This commit was manufactured by cvs2svn to create tag 'insight-
precleanup-2001-01-01'.

Sprout from gdb-premipsmulti-2000-06-06-branch 2000-06-05 20:49:54 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'gdb-'
Cherrypick from master 2000-12-27 17:47:20 UTC Alexandre Oliva <aoliva@redhat.com> '* Make-common.in (sim-io.o): Depend on targ-vals.h.':
    .cvsignore
    ChangeLog
    MAINTAINERS
    Makefile.in
    README-maintainer-mode
    bfd/ChangeLog
    bfd/MAINTAINERS
    bfd/Makefile.am
    bfd/Makefile.in
    bfd/acinclude.m4
    bfd/aclocal.m4
    bfd/aix386-core.c
    bfd/aout-adobe.c
    bfd/aout-arm.c
    bfd/aout-cris.c
    bfd/aout-encap.c
    bfd/aout-ns32k.c
    bfd/aout-target.h
    bfd/aout-tic30.c
    bfd/aoutf1.h
    bfd/aoutx.h
    bfd/archive.c
    bfd/archures.c
    bfd/armnetbsd.c
    bfd/bfd-in.h
    bfd/bfd-in2.h
    bfd/bfd.c
    bfd/binary.c
    bfd/bout.c
    bfd/cache.c
    bfd/cisco-core.c
    bfd/coff-a29k.c
    bfd/coff-alpha.c
    bfd/coff-apollo.c
    bfd/coff-arm.c
    bfd/coff-aux.c
    bfd/coff-h8300.c
    bfd/coff-h8500.c
    bfd/coff-i386.c
    bfd/coff-i860.c
    bfd/coff-i960.c
    bfd/coff-ia64.c
    bfd/coff-m68k.c
    bfd/coff-m88k.c
    bfd/coff-mcore.c
    bfd/coff-mips.c
    bfd/coff-pmac.c
    bfd/coff-ppc.c
    bfd/coff-rs6000.c
    bfd/coff-sh.c
    bfd/coff-sparc.c
    bfd/coff-stgo32.c
    bfd/coff-tic30.c
    bfd/coff-tic54x.c
    bfd/coff-tic80.c
    bfd/coff-w65.c
    bfd/coff-we32k.c
    bfd/coff-z8k.c
    bfd/coff64-rs6000.c
    bfd/coffcode.h
    bfd/coffgen.c
    bfd/cofflink.c
    bfd/coffswap.h
    bfd/config.bfd
    bfd/config.in
    bfd/configure
    bfd/configure.host
    bfd/configure.in
    bfd/corefile.c
    bfd/cpu-a29k.c
    bfd/cpu-alpha.c
    bfd/cpu-arm.c
    bfd/cpu-avr.c
    bfd/cpu-cris.c
    bfd/cpu-d10v.c
    bfd/cpu-h8300.c
    bfd/cpu-h8500.c
    bfd/cpu-hppa.c
    bfd/cpu-i370.c
    bfd/cpu-i386.c
    bfd/cpu-i860.c
    bfd/cpu-i960.c
    bfd/cpu-ia64-opc.c
    bfd/cpu-ia64.c
    bfd/cpu-m32r.c
    bfd/cpu-m68hc11.c
    bfd/cpu-m68hc12.c
    bfd/cpu-m68k.c
    bfd/cpu-m88k.c
    bfd/cpu-mips.c
    bfd/cpu-ns32k.c
    bfd/cpu-pj.c
    bfd/cpu-powerpc.c
    bfd/cpu-rs6000.c
    bfd/cpu-sh.c
    bfd/cpu-sparc.c
    bfd/cpu-tic54x.c
    bfd/cpu-v850.c
    bfd/cpu-vax.c
    bfd/cpu-w65.c
    bfd/cpu-we32k.c
    bfd/cpu-z8k.c
    bfd/doc/ChangeLog
    bfd/doc/Makefile.in
    bfd/doc/bfd.texinfo
    bfd/doc/bfdint.texi
    bfd/doc/chew.c
    bfd/dwarf1.c
    bfd/dwarf2.c
    bfd/ecoff.c
    bfd/ecofflink.c
    bfd/ecoffswap.h
    bfd/elf-bfd.h
    bfd/elf-hppa.h
    bfd/elf-m10200.c
    bfd/elf-m10300.c
    bfd/elf.c
    bfd/elf32-arm.h
    bfd/elf32-avr.c
    bfd/elf32-cris.c
    bfd/elf32-d10v.c
    bfd/elf32-d30v.c
    bfd/elf32-fr30.c
    bfd/elf32-hppa.c
    bfd/elf32-hppa.h
    bfd/elf32-i370.c
    bfd/elf32-i386.c
    bfd/elf32-i860.c
    bfd/elf32-i960.c
    bfd/elf32-m32r.c
    bfd/elf32-m68hc11.c
    bfd/elf32-m68hc12.c
    bfd/elf32-m68k.c
    bfd/elf32-mcore.c
    bfd/elf32-mips.c
    bfd/elf32-pj.c
    bfd/elf32-ppc.c
    bfd/elf32-sh-lin.c
    bfd/elf32-sh.c
    bfd/elf32-sparc.c
    bfd/elf32-v850.c
    bfd/elf64-alpha.c
    bfd/elf64-hppa.c
    bfd/elf64-hppa.h
    bfd/elf64-mips.c
    bfd/elf64-sparc.c
    bfd/elf64-x86-64.c
    bfd/elfcode.h
    bfd/elfcore.h
    bfd/elflink.c
    bfd/elflink.h
    bfd/elfxx-ia64.c
    bfd/elfxx-target.h
    bfd/epoc-pe-arm.c
    bfd/epoc-pei-arm.c
    bfd/format.c
    bfd/go32stub.h
    bfd/ieee.c
    bfd/libaout.h
    bfd/libbfd-in.h
    bfd/libbfd.c
    bfd/libbfd.h
    bfd/libcoff-in.h
    bfd/libcoff.h
    bfd/libhppa.h
    bfd/m68klinux.c
    bfd/m68knetbsd.c
    bfd/mipsbsd.c
    bfd/netbsd-core.c
    bfd/netbsd.h
    bfd/newsos3.c
    bfd/nlm-target.h
    bfd/nlm32-alpha.c
    bfd/nlm32-i386.c
    bfd/nlm32-ppc.c
    bfd/nlm32-sparc.c
    bfd/nlmcode.h
    bfd/nlmswap.h
    bfd/ns32knetbsd.c
    bfd/peicode.h
    bfd/peigen.c
    bfd/po/POTFILES.in
    bfd/po/bfd.pot
    bfd/reloc.c
    bfd/reloc16.c
    bfd/riscix.c
    bfd/rs6000-core.c
    bfd/sco5-core.c
    bfd/section.c
    bfd/som.c
    bfd/som.h
    bfd/sparclinux.c
    bfd/sparclynx.c
    bfd/sparcnetbsd.c
    bfd/srec.c
    bfd/stab-syms.c
    bfd/stabs.c
    bfd/sunos.c
    bfd/syms.c
    bfd/sysdep.h
    bfd/targets.c
    bfd/tekhex.c
    bfd/trad-core.c
    bfd/vaxnetbsd.c
    bfd/versados.c
    bfd/vms-gsd.c
    bfd/vms-hdr.c
    bfd/vms-misc.c
    bfd/vms-tir.c
    bfd/vms.c
    bfd/vms.h
    bfd/xcoff-target.h
    bfd/xcofflink.c
    config-ml.in
    config.guess
    config.if
    config.sub
    config/ChangeLog
    config/acinclude.m4
    config/mh-ia64pic
    config/mh-irix6
    config/mh-openedition
    config/mh-sparcpic
    config/mt-ia64pic
    config/mt-sparcpic
    configure
    configure.in
    gdb/ChangeLog
    gdb/MAINTAINERS
    gdb/Makefile.in
    gdb/NEWS
    gdb/README
    gdb/TODO
    gdb/a29k-tdep.c
    gdb/a68v-nat.c
    gdb/abug-rom.c
    gdb/acconfig.h
    gdb/acinclude.m4
    gdb/aclocal.m4
    gdb/alpha-nat.c
    gdb/alpha-tdep.c
    gdb/altos-xdep.c
    gdb/annotate.c
    gdb/arc-tdep.c
    gdb/arch-utils.c
    gdb/arch-utils.h
    gdb/arm-linux-tdep.c
    gdb/arm-tdep.c
    gdb/arm-xdep.c
    gdb/ax-gdb.c
    gdb/ax-general.c
    gdb/bcache.c
    gdb/blockframe.c
    gdb/breakpoint.c
    gdb/breakpoint.h
    gdb/buildsym.c
    gdb/c-lang.c
    gdb/c-typeprint.c
    gdb/c-valprint.c
    gdb/call-cmds.h
    gdb/ch-exp.c
    gdb/ch-lang.c
    gdb/ch-typeprint.c
    gdb/ch-valprint.c
    gdb/cli-out.c
    gdb/cli/cli-cmds.c
    gdb/cli/cli-cmds.h
    gdb/cli/cli-decode.c
    gdb/cli/cli-decode.h
    gdb/cli/cli-script.c
    gdb/cli/cli-script.h
    gdb/cli/cli-setshow.c
    gdb/cli/cli-setshow.h
    gdb/coff-solib.c
    gdb/coffread.c
    gdb/command.h
    gdb/complaints.c
    gdb/completer.c
    gdb/completer.h
    gdb/config.in
    gdb/config/alpha/alpha-linux.mh
    gdb/config/alpha/alpha-linux.mt
    gdb/config/alpha/alpha-osf3.mh
    gdb/config/alpha/fbsd.mh
    gdb/config/arm/linux.mh
    gdb/config/arm/linux.mt
    gdb/config/arm/tm-arm.h
    gdb/config/arm/tm-embed.h
    gdb/config/arm/tm-linux.h
    gdb/config/convex/tm-convex.h
    gdb/config/d10v/tm-d10v.h
    gdb/config/djgpp/config.sed
    gdb/config/djgpp/fnchange.lst
    gdb/config/h8300/tm-h8300.h
    gdb/config/i386/cygwin.mh
    gdb/config/i386/embed.mt
    gdb/config/i386/fbsd.mh
    gdb/config/i386/go32.mh
    gdb/config/i386/i386dgux.mh
    gdb/config/i386/i386gnu.mh
    gdb/config/i386/i386lynx.mh
    gdb/config/i386/i386sco5.mh
    gdb/config/i386/i386sol2.mh
    gdb/config/i386/i386sol2.mt
    gdb/config/i386/i386v4.mh
    gdb/config/i386/i386v42mp.mh
    gdb/config/i386/linux.mh
    gdb/config/i386/linux.mt
    gdb/config/i386/nbsd.mh
    gdb/config/i386/nbsd.mt
    gdb/config/i386/nbsdelf.mh
    gdb/config/i386/nbsdelf.mt
    gdb/config/i386/ncr3000.mt
    gdb/config/i386/nm-linux.h
    gdb/config/i386/ptx4.mh
    gdb/config/i386/sun386.mt
    gdb/config/i386/tm-cygwin.h
    gdb/config/i386/tm-embed.h
    gdb/config/i386/tm-i386.h
    gdb/config/i386/tm-linux.h
    gdb/config/ia64/linux.mh
    gdb/config/ia64/linux.mt
    gdb/config/ia64/nm-linux.h
    gdb/config/m68hc11/m68hc11.mt
    gdb/config/m68k/linux.mh
    gdb/config/m68k/linux.mt
    gdb/config/m68k/m68klynx.mh
    gdb/config/m68k/m68kv4.mh
    gdb/config/m68k/nbsd.mh
    gdb/config/m68k/nbsd.mt
    gdb/config/m68k/sun2os4.mt
    gdb/config/m68k/sun3os4.mt
    gdb/config/m68k/tm-altos.h
    gdb/config/m68k/tm-cisco.h
    gdb/config/m68k/tm-es1800.h
    gdb/config/m68k/tm-linux.h
    gdb/config/m68k/tm-m68k.h
    gdb/config/m68k/tm-m68kv4.h
    gdb/config/m68k/tm-sun3.h
    gdb/config/m68k/tm-vx68.h
    gdb/config/m88k/delta88v4.mh
    gdb/config/mcore/tm-mcore.h
    gdb/config/mips/irix4.mh
    gdb/config/mips/irix5.mh
    gdb/config/mips/mipsv4.mh
    gdb/config/mips/tm-bigmips.h
    gdb/config/mips/tm-bigmips64.h
    gdb/config/mips/tm-embed.h
    gdb/config/mips/tm-embed64.h
    gdb/config/mips/tm-embedl.h
    gdb/config/mips/tm-embedl64.h
    gdb/config/mips/tm-irix5.h
    gdb/config/mips/tm-mips.h
    gdb/config/mips/tm-mips64.h
    gdb/config/mips/tm-tx39.h
    gdb/config/mips/tm-tx39l.h
    gdb/config/mips/tm-vr4100.h
    gdb/config/mips/tm-vr4300.h
    gdb/config/mips/tm-vr4300el.h
    gdb/config/mips/tm-vr4xxx.h
    gdb/config/mips/tm-vr4xxxel.h
    gdb/config/mips/tm-vr5000.h
    gdb/config/mips/tm-vr5000el.h
    gdb/config/mn10300/tm-mn10300.h
    gdb/config/nm-lynx.h
    gdb/config/ns32k/nbsd.mh
    gdb/config/ns32k/nbsd.mt
    gdb/config/pa/hppabsd.mh
    gdb/config/pa/hppahpux.mh
    gdb/config/pa/hppaosf.mh
    gdb/config/pa/hpux1020.mh
    gdb/config/pa/hpux11.mh
    gdb/config/pa/hpux11w.mh
    gdb/config/pa/tm-hppa.h
    gdb/config/powerpc/aix.mh
    gdb/config/powerpc/aix.mt
    gdb/config/powerpc/cygwin.mh
    gdb/config/powerpc/cygwin.mt
    gdb/config/powerpc/linux.mh
    gdb/config/powerpc/linux.mt
    gdb/config/powerpc/macos.mt
    gdb/config/powerpc/nbsd.mh
    gdb/config/powerpc/nbsd.mt
    gdb/config/powerpc/nm-linux.h
    gdb/config/powerpc/ppc-eabi.mt
    gdb/config/powerpc/ppc-nw.mt
    gdb/config/powerpc/ppc-sim.mt
    gdb/config/powerpc/ppcle-eabi.mt
    gdb/config/powerpc/ppcle-sim.mt
    gdb/config/powerpc/solaris.mh
    gdb/config/powerpc/solaris.mt
    gdb/config/powerpc/tm-linux.h
    gdb/config/powerpc/tm-macos.h
    gdb/config/powerpc/tm-ppc-aix.h
    gdb/config/powerpc/tm-ppc-eabi.h
    gdb/config/powerpc/tm-ppc-nw.h
    gdb/config/powerpc/vxworks.mt
    gdb/config/rs6000/aix4.mh
    gdb/config/rs6000/aix4.mt
    gdb/config/rs6000/nm-rs6000.h
    gdb/config/rs6000/rs6000.mh
    gdb/config/rs6000/rs6000.mt
    gdb/config/rs6000/rs6000lynx.mh
    gdb/config/rs6000/rs6000lynx.mt
    gdb/config/rs6000/tm-rs6000.h
    gdb/config/rs6000/tm-rs6000ly.h
    gdb/config/sh/sh.mt
    gdb/config/sh/tm-linux.h
    gdb/config/sh/tm-sh.h
    gdb/config/sparc/linux.mh
    gdb/config/sparc/linux.mt
    gdb/config/sparc/nbsd.mh
    gdb/config/sparc/nbsd.mt
    gdb/config/sparc/nbsdelf.mh
    gdb/config/sparc/nm-nbsd.h
    gdb/config/sparc/sparclynx.mh
    gdb/config/sparc/sun4os4.mh
    gdb/config/sparc/sun4os4.mt
    gdb/config/sparc/sun4sol2.mh
    gdb/config/sparc/xm-sun4sol2.h
    gdb/config/tahoe/tm-tahoe.h
    gdb/config/tm-linux.h
    gdb/configure
    gdb/configure.host
    gdb/configure.in
    gdb/configure.tgt
    gdb/convex-tdep.c
    gdb/convex-xdep.c
    gdb/copying.awk
    gdb/copying.c
    gdb/core-aout.c
    gdb/core-regset.c
    gdb/core-sol2.c
    gdb/corefile.c
    gdb/corelow.c
    gdb/cp-valprint.c
    gdb/cpu32bug-rom.c
    gdb/cxux-nat.c
    gdb/d10v-tdep.c
    gdb/d30v-tdep.c
    gdb/dbug-rom.c
    gdb/dbxread.c
    gdb/dcache.c
    gdb/dcache.h
    gdb/defs.h
    gdb/delta68-nat.c
    gdb/demangle.c
    gdb/dink32-rom.c
    gdb/doc/ChangeLog
    gdb/doc/Makefile.in
    gdb/doc/gdb.texinfo
    gdb/doc/gdbint.texinfo
    gdb/doc/refcard.tex
    gdb/doc/stabs.texinfo
    gdb/dpx2-nat.c
    gdb/dsrec.c
    gdb/dst.h
    gdb/dstread.c
    gdb/dve3900-rom.c
    gdb/dwarf2read.c
    gdb/dwarfread.c
    gdb/elfread.c
    gdb/environ.c
    gdb/eval.c
    gdb/event-loop.c
    gdb/event-top.c
    gdb/exec.c
    gdb/expprint.c
    gdb/f-lang.c
    gdb/f-typeprint.c
    gdb/f-valprint.c
    gdb/findvar.c
    gdb/fork-child.c
    gdb/fr30-tdep.c
    gdb/gdb-events.c
    gdb/gdb-events.sh
    gdb/gdb-stabs.h
    gdb/gdb_assert.h
    gdb/gdb_proc_service.h
    gdb/gdb_thread_db.h
    gdb/gdbarch.c
    gdb/gdbarch.h
    gdb/gdbarch.sh
    gdb/gdbcmd.h
    gdb/gdbserver/configure
    gdb/gdbserver/configure.in
    gdb/gdbserver/gdbreplay.c
    gdb/gdbserver/low-hppabsd.c
    gdb/gdbserver/low-linux.c
    gdb/gdbserver/low-lynx.c
    gdb/gdbserver/low-nbsd.c
    gdb/gdbserver/low-sim.c
    gdb/gdbserver/low-sparc.c
    gdb/gdbserver/low-sun3.c
    gdb/gdbserver/remote-utils.c
    gdb/gdbserver/server.c
    gdb/gdbserver/utils.c
    gdb/gdbtypes.c
    gdb/gdbtypes.h
    gdb/gnu-nat.c
    gdb/go32-nat.c
    gdb/gregset.h
    gdb/h8300-tdep.c
    gdb/h8500-tdep.c
    gdb/hp-psymtab-read.c
    gdb/hp-symtab-read.c
    gdb/hp300ux-nat.c
    gdb/hppa-tdep.c
    gdb/hppab-nat.c
    gdb/hppah-nat.c
    gdb/hppam3-nat.c
    gdb/hpread.c
    gdb/hpux-thread.c
    gdb/i386-linux-nat.c
    gdb/i386-linux-tdep.c
    gdb/i386-stub.c
    gdb/i386-tdep.c
    gdb/i386aix-nat.c
    gdb/i386b-nat.c
    gdb/i386gnu-nat.c
    gdb/i386ly-tdep.c
    gdb/i386m3-nat.c
    gdb/i386mach-nat.c
    gdb/i386nbsd-nat.c
    gdb/i386nbsd-tdep.c
    gdb/i386v-nat.c
    gdb/i386v4-nat.c
    gdb/i387-nat.c
    gdb/i387-nat.h
    gdb/i387-tdep.c
    gdb/i960-tdep.c
    gdb/ia64-linux-nat.c
    gdb/ia64-tdep.c
    gdb/infcmd.c
    gdb/inferior.h
    gdb/inflow.c
    gdb/infptrace.c
    gdb/infrun.c
    gdb/inftarg.c
    gdb/infttrace.c
    gdb/irix4-nat.c
    gdb/irix5-nat.c
    gdb/jv-lang.c
    gdb/jv-typeprint.c
    gdb/jv-valprint.c
    gdb/kdb-start.c
    gdb/kod-cisco.c
    gdb/kod.c
    gdb/language.c
    gdb/language.h
    gdb/lin-lwp.c
    gdb/lin-thread.c
    gdb/linespec.c
    gdb/linespec.h
    gdb/linux-thread.c
    gdb/lynx-nat.c
    gdb/m2-lang.c
    gdb/m2-typeprint.c
    gdb/m2-valprint.c
    gdb/m3-nat.c
    gdb/m32r-rom.c
    gdb/m32r-stub.c
    gdb/m32r-tdep.c
    gdb/m68hc11-tdep.c
    gdb/m68k-stub.c
    gdb/m68k-tdep.c
    gdb/m68klinux-nat.c
    gdb/m68knbsd-nat.c
    gdb/m88k-nat.c
    gdb/m88k-tdep.c
    gdb/mac-nat.c
    gdb/mac-xdep.c
    gdb/main.c
    gdb/maint.c
    gdb/mcore-rom.c
    gdb/mcore-tdep.c
    gdb/mdebugread.c
    gdb/mem-break.c
    gdb/mi/ChangeLog
    gdb/mi/gdbmi.texinfo
    gdb/mi/mi-cmd-disas.c
    gdb/mi/mi-cmd-var.c
    gdb/mi/mi-cmds.c
    gdb/mi/mi-console.c
    gdb/mi/mi-main.c
    gdb/mi/mi-out.c
    gdb/mi/mi-parse.c
    gdb/minsyms.c
    gdb/mips-nat.c
    gdb/mips-tdep.c
    gdb/mipsm3-nat.c
    gdb/mipsread.c
    gdb/mipsv4-nat.c
    gdb/mn10200-tdep.c
    gdb/mn10300-tdep.c
    gdb/mon960-rom.c
    gdb/monitor.c
    gdb/monitor.h
    gdb/news-xdep.c
    gdb/nindy-tdep.c
    gdb/nlm/gdbserve.c
    gdb/nlm/i386.c
    gdb/nlm/ppc.c
    gdb/nlmread.c
    gdb/ns32k-tdep.c
    gdb/ns32km3-nat.c
    gdb/ns32knbsd-nat.c
    gdb/objfiles.c
    gdb/objfiles.h
    gdb/ocd.c
    gdb/op50-rom.c
    gdb/os9kread.c
    gdb/osfsolib.c
    gdb/p-exp.y
    gdb/p-lang.c
    gdb/p-lang.h
    gdb/p-typeprint.c
    gdb/p-valprint.c
    gdb/pa64solib.c
    gdb/parse.c
    gdb/partial-stab.h
    gdb/ppc-bdm.c
    gdb/ppc-linux-nat.c
    gdb/ppc-linux-tdep.c
    gdb/ppc-tdep.h
    gdb/ppcbug-rom.c
    gdb/ppcnbsd-nat.c
    gdb/printcmd.c
    gdb/proc-api.c
    gdb/proc-events.c
    gdb/proc-flags.c
    gdb/proc-service.c
    gdb/proc-why.c
    gdb/procfs.c
    gdb/ptx4-nat.c
    gdb/pyr-xdep.c
    gdb/rdi-share/ardi.c
    gdb/rdi-share/ardi.h
    gdb/regcache.c
    gdb/remote-adapt.c
    gdb/remote-array.c
    gdb/remote-bug.c
    gdb/remote-e7000.c
    gdb/remote-eb.c
    gdb/remote-es.c
    gdb/remote-est.c
    gdb/remote-hms.c
    gdb/remote-mips.c
    gdb/remote-mm.c
    gdb/remote-nindy.c
    gdb/remote-nrom.c
    gdb/remote-os9k.c
    gdb/remote-rdi.c
    gdb/remote-rdp.c
    gdb/remote-sds.c
    gdb/remote-sim.c
    gdb/remote-st.c
    gdb/remote-udi.c
    gdb/remote-utils.c
    gdb/remote-utils.h
    gdb/remote-vx.c
    gdb/remote-vx29k.c
    gdb/remote-vx68.c
    gdb/remote-vx960.c
    gdb/remote-vxmips.c
    gdb/remote-vxsparc.c
    gdb/remote.c
    gdb/rom68k-rom.c
    gdb/rs6000-nat.c
    gdb/rs6000-tdep.c
    gdb/scm-exp.c
    gdb/scm-lang.c
    gdb/scm-valprint.c
    gdb/ser-e7kpc.c
    gdb/ser-go32.c
    gdb/ser-mac.c
    gdb/ser-ocd.c
    gdb/ser-pipe.c
    gdb/ser-unix.c
    gdb/serial.c
    gdb/serial.h
    gdb/sh-stub.c
    gdb/sh-tdep.c
    gdb/sh3-rom.c
    gdb/sol-thread.c
    gdb/solib-svr4.c
    gdb/solib-svr4.h
    gdb/solib.c
    gdb/solist.h
    gdb/somread.c
    gdb/somsolib.c
    gdb/source.c
    gdb/sparc-nat.c
    gdb/sparc-stub.c
    gdb/sparc-tdep.c
    gdb/sparcl-stub.c
    gdb/sparcl-tdep.c
    gdb/sparclet-rom.c
    gdb/sparclet-stub.c
    gdb/stabsread.c
    gdb/stabsread.h
    gdb/stack.c
    gdb/standalone.c
    gdb/stop-gdb.c
    gdb/stuff.c
    gdb/sun3-nat.c
    gdb/sun386-nat.c
    gdb/symfile.c
    gdb/symfile.h
    gdb/symm-nat.c
    gdb/symm-tdep.c
    gdb/symmisc.c
    gdb/symtab.c
    gdb/symtab.h
    gdb/target.c
    gdb/target.h
    gdb/testsuite/ChangeLog
    gdb/testsuite/Makefile.in
    gdb/testsuite/config/gdbserver.exp
    gdb/testsuite/config/monitor.exp
    gdb/testsuite/configure
    gdb/testsuite/configure.in
    gdb/testsuite/gdb.asm/asm-source.exp
    gdb/testsuite/gdb.asm/asmsrc1.s
    gdb/testsuite/gdb.asm/d10v.inc
    gdb/testsuite/gdb.base/a2-run.exp
    gdb/testsuite/gdb.base/annota1.exp
    gdb/testsuite/gdb.base/break.exp
    gdb/testsuite/gdb.base/call-ar-st.exp
    gdb/testsuite/gdb.base/call-rt-st.exp
    gdb/testsuite/gdb.base/call-strs.exp
    gdb/testsuite/gdb.base/callfuncs.c
    gdb/testsuite/gdb.base/callfuncs.exp
    gdb/testsuite/gdb.base/commands.exp
    gdb/testsuite/gdb.base/constvars.exp
    gdb/testsuite/gdb.base/corefile.exp
    gdb/testsuite/gdb.base/display.exp
    gdb/testsuite/gdb.base/ending-run.exp
    gdb/testsuite/gdb.base/exprs.exp
    gdb/testsuite/gdb.base/finish.exp
    gdb/testsuite/gdb.base/maint.exp
    gdb/testsuite/gdb.base/mips_pro.exp
    gdb/testsuite/gdb.base/miscexprs.exp
    gdb/testsuite/gdb.base/pointers.exp
    gdb/testsuite/gdb.base/printcmds.exp
    gdb/testsuite/gdb.base/recurse.exp
    gdb/testsuite/gdb.base/reread.exp
    gdb/testsuite/gdb.base/restore.exp
    gdb/testsuite/gdb.base/return2.c
    gdb/testsuite/gdb.base/return2.exp
    gdb/testsuite/gdb.base/scope.exp
    gdb/testsuite/gdb.base/setvar.exp
    gdb/testsuite/gdb.base/shlib-call.exp
    gdb/testsuite/gdb.base/sizeof.c
    gdb/testsuite/gdb.base/sizeof.exp
    gdb/testsuite/gdb.base/so-impl-ld.exp
    gdb/testsuite/gdb.base/varargs.exp
    gdb/testsuite/gdb.base/watchpoint.exp
    gdb/testsuite/gdb.c++/Makefile.in
    gdb/testsuite/gdb.c++/classes.exp
    gdb/testsuite/gdb.c++/ctti.exp
    gdb/testsuite/gdb.c++/derivation.exp
    gdb/testsuite/gdb.c++/local.exp
    gdb/testsuite/gdb.c++/misc.cc
    gdb/testsuite/gdb.c++/namespace.cc
    gdb/testsuite/gdb.c++/namespace.exp
    gdb/testsuite/gdb.c++/overload.exp
    gdb/testsuite/gdb.c++/ovldbreak.exp
    gdb/testsuite/gdb.c++/ref-types.exp
    gdb/testsuite/gdb.c++/templates.exp
    gdb/testsuite/gdb.java/Makefile.in
    gdb/testsuite/gdb.java/configure
    gdb/testsuite/gdb.java/configure.in
    gdb/testsuite/gdb.java/jmisc.exp
    gdb/testsuite/gdb.java/jmisc.java
    gdb/testsuite/gdb.java/jv-exp.exp
    gdb/testsuite/lib/gdb.exp
    gdb/testsuite/lib/java.exp
    gdb/testsuite/lib/mi-support.exp
    gdb/thread-db.c
    gdb/thread.c
    gdb/tic80-tdep.c
    gdb/top.c
    gdb/top.h
    gdb/tracepoint.c
    gdb/tracepoint.h
    gdb/tui/ChangeLog
    gdb/tui/tui-file.c
    gdb/tui/tui.c
    gdb/tui/tuiData.c
    gdb/tui/tuiIO.c
    gdb/tui/tuiLayout.c
    gdb/tui/tuiRegs.c
    gdb/tui/tuiSourceWin.h
    gdb/tui/tuiStack.c
    gdb/tui/tuiWin.c
    gdb/typeprint.c
    gdb/ui-file.c
    gdb/ui-out.c
    gdb/ultra3-nat.c
    gdb/ultra3-xdep.c
    gdb/umax-xdep.c
    gdb/utils.c
    gdb/v850-tdep.c
    gdb/v850ice.c
    gdb/valarith.c
    gdb/valops.c
    gdb/valprint.c
    gdb/value.h
    gdb/values.c
    gdb/varobj.c
    gdb/vax-tdep.c
    gdb/w65-tdep.c
    gdb/w89k-rom.c
    gdb/win32-nat.c
    gdb/wince.c
    gdb/wrapper.c
    gdb/wrapper.h
    gdb/xcoffread.c
    gdb/xcoffsolib.c
    gdb/xcoffsolib.h
    gdb/xmodem.c
    gdb/z8k-tdep.c
    gettext.m4
    include/COPYING
    include/ChangeLog
    include/MAINTAINERS
    include/alloca-conf.h
    include/ansidecl.h
    include/bfdlink.h
    include/coff/ChangeLog
    include/coff/pe.h
    include/coff/ti.h
    include/demangle.h
    include/dis-asm.h
    include/dyn-string.h
    include/elf/ChangeLog
    include/elf/alpha.h
    include/elf/arc.h
    include/elf/arm.h
    include/elf/avr.h
    include/elf/common.h
    include/elf/cris.h
    include/elf/d10v.h
    include/elf/d30v.h
    include/elf/fr30.h
    include/elf/hppa.h
    include/elf/i370.h
    include/elf/i386.h
    include/elf/i860.h
    include/elf/i960.h
    include/elf/ia64.h
    include/elf/internal.h
    include/elf/m32r.h
    include/elf/m68hc11.h
    include/elf/m68k.h
    include/elf/mcore.h
    include/elf/mips.h
    include/elf/mn10200.h
    include/elf/mn10300.h
    include/elf/pj.h
    include/elf/ppc.h
    include/elf/reloc-macros.h
    include/elf/sh.h
    include/elf/sparc.h
    include/elf/v850.h
    include/elf/x86-64.h
    include/getopt.h
    include/hashtab.h
    include/libiberty.h
    include/md5.h
    include/obstack.h
    include/opcode/ChangeLog
    include/opcode/avr.h
    include/opcode/cgen.h
    include/opcode/cris.h
    include/opcode/hppa.h
    include/opcode/i386.h
    include/opcode/i860.h
    include/opcode/ia64.h
    include/opcode/m68hc11.h
    include/opcode/mips.h
    include/opcode/sparc.h
    include/os9k.h
    include/safe-ctype.h
    include/sort.h
    include/splay-tree.h
    include/symcat.h
    libiberty/ChangeLog
    libiberty/Makefile.in
    libiberty/aclocal.m4
    libiberty/argv.c
    libiberty/basename.c
    libiberty/bsearch.c
    libiberty/choose-temp.c
    libiberty/config.in
    libiberty/config.table
    libiberty/config/mh-openedition
    libiberty/configure
    libiberty/configure.in
    libiberty/cp-demangle.c
    libiberty/cplus-dem.c
    libiberty/dyn-string.c
    libiberty/fnmatch.c
    libiberty/getcwd.c
    libiberty/getruntime.c
    libiberty/hashtab.c
    libiberty/md5.c
    libiberty/memcmp.c
    libiberty/mkstemps.c
    libiberty/partition.c
    libiberty/pexecute.c
    libiberty/rename.c
    libiberty/safe-ctype.c
    libiberty/setenv.c
    libiberty/sigsetmask.c
    libiberty/sort.c
    libiberty/splay-tree.c
    libiberty/strncmp.c
    libiberty/strtod.c
    libiberty/strtol.c
    libiberty/strtoul.c
    libiberty/testsuite/demangle-expected
    libiberty/testsuite/regress-demangle
    libiberty/vasprintf.c
    libiberty/vfork.c
    libiberty/waitpid.c
    libiberty/xexit.c
    libiberty/xmalloc.c
    libtool.m4
    ltcf-c.sh
    ltcf-cxx.sh
    ltcf-gcj.sh
    ltconfig
    ltmain.sh
    opcodes/ChangeLog
    opcodes/MAINTAINERS
    opcodes/Makefile.am
    opcodes/Makefile.in
    opcodes/acinclude.m4
    opcodes/aclocal.m4
    opcodes/arm-dis.c
    opcodes/arm-opc.h
    opcodes/avr-dis.c
    opcodes/cgen-asm.c
    opcodes/cgen-asm.in
    opcodes/cgen-dis.c
    opcodes/cgen-dis.in
    opcodes/cgen-ibld.in
    opcodes/cgen-opc.c
    opcodes/cgen.sh
    opcodes/config.in
    opcodes/configure
    opcodes/configure.in
    opcodes/cris-dis.c
    opcodes/cris-opc.c
    opcodes/d30v-opc.c
    opcodes/disassemble.c
    opcodes/fr30-asm.c
    opcodes/fr30-desc.c
    opcodes/fr30-desc.h
    opcodes/fr30-dis.c
    opcodes/fr30-ibld.c
    opcodes/fr30-opc.c
    opcodes/fr30-opc.h
    opcodes/h8300-dis.c
    opcodes/h8500-dis.c
    opcodes/hppa-dis.c
    opcodes/i860-dis.c
    opcodes/ia64-asmtab.c
    opcodes/ia64-dis.c
    opcodes/ia64-gen.c
    opcodes/ia64-ic.tbl
    opcodes/ia64-opc-f.c
    opcodes/ia64-opc-m.c
    opcodes/ia64-opc.c
    opcodes/ia64-opc.h
    opcodes/ia64-raw.tbl
    opcodes/ia64-war.tbl
    opcodes/ia64-waw.tbl
    opcodes/m32r-asm.c
    opcodes/m32r-desc.c
    opcodes/m32r-desc.h
    opcodes/m32r-dis.c
    opcodes/m32r-ibld.c
    opcodes/m32r-opc.c
    opcodes/m68hc11-dis.c
    opcodes/m68hc11-opc.c
    opcodes/mcore-dis.c
    opcodes/mips-dis.c
    opcodes/mips-opc.c
    opcodes/mips16-opc.c
    opcodes/po/POTFILES.in
    opcodes/po/opcodes.pot
    opcodes/ppc-opc.c
    opcodes/sh-dis.c
    opcodes/sh-opc.h
    opcodes/sparc-dis.c
    opcodes/sparc-opc.c
    opcodes/tic30-dis.c
    opcodes/tic54x-dis.c
    opcodes/tic80-dis.c
    opcodes/w65-dis.c
    opcodes/z8k-dis.c
    readline/CHANGELOG
    readline/CHANGES
    readline/COPYING
    readline/ChangeLog.Cygnus
    readline/INSTALL
    readline/MANIFEST
    readline/Makefile.in
    readline/README
    readline/acconfig.h
    readline/aclocal.m4
    readline/ansi_stdlib.h
    readline/bind.c
    readline/callback.c
    readline/chardefs.h
    readline/complete.c
    readline/config.h.bot
    readline/config.h.in
    readline/configure
    readline/configure.in
    readline/cross-build/cygwin.cache
    readline/display.c
    readline/doc/ChangeLog
    readline/doc/Makefile.in
    readline/doc/hist.texinfo
    readline/doc/hstech.texinfo
    readline/doc/hsuser.texinfo
    readline/doc/inc-hist.texinfo
    readline/doc/manvers.texinfo
    readline/doc/readline.3
    readline/doc/rlman.texinfo
    readline/doc/rltech.texinfo
    readline/doc/rluser.texinfo
    readline/doc/texi2dvi
    readline/doc/texi2html
    readline/emacs_keymap.c
    readline/examples/ChangeLog.Cygnus
    readline/examples/Inputrc
    readline/examples/Makefile.in
    readline/examples/fileman.c
    readline/examples/histexamp.c
    readline/examples/manexamp.c
    readline/examples/rl.c
    readline/examples/rltest.c
    readline/examples/rlversion.c
    readline/funmap.c
    readline/histexpand.c
    readline/histfile.c
    readline/histlib.h
    readline/history.c
    readline/history.h
    readline/histsearch.c
    readline/input.c
    readline/isearch.c
    readline/keymaps.c
    readline/keymaps.h
    readline/kill.c
    readline/macro.c
    readline/nls.c
    readline/parens.c
    readline/posixdir.h
    readline/posixjmp.h
    readline/posixstat.h
    readline/readline.c
    readline/readline.h
    readline/rlconf.h
    readline/rldefs.h
    readline/rlstdc.h
    readline/rltty.c
    readline/rltty.h
    readline/rlwinsize.h
    readline/savestring.c
    readline/search.c
    readline/shell.c
    readline/shlib/Makefile.in
    readline/signals.c
    readline/support/config.guess
    readline/support/config.sub
    readline/support/install.sh
    readline/support/mkdirs
    readline/support/mkdist
    readline/support/shlib-install
    readline/support/shobj-conf
    readline/tcap.h
    readline/terminal.c
    readline/tilde.c
    readline/tilde.h
    readline/undo.c
    readline/util.c
    readline/vi_keymap.c
    readline/vi_mode.c
    readline/xmalloc.c
    sim/ChangeLog
    sim/MAINTAINERS
    sim/arm/ChangeLog
    sim/arm/armcopro.c
    sim/arm/armdefs.h
    sim/arm/armemu.c
    sim/arm/armemu.h
    sim/arm/arminit.c
    sim/arm/armos.c
    sim/arm/armrdi.c
    sim/arm/armsupp.c
    sim/arm/armvirt.c
    sim/arm/thumbemu.c
    sim/arm/wrapper.c
    sim/common/ChangeLog
    sim/common/Make-common.in
    sim/common/Makefile.in
    sim/common/cgen-ops.h
    sim/common/cgen-scache.c
    sim/common/cgen-trace.c
    sim/common/cgen-types.h
    sim/common/cgen-utils.c
    sim/common/cgen.sh
    sim/common/dv-core.c
    sim/common/dv-sockser.c
    sim/common/genmloop.sh
    sim/common/hw-alloc.c
    sim/common/hw-base.c
    sim/common/hw-base.h
    sim/common/hw-events.c
    sim/common/hw-events.h
    sim/common/hw-properties.h
    sim/common/nrun.c
    sim/common/run.1
    sim/common/sim-bits.c
    sim/common/sim-bits.h
    sim/common/sim-endian.h
    sim/common/sim-events.c
    sim/common/sim-events.h
    sim/common/sim-fpu.c
    sim/common/sim-fpu.h
    sim/common/sim-hw.c
    sim/common/sim-options.c
    sim/common/sim-profile.c
    sim/common/sim-profile.h
    sim/common/sim-trace.h
    sim/common/sim-types.h
    sim/configure
    sim/configure.in
    sim/d30v/ChangeLog
    sim/d30v/d30v-insns
    sim/fr30/ChangeLog
    sim/fr30/Makefile.in
    sim/fr30/cpu.h
    sim/fr30/decode.c
    sim/fr30/sem-switch.c
    sim/fr30/sem.c
    sim/h8300/ChangeLog
    sim/h8300/compile.c
    sim/h8300/writecode.c
    sim/i960/ChangeLog
    sim/i960/Makefile.in
    sim/m32r/ChangeLog
    sim/m32r/Makefile.in
    sim/m32r/cpu.h
    sim/m32r/cpux.h
    sim/m32r/decode.c
    sim/m32r/decodex.c
    sim/m32r/model.c
    sim/m32r/modelx.c
    sim/m32r/sem-switch.c
    sim/m32r/sem.c
    sim/m32r/semx-switch.c
    sim/m68hc11/ChangeLog
    sim/m68hc11/Makefile.in
    sim/m68hc11/config.in
    sim/m68hc11/configure
    sim/m68hc11/configure.in
    sim/m68hc11/dv-m68hc11.c
    sim/m68hc11/dv-m68hc11eepr.c
    sim/m68hc11/dv-m68hc11sio.c
    sim/m68hc11/dv-m68hc11spi.c
    sim/m68hc11/dv-m68hc11tim.c
    sim/m68hc11/dv-nvram.c
    sim/m68hc11/emulos.c
    sim/m68hc11/gencode.c
    sim/m68hc11/interp.c
    sim/m68hc11/interrupts.c
    sim/m68hc11/interrupts.h
    sim/m68hc11/m68hc11_sim.c
    sim/m68hc11/sim-main.h
    sim/mips/ChangeLog
    sim/mips/Makefile.in
    sim/mips/m16.igen
    sim/mips/mips.igen
    sim/mips/sim-main.h
    sim/mn10300/ChangeLog
    sim/mn10300/am33.igen
    sim/ppc/ChangeLog
    sim/ppc/ppc-instructions
    sim/ppc/sim-endian.h
    sim/ppc/sim_calls.c
    sim/sh/ChangeLog
    sim/sh/Makefile.in
    sim/sh/gencode.c
    sim/testsuite/ChangeLog
    sim/testsuite/lib/sim-defs.exp
    sim/tic80/ChangeLog
    sim/tic80/Makefile.in
    sim/tic80/acconfig.h
    sim/tic80/alu.h
    sim/tic80/config.in
    sim/tic80/configure
    sim/tic80/configure.in
    sim/tic80/cpu.h
    sim/tic80/interp.c
    sim/tic80/misc.c
    sim/tic80/sim-calls.c
    sim/tic80/sim-main.h
    sim/tic80/tic80.dc
    sim/tic80/tic80.ic
    sim/tic80/tic80.igen
    symlink-tree
    texinfo/texinfo.tex
Cherrypick from FSF 2000-07-09 16:21:23 UTC Elena Zannoni <ezannoni@kwikemart.cygnus.com> 'Import of readline 4.1':
    readline/USAGE
    readline/doc/rluserman.texinfo
    readline/examples/excallback.c
    readline/examples/rlfe.c
    readline/rlprivate.h
    readline/rlshell.h
    readline/xmalloc.h
Delete:
    bfd/elf64-ia64.c
    bfd/hppa_stubs.h
    gdb/command.c
    gdb/config/nm-empty.h
    gdb/gdba.el
    gdb/testsuite/gdb.hp/gdb.aCC/namespace.cc
    gdb/testsuite/gdb.hp/gdb.aCC/namespace.exp
    libiberty/acconfig.h
diff --git a/.cvsignore b/.cvsignore
index dab6c32..bde4852 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -28,3 +28,5 @@
 dir.info
 Makefile
 lost+found
+update.out
+
diff --git a/ChangeLog b/ChangeLog
index 0077cc9..23bd05a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,226 @@
+2000-12-12  Alexandre Oliva  <aoliva@redhat.com>
+
+	* configure.in: Disable language-specific target libraries for
+	languages that aren't enabled.
+
+2000-11-24  Nick Clifton  <nickc@redhat.com>
+
+	* configure.in (xscale-elf): Add target.
+	(xscale-coff): Add target.
+	(c4x, c5x, tic54x): Move after ARM targets.
+
+2000-11-23  Alexandre Oliva  <aoliva@redhat.com>
+
+	* ltcf-gcj.sh: Added file, required by 2000-11-18 merge.
+
+2000-11-20  Ian Lance Taylor  <ian@zembu.com>
+
+	* ltcf-cxx.sh: Added file, required by 2000-11-18 merge.
+
+2000-11-18  Alexandre Oliva  <aoliva@redhat.com>
+
+	* Makefile.in: Merge with GCC and libgcj.
+	(ALL_GCC_C, ALL_GCC_CXX): New macros.  Use them as dependencies of
+	configure-target-<library> when their configure scripts need the C
+	or C++ library to have already been built to work properly.
+	(do_proto_toplev): Set them to an empty string.
+
+Sat Nov 18 18:57:50 2000  Alexandre Oliva  <aoliva@redhat.com>
+
+	* Makefile.in (HOST_LIB_PATH, TARGET_LIB_PATH): New macros.
+	(REALLY_SET_LIB_PATH): Use them.
+
+Mon Nov  6 14:19:35 2000  Christopher Faylor <cgf@cygnus.com>
+
+	* config.sub: Add support for Sun Chorus
+
+2000-11-02  Per Lundberg  <plundis@chaosdev.org>
+
+	* config.sub: Add support for the *-storm-chaos OS.
+
+2000-10-30  Stephane Carrez  <stcarrez@worldnet.fr>
+
+        * configure.in (noconfigdirs): Don't compile some
+        of the libraries for 68HC11 & 68hc12 targets.
+
+2000-09-30  Alexandre Oliva  <aoliva@redhat.com>
+
+	* ltconfig, ltmain.sh, libtool.m4: Updated from libtool
+	multi-language branch, to work around Solaris' /bin/sh bug.  Rebuilt
+	all affected `configure' scripts.
+
+2000-09-25  Alexandre Oliva  <aoliva@redhat.com>
+
+	* Makefile.in (DEVO_SUPPORT): Added gettext.m4, libtool.m4 and
+	ltcf-c.sh.
+
+2000-09-12  Philip Blundell  <philb@gnu.org>
+
+	* config.sub, config.guess: Update from subversions.
+
+2000-09-06  Alexandre Oliva  <aoliva@redhat.com>
+
+	* Makefile.in (all-zlib): Added dummy target.
+
+	* ltconfig, ltmain.sh, libtool.m4, ltcf-c.sh: Updated from libtool
+	multi-language branch.
+
+2000-09-05  Alexandre Oliva  <aoliva@redhat.com>
+
+	* Makefile.in (all-bootstrap): Added all-texinfo and all-zlib.
+	(bootstrap*): Depend on all-bootstrap.
+
+2000-09-02  Alexandre Oliva  <aoliva@redhat.com>, DJ Delorie  <dj@redhat.com>
+
+	* configure.in (FLAGS_FOR_TARGET): Use -nostdinc even for Canadian
+	crosses, but add gcc/include to the header search path for them.
+
+2000-08-31  Alexandre Oliva  <aoliva@redhat.com>
+
+	* ltconfig, ltmain.sh: Updated from libtool multi-language branch.
+	* libtool.m4, ltcf-c.sh: Copied from libtool multi-language branch.
+	* gettext.m4: New file, extracted from aclocal.m4.
+
+2000-08-22  Alexandre Oliva  <aoliva@redhat.com>
+
+	* config-ml.in (CC, CXX): Avoid trailing whitespace.
+	(LD_LIBRARY_PATH, SHLIB_PATH): Adjust for multilibs and export to
+	sub-configures.
+
+2000-08-20  Doug Evans  <dje@casey.transmeta.com>
+
+	* Makefile.in (ALL_MODULES): Add all-cgen.
+	(CROSS_CHECK_MODULES,INSTALL_MODULES,CLEAN_MODULES): Similarily.
+	(all-cgen): New target.
+	(all-opcodes,all-sim): Depend on all-cgen.
+	* configure.in (host_tools): Add cgen.
+	Only configure cgen if --enable-cgen-maint.
+
+2000-08-17  Alexandre Oliva  <aoliva@redhat.com>
+
+	* config-ml.in (CC, CXX): Don't introduce a leading space.
+
+2000-08-16  Alexandre Oliva  <aoliva@redhat.com>
+
+	* configure.in (libstdcxx_flags): Use
+	libstdc++-v3/src/libstdc++.INC.
+
+2000-08-15  Alexandre Oliva  <aoliva@redhat.com>
+
+	* configure.in (libstdcxx_flags): Use libstdc++-v3/src/INCLUDES.
+
+2000-08-11  Jason Merrill  <jason@redhat.com>
+
+	* configure.in (CC_FOR_TARGET, CHILL_FOR_TARGET,
+	CXX_FOR_TARGET): Add -B$$r/gcc/ here.
+	(FLAGS_FOR_TARGET): Not here.
+	(CHILL_FOR_TARGET, CXX_FOR_TARGET): Don't check the list of languages.
+
+2000-08-07  DJ Delorie  <dj@redhat.com>
+
+	* configure.in (FLAGS_FOR_TARGET): invert test for xgcc, should mean
+	"if we're also building gcc, and it's a gcc that will run on the
+	build machine, we want to use its includes instead of the system's
+	default includes".
+
+2000-08-03  Alexandre Oliva  <aoliva@redhat.com>
+
+	* configure.in (libstdcxx_flags): Don't use `"'.
+
+	* config-ml.in: Adjust multilib search paths to the
+	appropriate multilib tree.
+
+2000-08-02  Alexandre Oliva  <aoliva@redhat.com>
+
+	* configure.in (CHILL_FOR_TARGET, CXX_FOR_TARGET): Convert blanks to
+	commas in $LANGUAGES.
+
+2000-08-01  Alexandre Oliva  <aoliva@redhat.com>
+
+	* configure.in (qCXX_FOR_TARGET): Use echo instead of expr.
+
+2000-07-31  Alexandre Oliva  <aoliva@redhat.com>
+
+	* configure.in (qCXX_FOR_TARGET): Quote `&' characters in
+	CXX_FOR_TARGET for sed.
+
+2000-07-30  Alexandre Oliva  <aoliva@redhat.com>
+
+	* configure.in (CC_FOR_TARGET, CHILL_FOR_TARGET, CXX_FOR_TARGET):
+	Do not override if already set in the environment or in configure.
+	Don't duplicate $(FLAGS_FOR_TARGET) if it already appears in them.
+	(FLAGS_FOR_TARGET): Don't use host directories on Canadian crosses.
+
+2000-07-27  Alexandre Oliva  <aoliva@redhat.com>
+
+	* Makefile.in (FLAGS_FOR_TARGET): New macro.
+	(GCC_FOR_TARGET): Use it.
+	(CC_FOR_TARGET, CXX_FOR_TARGET, CHILL_FOR_TARGET): Now defined...
+	* configure.in: ... here.
+	(FLAGS_FOR_TARGET): Define.  Add ld build dir to -L path.
+	(libstdcxx_flags): Define and append to CXX_FOR_TARGET.
+
+2000-07-24  Alexandre Oliva  <aoliva@redhat.com>
+
+	* Makefile.in (configure-target-libf2c): Depend on $(ALL_GCC).
+	(configure-target-libchill, configure-target-libobjc): Likewise.
+
+	* configure.in: Use the same cache file for all target libs.
+	* config-ml.in: But different cache files per multilib variant.
+
+2000-07-23  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
+
+	* configure (topsrcdir): Don't use dirname.
+
+2000-07-20  Jason Merrill  <jason@redhat.com>
+
+	* configure.in: Remove all references to libg++ and librx.
+
+	* configure, configure.in, Makefile.in: Unify gcc and binutils.
+
+2000-07-20  Hans-Peter Nilsson  <hp@axis.com>
+
+	* config.sub: Update to subversions version 2000-07-06.
+
+2000-07-12  Andrew Haley  <aph@cygnus.com>
+
+	* configure.in (host_makefile_frag): Use mh-ia64pic on IA-64 hosts.
+	(target_makefile_frag): Use mt-ia64pic on IA-64 targets.
+
+2000-07-07  Phil Edwards  <pme@sourceware.cygnus.com>
+
+	* symlink-tree:  Check number of arguments.
+
+Thu Jul  6 15:36:55 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* texinfo/texinfo.tex: Update to version 2000-05-28.15.
+
+2000-07-05  Jim Wilson  <wilson@cygnus.com>
+
+	* Makefile.in (CXX_FOR_TARGET): Add libstdc++ to the library
+	search path for a g++ extracted from the build tree.  This
+	will allow link tests run by configure scripts in
+	subdirectories to succeed.
+
+2000-07-01  Koundinya K  <kk@ddeorg.soft.net>
+
+        * ltconfig: Add support for mips-dde-sysv4.2MP
+	
+2000-06-28  Corinna Vinschen  <vinschen@cygnus.com>
+
+	* ltconfig: Check for host_os beeing one of `cygwin', `mingw' or
+	`os2'. Force ac_cv_exeext to be ".exe" in that case.
+
+2000-06-19  Timothy Wall  <twall@cygnus.com>
+
+	* configure.in (noconfigdirs): Set noconfigdirs for tic54x target.
+	* config.sub: Add tic54x target.
+
+2000-06-07  Phillip Thomas  <pthomas@suse.de>
+
+	* README-maintainer-mode: New file: Contains notes on using
+	--enable-maintainer-mode with binutils.
+
 Mon May 29 13:50:03 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* texinfo/texinfo.tex: Update. Version from makeinfo 4.0.
@@ -9,8 +232,6 @@
 
 20000-05-21  H.J. Lu  (hjl@gnu.org)
 
-	* configure: Revert changes made on May 18 and May 19.
-
         * Makefile.in (CC_FOR_TARGET): Make sure as/ld in the gcc
         directory are used if they exist. Make sure
         $(build_tooldir)/include is searched for header files,
@@ -18,29 +239,20 @@
 	(GCC_FOR_TARGET): Likewise.
         (CXX_FOR_TARGET): Likewise.
 
-20000-05-19  H.J. Lu  (hjl@gnu.org)
-
-	* configure: Provide --disable-target-dir-sanity-checking to
-	disable the gcc directory checking for cross compiling.
-
-20000-05-18  H.J. Lu  (hjl@gnu.org)
-
-	* configure: Ask to create the gcc directory for cross
-	compiling if necessary.
-
 Thu May 18 10:58:13 2000  Jeffrey A Law  (law@cygnus.com)
 
 	* configure.in (hppa*64*-*-*): Do build ld for this configuration.
 
-2000-05-18  David Edelsohn  <edelsohn@gnu.org>
-
-	* configure.in: Special case powerpc*-*-aix* target_makefile_frag.
-
 Wed May 17 16:03:48 2000  Alexandre Oliva  <aoliva@cygnus.com>
 
 	* Makefile.in (configure-target-libiberty): Depend on
 	configure-target-newlib.
 
+2000-05-16  Alexandre Oliva  <aoliva@cygnus.com>
+
+	* configure.in, Makefile.in: Merge all libffi-related
+	configury stuff from the libgcj tree.
+
 Tue May 16 10:06:21 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	Thu Apr 27 11:01:48 2000 Andrew Cagney <cagney@b1.cygnus.com>:
@@ -53,6 +265,10 @@
  	current version information.  Add to proto-toplev directory.
 	(gdb-taz): Build do-djunpack.
 
+2000-05-15  David Edelsohn  <edelsohn@gnu.org>
+
+	* configure.in: Special case powerpc*-*-aix* target_makefile_frag.
+
 2000-05-13 Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
 
 	* ltmain.sh: Preserve in relink_command any environment
@@ -71,14 +287,14 @@
 	* djunpack.bat: Change the Sed script to replace @V@ in fnchange.lst
         with the version name.
 
+2000-05-01  Benjamin Kosnik  <bkoz@cygnus.com>
+
+	* config.if: Tweak.
+
 2000-04-23  Eli Zaretskii  <eliz@is.elta.co.il>
 
 	* djunpack.bat: New file.
 
-2000-04-21  Michael Meissner  <meissner@redhat.com>
-
-	* config.sub (d30v): Add d30v as a basic machine type.
-
 Wed Apr 19 12:46:26 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* Makefile.in (taz, gdb-taz, gas.tar.bz2, binutils.tar.bz2,
@@ -86,6 +302,11 @@
  	dejagnu.tar.bz2, gdb+dejagnu.tar.bz2, insight.tar.bz2,
  	insight+dejagnu.tar.bz2, newlib.tar.bz2): Pass MD5PROG to sub-make.
 
+2000-04-16  Dave Pitts  <dpitts@cozx.com>
+
+        * config.sub (case $basic_machine): Change default for "ibm-*"
+        to "openedition".
+
 Wed Apr 12 16:42:48 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* Makefile.in (gdb-taz): New target.  GDB specific archive.
@@ -104,24 +325,23 @@
 
 	* configure (warn_cflags): Delete.
 
-2000-03-30  Christopher Faylor  <cgf@cygnus.com>
+2000-04-05  Benjamin Kosnik  <bkoz@cygnus.com>
+            Martin v. Loewis  <martin@loewis.home.cs.tu-berlin.de>
 
-	* Makefile.in (CC_FOR_TARGET): Add new winsup directory
-	structure stuff to -L library search.
-	(CXX_FOR_TARGET): Ditto.
+        * configure.in (enable_libstdcxx_v3): Add.
+        (target_libs): Add bits here to switch between libstdc++-v2 and
+        libstdc++-v3.
+        * config.if: And this file too.
+        * Makefile.in: Add libstdc++-v3 targets.
+	
+2000-04-05  Michael Meissner  <meissner@redhat.com>
+
+	* config.sub (d30v): Add d30v as a basic machine type.
 
 2000-03-29  Jason Merrill  <jason@casey.cygnus.com>
 
 	* configure.in: -linux-gnu*, not -linux-gnu.
 
-2000-03-10  H.J. Lu  <hjl@gnu.org>
-
-	* Makefile.in (all-gcc): Backed out the last change.
-
-2000-03-10  H.J. Lu  <hjl@gnu.org>
-
-	* Makefile.in (all-gcc): Run ld/ld-new if necessary.
-
 Fri Mar  3 18:44:08 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* Makefile.in (taz): Set PACKAGE to TOOL when not defined.
@@ -166,11 +386,68 @@
 	* configure (gcc_version): When setting, narrow search to
 	lines containing `version_string'.
 
+2000-02-15  Denis Chertykov  <denisc@overta.ru>
+
+	* config.sub: Add support for avr target.
+
+Tue Feb  1 00:07:46 2000  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* config.sub: Add mmix-knuth-mmixware.
+
+2000-01-27  Christopher Faylor <cgf@redhat.com>
+
+	* Makefile.in (CC_FOR_TARGET): Add new winsup directory
+	structure stuff to -L library search.
+	(CXX_FOR_TARGET): Ditto.
+	(CROSS_CHECK_MODULES): Fix spelling mistake.
+
+2000-01-24  Mark Mitchell  <mark@codesourcery.com>
+
+	* Makefile.in (CXX_FOR_TARGET): Use g++, not xgcc, to invoke
+	the C++ compiler.
+
+2000-01-12  Richard Henderson  <rth@cygnus.com>
+
+	* configure.in: Don't build some bits for beos.
+
+2000-01-12  Joel Sherrill (joel@OARcorp.com)
+
+	* Makefile.in (CC_FOR_TARGET): Use newlib libraries as well
+	as include files.
+
 2000-01-06  Geoff Keating  <geoffk@cygnus.com>
 
 	* configure.in: Use mt-aix43 to handle *_TARGET defs,
 	not mh-aix43.
 
+1999-12-14  Richard Henderson  <rth@cygnus.com>
+
+	* config.guess (alpha-osf, alpha-linux): Detect ev67.
+	* config.sub: Accept alphaev[78], alphaev8.
+
+1999-12-03  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
+
+	* config.guess, config.sub: Update from autoconf.
+
+Tue Nov 23 00:57:41 1999  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+	* config-ml.in (sparc*-*-*): Disable sparcv9 support if the
+	necessary libraries are missing.
+
+1999-10-25  Andreas Schwab  <schwab@suse.de>
+
+	* configure: Fix quoting inside arguments of eval.
+
+1999-10-21  Nick Clifton  <nickc@cygnus.com>
+
+	* config-ml.in: Allow suppression of some ARM multilibs.
+
+Tue Sep  7 23:33:57 1999  Linas Vepstas  <linas@linas.org>
+
+	* config.guess: Add OS/390 match pattern.
+	* config.sub: Add mvs, openedition targets.
+	* configure.in (i370-ibm-opened*): New.
+
 1999-09-04  Steve Chamberlain  <sac@pobox.com>
 
 	* config.sub: Add support for configuring for pj.
@@ -179,11 +456,16 @@
 
 	* config.sub (maybe_os): Add support for configuring for fr30.
 
-1999-08-27  Nick Clifton  <nickc@cygnus.com>
+1999-08-25  Nick Clifton  <nickc@cygnus.com>
 
 	* configure.in: Do not configure or build ld for AIX
 	platforms.  ld is known to be broken on these platforms.
 
+Wed Aug 25 01:12:25 1999  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+	* config-ml.in: Pass compiler flag corresponding to multidirs to
+	subdir configures.
+
 1999-08-09  Ian Lance Taylor  <ian@zembu.com>
 
 	* Makefile.in (LDFLAGS): Define.
@@ -204,11 +486,52 @@
 	* configure (tmpfile): Change cONf$$ to cNf$$ to avoid an overly
 	long file name when using DJGPP on MS-DOS.
 
+Wed Aug  4 02:07:14 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* config.sub (vxworks case): Use os=-vxworks, not os=vxworks.
+
 1999-07-30  Alan Modra  <alan@spri.levels.unisa.edu.au>
 
 	* Makefile.in (check-target-libio): Remove all-target-libstdc++
 	dependency as this causes "make check" to globally "make all"
 
+Tue Jun 22 23:45:18 1999  Tom Tromey  <tromey@cygnus.com>
+
+	* configure.in (target_libs): Added target-zlib.
+	* Makefile.in (ALL_TARGET_MODULES): Added zlib.
+	(CONFIGURE_TARGET_MODULES): Likewise.
+	(CHECK_TARGET_MODULES): Likewise.
+	(INSTALL_TARGET_MODULES): Likewise.
+	(CLEAN_TARGET_MODULES): Likewise.
+	(configure-target-zlib): New target.
+	(all-target-zlib): Likewise.
+	(all-target-libjava): Depend on all-target-zlib.
+	(configure-target-libjava): Depend on configure-target-zlib.
+
+	* Makefile.in (configure-target-libjava): Depend on
+	configure-target-newlib.
+	(configure-target-boehm-gc): New target.
+	(configure-target-qthreads): New target.
+
+        * configure.in (target_libs): Added target-qthreads.
+        * Makefile.in (ALL_TARGET_MODULES): Added qthreads.
+        (CONFIGURE_TARGET_MODULES): Likewise.
+        (CHECK_TARGET_MODULES): Likewise.
+        (INSTALL_TARGET_MODULES): Likewise.
+        (CLEAN_TARGET_MODULES): Likewise.
+        (all-target-qthreads): New target.
+        (configure-target-libjava): Depend on configure-target-qthreads.
+        (all-target-libjava): Depend on all-target-qthreads.
+
+	* Makefile.in (ALL_TARGET_MODULES): Added libjava, boehm-gc.
+	(CONFIGURE_TARGET_MODULES): Likewise.
+	(CHECK_TARGET_MODULES): Likewise.
+	(INSTALL_TARGET_MODULES): Likewise.
+	(CLEAN_TARGET_MODULES): Likewise.
+	(all-target-libjava): New target.
+	(all-target-boehm-gc): Likewise.
+	* configure.in (target_libs): Added libjava, boehm-gc.
+
 1999-07-22  Ian Lance Taylor  <ian@zembu.com>
 
 	* Makefile.in (binutils.tar.bz2): Don't pass makeall.bat and
@@ -250,9 +573,26 @@
 
 	* config.guess (ppc-*-linux-gnu): Also use ld emul elf32ppclinux.
 
+Tue May 25 11:20:46 1999  H.J. Lu  (hjl@gnu.org)
+
+	* config.guess (dummy): Changed to $dummy.
+
 1999-05-24  Nick Clifton  <nickc@cygnus.com>
 
-	* config.sub: Updated to match latest EGCS version.
+	* config.sub: Tidied up case statements.
+
+1999-05-22  Ben Elliston  <bje@cygnus.com>
+
+	* config.guess: Handle NEC UX/4800. Contributed by Jiro Takabatake
+	<jiro@din.or.jp>.
+
+	* config.guess: Merge with FSF version. Future changes will be
+	more accurately recorded in this ChangeLog.
+	* config.sub: Likewise.
+
+Thu May 20 10:00:42 1999   Stephen L Moshier  <moshier@world.std.com>
+
+	 * Makefile.in (GCC_FOR_TARGET): Add -I$(build_tooldir)/include.
 
 1999-04-30  Tom Tromey  <tromey@cygnus.com>
 
@@ -268,11 +608,26 @@
 	(noconfigdirs): Don't build any bsp stuff for for arm-oabi targets.
 	Bad merge removed these two changes.
 
+Tue Apr 13 22:50:54 1999  Donn Terry (donn@interix.com)
+                          Martin Heller (Ing.-Buero_Heller@t-online.de)
+
+	* config.guess (interix Alpha): Add.
+
 1999-04-11  Richard Henderson  <rth@cygnus.com>
 
 	* configure.in (i?86-*-beos*): Do config gperf; don't config
 	gdb, newlib, or libgloss.
 
+Sun Apr 11 23:55:34 1999  Alexandre Oliva  <oliva@dcc.unicamp.br>
+	
+	* config-ml.in: On mips*-*-*, if multidirs contains mabi=64, try to
+	link a trivial program with -mabi=64.  If it fails, remove mabi=64
+	from multidirs.
+
+Sat Apr 10 21:50:01 1999  Philipp Thomas  (kthomas@gwdg.de)
+
+	* config.sub: Set basic_machine to i586 when target_alias = k6-*.
+
 1999-04-08  Nick Clifton  <nickc@cygnus.com>
 
 	* config.sub: Add support for mcore targets.
@@ -456,17 +811,6 @@
 	* Makefile.in: Add libtermcap target.
 	* config/mt-cygwin: New file.  libtermcap target info.
 
-Tue Dec 15 17:02:58 1998  Bob Manson  <manson@charmed.cygnus.com>
-
-	* configure.in: Add cygmon for x86-coff and x86-elf. Configure
- 	cygmon for all sparclite targets, regardless of object format.
-
-1998-12-15  Mark Salter  <msalter@cygnus.com>
-
-	* configure.in: Added target-bsp for several target architectures.
-
-	* Makefile.in: Added rules for bsp.
-
 Wed Dec 23 00:20:50 1998  Jeffrey A Law  (law@cygnus.com)
 
 	* config.sub: Clean up handling of hppa2.0.
@@ -479,6 +823,17 @@
 
 	* config.sub: Handle hppa2.0.
 
+Tue Dec 15 17:02:58 1998  Bob Manson  <manson@charmed.cygnus.com>
+
+	* configure.in: Add cygmon for x86-coff and x86-elf. Configure
+ 	cygmon for all sparclite targets, regardless of object format.
+
+1998-12-15  Mark Salter  <msalter@cygnus.com>
+
+	* configure.in: Added target-bsp for several target architectures.
+
+	* Makefile.in: Added rules for bsp.
+
 Fri Dec  4 01:34:02 1998  Jeffrey A Law  (law@cygnus.com)
 
 	* config.guess: Improve detection of hppa2.0 processors.
@@ -494,7 +849,6 @@
 	directory is "unwanted".
 	* Makefile.in ($(CONFIGURE_TARGET_MODULES)): Likewise.
 
-
 Wed Nov 18 18:28:45 1998  Geoffrey Noer  <noer@cygnus.com>
 
 	* ltconfig: import from libtool, after changing libtool to
@@ -542,6 +896,10 @@
 	cygwin* instead of cygwin32*.
 	* config.sub: Check cygwin* instead of cygwin32*.
 
+Thu Oct 22 10:55:25 1998  Robert Lipe  <robertl@dgii.com>
+
+	* config.guess: Match any version of Unixware7.
+
 1998-10-20  Syd Polk  <spolk@cygnus.com>
 
 	* Makefile.in configure.in: Add the ability to use tcl8.1 and tk8.1
@@ -556,10 +914,30 @@
 
 	* Makefile.in (DEVO_SUPPORT): Add config.if.
 
+Tue Oct 13 15:45:36 1998  Manfred Hollstein  <manfred@s-direktnet.de>
+
+	* configure: Add pattern to replace "build_tooldir"'s
+	definition in the generated Makefile with "tooldir"'s
+	actual value.
+
 Tue Oct 13 09:17:06 1998  Jeffrey A Law  (law@cygnus.com)
 
 	* config.sub: Bring back lost sparcv9.
 
+	* Makefile.in (all-snvavigator): Remove all-flexlm dependency.
+
+Mon Oct 12 12:09:44 1998  Jeffrey A Law  (law@cygnus.com)
+
+	* Makefile.in (CHILL_FOR_TARGET): Mirror recent changes to
+	CC_FOR_TARGET and friends.
+
+Mon Oct 12 12:09:30 1998  Alexandre Oliva  <oliva@dcc.unicamp.br>
+	
+	* Makefile.in (build_tooldir): New variable, same as tooldir.
+	(CC_FOR_TARGET, GCC_FOR_TARGET, CXX_FOR_TARGET): Add
+	-B$(build_tooldir)/bin/.
+	(BASE_FLAGS_TO_PASS): Pass build_tooldir down.
+
 Wed Sep 30 22:20:50 1998  Robert Lipe  <robertl@dgii.com>
 
 	* config.sub: Add support for i[34567]86-pc-udk.
@@ -571,9 +949,18 @@
 	tools module
 	* configure.in: ditto
 
+Wed Sep 30 03:00:05 1998  Jeffrey A Law  (law@cygnus.com)
+
+	* Makefile.in (TARGET_CONFIGDIRS): Add libobjc.
+	(ALL_TARGET_MODULES): Add all-target-libobjc.
+	(CONFIGURE_TARGET_MODULES, CHECK_TARGET_MODULES): Similarly.
+	(INSTALL_TARGET_MODULES, CLEAN_TARGET_MODULES): Similarly.
+	(all-target-libchill): Add dependencies.
+	* configure.in (target_libs): Add libchill.
+	
 1998-09-30  Manfred Hollstein  <manfred@s-direktnet.de>
 
-	 * configure.in (target_subdir): Remove duplicate line.
+	* configure.in (target_subdir): Remove duplicate line.
 
 Tue Sep 29 22:45:41 1998  Felix Lee  <flee@cygnus.com>
 
@@ -594,7 +981,6 @@
 
 	* Makefile.in (bootstrap): Pass TARGET_FLAGS_TO_PASS to `make all'.
 
-
 Sun Sep 20 00:13:02 1998  Richard Henderson  <rth@cygnus.com>
 
 	* config.sub: Fix typo in last change.
@@ -663,12 +1049,12 @@
 
 Thu Aug 13 12:49:29 1998  H.J. Lu  <hjl@gnu.org>
 
-	* Makefile.in (taz): Try "chmod -R og=u ." before 
+	* Makefile.in (taz): Try "chmod -R og=u ." before
 	"chmod og=u `find . -print`".
 
 Fri Jul 31 09:38:33 1998  Catherine Moore  <clm@cygnus.com>
 
-        * configure.in: Add arm-elf and thumb-elf support.
+	* configure.in: Add arm-elf and thumb-elf support.
 
 Mon Jul 27 16:23:58 1998  Doug Evans  <devans@canuck.cygnus.com>
 
@@ -835,11 +1221,11 @@
 
 Fri Jun 19 02:36:59 1998  Alexandre Oliva <oliva@dcc.unicamp.br>
 
-	* Makefile.in (local-clean): remove *.log
-	(warning.log): built with warn_summary from build.log
-	(mail-report.log): run test_summary
-	(mail-report-with-warnings.log): run test_summary including
-	warning.log in the report
+	* Makefile.in (local-clean): Remove *.log.
+	(warning.log): Built with warn_summary from build.log.
+	(mail-report.log): Run test_summary.
+	(mail-report-with-warnings.log): Run test_summary including
+	warning.log in the report.
 
 Thu Jun 18 11:26:03 1998  Robert Lipe  <robertl@dgii.com>
 
@@ -881,7 +1267,11 @@
 Sat May 23 23:44:13 1998  Alexandre Oliva <oliva@dcc.unicamp.br>
 
 	* Makefile.in (boostrap2-lean, bootstrap3-lean,
-	bootstrap4-lean): new targets
+	bootstrap4-lean): New targets.
+
+Mon May 11 23:55:56 1998  Jeffrey A Law  (law@cygnus.com)
+
+	* mpw-* Delete.  Not used.
 
 Mon May 11 23:11:34 1998  Jeffrey A Law  (law@cygnus.com)
 
@@ -906,8 +1296,8 @@
 
 1998-04-30  Paul Eggert  <eggert@twinsun.com>
 
-        * Makefile.in (EXTRA_GCC_FLAGS): Remove backslash at end;
-        Solaris `make' causes it to continue to next definition. 
+	* Makefile.in (EXTRA_GCC_FLAGS): Remove backslash at end;
+	Solaris `make' causes it to continue to next definition. 
 
 Tue Apr 28 16:24:24 1998  Jason Molenda  (crash@bugshack.cygnus.com)
 
@@ -923,7 +1313,7 @@
 	* config.sub: Recognize sparc86x.
 
 Tue Apr 28 07:35:02 1998  Michael Meissner  <meissner@cygnus.com>
- 
+
 	* configure.in (--enable-target-optspace): Remove debug echo.
 
 Thu Apr 23 21:31:16 1998  Jim Wilson  <wilson@cygnus.com>
@@ -954,7 +1344,6 @@
 	(all-gprof): Likewise.
 	(all-ld): Likewise.
 
-
 1998-04-19  Brendan Kehoe  <brendan@cygnus.com>
 
 	* configure.in (host_tools): Fix typo, lbtool -> libtool.
@@ -991,7 +1380,11 @@
 	* ltconfig: Add cygwin32 support.
 
 	* Makefile.in, configure.in: Add libtool as a native only directory
- 	to configure and build.
+	to configure and build.
+
+Sun Apr 12 20:58:46 1998  Jeffrey A Law  (law@cygnus.com)
+
+	* Makefile.in (INSTALL_MODULES): Remove texinfo.
 
 Wed Apr  8 13:18:56 1998  Philippe De Muyter  <phdm@macqel.be>
 
@@ -1019,6 +1412,11 @@
 
 	* configure: Do not disable building gdbtk for cygwin32 hosts.
 
+Wed Mar 25 10:04:18 1998  Nick Clifton  <nickc@cygnus.com>
+
+	* configure.in: Add thumb-coff target.
+	* config.sub: Add thumb-coff target.
+
 Wed Mar 25 11:49:12 1998  Jason Molenda  (crash@bugshack.cygnus.com)
 
 	* Makefile.in: Revert yesterday's change.
@@ -1026,9 +1424,9 @@
 
 Tue Mar 24 16:58:29 1998  Jason Molenda  (crash@bugshack.cygnus.com)
 
-	* Makefile.in (TARGET_CONFIGDIRS, ALL_TARGET_MODULES, 
-	CONFIGURE_TARGET_MODULES, CHECK_TARGET_MODULES, 
-	INSTALL_TARGET_MODULES, CLEAN_TARGET_MODULES, all-target-winsup): 
+	* Makefile.in (TARGET_CONFIGDIRS, ALL_TARGET_MODULES,
+	CONFIGURE_TARGET_MODULES, CHECK_TARGET_MODULES,
+	INSTALL_TARGET_MODULES, CLEAN_TARGET_MODULES, all-target-winsup):
 	Remove references to librx and libg++.
 
 Tue Mar 24 18:28:12 1998  Eric Mumpower  <nocturne@cygnus.com>
@@ -1066,6 +1464,7 @@
 	* configure.in: Add Thumb-pe target.
 
 Tue Mar 17 16:59:00 1998  Syd Polk <spolk@cygnus.com>
+
 	* Makefile.in - changed sn targets to snavigator
 	* configure.in - changed sn targets to snavigator
 
@@ -1088,7 +1487,6 @@
 
 	* configure.in: Revert 3 Jan change for powerpc-linux-gnulibc1.
 
-
 Mon Feb 23 15:09:18 1998  Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de
 
         * config.sub (sco5): Fix typo.
@@ -1103,10 +1501,6 @@
 
 	* configure.in: Remove libgloss from noconfigdirs for MN10300.
 
-Fri Feb 20 16:47:24 1998  Tom Tromey  <tromey@cygnus.com>
-
-	* configure: Don't let builds be done in source tree.
-
 Thu Feb 19 13:40:41 1998  Ian Lance Taylor  <ian@cygnus.com>
 
 	* configure.in: Don't build libgui for a cygwin32 target when not on
@@ -1168,11 +1562,20 @@
 
 	* config.sub: Add tic30 cases, and map c30 to tic30.
 
+Sun Feb  1 02:40:41 1998  Richard Henderson  <rth@cygnus.com>
+
+	* Makefile.in (TARGET_CONFIGDIRS): Add libf2c.
+	(ALL_TARGET_MODULES, CONFIGURE_TARGET_MODULES): Similarly
+	(CHECK_TARGET_MODULES, INSTALL_TARGET_MODULES): Similarly
+	(CLEAN_TARGET_MODULES): Similarly
+	(all-target-libf2c): Add dependences.
+	* configure.in (target_libs): Add libf2c. 
+
 Fri Jan 30 17:18:32 1998  Geoffrey Noer  <noer@cygnus.com>
 
-        * configure.in: Remove expect from noconfigdirs when target
-        is cygwin32.  OK to build expect and dejagnu with Canadian
-        Cross.
+	* configure.in: Remove expect from noconfigdirs when target
+	is cygwin32.  OK to build expect and dejagnu with Canadian
+	Cross.
 
 Wed Jan 28 12:58:49 1998  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -1205,7 +1608,7 @@
 	${package_makefile_frag} to where it should be according
 	to the comment.
 
-Fri Jan 23 00:30:21 1998  Philip Blundell  <pb@nexus.co.uk>
+Fri Jan 23 00:29:28 1998  Philip Blundell  <pb@nexus.co.uk>
 
 	* config.guess: Add support for Linux/ARM.
 
@@ -1230,13 +1633,13 @@
 
 Fri Jan 16 00:41:37 1998  Alexandre Oliva <oliva@dcc.unicamp.br>
 
-	* configure.in: check whether host and target makefile
-	fragments exist before adding them to *_makefile_frag
+	* configure.in: Check whether host and target makefile
+	fragments exist before adding them to *_makefile_frag.
 
 Wed Jan 14 23:39:10 1998  Bob Manson  <manson@charmed.cygnus.com>
 
 	* configure.in (target_configdirs): Add cygmon for sparc64-elf.
-	
+
 Wed Jan 14 12:48:07 1998  Keith Seitz  <keiths@pizza.cygnus.com>
 
 	* configure.in: Make sure we only replace RPATH_ENVVAR on
@@ -1259,7 +1662,7 @@
 
 	* config.sub: Add mingw32 support.
 	* configure.in: Likewise.
-	* mh-mingw32: New file.
+	* config/mh-mingw32: New file.
 
 Sat Jan  3 12:11:05 1998 Franz Sirl <franz.sirl-kernel@lauterbach.com>
 
@@ -1276,17 +1679,20 @@
 	* config.guess: Sync with egcs.  Picks up new alpha support,
 	BeOS & some additional linux support.
 
-Tue Dec 23 12:45:50 1997  Jeffrey A Law  (law@cygnus.com)
+Tue Dec 23 12:44:24 1997  Jeffrey A Law  (law@cygnus.com)
 
 	* config.guess: HP 9000/803 is a PA1.1 machine.
 
+Mon Dec 22 02:39:24 1997  Richard Henderson  <rth@cygnus.com>
+
+	* configure.in: It's alpha*-...
 
 Sun Dec 21 16:53:12 1997  H.J. Lu  (hjl@gnu.ai.mit.edu)
 
-        * configure.in (host_makefile_frag, target_makefile_frag):
-        Handle multiple config files.
-        (alpha-*-linux*): Treat alpha-*-linux* as alpha-*-linux* and
-        alpha-*-*.
+	* configure.in (host_makefile_frag, target_makefile_frag):
+	Handle multiple config files.
+	(alpha-*-linux*): Treat alpha-*-linux* as alpha-*-linux* and
+	alpha-*-*.
 
 Thu Dec 18 13:13:03 1997  Doug Evans  <devans@canuck.cygnus.com>
 
@@ -1458,10 +1864,10 @@
 
 Thu Sep 18 23:58:27 1997  Jeffrey A Law  (law@cygnus.com)
 
-* Makefile.in (cross): New target.
+	* Makefile.in (cross): New target.
 
 Thu Sep 18 21:43:23 1997  Alexandre Oliva  <oliva@dcc.unicamp.br>
-			  Jeff Law         <law@cygnus.com>
+			  Jeff Law	   <law@cygnus.com>
 
 	* Makefile.in (bootstrap2, bootstrap3): New targets.
 	(all-bootstrap): Remove outdated and confusing target.
@@ -1472,7 +1878,6 @@
 	* configure (tooldir): enable_gdbtk=YES for cygwin32, NO for
  	windows.  Consistent with gdb/configure.
 
-
 1997-09-15 02:37  Ulrich Drepper  <drepper@cygnus.com>
 
 	* config/mt-linux: Define CXXFLAGS to make sure -fvtable-thunks is
@@ -1491,7 +1896,7 @@
 	* config/mh-cygwin32: ok to build split texinfo files
 
 Fri Sep 12 16:19:20 1997  Geoffrey Noer  <noer@cygnus.com>
-	
+
 	* configure.in: remove bison from noconfigdirs for Cygwin32 host
 
 Thu Sep 11 16:40:46 1997  H.J. Lu  (hjl@gnu.ai.mit.edu)
@@ -1513,6 +1918,10 @@
 
 	* config.guess: Merge with FSF.
 
+Sun Sep  7 23:18:32 1997  Fred Fish  <fnf@ninemoons.com>
+
+	* config.sub: Change 'amigados' to 'amigaos' to match current usage.
+
 Sun Sep  7 15:55:28 1997  Gavin Koch  <gavin@cygnus.com>
 
 	* config.sub: Add "marketing-names" patch.
@@ -1525,6 +1934,10 @@
 
 	* config.sub: Handle v850-elf.
 
+Wed Sep  3 22:01:58 1997  Fred Fish  <fnf@ninemoons.com>
+
+	* .cvsignore (*-install): Remove.
+
 Wed Sep  3 12:15:24 1997  Chris Provenzano  <proven@cygnus.com>
 
 	* ltconfig: Set CONFIG_SHELL in libtool.
@@ -1803,7 +2216,7 @@
 
 Fri Jun  6 21:38:40 1997  Rob Savoye  <rob@chinadoll.cygnus.com>
 
-	* configure: Use '|' instead of ":" as the seperator in
+	* configure: Use '|' instead of ":" as the separator in
 	sed. Otherwise sed chokes on NT path names with drive
 	designators. Also look for "?:*" as the leading characters in an
 	absolute pathname.
@@ -2355,10 +2768,26 @@
 
 	* configure.in: Use a single line for host_tools and native_only.
 
+Tue Sep 16 09:55:07 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* Makefile.in (install-itcl): Install tcl first.
+
+Sun Sep 14 20:53:42 1997  Geoffrey Noer  <noer@cygnus.com>
+
+	* config/mh-cygwin32: ok to build split texinfo files
+
+Fri Sep 12 16:19:20 1997  Geoffrey Noer  <noer@cygnus.com>
+
+	* configure.in: remove bison from noconfigdirs for Cygwin32 host
+
 Mon Sep  9 12:21:30 1996  Doug Evans  <dje@canuck.cygnus.com>
 
 	* config.sub, configure.in: Add entries for m32r.
 
+Mon Sep  8 20:46:20 1997  Ian Lance Taylor  <ian@cygnus.com>
+
+	* config.guess: Merge with FSF.
+
 Thu Sep  5 13:52:47 1996  Tom Tromey  <tromey@creche.cygnus.com>
 
 	* Makefile.in (inet-install): Don't run install-gzip.
@@ -4941,6 +5370,10 @@
 	* config.sub: Accept linux*coff and linux*elf as operating
 	systems.
 
+Tue Oct  7 14:24:41 1997  Ian Lance Taylor  <ian@cygnus.com>
+
+	* ltmain.sh: Handle symlinks in generated script.
+
 Thu Oct  7 12:57:19 1993  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
 
 	* config.sub: Recognize mips64, and mips3 as an alias for it.
@@ -4962,14 +5395,30 @@
 	* configure.in: default to '--with-gnu-as' and '--with-gnu-ld'
 	if gas and ld are in the source tree and are in ${configdirs}.
 	If ${use_gnu_as} or ${use_gnu_ld} are 'no', then don't set the
-	the --with options (but still pass them down on the command line,
+	--with options (but still pass them down on the command line,
 	if they were explicitly specified).
 
+Wed Oct  1 13:11:27 1997  Ian Lance Taylor  <ian@cygnus.com>
+
+	* configure: Handle autoconf style directory options: --bindir,
+	--datadir, --includedir, --infodir, --libdir, --libexecdir,
+	--mandir, --oldincludedir, --sbindir, --sharedstatedir,
+	--sysconfdir.
+	* Makefile.in (sbindir, libexecdir, sysconfdir): New variables.
+	(sharedstatedir, localstatedir, oldincludedir): New variables.
+	(BASE_FLAGS_TO_PASS): Pass down bindir, datadir, includedir,
+	infodir, libdir, libexecdir, localstatedir, mandir, oldincludedir,
+	sbindir, sharedstatedir, and sysconfdir.
+
 Fri Sep 24 19:11:13 1993  david d `zoo' zuhn  (zoo@rtl.cygnus.com)
 
 	* configure: substitute SHELL value in Makefile.in with
 	${CONFIG_SHELL}
 
+Wed Sep 24 15:18:32 1997  Ian Lance Taylor  <ian@cygnus.com>
+
+	* ltmain.sh: Tweak shell pattern to avoid bug in NetBSD /bin/sh.
+
 Thu Sep 23 18:05:13 1993  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
 
 	* configure.in: Build gas, ld, and binutils for *-*-sysv4* and
diff --git a/MAINTAINERS b/MAINTAINERS
index 477d7c8..a70aac0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6,17 +6,28 @@
 
 Makefile.in, configure, configure.in
 	Please notify the following of any committed patches.
-		binutils@sourceware.cygnus.com
-		gdb-patches@sourceware.cygnus.com
+		binutils@sources.redhat.com
+		gdb-patches@sources.redhat.com
 
 bfd/, binutils/, gas/, gprof/, ld/, opcodes/ & BFD's part of include/
-	binutils: http://sourceware.cygnus.com/binutils/
-	Patches to binutils@sourceware.cygnus.com.
+	binutils: http://sources.redhat.com/binutils/
+	Patches to binutils@sources.redhat.com.
 	Please notify the following of any interface changes:
-		gdb-patches@sourceware.cygnus.com
+		gdb-patches@sources.redhat.com
+
+cgen/, cgen parts of opcodes/, sim/, include/
+	cgen: http://sources.redhat.com/cgen/
+	Patches to cgen@sources.redhat.com
+	May need separate opcodes/ or sim/ approval for
+		commits of regenerated files there.
+
+sid/, sid parts of cgen/, dejagnu/
+	sid: http://sources.redhat.com/sid/
+	Patches to sid@sources.redhat.com
 
 config.guess, config.sub
 	config: http://gnu.org
+	Patches to config-patches@gnu.org.
 	Changes need to be done in tandem with the official CONFIG
 	sources or submitted to the master file maintainer and brought
 	in via a merge.
@@ -35,38 +46,45 @@
 
 mkinstalldirs, move-if-change, symlink-tree
 	autoconf: http://gnu.org
-	Change need to be done in tandem with the official AUTOCONF
+	Patches to autoconf-patches@gnu.org.
+	Changes need to be done in tandem with the official AUTOCONF
 	sources or submitted to the master file maintainer and brought
 	in via a merge.
 
 newlib/, libgloss/
-	http://sourceware.cygnus.com/newlib/
-	Patches to newlib@sourceware.cygnus.com.
+	http://sources.redhat.com/newlib/
+	Patches to newlib@sources.redhat.com.
 
 gdb/, mmalloc/, readline/, sim/ & GDB's part of include/
-	gdb: http://sourceware.cygnus.com/gdb/
-	Patches to gdb-patches@sourceware.cygnus.com.
+	gdb: http://sources.redhat.com/gdb/
+	Patches to gdb-patches@sources.redhat.com.
 	See also gdb/MAINTAINERS, sim/MAINTAINERS, mmalloc/MAINTAINERS.
 
 itcl/, tcl/, tix/, tk/, libgui/
-	insight: http://sourceware.cygnus.com/insight/
-	Contact insight@sourceware.cygnus.com.
+	insight: http://sources.redhat.com/insight/
+	Contact insight@sources.redhat.com.
 
 winsup/
-	cygwin: http://sourceware.cygnus.com/cygwin
-	Patches to cygwin-patches@sourceware.cygnus.com.
-	General discussion cygwin@sourceware.cygnus.com.
+	cygwin: http://sources.redhat.com/cygwin
+	Patches to cygwin-patches@sources.redhat.com.
+	General discussion cygwin@sources.redhat.com.
 	See also winsup/MAINTAINERS.
 
+texinfo/texinfo.tex
+	texinfo: http://ftp.gnu.org.
+	Latest version can be found on ftp://ftp.gnu.org and can be
+	imported at any (reasonable) time.
+	Please not use GCC's texinfo.  Please do not import texinfo.
+
 expect/, dejagnu/, config-ml.in, mpw-README, mpw-build.in,
-mpw-config.in, mpw-configure, mpw-install, setup.com, texinfo/,
-missing, makefile.vms, utils/, config/, config.if, makefile.vms,
-missing, ylwrap, mkdep, etc/, install-sh, intl/
+mpw-config.in, mpw-configure, mpw-install, setup.com, missing,
+makefile.vms, utils/, config/, config.if, makefile.vms, missing,
+ylwrap, mkdep, etc/, install-sh, intl/
 	?
 
 modules file
 	Obviously changes to this file should not go through
-	overseers@sourceware.cygnus.com.  If you understand the file
+	overseers@sources.redhat.com.  If you understand the file
 	format (or can cut-and-paste existing entries), modify it. If
 	it scares you, get someone who does understand it to help you.
 	Be prepared to fix it if you do break it.
diff --git a/Makefile.in b/Makefile.in
index f1acbd0..76cf582 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,7 @@
 #
 # Makefile for directory with subdirs to build.
-#   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998
-#   Free Software Foundation
+#   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+#   1999, 2000 Free Software Foundation
 #
 # 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
@@ -37,7 +37,8 @@
 mandir=${prefix}/man
 gxx_include_dir=${includedir}/g++
 
-tooldir = $(exec_prefix)/$(target)
+tooldir = $(exec_prefix)/$(target_alias)
+build_tooldir = $(exec_prefix)/$(target_alias)
 
 program_transform_name =
 
@@ -97,9 +98,9 @@
 CXX = c++
 
 # Use -O2 to stress test the compiler.
-LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates -fexceptions
+LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
 CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
-LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates -fexceptions
+LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
 
 RANLIB = ranlib
 
@@ -168,9 +169,7 @@
 
 # This is set by the configure script to the list of directories which
 # should be built using the target tools.
-
-
-TARGET_CONFIGDIRS = libiberty libgloss $(SPECIAL_LIBS) newlib libio librx libstdc++ libg++ winsup opcodes bsp libstub cygmon
+TARGET_CONFIGDIRS = libiberty libgloss $(SPECIAL_LIBS) newlib libio librx libstdc++ libg++ winsup opcodes bsp libstub cygmon libf2c libchill libobjc
 
 # Target libraries are put under this directory:
 # Changed by configure to $(target_alias) if cross.
@@ -187,14 +186,19 @@
 # the libraries.  This may be changed by configure.in.
 RPATH_ENVVAR = LD_LIBRARY_PATH
 
+# This is the list of directories that may be needed in RPATH_ENVVAR
+# so that programs built for the host machine work.
+HOST_LIB_PATH = $$r/bfd:$$r/opcodes
+
+# This is the list of directories that may be needed in RPATH_ENVVAR
+# so that prorgams built for the target machine work.
+TARGET_LIB_PATH = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:$$r/$(TARGET_SUBDIR)/libstdc++
+
 # configure.in sets SET_LIB_PATH to this if --enable-shared was used.
+# Some platforms don't like blank entries, so we remove duplicate,
+# leading and trailing colons.
 REALLY_SET_LIB_PATH = \
-  if [ x"$$$(RPATH_ENVVAR)" != x ]; then \
-    $(RPATH_ENVVAR)=$$r/bfd:$$r/opcodes:$$$(RPATH_ENVVAR); \
-  else \
-    $(RPATH_ENVVAR)=$$r/bfd:$$r/opcodes; \
-  fi; \
-  export $(RPATH_ENVVAR);
+  $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
 
 ALL = all.normal
 INSTALL_TARGET = installdirs \
@@ -211,66 +215,17 @@
 	$(INSTALL_X11_MODULES) \
 	$(INSTALL_DOSREL)
 
-CC_FOR_TARGET = ` \
-  if [ -f $$r/gcc/xgcc ] ; then \
-    if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \
-      case "$(target_canonical)" in \
-        i[3456]86-*-cygwin*) \
-          echo $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/ -B$$r/$(TARGET_SUBDIR)/newlib/ -L$$r/$(TARGET_SUBDIR)/winsup -L$$r/$(TARGET_SUBDIR)/winsup/cygwin -L$$r/$(TARGET_SUBDIR)/winsup/w32api/lib -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/winsup/include -idirafter $$s/winsup/cygwin/include -idirafter $$s/winsup/w32api/include -idirafter $$s/newlib/libc/include -idirafter $$s/newlib/libc/sys/cygwin -idirafter $$s/newlib/libc/sys/cygwin32 -nostdinc; \
-          ;; \
-        *) \
-          echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \
-	  ;; \
-      esac \
-    else \
-      echo $$r/gcc/xgcc -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -B$$r/gcc/ -isystem $(build_tooldir)/include; \
-    fi; \
-  else \
-    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
-      echo $(CC); \
-    else \
-      t='$(program_transform_name)'; echo gcc | sed -e 's/x/x/' $$t; \
-    fi; \
-  fi`
+# Should be substed by configure.in
+FLAGS_FOR_TARGET =
+CC_FOR_TARGET =
+CHILL_FOR_TARGET =
+CXX_FOR_TARGET =
 
-# If CC_FOR_TARGET is not overriden on the command line, then this
+# If GCC_FOR_TARGET is not overriden on the command line, then this
 # variable is passed down to the gcc Makefile, where it is used to
 # build libgcc2.a.  We define it here so that it can itself be
 # overridden on the command line.
-GCC_FOR_TARGET = $$r/gcc/xgcc -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -B$$r/gcc/ -I$(build_tooldir)/include
-
-CHILL_FOR_TARGET = ` \
-  if [ -f $$r/gcc/xgcc ] ; then \
-    echo $$r/gcc/xgcc -B$$r/gcc/ -L$$r/gcc/ch/runtime/; \
-  else \
-    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
-      echo $(CC); \
-    else \
-      t='$(program_transform_name)'; echo gcc | sed -e 's/x/x/' $$t; \
-    fi; \
-  fi`
-
-CXX_FOR_TARGET = ` \
-  if [ -f $$r/gcc/xgcc ] ; then \
-    if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \
-      case "$(target_canonical)" in \
-        i[3456]86-*-cygwin*) \
-          echo $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/ -B$$r/$(TARGET_SUBDIR)/newlib/ -L$$r/$(TARGET_SUBDIR)/winsup -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/winsup/cygwin/include -idirafter $$s/winsup/w32api/include -idirafter $$s/newlib/libc/include -idirafter $$s/newlib/libc/sys/cygwin -idirafter $$s/newlib/libc/sys/cygwin32 -nostdinc; \
-          ;; \
-        *) \
-          echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \
-	  ;; \
-      esac \
-    else \
-      echo $$r/gcc/g++ -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -B$$r/gcc/ -I$(build_tooldir)/include; \
-    fi; \
-  else \
-    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
-      echo $(CXX); \
-    else \
-      t='$(program_transform_name)'; echo c++ | sed -e 's/x/x/' $$t; \
-    fi; \
-  fi`
+GCC_FOR_TARGET = $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_FOR_TARGET)
 
 AS_FOR_TARGET = ` \
   if [ -f $$r/gas/as-new ] ; then \
@@ -423,6 +378,7 @@
 	"sharedstatedir=$(sharedstatedir)" \
 	"sysconfdir=$(sysconfdir)" \
 	"tooldir=$(tooldir)" \
+	"build_tooldir=$(build_tooldir)" \
 	"gxx_include_dir=$(gxx_include_dir)" \
 	"gcc_version=$(gcc_version)" \
 	"gcc_version_trigger=$(gcc_version_trigger)" \
@@ -522,6 +478,7 @@
 	all-bison \
 	all-byacc \
 	all-bzip2 \
+	all-cgen \
 	all-cvssrc \
 	all-db \
 	all-dejagnu \
@@ -565,6 +522,7 @@
 	all-send-pr \
 	all-shellutils \
 	all-sim \
+	all-snavigator \
 	all-tar \
 	all-tcl \
 	all-tcl8.1 \
@@ -575,6 +533,7 @@
 	all-uudecode \
 	all-wdiff \
 	all-zip \
+	all-zlib \
 	$(EXTRA_TARGET_HOST_ALL_MODULES)
 
 # This is a list of the check targets for all of the modules which are
@@ -598,6 +557,7 @@
 	check-bfd \
 	check-binutils \
 	check-bzip2 \
+	check-cgen \
 	check-cvssrc \
 	check-db \
 	check-dejagnu \
@@ -636,6 +596,7 @@
 	check-sed \
 	check-send-pr \
 	check-shellutils \
+	check-snavigator \
 	check-sim \
 	check-tar \
 	check-tcl \
@@ -668,6 +629,7 @@
 	install-binutils \
 	install-bison \
 	install-byacc \
+	install-cgen \
 	install-cvssrc \
 	install-db \
 	install-dejagnu \
@@ -711,8 +673,8 @@
 	install-send-pr \
 	install-shellutils \
 	install-sim \
+	install-snavigator \
 	install-tar \
-	install-texinfo \
 	install-textutils \
 	install-tgas \
 	install-time \
@@ -766,9 +728,13 @@
 ALL_TARGET_MODULES = \
 	all-target-libio \
 	all-target-libstdc++ \
+	all-target-libstdc++-v3 \
 	all-target-librx \
 	all-target-libg++ \
 	all-target-newlib \
+	all-target-libf2c \
+	all-target-libchill \
+	all-target-libobjc \
 	all-target-libtermcap \
 	all-target-winsup \
 	all-target-libgloss \
@@ -776,6 +742,11 @@
 	all-target-gperf \
 	all-target-examples \
 	all-target-libstub \
+	all-target-libffi \
+	all-target-libjava \
+	all-target-zlib \
+	all-target-boehm-gc \
+	all-target-qthreads \
 	all-target-bsp \
 	all-target-cygmon
 
@@ -784,9 +755,13 @@
 CONFIGURE_TARGET_MODULES = \
 	configure-target-libio \
 	configure-target-libstdc++ \
+	configure-target-libstdc++-v3 \
 	configure-target-librx \
 	configure-target-libg++ \
 	configure-target-newlib \
+	configure-target-libf2c \
+	configure-target-libchill \
+	configure-target-libobjc \
 	configure-target-libtermcap \
 	configure-target-winsup \
 	configure-target-libgloss \
@@ -794,6 +769,11 @@
 	configure-target-gperf \
 	configure-target-examples \
 	configure-target-libstub \
+	configure-target-libffi \
+	configure-target-libjava \
+	configure-target-zlib \
+	configure-target-boehm-gc \
+	configure-target-qthreads \
 	configure-target-bsp \
 	configure-target-cygmon
 
@@ -802,10 +782,19 @@
 CHECK_TARGET_MODULES = \
 	check-target-libio \
 	check-target-libstdc++ \
+	check-target-libstdc++-v3 \
 	check-target-libg++ \
 	check-target-newlib \
+	check-target-libf2c \
+	check-target-libchill \
+	check-target-libobjc \
 	check-target-winsup \
 	check-target-libiberty \
+	check-target-libffi \
+	check-target-libjava \
+	check-target-zlib \
+	check-target-boehm-gc \
+	check-target-qthreads \
 	check-target-gperf
 
 # This is a list of the install targets for all of the modules which are
@@ -813,13 +802,21 @@
 INSTALL_TARGET_MODULES = \
 	install-target-libio \
 	install-target-libstdc++ \
+	install-target-libstdc++-v3 \
 	install-target-libg++ \
 	install-target-newlib \
+	install-target-libf2c \
+	install-target-libchill \
+	install-target-libobjc \
 	install-target-libtermcap \
 	install-target-winsup \
 	install-target-libgloss \
 	install-target-libiberty \
 	install-target-bsp \
+	install-target-libjava \
+	install-target-zlib \
+	install-target-boehm-gc \
+	install-target-qthreads \
 	install-target-gperf
 
 # This is a list of the targets for which we can do a clean-{target}.
@@ -834,6 +831,7 @@
 	clean-bison \
 	clean-byacc \
 	clean-bzip2 \
+	clean-cgen \
 	clean-cvssrc \
 	clean-db \
 	clean-dejagnu \
@@ -877,6 +875,7 @@
 	clean-send-pr \
 	clean-shellutils \
 	clean-sim \
+	clean-snavigator \
 	clean-tar \
 	clean-tcl \
 	clean-texinfo \
@@ -885,21 +884,31 @@
 	clean-time \
 	clean-uudecode \
 	clean-wdiff \
-	clean-zip
+	clean-zip \
+	clean-zlib
 
 # All of the target modules that can be cleaned
 CLEAN_TARGET_MODULES = \
 	clean-target-libio \
 	clean-target-libstdc++ \
+	clean-target-libstdc++-v3 \
 	clean-target-librx \
 	clean-target-libg++ \
 	clean-target-newlib \
+	clean-target-libf2c \
+	clean-target-libchill \
+	clean-target-libobjc \
 	clean-target-winsup \
 	clean-target-libgloss \
 	clean-target-libiberty \
 	clean-target-gperf \
 	clean-target-examples \
 	clean-target-libstub \
+	clean-target-libffi \
+	clean-target-libjava \
+	clean-target-zlib \
+	clean-target-boehm-gc \
+	clean-target-qthreads \
 	clean-target-bsp \
 	clean-target-cygmon
 
@@ -1054,7 +1063,12 @@
 	  true; \
 	fi
 
-clean-target: $(CLEAN_TARGET_MODULES)
+clean-target: $(CLEAN_TARGET_MODULES) clean-target-libgcc
+clean-target-libgcc:
+	test ! -d gcc/libgcc || \
+	(cd gcc/libgcc && find . -type d -print) | \
+	while read d; do rm -f gcc/$$d/libgcc.a || : ; done
+	-rm -rf gcc/libgcc
 
 # Check target.
 
@@ -1156,7 +1170,6 @@
 	  mv gcc/tmp-include gcc/include 2>/dev/null; \
 	else true; fi
 
-
 # This rule is used to build the modules which use FLAGS_TO_PASS.  To
 # build a target all-X means to cd to X and make all.
 #
@@ -1435,12 +1448,12 @@
 # in parallel.
 #
 .PHONY: bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean
-bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean: all-texinfo all-bison all-byacc all-binutils all-gas all-ld
+bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean: all-bootstrap
 	@r=`pwd`; export r; \
 	s=`cd $(srcdir); pwd`; export s; \
 	$(SET_LIB_PATH) \
 	echo "Bootstrapping the compiler"; \
-	cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) $@
+	cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@
 	@r=`pwd`; export r; \
 	s=`cd $(srcdir); pwd`; export s; \
 	case "$@" in \
@@ -1456,7 +1469,7 @@
 	esac; \
 	$(SET_LIB_PATH) \
 	echo "$$msg"; \
-	cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
+	cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
 	@r=`pwd`; export r; \
 	s=`cd $(srcdir); pwd` ; export s; \
 	$(SET_LIB_PATH) \
@@ -1469,7 +1482,7 @@
 	s=`cd $(srcdir); pwd`; export s; \
 	$(SET_LIB_PATH) \
 	echo "Building the C and C++ compiler"; \
-	cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
+	cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++"
 	@r=`pwd`; export r; \
 	s=`cd $(srcdir); pwd` ; export s; \
 	$(SET_LIB_PATH) \
@@ -1535,20 +1548,23 @@
 all-bfd: all-libiberty all-intl
 all-binutils: all-libiberty all-opcodes all-bfd all-flex all-bison all-byacc all-intl
 all-bison: all-texinfo
-configure-target-bsp: $(ALL_GCC)
-all-target-bsp: configure-target-bsp all-gcc all-binutils all-target-newlib
+configure-target-boehm-gc: $(ALL_GCC_CXX) configure-target-qthreads
+all-target-boehm-gc: configure-target-boehm-gc
+configure-target-bsp: $(ALL_GCC_C)
+all-target-bsp: configure-target-bsp
 all-byacc:
 all-bzip2:
+all-cgen: all-libiberty
 all-cvssrc:
-configure-target-cygmon: $(ALL_GCC)
-all-target-cygmon: configure-target-cygmon all-gas all-ld all-gcc all-target-libiberty all-target-newlib all-target-libio all-target-libstub all-target-bsp
+configure-target-cygmon: $(ALL_GCC_C)
+all-target-cygmon: configure-target-cygmon all-target-libiberty all-target-libio all-target-libstub all-target-bsp
 all-db:
 all-dejagnu: all-tcl all-expect all-tk
 all-diff: all-libiberty
 all-emacs:
 all-emacs19: all-bison all-byacc
 all-etc:
-configure-target-examples: $(ALL_GCC)
+configure-target-examples: $(ALL_GCC_C)
 all-target-examples: configure-target-examples
 all-expect: all-tcl all-tk
 all-fileutils: all-libiberty
@@ -1559,15 +1575,18 @@
 all-gash: all-tcl
 all-gawk:
 ALL_GCC = all-gcc
-all-gcc: all-bison all-byacc all-binutils all-gas all-ld
-all-bootstrap: all-libiberty all-bison all-byacc all-binutils all-gas all-ld
+ALL_GCC_C = $(ALL_GCC) all-target-newlib all-target-libgloss
+ALL_GCC_CXX = $(ALL_GCC_C) all-target-libstdc++ all-target-libstdc++-v3
+all-gcc: all-bison all-byacc all-binutils all-gas all-ld all-zlib
+all-bootstrap: all-libiberty all-texinfo all-bison all-byacc all-binutils all-gas all-ld all-zlib
 GDB_TK = all-tk all-tcl all-itcl all-tix all-libgui
 all-gdb: all-libiberty all-opcodes all-bfd all-mmalloc all-readline all-bison all-byacc all-sim $(gdbnlmrequirements) $(GDB_TK)
 all-gettext:
 all-gnuserv:
-configure-target-gperf: $(ALL_GCC)
+configure-target-gperf: $(ALL_GCC_C)
 all-target-gperf: configure-target-gperf all-target-libiberty all-target-libstdc++
 all-gprof: all-libiberty all-bfd all-opcodes all-intl
+all-grep: all-libiberty
 all-grez: all-libiberty all-bfd all-opcodes
 all-gui: all-gdb all-libproc all-target-librx
 all-guile:
@@ -1579,40 +1598,55 @@
 all-ispell: all-emacs19
 all-itcl: all-tcl all-tk all-tcl8.1 all-tk8.1
 all-ld: all-libiberty all-bfd all-opcodes all-bison all-byacc all-flex all-intl
-configure-target-libg++: $(ALL_GCC) configure-target-librx
-all-target-libg++: configure-target-libg++ all-gas all-ld all-gcc all-target-libiberty all-target-newlib all-target-libio all-target-librx all-target-libstdc++
+configure-target-libg++: $(ALL_GCC_CXX) configure-target-librx
+all-target-libg++: configure-target-libg++ all-target-libiberty all-target-librx
 configure-target-libgloss: $(ALL_GCC)
 all-target-libgloss: configure-target-libgloss configure-target-newlib
-configure-target-libio: $(ALL_GCC)
+configure-target-libio: $(ALL_GCC_C)
 all-target-libio: configure-target-libio all-gas all-ld all-gcc all-target-libiberty all-target-newlib
-check-target-libio:
+check-target-libio: all-target-libstdc++
 all-libgui: all-tcl all-tk all-tcl8.1 all-tk8.1 all-itcl
 all-libiberty:
-configure-target-librx: $(ALL_GCC) configure-target-newlib
+configure-target-libffi: $(ALL_GCC_C) 
+all-target-libffi: configure-target-libffi
+configure-target-libjava: $(ALL_GCC_CXX) configure-target-zlib configure-target-boehm-gc configure-target-qthreads configure-target-libffi
+all-target-libjava: configure-target-libjava all-zip all-target-zlib all-target-boehm-gc all-target-qthreads all-target-libffi
+configure-target-librx: $(ALL_GCC_C)
 all-target-librx: configure-target-librx
-configure-target-libstdc++: $(ALL_GCC)
-all-target-libstdc++: configure-target-libstdc++ all-gas all-ld all-gcc all-target-libiberty all-target-newlib all-target-libio
-configure-target-libstub: $(ALL_GCC)
+configure-target-libstdc++: $(ALL_GCC_C)
+all-target-libstdc++: configure-target-libstdc++ all-target-libiberty all-target-libio
+configure-target-libstdc++-v3: $(ALL_GCC_C)
+all-target-libstdc++-v3: configure-target-libstdc++-v3 all-target-libiberty
+configure-target-libstub: $(ALL_GCC_C)
 all-target-libstub: configure-target-libstub
 all-libtool:
+configure-target-libf2c: $(ALL_GCC_C)
+all-target-libf2c: configure-target-libf2c all-target-libiberty
+configure-target-libchill: $(ALL_GCC_C)
+all-target-libchill: configure-target-libchill all-target-libiberty
+configure-target-libobjc: $(ALL_GCC_C)
+all-target-libobjc: configure-target-libobjc all-target-libiberty
 all-m4: all-libiberty
 all-make: all-libiberty
 all-mmalloc:
 configure-target-newlib: $(ALL_GCC)
-configure-target-libtermcap: $(ALL_GCC)
-all-target-newlib: configure-target-newlib all-binutils all-gas all-gcc
-all-target-libtermcap: configure-target-libtermcap all-binutils all-gas all-gcc
-all-opcodes: all-bfd all-libiberty
+all-target-newlib: configure-target-newlib
+configure-target-libtermcap: $(ALL_GCC_C)
+all-target-libtermcap: configure-target-libtermcap
+all-opcodes: all-bfd all-libiberty all-cgen
 all-patch: all-libiberty
 all-perl:
 all-prms: all-libiberty
+configure-target-qthreads: $(ALL_GCC_C)
+all-target-qthreads: configure-target-qthreads
 all-rcs:
 all-readline:
 all-recode: all-libiberty
 all-sed: all-libiberty
 all-send-pr: all-prms
 all-shellutils:
-all-sim: all-libiberty all-bfd all-opcodes all-readline
+all-sim: all-libiberty all-bfd all-opcodes all-readline all-cgen
+all-snavigator: all-tcl all-tk all-itcl all-db all-grep all-libgui
 all-tar: all-libiberty
 all-tcl:
 all-tcl8.1:
@@ -1625,12 +1659,15 @@
 all-time:
 all-tix: all-tcl all-tk all-tcl8.1 all-tk8.1
 all-wdiff:
-all-target-winsup: all-target-newlib all-target-libiberty all-target-libtermcap configure-target-winsup
-configure-target-winsup: configure-target-newlib
+configure-target-winsup: $(ALL_GCC_C)
+all-target-winsup: all-target-libiberty all-target-libtermcap configure-target-winsup
 all-uudecode: all-libiberty
 all-zip:
-configure-target-libiberty: $(ALL_GCC) configure-target-newlib
-all-target-libiberty: configure-target-libiberty all-gcc all-ld all-target-newlib
+all-zlib:
+configure-target-zlib: $(ALL_GCC_C)
+all-target-zlib: configure-target-zlib
+configure-target-libiberty: $(ALL_GCC_C)
+all-target-libiberty: configure-target-libiberty
 all-target: $(ALL_TARGET_MODULES)
 install-target: $(INSTALL_TARGET_MODULES)
 install-gdb: install-tcl install-tk install-itcl install-tix install-libgui
@@ -1679,7 +1716,8 @@
 	config.guess config.if config.sub config move-if-change \
 	mpw-README mpw-build.in mpw-config.in mpw-configure mpw-install \
 	COPYING COPYING.LIB install-sh config-ml.in symlink-tree \
-	mkinstalldirs ltconfig ltmain.sh missing ylwrap
+	mkinstalldirs ltconfig ltmain.sh missing ylwrap \
+	libtool.m4 gettext.m4 ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh
 
 # Files in devo/etc used in any net release.
 # ChangeLog omitted because it may refer to files which are not in this
@@ -1745,7 +1783,8 @@
 	#
 	./configure sun4
 	[ -z "$(CONFIGURE_TARGET_MODULES)" ] \
-	  || $(MAKE) $(CONFIGURE_TARGET_MODULES) ALL_GCC="" \
+	  || $(MAKE) $(CONFIGURE_TARGET_MODULES) \
+	    ALL_GCC="" ALL_GCC_C="" ALL_GCC_CXX="" \
 	    CC_FOR_TARGET="$(CC)" CXX_FOR_TARGET="$(CXX)"
 	# Make links, and run "make diststuff" or "make info" when needed.
 	rm -rf proto-toplev ; mkdir proto-toplev
@@ -1765,7 +1804,7 @@
 	    fi ; \
 	  else ln -s ../$$d proto-toplev/$$d ; fi ; \
 	done
-	cd etc ; $(MAKE) info
+	cd etc && $(MAKE) info
 	$(MAKE) distclean
 	#
 	mkdir proto-toplev/etc
diff --git a/README-maintainer-mode b/README-maintainer-mode
new file mode 100644
index 0000000..ee57e84
--- /dev/null
+++ b/README-maintainer-mode
@@ -0,0 +1,6 @@
+
+                Notes on enabling maintainer mode
+
+Note that if you configure with --enable-maintainer-mode, you will need
+special versions of automake, autoconf, libtool and gettext. You will
+find the sources for these in ftp://sourceware.cygnus.com/pub/binutils.
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ddced79..7fdbcd2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,2384 @@
+2000-12-26  Kazu Hirata  <kazu@hxi.com>
+
+	* vaxnetbsd.c: Fix formatting.
+	* versados.c: Likewise.
+	* vms-gsd.c: Likewise.
+	* vms-hdr.c: Likewise.
+	* vms-misc.c: Likewise.
+
+2000-12-25  Alexandre Oliva  <aoliva@redhat.com>
+
+	* archive.c (coff_write_armap): Don't write more than symbol_count
+	`archive_member_file_ptr's.
+
+2000-12-25  Kazu Hirata  <kazu@hxi.com>
+
+	* vms-tir.c: Fix formatting.
+
+2000-12-23  Kazu Hirata  <kazu@hxi.com>
+
+	* vms.c: Fix formatting.
+	* vms.h: Likewise.
+
+2000-12-21  Santeri Paavolainen <santtu@ssh.com>
+
+	* vms-hdr.c: Include alloca.h if HAVE_ALLOCA_H is defined.
+
+	* peicode.h (pe_ILF_object_p): Add const to import of TARGET_LITTLE_SYM.
+
+	* elf32-m32r.c (m32r_elf_generic_reloc): Add cast to avoid (void *)
+	arithmetic.
+
+	* elf32-fr30.c: Add casts to avoid (void *) arithmetic.
+
+	* coffcode.h (styp_to_sec_flags): Add empty statement after label.
+
+2000-12-21  Richard Sandiford  <rsandifo@redhat.com>
+
+	* libbfd.c (bfd_get_bits): Added
+	(bfd_put_bits): Likewise
+	* bfd-in.h: Declared the above.
+	* bfd-in2.h: Regenerated.
+
+2000-12-20  Kazu Hirata  <kazu@hxi.com>
+
+	* targets.c: Fix formatting.
+	* tekhex.c: Likewise.
+	* trad-core.c: Likewise.
+
+2000-12-19  Kazu Hirata  <kazu@hxi.com>
+
+	* sco5-core.c: Fix formatting.
+	* section.c: Likewise.
+	* sparclinux.c: Likewise.
+	* sparclynx.c: Likewise.
+	* sparcnetbsd.c: Likewise.
+	* srec.c: Likewise.
+	* stabs.c: Likewise.
+	* stab-syms.c: Likewise.
+	* sunos.c: Likewise.
+	* syms.c: Likewise.
+	* sysdep.h: Likewise.
+
+2000-12-18  Nick Clifton  <nickc@redhat.com>
+
+	* coff-arm.c (EXTRA_S_FLAGS): Only define if not already
+	defined.
+	* epoc-pe-arm.c (EXTRA_S_FLAGS): Define.
+	* epoc-pei-arm.c (EXTRA_S_FLAGS): Define.
+
+2000-12-18  Nick Clifton  <nickc@redhat.com>
+
+	* vms-misc.c (_bfd_vms_get_record): Add default case to
+	file_format switch.
+
+2000-12-15  Miloslav Trmac <mitr@volny.cz>
+
+	* elfcore.h (elf_core_file_p): Move to the start of the program
+	headers before attempting to read them.
+
+2000-12-14  Kazu Hirata  <kazu@hxi.com>
+
+	* peigen.c: Fix formatting.
+	* som.c: Likewise.
+	* som.h: Likewise.
+
+2000-12-13  Kazu Hirata  <kazu@hxi.com>
+
+	* peigen.c: Fix formatting.
+
+2000-12-12  Jim Wilson  <wilson@redhat.com>
+
+	*  elfxx-ia64.c (get_dyn_sym_info): Cast %p argument to void *.
+
+2000-12-08  Mark Salter  <msalter@redhat.com>
+
+	* binary.c (binary_set_section_contents): Ignore sections
+	with zero size.
+
+2000-12-12  Kazu Hirata  <kazu@hxi.com>
+
+	* m68klinux.c: Fix formatting.
+	* m68knetbsd.c: Likewise.
+	* mipsbsd.c: Likewise.
+	* netbsd-core.c: Likewise.
+	* netbsd.h: Likewise.
+	* newsos3.c: Likewise.
+	* nlm32-alpha.c: Likewise.
+	* nlm32-i386.c: Likewise.
+	* nlm32-ppc.c: Likewise.
+	* nlm32-sparc.c: Likewise.
+	* nlmcode.h: Likewise.
+	* nlmswap.h: Likewise.
+	* nlm-target.h: Likewise.
+	* ns32knetbsd.c: Likewise.
+
+2000-12-10  Fred Fish  <fnf@be.com>
+
+      * elflink.h (elf_link_output_extsym): Don't complain about undefined
+      symbols in shared objects if allow_shlib_undefined is true.
+
+2000-12-12  Nick Clifton  <nickc@redhat.com>
+
+	* cpu-sh.c: Fix formattng.
+	* elf.c: Fix formattng.
+	* elf32-mips.c: Fix formattng.
+	* elf32-sh.c: Fix formattng.
+	* elf64-alpha.c: Fix formattng.
+
+2000-12-09  Nick Clifton  <nickc@redhat.com>
+
+	* elf32-mips.c (_bfd_mips_elf_find_nearest_line): Pass
+	dwarf2_find_line_info as last parameter to invocation of
+	_bfd_dwarf2_find_nearest_line.
+	* elf32-arm.h (elf32_arm_find_nearest_line): Pass
+	dwarf2_find_line_info as last parameter to invocation of
+	_bfd_dwarf2_find_nearest_line.
+
+2000-12-08  Mark Elbrecht  <snowball3@bigfoot.com>
+
+	* Makefile.am (BFD32_BACKENDS): Move dwarf2.lo from here...
+	(BFD_LIBS): ...to here.
+	(BFD32_BACKENDS_CFILES): Move dwarf2.c from here...
+	(BFD_LIBS_CFILES): ...to here.
+	* Makefile.in: Regenerate.
+	* configure.in: Remove dwarf.lo from the elf shell variable.
+	* configure: Regenerate.
+	* libcoff-in.h (coff_tdata): Add pointer dwarf2_find_line_info.
+	* libcoff.h: Regenerate.
+	* coffgen.c (coff_find_nearest_line): Call 
+	_bfd_dwarf2_find_nearest_line.
+	* dwarf2.c (_bfd_dwarf2_find_nearest_line): Add parameter. Update
+	accordingly.
+	(read_abbrevs): Likewise
+	(decode_line_info): Likewise.
+	(parse_comp_unit): Likewise.
+	(comp_unit_find_nearest_line): Likewise.
+	* libbfd-in.h (_bfd_dwarf2_find_nearest_line): Update prototype.
+	* libbfd.h: Regenerate.
+	* elf.c (_bfd_elf_find_nearest_line): Update call.
+	* elf-bfd.h (elf_obj_tdata): Change dwarf2_find_line_info to type PTR.
+	* dwarf2.c (concat_filename): Use IS_ABSOLUTE_PATH.
+	* coffcode.h (STYP_XCOFF_DEBUG, STYP_DEBUG_INFO): New macros.
+	(sec_to_styp_flags): Use them. Handle DWARF2 sections.
+	(styp_to_sec_flags): Handle DWARF2 sections.
+	* elf32-arm.h (elf32_arm_find_nearest_line): Add parameter to call
+	to _bfd_find_nearest_line.
+	* elf32-mips.c (_bfd_mips_elf_find_nearest_line): Add parameter to
+	call to _bfd_find_nearest_line.
+	  
+2000-12-08  Kazu Hirata  <kazu@hxi.com>
+
+	* coffgen.c: Fix formatting.
+	* elf-m10300.c: Likewise.
+	* elf32-i386.c: Likewise.
+	* elf32-i960.c: Likewise.
+	* elf32-m68k.c: Likewise.
+	* elf32-mcore.c: Likewise.
+	* elf32-ppc.c: Likewise.
+	* elf32-sh.c: Likewise.
+	* elf32-sparc.c: Likewise.
+	* elf32-v850.c: Likewise.
+	* elf64-alpha.c: Likewise.
+	* elf64-hppa.c: Likewise.
+	* elf64-mips.c: Likewise.
+	* elf64-sparc.c: Likewise.
+
+2000-12-07  Kazu Hirata  <kazu@hxi.com>
+
+	* elf32-ppc.c: Fix formatting.
+	* elf64-x86-64.c: Likewise.
+
+2000-12-06  Ulf Carlsson  <ulfc@engr.sgi.com>
+
+	From  Ralf Baechle  <ralf@gnu.org>
+
+	* elf32-mips.c (elf32_mips_merge_private_bfd_data): Always permit
+	BFDs containing no sections or empty .text, .data or .bss sections
+	to be merged, regardless of their flags.
+
+2000-12-06  Kazu Hirata  <kazu@hxi.com>
+
+	* elf32-m32r.c: Fix formatting.
+	* elf32-m68hc11.c: Likewise.
+	* elf32-m68hc12.c: Likewise.
+	* elf32-m68k.c: Likewise.
+	* elf32-mcore.c: Likewise.
+	* elf32-pj.c: Likewise.
+	* elf32-ppc.c: Likewise.
+
+2000-12-05  Kazu Hirata  <kazu@hxi.com>
+
+	* elf32-fr30.c: Fix formatting.
+	* elf32-hppa.c: Likewise.
+	* elf32-i370.c: Likewise.
+	* elf32-i386.c: Likewise.
+	* elf32-i860.c: Likewise.
+	* elf32-i960.c: Likewise.
+
+2000-12-03  Kazu Hirata  <kazu@hxi.com>
+
+	* elf32-arm.h: Fix formatting.
+	* elf32-avr.c: Likewise.
+	* elf32-cris.c: Likewise.
+	* elf32-d10v.c: Likewise.
+	* elf32-d30v.c: Likewise.
+	* elf-hppa.h: Likewise.
+	* elf-m10200.c: Likewise.
+	* elf-m10300.c: Likewise.
+
+2000-12-01  Chris Demetriou  <cgd@sibyte.com>
+
+        * aoutx.h (NAME(aout,machine_type)): Add bfd_mach_mips32 and
+        bfd_mach_mips32_4k.  Update FIXME comment.
+        * archures.c (bfd_mach_mips32): New constant.
+        (bfd_mach_mips4K, bfd_mach_mips32_4k) Rename the former to
+        the latter, renumber it.
+        * bfd-in2.h (bfd_mach_mips32): New constant.
+        (bfd_mach_mips4K, bfd_mach_mips32_4k) Rename the former to
+        the latter, renumber it.
+        * cpu-mips.c (I_mips32): New constant.
+        (I_mips4K, I_mips32_4k): Rename the former to the latter.
+        (arch_info_struct): Add bfd_mach_mips32 entry, replace
+        bfd_mach_mips4K entry with bfd_mach_mips32_4k entry.
+        * elf32-mips.c (elf_mips_isa): Add E_MIPS_ARCH_32 case.
+        (elf_mips_mach): Likewise.  Also, replace E_MIPS_MACH_MIPS32
+        with E_MIPS_MACH_MIPS32_4K.
+        (_bfd_mips_elf_final_write_processing): Replace
+        bfd_mach_mips4K with bfd_mach_mips32_4k case, add
+        bfd_mach_mips32 case.
+        (_bfd_mips_elf_merge_private_bfd_data): Generalize ISA mixing
+        comparison with support for MIPS32.
+        (_bfd_mips_elf_print_private_bfd_data): Print ISA name for
+        MIPS32.
+
+        * aoutx.h (NAME(aout,machine_type)): Add cases for
+        bfd_mach_mips5 and bfd_mach_mips64.
+        * archures.c (bfd_mach_mips5, bfd_mach_mips64): New constants.
+        * bfd-in2.h (bfd_mach_mips5, bfd_mach_mips64): Likewise.
+        * cpu_mips.c (I_mips5, I_mips64): New definitions.
+        (arch_info_struct): Add entries for bfd_mach_mips5 and
+        bfd_mach_mips64.
+        * elf32-mips.c (elf_mips_isa, elf_mips_mach,
+        _bfd_mips_elf_print_private_bfd_data): Add cases for
+        E_MIPS_ARCH_5 and E_MIPS_ARCH_64.
+        (_bfd_mips_elf_final_write_processing): Add cases for
+        bfd_mach_mips5 and bfd_mach_mips64.
+
+        * bfd/aoutx.h (NAME(aout,machine_type)): Add a
+        bfd_mach_mips_sb1 case.
+        * bfd/archures.c (bfd_mach_mips_sb1): New constant.
+        * bfd/bfd-in2.h (bfd_mach_mips_sb1): New constant.
+        * bfd/cpu-mips.c (I_sb1): New constant.
+        (arch_info_struct): Add entry for bfd_mach_mips_sb1.
+        * bfd/elf32-mips.c (elf_mips_mach): Add case for
+        E_MIPS_MACH_SB1.
+        (_bfd_mips_elf_final_write_processing): Add case for
+        bfd_mach_mips_sb1.
+
+2000-12-01      Joel Sherrill <joel@OARcorp.com>
+
+	* config.bfd (arm-*-rtems*, a29k-*rtems*): New targets.
+	(sparc*-*-rtemself*, sparc*-*-rtemsaout*): New targets.
+	(sparc*-*-rtems*): Switched from a.out to ELF.
+
+2000-11-30  Jan Hubicka  <jh@suse.cz>
+	
+        * Makefile.am (BFD64_BACKENDS): Add elf64-x86-64.lo
+        BFD64_BACKENDS_CFILES): Add elf64-x86-64.c
+        (elf64-x86-64.lo): Add dependencies.
+        * archures.c (DESCRIPTION): Add bfd_mach_x86_64,
+        bfd_mach_x86_64_intel_syntax.
+        * elf.c (prep_headers): Use EM_x86_64 for 64bit output.
+        * config.bfd (x86_64): Add.
+        * configure.in: Add support for bfd_elf64_x86_64_vec.
+        * cpu-i386.c (bfd_x86_64_arch_intel_syntax, bfd_x86_64_arch): Add.
+        (bfd_i386_arch, i8086_ar): Link in.
+        * elf64-x86-64.c: New file.
+        * reloc.c (ENUMDOC): Add BFD_RELOC_X86_64*.
+        * targets.c (bfd_elf64_x86_64_vec): Add.
+        (bfd_target_vect): Add bfd_elf64_x86_64_vec.
+
+2000-11-30  Kazu Hirata  <kazu@hxi.com>
+
+	* xcofflink.c: Fix formatting.
+
+2000-11-28  Kazu Hirata  <kazu@hxi.com>
+
+	* aoutx.h: Fix formatting.
+	* bfd-in.h: Likewise.
+	* bfd-in2.h: Likewise.
+	* cache.c: Likewise.
+	* cisco-core.c: Likewise.
+	* coff64-rs6000.c: Likewise.
+	* coffcode.h: Likewise.
+	* coffswap.h: Likewise.
+	* corefile.c: Likewise.
+	* elf32-mips.c: Likewise.
+
+2000-11-27  Kazu Hirata  <kazu@hxi.com>
+
+	* aout-adobe.c: Fix formatting.
+	* coff64-rs6000.c: Likewise.
+	* coffgen.c: Likewise.
+	* cofflink.c: Likewise.
+
+2000-11-27  Philip Blundell  <pb@futuretv.com>
+
+	* libcoff-in.h (coff_tdata): Add `strings_written' flag.
+	(obj_coff_strings_written): New accessor macro for above.
+	* libcoff.h: Regenerate.
+	* cofflink.c (_bfd_coff_final_link): Say that we wrote the
+	strings.
+	* coffcode.h (coff_write_object_contents): No need to write out
+	the string table if it's already been done.
+
+2000-11-22  Philip Blundell  <pb@futuretv.com>
+
+	* cofflink.c (_bfd_coff_generic_relocate_section): Don't object to 
+	weak undefined symbols.
+
+2000-11-24  Nick Clifton  <nickc@redhat.com>
+
+	* archures.c (bfd_mach_arm_5TE): Define.
+	(bfd_mach_arm+XScale): Define.
+	* bfd-in2.h: Regenerate.
+
+	* coff-arm.c (coff_arm_reloc_type_lookup): Accept
+	BFD_RELOC_ARM_PCREL_BLX.
+
+	* coffcode.h (coff_set_flags): Set flags for 5t, 5te and
+	XScale machine numbers.
+
+	* config.bfd (xscale-elf): Add target.
+	(xscale-coff): Add target.
+
+	* cpu-arm.c: Add xscale machine name.
+	Add v5t, v5te and XScale machine numbers.
+
+2000-11-23  Kazu Hirata  <kazu@hxi.com>
+
+	* aix386-core.c: Fix formatting.
+
+2000-11-22  Jim Wilson  <wilson@redhat.com>
+
+	* coff-ia64.c (howto_table): Use EMPTY_HOWTO.
+	(in_reloc_p): Add ATTRIBUTE_UNUSED to unused parameters.
+	* cpu-ia64-opc.c (ins_rsvd, ext_rsvd, ins_const, ext_const): Likewise.
+	(ins_imms_scaled): Initialize sign_bit at function entry.
+	(elf64_ia64_operands): Add missing initializers.
+	* elfxx-ia64.c (elfNN_ia64_reloc, elfNN_ia64_reloc_type_lookup,
+	elfNN_ia64_info_to_howto, elfNN_ia64_fake_sections,
+	elfNN_ia64_add_symbol_hook, elfNN_ia64_is_local_label_name,
+	elfNN_ia64_local_hash_table_init, get_fptr, get_pltoff,
+	elfNN_ia64_adjust_dynamic_symbol): Add ATTRIBUTE_UNUSED for unused
+	parameters.
+	(elfNN_ia64_info_to_howto): Initialize free_relocs, free_contents,
+	and free_extsyms at function entry.
+	(elfNN_add_symbol_hook): Add unsigned cast to bfd_get_gp_size result.
+	(elfNN_ia64_create_dynamic_sections): Delete unused local h.
+	(get_got): Delete unused local srel.
+	(elfNN_ia64_check_relocs): Initialize dynrel_type when declared.
+	(elfNN_ia64_relocate_section): Delete unused local dynindx.
+	
+2000-11-21  Kazu Hirata  <kazu@hxi.com>
+
+	* coff-a29k.c: Fix formatting.
+	* coff-h8500.c: Likewise.
+	* coff-i960.c: Likewise.
+	* coff-ppc.c: Likewise.
+	* coff-rs6000.c: Likewise.
+	* coff-stgo32.c: Likewise.
+	* coff-tic54x.c: Likewise.
+	* coff-w65.c: Likewise.
+	* cpu-h8500.c: Likewise.
+	* cpu-hppa.c: Likewise.
+	* cpu-ns32k.c: Likewise.
+	* ecoff.c: Likewise.
+	* ecofflink.c: Likewise.
+
+2000-11-21  Nick Clifton  <nickc@redhat.com>
+
+	* elf32-sh.c (sh_elf_reloc_loop): Fix compile time warning, and
+	remove possibility of infinite loop.
+
+2000-11-20  Kazu Hirata  <kazu@hxi.com>
+
+	* aix386-core.c: Fix formatting.
+	* aout-adobe.c: Likewise.
+	* aout-arm.c: Likewise.
+	* aout-encap.c: Likewise.
+	* aout-ns32k.c: Likewise.
+	* aout-target.h: Likewise.
+	* aout-tic30.c: Likewise.
+	* aoutf1.h: Likewise.
+	* aoutx.h: Likewise.
+	* archive.c: Likewise.
+	* bfd-in.h: Likewise.
+	* bfd-in2.h: Likewise.
+	* bfd.c: Likewise.
+	* bout.c: Likewise.
+
+2000-11-17  H.J. Lu  <hjl@gnu.org>
+
+	* elfxx-ia64.c (elfNN_ia64_size_dynamic_sections): Don't create
+	pltoff entries for DT_INIT and DT_FINI.
+	(elfNN_ia64_final_link): Don't set DT_INIT/FINI entries.
+	(elfNN_ia64_finish_dynamic_sections): Don't fill in DT_INIT/FINI
+	entries.
+
+2000-11-16  Richard Henderson  <rth@redhat.com>
+
+	* elfxx-ia64.c (elfNN_ia64_check_relocs): Handle IPLT relocs.
+	(allocate_dynrel_entries): Likewise.
+	(elfNN_ia64_relocate_section): Likewise.  Set REL addends correctly.
+	(set_pltoff_entry): Likewise.
+	(ia64_howto_table): Remove R_IA64_SEGBASE, and R_IA64_EPLT[ML]SB
+	(elfNN_ia64_reloc_type_lookup): Likewise.
+	(elfNN_ia64_install_value): Likewise.
+	(elfNN_ia64_relocate_section): Likewise.
+	* reloc.c (BFD_RELOC_IA64_SEGBASE): Remove.
+	(BFD_RELOC_IA64_EPLTMSB, BFD_RELOC_IA64_EPLTLSB): Remove.
+
+2000-11-16  Kazu Hirata  <kazu@hxi.com>
+
+	* cpu-a29k.c: Fix formatting.
+	* cpu-alpha.c: Likewise.
+	* cpu-arm.c: Likewise.
+	* cpu-avr.c: Likewise.
+	* cpu-d10v.c: Likewise.
+	* cpu-h8500.c: Likewise.
+	* cpu-hppa.c: Likewise.
+	* cpu-i370.c: Likewise.
+	* cpu-i386.c: Likewise.
+	* cpu-i960.c: Likewise.
+	* cpu-ia64-opc.c: Likewise.
+	* cpu-ia64.c: Likewise.
+	* cpu-m32r.c: Likewise.
+	* cpu-m68hc11.c: Likewise.
+	* cpu-m68hc12.c: Likewise.
+	* cpu-m68k.c: Likewise.
+	* cpu-m88k.c: Likewise.
+	* cpu-mips.c: Likewise.
+	* cpu-ns32k.c: Likewise.
+	* cpu-pj.c: Likewise.
+	* cpu-powerpc.c: Likewise.
+	* cpu-sh.c: Likewise.
+	* cpu-sparc.c: Likewise.
+	* cpu-tic54x.c: Likewise.
+	* cpu-v850.c: Likewise.
+	* cpu-vax.c: Likewise.
+	* cpu-w65.c: Likewise.
+	* cpu-we32k.c: Likewise.
+	* cpu-z8k.c: Likewise.
+	* dwarf1.c: Likewise.
+	* dwarf2.c: Likewise.
+
+2000-11-15  Kazu Hirata  <kazu@hxi.com>
+
+	* coff-arm.c: Fix formatting.
+	* coff-ppc.c: Likewise.
+	* coff-rs6000.c: Likewise.
+	* coff-sh.c: Likewise.
+	* coff-sparc.c: Likewise.
+	* coff-tic30.c: Likewise.
+	* coff-tic54x.c: Likewise.
+	* coff-tic80.c: Likewise.
+	* coff-w65.c: Likewise.
+	* coff-we32k.c: Likewise.
+	* coff-z8k.c: Likewise.
+
+2000-11-15  Richard Henderson  <rth@redhat.com>
+
+	* elf64-alpha.c (elf64_alpha_check_relocs): Create the reloc
+	section with the same ALLOC|LOAD flags as the source section.
+
+2000-11-14  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf64-alpha.c (elf64_alpha_relax_opt_call): Only check bits used
+	by STO_ALPHA constants.
+
+2000-11-14  Kazu Hirata  <kazu@hxi.com>
+
+	* coff-pmac.c: Fix formatting.
+	* coff-ppc.c: Likewise.
+
+2000-11-13  H.J. Lu  <hjl@gnu.org>
+
+	* elflink.h (elf_link_add_object_symbols): Also add indirect
+	symbols for common symbols with the default version.
+
+2000-11-09  Philip Blundell  <pb@futuretv.com>
+
+	* section.c (STD_SECTION): Set gc_mark flag.
+
+2000-11-11  Kazu Hirata  <kazu@hxi.com>
+
+	* coff-i960.c: Likewise.
+	* coff-m68k.c: Likewise.
+	* coff-m88k.c: Likewise.
+	* coff-mcore.c: Likewise.
+	* coff-mips.c: Likewise.
+
+2000-11-11  Bernd Schmidt  <bernds@cygnus.co.uk>
+
+	* elf32-sh.c (sh_elf_relocate_section): Ignore R_SH_NONE relocs.
+
+2000-11-10  Kazu Hirata  <kazu@hxi.com>
+
+	* coff-h8300.c: Fix formatting.
+	* coff-h8500.c: Likewise.
+	* coff-i386.c: Likewise.
+	* coff-i860.c: Likewise.
+	* coff-i960.c: Likewise.
+	* coff-ia64.c: Likewise.
+
+2000-11-09  Kazu Hirata  <kazu@hxi.com>
+
+	* archive.c: Fix formatting.
+	* archures.c: Likewise.
+
+2000-11-07  Richard Henderson  <rth@redhat.com>
+
+	* elfxx-ia64.c (elf64_ia64_final_link): New local unwind_output_sec.
+	Set it before bfd_elf64_bfd_final_link call.  Use it after the call.
+	* section.c (bfd_set_section_contents): Call memcpy if
+	section->contents set and location not equal to contents plus offset.
+
+2000-11-08  Kazu Hirata  <kazu@hxi.com>
+
+	* bfd-in.h: Fix formatting.
+	* bfd-in2.h: Likewise.
+	* bfd.c: Likewise.
+	* binary.c: Likewise.
+	* bout.c: Likewise.
+	* coff-a29k.c: Likewise.
+	* coff-alpha.c: Likewise.
+	* coff-apollo.c: Likewise.
+	* coff-aux.c: Likewise.
+
+2000-11-07  Kazu Hirata  <kazu@hxi.com>
+
+	* aix386-core.c: Fix formatting.
+	* aoutf1.h: Likewise.
+	* aoutx.h: Likewise.
+	* archures.c: Likewise.
+	* armnetbsd.c: Likewise.
+
+2000-11-07  Alan Modra  <alan@linuxcare.com.au>
+
+	* coff-h8300.c (special): Adjust reloc address.
+
+2000-11-06  Steve Ellcey <sje@cup.hp.com>
+
+	* archures.c (bfd_mach_ia64_elf64, bfd_mach_ia64_elf32): Add defines
+	to differentiate elf32 and elf64 on ia64.
+	* bfd-in2.h: Regenerate.
+	* config.bfd: Add target for "ia64*-*-hpux*".
+	* configure.in: Add bfd_elf32_ia64_big_vec to selvecs switch.
+	* configure: Regenerate.
+	* cpu-ia64.c (bfd_ia64_elf32_arch): Add elf32 arch info structure.
+	* targets.c: Add bfd_target bfd_elf32_ia64_big_vec.
+
+	* Makefile.am: Make elf32-ia64.c and elf64-ia64.c derived objects
+	from elfxx-ia64.c.  Add depenency rules for making elf32-ia64.lo.
+	* Makefile.in: Regnerate.
+	* elf64-ia64.c: Deleted.
+	* elfxx-ia64.c: New file, paramaterized version of elf64-ia64.c.
+
+2000-11-06  Kazu Hirata  <kazu@hxi.com>
+
+	* aout-adobe.c: Fix formatting.
+	* aout-arm.c: Likewise.
+	* aout-cris.c: Likewise.
+	* aout-encap.c: Likewise.
+	* aout-ns32k.c: Likewise.
+	* aout-target.h: Likewise.
+	* aout-tic30.c: Likewise.
+
+2000-11-05  Philip Blundell  <philb@gnu.org>
+
+	* elf32-arm.h (elf32_arm_merge_private_bfd_data): Always permit
+	BFDs containing no sections to be merged, regardless of their flags.
+
+2000-11-04  Philip Blundell  <philb@gnu.org>
+
+	* elf32-arm.h (elf32_arm_relocate_section): Suppress error message
+	if a relocation for an undefined symbol also results in an
+	overflow.
+
+2000-11-06  Christopher Faylor <cgf@cygnus.com>
+
+	* config.bfd: Add support for Sun Chorus.
+
+2000-11-05  David O'Brien  <obrien@FreeBSD.org>
+
+	* configure.in: Recognize alpha-*-freebsd*.
+	* configure: Regenerate.
+
+2000-11-02  Luciano Gemme <ishitawa@yahoo.com> 
+
+	* srec.c (CHUNK): Rename to DEFAULT_CHUNK.
+	(Chunk): New global variable set by a parameter in objcopy.c.
+	(S3Forced): New global variable set by a parameter in
+	objcopy.c.
+	(srec_set_section_contents): If S3Forced is true, always generate
+	S3 records.
+	(srec_write_section): Use 'Chunk' to limit maximum length of S
+	records.
+
+2000-11-02  Per Lundberg  <plundis@chaosdev.org>
+
+	* config.bfd: Add support for i[3456]86-chaosdev-storm-chaos.
+	* Makefile.in: Regenerate.
+	* bfd-in2.h: Regenerate.
+	* po/bfd.pot: Regenerate.
+	
+2000-10-31  Philip Blundell  <philb@gnu.org>
+
+	* elf32-arm.h (elf32_arm_merge_private_bfd_data): Only handle
+	EF_SOFT_FLOAT if it is defined.
+
+2000-10-27  Philip Blundell  <philb@gnu.org>
+
+	* elf32-arm.h (elf32_arm_copy_private_bfd_data): Don't refuse
+	attempts to mix PIC code with non-PIC, just mark the output as
+	being position dependent.
+	(elf32_arm_merge_private_bfd_data): Likewise.  Print an error 
+	message for EF_SOFT_FLOAT mismatches.  Display diagnostics for 
+	all mismatches, not just the first one.
+	
+2000-10-25  Chris Demetriou  <cgd@sibyte.com>
+
+	* ieee.c (ieee_archive_p): Plug one of many possible
+	memory leaks in error handling.
+
+2000-10-20  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf32-sparc.c (elf32_sparc_merge_private_bfd_data,
+	elf32_sparc_object_p, elf32_sparc_final_write_processing):
+	Support v8plusb.
+	* elf64-sparc.c (sparc64_elf_merge_private_bfd_data,
+	sparc64_elf_object_p): Support v9b.
+	* archures.c: Declare v8plusb and v9b machines.
+	* bfd-in2.h: Ditto.
+	* cpu-sparc.c: Ditto.
+
+2000-10-16  Geoffrey Keating  <geoffk@shoggoth.cygnus.com>
+
+	* elf64-sparc.c (sparc64_elf_relocate_section): Clear the location
+	of a GOT reloc.
+
+	* elf32-ppc.c (SYMBOL_REFERENCES_LOCAL): New macro.
+	(SYMBOL_CALLS_LOCAL): New macro.
+	(ppc_elf_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL.
+	(ppc_elf_check_relocs): Use SYMBOL_REFERENCES_LOCAL.
+	(ppc_elf_finish_dynamic_symbol): Use SYMBOL_REFERENCES_LOCAL.
+	(ppc_elf_relocate_section): Use flag variable to determine
+	whether the relocation refers to a local symbol.
+	Test whether a PLTREL24 reloc will produce a reloc by looking
+	to see whether a PLT entry was made.
+
+2000-10-14  Geoffrey Keating  <geoffk@shoggoth.cygnus.com>
+
+	* elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Don't make PLT
+	entries that could serve as a definition for a weak symbol.
+
+2000-10-13  Ulf Carlsson  <ulfc@engr.sgi.com>
+
+	From  Ralf Baechle  <ralf@gnu.org>
+
+	* elf32-mips.c (mips_elf_create_dynamic_relocation): New argument
+	local_p.  Add symbol value only for non-R_MIPS_REL32 relocations
+	against local symbols.
+	(_bfd_mips_elf_finish_dynamic_sections): Undo patch from 2000-10-01.
+	
+2000-10-12  Alan Modra  <alan@linuxcare.com.au>
+
+	* section.c (struct sec): Add kept_section.
+	(struct bfd_comdat_info): Remove sec, we can use above.
+	(STD_SECTION): Add initializer.
+	(bfd_make_section_anyway): Init here too.
+
+	* bfd-in2.h: Regenerate.
+
+	* elflink.h (elf_link_add_object_symbols): Remove unnecessary
+	zeroing of `flags'.  
+	(elf_link_input_bfd): Set all asection->symbol->value's here, and
+	fudge values for discarded link-once section symbols.
+
+	* elf64-hppa.c: Include alloca-conf.h
+
+2000-10-11  Alan Modra  <alan@linuxcare.com.au>
+
+	* elf.c (swap_out_syms): Revert 2000-10-07 changes.
+
+	* ieee.c (ieee_make_empty_symbol): Oops, bfd_zalloc needs another arg.
+
+2000-10-10  Alan Modra  <alan@linuxcare.com.au>
+
+	* ieee.c (ieee_make_empty_symbol): Use bfd_zalloc, not bfd_zmalloc.
+
+2000-10-10  Tom Rix <trix@redhat.com>
+
+	* section.c (bfd_make_section_anyway): Release newsect ptr when 
+	newsect->symbol fails to alloc.  Use bfd_release instead of free.
+
+2000-10-09  Richard Henderson  <rth@cygnus.com
+
+	* elf64-ia64.c (elf64_ia64_unwind_entry_compare_bfd): New.
+	(elf64_ia64_unwind_entry_compare): New.
+	(elf64_ia64_final_link): Sort the .IA_64.unwind section.
+
+2000-10-07  Alan Modra  <alan@linuxcare.com.au>
+
+	* elflink.h (size_dynamic_sections): Don't create various tags if
+	.dynstr is excluded from the link.  Don't set first dynsym entry
+	if dynsymcount is zero.
+	(elf_bfd_final_link): Don't try to swap out dynamic syms if
+	.dynsym excluded from the link.  Don't try to write any dynamic
+	sections excluded from the link.
+
+	* elf.c (swap_out_syms): Handle global section symbols.
+
+2000-10-05  DJ Delorie  <dj@redhat.com>
+
+	* peigen.c (_bfd_pei_swap_scnhdr_out): note extended relocs
+	* coffcode.h (coff_set_alignment_hook): read extended reloc count
+	(coff_write_relocs): write extended reloc count
+	(coff_write_object_contents): account for extended relocs
+
+2000-10-05  Jim Wilson  <wilson@cygnus.com>
+
+	* elf-bfd.h (struct elf_backend_data): Add elf_backend_section_flags
+	field.
+	* elf.c (_bfd_elf_make_section_from_shdr): Call the
+	elf_backend_section_flags function.
+	* elf64-ia64.c (elf64_ia64_section_from_shdr): Delete flag conversion
+	code.
+	(elf64_ia64_section_flags): New function containing flag conversion
+	code.
+	(elf_backend_section_flags): Define to elf64_ia64_section_flags.
+	* elfxx-target.h (elf_backend_section_flags): Define.
+	(elfNN_bed): Initialize elf_backend_section_flags field.
+
+2000-10-02  Alan Modra  <alan@linuxcare.com.au>
+
+	* elf32-hppa.c (elf32_hppa_check_relocs): Correct call to
+	_bfd_elf32_gc_record_vtable.  Correct a comment.
+
+2000-10-01  Ulf Carlsson  <ulfc@engr.sgi.com>
+
+	From  Ralf Baechle  <ralf@gnu.org>
+
+	* elf32-mips.c (_bfd_mips_elf_finish_dynamic_sections): Mark gld
+	produces binaries with got[1] = 0x80000001 to differenciate them
+	for the dynamic linker from the broken binaries produced by old
+	versions.
+
+2000-09-30  Petr Sorfa <petrs@sco.com>
+
+	* elf.c (elfcore_grok_pstatus): Check for size of pxstatus_t.
+	(elfcore_grok_lwpstatus): Check for size of lwpxstatus_t.
+	* configure.in: Add check for pxstatus_t and lwpxstatus_t.
+	* configure: Regenerate.
+
+2000-09-27  Hans-Peter Nilsson  <hp@axis.com>
+
+	Define two bfd_targets for absence and presence of leading
+	underscore on symbols.  Make sure to only link same kind.
+	* elf32-cris.c (cris_elf_object_p,
+	cris_elf_final_write_processing, cris_elf_print_private_bfd_data,
+	cris_elf_merge_private_bfd_data): New.
+	(elf_backend_object_p, elf_backend_final_write_processing,
+	bfd_elf32_bfd_print_private_bfd_data,
+	bfd_elf32_bfd_merge_private_bfd_data): Define.
+	<Target vector definition>: Include elf32-target.h twice with
+	different macro settings:
+	(TARGET_LITTLE_SYM): First as bfd_elf32_cris_vec, then as
+	bfd_elf32_us_cris_vec.
+	(TARGET_LITTLE_NAME): First as "elf32-cris", then "elf32-us-cris".
+	(elf_symbol_leading_char): First as 0, then '_'.
+	(INCLUDED_TARGET_FILE): Define for second include of elf32-target.h.
+	* config.bfd (cris-*-*): Add bfd_elf32_us_cris_vec to targ_selvecs.
+	* configure.in (bfd_elf32_cris_vec, cris_aout_vec): New vector.
+	* configure: Regenerate.
+	* targets.c: Declare bfd_elf32_us_cris_vec.
+	* po/bfd.pot: Regenerate.
+
+2000-09-29  Momchil Velikov  <velco@fadata.bg>
+
+	* elf32-arm.h (arm_add_to_rel): Correctly adjust the addend for
+	R_ARM_THM_PC22 relocations.
+
+2000-09-29  NIIBE Yutaka <gniibe@chroot.org>
+
+	* elflink.h (elf_link_add_object_symbols): Don't bfd_release runpath.
+
+2000-09-29  Momchil Velikov <velco@fadata.bg>
+
+	* elf.c (elf_fake_sections): Do not mark the section SHT_NOBITS if
+	is has the SEC_HAS_CONTENTS flag set.
+
+2000-09-28  Örjan Friberg  <orjanf@axis.com>
+	    Hans-Peter Nilsson  <hp@axis.com>
+
+	* aout-cris.c (N_TXTADDR): Define.
+
+2000-09-28  John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+	* som.c: Include alloca-conf.h.
+	* Makefile.am: "make dep-am"
+	* Makefile.in: Regenerate.
+
+2000-09-27  Alan Modra  <alan@linuxcare.com.au>
+
+	* elf32-hppa.c (plt_stub): New.
+	(PLT_STUB_ENTRY): Define.
+	(elf32_hppa_link_hash_table): Change multi_subspace to packed
+	boolean.  Add need_plt_stub, has_12bit_branch and has_17bit_branch.
+	(elf32_hppa_link_hash_table_create): Init to suit.
+	(elf32_hppa_check_relocs): Set has_12bit_branch and
+	has_17bit_branch as appropriate.
+	(elf32_hppa_adjust_dynamic_symbol): Set need_plt_stub for
+	non-local functions.
+	(elf32_hppa_size_dynamic_sections): Correct setting of reltext.
+	Add space for plt_stub as needed.
+	(elf32_hppa_finish_dynamic_symbol): Point .plt entries for global
+	functions at plt_stub.
+	(elf32_hppa_finish_dynamic_sections): Write plt_stub.
+	(elf32_hppa_create_dynamic_sections): Leave .plt executable.
+
+	* elf32-hppa.h (elf32_hppa_size_stubs): Add group_size param.
+	* elf32-hppa.c (elf32_hppa_size_stubs): Likewise.  Use it instead
+	of fixed size, and if negative, disable handling of input sections
+	before stub section.  Set up default stub group size depending
+	on detected branch relocs.
+	(hppa_build_one_stub): Use lrsel and rrsel for import stubs to
+	ensure different offsets from sym_value aren't rounded to
+	different 2k blocks.  Use lrsel and rrsel for other stubs too for
+	consistency rather than necessity.
+	(elf32_hppa_check_relocs): Handle R_PARISC_DIR14F.
+	(final_link_relocate): Likewise.
+	(elf32_hppa_relocate_section): Likewise.
+
+	* elf-hppa.h (elf_hppa_howto_table): Add R_PARISC_DIR14F reloc.
+	(_bfd_elf_hppa_gen_reloc_type): Generate them.
+	(elf_hppa_final_link_relocate): Handle them.
+	(elf_hppa_relocate_insn): Likewise.
+	(_bfd_elf_hppa_gen_reloc_type): Add missing e_ldsel and e_rdsel cases.
+
+2000-09-26  Hans-Peter Nilsson  <hp@axis.com>
+
+	* elfcode.h (elf_object_p): Preserve and clear abfd section
+ 	information.  Restore at error.
+
+2000-09-26  Paul Sokolovsky  <Paul.Sokolovsky@technologist.com>
+
+	* peigen.c (_bfd_pei_swap_aouthdr_in): If some DataDirectory
+	is empty, make sure that its rva also 0. NT loader dislikes
+	having otherwise.
+
+2000-09-26  Steve Ellcey <sje@cup.hp.com>
+
+	* som.c (som_bfd_derive_misc_symbol_info): Make weak symbols
+	global by default.
+
+2000-09-21  Alan Modra  <alan@linuxcare.com.au>
+
+	* elf32-hppa.c (elf32_hppa_check_relocs): Fix weak sym handling in
+	currently unused RELATIVE_DYNAMIC_RELOCS code.
+	(hppa_discard_copies): Likewise.
+	(elf32_hppa_size_stubs): Size `input_list' array correctly.  Correct
+	comments.  Don't check non-code output sections for stub grouping.
+
+2000-09-20  Alan Modra  <alan@linuxcare.com.au>
+
+	* section.c (bfd_get_unique_section_name): Return NULL if
+	bfd_malloc fails.
+
+2000-09-19  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
+
+	* elf32-m68k.c (elf_cpu32_plt0_entry): Change the PLT entry 0
+	instruction sequence to actually work.
+	(elf_m68k_finish_dynamic_sections): Change the patch-in offset
+	accordingly.
+
+2000-09-18  Alexandre Oliva  <aoliva@redhat.com>
+
+	* elf32-sh.c (sh_elf_relocate_section): Use
+	_bfd_final_link_relocate to apply the relocation against a section
+	symbol, when doing relocatable links.
+
+2000-09-18  Alan Modra  <alan@linuxcare.com.au>
+
+	* elf32-hppa.c (elf32_hppa_stub_hash_entry): Rename input_section
+	to id_sec.
+	(stub_hash_newfunc): Here too.
+	(hppa_add_stub): And here.
+	(elf32_hppa_link_hash_table): Remove stub_section_created,
+	reloc_section_created, first_init_sec and first_fini_sec.  Add
+	stub_group.
+	(elf32_hppa_link_hash_table_create): Init to suit.
+	(hppa_get_stub_entry): Add support for grouping stub sections.
+	(hppa_add_stub): Likewise.  Remove sec_count param and init/fini
+	section code.  Index stub vars by section->id.
+	(elf32_hppa_size_stubs): Likewise.  Remove duplicated function
+	exit paths.  Zap allocation of above removed vars.  Refine
+	link-once test.
+
+	* elf32-hppa.h (elf32_hppa_size_stubs): Add output_bfd param.
+	* elf32-hppa.c (elf32_hppa_size_stubs): Likewise.
+	(hppa_get_stub_entry): Pass in pointer to elf32_hppa_link_hash_table
+	rather than pointer to bfd_link_info.
+	(hppa_add_stub): Likewise.
+	(final_link_relocate): Likewise.
+
+2000-09-17  David Huggins-Daines  <dhd@linuxcare.com>
+
+	(elf32_hppa_size_stubs): Don't try to build stubs for discarded
+	link-once sections.
+
+2000-09-16  Alexandre Oliva  <aoliva@redhat.com>
+
+	* elf32-sh.c (ELF_MAXPAGESIZE): Define to 128, to match
+	ld/emulparams/shelf.sh.
+
+2000-09-10  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
+
+	* elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): New function.
+	* bfd-in.h (bfd_m68k_elf32_create_embedded_relocs): Add declaration.
+	* bfd-in2.h: Regenerate.
+
+2000-09-15  Kenneth Block  <Kenneth.Block@compaq.com>
+
+	* bfd/elf64-alpha.c (elf64_alpha_relax_with_lituse): ld performs
+	LITUSE relocations incorrectly if -relax is specified on the ld
+	command line and the displacement field of the load or store
+	instruction is non-zero. (Patch by paul.winalski@compaq.com)
+
+2000-09-15  Alan Modra  <alan@linuxcare.com.au>
+
+	* elf32-hppa.c (hppa_add_stub): Dont set first_init_sec and
+	first_fini_sec here.
+	(elf32_hppa_size_stubs): Instead correctly find the first .init
+	and .fini section here.
+
+2000-09-15  David Huggins-Daines  <dhd@linuxcare.com>
+
+	* elf32-hppa.c (clobber_millicode_symbols): New function.
+	(elf32_hppa_size_dynamic_sections): Call it.
+
+2000-09-14  Alan Modra  <alan@linuxcare.com.au>
+
+	* elf32-hppa.c (elf32_hppa_link_hash_entry): Make pic_call
+	packed.  Add plabel, plt_abs packed booleans.
+	(hppa_link_hash_newfunc): Init new fields.
+	(PLABEL_PLT_ENTRY_SIZE): Define.
+	(hppa_stub_name): Use size_t len vars.
+	(hppa_add_stub): Likewise.
+	(elf32_hppa_build_stubs): Likewise.
+	(hppa_build_one_stub): Kill some compiler warnings.
+	(elf32_hppa_check_relocs): Always generate a plt entry for PLABELs
+	if dynamic linking.  Munge the local plt offsets into
+	local_got_refcounts.  Set h->plabel for all global PLABELs.  Use
+	size_t len vars.  Add assert for plabel addend.
+	(elf32_hppa_gc_sweep_hook): Sweep local plt entries too.
+	(elf32_hppa_hide_symbol): New function.
+	(elf_backend_hide_symbol): Define.
+	(elf32_hppa_adjust_dynamic_symbol): Don't throw away plt entries
+	with h->plabel set.  Don't make plt entries to have dynamic syms
+	when they have been forced local.  If plt entry is used by a
+	plabel, make it PLABEL_PLT_ENTRY_SIZE.
+	(elf32_hppa_size_dynamic_sections): Set plt_abs for init fns.
+	Set up .plt offsets for local syms.
+	(elf32_hppa_relocate_section): Initialise plt entries for local
+	syms.  Leave weak undefined plabels zero.  Make global plabel
+	relocs against function symbol, and leave the addend zero.
+	Use *ABS* DIR32 relocs instead of SEGREL32 for dynamic got relocs.
+	(elf32_hppa_finish_dynamic_symbol): Set up IPLT relocs for
+	non-dynamic syms.  Init extra plt for plabels.  Use *ABS* DIR32
+	relocs instead of SEGREL32 for dynamic got relocs.
+	(elf32_hppa_finish_dynamic_sections): Reserve one more .got entry.
+	(elf_backend_got_header_size): Adjust.
+	(elf32_hppa_set_gp): Calculate an "ideal" LTP.
+
+	* elf32-hppa.c (LONG_BRANCH_VIA_PLT): Define.
+	(hppa_type_of_stub): Use it instead of #if 0
+	(hppa_discard_copies): Use it here too.
+	(elf32_hppa_size_dynamic_sections): And here.
+
+	* elf32-hppa.c (elf32_hppa_link_hash_table): Remove `offset' field.
+	(elf32_hppa_link_hash_table_create): And here.
+	(hppa_build_one_stub): And here.  Instead keep track of stub
+	offset using _raw_size.
+	(elf32_hppa_size_stubs): Likewise.
+	(elf32_hppa_build_stubs): Likewise.
+	(hppa_size_one_stub): Likewise.  Resize reloc section too.
+
+	* elf32-hppa.c (hppa_add_stub): Correct first_init_sec and
+	first_fini_sec handling.  Don't search for reloc section or set
+	hplink->reloc_section_created here.
+	(elf32_hppa_size_stubs): Instead search for reloc sections, and
+	set reloc_section_created here.
+	(hppa_handle_PIC_calls): Set ELF_LINK_HASH_NEEDS_PLT.
+	(elf32_hppa_size_dynamic_sections): Make a .plt entry for DT_INIT
+	and DT_FINI.
+	(elf32_hppa_finish_dynamic_sections): Set DT_INIT and DT_FINI.
+
+	* elf32-hppa.c (hppa_build_one_stub): Replace `elf_hash_table (info)'
+	with `hplink->root.'.
+	(elf32_hppa_check_relocs): Likewise.
+	(elf32_hppa_gc_sweep_hook): Likewise.
+	(elf32_hppa_adjust_dynamic_symbol): Likewise.
+	(hppa_handle_PIC_calls): Likewise.
+	(elf32_hppa_size_dynamic_sections): Likewise.
+	(elf32_hppa_set_gp): Likewise.
+	(elf32_hppa_relocate_section): Likewise.
+	(elf32_hppa_finish_dynamic_symbol): Likewise.
+	(elf32_hppa_finish_dynamic_sections): Likewise.
+
+	From  David Huggins-Daines  <dhd@linuxcare.com>
+	* elf32-hppa.c (hppa_type_of_stub): Generate import stubs for
+	defined weak symbols in shared links.
+	(final_link_relocate): Calls to defined weak symbols in shared
+	objects must go via import stubs, as the target might not be known
+	at link time.
+
+2000-09-14  Alexandre Oliva  <aoliva@redhat.com>
+
+	* elf32-sh.c (sh_elf_howto_table): Moved R_SH_GOT32, R_SH_PLT32,
+	R_SH_COPY, R_SH_GLOB_DAT, R_SH_JMP_SLOT, R_SH_RELATIVE,
+	R_SH_GOTOFF, R_SH_GOTPC) to the range from 160 to 167.  Replaced
+	the original entries with EMPTY_HOWTOs, and added new ones to fill
+	in the gap.
+	(sh_elf_info_to_howto): Make sure the new gap isn't used.
+	(sh_elf_relocate_section): Likewise.
+
+2000-09-13  Anders Norlander  <anorland@acc.umu.se>
+
+ 	* cpu-mips.c (arch_info_struct): Add mips:4K
+ 	* bfd-in2.h (bfd_mach_mips4K): New define.
+ 	* archures.c: Add bfd_mach_mips4K to comment.
+ 	* elf32-mips.c (_bfd_mips_elf_final_write_processing): Return
+	E_MIPS_ARCH_2 for bfd_mach_mips4K.
+
+2000-09-13  Marco Franzen <marcof@thyron.com>
+
+	* som.c (som_write_symbol_strings): Do not used fixed buffers,
+	use size_t as a counter.
+	(som_write_space_strings): Similarly.
+
+2000-09-12  Jason Eckhardt  <jle@cygnus.com>
+
+	* elf32-i860.c (elf32_i860_relocate_pc26): New function
+	and prototype.
+	(elf32_i860_relocate_section): Invoke new function from here.
+
+2000-09-11  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
+
+	* elf.c (_bfd_elf_make_section_from_shdr): Make debug_sec_names
+	static.
+
+2000-09-10  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
+
+	* coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Emit 8 NULs for
+	target section name instead of dumping core when the target symbol is
+	undefined.
+
+2000-09-09  Kazu Hirata  <kazu@hxi.com>
+
+	* riscix.c: Remove DEFUN.
+
+2000-09-08  Nick Clifton  <nickc@redhat.com>
+
+	* elf32-arm.h (elf32_arm_merge_private_bfd_data): Do not
+	initialise flags in output bfd if the input bfd is the default
+	architecture with the default flags.
+
+2000-09-08  Kazu Hirata  <kazu@hxi.com>
+
+	* archive.c: Fix formatting.
+	* coff-arm.c: Likewise.
+	* doc/chew.c: Likewise.
+
+2000-09-08  Alan Modra  <alan@linuxcare.com.au>
+
+	* section.c (bfd_get_unique_section_name): Put a dot before the
+	numeric suffix.
+
+2000-09-07  Kazu Hirata  <kazu@hxi.com>
+
+	* doc/chew.c: Remove all uses of DEFUN and DEFUN_VOID.
+	* elf.c: Fix formatting.
+
+2000-09-07  Alexandre Oliva  <aoliva@redhat.com>
+
+	* config.bfd (sh-*-linux*): Added.
+	* configure.in (bfd_elf32_shlin_vec, bfd_elf32_shblin_vec): New.
+	* targets.c: Declare them.
+	* elf32-sh-lin.c: New file.
+	* Makefile.am: Compile it.
+	* elf32-sh.c: Don't override defines from elf32-sh-lin.c.
+	* configure, Makefile.in: Rebuilt.
+
+2000-09-06  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* xcofflink.c (xcoff_link_input_bfd): Include the .tocbss
+	pseduo-section when determining where the TOC ends.
+
+	* coff-rs6000.c (_bfd_xcoff_swap_aux_out): Use bfd_h_put_16 to
+	output x_tvndx as it is only two bytes wide.
+
+	* coff-rs6000.c (xcoff_howto_table): A modifiable branch-absolute
+	reloc is 26 or 32 bits wide.
+
+	* coff-rs6000.c (_bfd_xcoff_rtype2howto): The bitsize is irrelevant
+	for relocs that don't change anything.  Also look at the full
+	6 bits of bitsize.
+
+2000-09-06  Philip Blundell  <philb@gnu.org>
+
+	* config.bfd (arm*-*-uclinux*): New target.
+
+2000-09-06  Alexandre Oliva  <aoliva@redhat.com>
+
+	* configure: Rebuilt with new libtool.m4.
+
+2000-09-06  Alan Modra  <alan@linuxcare.com.au>
+
+	* section.c (bfd_get_unique_section_name): Avoid c++ reserved
+	word for variable name.
+	* bfd-in2.h: Regenerate.
+
+2000-09-05  Nick Clifton  <nickc@redhat.com>
+
+	* config.in: Regenerate.
+	* libbfd.h: Regenerate.
+	* po/bfd.pot: Regenerate.
+	* doc/bfdint.texi: Remove CVS date string - it foils compares with
+	local versions.
+
+2000-09-05  Steven Johnson  <sbjohnson@ozemail.com.au>
+
+	* cpu-powerpc.c  (arch_info_struct): Added MPC860 Family entry.
+
+2000-09-05  Alan Modra  <alan@linuxcare.com.au>
+
+	Shared library and PIC support.
+	* elf32-hppa.c (PLT_ENTRY_SIZE): New.
+	(GOT_ENTRY_SIZE): New.
+	(ELF_DYNAMIC_INTERPRETER): New.
+	(STUB_SUFFIX): Define.
+	(LONG_BRANCH_PIC_IN_SHLIB): Define.
+	(RELATIVE_DYNAMIC_RELOCS): Define.
+	(enum elf32_hppa_stub_type): New.
+	(struct elf32_hppa_stub_hash_entry): Rename offset to
+	stub_offset.  Add a number of new fields.
+	(struct elf32_hppa_link_hash_entry): New.
+	(struct elf32_hppa_link_hash_table): Add numerous fields.  Remove
+	global_value.
+	(elf32_hppa_hash_table): Rename to hppa_link_hash_table.
+	(elf32_hppa_stub_hash_lookup): Rename to hppa_stub_hash_lookup.
+	(elf32_hppa_stub_hash_newfunc): Rename to stub_hash_newfunc.  Init
+	new fields.
+	(hppa_link_hash_newfunc): New function.
+	(elf32_hppa_link_hash_table_create): Use above function. Init new
+	fields.
+	(elf32_hppa_stub_name): Rename to hppa_stub_name.  Pass in reloc
+	instead of addend, and remove sym_name from args.  Don't use
+	symbol name for local syms, instead use sym index.
+	(elf32_hppa_size_of_stub): Rename to hppa_type_of_stub, and return
+	stub type rather than size.  Pass in hash and handle import stub
+	case.  Also pass in reloc instead of offset so we can calculate
+	PCREL22F and PCREL12F branches properly.
+	(elf32_hppa_build_one_stub): Rename to hppa_build_one_stub.  Build
+	import and export stubs too.
+	(elf32_hppa_size_one_stub): Rename to hppa_size_one_stub.  Handle
+	import and export stub sizing.
+	(elf32_hppa_check_relocs): New function.
+	(elf32_hppa_adjust_dynamic_symbol): New function.
+	(hppa_discard_copies): New function.
+	(elf32_hppa_size_dynamic_sections): New function.
+	(elf_backend_size_dynamic_sections): Define.
+	(elf32_hppa_finish_dynamic_symbol): New function.
+	(elf_backend_finish_dynamic_symbol): Define.
+	(elf32_hppa_size_stubs): Stash params in link hash table, and move
+	some local vars into the link hash table too.  For shared links,
+	trundle over function syms, generating export stubs.  Handle
+	PCREL22F branches.  Break out stub creation code from here..
+	(hppa_add_stub): .. to here.  New function.
+	(elf32_hppa_final_link): Rename to elf32_hppa_set_gp, and don't
+	call the bfd linker.  Use elf_gp to record global pointer.
+	Calculate a value from sections if $global$ is missing.
+	(bfd_elf32_bfd_final_link): Define as _bfd_elf32_gc_common_final_link.
+	(elf32_hppa_gc_mark_hook): New function.
+	(elf_backend_gc_mark_hook): Define.
+	(elf32_hppa_gc_sweep_hook): New function.
+	(elf_backend_gc_sweep_hook): Define.
+	(elf32_hppa_bfd_final_link_relocate): Rename to final_link_relocate.
+	Add rel to args, and remove howto, input_bfd, offset, addend,
+	sym_name as we can recalculate these locally.  Handle calls to
+	dynamic objects, extra PIC relocs, PCREL22F branches.  Change
+	handling of undefined weak syms.  Check that stubs are in range.
+	Only look for import stubs on PCREL17F and PCREL22F relocs.  Add
+	message on hitting a DPREL21L reloc that needs fixing.  Subtract
+	off PC for PCREL14F.  Break out code that does a stub lookup from
+	here..
+	(hppa_get_stub_entry): ..to here.  New function.
+	(elf32_hppa_relocate_insn): Merge into final_link_relocate.
+	(elf32_hppa_relocate_section): Handle got and plt relocs, dynamic
+	relocs, etc. etc.
+	(elf32_hppa_finish_dynamic_sections): New function.
+	(elf_backend_finish_dynamic_sections): Define.
+	(elf_backend_final_write_processing) Define.
+	(hppa_handle_PIC_calls): New function.
+	(elf32_hppa_build_stubs): Call it.  Pass link_info to
+	hppa_build_one_stub.
+	(elf32_hppa_create_dynamic_sections): New function
+	to create .plt and .got then set .plt flags correctly.
+	(elf_backend_create_dynamic_sections): Define.
+	(elf32_hppa_object_p): New function.
+	(elf_backend_object_p): Define.
+	(elf32_hppa_elf_get_symbol_type): New function.
+	(elf_backend_get_symbol_type): Define.
+	(elf_backend_can_gc_sections): Define.
+	(elf_backend_want_got_plt): Define.
+	(elf_backend_plt_alignment): Set to 2.
+	(elf_backend_plt_readonly): Define.
+	(elf_backend_want_plt_sym): Define.
+	(elf_backend_got_header_size): Reserve one entry.
+
+	* elf32-hppa.h (elf32_hppa_build_stubs): Don't pass stub bfd.
+	(elf32_hppa_size_stubs): Pass in multi_subspace.
+	(elf32_hppa_set_gp): Declare.
+
+	* section.c (SEC_HAS_GOT_REF): Define new flag for asection.
+	(bfd_get_unique_section_name): New function.
+	* bfd_in2.h: Regenerate.
+
+	* elf64-hppa.c (elf64_hppa_check_relocs): Handle R_PARISC_PCREL12F.
+	(elf64_hppa_size_dynamic_sections): Remove the FIXME at bfd_zalloc
+	comment.
+
+	From  David Huggins-Daines  <dhd@linuxcare.com>
+	* elf64-hppa.c (elf64_hppa_check_relocs): Fix a warning.
+	(elf64_hppa_mark_exported_functions): Set dyn_h->st_shndx.
+	(elf64_hppa_link_output_symbol_hook): Test dyn_h->st_shndx has
+	been updated in finish_dynamic_symbol before modifying function
+	symbol.
+
+	* elf-hppa.h (elf_hppa_howto_table): Restructure into groups of
+	eight entries.  Replace NULL with bfd_elf_generic_reloc.  Add
+	R_PARISC_GNU_VTENTRY, R_PARISC_GNU_VTINHERIT and R_PARISC_PCREL12F.
+	(_bfd_elf_hppa_gen_reloc_type): Handle R_PARISC_GNU_VT*.  Add some
+	comments.  Handle format == 12 for R_HPPA_PCREL_CALL.
+	(elf_hppa_final_link_relocate): Handle R_PARISC_PCREL12F.
+	(elf_hppa_relocate_insn): Likewise.  Reformat some comments.
+	(elf_hppa_final_write_processing): Expose it for ARCH_SIZE == 32.
+
+	From David Huggins-Daines  <dhd@linuxcare.com>
+	* elf-hppa.h (elf_hppa_is_local_label_name): Accept the SysV/ELF
+	style of local labels as well.
+
+2000-09-03  Philip Blundell  <philb@gnu.org>
+
+	* elf32-arm.h (elf32_arm_relocate_section): Don't try to relocate
+	references to undefined symbols in debugging sections.
+
+2000-09-02  H.J. Lu  <hjl@gnu.org>
+
+	* reloc.c (BFD_RELOC_SH_COPY, BFD_RELOC_SH_GLOB_DAT,
+	BFD_RELOC_SH_JMP_SLOT, BFD_RELOC_SH_RELATIVE,
+	BFD_RELOC_SH_GOTPC): Move them from the MIPS section to the SH
+	section.
+
+2000-09-02  Jason Eckhardt  <jle@cygnus.com>
+
+	* elf32-i860.c (bfd_elf32_bfd_is_local_label_name): Define macro.
+	(elf32_i860_is_local_label_name): New function and prototype.
+
+2000-09-02  Nick Clifton  <nickc@redhat.com>
+
+	* configure.in: Increase version number to 2.10.91.
+	* configure: Regenerate.
+	* aclocal.m4: Regenerate.
+	* config.in: Regenerate.
+	* po/bfd.pot: Regenerate.
+
+2000-09-02  Daniel Berlin <dberlin@redhat.com>
+
+	* elf.c (_bfd_elf_make_section_from_shdr): Add
+	.gnu.linkobce.wi. to the list of debug section names.
+
+2000-09-02  Nick Clifton  <nickc@redhat.com>
+
+	* dwarf2.c (find_debug_info): New function: Locate a section
+	containing dwarf2 debug information.
+	(bfd_dwarf2_find_nearest_line): Find all sections containing
+	debug information and include them in the stash.
+
+2000-09-01  Niibe Yutaka  <gniibe@m17n.org>, Kaz Kojima  <kkojima@rr.iij4u.or.jp>, Alexandre Oliva  <aoliva@redhat.com>
+
+	* elf32-sh.c (R_SH_GOT32, R_SH_PLT32, R_SH_COPY, R_SH_GLOB_DAT,
+	R_SH_JMP_SLOT, R_SH_RELATIVE, R_SH_GOTOFF, R_SH_GOTPC): New.
+	(sh_reloc_map): Add new relocs.
+	(sh_elf_check_relocs, sh_elf_link_hash_newfunc,
+	sh_elf_link_hash_table_create, sh_elf_adjust_dynamic_symbol,
+	sh_elf_size_dynamic_sections, sh_elf_finish_dynamic_symbol,
+	sh_elf_finishe_dynamic_sections, sh_elf_discard_copies): New
+	functions.
+	(ELF_DYNAMIC_INTERPRETER, PLT_ENTRY_SIZE): Define.
+	(elf_sh_plt0_entry_be, elf_sh_plt0_entry_le,
+	elf_sh_plt_entry_be, elf_sh_plt_entry_le,
+	elf_sh_pic_plt_entry_be, elf_sh_pic_plt_entry_le):
+	New array constants.
+	(elf_sh_plt0_entry, elf_sh_plt_entry, elf_sh_pic_plt_entry):
+	New variables.
+	(elf_sh_sizeof_plt, elf_sh_plt_plt0_offset,
+	elf_sh_plt0_linker_offset, elf_sh_plt0_gotid_offset,
+	elf_sh_plt_temp_offset, elf_sh_plt_symbol_offset,
+	elf_sh_plt_reloc_offset): Define.
+	(elf_sh_pcrel_relocs_copied, elf_sh_link_hash_entry,
+	elf_sh_link_hash_table): New structs.
+	(sh_elf_link_hash_traverse, sh_elf_hash_table): New macros.
+	(sh_elf_relocate_section, sh_elf_check_relocs): Handle new
+	relocation types.
+	(elf_backend_create_dynamic_sections,
+	bfd_elf32_bfd_link_hash_table_create,
+	elf_backend_adjust_dynamic_symbol,
+	elf_backend_size_dynamic_sections,
+	elf_backend_finish_dynamic_symbol,
+	elf_backend_finish_dynamic_sections, elf_backend_want_got_plt,
+	elf_backend_plt_readonly, elf_backend_want_plt_sym,
+	elf_backend_got_header_size, elf_backend_plt_header_size):
+	Define.
+	* reloc.c (BFD_RELOC_SH_COPY, BFD_RELOC_SH_GLOB_DAT,
+	BFD_RELOC_SH_JMP_SLOT, BFD_RELOC_SH_RELATIVE, BFD_RELOC_SH_GOTPC):
+	New relocs.
+	* bfd-in2.h, libbfd.h: Rebuilt.
+
+2000-09-01  Alan Modra  <alan@linuxcare.com.au>
+
+	* elf32-i386.c (elf_i386_finish_dynamic_symbol): Revert 2000-08-27
+	change.
+
+2000-08-31  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+	* elf32-sh.c (sh_elf_merge_private_data): If ibfd's elf header flags
+	not initialized, set them to indicate the SH1 instruction set.
+
+2000-08-31  Alexandre Oliva  <aoliva@redhat.com>
+
+	* acinclude.m4: Include libtool and gettext macros from the
+	top level.
+	* aclocal.m4, configure: Rebuilt.
+
+2000-08-29  Michael Snyder  <msnyder@seadog.cygnus.com>
+
+	* elf.c: Eliminate references to __sparcv9 macro; replace with
+	autoconf variables HAVE_PSINFO32_T etc.
+	* configure.in: Auto-configure HAVE_PSINFO_32_T, HAVE_PRPSINFO32_T,
+	HAVE_PSTATUS32_T, HAVE_PRSTATUS32_T, HAVE_PRSTATUS32_T_PR_WHO.
+	* config.in: Ditto.
+	* acinclude.m4 (BFD_HAVE_SYS_PROCFS_TYPE) define _SYSCALL32 so it can
+	detect the above typedefs.  (BFD_HAVE_SYS_PROCFS_TYPE_MEMBER): Ditto.
+	* aclocal.m4: Ditto.
+	* configure: Regenerate.
+
+2000-08-27  Alan Modra  <alan@linuxcare.com.au>
+
+	* elf32-i386.c (elf_i386_check_relocs): Keep info on relocs copied
+	for any shared link, not just shared -Bsymbolic.
+	(elf_i386_size_dynamic_sections): Call elf_i386_discard_copies on
+	any shared link, and pass link info to it.
+	(elf_i386_size_dynamic_sections): Update comment.
+	(elf_i386_discard_copies): Modify to discard relocs for symbols
+	that have been forced local.
+	(elf_i386_finish_dynamic_symbol): Don't copy relocs for symbols
+	that have been forced local.
+
+2000-08-24  Denis Chertykov  <denisc@overta.ru> & Nick Clifton  <nickc@redhat.com>
+
+	* elflink.h (elf_link_add_object_symbols): Allow common
+	symbols to have an alignment of 1 if explicitly requested, and
+	not overridden by other definitions.
+
+2000-08-22  Doug Kwan <dkwan@transmeta.com>
+
+	* coff-w65.c (CREATE_LITTLE_COFF_TARGET): Fix typo.
+	* coffcode.h (coff_set_flags): Add detection of w65 architecture.
+
+2000-08-22  H.J. Lu  <hjl@gnu.org>
+
+	* elf-bfd.h (elf_link_hash_table): Add runpath.
+
+	* bfd-in.h (bfd_elf_get_runpath_list): New prototype.
+	* bfd-in2.h: Rebuilt.
+
+	* elf.c (_bfd_elf_link_hash_table_init): Initialize the
+	"runpath" field to NULL.
+	(bfd_elf_get_runpath_list): New function.
+
+	* elflink.h (elf_link_add_object_symbols): Record DT_RPATH and
+	DT_RUNPATH entries.
+
+2000-08-22  Alexandre Oliva  <aoliva@redhat.com>
+
+	* elf32-sh.c (sh_elf_relocate_section) [R_SH_IND12W,
+	R_SH_DIR8WPN, R_SH_DIR8WPZ, R_SH_DIR8WPL]: Handle them
+	explicitly.  Improve validation of r_type.
+
+2000-08-21  H.J. Lu  <hjl@gnu.org>
+
+	* elf32-i386.c (elf_i386_size_dynamic_sections): Zero out the
+	dynamic allocated content space.  Add a comment to remind us that
+	one day this ought to be fixed.
+	* elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
+	* elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
+	* elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
+
+2000-08-21  Jason Eckhardt  <jle@cygnus.com>
+
+	* elf32-i860.c (elf32_i860_relocate_pc16): Just write the immediate
+	field with the newly relocated value instead of adding it to the
+	existing immediate field.
+	(elf32_i860_relocate_splitn): Likewise.
+	(elf32_i860_relocate_highadj): Likewise.
+
+2000-08-16  Jason Eckhardt  <jle@cygnus.com>
+
+	* elf32-i860.c (elf32_i860_relocate_pc16): Implemented function (it
+	was previously just a stub).
+
+2000-08-16  Alexandre Oliva  <aoliva@redhat.com>
+
+	* elflink.c (_bfd_elf_create_got_section): Don't abort().
+	Formatting fixes.
+	(_bfd_elf_create_dynamic_sections): Likewise.
+
+2000-08-16  Andrew Macleod  <amacleod@cygnus.com>
+
+	* elf64-sparc.c (sparc64_elf_relocate_section): Set relocation address
+	for undefined symbols to be the beginning of the section.
+
+	* elf64-sparc.c (sparc64_elf_adjust_dynamic_symbol): Don't allocate
+	four extra entries at the beginning of the .rela.plt section.
+	(sparc64_elf_finish_dynamic_symbol): Adjust the offset in the .rela.plt
+	section to account for the four reserved entries in the .plt section.
+
+2000-08-15  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* xcofflink.c (_bfd_ppc_xcoff_relocate_section): Add ori r0,r0,0
+	to the list of NOPs we recognize after a branch-and-link.
+	Use the ori NOP when one is needed.
+
+	* coff-rs6000.c (_bfd_xcoff_slurp_armap): Finish implementation
+	for large archives.
+
+2000-08-14  Jim Wilson  <wilson@cygnus.com>
+
+	* elf64-ia64.c (elf64_ia64_merge_private_bfd_data): Handle
+	EF_IA_64_REDUCEDFP, EF_IA_64_CONS_GP, and EF_IA_64_NOFUNCDESC_CONS_GP.
+	(elf64_ia64_print_private_bfd_data): Likewise.  Also handle
+	EF_IA_64_ABSOLUTE.
+
+2000-08-11  Alexandre Oliva  <aoliva@redhat.com>
+
+	* elf32-sh.c (sh_elf_set_mach_from_flags): Make it static.
+
+2000-08-10  Jason Eckhardt  <jle@cygnus.com>
+
+	* elf32-i860.c (elf32_i860_relocate_section): New function.
+	(i860_final_link_relocate): New function.
+	(elf32_i860_relocate_splitn): New function.
+	(elf32_i860_relocate_pc16): New function.
+	(elf32_i860_relocate_highadj): New function.
+	(elf32_i860_howto): Minor adjustments to some relocations.
+	(elf_info_to_howto_rel): Define.
+	(elf_backend_relocate_section): Define.
+
+2000-08-10  Nick Clifton  <nickc@cygnus.com>
+
+	* elf32-arm.h: Fix formatting.
+
+2000-08-10  Bernd Schmidt  <bernds@cygnus.co.uk>
+
+	* elf32-sh.c (sh_elf_reloc_loop): Make LAST_SYMBOL_SECTION static.
+
+2000-08-08  Jason Eckhardt  <jle@cygnus.com>
+
+	* elf32-i860.c (elf32_i860_howto_table): Updated some fields.
+
+2000-08-07  Kazu Hirata  <kazu@hxi.com>
+
+	* ieee.c (ieee_write_debug_part): Rewrite a comment.
+	* elf64-ia64.c: Fix a typo.
+
+2000-08-05  Jason Eckhardt  <jle@cygnus.com>
+
+	* elf32-i860 (elf32_i860_howto_table): New structure.
+	(lookup_howto): New function.
+	(elf32_i860_reloc_type_lookup): New function.
+	(elf32_i860_info_to_howto_rela): New function.
+	(elf_code_to_howto_index): New structure.
+	(elf_info_to_howto): Re-define as elf32_i860_info_to_howto_rela.
+	(bfd_elf32_bfd_reloc_type_lookup): Re-define as
+	elf32_i860_reloc_type_lookup.
+
+2000-08-04  Rodney Brown  <RodneyBrown@pmsc.com>
+
+	* som.c (struct fixup_format): Constify `format'.
+	(som_hppa_howto_table): Use SOM_HOWTO macro.
+	(try_prev_fixup, hppa_som_reloc): Decorate unused parameter.
+	(som_bfd_reloc_type_lookup): Likewise.
+	(compare_subspaces): Remove unused `count1', `count2'.
+	(som_begin_writing): Remove unused `total_reloc_size'.
+	(som_bfd_derive_misc_symbol_info): Decorate unused parameter.
+	(som_print_symbol, som_bfd_is_local_label_name): Likewise.
+	(som_set_reloc_info): Constify `cp'. Remove unused `addend'.
+	(som_find_nearest_line): Decorate unused parameter(s).
+	(som_sizeof_headers, som_get_symbol_info, som_write_armap): Likewise.
+	(som_bfd_link_split_section): Likewise.
+
+2000-08-03  Nick Clifton  <nickc@cygnus.com>
+
+	* section.c: Restore backed out code.
+	* elf.c: Restore backed out code.
+	(copy_private_bfd_data): Fix bug preventing stipped dynamic
+	binaries from working.
+	* bfd-in2.h: Regenerate.
+
+2000-08-03  H.J. Lu  <hjl@gnu.org>
+
+	* section.c: Back out the change made by Nick Clifton
+	<nickc@cygnus.com> on 2000-07-31. It breaks stripping dynamic
+	binaries.
+	* bfd-in2.h: Likewise.
+	* elf.c: Likewise.
+
+2000-08-03  Alexandre Oliva  <aoliva@redhat.com>
+
+	* elf32-sh.c (sh_elf_reloc_loop): Warning removal.
+
+2000-07-31  Jason Eckhardt  <jle@cygnus.com>
+
+	* reloc.c (BFD_RELOC_860_*): New bfd relocs for i860.
+	* bfd-in2.h, libbfd.h: Regenerate.
+
+2000-07-31  Nick Clifton  <nickc@cygnus.com>
+
+	* section.c (struct sec): Add new boolean field 'segment_mark'.
+	(STD_SECTION): Initialise new field to zero.
+
+	* bfd-in2.h: Regenerate.
+
+	* elf.c (copy_private_bfd_data): Reorganise section to segment
+	mapping to cope with moved sections requiring new segments,
+	and overlapping segments.
+	(SEGMENT_END): New macro: Return the end address of a segment.
+	(IS_CONTAINED_BY_VMA): New macro: Determine if a segment
+	contains a section by comparing their VMA addresses.
+	(IS_CONTAINED_BY_LMA): New macro: Determine if a segment
+	contains a section by comparing their LMA addresses.
+	(INCLUDE_SECTION_IN_SEGMENT): New macro: Determine if a
+	section should be included in a segment.
+	(SEGMENT_AFTER_SEGMENT): New macro: Determine if one segment
+	follows another in memory.
+	(SEGMENT_OVERLAPS_SEGMENT): New macro: Determine if two
+	segments overlap.
+
+2000-07-22  Jason Eckhardt  <jle@cygnus.com>
+
+	* cpu-i860.c: Added comments.
+
+	* elf32-i860.c (TARGET_LITTLE_SYM): Defined to
+	bfd_elf32_i860_little_vec.
+	(TARGET_LITTLE_NAME): Defined to "elf32-i860-little".
+	(ELF_MAXPAGESIZE): Changed to 4096.
+
+	* targets.c (bfd_elf32_i860_little_vec): Declaration of
+	new target.
+	(bfd_target_vector): Added bfd_elf32_i860_little_vec.
+
+	* config.bfd (i860-stardent-sysv4*, i860-stardent-elf*): Added
+	config for little endian elf32 i860.
+	(targ_defvec): Define for the new config above
+	as "bfd_elf32_i860_little_vec".
+	(targ_selvecs): Define for the new config above
+	as "bfd_elf32_i860_vec bfd_elf32_i860_little_vec"
+
+	* configure.in (bfd_elf32_i860_little_vec): Added recognition
+	of new target vec.
+
+	* configure: Regenerated.
+
+2000-07-27  H.J. Lu  <hjl@gnu.org>
+
+	* elflink.h (elf_merge_symbol): Take one more argument,
+	dt_needed, to indicate if the symbol comes from a DT_NEEDED
+	entry. Don't overide the existing weak definition if dt_needed
+	is true.
+	(elf_link_add_object_symbols): Pass dt_needed to
+	elf_merge_symbol ().
+
+2000-07-27  Nick Clifton  <nickc@cygnus.com>
+
+	* elflink.h (elf_link_size_reloc_section): Zeroes the section's
+	allocated contents.
+
+2000-07-25  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* configure.host (*-*-aix*): AIX has 'long long' always.
+
+	* coff-rs6000.c (xcoff_write_one_armap_big): New procedure.
+	(xcoff_write_armap_big): Write both 32-bit and 64-bit armaps.
+	(xcoff_write_archive_contents_big): Don't update the offset
+	of the symbol table, xcoff_write_armap will do it.
+
+2000-07-23  Ulf Carlsson  <ulfc@engr.sgi.com>
+
+	* elf32-mips.c (_bfd_mips_elf_check_relocs): Use abfd instead
+	of dynobj for SGI_COMPAT checks.
+
+2000-07-21  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
+
+	* coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): New function.
+	* bfd-in.h (bfd_m68k_coff_create_embedded_relocs): Add declaration.
+	* bfd-in2.h: Regenerate.
+
+2000-07-21  Nick Clifton  <nickc@cygnus.com>
+
+	* elf32-mips.c (_bfd_mips_elf_check_relocs): Detect out of
+	range symbol indices in relocs and issue an error message.
+
+2000-07-20  H.J. Lu  <hjl@gnu.org>
+
+	* elflink.h (NAME(bfd_elf,size_dynamic_sections)): Don't check
+	info->new_dtags when setting DT_FLAGS_1. It will only be set
+	by the new linker options. It shouldn't break anything.
+
+2000-07-20  H.J. Lu  <hjl@gnu.org>
+
+	* elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set DT_FLAGS_1
+	only if info->new_dtags is true.
+
+2000-07-20  H.J. Lu  <hjl@gnu.org>
+
+	* elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set
+	DT_RUNPATH and DT_FLAGS only if info->new_dtags is true.
+
+2000-07-20  Hans-Peter Nilsson  <hp@axis.com>
+
+	* Makefile.am (ALL_MACHINES): Add cpu-cris.lo.
+	(ALL_MACHINES_CFILES): Add cpu-cris.c.
+	(BFD32_BACKENDS): Add aout-cris.lo and elf32-cris.lo.
+	(BFD32_BACKENDS_CFILES): Add aout-cris.c and elf32-cris.c.
+	(cpu-cris.lo, aout-cris.lo, elf32-cris.lo): New rules.
+	* Makefile.in: Rebuild.
+	* aclocal.m4: Rebuild.
+	* aoutx.h (NAME(aout,machine_type)): Add case for bfd_arch_cris.
+	* archures.c (enum bfd_architecture): Add bfd_arch_cris.
+	(bfd_cris_arch): Declare.
+	(bfd_archures_list): Add bfd_cris_arch.
+	* bfd-in2.h: Rebuild.
+	* config.bfd: (cris-*-*): New target.
+	* configure.in (bfd_elf32_cris_vec, cris_aout_vec): New vectors.
+	* configure: Rebuild.
+	* elf.c (prep_headers): Add bfd_arch_cris.
+	* libbfd.h: Rebuild.
+	* libaout.h (enum machine_type): Add M_CRIS.
+	* reloc.c: Add CRIS relocations.
+	* targets.c (bfd_elf32_cris_vec, cris_aout_vec): Declare.
+	(bfd_target_vect): Add bfd_elf32_cris_vec and cris_aout_vec.
+	* cpu-cris.c, aout-cris.c, elf32-cris.c: New files.
+	* po/POTFILES.in, po/bfd.pot: Regenerate.
+
+2000-07-19  H.J. Lu  <hjl@gnu.org>
+
+	* elf32-arm.h (elf32_arm_size_dynamic_sections): Also set
+	DF_TEXTREL if DT_TEXTREL is set.
+	* elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
+	* elf32-i386.c (elf_i386_size_dynamic_sections): Likewise.
+	* elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
+	* elf32-mips.c (_bfd_mips_elf_size_dynamic_sections): Likewise.
+	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
+	* elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
+	* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
+	* elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
+	* elf64-ia64.c (elf64_ia64_size_dynamic_sections): Likewise.
+	* elf64-sparc.c (sparc64_elf_size_dynamic_sections): Likewise.
+
+	* elflink.h (NAME(bfd_elf,size_dynamic_sections)): Also
+	set DF_SYMBOLIC for symbolic link. Also set DT_RUNPATH if
+	DT_RPATH is set.
+	Set the DT_FLAGS and DT_FLAGS_1 entries if necessary.
+
+2000-07-19  H.J. Lu  <hjl@gnu.org>
+
+	* bfd-in.h (bfd_elf_set_dt_needed_soname): New.
+	* bfd-in2.h: Rebuild.
+
+	* elf-bfd.h (elf_obj_tdata): Add dt_soname.
+	(elf_dt_soname): New.
+
+	* elf.c (bfd_elf_set_dt_needed_soname): New.
+
+	* elflink.h (elf_link_add_object_symbols): Add the DT_NEEDED
+	entry if the shared object loaded by DT_NEEDED is used to
+	resolve the reference in a regular object.
+
+2000-07-19  H.J. Lu  <hjl@gnu.org>
+
+	* elf.c (_bfd_elf_print_private_bfd_data): Handle DT_CONFIG,
+	DT_DEPAUDIT and DT_AUDIT as strings.
+
+2000-07-19  Nick Clifton  <nickc@cygnus.com>
+
+	* format.c: Fix formatting.
+
+2000-07-19  H.J. Lu  <hjl@gnu.org>
+
+	* elf.c (_bfd_elf_print_private_bfd_data): Fix DT_CHECKSUM.
+
+2000-07-19  H.J. Lu  <hjl@gnu.org>
+
+	* elf.c (_bfd_elf_print_private_bfd_data): Handle DT_BIND_NOW,
+	DT_INIT_ARRAY, DT_FINI_ARRAY, DT_INIT_ARRAYSZ, DT_FINI_ARRAYSZ,
+	DT_RUNPATH, DT_FLAGS, DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ,
+	DT_PLTPADSZ, DT_MOVEENT, DT_MOVESZ, DT_FEATURE, DT_POSFLAG_1,
+	DT_SYMINSZ, DT_SYMINENT, DT_CONFIG, DT_DEPAUDIT, DT_AUDIT,
+	DT_PLTPAD, DT_MOVETAB, DT_SYMINFO, DT_RELACOUNT, DT_RELCOUNT,
+	DT_FLAGS_1, DT_USED and DT_CHECKSUM.
+
+2000-07-18  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* elf.c (bfd_elf_get_sign_extend_vma, bfd_elf_get_arch_size): Move
+	renamed functions from here...
+	(assign_section_numbers): Use renamed functions.
+	(prep_headers): Use renamed functions.
+
+	* bfd.c (bfd_get_sign_extend_vma, bfd_get_arch_size): ...To here.
+	* bfd-in.h (bfd_get_sign_extend_vma, bfd_get_arch_size): Update.
+	* bfd-in2.h: Regenerate.
+
+2000-07-18  Ulf Carlsson  <ulfc@engr.sgi.com>
+
+	* elf32-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Add
+	parenthesis in if statement.
+
+2000-07-17  Koundinya K  <kk@ddeorg.soft.net>
+
+	Enable the support for Traditional MIPS.
+	* elf32-mips.c (IRIX_COMPAT): Recognize bfd_elf32_tradbigmips_vecand
+	return ict_none appropriately for traditional mips targets.
+	(STUB_LW): Change 0x8f998000 to 0x8f998010 for traditional mips.
+	(STUB_MOVE): Conditionalize for traditonal mips.
+	(STUB_LI16): Likewise.
+	(_bfd_mips_elf_modify_segment_map): Conditionalize to avoid making
+	room for RTPROC header.
+	(_bfd_mips_elf_modify_segment_map): For a normal mips executable set
+	the permission for the PT_DYNAMIC as read, write and execute.
+	(mips_elf_calculate_relocation): Check for the symbol _DYNAMIC_LINKING
+	for traditonal mips.
+	(_bfd_mips_elf_create_dynamic_sections): Add the symbol
+	_DYNAMIC_LINKING for traditonal mips.
+	(_bfd_mips_elf_create_dynamic_sections): Add the symbol __RLD_MAP
+	in case of traditonal mips.
+	(_bfd_mips_elf_adjust_dynamic_symbol): Create a stub only if a PLT
+	entry is required. For a function if PLT is not required then set the
+	corresponding hash table entry to 0.
+	(_bfd_mips_elf_size_dynamic_sections): Add DT_DEBUG entry for
+	traditonal mips.
+	(_bfd_mips_elf_finish_dynamic_symbol): for a undefined symbol in a
+	shared object set the value to 0.
+	(_bfd_mips_elf_finish_dynamic_symbol): Check for the symbol
+	_DYNAMIC_LINKING for traditonal mips.
+	(_bfd_mips_elf_finish_dynamic_symbol): Check for the symbol __RLD_MAP
+	for traditonal mips.
+
+2000-07-15  H.J. Lu  <hjl@gnu.org>
+
+	* aoutx.h (translate_to_native_sym_flags): Handle BSF_LOCAL.
+
+2000-07-12  Charles Wilson  <cwilson@ece.gatech.edu>
+
+	* libbfd.c (bfd_seek): fix 'seek beyond EOF' error when writing
+	out a structure that is BFD_IN_MEMORY.
+
+2000-07-11  Alan Modra  <alan@linuxcare.com.au>
+
+	* elf64-hppa.c (get_dyn_name): Pass in section pointer instead of
+	bfd pointer.  Print section id instead of bfd pointer for local
+	syms.  Prefix addend with `+' for global syms as well as local.
+	Correct calculation of name component lengths.
+	(elf64_hppa_check_relocs): Update call to get_dyn_name.
+
+	From David Huggins-Daines  <dhd@linuxcare.com>
+	* elf-hppa.h (elf_hppa_relocate_section): Update calls here too.
+	* elf64-hppa.c (elf64_hppa_check_relocs): Fix some warnings.
+	(elf64_hppa_modify_segment_map): Likewise.
+
+2000-07-11  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* elf.c (bfd_elf_get_sign_extend_vma): Return tendency of VMA
+	addresses to be "naturally" sign extended.  Return -1 if unknown.
+	* bfd-in.h (bfd_elf_get_sign_extend_vma): Add declaration.
+	* bfd-in2.h: Regenerate.
+
+2000-07-11  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* ecoffswap.h (ecoff_get_off, ecoff_put_off): Add ECOFF_SIGNED_32
+	and ECOF_SIGNED_64 to list ways to extract an offset.
+	(ecoff_swap_fdr_in, ecoff_swap_fdr_out, ecoff_swap_pdr_in,
+	ecoff_swap_pdr_out, ecoff_swap_ext_in, ecoff_swap_ext_out):
+	Update.
+	* elf64-mips.c (ECOFF_SIGNED_64): Define instead of ECOFF_64.
+	* elf32-mips.c (ECOFF_SIGNED_32): Define instead of ECOFF_32.
+
+2000-07-11  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* elfcode.h (elf_object_p): Use bfd_set_start_address and not
+	bfd_get_start_address.
+	(elf_swap_ehdr_in): Sign extend e_entry when applicable.
+	(elf_swap_ehdr_out): Ditto.
+
+2000-07-10  Alexander Aganichev  <AAganichev@hypercom.com>
+
+	* archures.c (bfd_default_scan): Add set of bfd_mach_ cases for
+	compatibility with older binutils.
+
+2000-07-10  Alan Modra  <alan@linuxcare.com.au>
+
+	* section.c (bfd_make_section_anyway): Start section_id at 0x10.
+	(STD_SECTION): Avoid negative ids, instead use 0 to 3.
+
+	From Ryan Bradetich  <rbradetich@uswest.net>
+	* dwarf1.c (parse_die): Cure signed/unsigned char warnings.
+	(parse_line_table): Ditto.
+	(_bfd_dwarf1_find_nearest_line): Ditto.
+	* syms.c (cmpindexentry): Remove extra `*' from params.
+
+2000-07-09  Koundinya K  <kk@ddeorg.soft.net>
+
+	* elf32-mips.c (sort_dynamic_relocs): New Function.
+	(_bfd_mips_elf_finish_dynamic_sections): Call sort_dynamic_relocs
+	via qsort to sort the dynamic relocations in increasing r_symndx
+	value.
+
+2000-07-09  Alan Modra  <alan@linuxcare.com.au>
+
+	* elf64-hppa.c (elf64_hppa_dyn_hash_table_init): Add
+	ATTRIBUTE_UNUSED to unused args.
+	(get_opd): Likewise.
+	(get_plt): Likewise.
+	(get_dlt): Likewise.
+	(get_stub): Likewise.
+	(elf64_hppa_adjust_dynamic_symbol): Likewise.
+	(elf64_hppa_link_output_symbol_hook): Likewise.
+	(elf64_hppa_check_relocs): Delete unused var.
+	(elf64_hppa_size_dynamic_sections): Likewise.
+	(elf64_hppa_finalize_opd): Likewise.
+	(elf64_hppa_finalize_dynreloc): Likewise.
+	(elf64_hppa_modify_segment_map): Likewise.
+	(elf64_hppa_finish_dynamic_sections): Likewise.
+
+	* elf-hppa.h (elf_hppa_final_write_processing): Add
+	ATTRIBUTE_UNUSED to unused args.
+	(elf_hppa_final_link_relocate): Likewise.
+	(elf_hppa_record_segment_addrs): Add paretheses.
+	(elf_hppa_relocate_section): Constify dyn_name.
+
+	From  David Huggins-Daines  <dhd@linuxcare.com>
+	* config.bfd: Add hppa*64*-*-linux-gnu 64-bit target, and
+	rearrange case statement so that it gets preferred to 32-bit ones.
+
+	* elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Use
+	asection->id instead of address of asection structure.
+	(elf32_hppa_size_stubs): Likewise.
+
+	* elf32-hppa.c (elf32_hppa_size_stubs): Use just one stub section
+	for .init* and .fini*.
+
+	* elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Mask pointers
+	and addends used in stub names to 32 bits.
+	(elf32_hppa_size_stubs): Likewise.
+
+	* elf-hppa.h (elf_hppa_final_link_relocate): Don't sum addend
+	twice for R_PARISC_GPREL64.  Use bfd_put_32 for R_PARISC_PCREL32,
+	not bfd_put_64.  Fix minor comment typo and formatting.
+
+	Changes to create multiple linker stubs, positioned immediately
+	before the section where they are required.
+	* elf32-hppa.c: Don't include hppa_stubs.h.
+	(elf32_hppa_stub_hash_entry): Add a pointer to the stub section.
+	(elf32_hppa_stub_hash_table): Delete.
+	(elf32_hppa_link_hash_entry): Delete.
+	(elf32_hppa_link_hash_table): Use plain bfd_hash_table for
+	stub_hash_table, and store the struct here rather than a pointer.
+	Delete output_symbol_count.  Add offset array.  Change
+	global_value to a bfd_vma.
+	(elf32_hppa_stub_hash_lookup): Use table instead of table->root.
+	(elf32_hppa_stub_hash_traverse): Delete.
+	(elf32_hppa_name_of_stub): Delete.
+	(elf32_hppa_link_hash_lookup): Delete.
+	(elf32_hppa_link_hash_traverse): Delete.
+	(elf32_hppa_stub_hash_table_init): Delete.
+	(elf32_hppa_size_of_stub): Pass input section and offset rather
+	than location and calculate location here.  Don't pass name as all
+	stubs are now the same size.
+	(elf32_hppa_stub_hash_newfunc): Init new fields.
+	(elf32_hppa_link_hash_table_create): Likewise, and stub_hash_table
+	too.
+	(elf32_hppa_bfd_final_link_relocate): Cast enums to int before
+	comparing against ints.  Rewrite stub handling code.
+	(elf32_hppa_relocate_section): Make r_type and r_symndx unsigned.
+	Case enums to int before comparing against ints.  Remove
+	bfd_reloc_dangerous case.
+	(elf32_hppa_build_one_stub): Rewrite.
+	(elf32_hppa_size_one_stub): New function.
+	(elf32_hppa_build_stubs): Rewrite.
+	(elf32_hppa_size_stubs): Pass in linker call-back functions.
+	Rewrite stub-handling specific code.
+
+	* elf32-hppa.h (elf32_hppa_size_stubs): Update prototype.
+
+	* elf64-hppa.c (elf64_hppa_dyn_hash_entry): Fix a comment typo.
+
+	* hppa_stubs.h: Delete.
+	* Makefile.am (SOURCE_HFILES): Remove hppa_stubs.h
+	(elf32-hppa.lo): Remove hppa_stubs.h from dependencies.
+	* Makefile.in: Regenerate.
+
+	* elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Handle e_nlsel and
+	e_nlrsel.
+
+	* libhppa.h (hppa_field_adjust): Correct e_nsel case.
+
+	* elf32-hppa.c (elf32_hppa_relocate_section): Mention the offset
+	and section name for bfd_reloc_notsupported error message.
+	(elf32_hppa_bfd_final_link_relocate): Print reasons for returning
+	bfd_reloc_notsupported.
+	(elf32_hppa_relocate_section): Add ATTRIBUTE_UNUSED to output_bfd.
+
+	* elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Handle
+	undefined weak symbols for all relocs.
+	(elf32_hppa_size_of_stub): Adjust calculation by 8 since branch
+	offsets are relative to one past the delay slot.
+	(elf32_hppa_size_stubs): Account for reloc addend when calculating
+	branch destination.  Put addend into stub name too.
+	(elf32_hppa_bfd_final_link_relocate): Account for reloc addend and
+	adjust by 8 when deciding whether a linker stub is needed.  Put
+	addend into stub name as for above.
+
+	* elf32-hppa.c (hppa_elf_relocate_insn): Change signed/unsigned on
+	various args and vars.
+	(elf32_hppa_bfd_final_link_relocate): Here too.
+	(elf32_hppa_size_stubs): Rename index -> indx.  Use e_indx for
+	inner block var to avoid shadowing.
+
+	* elf32-hppa.h (_bfd_elf32_hppa_gen_reloc_type):  Make `field' arg
+	unsigned.
+	* elf64-hppa.h (_bfd_elf64_hppa_gen_reloc_type): Ditto.
+	* elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Ditto.
+	(elf_hppa_fake_sections): Rename local var to avoid shadowing.
+
+	* libhppa.h: Change practically all unsigned ints to plain ints.
+	Remove tests on gcc version.  Instead use ATTRIBUTE_UNUSED for
+	prototypes.
+
+	From Ryan Bradetich  <rbradetich@uswest.net>
+	* libhppa.h (hppa_opcode_type): New enum to replace #define's.
+	* elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Modify to
+	suit above.
+	From  David Huggins-Daines  <dhd@linuxcare.com>
+	* elf-hppa.h (elf_hppa_relocate_insn): Update the opcode constants
+	to the new OP_* ones.
+
+	* elf32-hppa.c (elf32_hppa_size_stubs): Consolidate freeing on
+	error exit.  Bail out earlier on plabel relocs that we aren't
+	interested in.  Don't tell elf32_hppa_stub_hash_lookup to copy
+	string, and then don't free our copy.
+	(elf32_hppa_build_one_stub): Make insn unsigned int.
+
+	* libhppa.h (bfd_hppa_insn2fmt): 22 bit branches are only
+	available with BL, not BE and BLE.
+
+	* elf32-hppa.c (hppa_elf_relocate_insn): Add some more example
+	code for elf arg relocs.
+	(elf32_hppa_bfd_final_link_relocate): Replace boolean is_local
+	argument with elf_link_hash_entry h.  Handle undefined weak
+	symbols.  Move $global$ lookup from here...
+	(elf32_hppa_relocate_section): ...to here.  Return correct error
+	message for non-handled relocs.
+	(elf32_hppa_size_of_stub): Correctly test branch range.  Previous
+	wrong test was -0x3ffff to +0x40000.
+
+	* elf-hppa.h (elf_hppa_final_link_relocate): R_PARISC_DIR17R,
+	R_PARISC_DIR17F, and R_PARISC_DIR21L are for absolute branches;
+	Handle them as such.
+	(elf_hppa_relocate_insn): Fix a typo.
+
+	* libhppa.h (GET_FIELD, GET_BIT, MASK, CATENATE, ELEVEN): Delete.
+	(assemble_3, assemble_6, assemble_12, assemble_16, assemble_16a,
+	assemble_17, assemble_21): Delete.
+	Supply defines for all 64 possible opcodes.
+	(bfd_hppa_insn2fmt): Add bfd argument, and use to select wide mode
+	formats.  Handle COMICLR.
+	(hppa_rebuild_insn): Delete bfd argument.  Handle formats 10, -11,
+	-10, -16, 16, 22.
+
+	* elf32-hppa.c (hppa_elf_relocate_insn): Complete rewrite.
+	(elf32_hppa_bfd_final_link_relocate): Major rewrite.
+	(elf32_hppa_build_one_stub): Modify hppa_elf_relocate_insn calls
+	to suit.
+	(elf32_hppa_size_stubs): Don't free stub_name twice.  Read in all
+	the local syms - did this code get deleted accidentally?  Ignore
+	undefined and undefweak syms.
+
+	* elf-hppa.h (elf_hppa_final_link): Move hppa_info to outermost
+	block.  Use it instead of elf64_hppa_hash_table (info).
+	(elf_hppa_final_link_relocate): Use hppa_info instead of
+	elf64_hppa_hash_table (info).
+
+	* libhppa.h (re_assemble_3, re_assemble_12, re_assemble_16,
+	re_assemble_17, re_assemble_21, re_assemble_22): Don't mask insn.
+	(hppa_rebuild_insn): Mask immediate bits here instead.
+	* elf-hppa.h (elf_hppa_relocate_insn): Mask here too.
+
+2000-07-08  Alan Modra  <alan@linuxcare.com.au>
+
+	* section.c (struct sec): Add id field.  Tidy comment formatting.
+	(bfd_make_section_anyway): Set id.
+	(STD_SECTION): Init id too.
+	Change CONST to const throughout.
+	* archures.c (bfd_arch_info): Tidy comment.
+	(bfd_arch_list): Change a CONST to const.
+	* libbfd-in.h: Tidy comments and replace CONST with const.
+	* elf-bfd.h: Likewise.
+	* libbfd.h: Regenerate.
+	* bfd-in2.h: Regenerate.
+	* libcoff.h: Regenerate.
+
+2000-07-07  DJ Delorie  <dj@redhat.com>
+
+	* archive.c (_bfd_write_archive_contents): Add an informative
+	comment.
+
+2000-07-06  Kazu Hirata  <kazu@hxi.com>
+
+	* srec.c: Fix formatting.
+
+2000-06-05  DJ Delorie  <dj@redhat.com>
+
+	* MAINTAINERS: new
+
+2000-07-04  Alexandre Oliva  <aoliva@redhat.com>
+
+	* coff-arm.c (coff_arm_relocate_section): Do not ignore the symbol
+	value of PC-relative offsets.
+
+2000-07-03  Jim Wilson  <wilson@cygnus.com>
+
+	* elf64-alpha.c (alpha_elf_size_info): New.
+	(elf_backend_size_info): Define to alpha_elf_size_info.
+	* elfcode.h (elf_size_info): Change hash bucket size to 4.
+
+2000-07-03  Ulf Carlsson  <ulfc@engr.sgi.com>
+
+	* elf32-mips.c: Include elf32-target.h again for the traditional
+	MIPS targets.
+
+2000-07-03  Marek Michalkiewicz  <marekm@linux.org.pl>
+
+	* elf32-avr.c (bfd_elf32_bfd_reloc_type_lookup):
+	Add ATTRIBUTE_UNUSED to unused arguments to avoid warnings.
+	(avr_info_to_howto_rela): Likewise.
+	(elf32_avr_gc_mark_hook): Likewise.
+	(elf32_avr_gc_sweep_hook): Likewise.
+	(elf32_avr_relocate_section): Likewise.
+
+2000-07-03  Mark Elbrecht  <snowball3@bigfoot.com>
+
+	* cofflink.c (_bfd_coff_write_global_sym): Turn a weak symbol into
+	an external symbol for a non-shared, non-relocatable link.
+
+2000-07-03  Nick Clifton  <nickc@redhat.com>
+
+	* cofflink.c (IS_EXTERNAL): New macro: Return true if the symbol
+	is an external symbol.
+	(IS_WEAK_EXTERNAL): New macro: Return true if the symbol is a weak
+	external symbol.
+
+2000-07-03  Kazu Hirata  <kazu@hxi.com>
+
+	* reloc16.c: Fix formatting.
+
+2000-07-01  Koundinya K  <kk@ddeorg.soft.net>
+
+	* config.bfd: Change targ_defvec and targ_selvecs for mips*-*-sysv4*
+	to add a new target for traditional mips i.e
+	bfd_elf32_tradbigmips_vec and bfd_elf32_tradlittlemips_vec.
+	* configure.in: Likewise.
+	* configure: Rebuild.
+	* targets.c (bfd_elf32_tradbigmips_vec): Declare and put in
+	bfd_target_vector.
+	(bfd_elf32_tradlittlemips_vec): Likewise.
+	* elfxx-target.h: Add macro INCLUDED_TARGET_FILE which is more a test
+	to see that elfNN_bed does not get redefined even if the target file
+	is included twice for a chip. See elf32-mips.c.
+
+2000-07-01  Alan Modra  <alan@linuxcare.com.au>
+
+	* Makefile.am (DEP): Fix 2000-06-22.  grep after running dep.sed
+	(CLEANFILES): Add DEPA.
+	* Makefile.in: Regenerate.
+
+2000-06-30  DJ Delorie  <dj@cygnus.com>
+
+	* peicode.h (coff_swap_filehdr_in): can't use e_magic because we
+	can't assume the PE header is at 0x80.
+
+2000-06-29  Mark Elbrecht  <snowball3@bigfoot.com>
+
+	* syms.c (_bfd_stab_section_find_nearest_line): Use IS_ABSOLUTE_PATH.
+
+2000-06-28  Mark Elbrecht  <snowball3@bigfoot.com>
+
+	* go32stub.h: Update stub.
+
+2000-06-26  Marek Michalkiewicz  <marekm@linux.org.pl>
+
+	* archures.c (bfd_mach_avr5): Define.
+	* bfd-in2.h (bfd_mach_avr5): Define.
+	* cpu-avr.c (arch_info_struct): Rename bfd_mach_avr4 to
+	bfd_mach_avr5, add bfd_mach_avr4.  Update comments.
+	(compatible): Update comment.  Add missing test.
+	* elf32-avr.c (avr_final_link_relocate): Support 8K wrap
+	for avr2 and avr4.  Simplify 8K wrap code.
+	(bfd_elf_avr_final_write_processing): Recognize bfd_mach_avr5.
+	(elf32_avr_object_p): Recognize E_AVR_MACH_AVR5.
+
+2000-06-26  Kazu Hirata  <kazu@hxi.com>
+
+	* coff-h8300.c: Fix formatting.
+	* cpu-h8300.c: Likewise.
+
+2000-06-24  Alexandre Oliva  <aoliva@redhat.com>
+
+	* elf32-arm.h (elf32_arm_final_link_relocate): Print `(local)'
+	for local symbols whose names are unknown.
+
+2000-06-22  Alan Modra  <alan@linuxcare.com.au>
+
+	* Makefile.am (DEP): grep for leading `/' in DEP1, and fail if we
+	find one.
+	* Makefile.in: Regenerate.
+	* doc/Makefile.in: Regenerate.
+
+2000-06-20  H.J. Lu  <hjl@gnu.org>
+
+	* Makefile.am: Rebuild dependency.
+	* Makefile.in: Rebuild.
+
+2000-06-20  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
+
+	* elf32-mips.c (_bfd_mips_elf_copy_indirect_symbol): New function.
+	(elf_backend_copy_indirect_symbol): Map to the new function.
+
+2000-06-20  Alan Modra  <alan@linuxcare.com.au>
+
+	* archive.c (normalize): Correct pointer comparison when checking
+	for backslashes.
+	(bfd_bsd_truncate_arname): Likewise.
+	(bfd_gnu_truncate_arname): Likewise.
+
+2000-06-20  Ulf Carlsson  <ulfc@engr.sgi.com>
+
+	* elf-bfd.h (struct elf_obj_tdata): Define per BFD Irix 5 virtual
+	sections elf_{text,data}_{section,symbol}.
+	* elf32-mips.c: mips_elf_{text,data}_{section,symbol}{,_ptr}: Remove.
+	(_bfd_mips_elf_hide_symbol): New function.
+	(elf_backend_hide_symbol): Map to the new function.
+	(_bfd_mips_elf_add_symbol_hook): Change to use new per BFD
+	definitions of mips_elf_{text,data}_{section,symbol}.
+	(mips_elf_local_relocation_p): Try to find the direct symbol
+	based on new check_forced argument.
+	(mips_elf_calculate_relocation): Use new version of
+	mips_elf_local_relocation_p.
+	(mips_elf_relocate_section): Likewise.
+	(_bfd_mips_elf_relocate_section): Likewise.
+	(mips_elf_sort_hash_table): Only assert that have enough GOT
+	space.
+	(mips_elf_got16_entry): Match all 32 bits to the existing GOT
+	entry if the relocation based on the new external argument.
+	(mips_elf_create_dynamic_relocation): Assert that we have a
+	section contents allocated where we can swap out the dynamic
+	relocations.
+	(mips_elf_calculate_relocation): Find the real hash-table entry
+	correctly by using h->root.root.type.  Only create a dynamic
+	relocation entry if the symbol is defined in a shared library.
+	Create an external GOT entry for the GOT16 relocation if the
+	symbol was forced local.
+	(_bfd_mips_elf_finish_dynamic_symbol): Don't assert there is a
+	dynamic index if the symbol was forced local.
+
+2000-06-20  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
+
+	* elf32-mips.c: Fix typos in comments.
+
+2000-06-19  Mark Kettenis  <kettenis@gnu.org>
+
+	* rs6000-core.c: Wrap definition of `union VmInfo' within #ifdef
+	CORE_VERSION_1.
+
+2000-06-18  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* Makefile.in, bfd-in2.h, libbfd.h, configure: Rebuild.
+	* Makefile.am (ALL_MACHINES, ALL_MACHINES_CFILES, BFD32_BACKENDS,
+	BFD32_BACKENDS_CFILES): Add 68hc12, 68hc11 files.
+	* configure.in (bfd_elf32_m68hc12_vec): Recognize.
+	(bfd_elf32_m68hc11_vec): Likewise.
+	* config.bfd (targ_cpu): Recognize 68hc12 and 68hc11.
+	Supports 68hc11 & 68hc12  at the same time.
+	* targets.c (bfd_elf32_m68hc12_vec): Declare and put in
+	bfd_target_vector.
+	(bfd_elf32_m68hc11_vec): Likewise.
+	* elf.c (prep_headers): Recognize bfd_arch_m68hc12 and 68hc11.
+	* archures.c (bfd_m68hc12_arch): Define and register in global list
+	(bfd_m68hc11_arch): Likewise.
+	* reloc.c (BFD_RELOC_M68HC11_HI8, BFD_RELOC_M68HC11_LO8,
+	BFD_RELOC_M68HC11_3B): Define.
+	* cpu-m68hc12.c, elf32-m68hc12.c: New files for 68hc12 support.
+	* cpu-m68hc11.c, elf32-m68hc11.c: New files for 68hc11 support.
+
+2000-06-18  Ulf Carlsson  <ulfc@engr.sgi.com>
+
+	* elf_bfd.h (struct elf_backend_data): Add info argument to
+	elf_backend_hide_symbol.
+	(_bfd_elf_link_hash_hide_symbol): Likewise.
+	* elf.c (_bfd_elf_link_hash_hide_symbol): Likewise.
+	* elf64-ia64.c (elf64_ia64_hash_hide_symbol): Likewise.
+	* elflink.h (elf_link_add_object_symbols): Likewise.
+	(elf_link_assign_sym_version): Likewise.
+
+2000-06-18  H.J. Lu  <hjl@gnu.org>
+
+	* coff-i386.c (coff_i386_reloc): Don't return in case of
+	output_bfd == (bfd *) NULL if COFF_WITH_PE is defined.
+	Compensate PE relocations when linking with non-PE object
+	files to generate a non-PE executable.
+
+2000-06-17  Ulf Carlsson  <ulfc@engr.sgi.com>
+
+	* elf32-mips.c (mips_elf_calculate_relocation): Explicitly write
+	GOT entries if we're doing a static link or -Bsymbolic link.
+
+2000-06-15  Ulf Carlsson  <ulfc@engr.sgi.com>
+
+	* elflink.h (elf_link_adjust_relocs): Check for and call backend
+	specifific swap_reloc_{in,out} and swap_reloca_{in,out} if
+	available.
+	(elf_link_output_relocs): Likewise.
+	(elf_reloc_link_order): Likewise.
+
+2000-06-16  Nicholas Duffek  <nsd@redhat.com>
+
+	* archures.c (enum bfd_architecture): #define constants for
+	PowerPc and RS6000 machine numbers.
+	* bfd-in2.h: Regenerate.
+	* coffcode.h (coff_set_arch_mach_hook): #ifdef XCOFF64, set arch
+	to bfd_arch_powerpc instead of bfd_arch_rs6000.  Refer to PowerPc
+	and RS6000 machine numbers using #defined constants from
+	archures.c.
+	* cpu-powerpc.c (arch_info_struct): Refer to PowerPc and RS6000
+	machine numbers using #defined constants from archures.c.  Add
+	entries for EC603e, 630, A35, RS64II, RS64III, 7400.  Specify
+	64-bit words in 620 entry.
+	* cpu-rs6000.c (arch_info_struct): Create with entries for RS1,
+	RSC, and RS2.
+	(bfd_rs6000_arch): Change default machine to 0 (bfd_mach_rs6k).
+
+2000-06-16  Nicholas Duffek  <nsd@cygnus.com>
+
+	* coffcode.h (coff_mkobject_hook): Set xcoff_tdata.xcoff64.
+	* libcoff-in.h (struct xcoff_tdata): Define xcoff64 field.
+	* libcoff.h (struct xcoff_tdata): Define xcoff64 field.
+
+2000-06-16  Nicholas Duffek  <nsd@redhat.com>
+
+	* bfd-in.h (bfd_family_coff): Define.
+	* bfd-in2.h: Regenerate.
+	* coffgen.c (coff_count_linenumbers, coff_symbol_from,
+	coff_find_nearest_line): Check COFFness using bfd_family_coff()
+	instead of bfd_target_coff_flavour.
+	* cofflink.c (_bfd_coff_final_link): Likewise.
+	* cpu-ns32k.c (do_ns32k_reloc): Don't strcmp() target name to
+	exclude XCOFF files.
+	* reloc.c (bfd_perform_relocation, bfd_install_relocation):
+	Likewise.
+	* targets.c (enum bfd_flavour): Add bfd_target_xcoff_flavour.
+	* xcoff-target.h (TARGET_SYM): Use bfd_target_xcoff_flavour.
+	* xcofflink.c (XCOFF_XVECP): Delete.
+	(bfd_xcoff_link_record_set, bfd_xcoff_import_symbol,
+	bfd_xcoff_export_symbol, bfd_xcoff_link_count_reloc,
+	bfd_xcoff_record_link_assignment,
+	bfd_xcoff_size_dynamic_sections): Replace XCOFF_XVECP() with
+	check for bfd_target_xcoff_flavour.
+
+2000-06-16  Nicholas Duffek  <nsd@redhat.com>
+
+	* rs6000-core.c: Support 64-bit core files, support pre-4.3 core
+	files on AIX 4.3.
+	(read_hdr): New function.
+	(rs6000coff_core_p): Store mstsave or __context64 struct instead
+	of trying to extract individual registers.  Set abfd->arch_info
+	to match the architecture that created the core file.
+	(rs6000coff_get_section_contents): Delete.
+	* xcoff-target.h (rs6000coff_get_section_contents): Delete.
+
+2000-06-14  H.J. Lu  <hjl@gnu.org>
+
+	* vms-misc.c (_bfd_vms_next_record): Return -1 if PRIV(vms_rec)
+	is NULL.
+
+2000-06-13  H.J. Lu  <hjl@gnu.org>
+
+	* configure: Regenerate.
+
+2000-06-13  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+	* peicode.h (pe_ILF_object_p): Use TARGET_LITTLE_SYM instead of
+	armpei_little_vec.
+
+2000-06-08  David O'Brien  <obrien@FreeBSD.org>
+
+	* configure.in (VERSION): Update to show this is the CVS mainline.
+
+2000-06-07  Alan Modra  <alan@linuxcare.com.au>
+
+	* elf32-d10v.c: Include elf/d10v.h
+	(enum reloc_type): Delete.
+	* elf32-d30v.c: Include elf/d30v.h
+	(enum reloc_type): Delete.
+
+	* Makefile.am: Run "make dep-am" to regenerate dependencies.
+	* Makefile.in: Regenerate.
+
+	* elf32-i386.c (elf_howto_table): Remove EMPTY_HOWTOs.
+	(elf32_i386_vtinherit_howto, elf32_i386_vtentry_howto): Delete and
+	move HOWTOs into elf_howto_table.
+	(R_386_standard, R_386_ext_offset): Define.
+	(R_386_ext, R_386_vt_offset, R_386_vt): Define.
+	(elf_i386_reloc_type_lookup): Modify calculation of index into
+	elf_howto_table since we've removed the padding.
+	(elf_i386_info_to_howto_rel): Likewise.
+	(elf_i386_relocate_section): Likewise.
+
+2000-06-06  Michael Snyder  <msnyder@seadog.cygnus.com>
+
+	* elf.c (elf_grok_pr_status): Eliminate reference to prgregset_t.
+
 2000-06-05  H.J. Lu  <hjl@gnu.org>
 
 	* elflink.c (_bfd_elf_link_record_dynamic_symbol): Don't flag
@@ -18,15 +2399,15 @@
 	(i[3456]86-*-netbsd*): Add bfd_elf32_i386_vec to targ_selvecs.
 	(i[3456]86-*-openbsd*): Likewise.
 
-Tue May 30 15:39:04 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+2000-05-30  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* trad-core.c: From hpux-core.c, include <dirent.h> or
- 	<sys/ndir.h> when possible.
+	<sys/ndir.h> when possible.
 
 2000-05-31  Nick Clifton  <nickc@cygnus.com>
 
 	* opintl.h (_(String)): Explain why dgettext is used instead
-	of gettext. 
+	of gettext.
 
 2000-05-31  Ulrich Drepper  <drepper@redhat.com>
 
@@ -37,8 +2418,8 @@
 2000-05-31  Alan Modra  <alan@linuxcare.com.au>
 
 	* elf-hppa.h: (elf_hppa_final_link_relocate): Use e_rsel field
-        selector for R_PARISC_PCREL17R.  R_PARISC_DIR17R and
-        R_PARISC_DIR17F are for absolute branches; Handle them as such.
+	selector for R_PARISC_PCREL17R.  R_PARISC_DIR17R and
+	R_PARISC_DIR17F are for absolute branches; Handle them as such.
 
 2000-05-30  Nick Clifton  <nickc@cygnus.com>
 
@@ -62,6 +2443,13 @@
 
 	* elf.c (_bfd_elf_link_hash_table_init): Initialize dynlocal.
 
+2000-05-26  Michael Snyder  <msnyder@seadog.cygnus.com>
+
+	* elf.c (elfcore_grok_prstatus, elfcore_grok_pstatus,
+	elfcore_grok_psinfo): Add code to allow debugging a 32-bit
+	corefile on a 64-bit (Sparc Solaris) host.  Also clean up
+	a few old comments.
+
 2000-05-26  Alan Modra  <alan@linuxcare.com.au>
 
 	* Makefile.am: Update dependencies with "make dep-am"
@@ -155,17 +2543,17 @@
 	only if it is known for both input and output bfds. Separate
 	error message strings as in some languages, it may be necessary
 	to change more than one place in the string to change between
-	'big' and 'little'. 
+	'big' and 'little'.
 
 	* elf32-ppc.c (ppc_elf_merge_private_bfd_data): Remove inline
-	endianess checks, call _bfd_generic_verify_endian_match() instead.  
-	
-	* elf32-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.  
+	endianess checks, call _bfd_generic_verify_endian_match() instead.
 
-	* elf32-mcore.c (mcore_elf_merge_private_bfd_data): Likewise.  
+	* elf32-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.
+
+	* elf32-mcore.c (mcore_elf_merge_private_bfd_data): Likewise.
 
 	* elf32-arm.h (elf32_arm_merge_private_bfd_data): Likewise. Verify
-	endianess before checking bfd flavours.  
+	endianess before checking bfd flavours.
 
 2000-05-22  H.J. Lu  <hjl@gnu.org>
 
@@ -184,21 +2572,21 @@
 	* elflink.h (elf_bfd_final_link, elf_link_input_bfd): When emiting
 	relocs for an executable, ensure that they are virtual addresses.
 
-Thu May 18 10:55:47 2000  Jeffrey A Law  (law@cygnus.com)
+2000-05-18  Jeffrey A Law  (law@cygnus.com)
 
 	* config.bfd (hppa*64*-*-hpux11*): New target triplet.
 
 2000-05-17  S. Bharadwaj Yadavalli  <sby@scrugs.lkg.dec.com>
 	    Rick Gorton	            <gorton@scrugs.lkg.dec.com>
-	
-	* elflink.h: Add emitrelocations support: when enabled, relocation 
+
+	* elflink.h: Add emitrelocations support: when enabled, relocation
 	information and relocation sections are put into final output
 	executables.  If the emitrelocations flag is set, do the following:
 	(elf_bfd_final_link): Emit relocation sections.
 	(elf_link_input_bfd): Compute relocation section contents.
 	(elf_gc_sections): Don't clean relocation sections.
 
-2000-05-16  Catherine Moore  <clm@cygnux.com>
+2000-05-16  Catherine Moore  <clm@cygnus.com>
 
 	* som.c (som_decode_symclass):  Recognize weak symbols.
 
@@ -208,7 +2596,7 @@
 	read idata section only from dataoff.
 	(pe_print_edata): Correctly check for valid eat_member.
 
-Tue May 16 00:04:11 2000  J"orn Rennecke <amylaar@cygnus.co.uk>
+2000-05-16  J"orn Rennecke <amylaar@cygnus.co.uk>
 
 	* elf32-sh.c (sh_elf_relax_delete_bytes): Handle R_SH_SWITCH8.
 
@@ -262,7 +2650,7 @@
 	(_bfd_pe_print_private_bfd_data_common): Print Reserved1 field as
 	Win32Version.
 
-Fri May  5 20:44:40 2000  Clinton Popetz  <cpopetz@cygnus.com>
+2000-05-05  Clinton Popetz  <cpopetz@cygnus.com>
 
 	* xcoff.h: Rename to xcoff-target.h
 	* Makefile.am: Change all instances of xcoff.h to xcoff-target.h
@@ -270,8 +2658,8 @@
 	* coff64-rs6000.c: Ditto.
 	* coff-pmac.c: Ditto.
 	* Makefile.in: Regenerate.
-	
-Fri May  5 16:51:03 2000  Clinton Popetz  <cpopetz@cygnus.com>
+
+2000-05-05  Clinton Popetz  <cpopetz@cygnus.com>
 
 	* coffcode.h (coff_set_arch_mach_hook, coff_set_flags):
 	Change U802TOC64MAGIC to U803XTOCMAGIC.
@@ -314,7 +2702,7 @@
 	dependencies.
 	* Makefile.in: Regenerate.
 
-Mon May  1 16:56:47 2000  Jim Wilson  <wilson@cygnus.com>
+2000-05-01  Jim Wilson  <wilson@cygnus.com>
 
 	* Makefile.am (BFD32_BACKENDS): Add efi-app-ia32.lo.
 	(BFD32_BACKENDS_CFILES): Add efi-app-ia32.c.
@@ -384,7 +2772,7 @@
 	(bfd_hppa_insn2fmt): Change arg to unsigned int.  Delete fmt.
 	(hppa_rebuild_insn): Change args and return value to unsigned
 	int.  Make use of re_assemble_*.  Correct case 11.
-	
+
 	* dep-in.sed: Handle ../opcodes/.
 	* Makefile.am (SOURCE_HFILES): Add elf-hppa.h, elf32-hppa.h,
 	elf64-hppa.h, hppa_stubs.h, xcoff.h.
@@ -405,10 +2793,10 @@
 	* coff-sh.c (bfd_coff_small_swap_table): Fix Fri Apr 28 change.
 	* vms.c (vms_openr_next_archived_file): Return NULL.
 
-Fri Apr 28 21:34:44 2000  Clinton Popetz  <cpopetz@cygnus.com>
+2000-04-28  Clinton Popetz  <cpopetz@cygnus.com>
 
 	* coffcode.h Copy changes mistakenly done to libcoff.h in
-	4/24/2000 patch.  	
+	4/24/2000 patch.
 
 2000-04-29  Andreas Jaeger  <aj@suse.de>
 
@@ -418,7 +2806,7 @@
 	* libbfd.h: Regenerate.
 	* bfd-in2.h: Regenerate.
 
-Fri Apr 28 14:58:37 2000  Clinton Popetz  <cpopetz@cygnus.com>
+2000-04-28  Clinton Popetz  <cpopetz@cygnus.com>
 
 	* Makefile.am (BFD64_BACKENDS, BFD64_BACKENDS_CFILES): Add
 	coffdu-rs6000.{lo,c}.
@@ -429,25 +2817,25 @@
 	* coff-pmac.c: Use xcoff.h instead of coff-rs6000.c.
 	* coff-rs6000.c: Move all declarations and defines that are
 	common to the xcoff backends into xcoff.h
-	* coff64-rs6000.c: Ditto, 	
+	* coff64-rs6000.c: Ditto,
 
-Fri Apr 28 08:35:21 2000  Clinton Popetz  <cpopetz@cygnus.com>
+2000-04-28  Clinton Popetz  <cpopetz@cygnus.com>
 
 	* coff-mips.c (mips_ecoff_backend_data):  Add initialization of
 	_bfd_coff_force_symnames in strings and
 	_bfd_coff_debug_string_prefix_length to their default values.
 	* coff-sh.c: (bfd_coff_small_swap_table): Ditto.
 
-Fri Apr 28 08:05:12 2000  Clinton Popetz  <cpopetz@cygnus.com>
+2000-04-28  Clinton Popetz  <cpopetz@cygnus.com>
 
 	* coff-alpha.c (alpha_ecoff_backend_data): Add initialization of
-	_bfd_coff_force_symnames in strings and 
+	_bfd_coff_force_symnames in strings and
 	_bfd_coff_debug_string_prefix_length to their default values.
 
 2000-04-27  Alan Modra  <alan@linuxcare.com.au>
 
 	* elf32-m68k.c (elf_m68k_gc_sweep_hook):  Return if dynobj NULL.
-	Check local_got_refcounts before dereferencing. 
+	Check local_got_refcounts before dereferencing.
 
 	* elf32-ppc.c (ppc_elf_relocate_section): Check splt != NULL
 	before deciding we don't need R_PPC_PLT32 relocation.
@@ -465,11 +2853,11 @@
 	can use a relative reloc for got as elf_i386_relocate_section.
 	(bfd_elf32_bfd_final_link): Define to use gc form of final link.
 
-Wed Apr 26 16:31:28 2000  Clinton Popetz  <cpopetz@cygnus.com>
+2000-04-26  Clinton Popetz  <cpopetz@cygnus.com>
 
 	* config.bfd: Remove extraneous bfd_powerpc_64_arch.
 
-Mon Apr 24 15:20:35 2000  Clinton Popetz  <cpopetz@cygnus.com>
+2000-04-24  Clinton Popetz  <cpopetz@cygnus.com>
 
 	* Makefile.am (coff64-rs6000.lo): New rule.
 	* Makefile.in: Regenerate.
@@ -483,21 +2871,21 @@
 	xcoff64_swap_aux_out): New functions; handle xcoff symbol tables
 	internally.
 	(MINUS_ONE): New macro.
-	(xcoff_howto_tabl, xcoff_reloc_type_lookup): Add 64 bit POS 
+	(xcoff_howto_tabl, xcoff_reloc_type_lookup): Add 64 bit POS
 	relocation.
-	(coff_SWAP_sym_in, coff_SWAP_sym_out, coff_SWAP_aux_in, 
+	(coff_SWAP_sym_in, coff_SWAP_sym_out, coff_SWAP_aux_in,
 	coff_SWAP_aux_out): Map to the new functions.
 	* coff64-rs6000.c: New file.
-	* libcoff.h (bfd_coff_backend_data): Add new fields 
-	_bfd_coff_force_symnames_in_strings and 
+	* libcoff.h (bfd_coff_backend_data): Add new fields
+	_bfd_coff_force_symnames_in_strings and
 	_bfd_coff_debug_string_prefix_length.
-	(bfd_coff_force_symnames_in_strings, 
+	(bfd_coff_force_symnames_in_strings,
 	bfd_coff_debug_string_prefix_length): New macros for above fields.
 	* coffcode.h (coff_set_arch_mach_hook): Handle XCOFF64 magic.
-	Set machine to 620 for XCOFF64.  Use bfd_coff_swap_sym_in instead 
+	Set machine to 620 for XCOFF64.  Use bfd_coff_swap_sym_in instead
 	of using coff_swap_sym_in directly.
 	(FORCE_SYMNAMES_IN_STRINGS): New macro, defined for XCOFF64.
-	(coff_set_flags) Set magic for XCOFF64.	
+	(coff_set_flags) Set magic for XCOFF64.
 	(coff_compute_section_file_positions): Add symbol name length to
 	string section length if bfd_coff_debug_string_prefix_length is
 	true.
@@ -506,17 +2894,17 @@
 	using coff_swap_lineno_in directly.
 	(bfd_coff_backend_data): Add _bfd_coff_force_symnames_in_strings
 	and _bfd_coff_debug_string_prefix_length fields.
-	* coffgen.c (coff_fix_symbol_name, coff_write_symbols): Force 
-	symbol names into strings table when 
+	* coffgen.c (coff_fix_symbol_name, coff_write_symbols): Force
+	symbol names into strings table when
 	bfd_coff_force_symnames_in_strings is true.
 	* coffswap.h (MAX_SCNHDR_NRELOC, MAX_SCNHDR_NLNNO, GET_RELOC_VADDR,
 	SET_RELOC_VADDR): New macros.
-	(coff_swap_reloc_in, coff_swap_reloc_out): Use above macros.	
+	(coff_swap_reloc_in, coff_swap_reloc_out): Use above macros.
 	(coff_swap_aux_in, coff_swap_aux_out): Remove RS6000COFF_C
 	code.
 	(coff_swap_aouthdr_in, coff_swap_aouthdr_out): Handle XCOFF64
 	changes within RS6000COFF_C specific code.
-	(coff_swap_scnhdr_out): Use PUT_SCNHDR_NLNNO, PUT_SCNHDR_NRELOC, 
+	(coff_swap_scnhdr_out): Use PUT_SCNHDR_NLNNO, PUT_SCNHDR_NRELOC,
 	MAX_SCNHDR_NRELOC, and MAX_SCNHDR_NLNNO.
 	* reloc.c (bfd_perform_relocation, bfd_install_relocation):
 	Extend existing hack on target name.
@@ -529,7 +2917,7 @@
 	* configure.in: Add rs6000coff64_vec case.
 	* cpu-powerpc.c: New bfd_arch_info_type.
 
-Mon Apr 24 02:17:31 2000  Jeffrey A Law  (law@cygnus.com)
+2000-04-24  Jeffrey A Law  (law@cygnus.com)
 
 	* config.bfd: Only disable elf32-hppa vectors, not all of the
 	BSD and OSF configuration support.  Provide (disabled) clauses
@@ -547,12 +2935,12 @@
 
 	* elf64-hppa.c, elf64-hppa.h: New files with PA64 support.
 
-Mon Apr 24 02:14:29 2000  Jason Eckhardt  <jle@cygnus.com>
+2000-04-24  Jason Eckhardt  <jle@cygnus.com>
 
 	* libhppa.h (dis_assemble_16): New function.
 	(pa_arch): Added pa20w element.
 
-Mon Apr 24 01:49:03 2000  Ulrich Drepper  <drepper@cygnus.com>
+2000-04-24  Ulrich Drepper  <drepper@cygnus.com>
 
 	* elf-bfd.h: Add prototypes for bfd_elf32_write_relocs,
 	bfd_elf32_slurp_reloc_table, bfd_elf64_write_relocs, and
@@ -578,7 +2966,7 @@
 			  David Mosberger  <davidm@hpl.hp.com>
 			  Timothy Wall <twall@cygnus.com>
 			  Jim Wilson  <wilson@cygnus.com>
-	
+
 	* Makefile.am (ALL_MACHINES): Add cpu-ia64.lo.
 	(ALL_MACHINES_CFILES): Add cpu-ia64.c.
 	(BFD64_BACKENDS): Add elf64-ia64.lo.
@@ -601,7 +2989,7 @@
 	Declare.
 	(bfd_target_vect): Add bfd_elf64_ia64_little_vec.
 	* cpu-ia64-opc.c, cpu-ia64.c, elf64-ia64.c: New files.
-	
+
 2000-04-21  Richard Henderson  <rth@cygnus.com>
 
 	* elf32-d30v.c (bfd_elf_d30v_reloc): Don't modify section
@@ -671,7 +3059,7 @@
 	bfd_efi_app_ia64_vec.
 	(bfd_target_vector): Mention bfd_efi_app_ia32_vec and
 	bfd_efi_app_ia64_vec.
-	
+
 2000-04-17  Timothy Wall  <twall@cygnus.com>
 
 	* bfd-in2.h: Add prototypes for tic54x load page access.
@@ -679,9 +3067,9 @@
 	* coff-tic54x.c: Add load page functions; allow bfd_arch_unknown
 	in customized _set_arch_mach function.
 	* coffcode.h (coff_set_alignment_hook): Set section load page if
-	the appropriate macro is defined. 
+	the appropriate macro is defined.
 	(write_object_contents): Read section load page.
-	
+
 2000-04-13  Alan Modra  <alan@linuxcare.com.au>
 
 	* elf32-hppa.h: Update copyright date.
@@ -724,7 +3112,7 @@
 	* Makefile.in: Regenerate.
 	* coffcode.h (coff_set_arch_mach_hook): Eliminate warning on
 	unitialized variable.
-	
+
 Fri Apr  7 15:56:57 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* configure.in (WARN_CFLAGS): Set to -W -Wall by default.  Add
@@ -750,7 +3138,7 @@
 
 	* Makefile.am: Fix dependency for elfarm-oabi.c
 	* Makefile.in: Regenerate.
-	
+
 	* bfd-in2.h: Regenerate.
 	* libbfd.h: Regenerate.
 
@@ -759,7 +3147,7 @@
 	* elfcore.h (elf_core_file_p): preserve value of tdata at entry,
 	and restore it on failure.  Release newly allocated tdata on
 	failure.
-	
+
 Fri Apr  7 11:33:47 2000  Jim Wilson  <wilson@cygnus.com>
 
 	* dwarf2.c (struct dwarf2_debug): New field dwarf_line_size.
@@ -780,7 +3168,7 @@
 	* archures.c (bfd_archures_list): Add tic54x target.
 	* coff-tic54x.c: New.
 	* cpu-tic54x.c: New.
-	
+
 2000-04-06  Michael Snyder  <msnyder@seadog.cygnus.com>
 
 	* elfcore.h (elf_core_file_p): call backend_object_p which
@@ -938,7 +3326,7 @@
 
 2000-03-11  Alan Modra  <alan@linuxcare.com.au>
 
-	* ieee.c (ieee_archive_p): Return bfd_error_wrong_format on 
+	* ieee.c (ieee_archive_p): Return bfd_error_wrong_format on
 	a format mismatch rather than an "error" from bfd_read such as
 	bfd_error_file_truncated.
 
@@ -1048,7 +3436,7 @@
 	'srelgot'.
 
 	* elf32-mcore.c (mcore_elf_relocate_section): Initialise
-	'oldinst'. 
+	'oldinst'.
 
 	* elf32-mips.c: Add ATTRIBUTE_UNUSED to unused function
 	parameters.
@@ -1059,13 +3447,13 @@
 
 	* elflink.h (elf_bfd_link_add_symbols): Add ATTRIBUTE_UNUSED
 	to unused function parameter.
-	
+
 	* pe-mips.c: Add ATTRIBUTE_UNUSED to unused function
 	parameters.
 	Use EMPTY_HOWTO to initialise empty howto slots.
 	Remove unused variables.
 
-	* peicode.h (pe_ILF_build_a_bfd): Initialise id6.	
+	* peicode.h (pe_ILF_build_a_bfd): Initialise id6.
 
 2000-03-01  H.J. Lu  <hjl@gnu.org>
 
@@ -1124,7 +3512,7 @@
 	* configure: regenerate.
 
 	* config.bfd: Add support for arm-wince, mips-pe and sh-pe
-	targets. 
+	targets.
 
 	* targets.c: Add mips and sh pe vectors.
 
@@ -1199,7 +3587,7 @@
 2000-02-24  Catherine Moore  <clm@cygnus.com>
 
 	* som.c (som_misc_symbol_info):  Add field
-	secondary_def. 
+	secondary_def.
 	(som_bfd_derive_misc_symbol_info):  Initialize
 	secondary_def.
 	(som_build_and_write_symbol_table): Keep track
@@ -1213,7 +3601,7 @@
 
 	* dwarf2.c (read_address): Read 16-bits addresses.
 	(parse_comp_unit): Accept addr_size == 2.
-	
+
 2000-02-23  Alan Modra  <alan@spri.levels.unisa.edu.au>
 
 	* bfd-in.h: Update copyright date.
@@ -1394,7 +3782,7 @@
 	hide_symbol members.
 	(elf_link_hash_copy_indirect): New.
 	(elf_link_hash_hide_symbol): New.
-	* elflink.h (elf_link_add_object_symbols): Break out copy from 
+	* elflink.h (elf_link_add_object_symbols): Break out copy from
 	indirect new new symbol to elf.c.
 	(elf_link_assign_sym_version): Break out privatization of
 	non-exported symbol to elf.c.
@@ -1432,7 +3820,7 @@
 	* (sh_insn_sets_reg, sh_insn_uses_or_sets_reg, sh_insns_sets_freg,
 	sh_insns_uses_or_sets_freg): New functions.
 	* (sh_insn_uses_reg, sh_insn_uses_freg): Use new macros.
-	* (sh_insns_conflict): Use new functions and new macros to 
+	* (sh_insns_conflict): Use new functions and new macros to
 	detect conflicts when two instructions both set same integer registers,
 	both set same fp register, and both set special register.
 
@@ -1443,7 +3831,7 @@
 	the arch/mach info.
 
 2000-02-08 Mark Elbrecht <snowball3@bigfoot.com>
-	
+
 	* coff-go32.c: Update comment. Update copyright.
 
 2000-01-27  Thomas de Lellis  <tdel@windriver.com>
@@ -1460,12 +3848,12 @@
 
 	(bfd_is_undefined_symclass): New function.  Return true if the
 	given symbol class represents and undefined/unresolved symbol.
-	
+
 	(bfd_symbol_info): Use bfd_is_undefined_symclass to check for
 	unresolved symbols.
 
 	* bfd-in2.h: Add prototype for bfd_is_undefined_symbol().
-	
+
 	* elf32-arm.h (elf32_arm_get_symbol_type): If a symbol has the
 	STT_ARM_16BIT flag set, but it is not attached to a data object
 	return STT_ARM_16BIT so that it will be treated as code by the
@@ -1505,7 +3893,7 @@
 	= scnhsz, filhsz, relsz, aoutsz, etc)
 
 	 * coffswap.h: Ditto.
-	
+
 2000-01-13  Nick Clifton  <nickc@cygnus.com>
 
 	* elf32-arm.h (elf32_thumb_to_arm_stub): Fix offset in branch to
@@ -1526,27 +3914,27 @@
 
 	* coffgen.c: Indicate that the offset parameter is in bytes, not
 	octets.
-	
+
 	* cofflink.c (bfd_coff_link_input_bfd): Use bfd_octets_per_byte
 	where appropriate to get the octet offset when calling
 	bfd_set_section_contents.
 	(bfd_coff_reloc_link_order): Ditto.
-	
+
 	* linker.c (bfd_generic_reloc_link_order): Ditto.
 	(_bfd_default_link_order): Ditto.
-	
+
 	* reloc.c (bfd_perform_relocation):  Distinguish between octets
 	and bytes.  Use octets when indexing into octet data; use bytes
 	when calculating target addresses.
 	(bfd_install_relocation): Ditto.
-	
+
 	* srec.c (srec_write_section): Ditto.
-	
+
 2000-01-13  Nick Clifton  <nickc@cygnus.com>
 
 	* coff-mcore.c (COFF_DEFAULT_SECTION_ALIGNMENT_POWER): Change from
 	3 to 2.  This allows 4 byte sized sections, which is necessary for
-	dlltool to build funcitoning DLLs.
+	dlltool to build functioning DLLs.
 
 2000-01-10  Philip Blundell  <pb@futuretv.com>
 
@@ -1555,14 +3943,14 @@
 
 2000-01-10  Egor Duda  <deo@logos-m.ru>
 
-	* config.bfd: Include elf32_i386 vector to target list for cygwin 
+	* config.bfd: Include elf32_i386 vector to target list for cygwin
 	and mingw.
-	
+
 	* config.in: Undefine HAVE_WIN32_PSTATUS_T.
 	* configure.in: Test for structure win32_pstatus_t in
 	<sys/procfs.h>
 	* configure: Regenerate.
-	
+
 	* elf.c (elfcore_grok_win32pstatus): New function: process
 	win32_pstatus_t notes in elf core file.
 	(elfcore_grok_note): Detect win32_pstatus notes.
@@ -1582,7 +3970,7 @@
 1999-12-27  Nick Clifton  <nickc@cygnus.com>
 
 	* peicode.h (pe_bfd_object_p): Only define for PE format
-	targets. 
+	targets.
 
 1999-12-17  Nick Clifton  <nickc@cygnus.com>
 
@@ -1596,7 +3984,7 @@
 	presence of a PE format COFF object file.  Also detect and
 	warn about the presence of LINK6 format Image Library Format
 	object files.
-	
+
 1999-12-16  Nick Clifton  <nickc@cygnus.com>
 
 	* coff-arm.c (NUM_ELEM): New macro.
@@ -1611,12 +3999,12 @@
 
 	* elflink.h (is_global_symbol_definition): New Function: Return
 	true iff the symbol is being given a global definition in this
-	bfd. 
+	bfd.
 	(elf_link_is_defined_archive_symbol): Do not bother processing
 	symbols for an archive element that has already been included
 	in the link.
 	Use is_global_symbol_definition().
-	
+
 1999-12-09  Andrew Cagney  <cagney@cygnus.com>
 
 	* config.bfd: Add support for sparc-*-netbsdelf* and
@@ -1753,11 +4141,11 @@
 	(_bfd_elfcore_section_from_phdr): Remove call to elfcore_read_notes,
 	now called by _bfd_elf_make_section_from_phdr.  Note that this func
 	is now just a stub between the caller and bfd_section_from_phdr.
-	
+
 	* elf-bfd.h (struct elf_backend_data): Add new function pointer
 	elf_backend_section_from_phdr.
 	(elf_backend_section_from_phdr): Add prototype.
-	
+
 	* elfxx-target.h (elf_backend_section_from_phdr): Define default.
 	(elfNN_bed): Add elf_backend_section_from_phdr.
 
@@ -1772,7 +4160,7 @@
 1999-11-20  Nick Clifton  <nickc@cygnus.com>
 
 	* coff-mcore.c (coff_mcore_relocate_section): Fix typo in previous
-	delta. 
+	delta.
 
 1999-11-19  Catherine Moore  <clm@cygnus.com>
 
@@ -1826,7 +4214,7 @@
 	bfd_mach_d10v_ts3.
 	* cpu-d10v.c (d10v_ts3_info, d10v_ts2_info): Add.
 	* bfd-in2.h: Regenerate.
-	
+
 1999-10-15  Andrew Haley  <aph@cygnus.com>
 
 	* dwarf1.c (parse_die): Fail to parse a die if its length is zero.
@@ -1966,7 +4354,7 @@
 1999-09-14  Nick Clifton  <nickc@cygnus.com>
 
 	* elf32-m32r.c (ELF_MAXPAGESIZE): Change to 0x1 (at request of
-	Mitsubishi). 
+	Mitsubishi).
 
 Mon Sep 13 20:01:47 1999  Jeffrey A Law  (law@cygnus.com)
 
@@ -1994,7 +4382,7 @@
 	PC24 relocs if the target is an undefined weak symbol.
 	(arm_add_to_rel): Fix compiler warning.
 	(elf32_arm_plt0_entry): Correct comments.
-	
+
 1999-09-13  Alan Modra  <alan@spri.levels.unisa.edu.au>
 
 	* elfcode.h (write_relocs): Check for the_bfd NULL when handling
@@ -2198,13 +4586,13 @@
 	DIR32, DIR64 and FPTR64 relocations.
 	(elf_hppa_relocate_insn): Similarly.
 
-	* elf-hppa.h (elf_hppa_final_link): Set the value of __gp to the        
+	* elf-hppa.h (elf_hppa_final_link): Set the value of __gp to the
 	address of the .PARISC.global section.
 	(elf_hppa_relocate_section): Lookup and pass the PA64 hash
 	table entry elf_hppa_final_link_relocate.  Do not give a warning
 	for a reloc against an external symbol if it has a PA64 hash
 	table entry.
-	(elf_hppa_final_link_relocate): Significantly rework.  Handle   
+	(elf_hppa_final_link_relocate): Significantly rework.  Handle
 	DLTIND relocations.  Compute the final value of the relocation
 	before passing the value of elf_hppa_relocate_insn.
 	(elf_hppa_relocate_insn): Revamp to handle just bit tiwiddling
@@ -2225,7 +4613,7 @@
 	(elf_hppa_relocate_insn): Similarly.
 
 	* elf-hppa.h (elf_hppa_final_link_relocate): Handle DLTREL14WR and
-	DLTREL14WD relocs.  
+	DLTREL14WD relocs.
 	(elf_hppa_relocate_insn): Similarly.
 
 	* elf-hppa.h (elf_hppa_final_link_relocate): Handle DLTREL14R and
@@ -2379,9 +4767,9 @@
 	(ALL_MACHINES_CFILES): Add armnetbsd.c.
 	(armnetbsd.lo): New rule with deps.
 	* Makefile.in: Regenerate.
-	
+
 	* armnetbsd.c: New file:  Definitions specific to arm-netbsd
-	target. 
+	target.
 
 Tue Aug 24 00:25:58 1999  Jeffrey A Law  (law@cygnus.com)
 
@@ -2484,8 +4872,8 @@
 	prototype.  Handle local symbols.  Add commentary.
 	(mips_elf_calculate_relocation): Adjust accordingly.
 	(_bfd_mips_elf_check_relocs): Handle local symbols in R_MIPS_32
-	relocations. 
-	
+	relocations.
+
 	* elflink.h (elf_bfd_final_link): Tweak last change.
 
 1999-08-09  Mark Mitchell  <mark@codesourcery.com>
@@ -2622,7 +5010,7 @@
 	Just return the relocation found.
 	(mips_elf_relocate_section): Pull the LO16 addend out of the
 	section itself when using REL relocations.
-	
+
 	* elf32-mips.c (mips_elf_calculate_relocation): Restore
 	_DYNAMIC_LINK handling and handling of undefined symbols in shared
 	libraries.
@@ -2646,7 +5034,7 @@
 	and R_MIPS16_26 relocations correctly when relocating.
 	(_bfd_mips_elf_check_relocs): Don't assume that R_MIPS_CALL_HI16
 	and R_MIPS_CALL_LO16 are for global symbols.
-	
+
 1999-08-02  Jakub Jelinek  <jj@ultra.linux.cz>
 
 	* elflink.h (elf_bfd_final_link): Copy the whole isym, not just
@@ -2721,7 +5109,7 @@
 1999-07-27  Nick Clifton  <nickc@cygnus.com>
 
 	Patch generated by Bernd Schmidt. <bernds@cygnus.co.uk>
-	
+
 	* coff-arm.c (coff_arm_is_local_label_name): Change to strip
 	out only symbols that start with LOCAL_LABEL_PREFIX followed by 'L'.
 
@@ -2798,59 +5186,59 @@
 	* nlm-target.h: Initialise the alternative_target field of
 	the bfd_target structures to point to the other target (if
 	defined).
-	
+
 	* coffcode.h (CREATE_BIG_COFF_TARGET_VEC): New macro.
 	(CREATE_LITTLE_COFF_TARGET_VEC): New macro.
-	
+
 	* aix386-core.c: Initialise new field of bfd_target structure.
 	* aout-adobe.c: Initialise new field of bfd_target structure.
-	* aout-arm.c: Initialise new field of bfd_target structure. 
-	* aout-target.h: Initialise new field of bfd_target structure. 
-	* aout-tic30.c: Initialise new field of bfd_target structure. 
-	* binary.c: Initialise new field of bfd_target structure. 
-	* bout.c: Initialise new field of bfd_target structure. 
-	* cisco-core.c: Initialise new field of bfd_target structure. 
+	* aout-arm.c: Initialise new field of bfd_target structure.
+	* aout-target.h: Initialise new field of bfd_target structure.
+	* aout-tic30.c: Initialise new field of bfd_target structure.
+	* binary.c: Initialise new field of bfd_target structure.
+	* bout.c: Initialise new field of bfd_target structure.
+	* cisco-core.c: Initialise new field of bfd_target structure.
 	* coff-a29k.c: Use CREATE_BIG_COFF_TARGET_VEC.
-	* coff-alpha.c: Initialise new field of bfd_target structure. 
+	* coff-alpha.c: Initialise new field of bfd_target structure.
 	* coff-apollo.c: Use CREATE_BIG_COFF_TARGET_VEC.
 	* coff-arm.c: Use CREATE_{BIG|LITTLE}_COFF_TARGET_VEC.
 	* coff-h8300.c: Use CREATE_BIG_COFF_TARGET_VEC.
 	* coff-h8500.c: Use CREATE_BIG_COFF_TARGET_VEC.
-	* coff-i386.c: Initialise new field of bfd_target structure. 
-	* coff-i860.c: Initialise new field of bfd_target structure. 
+	* coff-i386.c: Initialise new field of bfd_target structure.
+	* coff-i860.c: Initialise new field of bfd_target structure.
 	* coff-i960.c: Use CREATE_LITTLE_COFF_TARGET_VEC.
 	* coff-m68k.c: Use CREATE_BIG_COFF_TARGET_VEC.
 	* coff-mcore.c: Use CREATE_{BIG|LITTLE}_COFF_TARGET_VEC.
-	* coff-mips.c: Initialise new field of bfd_target structure. 
-	* coff-ppc.c: Initialise new field of bfd_target structure. 
-	* coff-rs6000.c: Initialise new field of bfd_target structure. 
+	* coff-mips.c: Initialise new field of bfd_target structure.
+	* coff-ppc.c: Initialise new field of bfd_target structure.
+	* coff-rs6000.c: Initialise new field of bfd_target structure.
 	* coff-sh.c:  Use CREATE_{BIG|LITTLE}_COFF_TARGET_VEC.
 	* coff-sparc.c: Use CREATE_BIG_COFF_TARGET_VEC.
-	* coff-tic30.c: Initialise new field of bfd_target structure. 
+	* coff-tic30.c: Initialise new field of bfd_target structure.
 	* coff-tic80.c: Use CREATE_LITTLE_COFF_TARGET_VEC.
 	* coff-w65.c:   Use CREATE_LITTLE_COFF_TARGET_VEC.
 	* coff-we32k.c: Use CREATE_BIG_COFF_TARGET_VEC.
 	* coff-z8k.c:   Use CREATE_BIG_COFF_TARGET_VEC.
-	* hppabsd-core.c: Initialise new field of bfd_target structure. 
-	* hpux-core.c: Initialise new field of bfd_target structure. 
-	* i386msdos.c: Initialise new field of bfd_target structure. 
-	* i386os9k.c: Initialise new field of bfd_target structure. 
-	* ieee.c: Initialise new field of bfd_target structure. 
-	* ihex.c: Initialise new field of bfd_target structure. 
-	* irix-core.c: Initialise new field of bfd_target structure. 
-	* mipsbsd.c: Initialise new field of bfd_target structure. 
-	* netbsd-core.c: Initialise new field of bfd_target structure. 
-	* oasys.c: Initialise new field of bfd_target structure. 
-	* osf-core.c: Initialise new field of bfd_target structure. 
-	* ppcboot.c: Initialise new field of bfd_target structure. 
-	* ptrace-core.c: Initialise new field of bfd_target structure. 
-	* sco5-core.c: Initialise new field of bfd_target structure. 
-	* som.c: Initialise new field of bfd_target structure. 
-	* srec.c: Initialise new field of bfd_target structure. 
-	* tekhex.c: Initialise new field of bfd_target structure. 
-	* trad-core.c: Initialise new field of bfd_target structure. 
-	* versados.c: Initialise new field of bfd_target structure. 
-	* vms.c: Initialise new field of bfd_target structure. 
+	* hppabsd-core.c: Initialise new field of bfd_target structure.
+	* hpux-core.c: Initialise new field of bfd_target structure.
+	* i386msdos.c: Initialise new field of bfd_target structure.
+	* i386os9k.c: Initialise new field of bfd_target structure.
+	* ieee.c: Initialise new field of bfd_target structure.
+	* ihex.c: Initialise new field of bfd_target structure.
+	* irix-core.c: Initialise new field of bfd_target structure.
+	* mipsbsd.c: Initialise new field of bfd_target structure.
+	* netbsd-core.c: Initialise new field of bfd_target structure.
+	* oasys.c: Initialise new field of bfd_target structure.
+	* osf-core.c: Initialise new field of bfd_target structure.
+	* ppcboot.c: Initialise new field of bfd_target structure.
+	* ptrace-core.c: Initialise new field of bfd_target structure.
+	* sco5-core.c: Initialise new field of bfd_target structure.
+	* som.c: Initialise new field of bfd_target structure.
+	* srec.c: Initialise new field of bfd_target structure.
+	* tekhex.c: Initialise new field of bfd_target structure.
+	* trad-core.c: Initialise new field of bfd_target structure.
+	* versados.c: Initialise new field of bfd_target structure.
+	* vms.c: Initialise new field of bfd_target structure.
 
 1999-07-19  Andreas Schwab  <schwab@suse.de>
 
@@ -2861,11 +5249,11 @@
 
 	* elflink.h (elf_link_adjust_relocs): New function.
 	(elf_bfd_final_link): Use it.
-	(elf_link_input_bfd): Deal with the fact that there can be 
+	(elf_link_input_bfd): Deal with the fact that there can be
 	two relocation sections for a single section.
 	(elf_reloc_link_order): Likewise.
 
-	* elf32-mips.c (_bfd_mips_elf_final_link): Don't set GP for 
+	* elf32-mips.c (_bfd_mips_elf_final_link): Don't set GP for
 	a relocateable object.
 	(_bfd_mips_elf_relocate_section): Handle relocateable links.
 
@@ -2962,7 +5350,7 @@
 	subwords when handling an R_MIPS16_26 relocation.
 	(mips_elf_perform_relocation): Don't be paranoid abour right-shift
 	semantics.
-	
+
 	* elf32-mips.c (elf_mips16_gprel_howto): Adjust src_mask and
 	dst_mask to match reality.
 	(_bfd_mips_elf_calculate_relocation): Handle R_MIPS16_GPREL.
@@ -2973,7 +5361,7 @@
 1999-07-13  Mark Mitchell  <mark@codesourcery.com>
 
 	* elf32-mips.c (mips_elf_calculate_relocation): Handle R_MIPS16_26.
-	(mips_elf_relocate_section): Adjust calling sequence for 
+	(mips_elf_relocate_section): Adjust calling sequence for
 	mips_elf_perform_relocation.
 	(mips_elf_perform_relocation): Take additional argument.  Handle
 	R_MIPS16_26.  Use bfd_put for convenience.
@@ -3132,7 +5520,7 @@
 	(_bfd_mips_elf_create_dynamic_sections): New function.
 	(_bfd_mips_elf_add_symbol_hook): Likewise.
 	(_bfd_mips_elf_adjust_dynamic_symbol): Likewise.
-	(_bfd_mips_elf_finish_dynamic_symbol): Likewise.	
+	(_bfd_mips_elf_finish_dynamic_symbol): Likewise.
 	(_bfd_mips_elf_finish_dynamic_sections): Likewise.
 	(_bfd_mips_elf_gc_mark_hook): Likewise.
 	(_bfd_mips_elf_gc_sweep_hook): Likewise.
@@ -3202,7 +5590,7 @@
 	(_bfd_mips_elf_print_private_bfd_data): Print ABI=64 for 64-bit
 	ABI.
 	(_bfd_mips_elf_fake_sections): Remove duplicate handling of
-	.msym. 
+	.msym.
 	(mips_elf_global_got_index): Use MIPS_ELF_GOT_SIZE.
 	(mips_elf_got_offset_from_index): Use misp_elf_got_section.
 	(mips_elf_create_local_got_entry): Use MIPS_ELF_GOT_SIZE.
@@ -3223,7 +5611,7 @@
 	(mips_elf64_section_processing): Likewise.
 	Adjust elf backend entries to use _bfd_mips_elf variants now
 	publicly available.
-	
+
 	* elflink.h (elf_link_create_dynamic_sections): Handle non-standard
 	hash-entry sizes.
 	(size_dynamic_sections): Likewise.
@@ -3237,7 +5625,7 @@
 
 	* elf-bfd.h (elf_size_info): Add hash_entry_size,
 	int_rels_per_ext_rel, swap_dyn_out, swap_reloc_in, swap_reloc_out,
-	wap_reloca_in, and swap_reloca_out. 
+	wap_reloca_in, and swap_reloca_out.
 	* elflink.h (elf_link_read_relocs_from_section): Adjust to handle
 	multiple internal relocations per external relocation.
 	(link_read_relocs): Likewise.
@@ -3254,7 +5642,7 @@
 	(mips_elf64_be_swap_reloca_in): Likewise.
 	(mips_elf64_be_swap_reloca_out): Likewise.
 	(mips_elf64_size_info): Add entries for new fields.
-	
+
 1999-07-07  Ian Lance Taylor  <ian@zembu.com>
 
 	* elflink.h (elf_bfd_final_link): Assert that section reloc_count
@@ -3278,17 +5666,17 @@
 1999-07-05  Nick Clifton  <nickc@cygnus.com>
 
 	* coffcode.h (coff_set_arch_mach_hook): Recognise arm 5
-	architectures. 
+	architectures.
 	(coff_set_flags): Recognise arm 5 architectures.
 
 	* cpu-arm.c: Add support for strongarm and arm9 cpus.
 	Add support for armv5 architecture.
 
 	* archures.c: Add bfd_mach_arm_5 and bfd_mach_arm_5T.
-	
+
 	* reloc.c: Add new, assembler only, ARM reloc:
 	BFD_RELOC_ARM_ADRL_IMMEDIATE.
-	
+
 	* bfd-in2.h: Regenerate.
 
 1999-07-02  Mark Mitchell  <mark@codesourcery.com>
@@ -3328,7 +5716,7 @@
 	(elf_link_size_reloc_section): Likewise.
 	(elf_bfd_final_link): Use elf_link_size_reloc_section.
 	(elf_link_input_bfd): Use elf_link_output_relocs.
-	
+
 	* elf32-mips.c (_bfd_mips_elf_fake_sections): Use
 	_bfd_elf_init_reloc_shdr to initialize rel_hdr2.
 
@@ -3392,7 +5780,7 @@
 	(mips_elf_finish_dynamic_sections): Correct off-by-one error
 	setting DT_MIPS_UNREFEXTNO.  Adjust setting of DT_MIPS_GOTSYM for
 	change to global_gotsym.  Set DT_MIPS_OPTIONS on IRIX6.
-		
+
 1999-06-30  Ian Lance Taylor  <ian@zembu.com>
 
 	* elf32-mips.c (mips_elf_final_link): Don't set CPIC when doing a
@@ -3441,7 +5829,7 @@
 	(mips_elf_finish_dynamic_symbol): Use MIPS_ELF_STUB_SECTION_NAME.
 	Don't assert the existence of .rld_map on IRIX6.
 	(mips_elf_finish_dynamic_sections): Use MIPS_ELF_STUB_SECTION_NAME.
-		
+
 	* elf32-mips.c (mips_elf_adjust_dynindx): Remove.
 	(mips_elf_size_dynamic_sections): Use _bfd_elf_link_adjust_dynindx
 	instead.
@@ -3474,7 +5862,7 @@
 	(IRIX_COMPAT): Likewise.
 	(SGI_COMPAT): Implement in terms of IRIX_COMPAT.
 	(mips_elf_relocate_section): Fix typo.
-	
+
 1999-06-26  Mumit Khan  <khan@xraylith.wisc.edu>
 
 	* peicode.h (coff_swap_scnhdr_out): Mark non readonly BFD sections
@@ -3605,7 +5993,7 @@
 	* elflink.h (elf_link_remove_section_and_adjust_dynindices):
 	Remove abfd parameter.  Use _bfd_strip_section_from_output.
 	(bfd_elf_size_dynamic_sections): Adjust callers accordingly.
-	
+
 	* elf-bfd.h (_bfd_elf_link_adjust_dynindx): New function.
 	* elflink.c (_bfd_elf_link_adjust_dynindx): Define it.
 	* elflink.h (elf_link_remove_section_and_adjust_dynindices): New
@@ -3902,7 +6290,7 @@
 	no_pipeline_knowledge is false and the binary is from an old
 	toolchain.
 	(elf32_arm_merge_private_data): Generate an error if an attempt is
-	made to linl together big endian and little endian code.
+	made to link together big endian and little endian code.
 	(elf32_arm_post_process_headers): New function:  Initialise the
 	EI_OSABI and EI_ABIVERSION fields of the newly created ELF program
 	header.
diff --git a/bfd/MAINTAINERS b/bfd/MAINTAINERS
new file mode 100644
index 0000000..d59a3bd
--- /dev/null
+++ b/bfd/MAINTAINERS
@@ -0,0 +1 @@
+See ../binutils/MAINTAINERS
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 380b993..435b706 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -29,13 +29,15 @@
 	archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo \
 	format.lo init.lo libbfd.lo opncls.lo reloc.lo \
 	section.lo syms.lo targets.lo hash.lo linker.lo \
-	srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo
+	srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo \
+	dwarf2.lo
 
 BFD_LIBS_CFILES = \
 	archive.c archures.c bfd.c cache.c coffgen.c corefile.c \
 	format.c init.c libbfd.c opncls.c reloc.c \
 	section.c syms.c targets.c hash.c linker.c \
-	srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c
+	srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
+	dwarf2.c
 
 # This list is alphabetized to make it easier to keep in sync
 # with the decls and initializer in archures.c.
@@ -45,6 +47,7 @@
 	cpu-arc.lo \
 	cpu-arm.lo \
 	cpu-avr.lo \
+	cpu-cris.lo \
 	cpu-d10v.lo \
 	cpu-d30v.lo \
 	cpu-fr30.lo \
@@ -57,6 +60,8 @@
 	cpu-i860.lo \
 	cpu-i960.lo \
 	cpu-m32r.lo \
+	cpu-m68hc11.lo \
+	cpu-m68hc12.lo \
 	cpu-m68k.lo \
 	cpu-m88k.lo \
 	cpu-m10200.lo \
@@ -84,6 +89,7 @@
 	cpu-arc.c \
 	cpu-arm.c \
 	cpu-avr.c \
+	cpu-cris.c \
 	cpu-d10v.c \
 	cpu-d30v.c \
 	cpu-fr30.c \
@@ -96,6 +102,8 @@
 	cpu-i860.c \
 	cpu-i960.c \
 	cpu-m32r.c \
+	cpu-m68hc11.c \
+	cpu-m68hc12.c \
 	cpu-m68k.c \
 	cpu-m88k.c \
 	cpu-m10200.c \
@@ -122,6 +130,7 @@
 BFD32_BACKENDS = \
 	aout-adobe.lo \
 	aout-arm.lo \
+	aout-cris.lo \
 	aout-ns32k.lo \
 	aout-sparcle.lo \
 	aout-tic30.lo \
@@ -160,7 +169,6 @@
 	coff-z8k.lo \
 	cofflink.lo \
 	dwarf1.lo \
-	dwarf2.lo \
 	ecoff.lo \
 	ecofflink.lo \
 	efi-app-ia32.lo \
@@ -169,6 +177,7 @@
 	elfarm-oabi.lo \
 	elfarm-nabi.lo \
 	elf32-avr.lo \
+	elf32-cris.lo \
 	elf32-d10v.lo \
 	elf32-d30v.lo \
 	elf32-fr30.lo \
@@ -178,7 +187,10 @@
 	elf32-i386.lo \
 	elf32-i860.lo \
 	elf32-i960.lo \
+	elf32-ia64.lo \
 	elf32-m32r.lo \
+	elf32-m68hc11.lo \
+	elf32-m68hc12.lo \
 	elf32-m68k.lo \
 	elf32-m88k.lo \
 	elf-m10200.lo \
@@ -188,6 +200,7 @@
 	elf32-pj.lo \
 	elf32-ppc.lo \
 	elf32-sh.lo \
+	elf32-sh-lin.lo \
 	elf32-sparc.lo \
 	elf32-v850.lo \
 	elf32.lo \
@@ -255,6 +268,7 @@
 BFD32_BACKENDS_CFILES = \
 	aout-adobe.c \
 	aout-arm.c \
+	aout-cris.c \
 	aout-ns32k.c \
 	aout-sparcle.c \
 	aout-tic30.c \
@@ -293,7 +307,6 @@
 	coff-z8k.c \
 	cofflink.c \
 	dwarf1.c \
-	dwarf2.c \
 	ecoff.c \
 	ecofflink.c \
 	efi-app-ia32.c \
@@ -302,6 +315,7 @@
 	elfarm-oabi.c \
 	elfarm-nabi.c \
 	elf32-avr.c \
+	elf32-cris.c \
 	elf32-d10v.c \
 	elf32-d30v.c \
 	elf32-fr30.c \
@@ -313,6 +327,8 @@
 	elf32-i960.c \
 	elf32-m32r.c \
 	elf32-m68k.c \
+	elf32-m68hc11.c \
+	elf32-m68hc12.c \
 	elf32-m88k.c \
 	elf-m10200.c \
 	elf-m10300.c \
@@ -321,6 +337,7 @@
 	elf32-pj.c \
 	elf32-ppc.c \
 	elf32-sh.c \
+	elf32-sh-lin.c \
 	elf32-sparc.c \
 	elf32-v850.c \
 	elf32.c \
@@ -394,6 +411,7 @@
 	coff64-rs6000.lo \
 	demo64.lo \
 	efi-app-ia64.lo \
+	elf64-x86-64.lo \
 	elf64-alpha.lo \
 	elf64-hppa.lo \
 	elf64-ia64.lo \
@@ -410,6 +428,7 @@
 	coff64-rs6000.c \
 	demo64.c \
 	efi-app-ia64.c \
+	elf64-x86-64.c \
 	elf64-alpha.c \
 	elf64-hppa.c \
 	elf64-ia64.c \
@@ -462,7 +481,7 @@
 	aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
 	elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h elf64-hppa.h \
 	elfcode.h elfcore.h elflink.h freebsd.h genlink.h go32stub.h \
-	hppa_stubs.h libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \
+	libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \
 	libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h \
 	nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h xcoff-target.h
 
@@ -549,6 +568,16 @@
 	sed -e s/NN/64/g < $(srcdir)/elfxx-target.h > elf64-target.new
 	mv -f elf64-target.new elf64-target.h
 
+elf32-ia64.c : elfxx-ia64.c
+	rm -f elf32-ia64.c
+	sed -e s/NN/32/g < $(srcdir)/elfxx-ia64.c > elf32-ia64.new
+	mv -f elf32-ia64.new elf32-ia64.c
+
+elf64-ia64.c : elfxx-ia64.c
+	rm -f elf64-ia64.c
+	sed -e s/NN/64/g < $(srcdir)/elfxx-ia64.c > elf64-ia64.new
+	mv -f elf64-ia64.new elf64-ia64.c
+
 BFD_H_DEPS= $(INCDIR)/ansidecl.h
 LOCAL_H_DEPS= libbfd.h sysdep.h config.h
 $(BFD_LIBS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
@@ -568,8 +597,13 @@
 DEP: dep.sed $(CFILES) $(HFILES) bfd.h
 	rm -f DEP1
 	$(MAKE) MKDEP="$(MKDEP)" DEP1
-	sed -f dep.sed < DEP1 > $@
-	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> $@
+	sed -f dep.sed < DEP1 > DEPA
+	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEPA
+	if grep ' /' DEPA > /dev/null 2> /dev/null; then \
+	  echo 'make DEP failed!'; exit 1; \
+	else \
+	  mv -f DEPA $@; \
+	fi
 
 DEP1: $(CFILES)
 	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
@@ -658,7 +692,7 @@
 MOSTLYCLEANFILES = elf32-target.h elf64-target.h ofiles stamp-ofiles \
 	targmatch.h
 
-CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEP1 DEP2 libbfd.a stamp-lib \
+CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \
 	stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
 
 # We want to rerun configure if config.bfd or configure.host change.
@@ -707,6 +741,7 @@
 cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h
 cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h
 cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h
+cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h
 cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h
 cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h
 cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h
@@ -720,6 +755,8 @@
 cpu-i860.lo: cpu-i860.c $(INCDIR)/filenames.h
 cpu-i960.lo: cpu-i960.c $(INCDIR)/filenames.h
 cpu-m32r.lo: cpu-m32r.c $(INCDIR)/filenames.h
+cpu-m68hc11.lo: cpu-m68hc11.c $(INCDIR)/filenames.h
+cpu-m68hc12.lo: cpu-m68hc12.c $(INCDIR)/filenames.h
 cpu-m68k.lo: cpu-m68k.c $(INCDIR)/filenames.h
 cpu-m88k.lo: cpu-m88k.c $(INCDIR)/filenames.h
 cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h
@@ -747,6 +784,10 @@
   $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aoutx.h \
   $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
   aout-target.h
+aout-cris.lo: aout-cris.c aout32.c aoutx.h $(INCDIR)/filenames.h \
+  $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
+  $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
+  aout-target.h
 aout-ns32k.lo: aout-ns32k.c $(INCDIR)/aout/aout64.h \
   ns32k.h libaout.h $(INCDIR)/bfdlink.h
 aout-sparcle.lo: aout-sparcle.c $(INCDIR)/bfdlink.h \
@@ -898,12 +939,18 @@
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/elf/avr.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
+elf32-cris.lo: elf32-cris.c $(INCDIR)/filenames.h elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(INCDIR)/elf/cris.h $(INCDIR)/elf/reloc-macros.h \
+  elf32-target.h
 elf32-d10v.lo: elf32-d10v.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
-  $(INCDIR)/bfdlink.h elf32-target.h
+  $(INCDIR)/bfdlink.h $(INCDIR)/elf/d10v.h $(INCDIR)/elf/reloc-macros.h \
+  elf32-target.h
 elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
-  $(INCDIR)/bfdlink.h elf32-target.h
+  $(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/reloc-macros.h \
+  elf32-target.h
 elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h $(INCDIR)/elf/reloc-macros.h \
@@ -914,7 +961,7 @@
 elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \
-  libhppa.h elf32-hppa.h elf-hppa.h hppa_stubs.h elf32-target.h
+  libhppa.h elf32-hppa.h elf-hppa.h elf32-target.h
 elf32-i370.lo: elf32-i370.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h elf32-target.h
@@ -924,11 +971,16 @@
   elf32-target.h
 elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
-  $(INCDIR)/bfdlink.h elf32-target.h
+  $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \
+  elf32-target.h
 elf32-i960.lo: elf32-i960.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/elf/i960.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
+elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \
+  $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-m32r.lo: elf32-m32r.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/reloc-macros.h \
@@ -937,6 +989,14 @@
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
+elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \
+  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+  $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \
+  $(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \
+  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+  $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \
+  $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h elf32-target.h
@@ -969,6 +1029,10 @@
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
+elf32-sh-lin.lo: elf32-sh-lin.c elf32-sh.c $(INCDIR)/filenames.h \
+  $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
+  $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
   $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
@@ -999,7 +1063,7 @@
   aoutx.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h libaout.h \
   $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
   $(INCDIR)/aout/ar.h aout-target.h
-som.lo: som.c $(INCDIR)/filenames.h
+som.lo: som.c $(INCDIR)/alloca-conf.h $(INCDIR)/filenames.h
 i386aout.lo: i386aout.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
   libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/stab_gnu.h \
   $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@@ -1192,6 +1256,10 @@
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \
   $(INCDIR)/elf/reloc-macros.h elf64-target.h
+elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(INCDIR)/opcode/i386.h $(INCDIR)/elf/x86-64.h \
+  $(INCDIR)/elf/reloc-macros.h elf64-target.h
 elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h elf64-target.h
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 3192f32..9c41c79 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -75,10 +75,14 @@
 CC_FOR_BUILD = @CC_FOR_BUILD@
 COREFILE = @COREFILE@
 COREFLAG = @COREFLAG@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
 DATADIRNAME = @DATADIRNAME@
 DLLTOOL = @DLLTOOL@
 EXEEXT = @EXEEXT@
 EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+GCJ = @GCJ@
+GCJFLAGS = @GCJFLAGS@
 GMOFILES = @GMOFILES@
 GMSGFMT = @GMSGFMT@
 GT_NO = @GT_NO@
@@ -96,10 +100,12 @@
 MKINSTALLDIRS = @MKINSTALLDIRS@
 MSGFMT = @MSGFMT@
 OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 POFILES = @POFILES@
 POSUB = @POSUB@
 RANLIB = @RANLIB@
+STRIP = @STRIP@
 TDEFINES = @TDEFINES@
 USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
 USE_NLS = @USE_NLS@
@@ -142,14 +148,16 @@
 	archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo \
 	format.lo init.lo libbfd.lo opncls.lo reloc.lo \
 	section.lo syms.lo targets.lo hash.lo linker.lo \
-	srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo
+	srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo \
+	dwarf2.lo
 
 
 BFD_LIBS_CFILES = \
 	archive.c archures.c bfd.c cache.c coffgen.c corefile.c \
 	format.c init.c libbfd.c opncls.c reloc.c \
 	section.c syms.c targets.c hash.c linker.c \
-	srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c
+	srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
+	dwarf2.c
 
 
 # This list is alphabetized to make it easier to keep in sync
@@ -160,6 +168,7 @@
 	cpu-arc.lo \
 	cpu-arm.lo \
 	cpu-avr.lo \
+	cpu-cris.lo \
 	cpu-d10v.lo \
 	cpu-d30v.lo \
 	cpu-fr30.lo \
@@ -172,6 +181,8 @@
 	cpu-i860.lo \
 	cpu-i960.lo \
 	cpu-m32r.lo \
+	cpu-m68hc11.lo \
+	cpu-m68hc12.lo \
 	cpu-m68k.lo \
 	cpu-m88k.lo \
 	cpu-m10200.lo \
@@ -200,6 +211,7 @@
 	cpu-arc.c \
 	cpu-arm.c \
 	cpu-avr.c \
+	cpu-cris.c \
 	cpu-d10v.c \
 	cpu-d30v.c \
 	cpu-fr30.c \
@@ -212,6 +224,8 @@
 	cpu-i860.c \
 	cpu-i960.c \
 	cpu-m32r.c \
+	cpu-m68hc11.c \
+	cpu-m68hc12.c \
 	cpu-m68k.c \
 	cpu-m88k.c \
 	cpu-m10200.c \
@@ -239,6 +253,7 @@
 BFD32_BACKENDS = \
 	aout-adobe.lo \
 	aout-arm.lo \
+	aout-cris.lo \
 	aout-ns32k.lo \
 	aout-sparcle.lo \
 	aout-tic30.lo \
@@ -277,7 +292,6 @@
 	coff-z8k.lo \
 	cofflink.lo \
 	dwarf1.lo \
-	dwarf2.lo \
 	ecoff.lo \
 	ecofflink.lo \
 	efi-app-ia32.lo \
@@ -286,6 +300,7 @@
 	elfarm-oabi.lo \
 	elfarm-nabi.lo \
 	elf32-avr.lo \
+	elf32-cris.lo \
 	elf32-d10v.lo \
 	elf32-d30v.lo \
 	elf32-fr30.lo \
@@ -295,7 +310,10 @@
 	elf32-i386.lo \
 	elf32-i860.lo \
 	elf32-i960.lo \
+	elf32-ia64.lo \
 	elf32-m32r.lo \
+	elf32-m68hc11.lo \
+	elf32-m68hc12.lo \
 	elf32-m68k.lo \
 	elf32-m88k.lo \
 	elf-m10200.lo \
@@ -305,6 +323,7 @@
 	elf32-pj.lo \
 	elf32-ppc.lo \
 	elf32-sh.lo \
+	elf32-sh-lin.lo \
 	elf32-sparc.lo \
 	elf32-v850.lo \
 	elf32.lo \
@@ -373,6 +392,7 @@
 BFD32_BACKENDS_CFILES = \
 	aout-adobe.c \
 	aout-arm.c \
+	aout-cris.c \
 	aout-ns32k.c \
 	aout-sparcle.c \
 	aout-tic30.c \
@@ -411,7 +431,6 @@
 	coff-z8k.c \
 	cofflink.c \
 	dwarf1.c \
-	dwarf2.c \
 	ecoff.c \
 	ecofflink.c \
 	efi-app-ia32.c \
@@ -420,6 +439,7 @@
 	elfarm-oabi.c \
 	elfarm-nabi.c \
 	elf32-avr.c \
+	elf32-cris.c \
 	elf32-d10v.c \
 	elf32-d30v.c \
 	elf32-fr30.c \
@@ -431,6 +451,8 @@
 	elf32-i960.c \
 	elf32-m32r.c \
 	elf32-m68k.c \
+	elf32-m68hc11.c \
+	elf32-m68hc12.c \
 	elf32-m88k.c \
 	elf-m10200.c \
 	elf-m10300.c \
@@ -439,6 +461,7 @@
 	elf32-pj.c \
 	elf32-ppc.c \
 	elf32-sh.c \
+	elf32-sh-lin.c \
 	elf32-sparc.c \
 	elf32-v850.c \
 	elf32.c \
@@ -513,6 +536,7 @@
 	coff64-rs6000.lo \
 	demo64.lo \
 	efi-app-ia64.lo \
+	elf64-x86-64.lo \
 	elf64-alpha.lo \
 	elf64-hppa.lo \
 	elf64-ia64.lo \
@@ -530,6 +554,7 @@
 	coff64-rs6000.c \
 	demo64.c \
 	efi-app-ia64.c \
+	elf64-x86-64.c \
 	elf64-alpha.c \
 	elf64-hppa.c \
 	elf64-ia64.c \
@@ -585,7 +610,7 @@
 	aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
 	elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h elf64-hppa.h \
 	elfcode.h elfcore.h elflink.h freebsd.h genlink.h go32stub.h \
-	hppa_stubs.h libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \
+	libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \
 	libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h \
 	nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h xcoff-target.h
 
@@ -629,7 +654,7 @@
 	targmatch.h
 
 
-CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEP1 DEP2 libbfd.a stamp-lib \
+CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \
 	stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
 
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -650,7 +675,7 @@
 libbfd_la_OBJECTS =  archive.lo archures.lo bfd.lo cache.lo coffgen.lo \
 corefile.lo format.lo init.lo libbfd.lo opncls.lo reloc.lo section.lo \
 syms.lo targets.lo hash.lo linker.lo srec.lo binary.lo tekhex.lo \
-ihex.lo stabs.lo stab-syms.lo
+ihex.lo stabs.lo stab-syms.lo dwarf2.lo
 CFLAGS = @CFLAGS@
 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -663,14 +688,14 @@
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
+TAR = gtar
 GZIP_ENV = --best
 SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES)
 OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS)
 
 all: all-redirect
 .SUFFIXES:
-.SUFFIXES: .S .c .lo .o .s
+.SUFFIXES: .S .c .lo .o .obj .s
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
 	cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile
 
@@ -725,6 +750,11 @@
 .c.o:
 	$(COMPILE) -c $<
 
+# FIXME: We should only use cygpath when building on Windows,
+# and only if it is available.
+.c.obj:
+	$(COMPILE) -c `cygpath -w $<`
+
 .s.o:
 	$(COMPILE) -c $<
 
@@ -733,6 +763,7 @@
 
 mostlyclean-compile:
 	-rm -f *.o core *.core
+	-rm -f *.$(OBJEXT)
 
 clean-compile:
 
@@ -1091,6 +1122,16 @@
 	rm -f elf64-target.h
 	sed -e s/NN/64/g < $(srcdir)/elfxx-target.h > elf64-target.new
 	mv -f elf64-target.new elf64-target.h
+
+elf32-ia64.c : elfxx-ia64.c
+	rm -f elf32-ia64.c
+	sed -e s/NN/32/g < $(srcdir)/elfxx-ia64.c > elf32-ia64.new
+	mv -f elf32-ia64.new elf32-ia64.c
+
+elf64-ia64.c : elfxx-ia64.c
+	rm -f elf64-ia64.c
+	sed -e s/NN/64/g < $(srcdir)/elfxx-ia64.c > elf64-ia64.new
+	mv -f elf64-ia64.new elf64-ia64.c
 $(BFD_LIBS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
 $(BFD_MACHINES): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
 $(BFD_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
@@ -1108,8 +1149,13 @@
 DEP: dep.sed $(CFILES) $(HFILES) bfd.h
 	rm -f DEP1
 	$(MAKE) MKDEP="$(MKDEP)" DEP1
-	sed -f dep.sed < DEP1 > $@
-	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> $@
+	sed -f dep.sed < DEP1 > DEPA
+	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEPA
+	if grep ' /' DEPA > /dev/null 2> /dev/null; then \
+	  echo 'make DEP failed!'; exit 1; \
+	else \
+	  mv -f DEPA $@; \
+	fi
 
 DEP1: $(CFILES)
 	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
@@ -1235,6 +1281,7 @@
 cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h
 cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h
 cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h
+cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h
 cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h
 cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h
 cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h
@@ -1248,6 +1295,8 @@
 cpu-i860.lo: cpu-i860.c $(INCDIR)/filenames.h
 cpu-i960.lo: cpu-i960.c $(INCDIR)/filenames.h
 cpu-m32r.lo: cpu-m32r.c $(INCDIR)/filenames.h
+cpu-m68hc11.lo: cpu-m68hc11.c $(INCDIR)/filenames.h
+cpu-m68hc12.lo: cpu-m68hc12.c $(INCDIR)/filenames.h
 cpu-m68k.lo: cpu-m68k.c $(INCDIR)/filenames.h
 cpu-m88k.lo: cpu-m88k.c $(INCDIR)/filenames.h
 cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h
@@ -1275,6 +1324,10 @@
   $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aoutx.h \
   $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
   aout-target.h
+aout-cris.lo: aout-cris.c aout32.c aoutx.h $(INCDIR)/filenames.h \
+  $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
+  $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
+  aout-target.h
 aout-ns32k.lo: aout-ns32k.c $(INCDIR)/aout/aout64.h \
   ns32k.h libaout.h $(INCDIR)/bfdlink.h
 aout-sparcle.lo: aout-sparcle.c $(INCDIR)/bfdlink.h \
@@ -1426,12 +1479,18 @@
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/elf/avr.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
+elf32-cris.lo: elf32-cris.c $(INCDIR)/filenames.h elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(INCDIR)/elf/cris.h $(INCDIR)/elf/reloc-macros.h \
+  elf32-target.h
 elf32-d10v.lo: elf32-d10v.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
-  $(INCDIR)/bfdlink.h elf32-target.h
+  $(INCDIR)/bfdlink.h $(INCDIR)/elf/d10v.h $(INCDIR)/elf/reloc-macros.h \
+  elf32-target.h
 elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
-  $(INCDIR)/bfdlink.h elf32-target.h
+  $(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/reloc-macros.h \
+  elf32-target.h
 elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h $(INCDIR)/elf/reloc-macros.h \
@@ -1442,7 +1501,7 @@
 elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \
-  libhppa.h elf32-hppa.h elf-hppa.h hppa_stubs.h elf32-target.h
+  libhppa.h elf32-hppa.h elf-hppa.h elf32-target.h
 elf32-i370.lo: elf32-i370.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h elf32-target.h
@@ -1452,11 +1511,16 @@
   elf32-target.h
 elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
-  $(INCDIR)/bfdlink.h elf32-target.h
+  $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \
+  elf32-target.h
 elf32-i960.lo: elf32-i960.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/elf/i960.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
+elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \
+  $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-m32r.lo: elf32-m32r.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/reloc-macros.h \
@@ -1465,6 +1529,14 @@
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
+elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \
+  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+  $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \
+  $(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \
+  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+  $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m68hc11.h \
+  $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h elf32-target.h
@@ -1497,6 +1569,10 @@
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
+elf32-sh-lin.lo: elf32-sh-lin.c elf32-sh.c $(INCDIR)/filenames.h \
+  $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
+  $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
   $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
@@ -1527,7 +1603,7 @@
   aoutx.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h libaout.h \
   $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
   $(INCDIR)/aout/ar.h aout-target.h
-som.lo: som.c $(INCDIR)/filenames.h
+som.lo: som.c $(INCDIR)/alloca-conf.h $(INCDIR)/filenames.h
 i386aout.lo: i386aout.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
   libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/stab_gnu.h \
   $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@@ -1720,6 +1796,10 @@
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \
   $(INCDIR)/elf/reloc-macros.h elf64-target.h
+elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h elf-bfd.h \
+  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+  $(INCDIR)/bfdlink.h $(INCDIR)/opcode/i386.h $(INCDIR)/elf/x86-64.h \
+  $(INCDIR)/elf/reloc-macros.h elf64-target.h
 elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h elf64-target.h
diff --git a/bfd/acinclude.m4 b/bfd/acinclude.m4
index cac26e8..5391294 100644
--- a/bfd/acinclude.m4
+++ b/bfd/acinclude.m4
@@ -74,7 +74,9 @@
 AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
 [AC_MSG_CHECKING([for $1 in sys/procfs.h])
  AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
-   [AC_TRY_COMPILE([#include <sys/procfs.h>],
+   [AC_TRY_COMPILE([
+#define _SYSCALL32
+#include <sys/procfs.h>],
       [$1 avar],
       bfd_cv_have_sys_procfs_type_$1=yes,
       bfd_cv_have_sys_procfs_type_$1=no
@@ -92,7 +94,9 @@
 AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
 [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
  AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
-   [AC_TRY_COMPILE([#include <sys/procfs.h>],
+   [AC_TRY_COMPILE([
+#define _SYSCALL32
+#include <sys/procfs.h>],
       [$1 avar; void* aref = (void*) &avar.$2],
       bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
       bfd_cv_have_sys_procfs_type_member_$1_$2=no
@@ -104,4 +108,18 @@
  AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
 ])
 
+sinclude(../libtool.m4)
+dnl The lines below arrange for aclocal not to bring libtool.m4
+dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
+dnl to add a definition of LIBTOOL to Makefile.in.
+ifelse(yes,no,[
+AC_DEFUN([AM_PROG_LIBTOOL],)
+AC_DEFUN([AM_DISABLE_SHARED],)
+AC_SUBST(LIBTOOL)
+])
 
+sinclude(../gettext.m4)
+ifelse(yes,no,[
+AC_DEFUN([CY_WITH_NLS],)
+AC_SUBST(INTLLIBS)
+])
diff --git a/bfd/aclocal.m4 b/bfd/aclocal.m4
index ca9d432..45cc339 100644
--- a/bfd/aclocal.m4
+++ b/bfd/aclocal.m4
@@ -86,7 +86,9 @@
 AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
 [AC_MSG_CHECKING([for $1 in sys/procfs.h])
  AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
-   [AC_TRY_COMPILE([#include <sys/procfs.h>],
+   [AC_TRY_COMPILE([
+#define _SYSCALL32
+#include <sys/procfs.h>],
       [$1 avar],
       bfd_cv_have_sys_procfs_type_$1=yes,
       bfd_cv_have_sys_procfs_type_$1=no
@@ -104,7 +106,9 @@
 AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
 [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
  AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
-   [AC_TRY_COMPILE([#include <sys/procfs.h>],
+   [AC_TRY_COMPILE([
+#define _SYSCALL32
+#include <sys/procfs.h>],
       [$1 avar; void* aref = (void*) &avar.$2],
       bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
       bfd_cv_have_sys_procfs_type_member_$1_$2=no
@@ -116,7 +120,39 @@
  AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
 ])
 
+sinclude(../libtool.m4)
+dnl The lines below arrange for aclocal not to bring libtool.m4
+dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
+dnl to add a definition of LIBTOOL to Makefile.in.
+ifelse(yes,no,[
+AC_DEFUN([AM_PROG_LIBTOOL],)
+AC_DEFUN([AM_DISABLE_SHARED],)
+AC_SUBST(LIBTOOL)
+])
 
+sinclude(../gettext.m4)
+ifelse(yes,no,[
+AC_DEFUN([CY_WITH_NLS],)
+AC_SUBST(INTLLIBS)
+])
+
+#serial 1
+# This test replaces the one in autoconf.
+# Currently this macro should have the same name as the autoconf macro
+# because gettext's gettext.m4 (distributed in the automake package)
+# still uses it.  Otherwise, the use in gettext.m4 makes autoheader
+# give these diagnostics:
+#   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
+#   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
+
+undefine([AC_ISC_POSIX])
+
+AC_DEFUN(AC_ISC_POSIX,
+  [
+    dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
+    AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
+  ]
+)
 
 # Do all the work for Automake.  This macro actually does too much --
 # some checks are only needed if your package does certain things.
@@ -210,415 +246,6 @@
 fi
 AC_SUBST($1)])
 
-
-# serial 40 AC_PROG_LIBTOOL
-AC_DEFUN(AC_PROG_LIBTOOL,
-[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
-
-# Save cache, so that ltconfig can load it
-AC_CACHE_SAVE
-
-# Actually configure libtool.  ac_aux_dir is where install-sh is found.
-CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
-LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
-DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
-${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
-$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
-|| AC_MSG_ERROR([libtool configure failed])
-
-# Reload cache, that may have been modified by ltconfig
-AC_CACHE_LOAD
-
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
-
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-AC_SUBST(LIBTOOL)dnl
-
-# Redirect the config.log output again, so that the ltconfig log is not
-# clobbered by the next message.
-exec 5>>./config.log
-])
-
-AC_DEFUN(AC_LIBTOOL_SETUP,
-[AC_PREREQ(2.13)dnl
-AC_REQUIRE([AC_ENABLE_SHARED])dnl
-AC_REQUIRE([AC_ENABLE_STATIC])dnl
-AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_REQUIRE([AC_PROG_RANLIB])dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_LD])dnl
-AC_REQUIRE([AC_PROG_NM])dnl
-AC_REQUIRE([AC_PROG_LN_S])dnl
-dnl
-
-case "$target" in
-NONE) lt_target="$host" ;;
-*) lt_target="$target" ;;
-esac
-
-# Check for any special flags to pass to ltconfig.
-libtool_flags="--cache-file=$cache_file"
-test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
-test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
-test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
-test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
-test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
-ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
-[libtool_flags="$libtool_flags --enable-dlopen"])
-ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
-[libtool_flags="$libtool_flags --enable-win32-dll"])
-AC_ARG_ENABLE(libtool-lock,
-  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
-test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
-test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
-
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case "$lt_target" in
-*-*-irix6*)
-  # Find out which ABI we are using.
-  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case "`/usr/bin/file conftest.o`" in
-    *32-bit*)
-      LD="${LD-ld} -32"
-      ;;
-    *N32*)
-      LD="${LD-ld} -n32"
-      ;;
-    *64-bit*)
-      LD="${LD-ld} -64"
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-
-*-*-sco3.2v5*)
-  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
-  SAVE_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -belf"
-  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
-    [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
-    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
-    CFLAGS="$SAVE_CFLAGS"
-  fi
-  ;;
-
-ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
-[*-*-cygwin* | *-*-mingw*)
-  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-  AC_CHECK_TOOL(AS, as, false)
-  AC_CHECK_TOOL(OBJDUMP, objdump, false)
-  ;;
-])
-esac
-])
-
-# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
-AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
-
-# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
-AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
-
-# AC_ENABLE_SHARED - implement the --enable-shared flag
-# Usage: AC_ENABLE_SHARED[(DEFAULT)]
-#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
-#   `yes'.
-AC_DEFUN(AC_ENABLE_SHARED, [dnl
-define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE(shared,
-changequote(<<, >>)dnl
-<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
-changequote([, ])dnl
-[p=${PACKAGE-default}
-case "$enableval" in
-yes) enable_shared=yes ;;
-no) enable_shared=no ;;
-*)
-  enable_shared=no
-  # Look at the argument we got.  We use all the common list separators.
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
-  for pkg in $enableval; do
-    if test "X$pkg" = "X$p"; then
-      enable_shared=yes
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac],
-enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
-])
-
-# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
-AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_SHARED(no)])
-
-# AC_ENABLE_STATIC - implement the --enable-static flag
-# Usage: AC_ENABLE_STATIC[(DEFAULT)]
-#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
-#   `yes'.
-AC_DEFUN(AC_ENABLE_STATIC, [dnl
-define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE(static,
-changequote(<<, >>)dnl
-<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
-changequote([, ])dnl
-[p=${PACKAGE-default}
-case "$enableval" in
-yes) enable_static=yes ;;
-no) enable_static=no ;;
-*)
-  enable_static=no
-  # Look at the argument we got.  We use all the common list separators.
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
-  for pkg in $enableval; do
-    if test "X$pkg" = "X$p"; then
-      enable_static=yes
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac],
-enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
-])
-
-# AC_DISABLE_STATIC - set the default static flag to --disable-static
-AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_STATIC(no)])
-
-
-# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
-# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
-#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
-#   `yes'.
-AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
-define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE(fast-install,
-changequote(<<, >>)dnl
-<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
-changequote([, ])dnl
-[p=${PACKAGE-default}
-case "$enableval" in
-yes) enable_fast_install=yes ;;
-no) enable_fast_install=no ;;
-*)
-  enable_fast_install=no
-  # Look at the argument we got.  We use all the common list separators.
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
-  for pkg in $enableval; do
-    if test "X$pkg" = "X$p"; then
-      enable_fast_install=yes
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac],
-enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
-])
-
-# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
-AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_FAST_INSTALL(no)])
-
-# AC_PROG_LD - find the path to the GNU or non-GNU linker
-AC_DEFUN(AC_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
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-ac_prog=ld
-if test "$ac_cv_prog_gcc" = yes; then
-  # Check if gcc -print-prog-name=ld gives a path.
-  AC_MSG_CHECKING([for ld used by GCC])
-  ac_prog=`($CC -print-prog-name=ld) 2>&5`
-  case "$ac_prog" in
-    # Accept absolute paths.
-changequote(,)dnl
-    [\\/]* | [A-Za-z]:[\\/]*)
-      re_direlt='/[^/][^/]*/\.\./'
-changequote([,])dnl
-      # 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(ac_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
-      ac_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 "$ac_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
-  ac_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$ac_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_PROG_LD_GNU
-])
-
-AC_DEFUN(AC_PROG_LD_GNU,
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_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
-  ac_cv_prog_gnu_ld=yes
-else
-  ac_cv_prog_gnu_ld=no
-fi])
-])
-
-# AC_PROG_NM - find the path to a BSD-compatible name lister
-AC_DEFUN(AC_PROG_NM,
-[AC_MSG_CHECKING([for BSD-compatible nm])
-AC_CACHE_VAL(ac_cv_path_NM,
-[if test -n "$NM"; then
-  # Let the user override the test.
-  ac_cv_path_NM="$NM"
-else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
-  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
-      # Check to see if the nm accepts a BSD-compat flag.
-      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
-      #   nm: unknown option "B" ignored
-      if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
-	ac_cv_path_NM="$ac_dir/nm -B"
-	break
-      elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
-	ac_cv_path_NM="$ac_dir/nm -p"
-	break
-      else
-	ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
-	continue # so that we can try to find one that supports BSD flags
-      fi
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
-fi])
-NM="$ac_cv_path_NM"
-AC_MSG_RESULT([$NM])
-])
-
-# AC_CHECK_LIBM - check for math library
-AC_DEFUN(AC_CHECK_LIBM,
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-LIBM=
-case "$lt_target" in
-*-*-beos* | *-*-cygwin*)
-  # These system don't have libm
-  ;;
-*-ncr-sysv4.3*)
-  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
-  AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
-  ;;
-*)
-  AC_CHECK_LIB(m, main, LIBM="-lm")
-  ;;
-esac
-])
-
-# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
-# the libltdl convenience library, adds --enable-ltdl-convenience to
-# the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
-# is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
-# to be `${top_builddir}/libltdl'.  Make sure you start DIR with
-# '${top_builddir}/' (note the single quotes!) if your package is not
-# flat, and, if you're not using automake, define top_builddir as
-# appropriate in the Makefiles.
-AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-  case "$enable_ltdl_convenience" in
-  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
-  "") enable_ltdl_convenience=yes
-      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
-  esac
-  LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
-  INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
-])
-
-# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
-# the libltdl installable library, and adds --enable-ltdl-install to
-# the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
-# is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
-# to be `${top_builddir}/libltdl'.  Make sure you start DIR with
-# '${top_builddir}/' (note the single quotes!) if your package is not
-# flat, and, if you're not using automake, define top_builddir as
-# appropriate in the Makefiles.
-# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
-AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-  AC_CHECK_LIB(ltdl, main,
-  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
-  [if test x"$enable_ltdl_install" = xno; then
-     AC_MSG_WARN([libltdl not installed, but installation disabled])
-   else
-     enable_ltdl_install=yes
-   fi
-  ])
-  if test x"$enable_ltdl_install" = x"yes"; then
-    ac_configure_args="$ac_configure_args --enable-ltdl-install"
-    LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
-    INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
-  else
-    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
-    LIBLTDL="-lltdl"
-    INCLTDL=
-  fi
-])
-
-dnl old names
-AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
-AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
-AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
-AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
-AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
-AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
-AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
-
-dnl This is just to silence aclocal about the macro not being used
-ifelse([AC_DISABLE_FAST_INSTALL])dnl
-
 # Like AC_CONFIG_HEADER, but automatically create stamp file.
 
 AC_DEFUN(AM_CONFIG_HEADER,
@@ -675,348 +302,3 @@
   $1_FALSE=
 fi])
 
-# 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, 1, [Define to 1 if NLS is requested])
-      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, 1,
-			[Define as 1 if you have gettext and don't want to use GNU 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, 1, [Define if you have the stpcpy function])
-   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, 1,
-		[Define if your locale.h file contains LC_MESSAGES.])
-    fi
-  fi])
-
diff --git a/bfd/aix386-core.c b/bfd/aix386-core.c
index fb67b17..da86b58 100644
--- a/bfd/aix386-core.c
+++ b/bfd/aix386-core.c
@@ -1,7 +1,7 @@
 /* BFD back-end for AIX on PS/2 core files.
    This was based on trad-core.c, which was written by John Gilmore of
         Cygnus Support.
-   Copyright 1988, 89, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1988, 89, 91, 92, 93, 94, 95, 96, 97, 98, 2000
    Free Software Foundation, Inc.
    Written by Minh Tran-Le <TRANLE@INTELLICORP.COM>.
    Converted to back end form by Ian Lance Taylor <ian@cygnus.com>.
@@ -32,13 +32,13 @@
 #include <signal.h>
 
 #if defined (_AIX) && defined (_I386)
-#define NOCHECKS		/* this is for coredump.h */
-#define _h_USER			/* avoid including user.h from coredump.h */
+#define NOCHECKS		/* This is for coredump.h.  */
+#define _h_USER			/* Avoid including user.h from coredump.h.  */
 #include <uinfo.h>
 #include <sys/i386/coredump.h>
 #endif /* _AIX && _I386 */
 
-/* maybe this could work on some other i386 but I have not tried it
+/* Maybe this could work on some other i386 but I have not tried it
  * mtranle@paris - Tue Sep 24 12:49:35 1991
  */
 
@@ -46,7 +46,7 @@
 # define COR_MAGIC "core"
 #endif
 
-/* need this cast because ptr is really void * */
+/* Need this cast because ptr is really void *.  */
 #define core_hdr(bfd) \
     (((bfd->tdata.trad_core_data))->hdr)
 #define core_section(bfd,n) \
@@ -56,7 +56,7 @@
 #define core_reg2sec(bfd) \
     (((bfd)->tdata.trad_core_data)->reg2_section)
 
-/* These are stored in the bfd's tdata */
+/* These are stored in the bfd's tdata.  */
 struct trad_core_struct {
   struct corehdr *hdr;		/* core file header */
   asection *reg_section;
@@ -70,7 +70,7 @@
 aix386_core_file_p (abfd)
      bfd *abfd;
 {
-  int i,n;
+  int i, n;
   unsigned char longbuf[4];	/* Raw bytes of various header fields */
   int core_size = sizeof (struct corehdr);
   struct corehdr *core;
@@ -79,18 +79,20 @@
     struct corehdr internal_core;
   } *mergem;
 
-  if (bfd_read ((PTR)longbuf, 1, sizeof (longbuf), abfd) != sizeof (longbuf))
+  if (bfd_read ((PTR) longbuf, 1, sizeof (longbuf), abfd) != sizeof (longbuf))
     {
       if (bfd_get_error () != bfd_error_system_call)
 	bfd_set_error (bfd_error_wrong_format);
       return 0;
     }
 
-  if (strncmp(longbuf,COR_MAGIC,4)) return 0;
+  if (strncmp (longbuf, COR_MAGIC, 4))
+    return 0;
 
-  if (bfd_seek (abfd, 0L, false) < 0) return 0;
+  if (bfd_seek (abfd, 0L, false) < 0)
+    return 0;
 
-  mergem = (struct mergem *)bfd_zalloc (abfd, sizeof (struct mergem));
+  mergem = (struct mergem *) bfd_zalloc (abfd, sizeof (struct mergem));
   if (mergem == NULL)
     return 0;
 
@@ -100,45 +102,45 @@
     {
       if (bfd_get_error () != bfd_error_system_call)
 	bfd_set_error (bfd_error_wrong_format);
-      bfd_release (abfd, (char *)mergem);
+      bfd_release (abfd, (char *) mergem);
       return 0;
     }
 
   set_tdata (abfd, &mergem->coredata);
   core_hdr (abfd) = core;
 
-  /* create the sections.  This is raunchy, but bfd_close wants to reclaim
-     them */
+  /* Create the sections.  This is raunchy, but bfd_close wants to
+     reclaim them.  */
   core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
   if (core_regsec (abfd) == NULL)
     {
     loser:
-      bfd_release (abfd, (char *)mergem);
+      bfd_release (abfd, (char *) mergem);
       return 0;
     }
   core_reg2sec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
   if (core_reg2sec (abfd) == NULL)
     {
     loser1:
-     bfd_release (abfd, core_regsec (abfd));
+      bfd_release (abfd, core_regsec (abfd));
       goto loser;
     }
 
-  for (i=0, n=0 ; (i < MAX_CORE_SEGS) && (core->cd_segs[i].cs_type) ; i++)
+  for (i = 0, n = 0; (i < MAX_CORE_SEGS) && (core->cd_segs[i].cs_type); i++)
     {
       if (core->cd_segs[i].cs_offset == 0)
 	continue;
-      core_section (abfd,n) =
+      core_section (abfd, n) =
 	(asection *) bfd_zalloc (abfd, sizeof (asection));
-      if (core_section (abfd,n) == NULL)
+      if (core_section (abfd, n) == NULL)
 	{
 	  int j;
 	  if (n > 0)
 	    {
-	      for (j=0; j < n; j++)
-		bfd_release (abfd, core_section(abfd, j));
+	      for (j = 0; j < n; j++)
+		bfd_release (abfd, core_section (abfd, j));
 	    }
-	  bfd_release (abfd, (char *)mergem);
+	  bfd_release (abfd, (char *) mergem);
 	  goto loser1;
 	}
 
@@ -177,7 +179,7 @@
       core_section (abfd, n)->alignment_power = 2;
       core_section (abfd, n)->next      = NULL;
       if (n > 0)
-	core_section (abfd, (n-1))->next = core_section (abfd, n);
+	core_section (abfd, (n - 1))->next = core_section (abfd, n);
 
       abfd->section_count = ++n;
     }
@@ -188,18 +190,19 @@
   core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
   core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS;
 
-  core_regsec (abfd)->_raw_size = sizeof(core->cd_regs);
-  core_reg2sec (abfd)->_raw_size = sizeof(core->cd_fpregs);
+  core_regsec (abfd)->_raw_size = sizeof (core->cd_regs);
+  core_reg2sec (abfd)->_raw_size = sizeof (core->cd_fpregs);
 
   core_regsec (abfd)->vma = -1;
   core_reg2sec (abfd)->vma = -1;
 
-  /* We'll access the regs afresh in the core file, like any section: */
-  core_regsec (abfd)->filepos = (file_ptr)offsetof(struct corehdr,cd_regs[0]);
-  core_reg2sec (abfd)->filepos = (file_ptr)offsetof(struct corehdr,
-						    cd_fpregs);
+  /* We'll access the regs afresh in the core file, like any section.  */
+  core_regsec (abfd)->filepos =
+    (file_ptr) offsetof (struct corehdr, cd_regs[0]);
+  core_reg2sec (abfd)->filepos =
+    (file_ptr) offsetof (struct corehdr, cd_fpregs);
 
-  /* add the 2 reg fake sections to abfd */
+  /* Add the 2 reg fake sections to abfd.  */
   abfd->section_count += 2;
   abfd->sections = core_regsec (abfd);
   core_regsec (abfd)->next = core_reg2sec (abfd);
@@ -227,59 +230,61 @@
      bfd *core_bfd;
      bfd *exec_bfd;
 {
-  return true;			/* FIXME, We have no way of telling at this
-				   point */
+  /* FIXME: We have no way of telling at this point.  */
+  return true;
 }
 
 /* If somebody calls any byte-swapping routines, shoot them.  */
+
 static void
-swap_abort()
+swap_abort ()
 {
-  abort(); /* This way doesn't require any declaration for ANSI to fuck up */
+  /* This way doesn't require any declaration for ANSI to fuck up.  */
+  abort ();
 }
+
 #define	NO_GET	((PROTO(bfd_vma, (*), (       const bfd_byte *))) swap_abort )
 #define NO_GETS ((PROTO(bfd_signed_vma, (*), (const bfd_byte *))) swap_abort )
 #define	NO_PUT	((PROTO(void,        (*), (bfd_vma, bfd_byte *))) swap_abort )
 
-const bfd_target aix386_core_vec =
-  {
-    "aix386-core",
-    bfd_target_unknown_flavour,
-    BFD_ENDIAN_BIG,		/* target byte order */
-    BFD_ENDIANG_BIG,		/* target headers byte order */
+const bfd_target aix386_core_vec = {
+  "aix386-core",
+  bfd_target_unknown_flavour,
+  BFD_ENDIAN_BIG,		/* target byte order */
+  BFD_ENDIANG_BIG,		/* target headers byte order */
   (HAS_RELOC | EXEC_P |		/* object flags */
    HAS_LINENO | HAS_DEBUG |
    HAS_SYMS | HAS_LOCALS | WP_TEXT),
 
   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
-    0,						/* leading underscore */
-    ' ',					/* ar_pad_char */
-    16,						/* ar_max_namelen */
-    NO_GET, NO_GETS, NO_PUT,
-    NO_GET, NO_GETS, NO_PUT,
-    NO_GET, NO_GETS, NO_PUT, /* data */
-    NO_GET, NO_GETS, NO_PUT,
-    NO_GET, NO_GETS, NO_PUT,
-    NO_GET, NO_GETS, NO_PUT, /* hdrs */
+  0,				/* leading underscore */
+  ' ',				/* ar_pad_char */
+  16,				/* ar_max_namelen */
+  NO_GET, NO_GETS, NO_PUT,
+  NO_GET, NO_GETS, NO_PUT,
+  NO_GET, NO_GETS, NO_PUT,	/* data */
+  NO_GET, NO_GETS, NO_PUT,
+  NO_GET, NO_GETS, NO_PUT,
+  NO_GET, NO_GETS, NO_PUT,	/* hdrs */
 
-    {_bfd_dummy_target, _bfd_dummy_target,
-     _bfd_dummy_target, aix386_core_file_p},
-    {bfd_false, bfd_false,	/* bfd_create_object */
-     bfd_false, bfd_false},
-    {bfd_false, bfd_false,	/* bfd_write_contents */
-     bfd_false, bfd_false},
+  {_bfd_dummy_target, _bfd_dummy_target,
+   _bfd_dummy_target, aix386_core_file_p},
+  {bfd_false, bfd_false,	/* bfd_create_object */
+   bfd_false, bfd_false},
+  {bfd_false, bfd_false,	/* bfd_write_contents */
+   bfd_false, bfd_false},
 
-     BFD_JUMP_TABLE_GENERIC (_bfd_generic),
-     BFD_JUMP_TABLE_COPY (_bfd_generic),
-     BFD_JUMP_TABLE_CORE (aix386),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
-     BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
-     BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
-     BFD_JUMP_TABLE_WRITE (_bfd_generic),
-     BFD_JUMP_TABLE_LINK (_bfd_nolink),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+  BFD_JUMP_TABLE_GENERIC (_bfd_generic),
+  BFD_JUMP_TABLE_COPY (_bfd_generic),
+  BFD_JUMP_TABLE_CORE (aix386),
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
+  BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
+  BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
+  BFD_JUMP_TABLE_WRITE (_bfd_generic),
+  BFD_JUMP_TABLE_LINK (_bfd_nolink),
+  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-    NULL,
-    
-    (PTR) 0
+  NULL,
+
+  (PTR) 0
 };
diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c
index 8216c7e..a23b57d 100644
--- a/bfd/aout-adobe.c
+++ b/bfd/aout-adobe.c
@@ -1,5 +1,5 @@
 /* BFD back-end for a.out.adobe binaries.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 1999
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 99, 2000
    Free Software Foundation, Inc.
    Written by Cygnus Support.  Based on bout.c.
 
@@ -28,7 +28,8 @@
 #include "aout/stab_gnu.h"
 #include "libaout.h"		/* BFD a.out internal data structures */
 
-extern const bfd_target a_out_adobe_vec;		/* Forward decl */
+/* Forward decl.  */
+extern const bfd_target a_out_adobe_vec;
 
 static const bfd_target *aout_adobe_callback PARAMS ((bfd *));
 
@@ -42,14 +43,14 @@
 void aout_adobe_swap_exec_header_in
   PARAMS ((bfd *abfd, struct external_exec *raw_bytes,
 	   struct internal_exec *execp));
-	 
+
 void
 aout_adobe_swap_exec_header_in (abfd, raw_bytes, execp)
      bfd *abfd;
      struct external_exec *raw_bytes;
      struct internal_exec *execp;
 {
-  struct external_exec *bytes = (struct external_exec *)raw_bytes;
+  struct external_exec *bytes = (struct external_exec *) raw_bytes;
 
   /* Now fill in fields in the execp, from the bytes in the raw data.  */
   execp->a_info   = bfd_h_get_32 (abfd, bytes->e_info);
@@ -75,9 +76,10 @@
      struct internal_exec *execp;
      struct external_exec *raw_bytes;
 {
-  struct external_exec *bytes = (struct external_exec *)raw_bytes;
+  struct external_exec *bytes = (struct external_exec *) raw_bytes;
 
-  /* Now fill in fields in the raw data, from the fields in the exec struct. */
+  /* Now fill in fields in the raw data, from the fields in the exec
+     struct.  */
   bfd_h_put_32 (abfd, execp->a_info  , bytes->e_info);
   PUT_WORD (abfd, execp->a_text  , bytes->e_text);
   PUT_WORD (abfd, execp->a_data  , bytes->e_data);
@@ -88,7 +90,6 @@
   PUT_WORD (abfd, execp->a_drsize, bytes->e_drsize);
 }
 
-
 static const bfd_target *
 aout_adobe_object_p (abfd)
      bfd *abfd;
@@ -98,11 +99,12 @@
   char *targ;
 
   if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
-      != EXEC_BYTES_SIZE) {
-    if (bfd_get_error () != bfd_error_system_call)
-      bfd_set_error (bfd_error_wrong_format);
-    return 0;
-  }
+      != EXEC_BYTES_SIZE)
+    {
+      if (bfd_get_error () != bfd_error_system_call)
+	bfd_set_error (bfd_error_wrong_format);
+      return 0;
+    }
 
   anexec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info);
 
@@ -112,22 +114,23 @@
      If the environment variable GNUTARGET is set to "a.out.adobe", we will
      take just about any a.out file as an Adobe a.out file.  FIXME!  */
 
-  if (N_BADMAG (anexec)) {
-    targ = getenv ("GNUTARGET");
-    if (targ && !strcmp (targ, a_out_adobe_vec.name))
-      ;		/* Just continue anyway, if specifically set to this format */
-    else
-      {
-	bfd_set_error (bfd_error_wrong_format);
-	return 0;
-      }
-  }
+  if (N_BADMAG (anexec))
+    {
+      targ = getenv ("GNUTARGET");
+      if (targ && !strcmp (targ, a_out_adobe_vec.name))
+	/* Just continue anyway, if specifically set to this format.  */
+	;
+      else
+	{
+	  bfd_set_error (bfd_error_wrong_format);
+	  return 0;
+	}
+    }
 
   aout_adobe_swap_exec_header_in (abfd, &exec_bytes, &anexec);
   return aout_32_some_aout_object_p (abfd, &anexec, aout_adobe_callback);
 }
 
-
 /* Finish up the opening of a b.out file for reading.  Fill in all the
    fields that are not handled by common code.  */
 
@@ -145,7 +148,7 @@
   flagword flags;
 
   /* Architecture and machine type -- unknown in this format.  */
-  bfd_set_arch_mach(abfd, bfd_arch_unknown, 0);
+  bfd_set_arch_mach (abfd, bfd_arch_unknown, 0);
 
   /* The positions of the string table and symbol table.  */
   obj_str_filepos (abfd) = N_STROFF (*execp);
@@ -153,97 +156,106 @@
 
   /* Suck up the section information from the file, one section at a time.  */
 
-  for (;;) {
-    if (bfd_read ((PTR) ext, 1, sizeof (*ext), abfd) != sizeof (*ext)) {
-      if (bfd_get_error () != bfd_error_system_call)
-	bfd_set_error (bfd_error_wrong_format);
-      return 0;
+  for (;;)
+    {
+      if (bfd_read ((PTR) ext, 1, sizeof (*ext), abfd) != sizeof (*ext))
+	{
+	  if (bfd_get_error () != bfd_error_system_call)
+	    bfd_set_error (bfd_error_wrong_format);
+	  return 0;
+	}
+      switch (ext->e_type[0])
+	{
+	case N_TEXT:
+	  section_name = ".text";
+	  flags = SEC_CODE | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS;
+	  break;
+
+	case N_DATA:
+	  section_name = ".data";
+	  flags = SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS;
+	  break;
+
+	case N_BSS:
+	  section_name = ".bss";
+	  flags = SEC_DATA | SEC_HAS_CONTENTS;
+	  break;
+
+	case 0:
+	  goto no_more_sections;
+
+	default:
+	  (*_bfd_error_handler)
+	    (_("%s: Unknown section type in a.out.adobe file: %x\n"),
+	     bfd_get_filename (abfd), ext->e_type[0]);
+	  goto no_more_sections;
+	}
+
+      /* First one is called ".text" or whatever; subsequent ones are
+	 ".text1", ".text2", ...  */
+
+      bfd_set_error (bfd_error_no_error);
+      sect = bfd_make_section (abfd, section_name);
+      trynum = 0;
+      while (!sect)
+	{
+	  if (bfd_get_error () != bfd_error_no_error)
+	    /* Some other error -- slide into the sunset.  */
+	    return 0;
+	  sprintf (try_again, "%s%d", section_name, ++trynum);
+	  sect = bfd_make_section (abfd, try_again);
+	}
+
+      /* Fix the name, if it is a sprintf'd name.  */
+      if (sect->name == try_again)
+	{
+	  newname = (char *) bfd_zalloc (abfd, strlen (sect->name));
+	  if (newname == NULL)
+	    return 0;
+	  strcpy (newname, sect->name);
+	  sect->name = newname;
+	}
+
+      /* Now set the section's attributes.  */
+      bfd_set_section_flags (abfd, sect, flags);
+      /* Assumed big-endian.  */
+      sect->_raw_size = ((ext->e_size[0] << 8)
+			 | ext->e_size[1] << 8)
+	| ext->e_size[2];
+      sect->_cooked_size = sect->_raw_size;
+      sect->vma = bfd_h_get_32 (abfd, ext->e_virtbase);
+      sect->filepos = bfd_h_get_32 (abfd, ext->e_filebase);
+      /* FIXME XXX alignment?  */
+
+      /* Set relocation information for first section of each type.  */
+      if (trynum == 0)
+	switch (ext->e_type[0])
+	  {
+	  case N_TEXT:
+	    sect->rel_filepos = N_TRELOFF (*execp);
+	    sect->reloc_count = execp->a_trsize;
+	    break;
+
+	  case N_DATA:
+	    sect->rel_filepos = N_DRELOFF (*execp);
+	    sect->reloc_count = execp->a_drsize;
+	    break;
+	  }
     }
-    switch (ext->e_type[0]) {
-    case N_TEXT:
-      section_name = ".text";
-      flags = SEC_CODE | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS;
-      break;
+ no_more_sections:
 
-    case N_DATA:
-      section_name = ".data";
-      flags = SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS;
-      break;
-
-    case N_BSS:
-      section_name = ".bss";
-      flags = SEC_DATA | SEC_HAS_CONTENTS;
-      break;
-
-    case 0:
-      goto no_more_sections;
-
-    default:
-      (*_bfd_error_handler)
-	(_("%s: Unknown section type in a.out.adobe file: %x\n"), 
-	 bfd_get_filename (abfd), ext->e_type[0]);
-      goto no_more_sections;
-    }
-
-    /* First one is called ".text" or whatever; subsequent ones are
-       ".text1", ".text2", ... */
-
-    bfd_set_error (bfd_error_no_error);
-    sect = bfd_make_section (abfd, section_name);
-    trynum = 0;
-    while (!sect) {
-      if (bfd_get_error () != bfd_error_no_error)
-	return 0;	/* Some other error -- slide into the sunset */
-      sprintf (try_again, "%s%d", section_name, ++trynum);
-      sect = bfd_make_section (abfd, try_again);
-    }
-
-    /* Fix the name, if it is a sprintf'd name.  */
-    if (sect->name == try_again) {
-      newname = (char *) bfd_zalloc(abfd, strlen (sect->name));
-      if (newname == NULL)
-	return 0;
-      strcpy (newname, sect->name);
-      sect->name = newname;
-    }
-
-    /* Now set the section's attributes.  */
-    bfd_set_section_flags (abfd, sect, flags);
-    sect->_raw_size = ((ext->e_size[0] << 8)	/* Assumed big-endian */
-		      | ext->e_size[1] << 8)
-		      | ext->e_size[2];
-    sect->_cooked_size = sect->_raw_size;
-    sect->vma = bfd_h_get_32 (abfd, ext->e_virtbase);
-    sect->filepos = bfd_h_get_32 (abfd, ext->e_filebase);
-    /* FIXME XXX alignment? */
-
-    /* Set relocation information for first section of each type.  */
-    if (trynum == 0) switch (ext->e_type[0]) {
-    case N_TEXT:
-      sect->rel_filepos = N_TRELOFF (*execp);
-      sect->reloc_count = execp->a_trsize;
-      break;
-
-    case N_DATA:
-      sect->rel_filepos = N_DRELOFF (*execp);
-      sect->reloc_count = execp->a_drsize;
-      break;
-    }
-  }
-no_more_sections:  
-
-  adata(abfd).reloc_entry_size = sizeof (struct reloc_std_external);
-  adata(abfd).symbol_entry_size = sizeof (struct external_nlist);
-  adata(abfd).page_size = 1; /* Not applicable. */
-  adata(abfd).segment_size = 1; /* Not applicable. */
-  adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
+  adata (abfd).reloc_entry_size = sizeof (struct reloc_std_external);
+  adata (abfd).symbol_entry_size = sizeof (struct external_nlist);
+  adata (abfd).page_size = 1; /* Not applicable.  */
+  adata (abfd).segment_size = 1; /* Not applicable.  */
+  adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
 
   return abfd->xvec;
 }
 
 struct bout_data_struct {
-    struct aoutdata a;
-    struct internal_exec e;
+  struct aoutdata a;
+  struct internal_exec e;
 };
 
 static boolean
@@ -254,32 +266,31 @@
 
   rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, sizeof (struct bout_data_struct));
   if (rawptr == NULL)
-      return false;
+    return false;
 
   abfd->tdata.bout_data = rawptr;
   exec_hdr (abfd) = &rawptr->e;
 
-  adata(abfd).reloc_entry_size = sizeof (struct reloc_std_external);
-  adata(abfd).symbol_entry_size = sizeof (struct external_nlist);
-  adata(abfd).page_size = 1; /* Not applicable. */
-  adata(abfd).segment_size = 1; /* Not applicable. */
-  adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
+  adata (abfd).reloc_entry_size = sizeof (struct reloc_std_external);
+  adata (abfd).symbol_entry_size = sizeof (struct external_nlist);
+  adata (abfd).page_size = 1; /* Not applicable.  */
+  adata (abfd).segment_size = 1; /* Not applicable.  */
+  adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
 
   return true;
 }
 
-
 static boolean
 aout_adobe_write_object_contents (abfd)
      bfd *abfd;
 {
   struct external_exec swapped_hdr;
-  static struct external_segdesc sentinel[1];	/* Initialized to zero */
+  static struct external_segdesc sentinel[1];	/* Initialized to zero.  */
   asection *sect;
 
   exec_hdr (abfd)->a_info = ZMAGIC;
 
-  /* Calculate text size as total of text sections, etc. */
+  /* Calculate text size as total of text sections, etc.  */
 
   exec_hdr (abfd)->a_text = 0;
   exec_hdr (abfd)->a_data = 0;
@@ -287,22 +298,28 @@
   exec_hdr (abfd)->a_trsize = 0;
   exec_hdr (abfd)->a_drsize = 0;
 
-  for (sect = abfd->sections; sect; sect = sect->next) {
-    if (sect->flags & SEC_CODE)	{
-      exec_hdr (abfd)->a_text += sect->_raw_size;
-      exec_hdr (abfd)->a_trsize += sect->reloc_count *
-                                   sizeof (struct reloc_std_external);
-    } else if (sect->flags & SEC_DATA)	{
-      exec_hdr (abfd)->a_data += sect->_raw_size;
-      exec_hdr (abfd)->a_drsize += sect->reloc_count *
-                                   sizeof (struct reloc_std_external);
-    } else if (sect->flags & SEC_ALLOC && !(sect->flags & SEC_LOAD)) {
-      exec_hdr (abfd)->a_bss  += sect->_raw_size;
+  for (sect = abfd->sections; sect; sect = sect->next)
+    {
+      if (sect->flags & SEC_CODE)
+	{
+	  exec_hdr (abfd)->a_text += sect->_raw_size;
+	  exec_hdr (abfd)->a_trsize += sect->reloc_count *
+	    sizeof (struct reloc_std_external);
+	}
+      else if (sect->flags & SEC_DATA)
+	{
+	  exec_hdr (abfd)->a_data += sect->_raw_size;
+	  exec_hdr (abfd)->a_drsize += sect->reloc_count *
+	    sizeof (struct reloc_std_external);
+	}
+      else if (sect->flags & SEC_ALLOC && !(sect->flags & SEC_LOAD))
+	{
+	  exec_hdr (abfd)->a_bss += sect->_raw_size;
+	}
     }
-  }
 
   exec_hdr (abfd)->a_syms = bfd_get_symcount (abfd)
-    				* sizeof (struct external_nlist);
+    * sizeof (struct external_nlist);
   exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd);
 
   aout_adobe_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr);
@@ -315,58 +332,68 @@
   /* Now write out the section information.  Text first, data next, rest
      afterward.  */
 
-  for (sect = abfd->sections; sect; sect = sect->next) {
-    if (sect->flags & SEC_CODE)	{
-      aout_adobe_write_section (abfd, sect);
+  for (sect = abfd->sections; sect; sect = sect->next)
+    {
+      if (sect->flags & SEC_CODE)
+	{
+	  aout_adobe_write_section (abfd, sect);
+	}
     }
-  }
-  for (sect = abfd->sections; sect; sect = sect->next) {
-    if (sect->flags & SEC_DATA)	{
-      aout_adobe_write_section (abfd, sect);
+  for (sect = abfd->sections; sect; sect = sect->next)
+    {
+      if (sect->flags & SEC_DATA)
+	{
+	  aout_adobe_write_section (abfd, sect);
+	}
     }
-  }
-  for (sect = abfd->sections; sect; sect = sect->next) {
-    if (!(sect->flags & (SEC_CODE|SEC_DATA))) {
-      aout_adobe_write_section (abfd, sect);
+  for (sect = abfd->sections; sect; sect = sect->next)
+    {
+      if (!(sect->flags & (SEC_CODE | SEC_DATA)))
+	{
+	  aout_adobe_write_section (abfd, sect);
+	}
     }
-  }
 
   /* Write final `sentinel` section header (with type of 0).  */
   if (bfd_write ((PTR) sentinel, 1, sizeof (*sentinel), abfd)
       != sizeof (*sentinel))
     return false;
 
-  /* Now write out reloc info, followed by syms and strings */
-  if (bfd_get_symcount (abfd) != 0) 
+  /* Now write out reloc info, followed by syms and strings.  */
+  if (bfd_get_symcount (abfd) != 0)
     {
-      if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*exec_hdr(abfd))), SEEK_SET)
+      if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (*exec_hdr (abfd))), SEEK_SET)
 	  != 0)
 	return false;
 
       if (! aout_32_write_syms (abfd))
 	return false;
 
-      if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*exec_hdr(abfd))), SEEK_SET)
+      if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*exec_hdr (abfd))), SEEK_SET)
 	  != 0)
 	return false;
 
-      for (sect = abfd->sections; sect; sect = sect->next) {
-        if (sect->flags & SEC_CODE)	{
-          if (!aout_32_squirt_out_relocs (abfd, sect))
-            return false;
-        }
-      }
+      for (sect = abfd->sections; sect; sect = sect->next)
+	{
+	  if (sect->flags & SEC_CODE)
+	    {
+	      if (!aout_32_squirt_out_relocs (abfd, sect))
+		return false;
+	    }
+	}
 
-      if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*exec_hdr(abfd))), SEEK_SET)
+      if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*exec_hdr (abfd))), SEEK_SET)
 	  != 0)
 	return false;
 
-      for (sect = abfd->sections; sect; sect = sect->next) {
-        if (sect->flags & SEC_DATA)	{
-          if (!aout_32_squirt_out_relocs (abfd, sect))
-            return false;
-        }
-      }
+      for (sect = abfd->sections; sect; sect = sect->next)
+	{
+	  if (sect->flags & SEC_DATA)
+	    {
+	      if (!aout_32_squirt_out_relocs (abfd, sect))
+		return false;
+	    }
+	}
     }
   return true;
 }
@@ -390,46 +417,55 @@
   file_ptr section_start;
   sec_ptr sect;
 
-  if (abfd->output_has_begun == false) { /* set by bfd.c handler */
+  /* Set by bfd.c handler.  */
+  if (abfd->output_has_begun == false)
+    {
+      /* Assign file offsets to sections.  Text sections are first, and
+	 are contiguous.  Then data sections.  Everything else at the end.  */
 
-    /* Assign file offsets to sections.  Text sections are first, and
-       are contiguous.  Then data sections.  Everything else at the end.  */
+      section_start = N_TXTOFF (ignore<-->me);
 
-    section_start = N_TXTOFF (ignore<-->me);
+      for (sect = abfd->sections; sect; sect = sect->next)
+	{
+	  if (sect->flags & SEC_CODE)
+	    {
+	      sect->filepos = section_start;
+	      /* FIXME:  Round to alignment.  */
+	      section_start += sect->_raw_size;
+	    }
+	}
 
-    for (sect = abfd->sections; sect; sect = sect->next) {
-      if (sect->flags & SEC_CODE)	{
-        sect->filepos = section_start;
-	/* FIXME:  Round to alignment */
-	section_start += sect->_raw_size;
-      }
+      for (sect = abfd->sections; sect; sect = sect->next)
+	{
+	  if (sect->flags & SEC_DATA)
+	    {
+	      sect->filepos = section_start;
+	      /* FIXME:  Round to alignment.  */
+	      section_start += sect->_raw_size;
+	    }
+	}
+
+      for (sect = abfd->sections; sect; sect = sect->next)
+	{
+	  if (sect->flags & SEC_HAS_CONTENTS &&
+	      !(sect->flags & (SEC_CODE | SEC_DATA)))
+	    {
+	      sect->filepos = section_start;
+	      /* FIXME:  Round to alignment.  */
+	      section_start += sect->_raw_size;
+	    }
+	}
     }
 
-    for (sect = abfd->sections; sect; sect = sect->next) {
-      if (sect->flags & SEC_DATA)	{
-        sect->filepos = section_start;
-	/* FIXME:  Round to alignment */
-	section_start += sect->_raw_size;
-      }
-    }
-
-    for (sect = abfd->sections; sect; sect = sect->next) {
-      if (sect->flags & SEC_HAS_CONTENTS &&
-	  !(sect->flags & (SEC_CODE|SEC_DATA)))	{
-        sect->filepos = section_start;
-	/* FIXME:  Round to alignment */
-	section_start += sect->_raw_size;
-      }
-    }
-  }
-
-  /* regardless, once we know what we're doing, we might as well get going */
+  /* Regardless, once we know what we're doing, we might as well get
+     going.  */
   if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0)
     return false;
 
-  if (count != 0) {
-    return (bfd_write ((PTR)location, 1, count, abfd) == count) ?true:false;
-  }
+  if (count != 0)
+    {
+      return (bfd_write ((PTR) location, 1, count, abfd) == count) ? true : false;
+    }
   return true;
 }
 
@@ -449,17 +485,14 @@
   return false;
 }
 
-static int 
+static int
 aout_adobe_sizeof_headers (ignore_abfd, ignore)
      bfd *ignore_abfd ATTRIBUTE_UNUSED;
      boolean ignore ATTRIBUTE_UNUSED;
 {
-  return sizeof(struct internal_exec);
+  return sizeof (struct internal_exec);
 }
 
-
-
-
 /* Build the transfer vector for Adobe A.Out files.  */
 
 #define aout_32_close_and_cleanup aout_32_bfd_free_cached_info
@@ -486,8 +519,7 @@
 #define aout_32_bfd_final_link		_bfd_generic_final_link
 #define aout_32_bfd_link_split_section	_bfd_generic_link_split_section
 
-const bfd_target a_out_adobe_vec =
-{
+const bfd_target a_out_adobe_vec = {
   "a.out.adobe",		/* name */
   bfd_target_aout_flavour,
   BFD_ENDIAN_BIG,		/* data byte order is unknown (big assumed) */
@@ -502,29 +534,29 @@
   16,				/* ar_max_namelen */
 
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
-     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
+  bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+  bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* data */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
-     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
-     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
- {_bfd_dummy_target, aout_adobe_object_p, /* bfd_check_format */
+  bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+  bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* hdrs */
+  {_bfd_dummy_target, aout_adobe_object_p,	/* bfd_check_format */
    bfd_generic_archive_p, _bfd_dummy_target},
- {bfd_false, aout_adobe_mkobject, /* bfd_set_format */
+  {bfd_false, aout_adobe_mkobject,	/* bfd_set_format */
    _bfd_generic_mkarchive, bfd_false},
- {bfd_false, aout_adobe_write_object_contents, /* bfd_write_contents */
+  {bfd_false, aout_adobe_write_object_contents,	/* bfd_write_contents */
    _bfd_write_archive_contents, bfd_false},
 
-     BFD_JUMP_TABLE_GENERIC (aout_32),
-     BFD_JUMP_TABLE_COPY (_bfd_generic),
-     BFD_JUMP_TABLE_CORE (_bfd_nocore),
-     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd),
-     BFD_JUMP_TABLE_SYMBOLS (aout_32),
-     BFD_JUMP_TABLE_RELOCS (aout_32),
-     BFD_JUMP_TABLE_WRITE (aout_32),
-     BFD_JUMP_TABLE_LINK (aout_32),
-     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+  BFD_JUMP_TABLE_GENERIC (aout_32),
+  BFD_JUMP_TABLE_COPY (_bfd_generic),
+  BFD_JUMP_TABLE_CORE (_bfd_nocore),
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd),
+  BFD_JUMP_TABLE_SYMBOLS (aout_32),
+  BFD_JUMP_TABLE_RELOCS (aout_32),
+  BFD_JUMP_TABLE_WRITE (aout_32),
+  BFD_JUMP_TABLE_LINK (aout_32),
+  BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   NULL,
-  
+
   (PTR) 0
 };
diff --git a/bfd/aout-arm.c b/bfd/aout-arm.c
index 7365f9d..182c1c6 100644
--- a/bfd/aout-arm.c
+++ b/bfd/aout-arm.c
@@ -1,7 +1,7 @@
 /* BFD back-end for raw ARM a.out binaries.
    Copyright (C) 1994, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
    Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
-   
+
 This file is part of BFD, the Binary File Descriptor library.
 
 This program is free software; you can redistribute it and/or modify
@@ -18,7 +18,6 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-
 #define N_TXTADDR(x) \
   ((N_MAGIC(x) == NMAGIC) ? 0x8000 : \
    (N_MAGIC(x) != ZMAGIC) ? 0 : \
@@ -44,7 +43,7 @@
 				PARAMS((bfd *, bfd_reloc_code_real_type));
 static boolean 		MYARM(write_object_contents)	PARAMS((bfd *));
 
-/* Avoid multiple defininitions from aoutx if supporting standarad a.out 
+/* Avoid multiple defininitions from aoutx if supporting standarad a.out
    as well as our own.  */
 #define NAME(x,y) CAT3(aoutarm,_32_,y)
 
@@ -63,7 +62,7 @@
 static void MY(swap_std_reloc_in) PARAMS ((bfd *, struct reloc_std_external *,
 					   arelent *, asymbol **,
 					   bfd_size_type));
-void MY(swap_std_reloc_out) PARAMS ((bfd *, arelent *, 
+void MY(swap_std_reloc_out) PARAMS ((bfd *, arelent *,
 				     struct reloc_std_external *));
 
 reloc_howto_type MY(howto_table)[] =
@@ -98,7 +97,7 @@
 #define RELOC_ARM_BITS_NEG_LITTLE   ((unsigned int) 0x10)
 
 reloc_howto_type *
-MY(reloc_howto)(abfd, rel, r_index, r_extern, r_pcrel)
+MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel)
      bfd *abfd;
      struct reloc_std_external *rel;
      int *r_index;
@@ -139,12 +138,12 @@
 
   return MY(howto_table) + index;
 }
- 
+
 #define MY_reloc_howto(BFD, REL, IN, EX, PC) \
 	MY(reloc_howto) (BFD, REL, &IN, &EX, &PC)
 
 void
-MY(put_reloc)(abfd, r_extern, r_index, value, howto, reloc)
+MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
      bfd *abfd;
      int r_extern;
      int r_index;
@@ -159,7 +158,7 @@
   PUT_WORD (abfd, value, reloc->r_address);
   r_length = howto->size ;	/* Size as a power of two */
 
-  /* Special case for branch relocations. */
+  /* Special case for branch relocations.  */
   if (howto->type == 3 || howto->type == 7)
     r_length = 3;
 
@@ -188,12 +187,12 @@
 	 | (r_length <<  RELOC_STD_BITS_LENGTH_SH_LITTLE));
     }
 }
- 
+
 #define MY_put_reloc(BFD, EXT, IDX, VAL, HOWTO, RELOC) \
-  MY(put_reloc)(BFD, EXT, IDX, VAL, HOWTO, RELOC)
+  MY(put_reloc) (BFD, EXT, IDX, VAL, HOWTO, RELOC)
 
 void
-MY(relocatable_reloc)(howto, abfd, reloc, amount, r_addr)
+MY(relocatable_reloc) (howto, abfd, reloc, amount, r_addr)
      reloc_howto_type *howto;
      bfd *abfd;
      struct reloc_std_external *reloc;
@@ -202,11 +201,11 @@
 {
   if (howto->type == 3)
     {
-      if (reloc->r_type[0] 
+      if (reloc->r_type[0]
 	  & (bfd_header_big_endian (abfd)
 	     ? RELOC_STD_BITS_EXTERN_BIG : RELOC_STD_BITS_EXTERN_LITTLE))
 	{
-	  /* The reloc is still external, so don't modify anything. */
+	  /* The reloc is still external, so don't modify anything.  */
 	  *amount = 0;
 	}
       else
@@ -225,7 +224,7 @@
 }
 
 #define MY_relocatable_reloc(HOW, BFD, REL, AMOUNT, ADDR) \
-  MY(relocatable_reloc)(HOW, BFD, REL, &(AMOUNT), ADDR)
+  MY(relocatable_reloc) (HOW, BFD, REL, &(AMOUNT), ADDR)
 
 static bfd_reloc_status_type
 MY(fix_pcrel_26_done) (abfd, reloc_entry, symbol, data, input_section,
@@ -257,7 +256,7 @@
   bfd_size_type addr = reloc_entry->address;
   long target = bfd_get_32 (abfd, (bfd_byte *) data + addr);
   bfd_reloc_status_type flag = bfd_reloc_ok;
-  
+
   /* If this is an undefined symbol, return error */
   if (symbol->section == &bfd_und_section
       && (symbol->flags & BSF_WEAK) == 0)
@@ -297,12 +296,12 @@
   /* Now the ARM magic... Change the reloc type so that it is marked as done.
      Strictly this is only necessary if we are doing a partial relocation.  */
   reloc_entry->howto = &MY(howto_table)[7];
-  
+
   return flag;
 }
 
 reloc_howto_type *
-MY(bfd_reloc_type_lookup)(abfd,code)
+MY(bfd_reloc_type_lookup) (abfd,code)
      bfd *abfd;
      bfd_reloc_code_real_type code;
 {
@@ -392,11 +391,10 @@
       r_pcrel = 0;
     }
   else if (g->howto->type == 7)
-    { 
+    {
       r_length = 3;
       r_pcrel = 1;
     }
-  
 
 #if 0
   /* For a standard reloc, the addend is in the object file.  */
@@ -506,7 +504,7 @@
      BFD_JUMP_TABLE_DYNAMIC (MY),
 
   & aout_arm_big_vec,
-  
+
   (PTR) MY_backend_data,
 };
 
@@ -547,6 +545,6 @@
      BFD_JUMP_TABLE_DYNAMIC (MY),
 
   & aout_arm_little_vec,
-  
+
   (PTR) MY_backend_data,
 };
diff --git a/bfd/aout-cris.c b/bfd/aout-cris.c
new file mode 100644
index 0000000..896c2b2
--- /dev/null
+++ b/bfd/aout-cris.c
@@ -0,0 +1,305 @@
+/* BFD backend for CRIS a.out binaries.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Contributed by Axis Communications AB.
+   Written by Hans-Peter Nilsson.
+
+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 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.  */
+
+/* See info in the file PORTING for documentation of these macros and
+   functions.  Beware; some of the information there is outdated.  */
+
+#define N_HEADER_IN_TEXT(x) 0
+#define BYTES_IN_WORD 4
+#define N_TXTOFF(x) 32
+#define ENTRY_CAN_BE_ZERO
+#define TEXT_START_ADDR 0
+
+/* Without reading symbols to get the text start symbol, there is no way
+   to know where the text segment starts in an a.out file.  Defaulting to
+   anything as constant as TEXT_START_ADDR is bad.  But we can guess from
+   the entry point, which is usually within the first 64k of the text
+   segment.  We also assume here that the text segment is 64k-aligned.
+   FIXME: It is also wrong to assume that data and bss follow immediately
+   after text, but with those, we don't have any choice besides reading
+   symbol info, and luckily there's no pressing need for correctness for
+   those vma:s at this time.  */
+#define N_TXTADDR(x) ((x).a_entry & ~0xffff)
+
+/* If you change this to 4, you can not link to an address N*4+2.  */
+#define SEGMENT_SIZE 2
+
+/* For some reason, if the a.out file has Z_MAGIC, then
+   adata(abfd).exec_bytes_size is not used, but rather
+   adata(abfd).zmagic_disk_block_size, even though the exec_header is
+   *not* included in the text segment.  A simple workaround is to
+   #define ZMAGIC_DISK_BLOCK_SIZE, which is used if defined; otherwise
+   TARGET_PAGE_SIZE is used.  */
+#define ZMAGIC_DISK_BLOCK_SIZE N_TXTOFF (0)
+
+/* It seems odd at first to set a page-size this low, but gives greater
+   freedom in where things can be linked.  The drawback is that you have
+   to set alignment and padding in linker scripts.  */
+#define TARGET_PAGE_SIZE SEGMENT_SIZE
+#define TARGETNAME "a.out-cris"
+
+/* N_SHARED_LIB gets this reasonable default as of 1999-07-12, but we
+   have to work with 2.9.1.  Note that N_SHARED_LIB is used in a
+   SUN-specific context, not applicable to CRIS.  */
+#define N_SHARED_LIB(x) 0
+
+/* The definition here seems not used; just provided as a convention.  */
+#define DEFAULT_ARCH bfd_arch_cris
+
+/* ??? Spacing might be essential for the parameters in this macro.
+   Do Not Change.  */
+#define MY(OP) CAT (cris_aout_,OP)
+#define NAME(x,y) CAT3(cris_aout,_32_,y)
+
+#include "bfd.h"
+
+/* Version 1 of the header.  */
+#define MY_exec_hdr_flags 1
+
+#define MY_write_object_contents MY(write_object_contents)
+static boolean MY(write_object_contents) PARAMS ((bfd *));
+
+/* Forward this, so we can use a pointer to it in PARAMS.  */
+struct reloc_ext_external;
+
+#define MY_swap_ext_reloc_out MY(swap_ext_reloc_out)
+static void MY(swap_ext_reloc_out) PARAMS ((bfd *, arelent *,
+					    struct reloc_ext_external *));
+
+#define MY_swap_ext_reloc_in MY(swap_ext_reloc_in)
+static void MY(swap_ext_reloc_in) PARAMS ((bfd *, struct
+					   reloc_ext_external *,
+					   arelent *, asymbol **,
+					   bfd_size_type));
+
+#define MY_set_sizes MY(set_sizes)
+static boolean MY(set_sizes) PARAMS ((bfd *));
+
+/* To set back reloc_size to ext, we make MY(set_sizes) be called
+   through this construct.  Note that MY_set_arch_mach is only called
+   through SET_ARCH_MACH.  The default bfd_default_set_arch_mach will
+   not call set_sizes.  */
+
+#define MY_set_arch_mach NAME (aout, set_arch_mach)
+#define SET_ARCH_MACH(BFD, EXEC) \
+ MY_set_arch_mach (BFD, DEFAULT_ARCH, N_MACHTYPE (EXEC))
+
+/* These macros describe the binary layout of the reloc information we
+   use in a file.  */
+#define RELOC_EXT_BITS_EXTERN_LITTLE 0x80
+#define RELOC_EXT_BITS_TYPE_LITTLE 3
+#define RELOC_EXT_BITS_TYPE_SH_LITTLE 0
+
+#ifndef MY_get_section_contents
+#define MY_get_section_contents aout_32_get_section_contents
+#endif
+
+/* Include generic functions (some are overridden above).  */
+#include "aout32.c"
+#include "aout-target.h"
+
+/* We need our own version to set header flags.  */
+
+static boolean
+MY(write_object_contents) (abfd)
+     bfd *abfd;
+{
+  struct external_exec exec_bytes;
+  struct internal_exec *execp = exec_hdr (abfd);
+
+  /* We set the reloc type to RELOC_EXT_SIZE, although setting it at all
+     seems unnecessary when inspecting as and ld behavior (not an
+     exhaustive inspection).  The default write_object_contents
+     definition sets RELOC_EXT_SIZE, so we follow suite and set it too.  */
+  obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
+
+  /* Setting N_SET_MACHTYPE and using N_SET_FLAGS is not performed by
+     the default definition.  */
+  if (bfd_get_arch(abfd) == bfd_arch_cris)
+    N_SET_MACHTYPE(*execp, M_CRIS);
+
+  N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags);
+
+  WRITE_HEADERS (abfd, execp);
+
+  return true;
+}
+
+/* We need our own for these reasons:
+   - Assert that a normal 8, 16 or 32 reloc is output.
+   - Fix what seems to be a weak-bug (perhaps there for valid reasons).  */
+
+static void
+MY(swap_ext_reloc_out) (abfd, g, natptr)
+     bfd *abfd;
+     arelent *g;
+     struct reloc_ext_external *natptr;
+{
+  int r_index;
+  int r_extern;
+  unsigned int r_type;
+  unsigned int r_addend;
+  asymbol *sym = *(g->sym_ptr_ptr);
+  asection *output_section = sym->section->output_section;
+
+  PUT_WORD (abfd, g->address, natptr->r_address);
+
+  r_type = (unsigned int) g->howto->type;
+
+  r_addend = g->addend;
+  if ((sym->flags & BSF_SECTION_SYM) != 0)
+    r_addend += (*(g->sym_ptr_ptr))->section->output_section->vma;
+
+  /* If this relocation is relative to a symbol then set the
+     r_index to the symbols index, and the r_extern bit.
+
+     Absolute symbols can come in in two ways, either as an offset
+     from the abs section, or as a symbol which has an abs value.
+     check for that here.  */
+
+  if (bfd_is_abs_section (bfd_get_section (sym)))
+    {
+      r_extern = 0;
+      r_index = N_ABS;
+    }
+  else if ((sym->flags & BSF_SECTION_SYM) == 0)
+    {
+      if (bfd_is_und_section (bfd_get_section (sym))
+	  /* Remember to check for weak symbols; they count as global.  */
+	  || (sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0)
+	r_extern = 1;
+      else
+	r_extern = 0;
+      r_index = (*(g->sym_ptr_ptr))->KEEPIT;
+    }
+  else
+    {
+      /* Just an ordinary section.  */
+      r_extern = 0;
+      r_index = output_section->target_index;
+    }
+
+  /* The relocation type is the same as the canonical ones, but only
+     the first 3 are used: RELOC_8, RELOC_16, RELOC_32.
+     We may change this later, but assert this for the moment.  */
+  if (r_type > 2)
+    {
+      (*_bfd_error_handler) (_("%s: Invalid relocation type exported: %d"),
+			     bfd_get_filename (abfd), r_type);
+
+      bfd_set_error (bfd_error_wrong_format);
+    }
+
+  /* Now the fun stuff.  */
+  natptr->r_index[2] = r_index >> 16;
+  natptr->r_index[1] = r_index >> 8;
+  natptr->r_index[0] = r_index;
+  natptr->r_type[0] =
+     (r_extern ? RELOC_EXT_BITS_EXTERN_LITTLE : 0)
+      | (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE);
+
+  PUT_WORD (abfd, r_addend, natptr->r_addend);
+}
+
+/* We need our own to assert that a normal 8, 16 or 32 reloc is input.  */
+
+static void
+MY(swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
+     bfd *abfd;
+     struct reloc_ext_external *bytes;
+     arelent *cache_ptr;
+     asymbol **symbols;
+     bfd_size_type symcount;
+{
+  unsigned int r_index;
+  int r_extern;
+  unsigned int r_type;
+  struct aoutdata *su = &(abfd->tdata.aout_data->a);
+
+  cache_ptr->address = (GET_SWORD (abfd, bytes->r_address));
+
+  /* Now the fun stuff.  */
+  r_index =  (bytes->r_index[2] << 16)
+    | (bytes->r_index[1] << 8)
+    |  bytes->r_index[0];
+  r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE));
+  r_type = ((bytes->r_type[0]) >> RELOC_EXT_BITS_TYPE_SH_LITTLE)
+    & RELOC_EXT_BITS_TYPE_LITTLE;
+
+  if (r_type > 2)
+    {
+      (*_bfd_error_handler) (_("%s: Invalid relocation type imported: %d"),
+			     bfd_get_filename (abfd), r_type);
+
+      bfd_set_error(bfd_error_wrong_format);
+    }
+
+  cache_ptr->howto =  howto_table_ext + r_type;
+
+  if (r_extern && r_index > symcount)
+    {
+      (*_bfd_error_handler)
+        (_("%s: Bad relocation record imported: %d"),
+         bfd_get_filename (abfd), r_index);
+
+      bfd_set_error (bfd_error_wrong_format);
+
+      /* We continue, so we can catch further errors.  */
+      r_extern = 0;
+      r_index = N_ABS;
+    }
+
+  /* Magically uses r_extern, symbols etc.  Ugly, but it's what's in the
+     default.  */
+  MOVE_ADDRESS (GET_SWORD (abfd, bytes->r_addend));
+}
+
+/* We use the same as the default, except that we also set
+   "obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;", to avoid changing
+   NAME (aout, set_arch_mach) in aoutx.  */
+
+static boolean
+MY(set_sizes) (abfd)
+     bfd *abfd;
+{
+  /* Just as the default in aout-target.h (with some #ifdefs folded)...  */
+
+  adata(abfd).page_size = TARGET_PAGE_SIZE;
+  adata(abfd).segment_size = SEGMENT_SIZE;
+  adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE;
+  adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
+
+  /* ... except for that we have the extended reloc.  The alternative
+     would be to add a check on bfd_arch_cris in NAME (aout,
+     set_arch_mach) in aoutx.h, but I don't want to do that since
+     target-specific things should not be added there.  */
+
+  obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
+
+  return true;
+}
+
+/*
+ * Local variables:
+ * eval: (c-set-style "gnu")
+ * indent-tabs-mode: t
+ * End:
+ */
diff --git a/bfd/aout-encap.c b/bfd/aout-encap.c
index c25f9037..5f8a511 100644
--- a/bfd/aout-encap.c
+++ b/bfd/aout-encap.c
@@ -53,12 +53,12 @@
 	bfd_set_error (bfd_error_wrong_format);
       return 0;
     }
-  
+
   coff_magic = bfd_h_get_16 (abfd, magicbuf);
   if (coff_magic != COFF_MAGIC)
     return 0;			/* Not an encap coff file */
 
-  __header_offset_temp==COFF_MAGIC ? sizeof(struct coffheader) : 0)
+  __header_offset_temp==COFF_MAGIC ? sizeof (struct coffheader) : 0)
   (fseek ((f), HEADER_OFFSET((f)), 1))
 
   magic = bfd_h_get_32 (abfd, magicbuf);
@@ -72,7 +72,7 @@
       bfd_set_error (bfd_error_wrong_format);
     return 0;
   }
-  NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec);
+  NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
 
   return aout_32_some_aout_object_p (abfd, &exec, encap_realcallback);
 }
@@ -83,9 +83,9 @@
      bfd *abfd;
 {
   struct internal_exec *execp = exec_hdr (abfd);
-  
-  MY(callback)(abfd, execp);
-  
+
+  MY(callback) (abfd, execp);
+
   /* If we have a coff header, it can give us better values for
      text_start and exec_data_start.  This is particularly useful
      for remote debugging of embedded systems.  */
diff --git a/bfd/aout-ns32k.c b/bfd/aout-ns32k.c
index 05ac84e..e094a8c 100644
--- a/bfd/aout-ns32k.c
+++ b/bfd/aout-ns32k.c
@@ -89,7 +89,7 @@
  *
  */
 
-reloc_howto_type MY(howto_table)[] = 
+reloc_howto_type MY(howto_table)[] =
 {
   /* ns32k immediate operands */
   HOWTO (BFD_RELOC_NS32K_IMM_8, 0, 0, 8, false, 0, true,
@@ -146,7 +146,6 @@
 	 "PCREL_32", true, 0xffffffff,0xffffffff, false),
 };
 
-
 #define CTOR_TABLE_RELOC_HOWTO(BFD) (MY(howto_table) + 14)
 
 #define RELOC_STD_BITS_NS32K_TYPE_BIG 0x06
@@ -155,7 +154,7 @@
 #define RELOC_STD_BITS_NS32K_TYPE_SH_LITTLE 5
 
 reloc_howto_type *
-MY(reloc_howto)(abfd, rel, r_index, r_extern, r_pcrel)
+MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel)
      bfd *abfd ATTRIBUTE_UNUSED;
      struct reloc_std_external *rel;
      int *r_index;
@@ -177,10 +176,10 @@
   return (MY(howto_table) + r_length + 3 * (*r_pcrel) + 6 * r_ns32k_type);
 }
 
-#define MY_reloc_howto(BFD,REL,IN,EX,PC) MY(reloc_howto)(BFD, REL, &IN, &EX, &PC)
+#define MY_reloc_howto(BFD,REL,IN,EX,PC) MY(reloc_howto) (BFD, REL, &IN, &EX, &PC)
 
 void
-MY(put_reloc)(abfd, r_extern, r_index, value, howto, reloc)
+MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
      bfd *abfd;
      int r_extern;
      int r_index;
@@ -207,7 +206,7 @@
 }
 
 #define MY_put_reloc(BFD, EXT, IDX, VAL, HOWTO, RELOC) \
-  MY(put_reloc)(BFD, EXT, IDX, VAL, HOWTO, RELOC)
+  MY(put_reloc) (BFD, EXT, IDX, VAL, HOWTO, RELOC)
 
 #define STAT_FOR_EXEC
 
@@ -217,7 +216,7 @@
 #include <aoutx.h>
 
 reloc_howto_type *
-MY(bfd_reloc_type_lookup)(abfd,code)
+MY(bfd_reloc_type_lookup) (abfd,code)
      bfd *abfd;
      bfd_reloc_code_real_type code;
 {
@@ -259,7 +258,6 @@
 #undef ENTRY
 }
 
-
 static void
 MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
      bfd *abfd;
@@ -295,10 +293,10 @@
   asection *output_section = sym->section->output_section;
 
   r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;
-    
+
   /* name was clobbered by aout_write_syms to be symbol index */
 
-  /* If this relocation is relative to a symbol then set the 
+  /* If this relocation is relative to a symbol then set the
      r_index to the symbols index, and the r_extern bit.
 
      Absolute symbols can come in in two ways, either as an offset
@@ -307,7 +305,7 @@
 
   if (bfd_is_com_section (output_section)
       || output_section == &bfd_abs_section
-      || output_section == &bfd_und_section) 
+      || output_section == &bfd_und_section)
     {
       if (bfd_abs_section.symbol == sym)
 	{
@@ -316,21 +314,21 @@
 	  r_index = 0;
 	  r_extern = 0;
 	}
-      else 
+      else
 	{
 	  /* Fill in symbol */
 	  r_extern = 1;
 #undef KEEPIT
 #define KEEPIT udata.i
 	  r_index =  (*(g->sym_ptr_ptr))->KEEPIT;
-#undef KEEPIT     
+#undef KEEPIT
 	}
     }
-  else 
+  else
     {
       /* Just an ordinary section */
       r_extern = 0;
-      r_index  = output_section->target_index;      
+      r_index  = output_section->target_index;
     }
 
   MY_put_reloc (abfd, r_extern, r_index, g->address, g->howto, natptr);
diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index 046417b..1902cdf 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -61,7 +61,7 @@
       bfd_vma adjust;
 
       adjust = execp->a_entry - obj_textsec (abfd)->vma;
-      /* Adjust only by whole pages. */
+      /* Adjust only by whole pages.  */
       adjust &= ~(TARGET_PAGE_SIZE - 1);
       obj_textsec (abfd)->vma += adjust;
       obj_datasec (abfd)->vma += adjust;
@@ -84,7 +84,7 @@
   /* The file offsets of the string table and symbol table.  */
   obj_sym_filepos (abfd) = N_SYMOFF (*execp);
   obj_str_filepos (abfd) = N_STROFF (*execp);
-  
+
   /* Determine the architecture and machine type of the object file.  */
 #ifdef SET_ARCH_MACH
   SET_ARCH_MACH(abfd, *execp);
@@ -164,7 +164,7 @@
   if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0;
 #endif
 
-  NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec);
+  NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
 
 #ifdef SWAP_MAGIC
   /* swap_exec_header_in read in a_info with the wrong byte order */
@@ -178,7 +178,7 @@
    * means that it isn't obvious if EXEC_P should be set.
    * All of the following must be true for an executable:
    * There must be no relocations, the bfd can be neither an
-   * archive nor an archive element, and the file must be executable. */
+   * archive nor an archive element, and the file must be executable.  */
 
   if (exec.a_trsize + exec.a_drsize == 0
       && bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL)
@@ -197,7 +197,6 @@
 #define MY_object_p MY(object_p)
 #endif
 
-
 #ifndef MY_mkobject
 
 static boolean MY(mkobject) PARAMS ((bfd *));
@@ -206,7 +205,7 @@
 MY(mkobject) (abfd)
      bfd *abfd;
 {
-  if (NAME(aout,mkobject)(abfd) == false)
+  if (NAME(aout,mkobject) (abfd) == false)
     return false;
 #if 0 /* Sizes get set in set_sizes callback, later, after we know
 	 the architecture and machine.  */
@@ -230,7 +229,6 @@
 static boolean MY_bfd_copy_private_section_data
   PARAMS ((bfd *, asection *, bfd *, asection *));
 
-/*ARGSUSED*/
 static boolean
 MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
      bfd *ibfd;
@@ -530,7 +528,6 @@
 #define MY_bfd_link_split_section  _bfd_generic_link_split_section
 #endif
 
-
 #ifndef MY_bfd_copy_private_bfd_data
 #define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
 #endif
@@ -581,7 +578,7 @@
 #endif
 
 /* Aout symbols normally have leading underscores */
-#ifndef MY_symbol_leading_char 
+#ifndef MY_symbol_leading_char
 #define MY_symbol_leading_char '_'
 #endif
 
@@ -643,7 +640,7 @@
 
   /* Alternative_target */
   NULL,
-  
+
   (PTR) MY_backend_data
 };
 #endif /* MY_BFD_TARGET */
diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c
index 686c159..f0f4d3d 100644
--- a/bfd/aout-tic30.c
+++ b/bfd/aout-tic30.c
@@ -128,7 +128,7 @@
 /* This table lists the relocation types for the TMS320C30.  There are
    only a few relocations required, and all must be divided by 4 (>>
    2) to get the 32-bit addresses in the format the TMS320C30 likes
-   it. */
+   it.  */
 reloc_howto_type tic30_aout_howto_table[] =
 {
   EMPTY_HOWTO (-1),
@@ -210,7 +210,7 @@
    requires that any relocations for the data section should point to
    the end of the aligned text section, plus an offset.  By default,
    this does not happen, therefore this function takes care of
-   that. */
+   that.  */
 
 static bfd_reloc_status_type
 tic30_aout_fix_16 (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message)
@@ -224,11 +224,11 @@
 {
   bfd_vma relocation;
 
-  /* Make sure that the symbol's section is defined. */
+  /* Make sure that the symbol's section is defined.  */
   if (symbol->section == &bfd_und_section && (symbol->flags & BSF_WEAK) == 0)
     return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
   /* Get the size of the input section and turn it into the TMS320C30
-     32-bit address format. */
+     32-bit address format.  */
   relocation = (symbol->section->vma >> 2);
   relocation += bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address);
   bfd_put_16 (abfd, relocation, (bfd_byte *) data + reloc_entry->address);
@@ -236,7 +236,7 @@
 }
 
 /* This function does the same thing as tic30_aout_fix_16 except for 32
-   bit relocations. */
+   bit relocations.  */
 
 static bfd_reloc_status_type
 tic30_aout_fix_32 (abfd, reloc_entry, symbol, data, input_section,
@@ -251,11 +251,11 @@
 {
   bfd_vma relocation;
 
-  /* Make sure that the symbol's section is defined. */
+  /* Make sure that the symbol's section is defined.  */
   if (symbol->section == &bfd_und_section && (symbol->flags & BSF_WEAK) == 0)
     return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
   /* Get the size of the input section and turn it into the TMS320C30
-     32-bit address format. */
+     32-bit address format.  */
   relocation = (symbol->section->vma >> 2);
   relocation += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
   bfd_put_32 (abfd, relocation, (bfd_byte *) data + reloc_entry->address);
@@ -267,7 +267,7 @@
    useless for a relocation, so we just get the offset value and place
    a version of this within the object code.
    tic30_aout_final_link_relocate will then calculate the required
-   relocation to add on to the value in the object code. */
+   relocation to add on to the value in the object code.  */
 
 static bfd_reloc_status_type
 tic30_aout_fix_pcrel_16 (abfd, reloc_entry, symbol, data, input_section,
@@ -285,7 +285,7 @@
 
   /* The byte before the location of the fix contains bits 23-16 of
      the pcrel instruction.  Bit 21 is set for a delayed instruction
-     which requires on offset of 3 instead of 1. */
+     which requires on offset of 3 instead of 1.  */
   if (offset_data & 0x20)
     relocation -= 3;
   else
@@ -295,14 +295,16 @@
 }
 
 /* These macros will get 24-bit values from the bfd definition.
-   Big-endian only. */
-#define bfd_getb_24(BFD,ADDR) (bfd_get_8(BFD,ADDR) << 16) | \
-                              (bfd_get_8(BFD,ADDR+1) << 8) | \
-                              (bfd_get_8(BFD,ADDR+2))
+   Big-endian only.  */
+#define bfd_getb_24(BFD,ADDR)			\
+ (bfd_get_8 (BFD, ADDR    ) << 16) |		\
+ (bfd_get_8 (BFD, ADDR + 1) <<  8) |		\
+ (bfd_get_8 (BFD, ADDR + 2)      )
 
-#define bfd_putb_24(BFD,DATA,ADDR) bfd_put_8(BFD,(bfd_byte)((DATA >> 16) & 0xFF),ADDR); \
-	                               bfd_put_8(BFD,(bfd_byte)((DATA >> 8) & 0xFF),ADDR+1); \
-		         				   bfd_put_8(BFD,(bfd_byte)(DATA & 0xFF),ADDR+2)
+#define bfd_putb_24(BFD,DATA,ADDR)				\
+ bfd_put_8 (BFD, (bfd_byte) ((DATA >> 16) & 0xFF), ADDR    );	\
+ bfd_put_8 (BFD, (bfd_byte) ((DATA >>  8) & 0xFF), ADDR + 1);	\
+ bfd_put_8 (BFD, (bfd_byte) ( DATA        & 0xFF), ADDR + 2)
 
 /* Set parameters about this a.out file that are machine-dependent.
    This routine is called from some_aout_object_p just before it returns.  */
@@ -563,7 +565,7 @@
    * means that it isn't obvious if EXEC_P should be set.
    * All of the following must be true for an executable:
    * There must be no relocations, the bfd can be neither an
-   * archive nor an archive element, and the file must be executable. */
+   * archive nor an archive element, and the file must be executable.  */
 
   if (exec.a_trsize + exec.a_drsize == 0
       && bfd_get_format (abfd) == bfd_object && abfd->my_archive == NULL)
@@ -586,7 +588,6 @@
    section contents, and copy_private_bfd_data is not called until
    after the section contents have been set.  */
 
-/*ARGSUSED */
 static boolean
 MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
      bfd *ibfd;
@@ -720,7 +721,7 @@
   int pad;
 
   /* Set the executable header size to 0, as we don't want one for an
-     output. */
+     output.  */
   adata (abfd).exec_bytes_size = 0;
   pos = adata (abfd).exec_bytes_size;
   /* Text.  */
@@ -765,7 +766,7 @@
   obj_bsssec (abfd)->vma = vma;
   obj_bsssec (abfd)->user_set_vma = 1;
 
-  /* We are fully resized, so don't readjust in final_link. */
+  /* We are fully resized, so don't readjust in final_link.  */
   adata (abfd).magic = z_magic;
 
   return NAME (aout, final_link) (abfd, info, MY_final_link_callback);
@@ -961,7 +962,6 @@
 #define MY_bfd_link_split_section  _bfd_generic_link_split_section
 #endif
 
-
 #ifndef MY_bfd_copy_private_bfd_data
 #define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
 #endif
@@ -1058,7 +1058,7 @@
   BFD_JUMP_TABLE_DYNAMIC (MY),
 
   NULL,
-  
+
   (PTR) MY_backend_data
 };
 #endif /* MY_BFD_TARGET */
diff --git a/bfd/aoutf1.h b/bfd/aoutf1.h
index fdf95b5..4ad49a1 100644
--- a/bfd/aoutf1.h
+++ b/bfd/aoutf1.h
@@ -33,7 +33,7 @@
 /* This is needed to reject a NewsOS file, e.g. in
    gdb/testsuite/gdb.t10/crossload.exp. <kingdon@cygnus.com>
    I needed to add M_UNKNOWN to recognize a 68000 object, so this will
-   probably no longer reject a NewsOS object.  <ian@cygnus.com>. */
+   probably no longer reject a NewsOS object.  <ian@cygnus.com>.  */
 #ifndef MACHTYPE_OK
 #define MACHTYPE_OK(mtype) \
   (((mtype) == M_SPARC && bfd_lookup_arch (bfd_arch_sparc, 0) != NULL) \
@@ -123,7 +123,7 @@
 
     case M_UNKNOWN:
       /* Some Sun3s make magic numbers without cpu types in them, so
-	 we'll default to the 68000. */
+	 we'll default to the 68000.  */
       arch = bfd_arch_m68k;
       machine = bfd_mach_m68000;
       break;
@@ -180,7 +180,7 @@
 }
 
 #define SET_ARCH_MACH(ABFD, EXEC) \
-  NAME(sunos,set_arch_mach)(ABFD, N_MACHTYPE (EXEC)); \
+  NAME(sunos,set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \
   choose_reloc_size(ABFD);
 
 /* Determine the size of a relocation entry, based on the architecture */
@@ -275,11 +275,11 @@
   Unfortunately, they don't document the FPA structure, or at least I
   can't find it easily.  Fortunately the core header contains its own
   length.  So this shouldn't cause problems, except for c_ucode, which
-  so far we don't use but is easy to find with a little arithmetic. */
+  so far we don't use but is easy to find with a little arithmetic.  */
 
 /* But the reg structure can be gotten from the SPARC processor handbook.
   This really should be in a GNU include file though so that gdb can use
-  the same info. */
+  the same info.  */
 struct regs
 {
   int r_psr;
@@ -439,7 +439,7 @@
   intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_ssize);
   memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
   intcore->fp_stuff_pos = (long) (((struct external_sun3_core *) 0)->fp_stuff);
-  /* FP stuff takes up whole rest of struct, except c_ucode. */
+  /* FP stuff takes up whole rest of struct, except c_ucode.  */
   intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
     (file_ptr) (((struct external_sun3_core *) 0)->fp_stuff);
   /* Ucode is the last thing in the struct -- just before the end */
@@ -449,7 +449,6 @@
   intcore->c_stacktop = 0x0E000000;	/* By experimentation */
 }
 
-
 /* byte-swap in the Sparc core structure */
 static void
 swapcore_sparc (abfd, ext, intcore)
@@ -476,7 +475,7 @@
   intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_ssize);
   memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
   intcore->fp_stuff_pos = (long) (((struct external_sparc_core *) 0)->fp_stuff);
-  /* FP stuff takes up whole rest of struct, except c_ucode. */
+  /* FP stuff takes up whole rest of struct, except c_ucode.  */
   intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
     (file_ptr) (((struct external_sparc_core *) 0)->fp_stuff);
   /* Ucode is the last thing in the struct -- just before the end */
@@ -544,7 +543,7 @@
   memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
   intcore->fp_stuff_pos =
     (long) (((struct external_solaris_bcp_core *) 0)->fp_stuff);
-  /* FP stuff takes up whole rest of struct, except c_ucode. */
+  /* FP stuff takes up whole rest of struct, except c_ucode.  */
   intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
     (file_ptr) (((struct external_solaris_bcp_core *) 0)->fp_stuff);
   /* Ucode is the last thing in the struct -- just before the end */
@@ -764,7 +763,7 @@
       return false;
     }
 
-  /* Solaris core files do not include an aouthdr. */
+  /* Solaris core files do not include an aouthdr.  */
   if ((core_hdr (core_bfd)->hdr)->c_len == SOLARIS_BCP_CORE_LEN)
     return true;
 
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 4b0940d..f8612a8 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -23,7 +23,6 @@
 SECTION
 	a.out backends
 
-
 DESCRIPTION
 
 	BFD supports a number of different flavours of a.out format,
@@ -268,7 +267,7 @@
   HOWTO(40,	       0,  2,	 0, false, 0, complain_overflow_bitfield,0,"BASEREL",   false,         0,0x00000000, false),
 };
 
-#define TABLE_SIZE(TABLE)	(sizeof(TABLE)/sizeof(TABLE[0]))
+#define TABLE_SIZE(TABLE)	(sizeof (TABLE)/sizeof (TABLE[0]))
 
 reloc_howto_type *
 NAME(aout,reloc_type_lookup) (abfd,code)
@@ -363,7 +362,7 @@
   /* The internal_exec structure has some fields that are unused in this
      configuration (IE for i960), so ensure that all such uninitialized
      fields are zero'd out.  There are places where two of these structs
-     are memcmp'd, and thus the contents do matter. */
+     are memcmp'd, and thus the contents do matter.  */
   memset ((PTR) execp, 0, sizeof (struct internal_exec));
   /* Now fill in fields in the execp, from the bytes in the raw data.  */
   execp->a_info   = bfd_h_get_32 (abfd, bytes->e_info);
@@ -400,7 +399,7 @@
 {
   struct external_exec *bytes = (struct external_exec *)raw_bytes;
 
-  /* Now fill in fields in the raw data, from the fields in the exec struct. */
+  /* Now fill in fields in the raw data, from the fields in the exec struct.  */
   bfd_h_put_32 (abfd, execp->a_info  , bytes->e_info);
   PUT_WORD (abfd, execp->a_text  , bytes->e_text);
   PUT_WORD (abfd, execp->a_data  , bytes->e_data);
@@ -436,7 +435,7 @@
 SYNOPSIS
 	const bfd_target *aout_@var{size}_some_aout_object_p
 	 (bfd *abfd,
-	  const bfd_target *(*callback_to_real_object_p)());
+	  const bfd_target *(*callback_to_real_object_p) ());
 
 DESCRIPTION
 	Some a.out variant thinks that the file open in @var{abfd}
@@ -517,7 +516,7 @@
   /* The default relocation entry size is that of traditional V7 Unix.  */
   obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
 
-  /* The default symbol entry size is that of traditional Unix. */
+  /* The default symbol entry size is that of traditional Unix.  */
   obj_symbol_entry_size (abfd) = EXTERNAL_NLIST_SIZE;
 
 #ifdef USE_MMAP
@@ -601,7 +600,7 @@
      header, should cope with them in this callback as well.  */
 #endif				/* DOCUMENTATION */
 
-  result = (*callback_to_real_object_p)(abfd);
+  result = (*callback_to_real_object_p) (abfd);
 
   /* Now that the segment addresses have been worked out, take a better
      guess at whether the file is executable.  If the entry point
@@ -616,7 +615,7 @@
 
      To fix this, we now accept any non-zero entry point as an indication of
      executability.  This will work most of the time, since only the linker
-     sets the entry point, and that is likely to be non-zero for most systems. */
+     sets the entry point, and that is likely to be non-zero for most systems.  */
 
   if (execp->a_entry != 0
       || (execp->a_entry >= obj_textsec(abfd)->vma
@@ -693,7 +692,6 @@
   return true;
 }
 
-
 /*
 FUNCTION
 	aout_@var{size}_machine_type
@@ -757,7 +755,7 @@
   case bfd_arch_arm:
     if (machine == 0)	arch_flags = M_ARM;
     break;
-    
+
   case bfd_arch_mips:
     switch (machine) {
     case 0:
@@ -778,7 +776,12 @@
     case bfd_mach_mips8000:
     case bfd_mach_mips10000:
     case bfd_mach_mips16:
-      /* FIXME: These should be MIPS3 or MIPS4.  */
+    case bfd_mach_mips32:
+    case bfd_mach_mips32_4k:
+    case bfd_mach_mips5:
+    case bfd_mach_mips64:
+    case bfd_mach_mips_sb1:
+      /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc.  */
       arch_flags = M_MIPS2;
       break;
     default:
@@ -800,6 +803,10 @@
     *unknown = false;
     break;
 
+  case bfd_arch_cris:
+    if (machine == 0 || machine == 255)	arch_flags = M_CRIS;
+    break;
+
   default:
     arch_flags = M_UNKNOWN;
   }
@@ -810,7 +817,6 @@
   return arch_flags;
 }
 
-
 /*
 FUNCTION
 	aout_@var{size}_set_arch_mach
@@ -937,7 +943,7 @@
   file_ptr text_end;
   CONST struct aout_backend_data *abdp;
   int ztih;			/* Nonzero if text includes exec header.  */
-  
+
   abdp = aout_backend_info (abfd);
 
   /* Text.  */
@@ -1005,7 +1011,7 @@
     }
   obj_datasec(abfd)->filepos = (obj_textsec(abfd)->filepos
 				+ obj_textsec(abfd)->_raw_size);
-  
+
   /* Fix up exec header while we're at it.  */
   execp->a_text = obj_textsec(abfd)->_raw_size;
   if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted)))
@@ -1050,7 +1056,7 @@
   file_ptr pos = adata(abfd).exec_bytes_size;
   bfd_vma vma = 0;
   int pad;
-  
+
   /* Text.  */
   obj_textsec(abfd)->filepos = pos;
   if (!obj_textsec(abfd)->user_set_vma)
@@ -1065,7 +1071,7 @@
   if (!obj_datasec(abfd)->user_set_vma)
     obj_datasec(abfd)->vma = BFD_ALIGN (vma, adata(abfd).segment_size);
   vma = obj_datasec(abfd)->vma;
-  
+
   /* Since BSS follows data immediately, see if it needs alignment.  */
   vma += obj_datasec(abfd)->_raw_size;
   pad = align_power (vma, obj_bsssec(abfd)->alignment_power) - vma;
@@ -1110,7 +1116,7 @@
      (TARGET_PAGE_SIZE).  However, newer versions of SUNOS start the text
      segment right after the exec header; the latter is counted in the
      text segment size, and is paged in by the kernel with the rest of
-     the text. */
+     the text.  */
 
   /* This perhaps isn't the right way to do this, but made it simpler for me
      to understand enough to implement it.  Better would probably be to go
@@ -1197,7 +1203,6 @@
   /* align to double at least */
   newsect->alignment_power = bfd_get_arch_info(abfd)->section_align_power;
 
-
   if (bfd_get_format (abfd) == bfd_object)
   {
     if (obj_textsec(abfd) == NULL && !strcmp(newsect->name, ".text")) {
@@ -1307,7 +1312,7 @@
       obj_aout_external_syms (abfd) = syms;
       obj_aout_external_sym_count (abfd) = count;
     }
-      
+
   if (obj_aout_external_strings (abfd) == NULL
       && exec_hdr (abfd)->a_syms != 0)
     {
@@ -1636,7 +1641,7 @@
 	 file.  */
       (*_bfd_error_handler)
 	(_("%s: can not represent section for symbol `%s' in a.out object file format"),
-	 bfd_get_filename (abfd), 
+	 bfd_get_filename (abfd),
 	 cache_ptr->name != NULL ? cache_ptr->name : _("*unknown*"));
       bfd_set_error (bfd_error_nonrepresentable_section);
       return false;
@@ -1681,6 +1686,8 @@
     sym_pointer->e_type[0] = ((aout_symbol_type *) cache_ptr)->type;
   else if ((cache_ptr->flags & BSF_GLOBAL) != 0)
     sym_pointer->e_type[0] |= N_EXT;
+  else if ((cache_ptr->flags & BSF_LOCAL) != 0)
+    sym_pointer->e_type[0] &= ~N_EXT;
 
   if ((cache_ptr->flags & BSF_CONSTRUCTOR) != 0)
     {
@@ -1716,7 +1723,7 @@
   return true;
 }
 
-/* Native-level interface to symbols. */
+/* Native-level interface to symbols.  */
 
 asymbol *
 NAME(aout,make_empty_symbol) (abfd)
@@ -1783,7 +1790,7 @@
 
 /* We read the symbols into a buffer, which is discarded when this
    function exits.  We read the strings into a buffer large enough to
-   hold them all plus all the cached symbol entries. */
+   hold them all plus all the cached symbol entries.  */
 
 boolean
 NAME(aout,slurp_symbol_table) (abfd)
@@ -1980,18 +1987,18 @@
     unsigned int counter = 0;
     aout_symbol_type *symbase;
 
-    if (!NAME(aout,slurp_symbol_table)(abfd))
+    if (!NAME(aout,slurp_symbol_table) (abfd))
       return -1;
 
     for (symbase = obj_aout_symbols(abfd); counter++ < bfd_get_symcount (abfd);)
-      *(location++) = (asymbol *)( symbase++);
+      *(location++) = (asymbol *) ( symbase++);
     *location++ =0;
     return bfd_get_symcount (abfd);
 }
 
 
 /* Standard reloc stuff */
-/* Output standard relocation information to a file in target byte order. */
+/* Output standard relocation information to a file in target byte order.  */
 
 extern void  NAME(aout,swap_std_reloc_out)
   PARAMS ((bfd *, arelent *, struct reloc_std_external *));
@@ -2034,7 +2041,6 @@
      check for that here
      */
 
-
   if (bfd_is_com_section (output_section)
       || bfd_is_abs_section (output_section)
       || bfd_is_und_section (output_section))
@@ -2087,9 +2093,8 @@
       }
 }
 
-
 /* Extended stuff */
-/* Output extended relocation information to a file in target byte order. */
+/* Output extended relocation information to a file in target byte order.  */
 
 extern void NAME(aout,swap_ext_reloc_out)
   PARAMS ((bfd *, arelent *, struct reloc_ext_external *));
@@ -2171,7 +2176,6 @@
    contain 60. This macro subs the base of each section from the value
    to give the true offset from the section */
 
-
 #define MOVE_ADDRESS(ad)       						\
   if (r_extern) {							\
    /* undefined symbol */						\
@@ -2479,7 +2483,7 @@
       return 0;
     }
 
-  if (!(tblptr || NAME(aout,slurp_reloc_table)(abfd, section, symbols)))
+  if (!(tblptr || NAME(aout,slurp_reloc_table) (abfd, section, symbols)))
     return -1;
 
   if (section->flags & SEC_CONSTRUCTOR) {
@@ -2540,13 +2544,12 @@
 NAME(aout,get_symtab_upper_bound) (abfd)
      bfd *abfd;
 {
-  if (!NAME(aout,slurp_symbol_table)(abfd))
+  if (!NAME(aout,slurp_symbol_table) (abfd))
     return -1;
 
   return (bfd_get_symcount (abfd)+1) * (sizeof (aout_symbol_type *));
 }
 
-/*ARGSUSED*/
  alent *
 NAME(aout,get_lineno) (ignore_abfd, ignore_symbol)
      bfd *ignore_abfd ATTRIBUTE_UNUSED;
@@ -2555,7 +2558,6 @@
   return (alent *)NULL;
 }
 
-/*ARGSUSED*/
 void
 NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret)
      bfd *ignore_abfd ATTRIBUTE_UNUSED;
@@ -2572,18 +2574,17 @@
 
       if (stab_name == NULL)
 	{
-	  sprintf(buf, "(%d)", type_code);
+	  sprintf (buf, "(%d)", type_code);
 	  stab_name = buf;
 	}
       ret->type = '-';
       ret->stab_type = type_code;
-      ret->stab_other = (unsigned)(aout_symbol(symbol)->other & 0xff);
-      ret->stab_desc = (unsigned)(aout_symbol(symbol)->desc & 0xffff);
+      ret->stab_other = (unsigned) (aout_symbol(symbol)->other & 0xff);
+      ret->stab_desc = (unsigned) (aout_symbol(symbol)->desc & 0xffff);
       ret->stab_name = stab_name;
     }
 }
 
-/*ARGSUSED*/
 void
 NAME(aout,print_symbol) (ignore_abfd, afile, symbol, how)
      bfd *ignore_abfd ATTRIBUTE_UNUSED;
@@ -2596,27 +2597,26 @@
   switch (how) {
   case bfd_print_symbol_name:
     if (symbol->name)
-      fprintf(file,"%s", symbol->name);
+      fprintf (file,"%s", symbol->name);
     break;
   case bfd_print_symbol_more:
-    fprintf(file,"%4x %2x %2x",(unsigned)(aout_symbol(symbol)->desc & 0xffff),
-	    (unsigned)(aout_symbol(symbol)->other & 0xff),
-	    (unsigned)(aout_symbol(symbol)->type));
+    fprintf (file,"%4x %2x %2x",(unsigned) (aout_symbol(symbol)->desc & 0xffff),
+	    (unsigned) (aout_symbol(symbol)->other & 0xff),
+	    (unsigned) (aout_symbol(symbol)->type));
     break;
   case bfd_print_symbol_all:
     {
    CONST char *section_name = symbol->section->name;
 
-
       bfd_print_symbol_vandf((PTR)file,symbol);
 
-      fprintf(file," %-5s %04x %02x %02x",
+      fprintf (file," %-5s %04x %02x %02x",
 	      section_name,
-	      (unsigned)(aout_symbol(symbol)->desc & 0xffff),
-	      (unsigned)(aout_symbol(symbol)->other & 0xff),
-	      (unsigned)(aout_symbol(symbol)->type  & 0xff));
+	      (unsigned) (aout_symbol(symbol)->desc & 0xffff),
+	      (unsigned) (aout_symbol(symbol)->other & 0xff),
+	      (unsigned) (aout_symbol(symbol)->type  & 0xff));
       if (symbol->name)
-        fprintf(file," %s", symbol->name);
+        fprintf (file," %s", symbol->name);
     }
     break;
   }
@@ -2716,8 +2716,8 @@
   CONST char *directory_name = NULL;
   CONST char *main_file_name = NULL;
   CONST char *current_file_name = NULL;
-  CONST char *line_file_name = NULL; /* Value of current_file_name at line number. */
-  CONST char *line_directory_name = NULL; /* Value of directory_name at line number. */
+  CONST char *line_file_name = NULL; /* Value of current_file_name at line number.  */
+  CONST char *line_directory_name = NULL; /* Value of directory_name at line number.  */
   bfd_vma low_line_vma = 0;
   bfd_vma low_func_vma = 0;
   asymbol *func = 0;
@@ -2729,7 +2729,7 @@
   *line_ptr = 0;
   if (symbols != (asymbol **)NULL) {
     for (p = symbols; *p; p++) {
-      aout_symbol_type  *q = (aout_symbol_type *)(*p);
+      aout_symbol_type  *q = (aout_symbol_type *) (*p);
     next:
       switch (q->type){
       case N_TEXT:
@@ -2776,15 +2776,15 @@
 	  }
 
 	main_file_name = current_file_name = q->symbol.name;
-	/* Look ahead to next symbol to check if that too is an N_SO. */
+	/* Look ahead to next symbol to check if that too is an N_SO.  */
 	p++;
 	if (*p == NULL)
 	  break;
-	q = (aout_symbol_type *)(*p);
+	q = (aout_symbol_type *) (*p);
 	if (q->type != (int)N_SO)
 	  goto next;
 
-	/* Found a second N_SO  First is directory; second is filename. */
+	/* Found a second N_SO  First is directory; second is filename.  */
 	directory_name = current_file_name;
 	main_file_name = current_file_name = q->symbol.name;
 	if (obj_textsec(abfd) != section)
@@ -2892,7 +2892,6 @@
   return true;
 }
 
-/*ARGSUSED*/
 int
 NAME(aout,sizeof_headers) (abfd, execable)
      bfd *abfd;
@@ -4136,7 +4135,7 @@
 	  /* We have saved the hash table entry for this symbol, if
 	     there is one.  Note that we could just look it up again
 	     in the hash table, provided we first check that it is an
-	     external symbol. */
+	     external symbol.  */
 	  h = *sym_hash;
 
 	  /* Use the name from the hash table, in case the symbol was
@@ -4800,7 +4799,7 @@
 
 #ifdef MY_reloc_howto
       howto = MY_reloc_howto(input_bfd, rel, r_index, r_extern, r_pcrel);
-#else      
+#else
       {
 	int r_jmptable;
 	int r_relative;
diff --git a/bfd/archive.c b/bfd/archive.c
index 5709f26..14dc770 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -152,10 +152,8 @@
    the cache when we actually read one.  We also don't sort the cache;
    it's generally short enough to search linearly.
    Note that the pointers here point to the front of the ar_hdr, not
-   to the front of the contents!
-*/
-struct ar_cache
-{
+   to the front of the contents!  */
+struct ar_cache {
   file_ptr ptr;
   bfd *arelt;
   struct ar_cache *next;
@@ -164,7 +162,7 @@
 #define ar_padchar(abfd) ((abfd)->xvec->ar_pad_char)
 #define ar_maxnamelen(abfd) ((abfd)->xvec->ar_max_namelen)
 
-#define arch_eltdata(bfd) ((struct areltdata *)((bfd)->arelt_data))
+#define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data))
 #define arch_hdr(bfd) ((struct ar_hdr *)arch_eltdata(bfd)->arch_header)
 
 static char *get_extended_arelt_filename PARAMS ((bfd *arch,
@@ -316,7 +314,7 @@
 }
 
 /* The name begins with space.  Hence the rest of the name is an index into
-   the string table. */
+   the string table.  */
 
 static char *
 get_extended_arelt_filename (arch, name)
@@ -326,9 +324,9 @@
   unsigned long index = 0;
 
   /* Should extract string so that I can guarantee not to overflow into
-     the next region, but I'm too lazy. */
+     the next region, but I'm too lazy.  */
   errno = 0;
-  /* Skip first char, which is '/' in SVR4 or ' ' in some other variants. */
+  /* Skip first char, which is '/' in SVR4 or ' ' in some other variants.  */
   index = strtol (name + 1, NULL, 10);
   if (errno != 0)
     {
@@ -411,7 +409,7 @@
 	}
     }
   /* BSD4.4-style long filename.
-     Only implemented for reading, so far! */
+     Only implemented for reading, so far!  */
   else if (hdr.ar_name[0] == '#'
 	   && hdr.ar_name[1] == '1'
 	   && hdr.ar_name[2] == '/'
@@ -440,15 +438,15 @@
     {
       /* We judge the end of the name by looking for '/' or ' '.
 	 Note:  The SYSV format (terminated by '/') allows embedded
-	 spaces, so only look for ' ' if we don't find '/'. */
+	 spaces, so only look for ' ' if we don't find '/'.  */
 
       char *e;
       e = memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd));
       if (e == NULL)
 	{
-          e = memchr (hdr.ar_name, '/', ar_maxnamelen (abfd));
+	  e = memchr (hdr.ar_name, '/', ar_maxnamelen (abfd));
 	  if (e == NULL)
-            e = memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd));
+	    e = memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd));
 	}
 
       if (e != NULL)
@@ -526,7 +524,7 @@
   if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_nfd))
     return n_nfd;
 
-  /* huh? */
+  /* Huh?  */
   bfd_release (archive, (PTR) n_nfd);
   bfd_release (archive, (PTR) new_areldata);
   return NULL;
@@ -560,7 +558,6 @@
 	the archive and the previous return value to return a created
 	BFD to the next contained element. NULL is returned when there
 	are no more.
-
 */
 
 bfd *
@@ -595,7 +592,7 @@
       unsigned int size = arelt_size (last_file);
       /* Pad to an even boundary...
 	 Note that last_file->origin can be odd in the case of
-	 BSD-4.4-style element with a long odd size. */
+	 BSD-4.4-style element with a long odd size.  */
       filestart = last_file->origin + size;
       filestart += filestart % 2;
     }
@@ -603,7 +600,6 @@
   return _bfd_get_elt_at_filepos (archive, filestart);
 }
 
-
 const bfd_target *
 bfd_generic_archive_p (abfd)
      bfd *abfd;
@@ -630,7 +626,7 @@
 #endif
 
   /* We are setting bfd_ardata(abfd) here, but since bfd_ardata
-     involves a cast, we can't do it as the left operand of assignment. */
+     involves a cast, we can't do it as the left operand of assignment.  */
   abfd->tdata.aout_ar_data = ((struct artdata *)
 			      bfd_zalloc (abfd, sizeof (struct artdata)));
 
@@ -737,7 +733,7 @@
   if (mapdata == NULL)
     return false;
   parsed_size = mapdata->parsed_size;
-  bfd_release (abfd, (PTR) mapdata);	/* Don't need it any more. */
+  bfd_release (abfd, (PTR) mapdata);	/* Don't need it any more.  */
 
   raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size);
   if (raw_armap == (bfd_byte *) NULL)
@@ -782,16 +778,17 @@
     }
 
   ardata->first_file_filepos = bfd_tell (abfd);
-  /* Pad to an even boundary if you have to */
+  /* Pad to an even boundary if you have to.  */
   ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
   /* FIXME, we should provide some way to free raw_ardata when
      we are done using the strings from it.  For now, it seems
-     to be allocated on an objalloc anyway... */
+     to be allocated on an objalloc anyway...  */
   bfd_has_map (abfd) = true;
   return true;
 }
 
-/* Returns false on error, true otherwise */
+/* Returns false on error, true otherwise.  */
+
 static boolean
 do_slurp_coff_armap (abfd)
      bfd *abfd;
@@ -803,7 +800,7 @@
   unsigned int stringsize;
   unsigned int parsed_size;
   carsym *carsyms;
-  unsigned int nsymz;		/* Number of symbols in armap. */
+  unsigned int nsymz;		/* Number of symbols in armap.  */
   bfd_vma (*swap) PARAMS ((const bfd_byte *));
   char int_buf[sizeof (long)];
   unsigned int carsym_size, ptrsize, i;
@@ -812,7 +809,7 @@
   if (mapdata == NULL)
     return false;
   parsed_size = mapdata->parsed_size;
-  bfd_release (abfd, (PTR) mapdata);	/* Don't need it any more. */
+  bfd_release (abfd, (PTR) mapdata);	/* Don't need it any more.  */
 
   if (bfd_read ((PTR) int_buf, 1, 4, abfd) != 4)
     {
@@ -821,7 +818,7 @@
       return false;
     }
   /* It seems that all numeric information in a coff archive is always
-     in big endian format, nomatter the host or target. */
+     in big endian format, nomatter the host or target.  */
   swap = bfd_getb32;
   nsymz = bfd_getb32 ((PTR) int_buf);
   stringsize = parsed_size - (4 * nsymz) - 4;
@@ -836,7 +833,7 @@
       && bfd_get_arch (abfd) == bfd_arch_i960
       && bfd_get_flavour (abfd) == bfd_target_coff_flavour)
     {
-      /* This looks dangerous, let's do it the other way around */
+      /* This looks dangerous, let's do it the other way around.  */
       nsymz = bfd_getl32 ((PTR) int_buf);
       stringsize = parsed_size - (4 * nsymz) - 4;
       swap = bfd_getl32;
@@ -844,7 +841,7 @@
 #endif
 
   /* The coff armap must be read sequentially.  So we construct a
-     bsd-style one in core all at once, for simplicity. */
+     bsd-style one in core all at once, for simplicity.  */
 
   carsym_size = (nsymz * sizeof (carsym));
   ptrsize = (4 * nsymz);
@@ -855,7 +852,7 @@
   carsyms = ardata->symdefs;
   stringbase = ((char *) ardata->symdefs) + carsym_size;
 
-  /* Allocate and read in the raw offsets. */
+  /* Allocate and read in the raw offsets.  */
   raw_armap = (int *) bfd_alloc (abfd, ptrsize);
   if (raw_armap == NULL)
     goto release_symdefs;
@@ -867,7 +864,7 @@
       goto release_raw_armap;
     }
 
-  /* OK, build the carsyms */
+  /* OK, build the carsyms.  */
   for (i = 0; i < nsymz; i++)
     {
       rawptr = raw_armap + i;
@@ -880,15 +877,13 @@
 
   ardata->symdef_count = nsymz;
   ardata->first_file_filepos = bfd_tell (abfd);
-  /* Pad to an even boundary if you have to */
+  /* Pad to an even boundary if you have to.  */
   ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
 
-
   bfd_has_map (abfd) = true;
   bfd_release (abfd, (PTR) raw_armap);
 
-
-  /* Check for a second archive header (as used by PE) */
+  /* Check for a second archive header (as used by PE).  */
   {
     struct areltdata *tmp;
 
@@ -900,7 +895,7 @@
 	    && tmp->arch_header[1] == ' ')
 	  {
 	    ardata->first_file_filepos +=
-	      (tmp->parsed_size + sizeof(struct ar_hdr) + 1) & ~1;
+	      (tmp->parsed_size + sizeof (struct ar_hdr) + 1) & ~1;
 	  }
 	bfd_release (abfd, tmp);
       }
@@ -952,7 +947,7 @@
 /* Returns false on error, true otherwise */
 /* flavor 2 of a bsd armap, similar to bfd_slurp_bsd_armap except the
    header is in a slightly different order and the map name is '/'.
-   This flavour is used by hp300hpux. */
+   This flavour is used by hp300hpux.  */
 
 #define HPUX_SYMDEF_COUNT_SIZE 2
 
@@ -975,7 +970,7 @@
   if (i != 16)
     return false;
 
-  /* The archive has at least 16 bytes in it */
+  /* The archive has at least 16 bytes in it.  */
   if (bfd_seek (abfd, -16L, SEEK_CUR) != 0)
     return false;
 
@@ -1024,7 +1019,7 @@
   ardata->cache = 0;
 
   stringsize = bfd_h_get_32 (abfd, raw_armap + HPUX_SYMDEF_COUNT_SIZE);
-  /* skip sym count and string sz */
+  /* Skip sym count and string sz.  */
   stringbase = ((char *) raw_armap
 		+ HPUX_SYMDEF_COUNT_SIZE
 		+ BSD_STRING_COUNT_SIZE);
@@ -1044,11 +1039,11 @@
     }
 
   ardata->first_file_filepos = bfd_tell (abfd);
-  /* Pad to an even boundary if you have to */
+  /* Pad to an even boundary if you have to.  */
   ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
   /* FIXME, we should provide some way to free raw_ardata when
      we are done using the strings from it.  For now, it seems
-     to be allocated on an objalloc anyway... */
+     to be allocated on an objalloc anyway...  */
   bfd_has_map (abfd) = true;
   return true;
 }
@@ -1061,9 +1056,10 @@
   element (the first in the archive, or second if there is an armap);
   the name in the ar_hdr is replaced by <space><index into filename
   element>.  Index is the P.R. of an int (decimal).  Data General have
-  extended the format by using the prefix // for the special element */
+  extended the format by using the prefix // for the special element.  */
 
-/* Returns false on error, true otherwise */
+/* Returns false on error, true otherwise.  */
+
 boolean
 _bfd_slurp_extended_name_table (abfd)
      bfd *abfd;
@@ -1117,22 +1113,25 @@
       {
 	char *temp = bfd_ardata (abfd)->extended_names;
 	char *limit = temp + namedata->parsed_size;
-	for (; temp < limit; ++temp) {
-	  if (*temp == '\012')
-	    temp[temp[-1] == '/' ? -1 : 0] = '\0';
-	  if (*temp == '\\')
-	    *temp = '/';
-	}
+	for (; temp < limit; ++temp)
+	  {
+	    if (*temp == '\012')
+	      temp[temp[-1] == '/' ? -1 : 0] = '\0';
+	    if (*temp == '\\')
+	      *temp = '/';
+	  }
       }
 
-      /* Pad to an even boundary if you have to */
+      /* Pad to an even boundary if you have to.  */
       bfd_ardata (abfd)->first_file_filepos = bfd_tell (abfd);
       bfd_ardata (abfd)->first_file_filepos +=
 	(bfd_ardata (abfd)->first_file_filepos) % 2;
 
       /* FIXME, we can't release namedata here because it was allocated
-	 below extended_names on the objalloc... */
-      /* bfd_release (abfd, namedata); */
+	 below extended_names on the objalloc...  */
+#if 0
+      bfd_release (abfd, namedata);
+#endif
     }
   return true;
 }
@@ -1140,7 +1139,8 @@
 #ifdef VMS
 
 /* Return a copy of the stuff in the filename between any :]> and a
-   semicolon */
+   semicolon.  */
+
 static const char *
 normalize (abfd, file)
      bfd *abfd;
@@ -1183,12 +1183,11 @@
 {
   const char *filename = strrchr (file, '/');
 
-
 #ifdef HAVE_DOS_BASED_FILE_SYSTEM
   {
     /* We could have foo/bar\\baz, or foo\\bar, or d:bar.  */
     char *bslash = strrchr (file, '\\');
-    if (bslash > filename)
+    if (filename == NULL || (bslash != NULL && bslash > filename))
       filename = bslash;
     if (filename == NULL && file[0] != '\0' && file[1] == ':')
       filename = file + 1;
@@ -1250,7 +1249,7 @@
 
   *tablen = 0;
 
-  /* Figure out how long the table should be */
+  /* Figure out how long the table should be.  */
   for (current = abfd->archive_head; current != NULL; current = current->next)
     {
       const char *normal;
@@ -1318,7 +1317,7 @@
 	{
 	  /* Works for now; may need to be re-engineered if we
 	     encounter an oddball archive format and want to
-	     generalise this hack. */
+	     generalise this hack.  */
 	  struct ar_hdr *hdr = arch_hdr (current);
 	  strcpy (strptr, normal);
 	  if (! trailing_slash)
@@ -1330,10 +1329,10 @@
 	    }
 	  hdr->ar_name[0] = ar_padchar (current);
 	  /* We know there will always be enough room (one of the few
-	     cases where you may safely use sprintf). */
+	     cases where you may safely use sprintf).  */
 	  sprintf ((hdr->ar_name) + 1, "%-d", (unsigned) (strptr - *tabloc));
 	  /* Kinda Kludgy.  We should just use the returned value of
-	     sprintf but not all implementations get this right */
+	     sprintf but not all implementations get this right.  */
 	  {
 	    char *temp = hdr->ar_name + 2;
 	    for (; temp < hdr->ar_name + maxname; temp++)
@@ -1353,6 +1352,7 @@
 
 #ifdef HPUX_LARGE_AR_IDS
 /* Function to encode large UID/GID values according to HP.  */
+
 static void
 hpux_uid_gid_encode (str, id)
      char str[6];
@@ -1379,7 +1379,7 @@
 /* Takes a filename, returns an arelt_data for it, or NULL if it can't
    make one.  The filename must refer to a filename in the filesystem.
    The filename field of the ar_hdr will NOT be initialized.  If member
-   is set, and it's an in-memory bfd, we fake it. */
+   is set, and it's an in-memory bfd, we fake it.  */
 
 static struct areltdata *
 bfd_ar_hdr_from_filesystem (abfd, filename, member)
@@ -1394,11 +1394,11 @@
 
   if (member && (member->flags & BFD_IN_MEMORY) != 0)
     {
-      /* Assume we just "made" the member, and fake it */
+      /* Assume we just "made" the member, and fake it.  */
       struct bfd_in_memory *bim = (struct bfd_in_memory *) member->iostream;
-      time(&status.st_mtime);
-      status.st_uid = getuid();
-      status.st_gid = getgid();
+      time (&status.st_mtime);
+      status.st_uid = getuid ();
+      status.st_gid = getgid ();
       status.st_mode = 0644;
       status.st_size = bim->size;
     }
@@ -1414,12 +1414,12 @@
     return NULL;
   hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata));
 
-  /* ar headers are space padded, not null padded! */
+  /* ar headers are space padded, not null padded!  */
   memset ((PTR) hdr, ' ', sizeof (struct ar_hdr));
 
   strncpy (hdr->ar_fmag, ARFMAG, 2);
 
-  /* Goddamned sprintf doesn't permit MAXIMUM field lengths */
+  /* Goddamned sprintf doesn't permit MAXIMUM field lengths.  */
   sprintf ((hdr->ar_date), "%-12ld", (long) status.st_mtime);
 #ifdef HPUX_LARGE_AR_IDS
   /* HP has a very "special" way to handle UID/GID's with numeric values
@@ -1441,7 +1441,7 @@
   sprintf ((hdr->ar_size), "%-10ld", (long) status.st_size);
   /* Correct for a lossage in sprintf whereby it null-terminates.  I cannot
      understand how these C losers could design such a ramshackle bunch of
-     IO operations */
+     IO operations.  */
   temp = (char *) hdr;
   temp1 = temp + sizeof (struct ar_hdr) - 2;
   for (; temp < temp1; temp++)
@@ -1457,9 +1457,9 @@
 }
 
 /* This is magic required by the "ar" program.  Since it's
-    undocumented, it's undocumented.  You may think that it would take
-    a strong stomach to write this, and it does, but it takes even a
-    stronger stomach to try to code around such a thing!  */
+   undocumented, it's undocumented.  You may think that it would take
+   a strong stomach to write this, and it does, but it takes even a
+   stronger stomach to try to code around such a thing!  */
 
 struct ar_hdr *bfd_special_undocumented_glue PARAMS ((bfd *, const char *));
 
@@ -1474,8 +1474,8 @@
   return (struct ar_hdr *) ar_elt->arch_header;
 }
 
+/* Analogous to stat call.  */
 
-/* Analogous to stat call */
 int
 bfd_generic_stat_arch_elt (abfd, buf)
      bfd *abfd;
@@ -1492,26 +1492,33 @@
 
   hdr = arch_hdr (abfd);
 
-#define foo(arelt, stelt, size)  \
-  buf->stelt = strtol (hdr->arelt, &aloser, size); \
-  if (aloser == hdr->arelt) return -1;
+#define foo(arelt, stelt, size)				\
+  buf->stelt = strtol (hdr->arelt, &aloser, size);	\
+  if (aloser == hdr->arelt)	      			\
+    return -1;
+
   /* Some platforms support special notations for large IDs.  */
 #ifdef HPUX_LARGE_AR_IDS
-# define foo2(arelt, stelt, size) \
-  if (hdr->arelt[5] == ' ') { foo (arelt, stelt, size); } \
-  else { \
-    int cnt; \
-    for (buf->stelt = cnt = 0; cnt < 5; ++cnt) \
-      { \
-	if (hdr->arelt[cnt] < ' ' || hdr->arelt[cnt] > ' ' + 0x3f) \
-	  return -1; \
-	buf->stelt <<= 6; \
-	buf->stelt += hdr->arelt[cnt] - ' '; \
-      } \
-    if (hdr->arelt[5] < '@' || hdr->arelt[5] > '@' + 3) return -1; \
-    buf->stelt <<= 2; \
-    buf->stelt += hdr->arelt[5] - '@'; \
-  }
+# define foo2(arelt, stelt, size)					\
+  if (hdr->arelt[5] == ' ')						\
+    {									\
+      foo (arelt, stelt, size);						\
+    }									\
+  else									\
+    {									\
+      int cnt;								\
+      for (buf->stelt = cnt = 0; cnt < 5; ++cnt)			\
+	{								\
+	  if (hdr->arelt[cnt] < ' ' || hdr->arelt[cnt] > ' ' + 0x3f)	\
+	    return -1;							\
+	  buf->stelt <<= 6;						\
+	  buf->stelt += hdr->arelt[cnt] - ' ';				\
+	}								\
+      if (hdr->arelt[5] < '@' || hdr->arelt[5] > '@' + 3)		\
+	return -1;							\
+      buf->stelt <<= 2;							\
+      buf->stelt += hdr->arelt[5] - '@';				\
+    }
 #else
 # define foo2(arelt, stelt, size) foo (arelt, stelt, size)
 #endif
@@ -1535,7 +1542,7 @@
   /* FIXME: This interacts unpleasantly with ar's quick-append option.
      Fortunately ic960 users will never use that option.  Fixing this
      is very hard; fortunately I know how to do it and will do so once
-     intel's release is out the door. */
+     intel's release is out the door.  */
 
   struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
   size_t length;
@@ -1581,7 +1588,7 @@
   {
     /* We could have foo/bar\\baz, or foo\\bar, or d:bar.  */
     char *bslash = strrchr (pathname, '\\');
-    if (bslash > filename)
+    if (filename == NULL || (bslash != NULL && bslash > filename))
       filename = bslash;
     if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':')
       filename = pathname + 1;
@@ -1615,7 +1622,7 @@
    4> truncate it before the .o, append .o, stuff THAT in.  */
 
 /* This is what gnu ar does.  It's better but incompatible with the
-   bsd ar. */
+   bsd ar.  */
 
 void
 bfd_gnu_truncate_arname (abfd, pathname, arhdr)
@@ -1632,7 +1639,7 @@
   {
     /* We could have foo/bar\\baz, or foo\\bar, or d:bar.  */
     char *bslash = strrchr (pathname, '\\');
-    if (bslash > filename)
+    if (filename == NULL || (bslash != NULL && bslash > filename))
       filename = bslash;
     if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':')
       filename = pathname + 1;
@@ -1663,7 +1670,7 @@
     (hdr->ar_name)[length] = ar_padchar (abfd);
 }
 
-/* The BFD is open for write and has its format set to bfd_archive */
+/* The BFD is open for write and has its format set to bfd_archive.  */
 
 boolean
 _bfd_write_archive_contents (arch)
@@ -1674,7 +1681,7 @@
   bfd_size_type elength = 0;
   const char *ename = NULL;
   boolean makemap = bfd_has_map (arch);
-  boolean hasobjects = false;	/* if no .o's, don't bother to make a map */
+  boolean hasobjects = false;	/* If no .o's, don't bother to make a map.  */
   bfd_size_type wrote;
   unsigned int i;
   int tries;
@@ -1684,6 +1691,11 @@
      then construct a fresh ar_hdr for them.  */
   for (current = arch->archive_head; current; current = current->next)
     {
+      /* This check is checking the bfds for the objects we're reading
+	 from (which are usually either an object file or archive on
+	 disk), not the archive entries we're writing to.  We don't
+	 actually create bfds for the archive members, we just copy
+	 them byte-wise when we write out the archive.  */
       if (bfd_write_p (current))
 	{
 	  bfd_set_error (bfd_error_invalid_operation);
@@ -1696,14 +1708,14 @@
 	  if (!current->arelt_data)
 	    return false;
 
-	  /* Put in the file name */
+	  /* Put in the file name.  */
 	  BFD_SEND (arch, _bfd_truncate_arname, (arch,
 						 current->filename,
 					      (char *) arch_hdr (current)));
 	}
 
       if (makemap && ! hasobjects)
-	{			/* don't bother if we won't make a map! */
+	{			/* Don't bother if we won't make a map!  */
 	  if ((bfd_check_format (current, bfd_object))
 #if 0				/* FIXME -- these are not set correctly */
 	      && ((bfd_get_file_flags (current) & HAS_SYMS))
@@ -1763,7 +1775,7 @@
       unsigned int remaining = arelt_size (current);
       struct ar_hdr *hdr = arch_hdr (current);
 
-      /* write ar header */
+      /* Write ar header.  */
       if (bfd_write ((char *) hdr, 1, sizeof (*hdr), arch) != sizeof (*hdr))
 	return false;
       if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0)
@@ -1813,7 +1825,7 @@
   return true;
 }
 
-/* Note that the namidx for the first symbol is 0 */
+/* Note that the namidx for the first symbol is 0.  */
 
 boolean
 _bfd_compute_and_write_armap (arch, elength)
@@ -1831,7 +1843,7 @@
   long syms_max = 0;
   boolean ret;
 
-  /* Dunno if this is the best place for this info... */
+  /* Dunno if this is the best place for this info...  */
   if (elength != 0)
     elength += sizeof (struct ar_hdr);
   elength += elength % 2;
@@ -1846,13 +1858,12 @@
   if (first_name == NULL)
     goto error_return;
 
-  /* Drop all the files called __.SYMDEF, we're going to make our
-     own */
+  /* Drop all the files called __.SYMDEF, we're going to make our own.  */
   while (arch->archive_head &&
 	 strcmp (arch->archive_head->filename, "__.SYMDEF") == 0)
     arch->archive_head = arch->archive_head->next;
 
-  /* Map over each element */
+  /* Map over each element.  */
   for (current = arch->archive_head;
        current != (bfd *) NULL;
        current = current->next, elt_no++)
@@ -1883,7 +1894,8 @@
 	      if (symcount < 0)
 		goto error_return;
 
-	      /* Now map over all the symbols, picking out the ones we want */
+	      /* Now map over all the symbols, picking out the ones we
+                 want.  */
 	      for (src_count = 0; src_count < symcount; src_count++)
 		{
 		  flagword flags = (syms[src_count])->flags;
@@ -1898,7 +1910,7 @@
 		      size_t namelen;
 		      struct orl *new_map;
 
-		      /* This symbol will go into the archive header */
+		      /* This symbol will go into the archive header.  */
 		      if (orl_count == orl_max)
 			{
 			  orl_max *= 2;
@@ -1937,7 +1949,7 @@
 	}
     }
 
-  /* OK, now we have collected all the data, let's write them out */
+  /* OK, now we have collected all the data, let's write them out.  */
   ret = BFD_SEND (arch, write_armap,
 		  (arch, elength, map, orl_count, stridx));
 
@@ -1972,7 +1984,7 @@
   int padit = stridx & 1;
   unsigned int ranlibsize = orl_count * BSD_SYMDEF_SIZE;
   unsigned int stringsize = stridx + padit;
-  /* Include 8 bytes to store ranlibsize and stringsize in output. */
+  /* Include 8 bytes to store ranlibsize and stringsize in output.  */
   unsigned int mapsize = ranlibsize + stringsize + 8;
   file_ptr firstreal;
   bfd *current = arch->archive_head;
@@ -2029,7 +2041,7 @@
 	return false;
     }
 
-  /* now write the strings themselves */
+  /* Now write the strings themselves.  */
   bfd_h_put_32 (arch, stringsize, temp);
   if (bfd_write (temp, 1, sizeof (temp), arch) != sizeof (temp))
     return false;
@@ -2042,7 +2054,7 @@
     }
 
   /* The spec sez this should be a newline.  But in order to be
-     bug-compatible for sun's ar we use a null. */
+     bug-compatible for sun's ar we use a null.  */
   if (padit)
     {
       if (bfd_write ("", 1, 1, arch) != 1)
@@ -2072,10 +2084,13 @@
   if (bfd_stat (arch, &archstat) == -1)
     {
       perror (_("Reading archive file mod timestamp"));
-      return true;		/* Can't read mod time for some reason */
+
+      /* Can't read mod time for some reason.  */
+      return true;
     }
   if (archstat.st_mtime <= bfd_ardata (arch)->armap_timestamp)
-    return true;		/* OK by the linker's rules */
+    /* OK by the linker's rules.  */
+    return true;
 
   /* Update the timestamp.  */
   bfd_ardata (arch)->armap_timestamp = archstat.st_mtime + ARMAP_TIME_OFFSET;
@@ -2096,10 +2111,13 @@
     {
       /* FIXME: bfd can't call perror.  */
       perror (_("Writing updated armap timestamp"));
-      return true;		/* Some error while writing */
+
+      /* Some error while writing.  */
+      return true;
     }
 
-  return false;			/* We updated the timestamp successfully.  */
+  /* We updated the timestamp successfully.  */
+  return false;
 }
 
 /* A coff armap looks like :
@@ -2125,7 +2143,7 @@
      int stridx;
 {
   /* The size of the ranlib is the number of exported symbols in the
-     archive * the number of bytes in a int, + an int for the count */
+     archive * the number of bytes in a int, + an int for the count.  */
   unsigned int ranlibsize = (symbol_count * 4) + 4;
   unsigned int stringsize = stridx;
   unsigned int mapsize = stringsize + ranlibsize;
@@ -2139,7 +2157,7 @@
   if (padit)
     mapsize++;
 
-  /* work out where the first object file will go in the archive */
+  /* Work out where the first object file will go in the archive.  */
   archive_member_file_ptr = (mapsize
 			     + elength
 			     + sizeof (struct ar_hdr)
@@ -2149,7 +2167,7 @@
   hdr.ar_name[0] = '/';
   sprintf (hdr.ar_size, "%-10d", (int) mapsize);
   sprintf (hdr.ar_date, "%ld", (long) time (NULL));
-  /* This, at least, is what Intel coff sets the values to.: */
+  /* This, at least, is what Intel coff sets the values to.  */
   sprintf ((hdr.ar_uid), "%d", 0);
   sprintf ((hdr.ar_gid), "%d", 0);
   sprintf ((hdr.ar_mode), "%-7o", (unsigned) 0);
@@ -2159,7 +2177,7 @@
     if (((char *) (&hdr))[i] == '\0')
       (((char *) (&hdr))[i]) = ' ';
 
-  /* Write the ar header for this item and the number of symbols */
+  /* Write the ar header for this item and the number of symbols.  */
 
   if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), arch)
       != sizeof (struct ar_hdr))
@@ -2177,23 +2195,23 @@
   count = 0;
   while (current != (bfd *) NULL && count < symbol_count)
     {
-      /* For each symbol which is used defined in this object, write out
-	 the object file's address in the archive */
+      /* For each symbol which is used defined in this object, write
+	 out the object file's address in the archive.  */
 
-      while (((bfd *) (map[count]).pos) == current)
+      while (count < symbol_count && ((bfd *) (map[count]).pos) == current)
 	{
 	  bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr);
 	  count++;
 	}
-      /* Add size of this archive entry */
+      /* Add size of this archive entry.  */
       archive_member_file_ptr += (arelt_size (current)
 				  + sizeof (struct ar_hdr));
-      /* remember aboout the even alignment */
+      /* Remember aboout the even alignment.  */
       archive_member_file_ptr += archive_member_file_ptr % 2;
       current = current->next;
     }
 
-  /* now write the strings themselves */
+  /* Now write the strings themselves.  */
   for (count = 0; count < symbol_count; count++)
     {
       size_t len = strlen (*map[count].name) + 1;
@@ -2203,7 +2221,7 @@
     }
 
   /* The spec sez this should be a newline.  But in order to be
-     bug-compatible for arc960 we use a null. */
+     bug-compatible for arc960 we use a null.  */
   if (padit)
     {
       if (bfd_write ("", 1, 1, arch) != 1)
diff --git a/bfd/archures.c b/bfd/archures.c
index 536f2b1..5bc744a 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -31,7 +31,7 @@
 
 	BFD keeps one atom in a BFD describing the
 	architecture of the data attached to the BFD: a pointer to a
-	<<bfd_arch_info_type>>.  
+	<<bfd_arch_info_type>>.
 
 	Pointers to structures can be requested independently of a BFD
 	so that an architecture's information can be interrogated
@@ -41,13 +41,13 @@
 	The set of default architectures is selected by the macro
 	<<SELECT_ARCHITECTURES>>.  This is normally set up in the
 	@file{config/@var{target}.mt} file of your choice.  If the name is not
-	defined, then all the architectures supported are included. 
+	defined, then all the architectures supported are included.
 
 	When BFD starts up, all the architectures are called with an
 	initialize method.  It is up to the architecture back end to
 	insert as many items into the list of architectures as it wants to;
 	generally this would be one for each machine and one for the
-	default case (an item with a machine field of 0). 
+	default case (an item with a machine field of 0).
 
 	BFD's idea of an architecture is implemented in	@file{archures.c}.
 */
@@ -64,9 +64,9 @@
 	the family is in use.  The machine gives a number which
 	distinguishes different versions of the architecture,
 	containing, for example, 2 and 3 for Intel i960 KA and i960 KB,
-	and 68020 and 68030 for Motorola 68020 and 68030. 
+	and 68020 and 68030 for Motorola 68020 and 68030.
 
-.enum bfd_architecture 
+.enum bfd_architecture
 .{
 .  bfd_arch_unknown,   {* File arch not known *}
 .  bfd_arch_obscure,   {* Arch known, not one of these *}
@@ -79,14 +79,14 @@
 .#define bfd_mach_m68040 6
 .#define bfd_mach_m68060 7
 .#define bfd_mach_cpu32  8
-.  bfd_arch_vax,       {* DEC Vax *}   
+.  bfd_arch_vax,       {* DEC Vax *}
 .  bfd_arch_i960,      {* Intel 960 *}
 .    {* The order of the following is important.
-.       lower number indicates a machine type that 
+.       lower number indicates a machine type that
 .       only accepts a subset of the instructions
 .       available to machines with higher numbers.
 .       The exception is the "ca", which is
-.       incompatible with all other machines except 
+.       incompatible with all other machines except
 .       "core". *}
 .
 .#define bfd_mach_i960_core      1
@@ -109,9 +109,12 @@
 .#define bfd_mach_sparc_sparclite_le	6
 .#define bfd_mach_sparc_v9		7
 .#define bfd_mach_sparc_v9a		8 {* with ultrasparc add'ns *}
+.#define bfd_mach_sparc_v8plusb		9 {* with cheetah add'ns *}
+.#define bfd_mach_sparc_v9b		10 {* with cheetah add'ns *}
 .{* Nonzero if MACH has the v9 instruction set.  *}
 .#define bfd_mach_sparc_v9_p(mach) \
-.  ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a)
+.  ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
+.   && (mach) != bfd_mach_sparc_sparclite_le)
 .  bfd_arch_mips,      {* MIPS Rxxxx *}
 .#define bfd_mach_mips3000		3000
 .#define bfd_mach_mips3900		3900
@@ -128,10 +131,17 @@
 .#define bfd_mach_mips8000		8000
 .#define bfd_mach_mips10000		10000
 .#define bfd_mach_mips16		16
+.#define bfd_mach_mips32                32
+.#define bfd_mach_mips32_4k             3204113 {* 32, 04, octal 'K' *}
+.#define bfd_mach_mips5                 5
+.#define bfd_mach_mips64                64
+.#define bfd_mach_mips_sb1              12310201 {* octal 'SB', 01 *}
 .  bfd_arch_i386,      {* Intel 386 *}
 .#define bfd_mach_i386_i386 0
 .#define bfd_mach_i386_i8086 1
 .#define bfd_mach_i386_i386_intel_syntax 2
+.#define bfd_mach_x86_64 3
+.#define bfd_mach_x86_64_intel_syntax 4
 .  bfd_arch_we32k,     {* AT&T WE32xxx *}
 .  bfd_arch_tahoe,     {* CCI/Harris Tahoe *}
 .  bfd_arch_i860,      {* Intel 860 *}
@@ -146,13 +156,36 @@
 .#define bfd_mach_h8300h  2
 .#define bfd_mach_h8300s  3
 .  bfd_arch_powerpc,   {* PowerPC *}
+.#define bfd_mach_ppc		0
+.#define bfd_mach_ppc_403	403
+.#define bfd_mach_ppc_403gc	4030
+.#define bfd_mach_ppc_505	505
+.#define bfd_mach_ppc_601	601
+.#define bfd_mach_ppc_602	602
+.#define bfd_mach_ppc_603	603
+.#define bfd_mach_ppc_ec603e	6031
+.#define bfd_mach_ppc_604	604
+.#define bfd_mach_ppc_620	620
+.#define bfd_mach_ppc_630	630
+.#define bfd_mach_ppc_750	750
+.#define bfd_mach_ppc_860	860
+.#define bfd_mach_ppc_a35	35
+.#define bfd_mach_ppc_rs64ii	642
+.#define bfd_mach_ppc_rs64iii	643
+.#define bfd_mach_ppc_7400	7400
 .  bfd_arch_rs6000,    {* IBM RS/6000 *}
+.#define bfd_mach_rs6k		0
+.#define bfd_mach_rs6k_rs1	6001
+.#define bfd_mach_rs6k_rsc	6003
+.#define bfd_mach_rs6k_rs2	6002
 .  bfd_arch_hppa,      {* HP PA RISC *}
 .  bfd_arch_d10v,      {* Mitsubishi D10V *}
 .#define bfd_mach_d10v		0
 .#define bfd_mach_d10v_ts2	2
 .#define bfd_mach_d10v_ts3	3
 .  bfd_arch_d30v,      {* Mitsubishi D30V *}
+.  bfd_arch_m68hc11,   {* Motorola 68HC11 *}
+.  bfd_arch_m68hc12,   {* Motorola 68HC12 *}
 .  bfd_arch_z8k,       {* Zilog Z8000 *}
 .#define bfd_mach_z8001		1
 .#define bfd_mach_z8002		2
@@ -178,6 +211,8 @@
 .#define bfd_mach_arm_4T 	6
 .#define bfd_mach_arm_5 	7
 .#define bfd_mach_arm_5T	8
+.#define bfd_mach_arm_5TE	9
+.#define bfd_mach_arm_XScale	10
 .  bfd_arch_ns32k,     {* National Semiconductors ns32000 *}
 .  bfd_arch_w65,       {* WDC 65816 *}
 .  bfd_arch_tic30,     {* Texas Instruments TMS320C30 *}
@@ -200,20 +235,21 @@
 .#define bfd_mach_fr30		0x46523330
 .  bfd_arch_mcore,
 .  bfd_arch_ia64,      {* HP/Intel ia64 *}
+.#define bfd_mach_ia64_elf64	0
+.#define bfd_mach_ia64_elf32	1
 .  bfd_arch_pj,
 .  bfd_arch_avr,       {* Atmel AVR microcontrollers *}
 .#define bfd_mach_avr1		1
 .#define bfd_mach_avr2		2
 .#define bfd_mach_avr3		3
 .#define bfd_mach_avr4		4
+.#define bfd_mach_avr5		5
+.  bfd_arch_cris,      {* Axis CRIS *}
 .  bfd_arch_last
 .  };
-
-
 */
 
 /*
-
 SUBSECTION
 	bfd_arch_info
 
@@ -222,7 +258,7 @@
 	within BFD.
 
 .
-.typedef struct bfd_arch_info 
+.typedef struct bfd_arch_info
 .{
 .  int bits_per_word;
 .  int bits_per_address;
@@ -232,8 +268,8 @@
 .  const char *arch_name;
 .  const char *printable_name;
 .  unsigned int section_align_power;
-. {* true if this is the default machine for the architecture *}
-.  boolean the_default;	
+.  {* True if this is the default machine for the architecture.  *}
+.  boolean the_default;
 .  const struct bfd_arch_info * (*compatible)
 .	PARAMS ((const struct bfd_arch_info *a,
 .	         const struct bfd_arch_info *b));
@@ -248,6 +284,7 @@
 extern const bfd_arch_info_type bfd_alpha_arch;
 extern const bfd_arch_info_type bfd_arc_arch;
 extern const bfd_arch_info_type bfd_arm_arch;
+extern const bfd_arch_info_type bfd_cris_arch;
 extern const bfd_arch_info_type bfd_d10v_arch;
 extern const bfd_arch_info_type bfd_d30v_arch;
 extern const bfd_arch_info_type bfd_h8300_arch;
@@ -258,6 +295,8 @@
 extern const bfd_arch_info_type bfd_i860_arch;
 extern const bfd_arch_info_type bfd_i960_arch;
 extern const bfd_arch_info_type bfd_m32r_arch;
+extern const bfd_arch_info_type bfd_m68hc11_arch;
+extern const bfd_arch_info_type bfd_m68hc12_arch;
 extern const bfd_arch_info_type bfd_m68k_arch;
 extern const bfd_arch_info_type bfd_m88k_arch;
 extern const bfd_arch_info_type bfd_mips_arch;
@@ -282,8 +321,7 @@
 extern const bfd_arch_info_type bfd_avr_arch;
 extern const bfd_arch_info_type bfd_ia64_arch;
 
-static const bfd_arch_info_type * const bfd_archures_list[] =
-{
+static const bfd_arch_info_type * const bfd_archures_list[] = {
 #ifdef SELECT_ARCHITECTURES
   SELECT_ARCHITECTURES,
 #else
@@ -291,6 +329,7 @@
   &bfd_alpha_arch,
   &bfd_arc_arch,
   &bfd_arm_arch,
+  &bfd_cris_arch,
   &bfd_d10v_arch,
   &bfd_d30v_arch,
   &bfd_h8300_arch,
@@ -301,6 +340,8 @@
   &bfd_i860_arch,
   &bfd_i960_arch,
   &bfd_m32r_arch,
+  &bfd_m68hc11_arch,
+  &bfd_m68hc12_arch,
   &bfd_m68k_arch,
   &bfd_m88k_arch,
   &bfd_mips_arch,
@@ -347,8 +388,6 @@
   return abfd->arch_info->printable_name;
 }
 
-
-
 /*
 FUNCTION
 	bfd_scan_arch
@@ -360,7 +399,6 @@
 	Figure out if BFD supports any cpu which could be described with
 	the name @var{string}.  Return a pointer to an <<arch_info>>
 	structure if a machine is found, otherwise NULL.
-
 */
 
 const bfd_arch_info_type *
@@ -369,7 +407,7 @@
 {
   const bfd_arch_info_type * const *app, *ap;
 
-  /* Look through all the installed architectures */
+  /* Look through all the installed architectures.  */
   for (app = bfd_archures_list; *app != NULL; app++)
     {
       for (ap = *app; ap != NULL; ap = ap->next)
@@ -382,8 +420,6 @@
   return NULL;
 }
 
-
-
 /*
 FUNCTION
 	bfd_arch_list
@@ -394,7 +430,6 @@
 DESCRIPTION
 	Return a freshly malloced NULL-terminated vector of the names
 	of all the valid BFD architectures.  Do not modify the names.
-
 */
 
 const char **
@@ -405,7 +440,7 @@
   const char **name_list;
   const bfd_arch_info_type * const *app;
 
-  /* Determine the number of architectures */
+  /* Determine the number of architectures.  */
   vec_length = 0;
   for (app = bfd_archures_list; *app != NULL; app++)
     {
@@ -416,12 +451,12 @@
 	}
     }
 
-  name_list = (CONST char **)
+  name_list = (const char **)
     bfd_malloc ((vec_length + 1) * sizeof (char **));
   if (name_list == NULL)
     return NULL;
 
-  /* Point the list at each of the names */
+  /* Point the list at each of the names.  */
   name_ptr = name_list;
   for (app = bfd_archures_list; *app != NULL; app++)
     {
@@ -437,8 +472,6 @@
   return name_list;
 }
 
-
-
 /*
 FUNCTION
 	bfd_arch_get_compatible
@@ -464,15 +497,14 @@
   /* If either architecture is unknown, then all we can do is assume
      the user knows what he's doing.  */
   if (abfd->arch_info->arch == bfd_arch_unknown)
-  	return bbfd->arch_info;
+    return bbfd->arch_info;
   if (bbfd->arch_info->arch == bfd_arch_unknown)
-  	return abfd->arch_info;
+    return abfd->arch_info;
 
   /* Otherwise architecture-specific code has to decide.  */
   return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info);
 }
 
-
 /*
 INTERNAL_DEFINITION
 	bfd_default_arch_struct
@@ -485,15 +517,13 @@
 	architecture of the file.
 
 .extern const bfd_arch_info_type bfd_default_arch_struct;
-
 */
 
-const bfd_arch_info_type bfd_default_arch_struct =
-{
-    32,32,8,bfd_arch_unknown,0,"unknown","unknown",2,true,
-    bfd_default_compatible,
-    bfd_default_scan, 
-    0,
+const bfd_arch_info_type bfd_default_arch_struct = {
+  32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, true,
+  bfd_default_compatible,
+  bfd_default_scan,
+  0,
 };
 
 /*
@@ -528,7 +558,7 @@
 	Set the architecture and machine type in BFD @var{abfd}
 	to @var{arch} and @var{mach}.  Find the correct
 	pointer to a structure and insert it into the <<arch_info>>
-	pointer. 
+	pointer.
 */
 
 boolean
@@ -558,7 +588,6 @@
   return false;
 }
 
-
 /*
 FUNCTION
 	bfd_get_arch
@@ -569,14 +598,13 @@
 DESCRIPTION
 	Return the enumerated type which describes the BFD @var{abfd}'s
 	architecture.
-
 */
 
 enum bfd_architecture
 bfd_get_arch (abfd)
      bfd *abfd;
 {
-    return abfd->arch_info->arch;
+  return abfd->arch_info->arch;
 }
 
 /*
@@ -591,11 +619,11 @@
 	machine.
 */
 
-unsigned long  
+unsigned long
 bfd_get_mach (abfd)
      bfd *abfd;
 {
-    return abfd->arch_info->mach;
+  return abfd->arch_info->mach;
 }
 
 /*
@@ -608,7 +636,6 @@
 DESCRIPTION
 	Return the number of bits in one of the BFD @var{abfd}'s
 	architecture's bytes.
-
 */
 
 unsigned int
@@ -637,9 +664,8 @@
   return abfd->arch_info->bits_per_address;
 }
 
-
 /*
-INTERNAL_FUNCTION 
+INTERNAL_FUNCTION
 	bfd_default_compatible
 
 SYNOPSIS
@@ -652,7 +678,7 @@
 */
 
 const bfd_arch_info_type *
-bfd_default_compatible (a,b)
+bfd_default_compatible (a, b)
      const bfd_arch_info_type *a;
      const bfd_arch_info_type *b;
 {
@@ -668,7 +694,6 @@
   return a;
 }
 
-
 /*
 INTERNAL_FUNCTION
 	bfd_default_scan
@@ -681,7 +706,7 @@
 	architecture hit and a machine hit.
 */
 
-boolean 
+boolean
 bfd_default_scan (info, string)
      const struct bfd_arch_info *info;
      const char *string;
@@ -693,17 +718,17 @@
   const char *printable_name_colon;
 
   /* Exact match of the architecture name (ARCH_NAME) and also the
-     default architecture? */
+     default architecture?  */
   if (strcasecmp (string, info->arch_name) == 0
       && info->the_default)
     return true;
 
-  /* Exact match of the machine name (PRINTABLE_NAME)? */
+  /* Exact match of the machine name (PRINTABLE_NAME)?  */
   if (strcasecmp (string, info->printable_name) == 0)
     return true;
-     
+
   /* Given that printable_name contains no colon, attempt to match:
-     ARCH_NAME [ ":" ] PRINTABLE_NAME? */
+     ARCH_NAME [ ":" ] PRINTABLE_NAME?  */
   printable_name_colon = strchr (info->printable_name, ':');
   if (printable_name_colon == NULL)
     {
@@ -726,7 +751,7 @@
     }
 
   /* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>;
-     Attempt to match: <arch> <mach>? */
+     Attempt to match: <arch> <mach>?  */
   if (printable_name_colon != NULL)
     {
       int colon_index = printable_name_colon - info->printable_name;
@@ -738,48 +763,61 @@
 
   /* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>; Do not
      attempt to match just <mach>, it could be ambigious.  This test
-     is left until later. */
+     is left until later.  */
 
-  /* NOTE: The below is retained for compatibility only. Please do not
-     add to this code */
+  /* NOTE: The below is retained for compatibility only.  Please do
+     not add to this code.  */
 
   /* See how much of the supplied string matches with the
      architecture, eg the string m68k:68020 would match the 68k entry
-     up to the :, then we get left with the machine number */
+     up to the :, then we get left with the machine number.  */
 
-  for (ptr_src = string, ptr_tst = info->arch_name; 
+  for (ptr_src = string, ptr_tst = info->arch_name;
        *ptr_src && *ptr_tst;
-       ptr_src++, ptr_tst++) 
+       ptr_src++, ptr_tst++)
     {
-      if (*ptr_src != *ptr_tst) break;
+      if (*ptr_src != *ptr_tst)
+	break;
     }
 
   /* Chewed up as much of the architecture as will match, skip any
-     colons */
+     colons.  */
   if (*ptr_src == ':')
     ptr_src++;
-  
+
   if (*ptr_src == 0)
     {
-      /* nothing more, then only keep this one if it is the default
-	 machine for this architecture */
+      /* Nothing more, then only keep this one if it is the default
+	 machine for this architecture.  */
       return info->the_default;
     }
 
   number = 0;
   while (isdigit ((unsigned char) *ptr_src))
     {
-      number = number * 10 + *ptr_src  - '0';
+      number = number * 10 + *ptr_src - '0';
       ptr_src++;
     }
 
   /* NOTE: The below is retained for compatibility only.
-     PLEASE DO NOT ADD TO THIS CODE. */
+     PLEASE DO NOT ADD TO THIS CODE.  */
 
-  switch (number) 
+  switch (number)
     {
       /* FIXME: These are needed to parse IEEE objects.  */
-    case 68000: 
+      /* The following seven case's are here only for compatibility with
+	 older binutils (at least IEEE objects from binutils 2.9.1 require
+	 them).  */
+    case bfd_mach_m68000:
+    case bfd_mach_m68010:
+    case bfd_mach_m68020:
+    case bfd_mach_m68030:
+    case bfd_mach_m68040:
+    case bfd_mach_m68060:
+    case bfd_mach_cpu32:
+      arch = bfd_arch_m68k;
+      break;
+    case 68000:
       arch = bfd_arch_m68k;
       number = bfd_mach_m68000;
       break;
@@ -846,11 +884,11 @@
       number = bfd_mach_sh4;
       break;
 
-    default:  
+    default:
       return false;
     }
 
-  if (arch != info->arch) 
+  if (arch != info->arch)
     return false;
 
   if (number != info->mach)
@@ -859,7 +897,6 @@
   return true;
 }
 
-
 /*
 FUNCTION
 	bfd_get_arch_info
@@ -878,7 +915,6 @@
   return abfd->arch_info;
 }
 
-
 /*
 FUNCTION
 	bfd_lookup_arch
@@ -896,7 +932,7 @@
 	default.
 */
 
-const bfd_arch_info_type * 
+const bfd_arch_info_type *
 bfd_lookup_arch (arch, machine)
      enum bfd_architecture arch;
      unsigned long machine;
@@ -917,7 +953,6 @@
   return NULL;
 }
 
-
 /*
 FUNCTION
 	bfd_printable_arch_mach
@@ -928,7 +963,7 @@
 
 DESCRIPTION
 	Return a printable string representing the architecture and
-	machine type. 
+	machine type.
 
 	This routine is depreciated.
 */
@@ -938,11 +973,11 @@
      enum bfd_architecture arch;
      unsigned long machine;
 {
-    const bfd_arch_info_type * ap = bfd_lookup_arch (arch, machine);
+  const bfd_arch_info_type *ap = bfd_lookup_arch (arch, machine);
 
-    if (ap)
-      return ap->printable_name;
-    return "UNKNOWN!";
+  if (ap)
+    return ap->printable_name;
+  return "UNKNOWN!";
 }
 
 /*
@@ -956,15 +991,14 @@
 	Return the number of octets (8-bit quantities) per target byte
         (minimum addressable unit).  In most cases, this will be one, but some
         DSP targets have 16, 32, or even 48 bits per byte.
-
 */
 
 unsigned int
 bfd_octets_per_byte (abfd)
-     bfd * abfd;
+     bfd *abfd;
 {
-    return bfd_arch_mach_octets_per_byte (bfd_get_arch (abfd), 
-                                          bfd_get_mach (abfd));
+  return bfd_arch_mach_octets_per_byte (bfd_get_arch (abfd),
+					bfd_get_mach (abfd));
 }
 
 /*
@@ -977,19 +1011,19 @@
 
 DESCRIPTION
 	See bfd_octets_per_byte.
-        
+
         This routine is provided for those cases where a bfd * is not
         available
 */
 
 unsigned int
 bfd_arch_mach_octets_per_byte (arch, mach)
-    enum bfd_architecture arch;
-    unsigned long mach;
+     enum bfd_architecture arch;
+     unsigned long mach;
 {
-    const bfd_arch_info_type * ap = bfd_lookup_arch (arch, mach);
-    
-    if (ap)
-      return ap->bits_per_byte / 8;
-    return 1;
+  const bfd_arch_info_type *ap = bfd_lookup_arch (arch, mach);
+
+  if (ap)
+    return ap->bits_per_byte / 8;
+  return 1;
 }
diff --git a/bfd/armnetbsd.c b/bfd/armnetbsd.c
index 3e6ee47..05d8ad0 100644
--- a/bfd/armnetbsd.c
+++ b/bfd/armnetbsd.c
@@ -15,7 +15,7 @@
 
 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.  */
 
 #define	BYTES_IN_WORD		4
 #undef TARGET_IS_BIG_ENDIAN_P
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index dc172bf..08d597f 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -23,7 +23,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-/* bfd.h -- The only header file required by users of the bfd library 
+/* bfd.h -- The only header file required by users of the bfd library
 
 The bfd.h file is generated from bfd-in.h and various .c files; if you
 change it, your changes will probably be lost.
@@ -84,7 +84,7 @@
 /* General rules: functions which are boolean return true on success
    and false on failure (unless they're a predicate).   -- bfd.doc */
 /* I'm sure this is going to break something and someone is going to
-   force me to change it. */
+   force me to change it.  */
 /* typedef enum boolean {false, true} boolean; */
 /* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h>  -fnf */
 /* It gets worse if the host also defines a true/false enum... -sts */
@@ -93,7 +93,7 @@
 #define TRUE_FALSE_ALREADY_DEFINED
 #endif
 #ifdef MPW
-/* Pre-emptive strike - get the file with the enum. */
+/* Pre-emptive strike - get the file with the enum.  */
 #include <Types.h>
 #define TRUE_FALSE_ALREADY_DEFINED
 #endif /* MPW */
@@ -109,7 +109,7 @@
 /* FIXME:  This should be using off_t from <sys/types.h>.
    For now, try to avoid breaking stuff by not including <sys/types.h> here.
    This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
-   Probably the best long-term answer is to avoid using file_ptr AND off_t 
+   Probably the best long-term answer is to avoid using file_ptr AND off_t
    in this header file, and to handle this in the BFD implementation
    rather than in its interface.  */
 /* typedef off_t	file_ptr; */
@@ -177,8 +177,8 @@
 typedef unsigned long bfd_size_type;
 
 /* Print a bfd_vma x on stream s.  */
-#define fprintf_vma(s,x) fprintf(s, "%08lx", x)
-#define sprintf_vma(s,x) sprintf(s, "%08lx", x)
+#define fprintf_vma(s,x) fprintf (s, "%08lx", x)
+#define sprintf_vma(s,x) sprintf (s, "%08lx", x)
 
 #endif /* not BFD64  */
 
@@ -284,11 +284,10 @@
   file_ptr file_offset;		/* look here to find the file */
 } carsym;			/* to make these you call a carsymogen */
 
-  
 /* Used in generating armaps (archive tables of contents).
    Perhaps just a forward definition would do? */
 struct orl {			/* output ranlib */
-  char **name;			/* symbol name */ 
+  char **name;			/* symbol name */
   file_ptr pos;			/* bfd* or file position */
   int namidx;			/* index into string table */
 };
@@ -296,7 +295,7 @@
 
 /* Linenumber stuff */
 typedef struct lineno_cache_entry {
-  unsigned int line_number;	/* Linenumber from start of function*/  
+  unsigned int line_number;	/* Linenumber from start of function*/
   union {
     struct symbol_cache_entry *sym; /* Function name */
     unsigned long offset;	/* Offset into section */
@@ -327,15 +326,15 @@
 #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
 #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
 
-typedef struct stat stat_type; 
+typedef struct stat stat_type;
 
 typedef enum bfd_print_symbol
-{ 
+{
   bfd_print_symbol_name,
   bfd_print_symbol_more,
   bfd_print_symbol_all
 } bfd_print_symbol_type;
-    
+
 /* Information about a symbol that nm needs.  */
 
 typedef struct _symbol_info
@@ -344,7 +343,7 @@
   char type;
   CONST char *name;            /* Symbol name.  */
   unsigned char stab_type;     /* Stab type.  */
-  char stab_other;             /* Stab other. */
+  char stab_other;             /* Stab other.  */
   short stab_desc;             /* Stab desc.  */
   CONST char *stab_name;       /* String for stab type.  */
 } symbol_info;
@@ -481,7 +480,6 @@
 extern int bfd_flush PARAMS ((bfd *abfd));
 extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
 
-
 /* Cast from const char * to char * so that caller can assign to
    a char * without a warning.  */
 #define bfd_get_filename(abfd) ((char *) (abfd)->filename)
@@ -489,6 +487,9 @@
 #define bfd_get_format(abfd) ((abfd)->format)
 #define bfd_get_target(abfd) ((abfd)->xvec->name)
 #define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
+#define bfd_family_coff(abfd) \
+  (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \
+   bfd_get_flavour (abfd) == bfd_target_xcoff_flavour)
 #define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
 #define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
 #define bfd_header_big_endian(abfd) \
@@ -511,7 +512,7 @@
 
 #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
 
-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean)(bool)), true)
+#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true)
 
 extern boolean bfd_record_phdr
   PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
@@ -537,6 +538,11 @@
 void		bfd_putl32	   PARAMS ((bfd_vma, unsigned char *));
 void		bfd_putb16	   PARAMS ((bfd_vma, unsigned char *));
 void		bfd_putl16	   PARAMS ((bfd_vma, unsigned char *));
+
+/* Byte swapping routines which take size and endiannes as arguments.  */
+
+bfd_vma         bfd_get_bits       PARAMS ((bfd_byte *, int, boolean));
+void            bfd_put_bits       PARAMS ((bfd_vma, bfd_byte *, int, boolean));
 
 /* Externally visible ECOFF routines.  */
 
@@ -624,7 +630,10 @@
 	   const char * const *, struct bfd_link_info *, struct sec **,
 	   struct bfd_elf_version_tree *));
 extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
+extern void bfd_elf_set_dt_needed_soname PARAMS ((bfd *, const char *));
 extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
+extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
+  PARAMS ((bfd *, struct bfd_link_info *));
 
 /* Return an upper bound on the number of bytes required to store a
    copy of ABFD's program header table entries.  Return -1 if an error
@@ -641,7 +650,14 @@
 extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
 
 /* Return the arch_size field of an elf bfd, or -1 if not elf.  */
-extern int bfd_elf_get_arch_size PARAMS ((bfd *));
+extern int bfd_get_arch_size PARAMS ((bfd *));
+
+/* Return true if address "naturally" sign extends, or -1 if not elf.  */
+extern int bfd_get_sign_extend_vma PARAMS ((bfd *));
+
+extern boolean bfd_m68k_elf32_create_embedded_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+	   char **));
 
 /* SunOS shared library support routines for the linker.  */
 
@@ -721,6 +737,10 @@
 extern boolean bfd_coff_set_symbol_class
   PARAMS ((bfd *, struct symbol_cache_entry *, unsigned int));
 
+extern boolean bfd_m68k_coff_create_embedded_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+	   char **));
+
 /* ARM Interworking support.  Called from linker.  */
 extern boolean bfd_arm_allocate_interworking_sections
   PARAMS ((struct bfd_link_info *));
@@ -751,7 +771,7 @@
 extern boolean bfd_elf32_arm_get_bfd_for_interworking
   PARAMS ((bfd *, struct bfd_link_info *));
 
-/* TI COFF load page support. */
+/* TI COFF load page support.  */
 extern void bfd_ticoff_set_section_load_page
   PARAMS ((struct sec *, int));
 
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index a3f6d8c..5fe2b47 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -23,7 +23,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-/* bfd.h -- The only header file required by users of the bfd library 
+/* bfd.h -- The only header file required by users of the bfd library
 
 The bfd.h file is generated from bfd-in.h and various .c files; if you
 change it, your changes will probably be lost.
@@ -84,7 +84,7 @@
 /* General rules: functions which are boolean return true on success
    and false on failure (unless they're a predicate).   -- bfd.doc */
 /* I'm sure this is going to break something and someone is going to
-   force me to change it. */
+   force me to change it.  */
 /* typedef enum boolean {false, true} boolean; */
 /* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h>  -fnf */
 /* It gets worse if the host also defines a true/false enum... -sts */
@@ -93,7 +93,7 @@
 #define TRUE_FALSE_ALREADY_DEFINED
 #endif
 #ifdef MPW
-/* Pre-emptive strike - get the file with the enum. */
+/* Pre-emptive strike - get the file with the enum.  */
 #include <Types.h>
 #define TRUE_FALSE_ALREADY_DEFINED
 #endif /* MPW */
@@ -109,7 +109,7 @@
 /* FIXME:  This should be using off_t from <sys/types.h>.
    For now, try to avoid breaking stuff by not including <sys/types.h> here.
    This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
-   Probably the best long-term answer is to avoid using file_ptr AND off_t 
+   Probably the best long-term answer is to avoid using file_ptr AND off_t
    in this header file, and to handle this in the BFD implementation
    rather than in its interface.  */
 /* typedef off_t	file_ptr; */
@@ -177,8 +177,8 @@
 typedef unsigned long bfd_size_type;
 
 /* Print a bfd_vma x on stream s.  */
-#define fprintf_vma(s,x) fprintf(s, "%08lx", x)
-#define sprintf_vma(s,x) sprintf(s, "%08lx", x)
+#define fprintf_vma(s,x) fprintf (s, "%08lx", x)
+#define sprintf_vma(s,x) sprintf (s, "%08lx", x)
 
 #endif /* not BFD64  */
 
@@ -284,11 +284,10 @@
   file_ptr file_offset;		/* look here to find the file */
 } carsym;			/* to make these you call a carsymogen */
 
-  
 /* Used in generating armaps (archive tables of contents).
    Perhaps just a forward definition would do? */
 struct orl {			/* output ranlib */
-  char **name;			/* symbol name */ 
+  char **name;			/* symbol name */
   file_ptr pos;			/* bfd* or file position */
   int namidx;			/* index into string table */
 };
@@ -296,7 +295,7 @@
 
 /* Linenumber stuff */
 typedef struct lineno_cache_entry {
-  unsigned int line_number;	/* Linenumber from start of function*/  
+  unsigned int line_number;	/* Linenumber from start of function*/
   union {
     struct symbol_cache_entry *sym; /* Function name */
     unsigned long offset;	/* Offset into section */
@@ -327,15 +326,15 @@
 #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
 #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
 
-typedef struct stat stat_type; 
+typedef struct stat stat_type;
 
 typedef enum bfd_print_symbol
-{ 
+{
   bfd_print_symbol_name,
   bfd_print_symbol_more,
   bfd_print_symbol_all
 } bfd_print_symbol_type;
-    
+
 /* Information about a symbol that nm needs.  */
 
 typedef struct _symbol_info
@@ -344,7 +343,7 @@
   char type;
   CONST char *name;            /* Symbol name.  */
   unsigned char stab_type;     /* Stab type.  */
-  char stab_other;             /* Stab other. */
+  char stab_other;             /* Stab other.  */
   short stab_desc;             /* Stab desc.  */
   CONST char *stab_name;       /* String for stab type.  */
 } symbol_info;
@@ -481,7 +480,6 @@
 extern int bfd_flush PARAMS ((bfd *abfd));
 extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
 
-
 /* Cast from const char * to char * so that caller can assign to
    a char * without a warning.  */
 #define bfd_get_filename(abfd) ((char *) (abfd)->filename)
@@ -489,6 +487,9 @@
 #define bfd_get_format(abfd) ((abfd)->format)
 #define bfd_get_target(abfd) ((abfd)->xvec->name)
 #define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
+#define bfd_family_coff(abfd) \
+  (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \
+   bfd_get_flavour (abfd) == bfd_target_xcoff_flavour)
 #define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
 #define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
 #define bfd_header_big_endian(abfd) \
@@ -511,7 +512,7 @@
 
 #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
 
-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean)(bool)), true)
+#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true)
 
 extern boolean bfd_record_phdr
   PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
@@ -537,6 +538,11 @@
 void		bfd_putl32	   PARAMS ((bfd_vma, unsigned char *));
 void		bfd_putb16	   PARAMS ((bfd_vma, unsigned char *));
 void		bfd_putl16	   PARAMS ((bfd_vma, unsigned char *));
+
+/* Byte swapping routines which take size and endiannes as arguments.  */
+
+bfd_vma         bfd_get_bits       PARAMS ((bfd_byte *, int, boolean));
+void            bfd_put_bits       PARAMS ((bfd_vma, bfd_byte *, int, boolean));
 
 /* Externally visible ECOFF routines.  */
 
@@ -624,7 +630,10 @@
 	   const char * const *, struct bfd_link_info *, struct sec **,
 	   struct bfd_elf_version_tree *));
 extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
+extern void bfd_elf_set_dt_needed_soname PARAMS ((bfd *, const char *));
 extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
+extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
+  PARAMS ((bfd *, struct bfd_link_info *));
 
 /* Return an upper bound on the number of bytes required to store a
    copy of ABFD's program header table entries.  Return -1 if an error
@@ -641,7 +650,14 @@
 extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
 
 /* Return the arch_size field of an elf bfd, or -1 if not elf.  */
-extern int bfd_elf_get_arch_size PARAMS ((bfd *));
+extern int bfd_get_arch_size PARAMS ((bfd *));
+
+/* Return true if address "naturally" sign extends, or -1 if not elf.  */
+extern int bfd_get_sign_extend_vma PARAMS ((bfd *));
+
+extern boolean bfd_m68k_elf32_create_embedded_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+	   char **));
 
 /* SunOS shared library support routines for the linker.  */
 
@@ -721,6 +737,10 @@
 extern boolean bfd_coff_set_symbol_class
   PARAMS ((bfd *, struct symbol_cache_entry *, unsigned int));
 
+extern boolean bfd_m68k_coff_create_embedded_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+	   char **));
+
 /* ARM Interworking support.  Called from linker.  */
 extern boolean bfd_arm_allocate_interworking_sections
   PARAMS ((struct bfd_link_info *));
@@ -751,7 +771,7 @@
 extern boolean bfd_elf32_arm_get_bfd_for_interworking
   PARAMS ((bfd *, struct bfd_link_info *));
 
-/* TI COFF load page support. */
+/* TI COFF load page support.  */
 extern void bfd_ticoff_set_section_load_page
   PARAMS ((struct sec *, int));
 
@@ -790,7 +810,7 @@
 bfd_make_readable PARAMS ((bfd *abfd));
 
 
- /* Byte swapping macros for user section data.  */
+/* Byte swapping macros for user section data.  */
 
 #define bfd_put_8(abfd, val, ptr) \
                 ((void) (*((unsigned char *)(ptr)) = (unsigned char)(val)))
@@ -843,7 +863,7 @@
                 : (abort (), (void) 0))
 
 
- /* Byte swapping macros for file header data.  */
+/* Byte swapping macros for file header data.  */
 
 #define bfd_h_put_8(abfd, val, ptr) \
                bfd_put_8 (abfd, val, ptr)
@@ -881,365 +901,377 @@
 #define bfd_h_get_signed_64(abfd, ptr) \
                 BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr))
 
-  /* This structure is used for a comdat section, as in PE.  A comdat
-    section is associated with a particular symbol.  When the linker
-    sees a comdat section, it keeps only one of the sections with a
-    given name and associated with a given symbol. */
+/* This structure is used for a comdat section, as in PE.  A comdat
+   section is associated with a particular symbol.  When the linker
+   sees a comdat section, it keeps only one of the sections with a
+   given name and associated with a given symbol.  */
 
 struct bfd_comdat_info
 {
-   /* The name of the symbol associated with a comdat section.  */
+  /* The name of the symbol associated with a comdat section.  */
   const char *name;
 
-   /* The local symbol table index of the symbol associated with a
+  /* The local symbol table index of the symbol associated with a
      comdat section.  This is only meaningful to the object file format
      specific code; it is not an index into the list returned by
      bfd_canonicalize_symtab.  */
   long symbol;
-
-   /* If this section is being discarded, the linker uses this field
-     to point to the input section which is being kept.  */
-  struct sec *sec;
 };
 
 typedef struct sec
 {
-         /* The name of the section; the name isn't a copy, the pointer is
-        the same as that passed to bfd_make_section. */
+  /* The name of the section; the name isn't a copy, the pointer is
+     the same as that passed to bfd_make_section.  */
 
-    CONST char *name;
+  const char *name;
 
-         /* Which section is it; 0..nth.      */
+  /* A unique sequence number.  */
 
-   int index;
+  int id;
 
-         /* The next section in the list belonging to the BFD, or NULL. */
+  /* Which section is it; 0..nth.  */
 
-    struct sec *next;
+  int index;
 
-         /* The field flags contains attributes of the section. Some
-           flags are read in from the object file, and some are
-           synthesized from other information.  */
+  /* The next section in the list belonging to the BFD, or NULL.  */
 
-    flagword flags;
+  struct sec *next;
+
+  /* The field flags contains attributes of the section. Some
+     flags are read in from the object file, and some are
+     synthesized from other information.  */
+
+  flagword flags;
 
 #define SEC_NO_FLAGS   0x000
 
-         /* Tells the OS to allocate space for this section when loading.
-           This is clear for a section containing debug information
-           only. */
+  /* Tells the OS to allocate space for this section when loading.
+     This is clear for a section containing debug information only.  */
 #define SEC_ALLOC      0x001
 
-         /* Tells the OS to load the section from the file when loading.
-           This is clear for a .bss section. */
+  /* Tells the OS to load the section from the file when loading.
+     This is clear for a .bss section.  */
 #define SEC_LOAD       0x002
 
-         /* The section contains data still to be relocated, so there is
-           some relocation information too. */
+  /* The section contains data still to be relocated, so there is
+     some relocation information too.  */
 #define SEC_RELOC      0x004
 
-#if 0    /* Obsolete ? */
+#if 0   /* Obsolete ? */
 #define SEC_BALIGN     0x008
 #endif
 
-         /* A signal to the OS that the section contains read only
-          data. */
+  /* A signal to the OS that the section contains read only data.  */
 #define SEC_READONLY   0x010
 
-         /* The section contains code only. */
+  /* The section contains code only.  */
 #define SEC_CODE       0x020
 
-         /* The section contains data only. */
+  /* The section contains data only.  */
 #define SEC_DATA       0x040
 
-         /* The section will reside in ROM. */
+  /* The section will reside in ROM.  */
 #define SEC_ROM        0x080
 
-         /* The section contains constructor information. This section
-           type is used by the linker to create lists of constructors and
-           destructors used by <<g++>>. When a back end sees a symbol
-           which should be used in a constructor list, it creates a new
-           section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
-           the symbol to it, and builds a relocation. To build the lists
-           of constructors, all the linker has to do is catenate all the
-           sections called <<__CTOR_LIST__>> and relocate the data
-           contained within - exactly the operations it would peform on
-           standard data. */
+  /* The section contains constructor information. This section
+     type is used by the linker to create lists of constructors and
+     destructors used by <<g++>>. When a back end sees a symbol
+     which should be used in a constructor list, it creates a new
+     section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
+     the symbol to it, and builds a relocation. To build the lists
+     of constructors, all the linker has to do is catenate all the
+     sections called <<__CTOR_LIST__>> and relocate the data
+     contained within - exactly the operations it would peform on
+     standard data.  */
 #define SEC_CONSTRUCTOR 0x100
 
-         /* The section is a constructor, and should be placed at the
-          end of the text, data, or bss section(?). */
+  /* The section is a constructor, and should be placed at the
+     end of the text, data, or bss section(?).  */
 #define SEC_CONSTRUCTOR_TEXT 0x1100
 #define SEC_CONSTRUCTOR_DATA 0x2100
 #define SEC_CONSTRUCTOR_BSS  0x3100
 
-         /* The section has contents - a data section could be
-           <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
-           <<SEC_HAS_CONTENTS>> */
+  /* The section has contents - a data section could be
+     <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
+     <<SEC_HAS_CONTENTS>>  */
 #define SEC_HAS_CONTENTS 0x200
 
-         /* An instruction to the linker to not output the section
-           even if it has information which would normally be written. */
+  /* An instruction to the linker to not output the section
+     even if it has information which would normally be written.  */
 #define SEC_NEVER_LOAD 0x400
 
-         /* The section is a COFF shared library section.  This flag is
-           only for the linker.  If this type of section appears in
-           the input file, the linker must copy it to the output file
-           without changing the vma or size.  FIXME: Although this
-           was originally intended to be general, it really is COFF
-           specific (and the flag was renamed to indicate this).  It
-           might be cleaner to have some more general mechanism to
-           allow the back end to control what the linker does with
-           sections. */
+  /* The section is a COFF shared library section.  This flag is
+     only for the linker.  If this type of section appears in
+     the input file, the linker must copy it to the output file
+     without changing the vma or size.  FIXME: Although this
+     was originally intended to be general, it really is COFF
+     specific (and the flag was renamed to indicate this).  It
+     might be cleaner to have some more general mechanism to
+     allow the back end to control what the linker does with
+     sections.  */
 #define SEC_COFF_SHARED_LIBRARY 0x800
 
-         /* The section contains common symbols (symbols may be defined
-           multiple times, the value of a symbol is the amount of
-           space it requires, and the largest symbol value is the one
-           used).  Most targets have exactly one of these (which we
-           translate to bfd_com_section_ptr), but ECOFF has two. */
+  /* The section has GOT references.  This flag is only for the
+     linker, and is currently only used by the elf32-hppa back end.
+     It will be set if global offset table references were detected
+     in this section, which indicate to the linker that the section
+     contains PIC code, and must be handled specially when doing a
+     static link.  */
+#define SEC_HAS_GOT_REF 0x4000
+
+  /* The section contains common symbols (symbols may be defined
+     multiple times, the value of a symbol is the amount of
+     space it requires, and the largest symbol value is the one
+     used).  Most targets have exactly one of these (which we
+     translate to bfd_com_section_ptr), but ECOFF has two.  */
 #define SEC_IS_COMMON 0x8000
 
-         /* The section contains only debugging information.  For
-           example, this is set for ELF .debug and .stab sections.
-           strip tests this flag to see if a section can be
-           discarded. */
+  /* The section contains only debugging information.  For
+     example, this is set for ELF .debug and .stab sections.
+     strip tests this flag to see if a section can be
+     discarded.  */
 #define SEC_DEBUGGING 0x10000
 
-         /* The contents of this section are held in memory pointed to
-           by the contents field.  This is checked by
-           bfd_get_section_contents, and the data is retrieved from
-           memory if appropriate.  */
+  /* The contents of this section are held in memory pointed to
+     by the contents field.  This is checked by bfd_get_section_contents,
+     and the data is retrieved from memory if appropriate.  */
 #define SEC_IN_MEMORY 0x20000
 
-         /* The contents of this section are to be excluded by the
-           linker for executable and shared objects unless those
-           objects are to be further relocated.  */
+  /* The contents of this section are to be excluded by the
+     linker for executable and shared objects unless those
+     objects are to be further relocated.  */
 #define SEC_EXCLUDE 0x40000
 
-        /* The contents of this section are to be sorted by the
-          based on the address specified in the associated symbol
-          table.  */
+  /* The contents of this section are to be sorted by the
+     based on the address specified in the associated symbol
+     table.  */
 #define SEC_SORT_ENTRIES 0x80000
 
-        /* When linking, duplicate sections of the same name should be
-          discarded, rather than being combined into a single section as
-          is usually done.  This is similar to how common symbols are
-          handled.  See SEC_LINK_DUPLICATES below.  */
+  /* When linking, duplicate sections of the same name should be
+     discarded, rather than being combined into a single section as
+     is usually done.  This is similar to how common symbols are
+     handled.  See SEC_LINK_DUPLICATES below.  */
 #define SEC_LINK_ONCE 0x100000
 
-        /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
-          should handle duplicate sections.  */
+  /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
+     should handle duplicate sections.  */
 #define SEC_LINK_DUPLICATES 0x600000
 
-        /* This value for SEC_LINK_DUPLICATES means that duplicate
-          sections with the same name should simply be discarded. */
+  /* This value for SEC_LINK_DUPLICATES means that duplicate
+     sections with the same name should simply be discarded.  */
 #define SEC_LINK_DUPLICATES_DISCARD 0x0
 
-        /* This value for SEC_LINK_DUPLICATES means that the linker
-          should warn if there are any duplicate sections, although
-          it should still only link one copy.  */
+  /* This value for SEC_LINK_DUPLICATES means that the linker
+     should warn if there are any duplicate sections, although
+     it should still only link one copy.  */
 #define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
 
-        /* This value for SEC_LINK_DUPLICATES means that the linker
-          should warn if any duplicate sections are a different size.  */
+  /* This value for SEC_LINK_DUPLICATES means that the linker
+     should warn if any duplicate sections are a different size.  */
 #define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
 
-        /* This value for SEC_LINK_DUPLICATES means that the linker
-          should warn if any duplicate sections contain different
-          contents.  */
+  /* This value for SEC_LINK_DUPLICATES means that the linker
+     should warn if any duplicate sections contain different
+     contents.  */
 #define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
 
-        /* This section was created by the linker as part of dynamic
-          relocation or other arcane processing.  It is skipped when
-          going through the first-pass output, trusting that someone
-          else up the line will take care of it later.  */
+  /* This section was created by the linker as part of dynamic
+     relocation or other arcane processing.  It is skipped when
+     going through the first-pass output, trusting that someone
+     else up the line will take care of it later.  */
 #define SEC_LINKER_CREATED 0x800000
 
-        /* This section should not be subject to garbage collection.  */
+  /* This section should not be subject to garbage collection.  */
 #define SEC_KEEP 0x1000000
 
-        /* This section contains "short" data, and should be placed
-          "near" the GP.  */
+  /* This section contains "short" data, and should be placed
+     "near" the GP.  */
 #define SEC_SMALL_DATA 0x2000000
 
-        /* This section contains data which may be shared with other
-          executables or shared objects.  */
+  /* This section contains data which may be shared with other
+     executables or shared objects.  */
 #define SEC_SHARED 0x4000000
 
-        /* When a section with this flag is being linked, then if the size of
-          the input section is less than a page, it should not cross a page
-          boundary.  If the size of the input section is one page or more, it
-          should be aligned on a page boundary.  */
+  /* When a section with this flag is being linked, then if the size of
+     the input section is less than a page, it should not cross a page
+     boundary.  If the size of the input section is one page or more, it
+     should be aligned on a page boundary.  */
 #define SEC_BLOCK 0x8000000
 
-        /* Conditionally link this section; do not link if there are no
-          references found to any symbol in the section.  */
+  /* Conditionally link this section; do not link if there are no
+     references found to any symbol in the section.  */
 #define SEC_CLINK 0x10000000
 
-        /*  End of section flags.  */
+  /*  End of section flags.  */
 
-        /* Some internal packed boolean fields.  */
+  /* Some internal packed boolean fields.  */
 
-        /* See the vma field.  */
-       unsigned int user_set_vma : 1;
+  /* See the vma field.  */
+  unsigned int user_set_vma : 1;
 
-        /* Whether relocations have been processed.  */
-       unsigned int reloc_done : 1;
+  /* Whether relocations have been processed.  */
+  unsigned int reloc_done : 1;
 
-        /* A mark flag used by some of the linker backends.  */
-       unsigned int linker_mark : 1;
+  /* A mark flag used by some of the linker backends.  */
+  unsigned int linker_mark : 1;
 
-        /* A mark flag used by some linker backends for garbage collection.  */
-       unsigned int gc_mark : 1;
+  /* A mark flag used by some linker backends for garbage collection.  */
+  unsigned int gc_mark : 1;
 
-        /* End of internal packed boolean fields.  */
+  /* Used by the ELF code to mark sections which have been allocated to segments.  */
+  unsigned int segment_mark : 1;
 
-        /*  The virtual memory address of the section - where it will be
-           at run time.  The symbols are relocated against this.  The
-           user_set_vma flag is maintained by bfd; if it's not set, the
-           backend can assign addresses (for example, in <<a.out>>, where
-           the default address for <<.data>> is dependent on the specific
-           target and various flags).  */
+  /* End of internal packed boolean fields.  */
 
-   bfd_vma vma;
+  /*  The virtual memory address of the section - where it will be
+      at run time.  The symbols are relocated against this.  The
+      user_set_vma flag is maintained by bfd; if it's not set, the
+      backend can assign addresses (for example, in <<a.out>>, where
+      the default address for <<.data>> is dependent on the specific
+      target and various flags).  */
 
-        /*  The load address of the section - where it would be in a
-           rom image; really only used for writing section header
-           information. */
+  bfd_vma vma;
 
-   bfd_vma lma;
+  /*  The load address of the section - where it would be in a
+      rom image; really only used for writing section header
+      information. */
 
-         /* The size of the section in octets, as it will be output.
-           Contains a value even if the section has no contents (e.g., the
-           size of <<.bss>>).  This will be filled in after relocation.  */
+  bfd_vma lma;
 
-   bfd_size_type _cooked_size;
+  /* The size of the section in octets, as it will be output.
+     Contains a value even if the section has no contents (e.g., the
+     size of <<.bss>>).  This will be filled in after relocation.  */
 
-         /* The original size on disk of the section, in octets.  Normally this
-           value is the same as the size, but if some relaxing has
-           been done, then this value will be bigger.  */
+  bfd_size_type _cooked_size;
 
-   bfd_size_type _raw_size;
+  /* The original size on disk of the section, in octets.  Normally this
+     value is the same as the size, but if some relaxing has
+     been done, then this value will be bigger.  */
 
-         /* If this section is going to be output, then this value is the
-           offset in *bytes* into the output section of the first byte in the
-           input section (byte ==> smallest addressable unit on the
-           target).  In most cases, if this was going to start at the
-           100th octet (8-bit quantity) in the output section, this value
-           would be 100.  However, if the target byte size is 16 bits
-           (bfd_octets_per_byte is "2"), this value would be 50. */
+  bfd_size_type _raw_size;
 
-   bfd_vma output_offset;
+  /* If this section is going to be output, then this value is the
+     offset in *bytes* into the output section of the first byte in the
+     input section (byte ==> smallest addressable unit on the
+     target).  In most cases, if this was going to start at the
+     100th octet (8-bit quantity) in the output section, this value
+     would be 100.  However, if the target byte size is 16 bits
+     (bfd_octets_per_byte is "2"), this value would be 50.  */
 
-         /* The output section through which to map on output. */
+  bfd_vma output_offset;
 
-   struct sec *output_section;
+  /* The output section through which to map on output.  */
 
-         /* The alignment requirement of the section, as an exponent of 2 -
-           e.g., 3 aligns to 2^3 (or 8). */
+  struct sec *output_section;
 
-   unsigned int alignment_power;
+  /* The alignment requirement of the section, as an exponent of 2 -
+     e.g., 3 aligns to 2^3 (or 8).  */
 
-         /* If an input section, a pointer to a vector of relocation
-           records for the data in this section. */
+  unsigned int alignment_power;
 
-   struct reloc_cache_entry *relocation;
+  /* If an input section, a pointer to a vector of relocation
+     records for the data in this section.  */
 
-         /* If an output section, a pointer to a vector of pointers to
-           relocation records for the data in this section. */
+  struct reloc_cache_entry *relocation;
 
-   struct reloc_cache_entry **orelocation;
+  /* If an output section, a pointer to a vector of pointers to
+     relocation records for the data in this section.  */
 
-         /* The number of relocation records in one of the above  */
+  struct reloc_cache_entry **orelocation;
 
-   unsigned reloc_count;
+  /* The number of relocation records in one of the above  */
 
-         /* Information below is back end specific - and not always used
-           or updated.  */
+  unsigned reloc_count;
 
-         /* File position of section data    */
+  /* Information below is back end specific - and not always used
+     or updated.  */
 
-   file_ptr filepos;
+  /* File position of section data.  */
 
-         /* File position of relocation info */
+  file_ptr filepos;
 
-   file_ptr rel_filepos;
+  /* File position of relocation info.  */
 
-         /* File position of line data       */
+  file_ptr rel_filepos;
 
-   file_ptr line_filepos;
+  /* File position of line data.  */
 
-         /* Pointer to data for applications */
+  file_ptr line_filepos;
 
-   PTR userdata;
+  /* Pointer to data for applications.  */
 
-         /* If the SEC_IN_MEMORY flag is set, this points to the actual
-           contents.  */
-   unsigned char *contents;
+  PTR userdata;
 
-         /* Attached line number information */
+  /* If the SEC_IN_MEMORY flag is set, this points to the actual
+     contents.  */
+  unsigned char *contents;
 
-   alent *lineno;
+  /* Attached line number information.  */
 
-         /* Number of line number records   */
+  alent *lineno;
 
-   unsigned int lineno_count;
+  /* Number of line number records.  */
 
-         /* Optional information about a COMDAT entry; NULL if not COMDAT */
+  unsigned int lineno_count;
 
-   struct bfd_comdat_info *comdat;
+  /* Optional information about a COMDAT entry; NULL if not COMDAT.  */
 
-         /* When a section is being output, this value changes as more
-           linenumbers are written out */
+  struct bfd_comdat_info *comdat;
 
-   file_ptr moving_line_filepos;
+  /* Points to the kept section if this section is a link-once section,
+     and is discarded.  */
+  struct sec *kept_section;
 
-         /* What the section number is in the target world  */
+  /* When a section is being output, this value changes as more
+     linenumbers are written out.  */
 
-   int target_index;
+  file_ptr moving_line_filepos;
 
-   PTR used_by_bfd;
+  /* What the section number is in the target world.  */
 
-         /* If this is a constructor section then here is a list of the
-           relocations created to relocate items within it. */
+  int target_index;
 
-   struct relent_chain *constructor_chain;
+  PTR used_by_bfd;
 
-         /* The BFD which owns the section. */
+  /* If this is a constructor section then here is a list of the
+     relocations created to relocate items within it.  */
 
-   bfd *owner;
+  struct relent_chain *constructor_chain;
 
-         /* A symbol which points at this section only */
-   struct symbol_cache_entry *symbol;
-   struct symbol_cache_entry **symbol_ptr_ptr;
+  /* The BFD which owns the section.  */
 
-   struct bfd_link_order *link_order_head;
-   struct bfd_link_order *link_order_tail;
+  bfd *owner;
+
+  /* A symbol which points at this section only */
+  struct symbol_cache_entry *symbol;
+  struct symbol_cache_entry **symbol_ptr_ptr;
+
+  struct bfd_link_order *link_order_head;
+  struct bfd_link_order *link_order_tail;
 } asection ;
 
-     /* These sections are global, and are managed by BFD.  The application
-       and target back end are not permitted to change the values in
-       these sections.  New code should use the section_ptr macros rather
-       than referring directly to the const sections.  The const sections
-       may eventually vanish.  */
+/* These sections are global, and are managed by BFD.  The application
+   and target back end are not permitted to change the values in
+   these sections.  New code should use the section_ptr macros rather
+   than referring directly to the const sections.  The const sections
+   may eventually vanish.  */
 #define BFD_ABS_SECTION_NAME "*ABS*"
 #define BFD_UND_SECTION_NAME "*UND*"
 #define BFD_COM_SECTION_NAME "*COM*"
 #define BFD_IND_SECTION_NAME "*IND*"
 
-     /* the absolute section */
+/* the absolute section */
 extern const asection bfd_abs_section;
 #define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
 #define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
-     /* Pointer to the undefined section */
+/* Pointer to the undefined section */
 extern const asection bfd_und_section;
 #define bfd_und_section_ptr ((asection *) &bfd_und_section)
 #define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
-     /* Pointer to the common section */
+/* Pointer to the common section */
 extern const asection bfd_com_section;
 #define bfd_com_section_ptr ((asection *) &bfd_com_section)
-     /* Pointer to the indirect section */
+/* Pointer to the indirect section */
 extern const asection bfd_ind_section;
 #define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
 #define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
@@ -1255,23 +1287,28 @@
      ((section)->reloc_done ? (section)->_cooked_size \
                             : (abort (), (bfd_size_type) 1))
 asection *
-bfd_get_section_by_name PARAMS ((bfd *abfd, CONST char *name));
+bfd_get_section_by_name PARAMS ((bfd *abfd, const char *name));
+
+char *
+bfd_get_unique_section_name PARAMS ((bfd *abfd,
+    const char *templat,
+    int *count));
 
 asection *
-bfd_make_section_old_way PARAMS ((bfd *abfd, CONST char *name));
+bfd_make_section_old_way PARAMS ((bfd *abfd, const char *name));
 
 asection *
-bfd_make_section_anyway PARAMS ((bfd *abfd, CONST char *name));
+bfd_make_section_anyway PARAMS ((bfd *abfd, const char *name));
 
 asection *
-bfd_make_section PARAMS ((bfd *, CONST char *name));
+bfd_make_section PARAMS ((bfd *, const char *name));
 
 boolean 
 bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags));
 
 void 
 bfd_map_over_sections PARAMS ((bfd *abfd,
-    void (*func)(bfd *abfd,
+    void (*func) (bfd *abfd,
     asection *sect,
     PTR obj),
     PTR obj));
@@ -1302,11 +1339,11 @@
 _bfd_strip_section_from_output
  PARAMS ((struct bfd_link_info *info, asection *section));
 
-enum bfd_architecture 
+enum bfd_architecture
 {
-  bfd_arch_unknown,    /* File arch not known */
-  bfd_arch_obscure,    /* Arch known, not one of these */
-  bfd_arch_m68k,       /* Motorola 68xxx */
+  bfd_arch_unknown,   /* File arch not known */
+  bfd_arch_obscure,   /* Arch known, not one of these */
+  bfd_arch_m68k,      /* Motorola 68xxx */
 #define bfd_mach_m68000 1
 #define bfd_mach_m68008 2
 #define bfd_mach_m68010 3
@@ -1315,14 +1352,14 @@
 #define bfd_mach_m68040 6
 #define bfd_mach_m68060 7
 #define bfd_mach_cpu32  8
-  bfd_arch_vax,        /* DEC Vax */   
-  bfd_arch_i960,       /* Intel 960 */
-     /* The order of the following is important.
-       lower number indicates a machine type that 
+  bfd_arch_vax,       /* DEC Vax */
+  bfd_arch_i960,      /* Intel 960 */
+    /* The order of the following is important.
+       lower number indicates a machine type that
        only accepts a subset of the instructions
        available to machines with higher numbers.
        The exception is the "ca", which is
-       incompatible with all other machines except 
+       incompatible with all other machines except
        "core". */
 
 #define bfd_mach_i960_core      1
@@ -1334,21 +1371,24 @@
 #define bfd_mach_i960_jx        7
 #define bfd_mach_i960_hx        8
 
-  bfd_arch_a29k,       /* AMD 29000 */
-  bfd_arch_sparc,      /* SPARC */
+  bfd_arch_a29k,      /* AMD 29000 */
+  bfd_arch_sparc,     /* SPARC */
 #define bfd_mach_sparc                 1
- /* The difference between v8plus and v9 is that v9 is a true 64 bit env.  */
+/* The difference between v8plus and v9 is that v9 is a true 64 bit env.  */
 #define bfd_mach_sparc_sparclet        2
 #define bfd_mach_sparc_sparclite       3
 #define bfd_mach_sparc_v8plus          4
-#define bfd_mach_sparc_v8plusa         5  /* with ultrasparc add'ns */
+#define bfd_mach_sparc_v8plusa         5 /* with ultrasparc add'ns */
 #define bfd_mach_sparc_sparclite_le    6
 #define bfd_mach_sparc_v9              7
-#define bfd_mach_sparc_v9a             8  /* with ultrasparc add'ns */
- /* Nonzero if MACH has the v9 instruction set.  */
+#define bfd_mach_sparc_v9a             8 /* with ultrasparc add'ns */
+#define bfd_mach_sparc_v8plusb         9 /* with cheetah add'ns */
+#define bfd_mach_sparc_v9b             10 /* with cheetah add'ns */
+/* Nonzero if MACH has the v9 instruction set.  */
 #define bfd_mach_sparc_v9_p(mach) \
-  ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a)
-  bfd_arch_mips,       /* MIPS Rxxxx */
+  ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
+   && (mach) != bfd_mach_sparc_sparclite_le)
+  bfd_arch_mips,      /* MIPS Rxxxx */
 #define bfd_mach_mips3000              3000
 #define bfd_mach_mips3900              3900
 #define bfd_mach_mips4000              4000
@@ -1364,36 +1404,66 @@
 #define bfd_mach_mips8000              8000
 #define bfd_mach_mips10000             10000
 #define bfd_mach_mips16                16
-  bfd_arch_i386,       /* Intel 386 */
+#define bfd_mach_mips32                32
+#define bfd_mach_mips32_4k             3204113 /* 32, 04, octal 'K' */
+#define bfd_mach_mips5                 5
+#define bfd_mach_mips64                64
+#define bfd_mach_mips_sb1              12310201 /* octal 'SB', 01 */
+  bfd_arch_i386,      /* Intel 386 */
 #define bfd_mach_i386_i386 0
 #define bfd_mach_i386_i8086 1
 #define bfd_mach_i386_i386_intel_syntax 2
-  bfd_arch_we32k,      /* AT&T WE32xxx */
-  bfd_arch_tahoe,      /* CCI/Harris Tahoe */
-  bfd_arch_i860,       /* Intel 860 */
-  bfd_arch_i370,       /* IBM 360/370 Mainframes */
-  bfd_arch_romp,       /* IBM ROMP PC/RT */
-  bfd_arch_alliant,    /* Alliant */
-  bfd_arch_convex,     /* Convex */
-  bfd_arch_m88k,       /* Motorola 88xxx */
-  bfd_arch_pyramid,    /* Pyramid Technology */
-  bfd_arch_h8300,      /* Hitachi H8/300 */
+#define bfd_mach_x86_64 3
+#define bfd_mach_x86_64_intel_syntax 4
+  bfd_arch_we32k,     /* AT&T WE32xxx */
+  bfd_arch_tahoe,     /* CCI/Harris Tahoe */
+  bfd_arch_i860,      /* Intel 860 */
+  bfd_arch_i370,      /* IBM 360/370 Mainframes */
+  bfd_arch_romp,      /* IBM ROMP PC/RT */
+  bfd_arch_alliant,   /* Alliant */
+  bfd_arch_convex,    /* Convex */
+  bfd_arch_m88k,      /* Motorola 88xxx */
+  bfd_arch_pyramid,   /* Pyramid Technology */
+  bfd_arch_h8300,     /* Hitachi H8/300 */
 #define bfd_mach_h8300   1
 #define bfd_mach_h8300h  2
 #define bfd_mach_h8300s  3
-  bfd_arch_powerpc,    /* PowerPC */
-  bfd_arch_rs6000,     /* IBM RS/6000 */
-  bfd_arch_hppa,       /* HP PA RISC */
-  bfd_arch_d10v,       /* Mitsubishi D10V */
+  bfd_arch_powerpc,   /* PowerPC */
+#define bfd_mach_ppc           0
+#define bfd_mach_ppc_403       403
+#define bfd_mach_ppc_403gc     4030
+#define bfd_mach_ppc_505       505
+#define bfd_mach_ppc_601       601
+#define bfd_mach_ppc_602       602
+#define bfd_mach_ppc_603       603
+#define bfd_mach_ppc_ec603e    6031
+#define bfd_mach_ppc_604       604
+#define bfd_mach_ppc_620       620
+#define bfd_mach_ppc_630       630
+#define bfd_mach_ppc_750       750
+#define bfd_mach_ppc_860       860
+#define bfd_mach_ppc_a35       35
+#define bfd_mach_ppc_rs64ii    642
+#define bfd_mach_ppc_rs64iii   643
+#define bfd_mach_ppc_7400      7400
+  bfd_arch_rs6000,    /* IBM RS/6000 */
+#define bfd_mach_rs6k          0
+#define bfd_mach_rs6k_rs1      6001
+#define bfd_mach_rs6k_rsc      6003
+#define bfd_mach_rs6k_rs2      6002
+  bfd_arch_hppa,      /* HP PA RISC */
+  bfd_arch_d10v,      /* Mitsubishi D10V */
 #define bfd_mach_d10v          0
 #define bfd_mach_d10v_ts2      2
 #define bfd_mach_d10v_ts3      3
-  bfd_arch_d30v,       /* Mitsubishi D30V */
-  bfd_arch_z8k,        /* Zilog Z8000 */
+  bfd_arch_d30v,      /* Mitsubishi D30V */
+  bfd_arch_m68hc11,   /* Motorola 68HC11 */
+  bfd_arch_m68hc12,   /* Motorola 68HC12 */
+  bfd_arch_z8k,       /* Zilog Z8000 */
 #define bfd_mach_z8001         1
 #define bfd_mach_z8002         2
-  bfd_arch_h8500,      /* Hitachi H8/500 */
-  bfd_arch_sh,         /* Hitachi SH */
+  bfd_arch_h8500,     /* Hitachi H8/500 */
+  bfd_arch_sh,        /* Hitachi SH */
 #define bfd_mach_sh            0
 #define bfd_mach_sh2        0x20
 #define bfd_mach_sh_dsp     0x2d
@@ -1401,11 +1471,11 @@
 #define bfd_mach_sh3_dsp    0x3d
 #define bfd_mach_sh3e       0x3e
 #define bfd_mach_sh4        0x40
-  bfd_arch_alpha,      /* Dec Alpha */
+  bfd_arch_alpha,     /* Dec Alpha */
 #define bfd_mach_alpha_ev4  0x10
 #define bfd_mach_alpha_ev5  0x20
 #define bfd_mach_alpha_ev6  0x30
-  bfd_arch_arm,        /* Advanced Risc Machines ARM */
+  bfd_arch_arm,       /* Advanced Risc Machines ARM */
 #define bfd_mach_arm_2         1
 #define bfd_mach_arm_2a        2
 #define bfd_mach_arm_3         3
@@ -1414,38 +1484,44 @@
 #define bfd_mach_arm_4T        6
 #define bfd_mach_arm_5         7
 #define bfd_mach_arm_5T        8
-  bfd_arch_ns32k,      /* National Semiconductors ns32000 */
-  bfd_arch_w65,        /* WDC 65816 */
-  bfd_arch_tic30,      /* Texas Instruments TMS320C30 */
-  bfd_arch_tic54x,     /* Texas Instruments TMS320C54X */
-  bfd_arch_tic80,      /* TI TMS320c80 (MVP) */
-  bfd_arch_v850,       /* NEC V850 */
+#define bfd_mach_arm_5TE       9
+#define bfd_mach_arm_XScale    10
+  bfd_arch_ns32k,     /* National Semiconductors ns32000 */
+  bfd_arch_w65,       /* WDC 65816 */
+  bfd_arch_tic30,     /* Texas Instruments TMS320C30 */
+  bfd_arch_tic54x,    /* Texas Instruments TMS320C54X */
+  bfd_arch_tic80,     /* TI TMS320c80 (MVP) */
+  bfd_arch_v850,      /* NEC V850 */
 #define bfd_mach_v850          0
 #define bfd_mach_v850e         'E'
 #define bfd_mach_v850ea        'A'
-  bfd_arch_arc,        /* Argonaut RISC Core */
+  bfd_arch_arc,       /* Argonaut RISC Core */
 #define bfd_mach_arc_base 0
-  bfd_arch_m32r,       /* Mitsubishi M32R/D */
-#define bfd_mach_m32r          0  /* backwards compatibility */
+  bfd_arch_m32r,      /* Mitsubishi M32R/D */
+#define bfd_mach_m32r          0 /* backwards compatibility */
 #define bfd_mach_m32rx         'x'
-  bfd_arch_mn10200,    /* Matsushita MN10200 */
-  bfd_arch_mn10300,    /* Matsushita MN10300 */
+  bfd_arch_mn10200,   /* Matsushita MN10200 */
+  bfd_arch_mn10300,   /* Matsushita MN10300 */
 #define bfd_mach_mn10300               300
 #define bfd_mach_am33          330
   bfd_arch_fr30,
 #define bfd_mach_fr30          0x46523330
   bfd_arch_mcore,
-  bfd_arch_ia64,       /* HP/Intel ia64 */
+  bfd_arch_ia64,      /* HP/Intel ia64 */
+#define bfd_mach_ia64_elf64    0
+#define bfd_mach_ia64_elf32    1
   bfd_arch_pj,
-  bfd_arch_avr,        /* Atmel AVR microcontrollers */
+  bfd_arch_avr,       /* Atmel AVR microcontrollers */
 #define bfd_mach_avr1          1
 #define bfd_mach_avr2          2
 #define bfd_mach_avr3          3
 #define bfd_mach_avr4          4
+#define bfd_mach_avr5          5
+  bfd_arch_cris,      /* Axis CRIS */
   bfd_arch_last
   };
 
-typedef struct bfd_arch_info 
+typedef struct bfd_arch_info
 {
   int bits_per_word;
   int bits_per_address;
@@ -1455,8 +1531,8 @@
   const char *arch_name;
   const char *printable_name;
   unsigned int section_align_power;
-  /* true if this is the default machine for the architecture */
-  boolean the_default; 
+  /* True if this is the default machine for the architecture.  */
+  boolean the_default;
   const struct bfd_arch_info * (*compatible)
        PARAMS ((const struct bfd_arch_info *a,
                 const struct bfd_arch_info *b));
@@ -1516,28 +1592,28 @@
 
 typedef enum bfd_reloc_status
 {
-        /* No errors detected */
+       /* No errors detected */
   bfd_reloc_ok,
 
-        /* The relocation was performed, but there was an overflow. */
+       /* The relocation was performed, but there was an overflow. */
   bfd_reloc_overflow,
 
-        /* The address to relocate was not within the section supplied. */
+       /* The address to relocate was not within the section supplied. */
   bfd_reloc_outofrange,
 
-        /* Used by special functions */
+       /* Used by special functions */
   bfd_reloc_continue,
 
-        /* Unsupported relocation size requested. */
+       /* Unsupported relocation size requested. */
   bfd_reloc_notsupported,
 
-        /* Unused */
+       /* Unused */
   bfd_reloc_other,
 
-        /* The symbol to relocate against was undefined. */
+       /* The symbol to relocate against was undefined. */
   bfd_reloc_undefined,
 
-        /* The relocation was performed, but may not be ok - presently
+       /* The relocation was performed, but may not be ok - presently
           generated only when linking i960 coff files with i960 b.out
           symbols.  If this type is returned, the error_message argument
           to bfd_perform_relocation will be set.  */
@@ -1548,40 +1624,40 @@
 
 typedef struct reloc_cache_entry
 {
-        /* A pointer into the canonical table of pointers  */
+       /* A pointer into the canonical table of pointers  */
   struct symbol_cache_entry **sym_ptr_ptr;
 
-        /* offset in section */
+       /* offset in section */
   bfd_size_type address;
 
-        /* addend for relocation value */
+       /* addend for relocation value */
   bfd_vma addend;
 
-        /* Pointer to how to perform the required relocation */
+       /* Pointer to how to perform the required relocation */
   reloc_howto_type *howto;
 
 } arelent;
 enum complain_overflow
 {
-        /* Do not complain on overflow. */
+       /* Do not complain on overflow. */
   complain_overflow_dont,
 
-        /* Complain if the bitfield overflows, whether it is considered
+       /* Complain if the bitfield overflows, whether it is considered
           as signed or unsigned. */
   complain_overflow_bitfield,
 
-        /* Complain if the value overflows when considered as signed
+       /* Complain if the value overflows when considered as signed
           number. */
   complain_overflow_signed,
 
-        /* Complain if the value overflows when considered as an
+       /* Complain if the value overflows when considered as an
           unsigned number. */
   complain_overflow_unsigned
 };
 
 struct reloc_howto_struct
 {
-        /*  The type field has mainly a documentary use - the back end can
+       /*  The type field has mainly a documentary use - the back end can
            do what it wants with it, though normally the back end's
            external idea of what a reloc number is stored
            in this field. For example, a PC relative word relocation
@@ -1589,34 +1665,34 @@
            what the outside world calls a R_PCRWORD reloc. */
   unsigned int type;
 
-        /*  The value the final relocation is shifted right by. This drops
+       /*  The value the final relocation is shifted right by. This drops
            unwanted data from the relocation.  */
   unsigned int rightshift;
 
-        /*  The size of the item to be relocated.  This is *not* a
+       /*  The size of the item to be relocated.  This is *not* a
            power-of-two measure.  To get the number of bytes operated
            on by a type of relocation, use bfd_get_reloc_size.  */
   int size;
 
-        /*  The number of bits in the item to be relocated.  This is used
+       /*  The number of bits in the item to be relocated.  This is used
            when doing overflow checking.  */
   unsigned int bitsize;
 
-        /*  Notes that the relocation is relative to the location in the
+       /*  Notes that the relocation is relative to the location in the
            data section of the addend. The relocation function will
            subtract from the relocation value the address of the location
            being relocated. */
   boolean pc_relative;
 
-        /*  The bit position of the reloc value in the destination.
+       /*  The bit position of the reloc value in the destination.
            The relocated value is left shifted by this amount. */
   unsigned int bitpos;
 
-        /* What type of overflow error should be checked for when
+       /* What type of overflow error should be checked for when
           relocating. */
   enum complain_overflow complain_on_overflow;
 
-        /* If this field is non null, then the supplied function is
+       /* If this field is non null, then the supplied function is
           called rather than the normal function. This allows really
           strange relocation methods to be accomodated (e.g., i960 callj
           instructions). */
@@ -1629,10 +1705,10 @@
                                             bfd *output_bfd,
                                             char **error_message));
 
-        /* The textual name of the relocation type. */
+       /* The textual name of the relocation type. */
   char *name;
 
-        /* Some formats record a relocation addend in the section contents
+       /* Some formats record a relocation addend in the section contents
           rather than with the relocation.  For ELF formats this is the
           distinction between USE_REL and USE_RELA (though the code checks
           for USE_REL == 1/0).  The value of this field is TRUE if the
@@ -1649,7 +1725,7 @@
           links (e.g. GOT stuff) it doesn't matter what this is set to.  */
   boolean partial_inplace;
 
-        /* The src_mask selects which parts of the read in data
+       /* The src_mask selects which parts of the read in data
           are to be used in the relocation sum.  E.g., if this was an 8 bit
           byte of data which we read and relocated, this would be
           0x000000ff. When we have relocs which have an addend, such as
@@ -1658,13 +1734,13 @@
           the mask would be 0x00000000. */
   bfd_vma src_mask;
 
-        /* The dst_mask selects which parts of the instruction are replaced
+       /* The dst_mask selects which parts of the instruction are replaced
           into the instruction. In most cases src_mask == dst_mask,
           except in the above special case, where dst_mask would be
           0x000000ff, and src_mask would be 0x00000000.   */
   bfd_vma dst_mask;
 
-        /* When some formats create PC relative instructions, they leave
+       /* When some formats create PC relative instructions, they leave
           the value of the pc of the place being relocated in the offset
           slot of the instruction, so that a PC relative relocation can
           be made just by adding in an ordinary offset (e.g., sun3 a.out).
@@ -1994,6 +2070,16 @@
   BFD_RELOC_386_GOTOFF,
   BFD_RELOC_386_GOTPC,
 
+/* x86-64/elf relocations */
+  BFD_RELOC_X86_64_GOT32,
+  BFD_RELOC_X86_64_PLT32,
+  BFD_RELOC_X86_64_COPY,
+  BFD_RELOC_X86_64_GLOB_DAT,
+  BFD_RELOC_X86_64_JUMP_SLOT,
+  BFD_RELOC_X86_64_RELATIVE,
+  BFD_RELOC_X86_64_GOTPCREL,
+  BFD_RELOC_X86_64_32S,
+
 /* ns32k relocations */
   BFD_RELOC_NS32K_IMM_8,
   BFD_RELOC_NS32K_IMM_16,
@@ -2120,6 +2206,11 @@
   BFD_RELOC_SH_LABEL,
   BFD_RELOC_SH_LOOP_START,
   BFD_RELOC_SH_LOOP_END,
+  BFD_RELOC_SH_COPY,
+  BFD_RELOC_SH_GLOB_DAT,
+  BFD_RELOC_SH_JMP_SLOT,
+  BFD_RELOC_SH_RELATIVE,
+  BFD_RELOC_SH_GOTPC,
 
 /* Thumb 23-, 12- and 9-bit pc-relative branches.  The lowest bit must
 be zero and is not stored in the instruction. */
@@ -2493,7 +2584,6 @@
   BFD_RELOC_IA64_LTOFF_FPTR64I,
   BFD_RELOC_IA64_LTOFF_FPTR64MSB,
   BFD_RELOC_IA64_LTOFF_FPTR64LSB,
-  BFD_RELOC_IA64_SEGBASE,
   BFD_RELOC_IA64_SEGREL32MSB,
   BFD_RELOC_IA64_SEGREL32LSB,
   BFD_RELOC_IA64_SEGREL64MSB,
@@ -2512,8 +2602,6 @@
   BFD_RELOC_IA64_LTV64LSB,
   BFD_RELOC_IA64_IPLTMSB,
   BFD_RELOC_IA64_IPLTLSB,
-  BFD_RELOC_IA64_EPLTMSB,
-  BFD_RELOC_IA64_EPLTLSB,
   BFD_RELOC_IA64_COPY,
   BFD_RELOC_IA64_TPREL22,
   BFD_RELOC_IA64_TPREL64MSB,
@@ -2521,6 +2609,60 @@
   BFD_RELOC_IA64_LTOFF_TP22,
   BFD_RELOC_IA64_LTOFF22X,
   BFD_RELOC_IA64_LDXMOV,
+
+/* Motorola 68HC11 reloc.
+This is the 8 bits high part of an absolute address. */
+  BFD_RELOC_M68HC11_HI8,
+
+/* Motorola 68HC11 reloc.
+This is the 8 bits low part of an absolute address. */
+  BFD_RELOC_M68HC11_LO8,
+
+/* Motorola 68HC11 reloc.
+This is the 3 bits of a value. */
+  BFD_RELOC_M68HC11_3B,
+
+/* These relocs are only used within the CRIS assembler.  They are not
+(at present) written to any object files. */
+  BFD_RELOC_CRIS_BDISP8,
+  BFD_RELOC_CRIS_UNSIGNED_5,
+  BFD_RELOC_CRIS_SIGNED_6,
+  BFD_RELOC_CRIS_UNSIGNED_6,
+  BFD_RELOC_CRIS_UNSIGNED_4,
+
+/* Intel i860 Relocations. */
+  BFD_RELOC_860_COPY,
+  BFD_RELOC_860_GLOB_DAT,
+  BFD_RELOC_860_JUMP_SLOT,
+  BFD_RELOC_860_RELATIVE,
+  BFD_RELOC_860_PC26,
+  BFD_RELOC_860_PLT26,
+  BFD_RELOC_860_PC16,
+  BFD_RELOC_860_LOW0,
+  BFD_RELOC_860_SPLIT0,
+  BFD_RELOC_860_LOW1,
+  BFD_RELOC_860_SPLIT1,
+  BFD_RELOC_860_LOW2,
+  BFD_RELOC_860_SPLIT2,
+  BFD_RELOC_860_LOW3,
+  BFD_RELOC_860_LOGOT0,
+  BFD_RELOC_860_SPGOT0,
+  BFD_RELOC_860_LOGOT1,
+  BFD_RELOC_860_SPGOT1,
+  BFD_RELOC_860_LOGOTOFF0,
+  BFD_RELOC_860_SPGOTOFF0,
+  BFD_RELOC_860_LOGOTOFF1,
+  BFD_RELOC_860_SPGOTOFF1,
+  BFD_RELOC_860_LOGOTOFF2,
+  BFD_RELOC_860_LOGOTOFF3,
+  BFD_RELOC_860_LOPC,
+  BFD_RELOC_860_HIGHADJ,
+  BFD_RELOC_860_HAGOT,
+  BFD_RELOC_860_HAGOTOFF,
+  BFD_RELOC_860_HAPC,
+  BFD_RELOC_860_HIGH,
+  BFD_RELOC_860_HIGOT,
+  BFD_RELOC_860_HIGOTOFF,
   BFD_RELOC_UNUSED };
 typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
 reloc_howto_type *
@@ -2533,7 +2675,7 @@
 
 typedef struct symbol_cache_entry
 {
-        /* A pointer to the BFD which owns the symbol. This information
+       /* A pointer to the BFD which owns the symbol. This information
           is necessary so that a back end can work out what additional
           information (invisible to the application writer) is carried
           with the symbol.
@@ -2543,65 +2685,65 @@
           bfd_{abs,com,und}_section.  This could be fixed by making
           these globals be per-bfd (or per-target-flavor).  FIXME. */
 
-  struct _bfd *the_bfd;  /* Use bfd_asymbol_bfd(sym) to access this field. */
+  struct _bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */
 
-        /* The text of the symbol. The name is left alone, and not copied; the
+       /* The text of the symbol. The name is left alone, and not copied; the
           application may not alter it. */
   CONST char *name;
 
-        /* The value of the symbol.  This really should be a union of a
+       /* The value of the symbol.  This really should be a union of a
           numeric value with a pointer, since some flags indicate that
           a pointer to another symbol is stored here.  */
   symvalue value;
 
-        /* Attributes of a symbol: */
+       /* Attributes of a symbol: */
 
 #define BSF_NO_FLAGS    0x00
 
-        /* The symbol has local scope; <<static>> in <<C>>. The value
+       /* The symbol has local scope; <<static>> in <<C>>. The value
           is the offset into the section of the data. */
 #define BSF_LOCAL      0x01
 
-        /* The symbol has global scope; initialized data in <<C>>. The
+       /* The symbol has global scope; initialized data in <<C>>. The
           value is the offset into the section of the data. */
 #define BSF_GLOBAL     0x02
 
-        /* The symbol has global scope and is exported. The value is
+       /* The symbol has global scope and is exported. The value is
           the offset into the section of the data. */
-#define BSF_EXPORT     BSF_GLOBAL  /* no real difference */
+#define BSF_EXPORT     BSF_GLOBAL /* no real difference */
 
-        /* A normal C symbol would be one of:
+       /* A normal C symbol would be one of:
           <<BSF_LOCAL>>, <<BSF_FORT_COMM>>,  <<BSF_UNDEFINED>> or
           <<BSF_GLOBAL>> */
 
-        /* The symbol is a debugging record. The value has an arbitary
+       /* The symbol is a debugging record. The value has an arbitary
           meaning, unless BSF_DEBUGGING_RELOC is also set.  */
 #define BSF_DEBUGGING  0x08
 
-        /* The symbol denotes a function entry point.  Used in ELF,
+       /* The symbol denotes a function entry point.  Used in ELF,
           perhaps others someday.  */
 #define BSF_FUNCTION    0x10
 
-        /* Used by the linker. */
+       /* Used by the linker. */
 #define BSF_KEEP        0x20
 #define BSF_KEEP_G      0x40
 
-        /* A weak global symbol, overridable without warnings by
+       /* A weak global symbol, overridable without warnings by
           a regular global symbol of the same name.  */
 #define BSF_WEAK        0x80
 
-        /* This symbol was created to point to a section, e.g. ELF's
+       /* This symbol was created to point to a section, e.g. ELF's
           STT_SECTION symbols.  */
 #define BSF_SECTION_SYM 0x100
 
-        /* The symbol used to be a common symbol, but now it is
+       /* The symbol used to be a common symbol, but now it is
           allocated. */
 #define BSF_OLD_COMMON  0x200
 
-        /* The default value for common data. */
+       /* The default value for common data. */
 #define BFD_FORT_COMM_DEFAULT_VALUE 0
 
-        /* In some files the type of a symbol sometimes alters its
+       /* In some files the type of a symbol sometimes alters its
           location in an output file - ie in coff a <<ISFCN>> symbol
           which is also <<C_EXT>> symbol appears where it was
           declared and not at the end of a section.  This bit is set
@@ -2609,43 +2751,43 @@
 
 #define BSF_NOT_AT_END    0x400
 
-        /* Signal that the symbol is the label of constructor section. */
+       /* Signal that the symbol is the label of constructor section. */
 #define BSF_CONSTRUCTOR   0x800
 
-        /* Signal that the symbol is a warning symbol.  The name is a
+       /* Signal that the symbol is a warning symbol.  The name is a
           warning.  The name of the next symbol is the one to warn about;
           if a reference is made to a symbol with the same name as the next
           symbol, a warning is issued by the linker. */
 #define BSF_WARNING       0x1000
 
-        /* Signal that the symbol is indirect.  This symbol is an indirect
+       /* Signal that the symbol is indirect.  This symbol is an indirect
           pointer to the symbol with the same name as the next symbol. */
 #define BSF_INDIRECT      0x2000
 
-        /* BSF_FILE marks symbols that contain a file name.  This is used
+       /* BSF_FILE marks symbols that contain a file name.  This is used
           for ELF STT_FILE symbols.  */
 #define BSF_FILE          0x4000
 
-        /* Symbol is from dynamic linking information.  */
+       /* Symbol is from dynamic linking information.  */
 #define BSF_DYNAMIC       0x8000
 
-        /* The symbol denotes a data object.  Used in ELF, and perhaps
+       /* The symbol denotes a data object.  Used in ELF, and perhaps
           others someday.  */
 #define BSF_OBJECT        0x10000
 
-        /* This symbol is a debugging symbol.  The value is the offset
+       /* This symbol is a debugging symbol.  The value is the offset
           into the section of the data.  BSF_DEBUGGING should be set
           as well.  */
 #define BSF_DEBUGGING_RELOC 0x20000
 
   flagword flags;
 
-        /* A pointer to the section to which this symbol is
+       /* A pointer to the section to which this symbol is
           relative.  This will always be non NULL, there are special
           sections for undefined and absolute symbols.  */
   struct sec *section;
 
-        /* Back end special data.  */
+       /* Back end special data.  */
   union
     {
       PTR p;
@@ -2691,15 +2833,15 @@
 #define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
      BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
                (ibfd, isymbol, obfd, osymbol))
-struct _bfd 
+struct _bfd
 {
-     /* The filename the application opened the BFD with.  */
-    CONST char *filename;                
+    /* The filename the application opened the BFD with.  */
+    CONST char *filename;
 
-     /* A pointer to the target jump table.             */
+    /* A pointer to the target jump table.             */
     const struct bfd_target *xvec;
 
-     /* To avoid dragging too many header files into every file that
+    /* To avoid dragging too many header files into every file that
        includes `<<bfd.h>>', IOSTREAM has been declared as a "char
        *", and MTIME as a "long".  Their correct types, to which they
        are cast when used, are "FILE *" and "time_t".    The iostream
@@ -2708,105 +2850,105 @@
        to a bfd_in_memory struct.  */
     PTR iostream;
 
-     /* Is the file descriptor being cached?  That is, can it be closed as
+    /* Is the file descriptor being cached?  That is, can it be closed as
        needed, and re-opened when accessed later?  */
 
     boolean cacheable;
 
-     /* Marks whether there was a default target specified when the
+    /* Marks whether there was a default target specified when the
        BFD was opened. This is used to select which matching algorithm
        to use to choose the back end. */
 
     boolean target_defaulted;
 
-     /* The caching routines use these to maintain a
+    /* The caching routines use these to maintain a
        least-recently-used list of BFDs */
 
     struct _bfd *lru_prev, *lru_next;
 
-     /* When a file is closed by the caching routines, BFD retains
+    /* When a file is closed by the caching routines, BFD retains
        state information on the file here: */
 
-    file_ptr where;              
+    file_ptr where;
 
-     /* and here: (``once'' means at least once) */
+    /* and here: (``once'' means at least once) */
 
     boolean opened_once;
 
-     /* Set if we have a locally maintained mtime value, rather than
+    /* Set if we have a locally maintained mtime value, rather than
        getting it from the file each time: */
 
     boolean mtime_set;
 
-     /* File modified time, if mtime_set is true: */
+    /* File modified time, if mtime_set is true: */
 
-    long mtime;          
+    long mtime;
 
-     /* Reserved for an unimplemented file locking extension.*/
+    /* Reserved for an unimplemented file locking extension.*/
 
     int ifd;
 
-     /* The format which belongs to the BFD. (object, core, etc.) */
+    /* The format which belongs to the BFD. (object, core, etc.) */
 
     bfd_format format;
 
-     /* The direction the BFD was opened with*/
+    /* The direction the BFD was opened with*/
 
     enum bfd_direction {no_direction = 0,
                         read_direction = 1,
                         write_direction = 2,
                         both_direction = 3} direction;
 
-     /* Format_specific flags*/
+    /* Format_specific flags*/
 
-    flagword flags;              
+    flagword flags;
 
-     /* Currently my_archive is tested before adding origin to
+    /* Currently my_archive is tested before adding origin to
        anything. I believe that this can become always an add of
        origin, with origin set to 0 for non archive files.   */
 
-    file_ptr origin;             
+    file_ptr origin;
 
-     /* Remember when output has begun, to stop strange things
+    /* Remember when output has begun, to stop strange things
        from happening. */
     boolean output_has_begun;
 
-     /* Pointer to linked list of sections*/
+    /* Pointer to linked list of sections*/
     struct sec  *sections;
 
-     /* The number of sections */
+    /* The number of sections */
     unsigned int section_count;
 
-     /* Stuff only useful for object files: 
+    /* Stuff only useful for object files:
        The start address. */
     bfd_vma start_address;
 
-     /* Used for input and output*/
+    /* Used for input and output*/
     unsigned int symcount;
 
-     /* Symbol table for output BFD (with symcount entries) */
-    struct symbol_cache_entry  **outsymbols;             
+    /* Symbol table for output BFD (with symcount entries) */
+    struct symbol_cache_entry  **outsymbols;
 
-     /* Pointer to structure which contains architecture information*/
+    /* Pointer to structure which contains architecture information*/
     const struct bfd_arch_info *arch_info;
 
-     /* Stuff only useful for archives:*/
-    PTR arelt_data;              
-    struct _bfd *my_archive;      /* The containing archive BFD.  */
-    struct _bfd *next;            /* The next BFD in the archive.  */
-    struct _bfd *archive_head;    /* The first BFD in the archive.  */
-    boolean has_armap;           
+    /* Stuff only useful for archives:*/
+    PTR arelt_data;
+    struct _bfd *my_archive;     /* The containing archive BFD.  */
+    struct _bfd *next;           /* The next BFD in the archive.  */
+    struct _bfd *archive_head;   /* The first BFD in the archive.  */
+    boolean has_armap;
 
-     /* A chain of BFD structures involved in a link.  */
+    /* A chain of BFD structures involved in a link.  */
     struct _bfd *link_next;
 
-     /* A field used by _bfd_generic_link_add_archive_symbols.  This will
+    /* A field used by _bfd_generic_link_add_archive_symbols.  This will
        be used only for archive elements.  */
     int archive_pass;
 
-     /* Used by the back end to hold private data. */
+    /* Used by the back end to hold private data. */
 
-    union 
+    union
       {
       struct aout_data_struct *aout_data;
       struct artdata *aout_ar_data;
@@ -2838,11 +2980,11 @@
       struct netbsd_core_struct *netbsd_core_data;
       PTR any;
       } tdata;
-  
-     /* Used by the application to hold private data*/
+
+    /* Used by the application to hold private data*/
     PTR usrdata;
 
-   /* Where all the allocated stuff under this BFD goes.  This is a
+  /* Where all the allocated stuff under this BFD goes.  This is a
      struct objalloc *, but we use PTR to avoid requiring the inclusion of
      objalloc.h.  */
     PTR memory;
@@ -2913,6 +3055,12 @@
 boolean 
 bfd_set_file_flags PARAMS ((bfd *abfd, flagword flags));
 
+int 
+bfd_get_arch_size  PARAMS ((bfd *abfd));
+
+int 
+bfd_get_sign_extend_vma  PARAMS ((bfd *abfd));
+
 boolean 
 bfd_set_start_address PARAMS ((bfd *abfd, bfd_vma vma));
 
@@ -2955,7 +3103,7 @@
 #define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
      BFD_SEND (abfd, _bfd_find_nearest_line,  (abfd, sec, syms, off, file, func, line))
 
-        /* Do these three do anything useful at all, for any back end?  */
+       /* Do these three do anything useful at all, for any back end?  */
 #define bfd_debug_info_start(abfd) \
         BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
 
@@ -3043,13 +3191,13 @@
     (bfd_assert (__FILE__,__LINE__), NULL))
 #endif
 #define BFD_SEND_FMT(bfd, message, arglist) \
-            (((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
+            (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
 
 #ifdef DEBUG_BFD_SEND
 #undef BFD_SEND_FMT
 #define BFD_SEND_FMT(bfd, message, arglist) \
   (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
-   (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) : \
+   (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
    (bfd_assert (__FILE__,__LINE__), NULL))
 #endif
 enum bfd_flavour {
@@ -3057,6 +3205,7 @@
   bfd_target_aout_flavour,
   bfd_target_coff_flavour,
   bfd_target_ecoff_flavour,
+  bfd_target_xcoff_flavour,
   bfd_target_elf_flavour,
   bfd_target_ieee_flavour,
   bfd_target_nlm_flavour,
@@ -3074,7 +3223,7 @@
 
 enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
 
- /* Forward declaration.  */
+/* Forward declaration.  */
 typedef struct bfd_link_info _bfd_link_info;
 
 typedef struct bfd_target
@@ -3083,10 +3232,10 @@
   enum bfd_flavour flavour;
   enum bfd_endian byteorder;
   enum bfd_endian header_byteorder;
-  flagword object_flags;       
+  flagword object_flags;
   flagword section_flags;
   char symbol_leading_char;
-  char ar_pad_char;            
+  char ar_pad_char;
   unsigned short ar_max_namelen;
   bfd_vma      (*bfd_getx64) PARAMS ((const bfd_byte *));
   bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
@@ -3110,7 +3259,7 @@
   boolean             (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
   boolean             (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
 
-   /* Generic entry points.  */
+  /* Generic entry points.  */
 #define BFD_JUMP_TABLE_GENERIC(NAME)\
 CAT(NAME,_close_and_cleanup),\
 CAT(NAME,_bfd_free_cached_info),\
@@ -3118,20 +3267,20 @@
 CAT(NAME,_get_section_contents),\
 CAT(NAME,_get_section_contents_in_window)
 
-   /* Called when the BFD is being closed to do any necessary cleanup.  */
+  /* Called when the BFD is being closed to do any necessary cleanup.  */
   boolean       (*_close_and_cleanup) PARAMS ((bfd *));
-   /* Ask the BFD to free all cached information.  */
+  /* Ask the BFD to free all cached information.  */
   boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
-   /* Called when a new section is created.  */
+  /* Called when a new section is created.  */
   boolean       (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
-   /* Read the contents of a section.  */
-  boolean       (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR, 
+  /* Read the contents of a section.  */
+  boolean       (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
                                             file_ptr, bfd_size_type));
   boolean       (*_bfd_get_section_contents_in_window)
                           PARAMS ((bfd *, sec_ptr, bfd_window *,
                                    file_ptr, bfd_size_type));
 
-   /* Entry points to copy private data.  */
+  /* Entry points to copy private data.  */
 #define BFD_JUMP_TABLE_COPY(NAME)\
 CAT(NAME,_bfd_copy_private_bfd_data),\
 CAT(NAME,_bfd_merge_private_bfd_data),\
@@ -3139,27 +3288,27 @@
 CAT(NAME,_bfd_copy_private_symbol_data),\
 CAT(NAME,_bfd_set_private_flags),\
 CAT(NAME,_bfd_print_private_bfd_data)\
-   /* Called to copy BFD general private data from one object file
+  /* Called to copy BFD general private data from one object file
      to another.  */
   boolean       (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
-   /* Called to merge BFD general private data from one object file
+  /* Called to merge BFD general private data from one object file
      to a common output file when linking.  */
   boolean       (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
-   /* Called to copy BFD private section data from one object file
+  /* Called to copy BFD private section data from one object file
      to another.  */
   boolean       (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
                                                        bfd *, sec_ptr));
-   /* Called to copy BFD private symbol data from one symbol 
+  /* Called to copy BFD private symbol data from one symbol
      to another.  */
   boolean       (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
                                                           bfd *, asymbol *));
-   /* Called to set private backend flags */
+  /* Called to set private backend flags */
   boolean       (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
 
-   /* Called to print private BFD data */
+  /* Called to print private BFD data */
   boolean       (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
 
-   /* Core file entry points.  */
+  /* Core file entry points.  */
 #define BFD_JUMP_TABLE_CORE(NAME)\
 CAT(NAME,_core_file_failing_command),\
 CAT(NAME,_core_file_failing_signal),\
@@ -3168,7 +3317,7 @@
   int      (*_core_file_failing_signal) PARAMS ((bfd *));
   boolean  (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
 
-   /* Archive entry points.  */
+  /* Archive entry points.  */
 #define BFD_JUMP_TABLE_ARCHIVE(NAME)\
 CAT(NAME,_slurp_armap),\
 CAT(NAME,_slurp_extended_name_table),\
@@ -3185,10 +3334,10 @@
   boolean  (*_bfd_construct_extended_name_table)
              PARAMS ((bfd *, char **, bfd_size_type *, const char **));
   void     (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
-  boolean  (*write_armap) PARAMS ((bfd *arch, 
+  boolean  (*write_armap) PARAMS ((bfd *arch,
                               unsigned int elength,
                               struct orl *map,
-                              unsigned int orl_count, 
+                              unsigned int orl_count,
                               int stridx));
   PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
   bfd *    (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
@@ -3197,7 +3346,7 @@
   int      (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
   boolean  (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
 
-   /* Entry points used for symbols.  */
+  /* Entry points used for symbols.  */
 #define BFD_JUMP_TABLE_SYMBOLS(NAME)\
 CAT(NAME,_get_symtab_upper_bound),\
 CAT(NAME,_get_symtab),\
@@ -3230,7 +3379,7 @@
                     struct sec *section, struct symbol_cache_entry **symbols,
                     bfd_vma offset, CONST char **file, CONST char **func,
                     unsigned int *line));
-  /* Back-door to allow format-aware applications to create debug symbols
+ /* Back-door to allow format-aware applications to create debug symbols
     while using BFD for everything else.  Currently used by the assembler
     when creating COFF files.  */
   asymbol *  (*_bfd_make_debug_symbol) PARAMS ((
@@ -3246,7 +3395,7 @@
   asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
                                              asymbol *));
 
-   /* Routines for relocs.  */
+  /* Routines for relocs.  */
 #define BFD_JUMP_TABLE_RELOCS(NAME)\
 CAT(NAME,_get_reloc_upper_bound),\
 CAT(NAME,_canonicalize_reloc),\
@@ -3254,12 +3403,12 @@
   long  (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
   long  (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
                                             struct symbol_cache_entry **));
-   /* See documentation on reloc types.  */
+  /* See documentation on reloc types.  */
   reloc_howto_type *
        (*reloc_type_lookup) PARAMS ((bfd *abfd,
                                      bfd_reloc_code_real_type code));
 
-   /* Routines used when writing an object file.  */
+  /* Routines used when writing an object file.  */
 #define BFD_JUMP_TABLE_WRITE(NAME)\
 CAT(NAME,_set_arch_mach),\
 CAT(NAME,_set_section_contents)
@@ -3268,7 +3417,7 @@
   boolean       (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
                                             file_ptr, bfd_size_type));
 
-   /* Routines used by the linker.  */
+  /* Routines used by the linker.  */
 #define BFD_JUMP_TABLE_LINK(NAME)\
 CAT(NAME,_sizeof_headers),\
 CAT(NAME,_bfd_get_relocated_section_contents),\
@@ -3287,45 +3436,45 @@
   boolean    (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,
                     struct bfd_link_info *, boolean *again));
 
-   /* Create a hash table for the linker.  Different backends store
+  /* Create a hash table for the linker.  Different backends store
      different information in this table.  */
   struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
 
-   /* Add symbols from this object file into the hash table.  */
+  /* Add symbols from this object file into the hash table.  */
   boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
 
-   /* Do a link based on the link_order structures attached to each
+  /* Do a link based on the link_order structures attached to each
      section of the BFD.  */
   boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
 
-   /* Should this section be split up into smaller pieces during linking.  */
+  /* Should this section be split up into smaller pieces during linking.  */
   boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
 
-   /* Remove sections that are not referenced from the output.  */
+  /* Remove sections that are not referenced from the output.  */
   boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
 
-   /* Routines to handle dynamic symbols and relocs.  */
+  /* Routines to handle dynamic symbols and relocs.  */
 #define BFD_JUMP_TABLE_DYNAMIC(NAME)\
 CAT(NAME,_get_dynamic_symtab_upper_bound),\
 CAT(NAME,_canonicalize_dynamic_symtab),\
 CAT(NAME,_get_dynamic_reloc_upper_bound),\
 CAT(NAME,_canonicalize_dynamic_reloc)
-   /* Get the amount of memory required to hold the dynamic symbols. */
+  /* Get the amount of memory required to hold the dynamic symbols. */
   long  (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
-   /* Read in the dynamic symbols.  */
+  /* Read in the dynamic symbols.  */
   long  (*_bfd_canonicalize_dynamic_symtab)
     PARAMS ((bfd *, struct symbol_cache_entry **));
-   /* Get the amount of memory required to hold the dynamic relocs.  */
+  /* Get the amount of memory required to hold the dynamic relocs.  */
   long  (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
-   /* Read in the dynamic relocs.  */
+  /* Read in the dynamic relocs.  */
   long  (*_bfd_canonicalize_dynamic_reloc)
     PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
 
-  /* Opposite endian version of this target.  */  
+ /* Opposite endian version of this target.  */
  const struct bfd_target * alternative_target;
- 
+
  PTR backend_data;
- 
+
 } bfd_target;
 boolean 
 bfd_set_default_target  PARAMS ((const char *name));
@@ -3337,7 +3486,7 @@
 bfd_target_list PARAMS ((void));
 
 const bfd_target * 
-bfd_search_for_target  PARAMS ((int (* search_func)(const bfd_target *, void *), void *));
+bfd_search_for_target  PARAMS ((int (* search_func) (const bfd_target *, void *), void *));
 
 boolean 
 bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
diff --git a/bfd/bfd.c b/bfd/bfd.c
index e04172f..3372708 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -33,10 +33,10 @@
 
 CODE_FRAGMENT
 .
-.struct _bfd 
+.struct _bfd
 .{
 .    {* The filename the application opened the BFD with.  *}
-.    CONST char *filename;                
+.    CONST char *filename;
 .
 .    {* A pointer to the target jump table.             *}
 .    const struct bfd_target *xvec;
@@ -69,7 +69,7 @@
 .    {* When a file is closed by the caching routines, BFD retains
 .       state information on the file here: *}
 .
-.    file_ptr where;              
+.    file_ptr where;
 .
 .    {* and here: (``once'' means at least once) *}
 .
@@ -82,7 +82,7 @@
 .
 .    {* File modified time, if mtime_set is true: *}
 .
-.    long mtime;          
+.    long mtime;
 .
 .    {* Reserved for an unimplemented file locking extension.*}
 .
@@ -101,13 +101,13 @@
 .
 .    {* Format_specific flags*}
 .
-.    flagword flags;              
+.    flagword flags;
 .
 .    {* Currently my_archive is tested before adding origin to
 .       anything. I believe that this can become always an add of
 .       origin, with origin set to 0 for non archive files.   *}
 .
-.    file_ptr origin;             
+.    file_ptr origin;
 .
 .    {* Remember when output has begun, to stop strange things
 .       from happening. *}
@@ -119,7 +119,7 @@
 .    {* The number of sections *}
 .    unsigned int section_count;
 .
-.    {* Stuff only useful for object files: 
+.    {* Stuff only useful for object files:
 .       The start address. *}
 .    bfd_vma start_address;
 .
@@ -127,17 +127,17 @@
 .    unsigned int symcount;
 .
 .    {* Symbol table for output BFD (with symcount entries) *}
-.    struct symbol_cache_entry  **outsymbols;             
+.    struct symbol_cache_entry  **outsymbols;
 .
 .    {* Pointer to structure which contains architecture information*}
 .    const struct bfd_arch_info *arch_info;
 .
 .    {* Stuff only useful for archives:*}
-.    PTR arelt_data;              
+.    PTR arelt_data;
 .    struct _bfd *my_archive;     {* The containing archive BFD.  *}
 .    struct _bfd *next;           {* The next BFD in the archive.  *}
 .    struct _bfd *archive_head;   {* The first BFD in the archive.  *}
-.    boolean has_armap;           
+.    boolean has_armap;
 .
 .    {* A chain of BFD structures involved in a link.  *}
 .    struct _bfd *link_next;
@@ -148,7 +148,7 @@
 .
 .    {* Used by the back end to hold private data. *}
 .
-.    union 
+.    union
 .      {
 .      struct aout_data_struct *aout_data;
 .      struct artdata *aout_ar_data;
@@ -180,7 +180,7 @@
 .      struct netbsd_core_struct *netbsd_core_data;
 .      PTR any;
 .      } tdata;
-.  
+.
 .    {* Used by the application to hold private data*}
 .    PTR usrdata;
 .
@@ -219,7 +219,6 @@
    it to the following struct so that the data will be available in coffcode.h
    where it is needed.  The typedef's used are defined in bfd.h */
 
-
 
 /*
 SECTION
@@ -376,7 +375,7 @@
      CONST char *message;
 {
   if (bfd_get_error () == bfd_error_system_call)
-    perror((char *)message);            /* must be system error then... */
+    perror((char *)message);            /* must be system error then...  */
   else {
     if (message == NULL || *message == '\0')
       fprintf (stderr, "%s\n", bfd_errmsg (bfd_get_error ()));
@@ -510,7 +509,6 @@
   _bfd_error_program_name = name;
 }
 
-
 /*
 FUNCTION
 	bfd_get_error_handler
@@ -547,7 +545,6 @@
 
 */
 
-
 long
 bfd_get_reloc_upper_bound (abfd, asect)
      bfd *abfd;
@@ -584,7 +581,6 @@
 	The @var{syms} table is also needed for horrible internal magic
 	reasons.
 
-
 */
 long
 bfd_canonicalize_reloc (abfd, asect, location, symbols)
@@ -615,7 +611,7 @@
 	The argument @var{abfd} is ignored.
 
 */
-/*ARGSUSED*/
+
 void
 bfd_set_reloc (ignore_abfd, asect, location, count)
      bfd *ignore_abfd ATTRIBUTE_UNUSED;
@@ -706,6 +702,65 @@
 
 /*
 FUNCTION
+	bfd_get_arch_size
+
+SYNOPSIS
+ 	int bfd_get_arch_size (bfd *abfd);
+
+DESCRIPTION
+	Returns the architecture address size, in bits, as determined
+	by the object file's format.  For ELF, this information is
+	included in the header.
+
+RETURNS
+	Returns the arch size in bits if known, <<-1>> otherwise.
+*/
+
+int
+bfd_get_arch_size (abfd)
+     bfd *abfd;
+{
+  if (abfd->xvec->flavour == bfd_target_elf_flavour)
+    return (get_elf_backend_data (abfd))->s->arch_size;
+
+  bfd_set_error (bfd_error_wrong_format);
+  return -1;
+}
+
+/*
+FUNCTION
+	bfd_get_sign_extend_vma
+
+SYNOPSIS
+ 	int bfd_get_sign_extend_vma (bfd *abfd);
+
+DESCRIPTION
+	Indicates if the target architecture "naturally" sign extends
+	an address.  Some architectures implicitly sign extend address
+	values when they are converted to types larger than the size
+	of an address.  For instance, bfd_get_start_address() will
+	return an address sign extended to fill a bfd_vma when this is
+	the case.
+
+RETURNS
+	Returns <<1>> if the target architecture is known to sign
+	extend addresses, <<0>> if the target architecture is known to
+	not sign extend addresses, and <<-1>> otherwise.
+*/
+
+int
+bfd_get_sign_extend_vma (abfd)
+     bfd *abfd;
+{
+  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+    return (get_elf_backend_data (abfd)->sign_extend_vma);
+
+  bfd_set_error (bfd_error_wrong_format);
+  return -1;
+}
+
+/*
+FUNCTION
 	bfd_set_start_address
 
 SYNOPSIS
@@ -727,7 +782,6 @@
   return true;
 }
 
-
 /*
 FUNCTION
 	bfd_get_mtime
@@ -779,7 +833,7 @@
 	Instead, we want to ask questions like "is this NNN byte sized
 	object I'm about to try read from file offset YYY reasonable?"
 	As as example of where we might do this, some object formats
-	use string tables for which the first <<sizeof(long)>> bytes of the
+	use string tables for which the first <<sizeof (long)>> bytes of the
 	table contain the size of the table itself, including the size bytes.
 	If an application tries to read what it thinks is one of these
 	string tables, without some way to validate the size, and for
@@ -926,7 +980,7 @@
   int digit;
 
   /* Let the host do it if possible.  */
-  if (sizeof(bfd_vma) <= sizeof(unsigned long))
+  if (sizeof (bfd_vma) <= sizeof (unsigned long))
     return (bfd_vma) strtoul (string, (char **) end, base);
 
   /* A negative base makes no sense, and we only need to go as high as hex.  */
@@ -950,7 +1004,7 @@
       (string[0] == '0') && ((string[1] == 'x') || (string[1] == 'X')))
     string += 2;
   /* XXX should we also skip over "0b" or "0B" if base is 2? */
-    
+
 /* Speed could be improved with a table like hex_value[] in gas.  */
 #define HEX_VALUE(c) \
   (isxdigit ((unsigned char) c)					\
@@ -978,7 +1032,7 @@
 	boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd);
 
 DESCRIPTION
-	Copy private BFD information from the BFD @var{ibfd} to the 
+	Copy private BFD information from the BFD @var{ibfd} to the
 	the BFD @var{obfd}.  Return <<true>> on success, <<false>> on error.
 	Possible error returns are:
 
@@ -999,7 +1053,7 @@
 	boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd);
 
 DESCRIPTION
-	Merge private BFD information from the BFD @var{ibfd} to the 
+	Merge private BFD information from the BFD @var{ibfd} to the
 	the output file BFD @var{obfd} when linking.  Return <<true>>
 	on success, <<false>> on error.  Possible error returns are:
 
diff --git a/bfd/binary.c b/bfd/binary.c
index c2980b0..771e431 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -255,6 +255,9 @@
      file_ptr offset;
      bfd_size_type size;
 {
+  if (size == 0)
+    return true;
+
   if (! abfd->output_has_begun)
     {
       boolean found_low;
@@ -270,6 +273,7 @@
 	if (((s->flags
 	      & (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_NEVER_LOAD))
 	     == (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC))
+	    && (s->_raw_size > 0)
 	    && (! found_low || s->lma < low))
 	  {
 	    low = s->lma;
@@ -281,17 +285,18 @@
 	  s->filepos = s->lma - low;
 
 	  /* Skip following warning check for sections that will not
-	     occupy file space.  */ 
+	     occupy file space.  */
 	  if ((s->flags
 	       & (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_NEVER_LOAD))
-	      != (SEC_HAS_CONTENTS | SEC_ALLOC))
+	      != (SEC_HAS_CONTENTS | SEC_ALLOC)
+	      || (s->_raw_size == 0))
 	    continue;
 
 	  /* If attempting to generate a binary file from a bfd with
 	     LMA's all over the place, huge (sparse?) binary files may
 	     result.  This condition attempts to detect this situation
 	     and print a warning.  Better heuristics would be nice to
-	     have. */
+	     have.  */
 
 	  if (s->filepos < 0)
 	    (*_bfd_error_handler)
@@ -383,6 +388,6 @@
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   NULL,
-  
+
   NULL
 };
diff --git a/bfd/bout.c b/bfd/bout.c
index c230e18..b197831 100644
--- a/bfd/bout.c
+++ b/bfd/bout.c
@@ -19,7 +19,6 @@
 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"
@@ -30,7 +29,6 @@
 #include "aout/stab_gnu.h"
 #include "libaout.h"		/* BFD a.out internal data structures */
 
-
 static int aligncode PARAMS ((bfd *abfd, asection *input_section,
 			      arelent *r, unsigned int shrink));
 static void perform_slip PARAMS ((bfd *abfd, unsigned int slip,
@@ -97,7 +95,7 @@
 {
   struct external_exec *bytes = (struct external_exec *)raw_bytes;
 
-  /* Now fill in fields in the raw data, from the fields in the exec struct. */
+  /* Now fill in fields in the raw data, from the fields in the exec struct.  */
   bfd_h_put_32 (abfd, execp->a_info  , bytes->e_info);
   PUT_WORD (abfd, execp->a_text  , bytes->e_text);
   PUT_WORD (abfd, execp->a_data  , bytes->e_data);
@@ -114,7 +112,6 @@
   bytes->e_relaxable[0] = execp->a_relaxable;
 }
 
-
 static const bfd_target *
 b_out_object_p (abfd)
      bfd *abfd;
@@ -140,7 +137,6 @@
   return aout_32_some_aout_object_p (abfd, &anexec, b_out_callback);
 }
 
-
 /* Finish up the opening of a b.out file for reading.  Fill in all the
    fields that are not handled by common code.  */
 
@@ -189,8 +185,8 @@
   obj_textsec (abfd)->rel_filepos = N_TROFF(*execp);
   obj_datasec (abfd)->rel_filepos =  N_DROFF(*execp);
 
-  adata(abfd).page_size = 1;	/* Not applicable. */
-  adata(abfd).segment_size = 1; /* Not applicable. */
+  adata(abfd).page_size = 1;	/* Not applicable.  */
+  adata(abfd).segment_size = 1; /* Not applicable.  */
   adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
 
   if (execp->a_relaxable)
@@ -310,22 +306,22 @@
 	}
 
       if (q > outsyms)
-	qsort (outsyms, q - outsyms, sizeof(asymbol*), b_out_symbol_cmp);
+	qsort (outsyms, q - outsyms, sizeof (asymbol*), b_out_symbol_cmp);
 
       /* Back to your regularly scheduled program.  */
 
-      if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*exec_hdr(abfd))), SEEK_SET)
+      if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*exec_hdr(abfd))), SEEK_SET)
 	  != 0)
 	return false;
 
       if (! aout_32_write_syms (abfd))
 	return false;
 
-      if (bfd_seek (abfd, (file_ptr)(N_TROFF(*exec_hdr(abfd))), SEEK_SET) != 0)
+      if (bfd_seek (abfd, (file_ptr) (N_TROFF(*exec_hdr(abfd))), SEEK_SET) != 0)
 	return false;
 
       if (!b_out_squirt_out_relocs (abfd, obj_textsec (abfd))) return false;
-      if (bfd_seek (abfd, (file_ptr)(N_DROFF(*exec_hdr(abfd))), SEEK_SET)
+      if (bfd_seek (abfd, (file_ptr) (N_DROFF(*exec_hdr(abfd))), SEEK_SET)
 	  != 0)
 	return false;
 
@@ -344,7 +340,6 @@
 #define CALL      0x09000000
 #define PCREL13_MASK 0x1fff
 
-
 #define output_addr(sec) ((sec)->output_offset+(sec)->output_section->vma)
 
 /* Magic to turn callx into calljx */
@@ -380,11 +375,10 @@
 
   word += value + reloc_entry->addend;
 
-  bfd_put_32(abfd, word, dst);
+  bfd_put_32 (abfd, word, dst);
   return bfd_reloc_ok;
 }
 
-
 /* Magic to turn call into callj */
 static bfd_reloc_status_type
 callj_callback (abfd, link_info, reloc_entry,  data, srcidx, dstidx,
@@ -417,7 +411,7 @@
 
       /* The next symbol should be an N_BALNAME.  */
       BFD_ASSERT(IS_BALNAME(balsym->other));
-      
+
       /* We are calling a leaf, so replace the call instruction with a
 	 bal.  */
       word = BAL | ((word
@@ -445,7 +439,7 @@
 		      - output_addr (input_section))
 		     & BAL_MASK);
     }
-  bfd_put_32(abfd, word, (bfd_byte *) data + dstidx);
+  bfd_put_32 (abfd, word, (bfd_byte *) data + dstidx);
   return bfd_reloc_ok;
 }
 
@@ -472,7 +466,6 @@
 static reloc_howto_type howto_reloc_pcrel13 =
 HOWTO(PCREL13, 0, 2, 13, true, 0, complain_overflow_signed,0,"pcrel13", true, 0x00001fff,0x00001fff,false);
 
-
 static reloc_howto_type howto_reloc_abs32codeshrunk =
 HOWTO(ABS32CODE_SHRUNK, 0, 2, 24, true, 0, complain_overflow_signed, 0,"callx->callj", true, 0x00ffffff, 0x00ffffff,false);
 
@@ -556,7 +549,7 @@
   return false;
 
  doit:
-  if (bfd_seek (abfd, (file_ptr)(asect->rel_filepos),  SEEK_SET) != 0)
+  if (bfd_seek (abfd, (file_ptr) (asect->rel_filepos),  SEEK_SET) != 0)
     return false;
   count = reloc_size / sizeof (struct relocation_info);
 
@@ -577,8 +570,6 @@
     return false;
   }
 
-
-
   if (bfd_header_big_endian (abfd)) {
     /* big-endian bit field allocation order */
     pcrel_mask  = 0x80;
@@ -728,17 +719,14 @@
     }
   }
 
-
   if (relocs != NULL)
     free (relocs);
   asect->relocation = reloc_cache;
   asect->reloc_count = count;
 
-
   return true;
 }
 
-
 static boolean
 b_out_squirt_out_relocs (abfd, section)
      bfd *abfd;
@@ -956,7 +944,7 @@
     if (! aout_32_make_sections (abfd))
       return false;
 
-    obj_textsec (abfd)->filepos = sizeof(struct internal_exec);
+    obj_textsec (abfd)->filepos = sizeof (struct internal_exec);
     obj_datasec(abfd)->filepos = obj_textsec(abfd)->filepos
                                  +  obj_textsec (abfd)->_raw_size;
 
@@ -1005,11 +993,9 @@
      bfd *ignore_abfd ATTRIBUTE_UNUSED;
      boolean ignore ATTRIBUTE_UNUSED;
 {
-  return sizeof(struct internal_exec);
+  return sizeof (struct internal_exec);
 }
 
-
-
 /************************************************************************/
 static bfd_vma
 get_value (reloc, link_info, input_section)
@@ -1125,7 +1111,6 @@
 
   gap = value - (dot - shrink);
 
-
   if (-1<<23 < (long)gap && (long)gap < 1<<23 )
   {
     /* Change the reloc type from 32bitcode possible 24, to 24bit
@@ -1425,7 +1410,7 @@
 		  break;
 
 		default:
-		  abort();
+		  abort ();
 		}
 	    }
 	}
@@ -1494,11 +1479,10 @@
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   & b_out_vec_little_host,
-  
+
   (PTR) 0,
 };
 
-
 const bfd_target b_out_vec_little_host =
 {
   "b.out.little",		/* name */
@@ -1537,6 +1521,6 @@
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   & b_out_vec_big_host,
-  
+
   (PTR) 0
 };
diff --git a/bfd/cache.c b/bfd/cache.c
index 91b6c61..c4becf8 100644
--- a/bfd/cache.c
+++ b/bfd/cache.c
@@ -32,7 +32,7 @@
 	<<bfd_cache_lookup>>, which runs around and makes sure that
 	the required BFD is open. If not, then it chooses a file to
 	close, closes it and opens the one wanted, returning its file
-	handle. 
+	handle.
 
 */
 
@@ -79,19 +79,18 @@
 /*
   INTERNAL_FUNCTION
   	bfd_cache_lookup
- 
+
   DESCRIPTION
  	Check to see if the required BFD is the same as the last one
  	looked up. If so, then it can use the stream in the BFD with
  	impunity, since it can't have changed since the last lookup;
  	otherwise, it has to perform the complicated lookup function.
- 
+
   .#define bfd_cache_lookup(x) \
   .    ((x)==bfd_last_cache? \
-  .      (FILE*)(bfd_last_cache->iostream): \
+  .      (FILE*) (bfd_last_cache->iostream): \
   .       bfd_cache_lookup_worker(x))
- 
- 
+
  */
 
 /* Insert a BFD into the cache.  */
@@ -262,7 +261,7 @@
 bfd_open_file (abfd)
      bfd *abfd;
 {
-  abfd->cacheable = true;	/* Allow it to be closed later. */
+  abfd->cacheable = true;	/* Allow it to be closed later.  */
 
   if (open_files >= BFD_CACHE_MAX_OPEN)
     {
@@ -339,7 +338,7 @@
 	quick answer.  Find a file descriptor for @var{abfd}.  If
 	necessary, it open it.  If there are already more than
 	<<BFD_CACHE_MAX_OPEN>> files open, it tries to close one first, to
-	avoid running out of file descriptors.  
+	avoid running out of file descriptors.
 */
 
 FILE *
@@ -349,7 +348,7 @@
   if ((abfd->flags & BFD_IN_MEMORY) != 0)
     abort ();
 
-  if (abfd->my_archive) 
+  if (abfd->my_archive)
     abfd = abfd->my_archive;
 
   if (abfd->iostream != NULL)
diff --git a/bfd/cisco-core.c b/bfd/cisco-core.c
index 3492e75..9d1fb6f 100644
--- a/bfd/cisco-core.c
+++ b/bfd/cisco-core.c
@@ -72,7 +72,7 @@
 };
 
 /* Examine the file for a crash info struct at the offset given by
-   CRASH_INFO_LOC. */
+   CRASH_INFO_LOC.  */
 
 static const bfd_target *
 cisco_core_file_validate (abfd, crash_info_loc)
@@ -236,7 +236,7 @@
   abfd->section_count = 0;
 
   /* Create a ".reg" section to allow access to the saved
-     registers. */
+     registers.  */
 
   asect = (asection *) bfd_zmalloc (sizeof (asection));
   if (asect == NULL)
@@ -247,7 +247,7 @@
   asect->filepos = bfd_get_32 (abfd, crashinfo.registers) - rambase;
   /* Since we don't know the exact size of the saved register info,
      choose a register section size that is either the remaining part
-     of the file, or 1024, whichever is smaller. */
+     of the file, or 1024, whichever is smaller.  */
   nread = statbuf.st_size - asect->filepos;
   asect->_raw_size = (nread < 1024) ? nread : 1024;
   asect->next = abfd->sections;
@@ -255,7 +255,7 @@
   ++abfd->section_count;
 
   /* Create a ".crash" section to allow access to the saved
-     crash information. */
+     crash information.  */
 
   asect = (asection *) bfd_zmalloc (sizeof (asection));
   if (asect == NULL)
@@ -270,7 +270,7 @@
   ++abfd->section_count;
 
   /* Create a ".data" section that maps the entire file, which is
-     essentially a dump of the target system's RAM. */
+     essentially a dump of the target system's RAM.  */
 
   asect = (asection *) bfd_zmalloc (sizeof (asection));
   if (asect == NULL)
@@ -288,7 +288,7 @@
   return abfd->xvec;
 
   /* Get here if we have already started filling out the BFD
-     and there is an error of some kind. */
+     and there is an error of some kind.  */
 
  error_return:
   {
@@ -378,7 +378,7 @@
      bfd_false, bfd_false,
      bfd_false, bfd_false
     },
-    
+
        BFD_JUMP_TABLE_GENERIC (_bfd_generic),
        BFD_JUMP_TABLE_COPY (_bfd_generic),
        BFD_JUMP_TABLE_CORE (cisco),
@@ -390,7 +390,7 @@
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
     & cisco_core_little_vec,
-    
+
     (PTR) 0			/* backend_data */
 };
 
@@ -428,7 +428,7 @@
      bfd_false, bfd_false,
      bfd_false, bfd_false
     },
-    
+
        BFD_JUMP_TABLE_GENERIC (_bfd_generic),
        BFD_JUMP_TABLE_COPY (_bfd_generic),
        BFD_JUMP_TABLE_CORE (cisco),
@@ -440,6 +440,6 @@
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
     &cisco_core_big_vec,
-    
+
     (PTR) 0			/* backend_data */
 };
diff --git a/bfd/coff-a29k.c b/bfd/coff-a29k.c
index 26d3c64..55b244c 100644
--- a/bfd/coff-a29k.c
+++ b/bfd/coff-a29k.c
@@ -49,21 +49,21 @@
 
 /* Provided the symbol, returns the value reffed */
 static long
-get_symbol_value (symbol)       
+get_symbol_value (symbol)
      asymbol *symbol;
-{                                             
+{
   long relocation = 0;
 
   if (bfd_is_com_section (symbol->section))
   {
-    relocation = 0;                           
+    relocation = 0;
   }
-  else 
-  {                                      
+  else
+  {
     relocation = symbol->value +
      symbol->section->output_section->vma +
       symbol->section->output_offset;
-  }                                           
+  }
 
   return(relocation);
 }
@@ -93,8 +93,8 @@
   long signed_value;
 
   unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/
-  bfd_byte  *hit_data =addr + (bfd_byte *)(data);
-	
+  bfd_byte  *hit_data =addr + (bfd_byte *) (data);
+
   r_type = reloc_entry->howto->type;
 
   if (output_bfd) {
@@ -108,7 +108,7 @@
       && bfd_is_und_section (symbol_in->section))
   {
     /* Keep the state machine happy in case we're called again */
-    if (r_type == R_IHIHALF) 
+    if (r_type == R_IHIHALF)
     {
       part1_consth_active = true;
       part1_consth_value  = 0;
@@ -116,20 +116,19 @@
     return(bfd_reloc_undefined);
   }
 
-  if ((part1_consth_active) && (r_type != R_IHCONST)) 
+  if ((part1_consth_active) && (r_type != R_IHCONST))
   {
     part1_consth_active = false;
     *error_message = (char *) _("Missing IHCONST");
     return(bfd_reloc_dangerous);
   }
 
-
   sym_value = get_symbol_value(symbol_in);
 
-  switch (r_type) 
+  switch (r_type)
   {
-   case R_IREL: 	
-    insn = bfd_get_32(abfd, hit_data); 
+   case R_IREL:
+    insn = bfd_get_32 (abfd, hit_data);
     /* Take the value in the field and sign extend it */
     signed_value = EXTRACT_HWORD(insn);
     signed_value = SIGN_EXTEND_HWORD(signed_value);
@@ -144,39 +143,39 @@
     {				/* Absolute jmp/call */
       insn |= (1<<24);		/* Make it absolute */
       /* FIXME: Should we change r_type to R_IABS */
-    } 
-    else 
+    }
+    else
     {
       /* Relative jmp/call, so subtract from the value the
 	 address of the place we're coming from */
       signed_value -= (reloc_entry->address
 		       + input_section->output_section->vma
 		       + input_section->output_offset);
-      if (signed_value>0x1ffff || signed_value<-0x20000) 
+      if (signed_value>0x1ffff || signed_value<-0x20000)
        return(bfd_reloc_overflow);
     }
     signed_value >>= 2;
     insn = INSERT_HWORD(insn, signed_value);
-    bfd_put_32(abfd, insn ,hit_data); 
+    bfd_put_32 (abfd, insn ,hit_data);
     break;
-   case R_ILOHALF: 
-    insn = bfd_get_32(abfd, hit_data); 
+   case R_ILOHALF:
+    insn = bfd_get_32 (abfd, hit_data);
     unsigned_value = EXTRACT_HWORD(insn);
     unsigned_value +=  sym_value + reloc_entry->addend;
     insn = INSERT_HWORD(insn, unsigned_value);
-    bfd_put_32(abfd, insn, hit_data); 
+    bfd_put_32 (abfd, insn, hit_data);
     break;
    case R_IHIHALF:
-    insn = bfd_get_32(abfd, hit_data); 
-    /* consth, part 1 
+    insn = bfd_get_32 (abfd, hit_data);
+    /* consth, part 1
        Just get the symbol value that is referenced */
     part1_consth_active = true;
     part1_consth_value = sym_value + reloc_entry->addend;
     /* Don't modify insn until R_IHCONST */
     break;
-   case R_IHCONST:	
-    insn = bfd_get_32(abfd, hit_data); 
-    /* consth, part 2 
+   case R_IHCONST:
+    insn = bfd_get_32 (abfd, hit_data);
+    /* consth, part 2
        Now relocate the reference */
     if (part1_consth_active == false) {
       *error_message = (char *) _("Missing IHIHALF");
@@ -189,34 +188,33 @@
     unsigned_value = unsigned_value >> 16;
     insn = INSERT_HWORD(insn, unsigned_value);
     part1_consth_active = false;
-    bfd_put_32(abfd, insn, hit_data); 
+    bfd_put_32 (abfd, insn, hit_data);
     break;
    case R_BYTE:
-    insn = bfd_get_8(abfd, hit_data); 
-    unsigned_value = insn + sym_value + reloc_entry->addend;	
+    insn = bfd_get_8 (abfd, hit_data);
+    unsigned_value = insn + sym_value + reloc_entry->addend;
     if (unsigned_value & 0xffffff00)
       return(bfd_reloc_overflow);
-    bfd_put_8(abfd, unsigned_value, hit_data); 
+    bfd_put_8 (abfd, unsigned_value, hit_data);
     break;
    case R_HWORD:
-    insn = bfd_get_16(abfd, hit_data); 
-    unsigned_value = insn + sym_value + reloc_entry->addend;	
+    insn = bfd_get_16 (abfd, hit_data);
+    unsigned_value = insn + sym_value + reloc_entry->addend;
     if (unsigned_value & 0xffff0000)
       return(bfd_reloc_overflow);
-    bfd_put_16(abfd, insn, hit_data); 
+    bfd_put_16 (abfd, insn, hit_data);
     break;
    case R_WORD:
-    insn = bfd_get_32(abfd, hit_data); 
-    insn += sym_value + reloc_entry->addend;  
-    bfd_put_32(abfd, insn, hit_data);
+    insn = bfd_get_32 (abfd, hit_data);
+    insn += sym_value + reloc_entry->addend;
+    bfd_put_32 (abfd, insn, hit_data);
     break;
    default:
     *error_message = _("Unrecognized reloc");
     return (bfd_reloc_dangerous);
   }
 
-
-  return(bfd_reloc_ok);	
+  return(bfd_reloc_ok);
 }
 
 /*      type	   rightshift
@@ -228,12 +226,12 @@
 					     complain_on_overflow
 						  special_function
 						    relocation name
-							       partial_inplace 
+							       partial_inplace
 								      src_mask
 */
 
 /*FIXME: I'm not real sure about this table */
-static reloc_howto_type howto_table[] = 
+static reloc_howto_type howto_table[] =
 {
   {R_ABS,     0, 3, 32, false, 0, complain_overflow_bitfield,a29k_reloc,"ABS",     true, 0xffffffff,0xffffffff, false},
   EMPTY_HOWTO (1),
@@ -284,10 +282,10 @@
 {
     static bfd_vma ihihalf_vaddr = (bfd_vma) -1;
 
-    relent->address = reloc->r_vaddr;		
+    relent->address = reloc->r_vaddr;
     relent->howto = howto_table + reloc->r_type;
-    if (reloc->r_type == R_IHCONST) 
-    {		
+    if (reloc->r_type == R_IHCONST)
+    {
       /* The address of an R_IHCONST should always be the address of
 	 the immediately preceding R_IHIHALF.  relocs generated by gas
 	 are correct, but relocs generated by High C are different (I
@@ -298,27 +296,27 @@
 	  abort ();
 	relent->address = ihihalf_vaddr;
 	ihihalf_vaddr = (bfd_vma) -1;
-	relent->addend = reloc->r_symndx;		
+	relent->addend = reloc->r_symndx;
 	relent->sym_ptr_ptr= bfd_abs_section_ptr->symbol_ptr_ptr;
     }
-    else 
+    else
     {
       asymbol *ptr;
       relent->sym_ptr_ptr = symbols + obj_convert(abfd)[reloc->r_symndx];
 
       ptr = *(relent->sym_ptr_ptr);
 
-      if (ptr 
-	  && bfd_asymbol_bfd(ptr) == abfd		
+      if (ptr
+	  && bfd_asymbol_bfd(ptr) == abfd
 
-	  && ((ptr->flags & BSF_OLD_COMMON)== 0))	
-      {						
+	  && ((ptr->flags & BSF_OLD_COMMON)== 0))
+      {
 	  relent->addend = 0;
-      }						
+      }
       else
-      {					
-	  relent->addend = 0;			
-      }			
+      {
+	  relent->addend = 0;
+      }
       relent->address-= section->vma;
       if (reloc->r_type == R_IHIHALF)
 	ihihalf_vaddr = relent->address;
@@ -570,7 +568,7 @@
 		  rel->r_vaddr - input_section->vma)))
 	    return false;
 	}
-    }     
+    }
 
   return true;
 }
@@ -580,7 +578,6 @@
 /* We don't want to change the symndx of a R_IHCONST reloc, since it
    is actually an addend, not a symbol index at all.  */
 
-/*ARGSUSED*/
 static boolean
 coff_a29k_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
      bfd *obfd ATTRIBUTE_UNUSED;
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index 79b8023..41e4710 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -924,7 +924,7 @@
 	     does not cause anything to happen, itself.  */
 	  rel->address += input_section->output_offset;
 	  break;
-	    
+
 	case ALPHA_R_GPDISP:
 	  /* This marks the ldah of an ldah/lda pair which loads the
 	     gp register with the difference of the gp value and the
@@ -980,7 +980,7 @@
 	    rel->address += input_section->output_offset;
 	  }
 	  break;
-	  
+
 	case ALPHA_R_OP_PUSH:
 	  /* Push a value on the reloc evaluation stack.  */
 	  {
@@ -1106,7 +1106,7 @@
 	    stack[tos - 1] >>= relocation;
 	  }
 	  break;
-	    
+
 	case ALPHA_R_GPVALUE:
 	  /* I really don't know if this does the right thing.  */
 	  gp = rel->addend;
@@ -1126,7 +1126,7 @@
 	  os->reloc_count++;
 	}
 
-      if (r != bfd_reloc_ok) 
+      if (r != bfd_reloc_ok)
 	{
 	  switch (r)
 	    {
@@ -1136,7 +1136,7 @@
 		      input_bfd, input_section, rel->address, true)))
 		goto error_return;
 	      break;
-	    case bfd_reloc_dangerous: 
+	    case bfd_reloc_dangerous:
 	      if (! ((*link_info->callbacks->reloc_dangerous)
 		     (link_info, err, input_bfd, input_section,
 		      rel->address)))
@@ -1332,7 +1332,7 @@
 	    r_symndx = RELOC_SECTION_XDATA;
 	  break;
 	}
-		      
+
       if (r_symndx == -1)
 	abort ();
 
@@ -1437,7 +1437,7 @@
      pointer.  To support large programs, we need to allow multiple
      global pointers.  This works as long as each input .lita section
      is <64KB big.  This implies that when producing relocatable
-     output, the .lita section is limited to 64KB. . */
+     output, the .lita section is limited to 64KB. .  */
 
   lita_sec = symndx_to_section[RELOC_SECTION_LITA];
   gp = _bfd_get_gp_value (output_bfd);
@@ -1619,7 +1619,7 @@
 	  /* See ALPHA_R_LITERAL above for the uses of this reloc.  It
 	     does not cause anything to happen, itself.  */
 	  break;
-	    
+
 	case ALPHA_R_GPDISP:
 	  /* This marks the ldah of an ldah/lda pair which loads the
 	     gp register with the difference of the gp value and the
@@ -1679,7 +1679,7 @@
 	    gp_usedp = true;
 	  }
 	  break;
-	  
+
 	case ALPHA_R_OP_PUSH:
 	case ALPHA_R_OP_PSUB:
 	case ALPHA_R_OP_PRSHIFT:
@@ -2008,7 +2008,6 @@
 /* Do final adjustments to the filehdr and the aouthdr.  This routine
    sets the dynamic bits in the file header.  */
 
-/*ARGSUSED*/
 static boolean
 alpha_adjust_headers (abfd, fhdr, ahdr)
      bfd *abfd;
@@ -2136,7 +2135,7 @@
 
       left = size;
 
-      /* I don't know what the next eight bytes are for. */
+      /* I don't know what the next eight bytes are for.  */
       if (bfd_read (ab, 1, 8, nbfd) != 8)
 	goto error_return;
 
@@ -2201,7 +2200,7 @@
  error_return:
   if (nbfd != NULL)
     bfd_close (nbfd);
-  return NULL;  
+  return NULL;
 }
 
 /* Open the next archived file.  */
@@ -2229,7 +2228,7 @@
 
       /* Pad to an even boundary...
 	 Note that last_file->origin can be odd in the case of
-	 BSD-4.4-style element with a long odd size. */
+	 BSD-4.4-style element with a long odd size.  */
       filestart = last_file->origin + size;
       filestart += filestart % 2;
     }
@@ -2400,6 +2399,6 @@
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   NULL,
-  
+
   (PTR) &alpha_ecoff_backend_data
 };
diff --git a/bfd/coff-apollo.c b/bfd/coff-apollo.c
index 6075d52..7a28efa 100644
--- a/bfd/coff-apollo.c
+++ b/bfd/coff-apollo.c
@@ -31,7 +31,7 @@
 #ifdef ONLY_DECLARE_RELOCS
 extern reloc_howto_type apollocoff_howto_table[];
 #else
-reloc_howto_type apollocoff_howto_table[] = 
+reloc_howto_type apollocoff_howto_table[] =
 {
   HOWTO(R_RELBYTE,	       0,  0,  	8,  false, 0, complain_overflow_bitfield, 0, "8",	true, 0x000000ff,0x000000ff, false),
   HOWTO(R_RELWORD,	       0,  1, 	16, false, 0, complain_overflow_bitfield, 0, "16",	true, 0x0000ffff,0x0000ffff, false),
@@ -59,7 +59,7 @@
      arelent *internal;
      int relocentry;
 {
-  switch (relocentry) 
+  switch (relocentry)
   {
    case R_RELBYTE:	internal->howto = apollocoff_howto_table + 0; break;
    case R_RELWORD:	internal->howto = apollocoff_howto_table + 1; break;
@@ -71,13 +71,13 @@
   }
 }
 
-int 
+int
 apollo_howto2rtype (internal)
      reloc_howto_type *internal;
 {
-  if (internal->pc_relative) 
+  if (internal->pc_relative)
   {
-    switch (internal->bitsize) 
+    switch (internal->bitsize)
     {
      case 32: return R_PCRLONG;
      case 16: return R_PCRWORD;
@@ -93,7 +93,7 @@
       case 8: return R_RELBYTE;
      }
   }
-  return R_RELLONG;    
+  return R_RELLONG;
 }
 #endif /* not ONLY_DECLARE_RELOCS */
 
diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c
index 2b89b84..c1cf185 100644
--- a/bfd/coff-arm.c
+++ b/bfd/coff-arm.c
@@ -51,13 +51,12 @@
 #ifndef NUM_ELEM
 #define NUM_ELEM(a) ((sizeof (a)) / sizeof ((a)[0]))
 #endif
-     
+
 typedef enum {bunknown, b9, b12, b23} thumb_pcrel_branchtype;
 /* some typedefs for holding instructions */
 typedef unsigned long int insn32;
 typedef unsigned short int insn16;
 
-
      /* Forward declarations for stupid compilers.  */
 static boolean coff_arm_relocate_section
   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
@@ -77,7 +76,7 @@
 static boolean coff_arm_adjust_symndx
   PARAMS ((bfd *, struct bfd_link_info *, bfd *,
 	   asection *, struct internal_reloc *,	boolean *));
-static reloc_howto_type * coff_arm_rtype_to_howto 
+static reloc_howto_type * coff_arm_rtype_to_howto
   PARAMS ((bfd *, asection *, struct internal_reloc *,
 	   struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *));
 static bfd_reloc_status_type coff_thumb_pcrel_common
@@ -119,14 +118,14 @@
    Given a function name, and its type, the stub can be found. The
    name can be changed. The only requirement is the %s be present.
    */
-   
+
 #define THUMB2ARM_GLUE_SECTION_NAME ".glue_7t"
 #define THUMB2ARM_GLUE_ENTRY_NAME   "__%s_from_thumb"
 
 #define ARM2THUMB_GLUE_SECTION_NAME ".glue_7"
 #define ARM2THUMB_GLUE_ENTRY_NAME   "__%s_from_arm"
 
-/* Used by the assembler. */
+/* Used by the assembler.  */
 static bfd_reloc_status_type
 coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
 		 error_message)
@@ -232,14 +231,14 @@
 #define ARM_SECREL   15
 #endif
 
-static reloc_howto_type aoutarm_std_reloc_howto[] = 
+static reloc_howto_type aoutarm_std_reloc_howto[] =
 {
   /* type              rs size bsz  pcrel bitpos ovrf                     sf name     part_inpl readmask  setmask    pcdone */
 #ifdef ARM_WINCE
   EMPTY_HOWTO (-1),
-  HOWTO (ARM_32, 
+  HOWTO (ARM_32,
 	0,
-	2, 
+	2,
 	32,
 	false,
 	0,
@@ -250,9 +249,9 @@
 	0xffffffff,
 	0xffffffff,
 	PCRELOFFSET),
-  HOWTO (ARM_RVA32, 
+  HOWTO (ARM_RVA32,
 	0,
-	2, 
+	2,
 	32,
 	false,
 	0,
@@ -274,7 +273,7 @@
 	"ARM_26",
 	false,
 	0x00ffffff,
-	0x00ffffff, 
+	0x00ffffff,
 	PCRELOFFSET),
   HOWTO (ARM_THUMB12,
 	1,
@@ -287,16 +286,16 @@
 	"ARM_THUMB12",
 	false,
 	0x000007ff,
-	0x000007ff, 
+	0x000007ff,
 	PCRELOFFSET),
-  HOWTO (ARM_26D,  
-	2, 
+  HOWTO (ARM_26D,
+	2,
 	2,
 	24,
 	false,
 	0,
 	complain_overflow_dont,
-	aoutarm_fix_pcrel_26_done, 
+	aoutarm_fix_pcrel_26_done,
 	"ARM_26D",
 	true,
 	0x00ffffff,
@@ -310,22 +309,22 @@
   EMPTY_HOWTO (-1),
   EMPTY_HOWTO (-1),
   EMPTY_HOWTO (-1),
-  HOWTO (ARM_SECTION,  
-	0, 
-	1, 
-	16, 
+  HOWTO (ARM_SECTION,
+	0,
+	1,
+	16,
 	false,
 	0,
 	complain_overflow_bitfield,
 	coff_arm_reloc,
-	"ARM_16", 
+	"ARM_16",
 	true,
 	0x0000ffff,
-	0x0000ffff, 
+	0x0000ffff,
 	PCRELOFFSET),
-  HOWTO (ARM_SECREL, 
+  HOWTO (ARM_SECREL,
 	0,
-	2, 
+	2,
 	32,
 	false,
 	0,
@@ -350,22 +349,22 @@
 	0x000000ff,		/* src_mask */
 	0x000000ff,		/* dst_mask */
 	PCRELOFFSET		/* pcrel_offset */),
-  HOWTO(ARM_16,  
-	0, 
-	1, 
-	16, 
+  HOWTO(ARM_16,
+	0,
+	1,
+	16,
 	false,
 	0,
 	complain_overflow_bitfield,
 	coff_arm_reloc,
-	"ARM_16", 
+	"ARM_16",
 	true,
 	0x0000ffff,
-	0x0000ffff, 
+	0x0000ffff,
 	PCRELOFFSET),
-  HOWTO(ARM_32, 
+  HOWTO(ARM_32,
 	0,
-	2, 
+	2,
 	32,
 	false,
 	0,
@@ -387,28 +386,28 @@
 	"ARM_26",
 	false,
 	0x00ffffff,
-	0x00ffffff, 
+	0x00ffffff,
 	PCRELOFFSET),
-  HOWTO(ARM_DISP8,        
+  HOWTO(ARM_DISP8,
 	0,
 	0,
-	8, 
+	8,
 	true,
 	0,
-	complain_overflow_signed, 
+	complain_overflow_signed,
 	coff_arm_reloc,
-	"ARM_DISP8",  
+	"ARM_DISP8",
 	true,
 	0x000000ff,
 	0x000000ff,
 	true),
-  HOWTO( ARM_DISP16, 
+  HOWTO( ARM_DISP16,
 	0,
 	1,
 	16,
 	true,
 	0,
-	complain_overflow_signed, 
+	complain_overflow_signed,
 	coff_arm_reloc,
 	"ARM_DISP16",
 	true,
@@ -421,21 +420,21 @@
 	32,
 	true,
 	0,
-	complain_overflow_signed, 
+	complain_overflow_signed,
  	coff_arm_reloc,
 	"ARM_DISP32",
 	true,
 	0xffffffff,
 	0xffffffff,
 	true),
-  HOWTO( ARM_26D,  
-	2, 
+  HOWTO( ARM_26D,
+	2,
 	2,
 	24,
 	false,
 	0,
 	complain_overflow_dont,
-	aoutarm_fix_pcrel_26_done, 
+	aoutarm_fix_pcrel_26_done,
 	"ARM_26D",
 	true,
 	0x00ffffff,
@@ -448,16 +447,16 @@
 	-1,
 	16,
 	false,
-	0, 
+	0,
 	complain_overflow_bitfield,
 	coff_arm_reloc,
 	"ARM_NEG16",
-        true, 
+        true,
 	0x0000ffff,
-	0x0000ffff, 
+	0x0000ffff,
 	false),
-  HOWTO( ARM_NEG32, 
-	0, 
+  HOWTO( ARM_NEG32,
+	0,
 	-2,
 	32,
 	false,
@@ -469,9 +468,9 @@
 	0xffffffff,
 	0xffffffff,
 	false),
-  HOWTO( ARM_RVA32, 
+  HOWTO( ARM_RVA32,
 	0,
-	2, 
+	2,
 	32,
 	false,
 	0,
@@ -493,7 +492,7 @@
 	"ARM_THUMB9",
 	false,
 	0x000000ff,
-	0x000000ff, 
+	0x000000ff,
 	PCRELOFFSET),
   HOWTO( ARM_THUMB12,
 	1,
@@ -506,7 +505,7 @@
 	"ARM_THUMB12",
 	false,
 	0x000007ff,
-	0x000007ff, 
+	0x000007ff,
 	PCRELOFFSET),
   HOWTO( ARM_THUMB23,
 	1,
@@ -519,7 +518,7 @@
 	"ARM_THUMB23",
 	false,
 	0x07ff07ff,
-	0x07ff07ff, 
+	0x07ff07ff,
 	PCRELOFFSET)
 #endif /* not ARM_WINCE */
 };
@@ -528,7 +527,7 @@
 
 #ifdef COFF_WITH_PE
 /* Return true if this relocation should
-   appear in the output .reloc section. */
+   appear in the output .reloc section.  */
 
 static boolean
 in_reloc_p (abfd, howto)
@@ -536,7 +535,7 @@
      reloc_howto_type * howto;
 {
   return !howto->pc_relative && howto->type != ARM_RVA32;
-}     
+}
 #endif
 
 #define RTYPE2HOWTO(cache_ptr, dst)		\
@@ -560,7 +559,7 @@
 
   if (rel->r_type >= NUM_RELOCS)
     return NULL;
-  
+
   howto = aoutarm_std_reloc_howto + rel->r_type;
 
   if (rel->r_type == ARM_RVA32)
@@ -568,7 +567,7 @@
 
   return howto;
 }
-/* Used by the assembler. */
+/* Used by the assembler.  */
 
 static bfd_reloc_status_type
 aoutarm_fix_pcrel_26_done (abfd, reloc_entry, symbol, data, input_section,
@@ -585,7 +584,7 @@
   return bfd_reloc_ok;
 }
 
-/* Used by the assembler. */
+/* Used by the assembler.  */
 
 static bfd_reloc_status_type
 aoutarm_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
@@ -602,7 +601,7 @@
   bfd_size_type addr = reloc_entry->address;
   long target = bfd_get_32 (abfd, (bfd_byte *) data + addr);
   bfd_reloc_status_type flag = bfd_reloc_ok;
-  
+
   /* If this is an undefined symbol, return error */
   if (symbol->section == &bfd_und_section
       && (symbol->flags & BSF_WEAK) == 0)
@@ -623,7 +622,7 @@
   relocation -= input_section->output_section->vma;
   relocation -= input_section->output_offset;
   relocation -= addr;
-  
+
   if (relocation & 3)
     return bfd_reloc_overflow;
 
@@ -693,7 +692,7 @@
     default:
       abort ();
     }
-  
+
   /* If this is an undefined symbol, return error */
   if (symbol->section == &bfd_und_section
       && (symbol->flags & BSF_WEAK) == 0)
@@ -768,7 +767,7 @@
   /* Now the ARM magic... Change the reloc type so that it is marked as done.
      Strictly this is only necessary if we are doing a partial relocation.  */
   reloc_entry->howto = & aoutarm_std_reloc_howto [ARM_26D];
-  
+
   /* TODO: We should possibly have DONE entries for the THUMB PCREL relocations */
   return flag;
 }
@@ -818,14 +817,13 @@
                                   input_section, output_bfd, error_message, b9);
 }
 
-
 static CONST struct reloc_howto_struct *
 coff_arm_reloc_type_lookup (abfd, code)
       bfd * abfd;
       bfd_reloc_code_real_type code;
 {
 #define ASTD(i,j)       case i: return aoutarm_std_reloc_howto + j
-  
+
   if (code == BFD_RELOC_CTOR)
     switch (bfd_get_arch_info (abfd)->bits_per_address)
       {
@@ -847,6 +845,7 @@
       ASTD (BFD_RELOC_16,                   ARM_16);
       ASTD (BFD_RELOC_32,                   ARM_32);
       ASTD (BFD_RELOC_ARM_PCREL_BRANCH,     ARM_26);
+      ASTD (BFD_RELOC_ARM_PCREL_BLX,        ARM_26);
       ASTD (BFD_RELOC_8_PCREL,              ARM_DISP8);
       ASTD (BFD_RELOC_16_PCREL,             ARM_DISP16);
       ASTD (BFD_RELOC_32_PCREL,             ARM_DISP32);
@@ -854,7 +853,7 @@
       ASTD (BFD_RELOC_THUMB_PCREL_BRANCH9,  ARM_THUMB9);
       ASTD (BFD_RELOC_THUMB_PCREL_BRANCH12, ARM_THUMB12);
       ASTD (BFD_RELOC_THUMB_PCREL_BRANCH23, ARM_THUMB23);
-#endif      
+#endif
     default: return (CONST struct reloc_howto_struct *) 0;
     }
 }
@@ -874,17 +873,17 @@
 {
   /* The original coff_link_hash_table structure.  MUST be first field.  */
   struct coff_link_hash_table	root;
-  
+
   /* The size in bytes of the section containg the Thumb-to-ARM glue.  */
   long int 			thumb_glue_size;
-  
+
   /* The size in bytes of the section containg the ARM-to-Thumb glue.  */
   long int 			arm_glue_size;
 
   /* An arbitary input BFD chosen to hold the glue sections.  */
   bfd *				bfd_of_glue_owner;
 
-  /* Support interworking with old, non-interworking aware ARM code. */
+  /* Support interworking with old, non-interworking aware ARM code.  */
   int 				support_old_code;
 };
 
@@ -939,16 +938,16 @@
 
 /* The thumb form of a long branch is a bit finicky, because the offset
    encoding is split over two fields, each in it's own instruction. They
-   can occur in any order. So given a thumb form of long branch, and an 
+   can occur in any order. So given a thumb form of long branch, and an
    offset, insert the offset into the thumb branch and return finished
-   instruction. 
+   instruction.
 
-   It takes two thumb instructions to encode the target address. Each has 
+   It takes two thumb instructions to encode the target address. Each has
    11 bits to invest. The upper 11 bits are stored in one (identifed by
-   H-0.. see below), the lower 11 bits are stored in the other (identified 
-   by H-1). 
+   H-0.. see below), the lower 11 bits are stored in the other (identified
+   by H-1).
 
-   Combine together and shifted left by 1 (it's a half word address) and 
+   Combine together and shifted left by 1 (it's a half word address) and
    there you have it.
 
      Op: 1111 = F,
@@ -956,7 +955,7 @@
      Op: 1111 = F,
      H-1, lower address-0 = 800
 
-   They can be ordered either way, but the arm tools I've seen always put 
+   They can be ordered either way, but the arm tools I've seen always put
    the lower one first. It probably doesn't matter. krk@cygnus.com
 
    XXX:  Actually the order does matter.  The second instruction (H-1)
@@ -976,7 +975,6 @@
   unsigned int low_bits;
   unsigned int high_bits;
 
-
   BFD_ASSERT((rel_off & 1) != 1);
 
   rel_off >>= 1;                              /* half word aligned address */
@@ -988,7 +986,7 @@
   else if ((br_insn & HI_LOW_ORDER) == HI_LOW_ORDER)
     br_insn = HI_LOW_ORDER | (high_bits << 16) | low_bits;
   else
-    abort(); /* error - not a valid branch instruction form */
+    abort (); /* error - not a valid branch instruction form */
 
   /* FIXME: abort is probably not the right call. krk@cygnus.com */
 
@@ -1011,15 +1009,15 @@
   BFD_ASSERT (tmp_name);
 
   sprintf (tmp_name, THUMB2ARM_GLUE_ENTRY_NAME, name);
-  
+
   myh = coff_link_hash_lookup
     (coff_hash_table (info), tmp_name, false, false, true);
-  
+
   if (myh == NULL)
     /* xgettext:c-format */
     _bfd_error_handler (_("%s: unable to find THUMB glue '%s' for `%s'"),
 			bfd_get_filename (input_bfd), tmp_name, name);
-  
+
   free (tmp_name);
 
   return myh;
@@ -1040,7 +1038,7 @@
   BFD_ASSERT (tmp_name);
 
   sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name);
-  
+
   myh = coff_link_hash_lookup
     (coff_hash_table (info), tmp_name, false, false, true);
 
@@ -1048,7 +1046,7 @@
     /* xgettext:c-format */
     _bfd_error_handler (_("%s: unable to find ARM glue '%s' for `%s'"),
 			bfd_get_filename (input_bfd), tmp_name, name);
-  
+
   free (tmp_name);
 
   return myh;
@@ -1085,7 +1083,7 @@
    		  				ldmia r13! {r6, lr}
    					        bx    lr
    					   __func_addr:
-					        .word	func 
+					        .word	func
 */
 
 #define THUMB2ARM_GLUE_SIZE (globals->support_old_code ? 20 : 8)
@@ -1128,10 +1126,10 @@
      instruction we should generate a trampoline stub (needed to
      address the complete 32bit address space).  */
 
-/* The standard COFF backend linker does not cope with the special 
+/* The standard COFF backend linker does not cope with the special
    Thumb BRANCH23 relocation.  The alternative would be to split the
    BRANCH23 into seperate HI23 and LO23 relocations. However, it is a
-   bit simpler simply providing our own relocation driver. */
+   bit simpler simply providing our own relocation driver.  */
 
 /* The reloc processing routine for the ARM/Thumb COFF linker.  NOTE:
    This code is a very slightly modified copy of
@@ -1179,7 +1177,7 @@
 	  sym = NULL;
 	}
       else
-	{    
+	{
 	  h = obj_coff_sym_hashes (input_bfd)[symndx];
 	  sym = syms + symndx;
 	}
@@ -1194,7 +1192,6 @@
       else
 	addend = 0;
 
-
       howto = coff_rtype_to_howto (input_bfd, input_section, rel, h,
 				       sym, &addend);
       if (howto == NULL)
@@ -1212,7 +1209,7 @@
 	      || h->root.type == bfd_link_hash_defweak)
           && h->root.u.def.section->output_section == input_section->output_section)
         {
-          static reloc_howto_type fake_arm26_reloc = 
+          static reloc_howto_type fake_arm26_reloc =
 	    HOWTO (ARM_26,
     	       2,
     	       2,
@@ -1224,7 +1221,7 @@
     	       "ARM_26",
     	       false,
     	       0x00ffffff,
-    	       0x00ffffff, 
+    	       0x00ffffff,
     	       false);
 
           addend -= rel->r_vaddr - input_section->vma;
@@ -1233,11 +1230,11 @@
 
 #ifdef ARM_WINCE
       /* MS ARM-CE makes the reloc relative to the opcode's pc, not
-	 the next opcode's pc, so is off by one. */
+	 the next opcode's pc, so is off by one.  */
       if (howto->pc_relative && !info->relocateable)
 	addend -= 8;
 #endif
-      
+
       /* If we are doing a relocateable link, then we can just ignore
          a PC relative reloc that is pcrel_offset.  It will already
          have the correct value.  If this is not a relocateable link,
@@ -1246,8 +1243,15 @@
         {
           if (info->relocateable)
             continue;
+#if 0  /* We must not ignore the symbol value.  If the symbol is
+	  within the same section, the relocation should have already
+	  been fixed, but if it is not, we'll be handed a reloc into
+	  the beginning of the symbol's section, so we must not cancel
+	  out the symbol's value, otherwise we'll be adding it in
+	  twice.  */
           if (sym != NULL && sym->n_scnum != 0)
             addend += sym->n_value;
+#endif
         }
 
       val = 0;
@@ -1277,14 +1281,14 @@
              relocatable output file, since we may as well leave the
              stub generation to the final linker pass. If we fail to
 	     verify that the name is defined, we'll try to build stubs
-	     for an undefined name... */
+	     for an undefined name...  */
           if (! info->relocateable
 	      && (   h->root.type == bfd_link_hash_defined
 		  || h->root.type == bfd_link_hash_defweak))
             {
 	      asection *   h_sec = h->root.u.def.section;
 	      const char * name  = h->root.root.string;
-	      
+
 	      /* h locates the symbol referenced in the reloc.  */
 	      h_val = (h->root.u.def.value
 		       + h_sec->output_section->vma
@@ -1300,9 +1304,9 @@
 		      long int                          my_offset;
 		      asection *                        s;
 		      long int                          ret_offset;
-		      struct coff_link_hash_entry *     myh; 
+		      struct coff_link_hash_entry *     myh;
 		      struct coff_arm_link_hash_table * globals;
-		      
+
 		      myh = find_arm_glue (info, name, input_bfd);
 		      if (myh == NULL)
 			return false;
@@ -1311,10 +1315,10 @@
 
 		      BFD_ASSERT (globals != NULL);
 		      BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-			
+
 		      my_offset = myh->root.u.def.value;
-		      
-		      s = bfd_get_section_by_name (globals->bfd_of_glue_owner, 
+
+		      s = bfd_get_section_by_name (globals->bfd_of_glue_owner,
 						  ARM2THUMB_GLUE_SECTION_NAME);
 		      BFD_ASSERT (s != NULL);
 		      BFD_ASSERT (s->contents != NULL);
@@ -1341,16 +1345,16 @@
 
 			  bfd_put_32 (output_bfd, a2t1_ldr_insn,
 				      s->contents + my_offset);
-			  
+
 			  bfd_put_32 (output_bfd, a2t2_bx_r12_insn,
 				      s->contents + my_offset + 4);
-			  
+
 			  /* It's a thumb address.  Add the low order bit.  */
 			  bfd_put_32 (output_bfd, h_val | a2t3_func_addr_insn,
 				      s->contents + my_offset + 8);
 
                           if (info->base_file)
-                            arm_emit_base_file_entry (info, output_bfd, s, 
+                            arm_emit_base_file_entry (info, output_bfd, s,
                                                             my_offset + 8);
 
 			}
@@ -1359,32 +1363,32 @@
 
 		      tmp = bfd_get_32 (input_bfd, contents + rel->r_vaddr
 					- input_section->vma);
-		      
+
 		      tmp = tmp & 0xFF000000;
 
-		      /* Somehow these are both 4 too far, so subtract 8. */
+		      /* Somehow these are both 4 too far, so subtract 8.  */
 		      ret_offset =
 			s->output_offset
-			+ my_offset 
+			+ my_offset
 			+ s->output_section->vma
 			- (input_section->output_offset
-			   + input_section->output_section->vma 
+			   + input_section->output_section->vma
 			   + rel->r_vaddr)
 			- 8;
 
 		      tmp = tmp | ((ret_offset >> 2) & 0x00FFFFFF);
-		      
+
 		      bfd_put_32 (output_bfd, tmp, contents + rel->r_vaddr
 				  - input_section->vma);
 		      done = 1;
 		    }
                 }
-	      
+
 #ifndef ARM_WINCE
 	      /* Note: We used to check for ARM_THUMB9 and ARM_THUMB12 */
               else if (howto->type == ARM_THUMB23)
                 {
-                  if (   h->class == C_EXT 
+                  if (   h->class == C_EXT
 		      || h->class == C_STAT
 		      || h->class == C_LABEL)
 		    {
@@ -1401,19 +1405,19 @@
 			return false;
 
 		      globals = coff_arm_hash_table (info);
-		      
+
 		      BFD_ASSERT (globals != NULL);
 		      BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-		      
+
 		      my_offset = myh->root.u.def.value;
-		      
-		      s = bfd_get_section_by_name (globals->bfd_of_glue_owner, 
+
+		      s = bfd_get_section_by_name (globals->bfd_of_glue_owner,
 						   THUMB2ARM_GLUE_SECTION_NAME);
-		      
+
 		      BFD_ASSERT (s != NULL);
 		      BFD_ASSERT (s->contents != NULL);
 		      BFD_ASSERT (s->output_section != NULL);
-		      
+
 		      if ((my_offset & 0x01) == 0x01)
 			{
 			  if (h_sec->owner != NULL
@@ -1432,7 +1436,7 @@
 			      _bfd_error_handler
 				(_("  consider relinking with --support-old-code enabled"));
 			    }
-			  
+
 			  -- my_offset;
 			  myh->root.u.def.value = my_offset;
 
@@ -1440,7 +1444,7 @@
 			    {
 			      bfd_put_16 (output_bfd, t2a1_push_insn,
 					  s->contents + my_offset);
-			      
+
 			      bfd_put_16 (output_bfd, t2a2_ldr_insn,
 					  s->contents + my_offset + 2);
 
@@ -1449,13 +1453,13 @@
 
 			      bfd_put_16 (output_bfd, t2a4_bx_insn,
 					  s->contents + my_offset + 6);
-			      
+
 			      bfd_put_32 (output_bfd, t2a5_pop_insn,
 					  s->contents + my_offset + 8);
-			      
+
 			      bfd_put_32 (output_bfd, t2a6_bx_insn,
 					  s->contents + my_offset + 12);
-			      
+
 			      /* Store the address of the function in the last word of the stub.  */
 			      bfd_put_32 (output_bfd, h_val,
 					  s->contents + my_offset + 16);
@@ -1467,10 +1471,10 @@
 			    {
 			      bfd_put_16 (output_bfd, t2a1_bx_pc_insn,
 					  s->contents + my_offset);
-		      
+
 			      bfd_put_16 (output_bfd, t2a2_noop_insn,
 					  s->contents + my_offset + 2);
-		      
+
 			      ret_offset =
 				((bfd_signed_vma) h_val)	/* Address of destination of the stub */
 				- ((bfd_signed_vma)
@@ -1479,7 +1483,7 @@
 				    + s->output_section->vma) 	/* Address of the start of the current section.  */
 				   + 4				/* The branch instruction is 4 bytes into the stub.  */
 				   + 8);			/* ARM branches work from the pc of the instruction + 8.  */
-			      
+
 			      bfd_put_32 (output_bfd,
 					  t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF),
 					  s->contents + my_offset + 4);
@@ -1497,7 +1501,7 @@
 			- (input_section->output_offset
 			   + rel->r_vaddr)
 			-4;
-		      
+
 		      tmp = bfd_get_32 (input_bfd, contents + rel->r_vaddr
 					- input_section->vma);
 
@@ -1505,20 +1509,20 @@
 				  insert_thumb_branch (tmp, ret_offset),
 				  contents + rel->r_vaddr
 				  - input_section->vma);
-		      
+
 		      done = 1;
                     }
                 }
 #endif
             }
-	  
+
           /* If the relocation type and destination symbol does not
              fall into one of the above categories, then we can just
-             perform a direct link. */
+             perform a direct link.  */
 
 	  if (done)
 	    rstat = bfd_reloc_ok;
-	  else 
+	  else
 #endif /* THUMBEXTENSION */
 	    if (   h->root.type == bfd_link_hash_defined
 		|| h->root.type == bfd_link_hash_defweak)
@@ -1542,11 +1546,11 @@
 
       if (info->base_file)
 	{
-	  /* Emit a reloc if the backend thinks it needs it. */
+	  /* Emit a reloc if the backend thinks it needs it.  */
 	  if (sym && pe_data(output_bfd)->in_reloc_p(output_bfd, howto))
             arm_emit_base_file_entry (info, output_bfd, input_section, rel->r_vaddr);
 	}
-  
+
 #if 1 /* THUMBEXTENSION */
       if (done)
 	rstat = bfd_reloc_ok;
@@ -1562,9 +1566,9 @@
              instruction.  Again, it would probably be simpler adding a
              ThumbBRANCH23 specific macro expansion into the default
              code.  */
-	  
+
           bfd_vma address = rel->r_vaddr - input_section->vma;
-	  
+
           if (address > input_section->_raw_size)
 	    rstat = bfd_reloc_outofrange;
           else
@@ -1583,21 +1587,21 @@
 	      bfd_signed_vma  signed_add;
 
 	      BFD_ASSERT (size == 4);
-	      
+
               /* howto->pc_relative should be TRUE for type 14 BRANCH23 */
               relocation -= (input_section->output_section->vma
                              + input_section->output_offset);
-	      
+
               /* howto->pcrel_offset should be TRUE for type 14 BRANCH23 */
               relocation -= address;
-	      
-	      /* No need to negate the relocation with BRANCH23. */
+
+	      /* No need to negate the relocation with BRANCH23.  */
 	      /* howto->complain_on_overflow == complain_overflow_signed for BRANCH23.  */
 	      /* howto->rightshift == 1 */
 	      /* Drop unwanted bits from the value we are relocating to.  */
-	      
+
 	      check = relocation >> howto->rightshift;
-		
+
 	      /* If this is a signed value, the rightshift just dropped
 		 leading 1 bits (assuming twos complement).  */
 	      if ((bfd_signed_vma) relocation >= 0)
@@ -1606,7 +1610,7 @@
 		signed_check = (check
 				| ((bfd_vma) - 1
 				   & ~((bfd_vma) - 1 >> howto->rightshift)));
-	      
+
 	      /* Get the value from the object file.  */
 	      if (bfd_big_endian (input_bfd))
 		{
@@ -1625,16 +1629,16 @@
 		 can not get the upper bit, but that does not matter since
 		 signed_add needs no adjustment to become negative in that
 		 case.  */
-	      
+
 	      signed_add = add;
-	      
+
 	      if ((add & (((~ src_mask) >> 1) & src_mask)) != 0)
 		signed_add -= (((~ src_mask) >> 1) & src_mask) << 1;
-	      
+
 	      /* Add the value from the object file, shifted so that it is a
 		 straight number.  */
 	      /* howto->bitpos == 0 */
-	      
+
 	      signed_check += signed_add;
 	      relocation += signed_add;
 
@@ -1644,9 +1648,9 @@
 	      if (   signed_check > reloc_signed_max
 		  || signed_check < reloc_signed_min)
 		overflow = true;
-	      
+
 	      /* Put RELOCATION into the correct bits:  */
-	      
+
 	      if (bfd_big_endian (input_bfd))
 		{
 		  relocation = (((relocation & 0xffe) >> 1)  | ((relocation << 4) & 0x07ff0000));
@@ -1655,7 +1659,7 @@
 		{
 		  relocation = (((relocation & 0xffe) << 15) | ((relocation >> 12) & 0x7ff));
 		}
-	      
+
 	      /* Add RELOCATION to the correct bits of X:  */
 	      x = ((x & ~howto->dst_mask) | relocation);
 
@@ -1673,7 +1677,7 @@
                                           rel->r_vaddr - input_section->vma,
                                           val, addend);
 #if 1 /* THUMBEXTENSION */
-      /* FIXME: 
+      /* FIXME:
 	 Is this the best way to fix up thumb addresses? krk@cygnus.com
 	 Probably not, but it works, and if it works it don't need fixing!  nickc@cygnus.com */
       /* Only perform this fix during the final link, not a relocatable link.  nickc@cygnus.com  */
@@ -1682,9 +1686,9 @@
 	{
 	  /* Determine if we need to set the bottom bit of a relocated address
 	     because the address is the address of a Thumb code symbol.  */
-	     
+
 	  int patchit = false;
-	  
+
 	  if (h != NULL
 	      && (   h->class == C_THUMBSTATFUNC
 		  || h->class == C_THUMBEXTFUNC))
@@ -1709,8 +1713,8 @@
 	      bfd_put_32 (input_bfd, x | 1, location);
 	    }
 	}
-#endif /* THUMBEXTENSION */      
-      
+#endif /* THUMBEXTENSION */
+
       switch (rstat)
 	{
 	default:
@@ -1754,7 +1758,7 @@
 #ifndef COFF_IMAGE_WITH_PE
 
 boolean
-bfd_arm_allocate_interworking_sections (info) 
+bfd_arm_allocate_interworking_sections (info)
      struct bfd_link_info * info;
 {
   asection *                        s;
@@ -1765,24 +1769,24 @@
 #endif
 
   globals = coff_arm_hash_table (info);
-  
+
   BFD_ASSERT (globals != NULL);
 
   if (globals->arm_glue_size != 0)
     {
       BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-      
+
       s = bfd_get_section_by_name
 	(globals->bfd_of_glue_owner, ARM2THUMB_GLUE_SECTION_NAME);
 
       BFD_ASSERT (s != NULL);
-      
+
       foo = (bfd_byte *) bfd_alloc
 	(globals->bfd_of_glue_owner, globals->arm_glue_size);
 #if 0
       memset (foo, test_char, globals->arm_glue_size);
 #endif
-      
+
       s->_raw_size = s->_cooked_size = globals->arm_glue_size;
       s->contents = foo;
     }
@@ -1790,18 +1794,18 @@
   if (globals->thumb_glue_size != 0)
     {
       BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
-      
+
       s = bfd_get_section_by_name
 	(globals->bfd_of_glue_owner, THUMB2ARM_GLUE_SECTION_NAME);
 
       BFD_ASSERT (s != NULL);
-      
+
       foo = (bfd_byte *) bfd_alloc
 	(globals->bfd_of_glue_owner, globals->thumb_glue_size);
 #if 0
       memset (foo, test_char, globals->thumb_glue_size);
 #endif
-      
+
       s->_raw_size = s->_cooked_size = globals->thumb_glue_size;
       s->contents = foo;
     }
@@ -1836,10 +1840,10 @@
   BFD_ASSERT (tmp_name);
 
   sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name);
-  
+
   myh = coff_link_hash_lookup
     (coff_hash_table (info), tmp_name, false, false, true);
-  
+
   if (myh != NULL)
     {
       free (tmp_name);
@@ -1851,13 +1855,13 @@
      it.  */
 
   bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
-				BSF_GLOBAL, 
+				BSF_GLOBAL,
 				s, globals->arm_glue_size + 1,
-				NULL, true, false, 
+				NULL, true, false,
 				(struct bfd_link_hash_entry **) & myh);
-  
+
   free (tmp_name);
-  
+
   globals->arm_glue_size += ARM2THUMB_GLUE_SIZE;
 
   return;
@@ -1874,9 +1878,8 @@
   struct coff_link_hash_entry *      myh;
   struct coff_arm_link_hash_table *  globals;
 
-  
   globals = coff_arm_hash_table (info);
-  
+
   BFD_ASSERT (globals != NULL);
   BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
 
@@ -1893,7 +1896,7 @@
 
   myh = coff_link_hash_lookup
     (coff_hash_table (info), tmp_name, false, false, true);
-  
+
   if (myh != NULL)
     {
       free (tmp_name);
@@ -1902,35 +1905,35 @@
 
   bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
 				BSF_GLOBAL, s, globals->thumb_glue_size + 1,
-				NULL, true, false, 
+				NULL, true, false,
 				(struct bfd_link_hash_entry **) & myh);
-  
+
   /* If we mark it 'thumb', the disassembler will do a better job.  */
   myh->class = C_THUMBEXTFUNC;
 
   free (tmp_name);
 
   /* Allocate another symbol to mark where we switch to arm mode.  */
-      
+
 #define CHANGE_TO_ARM "__%s_change_to_arm"
 #define BACK_FROM_ARM "__%s_back_from_arm"
-  
+
   tmp_name = (char *) bfd_malloc (strlen (name) + strlen (CHANGE_TO_ARM) + 1);
-  
+
   BFD_ASSERT (tmp_name);
-  
+
   sprintf (tmp_name, globals->support_old_code ? BACK_FROM_ARM : CHANGE_TO_ARM, name);
 
   myh = NULL;
-  
+
   bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
 				BSF_LOCAL, s, globals->thumb_glue_size
 				+ (globals->support_old_code ? 8 : 4),
-				NULL, true, false, 
+				NULL, true, false,
 				(struct bfd_link_hash_entry **) & myh);
 
-  free (tmp_name);  
-  
+  free (tmp_name);
+
   globals->thumb_glue_size += THUMB2ARM_GLUE_SIZE;
 
   return;
@@ -1948,27 +1951,27 @@
   struct coff_arm_link_hash_table * globals;
   flagword   			    flags;
   asection * 			    sec;
-    
+
   /* If we are only performing a partial link do not bother
      getting a bfd to hold the glue.  */
   if (info->relocateable)
     return true;
-  
+
   globals = coff_arm_hash_table (info);
-  
+
   BFD_ASSERT (globals != NULL);
 
   if (globals->bfd_of_glue_owner != NULL)
     return true;
-  
+
   sec = bfd_get_section_by_name (abfd, ARM2THUMB_GLUE_SECTION_NAME);
-  
-  if (sec == NULL) 
+
+  if (sec == NULL)
     {
       flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
-      
+
       sec = bfd_make_section (abfd, ARM2THUMB_GLUE_SECTION_NAME);
-      
+
       if (sec == NULL
 	  || ! bfd_set_section_flags (abfd, sec, flags)
 	  || ! bfd_set_section_alignment (abfd, sec, 2))
@@ -1977,21 +1980,21 @@
 
   sec = bfd_get_section_by_name (abfd, THUMB2ARM_GLUE_SECTION_NAME);
 
-  if (sec == NULL) 
+  if (sec == NULL)
     {
       flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
-      
+
       sec = bfd_make_section (abfd, THUMB2ARM_GLUE_SECTION_NAME);
-      
+
       if (sec == NULL
 	  || ! bfd_set_section_flags (abfd, sec, flags)
 	  || ! bfd_set_section_alignment (abfd, sec, 2))
 	return false;
     }
-  
+
   /* Save the bfd for later use.  */
   globals->bfd_of_glue_owner = abfd;
-  
+
   return true;
 }
 
@@ -2008,19 +2011,19 @@
      to construct any glue.  */
   if (info->relocateable)
     return true;
-  
+
   /* Here we have a bfd that is to be included on the link.  We have a hook
      to do reloc rummaging, before section sizes are nailed down.  */
 
   _bfd_coff_get_external_symbols (abfd);
 
   globals = coff_arm_hash_table (info);
-  
+
   BFD_ASSERT (globals != NULL);
   BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
 
   globals->support_old_code = support_old_code;
-  
+
   /* Rummage around all the relocs and map the glue vectors.  */
   sec = abfd->sections;
 
@@ -2032,17 +2035,17 @@
       struct internal_reloc * i;
       struct internal_reloc * rel;
 
-      if (sec->reloc_count == 0) 
+      if (sec->reloc_count == 0)
 	continue;
 
       /* Load the relocs.  */
-      /* FIXME: there may be a storage leak here. */
-      
+      /* FIXME: there may be a storage leak here.  */
+
       i = _bfd_coff_read_internal_relocs (abfd, sec, 1, 0, 0, 0);
-    
+
       BFD_ASSERT (i != 0);
 
-      for (rel = i; rel < i + sec->reloc_count; ++rel) 
+      for (rel = i; rel < i + sec->reloc_count; ++rel)
 	{
 	  unsigned short                 r_type  = rel->r_type;
 	  long                           symndx;
@@ -2050,7 +2053,7 @@
 
 	  symndx = rel->r_symndx;
 
-	  /* If the relocation is not against a symbol it cannot concern us. */
+	  /* If the relocation is not against a symbol it cannot concern us.  */
 	  if (symndx == -1)
 	    continue;
 
@@ -2061,7 +2064,7 @@
 				  bfd_get_filename (abfd), symndx);
 	      continue;
 	    }
-	  
+
 	  h = obj_coff_sym_hashes (abfd)[symndx];
 
 	  /* If the relocation is against a static symbol it must be within
@@ -2075,11 +2078,11 @@
 	      /* This one is a call from arm code.  We need to look up
 		 the target of the call. If it is a thumb target, we
 		 insert glue.  */
-	      
+
 	      if (h->class == C_THUMBEXTFUNC)
 		record_arm_to_thumb_glue (info, h);
 	      break;
-	      
+
 #ifndef ARM_WINCE
 	    case ARM_THUMB23:
 	      /* This one is a call from thumb code.  We used to look
@@ -2102,7 +2105,7 @@
 		}
 	      break;
 #endif
-	      
+
 	    default:
 	      break;
 	    }
@@ -2126,7 +2129,6 @@
 #define coff_bfd_copy_private_bfd_data          coff_arm_copy_private_bfd_data
 #define coff_bfd_link_hash_table_create		coff_arm_link_hash_table_create
 
-
 /* When doing a relocateable link, we want to convert ARM26 relocs
    into ARM26D relocs.  */
 
@@ -2194,7 +2196,7 @@
 	      bfd_set_error (bfd_error_wrong_format);
 	      return false;
 	    }
-	  
+
 	  if (APCS_FLOAT_FLAG (obfd) != APCS_FLOAT_FLAG (ibfd))
 	    {
 	      const char *msg;
@@ -2205,14 +2207,14 @@
 	      else
 		/* xgettext: c-format */
 		msg = _("%s: ERROR: passes floats in integer registers whereas target %s uses float registers");
-	      
+
 	      _bfd_error_handler (msg, bfd_get_filename (ibfd),
 				  bfd_get_filename (obfd));
 
 	      bfd_set_error (bfd_error_wrong_format);
 	      return false;
 	    }
-	  
+
 	  if (PIC_FLAG (obfd) != PIC_FLAG (ibfd))
 	    {
 	      const char * msg;
@@ -2233,7 +2235,7 @@
       else
 	{
 	  SET_APCS_FLAGS (obfd, APCS_26_FLAG (ibfd) | APCS_FLOAT_FLAG (ibfd) | PIC_FLAG (ibfd));
-	  
+
 	  /* Set up the arch and fields as well as these are probably wrong.  */
 	  bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd));
 	}
@@ -2255,7 +2257,7 @@
 	      else
 		/* xgettext: c-format */
 		msg = _("Warning: input file %s does not support interworking, whereas %s does.");
-	      
+
 	      _bfd_error_handler (msg, bfd_get_filename (ibfd),
 				  bfd_get_filename (obfd));
 	    }
@@ -2269,7 +2271,6 @@
   return true;
 }
 
-
 /* Display the flags field.  */
 
 static boolean
@@ -2278,12 +2279,12 @@
      PTR     ptr;
 {
   FILE * file = (FILE *) ptr;
-  
+
   BFD_ASSERT (abfd != NULL && ptr != NULL);
-  
+
   /* xgettext:c-format */
   fprintf (file, _("private flags = %x:"), coff_data (abfd)->flags);
-  
+
   if (APCS_SET (abfd))
     {
       /* xgettext: APCS is ARM Prodecure Call Standard, it should not be translated.  */
@@ -2299,20 +2300,19 @@
       else
 	fprintf (file, _(" [absolute position]"));
     }
-  
+
   if (! INTERWORK_SET (abfd))
     fprintf (file, _(" [interworking flag not initialised]"));
   else if (INTERWORK_FLAG (abfd))
     fprintf (file, _(" [interworking supported]"));
   else
     fprintf (file, _(" [interworking not supported]"));
-  
+
   fputc ('\n', file);
-  
+
   return true;
 }
 
-
 /* Copies the given flags into the coff_tdata.flags field.
    Typically these flags come from the f_flags[] field of
    the COFF filehdr structure, which contains important,
@@ -2330,7 +2330,7 @@
   BFD_ASSERT (abfd != NULL);
 
   flag = (flags & F_APCS26) ? F_APCS_26 : 0;
-  
+
   /* Make sure that the APCS field has not been initialised to the opposite
      value.  */
   if (APCS_SET (abfd)
@@ -2341,11 +2341,11 @@
     return false;
 
   flag |= (flags & (F_APCS_FLOAT | F_PIC));
-  
+
   SET_APCS_FLAGS (abfd, flag);
 
   flag = (flags & F_INTERWORK);
-  
+
   /* If the BFD has already had its interworking flag set, but it
      is different from the value that we have been asked to set,
      then assume that that merged code will not support interworking
@@ -2368,7 +2368,6 @@
   return true;
 }
 
-
 /* Copy the important parts of the target specific data
    from one instance of a BFD to another.  */
 
@@ -2378,7 +2377,7 @@
      bfd *  dest;
 {
   BFD_ASSERT (src != NULL && dest != NULL);
- 
+
   if (src == dest)
     return true;
 
@@ -2395,10 +2394,10 @@
 	  /* If the src and dest have different APCS flag bits set, fail.  */
 	  if (APCS_26_FLAG (dest) != APCS_26_FLAG (src))
 	    return false;
-	  
+
 	  if (APCS_FLOAT_FLAG (dest) != APCS_FLOAT_FLAG (src))
 	    return false;
-	  
+
 	  if (PIC_FLAG (dest) != PIC_FLAG (src))
 	    return false;
 	}
@@ -2422,7 +2421,7 @@
 				      bfd_get_filename (dest),
 				      bfd_get_filename (src));
 		}
-	      
+
 	      SET_INTERWORK_FLAG (dest, 0);
 	    }
 	}
@@ -2462,28 +2461,28 @@
 
 #ifdef LOCAL_LABEL_PREFIX
   /* If there is a prefix for local labels then look for this.
-     If the prefix exists, but it is empty, then ignore the test. */
-  
+     If the prefix exists, but it is empty, then ignore the test.  */
+
   if (LOCAL_LABEL_PREFIX[0] != 0)
     {
       int len = strlen (LOCAL_LABEL_PREFIX);
-      
+
       if (strncmp (name, LOCAL_LABEL_PREFIX, len) != 0)
 	return false;
-      
+
       /* Perform the checks below for the rest of the name.  */
       name += len;
     }
 #endif
-  
+
   return name[0] == 'L';
 }
 
 /* This piece of machinery exists only to guarantee that the bfd that holds
-   the glue section is written last. 
+   the glue section is written last.
 
    This does depend on bfd_make_section attaching a new section to the
-   end of the section list for the bfd. 
+   end of the section list for the bfd.
 
    krk@cygnus.com  */
 
@@ -2504,17 +2503,17 @@
   struct coff_arm_link_hash_table * globals;
 
   globals = coff_arm_hash_table (pfinfo->info);
-  
+
   BFD_ASSERT (globals != NULL);
-  
+
   if (globals->bfd_of_glue_owner != NULL)
     {
       if (! _bfd_coff_link_input_bfd (pfinfo, globals->bfd_of_glue_owner))
 	return false;
-      
+
       globals->bfd_of_glue_owner->output_has_begun = true;
     }
-  
+
   return true;
 }
 
@@ -2537,11 +2536,13 @@
 #define TARGET_UNDERSCORE 0
 #endif
 
+#ifndef EXTRA_S_FLAGS
 #ifdef COFF_WITH_PE
 #define EXTRA_S_FLAGS (SEC_LINK_ONCE | SEC_LINK_DUPLICATES)
 #else
 #define EXTRA_S_FLAGS 0
 #endif
+#endif
 
 /* Forward declaration for use initialising alternative_target field.  */
 extern const bfd_target TARGET_BIG_SYM ;
diff --git a/bfd/coff-aux.c b/bfd/coff-aux.c
index 6966392..5bc9b8b 100644
--- a/bfd/coff-aux.c
+++ b/bfd/coff-aux.c
@@ -30,7 +30,7 @@
 /* 4k pages */
 #define COFF_PAGE_SIZE 0x1000
 
-/* On AUX, a STYP_NOLOAD|STYP_BSS section is part of a shared library. */
+/* On AUX, a STYP_NOLOAD|STYP_BSS section is part of a shared library.  */
 #define BSS_NOLOAD_IS_SHARED_LIBRARY
 
 #define STATIC_RELOCS
@@ -41,8 +41,8 @@
 #include "sysdep.h"
 
 static boolean coff_m68k_aux_link_add_one_symbol
-  PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, 
-           asection *, bfd_vma, const char *, boolean, boolean, 
+  PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
+           asection *, bfd_vma, const char *, boolean, boolean,
            struct bfd_link_hash_entry **));
 
 #define coff_link_add_one_symbol coff_m68k_aux_link_add_one_symbol
@@ -54,7 +54,7 @@
    mirrors Apple's "solution" to let a static library symbol override
    a shared library symbol.  On the whole not a good thing, given how
    shared libraries work here, but can work if you are careful with
-   what you include in the shared object. */
+   what you include in the shared object.  */
 
 static boolean
 coff_m68k_aux_link_add_one_symbol (info, abfd, name, flags, section, value,
diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c
index 1a4bcdd..d0287b7 100644
--- a/bfd/coff-h8300.c
+++ b/bfd/coff-h8300.c
@@ -31,7 +31,7 @@
 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1)
 
 /* We derive a hash table from the basic BFD hash table to
-   hold entries in the function vector.  Aside from the 
+   hold entries in the function vector.  Aside from the
    info stored by the basic hash table, we need the offset
    of a particular entry within the hash table as well as
    the offset where we'll add the next entry.  */
@@ -192,18 +192,18 @@
   return &ret->root.root;
 }
 
-/* special handling for H8/300 relocs.
+/* Special handling for H8/300 relocs.
    We only come here for pcrel stuff and return normally if not an -r link.
    When doing -r, we can't do any arithmetic for the pcrel stuff, because
    the code in reloc.c assumes that we can manipulate the targets of
-   the pcrel branches.  This isn't so, since the H8/300 can do relaxing, 
+   the pcrel branches.  This isn't so, since the H8/300 can do relaxing,
    which means that the gap after the instruction may not be enough to
-   contain the offset required for the branch, so we have to use the only
-   the addend until the final link */
+   contain the offset required for the branch, so we have to use only
+   the addend until the final link.  */
 
 static bfd_reloc_status_type
 special (abfd, reloc_entry, symbol, data, input_section, output_bfd,
-		 error_message)
+	 error_message)
      bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry ATTRIBUTE_UNUSED;
      asymbol *symbol ATTRIBUTE_UNUSED;
@@ -215,6 +215,8 @@
   if (output_bfd == (bfd *) NULL)
     return bfd_reloc_continue;
 
+  /* Adjust the reloc address to that in the output section.  */
+  reloc_entry->address += input_section->output_offset;
   return bfd_reloc_ok;
 }
 
@@ -253,8 +255,7 @@
   HOWTO (R_JMP_DEL, 0, 0, 8, true, 0, complain_overflow_signed, special, "Deleted jump", false, 0x000000ff, 0x000000ff, true),
 };
 
-
-/* Turn a howto into a reloc number */
+/* Turn a howto into a reloc number.  */
 
 #define SELECT_RELOC(x,howto) \
   { x.r_type = select_reloc(howto); }
@@ -263,16 +264,13 @@
 #define H8300 1			/* Customize coffcode.h */
 #define __A_MAGIC_SET__
 
-
-
-/* Code to swap in the reloc */
+/* Code to swap in the reloc.  */
 #define SWAP_IN_RELOC_OFFSET   bfd_h_get_32
 #define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
 #define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \
   dst->r_stuff[0] = 'S'; \
   dst->r_stuff[1] = 'C';
 
-
 static int
 select_reloc (howto)
      reloc_howto_type *howto;
@@ -280,8 +278,7 @@
   return howto->type;
 }
 
-/* Code to turn a r_type into a howto ptr, uses the above howto table
-   */
+/* Code to turn a r_type into a howto ptr, uses the above howto table.  */
 
 static void
 rtype2howto (internal, dst)
@@ -358,24 +355,21 @@
 
 #define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
 
-
-/* Perform any necessary magic to the addend in a reloc entry */
-
+/* Perform any necessary magic to the addend in a reloc entry.  */
 
 #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
  cache_ptr->addend =  ext_reloc.r_offset;
 
-
 #define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
  reloc_processing(relent, reloc, symbols, abfd, section)
 
 static void
 reloc_processing (relent, reloc, symbols, abfd, section)
-     arelent * relent;
+     arelent *relent;
      struct internal_reloc *reloc;
-     asymbol ** symbols;
-     bfd * abfd;
-     asection * section;
+     asymbol **symbols;
+     bfd *abfd;
+     asection *section;
 {
   relent->address = reloc->r_vaddr;
   rtype2howto (relent, reloc);
@@ -389,12 +383,12 @@
       relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
     }
 
-
-
   relent->addend = reloc->r_offset;
 
   relent->address -= section->vma;
-  /*  relent->section = 0;*/
+#if 0
+  relent->section = 0;
+#endif
 }
 
 static boolean
@@ -410,7 +404,7 @@
 
   /* Search all the symbols for one in INPUT_SECTION with
      address ADDRESS.  */
-  while (*s) 
+  while (*s)
     {
       asymbol *p = *s;
       if (p->section == input_section
@@ -419,11 +413,10 @@
 	      + p->value) == address)
 	return true;
       s++;
-    }    
+    }
   return false;
 }
 
-
 /* If RELOC represents a relaxable instruction/reloc, change it into
    the relaxed reloc, notify the linker that symbol addresses
    have changed (bfd_perform_slip) and return how much the current
@@ -433,20 +426,20 @@
    in the howto table.  This needs to be fixed.  */
 
 static int
-h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
+h8300_reloc16_estimate (abfd, input_section, reloc, shrink, link_info)
      bfd *abfd;
      asection *input_section;
      arelent *reloc;
      unsigned int shrink;
      struct bfd_link_info *link_info;
 {
-  bfd_vma value;  
+  bfd_vma value;
   bfd_vma dot;
   bfd_vma gap;
   static asection *last_input_section = NULL;
   static arelent *last_reloc = NULL;
 
-  /* The address of the thing to be relocated will have moved back by 
+  /* The address of the thing to be relocated will have moved back by
      the size of the shrink - but we don't change reloc->address here,
      since we need it to know where the relocation lives in the source
      uncooked section.  */
@@ -457,14 +450,13 @@
 
   /* Only examine the relocs which might be relaxable.  */
   switch (reloc->howto->type)
-    {     
-
+    {
     /* This is the 16/24 bit absolute branch which could become an 8 bit
        pc-relative branch.  */
     case R_JMP1:
     case R_JMPL1:
       /* Get the address of the target of this branch.  */
-      value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
+      value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 
       /* Get the address of the next instruction (not the reloc).  */
       dot = (input_section->output_section->vma
@@ -475,13 +467,12 @@
 
       /* Compute the distance from this insn to the branch target.  */
       gap = value - dot;
-  
+
       /* If the distance is within -128..+128 inclusive, then we can relax
 	 this jump.  +128 is valid since the target will move two bytes
 	 closer if we do relax this branch.  */
       if ((int)gap >= -128 && (int)gap <= 128 )
-	{ 
-
+	{
 	  /* It's possible we may be able to eliminate this branch entirely;
 	     if the previous instruction is a branch around this instruction,
 	     and there's no label at this instruction, then we can reverse
@@ -491,7 +482,7 @@
 		 bCC lab1			bCC' lab2
 		 jmp lab2
 		lab1:				lab1:
-	
+
 	     This saves 4 bytes instead of two, and should be relatively
 	     common.  */
 
@@ -505,7 +496,7 @@
 
 	      if (last_value == dot + 2
 		  && last_reloc->address + 1 == reloc->address
-		  && ! h8300_symbol_address_p (abfd, input_section, dot - 2))
+		  && !h8300_symbol_address_p (abfd, input_section, dot - 2))
 		{
 		  reloc->howto = howto_table + 19;
 		  last_reloc->howto = howto_table + 18;
@@ -518,11 +509,11 @@
 	    }
 
 	  /* Change the reloc type.  */
-	  reloc->howto = reloc->howto + 1;	  
+	  reloc->howto = reloc->howto + 1;
 
 	  /* This shrinks this section by two bytes.  */
 	  shrink += 2;
-	  bfd_perform_slip(abfd, 2, input_section, address);
+	  bfd_perform_slip (abfd, 2, input_section, address);
 	}
       break;
 
@@ -531,12 +522,12 @@
     case R_PCRWORD:
       /* Get the address of the target of this branch, add one to the value
          because the addend field in PCrel jumps is off by -1.  */
-      value = bfd_coff_reloc16_get_value(reloc, link_info, input_section) + 1;
-	
+      value = bfd_coff_reloc16_get_value (reloc, link_info, input_section) + 1;
+
       /* Get the address of the next instruction if we were to relax.  */
       dot = input_section->output_section->vma +
 	input_section->output_offset + address;
-  
+
       /* Compute the distance from this insn to the branch target.  */
       gap = value - dot;
 
@@ -544,13 +535,13 @@
 	 this jump.  +128 is valid since the target will move two bytes
 	 closer if we do relax this branch.  */
       if ((int)gap >= -128 && (int)gap <= 128 )
-	{ 
+	{
 	  /* Change the reloc type.  */
 	  reloc->howto = howto_table + 15;
 
 	  /* This shrinks this section by two bytes.  */
 	  shrink += 2;
-	  bfd_perform_slip(abfd, 2, input_section, address);
+	  bfd_perform_slip (abfd, 2, input_section, address);
 	}
       break;
 
@@ -558,7 +549,7 @@
        become an 8 bit absolute address if it's in the right range.  */
     case R_MOV16B1:
       /* Get the address of the data referenced by this mov.b insn.  */
-      value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
+      value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 
       /* The address is in 0xff00..0xffff inclusive on the h8300 or
 	 0xffff00..0xffffff inclusive on the h8300h, then we can
@@ -576,7 +567,7 @@
 
 	  /* This shrinks this section by two bytes.  */
 	  shrink += 2;
-	  bfd_perform_slip(abfd, 2, input_section, address);
+	  bfd_perform_slip (abfd, 2, input_section, address);
 	}
       break;
 
@@ -585,7 +576,7 @@
        and try to relax it into a 16bit absolute.  */
     case R_MOV24B1:
       /* Get the address of the data referenced by this mov.b insn.  */
-      value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
+      value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 
       /* The address is in 0xffff00..0xffffff inclusive on the h8300h,
 	 then we can relax this mov.b  */
@@ -599,7 +590,7 @@
 
 	  /* This shrinks this section by four bytes.  */
 	  shrink += 4;
-	  bfd_perform_slip(abfd, 4, input_section, address);
+	  bfd_perform_slip (abfd, 4, input_section, address);
 
 	  /* Done with this reloc.  */
 	  break;
@@ -612,7 +603,7 @@
        become an 16 bit absolute address if it's in the right range.  */
     case R_MOVL1:
       /* Get the address of the data referenced by this mov insn.  */
-      value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
+      value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 
       /* If this address is in 0x0000..0x7fff inclusive or
          0xff8000..0xffffff inclusive, then it can be relaxed.  */
@@ -623,13 +614,13 @@
 
 	  /* This shrinks this section by two bytes.  */
 	  shrink += 2;
-	  bfd_perform_slip(abfd, 2, input_section, address);
+	  bfd_perform_slip (abfd, 2, input_section, address);
 	}
       break;
 
       /* No other reloc types represent relaxing opportunities.  */
-      default:
-	break;
+    default:
+      break;
     }
 
   last_reloc = reloc;
@@ -637,7 +628,6 @@
   return shrink;
 }
 
-
 /* Handle relocations for the H8/300, including relocs for relaxed
    instructions.
 
@@ -659,18 +649,17 @@
   asection *input_section = link_order->u.indirect.section;
   bfd_vma value;
   bfd_vma dot;
-  int gap,tmp;
+  int gap, tmp;
 
   switch (reloc->howto->type)
     {
-
     /* Generic 8bit pc-relative relocation.  */
     case R_PCRBYTE:
       /* Get the address of the target of this branch.  */
-      value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
+      value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 
-      dot = (link_order->offset 
-	     + dst_address 
+      dot = (link_order->offset
+	     + dst_address
 	     + link_order->u.indirect.section->output_section->vma);
 
       gap = value - dot;
@@ -698,11 +687,11 @@
     /* Generic 16bit pc-relative relocation.  */
     case R_PCRWORD:
       /* Get the address of the target of this branch.  */
-      value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
+      value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 
       /* Get the address of the instruction (not the reloc).  */
-      dot = (link_order->offset 
-	     + dst_address 
+      dot = (link_order->offset
+	     + dst_address
 	     + link_order->u.indirect.section->output_section->vma + 1);
 
       gap = value - dot;
@@ -761,7 +750,7 @@
     case R_MOV16B1:
     case R_JMP1:
     case R_RELWORD:
-      value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
+      value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
       bfd_put_16 (abfd, value, data + dst_address);
       dst_address += 2;
       src_address += 2;
@@ -772,7 +761,7 @@
     case R_MOVL1:
     case R_RELLONG:
       /* Get the address of the target of this branch.  */
-      value = bfd_coff_reloc16_get_value (reloc, link_info, input_section),
+      value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
       bfd_put_32 (abfd, value, data + dst_address);
       dst_address += 4;
       src_address += 4;
@@ -901,6 +890,7 @@
 	  /* Write it.  */
 	  bfd_put_8 (abfd, tmp, data + dst_address - 2);
 	  break;
+
 	case 0x5c:
 	  /* bsr:16 -> bsr:8 */
 	  bfd_put_8 (abfd, 0x55, data + dst_address - 2);
@@ -918,7 +908,7 @@
 	src_address += 2;
 
 	break;
-      
+
     /* Similarly for a 24bit absolute that is now 8 bits.  */
     case R_JMPL2:
       /* Get the address of the target of this branch.  */
@@ -961,13 +951,13 @@
 	abort ();
 
       /* Fix up the opcode.  */
-      switch (data[src_address-1] & 0xf0)
+      switch (data[src_address - 1] & 0xf0)
 	{
 	case 0x00:
-	  data[dst_address - 2] = (data[src_address-1] & 0xf) | 0x20;
+	  data[dst_address - 2] = (data[src_address - 1] & 0xf) | 0x20;
 	  break;
 	case 0x80:
-	  data[dst_address - 2] = (data[src_address-1] & 0xf) | 0x30;
+	  data[dst_address - 2] = (data[src_address - 1] & 0xf) | 0x30;
 	  break;
 	default:
 	  abort ();
@@ -986,13 +976,13 @@
 	abort ();
 
       /* Fix up the opcode.  */
-      switch (data[src_address-1] & 0xf0)
+      switch (data[src_address - 1] & 0xf0)
 	{
 	case 0x20:
-	  data[dst_address - 2] = (data[src_address-1] & 0xf) | 0x20;
+	  data[dst_address - 2] = (data[src_address - 1] & 0xf) | 0x20;
 	  break;
 	case 0xa0:
-	  data[dst_address - 2] = (data[src_address-1] & 0xf) | 0x30;
+	  data[dst_address - 2] = (data[src_address - 1] & 0xf) | 0x30;
 	  break;
 	default:
 	  abort ();
@@ -1004,10 +994,10 @@
 
     case R_BCC_INV:
       /* Get the address of the target of this branch.  */
-      value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
+      value = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
 
-      dot = (link_order->offset 
-	     + dst_address 
+      dot = (link_order->offset
+	     + dst_address
 	     + link_order->u.indirect.section->output_section->vma) + 1;
 
       gap = value - dot;
@@ -1089,7 +1079,7 @@
 	  }
 
 	/* This is a jump/call through a function vector, and we're
-	   expected to create the function vector ourselves. 
+	   expected to create the function vector ourselves.
 
 	   First look up this symbol in the linker hash table -- we need
 	   the derived linker symbol which holds this symbol's index
@@ -1103,7 +1093,7 @@
 
 	    strcpy (new_name, name);
 	    sprintf (new_name + strlen (name), "_%08x",
-		     (int)symbol->section);
+		     (int) symbol->section);
 	    name = new_name;
 	  }
 
@@ -1162,7 +1152,6 @@
   *dst_ptr = dst_address;
 }
 
-
 /* Routine for the h8300 linker.
 
    This routine is necessary to handle the special R_MEM_INDIRECT
@@ -1175,7 +1164,7 @@
    selected static symbols to the bfd linker hash table.  */
 
 static boolean
-h8300_bfd_link_add_symbols(abfd, info)
+h8300_bfd_link_add_symbols (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
@@ -1239,7 +1228,7 @@
       if (reloc_size <= 0)
 	continue;
 
-      relocs = (arelent **)bfd_malloc ((size_t)reloc_size);
+      relocs = (arelent **) bfd_malloc ((size_t) reloc_size);
       if (!relocs)
 	return false;
 
@@ -1282,7 +1271,7 @@
 
 		  strcpy (new_name, name);
 		  sprintf (new_name + strlen (name), "_%08x",
-			   (int)symbol->section);
+			   (int) symbol->section);
 		  name = new_name;
 		}
 
@@ -1290,7 +1279,6 @@
 	      h = funcvec_hash_lookup (h8300_coff_hash_table (info)->funcvec_hash_table,
 				       name, false, false);
 
-
 	      /* If this symbol isn't already in the hash table, add
 		 it and bump up the size of the hash table.  */
 	      if (h == NULL)
@@ -1342,12 +1330,10 @@
 #define COFF_LONG_FILENAMES
 #include "coffcode.h"
 
-
 #undef coff_bfd_get_relocated_section_contents
 #undef coff_bfd_relax_section
 #define coff_bfd_get_relocated_section_contents \
   bfd_coff_reloc16_get_relocated_section_contents
 #define coff_bfd_relax_section bfd_coff_reloc16_relax_section
 
-
 CREATE_BIG_COFF_TARGET_VEC (h8300coff_vec, "coff-h8300", BFD_IS_RELAXABLE, 0, '_', NULL)
diff --git a/bfd/coff-h8500.c b/bfd/coff-h8500.c
index 22eeaa5..1dfb2bd 100644
--- a/bfd/coff-h8500.c
+++ b/bfd/coff-h8500.c
@@ -45,7 +45,6 @@
 HOWTO (R_H8500_IMM32, 0, 1, 32, false, 0,
        complain_overflow_bitfield, 0, "r_imm32", true, 0xffffffff, 0xffffffff, false);
 
-
 static reloc_howto_type r_high8 =
 HOWTO (R_H8500_HIGH8, 0, 1, 8, false, 0,
        complain_overflow_dont, 0, "r_high8", true, 0x000000ff, 0x000000ff, false);
@@ -57,7 +56,6 @@
 static reloc_howto_type r_pcrel8 =
 HOWTO (R_H8500_PCREL8, 0, 1, 8, true, 0, complain_overflow_signed, 0, "r_pcrel8", true, 0, 0, true);
 
-
 static reloc_howto_type r_pcrel16 =
 HOWTO (R_H8500_PCREL16, 0, 1, 16, true, 0, complain_overflow_signed, 0, "r_pcrel16", true, 0, 0, true);
 
@@ -65,10 +63,9 @@
 HOWTO (R_H8500_HIGH16, 0, 1, 8, false, 0,
        complain_overflow_dont, 0, "r_high16", true, 0x000ffff, 0x0000ffff, false);
 
-
 /* Turn a howto into a reloc number */
 
-static int 
+static int
 coff_h8500_select_reloc (howto)
      reloc_howto_type *howto;
 {
@@ -77,7 +74,6 @@
 
 #define SELECT_RELOC(x,howto) x.r_type = coff_h8500_select_reloc(howto)
 
-
 #define BADMAG(x) H8500BADMAG(x)
 #define H8500 1			/* Customize coffcode.h */
 
@@ -135,14 +131,11 @@
 
 #define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
 
-
 /* Perform any necessary magic to the addend in a reloc entry */
 
-
 #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
  cache_ptr->addend =  ext_reloc.r_offset;
 
-
 #define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
  reloc_processing(relent, reloc, symbols, abfd, section)
 
@@ -165,7 +158,6 @@
       relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
     }
 
-
   relent->addend = reloc->r_offset;
   relent->address -= section->vma;
 }
@@ -217,7 +209,7 @@
       (*dst_ptr) += 2;
       (*src_ptr) += 2;
       break;
-      
+
     case R_H8500_HIGH16:
       bfd_put_16 (in_abfd,
 		  (bfd_coff_reloc16_get_value (reloc, link_info, input_section)
@@ -231,7 +223,7 @@
     case R_H8500_IMM24:
       {
 	int v = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
-	int o = bfd_get_32(in_abfd, data+ *dst_ptr -1);
+	int o = bfd_get_32 (in_abfd, data+ *dst_ptr -1);
 	v = (v & 0x00ffffff) | (o & 0xff00000);
 	bfd_put_32 (in_abfd, v, data  + *dst_ptr -1);
 	(*dst_ptr) +=3;
@@ -247,7 +239,6 @@
       }
       break;
 
-
     case R_H8500_PCREL8:
       {
 	bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
@@ -304,7 +295,6 @@
 
 #include "coffcode.h"
 
-
 #undef  coff_bfd_get_relocated_section_contents
 #undef coff_bfd_relax_section
 #define coff_bfd_get_relocated_section_contents \
diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c
index 84d4d14..83d67c4 100644
--- a/bfd/coff-i386.c
+++ b/bfd/coff-i386.c
@@ -73,8 +73,10 @@
 {
   symvalue diff;
 
+#ifndef COFF_WITH_PE
   if (output_bfd == (bfd *) NULL)
     return bfd_reloc_continue;
+#endif
 
   if (bfd_is_com_section (symbol->section))
     {
@@ -102,7 +104,26 @@
 	 ignores the addend for a COFF target when producing
 	 relocateable output.  This seems to be always wrong for 386
 	 COFF, so we handle the addend here instead.  */
-      diff = reloc_entry->addend;
+#ifdef COFF_WITH_PE
+      if (output_bfd == (bfd *) NULL)
+	{
+	  reloc_howto_type *howto = reloc_entry->howto;
+
+	  /* Although PC relative relocations are very similar between
+	     PE and non-PE formats, but they are off by 1 << howto->size
+	     bytes. For the external relocation, PE is very different
+	     from others. See md_apply_fix3 () in gas/config/tc-i386.c.
+	     When we link PE and non-PE object files together to
+	     generate a non-PE executable, we have to compensate it
+	     here.  */
+	  if (howto->pc_relative == true && howto->pcrel_offset == true)
+	    diff = -(1 << howto->size);
+	  else
+	    diff = -reloc_entry->addend;
+	}
+      else
+#endif
+	diff = reloc_entry->addend;
     }
 
 #ifdef COFF_WITH_PE
@@ -155,19 +176,17 @@
 }
 
 #ifdef COFF_WITH_PE
-
 /* Return true if this relocation should appear in the output .reloc
    section.  */
 
 static boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
 
 static boolean in_reloc_p (abfd, howto)
-     bfd *abfd ATTRIBUTE_UNUSED;
+     bfd * abfd ATTRIBUTE_UNUSED;
      reloc_howto_type *howto;
 {
   return ! howto->pc_relative && howto->type != R_IMAGEBASE;
 }
-
 #endif /* COFF_WITH_PE */
 
 #ifndef PCRELOFFSET
@@ -575,7 +594,7 @@
      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
 
-/* Note that we allow an object file to be treated as a core file as well. */
+/* Note that we allow an object file to be treated as a core file as well.  */
     {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
        bfd_generic_archive_p, coff_object_p},
     {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
diff --git a/bfd/coff-i860.c b/bfd/coff-i860.c
index ab3bb5f..c02acce 100644
--- a/bfd/coff-i860.c
+++ b/bfd/coff-i860.c
@@ -29,7 +29,7 @@
 
 #include "libcoff.h"
 
-static bfd_reloc_status_type coff_i860_reloc 
+static bfd_reloc_status_type coff_i860_reloc
   PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
 static reloc_howto_type *coff_i860_rtype_to_howto
   PARAMS ((bfd *, asection *, struct internal_reloc *,
@@ -66,7 +66,6 @@
   if (output_bfd == (bfd *) NULL)
     return bfd_reloc_continue;
 
-
   if (bfd_is_com_section (symbol->section))
     {
       /* We are relocating a common symbol.  The current value in the
@@ -91,7 +90,6 @@
       diff = reloc_entry->addend;
     }
 
-
 #define DOIT(x) \
   x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
 
@@ -139,7 +137,7 @@
 #define PCRELOFFSET false
 #endif
 
-static reloc_howto_type howto_table[] = 
+static reloc_howto_type howto_table[] =
 {
   EMPTY_HOWTO (0),
   EMPTY_HOWTO (1),
@@ -147,32 +145,32 @@
   EMPTY_HOWTO (3),
   EMPTY_HOWTO (4),
   EMPTY_HOWTO (5),
-  HOWTO (R_DIR32,               /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (R_DIR32,               /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 coff_i860_reloc,       /* special_function */                     
-	 "dir32",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
+	 coff_i860_reloc,       /* special_function */
+	 "dir32",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,            /* src_mask */
+	 0xffffffff,            /* dst_mask */
 	 true),                /* pcrel_offset */
   /* {7}, */
-  HOWTO (R_IMAGEBASE,            /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (R_IMAGEBASE,            /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 coff_i860_reloc,       /* special_function */                     
-	 "rva32",	           /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
+	 coff_i860_reloc,       /* special_function */
+	 "rva32",	           /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,            /* src_mask */
+	 0xffffffff,            /* dst_mask */
 	 false),                /* pcrel_offset */
   EMPTY_HOWTO (010),
   EMPTY_HOWTO (011),
@@ -181,83 +179,83 @@
   EMPTY_HOWTO (014),
   EMPTY_HOWTO (015),
   EMPTY_HOWTO (016),
-  HOWTO (R_RELBYTE,		/* type */                                 
-	 0,			/* rightshift */                           
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */ 
-	 8,			/* bitsize */                   
-	 false,			/* pc_relative */                          
-	 0,			/* bitpos */                               
+  HOWTO (R_RELBYTE,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 coff_i860_reloc,	/* special_function */                     
-	 "8",			/* name */                                 
-	 true,			/* partial_inplace */                      
-	 0x000000ff,		/* src_mask */                             
-	 0x000000ff,		/* dst_mask */                             
+	 coff_i860_reloc,	/* special_function */
+	 "8",			/* name */
+	 true,			/* partial_inplace */
+	 0x000000ff,		/* src_mask */
+	 0x000000ff,		/* dst_mask */
 	 PCRELOFFSET),		/* pcrel_offset */
-  HOWTO (R_RELWORD,		/* type */                                 
-	 0,			/* rightshift */                           
-	 1,			/* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,			/* bitsize */                   
-	 false,			/* pc_relative */                          
-	 0,			/* bitpos */                               
+  HOWTO (R_RELWORD,		/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 coff_i860_reloc,	/* special_function */                     
-	 "16",			/* name */                                 
-	 true,			/* partial_inplace */                      
-	 0x0000ffff,		/* src_mask */                             
-	 0x0000ffff,		/* dst_mask */                             
+	 coff_i860_reloc,	/* special_function */
+	 "16",			/* name */
+	 true,			/* partial_inplace */
+	 0x0000ffff,		/* src_mask */
+	 0x0000ffff,		/* dst_mask */
 	 PCRELOFFSET),		/* pcrel_offset */
-  HOWTO (R_RELLONG,		/* type */                                 
-	 0,			/* rightshift */                           
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,			/* bitsize */                   
-	 false,			/* pc_relative */                          
-	 0,			/* bitpos */                               
+  HOWTO (R_RELLONG,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 coff_i860_reloc,	/* special_function */                     
-	 "32",			/* name */                                 
-	 true,			/* partial_inplace */                      
-	 0xffffffff,		/* src_mask */                             
-	 0xffffffff,		/* dst_mask */                             
+	 coff_i860_reloc,	/* special_function */
+	 "32",			/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
 	 PCRELOFFSET),		/* pcrel_offset */
-  HOWTO (R_PCRBYTE,		/* type */                                 
-	 0,			/* rightshift */                           
-	 0,			/* size (0 = byte, 1 = short, 2 = long) */ 
-	 8,			/* bitsize */                   
-	 true,			/* pc_relative */                          
-	 0,			/* bitpos */                               
+  HOWTO (R_PCRBYTE,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 coff_i860_reloc,	/* special_function */                     
-	 "DISP8",		/* name */                                 
-	 true,			/* partial_inplace */                      
-	 0x000000ff,		/* src_mask */                             
-	 0x000000ff,		/* dst_mask */                             
+	 coff_i860_reloc,	/* special_function */
+	 "DISP8",		/* name */
+	 true,			/* partial_inplace */
+	 0x000000ff,		/* src_mask */
+	 0x000000ff,		/* dst_mask */
 	 PCRELOFFSET),		/* pcrel_offset */
-  HOWTO (R_PCRWORD,		/* type */                                 
-	 0,			/* rightshift */                           
-	 1,			/* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,			/* bitsize */                   
-	 true,			/* pc_relative */                          
-	 0,			/* bitpos */                               
+  HOWTO (R_PCRWORD,		/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 coff_i860_reloc,	/* special_function */                     
-	 "DISP16",		/* name */                                 
-	 true,			/* partial_inplace */                      
-	 0x0000ffff,		/* src_mask */                             
-	 0x0000ffff,		/* dst_mask */                             
+	 coff_i860_reloc,	/* special_function */
+	 "DISP16",		/* name */
+	 true,			/* partial_inplace */
+	 0x0000ffff,		/* src_mask */
+	 0x0000ffff,		/* dst_mask */
 	 PCRELOFFSET),		/* pcrel_offset */
-  HOWTO (R_PCRLONG,		/* type */                                 
-	 0,			/* rightshift */                           
-	 2,			/* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,			/* bitsize */                   
-	 true,			/* pc_relative */                          
-	 0,			/* bitpos */                               
+  HOWTO (R_PCRLONG,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 coff_i860_reloc,	/* special_function */                     
-	 "DISP32",		/* name */                                 
-	 true,			/* partial_inplace */                      
-	 0xffffffff,		/* src_mask */                             
-	 0xffffffff,		/* dst_mask */                             
+	 coff_i860_reloc,	/* special_function */
+	 "DISP32",		/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
 	 PCRELOFFSET)		/* pcrel_offset */
 };
 
@@ -335,14 +333,13 @@
 	 function will be adding in the final value of the symbol.  We
 	 need to subtract out the current size in order to get the
 	 correct result.  */
- 
-      BFD_ASSERT (h != NULL);
 
+      BFD_ASSERT (h != NULL);
 
       /* I think we *do* want to bypass this.  If we don't, I have seen some data
 	 parameters get the wrong relcation address.  If I link two versions
 	 with and without this section bypassed and then do a binary comparison,
-	 the addresses which are different can be looked up in the map.  The 
+	 the addresses which are different can be looked up in the map.  The
 	 case in which this section has been bypassed has addresses which correspond
 	 to values I can find in the map */
       *addendp -= sym->n_value;
@@ -351,7 +348,7 @@
   /* If the output symbol is common (in which case this must be a
      relocateable link), we need to add in the final size of the
      common symbol.  */
-  if (h != NULL && h->root.type == bfd_link_hash_common) 
+  if (h != NULL && h->root.type == bfd_link_hash_common)
     *addendp += h->root.u.c.size;
 
   return howto;
@@ -400,7 +397,7 @@
      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
 
-/* Note that we allow an object file to be treated as a core file as well. */
+/* Note that we allow an object file to be treated as a core file as well.  */
     {_bfd_dummy_target, i3coff_object_p, /* bfd_check_format */
        bfd_generic_archive_p, i3coff_object_p},
     {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
@@ -419,6 +416,6 @@
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   NULL,
-  
+
   COFF_SWAP_TABLE
 };
diff --git a/bfd/coff-i960.c b/bfd/coff-i960.c
index 4c37fab..562f048 100644
--- a/bfd/coff-i960.c
+++ b/bfd/coff-i960.c
@@ -99,7 +99,7 @@
 #define BAL	 0x0b000000	/* Template for 'bal' instruction	*/
 #define BAL_MASK 0x00ffffff
 
-static bfd_reloc_status_type 
+static bfd_reloc_status_type
 optcall_callback (abfd, reloc_entry, symbol_in, data,
 		  input_section, ignore_bfd, error_message)
      bfd *abfd;
@@ -117,13 +117,13 @@
   coff_symbol_type *cs = coffsymbol(symbol_in);
 
   /* Don't do anything with symbols which aren't tied up yet,
-     except move the reloc. */
+     except move the reloc.  */
   if (bfd_is_und_section (cs->symbol.section)) {
     reloc_entry->address += input_section->output_offset;
     return bfd_reloc_ok;
   }
-    
-  /* So the target symbol has to be of coff type, and the symbol 
+
+  /* So the target symbol has to be of coff type, and the symbol
      has to have the correct native information within it */
   if ((bfd_asymbol_flavour(&cs->symbol) != bfd_target_coff_flavour)
       || (cs->native == (combined_entry_type *)NULL))
@@ -138,7 +138,7 @@
     }
   else
     {
-    switch (cs->native->u.syment.n_sclass) 
+    switch (cs->native->u.syment.n_sclass)
       {
       case C_LEAFSTAT:
       case C_LEAFEXT:
@@ -146,7 +146,7 @@
 	   to the correct location.  */
 	{
 	  union internal_auxent *aux = &((cs->native+2)->u.auxent);
-	  int word = bfd_get_32(abfd, (bfd_byte *)data + reloc_entry->address);
+	  int word = bfd_get_32 (abfd, (bfd_byte *)data + reloc_entry->address);
 	  int olf = (aux->x_bal.x_balntry - cs->native->u.syment.n_value);
 	  BFD_ASSERT(cs->native->u.syment.n_numaux==2);
 
@@ -156,7 +156,7 @@
 	     sym and auxents untouched, so the delta between the two
 	     is the offset of the bal entry point.  */
 	  word = ((word +  olf)  & BAL_MASK) | BAL;
-  	  bfd_put_32(abfd, word, (bfd_byte *) data + reloc_entry->address);
+  	  bfd_put_32 (abfd, word, (bfd_byte *) data + reloc_entry->address);
   	}
 	result = bfd_reloc_ok;
 	break;
@@ -188,7 +188,7 @@
    useful.  It was used before this target was converted to use the
    COFF specific backend linker.  */
 
-static bfd_reloc_status_type 
+static bfd_reloc_status_type
 coff_i960_relocate (abfd, reloc_entry, symbol, data, input_section,
 		    output_bfd, error_message)
      bfd *abfd;
@@ -402,7 +402,7 @@
 	  sym = NULL;
 	}
       else
-	{    
+	{
 	  h = obj_coff_sym_hashes (input_bfd)[symndx];
 	  sym = syms + symndx;
 	}
@@ -578,7 +578,6 @@
    instead be a reloc against the internal symbol we created specially
    for the section.  */
 
-/*ARGSUSED*/
 static boolean
 coff_i960_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
      bfd *obfd ATTRIBUTE_UNUSED;
@@ -661,6 +660,6 @@
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   & icoff_little_vec,
-  
+
   COFF_SWAP_TABLE
 };
diff --git a/bfd/coff-ia64.c b/bfd/coff-ia64.c
index df867e7..1f2b445 100644
--- a/bfd/coff-ia64.c
+++ b/bfd/coff-ia64.c
@@ -35,9 +35,9 @@
 
 #define COFF_PAGE_SIZE 0x1000
 
-static reloc_howto_type howto_table[] = 
+static reloc_howto_type howto_table[] =
 {
-  {0},
+  EMPTY_HOWTO (0),
 };
 
 #define BADMAG(x) IA64BADMAG(x)
@@ -54,15 +54,15 @@
 
 #ifdef COFF_WITH_PE
 /* Return true if this relocation should
-   appear in the output .reloc section. */
+   appear in the output .reloc section.  */
 
 static boolean
 in_reloc_p(abfd, howto)
-     bfd * abfd;
-     reloc_howto_type *howto;
+     bfd * abfd ATTRIBUTE_UNUSED;
+     reloc_howto_type *howto ATTRIBUTE_UNUSED;
 {
-  return 0;			/* We don't do relocs for now... */
-}     
+  return 0;			/* We don't do relocs for now...  */
+}
 #endif
 
 #include "coffcode.h"
@@ -174,7 +174,7 @@
      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
 
-/* Note that we allow an object file to be treated as a core file as well. */
+/* Note that we allow an object file to be treated as a core file as well.  */
     {_bfd_dummy_target, ia64coff_object_p, /* bfd_check_format */
        bfd_generic_archive_p, ia64coff_object_p},
     {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
diff --git a/bfd/coff-m68k.c b/bfd/coff-m68k.c
index d7138c0..e5e890f 100644
--- a/bfd/coff-m68k.c
+++ b/bfd/coff-m68k.c
@@ -1,5 +1,5 @@
 /* BFD back-end for Motorola 68000 COFF binaries.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1999
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 99, 2000
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -97,7 +97,7 @@
 #ifdef STATIC_RELOCS
 static
 #endif
-reloc_howto_type m68kcoff_howto_table[] = 
+reloc_howto_type m68kcoff_howto_table[] =
 {
   HOWTO(R_RELBYTE,	       0,  0,  	8,  false, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "8",	true, 0x000000ff,0x000000ff, false),
   HOWTO(R_RELWORD,	       0,  1, 	16, false, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "16",	true, 0x0000ffff,0x0000ffff, false),
@@ -130,7 +130,7 @@
      arelent *internal;
      int relocentry;
 {
-  switch (relocentry) 
+  switch (relocentry)
   {
    case R_RELBYTE:	internal->howto = m68kcoff_howto_table + 0; break;
    case R_RELWORD:	internal->howto = m68kcoff_howto_table + 1; break;
@@ -145,29 +145,29 @@
 #ifdef STATIC_RELOCS
 static
 #endif
-int 
+int
 m68k_howto2rtype (internal)
      reloc_howto_type *internal;
 {
-  if (internal->pc_relative) 
+  if (internal->pc_relative)
   {
-    switch (internal->bitsize) 
+    switch (internal->bitsize)
     {
      case 32: return R_PCRLONG;
      case 16: return R_PCRWORD;
      case 8: return R_PCRBYTE;
     }
   }
-  else 
+  else
   {
-    switch (internal->bitsize) 
+    switch (internal->bitsize)
      {
       case 32: return R_RELLONG;
       case 16: return R_RELWORD;
       case 8: return R_RELBYTE;
      }
   }
-  return R_RELLONG;    
+  return R_RELLONG;
 }
 
 #ifdef STATIC_RELOCS
@@ -213,7 +213,6 @@
 	   struct coff_link_hash_entry *, struct internal_syment *,
 	   bfd_vma *));
 
-/*ARGSUSED*/
 static reloc_howto_type *
 m68kcoff_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -374,7 +373,6 @@
 /* coff-m68k.c uses the special COFF backend linker.  We need to
    adjust common symbols.  */
 
-/*ARGSUSED*/
 static reloc_howto_type *
 m68kcoff_common_addend_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -419,6 +417,98 @@
 #endif /* ! defined (coff_rtype_to_howto) */
 
 #endif /* COFF_COMMON_ADDEND */
+
+#if !defined ONLY_DECLARE_RELOCS && ! defined STATIC_RELOCS
+/* Given a .data section and a .emreloc in-memory section, store
+   relocation information into the .emreloc section which can be
+   used at runtime to relocate the section.  This is called by the
+   linker when the --embedded-relocs switch is used.  This is called
+   after the add_symbols entry point has been called for all the
+   objects, and before the final_link entry point is called.  */
+
+boolean
+bfd_m68k_coff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
+     bfd *abfd;
+     struct bfd_link_info *info;
+     asection *datasec;
+     asection *relsec;
+     char **errmsg;
+{
+  char *extsyms;
+  bfd_size_type symesz;
+  struct internal_reloc *irel, *irelend;
+  bfd_byte *p;
+
+  BFD_ASSERT (! info->relocateable);
+
+  *errmsg = NULL;
+
+  if (datasec->reloc_count == 0)
+    return true;
+
+  extsyms = obj_coff_external_syms (abfd);
+  symesz = bfd_coff_symesz (abfd);
+
+  irel = _bfd_coff_read_internal_relocs (abfd, datasec, true, NULL, false,
+					 NULL);
+  irelend = irel + datasec->reloc_count;
+
+  relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 12);
+  if (relsec->contents == NULL)
+    return false;
+
+  p = relsec->contents;
+
+  for (; irel < irelend; irel++, p += 12)
+    {
+      asection *targetsec;
+
+      /* We are going to write a four byte longword into the runtime
+       reloc section.  The longword will be the address in the data
+       section which must be relocated.  It is followed by the name
+       of the target section NUL-padded or truncated to 8
+       characters.  */
+
+      /* We can only relocate absolute longword relocs at run time.  */
+      if (irel->r_type != R_RELLONG)
+	{
+	  *errmsg = _("unsupported reloc type");
+	  bfd_set_error (bfd_error_bad_value);
+	  return false;
+	}
+
+      if (irel->r_symndx == -1)
+	targetsec = bfd_abs_section_ptr;
+      else
+	{
+	  struct coff_link_hash_entry *h;
+
+	  h = obj_coff_sym_hashes (abfd)[irel->r_symndx];
+	  if (h == NULL)
+	    {
+	      struct internal_syment isym;
+
+	      bfd_coff_swap_sym_in (abfd, extsyms + symesz * irel->r_symndx,
+				    &isym);
+	      targetsec = coff_section_from_bfd_index (abfd, isym.n_scnum);
+	    }
+	  else if (h->root.type == bfd_link_hash_defined
+		   || h->root.type == bfd_link_hash_defweak)
+	    targetsec = h->root.u.def.section;
+	  else
+	    targetsec = NULL;
+	}
+
+      bfd_put_32 (abfd,
+		  (irel->r_vaddr - datasec->vma + datasec->output_offset), p);
+      memset (p + 4, 0, 8);
+      if (targetsec != NULL)
+	strncpy (p + 4, targetsec->output_section->name, 8);
+    }
+
+  return true;
+}
+#endif /* neither ONLY_DECLARE_RELOCS not STATIC_RELOCS  */
 
 #define coff_bfd_is_local_label_name m68k_coff_is_local_label_name
 
diff --git a/bfd/coff-m88k.c b/bfd/coff-m88k.c
index f78377a..a88b836 100644
--- a/bfd/coff-m88k.c
+++ b/bfd/coff-m88k.c
@@ -51,7 +51,7 @@
   return name[0] == '@';
 }
 
-static bfd_reloc_status_type 
+static bfd_reloc_status_type
 m88k_special_reloc (abfd, reloc_entry, symbol, data,
 		    input_section, output_bfd, error_message)
      bfd *abfd;
@@ -144,7 +144,7 @@
   return bfd_reloc_ok;
 }
 
-static reloc_howto_type howto_table[] = 
+static reloc_howto_type howto_table[] =
 {
   HOWTO (R_PCR16L,			/* type */
 	 02,				/* rightshift */
@@ -250,12 +250,10 @@
 
 #define RTYPE2HOWTO(cache_ptr, dst) rtype2howto (cache_ptr, dst)
 
-
 /* Code to swap in the reloc offset */
 #define SWAP_IN_RELOC_OFFSET  bfd_h_get_16
 #define SWAP_OUT_RELOC_OFFSET bfd_h_put_16
 
-
 #define RELOC_PROCESSING(relent,reloc,symbols,abfd,section)	\
   reloc_processing(relent, reloc, symbols, abfd, section)
 
diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c
index 19cbea1..edd1a90 100644
--- a/bfd/coff-mcore.c
+++ b/bfd/coff-mcore.c
@@ -42,7 +42,7 @@
 
 static struct bfd_link_hash_table * coff_mcore_link_hash_table_create
   PARAMS ((bfd *));
-static bfd_reloc_status_type        mcore_coff_unsupported_reloc 
+static bfd_reloc_status_type        mcore_coff_unsupported_reloc
   PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
 static boolean                      coff_mcore_relocate_section
   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
@@ -70,36 +70,36 @@
 static reloc_howto_type mcore_coff_howto_table[] =
 {
   /* Unused: */
-  HOWTO (IMAGE_REL_MCORE_ABSOLUTE,/* type */                                 
-	 0,	                 /* rightshift */                           
-	 0,	                 /* size (0 = byte, 1 = short, 2 = long) */ 
-	 0,	                 /* bitsize */                   
-	 false,	                 /* pc_relative */                          
-	 0,	                 /* bitpos */                               
+  HOWTO (IMAGE_REL_MCORE_ABSOLUTE,/* type */
+	 0,	                 /* rightshift */
+	 0,	                 /* size (0 = byte, 1 = short, 2 = long) */
+	 0,	                 /* bitsize */
+	 false,	                 /* pc_relative */
+	 0,	                 /* bitpos */
 	 complain_overflow_dont, /* dont complain_on_overflow */
-	 NULL,		         /* special_function */                     
+	 NULL,		         /* special_function */
 	 "ABSOLUTE",             /* name */
-	 false,	                 /* partial_inplace */                      
-	 0x00,	 	         /* src_mask */                             
-	 0x00,        		 /* dst_mask */                             
+	 false,	                 /* partial_inplace */
+	 0x00,	 	         /* src_mask */
+	 0x00,        		 /* dst_mask */
 	 false),                 /* pcrel_offset */
-  
+
   HOWTO (IMAGE_REL_MCORE_ADDR32,/* type */
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 NULL,		        /* special_function */                     
+	 NULL,		        /* special_function */
 	 "ADDR32",              /* name */
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
+	 true,	                /* partial_inplace */
+	 0xffffffff,            /* src_mask */
+	 0xffffffff,            /* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* 8 bits + 2 zero bits; jmpi/jsri/lrw instructions.
-     Should not appear in object files. */
+     Should not appear in object files.  */
   HOWTO (IMAGE_REL_MCORE_PCREL_IMM8BY4,	/* type */
 	 2,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -114,7 +114,7 @@
 	 0,			/* dst_mask */
 	 true),			/* pcrel_offset */
 
-  /* bsr/bt/bf/br instructions; 11 bits + 1 zero bit 
+  /* bsr/bt/bf/br instructions; 11 bits + 1 zero bit
      Span 2k instructions == 4k bytes.
      Only useful pieces at the relocated address are the opcode (5 bits) */
   HOWTO (IMAGE_REL_MCORE_PCREL_IMM11BY2,/* type */
@@ -131,7 +131,7 @@
 	 0x7ff,			/* dst_mask */
 	 true),			/* pcrel_offset */
 
-  /* 4 bits + 1 zero bit; 'loopt' instruction only; unsupported. */
+  /* 4 bits + 1 zero bit; 'loopt' instruction only; unsupported.  */
   HOWTO (IMAGE_REL_MCORE_PCREL_IMM4BY2,	/* type */
 	 1,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -146,7 +146,7 @@
 	 0,			/* dst_mask */
 	 true),			/* pcrel_offset */
 
-  /* 32-bit pc-relative. Eventually this will help support PIC code. */
+  /* 32-bit pc-relative. Eventually this will help support PIC code.  */
   HOWTO (IMAGE_REL_MCORE_PCREL_32,/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -163,11 +163,11 @@
 
   /* Like PCREL_IMM11BY2, this relocation indicates that there is a
      'jsri' at the specified address. There is a separate relocation
-     entry for the literal pool entry that it references, but we 
+     entry for the literal pool entry that it references, but we
      might be able to change the jsri to a bsr if the target turns out
      to be close enough [even though we won't reclaim the literal pool
      entry, we'll get some runtime efficiency back]. Note that this
-     is a relocation that we are allowed to safely ignore.  */ 
+     is a relocation that we are allowed to safely ignore.  */
   HOWTO (IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2,/* type */
 	 1,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -181,7 +181,7 @@
 	 0x0,			/* src_mask */
 	 0x7ff,			/* dst_mask */
 	 true),			/* pcrel_offset */
-  
+
   HOWTO (IMAGE_REL_MCORE_RVA,   /* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -259,11 +259,10 @@
 
   if (coff_data (output_bfd)->pe)
      addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
-  
+
   fwrite (&addr, 1, sizeof (addr), (FILE *) info->base_file);
 }
 
-/*ARGSUSED*/
 static bfd_reloc_status_type
 mcore_coff_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section,
 			   output_bfd, error_message)
@@ -276,17 +275,17 @@
      char ** error_message ATTRIBUTE_UNUSED;
 {
   BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0);
-  
+
   _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"),
 		      bfd_get_filename (abfd),
 		      reloc_entry->howto->name,
 		      reloc_entry->howto->type);
-  
+
   return bfd_reloc_notsupported;
 }
 
 
-/* A cheesy little macro to make the code a little more readable. */
+/* A cheesy little macro to make the code a little more readable.  */
 #define HOW2MAP(bfd_rtype, mcore_rtype)  \
  case bfd_rtype: return & mcore_coff_howto_table [mcore_rtype]
 
@@ -296,7 +295,7 @@
      bfd_reloc_code_real_type code;
 {
   switch (code)
-    { 
+    {
       HOW2MAP (BFD_RELOC_32,                       IMAGE_REL_MCORE_ADDR32);
       HOW2MAP (BFD_RELOC_MCORE_PCREL_IMM8BY4,      IMAGE_REL_MCORE_PCREL_IMM8BY4);
       HOW2MAP (BFD_RELOC_MCORE_PCREL_IMM11BY2,     IMAGE_REL_MCORE_PCREL_IMM11BY2);
@@ -304,7 +303,7 @@
       HOW2MAP (BFD_RELOC_32_PCREL,                 IMAGE_REL_MCORE_PCREL_32);
       HOW2MAP (BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2, IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2);
       HOW2MAP (BFD_RELOC_RVA,                      IMAGE_REL_MCORE_RVA);
-   default: 
+   default:
       return NULL;
     }
   /*NOTREACHED*/
@@ -326,19 +325,18 @@
 {
   reloc_howto_type * howto;
 
-
   if (rel->r_type >= NUM_ELEM (mcore_coff_howto_table))
     return NULL;
-  
+
   howto = mcore_coff_howto_table + rel->r_type;
 
   if (rel->r_type == IMAGE_REL_MCORE_RVA)
     * addendp -= pe_data (sec->output_section->owner)->pe_opthdr.ImageBase;
-  
+
   else if (howto->pc_relative)
     {
       * addendp = sec->vma - 2; /* XXX guess - is this right ? */
-      
+
       /* If the symbol is defined, then the generic code is going to
          add back the symbol value in order to cancel out an
          adjustment it made to the addend.  However, we set the addend
@@ -350,7 +348,7 @@
     }
   else
     * addendp = 0;
-  
+
   return howto;
 }
 
@@ -362,7 +360,7 @@
      reloc_howto_type * howto;
 {
   return ! howto->pc_relative && howto->type != IMAGE_REL_MCORE_RVA;
-}     
+}
 
 
 /* The reloc processing routine for the optimized COFF linker.  */
@@ -382,13 +380,13 @@
   struct internal_reloc * relend;
   boolean hihalf;
   bfd_vma hihalf_val;
-  
+
   /* If we are performing a relocateable link, we don't need to do a
      thing.  The caller will take care of adjusting the reloc
      addresses and symbol indices.  */
   if (info->relocateable)
     return true;
-  
+
   /* Check if we have the same endianess */
   if (   input_bfd->xvec->byteorder != output_bfd->xvec->byteorder
       && output_bfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
@@ -408,7 +406,7 @@
 
   rel = relocs;
   relend = rel + input_section->reloc_count;
-  
+
   for (; rel < relend; rel++)
     {
       long                           symndx;
@@ -421,7 +419,7 @@
       reloc_howto_type *             howto = NULL;
       struct coff_link_hash_entry *  h;
       const char *                   my_name;
-  
+
       symndx = rel->r_symndx;
       loc = contents + rel->r_vaddr - input_section->vma;
 
@@ -437,7 +435,7 @@
 	}
 
       addend = 0;
-      
+
       /* Get the howto and initialise the addend.  */
       howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
 				       sym, & addend);
@@ -445,7 +443,7 @@
 	return false;
 
       val = 0;
-      
+
       if (h == NULL)
 	{
 	  if (symndx == -1)
@@ -453,8 +451,8 @@
 	  else
 	    {
 	      asection * sec = sections[symndx];
-	      
-	      val = (sym->n_value 
+
+	      val = (sym->n_value
 		     + sec->output_section->vma
 		     + sec->output_offset);
 
@@ -463,10 +461,10 @@
 	      else if (   sym->_n._n_n._n_zeroes == 0
 		       && sym->_n._n_n._n_offset != 0)
 		my_name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset;
-	      else 
+	      else
 		{
 		  static char buf [SYMNMLEN + 1];
-		  
+
 		  strncpy (buf, sym->_n._n_name, SYMNMLEN);
 		  buf[SYMNMLEN] = '\0';
 		  my_name = buf;
@@ -479,7 +477,7 @@
 	      || h->root.type == bfd_link_hash_defweak)
 	    {
 	      asection * sec = h->root.u.def.section;
-	      
+
 	      val = (h->root.u.def.value
 		     + sec->output_section->vma
 		     + sec->output_offset);
@@ -491,12 +489,12 @@
 		      rel->r_vaddr - input_section->vma, true)))
 		return false;
 	    }
-	  
+
 	  my_name = h->root.root.string;
-	}	
+	}
 
       rstat = bfd_reloc_ok;
-      
+
       /* Each case must do its own relocation, setting rstat appropriately.  */
       switch (r_type)
 	{
@@ -505,19 +503,19 @@
 			      bfd_get_filename (input_bfd), r_type);
 	  bfd_set_error (bfd_error_bad_value);
 	  return false;
-	  
+
 	case IMAGE_REL_MCORE_ABSOLUTE:
-	  fprintf (stderr, 
-		   _("Warning: unsupported reloc %s <file %s, section %s>\n"), 
+	  fprintf (stderr,
+		   _("Warning: unsupported reloc %s <file %s, section %s>\n"),
 		   howto->name,
 		   bfd_get_filename (input_bfd),
 		   input_section->name);
-	  
-	  fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n", 
+
+	  fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n",
 		   rel->r_symndx, my_name, (long) rel->r_vaddr,
-		   (unsigned long) rel->r_vaddr);  
+		   (unsigned long) rel->r_vaddr);
 	  break;
-	  
+
 	case IMAGE_REL_MCORE_PCREL_IMM8BY4:
 	case IMAGE_REL_MCORE_PCREL_IMM11BY2:
 	case IMAGE_REL_MCORE_PCREL_IMM4BY2:
@@ -527,7 +525,7 @@
 	  /* XXX fixme - shouldn't this be like the code for the RVA reloc ? */
 	  rstat = _bfd_relocate_contents (howto, input_bfd, val, loc);
 	  break;
-	  
+
 	case IMAGE_REL_MCORE_RVA:
 	  rstat = _bfd_final_link_relocate
 	    (howto, input_bfd,
@@ -535,36 +533,36 @@
 	     val, addend);
 	  break;
 	}
-      
+
       if (info->base_file)
 	{
 	  /* Emit a reloc if the backend thinks it needs it.  */
 	  if (sym && pe_data (output_bfd)->in_reloc_p (output_bfd, howto))
             mcore_emit_base_file_entry (info, output_bfd, input_section, rel->r_vaddr);
 	}
-  
+
       switch (rstat)
 	{
 	default:
 	  abort ();
-	  
+
 	case bfd_reloc_ok:
 	  break;
-	  
+
 	case bfd_reloc_overflow:
 	  if (! ((*info->callbacks->reloc_overflow)
-		 (info, my_name, howto->name, 
+		 (info, my_name, howto->name,
 		  (bfd_vma) 0, input_bfd,
 		  input_section, rel->r_vaddr - input_section->vma)))
 	    return false;
 	}
-    }     
+    }
 
   return true;
 }
 
 
-/* Tailor coffcode.h -- macro heaven. */
+/* Tailor coffcode.h -- macro heaven.  */
 
 /* We use the special COFF backend linker, with our own special touch.  */
 
@@ -581,6 +579,10 @@
 /* Forward declaration to initialise alterbative_target field.  */
 extern const bfd_target TARGET_LITTLE_SYM;
 
-/* The transfer vectors that lead the outside world to all of the above. */
-CREATE_BIG_COFF_TARGET_VEC (TARGET_BIG_SYM, TARGET_BIG_NAME, D_PAGED, (SEC_LINK_ONCE | SEC_LINK_DUPLICATES), 0, & TARGET_LITTLE_SYM)
-CREATE_LITTLE_COFF_TARGET_VEC (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, D_PAGED, (SEC_LINK_ONCE | SEC_LINK_DUPLICATES), 0, & TARGET_BIG_SYM)
+/* The transfer vectors that lead the outside world to all of the above.  */
+CREATE_BIG_COFF_TARGET_VEC (TARGET_BIG_SYM, TARGET_BIG_NAME, D_PAGED,
+			    (SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_READONLY | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
+			    0, & TARGET_LITTLE_SYM)
+CREATE_LITTLE_COFF_TARGET_VEC (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, D_PAGED,
+			       (SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_READONLY | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
+			       0, & TARGET_BIG_SYM)
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index dd7ace5..cf884c5 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -1100,7 +1100,6 @@
    requires special handling when relaxing.  We don't want
    bfd_perform_relocation to tamper with it at all.  */
 
-/*ARGSUSED*/
 static bfd_reloc_status_type
 mips_switch_reloc (abfd,
 		   reloc_entry,
@@ -1195,7 +1194,7 @@
 
   if (refhi == NULL)
     return;
-  
+
   insn = bfd_get_32 (input_bfd,
 		     contents + adjust + refhi->r_vaddr - input_section->vma);
   if (reflo == NULL)
@@ -1204,7 +1203,7 @@
     vallo = (bfd_get_32 (input_bfd,
 			 contents + adjust + reflo->r_vaddr - input_section->vma)
 	     & 0xffff);
- 
+
   val = ((insn & 0xffff) << 16) + vallo;
   val += relocation;
 
@@ -1505,7 +1504,7 @@
 	      memmove (here + PCREL16_EXPANSION_ADJUSTMENT, here,
 		       (size_t) (input_section->_raw_size
 				 - (int_rel.r_vaddr - input_section->vma)));
-		       
+
 	      /* Generate the new instructions.  */
 	      if (! mips_relax_pcrel16 (info, input_bfd, input_section,
 					h, here,
@@ -1626,7 +1625,7 @@
 			int_rel.r_symndx = RELOC_SECTION_TEXT;
 		      break;
 		    }
-		      
+
 		  if (int_rel.r_symndx == -1)
 		    abort ();
 
@@ -2104,7 +2103,7 @@
 	 somebody felt it were important.  Ignoring this reloc will
 	 presumably cause a reloc overflow error later on.  */
       if (bfd_get_32 (abfd, contents + int_rel.r_vaddr - sec->vma)
-	  != 0x0411ffff) /* bgezal $0,. == bal . */
+	  != 0x0411ffff) /* bgezal $0,. == bal .  */
 	continue;
 
       /* Bother.  We need to expand this reloc, and we will need to
@@ -2180,7 +2179,7 @@
 	      mips_ecoff_swap_reloc_in (abfd, (PTR) (adj_ext_rel + 1), &rello);
 
 	      BFD_ASSERT (rello.r_type == MIPS_R_RELLO);
-	      
+
 	      addhi = bfd_get_32 (abfd,
 				   contents + adj_int_rel.r_vaddr - sec->vma);
 	      addhi &= 0xffff;
@@ -2643,7 +2642,7 @@
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   & ecoff_big_vec,
-  
+
   (PTR) &mips_ecoff_backend_data
 };
 
@@ -2686,7 +2685,7 @@
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   & ecoff_little_vec,
-  
+
   (PTR) &mips_ecoff_backend_data
 };
 
@@ -2730,6 +2729,6 @@
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   NULL,
-  
+
   (PTR) &mips_ecoff_backend_data
 };
diff --git a/bfd/coff-pmac.c b/bfd/coff-pmac.c
index 790160b..9ae9791 100644
--- a/bfd/coff-pmac.c
+++ b/bfd/coff-pmac.c
@@ -17,8 +17,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-
-/* Tweak coffcode.h based on this being a PowerMac instead of RS/6000. */
+/* Tweak coffcode.h based on this being a PowerMac instead of RS/6000.  */
 
 #define POWERMAC
 
@@ -33,4 +32,3 @@
 #include "libcoff.h"
 #include "xcoff-target.h"
 
-
diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c
index c5e695d..2fd4731 100644
--- a/bfd/coff-ppc.c
+++ b/bfd/coff-ppc.c
@@ -5,7 +5,7 @@
    Original version pieced together by Kim Knuttila (krk@cygnus.com)
 
    There is nothing new under the sun. This file draws a lot on other
-   coff files, in particular, those for the rs/6000, alpha, mips, and 
+   coff files, in particular, those for the rs/6000, alpha, mips, and
    intel backends, and the PE work for the arm.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -29,11 +29,10 @@
    - objdump works
    - relocs generated by gas
    - ld will link files, but they do not run.
-   - dlltool will not produce correct output in some .reloc cases, and will 
+   - dlltool will not produce correct output in some .reloc cases, and will
      not produce the right glue code for dll function calls.
 */
 
-
 #include "bfd.h"
 #include "sysdep.h"
 
@@ -75,7 +74,6 @@
 #define MARK_AS_WRITTEN(x)  ((x) |= 1)
 #define MAKE_ADDR_AGAIN(x)  ((x) &= ~1)
 
-
 /* Turn on this check if you suspect something amiss in the hash tables */
 #ifdef DEBUG_HASH
 
@@ -87,13 +85,12 @@
 #define HASH_CHECK(addr) \
  if (strcmp(addr->eye_catcher, EYE) != 0) \
   { \
-    fprintf(stderr,\
+    fprintf (stderr,\
     _("File %s, line %d, Hash check failure, bad eye %8s\n"), \
     __FILE__, __LINE__, addr->eye_catcher); \
-    abort(); \
+    abort (); \
  }
 
-
 #else
 
 #define HASH_CHECK_DCL
@@ -105,7 +102,7 @@
 /* In order not to add an int to every hash table item for every coff
    linker, we define our own hash table, derived from the coff one */
 
-/* PE linker hash table entries. */
+/* PE linker hash table entries.  */
 
 struct ppc_coff_link_hash_entry
 {
@@ -120,7 +117,6 @@
   HASH_CHECK_DCL
 };
 
-
 /* PE linker hash table.  */
 
 struct ppc_coff_link_hash_table
@@ -154,14 +150,14 @@
      struct bfd_hash_table *table;
      const char *string;
 {
-  struct ppc_coff_link_hash_entry *ret = 
+  struct ppc_coff_link_hash_entry *ret =
     (struct ppc_coff_link_hash_entry *) entry;
 
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
   if (ret == (struct ppc_coff_link_hash_entry *) NULL)
     ret = (struct ppc_coff_link_hash_entry *)
-      bfd_hash_allocate (table, 
+      bfd_hash_allocate (table,
 			 sizeof (struct ppc_coff_link_hash_entry));
 
   if (ret == (struct ppc_coff_link_hash_entry *) NULL)
@@ -169,7 +165,7 @@
 
   /* Call the allocation method of the superclass.  */
   ret = ((struct ppc_coff_link_hash_entry *)
-	 _bfd_coff_link_hash_newfunc ((struct bfd_hash_entry *) ret, 
+	 _bfd_coff_link_hash_newfunc ((struct bfd_hash_entry *) ret,
 				      table, string));
 
   if (ret)
@@ -238,7 +234,7 @@
    from smaller values.  Start with zero, widen, *then* decrement.  */
 #define MINUS_ONE	(((bfd_vma)0) - 1)
 
-/* these should definitely go in a header file somewhere... */
+/* these should definitely go in a header file somewhere...  */
 
 /* NOP */
 #define IMAGE_REL_PPC_ABSOLUTE          0x0000
@@ -391,8 +387,6 @@
 						       bfd *output_bfd,
 						       char **error));
 
-
-
 static boolean in_reloc_p PARAMS((bfd *abfd, reloc_howto_type *howto));
 
 
@@ -418,7 +412,7 @@
 /*                    the address of the SYM will be inserted at link time.  */
 /*   TOCREL16       : 16 bit displacement field referring to a slot in       */
 /*                    toc.                                                   */
-/*   TOCREL14       : 16 bit displacement field, similar to REL14 or ADDR14. */
+/*   TOCREL14       : 16 bit displacement field, similar to REL14 or ADDR14.  */
 /*   ADDR32NB       : 32 bit address relative to the virtual origin.         */
 /*                    (On the alpha, this is always a linker generated thunk)*/
 /*                    (i.e. 32bit addr relative to the image base)           */
@@ -438,32 +432,32 @@
 {
   /* IMAGE_REL_PPC_ABSOLUTE 0x0000   NOP */
   /* Unused: */
-  HOWTO (IMAGE_REL_PPC_ABSOLUTE, /* type */                                 
-	 0,	                 /* rightshift */                           
-	 0,	                 /* size (0 = byte, 1 = short, 2 = long) */ 
-	 0,	                 /* bitsize */                   
-	 false,	                 /* pc_relative */                          
-	 0,	                 /* bitpos */                               
+  HOWTO (IMAGE_REL_PPC_ABSOLUTE, /* type */
+	 0,	                 /* rightshift */
+	 0,	                 /* size (0 = byte, 1 = short, 2 = long) */
+	 0,	                 /* bitsize */
+	 false,	                 /* pc_relative */
+	 0,	                 /* bitpos */
 	 complain_overflow_dont, /* dont complain_on_overflow */
-	 0,		         /* special_function */                     
+	 0,		         /* special_function */
 	 "ABSOLUTE",             /* name */
-	 false,	                 /* partial_inplace */                      
-	 0x00,	 	         /* src_mask */                             
-	 0x00,        		 /* dst_mask */                             
+	 false,	                 /* partial_inplace */
+	 0x00,	 	         /* src_mask */
+	 0x00,        		 /* dst_mask */
 	 false),                 /* pcrel_offset */
-  
+
   /* IMAGE_REL_PPC_ADDR64 0x0001  64-bit address */
   /* Unused: */
-  HOWTO(IMAGE_REL_PPC_ADDR64,    /* type */                                 
-	0,	                 /* rightshift */                           
-	3,	                 /* size (0 = byte, 1 = short, 2 = long) */ 
-	64,	                 /* bitsize */                   
-	false,	                 /* pc_relative */                          
-	0,	                 /* bitpos */                               
+  HOWTO(IMAGE_REL_PPC_ADDR64,    /* type */
+	0,	                 /* rightshift */
+	3,	                 /* size (0 = byte, 1 = short, 2 = long) */
+	64,	                 /* bitsize */
+	false,	                 /* pc_relative */
+	0,	                 /* bitpos */
 	complain_overflow_bitfield, 	 /* complain_on_overflow */
-	0,		         /* special_function */                     
+	0,		         /* special_function */
 	"ADDR64",               /* name */
-	true,	                 /* partial_inplace */                      
+	true,	                 /* partial_inplace */
 	MINUS_ONE,	 	 /* src_mask */
 	MINUS_ONE,        	 /* dst_mask */
 	false),                 /* pcrel_offset */
@@ -471,312 +465,311 @@
   /* IMAGE_REL_PPC_ADDR32 0x0002  32-bit address */
   /* Used: */
   HOWTO (IMAGE_REL_PPC_ADDR32,	/* type */
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
+	 0,		        /* special_function */
 	 "ADDR32",              /* name */
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
+	 true,	                /* partial_inplace */
+	 0xffffffff,            /* src_mask */
+	 0xffffffff,            /* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* IMAGE_REL_PPC_ADDR24 0x0003  26-bit address, shifted left 2 (branch absolute) */
   /* the LI field is in bit 6 through bit 29 is 24 bits, + 2 for the shift */
   /* Of course, That's the IBM approved bit numbering, which is not what */
-  /* anyone else uses.... The li field is in bit 2 thru 25 */ 
+  /* anyone else uses.... The li field is in bit 2 thru 25 */
   /* Used: */
   HOWTO (IMAGE_REL_PPC_ADDR24,  /* type */
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
 	 26,	                /* bitsize */
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
+	 0,		        /* special_function */
 	 "ADDR24",              /* name */
-	 true,	                /* partial_inplace */                      
-	 0x07fffffc,	        /* src_mask */                             
-	 0x07fffffc,        	/* dst_mask */                             
+	 true,	                /* partial_inplace */
+	 0x07fffffc,	        /* src_mask */
+	 0x07fffffc,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* IMAGE_REL_PPC_ADDR16 0x0004  16-bit address */
   /* Used: */
-  HOWTO (IMAGE_REL_PPC_ADDR16,  /* type */             
-	 0,	                /* rightshift */                           
-	 1,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (IMAGE_REL_PPC_ADDR16,  /* type */
+	 0,	                /* rightshift */
+	 1,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,		        /* special_function */                     
+	 0,		        /* special_function */
 	 "ADDR16",              /* name */
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* IMAGE_REL_PPC_ADDR14 0x0005 */
   /*  16-bit address, shifted left 2 (load doubleword) */
   /* FIXME: the mask is likely wrong, and the bit position may be as well */
   /* Unused: */
-  HOWTO (IMAGE_REL_PPC_ADDR14,  /* type */             
-	 1,	                /* rightshift */                           
-	 1,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (IMAGE_REL_PPC_ADDR14,  /* type */
+	 1,	                /* rightshift */
+	 1,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,		        /* special_function */                     
+	 0,		        /* special_function */
 	 "ADDR16",              /* name */
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* IMAGE_REL_PPC_REL24 0x0006 */
   /*   26-bit PC-relative offset, shifted left 2 (branch relative) */
   /* Used: */
   HOWTO (IMAGE_REL_PPC_REL24,   /* type */
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 26,	                /* bitsize */                   
-	 true,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 26,	                /* bitsize */
+	 true,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,		        /* special_function */                     
+	 0,		        /* special_function */
 	 "REL24",               /* name */
-	 true,	                /* partial_inplace */                      
-	 0x3fffffc,	        /* src_mask */                             
-	 0x3fffffc,        	/* dst_mask */                             
+	 true,	                /* partial_inplace */
+	 0x3fffffc,	        /* src_mask */
+	 0x3fffffc,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* IMAGE_REL_PPC_REL14 0x0007 */
   /*   16-bit PC-relative offset, shifted left 2 (br cond relative) */
   /* FIXME: the mask is likely wrong, and the bit position may be as well */
   /* FIXME: how does it know how far to shift? */
   /* Unused: */
-  HOWTO (IMAGE_REL_PPC_ADDR14,  /* type */             
-	 1,	                /* rightshift */                           
-	 1,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (IMAGE_REL_PPC_ADDR14,  /* type */
+	 1,	                /* rightshift */
+	 1,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,		        /* special_function */                     
+	 0,		        /* special_function */
 	 "ADDR16",              /* name */
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 true),                 /* pcrel_offset */
-  
+
   /* IMAGE_REL_PPC_TOCREL16 0x0008 */
   /*   16-bit offset from TOC base */
   /* Used: */
-  HOWTO (IMAGE_REL_PPC_TOCREL16,/* type */             
-	 0,	                /* rightshift */                           
-	 1,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (IMAGE_REL_PPC_TOCREL16,/* type */
+	 0,	                /* rightshift */
+	 1,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_dont, /* complain_on_overflow */
-	 ppc_toc16_reloc,       /* special_function */                     
+	 ppc_toc16_reloc,       /* special_function */
 	 "TOCREL16",            /* name */
-	 false,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 false,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* IMAGE_REL_PPC_TOCREL14 0x0009 */
   /*   16-bit offset from TOC base, shifted left 2 (load doubleword) */
   /* Unused: */
-  HOWTO (IMAGE_REL_PPC_TOCREL14,/* type */             
-	 1,	                /* rightshift */                           
-	 1,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (IMAGE_REL_PPC_TOCREL14,/* type */
+	 1,	                /* rightshift */
+	 1,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,		        /* special_function */                     
+	 0,		        /* special_function */
 	 "TOCREL14",            /* name */
-	 false,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 false,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* IMAGE_REL_PPC_ADDR32NB 0x000A */
   /*   32-bit addr w/ image base */
   /* Unused: */
-  HOWTO (IMAGE_REL_PPC_ADDR32NB,/* type */             
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (IMAGE_REL_PPC_ADDR32NB,/* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,                     /* special_function */                     
+	 0,                     /* special_function */
 	 "ADDR32NB",            /* name */
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,	        /* src_mask */                             
-	 0xffffffff,        	/* dst_mask */                             
+	 true,	                /* partial_inplace */
+	 0xffffffff,	        /* src_mask */
+	 0xffffffff,        	/* dst_mask */
 	 false),                 /* pcrel_offset */
-  
+
   /* IMAGE_REL_PPC_SECREL 0x000B */
   /*   va of containing section (as in an image sectionhdr) */
   /* Unused: */
-  HOWTO (IMAGE_REL_PPC_SECREL,/* type */             
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (IMAGE_REL_PPC_SECREL,/* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 ppc_secrel_reloc,      /* special_function */                     
+	 ppc_secrel_reloc,      /* special_function */
 	 "SECREL",              /* name */
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,	        /* src_mask */                             
-	 0xffffffff,        	/* dst_mask */                             
+	 true,	                /* partial_inplace */
+	 0xffffffff,	        /* src_mask */
+	 0xffffffff,        	/* dst_mask */
 	 true),                 /* pcrel_offset */
 
   /* IMAGE_REL_PPC_SECTION 0x000C */
   /*   sectionheader number */
   /* Unused: */
-  HOWTO (IMAGE_REL_PPC_SECTION,/* type */             
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (IMAGE_REL_PPC_SECTION,/* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 ppc_section_reloc,     /* special_function */                     
+	 ppc_section_reloc,     /* special_function */
 	 "SECTION",             /* name */
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,	        /* src_mask */                             
-	 0xffffffff,        	/* dst_mask */                             
+	 true,	                /* partial_inplace */
+	 0xffffffff,	        /* src_mask */
+	 0xffffffff,        	/* dst_mask */
 	 true),                 /* pcrel_offset */
 
   /* IMAGE_REL_PPC_IFGLUE 0x000D */
   /*   substitute TOC restore instruction iff symbol is glue code */
   /* Used: */
-  HOWTO (IMAGE_REL_PPC_IFGLUE,/* type */             
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (IMAGE_REL_PPC_IFGLUE,/* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,		        /* special_function */                     
+	 0,		        /* special_function */
 	 "IFGLUE",              /* name */
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,	        /* src_mask */                             
-	 0xffffffff,        	/* dst_mask */                             
+	 true,	                /* partial_inplace */
+	 0xffffffff,	        /* src_mask */
+	 0xffffffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
 
   /* IMAGE_REL_PPC_IMGLUE 0x000E */
   /*   symbol is glue code; virtual address is TOC restore instruction */
   /* Unused: */
-  HOWTO (IMAGE_REL_PPC_IMGLUE,/* type */             
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (IMAGE_REL_PPC_IMGLUE,/* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_dont, /* complain_on_overflow */
-	 ppc_imglue_reloc,      /* special_function */                     
+	 ppc_imglue_reloc,      /* special_function */
 	 "IMGLUE",              /* name */
-	 false,	                /* partial_inplace */                      
-	 0xffffffff,	        /* src_mask */                             
-	 0xffffffff,        	/* dst_mask */                             
+	 false,	                /* partial_inplace */
+	 0xffffffff,	        /* src_mask */
+	 0xffffffff,        	/* dst_mask */
 	 false),                 /* pcrel_offset */
 
   /* IMAGE_REL_PPC_SECREL16 0x000F */
   /*   va of containing section (limited to 16 bits) */
   /* Unused: */
-  HOWTO (IMAGE_REL_PPC_SECREL16,/* type */             
-	 0,	                /* rightshift */                           
-	 1,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (IMAGE_REL_PPC_SECREL16,/* type */
+	 0,	                /* rightshift */
+	 1,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,		        /* special_function */                     
+	 0,		        /* special_function */
 	 "SECREL16",            /* name */
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 true),                 /* pcrel_offset */
 
   /* IMAGE_REL_PPC_REFHI             0x0010 */
   /* Unused: */
-  HOWTO (IMAGE_REL_PPC_REFHI,   /* type */             
-	 0,	                /* rightshift */                           
-	 1,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (IMAGE_REL_PPC_REFHI,   /* type */
+	 0,	                /* rightshift */
+	 1,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 ppc_refhi_reloc,	/* special_function */                     
+	 ppc_refhi_reloc,	/* special_function */
 	 "REFHI",               /* name */
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,	        /* src_mask */                             
-	 0xffffffff,        	/* dst_mask */                             
+	 true,	                /* partial_inplace */
+	 0xffffffff,	        /* src_mask */
+	 0xffffffff,        	/* dst_mask */
 	 false),                 /* pcrel_offset */
 
   /* IMAGE_REL_PPC_REFLO             0x0011 */
   /* Unused: */
-  HOWTO (IMAGE_REL_PPC_REFLO,   /* type */             
-	 0,	                /* rightshift */                           
-	 1,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (IMAGE_REL_PPC_REFLO,   /* type */
+	 0,	                /* rightshift */
+	 1,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 ppc_refhi_reloc,	/* special_function */                     
+	 ppc_refhi_reloc,	/* special_function */
 	 "REFLO",               /* name */
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,	        /* src_mask */                             
-	 0xffffffff,        	/* dst_mask */                             
+	 true,	                /* partial_inplace */
+	 0xffffffff,	        /* src_mask */
+	 0xffffffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
 
   /* IMAGE_REL_PPC_PAIR              0x0012 */
   /* Unused: */
-  HOWTO (IMAGE_REL_PPC_PAIR,    /* type */             
-	 0,	                /* rightshift */                           
-	 1,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (IMAGE_REL_PPC_PAIR,    /* type */
+	 0,	                /* rightshift */
+	 1,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 ppc_pair_reloc,        /* special_function */                     
+	 ppc_pair_reloc,        /* special_function */
 	 "PAIR",                /* name */
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,	        /* src_mask */                             
-	 0xffffffff,        	/* dst_mask */                             
+	 true,	                /* partial_inplace */
+	 0xffffffff,	        /* src_mask */
+	 0xffffffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
 
   /* IMAGE_REL_PPC_TOCREL16_DEFN 0x0013 */
   /*   16-bit offset from TOC base, without causing a definition */
   /* Used: */
-  HOWTO ( (IMAGE_REL_PPC_TOCREL16 | IMAGE_REL_PPC_TOCDEFN), /* type */ 
-	 0,	                /* rightshift */                           
-	 1,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO ( (IMAGE_REL_PPC_TOCREL16 | IMAGE_REL_PPC_TOCDEFN), /* type */
+	 0,	                /* rightshift */
+	 1,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_dont, /* complain_on_overflow */
-	 0,                     /* special_function */                     
+	 0,                     /* special_function */
 	 "TOCREL16, TOCDEFN",   /* name */
-	 false,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 false,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
 
 };
 
-
 
 
 /* Some really cheezy macros that can be turned on to test stderr :-) */
@@ -788,19 +781,19 @@
    if (i == 0)                                               \
      {                                                       \
        i = 1;                                                \
-       fprintf(stderr,_("Unimplemented Relocation -- %s\n"),x); \
+       fprintf (stderr,_("Unimplemented Relocation -- %s\n"),x); \
      }                                                       \
 }
 
 #define DUMP_RELOC(n,r)                              \
 {                                                    \
-   fprintf(stderr,"%s sym %d, addr %d, addend %d\n", \
+   fprintf (stderr,"%s sym %d, addr %d, addend %d\n", \
 	   n, (*(r->sym_ptr_ptr))->name,             \
 	   r->address, r->addend);                   \
 }
 
-/* Given a reloc name, n, and a pointer to an internal_reloc, 
-   dump out interesting information on the contents 
+/* Given a reloc name, n, and a pointer to an internal_reloc,
+   dump out interesting information on the contents
 
 #define n_name		_n._n_name
 #define n_zeroes	_n._n_n._n_zeroes
@@ -810,7 +803,7 @@
 
 #define DUMP_RELOC2(n,r)                     \
 {                                            \
-   fprintf(stderr,"%s sym %d, r_vaddr %d %s\n", \
+   fprintf (stderr,"%s sym %d, r_vaddr %d %s\n", \
 	   n, r->r_symndx, r->r_vaddr,\
 	   (((r->r_type) & IMAGE_REL_PPC_TOCDEFN) == 0) \
 	   ?" ":" TOCDEFN"  );      \
@@ -822,7 +815,6 @@
 #define DUMP_RELOC2(n,r)
 #endif
 
-
 
 /* toc construction and management routines */
 
@@ -924,16 +916,16 @@
       HASH_CHECK(h);
     }
 
-  if (h == 0) 
-    { 
+  if (h == 0)
+    {
       local_syms = obj_coff_local_toc_table(abfd);
       if (local_syms == 0)
 	{
 	  unsigned int i;
 	  /* allocate a table */
-	  local_syms = 
-	    (int *) bfd_zalloc (abfd, 
-				obj_raw_syment_count(abfd) * sizeof(int));
+	  local_syms =
+	    (int *) bfd_zalloc (abfd,
+				obj_raw_syment_count(abfd) * sizeof (int));
 	  if (local_syms == 0)
 	    return false;
 	  obj_coff_local_toc_table(abfd) = local_syms;
@@ -943,7 +935,7 @@
 	    }
 	}
 
-      if (IS_UNALLOCATED(local_syms[sym])) 
+      if (IS_UNALLOCATED(local_syms[sym]))
 	{
 	  local_syms[sym] = global_toc_size;
 	  global_toc_size += 4;
@@ -1004,18 +996,18 @@
 
 
 /* Return true if this relocation should
-   appear in the output .reloc section. */
+   appear in the output .reloc section.  */
 
 static boolean in_reloc_p(abfd, howto)
      bfd * abfd ATTRIBUTE_UNUSED;
      reloc_howto_type *howto;
 {
-  return 
-    (! howto->pc_relative) 
+  return
+    (! howto->pc_relative)
       && (howto->type != IMAGE_REL_PPC_ADDR32NB)
       && (howto->type != IMAGE_REL_PPC_TOCREL16)
       && (howto->type != IMAGE_REL_PPC_IMGLUE)
-      && (howto->type != IMAGE_REL_PPC_IFGLUE) 
+      && (howto->type != IMAGE_REL_PPC_IFGLUE)
       && (howto->type != IMAGE_REL_PPC_SECREL)
       && (howto->type != IMAGE_REL_PPC_SECTION)
       && (howto->type != IMAGE_REL_PPC_SECREL16)
@@ -1023,7 +1015,7 @@
       && (howto->type != IMAGE_REL_PPC_REFLO)
       && (howto->type != IMAGE_REL_PPC_PAIR)
       && (howto->type != IMAGE_REL_PPC_TOCREL16_DEFN) ;
-}     
+}
 
 #if 0
 
@@ -1050,39 +1042,38 @@
   unsigned long sym_value;
   unsigned short r_type;
   unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/
-	
+
   r_type = reloc_entry->howto->type;
 
-  if (output_bfd) 
+  if (output_bfd)
     {
       /* Partial linking - do nothing */
       reloc_entry->address += input_section->output_offset;
-      return bfd_reloc_ok; 
+      return bfd_reloc_ok;
     }
 
   if (symbol_in != NULL
       && bfd_is_und_section (symbol_in->section))
     {
       /* Keep the state machine happy in case we're called again */
-      if (r_type == IMAGE_REL_PPC_REFHI) 
+      if (r_type == IMAGE_REL_PPC_REFHI)
 	{
 	  part1_consth_active = true;
 	  part1_consth_value  = 0;
 	}
       return(bfd_reloc_undefined);
     }
-  
-  if ((part1_consth_active) && (r_type != IMAGE_REL_PPC_PAIR)) 
+
+  if ((part1_consth_active) && (r_type != IMAGE_REL_PPC_PAIR))
     {
       part1_consth_active = false;
       *error_message = (char *) _("Missing PAIR");
       return(bfd_reloc_dangerous);
     }
 
-
   sym_value = get_symbol_value(symbol_in);
-  
-  return(bfd_reloc_ok);	
+
+  return(bfd_reloc_ok);
 }
 
 #endif /* 0 */
@@ -1108,13 +1099,13 @@
   asection *toc_section = 0;
   bfd_vma relocation;
   reloc_howto_type *howto = 0;
-  
+
   /* If we are performing a relocateable link, we don't need to do a
      thing.  The caller will take care of adjusting the reloc
      addresses and symbol indices.  */
   if (info->relocateable)
     return true;
-  
+
   hihalf = false;
   hihalf_val = 0;
 
@@ -1133,7 +1124,7 @@
 
       unsigned short r_type  = EXTRACT_TYPE (rel->r_type);
       unsigned short r_flags = EXTRACT_FLAGS(rel->r_type);
-  
+
       symndx = rel->r_symndx;
       loc = contents + rel->r_vaddr - input_section->vma;
 
@@ -1147,9 +1138,9 @@
 	}
       else
 	{
-	  h = (struct ppc_coff_link_hash_entry *) 
+	  h = (struct ppc_coff_link_hash_entry *)
 	    (obj_coff_sym_hashes (input_bfd)[symndx]);
-	  if (h != 0) 
+	  if (h != 0)
 	    {
 	      HASH_CHECK(h);
 	    }
@@ -1159,8 +1150,8 @@
 
       if (r_type == IMAGE_REL_PPC_IMGLUE && h == 0)
 	{
-	  /* An IMGLUE reloc must have a name. Something is very wrong. */
-	  abort();
+	  /* An IMGLUE reloc must have a name. Something is very wrong.  */
+	  abort ();
 	}
 
       sec = NULL;
@@ -1203,7 +1194,7 @@
 	}
 
       rstat = bfd_reloc_ok;
-      
+
       /* Each case must do its own relocation, setting rstat appropriately */
       switch (r_type)
 	{
@@ -1220,19 +1211,19 @@
 
 	    DUMP_RELOC2(howto->name, rel);
 
-	    if (toc_section == 0) 
+	    if (toc_section == 0)
 	      {
-		toc_section = bfd_get_section_by_name (bfd_of_toc_owner, 
+		toc_section = bfd_get_section_by_name (bfd_of_toc_owner,
 						       TOC_SECTION_NAME);
 
-		if ( toc_section == NULL ) 
+		if ( toc_section == NULL )
 		  {
-		    /* There is no toc section. Something is very wrong. */
-		    abort();
+		    /* There is no toc section. Something is very wrong.  */
+		    abort ();
 		  }
 	      }
 
-	    /* 
+	    /*
 	     *  Amazing bit tricks present. As we may have seen earlier, we
 	     *  use the 1 bit to tell us whether or not a toc offset has been
 	     *  allocated. Now that they've all been allocated, we will use
@@ -1253,7 +1244,7 @@
 
 		if (IS_WRITTEN(our_toc_offset))
 		  {
-		    /* if it has been written out, it is marked with the 
+		    /* if it has been written out, it is marked with the
 		       1 bit. Fix up our offset, but do not write it out
 		       again.
 		     */
@@ -1262,12 +1253,12 @@
 		else
 		  {
 		    /* write out the toc entry */
-		    record_toc(toc_section, 
-			       our_toc_offset, 
-			       priv, 
+		    record_toc(toc_section,
+			       our_toc_offset,
+			       priv,
 			       strdup(name));
 
-		    bfd_put_32(output_bfd,
+		    bfd_put_32 (output_bfd,
 			       val,
 			       toc_section->contents + our_toc_offset);
 
@@ -1280,33 +1271,33 @@
 		const char *name = h->root.root.root.string;
 		our_toc_offset = h->toc_offset;
 
-		if ((r_flags & IMAGE_REL_PPC_TOCDEFN) 
+		if ((r_flags & IMAGE_REL_PPC_TOCDEFN)
 		    == IMAGE_REL_PPC_TOCDEFN )
 		  {
-		    /* This is unbelievable cheese. Some knowledgable asm 
-		       hacker has decided to use r2 as a base for loading 
-		       a value. He/She does this by setting the tocdefn bit, 
-		       and not supplying a toc definition. The behaviour is 
-		       then to use the difference between the value of the 
-		       symbol and the actual location of the toc as the toc 
-		       index. 
+		    /* This is unbelievable cheese. Some knowledgable asm
+		       hacker has decided to use r2 as a base for loading
+		       a value. He/She does this by setting the tocdefn bit,
+		       and not supplying a toc definition. The behaviour is
+		       then to use the difference between the value of the
+		       symbol and the actual location of the toc as the toc
+		       index.
 
 		       In fact, what is usually happening is, because the
 		       Import Address Table is mapped immediately following
 		       the toc, some trippy library code trying for speed on
-		       dll linkage, takes advantage of that and considers 
+		       dll linkage, takes advantage of that and considers
 		       the IAT to be part of the toc, thus saving a load.
 		    */
 
-		    our_toc_offset = val - 
-		      (toc_section->output_section->vma + 
+		    our_toc_offset = val -
+		      (toc_section->output_section->vma +
 		       toc_section->output_offset);
 
 		    /* The size must still fit in a 16bit displacment */
 		    if (our_toc_offset >= 65535)
 		      {
 			(*_bfd_error_handler)
-			  (_("%s: Relocation for %s of %x exceeds Toc size limit"), 
+			  (_("%s: Relocation for %s of %x exceeds Toc size limit"),
 			   bfd_get_filename (input_bfd), name, our_toc_offset);
 			bfd_set_error (bfd_error_bad_value);
 			return false;
@@ -1316,7 +1307,7 @@
 		  }
 		else if (IS_WRITTEN(our_toc_offset))
 		  {
-		    /* if it has been written out, it is marked with the 
+		    /* if it has been written out, it is marked with the
 		       1 bit. Fix up our offset, but do not write it out
 		       again.
 		     */
@@ -1327,7 +1318,7 @@
 		    record_toc(toc_section, our_toc_offset, pub, strdup(name));
 
 		    /* write out the toc entry */
-		    bfd_put_32(output_bfd,
+		    bfd_put_32 (output_bfd,
 			       val,
 			       toc_section->contents + our_toc_offset);
 
@@ -1338,31 +1329,30 @@
 		  }
 	      }
 
-	    if (fixit && info->base_file) 
+	    if (fixit && info->base_file)
 	      {
 		/* So if this is non pcrelative, and is referenced
 		   to a section or a common symbol, then it needs a reloc */
 
 		/* relocation to a symbol in a section which
-		   isn't absolute - we output the address here 
+		   isn't absolute - we output the address here
 		   to a file */
 
 		bfd_vma addr =  toc_section->output_section->vma
 		  + toc_section->output_offset + our_toc_offset;
-		    
+
 		if (coff_data(output_bfd)->pe)
 		  addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
 
 		fwrite (&addr, 1,4, (FILE *) info->base_file);
 	      }
 
-
 	    /* FIXME: this test is conservative */
 	    if ( (r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN &&
 		our_toc_offset > toc_section->_raw_size)
 	      {
 		(*_bfd_error_handler)
-		  (_("%s: Relocation exceeds allocated TOC (%x)"), 
+		  (_("%s: Relocation exceeds allocated TOC (%x)"),
 		   bfd_get_filename (input_bfd),
 		   toc_section->_raw_size);
 		bfd_set_error (bfd_error_bad_value);
@@ -1372,18 +1362,18 @@
 	    /* Now we know the relocation for this toc reference */
 	    relocation =  our_toc_offset + TOC_LOAD_ADJUSTMENT;
 	    rstat = _bfd_relocate_contents (howto,
-					    input_bfd, 
-					    relocation, 
+					    input_bfd,
+					    relocation,
 					    loc);
 	  }
 	  break;
 	case IMAGE_REL_PPC_IFGLUE:
 	  {
 	    /* To solve this, we need to know whether or not the symbol */
-	    /* appearing on the call instruction is a glue function or not. */
+	    /* appearing on the call instruction is a glue function or not.  */
 	    /* A glue function must announce itself via a IMGLUE reloc, and */
 	    /* the reloc contains the required toc restore instruction */
-	  
+
 	    bfd_vma x;
 	    const char *my_name;
 	    DUMP_RELOC2(howto->name, rel);
@@ -1391,18 +1381,18 @@
 	    if (h != 0)
 	      {
 		my_name = h->root.root.root.string;
-		if (h->symbol_is_glue == 1) 
+		if (h->symbol_is_glue == 1)
 		  {
-		    x = bfd_get_32(input_bfd, loc);
-		    bfd_put_32(input_bfd, h->glue_insn, loc);
+		    x = bfd_get_32 (input_bfd, loc);
+		    bfd_put_32 (input_bfd, h->glue_insn, loc);
 		  }
 	      }
 	  }
 	  break;
 	case IMAGE_REL_PPC_SECREL:
 	  /* Unimplemented: codeview debugging information */
-	  /* For fast access to the header of the section 
-	     containing the item. */
+	  /* For fast access to the header of the section
+	     containing the item.  */
 	  break;
 	case IMAGE_REL_PPC_SECTION:
 	  /* Unimplemented: codeview debugging information */
@@ -1420,15 +1410,15 @@
 		my_name = h->root.root.root.string;
 	      }
 
-	    fprintf(stderr, 
-		    _("Warning: unsupported reloc %s <file %s, section %s>\n"), 
+	    fprintf (stderr,
+		    _("Warning: unsupported reloc %s <file %s, section %s>\n"),
 		    howto->name,
 		    bfd_get_filename(input_bfd),
 		    input_section->name);
 
-	    fprintf(stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n", 
+	    fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n",
 		    rel->r_symndx, my_name, (long) rel->r_vaddr,
-		    (unsigned long) rel->r_vaddr);  
+		    (unsigned long) rel->r_vaddr);
 	  }
 	  break;
 	case IMAGE_REL_PPC_IMGLUE:
@@ -1436,12 +1426,12 @@
 	    /* There is nothing to do now. This reloc was noted in the first
 	       pass over the relocs, and the glue instruction extracted */
 	    const char *my_name;
-	    if (h->symbol_is_glue == 1) 
+	    if (h->symbol_is_glue == 1)
 	      break;
 	    my_name = h->root.root.root.string;
 
 	    (*_bfd_error_handler)
-	      (_("%s: Out of order IMGLUE reloc for %s"), 
+	      (_("%s: Out of order IMGLUE reloc for %s"),
 	       bfd_get_filename (input_bfd), my_name);
 	    bfd_set_error (bfd_error_bad_value);
 	    return false;
@@ -1461,16 +1451,16 @@
 		myh = coff_link_hash_lookup (coff_hash_table (info),
 					     "__idata5_magic__",
 					     false, false, true);
-		first_thunk_address = myh->root.u.def.value + 
-		  sec->output_section->vma + 
-		    sec->output_offset - 
+		first_thunk_address = myh->root.u.def.value +
+		  sec->output_section->vma +
+		    sec->output_offset -
 		      pe_data(output_bfd)->pe_opthdr.ImageBase;
-		
+
 		idata5offset = myh->root.u.def.value;
 		myh = coff_link_hash_lookup (coff_hash_table (info),
 					     "__idata6_magic__",
 					     false, false, true);
-		
+
 		thunk_size = myh->root.u.def.value - idata5offset;
 		myh = coff_link_hash_lookup (coff_hash_table (info),
 					     "__idata4_magic__",
@@ -1502,13 +1492,13 @@
 		    myh = coff_link_hash_lookup (coff_hash_table (info),
 						 target,
 						 false, false, true);
-		    if (myh == 0) 
+		    if (myh == 0)
 		      {
-			/* Missing magic cookies. Something is very wrong. */
-			abort();
+			/* Missing magic cookies. Something is very wrong.  */
+			abort ();
 		      }
-		    
-		    val = myh->root.u.def.value + 
+
+		    val = myh->root.u.def.value +
 		      sec->output_section->vma + sec->output_offset;
 		    if (first_thunk_address == 0)
 		      {
@@ -1516,16 +1506,16 @@
 			myh = coff_link_hash_lookup (coff_hash_table (info),
 						     "__idata5_magic__",
 						     false, false, true);
-			first_thunk_address = myh->root.u.def.value + 
-			  sec->output_section->vma + 
-			    sec->output_offset - 
+			first_thunk_address = myh->root.u.def.value +
+			  sec->output_section->vma +
+			    sec->output_offset -
 			      pe_data(output_bfd)->pe_opthdr.ImageBase;
-			
+
 			idata5offset = myh->root.u.def.value;
 			myh = coff_link_hash_lookup (coff_hash_table (info),
 						     "__idata6_magic__",
 						     false, false, true);
-			
+
 			thunk_size = myh->root.u.def.value - idata5offset;
 			myh = coff_link_hash_lookup (coff_hash_table (info),
 						     "__idata4_magic__",
@@ -1536,8 +1526,8 @@
 	      }
 
 	    rstat = _bfd_relocate_contents (howto,
-		      	      input_bfd, 
-			      val - 
+		      	      input_bfd,
+			      val -
 			      pe_data(output_bfd)->pe_opthdr.ImageBase,
 			      loc);
 	  }
@@ -1549,8 +1539,8 @@
 		  + input_section->output_offset);
 
 	  rstat = _bfd_relocate_contents (howto,
-					  input_bfd, 
-					  val, 
+					  input_bfd,
+					  val,
 					  loc);
 	  break;
 	case IMAGE_REL_PPC_ADDR16:
@@ -1558,8 +1548,8 @@
 	case IMAGE_REL_PPC_ADDR32:
 	  DUMP_RELOC2(howto->name, rel);
 	  rstat = _bfd_relocate_contents (howto,
-					  input_bfd, 
-					  val, 
+					  input_bfd,
+					  val,
 					  loc);
 	  break;
 	}
@@ -1571,11 +1561,11 @@
 	  if (sym && pe_data(output_bfd)->in_reloc_p(output_bfd, howto))
 	    {
 	      /* relocation to a symbol in a section which
-		 isn't absolute - we output the address here 
+		 isn't absolute - we output the address here
 		 to a file */
-	      bfd_vma addr = rel->r_vaddr 
-		- input_section->vma 
-		+ input_section->output_offset 
+	      bfd_vma addr = rel->r_vaddr
+		- input_section->vma
+		+ input_section->output_offset
 		  + input_section->output_section->vma;
 
 	      if (coff_data(output_bfd)->pe)
@@ -1614,7 +1604,7 @@
 	      }
 
 	    if (! ((*info->callbacks->reloc_overflow)
-		   (info, name, howto->name, 
+		   (info, name, howto->name,
 		    (bfd_vma) 0, input_bfd,
 		    input_section, rel->r_vaddr - input_section->vma)))
 	      {
@@ -1623,7 +1613,7 @@
 	  }
 	}
 
-    }     
+    }
 
   return true;
 }
@@ -1659,11 +1649,11 @@
   FILE *file = (FILE *) vfile;
   struct list_ele *t;
 
-  fprintf(file, _(h1));
-  fprintf(file, _(h2));
-  fprintf(file, _(h3));
+  fprintf (file, _(h1));
+  fprintf (file, _(h2));
+  fprintf (file, _(h3));
 
-  for(t = head; t != 0; t=t->next)
+  for (t = head; t != 0; t=t->next)
     {
       const char *cat = "";
 
@@ -1680,26 +1670,26 @@
 	    cat = _("IAT reference ");
 	  else
 	    {
-	      fprintf(file,
+	      fprintf (file,
 		      _("**** global_toc_size %ld(%lx), thunk_size %ld(%lx)\n"),
 		      global_toc_size, global_toc_size, thunk_size, thunk_size);
 	      cat = _("Out of bounds!");
 	    }
 	}
 
-      fprintf(file,
+      fprintf (file,
 	      " %04lx    (%d)", (unsigned long) t->offset, t->offset - 32768);
-      fprintf(file,
+      fprintf (file,
 	      "    %s %s\n",
 	      cat, t->name);
 
     }
 
-  fprintf(file, "\n");
+  fprintf (file, "\n");
 }
 
 boolean
-ppc_allocate_toc_section (info) 
+ppc_allocate_toc_section (info)
      struct bfd_link_info *info ATTRIBUTE_UNUSED;
 {
   asection *s;
@@ -1711,15 +1701,15 @@
 
   if (bfd_of_toc_owner == 0)
     {
-      /* No toc owner? Something is very wrong. */
-      abort();
+      /* No toc owner? Something is very wrong.  */
+      abort ();
     }
 
   s = bfd_get_section_by_name ( bfd_of_toc_owner , TOC_SECTION_NAME);
-  if (s == NULL) 
+  if (s == NULL)
     {
-      /* No toc section? Something is very wrong. */
-      abort();
+      /* No toc section? Something is very wrong.  */
+      abort ();
     }
 
   foo = (bfd_byte *) bfd_alloc(bfd_of_toc_owner, global_toc_size);
@@ -1740,7 +1730,7 @@
   struct internal_reloc *i, *rel;
 
   /* here we have a bfd that is to be included on the link. We have a hook
-     to do reloc rummaging, before section sizes are nailed down. */
+     to do reloc rummaging, before section sizes are nailed down.  */
 
   _bfd_coff_get_external_symbols(abfd);
 
@@ -1754,17 +1744,17 @@
 
   for (; sec != 0; sec = sec->next)
   {
-    if (sec->reloc_count == 0) 
+    if (sec->reloc_count == 0)
       continue;
 
     /* load the relocs */
     /* FIXME: there may be a storage leak here */
     i=_bfd_coff_read_internal_relocs(abfd,sec,1,0,0,0);
-    
-    if (i == 0)
-      abort();
 
-    for (rel=i;rel<i+sec->reloc_count;++rel) 
+    if (i == 0)
+      abort ();
+
+    for (rel=i;rel<i+sec->reloc_count;++rel)
       {
 	unsigned short r_type  = EXTRACT_TYPE (rel->r_type);
 	unsigned short r_flags = EXTRACT_FLAGS(rel->r_type);
@@ -1772,13 +1762,13 @@
 
 	DUMP_RELOC2(ppc_coff_howto_table[r_type].name, rel);
 
-	switch(r_type) 
+	switch(r_type)
 	  {
 	  case IMAGE_REL_PPC_TOCREL16:
 	    /* if TOCDEFN is on, ignore as someone else has allocated the
 	       toc entry */
 	    if ( (r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN )
-	      ok = ppc_record_toc_entry(abfd, info, sec, 
+	      ok = ppc_record_toc_entry(abfd, info, sec,
 					rel->r_symndx, default_toc);
 	    if (!ok)
 	      return false;
@@ -1797,7 +1787,6 @@
 
 #endif
 
-
 static bfd_reloc_status_type
 ppc_refhi_reloc (abfd,
 		 reloc_entry,
@@ -2015,11 +2004,10 @@
 
 
 #define MAX_RELOC_INDEX  \
-      (sizeof(ppc_coff_howto_table) / sizeof(ppc_coff_howto_table[0]) - 1)
-
+      (sizeof (ppc_coff_howto_table) / sizeof (ppc_coff_howto_table[0]) - 1)
 
 /* FIXME: There is a possiblity that when we read in a reloc from a file,
-          that there are some bits encoded in the upper portion of the 
+          that there are some bits encoded in the upper portion of the
 	  type field. Not yet implemented.
 */
 static void ppc_coff_rtype2howto PARAMS ((arelent *relent,
@@ -2029,7 +2017,7 @@
 ppc_coff_rtype2howto (relent, internal)
      arelent *relent;
      struct internal_reloc *internal;
-{  
+{
 
   /* We can encode one of three things in the type field, aside from the
      type:
@@ -2046,15 +2034,15 @@
   unsigned short r_flags = EXTRACT_FLAGS(internal->r_type);
   unsigned short junk    = EXTRACT_JUNK (internal->r_type);
 
-  /* the masking process only slices off the bottom byte for r_type. */
-  if ( r_type > MAX_RELOC_INDEX ) 
-    abort();
+  /* the masking process only slices off the bottom byte for r_type.  */
+  if ( r_type > MAX_RELOC_INDEX )
+    abort ();
 
   /* check for absolute crap */
   if ( junk != 0 )
-    abort();
+    abort ();
 
-  switch(r_type) 
+  switch(r_type)
     {
     case IMAGE_REL_PPC_ADDR16:
     case IMAGE_REL_PPC_REL24:
@@ -2079,16 +2067,16 @@
 	howto = ppc_coff_howto_table + IMAGE_REL_PPC_TOCREL16;
       break;
     default:
-      fprintf(stderr, 
+      fprintf (stderr,
 	      _("Warning: Unsupported reloc %s [%d] used -- it may not work.\n"),
 	      ppc_coff_howto_table[r_type].name,
 	      r_type);
-      howto = ppc_coff_howto_table + r_type;      
+      howto = ppc_coff_howto_table + r_type;
       break;
     }
-  
+
   relent->howto = howto;
-  
+
 }
 
 static reloc_howto_type *
@@ -2117,15 +2105,15 @@
   unsigned short r_flags = EXTRACT_FLAGS(rel->r_type);
   unsigned short junk    = EXTRACT_JUNK (rel->r_type);
 
-  /* the masking process only slices off the bottom byte for r_type. */
-  if ( r_type > MAX_RELOC_INDEX ) 
-    abort();
-  
+  /* the masking process only slices off the bottom byte for r_type.  */
+  if ( r_type > MAX_RELOC_INDEX )
+    abort ();
+
   /* check for absolute crap */
   if ( junk != 0 )
-    abort();
-    
-  switch(r_type) 
+    abort ();
+
+  switch(r_type)
     {
     case IMAGE_REL_PPC_ADDR32NB:
       DUMP_RELOC2(ppc_coff_howto_table[r_type].name, rel);
@@ -2154,18 +2142,17 @@
       howto = ppc_coff_howto_table + r_type;
       break;
     default:
-      fprintf(stderr, 
+      fprintf (stderr,
 	      _("Warning: Unsupported reloc %s [%d] used -- it may not work.\n"),
 	      ppc_coff_howto_table[r_type].name,
 	      r_type);
       howto = ppc_coff_howto_table + r_type;
       break;
     }
-  
+
   return howto;
 }
 
-
 /* a cheesy little macro to make the code a little more readable */
 #define HOW2MAP(bfd_rtype,ppc_rtype)  \
  case bfd_rtype: return &ppc_coff_howto_table[ppc_rtype]
@@ -2189,7 +2176,7 @@
       HOW2MAP(BFD_RELOC_16_GOTOFF,    IMAGE_REL_PPC_TOCREL16_DEFN);
       HOW2MAP(BFD_RELOC_32,           IMAGE_REL_PPC_ADDR32);
       HOW2MAP(BFD_RELOC_RVA,          IMAGE_REL_PPC_ADDR32NB);
-    default: 
+    default:
       return NULL;
     }
   /*NOTREACHED*/
@@ -2198,7 +2185,7 @@
 #undef HOW2MAP
 
 
-/* Tailor coffcode.h -- macro heaven. */
+/* Tailor coffcode.h -- macro heaven.  */
 
 #define RTYPE2HOWTO(cache_ptr, dst)  ppc_coff_rtype2howto (cache_ptr, dst)
 
@@ -2211,7 +2198,7 @@
 #define coff_bfd_reloc_type_lookup   ppc_coff_reloc_type_lookup
 #define coff_rtype_to_howto          coff_ppc_rtype_to_howto
 #define coff_relocate_section        coff_ppc_relocate_section
-#define coff_bfd_final_link          ppc_bfd_coff_final_link 
+#define coff_bfd_final_link          ppc_bfd_coff_final_link
 
 #ifndef COFF_IMAGE_WITH_PE
 /* FIXME: This no longer works.  */
@@ -2247,7 +2234,7 @@
 
 #ifndef COFF_IMAGE_WITH_PE
 /* FIXME:
-   What we're trying to do here is allocate a toc section (early), and attach 
+   What we're trying to do here is allocate a toc section (early), and attach
    it to the last bfd to be processed. This avoids the problem of having a toc
    written out before all files have been processed. This code allocates
    a toc section for every file, and records the last one seen. There are
@@ -2277,7 +2264,7 @@
       register asection *s;
 
       s = bfd_get_section_by_name ( abfd , TOC_SECTION_NAME);
-      if (s != NULL) 
+      if (s != NULL)
 	{
 	  return;
 	}
@@ -2291,7 +2278,7 @@
 	  || !bfd_set_section_alignment (abfd, s, 2))
 	{
 	  /* FIXME: set appropriate bfd error */
-	  abort();
+	  abort ();
 	}
 
       /* save the bfd for later allocation */
@@ -2324,18 +2311,17 @@
 }
 
 /* this piece of machinery exists only to guarantee that the bfd that holds
-   the toc section is written last. 
+   the toc section is written last.
 
    This does depend on bfd_make_section attaching a new section to the
-   end of the section list for the bfd. 
+   end of the section list for the bfd.
 
-   This is otherwise intended to be functionally the same as 
-   cofflink.c:_bfd_coff_final_link(). It is specifically different only 
-   where the POWERPC_LE_PE macro modifies the code. It is left in as a 
+   This is otherwise intended to be functionally the same as
+   cofflink.c:_bfd_coff_final_link(). It is specifically different only
+   where the POWERPC_LE_PE macro modifies the code. It is left in as a
    precise form of comment. krk@cygnus.com
 */
 
-
 /* Do the final link step.  */
 
 boolean
@@ -2846,7 +2832,7 @@
 extern const bfd_target TARGET_BIG_SYM;
 #endif
 
-/* The transfer vectors that lead the outside world to all of the above. */
+/* The transfer vectors that lead the outside world to all of the above.  */
 
 #ifdef TARGET_LITTLE_SYM
 const bfd_target TARGET_LITTLE_SYM =
@@ -2859,7 +2845,7 @@
   (HAS_RELOC | EXEC_P |		/* FIXME: object flags */
    HAS_LINENO | HAS_DEBUG |
    HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-  
+
 #ifndef COFF_WITH_PE
   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
 #else
@@ -2878,14 +2864,14 @@
   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
   bfd_getl32, bfd_getl_signed_32, bfd_putl32,
   bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
-  
+
   {_bfd_dummy_target, coff_object_p, 	/* bfd_check_format */
      bfd_generic_archive_p, /* _bfd_dummy_target */ coff_object_p },
   {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
      bfd_false},
   {bfd_false, coff_write_object_contents,	/* bfd_write_contents */
      _bfd_write_archive_contents, bfd_false},
-  
+
   BFD_JUMP_TABLE_GENERIC (coff),
   BFD_JUMP_TABLE_COPY (coff),
   BFD_JUMP_TABLE_CORE (_bfd_nocore),
@@ -2902,7 +2888,7 @@
 #else
   NULL,
 #endif
-  
+
   COFF_SWAP_TABLE
 };
 #endif
@@ -2911,7 +2897,7 @@
 const bfd_target TARGET_BIG_SYM =
 {
   TARGET_BIG_NAME,
-  bfd_target_coff_flavour,	
+  bfd_target_coff_flavour,
   BFD_ENDIAN_BIG,		/* data byte order is big */
   BFD_ENDIAN_BIG,		/* header byte order is big */
 
@@ -2955,14 +2941,13 @@
   BFD_JUMP_TABLE_LINK (coff),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-
   /* Alternative_target.  */
 #ifdef TARGET_LITTLE_SYM
   & TARGET_LITTLE_SYM,
 #else
   NULL,
 #endif
-  
+
   COFF_SWAP_TABLE
 };
 
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 4689400..da0e147 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -5,7 +5,7 @@
    Using the following chars caused a compiler warning on HIUX (so I replaced
    them with octal escapes), and isn't useful without an understanding of what
    character set it is.
-   Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365, 
+   Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365,
      and John Gilmore.
    Archive support from Damon A. Permezel.
    Contributed by IBM Corporation and Cygnus Support.
@@ -26,7 +26,6 @@
 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"
@@ -37,7 +36,6 @@
 #define TARGET_SYM rs6000coff_vec
 #include "xcoff-target.h"
 
-
 /* The main body of code is in coffcode.h.  */
 
 static const char *normalize_filename PARAMS ((bfd *));
@@ -133,7 +131,6 @@
 }
 
 
-
 void
 _bfd_xcoff_swap_sym_in (abfd, ext1, in1)
      bfd            *abfd;
@@ -143,19 +140,18 @@
   SYMENT *ext = (SYMENT *)ext1;
   struct internal_syment      *in = (struct internal_syment *)in1;
 
-
-  if(ext->e.e_name[0] != 0)
+  if (ext->e.e_name[0] != 0)
     {
       memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN);
     }
-  else 
+  else
     {
       in->_n._n_n._n_zeroes = 0;
-      in->_n._n_n._n_offset = 
+      in->_n._n_n._n_offset =
 	  bfd_h_get_32(abfd, (bfd_byte *) ext->e.e.e_offset);
     }
 
-  in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value); 
+  in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value);
   in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum);
   in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type);
   in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass);
@@ -171,14 +167,14 @@
   struct internal_syment *in = (struct internal_syment *)inp;
   SYMENT *ext =(SYMENT *)extp;
 
-  if(in->_n._n_name[0] != 0)
+  if (in->_n._n_name[0] != 0)
     {
       memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN);
     }
   else
     {
       bfd_h_put_32(abfd, 0, (bfd_byte *) ext->e.e.e_zeroes);
-      bfd_h_put_32(abfd, in->_n._n_n._n_offset, 
+      bfd_h_put_32(abfd, in->_n._n_n._n_offset,
 	      (bfd_byte *)  ext->e.e.e_offset);
     }
 
@@ -214,7 +210,7 @@
     case C_FILE:
       if (ext->x_file.x_fname[0] == 0) {
 	  in->x_file.x_n.x_zeroes = 0;
-	  in->x_file.x_n.x_offset = 
+	  in->x_file.x_n.x_offset =
 	   bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
 	} else {
 	    if (numaux > 1)
@@ -235,7 +231,7 @@
     case C_HIDEXT:
       if (indx + 1 == numaux)
 	{
-	  in->x_csect.x_scnlen.l = 
+	  in->x_csect.x_scnlen.l =
 	      bfd_h_get_32 (abfd, ext->x_csect.x_scnlen);
 	  in->x_csect.x_parmhash = bfd_h_get_32 (abfd,
 						 ext->x_csect.x_parmhash);
@@ -255,11 +251,11 @@
     case C_LEAFSTAT:
     case C_HIDDEN:
       if (type == T_NULL) {
-	  in->x_scn.x_scnlen = bfd_h_get_32(abfd, 
+	  in->x_scn.x_scnlen = bfd_h_get_32(abfd,
 		  (bfd_byte *) ext->x_scn.x_scnlen);
-	  in->x_scn.x_nreloc = bfd_h_get_16(abfd, 
+	  in->x_scn.x_nreloc = bfd_h_get_16(abfd,
 		  (bfd_byte *) ext->x_scn.x_nreloc);
-	  in->x_scn.x_nlinno = bfd_h_get_16(abfd, 
+	  in->x_scn.x_nlinno = bfd_h_get_16(abfd,
 		  (bfd_byte *) ext->x_scn.x_nlinno);
 	  /* PE defines some extra fields; we zero them out for
              safety.  */
@@ -305,12 +301,10 @@
 
 end: ;
   /* the semicolon is because MSVC doesn't like labels at
-     end of block. */
+     end of block.  */
 
 }
 
-
-
 unsigned int
 _bfd_xcoff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
      bfd   *abfd;
@@ -373,13 +367,13 @@
   }
 
   PUTWORD(abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx);
-  PUTWORD(abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx);
+  bfd_h_put_16 (abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx);
 
   if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
     {
-      bfd_h_put_32(abfd,  in->x_sym.x_fcnary.x_fcn.x_lnnoptr, 
+      bfd_h_put_32(abfd,  in->x_sym.x_fcnary.x_fcn.x_lnnoptr,
 	      (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
-      PUTWORD(abfd,  in->x_sym.x_fcnary.x_fcn.x_endndx.l, 
+      PUTWORD(abfd,  in->x_sym.x_fcnary.x_fcn.x_endndx.l,
 	      (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx);
     }
   else
@@ -399,9 +393,9 @@
 	     (bfd_byte *)  ext->x_sym.x_misc.x_fsize);
   else
     {
-      bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_lnno, 
+      bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_lnno,
 	      (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno);
-      bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_size, 
+      bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_size,
 	      (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_size);
     }
 
@@ -409,7 +403,6 @@
   return bfd_coff_auxesz (abfd);
 }
 
-
 
 /* The XCOFF reloc table.  Actually, XCOFF relocations specify the
    bitsize and whether they are signed or not, along with a
@@ -424,344 +417,344 @@
 reloc_howto_type xcoff_howto_table[] =
 {
   /* Standard 32 bit relocation.  */
-  HOWTO (0,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_POS",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_POS",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,            /* src_mask */
+	 0xffffffff,            /* dst_mask */
 	 false),                /* pcrel_offset */
 
   /* 32 bit relocation, but store negative value.  */
-  HOWTO (1,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 -2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (1,	                /* type */
+	 0,	                /* rightshift */
+	 -2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_NEG",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_NEG",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,            /* src_mask */
+	 0xffffffff,            /* dst_mask */
 	 false),                /* pcrel_offset */
 
   /* 32 bit PC relative relocation.  */
-  HOWTO (2,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 true,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (2,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 true,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_REL",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_REL",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,            /* src_mask */
+	 0xffffffff,            /* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* 16 bit TOC relative relocation.  */
-  HOWTO (3,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 1,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (3,	                /* type */
+	 0,	                /* rightshift */
+	 1,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_TOC",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_TOC",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* I don't really know what this is.  */
-  HOWTO (4,	                /* type */                                 
-	 1,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (4,	                /* type */
+	 1,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RTB",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,	        /* src_mask */                             
-	 0xffffffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RTB",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,	        /* src_mask */
+	 0xffffffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* External TOC relative symbol.  */
-  HOWTO (5,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (5,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_GL",                /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_GL",                /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Local TOC relative symbol.  */
-  HOWTO (6,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (6,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_TCL",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_TCL",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   EMPTY_HOWTO (7),
-  
+
   /* Non modifiable absolute branch.  */
-  HOWTO (8,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 26,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (8,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 26,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_BA",                /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0x3fffffc,	        /* src_mask */                             
-	 0x3fffffc,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_BA",                /* name */
+	 true,	                /* partial_inplace */
+	 0x3fffffc,	        /* src_mask */
+	 0x3fffffc,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   EMPTY_HOWTO (9),
 
   /* Non modifiable relative branch.  */
-  HOWTO (0xa,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 26,	                /* bitsize */                   
-	 true,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0xa,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 26,	                /* bitsize */
+	 true,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_BR",                /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0x3fffffc,	        /* src_mask */                             
-	 0x3fffffc,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_BR",                /* name */
+	 true,	                /* partial_inplace */
+	 0x3fffffc,	        /* src_mask */
+	 0x3fffffc,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   EMPTY_HOWTO (0xb),
 
   /* Indirect load.  */
-  HOWTO (0xc,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0xc,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RL",                /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RL",                /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Load address.  */
-  HOWTO (0xd,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0xd,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RLA",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RLA",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   EMPTY_HOWTO (0xe),
-  
+
   /* Non-relocating reference.  */
-  HOWTO (0xf,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0xf,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_REF",               /* name */                                 
-	 false,	                /* partial_inplace */                      
-	 0,		        /* src_mask */                             
-	 0,     	   	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_REF",               /* name */
+	 false,	                /* partial_inplace */
+	 0,		        /* src_mask */
+	 0,     	   	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   EMPTY_HOWTO (0x10),
   EMPTY_HOWTO (0x11),
-  
+
   /* TOC relative indirect load.  */
-  HOWTO (0x12,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x12,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_TRL",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_TRL",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* TOC relative load address.  */
-  HOWTO (0x13,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x13,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_TRLA",              /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_TRLA",              /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable relative branch.  */
-  HOWTO (0x14,	                /* type */                                 
-	 1,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x14,	                /* type */
+	 1,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RRTBI",             /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,	        /* src_mask */                             
-	 0xffffffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RRTBI",             /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,	        /* src_mask */
+	 0xffffffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable absolute branch.  */
-  HOWTO (0x15,	                /* type */                                 
-	 1,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x15,	                /* type */
+	 1,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RRTBA",             /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,	        /* src_mask */                             
-	 0xffffffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RRTBA",             /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,	        /* src_mask */
+	 0xffffffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable call absolute indirect.  */
-  HOWTO (0x16,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x16,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_CAI",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_CAI",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable call relative.  */
-  HOWTO (0x17,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x17,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_CREL",              /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_CREL",              /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable branch absolute.  */
-  HOWTO (0x18,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x18,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 26,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RBA",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RBA",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable branch absolute.  */
-  HOWTO (0x19,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x19,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RBAC",              /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RBAC",              /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable branch relative.  */
-  HOWTO (0x1a,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 26,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x1a,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 26,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RBR",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RBR",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable branch absolute.  */
-  HOWTO (0x1b,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x1b,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RBRC",              /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RBRC",              /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
   HOWTO (0,                     /* type */
          0,                     /* rightshift */
@@ -783,51 +776,51 @@
 static reloc_howto_type xcoff_howto_table_16[] =
 {
   /* Standard 16 bit relocation.  */
-  HOWTO (0,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_POS_16",            /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_POS_16",            /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,            /* src_mask */
+	 0xffffffff,            /* dst_mask */
 	 false),                /* pcrel_offset */
 
   /* 16 bit relocation, but store negative value.  */
-  HOWTO (1,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 -2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (1,	                /* type */
+	 0,	                /* rightshift */
+	 -2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_NEG_16",            /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_NEG_16",            /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,            /* src_mask */
+	 0xffffffff,            /* dst_mask */
 	 false),                /* pcrel_offset */
 
   /* 16 bit PC relative relocation.  */
-  HOWTO (2,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 true,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (2,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 true,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_REL_16",            /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_REL_16",            /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,            /* src_mask */
+	 0xffffffff,            /* dst_mask */
 	 false)                /* pcrel_offset */
   };
-  
+
 void
 _bfd_xcoff_rtype2howto (relent, internal)
      arelent *relent;
@@ -836,15 +829,18 @@
   relent->howto = xcoff_howto_table + internal->r_type;
 
   if (relent->howto->bitsize != ((unsigned int) internal->r_size & 0x1f) + 1
-      && (internal->r_type 
-	  < sizeof(xcoff_howto_table_16)/sizeof(xcoff_howto_table_16[0])))
+      && (internal->r_type
+	  < sizeof (xcoff_howto_table_16)/sizeof (xcoff_howto_table_16[0])))
     relent->howto = xcoff_howto_table_16 + internal->r_type;
 
   /* The r_size field of an XCOFF reloc encodes the bitsize of the
      relocation, as well as indicating whether it is signed or not.
      Doublecheck that the relocation information gathered from the
-     type matches this information.  */
-  if (relent->howto->bitsize != ((unsigned int) internal->r_size & 0x1f) + 1)
+     type matches this information.  The bitsize is not significant
+     for R_REF relocs.  */
+  if (relent->howto->dst_mask != 0
+      && (relent->howto->bitsize
+	  != ((unsigned int) internal->r_size & 0x3f) + 1))
     abort ();
 #if 0
   if ((internal->r_size & 0x80) != 0
@@ -989,7 +985,6 @@
 
 #define SIZEOF_AR_FILE_HDR_BIG (6 * 20 + SXCOFFARMAG)
 
-
 /* Each XCOFF archive member starts with this (printable) structure.  */
 
 struct xcoff_ar_hdr
@@ -1066,7 +1061,6 @@
 
 #define SIZEOF_AR_HDR_BIG (3 * 20 + 4 * 12 + 4)
 
-
 /* We often have to distinguish between the old and big file format.
    Make it a bit cleaner.  We can use `xcoff_ardata' here because the
    `hdr' member has the same size and position in both formats.  */
@@ -1098,7 +1092,7 @@
   size_t namlen;
   bfd_size_type sz;
   bfd_byte *contents, *cend;
-  unsigned int c, i;
+  bfd_vma c, i;
   carsym *arsym;
   bfd_byte *p;
 
@@ -1133,6 +1127,33 @@
 	return false;
 
       sz = strtol (hdr.size, (char **) NULL, 10);
+
+      /* Read in the entire symbol table.  */
+      contents = (bfd_byte *) bfd_alloc (abfd, sz);
+      if (contents == NULL)
+	return false;
+      if (bfd_read ((PTR) contents, 1, sz, abfd) != sz)
+	return false;
+
+      /* The symbol table starts with a four byte count.  */
+      c = bfd_h_get_32 (abfd, contents);
+
+      if (c * 4 >= sz)
+	{
+	  bfd_set_error (bfd_error_bad_value);
+	  return false;
+	}
+
+      bfd_ardata (abfd)->symdefs = ((carsym *)
+				    bfd_alloc (abfd, c * sizeof (carsym)));
+      if (bfd_ardata (abfd)->symdefs == NULL)
+	return false;
+
+      /* After the count comes a list of four byte file offsets.  */
+      for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 4;
+	   i < c;
+	   ++i, ++arsym, p += 4)
+	arsym->file_offset = bfd_h_get_32 (abfd, p);
     }
   else
     {
@@ -1163,35 +1184,35 @@
 	 machines) since the field width is 20 and there numbers with more
 	 than 32 bits can be represented.  */
       sz = strtol (hdr.size, (char **) NULL, 10);
+
+      /* Read in the entire symbol table.  */
+      contents = (bfd_byte *) bfd_alloc (abfd, sz);
+      if (contents == NULL)
+	return false;
+      if (bfd_read ((PTR) contents, 1, sz, abfd) != sz)
+	return false;
+
+      /* The symbol table starts with an eight byte count.  */
+      c = bfd_h_get_64 (abfd, contents);
+
+      if (c * 8 >= sz)
+	{
+	  bfd_set_error (bfd_error_bad_value);
+	  return false;
+	}
+
+      bfd_ardata (abfd)->symdefs = ((carsym *)
+				    bfd_alloc (abfd, c * sizeof (carsym)));
+      if (bfd_ardata (abfd)->symdefs == NULL)
+	return false;
+
+      /* After the count comes a list of eight byte file offsets.  */
+      for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 8;
+	   i < c;
+	   ++i, ++arsym, p += 8)
+	arsym->file_offset = bfd_h_get_64 (abfd, p);
     }
 
-  /* Read in the entire symbol table.  */
-  contents = (bfd_byte *) bfd_alloc (abfd, sz);
-  if (contents == NULL)
-    return false;
-  if (bfd_read ((PTR) contents, 1, sz, abfd) != sz)
-    return false;
-
-  /* The symbol table starts with a four byte count.  */
-  c = bfd_h_get_32 (abfd, contents);
-
-  if (c * 4 >= sz)
-    {
-      bfd_set_error (bfd_error_bad_value);
-      return false;
-    }
-
-  bfd_ardata (abfd)->symdefs = ((carsym *)
-				bfd_alloc (abfd, c * sizeof (carsym)));
-  if (bfd_ardata (abfd)->symdefs == NULL)
-    return false;
-
-  /* After the count comes a list of four byte file offsets.  */
-  for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 4;
-       i < c;
-       ++i, ++arsym, p += 4)
-    arsym->file_offset = bfd_h_get_32 (abfd, p);
-
   /* After the file offsets come null terminated symbol names.  */
   cend = contents + sz;
   for (i = 0, arsym = bfd_ardata (abfd)->symdefs;
@@ -1521,7 +1542,6 @@
 
 /* Write out an XCOFF armap.  */
 
-/*ARGSUSED*/
 static boolean
 xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
      bfd *abfd;
@@ -1607,29 +1627,39 @@
   return true;
 }
 
-/*ARGSUSED*/
+/* Write a single armap in the big format.  */
 static boolean
-xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
+xcoff_write_one_armap_big (abfd, map, orl_count, orl_ccount, stridx, bits64,
+			   prevoff, nextoff)
      bfd *abfd;
-     unsigned int elength ATTRIBUTE_UNUSED;
      struct orl *map;
      unsigned int orl_count;
-     int stridx;
+     unsigned int orl_ccount;
+     unsigned int stridx;
+     int bits64;
+     const char *prevoff;
+     char *nextoff;
 {
   struct xcoff_ar_hdr_big hdr;
   char *p;
   unsigned char buf[4];
+  const bfd_arch_info_type *arch_info = NULL;
   bfd *sub;
   file_ptr fileoff;
+  bfd *object_bfd;
   unsigned int i;
 
   memset (&hdr, 0, sizeof hdr);
   /* XXX This call actually should use %lld (at least on 32-bit
      machines) since the fields's width is 20 and there numbers with
      more than 32 bits can be represented.  */
-  sprintf (hdr.size, "%ld", (long) (4 + orl_count * 4 + stridx));
-  sprintf (hdr.nextoff, "%d", 0);
-  memcpy (hdr.prevoff, xcoff_ardata (abfd)->memoff, 12);
+  sprintf (hdr.size, "%ld", (long) (4 + orl_ccount * 4 + stridx));
+  if (bits64)
+    sprintf (hdr.nextoff, "%d", 0);
+  else
+    sprintf (hdr.nextoff, "%ld", (strtol (prevoff, (char **) NULL, 10)
+				 + 4 + orl_ccount * 4 + stridx));
+  memcpy (hdr.prevoff, prevoff, sizeof (hdr.prevoff));
   sprintf (hdr.date, "%d", 0);
   sprintf (hdr.uid, "%d", 0);
   sprintf (hdr.gid, "%d", 0);
@@ -1641,11 +1671,13 @@
     if (*p == '\0')
       *p = ' ';
 
+  memcpy (nextoff, hdr.nextoff, sizeof (hdr.nextoff));
+
   if (bfd_write ((PTR) &hdr, SIZEOF_AR_HDR_BIG, 1, abfd) != SIZEOF_AR_HDR_BIG
       || bfd_write (XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) != SXCOFFARFMAG)
     return false;
 
-  bfd_h_put_32 (abfd, orl_count, buf);
+  bfd_h_put_32 (abfd, orl_ccount, buf);
   if (bfd_write (buf, 1, 4, abfd) != 4)
     return false;
 
@@ -1656,13 +1688,18 @@
     {
       size_t namlen;
 
-      while (((bfd *) (map[i]).pos) == sub)
-	{
-	  bfd_h_put_32 (abfd, fileoff, buf);
-	  if (bfd_write (buf, 1, 4, abfd) != 4)
-	    return false;
-	  ++i;
-	}
+      if ((bfd_arch_bits_per_address ((bfd *) map[i].pos) == 64) == bits64)
+	while (((bfd *) (map[i]).pos) == sub)
+	  {
+	    bfd_h_put_32 (abfd, fileoff, buf);
+	    if (bfd_write (buf, 1, 4, abfd) != 4)
+	      return false;
+	    i++;
+	  }
+      else
+	while (((bfd *) (map[i]).pos) == sub)
+	  i++;
+
       namlen = strlen (normalize_filename (sub));
       namlen = (namlen + 1) &~ 1;
       fileoff += (SIZEOF_AR_HDR_BIG
@@ -1673,10 +1710,18 @@
       sub = sub->next;
     }
 
+  object_bfd = NULL;
   for (i = 0; i < orl_count; i++)
     {
       const char *name;
       size_t namlen;
+      bfd *ob = (bfd *)map[i].pos;
+
+      if (ob != object_bfd)
+	arch_info = bfd_get_arch_info (ob);
+
+      if (arch_info && (arch_info->bits_per_address == 64) != bits64)
+	continue;
 
       name = *map[i].name;
       namlen = strlen (name);
@@ -1696,7 +1741,65 @@
   return true;
 }
 
-/*ARGSUSED*/
+static boolean
+xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
+     bfd *abfd;
+     unsigned int elength ATTRIBUTE_UNUSED;
+     struct orl *map;
+     unsigned int orl_count;
+     int stridx;
+{
+  unsigned int i;
+  unsigned int orl_count_32, orl_count_64;
+  unsigned int stridx_32, stridx_64;
+  const bfd_arch_info_type *arch_info = NULL;
+  bfd *object_bfd;
+
+  /* First, we look through the symbols and work out which are
+     from 32-bit objects and which from 64-bit ones.  */
+  orl_count_32 = 0;
+  orl_count_64 = 0;
+  stridx_32 = 0;
+  stridx_64 = 0;
+  object_bfd = NULL;
+  for (i = 0; i < orl_count; i++)
+    {
+      bfd *ob = (bfd *)map[i].pos;
+      unsigned int len;
+      if (ob != object_bfd)
+	arch_info = bfd_get_arch_info (ob);
+      len = strlen (*map[i].name) + 1;
+      if (arch_info && arch_info->bits_per_address == 64)
+	{
+	  orl_count_64++;
+	  stridx_64 += len;
+	}
+      else
+	{
+	  orl_count_32++;
+	  stridx_32 += len;
+	}
+      object_bfd = ob;
+    }
+  /* A quick sanity check...  */
+  BFD_ASSERT (orl_count_64 + orl_count_32 == orl_count);
+  BFD_ASSERT (stridx_64 + stridx_32 == stridx);
+
+  /* Now write out each map.  */
+  if (! xcoff_write_one_armap_big (abfd, map, orl_count, orl_count_32,
+				   stridx_32, false,
+				   xcoff_ardata_big (abfd)->memoff,
+				   xcoff_ardata_big (abfd)->symoff))
+    return false;
+  if (! xcoff_write_one_armap_big (abfd, map, orl_count, orl_count_64,
+				   stridx_64, true,
+				   xcoff_ardata_big (abfd)->symoff,
+				   xcoff_ardata_big (abfd)->symoff64))
+    return false;
+
+  return true;
+}
+
 boolean
 _bfd_xcoff_write_armap (abfd, elength, map, orl_count, stridx)
      bfd *abfd;
@@ -2207,7 +2310,6 @@
       /* XXX This call actually should use %lld (at least on 32-bit
 	 machines) since the fields's width is 20 and there numbers with
 	 more than 32 bits can be represented.  */
-      sprintf (fhdr.symoff, "%ld", (long) nextoff);
       bfd_ardata (abfd)->tdata = (PTR) &fhdr;
       if (! _bfd_compute_and_write_armap (abfd, 0))
 	return false;
@@ -2241,7 +2343,6 @@
 /* We can't use the usual coff_sizeof_headers routine, because AIX
    always uses an a.out header.  */
 
-/*ARGSUSED*/
 int
 _bfd_xcoff_sizeof_headers (abfd, reloc)
      bfd *abfd;
@@ -2257,5 +2358,3 @@
   size += abfd->section_count * SCNHSZ;
   return size;
 }
-
-
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index 1b78ef4..77665d6 100644
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -31,7 +31,7 @@
 #include "coff/pe.h"
 
 #ifndef COFF_IMAGE_WITH_PE
-static boolean sh_align_load_span 
+static boolean sh_align_load_span
   PARAMS ((bfd *, asection *, bfd_byte *,
 	   boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma),
 	   PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, boolean *));
@@ -88,7 +88,7 @@
      reloc_howto_type * howto;
 {
   return ! howto->pc_relative && howto->type != R_SH_IMAGEBASE;
-}     
+}
 #endif
 
 /* The supported relocations.  There are a lot of relocations defined
@@ -171,18 +171,18 @@
 
   EMPTY_HOWTO (15),
 #ifdef COFF_WITH_PE
-  HOWTO (R_SH_IMAGEBASE,        /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (R_SH_IMAGEBASE,        /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 sh_reloc,       	/* special_function */                     
-	 "rva32",	        /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
+	 sh_reloc,       	/* special_function */
+	 "rva32",	        /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,            /* src_mask */
+	 0xffffffff,            /* dst_mask */
 	 false),                /* pcrel_offset */
 #else
   EMPTY_HOWTO (16), /* R_SH_IMM8 */
@@ -391,14 +391,14 @@
 /* Get the value of a symbol, when performing a relocation.  */
 
 static long
-get_symbol_value (symbol)       
+get_symbol_value (symbol)
      asymbol *symbol;
-{                                             
+{
   bfd_vma relocation;
 
   if (bfd_is_com_section (symbol->section))
-    relocation = 0;                           
-  else 
+    relocation = 0;
+  else
     relocation = (symbol->value +
 		  symbol->section->output_section->vma +
 		  symbol->section->output_offset);
@@ -676,7 +676,7 @@
    align load and store instructions on four byte boundaries if we
    can, by swapping them with one of the adjacent instructions.  */
 
-static boolean 
+static boolean
 sh_relax_section (abfd, sec, link_info, again)
      bfd *abfd;
      asection *sec;
@@ -2144,7 +2144,7 @@
 	  return op;
     }
 
-  return NULL;  
+  return NULL;
 }
 
 /* See whether an instruction uses or sets a general purpose register */
@@ -2251,7 +2251,7 @@
      of a double precision value.
      So what this all boils down to is that we have to ignore the lowest
      bit of the register number.  */
-     
+
   if ((f & USESF1) != 0
       && (USESF1_REG (insn) & 0xe) == (freg & 0xe))
     return true;
@@ -2285,7 +2285,7 @@
      of a double precision value.
      So what this all boils down to is that we have to ignore the lowest
      bit of the register number.  */
-     
+
   if ((f & SETSF1) != 0
       && (SETSF1_REG (insn) & 0xe) == (freg & 0xe))
     return true;
@@ -2485,7 +2485,7 @@
 	  if (dsp && i - 2 > start)
 	    {
 	      unsigned pprev_insn = bfd_get_16 (abfd, contents + i - 4);
-	
+
 	      if ((pprev_insn & 0xfc00) == 0xf800)
 		prev_op = NULL;
 	      else
@@ -2875,7 +2875,7 @@
 	  sym = NULL;
 	}
       else
-	{    
+	{
 	  if (symndx < 0
 	      || (unsigned long) symndx >= obj_raw_syment_count (input_bfd))
 	    {
@@ -2912,7 +2912,7 @@
       if (rel->r_type == R_SH_IMAGEBASE)
 	addend -= pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase;
 #endif
-      
+
       val = 0;
 
       if (h == NULL)
@@ -3118,7 +3118,7 @@
 #else
 #define TARGET_SYM shlcoff_vec
 #endif
-     
+
 #ifndef TARGET_SHL_NAME
 #define TARGET_SHL_NAME "coff-shl"
 #endif
@@ -3270,7 +3270,7 @@
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   & shlcoff_small_vec,
-  
+
   (PTR) &bfd_coff_small_swap_table
 };
 
@@ -3297,7 +3297,7 @@
   bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
 
   {_bfd_dummy_target, coff_small_object_p, /* bfd_check_format */
-     bfd_generic_archive_p, _bfd_dummy_target},   
+     bfd_generic_archive_p, _bfd_dummy_target},
   {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
      bfd_false},
   {bfd_false, coff_write_object_contents, /* bfd_write_contents */
@@ -3314,7 +3314,7 @@
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   & shcoff_small_vec,
-  
+
   (PTR) &bfd_coff_small_swap_table
 };
 #endif
diff --git a/bfd/coff-sparc.c b/bfd/coff-sparc.c
index 5e919da..9367770 100644
--- a/bfd/coff-sparc.c
+++ b/bfd/coff-sparc.c
@@ -36,8 +36,8 @@
 enum reloc_type
   {
     R_SPARC_NONE = 0,
-    R_SPARC_8,		R_SPARC_16,		R_SPARC_32, 
-    R_SPARC_DISP8,	R_SPARC_DISP16,		R_SPARC_DISP32, 
+    R_SPARC_8,		R_SPARC_16,		R_SPARC_32,
+    R_SPARC_DISP8,	R_SPARC_DISP16,		R_SPARC_DISP32,
     R_SPARC_WDISP30,	R_SPARC_WDISP22,
     R_SPARC_HI22,	R_SPARC_22,
     R_SPARC_13,		R_SPARC_LO10,
@@ -96,7 +96,7 @@
   return bfd_reloc_continue;
 }
 
-static reloc_howto_type coff_sparc_howto_table[] = 
+static reloc_howto_type coff_sparc_howto_table[] =
 {
   HOWTO(R_SPARC_NONE,    0,0, 0,false,0,complain_overflow_dont,    bfd_coff_generic_reloc,"R_SPARC_NONE",    false,0,0x00000000,true),
   HOWTO(R_SPARC_8,       0,0, 8,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_8",       false,0,0x000000ff,true),
@@ -197,7 +197,7 @@
 
 #define __A_MAGIC_SET__
 
-/* Enable Sparc-specific hacks in coffcode.h. */
+/* Enable Sparc-specific hacks in coffcode.h.  */
 
 #define COFF_SPARC
 
diff --git a/bfd/coff-stgo32.c b/bfd/coff-stgo32.c
index 45e7d62..95ccd83 100644
--- a/bfd/coff-stgo32.c
+++ b/bfd/coff-stgo32.c
@@ -111,7 +111,7 @@
 
 /* This macro is used, because I cannot assume the endianess of the
    host system */
-#define _H(index) (bfd_h_get_16(abfd, (bfd_byte *)(header+index*2)))
+#define _H(index) (bfd_h_get_16(abfd, (bfd_byte *) (header+index*2)))
 
 /* These bytes are a 2048-byte DOS executable, which loads the COFF
    image into memory and then runs it. It is called 'stub' */
diff --git a/bfd/coff-tic30.c b/bfd/coff-tic30.c
index a971f76..267ca97 100644
--- a/bfd/coff-tic30.c
+++ b/bfd/coff-tic30.c
@@ -49,7 +49,7 @@
 
 /* For the case statement use the code values used in tc_gen_reloc to
    map to the howto table entries that match those in both the aout
-   and coff implementations. */
+   and coff implementations.  */
 reloc_howto_type *
 tic30_coff_reloc_type_lookup (abfd, code)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -86,7 +86,6 @@
 
 #define SELECT_RELOC(x,howto) x.r_type = coff_tic30_select_reloc(howto)
 
-
 #define BADMAG(x) TIC30BADMAG(x)
 #define TIC30 1			/* Customize coffcode.h */
 #define __A_MAGIC_SET__
@@ -97,7 +96,7 @@
 #define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) dst->r_stuff[0] = 'S'; \
 dst->r_stuff[1] = 'C';
 
-/* Code to turn a r_type into a howto ptr, uses the above howto table. */
+/* Code to turn a r_type into a howto ptr, uses the above howto table.  */
 
 static void
 rtype2howto (internal, dst)
@@ -134,7 +133,6 @@
 #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
  cache_ptr->addend =  ext_reloc.r_offset;
 
-
 #define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
  reloc_processing(relent, reloc, symbols, abfd, section)
 
@@ -203,6 +201,6 @@
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   NULL,
-  
+
   COFF_SWAP_TABLE
 };
diff --git a/bfd/coff-tic54x.c b/bfd/coff-tic54x.c
index 4ae62e3..6a3aef1 100644
--- a/bfd/coff-tic54x.c
+++ b/bfd/coff-tic54x.c
@@ -56,9 +56,9 @@
      register bfd_byte *addr;
 {
   addr[2] = (bfd_byte)data;
-  addr[3] = (bfd_byte)(data >>  8);
-  addr[0] = (bfd_byte)(data >> 16);
-  addr[1] = (bfd_byte)(data >> 24);
+  addr[3] = (bfd_byte) (data >>  8);
+  addr[0] = (bfd_byte) (data >> 16);
+  addr[1] = (bfd_byte) (data >> 24);
 }
 
 bfd_signed_vma
@@ -79,7 +79,7 @@
 #define coff_get_section_load_page bfd_ticoff_get_section_load_page
 #define coff_set_section_load_page bfd_ticoff_set_section_load_page
 
-void 
+void
 bfd_ticoff_set_section_load_page (sect, page)
   asection *sect;
   int page;
@@ -87,14 +87,13 @@
   sect->lma = (sect->lma & ADDR_MASK) | PG_TO_FLAG(page);
 }
 
-
 int
 bfd_ticoff_get_section_load_page (sect)
   asection *sect;
 {
   int page;
 
-  /* Provide meaningful defaults for predefined sections. */
+  /* Provide meaningful defaults for predefined sections.  */
   if (sect == &bfd_com_section)
     page = PG_DATA;
 
@@ -110,7 +109,7 @@
 }
 
 /* Set the architecture appropriately.  Allow unkown architectures
-   (e.g. binary). */ 
+   (e.g. binary).  */
 static boolean
 tic54x_set_arch_mach (abfd, arch, machine)
      bfd *abfd;
@@ -127,7 +126,7 @@
 }
 
 static bfd_reloc_status_type
-tic54x_relocation (abfd, reloc_entry, symbol, data, input_section, 
+tic54x_relocation (abfd, reloc_entry, symbol, data, input_section,
                    output_bfd, error_message)
   bfd *abfd ATTRIBUTE_UNUSED;
   arelent *reloc_entry;
@@ -137,7 +136,7 @@
   bfd *output_bfd;
   char **error_message ATTRIBUTE_UNUSED;
 {
-  
+
   if (output_bfd != (bfd *) NULL)
     {
       /* This is a partial relocation, and we want to apply the
@@ -157,7 +156,7 @@
 
   /* NORMAL BANK */
   /* 16-bit direct reference to symbol's address */
-  HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont,    
+  HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont,
          tic54x_relocation,"REL16",false,0xFFFF,0xFFFF,false),
 
   /* 7 LSBs of an address */
@@ -183,7 +182,7 @@
 
   /* ABSOLUTE BANK */
   /* 16-bit direct reference to symbol's address, absolute */
-  HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont,    
+  HOWTO (R_RELWORD,0,1,16,false,0,complain_overflow_dont,
          tic54x_relocation,"AREL16",false,0xFFFF,0xFFFF,false),
 
   /* 7 LSBs of an address, absolute */
@@ -243,7 +242,7 @@
     }
 }
 
-/* Code to turn a r_type into a howto ptr, uses the above howto table. 
+/* Code to turn a r_type into a howto ptr, uses the above howto table.
    Called after some initial checking by the tic54x_rtype_to_howto fn below */
 static void
 tic54x_lookup_howto (internal, dst)
@@ -263,7 +262,7 @@
 
   (*_bfd_error_handler) (_("Unrecognized reloc type 0x%x"),
 			 (unsigned int) dst->r_type);
-  abort();
+  abort ();
 }
 
 #define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\
@@ -288,7 +287,7 @@
     {
       /* This is a TI "internal relocation", which means that the relocation
 	 amount is the amount by which the current section is being relocated
-	 in the output section. */
+	 in the output section.  */
       *addendp = (sec->output_section->vma + sec->output_offset) - sec->vma;
     }
 
@@ -325,7 +324,7 @@
 
 /* replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local
    labels */
-static boolean 
+static boolean
 ticoff_bfd_is_local_label_name (abfd, name)
   bfd *abfd ATTRIBUTE_UNUSED;
   const char *name;
@@ -337,11 +336,11 @@
 
 #define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name
 
-/* Customize coffcode.h; the default coff_ functions are set up to use COFF2; 
+/* Customize coffcode.h; the default coff_ functions are set up to use COFF2;
    coff_bad_format_hook uses BADMAG, so set that for COFF2.  The COFF1
    and COFF0 vectors use custom _bad_format_hook procs instead of setting
-   BADMAG. 
- */ 
+   BADMAG.
+ */
 #define BADMAG(x) COFF2_BADMAG(x)
 #include "coffcode.h"
 
@@ -353,7 +352,7 @@
      file_ptr offset;
      bfd_size_type bytes_to_do;
 {
-  return coff_set_section_contents (abfd, section, location, 
+  return coff_set_section_contents (abfd, section, location,
                                     offset, bytes_to_do);
 }
 
@@ -368,7 +367,7 @@
   asymbol *ptr;
 
   relent->address = reloc->r_vaddr;
-  
+
   if (reloc->r_symndx != -1)
     {
       if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd))
@@ -391,26 +390,26 @@
       relent->sym_ptr_ptr = section->symbol_ptr_ptr;
       ptr = *(relent->sym_ptr_ptr);
     }
-  
+
   /* The symbols definitions that we have read in have been
      relocated as if their sections started at 0. But the offsets
      refering to the symbols in the raw data have not been
      modified, so we have to have a negative addend to compensate.
-     
+
      Note that symbols which used to be common must be left alone */
-  
+
   /* Calculate any reloc addend by looking at the symbol */
   CALC_ADDEND (abfd, ptr, *reloc, relent);
-  
+
   relent->address -= section->vma;
   /* !!     relent->section = (asection *) NULL;*/
-  
+
   /* Fill in the relent->howto field from reloc->r_type */
   tic54x_lookup_howto (relent, reloc);
 }
 
 /* COFF0 differs in file/section header size and relocation entry size */
-static CONST bfd_coff_backend_data ticoff0_swap_table = 
+static CONST bfd_coff_backend_data ticoff0_swap_table =
 {
   coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
   coff_SWAP_aux_out, coff_SWAP_sym_out,
@@ -451,7 +450,7 @@
 };
 
 /* COFF1 differs in section header size */
-static CONST bfd_coff_backend_data ticoff1_swap_table = 
+static CONST bfd_coff_backend_data ticoff1_swap_table =
 {
   coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
   coff_SWAP_aux_out, coff_SWAP_sym_out,
@@ -491,7 +490,6 @@
   coff_link_output_has_begun, coff_final_link_postscript
 };
 
-
 /* TI COFF v0, DOS tools (little-endian headers) */
 const bfd_target tic54x_coff0_vec =
 {
diff --git a/bfd/coff-tic80.c b/bfd/coff-tic80.c
index a8ade33..934603c 100644
--- a/bfd/coff-tic80.c
+++ b/bfd/coff-tic80.c
@@ -424,7 +424,7 @@
 
 /* Code to turn an external r_type into a pointer to an entry in the howto_table.
    If passed an r_type we don't recognize the abort rather than silently failing
-   to generate an output file. */
+   to generate an output file.  */
 
 static void
 rtype2howto (cache_ptr, dst)
@@ -465,7 +465,7 @@
     {
       /* This is a TI "internal relocation", which means that the relocation
 	 amount is the amount by which the current section is being relocated
-	 in the output section. */
+	 in the output section.  */
       *addendp = (sec -> output_section -> vma + sec -> output_offset) - sec -> vma;
     }
   RTYPE2HOWTO (&genrel, rel);
@@ -518,7 +518,7 @@
 	  sym = NULL;
 	}
       else
-	{    
+	{
 	  h = obj_coff_sym_hashes (input_bfd)[symndx];
 	  sym = syms + symndx;
 	}
@@ -649,7 +649,7 @@
 	    contents[addr + 1] |= hold & 0x80;
 	    break;
 	  }
-	
+
 	case R_PPBASE:
 	  /* Parameter RAM is from 0x1000000 to 0x1000800.  */
 	  contents[addr] &=~ 0x3;
diff --git a/bfd/coff-w65.c b/bfd/coff-w65.c
index 0379bfb..787f4db 100644
--- a/bfd/coff-w65.c
+++ b/bfd/coff-w65.c
@@ -42,7 +42,6 @@
 
 };
 
-
 /* Turn a howto into a reloc number */
 
 #define SELECT_RELOC(x,howto) \
@@ -52,7 +51,6 @@
 #define W65 1			/* Customize coffcode.h */
 #define __A_MAGIC_SET__
 
-
 /* Code to swap in the reloc */
 #define SWAP_IN_RELOC_OFFSET   bfd_h_get_32
 #define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
@@ -60,7 +58,6 @@
   dst->r_stuff[0] = 'S'; \
   dst->r_stuff[1] = 'C';
 
-
 static int
 select_reloc (howto)
      reloc_howto_type *howto;
@@ -81,14 +78,11 @@
 
 #define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
 
-
 /* Perform any necessary magic to the addend in a reloc entry */
 
-
 #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
  cache_ptr->addend =  ext_reloc.r_offset;
 
-
 #define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
  reloc_processing(relent, reloc, symbols, abfd, section)
 
@@ -112,15 +106,12 @@
       relent->sym_ptr_ptr = (asymbol **)&(bfd_abs_symbol);
     }
 
-
-
   relent->addend = reloc->r_offset;
 
   relent->address -= section->vma;
   /*  relent->section = 0;*/
 }
 
-
 static int
 h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
      bfd *abfd;
@@ -129,11 +120,11 @@
      unsigned int shrink;
      struct bfd_link_info *link_info;
 {
-  bfd_vma value;  
+  bfd_vma value;
   bfd_vma dot;
   bfd_vma gap;
 
-  /* The address of the thing to be relocated will have moved back by 
+  /* The address of the thing to be relocated will have moved back by
    the size of the shrink  - but we don't change reloc->address here,
    since we need it to know where the relocation lives in the source
    uncooked section */
@@ -141,10 +132,9 @@
   /*  reloc->address -= shrink;   conceptual */
 
   bfd_vma address = reloc->address - shrink;
-  
 
   switch (reloc->howto->type)
-    {     
+    {
     case R_MOV16B2:
     case R_JMP2:
       shrink+=2;
@@ -155,40 +145,40 @@
       value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
 
       if (value >= 0xff00)
-	{ 
+	{
 
 	  /* Change the reloc type from 16bit, possible 8 to 8bit
 	     possible 16 */
-	  reloc->howto = reloc->howto + 1;	  
+	  reloc->howto = reloc->howto + 1;
 	  /* The place to relc moves back by one */
 	  /* This will be two bytes smaller in the long run */
 	  shrink +=2 ;
 	  bfd_perform_slip(abfd, 2, input_section, address);
-	}      
+	}
 
       break;
-      /* This is the 24 bit branch which could become an 8 bitter, 
+      /* This is the 24 bit branch which could become an 8 bitter,
        the relocation points to the first byte of the insn, not the
        actual data */
 
     case R_JMPL1:
       value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
-	
+
       dot = input_section->output_section->vma +
 	input_section->output_offset + address;
-  
+
       /* See if the address we're looking at within 127 bytes of where
 	 we are, if so then we can use a small branch rather than the
 	 jump we were going to */
 
       gap = value - dot ;
-  
+
       if (-120 < (long)gap && (long)gap < 120 )
-	{ 
+	{
 
 	  /* Change the reloc type from 24bit, possible 8 to 8bit
 	     possible 32 */
-	  reloc->howto = reloc->howto + 1;	  
+	  reloc->howto = reloc->howto + 1;
 	  /* This will be two bytes smaller in the long run */
 	  shrink +=2 ;
 	  bfd_perform_slip(abfd, 2, input_section, address);
@@ -198,23 +188,22 @@
     case R_JMP1:
 
       value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
-	
+
       dot = input_section->output_section->vma +
 	input_section->output_offset + address;
-  
+
       /* See if the address we're looking at within 127 bytes of where
 	 we are, if so then we can use a small branch rather than the
 	 jump we were going to */
 
       gap = value - (dot - shrink);
-  
 
       if (-120 < (long)gap && (long)gap < 120 )
-	{ 
+	{
 
 	  /* Change the reloc type from 16bit, possible 8 to 8bit
 	     possible 16 */
-	  reloc->howto = reloc->howto + 1;	  
+	  reloc->howto = reloc->howto + 1;
 	  /* The place to relc moves back by one */
 
 	  /* This will be two bytes smaller in the long run */
@@ -224,11 +213,9 @@
       break;
     }
 
-  
   return shrink;
 }
 
-
 /* First phase of a relaxing link */
 
 /* Reloc types
@@ -336,8 +323,8 @@
       {
 	int gap = bfd_coff_reloc16_get_value (reloc, link_info,
 					      input_section);
-	bfd_vma dot = link_order->offset 
-	  + dst_address 
+	bfd_vma dot = link_order->offset
+	  + dst_address
 	    + link_order->u.indirect.section->output_section->vma;
 
 	gap -= dot + 1;
@@ -346,7 +333,7 @@
 		 (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
 		  reloc->howto->name, reloc->addend, input_section->owner,
 		  input_section, reloc->address)))
-	    abort();
+	    abort ();
 	}
 	bfd_put_8 (abfd, gap, data + dst_address);
 	dst_address += 1;
@@ -358,11 +345,10 @@
       {
 	bfd_vma gap = bfd_coff_reloc16_get_value (reloc, link_info,
 						  input_section);
-	bfd_vma dot = link_order->offset 
-	  + dst_address 
+	bfd_vma dot = link_order->offset
+	  + dst_address
 	    + link_order->u.indirect.section->output_section->vma;
 
-
 	/* This wraps within the page, so ignore the relativeness, look at the
 	   high part */
 	if ((gap & 0xf0000) != (dot & 0xf0000)) {
@@ -370,7 +356,7 @@
 		 (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
 		  reloc->howto->name, reloc->addend, input_section->owner,
 		  input_section, reloc->address)))
-	    abort();
+	    abort ();
 	}
 
 	gap -= dot + 2;
@@ -380,7 +366,7 @@
       }
       break;
     default:
-      printf(_("ignoring reloc %s\n"), reloc->howto->name);
+      printf (_("ignoring reloc %s\n"), reloc->howto->name);
       break;
 
     }
@@ -394,11 +380,10 @@
 
 #include "coffcode.h"
 
-
 #undef coff_bfd_get_relocated_section_contents
 #undef coff_bfd_relax_section
 #define coff_bfd_get_relocated_section_contents \
   bfd_coff_reloc16_get_relocated_section_contents
 #define coff_bfd_relax_section bfd_coff_reloc16_relax_section
 
-CREATE_LITTLE_COFF_TARGET_VEC (w65_vec, "coff-w95", BFD_IS_RELAXABLE, 0, '_', NULL)
+CREATE_LITTLE_COFF_TARGET_VEC (w65_vec, "coff-w65", BFD_IS_RELAXABLE, 0, '_', NULL)
diff --git a/bfd/coff-we32k.c b/bfd/coff-we32k.c
index c559ad7..8d3fa5d 100644
--- a/bfd/coff-we32k.c
+++ b/bfd/coff-we32k.c
@@ -27,7 +27,7 @@
 
 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
 
-static reloc_howto_type howto_table[] = 
+static reloc_howto_type howto_table[] =
 {
     EMPTY_HOWTO (0),
     EMPTY_HOWTO (1),
diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c
index 21f29a8..7ad0630 100644
--- a/bfd/coff-z8k.c
+++ b/bfd/coff-z8k.c
@@ -54,7 +54,7 @@
 
 /* Turn a howto into a reloc number */
 
-static int 
+static int
 coff_z8k_select_reloc (howto)
      reloc_howto_type *howto;
 {
@@ -63,13 +63,10 @@
 
 #define SELECT_RELOC(x,howto) x.r_type = coff_z8k_select_reloc(howto)
 
-
 #define BADMAG(x) Z8KBADMAG(x)
 #define Z8K 1			/* Customize coffcode.h */
 #define __A_MAGIC_SET__
 
-
-
 /* Code to swap in the reloc */
 #define SWAP_IN_RELOC_OFFSET   bfd_h_get_32
 #define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
@@ -110,18 +107,15 @@
 
 #define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
 
-
 /* Perform any necessary magic to the addend in a reloc entry */
 
-
 #define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
  cache_ptr->addend =  ext_reloc.r_offset;
 
-
 #define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
  reloc_processing(relent, reloc, symbols, abfd, section)
 
-static void 
+static void
 reloc_processing (relent, reloc, symbols, abfd, section)
      arelent * relent;
      struct internal_reloc *reloc;
@@ -141,7 +135,6 @@
       relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
     }
 
-
   relent->addend = reloc->r_offset;
   relent->address -= section->vma;
 }
@@ -178,7 +171,7 @@
 
     case R_IMM4L:
       bfd_put_8 (in_abfd,
-		 ((bfd_get_8 (in_abfd, data + *dst_ptr) & 0xf0) 
+		 ((bfd_get_8 (in_abfd, data + *dst_ptr) & 0xf0)
 		  | (0x0f
 		     & bfd_coff_reloc16_get_value (reloc, link_info,
 						   input_section))),
@@ -230,7 +223,6 @@
 
 #include "coffcode.h"
 
-
 #undef  coff_bfd_get_relocated_section_contents
 #undef coff_bfd_relax_section
 #define coff_bfd_get_relocated_section_contents \
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index 8e5c501..913b2f7 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -21,7 +21,7 @@
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* Internalcoff.h and coffcode.h modify themselves based on these flags.  */
-#define XCOFF64 
+#define XCOFF64
 #define RS6000COFF_C 1
 
 #include "bfd.h"
@@ -31,7 +31,6 @@
 #include "coff/rs6k64.h"
 #include "libcoff.h"
 
-
 #define GET_FILEHDR_SYMPTR bfd_h_get_64
 #define PUT_FILEHDR_SYMPTR bfd_h_put_64
 #define GET_AOUTHDR_DATA_START bfd_h_get_64
@@ -70,11 +69,10 @@
 #define COFF_FORCE_SYMBOLS_IN_STRINGS
 #define COFF_DEBUG_STRING_WIDE_PREFIX
 
-
 #define COFF_ADJUST_SCNHDR_OUT_POST(ABFD,INT,EXT) \
 do { \
   memset (((SCNHDR *)EXT)->s_pad, 0, sizeof (((SCNHDR *)EXT)->s_pad));\
-} while(0)
+} while (0)
 
 #define NO_COFF_LINENOS
 
@@ -88,8 +86,7 @@
 #define GETHALF bfd_h_get_16
 #define GETBYTE bfd_h_get_8
 
-
-/* For XCOFF64, the effective width of symndx changes depending on 
+/* For XCOFF64, the effective width of symndx changes depending on
    whether we are the first entry.  Sigh.  */
 static void
 xcoff64_swap_lineno_in (abfd, ext1, in1)
@@ -102,10 +99,10 @@
 
   in->l_lnno = bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno));
   if (in->l_lnno == 0)
-    in->l_addr.l_symndx = 
+    in->l_addr.l_symndx =
 	    bfd_h_get_32(abfd, (bfd_byte *) ext->l_addr.l_symndx);
   else
-    in->l_addr.l_symndx = 
+    in->l_addr.l_symndx =
 	    bfd_h_get_64(abfd, (bfd_byte *) ext->l_addr.l_symndx);
 }
 
@@ -129,7 +126,6 @@
   return bfd_coff_linesz (abfd);
 }
 
-
 static void xcoff64_swap_sym_in PARAMS ((bfd *, PTR, PTR));
 static unsigned int xcoff64_swap_sym_out PARAMS ((bfd *, PTR, PTR));
 static void xcoff64_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
@@ -144,10 +140,9 @@
   SYMENT *ext = (SYMENT *)ext1;
   struct internal_syment      *in = (struct internal_syment *)in1;
 
-
   in->_n._n_n._n_zeroes = 0;
   in->_n._n_n._n_offset = bfd_h_get_32(abfd, (bfd_byte *) ext->e_offset);
-  in->n_value = bfd_h_get_64(abfd, (bfd_byte *) ext->e.e_value); 
+  in->n_value = bfd_h_get_64(abfd, (bfd_byte *) ext->e.e_value);
   in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum);
   in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type);
   in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass);
@@ -189,7 +184,7 @@
     case C_FILE:
       if (ext->x_file.x_fname[0] == 0) {
 	  in->x_file.x_n.x_zeroes = 0;
-	  in->x_file.x_n.x_offset = 
+	  in->x_file.x_n.x_offset =
 	   bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
 	} else {
 	    if (numaux > 1)
@@ -210,9 +205,9 @@
     case C_HIDEXT:
       if (indx + 1 == numaux)
 	{
-	  in->x_csect.x_scnlen.l = 
+	  in->x_csect.x_scnlen.l =
 	      bfd_h_get_32(abfd, ext->x_csect.x_scnlen_lo);
-	  /* FIXME: If we want section lengths larger than 32 bits, we need 
+	  /* FIXME: If we want section lengths larger than 32 bits, we need
 	     to modify the internal coff structures to support it.  */
 	  in->x_csect.x_parmhash = bfd_h_get_32 (abfd,
 						 ext->x_csect.x_parmhash);
@@ -260,12 +255,10 @@
 
 end: ;
   /* the semicolon is because MSVC doesn't like labels at
-     end of block. */
+     end of block.  */
 
 }
 
-
-
 static unsigned int
 xcoff64_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
      bfd   *abfd;
@@ -326,10 +319,10 @@
 
   if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
     {
-      bfd_h_put_64(abfd,  in->x_sym.x_fcnary.x_fcn.x_lnnoptr, 
+      bfd_h_put_64(abfd,  in->x_sym.x_fcnary.x_fcn.x_lnnoptr,
 	      (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
       PUTBYTE (abfd, _AUX_FCN, (bfd_byte *) ext->x_auxtype.x_auxtype);
-      PUTWORD(abfd,  in->x_sym.x_fcnary.x_fcn.x_endndx.l, 
+      PUTWORD(abfd,  in->x_sym.x_fcnary.x_fcn.x_endndx.l,
 	      (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx);
     }
   if (ISFCN (type))
@@ -337,9 +330,9 @@
 	     (bfd_byte *)  ext->x_sym.x_fcnary.x_fcn.x_fsize);
   else
     {
-      bfd_h_put_32(abfd, in->x_sym.x_misc.x_lnsz.x_lnno, 
+      bfd_h_put_32(abfd, in->x_sym.x_misc.x_lnsz.x_lnno,
 	      (bfd_byte *)ext->x_sym.x_fcnary.x_lnsz.x_lnno);
-      bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_size, 
+      bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_size,
 	      (bfd_byte *)ext->x_sym.x_fcnary.x_lnsz.x_size);
     }
 
@@ -347,7 +340,6 @@
   return bfd_coff_auxesz (abfd);
 }
 
-
 #define coff_SWAP_sym_in xcoff64_swap_sym_in
 #define coff_SWAP_sym_out xcoff64_swap_sym_out
 #define coff_SWAP_aux_in xcoff64_swap_aux_in
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 26c8620..05eba02 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -175,7 +175,6 @@
 	the file in the string 	table. This pass moves all strings
 	into memory and replaces them with pointers to the strings.
 
-
 	The symbol table is massaged once again, this time to create
 	the canonical table used by the BFD application. Each symbol
 	is inspected in turn, and a decision made (using the
@@ -301,7 +300,6 @@
 .boolean done_lineno;
 .} coff_symbol_type;
 
-
 */
 
 #ifdef COFF_WITH_PE
@@ -351,6 +349,19 @@
 
 #ifndef COFF_WITH_PE
 
+/* Macros for setting debugging flags.  */
+#ifdef STYP_DEBUG
+#define STYP_XCOFF_DEBUG STYP_DEBUG
+#else
+#define STYP_XCOFF_DEBUG STYP_INFO
+#endif
+
+#ifdef COFF_ALIGN_IN_S_FLAGS
+#define STYP_DEBUG_INFO STYP_DSECT
+#else
+#define STYP_DEBUG_INFO STYP_INFO
+#endif
+
 static long
 sec_to_styp_flags (sec_name, sec_flags)
      CONST char *sec_name;
@@ -388,22 +399,24 @@
       styp_flags = STYP_LIT;
 #endif /* _LIT */
     }
-  else if (!strcmp (sec_name, ".debug"))
+  else if (!strncmp (sec_name, ".debug", 6))
     {
-#ifdef STYP_DEBUG
-      styp_flags = STYP_DEBUG;
-#else
-      styp_flags = STYP_INFO;
-#endif
+      /* Handle the XCOFF debug section and DWARF2 debug sections.  */
+      if (!sec_name[6])
+        styp_flags = STYP_XCOFF_DEBUG;
+      else
+        styp_flags = STYP_DEBUG_INFO;
     }
   else if (!strncmp (sec_name, ".stab", 5))
     {
-#ifdef COFF_ALIGN_IN_S_FLAGS
-      styp_flags = STYP_DSECT;
-#else
-      styp_flags = STYP_INFO;
-#endif
+      styp_flags = STYP_DEBUG_INFO;
     }
+#ifdef COFF_LONG_SECTION_NAMES
+  else if (!strncmp (sec_name, ".gnu.linkonce.wi.", 17))
+    {
+      styp_flags = STYP_DEBUG_INFO;
+    }
+#endif
 #ifdef RS6000COFF_C
   else if (!strcmp (sec_name, _PAD))
     {
@@ -507,8 +520,8 @@
     styp_flags |= IMAGE_SCN_LNK_REMOVE;
   /* skip IN_MEMORY */
   /* skip SORT */
-  if (sec_flags & SEC_LINK_ONCE) 
-    styp_flags |= IMAGE_SCN_LNK_COMDAT; 
+  if (sec_flags & SEC_LINK_ONCE)
+    styp_flags |= IMAGE_SCN_LNK_COMDAT;
   /* skip LINK_DUPLICATES */
   /* skip LINKER_CREATED */
 
@@ -516,7 +529,7 @@
      though the semantics don't quite match.  The bits from the input
      are retained in pei_section_data(abfd, section)->pe_flags */
 
-  styp_flags |= IMAGE_SCN_MEM_READ;       /* always readable. */
+  styp_flags |= IMAGE_SCN_MEM_READ;       /* always readable.  */
   if ((sec_flags & SEC_READONLY) == 0)
     styp_flags |= IMAGE_SCN_MEM_WRITE;    /* Invert READONLY for write */
   if (sec_flags & SEC_CODE)
@@ -524,7 +537,7 @@
   if (sec_flags & SEC_SHARED)
     styp_flags |= IMAGE_SCN_MEM_SHARED;   /* Shared remains meaningful */
 
-  return styp_flags; 
+  return styp_flags;
 }
 
 #endif /* COFF_WITH_PE */
@@ -550,12 +563,12 @@
 #ifdef STYP_BLOCK
   if (styp_flags & STYP_BLOCK)
       sec_flags |= SEC_BLOCK;
-#endif  
+#endif
 
 #ifdef STYP_CLINK
   if (styp_flags & STYP_CLINK)
       sec_flags |= SEC_CLINK;
-#endif  
+#endif
 
 #ifdef STYP_NOLOAD
   if (styp_flags & STYP_NOLOAD)
@@ -628,10 +641,13 @@
 #endif
 	sec_flags |= SEC_ALLOC;
     }
-  else if (strcmp (name, ".debug") == 0
+  else if (strncmp (name, ".debug", 6) == 0
 #ifdef _COMMENT
 	   || strcmp (name, _COMMENT) == 0
 #endif
+#ifdef COFF_LONG_SECTION_NAMES
+	   || strncmp (name, ".gnu.linkonce.wi.", 17) == 0
+#endif
 	   || strncmp (name, ".stab", 5) == 0)
     {
 #ifdef COFF_PAGE_SIZE
@@ -754,7 +770,7 @@
 
   if (styp_flags & IMAGE_SCN_MEM_EXECUTE)
     sec_flags |= SEC_CODE;   /* Probably redundant */
-  /* IMAGE_SCN_MEM_READ is simply ignored, assuming it always to be true. */
+  /* IMAGE_SCN_MEM_READ is simply ignored, assuming it always to be true.  */
   if ((styp_flags & IMAGE_SCN_MEM_WRITE) == 0)
     sec_flags |= SEC_READONLY;
 
@@ -873,7 +889,7 @@
 
 			if (strcmp (name, symname) != 0)
 			  abort ();
-  
+
 			/* This is the section symbol.  */
 
 			bfd_coff_swap_aux_in (abfd, (PTR) (esym + bfd_coff_symesz (abfd)),
@@ -908,7 +924,7 @@
 			switch (aux.x_scn.x_comdat)
 			  {
 			  case IMAGE_COMDAT_SELECT_NODUPLICATES:
-#ifdef STRICT_PE_FORMAT 
+#ifdef STRICT_PE_FORMAT
 			    sec_flags |= SEC_LINK_DUPLICATES_ONE_ONLY;
 #else
 			    sec_flags &= ~SEC_LINK_ONCE;
@@ -960,7 +976,7 @@
 #define TARGET_UNDERSCORE 0
 #endif
 		      /* Is this the name we're looking for? */
-		      if (strcmp (target_name, 
+		      if (strcmp (target_name,
 				  symname + (TARGET_UNDERSCORE ? 1 : 0)) != 0)
 			{
 			    /* Not the name we're looking for */
@@ -968,7 +984,7 @@
 			    continue;
 			}
 		      /* Fall through.  */
-		    case 1: 
+		    case 1:
 		      /* MSVC mode: the lexically second symbol (or
 			 drop through from the above).  */
 		      {
@@ -979,7 +995,7 @@
 			   Intel puts the two adjacent, but Alpha (at
 			   least) spreads them out.  */
 
-		        section->comdat = 
+		        section->comdat =
 			  bfd_alloc (abfd, sizeof (struct bfd_comdat_info));
 		        if (section->comdat == NULL)
 		          abort ();
@@ -1001,7 +1017,9 @@
 
 	      esym += (isym.n_numaux + 1) * bfd_coff_symesz (abfd);
 	    }
-	  breakloop:
+	breakloop:
+	  /* SunOS requires a statement after any label.  */
+	  ;
 	}
     }
 
@@ -1228,12 +1246,12 @@
 .       struct bfd_link_info *info,
 .       bfd *abfd,
 .       const char *name,
-.       flagword flags, 
+.       flagword flags,
 .       asection *section,
 .       bfd_vma value,
 .       const char *string,
 .       boolean copy,
-.       boolean collect, 
+.       boolean collect,
 .       struct bfd_link_hash_entry **hashp));
 .
 . boolean (*_bfd_coff_link_output_has_begun) PARAMS ((
@@ -1466,8 +1484,8 @@
 
 static boolean
 coff_new_section_hook (abfd, section)
-     bfd *abfd;
-     asection *section;
+     bfd * abfd;
+     asection * section;
 {
   combined_entry_type *native;
 
@@ -1607,6 +1625,23 @@
   pei_section_data (abfd, section)->pe_flags = hdr->s_flags;
 
   section->lma = hdr->s_vaddr;
+
+  /* check for extended relocs */
+  if (hdr->s_flags & IMAGE_SCN_LNK_NRELOC_OVFL)
+    {
+      struct external_reloc dst;
+      struct internal_reloc n;
+      int oldpos = bfd_tell (abfd);
+      bfd_seek (abfd, hdr->s_relptr, 0);
+      if (bfd_read ((PTR) & dst, 1, bfd_coff_relsz (abfd), abfd)
+	  != bfd_coff_relsz (abfd))
+	return;
+
+      coff_swap_reloc_in (abfd, &dst, &n);
+      bfd_seek (abfd, oldpos, 0);
+      section->reloc_count =
+	hdr->s_nreloc = n.r_vaddr;
+    }
 }
 #undef ALIGN_SET
 #undef ELIFALIGN_SET
@@ -1731,6 +1766,11 @@
       struct xcoff_tdata *xcoff;
 
       xcoff = xcoff_data (abfd);
+# ifdef U803XTOCMAGIC
+      xcoff->xcoff64 = internal_f->f_magic == U803XTOCMAGIC;
+# else
+      xcoff->xcoff64 = 0;
+# endif
       xcoff->full_aouthdr = true;
       xcoff->toc = internal_a->o_toc;
       xcoff->sntoc = internal_a->o_sntoc;
@@ -1744,12 +1784,12 @@
     }
 #endif
 
-#ifdef ARM 
+#ifdef ARM
   /* Set the flags field from the COFF header read in */
   if (! _bfd_coff_arm_set_private_flags (abfd, internal_f->f_flags))
     coff->flags = 0;
 #endif
-  
+
 #ifdef COFF_WITH_PE
   /* FIXME: I'm not sure this is ever executed, since peicode.h
      defines coff_mkobject_hook.  */
@@ -1784,7 +1824,7 @@
     case PPCMAGIC:
       arch = bfd_arch_powerpc;
       machine = 0; /* what does this mean? (krk) */
-      break; 
+      break;
 #endif
 #ifdef I386MAGIC
     case I386MAGIC:
@@ -1936,7 +1976,7 @@
 
 		buf = (bfd_byte *) bfd_malloc (bfd_coff_symesz (abfd));
 		if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
-		    || (bfd_read (buf, 1, bfd_coff_symesz (abfd), abfd) 
+		    || (bfd_read (buf, 1, bfd_coff_symesz (abfd), abfd)
 			!= bfd_coff_symesz (abfd)))
 		  {
 		    free (buf);
@@ -1961,32 +2001,33 @@
 	       (because that's how they were bootstrapped originally),
 	       but they are always PowerPC architecture.  */
 	    arch = bfd_arch_powerpc;
-	    machine = 0;
+	    machine = bfd_mach_ppc;
+#else
+#ifdef XCOFF64
+	    arch = bfd_arch_powerpc;
+	    machine = bfd_mach_ppc_620;
 #else
 	    arch = bfd_arch_rs6000;
-#ifdef XCOFF64
-	    machine = 620;
-#else
-	    machine = 6000;
+	    machine = bfd_mach_rs6k;
 #endif
 #endif /* POWERMAC */
 	    break;
 
 	  case 1:
 	    arch = bfd_arch_powerpc;
-	    machine = 601;
+	    machine = bfd_mach_ppc_601;
 	    break;
 	  case 2: /* 64 bit PowerPC */
 	    arch = bfd_arch_powerpc;
-	    machine = 620;
+	    machine = bfd_mach_ppc_620;
 	    break;
 	  case 3:
 	    arch = bfd_arch_powerpc;
-	    machine = 0;
+	    machine = bfd_mach_ppc;
 	    break;
 	  case 4:
 	    arch = bfd_arch_rs6000;
-	    machine = 6000;
+	    machine = bfd_mach_rs6k;
 	    break;
 	  }
       }
@@ -2092,7 +2133,7 @@
         default:
           arch = bfd_arch_obscure;
           (*_bfd_error_handler)
-            (_("Unrecognized TI COFF target id '0x%x'"), 
+            (_("Unrecognized TI COFF target id '0x%x'"),
              internal_f->f_target_id);
           break;
         }
@@ -2144,7 +2185,7 @@
 #ifdef XCOFF64
 #define FORCE_SYMNAMES_IN_STRINGS
 #endif
-  
+
 /* Handle the csect auxent of a C_EXT or C_HIDEXT symbol.  */
 
 static boolean coff_pointerize_aux_hook
@@ -2330,6 +2371,22 @@
 
       if (bfd_seek (abfd, s->rel_filepos, SEEK_SET) != 0)
 	return false;
+
+#ifdef COFF_WITH_PE
+      if (s->reloc_count > 0xffff)
+	{
+	  /* encode real count here as first reloc */
+	  struct internal_reloc n;
+	  memset ((PTR) & n, 0, sizeof (n));
+	  /* add one to count *this* reloc (grr) */
+	  n.r_vaddr = s->reloc_count + 1;
+	  coff_swap_reloc_out (abfd, &n, &dst);
+	  if (bfd_write ((PTR) & dst, 1, bfd_coff_relsz (abfd), abfd)
+	      != bfd_coff_relsz (abfd))
+	    return false;
+	}
+#endif
+
       for (i = 0; i < s->reloc_count; i++)
 	{
 	  struct internal_reloc n;
@@ -2344,7 +2401,7 @@
 	     place). This is a bad thing,'cause the symbols attached
 	     to the output bfd are indexed, so that the relocation
 	     entries know which symbol index they point to.  So we
-	     have to look up the output symbol here. */
+	     have to look up the output symbol here.  */
 
 	  if (q->sym_ptr_ptr[0]->the_bfd != abfd)
 	    {
@@ -2539,10 +2596,10 @@
 	{
 	  if (APCS_26_FLAG (abfd))
 	    * flagsp |= F_APCS26;
-	  
+
 	  if (APCS_FLOAT_FLAG (abfd))
 	    * flagsp |= F_APCS_FLOAT;
-	  
+
 	  if (PIC_FLAG (abfd))
 	    * flagsp |= F_PIC;
 	}
@@ -2557,7 +2614,10 @@
 	case bfd_mach_arm_4:  * flagsp |= F_ARM_4;  break;
 	case bfd_mach_arm_4T: * flagsp |= F_ARM_4T; break;
 	case bfd_mach_arm_5:  * flagsp |= F_ARM_5;  break;
-	case bfd_mach_arm_5T: * flagsp |= F_ARM_5;  break; /* XXX - we do not have an F_ARM_5T */
+	  /* FIXME: we do not have F_ARM vaues greater than F_ARM_5.  */
+	case bfd_mach_arm_5T: * flagsp |= F_ARM_5;  break;
+	case bfd_mach_arm_5TE: * flagsp |= F_ARM_5; break;
+	case bfd_mach_arm_XScale: * flagsp |= F_ARM_5; break;
 	}
       return true;
 #endif
@@ -2571,7 +2631,7 @@
     case bfd_arch_i386:
       *magicp = I386MAGIC;
 #ifdef LYNXOS
-      /* Just overwrite the usual value if we're doing Lynx. */
+      /* Just overwrite the usual value if we're doing Lynx.  */
       *magicp = LYNXCOFFMAGIC;
 #endif
       return true;
@@ -2602,7 +2662,7 @@
 #endif
 #endif
 #ifdef LYNXOS
-      /* Just overwrite the usual value if we're doing Lynx. */
+      /* Just overwrite the usual value if we're doing Lynx.  */
       *magicp = LYNXCOFFMAGIC;
 #endif
       return true;
@@ -2657,7 +2717,7 @@
     case bfd_arch_sparc:
       *magicp = SPARCMAGIC;
 #ifdef LYNXOS
-      /* Just overwrite the usual value if we're doing Lynx. */
+      /* Just overwrite the usual value if we're doing Lynx.  */
       *magicp = LYNXCOFFMAGIC;
 #endif
       return true;
@@ -2693,11 +2753,12 @@
     case bfd_arch_powerpc:
 #endif
 #ifdef XCOFF64
-      if (bfd_get_mach (abfd) == 620 && !strncmp (abfd->xvec->name,"aix", 3))
-	*magicp = U803XTOCMAGIC; 
+      if (bfd_get_mach (abfd) == bfd_mach_ppc_620
+	  && !strncmp (abfd->xvec->name,"aix", 3))
+	*magicp = U803XTOCMAGIC;
       else
 #else
-    	*magicp = U802TOCMAGIC; 
+    	*magicp = U802TOCMAGIC;
 #endif
       return true;
       break;
@@ -2708,17 +2769,22 @@
       * magicp = MCOREMAGIC;
       return true;
 #endif
-      
-    default:			/* Unknown architecture */
-      /* return false;  -- fall through to "return false" below, to avoid
-       "statement never reached" errors on the one below. */
+
+#ifdef W65MAGIC
+    case bfd_arch_w65:
+      *magicp = W65MAGIC;
+      return true;
+#endif
+
+    default:			/* Unknown architecture.  */
+      /* Fall through to "return false" below, to avoid
+	 "statement never reached" errors on the one below.  */
       break;
     }
 
   return false;
 }
 
-
 static boolean
 coff_set_arch_mach (abfd, arch, machine)
      bfd * abfd;
@@ -2735,7 +2801,7 @@
       coff_set_flags (abfd, &dummy1, &dummy2) != true)
     return false;		/* We can't represent this type */
 
-  return true;			/* We're easy ... */
+  return true;			/* We're easy ...  */
 }
 
 #ifdef COFF_IMAGE_WITH_PE
@@ -2763,7 +2829,7 @@
 
 #endif /* COFF_IMAGE_WITH_PE */
 
-/* Calculate the file position for each section. */
+/* Calculate the file position for each section.  */
 
 #ifndef I960
 #define ALIGN_SECTIONS_IN_FILE
@@ -2825,7 +2891,7 @@
 
 #ifdef COFF_IMAGE_WITH_PE
   int page_size;
-  if (coff_data (abfd)->link_info) 
+  if (coff_data (abfd)->link_info)
     {
       page_size = pe_data (abfd)->pe_opthdr.FileAlignment;
     }
@@ -2974,7 +3040,7 @@
       /* Align the sections in the file to the same boundary on
 	 which they are aligned in virtual memory.  I960 doesn't
 	 do this (FIXME) so we can stay in sync with Intel.  960
-	 doesn't yet page from files... */
+	 doesn't yet page from files...  */
 #ifdef ALIGN_SECTIONS_IN_FILE
       if ((abfd->flags & EXEC_P) != 0)
 	{
@@ -3163,7 +3229,7 @@
   file_ptr reloc_base;
   file_ptr lineno_base;
   file_ptr sym_base;
-  unsigned long reloc_size = 0;
+  unsigned long reloc_size = 0, reloc_count = 0;
   unsigned long lnno_size = 0;
   boolean long_section_names;
   asection *text_sec = NULL;
@@ -3194,7 +3260,16 @@
 
   for (current = abfd->sections; current != NULL; current =
        current->next)
-    reloc_size += current->reloc_count * bfd_coff_relsz (abfd);
+    {
+#ifdef COFF_WITH_PE
+      /* we store the actual reloc count in the first reloc's addr */
+      if (current->reloc_count > 0xffff)
+	reloc_count ++;
+#endif
+      reloc_count += current->reloc_count;
+    }
+
+  reloc_size = reloc_count * bfd_coff_relsz (abfd);
 
   lineno_base = reloc_base + reloc_size;
   sym_base = lineno_base + lnno_size;
@@ -3217,6 +3292,11 @@
 	{
 	  current->rel_filepos = reloc_base;
 	  reloc_base += current->reloc_count * bfd_coff_relsz (abfd);
+#ifdef COFF_WITH_PE
+	  /* extra reloc to hold real count */
+	  if (current->reloc_count > 0xffff)
+	    reloc_base += bfd_coff_relsz (abfd);
+#endif
 	}
       else
 	{
@@ -3292,7 +3372,7 @@
       section.s_paddr = current->lma;
       section.s_size =  current->_raw_size;
 #ifdef coff_get_section_load_page
-      section.s_page = coff_get_section_load_page (current); 
+      section.s_page = coff_get_section_load_page (current);
 #endif
 
 #ifdef COFF_WITH_PE
@@ -3335,7 +3415,7 @@
 	  && ! is_reloc_section)
 	hasdebug = true;
 
-#ifdef RS6000COFF_C 
+#ifdef RS6000COFF_C
 #ifndef XCOFF64
       /* Indicate the use of an XCOFF overflow section header.  */
       if (current->reloc_count >= 0xffff || current->lineno_count >= 0xffff)
@@ -3366,7 +3446,7 @@
 			 ? 1 << current->alignment_power
 			 : 0);
 #endif
-#ifdef TIC80COFF 
+#ifdef TIC80COFF
       /* TI COFF puts the alignment power in bits 8-11 of the flags */
       section.s_flags |= (current->alignment_power & 0xF) << 8;
 #endif
@@ -3388,7 +3468,7 @@
 	  SCNHDR buff;
 	  if (coff_swap_scnhdr_out (abfd, &section, &buff) == 0
 	      || bfd_write ((PTR) (&buff), 1, bfd_coff_scnhsz (abfd), abfd)
-	           != bfd_coff_scnhsz (abfd))
+	      != bfd_coff_scnhsz (abfd))
 	    return false;
 	}
 
@@ -3510,13 +3590,13 @@
 	  scnhdr.s_flags = STYP_OVRFLO;
 	  if (coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0
 	      || bfd_write ((PTR) &buff, 1, bfd_coff_scnhsz (abfd), abfd)
-	           != bfd_coff_scnhsz (abfd))
+	      != bfd_coff_scnhsz (abfd))
 	    return false;
 	}
     }
 #endif
 
-  /* OK, now set up the filehdr... */
+  /* OK, now set up the filehdr...  */
 
   /* Don't include the internal abs section in the section count */
 
@@ -3592,7 +3672,7 @@
     coff_set_flags (abfd, &magic, &flags);
     internal_f.f_magic = magic;
     internal_f.f_flags |= flags;
-    /* ...and the "opt"hdr... */
+    /* ...and the "opt"hdr...  */
 
 #ifdef A29K
 #ifdef ULTRA3			/* NYU's machine */
@@ -3654,7 +3734,7 @@
 #if defined(ARM)
 #define __A_MAGIC_SET__
     internal_a.magic = ZMAGIC;
-#endif 
+#endif
 
 #if defined(PPC_PE)
 #define __A_MAGIC_SET__
@@ -3664,7 +3744,7 @@
 #if defined MCORE_PE
 #define __A_MAGIC_SET__
     internal_a.magic = IMAGE_NT_OPTIONAL_HDR_MAGIC;
-#endif 
+#endif
 
 #if defined(I386)
 #define __A_MAGIC_SET__
@@ -3735,7 +3815,7 @@
 	return false;
     }
 #ifdef COFF_LONG_SECTION_NAMES
-  else if (long_section_names)
+  else if (long_section_names && ! obj_coff_strings_written (abfd))
     {
       /* If we have long section names we have to write out the string
          table even if there are no symbols.  */
@@ -3876,40 +3956,40 @@
   /* now write them */
   if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
     return false;
-  
+
   {
     char * buff;
     bfd_size_type amount;
-    
+
     buff = bfd_malloc (bfd_coff_filhsz (abfd));
-    if (buff == NULL) 
+    if (buff == NULL)
       return false;
-    
+
     coff_swap_filehdr_out (abfd, (PTR) & internal_f, (PTR) buff);
     amount = bfd_write ((PTR) buff, 1, bfd_coff_filhsz (abfd), abfd);
-    
+
     free (buff);
-    
+
     if (amount != bfd_coff_filhsz (abfd))
       return false;
   }
-  
+
   if (abfd->flags & EXEC_P)
     {
-      /* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR. 
-	 include/coff/pe.h sets AOUTSZ == sizeof(PEAOUTHDR)) */
+      /* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR.
+	 include/coff/pe.h sets AOUTSZ == sizeof (PEAOUTHDR)) */
       char * buff;
       bfd_size_type amount;
 
       buff = bfd_malloc (bfd_coff_aoutsz (abfd));
-      if (buff == NULL) 
+      if (buff == NULL)
 	return false;
-      
+
       coff_swap_aouthdr_out (abfd, (PTR) & internal_a, (PTR) buff);
       amount = bfd_write ((PTR) buff, 1, bfd_coff_aoutsz (abfd), abfd);
-      
+
       free (buff);
-      
+
       if (amount != bfd_coff_aoutsz (abfd))
 	return false;
     }
@@ -3967,7 +4047,7 @@
       to write a section which doesn't follow these assumptions.  The
       code has been tested on ISC 4.1 by me, and on SCO by Robert Lipe
       <robertl@arnet.com> (Thanks!).
-  
+
       Gvran Uddeborg <gvran@uddeborg.pp.se> */
 
     if (strcmp (section->name, _LIB) == 0)
@@ -3988,7 +4068,7 @@
 #endif
 
   /* Don't write out bss sections - one way to do this is to
-       see if the filepos has not been set. */
+       see if the filepos has not been set.  */
   if (section->filepos == 0)
     return true;
 
@@ -4145,7 +4225,7 @@
 
     }
   asect->lineno = lineno_cache;
-  /* FIXME, free native_lineno here, or use alloca or something. */
+  /* FIXME, free native_lineno here, or use alloca or something.  */
   return true;
 }
 
@@ -4265,7 +4345,7 @@
 		case COFF_SYMBOL_UNDEFINED:
 		  dst->symbol.section = bfd_und_section_ptr;
 		  dst->symbol.value = 0;
-		  break; 
+		  break;
 
 		case COFF_SYMBOL_PE_SECTION:
 		  dst->symbol.flags |= BSF_EXPORT | BSF_SECTION_SYM;
@@ -4312,7 +4392,7 @@
 #ifdef I960
 	    case C_LEAFSTAT:	/* static leaf procedure        */
 #endif
-#if defined ARM 
+#if defined ARM
             case C_THUMBSTAT:   /* Thumb static                  */
             case C_THUMBLABEL:  /* Thumb label                   */
             case C_THUMBSTATFUNC:/* Thumb static function        */
@@ -4431,7 +4511,7 @@
 #endif
 
 	    case C_BLOCK:	/* ".bb" or ".eb"		 */
-	    case C_FCN:		/* ".bf" or ".ef" (or PE ".lf")	 */
+	    case C_FCN:		/* ".bf" or ".ef" (or PE ".lf")  */
 	    case C_EFCN:	/* physical end of function	 */
 #if defined COFF_WITH_PE
 	      /* PE sets the symbol to a value relative to the start
@@ -4477,7 +4557,7 @@
 	      /* NT uses 0x67 for a weak symbol, not C_ALIAS.  */
 	    case C_ALIAS:	/* duplicate tag		 */
 #endif
-	      /* New storage classes for TI COFF */ 
+	      /* New storage classes for TI COFF */
 #if defined(TIC80COFF) || defined(TICOFF)
 	    case C_UEXT:	/* Tentative external definition */
 #endif
@@ -4650,7 +4730,6 @@
 	into a howto table vector; the 88k subtracts a number from the
 	@code{r_type} field and creates an addend field.
 
-
 */
 
 #ifndef CALC_ADDEND
@@ -4705,7 +4784,6 @@
   if (reloc_cache == NULL)
     return false;
 
-
   for (idx = 0; idx < asect->reloc_count; idx++)
     {
       struct internal_reloc dst;
@@ -4826,7 +4904,6 @@
   arelent *tblptr = section->relocation;
   unsigned int count = 0;
 
-
   if (section->flags & SEC_CONSTRUCTOR)
     {
       /* this section has relocs made up by us, they are not in the
@@ -4850,7 +4927,6 @@
       for (; count++ < section->reloc_count;)
 	*relptr++ = tblptr++;
 
-
     }
   *relptr = 0;
   return section->reloc_count;
@@ -5037,7 +5113,7 @@
 #else
   false,
 #endif
-  COFF_DEFAULT_SECTION_ALIGNMENT_POWER, 
+  COFF_DEFAULT_SECTION_ALIGNMENT_POWER,
 #ifdef COFF_FORCE_SYMBOLS_IN_STRINGS
   true,
 #else
@@ -5079,7 +5155,7 @@
 #define coff_bfd_copy_private_section_data  _bfd_generic_bfd_copy_private_section_data
 #endif
 
-#ifndef coff_bfd_copy_private_bfd_data 
+#ifndef coff_bfd_copy_private_bfd_data
 #define coff_bfd_copy_private_bfd_data      _bfd_generic_bfd_copy_private_bfd_data
 #endif
 
@@ -5091,7 +5167,7 @@
 #define coff_bfd_set_private_flags          _bfd_generic_bfd_set_private_flags
 #endif
 
-#ifndef coff_bfd_print_private_bfd_data 
+#ifndef coff_bfd_print_private_bfd_data
 #define coff_bfd_print_private_bfd_data     _bfd_generic_bfd_print_private_bfd_data
 #endif
 
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index bb7f862..35ac1b9 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -60,7 +60,7 @@
 static boolean make_a_section_from_file
   PARAMS ((bfd *, struct internal_scnhdr *, unsigned int));
 static const bfd_target *coff_real_object_p
-  PARAMS ((bfd *, unsigned, struct internal_filehdr *, 
+  PARAMS ((bfd *, unsigned, struct internal_filehdr *,
 	   struct internal_aouthdr *));
 static void fixup_symbol_value
   PARAMS ((bfd *, coff_symbol_type *, struct internal_syment *));
@@ -212,7 +212,7 @@
     goto fail;
 
   /* Set the arch/mach *before* swapping in sections; section header swapping
-     may depend on arch/mach info. */
+     may depend on arch/mach info.  */
   if (bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f) == false)
     goto fail;
 
@@ -340,7 +340,6 @@
   return (bfd_get_symcount (abfd) + 1) * (sizeof (coff_symbol_type *));
 }
 
-
 /* Canonicalize a COFF symbol table.  */
 
 long
@@ -525,7 +524,7 @@
     {
       asymbol *q_maybe = *p;
 
-      if (bfd_asymbol_flavour (q_maybe) == bfd_target_coff_flavour)
+      if (bfd_family_coff (bfd_asymbol_bfd (q_maybe)))
 	{
 	  coff_symbol_type *q = coffsymbol (q_maybe);
 
@@ -558,13 +557,12 @@
 /* Takes a bfd and a symbol, returns a pointer to the coff specific
    area of the symbol if there is one.  */
 
-/*ARGSUSED*/
 coff_symbol_type *
 coff_symbol_from (ignore_abfd, symbol)
      bfd *ignore_abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
 {
-  if (bfd_asymbol_flavour (symbol) != bfd_target_coff_flavour)
+  if (!bfd_family_coff (bfd_asymbol_bfd (symbol)))
     return (coff_symbol_type *) NULL;
 
   if (bfd_asymbol_bfd (symbol)->tdata.coff_obj_data == (coff_data_type *) NULL)
@@ -692,7 +690,7 @@
   for (symbol_index = 0; symbol_index < symbol_count; symbol_index++)
     {
       coff_symbol_type *coff_symbol_ptr = coff_symbol_from (bfd_ptr, symbol_ptr_ptr[symbol_index]);
-      symbol_ptr_ptr[symbol_index]->udata.i = symbol_index; 
+      symbol_ptr_ptr[symbol_index]->udata.i = symbol_index;
       if (coff_symbol_ptr && coff_symbol_ptr->native)
 	{
 	  combined_entry_type *s = coff_symbol_ptr->native;
@@ -821,7 +819,7 @@
 
       if (bfd_coff_force_symnames_in_strings (abfd))
 	{
-          native->u.syment._n._n_n._n_offset = 
+          native->u.syment._n._n_n._n_offset =
 	      (*string_size_p + STRING_SIZE_SIZE);
 	  native->u.syment._n._n_n._n_zeroes = 0;
 	  *string_size_p += 6;  /* strlen(".file") + 1 */
@@ -900,7 +898,7 @@
 	    abort ();
 	  if (bfd_seek (abfd, filepos, SEEK_SET) != 0)
 	    abort ();
-	  native->u.syment._n._n_n._n_offset = 
+	  native->u.syment._n._n_n._n_offset =
 	      *debug_string_size_p + prefix_len;
 	  native->u.syment._n._n_n._n_zeroes = 0;
 	  *debug_string_size_p += name_length + 1 + prefix_len;
@@ -1103,7 +1101,7 @@
       while (lineno[count].line_number != 0)
 	{
 #if 0
-	  /* 13 april 92. sac 
+	  /* 13 april 92. sac
 	     I've been told this, but still need proof:
 	     > The second bug is also in `bfd/coffcode.h'.  This bug
 	     > causes the linker to screw up the pc-relocations for
@@ -1271,7 +1269,7 @@
 	  else if (c_symbol->native->u.syment.n_sclass == C_FILE
 		   && c_symbol->native->u.syment.n_numaux > 0)
 	    {
-	      if (bfd_coff_force_symnames_in_strings (abfd)) 
+	      if (bfd_coff_force_symnames_in_strings (abfd))
       		bfd_write (".file", 1, 6, abfd);
 	      maxlen = bfd_coff_filnmlen (abfd);
 	    }
@@ -1376,7 +1374,6 @@
   return true;
 }
 
-/*ARGSUSED */
 alent *
 coff_get_lineno (ignore_abfd, symbol)
      bfd *ignore_abfd ATTRIBUTE_UNUSED;
@@ -1487,7 +1484,7 @@
 
 /* Allocate space for the ".debug" section, and read it.
    We did not read the debug section until now, because
-   we didn't want to go to the trouble until someone needed it. */
+   we didn't want to go to the trouble until someone needed it.  */
 
 static char *
 build_debug_section (abfd)
@@ -1509,7 +1506,7 @@
   if (debug_section == NULL)
     return NULL;
 
-  /* Seek to the beginning of the `.debug' section and read it. 
+  /* Seek to the beginning of the `.debug' section and read it.
      Save the current position first; it is needed by our caller.
      Then read debug section and reset the file pointer.  */
 
@@ -1523,7 +1520,6 @@
   return debug_section;
 }
 
-
 /* Return a pointer to a malloc'd copy of 'name'.  'name' may not be
    \0-terminated, but will not exceed 'maxlen' characters.  The copy *will*
    be \0-terminated.  */
@@ -1611,7 +1607,7 @@
 		 + obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd)),
 		SEEK_SET) != 0)
     return NULL;
-    
+
   if (bfd_read (extstrsize, sizeof extstrsize, 1, abfd) != sizeof extstrsize)
     {
       if (bfd_get_error () != bfd_error_file_truncated)
@@ -1812,7 +1808,7 @@
 		    {
 		      break;
 		    }		/* if end of string */
-		}		/* possible lengths of this string. */
+		}		/* possible lengths of this string.  */
 
 	      if ((newstring = (PTR) bfd_alloc (abfd, ++i)) == NULL)
 		return (NULL);
@@ -1910,7 +1906,6 @@
   return &new->symbol;
 }
 
-/*ARGSUSED */
 void
 coff_get_symbol_info (abfd, symbol, ret)
      bfd *abfd;
@@ -2163,7 +2158,7 @@
 /* Provided a BFD, a section and an offset (in bytes, not octets) into the
    section, calculate and return the name of the source file and the line
    nearest to the wanted location.  */
-/*ARGSUSED*/
+
 boolean
 coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
 			functionname_ptr, line_ptr)
@@ -2190,9 +2185,17 @@
   if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
 					     &found, filename_ptr,
 					     functionname_ptr, line_ptr,
-					     &coff_data (abfd)->line_info))
+					     &coff_data(abfd)->line_info))
     return false;
-  if (found)
+
+  /* Also try examining DWARF2 debugging information.  */
+  if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
+				     filename_ptr, functionname_ptr,
+				     line_ptr, 0,
+				     &coff_data(abfd)->dwarf2_find_line_info))
+    return true;
+
+if (found)
     return true;
 
   *filename_ptr = 0;
@@ -2200,7 +2203,7 @@
   *line_ptr = 0;
 
   /* Don't try and find line numbers in a non coff file */
-  if (abfd->xvec->flavour != bfd_target_coff_flavour)
+  if (!bfd_family_coff (abfd))
     return false;
 
   if (cof == NULL)
@@ -2407,7 +2410,7 @@
 	 We cheat here by creating a fake native entry for it and
 	 then filling in the class.  This code is based on that in
 	 coff_write_alien_symbol().  */
-      
+
       combined_entry_type * native;
 
       native = (combined_entry_type *) bfd_alloc (abfd, sizeof (* native));
@@ -2415,10 +2418,10 @@
 	return false;
 
       memset (native, 0, sizeof (* native));
-      
+
       native->u.syment.n_type   = T_NULL;
       native->u.syment.n_sclass = class;
-      
+
       if (bfd_is_und_section (symbol->section))
 	{
 	  native->u.syment.n_scnum = N_UNDEF;
@@ -2437,19 +2440,19 @@
 				      + symbol->section->output_offset);
 	  if (! obj_pe (abfd))
 	    native->u.syment.n_value += symbol->section->output_section->vma;
-	  
+
 	  /* Copy the any flags from the the file header into the symbol.
 	     FIXME: Why?  */
 	  native->u.syment.n_flags = bfd_asymbol_bfd (& csym->symbol)->flags;
 	}
-      
+
       csym->native = native;
     }
   else
     {
       csym->native->u.syment.n_sclass = class;
     }
-  
+
   return true;
 }
 
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 609f665..91de3d0 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -40,6 +40,15 @@
   PARAMS ((bfd *, struct bfd_link_info *, bfd *));
 static void mark_relocs PARAMS ((struct coff_final_link_info *, bfd *));
 
+/* Return true if SYM is a weak, external symbol.  */
+#define IS_WEAK_EXTERNAL(abfd, sym)			\
+  ((sym).n_sclass == C_WEAKEXT				\
+   || (obj_pe (abfd) && (sym).n_sclass == C_NT_WEAK))
+
+/* Return true if SYM is an external symbol.  */
+#define IS_EXTERNAL(abfd, sym)				\
+  ((sym).n_sclass == C_EXT || IS_WEAK_EXTERNAL (abfd, sym))
+
 /* Define macros so that the ISFCN, et. al., macros work correctly.
    These macros are defined in include/coff/internal.h in terms of
    N_TMASK, etc.  These definitions require a user to define local
@@ -395,8 +404,7 @@
 	      break;
 	    }
 
-	  if (sym.n_sclass == C_WEAKEXT
-	      || (obj_pe (abfd) && sym.n_sclass == C_NT_WEAK))
+	  if (IS_WEAK_EXTERNAL (abfd, sym))
 	    flags = BSF_WEAK;
 
 	  addit = true;
@@ -894,8 +902,7 @@
       for (p = o->link_order_head; p != NULL; p = p->next)
 	{
 	  if (p->type == bfd_indirect_link_order
-	      && (bfd_get_flavour (p->u.indirect.section->owner)
-		  == bfd_target_coff_flavour))
+	      && bfd_family_coff (p->u.indirect.section->owner))
 	    {
 	      sub = p->u.indirect.section->owner;
 	      if (! bfd_coff_link_output_has_begun (sub, & finfo))
@@ -921,7 +928,7 @@
 
   if (! bfd_coff_final_link_postscript (abfd, & finfo))
     goto error_return;
-  
+
   /* Free up the buffers used by _bfd_coff_link_input_bfd.  */
 
   coff_debug_merge_hash_table_free (&finfo.debug_merge);
@@ -982,7 +989,7 @@
 
   /* If doing task linking (ld --task-link) then make a pass through the
      global symbols, writing out any that are defined, and making them
-     static. */
+     static.  */
   if (info->task_link)
     {
       finfo.failed = false;
@@ -1095,6 +1102,8 @@
 
       if (! _bfd_stringtab_emit (abfd, finfo.strtab))
 	return false;
+
+      obj_coff_strings_written (abfd) = true;
     }
 
   _bfd_stringtab_free (finfo.strtab);
@@ -1152,7 +1161,7 @@
      bfd *output_bfd;
      int heap;
 {
-  if (coff_data(output_bfd)->pe) 
+  if (coff_data(output_bfd)->pe)
     {
       int val = strtoul (ptr, &ptr, 0);
       if (heap)
@@ -1160,7 +1169,7 @@
       else
 	pe_data(output_bfd)->pe_opthdr.SizeOfStackReserve =val;
 
-      if (ptr[0] == ',') 
+      if (ptr[0] == ',')
 	{
 	  int val = strtoul (ptr+1, &ptr, 0);
 	  if (heap)
@@ -1186,7 +1195,7 @@
 }
 
 /* Process any magic embedded commands in a section called .drectve */
-			
+
 static int
 process_embedded_commands (output_bfd, info,  abfd)
      bfd *output_bfd;
@@ -1197,19 +1206,19 @@
   char *s;
   char *e;
   char *copy;
-  if (!sec) 
+  if (!sec)
     return 1;
-  
+
   copy = bfd_malloc ((size_t) sec->_raw_size);
-  if (!copy) 
+  if (!copy)
     return 0;
-  if (! bfd_get_section_contents(abfd, sec, copy, 0, sec->_raw_size)) 
+  if (! bfd_get_section_contents(abfd, sec, copy, 0, sec->_raw_size))
     {
       free (copy);
       return 0;
     }
   e = copy + sec->_raw_size;
-  for (s = copy;  s < e ; ) 
+  for (s = copy;  s < e ; )
     {
       if (s[0]!= '-') {
 	s++;
@@ -1230,7 +1239,7 @@
 	  s = get_name(s, &name);
 	  s = get_name(s, &attribs);
 	  while (loop) {
-	    switch (*attribs++) 
+	    switch (*attribs++)
 	      {
 	      case 'W':
 		had_write = 1;
@@ -1264,7 +1273,7 @@
 	{
 	  s = dores_com (s+6, output_bfd, 0);
 	}
-      else 
+      else
 	s++;
     }
   free (copy);
@@ -1274,7 +1283,7 @@
 /* Place a marker against all symbols which are used by relocations.
    This marker can be picked up by the 'do we skip this symbol ?'
    loop in _bfd_coff_link_input_bfd() and used to prevent skipping
-   that symbol. 
+   that symbol.
    */
 
 static void
@@ -1286,14 +1295,13 @@
 
   if ((bfd_get_file_flags (input_bfd) & HAS_SYMS) == 0)
     return;
-  
+
   for (a = input_bfd->sections; a != (asection *) NULL; a = a->next)
     {
       struct internal_reloc *	internal_relocs;
       struct internal_reloc *	irel;
       struct internal_reloc *	irelend;
 
-      
       if ((a->flags & SEC_RELOC) == 0 || a->reloc_count  < 1)
 	continue;
 
@@ -1306,7 +1314,7 @@
 	  ? (finfo->section_info[ a->output_section->target_index ].relocs + a->output_section->reloc_count)
 	  : finfo->internal_relocs)
 	);
-      
+
       if (internal_relocs == NULL)
 	continue;
 
@@ -1317,7 +1325,7 @@
 	 been initialised to 0) for all of the symbols that are used
 	 in the relocation table.  This will then be picked up in the
 	 skip/don't pass */
-      
+
       for (; irel < irelend; irel++)
 	{
 	  finfo->sym_indices[ irel->r_symndx ] = -1;
@@ -1400,8 +1408,8 @@
       && finfo->info->relocateable)
     {
       /* mark the symbol array as 'not-used' */
-      memset (indexp, 0, obj_raw_syment_count (input_bfd) * sizeof * indexp); 
-       
+      memset (indexp, 0, obj_raw_syment_count (input_bfd) * sizeof * indexp);
+
       mark_relocs (finfo, input_bfd);
     }
 
@@ -1448,7 +1456,7 @@
 	dont_skip_symbol = *indexp;
       else
 	dont_skip_symbol = false;
-      
+
       *indexp = -1;
 
       skip = false;
@@ -1834,12 +1842,8 @@
 	    }
 
 	  /* If doing task linking, convert normal global function symbols to
-	     static functions. */
-
-	  if (finfo->info->task_link
-	      && (isym.n_sclass == C_EXT
-		  || isym.n_sclass == C_WEAKEXT
-		  || (obj_pe (input_bfd) && isym.n_sclass == C_NT_WEAK)))
+	     static functions.  */
+	  if (finfo->info->task_link && IS_EXTERNAL (input_bfd, isym))
 	    isym.n_sclass = C_STAT;
 
 	  /* Output the symbol.  */
@@ -2202,7 +2206,7 @@
 						 is.n_numaux, auxptr);
 			}
 
-			skipping = false;
+		      skipping = false;
 		    }
 
 		  iline.l_addr.l_symndx = indx;
@@ -2400,8 +2404,8 @@
 			  /* This reloc is against a symbol we are
                              stripping.  This should have been handled
 			     by the 'dont_skip_symbol' code in the while
-			     loop at the top of this function. */
-			  
+			     loop at the top of this function.  */
+
 			  is = finfo->internal_syms + irel->r_symndx;
 
 			  name = (_bfd_coff_internal_syment_name
@@ -2425,9 +2429,9 @@
       if (secdata == NULL || secdata->stab_info == NULL)
 	{
 	  if (! bfd_set_section_contents (output_bfd, o->output_section,
-					  contents, 
-                                          (file_ptr) 
-                                          (o->output_offset * 
+					  contents,
+                                          (file_ptr)
+                                          (o->output_offset *
                                            bfd_octets_per_byte (output_bfd)),
 					  (o->_cooked_size != 0
 					   ? o->_cooked_size
@@ -2549,20 +2553,25 @@
   /* If doing task linking and this is the pass where we convert
      defined globals to statics, then do that conversion now.  If the
      symbol is not being converted, just ignore it and it will be
-     output during a later pass. */
+     output during a later pass.  */
   if (finfo->global_to_static)
     {
-      if (isym.n_sclass != C_EXT
-	  && isym.n_sclass != C_WEAKEXT
-	  && (! obj_pe (output_bfd) || isym.n_sclass != C_NT_WEAK))
-	{
-	  return true;
-	}
+      if (! IS_EXTERNAL (output_bfd, isym))
+	return true;
+
       isym.n_sclass = C_STAT;
     }
 
+  /* When a weak symbol is not overriden by a strong one,
+     turn it into an external symbol when not building a
+     shared or relocateable object.  */
+  if (! finfo->info->shared
+      && ! finfo->info->relocateable
+      && IS_WEAK_EXTERNAL (finfo->output_bfd, isym))
+    isym.n_sclass = C_EXT;
+
   isym.n_numaux = h->numaux;
-  
+
   bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) finfo->outsyms);
 
   symesz = bfd_coff_symesz (output_bfd);
@@ -2654,7 +2663,7 @@
 
 /* Write out task global symbols, converting them to statics.  Called
    via coff_link_hash_traverse.  Calls bfd_coff_write_global_sym to do
-   the dirty work, if the symbol we are processing needs conversion. */
+   the dirty work, if the symbol we are processing needs conversion.  */
 
 boolean
 _bfd_coff_write_task_globals (h, data)
@@ -2740,7 +2749,7 @@
 	  break;
 	}
       ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf,
-				     (file_ptr) 
+				     (file_ptr)
                                      (link_order->offset *
                                       bfd_octets_per_byte (output_bfd)), size);
       free (buf);
@@ -2862,7 +2871,7 @@
 	  return false;
 	}
       else
-	{    
+	{
 	  h = obj_coff_sym_hashes (input_bfd)[symndx];
 	  sym = syms + symndx;
 	}
@@ -2877,7 +2886,6 @@
       else
 	addend = 0;
 
-
       howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
 				       sym, &addend);
       if (howto == NULL)
@@ -2929,6 +2937,9 @@
 		     + sec->output_offset);
 	      }
 
+	  else if (h->root.type == bfd_link_hash_undefweak)
+	    val = 0;
+
 	  else if (! info->relocateable)
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
@@ -2940,7 +2951,7 @@
 
       if (info->base_file)
 	{
-	  /* Emit a reloc if the backend thinks it needs it. */
+	  /* Emit a reloc if the backend thinks it needs it.  */
 	  if (sym && pe_data (output_bfd)->in_reloc_p (output_bfd, howto))
 	    {
 	      /* Relocation to a symbol in a section which isn't
@@ -2949,9 +2960,9 @@
 		 reloc section.  Note that the base file is not
 		 portable between systems.  We write out a long here,
 		 and dlltool reads in a long.  */
-	      long addr = (rel->r_vaddr 
-			   - input_section->vma 
-			   + input_section->output_offset 
+	      long addr = (rel->r_vaddr
+			   - input_section->vma
+			   + input_section->output_offset
 			   + input_section->output_section->vma);
 	      if (coff_data (output_bfd)->pe)
 		addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
@@ -2963,7 +2974,7 @@
 		}
 	    }
 	}
-  
+
       rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
 					contents,
 					rel->r_vaddr - input_section->vma,
diff --git a/bfd/coffswap.h b/bfd/coffswap.h
index 5bf011e..2f89afb 100644
--- a/bfd/coffswap.h
+++ b/bfd/coffswap.h
@@ -336,7 +336,6 @@
   return bfd_coff_filhsz (abfd);
 }
 
-
 #ifndef NO_COFF_SYMBOLS
 
 static void
@@ -359,9 +358,9 @@
     memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN);
 #endif
   }
-  in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value); 
+  in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value);
   in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum);
-  if (sizeof(ext->e_type) == 2){
+  if (sizeof (ext->e_type) == 2){
     in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type);
   }
   else {
@@ -395,7 +394,7 @@
   }
   bfd_h_put_32(abfd,  in->n_value , (bfd_byte *) ext->e_value);
   bfd_h_put_16(abfd,  in->n_scnum , (bfd_byte *) ext->e_scnum);
-  if (sizeof(ext->e_type) == 2)
+  if (sizeof (ext->e_type) == 2)
       {
 	bfd_h_put_16(abfd,  in->n_type , (bfd_byte *) ext->e_type);
       }
@@ -431,7 +430,7 @@
     case C_FILE:
       if (ext->x_file.x_fname[0] == 0) {
 	  in->x_file.x_n.x_zeroes = 0;
-	  in->x_file.x_n.x_offset = 
+	  in->x_file.x_n.x_offset =
 	   bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
 	} else {
 #if FILNMLEN != E_FILNMLEN
@@ -507,7 +506,7 @@
 
 end: ;
   /* the semicolon is because MSVC doesn't like labels at
-     end of block. */
+     end of block.  */
 
 #ifdef COFF_ADJUST_AUX_IN_POST
   COFF_ADJUST_AUX_IN_POST (abfd, ext1, type, class, indx, numaux, in1);
@@ -672,7 +671,6 @@
   bfd_h_put_32(abfd, aouthdr_int->vid[1], (bfd_byte *) aouthdr_ext->vid + 4);
 #endif
 
-
 #ifdef RS6000COFF_C
 #ifdef XCOFF64
   aouthdr_int->o_toc = bfd_h_get_64(abfd, aouthdr_ext->o_toc);
@@ -805,7 +803,7 @@
 #ifdef COFF_ADJUST_SCNHDR_IN_PRE
   COFF_ADJUST_SCNHDR_IN_PRE (abfd, ext, in);
 #endif
-  memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof(scnhdr_int->s_name));
+  memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name));
   scnhdr_int->s_vaddr =
     GET_SCNHDR_VADDR (abfd, (bfd_byte *) scnhdr_ext->s_vaddr);
   scnhdr_int->s_paddr =
@@ -847,12 +845,11 @@
 #ifdef COFF_ADJUST_SCNHDR_OUT_PRE
   COFF_ADJUST_SCNHDR_OUT_PRE (abfd, in, out);
 #endif
-  memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof(scnhdr_int->s_name));
+  memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
 
   PUT_SCNHDR_VADDR (abfd, scnhdr_int->s_vaddr,
 		    (bfd_byte *) scnhdr_ext->s_vaddr);
 
-
   PUT_SCNHDR_PADDR (abfd, scnhdr_int->s_paddr,
 		    (bfd_byte *) scnhdr_ext->s_paddr);
   PUT_SCNHDR_SIZE (abfd, scnhdr_int->s_size,
@@ -871,7 +868,7 @@
   PUTWORD(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc);
 #else
   if (scnhdr_int->s_nlnno <= MAX_SCNHDR_NLNNO)
-    PUT_SCNHDR_NLNNO(abfd, scnhdr_int->s_nlnno, 
+    PUT_SCNHDR_NLNNO(abfd, scnhdr_int->s_nlnno,
 	    (bfd_byte *) scnhdr_ext->s_nlnno);
   else
     {
@@ -886,7 +883,7 @@
       PUT_SCNHDR_NLNNO(abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno);
     }
   if (scnhdr_int->s_nreloc <= MAX_SCNHDR_NRELOC)
-    PUT_SCNHDR_NRELOC(abfd, scnhdr_int->s_nreloc, 
+    PUT_SCNHDR_NRELOC(abfd, scnhdr_int->s_nreloc,
 	    (bfd_byte *) scnhdr_ext->s_nreloc);
   else
     {
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 324a168..f420b7e 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -32,11 +32,15 @@
 arm*)	targ_archs=bfd_arm_arch ;;
 strongarm*) targ_archs=bfd_arm_arch ;;
 thumb*)	targ_archs=bfd_arm_arch ;;
+xscale*) targ_archs=bfd_arm_arch ;;
 c30*)	targ_archs=bfd_tic30_arch ;;
 c54x*)	targ_archs=bfd_tic54x_arch ;;
 hppa*)	targ_archs=bfd_hppa_arch ;;
+x86_64) targ_archs=bfd_i386_arch ;;
 i[3456]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 ;;
@@ -84,6 +88,10 @@
     targ_defvec=bfd_elf64_ia64_little_vec
     targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
     ;;
+  ia64*-*-hpux*)
+    targ_defvec=bfd_elf64_ia64_big_vec
+    targ_selvecs="bfd_elf32_ia64_big_vec"
+    ;;
   sparc64-*-netbsd*)
     targ_defvec=bfd_elf64_sparc_vec
     targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
@@ -118,7 +126,7 @@
     targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec"
     targ_underscore=yes
     ;;
-  arm-*-aout | armel-*-aout)	
+  arm-*-aout | armel-*-aout)
     targ_defvec=aout_arm_little_vec
     targ_selvecs=aout_arm_big_vec
     ;;
@@ -131,11 +139,15 @@
     targ_selvecs=armcoff_big_vec
     targ_underscore=yes
     ;;
+  arm-*-rtems*)
+    targ_defvec=bfd_elf32_littlearm_vec
+    targ_selvecs=bfd_elf32_bigarm_vec
+    ;;
   armeb-*-elf | arm*b-*-linux-gnu*)
     targ_defvec=bfd_elf32_bigarm_vec
     targ_selvecs=bfd_elf32_littlearm_vec
     ;;
-  arm-*-elf | arm*-*-linux-gnu* | arm*-*-conix*)
+  arm-*-elf | arm*-*-linux-gnu* | arm*-*-conix* | arm*-*-uclinux*)
     targ_defvec=bfd_elf32_littlearm_vec
     targ_selvecs=bfd_elf32_bigarm_vec
     ;;
@@ -176,9 +188,18 @@
     targ_selvecs=armcoff_big_vec
     targ_underscore=yes
     ;;
+  xscale-*-elf)
+    targ_defvec=bfd_elf32_littlearm_vec
+    targ_selvecs=bfd_elf32_bigarm_vec
+    ;;
+  xscale-*-coff)
+    targ_defvec=armcoff_little_vec
+    targ_selvecs=armcoff_big_vec
+    targ_underscore=yes
+    ;;
 
   a29k-*-ebmon* | a29k-*-udi* | a29k-*-coff* | a29k-*-sym1* | \
-  a29k-*-vxworks* | a29k-*-sysv*)
+  a29k-*-vxworks* | a29k-*-sysv* | a29k-*rtems*)
     targ_defvec=a29kcoff_big_vec
     targ_selvecs=sunos_big_vec
     targ_underscore=yes
@@ -205,6 +226,12 @@
     targ_underscore=yes
     ;;
 
+  cris-*-*)
+    targ_defvec=cris_aout_vec
+    targ_selvecs="bfd_elf32_us_cris_vec bfd_elf32_cris_vec ieee_vec"
+    targ_underscore=yes # Note: not true for bfd_elf32_cris_vec.
+    ;;
+
   d10v-*-*)
     targ_defvec=bfd_elf32_d10v_vec
     ;;
@@ -228,15 +255,20 @@
     targ_underscore=yes
     ;;
 
-  hppa*-*-*elf* | hppa*-*-linux-gnu* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems*)
-    targ_defvec=bfd_elf32_hppa_vec
+#ifdef BFD64
+  hppa*64*-*-linux-gnu*)
+    targ_defvec=bfd_elf64_hppa_vec
     ;;
-#ifdef BFD64 
   hppa*64*-*-hpux11*)
     targ_defvec=bfd_elf64_hppa_vec
     targ_cflags=-DHPUX_LARGE_AR_IDS
     ;;
 #endif
+
+  hppa*-*-*elf* | hppa*-*-linux-gnu* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems*)
+    targ_defvec=bfd_elf32_hppa_vec
+    ;;
+
 #if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) || defined (HOST_HPPAMPEIX)
   hppa*-*-bsd*)
     targ_defvec=som_vec
@@ -269,6 +301,9 @@
     targ_defvec=bfd_elf32_i386_vec
     targ_selvecs="i386coff_vec i386aout_vec"
     ;;
+  i[3456]86-*-chorus*)
+    targ_defvec=bfd_elf32_i386_vec
+    ;;
   i[3456]86-*-msdosdjgpp* | i[3456]*-*-go32* | i[3456]86-go32-rtems* )
     targ_defvec=go32coff_vec
     targ_selvecs="go32stubbedcoff_vec i386aout_vec"
@@ -321,6 +356,12 @@
     targ_defvec=bfd_elf32_i386_vec
     targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
     ;;
+#ifdef BFD64    
+  x86_64-*-linux-gnu*)
+    targ_defvec=bfd_elf64_x86_64_vec
+    targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
+    ;;
+#endif
   i[3456]86-*-lynxos*)
     targ_defvec=i386lynx_coff_vec
     targ_selvecs=i386lynx_aout_vec
@@ -372,10 +413,18 @@
     targ_defvec=i386aout_vec
     targ_underscore=yes
     ;;
+  i[3456]86-*-chaos)
+    targ_defvec=bfd_elf32_i386_vec
+    targ_selfvecs=i386chaos_vec
+    ;;
 
   i860-*-mach3* | i860-*-osf1* | i860-*-coff*)
     targ_defvec=i860coff_vec
     ;;
+  i860-stardent-sysv4* | i860-stardent-elf*)
+    targ_defvec=bfd_elf32_i860_little_vec
+    targ_selvecs="bfd_elf32_i860_vec bfd_elf32_i860_little_vec"
+    ;;
   i860-*-sysv4* | i860-*-elf*)
     targ_defvec=bfd_elf32_i860_vec
     ;;
@@ -404,6 +453,15 @@
     targ_defvec=bfd_elf32_m32r_vec
     ;;
 
+  m68hc11-*-* | m6811-*-*)
+    targ_defvec=bfd_elf32_m68hc11_vec
+    targ_selvecs="bfd_elf32_m68hc11_vec bfd_elf32_m68hc12_vec"
+    ;;
+  m68hc12-*-* | m6812-*-*)
+    targ_defvec=bfd_elf32_m68hc12_vec
+    targ_selvecs="bfd_elf32_m68hc11_vec bfd_elf32_m68hc12_vec"
+    ;;
+
   m68*-apollo-*)
     targ_defvec=apollocoff_vec
     ;;
@@ -569,14 +627,14 @@
     targ_underscore=yes
     ;;
   mips*-*-sysv4*)
-    targ_defvec=bfd_elf32_bigmips_vec
-    targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_vec"
+    targ_defvec=bfd_elf32_tradbigmips_vec
+    targ_selvecs="bfd_elf32_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
     ;;
   mips*-*-sysv* | mips*-*-riscos*)
     targ_defvec=ecoff_big_vec
     targ_selvecs=ecoff_little_vec
     ;;
-  mips*el-*-elf* | mips*el-*-rtems* | mips*el-*-vxworks*)
+  mips*el-*-elf* | mips*el-*-rtems* | mips*el-*-vxworks* | mips*-*-chorus*)
     targ_defvec=bfd_elf32_littlemips_vec
     targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
     ;;
@@ -630,7 +688,7 @@
     ;;
   powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
   powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
-  powerpc-*-vxworks*)
+  powerpc-*-chorus* | powerpc-*-vxworks*)
     targ_defvec=bfd_elf32_powerpc_vec
     targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
     ;;
@@ -657,6 +715,11 @@
     targ_defvec=rs6000coff_vec
     ;;
 
+  sh-*-linux*)
+    targ_defvec=bfd_elf32_shblin_vec
+    targ_selvecs=bfd_elf32_shlin_vec
+    ;;
+
   sh-*-elf* | sh-*-rtemself*)
     targ_defvec=bfd_elf32_sh_vec
     targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
@@ -685,6 +748,9 @@
   sparclite-*-elf* | sparc86x-*-elf*)
     targ_defvec=bfd_elf32_sparc_vec
     ;;
+  sparc*-*-chorus*)
+    targ_defvec=bfd_elf32_sparc_vec
+    ;;
   sparc-*-linux*aout*)
     targ_defvec=sparclinux_vec
     targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
@@ -740,11 +806,20 @@
   sparc64-*-elf*)
     targ_defvec=bfd_elf64_sparc_vec
     targ_selvecs=bfd_elf32_sparc_vec
-    ;;    
+    ;;
 #endif /* BFD64 */
   sparc*-*-coff*)
     targ_defvec=sparccoff_vec
     ;;
+  sparc*-*-rtemsaout*)
+    targ_defvec=sunos_big_vec
+    targ_selvecs="bfd_elf32_sparc_vec sparccoff_vec"
+    targ_underscore=yes
+    ;;
+  sparc*-*-rtems* | sparc*-*-rtemself*)
+    targ_defvec=bfd_elf32_sparc_vec
+    targ_selvecs="sunos_big_vec sparccoff_vec"
+    ;;
   sparc*-*-* | sparc*-*-rtems*)
     targ_defvec=sunos_big_vec
     targ_underscore=yes
diff --git a/bfd/config.in b/bfd/config.in
index 7383656..74af3d3 100644
--- a/bfd/config.in
+++ b/bfd/config.in
@@ -25,9 +25,6 @@
 /* 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
 
@@ -211,21 +208,42 @@
 /* Define if <sys/procfs.h> has prstatus_t. */
 #undef HAVE_PRSTATUS_T
 
+/* Define if <sys/procfs.h> has prstatus32_t. */
+#undef HAVE_PRSTATUS32_T
+
 /* Define if <sys/procfs.h> has prstatus_t.pr_who. */
 #undef HAVE_PRSTATUS_T_PR_WHO
 
+/* Define if <sys/procfs.h> has prstatus32_t.pr_who. */
+#undef HAVE_PRSTATUS32_T_PR_WHO
+
 /* Define if <sys/procfs.h> has pstatus_t. */
 #undef HAVE_PSTATUS_T
 
+/* Define if <sys/procfs.h> has pxstatus_t. */
+#undef HAVE_PXSTATUS_T
+
+/* Define if <sys/procfs.h> has pstatus32_t. */
+#undef HAVE_PSTATUS32_T
+
 /* Define if <sys/procfs.h> has prpsinfo_t. */
 #undef HAVE_PRPSINFO_T
 
+/* Define if <sys/procfs.h> has prpsinfo32_t. */
+#undef HAVE_PRPSINFO32_T
+
 /* Define if <sys/procfs.h> has psinfo_t. */
 #undef HAVE_PSINFO_T
 
+/* Define if <sys/procfs.h> has psinfo32_t. */
+#undef HAVE_PSINFO32_T
+
 /* Define if <sys/procfs.h> has lwpstatus_t. */
 #undef HAVE_LWPSTATUS_T
 
+/* Define if <sys/procfs.h> has lwpxstatus_t. */
+#undef HAVE_LWPXSTATUS_T
+
 /* Define if <sys/procfs.h> has lwpstatus_t.pr_context. */
 #undef HAVE_LWPSTATUS_T_PR_CONTEXT
 
diff --git a/bfd/configure b/bfd/configure
index b567ae5..370ef0c 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -22,6 +22,8 @@
 ac_help="$ac_help
   --disable-libtool-lock  avoid locking (might break parallel builds)"
 ac_help="$ac_help
+  --with-pic              try to use only PIC/non-PIC objects [default=use both]"
+ac_help="$ac_help
   --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)"
 ac_help="$ac_help
   --enable-targets        alternative target configurations"
@@ -558,6 +560,68 @@
   ac_n= ac_c='\c' ac_t=
 fi
 
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:565: 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 570 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:581: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_cygwin=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:598: 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 603 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:610: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_mingw32=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
 
 
 ac_aux_dir=
@@ -607,7 +671,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:611: checking host system type" >&5
+echo "configure:675: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -628,7 +692,7 @@
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:632: checking target system type" >&5
+echo "configure:696: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
@@ -646,7 +710,7 @@
 echo "$ac_t""$target" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:650: checking build system type" >&5
+echo "configure:714: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -668,249 +732,49 @@
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
-# 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:675: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+
+        echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6
+echo "configure:738: checking for strerror in -lcposix" >&5
+ac_lib_var=`echo cposix'_'strerror | 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
-  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:705: 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:756: 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:788: 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 799 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lcposix  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 746 "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 strerror();
 
-main(){return(0);}
+int main() {
+strerror()
+; return 0; }
 EOF
-if { (eval echo configure:804: \"$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
+if { (eval echo configure:757: \"$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
   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:830: 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:835: 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:844: \"$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:863: 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
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
 
 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
-
-echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:895: 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
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; 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
+  LIBS="$LIBS -lcposix"
 else
   echo "$ac_t""no" 1>&6
-  ISC=
 fi
 
+  
+
 
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
@@ -924,7 +788,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:928: checking for a BSD compatible install" >&5
+echo "configure:792: 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
@@ -977,7 +841,7 @@
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:981: checking whether build environment is sane" >&5
+echo "configure:845: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -1034,7 +898,7 @@
 test "$program_transform_name" = "" && program_transform_name="s,x,x,"
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1038: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:902: 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
@@ -1063,7 +927,7 @@
 
 PACKAGE=bfd
 
-VERSION=2.9.5
+VERSION=2.10.91
 
 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
   { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
@@ -1080,7 +944,7 @@
 
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1084: checking for working aclocal" >&5
+echo "configure:948: checking for working aclocal" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1093,7 +957,7 @@
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1097: checking for working autoconf" >&5
+echo "configure:961: checking for working autoconf" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1106,7 +970,7 @@
 fi
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1110: checking for working automake" >&5
+echo "configure:974: checking for working automake" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1119,7 +983,7 @@
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1123: checking for working autoheader" >&5
+echo "configure:987: checking for working autoheader" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1132,7 +996,7 @@
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1136: checking for working makeinfo" >&5
+echo "configure:1000: checking for working makeinfo" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1155,7 +1019,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:1159: checking for $ac_word" >&5
+echo "configure:1023: 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
@@ -1187,7 +1051,7 @@
 # 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:1191: checking for $ac_word" >&5
+echo "configure:1055: 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
@@ -1219,7 +1083,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:1223: checking for $ac_word" >&5
+echo "configure:1087: 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
@@ -1322,36 +1186,228 @@
   enable_fast_install=yes
 fi
 
-# Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
+# 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:1329: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+echo "configure:1193: 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 "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+  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_RANLIB="ranlib"
+      ac_cv_prog_CC="gcc"
       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
+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:1223: 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:1274: 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:1306: 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 1317 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1322: \"$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:1348: 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:1353: 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:1362: \"$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:1381: 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
+
 # Check whether --with-gnu-ld or --without-gnu-ld was given.
 if test "${with_gnu_ld+set}" = set; then
   withval="$with_gnu_ld"
@@ -1364,8 +1420,14 @@
 if test "$ac_cv_prog_gcc" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
   echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1368: checking for ld used by GCC" >&5
-  ac_prog=`($CC -print-prog-name=ld) 2>&5`
+echo "configure:1424: checking for ld used by GCC" >&5
+  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]:[\\/]*)
@@ -1388,10 +1450,10 @@
   esac
 elif test "$with_gnu_ld" = yes; then
   echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1392: checking for GNU ld" >&5
+echo "configure:1454: checking for GNU ld" >&5
 else
   echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1395: checking for non-GNU ld" >&5
+echo "configure:1457: checking for non-GNU ld" >&5
 fi
 if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1426,7 +1488,7 @@
 fi
 test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
 echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1430: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1492: checking if the linker ($LD) is GNU ld" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1439,10 +1501,23 @@
 fi
 
 echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6
+with_gnu_ld=$ac_cv_prog_gnu_ld
 
 
+echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
+echo "configure:1509: checking for $LD option to reload object files" >&5
+if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+
+echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1446: checking for BSD-compatible nm" >&5
+echo "configure:1521: checking for BSD-compatible nm" >&5
 if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1453,18 +1528,20 @@
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
     test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
+    tmp_nm=$ac_dir/${ac_tool_prefix}nm
+    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
       # Check to see if the nm accepts a BSD-compat flag.
       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
       #   nm: unknown option "B" ignored
-      if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
-	ac_cv_path_NM="$ac_dir/nm -B"
+      # Tru64's nm complains that /dev/null is an invalid object file
+      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+	ac_cv_path_NM="$tmp_nm -B"
 	break
-      elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
-	ac_cv_path_NM="$ac_dir/nm -p"
+      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+	ac_cv_path_NM="$tmp_nm -p"
 	break
       else
-	ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+	ac_cv_path_NM=${ac_cv_path_NM="$tmp_nm"} # keep the first match, but
 	continue # so that we can try to find one that supports BSD flags
       fi
     fi
@@ -1478,7 +1555,7 @@
 echo "$ac_t""$NM" 1>&6
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1482: checking whether ln -s works" >&5
+echo "configure:1559: 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
@@ -1498,12 +1575,478 @@
   echo "$ac_t""no" 1>&6
 fi
 
+echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
+echo "configure:1580: checking how to recognise dependant libraries" >&5
+if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
 
-case "$target" in
-NONE) lt_target="$host" ;;
-*) lt_target="$target" ;;
+case "$host_os" in
+aix4*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi4*)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+    lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin* | mingw* |pw32*)
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+freebsd* )
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case "$host_cpu" in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+            lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+            lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20*)
+  # TODO:  Does this work for hpux-11 too?
+  lt_cv_deplibs_check_method='file_magic (s0-90-90-9|PA-RISC0-9.0-9) shared library'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libc.sl
+  ;;
+
+irix5* | irix6*)
+  case "$host_os" in
+  irix5*)
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+    ;;
+  *)
+    case "$LD" in
+    *-32|*"-32 ") libmagic=32-bit;;
+    *-n32|*"-n32 ") libmagic=N32;;
+    *-64|*"-64 ") libmagic=64-bit;;
+    *) libmagic=never-match;;
+    esac
+    # this will be overridden with pass_all, but let us keep it just in case
+        lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
+        ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  case "$host_cpu" in
+  alpha* | i*86 | powerpc* | sparc* | ia64* )
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+        lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
+      esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then :
+  else
+        lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+        lt_cv_file_magic_cmd='/usr/bin/file -L'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  # this will be overridden with pass_all, but let us keep it just in case
+  lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  lt_cv_file_magic_test_file=/lib/libc.so
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case "$host_vendor" in
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  motorola)
+        lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+        lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  esac
+  ;;
 esac
 
+fi
+
+echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+
+echo $ac_n "checking for object suffix""... $ac_c" 1>&6
+echo "configure:1723: checking for object suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  rm -f conftest*
+echo 'int i = 1;' > conftest.$ac_ext
+if { (eval echo configure:1729: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  for ac_file in conftest.*; do
+    case $ac_file in
+    *.c) ;;
+    *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
+    esac
+  done
+else
+  { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_objext" 1>&6
+OBJEXT=$ac_cv_objext
+ac_objext=$ac_cv_objext
+
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:1749: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  ac_cv_exeext=.exe
+else
+  rm -f conftest*
+  echo 'int main () { return 0; }' > conftest.$ac_ext
+  ac_cv_exeext=
+  if { (eval echo configure:1759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+    for file in conftest.*; do
+      case $file in
+      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+      esac
+    done
+  else
+    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+  fi
+  rm -f conftest*
+  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+
+# Only perform the check for file, if the check method requires it
+case "$deplibs_check_method" in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
+echo "configure:1786: checking for ${ac_tool_prefix}file" >&5
+if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$MAGIC_CMD" in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="/usr/bin:$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case "$deplibs_check_method" in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$ac_t""$MAGIC_CMD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    echo $ac_n "checking for file""... $ac_c" 1>&6
+echo "configure:1848: checking for file" >&5
+if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$MAGIC_CMD" in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="/usr/bin:$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case "$deplibs_check_method" in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$ac_t""$MAGIC_CMD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+# 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:1919: 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:1951: 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
+
+# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1986: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # 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_STRIP="${ac_tool_prefix}strip"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+  echo "$ac_t""$STRIP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_STRIP"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2018: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # 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_STRIP="strip"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+  echo "$ac_t""$STRIP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  STRIP=":"
+fi
+fi
+
+
 # Check for any special flags to pass to ltconfig.
 libtool_flags="--cache-file=$cache_file"
 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
@@ -1522,13 +2065,24 @@
 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
 
+# Check whether --with-pic or --without-pic was given.
+if test "${with_pic+set}" = set; then
+  withval="$with_pic"
+  pic_mode="$withval"
+else
+  pic_mode=default
+fi
+
+test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
+test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
+
 # Some flags need to be propagated to the compiler or linker for good
 # libtool support.
-case "$lt_target" in
+case "$host" in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 1531 "configure"' > conftest.$ac_ext
-  if { (eval echo configure:1532: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  echo '#line 2085 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:2086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case "`/usr/bin/file conftest.o`" in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -1549,19 +2103,27 @@
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:1553: checking whether the C compiler needs -belf" >&5
+echo "configure:2107: checking whether the C compiler needs -belf" >&5
 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1558 "configure"
+  
+     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 2120 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2127: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   lt_cv_cc_needs_belf=yes
 else
@@ -1571,6 +2133,13 @@
   lt_cv_cc_needs_belf=no
 fi
 rm -f 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
+
 fi
 
 echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
@@ -1634,12 +2203,14 @@
 
 
 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
-CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
-LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
-DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
-$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
 || { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
 
 # Reload cache, that may have been modified by ltconfig
@@ -1653,7 +2224,7 @@
 
 
 # This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
 
 # Always use our own libtool.
 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
@@ -1663,6 +2234,12 @@
 exec 5>>./config.log
 
 
+  
+
+  
+	 
+	 
+
 # Check whether --enable-64-bit-bfd or --disable-64-bit-bfd was given.
 if test "${enable_64_bit_bfd+set}" = set; then
   enableval="$enable_64_bit_bfd"
@@ -1756,7 +2333,7 @@
 
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:1760: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:2337: 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"
@@ -1778,72 +2355,10 @@
   MAINT=$MAINTAINER_MODE_TRUE
   
 
-echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:1783: 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 1788 "configure"
-#include "confdefs.h"
-
-int main() {
-
-#ifndef __CYGWIN__
-#define __CYGWIN__ __CYGWIN32__
-#endif
-return __CYGWIN__;
-; return 0; }
-EOF
-if { (eval echo configure:1799: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ac_cv_cygwin=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_cygwin=no
-fi
-rm -f conftest*
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_cygwin" 1>&6
-CYGWIN=
-test "$ac_cv_cygwin" = yes && CYGWIN=yes
-echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:1816: 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 1821 "configure"
-#include "confdefs.h"
-
-int main() {
-return __MINGW32__;
-; return 0; }
-EOF
-if { (eval echo configure:1828: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ac_cv_mingw32=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_mingw32=no
-fi
-rm -f conftest*
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_mingw32" 1>&6
-MINGW32=
-test "$ac_cv_mingw32" = yes && MINGW32=yes
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1847: checking for executable suffix" >&5
+echo "configure:2362: checking for executable suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1853,7 +2368,7 @@
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:1857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:2372: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
@@ -1882,7 +2397,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:1886: checking for $ac_word" >&5
+echo "configure:2401: 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
@@ -1912,7 +2427,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:1916: checking for $ac_word" >&5
+echo "configure:2431: 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
@@ -1963,7 +2478,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:1967: checking for $ac_word" >&5
+echo "configure:2482: 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
@@ -1995,7 +2510,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1999: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2514: 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.
@@ -2006,12 +2521,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 2010 "configure"
+#line 2525 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:2015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2530: \"$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
@@ -2037,12 +2552,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:2041: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2556: 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:2046: checking whether we are using GNU C" >&5
+echo "configure:2561: 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
@@ -2051,7 +2566,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2055: \"$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:2570: \"$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
@@ -2070,7 +2585,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2074: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2589: 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
@@ -2104,7 +2619,7 @@
 
 ALL_LINGUAS=
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2108: checking how to run the C preprocessor" >&5
+echo "configure:2623: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -2119,13 +2634,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 2123 "configure"
+#line 2638 "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:2129: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2644: \"$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
   :
@@ -2136,13 +2651,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 2140 "configure"
+#line 2655 "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:2146: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2661: \"$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
   :
@@ -2153,13 +2668,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 2157 "configure"
+#line 2672 "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:2163: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2678: \"$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
   :
@@ -2183,13 +2698,43 @@
 fi
 echo "$ac_t""$CPP" 1>&6
 
+# 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:2705: 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
+
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2188: checking for ANSI C header files" >&5
+echo "configure:2733: 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 2193 "configure"
+#line 2738 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2197,7 +2742,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2201: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2746: \"$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*
@@ -2214,7 +2759,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 2218 "configure"
+#line 2763 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2232,7 +2777,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 2236 "configure"
+#line 2781 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -2253,7 +2798,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 2257 "configure"
+#line 2802 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2264,7 +2809,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:2268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2813: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2288,12 +2833,12 @@
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2292: checking for working const" >&5
+echo "configure:2837: 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 2297 "configure"
+#line 2842 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2342,7 +2887,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2346: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2891: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -2363,21 +2908,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2367: checking for inline" >&5
+echo "configure:2912: 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 2374 "configure"
+#line 2919 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:2381: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2926: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -2403,12 +2948,12 @@
 esac
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2407: checking for off_t" >&5
+echo "configure:2952: 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 2412 "configure"
+#line 2957 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2436,12 +2981,12 @@
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2440: checking for size_t" >&5
+echo "configure:2985: 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 2445 "configure"
+#line 2990 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2471,19 +3016,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:2475: checking for working alloca.h" >&5
+echo "configure:3020: 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 2480 "configure"
+#line 3025 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:2487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3032: \"$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
@@ -2504,12 +3049,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:2508: checking for alloca" >&5
+echo "configure:3053: 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 2513 "configure"
+#line 3058 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -2537,7 +3082,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:2541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3086: \"$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
@@ -2569,12 +3114,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2573: checking whether alloca needs Cray hooks" >&5
+echo "configure:3118: 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 2578 "configure"
+#line 3123 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -2599,12 +3144,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:2603: checking for $ac_func" >&5
+echo "configure:3148: 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 2608 "configure"
+#line 3153 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2627,7 +3172,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3176: \"$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
@@ -2654,7 +3199,7 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2658: checking stack direction for C alloca" >&5
+echo "configure:3203: 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
@@ -2662,7 +3207,7 @@
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 2666 "configure"
+#line 3211 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -2681,7 +3226,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:2685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3230: \"$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
@@ -2706,17 +3251,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2710: checking for $ac_hdr" >&5
+echo "configure:3255: 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 2715 "configure"
+#line 3260 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2720: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3265: \"$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*
@@ -2745,12 +3290,12 @@
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2749: checking for $ac_func" >&5
+echo "configure:3294: 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 2754 "configure"
+#line 3299 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2773,7 +3318,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3322: \"$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
@@ -2798,7 +3343,7 @@
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:2802: checking for working mmap" >&5
+echo "configure:3347: 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
@@ -2806,7 +3351,7 @@
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 2810 "configure"
+#line 3355 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -2946,7 +3491,7 @@
 }
 
 EOF
-if { (eval echo configure:2950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3495: \"$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
@@ -2974,17 +3519,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2978: checking for $ac_hdr" >&5
+echo "configure:3523: 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 2983 "configure"
+#line 3528 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2988: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3533: \"$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*
@@ -3014,12 +3559,12 @@
 __argz_count __argz_stringify __argz_next
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3018: checking for $ac_func" >&5
+echo "configure:3563: 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 3023 "configure"
+#line 3568 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3042,7 +3587,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3591: \"$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
@@ -3071,12 +3616,12 @@
      for ac_func in stpcpy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3075: checking for $ac_func" >&5
+echo "configure:3620: 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 3080 "configure"
+#line 3625 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3099,7 +3644,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3648: \"$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
@@ -3133,19 +3678,19 @@
 
    if test $ac_cv_header_locale_h = yes; then
     echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3137: checking for LC_MESSAGES" >&5
+echo "configure:3682: 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 3142 "configure"
+#line 3687 "configure"
 #include "confdefs.h"
 #include <locale.h>
 int main() {
 return LC_MESSAGES
 ; return 0; }
 EOF
-if { (eval echo configure:3149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   am_cv_val_LC_MESSAGES=yes
 else
@@ -3166,7 +3711,7 @@
     fi
   fi
    echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3170: checking whether NLS is requested" >&5
+echo "configure:3715: 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"
@@ -3186,7 +3731,7 @@
 EOF
 
       echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3190: checking whether included gettext is requested" >&5
+echo "configure:3735: 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"
@@ -3205,17 +3750,17 @@
 
 	ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3209: checking for libintl.h" >&5
+echo "configure:3754: 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 3214 "configure"
+#line 3759 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3219: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3764: \"$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*
@@ -3232,19 +3777,19 @@
 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:3236: checking for gettext in libc" >&5
+echo "configure:3781: 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 3241 "configure"
+#line 3786 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   gt_cv_func_gettext_libc=yes
 else
@@ -3260,7 +3805,7 @@
 
 	   if test "$gt_cv_func_gettext_libc" != "yes"; then
 	     echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:3264: checking for bindtextdomain in -lintl" >&5
+echo "configure:3809: 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
@@ -3268,7 +3813,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lintl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3272 "configure"
+#line 3817 "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
@@ -3279,7 +3824,7 @@
 bindtextdomain()
 ; return 0; }
 EOF
-if { (eval echo configure:3283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3828: \"$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
@@ -3295,19 +3840,19 @@
 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:3299: checking for gettext in libintl" >&5
+echo "configure:3844: 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 3304 "configure"
+#line 3849 "configure"
 #include "confdefs.h"
 
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3311: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   gt_cv_func_gettext_libintl=yes
 else
@@ -3335,7 +3880,7 @@
 	      # 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:3339: checking for $ac_word" >&5
+echo "configure:3884: 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
@@ -3369,12 +3914,12 @@
 		for ac_func in dcgettext
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3373: checking for $ac_func" >&5
+echo "configure:3918: 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 3378 "configure"
+#line 3923 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3397,7 +3942,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3946: \"$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
@@ -3424,7 +3969,7 @@
 		# 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:3428: checking for $ac_word" >&5
+echo "configure:3973: 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
@@ -3460,7 +4005,7 @@
 		# 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:3464: checking for $ac_word" >&5
+echo "configure:4009: 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
@@ -3492,7 +4037,7 @@
 fi
 
 		cat > conftest.$ac_ext <<EOF
-#line 3496 "configure"
+#line 4041 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3500,7 +4045,7 @@
 			       return _nl_msg_cat_cntr
 ; return 0; }
 EOF
-if { (eval echo configure:3504: \"$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*
   CATOBJEXT=.gmo
 		   DATADIRNAME=share
@@ -3532,7 +4077,7 @@
         # 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:3536: checking for $ac_word" >&5
+echo "configure:4081: 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
@@ -3566,7 +4111,7 @@
         # 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:3570: checking for $ac_word" >&5
+echo "configure:4115: 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
@@ -3602,7 +4147,7 @@
         # 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:3606: checking for $ac_word" >&5
+echo "configure:4151: 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
@@ -3692,7 +4237,7 @@
        LINGUAS=
      else
        echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:3696: checking for catalogs to be installed" >&5
+echo "configure:4241: checking for catalogs to be installed" >&5
        NEW_LINGUAS=
        for lang in ${LINGUAS=$ALL_LINGUAS}; do
          case "$ALL_LINGUAS" in
@@ -3720,17 +4265,17 @@
       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:3724: checking for linux/version.h" >&5
+echo "configure:4269: 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 3729 "configure"
+#line 4274 "configure"
 #include "confdefs.h"
 #include <linux/version.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3734: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4279: \"$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*
@@ -3808,7 +4353,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:3812: checking for a BSD compatible install" >&5
+echo "configure:4357: 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
@@ -3891,7 +4436,7 @@
   EXEEXT_FOR_BUILD='$(EXEEXT)'
 else
   echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6
-echo "configure:3895: checking for build system executable suffix" >&5
+echo "configure:4440: checking for build system executable suffix" >&5
 if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3919,17 +4464,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3923: checking for $ac_hdr" >&5
+echo "configure:4468: 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 3928 "configure"
+#line 4473 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3933: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4478: \"$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*
@@ -3959,17 +4504,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3963: checking for $ac_hdr" >&5
+echo "configure:4508: 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 3968 "configure"
+#line 4513 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3973: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4518: \"$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*
@@ -3996,12 +4541,12 @@
 done
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:4000: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:4545: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4005 "configure"
+#line 4550 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -4010,7 +4555,7 @@
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:4014: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4559: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -4035,12 +4580,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:4039: checking for $ac_hdr that defines DIR" >&5
+echo "configure:4584: 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 4044 "configure"
+#line 4589 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -4048,7 +4593,7 @@
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:4052: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4597: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -4073,7 +4618,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:4077: checking for opendir in -ldir" >&5
+echo "configure:4622: 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
@@ -4081,7 +4626,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4085 "configure"
+#line 4630 "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
@@ -4092,7 +4637,7 @@
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4641: \"$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
@@ -4114,7 +4659,7 @@
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4118: checking for opendir in -lx" >&5
+echo "configure:4663: 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
@@ -4122,7 +4667,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4126 "configure"
+#line 4671 "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
@@ -4133,7 +4678,7 @@
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4682: \"$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
@@ -4158,12 +4703,12 @@
 for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4162: checking for $ac_func" >&5
+echo "configure:4707: 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 4167 "configure"
+#line 4712 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4186,7 +4731,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4735: \"$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
@@ -4221,12 +4766,12 @@
 esac
 
 echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6
-echo "configure:4225: checking whether strstr must be declared" >&5
+echo "configure:4770: 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 4230 "configure"
+#line 4775 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4247,7 +4792,7 @@
 char *(*pfn) = (char *(*)) strstr
 ; return 0; }
 EOF
-if { (eval echo configure:4251: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4796: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_strstr=no
 else
@@ -4268,12 +4813,12 @@
 fi
 
 echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6
-echo "configure:4272: checking whether malloc must be declared" >&5
+echo "configure:4817: 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 4277 "configure"
+#line 4822 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4294,7 +4839,7 @@
 char *(*pfn) = (char *(*)) malloc
 ; return 0; }
 EOF
-if { (eval echo configure:4298: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4843: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_malloc=no
 else
@@ -4315,12 +4860,12 @@
 fi
 
 echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6
-echo "configure:4319: checking whether realloc must be declared" >&5
+echo "configure:4864: 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 4324 "configure"
+#line 4869 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4341,7 +4886,7 @@
 char *(*pfn) = (char *(*)) realloc
 ; return 0; }
 EOF
-if { (eval echo configure:4345: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4890: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_realloc=no
 else
@@ -4362,12 +4907,12 @@
 fi
 
 echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6
-echo "configure:4366: checking whether free must be declared" >&5
+echo "configure:4911: 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 4371 "configure"
+#line 4916 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4388,7 +4933,7 @@
 char *(*pfn) = (char *(*)) free
 ; return 0; }
 EOF
-if { (eval echo configure:4392: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4937: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_free=no
 else
@@ -4409,12 +4954,12 @@
 fi
 
 echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6
-echo "configure:4413: checking whether getenv must be declared" >&5
+echo "configure:4958: checking whether getenv must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4418 "configure"
+#line 4963 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4435,7 +4980,7 @@
 char *(*pfn) = (char *(*)) getenv
 ; return 0; }
 EOF
-if { (eval echo configure:4439: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4984: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_getenv=no
 else
@@ -4462,6 +5007,9 @@
 TRAD_HEADER=
 if test "${target}" = "${host}"; then
   case "${host}" in
+  alpha*-*-freebsd*)
+	COREFILE=''
+	;;
   alpha*-*-linux-gnu*)
 	COREFILE=trad-core.lo
 	TRAD_HEADER='"hosts/alphalinux.h"'
@@ -4645,17 +5193,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4649: checking for $ac_hdr" >&5
+echo "configure:5197: 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 4654 "configure"
+#line 5202 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4659: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5207: \"$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*
@@ -4683,19 +5231,21 @@
 
   if test "$ac_cv_header_sys_procfs_h" = yes; then
     echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4687: checking for prstatus_t in sys/procfs.h" >&5
+echo "configure:5235: checking for prstatus_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4692 "configure"
+#line 5240 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 prstatus_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prstatus_t=yes
 else
@@ -4716,20 +5266,58 @@
  fi
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6
 
+    echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6
+echo "configure:5271: checking for prstatus32_t in sys/procfs.h" >&5
+ if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5276 "configure"
+#include "confdefs.h"
+
+#define _SYSCALL32
+#include <sys/procfs.h>
+int main() {
+prstatus32_t avar
+; return 0; }
+EOF
+if { (eval echo configure:5285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_prstatus32_t=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_prstatus32_t=no
+   
+fi
+rm -f conftest*
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_prstatus32_t = yes; then
+   cat >> confdefs.h <<\EOF
+#define HAVE_PRSTATUS32_T 1
+EOF
+
+ fi
+ echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6
+
     echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4721: checking for prstatus_t.pr_who in sys/procfs.h" >&5
+echo "configure:5307: checking for prstatus_t.pr_who in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4726 "configure"
+#line 5312 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 prstatus_t avar; void* aref = (void*) &avar.pr_who
 ; return 0; }
 EOF
-if { (eval echo configure:4733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5321: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes
 else
@@ -4750,20 +5338,58 @@
  fi
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6
 
+    echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6
+echo "configure:5343: checking for prstatus32_t.pr_who in sys/procfs.h" >&5
+ if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5348 "configure"
+#include "confdefs.h"
+
+#define _SYSCALL32
+#include <sys/procfs.h>
+int main() {
+prstatus32_t avar; void* aref = (void*) &avar.pr_who
+; return 0; }
+EOF
+if { (eval echo configure:5357: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=no
+   
+fi
+rm -f conftest*
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who = yes; then
+   cat >> confdefs.h <<\EOF
+#define HAVE_PRSTATUS32_T_PR_WHO 1
+EOF
+
+ fi
+ echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6
+
     echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4755: checking for pstatus_t in sys/procfs.h" >&5
+echo "configure:5379: 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 4760 "configure"
+#line 5384 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 pstatus_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4767: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5393: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_pstatus_t=yes
 else
@@ -4784,20 +5410,94 @@
  fi
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6
 
+    echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6
+echo "configure:5415: checking for pxstatus_t in sys/procfs.h" >&5
+ if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5420 "configure"
+#include "confdefs.h"
+
+#define _SYSCALL32
+#include <sys/procfs.h>
+int main() {
+pxstatus_t avar
+; return 0; }
+EOF
+if { (eval echo configure:5429: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_pxstatus_t=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_pxstatus_t=no
+   
+fi
+rm -f conftest*
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_pxstatus_t = yes; then
+   cat >> confdefs.h <<\EOF
+#define HAVE_PXSTATUS_T 1
+EOF
+
+ fi
+ echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6
+
+    echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6
+echo "configure:5451: checking for pstatus32_t in sys/procfs.h" >&5
+ if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5456 "configure"
+#include "confdefs.h"
+
+#define _SYSCALL32
+#include <sys/procfs.h>
+int main() {
+pstatus32_t avar
+; return 0; }
+EOF
+if { (eval echo configure:5465: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_pstatus32_t=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_pstatus32_t=no
+   
+fi
+rm -f conftest*
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_pstatus32_t = yes; then
+   cat >> confdefs.h <<\EOF
+#define HAVE_PSTATUS32_T 1
+EOF
+
+ fi
+ echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6
+
     echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4789: checking for prpsinfo_t in sys/procfs.h" >&5
+echo "configure:5487: checking for prpsinfo_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4794 "configure"
+#line 5492 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 prpsinfo_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4801: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5501: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prpsinfo_t=yes
 else
@@ -4818,20 +5518,58 @@
  fi
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6
 
+    echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6
+echo "configure:5523: checking for prpsinfo32_t in sys/procfs.h" >&5
+ if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5528 "configure"
+#include "confdefs.h"
+
+#define _SYSCALL32
+#include <sys/procfs.h>
+int main() {
+prpsinfo32_t avar
+; return 0; }
+EOF
+if { (eval echo configure:5537: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_prpsinfo32_t=no
+   
+fi
+rm -f conftest*
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_prpsinfo32_t = yes; then
+   cat >> confdefs.h <<\EOF
+#define HAVE_PRPSINFO32_T 1
+EOF
+
+ fi
+ echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6
+
     echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4823: checking for psinfo_t in sys/procfs.h" >&5
+echo "configure:5559: checking for psinfo_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4828 "configure"
+#line 5564 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 psinfo_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4835: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5573: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_psinfo_t=yes
 else
@@ -4852,20 +5590,58 @@
  fi
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6
 
+    echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6
+echo "configure:5595: checking for psinfo32_t in sys/procfs.h" >&5
+ if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5600 "configure"
+#include "confdefs.h"
+
+#define _SYSCALL32
+#include <sys/procfs.h>
+int main() {
+psinfo32_t avar
+; return 0; }
+EOF
+if { (eval echo configure:5609: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_psinfo32_t=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_psinfo32_t=no
+   
+fi
+rm -f conftest*
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_psinfo32_t = yes; then
+   cat >> confdefs.h <<\EOF
+#define HAVE_PSINFO32_T 1
+EOF
+
+ fi
+ echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6
+
     echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4857: checking for lwpstatus_t in sys/procfs.h" >&5
+echo "configure:5631: checking for lwpstatus_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4862 "configure"
+#line 5636 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 lwpstatus_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5645: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_lwpstatus_t=yes
 else
@@ -4886,20 +5662,58 @@
  fi
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6
 
+    echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6
+echo "configure:5667: checking for lwpxstatus_t in sys/procfs.h" >&5
+ if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5672 "configure"
+#include "confdefs.h"
+
+#define _SYSCALL32
+#include <sys/procfs.h>
+int main() {
+lwpxstatus_t avar
+; return 0; }
+EOF
+if { (eval echo configure:5681: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_lwpxstatus_t=no
+   
+fi
+rm -f conftest*
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_lwpxstatus_t = yes; then
+   cat >> confdefs.h <<\EOF
+#define HAVE_LWPXSTATUS_T 1
+EOF
+
+ fi
+ echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6
+
     echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4891: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5
+echo "configure:5703: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4896 "configure"
+#line 5708 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 lwpstatus_t avar; void* aref = (void*) &avar.pr_context
 ; return 0; }
 EOF
-if { (eval echo configure:4903: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5717: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes
 else
@@ -4921,19 +5735,21 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6
 
     echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4925: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5
+echo "configure:5739: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4930 "configure"
+#line 5744 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 lwpstatus_t avar; void* aref = (void*) &avar.pr_reg
 ; return 0; }
 EOF
-if { (eval echo configure:4937: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5753: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes
 else
@@ -4955,19 +5771,21 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6
 
     echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4959: checking for win32_pstatus_t in sys/procfs.h" >&5
+echo "configure:5775: checking for win32_pstatus_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_pstatus_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4964 "configure"
+#line 5780 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 win32_pstatus_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4971: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5789: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes
 else
@@ -5081,7 +5899,7 @@
 # Target backend .o files.
 tb=
 
-elf="elf.lo elflink.lo dwarf2.lo dwarf1.lo"
+elf="elf.lo elflink.lo dwarf1.lo"
 
 for vec in $selvecs
 do
@@ -5120,6 +5938,7 @@
 				target64=true ;;
     bfd_elf64_ia64_big_vec)	tb="$tb elf64-ia64.lo elf64.lo $elf"
 				target64=true ;;
+    bfd_elf32_ia64_big_vec)	tb="$tb elf32-ia64.lo elf32.lo $elf" ;;
     bfd_elf32_avr_vec)		tb="$tb elf32-avr.lo elf32.lo $elf" ;;
     bfd_elf32_littlearc_vec)	tb="$tb elf32-arc.lo elf32.lo $elf" ;;
     bfd_elf32_littlearm_vec)	tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
@@ -5131,19 +5950,25 @@
     bfd_elf32_bigmips_vec) 	tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf64_bigmips_vec) 	tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"
 				target64=true ;;
+    bfd_elf32_cris_vec)		tb="$tb elf32-cris.lo elf32.lo $elf" ;;
+    bfd_elf32_us_cris_vec)	tb="$tb elf32-cris.lo elf32.lo $elf" ;;
     bfd_elf32_d10v_vec)		tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
     bfd_elf32_d30v_vec)		tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
     bfd_elf32_fr30_vec)		tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
     bfd_elf32_hppa_vec)		tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
     bfd_elf32_i370_vec)		tb="$tb elf32-i370.lo elf32.lo $elf" ;;
     bfd_elf32_i386_vec)		tb="$tb elf32-i386.lo elf32.lo $elf" ;;
+    bfd_elf64_x86_64_vec)	tb="$tb elf64-x86-64.lo elf64.lo $elf" ;;
     bfd_elf32_i860_vec)		tb="$tb elf32-i860.lo elf32.lo $elf" ;;
+    bfd_elf32_i860_little_vec)	tb="$tb elf32-i860.lo elf32.lo $elf" ;;
     bfd_elf32_i960_vec)		tb="$tb elf32-i960.lo elf32.lo $elf" ;;
     bfd_elf32_little_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
     bfd_elf32_littlemips_vec) 	tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf64_littlemips_vec) 	tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"
 				target64=true ;;
     bfd_elf32_m32r_vec)		tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
+    bfd_elf32_m68hc11_vec)	tb="$tb elf32-m68hc11.lo elf32.lo $elf" ;;
+    bfd_elf32_m68hc12_vec)	tb="$tb elf32-m68hc12.lo elf32.lo $elf" ;;
     bfd_elf32_m68k_vec)		tb="$tb elf32-m68k.lo elf32.lo $elf" ;;
     bfd_elf32_m88k_vec)		tb="$tb elf32-m88k.lo elf32.lo $elf" ;;
     bfd_elf32_mcore_big_vec)	tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
@@ -5156,7 +5981,11 @@
     bfd_elf32_powerpcle_vec)	tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
     bfd_elf32_sh_vec)		tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
     bfd_elf32_shl_vec)		tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
+    bfd_elf32_shlin_vec)	tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+    bfd_elf32_shblin_vec)	tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
     bfd_elf32_sparc_vec)	tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
+    bfd_elf32_tradbigmips_vec)  tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
+    bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf32_v850_vec)		tb="$tb elf32-v850.lo elf32.lo $elf" ;;
     bfd_elf64_big_generic_vec) 	tb="$tb elf64-gen.lo elf64.lo $elf"
 				target64=true ;;
@@ -5166,6 +5995,7 @@
 				target64=true ;;
     cisco_core_big_vec)		tb="$tb cisco-core.lo" ;;
     cisco_core_little_vec)	tb="$tb cisco-core.lo" ;;
+    cris_aout_vec)		tb="$tb aout-cris.lo" ;;
     demo_64_vec)		tb="$tb demo64.lo aout64.lo"
 				target64=true ;;
     ecoff_big_vec)		tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
@@ -5236,8 +6066,8 @@
     shlcoff_vec)		tb="$tb coff-sh.lo cofflink.lo" ;;
     shcoff_small_vec)		tb="$tb coff-sh.lo cofflink.lo" ;;
     shlcoff_small_vec)		tb="$tb coff-sh.lo cofflink.lo" ;;
-    shlpe_vec)			tb="$tb pe-sh.lo coff-sh.lo cofflink.lo" ;;
-    shlpei_vec)			tb="$tb pei-sh.lo coff-sh.lo cofflink.lo" ;;
+    shlpe_vec)			tb="$tb pe-sh.lo coff-sh.lo peigen.lo cofflink.lo" ;;
+    shlpei_vec)			tb="$tb pei-sh.lo coff-sh.lo peigen.lo cofflink.lo" ;;
     som_vec)			tb="$tb som.lo" ;;
     sparcle_aout_vec)		tb="$tb aout-sparcle.lo aout32.lo" ;;
     sparclinux_vec)		tb="$tb sparclinux.lo aout32.lo" ;;
@@ -5346,17 +6176,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5350: checking for $ac_hdr" >&5
+echo "configure:6180: 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 5355 "configure"
+#line 6185 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5360: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6190: \"$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*
@@ -5385,12 +6215,12 @@
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5389: checking for $ac_func" >&5
+echo "configure:6219: 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 5394 "configure"
+#line 6224 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5413,7 +6243,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6247: \"$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
@@ -5438,7 +6268,7 @@
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:5442: checking for working mmap" >&5
+echo "configure:6272: 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
@@ -5446,7 +6276,7 @@
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 5450 "configure"
+#line 6280 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -5586,7 +6416,7 @@
 }
 
 EOF
-if { (eval echo configure:5590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6420: \"$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
@@ -5611,12 +6441,12 @@
 for ac_func in madvise mprotect
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5615: checking for $ac_func" >&5
+echo "configure:6445: 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 5620 "configure"
+#line 6450 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5639,7 +6469,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6473: \"$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
@@ -5819,7 +6649,6 @@
 s%@build_cpu@%$build_cpu%g
 s%@build_vendor@%$build_vendor%g
 s%@build_os@%$build_os%g
-s%@CC@%$CC%g
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
 s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
@@ -5833,13 +6662,16 @@
 s%@SET_MAKE@%$SET_MAKE%g
 s%@AR@%$AR%g
 s%@RANLIB@%$RANLIB%g
+s%@CC@%$CC%g
 s%@LN_S@%$LN_S%g
+s%@OBJEXT@%$OBJEXT%g
+s%@EXEEXT@%$EXEEXT%g
+s%@STRIP@%$STRIP%g
 s%@LIBTOOL@%$LIBTOOL%g
 s%@WARN_CFLAGS@%$WARN_CFLAGS%g
 s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
 s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
 s%@MAINT@%$MAINT%g
-s%@EXEEXT@%$EXEEXT%g
 s%@CPP@%$CPP%g
 s%@ALLOCA@%$ALLOCA%g
 s%@USE_NLS@%$USE_NLS%g
diff --git a/bfd/configure.host b/bfd/configure.host
index bd5391c..c72a4b3 100644
--- a/bfd/configure.host
+++ b/bfd/configure.host
@@ -48,6 +48,10 @@
 
 m68*-hp-hpux*)		HDEFINES=-DHOST_HP300HPUX ;;
 
+*-*-aix*)		HOST_64BIT_TYPE="long long"
+			HOST_U_64BIT_TYPE="unsigned long long"
+			;;
+
 *-*-solaris*)		HOST_64BIT_TYPE="long long"
 			HOST_U_64BIT_TYPE="unsigned long long"
 			;;
diff --git a/bfd/configure.in b/bfd/configure.in
index 4cc84de..0c7fd42 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -7,7 +7,7 @@
 AC_CANONICAL_SYSTEM
 AC_ISC_POSIX
 
-AM_INIT_AUTOMAKE(bfd, 2.9.5)
+AM_INIT_AUTOMAKE(bfd, 2.10.91)
 
 dnl These must be called before AM_PROG_LIBTOOL, because it may want
 dnl to call AC_CHECK_PROG.
@@ -135,6 +135,9 @@
 TRAD_HEADER=
 if test "${target}" = "${host}"; then
   case "${host}" in
+  alpha*-*-freebsd*)
+	COREFILE=''
+	;;
   alpha*-*-linux-gnu*)
 	COREFILE=trad-core.lo
 	TRAD_HEADER='"hosts/alphalinux.h"'
@@ -339,11 +342,18 @@
   AC_CHECK_HEADERS(sys/procfs.h)
   if test "$ac_cv_header_sys_procfs_h" = yes; then
     BFD_HAVE_SYS_PROCFS_TYPE(prstatus_t)
+    BFD_HAVE_SYS_PROCFS_TYPE(prstatus32_t)
     BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prstatus_t, pr_who)
+    BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prstatus32_t, pr_who)
     BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t)
+    BFD_HAVE_SYS_PROCFS_TYPE(pxstatus_t)
+    BFD_HAVE_SYS_PROCFS_TYPE(pstatus32_t)
     BFD_HAVE_SYS_PROCFS_TYPE(prpsinfo_t)
+    BFD_HAVE_SYS_PROCFS_TYPE(prpsinfo32_t)
     BFD_HAVE_SYS_PROCFS_TYPE(psinfo_t)
+    BFD_HAVE_SYS_PROCFS_TYPE(psinfo32_t)
     BFD_HAVE_SYS_PROCFS_TYPE(lwpstatus_t)
+    BFD_HAVE_SYS_PROCFS_TYPE(lwpxstatus_t)
     BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_context)
     BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_reg)
     BFD_HAVE_SYS_PROCFS_TYPE(win32_pstatus_t)
@@ -438,7 +448,7 @@
 # Target backend .o files.
 tb=
 
-elf="elf.lo elflink.lo dwarf2.lo dwarf1.lo"
+elf="elf.lo elflink.lo dwarf1.lo"
 
 for vec in $selvecs
 do
@@ -477,6 +487,7 @@
 				target64=true ;;
     bfd_elf64_ia64_big_vec)	tb="$tb elf64-ia64.lo elf64.lo $elf"
 				target64=true ;;
+    bfd_elf32_ia64_big_vec)	tb="$tb elf32-ia64.lo elf32.lo $elf" ;;
     bfd_elf32_avr_vec)		tb="$tb elf32-avr.lo elf32.lo $elf" ;;
     bfd_elf32_littlearc_vec)	tb="$tb elf32-arc.lo elf32.lo $elf" ;;
     bfd_elf32_littlearm_vec)	tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
@@ -488,19 +499,25 @@
     bfd_elf32_bigmips_vec) 	tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf64_bigmips_vec) 	tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"
 				target64=true ;;
+    bfd_elf32_cris_vec)		tb="$tb elf32-cris.lo elf32.lo $elf" ;;
+    bfd_elf32_us_cris_vec)	tb="$tb elf32-cris.lo elf32.lo $elf" ;;
     bfd_elf32_d10v_vec)		tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
     bfd_elf32_d30v_vec)		tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
     bfd_elf32_fr30_vec)		tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
     bfd_elf32_hppa_vec)		tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
     bfd_elf32_i370_vec)		tb="$tb elf32-i370.lo elf32.lo $elf" ;;
     bfd_elf32_i386_vec)		tb="$tb elf32-i386.lo elf32.lo $elf" ;;
+    bfd_elf64_x86_64_vec)	tb="$tb elf64-x86-64.lo elf64.lo $elf" ;;
     bfd_elf32_i860_vec)		tb="$tb elf32-i860.lo elf32.lo $elf" ;;
+    bfd_elf32_i860_little_vec)	tb="$tb elf32-i860.lo elf32.lo $elf" ;;
     bfd_elf32_i960_vec)		tb="$tb elf32-i960.lo elf32.lo $elf" ;;
     bfd_elf32_little_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
     bfd_elf32_littlemips_vec) 	tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf64_littlemips_vec) 	tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"
 				target64=true ;;
     bfd_elf32_m32r_vec)		tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
+    bfd_elf32_m68hc11_vec)	tb="$tb elf32-m68hc11.lo elf32.lo $elf" ;;
+    bfd_elf32_m68hc12_vec)	tb="$tb elf32-m68hc12.lo elf32.lo $elf" ;;
     bfd_elf32_m68k_vec)		tb="$tb elf32-m68k.lo elf32.lo $elf" ;;
     bfd_elf32_m88k_vec)		tb="$tb elf32-m88k.lo elf32.lo $elf" ;;
     bfd_elf32_mcore_big_vec)	tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
@@ -513,7 +530,11 @@
     bfd_elf32_powerpcle_vec)	tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
     bfd_elf32_sh_vec)		tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
     bfd_elf32_shl_vec)		tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
+    bfd_elf32_shlin_vec)	tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+    bfd_elf32_shblin_vec)	tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
     bfd_elf32_sparc_vec)	tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
+    bfd_elf32_tradbigmips_vec)  tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
+    bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
     bfd_elf32_v850_vec)		tb="$tb elf32-v850.lo elf32.lo $elf" ;;
     bfd_elf64_big_generic_vec) 	tb="$tb elf64-gen.lo elf64.lo $elf"
 				target64=true ;;
@@ -523,6 +544,7 @@
 				target64=true ;;
     cisco_core_big_vec)		tb="$tb cisco-core.lo" ;;
     cisco_core_little_vec)	tb="$tb cisco-core.lo" ;;
+    cris_aout_vec)		tb="$tb aout-cris.lo" ;;
     demo_64_vec)		tb="$tb demo64.lo aout64.lo"
 				target64=true ;;
     ecoff_big_vec)		tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
@@ -593,8 +615,8 @@
     shlcoff_vec)		tb="$tb coff-sh.lo cofflink.lo" ;;
     shcoff_small_vec)		tb="$tb coff-sh.lo cofflink.lo" ;;
     shlcoff_small_vec)		tb="$tb coff-sh.lo cofflink.lo" ;;
-    shlpe_vec)			tb="$tb pe-sh.lo coff-sh.lo cofflink.lo" ;;
-    shlpei_vec)			tb="$tb pei-sh.lo coff-sh.lo cofflink.lo" ;;
+    shlpe_vec)			tb="$tb pe-sh.lo coff-sh.lo peigen.lo cofflink.lo" ;;
+    shlpei_vec)			tb="$tb pei-sh.lo coff-sh.lo peigen.lo cofflink.lo" ;;
     som_vec)			tb="$tb som.lo" ;;
     sparcle_aout_vec)		tb="$tb aout-sparcle.lo aout32.lo" ;;
     sparclinux_vec)		tb="$tb sparclinux.lo aout32.lo" ;;
diff --git a/bfd/corefile.c b/bfd/corefile.c
index 212f519..061383f 100644
--- a/bfd/corefile.c
+++ b/bfd/corefile.c
@@ -30,7 +30,6 @@
 #include "sysdep.h"
 #include "libbfd.h"
 
-
 /*
 FUNCTION
 	bfd_core_file_failing_command
@@ -78,7 +77,6 @@
   return BFD_SEND (abfd, _core_file_failing_signal, (abfd));
 }
 
-
 /*
 FUNCTION
 	core_file_matches_executable_p
diff --git a/bfd/cpu-a29k.c b/bfd/cpu-a29k.c
index 5bd25a4..5b79937 100644
--- a/bfd/cpu-a29k.c
+++ b/bfd/cpu-a29k.c
@@ -33,7 +33,7 @@
     "a29k",
     4,
     true, /* the one and only */
-    bfd_default_compatible, 
+    bfd_default_compatible,
     bfd_default_scan ,
     0,
   };
diff --git a/bfd/cpu-alpha.c b/bfd/cpu-alpha.c
index b89900b..48a16e3 100644
--- a/bfd/cpu-alpha.c
+++ b/bfd/cpu-alpha.c
@@ -40,7 +40,7 @@
 #define NN(index) (&arch_info_struct[index])
 
 /* These exist only so that we can resonably disassemble PALcode.  */
-static const bfd_arch_info_type arch_info_struct[] = 
+static const bfd_arch_info_type arch_info_struct[] =
 {
   N (64, 64, bfd_mach_alpha_ev4, "alpha:ev4", false, NN(1)),
   N (64, 64, bfd_mach_alpha_ev5, "alpha:ev5", false, NN(2)),
diff --git a/bfd/cpu-arm.c b/bfd/cpu-arm.c
index bda9c44..91507f8 100644
--- a/bfd/cpu-arm.c
+++ b/bfd/cpu-arm.c
@@ -47,7 +47,7 @@
      it can be polymorphed into the other */
   if (a->the_default)
     return b;
-  
+
   if (b->the_default)
     return a;
 
@@ -93,9 +93,10 @@
   { bfd_mach_arm_4,  "strongarm"},
   { bfd_mach_arm_4,  "strongarm110" },
   { bfd_mach_arm_4,  "strongarm1100" },
+  { bfd_mach_arm_XScale, "xscale" }
 };
 
-static boolean 
+static boolean
 scan (info, string)
      const struct bfd_arch_info * info;
      const char * string;
@@ -119,16 +120,15 @@
   /* Finally check for the default architecture */
   if (strcasecmp (string, "arm") == 0)
     return info->the_default;
-  
+
   return false;
 }
 
-
 #define N(number, print, default, next)  \
 {  32, 32, 8, bfd_arch_arm, number, "arm", print, 4, default, compatible, scan, next }
 
 static const bfd_arch_info_type arch_info_struct[] =
-{ 
+{
   N( bfd_mach_arm_2,  "armv2",  false, & arch_info_struct[1] ),
   N( bfd_mach_arm_2a, "armv2a", false, & arch_info_struct[2] ),
   N( bfd_mach_arm_3,  "armv3",  false, & arch_info_struct[3] ),
@@ -136,7 +136,9 @@
   N( bfd_mach_arm_4,  "armv4",  false, & arch_info_struct[5] ),
   N( bfd_mach_arm_4T, "armv4t", false, & arch_info_struct[6] ),
   N( bfd_mach_arm_5,  "armv5",  false, & arch_info_struct[7] ),
-  N( bfd_mach_arm_5T, "armv5t", false, NULL )
+  N( bfd_mach_arm_5T, "armv5t", false, & arch_info_struct[8] ),
+  N( bfd_mach_arm_5TE, "armv5te", false, & arch_info_struct[9] ),
+  N( bfd_mach_arm_XScale, "xscale", false, NULL )
 };
 
 const bfd_arch_info_type bfd_arm_arch =
diff --git a/bfd/cpu-avr.c b/bfd/cpu-avr.c
index 637b13f..c86339d 100644
--- a/bfd/cpu-avr.c
+++ b/bfd/cpu-avr.c
@@ -22,11 +22,9 @@
 #include "sysdep.h"
 #include "libbfd.h"
 
-
 static const bfd_arch_info_type *compatible
   PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
 
-
 #define N(addr_bits, machine, print, default, next)		\
 {								\
   8,				/* 8 bits in a word */		\
@@ -45,17 +43,20 @@
 
 static const bfd_arch_info_type arch_info_struct[] =
 {
-  /* AT90S1200 */
+  /* AT90S1200, ATtiny1x, ATtiny28 */
   N (16, bfd_mach_avr1, "avr:1", false, & arch_info_struct[1]),
 
-  /* AT90S2xxx, AT90S4xxx, AT90S81xx, ATtiny22 */
+  /* AT90S2xxx, AT90S4xxx, AT90S8xxx, ATtiny22 */
   N (16, bfd_mach_avr2, "avr:2", false, & arch_info_struct[2]),
 
   /* ATmega103, ATmega603 */
   N (22, bfd_mach_avr3, "avr:3", false, & arch_info_struct[3]),
 
-  /* ATmega161 */
-  N (16, bfd_mach_avr4, "avr:4", false, NULL)
+  /* ATmega83, ATmega85 */
+  N (16, bfd_mach_avr4, "avr:4", false, & arch_info_struct[4]),
+
+  /* ATmega161, ATmega163, ATmega32, AT94K */
+  N (22, bfd_mach_avr5, "avr:5", false, NULL)
 };
 
 const bfd_arch_info_type bfd_avr_arch =
@@ -74,7 +75,7 @@
   if (a->arch != b->arch)
     return NULL;
 
-  /* Special case for ATmega[16]03 (avr:3) and ATmega161 (avr:4).  */
+  /* Special case for ATmega[16]03 (avr:3) and ATmega83 (avr:4).  */
   if ((a->mach == 3 && b->mach == 4)
       || (a->mach == 4 && b->mach == 3))
     return NULL;
@@ -84,6 +85,9 @@
   if (a->mach <= b->mach)
     return b;
 
+  if (a->mach >= b->mach)
+    return a;
+
   /* Never reached!  */
   return NULL;
 }
diff --git a/bfd/cpu-cris.c b/bfd/cpu-cris.c
new file mode 100644
index 0000000..423da6e
--- /dev/null
+++ b/bfd/cpu-cris.c
@@ -0,0 +1,57 @@
+/* BFD support for the Axis CRIS architecture.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Contributed by Axis Communications AB.
+   Written by Hans-Peter Nilsson.
+
+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 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 "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+
+const bfd_arch_info_type
+bfd_cris_arch =
+{
+  32,				/* There's 32 bits_per_word.  */
+  32,				/* There's 32 bits_per_address.  */
+  8,				/* There's 8 bits_per_byte.  */
+  bfd_arch_cris,		/* One of enum bfd_architecture, defined
+				   in archures.c and provided in
+				   generated header files.  */
+  0xff,				/* Only 1 machine, but #255 for
+				   historical reasons.  */
+  "cris",			/* The arch_name.  */
+  "cris",			/* The printable name is the same.  */
+  1,				/* Section alignment power; each section
+				   is aligned to (only) 2^1 bytes.  */
+  true,				/* This is the default "machine", since
+				   there's only one.  */
+  bfd_default_compatible,	/* A default function for testing
+				   "machine" compatibility of two
+				   bfd_arch_info_type.  */
+  bfd_default_scan,		/* Check if an bfd_arch_info_type is a
+				   match.  */
+  NULL				/* Pointer to next bfd_arch_info_type in
+				   the same family.  */
+};
+
+/*
+ * Local variables:
+ * eval: (c-set-style "gnu")
+ * indent-tabs-mode: t
+ * End:
+ */
diff --git a/bfd/cpu-d10v.c b/bfd/cpu-d10v.c
index e16c3b7..868cbcf 100644
--- a/bfd/cpu-d10v.c
+++ b/bfd/cpu-d10v.c
@@ -22,50 +22,50 @@
 #include "sysdep.h"
 #include "libbfd.h"
 
-static const bfd_arch_info_type d10v_ts3_info = 
-{					
-  16,	/* 16 bits in a word */		
-  16,	/* 16 bits in an address */	
-  8,	/* 8 bits in a byte */		
-  bfd_arch_d10v,
-  bfd_mach_d10v_ts3,		
-  "d10v",				
-  "d10v:ts3",				
-  4, /* section alignment power */	
-  false,				
-  bfd_default_compatible, 		
-  bfd_default_scan,			
-  0,				
-};
-
-static const bfd_arch_info_type d10v_ts2_info = 
+static const bfd_arch_info_type d10v_ts3_info =
 {
-  16,	/* 16 bits in a word */		
-  16,	/* 16 bits in an address */	
-  8,	/* 8 bits in a byte */		
+  16,	/* 16 bits in a word */
+  16,	/* 16 bits in an address */
+  8,	/* 8 bits in a byte */
   bfd_arch_d10v,
-  bfd_mach_d10v_ts2,		
-  "d10v",				
-  "d10v:ts2",				
-  4, /* section alignment power */	
-  false,				
-  bfd_default_compatible, 		
-  bfd_default_scan,			
-  &d10v_ts3_info,				
+  bfd_mach_d10v_ts3,
+  "d10v",
+  "d10v:ts3",
+  4, /* section alignment power */
+  false,
+  bfd_default_compatible,
+  bfd_default_scan,
+  0,
 };
 
-const bfd_arch_info_type bfd_d10v_arch = 
-{					
-  16,	/* 16 bits in a word */		
-  16,	/* 16 bits in an address */	
-  8,	/* 8 bits in a byte */		
+static const bfd_arch_info_type d10v_ts2_info =
+{
+  16,	/* 16 bits in a word */
+  16,	/* 16 bits in an address */
+  8,	/* 8 bits in a byte */
   bfd_arch_d10v,
-  bfd_mach_d10v,		
-  "d10v",				
-  "d10v",				
-  4, /* section alignment power */	
-  true,				
-  bfd_default_compatible, 		
-  bfd_default_scan,			
-  &d10v_ts2_info,				
+  bfd_mach_d10v_ts2,
+  "d10v",
+  "d10v:ts2",
+  4, /* section alignment power */
+  false,
+  bfd_default_compatible,
+  bfd_default_scan,
+  &d10v_ts3_info,
+};
+
+const bfd_arch_info_type bfd_d10v_arch =
+{
+  16,	/* 16 bits in a word */
+  16,	/* 16 bits in an address */
+  8,	/* 8 bits in a byte */
+  bfd_arch_d10v,
+  bfd_mach_d10v,
+  "d10v",
+  "d10v",
+  4, /* section alignment power */
+  true,
+  bfd_default_compatible,
+  bfd_default_scan,
+  &d10v_ts2_info,
 };
diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c
index 567b7df..9a4047d 100644
--- a/bfd/cpu-h8300.c
+++ b/bfd/cpu-h8300.c
@@ -65,15 +65,14 @@
     }
 }
 
-
-/* This routine is provided two arch_infos and works out the 
-   machine which would be compatible with both and returns a pointer
-   to its info structure */
+/* This routine is provided two arch_infos and works out the machine
+   which would be compatible with both and returns a pointer to its
+   info structure.  */
 
 static const bfd_arch_info_type *
 compatible (in, out)
-     const bfd_arch_info_type * in;
-     const bfd_arch_info_type * out;
+     const bfd_arch_info_type *in;
+     const bfd_arch_info_type *out;
 {
   /* It's really not a good idea to mix and match modes.  */
   if (in->mach != out->mach)
@@ -95,7 +94,9 @@
   true,				/* the default machine */
   compatible,
   h8300_scan,
-/*    local_bfd_reloc_type_lookup, */
+#if 0
+  local_bfd_reloc_type_lookup,
+#endif
   0,
 };
 
@@ -112,7 +113,9 @@
   false,			/* the default machine */
   compatible,
   h8300_scan,
-/*    local_bfd_reloc_type_lookup, */
+#if 0
+  local_bfd_reloc_type_lookup,
+#endif
   &h8300_info_struct,
 };
 
@@ -129,6 +132,8 @@
   false,			/* the default machine */
   compatible,
   h8300_scan,
-/*    local_bfd_reloc_type_lookup, */
+#if 0
+  local_bfd_reloc_type_lookup,
+#endif
   &h8300h_info_struct,
 };
diff --git a/bfd/cpu-h8500.c b/bfd/cpu-h8500.c
index eae42e3..143217c 100644
--- a/bfd/cpu-h8500.c
+++ b/bfd/cpu-h8500.c
@@ -24,11 +24,11 @@
 
 #if 0
 
-/* 
+/*
 Relocations for the Z8K
 
 */
-static bfd_reloc_status_type 
+static bfd_reloc_status_type
 howto16_callback (abfd, reloc_entry, symbol_in, data,
 		  ignore_input_section, ignore_bfd)
      bfd *abfd;
@@ -40,18 +40,17 @@
 {
   long relocation = 0;
   bfd_vma addr = reloc_entry->address;
-  long x = bfd_get_16(abfd, (bfd_byte *)data + addr);
+  long x = bfd_get_16 (abfd, (bfd_byte *)data + addr);
 
   HOWTO_PREPARE(relocation, symbol_in);
 
   x = (x + relocation + reloc_entry->addend);
 
-  bfd_put_16(abfd, x, (bfd_byte *)data + addr);
+  bfd_put_16 (abfd, x, (bfd_byte *)data + addr);
   return bfd_reloc_ok;
 }
 
-
-static bfd_reloc_status_type 
+static bfd_reloc_status_type
 howto8_callback (abfd, reloc_entry, symbol_in, data,
 		 ignore_input_section, ignore_bfd)
      bfd *abfd;
@@ -63,18 +62,17 @@
 {
   long relocation = 0;
   bfd_vma addr = reloc_entry->address;
-  long x = bfd_get_8(abfd, (bfd_byte *)data + addr);
+  long x = bfd_get_8 (abfd, (bfd_byte *)data + addr);
 
   HOWTO_PREPARE(relocation, symbol_in);
 
   x = (x + relocation + reloc_entry->addend);
 
-  bfd_put_8(abfd, x, (bfd_byte *)data + addr);
+  bfd_put_8 (abfd, x, (bfd_byte *)data + addr);
   return bfd_reloc_ok;
 }
 
-
-static bfd_reloc_status_type 
+static bfd_reloc_status_type
 howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data,
 		      ignore_input_section, ignore_bfd)
      bfd *abfd;
@@ -87,17 +85,17 @@
   long relocation = 0;
   bfd_vma addr = reloc_entry->address;
 
-  long x = bfd_get_8(abfd, (bfd_byte *)data + addr);
-  abort();
+  long x = bfd_get_8 (abfd, (bfd_byte *)data + addr);
+  abort ();
   HOWTO_PREPARE(relocation, symbol_in);
 
   x = (x + relocation + reloc_entry->addend);
 
-  bfd_put_8(abfd, x, (bfd_byte *)data + addr);
+  bfd_put_8 (abfd, x, (bfd_byte *)data + addr);
   return bfd_reloc_ok;
 }
 
-static bfd_reloc_status_type 
+static bfd_reloc_status_type
 howto8_pcrel_callback (abfd, reloc_entry, symbol_in, data,
 		       ignore_input_section, ignore_bfd)
      bfd *abfd;
@@ -109,18 +107,16 @@
 {
   long relocation = 0;
   bfd_vma addr = reloc_entry->address;
-  long x = bfd_get_8(abfd, (bfd_byte *)data + addr);
-  abort();
+  long x = bfd_get_8 (abfd, (bfd_byte *)data + addr);
+  abort ();
   HOWTO_PREPARE(relocation, symbol_in);
 
   x = (x + relocation + reloc_entry->addend);
 
-  bfd_put_8(abfd, x, (bfd_byte *)data + addr);
+  bfd_put_8 (abfd, x, (bfd_byte *)data + addr);
   return bfd_reloc_ok;
 }
 
-
-
 static reloc_howto_type howto_16
   = NEWHOWTO(howto16_callback,"abs16",1,false,false);
 static reloc_howto_type howto_8
@@ -132,7 +128,6 @@
 static reloc_howto_type howto_8_pcrel
   = NEWHOWTO(howto8_pcrel_callback,"pcrel8",0,false,true);
 
-
 static reloc_howto_type *
 local_bfd_reloc_type_lookup (arch, code)
      const struct bfd_arch_info *arch;
@@ -154,7 +149,7 @@
 
 int bfd_default_scan_num_mach();
 
-static boolean 
+static boolean
 scan_mach (info, string)
      const struct bfd_arch_info *info ATTRIBUTE_UNUSED;
      const char *string;
@@ -166,7 +161,6 @@
   return false;
 }
 
-
 #if 0 /* not used currently */
 /* This routine is provided two arch_infos and returns whether
    they'd be compatible */
diff --git a/bfd/cpu-hppa.c b/bfd/cpu-hppa.c
index 5c17743..3f80756 100644
--- a/bfd/cpu-hppa.c
+++ b/bfd/cpu-hppa.c
@@ -32,7 +32,7 @@
   "hppa1.0",
   3,
   true,				/* Unless we use 1.1 specific features */
-  bfd_default_compatible, 
+  bfd_default_compatible,
   bfd_default_scan ,
   0,
 };
@@ -49,7 +49,7 @@
   "hppa2.0",
   3,
   false,			/* Unless we use 1.1 specific features */
-  bfd_default_compatible, 
+  bfd_default_compatible,
   bfd_default_scan ,
   &bfd_hppa10_arch,
 };
@@ -66,7 +66,7 @@
   "hppa2.0w",
   3,
   false,			/* Unless we use 1.1 specific features */
-  bfd_default_compatible, 
+  bfd_default_compatible,
   bfd_default_scan ,
   &bfd_hppa20_arch,
 };
@@ -82,7 +82,7 @@
   "hppa1.1",
   3,
   false,			/* 1.1 specific features used */
-  bfd_default_compatible, 
+  bfd_default_compatible,
   bfd_default_scan ,
   &bfd_hppa20w_arch,
 };
diff --git a/bfd/cpu-i370.c b/bfd/cpu-i370.c
index 2331eef..b07a4c7 100644
--- a/bfd/cpu-i370.c
+++ b/bfd/cpu-i370.c
@@ -46,7 +46,7 @@
 
 static const bfd_arch_info_type arch_info_struct[] =
 {
-  /* hack alert: old old machines are really 16 and 24 bit arch ... */
+  /* hack alert: old old machines are really 16 and 24 bit arch ...  */
   {
     32, /* 32 bits in a word */
     32, /* 32 bits in an address */
diff --git a/bfd/cpu-i386.c b/bfd/cpu-i386.c
index f5b9b18..4fbf523 100644
--- a/bfd/cpu-i386.c
+++ b/bfd/cpu-i386.c
@@ -32,10 +32,25 @@
   "i386:intel",
   3,
   true,
-  bfd_default_compatible, 
+  bfd_default_compatible,
   bfd_default_scan ,
   0,
 };
+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,
+  "x86_64:intel",
+  "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 */
@@ -47,9 +62,25 @@
   "i8086",
   3,
   false,
+  bfd_default_compatible,
+  bfd_default_scan ,
+  &bfd_x86_64_arch_intel_syntax,
+};
+
+const bfd_arch_info_type bfd_x86_64_arch =
+{
+  64, /* 32 bits in a word */
+  64, /* 32 bits in an address */
+  8,  /* 8 bits in a byte */
+  bfd_arch_i386,
+  bfd_mach_x86_64,
+  "x86_64",
+  "x86_64",
+  3,
+  true,
   bfd_default_compatible, 
   bfd_default_scan ,
-  &bfd_i386_arch_intel_syntax,
+  &i8086_arch,
 };
 
 const bfd_arch_info_type bfd_i386_arch =
@@ -63,8 +94,8 @@
   "i386",
   3,
   true,
-  bfd_default_compatible, 
+  bfd_default_compatible,
   bfd_default_scan ,
-  &i8086_arch,
+  &bfd_x86_64_arch 
 };
 
diff --git a/bfd/cpu-i860.c b/bfd/cpu-i860.c
index 57c867c..7445e5f 100644
--- a/bfd/cpu-i860.c
+++ b/bfd/cpu-i860.c
@@ -1,5 +1,5 @@
 /* BFD support for the Intel 860 architecture.
-   Copyright 1992, 1995 Free Software Foundation, Inc.
+   Copyright 1992, 1995, 2000 Free Software Foundation, Inc.
    Created mostly by substituting "860" for "386" in cpu-i386.c
    Harry Dolan <dolan@ssd.intel.com>, October 1995
 
@@ -25,16 +25,16 @@
 
 const bfd_arch_info_type bfd_i860_arch =
   {
-    32,	/* 32 bits in a word */
-    32,	/* 32 bits in an address */
-    8,	/* 8 bits in a byte */
-    bfd_arch_i860,
-    0,	/* only 1 machine */
-    "i860",
-    "i860",
-    3,
-    true, /* the one and only */
-    bfd_default_compatible, 
-    bfd_default_scan ,
-    0,
+    32,				/* 32 bits in a word */
+    32,				/* 32 bits in an address */
+    8,				/* 8 bits in a byte */
+    bfd_arch_i860,		/* Architecture */
+    0,				/* Only one machine */
+    "i860",			/* Architecture name */
+    "i860",			/* Printable name */
+    3,				/* Section alignment exponent */
+    true,			/* Is this the default architecture? */
+    bfd_default_compatible,
+    bfd_default_scan,
+    0,				/* Next in list */
   };
diff --git a/bfd/cpu-i960.c b/bfd/cpu-i960.c
index 2374b2f..071d2a0 100644
--- a/bfd/cpu-i960.c
+++ b/bfd/cpu-i960.c
@@ -18,12 +18,10 @@
 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"
 
-
 /* This routine is provided a string, and tries to work out if it
    could possibly refer to the i960 machine pointed at in the
    info_struct pointer */
@@ -36,7 +34,7 @@
   unsigned long machine;
   int i;
   int fail_because_not_80960 = false;
-  
+
   for (i = 0; i < strlen (string); i ++)
     string[i] = tolower (string[i]);
 
@@ -48,7 +46,7 @@
       /* i960 on it's own means core to us.  */
       if (* string == 0)
 	return ap->mach == bfd_mach_i960_core;
-      
+
       /* "i960:*" is valid, anything else is not.  */
       if (* string != ':')
 	return false;
@@ -68,10 +66,10 @@
   /* No match, can't be us.  */
   else
     return false;
-  
+
   if (* string == '\0')
     return false;
-  
+
   if (string[0] == 'c' && string[1] == 'o' && string[2] == 'r' &&
       string[3] == 'e' && string[4] == '\0')
     machine = bfd_mach_i960_core;
@@ -104,15 +102,13 @@
 
   if (fail_because_not_80960)
     return false;
-  
+
   if (machine == ap->mach)
     return true;
-  
+
   return false;
 }
 
-
-
 /* This routine is provided two arch_infos and works out the i960
    machine which would be compatible with both and returns a pointer
    to its info structure */
@@ -124,17 +120,17 @@
 {
 
   /* The i960 has distinct subspecies which may not interbreed:
-	CORE CA          
+	CORE CA
 	CORE KA KB MC XA
 	CORE HX JX
      Any architecture on the same line is compatible, the one on
-     the right is the least restrictive.  
-     
+     the right is the least restrictive.
+
      We represent this information in an array, each machine to a side */
 
 #define ERROR	0
-#define CORE	bfd_mach_i960_core  /*1*/  
-#define KA 	bfd_mach_i960_ka_sa /*2*/ 
+#define CORE	bfd_mach_i960_core  /*1*/
+#define KA 	bfd_mach_i960_ka_sa /*2*/
 #define KB 	bfd_mach_i960_kb_sb /*3*/
 #define MC 	bfd_mach_i960_mc    /*4*/
 #define XA 	bfd_mach_i960_xa    /*5*/
@@ -143,7 +139,7 @@
 #define HX	bfd_mach_i960_hx    /*8*/
 #define MAX_ARCH ((int)HX)
 
-  static CONST unsigned long matrix[MAX_ARCH+1][MAX_ARCH+1] = 
+  static CONST unsigned long matrix[MAX_ARCH+1][MAX_ARCH+1] =
     {
       { ERROR,	CORE,	KA,	KB,	MC,	XA,	CA,	JX,	HX },
       { CORE,	CORE,	KA,	KB,	MC,	XA,	CA,	JX,	HX },
@@ -156,25 +152,22 @@
       { HX,	HX,	ERROR,	ERROR,	ERROR,	ERROR,	ERROR,	HX,	HX },
     };
 
-
-  if (a->arch != b->arch || matrix[a->mach][b->mach] == ERROR) 
+  if (a->arch != b->arch || matrix[a->mach][b->mach] == ERROR)
     {
     return NULL;
     }
-  else 
+  else
     {
     return (a->mach  ==  matrix[a->mach][b->mach]) ?  a : b;
     }
 }
 
-
-
 int bfd_default_scan_num_mach();
 #define N(a,b,d,n) \
 { 32, 32, 8,bfd_arch_i960,a,"i960",b,3,d,compatible,scan_960_mach,n,}
 
-static const bfd_arch_info_type arch_info_struct[] = 
-{ 
+static const bfd_arch_info_type arch_info_struct[] =
+{
   N(bfd_mach_i960_ka_sa,"i960:ka_sa",false, &arch_info_struct[1]),
   N(bfd_mach_i960_kb_sb,"i960:kb_sb",false, &arch_info_struct[2]),
   N(bfd_mach_i960_mc,   "i960:mc",   false, &arch_info_struct[3]),
diff --git a/bfd/cpu-ia64-opc.c b/bfd/cpu-ia64-opc.c
index 130dbe7..84774d2 100644
--- a/bfd/cpu-ia64-opc.c
+++ b/bfd/cpu-ia64-opc.c
@@ -17,7 +17,6 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-
 /* Logically, this code should be part of libopcode but since some of
    the operand insertion/extraction functions help bfd to implement
    relocations, this code is included as part of elf64-ia64.c.  This
@@ -32,25 +31,29 @@
 #define NELEMS(a)  ((int) (sizeof (a) / sizeof ((a)[0])))
 
 static const char*
-ins_rsvd (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
+ins_rsvd (const struct ia64_operand *self ATTRIBUTE_UNUSED,
+	  ia64_insn value ATTRIBUTE_UNUSED, ia64_insn *code ATTRIBUTE_UNUSED)
 {
   return "internal error---this shouldn't happen";
 }
 
 static const char*
-ext_rsvd (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
+ext_rsvd (const struct ia64_operand *self ATTRIBUTE_UNUSED,
+	  ia64_insn code ATTRIBUTE_UNUSED, ia64_insn *valuep ATTRIBUTE_UNUSED)
 {
   return "internal error---this shouldn't happen";
 }
 
 static const char*
-ins_const (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
+ins_const (const struct ia64_operand *self ATTRIBUTE_UNUSED,
+	   ia64_insn value ATTRIBUTE_UNUSED, ia64_insn *code ATTRIBUTE_UNUSED)
 {
   return 0;
 }
 
 static const char*
-ext_const (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
+ext_const (const struct ia64_operand *self ATTRIBUTE_UNUSED,
+	   ia64_insn code ATTRIBUTE_UNUSED, ia64_insn *valuep ATTRIBUTE_UNUSED)
 {
   return 0;
 }
@@ -134,7 +137,7 @@
 ins_imms_scaled (const struct ia64_operand *self, ia64_insn value,
 		 ia64_insn *code, int scale)
 {
-  BFD_HOST_64_BIT svalue = value, sign_bit;
+  BFD_HOST_64_BIT svalue = value, sign_bit = 0;
   ia64_insn new = 0;
   int i;
 
@@ -414,19 +417,19 @@
 const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] =
   {
     /* constants: */
-    { CST, ins_const, ext_const, "NIL",		{{ 0, }}, 0, "<none>" },
-    { CST, ins_const, ext_const, "ar.ccv",	{{ 0, }}, 0, "ar.ccv" },
-    { CST, ins_const, ext_const, "ar.pfs",	{{ 0, }}, 0, "ar.pfs" },
-    { CST, ins_const, ext_const, "1",		{{ 0, }}, 0, "1" },
-    { CST, ins_const, ext_const, "8",		{{ 0, }}, 0, "1" },
-    { CST, ins_const, ext_const, "16",		{{ 0, }}, 0, "16" },
-    { CST, ins_const, ext_const, "r0",		{{ 0, }}, 0, "r0" },
-    { CST, ins_const, ext_const, "ip",		{{ 0, }}, 0, "ip" },
-    { CST, ins_const, ext_const, "pr",		{{ 0, }}, 0, "pr" },
-    { CST, ins_const, ext_const, "pr.rot",	{{ 0, }}, 0, "pr.rot" },
-    { CST, ins_const, ext_const, "psr",		{{ 0, }}, 0, "psr" },
-    { CST, ins_const, ext_const, "psr.l",	{{ 0, }}, 0, "psr.l" },
-    { CST, ins_const, ext_const, "psr.um",	{{ 0, }}, 0, "psr.um" },
+    { CST, ins_const, ext_const, "NIL",		{{ 0, 0}}, 0, "<none>" },
+    { CST, ins_const, ext_const, "ar.ccv",	{{ 0, 0}}, 0, "ar.ccv" },
+    { CST, ins_const, ext_const, "ar.pfs",	{{ 0, 0}}, 0, "ar.pfs" },
+    { CST, ins_const, ext_const, "1",		{{ 0, 0}}, 0, "1" },
+    { CST, ins_const, ext_const, "8",		{{ 0, 0}}, 0, "1" },
+    { CST, ins_const, ext_const, "16",		{{ 0, 0}}, 0, "16" },
+    { CST, ins_const, ext_const, "r0",		{{ 0, 0}}, 0, "r0" },
+    { CST, ins_const, ext_const, "ip",		{{ 0, 0}}, 0, "ip" },
+    { CST, ins_const, ext_const, "pr",		{{ 0, 0}}, 0, "pr" },
+    { CST, ins_const, ext_const, "pr.rot",	{{ 0, 0}}, 0, "pr.rot" },
+    { CST, ins_const, ext_const, "psr",		{{ 0, 0}}, 0, "psr" },
+    { CST, ins_const, ext_const, "psr.l",	{{ 0, 0}}, 0, "psr.l" },
+    { CST, ins_const, ext_const, "psr.um",	{{ 0, 0}}, 0, "psr.um" },
 
     /* register operands: */
     { REG, ins_reg,   ext_reg,	"ar", {{ 7, 20}}, 0,		/* AR3 */
@@ -555,7 +558,7 @@
     { ABS, ins_imms16,ext_imms16,0, {{27,  6}, { 1, 36}}, 0,	/* IMM44 */
       "a 44-bit unsigned (least 16 bits ignored/zeroes)" },
     { ABS, ins_rsvd,  ext_rsvd,	0, {{0,  0}}, 0,		/* IMMU62 */
-      "a 62-bit unsigned" },        
+      "a 62-bit unsigned" },
     { ABS, ins_rsvd,  ext_rsvd,	0, {{0,  0}}, 0,		/* IMMU64 */
       "a 64-bit unsigned" },
     { ABS, ins_inc3,  ext_inc3,  0, {{ 3, 13}}, SDEC,		/* INC3 */
@@ -580,7 +583,7 @@
       {{ 7,  6}, {13, 20}, { 1, 36}}, 0,
       "a branch target" },
     { REL, ins_imms4, ext_imms4, 0, {{20, 13}, { 1, 36}}, 0,	/* TGT25c */
-      "a branch target" },         
-    { REL, ins_rsvd, ext_rsvd, 0, {{0, 0}}, 0,                  /* TGT64  */ 
+      "a branch target" },
+    { REL, ins_rsvd, ext_rsvd, 0, {{0, 0}}, 0,                  /* TGT64  */
       "a branch target" },
   };
diff --git a/bfd/cpu-ia64.c b/bfd/cpu-ia64.c
index 8069b1a..924e862 100644
--- a/bfd/cpu-ia64.c
+++ b/bfd/cpu-ia64.c
@@ -18,25 +18,40 @@
 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"
 
+const bfd_arch_info_type bfd_ia64_elf32_arch =
+  {
+    64,	/* 64 bits in a word */
+    32,	/* 32 bits in an address */
+    8,	/* 8 bits in a byte */
+    bfd_arch_ia64,
+    bfd_mach_ia64_elf32,
+    "ia64",
+    "ia64-elf32",
+    3,	/* log2 of section alignment */
+    true, /* the one and only */
+    bfd_default_compatible,
+    bfd_default_scan ,
+    0,
+  };
+
 const bfd_arch_info_type bfd_ia64_arch =
   {
     64,	/* 64 bits in a word */
     64,	/* 64 bits in an address */
     8,	/* 8 bits in a byte */
     bfd_arch_ia64,
-    0,	/* only 1 machine */
+    bfd_mach_ia64_elf64,
     "ia64",
-    "ia64",
+    "ia64-elf64",
     3,	/* log2 of section alignment */
     true, /* the one and only */
-    bfd_default_compatible, 
+    bfd_default_compatible,
     bfd_default_scan ,
-    0,
+    &bfd_ia64_elf32_arch,
   };
 
 #include "cpu-ia64-opc.c"
diff --git a/bfd/cpu-m32r.c b/bfd/cpu-m32r.c
index 895ad41..4902246 100644
--- a/bfd/cpu-m32r.c
+++ b/bfd/cpu-m32r.c
@@ -27,7 +27,7 @@
 
 #define NEXT NULL
 
-static const bfd_arch_info_type arch_info_struct[] = 
+static const bfd_arch_info_type arch_info_struct[] =
 {
   N (bfd_mach_m32rx, "m32rx", false, NULL)
 };
diff --git a/bfd/cpu-m68hc11.c b/bfd/cpu-m68hc11.c
new file mode 100644
index 0000000..2cf3bf5
--- /dev/null
+++ b/bfd/cpu-m68hc11.c
@@ -0,0 +1,39 @@
+/* BFD support for the Motorola 68HC11 processor
+   Copyright 1999, 2000 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 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 "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+
+const bfd_arch_info_type bfd_m68hc11_arch =
+{
+    16,	/* 16 bits in a word */
+    16,	/* 16 bits in an address */
+    8,	/* 8 bits in a byte */
+    bfd_arch_m68hc11,
+    0,
+    "m68hc11",
+    "m68hc11",
+    4, /* section alignment power */
+    true,
+    bfd_default_compatible,
+    bfd_default_scan,
+    0,
+};
+
diff --git a/bfd/cpu-m68hc12.c b/bfd/cpu-m68hc12.c
new file mode 100644
index 0000000..1810438
--- /dev/null
+++ b/bfd/cpu-m68hc12.c
@@ -0,0 +1,38 @@
+/* BFD support for the Motorola 68HC12 processor
+   Copyright 1999, 2000 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 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 "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+
+const bfd_arch_info_type bfd_m68hc12_arch =
+{
+    16,	/* 16 bits in a word */
+    16,	/* 16 bits in an address */
+    8,	/* 8 bits in a byte */
+    bfd_arch_m68hc12,
+    0,
+    "m68hc12",
+    "m68hc12",
+    4, /* section alignment power */
+    true,
+    bfd_default_compatible,
+    bfd_default_scan,
+    0,
+};
diff --git a/bfd/cpu-m68k.c b/bfd/cpu-m68k.c
index 184182d..6b67f18 100644
--- a/bfd/cpu-m68k.c
+++ b/bfd/cpu-m68k.c
@@ -27,7 +27,7 @@
 {  32, 32, 8, bfd_arch_m68k, name, "m68k",print,2,d,bfd_default_compatible,bfd_default_scan, next, }
 
 static const bfd_arch_info_type arch_info_struct[] =
-{ 
+{
   N(bfd_mach_m68000, "m68k:68000", false, &arch_info_struct[1]),
   N(bfd_mach_m68008, "m68k:68008", false, &arch_info_struct[2]),
   N(bfd_mach_m68010, "m68k:68010", false, &arch_info_struct[3]),
diff --git a/bfd/cpu-m88k.c b/bfd/cpu-m88k.c
index c3716c5..e5cc1a1 100644
--- a/bfd/cpu-m88k.c
+++ b/bfd/cpu-m88k.c
@@ -22,9 +22,6 @@
 #include "sysdep.h"
 #include "libbfd.h"
 
-
-
-
 const bfd_arch_info_type bfd_m88k_arch =
   {
     32,	/* 32 bits in a word */
@@ -36,7 +33,7 @@
     "m88k:88100",
     3,
     true, /* the one and only */
-    bfd_default_compatible, 
+    bfd_default_compatible,
     bfd_default_scan ,
     0,
   };
diff --git a/bfd/cpu-mips.c b/bfd/cpu-mips.c
index a933b8c..397e5a9 100644
--- a/bfd/cpu-mips.c
+++ b/bfd/cpu-mips.c
@@ -1,5 +1,5 @@
 /* bfd back-end for mips support
-   Copyright (C) 1990, 91-97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1990, 91-97, 1998, 2000 Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -38,46 +38,54 @@
     NEXT,						\
   }
 
-enum {
-I_mips3000, 
-I_mips3900, 
-I_mips4000, 
-I_mips4010, 
-I_mips4100, 
-I_mips4111,
-I_mips4300, 
-I_mips4400, 
-I_mips4600, 
-I_mips4650, 
-I_mips5000, 
-I_mips6000, 
-I_mips8000, 
-I_mips10000,
-I_mips16
+enum
+{
+  I_mips3000,
+  I_mips3900,
+  I_mips4000,
+  I_mips4010,
+  I_mips4100,
+  I_mips4111,
+  I_mips4300,
+  I_mips4400,
+  I_mips4600,
+  I_mips4650,
+  I_mips5000,
+  I_mips6000,
+  I_mips8000,
+  I_mips10000,
+  I_mips16,
+  I_mips32,
+  I_mips32_4k,
+  I_mips5,
+  I_mips64,
+  I_sb1,
 };
 
+#define NN(index) (&arch_info_struct[(index) + 1])
 
-#define NN(index) (&arch_info_struct[(index)+1])
-
-static const bfd_arch_info_type arch_info_struct[] = 
+static const bfd_arch_info_type arch_info_struct[] =
 {
-  N (32, 32, bfd_mach_mips3000, "mips:3000", false, NN(I_mips3000)),
-  N (32, 32, bfd_mach_mips3900, "mips:3900", false, NN(I_mips3900)),
-  N (64, 64, bfd_mach_mips4000, "mips:4000", false, NN(I_mips4000)),
-  N (64, 64, bfd_mach_mips4010, "mips:4010", false, NN(I_mips4010)),
-  N (64, 64, bfd_mach_mips4100, "mips:4100", false, NN(I_mips4100)),
-  N (64, 64, bfd_mach_mips4111, "mips:4111", false, NN(I_mips4111)),
-  N (64, 64, bfd_mach_mips4300, "mips:4300", false, NN(I_mips4300)),
-  N (64, 64, bfd_mach_mips4400, "mips:4400", false, NN(I_mips4400)),
-  N (64, 64, bfd_mach_mips4600, "mips:4600", false, NN(I_mips4600)),
-  N (64, 64, bfd_mach_mips4650, "mips:4650", false, NN(I_mips4650)),
-  N (64, 64, bfd_mach_mips5000, "mips:5000", false, NN(I_mips5000)),
-  N (32, 32, bfd_mach_mips6000, "mips:6000", false, NN(I_mips6000)),
-  N (64, 64, bfd_mach_mips8000, "mips:8000", false, NN(I_mips8000)),
-  N (64, 64, bfd_mach_mips10000, "mips:10000", false, NN(I_mips10000)),
-
-
-  N (64, 64, bfd_mach_mips16,   "mips:16",   false, 0),
+  N (32, 32, bfd_mach_mips3000, "mips:3000",      false, NN(I_mips3000)),
+  N (32, 32, bfd_mach_mips3900, "mips:3900",      false, NN(I_mips3900)),
+  N (64, 64, bfd_mach_mips4000, "mips:4000",      false, NN(I_mips4000)),
+  N (64, 64, bfd_mach_mips4010, "mips:4010",      false, NN(I_mips4010)),
+  N (64, 64, bfd_mach_mips4100, "mips:4100",      false, NN(I_mips4100)),
+  N (64, 64, bfd_mach_mips4111, "mips:4111",      false, NN(I_mips4111)),
+  N (64, 64, bfd_mach_mips4300, "mips:4300",      false, NN(I_mips4300)),
+  N (64, 64, bfd_mach_mips4400, "mips:4400",      false, NN(I_mips4400)),
+  N (64, 64, bfd_mach_mips4600, "mips:4600",      false, NN(I_mips4600)),
+  N (64, 64, bfd_mach_mips4650, "mips:4650",      false, NN(I_mips4650)),
+  N (64, 64, bfd_mach_mips5000, "mips:5000",      false, NN(I_mips5000)),
+  N (32, 32, bfd_mach_mips6000, "mips:6000",      false, NN(I_mips6000)),
+  N (64, 64, bfd_mach_mips8000, "mips:8000",      false, NN(I_mips8000)),
+  N (64, 64, bfd_mach_mips10000,"mips:10000",     false, NN(I_mips10000)),
+  N (64, 64, bfd_mach_mips16,   "mips:16",        false, NN(I_mips16)),
+  N (32, 32, bfd_mach_mips32,   "mips:mips32",    false, NN(I_mips32)),
+  N (32, 32, bfd_mach_mips32_4k,"mips:mips32-4k", false, NN(I_mips32_4k)),
+  N (64, 64, bfd_mach_mips5,    "mips:mips5",     false, NN(I_mips5)),
+  N (64, 64, bfd_mach_mips64,   "mips:mips64",    false, NN(I_mips64)),
+  N (64, 64, bfd_mach_mips_sb1, "mips:sb1",       false, 0),
 };
 
 /* The default architecture is mips:3000, but with a machine number of
diff --git a/bfd/cpu-ns32k.c b/bfd/cpu-ns32k.c
index f74e25b..6083a7d 100644
--- a/bfd/cpu-ns32k.c
+++ b/bfd/cpu-ns32k.c
@@ -28,7 +28,7 @@
 {  32, 32, 8, bfd_arch_ns32k, machine, "ns32k",printable,3,d,bfd_default_compatible,bfd_default_scan, next, }
 
 static const bfd_arch_info_type arch_info_struct[] =
-{ 
+{
   N(32532,"ns32k:32532",true, 0), /* the word ns32k will match this too */
 };
 
@@ -174,8 +174,8 @@
      asection *input_section;
      bfd *output_bfd;
      char **error_message ATTRIBUTE_UNUSED;
-     long (*get_data)();
-     int (*put_data)();
+     long (*get_data) ();
+     int (*put_data) ();
 {
   int overflow = 0;
   bfd_vma relocation;
@@ -200,7 +200,6 @@
       && output_bfd == (bfd *) NULL)
     flag = bfd_reloc_undefined;
 
-
   /* Is the address of the relocation really within the section?  */
   if (reloc_entry->address > input_section->_cooked_size)
     return bfd_reloc_outofrange;
@@ -214,7 +213,6 @@
   else
     relocation = symbol->value;
 
-
   reloc_target_output_section = symbol->section->output_section;
 
   /* Convert input-section-relative symbol value to absolute.  */
@@ -290,8 +288,7 @@
 	  reloc_entry->address += input_section->output_offset;
 
 	  /* WTF?? */
-	  if (abfd->xvec->flavour == bfd_target_coff_flavour
-	      && strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0)
+	  if (abfd->xvec->flavour == bfd_target_coff_flavour)
 	    {
 #if 1
 	      /* For m68k-coff, the addend was being subtracted twice during
@@ -599,8 +596,8 @@
      bfd *input_bfd ATTRIBUTE_UNUSED;
      bfd_vma relocation;
      bfd_byte *location;
-     long (*get_data)();
-     int (*put_data)();
+     long (*get_data) ();
+     int (*put_data) ();
 {
   int size;
   bfd_vma x;
diff --git a/bfd/cpu-pj.c b/bfd/cpu-pj.c
index 44ddd33..913cbc5 100644
--- a/bfd/cpu-pj.c
+++ b/bfd/cpu-pj.c
@@ -22,8 +22,7 @@
 #include "sysdep.h"
 #include "libbfd.h"
 
-
-static boolean 
+static boolean
 scan_mach (info, string)
      const struct bfd_arch_info *info;
      const char *string;
@@ -33,7 +32,6 @@
   return false;
 }
 
-
 #if 0
 /* This routine is provided two arch_infos and returns whether
    they'd be compatible */
@@ -49,8 +47,7 @@
 }
 #endif
 
-
-static const bfd_arch_info_type arch_info_struct[] = 
+static const bfd_arch_info_type arch_info_struct[] =
 {
   {
     32,				/* 32 bits in a word */
diff --git a/bfd/cpu-powerpc.c b/bfd/cpu-powerpc.c
index a2c8f59..2e41899 100644
--- a/bfd/cpu-powerpc.c
+++ b/bfd/cpu-powerpc.c
@@ -54,12 +54,12 @@
     32,	/* 32 bits in an address */
     8,	/* 8 bits in a byte */
     bfd_arch_powerpc,
-    603, /* for the mpc603 */
+    bfd_mach_ppc_603,
     "powerpc",
     "powerpc:603",
     3,
     false, /* not the default */
-    powerpc_compatible, 
+    powerpc_compatible,
     bfd_default_scan,
     &arch_info_struct[1]
   },
@@ -68,12 +68,12 @@
     32,	/* 32 bits in an address */
     8,	/* 8 bits in a byte */
     bfd_arch_powerpc,
-    604, /* for the mpc604 */
+    bfd_mach_ppc_ec603e,
     "powerpc",
-    "powerpc:604",
+    "powerpc:EC603e",
     3,
     false, /* not the default */
-    powerpc_compatible, 
+    powerpc_compatible,
     bfd_default_scan,
     &arch_info_struct[2]
   },
@@ -82,12 +82,12 @@
     32,	/* 32 bits in an address */
     8,	/* 8 bits in a byte */
     bfd_arch_powerpc,
-    403, /* for the 403 */
+    bfd_mach_ppc_604,
     "powerpc",
-    "powerpc:403",
+    "powerpc:604",
     3,
     false, /* not the default */
-    powerpc_compatible, 
+    powerpc_compatible,
     bfd_default_scan,
     &arch_info_struct[3]
   },
@@ -96,26 +96,124 @@
     32,	/* 32 bits in an address */
     8,	/* 8 bits in a byte */
     bfd_arch_powerpc,
-    601, /* for the mpc601 */
+    bfd_mach_ppc_403,
+    "powerpc",
+    "powerpc:403",
+    3,
+    false, /* not the default */
+    powerpc_compatible,
+    bfd_default_scan,
+    &arch_info_struct[4]
+  },
+  {
+    32,	/* 32 bits in a word */
+    32,	/* 32 bits in an address */
+    8,	/* 8 bits in a byte */
+    bfd_arch_powerpc,
+    bfd_mach_ppc_601,
     "powerpc",
     "powerpc:601",
     3,
     false, /* not the default */
-    powerpc_compatible, 
+    powerpc_compatible,
     bfd_default_scan,
-    &arch_info_struct[4]
+    &arch_info_struct[5]
   },
-  { 
-    32,	/* 32 bits in a word */
+  {
+    64,	/* 64 bits in a word */
     64,	/* 64 bits in an address */
     8,	/* 8 bits in a byte */
     bfd_arch_powerpc,
-    620, /* for the mpc620 */
+    bfd_mach_ppc_620,
     "powerpc",
     "powerpc:620",
     3,
     false, /* not the default */
-    powerpc_compatible, 
+    powerpc_compatible,
+    bfd_default_scan,
+    &arch_info_struct[6]
+  },
+  {
+    64,	/* 64 bits in a word */
+    64,	/* 64 bits in an address */
+    8,	/* 8 bits in a byte */
+    bfd_arch_powerpc,
+    bfd_mach_ppc_630,
+    "powerpc",
+    "powerpc:630",
+    3,
+    false, /* not the default */
+    powerpc_compatible,
+    bfd_default_scan,
+    &arch_info_struct[7]
+  },
+  {
+    64,	/* 64 bits in a word */
+    64,	/* 64 bits in an address */
+    8,	/* 8 bits in a byte */
+    bfd_arch_powerpc,
+    bfd_mach_ppc_a35,
+    "powerpc",
+    "powerpc:a35",
+    3,
+    false, /* not the default */
+    powerpc_compatible,
+    bfd_default_scan,
+    &arch_info_struct[8]
+  },
+  {
+    64,	/* 64 bits in a word */
+    64,	/* 64 bits in an address */
+    8,	/* 8 bits in a byte */
+    bfd_arch_powerpc,
+    bfd_mach_ppc_rs64ii,
+    "powerpc",
+    "powerpc:rs64ii",
+    3,
+    false, /* not the default */
+    powerpc_compatible,
+    bfd_default_scan,
+    &arch_info_struct[9]
+  },
+  {
+    64,	/* 64 bits in a word */
+    64,	/* 64 bits in an address */
+    8,	/* 8 bits in a byte */
+    bfd_arch_powerpc,
+    bfd_mach_ppc_rs64iii,
+    "powerpc",
+    "powerpc:rs64iii",
+    3,
+    false, /* not the default */
+    powerpc_compatible,
+    bfd_default_scan,
+    &arch_info_struct[10]
+  },
+  {
+    32,	/* 32 bits in a word */
+    32,	/* 32 bits in an address */
+    8,	/* 8 bits in a byte */
+    bfd_arch_powerpc,
+    bfd_mach_ppc_7400,
+    "powerpc",
+    "powerpc:7400",
+    3,
+    false, /* not the default */
+    powerpc_compatible,
+    bfd_default_scan,
+    &arch_info_struct[11]
+  },
+  {
+    32,       /* 32 bits in a word */
+    32,       /* 32 bits in an address */
+    8,        /* 8 bits in a byte */
+    bfd_arch_powerpc,
+    bfd_mach_ppc_860,
+    "powerpc",
+    "powerpc:MPC8XX",
+    3,
+    false, /* not the default */
+    powerpc_compatible,
     bfd_default_scan,
     0
   }
@@ -127,12 +225,12 @@
     32,	/* 32 bits in an address */
     8,	/* 8 bits in a byte */
     bfd_arch_powerpc,
-    0, /* for the POWER/PowerPC common architecture */
+    bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
     "powerpc",
     "powerpc:common",
     3,
     true, /* the default */
-    powerpc_compatible, 
+    powerpc_compatible,
     bfd_default_scan,
     &arch_info_struct[0]
   };
diff --git a/bfd/cpu-rs6000.c b/bfd/cpu-rs6000.c
index 9852ae9..4934542 100644
--- a/bfd/cpu-rs6000.c
+++ b/bfd/cpu-rs6000.c
@@ -53,18 +53,64 @@
   /*NOTREACHED*/
 }
 
+static const bfd_arch_info_type arch_info_struct[] =
+{
+  {
+    32,	/* 32 bits in a word */
+    32,	/* 32 bits in an address */
+    8,	/* 8 bits in a byte */
+    bfd_arch_rs6000,
+    bfd_mach_rs6k_rs1,
+    "rs6000",
+    "rs6000:rs1",
+    3,
+    false, /* not the default */
+    rs6000_compatible,
+    bfd_default_scan,
+    &arch_info_struct[1]
+  },
+  {
+    32,	/* 32 bits in a word */
+    32,	/* 32 bits in an address */
+    8,	/* 8 bits in a byte */
+    bfd_arch_rs6000,
+    bfd_mach_rs6k_rsc,
+    "rs6000",
+    "rs6000:rsc",
+    3,
+    false, /* not the default */
+    rs6000_compatible,
+    bfd_default_scan,
+    &arch_info_struct[2]
+  },
+  {
+    32,	/* 32 bits in a word */
+    32,	/* 32 bits in an address */
+    8,	/* 8 bits in a byte */
+    bfd_arch_rs6000,
+    bfd_mach_rs6k_rs2,
+    "rs6000",
+    "rs6000:rs2",
+    3,
+    false, /* not the default */
+    rs6000_compatible,
+    bfd_default_scan,
+    0
+  }
+};
+
 const bfd_arch_info_type bfd_rs6000_arch =
   {
     32,	/* 32 bits in a word */
     32,	/* 32 bits in an address */
     8,	/* 8 bits in a byte */
     bfd_arch_rs6000,
-    6000,	/* only 1 machine */
+    bfd_mach_rs6k,	/* POWER common architecture */
     "rs6000",
     "rs6000:6000",
     3,
-    true, /* the one and only */
+    true, /* the default */
     rs6000_compatible,
     bfd_default_scan,
-    0,
+    &arch_info_struct[0]
   };
diff --git a/bfd/cpu-sh.c b/bfd/cpu-sh.c
index cb54e7d..3b903eb 100644
--- a/bfd/cpu-sh.c
+++ b/bfd/cpu-sh.c
@@ -22,8 +22,7 @@
 #include "sysdep.h"
 #include "libbfd.h"
 
-
-static boolean 
+static boolean
 scan_mach (info, string)
      const struct bfd_arch_info *info;
      const char *string;
@@ -33,7 +32,6 @@
   return false;
 }
 
-
 #if 0
 /* This routine is provided two arch_infos and returns whether
    they'd be compatible */
@@ -49,15 +47,15 @@
 }
 #endif
 
-#define SH_NEXT &arch_info_struct[0]
-#define SH2_NEXT &arch_info_struct[1]
-#define SH_DSP_NEXT &arch_info_struct[2]
-#define SH3_NEXT &arch_info_struct[3]
+#define SH_NEXT      &arch_info_struct[0]
+#define SH2_NEXT     &arch_info_struct[1]
+#define SH_DSP_NEXT  &arch_info_struct[2]
+#define SH3_NEXT     &arch_info_struct[3]
 #define SH3_DSP_NEXT &arch_info_struct[4]
-#define SH3E_NEXT &arch_info_struct[5]
-#define SH4_NEXT NULL
+#define SH3E_NEXT    &arch_info_struct[5]
+#define SH4_NEXT     NULL
 
-static const bfd_arch_info_type arch_info_struct[] = 
+static const bfd_arch_info_type arch_info_struct[] =
 {
   {
     32,				/* 32 bits in a word */
diff --git a/bfd/cpu-sparc.c b/bfd/cpu-sparc.c
index 234bd92..5c777d20 100644
--- a/bfd/cpu-sparc.c
+++ b/bfd/cpu-sparc.c
@@ -1,5 +1,5 @@
 /* BFD support for the SPARC architecture.
-   Copyright (C) 1992, 94, 95, 96, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1992, 94, 95, 96, 97, 2000 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -49,7 +49,7 @@
     "sparc:sparclet",
     3,
     false,
-    sparc_compatible, 
+    sparc_compatible,
     bfd_default_scan,
     &arch_info_struct[1],
   },
@@ -63,7 +63,7 @@
     "sparc:sparclite",
     3,
     false,
-    sparc_compatible, 
+    sparc_compatible,
     bfd_default_scan,
     &arch_info_struct[2],
   },
@@ -77,7 +77,7 @@
     "sparc:v8plus",
     3,
     false,
-    sparc_compatible, 
+    sparc_compatible,
     bfd_default_scan,
     &arch_info_struct[3],
   },
@@ -91,7 +91,7 @@
     "sparc:v8plusa",
     3,
     false,
-    sparc_compatible, 
+    sparc_compatible,
     bfd_default_scan,
     &arch_info_struct[4],
   },
@@ -105,7 +105,7 @@
     "sparc:sparclite_le",
     3,
     false,
-    sparc_compatible, 
+    sparc_compatible,
     bfd_default_scan,
     &arch_info_struct[5],
   },
@@ -119,7 +119,7 @@
     "sparc:v9",
     3,
     false,
-    sparc_compatible, 
+    sparc_compatible,
     bfd_default_scan,
     &arch_info_struct[6],
   },
@@ -133,7 +133,35 @@
     "sparc:v9a",
     3,
     false,
-    sparc_compatible, 
+    sparc_compatible,
+    bfd_default_scan,
+    &arch_info_struct[7],
+  },
+  {
+    32,	/* bits in a word */
+    32,	/* bits in an address */
+    8,	/* bits in a byte */
+    bfd_arch_sparc,
+    bfd_mach_sparc_v8plusb,
+    "sparc",
+    "sparc:v8plusb",
+    3,
+    false,
+    sparc_compatible,
+    bfd_default_scan,
+    &arch_info_struct[8],
+  },
+  {
+    64,	/* bits in a word */
+    64,	/* bits in an address */
+    8,	/* bits in a byte */
+    bfd_arch_sparc,
+    bfd_mach_sparc_v9b,
+    "sparc",
+    "sparc:v9b",
+    3,
+    false,
+    sparc_compatible,
     bfd_default_scan,
     0,
   }
@@ -150,7 +178,7 @@
     "sparc",
     3,
     true, /* the default */
-    sparc_compatible, 
+    sparc_compatible,
     bfd_default_scan,
     &arch_info_struct[0],
   };
diff --git a/bfd/cpu-tic54x.c b/bfd/cpu-tic54x.c
index 6f5e2c3..f82432d 100644
--- a/bfd/cpu-tic54x.c
+++ b/bfd/cpu-tic54x.c
@@ -34,6 +34,6 @@
   1,
   true,				/* the one and only */
   bfd_default_compatible,
-  bfd_default_scan,             
+  bfd_default_scan,
   0,
 };
diff --git a/bfd/cpu-v850.c b/bfd/cpu-v850.c
index 539413d..55606f8 100644
--- a/bfd/cpu-v850.c
+++ b/bfd/cpu-v850.c
@@ -23,7 +23,7 @@
 
 #include <ctype.h>
 
-static boolean 
+static boolean
 scan (info, string)
      const struct bfd_arch_info * info;
      const char * string;
@@ -41,9 +41,9 @@
      architecture, eg the string m68k:68020 would match the m68k entry
      up to the :, then we get left with the machine number */
 
-  for (ptr_src = string, ptr_tst = info->arch_name; 
+  for (ptr_src = string, ptr_tst = info->arch_name;
        *ptr_src && *ptr_tst;
-       ptr_src++, ptr_tst++) 
+       ptr_src++, ptr_tst++)
     {
       if (*ptr_src != *ptr_tst) break;
     }
@@ -52,7 +52,7 @@
      colons */
   if (*ptr_src == ':')
     ptr_src++;
-  
+
   if (*ptr_src == 0)
     {
       /* nothing more, then only keep this one if it is the default
@@ -67,15 +67,15 @@
       ptr_src++;
     }
 
-  switch (number) 
+  switch (number)
     {
     case bfd_mach_v850e:  arch = bfd_arch_v850; break;
     case bfd_mach_v850ea: arch = bfd_arch_v850; break;
-    default:  
+    default:
       return false;
     }
 
-  if (arch != info->arch) 
+  if (arch != info->arch)
     return false;
 
   if (number != info->mach)
@@ -90,7 +90,7 @@
 
 #define NEXT NULL
 
-static const bfd_arch_info_type arch_info_struct[] = 
+static const bfd_arch_info_type arch_info_struct[] =
 {
   N (bfd_mach_v850e,  "v850e",  false, &arch_info_struct[1]),
   N (bfd_mach_v850ea, "v850ea", false, NULL)
diff --git a/bfd/cpu-vax.c b/bfd/cpu-vax.c
index bdc6d39..e42ec10 100644
--- a/bfd/cpu-vax.c
+++ b/bfd/cpu-vax.c
@@ -33,7 +33,7 @@
     "vax",
     3,
     true, /* the one and only */
-    bfd_default_compatible, 
+    bfd_default_compatible,
     bfd_default_scan ,
     0,
   };
diff --git a/bfd/cpu-w65.c b/bfd/cpu-w65.c
index 13f68b3..9a31772 100644
--- a/bfd/cpu-w65.c
+++ b/bfd/cpu-w65.c
@@ -22,10 +22,9 @@
 #include "sysdep.h"
 #include "libbfd.h"
 
-
 int bfd_default_scan_num_mach();
 
-static boolean 
+static boolean
 scan_mach (info, string)
      const struct bfd_arch_info *info ATTRIBUTE_UNUSED;
      const char *string;
@@ -35,8 +34,6 @@
   return false;
 }
 
-
-
 const bfd_arch_info_type bfd_w65_arch =
 {
   16,				/* 16 bits in a word */
diff --git a/bfd/cpu-we32k.c b/bfd/cpu-we32k.c
index a38cbc1..2133015 100644
--- a/bfd/cpu-we32k.c
+++ b/bfd/cpu-we32k.c
@@ -33,7 +33,7 @@
     "we32k:32000",
     3,
     true, /* the one and only */
-    bfd_default_compatible, 
+    bfd_default_compatible,
     bfd_default_scan ,
     0,
   };
diff --git a/bfd/cpu-z8k.c b/bfd/cpu-z8k.c
index 5cce8eb..29682c1 100644
--- a/bfd/cpu-z8k.c
+++ b/bfd/cpu-z8k.c
@@ -22,7 +22,6 @@
 #include "sysdep.h"
 #include "libbfd.h"
 
-
 #if 0				/* not used currently */
 /*
 Relocations for the Z8K
@@ -50,7 +49,6 @@
   return bfd_reloc_ok;
 }
 
-
 static bfd_reloc_status_type
 howto8_callback (abfd, reloc_entry, symbol_in, data,
 		 ignore_input_section, ignore_bfd)
@@ -73,7 +71,6 @@
   return bfd_reloc_ok;
 }
 
-
 static bfd_reloc_status_type
 howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data,
 		      ignore_input_section, ignore_bfd)
@@ -119,8 +116,6 @@
   return bfd_reloc_ok;
 }
 
-
-
 static reloc_howto_type howto_16
 = NEWHOWTO (howto16_callback, "abs16", 1, false, false);
 static reloc_howto_type howto_8
@@ -132,7 +127,6 @@
 static reloc_howto_type howto_8_pcrel
 = NEWHOWTO (howto8_pcrel_callback, "pcrel8", 0, false, true);
 
-
 static reloc_howto_type *
 local_bfd_reloc_type_lookup (arch, code)
      const struct bfd_arch_info *arch;
@@ -172,7 +166,6 @@
   return false;
 }
 
-
 /* This routine is provided two arch_infos and returns whether
    they'd be compatible */
 
@@ -186,7 +179,6 @@
   return a;
 }
 
-
 static const bfd_arch_info_type arch_info_struct[] =
 {
   {32, 32, 8, bfd_arch_z8k, bfd_mach_z8001, "z8k", "z8001", 1, false, compatible, scan_mach, 0,},
diff --git a/bfd/doc/ChangeLog b/bfd/doc/ChangeLog
index 39c7265..549cdf6 100644
--- a/bfd/doc/ChangeLog
+++ b/bfd/doc/ChangeLog
@@ -1,3 +1,16 @@
+2000-11-06  Nick Clifton  <nickc@redhat.com>
+
+	* bfd.texinfo: Add GNU Free Documentation License.
+
+2000-07-09  Alan Modra  <alan@linuxcare.com.au>
+
+	* Makefile.in: Regenerate.
+
+2000-07-08  Alan Modra  <alan@linuxcare.com.au>
+
+	* chew.c (outputdots): Don't add a space before `/*'.
+	(courierize): Likewise.
+
 Wed May 24 12:03:25 2000  Hans-Peter Nilsson  <hp@axis.com>
 
 	* bfdint.texi (BFD ELF processor required): Add paragraph about
diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
index e45ab48..dfc33e1 100644
--- a/bfd/doc/Makefile.in
+++ b/bfd/doc/Makefile.in
@@ -75,10 +75,14 @@
 CC_FOR_BUILD = @CC_FOR_BUILD@
 COREFILE = @COREFILE@
 COREFLAG = @COREFLAG@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
 DATADIRNAME = @DATADIRNAME@
 DLLTOOL = @DLLTOOL@
 EXEEXT = @EXEEXT@
 EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+GCJ = @GCJ@
+GCJFLAGS = @GCJFLAGS@
 GMOFILES = @GMOFILES@
 GMSGFMT = @GMSGFMT@
 GT_NO = @GT_NO@
@@ -96,10 +100,12 @@
 MKINSTALLDIRS = @MKINSTALLDIRS@
 MSGFMT = @MSGFMT@
 OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 POFILES = @POFILES@
 POSUB = @POSUB@
 RANLIB = @RANLIB@
+STRIP = @STRIP@
 TDEFINES = @TDEFINES@
 USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
 USE_NLS = @USE_NLS@
@@ -188,7 +194,7 @@
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
+TAR = gtar
 GZIP_ENV = --best
 all: all-redirect
 .SUFFIXES:
diff --git a/bfd/doc/bfd.texinfo b/bfd/doc/bfd.texinfo
index eadf87c..e82b9dc 100644
--- a/bfd/doc/bfd.texinfo
+++ b/bfd/doc/bfd.texinfo
@@ -28,11 +28,14 @@
 @ifinfo
 This file documents the BFD library.
 
-Copyright (C) 1991 Free Software Foundation, Inc.
+Copyright (C) 1991, 2000 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, distribute and/or modify this document
+      under the terms of the GNU Free Documentation License, Version 1.1
+      or any later version published by the Free Software Foundation;
+      with no Invariant Sections, with no Front-Cover Texts, and with no
+      Back-Cover Texts.  A copy of the license is included in the
+      section entitled "GNU Free Documentation License".
 
 @ignore
 Permission is granted to process this file through Tex and print the
@@ -41,14 +44,6 @@
 (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, subject to the terms
-of the GNU General Public License, which includes the provision 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
@@ -80,18 +75,13 @@
 @vskip 0pt plus 1filll
 Copyright @copyright{} 1991 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, distribute and/or modify this document
+      under the terms of the GNU Free Documentation License, Version 1.1
+      or any later version published by the Free Software Foundation;
+      with no Invariant Sections, with no Front-Cover Texts, and with no
+      Back-Cover Texts.  A copy of the license is included in the
+      section entitled "GNU Free Documentation License".
 
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, subject to the terms
-of the GNU General Public License, which includes the provision 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
 
@@ -104,6 +94,7 @@
 * Overview::			Overview of BFD
 * BFD front end::		BFD front end
 * BFD back ends::		BFD back ends
+* GNU Free Documentation License::  GNU Free Documentation License
 * Index::			Index
 @end menu
 
@@ -298,7 +289,7 @@
 @node Hash Tables, , Linker Functions, BFD front end
 @include  hash.texi
 
-@node BFD back ends, Index, BFD front end, Top
+@node BFD back ends, GNU Free Documentation License, BFD front end, Top
 @chapter BFD back ends
 @menu
 * What to Put Where::
@@ -325,7 +316,371 @@
 @c Leave this out until the file has some actual contents...
 @c @include  elfcode.texi
 
-@node Index,  , BFD back ends , Top
+@node GNU Free Documentation License, Index, BFD back ends, Top
+@chapter GNU Free Documentation License
+@cindex GNU Free Documentation License
+
+                GNU Free Documentation License
+                
+                   Version 1.1, March 2000
+
+ Copyright (C) 2000  Free Software Foundation, Inc.
+  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+     
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+0. PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+written document "free" in the sense of freedom: to assure everyone
+the effective freedom to copy and redistribute it, with or without
+modifying it, either commercially or noncommercially.  Secondarily,
+this License preserves for the author and publisher a way to get
+credit for their work, while not being considered responsible for
+modifications made by others.
+
+This License is a kind of "copyleft", which means that derivative
+works of the document must themselves be free in the same sense.  It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does.  But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book.  We recommend this License
+principally for works whose purpose is instruction or reference.
+
+
+1. APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work that contains a
+notice placed by the copyright holder saying it can be distributed
+under the terms of this License.  The "Document", below, refers to any
+such manual or work.  Any member of the public is a licensee, and is
+addressed as "you".
+
+A "Modified Version" of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A "Secondary Section" is a named appendix or a front-matter section of
+the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall subject
+(or to related matters) and contains nothing that could fall directly
+within that overall subject.  (For example, if the Document is in part a
+textbook of mathematics, a Secondary Section may not explain any
+mathematics.)  The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The "Invariant Sections" are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License.
+
+The "Cover Texts" are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License.
+
+A "Transparent" copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, whose contents can be viewed and edited directly and
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters.  A copy made in an otherwise Transparent file
+format whose markup has been designed to thwart or discourage
+subsequent modification by readers is not Transparent.  A copy that is
+not "Transparent" is called "Opaque".
+
+Examples of suitable formats for Transparent copies include plain
+ASCII without markup, Texinfo input format, LaTeX input format, SGML
+or XML using a publicly available DTD, and standard-conforming simple
+HTML designed for human modification.  Opaque formats include
+PostScript, PDF, proprietary formats that can be read and edited only
+by proprietary word processors, SGML or XML for which the DTD and/or
+processing tools are not generally available, and the
+machine-generated HTML produced by some word processors for output
+purposes only.
+
+The "Title Page" means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page.  For works in
+formats which do not have any title page as such, "Title Page" means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+
+
+2. VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License.  You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute.  However, you may accept
+compensation in exchange for copies.  If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+
+
+3. COPYING IN QUANTITY
+
+If you publish printed copies of the Document numbering more than 100,
+and the Document's license notice requires Cover Texts, you must enclose
+the copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover.  Both covers must also clearly and legibly identify
+you as the publisher of these copies.  The front cover must present
+the full title with all words of the title equally prominent and
+visible.  You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a publicly-accessible computer-network location containing a complete
+Transparent copy of the Document, free of added material, which the
+general network-using public has access to download anonymously at no
+charge using public-standard network protocols.  If you use the latter
+option, you must take reasonably prudent steps, when you begin
+distribution of Opaque copies in quantity, to ensure that this
+Transparent copy will remain thus accessible at the stated location
+until at least one year after the last time you distribute an Opaque
+copy (directly or through your agents or retailers) of that edition to
+the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+
+
+4. MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it.  In addition, you must do these things in the Modified Version:
+
+A. Use in the Title Page (and on the covers, if any) a title distinct
+   from that of the Document, and from those of previous versions
+   (which should, if there were any, be listed in the History section
+   of the Document).  You may use the same title as a previous version
+   if the original publisher of that version gives permission.
+B. List on the Title Page, as authors, one or more persons or entities
+   responsible for authorship of the modifications in the Modified
+   Version, together with at least five of the principal authors of the
+   Document (all of its principal authors, if it has less than five).
+C. State on the Title page the name of the publisher of the
+   Modified Version, as the publisher.
+D. Preserve all the copyright notices of the Document.
+E. Add an appropriate copyright notice for your modifications
+   adjacent to the other copyright notices.
+F. Include, immediately after the copyright notices, a license notice
+   giving the public permission to use the Modified Version under the
+   terms of this License, in the form shown in the Addendum below.
+G. Preserve in that license notice the full lists of Invariant Sections
+   and required Cover Texts given in the Document's license notice.
+H. Include an unaltered copy of this License.
+I. Preserve the section entitled "History", and its title, and add to
+   it an item stating at least the title, year, new authors, and
+   publisher of the Modified Version as given on the Title Page.  If
+   there is no section entitled "History" in the Document, create one
+   stating the title, year, authors, and publisher of the Document as
+   given on its Title Page, then add an item describing the Modified
+   Version as stated in the previous sentence.
+J. Preserve the network location, if any, given in the Document for
+   public access to a Transparent copy of the Document, and likewise
+   the network locations given in the Document for previous versions
+   it was based on.  These may be placed in the "History" section.
+   You may omit a network location for a work that was published at
+   least four years before the Document itself, or if the original
+   publisher of the version it refers to gives permission.
+K. In any section entitled "Acknowledgements" or "Dedications",
+   preserve the section's title, and preserve in the section all the
+   substance and tone of each of the contributor acknowledgements
+   and/or dedications given therein.
+L. Preserve all the Invariant Sections of the Document,
+   unaltered in their text and in their titles.  Section numbers
+   or the equivalent are not considered part of the section titles.
+M. Delete any section entitled "Endorsements".  Such a section
+   may not be included in the Modified Version.
+N. Do not retitle any existing section as "Endorsements"
+   or to conflict in title with any Invariant Section.
+
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant.  To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section entitled "Endorsements", provided it contains
+nothing but endorsements of your Modified Version by various
+parties--for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version.  Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity.  If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+
+
+5. COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy.  If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections entitled "History"
+in the various original documents, forming one section entitled
+"History"; likewise combine any sections entitled "Acknowledgements",
+and any sections entitled "Dedications".  You must delete all sections
+entitled "Endorsements."
+
+
+6. COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+
+
+7. AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, does not as a whole count as a Modified Version
+of the Document, provided no compilation copyright is claimed for the
+compilation.  Such a compilation is called an "aggregate", and this
+License does not apply to the other self-contained works thus compiled
+with the Document, on account of their being thus compiled, if they
+are not themselves derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one quarter
+of the entire aggregate, the Document's Cover Texts may be placed on
+covers that surround only the Document within the aggregate.
+Otherwise they must appear on covers around the whole aggregate.
+
+
+8. TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections.  You may include a
+translation of this License provided that you also include the
+original English version of this License.  In case of a disagreement
+between the translation and the original English version of this
+License, the original English version will prevail.
+
+
+9. TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document except
+as expressly provided for under this License.  Any other attempt to
+copy, modify, sublicense or distribute the Document 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.
+
+
+10. FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation 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.  See
+http://www.gnu.org/copyleft/.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License "or any later version" applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation.  If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation.
+
+
+ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
+@smallexample
+    Copyright (c)  YEAR  YOUR NAME.
+    Permission is granted to copy, distribute and/or modify this document
+    under the terms of the GNU Free Documentation License, Version 1.1
+    or any later version published by the Free Software Foundation;
+    with the Invariant Sections being LIST THEIR TITLES, with the
+    Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
+    A copy of the license is included in the section entitled "GNU
+    Free Documentation License".
+@end smallexample
+
+If you have no Invariant Sections, write "with no Invariant Sections"
+instead of saying which ones are invariant.  If you have no
+Front-Cover Texts, write "no Front-Cover Texts" instead of
+"Front-Cover Texts being LIST"; likewise for Back-Cover Texts.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
+
+@node Index,  , GNU Free Documentation License , Top
 @unnumbered Index
 @printindex cp
 
diff --git a/bfd/doc/bfdint.texi b/bfd/doc/bfdint.texi
index ef4fa91..b0a0182 100644
--- a/bfd/doc/bfdint.texi
+++ b/bfd/doc/bfdint.texi
@@ -18,8 +18,7 @@
 This document describes some BFD internal information which may be
 helpful when working on BFD.  It is very incomplete.
 
-This document is not updated regularly, and may be out of date.  It was
-last modified on $Date$.
+This document is not updated regularly, and may be out of date.
 
 The initial version of this document was written by Ian Lance Taylor
 @email{ian@@cygnus.com}.
diff --git a/bfd/doc/chew.c b/bfd/doc/chew.c
index eba69c2..52de92e 100644
--- a/bfd/doc/chew.c
+++ b/bfd/doc/chew.c
@@ -1,5 +1,5 @@
 /* chew
-   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1998
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1998, 2000
    Free Software Foundation, Inc.
    Contributed by steve chamberlain @cygnus
 
@@ -22,7 +22,7 @@
 /* Yet another way of extracting documentation from source.
    No, I haven't finished it yet, but I hope you people like it better
    than the old way
-  
+
    sac
 
    Basically, this is a sort of string forth, maybe we should call it
@@ -81,7 +81,6 @@
 
    Foo.  */
 
-
 #include <ansidecl.h>
 #include "sysdep.h"
 #include <assert.h>
@@ -96,16 +95,15 @@
 
 int warning;
 
-/* Here is a string type ... */
+/* Here is a string type ...  */
 
-typedef struct buffer 
+typedef struct buffer
 {
   char *ptr;
   unsigned long write_idx;
   unsigned long size;
 } string_type;
 
-
 #ifdef __STDC__
 static void init_string_with_size (string_type *, unsigned int);
 static void init_string (string_type *);
@@ -121,100 +119,104 @@
 static void catstr (string_type *, string_type *);
 #endif
 
-
-static void DEFUN(init_string_with_size,(buffer, size),
-	   string_type *buffer AND
-	   unsigned int size )
+static void
+init_string_with_size (buffer, size)
+     string_type *buffer;
+     unsigned int size;
 {
-    buffer->write_idx = 0;
-    buffer->size = size;
-    buffer->ptr = malloc(size);
+  buffer->write_idx = 0;
+  buffer->size = size;
+  buffer->ptr = malloc (size);
 }
 
-static void DEFUN(init_string,(buffer),
-	   string_type *buffer)
+static void
+init_string (buffer)
+     string_type *buffer;
 {
-    init_string_with_size(buffer, DEF_SIZE);
-
+  init_string_with_size (buffer, DEF_SIZE);
 }
 
-static int DEFUN(find, (str, what),
-	  string_type *str AND
-	  char *what)
+static int
+find (str, what)
+     string_type *str;
+     char *what;
 {
-    unsigned int i;
-    char *p;
-    p = what;
-    for (i = 0; i < str->write_idx && *p; i++) 
+  unsigned int i;
+  char *p;
+  p = what;
+  for (i = 0; i < str->write_idx && *p; i++)
     {
-	if (*p == str->ptr[i])
-	 p++;
-	else
-	 p = what;
+      if (*p == str->ptr[i])
+	p++;
+      else
+	p = what;
     }
-    return (*p == 0);
-    
+  return (*p == 0);
 }
 
-static void DEFUN(write_buffer,(buffer, f),
-	   string_type *buffer AND
-	   FILE *f)
+static void
+write_buffer (buffer, f)
+     string_type *buffer;
+     FILE *f;
 {
-    fwrite(buffer->ptr, buffer->write_idx, 1, f);
+  fwrite (buffer->ptr, buffer->write_idx, 1, f);
 }
 
-
-static void DEFUN(delete_string,(buffer),
-	   string_type *buffer)
+static void
+delete_string (buffer)
+     string_type *buffer;
 {
-    free(buffer->ptr);
+  free (buffer->ptr);
 }
 
-
-static char *DEFUN(addr, (buffer, idx),
-	    string_type *buffer AND
-	    unsigned int idx)
+static char *
+addr (buffer, idx)
+     string_type *buffer;
+     unsigned int idx;
 {
-    return buffer->ptr + idx;
+  return buffer->ptr + idx;
 }
 
-static char DEFUN(at,(buffer, pos),
-	   string_type *buffer AND
-	   unsigned int pos) 
+static char
+at (buffer, pos)
+     string_type *buffer;
+     unsigned int pos;
 {
-  if (pos >= buffer->write_idx) 
+  if (pos >= buffer->write_idx)
     return 0;
   return buffer->ptr[pos];
 }
 
-static void DEFUN(catchar,(buffer, ch), 
-	   string_type *buffer AND
-	   int ch)
+static void
+catchar (buffer, ch)
+     string_type *buffer;
+     int ch;
 {
-  if (buffer->write_idx == buffer->size) 
+  if (buffer->write_idx == buffer->size)
     {
-      buffer->size *=2;
-      buffer->ptr = realloc(buffer->ptr, buffer->size);
+      buffer->size *= 2;
+      buffer->ptr = realloc (buffer->ptr, buffer->size);
     }
 
-  buffer->ptr[buffer->write_idx ++ ] = ch;
+  buffer->ptr[buffer->write_idx++] = ch;
 }
 
-
-static void DEFUN(overwrite_string,(dst,   src),
-	   string_type *dst AND
-	   string_type *src)
+static void
+overwrite_string (dst, src)
+     string_type *dst;
+     string_type *src;
 {
-    free(dst->ptr);
-    dst->size = src->size;
-    dst->write_idx = src->write_idx;
-    dst->ptr = src->ptr;
+  free (dst->ptr);
+  dst->size = src->size;
+  dst->write_idx = src->write_idx;
+  dst->ptr = src->ptr;
 }
 
-static void DEFUN(catbuf,(buffer, buf, len),
-	   string_type *buffer AND
-	   char *buf AND
-	   unsigned int len)
+static void
+catbuf (buffer, buf, len)
+     string_type *buffer;
+     char *buf;
+     unsigned int len;
 {
   if (buffer->write_idx + len >= buffer->size)
     {
@@ -226,41 +228,41 @@
   buffer->write_idx += len;
 }
 
-static void DEFUN(cattext,(buffer, string),
-	   string_type *buffer AND
-	   char *string)
+static void
+cattext (buffer, string)
+     string_type *buffer;
+     char *string;
 {
   catbuf (buffer, string, (unsigned int) strlen (string));
 }
 
-static void DEFUN(catstr,(dst, src),
-	   string_type *dst AND
-	   string_type *src)
+static void
+catstr (dst, src)
+     string_type *dst;
+     string_type *src;
 {
   catbuf (dst, src->ptr, src->write_idx);
 }
 
-
-static unsigned int 
-DEFUN(skip_white_and_stars,(src, idx),
-      string_type *src AND
-      unsigned int idx)
+static unsigned int
+skip_white_and_stars (src, idx)
+     string_type *src;
+     unsigned int idx;
 {
   char c;
-  while ((c = at(src,idx)),
+  while ((c = at (src, idx)),
 	 isspace ((unsigned char) c)
 	 || (c == '*'
 	     /* Don't skip past end-of-comment or star as first
 		character on its line.  */
-	     && at(src,idx +1) != '/'
-	     && at(src,idx -1) != '\n')) 
+	     && at (src, idx +1) != '/'
+	     && at (src, idx -1) != '\n'))
     idx++;
   return idx;
 }
 
 /***********************************************************************/
 
-
 string_type stack[STACK];
 string_type *tos;
 
@@ -275,19 +277,18 @@
 
 typedef int *word_type;
 
-
-
 struct dict_struct
 {
-    char *word;
-    struct dict_struct *next;
-    stinst_type *code;
-    int code_length;
-    int code_end;
-    int var;
-    
+  char *word;
+  struct dict_struct *next;
+  stinst_type *code;
+  int code_length;
+  int code_end;
+  int var;
 };
+
 typedef struct dict_struct dict_type;
+
 #define WORD(x) static void x()
 
 static void
@@ -352,27 +353,28 @@
 static void chew_exit (void);
 #endif
 
-static void DEFUN(exec,(word),
-		  dict_type *word)
+static void
+exec (word)
+     dict_type *word;
 {
   pc = word->code;
-  while (*pc) 
-    (*pc)();
-}
-WORD(call)
-{
-    stinst_type *oldpc = pc;
-    dict_type *e;
-    e =  (dict_type *)(pc [1]);
-    exec(e);
-    pc = oldpc + 2;
-    
+  while (*pc)
+    (*pc) ();
 }
 
-WORD(remchar)
+WORD (call)
+{
+  stinst_type *oldpc = pc;
+  dict_type *e;
+  e = (dict_type *) (pc[1]);
+  exec (e);
+  pc = oldpc + 2;
+}
+
+WORD (remchar)
 {
   if (tos->write_idx)
-    tos->write_idx--;    
+    tos->write_idx--;
   pc++;
 }
 
@@ -386,81 +388,80 @@
   pc++;
 }
 
-WORD(push_number)
+WORD (push_number)
 {
-    isp++;
-    icheck_range ();
-    pc++;
-    *isp = (long)(*pc);
-    pc++;
+  isp++;
+  icheck_range ();
+  pc++;
+  *isp = (long) (*pc);
+  pc++;
 }
 
-WORD(push_text)
+WORD (push_text)
 {
-    tos++;
-    check_range ();
-    init_string(tos);
-    pc++;
-    cattext(tos,*((char **)pc));
-    pc++;
-    
+  tos++;
+  check_range ();
+  init_string (tos);
+  pc++;
+  cattext (tos, *((char **) pc));
+  pc++;
 }
 
-
 /* This function removes everything not inside comments starting on
    the first char of the line from the  string, also when copying
    comments, removes blank space and leading *'s.
    Blank lines are turned into one blank line.  */
 
-static void 
-DEFUN(remove_noncomments,(src,dst),
-	   string_type *src AND
-	   string_type *dst)
+static void
+remove_noncomments (src, dst)
+     string_type *src;
+     string_type *dst;
 {
-    unsigned int idx = 0;
-    
-    while (at(src,idx)) 
-    {
-	/* Now see if we have a comment at the start of the line */
-	if (at(src,idx) == '\n' 
-	    && at(src,idx+1) ==  '/' 
-	    && at(src,idx+2) == '*') 
-	{
-	    idx+=3;
-	    
-	    idx = skip_white_and_stars(src,idx);
+  unsigned int idx = 0;
 
-	    /* Remove leading dot */
-	    if (at(src, idx) == '.')
-	     idx++;
-	    
-	    /* Copy to the end of the line, or till the end of the
-	       comment */
-	    while (at(src, idx))
+  while (at (src, idx))
+    {
+      /* Now see if we have a comment at the start of the line.  */
+      if (at (src, idx) == '\n'
+	  && at (src, idx + 1) == '/'
+	  && at (src, idx + 2) == '*')
+	{
+	  idx += 3;
+
+	  idx = skip_white_and_stars (src, idx);
+
+	  /* Remove leading dot */
+	  if (at (src, idx) == '.')
+	    idx++;
+
+	  /* Copy to the end of the line, or till the end of the
+	     comment.  */
+	  while (at (src, idx))
 	    {
-		if (at(src, idx) == '\n') 
+	      if (at (src, idx) == '\n')
 		{
-		    /* end of line, echo and scrape of leading blanks  */
-		    if (at(src,idx +1) == '\n')
-		     catchar(dst,'\n');
-		    catchar(dst,'\n');
-		    idx++;
-		    idx =   skip_white_and_stars(src, idx);
+		  /* end of line, echo and scrape of leading blanks  */
+		  if (at (src, idx + 1) == '\n')
+		    catchar (dst, '\n');
+		  catchar (dst, '\n');
+		  idx++;
+		  idx = skip_white_and_stars (src, idx);
 		}
-		else if (at(src, idx) == '*' && at(src,idx+1) == '/') 
+	      else if (at (src, idx) == '*' && at (src, idx + 1) == '/')
 		{
-		    idx +=2 ;
-		    cattext(dst,"\nENDDD\n");
-		    break;
+		  idx += 2;
+		  cattext (dst, "\nENDDD\n");
+		  break;
 		}
-		else 
+	      else
 		{
-		    catchar(dst, at(src, idx));
-		    idx++;
+		  catchar (dst, at (src, idx));
+		  idx++;
 		}
 	    }
 	}
-	else idx++;
+      else
+	idx++;
     }
 }
 
@@ -481,98 +482,94 @@
  */
 
 static void
-DEFUN_VOID(paramstuff)
+paramstuff (void)
 {
-    unsigned int openp;
-    unsigned int fname;
-    unsigned int idx;
-    string_type out;
-    init_string(&out);
-    
+  unsigned int openp;
+  unsigned int fname;
+  unsigned int idx;
+  string_type out;
+  init_string (&out);
 
-    /* make sure that it's not already param'd or proto'd */
-    if(find(tos,"PARAMS") || find(tos,"PROTO") || !find(tos,"(")) {
-	    catstr(&out,tos);
-	}
-    else 
+  /* Make sure that it's not already param'd or proto'd.  */
+  if (find (tos, "PARAMS") || find (tos, "PROTO") || !find (tos, "("))
     {
-	/* Find the open paren */
-	for (openp = 0; at(tos, openp) != '('  && at(tos,openp); openp++)
-	 ;
-
-	fname = openp;
-	/* Step back to the fname */
-	fname--;
-	while (fname && isspace((unsigned char) at(tos, fname)))
-	 fname --;
-	while (fname
-	       && !isspace((unsigned char) at(tos,fname))
-	       && at(tos,fname) != '*')
-	 fname--;
-
-	fname++;
-	
-	for (idx = 0; idx < fname; idx++) 	/* Output type */
-	{
-	    catchar(&out, at(tos,idx));
-	}
-    
-        cattext(&out, "\n");	/* Insert a newline between type and fnname */
-
-	for (idx = fname; idx < openp; idx++) 		/* Output fnname */
-	{
-	    catchar(&out, at(tos,idx));
-	}
-
-	cattext(&out," PARAMS (");
-
-	while (at(tos,idx) && at(tos,idx) !=';') 
-	{
-	    catchar(&out, at(tos, idx));
-	    idx++;
-	}
-	cattext(&out,");\n\n");
+      catstr (&out, tos);
     }
-    overwrite_string(tos, &out);    
-    pc++;
-    
+  else
+    {
+      /* Find the open paren.  */
+      for (openp = 0; at (tos, openp) != '(' && at (tos, openp); openp++)
+	;
+
+      fname = openp;
+      /* Step back to the fname.  */
+      fname--;
+      while (fname && isspace ((unsigned char) at (tos, fname)))
+	fname--;
+      while (fname
+	     && !isspace ((unsigned char) at (tos,fname))
+	     && at (tos,fname) != '*')
+	fname--;
+
+      fname++;
+
+      for (idx = 0; idx < fname; idx++) 	/* Output type */
+	{
+	  catchar (&out, at (tos, idx));
+	}
+
+      cattext (&out, "\n");	/* Insert a newline between type and fnname */
+
+      for (idx = fname; idx < openp; idx++) 		/* Output fnname */
+	{
+	  catchar (&out, at (tos, idx));
+	}
+
+      cattext (&out, " PARAMS (");
+
+      while (at (tos, idx) && at (tos, idx) != ';')
+	{
+	  catchar (&out, at (tos, idx));
+	  idx++;
+	}
+      cattext (&out, ");\n\n");
+    }
+  overwrite_string (tos, &out);
+  pc++;
+
 }
 
-
-
 /* turn {*
    and *} into comments */
 
-WORD(translatecomments)
+WORD (translatecomments)
 {
-    unsigned int idx = 0;
-    string_type out;
-    init_string(&out);
-    
-    while (at(tos, idx)) 
+  unsigned int idx = 0;
+  string_type out;
+  init_string (&out);
+
+  while (at (tos, idx))
     {
-	if (at(tos,idx) == '{' && at(tos,idx+1) =='*') 
+      if (at (tos, idx) == '{' && at (tos, idx + 1) == '*')
 	{
-	    cattext(&out,"/*");
-	    idx+=2;
+	  cattext (&out, "/*");
+	  idx += 2;
 	}
-	else if (at(tos,idx) == '*' && at(tos,idx+1) =='}') 
+      else if (at (tos, idx) == '*' && at (tos, idx + 1) == '}')
 	{
-	    cattext(&out,"*/");
-	    idx+=2;
+	  cattext (&out, "*/");
+	  idx += 2;
 	}
-	else  
+      else
 	{
-	    catchar(&out, at(tos, idx));
-	    idx++;
+	  catchar (&out, at (tos, idx));
+	  idx++;
 	}
     }
 
+  overwrite_string (tos, &out);
 
-    overwrite_string(tos, &out);
-    
-    pc++;
-    
+  pc++;
 }
 
 #if 0
@@ -581,843 +578,822 @@
 
 /* turn everything not starting with a . into a comment */
 
-WORD(manglecomments)
+WORD (manglecomments)
 {
-    unsigned int idx = 0;
-    string_type out;
-    init_string(&out);
-    
-    while (at(tos, idx)) 
+  unsigned int idx = 0;
+  string_type out;
+  init_string (&out);
+
+  while (at (tos, idx))
     {
-	if (at(tos,idx) == '\n' && at(tos,idx+1) =='*') 
+      if (at (tos, idx) == '\n' && at (tos, idx + 1) == '*')
 	{
-	    cattext(&out,"	/*");
-	    idx+=2;
+	  cattext (&out, "	/*");
+	  idx += 2;
 	}
-	else if (at(tos,idx) == '*' && at(tos,idx+1) =='}') 
+      else if (at (tos, idx) == '*' && at (tos, idx + 1) == '}')
 	{
-	    cattext(&out,"*/");
-	    idx+=2;
+	  cattext (&out, "*/");
+	  idx += 2;
 	}
-	else  
+      else
 	{
-	    catchar(&out, at(tos, idx));
-	    idx++;
+	  catchar (&out, at (tos, idx));
+	  idx++;
 	}
     }
 
+  overwrite_string (tos, &out);
 
-    overwrite_string(tos, &out);
-    
-    pc++;
-    
+  pc++;
 }
 
 #endif
 
 /* Mod tos so that only lines with leading dots remain */
 static void
-DEFUN_VOID(outputdots)
+outputdots (void)
 {
-    unsigned int idx = 0;
-    string_type out;
-    init_string(&out);
-    
-    while (at(tos, idx)) 
+  unsigned int idx = 0;
+  string_type out;
+  init_string (&out);
+
+  while (at (tos, idx))
     {
-	if (at(tos, idx) == '\n' && at(tos, idx+1) == '.') 
+      if (at (tos, idx) == '\n' && at (tos, idx + 1) == '.')
 	{
 	  char c;
 	  idx += 2;
-	    
-	    while ((c = at(tos, idx)) && c != '\n')
+
+	  while ((c = at (tos, idx)) && c != '\n')
 	    {
-	      if (c == '{' && at(tos,idx+1) =='*') 
+	      if (c == '{' && at (tos, idx + 1) == '*')
 		{
-		    cattext(&out," /*");
-		    idx+=2;
+		  cattext (&out, "/*");
+		  idx += 2;
 		}
-	      else if (c == '*' && at(tos,idx+1) =='}') 
+	      else if (c == '*' && at (tos, idx + 1) == '}')
 		{
-		    cattext(&out,"*/");
-		    idx+=2;
+		  cattext (&out, "*/");
+		  idx += 2;
 		}
 	      else
 		{
-		    catchar(&out, c);
-		    idx++;
+		  catchar (&out, c);
+		  idx++;
 		}
 	    }
-	    catchar(&out,'\n');
+	  catchar (&out, '\n');
 	}
-	else 
+      else
 	{
-	    idx++;
+	  idx++;
 	}
-    }	
+    }
 
-    overwrite_string(tos, &out);
-    pc++;
-    
+  overwrite_string (tos, &out);
+  pc++;
 }
 
 /* Find lines starting with . and | and put example around them on tos */
-WORD(courierize)
+WORD (courierize)
 {
-    string_type out;
-    unsigned int idx = 0;
-    int command = 0;
-    
-    init_string(&out);
-    
-    while (at(tos, idx)) 
+  string_type out;
+  unsigned int idx = 0;
+  int command = 0;
+
+  init_string (&out);
+
+  while (at (tos, idx))
     {
-	if (at(tos, idx) == '\n' 
-	    && (at(tos, idx +1 ) == '.'
-		|| at(tos,idx+1) == '|')) 
+      if (at (tos, idx) == '\n'
+	  && (at (tos, idx +1 ) == '.'
+	      || at (tos, idx + 1) == '|'))
 	{
-	    cattext(&out,"\n@example\n");
-	    do 
+	  cattext (&out, "\n@example\n");
+	  do
 	    {
-		idx += 2;
-		
-		while (at(tos, idx) && at(tos, idx)!='\n')
+	      idx += 2;
+
+	      while (at (tos, idx) && at (tos, idx) != '\n')
 		{
-		    if (at(tos,idx)=='{' && at(tos,idx+1) =='*') 
+		  if (at (tos, idx) == '{' && at (tos, idx + 1) == '*')
 		    {
-			cattext(&out," /*");
-			idx+=2;
+		      cattext (&out, "/*");
+		      idx += 2;
 		    }
-		    else if (at(tos,idx)=='*' && at(tos,idx+1) =='}') 
+		  else if (at (tos, idx) == '*' && at (tos, idx + 1) == '}')
 		    {
-			cattext(&out,"*/");
-			idx+=2;
+		      cattext (&out, "*/");
+		      idx += 2;
 		    }
-	            else if (at(tos,idx) == '{' && !command)
+		  else if (at (tos, idx) == '{' && !command)
 		    {
-			cattext(&out,"@{");
-			idx++;
+		      cattext (&out, "@{");
+		      idx++;
 		    }
-	            else if (at(tos,idx) == '}' && !command)
+		  else if (at (tos, idx) == '}' && !command)
 		    {
-			cattext(&out,"@}");
-			idx++;
+		      cattext (&out, "@}");
+		      idx++;
 		    }
-		    else 
+		  else
 		    {
-			if (at(tos,idx) == '@')
-			    command = 1;
-			else if (isspace((unsigned char) at(tos,idx))
-				 || at(tos,idx) == '}')
-			    command = 0;
-			catchar(&out, at(tos, idx));
-			idx++;
+		      if (at (tos, idx) == '@')
+			command = 1;
+		      else if (isspace ((unsigned char) at (tos, idx))
+			       || at (tos, idx) == '}')
+			command = 0;
+		      catchar (&out, at (tos, idx));
+		      idx++;
 		    }
-		    
+
 		}
-		catchar(&out,'\n');
-	    }  
-	    while (at(tos, idx) == '\n' 
-		   && ((at(tos, idx+1) == '.')
-		       || (at(tos,idx+1) == '|')))
-	      ;
-	    cattext(&out,"@end example");
+	      catchar (&out, '\n');
+	    }
+	  while (at (tos, idx) == '\n'
+		 && ((at (tos, idx + 1) == '.')
+		     || (at (tos, idx + 1) == '|')))
+	    ;
+	  cattext (&out, "@end example");
 	}
-	else 
-	{    
-	    catchar(&out, at(tos, idx));
-	    idx++;
+      else
+	{
+	  catchar (&out, at (tos, idx));
+	  idx++;
 	}
-    }    
+    }
 
-    overwrite_string(tos, &out);
-    pc++;
-
-    
+  overwrite_string (tos, &out);
+  pc++;
 }
 
 /* Finds any lines starting with "o ", if there are any, then turns
    on @itemize @bullet, and @items each of them. Then ends with @end
    itemize, inplace at TOS*/
 
-
-WORD(bulletize)
+WORD (bulletize)
 {
-    unsigned int idx = 0;
-    int on = 0;
-    string_type out;
-    init_string(&out);
-    
-    while (at(tos, idx)) {
-	if (at(tos, idx) == '@' &&
-	    at(tos, idx+1) == '*') 
-	{
-	  cattext(&out,"*");
-	  idx+=2;
-	}
-	
-	else
-	    if (at(tos, idx) == '\n' &&
-		at(tos, idx+1) == 'o' &&
-		isspace((unsigned char) at(tos, idx +2)))
-	    {
-		if (!on) 
-		{
-		    cattext(&out,"\n@itemize @bullet\n");
-		    on = 1;
-		    
-		}
-		cattext(&out,"\n@item\n");
-		idx+=3;
-	    }
-	    else 
-	    {
-		catchar(&out, at(tos, idx));
-		if (on && at(tos, idx) == '\n' &&
-		    at(tos, idx+1) == '\n' &&
-		    at(tos, idx+2) != 'o')
-		{
-		    cattext(&out, "@end itemize");
-		    on = 0;
-		}
-		idx++;
-		
-	    }
-	}
-    if (on) 
-    {
-	cattext(&out,"@end itemize\n");
-    }	
+  unsigned int idx = 0;
+  int on = 0;
+  string_type out;
+  init_string (&out);
 
-    delete_string(tos);
-    *tos = out;
-    pc++;
-    
+  while (at (tos, idx))
+    {
+      if (at (tos, idx) == '@'
+	  && at (tos, idx + 1) == '*')
+	{
+	  cattext (&out, "*");
+	  idx += 2;
+	}
+      else if (at (tos, idx) == '\n'
+	       && at (tos, idx + 1) == 'o'
+	       && isspace ((unsigned char) at (tos, idx + 2)))
+	{
+	  if (!on)
+	    {
+	      cattext (&out, "\n@itemize @bullet\n");
+	      on = 1;
+
+	    }
+	  cattext (&out, "\n@item\n");
+	  idx += 3;
+	}
+      else
+	{
+	  catchar (&out, at (tos, idx));
+	  if (on && at (tos, idx) == '\n'
+	      && at (tos, idx + 1) == '\n'
+	      && at (tos, idx + 2) != 'o')
+	    {
+	      cattext (&out, "@end itemize");
+	      on = 0;
+	    }
+	  idx++;
+
+	}
+    }
+  if (on)
+    {
+      cattext (&out, "@end itemize\n");
+    }
+
+  delete_string (tos);
+  *tos = out;
+  pc++;
 }
 
 /* Turn <<foo>> into @code{foo} in place at TOS*/
-   
 
-WORD(do_fancy_stuff)
+WORD (do_fancy_stuff)
 {
-    unsigned int idx = 0;
-    string_type out;
-    init_string(&out);
-    while (at(tos, idx)) 
+  unsigned int idx = 0;
+  string_type out;
+  init_string (&out);
+  while (at (tos, idx))
     {
-	if (at(tos, idx) == '<' 
-	    && at(tos, idx+1) == '<'
-	    && !isspace((unsigned char) at(tos,idx + 2))) 
+      if (at (tos, idx) == '<'
+	  && at (tos, idx + 1) == '<'
+	  && !isspace ((unsigned char) at (tos, idx + 2)))
 	{
-	    /* This qualifies as a << startup */
-	    idx +=2;
-	    cattext(&out,"@code{");
-	    while(at(tos,idx) &&
-		  at(tos,idx) != '>' )
+	  /* This qualifies as a << startup.  */
+	  idx += 2;
+	  cattext (&out, "@code{");
+	  while (at (tos, idx)
+		 && at (tos, idx) != '>' )
 	    {
-		catchar(&out, at(tos, idx));
-		idx++;
-		
+	      catchar (&out, at (tos, idx));
+	      idx++;
+
 	    }
-	    cattext(&out,"}");
-	    idx+=2;
+	  cattext (&out, "}");
+	  idx += 2;
 	}
-	else 
+      else
 	{
-	    catchar(&out, at(tos, idx));
-	    idx++;
+	  catchar (&out, at (tos, idx));
+	  idx++;
 	}
     }
-    delete_string(tos);
-    *tos = out;
-    pc++;
-    
-}
-/* A command is all upper case,and alone on a line */
-static int 
-DEFUN( iscommand,(ptr, idx),
-      string_type *ptr AND
-      unsigned int idx)
-{
-    unsigned int len = 0;
-    while (at(ptr,idx)) {
-	    if (isupper((unsigned char) at(ptr,idx)) || at(ptr,idx) == ' ' ||
-		at(ptr,idx) == '_') 
-	    {
-	     len++;
-	     idx++;
-	 }
-	    else if(at(ptr,idx) == '\n')
-	    {
-		if (len > 3) return 1;
-		return 0;
-	    }
-	    else return 0;
-	}
-    return 0;
+  delete_string (tos);
+  *tos = out;
+  pc++;
 
 }
 
+/* A command is all upper case,and alone on a line.  */
 
 static int
-DEFUN(copy_past_newline,(ptr, idx, dst),
-      string_type *ptr AND
-      unsigned int idx AND
-      string_type *dst)
+iscommand (ptr, idx)
+     string_type *ptr;
+     unsigned int idx;
 {
-    int column = 0;
-
-    while (at(ptr, idx) && at(ptr, idx) != '\n') 
+  unsigned int len = 0;
+  while (at (ptr, idx))
     {
-	if (at (ptr, idx) == '\t')
-	  {
-	    /* Expand tabs.  Neither makeinfo nor TeX can cope well with
-	       them.  */
-	    do
-	      catchar (dst, ' ');
-	    while (++column & 7);
-	  }
-	else
-	  {
-	    catchar(dst, at(ptr, idx));
-	    column++;
-	  }
-	idx++;
-	
-    }    
-    catchar(dst, at(ptr, idx));
-    idx++;
-    return idx;
+      if (isupper ((unsigned char) at (ptr, idx))
+	  || at (ptr, idx) == ' ' || at (ptr, idx) == '_')
+	{
+	  len++;
+	  idx++;
+	}
+      else if (at (ptr, idx) == '\n')
+	{
+	  if (len > 3)
+	    return 1;
+	  return 0;
+	}
+      else
+	return 0;
+    }
+  return 0;
+}
+
+static int
+copy_past_newline (ptr, idx, dst)
+     string_type *ptr;
+     unsigned int idx;
+     string_type *dst;
+{
+  int column = 0;
+
+  while (at (ptr, idx) && at (ptr, idx) != '\n')
+    {
+      if (at (ptr, idx) == '\t')
+	{
+	  /* Expand tabs.  Neither makeinfo nor TeX can cope well with
+	     them.  */
+	  do
+	    catchar (dst, ' ');
+	  while (++column & 7);
+	}
+      else
+	{
+	  catchar (dst, at (ptr, idx));
+	  column++;
+	}
+      idx++;
+
+    }
+  catchar (dst, at (ptr, idx));
+  idx++;
+  return idx;
 
 }
 
-WORD(icopy_past_newline)
+WORD (icopy_past_newline)
 {
-    tos++;
-    check_range ();
-    init_string(tos);
-    idx = copy_past_newline(ptr, idx, tos);
-    pc++;	
+  tos++;
+  check_range ();
+  init_string (tos);
+  idx = copy_past_newline (ptr, idx, tos);
+  pc++;
 }
 
 /* indent
-   Take the string at the top of the stack, do some prettying */
+   Take the string at the top of the stack, do some prettying.  */
 
-
-WORD(kill_bogus_lines)
+WORD (kill_bogus_lines)
 {
-    int sl ;
-    
-    int idx = 0;
-    int c;
-    int dot = 0    ;
-    
-    string_type out;    
-    init_string(&out);
-    /* Drop leading nl */
-    while (at(tos,idx) == '\n')
-    {
-	idx++;
-    }
-    c = idx;
-    
-    /* If the first char is a '.' prepend a newline so that it is
-       recognized properly later.  */
-    if (at (tos, idx) == '.')
-      catchar (&out, '\n');
+  int sl;
 
-    /* Find the last char */
-    while (at(tos,idx))
+  int idx = 0;
+  int c;
+  int dot = 0;
+
+  string_type out;
+  init_string (&out);
+  /* Drop leading nl.  */
+  while (at (tos, idx) == '\n')
     {
-	idx++;
+      idx++;
     }
-    
-    /* find the last non white before the nl */
+  c = idx;
+
+  /* If the first char is a '.' prepend a newline so that it is
+     recognized properly later.  */
+  if (at (tos, idx) == '.')
+    catchar (&out, '\n');
+
+  /* Find the last char.  */
+  while (at (tos, idx))
+    {
+      idx++;
+    }
+
+  /* Find the last non white before the nl.  */
+  idx--;
+
+  while (idx && isspace ((unsigned char) at (tos, idx)))
     idx--;
-    
-    while (idx && isspace((unsigned char) at(tos,idx)))
-     idx--;
-    idx++;
-    
-    /* Copy buffer upto last char, but blank lines before and after
-       dots don't count */
-    sl = 1;
+  idx++;
 
-    while (c < idx)
+  /* Copy buffer upto last char, but blank lines before and after
+     dots don't count.  */
+  sl = 1;
+
+  while (c < idx)
     {
-	if (at(tos,c) == '\n' 
-	    && at(tos,c+1) == '\n'
-	    && at(tos,c+2) == '.') 
+      if (at (tos, c) == '\n'
+	  && at (tos, c + 1) == '\n'
+	  && at (tos, c + 2) == '.')
 	{
-	    /* Ignore two newlines before a dot*/
-	    c++;
+	  /* Ignore two newlines before a dot.  */
+	  c++;
 	}
-	else if (at(tos,c) == '.' && sl)
+      else if (at (tos, c) == '.' && sl)
 	{
-	    /* remember that this line started with a dot */
-	    dot=2;
+	  /* remember that this line started with a dot.  */
+	  dot = 2;
 	}
-	else if (at(tos,c) == '\n' 
-		 && at(tos,c+1) == '\n'
-		 && dot)
+      else if (at (tos, c) == '\n'
+	       && at (tos, c + 1) == '\n'
+	       && dot)
 	{
-	    c++;
-	    /* Ignore two newlines when last line was dot */
+	  c++;
+	  /* Ignore two newlines when last line was dot.  */
 	}
 
-	catchar(&out, at(tos,c));
-	if (at(tos,c) == '\n')
+      catchar (&out, at (tos, c));
+      if (at (tos, c) == '\n')
 	{
-	    sl = 1;
-	    
-	    if (dot == 2)dot=1;else dot = 0;
+	  sl = 1;
+
+	  if (dot == 2)
+	    dot = 1;
+	  else
+	    dot = 0;
 	}
-	else
-	  sl = 0;
-	
-	c++;	
+      else
+	sl = 0;
+
+      c++;
 
     }
-    
-    /* Append nl*/
-    catchar(&out, '\n');
-    pc++;
-    delete_string(tos);
-    *tos = out;
-    
-    
+
+  /* Append nl.  */
+  catchar (&out, '\n');
+  pc++;
+  delete_string (tos);
+  *tos = out;
+
 }
 
-WORD(indent)
+WORD (indent)
 {
-    string_type out;
-    int tab = 0;
-    int idx = 0;
-    int ol =0;
-    init_string(&out);
-    while (at(tos,idx)) {
-	    switch (at(tos,idx)) 
+  string_type out;
+  int tab = 0;
+  int idx = 0;
+  int ol = 0;
+  init_string (&out);
+  while (at (tos, idx))
+    {
+      switch (at (tos, idx))
+	{
+	case '\n':
+	  cattext (&out, "\n");
+	  idx++;
+	  if (tab && at (tos, idx))
 	    {
-	      case '\n':
-		cattext(&out,"\n");
-		idx++;
-		if (tab && at(tos,idx))
-		{
-		    cattext(&out,"    ");
-		}
-		ol = 0;
-		break;
-	      case '(':
-		tab++;
-		if (ol == 0)
-		    cattext(&out,"   ");
-		idx++;
-		cattext(&out,"(");
-		ol = 1;
-		break;
-	      case ')':
-		tab--;
-		cattext(&out,")");
-		idx++;
-		ol=1;
-		
-		break;
-	      default:
-		catchar(&out,at(tos,idx));
-		ol=1;
-		
-		idx++;
-		break;
+	      cattext (&out, "    ");
 	    }
-	}	
+	  ol = 0;
+	  break;
+	case '(':
+	  tab++;
+	  if (ol == 0)
+	    cattext (&out, "   ");
+	  idx++;
+	  cattext (&out, "(");
+	  ol = 1;
+	  break;
+	case ')':
+	  tab--;
+	  cattext (&out, ")");
+	  idx++;
+	  ol = 1;
 
-    pc++;
-    delete_string(tos);
-    *tos = out;
+	  break;
+	default:
+	  catchar (&out, at (tos, idx));
+	  ol = 1;
 
-}
-
-
-WORD(get_stuff_in_command)
-{
-    tos++;
-    check_range ();
-    init_string(tos);
-
-    while (at(ptr, idx)) {
-	    if (iscommand(ptr, idx))  break;
-	    idx =   copy_past_newline(ptr, idx, tos);
+	  idx++;
+	  break;
 	}
-    pc++;    
+    }
+
+  pc++;
+  delete_string (tos);
+  *tos = out;
+
 }
 
-WORD(swap)
+WORD (get_stuff_in_command)
 {
-    string_type t;
-    
-    t = tos[0];
-    tos[0] = tos[-1];
-    tos[-1] =t; 
-    pc++;
-    
+  tos++;
+  check_range ();
+  init_string (tos);
+
+  while (at (ptr, idx))
+    {
+      if (iscommand (ptr, idx))
+	break;
+      idx = copy_past_newline (ptr, idx, tos);
+    }
+  pc++;
 }
 
-WORD(other_dup)
+WORD (swap)
 {
-    tos++;
-    check_range ();
-    init_string(tos);
-    catstr(tos, tos-1);
-    pc++;
+  string_type t;
+
+  t = tos[0];
+  tos[0] = tos[-1];
+  tos[-1] = t;
+  pc++;
 }
 
-WORD(drop)
+WORD (other_dup)
+{
+  tos++;
+  check_range ();
+  init_string (tos);
+  catstr (tos, tos - 1);
+  pc++;
+}
+
+WORD (drop)
 {
   tos--;
   check_range ();
   pc++;
 }
 
-WORD(idrop)
+WORD (idrop)
 {
   isp--;
   icheck_range ();
   pc++;
 }
 
-WORD(icatstr)
+WORD (icatstr)
 {
-    tos--;
-    check_range ();
-    catstr(tos, tos+1);
-    delete_string(tos+1);
-    pc++;
+  tos--;
+  check_range ();
+  catstr (tos, tos + 1);
+  delete_string (tos + 1);
+  pc++;
 }
 
-WORD(skip_past_newline)
+WORD (skip_past_newline)
 {
-    while (at(ptr,idx) 
-	   && at(ptr,idx) != '\n')
-     idx++;
+  while (at (ptr, idx)
+	 && at (ptr, idx) != '\n')
     idx++;
-    pc++;
+  idx++;
+  pc++;
 }
 
-
-WORD(internalmode)
+WORD (internalmode)
 {
-    internal_mode = *(isp);
-    isp--;
-    icheck_range ();
-    pc++;
-}
-
-WORD(maybecatstr)
-{
-    if (internal_wanted == internal_mode) 
-    {
-	catstr(tos-1, tos);
-    }
-    delete_string(tos);
-    tos--;
-    check_range ();
-    pc++;
-}
-
-char *
-DEFUN(nextword,(string, word),
-      char *string AND
-      char **word)
-{
-    char *word_start;
-    int idx;
-    char *dst;
-    char *src;
-    
-    int length = 0;
-    
-    while (isspace((unsigned char) *string) || *string == '-') {
-	    if (*string == '-') 
-	    {
-		while (*string && *string != '\n') 
-		 string++;
-		
-	    }
-	    else {
-		    string++;
-		}
-	}
-    if (!*string) return 0;
-    
-    word_start = string;
-    if (*string == '"') 
-      {
-	do
-	  {
-	    string++;
-	    length++;
-	    if (*string == '\\')
-	      {
-		string += 2;
-		length += 2;
-	      }
-	  }
-	while (*string != '"');
-      }
-    else     
-      {
-	while (!isspace((unsigned char) *string)) 
-	{
-	    string++;
-	    length++;
-	
-	}
-    }
-    
-    *word = malloc(length + 1);
-
-    dst = *word;
-    src = word_start;
-
-
-    for (idx= 0; idx < length; idx++) 
-      {
-	if (src[idx] == '\\')
-	  switch (src[idx+1])
-	    {
-	    case 'n':
-	      *dst++ = '\n';
-	      idx++;
-	      break;
-	    case '"':
-	    case '\\':
-	      *dst++ = src[idx+1];
-	      idx++;
-	      break;
-	    default:
-	      *dst++ = '\\';
-	      break;
-	    }
-	else
-	  *dst++ = src[idx];
-    }
-    *dst++ = 0;
-
-
-
-
-
-    if(*string)    
-     return string + 1;
-    else 
-     return 0;
-    
-}
-dict_type *root;
-dict_type *
-DEFUN(lookup_word,(word),
-      char *word)
-{
-  dict_type *ptr = root;
-  while (ptr) {
-      if (strcmp(ptr->word, word) == 0) return ptr;
-      ptr = ptr->next;
-	    
-    }
-  if (warning)
-   fprintf(stderr,"Can't find %s\n",word);
-  return 0;
-    
-    
-}
-
-static void DEFUN_VOID(perform)
-{
-  tos = stack;
-    
-  while (at(ptr, idx)) {
-      /* It's worth looking through the command list */
-      if (iscommand(ptr, idx))
-      {
-	char *next;
-	dict_type *word ;
-		
-	(void)		nextword(addr(ptr, idx), &next);
-
-
-	word = lookup_word(next);
-
-
-		
-
-	if (word) 
-	{
-	  exec(word);
-	}
-	else
-	{
-	  if (warning)
-	   fprintf(stderr,"warning, %s is not recognised\n",  next);
-	  skip_past_newline();
-	}
-		
-      }
-      else skip_past_newline();
-
-    }
-}
-
-dict_type *
-DEFUN(newentry,(word),
-      char *word)
-{
-    dict_type *new = (dict_type *)malloc(sizeof(dict_type));
-    new->word = word;
-    new->next = root;
-    root = new;
-    new->code = (stinst_type *)malloc(sizeof(stinst_type ));
-    new->code_length = 1;
-    new->code_end = 0;
-    return new;
-    
-}
-
-
-unsigned int
-DEFUN(add_to_definition,(entry, word), 
-      dict_type *entry AND
-      stinst_type word)
-{
-    if (entry->code_end == entry->code_length) 
-    {
-	entry->code_length += 2;
-	entry->code =
-	 (stinst_type *) realloc((char *)(entry->code),
-			       entry->code_length *sizeof(word_type));
-    }
-    entry->code[entry->code_end] = word;
-    
-return     entry->code_end++;  
-}
-
-
-
-
-
-
-
-void
-DEFUN(add_intrinsic,(name, func),
-      char *name AND
-      void (*func)())
-{
-    dict_type *new = newentry(name);
-    add_to_definition(new, func);
-    add_to_definition(new, 0);
-}
-
-void
-DEFUN(add_var,(name),
-      char *name)
-{
-    dict_type *new = newentry(name);
-    add_to_definition(new, push_number);
-    add_to_definition(new, (stinst_type)(&(new->var)));
-    add_to_definition(new,0);
-}
-
-
-void 
-DEFUN(compile, (string), 
-      char *string)
-{
-    /* add words to the dictionary */
-    char *word;
-    string = nextword(string, &word);
-    while (string && *string && word[0]) 
-    {
-	if (strcmp(word,"var")==0) 
-	{
- string=nextword(string, &word);
-	  
-	  add_var(word);
- string=nextword(string, &word);
-	}
-else	
-	    
-	if (word[0] == ':')
-	{
-	    dict_type *ptr;
-	    /* Compile a word and add to dictionary */
-	    string = nextword(string, &word);
-	    
-	    ptr = newentry(word);
-	    string = nextword(string, &word);
-	    while (word[0] != ';' ) 
-	    {
-		 switch (word[0]) 
-		 {
-		   case '"':
-		     /* got a string, embed magic push string
-			function */
-		     add_to_definition(ptr, push_text);
-		     add_to_definition(ptr, (stinst_type)(word+1));
-		     break;
-		   case '0':
-		   case '1':
-		   case '2':
-		   case '3':
-		   case '4':
-		   case '5':
-		   case '6':
-		   case '7':
-		   case '8':
-		   case '9':
-		     /* Got a number, embedd the magic push number
-			function */
-		     add_to_definition(ptr, push_number);
-		     add_to_definition(ptr, (stinst_type)atol(word));
-		     break;
-		   default:
-		     add_to_definition(ptr, call);
-		     add_to_definition(ptr, (stinst_type)lookup_word(word));
-		 }
-
-		string = nextword(string, &word);		     
-	    }
-	    add_to_definition(ptr,0);
-	    string = nextword(string, &word);
-	}
-	else 
-	{
-	    fprintf(stderr,"syntax error at %s\n",string-1);
-	}	    
-    }
-
-}
-
- 
-static void DEFUN_VOID(bang)
-{
-  *(long *)((isp[0])) = isp[-1];
-  isp-=2;
+  internal_mode = *(isp);
+  isp--;
   icheck_range ();
   pc++;
 }
 
-WORD(atsign)
+WORD (maybecatstr)
 {
-    isp[0] = *(long *)(isp[0]);
-    pc++;
+  if (internal_wanted == internal_mode)
+    {
+      catstr (tos - 1, tos);
+    }
+  delete_string (tos);
+  tos--;
+  check_range ();
+  pc++;
 }
 
-WORD(hello)
+char *
+nextword (string, word)
+     char *string;
+     char **word;
 {
-  printf("hello\n");
-  pc++;    
+  char *word_start;
+  int idx;
+  char *dst;
+  char *src;
+
+  int length = 0;
+
+  while (isspace ((unsigned char) *string) || *string == '-')
+    {
+      if (*string == '-')
+	{
+	  while (*string && *string != '\n')
+	    string++;
+
+	}
+      else
+	{
+	  string++;
+	}
+    }
+  if (!*string)
+    return 0;
+
+  word_start = string;
+  if (*string == '"')
+    {
+      do
+	{
+	  string++;
+	  length++;
+	  if (*string == '\\')
+	    {
+	      string += 2;
+	      length += 2;
+	    }
+	}
+      while (*string != '"');
+    }
+  else
+    {
+      while (!isspace ((unsigned char) *string))
+	{
+	  string++;
+	  length++;
+
+	}
+    }
+
+  *word = malloc (length + 1);
+
+  dst = *word;
+  src = word_start;
+
+  for (idx = 0; idx < length; idx++)
+    {
+      if (src[idx] == '\\')
+	switch (src[idx + 1])
+	  {
+	  case 'n':
+	    *dst++ = '\n';
+	    idx++;
+	    break;
+	  case '"':
+	  case '\\':
+	    *dst++ = src[idx + 1];
+	    idx++;
+	    break;
+	  default:
+	    *dst++ = '\\';
+	    break;
+	  }
+      else
+	*dst++ = src[idx];
+    }
+  *dst++ = 0;
+
+  if (*string)
+    return string + 1;
+  else
+    return 0;
 }
 
-WORD(stdout_)
+dict_type *root;
+
+dict_type *
+lookup_word (word)
+     char *word;
+{
+  dict_type *ptr = root;
+  while (ptr)
+    {
+      if (strcmp (ptr->word, word) == 0)
+	return ptr;
+      ptr = ptr->next;
+    }
+  if (warning)
+    fprintf (stderr, "Can't find %s\n", word);
+  return 0;
+}
+
+static void
+perform (void)
+{
+  tos = stack;
+
+  while (at (ptr, idx))
+    {
+      /* It's worth looking through the command list.  */
+      if (iscommand (ptr, idx))
+	{
+	  char *next;
+	  dict_type *word;
+
+	  (void) nextword (addr (ptr, idx), &next);
+
+	  word = lookup_word (next);
+
+	  if (word)
+	    {
+	      exec (word);
+	    }
+	  else
+	    {
+	      if (warning)
+		fprintf (stderr, "warning, %s is not recognised\n", next);
+	      skip_past_newline ();
+	    }
+
+	}
+      else
+	skip_past_newline ();
+    }
+}
+
+dict_type *
+newentry (word)
+     char *word;
+{
+  dict_type *new = (dict_type *) malloc (sizeof (dict_type));
+  new->word = word;
+  new->next = root;
+  root = new;
+  new->code = (stinst_type *) malloc (sizeof (stinst_type));
+  new->code_length = 1;
+  new->code_end = 0;
+  return new;
+}
+
+unsigned int
+add_to_definition (entry, word)
+     dict_type *entry;
+     stinst_type word;
+{
+  if (entry->code_end == entry->code_length)
+    {
+      entry->code_length += 2;
+      entry->code =
+	(stinst_type *) realloc ((char *) (entry->code),
+				 entry->code_length * sizeof (word_type));
+    }
+  entry->code[entry->code_end] = word;
+
+  return entry->code_end++;
+}
+
+void
+add_intrinsic (name, func)
+     char *name;
+     void (*func) ();
+{
+  dict_type *new = newentry (name);
+  add_to_definition (new, func);
+  add_to_definition (new, 0);
+}
+
+void
+add_var (name)
+     char *name;
+{
+  dict_type *new = newentry (name);
+  add_to_definition (new, push_number);
+  add_to_definition (new, (stinst_type) (&(new->var)));
+  add_to_definition (new, 0);
+}
+
+void
+compile (string)
+     char *string;
+{
+  /* Add words to the dictionary.  */
+  char *word;
+  string = nextword (string, &word);
+  while (string && *string && word[0])
+    {
+      if (strcmp (word, "var") == 0)
+	{
+	  string = nextword (string, &word);
+
+	  add_var (word);
+	  string = nextword (string, &word);
+	}
+      else if (word[0] == ':')
+	{
+	  dict_type *ptr;
+	  /* Compile a word and add to dictionary.  */
+	  string = nextword (string, &word);
+
+	  ptr = newentry (word);
+	  string = nextword (string, &word);
+	  while (word[0] != ';')
+	    {
+	      switch (word[0])
+		{
+		case '"':
+		  /* got a string, embed magic push string
+		     function */
+		  add_to_definition (ptr, push_text);
+		  add_to_definition (ptr, (stinst_type) (word + 1));
+		  break;
+		case '0':
+		case '1':
+		case '2':
+		case '3':
+		case '4':
+		case '5':
+		case '6':
+		case '7':
+		case '8':
+		case '9':
+		  /* Got a number, embedd the magic push number
+		     function */
+		  add_to_definition (ptr, push_number);
+		  add_to_definition (ptr, (stinst_type) atol (word));
+		  break;
+		default:
+		  add_to_definition (ptr, call);
+		  add_to_definition (ptr, (stinst_type) lookup_word (word));
+		}
+
+	      string = nextword (string, &word);
+	    }
+	  add_to_definition (ptr, 0);
+	  string = nextword (string, &word);
+	}
+      else
+	{
+	  fprintf (stderr, "syntax error at %s\n", string - 1);
+	}
+    }
+}
+
+static void
+bang (void)
+{
+  *(long *) ((isp[0])) = isp[-1];
+  isp -= 2;
+  icheck_range ();
+  pc++;
+}
+
+WORD (atsign)
+{
+  isp[0] = *(long *) (isp[0]);
+  pc++;
+}
+
+WORD (hello)
+{
+  printf ("hello\n");
+  pc++;
+}
+
+WORD (stdout_)
 {
   isp++;
   icheck_range ();
@@ -1425,7 +1401,7 @@
   pc++;
 }
 
-WORD(stderr_)
+WORD (stderr_)
 {
   isp++;
   icheck_range ();
@@ -1433,7 +1409,7 @@
   pc++;
 }
 
-WORD(print)
+WORD (print)
 {
   if (*isp == 1)
     write_buffer (tos, stdout);
@@ -1448,29 +1424,29 @@
   pc++;
 }
 
-
-static void DEFUN(read_in, (str, file), 
-	   string_type *str AND
-		  FILE *file)
+static void
+read_in (str, file)
+     string_type *str;
+     FILE *file;
 {
-    char buff[10000];    
-    unsigned int r;
-    do 
+  char buff[10000];
+  unsigned int r;
+  do
     {
-	r = fread(buff, 1, sizeof(buff), file);
-	catbuf(str, buff, r);
+      r = fread (buff, 1, sizeof (buff), file);
+      catbuf (str, buff, r);
     }
-    while (r);
-    buff[0] = 0;
-    
-    catbuf(str, buff,1);
+  while (r);
+  buff[0] = 0;
+
+  catbuf (str, buff, 1);
 }
 
-
-static void DEFUN_VOID(usage)
+static void
+usage (void)
 {
-    fprintf(stderr,"usage: -[d|i|g] <file >file\n");
-    exit(33);    
+  fprintf (stderr, "usage: -[d|i|g] <file >file\n");
+  exit (33);
 }
 
 /* There is no reliable way to declare exit.  Sometimes it returns
@@ -1484,95 +1460,98 @@
   exit (0);
 }
 
-int DEFUN(main,(ac,av),
-int ac AND
-char *av[])
+int
+main (ac, av)
+     int ac;
+     char *av[];
 {
   unsigned int i;
   string_type buffer;
   string_type pptr;
 
-  init_string(&buffer);
-  init_string(&pptr);
-  init_string(stack+0);
-  tos=stack+1;
+  init_string (&buffer);
+  init_string (&pptr);
+  init_string (stack + 0);
+  tos = stack + 1;
   ptr = &pptr;
-    
-  add_intrinsic("push_text", push_text);
-  add_intrinsic("!", bang);
-  add_intrinsic("@", atsign);
-  add_intrinsic("hello",hello);    
-  add_intrinsic("stdout",stdout_);    
-  add_intrinsic("stderr",stderr_);    
-  add_intrinsic("print",print);    
-  add_intrinsic("skip_past_newline", skip_past_newline );
-  add_intrinsic("catstr", icatstr );
-  add_intrinsic("copy_past_newline", icopy_past_newline );
-  add_intrinsic("dup", other_dup );
-  add_intrinsic("drop", drop);
-  add_intrinsic("idrop", idrop);
-  add_intrinsic("remchar", remchar );
-  add_intrinsic("get_stuff_in_command", get_stuff_in_command );
-  add_intrinsic("do_fancy_stuff", do_fancy_stuff );
-  add_intrinsic("bulletize", bulletize );
-  add_intrinsic("courierize", courierize );
+
+  add_intrinsic ("push_text", push_text);
+  add_intrinsic ("!", bang);
+  add_intrinsic ("@", atsign);
+  add_intrinsic ("hello", hello);
+  add_intrinsic ("stdout", stdout_);
+  add_intrinsic ("stderr", stderr_);
+  add_intrinsic ("print", print);
+  add_intrinsic ("skip_past_newline", skip_past_newline);
+  add_intrinsic ("catstr", icatstr);
+  add_intrinsic ("copy_past_newline", icopy_past_newline);
+  add_intrinsic ("dup", other_dup);
+  add_intrinsic ("drop", drop);
+  add_intrinsic ("idrop", idrop);
+  add_intrinsic ("remchar", remchar);
+  add_intrinsic ("get_stuff_in_command", get_stuff_in_command);
+  add_intrinsic ("do_fancy_stuff", do_fancy_stuff);
+  add_intrinsic ("bulletize", bulletize);
+  add_intrinsic ("courierize", courierize);
   /* If the following line gives an error, exit() is not declared in the
      ../hosts/foo.h file for this host.  Fix it there, not here!  */
   /* No, don't fix it anywhere; see comment on chew_exit--Ian Taylor.  */
-  add_intrinsic("exit", chew_exit );
-  add_intrinsic("swap", swap );
-  add_intrinsic("outputdots", outputdots );
-  add_intrinsic("paramstuff", paramstuff );
-  add_intrinsic("maybecatstr", maybecatstr );
-  add_intrinsic("translatecomments", translatecomments );
-  add_intrinsic("kill_bogus_lines", kill_bogus_lines);
-  add_intrinsic("indent", indent);
-  add_intrinsic("internalmode", internalmode);
-  add_intrinsic("print_stack_level", print_stack_level);
-  add_intrinsic("strip_trailing_newlines", strip_trailing_newlines);
-    
-  /* Put a nl at the start */
-  catchar(&buffer,'\n');
+  add_intrinsic ("exit", chew_exit);
+  add_intrinsic ("swap", swap);
+  add_intrinsic ("outputdots", outputdots);
+  add_intrinsic ("paramstuff", paramstuff);
+  add_intrinsic ("maybecatstr", maybecatstr);
+  add_intrinsic ("translatecomments", translatecomments);
+  add_intrinsic ("kill_bogus_lines", kill_bogus_lines);
+  add_intrinsic ("indent", indent);
+  add_intrinsic ("internalmode", internalmode);
+  add_intrinsic ("print_stack_level", print_stack_level);
+  add_intrinsic ("strip_trailing_newlines", strip_trailing_newlines);
 
-  read_in(&buffer, stdin); 
-  remove_noncomments(&buffer, ptr);
-  for (i= 1; i < (unsigned int) ac; i++) 
-  {
-    if (av[i][0] == '-')
+  /* Put a nl at the start.  */
+  catchar (&buffer, '\n');
+
+  read_in (&buffer, stdin);
+  remove_noncomments (&buffer, ptr);
+  for (i = 1; i < (unsigned int) ac; i++)
     {
-      if (av[i][1] == 'f')
-      {
-	string_type b;
-	FILE *f;
-	init_string(&b);
-
-	f  = fopen(av[i+1],"r");
-	if (!f) 
+      if (av[i][0] == '-')
 	{
-	  fprintf(stderr,"Can't open the input file %s\n",av[i+1]);
-	  return 33;
-	}
+	  if (av[i][1] == 'f')
+	    {
+	      string_type b;
+	      FILE *f;
+	      init_string (&b);
 
-	read_in(&b, f);
-	compile(b.ptr);
-	perform();	
-      }
-      else if (av[i][1] == 'i') 
-      {
-	internal_wanted = 1;
-      }
-      else if (av[i][1] == 'w') 
-      {
-	warning = 1;
-      }
-      else
-	usage ();
+	      f = fopen (av[i + 1], "r");
+	      if (!f)
+		{
+		  fprintf (stderr, "Can't open the input file %s\n",
+			   av[i + 1]);
+		  return 33;
+		}
+
+	      read_in (&b, f);
+	      compile (b.ptr);
+	      perform ();
+	    }
+	  else if (av[i][1] == 'i')
+	    {
+	      internal_wanted = 1;
+	    }
+	  else if (av[i][1] == 'w')
+	    {
+	      warning = 1;
+	    }
+	  else
+	    usage ();
+	}
     }
-  }      
-  write_buffer(stack+0, stdout);
+  write_buffer (stack + 0, stdout);
   if (tos != stack)
     {
-      fprintf (stderr, "finishing with current stack level %d\n", tos - stack);
+      fprintf (stderr, "finishing with current stack level %d\n",
+	       tos - stack);
       return 1;
     }
   return 0;
diff --git a/bfd/dwarf1.c b/bfd/dwarf1.c
index da184cc..b96adc5 100644
--- a/bfd/dwarf1.c
+++ b/bfd/dwarf1.c
@@ -1,7 +1,7 @@
 /* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line).
-   Copyright 1998, 1999 Free Software Foundation, Inc.
+   Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
 
-Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).  
+Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).
 
 This file is part of BFD.
 
@@ -26,121 +26,115 @@
 #include "elf-bfd.h"
 #include "elf/dwarf.h"
 
-/* dwarf1_debug is the starting point for all dwarf1 info. */
+/* dwarf1_debug is the starting point for all dwarf1 info.  */
 
 struct dwarf1_debug {
 
-  /* The bfd we are working with. */
+  /* The bfd we are working with.  */
   bfd* abfd;
 
-  /* List of already parsed compilation units. */
+  /* List of already parsed compilation units.  */
   struct dwarf1_unit* lastUnit;
 
-  /* The buffer for the .debug section. 
-     Zero indicates that the .debug section failed to load. */
+  /* The buffer for the .debug section.
+     Zero indicates that the .debug section failed to load.  */
   char* debug_section;
 
-  /* Pointer to the end of the .debug_info section memory buffer. */
+  /* Pointer to the end of the .debug_info section memory buffer.  */
   char* debug_section_end;
 
-  /* The buffer for the .line section. */
+  /* The buffer for the .line section.  */
   char* line_section;
 
-  /* End of that buffer. */
+  /* End of that buffer.  */
   char* line_section_end;
 
-  /* The current or next unread die within the .debug section. */
+  /* The current or next unread die within the .debug section.  */
   char* currentDie;
 };
 
-/* One dwarf1_unit for each parsed compilation unit die. */
+/* One dwarf1_unit for each parsed compilation unit die.  */
 
 struct dwarf1_unit {
-  /* Linked starting from stash->lastUnit. */
+  /* Linked starting from stash->lastUnit.  */
   struct dwarf1_unit* prev;
 
-  /* Name of the compilation unit. */
+  /* Name of the compilation unit.  */
   char* name;
 
-  /* The highest and lowest address used in the compilation unit. */
+  /* The highest and lowest address used in the compilation unit.  */
   unsigned long low_pc;
   unsigned long high_pc;
 
   /* Does this unit have a statement list? */
   int has_stmt_list;
 
-  /* If any, the offset of the line number table in the .line section. */
+  /* If any, the offset of the line number table in the .line section.  */
   unsigned long stmt_list_offset;
 
-  /* If non-zero, a pointer to the first child of this unit. */
+  /* If non-zero, a pointer to the first child of this unit.  */
   char* first_child;
 
   /* How many line entries? */
   unsigned long line_count;
 
-  /* The decoded line number table (line_count entries). */
+  /* The decoded line number table (line_count entries).  */
   struct linenumber* linenumber_table;
 
-  /* The list of functions in this unit. */
+  /* The list of functions in this unit.  */
   struct dwarf1_func* func_list;
 };
 
-
-
 /* One dwarf1_func for each parsed function die.  */
 
 struct dwarf1_func {
-  /* Linked starting from aUnit->func_list. */
+  /* Linked starting from aUnit->func_list.  */
   struct dwarf1_func* prev;
-  
-  /* Name of function. */
+
+  /* Name of function.  */
   char* name;
-  
-  /* The highest and lowest address used in the compilation unit. */
+
+  /* The highest and lowest address used in the compilation unit.  */
   unsigned long low_pc;
   unsigned long high_pc;
 };
 
-
-/* Used to return info about a parsed die. */
+/* Used to return info about a parsed die.  */
 struct die_info {
   unsigned long length;
   unsigned long sibling;
   unsigned long low_pc;
   unsigned long high_pc;
   unsigned long stmt_list_offset;
-  
-  char* name; 
-  
+
+  char* name;
+
   int has_stmt_list;
 
   unsigned short tag;
 };
 
-
-/* Parsed line number information. */
+/* Parsed line number information.  */
 struct linenumber {
-  /* First address in the line. */
+  /* First address in the line.  */
   unsigned long addr;
 
-  /* The line number. */
+  /* The line number.  */
   unsigned long linenumber;
 };
 
-
-/* Find the form of an attr, from the attr field. */
+/* Find the form of an attr, from the attr field.  */
 #define FORM_FROM_ATTR(attr)	((attr) & 0xF)	/* Implicitly specified */
 
-
 /* Return a newly allocated dwarf1_unit.  It should be cleared and
-   then attached into the 'stash' at 'stash->lastUnit'. */
+   then attached into the 'stash' at 'stash->lastUnit'.  */
 
 static struct dwarf1_unit*
 alloc_dwarf1_unit (stash)
   struct dwarf1_debug* stash;
 {
-  struct dwarf1_unit* x = 
-    (struct dwarf1_unit*) bfd_zalloc (stash->abfd, 
+  struct dwarf1_unit* x =
+    (struct dwarf1_unit*) bfd_zalloc (stash->abfd,
 				      sizeof (struct dwarf1_unit));
   x->prev = stash->lastUnit;
   stash->lastUnit = x;
@@ -149,28 +143,28 @@
 }
 
 /* Return a newly allocated dwarf1_func.  It must be cleared and
-   attached into 'aUnit' at 'aUnit->func_list'. */
+   attached into 'aUnit' at 'aUnit->func_list'.  */
 
 static struct dwarf1_func*
 alloc_dwarf1_func (stash, aUnit)
      struct dwarf1_debug* stash;
      struct dwarf1_unit* aUnit;
 {
-  struct dwarf1_func* x = 
-    (struct dwarf1_func*) bfd_zalloc (stash->abfd, 
+  struct dwarf1_func* x =
+    (struct dwarf1_func*) bfd_zalloc (stash->abfd,
 				      sizeof (struct dwarf1_func));
   x->prev = aUnit->func_list;
   aUnit->func_list = x;
-  
+
   return x;
 }
 
 /* parse_die - parse a Dwarf1 die.
    Parse the die starting at 'aDiePtr' into 'aDieInfo'.
    'abfd' must be the bfd from which the section that 'aDiePtr'
-   points to was pulled from. 
+   points to was pulled from.
 
-   Return false if the die is invalidly formatted; true otherwise. */
+   Return false if the die is invalidly formatted; true otherwise.  */
 
 static boolean
 parse_die (abfd, aDieInfo, aDiePtr)
@@ -181,36 +175,36 @@
   char* this_die = aDiePtr;
   char* xptr = this_die;
 
-  memset (aDieInfo,0,sizeof(*aDieInfo));
+  memset (aDieInfo,0,sizeof (*aDieInfo));
 
-  /* First comes the length. */
-  aDieInfo->length = bfd_get_32 (abfd, xptr);
+  /* First comes the length.  */
+  aDieInfo->length = bfd_get_32 (abfd, (bfd_byte *) xptr);
   xptr += 4;
   if (aDieInfo->length == 0)
     return false;
   if (aDieInfo->length < 6)
     {
-      /* Just padding bytes. */
+      /* Just padding bytes.  */
       aDieInfo->tag = TAG_padding;
       return true;
     }
 
-  /* Then the tag. */
-  aDieInfo->tag = bfd_get_16 (abfd, xptr);
+  /* Then the tag.  */
+  aDieInfo->tag = bfd_get_16 (abfd, (bfd_byte *) xptr);
   xptr += 2;
-      
-  /* Then the attributes. */
+
+  /* Then the attributes.  */
   while (xptr < (this_die + aDieInfo->length))
     {
       unsigned short attr;
-      
-      /* Parse the attribute based on its form.  This section 
-         must handle all dwarf1 forms, but need only handle the
-	 actual attributes that we care about. */
 
-      attr = bfd_get_16 (abfd, xptr);
+      /* Parse the attribute based on its form.  This section
+         must handle all dwarf1 forms, but need only handle the
+	 actual attributes that we care about.  */
+
+      attr = bfd_get_16 (abfd, (bfd_byte *) xptr);
       xptr += 2;
-      
+
       switch (FORM_FROM_ATTR (attr))
 	{
 	case FORM_DATA2:
@@ -219,10 +213,10 @@
 	case FORM_DATA4:
 	case FORM_REF:
 	  if (attr == AT_sibling)
-	    aDieInfo->sibling = bfd_get_32 (abfd, xptr);
+	    aDieInfo->sibling = bfd_get_32 (abfd, (bfd_byte *) xptr);
 	  else if (attr == AT_stmt_list)
 	    {
-	      aDieInfo->stmt_list_offset = bfd_get_32 (abfd, xptr);
+	      aDieInfo->stmt_list_offset = bfd_get_32 (abfd, (bfd_byte *) xptr);
 	      aDieInfo->has_stmt_list = 1;
 	    }
 	  xptr += 4;
@@ -232,16 +226,16 @@
 	  break;
 	case FORM_ADDR:
 	  if (attr == AT_low_pc)
-	    aDieInfo->low_pc = bfd_get_32 (abfd, xptr);
+	    aDieInfo->low_pc = bfd_get_32 (abfd, (bfd_byte *) xptr);
 	  else if (attr == AT_high_pc)
-	    aDieInfo->high_pc = bfd_get_32 (abfd, xptr);
+	    aDieInfo->high_pc = bfd_get_32 (abfd, (bfd_byte *) xptr);
 	  xptr += 4;
 	  break;
 	case FORM_BLOCK2:
-	  xptr += 2 + bfd_get_16 (abfd, xptr);
+	  xptr += 2 + bfd_get_16 (abfd, (bfd_byte *) xptr);
 	  break;
 	case FORM_BLOCK4:
-	  xptr += 4 + bfd_get_32 (abfd, xptr);
+	  xptr += 4 + bfd_get_32 (abfd, (bfd_byte *) xptr);
 	  break;
 	case FORM_STRING:
 	  if (attr == AT_name)
@@ -255,9 +249,9 @@
 }
 
 /* Parse a dwarf1 line number table for 'aUnit->stmt_list_offset'
-   into 'aUnit->linenumber_table'.  Return false if an error 
-   occurs; true otherwise. */
-  
+   into 'aUnit->linenumber_table'.  Return false if an error
+   occurs; true otherwise.  */
+
 static boolean
 parse_line_table (stash, aUnit)
   struct dwarf1_debug* stash;
@@ -265,19 +259,19 @@
 {
   char* xptr;
 
-  /* Load the ".line" section from the bfd if we haven't already. */ 
+  /* Load the ".line" section from the bfd if we haven't already.  */
   if (stash->line_section == 0)
     {
       asection *msec;
       unsigned long size;
-      
+
       msec = bfd_get_section_by_name (stash->abfd, ".line");
       if (! msec)
 	return false;
-	  
+
       size = bfd_get_section_size_before_reloc (msec);
-      stash->line_section = (unsigned char*) bfd_alloc (stash->abfd, size);
-      
+      stash->line_section = (char *) bfd_alloc (stash->abfd, size);
+
       if (! stash->line_section)
 	return false;
 
@@ -298,36 +292,36 @@
       char* tblend;
       unsigned long base;
 
-      /* First comes the length. */
-      tblend = bfd_get_32 (stash->abfd, xptr) + xptr;
+      /* First comes the length.  */
+      tblend = bfd_get_32 (stash->abfd, (bfd_byte *) xptr) + xptr;
       xptr += 4;
 
-      /* Then the base address for each address in the table. */
-      base = bfd_get_32 (stash->abfd, xptr);
+      /* Then the base address for each address in the table.  */
+      base = bfd_get_32 (stash->abfd, (bfd_byte *) xptr);
       xptr += 4;
 
       /* How many line entrys?
 	 10 = 4 (line number) + 2 (pos in line) + 4 (address in line) */
       aUnit->line_count = (tblend - xptr) / 10;
 
-      /* Allocate an array for the entries. */
-      aUnit->linenumber_table = (struct linenumber*)
-	bfd_alloc (stash->abfd, 
+      /* Allocate an array for the entries.  */
+      aUnit->linenumber_table = (struct linenumber *)
+	bfd_alloc (stash->abfd,
 		   sizeof (struct linenumber) * aUnit->line_count);
-	
+
       for (eachLine = 0; eachLine < aUnit->line_count; eachLine++)
 	{
-	  /* A line number. */
+	  /* A line number.  */
 	  aUnit->linenumber_table[eachLine].linenumber
-	    = bfd_get_32 (stash->abfd, xptr);
+	    = bfd_get_32 (stash->abfd, (bfd_byte *) xptr);
 	  xptr += 4;
 
-	  /* Skip the position within the line. */
+	  /* Skip the position within the line.  */
 	  xptr += 2;
 
-	  /* And finally the address. */
-	  aUnit->linenumber_table[eachLine].addr 
-	    = base + bfd_get_32 (stash->abfd, xptr);
+	  /* And finally the address.  */
+	  aUnit->linenumber_table[eachLine].addr
+	    = base + bfd_get_32 (stash->abfd, (bfd_byte *) xptr);
 	  xptr += 4;
 	}
     }
@@ -338,7 +332,7 @@
 /* Parse each function die in a compilation unit 'aUnit'.
    The first child die of 'aUnit' should be in 'aUnit->first_child',
    the result is placed in 'aUnit->func_list'.
-   Return false if error; true otherwise. */
+   Return false if error; true otherwise.  */
 
 static boolean
 parse_functions_in_unit (stash, aUnit)
@@ -353,37 +347,37 @@
 	 )
       {
 	struct die_info eachDieInfo;
-	
+
 	if (! parse_die (stash->abfd, &eachDieInfo, eachDie))
 	  return false;
-	
+
 	if (eachDieInfo.tag == TAG_global_subroutine
 	    || eachDieInfo.tag == TAG_subroutine
 	    || eachDieInfo.tag == TAG_inlined_subroutine
 	    || eachDieInfo.tag == TAG_entry_point)
 	  {
 	    struct dwarf1_func* aFunc = alloc_dwarf1_func (stash,aUnit);
-	    
+
 	    aFunc->name = eachDieInfo.name;
 	    aFunc->low_pc = eachDieInfo.low_pc;
 	    aFunc->high_pc = eachDieInfo.high_pc;
 	  }
-	
+
 	/* Move to next sibling, if none, end loop */
 	if (eachDieInfo.sibling)
 	  eachDie = stash->debug_section + eachDieInfo.sibling;
 	else
 	  break;
       }
-  
+
   return true;
 }
 
 /* Find the nearest line to 'addr' in 'aUnit'.
-   Return whether we found the line (or a function) without error. */
+   Return whether we found the line (or a function) without error.  */
 
 static boolean
-dwarf1_unit_find_nearest_line (stash, aUnit, addr, 
+dwarf1_unit_find_nearest_line (stash, aUnit, addr,
 		       filename_ptr, functionname_ptr,
 		       linenumber_ptr)
   struct dwarf1_debug* stash;
@@ -427,8 +421,8 @@
 		}
 	    }
 
-	  for (eachFunc = aUnit->func_list; 
-	       eachFunc; 
+	  for (eachFunc = aUnit->func_list;
+	       eachFunc;
 	       eachFunc = eachFunc->prev)
 	    {
 	      if (eachFunc->low_pc <= addr
@@ -445,11 +439,8 @@
   return line_p || func_p;
 }
 
-
-
-
 /* The DWARF 1 version of find_nearest line.
-   Return true if the line is found without error. */
+   Return true if the line is found without error.  */
 
 boolean
 _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
@@ -472,31 +463,30 @@
   *filename_ptr = NULL;
   *functionname_ptr = NULL;
   *linenumber_ptr = 0;
-  
 
   if (! stash)
     {
       asection *msec;
       unsigned long size;
-      
+
       stash = elf_tdata (abfd)->dwarf1_find_line_info =
 	(struct dwarf1_debug*) bfd_zalloc (abfd, sizeof (struct dwarf1_debug));
-      
+
       if (! stash)
 	return false;
-      
+
       msec = bfd_get_section_by_name (abfd, ".debug");
       if (! msec)
 	{
 	  /* No dwarf1 info.  Note that at this point the stash
 	     has been allocated, but contains zeros, this lets
-	     future calls to this function fail quicker. */
+	     future calls to this function fail quicker.  */
 	  return false;
 	}
 
       size = bfd_get_section_size_before_reloc (msec);
-      stash->debug_section = (unsigned char*) bfd_alloc (abfd, size);
-      
+      stash->debug_section = (char *) bfd_alloc (abfd, size);
+
       if (! stash->debug_section)
 	return false;
 
@@ -512,20 +502,19 @@
     }
 
   /* A null debug_section indicates that there was no dwarf1 info
-     or that an error occured while setting up the stash. */
+     or that an error occured while setting up the stash.  */
 
   if (! stash->debug_section)
     return false;
-  
 
   /* Look at the previously parsed units to see if any contain
-     the addr. */
+     the addr.  */
   for (eachUnit = stash->lastUnit; eachUnit; eachUnit = eachUnit->prev)
     {
       if (eachUnit->low_pc <= addr && addr < eachUnit->high_pc)
 	return dwarf1_unit_find_nearest_line (stash, eachUnit, addr,
-					      filename_ptr, 
-					      functionname_ptr, 
+					      filename_ptr,
+					      functionname_ptr,
 					      linenumber_ptr);
     }
 
@@ -535,36 +524,36 @@
 
       if (! parse_die (stash->abfd, &aDieInfo, stash->currentDie))
 	return false;
-      
+
       if (aDieInfo.tag == TAG_compile_unit)
 	{
 	  struct dwarf1_unit* aUnit
 	    = alloc_dwarf1_unit (stash);
-	  
+
 	  aUnit->name = aDieInfo.name;
 	  aUnit->low_pc = aDieInfo.low_pc;
 	  aUnit->high_pc = aDieInfo.high_pc;
 	  aUnit->has_stmt_list = aDieInfo.has_stmt_list;
 	  aUnit->stmt_list_offset = aDieInfo.stmt_list_offset;
-	  
+
 	  /* A die has a child if it's followed by a die that is
-	     not it's sibling. */
-	  if (aDieInfo.sibling 
-	      && stash->currentDie + aDieInfo.length 
+	     not it's sibling.  */
+	  if (aDieInfo.sibling
+	      && stash->currentDie + aDieInfo.length
                     < stash->debug_section_end
-	      && stash->currentDie + aDieInfo.length 
+	      && stash->currentDie + aDieInfo.length
 	            != stash->debug_section + aDieInfo.sibling)
 	    aUnit->first_child = stash->currentDie + aDieInfo.length;
 	  else
 	    aUnit->first_child = 0;
 
 	  if (aUnit->low_pc <= addr && addr < aUnit->high_pc)
-	    return dwarf1_unit_find_nearest_line (stash, aUnit, addr, 
-						  filename_ptr, 
-						  functionname_ptr, 
+	    return dwarf1_unit_find_nearest_line (stash, aUnit, addr,
+						  filename_ptr,
+						  functionname_ptr,
 						  linenumber_ptr);
 	}
-      
+
       if (aDieInfo.sibling != 0)
 	stash->currentDie = stash->debug_section + aDieInfo.sibling;
       else
@@ -574,5 +563,4 @@
   return false;
 }
 
-
 /* EOF */
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 1c02912..42f3052 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -36,36 +36,38 @@
 #include "elf/dwarf2.h"
 
 /* The data in the .debug_line statement prologue looks like this.  */
+
 struct line_head
-  {
-    unsigned int total_length;
-    unsigned short version;
-    unsigned int prologue_length;
-    unsigned char minimum_instruction_length;
-    unsigned char default_is_stmt;
-    int line_base;
-    unsigned char line_range;
-    unsigned char opcode_base;
-    unsigned char *standard_opcode_lengths;
-  };
+{
+  unsigned int total_length;
+  unsigned short version;
+  unsigned int prologue_length;
+  unsigned char minimum_instruction_length;
+  unsigned char default_is_stmt;
+  int line_base;
+  unsigned char line_range;
+  unsigned char opcode_base;
+  unsigned char *standard_opcode_lengths;
+};
 
-/* Attributes have a name and a value */
+/* Attributes have a name and a value.  */
+
 struct attribute
+{
+  enum dwarf_attribute name;
+  enum dwarf_form form;
+  union
   {
-    enum dwarf_attribute name;
-    enum dwarf_form form;
-    union
-      {
-	char *str;
-	struct dwarf_block *blk;
-	unsigned int unsnd;
-	int snd;
-	bfd_vma addr;
-      }
-    u;
-  };
+    char *str;
+    struct dwarf_block *blk;
+    unsigned int unsnd;
+    int snd;
+    bfd_vma addr;
+  }
+  u;
+};
 
-/* Get at parts of an attribute structure */
+/* Get at parts of an attribute structure.  */
 
 #define DW_STRING(attr)    ((attr)->u.str)
 #define DW_UNSND(attr)     ((attr)->u.unsnd)
@@ -73,31 +75,30 @@
 #define DW_SND(attr)       ((attr)->u.snd)
 #define DW_ADDR(attr)	   ((attr)->u.addr)
 
-/* Blocks are a bunch of untyped bytes. */
+/* Blocks are a bunch of untyped bytes.  */
 struct dwarf_block
-  {
-    unsigned int size;
-    char *data;
-  };
+{
+  unsigned int size;
+  char *data;
+};
 
-
-struct dwarf2_debug {
-
-  /* A list of all previously read comp_units. */
+struct dwarf2_debug
+{
+  /* A list of all previously read comp_units.  */
   struct comp_unit* all_comp_units;
 
   /* The next unread compilation unit within the .debug_info section.
      Zero indicates that the .debug_info section has not been loaded
-     into a buffer yet.*/
+     into a buffer yet.  */
   char* info_ptr;
 
-  /* Pointer to the end of the .debug_info section memory buffer. */
+  /* Pointer to the end of the .debug_info section memory buffer.  */
   char* info_ptr_end;
 
-  /* Pointer to the .debug_abbrev section loaded into memory. */
+  /* Pointer to the .debug_abbrev section loaded into memory.  */
   char* dwarf_abbrev_buffer;
 
-  /* Length of the loaded .debug_abbrev section. */
+  /* Length of the loaded .debug_abbrev section.  */
   unsigned long dwarf_abbrev_size;
 
   /* Buffer for decode_line_info.  */
@@ -107,69 +108,67 @@
   unsigned long dwarf_line_size;
 };
 
-struct arange {
+struct arange
+{
   struct arange *next;
   bfd_vma low;
   bfd_vma high;
 };
 
-
 /* A minimal decoding of DWARF2 compilation units.  We only decode
-   what's needed to get to the line number information. */
+   what's needed to get to the line number information.  */
 
-struct comp_unit {
-
-  /* Chain the previously read compilation units. */
+struct comp_unit
+{
+  /* Chain the previously read compilation units.  */
   struct comp_unit* next_unit;
 
-  /* Keep the bdf convenient (for memory allocation). */
+  /* Keep the bdf convenient (for memory allocation).  */
   bfd* abfd;
 
   /* The lowest and higest addresses contained in this compilation
-     unit as specified in the compilation unit header. */
+     unit as specified in the compilation unit header.  */
   struct arange arange;
 
-  /* The DW_AT_name attribute (for error messages). */
+  /* The DW_AT_name attribute (for error messages).  */
   char* name;
 
-  /* The abbrev hash table. */
+  /* The abbrev hash table.  */
   struct abbrev_info** abbrevs;
 
-  /* Note that an error was found by comp_unit_find_nearest_line. */
+  /* Note that an error was found by comp_unit_find_nearest_line.  */
   int error;
 
-  /* The DW_AT_comp_dir attribute */
+  /* The DW_AT_comp_dir attribute.  */
   char* comp_dir;
 
-  /* True if there is a line number table associated with this comp. unit. */
+  /* True if there is a line number table associated with this comp. unit.  */
   int stmtlist;
-  
-  /* The offset into .debug_line of the line number table. */
+
+  /* The offset into .debug_line of the line number table.  */
   unsigned long line_offset;
 
-  /* Pointer to the first child die for the comp unit. */
+  /* Pointer to the first child die for the comp unit.  */
   char *first_child_die_ptr;
 
-  /* The end of the comp unit. */
+  /* The end of the comp unit.  */
   char *end_ptr;
 
-  /* The decoded line number, NULL if not yet decoded. */
+  /* The decoded line number, NULL if not yet decoded.  */
   struct line_info_table* line_table;
 
-  /* A list of the functions found in this comp. unit. */
-  struct funcinfo* function_table; 
+  /* A list of the functions found in this comp. unit.  */
+  struct funcinfo* function_table;
 
-  /* Address size for this unit - from unit header */
+  /* Address size for this unit - from unit header.  */
   unsigned char addr_size;
 };
 
+/* VERBATIM
+   The following function up to the END VERBATIM mark are
+   copied directly from dwarf2read.c.  */
 
-
-/* VERBATIM 
-   The following function up to the END VERBATIM mark are 
-   copied directly from dwarf2read.c. */
-
-/* read dwarf information from a buffer */
+/* Read dwarf information from a buffer.  */
 
 static unsigned int
 read_1_byte (abfd, buf)
@@ -195,9 +194,7 @@
   return bfd_get_16 (abfd, (bfd_byte *) buf);
 }
 
-#if 0
-
-/* This is not used.  */
+#if 0  /* This is not used.  */
 
 static int
 read_2_signed_bytes (abfd, buf)
@@ -217,9 +214,7 @@
   return bfd_get_32 (abfd, (bfd_byte *) buf);
 }
 
-#if 0
-
-/* This is not used.  */
+#if 0  /* This is not used.  */
 
 static int
 read_4_signed_bytes (abfd, buf)
@@ -265,6 +260,7 @@
       *bytes_read_ptr = 1;
       return NULL;
     }
+
   *bytes_read_ptr = strlen (buf) + 1;
   return buf;
 }
@@ -283,7 +279,7 @@
   result   = 0;
   shift    = 0;
   num_read = 0;
-  
+
   do
     {
       byte = bfd_get_8 (abfd, (bfd_byte *) buf);
@@ -293,9 +289,9 @@
       shift += 7;
     }
   while (byte & 0x80);
-  
+
   * bytes_read_ptr = num_read;
-  
+
   return result;
 }
 
@@ -323,12 +319,12 @@
       shift += 7;
     }
   while (byte & 0x80);
-  
+
   if ((shift < 32) && (byte & 0x40))
     result |= -(1 << shift);
 
   * bytes_read_ptr = num_read;
-  
+
   return result;
 }
 
@@ -352,26 +348,22 @@
     }
 }
 
-
-
-
-
-/* This data structure holds the information of an abbrev. */
+/* This data structure holds the information of an abbrev.  */
 struct abbrev_info
-  {
-    unsigned int number;	/* number identifying abbrev */
-    enum dwarf_tag tag;		/* dwarf tag */
-    int has_children;		/* boolean */
-    unsigned int num_attrs;	/* number of attributes */
-    struct attr_abbrev *attrs;	/* an array of attribute descriptions */
-    struct abbrev_info *next;	/* next in chain */
-  };
+{
+  unsigned int number;		/* Number identifying abbrev.  */
+  enum dwarf_tag tag;		/* DWARF tag.  */
+  int has_children;		/* Boolean.  */
+  unsigned int num_attrs;	/* Number of attributes.  */
+  struct attr_abbrev *attrs;	/* An array of attribute descriptions.  */
+  struct abbrev_info *next;	/* Next in chain.  */
+};
 
 struct attr_abbrev
-  {
-    enum dwarf_attribute name;
-    enum dwarf_form form;
-  };
+{
+  enum dwarf_attribute name;
+  enum dwarf_form form;
+};
 
 #ifndef ABBREV_HASH_SIZE
 #define ABBREV_HASH_SIZE 121
@@ -400,6 +392,7 @@
       else
 	abbrev = abbrev->next;
     }
+
   return NULL;
 }
 
@@ -409,18 +402,16 @@
    in a hash table.  */
 
 static struct abbrev_info**
-read_abbrevs (abfd, offset)
+read_abbrevs (abfd, offset, stash)
      bfd * abfd;
      unsigned int offset;
+     struct dwarf2_debug *stash;
 {
   struct abbrev_info **abbrevs;
   char *abbrev_ptr;
   struct abbrev_info *cur_abbrev;
   unsigned int abbrev_number, bytes_read, abbrev_name;
   unsigned int abbrev_form, hash_number;
-  struct dwarf2_debug *stash;
-
-  stash = elf_tdata(abfd)->dwarf2_find_line_info;
 
   if (! stash->dwarf_abbrev_buffer)
     {
@@ -433,13 +424,13 @@
 	  bfd_set_error (bfd_error_bad_value);
 	  return 0;
 	}
-      
+
       stash->dwarf_abbrev_size = msec->_raw_size;
       stash->dwarf_abbrev_buffer = (char*) bfd_alloc (abfd, stash->dwarf_abbrev_size);
       if (! stash->dwarf_abbrev_buffer)
 	  return 0;
-      
-      if (! bfd_get_section_contents (abfd, msec, 
+
+      if (! bfd_get_section_contents (abfd, msec,
 				      stash->dwarf_abbrev_buffer, 0,
 				      stash->dwarf_abbrev_size))
 	return 0;
@@ -447,35 +438,36 @@
 
   if (offset > stash->dwarf_abbrev_size)
     {
-      (*_bfd_error_handler) (_("Dwarf Error: Abbrev offset (%u) bigger than abbrev size (%u)."), 
+      (*_bfd_error_handler) (_("Dwarf Error: Abbrev offset (%u) bigger than abbrev size (%u)."),
 			     offset, stash->dwarf_abbrev_size );
       bfd_set_error (bfd_error_bad_value);
       return 0;
     }
 
-  abbrevs = (struct abbrev_info**) bfd_zalloc (abfd, sizeof(struct abbrev_info*) * ABBREV_HASH_SIZE);
+  abbrevs = (struct abbrev_info**) bfd_zalloc (abfd, sizeof (struct abbrev_info*) * ABBREV_HASH_SIZE);
 
   abbrev_ptr = stash->dwarf_abbrev_buffer + offset;
   abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
   abbrev_ptr += bytes_read;
 
-  /* loop until we reach an abbrev number of 0 */
+  /* Loop until we reach an abbrev number of 0.  */
   while (abbrev_number)
     {
       cur_abbrev = (struct abbrev_info*)bfd_zalloc (abfd, sizeof (struct abbrev_info));
 
-      /* read in abbrev header */
+      /* Read in abbrev header.  */
       cur_abbrev->number = abbrev_number;
       cur_abbrev->tag = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
       abbrev_ptr += bytes_read;
       cur_abbrev->has_children = read_1_byte (abfd, abbrev_ptr);
       abbrev_ptr += 1;
 
-      /* now read in declarations */
+      /* Now read in declarations.  */
       abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
       abbrev_ptr += bytes_read;
       abbrev_form = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
       abbrev_ptr += bytes_read;
+
       while (abbrev_name)
 	{
 	  if ((cur_abbrev->num_attrs % ATTR_ALLOC_CHUNK) == 0)
@@ -487,6 +479,7 @@
 	      if (! cur_abbrev->attrs)
 		return 0;
 	    }
+
 	  cur_abbrev->attrs[cur_abbrev->num_attrs].name = abbrev_name;
 	  cur_abbrev->attrs[cur_abbrev->num_attrs++].form = abbrev_form;
 	  abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
@@ -533,6 +526,7 @@
 
   attr->name = abbrev->name;
   attr->form = abbrev->form;
+
   switch (abbrev->form)
     {
     case DW_FORM_addr:
@@ -634,42 +628,41 @@
   return info_ptr;
 }
 
-
-/* Source line information table routines. */
+/* Source line information table routines.  */
 
 #define FILE_ALLOC_CHUNK 5
 #define DIR_ALLOC_CHUNK 5
 
-struct line_info {
+struct line_info
+{
   struct line_info* prev_line;
-
   bfd_vma address;
   char* filename;
   unsigned int line;
   unsigned int column;
-  int end_sequence;		/* end of (sequential) code sequence */
+  int end_sequence;		/* End of (sequential) code sequence.  */
 };
 
-struct fileinfo {
+struct fileinfo
+{
   char *name;
   unsigned int dir;
   unsigned int time;
   unsigned int size;
 };
 
-struct line_info_table {
+struct line_info_table
+{
   bfd* abfd;
-
   unsigned int num_files;
   unsigned int num_dirs;
-
   char* comp_dir;
   char** dirs;
   struct fileinfo* files;
   struct line_info* last_line;
 };
 
-static void 
+static void
 add_line_info (table, address, filename, line, column, end_sequence)
      struct line_info_table* table;
      bfd_vma address;
@@ -691,7 +684,7 @@
   info->end_sequence = end_sequence;
 }
 
-static char* 
+static char *
 concat_filename (table, file)
      struct line_info_table* table;
      unsigned int file;
@@ -706,7 +699,7 @@
     }
 
   filename = table->files[file - 1].name;
-  if (*filename == '/')
+  if (IS_ABSOLUTE_PATH(filename))
     return filename;
 
   else
@@ -726,8 +719,9 @@
 {
   struct arange *arange;
 
-  /* first see if we can cheaply extend an existing range: */
+  /* First see if we can cheaply extend an existing range.  */
   arange = &unit->arange;
+
   do
     {
       if (low_pc == arange->high)
@@ -746,14 +740,14 @@
 
   if (unit->arange.high == 0)
     {
-      /* this is the first address range: store it in unit->arange: */
+      /* This is the first address range: store it in unit->arange.  */
       unit->arange.next = 0;
       unit->arange.low = low_pc;
       unit->arange.high = high_pc;
       return;
     }
 
-  /* need to allocate a new arange and insert it into the arange list: */
+  /* Need to allocate a new arange and insert it into the arange list.  */
   arange = bfd_zalloc (unit->abfd, sizeof (*arange));
   arange->low = low_pc;
   arange->high = high_pc;
@@ -762,18 +756,15 @@
   unit->arange.next = arange;
 }
 
-/* Decode the line number information for UNIT. */
+/* Decode the line number information for UNIT.  */
 
 static struct line_info_table*
-decode_line_info (unit)
+decode_line_info (unit, stash)
      struct comp_unit *unit;
+     struct dwarf2_debug *stash;
 {
   bfd *abfd = unit->abfd;
-
-  struct dwarf2_debug *stash;
-
   struct line_info_table* table;
-
   char *line_ptr;
   char *line_end;
   struct line_head lh;
@@ -781,8 +772,6 @@
   char *cur_file, *cur_dir;
   unsigned char op_code, extended_op, adj_opcode;
 
-  stash = elf_tdata (abfd)->dwarf2_find_line_info;
-
   if (! stash->dwarf_line_buffer)
     {
       asection *msec;
@@ -794,19 +783,19 @@
 	  bfd_set_error (bfd_error_bad_value);
 	  return 0;
 	}
-      
+
       stash->dwarf_line_size = msec->_raw_size;
       stash->dwarf_line_buffer = (char *) bfd_alloc (abfd, stash->dwarf_line_size);
       if (! stash->dwarf_line_buffer)
 	return 0;
 
-      if (! bfd_get_section_contents (abfd, msec, 
+      if (! bfd_get_section_contents (abfd, msec,
 				      stash->dwarf_line_buffer, 0,
 				      stash->dwarf_line_size))
 	return 0;
 
       /* FIXME: We ought to apply the relocs against this section before
-	 we process it.... */
+	 we process it...  */
     }
 
   /* Since we are using un-relocated data, it is possible to get a bad value
@@ -820,7 +809,7 @@
       return 0;
     }
 
-  table = (struct line_info_table*) bfd_alloc (abfd, 
+  table = (struct line_info_table*) bfd_alloc (abfd,
 					       sizeof (struct line_info_table));
   table->abfd = abfd;
   table->comp_dir = unit->comp_dir;
@@ -836,7 +825,7 @@
 
   line_ptr = stash->dwarf_line_buffer + unit->line_offset;
 
-  /* read in the prologue */
+  /* Read in the prologue.  */
   lh.total_length = read_4_bytes (abfd, line_ptr);
   line_ptr += 4;
   line_end = line_ptr + lh.total_length;
@@ -858,16 +847,18 @@
     bfd_alloc (abfd, lh.opcode_base * sizeof (unsigned char));
 
   lh.standard_opcode_lengths[0] = 1;
+
   for (i = 1; i < lh.opcode_base; ++i)
     {
       lh.standard_opcode_lengths[i] = read_1_byte (abfd, line_ptr);
       line_ptr += 1;
     }
 
-  /* Read directory table  */
+  /* Read directory table.  */
   while ((cur_dir = read_string (abfd, line_ptr, &bytes_read)) != NULL)
     {
       line_ptr += bytes_read;
+
       if ((table->num_dirs % DIR_ALLOC_CHUNK) == 0)
 	{
 	  table->dirs = (char **)
@@ -876,14 +867,17 @@
 	  if (! table->dirs)
 	    return 0;
 	}
+
       table->dirs[table->num_dirs++] = cur_dir;
     }
+
   line_ptr += bytes_read;
 
-  /* Read file name table */
+  /* Read file name table.  */
   while ((cur_file = read_string (abfd, line_ptr, &bytes_read)) != NULL)
     {
       line_ptr += bytes_read;
+
       if ((table->num_files % FILE_ALLOC_CHUNK) == 0)
 	{
 	  table->files = (struct fileinfo *)
@@ -893,6 +887,7 @@
 	  if (! table->files)
 	    return 0;
 	}
+
       table->files[table->num_files].name = cur_file;
       table->files[table->num_files].dir =
 	read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
@@ -905,12 +900,13 @@
       line_ptr += bytes_read;
       table->num_files++;
     }
+
   line_ptr += bytes_read;
 
   /* Read the statement sequences until there's nothing left.  */
   while (line_ptr < line_end)
     {
-      /* state machine registers  */
+      /* State machine registers.  */
       bfd_vma address = 0;
       char* filename = concat_filename (table, 1);
       unsigned int line = 1;
@@ -920,15 +916,16 @@
       int end_sequence = 0, need_low_pc = 1;
       bfd_vma low_pc = 0;
 
-      /* Decode the table. */
+      /* Decode the table.  */
       while (! end_sequence)
 	{
 	  op_code = read_1_byte (abfd, line_ptr);
 	  line_ptr += 1;
+
 	  switch (op_code)
 	    {
 	    case DW_LNS_extended_op:
-	      line_ptr += 1;	/* ignore length */
+	      line_ptr += 1;	/* Ignore length.  */
 	      extended_op = read_1_byte (abfd, line_ptr);
 	      line_ptr += 1;
 	      switch (extended_op)
@@ -1025,12 +1022,12 @@
 	      address += read_2_bytes (abfd, line_ptr);
 	      line_ptr += 2;
 	      break;
-	    default:		/* special operand */
+	    default:		/* Special operand.  */
 	      adj_opcode = op_code - lh.opcode_base;
 	      address += (adj_opcode / lh.line_range)
 		* lh.minimum_instruction_length;
 	      line += lh.line_base + (adj_opcode % lh.line_range);
-	      /* append row to matrix using current values */
+	      /* Append row to matrix using current values.  */
 	      add_line_info (table, address, filename, line, column, 0);
 	      basic_block = 1;
 	      if (need_low_pc)
@@ -1045,15 +1042,14 @@
   return table;
 }
 
-
 /* If ADDR is within TABLE set the output parameters and return true,
    otherwise return false.  The output parameters, FILENAME_PTR and
-   LINENUMBER_PTR, are pointers to the objects to be filled in. */
+   LINENUMBER_PTR, are pointers to the objects to be filled in.  */
 
 static boolean
-lookup_address_in_line_info_table (table, 
+lookup_address_in_line_info_table (table,
 				   addr,
-				   filename_ptr, 
+				   filename_ptr,
 				   linenumber_ptr)
      struct line_info_table* table;
      bfd_vma addr;
@@ -1062,7 +1058,7 @@
 {
   struct line_info* next_line = table->last_line;
   struct line_info* each_line;
-  
+
   if (!next_line)
     return false;
 
@@ -1080,28 +1076,24 @@
       next_line = each_line;
       each_line = each_line->prev_line;
     }
-  
+
   return false;
 }
-  
 
+/* Function table functions.  */
 
-
-/* Function table functions. */
-
-struct funcinfo {
+struct funcinfo
+{
   struct funcinfo *prev_func;
-
   char* name;
   bfd_vma low;
   bfd_vma high;
 };
 
-
-/* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return true. */
+/* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return true.  */
 
 static boolean
-lookup_address_in_function_table (table, 
+lookup_address_in_function_table (table,
 				  addr,
 				  functionname_ptr)
      struct funcinfo* table;
@@ -1120,18 +1112,14 @@
 	  return true;
 	}
     }
-  
+
   return false;
 }
 
-
-
-
-/* DWARF2 Compilation unit functions. */
-
+/* DWARF2 Compilation unit functions.  */
 
 /* Scan over each die in a comp. unit looking for functions to add
-   to the function table. */
+   to the function table.  */
 
 static boolean
 scan_unit_for_functions (unit)
@@ -1157,16 +1145,16 @@
 	  nesting_level--;
 	  continue;
 	}
-      
+
       abbrev = lookup_abbrev (abbrev_number,unit->abbrevs);
       if (! abbrev)
 	{
-	  (*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %d."), 
+	  (*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %d."),
 			     abbrev_number);
 	  bfd_set_error (bfd_error_bad_value);
 	  return false;
 	}
-      
+
       if (abbrev->tag == DW_TAG_subprogram)
 	{
 	  func = (struct funcinfo*) bfd_zalloc (abfd, sizeof (struct funcinfo));
@@ -1175,24 +1163,24 @@
 	}
       else
 	func = NULL;
-  
+
       for (i = 0; i < abbrev->num_attrs; ++i)
 	{
 	  info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr);
-	  
+
 	  if (func)
 	    {
 	      switch (attr.name)
 		{
 		case DW_AT_name:
-		  
+
 		  name = DW_STRING (&attr);
 
 		  /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name.  */
 		  if (func->name == NULL)
 		    func->name = DW_STRING (&attr);
 		  break;
-		  
+
 		case DW_AT_MIPS_linkage_name:
 		  func->name = DW_STRING (&attr);
 		  break;
@@ -1216,7 +1204,7 @@
 		case DW_AT_name:
 		  name = DW_STRING (&attr);
 		  break;
-		  
+
 		default:
 		  break;
 		}
@@ -1230,11 +1218,6 @@
   return true;
 }
 
-
-
-
-
-
 /* Parse a DWARF2 compilation unit starting at INFO_PTR.  This
    includes the compilation unit header that proceeds the DIE's, but
    does not include the length field that preceeds each compilation
@@ -1246,10 +1229,10 @@
    to get to the line number information for the compilation unit.  */
 
 static struct comp_unit *
-parse_comp_unit (abfd, info_ptr, end_ptr, abbrev_length)
+parse_comp_unit (abfd, stash, unit_length, abbrev_length)
      bfd* abfd;
-     char* info_ptr;
-     char* end_ptr;
+     struct dwarf2_debug *stash;
+     bfd_vma unit_length;
      unsigned int abbrev_length;
 {
   struct comp_unit* unit;
@@ -1263,6 +1246,9 @@
   struct abbrev_info *abbrev;
   struct attribute attr;
 
+  char *info_ptr = stash->info_ptr;
+  char *end_ptr = info_ptr + unit_length;
+  
   version = read_2_bytes (abfd, info_ptr);
   info_ptr += 2;
   BFD_ASSERT (abbrev_length == 0
@@ -1299,8 +1285,8 @@
       return 0;
     }
 
-  /* Read the abbrevs for this compilation unit into a table */
-  abbrevs = read_abbrevs (abfd, abbrev_offset);
+  /* Read the abbrevs for this compilation unit into a table.  */
+  abbrevs = read_abbrevs (abfd, abbrev_offset, stash);
   if (! abbrevs)
       return 0;
 
@@ -1322,10 +1308,10 @@
       bfd_set_error (bfd_error_bad_value);
       return 0;
     }
-  
+
   unit = (struct comp_unit*) bfd_zalloc (abfd, sizeof (struct comp_unit));
   unit->abfd = abfd;
-  unit->addr_size = addr_size; 
+  unit->addr_size = addr_size;
   unit->abbrevs = abbrevs;
   unit->end_ptr = end_ptr;
 
@@ -1379,11 +1365,7 @@
   return unit;
 }
 
-
-
-
-
-/* Return true if UNIT contains the address given by ADDR. */
+/* Return true if UNIT contains the address given by ADDR.  */
 
 static boolean
 comp_unit_contains_address (unit, addr)
@@ -1403,30 +1385,32 @@
       arange = arange->next;
     }
   while (arange);
+
   return 0;
 }
 
-
 /* If UNIT contains ADDR, set the output parameters to the values for
    the line containing ADDR.  The output parameters, FILENAME_PTR,
    FUNCTIONNAME_PTR, and LINENUMBER_PTR, are pointers to the objects
-   to be filled in.  
+   to be filled in.
 
    Return true of UNIT contains ADDR, and no errors were encountered;
    false otherwise.  */
 
 static boolean
 comp_unit_find_nearest_line (unit, addr,
-			     filename_ptr, functionname_ptr, linenumber_ptr)
+			     filename_ptr, functionname_ptr, linenumber_ptr,
+			     stash)
      struct comp_unit* unit;
      bfd_vma addr;
      const char **filename_ptr;
      const char **functionname_ptr;
      unsigned int *linenumber_ptr;
+     struct dwarf2_debug *stash;
 {
   boolean line_p;
   boolean func_p;
-  
+
   if (unit->error)
     return false;
 
@@ -1437,15 +1421,15 @@
 	  unit->error = 1;
 	  return false;
 	}
-  
-      unit->line_table = decode_line_info (unit);
+
+      unit->line_table = decode_line_info (unit, stash);
 
       if (! unit->line_table)
 	{
 	  unit->error = 1;
 	  return false;
 	}
-      
+
       if (! scan_unit_for_functions (unit))
 	{
 	  unit->error = 1;
@@ -1455,14 +1439,51 @@
 
   line_p = lookup_address_in_line_info_table (unit->line_table,
 					      addr,
-					      filename_ptr, 
+					      filename_ptr,
 					      linenumber_ptr);
-  func_p = lookup_address_in_function_table (unit->function_table, 
+  func_p = lookup_address_in_function_table (unit->function_table,
 					     addr,
 					     functionname_ptr);
   return line_p || func_p;
 }
 
+/* Locate a section in a BFD containing debugging info.  The search starts from the
+   section after AFTER_SEC, or from the first section in the BFD if AFTER_SEC is
+   NULL.  The search works by examining the names of the sections.  There are two
+   permissiable names.  The first is .debug_info.  This is the standard DWARF2 name.
+   The second is a prefix .gnu.linkonce.wi.  This is a variation on the .debug_info
+   section which has a checksum describing the contents appended onto the name.  This
+   allows the linker to identify and discard duplicate debugging sections for
+   different compilation units.  */
+#define DWARF2_DEBUG_INFO ".debug_info"
+#define GNU_LINKONCE_INFO ".gnu.linkonce.wi."
+
+static asection *
+find_debug_info (abfd, after_sec)
+     bfd * abfd;
+     asection * after_sec;
+{
+  asection * msec;
+
+  if (after_sec)
+    msec = after_sec->next;
+  else
+    msec = abfd->sections;
+
+  while (msec)
+    {
+      if (strcmp (msec->name, DWARF2_DEBUG_INFO) == 0)
+	return msec;
+
+      if (strncmp (msec->name, GNU_LINKONCE_INFO, strlen (GNU_LINKONCE_INFO)) == 0)
+	return msec;
+
+      msec = msec->next;
+    }
+
+  return NULL;
+}
+
 /* The DWARF2 version of find_nearest line.  Return true if the line
    is found without error.  ADDR_SIZE is the number of bytes in the
    initial .debug_info length field and in the abbreviation offset.
@@ -1473,7 +1494,7 @@
 _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
 			       filename_ptr, functionname_ptr,
 			       linenumber_ptr,
-			       addr_size)
+			       addr_size, pinfo)
      bfd *abfd;
      asection *section;
      asymbol **symbols ATTRIBUTE_UNUSED;
@@ -1482,24 +1503,23 @@
      const char **functionname_ptr;
      unsigned int *linenumber_ptr;
      unsigned int addr_size;
+     PTR *pinfo;
 {
   /* Read each compilation unit from the section .debug_info, and check
      to see if it contains the address we are searching for.  If yes,
      lookup the address, and return the line number info.  If no, go
-     on to the next compilation unit.  
+     on to the next compilation unit.
 
      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.
-     */
+     a pointer to the next un-read compilation unit.  Check the
+     previously read units before reading more.  */
+  struct dwarf2_debug *stash = (struct dwarf2_debug *) *pinfo;
 
-  struct dwarf2_debug *stash = elf_tdata (abfd)->dwarf2_find_line_info;
-
-  /* What address are we looking for? */
+  /* What address are we looking for?  */
   bfd_vma addr = offset + section->vma;
 
   struct comp_unit* each;
-  
+
   *filename_ptr = NULL;
   *functionname_ptr = NULL;
   *linenumber_ptr = 0;
@@ -1510,74 +1530,90 @@
   if (addr_size == 0)
     addr_size = 4;
   BFD_ASSERT (addr_size == 4 || addr_size == 8);
-    
+
   if (! stash)
     {
+      unsigned long total_size;
       asection *msec;
-      unsigned long size;
-      
-      stash = elf_tdata (abfd)->dwarf2_find_line_info =
+
+      stash =
 	(struct dwarf2_debug*) bfd_zalloc (abfd, sizeof (struct dwarf2_debug));
-      
       if (! stash)
 	return false;
+
+      *pinfo = (PTR) stash;
       
-      msec = bfd_get_section_by_name (abfd, ".debug_info");
+      msec = find_debug_info (abfd, NULL);
       if (! msec)
-	{
-	  /* No dwarf2 info.  Note that at this point the stash
-	     has been allocated, but contains zeros, this lets
-	     future calls to this function fail quicker. */
-	  return false;
-	}
+	/* No dwarf2 info.  Note that at this point the stash
+	   has been allocated, but contains zeros, this lets
+	   future calls to this function fail quicker.  */
+	 return false;
 
-      size = msec->_raw_size;
-      if (size == 0)
-	return false;
-      
-      stash->info_ptr = (char *) bfd_alloc (abfd, size);
-      
-      if (! stash->info_ptr)
+      /* There can be more than one DWARF2 info section in a BFD these days.
+         Read them all in and produce one large stash.  We do this in two
+	 passes - in the first pass we just accumulate the section sizes.
+	 In the second pass we read in the section's contents.  The allows
+	 us to avoid reallocing the data as we add sections to the stash.  */
+      for (total_size = 0; msec; msec = find_debug_info (abfd, msec))
+	total_size += msec->_raw_size;
+
+      stash->info_ptr = (char *) bfd_alloc (abfd, total_size);
+      if (stash->info_ptr == NULL)
 	return false;
 
-      if (! bfd_get_section_contents (abfd, msec, stash->info_ptr, 0, size))
+      stash->info_ptr_end = stash->info_ptr;
+
+      for (msec = find_debug_info (abfd, NULL);
+	   msec;
+	   msec = find_debug_info (abfd, msec))
 	{
-	  stash->info_ptr = 0;
-	  return false;
+	  unsigned long size;
+	  unsigned long start;
+
+	  size = msec->_raw_size;
+	  if (size == 0)
+	    continue;
+
+	  start = stash->info_ptr_end - stash->info_ptr;
+
+	  if (! bfd_get_section_contents (abfd, msec, stash->info_ptr + start, 0, size))
+	    continue;
+
+	  stash->info_ptr_end = stash->info_ptr + start + size;
 	}
 
-      stash->info_ptr_end = stash->info_ptr + size;
-
-      /* FIXME: There is a problem with the contents of the
-	 .debug_info section.  The 'low' and 'high' addresses of the
-	 comp_units are computed by relocs against symbols in the
-	 .text segment.  We need these addresses in order to determine
-	 the nearest line number, and so we have to resolve the
-	 relocs.  There is a similar problem when the .debug_line
-	 section is processed as well (e.g., there may be relocs
-	 against the operand of the DW_LNE_set_address operator).
-	 
-	 Unfortunately getting hold of the reloc information is hard...
-
-	 For now, this means that disassembling object files (as
-	 opposed to fully executables) does not always work as well as
-	 we would like.  */
+      BFD_ASSERT (stash->info_ptr_end = stash->info_ptr + total_size);
     }
-  
-  /* A null info_ptr indicates that there is no dwarf2 info 
-     (or that an error occured while setting up the stash). */
 
+  /* FIXME: There is a problem with the contents of the
+     .debug_info section.  The 'low' and 'high' addresses of the
+     comp_units are computed by relocs against symbols in the
+     .text segment.  We need these addresses in order to determine
+     the nearest line number, and so we have to resolve the
+     relocs.  There is a similar problem when the .debug_line
+     section is processed as well (e.g., there may be relocs
+     against the operand of the DW_LNE_set_address operator).
+
+     Unfortunately getting hold of the reloc information is hard...
+
+     For now, this means that disassembling object files (as
+     opposed to fully executables) does not always work as well as
+     we would like.  */
+
+  /* A null info_ptr indicates that there is no dwarf2 info
+     (or that an error occured while setting up the stash).  */
   if (! stash->info_ptr)
     return false;
 
-  /* Check the previously read comp. units first. */
-
+  /* Check the previously read comp. units first.  */
   for (each = stash->all_comp_units; each; each = each->next_unit)
     if (comp_unit_contains_address (each, addr))
-      return comp_unit_find_nearest_line (each, addr, filename_ptr, 
-					  functionname_ptr, linenumber_ptr);
+      return comp_unit_find_nearest_line (each, addr, filename_ptr,
+					  functionname_ptr, linenumber_ptr,
+					  stash);
 
-  /* Read each remaining comp. units checking each as they are read. */
+  /* Read each remaining comp. units checking each as they are read.  */
   while (stash->info_ptr < stash->info_ptr_end)
     {
       struct comp_unit* each;
@@ -1592,9 +1628,7 @@
 
       if (length > 0)
         {
-	  each = parse_comp_unit (abfd, stash->info_ptr, 
-				  stash->info_ptr + length,
-				  addr_size);
+	  each = parse_comp_unit (abfd, stash, length, addr_size);
 	  stash->info_ptr += length;
 
 	  if (each)
@@ -1606,21 +1640,23 @@
 		 compilation units.  If we don't have them (i.e.,
 		 unit->high == 0), we need to consult the line info
 		 table to see if a compilation unit contains the given
-		 address. */
+		 address.  */
 	      if (each->arange.high > 0)
 		{
 		  if (comp_unit_contains_address (each, addr))
 		    return comp_unit_find_nearest_line (each, addr,
 						       filename_ptr,
 						       functionname_ptr,
-						       linenumber_ptr);
+						       linenumber_ptr,
+						       stash);
 		}
 	      else
 		{
 		  found = comp_unit_find_nearest_line (each, addr,
 						       filename_ptr,
 						       functionname_ptr,
-						       linenumber_ptr);
+						       linenumber_ptr,
+						       stash);
 		  if (found)
 		    return true;
 		}
@@ -1630,5 +1666,3 @@
 
   return false;
 }
-
-/* end of file */
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index 4b136ee..f22112b 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -1,5 +1,5 @@
 /* Generic ECOFF (Extended-COFF) routines.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
    Original version by Per Bothner.
    Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -344,9 +344,9 @@
     }
   else if (strcmp (name, _RCONST) == 0)
     styp = STYP_RCONST;
-  else if (flags & SEC_CODE) 
+  else if (flags & SEC_CODE)
     styp = STYP_TEXT;
-  else if (flags & SEC_DATA) 
+  else if (flags & SEC_DATA)
     styp = STYP_DATA;
   else if (flags & SEC_READONLY)
     styp = STYP_RDATA;
@@ -363,7 +363,6 @@
 
 /* Get the BFD flags to use for a section.  */
 
-/*ARGSUSED*/
 flagword
 _bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -452,7 +451,7 @@
   HDRR *internal_symhdr;
 
   /* See if we've already read it in.  */
-  if (ecoff_data (abfd)->debug_info.symbolic_header.magic == 
+  if (ecoff_data (abfd)->debug_info.symbolic_header.magic ==
       backend->debug_swap.sym_magic)
     return true;
 
@@ -509,7 +508,6 @@
    object file.  This is called by gdb via the read_debug_info entry
    point in the backend structure.  */
 
-/*ARGSUSED*/
 boolean
 _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
      bfd *abfd;
@@ -1090,7 +1088,7 @@
   unsigned int ifd = rndx->rfd;
   unsigned int indx = rndx->index;
   const char *name;
-  
+
   if (ifd == 0xfff)
     ifd = isym;
 
@@ -1340,7 +1338,6 @@
       p1 += strlen (buffer1);
     }
 
-
   /*
    * Deal with any qualifiers.
    */
@@ -1406,7 +1403,7 @@
 		int j;
 
 		/* Print array bounds reversed (ie, in the order the C
-		   programmer writes them).  C is such a fun language.... */
+		   programmer writes them).  C is such a fun language....  */
 
 		while (i < 5 && qualifiers[i+1].type == tqArray)
 		  i++;
@@ -1447,7 +1444,6 @@
 
 /* Return information about ECOFF symbol SYMBOL in RET.  */
 
-/*ARGSUSED*/
 void
 _bfd_ecoff_get_symbol_info (abfd, symbol, ret)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -1459,7 +1455,6 @@
 
 /* Return whether this is a local label.  */
 
-/*ARGSUSED*/
 boolean
 _bfd_ecoff_bfd_is_local_label_name (abfd, name)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -1490,7 +1485,7 @@
       if (ecoffsymbol (symbol)->local)
 	{
 	  SYMR ecoff_sym;
-	
+
 	  (*debug_swap->swap_sym_in) (abfd, ecoffsymbol (symbol)->native,
 				      &ecoff_sym);
 	  fprintf (file, "ecoff local ");
@@ -1604,7 +1599,7 @@
 		  fprintf (file, _("\n      First symbol: %ld"),
 			   (long) (indx + sym_base));
 		else
-		  fprintf (file, _("\n      First symbol: %ld"), 
+		  fprintf (file, _("\n      First symbol: %ld"),
 			   ((long)
 			    (AUX_GET_ISYM (bigendian,
 					   &aux_base[ecoff_ext.asym.index])
@@ -1680,7 +1675,7 @@
 
   if (_bfd_ecoff_slurp_symbol_table (abfd) == false)
     return false;
-  
+
   internal_relocs = (arelent *) bfd_alloc (abfd,
 					   (sizeof (arelent)
 					    * section->reloc_count));
@@ -1778,7 +1773,7 @@
 {
   unsigned int count;
 
-  if (section->flags & SEC_CONSTRUCTOR) 
+  if (section->flags & SEC_CONSTRUCTOR)
     {
       arelent_chain *chain;
 
@@ -1791,7 +1786,7 @@
 	*relptr++ = &chain->relent;
     }
   else
-    { 
+    {
       arelent *tblptr;
 
       if (ecoff_slurp_reloc_table (abfd, section, symbols) == false)
@@ -1812,7 +1807,6 @@
    and return the name of the source file and the line nearest to the
    wanted location.  */
 
-/*ARGSUSED*/
 boolean
 _bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset,
 			      filename_ptr, functionname_ptr, retline_ptr)
@@ -1984,7 +1978,6 @@
 
 /* Get the size of the section headers.  */
 
-/*ARGSUSED*/
 int
 _bfd_ecoff_sizeof_headers (abfd, reloc)
      bfd *abfd;
@@ -1996,8 +1989,8 @@
 
   c = 0;
   for (current = abfd->sections;
-       current != (asection *)NULL; 
-       current = current->next) 
+       current != (asection *)NULL;
+       current = current->next)
     ++c;
 
   ret = (bfd_coff_filhsz (abfd)
@@ -2218,13 +2211,13 @@
 	abort ();
       abfd->output_has_begun = true;
     }
-  
+
   reloc_base = ecoff_data (abfd)->reloc_filepos;
 
   reloc_size = 0;
   for (current = abfd->sections;
-       current != (asection *)NULL; 
-       current = current->next) 
+       current != (asection *)NULL;
+       current = current->next)
     {
       if (current->reloc_count == 0)
 	current->rel_filepos = 0;
@@ -2312,7 +2305,7 @@
       bfd_set_error (bfd_error_invalid_operation);
       return 0;
     }
-  
+
   return ecoff_data (abfd)->gp;
 }
 
@@ -2491,8 +2484,8 @@
 
   count = 1;
   for (current = abfd->sections;
-       current != (asection *)NULL; 
-       current = current->next) 
+       current != (asection *)NULL;
+       current = current->next)
     {
       current->target_index = count;
       ++count;
@@ -2630,7 +2623,7 @@
 	/* Do nothing */ ;
       else
 	abort ();
-    }	
+    }
 
   /* Set up the file header.  */
 
@@ -2782,7 +2775,7 @@
 	      arelent *reloc;
 	      asymbol *sym;
 	      struct internal_reloc in;
-	  
+
 	      memset ((PTR) &in, 0, sizeof in);
 
 	      reloc = *reloc_ptr_ptr;
@@ -2982,7 +2975,7 @@
   char *raw_ptr;
   struct symdef *symdef_ptr;
   char *stringbase;
-  
+
   /* Get the name of the first element.  */
   i = bfd_read ((PTR) nextname, 1, 16, abfd);
   if (i == 0)
@@ -3034,11 +3027,11 @@
     return false;
   parsed_size = mapdata->parsed_size;
   bfd_release (abfd, (PTR) mapdata);
-    
+
   raw_armap = (char *) bfd_alloc (abfd, parsed_size);
   if (raw_armap == (char *) NULL)
     return false;
-    
+
   if (bfd_read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size)
     {
       if (bfd_get_error () != bfd_error_system_call)
@@ -3046,7 +3039,7 @@
       bfd_release (abfd, (PTR) raw_armap);
       return false;
     }
-    
+
   ardata->tdata = (PTR) raw_armap;
 
   count = bfd_h_get_32 (abfd, (PTR) raw_armap);
@@ -3075,7 +3068,7 @@
       {
 	unsigned int name_offset, file_offset;
 	unsigned int hash, rehash, srch;
-      
+
 	name_offset = bfd_h_get_32 (abfd, (PTR) raw_ptr);
 	file_offset = bfd_h_get_32 (abfd, (PTR) (raw_ptr + 4));
 	if (file_offset == 0)
@@ -3167,7 +3160,7 @@
   padit = stridx % 2;
   stringsize = stridx + padit;
 
-  /* Include 8 bytes to store symdefsize and stringsize in output. */
+  /* Include 8 bytes to store symdefsize and stringsize in output.  */
   mapsize = symdefsize + stringsize + 8;
 
   firstreal = SARMAG + sizeof (struct ar_hdr) + mapsize + elength;
@@ -3201,7 +3194,7 @@
 #if 0
   hdr.ar_mode[0] = '0';
 #else
-  /* Building gcc ends up extracting the armap as a file - twice. */
+  /* Building gcc ends up extracting the armap as a file - twice.  */
   hdr.ar_mode[0] = '6';
   hdr.ar_mode[1] = '4';
   hdr.ar_mode[2] = '4';
@@ -3214,8 +3207,8 @@
 
   /* Turn all null bytes in the header into spaces.  */
   for (i = 0; i < sizeof (struct ar_hdr); i++)
-   if (((char *)(&hdr))[i] == '\0')
-     (((char *)(&hdr))[i]) = ' ';
+   if (((char *) (&hdr))[i] == '\0')
+     (((char *) (&hdr))[i]) = ' ';
 
   if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), abfd)
       != sizeof (struct ar_hdr))
@@ -3224,7 +3217,7 @@
   bfd_h_put_32 (abfd, (bfd_vma) hashsize, temp);
   if (bfd_write ((PTR) temp, 1, 4, abfd) != 4)
     return false;
-  
+
   hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize);
   if (!hashtable)
     return false;
@@ -3266,7 +3259,7 @@
 
 	  hash = srch;
 	}
-	
+
       bfd_h_put_32 (abfd, (bfd_vma) map[i].namidx,
 		    (PTR) (hashtable + hash * 8));
       bfd_h_put_32 (abfd, (bfd_vma) firstreal,
@@ -3345,7 +3338,7 @@
   bfd_ardata (abfd)->symdefs = NULL;
   bfd_ardata (abfd)->extended_names = NULL;
   bfd_ardata (abfd)->tdata = NULL;
-  
+
   if (_bfd_ecoff_slurp_armap (abfd) == false
       || _bfd_ecoff_slurp_extended_name_table (abfd) == false)
     {
@@ -3353,7 +3346,7 @@
       abfd->tdata.aout_ar_data = tdata_hold;
       return (const bfd_target *) NULL;
     }
-  
+
   if (bfd_has_map (abfd))
     {
       bfd *first;
@@ -4391,7 +4384,7 @@
   bfd *output_bfd = einfo->abfd;
   boolean strip;
 
-  /* We need to check if this symbol is being stripped. */
+  /* We need to check if this symbol is being stripped.  */
   if (h->root.type == bfd_link_hash_undefined
       || h->root.type == bfd_link_hash_undefweak)
     strip = false;
@@ -4427,7 +4420,7 @@
 
 	  output_section = h->root.u.def.section->output_section;
 	  name = bfd_section_name (output_section->owner, output_section);
-	
+
 	  if (strcmp (name, _TEXT) == 0)
 	    h->esym.asym.sc = scText;
 	  else if (strcmp (name, _DATA) == 0)
diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c
index 25fc966..9b2e0f5 100644
--- a/bfd/ecofflink.c
+++ b/bfd/ecofflink.c
@@ -1,5 +1,5 @@
 /* Routines to link ECOFF debugging information.
-   Copyright 1993, 94, 95, 96, 97, 1999 Free Software Foundation, Inc.
+   Copyright 1993, 94, 95, 96, 97, 99, 2000 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -69,8 +69,8 @@
   struct tir_ext ext[1];
 
   *ext = *ext_copy;		/* Make it reasonable to do in-place.  */
-  
-  /* now the fun stuff... */
+
+  /* now the fun stuff...  */
   if (bigend) {
     intern->fBitfield   = 0 != (ext->t_bits1[0] & TIR_BITS1_FBITFIELD_BIG);
     intern->continued   = 0 != (ext->t_bits1[0] & TIR_BITS1_CONTINUED_BIG);
@@ -109,7 +109,7 @@
 
 #ifdef TEST
   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
-    abort();
+    abort ();
 #endif
 }
 
@@ -126,8 +126,8 @@
   TIR intern[1];
 
   *intern = *intern_copy;	/* Make it reasonable to do in-place.  */
-  
-  /* now the fun stuff... */
+
+  /* now the fun stuff...  */
   if (bigend) {
     ext->t_bits1[0] = ((intern->fBitfield ? TIR_BITS1_FBITFIELD_BIG : 0)
 		       | (intern->continued ? TIR_BITS1_CONTINUED_BIG : 0)
@@ -166,7 +166,7 @@
 
 #ifdef TEST
   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
-    abort();
+    abort ();
 #endif
 }
 
@@ -182,8 +182,8 @@
   struct rndx_ext ext[1];
 
   *ext = *ext_copy;		/* Make it reasonable to do in-place.  */
-  
-  /* now the fun stuff... */
+
+  /* now the fun stuff...  */
   if (bigend) {
     intern->rfd   = (ext->r_bits[0] << RNDX_BITS0_RFD_SH_LEFT_BIG)
 		  | ((ext->r_bits[1] & RNDX_BITS1_RFD_BIG)
@@ -205,7 +205,7 @@
 
 #ifdef TEST
   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
-    abort();
+    abort ();
 #endif
 }
 
@@ -221,8 +221,8 @@
   RNDXR intern[1];
 
   *intern = *intern_copy;	/* Make it reasonable to do in-place.  */
-  
-  /* now the fun stuff... */
+
+  /* now the fun stuff...  */
   if (bigend) {
     ext->r_bits[0] = intern->rfd >> RNDX_BITS0_RFD_SH_LEFT_BIG;
     ext->r_bits[1] = (((intern->rfd << RNDX_BITS1_RFD_SH_BIG)
@@ -243,7 +243,7 @@
 
 #ifdef TEST
   if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
-    abort();
+    abort ();
 #endif
 }
 
@@ -465,7 +465,7 @@
      unsigned long size;
 {
   struct shuffle *n;
-     
+
   n = (struct shuffle *) objalloc_alloc (ainfo->memory,
 					 sizeof (struct shuffle));
   if (!n)
@@ -488,7 +488,6 @@
 /* Initialize the FDR hash table.  This returns a handle which is then
    passed in to bfd_ecoff_debug_accumulate, et. al.  */
 
-/*ARGSUSED*/
 PTR
 bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info)
      bfd *output_bfd ATTRIBUTE_UNUSED;
@@ -547,7 +546,6 @@
 
 /* Free the accumulated debugging information.  */
 
-/*ARGSUSED*/
 void
 bfd_ecoff_debug_free (handle, output_bfd, output_debug, output_swap, info)
      PTR handle;
@@ -557,7 +555,7 @@
      struct bfd_link_info *info;
 {
   struct accumulate *ainfo = (struct accumulate *) handle;
-  
+
   bfd_hash_table_free (&ainfo->fdr_hash.table);
 
   if (! info->relocateable)
@@ -576,7 +574,6 @@
    linker information structure.  HANDLE is returned by
    bfd_ecoff_debug_init.  */
 
-/*ARGSUSED*/
 boolean
 bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
 			    input_bfd, input_debug, input_swap,
@@ -1409,7 +1406,6 @@
 
 /* Align the ECOFF debugging information.  */
 
-/*ARGSUSED*/
 static void
 ecoff_align_debug (abfd, debug, swap)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -1967,9 +1963,9 @@
   boolean stabs;
   FDR *fdr_ptr;
   int i;
-  
+
   offset = line_info->cache.start;
-     
+
   /* Build FDR table (sorted by object file's base-address) if we
      don't have it already.  */
   if (line_info->fdrtab == NULL
@@ -1981,7 +1977,7 @@
   /* find first FDR for address OFFSET */
   i = fdrtab_lookup (line_info, offset);
   if (i < 0)
-    return false;		/* no FDR, no fun... */
+    return false;		/* no FDR, no fun...  */
   fdr_ptr = tab[i].fdr;
 
   /* Check whether this file has stabs debugging information.  In a
@@ -2046,9 +2042,9 @@
                malloc.c.  I'm not sure why this happens, but it could
                be due to optimizations that reorder a function's
                position within an object-file.
-        
+
          Strategy:
-         
+
          On the first call to this function, we build a table of FDRs
          that is sorted by the base-address of the object-file the FDR
          is referring to.  Notice that each object-file may contain
@@ -2079,9 +2075,9 @@
 	  bfd_vma dist, min_dist = 0;
 	  char *pdr_hold;
 	  char *pdr_end;
-	  
+
 	  fdr_ptr = tab[i].fdr;
-	  
+
 	  pdr_ptr = ((char *) debug_info->external_pdr
 		     + fdr_ptr->ipdFirst * external_pdr_size);
 	  pdr_end = pdr_ptr + fdr_ptr->cpd * external_pdr_size;
@@ -2106,7 +2102,7 @@
 		    }
 		}
 	    }
-	  
+
 	  if (!best_pdr || min_dist < best_dist)
 	    {
 	      best_dist = min_dist;
@@ -2119,7 +2115,7 @@
 	     && tab[i].base_addr == tab[i - 1].base_addr);
 
       if (!best_fdr || !best_pdr)
-	return false;			/* shouldn't happen... */
+	return false;			/* shouldn't happen...  */
 
       /* phew, finally we got something that we can hold onto: */
       fdr_ptr = best_fdr;
diff --git a/bfd/ecoffswap.h b/bfd/ecoffswap.h
index 0d28d16..efafe91 100644
--- a/bfd/ecoffswap.h
+++ b/bfd/ecoffswap.h
@@ -1,5 +1,5 @@
 /* Generic ECOFF swapping routines, for BFD.
-   Copyright 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+   Copyright 1992, 1993, 1994, 1995, 1996, 2000 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -27,10 +27,11 @@
    on them in gdb by naming the including source file; e.g.,
    'coff-mips.c':ecoff_swap_hdr_in.
 
-   Before including this header file, one of ECOFF_32 or ECOFF_64 must
-   be defined.  These are checked when swapping information that
-   depends upon the target size.  This code works for 32 bit and 64
-   bit ECOFF, but may need to be generalized in the future.
+   Before including this header file, one of ECOFF_32, ECOFF_64,
+   ECOFF_SIGNED_32 or ECOFF_SIGNED_64 must be defined.  These are
+   checked when swapping information that depends upon the target
+   size.  This code works for 32 bit and 64 bit ECOFF, but may need to
+   be generalized in the future.
 
    Some header file which defines the external forms of these
    structures must also be included before including this header file.
@@ -50,6 +51,14 @@
 #define ecoff_get_off bfd_h_get_64
 #define ecoff_put_off bfd_h_put_64
 #endif
+#ifdef ECOFF_SIGNED_32
+#define ecoff_get_off bfd_h_get_signed_32
+#define ecoff_put_off bfd_h_put_signed_32
+#endif
+#ifdef ECOFF_SIGNED_64
+#define ecoff_get_off bfd_h_get_signed_64
+#define ecoff_put_off bfd_h_put_signed_64
+#endif
 
 /* ECOFF auxiliary information swapping routines.  These are the same
    for all ECOFF targets, so they are defined in ecofflink.c.  */
@@ -185,7 +194,7 @@
   
   intern->adr           = ecoff_get_off (abfd, (bfd_byte *)ext->f_adr);
   intern->rss           = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_rss);
-#ifdef ECOFF_64
+#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
   if (intern->rss == 0xffffffff)
     intern->rss = -1;
 #endif
@@ -197,11 +206,11 @@
   intern->cline         = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cline);
   intern->ioptBase      = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ioptBase);
   intern->copt          = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_copt);
-#ifdef ECOFF_32
+#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
   intern->ipdFirst      = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_ipdFirst);
   intern->cpd           = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_cpd);
 #endif
-#ifdef ECOFF_64
+#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
   intern->ipdFirst      = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ipdFirst);
   intern->cpd           = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cpd);
 #endif
@@ -262,11 +271,11 @@
   bfd_h_put_32 (abfd, intern->cline, (bfd_byte *)ext->f_cline);
   bfd_h_put_32 (abfd, intern->ioptBase, (bfd_byte *)ext->f_ioptBase);
   bfd_h_put_32 (abfd, intern->copt, (bfd_byte *)ext->f_copt);
-#ifdef ECOFF_32
+#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
   bfd_h_put_16 (abfd, intern->ipdFirst, (bfd_byte *)ext->f_ipdFirst);
   bfd_h_put_16 (abfd, intern->cpd, (bfd_byte *)ext->f_cpd);
 #endif
-#ifdef ECOFF_64
+#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
   bfd_h_put_32 (abfd, intern->ipdFirst, (bfd_byte *)ext->f_ipdFirst);
   bfd_h_put_32 (abfd, intern->cpd, (bfd_byte *)ext->f_cpd);
 #endif
@@ -341,7 +350,7 @@
   intern->lnHigh        = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnHigh);
   intern->cbLineOffset  = ecoff_get_off (abfd, (bfd_byte *)ext->p_cbLineOffset);
 
-#ifdef ECOFF_64
+#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
   intern->gp_prologue = bfd_h_get_8 (abfd, (bfd_byte *) ext->p_gp_prologue);
   if (bfd_header_big_endian (abfd))
     {
@@ -400,7 +409,7 @@
   bfd_h_put_32 (abfd, intern->lnHigh, (bfd_byte *)ext->p_lnHigh);
   ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->p_cbLineOffset);
 
-#ifdef ECOFF_64
+#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
   bfd_h_put_8 (abfd, intern->gp_prologue, (bfd_byte *) ext->p_gp_prologue);
   if (bfd_header_big_endian (abfd))
     {
@@ -629,10 +638,10 @@
   }
   intern->reserved = 0;
 
-#ifdef ECOFF_32
+#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
   intern->ifd           = bfd_h_get_signed_16 (abfd, (bfd_byte *)ext->es_ifd);
 #endif
-#ifdef ECOFF_64
+#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
   intern->ifd           = bfd_h_get_signed_32 (abfd, (bfd_byte *)ext->es_ifd);
 #endif
 
@@ -663,7 +672,7 @@
 			| (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_BIG : 0)
 			| (intern->weakext ? EXT_BITS1_WEAKEXT_BIG : 0));
     ext->es_bits2[0] = 0;
-#ifdef ECOFF_64
+#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
     ext->es_bits2[1] = 0;
     ext->es_bits2[2] = 0;
 #endif
@@ -672,16 +681,16 @@
 			| (intern->cobol_main ? EXT_BITS1_COBOL_MAIN_LITTLE : 0)
 			| (intern->weakext ? EXT_BITS1_WEAKEXT_LITTLE : 0));
     ext->es_bits2[0] = 0;
-#ifdef ECOFF_64
+#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
     ext->es_bits2[1] = 0;
     ext->es_bits2[2] = 0;
 #endif
   }
 
-#ifdef ECOFF_32
+#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
   bfd_h_put_signed_16 (abfd, intern->ifd, (bfd_byte *)ext->es_ifd);
 #endif
-#ifdef ECOFF_64
+#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
   bfd_h_put_signed_32 (abfd, intern->ifd, (bfd_byte *)ext->es_ifd);
 #endif
 
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 3978aee..d88e4a3 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -243,6 +243,9 @@
   PTR stab_info;
   /* A linked list of local symbols to be added to .dynsym.  */
   struct elf_link_local_dynamic_entry *dynlocal;
+  /* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic
+     objects included in the link.  */
+  struct bfd_link_needed_list *runpath;
 };
 
 /* Look up an entry in an ELF linker hash table.  */
@@ -373,8 +376,8 @@
 
    /* A function to set the type of the info field.  Processor-specific
      types should be handled here. */
-  int (*elf_backend_get_symbol_type) PARAMS (( Elf_Internal_Sym *, int)); 
- 
+  int (*elf_backend_get_symbol_type) PARAMS (( Elf_Internal_Sym *, int));
+
   /* A function to do additional processing on the ELF section header
      just before writing it out.  This is used to set the flags and
      type fields for some sections, or to actually write out data for
@@ -388,6 +391,11 @@
 						    Elf32_Internal_Shdr *,
 						    char *));
 
+  /* A function to convert machine dependent section header flags to
+     BFD internal section header flags.  */
+  boolean (*elf_backend_section_flags) PARAMS ((flagword *,
+						Elf32_Internal_Shdr *));
+
   /* A function to handle unusual program segment types when creating BFD
      sections from ELF program segments. */
   boolean (*elf_backend_section_from_phdr) PARAMS ((bfd *,
@@ -601,7 +609,7 @@
   /* Modify any information related to dynamic linking such that the
      symbol is not exported.  */
   void (*elf_backend_hide_symbol)
-    PARAMS ((struct elf_link_hash_entry *));
+    PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
 
   /* The swapping table to use when dealing with ECOFF information.
      Used for the MIPS ELF .mdebug section.  */
@@ -638,7 +646,7 @@
      both REL and RELA relocations, and this flag is set for those
      backends.)  */
   unsigned may_use_rel_p : 1;
-    
+
   /* Whether the backend may use RELA relocations.  (Some backends use
      both REL and RELA relocations, and this flag is set for those
      backends.)  */
@@ -647,8 +655,8 @@
   /* Whether the default relocation type is RELA.  If a backend with
      this flag set wants REL relocations for a particular section,
      it must note that explicitly.  Similarly, if this flag is clear,
-     and the backend wants RELA relocations for a particular 
-     section.  */   
+     and the backend wants RELA relocations for a particular
+     section.  */
   unsigned default_use_rela_p : 1;
 
   /* True if addresses "naturally" sign extend.  This is used when
@@ -838,6 +846,14 @@
      one.  */
   const char *dt_name;
 
+  /* When a reference in a regular object is resolved by a shared
+     object is loaded into via the DT_NEEDED entries by the linker
+     ELF emulation code, we need to add the shared object to the
+     DT_NEEDED list of the resulting binary to indicate the dependency
+     as if the -l option is passed to the linker. This field holds the
+     name of the loaded shared object. */
+  const char *dt_soname;
+
   /* Irix 5 often screws up the symbol table, sorting local symbols
      after global symbols.  This flag is set if the symbol table in
      this BFD appears to be screwed up.  If it is, we ignore the
@@ -861,7 +877,7 @@
   struct dwarf1_debug *dwarf1_find_line_info;
 
   /* A place to stash dwarf2 info for this bfd. */
-  struct dwarf2_debug *dwarf2_find_line_info;
+  PTR dwarf2_find_line_info;
 
   /* An array of stub sections indexed by symbol number, used by the
      MIPS ELF linker.  FIXME: We should figure out some way to only
@@ -885,6 +901,13 @@
 
   /* Linker sections that we are interested in.  */
   struct elf_linker_section *linker_section[ (int)LINKER_SECTION_MAX ];
+
+  /* The Irix 5 support uses two virtual sections, which represent
+     text/data symbols defined in dynamic objects.  */
+  asymbol *elf_data_symbol;
+  asymbol *elf_text_symbol;
+  asection *elf_data_section;
+  asection *elf_text_section;
 };
 
 #define elf_tdata(bfd)		((bfd) -> tdata.elf_obj_data)
@@ -908,6 +931,7 @@
 #define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
 #define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
 #define elf_dt_name(bfd)	(elf_tdata(bfd) -> dt_name)
+#define elf_dt_soname(bfd)	(elf_tdata(bfd) -> dt_soname)
 #define elf_bad_symtab(bfd)	(elf_tdata(bfd) -> bad_symtab)
 #define elf_flags_init(bfd)	(elf_tdata(bfd) -> flags_init)
 #define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n])
@@ -970,7 +994,7 @@
 extern void _bfd_elf_link_hash_copy_indirect
   PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
 extern void _bfd_elf_link_hash_hide_symbol
-  PARAMS ((struct elf_link_hash_entry *));
+  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
 extern boolean _bfd_elf_link_hash_table_init
   PARAMS ((struct elf_link_hash_table *, bfd *,
 	   struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
@@ -1006,14 +1030,14 @@
 						unsigned long));
 extern boolean _bfd_elf_find_nearest_line PARAMS ((bfd *, asection *,
 						    asymbol **,
-						    bfd_vma, CONST char **,
-						    CONST char **,
+						    bfd_vma, const char **,
+						    const char **,
 						    unsigned int *));
 #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
 #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
 extern int _bfd_elf_sizeof_headers PARAMS ((bfd *, boolean));
 extern boolean _bfd_elf_new_section_hook PARAMS ((bfd *, asection *));
-extern boolean _bfd_elf_init_reloc_shdr 
+extern boolean _bfd_elf_init_reloc_shdr
   PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, boolean));
 
 /* If the target doesn't have reloc handling written yet:  */
@@ -1282,11 +1306,11 @@
 	   Elf_Internal_Sym *));
 extern boolean _bfd_mips_elf_finish_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
-extern asection * _bfd_mips_elf_gc_mark_hook 
+extern asection * _bfd_mips_elf_gc_mark_hook
   PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
 	   struct elf_link_hash_entry *, Elf_Internal_Sym *));
-extern boolean _bfd_mips_elf_gc_sweep_hook 
-  PARAMS ((bfd *, struct bfd_link_info *, asection *, 
+extern boolean _bfd_mips_elf_gc_sweep_hook
+  PARAMS ((bfd *, struct bfd_link_info *, asection *,
 	   const Elf_Internal_Rela *));
 extern boolean _bfd_mips_elf_always_size_sections
   PARAMS ((bfd *, struct bfd_link_info *));
@@ -1297,7 +1321,7 @@
 	   const Elf_Internal_Rela *));
 extern struct bfd_link_hash_table *_bfd_mips_elf_link_hash_table_create
   PARAMS ((bfd *));
-extern boolean _bfd_mips_elf_print_private_bfd_data 
+extern boolean _bfd_mips_elf_print_private_bfd_data
   PARAMS ((bfd *, PTR));
 extern boolean _bfd_mips_elf_link_output_symbol_hook
   PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h
index 0a4dc64..ad049dd 100644
--- a/bfd/elf-hppa.h
+++ b/bfd/elf-hppa.h
@@ -45,7 +45,7 @@
 #endif
 
 elf_hppa_reloc_type ** _bfd_elf_hppa_gen_reloc_type
-  PARAMS ((bfd *, elf_hppa_reloc_type, int, int, int, asymbol *));
+  PARAMS ((bfd *, elf_hppa_reloc_type, int, unsigned int, int, asymbol *));
 
 static void elf_hppa_info_to_howto
   PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
@@ -62,10 +62,10 @@
 static boolean elf_hppa_fake_sections
   PARAMS ((bfd *abfd, elf_hppa_internal_shdr *, asection *));
 
-#if ARCH_SIZE == 64
 static void elf_hppa_final_write_processing
   PARAMS ((bfd *, boolean));
 
+#if ARCH_SIZE == 64
 static boolean elf_hppa_add_symbol_hook
   PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
 	   const char **, flagword *, asection **, bfd_vma *));
@@ -96,7 +96,6 @@
   PARAMS ((unsigned int, unsigned int, unsigned int));
 #endif
 
-
 /* ELF/PA relocation howto entries.  */
 
 static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
@@ -118,13 +117,13 @@
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_DIR14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_DIR14R", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_DIR14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_DIR14F", false, 0, 0, false },
+  /* 8 */
+  { R_PARISC_PCREL12F, 0, 0, 12, true, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_PCREL12F", false, 0, 0, false },
   { R_PARISC_PCREL32, 0, 0, 32, true, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_PCREL32", false, 0, 0, false },
-
   { R_PARISC_PCREL21L, 0, 0, 21, true, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_PCREL21L", false, 0, 0, false },
   { R_PARISC_PCREL17R, 0, 0, 17, true, 0, complain_overflow_bitfield,
@@ -137,6 +136,7 @@
     bfd_elf_generic_reloc, "R_PARISC_PCREL14R", false, 0, 0, false },
   { R_PARISC_PCREL14F, 0, 0, 14, true, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_PCREL14F", false, 0, 0, false },
+  /* 16 */
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -145,7 +145,6 @@
     bfd_elf_generic_reloc, "R_PARISC_DPREL21L", false, 0, 0, false },
   { R_PARISC_DPREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_DPREL14WR", false, 0, 0, false },
-
   { R_PARISC_DPREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_DPREL14DR", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -154,6 +153,7 @@
     bfd_elf_generic_reloc, "R_PARISC_DPREL14R", false, 0, 0, false },
   { R_PARISC_DPREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_DPREL14F", false, 0, 0, false },
+  /* 24 */
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -166,11 +166,11 @@
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-
   { R_PARISC_DLTREL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_DLTREL14R", false, 0, 0, false },
   { R_PARISC_DLTREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_DLTREL14F", false, 0, 0, false },
+  /* 32 */
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -187,7 +187,7 @@
     bfd_elf_generic_reloc, "R_PARISC_DLTIND14R", false, 0, 0, false },
   { R_PARISC_DLTIND14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_DLTIND14F", false, 0, 0, false },
-
+  /* 40 */
   { R_PARISC_SETBASE, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_SETBASE", false, 0, 0, false },
   { R_PARISC_SECREL32, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -204,11 +204,11 @@
     bfd_elf_generic_reloc, "R_PARISC_BASEREL14R", false, 0, 0, false },
   { R_PARISC_BASEREL14F, 0, 0, 14, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_BASEREL14F", false, 0, 0, false },
+  /* 48 */
   { R_PARISC_SEGBASE, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_SEGBASE", false, 0, 0, false },
   { R_PARISC_SEGREL32, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_SEGREL32", false, 0, 0, false },
-
   { R_PARISC_PLTOFF21L, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_PLTOFF21L", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -221,6 +221,7 @@
     bfd_elf_generic_reloc, "R_PARISC_PLTOFF14R", false, 0, 0, false },
   { R_PARISC_PLTOFF14F, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_PLTOFF14F", false, 0, 0, false },
+  /* 56 */
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_LTOFF_FPTR32, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -229,7 +230,6 @@
     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR21L", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -238,6 +238,7 @@
     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR14R", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  /* 64 */
   { R_PARISC_FPTR64, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_FPTR64", false, 0, 0, false },
   { R_PARISC_PLABEL32, 0, 0, 32, false, 0, complain_overflow_bitfield,
@@ -250,11 +251,11 @@
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-
   { R_PARISC_PLABEL14R, 0, 0, 14, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_PLABEL14R", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  /* 72 */
   { R_PARISC_PCREL64, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_PCREL64", false, 0, 0, false },
   { R_PARISC_PCREL22C, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -271,7 +272,7 @@
     bfd_elf_generic_reloc, "R_PARISC_PCREL16WF", false, 0, 0, false },
   { R_PARISC_PCREL16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_PCREL16DF", false, 0, 0, false },
-
+  /* 80 */
   { R_PARISC_DIR64, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_DIR64", false, 0, 0, false },
   { R_PARISC_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -288,11 +289,11 @@
     bfd_elf_generic_reloc, "R_PARISC_DIR16WF", false, 0, 0, false },
   { R_PARISC_DIR16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_DIR16DF", false, 0, 0, false },
+  /* 88 */
   { R_PARISC_GPREL64, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_GPREL64", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_DLTREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -305,6 +306,7 @@
     bfd_elf_generic_reloc, "R_PARISC_GPREL16WF", false, 0, 0, false },
   { R_PARISC_GPREL16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_GPREL16DF", false, 0, 0, false },
+  /* 96 */
   { R_PARISC_LTOFF64, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_LTOFF64", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -313,7 +315,6 @@
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_DLTIND14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_DLTIND14WR", false, 0, 0, false },
-
   { R_PARISC_DLTIND14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_DLTIND14DR", false, 0, 0, false },
   { R_PARISC_LTOFF16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -322,23 +323,24 @@
     bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", false, 0, 0, false },
   { R_PARISC_LTOFF16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_LTOFF16DF", false, 0, 0, false },
+  /* 104 */
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_BASEREL14WR, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_BSEREL14WR", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_BASEREL14WR", false, 0, 0, false },
   { R_PARISC_BASEREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_BASEREL14DR", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  /* 112 */
   { R_PARISC_SEGREL64, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_SEGREL64", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -355,7 +357,7 @@
     bfd_elf_generic_reloc, "R_PARISC_PLTOFF16WF", false, 0, 0, false },
   { R_PARISC_PLTOFF16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_PLTOFF16DF", false, 0, 0, false },
-
+  /* 120 */
   { R_PARISC_LTOFF_FPTR64, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -372,11 +374,11 @@
     bfd_elf_generic_reloc, "R_PARISC_LTOFF_FPTR16WF", false, 0, 0, false },
   { R_PARISC_LTOFF_FPTR16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  /* 128 */
   { R_PARISC_COPY, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_COPY", false, 0, 0, false },
   { R_PARISC_IPLT, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_IPLT", false, 0, 0, false },
-
   { R_PARISC_EPLT, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_EPLT", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -389,23 +391,24 @@
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  /* 136 */
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  /* 144 */
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -413,41 +416,41 @@
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  /* 152 */
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_TPREL32, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_TPREL32", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_TPREL32", false, 0, 0, false },
   { R_PARISC_TPREL21L, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_TPREL21L", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_TPREL21L", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_TPREL14R, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_TPREL14R", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_TPREL14R", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  /* 160 */
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_LTOFF_TP21L, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP21L", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -456,15 +459,58 @@
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_LTOFF_TP14F, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14F", false, 0, 0, false },
+  /* 168 */
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  /* 176 */
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  /* 184 */
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  /* 192 */
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -478,14 +524,16 @@
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-
+  /* 200 */
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -496,18 +544,16 @@
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  /* 208 */
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
+    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
@@ -515,48 +561,7 @@
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
-  { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
-    bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
+  /* 216 */
   { R_PARISC_TPREL64, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_TPREL64", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -564,16 +569,16 @@
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_UNIMPLEMENTED", false, 0, 0, false },
   { R_PARISC_TPREL14WR, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_TPREL14WR", false, 0, 0, false },
-
+    bfd_elf_generic_reloc, "R_PARISC_TPREL14WR", false, 0, 0, false },
   { R_PARISC_TPREL14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_TPREL14DR", false, 0, 0, false },
   { R_PARISC_TPREL16F, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_TPREL16F", false, 0, 0, false },
   { R_PARISC_TPREL16WF, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_TPREL16WF", false, 0, 0, false },
+    bfd_elf_generic_reloc, "R_PARISC_TPREL16WF", false, 0, 0, false },
   { R_PARISC_TPREL16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_TPREL16DF", false, 0, 0, false },
+  /* 224 */
   { R_PARISC_LTOFF_TP64, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP64", false, 0, 0, false },
   { R_PARISC_UNIMPLEMENTED, 0, 0, 0, false, 0, complain_overflow_bitfield,
@@ -585,12 +590,16 @@
   { R_PARISC_LTOFF_TP14DR, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP14DR", false, 0, 0, false },
   { R_PARISC_LTOFF_TP16F, 0, 0, 0, false, 0, complain_overflow_dont,
-    NULL, "R_PARISC_LTOFF_TP16F", false, 0, 0, false },
-
+    bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16F", false, 0, 0, false },
   { R_PARISC_LTOFF_TP16WF, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16WF", false, 0, 0, false },
   { R_PARISC_LTOFF_TP16DF, 0, 0, 0, false, 0, complain_overflow_bitfield,
     bfd_elf_generic_reloc, "R_PARISC_LTOFF_TP16DF", false, 0, 0, false },
+  /* 232 */
+  { R_PARISC_GNU_VTENTRY, 0, 0, 0, false, 0, complain_overflow_dont,
+    bfd_elf_generic_reloc, "R_PARISC_GNU_VTENTRY", false, 0, 0, false },
+  { R_PARISC_GNU_VTINHERIT, 0, 0, 0, false, 0, complain_overflow_dont,
+    bfd_elf_generic_reloc, "R_PARISC_GNU_VTINHERIT", false, 0, 0, false },
 };
 
 #define OFFSET_14R_FROM_21L 4
@@ -604,7 +613,7 @@
      bfd *abfd;
      elf_hppa_reloc_type base_type;
      int format;
-     int field;
+     unsigned int field;
      int ignore ATTRIBUTE_UNUSED;
      asymbol *sym ATTRIBUTE_UNUSED;
 {
@@ -647,8 +656,12 @@
 	case 14:
 	  switch (field)
 	    {
+	    case e_fsel:
+	      final_type = R_PARISC_DIR14F;
+	      break;
 	    case e_rsel:
 	    case e_rrsel:
+	    case e_rdsel:
 	      final_type = R_PARISC_DIR14R;
 	      break;
 	    case e_rtsel:
@@ -676,6 +689,7 @@
 	      break;
 	    case e_rsel:
 	    case e_rrsel:
+	    case e_rdsel:
 	      final_type = R_PARISC_DIR17R;
 	      break;
 	    default:
@@ -688,6 +702,9 @@
 	    {
 	    case e_lsel:
 	    case e_lrsel:
+	    case e_ldsel:
+	    case e_nlsel:
+	    case e_nlrsel:
 	      final_type = R_PARISC_DIR21L;
 	      break;
 	    case e_ltsel:
@@ -742,7 +759,6 @@
 	}
       break;
 
-
     case R_HPPA_GOTOFF:
       switch (format)
 	{
@@ -751,9 +767,12 @@
 	    {
 	    case e_rsel:
 	    case e_rrsel:
+	    case e_rdsel:
+	      /* R_PARISC_DLTREL14R for elf64, R_PARISC_DPREL14R for elf32  */
 	      final_type = base_type + OFFSET_14R_FROM_21L;
 	      break;
 	    case e_fsel:
+	      /* R_PARISC_DLTREL14F for elf64, R_PARISC_DPREL14F for elf32  */
 	      final_type = base_type + OFFSET_14F_FROM_21L;
 	      break;
 	    default:
@@ -764,8 +783,12 @@
 	case 21:
 	  switch (field)
 	    {
-	    case e_lrsel:
 	    case e_lsel:
+	    case e_lrsel:
+	    case e_ldsel:
+	    case e_nlsel:
+	    case e_nlrsel:
+	      /* R_PARISC_DLTREL21L for elf64, R_PARISC_DPREL21L for elf32  */
 	      final_type = base_type;
 	      break;
 	    default:
@@ -778,15 +801,28 @@
 	}
       break;
 
-
     case R_HPPA_PCREL_CALL:
       switch (format)
 	{
+	case 12:
+	  switch (field)
+	    {
+	    case e_fsel:
+	      final_type = R_PARISC_PCREL12F;
+	      break;
+	    default:
+	      return NULL;
+	    }
+	  break;
+
 	case 14:
+	  /* Contrary to appearances, these are not calls of any sort.
+	     Rather, they are loads/stores with a pcrel reloc.  */
 	  switch (field)
 	    {
 	    case e_rsel:
 	    case e_rrsel:
+	    case e_rdsel:
 	      final_type = R_PARISC_PCREL14R;
 	      break;
 	    case e_fsel:
@@ -802,6 +838,7 @@
 	    {
 	    case e_rsel:
 	    case e_rrsel:
+	    case e_rdsel:
 	      final_type = R_PARISC_PCREL17R;
 	      break;
 	    case e_fsel:
@@ -812,6 +849,21 @@
 	    }
 	  break;
 
+	case 21:
+	  switch (field)
+	    {
+	    case e_lsel:
+	    case e_lrsel:
+	    case e_ldsel:
+	    case e_nlsel:
+	    case e_nlrsel:
+	      final_type = R_PARISC_PCREL21L;
+	      break;
+	    default:
+	      return NULL;
+	    }
+	  break;
+
 	case 22:
 	  switch (field)
 	    {
@@ -823,23 +875,13 @@
 	    }
 	  break;
 
-	case 21:
-	  switch (field)
-	    {
-	    case e_lsel:
-	    case e_lrsel:
-	      final_type = R_PARISC_PCREL21L;
-	      break;
-	    default:
-	      return NULL;
-	    }
-	  break;
-
 	default:
 	  return NULL;
 	}
       break;
 
+    case R_PARISC_GNU_VTENTRY:
+    case R_PARISC_GNU_VTINHERIT:
     case R_PARISC_SEGREL32:
     case R_PARISC_SEGBASE:
       /* The defaults are fine for these cases.  */
@@ -901,7 +943,9 @@
      bfd *abfd ATTRIBUTE_UNUSED;
      const char *name;
 {
-  return (name[0] == 'L' && name[1] == '$');
+  if (name[0] == 'L' && name[1] == '$')
+    return 1;
+  return _bfd_elf_is_local_label_name (abfd, name);
 }
 
 /* Set the correct type for an ELF section.  We do this by the
@@ -920,7 +964,7 @@
   if (strcmp (name, ".PARISC.unwind") == 0)
     {
       int indx;
-      asection *sec;
+      asection *asec;
 #if ARCH_SIZE == 64
       hdr->sh_type = SHT_LOPROC + 1;
 #else
@@ -935,9 +979,9 @@
 
 	 So we (gasp) recompute it here.  Hopefully nobody ever changes the
 	 way sections are numbered in elf.c!  */
-      for (sec = abfd->sections, indx = 1; sec; sec = sec->next, indx++)
+      for (asec = abfd->sections, indx = 1; asec; asec = asec->next, indx++)
 	{
-	  if (sec->name && strcmp (sec->name, ".text") == 0)
+	  if (asec->name && strcmp (asec->name, ".text") == 0)
 	    {
 	      hdr->sh_info = indx;
 	      break;
@@ -950,11 +994,10 @@
   return true;
 }
 
-#if ARCH_SIZE == 64
 static void
 elf_hppa_final_write_processing (abfd, linker)
      bfd *abfd;
-     boolean linker;
+     boolean linker ATTRIBUTE_UNUSED;
 {
   int mach = bfd_get_mach (abfd);
 
@@ -979,6 +1022,7 @@
 				      | EF_PARISC_TRAPNIL);
 }
 
+#if ARCH_SIZE == 64
 /* Hook called by the linker routine which adds symbols from an object
    file.  HP's libraries define symbols with HP specific section
    indices, which we have to handle.  */
@@ -1046,7 +1090,6 @@
   return true;
 }
 
-
 static boolean
 elf_hppa_remark_useless_dynamic_symbols (h, data)
      struct elf_link_hash_entry *h;
@@ -1090,18 +1133,18 @@
 {
   struct elf64_hppa_link_hash_table *hppa_info;
   bfd_vma value;
- 
+
   hppa_info = (struct elf64_hppa_link_hash_table *)data;
 
   value = section->vma - section->filepos;
 
-  if ((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
+  if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
        == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
       && value < hppa_info->text_segment_base)
     hppa_info->text_segment_base = value;
-  else if ((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
-       == (SEC_ALLOC | SEC_LOAD))
-      && value < hppa_info->data_segment_base)
+  else if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
+	    == (SEC_ALLOC | SEC_LOAD))
+	   && value < hppa_info->data_segment_base)
     hppa_info->data_segment_base = value;
 }
 
@@ -1117,14 +1160,12 @@
      struct bfd_link_info *info;
 {
   boolean retval;
+  struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
 
   if (! info->relocateable)
     {
       struct elf_link_hash_entry *gp;
       bfd_vma gp_val;
-      struct elf64_hppa_link_hash_table *hppa_info;
-
-      hppa_info = elf64_hppa_hash_table (info);
 
       /* The linker script defines a value for __gp iff it was referenced
 	 by one of the objects being linked.  First try to find the symbol
@@ -1139,7 +1180,7 @@
 	  /* Adjust the value of __gp as we may want to slide it into the
 	     .plt section so that the stubs can access PLT entries without
 	     using an addil sequence.  */
-	  gp->root.u.def.value += elf64_hppa_hash_table (info)->gp_offset;
+	  gp->root.u.def.value += hppa_info->gp_offset;
 
 	  gp_val = (gp->root.u.def.section->output_section->vma
 		    + gp->root.u.def.section->output_offset
@@ -1148,7 +1189,6 @@
       else
 	{
 	  asection *sec;
-  
 
 	  /* First look for a .plt section.  If found, then __gp is the
 	     address of the .plt + gp_offset.
@@ -1181,10 +1221,10 @@
     }
 
   /* We need to know the base of the text and data segments so that we
-     can perform SEGREL relocations.  We will recore the base addresses
+     can perform SEGREL relocations.  We will record the base addresses
      when we encounter the first SEGREL relocation.  */
-  elf64_hppa_hash_table (info)->text_segment_base = (bfd_vma)-1;
-  elf64_hppa_hash_table (info)->data_segment_base = (bfd_vma)-1;
+  hppa_info->text_segment_base = (bfd_vma)-1;
+  hppa_info->data_segment_base = (bfd_vma)-1;
 
   /* HP's shared libraries have references to symbols that are not
      defined anywhere.  The generic ELF BFD linker code will complaim
@@ -1243,7 +1283,7 @@
       bfd_vma relocation;
       bfd_reloc_status_type r;
       const char *sym_name;
-      char *dyn_name;
+      const char *dyn_name;
       char *dynh_buf = NULL;
       size_t dynh_buflen = 0;
       struct elf64_hppa_dyn_hash_entry *dyn_h = NULL;
@@ -1292,7 +1332,7 @@
 
 	  /* If this symbol has an entry in the PA64 dynamic hash
 	     table, then get it.  */
-	  dyn_name = get_dyn_name (input_bfd, h, rel,
+	  dyn_name = get_dyn_name (input_section, h, rel,
 				   &dynh_buf, &dynh_buflen);
 	  dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
 					      dyn_name, false, false);
@@ -1315,7 +1355,7 @@
 
 	      /* If this symbol has an entry in the PA64 dynamic hash
 		 table, then get it.  */
-	      dyn_name = get_dyn_name (input_bfd, h, rel,
+	      dyn_name = get_dyn_name (input_section, h, rel,
 				       &dynh_buf, &dynh_buflen);
 	      dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
 						  dyn_name, false, false);
@@ -1351,7 +1391,7 @@
 
 	      /* If this symbol has an entry in the PA64 dynamic hash
 		 table, then get it.  */
-	      dyn_name = get_dyn_name (input_bfd, h, rel,
+	      dyn_name = get_dyn_name (input_section, h, rel,
 				       &dynh_buf, &dynh_buflen);
 	      dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
 						  dyn_name, false, false);
@@ -1416,15 +1456,14 @@
   return true;
 }
 
-
 /* Compute the value for a relocation (REL) during a final link stage,
-   then insert the value into the proper location in CONTENTS. 
+   then insert the value into the proper location in CONTENTS.
 
    VALUE is a tentative value for the relocation and may be overridden
    and modified here based on the specific relocation to be performed.
 
    For example we do conversions for PC-relative branches in this routine
-   or redirection of calls to external routines to stubs. 
+   or redirection of calls to external routines to stubs.
 
    The work of actually applying the relocation is left to a helper
    routine in an attempt to reduce the complexity and size of this
@@ -1442,7 +1481,7 @@
      bfd_vma value;
      struct bfd_link_info *info;
      asection *sym_sec;
-     struct elf_link_hash_entry *h;
+     struct elf_link_hash_entry *h ATTRIBUTE_UNUSED;
      struct elf64_hppa_dyn_hash_entry *dyn_h;
 {
   unsigned int insn;
@@ -1482,7 +1521,7 @@
 	if (sym_sec == NULL || sym_sec->output_section == NULL)
 	  value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
 		   + hppa_info->stub_sec->output_section->vma);
-  
+
 	/* Turn VALUE into a proper PC relative address.  */
 	value -= (offset + input_section->output_offset
 		  + input_section->output_section->vma);
@@ -1503,6 +1542,7 @@
 	break;
       }
 
+    case R_PARISC_PCREL12F:
     case R_PARISC_PCREL22F:
     case R_PARISC_PCREL17F:
     case R_PARISC_PCREL22C:
@@ -1515,7 +1555,7 @@
 	if (sym_sec == NULL || sym_sec->output_section == NULL)
 	  value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
 		   + hppa_info->stub_sec->output_section->vma);
-  
+
 	/* Turn VALUE into a proper PC relative address.  */
 	value -= (offset + input_section->output_offset
 		  + input_section->output_section->vma);
@@ -1560,12 +1600,12 @@
     case R_PARISC_LTOFF16DF:
       {
 	/* If this relocation was against a local symbol, then we still
-	   have not set up the DLT entry (it's not convienent to do so
+	   have not set up the DLT entry (it's not convenient to do so
 	   in the "finalize_dlt" routine because it is difficult to get
 	   to the local symbol's value).
 
 	   So, if this is a local symbol (h == NULL), then we need to
-	   fill in its DLT entry. 
+	   fill in its DLT entry.
 
 	   Similarly we may still need to set up an entry in .opd for
 	   a local function which had its address taken.  */
@@ -1677,6 +1717,7 @@
     case R_PARISC_DIR17R:
     case R_PARISC_DIR17F:
     case R_PARISC_DIR14R:
+    case R_PARISC_DIR14F:
     case R_PARISC_DIR14WR:
     case R_PARISC_DIR14DR:
     case R_PARISC_DIR16F:
@@ -1693,7 +1734,8 @@
 	else if (r_type == R_PARISC_DIR17F
 		 || r_type == R_PARISC_DIR16F
 		 || r_type == R_PARISC_DIR16WF
-		 || r_type == R_PARISC_DIR16DF)
+		 || r_type == R_PARISC_DIR16DF
+		 || r_type == R_PARISC_DIR14F)
 	  value = hppa_field_adjust (value, addend, e_fsel);
 	else
 	  value = hppa_field_adjust (value, addend, e_rrsel);
@@ -1822,7 +1864,6 @@
       /* Subtract out the global pointer value to make value a DLT
 	 relative address.  */
       value -= _bfd_get_gp_value (output_bfd);
-      value += addend;
 
       bfd_put_64 (input_bfd, value + addend, hit_data);
       return bfd_reloc_ok;
@@ -1848,14 +1889,14 @@
 	if (sym_sec == NULL || sym_sec->output_section == NULL)
 	  value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
 		   + hppa_info->stub_sec->output_section->vma);
-  
+
 	/* Turn VALUE into a proper PC relative address.  */
 	value -= (offset + input_section->output_offset
 		  + input_section->output_section->vma);
 
 	value += addend;
 	value -= 8;
-	bfd_put_64 (input_bfd, value, hit_data);
+	bfd_put_32 (input_bfd, value, hit_data);
 	return bfd_reloc_ok;
       }
 
@@ -1867,8 +1908,7 @@
 	if (sym_sec == NULL || sym_sec->output_section == NULL)
 	  value = (dyn_h->stub_offset + hppa_info->stub_sec->output_offset
 		   + hppa_info->stub_sec->output_section->vma);
-  
-  
+
 	/* Turn VALUE into a proper PC relative address.  */
 	value -= (offset + input_section->output_offset
 		  + input_section->output_section->vma);
@@ -1879,7 +1919,6 @@
 	return bfd_reloc_ok;
       }
 
-
     case R_PARISC_FPTR64:
       {
 	/* We may still need to create the FPTR itself if it was for
@@ -1906,15 +1945,14 @@
 	value = (dyn_h->opd_offset
 		 + hppa_info->opd_sec->output_offset
 		 + hppa_info->opd_sec->output_section->vma);
-	       
+
 	bfd_put_64 (input_bfd, value + addend, hit_data);
 	return bfd_reloc_ok;
       }
 
     case R_PARISC_SECREL32:
       bfd_put_32 (input_bfd,
-		  (value + addend
-		   - sym_sec->output_section->vma),
+		  value + addend - sym_sec->output_section->vma,
 		  hit_data);
       return bfd_reloc_ok;
 
@@ -1925,7 +1963,7 @@
 	   the segment base values.  */
 	if (hppa_info->text_segment_base == (bfd_vma) -1)
 	  bfd_map_over_sections (output_bfd, elf_hppa_record_segment_addrs,
-				 elf64_hppa_hash_table (info));
+				 hppa_info);
 
 	/* VALUE holds the absolute address.  We want to include the
 	   addend, then turn it into a segment relative address.
@@ -1946,7 +1984,6 @@
 	  bfd_put_64 (input_bfd, value, hit_data);
         return bfd_reloc_ok;
       }
-      
 
     /* Something we don't know how to handle.  */
     default:
@@ -1955,7 +1992,7 @@
 
   /* Update the instruction word.  */
   bfd_put_32 (input_bfd, insn, hit_data);
-  return (bfd_reloc_ok);
+  return bfd_reloc_ok;
 }
 
 /* Relocate the given INSN.  VALUE should be the actual value we want
@@ -1972,20 +2009,24 @@
 {
   switch (r_type)
     {
-    /* This is any 22bit branch.  In PA2.0 syntax it corresponds to
+    /* This is any 22 bit branch.  In PA2.0 syntax it corresponds to
        the "B" instruction.  */
     case R_PARISC_PCREL22F:
     case R_PARISC_PCREL22C:
-      return re_assemble_22 (insn & ~ 0x3ff1ffd, sym_value);
+      return (insn & ~ 0x3ff1ffd) | re_assemble_22 (sym_value);
 
-    /* This is any 17bit branch.  In PA2.0 syntax it also corresponds to
-       the "B" instruction as well as BE.  */
+      /* This is any 12 bit branch.  */
+    case R_PARISC_PCREL12F:
+      return (insn & ~ 0x1ffd) | re_assemble_12 (sym_value);
+
+    /* This is any 17 bit branch.  In PA2.0 syntax it also corresponds
+       to the "B" instruction as well as BE.  */
     case R_PARISC_PCREL17F:
     case R_PARISC_DIR17F:
     case R_PARISC_DIR17R:
     case R_PARISC_PCREL17C:
     case R_PARISC_PCREL17R:
-      return re_assemble_17 (insn & ~ 0x1f1ffd, sym_value);
+      return (insn & ~ 0x1f1ffd) | re_assemble_17 (sym_value);
 
     /* ADDIL or LDIL instructions.  */
     case R_PARISC_DLTREL21L:
@@ -1996,9 +2037,9 @@
     case R_PARISC_DPREL21L:
     case R_PARISC_PLTOFF21L:
     case R_PARISC_DIR21L:
-      return re_assemble_21 (insn & ~ 0x1fffff, sym_value);
+      return (insn & ~ 0x1fffff) | re_assemble_21 (sym_value);
 
-    /* LDO and integer loads/stores with 14bit displacements.  */
+    /* LDO and integer loads/stores with 14 bit displacements.  */
     case R_PARISC_DLTREL14R:
     case R_PARISC_DLTREL14F:
     case R_PARISC_DLTIND14R:
@@ -2018,11 +2059,12 @@
     case R_PARISC_PLTOFF14F:
     case R_PARISC_PLTOFF16F:
     case R_PARISC_DIR14R:
+    case R_PARISC_DIR14F:
     case R_PARISC_DIR16F:
     case R_PARISC_LTOFF16F:
       return (insn & ~ 0x3fff) | low_sign_unext (sym_value, 14);
 
-    /* Doubleword loads and stores with a 14bit displacement.  */
+    /* Doubleword loads and stores with a 14 bit displacement.  */
     case R_PARISC_DLTREL14DR:
     case R_PARISC_DLTIND14DR:
     case R_PARISC_LTOFF_FPTR14DR:
diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c
index 1939635..acdb3dd 100644
--- a/bfd/elf-m10200.c
+++ b/bfd/elf-m10200.c
@@ -505,11 +505,11 @@
 	abs24, imm24, d24 all look the same at the reloc level.  It
 	might make the code simpler if we had different relocs for
 	the various relaxable operand types.
-   
+
 	We don't handle imm16->imm8 or d16->d8 as they're very rare
 	and somewhat more difficult to support.  */
 
-static boolean 
+static boolean
 mn10200_elf_relax_section (abfd, sec, link_info, again)
      bfd *abfd;
      asection *sec;
@@ -654,7 +654,6 @@
 	 that would be more work, but would require less memory when
 	 the linker is run.  */
 
-
       /* Try to turn a 24bit pc-relative branch/call into a 16bit pc-relative
 	 branch/call.  */
       if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_PCREL24)
@@ -774,7 +773,6 @@
 	    bra lab2
 	   lab1:	       lab1:
 
-
 	 This happens when the bCC can't reach lab2 at assembly time,
 	 but due to other relaxations it can reach at link time.  */
       if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10200_PCREL8)
@@ -814,7 +812,7 @@
 	    continue;
 
 	  /* Now make sure we are a conditional branch.  This may not
-	     be necessary, but why take the chance. 
+	     be necessary, but why take the chance.
 
 	     Note these checks assume that R_MN10200_PCREL8 relocs
 	     only occur on bCC and bCCx insns.  If they occured
@@ -904,7 +902,7 @@
 		break;
 	    }
 	  bfd_put_8 (abfd, code, contents + irel->r_offset - 1);
-	  
+
 	  /* Set the reloc type and symbol for the first branch
 	     from the second branch.  */
 	  irel->r_info = nrel->r_info;
@@ -929,7 +927,7 @@
 	{
 	  bfd_vma value = symval;
 
-	  /* See if the value will fit in 16 bits. 
+	  /* See if the value will fit in 16 bits.
 	     We allow any 16bit match here.  We prune those we can't
 	     handle below.  */
 	  if ((long)value < 0x7fff && (long)value > -0x8000)
@@ -991,7 +989,7 @@
 		  *again = true;
 		  break;
 
-		/* mov imm24,an -> mov imm16,an 
+		/* mov imm24,an -> mov imm16,an
 		   cmp imm24,an -> cmp imm16,an
 		   mov (abs24),dn -> mov (abs16),dn
 		   mov dn,(abs24) -> mov dn,(abs16)
@@ -1053,7 +1051,7 @@
 		   add imm24,dn -> add imm16,dn
 		   add imm24,an -> add imm16,an
 		   sub imm24,dn -> sub imm16,dn
-		   sub imm24,an -> sub imm16,an 
+		   sub imm24,an -> sub imm16,an
 		   And all d24->d16 in memory ops.  */
 		case 0x78:
 		case 0xd0:
@@ -1506,7 +1504,6 @@
   return NULL;
 }
 
-
 #define TARGET_LITTLE_SYM	bfd_elf32_mn10200_vec
 #define TARGET_LITTLE_NAME	"elf32-mn10200"
 #define ELF_ARCH		bfd_arch_mn10200
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 498f538..ac320d6 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -1,5 +1,5 @@
 /* Matsushita 10300 specific support for 32-bit ELF
-   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -119,7 +119,6 @@
    does absolutely nothing.  */
 #define USE_RELA
 
-
 static reloc_howto_type elf_mn10300_howto_table[] =
 {
   /* Dummy relocation.  Does nothing.  */
@@ -342,7 +341,7 @@
 
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
-  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf32_External_Sym);
+  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym);
   if (!elf_bad_symtab (abfd))
     sym_hashes_end -= symtab_hdr->sh_info;
 
@@ -767,7 +766,6 @@
 		This is only done if the resulting code is no larger
 		than the original code.
 
-
 	* jmp:32 -> jmp:16					   2 bytes
 	* jmp:16 -> bra:8					   1 byte
 
@@ -930,7 +928,7 @@
 			    sym_sec = bfd_abs_section_ptr;
 			  else if (isym.st_shndx == SHN_COMMON)
 			    sym_sec = bfd_com_section_ptr;
-			  
+
 			  sym_name = bfd_elf_string_from_elf_section (input_bfd,
 							   symtab_hdr->sh_link,
 							   isym.st_name);
@@ -993,7 +991,6 @@
 		  shndx = _bfd_elf_section_from_bfd_section (input_bfd,
 							     section);
 
-
 		  /* Look at each function defined in this section and
 		     update info for that function.  */
 		  esym = extsyms;
@@ -1182,7 +1179,6 @@
 		    goto error_return;
 		}
 
-
 	      shndx = _bfd_elf_section_from_bfd_section (input_bfd, section);
 
 	      /* Now look for any function in this section which needs
@@ -1213,7 +1209,7 @@
 		    sym_sec = bfd_com_section_ptr;
 		  else
 		    abort ();
-		  
+
 		  sym_name = bfd_elf_string_from_elf_section (input_bfd,
 							symtab_hdr->sh_link,
 							isym.st_name);
@@ -1370,7 +1366,6 @@
 	}
     }
 
-
   /* (Re)initialize for the basic instruction shortening/relaxing pass.  */
   contents = NULL;
   extsyms = NULL;
@@ -1482,7 +1477,7 @@
 	    sym_sec = bfd_com_section_ptr;
 	  else
 	    abort ();
-	  
+
 	  symval = (isym.st_value
 		    + sym_sec->output_section->vma
 		    + sym_sec->output_offset);
@@ -1771,7 +1766,6 @@
 	    bra lab2
 	   lab1:	       lab1:
 
-
 	 This happens when the bCC can't reach lab2 at assembly time,
 	 but due to other relaxations it can reach at link time.  */
       if (ELF32_R_TYPE (irel->r_info) == (int) R_MN10300_PCREL8)
@@ -2642,7 +2636,7 @@
 	return true;
     }
 
-  sym_hash = (struct elf32_mn10300_link_hash_entry **)(elf_sym_hashes (abfd));
+  sym_hash = (struct elf32_mn10300_link_hash_entry **) (elf_sym_hashes (abfd));
   sym_hash_end = (sym_hash
 		  + (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)
 		     - symtab_hdr->sh_info));
@@ -2892,7 +2886,6 @@
    file.  This gets the MN10300 architecture right based on the machine
    number.  */
 
-/*ARGSUSED*/
 void
 _bfd_mn10300_elf_final_write_processing (abfd, linker)
      bfd *abfd;
@@ -2948,7 +2941,6 @@
   return true;
 }
 
-
 #define TARGET_LITTLE_SYM	bfd_elf32_mn10300_vec
 #define TARGET_LITTLE_NAME	"elf32-mn10300"
 #define ELF_ARCH		bfd_arch_mn10300
@@ -2977,5 +2969,4 @@
 #define bfd_elf32_bfd_merge_private_bfd_data \
                                         _bfd_mn10300_elf_merge_private_bfd_data
 
-
 #include "elf32-target.h"
diff --git a/bfd/elf.c b/bfd/elf.c
index 3143a0e..5ae24ee 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -31,6 +31,8 @@
 	haven't bothered yet.
  */
 
+/* For sparc64-cross-sparc32.  */
+#define _SYSCALL32
 #include "bfd.h"
 #include "sysdep.h"
 #include "bfdlink.h"
@@ -227,11 +229,11 @@
 
 /* Read a specified number of bytes at a specified offset in an ELF
    file, into a newly allocated buffer, and return a pointer to the
-   buffer. */
+   buffer.  */
 
 static char *
 elf_read (abfd, offset, size)
-     bfd * abfd;
+     bfd *abfd;
      long offset;
      unsigned int size;
 {
@@ -252,31 +254,31 @@
 
 boolean
 bfd_elf_mkobject (abfd)
-     bfd * abfd;
+     bfd *abfd;
 {
-  /* this just does initialization */
-  /* coff_mkobject zalloc's space for tdata.coff_obj_data ... */
+  /* This just does initialization.  */
+  /* coff_mkobject zalloc's space for tdata.coff_obj_data ...  */
   elf_tdata (abfd) = (struct elf_obj_tdata *)
     bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
   if (elf_tdata (abfd) == 0)
     return false;
-  /* since everything is done at close time, do we need any
-     initialization? */
+  /* Since everything is done at close time, do we need any
+     initialization?  */
 
   return true;
 }
 
 boolean
 bfd_elf_mkcorefile (abfd)
-     bfd * abfd;
+     bfd *abfd;
 {
-  /* I think this can be done just like an object file. */
+  /* I think this can be done just like an object file.  */
   return bfd_elf_mkobject (abfd);
 }
 
 char *
 bfd_elf_get_str_section (abfd, shindex)
-     bfd * abfd;
+     bfd *abfd;
      unsigned int shindex;
 {
   Elf_Internal_Shdr **i_shdrp;
@@ -291,7 +293,7 @@
   shstrtab = (char *) i_shdrp[shindex]->contents;
   if (shstrtab == NULL)
     {
-      /* No cached one, attempt to read, and cache what we read. */
+      /* No cached one, attempt to read, and cache what we read.  */
       offset = i_shdrp[shindex]->sh_offset;
       shstrtabsize = i_shdrp[shindex]->sh_size;
       shstrtab = elf_read (abfd, offset, shstrtabsize);
@@ -302,7 +304,7 @@
 
 char *
 bfd_elf_string_from_elf_section (abfd, shindex, strindex)
-     bfd * abfd;
+     bfd *abfd;
      unsigned int shindex;
      unsigned int strindex;
 {
@@ -343,6 +345,7 @@
 {
   asection *newsect;
   flagword flags;
+  struct elf_backend_data *bed;
 
   if (hdr->bfd_section != NULL)
     {
@@ -381,10 +384,23 @@
 
   /* The debugging sections appear to be recognized only by name, not
      any sort of flag.  */
-  if (strncmp (name, ".debug", sizeof ".debug" - 1) == 0
-      || strncmp (name, ".line", sizeof ".line" - 1) == 0
-      || strncmp (name, ".stab", sizeof ".stab" - 1) == 0)
-    flags |= SEC_DEBUGGING;
+  {
+    static const char *debug_sec_names [] =
+    {
+      ".debug",
+      ".gnu.linkonce.wi.",
+      ".line",
+      ".stab"
+    };
+    int i;
+
+    for (i = sizeof (debug_sec_names) / sizeof (debug_sec_names[0]); i--;)
+      if (strncmp (name, debug_sec_names[i], strlen (debug_sec_names[i])) == 0)
+	break;
+
+    if (i >= 0)
+      flags |= SEC_DEBUGGING;
+  }
 
   /* As a GNU extension, if the name begins with .gnu.linkonce, we
      only link a single copy of the section.  This is used to support
@@ -395,6 +411,11 @@
   if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
     flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
 
+  bed = get_elf_backend_data (abfd);
+  if (bed->elf_backend_section_flags)
+    if (! bed->elf_backend_section_flags (&flags, hdr))
+      return false;
+
   if (! bfd_set_section_flags (abfd, newsect, flags))
     return false;
 
@@ -457,7 +478,7 @@
 
 struct elf_internal_shdr *
 bfd_elf_find_section (abfd, name)
-     bfd * abfd;
+     bfd *abfd;
      char *name;
 {
   Elf_Internal_Shdr **i_shdrp;
@@ -497,7 +518,6 @@
    function.  It just short circuits the reloc if producing
    relocateable output against an external symbol.  */
 
-/*ARGSUSED*/
 bfd_reloc_status_type
 bfd_elf_generic_reloc (abfd,
 		       reloc_entry,
@@ -653,13 +673,40 @@
 	    case DT_DEBUG: name = "DEBUG"; break;
 	    case DT_TEXTREL: name = "TEXTREL"; break;
 	    case DT_JMPREL: name = "JMPREL"; break;
-	    case DT_AUXILIARY: name = "AUXILIARY"; stringp = true; break;
-	    case DT_FILTER: name = "FILTER"; stringp = true; break;
+	    case DT_BIND_NOW: name = "BIND_NOW"; break;
+	    case DT_INIT_ARRAY: name = "INIT_ARRAY"; break;
+	    case DT_FINI_ARRAY: name = "FINI_ARRAY"; break;
+	    case DT_INIT_ARRAYSZ: name = "INIT_ARRAYSZ"; break;
+	    case DT_FINI_ARRAYSZ: name = "FINI_ARRAYSZ"; break;
+	    case DT_RUNPATH: name = "RUNPATH"; stringp = true; break;
+	    case DT_FLAGS: name = "FLAGS"; break;
+	    case DT_PREINIT_ARRAY: name = "PREINIT_ARRAY"; break;
+	    case DT_PREINIT_ARRAYSZ: name = "PREINIT_ARRAYSZ"; break;
+	    case DT_CHECKSUM: name = "CHECKSUM"; break;
+	    case DT_PLTPADSZ: name = "PLTPADSZ"; break;
+	    case DT_MOVEENT: name = "MOVEENT"; break;
+	    case DT_MOVESZ: name = "MOVESZ"; break;
+	    case DT_FEATURE: name = "FEATURE"; break;
+	    case DT_POSFLAG_1: name = "POSFLAG_1"; break;
+	    case DT_SYMINSZ: name = "SYMINSZ"; break;
+	    case DT_SYMINENT: name = "SYMINENT"; break;
+	    case DT_CONFIG: name = "CONFIG"; stringp = true; break;
+	    case DT_DEPAUDIT: name = "DEPAUDIT"; stringp = true; break;
+	    case DT_AUDIT: name = "AUDIT"; stringp = true; break;
+	    case DT_PLTPAD: name = "PLTPAD"; break;
+	    case DT_MOVETAB: name = "MOVETAB"; break;
+	    case DT_SYMINFO: name = "SYMINFO"; break;
+	    case DT_RELACOUNT: name = "RELACOUNT"; break;
+	    case DT_RELCOUNT: name = "RELCOUNT"; break;
+	    case DT_FLAGS_1: name = "FLAGS_1"; break;
 	    case DT_VERSYM: name = "VERSYM"; break;
 	    case DT_VERDEF: name = "VERDEF"; break;
 	    case DT_VERDEFNUM: name = "VERDEFNUM"; break;
 	    case DT_VERNEED: name = "VERNEED"; break;
 	    case DT_VERNEEDNUM: name = "VERNEEDNUM"; break;
+	    case DT_AUXILIARY: name = "AUXILIARY"; stringp = true; break;
+	    case DT_USED: name = "USED"; break;
+	    case DT_FILTER: name = "FILTER"; stringp = true; break;
 	    }
 
 	  fprintf (f, "  %-11s ", name);
@@ -762,16 +809,16 @@
 	CONST char *name = NULL;
 	struct elf_backend_data *bed;
 	unsigned char st_other;
-	
+
 	section_name = symbol->section ? symbol->section->name : "(*none*)";
 
 	bed = get_elf_backend_data (abfd);
 	if (bed->elf_backend_print_symbol_all)
-	    name = (*bed->elf_backend_print_symbol_all) (abfd, filep, symbol);
+	  name = (*bed->elf_backend_print_symbol_all) (abfd, filep, symbol);
 
 	if (name == NULL)
 	  {
-	    name = symbol->name;  
+	    name = symbol->name;
 	    bfd_print_symbol_vandf ((PTR) file, symbol);
 	  }
 
@@ -838,7 +885,7 @@
 
 	/* If the st_other field is not zero, print it.  */
 	st_other = ((elf_symbol_type *) symbol)->internal_elf_sym.st_other;
-	
+
 	switch (st_other)
 	  {
 	  case 0: break;
@@ -950,7 +997,8 @@
 }
 
 void
-_bfd_elf_link_hash_hide_symbol(h)
+_bfd_elf_link_hash_hide_symbol (info, h)
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      struct elf_link_hash_entry *h;
 {
   h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
@@ -975,6 +1023,7 @@
   table->dynstr = NULL;
   table->bucketcount = 0;
   table->needed = NULL;
+  table->runpath = NULL;
   table->hgot = NULL;
   table->stab_info = NULL;
   table->dynlocal = NULL;
@@ -1018,6 +1067,16 @@
     elf_dt_name (abfd) = name;
 }
 
+void
+bfd_elf_set_dt_needed_soname (abfd, name)
+     bfd *abfd;
+     const char *name;
+{
+  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
+      && bfd_get_format (abfd) == bfd_object)
+    elf_dt_soname (abfd) = name;
+}
+
 /* Get the list of DT_NEEDED entries for a link.  This is a hook for
    the linker ELF emulation code.  */
 
@@ -1031,6 +1090,19 @@
   return elf_hash_table (info)->needed;
 }
 
+/* Get the list of DT_RPATH/DT_RUNPATH entries for a link.  This is a
+   hook for the linker ELF emulation code.  */
+
+struct bfd_link_needed_list *
+bfd_elf_get_runpath_list (abfd, info)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *info;
+{
+  if (info->hash->creator->flavour != bfd_target_elf_flavour)
+    return NULL;
+  return elf_hash_table (info)->runpath;
+}
+
 /* Get the name actually used for a dynamic object for a link.  This
    is the SONAME entry if there is one.  Otherwise, it is the string
    passed to bfd_elf_set_dt_needed_name, or it is the filename.  */
@@ -1155,7 +1227,7 @@
 
 /* ELF .o/exec file reading */
 
-/* Create a new bfd section from an ELF section header. */
+/* Create a new bfd section from an ELF section header.  */
 
 boolean
 bfd_section_from_shdr (abfd, shindex)
@@ -1328,8 +1400,10 @@
 	/* If this reloc section does not use the main symbol table we
 	   don't treat it as a reloc section.  BFD can't adequately
 	   represent such a section, so at least for now, we don't
-	   try.  We just present it as a normal section.  */
-	if (hdr->sh_link != elf_onesymtab (abfd))
+	   try.  We just present it as a normal section.  We also
+	   can't use it as a reloc section if it points to the null
+	   section.  */
+	if (hdr->sh_link != elf_onesymtab (abfd) || hdr->sh_info == SHN_UNDEF)
 	  return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
 
 	if (! bfd_section_from_shdr (abfd, hdr->sh_info))
@@ -1423,7 +1497,7 @@
   sec->used_by_bfd = (PTR) sdata;
 
   /* Indicate whether or not this section should use RELA relocations.  */
-  sdata->use_rela_p 
+  sdata->use_rela_p
     = get_elf_backend_data (abfd)->default_use_rela_p;
 
   return true;
@@ -1486,7 +1560,7 @@
       if (hdr->p_flags & PF_X)
 	{
 	  /* FIXME: all we known is that it has execute PERMISSION,
-	     may be data. */
+	     may be data.  */
 	  newsect->flags |= SEC_CODE;
 	}
     }
@@ -1558,7 +1632,7 @@
 
     default:
       /* Check for any processor-specific program segment types.
-         If no handler for them, default to making "segment" sections. */
+         If no handler for them, default to making "segment" sections.  */
       bed = get_elf_backend_data (abfd);
       if (bed->elf_backend_section_from_phdr)
 	return (*bed->elf_backend_section_from_phdr) (abfd, hdr, index);
@@ -1606,7 +1680,6 @@
 
 /* Set up an ELF internal section header for a section.  */
 
-/*ARGSUSED*/
 static void
 elf_fake_sections (abfd, asect, failedptrarg)
      bfd *abfd;
@@ -1720,16 +1793,10 @@
 		    || this_hdr->sh_info == elf_tdata (abfd)->cverrefs);
     }
   else if ((asect->flags & SEC_ALLOC) != 0
-	   && (asect->flags & SEC_LOAD) != 0)
-    this_hdr->sh_type = SHT_PROGBITS;
-  else if ((asect->flags & SEC_ALLOC) != 0
-	   && ((asect->flags & SEC_LOAD) == 0))
+	   && ((asect->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0))
     this_hdr->sh_type = SHT_NOBITS;
   else
-    {
-      /* Who knows?  */
-      this_hdr->sh_type = SHT_PROGBITS;
-    }
+    this_hdr->sh_type = SHT_PROGBITS;
 
   if ((asect->flags & SEC_ALLOC) != 0)
     this_hdr->sh_flags |= SHF_ALLOC;
@@ -1745,31 +1812,15 @@
   /* If the section has relocs, set up a section header for the
      SHT_REL[A] section.  If two relocation sections are required for
      this section, it is up to the processor-specific back-end to
-     create the other.  */ 
+     create the other.  */
   if ((asect->flags & SEC_RELOC) != 0
-      && !_bfd_elf_init_reloc_shdr (abfd, 
+      && !_bfd_elf_init_reloc_shdr (abfd,
 				    &elf_section_data (asect)->rel_hdr,
-				    asect, 
+				    asect,
 				    elf_section_data (asect)->use_rela_p))
     *failedptr = true;
 }
 
-/* Get elf arch size (32 / 64).
-   Returns -1 if not elf.  */
-
-int
-bfd_elf_get_arch_size (abfd)
-     bfd *abfd;
-{
-  if (abfd->xvec->flavour != bfd_target_elf_flavour)
-    {
-      bfd_set_error (bfd_error_wrong_format);
-      return -1;
-    }
-
-  return (get_elf_backend_data (abfd))->s->arch_size;
-}
-
 /* Assign all ELF section numbers.  The dummy first section is handled here
    too.  The link/info pointers for the standard section types are filled
    in here too, while we're at it.  */
@@ -1916,7 +1967,7 @@
 
 		  /* This is a .stab section.  */
 		  elf_section_data (s)->this_hdr.sh_entsize =
-		    4 + 2 * bfd_elf_get_arch_size (abfd) / 8;
+		    4 + 2 * bfd_get_arch_size (abfd) / 8;
 		}
 	    }
 	  break;
@@ -2005,7 +2056,7 @@
   for (idx = 0; idx < symcount; idx++)
     {
       sym = syms[idx];
-      
+
       if ((sym->flags & BSF_SECTION_SYM) != 0
 	  && sym->value == 0)
 	{
@@ -2019,7 +2070,7 @@
 		{
 		  if (sec->output_offset != 0)
 		    continue;
-		  
+
 		  sec = sec->output_section;
 
 		  /* Empty sections in the input files may have had a section
@@ -2918,18 +2969,21 @@
 
 	  if (p->p_type == PT_NOTE && bfd_get_format (abfd) == bfd_core)
 	    {
-	      if (i == 0)	/* the actual "note" segment */
-		{		/* this one actually contains everything. */
+	      /* The actual "note" segment has i == 0.
+		 This is the one that actually contains everything.  */
+	      if (i == 0)
+		{
 		  sec->filepos = off;
 		  p->p_filesz = sec->_raw_size;
 		  off += sec->_raw_size;
 		  voff = off;
 		}
-	      else	/* fake sections -- don't need to be written */
+	      else
 		{
+		  /* Fake sections -- don't need to be written.  */
 		  sec->filepos = 0;
 		  sec->_raw_size = 0;
-		  flags = sec->flags = 0;	/* no contents */
+		  flags = sec->flags = 0;
 		}
 	      p->p_memsz = 0;
 	      p->p_align = 1;
@@ -3243,7 +3297,7 @@
       i_ehdrp->e_machine = EM_NONE;
       break;
     case bfd_arch_sparc:
-      if (bfd_elf_get_arch_size (abfd) == 64)
+      if (bfd_get_arch_size (abfd) == 64)
 	i_ehdrp->e_machine = EM_SPARCV9;
       else
 	i_ehdrp->e_machine = EM_SPARC;
@@ -3252,11 +3306,20 @@
       i_ehdrp->e_machine = EM_S370;
       break;
     case bfd_arch_i386:
-      i_ehdrp->e_machine = EM_386;
+      if (bfd_get_arch_size (abfd) == 64)
+	i_ehdrp->e_machine = EM_X86_64;
+      else
+	i_ehdrp->e_machine = EM_386;
       break;
     case bfd_arch_ia64:
       i_ehdrp->e_machine = EM_IA_64;
       break;
+    case bfd_arch_m68hc11:
+      i_ehdrp->e_machine = EM_68HC11;
+      break;
+    case bfd_arch_m68hc12:
+      i_ehdrp->e_machine = EM_68HC12;
+      break;
     case bfd_arch_m68k:
       i_ehdrp->e_machine = EM_68K;
       break;
@@ -3306,10 +3369,10 @@
 	case 0:               i_ehdrp->e_machine = EM_CYGNUS_V850; break;
 	}
       break;
-   case bfd_arch_arc:
+    case bfd_arch_arc:
       i_ehdrp->e_machine = EM_CYGNUS_ARC;
       break;
-   case bfd_arch_arm:
+    case bfd_arch_arm:
       i_ehdrp->e_machine = EM_ARM;
       break;
     case bfd_arch_m32r:
@@ -3324,6 +3387,9 @@
     case bfd_arch_pj:
       i_ehdrp->e_machine = EM_PJ;
       break;
+    case bfd_arch_cris:
+      i_ehdrp->e_machine = EM_CRIS;
+      break;
       /* also note that EM_M32, AT&T WE32100 is unknown to bfd */
     default:
       i_ehdrp->e_machine = EM_NONE;
@@ -3331,24 +3397,24 @@
   i_ehdrp->e_version = bed->s->ev_current;
   i_ehdrp->e_ehsize = bed->s->sizeof_ehdr;
 
-  /* no program header, for now. */
+  /* No program header, for now.  */
   i_ehdrp->e_phoff = 0;
   i_ehdrp->e_phentsize = 0;
   i_ehdrp->e_phnum = 0;
 
-  /* each bfd section is section header entry */
+  /* Each bfd section is section header entry.  */
   i_ehdrp->e_entry = bfd_get_start_address (abfd);
   i_ehdrp->e_shentsize = bed->s->sizeof_shdr;
 
-  /* if we're building an executable, we'll need a program header table */
+  /* If we're building an executable, we'll need a program header table.  */
   if (abfd->flags & EXEC_P)
     {
-      /* it all happens later */
+      /* It all happens later.  */
 #if 0
       i_ehdrp->e_phentsize = sizeof (Elf_External_Phdr);
 
       /* elf_build_phdrs() returns a (NULL-terminated) array of
-	 Elf_Internal_Phdrs */
+	 Elf_Internal_Phdrs.  */
       i_phdrp = elf_build_phdrs (abfd, i_ehdrp, i_shdrp, &i_ehdrp->e_phnum);
       i_ehdrp->e_phoff = outbase;
       outbase += i_ehdrp->e_phentsize * i_ehdrp->e_phnum;
@@ -3428,7 +3494,7 @@
 
   _bfd_elf_assign_file_positions_for_relocs (abfd);
 
-  /* After writing the headers, we need to write the sections too... */
+  /* After writing the headers, we need to write the sections too...  */
   for (count = 1; count < i_ehdrp->e_shnum; count++)
     {
       if (bed->elf_backend_section_processing)
@@ -3459,10 +3525,12 @@
 _bfd_elf_write_corefile_contents (abfd)
      bfd *abfd;
 {
-  /* Hopefully this can be done just like an object file. */
+  /* Hopefully this can be done just like an object file.  */
   return _bfd_elf_write_object_contents (abfd);
 }
-/* given a section, search the header to find them... */
+
+/* Given a section, search the header to find them.  */
+
 int
 _bfd_elf_section_from_bfd_section (abfd, asect)
      bfd *abfd;
@@ -3571,14 +3639,18 @@
      bfd *ibfd;
      bfd *obfd;
 {
-  Elf_Internal_Ehdr *iehdr;
-  struct elf_segment_map *mfirst;
-  struct elf_segment_map **pm;
-  struct elf_segment_map *m;
-  Elf_Internal_Phdr *p;
-  unsigned int i;
-  unsigned int num_segments;
-  boolean phdr_included = false;
+  Elf_Internal_Ehdr *       iehdr;
+  struct elf_segment_map *  map;
+  struct elf_segment_map *  map_first;
+  struct elf_segment_map ** pointer_to_map;
+  Elf_Internal_Phdr *       segment;
+  asection *                section;
+  unsigned int              i;
+  unsigned int              num_segments;
+  boolean                   phdr_included = false;
+  bfd_vma                   maxpagesize;
+  struct elf_segment_map *  phdr_adjust_seg = NULL;
+  unsigned int              phdr_adjust_num = 0;
 
   if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
       || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
@@ -3589,119 +3661,214 @@
 
   iehdr = elf_elfheader (ibfd);
 
-  mfirst = NULL;
-  pm = &mfirst;
+  map_first = NULL;
+  pointer_to_map = &map_first;
 
   num_segments = elf_elfheader (ibfd)->e_phnum;
+  maxpagesize = get_elf_backend_data (obfd)->maxpagesize;
 
-#define IS_CONTAINED_BY(addr, len, bottom, phdr)		 	\
-	  ((addr) >= (bottom)				 	  	\
-	   && (   ((addr) + (len)) <= ((bottom) + (phdr)->p_memsz)	\
-	       || ((addr) + (len)) <= ((bottom) + (phdr)->p_filesz)))
+  /* Returns the end address of the segment + 1.  */
+#define SEGMENT_END(segment, start) 			\
+  (start + (segment->p_memsz > segment->p_filesz 	\
+   ? segment->p_memsz : segment->p_filesz))
 
-  /* Special case: corefile "NOTE" section containing regs, prpsinfo etc. */
+  /* Returns true if the given section is contained within
+     the given segment.  VMA addresses are compared.  */
+#define IS_CONTAINED_BY_VMA(section, segment)		\
+  (section->vma >= segment->p_vaddr			\
+   && (section->vma + section->_raw_size)		\
+   <= (SEGMENT_END (segment, segment->p_vaddr)))
 
-#define IS_COREFILE_NOTE(p, s)                                          \
-	    (p->p_type == PT_NOTE                                       \
-	     && bfd_get_format (ibfd) == bfd_core                       \
-	     && s->vma == 0 && s->lma == 0                              \
-	     && (bfd_vma) s->filepos >= p->p_offset                     \
-	     && (bfd_vma) s->filepos + s->_raw_size                     \
+  /* Returns true if the given section is contained within
+     the given segment.  LMA addresses are compared.  */
+#define IS_CONTAINED_BY_LMA(section, segment, base)	\
+    (section->lma >= base				\
+     && (section->lma + section->_raw_size)		\
+     <= SEGMENT_END (segment, base))
+
+  /* Special case: corefile "NOTE" section containing regs, prpsinfo etc.  */
+#define IS_COREFILE_NOTE(p, s)                          \
+	    (p->p_type == PT_NOTE                       \
+	     && bfd_get_format (ibfd) == bfd_core       \
+	     && s->vma == 0 && s->lma == 0              \
+	     && (bfd_vma) s->filepos >= p->p_offset     \
+	     && (bfd_vma) s->filepos + s->_raw_size     \
 	     <= p->p_offset + p->p_filesz)
 
   /* The complicated case when p_vaddr is 0 is to handle the Solaris
      linker, which generates a PT_INTERP section with p_vaddr and
      p_memsz set to 0.  */
-
-#define IS_SOLARIS_PT_INTERP(p, s)					\
-	    (p->p_vaddr == 0						\
-	     && p->p_filesz > 0						\
-	     && (s->flags & SEC_HAS_CONTENTS) != 0			\
-	     && s->_raw_size > 0					\
-	     && (bfd_vma) s->filepos >= p->p_offset			\
-	     && ((bfd_vma) s->filepos + s->_raw_size			\
+#define IS_SOLARIS_PT_INTERP(p, s)			\
+	    (   p->p_vaddr == 0				\
+	     && p->p_filesz > 0				\
+	     && (s->flags & SEC_HAS_CONTENTS) != 0	\
+	     && s->_raw_size > 0			\
+	     && (bfd_vma) s->filepos >= p->p_offset	\
+	     && ((bfd_vma) s->filepos + s->_raw_size	\
 		     <= p->p_offset + p->p_filesz))
 
-  /* Scan through the segments specified in the program header
-     of the input BFD.  */
-  for (i = 0, p = elf_tdata (ibfd)->phdr; i < num_segments; i++, p++)
-    {
-      unsigned int csecs;
-      asection *s;
-      asection **sections;
-      asection *os;
-      unsigned int isec;
-      bfd_vma matching_lma;
-      bfd_vma suggested_lma;
-      unsigned int j;
+  /* Decide if the given section should be included in the given segment.
+     A section will be included if:
+       1. It is within the address space of the segment,
+       2. It is an allocated segment,
+       3. There is an output section associated with it,
+       4. The section has not already been allocated to a previous segment.  */
+#define INCLUDE_SECTION_IN_SEGMENT(section, segment)	\
+  ((((IS_CONTAINED_BY_VMA (section, segment) 		\
+      || IS_SOLARIS_PT_INTERP (segment, section))	\
+     && (section->flags & SEC_ALLOC) != 0)		\
+    || IS_COREFILE_NOTE (segment, section))		\
+   && section->output_section != NULL			\
+   && section->segment_mark == false)
 
-      /* For each section in the input BFD, decide if it should be
-	 included in the current segment.  A section will be included
-	 if it is within the address space of the segment, and it is
-	 an allocated segment, and there is an output section
-	 associated with it.  */
-      csecs = 0;
-      for (s = ibfd->sections; s != NULL; s = s->next)
-	if (s->output_section != NULL)
-	  {
-	    if ((IS_CONTAINED_BY (s->vma, s->_raw_size, p->p_vaddr, p)
-		 || IS_SOLARIS_PT_INTERP (p, s))
-		&& (s->flags & SEC_ALLOC) != 0)
-	      ++csecs;
-	    else if (IS_COREFILE_NOTE (p, s))
-	      ++csecs;
-	  }
+  /* Returns true iff seg1 starts after the end of seg2.  */
+#define SEGMENT_AFTER_SEGMENT(seg1, seg2)		\
+    (seg1->p_vaddr >= SEGMENT_END (seg2, seg2->p_vaddr))
+
+  /* Returns true iff seg1 and seg2 overlap.  */
+#define SEGMENT_OVERLAPS(seg1, seg2)			\
+  (!(SEGMENT_AFTER_SEGMENT (seg1, seg2) || SEGMENT_AFTER_SEGMENT (seg2, seg1)))
+
+  /* Initialise the segment mark field.  */
+  for (section = ibfd->sections; section != NULL; section = section->next)
+    section->segment_mark = false;
+
+  /* Scan through the segments specified in the program header
+     of the input BFD.  For this first scan we look for overlaps
+     in the loadable segments.  These can be created by wierd
+     parameters to objcopy.  */
+  for (i = 0, segment = elf_tdata (ibfd)->phdr;
+       i < num_segments;
+       i++, segment++)
+    {
+      unsigned int j;
+      Elf_Internal_Phdr *segment2;
+
+      if (segment->p_type != PT_LOAD)
+	continue;
+
+      /* Determine if this segment overlaps any previous segments.  */
+      for (j = 0, segment2 = elf_tdata (ibfd)->phdr; j < i; j++, segment2 ++)
+	{
+	  bfd_signed_vma extra_length;
+
+	  if (segment2->p_type != PT_LOAD
+	      || ! SEGMENT_OVERLAPS (segment, segment2))
+	    continue;
+
+	  /* Merge the two segments together.  */
+	  if (segment2->p_vaddr < segment->p_vaddr)
+	    {
+	      /* Extend SEGMENT2 to include SEGMENT and then delete
+                 SEGMENT.  */
+	      extra_length =
+		SEGMENT_END (segment, segment->p_vaddr)
+		- SEGMENT_END (segment2, segment2->p_vaddr);
+
+	      if (extra_length > 0)
+		{
+		  segment2->p_memsz  += extra_length;
+		  segment2->p_filesz += extra_length;
+		}
+
+	      segment->p_type = PT_NULL;
+
+	      /* Since we have deleted P we must restart the outer loop.  */
+	      i = 0;
+	      segment = elf_tdata (ibfd)->phdr;
+	      break;
+	    }
+	  else
+	    {
+	      /* Extend SEGMENT to include SEGMENT2 and then delete
+                 SEGMENT2.  */
+	      extra_length =
+		SEGMENT_END (segment2, segment2->p_vaddr)
+		- SEGMENT_END (segment, segment->p_vaddr);
+
+	      if (extra_length > 0)
+		{
+		  segment->p_memsz  += extra_length;
+		  segment->p_filesz += extra_length;
+		}
+
+	      segment2->p_type = PT_NULL;
+	    }
+	}
+    }
+
+  /* The second scan attempts to assign sections to segments.  */
+  for (i = 0, segment = elf_tdata (ibfd)->phdr;
+       i < num_segments;
+       i ++, segment ++)
+    {
+      unsigned int  section_count;
+      asection **   sections;
+      asection *    output_section;
+      unsigned int  isec;
+      bfd_vma       matching_lma;
+      bfd_vma       suggested_lma;
+      unsigned int  j;
+
+      if (segment->p_type == PT_NULL)
+	continue;
+
+      /* Compute how many sections might be placed into this segment.  */
+      section_count = 0;
+      for (section = ibfd->sections; section != NULL; section = section->next)
+	if (INCLUDE_SECTION_IN_SEGMENT (section, segment))
+	  ++section_count;
 
       /* Allocate a segment map big enough to contain all of the
 	 sections we have selected.  */
-      m = ((struct elf_segment_map *)
+      map = ((struct elf_segment_map *)
 	   bfd_alloc (obfd,
 		      (sizeof (struct elf_segment_map)
-		       + ((size_t) csecs - 1) * sizeof (asection *))));
-      if (m == NULL)
+		       + ((size_t) section_count - 1) * sizeof (asection *))));
+      if (map == NULL)
 	return false;
 
       /* Initialise the fields of the segment map.  Default to
 	 using the physical address of the segment in the input BFD.  */
-      m->next          = NULL;
-      m->p_type        = p->p_type;
-      m->p_flags       = p->p_flags;
-      m->p_flags_valid = 1;
-      m->p_paddr       = p->p_paddr;
-      m->p_paddr_valid = 1;
+      map->next          = NULL;
+      map->p_type        = segment->p_type;
+      map->p_flags       = segment->p_flags;
+      map->p_flags_valid = 1;
+      map->p_paddr       = segment->p_paddr;
+      map->p_paddr_valid = 1;
 
       /* Determine if this segment contains the ELF file header
 	 and if it contains the program headers themselves.  */
-      m->includes_filehdr = (p->p_offset == 0
-			     && p->p_filesz >= iehdr->e_ehsize);
+      map->includes_filehdr = (segment->p_offset == 0
+			       && segment->p_filesz >= iehdr->e_ehsize);
 
-      m->includes_phdrs = 0;
+      map->includes_phdrs = 0;
 
-      if (! phdr_included || p->p_type != PT_LOAD)
+      if (! phdr_included || segment->p_type != PT_LOAD)
 	{
-	  m->includes_phdrs =
-	    (p->p_offset <= (bfd_vma) iehdr->e_phoff
-	     && (p->p_offset + p->p_filesz
+	  map->includes_phdrs =
+	    (segment->p_offset <= (bfd_vma) iehdr->e_phoff
+	     && (segment->p_offset + segment->p_filesz
 		 >= ((bfd_vma) iehdr->e_phoff
 		     + iehdr->e_phnum * iehdr->e_phentsize)));
-	  if (p->p_type == PT_LOAD && m->includes_phdrs)
+
+	  if (segment->p_type == PT_LOAD && map->includes_phdrs)
 	    phdr_included = true;
 	}
 
-      if (csecs == 0)
+      if (section_count == 0)
 	{
 	  /* Special segments, such as the PT_PHDR segment, may contain
 	     no sections, but ordinary, loadable segments should contain
 	     something.  */
-
-	  if (p->p_type == PT_LOAD)
+	  if (segment->p_type == PT_LOAD)
 	      _bfd_error_handler
 		(_("%s: warning: Empty loadable segment detected\n"),
 		 bfd_get_filename (ibfd));
 
-	  m->count = 0;
-	  *pm = m;
-	  pm = &m->next;
+	  map->count = 0;
+	  *pointer_to_map = map;
+	  pointer_to_map = &map->next;
 
 	  continue;
 	}
@@ -3734,7 +3901,8 @@
 	 pointers that we are interested in.  As these sections get assigned
 	 to a segment, they are removed from this array.  */
 
-      sections = (asection **) bfd_malloc (sizeof (asection *) * csecs);
+      sections = (asection **) bfd_malloc
+	(sizeof (asection *) * section_count);
       if (sections == NULL)
 	return false;
 
@@ -3744,70 +3912,67 @@
 	 case, where the sections have not been moved, this means that
 	 we have completely filled the segment, and there is nothing
 	 more to do.  */
-
       isec = 0;
       matching_lma = 0;
       suggested_lma = 0;
 
-      for (j = 0, s = ibfd->sections; s != NULL; s = s->next)
+      for (j = 0, section = ibfd->sections;
+	   section != NULL;
+	   section = section->next)
 	{
-	  os = s->output_section;
-
-	  if ((((IS_CONTAINED_BY (s->vma, s->_raw_size, p->p_vaddr, p)
-		 || IS_SOLARIS_PT_INTERP (p, s))
-		&& (s->flags & SEC_ALLOC) != 0)
-	       || IS_COREFILE_NOTE (p, s))
-	      && os != NULL)
+	  if (INCLUDE_SECTION_IN_SEGMENT (section, segment))
 	    {
-	      sections[j++] = s;
+	      output_section = section->output_section;
+
+	      sections[j ++] = section;
 
 	      /* The Solaris native linker always sets p_paddr to 0.
 		 We try to catch that case here, and set it to the
 		 correct value.  */
-	      if (p->p_paddr == 0
-		  && p->p_vaddr != 0
+	      if (segment->p_paddr == 0
+		  && segment->p_vaddr != 0
 		  && isec == 0
-		  && os->lma != 0
-		  && (os->vma == (p->p_vaddr
-				  + (m->includes_filehdr
-				     ? iehdr->e_ehsize
-				     : 0)
-				  + (m->includes_phdrs
-				     ? iehdr->e_phnum * iehdr->e_phentsize
-				     : 0))))
-		m->p_paddr = p->p_vaddr;
+		  && output_section->lma != 0
+		  && (output_section->vma == (segment->p_vaddr
+					      + (map->includes_filehdr
+						 ? iehdr->e_ehsize
+						 : 0)
+					      + (map->includes_phdrs
+						 ? iehdr->e_phnum * iehdr->e_phentsize
+						 : 0))))
+		map->p_paddr = segment->p_vaddr;
 
 	      /* Match up the physical address of the segment with the
 		 LMA address of the output section.  */
-	      if (IS_CONTAINED_BY (os->lma, os->_raw_size, m->p_paddr, p)
-		  || IS_COREFILE_NOTE (p, s))
+	      if (IS_CONTAINED_BY_LMA (output_section, segment, map->p_paddr)
+		  || IS_COREFILE_NOTE (segment, section))
 		{
 		  if (matching_lma == 0)
-		    matching_lma = os->lma;
+		    matching_lma = output_section->lma;
 
 		  /* We assume that if the section fits within the segment
-		     that it does not overlap any other section within that
+		     then it does not overlap any other section within that
 		     segment.  */
-		  m->sections[isec++] = os;
+		  map->sections[isec ++] = output_section;
 		}
 	      else if (suggested_lma == 0)
-		suggested_lma = os->lma;
+		suggested_lma = output_section->lma;
 	    }
 	}
 
-      BFD_ASSERT (j == csecs);
+      BFD_ASSERT (j == section_count);
 
       /* Step Two: Adjust the physical address of the current segment,
 	 if necessary.  */
-      if (isec == csecs)
+      if (isec == section_count)
 	{
 	  /* All of the sections fitted within the segment as currently
 	     specified.  This is the default case.  Add the segment to
 	     the list of built segments and carry on to process the next
 	     program header in the input BFD.  */
-	  m->count = csecs;
-	  *pm = m;
-	  pm = &m->next;
+	  map->count = section_count;
+	  *pointer_to_map = map;
+	  pointer_to_map = &map->next;
 
 	  free (sections);
 	  continue;
@@ -3819,25 +3984,33 @@
 	      /* At least one section fits inside the current segment.
 		 Keep it, but modify its physical address to match the
 		 LMA of the first section that fitted.  */
-
-	      m->p_paddr = matching_lma;
+	      map->p_paddr = matching_lma;
 	    }
 	  else
 	    {
 	      /* None of the sections fitted inside the current segment.
 		 Change the current segment's physical address to match
 		 the LMA of the first section.  */
-
-	      m->p_paddr = suggested_lma;
+	      map->p_paddr = suggested_lma;
 	    }
 
-	  /* Offset the segment physical address from the lma to allow
-	     for space taken up by elf headers.  */
-	  if (m->includes_filehdr)
-	    m->p_paddr -= iehdr->e_ehsize;
+	  /* Offset the segment physical address from the lma
+	     to allow for space taken up by elf headers.  */
+	  if (map->includes_filehdr)
+	    map->p_paddr -= iehdr->e_ehsize;
 
-	  if (m->includes_phdrs)
-	    m->p_paddr -= iehdr->e_phnum * iehdr->e_phentsize;
+	  if (map->includes_phdrs)
+	    {
+	      map->p_paddr -= iehdr->e_phnum * iehdr->e_phentsize;
+
+	      /* iehdr->e_phnum is just an estimate of the number
+		 of program headers that we will need.  Make a note
+		 here of the number we used and the segment we chose
+		 to hold these headers, so that we can adjust the
+		 offset when we know the correct value.  */
+	      phdr_adjust_num = iehdr->e_phnum;
+	      phdr_adjust_seg = map;
+	    }
 	}
 
       /* Step Three: Loop over the sections again, this time assigning
@@ -3850,97 +4023,99 @@
       isec = 0;
       do
 	{
-	  m->count = 0;
+	  map->count = 0;
 	  suggested_lma = 0;
 
 	  /* Fill the current segment with sections that fit.  */
-	  for (j = 0; j < csecs; j++)
+	  for (j = 0; j < section_count; j++)
 	    {
-	      s = sections[j];
+	      section = sections[j];
 
-	      if (s == NULL)
+	      if (section == NULL)
 		continue;
 
-	      os = s->output_section;
+	      output_section = section->output_section;
 
-	      if (IS_CONTAINED_BY (os->lma, os->_raw_size, m->p_paddr, p)
-		  || IS_COREFILE_NOTE (p, s))
+	      BFD_ASSERT (output_section != NULL);
+
+	      if (IS_CONTAINED_BY_LMA (output_section, segment, map->p_paddr)
+		  || IS_COREFILE_NOTE (segment, section))
 		{
-		  if (m->count == 0)
+		  if (map->count == 0)
 		    {
 		      /* If the first section in a segment does not start at
-			 the beginning of the segment, then something is wrong.  */
-		      if (os->lma != (m->p_paddr
-				      + (m->includes_filehdr
-					 ? iehdr->e_ehsize : 0)
-				      + (m->includes_phdrs
-					 ? iehdr->e_phnum * iehdr->e_phentsize
-					 : 0)))
+			 the beginning of the segment, then something is
+			 wrong.  */
+		      if (output_section->lma !=
+			  (map->p_paddr
+			   + (map->includes_filehdr ? iehdr->e_ehsize : 0)
+			   + (map->includes_phdrs
+			      ? iehdr->e_phnum * iehdr->e_phentsize
+			      : 0)))
 			abort ();
 		    }
 		  else
 		    {
 		      asection * prev_sec;
-		      bfd_vma maxpagesize;
 
-		      prev_sec = m->sections[m->count - 1];
-		      maxpagesize = get_elf_backend_data (obfd)->maxpagesize;
+		      prev_sec = map->sections[map->count - 1];
 
 		      /* If the gap between the end of the previous section
-			 and the start of this section is more than maxpagesize
-			 then we need to start a new segment.  */
-		      if (BFD_ALIGN (prev_sec->lma + prev_sec->_raw_size, maxpagesize)
-			  < BFD_ALIGN (os->lma, maxpagesize))
+			 and the start of this section is more than
+			 maxpagesize then we need to start a new segment.  */
+		      if ((BFD_ALIGN (prev_sec->lma + prev_sec->_raw_size, maxpagesize)
+			  < BFD_ALIGN (output_section->lma, maxpagesize))
+			  || ((prev_sec->lma + prev_sec->_raw_size) > output_section->lma))
 			{
 			  if (suggested_lma == 0)
-			    suggested_lma = os->lma;
+			    suggested_lma = output_section->lma;
 
 			  continue;
 			}
 		    }
 
-		  m->sections[m->count++] = os;
+		  map->sections[map->count++] = output_section;
 		  ++isec;
 		  sections[j] = NULL;
+		  section->segment_mark = true;
 		}
 	      else if (suggested_lma == 0)
-		suggested_lma = os->lma;
+		suggested_lma = output_section->lma;
 	    }
 
-	  BFD_ASSERT (m->count > 0);
+	  BFD_ASSERT (map->count > 0);
 
 	  /* Add the current segment to the list of built segments.  */
-	  *pm = m;
-	  pm = &m->next;
+	  *pointer_to_map = map;
+	  pointer_to_map = &map->next;
 
-	  if (isec < csecs)
+	  if (isec < section_count)
 	    {
 	      /* We still have not allocated all of the sections to
 		 segments.  Create a new segment here, initialise it
 		 and carry on looping.  */
-
-	      m = ((struct elf_segment_map *)
-		   bfd_alloc (obfd,
-			      (sizeof (struct elf_segment_map)
-			       + ((size_t) csecs - 1) * sizeof (asection *))));
-	      if (m == NULL)
+	      map = ((struct elf_segment_map *)
+		     bfd_alloc (obfd,
+				(sizeof (struct elf_segment_map)
+				 + ((size_t) section_count - 1)
+				 * sizeof (asection *))));
+	      if (map == NULL)
 		return false;
 
 	      /* Initialise the fields of the segment map.  Set the physical
 		 physical address to the LMA of the first section that has
 		 not yet been assigned.  */
-
-	      m->next             = NULL;
-	      m->p_type           = p->p_type;
-	      m->p_flags          = p->p_flags;
-	      m->p_flags_valid    = 1;
-	      m->p_paddr          = suggested_lma;
-	      m->p_paddr_valid    = 1;
-	      m->includes_filehdr = 0;
-	      m->includes_phdrs   = 0;
+	      map->next             = NULL;
+	      map->p_type           = segment->p_type;
+	      map->p_flags          = segment->p_flags;
+	      map->p_flags_valid    = 1;
+	      map->p_paddr          = suggested_lma;
+	      map->p_paddr_valid    = 1;
+	      map->includes_filehdr = 0;
+	      map->includes_phdrs   = 0;
 	    }
 	}
-      while (isec < csecs);
+      while (isec < section_count);
 
       free (sections);
     }
@@ -3949,44 +4124,65 @@
      p_paddr fields are zero.  When we try to objcopy or strip such a
      file, we get confused.  Check for this case, and if we find it
      reset the p_paddr_valid fields.  */
-  for (m = mfirst; m != NULL; m = m->next)
-    if (m->p_paddr != 0)
+  for (map = map_first; map != NULL; map = map->next)
+    if (map->p_paddr != 0)
       break;
-  if (m == NULL)
+  if (map == NULL)
     {
-      for (m = mfirst; m != NULL; m = m->next)
-	m->p_paddr_valid = 0;
+      for (map = map_first; map != NULL; map = map->next)
+	map->p_paddr_valid = 0;
     }
 
-  elf_tdata (obfd)->segment_map = mfirst;
+  elf_tdata (obfd)->segment_map = map_first;
+
+  /* If we had to estimate the number of program headers that were
+     going to be needed, then check our estimate know and adjust
+     the offset if necessary.  */
+  if (phdr_adjust_seg != NULL)
+    {
+      unsigned int count;
+
+      for (count = 0, map = map_first; map != NULL; map = map->next)
+	count++;
+
+      if (count > phdr_adjust_num)
+	phdr_adjust_seg->p_paddr
+	  -= (count - phdr_adjust_num) * iehdr->e_phentsize;
+    }
 
 #if 0
-  /* Final Step: Sort the segments into ascending order of physical address. */
-  if (mfirst != NULL)
+  /* Final Step: Sort the segments into ascending order of physical
+     address.  */
+  if (map_first != NULL)
     {
-      struct elf_segment_map* prev;
+      struct elf_segment_map *prev;
 
-      prev = mfirst;
-      for (m = mfirst->next; m != NULL; prev = m, m = m->next)
+      prev = map_first;
+      for (map = map_first->next; map != NULL; prev = map, map = map->next)
 	{
-	  /* Yes I know - its a bubble sort....*/
-	  if (m->next != NULL && (m->next->p_paddr < m->p_paddr))
+	  /* Yes I know - its a bubble sort....  */
+	  if (map->next != NULL && (map->next->p_paddr < map->p_paddr))
 	    {
-	      /* swap m and m->next */
-	      prev->next = m->next;
-	      m->next = m->next->next;
-	      prev->next->next = m;
+	      /* Swap map and map->next.  */
+	      prev->next = map->next;
+	      map->next = map->next->next;
+	      prev->next->next = map;
 
-	      /* restart loop. */
-	      m = mfirst;
+	      /* Restart loop.  */
+	      map = map_first;
 	    }
 	}
     }
 #endif
 
-#undef IS_CONTAINED_BY
-#undef IS_SOLARIS_PT_INTERP
+#undef SEGMENT_END
+#undef IS_CONTAINED_BY_VMA
+#undef IS_CONTAINED_BY_LMA
 #undef IS_COREFILE_NOTE
+#undef IS_SOLARIS_PT_INTERP
+#undef INCLUDE_SECTION_IN_SEGMENT
+#undef SEGMENT_AFTER_SEGMENT
+#undef SEGMENT_OVERLAPS
   return true;
 }
 
@@ -4108,7 +4304,7 @@
   if (!elf_map_symbols (abfd))
     return false;
 
-  /* Dump out the symtabs. */
+  /* Dump out the symtabs.  */
   {
     int symcount = bfd_get_symcount (abfd);
     asymbol **syms = bfd_get_outsymbols (abfd);
@@ -4159,9 +4355,11 @@
 	flagword flags = syms[idx]->flags;
 	int type;
 
-	if (flags & BSF_SECTION_SYM)
-	  /* Section symbols have no names.  */
-	  sym.st_name = 0;
+	if ((flags & BSF_SECTION_SYM) != 0)
+	  {
+	    /* Section symbols have no name.  */
+	    sym.st_name = 0;
+	  }
 	else
 	  {
 	    sym.st_name = (unsigned long) _bfd_stringtab_add (stt,
@@ -4799,13 +4997,14 @@
   asymbol **p;
 
   if (_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
-				     filename_ptr, functionname_ptr, 
+				     filename_ptr, functionname_ptr,
 				     line_ptr))
     return true;
 
   if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
 				     filename_ptr, functionname_ptr,
-				     line_ptr, 0))
+				     line_ptr, 0,
+				     &elf_tdata (abfd)->dwarf2_find_line_info))
     return true;
 
   if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
@@ -4926,7 +5125,7 @@
      bfd *abfd;
      arelent *areloc;
 {
-  /* Check whether we really have an ELF howto. */
+  /* Check whether we really have an ELF howto.  */
 
   if ((*areloc->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec)
     {
@@ -4934,7 +5133,7 @@
       reloc_howto_type *howto;
 
       /* Alien reloc: Try to determine its type to replace it with an
-	 equivalent ELF reloc. */
+	 equivalent ELF reloc.  */
 
       if (areloc->howto->pc_relative)
 	{
@@ -5047,48 +5246,44 @@
 {
   return bfd_reloc_ok;
 }
-
 
 /* Elf core file support.  Much of this only works on native
    toolchains, since we rely on knowing the
    machine-dependent procfs structure in order to pick
-   out details about the corefile. */
+   out details about the corefile.  */
 
 #ifdef HAVE_SYS_PROCFS_H
 # include <sys/procfs.h>
 #endif
 
-
-/* Define offsetof for those systems which lack it. */
+/* Define offsetof for those systems which lack it.  */
 
 #ifndef offsetof
 # define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
 #endif
 
-
-/* FIXME: this is kinda wrong, but it's what gdb wants. */
+/* FIXME: this is kinda wrong, but it's what gdb wants.  */
 
 static int
 elfcore_make_pid (abfd)
-     bfd* abfd;
+     bfd *abfd;
 {
   return ((elf_tdata (abfd)->core_lwpid << 16)
 	  + (elf_tdata (abfd)->core_pid));
 }
 
-
 /* If there isn't a section called NAME, make one, using
    data from SECT.  Note, this function will generate a
    reference to NAME, so you shouldn't deallocate or
-   overwrite it. */
+   overwrite it.  */
 
 static boolean
 elfcore_maybe_make_sect (abfd, name, sect)
-     bfd* abfd;
-     char* name;
-     asection* sect;
+     bfd *abfd;
+     char *name;
+     asection *sect;
 {
-  asection* sect2;
+  asection *sect2;
 
   if (bfd_get_section_by_name (abfd, name) != NULL)
     return true;
@@ -5104,9 +5299,8 @@
   return true;
 }
 
-
 /* prstatus_t exists on:
-     solaris 2.[567]
+     solaris 2.5+
      linux 2.[01] + glibc
      unixware 4.2
 */
@@ -5114,33 +5308,68 @@
 #if defined (HAVE_PRSTATUS_T)
 static boolean
 elfcore_grok_prstatus (abfd, note)
-     bfd* abfd;
-     Elf_Internal_Note* note;
+     bfd *abfd;
+     Elf_Internal_Note *note;
 {
-  prstatus_t prstat;
   char buf[100];
-  char* name;
-  asection* sect;
+  char *name;
+  asection *sect;
+  int raw_size;
+  int offset;
 
-  if (note->descsz != sizeof (prstat))
-    return true;
+  if (note->descsz == sizeof (prstatus_t))
+    {
+      prstatus_t prstat;
 
-  memcpy (&prstat, note->descdata, sizeof (prstat));
+      raw_size = sizeof (prstat.pr_reg);
+      offset   = offsetof (prstatus_t, pr_reg);
+      memcpy (&prstat, note->descdata, sizeof (prstat));
 
-  elf_tdata (abfd)->core_signal = prstat.pr_cursig;
-  elf_tdata (abfd)->core_pid = prstat.pr_pid;
+      elf_tdata (abfd)->core_signal = prstat.pr_cursig;
+      elf_tdata (abfd)->core_pid = prstat.pr_pid;
 
-  /* pr_who exists on:
-       solaris 2.[567]
-       unixware 4.2
-     pr_who doesn't exist on:
-       linux 2.[01]
-  */
+      /* pr_who exists on:
+	 solaris 2.5+
+	 unixware 4.2
+	 pr_who doesn't exist on:
+	 linux 2.[01]
+	 */
 #if defined (HAVE_PRSTATUS_T_PR_WHO)
-  elf_tdata (abfd)->core_lwpid = prstat.pr_who;
+      elf_tdata (abfd)->core_lwpid = prstat.pr_who;
 #endif
+    }
+#if defined (HAVE_PRSTATUS32_T)
+  else if (note->descsz == sizeof (prstatus32_t))
+    {
+      /* 64-bit host, 32-bit corefile */
+      prstatus32_t prstat;
 
-  /* Make a ".reg/999" section. */
+      raw_size = sizeof (prstat.pr_reg);
+      offset   = offsetof (prstatus32_t, pr_reg);
+      memcpy (&prstat, note->descdata, sizeof (prstat));
+
+      elf_tdata (abfd)->core_signal = prstat.pr_cursig;
+      elf_tdata (abfd)->core_pid = prstat.pr_pid;
+
+      /* pr_who exists on:
+	 solaris 2.5+
+	 unixware 4.2
+	 pr_who doesn't exist on:
+	 linux 2.[01]
+	 */
+#if defined (HAVE_PRSTATUS32_T_PR_WHO)
+      elf_tdata (abfd)->core_lwpid = prstat.pr_who;
+#endif
+    }
+#endif /* HAVE_PRSTATUS32_T */
+  else
+    {
+      /* Fail - we don't know how to handle any other
+	 note size (ie. data object type).  */
+      return true;
+    }
+
+  /* Make a ".reg/999" section.  */
 
   sprintf (buf, ".reg/%d", elfcore_make_pid (abfd));
   name = bfd_alloc (abfd, strlen (buf) + 1);
@@ -5151,8 +5380,10 @@
   sect = bfd_make_section (abfd, name);
   if (sect == NULL)
     return false;
-  sect->_raw_size = sizeof (prstat.pr_reg);
-  sect->filepos = note->descpos + offsetof (prstatus_t, pr_reg);
+
+  sect->_raw_size = raw_size;
+  sect->filepos = note->descpos + offset;
+
   sect->flags = SEC_HAS_CONTENTS;
   sect->alignment_power = 2;
 
@@ -5163,7 +5394,6 @@
 }
 #endif /* defined (HAVE_PRSTATUS_T) */
 
-
 /* Create a pseudosection containing the exact contents of NOTE.  This
    actually creates up to two pseudosections:
    - For the single-threaded case, a section named NAME, unless
@@ -5174,13 +5404,13 @@
 
 static boolean
 elfcore_make_note_pseudosection (abfd, name, note)
-     bfd* abfd;
+     bfd *abfd;
      char *name;
-     Elf_Internal_Note* note;
+     Elf_Internal_Note *note;
 {
   char buf[100];
   char *threaded_name;
-  asection* sect;
+  asection *sect;
 
   /* Build the section name.  */
 
@@ -5204,54 +5434,58 @@
   return true;
 }
 
-
 /* There isn't a consistent prfpregset_t across platforms,
    but it doesn't matter, because we don't have to pick this
-   data structure apart. */
+   data structure apart.  */
+
 static boolean
 elfcore_grok_prfpreg (abfd, note)
-     bfd* abfd;
-     Elf_Internal_Note* note;
+     bfd *abfd;
+     Elf_Internal_Note *note;
 {
   return elfcore_make_note_pseudosection (abfd, ".reg2", note);
 }
 
-
 /* Linux dumps the Intel SSE regs in a note named "LINUX" with a note
    type of 5 (NT_PRXFPREG).  Just include the whole note's contents
    literally.  */
+
 static boolean
 elfcore_grok_prxfpreg (abfd, note)
-     bfd* abfd;
-     Elf_Internal_Note* note;
+     bfd *abfd;
+     Elf_Internal_Note *note;
 {
   return elfcore_make_note_pseudosection (abfd, ".reg-xfp", note);
 }
 
-
 #if defined (HAVE_PRPSINFO_T)
-# define elfcore_psinfo_t prpsinfo_t
+typedef prpsinfo_t   elfcore_psinfo_t;
+#if defined (HAVE_PRPSINFO32_T)		/* Sparc64 cross Sparc32 */
+typedef prpsinfo32_t elfcore_psinfo32_t;
+#endif
 #endif
 
 #if defined (HAVE_PSINFO_T)
-# define elfcore_psinfo_t psinfo_t
+typedef psinfo_t   elfcore_psinfo_t;
+#if defined (HAVE_PSINFO32_T)		/* Sparc64 cross Sparc32 */
+typedef psinfo32_t elfcore_psinfo32_t;
 #endif
-
+#endif
 
 #if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
 
 /* return a malloc'ed copy of a string at START which is at
    most MAX bytes long, possibly without a terminating '\0'.
-   the copy will always have a terminating '\0'. */
+   the copy will always have a terminating '\0'.  */
 
 static char*
 elfcore_strndup (abfd, start, max)
-     bfd* abfd;
-     char* start;
+     bfd *abfd;
+     char *start;
      int max;
 {
-  char* dup;
-  char* end = memchr (start, '\0', max);
+  char *dup;
+  char *end = memchr (start, '\0', max);
   int len;
 
   if (end == NULL)
@@ -5271,28 +5505,50 @@
 
 static boolean
 elfcore_grok_psinfo (abfd, note)
-     bfd* abfd;
-     Elf_Internal_Note* note;
+     bfd *abfd;
+     Elf_Internal_Note *note;
 {
-  elfcore_psinfo_t psinfo;
+  if (note->descsz == sizeof (elfcore_psinfo_t))
+    {
+      elfcore_psinfo_t psinfo;
 
-  if (note->descsz != sizeof (elfcore_psinfo_t))
-    return true;
+      memcpy (&psinfo, note->descdata, sizeof (psinfo));
 
-  memcpy (&psinfo, note->descdata, note->descsz);
+      elf_tdata (abfd)->core_program
+	= elfcore_strndup (abfd, psinfo.pr_fname, sizeof (psinfo.pr_fname));
 
-  elf_tdata (abfd)->core_program
-    = elfcore_strndup (abfd, psinfo.pr_fname, sizeof (psinfo.pr_fname));
+      elf_tdata (abfd)->core_command
+	= elfcore_strndup (abfd, psinfo.pr_psargs, sizeof (psinfo.pr_psargs));
+    }
+#if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T)
+  else if (note->descsz == sizeof (elfcore_psinfo32_t))
+    {
+      /* 64-bit host, 32-bit corefile */
+      elfcore_psinfo32_t psinfo;
 
-  elf_tdata (abfd)->core_command
-    = elfcore_strndup (abfd, psinfo.pr_psargs, sizeof (psinfo.pr_psargs));
+      memcpy (&psinfo, note->descdata, sizeof (psinfo));
+
+      elf_tdata (abfd)->core_program
+	= elfcore_strndup (abfd, psinfo.pr_fname, sizeof (psinfo.pr_fname));
+
+      elf_tdata (abfd)->core_command
+	= elfcore_strndup (abfd, psinfo.pr_psargs, sizeof (psinfo.pr_psargs));
+    }
+#endif
+
+  else
+    {
+      /* Fail - we don't know how to handle any other
+	 note size (ie. data object type).  */
+      return true;
+    }
 
   /* Note that for some reason, a spurious space is tacked
      onto the end of the args in some (at least one anyway)
-     implementations, so strip it off if it exists. */
+     implementations, so strip it off if it exists.  */
 
   {
-    char* command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core_command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -5303,43 +5559,59 @@
 }
 #endif /* defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T) */
 
-
 #if defined (HAVE_PSTATUS_T)
 static boolean
 elfcore_grok_pstatus (abfd, note)
-     bfd* abfd;
-     Elf_Internal_Note* note;
+     bfd *abfd;
+     Elf_Internal_Note *note;
 {
-  pstatus_t pstat;
+  if (note->descsz == sizeof (pstatus_t)
+#if defined (HAVE_PXSTATUS_T)
+      || note->descsz == sizeof (pxstatus_t)
+#endif
+      )
+    {
+      pstatus_t pstat;
 
-  if (note->descsz != sizeof (pstat))
-    return true;
+      memcpy (&pstat, note->descdata, sizeof (pstat));
 
-  memcpy (&pstat, note->descdata, sizeof (pstat));
+      elf_tdata (abfd)->core_pid = pstat.pr_pid;
+    }
+#if defined (HAVE_PSTATUS32_T)
+  else if (note->descsz == sizeof (pstatus32_t))
+    {
+      /* 64-bit host, 32-bit corefile */
+      pstatus32_t pstat;
 
-  elf_tdata (abfd)->core_pid = pstat.pr_pid;
+      memcpy (&pstat, note->descdata, sizeof (pstat));
 
+      elf_tdata (abfd)->core_pid = pstat.pr_pid;
+    }
+#endif
   /* Could grab some more details from the "representative"
      lwpstatus_t in pstat.pr_lwp, but we'll catch it all in an
-     NT_LWPSTATUS note, presumably. */
+     NT_LWPSTATUS note, presumably.  */
 
   return true;
 }
 #endif /* defined (HAVE_PSTATUS_T) */
 
-
 #if defined (HAVE_LWPSTATUS_T)
 static boolean
 elfcore_grok_lwpstatus (abfd, note)
-     bfd* abfd;
-     Elf_Internal_Note* note;
+     bfd *abfd;
+     Elf_Internal_Note *note;
 {
   lwpstatus_t lwpstat;
   char buf[100];
-  char* name;
-  asection* sect;
+  char *name;
+  asection *sect;
 
-  if (note->descsz != sizeof (lwpstat))
+  if (note->descsz != sizeof (lwpstat)
+#if defined (HAVE_LWPXSTATUS_T)
+      && note->descsz != sizeof (lwpxstatus_t)
+#endif
+      )
     return true;
 
   memcpy (&lwpstat, note->descdata, sizeof (lwpstat));
@@ -5347,7 +5619,7 @@
   elf_tdata (abfd)->core_lwpid = lwpstat.pr_lwpid;
   elf_tdata (abfd)->core_signal = lwpstat.pr_cursig;
 
-  /* Make a ".reg/999" section. */
+  /* Make a ".reg/999" section.  */
 
   sprintf (buf, ".reg/%d", elfcore_make_pid (abfd));
   name = bfd_alloc (abfd, strlen (buf) + 1);
@@ -5412,41 +5684,41 @@
 #if defined (HAVE_WIN32_PSTATUS_T)
 static boolean
 elfcore_grok_win32pstatus (abfd, note)
-     bfd * abfd;
-     Elf_Internal_Note * note;
+     bfd *abfd;
+     Elf_Internal_Note *note;
 {
   char buf[30];
-  char * name;
-  asection * sect;
+  char *name;
+  asection *sect;
   win32_pstatus_t pstatus;
 
   if (note->descsz < sizeof (pstatus))
     return true;
 
-  memcpy (& pstatus, note->descdata, note->descsz);
-  
-  switch (pstatus.data_type) 
+  memcpy (&pstatus, note->descdata, note->descsz);
+
+  switch (pstatus.data_type)
     {
     case NOTE_INFO_PROCESS:
       /* FIXME: need to add ->core_command.  */
       elf_tdata (abfd)->core_signal = pstatus.data.process_info.signal;
       elf_tdata (abfd)->core_pid = pstatus.data.process_info.pid;
-      break ;
+      break;
 
     case NOTE_INFO_THREAD:
       /* Make a ".reg/999" section.  */
       sprintf (buf, ".reg/%d", pstatus.data.thread_info.tid);
-      
+
       name = bfd_alloc (abfd, strlen (buf) + 1);
       if (name == NULL)
-        return false;
-      
+	return false;
+
       strcpy (name, buf);
 
       sect = bfd_make_section (abfd, name);
       if (sect == NULL)
-        return false;
-      
+	return false;
+
       sect->_raw_size = sizeof (pstatus.data.thread_info.thread_context);
       sect->filepos = note->descpos + offsetof (struct win32_pstatus,
 						data.thread_info.thread_context);
@@ -5460,19 +5732,19 @@
 
     case NOTE_INFO_MODULE:
       /* Make a ".module/xxxxxxxx" section.  */
-      sprintf (buf, ".module/%08x" , pstatus.data.module_info.base_address);
-      
+      sprintf (buf, ".module/%08x", pstatus.data.module_info.base_address);
+
       name = bfd_alloc (abfd, strlen (buf) + 1);
       if (name == NULL)
 	return false;
-      
+
       strcpy (name, buf);
 
       sect = bfd_make_section (abfd, name);
-      
+
       if (sect == NULL)
 	return false;
-      
+
       sect->_raw_size = note->descsz;
       sect->filepos = note->descpos;
       sect->flags = SEC_HAS_CONTENTS;
@@ -5489,8 +5761,8 @@
 
 static boolean
 elfcore_grok_note (abfd, note)
-     bfd* abfd;
-     Elf_Internal_Note* note;
+     bfd *abfd;
+     Elf_Internal_Note *note;
 {
   switch (note->type)
     {
@@ -5516,11 +5788,11 @@
       return elfcore_grok_prfpreg (abfd, note);
 
 #if defined (HAVE_WIN32_PSTATUS_T)
-    case NT_WIN32PSTATUS:	
+    case NT_WIN32PSTATUS:
       return elfcore_grok_win32pstatus (abfd, note);
 #endif
 
-  case NT_PRXFPREG:		/* Linux SSE extension */
+    case NT_PRXFPREG:		/* Linux SSE extension */
       if (note->namesz == 5
 	  && ! strcmp (note->namedata, "LINUX"))
 	return elfcore_grok_prxfpreg (abfd, note);
@@ -5535,15 +5807,14 @@
     }
 }
 
-
 static boolean
 elfcore_read_notes (abfd, offset, size)
-     bfd* abfd;
+     bfd *abfd;
      bfd_vma offset;
      bfd_vma size;
 {
-  char* buf;
-  char* p;
+  char *buf;
+  char *p;
 
   if (size <= 0)
     return true;
@@ -5565,8 +5836,8 @@
   p = buf;
   while (p < buf + size)
     {
-      /* FIXME: bad alignment assumption. */
-      Elf_External_Note* xnp = (Elf_External_Note*) p;
+      /* FIXME: bad alignment assumption.  */
+      Elf_External_Note *xnp = (Elf_External_Note *) p;
       Elf_Internal_Note in;
 
       in.type = bfd_h_get_32 (abfd, (bfd_byte *) xnp->type);
@@ -5588,13 +5859,12 @@
   return true;
 }
 
-
 /* FIXME: This function is now unnecessary.  Callers can just call
    bfd_section_from_phdr directly.  */
 
 boolean
 _bfd_elfcore_section_from_phdr (abfd, phdr, sec_num)
-     bfd* abfd;
+     bfd *abfd;
      Elf_Internal_Phdr* phdr;
      int sec_num;
 {
@@ -5603,14 +5873,13 @@
 
   return true;
 }
-
-
 
 /* Providing external access to the ELF program header table.  */
 
 /* Return an upper bound on the number of bytes required to store a
    copy of ABFD's program header table entries.  Return -1 if an error
    occurs; bfd_get_error will return an appropriate code.  */
+
 long
 bfd_get_elf_phdr_upper_bound (abfd)
      bfd *abfd;
@@ -5625,7 +5894,6 @@
 	  * sizeof (Elf_Internal_Phdr));
 }
 
-
 /* Copy ABFD's program header table entries to *PHDRS.  The entries
    will be stored as an array of Elf_Internal_Phdr structures, as
    defined in include/elf/internal.h.  To find out how large the
@@ -5633,6 +5901,7 @@
 
    Return the number of program header table entries read, or -1 if an
    error occurs; bfd_get_error will return an appropriate code.  */
+
 int
 bfd_get_elf_phdrs (abfd, phdrs)
      bfd *abfd;
@@ -5647,7 +5916,7 @@
     }
 
   num_phdrs = elf_elfheader (abfd)->e_phnum;
-  memcpy (phdrs, elf_tdata (abfd)->phdr, 
+  memcpy (phdrs, elf_tdata (abfd)->phdr,
 	  num_phdrs * sizeof (Elf_Internal_Phdr));
 
   return num_phdrs;
diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h
index e655781..abda34d 100644
--- a/bfd/elf32-arm.h
+++ b/bfd/elf32-arm.h
@@ -17,7 +17,6 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-
 typedef unsigned long int insn32;
 typedef unsigned short int insn16;
 
@@ -37,7 +36,6 @@
   PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *, bfd_byte *,
 	   Elf_Internal_Rela *, bfd_vma, struct bfd_link_info *, asection *,
 	   const char *, unsigned char, struct elf_link_hash_entry *));
-
 static insn32 insert_thumb_branch
   PARAMS ((insn32, int));
 static struct elf_link_hash_entry *find_thumb_glue
@@ -57,14 +55,12 @@
   PARAMS ((struct bfd_link_info *, const char *, bfd *, bfd *, asection *,
 	   bfd_byte *, asection *, bfd_vma, bfd_signed_vma, bfd_vma));
 
+#define INTERWORK_FLAG(abfd)   (elf_elfheader (abfd)->e_flags & EF_INTERWORK)
+
 /* The linker script knows the section names for placement.
    The entry_names are used to do simple name mangling on the stubs.
    Given a function name, and its type, the stub can be found. The
-   name can be changed. The only requirement is the %s be present.
- */
-
-#define INTERWORK_FLAG( abfd )   (elf_elfheader (abfd)->e_flags & EF_INTERWORK)
-
+   name can be changed. The only requirement is the %s be present.  */
 #define THUMB2ARM_GLUE_SECTION_NAME ".glue_7t"
 #define THUMB2ARM_GLUE_ENTRY_NAME   "__%s_from_thumb"
 
@@ -76,14 +72,12 @@
 #define ELF_DYNAMIC_INTERPRETER     "/usr/lib/ld.so.1"
 
 /* The size in bytes of an entry in the procedure linkage table.  */
-
 #define PLT_ENTRY_SIZE 16
 
 /* The first entry in a procedure linkage table looks like
    this.  It is set up so that any shared library function that is
    called before the relocation has been set up calls the dynamic
-   linker first */
-
+   linker first.  */
 static const bfd_byte elf32_arm_plt0_entry [PLT_ENTRY_SIZE] =
 {
   0x04, 0xe0, 0x2d, 0xe5,	/* str   lr, [sp, #-4]!     */
@@ -94,7 +88,6 @@
 
 /* Subsequent entries in a procedure linkage table look like
    this.  */
-
 static const bfd_byte elf32_arm_plt_entry [PLT_ENTRY_SIZE] =
 {
   0x04, 0xc0, 0x9f, 0xe5,	/* ldr   ip, [pc, #4]       */
@@ -103,7 +96,6 @@
   0x00, 0x00, 0x00, 0x00        /* offset to symbol in got  */
 };
 
-
 /* The ARM linker needs to keep track of the number of relocs that it
    decides to copy in check_relocs for each symbol.  This is so that
    it can discard PC relative relocs if it doesn't need them when
@@ -112,7 +104,6 @@
 
 /* This structure keeps track of the number of PC relative relocs we
    have copied for a given symbol.  */
-
 struct elf32_arm_pcrel_relocs_copied
 {
   /* Next section.  */
@@ -124,7 +115,6 @@
 };
 
 /* Arm ELF linker hash entry.  */
-
 struct elf32_arm_link_hash_entry
 {
   struct elf_link_hash_entry root;
@@ -134,12 +124,10 @@
 };
 
 /* Declare this now that the above structures are defined.  */
-
 static boolean elf32_arm_discard_copies
   PARAMS ((struct elf32_arm_link_hash_entry *, PTR));
 
 /* Traverse an arm ELF linker hash table.  */
-
 #define elf32_arm_link_hash_traverse(table, func, info)			\
   (elf_link_hash_traverse						\
    (&(table)->root,							\
@@ -150,26 +138,25 @@
 #define elf32_arm_hash_table(info) \
   ((struct elf32_arm_link_hash_table *) ((info)->hash))
 
-/* ARM ELF linker hash table */
+/* ARM ELF linker hash table.  */
 struct elf32_arm_link_hash_table
-  {
-    /* The main hash table.  */
-    struct elf_link_hash_table root;
+{
+  /* The main hash table.  */
+  struct elf_link_hash_table root;
 
-    /* The size in bytes of the section containg the Thumb-to-ARM glue.  */
-    long int thumb_glue_size;
+  /* The size in bytes of the section containg the Thumb-to-ARM glue.  */
+  long int thumb_glue_size;
 
-    /* The size in bytes of the section containg the ARM-to-Thumb glue.  */
-    long int arm_glue_size;
+  /* The size in bytes of the section containg the ARM-to-Thumb glue.  */
+  long int arm_glue_size;
 
-    /* An arbitary input BFD chosen to hold the glue sections.  */
-    bfd * bfd_of_glue_owner;
+  /* An arbitary input BFD chosen to hold the glue sections.  */
+  bfd * bfd_of_glue_owner;
 
-    /* A boolean indicating whether knowledge of the ARM's pipeline
-       length should be applied by the linker.  */
-    int no_pipeline_knowledge;
-  };
-
+  /* A boolean indicating whether knowledge of the ARM's pipeline
+     length should be applied by the linker.  */
+  int no_pipeline_knowledge;
+};
 
 /* Create an entry in an ARM ELF linker hash table.  */
 
@@ -201,7 +188,7 @@
   return (struct bfd_hash_entry *) ret;
 }
 
-/* Create an ARM elf linker hash table */
+/* Create an ARM elf linker hash table.  */
 
 static struct bfd_link_hash_table *
 elf32_arm_link_hash_table_create (abfd)
@@ -229,6 +216,8 @@
   return &ret->root.root;
 }
 
+/* Locate the Thumb encoded calling stub for NAME.  */
+
 static struct elf_link_hash_entry *
 find_thumb_glue (link_info, name, input_bfd)
      struct bfd_link_info *link_info;
@@ -242,7 +231,6 @@
   /* We need a pointer to the armelf specific hash table.  */
   hash_table = elf32_arm_hash_table (link_info);
 
-
   tmp_name = ((char *)
        bfd_malloc (strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1));
 
@@ -255,7 +243,7 @@
 
   if (hash == NULL)
     /* xgettext:c-format */
-    _bfd_error_handler (_ ("%s: unable to find THUMB glue '%s' for `%s'"),
+    _bfd_error_handler (_("%s: unable to find THUMB glue '%s' for `%s'"),
 			bfd_get_filename (input_bfd), tmp_name, name);
 
   free (tmp_name);
@@ -263,6 +251,8 @@
   return hash;
 }
 
+/* Locate the ARM encoded calling stub for NAME.  */
+
 static struct elf_link_hash_entry *
 find_arm_glue (link_info, name, input_bfd)
      struct bfd_link_info *link_info;
@@ -288,7 +278,7 @@
 
   if (myh == NULL)
     /* xgettext:c-format */
-    _bfd_error_handler (_ ("%s: unable to find ARM glue '%s' for `%s'"),
+    _bfd_error_handler (_("%s: unable to find ARM glue '%s' for `%s'"),
 			bfd_get_filename (input_bfd), tmp_name, name);
 
   free (tmp_name);
@@ -296,24 +286,21 @@
   return myh;
 }
 
-/*
-   ARM->Thumb glue:
+/* ARM->Thumb glue:
 
    .arm
    __func_from_arm:
    ldr r12, __func_addr
    bx  r12
    __func_addr:
-   .word func    @ behave as if you saw a ARM_32 reloc
- */
+   .word func    @ behave as if you saw a ARM_32 reloc.  */
 
 #define ARM2THUMB_GLUE_SIZE 12
 static const insn32 a2t1_ldr_insn = 0xe59fc000;
 static const insn32 a2t2_bx_r12_insn = 0xe12fff1c;
 static const insn32 a2t3_func_addr_insn = 0x00000001;
 
-/*
-   Thumb->ARM:                          Thumb->(non-interworking aware) ARM
+/* Thumb->ARM:                          Thumb->(non-interworking aware) ARM
 
    .thumb                               .thumb
    .align 2                             .align 2
@@ -327,8 +314,7 @@
    ldmia r13! {r6, lr}
    bx    lr
    __func_addr:
-   .word        func
- */
+   .word        func  */
 
 #define THUMB2ARM_GLUE_SIZE 8
 static const insn16 t2a1_bx_pc_insn = 0x4778;
@@ -408,7 +394,6 @@
   s = bfd_get_section_by_name
     (globals->bfd_of_glue_owner, ARM2THUMB_GLUE_SECTION_NAME);
 
-
   BFD_ASSERT (s != NULL);
 
   tmp_name = ((char *)
@@ -423,14 +408,14 @@
 
   if (myh != NULL)
     {
+      /* We've already seen this guy.  */
       free (tmp_name);
-      return;			/* we've already seen this guy */
+      return;
     }
 
   /* The only trick here is using hash_table->arm_glue_size as the value. Even
      though the section isn't allocated yet, this is where we will be putting
      it.  */
-
   _bfd_generic_link_add_one_symbol (link_info, globals->bfd_of_glue_owner, tmp_name,
 				    BSF_GLOBAL,
 				    s, globals->arm_glue_size + 1,
@@ -477,8 +462,9 @@
 
   if (myh != NULL)
     {
+      /* We've already seen this guy.  */
       free (tmp_name);
-      return;			/* we've already seen this guy */
+      return;
     }
 
   _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, tmp_name,
@@ -486,17 +472,16 @@
 				    NULL, true, false,
 				    (struct bfd_link_hash_entry **) &myh);
 
-  /* If we mark it 'thumb', the disassembler will do a better job.  */
+  /* If we mark it 'Thumb', the disassembler will do a better job.  */
   bind = ELF_ST_BIND (myh->type);
   myh->type = ELF_ST_INFO (bind, STT_ARM_TFUNC);
 
   free (tmp_name);
 
-  /* Allocate another symbol to mark where we switch to arm mode.  */
-
 #define CHANGE_TO_ARM "__%s_change_to_arm"
 #define BACK_FROM_ARM "__%s_back_from_arm"
 
+  /* Allocate another symbol to mark where we switch to Arm mode.  */
   tmp_name = (char *) bfd_malloc (strlen (name) + strlen (CHANGE_TO_ARM) + 1);
 
   BFD_ASSERT (tmp_name);
@@ -520,6 +505,7 @@
 /* Select a BFD to be used to hold the sections used by the glue code.
    This function is called from the linker scripts in ld/emultempl/
    {armelf/pe}.em  */
+
 boolean
 bfd_elf32_arm_get_bfd_for_interworking (abfd, info)
      bfd *abfd;
@@ -556,7 +542,7 @@
 	  || !bfd_set_section_flags (abfd, sec, flags)
 	  || !bfd_set_section_alignment (abfd, sec, 2))
 	return false;
-      
+
       /* Set the gc mark to prevent the section from being removed by garbage
 	 collection, despite the fact that no relocs refer to this section.  */
       sec->gc_mark = 1;
@@ -574,7 +560,7 @@
 	  || !bfd_set_section_flags (abfd, sec, flags)
 	  || !bfd_set_section_alignment (abfd, sec, 2))
 	return false;
-      
+
       sec->gc_mark = 1;
     }
 
@@ -608,7 +594,6 @@
 
   /* Here we have a bfd that is to be included on the link.  We have a hook
      to do reloc rummaging, before section sizes are nailed down.  */
-
   globals = elf32_arm_hash_table (link_info);
 
   BFD_ASSERT (globals != NULL);
@@ -628,8 +613,8 @@
 	continue;
 
       symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
-      /* Load the relocs.  */
 
+      /* Load the relocs.  */
       irel = (_bfd_elf32_link_read_relocs (abfd, sec, (PTR) NULL,
 					(Elf_Internal_Rela *) NULL, false));
 
@@ -646,7 +631,7 @@
 	  r_type = ELF32_R_TYPE (irel->r_info);
 	  r_index = ELF32_R_SYM (irel->r_info);
 
-	  /* These are the only relocation types we care about */
+	  /* These are the only relocation types we care about.  */
 	  if (   r_type != R_ARM_PC24
 	      && r_type != R_ARM_THM_PC22)
 	    continue;
@@ -663,6 +648,7 @@
 		  contents = (bfd_byte *) bfd_malloc (sec->_raw_size);
 		  if (contents == NULL)
 		    goto error_return;
+
 		  free_contents = contents;
 
 		  if (!bfd_get_section_contents (abfd, sec, contents,
@@ -684,7 +670,9 @@
 			     bfd_malloc (symtab_hdr->sh_size));
 		  if (extsyms == NULL)
 		    goto error_return;
+
 		  free_extsyms = extsyms;
+
 		  if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
 		      || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd)
 			  != symtab_hdr->sh_size))
@@ -692,15 +680,14 @@
 		}
 	    }
 
-	  /* If the relocation is not against a symbol it cannot concern us. */
-
+	  /* If the relocation is not against a symbol it cannot concern us.  */
 	  h = NULL;
 
-	  /* We don't care about local symbols */
+	  /* We don't care about local symbols.  */
 	  if (r_index < symtab_hdr->sh_info)
 	    continue;
 
-	  /* This is an external symbol */
+	  /* This is an external symbol.  */
 	  r_index -= symtab_hdr->sh_info;
 	  h = (struct elf_link_hash_entry *)
 	    elf_sym_hashes (abfd)[r_index];
@@ -716,7 +703,6 @@
 	      /* This one is a call from arm code.  We need to look up
 	         the target of the call.  If it is a thumb target, we
 	         insert glue.  */
-
 	      if (ELF_ST_TYPE(h->type) == STT_ARM_TFUNC)
 		record_arm_to_thumb_glue (link_info, h);
 	      break;
@@ -725,7 +711,6 @@
 	      /* This one is a call from thumb code.  We look
 	         up the target of the call.  If it is not a thumb
                  target, we insert glue.  */
-
 	      if (ELF_ST_TYPE (h->type) != STT_ARM_TFUNC)
 		record_thumb_to_arm_glue (link_info, h);
 	      break;
@@ -737,7 +722,7 @@
     }
 
   return true;
-  
+
 error_return:
   if (free_relocs != NULL)
     free (free_relocs);
@@ -745,7 +730,7 @@
     free (free_contents);
   if (free_extsyms != NULL)
     free (free_extsyms);
-  
+
   return false;
 }
 
@@ -788,7 +773,6 @@
   unsigned int low_bits;
   unsigned int high_bits;
 
-
   BFD_ASSERT ((rel_off & 1) != 1);
 
   rel_off >>= 1;				/* Half word aligned address.  */
@@ -800,14 +784,14 @@
   else if ((br_insn & HI_LOW_ORDER) == HI_LOW_ORDER)
     br_insn = HI_LOW_ORDER | (high_bits << 16) | low_bits;
   else
-    abort ();			/* error - not a valid branch instruction form */
+    /* FIXME: abort is probably not the right call. krk@cygnus.com  */
+    abort ();			/* error - not a valid branch instruction form.  */
 
-  /* FIXME: abort is probably not the right call. krk@cygnus.com */
-  
   return br_insn;
 }
 
-/* Thumb code calling an ARM function */
+/* Thumb code calling an ARM function.  */
+
 static int
 elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
 			 hit_data, sym_sec, offset, addend, val)
@@ -854,10 +838,10 @@
 	  && !INTERWORK_FLAG (sym_sec->owner))
 	{
 	  _bfd_error_handler
-	    (_ ("%s(%s): warning: interworking not enabled."),
+	    (_("%s(%s): warning: interworking not enabled."),
 	     bfd_get_filename (sym_sec->owner), name);
 	  _bfd_error_handler
-	    (_ ("  first occurrence: %s: thumb call to arm"),
+	    (_("  first occurrence: %s: thumb call to arm"),
 	     bfd_get_filename (input_bfd));
 
 	  return false;
@@ -873,13 +857,19 @@
 		  s->contents + my_offset + 2);
 
       ret_offset =
-	((bfd_signed_vma) val)	/* Address of destination of the stub */
+	/* Address of destination of the stub.  */
+	((bfd_signed_vma) val)
 	- ((bfd_signed_vma)
-	   (s->output_offset	/* Offset from the start of the current section to the start of the stubs.  */
-	    + my_offset		/* Offset of the start of this stub from the start of the stubs.  */
-	    + s->output_section->vma)	/* Address of the start of the current section.  */
-	   + 4			/* The branch instruction is 4 bytes into the stub.  */
-	   + 8);		/* ARM branches work from the pc of the instruction + 8.  */
+	   /* Offset from the start of the current section to the start of the stubs.  */
+	   (s->output_offset
+	    /* Offset of the start of this stub from the start of the stubs.  */
+	    + my_offset
+	    /* Address of the start of the current section.  */
+	    + s->output_section->vma)
+	   /* The branch instruction is 4 bytes into the stub.  */
+	   + 4
+	   /* ARM branches work from the pc of the instruction + 8.  */
+	   + 8);
 
       bfd_put_32 (output_bfd,
 		  t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF),
@@ -907,7 +897,8 @@
   return true;
 }
 
-/* Arm code calling a Thumb function */
+/* Arm code calling a Thumb function.  */
+
 static int
 elf32_arm_to_thumb_stub (info, name, input_bfd, output_bfd, input_section,
 			 hit_data, sym_sec, offset, addend, val)
@@ -952,12 +943,13 @@
 	  && !INTERWORK_FLAG (sym_sec->owner))
 	{
 	  _bfd_error_handler
-	    (_ ("%s(%s): warning: interworking not enabled."),
+	    (_("%s(%s): warning: interworking not enabled."),
 	     bfd_get_filename (sym_sec->owner), name);
 	  _bfd_error_handler
-	    (_ ("  first occurrence: %s: arm call to thumb"),
+	    (_("  first occurrence: %s: arm call to thumb"),
 	     bfd_get_filename (input_bfd));
 	}
+
       --my_offset;
       myh->root.u.def.value = my_offset;
 
@@ -977,7 +969,7 @@
   tmp = bfd_get_32 (input_bfd, hit_data);
   tmp = tmp & 0xFF000000;
 
-  /* Somehow these are both 4 too far, so subtract 8. */
+  /* Somehow these are both 4 too far, so subtract 8.  */
   ret_offset = s->output_offset
     + my_offset
     + s->output_section->vma
@@ -985,7 +977,7 @@
        + input_section->output_section->vma
        + offset + addend)
     - 8;
-  
+
   tmp = tmp | ((ret_offset >> 2) & 0x00FFFFFF);
 
   bfd_put_32 (output_bfd, tmp, hit_data
@@ -995,6 +987,7 @@
 }
 
 /* Perform a relocation as part of a final link.  */
+
 static bfd_reloc_status_type
 elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
 			       input_section, contents, rel, value,
@@ -1066,8 +1059,7 @@
     case R_ARM_XPC25:
 #endif
       /* When generating a shared object, these relocations are copied
-	 into the output file to be resolved at run time. */
-
+	 into the output file to be resolved at run time.  */
       if (info->shared
 	  && (r_type != R_ARM_PC24
  	      || (h != NULL
@@ -1160,14 +1152,13 @@
 				      sreloc->contents)
 				     + sreloc->reloc_count));
 	  ++sreloc->reloc_count;
-	  
+
 	  /* If this reloc is against an external symbol, we do not want to
 	     fiddle with the addend.  Otherwise, we need to include the symbol
-	     value so that it becomes an addend for the dynamic reloc. */
+	     value so that it becomes an addend for the dynamic reloc.  */
 	  if (! relocate)
 	    return bfd_reloc_ok;
 
-	  
 	  return _bfd_final_link_relocate (howto, input_bfd, input_section,
 					   contents, rel->r_offset, value,
 					   (bfd_vma) 0);
@@ -1188,7 +1179,7 @@
 		_bfd_error_handler (_("\
 %s: Warning: Arm BLX instruction targets Arm function '%s'."),
 				    bfd_get_filename (input_bfd),
-				    h->root.root.string);
+				    h ? h->root.root.string : "(local)");
 	    }
 	  else
 #endif
@@ -1208,7 +1199,6 @@
 	    {
 	      /* The old way of doing things.  Trearing the addend as a
 		 byte sized field and adding in the pipeline offset.  */
-
 	      value -= (input_section->output_section->vma
 			+ input_section->output_offset);
 	      value -= rel->r_offset;
@@ -1237,7 +1227,6 @@
 		 Note: None of these operations have knowledge of the pipeline
 		 size of the processor, thus it is up to the assembler to encode
 		 this information into the addend.  */
-
 	      value -= (input_section->output_section->vma
 			+ input_section->output_offset);
 	      value -= rel->r_offset;
@@ -1259,22 +1248,31 @@
 		}
 	    }
 
+	  signed_addend = value;
+	  signed_addend >>= howto->rightshift;
+
 	  /* It is not an error for an undefined weak reference to be
 	     out of range.  Any program that branches to such a symbol
-	     is going to crash anyway, so there is no point worrying 
-	     about getting the destination exactly right.  */	     
+	     is going to crash anyway, so there is no point worrying
+	     about getting the destination exactly right.  */
 	  if (! h || h->root.type != bfd_link_hash_undefweak)
 	    {
 	      /* Perform a signed range check.  */
-	      signed_addend = value;
-	      signed_addend >>= howto->rightshift;
-	      if (signed_addend > ((bfd_signed_vma)(howto->dst_mask >> 1))
+	      if (   signed_addend >   ((bfd_signed_vma)  (howto->dst_mask >> 1))
 		  || signed_addend < - ((bfd_signed_vma) ((howto->dst_mask + 1) >> 1)))
 		return bfd_reloc_overflow;
 	    }
-	      
-	  value = (signed_addend & howto->dst_mask)
-	    | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask));
+
+#ifndef OLD_ARM_ABI
+	  /* If necessary set the H bit in the BLX instruction.  */
+	  if (r_type == R_ARM_XPC25 && ((value & 2) == 2))
+	    value = (signed_addend & howto->dst_mask)
+	      | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask))
+	      | (1 << 24);
+	  else
+#endif
+	    value = (signed_addend & howto->dst_mask)
+	      | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask));
 	  break;
 
 	case R_ARM_ABS32:
@@ -1323,7 +1321,7 @@
       return bfd_reloc_ok;
 
     case R_ARM_THM_ABS5:
-      /* Support ldr and str instructions for the thumb. */
+      /* Support ldr and str instructions for the thumb.  */
 #ifdef USE_REL
       /* Need to refetch addend.  */
       addend = bfd_get_16 (input_bfd, hit_data) & howto->src_mask;
@@ -1362,7 +1360,7 @@
 	{
 	  bfd_vma upper = upper_insn & 0x7ff;
 	  bfd_vma lower = lower_insn & 0x7ff;
-	  upper = (upper ^ 0x400) - 0x400; /* sign extend */
+	  upper = (upper ^ 0x400) - 0x400; /* Sign extend.  */
 	  addend = (upper << 12) | (lower << 1);
 	  signed_addend = addend;
 	}
@@ -1377,7 +1375,7 @@
 	      _bfd_error_handler (_("\
 %s: Warning: Thumb BLX instruction targets thumb function '%s'."),
 				  bfd_get_filename (input_bfd),
-				  h->root.root.string);
+				  h ? h->root.root.string : "(local)");
 	  }
 	else
 #endif
@@ -1401,11 +1399,11 @@
 	relocation -= (input_section->output_section->vma
 		       + input_section->output_offset
 		       + rel->r_offset);
-	
+
 	if (! globals->no_pipeline_knowledge)
 	  {
-	    Elf_Internal_Ehdr * i_ehdrp; /* Elf file header, internal form */
-	    
+	    Elf_Internal_Ehdr * i_ehdrp; /* Elf file header, internal form.  */
+
 	    i_ehdrp = elf_elfheader (input_bfd);
 
 	    /* Previous versions of this code also used to add in the pipline
@@ -1467,21 +1465,19 @@
       BFD_ASSERT (sgot != NULL);
       if (sgot == NULL)
         return bfd_reloc_notsupported;
-      
+
       /* Note that sgot->output_offset is not involved in this
          calculation.  We always want the start of .got.  If we
          define _GLOBAL_OFFSET_TABLE in a different way, as is
          permitted by the ABI, we might have to change this
-         calculation. */
-
+         calculation.  */
       value -= sgot->output_section->vma;
       return _bfd_final_link_relocate (howto, input_bfd, input_section,
       				       contents, rel->r_offset, value,
       				       (bfd_vma) 0);
 
     case R_ARM_GOTPC:
-      /* Use global offset table as symbol value. */
-
+      /* Use global offset table as symbol value.  */
       BFD_ASSERT (sgot != NULL);
 
       if (sgot == NULL)
@@ -1494,7 +1490,7 @@
 
     case R_ARM_GOT32:
       /* Relocation is to the entry for this symbol in the
-         global offset table. */
+         global offset table.  */
       if (sgot == NULL)
 	return bfd_reloc_notsupported;
 
@@ -1517,8 +1513,7 @@
 
 		 When doing a dynamic link, we create a .rel.got relocation
 		 entry to initialize the value.  This is done in the
-		 finish_dynamic_symbol routine. */
-
+		 finish_dynamic_symbol routine.  */
 	      if ((off & 1) != 0)
 		off &= ~1;
 	      else
@@ -1541,7 +1536,7 @@
 
 	  /* The offset must always be a multiple of 4.  We use the
 	     least significant bit to record whether we have already
-	     generated the necessary reloc. */
+	     generated the necessary reloc.  */
 	  if ((off & 1) != 0)
 	    off &= ~1;
 	  else
@@ -1572,7 +1567,7 @@
 
 	  value = sgot->output_offset + off;
 	}
-      
+
       return _bfd_final_link_relocate (howto, input_bfd, input_section,
       				       contents, rel->r_offset, value,
       				       (bfd_vma) 0);
@@ -1582,7 +1577,7 @@
          procedure linkage table.  */
 
       /* Resolve a PLT32 reloc against a local symbol directly,
-         without using the procedure linkage table. */
+         without using the procedure linkage table.  */
       if (h == NULL)
         return _bfd_final_link_relocate (howto, input_bfd, input_section,
         				 contents, rel->r_offset, value,
@@ -1645,44 +1640,67 @@
      reloc_howto_type * howto;
      bfd_signed_vma     increment;
 {
-  bfd_vma        contents;
   bfd_signed_vma addend;
 
-  contents = bfd_get_32 (abfd, address);
-
-  /* Get the (signed) value from the instruction.  */
-  addend = contents & howto->src_mask;
-  if (addend & ((howto->src_mask + 1) >> 1))
+  if (howto->type == R_ARM_THM_PC22)
     {
-      bfd_signed_vma mask;
-      
-      mask = -1;
-      mask &= ~ howto->src_mask;
-      addend |= mask;
-    }
+      int upper_insn, lower_insn;
+      int upper, lower;
 
-  /* Add in the increment, (which is a byte value).  */
-  switch (howto->type)
-    {
-    case R_ARM_THM_PC22:
-    default:
+      upper_insn = bfd_get_16 (abfd, address);
+      lower_insn = bfd_get_16 (abfd, address + 2);
+      upper = upper_insn & 0x7ff;
+      lower = lower_insn & 0x7ff;
+
+      addend = (upper << 12) | (lower << 1);
       addend += increment;
-      break;
-      
-    case R_ARM_PC24:
-      addend <<= howto->size;
-      addend +=  increment;
-      
-      /* Should we check for overflow here ?  */
+      addend >>= 1;
 
-      /* Drop any undesired bits.  */
-      addend >>= howto->rightshift;
-      break;
+      upper_insn = (upper_insn & 0xf800) | ((addend >> 11) & 0x7ff);
+      lower_insn = (lower_insn & 0xf800) | (addend & 0x7ff);
+
+      bfd_put_16 (abfd, upper_insn, address);
+      bfd_put_16 (abfd, lower_insn, address + 2);
     }
-  
-  contents = (contents & ~ howto->dst_mask) | (addend & howto->dst_mask);
-  
-  bfd_put_32 (abfd, contents, address);
+  else
+    {
+      bfd_vma        contents;
+
+      contents = bfd_get_32 (abfd, address);
+
+      /* Get the (signed) value from the instruction.  */
+      addend = contents & howto->src_mask;
+      if (addend & ((howto->src_mask + 1) >> 1))
+	{
+	  bfd_signed_vma mask;
+
+	  mask = -1;
+	  mask &= ~ howto->src_mask;
+	  addend |= mask;
+	}
+
+      /* Add in the increment, (which is a byte value).  */
+      switch (howto->type)
+	{
+	default:
+	  addend += increment;
+	  break;
+
+	case R_ARM_PC24:
+	  addend <<= howto->size;
+	  addend +=  increment;
+
+	  /* Should we check for overflow here ?  */
+
+	  /* Drop any undesired bits.  */
+	  addend >>= howto->rightshift;
+	  break;
+	}
+
+      contents = (contents & ~ howto->dst_mask) | (addend & howto->dst_mask);
+
+      bfd_put_32 (abfd, contents, address);
+    }
 }
 #endif /* USE_REL */
 
@@ -1761,6 +1779,7 @@
       h = NULL;
       sym = NULL;
       sec = NULL;
+
       if (r_symndx < symtab_hdr->sh_info)
 	{
 	  sym = local_syms + r_symndx;
@@ -1772,10 +1791,12 @@
       else
 	{
 	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-	  while (h->root.type == bfd_link_hash_indirect
+
+	  while (   h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-	  if (h->root.type == bfd_link_hash_defined
+
+	  if (   h->root.type == bfd_link_hash_defined
 	      || h->root.type == bfd_link_hash_defweak)
 	    {
 	      int relocation_needed = 1;
@@ -1784,7 +1805,7 @@
 
 	      /* In these cases, we don't need the relocation value.
 	         We check specially because in some obscure cases
-	         sec->output_section will be NULL. */
+	         sec->output_section will be NULL.  */
 	      switch (r_type)
 		{
 	        case R_ARM_PC24:
@@ -1794,7 +1815,14 @@
 	              	  (!info->symbolic && h->dynindx != -1)
 	                  || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
 			  )
-	              && ((input_section->flags & SEC_ALLOC) != 0)
+	              && ((input_section->flags & SEC_ALLOC) != 0
+			  /* DWARF will emit R_ARM_ABS32 relocations in its
+			     sections against symbols defined externally
+			     in shared libraries.  We can't do anything
+			     with them here.  */
+			  || ((input_section->flags & SEC_DEBUGGING) != 0
+			      && (h->elf_link_hash_flags
+				  & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
 		      )
 	            relocation_needed = 0;
 		  break;
@@ -1877,10 +1905,15 @@
 	  switch (r)
 	    {
 	    case bfd_reloc_overflow:
-	      if (!((*info->callbacks->reloc_overflow)
-		    (info, name, howto->name, (bfd_vma) 0,
-		     input_bfd, input_section, rel->r_offset)))
-		return false;
+	      /* If the overflowing reloc was to an undefined symbol,
+		 we have already printed one error message and there
+		 is no point complaining again.  */
+	      if ((! h ||
+		   h->root.type != bfd_link_hash_undefined)
+		  && (!((*info->callbacks->reloc_overflow)
+			(info, name, howto->name, (bfd_vma) 0,
+			 input_bfd, input_section, rel->r_offset))))
+		  return false;
 	      break;
 
 	    case bfd_reloc_undefined:
@@ -1891,19 +1924,19 @@
 	      break;
 
 	    case bfd_reloc_outofrange:
-	      msg = _ ("internal error: out of range error");
+	      msg = _("internal error: out of range error");
 	      goto common_error;
 
 	    case bfd_reloc_notsupported:
-	      msg = _ ("internal error: unsupported relocation error");
+	      msg = _("internal error: unsupported relocation error");
 	      goto common_error;
 
 	    case bfd_reloc_dangerous:
-	      msg = _ ("internal error: dangerous error");
+	      msg = _("internal error: dangerous error");
 	      goto common_error;
 
 	    default:
-	      msg = _ ("internal error: unknown error");
+	      msg = _("internal error: unknown error");
 	      /* fall through */
 
 	    common_error:
@@ -1931,11 +1964,11 @@
       if (EF_ARM_EABI_VERSION (flags) == EF_ARM_EABI_UNKNOWN)
 	{
 	  if (flags & EF_INTERWORK)
-	    _bfd_error_handler (_ ("\
+	    _bfd_error_handler (_("\
 Warning: Not setting interwork flag of %s since it has already been specified as non-interworking"),
 				bfd_get_filename (abfd));
 	  else
-	    _bfd_error_handler (_ ("\
+	    _bfd_error_handler (_("\
 Warning: Clearing the interwork flag of %s due to outside request"),
 				bfd_get_filename (abfd));
 	}
@@ -1950,6 +1983,7 @@
 }
 
 /* Copy backend specific data from one object module to another.  */
+
 static boolean
 elf32_arm_copy_private_bfd_data (ibfd, obfd)
      bfd *ibfd;
@@ -1969,10 +2003,6 @@
       && EF_ARM_EABI_VERSION (out_flags) == EF_ARM_EABI_UNKNOWN
       && in_flags != out_flags)
     {
-      /* Cannot mix PIC and non-PIC code.  */
-      if ((in_flags & EF_PIC) != (out_flags & EF_PIC))
-	return false;
-
       /* Cannot mix APCS26 and APCS32 code.  */
       if ((in_flags & EF_APCS_26) != (out_flags & EF_APCS_26))
 	return false;
@@ -1986,12 +2016,16 @@
       if ((in_flags & EF_INTERWORK) != (out_flags & EF_INTERWORK))
 	{
 	  if (out_flags & EF_INTERWORK)
-	    _bfd_error_handler (_ ("\
+	    _bfd_error_handler (_("\
 Warning: Clearing the interwork flag in %s because non-interworking code in %s has been linked with it"),
 			  bfd_get_filename (obfd), bfd_get_filename (ibfd));
 
 	  in_flags &= ~EF_INTERWORK;
 	}
+
+      /* Likewise for PIC, though don't warn for this case.  */
+      if ((in_flags & EF_PIC) != (out_flags & EF_PIC))
+	in_flags &= ~EF_PIC;
     }
 
   elf_elfheader (obfd)->e_flags = in_flags;
@@ -2002,6 +2036,7 @@
 
 /* Merge backend specific data from an object file to the output
    object file when linking.  */
+
 static boolean
 elf32_arm_merge_private_bfd_data (ibfd, obfd)
      bfd * ibfd;
@@ -2009,8 +2044,11 @@
 {
   flagword out_flags;
   flagword in_flags;
+  boolean flags_compatible = true;
+  boolean null_input_bfd = true;
+  asection *sec;
 
-  /* Check if we have the same endianess */
+  /* Check if we have the same endianess.  */
   if (_bfd_generic_verify_endian_match (ibfd, obfd) == false)
     return false;
 
@@ -2021,7 +2059,7 @@
   /* The input BFD must have had its flags initialised.  */
   /* The following seems bogus to me -- The flags are initialized in
      the assembler but I don't think an elf_flags_init field is
-     written into the object */
+     written into the object.  */
   /* BFD_ASSERT (elf_flags_init (ibfd)); */
 
   in_flags  = elf_elfheader (ibfd)->e_flags;
@@ -2029,13 +2067,14 @@
 
   if (!elf_flags_init (obfd))
     {
-      /* If the input is the default architecture then do not
-         bother setting the flags for the output architecture,
-         instead allow future merges to do this.  If no future
-         merges ever set these flags then they will retain their
-         unitialised values, which surprise surprise, correspond
+      /* If the input is the default architecture and had the default
+	 flags then do not bother setting the flags for the output
+	 architecture, instead allow future merges to do this.  If no
+	 future merges ever set these flags then they will retain their
+         uninitialised values, which surprise surprise, correspond
          to the default values.  */
-      if (bfd_get_arch_info (ibfd)->the_default)
+      if (bfd_get_arch_info (ibfd)->the_default
+	  && elf_elfheader (ibfd)->e_flags == 0)
 	return true;
 
       elf_flags_init (obfd) = true;
@@ -2048,10 +2087,26 @@
       return true;
     }
 
-  /* Check flag compatibility.  */
+  /* Identical flags must be compatible.  */
   if (in_flags == out_flags)
     return true;
 
+  /* Check to see if the input BFD actually contains any sections.
+     If not, its flags may not have been initialised either, but it cannot
+     actually cause any incompatibility.  */
+  for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+    {
+      /* Ignore synthetic glue sections.  */
+      if (strcmp (sec->name, ".glue_7")
+	  && strcmp (sec->name, ".glue_7t"))
+	{
+	  null_input_bfd = false;
+	  break;
+	}
+    }
+  if (null_input_bfd)
+    return true;
+
   /* Complain about various flag mismatches.  */
   if (EF_ARM_EABI_VERSION (in_flags) != EF_ARM_EABI_VERSION (out_flags))
     {
@@ -2061,50 +2116,62 @@
 			 (in_flags & EF_ARM_EABIMASK) >> 24,
 			 bfd_get_filename (obfd),
 			 (out_flags & EF_ARM_EABIMASK) >> 24);
+      return false;
     }
-  else if (EF_ARM_EABI_VERSION (in_flags) != EF_ARM_EABI_UNKNOWN)
-    /* Not sure what needs to be checked for EABI versions >= 1.  */
-    return true;
 
-  if ((in_flags & EF_APCS_26) != (out_flags & EF_APCS_26))
-    _bfd_error_handler (_ ("\
+  /* Not sure what needs to be checked for EABI versions >= 1.  */
+  if (EF_ARM_EABI_VERSION (in_flags) == EF_ARM_EABI_UNKNOWN)
+    {
+      if ((in_flags & EF_APCS_26) != (out_flags & EF_APCS_26))
+	{
+	  _bfd_error_handler (_("\
 Error: %s compiled for APCS-%d, whereas %s is compiled for APCS-%d"),
 			bfd_get_filename (ibfd),
 			in_flags & EF_APCS_26 ? 26 : 32,
 			bfd_get_filename (obfd),
 			out_flags & EF_APCS_26 ? 26 : 32);
+	  flags_compatible = false;
+	}
 
-  if ((in_flags & EF_APCS_FLOAT) != (out_flags & EF_APCS_FLOAT))
-    _bfd_error_handler (_ ("\
+      if ((in_flags & EF_APCS_FLOAT) != (out_flags & EF_APCS_FLOAT))
+	{
+	  _bfd_error_handler (_("\
 Error: %s passes floats in %s registers, whereas %s passes them in %s registers"),
 			bfd_get_filename (ibfd),
-		     in_flags & EF_APCS_FLOAT ? _ ("float") : _ ("integer"),
+		     in_flags & EF_APCS_FLOAT ? _("float") : _("integer"),
 			bfd_get_filename (obfd),
-		      out_flags & EF_APCS_26 ? _ ("float") : _ ("integer"));
+		      out_flags & EF_APCS_26 ? _("float") : _("integer"));
+	  flags_compatible = false;
+	}
 
-  if ((in_flags & EF_PIC) != (out_flags & EF_PIC))
-    _bfd_error_handler (_ ("\
-Error: %s is compiled as position %s code, whereas %s is not"),
-			bfd_get_filename (ibfd),
-		    in_flags & EF_PIC ? _ ("independent") : _ ("dependent"),
-			bfd_get_filename (obfd));
+#ifdef EF_SOFT_FLOAT
+      if ((in_flags & EF_SOFT_FLOAT) != (out_flags & EF_SOFT_FLOAT))
+	{
+	  _bfd_error_handler (_ ("\
+Error: %s uses %s floating point, whereas %s uses %s floating point"),
+			      bfd_get_filename (ibfd),
+			      in_flags & EF_SOFT_FLOAT ? _("soft") : _("hard"),
+			      bfd_get_filename (obfd),
+			      out_flags & EF_SOFT_FLOAT ? _("soft") : _("hard"));
+	  flags_compatible = false;
+	}
+#endif
 
-  /* Interworking mismatch is only a warning. */
-  if ((in_flags & EF_INTERWORK) != (out_flags & EF_INTERWORK))
-    {
-      _bfd_error_handler (_ ("\
+      /* Interworking mismatch is only a warning.  */
+      if ((in_flags & EF_INTERWORK) != (out_flags & EF_INTERWORK))
+	_bfd_error_handler (_("\
 Warning: %s %s interworking, whereas %s %s"),
 			  bfd_get_filename (ibfd),
-	  in_flags & EF_INTERWORK ? _ ("supports") : _ ("does not support"),
+	  in_flags & EF_INTERWORK ? _("supports") : _("does not support"),
 			  bfd_get_filename (obfd),
-		    out_flags & EF_INTERWORK ? _ ("does not") : _ ("does"));
-      return true;
+		    out_flags & EF_INTERWORK ? _("does not") : _("does"));
     }
 
-  return false;
+  return flags_compatible;
 }
 
-/* Display the flags field */
+/* Display the flags field.  */
+
 static boolean
 elf32_arm_print_private_bfd_data (abfd, ptr)
      bfd *abfd;
@@ -2119,10 +2186,11 @@
   _bfd_elf_print_private_bfd_data (abfd, ptr);
 
   flags = elf_elfheader (abfd)->e_flags;
-  /* Ignore init flag - it may not be set, despite the flags field containing valid data.  */
+  /* Ignore init flag - it may not be set, despite the flags field
+     containing valid data.  */
 
   /* xgettext:c-format */
-  fprintf (file, _ ("private flags = %lx:"), elf_elfheader (abfd)->e_flags);
+  fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags);
 
   switch (EF_ARM_EABI_VERSION (flags))
     {
@@ -2131,61 +2199,61 @@
 	 official ARM ELF extended ABI.  Hence they are only decoded if
 	 the EABI version is not set.  */
       if (flags & EF_INTERWORK)
-	fprintf (file, _ (" [interworking enabled]"));
-      
+	fprintf (file, _(" [interworking enabled]"));
+
       if (flags & EF_APCS_26)
-	fprintf (file, _ (" [APCS-26]"));
+	fprintf (file, _(" [APCS-26]"));
       else
-	fprintf (file, _ (" [APCS-32]"));
-      
+	fprintf (file, _(" [APCS-32]"));
+
       if (flags & EF_APCS_FLOAT)
-	fprintf (file, _ (" [floats passed in float registers]"));
-      
+	fprintf (file, _(" [floats passed in float registers]"));
+
       if (flags & EF_PIC)
-	fprintf (file, _ (" [position independent]"));
+	fprintf (file, _(" [position independent]"));
 
       if (flags & EF_NEW_ABI)
-	fprintf (file, _ (" [new ABI]"));
-		 
+	fprintf (file, _(" [new ABI]"));
+
       if (flags & EF_OLD_ABI)
-	fprintf (file, _ (" [old ABI]"));
-		 
+	fprintf (file, _(" [old ABI]"));
+
       if (flags & EF_SOFT_FLOAT)
-	fprintf (file, _ (" [software FP]"));
-		 
+	fprintf (file, _(" [software FP]"));
+
       flags &= ~(EF_INTERWORK | EF_APCS_26 | EF_APCS_FLOAT | EF_PIC
 		 | EF_NEW_ABI | EF_OLD_ABI | EF_SOFT_FLOAT);
       break;
-      
+
     case EF_ARM_EABI_VER1:
-      fprintf (file, _ (" [Version1 EABI]"));
-      
+      fprintf (file, _(" [Version1 EABI]"));
+
       if (flags & EF_ARM_SYMSARESORTED)
-	fprintf (file, _ (" [sorted symbol table]"));
+	fprintf (file, _(" [sorted symbol table]"));
       else
-	fprintf (file, _ (" [unsorted symbol table]"));
-      
+	fprintf (file, _(" [unsorted symbol table]"));
+
       flags &= ~ EF_ARM_SYMSARESORTED;
       break;
-      
+
     default:
-      fprintf (file, _ (" <EABI version unrecognised>"));
+      fprintf (file, _(" <EABI version unrecognised>"));
       break;
     }
 
   flags &= ~ EF_ARM_EABIMASK;
 
   if (flags & EF_ARM_RELEXEC)
-    fprintf (file, _ (" [relocatable executable]"));
+    fprintf (file, _(" [relocatable executable]"));
 
   if (flags & EF_ARM_HASENTRY)
-    fprintf (file, _ (" [has entry point]"));
+    fprintf (file, _(" [has entry point]"));
 
   flags &= ~ (EF_ARM_RELEXEC | EF_ARM_HASENTRY);
 
   if (flags)
-    fprintf (file, _ ("<Unrecognised flag bits set>"));
-  
+    fprintf (file, _("<Unrecognised flag bits set>"));
+
   fputc ('\n', file);
 
   return true;
@@ -2209,7 +2277,7 @@
       if (type != STT_OBJECT)
 	return ELF_ST_TYPE (elf_sym->st_info);
       break;
-      
+
     default:
       break;
     }
@@ -2291,33 +2359,35 @@
   bfd *                         dynobj;
   asection * sgot, *srelgot, *sreloc;
   bfd_vma * local_got_offsets;
-  
+
   if (info->relocateable)
     return true;
-  
+
   sgot = srelgot = sreloc = NULL;
-  
+
   dynobj = elf_hash_table (info)->dynobj;
   local_got_offsets = elf_local_got_offsets (abfd);
 
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
-  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf32_External_Sym);
+  sym_hashes_end = sym_hashes
+    + symtab_hdr->sh_size / sizeof (Elf32_External_Sym);
+
   if (!elf_bad_symtab (abfd))
     sym_hashes_end -= symtab_hdr->sh_info;
-  
+
   rel_end = relocs + sec->reloc_count;
   for (rel = relocs; rel < rel_end; rel++)
     {
       struct elf_link_hash_entry *h;
       unsigned long r_symndx;
-      
+
       r_symndx = ELF32_R_SYM (rel->r_info);
       if (r_symndx < symtab_hdr->sh_info)
         h = NULL;
       else
         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-      
+
       /* Some relocs require a global offset table.  */
       if (dynobj == NULL)
 	{
@@ -2351,7 +2421,7 @@
 	        && (h != NULL || info->shared))
 	      {
 	        srelgot = bfd_get_section_by_name (dynobj, ".rel.got");
-		
+
 	        /* If no got relocation section, make one and initialize.  */
 	        if (srelgot == NULL)
 		  {
@@ -2536,7 +2606,7 @@
           if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
             return false;
           break;
-	  
+
         /* This relocation describes which C++ vtable entries are actually
            used.  Record for later use during GC.  */
         case R_ARM_GNU_VTENTRY:
@@ -2549,10 +2619,9 @@
   return true;
 }
 
-
 /* Find the nearest line to a particular section and offset, for error
    reporting.   This code is a duplicate of the code in elf.c, except
-   that it also accepts STT_ARM_TFUNC as a symbol that names a function. */
+   that it also accepts STT_ARM_TFUNC as a symbol that names a function.  */
 
 static boolean
 elf32_arm_find_nearest_line
@@ -2573,7 +2642,8 @@
 
   if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
 				     filename_ptr, functionname_ptr,
-				     line_ptr, 0))
+				     line_ptr, 0,
+				     &elf_tdata (abfd)->dwarf2_find_line_info))
     return true;
 
   if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
@@ -2713,7 +2783,6 @@
 
       /* We also need to make an entry in the .got.plt section, which
 	 will be placed in the .got section by the linker script.  */
-
       s = bfd_get_section_by_name (dynobj, ".got.plt");
       BFD_ASSERT (s != NULL);
       s->_raw_size += 4;
@@ -2758,7 +2827,6 @@
      determine the address it must put in the global offset table, so
      both the dynamic object and the regular object will refer to the
      same memory location for the variable.  */
-
   s = bfd_get_section_by_name (dynobj, ".dynbss");
   BFD_ASSERT (s != NULL);
 
@@ -2918,7 +2986,7 @@
 		  outname = bfd_get_section_name (output_bfd,
 						  s->output_section);
 		  target = bfd_get_section_by_name (output_bfd, outname + 4);
-		  
+
 		  if (target != NULL
 		      && (target->flags & SEC_READONLY) != 0
 		      && (target->flags & SEC_ALLOC) != 0)
@@ -2971,7 +3039,7 @@
 
       if (plt)
 	{
-	  if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0)
+	  if (   ! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0)
 	      || ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0)
 	      || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_REL)
 	      || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0))
@@ -2980,7 +3048,7 @@
 
       if (relocs)
 	{
-	  if (! bfd_elf32_add_dynamic_entry (info, DT_REL, 0)
+	  if (   ! bfd_elf32_add_dynamic_entry (info, DT_REL, 0)
 	      || ! bfd_elf32_add_dynamic_entry (info, DT_RELSZ, 0)
 	      || ! bfd_elf32_add_dynamic_entry (info, DT_RELENT,
 						sizeof (Elf32_External_Rel)))
@@ -2991,6 +3059,7 @@
 	{
 	  if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
@@ -3109,7 +3178,6 @@
 
       /* This symbol has an entry in the global offset table.  Set it
 	 up.  */
-
       sgot = bfd_get_section_by_name (dynobj, ".got");
       srel = bfd_get_section_by_name (dynobj, ".rel.got");
       BFD_ASSERT (sgot != NULL && srel != NULL);
@@ -3144,7 +3212,6 @@
       Elf_Internal_Rel rel;
 
       /* This symbol needs a copy reloc.  Set it up.  */
-
       BFD_ASSERT (h->dynindx != -1
 		  && (h->root.type == bfd_link_hash_defined
 		      || h->root.type == bfd_link_hash_defweak));
@@ -3198,6 +3265,7 @@
 
       dyncon = (Elf32_External_Dyn *) sdyn->contents;
       dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+
       for (; dyncon < dynconend; dyncon++)
 	{
 	  Elf_Internal_Dyn dyn;
@@ -3288,7 +3356,7 @@
      bfd * abfd;
      struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
 {
-  Elf_Internal_Ehdr * i_ehdrp;	/* Elf file header, internal form */
+  Elf_Internal_Ehdr * i_ehdrp;	/* ELF file header, internal form.  */
 
   i_ehdrp = elf_elfheader (abfd);
 
@@ -3296,12 +3364,10 @@
   i_ehdrp->e_ident[EI_ABIVERSION] = ARM_ELF_ABI_VERSION;
 }
 
-
 #define ELF_ARCH			bfd_arch_arm
 #define ELF_MACHINE_CODE		EM_ARM
 #define ELF_MAXPAGESIZE			0x8000
 
-
 #define bfd_elf32_bfd_copy_private_bfd_data 	elf32_arm_copy_private_bfd_data
 #define bfd_elf32_bfd_merge_private_bfd_data 	elf32_arm_merge_private_bfd_data
 #define bfd_elf32_bfd_set_private_flags		elf32_arm_set_private_flags
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index c64ab28..ab8b572 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -18,7 +18,6 @@
 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"
@@ -47,7 +46,6 @@
 static void bfd_elf_avr_final_write_processing PARAMS ((bfd *, boolean));
 static boolean elf32_avr_object_p PARAMS ((bfd *));
 
-
 /* Use RELA instead of REL */
 #undef USE_REL
 
@@ -369,7 +367,7 @@
 
 static reloc_howto_type *
 bfd_elf32_bfd_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   unsigned int i;
@@ -389,7 +387,7 @@
 
 static void
 avr_info_to_howto_rela (abfd, cache_ptr, dst)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *cache_ptr;
      Elf32_Internal_Rela *dst;
 {
@@ -403,7 +401,7 @@
 static asection *
 elf32_avr_gc_mark_hook (abfd, info, rel, h, sym)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      Elf_Internal_Rela *rel;
      struct elf_link_hash_entry *h;
      Elf_Internal_Sym *sym;
@@ -442,10 +440,10 @@
 
 static boolean
 elf32_avr_gc_sweep_hook (abfd, info, sec, relocs)
-     bfd *abfd;
-     struct bfd_link_info *info;
-     asection *sec;
-     const Elf_Internal_Rela *relocs;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     asection *sec ATTRIBUTE_UNUSED;
+     const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
 {
   /* We don't use got and plt entries for avr.  */
   return true;
@@ -472,7 +470,7 @@
 
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
-  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf32_External_Sym);
+  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym);
   if (!elf_bad_symtab (abfd))
     sym_hashes_end -= symtab_hdr->sh_info;
 
@@ -516,7 +514,7 @@
       srel = (bfd_signed_vma) relocation;
       srel += rel->r_addend;
       srel -= rel->r_offset;
-      srel -= 2;	/* Branch instructions add 2 to the PC... */
+      srel -= 2;	/* Branch instructions add 2 to the PC...  */
       srel -= (input_section->output_section->vma +
 	       input_section->output_offset);
 
@@ -534,7 +532,7 @@
       srel = (bfd_signed_vma) relocation;
       srel += rel->r_addend;
       srel -= rel->r_offset;
-      srel -= 2;	/* Branch instructions add 2 to the PC... */
+      srel -= 2;	/* Branch instructions add 2 to the PC...  */
       srel -= (input_section->output_section->vma +
 	       input_section->output_offset);
 
@@ -548,15 +546,15 @@
       if (srel < -2048 || srel > 2047)
 	{
 	  /* Apply WRAPAROUND if possible.  */
-	  if (bfd_get_mach (input_bfd) == bfd_mach_avr2)
+	  switch (bfd_get_mach (input_bfd))
 	    {
-	      if (srel > 2047)
-		srel -= 4096;
-	      else
-		srel += 4096;
+	    case bfd_mach_avr2:
+	    case bfd_mach_avr4:
+	      break;
+
+	    default:
+	      return bfd_reloc_overflow;
 	    }
-	  else
-	    return bfd_reloc_overflow;
 	}
 
       x = bfd_get_16 (input_bfd, contents);
@@ -717,7 +715,7 @@
 static boolean
 elf32_avr_relocate_section (output_bfd, info, input_bfd, input_section,
 			    contents, relocs, local_syms, local_sections)
-     bfd *output_bfd;
+     bfd *output_bfd ATTRIBUTE_UNUSED;
      struct bfd_link_info *info;
      bfd *input_bfd;
      asection *input_section;
@@ -899,6 +897,9 @@
       val = E_AVR_MACH_AVR4;
       break;
 
+    case bfd_mach_avr5:
+      val = E_AVR_MACH_AVR5;
+      break;
     }
 
   elf_elfheader (abfd)->e_machine = EM_AVR;
@@ -934,13 +935,16 @@
 	case E_AVR_MACH_AVR4:
 	  e_set = bfd_mach_avr4;
 	  break;
+
+	case E_AVR_MACH_AVR5:
+	  e_set = bfd_mach_avr5;
+	  break;
 	}
     }
   return bfd_default_set_arch_mach (abfd, bfd_arch_avr,
 				    e_set);
 }
 
-
 #define ELF_ARCH		bfd_arch_avr
 #define ELF_MACHINE_CODE	EM_AVR
 #define ELF_MAXPAGESIZE		1
@@ -959,5 +963,4 @@
 					bfd_elf_avr_final_write_processing
 #define elf_backend_object_p		elf32_avr_object_p
 
-
 #include "elf32-target.h"
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
new file mode 100644
index 0000000..9f92c73
--- /dev/null
+++ b/bfd/elf32-cris.c
@@ -0,0 +1,712 @@
+/* CRIS-specific support for 32-bit ELF.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Contributed by Axis Communications AB.
+   Written by Hans-Peter Nilsson, based on elf32-fr30.c
+
+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 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 "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf/cris.h"
+
+/* Forward declarations.  */
+static reloc_howto_type * cris_reloc_type_lookup
+  PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
+
+static void cris_info_to_howto_rela
+  PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+
+static boolean cris_elf_relocate_section
+  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+	   Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+
+static bfd_reloc_status_type cris_final_link_relocate
+  PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *,
+	   Elf_Internal_Rela *, bfd_vma));
+
+static boolean cris_elf_gc_sweep_hook
+  PARAMS ((bfd *, struct bfd_link_info *, asection *,
+	   const Elf_Internal_Rela *));
+
+static asection * cris_elf_gc_mark_hook
+  PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
+	   struct elf_link_hash_entry *, Elf_Internal_Sym *));
+
+static boolean cris_elf_object_p PARAMS ((bfd *));
+
+static void cris_elf_final_write_processing PARAMS ((bfd *, boolean));
+
+static boolean cris_elf_print_private_bfd_data PARAMS ((bfd *, PTR));
+
+static boolean cris_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *));
+
+static reloc_howto_type cris_elf_howto_table [] =
+{
+  /* This reloc does nothing.  */
+  HOWTO (R_CRIS_NONE,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_CRIS_NONE",		/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* An 8 bit absolute relocation.  */
+  HOWTO (R_CRIS_8,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_CRIS_8",		/* name */
+	 false,			/* partial_inplace */
+	 0x0000,		/* src_mask */
+	 0x00ff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 16 bit absolute relocation.  */
+  HOWTO (R_CRIS_16,		/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_CRIS_16",		/* name */
+	 false,			/* partial_inplace */
+	 0x00000000,		/* src_mask */
+	 0x0000ffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 32 bit absolute relocation.  */
+  HOWTO (R_CRIS_32,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_CRIS_32",		/* name */
+	 false,			/* partial_inplace */
+	 0x00000000,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* An 8 bit absolute relocation.  */
+  HOWTO (R_CRIS_8_PCREL,	/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_CRIS_8_PCREL",	/* name */
+	 false,			/* partial_inplace */
+	 0x0000,		/* src_mask */
+	 0x00ff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 16 bit absolute relocation.  */
+  HOWTO (R_CRIS_16_PCREL,	/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_CRIS_16",		/* name */
+	 false,			/* partial_inplace */
+	 0x00000000,		/* src_mask */
+	 0x0000ffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 32 bit absolute relocation.  */
+  HOWTO (R_CRIS_32_PCREL,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_CRIS_32",		/* name */
+	 false,			/* partial_inplace */
+	 0x00000000,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* GNU extension to record C++ vtable hierarchy */
+  HOWTO (R_CRIS_GNU_VTINHERIT, /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 NULL,			/* special_function */
+	 "R_CRIS_GNU_VTINHERIT", /* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* GNU extension to record C++ vtable member usage */
+  HOWTO (R_CRIS_GNU_VTENTRY,	 /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 _bfd_elf_rel_vtable_reloc_fn,	/* special_function */
+	 "R_CRIS_GNU_VTENTRY",	 /* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false)			/* pcrel_offset */
+};
+
+/* Map BFD reloc types to CRIS ELF reloc types.  */
+
+struct cris_reloc_map
+{
+  bfd_reloc_code_real_type bfd_reloc_val;
+  unsigned int cris_reloc_val;
+};
+
+static const struct cris_reloc_map cris_reloc_map [] =
+{
+  { BFD_RELOC_NONE,		R_CRIS_NONE },
+  { BFD_RELOC_8,		R_CRIS_8 },
+  { BFD_RELOC_16,		R_CRIS_16 },
+  { BFD_RELOC_32,		R_CRIS_32 },
+  { BFD_RELOC_8_PCREL,		R_CRIS_8_PCREL },
+  { BFD_RELOC_16_PCREL,		R_CRIS_16_PCREL },
+  { BFD_RELOC_32_PCREL,		R_CRIS_32_PCREL },
+  { BFD_RELOC_VTABLE_INHERIT,	R_CRIS_GNU_VTINHERIT },
+  { BFD_RELOC_VTABLE_ENTRY,	R_CRIS_GNU_VTENTRY }
+};
+
+static reloc_howto_type *
+cris_reloc_type_lookup (abfd, code)
+     bfd * abfd ATTRIBUTE_UNUSED;
+     bfd_reloc_code_real_type code;
+{
+  unsigned int i;
+
+  for (i = sizeof (cris_reloc_map) / sizeof (cris_reloc_map[0]);
+       --i;)
+    if (cris_reloc_map [i].bfd_reloc_val == code)
+      return & cris_elf_howto_table [cris_reloc_map[i].cris_reloc_val];
+
+  return NULL;
+}
+
+/* Set the howto pointer for an CRIS ELF reloc.  */
+
+static void
+cris_info_to_howto_rela (abfd, cache_ptr, dst)
+     bfd * abfd ATTRIBUTE_UNUSED;
+     arelent * cache_ptr;
+     Elf32_Internal_Rela * dst;
+{
+  unsigned int r_type;
+
+  r_type = ELF32_R_TYPE (dst->r_info);
+  BFD_ASSERT (r_type < (unsigned int) R_CRIS_max);
+  cache_ptr->howto = & cris_elf_howto_table [r_type];
+}
+
+/* Perform a single relocation.  By default we use the standard BFD
+   routines, but we might have to do a few relocs ourselves in the future.  */
+
+static bfd_reloc_status_type
+cris_final_link_relocate (howto, input_bfd, input_section, contents, rel,
+			  relocation)
+     reloc_howto_type *  howto;
+     bfd *               input_bfd;
+     asection *          input_section;
+     bfd_byte *          contents;
+     Elf_Internal_Rela * rel;
+     bfd_vma             relocation;
+{
+  bfd_reloc_status_type r
+    = _bfd_final_link_relocate (howto, input_bfd, input_section,
+				contents, rel->r_offset,
+				relocation, rel->r_addend);
+  return r;
+}
+
+/* Relocate an CRIS ELF section.  See elf32-fr30.c, from where this was
+   copied, for further comments.  */
+
+static boolean
+cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
+			   contents, relocs, local_syms, local_sections)
+     bfd *                   output_bfd ATTRIBUTE_UNUSED;
+     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;
+  struct elf_link_hash_entry ** sym_hashes;
+  Elf_Internal_Rela *           rel;
+  Elf_Internal_Rela *           relend;
+
+  symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (input_bfd);
+  relend     = relocs + input_section->reloc_count;
+
+  /* It seems this can happen with erroneous or unsupported input (mixing
+     a.out and elf in an archive, for example.)  */
+  if (sym_hashes == NULL)
+    return false;
+
+  for (rel = relocs; rel < relend; rel ++)
+    {
+      reloc_howto_type *           howto;
+      unsigned long                r_symndx;
+      Elf_Internal_Sym *           sym;
+      asection *                   sec;
+      struct elf_link_hash_entry * h;
+      bfd_vma                      relocation;
+      bfd_reloc_status_type        r;
+      const char *                 name = NULL;
+      int                          r_type;
+
+      r_type = ELF32_R_TYPE (rel->r_info);
+
+      if (   r_type == R_CRIS_GNU_VTINHERIT
+	  || r_type == R_CRIS_GNU_VTENTRY)
+	continue;
+
+      r_symndx = ELF32_R_SYM (rel->r_info);
+
+      if (info->relocateable)
+	{
+	  /* This is a relocateable link.  We don't have to change
+             anything, unless the reloc is against a section symbol,
+             in which case we have to adjust according to where the
+             section symbol winds up in the output section.  */
+	  if (r_symndx < symtab_hdr->sh_info)
+	    {
+	      sym = local_syms + r_symndx;
+
+	      if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+		{
+		  sec = local_sections [r_symndx];
+		  rel->r_addend += sec->output_offset + sym->st_value;
+		}
+	    }
+
+	  continue;
+	}
+
+      /* This is a final link.  */
+      howto  = cris_elf_howto_table + ELF32_R_TYPE (rel->r_info);
+      h      = NULL;
+      sym    = NULL;
+      sec    = NULL;
+
+      if (r_symndx < symtab_hdr->sh_info)
+	{
+	  sym = local_syms + r_symndx;
+	  sec = local_sections [r_symndx];
+	  relocation = (sec->output_section->vma
+			+ sec->output_offset
+			+ sym->st_value);
+
+	  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;
+#if 0
+	  fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n",
+		   sec->name, name, sym->st_name,
+		   sec->output_section->vma, sec->output_offset,
+		   sym->st_value, rel->r_addend);
+#endif
+	}
+      else
+	{
+	  h = sym_hashes [r_symndx - symtab_hdr->sh_info];
+
+	  while (h->root.type == bfd_link_hash_indirect
+		 || h->root.type == bfd_link_hash_warning)
+	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  name = h->root.root.string;
+
+	  if (h->root.type == bfd_link_hash_defined
+	      || h->root.type == bfd_link_hash_defweak)
+	    {
+	      sec = h->root.u.def.section;
+	      relocation = (h->root.u.def.value
+			    + sec->output_section->vma
+			    + sec->output_offset);
+#if 0
+	      fprintf (stderr,
+		       "defined: sec: %s, name: %s, value: %x + %x + %x gives: %x\n",
+		       sec->name, name, h->root.u.def.value,
+		       sec->output_section->vma, sec->output_offset, relocation);
+#endif
+	    }
+	  else if (h->root.type == bfd_link_hash_undefweak)
+	    {
+#if 0
+	      fprintf (stderr, "undefined: sec: %s, name: %s\n",
+		       sec->name, name);
+#endif
+	      relocation = 0;
+	    }
+	  else if (info->shared
+		   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
+	    relocation = 0;
+	  else
+	    {
+	      if (! ((*info->callbacks->undefined_symbol)
+		     (info, h->root.root.string, input_bfd,
+		      input_section, rel->r_offset, true)))
+		return false;
+#if 0
+	      fprintf (stderr, "unknown: name: %s\n", name);
+#endif
+	      relocation = 0;
+	    }
+	}
+
+      r = cris_final_link_relocate (howto, input_bfd, input_section,
+				     contents, rel, relocation);
+
+      if (r != bfd_reloc_ok)
+	{
+	  const char * msg = (const char *) NULL;
+
+	  switch (r)
+	    {
+	    case bfd_reloc_overflow:
+	      r = info->callbacks->reloc_overflow
+		(info, name, howto->name, (bfd_vma) 0,
+		 input_bfd, input_section, rel->r_offset);
+	      break;
+
+	    case bfd_reloc_undefined:
+	      r = info->callbacks->undefined_symbol
+		(info, name, input_bfd, input_section, rel->r_offset,
+		 true);
+	      break;
+
+	    case bfd_reloc_outofrange:
+	      msg = _("internal error: out of range error");
+	      break;
+
+	    case bfd_reloc_notsupported:
+	      msg = _("internal error: unsupported relocation error");
+	      break;
+
+	    case bfd_reloc_dangerous:
+	      msg = _("internal error: dangerous relocation");
+	      break;
+
+	    default:
+	      msg = _("internal error: unknown error");
+	      break;
+	    }
+
+	  if (msg)
+	    r = info->callbacks->warning
+	      (info, msg, name, input_bfd, input_section, rel->r_offset);
+
+	  if (! r)
+	    return false;
+	}
+    }
+
+  return true;
+}
+
+/* Return the section that should be marked against GC for a given
+   relocation.  */
+
+static asection *
+cris_elf_gc_mark_hook (abfd, info, rel, h, sym)
+     bfd *                        abfd;
+     struct bfd_link_info *       info ATTRIBUTE_UNUSED;
+     Elf_Internal_Rela *          rel;
+     struct elf_link_hash_entry * h;
+     Elf_Internal_Sym *           sym;
+{
+  if (h != NULL)
+    {
+      switch (ELF32_R_TYPE (rel->r_info))
+	{
+	case R_CRIS_GNU_VTINHERIT:
+	case R_CRIS_GNU_VTENTRY:
+	  break;
+
+	default:
+	  switch (h->root.type)
+	    {
+	    case bfd_link_hash_defined:
+	    case bfd_link_hash_defweak:
+	      return h->root.u.def.section;
+
+	    case bfd_link_hash_common:
+	      return h->root.u.c.p->section;
+
+	    default:
+	      break;
+	    }
+	}
+    }
+  else
+    {
+      if (!(elf_bad_symtab (abfd)
+	    && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
+	  && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
+		&& sym->st_shndx != SHN_COMMON))
+	{
+	  return bfd_section_from_elf_index (abfd, sym->st_shndx);
+	}
+    }
+
+  return NULL;
+}
+
+/* Update the got entry reference counts for the section being removed.  */
+
+static boolean
+cris_elf_gc_sweep_hook (abfd, info, sec, relocs)
+     bfd *                     abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *    info ATTRIBUTE_UNUSED;
+     asection *                sec ATTRIBUTE_UNUSED;
+     const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED;
+{
+  return true;
+}
+
+/* Look through the relocs for a section during the first phase.
+   Since we don't do .gots or .plts, we just need to consider the
+   virtual table relocs for gc.  */
+
+static boolean
+cris_elf_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, **sym_hashes_end;
+  const Elf_Internal_Rela *rel;
+  const Elf_Internal_Rela *rel_end;
+
+  if (info->relocateable)
+    return true;
+
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (abfd);
+  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym);
+  if (!elf_bad_symtab (abfd))
+    sym_hashes_end -= symtab_hdr->sh_info;
+
+  rel_end = relocs + sec->reloc_count;
+  for (rel = relocs; rel < rel_end; rel++)
+    {
+      struct elf_link_hash_entry *h;
+      unsigned long r_symndx;
+
+      r_symndx = ELF32_R_SYM (rel->r_info);
+      if (r_symndx < symtab_hdr->sh_info)
+        h = NULL;
+      else
+        h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+
+      switch (ELF32_R_TYPE (rel->r_info))
+        {
+        /* This relocation describes the C++ object vtable hierarchy.
+           Reconstruct it for later use during GC.  */
+        case R_CRIS_GNU_VTINHERIT:
+          if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+            return false;
+          break;
+
+        /* This relocation describes which C++ vtable entries are actually
+           used.  Record for later use during GC.  */
+        case R_CRIS_GNU_VTENTRY:
+          if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+            return false;
+          break;
+        }
+    }
+
+  return true;
+}
+
+/* Reject a file depending on underscores on symbols.  */
+
+static boolean
+cris_elf_object_p (abfd)
+     bfd *abfd;
+{
+  if ((elf_elfheader (abfd)->e_flags & EF_CRIS_UNDERSCORE))
+    return (bfd_get_symbol_leading_char (abfd) == '_');
+  else
+    return (bfd_get_symbol_leading_char (abfd) == 0);
+}
+
+/* Mark presence or absence of leading underscore.  */
+
+static void
+cris_elf_final_write_processing (abfd, linker)
+     bfd *abfd;
+     boolean linker ATTRIBUTE_UNUSED;
+{
+  if (bfd_get_symbol_leading_char (abfd) == '_')
+    elf_elfheader (abfd)->e_flags |= EF_CRIS_UNDERSCORE;
+  else
+    elf_elfheader (abfd)->e_flags &= ~EF_CRIS_UNDERSCORE;
+}
+
+/* Display the flags field.  */
+
+static boolean
+cris_elf_print_private_bfd_data (abfd, ptr)
+     bfd *abfd;
+     PTR ptr;
+{
+  FILE *file = (FILE *) ptr;
+
+  BFD_ASSERT (abfd != NULL && ptr != NULL)
+
+  _bfd_elf_print_private_bfd_data (abfd, ptr);
+
+  fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags);
+
+  if (elf_elfheader (abfd)->e_flags & EF_CRIS_UNDERSCORE)
+    fprintf (file, _(" [symbols have a _ prefix]"));
+
+  fputc ('\n', file);
+  return true;
+}
+
+/* Don't mix files with and without a leading underscore.  */
+
+static boolean
+cris_elf_merge_private_bfd_data (ibfd, obfd)
+     bfd *ibfd;
+     bfd *obfd;
+{
+  flagword old_flags, new_flags;
+
+  if (_bfd_generic_verify_endian_match (ibfd, obfd) == false)
+    return false;
+
+  if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
+      || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
+    return true;
+
+  if (! elf_flags_init (obfd))
+    {
+      /* This happens when ld starts out with a 'blank' output file.  */
+      elf_flags_init (obfd) = true;
+
+      /* Set flags according to current bfd_target.  */
+      cris_elf_final_write_processing (obfd, false);
+    }
+
+  old_flags = elf_elfheader (obfd)->e_flags;
+  new_flags = elf_elfheader (ibfd)->e_flags;
+
+  /* Is this good or bad?  We'll follow with other excluding flags.  */
+  if ((old_flags & EF_CRIS_UNDERSCORE) != (new_flags & EF_CRIS_UNDERSCORE))
+    {
+      (*_bfd_error_handler)
+	((new_flags & EF_CRIS_UNDERSCORE)
+	 ? _("%s: uses _-prefixed symbols, but writing file with non-prefixed symbols")
+	 : _("%s: uses non-prefixed symbols, but writing file with _-prefixed symbols"),
+	 bfd_get_filename (ibfd));
+      bfd_set_error (bfd_error_bad_value);
+      return false;
+    }
+
+  return true;
+}
+
+#define ELF_ARCH		bfd_arch_cris
+#define ELF_MACHINE_CODE	EM_CRIS
+#define ELF_MAXPAGESIZE		0x2000
+
+#define TARGET_LITTLE_SYM	bfd_elf32_cris_vec
+#define TARGET_LITTLE_NAME	"elf32-cris"
+#define elf_symbol_leading_char 0
+
+#define elf_info_to_howto_rel			NULL
+#define elf_info_to_howto			cris_info_to_howto_rela
+#define elf_backend_relocate_section		cris_elf_relocate_section
+#define elf_backend_gc_mark_hook		cris_elf_gc_mark_hook
+#define elf_backend_gc_sweep_hook		cris_elf_gc_sweep_hook
+#define elf_backend_check_relocs                cris_elf_check_relocs
+
+#define elf_backend_can_gc_sections		1
+
+#define elf_backend_object_p			cris_elf_object_p
+#define elf_backend_final_write_processing \
+	cris_elf_final_write_processing
+#define bfd_elf32_bfd_print_private_bfd_data \
+	cris_elf_print_private_bfd_data
+#define bfd_elf32_bfd_merge_private_bfd_data \
+	cris_elf_merge_private_bfd_data
+
+#define bfd_elf32_bfd_reloc_type_lookup		cris_reloc_type_lookup
+
+/* Later, we my want to optimize RELA entries into REL entries for dynamic
+   linking and libraries (if it's a win of any significance).  Until then,
+   take the easy route.  */
+#define elf_backend_may_use_rel_p 0
+#define elf_backend_may_use_rela_p 1
+
+#include "elf32-target.h"
+
+#define INCLUDED_TARGET_FILE
+
+#undef TARGET_LITTLE_SYM
+#undef TARGET_LITTLE_NAME
+#undef elf_symbol_leading_char
+
+#define TARGET_LITTLE_SYM bfd_elf32_us_cris_vec
+#define TARGET_LITTLE_NAME "elf32-us-cris"
+#define elf_symbol_leading_char '_'
+
+#include "elf32-target.h"
diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c
index dd2e892..a4075a5 100644
--- a/bfd/elf32-d10v.c
+++ b/bfd/elf32-d10v.c
@@ -1,5 +1,5 @@
 /* D10V-specific support for 32-bit ELF
-   Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
    Contributed by Martin Hunt (hunt@cygnus.com).
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -22,31 +22,16 @@
 #include "sysdep.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
-/* #include "elf/d10v.h" */
+#include "elf/d10v.h"
 
 static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
   PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
 static void d10v_info_to_howto_rel
   PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
 
-
 /* Use REL instead of RELA to save space */
 #define USE_REL
 
-enum reloc_type
-{
-  R_D10V_NONE = 0,
-  R_D10V_10_PCREL_R,
-  R_D10V_10_PCREL_L,
-  R_D10V_16,
-  R_D10V_18,
-  R_D10V_18_PCREL,
-  R_D10V_32,
-  R_D10V_GNU_VTINHERIT,
-  R_D10V_GNU_VTENTRY,
-  R_D10V_max
-};
-
 static reloc_howto_type elf_d10v_howto_table[] =
 {
   /* This reloc does nothing.  */
@@ -185,7 +170,7 @@
          0,                     /* src_mask */
          0,                     /* dst_mask */
          false),                /* pcrel_offset */
- 
+
 };
 
 /* Map BFD reloc types to D10V ELF reloc types.  */
@@ -300,7 +285,7 @@
 /* Look through the relocs for a section during the first phase.
    Since we don't do .gots or .plts, we just need to consider the
    virtual table relocs for gc.  */
- 
+
 static boolean
 elf32_d10v_check_relocs (abfd, info, sec, relocs)
      bfd *abfd;
@@ -312,28 +297,28 @@
   struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
   const Elf_Internal_Rela *rel;
   const Elf_Internal_Rela *rel_end;
- 
+
   if (info->relocateable)
     return true;
- 
+
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
-  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf32_External_Sym);
+  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym);
   if (!elf_bad_symtab (abfd))
     sym_hashes_end -= symtab_hdr->sh_info;
- 
+
   rel_end = relocs + sec->reloc_count;
   for (rel = relocs; rel < rel_end; rel++)
     {
       struct elf_link_hash_entry *h;
       unsigned long r_symndx;
- 
+
       r_symndx = ELF32_R_SYM (rel->r_info);
       if (r_symndx < symtab_hdr->sh_info)
         h = NULL;
       else
         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- 
+
       switch (ELF32_R_TYPE (rel->r_info))
         {
         /* This relocation describes the C++ object vtable hierarchy.
@@ -342,7 +327,7 @@
           if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
             return false;
           break;
- 
+
         /* This relocation describes which C++ vtable entries are actually
            used.  Record for later use during GC.  */
         case R_D10V_GNU_VTENTRY:
@@ -351,7 +336,7 @@
           break;
         }
     }
- 
+
   return true;
 }
 
@@ -464,7 +449,7 @@
 	  if (name == NULL || *name == '\0')
 	    name = bfd_section_name (input_bfd, sec);
 	}
-      
+
       r = _bfd_final_link_relocate (howto, input_bfd, input_section,
                                     contents, rel->r_offset,
                                     relocation, rel->r_addend);
diff --git a/bfd/elf32-d30v.c b/bfd/elf32-d30v.c
index 52bafb9..43fc9b6 100644
--- a/bfd/elf32-d30v.c
+++ b/bfd/elf32-d30v.c
@@ -22,6 +22,7 @@
 #include "sysdep.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
+#include "elf/d30v.h"
 
 static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
   PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
@@ -46,24 +47,6 @@
      bfd *output_bfd,
      char **error_message));
 
-enum reloc_type
-{
-  R_D30V_NONE = 0,
-  R_D30V_6,
-  R_D30V_9_PCREL,
-  R_D30V_9_PCREL_R,
-  R_D30V_15,
-  R_D30V_15_PCREL,
-  R_D30V_15_PCREL_R,
-  R_D30V_21,
-  R_D30V_21_PCREL,
-  R_D30V_21_PCREL_R,
-  R_D30V_32,
-  R_D30V_32_PCREL,
-  R_D30V_32_NORMAL,
-  R_D30V_max
-};
-
 static reloc_howto_type elf_d30v_howto_table[] =
 {
   /* This reloc does nothing.  */
@@ -297,7 +280,7 @@
   r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
                              input_section, output_bfd, error_message);
   if (r != bfd_reloc_continue)
-    return r; 
+    return r;
 
   /* a hacked-up version of bfd_perform_reloc() follows */
  if (bfd_is_und_section (symbol->section)
@@ -332,11 +315,11 @@
 
   if (howto->pc_relative == true)
     {
-      tmp_addr = input_section->output_section->vma + input_section->output_offset 
+      tmp_addr = input_section->output_section->vma + input_section->output_offset
 	+ reloc_entry->address;
       relocation -= tmp_addr;
     }
-  
+
   in1 = bfd_get_32 (abfd, (bfd_byte *) data + addr);
   in2 = bfd_get_32 (abfd, (bfd_byte *) data + addr + 4);
 
@@ -346,7 +329,7 @@
 	 | ((in1 & 0x3F) << 26));
   in1 &= 0xFFFFFFC0;
   in2 = 0x80000000;
-  
+
   relocation += num;
 
   if (howto->pc_relative == true && howto->bitsize == 32)
@@ -360,11 +343,11 @@
 	  make_absolute = 1;
 	}
     }
-  
+
   in1 |= (relocation >> 26) & 0x3F;	/* top 6 bits */
-  in2 |= ((relocation & 0x03FC0000) << 2);  /* next 8 bits */ 
+  in2 |= ((relocation & 0x03FC0000) << 2);  /* next 8 bits */
   in2 |= relocation & 0x0003FFFF;		/* bottom 18 bits */
-  
+
   /* change a PC-relative instruction to its absolute equivalent */
   /* with this simple hack */
   if (make_absolute)
@@ -372,10 +355,9 @@
 
   bfd_put_32 (abfd, in1, (bfd_byte *) data + addr);
   bfd_put_32 (abfd, in2, (bfd_byte *) data + addr + 4);
-  
-  return flag;
-}   
 
+  return flag;
+}
 
 static bfd_reloc_status_type
 bfd_elf_d30v_reloc_21 (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message)
@@ -403,11 +385,11 @@
       reloc_entry->address += input_section->output_offset;
       return bfd_reloc_ok;
     }
-  
+
   r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
                              input_section, output_bfd, error_message);
   if (r != bfd_reloc_continue)
-    return r; 
+    return r;
 
   /* a hacked-up version of bfd_perform_reloc() follows */
  if (bfd_is_und_section (symbol->section)
@@ -479,16 +461,16 @@
       if ((int)relocation > max)
 	flag = bfd_reloc_overflow;
     }
-  relocation >>= 3; 
+  relocation >>= 3;
   if (howto->bitsize == 6)
     in1 |= ((relocation & (mask >> 12)) << 12);
   else
     in1 |= relocation & mask;
 
   bfd_put_32 (abfd, in1, (bfd_byte *) data + addr);
-  
+
   return flag;
-}   
+}
 
 /* Map BFD reloc types to D30V ELF reloc types.  */
 
@@ -498,7 +480,6 @@
   unsigned char elf_reloc_val;
 };
 
-
 static const struct d30v_reloc_map d30v_reloc_map[] =
 {
   { BFD_RELOC_NONE, R_D30V_NONE, },
diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c
index b150ec9..526212b 100644
--- a/bfd/elf32-fr30.c
+++ b/bfd/elf32-fr30.c
@@ -30,9 +30,9 @@
   PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
 static reloc_howto_type * fr30_reloc_type_lookup
   PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
-static void fr30_info_to_howto_rela 
+static void fr30_info_to_howto_rela
   PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
-static boolean fr30_elf_relocate_section 
+static boolean fr30_elf_relocate_section
   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
 static bfd_reloc_status_type fr30_final_link_relocate
   PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, bfd_vma));
@@ -132,7 +132,7 @@
 	 0x0000,		/* src_mask */
 	 0x00f0,		/* dst_mask */
 	 false),		/* pcrel_offset */
-  
+
   /* An 8 bit absolute relocation.  */
   HOWTO (R_FR30_8_IN_8,		/* type */
 	 0,			/* rightshift */
@@ -147,7 +147,7 @@
 	 0x0000,		/* src_mask */
 	 0x0ff0,		/* dst_mask */
 	 false),		/* pcrel_offset */
-  
+
   /* A 9 bit absolute relocation.  */
   HOWTO (R_FR30_9_IN_8,		/* type */
 	 1,			/* rightshift */
@@ -162,7 +162,7 @@
 	 0x0000,		/* src_mask */
 	 0x0ff0,		/* dst_mask */
 	 false),		/* pcrel_offset */
-  
+
   /* A 10 bit absolute relocation.  */
   HOWTO (R_FR30_10_IN_8,	/* type */
 	 2,			/* rightshift */
@@ -236,7 +236,7 @@
          0,                     /* src_mask */
          0,                     /* dst_mask */
          false),                /* pcrel_offset */
- 
+
 };
 
 /* Utility to actually perform an R_FR30_20 reloc.  */
@@ -254,7 +254,7 @@
 {
   bfd_vma       relocation;
   unsigned long x;
-  
+
   /* This part is from bfd_elf_generic_reloc.  */
   if (output_bfd != (bfd *) NULL
       && (symbol->flags & BSF_SECTION_SYM) == 0
@@ -278,9 +278,9 @@
   if (relocation > (((bfd_vma) 1 << 20) - 1))
     return bfd_reloc_overflow;
 
-  x = bfd_get_32 (abfd, data + reloc_entry->address);
+  x = bfd_get_32 (abfd, (char *) data + reloc_entry->address);
   x = (x & 0xff0f0000) | (relocation & 0x0000ffff) | ((relocation & 0x000f0000) << 4);
-  bfd_put_32 (abfd, x, data + reloc_entry->address);
+  bfd_put_32 (abfd, x, (char *) data + reloc_entry->address);
 
   return bfd_reloc_ok;
 }
@@ -321,7 +321,7 @@
     + symbol->section->output_offset
     + reloc_entry->addend;
 
-  bfd_put_32 (abfd, relocation, data + reloc_entry->address + 2);
+  bfd_put_32 (abfd, relocation, (char *) data + reloc_entry->address + 2);
 
   return bfd_reloc_ok;
 }
@@ -362,7 +362,7 @@
        --i;)
     if (fr30_reloc_map [i].bfd_reloc_val == code)
       return & fr30_elf_howto_table [fr30_reloc_map[i].fr30_reloc_val];
-  
+
   return NULL;
 }
 
@@ -396,7 +396,7 @@
   bfd_reloc_status_type r = bfd_reloc_ok;
   bfd_vma               x;
   bfd_signed_vma	srel;
-  
+
   switch (howto->type)
     {
     case R_FR30_20:
@@ -405,12 +405,12 @@
 
       if (relocation > ((1 << 20) - 1))
 	return bfd_reloc_overflow;
-      
+
       x = bfd_get_32 (input_bfd, contents);
       x = (x & 0xff0f0000) | (relocation & 0x0000ffff) | ((relocation & 0x000f0000) << 4);
       bfd_put_32 (input_bfd, x, contents);
       break;
-      
+
     case R_FR30_48:
       contents   += rel->r_offset + 2;
       relocation += rel->r_addend;
@@ -422,10 +422,10 @@
       srel = (bfd_signed_vma) relocation;
       srel += rel->r_addend;
       srel -= rel->r_offset;
-      srel -= 2;  /* Branch instructions add 2 to the PC... */
+      srel -= 2;  /* Branch instructions add 2 to the PC...  */
       srel -= (input_section->output_section->vma +
 		     input_section->output_offset);
-      
+
       if (srel & 1)
 	return bfd_reloc_outofrange;
       if (srel > ((1 << 8) - 1) || (srel < - (1 << 8)))
@@ -439,15 +439,15 @@
       srel = (bfd_signed_vma) relocation;
       srel += rel->r_addend;
       srel -= rel->r_offset;
-      srel -= 2; /* Branch instructions add 2 to the PC... */
+      srel -= 2; /* Branch instructions add 2 to the PC...  */
       srel -= (input_section->output_section->vma +
 		     input_section->output_offset);
-      
+
       if (srel & 1)
 	return bfd_reloc_outofrange;
       if (srel > ((1 << 11) - 1) || (srel < - (1 << 11)))
 	  return bfd_reloc_overflow;
-      
+
       x = bfd_get_16 (input_bfd, contents);
       x = (x & 0xf800) | ((srel >> 1) & 0x7ff);
       bfd_put_16 (input_bfd, x, contents);
@@ -528,13 +528,13 @@
       bfd_reloc_status_type        r;
       const char *                 name = NULL;
       int                          r_type;
-      
+
       r_type = ELF32_R_TYPE (rel->r_info);
-      
+
       if (   r_type == R_FR30_GNU_VTINHERIT
 	  || r_type == R_FR30_GNU_VTENTRY)
 	continue;
-      
+
       r_symndx = ELF32_R_SYM (rel->r_info);
 
       if (info->relocateable)
@@ -546,7 +546,7 @@
 	  if (r_symndx < symtab_hdr->sh_info)
 	    {
 	      sym = local_syms + r_symndx;
-	      
+
 	      if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
 		{
 		  sec = local_sections [r_symndx];
@@ -562,7 +562,7 @@
       h      = NULL;
       sym    = NULL;
       sec    = NULL;
-      
+
       if (r_symndx < symtab_hdr->sh_info)
 	{
 	  sym = local_syms + r_symndx;
@@ -570,7 +570,7 @@
 	  relocation = (sec->output_section->vma
 			+ sec->output_offset
 			+ sym->st_value);
-	  
+
 	  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;
@@ -584,13 +584,13 @@
       else
 	{
 	  h = sym_hashes [r_symndx - symtab_hdr->sh_info];
-	  
+
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 	  name = h->root.root.string;
-	  
+
 	  if (h->root.type == bfd_link_hash_defined
 	      || h->root.type == bfd_link_hash_defweak)
 	    {
@@ -625,7 +625,7 @@
 	      relocation = 0;
 	    }
 	}
-      
+
       r = fr30_final_link_relocate (howto, input_bfd, input_section,
 				     contents, rel, relocation);
 
@@ -640,13 +640,13 @@
 		(info, name, howto->name, (bfd_vma) 0,
 		 input_bfd, input_section, rel->r_offset);
 	      break;
-	      
+
 	    case bfd_reloc_undefined:
 	      r = info->callbacks->undefined_symbol
 		(info, name, input_bfd, input_section, rel->r_offset,
 		 true);
 	      break;
-	      
+
 	    case bfd_reloc_outofrange:
 	      msg = _("internal error: out of range error");
 	      break;
@@ -739,7 +739,7 @@
 /* Look through the relocs for a section during the first phase.
    Since we don't do .gots or .plts, we just need to consider the
    virtual table relocs for gc.  */
- 
+
 static boolean
 fr30_elf_check_relocs (abfd, info, sec, relocs)
      bfd *abfd;
@@ -751,28 +751,28 @@
   struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
   const Elf_Internal_Rela *rel;
   const Elf_Internal_Rela *rel_end;
- 
+
   if (info->relocateable)
     return true;
- 
+
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
-  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf32_External_Sym);
+  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym);
   if (!elf_bad_symtab (abfd))
     sym_hashes_end -= symtab_hdr->sh_info;
- 
+
   rel_end = relocs + sec->reloc_count;
   for (rel = relocs; rel < rel_end; rel++)
     {
       struct elf_link_hash_entry *h;
       unsigned long r_symndx;
- 
+
       r_symndx = ELF32_R_SYM (rel->r_info);
       if (r_symndx < symtab_hdr->sh_info)
         h = NULL;
       else
         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- 
+
       switch (ELF32_R_TYPE (rel->r_info))
         {
         /* This relocation describes the C++ object vtable hierarchy.
@@ -781,7 +781,7 @@
           if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
             return false;
           break;
- 
+
         /* This relocation describes which C++ vtable entries are actually
            used.  Record for later use during GC.  */
         case R_FR30_GNU_VTENTRY:
@@ -790,7 +790,7 @@
           break;
         }
     }
- 
+
   return true;
 }
 
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 1fdd4ab..3d0c9ee 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -2,11 +2,11 @@
    Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
-   Written by
-
+   Original code by
 	Center for Software Science
 	Department of Computer Science
 	University of Utah
+   Largely rewritten by Alan Modra <alan@linuxcare.com.au>
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -33,10 +33,20 @@
 #include "elf32-hppa.h"
 #define ARCH_SIZE		32
 #include "elf-hppa.h"
+#include "elf32-hppa.h"
 
+/* In order to gain some understanding of code in this file without
+   knowing all the intricate details of the linker, note the
+   following:
 
-/* We use three different hash tables to hold information for
-   linking PA ELF objects.
+   Functions named elf32_hppa_* are called by external routines, other
+   functions are only called locally.  elf32_hppa_* functions appear
+   in this file more or less in the order in which they are called
+   from external routines.  eg. elf32_hppa_check_relocs is called
+   early in the link process, elf32_hppa_finish_dynamic_sections is
+   one of the last functions.  */
+
+/* We use two hash tables to hold information for linking PA ELF objects.
 
    The first is the elf32_hppa_link_hash_table which is derived
    from the standard ELF linker hash table.  We use this as a place to
@@ -44,149 +54,346 @@
 
    The second is the stub hash table which is derived from the
    base BFD hash table.  The stub hash table holds the information
-   necessary to build the linker stubs during a link.  */
+   necessary to build the linker stubs during a link.
 
-/* Hash table for linker stubs.  */
+   There are a number of different stubs generated by the linker.
 
-struct elf32_hppa_stub_hash_entry
+   Long branch stub:
+   :		ldil LR'X,%r1
+   :		be,n RR'X(%sr4,%r1)
+
+   PIC long branch stub:
+   :		b,l .+8,%r1
+   :		addil L'X - ($PIC_pcrel$0 - 4),%r1
+   :		be,n R'X - ($PIC_pcrel$0 - 8)(%sr4,%r1)
+
+   Import stub to call shared library routine from normal object file
+   (single sub-space version)
+   :		addil L'lt_ptr+ltoff,%dp	; get procedure entry point
+   :		ldw R'lt_ptr+ltoff(%r1),%r21
+   :            bv %r0(%r21)
+   :		ldw R'lt_ptr+ltoff+4(%r1),%r19	; get new dlt value.
+
+   Import stub to call shared library routine from shared library
+   (single sub-space version)
+   :		addil L'ltoff,%r19		; get procedure entry point
+   :		ldw R'ltoff(%r1),%r21
+   :            bv %r0(%r21)
+   :		ldw R'ltoff+4(%r1),%r19		; get new dlt value.
+
+   Import stub to call shared library routine from normal object file
+   (multiple sub-space support)
+   :		addil L'lt_ptr+ltoff,%dp	; get procedure entry point
+   :		ldw R'lt_ptr+ltoff(%r1),%r21
+   :		ldw R'lt_ptr+ltoff+4(%r1),%r19	; get new dlt value.
+   :		ldsid (%r21),%r1
+   :		mtsp %r1,%sr0
+   :		be 0(%sr0,%r21)			; branch to target
+   :		stw %rp,-24(%sp)		; save rp
+
+   Import stub to call shared library routine from shared library
+   (multiple sub-space support)
+   :		addil L'ltoff,%r19		; get procedure entry point
+   :		ldw R'ltoff(%r1),%r21
+   :		ldw R'ltoff+4(%r1),%r19		; get new dlt value.
+   :		ldsid (%r21),%r1
+   :		mtsp %r1,%sr0
+   :		be 0(%sr0,%r21)			; branch to target
+   :		stw %rp,-24(%sp)		; save rp
+
+   Export stub to return from shared lib routine (multiple sub-space support)
+   One of these is created for each exported procedure in a shared
+   library (and stored in the shared lib).  Shared lib routines are
+   called via the first instruction in the export stub so that we can
+   do an inter-space return.  Not required for single sub-space.
+   :		bl,n X,%rp			; trap the return
+   :		nop
+   :		ldw -24(%sp),%rp		; restore the original rp
+   :		ldsid (%rp),%r1
+   :		mtsp %r1,%sr0
+   :		be,n 0(%sr0,%rp)		; inter-space return  */
+
+#define PLT_ENTRY_SIZE 8
+#define PLABEL_PLT_ENTRY_SIZE PLT_ENTRY_SIZE
+#define GOT_ENTRY_SIZE 4
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
+
+static const bfd_byte plt_stub[] =
 {
-  /* Base hash table entry structure, we can get the name of the stub
-     (and thus know exactly what actions it performs) from the base
-     hash table entry.  */
+  0x0e, 0x80, 0x10, 0x96,  /* 1: ldw	0(%r20),%r22		*/
+  0xea, 0xc0, 0xc0, 0x00,  /*    bv	%r0(%r22)		*/
+  0x0e, 0x88, 0x10, 0x95,  /*    ldw	4(%r20),%r21		*/
+#define PLT_STUB_ENTRY (3*4)
+  0xea, 0x9f, 0x1f, 0xdd,  /*    b,l	1b,%r20			*/
+  0xd6, 0x80, 0x1c, 0x1e,  /*    depi	0,31,2,%r20		*/
+  0x00, 0xc0, 0xff, 0xee,  /* 9: .word	fixup_func		*/
+  0xde, 0xad, 0xbe, 0xef   /*    .word	fixup_ltp		*/
+};
+
+/* Section name for stubs is the associated section name plus this
+   string.  */
+#define STUB_SUFFIX ".stub"
+
+/* Setting the following non-zero makes all long branch stubs
+   generated during a shared link of the PIC variety.  This saves on
+   relocs, but costs one extra instruction per stub.  */
+#ifndef LONG_BRANCH_PIC_IN_SHLIB
+#define LONG_BRANCH_PIC_IN_SHLIB 1
+#endif
+
+/* Set this non-zero to use import stubs instead of long branch stubs
+   where a .plt entry exists for the symbol.  This is a fairly useless
+   option as import stubs are bigger than PIC long branch stubs.  */
+#ifndef LONG_BRANCH_VIA_PLT
+#define LONG_BRANCH_VIA_PLT 0
+#endif
+
+/* We don't need to copy any PC- or GP-relative dynamic relocs into a
+   shared object's dynamic section.  */
+#ifndef RELATIVE_DYNAMIC_RELOCS
+#define RELATIVE_DYNAMIC_RELOCS 0
+#endif
+
+enum elf32_hppa_stub_type {
+  hppa_stub_long_branch,
+  hppa_stub_long_branch_shared,
+  hppa_stub_import,
+  hppa_stub_import_shared,
+  hppa_stub_export,
+  hppa_stub_none
+};
+
+struct elf32_hppa_stub_hash_entry {
+
+  /* Base hash table entry structure.  */
   struct bfd_hash_entry root;
 
-  /* Offset of the beginning of this stub.  */
-  bfd_vma offset;
+  /* The stub section.  */
+  asection *stub_sec;
+
+#if ! LONG_BRANCH_PIC_IN_SHLIB
+  /* It's associated reloc section.  */
+  asection *reloc_sec;
+#endif
+
+  /* Offset within stub_sec of the beginning of this stub.  */
+  bfd_vma stub_offset;
 
   /* Given the symbol's value and its section we can determine its final
      value when building the stubs (so the stub knows where to jump.  */
-  symvalue target_value;
+  bfd_vma target_value;
   asection *target_section;
+
+  enum elf32_hppa_stub_type stub_type;
+
+  /* The symbol table entry, if any, that this was derived from.  */
+  struct elf32_hppa_link_hash_entry *h;
+
+  /* Where this stub is being called from, or, in the case of combined
+     stub sections, the first input section in the group.  */
+  asection *id_sec;
 };
 
-struct elf32_hppa_stub_hash_table
-{
-  /* The hash table itself.  */
-  struct bfd_hash_table root;
+struct elf32_hppa_link_hash_entry {
 
-  /* The stub BFD.  */
-  bfd *stub_bfd;
+  struct elf_link_hash_entry elf;
 
-  /* Where to place the next stub.  */
-  bfd_byte *location;
+  /* A pointer to the most recently used stub hash entry against this
+     symbol.  */
+  struct elf32_hppa_stub_hash_entry *stub_cache;
 
-  /* Current offset in the stub section.  */
-  unsigned int offset;
+#if ! LONG_BRANCH_PIC_IN_SHLIB
+  /* Used to track whether we have allocated space for a long branch
+     stub relocation for this symbol in the given section.  */
+  asection *stub_reloc_sec;
+#endif
 
+#if ! LONG_BRANCH_PIC_IN_SHLIB || RELATIVE_DYNAMIC_RELOCS
+  /* Used to count relocations for delayed sizing of relocation
+     sections.  */
+  struct elf32_hppa_dyn_reloc_entry {
+
+    /* Next relocation in the chain.  */
+    struct elf32_hppa_dyn_reloc_entry *next;
+
+    /* The section in dynobj.  */
+    asection *section;
+
+    /* Number of relocs copied in this section.  */
+    bfd_size_type count;
+  } *reloc_entries;
+#endif
+
+  /* Set during a static link if we detect a function is PIC.  */
+  unsigned int pic_call:1;
+
+  /* Set if this symbol is used by a plabel reloc.  */
+  unsigned int plabel:1;
+
+  /* Set if this symbol is an init or fini function and thus should
+     use an absolute reloc.  */
+  unsigned int plt_abs:1;
 };
 
-struct elf32_hppa_link_hash_entry
-{
-  struct elf_link_hash_entry root;
-};
+struct elf32_hppa_link_hash_table {
 
-struct elf32_hppa_link_hash_table
-{
   /* The main hash table.  */
   struct elf_link_hash_table root;
 
   /* The stub hash table.  */
-  struct elf32_hppa_stub_hash_table *stub_hash_table;
+  struct bfd_hash_table stub_hash_table;
 
-  /* A count of the number of output symbols.  */
-  unsigned int output_symbol_count;
+  /* Linker stub bfd.  */
+  bfd *stub_bfd;
 
-  /* Stuff so we can handle DP relative relocations.  */
-  long global_value;
-  int global_sym_defined;
+  /* Linker call-backs.  */
+  asection * (*add_stub_section) PARAMS ((const char *, asection *));
+  void (*layout_sections_again) PARAMS ((void));
+
+  /* Array to keep track of which stub sections have been created, and
+     information on stub grouping.  */
+  struct map_stub {
+    /* This is the section to which stubs in the group will be
+       attached.  */
+    asection *link_sec;
+    /* The stub section.  */
+    asection *stub_sec;
+#if ! LONG_BRANCH_PIC_IN_SHLIB
+    /* The stub section's reloc section.  */
+    asection *reloc_sec;
+#endif
+  } *stub_group;
+
+  /* Short-cuts to get to dynamic linker sections.  */
+  asection *sgot;
+  asection *srelgot;
+  asection *splt;
+  asection *srelplt;
+  asection *sdynbss;
+  asection *srelbss;
+
+  /* Whether we support multiple sub-spaces for shared libs.  */
+  unsigned int multi_subspace:1;
+
+  /* Flags set when PCREL12F and PCREL17F branches detected.  Used to
+     select suitable defaults for the stub group size.  */
+  unsigned int has_12bit_branch:1;
+  unsigned int has_17bit_branch:1;
+
+  /* Set if we need a .plt stub to support lazy dynamic linking.  */
+  unsigned int need_plt_stub:1;
 };
 
-/* ELF32/HPPA relocation support
+/* Various hash macros and functions.  */
+#define hppa_link_hash_table(p) \
+  ((struct elf32_hppa_link_hash_table *) ((p)->hash))
 
-	This file contains ELF32/HPPA relocation support as specified
-	in the Stratus FTX/Golf Object File Format (SED-1762) dated
-	February 1994.  */
+#define hppa_stub_hash_lookup(table, string, create, copy) \
+  ((struct elf32_hppa_stub_hash_entry *) \
+   bfd_hash_lookup ((table), (string), (create), (copy)))
 
-#include "elf32-hppa.h"
-#include "hppa_stubs.h"
+static struct bfd_hash_entry *stub_hash_newfunc
+  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
 
-static unsigned long hppa_elf_relocate_insn
-  PARAMS ((bfd *, asection *, unsigned long, unsigned long, long,
-	   long, unsigned long, unsigned long, unsigned long));
+static struct bfd_hash_entry *hppa_link_hash_newfunc
+  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+
+static struct bfd_link_hash_table *elf32_hppa_link_hash_table_create
+  PARAMS ((bfd *));
+
+/* Stub handling functions.  */
+static char *hppa_stub_name
+  PARAMS ((const asection *, const asection *,
+	   const struct elf32_hppa_link_hash_entry *,
+	   const Elf_Internal_Rela *));
+
+static struct elf32_hppa_stub_hash_entry *hppa_get_stub_entry
+  PARAMS ((const asection *, const asection *,
+	   struct elf32_hppa_link_hash_entry *,
+	   const Elf_Internal_Rela *,
+	   struct elf32_hppa_link_hash_table *));
+
+static struct elf32_hppa_stub_hash_entry *hppa_add_stub
+  PARAMS ((const char *, asection *, struct elf32_hppa_link_hash_table *));
+
+static enum elf32_hppa_stub_type hppa_type_of_stub
+  PARAMS ((asection *, const Elf_Internal_Rela *,
+	   struct elf32_hppa_link_hash_entry *, bfd_vma));
+
+static boolean hppa_build_one_stub
+  PARAMS ((struct bfd_hash_entry *, PTR));
+
+static boolean hppa_size_one_stub
+  PARAMS ((struct bfd_hash_entry *, PTR));
+
+/* BFD and elf backend functions.  */
+static boolean elf32_hppa_object_p PARAMS ((bfd *));
 
 static boolean elf32_hppa_add_symbol_hook
   PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
 	   const char **, flagword *, asection **, bfd_vma *));
 
-static bfd_reloc_status_type elf32_hppa_bfd_final_link_relocate
-  PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *,
-	   bfd_byte *, bfd_vma, bfd_vma, bfd_vma, struct bfd_link_info *,
-	   asection *, const char *, int));
+static boolean elf32_hppa_create_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
 
-static struct bfd_link_hash_table *elf32_hppa_link_hash_table_create
-  PARAMS ((bfd *));
+static boolean elf32_hppa_check_relocs
+  PARAMS ((bfd *, struct bfd_link_info *,
+	   asection *, const Elf_Internal_Rela *));
 
-static struct bfd_hash_entry *
-elf32_hppa_stub_hash_newfunc
-  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+static asection *elf32_hppa_gc_mark_hook
+  PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
+	   struct elf_link_hash_entry *, Elf_Internal_Sym *));
 
-static boolean
-elf32_hppa_relocate_section
+static boolean elf32_hppa_gc_sweep_hook
+  PARAMS ((bfd *, struct bfd_link_info *,
+	   asection *, const Elf_Internal_Rela *));
+
+static void elf32_hppa_hide_symbol
+  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+
+static boolean elf32_hppa_adjust_dynamic_symbol
+  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+
+static boolean hppa_handle_PIC_calls
+  PARAMS ((struct elf_link_hash_entry *, PTR));
+
+#if ((! LONG_BRANCH_PIC_IN_SHLIB && LONG_BRANCH_VIA_PLT) \
+     || RELATIVE_DYNAMIC_RELOCS)
+static boolean hppa_discard_copies
+  PARAMS ((struct elf_link_hash_entry *, PTR));
+#endif
+
+static boolean clobber_millicode_symbols
+  PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *));
+
+static boolean elf32_hppa_size_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+static bfd_reloc_status_type final_link_relocate
+  PARAMS ((asection *, bfd_byte *, const Elf_Internal_Rela *,
+	   bfd_vma, struct elf32_hppa_link_hash_table *, asection *,
+	   struct elf32_hppa_link_hash_entry *));
+
+static boolean elf32_hppa_relocate_section
   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
 	   bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
 
-static boolean
-elf32_hppa_stub_hash_table_init
-  PARAMS ((struct elf32_hppa_stub_hash_table *, bfd *,
-	   struct bfd_hash_entry *(*) PARAMS ((struct bfd_hash_entry *,
-					       struct bfd_hash_table *,
-					       const char *))));
+static boolean elf32_hppa_finish_dynamic_symbol
+  PARAMS ((bfd *, struct bfd_link_info *,
+	   struct elf_link_hash_entry *, Elf_Internal_Sym *));
 
-static boolean
-elf32_hppa_build_one_stub PARAMS ((struct bfd_hash_entry *, PTR));
+static boolean elf32_hppa_finish_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
 
-static unsigned int elf32_hppa_size_of_stub
-  PARAMS ((bfd_vma, bfd_vma, const char *));
-
-static void elf32_hppa_name_of_stub
-  PARAMS ((bfd_vma, bfd_vma, char *));
-
-/* For linker stub hash tables.  */
-#define elf32_hppa_stub_hash_lookup(table, string, create, copy) \
-  ((struct elf32_hppa_stub_hash_entry *) \
-   bfd_hash_lookup (&(table)->root, (string), (create), (copy)))
-
-#define elf32_hppa_stub_hash_traverse(table, func, info) \
-  (bfd_hash_traverse \
-   (&(table)->root, \
-    (boolean (*) PARAMS ((struct bfd_hash_entry *, PTR))) (func), \
-    (info)))
-
-/* For HPPA linker hash table.  */
-
-#define elf32_hppa_link_hash_lookup(table, string, create, copy, follow)\
-  ((struct elf32_hppa_link_hash_entry *)				\
-   elf_link_hash_lookup (&(table)->root, (string), (create),		\
-			 (copy), (follow)))
-
-#define elf32_hppa_link_hash_traverse(table, func, info)		\
-  (elf_link_hash_traverse						\
-   (&(table)->root,							\
-    (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func),	\
-    (info)))
-
-/* Get the PA ELF linker hash table from a link_info structure.  */
-
-#define elf32_hppa_hash_table(p) \
-  ((struct elf32_hppa_link_hash_table *) ((p)->hash))
-
+static int elf32_hppa_elf_get_symbol_type
+  PARAMS ((Elf_Internal_Sym *, int));
 
 /* Assorted hash table functions.  */
 
 /* Initialize an entry in the stub hash table.  */
 
 static struct bfd_hash_entry *
-elf32_hppa_stub_hash_newfunc (entry, table, string)
+stub_hash_newfunc (entry, table, string)
      struct bfd_hash_entry *entry;
      struct bfd_hash_table *table;
      const char *string;
@@ -198,11 +405,13 @@
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
   if (ret == NULL)
-    ret = ((struct elf32_hppa_stub_hash_entry *)
-	   bfd_hash_allocate (table,
-			      sizeof (struct elf32_hppa_stub_hash_entry)));
-  if (ret == NULL)
-    return NULL;
+    {
+      ret = ((struct elf32_hppa_stub_hash_entry *)
+	     bfd_hash_allocate (table,
+				sizeof (struct elf32_hppa_stub_hash_entry)));
+      if (ret == NULL)
+	return NULL;
+    }
 
   /* Call the allocation method of the superclass.  */
   ret = ((struct elf32_hppa_stub_hash_entry *)
@@ -211,28 +420,65 @@
   if (ret)
     {
       /* Initialize the local fields.  */
-      ret->offset = 0;
+      ret->stub_sec = NULL;
+#if ! LONG_BRANCH_PIC_IN_SHLIB
+      ret->reloc_sec = NULL;
+#endif
+      ret->stub_offset = 0;
       ret->target_value = 0;
       ret->target_section = NULL;
+      ret->stub_type = hppa_stub_long_branch;
+      ret->h = NULL;
+      ret->id_sec = NULL;
     }
 
   return (struct bfd_hash_entry *) ret;
 }
 
-/* Initialize a stub hash table.  */
+/* Initialize an entry in the link hash table.  */
 
-static boolean
-elf32_hppa_stub_hash_table_init (table, stub_bfd, newfunc)
-     struct elf32_hppa_stub_hash_table *table;
-     bfd *stub_bfd;
-     struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
-						struct bfd_hash_table *,
-						const char *));
+static struct bfd_hash_entry *
+hppa_link_hash_newfunc (entry, table, string)
+     struct bfd_hash_entry *entry;
+     struct bfd_hash_table *table;
+     const char *string;
 {
-  table->offset = 0;
-  table->location = 0;
-  table->stub_bfd = stub_bfd;
-  return (bfd_hash_table_init (&table->root, newfunc));
+  struct elf32_hppa_link_hash_entry *ret;
+
+  ret = (struct elf32_hppa_link_hash_entry *) entry;
+
+  /* Allocate the structure if it has not already been allocated by a
+     subclass.  */
+  if (ret == NULL)
+    {
+      ret = ((struct elf32_hppa_link_hash_entry *)
+	     bfd_hash_allocate (table,
+				sizeof (struct elf32_hppa_link_hash_entry)));
+      if (ret == NULL)
+	return NULL;
+    }
+
+  /* Call the allocation method of the superclass.  */
+  ret = ((struct elf32_hppa_link_hash_entry *)
+	 _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
+				     table, string));
+
+  if (ret)
+    {
+      /* Initialize the local fields.  */
+#if ! LONG_BRANCH_PIC_IN_SHLIB
+      ret->stub_reloc_sec = NULL;
+#endif
+      ret->stub_cache = NULL;
+#if ! LONG_BRANCH_PIC_IN_SHLIB || RELATIVE_DYNAMIC_RELOCS
+      ret->reloc_entries = NULL;
+#endif
+      ret->pic_call = 0;
+      ret->plabel = 0;
+      ret->plt_abs = 0;
+    }
+
+  return (struct bfd_hash_entry *) ret;
 }
 
 /* Create the derived linker hash table.  The PA ELF port uses the derived
@@ -245,549 +491,641 @@
 {
   struct elf32_hppa_link_hash_table *ret;
 
-  ret = ((struct elf32_hppa_link_hash_table *)
-	 bfd_alloc (abfd, sizeof (struct elf32_hppa_link_hash_table)));
+  ret = ((struct elf32_hppa_link_hash_table *) bfd_alloc (abfd, sizeof (*ret)));
   if (ret == NULL)
     return NULL;
-  if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
-				      _bfd_elf_link_hash_newfunc))
+
+  if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, hppa_link_hash_newfunc))
     {
       bfd_release (abfd, ret);
       return NULL;
     }
-  ret->stub_hash_table = NULL;
-  ret->output_symbol_count = 0;
-  ret->global_value = 0;
-  ret->global_sym_defined = 0;
+
+  /* Init the stub hash table too.  */
+  if (!bfd_hash_table_init (&ret->stub_hash_table, stub_hash_newfunc))
+    return NULL;
+
+  ret->stub_bfd = NULL;
+  ret->add_stub_section = NULL;
+  ret->layout_sections_again = NULL;
+  ret->stub_group = NULL;
+  ret->sgot = NULL;
+  ret->srelgot = NULL;
+  ret->splt = NULL;
+  ret->srelplt = NULL;
+  ret->sdynbss = NULL;
+  ret->srelbss = NULL;
+  ret->multi_subspace = 0;
+  ret->has_12bit_branch = 0;
+  ret->has_17bit_branch = 0;
+  ret->need_plt_stub = 0;
 
   return &ret->root.root;
 }
 
-/* Relocate the given INSN given the various input parameters.
+/* Build a name for an entry in the stub hash table.  */
 
-   FIXME: endianness and sizeof (long) issues abound here.  */
-
-static unsigned long
-hppa_elf_relocate_insn (abfd, input_sect, insn, address, sym_value,
-			r_addend, r_format, r_field, pcrel)
-     bfd *abfd;
-     asection *input_sect;
-     unsigned long insn;
-     unsigned long address;
-     long sym_value;
-     long r_addend;
-     unsigned long r_format;
-     unsigned long r_field;
-     unsigned long pcrel;
+static char *
+hppa_stub_name (input_section, sym_sec, hash, rel)
+     const asection *input_section;
+     const asection *sym_sec;
+     const struct elf32_hppa_link_hash_entry *hash;
+     const Elf_Internal_Rela *rel;
 {
-  unsigned char opcode = get_opcode (insn);
-  long constant_value;
+  char *stub_name;
+  size_t len;
 
-  switch (opcode)
+  if (hash)
     {
-    case LDO:
-    case LDB:
-    case LDH:
-    case LDW:
-    case LDWM:
-    case STB:
-    case STH:
-    case STW:
-    case STWM:
-    case COMICLR:
-    case SUBI:
-    case ADDIT:
-    case ADDI:
-    case LDIL:
-    case ADDIL:
-      constant_value = HPPA_R_CONSTANT (r_addend);
-
-      if (pcrel)
-	sym_value -= address;
-
-      sym_value = hppa_field_adjust (sym_value, constant_value, r_field);
-      return hppa_rebuild_insn (abfd, insn, sym_value, r_format);
-
-    case BL:
-    case BE:
-    case BLE:
-      /* XXX r_addend ignored ???.  */
-      constant_value = assemble_17 ((insn & 0x001f0000) >> 16,
-				    (insn & 0x00001ffc) >> 2,
-				    insn & 1);
-
-      constant_value = (constant_value << (BFD_ARCH_SIZE-17))
-				       >> (BFD_ARCH_SIZE-17);
-      if (pcrel)
+      len = 8 + 1 + strlen (hash->elf.root.root.string) + 1 + 8 + 1;
+      stub_name = bfd_malloc (len);
+      if (stub_name != NULL)
 	{
-	  sym_value -= (address + input_sect->output_offset
-			+ input_sect->output_section->vma);
-	  sym_value = hppa_field_adjust (sym_value, -8, r_field);
+	  sprintf (stub_name, "%08x_%s+%x",
+		   input_section->id & 0xffffffff,
+		   hash->elf.root.root.string,
+		   (int) rel->r_addend & 0xffffffff);
 	}
-      else
-	sym_value = hppa_field_adjust (sym_value, constant_value, r_field);
-
-      return hppa_rebuild_insn (abfd, insn, sym_value >> 2, r_format);
-
-    default:
-      if (opcode == 0)
-	{
-	  constant_value = HPPA_R_CONSTANT (r_addend);
-
-	  if (pcrel)
-	    sym_value -= address;
-
-	  return hppa_field_adjust (sym_value, constant_value, r_field);
-	}
-      else
-	abort ();
     }
+  else
+    {
+      len = 8 + 1 + 8 + 1 + 8 + 1 + 8 + 1;
+      stub_name = bfd_malloc (len);
+      if (stub_name != NULL)
+	{
+	  sprintf (stub_name, "%08x_%x:%x+%x",
+		   input_section->id & 0xffffffff,
+		   sym_sec->id & 0xffffffff,
+		   (int) ELF32_R_SYM (rel->r_info) & 0xffffffff,
+		   (int) rel->r_addend & 0xffffffff);
+	}
+    }
+  return stub_name;
 }
 
-/* Relocate an HPPA ELF section.  */
+/* Look up an entry in the stub hash.  Stub entries are cached because
+   creating the stub name takes a bit of time.  */
+
+static struct elf32_hppa_stub_hash_entry *
+hppa_get_stub_entry (input_section, sym_sec, hash, rel, hplink)
+     const asection *input_section;
+     const asection *sym_sec;
+     struct elf32_hppa_link_hash_entry *hash;
+     const Elf_Internal_Rela *rel;
+     struct elf32_hppa_link_hash_table *hplink;
+{
+  struct elf32_hppa_stub_hash_entry *stub_entry;
+  const asection *id_sec;
+
+  /* If this input section is part of a group of sections sharing one
+     stub section, then use the id of the first section in the group.
+     Stub names need to include a section id, as there may well be
+     more than one stub used to reach say, printf, and we need to
+     distinguish between them.  */
+  id_sec = hplink->stub_group[input_section->id].link_sec;
+
+  if (hash != NULL && hash->stub_cache != NULL
+      && hash->stub_cache->h == hash
+      && hash->stub_cache->id_sec == id_sec)
+    {
+      stub_entry = hash->stub_cache;
+    }
+  else
+    {
+      char *stub_name;
+
+      stub_name = hppa_stub_name (id_sec, sym_sec, hash, rel);
+      if (stub_name == NULL)
+	return NULL;
+
+      stub_entry = hppa_stub_hash_lookup (&hplink->stub_hash_table,
+					  stub_name, false, false);
+      if (stub_entry == NULL)
+	{
+	  if (hash == NULL || hash->elf.root.type != bfd_link_hash_undefweak)
+	    (*_bfd_error_handler) (_("%s(%s+0x%lx): cannot find stub entry %s"),
+				   bfd_get_filename (input_section->owner),
+				   input_section->name,
+				   (long) rel->r_offset,
+				   stub_name);
+	}
+      else
+	{
+	  if (hash != NULL)
+	    hash->stub_cache = stub_entry;
+	}
+
+      free (stub_name);
+    }
+
+  return stub_entry;
+}
+
+/* Add a new stub entry to the stub hash.  Not all fields of the new
+   stub entry are initialised.  */
+
+static struct elf32_hppa_stub_hash_entry *
+hppa_add_stub (stub_name, section, hplink)
+     const char *stub_name;
+     asection *section;
+     struct elf32_hppa_link_hash_table *hplink;
+{
+  asection *link_sec;
+  asection *stub_sec;
+  struct elf32_hppa_stub_hash_entry *stub_entry;
+
+  link_sec = hplink->stub_group[section->id].link_sec;
+  stub_sec = hplink->stub_group[section->id].stub_sec;
+  if (stub_sec == NULL)
+    {
+      stub_sec = hplink->stub_group[link_sec->id].stub_sec;
+      if (stub_sec == NULL)
+	{
+	  size_t len;
+	  char *s_name;
+
+	  len = strlen (link_sec->name) + sizeof (STUB_SUFFIX);
+	  s_name = bfd_alloc (hplink->stub_bfd, len);
+	  if (s_name == NULL)
+	    return NULL;
+
+	  strcpy (s_name, link_sec->name);
+	  strcpy (s_name + len - sizeof (STUB_SUFFIX), STUB_SUFFIX);
+	  stub_sec = (*hplink->add_stub_section) (s_name, link_sec);
+	  if (stub_sec == NULL)
+	    return NULL;
+	  hplink->stub_group[link_sec->id].stub_sec = stub_sec;
+	}
+      hplink->stub_group[section->id].stub_sec = stub_sec;
+    }
+
+  /* Enter this entry into the linker stub hash table.  */
+  stub_entry = hppa_stub_hash_lookup (&hplink->stub_hash_table, stub_name,
+				      true, false);
+  if (stub_entry == NULL)
+    {
+      (*_bfd_error_handler) (_("%s: cannot create stub entry %s"),
+			     bfd_get_filename (section->owner),
+			     stub_name);
+      return NULL;
+    }
+
+  stub_entry->stub_sec = stub_sec;
+#if ! LONG_BRANCH_PIC_IN_SHLIB
+  stub_entry->reloc_sec = hplink->stub_group[section->id].reloc_sec;
+#endif
+  stub_entry->stub_offset = 0;
+  stub_entry->id_sec = link_sec;
+  return stub_entry;
+}
+
+/* Determine the type of stub needed, if any, for a call.  */
+
+static enum elf32_hppa_stub_type
+hppa_type_of_stub (input_sec, rel, hash, destination)
+     asection *input_sec;
+     const Elf_Internal_Rela *rel;
+     struct elf32_hppa_link_hash_entry *hash;
+     bfd_vma destination;
+{
+  bfd_vma location;
+  bfd_vma branch_offset;
+  bfd_vma max_branch_offset;
+  unsigned int r_type;
+
+  if (hash != NULL
+      && (((hash->elf.root.type == bfd_link_hash_defined
+	    || hash->elf.root.type == bfd_link_hash_defweak)
+	   && hash->elf.root.u.def.section->output_section == NULL)
+	  || (hash->elf.root.type == bfd_link_hash_defweak
+	      && hash->elf.dynindx != -1
+	      && hash->elf.plt.offset != (bfd_vma) -1)
+	  || hash->elf.root.type == bfd_link_hash_undefweak
+	  || hash->elf.root.type == bfd_link_hash_undefined
+	  || hash->pic_call))
+    {
+      /* If output_section is NULL, then it's a symbol defined in a
+	 shared library.  We will need an import stub.  Decide between
+	 hppa_stub_import and hppa_stub_import_shared later.  For
+	 shared links we need stubs for undefined or weak syms too;
+	 They will presumably be resolved by the dynamic linker.  */
+      return hppa_stub_import;
+    }
+
+  /* Determine where the call point is.  */
+  location = (input_sec->output_offset
+	      + input_sec->output_section->vma
+	      + rel->r_offset);
+
+  branch_offset = destination - location - 8;
+  r_type = ELF32_R_TYPE (rel->r_info);
+
+  /* Determine if a long branch stub is needed.  parisc branch offsets
+     are relative to the second instruction past the branch, ie. +8
+     bytes on from the branch instruction location.  The offset is
+     signed and counts in units of 4 bytes.  */
+  if (r_type == (unsigned int) R_PARISC_PCREL17F)
+    {
+      max_branch_offset = (1 << (17-1)) << 2;
+    }
+  else if (r_type == (unsigned int) R_PARISC_PCREL12F)
+    {
+      max_branch_offset = (1 << (12-1)) << 2;
+    }
+  else /* R_PARISC_PCREL22F.  */
+    {
+      max_branch_offset = (1 << (22-1)) << 2;
+    }
+
+  if (branch_offset + max_branch_offset >= 2*max_branch_offset)
+    {
+#if LONG_BRANCH_VIA_PLT
+      if (hash != NULL
+	  && hash->elf.dynindx != -1
+	  && hash->elf.plt.offset != (bfd_vma) -1)
+	{
+	  /* If we are doing a shared link and find we need a long
+	     branch stub, then go via the .plt if possible.  */
+	  return hppa_stub_import;
+	}
+      else
+#endif
+	return hppa_stub_long_branch;
+    }
+  return hppa_stub_none;
+}
+
+/* Build one linker stub as defined by the stub hash table entry GEN_ENTRY.
+   IN_ARG contains the link info pointer.  */
+
+#define LDIL_R1		0x20200000	/* ldil  LR'XXX,%r1		*/
+#define BE_SR4_R1	0xe0202002	/* be,n  RR'XXX(%sr4,%r1)	*/
+
+#define BL_R1		0xe8200000	/* b,l   .+8,%r1		*/
+#define ADDIL_R1	0x28200000	/* addil L'XXX,%r1,%r1		*/
+#define DEPI_R1		0xd4201c1e	/* depi  0,31,2,%r1		*/
+
+#define ADDIL_DP	0x2b600000	/* addil L'XXX,%dp,%r1		*/
+#define LDW_R1_R21	0x48350000	/* ldw   R'XXX(%sr0,%r1),%r21	*/
+#define BV_R0_R21	0xeaa0c000	/* bv    %r0(%r21)		*/
+#define LDW_R1_R19	0x48330000	/* ldw   R'XXX(%sr0,%r1),%r19	*/
+
+#define ADDIL_R19	0x2a600000	/* addil L'XXX,%r19,%r1		*/
+#define LDW_R1_DP	0x483b0000	/* ldw   R'XXX(%sr0,%r1),%dp	*/
+
+#define LDSID_R21_R1	0x02a010a1	/* ldsid (%sr0,%r21),%r1	*/
+#define MTSP_R1		0x00011820	/* mtsp  %r1,%sr0		*/
+#define BE_SR0_R21	0xe2a00000	/* be    0(%sr0,%r21)		*/
+#define STW_RP		0x6bc23fd1	/* stw   %rp,-24(%sr0,%sp)	*/
+
+#define BL_RP		0xe8400002	/* b,l,n XXX,%rp		*/
+#define NOP		0x08000240	/* nop				*/
+#define LDW_RP		0x4bc23fd1	/* ldw   -24(%sr0,%sp),%rp	*/
+#define LDSID_RP_R1	0x004010a1	/* ldsid (%sr0,%rp),%r1		*/
+#define BE_SR0_RP	0xe0400002	/* be,n  0(%sr0,%rp)		*/
+
+#ifndef R19_STUBS
+#define R19_STUBS 1
+#endif
+
+#if R19_STUBS
+#define LDW_R1_DLT	LDW_R1_R19
+#else
+#define LDW_R1_DLT	LDW_R1_DP
+#endif
 
 static boolean
-elf32_hppa_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;
+hppa_build_one_stub (gen_entry, in_arg)
+     struct bfd_hash_entry *gen_entry;
+     PTR in_arg;
 {
-  Elf_Internal_Shdr *symtab_hdr;
-  Elf_Internal_Rela *rel;
-  Elf_Internal_Rela *relend;
+  struct elf32_hppa_stub_hash_entry *stub_entry;
+  struct bfd_link_info *info;
+  struct elf32_hppa_link_hash_table *hplink;
+  asection *stub_sec;
+  bfd *stub_bfd;
+  bfd_byte *loc;
+  bfd_vma sym_value;
+  bfd_vma insn;
+  int val;
+  int size;
 
-  symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+  /* Massage our args to the form they really have.  */
+  stub_entry = (struct elf32_hppa_stub_hash_entry *) gen_entry;
+  info = (struct bfd_link_info *) in_arg;
 
-  rel = relocs;
-  relend = relocs + input_section->reloc_count;
-  for (; rel < relend; rel++)
+  hplink = hppa_link_hash_table (info);
+  stub_sec = stub_entry->stub_sec;
+
+  /* Make a note of the offset within the stubs for this entry.  */
+  stub_entry->stub_offset = stub_sec->_raw_size;
+  loc = stub_sec->contents + stub_entry->stub_offset;
+
+  stub_bfd = stub_sec->owner;
+
+  switch (stub_entry->stub_type)
     {
-      int r_type;
-      reloc_howto_type *howto;
-      unsigned long r_symndx;
-      struct elf_link_hash_entry *h;
-      Elf_Internal_Sym *sym;
-      asection *sym_sec;
-      bfd_vma relocation;
-      bfd_reloc_status_type r;
-      const char *sym_name;
+    case hppa_stub_long_branch:
+      /* Create the long branch.  A long branch is formed with "ldil"
+	 loading the upper bits of the target address into a register,
+	 then branching with "be" which adds in the lower bits.
+	 The "be" has its delay slot nullified.  */
+      sym_value = (stub_entry->target_value
+		   + stub_entry->target_section->output_offset
+		   + stub_entry->target_section->output_section->vma);
 
-      r_type = ELF32_R_TYPE (rel->r_info);
-      if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
+      val = hppa_field_adjust (sym_value, (bfd_signed_vma) 0, e_lrsel);
+      insn = hppa_rebuild_insn ((int) LDIL_R1, val, 21);
+      bfd_put_32 (stub_bfd, insn, loc);
+
+      val = hppa_field_adjust (sym_value, (bfd_signed_vma) 0, e_rrsel) >> 2;
+      insn = hppa_rebuild_insn ((int) BE_SR4_R1, val, 17);
+      bfd_put_32 (stub_bfd, insn, loc + 4);
+
+#if ! LONG_BRANCH_PIC_IN_SHLIB
+      if (info->shared)
 	{
+	  /* Output a dynamic relocation for this stub.  We only
+	     output one PCREL21L reloc per stub, trusting that the
+	     dynamic linker will also fix the implied PCREL17R for the
+	     second instruction.  PCREL21L dynamic relocs had better
+	     never be emitted for some other purpose...  */
+	  asection *srel;
+	  Elf_Internal_Rela outrel;
+
+	  if (stub_entry->h == NULL)
+	    {
+	      (*_bfd_error_handler)
+		(_("%s(%s+0x%lx): cannot relocate %s, recompile with -ffunction-sections"),
+		 bfd_get_filename (stub_entry->target_section->owner),
+		 stub_sec->name,
+		 (long) stub_entry->stub_offset,
+		 stub_entry->root.string);
+	      bfd_set_error (bfd_error_bad_value);
+	      return false;
+	    }
+
+	  srel = stub_entry->reloc_sec;
+	  if (srel == NULL)
+	    {
+	      (*_bfd_error_handler)
+		(_("Could not find relocation section for %s"),
+		 stub_sec->name);
+	      bfd_set_error (bfd_error_bad_value);
+	      return false;
+	    }
+
+	  outrel.r_offset = (stub_entry->stub_offset
+			     + stub_sec->output_offset
+			     + stub_sec->output_section->vma);
+	  outrel.r_info = ELF32_R_INFO (0, R_PARISC_PCREL21L);
+	  outrel.r_addend = sym_value;
+	  bfd_elf32_swap_reloca_out (stub_sec->output_section->owner,
+				     &outrel,
+				     ((Elf32_External_Rela *)
+				      srel->contents + srel->reloc_count));
+	  ++srel->reloc_count;
+	}
+#endif
+      size = 8;
+      break;
+
+    case hppa_stub_long_branch_shared:
+      /* Branches are relative.  This is where we are going to.  */
+      sym_value = (stub_entry->target_value
+		   + stub_entry->target_section->output_offset
+		   + stub_entry->target_section->output_section->vma);
+
+      /* And this is where we are coming from, more or less.  */
+      sym_value -= (stub_entry->stub_offset
+		    + stub_sec->output_offset
+		    + stub_sec->output_section->vma);
+
+      bfd_put_32 (stub_bfd, (bfd_vma) BL_R1, loc);
+      val = hppa_field_adjust (sym_value, (bfd_signed_vma) -8, e_lrsel);
+      insn = hppa_rebuild_insn ((int) ADDIL_R1, val, 21);
+      bfd_put_32 (stub_bfd, insn, loc + 4);
+
+      val = hppa_field_adjust (sym_value, (bfd_signed_vma) -8, e_rrsel) >> 2;
+      insn = hppa_rebuild_insn ((int) BE_SR4_R1, val, 17);
+      bfd_put_32 (stub_bfd, insn, loc + 8);
+      size = 12;
+      break;
+
+    case hppa_stub_import:
+    case hppa_stub_import_shared:
+      sym_value = (stub_entry->h->elf.plt.offset
+		   + hplink->splt->output_offset
+		   + hplink->splt->output_section->vma
+		   - elf_gp (hplink->splt->output_section->owner));
+
+      insn = ADDIL_DP;
+#if R19_STUBS
+      if (stub_entry->stub_type == hppa_stub_import_shared)
+	insn = ADDIL_R19;
+#endif
+      val = hppa_field_adjust (sym_value, (bfd_signed_vma) 0, e_lrsel),
+      insn = hppa_rebuild_insn ((int) insn, val, 21);
+      bfd_put_32 (stub_bfd, insn, loc);
+
+      /* It is critical to use lrsel/rrsel here because we are using
+	 two different offsets (+0 and +4) from sym_value.  If we use
+	 lsel/rsel then with unfortunate sym_values we will round
+	 sym_value+4 up to the next 2k block leading to a mis-match
+	 between the lsel and rsel value.  */
+      val = hppa_field_adjust (sym_value, (bfd_signed_vma) 0, e_rrsel);
+      insn = hppa_rebuild_insn ((int) LDW_R1_R21, val, 14);
+      bfd_put_32 (stub_bfd, insn, loc + 4);
+
+      if (hplink->multi_subspace)
+	{
+	  val = hppa_field_adjust (sym_value, (bfd_signed_vma) 4, e_rrsel);
+	  insn = hppa_rebuild_insn ((int) LDW_R1_DLT, val, 14);
+	  bfd_put_32 (stub_bfd, insn, loc + 8);
+
+	  bfd_put_32 (stub_bfd, (bfd_vma) LDSID_R21_R1, loc + 12);
+	  bfd_put_32 (stub_bfd, (bfd_vma) MTSP_R1,      loc + 16);
+	  bfd_put_32 (stub_bfd, (bfd_vma) BE_SR0_R21,   loc + 20);
+	  bfd_put_32 (stub_bfd, (bfd_vma) STW_RP,       loc + 24);
+
+	  size = 28;
+	}
+      else
+	{
+	  bfd_put_32 (stub_bfd, (bfd_vma) BV_R0_R21, loc + 8);
+	  val = hppa_field_adjust (sym_value, (bfd_signed_vma) 4, e_rrsel);
+	  insn = hppa_rebuild_insn ((int) LDW_R1_DLT, val, 14);
+	  bfd_put_32 (stub_bfd, insn, loc + 12);
+
+	  size = 16;
+	}
+
+      if (!info->shared
+	  && stub_entry->h != NULL
+	  && stub_entry->h->pic_call)
+	{
+	  /* Build the .plt entry needed to call a PIC function from
+	     statically linked code.  We don't need any relocs.  */
+	  bfd *dynobj;
+	  struct elf32_hppa_link_hash_entry *eh;
+	  bfd_vma value;
+
+	  dynobj = hplink->root.dynobj;
+	  eh = (struct elf32_hppa_link_hash_entry *) stub_entry->h;
+
+	  BFD_ASSERT (eh->elf.root.type == bfd_link_hash_defined
+		      || eh->elf.root.type == bfd_link_hash_defweak);
+
+	  value = (eh->elf.root.u.def.value
+		   + eh->elf.root.u.def.section->output_offset
+		   + eh->elf.root.u.def.section->output_section->vma);
+
+	  /* Fill in the entry in the procedure linkage table.
+
+	     The format of a plt entry is
+	     <funcaddr>
+	     <__gp>.  */
+
+	  bfd_put_32 (hplink->splt->owner, value,
+		      hplink->splt->contents + eh->elf.plt.offset);
+	  value = elf_gp (hplink->splt->output_section->owner);
+	  bfd_put_32 (hplink->splt->owner, value,
+		      hplink->splt->contents + eh->elf.plt.offset + 4);
+	}
+      break;
+
+    case hppa_stub_export:
+      /* Branches are relative.  This is where we are going to.  */
+      sym_value = (stub_entry->target_value
+		   + stub_entry->target_section->output_offset
+		   + stub_entry->target_section->output_section->vma);
+
+      /* And this is where we are coming from.  */
+      sym_value -= (stub_entry->stub_offset
+		    + stub_sec->output_offset
+		    + stub_sec->output_section->vma);
+
+      if (sym_value - 8 + 0x40000 >= 0x80000)
+	{
+	  (*_bfd_error_handler)
+	    (_("%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections"),
+	     bfd_get_filename (stub_entry->target_section->owner),
+	     stub_sec->name,
+	     (long) stub_entry->stub_offset,
+	     stub_entry->root.string);
 	  bfd_set_error (bfd_error_bad_value);
 	  return false;
 	}
-      howto = elf_hppa_howto_table + r_type;
 
-      r_symndx = ELF32_R_SYM (rel->r_info);
+      val = hppa_field_adjust (sym_value, (bfd_signed_vma) -8, e_fsel) >> 2;
+      insn = hppa_rebuild_insn ((int) BL_RP, val, 17);
+      bfd_put_32 (stub_bfd, insn, loc);
 
-      if (info->relocateable)
-	{
-	  /* This is a relocateable link.  We don't have to change
-	     anything, unless the reloc is against a section symbol,
-	     in which case we have to adjust according to where the
-	     section symbol winds up in the output section.  */
-	  if (r_symndx < symtab_hdr->sh_info)
-	    {
-	      sym = local_syms + r_symndx;
-	      if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
-		{
-		  sym_sec = local_sections[r_symndx];
-		  rel->r_addend += sym_sec->output_offset;
-		}
-	    }
+      bfd_put_32 (stub_bfd, (bfd_vma) NOP,         loc + 4);
+      bfd_put_32 (stub_bfd, (bfd_vma) LDW_RP,      loc + 8);
+      bfd_put_32 (stub_bfd, (bfd_vma) LDSID_RP_R1, loc + 12);
+      bfd_put_32 (stub_bfd, (bfd_vma) MTSP_R1,     loc + 16);
+      bfd_put_32 (stub_bfd, (bfd_vma) BE_SR0_RP,   loc + 20);
 
-	  continue;
-	}
+      /* Point the function symbol at the stub.  */
+      stub_entry->h->elf.root.u.def.section = stub_sec;
+      stub_entry->h->elf.root.u.def.value = stub_sec->_raw_size;
 
-      /* This is a final link.  */
-      h = NULL;
-      sym = NULL;
-      sym_sec = NULL;
-      if (r_symndx < symtab_hdr->sh_info)
-	{
-	  sym = local_syms + r_symndx;
-	  sym_sec = local_sections[r_symndx];
-	  relocation = ((ELF_ST_TYPE (sym->st_info) == STT_SECTION
-			   ? 0 : sym->st_value)
-			 + sym_sec->output_offset
-			 + sym_sec->output_section->vma);
-	}
-      else
-	{
-	  long indx;
+      size = 24;
+      break;
 
-	  indx = r_symndx - symtab_hdr->sh_info;
-	  h = elf_sym_hashes (input_bfd)[indx];
-	  while (h->root.type == bfd_link_hash_indirect
-		 || h->root.type == bfd_link_hash_warning)
-	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-	  if (h->root.type == bfd_link_hash_defined
-	      || h->root.type == bfd_link_hash_defweak)
-	    {
-	      sym_sec = h->root.u.def.section;
-	      relocation = (h->root.u.def.value
-			    + sym_sec->output_offset
-			    + sym_sec->output_section->vma);
-	    }
-	  else if (h->root.type == bfd_link_hash_undefweak)
-	    relocation = 0;
-	  else
-	    {
-	      if (!((*info->callbacks->undefined_symbol)
-		    (info, h->root.root.string, input_bfd,
-		     input_section, rel->r_offset, true)))
-		return false;
-	      break;
-	    }
-	}
-
-      if (h != NULL)
-	sym_name = h->root.root.string;
-      else
-	{
-	  sym_name = bfd_elf_string_from_elf_section (input_bfd,
-						      symtab_hdr->sh_link,
-						      sym->st_name);
-	  if (sym_name == NULL)
-	    return false;
-	  if (*sym_name == '\0')
-	    sym_name = bfd_section_name (input_bfd, sym_sec);
-	}
-
-      r = elf32_hppa_bfd_final_link_relocate (howto, input_bfd, output_bfd,
-					      input_section, contents,
-					      rel->r_offset, relocation,
-					      rel->r_addend, info, sym_sec,
-					      sym_name, h == NULL);
-
-      if (r != bfd_reloc_ok)
-	{
-	  switch (r)
-	    {
-	    /* This can happen for DP relative relocs if $global$ is
-	       undefined.  This is a panic situation so we don't try
-	       to continue.  */
-	    case bfd_reloc_undefined:
-	    case bfd_reloc_notsupported:
-	      if (!((*info->callbacks->undefined_symbol)
-		    (info, "$global$", input_bfd,
-		     input_section, rel->r_offset, true)))
-		return false;
-	      return false;
-	    case bfd_reloc_dangerous:
-	      {
-		/* We use this return value to indicate that we performed
-		   a "dangerous" relocation.  This doesn't mean we did
-		   the wrong thing, it just means there may be some cleanup
-		   that needs to be done here.
-
-		   In particular we had to swap the last call insn and its
-		   delay slot.  If the delay slot insn needed a relocation,
-		   then we'll need to adjust the next relocation entry's
-		   offset to account for the fact that the insn moved.
-
-		   This hair wouldn't be necessary if we inserted stubs
-		   between procedures and used a "bl" to get to the stub.  */
-		if (rel != relend)
-		  {
-		    Elf_Internal_Rela *next_rel = rel + 1;
-
-		    if (rel->r_offset + 4 == next_rel->r_offset)
-		      next_rel->r_offset -= 4;
-		  }
-		break;
-	      }
-	    default:
-	    case bfd_reloc_outofrange:
-	    case bfd_reloc_overflow:
-	      {
-		if (!((*info->callbacks->reloc_overflow)
-		      (info, sym_name, howto->name, (bfd_vma) 0,
-			input_bfd, input_section, rel->r_offset)))
-		  return false;
-	      }
-	      break;
-	    }
-	}
+    default:
+      BFD_FAIL ();
+      return false;
     }
 
+  stub_sec->_raw_size += size;
   return true;
 }
 
-/* Actually perform a relocation as part of a final link.  This can get
-   rather hairy when linker stubs are needed.  */
+#undef LDIL_R1
+#undef BE_SR4_R1
+#undef BL_R1
+#undef ADDIL_R1
+#undef DEPI_R1
+#undef ADDIL_DP
+#undef LDW_R1_R21
+#undef LDW_R1_DLT
+#undef LDW_R1_R19
+#undef ADDIL_R19
+#undef LDW_R1_DP
+#undef LDSID_R21_R1
+#undef MTSP_R1
+#undef BE_SR0_R21
+#undef STW_RP
+#undef BV_R0_R21
+#undef BL_RP
+#undef NOP
+#undef LDW_RP
+#undef LDSID_RP_R1
+#undef BE_SR0_RP
 
-static bfd_reloc_status_type
-elf32_hppa_bfd_final_link_relocate (howto, input_bfd, output_bfd,
-				    input_section, contents, offset, value,
-				    addend, info, sym_sec, sym_name, is_local)
-     reloc_howto_type *howto;
-     bfd *input_bfd;
-     bfd *output_bfd ATTRIBUTE_UNUSED;
-     asection *input_section;
-     bfd_byte *contents;
-     bfd_vma offset;
-     bfd_vma value;
-     bfd_vma addend;
-     struct bfd_link_info *info;
-     asection *sym_sec;
-     const char *sym_name;
-     int is_local;
+/* As above, but don't actually build the stub.  Just bump offset so
+   we know stub section sizes.  */
+
+static boolean
+hppa_size_one_stub (gen_entry, in_arg)
+     struct bfd_hash_entry *gen_entry;
+     PTR in_arg;
 {
-  unsigned long insn;
-  unsigned long r_type = howto->type;
-  unsigned long r_format = howto->bitsize;
-  unsigned long r_field = e_fsel;
-  bfd_byte *hit_data = contents + offset;
-  boolean r_pcrel = howto->pc_relative;
+  struct elf32_hppa_stub_hash_entry *stub_entry;
+  struct elf32_hppa_link_hash_table *hplink;
+  int size;
 
-  insn = bfd_get_32 (input_bfd, hit_data);
+  /* Massage our args to the form they really have.  */
+  stub_entry = (struct elf32_hppa_stub_hash_entry *) gen_entry;
+  hplink = (struct elf32_hppa_link_hash_table *) in_arg;
 
-  /* Make sure we have a value for $global$.  FIXME isn't this effectively
-     just like the gp pointer on MIPS?  Can we use those routines for this
-     purpose?  */
-  if (!elf32_hppa_hash_table (info)->global_sym_defined)
+  if (stub_entry->stub_type == hppa_stub_long_branch)
     {
-      struct elf_link_hash_entry *h;
-      asection *sec;
-
-      h = elf_link_hash_lookup (elf_hash_table (info), "$global$", false,
-				 false, false);
-
-      /* If there isn't a $global$, then we're in deep trouble.  */
-      if (h == NULL)
-	return bfd_reloc_notsupported;
-
-      /* If $global$ isn't a defined symbol, then we're still in deep
-	 trouble.  */
-      if (h->root.type != bfd_link_hash_defined)
-	return bfd_reloc_undefined;
-
-      sec = h->root.u.def.section;
-      elf32_hppa_hash_table (info)->global_value = (h->root.u.def.value
-						    + sec->output_section->vma
-						    + sec->output_offset);
-      elf32_hppa_hash_table (info)->global_sym_defined = 1;
+#if ! LONG_BRANCH_PIC_IN_SHLIB
+      if (stub_entry->reloc_sec != NULL)
+	stub_entry->reloc_sec->_raw_size += sizeof (Elf32_External_Rela);
+#endif
+      size = 8;
     }
-
-  switch (r_type)
+  else if (stub_entry->stub_type == hppa_stub_long_branch_shared)
+    size = 12;
+  else if (stub_entry->stub_type == hppa_stub_export)
+    size = 24;
+  else /* hppa_stub_import or hppa_stub_import_shared.  */
     {
-    case R_PARISC_NONE:
-      break;
-
-    case R_PARISC_DIR32:
-    case R_PARISC_DIR17F:
-    case R_PARISC_PCREL17C:
-      r_field = e_fsel;
-      goto do_basic_type_1;
-    case R_PARISC_DIR21L:
-    case R_PARISC_PCREL21L:
-      r_field = e_lrsel;
-      goto do_basic_type_1;
-    case R_PARISC_DIR17R:
-    case R_PARISC_PCREL17R:
-    case R_PARISC_DIR14R:
-    case R_PARISC_PCREL14R:
-      r_field = e_rrsel;
-      goto do_basic_type_1;
-
-    /* For all the DP relative relocations, we need to examine the symbol's
-       section.  If it's a code section, then "data pointer relative" makes
-       no sense.  In that case we don't adjust the "value", and for 21 bit
-       addil instructions, we change the source addend register from %dp to
-       %r0.  */
-    case R_PARISC_DPREL21L:
-      r_field = e_lrsel;
-      if (sym_sec->flags & SEC_CODE)
-	{
-	  if ((insn & 0xfc000000) >> 26 == 0xa
-	       && (insn & 0x03e00000) >> 21 == 0x1b)
-	    insn &= ~0x03e00000;
-	}
+      if (hplink->multi_subspace)
+	size = 28;
       else
-	value -= elf32_hppa_hash_table (info)->global_value;
-      goto do_basic_type_1;
-    case R_PARISC_DPREL14R:
-      r_field = e_rrsel;
-      if ((sym_sec->flags & SEC_CODE) == 0)
-	value -= elf32_hppa_hash_table (info)->global_value;
-      goto do_basic_type_1;
-    case R_PARISC_DPREL14F:
-      r_field = e_fsel;
-      if ((sym_sec->flags & SEC_CODE) == 0)
-	value -= elf32_hppa_hash_table (info)->global_value;
-      goto do_basic_type_1;
-
-    /* These cases are separate as they may involve a lot more work
-       to deal with linker stubs.  */
-    case R_PARISC_PLABEL32:
-    case R_PARISC_PLABEL21L:
-    case R_PARISC_PLABEL14R:
-    case R_PARISC_PCREL17F:
-      {
-	bfd_vma location;
-	unsigned int len;
-	char *new_name, *stub_name;
-
-	/* Get the field selector right.  We'll need it in a minute.  */
-	if (r_type == R_PARISC_PCREL17F
-	    || r_type == R_PARISC_PLABEL32)
-	  r_field = e_fsel;
-	else if (r_type == R_PARISC_PLABEL21L)
-	  r_field = e_lrsel;
-	else if (r_type == R_PARISC_PLABEL14R)
-	  r_field = e_rrsel;
-
-	/* Find out where we are and where we're going.  */
-	location = (offset +
-		    input_section->output_offset +
-		    input_section->output_section->vma);
-
-	len = strlen (sym_name) + 1;
-	if (is_local)
-	  len += 9;
-	new_name = bfd_malloc (len);
-	if (!new_name)
-	  return bfd_reloc_notsupported;
-	strcpy (new_name, sym_name);
-
-	/* Local symbols have unique IDs.  */
-	if (is_local)
-	  sprintf (new_name + len - 10, "_%08x", (int)sym_sec);
-
-	/* Any kind of linker stub needed?  */
-	if (((int)(value - location) > 0x3ffff)
-	    || ((int)(value - location) < -0x40000))
-	  {
-	    struct elf32_hppa_stub_hash_table *stub_hash_table;
-	    struct elf32_hppa_stub_hash_entry *stub_hash;
-	    asection *stub_section;
-
-	    /* Build a name for the stub.  */
-
-	    len = strlen (new_name);
-	    len += 23;
-	    stub_name = bfd_malloc (len);
-	    if (!stub_name)
-	      return bfd_reloc_notsupported;
-	    elf32_hppa_name_of_stub (location, value, stub_name);
-	    strcat (stub_name, new_name);
-	    free (new_name);
-
-	    stub_hash_table = elf32_hppa_hash_table (info)->stub_hash_table;
-
-	    stub_hash
-	      = elf32_hppa_stub_hash_lookup (stub_hash_table, stub_name,
-					     false, false);
-
-	    /* We're done with that name.  */
-	    free (stub_name);
-
-	    /* The stub BFD only has one section.  */
-	    stub_section = stub_hash_table->stub_bfd->sections;
-
-	    if (stub_hash != NULL)
-	      {
-		if (r_type == R_PARISC_PCREL17F)
-		  {
-		    unsigned long delay_insn;
-		    unsigned int opcode, rtn_reg, ldo_target_reg, ldo_src_reg;
-
-		    /* We'll need to peek at the next insn.  */
-		    delay_insn = bfd_get_32 (input_bfd, hit_data + 4);
-		    opcode = get_opcode (delay_insn);
-
-		    /* We also need to know the return register for this
-		       call.  */
-		    rtn_reg = (insn & 0x03e00000) >> 21;
-
-		    ldo_src_reg = (delay_insn & 0x03e00000) >> 21;
-		    ldo_target_reg = (delay_insn & 0x001f0000) >> 16;
-
-		    /* Munge up the value and other parameters for
-		       hppa_elf_relocate_insn.  */
-
-		    value = (stub_hash->offset
-			     + stub_section->output_offset
-			     + stub_section->output_section->vma);
-
-		    r_format = 17;
-		    r_field = e_fsel;
-		    r_pcrel = 0;
-		    addend = 0;
-
-		    /* We need to peek at the delay insn and determine if
-		       we'll need to swap the branch and its delay insn.  */
-		    if ((insn & 2)
-			|| (opcode == LDO
-			    && ldo_target_reg == rtn_reg)
-			|| (delay_insn == 0x08000240))
-		      {
-			/* No need to swap the branch and its delay slot, but
-			   we do need to make sure to jump past the return
-			   pointer update in the stub.  */
-			value += 4;
-
-			/* If the delay insn does a return pointer adjustment,
-			   then we have to make sure it stays valid.  */
-			if (opcode == LDO
-			    && ldo_target_reg == rtn_reg)
-			  {
-			    delay_insn &= 0xfc00ffff;
-			    delay_insn |= ((31 << 21) | (31 << 16));
-			    bfd_put_32 (input_bfd, delay_insn, hit_data + 4);
-			  }
-			/* Use a BLE to reach the stub.  */
-			insn = BLE_SR4_R0;
-		      }
-		    else
-		      {
-			/* Wonderful, we have to swap the call insn and its
-			   delay slot.  */
-			bfd_put_32 (input_bfd, delay_insn, hit_data);
-			/* Use a BLE,n to reach the stub.  */
-			insn = (BLE_SR4_R0 | 0x2);
-			bfd_put_32 (input_bfd, insn, hit_data + 4);
-			insn = hppa_elf_relocate_insn (input_bfd,
-						       input_section,
-						       insn, offset + 4,
-						       value, addend,
-						       r_format, r_field,
-						       r_pcrel);
-			/* Update the instruction word.  */
-			bfd_put_32 (input_bfd, insn, hit_data + 4);
-			return bfd_reloc_dangerous;
-		      }
-		  }
-	        else
-		  return bfd_reloc_notsupported;
-	      }
-	  }
-	goto do_basic_type_1;
-      }
-
-do_basic_type_1:
-      insn = hppa_elf_relocate_insn (input_bfd, input_section, insn,
-				     offset, value, addend, r_format,
-				     r_field, r_pcrel);
-      break;
-
-    /* Something we don't know how to handle.  */
-    default:
-      return bfd_reloc_notsupported;
+	size = 16;
     }
 
-  /* Update the instruction word.  */
-  bfd_put_32 (input_bfd, insn, hit_data);
-  return (bfd_reloc_ok);
+  stub_entry->stub_sec->_raw_size += size;
+  return true;
+}
+
+/* Return nonzero if ABFD represents an HPPA ELF32 file.
+   Additionally we set the default architecture and machine.  */
+
+static boolean
+elf32_hppa_object_p (abfd)
+     bfd *abfd;
+{
+  unsigned int flags = elf_elfheader (abfd)->e_flags;
+
+  switch (flags & (EF_PARISC_ARCH | EF_PARISC_WIDE))
+    {
+    case EFA_PARISC_1_0:
+      return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 10);
+    case EFA_PARISC_1_1:
+      return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 11);
+    case EFA_PARISC_2_0:
+      return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 20);
+    case EFA_PARISC_2_0 | EF_PARISC_WIDE:
+      return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 25);
+    }
+  return true;
 }
 
 /* Undo the generic ELF code's subtraction of section->vma from the
@@ -807,518 +1145,3084 @@
   return true;
 }
 
-/* Determine the name of the stub needed to perform a call assuming the
-   argument relocation bits for caller and callee are in CALLER and CALLEE
-   for a call from LOCATION to DESTINATION.  Copy the name into STUB_NAME.  */
-
-static void
-elf32_hppa_name_of_stub (location, destination, stub_name)
-     bfd_vma location ATTRIBUTE_UNUSED;
-     bfd_vma destination ATTRIBUTE_UNUSED;
-     char *stub_name;
-{
-  strcpy (stub_name, "_____long_branch_stub_");
-}
-
-/* Compute the size of the stub needed to call from LOCATION to DESTINATION
-   (a function named SYM_NAME), with argument relocation bits CALLER and
-   CALLEE.  Return zero if no stub is needed to perform such a call.  */
-
-static unsigned int
-elf32_hppa_size_of_stub (location, destination, sym_name)
-     bfd_vma location, destination;
-     const char *sym_name;
-{
-  /* Determine if a long branch stub is needed.  */
-  if (!(((int)(location - destination) > 0x3ffff)
-	|| ((int)(location - destination) < -0x40000)))
-    return 0;
-
-  if (!strncmp ("$$", sym_name, 2)
-      && strcmp ("$$dyncall", sym_name))
-    return 12;
-  else
-    return 16;
-}
-
-/* Build one linker stub as defined by the stub hash table entry GEN_ENTRY.
-   IN_ARGS contains the stub BFD and link info pointers.  */
+/* Create the .plt and .got sections, and set up our hash table
+   short-cuts to various dynamic sections.  */
 
 static boolean
-elf32_hppa_build_one_stub (gen_entry, in_args)
-     struct bfd_hash_entry *gen_entry;
-     PTR in_args;
+elf32_hppa_create_dynamic_sections (abfd, info)
+     bfd *abfd;
+     struct bfd_link_info *info;
 {
-  void **args = (void **)in_args;
-  bfd *stub_bfd = (bfd *)args[0];
-  struct bfd_link_info *info = (struct bfd_link_info *)args[1];
-  struct elf32_hppa_stub_hash_entry *entry;
-  struct elf32_hppa_stub_hash_table *stub_hash_table;
-  bfd_byte *loc;
-  symvalue sym_value;
-  const char *sym_name;
+  struct elf32_hppa_link_hash_table *hplink;
 
-  /* Initialize pointers to the stub hash table, the particular entry we
-     are building a stub for, and where (in memory) we should place the stub
-     instructions.  */
-  entry = (struct elf32_hppa_stub_hash_entry *)gen_entry;
-  stub_hash_table = elf32_hppa_hash_table(info)->stub_hash_table;
-  loc = stub_hash_table->location;
+  /* Don't try to create the .plt and .got twice.  */
+  hplink = hppa_link_hash_table (info);
+  if (hplink->splt != NULL)
+    return true;
 
-  /* Make a note of the offset within the stubs for this entry.  */
-  entry->offset = stub_hash_table->offset;
+  /* Call the generic code to do most of the work.  */
+  if (! _bfd_elf_create_dynamic_sections (abfd, info))
+    return false;
 
-  /* The symbol's name starts at offset 22.  */
-  sym_name = entry->root.string + 22;
+  hplink->splt = bfd_get_section_by_name (abfd, ".plt");
+  hplink->srelplt = bfd_get_section_by_name (abfd, ".rela.plt");
 
-  sym_value = (entry->target_value
-	       + entry->target_section->output_offset
-	       + entry->target_section->output_section->vma);
+  hplink->sgot = bfd_get_section_by_name (abfd, ".got");
+  hplink->srelgot = bfd_make_section (abfd, ".rela.got");
+  if (hplink->srelgot == NULL
+      || ! bfd_set_section_flags (abfd, hplink->srelgot,
+				  (SEC_ALLOC
+				   | SEC_LOAD
+				   | SEC_HAS_CONTENTS
+				   | SEC_IN_MEMORY
+				   | SEC_LINKER_CREATED
+				   | SEC_READONLY))
+      || ! bfd_set_section_alignment (abfd, hplink->srelgot, 2))
+    return false;
 
-  if (1)
+  hplink->sdynbss = bfd_get_section_by_name (abfd, ".dynbss");
+  hplink->srelbss = bfd_get_section_by_name (abfd, ".rela.bss");
+
+  return true;
+}
+
+/* Look through the relocs for a section during the first phase, and
+   allocate space in the global offset table or procedure linkage
+   table.  At this point we haven't necessarily read all the input
+   files.  */
+
+static boolean
+elf32_hppa_check_relocs (abfd, info, sec, relocs)
+     bfd *abfd;
+     struct bfd_link_info *info;
+     asection *sec;
+     const Elf_Internal_Rela *relocs;
+{
+  bfd *dynobj;
+  Elf_Internal_Shdr *symtab_hdr;
+  struct elf_link_hash_entry **sym_hashes;
+  bfd_signed_vma *local_got_refcounts;
+  const Elf_Internal_Rela *rel;
+  const Elf_Internal_Rela *rel_end;
+  struct elf32_hppa_link_hash_table *hplink;
+  asection *sreloc;
+  asection *stubreloc;
+
+  if (info->relocateable)
+    return true;
+
+  hplink = hppa_link_hash_table (info);
+  dynobj = hplink->root.dynobj;
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (abfd);
+  local_got_refcounts = elf_local_got_refcounts (abfd);
+  sreloc = NULL;
+  stubreloc = NULL;
+
+  rel_end = relocs + sec->reloc_count;
+  for (rel = relocs; rel < rel_end; rel++)
     {
-      /* Create one of two variant long branch stubs.  One for $$dyncall and
-	 normal calls, the other for calls to millicode.  */
-      unsigned long insn;
-      int millicode_call = 0;
+      enum {
+	NEED_GOT = 1,
+	NEED_PLT = 2,
+	NEED_DYNREL = 4,
+#if LONG_BRANCH_PIC_IN_SHLIB
+	NEED_STUBREL = 0,  /* We won't be needing them in this case.  */
+#else
+	NEED_STUBREL = 8,
+#endif
+	PLT_PLABEL = 16
+      };
 
-      if (!strncmp ("$$", sym_name, 2) && strcmp ("$$dyncall", sym_name))
-	millicode_call = 1;
+      unsigned int r_symndx, r_type;
+      struct elf32_hppa_link_hash_entry *h;
+      int need_entry;
 
-      /* First the return pointer adjustment.  Depending on exact calling
-	 sequence this instruction may be skipped.  */
-      bfd_put_32 (stub_bfd, LDO_M4_R31_R31, loc);
+      r_symndx = ELF32_R_SYM (rel->r_info);
 
-      /* The next two instructions are the long branch itself.  A long branch
-	 is formed with "ldil" loading the upper bits of the target address
-	 into a register, then branching with "be" which adds in the lower bits.
-	 Long branches to millicode nullify the delay slot of the "be".  */
-      insn = hppa_rebuild_insn (stub_bfd, LDIL_R1,
-				hppa_field_adjust (sym_value, 0, e_lrsel), 21);
-      bfd_put_32 (stub_bfd, insn, loc + 4);
-      insn = hppa_rebuild_insn (stub_bfd, BE_SR4_R1 | (millicode_call ? 2 : 0),
-				hppa_field_adjust (sym_value, 0, e_rrsel) >> 2,
-				17);
-      bfd_put_32 (stub_bfd, insn, loc + 8);
+      if (r_symndx < symtab_hdr->sh_info)
+	h = NULL;
+      else
+	h = ((struct elf32_hppa_link_hash_entry *)
+	     sym_hashes[r_symndx - symtab_hdr->sh_info]);
 
-      if (!millicode_call)
+      r_type = ELF32_R_TYPE (rel->r_info);
+
+      switch (r_type)
 	{
-	  /* The sequence to call this stub places the return pointer into %r31,
-	     the final target expects the return pointer in %r2, so copy the
-	      return pointer into the proper register.  */
-	  bfd_put_32 (stub_bfd, COPY_R31_R2, loc + 12);
+	case R_PARISC_DLTIND14F:
+	case R_PARISC_DLTIND14R:
+	case R_PARISC_DLTIND21L:
+	  /* This symbol requires a global offset table entry.  */
+	  need_entry = NEED_GOT;
 
-	  /* Update the location and offsets.  */
-	  stub_hash_table->location += 16;
-	  stub_hash_table->offset += 16;
+	  /* Mark this section as containing PIC code.  */
+	  sec->flags |= SEC_HAS_GOT_REF;
+	  break;
+
+	case R_PARISC_PLABEL14R: /* "Official" procedure labels.  */
+	case R_PARISC_PLABEL21L:
+	case R_PARISC_PLABEL32:
+	  /* If the addend is non-zero, we break badly.  */
+	  BFD_ASSERT (rel->r_addend == 0);
+
+	  /* If we are creating a shared library, then we need to
+	     create a PLT entry for all PLABELs, because PLABELs with
+	     local symbols may be passed via a pointer to another
+	     object.  Additionally, output a dynamic relocation
+	     pointing to the PLT entry.  */
+	  need_entry = PLT_PLABEL | NEED_PLT | NEED_DYNREL;
+	  break;
+
+	case R_PARISC_PCREL12F:
+	  hplink->has_12bit_branch = 1;
+	  /* Fall thru.  */
+	case R_PARISC_PCREL17C:
+	case R_PARISC_PCREL17F:
+	  hplink->has_17bit_branch = 1;
+	  /* Fall thru.  */
+	case R_PARISC_PCREL22F:
+	  /* Function calls might need to go through the .plt, and
+	     might require long branch stubs.  */
+	  if (h == NULL)
+	    {
+	      /* We know local syms won't need a .plt entry, and if
+		 they need a long branch stub we can't guarantee that
+		 we can reach the stub.  So just flag an error later
+		 if we're doing a shared link and find we need a long
+		 branch stub.  */
+	      continue;
+	    }
+	  else
+	    {
+	      /* Global symbols will need a .plt entry if they remain
+		 global, and in most cases won't need a long branch
+		 stub.  Unfortunately, we have to cater for the case
+		 where a symbol is forced local by versioning, or due
+		 to symbolic linking, and we lose the .plt entry.  */
+	      need_entry = NEED_PLT | NEED_STUBREL;
+	    }
+	  break;
+
+	case R_PARISC_SEGBASE: /* Used to set segment base.  */
+	case R_PARISC_SEGREL32: /* Relative reloc.  */
+	case R_PARISC_PCREL14F: /* PC relative load/store.  */
+	case R_PARISC_PCREL14R:
+	case R_PARISC_PCREL17R: /* External branches.  */
+	case R_PARISC_PCREL21L: /* As above, and for load/store too.  */
+	  /* We don't need to propagate the relocation if linking a
+	     shared object since these are section relative.  */
+	  continue;
+
+	case R_PARISC_DPREL14F: /* Used for gp rel data load/store.  */
+	case R_PARISC_DPREL14R:
+	case R_PARISC_DPREL21L:
+	  if (info->shared)
+	    {
+	      (*_bfd_error_handler)
+		(_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"),
+		 bfd_get_filename (abfd),
+		 elf_hppa_howto_table[r_type].name);
+	      bfd_set_error (bfd_error_bad_value);
+	      return false;
+	    }
+	  /* Fall through.  */
+
+	case R_PARISC_DIR17F: /* Used for external branches.  */
+	case R_PARISC_DIR17R:
+	case R_PARISC_DIR14F: /* Used for load/store from absolute locn.  */
+	case R_PARISC_DIR14R:
+	case R_PARISC_DIR21L: /* As above, and for ext branches too.  */
+#if 1
+	  /* Help debug shared library creation.  Any of the above
+	     relocs can be used in shared libs, but they may cause
+	     pages to become unshared.  */
+	  if (info->shared)
+	    {
+	      (*_bfd_error_handler)
+		(_("%s: relocation %s should not be used when making a shared object; recompile with -fPIC"),
+		 bfd_get_filename (abfd),
+		 elf_hppa_howto_table[r_type].name);
+	    }
+	  /* Fall through.  */
+#endif
+
+	case R_PARISC_DIR32: /* .word, PARISC.unwind relocs.  */
+	  /* We may want to output a dynamic relocation later.  */
+	  need_entry = NEED_DYNREL;
+	  break;
+
+	  /* This relocation describes the C++ object vtable hierarchy.
+	     Reconstruct it for later use during GC.  */
+	case R_PARISC_GNU_VTINHERIT:
+	  if (!_bfd_elf32_gc_record_vtinherit (abfd, sec,
+					       &h->elf, rel->r_offset))
+	    return false;
+	  continue;
+
+	  /* This relocation describes which C++ vtable entries are actually
+	     used.  Record for later use during GC.  */
+	case R_PARISC_GNU_VTENTRY:
+	  if (!_bfd_elf32_gc_record_vtentry (abfd, sec,
+					     &h->elf, rel->r_addend))
+	    return false;
+	  continue;
+
+	default:
+	  continue;
+	}
+
+      /* Now carry out our orders.  */
+      if (need_entry & NEED_GOT)
+	{
+	  /* Allocate space for a GOT entry, as well as a dynamic
+	     relocation for this entry.  */
+	  if (dynobj == NULL)
+	    hplink->root.dynobj = dynobj = abfd;
+
+	  if (hplink->sgot == NULL)
+	    {
+	      if (! elf32_hppa_create_dynamic_sections (dynobj, info))
+		return false;
+	    }
+
+	  if (h != NULL)
+	    {
+	      if (h->elf.got.refcount == -1)
+		{
+		  h->elf.got.refcount = 1;
+
+		  /* Make sure this symbol is output as a dynamic symbol.  */
+		  if (h->elf.dynindx == -1)
+		    {
+		      if (! bfd_elf32_link_record_dynamic_symbol (info,
+								  &h->elf))
+			return false;
+		    }
+
+		  hplink->sgot->_raw_size += GOT_ENTRY_SIZE;
+		  hplink->srelgot->_raw_size += sizeof (Elf32_External_Rela);
+		}
+	      else
+		h->elf.got.refcount += 1;
+	    }
+	  else
+	    {
+	      /* This is a global offset table entry for a local symbol.  */
+	      if (local_got_refcounts == NULL)
+		{
+		  size_t size;
+
+		  /* Allocate space for local got offsets and local
+		     plt offsets.  Done this way to save polluting
+		     elf_obj_tdata with another target specific
+		     pointer.  */
+		  size = symtab_hdr->sh_info * 2 * sizeof (bfd_signed_vma);
+		  local_got_refcounts = ((bfd_signed_vma *)
+					 bfd_alloc (abfd, size));
+		  if (local_got_refcounts == NULL)
+		    return false;
+		  elf_local_got_refcounts (abfd) = local_got_refcounts;
+		  memset (local_got_refcounts, -1, size);
+		}
+	      if (local_got_refcounts[r_symndx] == -1)
+		{
+		  local_got_refcounts[r_symndx] = 1;
+
+		  hplink->sgot->_raw_size += GOT_ENTRY_SIZE;
+		  if (info->shared)
+		    {
+		      /* If we are generating a shared object, we need to
+			 output a reloc so that the dynamic linker can
+			 adjust this GOT entry (because the address
+			 the shared library is loaded at is not fixed).  */
+		      hplink->srelgot->_raw_size +=
+			sizeof (Elf32_External_Rela);
+		    }
+		}
+	      else
+		local_got_refcounts[r_symndx] += 1;
+	    }
+	}
+
+      if (need_entry & NEED_PLT)
+	{
+	  /* If we are creating a shared library, and this is a reloc
+	     against a weak symbol or a global symbol in a dynamic
+	     object, then we will be creating an import stub and a
+	     .plt entry for the symbol.  Similarly, on a normal link
+	     to symbols defined in a dynamic object we'll need the
+	     import stub and a .plt entry.  We don't know yet whether
+	     the symbol is defined or not, so make an entry anyway and
+	     clean up later in adjust_dynamic_symbol.  */
+	  if ((sec->flags & SEC_ALLOC) != 0)
+	    {
+	      if (h != NULL)
+		{
+		  if (h->elf.plt.refcount == -1)
+		    {
+		      h->elf.plt.refcount = 1;
+		      h->elf.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+		    }
+		  else
+		    h->elf.plt.refcount += 1;
+
+		  /* If this .plt entry is for a plabel, mark it so
+		     that adjust_dynamic_symbol will keep the entry
+		     even if it appears to be local.  */
+		  if (need_entry & PLT_PLABEL)
+		    h->plabel = 1;
+		}
+	      else if (need_entry & PLT_PLABEL)
+		{
+		  int indx;
+
+		  if (local_got_refcounts == NULL)
+		    {
+		      size_t size;
+
+		      /* Allocate space for local got offsets and local
+			 plt offsets.  */
+		      size = symtab_hdr->sh_info * 2 * sizeof (bfd_signed_vma);
+		      local_got_refcounts = ((bfd_signed_vma *)
+					     bfd_alloc (abfd, size));
+		      if (local_got_refcounts == NULL)
+			return false;
+		      elf_local_got_refcounts (abfd) = local_got_refcounts;
+		      memset (local_got_refcounts, -1, size);
+		    }
+		  indx = r_symndx + symtab_hdr->sh_info;
+		  if (local_got_refcounts[indx] == -1)
+		    local_got_refcounts[indx] = 1;
+		  else
+		    local_got_refcounts[indx] += 1;
+		}
+	    }
+	}
+
+      if (need_entry & (NEED_DYNREL | NEED_STUBREL))
+	{
+	  /* Flag this symbol as having a non-got, non-plt reference
+	     so that we generate copy relocs if it turns out to be
+	     dynamic.  */
+	  if (h != NULL)
+	    h->elf.elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+
+	  /* If we are creating a shared library then we need to copy
+	     the reloc into the shared library.  However, if we are
+	     linking with -Bsymbolic, we need only copy absolute
+	     relocs or relocs against symbols that are not defined in
+	     an object we are including in the link.  PC- or DP- or
+	     DLT-relative relocs against any local sym or global sym
+	     with DEF_REGULAR set, can be discarded.  At this point we
+	     have not seen all the input files, so it is possible that
+	     DEF_REGULAR is not set now but will be set later (it is
+	     never cleared).  We account for that possibility below by
+	     storing information in the reloc_entries field of the
+	     hash table entry.
+
+	     A similar situation to the -Bsymbolic case occurs when
+	     creating shared libraries and symbol visibility changes
+	     render the symbol local.
+
+	     As it turns out, all the relocs we will be creating here
+	     are absolute, so we cannot remove them on -Bsymbolic
+	     links or visibility changes anyway.  A STUB_REL reloc
+	     is absolute too, as in that case it is the reloc in the
+	     stub we will be creating, rather than copying the PCREL
+	     reloc in the branch.  */
+	  if ((sec->flags & SEC_ALLOC) != 0
+	      && info->shared
+#if RELATIVE_DYNAMIC_RELOCS
+	      && (!info->symbolic
+		  || is_absolute_reloc (r_type)
+		  || (h != NULL
+		      && ((h->elf.elf_link_hash_flags
+			   & ELF_LINK_HASH_DEF_REGULAR) == 0)))
+#endif
+	      )
+	    {
+	      boolean doit;
+	      asection *srel;
+
+	      srel = sreloc;
+	      if ((need_entry & NEED_STUBREL))
+		srel = stubreloc;
+
+	      /* Create a reloc section in dynobj and make room for
+		 this reloc.  */
+	      if (srel == NULL)
+		{
+		  char *name;
+
+		  if (dynobj == NULL)
+		    hplink->root.dynobj = dynobj = abfd;
+
+		  name = bfd_elf_string_from_elf_section
+		    (abfd,
+		     elf_elfheader (abfd)->e_shstrndx,
+		     elf_section_data (sec)->rel_hdr.sh_name);
+		  if (name == NULL)
+		    {
+		      (*_bfd_error_handler)
+			(_("Could not find relocation section for %s"),
+			 sec->name);
+		      bfd_set_error (bfd_error_bad_value);
+		      return false;
+		    }
+
+		  if ((need_entry & NEED_STUBREL))
+		    {
+		      size_t len = strlen (name) + sizeof (STUB_SUFFIX);
+		      char *newname = bfd_malloc (len);
+
+		      if (newname == NULL)
+			return false;
+		      strcpy (newname, name);
+		      strcpy (newname + len - sizeof (STUB_SUFFIX),
+			      STUB_SUFFIX);
+		      name = newname;
+		    }
+
+		  srel = bfd_get_section_by_name (dynobj, name);
+		  if (srel == NULL)
+		    {
+		      flagword flags;
+
+		      srel = bfd_make_section (dynobj, name);
+		      flags = (SEC_HAS_CONTENTS | SEC_READONLY
+			       | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+		      if ((sec->flags & SEC_ALLOC) != 0)
+			flags |= SEC_ALLOC | SEC_LOAD;
+		      if (srel == NULL
+			  || !bfd_set_section_flags (dynobj, srel, flags)
+			  || !bfd_set_section_alignment (dynobj, srel, 2))
+			return false;
+		    }
+		  else if ((need_entry & NEED_STUBREL))
+		    free (name);
+
+		  if ((need_entry & NEED_STUBREL))
+		    stubreloc = srel;
+		  else
+		    sreloc = srel;
+		}
+
+#if ! LONG_BRANCH_PIC_IN_SHLIB
+	      /* If this is a function call, we only need one dynamic
+		 reloc for the stub as all calls to a particular
+		 function will go through the same stub.  Actually, a
+		 long branch stub needs two relocations, but we count
+		 on some intelligence on the part of the dynamic
+		 linker.  */
+	      if ((need_entry & NEED_STUBREL))
+		{
+		  doit = h->stub_reloc_sec != stubreloc;
+		  h->stub_reloc_sec = stubreloc;
+		}
+	      else
+#endif
+		doit = 1;
+
+	      if (doit)
+		{
+		  srel->_raw_size += sizeof (Elf32_External_Rela);
+
+#if ! LONG_BRANCH_PIC_IN_SHLIB || RELATIVE_DYNAMIC_RELOCS
+		  /* Keep track of relocations we have entered for
+		     this global symbol, so that we can discard them
+		     later if necessary.  */
+		  if (h != NULL
+		      && (0
+#if RELATIVE_DYNAMIC_RELOCS
+			  || ! is_absolute_reloc (rtype)
+#endif
+			  || (need_entry & NEED_STUBREL)))
+		    {
+		      struct elf32_hppa_dyn_reloc_entry *p;
+
+		      for (p = h->reloc_entries; p != NULL; p = p->next)
+			if (p->section == srel)
+			  break;
+
+		      if (p == NULL)
+			{
+			  p = ((struct elf32_hppa_dyn_reloc_entry *)
+			       bfd_alloc (dynobj, sizeof *p));
+			  if (p == NULL)
+			    return false;
+			  p->next = h->reloc_entries;
+			  h->reloc_entries = p;
+			  p->section = srel;
+			  p->count = 0;
+			}
+
+		      /* NEED_STUBREL and NEED_DYNREL are never both
+			 set.  Leave the count at zero for the
+			 NEED_STUBREL case as we only ever have one
+			 stub reloc per section per symbol, and this
+			 simplifies code in hppa_discard_copies.  */
+		      if (! (need_entry & NEED_STUBREL))
+			++p->count;
+		    }
+#endif
+		}
+	    }
+	}
+    }
+
+  return true;
+}
+
+/* Return the section that should be marked against garbage collection
+   for a given relocation.  */
+
+static asection *
+elf32_hppa_gc_mark_hook (abfd, info, rel, h, sym)
+     bfd *abfd;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     Elf_Internal_Rela *rel;
+     struct elf_link_hash_entry *h;
+     Elf_Internal_Sym *sym;
+{
+  if (h != NULL)
+    {
+      switch ((unsigned int) ELF32_R_TYPE (rel->r_info))
+	{
+	case R_PARISC_GNU_VTINHERIT:
+	case R_PARISC_GNU_VTENTRY:
+	  break;
+
+	default:
+	  switch (h->root.type)
+	    {
+	    case bfd_link_hash_defined:
+	    case bfd_link_hash_defweak:
+	      return h->root.u.def.section;
+
+	    case bfd_link_hash_common:
+	      return h->root.u.c.p->section;
+
+	    default:
+	      break;
+	    }
+	}
+    }
+  else
+    {
+      if (!(elf_bad_symtab (abfd)
+	    && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
+	  && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
+		&& sym->st_shndx != SHN_COMMON))
+	{
+	  return bfd_section_from_elf_index (abfd, sym->st_shndx);
+	}
+    }
+
+  return NULL;
+}
+
+/* Update the got and plt entry reference counts for the section being
+   removed.  */
+
+static boolean
+elf32_hppa_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;
+  bfd_signed_vma *local_got_refcounts;
+  bfd_signed_vma *local_plt_refcounts;
+  const Elf_Internal_Rela *rel, *relend;
+  unsigned long r_symndx;
+  struct elf_link_hash_entry *h;
+  struct elf32_hppa_link_hash_table *hplink;
+  bfd *dynobj;
+  asection *sgot;
+  asection *srelgot;
+
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (abfd);
+  local_got_refcounts = elf_local_got_refcounts (abfd);
+  local_plt_refcounts = local_got_refcounts;
+  if (local_plt_refcounts != NULL)
+    local_plt_refcounts += symtab_hdr->sh_info;
+  hplink = hppa_link_hash_table (info);
+  dynobj = hplink->root.dynobj;
+  if (dynobj == NULL)
+    return true;
+
+  sgot = hplink->sgot;
+  srelgot = hplink->srelgot;
+
+  relend = relocs + sec->reloc_count;
+  for (rel = relocs; rel < relend; rel++)
+    switch ((unsigned int) ELF32_R_TYPE (rel->r_info))
+      {
+      case R_PARISC_DLTIND14F:
+      case R_PARISC_DLTIND14R:
+      case R_PARISC_DLTIND21L:
+	r_symndx = ELF32_R_SYM (rel->r_info);
+	if (r_symndx >= symtab_hdr->sh_info)
+	  {
+	    h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	    if (h->got.refcount > 0)
+	      {
+		h->got.refcount -= 1;
+		if (h->got.refcount == 0)
+		  {
+		    sgot->_raw_size -= GOT_ENTRY_SIZE;
+		    srelgot->_raw_size -= sizeof (Elf32_External_Rela);
+		  }
+	      }
+	  }
+	else if (local_got_refcounts != NULL)
+	  {
+	    if (local_got_refcounts[r_symndx] > 0)
+	      {
+		local_got_refcounts[r_symndx] -= 1;
+		if (local_got_refcounts[r_symndx] == 0)
+		  {
+		    sgot->_raw_size -= GOT_ENTRY_SIZE;
+		    if (info->shared)
+		      srelgot->_raw_size -= sizeof (Elf32_External_Rela);
+		  }
+	      }
+	  }
+	break;
+
+      case R_PARISC_PCREL12F:
+      case R_PARISC_PCREL17C:
+      case R_PARISC_PCREL17F:
+      case R_PARISC_PCREL22F:
+	r_symndx = ELF32_R_SYM (rel->r_info);
+	if (r_symndx >= symtab_hdr->sh_info)
+	  {
+	    h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	    if (h->plt.refcount > 0)
+	      h->plt.refcount -= 1;
+	  }
+	break;
+
+      case R_PARISC_PLABEL14R:
+      case R_PARISC_PLABEL21L:
+      case R_PARISC_PLABEL32:
+	r_symndx = ELF32_R_SYM (rel->r_info);
+	if (r_symndx >= symtab_hdr->sh_info)
+	  {
+	    h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	    if (h->plt.refcount > 0)
+	      h->plt.refcount -= 1;
+	  }
+	else if (local_plt_refcounts != NULL)
+	  {
+	    if (local_plt_refcounts[r_symndx] > 0)
+	      local_plt_refcounts[r_symndx] -= 1;
+	  }
+	break;
+
+      default:
+	break;
+      }
+
+  return true;
+}
+
+/* Our own version of hide_symbol, so that we can keep plt entries for
+   plabels.  */
+
+static void
+elf32_hppa_hide_symbol (info, h)
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     struct elf_link_hash_entry *h;
+{
+  h->dynindx = -1;
+  if (! ((struct elf32_hppa_link_hash_entry *) h)->plabel)
+    {
+      h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+      h->plt.offset = (bfd_vma) -1;
+    }
+}
+
+/* Adjust a symbol defined by a dynamic object and referenced by a
+   regular object.  The current definition is in some section of the
+   dynamic object, but we're not including those sections.  We have to
+   change the definition to something the rest of the link can
+   understand.  */
+
+static boolean
+elf32_hppa_adjust_dynamic_symbol (info, h)
+     struct bfd_link_info *info;
+     struct elf_link_hash_entry *h;
+{
+  bfd *dynobj;
+  struct elf32_hppa_link_hash_table *hplink;
+  asection *s;
+
+  hplink = hppa_link_hash_table (info);
+  dynobj = hplink->root.dynobj;
+
+  /* If this is a function, put it in the procedure linkage table.  We
+     will fill in the contents of the procedure linkage table later,
+     when we know the address of the .got section.  */
+  if (h->type == STT_FUNC
+      || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
+    {
+      if (h->plt.refcount <= 0
+	  || ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
+	      && h->root.type != bfd_link_hash_defweak
+	      && ! ((struct elf32_hppa_link_hash_entry *) h)->plabel
+	      && (!info->shared || info->symbolic)))
+	{
+	  /* The .plt entry is not needed when:
+	     a) Garbage collection has removed all references to the
+	     symbol, or
+	     b) We know for certain the symbol is defined in this
+	     object, and it's not a weak definition, nor is the symbol
+	     used by a plabel relocation.  Either this object is the
+	     application or we are doing a shared symbolic link.  */
+
+	  /* As a special sop to the hppa ABI, we keep a .plt entry
+	     for functions in sections containing PIC code.  */
+	  if (!info->shared
+	      && h->plt.refcount > 0
+	      && (h->root.type == bfd_link_hash_defined
+		  || h->root.type == bfd_link_hash_defweak)
+	      && (h->root.u.def.section->flags & SEC_HAS_GOT_REF) != 0)
+	    {
+	      ((struct elf32_hppa_link_hash_entry *) h)->pic_call = 1;
+	    }
+	  else
+	    {
+	      h->plt.offset = (bfd_vma) -1;
+	      h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+	      return true;
+	    }
+	}
+
+      /* Make an entry in the .plt section.  */
+      s = hplink->splt;
+      h->plt.offset = s->_raw_size;
+      if (PLABEL_PLT_ENTRY_SIZE != PLT_ENTRY_SIZE
+	  && ((struct elf32_hppa_link_hash_entry *) h)->plabel
+	  && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+	{
+	  /* Add some extra space for the dynamic linker to use.  */
+	  s->_raw_size += PLABEL_PLT_ENTRY_SIZE;
 	}
       else
+	s->_raw_size += PLT_ENTRY_SIZE;
+
+      if (! ((struct elf32_hppa_link_hash_entry *) h)->pic_call)
 	{
-	  /* Update the location and offsets.  */
-	  stub_hash_table->location += 12;
-	  stub_hash_table->offset += 12;
+	  /* Make sure this symbol is output as a dynamic symbol.  */
+	  if (h->dynindx == -1
+	      && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+	    {
+	      if (! bfd_elf32_link_record_dynamic_symbol (info, h))
+		return false;
+	    }
+
+	  /* We also need to make an entry in the .rela.plt section.  */
+	  s = hplink->srelplt;
+	  s->_raw_size += sizeof (Elf32_External_Rela);
+
+	  hplink->need_plt_stub = 1;
+	}
+      return true;
+    }
+
+  /* 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->weakdef != NULL)
+    {
+      BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
+		  || h->weakdef->root.type == bfd_link_hash_defweak);
+      h->root.u.def.section = h->weakdef->root.u.def.section;
+      h->root.u.def.value = h->weakdef->root.u.def.value;
+      return true;
+    }
+
+  /* This is a reference to a symbol defined by a dynamic object which
+     is not a function.  */
+
+  /* If we are creating a shared library, we must presume that the
+     only references to the symbol are via the global offset table.
+     For such cases we need not do anything here; the relocations will
+     be handled correctly by relocate_section.  */
+  if (info->shared)
+    return true;
+
+  /* If there are no references to this symbol that do not use the
+     GOT, we don't need to generate a copy reloc.  */
+  if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
+    return true;
+
+  /* We must allocate the symbol in our .dynbss section, which will
+     become part of the .bss section of the executable.  There will be
+     an entry for this symbol in the .dynsym section.  The dynamic
+     object will contain position independent code, so all references
+     from the dynamic object to this symbol will go through the global
+     offset table.  The dynamic linker will use the .dynsym entry to
+     determine the address it must put in the global offset table, so
+     both the dynamic object and the regular object will refer to the
+     same memory location for the variable.  */
+
+  s = hplink->sdynbss;
+
+  /* We must generate a COPY reloc to tell the dynamic linker to
+     copy the initial value out of the dynamic object and into the
+     runtime process image.  We need to remember the offset into the
+     .rela.bss section we are going to use.  */
+  if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
+    {
+      asection *srel;
+
+      srel = hplink->srelbss;
+      srel->_raw_size += sizeof (Elf32_External_Rela);
+      h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
+    }
+
+  {
+    /* We need to figure out the alignment required for this symbol.  I
+       have no idea how other ELF linkers handle this.  */
+    unsigned int power_of_two;
+
+    power_of_two = bfd_log2 (h->size);
+    if (power_of_two > 3)
+      power_of_two = 3;
+
+    /* Apply the required alignment.  */
+    s->_raw_size = BFD_ALIGN (s->_raw_size,
+			      (bfd_size_type) (1 << power_of_two));
+    if (power_of_two > bfd_get_section_alignment (dynobj, s))
+      {
+	if (! bfd_set_section_alignment (dynobj, s, power_of_two))
+	  return false;
+      }
+  }
+  /* Define the symbol as being at this point in the section.  */
+  h->root.u.def.section = s;
+  h->root.u.def.value = s->_raw_size;
+
+  /* Increment the section size to make room for the symbol.  */
+  s->_raw_size += h->size;
+
+  return true;
+}
+
+/* Called via elf_link_hash_traverse to create .plt entries for an
+   application that uses statically linked PIC functions.  Similar to
+   the first part of elf32_hppa_adjust_dynamic_symbol.  */
+
+static boolean
+hppa_handle_PIC_calls (h, inf)
+     struct elf_link_hash_entry *h;
+     PTR inf;
+{
+  struct bfd_link_info *info;
+  bfd *dynobj;
+  struct elf32_hppa_link_hash_table *hplink;
+  asection *s;
+
+  if (! (h->plt.refcount > 0
+	 && (h->root.type == bfd_link_hash_defined
+	     || h->root.type == bfd_link_hash_defweak)
+	 && (h->root.u.def.section->flags & SEC_HAS_GOT_REF) != 0))
+    {
+      h->plt.offset = (bfd_vma) -1;
+      h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+      return true;
+    }
+
+  h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+  ((struct elf32_hppa_link_hash_entry *) h)->pic_call = 1;
+
+  info = (struct bfd_link_info *) inf;
+  hplink = hppa_link_hash_table (info);
+  dynobj = hplink->root.dynobj;
+
+  /* Make an entry in the .plt section.  */
+  s = hplink->splt;
+  h->plt.offset = s->_raw_size;
+  s->_raw_size += PLT_ENTRY_SIZE;
+
+  return true;
+}
+
+#if ((! LONG_BRANCH_PIC_IN_SHLIB && LONG_BRANCH_VIA_PLT) \
+     || RELATIVE_DYNAMIC_RELOCS)
+/* This function is called via elf_link_hash_traverse to discard space
+   we allocated for relocs that it turned out we didn't need.  */
+
+static boolean
+hppa_discard_copies (h, inf)
+     struct elf_link_hash_entry *h;
+     PTR inf;
+{
+  struct elf32_hppa_dyn_reloc_entry *s;
+  struct elf32_hppa_link_hash_entry *eh;
+  struct bfd_link_info *info;
+
+  eh = (struct elf32_hppa_link_hash_entry *) h;
+  info = (struct bfd_link_info *) inf;
+
+#if ! LONG_BRANCH_PIC_IN_SHLIB && LONG_BRANCH_VIA_PLT
+  /* Handle the stub reloc case.  If we have a plt entry for the
+     function, we won't be needing long branch stubs.  s->count will
+     only be zero for stub relocs, which provides a handy way of
+     flagging these relocs, and means we need do nothing special for
+     the forced local and symbolic link case.  */
+  if (eh->stub_reloc_sec != NULL
+      && eh->elf.plt.offset != (bfd_vma) -1)
+    {
+      for (s = eh->reloc_entries; s != NULL; s = s->next)
+	if (s->count == 0)
+	  s->section->_raw_size -= sizeof (Elf32_External_Rela);
+    }
+#endif
+
+#if RELATIVE_DYNAMIC_RELOCS
+  /* If a symbol has been forced local or we have found a regular
+     definition for the symbolic link case, then we won't be needing
+     any relocs.  */
+  if (eh->elf.dynindx == -1
+      || ((eh->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
+	  && !is_absolute_reloc (r_type)
+	  && info->symbolic))
+    {
+      for (s = eh->reloc_entries; s != NULL; s = s->next)
+	s->section->_raw_size -= s->count * sizeof (Elf32_External_Rela);
+    }
+#endif
+
+  return true;
+}
+#endif
+
+/* This function is called via elf_link_hash_traverse to force
+   millicode symbols local so they do not end up as globals in the
+   dynamic symbol table.  We ought to be able to do this in
+   adjust_dynamic_symbol, but our adjust_dynamic_symbol is not called
+   for all dynamic symbols.  Arguably, this is a bug in
+   elf_adjust_dynamic_symbol.  */
+
+static boolean
+clobber_millicode_symbols (h, info)
+     struct elf_link_hash_entry *h;
+     struct bfd_link_info *info;
+{
+  /* Note!  We only want to remove these from the dynamic symbol
+     table.  Therefore we do not set ELF_LINK_FORCED_LOCAL.  */
+  if (h->type == STT_PARISC_MILLI)
+    elf32_hppa_hide_symbol(info, h);
+  return true;
+}
+
+/* Set the sizes of the dynamic sections.  */
+
+static boolean
+elf32_hppa_size_dynamic_sections (output_bfd, info)
+     bfd *output_bfd;
+     struct bfd_link_info *info;
+{
+  struct elf32_hppa_link_hash_table *hplink;
+  bfd *dynobj;
+  asection *s;
+  boolean relocs;
+  boolean reltext;
+
+  hplink = hppa_link_hash_table (info);
+  dynobj = hplink->root.dynobj;
+  BFD_ASSERT (dynobj != NULL);
+
+  if (hplink->root.dynamic_sections_created)
+    {
+      const char *funcname;
+      bfd *i;
+
+      /* Set the contents of the .interp section to the interpreter.  */
+      if (! info->shared)
+	{
+	  s = bfd_get_section_by_name (dynobj, ".interp");
+	  BFD_ASSERT (s != NULL);
+	  s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
+	  s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
 	}
 
+      /* Force millicode symbols local.  */
+      elf_link_hash_traverse (&hplink->root,
+			      clobber_millicode_symbols,
+			      info);
+
+      /* DT_INIT and DT_FINI need a .plt entry.  Make sure they have
+	 one.  */
+      funcname = info->init_function;
+      while (1)
+	{
+	  if (funcname != NULL)
+	    {
+	      struct elf_link_hash_entry *h;
+
+	      h = elf_link_hash_lookup (&hplink->root,
+					funcname,
+					false, false, false);
+	      if (h != NULL
+		  && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
+						| ELF_LINK_HASH_DEF_REGULAR)))
+		{
+		  if (h->plt.refcount <= 0)
+		    {
+		      h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+
+		      /* Make an entry in the .plt section.  We know
+			 the function doesn't have a plabel by the
+			 refcount.  */
+		      s = hplink->splt;
+		      h->plt.offset = s->_raw_size;
+		      s->_raw_size += PLT_ENTRY_SIZE;
+
+		      /* Make sure this symbol is output as a dynamic
+			 symbol.  */
+		      if (h->dynindx == -1)
+			{
+			  if (! bfd_elf32_link_record_dynamic_symbol (info, h))
+			    return false;
+			}
+
+		      /* Make an entry for the reloc too.  */
+		      s = hplink->srelplt;
+		      s->_raw_size += sizeof (Elf32_External_Rela);
+		    }
+
+		  ((struct elf32_hppa_link_hash_entry *) h)->plt_abs = 1;
+		}
+	    }
+	  if (funcname == info->fini_function)
+	    break;
+	  funcname = info->fini_function;
+	}
+
+      /* Set up .plt offsets for local plabels.  */
+      for (i = info->input_bfds; i; i = i->link_next)
+	{
+	  bfd_signed_vma *local_plt;
+	  bfd_signed_vma *end_local_plt;
+	  bfd_size_type locsymcount;
+	  Elf_Internal_Shdr *symtab_hdr;
+
+	  local_plt = elf_local_got_refcounts (i);
+	  if (!local_plt)
+	    continue;
+
+	  symtab_hdr = &elf_tdata (i)->symtab_hdr;
+	  locsymcount = symtab_hdr->sh_info;
+	  local_plt += locsymcount;
+	  end_local_plt = local_plt + locsymcount;
+
+	  for (; local_plt < end_local_plt; ++local_plt)
+	    {
+	      if (*local_plt > 0)
+		{
+		  s = hplink->splt;
+		  *local_plt = s->_raw_size;
+		  s->_raw_size += PLT_ENTRY_SIZE;
+		  if (info->shared)
+		    hplink->srelplt->_raw_size += sizeof (Elf32_External_Rela);
+		}
+	      else
+		*local_plt = (bfd_vma) -1;
+	    }
+	}
     }
+  else
+    {
+      /* Run through the function symbols, looking for any that are
+	 PIC, and allocate space for the necessary .plt entries so
+	 that %r19 will be set up.  */
+      if (! info->shared)
+	elf_link_hash_traverse (&hplink->root,
+				hppa_handle_PIC_calls,
+				info);
+
+      /* We may have created entries in the .rela.got section.
+	 However, if we are not creating the dynamic sections, we will
+	 not actually use these entries.  Reset the size of .rela.got,
+	 which will cause it to get stripped from the output file
+	 below.  */
+      hplink->srelgot->_raw_size = 0;
+    }
+
+#if ((! LONG_BRANCH_PIC_IN_SHLIB && LONG_BRANCH_VIA_PLT) \
+     || RELATIVE_DYNAMIC_RELOCS)
+  /* If this is a -Bsymbolic shared link, then we need to discard all
+     relocs against symbols defined in a regular object.  We also need
+     to lose relocs we've allocated for long branch stubs if we know
+     we won't be generating a stub.  */
+  if (info->shared)
+    elf_link_hash_traverse (&hplink->root,
+			    hppa_discard_copies,
+			    info);
+#endif
+
+  /* The check_relocs and adjust_dynamic_symbol entry points have
+     determined the sizes of the various dynamic sections.  Allocate
+     memory for them.  */
+  relocs = false;
+  reltext = false;
+  for (s = dynobj->sections; s != NULL; s = s->next)
+    {
+      const char *name;
+
+      if ((s->flags & SEC_LINKER_CREATED) == 0)
+	continue;
+
+      /* It's OK to base decisions on the section name, because none
+	 of the dynobj section names depend upon the input files.  */
+      name = bfd_get_section_name (dynobj, s);
+
+      if (strncmp (name, ".rela", 5) == 0)
+	{
+	  if (s->_raw_size != 0)
+	    {
+	      asection *target;
+	      const char *outname;
+
+	      /* Remember whether there are any reloc sections other
+		 than .rela.plt.  */
+	      if (strcmp (name+5, ".plt") != 0)
+		relocs = true;
+
+	      /* If this relocation section applies to a read only
+		 section, then we probably need a DT_TEXTREL entry.  */
+	      outname = bfd_get_section_name (output_bfd,
+					      s->output_section);
+	      target = bfd_get_section_by_name (output_bfd, outname + 5);
+	      if (target != NULL
+		  && (target->flags & SEC_READONLY) != 0
+		  && (target->flags & SEC_ALLOC) != 0)
+		reltext = true;
+
+	      /* We use the reloc_count field as a counter if we need
+		 to copy relocs into the output file.  */
+	      s->reloc_count = 0;
+	    }
+	}
+      else if (strcmp (name, ".plt") == 0)
+	{
+	  if (hplink->need_plt_stub)
+	    {
+	      /* Make space for the plt stub at the end of the .plt
+		 section.  We want this stub right at the end, up
+		 against the .got section.  */
+	      int gotalign = bfd_section_alignment (dynobj, hplink->sgot);
+	      int pltalign = bfd_section_alignment (dynobj, s);
+	      bfd_size_type mask;
+
+	      if (gotalign > pltalign)
+		bfd_set_section_alignment (dynobj, s, gotalign);
+	      mask = ((bfd_size_type) 1 << gotalign) - 1;
+	      s->_raw_size = (s->_raw_size + sizeof (plt_stub) + mask) & ~mask;
+	    }
+	}
+      else if (strcmp (name, ".got") == 0)
+	;
+      else
+	{
+	  /* It's not one of our sections, so don't allocate space.  */
+	  continue;
+	}
+
+      if (s->_raw_size == 0)
+	{
+	  /* If we don't need this section, strip it from the
+	     output file.  This is mostly to handle .rela.bss and
+	     .rela.plt.  We must create both sections in
+	     create_dynamic_sections, because they must be created
+	     before the linker maps input sections to output
+	     sections.  The linker does that before
+	     adjust_dynamic_symbol is called, and it is that
+	     function which decides whether anything needs to go
+	     into these sections.  */
+	  _bfd_strip_section_from_output (info, s);
+	  continue;
+	}
+
+      /* Allocate memory for the section contents.  Zero it, because
+	 we may not fill in all the reloc sections.  */
+      s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
+      if (s->contents == NULL && s->_raw_size != 0)
+	return false;
+    }
+
+  if (hplink->root.dynamic_sections_created)
+    {
+      /* Like IA-64 and HPPA64, always create a DT_PLTGOT.  It
+	 actually has nothing to do with the PLT, it is how we
+	 communicate the LTP value of a load module to the dynamic
+	 linker.  */
+      if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0))
+	return false;
+
+      /* Add some entries to the .dynamic section.  We fill in the
+	 values later, in elf32_hppa_finish_dynamic_sections, but we
+	 must add the entries now so that we get the correct size for
+	 the .dynamic section.  The DT_DEBUG entry is filled in by the
+	 dynamic linker and used by the debugger.  */
+      if (! info->shared)
+	{
+	  if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0))
+	    return false;
+	}
+
+      if (hplink->srelplt->_raw_size != 0)
+	{
+	  if (! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0)
+	      || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA)
+	      || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0))
+	    return false;
+	}
+
+      if (relocs)
+	{
+	  if (! bfd_elf32_add_dynamic_entry (info, DT_RELA, 0)
+	      || ! bfd_elf32_add_dynamic_entry (info, DT_RELASZ, 0)
+	      || ! bfd_elf32_add_dynamic_entry (info, DT_RELAENT,
+						sizeof (Elf32_External_Rela)))
+	    return false;
+	}
+
+      if (reltext)
+	{
+	  if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
+	    return false;
+	  info->flags |= DF_TEXTREL;
+	}
+    }
+
   return true;
 }
 
 /* External entry points for sizing and building linker stubs.  */
 
-/* Build all the stubs associated with the current output file.  The
-   stubs are kept in a hash table attached to the main linker hash
-   table.  This is called via hppaelf_finish in the linker.  */
-
-boolean
-elf32_hppa_build_stubs (stub_bfd, info)
-     bfd *stub_bfd;
-     struct bfd_link_info *info;
-{
-  /* The stub BFD only has one section.  */
-  asection *stub_sec = stub_bfd->sections;
-  struct elf32_hppa_stub_hash_table *table;
-  unsigned int size;
-  void *args[2];
-
-  /* So we can pass both the BFD for the stubs and the link info
-     structure to the routine which actually builds stubs.  */
-  args[0] = stub_bfd;
-  args[1] = info;
-
-  /* Allocate memory to hold the linker stubs.  */
-  size = bfd_section_size (stub_bfd, stub_sec);
-  stub_sec->contents = (unsigned char *) bfd_zalloc (stub_bfd, size);
-  if (stub_sec->contents == NULL)
-    return false;
-  table = elf32_hppa_hash_table(info)->stub_hash_table;
-  table->location = stub_sec->contents;
-
-  /* Build the stubs as directed by the stub hash table.  */
-  elf32_hppa_stub_hash_traverse (table, elf32_hppa_build_one_stub, args);
-
-  return true;
-}
-
 /* Determine and set the size of the stub section for a final link.
 
    The basic idea here is to examine all the relocations looking for
    PC-relative calls to a target that is unreachable with a "bl"
-   instruction or calls where the caller and callee disagree on the
-   location of their arguments or return value.  */
+   instruction.  */
 
 boolean
-elf32_hppa_size_stubs (stub_bfd, output_bfd, link_info)
+elf32_hppa_size_stubs (output_bfd, stub_bfd, info, multi_subspace, group_size,
+		       add_stub_section, layout_sections_again)
+     bfd *output_bfd;
      bfd *stub_bfd;
-     bfd *output_bfd ATTRIBUTE_UNUSED;
-     struct bfd_link_info *link_info;
+     struct bfd_link_info *info;
+     boolean multi_subspace;
+     bfd_signed_vma group_size;
+     asection * (*add_stub_section) PARAMS ((const char *, asection *));
+     void (*layout_sections_again) PARAMS ((void));
 {
   bfd *input_bfd;
-  asection *section, *stub_sec = 0;
-  Elf_Internal_Shdr *symtab_hdr;
+  asection *section;
+  asection **input_list, **list;
   Elf_Internal_Sym *local_syms, **all_local_syms;
-  unsigned int i, index, bfd_count = 0;
-  struct elf32_hppa_stub_hash_table *stub_hash_table = 0;
+  unsigned int bfd_indx, bfd_count;
+  int top_id, top_index;
+  struct elf32_hppa_link_hash_table *hplink;
+  bfd_size_type stub_group_size;
+  boolean stubs_always_before_branch;
+  boolean stub_changed = 0;
+  boolean ret = 0;
 
-  /* Create and initialize the stub hash table.  */
-  stub_hash_table = ((struct elf32_hppa_stub_hash_table *)
-		     bfd_malloc (sizeof (struct elf32_hppa_stub_hash_table)));
-  if (!stub_hash_table)
-    goto error_return;
+  hplink = hppa_link_hash_table (info);
 
-  if (!elf32_hppa_stub_hash_table_init (stub_hash_table, stub_bfd,
-					elf32_hppa_stub_hash_newfunc))
-    goto error_return;
-
-  /* Attach the hash tables to the main hash table.  */
-  elf32_hppa_hash_table(link_info)->stub_hash_table = stub_hash_table;
-
-  /* Count the number of input BFDs.  */
-  for (input_bfd = link_info->input_bfds;
-       input_bfd != NULL;
-       input_bfd = input_bfd->link_next)
-     bfd_count++;
-
-  /* Magic as we know the stub bfd only has one section.  */
-  stub_sec = stub_bfd->sections;
-
-  /* If generating a relocateable output file, then we don't
-     have to examine the relocs.  */
-  if (link_info->relocateable)
+  /* Stash our params away.  */
+  hplink->stub_bfd = stub_bfd;
+  hplink->multi_subspace = multi_subspace;
+  hplink->add_stub_section = add_stub_section;
+  hplink->layout_sections_again = layout_sections_again;
+  stubs_always_before_branch = group_size < 0;
+  if (group_size < 0)
+    stub_group_size = -group_size;
+  else
+    stub_group_size = group_size;
+  if (stub_group_size == 1)
     {
-      for (i = 0; i < bfd_count; i++)
-	if (all_local_syms[i])
-	  free (all_local_syms[i]);
-      free (all_local_syms);
-      return true;
+      /* Default values.  */
+      stub_group_size = 8000000;
+      if (hplink->has_17bit_branch || hplink->multi_subspace)
+	stub_group_size = 250000;
+      if (hplink->has_12bit_branch)
+	stub_group_size = 7812;
     }
 
-  /* Now that we have argument location information for all the global
-     functions we can start looking for stubs.  */
-  for (input_bfd = link_info->input_bfds, index = 0;
+  /* Count the number of input BFDs and find the top input section id.  */
+  for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0;
        input_bfd != NULL;
-       input_bfd = input_bfd->link_next, index++)
+       input_bfd = input_bfd->link_next)
     {
+      bfd_count += 1;
+      for (section = input_bfd->sections;
+	   section != NULL;
+	   section = section->next)
+	{
+	  if (top_id < section->id)
+	    top_id = section->id;
+	}
+    }
+
+  hplink->stub_group
+    = (struct map_stub *) bfd_zmalloc (sizeof (struct map_stub) * (top_id + 1));
+  if (hplink->stub_group == NULL)
+    return false;
+
+  /* Make a list of input sections for each output section included in
+     the link.
+
+     We can't use output_bfd->section_count here to find the top output
+     section index as some sections may have been removed, and
+     _bfd_strip_section_from_output doesn't renumber the indices.  */
+  for (section = output_bfd->sections, top_index = 0;
+       section != NULL;
+       section = section->next)
+    {
+      if (top_index < section->index)
+	top_index = section->index;
+    }
+
+  input_list
+    = (asection **) bfd_malloc (sizeof (asection *) * (top_index + 1));
+  if (input_list == NULL)
+    return false;
+
+  /* For sections we aren't interested in, mark their entries with a
+     value we can check later.  */
+  list = input_list + top_index;
+  do
+    *list = bfd_abs_section_ptr;
+  while (list-- != input_list);
+
+  for (section = output_bfd->sections;
+       section != NULL;
+       section = section->next)
+    {
+      if ((section->flags & SEC_CODE) != 0)
+	input_list[section->index] = NULL;
+    }
+
+  /* Now actually build the lists.  */
+  for (input_bfd = info->input_bfds;
+       input_bfd != NULL;
+       input_bfd = input_bfd->link_next)
+    {
+      for (section = input_bfd->sections;
+	   section != NULL;
+	   section = section->next)
+	{
+	  if (section->output_section != NULL
+	      && section->output_section->owner == output_bfd
+	      && section->output_section->index <= top_index)
+	    {
+	      list = input_list + section->output_section->index;
+	      if (*list != bfd_abs_section_ptr)
+		{
+		  /* Steal the link_sec pointer for our list.  */
+#define PREV_SEC(sec) (hplink->stub_group[(sec)->id].link_sec)
+		  /* This happens to make the list in reverse order,
+		     which is what we want.  */
+		  PREV_SEC (section) = *list;
+		  *list = section;
+		}
+	    }
+	}
+    }
+
+  /* See whether we can group stub sections together.  Grouping stub
+     sections may result in fewer stubs.  More importantly, we need to
+     put all .init* and .fini* stubs at the beginning of the .init or
+     .fini output sections respectively, because glibc splits the
+     _init and _fini functions into multiple parts.  Putting a stub in
+     the middle of a function is not a good idea.  */
+  list = input_list + top_index;
+  do
+    {
+      asection *tail = *list;
+      if (tail == bfd_abs_section_ptr)
+	continue;
+      while (tail != NULL)
+	{
+	  asection *curr;
+	  asection *prev;
+	  bfd_size_type total;
+
+	  curr = tail;
+	  if (tail->_cooked_size)
+	    total = tail->_cooked_size;
+	  else
+	    total = tail->_raw_size;
+	  while ((prev = PREV_SEC (curr)) != NULL
+		 && ((total += curr->output_offset - prev->output_offset)
+		     < stub_group_size))
+	    curr = prev;
+
+	  /* OK, the size from the start of CURR to the end is less
+	     than 250000 bytes and thus can be handled by one stub
+	     section.  (or the tail section is itself larger than
+	     250000 bytes, in which case we may be toast.)
+	     We should really be keeping track of the total size of
+	     stubs added here, as stubs contribute to the final output
+	     section size.  That's a little tricky, and this way will
+	     only break if stubs added total more than 12144 bytes, or
+	     1518 long branch stubs.  It seems unlikely for more than
+	     1518 different functions to be called, especially from
+	     code only 250000 bytes long.  */
+	  do
+	    {
+	      prev = PREV_SEC (tail);
+	      /* Set up this stub group.  */
+	      hplink->stub_group[tail->id].link_sec = curr;
+	    }
+	  while (tail != curr && (tail = prev) != NULL);
+
+	  /* But wait, there's more!  Input sections up to 250000
+	     bytes before the stub section can be handled by it too.  */
+	  if (!stubs_always_before_branch)
+	    {
+	      total = 0;
+	      while (prev != NULL
+		     && ((total += tail->output_offset - prev->output_offset)
+			 < stub_group_size))
+		{
+		  tail = prev;
+		  prev = PREV_SEC (tail);
+		  hplink->stub_group[tail->id].link_sec = curr;
+		}
+	    }
+	  tail = prev;
+	}
+    }
+  while (list-- != input_list);
+  free (input_list);
+#undef PREV_SEC
+
+  /* We want to read in symbol extension records only once.  To do this
+     we need to read in the local symbols in parallel and save them for
+     later use; so hold pointers to the local symbols in an array.  */
+  all_local_syms
+    = (Elf_Internal_Sym **) bfd_zmalloc (sizeof (Elf_Internal_Sym *)
+					 * bfd_count);
+  if (all_local_syms == NULL)
+    return false;
+
+  /* Walk over all the input BFDs, swapping in local symbols.
+     If we are creating a shared library, create hash entries for the
+     export stubs.  */
+  for (input_bfd = info->input_bfds, bfd_indx = 0;
+       input_bfd != NULL;
+       input_bfd = input_bfd->link_next, bfd_indx++)
+    {
+      Elf_Internal_Shdr *symtab_hdr;
+      Elf_Internal_Sym *isym;
+      Elf32_External_Sym *ext_syms, *esym, *end_sy;
+
       /* We'll need the symbol table in a second.  */
       symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
       if (symtab_hdr->sh_info == 0)
 	continue;
 
-      local_syms = all_local_syms[index];
-
-      /* Walk over each section attached to the input bfd.  */
-      for (section = input_bfd->sections;
-	   section != NULL;
-	   section = section->next)
+      /* We need an array of the local symbols attached to the input bfd.
+	 Unfortunately, we're going to have to read & swap them in.  */
+      local_syms = (Elf_Internal_Sym *)
+	bfd_malloc (symtab_hdr->sh_info * sizeof (Elf_Internal_Sym));
+      if (local_syms == NULL)
 	{
-	  Elf_Internal_Shdr *input_rel_hdr;
-	  Elf32_External_Rela *external_relocs, *erelaend, *erela;
-	  Elf_Internal_Rela *internal_relocs, *irelaend, *irela;
+	  goto error_ret_free_local;
+	}
+      all_local_syms[bfd_indx] = local_syms;
+      ext_syms = (Elf32_External_Sym *)
+	bfd_malloc (symtab_hdr->sh_info * sizeof (Elf32_External_Sym));
+      if (ext_syms == NULL)
+	{
+	  goto error_ret_free_local;
+	}
 
-	  /* If there aren't any relocs, then there's nothing to do.  */
-	  if ((section->flags & SEC_RELOC) == 0
-	      || section->reloc_count == 0)
+      if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0
+	  || (bfd_read (ext_syms, 1,
+			(symtab_hdr->sh_info * sizeof (Elf32_External_Sym)),
+			input_bfd)
+	      != (symtab_hdr->sh_info * sizeof (Elf32_External_Sym))))
+	{
+	  free (ext_syms);
+	  goto error_ret_free_local;
+	}
+
+      /* Swap the local symbols in.  */
+      isym = local_syms;
+      esym = ext_syms;
+      for (end_sy = esym + symtab_hdr->sh_info; esym < end_sy; esym++, isym++)
+	bfd_elf32_swap_symbol_in (input_bfd, esym, isym);
+
+      /* Now we can free the external symbols.  */
+      free (ext_syms);
+
+#if ! LONG_BRANCH_PIC_IN_SHLIB
+      /* If this is a shared link, find all the stub reloc sections.  */
+      if (info->shared)
+	for (section = input_bfd->sections;
+	     section != NULL;
+	     section = section->next)
+	  {
+	    char *name;
+	    asection *reloc_sec;
+
+	    name = bfd_malloc (strlen (section->name)
+			       + sizeof STUB_SUFFIX
+			       + 5);
+	    if (name == NULL)
+	      return false;
+	    sprintf (name, ".rela%s%s", section->name, STUB_SUFFIX);
+	    reloc_sec = bfd_get_section_by_name (hplink->root.dynobj, name);
+	    hplink->stub_group[section->id].reloc_sec = reloc_sec;
+	    free (name);
+	  }
+#endif
+
+      if (info->shared && hplink->multi_subspace)
+	{
+	  struct elf_link_hash_entry **sym_hashes;
+	  struct elf_link_hash_entry **end_hashes;
+	  unsigned int symcount;
+
+	  symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)
+		      - symtab_hdr->sh_info);
+	  sym_hashes = elf_sym_hashes (input_bfd);
+	  end_hashes = sym_hashes + symcount;
+
+	  /* Look through the global syms for functions;  We need to
+	     build export stubs for all globally visible functions.  */
+	  for (; sym_hashes < end_hashes; sym_hashes++)
+	    {
+	      struct elf32_hppa_link_hash_entry *hash;
+
+	      hash = (struct elf32_hppa_link_hash_entry *) *sym_hashes;
+
+	      while (hash->elf.root.type == bfd_link_hash_indirect
+		     || hash->elf.root.type == bfd_link_hash_warning)
+		hash = ((struct elf32_hppa_link_hash_entry *)
+			hash->elf.root.u.i.link);
+
+	      /* At this point in the link, undefined syms have been
+		 resolved, so we need to check that the symbol was
+		 defined in this BFD.  */
+	      if ((hash->elf.root.type == bfd_link_hash_defined
+		   || hash->elf.root.type == bfd_link_hash_defweak)
+		  && hash->elf.type == STT_FUNC
+		  && hash->elf.root.u.def.section->output_section != NULL
+		  && (hash->elf.root.u.def.section->output_section->owner
+		      == output_bfd)
+		  && hash->elf.root.u.def.section->owner == input_bfd
+		  && (hash->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)
+		  && !(hash->elf.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)
+		  && ELF_ST_VISIBILITY (hash->elf.other) == STV_DEFAULT)
+		{
+		  asection *sec;
+		  const char *stub_name;
+		  struct elf32_hppa_stub_hash_entry *stub_entry;
+
+		  sec = hash->elf.root.u.def.section;
+		  stub_name = hash->elf.root.root.string;
+		  stub_entry = hppa_stub_hash_lookup (&hplink->stub_hash_table,
+						      stub_name,
+						      false, false);
+		  if (stub_entry == NULL)
+		    {
+		      stub_entry = hppa_add_stub (stub_name, sec, hplink);
+		      if (!stub_entry)
+			goto error_ret_free_local;
+
+		      stub_entry->target_value = hash->elf.root.u.def.value;
+		      stub_entry->target_section = hash->elf.root.u.def.section;
+		      stub_entry->stub_type = hppa_stub_export;
+		      stub_entry->h = hash;
+		      stub_changed = 1;
+		    }
+		  else
+		    {
+		      (*_bfd_error_handler) (_("%s: duplicate export stub %s"),
+			     bfd_get_filename (input_bfd),
+			     stub_name);
+		    }
+		}
+	    }
+	}
+    }
+
+  while (1)
+    {
+      asection *stub_sec;
+
+      for (input_bfd = info->input_bfds, bfd_indx = 0;
+	   input_bfd != NULL;
+	   input_bfd = input_bfd->link_next, bfd_indx++)
+	{
+	  Elf_Internal_Shdr *symtab_hdr;
+
+	  /* We'll need the symbol table in a second.  */
+	  symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+	  if (symtab_hdr->sh_info == 0)
 	    continue;
 
-	  /* Allocate space for the external relocations.  */
-	  external_relocs
-	    = ((Elf32_External_Rela *)
-	       bfd_malloc (section->reloc_count
-			   * sizeof (Elf32_External_Rela)));
-	  if (external_relocs == NULL)
+	  local_syms = all_local_syms[bfd_indx];
+
+	  /* Walk over each section attached to the input bfd.  */
+	  for (section = input_bfd->sections;
+	       section != NULL;
+	       section = section->next)
 	    {
-	      for (i = 0; i < bfd_count; i++)
-		if (all_local_syms[i])
-		  free (all_local_syms[i]);
-	      free (all_local_syms);
-	      goto error_return;
-	    }
+	      Elf_Internal_Shdr *input_rel_hdr;
+	      Elf32_External_Rela *external_relocs, *erelaend, *erela;
+	      Elf_Internal_Rela *internal_relocs, *irelaend, *irela;
 
-	  /* Likewise for the internal relocations.  */
-	  internal_relocs
-	    = ((Elf_Internal_Rela *)
-	       bfd_malloc (section->reloc_count * sizeof (Elf_Internal_Rela)));
-	  if (internal_relocs == NULL)
-	    {
-	      free (external_relocs);
-	      for (i = 0; i < bfd_count; i++)
-		if (all_local_syms[i])
-		  free (all_local_syms[i]);
-	      free (all_local_syms);
-	      goto error_return;
-	    }
-
-	  /* Read in the external relocs.  */
-	  input_rel_hdr = &elf_section_data (section)->rel_hdr;
-	  if (bfd_seek (input_bfd, input_rel_hdr->sh_offset, SEEK_SET) != 0
-	      || bfd_read (external_relocs, 1, input_rel_hdr->sh_size,
-			   input_bfd) != input_rel_hdr->sh_size)
-	    {
-	      free (external_relocs);
-	      free (internal_relocs);
-	      for (i = 0; i < bfd_count; i++)
-		if (all_local_syms[i])
-		  free (all_local_syms[i]);
-	      free (all_local_syms);
-	      goto error_return;
-	    }
-
-	  /* Swap in the relocs.  */
-	  erela = external_relocs;
-	  erelaend = erela + section->reloc_count;
-	  irela = internal_relocs;
-	  for (; erela < erelaend; erela++, irela++)
-	    bfd_elf32_swap_reloca_in (input_bfd, erela, irela);
-
-	  /* We're done with the external relocs, free them.  */
-	  free (external_relocs);
-
-	  /* Now examine each relocation.  */
-	  irela = internal_relocs;
-	  irelaend = irela + section->reloc_count;
-	  for (; irela < irelaend; irela++)
-	    {
-	      long r_type, size_of_stub;
-	      unsigned long r_index;
-	      struct elf_link_hash_entry *hash;
-	      struct elf32_hppa_stub_hash_entry *stub_hash;
-	      Elf_Internal_Sym *sym;
-	      asection *sym_sec;
-	      const char *sym_name;
-	      symvalue sym_value;
-	      bfd_vma location, destination;
-	      char *new_name = NULL;
-
-	      r_type = ELF32_R_TYPE (irela->r_info);
-	      r_index = ELF32_R_SYM (irela->r_info);
-
-	      if (r_type < 0 || r_type >= (int) R_PARISC_UNIMPLEMENTED)
-		{
-		  bfd_set_error (bfd_error_bad_value);
-		  free (internal_relocs);
-		  for (i = 0; i < bfd_count; i++)
-		    if (all_local_syms[i])
-		      free (all_local_syms[i]);
-		  free (all_local_syms);
-		  goto error_return;
-		}
-
-	      /* Only look for stubs on call instructions or plabel
-		 references.  */
-	      if (r_type != R_PARISC_PCREL17F
-		  && r_type != R_PARISC_PLABEL32
-		  && r_type != R_PARISC_PLABEL21L
-		  && r_type != R_PARISC_PLABEL14R)
+	      /* If there aren't any relocs, then there's nothing more
+		 to do.  */
+	      if ((section->flags & SEC_RELOC) == 0
+		  || section->reloc_count == 0)
 		continue;
 
-	      /* Now determine the call target, its name, value, section
-		 and argument relocation bits.  */
-	      hash = NULL;
-	      sym = NULL;
-	      sym_sec = NULL;
-	      if (r_index < symtab_hdr->sh_info)
+	      /* If this section is a link-once section that will be
+		 discarded, then don't create any stubs.  */
+	      if (section->output_section == NULL
+		  || section->output_section->owner != output_bfd)
+		continue;
+
+	      /* Allocate space for the external relocations.  */
+	      external_relocs
+		= ((Elf32_External_Rela *)
+		   bfd_malloc (section->reloc_count
+			       * sizeof (Elf32_External_Rela)));
+	      if (external_relocs == NULL)
 		{
-		  /* It's a local symbol.  */
-		  Elf_Internal_Shdr *hdr;
-
-		  sym = local_syms + r_index;
-		  hdr = elf_elfsections (input_bfd)[sym->st_shndx];
-		  sym_sec = hdr->bfd_section;
-		  sym_name = bfd_elf_string_from_elf_section (input_bfd,
-							      symtab_hdr->sh_link,
-							      sym->st_name);
-		  sym_value = (ELF_ST_TYPE (sym->st_info) == STT_SECTION
-			       ? 0 : sym->st_value);
-		  destination = (sym_value
-				 + sym_sec->output_offset
-				 + sym_sec->output_section->vma);
-
-		  /* Tack on an ID so we can uniquely identify this local
-		     symbol in the stub or arg info hash tables.  */
-		  new_name = bfd_malloc (strlen (sym_name) + 10);
-		  if (new_name == 0)
-		    {
-		      free (internal_relocs);
-		      for (i = 0; i < bfd_count; i++)
-			if (all_local_syms[i])
-			  free (all_local_syms[i]);
-		      free (all_local_syms);
-		      goto error_return;
-		    }
-		  sprintf (new_name, "%s_%08x", sym_name, (int)sym_sec);
-		  sym_name = new_name;
+		  goto error_ret_free_local;
 		}
-	      else
-		{
-		  /* It's an external symbol.  */
-		  long index;
 
-		  index = r_index - symtab_hdr->sh_info;
-		  hash = elf_sym_hashes (input_bfd)[index];
-		  if (hash->root.type == bfd_link_hash_defined
-		      || hash->root.type == bfd_link_hash_defweak)
+	      /* Likewise for the internal relocations.  */
+	      internal_relocs = ((Elf_Internal_Rela *)
+				 bfd_malloc (section->reloc_count
+					     * sizeof (Elf_Internal_Rela)));
+	      if (internal_relocs == NULL)
+		{
+		  free (external_relocs);
+		  goto error_ret_free_local;
+		}
+
+	      /* Read in the external relocs.  */
+	      input_rel_hdr = &elf_section_data (section)->rel_hdr;
+	      if (bfd_seek (input_bfd, input_rel_hdr->sh_offset, SEEK_SET) != 0
+		  || bfd_read (external_relocs, 1,
+			       input_rel_hdr->sh_size,
+			       input_bfd) != input_rel_hdr->sh_size)
+		{
+		  free (external_relocs);
+		error_ret_free_internal:
+		  free (internal_relocs);
+		  goto error_ret_free_local;
+		}
+
+	      /* Swap in the relocs.  */
+	      erela = external_relocs;
+	      erelaend = erela + section->reloc_count;
+	      irela = internal_relocs;
+	      for (; erela < erelaend; erela++, irela++)
+		bfd_elf32_swap_reloca_in (input_bfd, erela, irela);
+
+	      /* We're done with the external relocs, free them.  */
+	      free (external_relocs);
+
+	      /* Now examine each relocation.  */
+	      irela = internal_relocs;
+	      irelaend = irela + section->reloc_count;
+	      for (; irela < irelaend; irela++)
+		{
+		  unsigned int r_type, r_indx;
+		  enum elf32_hppa_stub_type stub_type;
+		  struct elf32_hppa_stub_hash_entry *stub_entry;
+		  asection *sym_sec;
+		  bfd_vma sym_value;
+		  bfd_vma destination;
+		  struct elf32_hppa_link_hash_entry *hash;
+		  char *stub_name;
+		  const asection *id_sec;
+
+		  r_type = ELF32_R_TYPE (irela->r_info);
+		  r_indx = ELF32_R_SYM (irela->r_info);
+
+		  if (r_type >= (unsigned int) R_PARISC_UNIMPLEMENTED)
 		    {
-		      sym_sec = hash->root.u.def.section;
-		      sym_name = hash->root.root.string;
-		      sym_value = hash->root.u.def.value;
-		      destination = (sym_value
+		      bfd_set_error (bfd_error_bad_value);
+		      goto error_ret_free_internal;
+		    }
+
+		  /* Only look for stubs on call instructions.  */
+		  if (r_type != (unsigned int) R_PARISC_PCREL12F
+		      && r_type != (unsigned int) R_PARISC_PCREL17F
+		      && r_type != (unsigned int) R_PARISC_PCREL22F)
+		    continue;
+
+		  /* Now determine the call target, its name, value,
+		     section.  */
+		  sym_sec = NULL;
+		  sym_value = 0;
+		  destination = 0;
+		  hash = NULL;
+		  if (r_indx < symtab_hdr->sh_info)
+		    {
+		      /* It's a local symbol.  */
+		      Elf_Internal_Sym *sym;
+		      Elf_Internal_Shdr *hdr;
+
+		      sym = local_syms + r_indx;
+		      hdr = elf_elfsections (input_bfd)[sym->st_shndx];
+		      sym_sec = hdr->bfd_section;
+		      if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
+			sym_value = sym->st_value;
+		      destination = (sym_value + irela->r_addend
 				     + sym_sec->output_offset
 				     + sym_sec->output_section->vma);
 		    }
 		  else
 		    {
-		      bfd_set_error (bfd_error_bad_value);
-		      free (internal_relocs);
-		      for (i = 0; i < bfd_count; i++)
-			if (all_local_syms[i])
-			  free (all_local_syms[i]);
-		      free (all_local_syms);
-		      goto error_return;
+		      /* It's an external symbol.  */
+		      int e_indx;
+
+		      e_indx = r_indx - symtab_hdr->sh_info;
+		      hash = ((struct elf32_hppa_link_hash_entry *)
+			      elf_sym_hashes (input_bfd)[e_indx]);
+
+		      while (hash->elf.root.type == bfd_link_hash_indirect
+			     || hash->elf.root.type == bfd_link_hash_warning)
+			hash = ((struct elf32_hppa_link_hash_entry *)
+				hash->elf.root.u.i.link);
+
+		      if (hash->elf.root.type == bfd_link_hash_defined
+			  || hash->elf.root.type == bfd_link_hash_defweak)
+			{
+			  sym_sec = hash->elf.root.u.def.section;
+			  sym_value = hash->elf.root.u.def.value;
+			  if (sym_sec->output_section != NULL)
+			    destination = (sym_value + irela->r_addend
+					   + sym_sec->output_offset
+					   + sym_sec->output_section->vma);
+			}
+		      else if (hash->elf.root.type == bfd_link_hash_undefweak)
+			{
+			  if (! info->shared)
+			    continue;
+			}
+		      else if (hash->elf.root.type == bfd_link_hash_undefined)
+			{
+			  if (! (info->shared
+				 && !info->no_undefined
+				 && (ELF_ST_VISIBILITY (hash->elf.other)
+				     == STV_DEFAULT)))
+			    continue;
+			}
+		      else
+			{
+			  bfd_set_error (bfd_error_bad_value);
+			  goto error_ret_free_internal;
+			}
 		    }
-		}
 
-	      /* Now determine where the call point is.  */
-	      location = (section->output_offset
-			  + section->output_section->vma
-			  + irela->r_offset);
+		  /* Determine what (if any) linker stub is needed.  */
+		  stub_type = hppa_type_of_stub (section, irela, hash,
+						 destination);
+		  if (stub_type == hppa_stub_none)
+		    continue;
 
-	      /* We only care about the destination for PCREL function
-		 calls (eg. we don't care for PLABELS).  */
-	      if (r_type != R_PARISC_PCREL17F)
-		location = destination;
-
-	      /* Determine what (if any) linker stub is needed and its
-		 size (in bytes).  */
-	      size_of_stub = elf32_hppa_size_of_stub (location,
-						      destination,
-						      sym_name);
-	      if (size_of_stub != 0)
-		{
-		  char *stub_name;
-		  unsigned int len;
+		  /* Support for grouping stub sections.  */
+		  id_sec = hplink->stub_group[section->id].link_sec;
 
 		  /* Get the name of this stub.  */
-		  len = strlen (sym_name);
-		  len += 23;
-
-		  stub_name = bfd_malloc (len);
+		  stub_name = hppa_stub_name (id_sec, sym_sec, hash, irela);
 		  if (!stub_name)
+		    goto error_ret_free_internal;
+
+		  stub_entry = hppa_stub_hash_lookup (&hplink->stub_hash_table,
+						      stub_name,
+						      false, false);
+		  if (stub_entry != NULL)
 		    {
-		      /* Because sym_name was mallocd above for local
-			 symbols.  */
-		      if (r_index < symtab_hdr->sh_info)
-			free (new_name);
-
-		      free (internal_relocs);
-		      for (i = 0; i < bfd_count; i++)
-			if (all_local_syms[i])
-			  free (all_local_syms[i]);
-		      free (all_local_syms);
-		      goto error_return;
-		    }
-		  elf32_hppa_name_of_stub (location, destination, stub_name);
-		  strcat (stub_name + 22, sym_name);
-
-		  /* Because sym_name was malloced above for local symbols.  */
-		  if (r_index < symtab_hdr->sh_info)
-		    free (new_name);
-
-		  stub_hash
-		    = elf32_hppa_stub_hash_lookup (stub_hash_table, stub_name,
-						   false, false);
-		  if (stub_hash != NULL)
-		    {
-		      /* The proper stub has already been created, nothing
-			 else to do.  */
+		      /* The proper stub has already been created.  */
 		      free (stub_name);
+		      continue;
 		    }
-		  else
+
+		  stub_entry = hppa_add_stub (stub_name, section, hplink);
+		  if (stub_entry == NULL)
 		    {
-		      bfd_set_section_size (stub_bfd, stub_sec,
-					    (bfd_section_size (stub_bfd,
-							       stub_sec)
-					     + size_of_stub));
-
-		      /* Enter this entry into the linker stub hash table.  */
-		      stub_hash
-			= elf32_hppa_stub_hash_lookup (stub_hash_table,
-						       stub_name, true, true);
-		      if (stub_hash == NULL)
-			{
-			  free (stub_name);
-			  free (internal_relocs);
-			  for (i = 0; i < bfd_count; i++)
-			    if (all_local_syms[i])
-			      free (all_local_syms[i]);
-			  free (all_local_syms);
-			  goto error_return;
-			}
-
-		      /* We'll need these to determine the address that the
-			 stub will branch to.  */
-		      stub_hash->target_value = sym_value;
-		      stub_hash->target_section = sym_sec;
+		      free (stub_name);
+		      goto error_ret_free_local;
 		    }
-		  free (stub_name);
+
+		  stub_entry->target_value = sym_value;
+		  stub_entry->target_section = sym_sec;
+		  stub_entry->stub_type = stub_type;
+		  if (info->shared)
+		    {
+		      if (stub_type == hppa_stub_import)
+			stub_entry->stub_type = hppa_stub_import_shared;
+		      else if (stub_type == hppa_stub_long_branch
+			       && (LONG_BRANCH_PIC_IN_SHLIB || hash == NULL))
+			stub_entry->stub_type = hppa_stub_long_branch_shared;
+		    }
+		  stub_entry->h = hash;
+		  stub_changed = 1;
 		}
+
+	      /* We're done with the internal relocs, free them.  */
+	      free (internal_relocs);
 	    }
-	  /* We're done with the internal relocs, free them.  */
-	  free (internal_relocs);
+	}
+
+      if (!stub_changed)
+	break;
+
+      /* OK, we've added some stubs.  Find out the new size of the
+	 stub sections.  */
+      for (stub_sec = hplink->stub_bfd->sections;
+	   stub_sec != NULL;
+	   stub_sec = stub_sec->next)
+	{
+	  stub_sec->_raw_size = 0;
+	  stub_sec->_cooked_size = 0;
+	}
+#if ! LONG_BRANCH_PIC_IN_SHLIB
+      {
+	int i;
+
+	for (i = top_id; i >= 0; --i)
+	  {
+	    /* This will probably hit the same section many times..  */
+	    stub_sec = hplink->stub_group[i].reloc_sec;
+	    if (stub_sec != NULL)
+	      {
+		stub_sec->_raw_size = 0;
+		stub_sec->_cooked_size = 0;
+	      }
+	  }
+      }
+#endif
+
+      bfd_hash_traverse (&hplink->stub_hash_table,
+			 hppa_size_one_stub,
+			 hplink);
+
+      /* Ask the linker to do its stuff.  */
+      (*hplink->layout_sections_again) ();
+      stub_changed = 0;
+    }
+
+  ret = 1;
+
+ error_ret_free_local:
+  while (bfd_count-- > 0)
+    if (all_local_syms[bfd_count])
+      free (all_local_syms[bfd_count]);
+  free (all_local_syms);
+
+  return ret;
+}
+
+/* For a final link, this function is called after we have sized the
+   stubs to provide a value for __gp.  */
+
+boolean
+elf32_hppa_set_gp (abfd, info)
+     bfd *abfd;
+     struct bfd_link_info *info;
+{
+  struct elf32_hppa_link_hash_table *hplink;
+  struct elf_link_hash_entry *h;
+  asection *sec;
+  bfd_vma gp_val;
+
+  hplink = hppa_link_hash_table (info);
+  h = elf_link_hash_lookup (&hplink->root, "$global$",
+			    false, false, false);
+
+  if (h != NULL && h->root.type == bfd_link_hash_defined)
+    {
+      gp_val = h->root.u.def.value;
+      sec = h->root.u.def.section;
+    }
+  else
+    {
+      /* Choose to point our LTP at, in this order, one of .plt, .got,
+	 or .data, if these sections exist.  In the case of choosing
+	 .plt try to make the LTP ideal for addressing anywhere in the
+	 .plt or .got with a 14 bit signed offset.  Typically, the end
+	 of the .plt is the start of the .got, so choose .plt + 0x2000
+	 if either the .plt or .got is larger than 0x2000.  If both
+	 the .plt and .got are smaller than 0x2000, choose the end of
+	 the .plt section.  */
+
+      sec = hplink->splt;
+      if (sec != NULL)
+	{
+	  gp_val = sec->_raw_size;
+	  if (gp_val > 0x2000
+	      || (hplink->sgot && hplink->sgot->_raw_size > 0x2000))
+	    {
+	      gp_val = 0x2000;
+	    }
+	}
+      else
+	{
+	  gp_val = 0;
+	  sec = hplink->sgot;
+	  if (sec != NULL)
+	    {
+	      /* We know we don't have a .plt.  If .got is large,
+		 offset our LTP.  */
+	      if (sec->_raw_size > 0x2000)
+		gp_val = 0x2000;
+	    }
+	  else
+	    {
+	      /* No .plt or .got.  Who cares what the LTP is?  */
+	      sec = bfd_get_section_by_name (abfd, ".data");
+	    }
 	}
     }
-  /* We're done with the local symbols, free them.  */
-  for (i = 0; i < bfd_count; i++)
-    if (all_local_syms[i])
-      free (all_local_syms[i]);
-  free (all_local_syms);
-  return true;
 
-error_return:
-  /* Return gracefully, avoiding dangling references to the hash tables.  */
-  if (stub_hash_table)
+  if (sec != NULL)
+    gp_val += sec->output_section->vma + sec->output_offset;
+
+  elf_gp (abfd) = gp_val;
+  return true;
+}
+
+/* Build all the stubs associated with the current output file.  The
+   stubs are kept in a hash table attached to the main linker hash
+   table.  We also set up the .plt entries for statically linked PIC
+   functions here.  This function is called via hppaelf_finish in the
+   linker.  */
+
+boolean
+elf32_hppa_build_stubs (info)
+     struct bfd_link_info *info;
+{
+  asection *stub_sec;
+  struct bfd_hash_table *table;
+  struct elf32_hppa_link_hash_table *hplink;
+
+  hplink = hppa_link_hash_table (info);
+
+  for (stub_sec = hplink->stub_bfd->sections;
+       stub_sec != NULL;
+       stub_sec = stub_sec->next)
     {
-      elf32_hppa_hash_table(link_info)->stub_hash_table = NULL;
-      free (stub_hash_table);
+      size_t size;
+
+      /* Allocate memory to hold the linker stubs.  */
+      size = stub_sec->_raw_size;
+      stub_sec->contents = (unsigned char *) bfd_zalloc (hplink->stub_bfd,
+							 size);
+      if (stub_sec->contents == NULL && size != 0)
+	return false;
+      stub_sec->_raw_size = 0;
     }
-  /* Set the size of the stub section to zero since we're never going
-     to create them.   Avoids losing when we try to get its contents
-     too.  */
-  bfd_set_section_size (stub_bfd, stub_sec, 0);
-  return false;
+
+  /* Build the stubs as directed by the stub hash table.  */
+  table = &hplink->stub_hash_table;
+  bfd_hash_traverse (table, hppa_build_one_stub, info);
+
+  return true;
+}
+
+/* Perform a relocation as part of a final link.  */
+
+static bfd_reloc_status_type
+final_link_relocate (input_section, contents, rel, value, hplink, sym_sec, h)
+     asection *input_section;
+     bfd_byte *contents;
+     const Elf_Internal_Rela *rel;
+     bfd_vma value;
+     struct elf32_hppa_link_hash_table *hplink;
+     asection *sym_sec;
+     struct elf32_hppa_link_hash_entry *h;
+{
+  int insn;
+  unsigned int r_type = ELF32_R_TYPE (rel->r_info);
+  reloc_howto_type *howto = elf_hppa_howto_table + r_type;
+  int r_format = howto->bitsize;
+  enum hppa_reloc_field_selector_type_alt r_field;
+  bfd *input_bfd = input_section->owner;
+  bfd_vma offset = rel->r_offset;
+  bfd_vma max_branch_offset = 0;
+  bfd_byte *hit_data = contents + offset;
+  bfd_signed_vma addend = rel->r_addend;
+  bfd_vma location;
+  struct elf32_hppa_stub_hash_entry *stub_entry = NULL;
+  int val;
+
+  if (r_type == R_PARISC_NONE)
+    return bfd_reloc_ok;
+
+  insn = bfd_get_32 (input_bfd, hit_data);
+
+  /* Find out where we are and where we're going.  */
+  location = (offset +
+	      input_section->output_offset +
+	      input_section->output_section->vma);
+
+  switch (r_type)
+    {
+    case R_PARISC_PCREL12F:
+    case R_PARISC_PCREL17F:
+    case R_PARISC_PCREL22F:
+      /* If this is a call to a function defined in another dynamic
+	 library, or if it is a call to a PIC function in the same
+	 object, or if this is a shared link and it is a call to a
+	 weak symbol which may or may not be in the same object, then
+	 find the import stub in the stub hash.  */
+      if (sym_sec == NULL
+	  || sym_sec->output_section == NULL
+	  || (h != NULL &&
+	      (h->pic_call
+	       || (h->elf.root.type == bfd_link_hash_defweak
+		   && h->elf.dynindx != -1
+		   && h->elf.plt.offset != (bfd_vma) -1))))
+	{
+	  stub_entry = hppa_get_stub_entry (input_section, sym_sec,
+					    h, rel, hplink);
+	  if (stub_entry != NULL)
+	    {
+	      value = (stub_entry->stub_offset
+		       + stub_entry->stub_sec->output_offset
+		       + stub_entry->stub_sec->output_section->vma);
+	      addend = 0;
+	    }
+	  else if (sym_sec == NULL && h != NULL
+		   && h->elf.root.type == bfd_link_hash_undefweak)
+	    {
+	      /* It's OK if undefined weak.  Make undefined weak
+		 branches go nowhere.  */
+	      value = location;
+	      addend = 0;
+	    }
+	  else
+	    return bfd_reloc_notsupported;
+	}
+      /* Fall thru.  */
+
+    case R_PARISC_PCREL21L:
+    case R_PARISC_PCREL17C:
+    case R_PARISC_PCREL17R:
+    case R_PARISC_PCREL14R:
+    case R_PARISC_PCREL14F:
+      /* Make it a pc relative offset.  */
+      value -= location;
+      addend -= 8;
+      break;
+
+    case R_PARISC_DPREL21L:
+    case R_PARISC_DPREL14R:
+    case R_PARISC_DPREL14F:
+    /* For all the DP relative relocations, we need to examine the symbol's
+       section.  If it's a code section, then "data pointer relative" makes
+       no sense.  In that case we don't adjust the "value", and for 21 bit
+       addil instructions, we change the source addend register from %dp to
+       %r0.  This situation commonly arises when a variable's "constness"
+       is declared differently from the way the variable is defined.  For
+       instance: "extern int foo" with foo defined as "const int foo".  */
+      if (sym_sec == NULL)
+	break;
+      if ((sym_sec->flags & SEC_CODE) != 0)
+	{
+	  if ((insn & ((0x3f << 26) | (0x1f << 21)))
+	      == (((int) OP_ADDIL << 26) | (27 << 21)))
+	    {
+	      insn &= ~ (0x1f << 21);
+#if 1 /* debug them.  */
+	      (*_bfd_error_handler)
+		(_("%s(%s+0x%lx): fixing %s"),
+		 bfd_get_filename (input_bfd),
+		 input_section->name,
+		 (long) rel->r_offset,
+		 howto->name);
+#endif
+	    }
+	  /* Now try to make things easy for the dynamic linker.  */
+
+	  break;
+	}
+      /* Fall thru.  */
+
+    case R_PARISC_DLTIND21L:
+    case R_PARISC_DLTIND14R:
+    case R_PARISC_DLTIND14F:
+      value -= elf_gp (input_section->output_section->owner);
+      break;
+
+    default:
+      break;
+    }
+
+  switch (r_type)
+    {
+    case R_PARISC_DIR32:
+    case R_PARISC_DIR14F:
+    case R_PARISC_DIR17F:
+    case R_PARISC_PCREL17C:
+    case R_PARISC_PCREL14F:
+    case R_PARISC_DPREL14F:
+    case R_PARISC_PLABEL32:
+    case R_PARISC_DLTIND14F:
+    case R_PARISC_SEGBASE:
+    case R_PARISC_SEGREL32:
+      r_field = e_fsel;
+      break;
+
+    case R_PARISC_DIR21L:
+    case R_PARISC_PCREL21L:
+    case R_PARISC_DPREL21L:
+    case R_PARISC_PLABEL21L:
+    case R_PARISC_DLTIND21L:
+      r_field = e_lrsel;
+      break;
+
+    case R_PARISC_DIR17R:
+    case R_PARISC_PCREL17R:
+    case R_PARISC_DIR14R:
+    case R_PARISC_PCREL14R:
+    case R_PARISC_DPREL14R:
+    case R_PARISC_PLABEL14R:
+    case R_PARISC_DLTIND14R:
+      r_field = e_rrsel;
+      break;
+
+    case R_PARISC_PCREL12F:
+    case R_PARISC_PCREL17F:
+    case R_PARISC_PCREL22F:
+      r_field = e_fsel;
+
+      if (r_type == (unsigned int) R_PARISC_PCREL17F)
+	{
+	  max_branch_offset = (1 << (17-1)) << 2;
+	}
+      else if (r_type == (unsigned int) R_PARISC_PCREL12F)
+	{
+	  max_branch_offset = (1 << (12-1)) << 2;
+	}
+      else
+	{
+	  max_branch_offset = (1 << (22-1)) << 2;
+	}
+
+      /* sym_sec is NULL on undefined weak syms or when shared on
+	 undefined syms.  We've already checked for a stub for the
+	 shared undefined case.  */
+      if (sym_sec == NULL)
+	break;
+
+      /* If the branch is out of reach, then redirect the
+	 call to the local stub for this function.  */
+      if (value + addend + max_branch_offset >= 2*max_branch_offset)
+	{
+	  stub_entry = hppa_get_stub_entry (input_section, sym_sec,
+					    h, rel, hplink);
+	  if (stub_entry == NULL)
+	    return bfd_reloc_notsupported;
+
+	  /* Munge up the value and addend so that we call the stub
+	     rather than the procedure directly.  */
+	  value = (stub_entry->stub_offset
+		   + stub_entry->stub_sec->output_offset
+		   + stub_entry->stub_sec->output_section->vma
+		   - location);
+	  addend = -8;
+	}
+      break;
+
+    /* Something we don't know how to handle.  */
+    default:
+      return bfd_reloc_notsupported;
+    }
+
+  /* Make sure we can reach the stub.  */
+  if (max_branch_offset != 0
+      && value + addend + max_branch_offset >= 2*max_branch_offset)
+    {
+      (*_bfd_error_handler)
+	(_("%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections"),
+	 bfd_get_filename (input_bfd),
+	 input_section->name,
+	 (long) rel->r_offset,
+	 stub_entry->root.string);
+      return bfd_reloc_notsupported;
+    }
+
+  val = hppa_field_adjust (value, addend, r_field);
+
+  switch (r_type)
+    {
+    case R_PARISC_PCREL12F:
+    case R_PARISC_PCREL17C:
+    case R_PARISC_PCREL17F:
+    case R_PARISC_PCREL17R:
+    case R_PARISC_PCREL22F:
+    case R_PARISC_DIR17F:
+    case R_PARISC_DIR17R:
+      /* This is a branch.  Divide the offset by four.
+	 Note that we need to decide whether it's a branch or
+	 otherwise by inspecting the reloc.  Inspecting insn won't
+	 work as insn might be from a .word directive.  */
+      val >>= 2;
+      break;
+
+    default:
+      break;
+    }
+
+  insn = hppa_rebuild_insn (insn, val, r_format);
+
+  /* Update the instruction word.  */
+  bfd_put_32 (input_bfd, (bfd_vma) insn, hit_data);
+  return bfd_reloc_ok;
+}
+
+/* Relocate an HPPA ELF section.  */
+
+static boolean
+elf32_hppa_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;
+{
+  bfd *dynobj;
+  bfd_vma *local_got_offsets;
+  struct elf32_hppa_link_hash_table *hplink;
+  Elf_Internal_Shdr *symtab_hdr;
+  Elf_Internal_Rela *rel;
+  Elf_Internal_Rela *relend;
+  asection *sreloc;
+
+  symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+
+  hplink = hppa_link_hash_table (info);
+  dynobj = hplink->root.dynobj;
+  local_got_offsets = elf_local_got_offsets (input_bfd);
+  sreloc = NULL;
+
+  rel = relocs;
+  relend = relocs + input_section->reloc_count;
+  for (; rel < relend; rel++)
+    {
+      unsigned int r_type;
+      reloc_howto_type *howto;
+      unsigned int r_symndx;
+      struct elf32_hppa_link_hash_entry *h;
+      Elf_Internal_Sym *sym;
+      asection *sym_sec;
+      bfd_vma relocation;
+      bfd_reloc_status_type r;
+      const char *sym_name;
+      boolean plabel;
+
+      r_type = ELF32_R_TYPE (rel->r_info);
+      if (r_type >= (unsigned int) R_PARISC_UNIMPLEMENTED)
+	{
+	  bfd_set_error (bfd_error_bad_value);
+	  return false;
+	}
+      if (r_type == (unsigned int) R_PARISC_GNU_VTENTRY
+	  || r_type == (unsigned int) R_PARISC_GNU_VTINHERIT)
+	continue;
+
+      r_symndx = ELF32_R_SYM (rel->r_info);
+
+      if (info->relocateable)
+	{
+	  /* This is a relocateable link.  We don't have to change
+	     anything, unless the reloc is against a section symbol,
+	     in which case we have to adjust according to where the
+	     section symbol winds up in the output section.  */
+	  if (r_symndx < symtab_hdr->sh_info)
+	    {
+	      sym = local_syms + r_symndx;
+	      if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+		{
+		  sym_sec = local_sections[r_symndx];
+		  rel->r_addend += sym_sec->output_offset;
+		}
+	    }
+	  continue;
+	}
+
+      /* This is a final link.  */
+      h = NULL;
+      sym = NULL;
+      sym_sec = NULL;
+      if (r_symndx < symtab_hdr->sh_info)
+	{
+	  /* This is a local symbol, h defaults to NULL.  */
+	  sym = local_syms + r_symndx;
+	  sym_sec = local_sections[r_symndx];
+	  relocation = ((ELF_ST_TYPE (sym->st_info) == STT_SECTION
+			   ? 0 : sym->st_value)
+			 + sym_sec->output_offset
+			 + sym_sec->output_section->vma);
+	}
+      else
+	{
+	  int indx;
+
+	  /* It's a global; Find its entry in the link hash.  */
+	  indx = r_symndx - symtab_hdr->sh_info;
+	  h = ((struct elf32_hppa_link_hash_entry *)
+	       elf_sym_hashes (input_bfd)[indx]);
+	  while (h->elf.root.type == bfd_link_hash_indirect
+		 || h->elf.root.type == bfd_link_hash_warning)
+	    h = (struct elf32_hppa_link_hash_entry *) h->elf.root.u.i.link;
+
+	  relocation = 0;
+	  if (h->elf.root.type == bfd_link_hash_defined
+	      || h->elf.root.type == bfd_link_hash_defweak)
+	    {
+	      sym_sec = h->elf.root.u.def.section;
+	      /* If sym_sec->output_section is NULL, then it's a
+		 symbol defined in a shared library.  */
+	      if (sym_sec->output_section != NULL)
+		relocation = (h->elf.root.u.def.value
+			      + sym_sec->output_offset
+			      + sym_sec->output_section->vma);
+	    }
+	  else if (h->elf.root.type == bfd_link_hash_undefweak)
+	    ;
+	  else if (info->shared && !info->no_undefined
+		   && ELF_ST_VISIBILITY (h->elf.other) == STV_DEFAULT)
+	    {
+	      if (info->symbolic)
+		if (!((*info->callbacks->undefined_symbol)
+		      (info, h->elf.root.root.string, input_bfd,
+		       input_section, rel->r_offset, false)))
+		  return false;
+	    }
+	  else
+	    {
+	      if (!((*info->callbacks->undefined_symbol)
+		    (info, h->elf.root.root.string, input_bfd,
+		     input_section, rel->r_offset, true)))
+		return false;
+	    }
+	}
+
+      /* Do any required modifications to the relocation value, and
+	 determine what types of dynamic info we need to output, if
+	 any.  */
+      plabel = 0;
+      switch (r_type)
+	{
+	case R_PARISC_DLTIND14F:
+	case R_PARISC_DLTIND14R:
+	case R_PARISC_DLTIND21L:
+	  /* Relocation is to the entry for this symbol in the global
+	     offset table.  */
+	  if (h != NULL)
+	    {
+	      bfd_vma off;
+
+	      off = h->elf.got.offset;
+	      BFD_ASSERT (off != (bfd_vma) -1);
+
+	      if (! hplink->root.dynamic_sections_created
+		  || (info->shared
+		      && (info->symbolic || h->elf.dynindx == -1)
+		      && (h->elf.elf_link_hash_flags
+			  & ELF_LINK_HASH_DEF_REGULAR) != 0))
+		{
+		  /* This is actually a static link, or it is a
+		     -Bsymbolic link and the symbol is defined
+		     locally, or the symbol was forced to be local
+		     because of a version file.  We must initialize
+		     this entry in the global offset table.  Since the
+		     offset must always be a multiple of 4, we use the
+		     least significant bit to record whether we have
+		     initialized it already.
+
+		     When doing a dynamic link, we create a .rela.got
+		     relocation entry to initialize the value.  This
+		     is done in the finish_dynamic_symbol routine.  */
+		  if ((off & 1) != 0)
+		    off &= ~1;
+		  else
+		    {
+		      bfd_put_32 (output_bfd, relocation,
+				  hplink->sgot->contents + off);
+		      h->elf.got.offset |= 1;
+		    }
+		}
+
+	      relocation = off;
+	    }
+	  else
+	    {
+	      /* Local symbol case.  */
+	      bfd_vma off;
+
+	      BFD_ASSERT (local_got_offsets != NULL
+			  && local_got_offsets[r_symndx] != (bfd_vma) -1);
+
+	      off = local_got_offsets[r_symndx];
+
+	      /* The offset must always be a multiple of 4.  We use
+		 the least significant bit to record whether we have
+		 already generated the necessary reloc.  */
+	      if ((off & 1) != 0)
+		off &= ~1;
+	      else
+		{
+		  bfd_put_32 (output_bfd, relocation,
+			      hplink->sgot->contents + off);
+
+		  if (info->shared)
+		    {
+		      /* Output a dynamic *ABS* relocation for this
+			 GOT entry.  In this case it is relative to
+			 the base of the object because the symbol
+			 index is zero.  */
+		      Elf_Internal_Rela outrel;
+		      asection *srelgot = hplink->srelgot;
+
+		      outrel.r_offset = (off
+					 + hplink->sgot->output_offset
+					 + hplink->sgot->output_section->vma);
+		      outrel.r_info = ELF32_R_INFO (0, R_PARISC_DIR32);
+		      outrel.r_addend = relocation;
+		      bfd_elf32_swap_reloca_out (output_bfd, &outrel,
+						 ((Elf32_External_Rela *)
+						  srelgot->contents
+						  + srelgot->reloc_count));
+		      ++srelgot->reloc_count;
+		    }
+
+		  local_got_offsets[r_symndx] |= 1;
+		}
+
+	      relocation = off;
+	    }
+
+	  /* Add the base of the GOT to the relocation value.  */
+	  relocation += (hplink->sgot->output_offset
+			 + hplink->sgot->output_section->vma);
+	  break;
+
+	case R_PARISC_PLABEL14R:
+	case R_PARISC_PLABEL21L:
+	case R_PARISC_PLABEL32:
+	  if (hplink->root.dynamic_sections_created)
+	    {
+	      bfd_vma off;
+
+	      /* If we have a global symbol with a PLT slot, then
+		 redirect this relocation to it.  */
+	      if (h != NULL)
+		{
+		  off = h->elf.plt.offset;
+		}
+	      else
+		{
+		  int indx;
+
+		  indx = r_symndx + symtab_hdr->sh_info;
+		  off = local_got_offsets[indx];
+
+		  /* As for the local .got entry case, we use the last
+		     bit to record whether we've already initialised
+		     this local .plt entry.  */
+		  if ((off & 1) != 0)
+		    off &= ~1;
+		  else
+		    {
+		      bfd_put_32 (output_bfd,
+				  relocation,
+				  hplink->splt->contents + off);
+		      bfd_put_32 (output_bfd,
+				  elf_gp (hplink->splt->output_section->owner),
+				  hplink->splt->contents + off + 4);
+
+		      if (info->shared)
+			{
+			  /* Output a dynamic IPLT relocation for this
+			     PLT entry.  */
+			  Elf_Internal_Rela outrel;
+			  asection *srelplt = hplink->srelplt;
+
+			  outrel.r_offset = (off
+					     + hplink->splt->output_offset
+					     + hplink->splt->output_section->vma);
+			  outrel.r_info = ELF32_R_INFO (0, R_PARISC_IPLT);
+			  outrel.r_addend = relocation;
+			  bfd_elf32_swap_reloca_out (output_bfd, &outrel,
+						     ((Elf32_External_Rela *)
+						      srelplt->contents
+						      + srelplt->reloc_count));
+			  ++srelplt->reloc_count;
+			}
+
+		      local_got_offsets[indx] |= 1;
+		    }
+		}
+
+	      BFD_ASSERT (off < (bfd_vma) -2);
+
+	      /* PLABELs contain function pointers.  Relocation is to
+		 the entry for the function in the .plt.  The magic +2
+		 offset signals to $$dyncall that the function pointer
+		 is in the .plt and thus has a gp pointer too.
+		 Exception:  Undefined PLABELs should have a value of
+		 zero.  */
+	      if (h == NULL
+		  || (h->elf.root.type != bfd_link_hash_undefweak
+		      && h->elf.root.type != bfd_link_hash_undefined))
+		{
+		  relocation = (off
+				+ hplink->splt->output_offset
+				+ hplink->splt->output_section->vma
+				+ 2);
+		}
+	      plabel = 1;
+	    }
+	  /* Fall through and possibly emit a dynamic relocation.  */
+
+	case R_PARISC_DIR17F:
+	case R_PARISC_DIR17R:
+	case R_PARISC_DIR14F:
+	case R_PARISC_DIR14R:
+	case R_PARISC_DIR21L:
+	case R_PARISC_DPREL14F:
+	case R_PARISC_DPREL14R:
+	case R_PARISC_DPREL21L:
+	case R_PARISC_DIR32:
+	  /* The reloc types handled here and this conditional
+	     expression must match the code in check_relocs and
+	     hppa_discard_copies.  ie. We need exactly the same
+	     condition as in check_relocs, with some extra conditions
+	     (dynindx test in this case) to cater for relocs removed
+	     by hppa_discard_copies.  */
+	  if ((input_section->flags & SEC_ALLOC) != 0
+	      && info->shared
+#if RELATIVE_DYNAMIC_RELOCS
+	      && (is_absolute_reloc (r_type)
+		  || ((!info->symbolic
+		       || (h != NULL
+			   && ((h->elf.elf_link_hash_flags
+				& ELF_LINK_HASH_DEF_REGULAR) == 0
+			       || h->elf.root.type == bfd_link_hash_defweak)))
+		      && (h == NULL || h->elf.dynindx != -1)))
+#endif
+	      )
+	    {
+	      Elf_Internal_Rela outrel;
+	      boolean skip;
+
+	      /* When generating a shared object, these relocations
+		 are copied into the output file to be resolved at run
+		 time.  */
+
+	      if (sreloc == NULL)
+		{
+		  const char *name;
+
+		  name = (bfd_elf_string_from_elf_section
+			  (input_bfd,
+			   elf_elfheader (input_bfd)->e_shstrndx,
+			   elf_section_data (input_section)->rel_hdr.sh_name));
+		  if (name == NULL)
+		    return false;
+		  sreloc = bfd_get_section_by_name (dynobj, name);
+		  BFD_ASSERT (sreloc != NULL);
+		}
+
+	      outrel.r_offset = rel->r_offset;
+	      outrel.r_addend = rel->r_addend;
+	      skip = false;
+	      if (elf_section_data (input_section)->stab_info != NULL)
+		{
+		  bfd_vma off;
+
+		  off = (_bfd_stab_section_offset
+			 (output_bfd, &hplink->root.stab_info,
+			  input_section,
+			  &elf_section_data (input_section)->stab_info,
+			  rel->r_offset));
+		  if (off == (bfd_vma) -1)
+		    skip = true;
+		  outrel.r_offset = off;
+		}
+
+	      outrel.r_offset += (input_section->output_offset
+				  + input_section->output_section->vma);
+
+	      if (skip)
+		{
+		  memset (&outrel, 0, sizeof (outrel));
+		}
+	      else if (h != NULL
+		       && h->elf.dynindx != -1
+		       && (plabel
+			   || !info->symbolic
+			   || (h->elf.elf_link_hash_flags
+			       & ELF_LINK_HASH_DEF_REGULAR) == 0))
+		{
+		  outrel.r_info = ELF32_R_INFO (h->elf.dynindx, r_type);
+		}
+	      else /* It's a local symbol, or one marked to become local.  */
+		{
+		  int indx = 0;
+
+		  /* Add the absolute offset of the symbol.  */
+		  outrel.r_addend += relocation;
+
+		  /* Global plabels need to be processed by the
+		     dynamic linker so that functions have at most one
+		     fptr.  For this reason, we need to differentiate
+		     between global and local plabels, which we do by
+		     providing the function symbol for a global plabel
+		     reloc, and no symbol for local plabels.  */
+		  if (! plabel
+		      && sym_sec != NULL
+		      && sym_sec->output_section != NULL
+		      && ! bfd_is_abs_section (sym_sec))
+		    {
+		      indx = elf_section_data (sym_sec->output_section)->dynindx;
+		      /* We are turning this relocation into one
+			 against a section symbol, so subtract out the
+			 output section's address but not the offset
+			 of the input section in the output section.  */
+		      outrel.r_addend -= sym_sec->output_section->vma;
+		    }
+
+		  outrel.r_info = ELF32_R_INFO (indx, r_type);
+		}
+
+	      bfd_elf32_swap_reloca_out (output_bfd, &outrel,
+					 ((Elf32_External_Rela *)
+					  sreloc->contents
+					  + sreloc->reloc_count));
+	      ++sreloc->reloc_count;
+	    }
+	  break;
+
+	default:
+	  break;
+	}
+
+      r = final_link_relocate (input_section, contents, rel, relocation,
+			       hplink, sym_sec, h);
+
+      if (r == bfd_reloc_ok)
+	continue;
+
+      if (h != NULL)
+	sym_name = h->elf.root.root.string;
+      else
+	{
+	  sym_name = bfd_elf_string_from_elf_section (input_bfd,
+						      symtab_hdr->sh_link,
+						      sym->st_name);
+	  if (sym_name == NULL)
+	    return false;
+	  if (*sym_name == '\0')
+	    sym_name = bfd_section_name (input_bfd, sym_sec);
+	}
+
+      howto = elf_hppa_howto_table + r_type;
+
+      if (r == bfd_reloc_undefined || r == bfd_reloc_notsupported)
+	{
+	  (*_bfd_error_handler)
+	    (_("%s(%s+0x%lx): cannot handle %s for %s"),
+	     bfd_get_filename (input_bfd),
+	     input_section->name,
+	     (long) rel->r_offset,
+	     howto->name,
+	     sym_name);
+	}
+      else
+	{
+	  if (!((*info->callbacks->reloc_overflow)
+		(info, sym_name, howto->name, (bfd_vma) 0,
+		 input_bfd, input_section, rel->r_offset)))
+	    return false;
+	}
+    }
+
+  return true;
+}
+
+/* Finish up dynamic symbol handling.  We set the contents of various
+   dynamic sections here.  */
+
+static boolean
+elf32_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
+     bfd *output_bfd;
+     struct bfd_link_info *info;
+     struct elf_link_hash_entry *h;
+     Elf_Internal_Sym *sym;
+{
+  struct elf32_hppa_link_hash_table *hplink;
+  bfd *dynobj;
+
+  hplink = hppa_link_hash_table (info);
+  dynobj = hplink->root.dynobj;
+
+  if (h->plt.offset != (bfd_vma) -1)
+    {
+      bfd_vma value;
+
+      /* This symbol has an entry in the procedure linkage table.  Set
+	 it up.
+
+	 The format of a plt entry is
+	 <funcaddr>
+	 <__gp>
+      */
+      value = 0;
+      if (h->root.type == bfd_link_hash_defined
+	  || h->root.type == bfd_link_hash_defweak)
+	{
+	  value = h->root.u.def.value;
+	  if (h->root.u.def.section->output_section != NULL)
+	    value += (h->root.u.def.section->output_offset
+		      + h->root.u.def.section->output_section->vma);
+	}
+
+      if (! ((struct elf32_hppa_link_hash_entry *) h)->pic_call)
+	{
+	  Elf_Internal_Rela rel;
+
+	  /* Create a dynamic IPLT relocation for this entry.  */
+	  rel.r_offset = (h->plt.offset
+			  + hplink->splt->output_offset
+			  + hplink->splt->output_section->vma);
+	  if (! ((struct elf32_hppa_link_hash_entry *) h)->plt_abs
+	      && h->dynindx != -1)
+	    {
+	      /* To support lazy linking, the function pointer is
+		 initialised to point to a special stub stored at the
+		 end of the .plt.  This is only done for plt entries
+		 with a non-*ABS* dynamic relocation.  */
+	      value = (hplink->splt->output_offset
+		       + hplink->splt->output_section->vma
+		       + hplink->splt->_raw_size
+		       - sizeof (plt_stub)
+		       + PLT_STUB_ENTRY);
+	      rel.r_info = ELF32_R_INFO (h->dynindx, R_PARISC_IPLT);
+	      rel.r_addend = 0;
+	    }
+	  else
+	    {
+	      /* This symbol has been marked to become local, and is
+		 used by a plabel so must be kept in the .plt.  */
+	      rel.r_info = ELF32_R_INFO (0, R_PARISC_IPLT);
+	      rel.r_addend = value;
+	    }
+
+	  bfd_elf32_swap_reloca_out (hplink->splt->output_section->owner,
+				     &rel,
+				     ((Elf32_External_Rela *)
+				      hplink->srelplt->contents
+				      + hplink->srelplt->reloc_count));
+	  hplink->srelplt->reloc_count++;
+	}
+
+      bfd_put_32 (hplink->splt->owner,
+		  value,
+		  hplink->splt->contents + h->plt.offset);
+      bfd_put_32 (hplink->splt->owner,
+		  elf_gp (hplink->splt->output_section->owner),
+		  hplink->splt->contents + h->plt.offset + 4);
+      if (PLABEL_PLT_ENTRY_SIZE != PLT_ENTRY_SIZE
+	  && ((struct elf32_hppa_link_hash_entry *) h)->plabel
+	  && h->dynindx != -1)
+	{
+	  memset (hplink->splt->contents + h->plt.offset + 8,
+		  0, PLABEL_PLT_ENTRY_SIZE - PLT_ENTRY_SIZE);
+	}
+
+      if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+	{
+	  /* Mark the symbol as undefined, rather than as defined in
+	     the .plt section.  Leave the value alone.  */
+	  sym->st_shndx = SHN_UNDEF;
+	}
+    }
+
+  if (h->got.offset != (bfd_vma) -1)
+    {
+      Elf_Internal_Rela rel;
+
+      /* This symbol has an entry in the global offset table.  Set it
+	 up.  */
+
+      rel.r_offset = ((h->got.offset &~ (bfd_vma) 1)
+		      + hplink->sgot->output_offset
+		      + hplink->sgot->output_section->vma);
+
+      /* If this is a static link, or it is a -Bsymbolic link and the
+	 symbol is defined locally or was forced to be local because
+	 of a version file, we just want to emit a RELATIVE reloc.
+	 The entry in the global offset table will already have been
+	 initialized in the relocate_section function.  */
+      if (! hplink->root.dynamic_sections_created
+	  || (info->shared
+	      && (info->symbolic || h->dynindx == -1)
+	      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+	{
+	  rel.r_info = ELF32_R_INFO (0, R_PARISC_DIR32);
+	  rel.r_addend = (h->root.u.def.value
+			  + h->root.u.def.section->output_offset
+			  + h->root.u.def.section->output_section->vma);
+	}
+      else
+	{
+	  BFD_ASSERT((h->got.offset & 1) == 0);
+	  bfd_put_32 (output_bfd, (bfd_vma) 0,
+		      hplink->sgot->contents + h->got.offset);
+	  rel.r_info = ELF32_R_INFO (h->dynindx, R_PARISC_DIR32);
+	  rel.r_addend = 0;
+	}
+
+      bfd_elf32_swap_reloca_out (output_bfd, &rel,
+				 ((Elf32_External_Rela *)
+				  hplink->srelgot->contents
+				  + hplink->srelgot->reloc_count));
+      ++hplink->srelgot->reloc_count;
+    }
+
+  if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
+    {
+      asection *s;
+      Elf_Internal_Rela rel;
+
+      /* This symbol needs a copy reloc.  Set it up.  */
+
+      BFD_ASSERT (h->dynindx != -1
+		  && (h->root.type == bfd_link_hash_defined
+		      || h->root.type == bfd_link_hash_defweak));
+
+      s = hplink->srelbss;
+
+      rel.r_offset = (h->root.u.def.value
+		      + h->root.u.def.section->output_offset
+		      + h->root.u.def.section->output_section->vma);
+      rel.r_addend = 0;
+      rel.r_info = ELF32_R_INFO (h->dynindx, R_PARISC_COPY);
+      bfd_elf32_swap_reloca_out (output_bfd, &rel,
+				 ((Elf32_External_Rela *) s->contents
+				  + s->reloc_count));
+      ++s->reloc_count;
+    }
+
+  /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
+  if (h->root.root.string[0] == '_'
+      && (strcmp (h->root.root.string, "_DYNAMIC") == 0
+	  || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0))
+    {
+      sym->st_shndx = SHN_ABS;
+    }
+
+  return true;
+}
+
+/* Finish up the dynamic sections.  */
+
+static boolean
+elf32_hppa_finish_dynamic_sections (output_bfd, info)
+     bfd *output_bfd;
+     struct bfd_link_info *info;
+{
+  bfd *dynobj;
+  struct elf32_hppa_link_hash_table *hplink;
+  asection *sdyn;
+
+  hplink = hppa_link_hash_table (info);
+  dynobj = hplink->root.dynobj;
+
+  sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+
+  if (hplink->root.dynamic_sections_created)
+    {
+      Elf32_External_Dyn *dyncon, *dynconend;
+
+      BFD_ASSERT (sdyn != NULL);
+
+      dyncon = (Elf32_External_Dyn *) sdyn->contents;
+      dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+      for (; dyncon < dynconend; dyncon++)
+	{
+	  Elf_Internal_Dyn dyn;
+	  asection *s;
+
+	  bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
+
+	  switch (dyn.d_tag)
+	    {
+	    default:
+	      break;
+
+	    case DT_PLTGOT:
+	      /* Use PLTGOT to set the GOT register.  */
+	      dyn.d_un.d_ptr = elf_gp (output_bfd);
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+
+	    case DT_JMPREL:
+	      s = hplink->srelplt;
+	      dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+
+	    case DT_PLTRELSZ:
+	      s = hplink->srelplt;
+	      if (s->_cooked_size != 0)
+		dyn.d_un.d_val = s->_cooked_size;
+	      else
+		dyn.d_un.d_val = s->_raw_size;
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+
+	    case DT_INIT:
+	    case DT_FINI:
+	      {
+		struct elf_link_hash_entry *h;
+		const char *funcname;
+
+		if (dyn.d_tag == DT_INIT)
+		  funcname = info->init_function;
+		else
+		  funcname = info->fini_function;
+
+		h = elf_link_hash_lookup (&hplink->root, funcname,
+					  false, false, false);
+
+		/* This is a function pointer.  The magic +2 offset
+		   signals to $$dyncall that the function pointer
+		   is in the .plt and thus has a gp pointer too.  */
+		dyn.d_un.d_ptr = (h->plt.offset
+				  + hplink->splt->output_offset
+				  + hplink->splt->output_section->vma
+				  + 2);
+		bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+		break;
+	      }
+	    }
+	}
+    }
+
+  if (hplink->sgot->_raw_size != 0)
+    {
+      /* Fill in the first entry in the global offset table.
+	 We use it to point to our dynamic section, if we have one.  */
+      bfd_put_32 (output_bfd,
+		  (sdyn != NULL
+		   ? sdyn->output_section->vma + sdyn->output_offset
+		   : (bfd_vma) 0),
+		  hplink->sgot->contents);
+
+      /* The second entry is reserved for use by the dynamic linker.  */
+      memset (hplink->sgot->contents + GOT_ENTRY_SIZE, 0, GOT_ENTRY_SIZE);
+
+      /* Set .got entry size.  */
+      elf_section_data (hplink->sgot->output_section)
+	->this_hdr.sh_entsize = GOT_ENTRY_SIZE;
+    }
+
+  if (hplink->splt->_raw_size != 0)
+    {
+      /* Set plt entry size.  */
+      elf_section_data (hplink->splt->output_section)
+	->this_hdr.sh_entsize = PLT_ENTRY_SIZE;
+
+      if (hplink->need_plt_stub)
+	{
+	  /* Set up the .plt stub.  */
+	  memcpy (hplink->splt->contents
+		  + hplink->splt->_raw_size - sizeof (plt_stub),
+		  plt_stub, sizeof (plt_stub));
+
+	  if ((hplink->splt->output_offset
+	       + hplink->splt->output_section->vma
+	       + hplink->splt->_raw_size)
+	      != (hplink->sgot->output_offset
+		  + hplink->sgot->output_section->vma))
+	    {
+	      (*_bfd_error_handler)
+		(_(".got section not immediately after .plt section"));
+	      return false;
+	    }
+	}
+    }
+
+  return true;
+}
+
+/* Called when writing out an object file to decide the type of a
+   symbol.  */
+static int
+elf32_hppa_elf_get_symbol_type (elf_sym, type)
+     Elf_Internal_Sym *elf_sym;
+     int type;
+{
+  if (ELF_ST_TYPE (elf_sym->st_info) == STT_PARISC_MILLI)
+    return STT_PARISC_MILLI;
+  else
+    return type;
 }
 
 /* Misc BFD support code.  */
-#define bfd_elf32_bfd_reloc_type_lookup		elf_hppa_reloc_type_lookup
-#define bfd_elf32_bfd_is_local_label_name	elf_hppa_is_local_label_name
-#define elf_info_to_howto               	elf_hppa_info_to_howto
-#define elf_info_to_howto_rel           	elf_hppa_info_to_howto_rel
+#define bfd_elf32_bfd_is_local_label_name    elf_hppa_is_local_label_name
+#define bfd_elf32_bfd_reloc_type_lookup	     elf_hppa_reloc_type_lookup
+#define elf_info_to_howto		     elf_hppa_info_to_howto
+#define elf_info_to_howto_rel		     elf_hppa_info_to_howto_rel
 
 /* Stuff for the BFD linker.  */
-#define elf_backend_relocate_section		elf32_hppa_relocate_section
-#define elf_backend_add_symbol_hook		elf32_hppa_add_symbol_hook
-#define bfd_elf32_bfd_link_hash_table_create \
-  elf32_hppa_link_hash_table_create
-#define elf_backend_fake_sections		elf_hppa_fake_sections
+#define bfd_elf32_bfd_final_link	     _bfd_elf32_gc_common_final_link
+#define bfd_elf32_bfd_link_hash_table_create elf32_hppa_link_hash_table_create
+#define elf_backend_add_symbol_hook	     elf32_hppa_add_symbol_hook
+#define elf_backend_adjust_dynamic_symbol    elf32_hppa_adjust_dynamic_symbol
+#define elf_backend_check_relocs	     elf32_hppa_check_relocs
+#define elf_backend_create_dynamic_sections  elf32_hppa_create_dynamic_sections
+#define elf_backend_fake_sections	     elf_hppa_fake_sections
+#define elf_backend_relocate_section	     elf32_hppa_relocate_section
+#define elf_backend_hide_symbol		     elf32_hppa_hide_symbol
+#define elf_backend_finish_dynamic_symbol    elf32_hppa_finish_dynamic_symbol
+#define elf_backend_finish_dynamic_sections  elf32_hppa_finish_dynamic_sections
+#define elf_backend_size_dynamic_sections    elf32_hppa_size_dynamic_sections
+#define elf_backend_gc_mark_hook	     elf32_hppa_gc_mark_hook
+#define elf_backend_gc_sweep_hook	     elf32_hppa_gc_sweep_hook
+#define elf_backend_object_p		     elf32_hppa_object_p
+#define elf_backend_final_write_processing   elf_hppa_final_write_processing
+#define elf_backend_get_symbol_type	     elf32_hppa_elf_get_symbol_type
 
+#define elf_backend_can_gc_sections	     1
+#define elf_backend_plt_alignment	     2
+#define elf_backend_want_got_plt	     0
+#define elf_backend_plt_readonly	     0
+#define elf_backend_want_plt_sym	     0
+#define elf_backend_got_header_size	     8
 
 #define TARGET_BIG_SYM		bfd_elf32_hppa_vec
 #define TARGET_BIG_NAME		"elf32-hppa"
diff --git a/bfd/elf32-hppa.h b/bfd/elf32-hppa.h
index 17c5e16..b7b59e6 100644
--- a/bfd/elf32-hppa.h
+++ b/bfd/elf32-hppa.h
@@ -37,13 +37,18 @@
 #include "elf/hppa.h"
 
 boolean elf32_hppa_size_stubs
-  PARAMS ((bfd *, bfd *, struct bfd_link_info *));
+  PARAMS ((bfd *, bfd *, struct bfd_link_info *, boolean, bfd_signed_vma,
+	   asection * (*) PARAMS ((const char *, asection *)),
+	   void (*) PARAMS ((void))));
 
-boolean elf32_hppa_build_stubs
+boolean elf32_hppa_set_gp
   PARAMS ((bfd *, struct bfd_link_info *));
 
+boolean elf32_hppa_build_stubs
+  PARAMS ((struct bfd_link_info *));
+
 extern elf_hppa_reloc_type ** _bfd_elf32_hppa_gen_reloc_type
-  PARAMS ((bfd *, elf_hppa_reloc_type, int, int, int, asymbol *));
+  PARAMS ((bfd *, elf_hppa_reloc_type, int, unsigned int, int, asymbol *));
 
 /* Define groups of basic relocations.  FIXME:  These should
    be the only basic relocations created by GAS.  The rest
diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c
index 0715d86..d5b060e 100644
--- a/bfd/elf32-i370.c
+++ b/bfd/elf32-i370.c
@@ -19,8 +19,6 @@
 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 based on a preliminary PowerPC ELF ABI.
    But its been hacked on for the IBM 360/370 architectures.
    Basically, the 31bit relocation works, and just about everything
@@ -28,7 +26,6 @@
    dynamic loading to work ...  its never been tested ...
 */
 
-
 #include "bfd.h"
 #include "sysdep.h"
 #include "bfdlink.h"
@@ -272,7 +269,7 @@
   for (i = 0; i < sizeof (i370_elf_howto_raw) / sizeof (i370_elf_howto_raw[0]); i++)
     {
       type = i370_elf_howto_raw[i].type;
-      BFD_ASSERT (type < sizeof(i370_elf_howto_table) / sizeof(i370_elf_howto_table[0]));
+      BFD_ASSERT (type < sizeof (i370_elf_howto_table) / sizeof (i370_elf_howto_table[0]));
       i370_elf_howto_table[type] = &i370_elf_howto_raw[i];
     }
 }
@@ -350,7 +347,6 @@
 
 #define ELF_DYNAMIC_INTERPRETER "/lib/ld.so"
 
-
 /* Set the howto pointer for an i370 ELF reloc.  */
 
 static void
@@ -369,7 +365,7 @@
 /* hack alert --  the following several routines look generic to me ...
  * why are we bothering with them ???
  */
-/* Function to set whether a module needs the -mrelocatable bit set. */
+/* Function to set whether a module needs the -mrelocatable bit set.  */
 static boolean
 i370_elf_set_private_flags (abfd, flags)
      bfd *abfd;
@@ -471,7 +467,6 @@
   return true;
 }
 
-
 
 /* Set up any other section flags and such that may be necessary.  */
 /* XXX hack alert bogus This routine is mostly all junk and almost
@@ -479,7 +474,6 @@
  * just enough to allow glibc-2.1 ld.so to compile & link.
  */
 
-
 static boolean
 i370_elf_fake_sections (abfd, shdr, asect)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -610,7 +604,7 @@
 	return false;
     }
 
-   /* xxx beats me, seem to need a rela.text ... */
+   /* xxx beats me, seem to need a rela.text ...  */
    s = bfd_make_section (abfd, ".rela.text");
    if (s == NULL
       || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
@@ -654,7 +648,6 @@
 		      && (h->elf_link_hash_flags
 			  & ELF_LINK_HASH_DEF_REGULAR) == 0)));
 
-
   s = bfd_get_section_by_name (dynobj, ".rela.text");
   BFD_ASSERT (s != NULL);
   s->_raw_size += sizeof (Elf32_External_Rela);
@@ -879,7 +872,7 @@
 	      asection *target;
 	      const char *outname;
 
-	      /* Remember whether there are any relocation sections. */
+	      /* Remember whether there are any relocation sections.  */
 	      relocs = true;
 
 	      /* If this relocation section applies to a read only
@@ -959,6 +952,7 @@
 	{
 	  if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
@@ -1418,12 +1412,12 @@
 	    relocation = 0;
 	  else
 	    {
-	      (*info->callbacks->undefined_symbol)(info,
-						   h->root.root.string,
-						   input_bfd,
-						   input_section,
-						   rel->r_offset,
-						   true);
+	      (*info->callbacks->undefined_symbol) (info,
+						    h->root.root.string,
+						    input_bfd,
+						    input_section,
+						    rel->r_offset,
+						    true);
 	      ret = false;
 	      continue;
 	    }
@@ -1561,9 +1555,9 @@
 #ifdef DEBUG
 			  if (indx <= 0)
 			    {
-			      printf("indx=%d section=%s flags=%08x name=%s\n",
-				     indx, osec->name, osec->flags,
-				     h->root.root.string);
+			      printf ("indx=%d section=%s flags=%08x name=%s\n",
+				      indx, osec->name, osec->flags,
+				      h->root.root.string);
 			    }
 #endif
 			}
@@ -1601,7 +1595,6 @@
 	  continue;
 	}
 
-
 #ifdef DEBUG
       fprintf (stderr, "\ttype = %s (%d), name = %s, symbol index = %ld, offset = %ld, addend = %ld\n",
 	       howto->name,
@@ -1646,13 +1639,13 @@
 		      name = bfd_section_name (input_bfd, sec);
 		  }
 
-		(*info->callbacks->reloc_overflow)(info,
-						   name,
-						   howto->name,
-						   (bfd_vma) 0,
-						   input_bfd,
-						   input_section,
-						   offset);
+		(*info->callbacks->reloc_overflow) (info,
+						    name,
+						    howto->name,
+						    (bfd_vma) 0,
+						    input_bfd,
+						    input_section,
+						    offset);
 	      }
 	      break;
 
@@ -1660,7 +1653,6 @@
 	}
     }
 
-
 #ifdef DEBUG
   fprintf (stderr, "\n");
 #endif
@@ -1689,8 +1681,6 @@
 #define ELF_MAXPAGESIZE		0x1000
 #define elf_info_to_howto	i370_elf_info_to_howto
 
-
-
 #define elf_backend_plt_not_loaded 1
 #define elf_backend_got_symbol_offset 4
 
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 53edaaf..f538bf6 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1,5 +1,6 @@
 /* Intel 80386/80486-specific support for 32-bit ELF
-   Copyright 1993, 94-98, 1999 Free Software Foundation, Inc.
+   Copyright 1993, 94, 95, 96, 97, 98, 99, 2000
+   Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -56,35 +57,66 @@
 
 static reloc_howto_type elf_howto_table[]=
 {
-  HOWTO(R_386_NONE,	 0,0, 0,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_NONE",	    true,0x00000000,0x00000000,false),
-  HOWTO(R_386_32,	 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_32",	    true,0xffffffff,0xffffffff,false),
-  HOWTO(R_386_PC32,	 0,2,32,true, 0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PC32",	    true,0xffffffff,0xffffffff,true),
-  HOWTO(R_386_GOT32,	 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOT32",    true,0xffffffff,0xffffffff,false),
-  HOWTO(R_386_PLT32,	 0,2,32,true,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PLT32",    true,0xffffffff,0xffffffff,true),
-  HOWTO(R_386_COPY,      0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_COPY",	    true,0xffffffff,0xffffffff,false),
-  HOWTO(R_386_GLOB_DAT,  0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GLOB_DAT", true,0xffffffff,0xffffffff,false),
-  HOWTO(R_386_JUMP_SLOT, 0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_JUMP_SLOT",true,0xffffffff,0xffffffff,false),
-  HOWTO(R_386_RELATIVE,  0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_RELATIVE", true,0xffffffff,0xffffffff,false),
-  HOWTO(R_386_GOTOFF,    0,2,32,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOTOFF",   true,0xffffffff,0xffffffff,false),
-  HOWTO(R_386_GOTPC,     0,2,32,true,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_GOTPC",    true,0xffffffff,0xffffffff,true),
-  EMPTY_HOWTO (11),
-  EMPTY_HOWTO (12),
-  EMPTY_HOWTO (13),
-  EMPTY_HOWTO (14),
-  EMPTY_HOWTO (15),
-  EMPTY_HOWTO (16),
-  EMPTY_HOWTO (17),
-  EMPTY_HOWTO (18),
-  EMPTY_HOWTO (19),
+  HOWTO(R_386_NONE, 0, 0, 0, false, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_386_NONE",
+	true, 0x00000000, 0x00000000, false),
+  HOWTO(R_386_32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_386_32",
+	true, 0xffffffff, 0xffffffff, false),
+  HOWTO(R_386_PC32, 0, 2, 32, true, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_386_PC32",
+	true, 0xffffffff, 0xffffffff, true),
+  HOWTO(R_386_GOT32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_386_GOT32",
+	true, 0xffffffff, 0xffffffff, false),
+  HOWTO(R_386_PLT32, 0, 2, 32, true, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_386_PLT32",
+	true, 0xffffffff, 0xffffffff, true),
+  HOWTO(R_386_COPY, 0, 2, 32, false, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_386_COPY",
+	true, 0xffffffff, 0xffffffff, false),
+  HOWTO(R_386_GLOB_DAT, 0, 2, 32, false, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_386_GLOB_DAT",
+	true, 0xffffffff, 0xffffffff, false),
+  HOWTO(R_386_JUMP_SLOT, 0, 2, 32, false, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_386_JUMP_SLOT",
+	true, 0xffffffff, 0xffffffff, false),
+  HOWTO(R_386_RELATIVE, 0, 2, 32, false, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_386_RELATIVE",
+	true, 0xffffffff, 0xffffffff, false),
+  HOWTO(R_386_GOTOFF, 0, 2, 32, false, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_386_GOTOFF",
+	true, 0xffffffff, 0xffffffff, false),
+  HOWTO(R_386_GOTPC, 0, 2, 32, true, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_386_GOTPC",
+	true, 0xffffffff, 0xffffffff, true),
+
+  /* We have a gap in the reloc numbers here.
+     R_386_standard counts the number up to this point, and
+     R_386_ext_offset is the value to subtract from a reloc type of
+     R_386_16 thru R_386_PC8 to form an index into this table.  */
+#define R_386_standard ((unsigned int) R_386_GOTPC + 1)
+#define R_386_ext_offset ((unsigned int) R_386_16 - R_386_standard)
+
   /* The remaining relocs are a GNU extension.  */
-  HOWTO(R_386_16,	 0,1,16,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_16",	    true,0xffff,0xffff,false),
-  HOWTO(R_386_PC16,	 0,1,16,true, 0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_PC16",	    true,0xffff,0xffff,true),
-  HOWTO(R_386_8,	 0,0,8,false,0,complain_overflow_bitfield, bfd_elf_generic_reloc,"R_386_8",	    true,0xff,0xff,false),
-  HOWTO(R_386_PC8,	 0,0,8,true, 0,complain_overflow_signed, bfd_elf_generic_reloc,"R_386_PC8",	    true,0xff,0xff,true),
-};
+  HOWTO(R_386_16, 0, 1, 16, false, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_386_16",
+	true, 0xffff, 0xffff, false),
+  HOWTO(R_386_PC16, 0, 1, 16, true, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_386_PC16",
+	true, 0xffff, 0xffff, true),
+  HOWTO(R_386_8, 0, 0, 8, false, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_386_8",
+	true, 0xff, 0xff, false),
+  HOWTO(R_386_PC8, 0, 0, 8, true, 0, complain_overflow_signed,
+	bfd_elf_generic_reloc, "R_386_PC8",
+	true, 0xff, 0xff, true),
+
+  /* Another gap.  */
+#define R_386_ext ((unsigned int) R_386_PC8 + 1 - R_386_ext_offset)
+#define R_386_vt_offset ((unsigned int) R_386_GNU_VTINHERIT - R_386_ext)
 
 /* GNU extension to record C++ vtable hierarchy.  */
-static reloc_howto_type elf32_i386_vtinherit_howto =
   HOWTO (R_386_GNU_VTINHERIT,	/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -97,10 +129,9 @@
 	 false,			/* partial_inplace */
 	 0,			/* src_mask */
 	 0,			/* dst_mask */
-	 false);
+	 false),
 
 /* GNU extension to record C++ vtable member usage.  */
-static reloc_howto_type elf32_i386_vtentry_howto =
   HOWTO (R_386_GNU_VTENTRY,	/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -113,7 +144,11 @@
 	 false,			/* partial_inplace */
 	 0,			/* src_mask */
 	 0,			/* dst_mask */
-	 false);
+	 false)
+
+#define R_386_vt ((unsigned int) R_386_GNU_VTENTRY + 1 - R_386_vt_offset)
+
+};
 
 #ifdef DEBUG_GEN_RELOC
 #define TRACE(str) fprintf (stderr, "i386 bfd reloc lookup %d (%s)\n", code, str)
@@ -130,76 +165,78 @@
     {
     case BFD_RELOC_NONE:
       TRACE ("BFD_RELOC_NONE");
-      return &elf_howto_table[ (int)R_386_NONE ];
+      return &elf_howto_table[(unsigned int) R_386_NONE ];
 
     case BFD_RELOC_32:
       TRACE ("BFD_RELOC_32");
-      return &elf_howto_table[ (int)R_386_32 ];
+      return &elf_howto_table[(unsigned int) R_386_32 ];
 
     case BFD_RELOC_CTOR:
       TRACE ("BFD_RELOC_CTOR");
-      return &elf_howto_table[ (int)R_386_32 ];
+      return &elf_howto_table[(unsigned int) R_386_32 ];
 
     case BFD_RELOC_32_PCREL:
       TRACE ("BFD_RELOC_PC32");
-      return &elf_howto_table[ (int)R_386_PC32 ];
+      return &elf_howto_table[(unsigned int) R_386_PC32 ];
 
     case BFD_RELOC_386_GOT32:
       TRACE ("BFD_RELOC_386_GOT32");
-      return &elf_howto_table[ (int)R_386_GOT32 ];
+      return &elf_howto_table[(unsigned int) R_386_GOT32 ];
 
     case BFD_RELOC_386_PLT32:
       TRACE ("BFD_RELOC_386_PLT32");
-      return &elf_howto_table[ (int)R_386_PLT32 ];
+      return &elf_howto_table[(unsigned int) R_386_PLT32 ];
 
     case BFD_RELOC_386_COPY:
       TRACE ("BFD_RELOC_386_COPY");
-      return &elf_howto_table[ (int)R_386_COPY ];
+      return &elf_howto_table[(unsigned int) R_386_COPY ];
 
     case BFD_RELOC_386_GLOB_DAT:
       TRACE ("BFD_RELOC_386_GLOB_DAT");
-      return &elf_howto_table[ (int)R_386_GLOB_DAT ];
+      return &elf_howto_table[(unsigned int) R_386_GLOB_DAT ];
 
     case BFD_RELOC_386_JUMP_SLOT:
       TRACE ("BFD_RELOC_386_JUMP_SLOT");
-      return &elf_howto_table[ (int)R_386_JUMP_SLOT ];
+      return &elf_howto_table[(unsigned int) R_386_JUMP_SLOT ];
 
     case BFD_RELOC_386_RELATIVE:
       TRACE ("BFD_RELOC_386_RELATIVE");
-      return &elf_howto_table[ (int)R_386_RELATIVE ];
+      return &elf_howto_table[(unsigned int) R_386_RELATIVE ];
 
     case BFD_RELOC_386_GOTOFF:
       TRACE ("BFD_RELOC_386_GOTOFF");
-      return &elf_howto_table[ (int)R_386_GOTOFF ];
+      return &elf_howto_table[(unsigned int) R_386_GOTOFF ];
 
     case BFD_RELOC_386_GOTPC:
       TRACE ("BFD_RELOC_386_GOTPC");
-      return &elf_howto_table[ (int)R_386_GOTPC ];
+      return &elf_howto_table[(unsigned int) R_386_GOTPC ];
 
       /* The remaining relocs are a GNU extension.  */
     case BFD_RELOC_16:
       TRACE ("BFD_RELOC_16");
-      return &elf_howto_table[(int) R_386_16];
+      return &elf_howto_table[(unsigned int) R_386_16 - R_386_ext_offset];
 
     case BFD_RELOC_16_PCREL:
       TRACE ("BFD_RELOC_16_PCREL");
-      return &elf_howto_table[(int) R_386_PC16];
+      return &elf_howto_table[(unsigned int) R_386_PC16 - R_386_ext_offset];
 
     case BFD_RELOC_8:
       TRACE ("BFD_RELOC_8");
-      return &elf_howto_table[(int) R_386_8];
+      return &elf_howto_table[(unsigned int) R_386_8 - R_386_ext_offset];
 
     case BFD_RELOC_8_PCREL:
       TRACE ("BFD_RELOC_8_PCREL");
-      return &elf_howto_table[(int) R_386_PC8];
+      return &elf_howto_table[(unsigned int) R_386_PC8 - R_386_ext_offset];
 
     case BFD_RELOC_VTABLE_INHERIT:
       TRACE ("BFD_RELOC_VTABLE_INHERIT");
-      return &elf32_i386_vtinherit_howto;
+      return &elf_howto_table[(unsigned int) R_386_GNU_VTINHERIT
+			     - R_386_vt_offset];
 
     case BFD_RELOC_VTABLE_ENTRY:
       TRACE ("BFD_RELOC_VTABLE_ENTRY");
-      return &elf32_i386_vtentry_howto;
+      return &elf_howto_table[(unsigned int) R_386_GNU_VTENTRY
+			     - R_386_vt_offset];
 
     default:
       break;
@@ -224,22 +261,20 @@
      arelent *cache_ptr;
      Elf32_Internal_Rel *dst;
 {
-  enum elf_i386_reloc_type type;
+  unsigned int r_type = ELF32_R_TYPE (dst->r_info);
+  unsigned int indx;
 
-  type = (enum elf_i386_reloc_type) ELF32_R_TYPE (dst->r_info);
-  if (type == R_386_GNU_VTINHERIT)
-    cache_ptr->howto = &elf32_i386_vtinherit_howto;
-  else if (type == R_386_GNU_VTENTRY)
-    cache_ptr->howto = &elf32_i386_vtentry_howto;
-  else if (type < R_386_max
-	   && (type < FIRST_INVALID_RELOC || type > LAST_INVALID_RELOC))
-    cache_ptr->howto = &elf_howto_table[(int) type];
-  else
+  if ((indx = r_type) >= R_386_standard
+      && ((indx = r_type - R_386_ext_offset) - R_386_standard
+	  >= R_386_ext - R_386_standard)
+      && ((indx = r_type - R_386_vt_offset) - R_386_ext
+	  >= R_386_vt - R_386_ext))
     {
       (*_bfd_error_handler) (_("%s: invalid relocation type %d"),
-			     bfd_get_filename (abfd), (int) type);
-      cache_ptr->howto = &elf_howto_table[(int) R_386_NONE];
+			     bfd_get_filename (abfd), (int) r_type);
+      indx = (unsigned int) R_386_NONE;
     }
+  cache_ptr->howto = &elf_howto_table[indx];
 }
 
 /* Return whether a symbol name implies a local label.  The UnixWare
@@ -600,17 +635,19 @@
 	    h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
 
 	  /* If we are creating a shared library, and this is a reloc
-             against a global symbol, or a non PC relative reloc
-             against a local symbol, then we need to copy the reloc
-             into the shared library.  However, if we are linking with
-             -Bsymbolic, we do not need to copy a reloc against a
-             global symbol which is defined in an object we are
-             including in the link (i.e., DEF_REGULAR is set).  At
-             this point we have not seen all the input files, so it is
-             possible that DEF_REGULAR is not set now but will be set
-             later (it is never cleared).  We account for that
-             possibility below by storing information in the
-             pcrel_relocs_copied field of the hash table entry.  */
+	     against a global symbol, or a non PC relative reloc
+	     against a local symbol, then we need to copy the reloc
+	     into the shared library.  However, if we are linking with
+	     -Bsymbolic, we do not need to copy a reloc against a
+	     global symbol which is defined in an object we are
+	     including in the link (i.e., DEF_REGULAR is set).  At
+	     this point we have not seen all the input files, so it is
+	     possible that DEF_REGULAR is not set now but will be set
+	     later (it is never cleared).  We account for that
+	     possibility below by storing information in the
+	     pcrel_relocs_copied field of the hash table entry.
+	     A similar situation occurs when creating shared libraries
+	     and symbol visibility changes render the symbol local.  */
 	  if (info->shared
 	      && (sec->flags & SEC_ALLOC) != 0
 	      && (ELF32_R_TYPE (rel->r_info) != R_386_PC32
@@ -620,8 +657,8 @@
 			      & ELF_LINK_HASH_DEF_REGULAR) == 0))))
 	    {
 	      /* When creating a shared object, we must copy these
-                 reloc types into the output file.  We create a reloc
-                 section in dynobj and make room for this reloc.  */
+		 reloc types into the output file.  We create a reloc
+		 section in dynobj and make room for this reloc.  */
 	      if (sreloc == NULL)
 		{
 		  const char *name;
@@ -656,15 +693,13 @@
 
 	      sreloc->_raw_size += sizeof (Elf32_External_Rel);
 
-	      /* If we are linking with -Bsymbolic, and this is a
-                 global symbol, we count the number of PC relative
-                 relocations we have entered for this symbol, so that
-                 we can discard them again if the symbol is later
-                 defined by a regular object.  Note that this function
-                 is only called if we are using an elf_i386 linker
-                 hash table, which means that h is really a pointer to
-                 an elf_i386_link_hash_entry.  */
-	      if (h != NULL && info->symbolic
+	      /* If this is a global symbol, we count the number of PC
+		 relative relocations we have entered for this symbol,
+		 so that we can discard them later as necessary.  Note
+		 that this function is only called if we are using an
+		 elf_i386 linker hash table, which means that h is
+		 really a pointer to an elf_i386_link_hash_entry.  */
+	      if (h != NULL
 		  && ELF32_R_TYPE (rel->r_info) == R_386_PC32)
 		{
 		  struct elf_i386_link_hash_entry *eh;
@@ -1064,10 +1099,10 @@
      PC relative relocs against symbols defined in a regular object.
      We allocated space for them in the check_relocs routine, but we
      will not fill them in in the relocate_section routine.  */
-  if (info->shared && info->symbolic)
+  if (info->shared)
     elf_i386_link_hash_traverse (elf_i386_hash_table (info),
 				 elf_i386_discard_copies,
-				 (PTR) NULL);
+				 (PTR) info);
 
   /* The check_relocs and adjust_dynamic_symbol entry points have
      determined the sizes of the various dynamic sections.  Allocate
@@ -1161,8 +1196,12 @@
 	  continue;
 	}
 
-      /* Allocate memory for the section contents.  */
-      s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
+      /* Allocate memory for the section contents.  We use bfd_zalloc
+	 here in case unused entries are not reclaimed before the
+	 section's contents are written out.  This should not happen,
+	 but this way if it does, we get a R_386_NONE reloc instead
+	 of garbage.  */
+      s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
       if (s->contents == NULL && s->_raw_size != 0)
 	return false;
     }
@@ -1202,6 +1241,7 @@
 	{
 	  if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
@@ -1209,26 +1249,32 @@
 }
 
 /* This function is called via elf_i386_link_hash_traverse if we are
-   creating a shared object with -Bsymbolic.  It discards the space
-   allocated to copy PC relative relocs against symbols which are
-   defined in regular objects.  We allocated space for them in the
+   creating a shared object.  In the -Bsymbolic case, it discards the
+   space allocated to copy PC relative relocs against symbols which
+   are defined in regular objects.  For the normal non-symbolic case,
+   we also discard space for relocs that have become local due to
+   symbol visibility changes.  We allocated space for them in the
    check_relocs routine, but we won't fill them in in the
    relocate_section routine.  */
 
-/*ARGSUSED*/
 static boolean
-elf_i386_discard_copies (h, ignore)
+elf_i386_discard_copies (h, inf)
      struct elf_i386_link_hash_entry *h;
-     PTR ignore ATTRIBUTE_UNUSED;
+     PTR inf;
 {
   struct elf_i386_pcrel_relocs_copied *s;
+  struct bfd_link_info *info = (struct bfd_link_info *) inf;
 
-  /* We only discard relocs for symbols defined in a regular object.  */
-  if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
-    return true;
-
-  for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
-    s->section->_raw_size -= s->count * sizeof (Elf32_External_Rel);
+  /* If a symbol has been forced local or we have found a regular
+     definition for the symbolic link case, then we won't be needing
+     any relocs.  */
+  if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
+      && ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
+	  || info->symbolic))
+    {
+      for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
+	s->section->_raw_size -= s->count * sizeof (Elf32_External_Rel);
+    }
 
   return true;
 }
@@ -1283,20 +1329,21 @@
       asection *sec;
       bfd_vma relocation;
       bfd_reloc_status_type r;
+      unsigned int indx;
 
       r_type = ELF32_R_TYPE (rel->r_info);
-      if (r_type == R_386_GNU_VTINHERIT
-	  || r_type == R_386_GNU_VTENTRY)
+      if (r_type == (int) R_386_GNU_VTINHERIT
+	  || r_type == (int) R_386_GNU_VTENTRY)
 	continue;
-      if (r_type < 0
-	  || r_type >= (int) R_386_max
-	  || (r_type >= (int) FIRST_INVALID_RELOC
-	      && r_type <= (int) LAST_INVALID_RELOC))
+
+      if ((indx = (unsigned) r_type) >= R_386_standard
+	  && ((indx = (unsigned) r_type - R_386_ext_offset) - R_386_standard
+	      >= R_386_ext - R_386_standard))
 	{
 	  bfd_set_error (bfd_error_bad_value);
 	  return false;
 	}
-      howto = elf_howto_table + r_type;
+      howto = elf_howto_table + indx;
 
       r_symndx = ELF32_R_SYM (rel->r_info);
 
diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c
index 6a2d2d9..2857a16 100644
--- a/bfd/elf32-i860.c
+++ b/bfd/elf32-i860.c
@@ -1,5 +1,7 @@
-/* Intel 860 specific support for 32-bit ELF
-   Copyright 1993 Free Software Foundation, Inc.
+/* Intel i860 specific support for 32-bit ELF.
+   Copyright 1993, 2000 Free Software Foundation, Inc.
+
+   Full i860 support contributed by Jason Eckhardt <jle@cygnus.com>.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -21,14 +23,1088 @@
 #include "sysdep.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
+#include "elf/i860.h"
 
-#define bfd_elf32_bfd_reloc_type_lookup	bfd_default_reloc_type_lookup
-#define elf_info_to_howto		_bfd_elf_no_info_to_howto
+/* Prototypes.  */
+static reloc_howto_type *lookup_howto
+  PARAMS ((unsigned int));
 
-#define TARGET_BIG_SYM	 bfd_elf32_i860_vec
-#define TARGET_BIG_NAME  "elf32-i860"
-#define ELF_ARCH	 bfd_arch_i860
-#define ELF_MACHINE_CODE EM_860
-#define ELF_MAXPAGESIZE  1 /* FIXME: This number is wrong,  It should be the page size in bytes.  */
+static reloc_howto_type *elf32_i860_reloc_type_lookup
+  PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
+
+static void elf32_i860_info_to_howto_rela
+  PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+
+static bfd_reloc_status_type elf32_i860_relocate_splitn
+  PARAMS ((bfd *,  Elf_Internal_Rela *, bfd_byte *, bfd_vma));
+
+static bfd_reloc_status_type elf32_i860_relocate_pc16
+  PARAMS ((bfd *,  asection *, Elf_Internal_Rela *, bfd_byte *, bfd_vma));
+
+static bfd_reloc_status_type elf32_i860_relocate_pc26
+  PARAMS ((bfd *,  asection *, Elf_Internal_Rela *, bfd_byte *, bfd_vma));
+
+static bfd_reloc_status_type elf32_i860_relocate_highadj
+  PARAMS ((bfd *,  Elf_Internal_Rela *, bfd_byte *, bfd_vma));
+
+static boolean elf32_i860_relocate_section
+  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+	   Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+
+static bfd_reloc_status_type i860_final_link_relocate
+  PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *,
+	   Elf_Internal_Rela *, bfd_vma));
+
+static boolean elf32_i860_is_local_label_name
+  PARAMS ((bfd *, const char *));
+
+/* This howto table is preliminary.  */
+static reloc_howto_type elf32_i860_howto_table [] =
+{
+  /* This relocation does nothing.  */
+  HOWTO (R_860_NONE,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_NONE",		/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 32-bit absolute relocation.  */
+  HOWTO (R_860_32,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_32",		/* name */
+	 false,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_860_COPY,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_COPY",		/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_860_GLOB_DAT,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_GLOB_DAT",	/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_860_JUMP_SLOT,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_JUMP_SLOT",	/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_860_RELATIVE,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_RELATIVE",	/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 26-bit PC-relative relocation.  */
+  HOWTO (R_860_PC26,	        /* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 26,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_PC26",		/* name */
+	 false,			/* partial_inplace */
+	 0x3ffffff,		/* src_mask */
+	 0x3ffffff,		/* dst_mask */
+	 true),		        /* pcrel_offset */
+
+  HOWTO (R_860_PLT26,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 26,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_PLT26",		/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 true),		        /* pcrel_offset */
+
+  /* A 16-bit PC-relative relocation.  */
+  HOWTO (R_860_PC16,	        /* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_PC16",		/* name */
+	 false,			/* partial_inplace */
+	 0x1f07ff,		/* src_mask */
+	 0x1f07ff,		/* dst_mask */
+	 true),		        /* pcrel_offset */
+
+  HOWTO (R_860_LOW0,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_LOW0",		/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_SPLIT0,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_SPLIT0",	/* name */
+	 false,			/* partial_inplace */
+	 0x1f07ff,		/* src_mask */
+	 0x1f07ff,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_LOW1,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_LOW1",		/* name */
+	 false,			/* partial_inplace */
+	 0xfffe,		/* src_mask */
+	 0xfffe,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_SPLIT1,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_SPLIT1",	/* name */
+	 false,			/* partial_inplace */
+	 0x1f07fe,		/* src_mask */
+	 0x1f07fe,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_LOW2,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_LOW2",		/* name */
+	 false,			/* partial_inplace */
+	 0xfffc,		/* src_mask */
+	 0xfffc,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_SPLIT2,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_SPLIT2",	/* name */
+	 false,			/* partial_inplace */
+	 0x1f07fc,		/* src_mask */
+	 0x1f07fc,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_LOW3,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_LOW3",		/* name */
+	 false,			/* partial_inplace */
+	 0xfff8,		/* src_mask */
+	 0xfff8,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_LOGOT0,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_LOGOT0",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 true),		        /* pcrel_offset */
+
+  HOWTO (R_860_SPGOT0,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_SPGOT0",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 true),		        /* pcrel_offset */
+
+  HOWTO (R_860_LOGOT1,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_LOGOT1",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 true),		        /* pcrel_offset */
+
+  HOWTO (R_860_SPGOT1,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_SPGOT1",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 true),		        /* pcrel_offset */
+
+  HOWTO (R_860_LOGOTOFF0,        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_LOGOTOFF0",	/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_SPGOTOFF0,        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_SPGOTOFF0",	/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_LOGOTOFF1,        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_LOGOTOFF1",	/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_SPGOTOFF1,       /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_SPGOTOFF1",	/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_LOGOTOFF2,        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_LOGOTOFF2",	/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_LOGOTOFF3,        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_LOGOTOFF3",	/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_LOPC,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_LOPC",		/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 true),		        /* pcrel_offset */
+
+  HOWTO (R_860_HIGHADJ,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_HIGHADJ",	/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_HAGOT,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_HAGOT",		/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 true),		        /* pcrel_offset */
+
+  HOWTO (R_860_HAGOTOFF,        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_HAGOTOFF",	/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_HAPC,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_HAPC",		/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 true),		        /* pcrel_offset */
+
+  HOWTO (R_860_HIGH,	        /* type */
+	 16,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_HIGH",		/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+
+  HOWTO (R_860_HIGOT,	        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_HIGOT",		/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 true),		        /* pcrel_offset */
+
+  HOWTO (R_860_HIGOTOFF,        /* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont, /* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_860_HIGOTOFF",	/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),	        /* pcrel_offset */
+};
+
+
+static unsigned char elf_code_to_howto_index[R_860_max + 1];
+
+static reloc_howto_type *
+lookup_howto (rtype)
+     unsigned int rtype;
+{
+  static int initialized = 0;
+  int i;
+  int howto_tbl_size = (int) (sizeof (elf32_i860_howto_table)
+			/ sizeof (elf32_i860_howto_table[0]));
+
+  if (! initialized)
+    {
+      initialized = 1;
+      memset (elf_code_to_howto_index, 0xff,
+	      sizeof (elf_code_to_howto_index));
+      for (i = 0; i < howto_tbl_size; i++)
+        elf_code_to_howto_index[elf32_i860_howto_table[i].type] = i;
+    }
+
+  BFD_ASSERT (rtype <= R_860_max);
+  i = elf_code_to_howto_index[rtype];
+  if (i >= howto_tbl_size)
+    return 0;
+  return elf32_i860_howto_table + i;
+}
+
+/* Given a BFD reloc, return the matching HOWTO structure.  */
+static reloc_howto_type *
+elf32_i860_reloc_type_lookup (abfd, code)
+     bfd * abfd ATTRIBUTE_UNUSED;
+     bfd_reloc_code_real_type code;
+{
+  unsigned int rtype;
+
+  switch (code)
+    {
+    case BFD_RELOC_NONE:
+      rtype = R_860_NONE;
+      break;
+    case BFD_RELOC_32:
+      rtype = R_860_32;
+      break;
+    case BFD_RELOC_860_COPY:
+      rtype = R_860_COPY;
+      break;
+    case BFD_RELOC_860_GLOB_DAT:
+      rtype = R_860_GLOB_DAT;
+      break;
+    case BFD_RELOC_860_JUMP_SLOT:
+      rtype = R_860_JUMP_SLOT;
+      break;
+    case BFD_RELOC_860_RELATIVE:
+      rtype = R_860_RELATIVE;
+      break;
+    case BFD_RELOC_860_PC26:
+      rtype = R_860_PC26;
+      break;
+    case BFD_RELOC_860_PLT26:
+      rtype = R_860_PLT26;
+      break;
+    case BFD_RELOC_860_PC16:
+      rtype = R_860_PC16;
+      break;
+    case BFD_RELOC_860_LOW0:
+      rtype = R_860_LOW0;
+      break;
+    case BFD_RELOC_860_SPLIT0:
+      rtype = R_860_SPLIT0;
+      break;
+    case BFD_RELOC_860_LOW1:
+      rtype = R_860_LOW1;
+      break;
+    case BFD_RELOC_860_SPLIT1:
+      rtype = R_860_SPLIT1;
+      break;
+    case BFD_RELOC_860_LOW2:
+      rtype = R_860_LOW2;
+      break;
+    case BFD_RELOC_860_SPLIT2:
+      rtype = R_860_SPLIT2;
+      break;
+    case BFD_RELOC_860_LOW3:
+      rtype = R_860_LOW3;
+      break;
+    case BFD_RELOC_860_LOGOT0:
+      rtype = R_860_LOGOT0;
+      break;
+    case BFD_RELOC_860_SPGOT0:
+      rtype = R_860_SPGOT0;
+      break;
+    case BFD_RELOC_860_LOGOT1:
+      rtype = R_860_LOGOT1;
+      break;
+    case BFD_RELOC_860_SPGOT1:
+      rtype = R_860_SPGOT1;
+      break;
+    case BFD_RELOC_860_LOGOTOFF0:
+      rtype = R_860_LOGOTOFF0;
+      break;
+    case BFD_RELOC_860_SPGOTOFF0:
+      rtype = R_860_SPGOTOFF0;
+      break;
+    case BFD_RELOC_860_LOGOTOFF1:
+      rtype = R_860_LOGOTOFF1;
+      break;
+    case BFD_RELOC_860_SPGOTOFF1:
+      rtype = R_860_SPGOTOFF1;
+      break;
+    case BFD_RELOC_860_LOGOTOFF2:
+      rtype = R_860_LOGOTOFF2;
+      break;
+    case BFD_RELOC_860_LOGOTOFF3:
+      rtype = R_860_LOGOTOFF3;
+      break;
+    case BFD_RELOC_860_LOPC:
+      rtype = R_860_LOPC;
+      break;
+    case BFD_RELOC_860_HIGHADJ:
+      rtype = R_860_HIGHADJ;
+      break;
+    case BFD_RELOC_860_HAGOT:
+      rtype = R_860_HAGOT;
+      break;
+    case BFD_RELOC_860_HAGOTOFF:
+      rtype = R_860_HAGOTOFF;
+      break;
+    case BFD_RELOC_860_HAPC:
+      rtype = R_860_HAPC;
+      break;
+    case BFD_RELOC_860_HIGH:
+      rtype = R_860_HIGH;
+      break;
+    case BFD_RELOC_860_HIGOT:
+      rtype = R_860_HIGOT;
+      break;
+    case BFD_RELOC_860_HIGOTOFF:
+      rtype = R_860_HIGOTOFF;
+      break;
+    default:
+      rtype = 0;
+      break;
+    }
+  return lookup_howto (rtype);
+}
+
+/* Given a ELF reloc, return the matching HOWTO structure.  */
+static void
+elf32_i860_info_to_howto_rela (abfd, bfd_reloc, elf_reloc)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *bfd_reloc;
+     Elf64_Internal_Rela *elf_reloc;
+{
+  bfd_reloc->howto = lookup_howto (ELF32_R_TYPE (elf_reloc->r_info));
+}
+
+
+/* Specialized relocation handler for R_860_SPLITn.  These relocations
+   involves a 16-bit field that is split into two contiguous parts.  */
+static bfd_reloc_status_type
+elf32_i860_relocate_splitn (input_bfd, rello, contents, value)
+     bfd *input_bfd;
+     Elf_Internal_Rela *rello;
+     bfd_byte *contents;
+     bfd_vma value;
+{
+  bfd_vma insn;
+  reloc_howto_type *howto;
+  howto  = lookup_howto (ELF32_R_TYPE (rello->r_info));
+  insn = bfd_get_32 (input_bfd, contents + rello->r_offset);
+
+  /* Relocate.  */
+  value += rello->r_addend;
+
+  /* Separate the fields and insert.  */
+  value = (((value & 0xf8) << 5) | (value & 0x7ff)) & howto->dst_mask;
+  insn = (insn & ~howto->dst_mask) | value;
+
+  bfd_put_32 (input_bfd, insn, contents + rello->r_offset);
+  return bfd_reloc_ok;
+}
+
+/* Specialized relocation handler for R_860_PC16.  This relocation
+   involves a 16-bit, PC-relative field that is split into two contiguous
+   parts.  */
+static bfd_reloc_status_type
+elf32_i860_relocate_pc16 (input_bfd, input_section, rello, contents, value)
+     bfd *input_bfd;
+     asection *input_section;
+     Elf_Internal_Rela *rello;
+     bfd_byte *contents;
+     bfd_vma value;
+{
+  bfd_vma insn;
+  reloc_howto_type *howto;
+  howto  = lookup_howto (ELF32_R_TYPE (rello->r_info));
+  insn = bfd_get_32 (input_bfd, contents + rello->r_offset);
+
+  /* Adjust for PC-relative relocation.  */
+  value -= (input_section->output_section->vma
+	    + input_section->output_offset);
+  value -= rello->r_offset;
+
+  /* Relocate.  */
+  value += rello->r_addend;
+
+  /* Separate the fields and insert.  */
+  value = (((value & 0xf8) << 5) | (value & 0x7ff)) & howto->dst_mask;
+  insn = (insn & ~howto->dst_mask) | value;
+
+  bfd_put_32 (input_bfd, insn, contents + rello->r_offset);
+  return bfd_reloc_ok;
+
+}
+
+/* Specialized relocation handler for R_860_PC26.  This relocation
+   involves a 26-bit, PC-relative field which must be adjusted by 4.  */
+static bfd_reloc_status_type
+elf32_i860_relocate_pc26 (input_bfd, input_section, rello, contents, value)
+     bfd *input_bfd;
+     asection *input_section;
+     Elf_Internal_Rela *rello;
+     bfd_byte *contents;
+     bfd_vma value;
+{
+  bfd_vma insn;
+  reloc_howto_type *howto;
+  howto  = lookup_howto (ELF32_R_TYPE (rello->r_info));
+  insn = bfd_get_32 (input_bfd, contents + rello->r_offset);
+
+  /* Adjust for PC-relative relocation.  */
+  value -= (input_section->output_section->vma
+	    + input_section->output_offset);
+  value -= rello->r_offset;
+
+  /* Relocate.  */
+  value += rello->r_addend;
+
+  /* Adjust value by 4 and insert the field.  */
+  value = ((value - 4) >> howto->rightshift) & howto->dst_mask;
+  insn = (insn & ~howto->dst_mask) | value;
+
+  bfd_put_32 (input_bfd, insn, contents + rello->r_offset);
+  return bfd_reloc_ok;
+
+}
+
+/* Specialized relocation handler for R_860_HIGHADJ.  */
+static bfd_reloc_status_type
+elf32_i860_relocate_highadj (input_bfd, rel, contents, value)
+     bfd *input_bfd;
+     Elf_Internal_Rela *rel;
+     bfd_byte *contents;
+     bfd_vma value;
+{
+  bfd_vma insn;
+
+  insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
+
+  value += ((rel->r_addend & 0x8000) << 1);
+  value += rel->r_addend;
+  value = ((value >> 16) & 0xffff);
+
+  insn = (insn & 0xffff0000) | value;
+
+  bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
+  return bfd_reloc_ok;
+}
+
+/* Perform a single relocation.  By default we use the standard BFD
+   routines. However, we handle some specially.  */
+static bfd_reloc_status_type
+i860_final_link_relocate (howto, input_bfd, input_section, contents, rel, relocation)
+     reloc_howto_type *  howto;
+     bfd *               input_bfd;
+     asection *          input_section;
+     bfd_byte *          contents;
+     Elf_Internal_Rela * rel;
+     bfd_vma             relocation;
+{
+  return _bfd_final_link_relocate (howto, input_bfd, input_section,
+				   contents, rel->r_offset, relocation,
+				   rel->r_addend);
+}
+
+/* Relocate an i860 ELF section.
+
+   This is boiler-plate code copied from fr30.
+   There is some attempt to make this function usable for many architectures,
+   both USE_REL and USE_RELA ['twould be nice if such a critter existed],
+   if only to serve as a learning tool.
+
+   The RELOCATE_SECTION function is called by the new ELF backend linker
+   to handle the relocations for a section.
+
+   The relocs are always passed as Rela structures; if the section
+   actually uses Rel structures, the r_addend field will always be
+   zero.
+
+   This function is responsible for adjusting the section contents as
+   necessary, and (if using Rela relocs and generating a relocateable
+   output file) adjusting the reloc addend as necessary.
+
+   This function does not have to worry about setting the reloc
+   address or the reloc symbol index.
+
+   LOCAL_SYMS is a pointer to the swapped in local symbols.
+
+   LOCAL_SECTIONS is an array giving the section in the input file
+   corresponding to the st_shndx field of each local symbol.
+
+   The global hash table entry for the global symbols can be found
+   via elf_sym_hashes (input_bfd).
+
+   When generating relocateable output, this function must handle
+   STB_LOCAL/STT_SECTION symbols specially.  The output symbol is
+   going to be the section symbol corresponding to the output
+   section, which means that the addend must be adjusted
+   accordingly.  */
+static boolean
+elf32_i860_relocate_section (output_bfd, info, input_bfd, input_section,
+			     contents, relocs, local_syms, local_sections)
+     bfd *                   output_bfd ATTRIBUTE_UNUSED;
+     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;
+  struct elf_link_hash_entry ** sym_hashes;
+  Elf_Internal_Rela *           rel;
+  Elf_Internal_Rela *           relend;
+
+  symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (input_bfd);
+  relend     = relocs + input_section->reloc_count;
+
+  for (rel = relocs; rel < relend; rel ++)
+    {
+      reloc_howto_type *           howto;
+      unsigned long                r_symndx;
+      Elf_Internal_Sym *           sym;
+      asection *                   sec;
+      struct elf_link_hash_entry * h;
+      bfd_vma                      relocation;
+      bfd_reloc_status_type        r;
+      const char *                 name = NULL;
+      int                          r_type;
+
+      r_type = ELF32_R_TYPE (rel->r_info);
+
+#if 0
+      if (   r_type == R_860_GNU_VTINHERIT
+	  || r_type == R_860_GNU_VTENTRY)
+	continue;
+#endif
+
+      r_symndx = ELF32_R_SYM (rel->r_info);
+
+      if (info->relocateable)
+	{
+	  /* This is a relocateable link.  We don't have to change
+             anything, unless the reloc is against a section symbol,
+             in which case we have to adjust according to where the
+             section symbol winds up in the output section.  */
+	  if (r_symndx < symtab_hdr->sh_info)
+	    {
+	      sym = local_syms + r_symndx;
+
+	      if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+		{
+		  sec = local_sections [r_symndx];
+		  rel->r_addend += sec->output_offset + sym->st_value;
+		}
+	    }
+
+	  continue;
+	}
+
+      /* This is a final link.  */
+      howto  = lookup_howto (ELF32_R_TYPE (rel->r_info));
+      h      = NULL;
+      sym    = NULL;
+      sec    = NULL;
+
+      if (r_symndx < symtab_hdr->sh_info)
+	{
+	  sym = local_syms + r_symndx;
+	  sec = local_sections [r_symndx];
+	  relocation = (sec->output_section->vma
+			+ sec->output_offset
+			+ sym->st_value);
+
+	  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
+	{
+	  h = sym_hashes [r_symndx - symtab_hdr->sh_info];
+
+	  while (h->root.type == bfd_link_hash_indirect
+		 || h->root.type == bfd_link_hash_warning)
+	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+	  name = h->root.root.string;
+
+	  if (h->root.type == bfd_link_hash_defined
+	      || h->root.type == bfd_link_hash_defweak)
+	    {
+	      sec = h->root.u.def.section;
+	      relocation = (h->root.u.def.value
+			    + sec->output_section->vma
+			    + sec->output_offset);
+	    }
+	  else if (h->root.type == bfd_link_hash_undefweak)
+	    {
+	      relocation = 0;
+	    }
+	  else
+	    {
+	      if (! ((*info->callbacks->undefined_symbol)
+		     (info, h->root.root.string, input_bfd,
+		      input_section, rel->r_offset, true)))
+		return false;
+	      relocation = 0;
+	    }
+	}
+
+      switch (r_type)
+	{
+	default:
+	  r = i860_final_link_relocate (howto, input_bfd, input_section,
+					contents, rel, relocation);
+	  break;
+
+	case R_860_HIGHADJ:
+	  r = elf32_i860_relocate_highadj (input_bfd, rel, contents,
+					   relocation);
+	  break;
+
+	case R_860_PC16:
+	  r = elf32_i860_relocate_pc16 (input_bfd, input_section, rel,
+					contents, relocation);
+	  break;
+
+	case R_860_PC26:
+	  r = elf32_i860_relocate_pc26 (input_bfd, input_section, rel,
+					contents, relocation);
+	  break;
+
+	case R_860_SPLIT0:
+	case R_860_SPLIT1:
+	case R_860_SPLIT2:
+	  r = elf32_i860_relocate_splitn (input_bfd, rel, contents,
+					  relocation);
+	  break;
+
+	/* We do not yet handle GOT/PLT/Dynamic relocations.  */
+	case R_860_COPY:
+	case R_860_GLOB_DAT:
+	case R_860_JUMP_SLOT:
+	case R_860_RELATIVE:
+	case R_860_PLT26:
+	case R_860_LOGOT0:
+	case R_860_SPGOT0:
+	case R_860_LOGOT1:
+	case R_860_SPGOT1:
+	case R_860_LOGOTOFF0:
+	case R_860_SPGOTOFF0:
+	case R_860_LOGOTOFF1:
+	case R_860_SPGOTOFF1:
+	case R_860_LOGOTOFF2:
+	case R_860_LOGOTOFF3:
+	case R_860_LOPC:
+	case R_860_HAGOT:
+	case R_860_HAGOTOFF:
+	case R_860_HAPC:
+	case R_860_HIGOT:
+	case R_860_HIGOTOFF:
+	  r = bfd_reloc_notsupported;
+	  break;
+	}
+
+      if (r != bfd_reloc_ok)
+	{
+	  const char * msg = (const char *) NULL;
+
+	  switch (r)
+	    {
+	    case bfd_reloc_overflow:
+	      r = info->callbacks->reloc_overflow
+		(info, name, howto->name, (bfd_vma) 0,
+		 input_bfd, input_section, rel->r_offset);
+	      break;
+
+	    case bfd_reloc_undefined:
+	      r = info->callbacks->undefined_symbol
+		(info, name, input_bfd, input_section, rel->r_offset, true);
+	      break;
+
+	    case bfd_reloc_outofrange:
+	      msg = _("internal error: out of range error");
+	      break;
+
+	    case bfd_reloc_notsupported:
+	      msg = _("internal error: unsupported relocation error");
+	      break;
+
+	    case bfd_reloc_dangerous:
+	      msg = _("internal error: dangerous relocation");
+	      break;
+
+	    default:
+	      msg = _("internal error: unknown error");
+	      break;
+	    }
+
+	  if (msg)
+	    r = info->callbacks->warning
+	      (info, msg, name, input_bfd, input_section, rel->r_offset);
+
+	  if (! r)
+	    return false;
+	}
+    }
+
+  return true;
+}
+
+/* Return whether a symbol name implies a local label.  SVR4/860 compilers
+   generate labels of the form ".ep.function_name" to denote the end of a
+   function prolog. These should be local.
+   ??? Do any other SVR4 compilers have this convention? If so, this should
+   be added to the generic routine.  */
+static boolean
+elf32_i860_is_local_label_name (abfd, name)
+     bfd *abfd;
+     const char *name;
+{
+  if (name[0] == '.' && name[1] == 'e' && name[2] == 'p' && name[3] == '.')
+    return true;
+
+  return _bfd_elf_is_local_label_name (abfd, name);
+}
+
+
+#define TARGET_BIG_SYM		bfd_elf32_i860_vec
+#define TARGET_BIG_NAME		"elf32-i860"
+#define TARGET_LITTLE_SYM	bfd_elf32_i860_little_vec
+#define TARGET_LITTLE_NAME	"elf32-i860-little"
+#define ELF_ARCH		bfd_arch_i860
+#define ELF_MACHINE_CODE	EM_860
+#define ELF_MAXPAGESIZE		4096
+
+#define elf_info_to_howto_rel                   NULL
+#define elf_info_to_howto			elf32_i860_info_to_howto_rela
+#define elf_backend_relocate_section		elf32_i860_relocate_section
+#define bfd_elf32_bfd_reloc_type_lookup		elf32_i860_reloc_type_lookup
+#define bfd_elf32_bfd_is_local_label_name	elf32_i860_is_local_label_name
 
 #include "elf32-target.h"
diff --git a/bfd/elf32-i960.c b/bfd/elf32-i960.c
index 839fc3d..0d03d57 100644
--- a/bfd/elf32-i960.c
+++ b/bfd/elf32-i960.c
@@ -102,7 +102,6 @@
    function.  It just short circuits the reloc if producing
    relocateable output against an external symbol.  */
 
-/*ARGSUSED*/
 bfd_reloc_status_type
 elf32_i960_relocate (abfd,
 		       reloc_entry,
@@ -129,7 +128,7 @@
     {
       reloc_entry->addend -= symbol->value;
     }
-  /* This is more dubious. */
+  /* This is more dubious.  */
   else if (output_bfd != (bfd *) NULL
 	   && (symbol->flags & BSF_SECTION_SYM) != 0)
     {
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index efb6555..5b2d63f 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -566,8 +566,8 @@
 				input_section, output_bfd, error_message);
 }
 
-/* Do generic partial_inplace relocation.  
-   This is a local replacement for bfd_elf_generic_reloc. */
+/* Do generic partial_inplace relocation.
+   This is a local replacement for bfd_elf_generic_reloc.  */
 
 bfd_reloc_status_type
 m32r_elf_generic_reloc (input_bfd, reloc_entry, symbol, data,
@@ -578,7 +578,7 @@
      PTR data;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   bfd_reloc_status_type ret;
   bfd_vma relocation;
@@ -624,7 +624,7 @@
     }
 
   relocation += reloc_entry->addend;
-  inplace_address = data + reloc_entry->address;
+  inplace_address = (bfd_byte *) data + reloc_entry->address;
 
 #define DOIT(x) 					\
   x = ( (x & ~reloc_entry->howto->dst_mask) | 		\
@@ -1313,7 +1313,7 @@
    When the chip supports parallel 16 bit insns, things may change.
 */
 
-static boolean 
+static boolean
 m32r_elf_relax_section (abfd, sec, link_info, again)
      bfd *abfd;
      asection *sec;
@@ -1925,7 +1925,7 @@
   elf_elfheader (abfd)->e_flags |= val;
 }
 
-/* Function to keep M32R specific file flags. */
+/* Function to keep M32R specific file flags.  */
 static boolean
 m32r_elf_set_private_flags (abfd, flags)
      bfd *    abfd;
@@ -1986,7 +1986,7 @@
 	 to the default values.  */
       if (bfd_get_arch_info (ibfd)->the_default)
 	return true;
-      
+
       elf_flags_init (obfd) = true;
       elf_elfheader (obfd)->e_flags = in_flags;
 
@@ -2025,22 +2025,22 @@
      PTR     ptr;
 {
   FILE * file = (FILE *) ptr;
-  
+
   BFD_ASSERT (abfd != NULL && ptr != NULL)
-  
+
   _bfd_elf_print_private_bfd_data (abfd, ptr);
-  
+
   fprintf (file, _("private flags = %lx"), elf_elfheader (abfd)->e_flags);
-  
+
   switch (elf_elfheader (abfd)->e_flags & EF_M32R_ARCH)
     {
     default:
     case E_M32R_ARCH:  fprintf (file, _(": m32r instructions"));  break;
     case E_M32RX_ARCH: fprintf (file, _(": m32rx instructions")); break;
     }
-  
+
   fputc ('\n', file);
-  
+
   return true;
 }
 
@@ -2059,14 +2059,14 @@
       case R_M32R_GNU_VTINHERIT:
       case R_M32R_GNU_VTENTRY:
         break;
- 
+
       default:
         switch (h->root.type)
           {
           case bfd_link_hash_defined:
           case bfd_link_hash_defweak:
             return h->root.u.def.section;
- 
+
           case bfd_link_hash_common:
             return h->root.u.c.p->section;
 
@@ -2099,11 +2099,10 @@
   return true;
 }
 
-
 /* Look through the relocs for a section during the first phase.
    Since we don't do .gots or .plts, we just need to consider the
    virtual table relocs for gc.  */
- 
+
 static boolean
 m32r_elf_check_relocs (abfd, info, sec, relocs)
      bfd *abfd;
@@ -2115,28 +2114,28 @@
   struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
   const Elf_Internal_Rela *rel;
   const Elf_Internal_Rela *rel_end;
- 
+
   if (info->relocateable)
     return true;
- 
+
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
-  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf32_External_Sym);
+  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym);
   if (!elf_bad_symtab (abfd))
     sym_hashes_end -= symtab_hdr->sh_info;
- 
+
   rel_end = relocs + sec->reloc_count;
   for (rel = relocs; rel < rel_end; rel++)
     {
       struct elf_link_hash_entry *h;
       unsigned long r_symndx;
- 
+
       r_symndx = ELF32_R_SYM (rel->r_info);
       if (r_symndx < symtab_hdr->sh_info)
         h = NULL;
       else
         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- 
+
       switch (ELF32_R_TYPE (rel->r_info))
         {
         /* This relocation describes the C++ object vtable hierarchy.
@@ -2145,7 +2144,7 @@
           if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
             return false;
           break;
- 
+
         /* This relocation describes which C++ vtable entries are actually
            used.  Record for later use during GC.  */
         case R_M32R_GNU_VTENTRY:
@@ -2154,11 +2153,10 @@
           break;
         }
     }
- 
+
   return true;
 }
 
-
 
 
 #define ELF_ARCH		bfd_arch_m32r
@@ -2192,5 +2190,5 @@
 #define bfd_elf32_bfd_merge_private_bfd_data 	m32r_elf_merge_private_bfd_data
 #define bfd_elf32_bfd_set_private_flags		m32r_elf_set_private_flags
 #define bfd_elf32_bfd_print_private_bfd_data	m32r_elf_print_private_bfd_data
-					
+
 #include "elf32-target.h"
diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c
new file mode 100644
index 0000000..177db3e
--- /dev/null
+++ b/bfd/elf32-m68hc11.c
@@ -0,0 +1,280 @@
+/* Motorola 68HC11-specific support for 32-bit ELF
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Contributed by Stephane Carrez (stcarrez@worldnet.fr)
+   (Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com))
+
+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 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 "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf/m68hc11.h"
+
+static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
+PARAMS ((bfd * abfd, bfd_reloc_code_real_type code));
+static void m68hc11_info_to_howto_rel
+PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+
+/* Use REL instead of RELA to save space */
+#define USE_REL
+
+/* The Motorola 68HC11 microcontroler only addresses 64Kb.
+   We must handle 8 and 16-bit relocations.  The 32-bit relocation
+   is defined but not used except by gas when -gstabs is used (which
+   is wrong).
+   The 3-bit and 16-bit PC rel relocation is only used by 68HC12.  */
+static reloc_howto_type elf_m68hc11_howto_table[] = {
+  /* This reloc does nothing.  */
+  HOWTO (R_M68HC11_NONE,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_NONE",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 8 bit absolute relocation */
+  HOWTO (R_M68HC11_8,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_8",		/* name */
+	 false,			/* partial_inplace */
+	 0x00ff,		/* src_mask */
+	 0x00ff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 8 bit absolute relocation (upper address) */
+  HOWTO (R_M68HC11_HI8,		/* type */
+	 8,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_HI8",	/* name */
+	 false,			/* partial_inplace */
+	 0x00ff,		/* src_mask */
+	 0x00ff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 8 bit absolute relocation (upper address) */
+  HOWTO (R_M68HC11_LO8,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_LO8",	/* name */
+	 false,			/* partial_inplace */
+	 0x00ff,		/* src_mask */
+	 0x00ff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 8 bit PC-rel relocation */
+  HOWTO (R_M68HC11_PCREL_8,	/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_PCREL_8",	/* name */
+	 false,			/* partial_inplace */
+	 0x0,			/* src_mask */
+	 0x00ff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 16 bit absolute relocation */
+  HOWTO (R_M68HC11_16,		/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont /*bitfield */ ,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_16",	/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 32 bit absolute relocation.  This one is never used for the
+     code relocation.  It's used by gas for -gstabs generation.  */
+  HOWTO (R_M68HC11_32,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_32",	/* name */
+	 false,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 3 bit absolute relocation */
+  HOWTO (R_M68HC11_3B,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 3,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_4B",	/* name */
+	 false,			/* partial_inplace */
+	 0x003,			/* src_mask */
+	 0x003,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 16 bit PC-rel relocation */
+  HOWTO (R_M68HC11_PCREL_16,	/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_PCREL_16",	/* name */
+	 false,			/* partial_inplace */
+	 0x0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* GNU extension to record C++ vtable hierarchy */
+  HOWTO (R_M68HC11_GNU_VTINHERIT,	/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,	/* complain_on_overflow */
+	 NULL,			/* special_function */
+	 "R_M68HC11_GNU_VTINHERIT",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* GNU extension to record C++ vtable member usage */
+  HOWTO (R_M68HC11_GNU_VTENTRY,	/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,	/* complain_on_overflow */
+	 _bfd_elf_rel_vtable_reloc_fn,	/* special_function */
+	 "R_M68HC11_GNU_VTENTRY",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+};
+
+/* Map BFD reloc types to M68HC11 ELF reloc types.  */
+
+struct m68hc11_reloc_map
+{
+  bfd_reloc_code_real_type bfd_reloc_val;
+  unsigned char elf_reloc_val;
+};
+
+static const struct m68hc11_reloc_map m68hc11_reloc_map[] = {
+  {BFD_RELOC_NONE, R_M68HC11_NONE,},
+  {BFD_RELOC_8, R_M68HC11_8},
+  {BFD_RELOC_M68HC11_HI8, R_M68HC11_HI8},
+  {BFD_RELOC_M68HC11_LO8, R_M68HC11_LO8},
+  {BFD_RELOC_8_PCREL, R_M68HC11_PCREL_8},
+  {BFD_RELOC_16_PCREL, R_M68HC11_PCREL_16},
+  {BFD_RELOC_16, R_M68HC11_16},
+  {BFD_RELOC_32, R_M68HC11_32},
+  {BFD_RELOC_M68HC11_3B, R_M68HC11_3B},
+
+  /* The following relocs are defined but they probably don't work yet.  */
+  {BFD_RELOC_VTABLE_INHERIT, R_M68HC11_GNU_VTINHERIT},
+  {BFD_RELOC_VTABLE_ENTRY, R_M68HC11_GNU_VTENTRY},
+};
+
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_type_lookup (abfd, code)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     bfd_reloc_code_real_type code;
+{
+  unsigned int i;
+
+  for (i = 0;
+       i < sizeof (m68hc11_reloc_map) / sizeof (struct m68hc11_reloc_map);
+       i++)
+    {
+      if (m68hc11_reloc_map[i].bfd_reloc_val == code)
+	return &elf_m68hc11_howto_table[m68hc11_reloc_map[i].elf_reloc_val];
+    }
+
+  return NULL;
+}
+
+/* Set the howto pointer for an M68HC11 ELF reloc.  */
+
+static void
+m68hc11_info_to_howto_rel (abfd, cache_ptr, dst)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *cache_ptr;
+     Elf32_Internal_Rel *dst;
+{
+  unsigned int r_type;
+
+  r_type = ELF32_R_TYPE (dst->r_info);
+  BFD_ASSERT (r_type < (unsigned int) R_M68HC11_max);
+  cache_ptr->howto = &elf_m68hc11_howto_table[r_type];
+}
+
+/* Below is the only difference between elf32-m68hc12.c and elf32-m68hc11.c.
+   The Motorola spec says to use a different Elf machine code.  */
+#define ELF_ARCH		bfd_arch_m68hc11
+#define ELF_MACHINE_CODE	EM_68HC11
+#define ELF_MAXPAGESIZE		0x1000
+
+#define TARGET_BIG_SYM          bfd_elf32_m68hc11_vec
+#define TARGET_BIG_NAME		"elf32-m68hc11"
+
+#define elf_info_to_howto	0
+#define elf_info_to_howto_rel	m68hc11_info_to_howto_rel
+#define elf_backend_object_p	0
+#define elf_backend_final_write_processing	0
+
+#include "elf32-target.h"
diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c
new file mode 100644
index 0000000..d4baece
--- /dev/null
+++ b/bfd/elf32-m68hc12.c
@@ -0,0 +1,280 @@
+/* Motorola 68HC12-specific support for 32-bit ELF
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Contributed by Stephane Carrez (stcarrez@worldnet.fr)
+   (Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com))
+
+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 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 "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf/m68hc11.h"
+
+static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
+PARAMS ((bfd * abfd, bfd_reloc_code_real_type code));
+static void m68hc11_info_to_howto_rel
+PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+
+/* Use REL instead of RELA to save space */
+#define USE_REL
+
+/* The Motorola 68HC11 microcontroler only addresses 64Kb.
+   We must handle 8 and 16-bit relocations.  The 32-bit relocation
+   is defined but not used except by gas when -gstabs is used (which
+   is wrong).
+   The 3-bit and 16-bit PC rel relocation is only used by 68HC12.  */
+static reloc_howto_type elf_m68hc11_howto_table[] = {
+  /* This reloc does nothing.  */
+  HOWTO (R_M68HC11_NONE,	/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_NONE",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 8 bit absolute relocation */
+  HOWTO (R_M68HC11_8,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_8",		/* name */
+	 false,			/* partial_inplace */
+	 0x00ff,		/* src_mask */
+	 0x00ff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 8 bit absolute relocation (upper address) */
+  HOWTO (R_M68HC11_HI8,		/* type */
+	 8,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_HI8",	/* name */
+	 false,			/* partial_inplace */
+	 0x00ff,		/* src_mask */
+	 0x00ff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 8 bit absolute relocation (upper address) */
+  HOWTO (R_M68HC11_LO8,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_LO8",	/* name */
+	 false,			/* partial_inplace */
+	 0x00ff,		/* src_mask */
+	 0x00ff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 8 bit PC-rel relocation */
+  HOWTO (R_M68HC11_PCREL_8,	/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_PCREL_8",	/* name */
+	 false,			/* partial_inplace */
+	 0x0,			/* src_mask */
+	 0x00ff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 16 bit absolute relocation */
+  HOWTO (R_M68HC11_16,		/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont /*bitfield */ ,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_16",	/* name */
+	 false,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 32 bit absolute relocation.  This one is never used for the
+     code relocation.  It's used by gas for -gstabs generation.  */
+  HOWTO (R_M68HC11_32,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_32",	/* name */
+	 false,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 3 bit absolute relocation */
+  HOWTO (R_M68HC11_3B,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 3,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_4B",	/* name */
+	 false,			/* partial_inplace */
+	 0x003,			/* src_mask */
+	 0x003,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* A 16 bit PC-rel relocation */
+  HOWTO (R_M68HC11_PCREL_16,	/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_M68HC11_PCREL_16",	/* name */
+	 false,			/* partial_inplace */
+	 0x0,			/* src_mask */
+	 0xffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* GNU extension to record C++ vtable hierarchy */
+  HOWTO (R_M68HC11_GNU_VTINHERIT,	/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,	/* complain_on_overflow */
+	 NULL,			/* special_function */
+	 "R_M68HC11_GNU_VTINHERIT",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* GNU extension to record C++ vtable member usage */
+  HOWTO (R_M68HC11_GNU_VTENTRY,	/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,	/* complain_on_overflow */
+	 _bfd_elf_rel_vtable_reloc_fn,	/* special_function */
+	 "R_M68HC11_GNU_VTENTRY",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+};
+
+/* Map BFD reloc types to M68HC11 ELF reloc types.  */
+
+struct m68hc11_reloc_map
+{
+  bfd_reloc_code_real_type bfd_reloc_val;
+  unsigned char elf_reloc_val;
+};
+
+static const struct m68hc11_reloc_map m68hc11_reloc_map[] = {
+  {BFD_RELOC_NONE, R_M68HC11_NONE,},
+  {BFD_RELOC_8, R_M68HC11_8},
+  {BFD_RELOC_M68HC11_HI8, R_M68HC11_HI8},
+  {BFD_RELOC_M68HC11_LO8, R_M68HC11_LO8},
+  {BFD_RELOC_8_PCREL, R_M68HC11_PCREL_8},
+  {BFD_RELOC_16_PCREL, R_M68HC11_PCREL_16},
+  {BFD_RELOC_16, R_M68HC11_16},
+  {BFD_RELOC_32, R_M68HC11_32},
+  {BFD_RELOC_M68HC11_3B, R_M68HC11_3B},
+
+  /* The following relocs are defined but they probably don't work yet.  */
+  {BFD_RELOC_VTABLE_INHERIT, R_M68HC11_GNU_VTINHERIT},
+  {BFD_RELOC_VTABLE_ENTRY, R_M68HC11_GNU_VTENTRY},
+};
+
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_type_lookup (abfd, code)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     bfd_reloc_code_real_type code;
+{
+  unsigned int i;
+
+  for (i = 0;
+       i < sizeof (m68hc11_reloc_map) / sizeof (struct m68hc11_reloc_map);
+       i++)
+    {
+      if (m68hc11_reloc_map[i].bfd_reloc_val == code)
+	return &elf_m68hc11_howto_table[m68hc11_reloc_map[i].elf_reloc_val];
+    }
+
+  return NULL;
+}
+
+/* Set the howto pointer for an M68HC11 ELF reloc.  */
+
+static void
+m68hc11_info_to_howto_rel (abfd, cache_ptr, dst)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *cache_ptr;
+     Elf32_Internal_Rel *dst;
+{
+  unsigned int r_type;
+
+  r_type = ELF32_R_TYPE (dst->r_info);
+  BFD_ASSERT (r_type < (unsigned int) R_M68HC11_max);
+  cache_ptr->howto = &elf_m68hc11_howto_table[r_type];
+}
+
+/* Below is the only difference between elf32-m68hc12.c and elf32-m68hc11.c.
+   The Motorola spec says to use a different Elf machine code.  */
+#define ELF_ARCH		bfd_arch_m68hc12
+#define ELF_MACHINE_CODE	EM_68HC12
+#define ELF_MAXPAGESIZE		0x1000
+
+#define TARGET_BIG_SYM          bfd_elf32_m68hc12_vec
+#define TARGET_BIG_NAME		"elf32-m68hc12"
+
+#define elf_info_to_howto	0
+#define elf_info_to_howto_rel	m68hc11_info_to_howto_rel
+#define elf_backend_object_p	0
+#define elf_backend_final_write_processing	0
+
+#include "elf32-target.h"
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index b015234..c37bb5a9 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -224,11 +224,11 @@
 /* Procedure linkage table entries for the cpu32 */
 static const bfd_byte elf_cpu32_plt0_entry[PLT_CPU32_ENTRY_SIZE] =
 {
-  0x22, 0x7b, 0x01, 0x70, /* moveal %pc@(0xc), %a1 */
+  0x2f, 0x3b, 0x01, 0x70, /* move.l (%pc,addr),-(%sp) */
   0, 0, 0, 0,             /* replaced with offset to .got + 4.  */
+  0x22, 0x7b, 0x01, 0x70, /* moveal %pc@(0xc), %a1 */
+  0, 0, 0, 0,             /* replace with offset to .got +8.  */
   0x4e, 0xd1,             /* jmp %a1@ */
-  0, 0, 0, 0,             /* replace with offset to .got +8. */
-  0, 0, 0, 0,             /* pad out to 24 bytes.  */
   0, 0, 0, 0,             /* pad out to 24 bytes.  */
   0, 0
 };
@@ -376,12 +376,12 @@
   if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
       || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
     return true;
- 
+
   in_flags = elf_elfheader (ibfd)->e_flags;
- 
+
   elf_elfheader (obfd)->e_flags = in_flags;
   elf_flags_init (obfd) = true;
- 
+
   return true;
 }
 
@@ -932,7 +932,6 @@
   return true;
 }
 
-
 /* Adjust a symbol defined by a dynamic object and referenced by a
    regular object.  The current definition is in some section of the
    dynamic object, but we're not including those sections.  We have to
@@ -1267,7 +1266,12 @@
 	}
 
       /* Allocate memory for the section contents.  */
-      s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
+      /* FIXME: This should be a call to bfd_alloc not bfd_zalloc.
+	 Unused entries should be reclaimed before the section's contents
+	 are written out, but at the moment this does not happen.  Thus in
+	 order to prevent writing out garbage, we initialise the section's
+	 contents to zero.  */
+      s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
       if (s->contents == NULL && s->_raw_size != 0)
 	return false;
     }
@@ -1307,6 +1311,7 @@
 	{
 	  if (!bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
@@ -1319,7 +1324,6 @@
    in regular objects.  We allocated space for them in the check_relocs
    routine, but we won't fill them in in the relocate_section routine.  */
 
-/*ARGSUSED*/
 static boolean
 elf_m68k_discard_copies (h, ignore)
      struct elf_m68k_link_hash_entry *h;
@@ -2133,7 +2137,7 @@
 		           + sgot->output_offset + 8
 		           - (splt->output_section->vma + 10)),
 		          splt->contents + 12);
-              elf_section_data (splt->output_section)->this_hdr.sh_entsize 
+              elf_section_data (splt->output_section)->this_hdr.sh_entsize
                = PLT_ENTRY_SIZE;
             }
           else /* cpu32 */
@@ -2148,8 +2152,8 @@
 		          (sgot->output_section->vma
 		           + sgot->output_offset + 8
 		           - (splt->output_section->vma + 10)),
-		          splt->contents + 10);
-              elf_section_data (splt->output_section)->this_hdr.sh_entsize 
+		          splt->contents + 12);
+              elf_section_data (splt->output_section)->this_hdr.sh_entsize
                = PLT_CPU32_ENTRY_SIZE;
             }
 	}
@@ -2173,6 +2177,144 @@
   return true;
 }
 
+/* Given a .data section and a .emreloc in-memory section, store
+   relocation information into the .emreloc section which can be
+   used at runtime to relocate the section.  This is called by the
+   linker when the --embedded-relocs switch is used.  This is called
+   after the add_symbols entry point has been called for all the
+   objects, and before the final_link entry point is called.  */
+
+boolean
+bfd_m68k_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
+     bfd *abfd;
+     struct bfd_link_info *info;
+     asection *datasec;
+     asection *relsec;
+     char **errmsg;
+{
+  Elf_Internal_Shdr *symtab_hdr;
+  Elf32_External_Sym *extsyms;
+  Elf32_External_Sym *free_extsyms = NULL;
+  Elf_Internal_Rela *internal_relocs;
+  Elf_Internal_Rela *free_relocs = NULL;
+  Elf_Internal_Rela *irel, *irelend;
+  bfd_byte *p;
+
+  BFD_ASSERT (! info->relocateable);
+
+  *errmsg = NULL;
+
+  if (datasec->reloc_count == 0)
+    return true;
+
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+  /* Read this BFD's symbols if we haven't done so already, or get the cached
+     copy if it exists.  */
+  if (symtab_hdr->contents != NULL)
+    extsyms = (Elf32_External_Sym *) symtab_hdr->contents;
+  else
+    {
+      /* Go get them off disk.  */
+      if (info->keep_memory)
+	extsyms = ((Elf32_External_Sym *)
+		   bfd_alloc (abfd, symtab_hdr->sh_size));
+      else
+	extsyms = ((Elf32_External_Sym *)
+		   bfd_malloc (symtab_hdr->sh_size));
+      if (extsyms == NULL)
+	goto error_return;
+      if (! info->keep_memory)
+	free_extsyms = extsyms;
+      if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
+	  || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd)
+	      != symtab_hdr->sh_size))
+	goto error_return;
+      if (info->keep_memory)
+	symtab_hdr->contents = extsyms;
+    }
+
+  /* Get a copy of the native relocations.  */
+  internal_relocs = (_bfd_elf32_link_read_relocs
+		     (abfd, datasec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
+		      info->keep_memory));
+  if (internal_relocs == NULL)
+    goto error_return;
+  if (! info->keep_memory)
+    free_relocs = internal_relocs;
+
+  relsec->contents = (bfd_byte *) bfd_alloc (abfd, datasec->reloc_count * 12);
+  if (relsec->contents == NULL)
+    goto error_return;
+
+  p = relsec->contents;
+
+  irelend = internal_relocs + datasec->reloc_count;
+  for (irel = internal_relocs; irel < irelend; irel++, p += 12)
+    {
+      asection *targetsec;
+
+      /* We are going to write a four byte longword into the runtime
+       reloc section.  The longword will be the address in the data
+       section which must be relocated.  It is followed by the name
+       of the target section NUL-padded or truncated to 8
+       characters.  */
+
+      /* We can only relocate absolute longword relocs at run time.  */
+      if (ELF32_R_TYPE (irel->r_info) != (int) R_68K_32)
+	{
+	  *errmsg = _("unsupported reloc type");
+	  bfd_set_error (bfd_error_bad_value);
+	  goto error_return;
+	}
+
+      /* Get the target section referred to by the reloc.  */
+      if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
+	{
+	  Elf_Internal_Sym isym;
+
+	  /* A local symbol.  */
+	  bfd_elf32_swap_symbol_in (abfd,
+				    extsyms + ELF32_R_SYM (irel->r_info),
+				    &isym);
+
+	  targetsec = bfd_section_from_elf_index (abfd, isym.st_shndx);
+	}
+      else
+	{
+	  unsigned long indx;
+	  struct elf_link_hash_entry *h;
+
+	  /* An external symbol.  */
+	  indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info;
+	  h = elf_sym_hashes (abfd)[indx];
+	  BFD_ASSERT (h != NULL);
+	  if (h->root.type == bfd_link_hash_defined
+	      || h->root.type == bfd_link_hash_defweak)
+	    targetsec = h->root.u.def.section;
+	  else
+	    targetsec = NULL;
+	}
+
+      bfd_put_32 (abfd, irel->r_offset + datasec->output_offset, p);
+      memset (p + 4, 0, 8);
+      if (targetsec != NULL)
+	strncpy (p + 4, targetsec->output_section->name, 8);
+    }
+
+  if (free_extsyms != NULL)
+    free (free_extsyms);
+  if (free_relocs != NULL)
+    free (free_relocs);
+  return true;
+
+error_return:
+  if (free_extsyms != NULL)
+    free (free_extsyms);
+  if (free_relocs != NULL)
+    free (free_relocs);
+  return false;
+}
+
 #define TARGET_BIG_SYM			bfd_elf32_m68k_vec
 #define TARGET_BIG_NAME			"elf32-m68k"
 #define ELF_MACHINE_CODE		EM_68K
diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c
index 99e9c73..6bb2e75 100644
--- a/bfd/elf32-mcore.c
+++ b/bfd/elf32-mcore.c
@@ -29,7 +29,7 @@
 #include <assert.h>
 
 #define	USE_RELA	/* Only USE_REL is actually significant, but this is
-			   here are a reminder... */
+			   here are a reminder...  */
 
 static void mcore_elf_howto_init
   PARAMS ((void));
@@ -84,7 +84,7 @@
 	 false),		/* pcrel_offset */
 
   /* 8 bits + 2 zero bits; jmpi/jsri/lrw instructions.
-     Should not appear in object files. */
+     Should not appear in object files.  */
   HOWTO (R_MCORE_PCRELIMM8BY4,	/* type */
 	 2,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -99,7 +99,7 @@
 	 0,			/* dst_mask */
 	 true),			/* pcrel_offset */
 
-  /* bsr/bt/bf/br instructions; 11 bits + 1 zero bit 
+  /* bsr/bt/bf/br instructions; 11 bits + 1 zero bit
      Span 2k instructions == 4k bytes.
      Only useful pieces at the relocated address are the opcode (5 bits) */
   HOWTO (R_MCORE_PCRELIMM11BY2,/* type */
@@ -116,7 +116,7 @@
 	 0x7ff,			/* dst_mask */
 	 true),			/* pcrel_offset */
 
-  /* 4 bits + 1 zero bit; 'loopt' instruction only; unsupported. */
+  /* 4 bits + 1 zero bit; 'loopt' instruction only; unsupported.  */
   HOWTO (R_MCORE_PCRELIMM4BY2,	/* type */
 	 1,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -131,7 +131,7 @@
 	 0,			/* dst_mask */
 	 true),			/* pcrel_offset */
 
-  /* 32-bit pc-relative. Eventually this will help support PIC code. */
+  /* 32-bit pc-relative. Eventually this will help support PIC code.  */
   HOWTO (R_MCORE_PCREL32,	/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -148,11 +148,11 @@
 
   /* Like PCRELIMM11BY2, this relocation indicates that there is a
      'jsri' at the specified address. There is a separate relocation
-     entry for the literal pool entry that it references, but we 
+     entry for the literal pool entry that it references, but we
      might be able to change the jsri to a bsr if the target turns out
      to be close enough [even though we won't reclaim the literal pool
      entry, we'll get some runtime efficiency back]. Note that this
-     is a relocation that we are allowed to safely ignore.  */ 
+     is a relocation that we are allowed to safely ignore.  */
   HOWTO (R_MCORE_PCRELJSR_IMM11BY2,/* type */
 	 1,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -166,7 +166,7 @@
 	 0x0,			/* src_mask */
 	 0x7ff,			/* dst_mask */
 	 true),			/* pcrel_offset */
-  
+
   /* GNU extension to record C++ vtable hierarchy */
   HOWTO (R_MCORE_GNU_VTINHERIT, /* type */
          0,                     /* rightshift */
@@ -196,7 +196,7 @@
          0,                     /* src_mask */
          0,                     /* dst_mask */
          false),                /* pcrel_offset */
-  
+
   HOWTO (R_MCORE_RELATIVE,      /* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -225,11 +225,11 @@
   for (i = NUM_ELEM (mcore_elf_howto_raw); i--;)
     {
       unsigned int type;
-      
+
       type = mcore_elf_howto_raw[i].type;
-      
+
       BFD_ASSERT (type < NUM_ELEM (mcore_elf_howto_table));
-      
+
       mcore_elf_howto_table [type] = & mcore_elf_howto_raw [i];
     }
 }
@@ -275,11 +275,11 @@
     mcore_elf_howto_init ();
 
   BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_MCORE_max);
-  
+
   cache_ptr->howto = mcore_elf_howto_table [ELF32_R_TYPE (dst->r_info)];
 }
 
-/* Function to set whether a module needs the -mrelocatable bit set. */
+/* Function to set whether a module needs the -mrelocatable bit set.  */
 static boolean
 mcore_elf_set_private_flags (abfd, flags)
      bfd * abfd;
@@ -331,7 +331,7 @@
 
   new_flags = elf_elfheader (ibfd)->e_flags;
   old_flags = elf_elfheader (obfd)->e_flags;
-  
+
   if (! elf_flags_init (obfd))	/* First call, no flags set */
     {
       elf_flags_init (obfd) = true;
@@ -350,7 +350,6 @@
 
 /* Don't pretend we can deal with unsupported relocs.  */
 
-/*ARGSUSED*/
 static bfd_reloc_status_type
 mcore_elf_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section,
 			   output_bfd, error_message)
@@ -363,7 +362,7 @@
      char ** error_message ATTRIBUTE_UNUSED;
 {
   BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0);
-  
+
   _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"),
 		      bfd_get_filename (abfd),
 		      reloc_entry->howto->name,
@@ -445,7 +444,7 @@
       unsigned long                r_symndx;
       struct elf_link_hash_entry * h = (struct elf_link_hash_entry *) 0;
       unsigned short               oldinst = 0;
-      
+
       /* Unknown relocation handling */
       if ((unsigned) r_type >= (unsigned) R_MCORE_max
 	  || ! mcore_elf_howto_table [(int)r_type])
@@ -458,10 +457,10 @@
 	  ret = false;
 	  continue;
 	}
-      
+
       howto = mcore_elf_howto_table [(int) r_type];
       r_symndx = ELF32_R_SYM (rel->r_info);
-      
+
       if (info->relocateable)
 	{
 	  /* This is a relocateable link.  We don't have to change
@@ -471,7 +470,7 @@
 	  if (r_symndx < symtab_hdr->sh_info)
 	    {
 	      sym = local_syms + r_symndx;
-	      
+
 	      if ((unsigned)ELF_ST_TYPE (sym->st_info) == STT_SECTION)
 		{
 		  sec = local_sections[r_symndx];
@@ -488,7 +487,7 @@
 
       /* This is a final link.  */
 
-      /* Complain about known relocation that are not yet supported */
+      /* Complain about known relocation that are not yet supported.  */
       if (howto->special_function == mcore_elf_unsupported_reloc)
 	{
 	  _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"),
@@ -549,7 +548,6 @@
 	  break;
 	}
 
-
 #ifdef DEBUG
       fprintf (stderr, "\ttype = %s (%d), symbol index = %ld, offset = %ld, addend = %ld\n",
 	       howto->name, r_type, r_symndx, (long) offset, (long) addend);
@@ -564,11 +562,11 @@
 	  bfd_put_16 (input_bfd, oldinst, contents + offset);
 	  r = bfd_reloc_ok;
 	}
-      
+
       if (r != bfd_reloc_ok)
 	{
 	  ret = false;
-	  
+
 	  switch (r)
 	    {
 	    default:
@@ -584,7 +582,7 @@
 		  {
 		    name = bfd_elf_string_from_elf_section
 		      (input_bfd, symtab_hdr->sh_link, sym->st_name);
-		    
+
 		    if (name == NULL)
 		      break;
 
@@ -633,7 +631,7 @@
 	    case bfd_link_hash_defined:
 	    case bfd_link_hash_defweak:
 	      return h->root.u.def.section;
-	      
+
 	    case bfd_link_hash_common:
 	      return h->root.u.c.p->section;
 
@@ -671,7 +669,7 @@
 /* Look through the relocs for a section during the first phase.
    Since we don't do .gots or .plts, we just need to consider the
    virtual table relocs for gc.  */
- 
+
 static boolean
 mcore_elf_check_relocs (abfd, info, sec, relocs)
      bfd * abfd;
@@ -684,30 +682,30 @@
   struct elf_link_hash_entry ** sym_hashes_end;
   const Elf_Internal_Rela *     rel;
   const Elf_Internal_Rela *     rel_end;
- 
+
   if (info->relocateable)
     return true;
- 
+
   symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
   sym_hashes_end = sym_hashes + symtab_hdr->sh_size / sizeof (Elf32_External_Sym);
   if (!elf_bad_symtab (abfd))
     sym_hashes_end -= symtab_hdr->sh_info;
- 
+
   rel_end = relocs + sec->reloc_count;
-  
+
   for (rel = relocs; rel < rel_end; rel++)
     {
       struct elf_link_hash_entry * h;
       unsigned long r_symndx;
- 
+
       r_symndx = ELF32_R_SYM (rel->r_info);
-      
+
       if (r_symndx < symtab_hdr->sh_info)
         h = NULL;
       else
         h = sym_hashes [r_symndx - symtab_hdr->sh_info];
- 
+
       switch (ELF32_R_TYPE (rel->r_info))
         {
         /* This relocation describes the C++ object vtable hierarchy.
@@ -716,7 +714,7 @@
           if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
             return false;
           break;
-	  
+
         /* This relocation describes which C++ vtable entries are actually
            used.  Record for later use during GC.  */
         case R_MCORE_GNU_VTENTRY:
@@ -725,7 +723,7 @@
           break;
         }
     }
- 
+
   return true;
 }
 
@@ -740,7 +738,6 @@
 #define elf_info_to_howto	mcore_elf_info_to_howto
 #define elf_info_to_howto_rel	NULL
 
-
 #define bfd_elf32_bfd_copy_private_bfd_data	mcore_elf_copy_private_bfd_data
 #define bfd_elf32_bfd_merge_private_bfd_data	mcore_elf_merge_private_bfd_data
 #define bfd_elf32_bfd_set_private_flags		mcore_elf_set_private_flags
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 29e260e..5bb1e94 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -1,10 +1,13 @@
 /* MIPS-specific support for 32-bit ELF
-   Copyright 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+   Copyright 1993, 94, 95, 96, 97, 98, 99, 2000
+   Free Software Foundation, Inc.
 
    Most of the information added by Ian Lance Taylor, Cygnus Support,
    <ian@cygnus.com>.
    N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC.
    <mark@codesourcery.com>
+   Traditional MIPS targets support added by Koundinya.K, Dansk Data
+   Elektronik & Operations Research Group. <kk@ddeorg.soft.net>
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -40,7 +43,7 @@
 #include "coff/internal.h"
 #include "coff/ecoff.h"
 #include "coff/mips.h"
-#define ECOFF_32
+#define ECOFF_SIGNED_32
 #include "ecoffswap.h"
 
 /* This structure is used to hold .got information when linking.  It
@@ -70,7 +73,7 @@
   EXTR esym;
 
   /* Number of R_MIPS_32, R_MIPS_REL32, or R_MIPS_64 relocs against
-     this symbol.  */ 
+     this symbol.  */
   unsigned int possibly_dynamic_relocs;
 
   /* The index of the first dynamic relocation (in the .rel.dyn
@@ -109,7 +112,7 @@
 static void bfd_mips_elf32_swap_gptab_out
   PARAMS ((bfd *, const Elf32_gptab *, Elf32_External_gptab *));
 #if 0
-static void bfd_mips_elf_swap_msym_in 
+static void bfd_mips_elf_swap_msym_in
   PARAMS ((bfd *, const Elf32_External_Msym *, Elf32_Internal_Msym *));
 #endif
 static void bfd_mips_elf_swap_msym_out
@@ -139,9 +142,9 @@
 static bfd_byte *elf32_mips_get_relocated_section_contents
   PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
 	   bfd_byte *, boolean, asymbol **));
-static asection *mips_elf_create_msym_section 
+static asection *mips_elf_create_msym_section
   PARAMS ((bfd *));
-static void mips_elf_irix6_finish_dynamic_symbol 
+static void mips_elf_irix6_finish_dynamic_symbol
   PARAMS ((bfd *, const char *, Elf_Internal_Sym *));
 static bfd_vma mips_elf_sign_extend PARAMS ((bfd_vma, int));
 static boolean mips_elf_overflow_p PARAMS ((bfd_vma, int));
@@ -154,13 +157,13 @@
   PARAMS ((bfd *, struct bfd_link_info *, bfd_vma));
 static bfd_vma mips_elf_got_offset_from_index
   PARAMS ((bfd *, bfd *, bfd_vma));
-static boolean mips_elf_record_global_got_symbol 
+static boolean mips_elf_record_global_got_symbol
   PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *,
 	   struct mips_got_info *));
 static bfd_vma mips_elf_got_page
   PARAMS ((bfd *, struct bfd_link_info *, bfd_vma, bfd_vma *));
 static const Elf_Internal_Rela *mips_elf_next_relocation
-  PARAMS ((unsigned int, const Elf_Internal_Rela *, 
+  PARAMS ((unsigned int, const Elf_Internal_Rela *,
 	   const Elf_Internal_Rela *));
 static bfd_reloc_status_type mips_elf_calculate_relocation
   PARAMS ((bfd *, bfd *, asection *, struct bfd_link_info *,
@@ -170,31 +173,35 @@
 static bfd_vma mips_elf_obtain_contents
   PARAMS ((reloc_howto_type *, const Elf_Internal_Rela *, bfd *, bfd_byte *));
 static boolean mips_elf_perform_relocation
-  PARAMS ((struct bfd_link_info *, reloc_howto_type *, 
+  PARAMS ((struct bfd_link_info *, reloc_howto_type *,
 	   const Elf_Internal_Rela *, bfd_vma,
 	   bfd *, asection *, bfd_byte *, boolean));
 static boolean mips_elf_assign_gp PARAMS ((bfd *, bfd_vma *));
-static boolean mips_elf_sort_hash_table_f 
+static boolean mips_elf_sort_hash_table_f
   PARAMS ((struct mips_elf_link_hash_entry *, PTR));
-static boolean mips_elf_sort_hash_table 
+static boolean mips_elf_sort_hash_table
   PARAMS ((struct bfd_link_info *, unsigned long));
 static asection * mips_elf_got_section PARAMS ((bfd *));
-static struct mips_got_info *mips_elf_got_info 
+static struct mips_got_info *mips_elf_got_info
   PARAMS ((bfd *, asection **));
 static boolean mips_elf_local_relocation_p
-  PARAMS ((bfd *, const Elf_Internal_Rela *, asection **));
-static bfd_vma mips_elf_create_local_got_entry 
+  PARAMS ((bfd *, const Elf_Internal_Rela *, asection **, boolean));
+static bfd_vma mips_elf_create_local_got_entry
   PARAMS ((bfd *, struct mips_got_info *, asection *, bfd_vma));
-static bfd_vma mips_elf_got16_entry 
-  PARAMS ((bfd *, struct bfd_link_info *, bfd_vma));
-static boolean mips_elf_create_dynamic_relocation 
+static bfd_vma mips_elf_got16_entry
+  PARAMS ((bfd *, struct bfd_link_info *, bfd_vma, boolean));
+static boolean mips_elf_create_dynamic_relocation
   PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Rela *,
 	   struct mips_elf_link_hash_entry *, asection *,
-	   bfd_vma, bfd_vma *, asection *));
-static void mips_elf_allocate_dynamic_relocations 
+	   bfd_vma, bfd_vma *, asection *, boolean local_p));
+static void mips_elf_allocate_dynamic_relocations
   PARAMS ((bfd *, unsigned int));
-static boolean mips_elf_stub_section_p 
+static boolean mips_elf_stub_section_p
   PARAMS ((bfd *, asection *));
+static int sort_dynamic_relocs
+  PARAMS ((const void *, const void *));
+
+extern const bfd_target bfd_elf32_tradbigmips_vec;
 
 /* The level of IRIX compatibility we're striving for.  */
 
@@ -204,6 +211,9 @@
   ict_irix6
 } irix_compat_t;
 
+/* This will be used when we sort the dynamic relocation records.  */
+static bfd *reldyn_sorting_bfd;
+
 /* Nonzero if ABFD is using the N32 ABI.  */
 
 #define ABI_N32_P(abfd) \
@@ -214,12 +224,12 @@
 #define ABI_64_P(abfd) \
   ((elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64) != 0)
 
-/* What version of Irix we are trying to be compatible with.  FIXME:
-   At the moment, we never generate "normal" MIPS ELF ABI executables;
-   we always use some version of Irix.  */
+/* Depending on the target vector we generate some version of Irix
+   executables or "normal" MIPS ELF ABI executables.  */
 
 #define IRIX_COMPAT(abfd) \
-  ((ABI_N32_P (abfd) || ABI_64_P (abfd)) ? ict_irix6 : ict_irix5)
+  (abfd->xvec == &bfd_elf32_tradbigmips_vec ? ict_none : \
+  ((ABI_N32_P (abfd) || ABI_64_P (abfd)) ? ict_irix6 : ict_irix5))
 
 /* Whether we are trying to be compatible with IRIX at all.  */
 
@@ -297,10 +307,12 @@
    ? (ABI_64_P (abfd)  						\
       ? 0xdf998010		/* ld t9,0x8010(gp) */		\
       : 0x8f998010)             /* lw t9,0x8010(gp) */		\
-   : 0x8f998000)		/* lw t9,0x8000(gp) */
-#define STUB_MOVE 0x03e07825	/* move t7,ra */
-#define STUB_JALR 0x0320f809	/* jal t9 */
-#define STUB_LI16 0x34180000	/* ori t8,zero,0 */
+   : 0x8f998010)		/* lw t9,0x8000(gp) */
+#define STUB_MOVE(abfd)                                         \
+  (SGI_COMPAT (abfd) ? 0x03e07825 : 0x03e07821)         /* move t7,ra */
+#define STUB_JALR 0x0320f809				/* jal t9 */
+#define STUB_LI16(abfd)                                         \
+  (SGI_COMPAT (abfd) ? 0x34180000 : 0x24180000)         /* ori t8,zero,0 */
 #define MIPS_FUNCTION_STUB_SIZE (16)
 
 #if 0
@@ -370,7 +382,7 @@
 typedef struct
 {
   unsigned int ctype : 1;	/* 1: long 0: short format. See below.  */
-  unsigned int rtype : 4;	/* Relocation types. See below. */
+  unsigned int rtype : 4;	/* Relocation types. See below.  */
   unsigned int dist2to : 8;
   unsigned int relvaddr : 19;	/* (VADDR - vaddr of the previous entry)/ 4 */
   unsigned long konst;		/* KONST field. See below.  */
@@ -380,7 +392,7 @@
 typedef struct
 {
   unsigned int ctype : 1;	/* 1: long 0: short format. See below.  */
-  unsigned int rtype : 4;	/* Relocation types. See below. */
+  unsigned int rtype : 4;	/* Relocation types. See below.  */
   unsigned int dist2to : 8;
   unsigned int relvaddr : 19;	/* (VADDR - vaddr of the previous entry)/ 4 */
   unsigned long konst;		/* KONST field. See below.  */
@@ -875,7 +887,7 @@
   EMPTY_HOWTO (R_MIPS_PJUMP),
   EMPTY_HOWTO (R_MIPS_RELGOT),
 
-  /* Protected jump conversion.  This is an optimization hint.  No 
+  /* Protected jump conversion.  This is an optimization hint.  No
      relocation is required for correctness.  */
   HOWTO (R_MIPS_JALR,	        /* type */
 	 0,			/* rightshift */
@@ -944,7 +956,6 @@
 	 0x07ff001f,	        /* dst_mask */
 	 false);		/* pcrel_offset */
 
-
 /* GNU extensions for embedded-pic.  */
 /* High 16 bits of symbol value, pc-relative.  */
 static reloc_howto_type elf_mips_gnu_rel_hi16 =
@@ -1221,7 +1232,7 @@
 	  if ((val & 0x8000) != 0)
 	    val += 0x10000;
 
-	  insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff);
+	  insn = (insn & ~0xffff) | ((val >> 16) & 0xffff);
 	  bfd_put_32 (abfd, insn, l->addr);
 
 	  if (strcmp (bfd_asymbol_name (symbol), "_gp_disp") == 0)
@@ -1513,7 +1524,7 @@
       || (symbol->flags & BSF_SECTION_SYM) != 0)
     val += relocation - gp;
 
-  insn = (insn &~ 0xffff) | (val & 0xffff);
+  insn = (insn & ~0xffff) | (val & 0xffff);
   bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
 
   if (relocateable)
@@ -1811,6 +1822,12 @@
       return 3;
     case E_MIPS_ARCH_4:
       return 4;
+    case E_MIPS_ARCH_5:
+      return 5;
+    case E_MIPS_ARCH_32:
+      return 32;
+    case E_MIPS_ARCH_64:
+      return 64;
     }
   return 4;
 }
@@ -1838,6 +1855,12 @@
     case E_MIPS_MACH_4650:
       return bfd_mach_mips4650;
 
+    case E_MIPS_MACH_MIPS32_4K:
+      return bfd_mach_mips32_4k;
+
+    case E_MIPS_MACH_SB1:
+      return bfd_mach_mips_sb1;
+
     default:
       switch (flags & EF_MIPS_ARCH)
 	{
@@ -1857,15 +1880,27 @@
 	case E_MIPS_ARCH_4:
 	  return bfd_mach_mips8000;
 	  break;
+
+	case E_MIPS_ARCH_5:
+	  return bfd_mach_mips5;
+	  break;
+
+	case E_MIPS_ARCH_32:
+	  return bfd_mach_mips32;
+	  break;
+
+	case E_MIPS_ARCH_64:
+	  return bfd_mach_mips64;
+	  break;
 	}
     }
 
   return 0;
 }
 
-/* Return printable name for ABI. */
+/* Return printable name for ABI.  */
 
-static INLINE char*
+static INLINE char *
 elf_mips_abi_name (abfd)
      bfd *abfd;
 {
@@ -1875,7 +1910,7 @@
     return "N32";
   else if (ABI_64_P (abfd))
     return "64";
-      
+
   flags = elf_elfheader (abfd)->e_flags;
   switch (flags & EF_MIPS_ABI)
     {
@@ -2248,7 +2283,6 @@
   bfd_h_put_32 (abfd, in->ms_hash_value, ex->ms_hash_value);
   bfd_h_put_32 (abfd, in->ms_info, ex->ms_info);
 }
-
 
 /* Determine whether a symbol is global for the purposes of splitting
    the symbol table into global symbols and local symbols.  At least
@@ -2256,7 +2290,6 @@
    symbols.  On most ELF targets the split is between static symbols
    and externally visible symbols.  */
 
-/*ARGSUSED*/
 static boolean
 mips_elf_sym_is_global (abfd, sym)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -2286,7 +2319,6 @@
    file.  This gets the MIPS architecture right based on the machine
    number.  This is used by both the 32-bit and the 64-bit ABI.  */
 
-/*ARGSUSED*/
 void
 _bfd_mips_elf_final_write_processing (abfd, linker)
      bfd *abfd;
@@ -2337,9 +2369,29 @@
     case bfd_mach_mips8000:
       val = E_MIPS_ARCH_4;
       break;
+
+    case bfd_mach_mips32:
+      val = E_MIPS_ARCH_32;
+      break;
+
+    case bfd_mach_mips32_4k:
+      val = E_MIPS_ARCH_32 | E_MIPS_MACH_MIPS32_4K;
+      break;
+
+    case bfd_mach_mips5:
+      val = E_MIPS_ARCH_5;
+      break;
+
+    case bfd_mach_mips64:
+      val = E_MIPS_ARCH_64;
+      break;
+
+    case bfd_mach_mips_sb1:
+      val = E_MIPS_ARCH_64 | E_MIPS_MACH_SB1;
+      break;
     }
 
-  elf_elfheader (abfd)->e_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH);
+  elf_elfheader (abfd)->e_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH);
   elf_elfheader (abfd)->e_flags |= val;
 
   /* Set the sh_info field for .gptab sections and other appropriate
@@ -2411,7 +2463,7 @@
     }
 }
 
-/* Function to keep MIPS specific file flags like as EF_MIPS_PIC. */
+/* Function to keep MIPS specific file flags like as EF_MIPS_PIC.  */
 
 boolean
 _bfd_mips_elf_set_private_flags (abfd, flags)
@@ -2458,6 +2510,8 @@
   flagword old_flags;
   flagword new_flags;
   boolean ok;
+  boolean null_input_bfd = true;
+  asection *sec;
 
   /* Check if we have the same endianess */
   if (_bfd_generic_verify_endian_match (ibfd, obfd) == false)
@@ -2475,7 +2529,7 @@
     {
       elf_flags_init (obfd) = true;
       elf_elfheader (obfd)->e_flags = new_flags;
-      elf_elfheader (obfd)->e_ident[EI_CLASS] 
+      elf_elfheader (obfd)->e_ident[EI_CLASS]
 	= elf_elfheader (ibfd)->e_ident[EI_CLASS];
 
       if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
@@ -2497,6 +2551,27 @@
   if (new_flags == old_flags)
     return true;
 
+  /* Check to see if the input BFD actually contains any sections.
+     If not, its flags may not have been initialised either, but it cannot
+     actually cause any incompatibility.  */
+  for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+    {
+      /* Ignore synthetic sections and empty .text, .data and .bss sections
+	  which are automatically generated by gas.  */
+      if (strcmp (sec->name, ".reginfo")
+	  && strcmp (sec->name, ".mdebug")
+	  && ((!strcmp (sec->name, ".text")
+	       || !strcmp (sec->name, ".data")
+	       || !strcmp (sec->name, ".bss"))
+	      && sec->_raw_size != 0))
+	{
+	  null_input_bfd = false;
+	  break;
+	}
+    }
+  if (null_input_bfd)
+    return true;
+
   ok = true;
 
   if ((new_flags & EF_MIPS_PIC) != (old_flags & EF_MIPS_PIC))
@@ -2519,7 +2594,7 @@
       ok = false;
     }
 
-  /* Compare the ISA's. */
+  /* Compare the ISA's.  */
   if ((new_flags & (EF_MIPS_ARCH | EF_MIPS_MACH))
       != (old_flags & (EF_MIPS_ARCH | EF_MIPS_MACH)))
     {
@@ -2529,19 +2604,18 @@
       int old_isa = elf_mips_isa (old_flags);
 
       /* If either has no machine specified, just compare the general isa's.
-	 Some combinations of machines are ok, if the isa's match. */
-      if (! new_mach 
+	 Some combinations of machines are ok, if the isa's match.  */
+      if (! new_mach
 	  || ! old_mach
 	  || new_mach == old_mach
 	  )
 	{
-	  /* Don't warn about mixing -mips1 and -mips2 code, or mixing -mips3
-	     and -mips4 code.  They will normally use the same data sizes and
-	     calling conventions.  */
+	  /* Don't warn about mixing code using 32-bit ISAs, or mixing code
+	     using 64-bit ISAs.  They will normally use the same data sizes
+	     and calling conventions.  */
 
-	  if ((new_isa == 1 || new_isa == 2)
-	      ? (old_isa != 1 && old_isa != 2)
-	      : (old_isa == 1 || old_isa == 2))
+	  if ((  (new_isa == 1 || new_isa == 2 || new_isa == 32)
+	       ^ (old_isa == 1 || old_isa == 2 || old_isa == 32)) != 0)
 	    {
 	      (*_bfd_error_handler)
 	       (_("%s: ISA mismatch (-mips%d) with previous modules (-mips%d)"),
@@ -2560,19 +2634,19 @@
 	  ok = false;
 	}
 
-      new_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH);
-      old_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH);
+      new_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH);
+      old_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH);
     }
 
   /* Compare ABI's.  The 64-bit ABI does not use EF_MIPS_ABI.  But, it
      does set EI_CLASS differently from any 32-bit ABI.  */
   if ((new_flags & EF_MIPS_ABI) != (old_flags & EF_MIPS_ABI)
-      || (elf_elfheader (ibfd)->e_ident[EI_CLASS] 
+      || (elf_elfheader (ibfd)->e_ident[EI_CLASS]
 	  != elf_elfheader (obfd)->e_ident[EI_CLASS]))
     {
-      /* Only error if both are set (to different values). */
+      /* Only error if both are set (to different values).  */
       if (((new_flags & EF_MIPS_ABI) && (old_flags & EF_MIPS_ABI))
-	  || (elf_elfheader (ibfd)->e_ident[EI_CLASS] 
+	  || (elf_elfheader (ibfd)->e_ident[EI_CLASS]
 	      != elf_elfheader (obfd)->e_ident[EI_CLASS]))
 	{
 	  (*_bfd_error_handler)
@@ -2618,40 +2692,46 @@
   _bfd_elf_print_private_bfd_data (abfd, ptr);
 
   /* xgettext:c-format */
-  fprintf (file, _ ("private flags = %lx:"), elf_elfheader (abfd)->e_flags);
+  fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags);
 
   if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_O32)
-    fprintf (file, _ (" [abi=O32]"));
+    fprintf (file, _(" [abi=O32]"));
   else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_O64)
-    fprintf (file, _ (" [abi=O64]"));
+    fprintf (file, _(" [abi=O64]"));
   else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI32)
-    fprintf (file, _ (" [abi=EABI32]"));
+    fprintf (file, _(" [abi=EABI32]"));
   else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI64)
-    fprintf (file, _ (" [abi=EABI64]"));
+    fprintf (file, _(" [abi=EABI64]"));
   else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI))
-    fprintf (file, _ (" [abi unknown]"));
+    fprintf (file, _(" [abi unknown]"));
   else if (ABI_N32_P (abfd))
-    fprintf (file, _ (" [abi=N32]"));
+    fprintf (file, _(" [abi=N32]"));
   else if (ABI_64_P (abfd))
-    fprintf (file, _ (" [abi=64]"));
+    fprintf (file, _(" [abi=64]"));
   else
-    fprintf (file, _ (" [no abi set]"));
+    fprintf (file, _(" [no abi set]"));
 
   if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_1)
-    fprintf (file, _ (" [mips1]"));
+    fprintf (file, _(" [mips1]"));
   else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_2)
-    fprintf (file, _ (" [mips2]"));
+    fprintf (file, _(" [mips2]"));
   else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_3)
-    fprintf (file, _ (" [mips3]"));
+    fprintf (file, _(" [mips3]"));
   else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_4)
-    fprintf (file, _ (" [mips4]"));
+    fprintf (file, _(" [mips4]"));
+  else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_5)
+    fprintf (file, _ (" [mips5]"));
+  else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_32)
+    fprintf (file, _ (" [mips32]"));
+  else if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_64)
+    fprintf (file, _ (" [mips64]"));
   else
-    fprintf (file, _ (" [unknown ISA]"));
+    fprintf (file, _(" [unknown ISA]"));
 
   if (elf_elfheader (abfd)->e_flags & EF_MIPS_32BITMODE)
-    fprintf (file, _ (" [32bitmode]"));
+    fprintf (file, _(" [32bitmode]"));
   else
-    fprintf (file, _ (" [not 32bitmode]"));
+    fprintf (file, _(" [not 32bitmode]"));
 
   fputc ('\n', file);
 
@@ -2871,17 +2951,23 @@
       hdr->sh_type = SHT_MIPS_REGINFO;
       /* In a shared object on Irix 5.3, the .reginfo section has an
          entsize of 0x18.  FIXME: Does this matter?  */
-      if (SGI_COMPAT (abfd) && (abfd->flags & DYNAMIC) != 0)
-	hdr->sh_entsize = sizeof (Elf32_External_RegInfo);
+      if (SGI_COMPAT (abfd))
+	{
+	  if ((abfd->flags & DYNAMIC) != 0)
+	    hdr->sh_entsize = sizeof (Elf32_External_RegInfo);
+	  else
+	    hdr->sh_entsize = 1;
+	}
       else
-	hdr->sh_entsize = 1;
+	hdr->sh_entsize = sizeof (Elf32_External_RegInfo);
     }
   else if (SGI_COMPAT (abfd)
 	   && (strcmp (name, ".hash") == 0
 	       || strcmp (name, ".dynamic") == 0
 	       || strcmp (name, ".dynstr") == 0))
     {
-      hdr->sh_entsize = 0;
+      if (SGI_COMPAT (abfd))
+	hdr->sh_entsize = 0;
 #if 0
       /* This isn't how the Irix 6 linker behaves.  */
       hdr->sh_info = SIZEOF_MIPS_DYNSYM_SECNAMES;
@@ -2943,7 +3029,7 @@
 
       esd = elf_section_data (sec);
       BFD_ASSERT (esd->rel_hdr2 == NULL);
-      esd->rel_hdr2 
+      esd->rel_hdr2
 	= (Elf_Internal_Shdr *) bfd_zalloc (abfd, sizeof (Elf_Internal_Shdr));
       if (!esd->rel_hdr2)
 	return false;
@@ -3099,7 +3185,7 @@
 			     + (l - contents)
 			     + sizeof (Elf_External_Options)
 			     + (sizeof (Elf32_External_RegInfo) - 4)),
-			     SEEK_SET) == -1)
+			    SEEK_SET) == -1)
 		return false;
 	      bfd_h_put_32 (abfd, elf_gp (abfd), buf);
 	      if (bfd_write (buf, 1, 4, abfd) != 4)
@@ -3150,7 +3236,6 @@
 
   return true;
 }
-
 
 /* MIPS ELF uses two common sections.  One is the usual one, and the
    other is for small objects.  All the small objects are kept
@@ -3168,18 +3253,6 @@
 static asymbol mips_elf_acom_symbol;
 static asymbol *mips_elf_acom_symbol_ptr;
 
-/* The Irix 5 support uses two virtual sections, which represent
-   text/data symbols defined in dynamic objects.  */
-static asection mips_elf_text_section;
-static asection *mips_elf_text_section_ptr;
-static asymbol mips_elf_text_symbol;
-static asymbol *mips_elf_text_symbol_ptr;
-
-static asection mips_elf_data_section;
-static asection *mips_elf_data_section_ptr;
-static asymbol mips_elf_data_symbol;
-static asymbol *mips_elf_data_symbol_ptr;
-
 /* Handle the special MIPS section numbers that a symbol may use.
    This is used for both the 32-bit and the 64-bit ABI.  */
 
@@ -3266,9 +3339,6 @@
   asection *s;
   int ret = 0;
 
-  if (!SGI_COMPAT (abfd))
-    return 0;
-
   /* See if we need a PT_MIPS_REGINFO segment.  */
   s = bfd_get_section_by_name (abfd, ".reginfo");
   if (s && (s->flags & SEC_LOAD))
@@ -3276,7 +3346,7 @@
 
   /* See if we need a PT_MIPS_OPTIONS segment.  */
   if (IRIX_COMPAT (abfd) == ict_irix6
-      && bfd_get_section_by_name (abfd, 
+      && bfd_get_section_by_name (abfd,
 				  MIPS_ELF_OPTIONS_SECTION_NAME (abfd)))
     ++ret;
 
@@ -3298,9 +3368,6 @@
   asection *s;
   struct elf_segment_map *m, **pm;
 
-  if (! SGI_COMPAT (abfd))
-    return true;
-
   /* If there is a .reginfo section, we need a PT_MIPS_REGINFO
      segment.  */
   s = bfd_get_section_by_name (abfd, ".reginfo");
@@ -3351,13 +3418,13 @@
 	     there's not (like when running the `ld' testsuite).  So,
 	     if there's no program header table, we just put the
 	     options segement at the end.  */
-	  for (pm = &elf_tdata (abfd)->segment_map; 
+	  for (pm = &elf_tdata (abfd)->segment_map;
 	       *pm != NULL;
 	       pm = &(*pm)->next)
 	    if ((*pm)->p_type == PT_PHDR)
 	      break;
 
-	  options_segment = bfd_zalloc (abfd, 
+	  options_segment = bfd_zalloc (abfd,
 					sizeof (struct elf_segment_map));
 	  options_segment->next = *pm;
 	  options_segment->p_type = PT_MIPS_OPTIONS;
@@ -3370,61 +3437,77 @@
     }
   else
     {
-      /* If there are .dynamic and .mdebug sections, we make a room
-	 for the RTPROC header.  FIXME: Rewrite without section names.  */
-      if (bfd_get_section_by_name (abfd, ".interp") == NULL
-	  && bfd_get_section_by_name (abfd, ".dynamic") != NULL
-	  && bfd_get_section_by_name (abfd, ".mdebug") != NULL)
+      if (IRIX_COMPAT (abfd) == ict_irix5)
 	{
-	  for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
-	    if (m->p_type == PT_MIPS_RTPROC)
-	      break;
-	  if (m == NULL)
+	  /* If there are .dynamic and .mdebug sections, we make a room
+	     for the RTPROC header.  FIXME: Rewrite without section names.  */
+	  if (bfd_get_section_by_name (abfd, ".interp") == NULL
+	      && bfd_get_section_by_name (abfd, ".dynamic") != NULL
+	      && bfd_get_section_by_name (abfd, ".mdebug") != NULL)
 	    {
-	      m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m);
+	      for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+		if (m->p_type == PT_MIPS_RTPROC)
+		  break;
 	      if (m == NULL)
-		return false;
-
-	      m->p_type = PT_MIPS_RTPROC;
-
-	      s = bfd_get_section_by_name (abfd, ".rtproc");
-	      if (s == NULL)
 		{
-		  m->count = 0;
-		  m->p_flags = 0;
-		  m->p_flags_valid = 1;
-		}
-	      else
-		{
-		  m->count = 1;
-		  m->sections[0] = s;
-		}
+		  m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m);
+		  if (m == NULL)
+		    return false;
 
-	      /* We want to put it after the DYNAMIC segment.  */
-	      pm = &elf_tdata (abfd)->segment_map;
-	      while (*pm != NULL && (*pm)->p_type != PT_DYNAMIC)
-		pm = &(*pm)->next;
-	      if (*pm != NULL)
-		pm = &(*pm)->next;
+		  m->p_type = PT_MIPS_RTPROC;
 
-	      m->next = *pm;
-	      *pm = m;
+		  s = bfd_get_section_by_name (abfd, ".rtproc");
+		  if (s == NULL)
+		    {
+		      m->count = 0;
+		      m->p_flags = 0;
+		      m->p_flags_valid = 1;
+		    }
+		  else
+		    {
+		      m->count = 1;
+		      m->sections[0] = s;
+		    }
+
+		  /* We want to put it after the DYNAMIC segment.  */
+		  pm = &elf_tdata (abfd)->segment_map;
+		  while (*pm != NULL && (*pm)->p_type != PT_DYNAMIC)
+		    pm = &(*pm)->next;
+		  if (*pm != NULL)
+		    pm = &(*pm)->next;
+
+		  m->next = *pm;
+		  *pm = m;
+		}
 	    }
 	}
-
       /* On Irix 5, the PT_DYNAMIC segment includes the .dynamic,
 	 .dynstr, .dynsym, and .hash sections, and everything in
 	 between.  */
-      for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL; pm = &(*pm)->next)
+      for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL;
+	   pm = &(*pm)->next)
 	if ((*pm)->p_type == PT_DYNAMIC)
 	  break;
       m = *pm;
+      if (IRIX_COMPAT (abfd) == ict_none)
+	{
+	  /* For a normal mips executable the permissions for the PT_DYNAMIC
+	     segment are read, write and execute. We do that here since
+	     the code in elf.c sets only the read permission. This matters
+	     sometimes for the dynamic linker.  */
+	  if (bfd_get_section_by_name (abfd, ".dynamic") != NULL)
+	    {
+	      m->p_flags = PF_R | PF_W | PF_X;
+	      m->p_flags_valid = 1;
+	    }
+	}
       if (m != NULL
-	  && m->count == 1
-	  && strcmp (m->sections[0]->name, ".dynamic") == 0)
+	  && m->count == 1 && strcmp (m->sections[0]->name, ".dynamic") == 0)
 	{
 	  static const char *sec_names[] =
-	  { ".dynamic", ".dynstr", ".dynsym", ".hash" };
+	  {
+	    ".dynamic", ".dynstr", ".dynsym", ".hash"
+	  };
 	  bfd_vma low, high;
 	  unsigned int i, c;
 	  struct elf_segment_map *n;
@@ -3453,8 +3536,8 @@
 	    if ((s->flags & SEC_LOAD) != 0
 		&& s->vma >= low
 		&& ((s->vma
-		     + (s->_cooked_size != 0 ? s->_cooked_size : s->_raw_size))
-		    <= high))
+		     + (s->_cooked_size !=
+			0 ? s->_cooked_size : s->_raw_size)) <= high))
 	      ++c;
 
 	  n = ((struct elf_segment_map *)
@@ -3471,8 +3554,7 @@
 		  && s->vma >= low
 		  && ((s->vma
 		       + (s->_cooked_size != 0 ?
-			  s->_cooked_size : s->_raw_size))
-		      <= high))
+			  s->_cooked_size : s->_raw_size)) <= high))
 		{
 		  n->sections[i] = s;
 		  ++i;
@@ -3502,7 +3584,7 @@
 	long	reserved;
 	struct exception_info *exception_info;/* pointer to exception array */
 } RPDR, *pRPDR;
-#define cbRPDR sizeof(RPDR)
+#define cbRPDR sizeof (RPDR)
 #define rpdNil ((pRPDR) 0)
 
 /* Swap RPDR (runtime procedure table entry) for output.  */
@@ -3547,7 +3629,7 @@
   char *ext_hdr = NULL;
 
   swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
-  memset (debug, 0, sizeof(*debug));
+  memset (debug, 0, sizeof (*debug));
 
   ext_hdr = (char *) bfd_malloc ((size_t) swap->external_hdr_size);
   if (ext_hdr == NULL && swap->external_hdr_size != 0)
@@ -3626,7 +3708,6 @@
 
 /* MIPS ELF local labels start with '$', not 'L'.  */
 
-/*ARGSUSED*/
 static boolean
 mips_elf_is_local_label_name (abfd, name)
      bfd *abfd;
@@ -3669,8 +3750,9 @@
 
   if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
 				     filename_ptr, functionname_ptr,
-				     line_ptr, 
-				     ABI_64_P (abfd) ? 8 : 0))
+				     line_ptr,
+				     ABI_64_P (abfd) ? 8 : 0,
+				     &elf_tdata (abfd)->dwarf2_find_line_info))
     return true;
 
   msec = bfd_get_section_by_name (abfd, ".mdebug");
@@ -3809,11 +3891,11 @@
   /* The size of the .compact_rel section (if SGI_COMPAT).  */
   bfd_size_type compact_rel_size;
   /* This flag indicates that the value of DT_MIPS_RLD_MAP dynamic
-     entry is set to the address of __rld_obj_head as in Irix 5. */
+     entry is set to the address of __rld_obj_head as in Irix 5.  */
   boolean use_rld_obj_head;
   /* This is the value of the __rld_map or __rld_obj_head symbol.  */
   bfd_vma rld_value;
-  /* This is set if we see any mips16 stub sections. */
+  /* This is set if we see any mips16 stub sections.  */
   boolean mips16_stubs_seen;
 };
 
@@ -3882,6 +3964,27 @@
   return (struct bfd_hash_entry *) ret;
 }
 
+void
+_bfd_mips_elf_hide_symbol (info, h)
+     struct bfd_link_info *info;
+     struct mips_elf_link_hash_entry *h;
+{
+  bfd *dynobj;
+  asection *got;
+  struct mips_got_info *g;
+  dynobj = elf_hash_table (info)->dynobj;
+  got = bfd_get_section_by_name (dynobj, ".got");
+  g = (struct mips_got_info *) elf_section_data (got)->tdata;
+
+  h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+  h->root.plt.offset = (bfd_vma) -1;
+  h->root.dynindx = -1;
+
+  /* FIXME: Do we allocate too much GOT space here?  */
+  g->local_gotno++;
+  got->_raw_size += MIPS_ELF_GOT_SIZE (dynobj);
+}
+
 /* Create a MIPS ELF linker hash table.  */
 
 struct bfd_link_hash_table *
@@ -3919,7 +4022,6 @@
 /* Hook called by the linker routine which adds symbols from an object
    file.  We must handle the special MIPS section numbers here.  */
 
-/*ARGSUSED*/
 boolean
 _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
      bfd *abfd;
@@ -3956,48 +4058,78 @@
 
     case SHN_MIPS_TEXT:
       /* This section is used in a shared object.  */
-      if (mips_elf_text_section_ptr == NULL)
+      if (elf_tdata (abfd)->elf_text_section == NULL)
 	{
+	  asymbol *elf_text_symbol;
+	  asection *elf_text_section;
+
+	  elf_text_section = bfd_zalloc (abfd, sizeof (asection));
+	  if (elf_text_section == NULL)
+	    return false;
+
+	  elf_text_symbol = bfd_zalloc (abfd, sizeof (asymbol));
+	  if (elf_text_symbol == NULL)
+	    return false;
+
 	  /* Initialize the section.  */
-	  mips_elf_text_section.name = ".text";
-	  mips_elf_text_section.flags = SEC_NO_FLAGS;
-	  mips_elf_text_section.output_section = NULL;
-	  mips_elf_text_section.symbol = &mips_elf_text_symbol;
-	  mips_elf_text_section.symbol_ptr_ptr = &mips_elf_text_symbol_ptr;
-	  mips_elf_text_symbol.name = ".text";
-	  mips_elf_text_symbol.flags = BSF_SECTION_SYM | BSF_DYNAMIC;
-	  mips_elf_text_symbol.section = &mips_elf_text_section;
-	  mips_elf_text_symbol_ptr = &mips_elf_text_symbol;
-	  mips_elf_text_section_ptr = &mips_elf_text_section;
+
+	  elf_tdata (abfd)->elf_text_section = elf_text_section;
+	  elf_tdata (abfd)->elf_text_symbol = elf_text_symbol;
+
+	  elf_text_section->symbol = elf_text_symbol;
+	  elf_text_section->symbol_ptr_ptr = &elf_tdata (abfd)->elf_text_symbol;
+
+	  elf_text_section->name = ".text";
+	  elf_text_section->flags = SEC_NO_FLAGS;
+	  elf_text_section->output_section = NULL;
+	  elf_text_section->owner = abfd;
+	  elf_text_symbol->name = ".text";
+	  elf_text_symbol->flags = BSF_SECTION_SYM | BSF_DYNAMIC;
+	  elf_text_symbol->section = elf_text_section;
 	}
       /* This code used to do *secp = bfd_und_section_ptr if
          info->shared.  I don't know why, and that doesn't make sense,
          so I took it out.  */
-      *secp = mips_elf_text_section_ptr;
+      *secp = elf_tdata (abfd)->elf_text_section;
       break;
 
     case SHN_MIPS_ACOMMON:
       /* Fall through. XXX Can we treat this as allocated data?  */
     case SHN_MIPS_DATA:
       /* This section is used in a shared object.  */
-      if (mips_elf_data_section_ptr == NULL)
+      if (elf_tdata (abfd)->elf_data_section == NULL)
 	{
+	  asymbol *elf_data_symbol;
+	  asection *elf_data_section;
+
+	  elf_data_section = bfd_zalloc (abfd, sizeof (asection));
+	  if (elf_data_section == NULL)
+	    return false;
+
+	  elf_data_symbol = bfd_zalloc (abfd, sizeof (asymbol));
+	  if (elf_data_symbol == NULL)
+	    return false;
+
 	  /* Initialize the section.  */
-	  mips_elf_data_section.name = ".data";
-	  mips_elf_data_section.flags = SEC_NO_FLAGS;
-	  mips_elf_data_section.output_section = NULL;
-	  mips_elf_data_section.symbol = &mips_elf_data_symbol;
-	  mips_elf_data_section.symbol_ptr_ptr = &mips_elf_data_symbol_ptr;
-	  mips_elf_data_symbol.name = ".data";
-	  mips_elf_data_symbol.flags = BSF_SECTION_SYM | BSF_DYNAMIC;
-	  mips_elf_data_symbol.section = &mips_elf_data_section;
-	  mips_elf_data_symbol_ptr = &mips_elf_data_symbol;
-	  mips_elf_data_section_ptr = &mips_elf_data_section;
+
+	  elf_tdata (abfd)->elf_data_section = elf_data_section;
+	  elf_tdata (abfd)->elf_data_symbol = elf_data_symbol;
+
+	  elf_data_section->symbol = elf_data_symbol;
+	  elf_data_section->symbol_ptr_ptr = &elf_tdata (abfd)->elf_data_symbol;
+
+	  elf_data_section->name = ".data";
+	  elf_data_section->flags = SEC_NO_FLAGS;
+	  elf_data_section->output_section = NULL;
+	  elf_data_section->owner = abfd;
+	  elf_data_symbol->name = ".data";
+	  elf_data_symbol->flags = BSF_SECTION_SYM | BSF_DYNAMIC;
+	  elf_data_symbol->section = elf_data_section;
 	}
       /* This code used to do *secp = bfd_und_section_ptr if
          info->shared.  I don't know why, and that doesn't make sense,
          so I took it out.  */
-      *secp = mips_elf_data_section_ptr;
+      *secp = elf_tdata (abfd)->elf_data_section;
       break;
 
     case SHN_MIPS_SUNDEFINED:
@@ -4020,7 +4152,7 @@
 	      get_elf_backend_data (abfd)->collect,
 	      (struct bfd_link_hash_entry **) &h)))
 	return false;
-      h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+      h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
       h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
       h->type = STT_OBJECT;
 
@@ -4102,9 +4234,8 @@
       h->esym.asym.value = 0;
       h->esym.asym.st = stGlobal;
 
-      if (SGI_COMPAT (einfo->abfd)
-	  && (h->root.root.type == bfd_link_hash_undefined
-	      || h->root.root.type == bfd_link_hash_undefweak))
+      if (h->root.root.type == bfd_link_hash_undefined
+	  || h->root.root.type == bfd_link_hash_undefweak)
 	{
 	  const char *name;
 
@@ -4414,6 +4545,20 @@
     = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
   HDRR *symhdr = &debug.symbolic_header;
   PTR mdebug_handle = NULL;
+  asection *s;
+  EXTR esym;
+  bfd_vma last;
+  unsigned int i;
+  static const char * const name[] =
+  {
+    ".text", ".init", ".fini", ".data",
+    ".rodata", ".sdata", ".sbss", ".bss"
+  };
+  static const int sc[] =
+  {
+    scText, scInit, scFini, scData,
+    scRData, scSData, scSBss, scBss
+  };
 
   /* If all the things we linked together were PIC, but we're
      producing an executable (rather than a shared object), then the
@@ -4442,10 +4587,10 @@
 	 adds these symbols when building a shared object.  Note that
 	 we count the sections after (possibly) removing the .options
 	 section above.  */
-      if (!mips_elf_sort_hash_table (info, (info->shared 
+      if (!mips_elf_sort_hash_table (info, (info->shared
 					    ? bfd_count_sections (abfd) + 1
 					    : 1)))
-        return false;
+	return false;
 
       /* Make sure we didn't grow the global .got region.  */
       dynobj = elf_hash_table (info)->dynobj;
@@ -4462,18 +4607,18 @@
      include it, even though we don't process it quite right.  (Some
      entries are supposed to be merged.)  Empirically, we seem to be
      better off including it then not.  */
-  if (IRIX_COMPAT (abfd) == ict_irix5)
+  if (IRIX_COMPAT (abfd) == ict_irix5 || IRIX_COMPAT (abfd) == ict_none)
     for (secpp = &abfd->sections; *secpp != NULL; secpp = &(*secpp)->next)
       {
 	if (strcmp ((*secpp)->name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0)
 	  {
 	    for (p = (*secpp)->link_order_head; p != NULL; p = p->next)
 	      if (p->type == bfd_indirect_link_order)
-		p->u.indirect.section->flags &=~ SEC_HAS_CONTENTS;
+		p->u.indirect.section->flags &= ~SEC_HAS_CONTENTS;
 	    (*secpp)->link_order_head = NULL;
 	    *secpp = (*secpp)->next;
 	    --abfd->section_count;
-	    
+
 	    break;
 	  }
       }
@@ -4496,7 +4641,7 @@
 	  /* Find the GP-relative section with the lowest offset.  */
 	  lo = (bfd_vma) -1;
 	  for (o = abfd->sections; o != (asection *) NULL; o = o->next)
-	    if (o->vma < lo 
+	    if (o->vma < lo
 		&& (elf_section_data (o)->this_hdr.sh_flags & SHF_MIPS_GPREL))
 	      lo = o->vma;
 
@@ -4570,7 +4715,7 @@
 
 	      /* Hack: reset the SEC_HAS_CONTENTS flag so that
 		 elf_link_input_bfd ignores this section.  */
-	      input_section->flags &=~ SEC_HAS_CONTENTS;
+	      input_section->flags &= ~SEC_HAS_CONTENTS;
 	    }
 
 	  /* Size has been set in mips_elf_always_size_sections  */
@@ -4624,44 +4769,30 @@
 	  if (mdebug_handle == (PTR) NULL)
 	    return false;
 
-	  if (SGI_COMPAT (abfd))
+	  esym.jmptbl = 0;
+	  esym.cobol_main = 0;
+	  esym.weakext = 0;
+	  esym.reserved = 0;
+	  esym.ifd = ifdNil;
+	  esym.asym.iss = issNil;
+	  esym.asym.st = stLocal;
+	  esym.asym.reserved = 0;
+	  esym.asym.index = indexNil;
+	  last = 0;
+	  for (i = 0; i < 8; i++)
 	    {
-	      asection *s;
-	      EXTR esym;
-	      bfd_vma last;
-	      unsigned int i;
-	      static const char * const name[] =
-		{ ".text", ".init", ".fini", ".data",
-		    ".rodata", ".sdata", ".sbss", ".bss" };
-	      static const int sc[] = { scText, scInit, scFini, scData,
-					  scRData, scSData, scSBss, scBss };
-
-	      esym.jmptbl = 0;
-	      esym.cobol_main = 0;
-	      esym.weakext = 0;
-	      esym.reserved = 0;
-	      esym.ifd = ifdNil;
-	      esym.asym.iss = issNil;
-	      esym.asym.st = stLocal;
-	      esym.asym.reserved = 0;
-	      esym.asym.index = indexNil;
-	      last = 0;
-	      for (i = 0; i < 8; i++)
+	      esym.asym.sc = sc[i];
+	      s = bfd_get_section_by_name (abfd, name[i]);
+	      if (s != NULL)
 		{
-		  esym.asym.sc = sc[i];
-		  s = bfd_get_section_by_name (abfd, name[i]);
-		  if (s != NULL)
-		    {
-		      esym.asym.value = s->vma;
-		      last = s->vma + s->_raw_size;
-		    }
-		  else
-		    esym.asym.value = last;
-
-		  if (! bfd_ecoff_debug_one_external (abfd, &debug, swap,
-						      name[i], &esym))
-		    return false;
+		  esym.asym.value = s->vma;
+		  last = s->vma + s->_raw_size;
 		}
+	      else
+		esym.asym.value = last;
+	      if (!bfd_ecoff_debug_one_external (abfd, &debug, swap,
+						 name[i], &esym))
+		return false;
 	    }
 
 	  for (p = o->link_order_head;
@@ -4765,7 +4896,7 @@
 
 	      /* Hack: reset the SEC_HAS_CONTENTS flag so that
 		 elf_link_input_bfd ignores this section.  */
-	      input_section->flags &=~ SEC_HAS_CONTENTS;
+	      input_section->flags &= ~SEC_HAS_CONTENTS;
 	    }
 
 	  if (SGI_COMPAT (abfd) && info->shared)
@@ -4844,7 +4975,7 @@
 
 		  /* Hack: reset the SEC_HAS_CONTENTS flag so that
 		     elf_link_input_bfd ignores this section.  */
-		  input_section->flags &=~ SEC_HAS_CONTENTS;
+		  input_section->flags &= ~SEC_HAS_CONTENTS;
 		}
 
 	      /* Skip this section later on (I don't think this
@@ -5003,7 +5134,7 @@
 
 	      /* Hack: reset the SEC_HAS_CONTENTS flag so that
 		 elf_link_input_bfd ignores this section.  */
-	      input_section->flags &=~ SEC_HAS_CONTENTS;
+	      input_section->flags &= ~SEC_HAS_CONTENTS;
 	    }
 
 	  /* The table must be sorted by -G value.  */
@@ -5103,6 +5234,26 @@
   return true;
 }
 
+/* This function is called via qsort() to sort the dynamic relocation
+   entries by increasing r_symndx value.  */
+
+static int
+sort_dynamic_relocs (arg1, arg2)
+     const PTR arg1;
+     const PTR arg2;
+{
+  const Elf32_External_Rel *ext_reloc1 = (const Elf32_External_Rel *) arg1;
+  const Elf32_External_Rel *ext_reloc2 = (const Elf32_External_Rel *) arg2;
+
+  Elf_Internal_Rel int_reloc1;
+  Elf_Internal_Rel int_reloc2;
+
+  bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, ext_reloc1, &int_reloc1);
+  bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, ext_reloc2, &int_reloc2);
+
+  return (ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info));
+}
+
 /* Returns the GOT section for ABFD.  */
 
 static asection *
@@ -5113,7 +5264,7 @@
 }
 
 /* Returns the GOT information associated with the link indicated by
-   INFO.  If SGOTP is non-NULL, it is filled in with the GOT 
+   INFO.  If SGOTP is non-NULL, it is filled in with the GOT
    section.  */
 
 static struct mips_got_info *
@@ -5138,24 +5289,42 @@
 /* Return whether a relocation is against a local symbol.  */
 
 static boolean
-mips_elf_local_relocation_p (input_bfd, relocation, local_sections)
+mips_elf_local_relocation_p (input_bfd, relocation, local_sections,
+			     check_forced)
      bfd *input_bfd;
      const Elf_Internal_Rela *relocation;
      asection **local_sections;
+     boolean check_forced;
 {
   unsigned long r_symndx;
   Elf_Internal_Shdr *symtab_hdr;
+  struct mips_elf_link_hash_entry *h;
+  size_t extsymoff;
 
   r_symndx = ELF32_R_SYM (relocation->r_info);
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
-  if (! elf_bad_symtab (input_bfd))
-    return r_symndx < symtab_hdr->sh_info;
-  else
+  extsymoff = (elf_bad_symtab (input_bfd)) ? 0 : symtab_hdr->sh_info;
+
+  if (r_symndx < extsymoff)
+    return true;
+  if (elf_bad_symtab (input_bfd) && local_sections[r_symndx] != NULL)
+    return true;
+
+  if (check_forced)
     {
-      /* The symbol table does not follow the rule that local symbols
-	 must come before globals.  */
-      return local_sections[r_symndx] != NULL;
+      /* Look up the hash table to check whether the symbol
+ 	 was forced local.  */
+      h = (struct mips_elf_link_hash_entry *)
+	elf_sym_hashes (input_bfd) [r_symndx - extsymoff];
+      /* Find the real hash-table entry for this symbol.  */
+      while (h->root.root.type == bfd_link_hash_indirect
+ 	     || h->root.root.type == bfd_link_hash_warning)
+	h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
+      if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
+	return true;
     }
+
+  return false;
 }
 
 /* Sign-extend VALUE, which has the indicated number of BITS.  */
@@ -5165,10 +5334,10 @@
      bfd_vma value;
      int bits;
 {
-  if (value & ((bfd_vma)1 << (bits - 1)))
+  if (value & ((bfd_vma) 1 << (bits - 1)))
     /* VALUE is negative.  */
-    value |= ((bfd_vma) - 1) << bits;      
-  
+    value |= ((bfd_vma) - 1) << bits;
+
   return value;
 }
 
@@ -5189,7 +5358,7 @@
   else if (svalue < -(1 << (bits - 1)))
     /* The value is too small.  */
     return true;
-    
+
   /* All is well.  */
   return false;
 }
@@ -5219,7 +5388,7 @@
 
 /* Calculate the %highest function.  */
 
-static bfd_vma 
+static bfd_vma
 mips_elf_highest (value)
      bfd_vma value ATTRIBUTE_UNUSED;
 {
@@ -5233,7 +5402,7 @@
 
 /* Returns the GOT index for the global symbol indicated by H.  */
 
-static bfd_vma 
+static bfd_vma
 mips_elf_global_got_index (abfd, h)
      bfd *abfd;
      struct elf_link_hash_entry *h;
@@ -5249,7 +5418,7 @@
      indices into the GOT.  That makes it easy to calculate the GOT
      offset.  */
   BFD_ASSERT (h->dynindx >= g->global_gotsym->dynindx);
-  index = ((h->dynindx - g->global_gotsym->dynindx + g->local_gotno) 
+  index = ((h->dynindx - g->global_gotsym->dynindx + g->local_gotno)
 	   * MIPS_ELF_GOT_SIZE (abfd));
   BFD_ASSERT (index < sgot->_raw_size);
 
@@ -5270,7 +5439,7 @@
 
   sgot = mips_elf_got_section (dynobj);
   gp = _bfd_get_gp_value (output_bfd);
-  return (sgot->output_section->vma + sgot->output_offset + index - 
+  return (sgot->output_section->vma + sgot->output_offset + index -
 	  gp);
 }
 
@@ -5289,7 +5458,7 @@
   if (h->dynindx == -1
       && !bfd_elf32_link_record_dynamic_symbol (info, h))
     return false;
-  
+
   /* If we've already marked this entry as need GOT space, we don't
      need to do it again.  */
   if (h->got.offset != (bfd_vma) - 1)
@@ -5304,7 +5473,7 @@
 
 /* This structure is passed to mips_elf_sort_hash_table_f when sorting
    the dynamic symbols.  */
-     
+
 struct mips_elf_hash_sort_data
 {
   /* The symbol in the global GOT with the lowest dynamic symbol table
@@ -5319,7 +5488,7 @@
 };
 
 /* If H needs a GOT entry, assign it the highest available dynamic
-   index.  Otherwise, assign it the lowest available dynamic 
+   index.  Otherwise, assign it the lowest available dynamic
    index.  */
 
 static boolean
@@ -5327,7 +5496,7 @@
      struct mips_elf_link_hash_entry *h;
      PTR data;
 {
-  struct mips_elf_hash_sort_data *hsd 
+  struct mips_elf_hash_sort_data *hsd
     = (struct mips_elf_hash_sort_data *) data;
 
   /* Symbols without dynamic symbol table entries aren't interesting
@@ -5367,14 +5536,14 @@
   hsd.low = NULL;
   hsd.min_got_dynindx = elf_hash_table (info)->dynsymcount;
   hsd.max_non_got_dynindx = max_local;
-  mips_elf_link_hash_traverse (((struct mips_elf_link_hash_table *) 
-				elf_hash_table (info)), 
-			       mips_elf_sort_hash_table_f, 
+  mips_elf_link_hash_traverse (((struct mips_elf_link_hash_table *)
+				elf_hash_table (info)),
+			       mips_elf_sort_hash_table_f,
 			       &hsd);
 
   /* There shoud have been enough room in the symbol table to
      accomodate both the GOT and non-GOT symbols.  */
-  BFD_ASSERT (hsd.min_got_dynindx == hsd.max_non_got_dynindx);
+  BFD_ASSERT (hsd.max_non_got_dynindx <= hsd.min_got_dynindx);
 
   /* Now we know which dynamic symbol has the lowest dynamic symbol
      table index in the GOT.  */
@@ -5404,7 +5573,7 @@
     }
 
   MIPS_ELF_PUT_WORD (abfd, value,
-		     (sgot->contents 
+		     (sgot->contents
 		      + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno));
   return MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno++;
 }
@@ -5426,8 +5595,8 @@
   g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
 
   /* Look to see if we already have an appropriate entry.  */
-  for (entry = (sgot->contents 
-		+ MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO); 
+  for (entry = (sgot->contents
+		+ MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO);
        entry != sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno;
        entry += MIPS_ELF_GOT_SIZE (abfd))
     {
@@ -5463,7 +5632,7 @@
 
   /* Look to see if we aleady have an appropriate entry.  */
   last_entry = sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno;
-  for (entry = (sgot->contents 
+  for (entry = (sgot->contents
 		+ MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO);
        entry != last_entry;
        entry += MIPS_ELF_GOT_SIZE (abfd))
@@ -5496,10 +5665,11 @@
    for value.  Return the index into the GOT for this entry.  */
 
 static bfd_vma
-mips_elf_got16_entry (abfd, info, value)
+mips_elf_got16_entry (abfd, info, value, external)
      bfd *abfd;
      struct bfd_link_info *info;
      bfd_vma value;
+     boolean external;
 {
   asection *sgot;
   struct mips_got_info *g;
@@ -5508,24 +5678,29 @@
   bfd_vma index = 0;
   bfd_vma address;
 
-  /* Although the ABI says that it is "the high-order 16 bits" that we
-     want, it is really the %high value.  The complete value is
-     calculated with a `addiu' of a LO16 relocation, just as with a
-     HI16/LO16 pair.  */
-  value = mips_elf_high (value) << 16;
+  if (! external)
+    {
+      /* Although the ABI says that it is "the high-order 16 bits" that we
+	 want, it is really the %high value.  The complete value is
+	 calculated with a `addiu' of a LO16 relocation, just as with a
+	 HI16/LO16 pair.  */
+      value = mips_elf_high (value) << 16;
+    }
+
   g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot);
 
   /* Look to see if we already have an appropriate entry.  */
   last_entry = sgot->contents + MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno;
-  for (entry = (sgot->contents 
+  for (entry = (sgot->contents
 		+ MIPS_ELF_GOT_SIZE (abfd) * MIPS_RESERVED_GOTNO);
        entry != last_entry;
        entry += MIPS_ELF_GOT_SIZE (abfd))
     {
       address = MIPS_ELF_GET_WORD (abfd, entry);
-      if ((address & 0xffff0000) == value)
+      if (address == value)
 	{
-	  /* This entry has the right high-order 16 bits.  */
+	  /* This entry has the right high-order 16 bits, and the low-order
+	     16 bits are set to zero.  */
 	  index = entry - sgot->contents;
 	  break;
 	}
@@ -5568,12 +5743,12 @@
 
 /* Create a rel.dyn relocation for the dynamic linker to resolve.  REL
    is the original relocation, which is now being transformed into a
-   dyanmic relocation.  The ADDENDP is adjusted if necessary; the
+   dynamic relocation.  The ADDENDP is adjusted if necessary; the
    caller should store the result in place of the original addend.  */
 
 static boolean
 mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
-				    symbol, addendp, input_section)
+				    symbol, addendp, input_section, local_p)
      bfd *output_bfd;
      struct bfd_link_info *info;
      const Elf_Internal_Rela *rel;
@@ -5582,6 +5757,7 @@
      bfd_vma symbol;
      bfd_vma *addendp;
      asection *input_section;
+     boolean local_p;
 {
   Elf_Internal_Rel outrel;
   boolean skip;
@@ -5591,10 +5767,11 @@
 
   r_type = ELF32_R_TYPE (rel->r_info);
   dynobj = elf_hash_table (info)->dynobj;
-  sreloc 
+  sreloc
     = bfd_get_section_by_name (dynobj,
 			       MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd));
   BFD_ASSERT (sreloc != NULL);
+  BFD_ASSERT (sreloc->contents != NULL);
 
   skip = false;
 
@@ -5609,7 +5786,7 @@
 	 Because we compress stab information, the offset given in the
 	 relocation may not be the one we want; we must let the stabs
 	 machinery tell us the offset.  */
-      outrel.r_offset 
+      outrel.r_offset
 	= (_bfd_stab_section_offset
 	   (output_bfd, &elf_hash_table (info)->stab_info,
 	    input_section,
@@ -5621,7 +5798,7 @@
 	skip = true;
     }
 
-  /* If we've decided to skip this relocation, just output an emtpy
+  /* If we've decided to skip this relocation, just output an empty
      record.  Note that R_MIPS_NONE == 0, so that this call to memset
      is a way of setting R_TYPE to R_MIPS_NONE.  */
   if (skip)
@@ -5638,7 +5815,10 @@
 				   & ELF_LINK_HASH_DEF_REGULAR) == 0))
 	{
 	  indx = h->root.dynindx;
-	  BFD_ASSERT (indx != -1);
+	  /* h->root.dynindx may be -1 if this symbol was marked to
+	     become local.  */
+	  if (indx == -1)
+	    indx = 0;
 	}
       else
 	{
@@ -5666,11 +5846,11 @@
 	  /* Now, the relocation is just against the section.  */
 	  symbol = sec->output_section->vma;
 	}
-      
-      /* If the relocation was previously an absolute relocation, we
-	 must adjust it by the value we give it in the dynamic symbol
-	 table.  */
-      if (r_type != R_MIPS_REL32)
+
+      /* If the relocation is against a local symbol was previously an
+	 absolute relocation, we must adjust it by the value we give
+	 it in the dynamic symbol table.  */
+      if (local_p && r_type != R_MIPS_REL32)
 	*addendp += symbol;
 
       /* The relocation is always an REL32 relocation because we don't
@@ -5690,7 +5870,7 @@
     {
       (*get_elf_backend_data (output_bfd)->s->swap_reloc_out)
 	(output_bfd, &outrel,
-	 (sreloc->contents 
+	 (sreloc->contents
 	  + sreloc->reloc_count * sizeof (Elf64_Mips_External_Rel)));
     }
   else
@@ -5702,7 +5882,7 @@
   /* Record the index of the first relocation referencing H.  This
      information is later emitted in the .msym section.  */
   if (h != NULL
-      && (h->min_dyn_reloc_index == 0 
+      && (h->min_dyn_reloc_index == 0
 	  || sreloc->reloc_count < h->min_dyn_reloc_index))
     h->min_dyn_reloc_index = sreloc->reloc_count;
 
@@ -5717,7 +5897,7 @@
   /* On IRIX5, make an entry of compact relocation info.  */
   if (! skip && IRIX_COMPAT (output_bfd) == ict_irix5)
     {
-      asection* scpt = bfd_get_section_by_name (dynobj, ".compact_rel");
+      asection *scpt = bfd_get_section_by_name (dynobj, ".compact_rel");
       bfd_byte *cr;
 
       if (scpt)
@@ -5761,7 +5941,7 @@
    overflow occurs, and bfd_reloc_ok to indicate success.  */
 
 static bfd_reloc_status_type
-mips_elf_calculate_relocation (abfd, 
+mips_elf_calculate_relocation (abfd,
 			       input_bfd,
 			       input_section,
 			       info,
@@ -5772,7 +5952,7 @@
 			       local_sections,
 			       valuep,
 			       namep,
-			       require_jalxp) 
+			       require_jalxp)
      bfd *abfd;
      bfd *input_bfd;
      asection *input_section;
@@ -5806,7 +5986,7 @@
   /* The section in which the symbol referenced by the relocation is
      located.  */
   asection *sec = NULL;
-  struct mips_elf_link_hash_entry* h = NULL;
+  struct mips_elf_link_hash_entry *h = NULL;
   /* True if the symbol referred to by this relocation is a local
      symbol.  */
   boolean local_p;
@@ -5825,7 +6005,7 @@
   /* Parse the relocation.  */
   r_symndx = ELF32_R_SYM (relocation->r_info);
   r_type = ELF32_R_TYPE (relocation->r_info);
-  p = (input_section->output_section->vma 
+  p = (input_section->output_section->vma
        + input_section->output_offset
        + relocation->r_offset);
 
@@ -5836,7 +6016,7 @@
      used in the array of hash table entries.  */
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
   local_p = mips_elf_local_relocation_p (input_bfd, relocation,
-					 local_sections);
+					 local_sections, false);
   if (! elf_bad_symtab (input_bfd))
     extsymoff = symtab_hdr->sh_info;
   else
@@ -5845,7 +6025,7 @@
 	 must come before globals.  */
       extsymoff = 0;
     }
-      
+
   /* Figure out the value of the symbol.  */
   if (local_p)
     {
@@ -5874,13 +6054,13 @@
   else
     {
       /* For global symbols we look up the symbol in the hash-table.  */
-      h = ((struct mips_elf_link_hash_entry *) 
+      h = ((struct mips_elf_link_hash_entry *)
 	   elf_sym_hashes (input_bfd) [r_symndx - extsymoff]);
       /* Find the real hash-table entry for this symbol.  */
-      while (h->root.type == bfd_link_hash_indirect
-	     || h->root.type == bfd_link_hash_warning)
+      while (h->root.root.type == bfd_link_hash_indirect
+	     || h->root.root.type == bfd_link_hash_warning)
 	h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link;
-      
+
       /* Record the name of this symbol, for our caller.  */
       *namep = h->root.root.root.string;
 
@@ -5905,7 +6085,7 @@
 	{
 	  sec = h->root.root.u.def.section;
 	  if (sec->output_section)
-	    symbol = (h->root.root.u.def.value 
+	    symbol = (h->root.root.u.def.value
 		      + sec->output_section->vma
 		      + sec->output_offset);
 	  else
@@ -5920,10 +6100,12 @@
       else if (info->shared && !info->symbolic && !info->no_undefined
 	       && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT)
 	symbol = 0;
-      else if (strcmp (h->root.root.root.string, "_DYNAMIC_LINK") == 0)
+      else if (strcmp (h->root.root.root.string, "_DYNAMIC_LINK") == 0 ||
+              strcmp (h->root.root.root.string, "_DYNAMIC_LINKING") == 0)
 	{
 	  /* If this is a dynamic link, we should have created a
-	     _DYNAMIC_LINK symbol in mips_elf_create_dynamic_sections.
+	     _DYNAMIC_LINK symbol or _DYNAMIC_LINKING(for normal mips) symbol
+	     in in mips_elf_create_dynamic_sections.
 	     Otherwise, we should define the symbol with a value of 0.
 	     FIXME: It should probably get into the symbol table
 	     somehow as well.  */
@@ -5944,7 +6126,7 @@
 
       target_is_16_bit_code_p = (h->root.other == STO_MIPS16);
     }
-  
+
   /* If this is a 32-bit call to a 16-bit function with a stub, we
      need to redirect the call to the stub, unless we're already *in*
      a stub.  */
@@ -5970,7 +6152,7 @@
   /* If this is a 16-bit call to a 32-bit function with a stub, we
      need to redirect the call to the stub.  */
   else if (r_type == R_MIPS16_26 && !info->relocateable
-	   && h != NULL 
+	   && h != NULL
 	   && (h->call_stub != NULL || h->call_fp_stub != NULL)
 	   && !target_is_16_bit_code_p)
     {
@@ -6008,6 +6190,9 @@
   *require_jalxp = (!info->relocateable
 		    && ((r_type == R_MIPS16_26) != target_is_16_bit_code_p));
 
+  local_p = mips_elf_local_relocation_p (input_bfd, relocation,
+					 local_sections, true);
+
   /* If we haven't already determined the GOT offset, or the GP value,
      and we're going to need it, get it now.  */
   switch (r_type)
@@ -6023,9 +6208,22 @@
       if (!local_p)
 	{
 	  BFD_ASSERT (addend == 0);
-	  g = mips_elf_global_got_index 
+	  g = mips_elf_global_got_index
 	    (elf_hash_table (info)->dynobj,
-	     (struct elf_link_hash_entry*) h);
+	     (struct elf_link_hash_entry *) h);
+	  if (! elf_hash_table(info)->dynamic_sections_created
+	      || (info->shared
+		  && (info->symbolic || h->root.dynindx == -1)
+		  && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+	    {
+	      /* This is a static link or a -Bsymbolic link.  The
+		 symbol is defined locally, or was forced to be local.
+		 We must initialize this entry in the GOT.  */
+	      asection *sgot = mips_elf_got_section(elf_hash_table
+						    (info)->dynobj);
+	      MIPS_ELF_PUT_WORD (elf_hash_table (info)->dynobj,
+				 symbol + addend, sgot->contents + g);
+	    }
 	}
       else if (r_type == R_MIPS_GOT16)
 	/* There's no need to create a local GOT entry here; the
@@ -6042,7 +6240,7 @@
       g = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
 					  abfd, g);
       break;
-      
+
     case R_MIPS_HI16:
     case R_MIPS_LO16:
     case R_MIPS_GPREL16:
@@ -6073,8 +6271,8 @@
       if ((info->shared
 	   || (elf_hash_table (info)->dynamic_sections_created
 	       && h != NULL
-	       && ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)
-		   == 0)))
+	       && ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
+		   != 0)))
 	  && (input_section->flags & SEC_ALLOC) != 0)
 	{
 	  /* If we're creating a shared library, or this relocation is
@@ -6083,14 +6281,14 @@
 	     record in the output, and leave the job up to the dynamic
 	     linker.  */
 	  value = addend;
-	  if (!mips_elf_create_dynamic_relocation (abfd, 
-						   info, 
+	  if (!mips_elf_create_dynamic_relocation (abfd,
+						   info,
 						   relocation,
 						   h,
 						   sec,
 						   symbol,
 						   &value,
-						   input_section))
+						   input_section, local_p))
 	    return false;
 	}
       else
@@ -6193,14 +6391,21 @@
 	value = mips_elf_sign_extend (addend, 16) + symbol - gp;
       overflowed_p = mips_elf_overflow_p (value, 16);
       break;
-      
+
     case R_MIPS_GOT16:
       if (local_p)
 	{
-	  value = mips_elf_got16_entry (abfd, info, symbol + addend);
+	  boolean forced;
+
+	  /* The special case is when the symbol is forced to be local.  We
+	     need the full address in the GOT since no R_MIPS_LO16 relocation
+	     follows.  */
+	  forced = ! mips_elf_local_relocation_p (input_bfd, relocation,
+						  local_sections, false);
+	  value = mips_elf_got16_entry (abfd, info, symbol + addend, forced);
 	  if (value == (bfd_vma) -1)
 	    return false;
-	  value 
+	  value
 	    = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj,
 					      abfd,
 					      value);
@@ -6250,7 +6455,7 @@
 					      value);
       overflowed_p = mips_elf_overflow_p (value, 16);
       break;
-      
+
     case R_MIPS_GOT_OFST:
       mips_elf_got_page (abfd, info, symbol + addend, &value);
       overflowed_p = mips_elf_overflow_p (value, 16);
@@ -6270,7 +6475,7 @@
       value = mips_elf_highest (addend + symbol);
       value &= howto->dst_mask;
       break;
-      
+
     case R_MIPS_SCN_DISP:
       value = symbol + addend - sec->output_offset;
       value &= howto->dst_mask;
@@ -6333,7 +6538,7 @@
 
 static boolean
 mips_elf_perform_relocation (info, howto, relocation, value,
-			     input_bfd, input_section, 
+			     input_bfd, input_section,
 			     contents, require_jalx)
      struct bfd_link_info *info;
      reloc_howto_type *howto;
@@ -6372,7 +6577,7 @@
 	 +--------------+--------------------------------+
 	 !	  	  Immediate  15:0		    !
 	 +-----------------------------------------------+
-	 
+
 	 JALX is the 5-bit value 00011.  X is 0 for jal, 1 for jalx.
 	 Note that the immediate value in the first word is swapped.
 
@@ -6397,14 +6602,14 @@
 
 	 To put it in MIPS ABI terms, the relocation field is T-targ26-16,
 	 defined as
-	 
+
 	 big-endian:
 	 +--------+----------------------+
 	 |        |                      |
 	 |        |    targ26-16         |
 	 |31    26|25                   0|
 	 +--------+----------------------+
-	 
+
 	 little-endian:
 	 +----------+------+-------------+
 	 |          |      |             |
@@ -6413,7 +6618,7 @@
 	 +----------+--------------------+
 	 where targ26-16 is sub1 followed by sub2 (i.e., the addend field A is
 	 ((sub1 << 16) | sub2)).
-	 
+
 	 When producing a relocateable object file, the calculation is
 	 (((A < 2) | (P & 0xf0000000) + S) >> 2)
 	 When producing a fully linked file, the calculation is
@@ -6422,10 +6627,9 @@
 
       if (!info->relocateable)
 	/* Shuffle the bits according to the formula above.  */
-	value = (((value & 0x1f0000) << 5) 
-		 | ((value & 0x3e00000) >> 5) 
+	value = (((value & 0x1f0000) << 5)
+		 | ((value & 0x3e00000) >> 5)
 		 | (value & 0xffff));
-      
     }
   else if (r_type == R_MIPS16_GPREL)
     {
@@ -6437,13 +6641,13 @@
 	 +--------------+--------------------------------+
 	 !    Major     !   rx   !   ry   !   Imm  4:0   !
 	 +--------------+--------------------------------+
-	 
+
 	 EXTEND is the five bit value 11110.  Major is the instruction
 	 opcode.
-	 
+
 	 This is handled exactly like R_MIPS_GPREL16, except that the
 	 addend is retrieved and stored as shown in this diagram; that
-	 is, the Imm fields above replace the V-rel16 field.  
+	 is, the Imm fields above replace the V-rel16 field.
 
          All we need to do here is shuffle the bits appropriately.  As
 	 above, the two 16-bit halves must be swapped on a
@@ -6496,7 +6700,7 @@
   if ((r_type == R_MIPS16_GPREL || r_type == R_MIPS16_26)
       && bfd_little_endian (input_bfd))
     x = (((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16));
-  
+
   /* Put the value into the output.  */
   bfd_put (8 * bfd_get_reloc_size (howto), input_bfd, x, location);
   return true;
@@ -6553,7 +6757,7 @@
       if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd))
 	{
 	  /* Some 32-bit code uses R_MIPS_64.  In particular, people use
-	     64-bit code, but make sure all their addresses are in the 
+	     64-bit code, but make sure all their addresses are in the
 	     lowermost or uppermost 32-bit section of the 64-bit address
 	     space.  Thus, when they use an R_MIPS_64 they mean what is
 	     usually meant by R_MIPS_32, with the exception that the
@@ -6563,7 +6767,7 @@
 	  /* On big-endian systems, we need to lie about the position
 	     of the reloc.  */
 	  if (bfd_big_endian (input_bfd))
-	      rel->r_offset += 4;
+	    rel->r_offset += 4;
 	}
       else
 	howto = mips_rtype_to_howto (r_type);
@@ -6589,7 +6793,7 @@
 	      rela_relocation_p = false;
 
 	      /* Get the addend, which is stored in the input file.  */
-	      addend = mips_elf_obtain_contents (howto, 
+	      addend = mips_elf_obtain_contents (howto,
 						 rel,
 						 input_bfd,
 						 contents);
@@ -6602,7 +6806,7 @@
 		  || r_type == R_MIPS_GNU_REL_HI16
 		  || (r_type == R_MIPS_GOT16
 		      && mips_elf_local_relocation_p (input_bfd, rel,
-						      local_sections)))
+						      local_sections, false)))
 		{
 		  bfd_vma l;
 		  const Elf_Internal_Rela *lo16_relocation;
@@ -6613,15 +6817,15 @@
 		     left-shifted by sixteen bits, and the LO16
 		     addend, sign extended.  (Usually, the code does
 		     a `lui' of the HI16 value, and then an `addiu' of
-		     the LO16 value.)  
+		     the LO16 value.)
 
 		     Scan ahead to find a matching LO16 relocation.  */
 		  if (r_type == R_MIPS_GNU_REL_HI16)
 		    lo = R_MIPS_GNU_REL_LO16;
 		  else
 		    lo = R_MIPS_LO16;
-		  lo16_relocation 
-		    = mips_elf_next_relocation (lo, rel, relend); 
+		  lo16_relocation
+		    = mips_elf_next_relocation (lo, rel, relend);
 		  if (lo16_relocation == NULL)
 		    return false;
 
@@ -6668,11 +6872,12 @@
 	     relative in which case we need to adjust by the amount
 	     that we're adjusting GP in this relocateable object.  */
 
-	  if (!mips_elf_local_relocation_p (input_bfd, rel, local_sections))
+	  if (!mips_elf_local_relocation_p (input_bfd, rel, local_sections,
+					    false))
 	    /* There's nothing to do for non-local relocations.  */
 	    continue;
 
-	  if (r_type == R_MIPS16_GPREL 
+	  if (r_type == R_MIPS16_GPREL
 	      || r_type == R_MIPS_GPREL16
 	      || r_type == R_MIPS_GPREL32
 	      || r_type == R_MIPS_LITERAL)
@@ -6691,7 +6896,7 @@
 	  if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
 	    /* Adjust the addend appropriately.  */
 	    addend += local_sections[r_symndx]->output_offset;
-	  
+
 	  /* If the relocation is for a R_MIPS_HI16 or R_MIPS_GOT16,
 	     then we only want to write out the high-order 16 bits.
 	     The subsequent R_MIPS_LO16 will handle the low-order bits.  */
@@ -6727,12 +6932,12 @@
 		  bfd_vma sign_bits;
 		  bfd_vma low_bits;
 		  bfd_vma high_bits;
-		  
+
 		  if (addend & ((bfd_vma) 1 << 31))
 		    sign_bits = ((bfd_vma) 1 << 32) - 1;
 		  else
 		    sign_bits = 0;
-		  
+
 		  /* If we don't know that we have a 64-bit type,
 		     do two separate stores.  */
 		  if (bfd_big_endian (input_bfd))
@@ -6747,15 +6952,15 @@
 		      low_bits = addend;
 		      high_bits = sign_bits;
 		    }
-		  bfd_put_32 (input_bfd, low_bits, 
+		  bfd_put_32 (input_bfd, low_bits,
 			      contents + rel->r_offset);
-		  bfd_put_32 (input_bfd, high_bits, 
+		  bfd_put_32 (input_bfd, high_bits,
 			      contents + rel->r_offset + 4);
 		  continue;
 		}
 
 	      if (!mips_elf_perform_relocation (info, howto, rel, addend,
-						input_bfd,  input_section, 
+						input_bfd,  input_section,
 						contents, false))
 		return false;
 	    }
@@ -6768,7 +6973,7 @@
 	 relocations for the same offset.  In that case we are
 	 supposed to treat the output of each relocation as the addend
 	 for the next.  */
-      if (rel + 1 < relend 
+      if (rel + 1 < relend
 	  && rel->r_offset == rel[1].r_offset
 	  && ELF32_R_TYPE (rel[1].r_info) != R_MIPS_NONE)
 	use_saved_addend_p = true;
@@ -6776,7 +6981,7 @@
 	use_saved_addend_p = false;
 
       /* Figure out what value we are supposed to relocate.  */
-      switch (mips_elf_calculate_relocation (output_bfd, 
+      switch (mips_elf_calculate_relocation (output_bfd,
 					     input_bfd,
 					     input_section,
 					     info,
@@ -6869,15 +7074,15 @@
 	      low_bits = value;
 	      high_bits = sign_bits;
 	    }
-	  bfd_put_32 (input_bfd, low_bits, 
+	  bfd_put_32 (input_bfd, low_bits,
 		      contents + rel->r_offset);
-	  bfd_put_32 (input_bfd, high_bits, 
+	  bfd_put_32 (input_bfd, high_bits,
 		      contents + rel->r_offset + 4);
 	  continue;
 	}
 
       /* Actually perform the relocation.  */
-      if (!mips_elf_perform_relocation (info, howto, rel, value, input_bfd, 
+      if (!mips_elf_perform_relocation (info, howto, rel, value, input_bfd,
 					input_section, contents,
 					require_jalx))
 	return false;
@@ -6890,7 +7095,6 @@
    symbol.  We mark symbols as small common if appropriate.  This is
    also where we undo the increment of the value for a mips16 symbol.  */
 
-/*ARGSIGNORED*/
 boolean
 _bfd_mips_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -6956,9 +7160,9 @@
   if (IRIX_COMPAT (abfd) == ict_irix6
       && !mips_elf_create_msym_section (abfd))
     return false;
-  
+
   /* Create .stub section.  */
-  if (bfd_get_section_by_name (abfd, 
+  if (bfd_get_section_by_name (abfd,
 			       MIPS_ELF_STUB_SECTION_NAME (abfd)) == NULL)
     {
       s = bfd_make_section (abfd, MIPS_ELF_STUB_SECTION_NAME (abfd));
@@ -6969,7 +7173,7 @@
 	return false;
     }
 
-  if (IRIX_COMPAT (abfd) == ict_irix5
+  if ((IRIX_COMPAT (abfd) == ict_irix5 || IRIX_COMPAT (abfd) == ict_none)
       && !info->shared
       && bfd_get_section_by_name (abfd, ".rld_map") == NULL)
     {
@@ -6996,7 +7200,7 @@
 		  get_elf_backend_data (abfd)->collect,
 		  (struct bfd_link_hash_entry **) &h)))
 	    return false;
-	  h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+	  h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
 	  h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
 	  h->type = STT_SECTION;
 
@@ -7005,8 +7209,11 @@
 	}
 
       /* We need to create a .compact_rel section.  */
-      if (! mips_elf_create_compact_rel_section (abfd, info))
-	return false;
+      if (SGI_COMPAT (abfd))
+	{
+	  if (!mips_elf_create_compact_rel_section (abfd, info))
+	    return false;
+	}
 
       /* Change aligments of some sections.  */
       s = bfd_get_section_by_name (abfd, ".hash");
@@ -7029,13 +7236,26 @@
   if (!info->shared)
     {
       h = NULL;
-      if (! (_bfd_generic_link_add_one_symbol
-	     (info, abfd, "_DYNAMIC_LINK", BSF_GLOBAL, bfd_abs_section_ptr,
-	      (bfd_vma) 0, (const char *) NULL, false,
-	      get_elf_backend_data (abfd)->collect,
-	      (struct bfd_link_hash_entry **) &h)))
-	return false;
-      h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+      if (SGI_COMPAT (abfd))
+	{
+	  if (!(_bfd_generic_link_add_one_symbol
+		(info, abfd, "_DYNAMIC_LINK", BSF_GLOBAL, bfd_abs_section_ptr,
+		 (bfd_vma) 0, (const char *) NULL, false,
+		 get_elf_backend_data (abfd)->collect,
+		 (struct bfd_link_hash_entry **) &h)))
+	    return false;
+	}
+      else
+	{
+	  /* For normal mips it is _DYNAMIC_LINKING.  */
+	  if (!(_bfd_generic_link_add_one_symbol
+		(info, abfd, "_DYNAMIC_LINKING", BSF_GLOBAL,
+		 bfd_abs_section_ptr, (bfd_vma) 0, (const char *) NULL, false,
+		 get_elf_backend_data (abfd)->collect,
+		 (struct bfd_link_hash_entry **) &h)))
+	    return false;
+	}
+      h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
       h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
       h->type = STT_SECTION;
 
@@ -7052,13 +7272,26 @@
 	  BFD_ASSERT (s != NULL);
 
 	  h = NULL;
-	  if (! (_bfd_generic_link_add_one_symbol
-		 (info, abfd, "__rld_map", BSF_GLOBAL, s,
-		  (bfd_vma) 0, (const char *) NULL, false,
-		  get_elf_backend_data (abfd)->collect,
-		  (struct bfd_link_hash_entry **) &h)))
-	    return false;
-	  h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+	  if (SGI_COMPAT (abfd))
+	    {
+	      if (!(_bfd_generic_link_add_one_symbol
+		    (info, abfd, "__rld_map", BSF_GLOBAL, s,
+		     (bfd_vma) 0, (const char *) NULL, false,
+		     get_elf_backend_data (abfd)->collect,
+		     (struct bfd_link_hash_entry **) &h)))
+		return false;
+	    }
+	  else
+	    {
+	      /* For normal mips the symbol is __RLD_MAP.  */
+	      if (!(_bfd_generic_link_add_one_symbol
+		    (info, abfd, "__RLD_MAP", BSF_GLOBAL, s,
+		     (bfd_vma) 0, (const char *) NULL, false,
+		     get_elf_backend_data (abfd)->collect,
+		     (struct bfd_link_hash_entry **) &h)))
+		return false;
+	    }
+	  h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
 	  h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
 	  h->type = STT_OBJECT;
 
@@ -7098,7 +7331,7 @@
   return true;
 }
 
-/* Create the .got section to hold the global offset table. */
+/* Create the .got section to hold the global offset table.  */
 
 static boolean
 mips_elf_create_got_section (abfd, info)
@@ -7133,7 +7366,7 @@
 	  get_elf_backend_data (abfd)->collect,
 	  (struct bfd_link_hash_entry **) &h)))
     return false;
-  h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+  h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
   h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
   h->type = STT_OBJECT;
 
@@ -7159,7 +7392,7 @@
 	return false;
     }
   elf_section_data (s)->tdata = (PTR) g;
-  elf_section_data (s)->this_hdr.sh_flags 
+  elf_section_data (s)->this_hdr.sh_flags
     |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
 
   return true;
@@ -7175,15 +7408,15 @@
   asection *s;
 
   s = bfd_get_section_by_name (abfd, MIPS_ELF_MSYM_SECTION_NAME (abfd));
-  if (!s) 
+  if (!s)
     {
       s = bfd_make_section (abfd, MIPS_ELF_MSYM_SECTION_NAME (abfd));
       if (!s
-	  || !bfd_set_section_flags (abfd, s, 
+	  || !bfd_set_section_flags (abfd, s,
 				     SEC_ALLOC
 				     | SEC_LOAD
 				     | SEC_HAS_CONTENTS
-				     | SEC_LINKER_CREATED 
+				     | SEC_LINKER_CREATED
 				     | SEC_READONLY)
 	  || !bfd_set_section_alignment (abfd, s,
 					 MIPS_ELF_LOG_FILE_ALIGN (abfd)))
@@ -7204,10 +7437,10 @@
 
   s = bfd_get_section_by_name (abfd, MIPS_ELF_REL_DYN_SECTION_NAME (abfd));
   BFD_ASSERT (s != NULL);
-  
+
   if (s->_raw_size == 0)
     {
-      /* Make room for a null element. */
+      /* Make room for a null element.  */
       s->_raw_size += MIPS_ELF_REL_SIZE (abfd);
       ++s->reloc_count;
     }
@@ -7312,7 +7545,7 @@
 	    }
 
 	  /* Record this stub in an array of local symbol stubs for
-             this BFD. */
+             this BFD.  */
 	  if (elf_tdata (abfd)->local_stubs == NULL)
 	    {
 	      unsigned long symcount;
@@ -7434,6 +7667,13 @@
 
       if (r_symndx < extsymoff)
 	h = NULL;
+      else if (r_symndx >= extsymoff + (symtab_hdr->sh_size / symtab_hdr->sh_entsize))
+	{
+	  (*_bfd_error_handler)
+	    (_("Malformed reloc detected for section %s"), name);
+	  bfd_set_error (bfd_error_bad_value);
+	  return false;
+	}
       else
 	{
 	  h = sym_hashes[r_symndx - extsymoff];
@@ -7581,7 +7821,7 @@
 		  hmips = (struct mips_elf_link_hash_entry *) h;
 		  ++hmips->possibly_dynamic_relocs;
 		}
-	     
+
 	      /* Even though we don't directly need a GOT entry for
 		 this symbol, a symbol must have a dynamic symbol
 		 table index greater that DT_MIPS_GOTSYM if there are
@@ -7591,7 +7831,7 @@
 		return false;
 	    }
 
-	  if (SGI_COMPAT (dynobj))
+	  if (SGI_COMPAT (abfd))
 	    mips_elf_hash_table (info)->compact_rel_size +=
 	      sizeof (Elf32_External_crinfo);
 	  break;
@@ -7600,7 +7840,7 @@
 	case R_MIPS_GPREL16:
 	case R_MIPS_LITERAL:
 	case R_MIPS_GPREL32:
-	  if (SGI_COMPAT (dynobj))
+	  if (SGI_COMPAT (abfd))
 	    mips_elf_hash_table (info)->compact_rel_size +=
 	      sizeof (Elf32_External_crinfo);
 	  break;
@@ -7625,7 +7865,7 @@
 
       /* If this reloc is not a 16 bit call, and it has a global
          symbol, then we will need the fn_stub if there is one.
-         References from a stub section do not count. */
+         References from a stub section do not count.  */
       if (h != NULL
 	  && r_type != R_MIPS16_26
 	  && strncmp (bfd_get_section_name (abfd, sec), FN_STUB,
@@ -7729,7 +7969,7 @@
 	/* ??? It would seem that the existing MIPS code does no sort
 	   of reference counting or whatnot on its GOT and PLT entries,
 	   so it is not possible to garbage collect them at this time.  */
-        break;
+	break;
 
       default:
 	break;
@@ -7739,6 +7979,26 @@
   return true;
 }
 
+/* Copy data from a MIPS ELF indirect symbol to its direct symbol,
+   hiding the old indirect symbol.  Process additional relocation
+   information.  */
+
+void
+_bfd_mips_elf_copy_indirect_symbol (dir, ind)
+     struct elf_link_hash_entry *dir, *ind;
+{
+  struct mips_elf_link_hash_entry *dirmips, *indmips;
+
+  _bfd_elf_link_hash_copy_indirect (dir, ind);
+
+  dirmips = (struct mips_elf_link_hash_entry *) dir;
+  indmips = (struct mips_elf_link_hash_entry *) ind;
+  dirmips->possibly_dynamic_relocs += indmips->possibly_dynamic_relocs;
+  if (dirmips->min_dyn_reloc_index == 0
+      || (indmips->min_dyn_reloc_index != 0
+	  && indmips->min_dyn_reloc_index < dirmips->min_dyn_reloc_index))
+    dirmips->min_dyn_reloc_index = indmips->min_dyn_reloc_index;
+}
 
 /* Adjust a symbol defined by a dynamic object and referenced by a
    regular object.  The current definition is in some section of the
@@ -7775,12 +8035,11 @@
   if (! info->relocateable
       && hmips->possibly_dynamic_relocs != 0
       && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
-    mips_elf_allocate_dynamic_relocations (dynobj, 
+    mips_elf_allocate_dynamic_relocations (dynobj,
 					   hmips->possibly_dynamic_relocs);
 
-  /* For a function, create a stub, if needed. */
-  if (h->type == STT_FUNC
-      || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
+  /* For a function, create a stub, if needed.  */
+  if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
     {
       if (! elf_hash_table (info)->dynamic_sections_created)
 	return true;
@@ -7792,7 +8051,7 @@
       if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
 	{
 	  /* We need .stub section.  */
-	  s = bfd_get_section_by_name (dynobj, 
+	  s = bfd_get_section_by_name (dynobj,
 				       MIPS_ELF_STUB_SECTION_NAME (dynobj));
 	  BFD_ASSERT (s != NULL);
 
@@ -7810,6 +8069,14 @@
 	  return true;
 	}
     }
+  else if ((h->type == STT_FUNC)
+	   && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0)
+    {
+      /* This will set the entry for this symbol in the GOT to 0, and
+         the dynamic linker will take care of this.  */
+      h->root.u.def.value = 0;
+      return true;
+    }
 
   /* If this is a weak symbol, and there is a real definition, the
      processor independent code will have arranged for us to see the
@@ -7862,7 +8129,6 @@
 /* Check the mips16 stubs for a particular symbol, and see if we can
    discard them.  */
 
-/*ARGSUSED*/
 static boolean
 mips_elf_check_mips16_stubs (h, data)
      struct mips_elf_link_hash_entry *h;
@@ -7876,7 +8142,7 @@
          being included in the link.  */
       h->fn_stub->_raw_size = 0;
       h->fn_stub->_cooked_size = 0;
-      h->fn_stub->flags &= ~ SEC_RELOC;
+      h->fn_stub->flags &= ~SEC_RELOC;
       h->fn_stub->reloc_count = 0;
       h->fn_stub->flags |= SEC_EXCLUDE;
     }
@@ -7889,7 +8155,7 @@
          to 0 to prevent it from being included in the link.  */
       h->call_stub->_raw_size = 0;
       h->call_stub->_cooked_size = 0;
-      h->call_stub->flags &= ~ SEC_RELOC;
+      h->call_stub->flags &= ~SEC_RELOC;
       h->call_stub->reloc_count = 0;
       h->call_stub->flags |= SEC_EXCLUDE;
     }
@@ -7902,7 +8168,7 @@
          to 0 to prevent it from being included in the link.  */
       h->call_fp_stub->_raw_size = 0;
       h->call_fp_stub->_cooked_size = 0;
-      h->call_fp_stub->flags &= ~ SEC_RELOC;
+      h->call_fp_stub->flags &= ~SEC_RELOC;
       h->call_fp_stub->reloc_count = 0;
       h->call_fp_stub->flags |= SEC_EXCLUDE;
     }
@@ -7932,9 +8198,9 @@
 	{
 	  s = bfd_get_section_by_name (dynobj, ".interp");
 	  BFD_ASSERT (s != NULL);
-	  s->_raw_size 
+	  s->_raw_size
 	    = strlen (ELF_DYNAMIC_INTERPRETER (output_bfd)) + 1;
-	  s->contents 
+	  s->contents
 	    = (bfd_byte *) ELF_DYNAMIC_INTERPRETER (output_bfd);
 	}
     }
@@ -7989,13 +8255,13 @@
 	      if ((target != NULL
 		   && (target->flags & SEC_READONLY) != 0
 		   && (target->flags & SEC_ALLOC) != 0)
-		  || strcmp (outname, 
+		  || strcmp (outname,
 			     MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)) == 0)
 		reltext = true;
 
 	      /* We use the reloc_count field as a counter if we need
 		 to copy relocs into the output file.  */
-	      if (strcmp (name, 
+	      if (strcmp (name,
 			  MIPS_ELF_REL_DYN_SECTION_NAME (output_bfd)) != 0)
 		s->reloc_count = 0;
 	    }
@@ -8003,49 +8269,49 @@
       else if (strncmp (name, ".got", 4) == 0)
 	{
 	  int i;
- 	  bfd_size_type loadable_size = 0;
- 	  bfd_size_type local_gotno;
- 	  struct _bfd *sub;
+	  bfd_size_type loadable_size = 0;
+	  bfd_size_type local_gotno;
+	  struct _bfd *sub;
 
- 	  BFD_ASSERT (elf_section_data (s) != NULL);
+	  BFD_ASSERT (elf_section_data (s) != NULL);
 	  g = (struct mips_got_info *) elf_section_data (s)->tdata;
- 	  BFD_ASSERT (g != NULL);
+	  BFD_ASSERT (g != NULL);
 
- 	  /* Calculate the total loadable size of the output.  That
- 	     will give us the maximum number of GOT_PAGE entries
- 	     required.  */
- 	  for (sub = info->input_bfds; sub; sub = sub->link_next)
- 	    {
- 	      asection *subsection;
- 
- 	      for (subsection = sub->sections; 
- 		   subsection; 
- 		   subsection = subsection->next)
- 		{
- 		  if ((subsection->flags & SEC_ALLOC) == 0)
- 		    continue;
- 		  loadable_size += (subsection->_raw_size + 0xf) & ~0xf;
- 		}
- 	    }
- 	  loadable_size += MIPS_FUNCTION_STUB_SIZE;
+	  /* Calculate the total loadable size of the output.  That
+	     will give us the maximum number of GOT_PAGE entries
+	     required.  */
+	  for (sub = info->input_bfds; sub; sub = sub->link_next)
+	    {
+	      asection *subsection;
 
- 	  /* Assume there are two loadable segments consisting of
- 	     contiguous sections.  Is 5 enough?  */
- 	  local_gotno = (loadable_size >> 16) + 5;
+	      for (subsection = sub->sections;
+		   subsection;
+		   subsection = subsection->next)
+		{
+		  if ((subsection->flags & SEC_ALLOC) == 0)
+		    continue;
+		  loadable_size += (subsection->_raw_size + 0xf) & ~0xf;
+		}
+	    }
+	  loadable_size += MIPS_FUNCTION_STUB_SIZE;
+
+	  /* Assume there are two loadable segments consisting of
+	     contiguous sections.  Is 5 enough?  */
+	  local_gotno = (loadable_size >> 16) + 5;
 	  if (IRIX_COMPAT (output_bfd) == ict_irix6)
 	    /* It's possible we will need GOT_PAGE entries as well as
 	       GOT16 entries.  Often, these will be able to share GOT
 	       entries, but not always.  */
 	    local_gotno *= 2;
 
- 	  g->local_gotno += local_gotno;
- 	  s->_raw_size += local_gotno * MIPS_ELF_GOT_SIZE (dynobj);
+	  g->local_gotno += local_gotno;
+	  s->_raw_size += local_gotno * MIPS_ELF_GOT_SIZE (dynobj);
 
- 	  /* There has to be a global GOT entry for every symbol with
- 	     a dynamic symbol table index of DT_MIPS_GOTSYM or
- 	     higher.  Therefore, it make sense to put those symbols
- 	     that need GOT entries at the end of the symbol table.  We
- 	     do that here.  */
+	  /* There has to be a global GOT entry for every symbol with
+	     a dynamic symbol table index of DT_MIPS_GOTSYM or
+	     higher.  Therefore, it make sense to put those symbols
+	     that need GOT entries at the end of the symbol table.  We
+	     do that here.  */
  	  if (!mips_elf_sort_hash_table (info, 1))
  	    return false;
 
@@ -8077,7 +8343,7 @@
 	s->_raw_size += mips_elf_hash_table (info)->compact_rel_size;
       else if (strcmp (name, MIPS_ELF_MSYM_SECTION_NAME (output_bfd))
 	       == 0)
-	s->_raw_size = (sizeof (Elf32_External_Msym) 
+	s->_raw_size = (sizeof (Elf32_External_Msym)
 			* (elf_hash_table (info)->dynsymcount
 			   + bfd_count_sections (output_bfd)));
       else if (strncmp (name, ".init", 5) != 0)
@@ -8110,22 +8376,30 @@
 	 dynamic linker and used by the debugger.  */
       if (! info->shared)
 	{
-	  if (SGI_COMPAT (output_bfd))
+	  /* SGI object has the equivalence of DT_DEBUG in the
+	     DT_MIPS_RLD_MAP entry.  */
+	  if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
+	    return false;
+	  if (!SGI_COMPAT (output_bfd))
 	    {
-	      /* SGI object has the equivalence of DT_DEBUG in the
-		 DT_MIPS_RLD_MAP entry.  */
-	      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
+	      if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
 		return false;
 	    }
-	  else
-	    if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
-	      return false;
 	}
-
-      if (reltext)
+      else
+	{
+	  /* Shared libraries on traditional mips have DT_DEBUG.  */
+	  if (!SGI_COMPAT (output_bfd))
+	    {
+	      if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
+		return false;
+	    }
+	}
+      if (reltext && SGI_COMPAT (output_bfd))
 	{
 	  if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
 
       if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTGOT, 0))
@@ -8144,11 +8418,17 @@
 	    return false;
 	}
 
-      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICTNO, 0))
-	return false;
+      if (SGI_COMPAT (output_bfd))
+	{
+	  if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_CONFLICTNO, 0))
+	    return false;
+	}
 
-      if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLISTNO, 0))
-	return false;
+      if (SGI_COMPAT (output_bfd))
+	{
+	  if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_LIBLISTNO, 0))
+	    return false;
+	}
 
       if (bfd_get_section_by_name (dynobj, ".conflict") != NULL)
 	{
@@ -8204,12 +8484,12 @@
 	return false;
 
       if (IRIX_COMPAT (dynobj) == ict_irix6
-	  && (bfd_get_section_by_name 
+	  && (bfd_get_section_by_name
 	      (dynobj, MIPS_ELF_OPTIONS_SECTION_NAME (dynobj)))
 	  && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_OPTIONS, 0))
 	return false;
 
-      if (bfd_get_section_by_name (dynobj, 
+      if (bfd_get_section_by_name (dynobj,
 				   MIPS_ELF_MSYM_SECTION_NAME (dynobj))
 	  && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_MSYM, 0))
 	return false;
@@ -8250,7 +8530,7 @@
   int i;
 
   for (i = 0; i < 2; ++i)
-    for (p = (i == 0) ? text_section_symbols : data_section_symbols; 
+    for (p = (i == 0) ? text_section_symbols : data_section_symbols;
 	 *p;
 	 ++p)
       if (strcmp (*p, name) == 0)
@@ -8258,13 +8538,13 @@
 	  /* All of these symbols are given type STT_SECTION by the
 	     IRIX6 linker.  */
 	  sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
-	  
+
 	  /* The IRIX linker puts these symbols in special sections.  */
 	  if (i == 0)
 	    sym->st_shndx = SHN_MIPS_TEXT;
 	  else
 	    sym->st_shndx = SHN_MIPS_DATA;
-	  
+
 	  break;
 	}
 }
@@ -8301,15 +8581,15 @@
 
       BFD_ASSERT (h->dynindx != -1);
 
-      s = bfd_get_section_by_name (dynobj, 
+      s = bfd_get_section_by_name (dynobj,
 				   MIPS_ELF_STUB_SECTION_NAME (dynobj));
       BFD_ASSERT (s != NULL);
 
       /* Fill the stub.  */
       p = stub;
-      bfd_put_32 (output_bfd, STUB_LW(output_bfd), p);
+      bfd_put_32 (output_bfd, STUB_LW (output_bfd), p);
       p += 4;
-      bfd_put_32 (output_bfd, STUB_MOVE, p);
+      bfd_put_32 (output_bfd, STUB_MOVE (output_bfd), p);
       p += 4;
 
       /* FIXME: Can h->dynindex be more than 64K?  */
@@ -8318,7 +8598,7 @@
 
       bfd_put_32 (output_bfd, STUB_JALR, p);
       p += 4;
-      bfd_put_32 (output_bfd, STUB_LI16 + h->dynindx, p);
+      bfd_put_32 (output_bfd, STUB_LI16 (output_bfd) + h->dynindx, p);
 
       BFD_ASSERT (h->plt.offset <= s->_raw_size);
       memcpy (s->contents + h->plt.offset, stub, MIPS_FUNCTION_STUB_SIZE);
@@ -8334,7 +8614,8 @@
       sym->st_value = gval;
     }
 
-  BFD_ASSERT (h->dynindx != -1);
+  BFD_ASSERT (h->dynindx != -1
+	      || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0);
 
   sgot = mips_elf_got_section (dynobj);
   BFD_ASSERT (sgot != NULL);
@@ -8353,19 +8634,24 @@
       if (sym->st_value)
 	value = sym->st_value;
       else
-	/* For an entity defined in a shared object, this will be
-	   NULL.  (For functions in shared objects for
-	   which we have created stubs, ST_VALUE will be non-NULL.
-	   That's because such the functions are now no longer defined
-	   in a shared object.)  */
-	value = h->root.u.def.value;
+	{
+	  /* For an entity defined in a shared object, this will be
+	     NULL.  (For functions in shared objects for
+	     which we have created stubs, ST_VALUE will be non-NULL.
+	     That's because such the functions are now no longer defined
+	     in a shared object.)  */
 
+	  if (info->shared && h->root.type == bfd_link_hash_undefined)
+	    value = 0;
+	  else
+	    value = h->root.u.def.value;
+	}
       offset = mips_elf_global_got_index (dynobj, h);
       MIPS_ELF_PUT_WORD (output_bfd, value, sgot->contents + offset);
     }
 
   /* Create a .msym entry, if appropriate.  */
-  smsym = bfd_get_section_by_name (dynobj, 
+  smsym = bfd_get_section_by_name (dynobj,
 				   MIPS_ELF_MSYM_SECTION_NAME (dynobj));
   if (smsym)
     {
@@ -8375,7 +8661,7 @@
       /* It is undocumented what the `1' indicates, but IRIX6 uses
 	 this value.  */
       msym.ms_info = ELF32_MS_INFO (mh->min_dyn_reloc_index, 1);
-      bfd_mips_elf_swap_msym_out 
+      bfd_mips_elf_swap_msym_out
 	(dynobj, &msym,
 	 ((Elf32_External_Msym *) smsym->contents) + h->dynindx);
     }
@@ -8385,22 +8671,23 @@
   if (strcmp (name, "_DYNAMIC") == 0
       || strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
     sym->st_shndx = SHN_ABS;
-  else if (strcmp (name, "_DYNAMIC_LINK") == 0)
+  else if (strcmp (name, "_DYNAMIC_LINK") == 0
+	   || strcmp (name, "_DYNAMIC_LINKING") == 0)
     {
       sym->st_shndx = SHN_ABS;
       sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
       sym->st_value = 1;
     }
+  else if (strcmp (name, "_gp_disp") == 0)
+    {
+      sym->st_shndx = SHN_ABS;
+      sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
+      sym->st_value = elf_gp (output_bfd);
+    }
   else if (SGI_COMPAT (output_bfd))
     {
-      if (strcmp (name, "_gp_disp") == 0)
-	{
-	  sym->st_shndx = SHN_ABS;
-	  sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
-	  sym->st_value = elf_gp (output_bfd);
-	}
-      else if (strcmp (name, mips_elf_dynsym_rtproc_names[0]) == 0
-	       || strcmp (name, mips_elf_dynsym_rtproc_names[1]) == 0)
+      if (strcmp (name, mips_elf_dynsym_rtproc_names[0]) == 0
+	  || strcmp (name, mips_elf_dynsym_rtproc_names[1]) == 0)
 	{
 	  sym->st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
 	  sym->st_other = STO_PROTECTED;
@@ -8427,11 +8714,11 @@
   if (IRIX_COMPAT (output_bfd) == ict_irix6)
     mips_elf_irix6_finish_dynamic_symbol (output_bfd, name, sym);
 
-  if (SGI_COMPAT (output_bfd)
-      && ! info->shared)
+  if (! info->shared)
     {
       if (! mips_elf_hash_table (info)->use_rld_obj_head
-	  && strcmp (name, "__rld_map") == 0)
+	  && (strcmp (name, "__rld_map") == 0
+	      || strcmp (name, "__RLD_MAP") == 0))
 	{
 	  asection *s = bfd_get_section_by_name (dynobj, ".rld_map");
 	  BFD_ASSERT (s != NULL);
@@ -8444,8 +8731,9 @@
 	       && strcmp (name, "__rld_obj_head") == 0)
 	{
 	  /* IRIX6 does not use a .rld_map section.  */
-	  if (IRIX_COMPAT (output_bfd) == ict_irix5)
-	    BFD_ASSERT (bfd_get_section_by_name (dynobj, ".rld_map") 
+	  if (IRIX_COMPAT (output_bfd) == ict_irix5
+              || IRIX_COMPAT (output_bfd) == ict_none)
+	    BFD_ASSERT (bfd_get_section_by_name (dynobj, ".rld_map")
 			!= NULL);
 	  mips_elf_hash_table (info)->rld_value = sym->st_value;
 	}
@@ -8504,14 +8792,14 @@
 
 	  /* Read in the current dynamic entry.  */
 	  (*get_elf_backend_data (dynobj)->s->swap_dyn_in) (dynobj, b, &dyn);
-	  
+
 	  /* Assume that we're going to modify it and write it out.  */
 	  swap_out_p = true;
 
 	  switch (dyn.d_tag)
 	    {
 	    case DT_RELENT:
-	      s = (bfd_get_section_by_name 
+	      s = (bfd_get_section_by_name
 		   (dynobj,
 		    MIPS_ELF_REL_DYN_SECTION_NAME (dynobj)));
 	      BFD_ASSERT (s != NULL);
@@ -8564,7 +8852,7 @@
 		    dyn.d_un.d_val = s->_raw_size / elemsize;
 		}
 	      else
-		    dyn.d_un.d_val = 0;
+		dyn.d_un.d_val = 0;
 	      break;
 
 	    case DT_MIPS_TIME_STAMP:
@@ -8629,13 +8917,13 @@
 	      break;
 
 	    case DT_MIPS_OPTIONS:
-	      s = (bfd_get_section_by_name 
+	      s = (bfd_get_section_by_name
 		   (output_bfd, MIPS_ELF_OPTIONS_SECTION_NAME (output_bfd)));
 	      dyn.d_un.d_ptr = s->vma;
 	      break;
 
 	    case DT_MIPS_MSYM:
-	      s = (bfd_get_section_by_name 
+	      s = (bfd_get_section_by_name
 		   (output_bfd, MIPS_ELF_MSYM_SECTION_NAME (output_bfd)));
 	      dyn.d_un.d_ptr = s->vma;
 	      break;
@@ -8646,18 +8934,18 @@
 	    }
 
 	  if (swap_out_p)
-	    (*get_elf_backend_data (dynobj)->s->swap_dyn_out) 
+	    (*get_elf_backend_data (dynobj)->s->swap_dyn_out)
 	      (dynobj, &dyn, b);
 	}
     }
 
   /* The first entry of the global offset table will be filled at
      runtime. The second entry will be used by some runtime loaders.
-     This isn't the case of Irix rld. */
+     This isn't the case of Irix rld.  */
   if (sgot != NULL && sgot->_raw_size > 0)
     {
       MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0, sgot->contents);
-      MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000, 
+      MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0x80000000,
 			 sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd));
     }
 
@@ -8674,7 +8962,7 @@
        _bfd_elf_final_link.  SGI sets the STT_NOTYPE attribute for these
        symbols.  Should we do so?  */
 
-    smsym = bfd_get_section_by_name (dynobj, 
+    smsym = bfd_get_section_by_name (dynobj,
 				     MIPS_ELF_MSYM_SECTION_NAME (dynobj));
     if (smsym != NULL)
       {
@@ -8687,7 +8975,7 @@
 	  {
 	    long dynindx = elf_section_data (s)->dynindx;
 
-	    bfd_mips_elf_swap_msym_out 
+	    bfd_mips_elf_swap_msym_out
 	      (output_bfd, &msym,
 	       (((Elf32_External_Msym *) smsym->contents)
 		+ dynindx));
@@ -8712,7 +9000,7 @@
 					     s->contents));
 
 	    /* Clean up a dummy stub function entry in .text.  */
-	    s = bfd_get_section_by_name (dynobj, 
+	    s = bfd_get_section_by_name (dynobj,
 					 MIPS_ELF_STUB_SECTION_NAME (dynobj));
 	    if (s != NULL)
 	      {
@@ -8726,8 +9014,25 @@
 	  }
       }
 
+    /* We need to sort the entries of the dynamic relocation section.  */
+
+    if (!ABI_64_P (output_bfd))
+      {
+	asection *reldyn;
+
+	reldyn = bfd_get_section_by_name (dynobj,
+					  MIPS_ELF_REL_DYN_SECTION_NAME (dynobj));
+	if (reldyn != NULL && reldyn->reloc_count > 2)
+	  {
+	    reldyn_sorting_bfd = output_bfd;
+	    qsort ((Elf32_External_Rel *) reldyn->contents + 1,
+		   (size_t) reldyn->reloc_count - 1,
+		   sizeof (Elf32_External_Rel), sort_dynamic_relocs);
+	  }
+      }
+
     /* Clean up a first relocation in .rel.dyn.  */
-    s = bfd_get_section_by_name (dynobj, 
+    s = bfd_get_section_by_name (dynobj,
 				 MIPS_ELF_REL_DYN_SECTION_NAME (dynobj));
     if (s != NULL && s->_raw_size > 0)
       memset (s->contents, 0, MIPS_ELF_REL_SIZE (dynobj));
@@ -8919,13 +9224,13 @@
     free (reloc_vector);
   return NULL;
 }
+
 #define bfd_elf32_bfd_get_relocated_section_contents \
   elf32_mips_get_relocated_section_contents
 
 /* ECOFF swapping routines.  These are used when dealing with the
    .mdebug section, which is in the ECOFF debugging format.  */
-static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap =
-{
+static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
   /* Symbol table magic number.  */
   magicSym,
   /* Alignment of debugging information.  E.g., 4.  */
@@ -9019,6 +9324,11 @@
 #define elf_backend_got_header_size	(4*MIPS_RESERVED_GOTNO)
 #define elf_backend_plt_header_size	0
 
+#define elf_backend_copy_indirect_symbol \
+					_bfd_mips_elf_copy_indirect_symbol
+
+#define elf_backend_hide_symbol		_bfd_mips_elf_hide_symbol
+
 #define bfd_elf32_bfd_is_local_label_name \
 					mips_elf_is_local_label_name
 #define bfd_elf32_find_nearest_line	_bfd_mips_elf_find_nearest_line
@@ -9034,3 +9344,20 @@
 #define bfd_elf32_bfd_print_private_bfd_data \
 					_bfd_mips_elf_print_private_bfd_data
 #include "elf32-target.h"
+
+/* Support for traditional mips targets */
+
+#define INCLUDED_TARGET_FILE            /* More a type of flag */
+
+#undef TARGET_LITTLE_SYM
+#undef TARGET_LITTLE_NAME
+#undef TARGET_BIG_SYM
+#undef TARGET_BIG_NAME
+
+#define TARGET_LITTLE_SYM               bfd_elf32_tradlittlemips_vec
+#define TARGET_LITTLE_NAME              "elf32-tradlittlemips"
+#define TARGET_BIG_SYM                  bfd_elf32_tradbigmips_vec
+#define TARGET_BIG_NAME                 "elf32-tradbigmips"
+
+/* Include the target file again for this target */
+#include "elf32-target.h"
diff --git a/bfd/elf32-pj.c b/bfd/elf32-pj.c
index 3b96949..81759ff 100644
--- a/bfd/elf32-pj.c
+++ b/bfd/elf32-pj.c
@@ -131,7 +131,6 @@
 	 0xffff,		/* dst_mask */
 	 true),			/* pcrel_offset */
 
-
     HOWTO (R_PJ_CODE_HI16,	/* type */
 	 16,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -176,7 +175,6 @@
          0,                     /* dst_mask */
          false),                /* pcrel_offset */
 
-
 };
 
 /* This function is used for normal relocs.  This is like the COFF
@@ -213,8 +211,8 @@
     return bfd_reloc_undefined;
 
   if (bfd_is_com_section (symbol_in->section))
-    sym_value = 0;                           
-  else 
+    sym_value = 0;
+  else
     sym_value = (symbol_in->value +
 		 symbol_in->section->output_section->vma +
 		 symbol_in->section->output_offset);
@@ -228,7 +226,7 @@
       break;
 
       /* Relocations in code are always bigendian, no matter what the
-	 data endianness is. */
+	 data endianness is.  */
 
     case R_PJ_CODE_DIR32:
       insn = bfd_getb32 (hit_data);
@@ -254,7 +252,7 @@
       insn += (sym_value + reloc_entry->addend) >> 16;
       bfd_putb16 (insn, hit_data);
       break;
-      
+
     default:
       abort ();
       break;
@@ -296,7 +294,7 @@
      bfd_reloc_code_real_type code;
 {
   unsigned int i;
-  
+
   for (i = 0; i < sizeof (pj_reloc_map) / sizeof (struct elf_reloc_map); i++)
     {
       if (pj_reloc_map[i].bfd_reloc_val == code)
@@ -324,7 +322,7 @@
 }
 
 /* Take this moment to fill in the special picoJava bits in the
-   e_flags field. */
+   e_flags field.  */
 
 static void
 pj_elf_final_write_processing (abfd, linker)
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 6dc3eff..58ffce4 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -32,7 +32,6 @@
 
 #define USE_RELA		/* we want RELA relocations, not REL */
 
-
 static reloc_howto_type *ppc_elf_reloc_type_lookup
   PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
 static void ppc_elf_info_to_howto
@@ -124,11 +123,27 @@
 /* The number of single-slot PLT entries (the rest use two slots).  */
 #define PLT_NUM_SINGLE_ENTRIES 8192
 
-
-static reloc_howto_type *ppc_elf_howto_table[ (int)R_PPC_max ];
+/* Will references to this symbol always reference the symbol
+   in this object?  */
+#define SYMBOL_REFERENCES_LOCAL(INFO, H)				\
+  ((! INFO->shared							\
+    || INFO->symbolic							\
+    || H->dynindx == -1							\
+    || ELF_ST_VISIBILITY (H->other) == STV_INTERNAL			\
+    || ELF_ST_VISIBILITY (H->other) == STV_HIDDEN)			\
+   && (H->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
 
-static reloc_howto_type ppc_elf_howto_raw[] =
-{
+/* Will _calls_ to this symbol always call the version in this object?  */
+#define SYMBOL_CALLS_LOCAL(INFO, H)				\
+  ((! INFO->shared							\
+    || INFO->symbolic							\
+    || H->dynindx == -1							\
+    || ELF_ST_VISIBILITY (H->other) != STV_DEFAULT)			\
+   && (H->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
+
+static reloc_howto_type *ppc_elf_howto_table[(int) R_PPC_max];
+
+static reloc_howto_type ppc_elf_howto_raw[] = {
   /* This reloc does nothing.  */
   HOWTO (R_PPC_NONE,		/* type */
 	 0,			/* rightshift */
@@ -221,7 +236,7 @@
 	 false),		/* pcrel_offset */
 
   /* The high order 16 bits of an address, plus 1 if the contents of
-     the low 16 bits, treated as a signed number, is negative.	*/
+     the low 16 bits, treated as a signed number, is negative.  */
   HOWTO (R_PPC_ADDR16_HA,	/* type */
 	 16,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -254,7 +269,7 @@
 
   /* An absolute 16 bit branch, for which bit 10 should be set to
      indicate that the branch is expected to be taken.	The lower two
-     bits must be zero.	 */
+     bits must be zero.  */
   HOWTO (R_PPC_ADDR14_BRTAKEN,	/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -286,7 +301,7 @@
 	 0xfffc,		/* dst_mask */
 	 false),		/* pcrel_offset */
 
-  /* A relative 26 bit branch; the lower two bits must be zero.	 */
+  /* A relative 26 bit branch; the lower two bits must be zero.  */
   HOWTO (R_PPC_REL24,		/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -301,7 +316,7 @@
 	 0x3fffffc,		/* dst_mask */
 	 true),			/* pcrel_offset */
 
-  /* A relative 16 bit branch; the lower two bits must be zero.	 */
+  /* A relative 16 bit branch; the lower two bits must be zero.  */
   HOWTO (R_PPC_REL14,		/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -316,7 +331,7 @@
 	 0xfffc,		/* dst_mask */
 	 true),			/* pcrel_offset */
 
-  /* A relative 16 bit branch.	Bit 10 should be set to indicate that
+  /* A relative 16 bit branch.  Bit 10 should be set to indicate that
      the branch is expected to be taken.  The lower two bits must be
      zero.  */
   HOWTO (R_PPC_REL14_BRTAKEN,	/* type */
@@ -333,7 +348,7 @@
 	 0xfffc,		/* dst_mask */
 	 true),			/* pcrel_offset */
 
-  /* A relative 16 bit branch.	Bit 10 should be set to indicate that
+  /* A relative 16 bit branch.  Bit 10 should be set to indicate that
      the branch is not expected to be taken.  The lower two bits must
      be zero.  */
   HOWTO (R_PPC_REL14_BRNTAKEN,	/* type */
@@ -560,7 +575,7 @@
 	 true),			/* pcrel_offset */
 
   /* 32-bit relocation to the symbol's procedure linkage table.
-     FIXME: not supported. */
+     FIXME: not supported.  */
   HOWTO (R_PPC_PLT32,		/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -576,7 +591,7 @@
 	 false),		/* pcrel_offset */
 
   /* 32-bit PC relative relocation to the symbol's procedure linkage table.
-     FIXME: not supported. */
+     FIXME: not supported.  */
   HOWTO (R_PPC_PLTREL32,	/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -655,7 +670,7 @@
 	 0xffff,		/* dst_mask */
 	 false),		/* pcrel_offset */
 
-  /* 32-bit section relative relocation. */
+  /* 32-bit section relative relocation.  */
   HOWTO (R_PPC_SECTOFF,		/* type */
 	 0,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -670,7 +685,7 @@
 	 0,			/* dst_mask */
 	 true),			/* pcrel_offset */
 
-  /* 16-bit lower half section relative relocation. */
+  /* 16-bit lower half section relative relocation.  */
   HOWTO (R_PPC_SECTOFF_LO,	  /* type */
 	 0,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -685,7 +700,7 @@
 	 0xffff,		/* dst_mask */
 	 false),		/* pcrel_offset */
 
-  /* 16-bit upper half section relative relocation. */
+  /* 16-bit upper half section relative relocation.  */
   HOWTO (R_PPC_SECTOFF_HI,	/* type */
 	 16,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -700,7 +715,7 @@
 	 0xffff,		/* dst_mask */
 	 false),		 /* pcrel_offset */
 
-  /* 16-bit upper half adjusted section relative relocation. */
+  /* 16-bit upper half adjusted section relative relocation.  */
   HOWTO (R_PPC_SECTOFF_HA,	/* type */
 	 16,			/* rightshift */
 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
@@ -931,7 +946,6 @@
 	 0xffff,		/* dst_mask */
 	 false),		/* pcrel_offset */
 };
-
 
 /* Initialize the ppc_elf_howto_table, so that linear accesses can be done.  */
 
@@ -943,11 +957,10 @@
   for (i = 0; i < sizeof (ppc_elf_howto_raw) / sizeof (ppc_elf_howto_raw[0]); i++)
     {
       type = ppc_elf_howto_raw[i].type;
-      BFD_ASSERT (type < sizeof(ppc_elf_howto_table) / sizeof(ppc_elf_howto_table[0]));
+      BFD_ASSERT (type < sizeof (ppc_elf_howto_table) / sizeof (ppc_elf_howto_table[0]));
       ppc_elf_howto_table[type] = &ppc_elf_howto_raw[i];
     }
 }
-
 
 /* This function handles relaxing for the PPC with option --mpc860c0[=<n>].
 
@@ -959,7 +972,7 @@
    3/ The branch is taken.
    4/ The branch is located in the last 5 words of a page.
       (The EOP limit is 5 by default but may be specified as any value from 1-10.)
-   
+
    Our software solution is to detect these problematic branches in a
    linker pass and modify them as follows:
    1/ Unconditional branches - Since these are always predicted taken,
@@ -975,22 +988,22 @@
 
 static int
 ppc_elf_sort_rela (arg1, arg2)
-    const void *arg1;
-    const void *arg2;
+     const void *arg1;
+     const void *arg2;
 {
   const Elf_Internal_Rela **rela1 = (const Elf_Internal_Rela**) arg1;
   const Elf_Internal_Rela **rela2 = (const Elf_Internal_Rela**) arg2;
 
-  /* Sort by offset. */
+  /* Sort by offset.  */
   return ((*rela1)->r_offset - (*rela2)->r_offset);
 }
 
 static boolean
 ppc_elf_relax_section (abfd, isec, link_info, again)
-    bfd *abfd;
-    asection *isec;
-    struct bfd_link_info *link_info;
-    boolean *again;
+     bfd *abfd;
+     asection *isec;
+     struct bfd_link_info *link_info;
+     boolean *again;
 {
 #define PAGESIZE 0x1000
 
@@ -1001,7 +1014,7 @@
   Elf_Internal_Rela **rela_comb = NULL;
   int comb_curr, comb_count;
 
-  /* We never have to do this more than once per input section. */
+  /* We never have to do this more than once per input section.  */
   *again = false;
 
   /* If needed, initialize this section's cooked size.  */
@@ -1009,13 +1022,13 @@
       isec->_cooked_size = isec->_raw_size;
 
   /* We're only interested in text sections which overlap the
-  troublesome area at the end of a page. */
+     troublesome area at the end of a page.  */
   if (link_info->mpc860c0 && (isec->flags & SEC_CODE) && isec->_cooked_size)
     {
       bfd_vma dot, end_page, end_section;
       boolean section_modified;
 
-      /* Get the section contents. */
+      /* Get the section contents.  */
       /* Get cached copy if it exists.  */
       if (elf_section_data (isec)->this_hdr.contents != NULL)
 	  contents = elf_section_data (isec)->this_hdr.contents;
@@ -1024,42 +1037,42 @@
 	  /* Go get them off disk.  */
 	  contents = (bfd_byte *) bfd_malloc (isec->_raw_size);
 	  if (contents == NULL)
-	      goto error_return;
+	    goto error_return;
 	  free_contents = contents;
 
 	  if (! bfd_get_section_contents (abfd, isec, contents,
 					  (file_ptr) 0, isec->_raw_size))
-	      goto error_return;
+	    goto error_return;
 	}
 
       comb_curr = 0;
       comb_count = 0;
       if (isec->reloc_count)
-        {
+	{
           unsigned n;
 
           /* Get a copy of the native relocations.  */
           internal_relocs = _bfd_elf32_link_read_relocs (
-    	    abfd, isec, (PTR) NULL, (Elf_Internal_Rela *) NULL, 
+    	    abfd, isec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
     	    link_info->keep_memory);
           if (internal_relocs == NULL)
     	      goto error_return;
           if (! link_info->keep_memory)
     	      free_relocs = internal_relocs;
-    
-          /* Setup a faster access method for the reloc info we need. */
+
+          /* Setup a faster access method for the reloc info we need.  */
           rela_comb = (Elf_Internal_Rela**)
-	    bfd_malloc (isec->reloc_count*sizeof(Elf_Internal_Rela*));
+	    bfd_malloc (isec->reloc_count*sizeof (Elf_Internal_Rela*));
           if (rela_comb == NULL)
               goto error_return;
-          for (n=0; n<isec->reloc_count; ++n)
+          for (n = 0; n < isec->reloc_count; ++n)
             {
               long r_type;
-    
+
               r_type = ELF32_R_TYPE (internal_relocs[n].r_info);
-              if (r_type < 0 || r_type >= (int)R_PPC_max)
+              if (r_type < 0 || r_type >= (int) R_PPC_max)
                   goto error_return;
-    
+
               /* Prologue constants are sometimes present in the ".text"
               sections and they can be identified by their associated relocation.
               We don't want to process those words and some others which
@@ -1067,37 +1080,37 @@
               conditional branches will have a relocation so we will
               only ignore words that 1) have a reloc, and 2) the reloc
               is not applicable to a conditional branch.
-              The array rela_comb is built here for use in the EOP scan loop. */
+              The array rela_comb is built here for use in the EOP scan loop.  */
               switch (r_type)
                 {
                 case R_PPC_ADDR14_BRNTAKEN:     /* absolute, predicted not taken */
-                case R_PPC_REL14:               /* relative cond. br. */
+                case R_PPC_REL14:               /* relative cond. br.  */
                 case R_PPC_REL14_BRNTAKEN:      /* rel. cond. br., predicted not taken */
-                  /* We should check the instruction. */
+                  /* We should check the instruction.  */
                   break;
                 default:
-                  /* The word is not a conditional branch - ignore it. */
+                  /* The word is not a conditional branch - ignore it.  */
                   rela_comb[comb_count++] = &internal_relocs[n];
                   break;
                 }
             }
           if (comb_count > 1)
-              qsort (rela_comb, (size_t) comb_count, sizeof (int), ppc_elf_sort_rela);
-        }
+	    qsort (rela_comb, (size_t) comb_count, sizeof (int), ppc_elf_sort_rela);
+	}
 
-      /* Enumerate each EOP region that overlaps this section. */
+      /* Enumerate each EOP region that overlaps this section.  */
       end_section = isec->vma + isec->_cooked_size;
       dot = end_page = (isec->vma | (PAGESIZE - 1)) + 1;
       dot -= link_info->mpc860c0;
       section_modified = false;
       if (dot < isec->vma)      /* Increment the start position if this section */
-          dot = isec->vma;      /* begins in the middle of its first EOP region. */
+          dot = isec->vma;      /* begins in the middle of its first EOP region.  */
       for (;
            dot < end_section;
            dot += PAGESIZE, end_page += PAGESIZE)
         {
 
-          /* Check each word in this EOP region. */
+          /* Check each word in this EOP region.  */
           for (; dot < end_page; dot += 4)
             {
               bfd_vma isec_offset;
@@ -1105,7 +1118,7 @@
               boolean skip, modified;
 
               /* Don't process this word if there is a relocation for it and
-              the relocation indicates the word is not a conditional branch. */
+              the relocation indicates the word is not a conditional branch.  */
               skip = false;
               isec_offset = dot - isec->vma;
               for (; comb_curr<comb_count; ++comb_curr)
@@ -1121,7 +1134,7 @@
                 }
               if (skip) continue;
 
-              /* Check the current word for a problematic conditional branch. */
+              /* Check the current word for a problematic conditional branch.  */
 #define BO0(insn) ((insn) & 0x02000000)
 #define BO2(insn) ((insn) & 0x00800000)
 #define BO4(insn) ((insn) & 0x00200000)
@@ -1134,7 +1147,7 @@
                     {
                       bfd_vma target;
                       /* This branch is predicted as "normal".
-                      If this is a forward branch, it is problematic. */
+                      If this is a forward branch, it is problematic.  */
 
                       target = insn & 0x0000Fffc;               /*extract*/
                       target = (target ^ 0x8000) - 0x8000;      /*sign extend*/
@@ -1155,7 +1168,7 @@
 		      /* This branch is predicted as not-taken.
 		      If this is a forward branch, it is problematic.
                       Since we can't tell statically if it will branch forward,
-                      always set the prediction bit. */
+                      always set the prediction bit.  */
                       insn |= 0x00200000;   /* set the prediction bit */
                       modified = true;
 		    }
@@ -1168,7 +1181,7 @@
 		      /* This branch is predicted as not-taken.
 		      If this is a forward branch, it is problematic.
                       Since we can't tell statically if it will branch forward,
-                      always set the prediction bit. */
+                      always set the prediction bit.  */
                       insn |= 0x00200000;   /* set the prediction bit */
                       modified = true;
 		    }
@@ -1225,7 +1238,6 @@
     free (free_contents);
   return false;
 }
-
 
 static reloc_howto_type *
 ppc_elf_reloc_type_lookup (abfd, code)
@@ -1235,13 +1247,13 @@
   enum elf_ppc_reloc_type ppc_reloc = R_PPC_NONE;
 
   if (!ppc_elf_howto_table[R_PPC_ADDR32])
-    /* Initialize howto table if needed */
+    /* Initialize howto table if needed.  */
     ppc_elf_howto_init ();
 
-  switch ((int)code)
+  switch ((int) code)
     {
     default:
-      return (reloc_howto_type *)NULL;
+      return (reloc_howto_type *) NULL;
 
     case BFD_RELOC_NONE:		ppc_reloc = R_PPC_NONE;			break;
     case BFD_RELOC_32:			ppc_reloc = R_PPC_ADDR32;		break;
@@ -1298,7 +1310,7 @@
     case BFD_RELOC_VTABLE_ENTRY:	ppc_reloc = R_PPC_GNU_VTENTRY;		break;
     }
 
-  return ppc_elf_howto_table[ (int)ppc_reloc ];
+  return ppc_elf_howto_table[(int) ppc_reloc];
 };
 
 /* Set the howto pointer for a PowerPC ELF reloc.  */
@@ -1309,7 +1321,8 @@
      arelent *cache_ptr;
      Elf32_Internal_Rela *dst;
 {
-  if (!ppc_elf_howto_table[ R_PPC_ADDR32 ])	/* Initialize howto table if needed */
+  if (!ppc_elf_howto_table[R_PPC_ADDR32])
+    /* Initialize howto table if needed.  */
     ppc_elf_howto_init ();
 
   BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_PPC_max);
@@ -1354,7 +1367,7 @@
   return bfd_reloc_continue;
 }
 
-/* Function to set whether a module needs the -mrelocatable bit set. */
+/* Function to set whether a module needs the -mrelocatable bit set.  */
 
 static boolean
 ppc_elf_set_private_flags (abfd, flags)
@@ -1462,7 +1475,7 @@
 	  error = true;
 	  (*_bfd_error_handler)
 	    (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
-	     bfd_get_filename (ibfd), (long)new_flags, (long)old_flags);
+	     bfd_get_filename (ibfd), (long) new_flags, (long) old_flags);
 	}
 
       if (error)
@@ -1564,10 +1577,10 @@
 	default:
 	  (*_bfd_error_handler) (_("%s: Unknown special linker type %d"),
 				 bfd_get_filename (abfd),
-				 (int)which);
+				 (int) which);
 
 	  bfd_set_error (bfd_error_bad_value);
-	  return (elf_linker_section_t *)0;
+	  return (elf_linker_section_t *) 0;
 
 	case LINKER_SECTION_SDATA:	/* .sdata/.sbss section */
 	  defaults.name		  = ".sdata";
@@ -1592,10 +1605,9 @@
 
   return lsect;
 }
-
 
-/* If we have a non-zero sized .sbss2 or .PPC.EMB.sbss0 sections, we need to bump up
-   the number of section headers.  */
+/* If we have a non-zero sized .sbss2 or .PPC.EMB.sbss0 sections, we
+   need to bump up the number of section headers.  */
 
 static int
 ppc_elf_additional_program_headers (abfd)
@@ -1621,7 +1633,7 @@
   return ret;
 }
 
-/* Modify the segment map if needed */
+/* Modify the segment map if needed.  */
 
 static boolean
 ppc_elf_modify_segment_map (abfd)
@@ -1642,7 +1654,7 @@
   register asection *s;
   flagword flags;
 
-  if (!_bfd_elf_create_dynamic_sections(abfd, info))
+  if (!_bfd_elf_create_dynamic_sections (abfd, info))
     return false;
 
   flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
@@ -1695,7 +1707,6 @@
 		      && (h->elf_link_hash_flags
 			  & ELF_LINK_HASH_DEF_REGULAR) == 0)));
 
-
   /* If this is a function, put it in the procedure linkage table.  We
      will fill in the contents of the procedure linkage table later,
      when we know the address of the .got section.  */
@@ -1703,9 +1714,7 @@
       || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
     {
       if (! elf_hash_table (info)->dynamic_sections_created
-	  || ((!info->shared || info->symbolic || h->dynindx == -1)
-	      && (h->elf_link_hash_flags
-		  & ELF_LINK_HASH_DEF_REGULAR) != 0)
+ 	  || SYMBOL_CALLS_LOCAL (info, h)
 	  || (info->shared && h->plt.refcount <= 0))
 	{
 	  /* A PLT entry is not required/allowed when:
@@ -1713,9 +1722,8 @@
 	     1. We are not using ld.so; because then the PLT entry
 	     can't be set up, so we can't use one.
 
-	     2. We know for certain that a symbol is defined in
-	     this object, because this object is the application,
-	     is linked with -Bsymbolic, or because the symbol is local.
+	     2. We know for certain that a call to this symbol
+	     will go to this object.
 
 	     3. GC has rendered the entry unused.
 	     Note, however, that in an executable all references to the
@@ -1864,7 +1872,6 @@
 
   return true;
 }
-
 
 /* Set the sizes of the dynamic sections.  */
 
@@ -1906,10 +1913,10 @@
 	 stripped from the output file below.  */
       static char *rela_sections[] = { ".rela.got", ".rela.sdata",
 				       ".rela.sdata2", ".rela.sbss",
-				       (char *)0 };
+				       (char *) 0 };
       char **p;
 
-      for (p = rela_sections; *p != (char *)0; p++)
+      for (p = rela_sections; *p != (char *) 0; p++)
 	{
 	  s = bfd_get_section_by_name (dynobj, *p);
 	  if (s != NULL)
@@ -1971,7 +1978,7 @@
 	      asection *target;
 	      const char *outname;
 
-	      /* Remember whether there are any relocation sections. */
+	      /* Remember whether there are any relocation sections.  */
 	      relocs = true;
 
 	      /* If this relocation section applies to a read only
@@ -2044,6 +2051,7 @@
 	{
 	  if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
@@ -2093,7 +2101,6 @@
 	return false;
     }
 
-
   if ((sdata2 = elf_linker_section (abfd, LINKER_SECTION_SDATA2)) == NULL)
     {
       sdata2 = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_SDATA2);
@@ -2106,7 +2113,7 @@
   local_got_refcounts = elf_local_got_refcounts (abfd);
 
   sym_hashes = elf_sym_hashes (abfd);
-  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf32_External_Sym);
+  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym);
   if (!elf_bad_symtab (abfd))
     sym_hashes_end -= symtab_hdr->sh_info;
 
@@ -2237,7 +2244,7 @@
 	      ((*_bfd_error_handler)
 	       (_("%s: relocation %s cannot be used when making a shared object"),
 		bfd_get_filename (abfd), "R_PPC_EMB_SDAI16"));
-	       return false;
+	      return false;
 	    }
 
 	  if (srelgot == NULL && (h != NULL || info->shared))
@@ -2306,7 +2313,7 @@
 	      ((*_bfd_error_handler)
 	       (_("%s: relocation %s cannot be used when making a shared object"),
 		bfd_get_filename (abfd),
-		ppc_elf_howto_table[(int)ELF32_R_TYPE (rel->r_info)]->name));
+		ppc_elf_howto_table[(int) ELF32_R_TYPE (rel->r_info)]->name));
 	      return false;
 	    }
 	  break;
@@ -2384,7 +2391,8 @@
 	case R_PPC_REL14_BRNTAKEN:
 	case R_PPC_REL32:
 	  if (h == NULL
-	      || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+	      || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
+	      || SYMBOL_REFERENCES_LOCAL (info, h))
 	    break;
 	  /* fall through */
 
@@ -2558,7 +2566,6 @@
 /* Hook called by the linker routine which adds symbols from an object
    file.  We use it to put .comm items in .sbss, and not .bss.  */
 
-/*ARGSUSED*/
 static boolean
 ppc_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
      bfd *abfd;
@@ -2610,7 +2617,6 @@
 
   return true;
 }
-
 
 /* Finish up dynamic symbol handling.  We set the contents of various
    dynamic sections here.  */
@@ -2674,6 +2680,13 @@
 	  /* Mark the symbol as undefined, rather than as defined in
 	     the .plt section.  Leave the value alone.  */
 	  sym->st_shndx = SHN_UNDEF;
+	  /* If the symbol is weak, we do need to clear the value.
+	     Otherwise, the PLT entry would provide a definition for
+	     the symbol even if the symbol wasn't defined anywhere,
+	     and so the symbol would never be NULL.  */
+	  if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK)
+	      == 0)
+	    sym->st_value = 0;
 	}
     }
 
@@ -2699,8 +2712,7 @@
 	 the global offset table will already have been initialized in
 	 the relocate_section function.  */
       if (info->shared
-	  && (info->symbolic || h->dynindx == -1)
-	  && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+	  && SYMBOL_REFERENCES_LOCAL (info, h))
 	{
 	  rela.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
 	  rela.r_addend = (h->root.u.def.value
@@ -2709,7 +2721,7 @@
 	}
       else
 	{
-	  BFD_ASSERT((h->got.offset & 1) == 0);
+	  BFD_ASSERT ((h->got.offset & 1) == 0);
 	  bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
 	  rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_GLOB_DAT);
 	  rela.r_addend = 0;
@@ -2765,7 +2777,6 @@
 
   return true;
 }
-
 
 /* Finish up the dynamic sections.  */
 
@@ -2853,7 +2864,6 @@
 
   return true;
 }
-
 
 /* The RELOCATE_SECTION function is called by the ELF backend linker
    to handle the relocations for a section.
@@ -2914,11 +2924,12 @@
   fprintf (stderr, "ppc_elf_relocate_section called for %s section %s, %ld relocations%s\n",
 	   bfd_get_filename (input_bfd),
 	   bfd_section_name(input_bfd, input_section),
-	   (long)input_section->reloc_count,
+	   (long) input_section->reloc_count,
 	   (info->relocateable) ? " (relocatable)" : "");
 #endif
 
-  if (!ppc_elf_howto_table[ R_PPC_ADDR32 ])	/* Initialize howto table if needed */
+  if (!ppc_elf_howto_table[R_PPC_ADDR32])
+    /* Initialize howto table if needed.  */
     ppc_elf_howto_init ();
 
   local_got_offsets = elf_local_got_offsets (input_bfd);
@@ -2936,27 +2947,29 @@
       bfd_vma offset			= rel->r_offset;
       bfd_vma addend			= rel->r_addend;
       bfd_reloc_status_type r		= bfd_reloc_other;
-      Elf_Internal_Sym *sym		= (Elf_Internal_Sym *)0;
-      asection *sec			= (asection *)0;
-      struct elf_link_hash_entry *h	= (struct elf_link_hash_entry *)0;
-      const char *sym_name		= (const char *)0;
+      Elf_Internal_Sym *sym		= (Elf_Internal_Sym *) 0;
+      asection *sec			= (asection *) 0;
+      struct elf_link_hash_entry *h	= (struct elf_link_hash_entry *) 0;
+      const char *sym_name		= (const char *) 0;
       reloc_howto_type *howto;
       unsigned long r_symndx;
       bfd_vma relocation;
+      int will_become_local;
 
       /* Unknown relocation handling */
-      if ((unsigned)r_type >= (unsigned)R_PPC_max || !ppc_elf_howto_table[(int)r_type])
+      if ((unsigned) r_type >= (unsigned) R_PPC_max
+	  || !ppc_elf_howto_table[(int) r_type])
 	{
 	  (*_bfd_error_handler) (_("%s: unknown relocation type %d"),
 				 bfd_get_filename (input_bfd),
-				 (int)r_type);
+				 (int) r_type);
 
 	  bfd_set_error (bfd_error_bad_value);
 	  ret = false;
 	  continue;
 	}
 
-      howto = ppc_elf_howto_table[(int)r_type];
+      howto = ppc_elf_howto_table[(int) r_type];
       r_symndx = ELF32_R_SYM (rel->r_info);
 
       if (info->relocateable)
@@ -2968,7 +2981,7 @@
 	  if (r_symndx < symtab_hdr->sh_info)
 	    {
 	      sym = local_syms + r_symndx;
-	      if ((unsigned)ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+	      if ((unsigned) ELF_ST_TYPE (sym->st_info) == STT_SECTION)
 		{
 		  sec = local_sections[r_symndx];
 		  addend = rel->r_addend += sec->output_offset + sym->st_value;
@@ -2978,10 +2991,10 @@
 #ifdef DEBUG
 	  fprintf (stderr, "\ttype = %s (%d), symbol index = %ld, offset = %ld, addend = %ld\n",
 		   howto->name,
-		   (int)r_type,
+		   (int) r_type,
 		   r_symndx,
-		   (long)offset,
-		   (long)addend);
+		   (long) offset,
+		   (long) addend);
 #endif
 	  continue;
 	}
@@ -2996,6 +3009,8 @@
 	  relocation = (sec->output_section->vma
 			+ sec->output_offset
 			+ sym->st_value);
+	  /* Relocs to local symbols are always resolved.  */
+	  will_become_local = 1;
 	}
       else
 	{
@@ -3004,11 +3019,16 @@
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 	  sym_name = h->root.root.string;
+
+	  /* Can this relocation be resolved immediately?  */
+	  will_become_local = SYMBOL_REFERENCES_LOCAL (info, h);
+
 	  if (h->root.type == bfd_link_hash_defined
 	      || h->root.type == bfd_link_hash_defweak)
 	    {
 	      sec = h->root.u.def.section;
-	      if ((r_type == R_PPC_PLT32
+	      if (((r_type == R_PPC_PLT32
+		    || r_type == R_PPC_PLTREL24)
 		   && splt != NULL
 		   && h->plt.offset != (bfd_vma) -1)
 		  || (r_type == R_PPC_LOCAL24PC
@@ -3018,14 +3038,9 @@
 		       || r_type == R_PPC_GOT16_HI
 		       || r_type == R_PPC_GOT16_HA)
 		      && elf_hash_table (info)->dynamic_sections_created
-		      && (! info->shared
-			  || (! info->symbolic && h->dynindx != -1)
-			  || (h->elf_link_hash_flags
-			      & ELF_LINK_HASH_DEF_REGULAR) == 0))
+		      && (! info->shared || ! will_become_local))
 		  || (info->shared
-		      && ((! info->symbolic && h->dynindx != -1)
-			  || (h->elf_link_hash_flags
-			      & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ 		      && ! will_become_local
 		      && ((input_section->flags & SEC_ALLOC) != 0
 			  /* Testing SEC_DEBUGGING here may be wrong.
                              It's here to avoid a crash when
@@ -3043,7 +3058,6 @@
 			  || r_type == R_PPC_ADDR14
 			  || r_type == R_PPC_ADDR14_BRTAKEN
 			  || r_type == R_PPC_ADDR14_BRNTAKEN
-			  || r_type == R_PPC_PLTREL24
 			  || r_type == R_PPC_COPY
 			  || r_type == R_PPC_GLOB_DAT
 			  || r_type == R_PPC_JMP_SLOT
@@ -3077,13 +3091,13 @@
 		  relocation = 0;
 		}
 	      else if (sec->output_section == NULL)
-	        {
+		{
                   (*_bfd_error_handler)
                     (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
                      bfd_get_filename (input_bfd), h->root.root.string,
                      bfd_get_section_name (input_bfd, input_section));
 		  relocation = 0;
-	        }
+		}
 	      else
 		relocation = (h->root.u.def.value
 			      + sec->output_section->vma
@@ -3091,13 +3105,12 @@
 	    }
 	  else if (h->root.type == bfd_link_hash_undefweak)
 	    relocation = 0;
-	  else if (info->shared && !info->symbolic
-		   && !info->no_undefined
+	  else if (info->shared && !info->symbolic && !info->no_undefined
 		   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
 	    relocation = 0;
 	  else
 	    {
-	      if (! (*info->callbacks->undefined_symbol)(info,
+	      if (! (*info->callbacks->undefined_symbol) (info,
 							 h->root.root.string,
 							 input_bfd,
 							 input_section,
@@ -3110,19 +3123,19 @@
 	    }
 	}
 
-      switch ((int)r_type)
+      switch ((int) r_type)
 	{
 	default:
 	  (*_bfd_error_handler) (_("%s: unknown relocation type %d for symbol %s"),
 				 bfd_get_filename (input_bfd),
-				 (int)r_type, sym_name);
+				 (int) r_type, sym_name);
 
 	  bfd_set_error (bfd_error_bad_value);
 	  ret = false;
 	  continue;
 
 	/* Relocations that need no special processing.  */
-	case (int)R_PPC_LOCAL24PC:
+	case (int) R_PPC_LOCAL24PC:
 	  /* It makes no sense to point a local relocation
 	     at a symbol not in this object.  */
 	  if (h != NULL
@@ -3143,28 +3156,29 @@
 
 	/* Relocations that may need to be propagated if this is a shared
            object.  */
-	case (int)R_PPC_REL24:
-	case (int)R_PPC_REL32:
-	case (int)R_PPC_REL14:
+	case (int) R_PPC_REL24:
+	case (int) R_PPC_REL32:
+	case (int) R_PPC_REL14:
 	  /* If these relocations are not to a named symbol, they can be
 	     handled right here, no need to bother the dynamic linker.  */
 	  if (h == NULL
-	      || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+	      || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
+	      || SYMBOL_REFERENCES_LOCAL (info, h))
 	    break;
 	/* fall through */
 
 	/* Relocations that always need to be propagated if this is a shared
            object.  */
-	case (int)R_PPC_NONE:
-	case (int)R_PPC_ADDR32:
-	case (int)R_PPC_ADDR24:
-	case (int)R_PPC_ADDR16:
-	case (int)R_PPC_ADDR16_LO:
-	case (int)R_PPC_ADDR16_HI:
-	case (int)R_PPC_ADDR16_HA:
-	case (int)R_PPC_ADDR14:
-	case (int)R_PPC_UADDR32:
-	case (int)R_PPC_UADDR16:
+	case (int) R_PPC_NONE:
+	case (int) R_PPC_ADDR32:
+	case (int) R_PPC_ADDR24:
+	case (int) R_PPC_ADDR16:
+	case (int) R_PPC_ADDR16_LO:
+	case (int) R_PPC_ADDR16_HI:
+	case (int) R_PPC_ADDR16_HA:
+	case (int) R_PPC_ADDR14:
+	case (int) R_PPC_UADDR32:
+	case (int) R_PPC_UADDR16:
 	  if (info->shared)
 	    {
 	      Elf_Internal_Rela outrel;
@@ -3224,12 +3238,8 @@
 		memset (&outrel, 0, sizeof outrel);
 	      /* h->dynindx may be -1 if this symbol was marked to
                  become local.  */
-	      else if (h != NULL
-		       && ((! info->symbolic && h->dynindx != -1)
-			   || (h->elf_link_hash_flags
-			       & ELF_LINK_HASH_DEF_REGULAR) == 0))
+	      else if (! will_become_local)
 		{
-		  BFD_ASSERT (h->dynindx != -1);
 		  outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
 		  outrel.r_addend = rel->r_addend;
 		}
@@ -3266,11 +3276,11 @@
 
 			  osec = sec->output_section;
 			  indx = elf_section_data (osec)->dynindx;
-			  BFD_ASSERT(indx > 0);
+			  BFD_ASSERT (indx > 0);
 #ifdef DEBUG
 			  if (indx <= 0)
 			    {
-			      printf("indx=%d section=%s flags=%08x name=%s\n",
+			      printf ("indx=%d section=%s flags=%08x name=%s\n",
 				     indx, osec->name, osec->flags,
 				     h->root.root.string);
 			    }
@@ -3311,8 +3321,8 @@
 	  break;
 
 	/* branch taken prediction relocations */
-	case (int)R_PPC_ADDR14_BRTAKEN:
-	case (int)R_PPC_REL14_BRTAKEN:
+	case (int) R_PPC_ADDR14_BRTAKEN:
+	case (int) R_PPC_REL14_BRTAKEN:
 	  insn = bfd_get_32 (output_bfd, contents + offset);
 	  if ((relocation - offset) & 0x8000)
 	    insn &= ~BRANCH_PREDICT_BIT;
@@ -3322,8 +3332,8 @@
 	  break;
 
 	/* branch not taken predicition relocations */
-	case (int)R_PPC_ADDR14_BRNTAKEN:
-	case (int)R_PPC_REL14_BRNTAKEN:
+	case (int) R_PPC_ADDR14_BRNTAKEN:
+	case (int) R_PPC_REL14_BRNTAKEN:
 	  insn = bfd_get_32 (output_bfd, contents + offset);
 	  if ((relocation - offset) & 0x8000)
 	    insn |= BRANCH_PREDICT_BIT;
@@ -3333,10 +3343,10 @@
 	  break;
 
 	/* GOT16 relocations */
-	case (int)R_PPC_GOT16:
-	case (int)R_PPC_GOT16_LO:
-	case (int)R_PPC_GOT16_HI:
-	case (int)R_PPC_GOT16_HA:
+	case (int) R_PPC_GOT16:
+	case (int) R_PPC_GOT16_LO:
+	case (int) R_PPC_GOT16_HI:
+	case (int) R_PPC_GOT16_HA:
 	  /* Relocation is to the entry for this symbol in the global
              offset table.  */
 	  BFD_ASSERT (sgot != NULL);
@@ -3350,8 +3360,7 @@
 
 	      if (! elf_hash_table (info)->dynamic_sections_created
 		  || (info->shared
-		      && (info->symbolic || h->dynindx == -1)
-		      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+		      && SYMBOL_REFERENCES_LOCAL (info, h)))
 		{
 		  /* This is actually a static link, or it is a
                      -Bsymbolic link and the symbol is defined
@@ -3424,7 +3433,7 @@
 	  break;
 
 	/* Indirect .sdata relocation */
-	case (int)R_PPC_EMB_SDAI16:
+	case (int) R_PPC_EMB_SDAI16:
 	  BFD_ASSERT (sdata != NULL);
 	  relocation = bfd_elf32_finish_pointer_linker_section (output_bfd, input_bfd, info,
 								sdata, h, relocation, rel,
@@ -3432,7 +3441,7 @@
 	  break;
 
 	/* Indirect .sdata2 relocation */
-	case (int)R_PPC_EMB_SDA2I16:
+	case (int) R_PPC_EMB_SDA2I16:
 	  BFD_ASSERT (sdata2 != NULL);
 	  relocation = bfd_elf32_finish_pointer_linker_section (output_bfd, input_bfd, info,
 								sdata2, h, relocation, rel,
@@ -3443,8 +3452,8 @@
 	   section, not the actual VMA.  This is appropriate when generating
 	   an embedded ELF object, for which the .got section acts like the
 	   AIX .toc section.  */
-	case (int)R_PPC_TOC16:			/* phony GOT16 relocations */
-	  BFD_ASSERT (sec != (asection *)0);
+	case (int) R_PPC_TOC16:			/* phony GOT16 relocations */
+	  BFD_ASSERT (sec != (asection *) 0);
 	  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)
@@ -3452,7 +3461,7 @@
 	  addend -= sec->output_section->vma + sec->output_offset + 0x8000;
 	  break;
 
-	case (int)R_PPC_PLTREL24:
+	case (int) R_PPC_PLTREL24:
 	  /* Relocation is to the entry for this symbol in the
              procedure linkage table.  */
 	  BFD_ASSERT (h != NULL);
@@ -3469,14 +3478,14 @@
 	  relocation = (splt->output_section->vma
 			+ splt->output_offset
 			+ h->plt.offset);
- 	  break;
+	  break;
 
 	/* relocate against _SDA_BASE_ */
-	case (int)R_PPC_SDAREL16:
+	case (int) R_PPC_SDAREL16:
 	  {
 	    const char *name;
 
-	    BFD_ASSERT (sec != (asection *)0);
+	    BFD_ASSERT (sec != (asection *) 0);
 	    name = bfd_get_section_name (abfd, sec->output_section);
 	    if (strcmp (name, ".sdata") != 0
 		&& strcmp (name, ".sbss") != 0)
@@ -3484,7 +3493,7 @@
 		(*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
 				       bfd_get_filename (input_bfd),
 				       sym_name,
-				       ppc_elf_howto_table[ (int)r_type ]->name,
+				       ppc_elf_howto_table[(int) r_type]->name,
 				       name);
 	      }
 	    addend -= (sdata->sym_hash->root.u.def.value
@@ -3493,22 +3502,21 @@
 	  }
 	  break;
 
-
 	/* relocate against _SDA2_BASE_ */
-	case (int)R_PPC_EMB_SDA2REL:
+	case (int) R_PPC_EMB_SDA2REL:
 	  {
 	    const char *name;
 
-	    BFD_ASSERT (sec != (asection *)0);
+	    BFD_ASSERT (sec != (asection *) 0);
 	    name = bfd_get_section_name (abfd, sec->output_section);
 	    if (strcmp (name, ".sdata2") != 0 && strcmp (name, ".sbss2") != 0)
 	      {
 		(*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
 				       bfd_get_filename (input_bfd),
 				       sym_name,
-				       ppc_elf_howto_table[ (int)r_type ]->name,
+				       ppc_elf_howto_table[(int) r_type]->name,
 				       name);
-		
+
 		bfd_set_error (bfd_error_bad_value);
 		ret = false;
 		continue;
@@ -3519,15 +3527,14 @@
 	  }
 	  break;
 
-
 	/* relocate against either _SDA_BASE_, _SDA2_BASE_, or 0 */
-	case (int)R_PPC_EMB_SDA21:
-	case (int)R_PPC_EMB_RELSDA:
+	case (int) R_PPC_EMB_SDA21:
+	case (int) R_PPC_EMB_RELSDA:
 	  {
 	    const char *name;
 	    int reg;
 
-	    BFD_ASSERT (sec != (asection *)0);
+	    BFD_ASSERT (sec != (asection *) 0);
 	    name = bfd_get_section_name (abfd, sec->output_section);
 	    if (strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0)
 	      {
@@ -3537,7 +3544,8 @@
 			   + sdata->sym_hash->root.u.def.section->output_offset);
 	      }
 
-	    else if (strcmp (name, ".sdata2") == 0 || strcmp (name, ".sbss2") == 0)
+	    else if (strcmp (name, ".sdata2") == 0
+		     || strcmp (name, ".sbss2") == 0)
 	      {
 		reg = 2;
 		addend -= (sdata2->sym_hash->root.u.def.value
@@ -3545,7 +3553,8 @@
 			   + sdata2->sym_hash->root.u.def.section->output_offset);
 	      }
 
-	    else if (strcmp (name, ".PPC.EMB.sdata0") == 0 || strcmp (name, ".PPC.EMB.sbss0") == 0)
+	    else if (strcmp (name, ".PPC.EMB.sdata0") == 0
+		     || strcmp (name, ".PPC.EMB.sbss0") == 0)
 	      {
 		reg = 0;
 	      }
@@ -3555,7 +3564,7 @@
 		(*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
 				       bfd_get_filename (input_bfd),
 				       sym_name,
-				       ppc_elf_howto_table[ (int)r_type ]->name,
+				       ppc_elf_howto_table[(int) r_type]->name,
 				       name);
 
 		bfd_set_error (bfd_error_bad_value);
@@ -3573,75 +3582,74 @@
 	  break;
 
 	/* Relocate against the beginning of the section */
-	case (int)R_PPC_SECTOFF:
-	case (int)R_PPC_SECTOFF_LO:
-	case (int)R_PPC_SECTOFF_HI:
-	  BFD_ASSERT (sec != (asection *)0);
+	case (int) R_PPC_SECTOFF:
+	case (int) R_PPC_SECTOFF_LO:
+	case (int) R_PPC_SECTOFF_HI:
+	  BFD_ASSERT (sec != (asection *) 0);
 	  addend -= sec->output_section->vma;
 	  break;
 
-	case (int)R_PPC_SECTOFF_HA:
-	  BFD_ASSERT (sec != (asection *)0);
+	case (int) R_PPC_SECTOFF_HA:
+	  BFD_ASSERT (sec != (asection *) 0);
 	  addend -= sec->output_section->vma;
 	  addend += ((relocation + addend) & 0x8000) << 1;
 	  break;
 
 	/* Negative relocations */
-	case (int)R_PPC_EMB_NADDR32:
-	case (int)R_PPC_EMB_NADDR16:
-	case (int)R_PPC_EMB_NADDR16_LO:
-	case (int)R_PPC_EMB_NADDR16_HI:
-	  addend -= 2*relocation;
+	case (int) R_PPC_EMB_NADDR32:
+	case (int) R_PPC_EMB_NADDR16:
+	case (int) R_PPC_EMB_NADDR16_LO:
+	case (int) R_PPC_EMB_NADDR16_HI:
+	  addend -= 2 * relocation;
 	  break;
 
-	case (int)R_PPC_EMB_NADDR16_HA:
-	  addend -= 2*relocation;
+	case (int) R_PPC_EMB_NADDR16_HA:
+	  addend -= 2 * relocation;
 	  addend += ((relocation + addend) & 0x8000) << 1;
 	  break;
 
 	/* NOP relocation that prevents garbage collecting linkers from omitting a
 	   reference.  */
-	case (int)R_PPC_EMB_MRKREF:
+	case (int) R_PPC_EMB_MRKREF:
 	  continue;
 
-	case (int)R_PPC_COPY:
-	case (int)R_PPC_GLOB_DAT:
-	case (int)R_PPC_JMP_SLOT:
-	case (int)R_PPC_RELATIVE:
-	case (int)R_PPC_PLT32:
-	case (int)R_PPC_PLTREL32:
-	case (int)R_PPC_PLT16_LO:
-	case (int)R_PPC_PLT16_HI:
-	case (int)R_PPC_PLT16_HA:
-	case (int)R_PPC_EMB_RELSEC16:
-	case (int)R_PPC_EMB_RELST_LO:
-	case (int)R_PPC_EMB_RELST_HI:
-	case (int)R_PPC_EMB_RELST_HA:
-	case (int)R_PPC_EMB_BIT_FLD:
+	case (int) R_PPC_COPY:
+	case (int) R_PPC_GLOB_DAT:
+	case (int) R_PPC_JMP_SLOT:
+	case (int) R_PPC_RELATIVE:
+	case (int) R_PPC_PLT32:
+	case (int) R_PPC_PLTREL32:
+	case (int) R_PPC_PLT16_LO:
+	case (int) R_PPC_PLT16_HI:
+	case (int) R_PPC_PLT16_HA:
+	case (int) R_PPC_EMB_RELSEC16:
+	case (int) R_PPC_EMB_RELST_LO:
+	case (int) R_PPC_EMB_RELST_HI:
+	case (int) R_PPC_EMB_RELST_HA:
+	case (int) R_PPC_EMB_BIT_FLD:
 	  (*_bfd_error_handler) (_("%s: Relocation %s is not yet supported for symbol %s."),
 				 bfd_get_filename (input_bfd),
-				 ppc_elf_howto_table[ (int)r_type ]->name,
+				 ppc_elf_howto_table[(int) r_type]->name,
 				 sym_name);
 
 	  bfd_set_error (bfd_error_invalid_operation);
 	  ret = false;
 	  continue;
 
-	case (int)R_PPC_GNU_VTINHERIT:
-	case (int)R_PPC_GNU_VTENTRY:
+	case (int) R_PPC_GNU_VTINHERIT:
+	case (int) R_PPC_GNU_VTENTRY:
 	  /* These are no-ops in the end.  */
 	  continue;
 	}
 
-
 #ifdef DEBUG
       fprintf (stderr, "\ttype = %s (%d), name = %s, symbol index = %ld, offset = %ld, addend = %ld\n",
 	       howto->name,
-	       (int)r_type,
+	       (int) r_type,
 	       sym_name,
 	       r_symndx,
-	       (long)offset,
-	       (long)addend);
+	       (long) offset,
+	       (long) addend);
 #endif
 
       r = _bfd_final_link_relocate (howto,
@@ -3685,7 +3693,7 @@
 		name = bfd_section_name (input_bfd, sec);
 	    }
 
-	  if (! (*info->callbacks->reloc_overflow)(info,
+	  if (! (*info->callbacks->reloc_overflow) (info,
 						   name,
 						   howto->name,
 						   (bfd_vma) 0,
@@ -3704,7 +3712,6 @@
 
   return ret;
 }
-
 
 #define TARGET_LITTLE_SYM	bfd_elf32_powerpcle_vec
 #define TARGET_LITTLE_NAME	"elf32-powerpcle"
diff --git a/bfd/elf32-sh-lin.c b/bfd/elf32-sh-lin.c
new file mode 100644
index 0000000..1ee0a87
--- /dev/null
+++ b/bfd/elf32-sh-lin.c
@@ -0,0 +1,29 @@
+/* Hitachi SH specific support for 32-bit Linux
+   Copyright 2000 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 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.  */
+
+#define TARGET_BIG_SYM bfd_elf32_shblin_vec
+#define TARGET_BIG_NAME "elf32-shbig-linux"
+#define TARGET_LITTLE_SYM bfd_elf32_shlin_vec
+#define TARGET_LITTLE_NAME "elf32-sh-linux"
+#define ELF_ARCH bfd_arch_sh
+#define ELF_MACHINE_CODE EM_SH
+#define ELF_MAXPAGESIZE 0x10000
+#define elf_symbol_leading_char 0
+
+#include "elf32-sh.c"
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 7fe30ef..1648b71 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -39,7 +39,7 @@
   PARAMS ((bfd *, bfd *));
 static boolean sh_elf_merge_private_data
   PARAMS ((bfd *, bfd *));
-boolean sh_elf_set_mach_from_flags
+static boolean sh_elf_set_mach_from_flags
   PARAMS ((bfd *));
 static boolean sh_elf_relax_section
   PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
@@ -55,6 +55,27 @@
 static bfd_byte *sh_elf_get_relocated_section_contents
   PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
 	   bfd_byte *, boolean, asymbol **));
+static boolean sh_elf_check_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, asection *,
+	   const Elf_Internal_Rela *));
+static struct bfd_hash_entry *sh_elf_link_hash_newfunc
+  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+static struct bfd_link_hash_table *sh_elf_link_hash_table_create
+  PARAMS ((bfd *));
+static boolean sh_elf_adjust_dynamic_symbol
+  PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+static boolean sh_elf_size_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+static boolean sh_elf_finish_dynamic_symbol
+  PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
+	   Elf_Internal_Sym *));
+static boolean sh_elf_finish_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
+
+/* The name of the dynamic interpreter.  This is put in the .interp
+   section.  */
+
+#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1"
 
 static reloc_howto_type sh_elf_howto_table[] =
 {
@@ -450,12 +471,247 @@
 	 0xff,			/* dst_mask */
 	 true),			/* pcrel_offset */
 
+  EMPTY_HOWTO (38),
+  EMPTY_HOWTO (39),
+  EMPTY_HOWTO (40),
+  EMPTY_HOWTO (41),
+  EMPTY_HOWTO (42),
+  EMPTY_HOWTO (43),
+  EMPTY_HOWTO (44),
+  EMPTY_HOWTO (45),
+  EMPTY_HOWTO (46),
+  EMPTY_HOWTO (47),
+  EMPTY_HOWTO (48),
+  EMPTY_HOWTO (49),
+  EMPTY_HOWTO (50),
+  EMPTY_HOWTO (51),
+  EMPTY_HOWTO (52),
+  EMPTY_HOWTO (53),
+  EMPTY_HOWTO (54),
+  EMPTY_HOWTO (55),
+  EMPTY_HOWTO (56),
+  EMPTY_HOWTO (57),
+  EMPTY_HOWTO (58),
+  EMPTY_HOWTO (59),
+  EMPTY_HOWTO (60),
+  EMPTY_HOWTO (61),
+  EMPTY_HOWTO (62),
+  EMPTY_HOWTO (63),
+  EMPTY_HOWTO (64),
+  EMPTY_HOWTO (65),
+  EMPTY_HOWTO (66),
+  EMPTY_HOWTO (67),
+  EMPTY_HOWTO (68),
+  EMPTY_HOWTO (69),
+  EMPTY_HOWTO (70),
+  EMPTY_HOWTO (71),
+  EMPTY_HOWTO (72),
+  EMPTY_HOWTO (73),
+  EMPTY_HOWTO (74),
+  EMPTY_HOWTO (75),
+  EMPTY_HOWTO (76),
+  EMPTY_HOWTO (77),
+  EMPTY_HOWTO (78),
+  EMPTY_HOWTO (79),
+  EMPTY_HOWTO (80),
+  EMPTY_HOWTO (81),
+  EMPTY_HOWTO (82),
+  EMPTY_HOWTO (83),
+  EMPTY_HOWTO (84),
+  EMPTY_HOWTO (85),
+  EMPTY_HOWTO (86),
+  EMPTY_HOWTO (87),
+  EMPTY_HOWTO (88),
+  EMPTY_HOWTO (89),
+  EMPTY_HOWTO (90),
+  EMPTY_HOWTO (91),
+  EMPTY_HOWTO (92),
+  EMPTY_HOWTO (93),
+  EMPTY_HOWTO (94),
+  EMPTY_HOWTO (95),
+  EMPTY_HOWTO (96),
+  EMPTY_HOWTO (97),
+  EMPTY_HOWTO (98),
+  EMPTY_HOWTO (99),
+  EMPTY_HOWTO (100),
+  EMPTY_HOWTO (101),
+  EMPTY_HOWTO (102),
+  EMPTY_HOWTO (103),
+  EMPTY_HOWTO (104),
+  EMPTY_HOWTO (105),
+  EMPTY_HOWTO (106),
+  EMPTY_HOWTO (107),
+  EMPTY_HOWTO (108),
+  EMPTY_HOWTO (109),
+  EMPTY_HOWTO (110),
+  EMPTY_HOWTO (111),
+  EMPTY_HOWTO (112),
+  EMPTY_HOWTO (113),
+  EMPTY_HOWTO (114),
+  EMPTY_HOWTO (115),
+  EMPTY_HOWTO (116),
+  EMPTY_HOWTO (117),
+  EMPTY_HOWTO (118),
+  EMPTY_HOWTO (119),
+  EMPTY_HOWTO (120),
+  EMPTY_HOWTO (121),
+  EMPTY_HOWTO (122),
+  EMPTY_HOWTO (123),
+  EMPTY_HOWTO (124),
+  EMPTY_HOWTO (125),
+  EMPTY_HOWTO (126),
+  EMPTY_HOWTO (127),
+  EMPTY_HOWTO (128),
+  EMPTY_HOWTO (129),
+  EMPTY_HOWTO (130),
+  EMPTY_HOWTO (131),
+  EMPTY_HOWTO (132),
+  EMPTY_HOWTO (133),
+  EMPTY_HOWTO (134),
+  EMPTY_HOWTO (135),
+  EMPTY_HOWTO (136),
+  EMPTY_HOWTO (137),
+  EMPTY_HOWTO (138),
+  EMPTY_HOWTO (139),
+  EMPTY_HOWTO (140),
+  EMPTY_HOWTO (141),
+  EMPTY_HOWTO (142),
+  EMPTY_HOWTO (143),
+  EMPTY_HOWTO (144),
+  EMPTY_HOWTO (145),
+  EMPTY_HOWTO (146),
+  EMPTY_HOWTO (147),
+  EMPTY_HOWTO (148),
+  EMPTY_HOWTO (149),
+  EMPTY_HOWTO (150),
+  EMPTY_HOWTO (151),
+  EMPTY_HOWTO (152),
+  EMPTY_HOWTO (153),
+  EMPTY_HOWTO (154),
+  EMPTY_HOWTO (155),
+  EMPTY_HOWTO (156),
+  EMPTY_HOWTO (157),
+  EMPTY_HOWTO (158),
+  EMPTY_HOWTO (159),
+
+  HOWTO (R_SH_GOT32,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* */
+	 "R_SH_GOT32",		/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_SH_PLT32,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* */
+	 "R_SH_PLT32",		/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+
+  HOWTO (R_SH_COPY,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* */
+	 "R_SH_COPY",		/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_SH_GLOB_DAT,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* */
+	 "R_SH_GLOB_DAT",	/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_SH_JMP_SLOT,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* */
+	 "R_SH_JMP_SLOT",	/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_SH_RELATIVE,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* */
+	 "R_SH_RELATIVE",	/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_SH_GOTOFF,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* */
+	 "R_SH_GOTOFF",		/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_SH_GOTPC,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 bfd_elf_generic_reloc, /* */
+	 "R_SH_GOTPC",		/* name */
+	 true,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+
 };
 
 static bfd_reloc_status_type
 sh_elf_reloc_loop (r_type, input_bfd, input_section, contents, addr,
-                   symbol_section, start, end)
-     int r_type;
+		   symbol_section, start, end)
+     int r_type ATTRIBUTE_UNUSED;
      bfd *input_bfd;
      asection *input_section;
      bfd_byte *contents;
@@ -464,7 +720,7 @@
      bfd_vma start, end;
 {
   static bfd_vma last_addr;
-  asection *last_symbol_section;
+  static asection *last_symbol_section;
   bfd_byte *free_contents = NULL;
   bfd_byte *start_ptr, *ptr, *last_ptr;
   int diff, cum_diff;
@@ -517,7 +773,7 @@
       for (last_ptr = ptr, ptr -= 4; ptr >= start_ptr && IS_PPI (ptr);)
 	ptr -= 2;
       ptr += 2;
-      diff = last_ptr - ptr >> 1;
+      diff = (last_ptr - ptr) >> 1;
       cum_diff += diff & 1;
       cum_diff += diff;
     }
@@ -533,7 +789,7 @@
     {
       bfd_vma start0 = start - 4;
 
-      while (start0 >= 0 && IS_PPI (contents + start0))
+      while (start0 && IS_PPI (contents + start0))
 	start0 -= 2;
       start0 = start - 2 - ((start - start0) & 2);
       start = start0 - cum_diff - 2;
@@ -554,7 +810,7 @@
   if (x < -128 || x > 127)
     return bfd_reloc_overflow;
 
-  x = insn & ~0xff | x & 0xff;
+  x = (insn & ~0xff) | (x & 0xff);
   bfd_put_16 (input_bfd, x, contents + addr);
 
   return bfd_reloc_ok;
@@ -565,7 +821,7 @@
 
 static bfd_reloc_status_type
 sh_elf_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
-	  error_message)
+	      error_message)
      bfd *abfd;
      arelent *reloc_entry;
      asymbol *symbol_in;
@@ -599,8 +855,8 @@
     return bfd_reloc_undefined;
 
   if (bfd_is_com_section (symbol_in->section))
-    sym_value = 0;                           
-  else 
+    sym_value = 0;
+  else
     sym_value = (symbol_in->value +
 		 symbol_in->section->output_section->vma +
 		 symbol_in->section->output_offset);
@@ -687,6 +943,14 @@
   { BFD_RELOC_VTABLE_ENTRY, R_SH_GNU_VTENTRY },
   { BFD_RELOC_SH_LOOP_START, R_SH_LOOP_START },
   { BFD_RELOC_SH_LOOP_END, R_SH_LOOP_END },
+  { BFD_RELOC_32_GOT_PCREL, R_SH_GOT32 },
+  { BFD_RELOC_32_PLT_PCREL, R_SH_PLT32 },
+  { BFD_RELOC_SH_COPY, R_SH_COPY },
+  { BFD_RELOC_SH_GLOB_DAT, R_SH_GLOB_DAT },
+  { BFD_RELOC_SH_JMP_SLOT, R_SH_JMP_SLOT },
+  { BFD_RELOC_SH_RELATIVE, R_SH_RELATIVE },
+  { BFD_RELOC_32_GOTOFF, R_SH_GOTOFF },
+  { BFD_RELOC_SH_GOTPC, R_SH_GOTPC },
 };
 
 /* Given a BFD reloc code, return the howto structure for the
@@ -722,6 +986,7 @@
 
   BFD_ASSERT (r < (unsigned int) R_SH_max);
   BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC || r > R_SH_LAST_INVALID_RELOC);
+  BFD_ASSERT (r < R_SH_FIRST_INVALID_RELOC_2 || r > R_SH_LAST_INVALID_RELOC_2);
 
   cache_ptr->howto = &sh_elf_howto_table[r];
 }
@@ -736,7 +1001,7 @@
    values; in coff-sh.c they come from include/coff/sh.h, whereas here
    they come from enum elf_sh_reloc_type in include/elf/sh.h.  */
 
-static boolean 
+static boolean
 sh_elf_relax_section (abfd, sec, link_info, again)
      bfd *abfd;
      asection *sec;
@@ -841,7 +1106,7 @@
       	 on a four byte boundary.  */
       paddr = insn & 0xff;
       paddr *= 4;
-      paddr += (laddr + 4) &~ 3;
+      paddr += (laddr + 4) & ~3;
       if (paddr >= sec->_raw_size)
 	{
 	  ((*_bfd_error_handler)
@@ -1299,7 +1564,7 @@
 
 	case R_SH_DIR8WPL:
 	  off = insn & 0xff;
-	  stop = (start &~ (bfd_vma) 3) + 4 + off * 4;
+	  stop = (start & ~(bfd_vma) 3) + 4 + off * 4;
 	  break;
 
 	case R_SH_SWITCH8:
@@ -1819,6 +2084,769 @@
   return true;
 }
 
+/* The size in bytes of an entry in the procedure linkage table.  */
+
+#define PLT_ENTRY_SIZE 28
+
+/* First entry in an absolute procedure linkage table look like this.  */
+
+static const bfd_byte elf_sh_plt0_entry_be[PLT_ENTRY_SIZE] =
+{
+  0xd0, 0x04,	/* mov.l 1f,r0 */
+  0xd2, 0x05,	/* mov.l 2f,r2 */
+  0x60, 0x02,	/* mov.l @r0,r0 */
+  0x62, 0x22,	/* mov.l @r2,r2 */
+  0x40, 0x2b,	/* jmp @r0 */
+  0xe0, 0x00,	/*  mov #0,r0 */
+  0x00, 0x09,	/* nop */
+  0x00, 0x09,	/* nop */
+  0x00, 0x09,	/* nop */
+  0x00, 0x09,	/* nop */
+  0, 0, 0, 0,	/* 1: replaced with address of .got.plt + 8.  */
+  0, 0, 0, 0,	/* 2: replaced with address of .got.plt + 4.  */
+};
+
+static const bfd_byte elf_sh_plt0_entry_le[PLT_ENTRY_SIZE] =
+{
+  0x04, 0xd0,	/* mov.l 1f,r0 */
+  0x05, 0xd2,	/* mov.l 2f,r2 */
+  0x02, 0x60,	/* mov.l @r0,r0 */
+  0x22, 0x62,	/* mov.l @r2,r2 */
+  0x2b, 0x40,	/* jmp @r0 */
+  0x00, 0xe0,	/*  mov #0,r0 */
+  0x09, 0x00,	/* nop */
+  0x09, 0x00,	/* nop */
+  0x09, 0x00,	/* nop */
+  0x09, 0x00,	/* nop */
+  0, 0, 0, 0,	/* 1: replaced with address of .got.plt + 8.  */
+  0, 0, 0, 0,	/* 2: replaced with address of .got.plt + 4.  */
+};
+
+/* Sebsequent entries in an absolute procedure linkage table look like
+   this.  */
+
+static const bfd_byte elf_sh_plt_entry_be[PLT_ENTRY_SIZE] =
+{
+  0xd0, 0x04,	/* mov.l 1f,r0 */
+  0x60, 0x02,	/* mov.l @r0,r0 */
+  0xd2, 0x02,	/* mov.l 0f,r2 */
+  0x40, 0x2b,   /* jmp @r0 */
+  0x60, 0x23,	/*  mov r2,r0 */
+  0xd1, 0x03,	/* mov.l 2f,r1 */
+  0x40, 0x2b,	/* jmp @r0 */
+  0x00, 0x09,	/* nop */
+  0, 0, 0, 0,	/* 0: replaced with address of .PLT0.  */
+  0, 0, 0, 0,	/* 1: replaced with address of this symbol in .got.  */
+  0, 0, 0, 0,	/* 2: replaced with offset into relocation table.  */
+};
+
+static const bfd_byte elf_sh_plt_entry_le[PLT_ENTRY_SIZE] =
+{
+  0x04, 0xd0,	/* mov.l 1f,r0 */
+  0x02, 0x60,	/* mov.l @r0,r0 */
+  0x02, 0xd2,	/* mov.l 0f,r2 */
+  0x2b, 0x40,   /* jmp @r0 */
+  0x23, 0x60,	/*  mov r2,r0 */
+  0x03, 0xd1,	/* mov.l 2f,r1 */
+  0x2b, 0x40,	/* jmp @r0 */
+  0x09, 0x00,	/*  nop */
+  0, 0, 0, 0,	/* 0: replaced with address of .PLT.  */
+  0, 0, 0, 0,	/* 1: replaced with address of this symbol in .got.  */
+  0, 0, 0, 0,	/* 2: replaced with offset into relocation table.  */
+};
+
+/* Entries in a PIC procedure linkage table look like this.  */
+
+static const bfd_byte elf_sh_pic_plt_entry_be[PLT_ENTRY_SIZE] =
+{
+  0xd0, 0x04,	/* mov.l 1f,r0 */
+  0x00, 0xce,	/* mov.l @(r0,r12),r0 */
+  0x40, 0x2b,	/* jmp @r0 */
+  0x00, 0x09,	/*  nop */
+  0x50, 0xc2,	/* 0: mov.l @(8,r12),r0 */
+  0x52, 0xc1,	/* 1: mov.l @(4,r12),r2 */
+  0xd1, 0x02,	/* mov.l 2f,r1 */
+  0x40, 0x2b,	/* jmp @r0 */
+  0xe0, 0x00,	/*  mov #0,r0 ! shows the type of PLT.  */
+  0x00, 0x09,	/* nop */
+  0, 0, 0, 0,	/* 1: replaced with address of this symbol in .got.  */
+  0, 0, 0, 0    /* 2: replaced with offset into relocation table.  */
+};
+
+static const bfd_byte elf_sh_pic_plt_entry_le[PLT_ENTRY_SIZE] =
+{
+  0x04, 0xd0,	/* mov.l 1f,r0 */
+  0xce, 0x00,	/* mov.l @(r0,r12),r0 */
+  0x2b, 0x40,	/* jmp @r0 */
+  0x09, 0x00,	/*  nop */
+  0xc2, 0x50,	/* 0: mov.l @(8,r12),r0 */
+  0xc1, 0x52,	/* 1: mov.l @(4,r12),r2 */
+  0x02, 0xd1,	/* mov.l 2f,r1 */
+  0x2b, 0x40,	/* jmp @r0 */
+  0x00, 0xe0,	/*  mov #0,r0 ! shows the type of PLT.  */
+  0x09, 0x00,	/* nop */
+  0, 0, 0, 0,	/* 1: replaced with address of this symbol in .got.  */
+  0, 0, 0, 0    /* 2: replaced with offset into relocation table.  */
+};
+
+static const bfd_byte *elf_sh_plt0_entry;
+static const bfd_byte *elf_sh_plt_entry;
+static const bfd_byte *elf_sh_pic_plt_entry;
+
+/* Return size of a PLT entry.  */
+#define elf_sh_sizeof_plt(info) PLT_ENTRY_SIZE
+
+/* Return offset of the PLT0 address in an absolute PLT entry.  */
+#define elf_sh_plt_plt0_offset(info) 16
+
+/* Return offset of the linker in PLT0 entry.  */
+#define elf_sh_plt0_linker_offset(info) 20
+
+/* Return offset of the GOT id in PLT0 entry.  */
+#define elf_sh_plt0_gotid_offset(info) 24
+
+/* Return offset of the tempoline in PLT entry */
+#define elf_sh_plt_temp_offset(info) 8
+
+/* Return offset of the symbol in PLT entry.  */
+#define elf_sh_plt_symbol_offset(info) 20
+
+/* Return offset of the relocation in PLT entry.  */
+#define elf_sh_plt_reloc_offset(info) 24
+
+/* The sh linker needs to keep track of the number of relocs that it
+   decides to copy in check_relocs for each symbol.  This is so that
+   it can discard PC relative relocs if it doesn't need them when
+   linking with -Bsymbolic.  We store the information in a field
+   extending the regular ELF linker hash table.  */
+
+/* This structure keeps track of the number of PC relative relocs we
+   have copied for a given symbol.  */
+
+struct elf_sh_pcrel_relocs_copied
+{
+  /* Next section.  */
+  struct elf_sh_pcrel_relocs_copied *next;
+  /* A section in dynobj.  */
+  asection *section;
+  /* Number of relocs copied in this section.  */
+  bfd_size_type count;
+};
+
+/* sh ELF linker hash entry.  */
+
+struct elf_sh_link_hash_entry
+{
+  struct elf_link_hash_entry root;
+
+  /* Number of PC relative relocs copied for this symbol.  */
+  struct elf_sh_pcrel_relocs_copied *pcrel_relocs_copied;
+};
+
+/* sh ELF linker hash table.  */
+
+struct elf_sh_link_hash_table
+{
+  struct elf_link_hash_table root;
+};
+
+/* Declare this now that the above structures are defined.  */
+
+static boolean sh_elf_discard_copies
+  PARAMS ((struct elf_sh_link_hash_entry *, PTR));
+
+/* Traverse an sh ELF linker hash table.  */
+
+#define sh_elf_link_hash_traverse(table, func, info)			\
+  (elf_link_hash_traverse						\
+   (&(table)->root,							\
+    (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func),	\
+    (info)))
+
+/* Get the sh ELF linker hash table from a link_info structure.  */
+
+#define sh_elf_hash_table(p) \
+  ((struct elf_sh_link_hash_table *) ((p)->hash))
+
+/* Create an entry in an sh ELF linker hash table.  */
+
+static struct bfd_hash_entry *
+sh_elf_link_hash_newfunc (entry, table, string)
+     struct bfd_hash_entry *entry;
+     struct bfd_hash_table *table;
+     const char *string;
+{
+  struct elf_sh_link_hash_entry *ret =
+    (struct elf_sh_link_hash_entry *) entry;
+
+  /* Allocate the structure if it has not already been allocated by a
+     subclass.  */
+  if (ret == (struct elf_sh_link_hash_entry *) NULL)
+    ret = ((struct elf_sh_link_hash_entry *)
+	   bfd_hash_allocate (table,
+			      sizeof (struct elf_sh_link_hash_entry)));
+  if (ret == (struct elf_sh_link_hash_entry *) NULL)
+    return (struct bfd_hash_entry *) ret;
+
+  /* Call the allocation method of the superclass.  */
+  ret = ((struct elf_sh_link_hash_entry *)
+	 _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
+				     table, string));
+  if (ret != (struct elf_sh_link_hash_entry *) NULL)
+    {
+      ret->pcrel_relocs_copied = NULL;
+    }
+
+  return (struct bfd_hash_entry *) ret;
+}
+
+/* Create an sh ELF linker hash table.  */
+
+static struct bfd_link_hash_table *
+sh_elf_link_hash_table_create (abfd)
+     bfd *abfd;
+{
+  struct elf_sh_link_hash_table *ret;
+
+  ret = ((struct elf_sh_link_hash_table *)
+	 bfd_alloc (abfd, sizeof (struct elf_sh_link_hash_table)));
+  if (ret == (struct elf_sh_link_hash_table *) NULL)
+    return NULL;
+
+  if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
+				       sh_elf_link_hash_newfunc))
+    {
+      bfd_release (abfd, ret);
+      return NULL;
+    }
+
+  return &ret->root.root;
+}
+
+/* Create dynamic sections when linking against a dynamic object.  */
+
+static boolean
+sh_elf_create_dynamic_sections (abfd, info)
+     bfd *abfd;
+     struct bfd_link_info *info;
+{
+  flagword flags, pltflags;
+  register asection *s;
+  struct elf_backend_data *bed = get_elf_backend_data (abfd);
+  int ptralign = 0;
+
+  switch (bed->s->arch_size)
+    {
+    case 32:
+      ptralign = 2;
+      break;
+
+    case 64:
+      ptralign = 3;
+      break;
+
+    default:
+      bfd_set_error (bfd_error_bad_value);
+      return false;
+    }
+
+  /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and
+     .rel[a].bss sections.  */
+
+  flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+	   | SEC_LINKER_CREATED);
+
+  pltflags = flags;
+  pltflags |= SEC_CODE;
+  if (bed->plt_not_loaded)
+    pltflags &= ~ (SEC_LOAD | SEC_HAS_CONTENTS);
+  if (bed->plt_readonly)
+    pltflags |= SEC_READONLY;
+
+  s = bfd_make_section (abfd, ".plt");
+  if (s == NULL
+      || ! bfd_set_section_flags (abfd, s, pltflags)
+      || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment))
+    return false;
+
+  if (bed->want_plt_sym)
+    {
+      /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
+	 .plt section.  */
+      struct elf_link_hash_entry *h = NULL;
+      if (! (_bfd_generic_link_add_one_symbol
+	     (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s,
+	      (bfd_vma) 0, (const char *) NULL, false,
+	      get_elf_backend_data (abfd)->collect,
+	      (struct bfd_link_hash_entry **) &h)))
+	return false;
+      h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+      h->type = STT_OBJECT;
+
+      if (info->shared
+	  && ! _bfd_elf_link_record_dynamic_symbol (info, h))
+	return false;
+    }
+
+  s = bfd_make_section (abfd,
+			bed->default_use_rela_p ? ".rela.plt" : ".rel.plt");
+  if (s == NULL
+      || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+      || ! bfd_set_section_alignment (abfd, s, ptralign))
+    return false;
+
+  if (! _bfd_elf_create_got_section (abfd, info))
+    return false;
+
+  {
+    const char *secname;
+    char *relname;
+    flagword secflags;
+    asection *sec;
+
+    for (sec = abfd->sections; sec; sec = sec->next)
+      {
+	secflags = bfd_get_section_flags (abfd, sec);
+	if ((secflags & (SEC_DATA | SEC_LINKER_CREATED))
+	    || ((secflags & SEC_HAS_CONTENTS) != SEC_HAS_CONTENTS))
+	  continue;
+	secname = bfd_get_section_name (abfd, sec);
+	relname = (char *) bfd_malloc (strlen (secname) + 6);
+	strcpy (relname, ".rela");
+	strcat (relname, secname);
+	s = bfd_make_section (abfd, relname);
+	if (s == NULL
+	    || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+	    || ! bfd_set_section_alignment (abfd, s, ptralign))
+	  return false;
+      }
+  }
+
+  if (bed->want_dynbss)
+    {
+      /* The .dynbss section is a place to put symbols which are defined
+	 by dynamic objects, are referenced by regular objects, and are
+	 not functions.  We must allocate space for them in the process
+	 image and use a R_*_COPY reloc to tell the dynamic linker to
+	 initialize them at run time.  The linker script puts the .dynbss
+	 section into the .bss section of the final image.  */
+      s = bfd_make_section (abfd, ".dynbss");
+      if (s == NULL
+	  || ! bfd_set_section_flags (abfd, s, SEC_ALLOC))
+	return false;
+
+      /* The .rel[a].bss section holds copy relocs.  This section is not
+	 normally needed.  We need to create it here, though, so that the
+	 linker will map it to an output section.  We can't just create it
+	 only if we need it, because we will not know whether we need it
+	 until we have seen all the input files, and the first time the
+	 main linker code calls BFD after examining all the input files
+	 (size_dynamic_sections) the input sections have already been
+	 mapped to the output sections.  If the section turns out not to
+	 be needed, we can discard it later.  We will never need this
+	 section when generating a shared object, since they do not use
+	 copy relocs.  */
+      if (! info->shared)
+	{
+	  s = bfd_make_section (abfd,
+				(bed->default_use_rela_p
+				 ? ".rela.bss" : ".rel.bss"));
+	  if (s == NULL
+	      || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+	      || ! bfd_set_section_alignment (abfd, s, ptralign))
+	    return false;
+	}
+    }
+
+  return true;
+}
+
+/* Adjust a symbol defined by a dynamic object and referenced by a
+   regular object.  The current definition is in some section of the
+   dynamic object, but we're not including those sections.  We have to
+   change the definition to something the rest of the link can
+   understand.  */
+
+static boolean
+sh_elf_adjust_dynamic_symbol (info, h)
+     struct bfd_link_info *info;
+     struct elf_link_hash_entry *h;
+{
+  bfd *dynobj;
+  asection *s;
+  unsigned int power_of_two;
+
+  dynobj = elf_hash_table (info)->dynobj;
+
+  /* Make sure we know what is going on here.  */
+  BFD_ASSERT (dynobj != NULL
+	      && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
+		  || h->weakdef != NULL
+		  || ((h->elf_link_hash_flags
+		       & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+		      && (h->elf_link_hash_flags
+			  & ELF_LINK_HASH_REF_REGULAR) != 0
+		      && (h->elf_link_hash_flags
+			  & ELF_LINK_HASH_DEF_REGULAR) == 0)));
+
+  /* If this is a function, put it in the procedure linkage table.  We
+     will fill in the contents of the procedure linkage table later,
+     when we know the address of the .got section.  */
+  if (h->type == STT_FUNC
+      || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
+    {
+      if (! info->shared
+	  && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
+	  && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0)
+	{
+	  /* This case can occur if we saw a PLT reloc in an input
+	     file, but the symbol was never referred to by a dynamic
+	     object.  In such a case, we don't actually need to build
+	     a procedure linkage table, and we can just do a REL32
+	     reloc instead.  */
+	  BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0);
+	  return true;
+	}
+
+      /* Make sure this symbol is output as a dynamic symbol.  */
+      if (h->dynindx == -1)
+	{
+	  if (! bfd_elf32_link_record_dynamic_symbol (info, h))
+	    return false;
+	}
+
+      s = bfd_get_section_by_name (dynobj, ".plt");
+      BFD_ASSERT (s != NULL);
+
+      /* If this is the first .plt entry, make room for the special
+	 first entry.  */
+      if (s->_raw_size == 0)
+	s->_raw_size += PLT_ENTRY_SIZE;
+
+      /* If this symbol is not defined in a regular file, and we are
+	 not generating a shared library, then set the symbol to this
+	 location in the .plt.  This is required to make function
+	 pointers compare as equal between the normal executable and
+	 the shared library.  */
+      if (! info->shared
+	  && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+	{
+	  h->root.u.def.section = s;
+	  h->root.u.def.value = s->_raw_size;
+	}
+
+      h->plt.offset = s->_raw_size;
+
+      /* Make room for this entry.  */
+      s->_raw_size += elf_sh_sizeof_plt (info);
+
+      /* We also need to make an entry in the .got.plt section, which
+	 will be placed in the .got section by the linker script.  */
+
+      s = bfd_get_section_by_name (dynobj, ".got.plt");
+      BFD_ASSERT (s != NULL);
+      s->_raw_size += 4;
+
+      /* We also need to make an entry in the .rela.plt section.  */
+
+      s = bfd_get_section_by_name (dynobj, ".rela.plt");
+      BFD_ASSERT (s != NULL);
+      s->_raw_size += sizeof (Elf32_External_Rela);
+
+      return true;
+    }
+
+  /* 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->weakdef != NULL)
+    {
+      BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
+		  || h->weakdef->root.type == bfd_link_hash_defweak);
+      h->root.u.def.section = h->weakdef->root.u.def.section;
+      h->root.u.def.value = h->weakdef->root.u.def.value;
+      return true;
+    }
+
+  /* This is a reference to a symbol defined by a dynamic object which
+     is not a function.  */
+
+  /* If we are creating a shared library, we must presume that the
+     only references to the symbol are via the global offset table.
+     For such cases we need not do anything here; the relocations will
+     be handled correctly by relocate_section.  */
+  if (info->shared)
+    return true;
+
+  /* If there are no references to this symbol that do not use the
+     GOT, we don't need to generate a copy reloc.  */
+  if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
+    return true;
+
+  /* We must allocate the symbol in our .dynbss section, which will
+     become part of the .bss section of the executable.  There will be
+     an entry for this symbol in the .dynsym section.  The dynamic
+     object will contain position independent code, so all references
+     from the dynamic object to this symbol will go through the global
+     offset table.  The dynamic linker will use the .dynsym entry to
+     determine the address it must put in the global offset table, so
+     both the dynamic object and the regular object will refer to the
+     same memory location for the variable.  */
+
+  s = bfd_get_section_by_name (dynobj, ".dynbss");
+  BFD_ASSERT (s != NULL);
+
+  /* We must generate a R_SH_COPY reloc to tell the dynamic linker to
+     copy the initial value out of the dynamic object and into the
+     runtime process image.  We need to remember the offset into the
+     .rela.bss section we are going to use.  */
+  if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
+    {
+      asection *srel;
+
+      srel = bfd_get_section_by_name (dynobj, ".rela.bss");
+      BFD_ASSERT (srel != NULL);
+      srel->_raw_size += sizeof (Elf32_External_Rela);
+      h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
+    }
+
+  /* We need to figure out the alignment required for this symbol.  I
+     have no idea how ELF linkers handle this.  */
+  power_of_two = bfd_log2 (h->size);
+  if (power_of_two > 3)
+    power_of_two = 3;
+
+  /* Apply the required alignment.  */
+  s->_raw_size = BFD_ALIGN (s->_raw_size,
+			    (bfd_size_type) (1 << power_of_two));
+  if (power_of_two > bfd_get_section_alignment (dynobj, s))
+    {
+      if (! bfd_set_section_alignment (dynobj, s, power_of_two))
+	return false;
+    }
+
+  /* Define the symbol as being at this point in the section.  */
+  h->root.u.def.section = s;
+  h->root.u.def.value = s->_raw_size;
+
+  /* Increment the section size to make room for the symbol.  */
+  s->_raw_size += h->size;
+
+  return true;
+}
+
+/* Set the sizes of the dynamic sections.  */
+
+static boolean
+sh_elf_size_dynamic_sections (output_bfd, info)
+     bfd *output_bfd;
+     struct bfd_link_info *info;
+{
+  bfd *dynobj;
+  asection *s;
+  boolean plt;
+  boolean relocs;
+  boolean reltext;
+
+  dynobj = elf_hash_table (info)->dynobj;
+  BFD_ASSERT (dynobj != NULL);
+
+  if (elf_hash_table (info)->dynamic_sections_created)
+    {
+      /* Set the contents of the .interp section to the interpreter.  */
+      if (! info->shared)
+	{
+	  s = bfd_get_section_by_name (dynobj, ".interp");
+	  BFD_ASSERT (s != NULL);
+	  s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
+	  s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
+	}
+    }
+  else
+    {
+      /* We may have created entries in the .rela.got section.
+	 However, if we are not creating the dynamic sections, we will
+	 not actually use these entries.  Reset the size of .rela.got,
+	 which will cause it to get stripped from the output file
+	 below.  */
+      s = bfd_get_section_by_name (dynobj, ".rela.got");
+      if (s != NULL)
+	s->_raw_size = 0;
+    }
+
+  /* If this is a -Bsymbolic shared link, then we need to discard all
+     PC relative relocs against symbols defined in a regular object.
+     We allocated space for them in the check_relocs routine, but we
+     will not fill them in in the relocate_section routine.  */
+  if (info->shared && info->symbolic)
+    sh_elf_link_hash_traverse (sh_elf_hash_table (info),
+				 sh_elf_discard_copies,
+				 (PTR) NULL);
+
+  /* The check_relocs and adjust_dynamic_symbol entry points have
+     determined the sizes of the various dynamic sections.  Allocate
+     memory for them.  */
+  plt = false;
+  relocs = false;
+  reltext = false;
+  for (s = dynobj->sections; s != NULL; s = s->next)
+    {
+      const char *name;
+      boolean strip;
+
+      if ((s->flags & SEC_LINKER_CREATED) == 0)
+	continue;
+
+      /* It's OK to base decisions on the section name, because none
+	 of the dynobj section names depend upon the input files.  */
+      name = bfd_get_section_name (dynobj, s);
+
+      strip = false;
+
+      if (strcmp (name, ".plt") == 0)
+	{
+	  if (s->_raw_size == 0)
+	    {
+	      /* Strip this section if we don't need it; see the
+		 comment below.  */
+	      strip = true;
+	    }
+	  else
+	    {
+	      /* Remember whether there is a PLT.  */
+	      plt = true;
+	    }
+	}
+      else if (strncmp (name, ".rela", 5) == 0)
+	{
+	  if (s->_raw_size == 0)
+	    {
+	      /* If we don't need this section, strip it from the
+		 output file.  This is mostly to handle .rela.bss and
+		 .rela.plt.  We must create both sections in
+		 create_dynamic_sections, because they must be created
+		 before the linker maps input sections to output
+		 sections.  The linker does that before
+		 adjust_dynamic_symbol is called, and it is that
+		 function which decides whether anything needs to go
+		 into these sections.  */
+	      strip = true;
+	    }
+	  else
+	    {
+	      asection *target;
+
+	      /* Remember whether there are any reloc sections other
+		 than .rela.plt.  */
+	      if (strcmp (name, ".rela.plt") != 0)
+		{
+		  const char *outname;
+
+		  relocs = true;
+
+		  /* If this relocation section applies to a read only
+		     section, then we probably need a DT_TEXTREL
+		     entry.  The entries in the .rela.plt section
+		     really apply to the .got section, which we
+		     created ourselves and so know is not readonly.  */
+		  outname = bfd_get_section_name (output_bfd,
+						  s->output_section);
+		  target = bfd_get_section_by_name (output_bfd, outname + 5);
+		  if (target != NULL
+		      && (target->flags & SEC_READONLY) != 0
+		      && (target->flags & SEC_ALLOC) != 0)
+		    reltext = true;
+		}
+
+	      /* We use the reloc_count field as a counter if we need
+		 to copy relocs into the output file.  */
+	      s->reloc_count = 0;
+	    }
+	}
+      else if (strncmp (name, ".got", 4) != 0)
+	{
+	  /* It's not one of our sections, so don't allocate space.  */
+	  continue;
+	}
+
+      if (strip)
+	{
+	  _bfd_strip_section_from_output (info, s);
+	  continue;
+	}
+
+      /* Allocate memory for the section contents.  */
+      s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
+      if (s->contents == NULL && s->_raw_size != 0)
+	return false;
+    }
+
+  if (elf_hash_table (info)->dynamic_sections_created)
+    {
+      /* Add some entries to the .dynamic section.  We fill in the
+	 values later, in sh_elf_finish_dynamic_sections, but we
+	 must add the entries now so that we get the correct size for
+	 the .dynamic section.  The DT_DEBUG entry is filled in by the
+	 dynamic linker and used by the debugger.  */
+      if (! info->shared)
+	{
+	  if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0))
+	    return false;
+	}
+
+      if (plt)
+	{
+	  if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0)
+	      || ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0)
+	      || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA)
+	      || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0))
+	    return false;
+	}
+
+      if (relocs)
+	{
+	  if (! bfd_elf32_add_dynamic_entry (info, DT_RELA, 0)
+	      || ! bfd_elf32_add_dynamic_entry (info, DT_RELASZ, 0)
+	      || ! bfd_elf32_add_dynamic_entry (info, DT_RELAENT,
+						sizeof (Elf32_External_Rela)))
+	    return false;
+	}
+
+      if (reltext)
+	{
+	  if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
+	    return false;
+	}
+    }
+
+  return true;
+}
+
+/* This function is called via sh_elf_link_hash_traverse if we are
+   creating a shared object with -Bsymbolic.  It discards the space
+   allocated to copy PC relative relocs against symbols which are
+   defined in regular objects.  We allocated space for them in the
+   check_relocs routine, but we won't fill them in in the
+   relocate_section routine.  */
+
+static boolean
+sh_elf_discard_copies (h, ignore)
+     struct elf_sh_link_hash_entry *h;
+     PTR ignore ATTRIBUTE_UNUSED;
+{
+  struct elf_sh_pcrel_relocs_copied *s;
+
+  /* We only discard relocs for symbols defined in a regular object.  */
+  if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+    return true;
+
+  for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
+    s->section->_raw_size -= s->count * sizeof (Elf32_External_Rela);
+
+  return true;
+}
+
+
 /* Relocate an SH ELF section.  */
 
 static boolean
@@ -1836,9 +2864,20 @@
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
   Elf_Internal_Rela *rel, *relend;
+  bfd *dynobj;
+  bfd_vma *local_got_offsets;
+  asection *sgot;
+  asection *splt;
+  asection *sreloc;
 
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (input_bfd);
+  dynobj = elf_hash_table (info)->dynobj;
+  local_got_offsets = elf_local_got_offsets (input_bfd);
+
+  sgot = NULL;
+  splt = NULL;
+  sreloc = NULL;
 
   rel = relocs;
   relend = relocs + input_section->reloc_count;
@@ -1851,30 +2890,11 @@
       asection *sec;
       struct elf_link_hash_entry *h;
       bfd_vma relocation;
-      bfd_vma addend = (bfd_vma)0;
+      bfd_vma addend = (bfd_vma) 0;
       bfd_reloc_status_type r;
 
       r_symndx = ELF32_R_SYM (rel->r_info);
 
-      if (info->relocateable)
-	{
-	  /* This is a relocateable link.  We don't have to change
-             anything, unless the reloc is against a section symbol,
-             in which case we have to adjust according to where the
-             section symbol winds up in the output section.  */
-	  if (r_symndx < symtab_hdr->sh_info)
-	    {
-	      sym = local_syms + r_symndx;
-	      if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
-		{
-		  sec = local_sections[r_symndx];
-		  rel->r_addend += sec->output_offset + sym->st_value;
-		}
-	    }
-
-	  continue;
-	}
-
       r_type = ELF32_R_TYPE (rel->r_info);
 
       /* Many of the relocs are only used for relaxing, and are
@@ -1882,23 +2902,20 @@
       if (r_type > (int) R_SH_LAST_INVALID_RELOC
 	  && r_type < (int) R_SH_LOOP_START)
 	continue;
+      if (r_type == (int) R_SH_NONE)
+	continue;
 
       if (r_type < 0
+	  || r_type >= R_SH_max
 	  || (r_type >= (int) R_SH_FIRST_INVALID_RELOC
-	      && r_type <= (int) R_SH_LAST_INVALID_RELOC))
+	      && r_type <= (int) R_SH_LAST_INVALID_RELOC)
+	  || (r_type >= (int) R_SH_FIRST_INVALID_RELOC_2
+	      && r_type <= (int) R_SH_LAST_INVALID_RELOC_2))
 	{
 	  bfd_set_error (bfd_error_bad_value);
 	  return false;
 	}
 
-      /* FIXME: This is certainly incorrect.  However, it is how the
-         COFF linker works.  */
-      if (r_type != (int) R_SH_DIR32
-	  && r_type != (int) R_SH_IND12W
-	  && r_type != (int) R_SH_LOOP_START
-	  && r_type != (int) R_SH_LOOP_END)
-	continue;
-
       howto = sh_elf_howto_table + r_type;
 
       /* This is a final link.  */
@@ -1907,19 +2924,33 @@
       sec = NULL;
       if (r_symndx < symtab_hdr->sh_info)
 	{
-	  /* There is nothing to be done for an internal IND12W
-             relocation.  FIXME: This is probably wrong, but it's how
-             the COFF relocations work.  */
-	  if (r_type == (int) R_SH_IND12W)
-	    continue;
 	  sym = local_syms + r_symndx;
 	  sec = local_sections[r_symndx];
 	  relocation = (sec->output_section->vma
 			+ sec->output_offset
 			+ sym->st_value);
+
+	  if (info->relocateable)
+	    {
+	      /* This is a relocateable link.  We don't have to change
+		 anything, unless the reloc is against a section symbol,
+		 in which case we have to adjust according to where the
+		 section symbol winds up in the output section.  */
+	      sym = local_syms + r_symndx;
+	      if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+		goto final_link_relocate;
+
+	      continue;
+	    }
 	}
       else
 	{
+	  /* Section symbol are never (?) placed in the hash table, so
+	     we can just ignore hash relocations when creating a
+	     relocateable object file.  */
+	  if (info->relocateable)
+	    continue;
+
 	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
@@ -1928,12 +2959,55 @@
 	      || h->root.type == bfd_link_hash_defweak)
 	    {
 	      sec = h->root.u.def.section;
-	      relocation = (h->root.u.def.value
-			    + sec->output_section->vma
-			    + sec->output_offset);
+	      /* In these cases, we don't need the relocation value.
+		 We check specially because in some obscure cases
+		 sec->output_section will be NULL.  */
+	      if (r_type == R_SH_GOTPC
+		  || (r_type == R_SH_PLT32
+		      && h->plt.offset != (bfd_vma) -1)
+		  || (r_type == R_SH_GOT32
+		      && elf_hash_table (info)->dynamic_sections_created
+		      && (! info->shared
+			  || (! info->symbolic && h->dynindx != -1)
+			  || (h->elf_link_hash_flags
+			      & ELF_LINK_HASH_DEF_REGULAR) == 0))
+		  /* The cases above are those in which relocation is
+		     overwritten in the switch block below.  The cases
+		     below are those in which we must defer relocation
+		     to run-time, because we can't resolve absolute
+		     addresses when creating a shared library.  */
+		  || (info->shared
+		      && ((! info->symbolic && h->dynindx != -1)
+			  || (h->elf_link_hash_flags
+			      & ELF_LINK_HASH_DEF_REGULAR) == 0)
+		      && ((r_type == R_SH_DIR32
+			   && !(ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
+				|| ELF_ST_VISIBILITY (h->other) == STV_HIDDEN))
+			  || r_type == R_SH_REL32)
+		      && ((input_section->flags & SEC_ALLOC) != 0
+			  /* DWARF will emit R_SH_DIR32 relocations in its
+			     sections against symbols defined externally
+			     in shared libraries.  We can't do anything
+			     with them here.  */
+			  || (input_section->flags & SEC_DEBUGGING) != 0)))
+		relocation = 0;
+	      else if (sec->output_section == NULL)
+		{
+		  (*_bfd_error_handler)
+		    (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
+		     bfd_get_filename (input_bfd), h->root.root.string,
+		     bfd_get_section_name (input_bfd, input_section));
+		  relocation = 0;
+		}
+	      else
+		relocation = (h->root.u.def.value
+			      + sec->output_section->vma
+			      + sec->output_offset);
 	    }
 	  else if (h->root.type == bfd_link_hash_undefweak)
 	    relocation = 0;
+	  else if (info->shared && !info->symbolic && !info->no_undefined)
+	    relocation = 0;
 	  else
 	    {
 	      if (! ((*info->callbacks->undefined_symbol)
@@ -1944,22 +3018,298 @@
 	    }
 	}
 
-      /* FIXME: This is how the COFF relocations work.  */
-      if (r_type == (int) R_SH_IND12W)
-	relocation -= 4;
-
-      switch ((int)r_type)
+      switch ((int) r_type)
 	{
-	case (int)R_SH_DIR32:
-	  addend = rel->r_addend;
-	  /* Fall through.  */
-	default:
+	final_link_relocate:
 	  /* COFF relocs don't use the addend. The addend is used for
-	     R_SH_DIR32 to be compatible with other compilers. */
+	     R_SH_DIR32 to be compatible with other compilers.  */
 	  r = _bfd_final_link_relocate (howto, input_bfd, input_section,
 					contents, rel->r_offset,
 					relocation, addend);
 	  break;
+
+	case R_SH_IND12W:
+	case R_SH_DIR8WPN:
+	case R_SH_DIR8WPZ:
+	case R_SH_DIR8WPL:
+	  /* These should normally be handled by the assembler, but at
+	     least IND12W is generated by ourselves, so we must deal
+	     with it.  */
+	  relocation -= 4;
+	  goto final_link_relocate;
+
+	default:
+	  bfd_set_error (bfd_error_bad_value);
+	  return false;
+
+	case R_SH_DIR32:
+	case R_SH_REL32:
+	  if (info->shared
+	      && (input_section->flags & SEC_ALLOC) != 0
+	      && (r_type != R_SH_REL32
+		  || (h != NULL
+		      && h->dynindx != -1
+		      && (! info->symbolic
+			  || (h->elf_link_hash_flags
+			      & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+	    {
+	      Elf_Internal_Rela outrel;
+	      boolean skip, relocate;
+
+	      /* When generating a shared object, these relocations
+		 are copied into the output file to be resolved at run
+		 time.  */
+
+	      if (sreloc == NULL)
+		{
+		  const char *name;
+
+		  name = (bfd_elf_string_from_elf_section
+			  (input_bfd,
+			   elf_elfheader (input_bfd)->e_shstrndx,
+			   elf_section_data (input_section)->rel_hdr.sh_name));
+		  if (name == NULL)
+		    return false;
+
+		  BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+			      && strcmp (bfd_get_section_name (input_bfd,
+							       input_section),
+					 name + 5) == 0);
+
+		  sreloc = bfd_get_section_by_name (dynobj, name);
+		  BFD_ASSERT (sreloc != NULL);
+		}
+
+	      skip = false;
+
+	      if (elf_section_data (input_section)->stab_info == NULL)
+		outrel.r_offset = rel->r_offset;
+	      else
+		{
+		  bfd_vma off;
+
+		  off = (_bfd_stab_section_offset
+			 (output_bfd, &elf_hash_table (info)->stab_info,
+			  input_section,
+			  &elf_section_data (input_section)->stab_info,
+			  rel->r_offset));
+		  if (off == (bfd_vma) -1)
+		    skip = true;
+		  outrel.r_offset = off;
+		}
+
+	      outrel.r_offset += (input_section->output_section->vma
+				  + input_section->output_offset);
+
+	      if (skip)
+		{
+		  memset (&outrel, 0, sizeof outrel);
+		  relocate = false;
+		}
+	      else if (r_type == R_SH_REL32)
+		{
+		  BFD_ASSERT (h != NULL && h->dynindx != -1);
+		  relocate = false;
+		  outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_REL32);
+		  outrel.r_addend = rel->r_addend;
+		}
+	      else
+		{
+		  /* h->dynindx may be -1 if this symbol was marked to
+		     become local.  */
+		  if (h == NULL
+		      || ((info->symbolic || h->dynindx == -1)
+			  && (h->elf_link_hash_flags
+			      & ELF_LINK_HASH_DEF_REGULAR) != 0))
+		    {
+		      relocate = true;
+		      outrel.r_info = ELF32_R_INFO (0, R_SH_RELATIVE);
+		      outrel.r_addend = relocation + rel->r_addend;
+		    }
+		  else
+		    {
+		      BFD_ASSERT (h->dynindx != -1);
+		      relocate = false;
+		      outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_DIR32);
+		      outrel.r_addend = relocation + rel->r_addend;
+		    }
+		}
+
+	      bfd_elf32_swap_reloca_out (output_bfd, &outrel,
+					 (((Elf32_External_Rela *)
+					   sreloc->contents)
+					  + sreloc->reloc_count));
+	      ++sreloc->reloc_count;
+
+	      /* If this reloc is against an external symbol, we do
+		 not want to fiddle with the addend.  Otherwise, we
+		 need to include the symbol value so that it becomes
+		 an addend for the dynamic reloc.  */
+	      if (! relocate)
+		continue;
+	    }
+	  else if (r_type == R_SH_DIR32)
+	    addend = rel->r_addend;
+	  goto final_link_relocate;
+
+	case R_SH_GOT32:
+	  /* Relocation is to the entry for this symbol in the global
+	     offset table.  */
+	  if (sgot == NULL)
+	    {
+	      sgot = bfd_get_section_by_name (dynobj, ".got");
+	      BFD_ASSERT (sgot != NULL);
+	    }
+
+	  if (h != NULL)
+	    {
+	      bfd_vma off;
+
+	      off = h->got.offset;
+	      BFD_ASSERT (off != (bfd_vma) -1);
+
+	      if (! elf_hash_table (info)->dynamic_sections_created
+		  || (info->shared
+		      && (info->symbolic || h->dynindx == -1
+			  || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
+			  || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)
+		      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+		{
+		  /* This is actually a static link, or it is a
+		     -Bsymbolic link and the symbol is defined
+		     locally, or the symbol was forced to be local
+		     because of a version file.  We must initialize
+		     this entry in the global offset table.  Since the
+		     offset must always be a multiple of 4, we use the
+		     least significant bit to record whether we have
+		     initialized it already.
+
+		     When doing a dynamic link, we create a .rela.got
+		     relocation entry to initialize the value.  This
+		     is done in the finish_dynamic_symbol routine.  */
+		  if ((off & 1) != 0)
+		    off &= ~1;
+		  else
+		    {
+		      bfd_put_32 (output_bfd, relocation,
+				  sgot->contents + off);
+		      h->got.offset |= 1;
+		    }
+		}
+
+	      relocation = sgot->output_offset + off;
+	    }
+	  else
+	    {
+	      bfd_vma off;
+
+	      BFD_ASSERT (local_got_offsets != NULL
+			  && local_got_offsets[r_symndx] != (bfd_vma) -1);
+
+	      off = local_got_offsets[r_symndx];
+
+	      /* The offset must always be a multiple of 4.  We use
+		 the least significant bit to record whether we have
+		 already generated the necessary reloc.  */
+	      if ((off & 1) != 0)
+		off &= ~1;
+	      else
+		{
+		  bfd_put_32 (output_bfd, relocation, sgot->contents + off);
+
+		  if (info->shared)
+		    {
+		      asection *srelgot;
+		      Elf_Internal_Rela outrel;
+
+		      srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
+		      BFD_ASSERT (srelgot != NULL);
+
+		      outrel.r_offset = (sgot->output_section->vma
+					 + sgot->output_offset
+					 + off);
+		      outrel.r_info = ELF32_R_INFO (0, R_SH_RELATIVE);
+		      outrel.r_addend = relocation;
+		      bfd_elf32_swap_reloca_out (output_bfd, &outrel,
+						(((Elf32_External_Rela *)
+						  srelgot->contents)
+						 + srelgot->reloc_count));
+		      ++srelgot->reloc_count;
+		    }
+
+		  local_got_offsets[r_symndx] |= 1;
+		}
+
+	      relocation = sgot->output_offset + off;
+	    }
+
+	  goto final_link_relocate;
+
+	case R_SH_GOTOFF:
+	  /* Relocation is relative to the start of the global offset
+	     table.  */
+
+	  if (sgot == NULL)
+	    {
+	      sgot = bfd_get_section_by_name (dynobj, ".got");
+	      BFD_ASSERT (sgot != NULL);
+	    }
+
+	  /* Note that sgot->output_offset is not involved in this
+	     calculation.  We always want the start of .got.  If we
+	     defined _GLOBAL_OFFSET_TABLE in a different way, as is
+	     permitted by the ABI, we might have to change this
+	     calculation.  */
+	  relocation -= sgot->output_section->vma;
+
+	  goto final_link_relocate;
+
+	case R_SH_GOTPC:
+	  /* Use global offset table as symbol value.  */
+
+	  if (sgot == NULL)
+	    {
+	      sgot = bfd_get_section_by_name (dynobj, ".got");
+	      BFD_ASSERT (sgot != NULL);
+	    }
+
+	  relocation = sgot->output_section->vma;
+
+	  goto final_link_relocate;
+
+	case R_SH_PLT32:
+	  /* Relocation is to the entry for this symbol in the
+	     procedure linkage table.  */
+
+	  /* Resolve a PLT reloc against a local symbol directly,
+	     without using the procedure linkage table.  */
+	  if (h == NULL)
+	    goto final_link_relocate;
+
+	  if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
+	      || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)
+	    goto final_link_relocate;
+
+	  if (h->plt.offset == (bfd_vma) -1)
+	    {
+	      /* We didn't make a PLT entry for this symbol.  This
+		 happens when statically linking PIC code, or when
+		 using -Bsymbolic.  */
+	      goto final_link_relocate;
+	    }
+
+	  if (splt == NULL)
+	    {
+	      splt = bfd_get_section_by_name (dynobj, ".plt");
+	      BFD_ASSERT (splt != NULL);
+	    }
+
+	  relocation = (splt->output_section->vma
+			+ splt->output_offset
+			+ h->plt.offset);
+
+	  goto final_link_relocate;
+
 	case R_SH_LOOP_START:
 	  {
 	    static bfd_vma start, end;
@@ -1969,6 +3319,7 @@
 	    r = sh_elf_reloc_loop (r_type, input_bfd, input_section, contents,
 				   rel->r_offset, sec, start, end);
 	    break;
+
 	case R_SH_LOOP_END:
 	    end = (relocation + rel->r_addend
 		   - (sec->output_section->vma + sec->output_offset));
@@ -2018,7 +3369,7 @@
 
 static bfd_byte *
 sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
-					data, relocateable, symbols)
+				       data, relocateable, symbols)
      bfd *output_bfd;
      struct bfd_link_info *link_info;
      struct bfd_link_order *link_order;
@@ -2150,48 +3501,48 @@
 }
 static asection *
 sh_elf_gc_mark_hook (abfd, info, rel, h, sym)
-       bfd *abfd;
-       struct bfd_link_info *info ATTRIBUTE_UNUSED;
-       Elf_Internal_Rela *rel;
-       struct elf_link_hash_entry *h;
-       Elf_Internal_Sym *sym;
+     bfd *abfd;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     Elf_Internal_Rela *rel;
+     struct elf_link_hash_entry *h;
+     Elf_Internal_Sym *sym;
 {
   if (h != NULL)
     {
       switch (ELF32_R_TYPE (rel->r_info))
-      {
-      case R_SH_GNU_VTINHERIT:
-      case R_SH_GNU_VTENTRY:
-        break;
+	{
+	case R_SH_GNU_VTINHERIT:
+	case R_SH_GNU_VTENTRY:
+	  break;
 
-      default:
-        switch (h->root.type)
-          {
-          case bfd_link_hash_defined:
-          case bfd_link_hash_defweak:
-            return h->root.u.def.section;
+	default:
+	  switch (h->root.type)
+	    {
+	    case bfd_link_hash_defined:
+	    case bfd_link_hash_defweak:
+	      return h->root.u.def.section;
 
-          case bfd_link_hash_common:
-            return h->root.u.c.p->section;
+	    case bfd_link_hash_common:
+	      return h->root.u.c.p->section;
 
-	  default:
-	    break;
-          }
-       }
-     }
-   else
-     {
-       if (!(elf_bad_symtab (abfd)
-           && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
-         && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
+	    default:
+	      break;
+	    }
+	}
+    }
+  else
+    {
+      if (!(elf_bad_symtab (abfd)
+	    && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
+	  && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
                 && sym->st_shndx != SHN_COMMON))
-          {
-            return bfd_section_from_elf_index (abfd, sym->st_shndx);
-          }
-      }
+	return bfd_section_from_elf_index (abfd, sym->st_shndx);
+    }
   return NULL;
 }
 
+/* Update the got entry reference counts for the section being removed.  */
+
 static boolean
 sh_elf_gc_sweep_hook (abfd, info, sec, relocs)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -2199,14 +3550,17 @@
      asection *sec ATTRIBUTE_UNUSED;
      const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
 {
-  /* we don't use got and plt entries for sh. */
+  /* We use got and plt entries for sh, but it would seem that the
+     existing SH code does no sort of reference counting or whatnot on
+     its GOT and PLT entries, so it is not possible to garbage collect
+     them at this time.  */
   return true;
 }
 
 /* Look through the relocs for a section during the first phase.
    Since we don't do .gots or .plts, we just need to consider the
    virtual table relocs for gc.  */
- 
+
 static boolean
 sh_elf_check_relocs (abfd, info, sec, relocs)
      bfd *abfd;
@@ -2218,52 +3572,287 @@
   struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
   const Elf_Internal_Rela *rel;
   const Elf_Internal_Rela *rel_end;
- 
+  bfd *dynobj;
+  bfd_vma *local_got_offsets;
+  asection *sgot;
+  asection *srelgot;
+  asection *sreloc;
+
+  sgot = NULL;
+  srelgot = NULL;
+  sreloc = NULL;
+
   if (info->relocateable)
     return true;
- 
+
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
-  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf32_External_Sym);
+  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym);
   if (!elf_bad_symtab (abfd))
     sym_hashes_end -= symtab_hdr->sh_info;
- 
+
+  dynobj = elf_hash_table (info)->dynobj;
+  local_got_offsets = elf_local_got_offsets (abfd);
+
   rel_end = relocs + sec->reloc_count;
   for (rel = relocs; rel < rel_end; rel++)
     {
       struct elf_link_hash_entry *h;
       unsigned long r_symndx;
- 
+
       r_symndx = ELF32_R_SYM (rel->r_info);
       if (r_symndx < symtab_hdr->sh_info)
-        h = NULL;
+	h = NULL;
       else
-        h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- 
+	h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+
+      /* Some relocs require a global offset table.  */
+      if (dynobj == NULL)
+	{
+	  switch (ELF32_R_TYPE (rel->r_info))
+	    {
+	    case R_SH_GOT32:
+	    case R_SH_GOTOFF:
+	    case R_SH_GOTPC:
+	      elf_hash_table (info)->dynobj = dynobj = abfd;
+	      if (! _bfd_elf_create_got_section (dynobj, info))
+		return false;
+	      break;
+
+	    default:
+	      break;
+	    }
+	}
+
       switch (ELF32_R_TYPE (rel->r_info))
         {
         /* This relocation describes the C++ object vtable hierarchy.
            Reconstruct it for later use during GC.  */
-        case R_SH_GNU_VTINHERIT:
-          if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
-            return false;
-          break;
- 
+	case R_SH_GNU_VTINHERIT:
+	  if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+	    return false;
+	  break;
+
         /* This relocation describes which C++ vtable entries are actually
            used.  Record for later use during GC.  */
-        case R_SH_GNU_VTENTRY:
-          if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
-            return false;
-          break;
-        }
+	case R_SH_GNU_VTENTRY:
+	  if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+	    return false;
+	  break;
+
+	case R_SH_GOT32:
+	  /* This symbol requires a global offset table entry.  */
+
+	  if (sgot == NULL)
+	    {
+	      sgot = bfd_get_section_by_name (dynobj, ".got");
+	      BFD_ASSERT (sgot != NULL);
+	    }
+
+	  if (srelgot == NULL
+	      && (h != NULL || info->shared))
+	    {
+	      srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
+	      if (srelgot == NULL)
+		{
+		  srelgot = bfd_make_section (dynobj, ".rela.got");
+		  if (srelgot == NULL
+		      || ! bfd_set_section_flags (dynobj, srelgot,
+						  (SEC_ALLOC
+						   | SEC_LOAD
+						   | SEC_HAS_CONTENTS
+						   | SEC_IN_MEMORY
+						   | SEC_LINKER_CREATED
+						   | SEC_READONLY))
+		      || ! bfd_set_section_alignment (dynobj, srelgot, 2))
+		    return false;
+		}
+	    }
+
+	  if (h != NULL)
+	    {
+	      if (h->got.offset != (bfd_vma) -1)
+		{
+		  /* We have already allocated space in the .got.  */
+		  break;
+		}
+	      h->got.offset = sgot->_raw_size;
+
+	      /* Make sure this symbol is output as a dynamic symbol.  */
+	      if (h->dynindx == -1)
+		{
+		  if (! bfd_elf32_link_record_dynamic_symbol (info, h))
+		    return false;
+		}
+
+	      srelgot->_raw_size += sizeof (Elf32_External_Rela);
+	    }
+	  else
+	    {
+	      /* This is a global offset table entry for a local
+	         symbol.  */
+	      if (local_got_offsets == NULL)
+		{
+		  size_t size;
+		  register unsigned int i;
+
+		  size = symtab_hdr->sh_info * sizeof (bfd_vma);
+		  local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size);
+		  if (local_got_offsets == NULL)
+		    return false;
+		  elf_local_got_offsets (abfd) = local_got_offsets;
+		  for (i = 0; i < symtab_hdr->sh_info; i++)
+		    local_got_offsets[i] = (bfd_vma) -1;
+		}
+	      if (local_got_offsets[r_symndx] != (bfd_vma) -1)
+		{
+		  /* We have already allocated space in the .got.  */
+		  break;
+		}
+	      local_got_offsets[r_symndx] = sgot->_raw_size;
+
+	      if (info->shared)
+		{
+		  /* If we are generating a shared object, we need to
+		     output a R_SH_RELATIVE reloc so that the dynamic
+		     linker can adjust this GOT entry.  */
+		  srelgot->_raw_size += sizeof (Elf32_External_Rela);
+		}
+	    }
+
+	  sgot->_raw_size += 4;
+
+	  break;
+
+	case R_SH_PLT32:
+	  /* This symbol requires a procedure linkage table entry.  We
+	     actually build the entry in adjust_dynamic_symbol,
+	     because this might be a case of linking PIC code which is
+	     never referenced by a dynamic object, in which case we
+	     don't need to generate a procedure linkage table entry
+	     after all.  */
+
+	  /* If this is a local symbol, we resolve it directly without
+	     creating a procedure linkage table entry.  */
+	  if (h == NULL)
+	    continue;
+
+	  if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
+	      || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)
+	    break;
+
+	  h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+
+	  break;
+
+	case R_SH_DIR32:
+	case R_SH_REL32:
+	  if (h != NULL)
+	    h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+
+	  /* If we are creating a shared library, and this is a reloc
+	     against a global symbol, or a non PC relative reloc
+	     against a local symbol, then we need to copy the reloc
+	     into the shared library.  However, if we are linking with
+	     -Bsymbolic, we do not need to copy a reloc against a
+	     global symbol which is defined in an object we are
+	     including in the link (i.e., DEF_REGULAR is set).  At
+	     this point we have not seen all the input files, so it is
+	     possible that DEF_REGULAR is not set now but will be set
+	     later (it is never cleared).  We account for that
+	     possibility below by storing information in the
+	     pcrel_relocs_copied field of the hash table entry.  */
+	  if (info->shared
+	      && (sec->flags & SEC_ALLOC) != 0
+	      && (ELF32_R_TYPE (rel->r_info) != R_SH_REL32
+		  || (h != NULL
+		      && (! info->symbolic
+			  || (h->elf_link_hash_flags
+			      & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+	    {
+	      /* When creating a shared object, we must copy these
+		 reloc types into the output file.  We create a reloc
+		 section in dynobj and make room for this reloc.  */
+	      if (sreloc == NULL)
+		{
+		  const char *name;
+
+		  name = (bfd_elf_string_from_elf_section
+			  (abfd,
+			   elf_elfheader (abfd)->e_shstrndx,
+			   elf_section_data (sec)->rel_hdr.sh_name));
+		  if (name == NULL)
+		    return false;
+
+		  BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+			      && strcmp (bfd_get_section_name (abfd, sec),
+					 name + 5) == 0);
+
+		  sreloc = bfd_get_section_by_name (dynobj, name);
+		  if (sreloc == NULL)
+		    {
+		      flagword flags;
+
+		      sreloc = bfd_make_section (dynobj, name);
+		      flags = (SEC_HAS_CONTENTS | SEC_READONLY
+			       | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+		      if ((sec->flags & SEC_ALLOC) != 0)
+			flags |= SEC_ALLOC | SEC_LOAD;
+		      if (sreloc == NULL
+			  || ! bfd_set_section_flags (dynobj, sreloc, flags)
+			  || ! bfd_set_section_alignment (dynobj, sreloc, 2))
+			return false;
+		    }
+		}
+
+	      sreloc->_raw_size += sizeof (Elf32_External_Rela);
+
+	      /* If we are linking with -Bsymbolic, and this is a
+		 global symbol, we count the number of PC relative
+		 relocations we have entered for this symbol, so that
+		 we can discard them again if the symbol is later
+		 defined by a regular object.  Note that this function
+		 is only called if we are using an elf_sh linker
+		 hash table, which means that h is really a pointer to
+		 an elf_sh_link_hash_entry.  */
+	      if (h != NULL && info->symbolic
+		  && ELF32_R_TYPE (rel->r_info) == R_SH_REL32)
+		{
+		  struct elf_sh_link_hash_entry *eh;
+		  struct elf_sh_pcrel_relocs_copied *p;
+
+		  eh = (struct elf_sh_link_hash_entry *) h;
+
+		  for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next)
+		    if (p->section == sreloc)
+		      break;
+
+		  if (p == NULL)
+		    {
+		      p = ((struct elf_sh_pcrel_relocs_copied *)
+			   bfd_alloc (dynobj, sizeof *p));
+		      if (p == NULL)
+			return false;
+		      p->next = eh->pcrel_relocs_copied;
+		      eh->pcrel_relocs_copied = p;
+		      p->section = sreloc;
+		      p->count = 0;
+		    }
+
+		  ++p->count;
+		}
+	    }
+
+	  break;
+	}
     }
- 
+
   return true;
 }
 
-boolean
+static boolean
 sh_elf_set_mach_from_flags (abfd)
-     bfd *    abfd;
+     bfd *abfd;
 {
   flagword flags = elf_elfheader (abfd)->e_flags;
 
@@ -2297,10 +3886,11 @@
   return true;
 }
 
-/* Function to keep SH specific file flags. */
+/* Function to keep SH specific file flags.  */
+
 static boolean
 sh_elf_set_private_flags (abfd, flags)
-     bfd *    abfd;
+     bfd *abfd;
      flagword flags;
 {
   BFD_ASSERT (! elf_flags_init (abfd)
@@ -2312,6 +3902,7 @@
 }
 
 /* Copy backend specific data from one object module to another */
+
 static boolean
 sh_elf_copy_private_data (ibfd, obfd)
      bfd * ibfd;
@@ -2343,8 +3934,9 @@
 
   if (! elf_flags_init (obfd))
     {
+      /* This happens when ld starts out with a 'blank' output file.  */
       elf_flags_init (obfd) = true;
-      elf_elfheader (obfd)->e_flags = 0;
+      elf_elfheader (obfd)->e_flags = EF_SH1;
     }
   old_flags = elf_elfheader (obfd)->e_flags;
   new_flags = elf_elfheader (ibfd)->e_flags;
@@ -2364,15 +3956,348 @@
   return sh_elf_set_mach_from_flags (obfd);
 }
 
+/* Finish up dynamic symbol handling.  We set the contents of various
+   dynamic sections here.  */
+
+static boolean
+sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
+     bfd *output_bfd;
+     struct bfd_link_info *info;
+     struct elf_link_hash_entry *h;
+     Elf_Internal_Sym *sym;
+{
+  bfd *dynobj;
+
+  dynobj = elf_hash_table (info)->dynobj;
+
+  if (h->plt.offset != (bfd_vma) -1)
+    {
+      asection *splt;
+      asection *sgot;
+      asection *srel;
+
+      bfd_vma plt_index;
+      bfd_vma got_offset;
+      Elf_Internal_Rela rel;
+
+      /* This symbol has an entry in the procedure linkage table.  Set
+	 it up.  */
+
+      BFD_ASSERT (h->dynindx != -1);
+
+      splt = bfd_get_section_by_name (dynobj, ".plt");
+      sgot = bfd_get_section_by_name (dynobj, ".got.plt");
+      srel = bfd_get_section_by_name (dynobj, ".rela.plt");
+      BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL);
+
+      /* Get the index in the procedure linkage table which
+	 corresponds to this symbol.  This is the index of this symbol
+	 in all the symbols for which we are making plt entries.  The
+	 first entry in the procedure linkage table is reserved.  */
+      plt_index = h->plt.offset / elf_sh_sizeof_plt (info) - 1;
+
+      /* Get the offset into the .got table of the entry that
+	 corresponds to this function.  Each .got entry is 4 bytes.
+	 The first three are reserved.  */
+      got_offset = (plt_index + 3) * 4;
+
+      /* Fill in the entry in the procedure linkage table.  */
+      if (! info->shared)
+	{
+	  if (elf_sh_plt_entry == NULL)
+	    {
+	      elf_sh_plt_entry = (bfd_big_endian (output_bfd) ?
+				  elf_sh_plt_entry_be : elf_sh_plt_entry_le);
+	    }
+	  memcpy (splt->contents + h->plt.offset, elf_sh_plt_entry,
+		  elf_sh_sizeof_plt (info));
+	  bfd_put_32 (output_bfd,
+		      (sgot->output_section->vma
+		       + sgot->output_offset
+		       + got_offset),
+		      (splt->contents + h->plt.offset
+		       + elf_sh_plt_symbol_offset (info)));
+
+	  bfd_put_32 (output_bfd,
+		      (splt->output_section->vma + splt->output_offset),
+		      (splt->contents + h->plt.offset
+		       + elf_sh_plt_plt0_offset (info)));
+	}
+      else
+	{
+	  if (elf_sh_pic_plt_entry == NULL)
+	    {
+	      elf_sh_pic_plt_entry = (bfd_big_endian (output_bfd) ?
+				      elf_sh_pic_plt_entry_be :
+				      elf_sh_pic_plt_entry_le);
+	    }
+	  memcpy (splt->contents + h->plt.offset, elf_sh_pic_plt_entry,
+		  elf_sh_sizeof_plt (info));
+	  bfd_put_32 (output_bfd, got_offset,
+		      (splt->contents + h->plt.offset
+		       + elf_sh_plt_symbol_offset (info)));
+	}
+
+      bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela),
+		  (splt->contents + h->plt.offset
+		   + elf_sh_plt_reloc_offset (info)));
+
+      /* Fill in the entry in the global offset table.  */
+      bfd_put_32 (output_bfd,
+		  (splt->output_section->vma
+		   + splt->output_offset
+		   + h->plt.offset
+		   + elf_sh_plt_temp_offset (info)),
+		  sgot->contents + got_offset);
+
+      /* Fill in the entry in the .rela.plt section.  */
+      rel.r_offset = (sgot->output_section->vma
+		      + sgot->output_offset
+		      + got_offset);
+      rel.r_info = ELF32_R_INFO (h->dynindx, R_SH_JMP_SLOT);
+      rel.r_addend = 0;
+      bfd_elf32_swap_reloca_out (output_bfd, &rel,
+				((Elf32_External_Rela *) srel->contents
+				 + plt_index));
+
+      if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+	{
+	  /* Mark the symbol as undefined, rather than as defined in
+	     the .plt section.  Leave the value alone.  */
+	  sym->st_shndx = SHN_UNDEF;
+	}
+    }
+
+  if (h->got.offset != (bfd_vma) -1)
+    {
+      asection *sgot;
+      asection *srel;
+      Elf_Internal_Rela rel;
+
+      /* This symbol has an entry in the global offset table.  Set it
+	 up.  */
+
+      sgot = bfd_get_section_by_name (dynobj, ".got");
+      srel = bfd_get_section_by_name (dynobj, ".rela.got");
+      BFD_ASSERT (sgot != NULL && srel != NULL);
+
+      rel.r_offset = (sgot->output_section->vma
+		      + sgot->output_offset
+		      + (h->got.offset &~ 1));
+
+      /* If this is a -Bsymbolic link, and the symbol is defined
+	 locally, we just want to emit a RELATIVE reloc.  Likewise if
+	 the symbol was forced to be local because of a version file.
+	 The entry in the global offset table will already have been
+	 initialized in the relocate_section function.  */
+      if (info->shared
+	  && (info->symbolic || h->dynindx == -1)
+	  && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+	{
+	  rel.r_info = ELF32_R_INFO (0, R_SH_RELATIVE);
+	  rel.r_addend = (h->root.u.def.value
+			  + h->root.u.def.section->output_section->vma
+			  + h->root.u.def.section->output_offset);
+	}
+      else
+	{
+	  bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
+	  rel.r_info = ELF32_R_INFO (h->dynindx, R_SH_GLOB_DAT);
+	  rel.r_addend = 0;
+	}
+
+      bfd_elf32_swap_reloca_out (output_bfd, &rel,
+				 ((Elf32_External_Rela *) srel->contents
+				  + srel->reloc_count));
+      ++srel->reloc_count;
+    }
+
+  if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
+    {
+      asection *s;
+      Elf_Internal_Rela rel;
+
+      /* This symbol needs a copy reloc.  Set it up.  */
+
+      BFD_ASSERT (h->dynindx != -1
+		  && (h->root.type == bfd_link_hash_defined
+		      || h->root.type == bfd_link_hash_defweak));
+
+      s = bfd_get_section_by_name (h->root.u.def.section->owner,
+				   ".rela.bss");
+      BFD_ASSERT (s != NULL);
+
+      rel.r_offset = (h->root.u.def.value
+		      + h->root.u.def.section->output_section->vma
+		      + h->root.u.def.section->output_offset);
+      rel.r_info = ELF32_R_INFO (h->dynindx, R_SH_COPY);
+      rel.r_addend = 0;
+      bfd_elf32_swap_reloca_out (output_bfd, &rel,
+				 ((Elf32_External_Rela *) s->contents
+				  + s->reloc_count));
+      ++s->reloc_count;
+    }
+
+  /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute.  */
+  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+      || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+    sym->st_shndx = SHN_ABS;
+
+  return true;
+}
+
+/* Finish up the dynamic sections.  */
+
+static boolean
+sh_elf_finish_dynamic_sections (output_bfd, info)
+     bfd *output_bfd;
+     struct bfd_link_info *info;
+{
+  bfd *dynobj;
+  asection *sgot;
+  asection *sdyn;
+
+  dynobj = elf_hash_table (info)->dynobj;
+
+  sgot = bfd_get_section_by_name (dynobj, ".got.plt");
+  BFD_ASSERT (sgot != NULL);
+  sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+
+  if (elf_hash_table (info)->dynamic_sections_created)
+    {
+      asection *splt;
+      Elf32_External_Dyn *dyncon, *dynconend;
+
+      BFD_ASSERT (sdyn != NULL);
+
+      dyncon = (Elf32_External_Dyn *) sdyn->contents;
+      dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+      for (; dyncon < dynconend; dyncon++)
+	{
+	  Elf_Internal_Dyn dyn;
+	  const char *name;
+	  asection *s;
+
+	  bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
+
+	  switch (dyn.d_tag)
+	    {
+	    default:
+	      break;
+
+	    case DT_PLTGOT:
+	      name = ".got";
+	      goto get_vma;
+
+	    case DT_JMPREL:
+	      name = ".rela.plt";
+	    get_vma:
+	      s = bfd_get_section_by_name (output_bfd, name);
+	      BFD_ASSERT (s != NULL);
+	      dyn.d_un.d_ptr = s->vma;
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+
+	    case DT_PLTRELSZ:
+	      s = bfd_get_section_by_name (output_bfd, ".rela.plt");
+	      BFD_ASSERT (s != NULL);
+	      if (s->_cooked_size != 0)
+		dyn.d_un.d_val = s->_cooked_size;
+	      else
+		dyn.d_un.d_val = s->_raw_size;
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+
+	    case DT_RELASZ:
+	      /* My reading of the SVR4 ABI indicates that the
+		 procedure linkage table relocs (DT_JMPREL) should be
+		 included in the overall relocs (DT_RELA).  This is
+		 what Solaris does.  However, UnixWare can not handle
+		 that case.  Therefore, we override the DT_RELASZ entry
+		 here to make it not include the JMPREL relocs.  Since
+		 the linker script arranges for .rela.plt to follow all
+		 other relocation sections, we don't have to worry
+		 about changing the DT_RELA entry.  */
+	      s = bfd_get_section_by_name (output_bfd, ".rela.plt");
+	      if (s != NULL)
+		{
+		  if (s->_cooked_size != 0)
+		    dyn.d_un.d_val -= s->_cooked_size;
+		  else
+		    dyn.d_un.d_val -= s->_raw_size;
+		}
+	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+	      break;
+	    }
+	}
+
+      /* Fill in the first entry in the procedure linkage table.  */
+      splt = bfd_get_section_by_name (dynobj, ".plt");
+      if (splt && splt->_raw_size > 0)
+	{
+	  if (info->shared)
+	    {
+	      if (elf_sh_pic_plt_entry == NULL)
+		{
+		  elf_sh_pic_plt_entry = (bfd_big_endian (output_bfd) ?
+					  elf_sh_pic_plt_entry_be :
+					  elf_sh_pic_plt_entry_le);
+		}
+	      memcpy (splt->contents, elf_sh_pic_plt_entry,
+		      elf_sh_sizeof_plt (info));
+	    }
+	  else
+	    {
+	      if (elf_sh_plt0_entry == NULL)
+		{
+		  elf_sh_plt0_entry = (bfd_big_endian (output_bfd) ?
+				       elf_sh_plt0_entry_be :
+				       elf_sh_plt0_entry_le);
+		}
+	      memcpy (splt->contents, elf_sh_plt0_entry, PLT_ENTRY_SIZE);
+	      bfd_put_32 (output_bfd,
+			  sgot->output_section->vma + sgot->output_offset + 4,
+			  splt->contents + elf_sh_plt0_gotid_offset (info));
+	      bfd_put_32 (output_bfd,
+			  sgot->output_section->vma + sgot->output_offset + 8,
+			  splt->contents + elf_sh_plt0_linker_offset (info));
+	    }
+
+	  /* UnixWare sets the entsize of .plt to 4, although that doesn't
+	     really seem like the right value.  */
+	  elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
+	}
+    }
+
+  /* Fill in the first three entries in the global offset table.  */
+  if (sgot->_raw_size > 0)
+    {
+      if (sdyn == NULL)
+	bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents);
+      else
+	bfd_put_32 (output_bfd,
+		    sdyn->output_section->vma + sdyn->output_offset,
+		    sgot->contents);
+      bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4);
+      bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8);
+    }
+
+  elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
+
+  return true;
+}
+
+#ifndef ELF_ARCH
 #define TARGET_BIG_SYM		bfd_elf32_sh_vec
 #define TARGET_BIG_NAME		"elf32-sh"
 #define TARGET_LITTLE_SYM	bfd_elf32_shl_vec
 #define TARGET_LITTLE_NAME	"elf32-shl"
 #define ELF_ARCH		bfd_arch_sh
 #define ELF_MACHINE_CODE	EM_SH
-#define ELF_MAXPAGESIZE		0x1
+#define ELF_MAXPAGESIZE		128
 
 #define elf_symbol_leading_char '_'
+#endif /* ELF_ARCH */
 
 #define bfd_elf32_bfd_reloc_type_lookup	sh_elf_reloc_type_lookup
 #define elf_info_to_howto		sh_elf_info_to_howto
@@ -2392,5 +4317,23 @@
 #define elf_backend_gc_sweep_hook       sh_elf_gc_sweep_hook
 #define elf_backend_check_relocs        sh_elf_check_relocs
 
-#define elf_backend_can_gc_sections 1
+#define elf_backend_can_gc_sections	1
+#define elf_backend_create_dynamic_sections \
+					sh_elf_create_dynamic_sections
+#define bfd_elf32_bfd_link_hash_table_create \
+					sh_elf_link_hash_table_create
+#define elf_backend_adjust_dynamic_symbol \
+					sh_elf_adjust_dynamic_symbol
+#define elf_backend_size_dynamic_sections \
+					sh_elf_size_dynamic_sections
+#define elf_backend_finish_dynamic_symbol \
+					sh_elf_finish_dynamic_symbol
+#define elf_backend_finish_dynamic_sections \
+					sh_elf_finish_dynamic_sections
+
+#define elf_backend_want_got_plt	1
+#define elf_backend_plt_readonly	1
+#define elf_backend_want_plt_sym	0
+#define elf_backend_got_header_size	12
+#define elf_backend_plt_header_size	PLT_ENTRY_SIZE
 #include "elf32-target.h"
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index 70d65a5..4e9c6c2 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -129,7 +129,6 @@
 static reloc_howto_type elf32_sparc_vtentry_howto =
   HOWTO (R_SPARC_GNU_VTENTRY, 0,2,0,false,0,complain_overflow_dont, _bfd_elf_rel_vtable_reloc_fn,"R_SPARC_GNU_VTENTRY", false,0,0, false);
 
-
 struct elf_reloc_map {
   bfd_reloc_code_real_type bfd_reloc_val;
   unsigned char elf_reloc_val;
@@ -188,7 +187,7 @@
      bfd_reloc_code_real_type code;
 {
   unsigned int i;
-  
+
   switch (code)
     {
     case BFD_RELOC_VTABLE_INHERIT:
@@ -1019,7 +1018,12 @@
 	}
 
       /* Allocate memory for the section contents.  */
-      s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
+      /* FIXME: This should be a call to bfd_alloc not bfd_zalloc.
+	 Unused entries should be reclaimed before the section's contents
+	 are written out, but at the moment this does not happen.  Thus in
+	 order to prevent writing out garbage, we initialise the section's
+	 contents to zero.  */
+      s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
       if (s->contents == NULL && s->_raw_size != 0)
 	return false;
     }
@@ -1056,17 +1060,16 @@
 	{
 	  if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
   return true;
 }
 
-
 #define SET_SEC_DO_RELAX(section) do { elf_section_data(section)->tdata = (void *)1; } while (0)
 #define SEC_DO_RELAX(section) (elf_section_data(section)->tdata == (void *)1)
 
-/*ARGSUSED*/
 static boolean
 elf32_sparc_relax_section (abfd, section, link_info, again)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -1133,7 +1136,7 @@
 
       r_type = ELF32_R_TYPE (rel->r_info);
 
-      if (r_type == R_SPARC_GNU_VTINHERIT 
+      if (r_type == R_SPARC_GNU_VTINHERIT
           || r_type == R_SPARC_GNU_VTENTRY)
         continue;
 
@@ -1615,7 +1618,7 @@
 			  || ((reloc | 0x7fffff) == ~(bfd_vma)0)))
 		    {
 		      reloc >>= 2;
-		
+
 		      /* Check whether it fits into simm19 on v9.  */
 		      if (((reloc & 0x3c0000) == 0
 			   || (reloc & 0x3c0000) == 0x3c0000)
@@ -1665,7 +1668,6 @@
 				      contents, rel->r_offset,
 				      relocation, rel->r_addend);
 
-
       if (r != bfd_reloc_ok)
 	{
 	  switch (r)
@@ -1953,33 +1955,6 @@
 
   error = false;
 
-#if 0
-  /* ??? The native linker doesn't do this so we can't (otherwise gcc would
-     have to know which linker is being used).  Instead, the native linker
-     bumps up the architecture level when it has to.  However, I still think
-     warnings like these are good, so it would be nice to have them turned on
-     by some option.  */
-
-  /* If the output machine is normal sparc, we can't allow v9 input files.  */
-  if (bfd_get_mach (obfd) == bfd_mach_sparc
-      && (bfd_get_mach (ibfd) == bfd_mach_sparc_v8plus
-	  || bfd_get_mach (ibfd) == bfd_mach_sparc_v8plusa))
-    {
-      error = true;
-      (*_bfd_error_handler)
-	(_("%s: compiled for a v8plus system and target is v8"),
-	 bfd_get_filename (ibfd));
-    }
-  /* If the output machine is v9, we can't allow v9+vis input files.  */
-  if (bfd_get_mach (obfd) == bfd_mach_sparc_v8plus
-      && bfd_get_mach (ibfd) == bfd_mach_sparc_v8plusa)
-    {
-      error = true;
-      (*_bfd_error_handler)
-	(_("%s: compiled for a v8plusa system and target is v8plus"),
-	 bfd_get_filename (ibfd));
-    }
-#else
   if (bfd_get_mach (ibfd) >= bfd_mach_sparc_v9)
     {
       error = true;
@@ -1992,7 +1967,6 @@
       if (bfd_get_mach (obfd) < bfd_get_mach (ibfd))
 	bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd));
     }
-#endif
 
   if (((elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA)
        != previous_ibfd_e_flags)
@@ -2022,7 +1996,10 @@
 {
   if (elf_elfheader (abfd)->e_machine == EM_SPARC32PLUS)
     {
-      if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US1)
+      if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US3)
+	return bfd_default_set_arch_mach (abfd, bfd_arch_sparc,
+					  bfd_mach_sparc_v8plusb);
+      else if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US1)
 	return bfd_default_set_arch_mach (abfd, bfd_arch_sparc,
 					  bfd_mach_sparc_v8plusa);
       else if (elf_elfheader (abfd)->e_flags & EF_SPARC_32PLUS)
@@ -2060,6 +2037,12 @@
       elf_elfheader (abfd)->e_flags &=~ EF_SPARC_32PLUS_MASK;
       elf_elfheader (abfd)->e_flags |= EF_SPARC_32PLUS | EF_SPARC_SUN_US1;
       break;
+    case bfd_mach_sparc_v8plusb :
+      elf_elfheader (abfd)->e_machine = EM_SPARC32PLUS;
+      elf_elfheader (abfd)->e_flags &=~ EF_SPARC_32PLUS_MASK;
+      elf_elfheader (abfd)->e_flags |= EF_SPARC_32PLUS | EF_SPARC_SUN_US1
+				       | 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;
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index 4fe28fc..687f180 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -17,12 +17,9 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-
-
 /* XXX FIXME: This code is littered with 32bit int, 16bit short, 8bit char
    dependencies.  As is the gas & simulator code or the v850.  */
 
-
 #include "bfd.h"
 #include "sysdep.h"
 #include "bfdlink.h"
@@ -32,7 +29,7 @@
 
 /* sign-extend a 24-bit number */
 #define SEXT24(x)	((((x) & 0xffffff) ^ (~ 0x7fffff)) + 0x800000)
-      
+
 static reloc_howto_type *v850_elf_reloc_type_lookup
   PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
 static void v850_elf_info_to_howto_rel
@@ -103,7 +100,7 @@
 	 0,				/* dst_mask */
 	 false),			/* pcrel_offset */
 
-  /* A PC relative 9 bit branch. */
+  /* A PC relative 9 bit branch.  */
   HOWTO (R_V850_9_PCREL,		/* type */
 	 2,				/* rightshift */
 	 2,				/* size (0 = byte, 1 = short, 2 = long) */
@@ -118,7 +115,7 @@
 	 0x00ffffff,			/* dst_mask */
 	 true),				/* pcrel_offset */
 
-  /* A PC relative 22 bit branch. */
+  /* A PC relative 22 bit branch.  */
   HOWTO (R_V850_22_PCREL,		/* type */
 	 2,				/* rightshift */
 	 2,				/* size (0 = byte, 1 = short, 2 = long) */
@@ -312,7 +309,7 @@
 	 0x7f,				/* src_mask */
 	 0x7f,				/* dst_mask */
 	 false),			/* pcrel_offset */
-  
+
   /* 7 bit offset from the tiny data area pointer.  */
   HOWTO (R_V850_TDA_7_7_OFFSET,		/* type */
 	 0,				/* rightshift */
@@ -462,7 +459,7 @@
          0,                     /* src_mask */
          0,                     /* dst_mask */
          false),                /* pcrel_offset */
- 
+
 };
 
 /* Map BFD reloc types to V850 ELF reloc types.  */
@@ -521,7 +518,7 @@
       if (v850_elf_reloc_map[i].bfd_reloc_val == code)
 	{
 	  BFD_ASSERT (v850_elf_howto_table[v850_elf_reloc_map[i].elf_reloc_val].type == v850_elf_reloc_map[i].elf_reloc_val);
-	  
+
 	  return & v850_elf_howto_table[v850_elf_reloc_map[i].elf_reloc_val];
 	}
     }
@@ -544,7 +541,7 @@
   cache_ptr->howto = &v850_elf_howto_table[r_type];
 }
 
-/* Set the howto pointer for a V850 ELF reloc (type RELA). */
+/* Set the howto pointer for a V850 ELF reloc (type RELA).  */
 static void
 v850_elf_info_to_howto_rela (abfd, cache_ptr, dst)
      bfd *                 abfd ATTRIBUTE_UNUSED;
@@ -644,14 +641,14 @@
 	  other = V850_OTHER_SDA;
 	  common = ".scommon";
 	  goto small_data_common;
-	  
+
 	case R_V850_ZDA_16_16_SPLIT_OFFSET:
 	case R_V850_ZDA_16_16_OFFSET:
 	case R_V850_ZDA_15_16_OFFSET:
 	  other = V850_OTHER_ZDA;
 	  common = ".zcommon";
 	  goto small_data_common;
-	  
+
 	case R_V850_TDA_4_5_OFFSET:
 	case R_V850_TDA_4_4_OFFSET:
 	case R_V850_TDA_6_8_OFFSET:
@@ -760,21 +757,21 @@
      bfd_byte * address;
 {
   hi16s_location * entry = NULL;
-  
+
   /* Find a free structure.  */
   if (free_hi16s == NULL)
     free_hi16s = (hi16s_location *) bfd_zalloc (abfd, sizeof (* free_hi16s));
 
   entry      = free_hi16s;
   free_hi16s = free_hi16s->next;
-  
+
   entry->addend  = addend;
   entry->address = address;
   entry->counter = hi16s_counter ++;
   entry->found   = false;
   entry->next    = previous_hi16s;
   previous_hi16s = entry;
-  
+
   /* Cope with wrap around of our counter.  */
   if (hi16s_counter == 0)
     {
@@ -784,7 +781,7 @@
 
       hi16s_counter = 0x10000;
     }
-  
+
   return;
 }
 
@@ -798,7 +795,7 @@
   hi16s_location * previous = NULL;
   hi16s_location * prev;
   bfd_byte *       addr;
-  
+
   /* Search the table.  Record the most recent entry that matches.  */
   for (entry = previous_hi16s; entry; entry = entry->next)
     {
@@ -808,7 +805,7 @@
 	  previous = prev;
 	  match    = entry;
 	}
-      
+
       prev = entry;
     }
 
@@ -824,9 +821,9 @@
 
   /* Note that this entry has now been used.  */
   match->found = true;
-  
+
   return addr;
-}     
+}
 
 /* FIXME:  The code here probably ought to be removed and the code in reloc.c
    allowed to do its  stuff instead.  At least for most of the relocs, anwyay.  */
@@ -839,62 +836,62 @@
 {
   unsigned long insn;
   bfd_signed_vma saddend = (bfd_signed_vma) addend;
-  
+
   switch (r_type)
     {
     default:
       /* fprintf (stderr, "reloc type %d not SUPPORTED\n", r_type ); */
       return bfd_reloc_notsupported;
-      
+
     case R_V850_32:
       bfd_put_32 (abfd, addend, address);
       return bfd_reloc_ok;
-      
+
     case R_V850_22_PCREL:
       if (saddend > 0x1fffff || saddend < -0x200000)
 	return bfd_reloc_overflow;
-      
+
       if ((addend % 2) != 0)
 	return bfd_reloc_dangerous;
-      
+
       insn  = bfd_get_32 (abfd, address);
       insn &= ~0xfffe003f;
       insn |= (((addend & 0xfffe) << 16) | ((addend & 0x3f0000) >> 16));
       bfd_put_32 (abfd, insn, address);
       return bfd_reloc_ok;
-      
+
     case R_V850_9_PCREL:
       if (saddend > 0xff || saddend < -0x100)
 	return bfd_reloc_overflow;
-      
+
       if ((addend % 2) != 0)
 	return bfd_reloc_dangerous;
-      
+
       insn  = bfd_get_16 (abfd, address);
       insn &= ~ 0xf870;
       insn |= ((addend & 0x1f0) << 7) | ((addend & 0x0e) << 3);
       break;
-      
+
     case R_V850_HI16:
       addend += (bfd_get_16 (abfd, address) << 16);
       addend = (addend >> 16);
       insn = addend;
       break;
-      
+
     case R_V850_HI16_S:
       /* Remember where this relocation took place.  */
       remember_hi16s_reloc (abfd, addend, address);
 
       addend += (bfd_get_16 (abfd, address) << 16);
       addend = (addend >> 16) + ((addend & 0x8000) != 0);
-      
-      /* This relocation cannot overflow. */
+
+      /* This relocation cannot overflow.  */
       if (addend > 0x7fff)
 	addend = 0;
-      
+
       insn = addend;
       break;
-      
+
     case R_V850_LO16:
       /* Calculate the sum of the value stored in the instruction and the
 	 addend and check for overflow from the low 16 bits into the high
@@ -972,7 +969,6 @@
 	    ------------
 	      0x00116fff  = fred + 0x10ffff = 0x7000 + 0x10ffff
 
-	 
 	 Overflow can also occur if the computation carries into the 16th bit
 	 and it also results in the 15th bit having the same value as the 15th
 	 bit of the original value.   What happens is that the HI16S reloc
@@ -1007,7 +1003,7 @@
 	   + 0x00006fff
 	   ------------
 	     0x00006fff   but 'fred + 0x7000' = 0x00016fff
-	   
+
 	 Note - there is no need to change anything if a carry occurs, and the
 	 15th bit changes its value from being set to being clear, as the HI16S
 	 reloc will have already added in 1 to the high part for us:
@@ -1046,7 +1042,7 @@
 
 #define BIT15_SET(x) ((x) & 0x8000)
 #define OVERFLOWS(a,i) ((((a) & 0xffff) + (i)) > 0xffff)
-	
+
 	if ((BIT15_SET (result) && ! BIT15_SET (addend))
 	    || (OVERFLOWS (addend, insn)
 		&& ((! BIT15_SET (insn)) || (BIT15_SET (addend)))))
@@ -1054,7 +1050,7 @@
 	    boolean already_updated;
 	    bfd_byte * hi16s_address = find_remembered_hi16s_reloc
 	      (addend, & already_updated);
-	    
+
 	    /* Amend the matching HI16_S relocation.  */
 	    if (hi16s_address != NULL)
 	      {
@@ -1071,7 +1067,7 @@
 		return bfd_reloc_overflow;
 	      }
 	  }
-	
+
 	/* Do not complain if value has top bit set, as this has been anticipated.  */
 	insn = result & 0xffff;
 	break;
@@ -1081,7 +1077,7 @@
       addend += (char) bfd_get_8 (abfd, address);
 
       saddend = (bfd_signed_vma) addend;
-      
+
       if (saddend > 0x7f || saddend < -0x80)
 	return bfd_reloc_overflow;
 
@@ -1090,150 +1086,150 @@
 
     case R_V850_CALLT_16_16_OFFSET:
       addend += bfd_get_16 (abfd, address);
-      
+
       saddend = (bfd_signed_vma) addend;
-      
+
       if (saddend > 0xffff || saddend < 0)
 	return bfd_reloc_overflow;
 
       insn = addend;
       break;
-      
+
     case R_V850_16:
 
-      /* drop through */            
+      /* drop through */
     case R_V850_SDA_16_16_OFFSET:
     case R_V850_ZDA_16_16_OFFSET:
     case R_V850_TDA_16_16_OFFSET:
       addend += bfd_get_16 (abfd, address);
-      
+
       saddend = (bfd_signed_vma) addend;
-      
+
       if (saddend > 0x7fff || saddend < -0x8000)
 	return bfd_reloc_overflow;
 
       insn = addend;
       break;
-      
+
     case R_V850_SDA_15_16_OFFSET:
     case R_V850_ZDA_15_16_OFFSET:
       insn = bfd_get_16 (abfd, address);
       addend += (insn & 0xfffe);
-      
+
       saddend = (bfd_signed_vma) addend;
-      
+
       if (saddend > 0x7ffe || saddend < -0x8000)
 	return bfd_reloc_overflow;
-      
+
       if (addend & 1)
         return bfd_reloc_dangerous;
-      
+
       insn = (addend & ~1) | (insn & 1);
       break;
-      
+
     case R_V850_TDA_6_8_OFFSET:
       insn = bfd_get_16 (abfd, address);
       addend += ((insn & 0x7e) << 1);
-      
+
       saddend = (bfd_signed_vma) addend;
-      
+
       if (saddend > 0xfc || saddend < 0)
 	return bfd_reloc_overflow;
-      
+
       if (addend & 3)
 	return bfd_reloc_dangerous;
-      
+
       insn &= 0xff81;
       insn |= (addend >> 1);
       break;
-      
+
     case R_V850_TDA_7_8_OFFSET:
       insn = bfd_get_16 (abfd, address);
       addend += ((insn & 0x7f) << 1);
-      
+
       saddend = (bfd_signed_vma) addend;
-      
+
       if (saddend > 0xfe || saddend < 0)
 	return bfd_reloc_overflow;
-      
+
       if (addend & 1)
 	return bfd_reloc_dangerous;
-      
+
       insn &= 0xff80;
       insn |= (addend >> 1);
       break;
-      
+
     case R_V850_TDA_7_7_OFFSET:
       insn = bfd_get_16 (abfd, address);
       addend += insn & 0x7f;
-	
+
       saddend = (bfd_signed_vma) addend;
-      
+
       if (saddend > 0x7f || saddend < 0)
 	return bfd_reloc_overflow;
-      
+
       insn &= 0xff80;
       insn |= addend;
       break;
-      
+
     case R_V850_TDA_4_5_OFFSET:
       insn = bfd_get_16 (abfd, address);
       addend += ((insn & 0xf) << 1);
-      
+
       saddend = (bfd_signed_vma) addend;
-      
+
       if (saddend > 0x1e || saddend < 0)
 	return bfd_reloc_overflow;
-      
+
       if (addend & 1)
 	return bfd_reloc_dangerous;
-      
+
       insn &= 0xfff0;
       insn |= (addend >> 1);
       break;
-      
+
     case R_V850_TDA_4_4_OFFSET:
       insn = bfd_get_16 (abfd, address);
       addend += insn & 0xf;
-      
+
       saddend = (bfd_signed_vma) addend;
-      
+
       if (saddend > 0xf || saddend < 0)
 	return bfd_reloc_overflow;
-      
+
       insn &= 0xfff0;
       insn |= addend;
       break;
-      
+
     case R_V850_ZDA_16_16_SPLIT_OFFSET:
     case R_V850_SDA_16_16_SPLIT_OFFSET:
       insn = bfd_get_32 (abfd, address);
       addend += ((insn & 0xfffe0000) >> 16) + ((insn & 0x20) >> 5);
-      
+
       saddend = (bfd_signed_vma) addend;
-      
+
       if (saddend > 0x7fff || saddend < -0x8000)
 	return bfd_reloc_overflow;
-      
+
       insn &= 0x0001ffdf;
       insn |= (addend & 1) << 5;
       insn |= (addend & ~1) << 16;
-      
+
       bfd_put_32 (abfd, insn, address);
       return bfd_reloc_ok;
-      
+
     case R_V850_CALLT_6_7_OFFSET:
       insn = bfd_get_16 (abfd, address);
       addend += ((insn & 0x3f) << 1);
-      
+
       saddend = (bfd_signed_vma) addend;
-      
+
       if (saddend > 0x7e || saddend < 0)
 	return bfd_reloc_overflow;
-      
+
       if (addend & 1)
 	return bfd_reloc_dangerous;
-      
+
       insn &= 0xff80;
       insn |= (addend >> 1);
       break;
@@ -1261,7 +1257,7 @@
      char **     err ATTRIBUTE_UNUSED;
 {
   long relocation;
-  
+
   /* If there is an output BFD,
      and the symbol is not a section name (which is only defined at final link time),
      and either we are not putting the addend into the instruction
@@ -1275,13 +1271,13 @@
       reloc->address += isection->output_offset;
       return bfd_reloc_ok;
     }
-#if 0  
+#if 0
   else if (obfd != NULL)
     {
       return bfd_reloc_continue;
     }
 #endif
-  
+
   /* Catch relocs involving undefined symbols.  */
   if (bfd_is_und_section (symbol->section)
       && (symbol->flags & BSF_WEAK) == 0
@@ -1293,37 +1289,36 @@
   /* Is the address of the relocation really within the section?  */
   if (reloc->address > isection->_cooked_size)
     return bfd_reloc_outofrange;
-  
+
   /* Work out which section the relocation is targetted at and the
      initial relocation command value.  */
-  
+
   /* Get symbol value.  (Common symbols are special.)  */
   if (bfd_is_com_section (symbol->section))
     relocation = 0;
   else
     relocation = symbol->value;
-  
+
   /* Convert input-section-relative symbol value to absolute + addend.  */
   relocation += symbol->section->output_section->vma;
   relocation += symbol->section->output_offset;
   relocation += reloc->addend;
-  
+
   if (reloc->howto->pc_relative == true)
     {
       /* Here the variable relocation holds the final address of the
 	 symbol we are relocating against, plus any addend.  */
       relocation -= isection->output_section->vma + isection->output_offset;
-      
+
       /* Deal with pcrel_offset */
       relocation -= reloc->address;
     }
 
-  reloc->addend = relocation;	
+  reloc->addend = relocation;
   return bfd_reloc_ok;
 }
 
 
-/*ARGSUSED*/
 static boolean
 v850_elf_is_local_label_name (abfd, name)
      bfd *         abfd ATTRIBUTE_UNUSED;
@@ -1362,7 +1357,7 @@
 		+ input_section->output_offset);
       value -= offset;
       break;
-    
+
     case R_V850_22_PCREL:
       value -= (input_section->output_section->vma
 		+ input_section->output_offset
@@ -1371,10 +1366,10 @@
       /* If the sign extension will corrupt the value then we have overflowed.  */
       if (((value & 0xff000000) != 0x0) && ((value & 0xff000000) != 0xff000000))
 	return bfd_reloc_overflow;
-      
+
       value = SEXT24 (value);  /* Only the bottom 24 bits of the PC are valid */
       break;
-      
+
     case R_V850_HI16_S:
     case R_V850_HI16:
     case R_V850_LO16:
@@ -1383,12 +1378,12 @@
     case R_V850_8:
       break;
 
-    case R_V850_ZDA_15_16_OFFSET:	
+    case R_V850_ZDA_15_16_OFFSET:
     case R_V850_ZDA_16_16_OFFSET:
     case R_V850_ZDA_16_16_SPLIT_OFFSET:
       if (sym_sec == NULL)
 	return bfd_reloc_undefined;
-	  
+
       value -= sym_sec->output_section->vma;
       break;
 
@@ -1401,7 +1396,7 @@
 
 	if (sym_sec == NULL)
 	  return bfd_reloc_undefined;
-	  
+
 	/* Get the value of __gp.  */
 	h = bfd_link_hash_lookup (info->hash, "__gp", false, false, true);
 	if (h == (struct bfd_link_hash_entry *) NULL
@@ -1426,12 +1421,12 @@
       {
 	unsigned long                ep;
 	struct bfd_link_hash_entry * h;
-	
+
 	/* Get the value of __ep.  */
 	h = bfd_link_hash_lookup (info->hash, "__ep", false, false, true);
 	if (h == (struct bfd_link_hash_entry *) NULL
 	    || h->type != bfd_link_hash_defined)
-	  return bfd_reloc_continue;  /* Actually this indicates that __ep could not be found. */
+	  return bfd_reloc_continue;  /* Actually this indicates that __ep could not be found.  */
 
 	ep = (h->u.def.value
 	      + h->u.def.section->output_section->vma
@@ -1440,17 +1435,17 @@
 	value -= ep;
       }
     break;
-    
+
     case R_V850_CALLT_6_7_OFFSET:
       {
 	unsigned long                ctbp;
 	struct bfd_link_hash_entry * h;
-	
+
 	/* Get the value of __ctbp.  */
 	h = bfd_link_hash_lookup (info->hash, "__ctbp", false, false, true);
 	if (h == (struct bfd_link_hash_entry *) NULL
 	    || h->type != bfd_link_hash_defined)
-	  return (bfd_reloc_dangerous + 1);  /* Actually this indicates that __ctbp could not be found. */
+	  return (bfd_reloc_dangerous + 1);  /* Actually this indicates that __ctbp could not be found.  */
 
 	ctbp = (h->u.def.value
 	      + h->u.def.section->output_section->vma
@@ -1458,7 +1453,7 @@
 	value -= ctbp;
       }
     break;
-    
+
     case R_V850_CALLT_16_16_OFFSET:
       {
 	unsigned long                ctbp;
@@ -1466,7 +1461,7 @@
 
 	if (sym_sec == NULL)
 	  return bfd_reloc_undefined;
-	  
+
 	/* Get the value of __ctbp.  */
 	h = bfd_link_hash_lookup (info->hash, "__ctbp", false, false, true);
 	if (h == (struct bfd_link_hash_entry *) NULL
@@ -1481,7 +1476,7 @@
 	value -= (ctbp - sym_sec->output_section->vma);
       }
     break;
-      
+
     case R_V850_NONE:
     case R_V850_GNU_VTINHERIT:
     case R_V850_GNU_VTENTRY:
@@ -1492,7 +1487,7 @@
     }
 
   /* Perform the relocation.  */
-  return v850_elf_perform_relocation (input_bfd, r_type, value + addend, hit_data); 
+  return v850_elf_perform_relocation (input_bfd, r_type, value + addend, hit_data);
 }
 
 
@@ -1524,12 +1519,12 @@
 
       return false;
     }
-  
+
   /* Reset the list of remembered HI16S relocs to empty.  */
   free_hi16s     = previous_hi16s;
   previous_hi16s = NULL;
   hi16s_counter  = 0;
-  
+
   rel    = relocs;
   relend = relocs + input_section->reloc_count;
   for (; rel < relend; rel++)
@@ -1596,11 +1591,11 @@
       else
 	{
 	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-	  
+
 	  while (h->root.type == bfd_link_hash_indirect
 		 || h->root.type == bfd_link_hash_warning)
 	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
-	  
+
 	  if (h->root.type == bfd_link_hash_defined
 	      || h->root.type == bfd_link_hash_defweak)
 	    {
@@ -1696,7 +1691,7 @@
 	    case (bfd_reloc_dangerous + 1):
 	      msg = _("could not locate special linker symbol __ctbp");
 	      goto common_error;
-	      
+
 	    default:
 	      msg = _("internal error: unknown error");
 	      /* fall through */
@@ -1803,7 +1798,7 @@
   elf_elfheader (abfd)->e_flags |= val;
 }
 
-/* Function to keep V850 specific file flags. */
+/* Function to keep V850 specific file flags.  */
 static boolean
 v850_elf_set_private_flags (abfd, flags)
      bfd *    abfd;
@@ -1864,7 +1859,7 @@
 	 to the default values.  */
       if (bfd_get_arch_info (ibfd)->the_default)
 	return true;
-      
+
       elf_flags_init (obfd) = true;
       elf_elfheader (obfd)->e_flags = in_flags;
 
@@ -1896,14 +1891,14 @@
      PTR     ptr;
 {
   FILE * file = (FILE *) ptr;
-  
+
   BFD_ASSERT (abfd != NULL && ptr != NULL);
-  
+
   _bfd_elf_print_private_bfd_data (abfd, ptr);
-  
+
   /* xgettext:c-format */
   fprintf (file, _("private flags = %lx: "), elf_elfheader (abfd)->e_flags);
-  
+
   switch (elf_elfheader (abfd)->e_flags & EF_V850_ARCH)
     {
     default:
@@ -1911,9 +1906,9 @@
     case E_V850E_ARCH:  fprintf (file, _("v850e architecture")); break;
     case E_V850EA_ARCH: fprintf (file, _("v850ea architecture")); break;
     }
-  
+
   fputc ('\n', file);
-  
+
   return true;
 }
 
@@ -1934,7 +1929,6 @@
 static asymbol   v850_elf_zcom_symbol;
 static asymbol * v850_elf_zcom_symbol_ptr;
 
-
 /* Given a BFD section, try to locate the corresponding ELF section
    index.  */
 
@@ -1953,7 +1947,7 @@
     *retval = SHN_V850_ZCOMMON;
   else
     return false;
-  
+
   return true;
 }
 
@@ -1966,34 +1960,34 @@
 {
   elf_symbol_type * elfsym = (elf_symbol_type *) asym;
   unsigned short index;
-  
+
   index = elfsym->internal_elf_sym.st_shndx;
 
   /* If the section index is an "ordinary" index, then it may
      refer to a v850 specific section created by the assembler.
      Check the section's type and change the index it matches.
-     
+
      FIXME: Should we alter the st_shndx field as well ?  */
-  
+
   if (index < elf_elfheader(abfd)[0].e_shnum)
     switch (elf_elfsections(abfd)[index]->sh_type)
       {
       case SHT_V850_SCOMMON:
 	index = SHN_V850_SCOMMON;
 	break;
-	
+
       case SHT_V850_TCOMMON:
 	index = SHN_V850_TCOMMON;
 	break;
-	
+
       case SHT_V850_ZCOMMON:
 	index = SHN_V850_ZCOMMON;
 	break;
-	
+
       default:
 	break;
       }
-  
+
   switch (index)
     {
     case SHN_V850_SCOMMON:
@@ -2013,7 +2007,7 @@
       asym->section = & v850_elf_scom_section;
       asym->value = elfsym->internal_elf_sym.st_size;
       break;
-      
+
     case SHN_V850_TCOMMON:
       if (v850_elf_tcom_section.name == NULL)
 	{
@@ -2055,7 +2049,6 @@
 /* Hook called by the linker routine which adds symbols from an object
    file.  We must handle the special v850 section numbers here.  */
 
-/*ARGSUSED*/
 static boolean
 v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
      bfd *                    abfd;
@@ -2067,32 +2060,32 @@
      bfd_vma *                valp;
 {
   int index = sym->st_shndx;
-  
+
   /* If the section index is an "ordinary" index, then it may
      refer to a v850 specific section created by the assembler.
      Check the section's type and change the index it matches.
-     
+
      FIXME: Should we alter the st_shndx field as well ?  */
-  
+
   if (index < elf_elfheader(abfd)[0].e_shnum)
     switch (elf_elfsections(abfd)[index]->sh_type)
       {
       case SHT_V850_SCOMMON:
 	index = SHN_V850_SCOMMON;
 	break;
-	
+
       case SHT_V850_TCOMMON:
 	index = SHN_V850_TCOMMON;
 	break;
-	
+
       case SHT_V850_ZCOMMON:
 	index = SHN_V850_ZCOMMON;
 	break;
-	
+
       default:
 	break;
       }
-  
+
   switch (index)
     {
     case SHN_V850_SCOMMON:
@@ -2100,13 +2093,13 @@
       (*secp)->flags |= SEC_IS_COMMON;
       *valp = sym->st_size;
       break;
-      
+
     case SHN_V850_TCOMMON:
       *secp = bfd_make_section_old_way (abfd, ".tcommon");
       (*secp)->flags |= SEC_IS_COMMON;
       *valp = sym->st_size;
       break;
-      
+
     case SHN_V850_ZCOMMON:
       *secp = bfd_make_section_old_way (abfd, ".zcommon");
       (*secp)->flags |= SEC_IS_COMMON;
@@ -2129,7 +2122,7 @@
   /* If we see a common symbol, which implies a relocatable link, then
      if a symbol was in a special common section in an input file, mark
      it as a special common in the output file.  */
-  
+
   if (sym->st_shndx == SHN_COMMON)
     {
       if (strcmp (input_sec->name, ".scommon") == 0)
@@ -2193,18 +2186,17 @@
     }
   else if (strcmp (name, ".zcommon") == 0)
     hdr->sh_type = SHT_V850_ZCOMMON;
-  
+
   return true;
 }
 
-
 
 #define TARGET_LITTLE_SYM			bfd_elf32_v850_vec
 #define TARGET_LITTLE_NAME			"elf32-v850"
 #define ELF_ARCH				bfd_arch_v850
 #define ELF_MACHINE_CODE			EM_CYGNUS_V850
 #define ELF_MAXPAGESIZE				0x1000
-	
+
 #define elf_info_to_howto			v850_elf_info_to_howto_rela
 #define elf_info_to_howto_rel			v850_elf_info_to_howto_rel
 
@@ -2223,7 +2215,6 @@
 
 #define elf_backend_can_gc_sections 1
 
-
 #define bfd_elf32_bfd_is_local_label_name	v850_elf_is_local_label_name
 #define bfd_elf32_bfd_reloc_type_lookup		v850_elf_reloc_type_lookup
 #define bfd_elf32_bfd_copy_private_bfd_data 	v850_elf_copy_private_bfd_data
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 4c083fa..ce63cc7 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -34,7 +34,7 @@
 #define NO_COFF_SYMBOLS
 #define NO_COFF_LINENOS
 
-/* Get the ECOFF swapping routines.  Needed for the debug information. */
+/* Get the ECOFF swapping routines.  Needed for the debug information.  */
 #include "coff/internal.h"
 #include "coff/sym.h"
 #include "coff/symconst.h"
@@ -711,7 +711,7 @@
 	 false),		/* pcrel_offset */
 
   /* The high bits of a 32-bit displacement to the starting address of the
-     current section (the relocation target is ignored); the low bits are 
+     current section (the relocation target is ignored); the low bits are
      supplied in the subsequent R_ALPHA_IMMED_LO32 relocs.  */
   /* XXX: Not implemented.  */
   HOWTO (R_ALPHA_IMMED_SCN_HI32,
@@ -762,7 +762,7 @@
 	 0,			/* dst_mask */
 	 false),		/* pcrel_offset */
 
-  /* Misc ELF relocations. */
+  /* Misc ELF relocations.  */
 
   /* A dynamic relocation to copy the target into our .dynbss section.  */
   /* Not generated, as all Alpha objects use PIC, so it is not needed.  It
@@ -979,7 +979,7 @@
 
 /* The BFD_RELOC_ALPHA_USER_* relocations are used by the assembler to process
    the explicit !<reloc>!sequence relocations, and are mapped into the normal
-   relocations at the end of processing. */
+   relocations at the end of processing.  */
   {BFD_RELOC_ALPHA_USER_LITERAL,	R_ALPHA_LITERAL},
   {BFD_RELOC_ALPHA_USER_LITUSE_BASE,	R_ALPHA_LITUSE},
   {BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF,	R_ALPHA_LITUSE},
@@ -1022,7 +1022,7 @@
   cache_ptr->howto = &elf64_alpha_howto_table[r_type];
 }
 
-/* These functions do relaxation for Alpha ELF. 
+/* These functions do relaxation for Alpha ELF.
 
    Currently I'm only handling what I can do with existing compiler
    and assembler support, which means no instructions are removed,
@@ -1062,11 +1062,11 @@
 };
 
 static Elf_Internal_Rela * elf64_alpha_relax_with_lituse
-  PARAMS((struct alpha_relax_info *info, bfd_vma symval, 
+  PARAMS((struct alpha_relax_info *info, bfd_vma symval,
           Elf_Internal_Rela *irel, Elf_Internal_Rela *irelend));
 
 static boolean elf64_alpha_relax_without_lituse
-  PARAMS((struct alpha_relax_info *info, bfd_vma symval, 
+  PARAMS((struct alpha_relax_info *info, bfd_vma symval,
           Elf_Internal_Rela *irel));
 
 static bfd_vma elf64_alpha_relax_opt_call
@@ -1125,14 +1125,15 @@
 	flags |= 1 << urel->r_addend;
     }
 
-  /* A little preparation for the loop... */
+  /* A little preparation for the loop...  */
   disp = symval - info->gp;
-  fits16 = (disp >= -(bfd_signed_vma)0x8000 && disp < 0x8000);
-  fits32 = (disp >= -(bfd_signed_vma)0x80000000 && disp < 0x7fff8000);
 
   for (urel = irel+1, i = 0; i < count; ++i, ++urel)
     {
       unsigned int insn;
+      int insn_disp;
+      bfd_signed_vma xdisp;
+
       insn = bfd_get_32 (info->abfd, info->contents + urel->r_offset);
 
       switch (urel->r_addend)
@@ -1145,14 +1146,23 @@
 
 	case 1: /* MEM FORMAT */
 	  /* We can always optimize 16-bit displacements.  */
+
+	  /* Extract the displacement from the instruction, sign-extending
+	     it if necessary, then test whether it is within 16 or 32 bits
+	     displacement from GP.  */
+	  insn_disp = insn & 0x0000ffff;
+	  if (insn_disp & 0x00008000)
+	    insn_disp |= 0xffff0000;  /* Negative: sign-extend.  */
+
+	  xdisp = disp + insn_disp;
+	  fits16 = (xdisp >= - (bfd_signed_vma) 0x00008000 && xdisp < 0x00008000);
+	  fits32 = (xdisp >= - (bfd_signed_vma) 0x80000000 && xdisp < 0x7fff8000);
+
 	  if (fits16)
 	    {
-	      /* FIXME: sanity check the insn for mem format with
-		 zero addend.  */
-
-	      /* Take the op code and dest from this insn, take the base 
+	      /* Take the op code and dest from this insn, take the base
 		 register from the literal insn.  Leave the offset alone.  */
-	      insn = (insn & 0xffe00000) | (lit_insn & 0x001f0000);
+	      insn = (insn & 0xffe0ffff) | (lit_insn & 0x001f0000);
 	      urel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
 					   R_ALPHA_GPRELLOW);
 	      urel->r_addend = irel->r_addend;
@@ -1165,8 +1175,7 @@
 	  /* If all mem+byte, we can optimize 32-bit mem displacements.  */
 	  else if (fits32 && !(flags & ~6))
 	    {
-	      /* FIXME: sanity check that lit insn Ra is mem insn Rb, and
-		 that mem_insn disp is zero.  */
+	      /* FIXME: sanity check that lit insn Ra is mem insn Rb.  */
 
 	      irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
 					   R_ALPHA_GPRELHIGH);
@@ -1215,12 +1224,12 @@
 	      {
 		Elf_Internal_Rela *xrel;
 
-		/* Preserve branch prediction call stack when possible. */
+		/* Preserve branch prediction call stack when possible.  */
 		if ((insn & INSN_JSR_MASK) == INSN_JSR)
 		  insn = (OP_BSR << 26) | (insn & 0x03e00000);
 		else
 		  insn = (OP_BR << 26) | (insn & 0x03e00000);
-		  
+
 		urel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
 					     R_ALPHA_BRADDR);
 		urel->r_addend = irel->r_addend;
@@ -1234,7 +1243,7 @@
 
 		/* Kill any HINT reloc that might exist for this insn.  */
 		xrel = (elf64_alpha_find_reloc_at_ofs
-			(info->relocs, info->relend, urel->r_offset, 
+			(info->relocs, info->relend, urel->r_offset,
 			 R_ALPHA_HINT));
 		if (xrel)
 		  xrel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
@@ -1249,7 +1258,7 @@
 	       This does depend on every place a gp could be reloaded will
 	       be, which currently happens for all code produced by gcc, but
 	       not necessarily by hand-coded assembly, or if sibling calls
-	       are enabled in gcc. 
+	       are enabled in gcc.
 
 	       Perhaps conditionalize this on a flag being set in the target
 	       object file's header, and have gcc set it?  */
@@ -1295,22 +1304,22 @@
 
   /* If the symbol is marked NOPV, we are being told the function never
      needs its procedure value.  */
-  if (info->other == STO_ALPHA_NOPV)
+  if ((info->other & STO_ALPHA_STD_GPLOAD) == STO_ALPHA_NOPV)
     return symval;
 
   /* If the symbol is marked STD_GP, we are being told the function does
-     a normal ldgp in the first two words.  */ 
-  else if (info->other == STO_ALPHA_STD_GPLOAD)
+     a normal ldgp in the first two words.  */
+  else if ((info->other & STO_ALPHA_STD_GPLOAD) == STO_ALPHA_STD_GPLOAD)
     ;
 
   /* Otherwise, we may be able to identify a GP load in the first two
      words, which we can then skip.  */
-  else 
+  else
     {
       Elf_Internal_Rela *tsec_relocs, *tsec_relend, *tsec_free, *gpdisp;
       bfd_vma ofs;
 
-      /* Load the relocations from the section that the target symbol is in. */
+      /* Load the relocations from the section that the target symbol is in.  */
       if (info->sec == info->tsec)
 	{
 	  tsec_relocs = info->relocs;
@@ -1332,7 +1341,7 @@
       /* Recover the symbol's offset within the section.  */
       ofs = (symval - info->tsec->output_section->vma
 	     - info->tsec->output_offset);
-  
+
       /* Look for a GPDISP reloc.  */
       gpdisp = (elf64_alpha_find_reloc_at_ofs
 		(tsec_relocs, tsec_relend, ofs, R_ALPHA_GPDISP));
@@ -1347,7 +1356,7 @@
         free (tsec_free);
     }
 
-  /* We've now determined that we can skip an initial gp load.  Verify 
+  /* We've now determined that we can skip an initial gp load.  Verify
      that the call and the target use the same gp.   */
   if (info->link_info->hash->creator != info->tsec->owner->xvec
       || info->gotobj != alpha_elf_tdata (info->tsec->owner)->gotobj)
@@ -1408,7 +1417,7 @@
 
      Any such memory load insn may be substituted by a load directly
      off the GP.  This allows the memory load insn to be issued before
-     the calculated GP register would otherwise be ready. 
+     the calculated GP register would otherwise be ready.
 
      Any such jsr insn can be replaced by a bsr if it is in range.
 
@@ -1460,7 +1469,7 @@
   if (! link_info->keep_memory)
     free_relocs = internal_relocs;
 
-  memset(&info, 0, sizeof(info));
+  memset(&info, 0, sizeof (info));
   info.abfd = abfd;
   info.sec = sec;
   info.link_info = link_info;
@@ -1543,8 +1552,8 @@
 	    info.tsec = bfd_abs_section_ptr;
 	  else if (isym.st_shndx == SHN_COMMON)
 	    info.tsec = bfd_com_section_ptr;
-	  else 
-	    continue;	/* who knows. */
+	  else
+	    continue;	/* who knows.  */
 
 	  info.h = NULL;
 	  info.other = isym.st_other;
@@ -1962,7 +1971,7 @@
   char *ext_hdr = NULL;
 
   swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
-  memset (debug, 0, sizeof(*debug));
+  memset (debug, 0, sizeof (*debug));
 
   ext_hdr = (char *) bfd_malloc ((size_t) swap->external_hdr_size);
   if (ext_hdr == NULL && swap->external_hdr_size != 0)
@@ -2539,7 +2548,8 @@
 		  sreloc = bfd_make_section (dynobj, rel_sec_name);
 		  if (sreloc == NULL
 		      || !bfd_set_section_flags (dynobj, sreloc,
-						 (SEC_ALLOC|SEC_LOAD
+						 ((sec->flags & (SEC_ALLOC
+								 | SEC_LOAD))
 						  | SEC_HAS_CONTENTS
 						  | SEC_IN_MEMORY
 						  | SEC_LINKER_CREATED
@@ -2555,7 +2565,7 @@
 		 don't know whether we'll actually need a dynamic relocation
 		 entry for this reloc.  So make a record of it.  Once we
 		 find out if this thing needs dynamic relocation we'll
-		 expand the relocation sections by the appropriate amount. */
+		 expand the relocation sections by the appropriate amount.  */
 
 	      struct alpha_elf_reloc_entry *rent;
 
@@ -3127,7 +3137,7 @@
 	    || relent->rtype == R_ALPHA_REFQUAD)
 	  {
 	    relent->srel->_raw_size +=
-	      sizeof(Elf64_External_Rela) * relent->count;
+	      sizeof (Elf64_External_Rela) * relent->count;
 	  }
 
       dynobj = elf_hash_table(info)->dynobj;
@@ -3202,7 +3212,7 @@
 	       i = alpha_elf_tdata(i)->got_link_next)
 	    count += alpha_elf_tdata(i)->n_local_got_entries;
 
-	  srel->_raw_size += count * sizeof(Elf64_External_Rela);
+	  srel->_raw_size += count * sizeof (Elf64_External_Rela);
 	}
     }
   /* else we're not dynamic and by definition we don't need such things.  */
@@ -3305,13 +3315,14 @@
       if (! bfd_elf64_add_dynamic_entry (info, DT_RELA, 0)
 	  || ! bfd_elf64_add_dynamic_entry (info, DT_RELASZ, 0)
 	  || ! bfd_elf64_add_dynamic_entry (info, DT_RELAENT,
-					    sizeof(Elf64_External_Rela)))
+					    sizeof (Elf64_External_Rela)))
 	return false;
 
       if (reltext)
 	{
 	  if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
@@ -3394,7 +3405,7 @@
 	     in which case we have to adjust according to where the
 	     section symbol winds up in the output section.  */
 
-	  /* The symbol associated with GPDISP and LITUSE is 
+	  /* The symbol associated with GPDISP and LITUSE is
 	     immaterial.  Only the addend is significant.  */
 	  if (r_type == R_ALPHA_GPDISP || r_type == R_ALPHA_LITUSE)
 	    continue;
@@ -3517,7 +3528,7 @@
 	case R_ALPHA_OP_PSUB:
 	case R_ALPHA_OP_PRSHIFT:
 	  /* We hate these silly beasts.  */
-	  abort();
+	  abort ();
 
 	case R_ALPHA_LITERAL:
 	  {
@@ -3571,7 +3582,7 @@
 					       ((Elf64_External_Rela *)
 					        srelgot->contents)
 					       + srelgot->reloc_count++);
-		    BFD_ASSERT (sizeof(Elf64_External_Rela)
+		    BFD_ASSERT (sizeof (Elf64_External_Rela)
 				* srelgot->reloc_count
 				<= srelgot->_cooked_size);
 		  }
@@ -3676,7 +3687,7 @@
 				       ((Elf64_External_Rela *)
 					srel->contents)
 				       + srel->reloc_count++);
-	    BFD_ASSERT (sizeof(Elf64_External_Rela) * srel->reloc_count
+	    BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
 			<= srel->_cooked_size);
 	  }
 	  goto default_reloc;
@@ -3829,7 +3840,7 @@
 					     ((Elf64_External_Rela *)
 					      srel->contents)
 					     + srel->reloc_count++);
-		  BFD_ASSERT (sizeof(Elf64_External_Rela) * srel->reloc_count
+		  BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
 			      <= srel->_cooked_size);
 		}
 
@@ -3862,7 +3873,7 @@
 	  bfd_elf64_swap_reloca_out (output_bfd, &outrel,
 				     ((Elf64_External_Rela *)srel->contents
 				      + srel->reloc_count++));
-	  BFD_ASSERT (sizeof(Elf64_External_Rela) * srel->reloc_count
+	  BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
 		      <= srel->_cooked_size);
 	}
     }
@@ -4280,7 +4291,6 @@
 	    }
 #endif
 
-
 	  /* Build the external symbol information.  */
 	  einfo.abfd = abfd;
 	  einfo.info = info;
@@ -4600,7 +4610,7 @@
 
 /* ECOFF swapping routines.  These are used when dealing with the
    .mdebug section, which is in the ECOFF debugging format.  Copied
-   from elf32-mips.c. */
+   from elf32-mips.c.  */
 static const struct ecoff_debug_swap
 elf64_alpha_ecoff_debug_swap =
 {
@@ -4643,6 +4653,36 @@
   elf64_alpha_read_ecoff_info
 };
 
+/* Use a non-standard hash bucket size of 8.  */
+
+const struct elf_size_info alpha_elf_size_info =
+{
+  sizeof (Elf64_External_Ehdr),
+  sizeof (Elf64_External_Phdr),
+  sizeof (Elf64_External_Shdr),
+  sizeof (Elf64_External_Rel),
+  sizeof (Elf64_External_Rela),
+  sizeof (Elf64_External_Sym),
+  sizeof (Elf64_External_Dyn),
+  sizeof (Elf_External_Note),
+  8,
+  1,
+  64, 8,
+  ELFCLASS64, EV_CURRENT,
+  bfd_elf64_write_out_phdrs,
+  bfd_elf64_write_shdrs_and_ehdr,
+  bfd_elf64_write_relocs,
+  bfd_elf64_swap_symbol_out,
+  bfd_elf64_slurp_reloc_table,
+  bfd_elf64_slurp_symbol_table,
+  bfd_elf64_swap_dyn_in,
+  bfd_elf64_swap_dyn_out,
+  NULL,
+  NULL,
+  NULL,
+  NULL
+};
+
 #define TARGET_LITTLE_SYM	bfd_elf64_alpha_vec
 #define TARGET_LITTLE_NAME	"elf64-alpha"
 #define ELF_ARCH		bfd_arch_alpha
@@ -4698,9 +4738,10 @@
 #define elf_backend_ecoff_debug_swap \
   &elf64_alpha_ecoff_debug_swap
 
-/*
- * A few constants that determine how the .plt section is set up.
- */
+#define elf_backend_size_info \
+  alpha_elf_size_info
+
+/* A few constants that determine how the .plt section is set up.  */
 #define elf_backend_want_got_plt 0
 #define elf_backend_plt_readonly 0
 #define elf_backend_want_plt_sym 1
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index b5b9f7f..22a6f9e 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -17,6 +17,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
+#include "alloca-conf.h"
 #include "bfd.h"
 #include "sysdep.h"
 #include "libbfd.h"
@@ -29,7 +30,7 @@
 #define PLT_ENTRY_SIZE 0x10
 #define DLT_ENTRY_SIZE 0x8
 #define OPD_ENTRY_SIZE 0x20
- 
+
 #define ELF_DYNAMIC_INTERPRETER "/usr/lib/pa20_64/dld.sl"
 
 /* The stub is supposed to load the target address and target's DP
@@ -55,7 +56,7 @@
   bfd_vma opd_offset;
   bfd_vma stub_offset;
 
-  /* The symbol table entry, if any, that this was derrived from.  */
+  /* The symbol table entry, if any, that this was derived from.  */
   struct elf_link_hash_entry *h;
 
   /* The index of the (possibly local) symbol in the input bfd and its
@@ -168,19 +169,17 @@
 	   boolean create, boolean copy));
 static void elf64_hppa_dyn_hash_traverse
   PARAMS ((struct elf64_hppa_dyn_hash_table *table,
-	   boolean (*func)(struct elf64_hppa_dyn_hash_entry *, PTR),
+	   boolean (*func) (struct elf64_hppa_dyn_hash_entry *, PTR),
 	   PTR info));
 
 static const char *get_dyn_name
-  PARAMS ((bfd *abfd, struct elf_link_hash_entry *h,
-	   const Elf_Internal_Rela *rel, char **pbuf, size_t *plen));
-
+  PARAMS ((asection *, struct elf_link_hash_entry *,
+	   const Elf_Internal_Rela *, char **, size_t *));
 
 /* This must follow the definitions of the various derived linker
    hash tables and shared functions.  */
 #include "elf-hppa.h"
 
-
 static boolean elf64_hppa_object_p
   PARAMS ((bfd *));
 
@@ -202,7 +201,7 @@
 static boolean elf64_hppa_finish_dynamic_symbol
   PARAMS ((bfd *, struct bfd_link_info *,
 	   struct elf_link_hash_entry *, Elf_Internal_Sym *));
-	
+
 static boolean elf64_hppa_finish_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
 
@@ -262,10 +261,10 @@
 static boolean
 elf64_hppa_dyn_hash_table_init (ht, abfd, new)
      struct elf64_hppa_dyn_hash_table *ht;
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      new_hash_entry_func new;
 {
-  memset (ht, 0, sizeof(*ht));
+  memset (ht, 0, sizeof (*ht));
   return bfd_hash_table_init (&ht->root, new);
 }
 
@@ -288,7 +287,7 @@
 
   /* Initialize our local data.  All zeros, and definitely easier
      than setting 8 bit fields.  */
-  memset (ret, 0, sizeof(*ret));
+  memset (ret, 0, sizeof (*ret));
 
   /* Call the allocation method of the superclass.  */
   ret = ((struct elf64_hppa_dyn_hash_entry *)
@@ -393,14 +392,13 @@
   return true;
 }
 
-
 /* Construct a string for use in the elf64_hppa_dyn_hash_table.  The
-   name describes what was once potentially anonymous memory.  We 
+   name describes what was once potentially anonymous memory.  We
    allocate memory as necessary, possibly reusing PBUF/PLEN.  */
 
 static const char *
-get_dyn_name (abfd, h, rel, pbuf, plen)
-     bfd *abfd;
+get_dyn_name (sec, h, rel, pbuf, plen)
+     asection *sec;
      struct elf_link_hash_entry *h;
      const Elf_Internal_Rela *rel;
      char **pbuf;
@@ -416,11 +414,8 @@
   if (h)
     nlen = strlen (h->root.root.string);
   else
-    {
-      nlen = sizeof(void*)*2 + 1 + sizeof(bfd_vma)*4 + 1 + 1;
-      nlen += 10;	/* %p slop */
-    }
-  tlen = nlen + 1 + 16 + 1;
+    nlen = 8 + 1 + sizeof (rel->r_info) * 2 - 8;
+  tlen = nlen + 1 + sizeof (rel->r_addend) * 2 + 1;
 
   len = *plen;
   buf = *pbuf;
@@ -437,11 +432,14 @@
   if (h)
     {
       memcpy (buf, h->root.root.string, nlen);
+      buf[nlen++] = '+';
       sprintf_vma (buf + nlen, rel->r_addend);
     }
   else
     {
-      nlen = sprintf (buf, "%p:%lx", abfd, ELF64_R_SYM (rel->r_info));
+      nlen = sprintf (buf, "%x:%lx",
+		      sec->id & 0xffffffff,
+		      (long) ELF64_R_SYM (rel->r_info));
       if (rel->r_addend)
 	{
 	  buf[nlen++] = '+';
@@ -502,7 +500,7 @@
   return true;
 }
 
-/* Add a new entry to the list of dynamic relocations against DYN_H. 
+/* Add a new entry to the list of dynamic relocations against DYN_H.
 
    We use this to keep a record of all the FPTR relocations against a
    particular symbol so that we can create FPTR relocations in the
@@ -571,11 +569,11 @@
 
   /* If necessary, build a new table holding section symbols indices
      for this BFD.  This is disgusting.  */
- 
+
   if (info->shared && hppa_info->section_syms_bfd != abfd)
     {
-      int i, highest_shndx;
-      asection *section;
+      unsigned long i;
+      int highest_shndx;
       Elf_Internal_Sym *local_syms, *isym;
       Elf64_External_Sym *ext_syms, *esym;
 
@@ -668,7 +666,7 @@
     }
   else
     sec_symndx = 0;
- 
+
   dlt = plt = stubs = NULL;
   buf = NULL;
   buf_len = 0;
@@ -748,6 +746,7 @@
 	/* These are function calls.  Depending on their precise target we
 	   may need to make a stub for them.  The stub uses the PLT, so we
 	   need to create PLT entries for these symbols too.  */
+	case R_PARISC_PCREL12F:
 	case R_PARISC_PCREL17F:
 	case R_PARISC_PCREL22F:
 	case R_PARISC_PCREL32:
@@ -818,7 +817,7 @@
 	continue;
 
       /* Collect a canonical name for this address.  */
-      addr_name = get_dyn_name (abfd, h, rel, &buf, &buf_len);
+      addr_name = get_dyn_name (sec, h, rel, &buf, &buf_len);
 
       /* Collect the canonical entry data for this address.  */
       dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
@@ -867,7 +866,7 @@
 
 	  /* FPTRs are not allocated by the dynamic linker for PA64, though
 	     it is possible that will change in the future.  */
-	    
+
 	  /* This could be a local function that had its address taken, in
 	     which case H will be NULL.  */
 	  if (h)
@@ -978,6 +977,8 @@
 	return false;
 
       dyn_h->want_opd = 1;
+      /* Put a flag here for output_symbol_hook.  */
+      dyn_h->st_shndx = -1;
       h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
     }
 
@@ -1081,7 +1082,7 @@
   if (dyn_h->want_opd)
     {
       struct elf_link_hash_entry *h = dyn_h->h;
-      
+
       if (h)
 	while (h->root.type == bfd_link_hash_indirect
 	       || h->root.type == bfd_link_hash_warning)
@@ -1177,7 +1178,7 @@
 static boolean
 get_opd (abfd, info, hppa_info)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      struct elf64_hppa_link_hash_table *hppa_info;
 {
   asection *opd;
@@ -1215,7 +1216,7 @@
 static boolean
 get_plt (abfd, info, hppa_info)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      struct elf64_hppa_link_hash_table *hppa_info;
 {
   asection *plt;
@@ -1253,7 +1254,7 @@
 static boolean
 get_dlt (abfd, info, hppa_info)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      struct elf64_hppa_link_hash_table *hppa_info;
 {
   asection *dlt;
@@ -1291,7 +1292,7 @@
 static boolean
 get_stub (abfd, info, hppa_info)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      struct elf64_hppa_link_hash_table *hppa_info;
 {
   asection *stub;
@@ -1358,7 +1359,7 @@
 	Should contain dynamic IPLT (and EPLT?) relocations.
 
    .opd:
-	FPTRS 
+	FPTRS
 
    .rela.opd:
 	EPLT relocations for symbols exported from shared libraries.  */
@@ -1510,7 +1511,7 @@
 
 static boolean
 elf64_hppa_adjust_dynamic_symbol (info, h)
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      struct elf_link_hash_entry *h;
 {
   /* ??? Undefined symbols with PLT entries should be re-defined
@@ -1551,7 +1552,6 @@
   boolean plt;
   boolean relocs;
   boolean reltext;
-  boolean stubs;
   struct elf64_hppa_allocate_data data;
   struct elf64_hppa_link_hash_table *hppa_info;
 
@@ -1738,10 +1738,14 @@
 	}
 
       /* Allocate memory for the section contents if it has not
-	 been allocated already.  */
+	 been allocated already.  We use bfd_zalloc here in case
+	 unused entries are not reclaimed before the section's
+	 contents are written out.  This should not happen, but this
+	 way if it does, we get a R_PARISC_NONE reloc instead of
+	 garbage.  */
       if (s->contents == NULL)
 	{
-	  s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
+	  s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
 	  if (s->contents == NULL && s->_raw_size != 0)
 	    return false;
 	}
@@ -1790,6 +1794,7 @@
 	{
 	  if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
@@ -1807,11 +1812,11 @@
 
 static boolean
 elf64_hppa_link_output_symbol_hook (abfd, info, name, sym, input_sec)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      struct bfd_link_info *info;
      const char *name;
      Elf_Internal_Sym *sym;
-     asection *input_sec;
+     asection *input_sec ATTRIBUTE_UNUSED;
 {
   struct elf64_hppa_link_hash_table *hppa_info;
   struct elf64_hppa_dyn_hash_entry *dyn_h;
@@ -1826,13 +1831,18 @@
   dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
 				      name, false, false);
 
-  /* Function symbols for which we created .opd entries were munged
-     by finish_dynamic_symbol and have to be un-munged here.  */
-  if (dyn_h && dyn_h->want_opd)
+  /* Function symbols for which we created .opd entries *may* have been
+     munged by finish_dynamic_symbol and have to be un-munged here.
+
+     Note that finish_dynamic_symbol sometimes turns dynamic symbols
+     into non-dynamic ones, so we initialize st_shndx to -1 in
+     mark_exported_functions and check to see if it was overwritten
+     here instead of just checking dyn_h->h->dynindx.  */
+  if (dyn_h && dyn_h->want_opd && dyn_h->st_shndx != -1)
     {
       /* Restore the saved value and section index.  */
       sym->st_value = dyn_h->st_value;
-      sym->st_shndx = dyn_h->st_shndx; 
+      sym->st_shndx = dyn_h->st_shndx;
     }
 
   return true;
@@ -1905,13 +1915,13 @@
       else
 	value = (h->root.u.def.value + h->root.u.def.section->vma);
 
-      /* Fill in the entry in the procedure linkage table. 
+      /* Fill in the entry in the procedure linkage table.
 
 	 The format of a plt entry is
-	 <funcaddr> <__gp>. 
+	 <funcaddr> <__gp>.
 
 	 plt_offset is the offset within the PLT section at which to
-	 install the PLT entry. 
+	 install the PLT entry.
 
 	 We are modifying the in-memory PLT contents here, so we do not add
 	 in the output_offset of the PLT section.  */
@@ -1954,7 +1964,7 @@
       /* Fix up the first ldd instruction.
 
 	 We are modifying the contents of the STUB section in memory,
-	 so we do not need to include its output offset in this computation. 
+	 so we do not need to include its output offset in this computation.
 
 	 Note the plt_offset value is the value of the PLT entry relative to
 	 the start of the PLT section.  These instructions will reference
@@ -1963,7 +1973,7 @@
 
 	 gp_offset contains the offset of __gp within the PLT section.  */
       value = dyn_h->plt_offset - hppa_info->gp_offset;
-      
+
       insn = bfd_get_32 (stub->owner, stub->contents + dyn_h->stub_offset);
       insn &= 0xffffc00e;
       insn |= ((value & 0x2000) >> 13);
@@ -1974,7 +1984,7 @@
 
       /* Fix up the second ldd instruction.  */
       value = dyn_h->plt_offset - hppa_info->gp_offset + 8;
-      
+
       insn = bfd_get_32 (stub->owner, stub->contents + dyn_h->stub_offset + 8);
       insn &= 0xffffc00e;
       insn |= ((value & 0x2000) >> 13);
@@ -2014,7 +2024,7 @@
     {
       bfd_vma value;
 
-      /* The first two words of an .opd entry are zero. 
+      /* The first two words of an .opd entry are zero.
 
 	 We are modifying the contents of the OPD section in memory, so we
 	 do not need to include its output offset in this computation.  */
@@ -2038,7 +2048,6 @@
   if (info->shared && dyn_h && dyn_h->want_opd)
     {
       Elf64_Internal_Rela rel;
-      bfd_vma value;
       int dynindx;
 
       /* We may need to do a relocation against a local symbol, in
@@ -2068,7 +2077,7 @@
 	 (if we did, the data in the .opd would reference itself rather
 	 than the actual address of the function).  Instead we have to use
 	 a new dynamic symbol which has the same value as the original global
-	 function symbol. 
+	 function symbol.
 
 	 We prefix the original symbol with a "." and use the new symbol in
 	 the EPLT relocation.  This new symbol has already been recorded in
@@ -2140,7 +2149,7 @@
       bfd_vma value;
 
       /* If we had an LTOFF_FPTR style relocation we want the DLT entry
-	 to point to the FPTR entry in the .opd section. 
+	 to point to the FPTR entry in the .opd section.
 
 	 We include the OPD's output offset in this computation as
 	 we are referring to an absolute address in the resulting
@@ -2185,7 +2194,6 @@
 	  = _bfd_elf_link_lookup_local_dynindx (info, dyn_h->owner,
 						dyn_h->sym_indx);
 
-
       /* Create a dynamic relocation for this entry.  Do include the output
 	 offset of the DLT entry since we need an absolute address in the
 	 resulting object file.  */
@@ -2257,7 +2265,7 @@
 	      break;
 	    }
 
-	  /* Create a dynamic relocation for this entry. 
+	  /* Create a dynamic relocation for this entry.
 
 	     We need the output offset for the reloc's section because
 	     we are creating an absolute address in the resulting object
@@ -2280,15 +2288,13 @@
 	     the .opd entry.  At least that seems sensible until you
 	     realize there's no local dynamic symbols we can use for that
 	     purpose.  Thus the hair in the check_relocs routine.
-	
+
 	     We use a section symbol recorded by check_relocs as the
 	     base symbol for the relocation.  The addend is the difference
 	     between the section symbol and the address of the .opd entry.  */
 	  if (info->shared && rent->type == R_PARISC_FPTR64)
 	    {
 	      bfd_vma value, value2;
-	      asymbol *sym;
-	      int elf_index;
 
 	      /* First compute the address of the opd entry for this symbol.  */
 	      value = (dyn_h->opd_offset
@@ -2303,7 +2309,7 @@
 	      /* Compute the difference between the start of the section
 		 with the relocation and the opd entry.  */
 	      value -= value2;
-		
+
 	      /* The result becomes the addend of the relocation.  */
 	      rel.r_addend = value;
 
@@ -2360,13 +2366,11 @@
 				elf64_hppa_finalize_dlt,
 				info);
 
-
   sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
 
   if (elf_hash_table (info)->dynamic_sections_created)
     {
       Elf64_External_Dyn *dyncon, *dynconend;
-      struct elf_link_hash_entry *h;
 
       BFD_ASSERT (sdyn != NULL);
 
@@ -2444,11 +2448,10 @@
   return true;
 }
 
-
 /* Return the number of additional phdrs we will need.
 
    The generic ELF code only creates PT_PHDRs for executables.  The HP
-   dynamic linker requires PT_PHDRs for dynamic libraries too. 
+   dynamic linker requires PT_PHDRs for dynamic libraries too.
 
    This routine indicates that the backend needs one additional program
    header for that case.
@@ -2475,10 +2478,10 @@
    specific backend.
 
    The generic ELF code only creates PT_PHDRs for executables.  The HP
-   dynamic linker requires PT_PHDRs for dynamic libraries too. 
+   dynamic linker requires PT_PHDRs for dynamic libraries too.
 
    This allocates the PT_PHDR and initializes it in a manner suitable
-   for the HP linker. 
+   for the HP linker.
 
    Note we do not have access to the link info structure here, so we have
    to guess whether or not we are building a shared library based on the
@@ -2488,7 +2491,7 @@
 elf64_hppa_modify_segment_map (abfd)
      bfd *abfd;
 {
-  struct elf_segment_map *m, **pm;
+  struct elf_segment_map *m;
   asection *s;
 
   s = bfd_get_section_by_name (abfd, ".interp");
@@ -2517,7 +2520,7 @@
   for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
     if (m->p_type == PT_LOAD)
       {
-        int i;
+	unsigned int i;
 
 	for (i = 0; i < m->count; i++)
 	  {
@@ -2622,7 +2625,6 @@
 #define elf_backend_link_output_symbol_hook \
 	elf64_hppa_link_output_symbol_hook
 
-
 #define elf_backend_want_got_plt	0
 #define elf_backend_plt_readonly	0
 #define elf_backend_want_plt_sym	0
diff --git a/bfd/elf64-hppa.h b/bfd/elf64-hppa.h
index 5098e0c..9c15e6a 100644
--- a/bfd/elf64-hppa.h
+++ b/bfd/elf64-hppa.h
@@ -26,7 +26,7 @@
 #include "elf/hppa.h"
 
 extern elf_hppa_reloc_type ** _bfd_elf64_hppa_gen_reloc_type
-  PARAMS ((bfd *, elf_hppa_reloc_type, int, int, int, asymbol *));
+  PARAMS ((bfd *, elf_hppa_reloc_type, int, unsigned int, int, asymbol *));
 
 /* Define groups of basic relocations.  FIXME:  These should
    be the only basic relocations created by GAS.  The rest
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index 6fc0dcd..abd0f0e 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -45,7 +45,7 @@
 #include "coff/ecoff.h"
 /* The 64 bit versions of the mdebug data structures are in alpha.h.  */
 #include "coff/alpha.h"
-#define ECOFF_64
+#define ECOFF_SIGNED_64
 #include "ecoffswap.h"
 
 static void mips_elf64_swap_reloc_in
@@ -623,7 +623,7 @@
 	 0,			/* dst_mask */
 	 false),		/* pcrel_offset */
 
-  /* Protected jump conversion.  This is an optimization hint.  No 
+  /* Protected jump conversion.  This is an optimization hint.  No
      relocation is required for correctness.  */
   HOWTO (R_MIPS_JALR,	        /* type */
 	 0,			/* rightshift */
@@ -1177,7 +1177,7 @@
 	 0,			/* dst_mask */
 	 false),		/* pcrel_offset */
 
-  /* Protected jump conversion.  This is an optimization hint.  No 
+  /* Protected jump conversion.  This is an optimization hint.  No
      relocation is required for correctness.  */
   HOWTO (R_MIPS_JALR,	        /* type */
 	 0,			/* rightshift */
@@ -1270,7 +1270,7 @@
 {
   Elf64_Mips_Internal_Rel mirel;
 
-  mips_elf64_swap_reloc_in (abfd, 
+  mips_elf64_swap_reloc_in (abfd,
 			    (const Elf64_Mips_External_Rel *) src,
 			    &mirel);
 
@@ -1292,7 +1292,7 @@
 {
   Elf64_Mips_Internal_Rela mirela;
 
-  mips_elf64_swap_reloca_in (abfd, 
+  mips_elf64_swap_reloca_in (abfd,
 			     (const Elf64_Mips_External_Rela *) src,
 			     &mirela);
 
@@ -1324,7 +1324,7 @@
   mirel.r_ssym = STN_UNDEF;
   mirel.r_type3 = R_MIPS_NONE;
 
-  mips_elf64_swap_reloc_out (abfd, &mirel, 
+  mips_elf64_swap_reloc_out (abfd, &mirel,
 			     (Elf64_Mips_External_Rel *) dst);
 }
 
@@ -1346,7 +1346,7 @@
   mirela.r_ssym = STN_UNDEF;
   mirela.r_type3 = R_MIPS_NONE;
 
-  mips_elf64_swap_reloca_out (abfd, &mirela, 
+  mips_elf64_swap_reloca_out (abfd, &mirela,
 			      (Elf64_Mips_External_Rela *) dst);
 }
 
@@ -2150,7 +2150,7 @@
 #define elf_backend_plt_header_size	0
 #define elf_backend_may_use_rel_p       1
 
-/* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit 
+/* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit
    MIPS-specific function only applies to IRIX5, which had no 64-bit
    ABI.  */
 #define bfd_elf64_find_nearest_line	_bfd_mips_elf_find_nearest_line
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index ca2e7c1..087fe96 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -240,7 +240,7 @@
 /* Due to the way how we handle R_SPARC_OLO10, each entry in a SHT_RELA
    section can represent up to two relocs, we must tell the user to allocate
    more space.  */
-   
+
 static long
 sparc64_elf_get_reloc_upper_bound (abfd, sec)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -256,7 +256,7 @@
   return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 2;
 }
 
-/* Read  relocations for ASECT from REL_HDR.  There are RELOC_COUNT of 
+/* Read  relocations for ASECT from REL_HDR.  There are RELOC_COUNT of
    them.  We cannot use generic elf routines for this,  because R_SPARC_OLO10
    has secondary addend in ELF64_R_TYPE_DATA.  We handle it as two relocations
    for the same location,  R_SPARC_LO10 and R_SPARC_13.  */
@@ -292,7 +292,7 @@
 
   entsize = rel_hdr->sh_entsize;
   BFD_ASSERT (entsize == sizeof (Elf64_External_Rela));
-  
+
   count = rel_hdr->sh_size / entsize;
 
   for (i = 0, relent = relents; i < count;
@@ -398,20 +398,20 @@
       rel_hdr2 = NULL;
     }
 
-  asect->relocation = ((arelent *) 
-		       bfd_alloc (abfd, 
+  asect->relocation = ((arelent *)
+		       bfd_alloc (abfd,
 				  asect->reloc_count * 2 * sizeof (arelent)));
   if (asect->relocation == NULL)
     return false;
 
   /* The sparc64_elf_slurp_one_reloc_table routine increments reloc_count.  */
   asect->reloc_count = 0;
-    
+
   if (!sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols,
 					  dynamic))
     return false;
-  
-  if (rel_hdr2 
+
+  if (rel_hdr2
       && !sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr2, symbols,
 					     dynamic))
     return false;
@@ -534,7 +534,7 @@
   if (rela_hdr->sh_type != SHT_RELA)
     abort ();
 
-  /* orelocation has the data, reloc_count has the count... */
+  /* orelocation has the data, reloc_count has the count...  */
   outbound_relocas = (Elf64_External_Rela *) rela_hdr->contents;
   src_rela = outbound_relocas;
 
@@ -628,7 +628,7 @@
 
 #define sparc64_elf_hash_table(p) \
   ((struct sparc64_elf_link_hash_table *) ((p)->hash))
-  
+
 /* Create a Sparc64 ELF linker hash table.  */
 
 static struct bfd_link_hash_table *
@@ -848,7 +848,6 @@
 
 #define ELF_DYNAMIC_INTERPRETER "/usr/lib/sparcv9/ld.so.1"
 
-
 /* Fill in the .plt section.  */
 
 static void
@@ -859,7 +858,7 @@
 {
   const unsigned int nop = 0x01000000;
   int i, j;
-  
+
   /* The first four entries are reserved, and are initially undefined.
      We fill them with `illtrap 0' to force ld.so to do something.  */
 
@@ -893,7 +892,7 @@
   /* Now the tricky bit.  Entries 32768 and higher are grouped in blocks of
      160: 160 entries and 160 pointers.  This is to separate code from data,
      which is much friendlier on the cache.  */
-  
+
   for (; i < nentries; i += 160)
     {
       int block = (i + 160 <= nentries ? 160 : nentries - i);
@@ -936,7 +935,7 @@
   block = (index - LARGE_PLT_THRESHOLD) / 160;
   ofs = (index - LARGE_PLT_THRESHOLD) % 160;
 
-  return ((bfd_vma)(LARGE_PLT_THRESHOLD + block*160) * PLT_ENTRY_SIZE
+  return ((bfd_vma) (LARGE_PLT_THRESHOLD + block*160) * PLT_ENTRY_SIZE
 	  + ofs * 6*4);
 }
 
@@ -963,7 +962,6 @@
 	  + ofs * 8);
 }
 
-
 
 /* Look through the relocs for a section during the first phase, and
    allocate space in the global offset table or procedure linkage
@@ -1198,7 +1196,7 @@
 	case R_SPARC_UA16:
 	  /* When creating a shared object, we must copy these relocs
 	     into the output file.  We create a reloc section in
-	     dynobj and make room for the reloc. 
+	     dynobj and make room for the reloc.
 
 	     But don't do this for debugging sections -- this shows up
 	     with DWARF2 -- first because they are not loaded, and
@@ -1247,7 +1245,7 @@
 	  break;
 
 	default:
-	  (*_bfd_error_handler)(_("%s: check_relocs: unhandled reloc type %d"),
+	  (*_bfd_error_handler) (_("%s: check_relocs: unhandled reloc type %d"),
 				bfd_get_filename(abfd),
 				ELF64_R_TYPE_ID (rel->r_info));
 	  return false;
@@ -1276,7 +1274,7 @@
     {
       int reg;
       struct sparc64_elf_app_reg *p;
-      
+
       reg = (int)sym->st_value;
       switch (reg & ~1)
 	{
@@ -1317,7 +1315,7 @@
 	  if (**namep)
 	    {
 	      struct elf_link_hash_entry *h;
-	      
+
 	      h = (struct elf_link_hash_entry *)
 		bfd_link_hash_lookup (info->hash, *namep, false, false, false);
 
@@ -1557,12 +1555,6 @@
       s = bfd_get_section_by_name (dynobj, ".rela.plt");
       BFD_ASSERT (s != NULL);
 
-      /* The first plt entries are reserved, and the relocations must
-	 pair up exactly.  */
-      if (s->_raw_size == 0)
-	s->_raw_size += (PLT_HEADER_SIZE/PLT_ENTRY_SIZE
-			 * sizeof (Elf64_External_Rela));
-
       s->_raw_size += sizeof (Elf64_External_Rela);
 
       /* The procedure linkage table size is bounded by the magnitude
@@ -1803,6 +1795,7 @@
 	{
 	  if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
 
       /* Add dynamic STT_REGISTER symbols and corresponding DT_SPARC_REGISTER
@@ -1814,7 +1807,7 @@
 	if (app_regs [reg].name != NULL)
 	  {
 	    struct elf_link_local_dynamic_entry *entry, *e;
-	      
+
 	    if (! bfd_elf64_add_dynamic_entry (info, DT_SPARC_REGISTER, 0))
 	      return false;
 
@@ -1859,7 +1852,6 @@
 #define SET_SEC_DO_RELAX(section) do { elf_section_data(section)->tdata = (void *)1; } while (0)
 #define SEC_DO_RELAX(section) (elf_section_data(section)->tdata == (void *)1)
 
-/*ARGSUSED*/
 static boolean
 sparc64_elf_relax_section (abfd, section, link_info, again)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -2078,7 +2070,15 @@
 		      (!info->shared || info->no_undefined
 		       || ELF_ST_VISIBILITY (h->other)))))
 		return false;
-	      relocation = 0;
+
+	      /* To avoid generating warning messages about truncated
+		 relocations, set the relocation's address to be the same as
+		 the start of this section.  */
+
+	      if (input_section->output_section != NULL)
+		relocation = input_section->output_section->vma;
+	      else
+		relocation = 0;
 	    }
 	}
 
@@ -2355,7 +2355,6 @@
 		off &= ~1;
 	      else
 		{
-		  bfd_put_64 (output_bfd, relocation, sgot->contents + off);
 		  local_got_offsets[r_symndx] |= 1;
 
 		  if (info->shared)
@@ -2363,6 +2362,13 @@
 		      asection *srelgot;
 		      Elf_Internal_Rela outrel;
 
+		      /* The Solaris 2.7 64-bit linker adds the contents
+			 of the location to the value of the reloc.
+			 Note this is different behaviour to the
+			 32-bit linker, which both adds the contents
+			 and ignores the addend.  So clear the location.  */
+		      bfd_put_64 (output_bfd, 0, sgot->contents + off);
+
 		      /* We need to generate a R_SPARC_RELATIVE reloc
 			 for the dynamic linker.  */
 		      srelgot = bfd_get_section_by_name(dynobj, ".rela.got");
@@ -2379,6 +2385,8 @@
 						  + srelgot->reloc_count));
 		      ++srelgot->reloc_count;
 		    }
+		  else
+		    bfd_put_64 (output_bfd, relocation, sgot->contents + off);
 		}
 	      relocation = sgot->output_offset + off - got_base;
 	    }
@@ -2609,12 +2617,12 @@
 		  {
 		    /* Assume this is a call protected by other code that
 		       detect the symbol is undefined.  If this is the case,
-		       we can safely ignore the overflow.  If not, the 
+		       we can safely ignore the overflow.  If not, the
 		       program is hosed anyway, and a little warning isn't
 		       going to help.  */
 		    break;
 		  }
-		  
+
 	        name = h->root.root.string;
 	      }
 	    else
@@ -2660,7 +2668,7 @@
       asection *srela;
       Elf_Internal_Rela rela;
 
-      /* This symbol has an entry in the PLT.  Set it up. */
+      /* This symbol has an entry in the PLT.  Set it up.  */
 
       BFD_ASSERT (h->dynindx != -1);
 
@@ -2685,9 +2693,14 @@
       rela.r_offset += (splt->output_section->vma + splt->output_offset);
       rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_JMP_SLOT);
 
+      /* Adjust for the first 4 reserved elements in the .plt section
+	 when setting the offset in the .rela.plt section.
+	 Sun forgot to read their own ABI and copied elf32-sparc behaviour,
+	 thus .plt[4] has corresponding .rela.plt[0] and so on.  */
+
       bfd_elf64_swap_reloca_out (output_bfd, &rela,
 				 ((Elf64_External_Rela *) srela->contents
-				  + h->plt.offset));
+				  + (h->plt.offset - 4)));
 
       if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
 	{
@@ -2880,7 +2893,7 @@
   return true;
 }
 
-/* Functions for dealing with the e_flags field. */
+/* Functions for dealing with the e_flags field.  */
 
 /* Merge backend specific data from an object file to the output
    object file when linking.  */
@@ -2906,32 +2919,33 @@
       elf_flags_init (obfd) = true;
       elf_elfheader (obfd)->e_flags = new_flags;
     }
-                      
+
   else if (new_flags == old_flags)      /* Compatible flags are ok */
     ;
-                            
+
   else                                  /* Incompatible flags */
     {
       error = false;
-  
+
+#define EF_SPARC_ISA_EXTENSIONS \
+  (EF_SPARC_SUN_US1 | EF_SPARC_SUN_US3 | EF_SPARC_HAL_R1)
+
       if ((ibfd->flags & DYNAMIC) != 0)
 	{
 	  /* We don't want dynamic objects memory ordering and
 	     architecture to have any role. That's what dynamic linker
 	     should do.  */
-	  new_flags &= ~(EF_SPARCV9_MM | EF_SPARC_SUN_US1 | EF_SPARC_HAL_R1);
+	  new_flags &= ~(EF_SPARCV9_MM | EF_SPARC_ISA_EXTENSIONS);
 	  new_flags |= (old_flags
-			& (EF_SPARCV9_MM
-			   | EF_SPARC_SUN_US1
-			   | EF_SPARC_HAL_R1));
+			& (EF_SPARCV9_MM | EF_SPARC_ISA_EXTENSIONS));
 	}
       else
 	{
 	  /* Choose the highest architecture requirements.  */
-	  old_flags |= (new_flags & (EF_SPARC_SUN_US1 | EF_SPARC_HAL_R1));
-	  new_flags |= (old_flags & (EF_SPARC_SUN_US1 | EF_SPARC_HAL_R1));
-	  if ((old_flags & (EF_SPARC_SUN_US1 | EF_SPARC_HAL_R1))
-	      == (EF_SPARC_SUN_US1 | EF_SPARC_HAL_R1))
+	  old_flags |= (new_flags & EF_SPARC_ISA_EXTENSIONS);
+	  new_flags |= (old_flags & EF_SPARC_ISA_EXTENSIONS);
+	  if ((old_flags & (EF_SPARC_SUN_US1 | EF_SPARC_SUN_US3))
+	      && (old_flags & EF_SPARC_HAL_R1))
 	    {
 	      error = true;
 	      (*_bfd_error_handler)
@@ -2979,7 +2993,7 @@
 {
   FILE *file = (FILE *) filep;
   int reg, type;
-  
+
   if (ELF_ST_TYPE (((elf_symbol_type *) symbol)->internal_elf_sym.st_info)
       != STT_REGISTER)
     return NULL;
@@ -3004,8 +3018,10 @@
      bfd *abfd;
 {
   unsigned long mach = bfd_mach_sparc_v9;
-  
-  if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US1)
+
+  if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US3)
+    mach = bfd_mach_sparc_v9b;
+  else if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US1)
     mach = bfd_mach_sparc_v9a;
   return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, mach);
 }
@@ -3029,7 +3045,7 @@
   /* internal relocations per external relocations.
      For link purposes we use just 1 internal per
      1 external, for assembly and slurp symbol table
-     we use 2. */
+     we use 2.  */
   1,
   64,		/* arch_size */
   8,		/* file_align */
@@ -3062,7 +3078,7 @@
 
 #define bfd_elf64_bfd_link_hash_table_create \
   sparc64_elf_bfd_link_hash_table_create
-  
+
 #define elf_info_to_howto \
   sparc64_elf_info_to_howto
 #define bfd_elf64_get_reloc_upper_bound \
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
new file mode 100644
index 0000000..0b561f7
--- /dev/null
+++ b/bfd/elf64-x86-64.c
@@ -0,0 +1,348 @@
+/* X86-64 specific support for 64-bit ELF
+   Copyright 2000 Free Software Foundation, Inc.
+   Contributed by Jan Hubicka <jh@suse.cz>.
+
+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 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 "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+
+#include "elf/x86-64.h"
+
+/* We use only the RELA entries.  */
+#define USE_RELA
+
+/* In case we're on a 32-bit machine, construct a 64-bit "-1" value.  */
+#define MINUS_ONE (~ (bfd_vma) 0)
+
+/* The relocation "howto" table.  Order of fields:
+   type, size, bitsize, pc_relative, complain_on_overflow, special_function,
+   name, partial_inplace, src_mask, dst_pack, pcrel_offset  */
+static reloc_howto_type x86_64_elf_howto_table[] = {
+  HOWTO(R_X86_64_NONE,          0,0, 0,false,0,complain_overflow_dont,    0, "R_X86_64_NONE",   false,0x00000000,0x00000000,false),
+  HOWTO(R_X86_64_64,    0,4,64,false,0,complain_overflow_bitfield,0, "R_X86_64_64",     false,MINUS_ONE ,MINUS_ONE ,false),
+  HOWTO(R_X86_64_PC32,          0,4,32,true ,0,complain_overflow_signed  ,0, "R_X86_64_PC32",   false,0xffffffff,0xffffffff,true),
+  HOWTO(R_X86_64_GOT32,         0,4,32,false,0,complain_overflow_signed  ,0, "R_X86_64_GOT32",  false,0xffffffff,0xffffffff,false),
+  HOWTO(R_X86_64_PLT32,         0,4,32,true ,0,complain_overflow_signed  ,0, "R_X86_64_PLT32",  false,0xffffffff,0xffffffff,true),
+  HOWTO(R_X86_64_COPY,     0,4,32,false,0,complain_overflow_bitfield,0, "R_X86_64_COPY",   false,0xffffffff,0xffffffff,false),
+  HOWTO(R_X86_64_GLOB_DAT, 0,4,64,false,0,complain_overflow_bitfield,0,"R_X86_64_GLOB_DAT",false,MINUS_ONE ,MINUS_ONE ,false),
+  HOWTO(R_X86_64_RELATIVE ,0,4,64,false,0,complain_overflow_bitfield,0,"R_X86_64_RELATIVE",false,MINUS_ONE ,MINUS_ONE ,false),
+  HOWTO(R_X86_64_JUMP_SLOT,0,4,64,false,0,complain_overflow_bitfield,0,"R_X86_64_JUMP_SLOT",false,MINUS_ONE,MINUS_ONE ,false),
+  HOWTO(R_X86_64_GOTPCREL, 0,4,32,true, 0,complain_overflow_signed  ,0, "R_X86_64_PCREL",  false,0xffffffff,0xffffffff,true),
+  HOWTO(R_X86_64_32,    0,4,32,false,0,complain_overflow_unsigned,0, "R_X86_64_32",     false,0xffffffff,0xffffffff,false),
+  HOWTO(R_X86_64_32S,   0,4,32,false,0,complain_overflow_signed,  0, "R_X86_64_32S",    false,0xffffffff,0xffffffff,false),
+  HOWTO(R_X86_64_16,    0,1,16,false,0,complain_overflow_bitfield,0, "R_X86_64_16",     false,0xffff    ,0xffff,    false),
+  HOWTO(R_X86_64_PC16,          0,1,16,true ,0,complain_overflow_bitfield,0, "R_X86_64_PC16",   false,0xffff    ,0xffff,    true),
+  HOWTO(R_X86_64_8,     0,0, 8,false,0,complain_overflow_signed  ,0, "R_X86_64_8",      false,0xff      ,0xff,      false),
+  HOWTO(R_X86_64_PC8,   0,0, 8,true ,0,complain_overflow_signed  ,0, "R_X86_64_PC8",    false,0xff      ,0xff,      true),
+};
+
+/* Map BFD relocs to the x86_64 elf relocs.  */
+struct elf_reloc_map {
+  bfd_reloc_code_real_type bfd_reloc_val;
+  unsigned char elf_reloc_val;
+};
+
+static CONST struct elf_reloc_map x86_64_reloc_map[] =
+{
+  { BFD_RELOC_NONE,           R_X86_64_NONE, },
+  { BFD_RELOC_64,             R_X86_64_64,   },
+  { BFD_RELOC_32_PCREL,               R_X86_64_PC32, },
+  { BFD_RELOC_X86_64_GOT32,   R_X86_64_GOT32,},
+  { BFD_RELOC_X86_64_PLT32,   R_X86_64_PLT32,},
+  { BFD_RELOC_X86_64_COPY,    R_X86_64_COPY, },
+  { BFD_RELOC_X86_64_GLOB_DAT,        R_X86_64_GLOB_DAT, },
+  { BFD_RELOC_X86_64_JUMP_SLOT,       R_X86_64_JUMP_SLOT, },
+  { BFD_RELOC_X86_64_RELATIVE,        R_X86_64_RELATIVE, },
+  { BFD_RELOC_X86_64_GOTPCREL,        R_X86_64_GOTPCREL, },
+  { BFD_RELOC_32,             R_X86_64_32, },
+  { BFD_RELOC_X86_64_32S,     R_X86_64_32S, },
+  { BFD_RELOC_16,             R_X86_64_16, },
+  { BFD_RELOC_16_PCREL,               R_X86_64_PC16, },
+  { BFD_RELOC_8,              R_X86_64_8, },
+  { BFD_RELOC_8_PCREL,                R_X86_64_PC8, },
+};
+
+static reloc_howto_type *elf64_x86_64_reloc_type_lookup
+  PARAMS ((bfd *, bfd_reloc_code_real_type));
+static void elf64_x86_64_info_to_howto
+  PARAMS ((bfd *, arelent *, Elf64_Internal_Rela *));
+static struct bfd_link_hash_table *elf64_x86_64_link_hash_table_create
+  PARAMS ((bfd *));
+static boolean elf64_x86_64_relocate_section
+  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+         Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+
+/* Given a BFD reloc type, return a HOWTO structure.  */
+static reloc_howto_type *
+elf64_x86_64_reloc_type_lookup (abfd, code)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     bfd_reloc_code_real_type code;
+{
+  unsigned int i;
+  for (i = 0; i < sizeof (x86_64_reloc_map) / sizeof (struct elf_reloc_map);
+       i++)
+    {
+      if (x86_64_reloc_map[i].bfd_reloc_val == code)
+	return &x86_64_elf_howto_table[(int)
+				       x86_64_reloc_map[i].elf_reloc_val];
+    }
+  return 0;
+}
+
+/* Given an x86_64 ELF reloc type, fill in an arelent structure.  */
+
+static void
+elf64_x86_64_info_to_howto (abfd, cache_ptr, dst)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *cache_ptr;
+     Elf64_Internal_Rela *dst;
+{
+  unsigned r_type;
+
+  r_type = ELF64_R_TYPE (dst->r_info);
+  BFD_ASSERT (r_type < (unsigned int) R_X86_64_max);
+  cache_ptr->howto = &x86_64_elf_howto_table[r_type];
+  BFD_ASSERT (r_type == cache_ptr->howto->type);
+}
+
+/* Hash table functions - these will be used by dynamic linking code and
+   right now they are needed to keep ld happy.  */
+
+/* x86_64  ELF linker hash table.  */
+
+struct elf64_x86_64_link_hash_table {
+  struct elf_link_hash_table root;
+};
+
+/* Get the X86-64 ELF linker hash table from a link_info structure.  */
+
+#define elf64_x86_64_hash_table(p) \
+  ((struct elf64_x86_64_link_hash_table *) ((p)->hash))
+
+/* Create an X86-64 ELF linker hash table.  */
+
+static struct bfd_link_hash_table *
+elf64_x86_64_link_hash_table_create (abfd)
+     bfd *abfd;
+{
+  struct elf64_x86_64_link_hash_table *ret;
+
+  ret = ((struct elf64_x86_64_link_hash_table *)
+	 bfd_alloc (abfd, sizeof (struct elf64_x86_64_link_hash_table)));
+  if (ret == (struct elf64_x86_64_link_hash_table *) NULL)
+    return NULL;
+
+  if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
+                                     _bfd_elf_link_hash_newfunc))
+    {
+      bfd_release (abfd, ret);
+      return NULL;
+    }
+
+  return &ret->root.root;
+}
+
+boolean
+elf64_x86_64_elf_object_p (abfd)
+     bfd *abfd;
+{
+  /* Set the right machine number for an x86-64 elf64 file.  */
+  bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x86_64);
+  return true;
+}
+
+/* Relocate an x86_64 ELF section.  */
+
+static boolean
+elf64_x86_64_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;
+{
+  bfd *dynobj;
+  Elf_Internal_Shdr *symtab_hdr;
+  struct elf_link_hash_entry **sym_hashes;
+  bfd_vma *local_got_offsets;
+  asection *sreloc;
+  Elf_Internal_Rela *rel;
+  Elf_Internal_Rela *relend;
+
+  dynobj = elf_hash_table (info)->dynobj;
+  symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (input_bfd);
+  local_got_offsets = elf_local_got_offsets (input_bfd);
+
+  sreloc = NULL;
+  if (dynobj != NULL)
+    abort ();
+
+  rel = relocs;
+  relend = relocs + input_section->reloc_count;
+  for (; rel < relend; rel++)
+    {
+      int r_type;
+      reloc_howto_type *howto;
+      unsigned long r_symndx;
+      struct elf_link_hash_entry *h;
+      Elf_Internal_Sym *sym;
+      asection *sec;
+      bfd_vma relocation;
+      bfd_reloc_status_type r;
+      unsigned int indx;
+
+      r_type = ELF64_R_TYPE (rel->r_info);
+
+      if ((indx = (unsigned) r_type) >= R_X86_64_max)
+	{
+	  bfd_set_error (bfd_error_bad_value);
+	  return false;
+	}
+      howto = x86_64_elf_howto_table + indx;
+
+      r_symndx = ELF64_R_SYM (rel->r_info);
+
+      if (info->relocateable)
+	{
+	  /* This is a relocateable link.  We don't have to change
+	     anything, unless the reloc is against a section symbol,
+	     in which case we have to adjust according to where the
+	     section symbol winds up in the output section.  */
+	  if (r_symndx < symtab_hdr->sh_info)
+	    {
+	      sym = local_syms + r_symndx;
+	      if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+		{
+		  sec = local_sections[r_symndx];
+		  rel->r_addend += sec->output_offset + sym->st_value;
+		}
+	    }
+
+	  continue;
+	}
+
+      /* This is a final link.  */
+      h = NULL;
+      sym = NULL;
+      sec = NULL;
+      if (r_symndx < symtab_hdr->sh_info)
+	{
+	  sym = local_syms + r_symndx;
+	  sec = local_sections[r_symndx];
+	  relocation = (sec->output_section->vma
+			+ sec->output_offset
+			+ sym->st_value);
+	}
+      else
+	{
+	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	  while (h->root.type == bfd_link_hash_indirect
+		 || h->root.type == bfd_link_hash_warning)
+	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+	  if (h->root.type == bfd_link_hash_defined
+	      || h->root.type == bfd_link_hash_defweak)
+	    {
+	      sec = h->root.u.def.section;
+	      if (sec->output_section == NULL)
+		{
+		  (*_bfd_error_handler)
+		    (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
+		     bfd_get_filename (input_bfd), h->root.root.string,
+		     bfd_get_section_name (input_bfd, input_section));
+		  relocation = 0;
+		}
+	      else
+		relocation = (h->root.u.def.value
+			      + sec->output_section->vma
+			      + sec->output_offset);
+	    }
+	  else if (h->root.type == bfd_link_hash_undefweak)
+	    relocation = 0;
+	  else
+	    {
+	      if (! ((*info->callbacks->undefined_symbol)
+		     (info, h->root.root.string, input_bfd,
+		      input_section, rel->r_offset,
+		      (!info->shared || info->no_undefined
+		       || ELF_ST_VISIBILITY (h->other)))))
+		return false;
+	      relocation = 0;
+	    }
+	}
+      /* This function should support shared objects, but don't.  */
+      if (info->shared)
+	abort ();
+
+      r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+				    contents, rel->r_offset,
+				    relocation, rel->r_addend);
+
+      if (r != bfd_reloc_ok)
+	{
+	  switch (r)
+	    {
+	    default:
+	    case bfd_reloc_outofrange:
+	      abort ();
+	    case bfd_reloc_overflow:
+	      {
+		const char *name;
+
+		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)
+		      return false;
+		    if (*name == '\0')
+		      name = bfd_section_name (input_bfd, sec);
+		  }
+		if (! ((*info->callbacks->reloc_overflow)
+		       (info, name, howto->name, (bfd_vma) 0,
+			input_bfd, input_section, rel->r_offset)))
+		  return false;
+	      }
+	      break;
+	    }
+	}
+    }
+  return true;
+}
+
+#define TARGET_LITTLE_SYM             bfd_elf64_x86_64_vec
+#define TARGET_LITTLE_NAME            "elf64-x86-64"
+#define ELF_ARCH                      bfd_arch_i386
+#define ELF_MACHINE_CODE              EM_X86_64
+#define ELF_MAXPAGESIZE                       0x100000
+#define elf_info_to_howto             elf64_x86_64_info_to_howto
+#define bfd_elf64_bfd_reloc_type_lookup       elf64_x86_64_reloc_type_lookup
+#define elf_backend_object_p            elf64_x86_64_elf_object_p
+#define elf_backend_relocate_section  elf64_x86_64_relocate_section
+#define bfd_elf64_bfd_link_hash_table_create elf64_x86_64_link_hash_table_create
+
+#include "elf64-target.h"
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index b1ce9d8..b94f74b 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -1,6 +1,6 @@
 /* ELF executable support for BFD.
-   Copyright 1991, 92, 93, 94, 95, 96, 97, 98, 1999 Free Software
-   Foundation, Inc.
+   Copyright 1991, 92, 93, 94, 95, 96, 97, 98, 1999, 2000 Free
+   Software Foundation, Inc.
 
    Written by Fred Fish @ Cygnus Support, from information published
    in "UNIX System V Release 4, Programmers Guide: ANSI C and
@@ -167,7 +167,7 @@
 
 #define section_from_elf_index bfd_section_from_elf_index
 
-static boolean elf_slurp_reloc_table_from_section 
+static boolean elf_slurp_reloc_table_from_section
   PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, bfd_size_type,
 	   arelent *, asymbol **, boolean));
 
@@ -246,11 +246,15 @@
      const Elf_External_Ehdr *src;
      Elf_Internal_Ehdr *dst;
 {
+  int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
   memcpy (dst->e_ident, src->e_ident, EI_NIDENT);
   dst->e_type = bfd_h_get_16 (abfd, (bfd_byte *) src->e_type);
   dst->e_machine = bfd_h_get_16 (abfd, (bfd_byte *) src->e_machine);
   dst->e_version = bfd_h_get_32 (abfd, (bfd_byte *) src->e_version);
-  dst->e_entry = get_word (abfd, (bfd_byte *) src->e_entry);
+  if (signed_vma)
+    dst->e_entry = get_signed_word (abfd, (bfd_byte *) src->e_entry);
+  else
+    dst->e_entry = get_word (abfd, (bfd_byte *) src->e_entry);
   dst->e_phoff = get_word (abfd, (bfd_byte *) src->e_phoff);
   dst->e_shoff = get_word (abfd, (bfd_byte *) src->e_shoff);
   dst->e_flags = bfd_h_get_32 (abfd, (bfd_byte *) src->e_flags);
@@ -271,12 +275,16 @@
      const Elf_Internal_Ehdr *src;
      Elf_External_Ehdr *dst;
 {
+  int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
   memcpy (dst->e_ident, src->e_ident, EI_NIDENT);
   /* note that all elements of dst are *arrays of unsigned char* already... */
   bfd_h_put_16 (abfd, src->e_type, dst->e_type);
   bfd_h_put_16 (abfd, src->e_machine, dst->e_machine);
   bfd_h_put_32 (abfd, src->e_version, dst->e_version);
-  put_word (abfd, src->e_entry, dst->e_entry);
+  if (signed_vma)
+    put_signed_word (abfd, src->e_entry, dst->e_entry);
+  else
+    put_word (abfd, src->e_entry, dst->e_entry);
   put_word (abfd, src->e_phoff, dst->e_phoff);
   put_word (abfd, src->e_shoff, dst->e_shoff);
   bfd_h_put_32 (abfd, src->e_flags, dst->e_flags);
@@ -492,9 +500,16 @@
   char *shstrtab;		/* Internal copy of section header stringtab */
   struct elf_backend_data *ebd;
   struct elf_obj_tdata *preserved_tdata = elf_tdata (abfd);
+  struct sec *preserved_sections = abfd->sections;
+  unsigned int preserved_section_count = abfd->section_count;
   struct elf_obj_tdata *new_tdata = NULL;
   asection *s;
 
+  /* Clear section information, since there might be a recognized bfd that
+     we now check if we can replace, and we don't want to append to it.  */
+  abfd->sections = NULL;
+  abfd->section_count = 0;
+
   /* Read in the ELF header in external format.  */
 
   if (bfd_read ((PTR) & x_ehdr, sizeof (x_ehdr), 1, abfd) != sizeof (x_ehdr))
@@ -613,7 +628,7 @@
     }
 
   /* Remember the entry point specified in the ELF file header. */
-  bfd_get_start_address (abfd) = i_ehdrp->e_entry;
+  bfd_set_start_address (abfd, i_ehdrp->e_entry);
 
   /* Allocate space for a copy of the section header table in
      internal form, seek to the section header table in the file,
@@ -737,6 +752,8 @@
   if (new_tdata != NULL)
     bfd_release (abfd, new_tdata);
   elf_tdata (abfd) = preserved_tdata;
+  abfd->sections = preserved_sections;
+  abfd->section_count = preserved_section_count;
   return (NULL);
 }
 
@@ -1224,7 +1241,7 @@
   return -1;
 }
 
-/* Read  relocations for ASECT from REL_HDR.  There are RELOC_COUNT of 
+/* Read  relocations for ASECT from REL_HDR.  There are RELOC_COUNT of
    them.  */
 
 static boolean
@@ -1349,7 +1366,7 @@
       rel_hdr = &d->rel_hdr;
       reloc_count = rel_hdr->sh_size / rel_hdr->sh_entsize;
       rel_hdr2 = d->rel_hdr2;
-      reloc_count2 = (rel_hdr2 
+      reloc_count2 = (rel_hdr2
 		      ? (rel_hdr2->sh_size / rel_hdr2->sh_entsize)
 		      : 0);
 
@@ -1373,8 +1390,8 @@
       reloc_count2 = 0;
     }
 
-  relents = ((arelent *) 
-	     bfd_alloc (abfd, 
+  relents = ((arelent *)
+	     bfd_alloc (abfd,
 			(reloc_count + reloc_count2) * sizeof (arelent)));
   if (relents == NULL)
     return false;
@@ -1384,15 +1401,15 @@
 					   relents,
 					   symbols, dynamic))
     return false;
-  
-  if (rel_hdr2 
+
+  if (rel_hdr2
       && !elf_slurp_reloc_table_from_section (abfd, asect,
 					      rel_hdr2, reloc_count2,
 					      relents + reloc_count,
 					      symbols, dynamic))
     return false;
 
-  
+
   asect->relocation = relents;
   return true;
 }
@@ -1525,7 +1542,7 @@
   sizeof (Elf_External_Sym),
   sizeof (Elf_External_Dyn),
   sizeof (Elf_External_Note),
-  ARCH_SIZE / 8,
+  4,
   1,
   ARCH_SIZE, FILE_ALIGN,
   ELFCLASS, EV_CURRENT,
diff --git a/bfd/elfcore.h b/bfd/elfcore.h
index ec03ec3..f04c1d2 100644
--- a/bfd/elfcore.h
+++ b/bfd/elfcore.h
@@ -99,9 +99,7 @@
 
   /* Check the magic number. */
   if (elf_file_p (&x_ehdr) == false)
-    {
-      goto wrong;
-    }
+    goto wrong;
 
   /* FIXME: Check EI_VERSION here ! */
 
@@ -184,6 +182,10 @@
   if (i_ehdrp->e_phentsize != sizeof (Elf_External_Phdr))
     goto wrong;
 
+  /* Move to the start of the program headers.  */
+  if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) != 0)
+    goto wrong;
+  
   /* Allocate space for the program headers. */
   i_phdrp = (Elf_Internal_Phdr *)
     bfd_alloc (abfd, sizeof (*i_phdrp) * i_ehdrp->e_phnum);
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 8039b4f..e9fb64d 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -41,9 +41,17 @@
 
   switch (bed->s->arch_size)
     {
-    case 32: ptralign = 2; break;
-    case 64: ptralign = 3; break;
-    default: abort();
+    case 32:
+      ptralign = 2;
+      break;
+
+    case 64:
+      ptralign = 3;
+      break;
+
+    default:
+      bfd_set_error (bfd_error_bad_value);
+      return false;
     }
 
   flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
@@ -104,9 +112,17 @@
 
   switch (bed->s->arch_size)
     {
-    case 32: ptralign = 2; break;
-    case 64: ptralign = 3; break;
-    default: abort();
+    case 32:
+      ptralign = 2;
+      break;
+
+    case 64:
+      ptralign = 3;
+      break;
+
+    default:
+      bfd_set_error (bfd_error_bad_value);
+      return false;
     }
 
   /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 898d6b3..b3e1bbc 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -35,7 +35,7 @@
 static boolean elf_merge_symbol
   PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
 	   asection **, bfd_vma *, struct elf_link_hash_entry **,
-	   boolean *, boolean *, boolean *));
+	   boolean *, boolean *, boolean *, boolean));
 static boolean elf_export_symbol
   PARAMS ((struct elf_link_hash_entry *, PTR));
 static boolean elf_fix_symbol_flags
@@ -433,11 +433,12 @@
    TYPE_CHANGE_OK if it is OK for the type to change.  We set
    SIZE_CHANGE_OK if it is OK for the size to change.  By OK to
    change, we mean that we shouldn't warn if the type or size does
-   change.  */
+   change. DT_NEEDED indicates if it comes from a DT_NEEDED entry of
+   a shared object.  */
 
 static boolean
 elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
-		  override, type_change_ok, size_change_ok)
+		  override, type_change_ok, size_change_ok, dt_needed)
      bfd *abfd;
      struct bfd_link_info *info;
      const char *name;
@@ -448,6 +449,7 @@
      boolean *override;
      boolean *type_change_ok;
      boolean *size_change_ok;
+     boolean dt_needed;
 {
   asection *sec;
   struct elf_link_hash_entry *h;
@@ -624,9 +626,11 @@
     olddyncommon = false;
 
   /* It's OK to change the type if either the existing symbol or the
-     new symbol is weak.  */
+     new symbol is weak unless it comes from a DT_NEEDED entry of
+     a shared object, in which case, the DT_NEEDED entry may not be
+     required at the run time. */
 
-  if (h->root.type == bfd_link_hash_defweak
+  if ((! dt_needed && h->root.type == bfd_link_hash_defweak)
       || h->root.type == bfd_link_hash_undefweak
       || bind == STB_WEAK)
     *type_change_ok = true;
@@ -678,7 +682,9 @@
      object to override a weak symbol in a shared object.
 
      We prefer a non-weak definition in a shared library to a weak
-     definition in the executable.  */
+     definition in the executable unless it comes from a DT_NEEDED
+     entry of a shared object, in which case, the DT_NEEDED entry
+     may not be required at the run time. */
 
   if (newdyn
       && newdef
@@ -686,7 +692,8 @@
 	  || (h->root.type == bfd_link_hash_common
 	      && (bind == STB_WEAK
 		  || ELF_ST_TYPE (sym->st_info) == STT_FUNC)))
-      && (h->root.type != bfd_link_hash_defweak
+      && (h->root.type != bfd_link_hash_defweak 
+	  || dt_needed
 	  || bind == STB_WEAK))
     {
       *override = true;
@@ -821,8 +828,11 @@
 
   /* Handle the special case of a weak definition in a regular object
      followed by a non-weak definition in a shared object.  In this
-     case, we prefer the definition in the shared object.  */
+     case, we prefer the definition in the shared object unless it
+     comes from a DT_NEEDED entry of a shared object, in which case,
+     the DT_NEEDED entry may not be required at the run time. */
   if (olddef
+      && ! dt_needed
       && h->root.type == bfd_link_hash_defweak
       && newdef
       && newdyn
@@ -890,6 +900,7 @@
   Elf_External_Sym *esym;
   Elf_External_Sym *esymend;
   struct elf_backend_data *bed;
+  boolean dt_needed;
 
   bed = get_elf_backend_data (abfd);
   add_symbol_hook = bed->elf_add_symbol_hook;
@@ -1049,6 +1060,8 @@
     goto error_return;
   elf_sym_hashes (abfd) = sym_hash;
 
+  dt_needed = false;
+
   if (! dynamic)
     {
       /* If we are creating a shared library, create all the dynamic
@@ -1085,7 +1098,12 @@
 	{
 	  name = elf_dt_name (abfd);
 	  if (*name == '\0')
-	    add_needed = false;
+	    {
+	      if (elf_dt_soname (abfd) != NULL)
+	        dt_needed = true;
+
+	      add_needed = false;
+	    }
 	}
       s = bfd_get_section_by_name (abfd, ".dynamic");
       if (s != NULL)
@@ -1094,6 +1112,8 @@
 	  Elf_External_Dyn *extdynend;
 	  int elfsec;
 	  unsigned long link;
+	  int rpath;
+	  int runpath;
 
 	  dynbuf = (Elf_External_Dyn *) bfd_malloc ((size_t) s->_raw_size);
 	  if (dynbuf == NULL)
@@ -1127,6 +1147,8 @@
 
 	  extdyn = dynbuf;
 	  extdynend = extdyn + s->_raw_size / sizeof (Elf_External_Dyn);
+	  rpath = 0;
+	  runpath = 0;
 	  for (; extdyn < extdynend; extdyn++)
 	    {
 	      Elf_Internal_Dyn dyn;
@@ -1163,6 +1185,65 @@
 		    ;
 		  *pn = n;
 		}
+	      if (dyn.d_tag == DT_RUNPATH)
+		{
+		  struct bfd_link_needed_list *n, **pn;
+		  char *fnm, *anm;
+
+		  /* When we see DT_RPATH before DT_RUNPATH, we have
+		     to clear runpath.  Do _NOT_ bfd_release, as that
+		     frees all more recently bfd_alloc'd blocks as
+		     well.  */
+		  if (rpath && elf_hash_table (info)->runpath)
+		    elf_hash_table (info)->runpath = NULL;
+
+		  n = ((struct bfd_link_needed_list *)
+		       bfd_alloc (abfd, sizeof (struct bfd_link_needed_list)));
+		  fnm = bfd_elf_string_from_elf_section (abfd, link,
+							 dyn.d_un.d_val);
+		  if (n == NULL || fnm == NULL)
+		    goto error_return;
+		  anm = bfd_alloc (abfd, strlen (fnm) + 1);
+		  if (anm == NULL)
+		    goto error_return;
+		  strcpy (anm, fnm);
+		  n->name = anm;
+		  n->by = abfd;
+		  n->next = NULL;
+		  for (pn = &elf_hash_table (info)->runpath;
+		       *pn != NULL;
+		       pn = &(*pn)->next)
+		    ;
+		  *pn = n;
+		  runpath = 1;
+		  rpath = 0;
+		}
+	      /* Ignore DT_RPATH if we have seen DT_RUNPATH. */
+	      if (!runpath && dyn.d_tag == DT_RPATH)
+	        {
+		  struct bfd_link_needed_list *n, **pn;
+		  char *fnm, *anm;
+
+		  n = ((struct bfd_link_needed_list *)
+		       bfd_alloc (abfd, sizeof (struct bfd_link_needed_list)));
+		  fnm = bfd_elf_string_from_elf_section (abfd, link,
+							 dyn.d_un.d_val);
+		  if (n == NULL || fnm == NULL)
+		    goto error_return;
+		  anm = bfd_alloc (abfd, strlen (fnm) + 1);
+		  if (anm == NULL)
+		    goto error_return;
+		  strcpy (anm, fnm);
+		  n->name = anm;
+		  n->by = abfd;
+		  n->next = NULL;
+		  for (pn = &elf_hash_table (info)->runpath;
+		       *pn != NULL;
+		       pn = &(*pn)->next)
+		    ;
+		  *pn = n;
+		  rpath = 1;
+		}
 	    }
 
 	  free (dynbuf);
@@ -1290,8 +1371,6 @@
 	  if (sym.st_shndx != SHN_UNDEF
 	      && sym.st_shndx != SHN_COMMON)
 	    flags = BSF_GLOBAL;
-	  else
-	    flags = 0;
 	}
       else if (bind == STB_WEAK)
 	flags = BSF_WEAK;
@@ -1457,7 +1536,7 @@
 
 	  if (! elf_merge_symbol (abfd, info, name, &sym, &sec, &value,
 				  sym_hash, &override, &type_change_ok,
-				  &size_change_ok))
+				  &size_change_ok, dt_needed))
 	    goto error_return;
 
 	  if (override)
@@ -1526,7 +1605,10 @@
 	  unsigned int align;
 
 	  align = bfd_log2 (sym.st_value);
-	  if (align > old_alignment)
+	  if (align > old_alignment
+	      /* Permit an alignment power of zero if an alignment of one
+		 is specified and no other alignments have been specified.  */
+	      || (sym.st_value == 1 && old_alignment == 0))
 	    h->root.u.c.p->alignment_power = align;
 	}
 
@@ -1633,7 +1715,7 @@
              name to the fully decorated name.  This will cause
              external references which do not specify a version to be
              bound to this version of the symbol.  */
-	  if (definition)
+	  if (definition || h->root.type == bfd_link_hash_common)
 	    {
 	      char *p;
 
@@ -1660,7 +1742,8 @@
 		  size_change_ok = false;
 		  if (! elf_merge_symbol (abfd, info, shortname, &sym, &sec,
 					  &value, &hi, &override,
-					  &type_change_ok, &size_change_ok))
+					  &type_change_ok,
+					  &size_change_ok, dt_needed))
 		    goto error_return;
 
 		  if (! override)
@@ -1777,7 +1860,8 @@
 		  size_change_ok = false;
 		  if (! elf_merge_symbol (abfd, info, shortname, &sym, &sec,
 					  &value, &hi, &override,
-					  &type_change_ok, &size_change_ok))
+					  &type_change_ok,
+					  &size_change_ok, dt_needed))
 		    goto error_return;
 
 		  if (override)
@@ -1860,9 +1944,56 @@
 	      case STV_INTERNAL:
 	      case STV_HIDDEN:  
 		h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
-		(*bed->elf_backend_hide_symbol) (h);
+		(*bed->elf_backend_hide_symbol) (info, h);
 		break;
 	      }
+
+	  if (dt_needed && definition
+	      && (h->elf_link_hash_flags
+		  & ELF_LINK_HASH_REF_REGULAR) != 0)
+	    {
+	      bfd_size_type oldsize;
+	      bfd_size_type strindex;
+
+	      /* The symbol from a DT_NEEDED object is referenced from
+	         the regular object to create a dynamic executable. We
+		 have to make sure there is a DT_NEEDED entry for it. */
+
+	      dt_needed = false;
+	      oldsize = _bfd_stringtab_size (elf_hash_table (info)->dynstr);
+	      strindex = _bfd_stringtab_add (elf_hash_table (info)->dynstr,
+	      				     elf_dt_soname (abfd),
+					     true, false);
+	      if (strindex == (bfd_size_type) -1)
+		goto error_return;
+
+	      if (oldsize
+		  == _bfd_stringtab_size (elf_hash_table (info)->dynstr))
+		{
+		  asection *sdyn;
+		  Elf_External_Dyn *dyncon, *dynconend;
+
+		  sdyn = bfd_get_section_by_name (elf_hash_table (info)->dynobj,
+						  ".dynamic");
+		  BFD_ASSERT (sdyn != NULL);
+
+		  dyncon = (Elf_External_Dyn *) sdyn->contents;
+		  dynconend = (Elf_External_Dyn *) (sdyn->contents +
+						    sdyn->_raw_size);
+		  for (; dyncon < dynconend; dyncon++)
+		    {
+		      Elf_Internal_Dyn dyn;
+
+		      elf_swap_dyn_in (elf_hash_table (info)->dynobj,
+				       dyncon, &dyn);
+		      BFD_ASSERT (dyn.d_tag != DT_NEEDED ||
+				  dyn.d_un.d_val != strindex);
+		    }
+		}
+
+	      if (! elf_add_dynamic_entry (info, DT_NEEDED, strindex))
+		goto error_return;
+	    }
 	}
     }
 
@@ -2764,7 +2895,7 @@
     {
       struct elf_info_failed eif;
       struct elf_link_hash_entry *h;
-      bfd_size_type strsize;
+      asection *dynstr;
 
       *sinterpptr = bfd_get_section_by_name (dynobj, ".interp");
       BFD_ASSERT (*sinterpptr != NULL || info->shared);
@@ -2782,6 +2913,7 @@
 	{
 	  if (! elf_add_dynamic_entry (info, DT_SYMBOLIC, 0))
 	    return false;
+	  info->flags |= DF_SYMBOLIC;
 	}
 
       if (rpath != NULL)
@@ -2791,7 +2923,9 @@
 	  indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, rpath,
 				     true, true);
 	  if (indx == (bfd_size_type) -1
-	      || ! elf_add_dynamic_entry (info, DT_RPATH, indx))
+	      || ! elf_add_dynamic_entry (info, DT_RPATH, indx)
+	      || (info->new_dtags
+		  && ! elf_add_dynamic_entry (info, DT_RUNPATH, indx)))
 	    return false;
 	}
 
@@ -2890,14 +3024,24 @@
 	    return false;
 	}
 
-      strsize = _bfd_stringtab_size (elf_hash_table (info)->dynstr);
-      if (! elf_add_dynamic_entry (info, DT_HASH, 0)
-	  || ! elf_add_dynamic_entry (info, DT_STRTAB, 0)
-	  || ! elf_add_dynamic_entry (info, DT_SYMTAB, 0)
-	  || ! elf_add_dynamic_entry (info, DT_STRSZ, strsize)
-	  || ! elf_add_dynamic_entry (info, DT_SYMENT,
-				      sizeof (Elf_External_Sym)))
-	return false;
+      dynstr = bfd_get_section_by_name (dynobj, ".dynstr");
+      /* If .dynstr is excluded from the link, we don't want any of
+	 these tags.  Strictly, we should be checking each section
+	 individually;  This quick check covers for the case where
+	 someone does a /DISCARD/ : { *(*) }.  */
+      if (dynstr != NULL && dynstr->output_section != bfd_abs_section_ptr)
+	{
+	  bfd_size_type strsize;
+
+	  strsize = _bfd_stringtab_size (elf_hash_table (info)->dynstr);
+	  if (! elf_add_dynamic_entry (info, DT_HASH, 0)
+	      || ! elf_add_dynamic_entry (info, DT_STRTAB, 0)
+	      || ! elf_add_dynamic_entry (info, DT_SYMTAB, 0)
+	      || ! elf_add_dynamic_entry (info, DT_STRSZ, strsize)
+	      || ! elf_add_dynamic_entry (info, DT_SYMENT,
+					  sizeof (Elf_External_Sym)))
+	    return false;
+	}
     }
 
   /* The backend must work out the sizes of all the other dynamic
@@ -2911,7 +3055,6 @@
       size_t dynsymcount;
       asection *s;
       size_t bucketcount = 0;
-      Elf_Internal_Sym isym;
       size_t hash_entry_size;
 
       /* Set up the version definition section.  */
@@ -3080,6 +3223,22 @@
 	  elf_tdata (output_bfd)->cverdefs = cdefs;
 	}
 
+      if (info->new_dtags && info->flags)
+	{
+	  if (! elf_add_dynamic_entry (info, DT_FLAGS, info->flags))
+	    return false;
+	}
+
+      if (info->flags_1)
+	{
+	  if (! info->shared)
+	    info->flags_1 &= ~ (DF_1_INITFIRST
+				| DF_1_NODELETE
+				| DF_1_NOOPEN);
+	  if (! elf_add_dynamic_entry (info, DT_FLAGS_1, info->flags_1))
+	    return false;
+	}
+
       /* Work out the size of the version reference section.  */
 
       s = bfd_get_section_by_name (dynobj, ".gnu.version_r");
@@ -3232,15 +3391,20 @@
       if (s->contents == NULL && s->_raw_size != 0)
 	return false;
 
-      /* The first entry in .dynsym is a dummy symbol.  */
-      isym.st_value = 0;
-      isym.st_size = 0;
-      isym.st_name = 0;
-      isym.st_info = 0;
-      isym.st_other = 0;
-      isym.st_shndx = 0;
-      elf_swap_symbol_out (output_bfd, &isym,
-			   (PTR) (Elf_External_Sym *) s->contents);
+      if (dynsymcount != 0)
+	{
+	  Elf_Internal_Sym isym;
+
+	  /* The first entry in .dynsym is a dummy symbol.  */
+	  isym.st_value = 0;
+	  isym.st_size = 0;
+	  isym.st_name = 0;
+	  isym.st_info = 0;
+	  isym.st_other = 0;
+	  isym.st_shndx = 0;
+	  elf_swap_symbol_out (output_bfd, &isym,
+			       (PTR) (Elf_External_Sym *) s->contents);
+	}
 
       /* Compute the size of the hashing table.  As a side effect this
 	 computes the hash values for all the names we export.  */
@@ -3707,7 +3871,7 @@
 			      && ! sinfo->export_dynamic)
 			    {
 			      h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
-			      (*bed->elf_backend_hide_symbol) (h);
+			      (*bed->elf_backend_hide_symbol) (info, h);
 			      /* FIXME: The name of the symbol has
 				 already been recorded in the dynamic
 				 string table section.  */
@@ -3819,7 +3983,7 @@
 			  && ! sinfo->export_dynamic)
 			{
 			  h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
-			  (*bed->elf_backend_hide_symbol) (h);
+			  (*bed->elf_backend_hide_symbol) (info, h);
 			  /* FIXME: The name of the symbol has already
 			     been recorded in the dynamic string table
 			     section.  */
@@ -3841,7 +4005,7 @@
 	      && ! sinfo->export_dynamic)
 	    {
 	      h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
-	      (*bed->elf_backend_hide_symbol) (h);
+	      (*bed->elf_backend_hide_symbol) (info, h);
 	      /* FIXME: The name of the symbol has already been
 		 recorded in the dynamic string table section.  */
 	    }
@@ -3939,8 +4103,10 @@
   rel_hdr->sh_size = rel_hdr->sh_entsize * reloc_count;
 
   /* The contents field must last into write_object_contents, so we
-     allocate it with bfd_alloc rather than malloc.  */
-  rel_hdr->contents = (PTR) bfd_alloc (abfd, rel_hdr->sh_size);
+     allocate it with bfd_alloc rather than malloc.  Also since we
+     cannot be sure that the contents will actually be filled in,
+     we zero the allocated space.  */
+  rel_hdr->contents = (PTR) bfd_zalloc (abfd, rel_hdr->sh_size);
   if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
     return false;
   
@@ -3976,6 +4142,7 @@
      struct elf_link_hash_entry **rel_hash;
 {
   unsigned int i;
+  struct elf_backend_data *bed = get_elf_backend_data (abfd);
 
   for (i = 0; i < count; i++, rel_hash++)
     {
@@ -3990,10 +4157,16 @@
 	  Elf_Internal_Rel irel;
 	  
 	  erel = (Elf_External_Rel *) rel_hdr->contents + i;
-	  elf_swap_reloc_in (abfd, erel, &irel);
+	  if (bed->s->swap_reloc_in)
+	    (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, &irel);
+	  else
+	    elf_swap_reloc_in (abfd, erel, &irel);
 	  irel.r_info = ELF_R_INFO ((*rel_hash)->indx,
 				    ELF_R_TYPE (irel.r_info));
-	  elf_swap_reloc_out (abfd, &irel, erel);
+	  if (bed->s->swap_reloc_out)
+	    (*bed->s->swap_reloc_out) (abfd, &irel, (bfd_byte *) erel);
+	  else
+	    elf_swap_reloc_out (abfd, &irel, erel);
 	}
       else
 	{
@@ -4004,10 +4177,16 @@
 		      == sizeof (Elf_External_Rela));
 	  
 	  erela = (Elf_External_Rela *) rel_hdr->contents + i;
-	  elf_swap_reloca_in (abfd, erela, &irela);
+	  if (bed->s->swap_reloca_in)
+	    (*bed->s->swap_reloca_in) (abfd, (bfd_byte *) erela, &irela);
+	  else
+	    elf_swap_reloca_in (abfd, erela, &irela);
 	  irela.r_info = ELF_R_INFO ((*rel_hash)->indx,
 				     ELF_R_TYPE (irela.r_info));
-	  elf_swap_reloca_out (abfd, &irela, erela);
+	  if (bed->s->swap_reloca_out)
+	    (*bed->s->swap_reloca_out) (abfd, &irela, (bfd_byte *) erela);
+	  else
+	    elf_swap_reloca_out (abfd, &irela, erela);
 	}
     }
 }
@@ -4435,7 +4614,8 @@
   /* The sh_info field records the index of the first non local symbol.  */
   symtab_hdr->sh_info = bfd_get_symcount (abfd);
 
-  if (dynamic)
+  if (dynamic
+      && finfo.dynsym_sec->output_section != bfd_abs_section_ptr)
     {
       Elf_Internal_Sym sym;
       Elf_External_Sym *dynsym =
@@ -4700,7 +4880,8 @@
       for (o = dynobj->sections; o != NULL; o = o->next)
 	{
 	  if ((o->flags & SEC_HAS_CONTENTS) == 0
-	      || o->_raw_size == 0)
+	      || o->_raw_size == 0
+	      || o->output_section == bfd_abs_section_ptr)
 	    continue;
 	  if ((o->flags & SEC_LINKER_CREATED) == 0)
 	    {
@@ -4914,6 +5095,7 @@
      referenced by regular files, because we will already have issued
      warnings for them.  */
   if (! finfo->info->relocateable
+      && ! finfo->info->allow_shlib_undefined
       && ! (finfo->info->shared
 	    && !finfo->info->no_undefined)
       && h->root.type == bfd_link_hash_undefined
@@ -5183,6 +5365,7 @@
   Elf_Internal_Shdr *output_rel_hdr;
   asection *output_section;
   unsigned int *rel_countp = NULL;
+  struct elf_backend_data *bed;
 
   output_section = input_section->output_section;
   output_rel_hdr = NULL;
@@ -5202,7 +5385,8 @@
     }
 
   BFD_ASSERT (output_rel_hdr != NULL);
-  
+
+  bed = get_elf_backend_data (output_bfd);
   irela = internal_relocs;
   irelaend = irela + input_rel_hdr->sh_size / input_rel_hdr->sh_entsize;
   if (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
@@ -5217,7 +5401,10 @@
 	  irel.r_offset = irela->r_offset;
 	  irel.r_info = irela->r_info;
 	  BFD_ASSERT (irela->r_addend == 0);
-	  elf_swap_reloc_out (output_bfd, &irel, erel);
+	  if (bed->s->swap_reloc_out)
+	    (*bed->s->swap_reloc_out) (output_bfd, &irel, (PTR) erel);
+	  else
+	    elf_swap_reloc_out (output_bfd, &irel, erel);
 	}
     }
   else
@@ -5228,7 +5415,10 @@
 		  == sizeof (Elf_External_Rela));
       erela = ((Elf_External_Rela *) output_rel_hdr->contents + *rel_countp);
       for (; irela < irelaend; irela++, erela++)
-	elf_swap_reloca_out (output_bfd, irela, erela);
+	if (bed->s->swap_reloca_out)
+	  (*bed->s->swap_reloca_out) (output_bfd, irela, (PTR) erela);
+	else
+	  elf_swap_reloca_out (output_bfd, irela, erela);
     }
 
   /* Bump the counter, so that we know where to add the next set of
@@ -5345,16 +5535,43 @@
       if (esym == external_syms)
 	continue;
 
+      if (ELF_ST_TYPE (isym->st_info) == STT_SECTION)
+	{
+	  asection *ksec;
+
+	  /* Save away all section symbol values.  */
+	  if (isec != NULL)
+	    isec->symbol->value = isym->st_value;
+
+	  /* If this is a discarded link-once section symbol, update
+	     it's value to that of the kept section symbol.  The
+	     linker will keep the first of any matching link-once
+	     sections, so we should have already seen it's section
+	     symbol.  I trust no-one will have the bright idea of
+	     re-ordering the bfd list...  */
+	  if (isec != NULL
+	      && (bfd_get_section_flags (input_bfd, isec) & SEC_LINK_ONCE) != 0
+	      && (ksec = isec->kept_section) != NULL)
+	    {
+	      isym->st_value = ksec->symbol->value;
+
+	      /* That put the value right, but the section info is all
+		 wrong.  I hope this works.  */
+	      isec->output_offset = ksec->output_offset;
+	      isec->output_section = ksec->output_section;
+	    }
+
+	  /* We never output section symbols.  Instead, we use the
+	     section symbol of the corresponding section in the output
+	     file.  */
+	  continue;
+	}
+
       /* If we are stripping all symbols, we don't want to output this
 	 one.  */
       if (finfo->info->strip == strip_all)
 	continue;
 
-      /* We never output section symbols.  Instead, we use the section
-	 symbol of the corresponding section in the output file.  */
-      if (ELF_ST_TYPE (isym->st_info) == STT_SECTION)
-	continue;
-
       /* If we are discarding all local symbols, we don't want to
 	 output this one.  If we are generating a relocateable output
 	 file, then some of the local symbols may be required by
@@ -5688,6 +5905,7 @@
   bfd_vma addend;
   struct elf_link_hash_entry **rel_hash_ptr;
   Elf_Internal_Shdr *rel_hdr;
+  struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
 
   howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc);
   if (howto == NULL)
@@ -5811,7 +6029,10 @@
       irel.r_info = ELF_R_INFO (indx, howto->type);
       erel = ((Elf_External_Rel *) rel_hdr->contents
 	      + elf_section_data (output_section)->rel_count);
-      elf_swap_reloc_out (output_bfd, &irel, erel);
+      if (bed->s->swap_reloc_out)
+	(*bed->s->swap_reloc_out) (output_bfd, &irel, (bfd_byte *) erel);
+      else
+	elf_swap_reloc_out (output_bfd, &irel, erel);
     }
   else
     {
@@ -5823,7 +6044,10 @@
       irela.r_addend = addend;
       erela = ((Elf_External_Rela *) rel_hdr->contents
 	       + elf_section_data (output_section)->rel_count);
-      elf_swap_reloca_out (output_bfd, &irela, erela);
+      if (bed->s->swap_reloca_out)
+	(*bed->s->swap_reloca_out) (output_bfd, &irela, (bfd_byte *) erela);
+      else
+	elf_swap_reloca_out (output_bfd, &irela, erela);
     }
 
   ++elf_section_data (output_section)->rel_count;
diff --git a/bfd/elf64-ia64.c b/bfd/elfxx-ia64.c
similarity index 81%
rename from bfd/elf64-ia64.c
rename to bfd/elfxx-ia64.c
index 2fafeb1..56087a6 100644
--- a/bfd/elf64-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -67,13 +67,13 @@
    of the place a symbol or expression got allocated to. This is done via hash
    tables that store entries of the following type.  */
 
-struct elf64_ia64_dyn_sym_info
+struct elfNN_ia64_dyn_sym_info
 {
   /* The addend for which this entry is relevant.  */
   bfd_vma addend;
 
   /* Next addend in the list.  */
-  struct elf64_ia64_dyn_sym_info *next;
+  struct elfNN_ia64_dyn_sym_info *next;
 
   bfd_vma got_offset;
   bfd_vma fptr_offset;
@@ -86,9 +86,9 @@
   
   /* Used to count non-got, non-plt relocations for delayed sizing
      of relocation sections.  */
-  struct elf64_ia64_dyn_reloc_entry
+  struct elfNN_ia64_dyn_reloc_entry
   {
-    struct elf64_ia64_dyn_reloc_entry *next;
+    struct elfNN_ia64_dyn_reloc_entry *next;
     asection *srel;
     int type;
     int count;
@@ -108,25 +108,25 @@
   unsigned want_pltoff : 1;
 };
 
-struct elf64_ia64_local_hash_entry
+struct elfNN_ia64_local_hash_entry
 {
   struct bfd_hash_entry root;
-  struct elf64_ia64_dyn_sym_info *info;
+  struct elfNN_ia64_dyn_sym_info *info;
 };
 
-struct elf64_ia64_local_hash_table
+struct elfNN_ia64_local_hash_table
 {
   struct bfd_hash_table root;
   /* No additional fields for now.  */
 };
 
-struct elf64_ia64_link_hash_entry
+struct elfNN_ia64_link_hash_entry
 {
   struct elf_link_hash_entry root;
-  struct elf64_ia64_dyn_sym_info *info;
+  struct elfNN_ia64_dyn_sym_info *info;
 };
 
-struct elf64_ia64_link_hash_table
+struct elfNN_ia64_link_hash_table
 {
   /* The main hash table */
   struct elf_link_hash_table root;
@@ -140,153 +140,153 @@
 
   bfd_size_type minplt_entries;	/* number of minplt entries */
 
-  struct elf64_ia64_local_hash_table loc_hash_table;
+  struct elfNN_ia64_local_hash_table loc_hash_table;
 };
 
-#define elf64_ia64_hash_table(p) \
-  ((struct elf64_ia64_link_hash_table *) ((p)->hash))
+#define elfNN_ia64_hash_table(p) \
+  ((struct elfNN_ia64_link_hash_table *) ((p)->hash))
 
-static bfd_reloc_status_type elf64_ia64_reloc
+static bfd_reloc_status_type elfNN_ia64_reloc
   PARAMS ((bfd *abfd, arelent *reloc, asymbol *sym, PTR data,
 	   asection *input_section, bfd *output_bfd, char **error_message));
 static reloc_howto_type * lookup_howto
   PARAMS ((unsigned int rtype));
-static reloc_howto_type *elf64_ia64_reloc_type_lookup
+static reloc_howto_type *elfNN_ia64_reloc_type_lookup
   PARAMS ((bfd *abfd, bfd_reloc_code_real_type bfd_code));
-static void elf64_ia64_info_to_howto
-  PARAMS ((bfd *abfd, arelent *bfd_reloc, Elf64_Internal_Rela *elf_reloc));
-static boolean elf64_ia64_relax_section
+static void elfNN_ia64_info_to_howto
+  PARAMS ((bfd *abfd, arelent *bfd_reloc, ElfNN_Internal_Rela *elf_reloc));
+static boolean elfNN_ia64_relax_section
   PARAMS((bfd *abfd, asection *sec, struct bfd_link_info *link_info,
 	  boolean *again));
-static boolean elf64_ia64_section_from_shdr
-  PARAMS ((bfd *, Elf64_Internal_Shdr *, char *));
-static boolean elf64_ia64_fake_sections
-  PARAMS ((bfd *abfd, Elf64_Internal_Shdr *hdr, asection *sec));
-static boolean elf64_ia64_add_symbol_hook
+static boolean elfNN_ia64_section_from_shdr
+  PARAMS ((bfd *, ElfNN_Internal_Shdr *, char *));
+static boolean elfNN_ia64_fake_sections
+  PARAMS ((bfd *abfd, ElfNN_Internal_Shdr *hdr, asection *sec));
+static boolean elfNN_ia64_add_symbol_hook
   PARAMS ((bfd *abfd, struct bfd_link_info *info, const Elf_Internal_Sym *sym,
 	   const char **namep, flagword *flagsp, asection **secp,
 	   bfd_vma *valp));
-static int elf64_ia64_additional_program_headers
+static int elfNN_ia64_additional_program_headers
   PARAMS ((bfd *abfd));
-static boolean elf64_ia64_is_local_label_name
+static boolean elfNN_ia64_is_local_label_name
   PARAMS ((bfd *abfd, const char *name));
-static boolean elf64_ia64_dynamic_symbol_p
+static boolean elfNN_ia64_dynamic_symbol_p
   PARAMS ((struct elf_link_hash_entry *h, struct bfd_link_info *info));
-static boolean elf64_ia64_local_hash_table_init
-  PARAMS ((struct elf64_ia64_local_hash_table *ht, bfd *abfd,
+static boolean elfNN_ia64_local_hash_table_init
+  PARAMS ((struct elfNN_ia64_local_hash_table *ht, bfd *abfd,
 	   new_hash_entry_func new));
-static struct bfd_hash_entry *elf64_ia64_new_loc_hash_entry
+static struct bfd_hash_entry *elfNN_ia64_new_loc_hash_entry
   PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table,
 	   const char *string));
-static struct bfd_hash_entry *elf64_ia64_new_elf_hash_entry
+static struct bfd_hash_entry *elfNN_ia64_new_elf_hash_entry
   PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table,
 	   const char *string));
-static struct bfd_link_hash_table *elf64_ia64_hash_table_create
+static struct bfd_link_hash_table *elfNN_ia64_hash_table_create
   PARAMS ((bfd *abfd));
-static struct elf64_ia64_local_hash_entry *elf64_ia64_local_hash_lookup
-  PARAMS ((struct elf64_ia64_local_hash_table *table, const char *string,
+static struct elfNN_ia64_local_hash_entry *elfNN_ia64_local_hash_lookup
+  PARAMS ((struct elfNN_ia64_local_hash_table *table, const char *string,
 	   boolean create, boolean copy));
-static void elf64_ia64_dyn_sym_traverse
-  PARAMS ((struct elf64_ia64_link_hash_table *ia64_info,
-	   boolean (*func)(struct elf64_ia64_dyn_sym_info *, PTR),
+static void elfNN_ia64_dyn_sym_traverse
+  PARAMS ((struct elfNN_ia64_link_hash_table *ia64_info,
+	   boolean (*func)(struct elfNN_ia64_dyn_sym_info *, PTR),
 	   PTR info));
-static boolean elf64_ia64_create_dynamic_sections
+static boolean elfNN_ia64_create_dynamic_sections
   PARAMS ((bfd *abfd, struct bfd_link_info *info));
-static struct elf64_ia64_dyn_sym_info * get_dyn_sym_info
-  PARAMS ((struct elf64_ia64_link_hash_table *ia64_info,
+static struct elfNN_ia64_dyn_sym_info * get_dyn_sym_info
+  PARAMS ((struct elfNN_ia64_link_hash_table *ia64_info,
 	   struct elf_link_hash_entry *h,
 	   bfd *abfd, const Elf_Internal_Rela *rel, boolean create));
 static asection *get_got
   PARAMS ((bfd *abfd, struct bfd_link_info *info,
-	   struct elf64_ia64_link_hash_table *ia64_info));
+	   struct elfNN_ia64_link_hash_table *ia64_info));
 static asection *get_fptr
   PARAMS ((bfd *abfd, struct bfd_link_info *info,
-	   struct elf64_ia64_link_hash_table *ia64_info));
+	   struct elfNN_ia64_link_hash_table *ia64_info));
 static asection *get_pltoff
   PARAMS ((bfd *abfd, struct bfd_link_info *info,
-	   struct elf64_ia64_link_hash_table *ia64_info));
+	   struct elfNN_ia64_link_hash_table *ia64_info));
 static asection *get_reloc_section
-  PARAMS ((bfd *abfd, struct elf64_ia64_link_hash_table *ia64_info,
+  PARAMS ((bfd *abfd, struct elfNN_ia64_link_hash_table *ia64_info,
 	   asection *sec, boolean create));
 static boolean count_dyn_reloc
-  PARAMS ((bfd *abfd, struct elf64_ia64_dyn_sym_info *dyn_i,
+  PARAMS ((bfd *abfd, struct elfNN_ia64_dyn_sym_info *dyn_i,
 	   asection *srel, int type));
-static boolean elf64_ia64_check_relocs
+static boolean elfNN_ia64_check_relocs
   PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *sec,
 	   const Elf_Internal_Rela *relocs));
-static boolean elf64_ia64_adjust_dynamic_symbol
+static boolean elfNN_ia64_adjust_dynamic_symbol
   PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h));
 static unsigned long global_sym_index
   PARAMS ((struct elf_link_hash_entry *h));
 static boolean allocate_fptr
-  PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data));
+  PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
 static boolean allocate_global_data_got
-  PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data));
+  PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
 static boolean allocate_global_fptr_got
-  PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data));
+  PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
 static boolean allocate_local_got
-  PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data));
+  PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
 static boolean allocate_pltoff_entries
-  PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data));
+  PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
 static boolean allocate_plt_entries
-  PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data));
+  PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
 static boolean allocate_plt2_entries
-  PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data));
+  PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
 static boolean allocate_dynrel_entries
-  PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data));
-static boolean elf64_ia64_size_dynamic_sections
+  PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
+static boolean elfNN_ia64_size_dynamic_sections
   PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
-static bfd_reloc_status_type elf64_ia64_install_value
+static bfd_reloc_status_type elfNN_ia64_install_value
   PARAMS ((bfd *abfd, bfd_byte *hit_addr, bfd_vma val, unsigned int r_type));
-static void elf64_ia64_install_dyn_reloc
+static void elfNN_ia64_install_dyn_reloc
   PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *sec,
 	   asection *srel, bfd_vma offset, unsigned int type,
 	   long dynindx, bfd_vma addend));
 static bfd_vma set_got_entry
   PARAMS ((bfd *abfd, struct bfd_link_info *info,
-	   struct elf64_ia64_dyn_sym_info *dyn_i, long dynindx,
+	   struct elfNN_ia64_dyn_sym_info *dyn_i, long dynindx,
 	   bfd_vma addend, bfd_vma value, unsigned int dyn_r_type));
 static bfd_vma set_fptr_entry
   PARAMS ((bfd *abfd, struct bfd_link_info *info,
-	   struct elf64_ia64_dyn_sym_info *dyn_i,
+	   struct elfNN_ia64_dyn_sym_info *dyn_i,
 	   bfd_vma value));
 static bfd_vma set_pltoff_entry
   PARAMS ((bfd *abfd, struct bfd_link_info *info,
-	   struct elf64_ia64_dyn_sym_info *dyn_i,
+	   struct elfNN_ia64_dyn_sym_info *dyn_i,
 	   bfd_vma value, boolean));
-static boolean elf64_ia64_final_link
+static boolean elfNN_ia64_final_link
   PARAMS ((bfd *abfd, struct bfd_link_info *info));
-static boolean elf64_ia64_relocate_section
+static boolean elfNN_ia64_relocate_section
   PARAMS ((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));
-static boolean elf64_ia64_finish_dynamic_symbol
+static boolean elfNN_ia64_finish_dynamic_symbol
   PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
 	   struct elf_link_hash_entry *h, Elf_Internal_Sym *sym));
-static boolean elf64_ia64_finish_dynamic_sections
+static boolean elfNN_ia64_finish_dynamic_sections
   PARAMS ((bfd *abfd, struct bfd_link_info *info));
-static boolean elf64_ia64_set_private_flags
+static boolean elfNN_ia64_set_private_flags
   PARAMS ((bfd *abfd, flagword flags));
-static boolean elf64_ia64_copy_private_bfd_data
+static boolean elfNN_ia64_copy_private_bfd_data
   PARAMS ((bfd *ibfd, bfd *obfd));
-static boolean elf64_ia64_merge_private_bfd_data
+static boolean elfNN_ia64_merge_private_bfd_data
   PARAMS ((bfd *ibfd, bfd *obfd));
-static boolean elf64_ia64_print_private_bfd_data
+static boolean elfNN_ia64_print_private_bfd_data
   PARAMS ((bfd *abfd, PTR ptr));
 
 
 /* ia64-specific relocation */
 
 /* Perform a relocation.  Not much to do here as all the hard work is
-   done in elf64_ia64_final_link_relocate.  */
+   done in elfNN_ia64_final_link_relocate.  */
 static bfd_reloc_status_type
-elf64_ia64_reloc (abfd, reloc, sym, data, input_section,
+elfNN_ia64_reloc (abfd, reloc, sym, data, input_section,
 		  output_bfd, error_message)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc;
-     asymbol *sym;
-     PTR data;
+     asymbol *sym ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
      asection *input_section;
      bfd *output_bfd;
      char **error_message;
@@ -296,13 +296,13 @@
       reloc->address += input_section->output_offset;
       return bfd_reloc_ok;
     }
-  *error_message = "Unsupported call to elf64_ia64_reloc";
+  *error_message = "Unsupported call to elfNN_ia64_reloc";
   return bfd_reloc_notsupported;
 }
 
 #define IA64_HOWTO(TYPE, NAME, SIZE, PCREL, IN)			\
   HOWTO (TYPE, 0, SIZE, 0, PCREL, 0, complain_overflow_signed,	\
-	 elf64_ia64_reloc, NAME, false, 0, 0, IN)
+	 elfNN_ia64_reloc, NAME, false, 0, 0, IN)
 
 /* This table has to be sorted according to increasing number of the
    TYPE field.  */
@@ -353,7 +353,6 @@
     IA64_HOWTO (R_IA64_LTOFF_FPTR64MSB, "LTOFF_FPTR64MSB", 4, false, true),
     IA64_HOWTO (R_IA64_LTOFF_FPTR64LSB, "LTOFF_FPTR64LSB", 4, false, true),
 
-    IA64_HOWTO (R_IA64_SEGBASE,	    "SEGBASE",	   4, false, true),
     IA64_HOWTO (R_IA64_SEGREL32MSB, "SEGREL32MSB", 2, false, true),
     IA64_HOWTO (R_IA64_SEGREL32LSB, "SEGREL32LSB", 2, false, true),
     IA64_HOWTO (R_IA64_SEGREL64MSB, "SEGREL64MSB", 4, false, true),
@@ -380,8 +379,6 @@
 
     IA64_HOWTO (R_IA64_IPLTMSB,	    "IPLTMSB",	   4, false, true),
     IA64_HOWTO (R_IA64_IPLTLSB,	    "IPLTLSB",	   4, false, true),
-    IA64_HOWTO (R_IA64_EPLTMSB,	    "EPLTMSB",	   4, false, true),
-    IA64_HOWTO (R_IA64_EPLTLSB,	    "EPLTLSB",	   4, false, true),
     IA64_HOWTO (R_IA64_COPY,	    "COPY",	   4, false, true),
     IA64_HOWTO (R_IA64_LTOFF22X,    "LTOFF22X",	   0, false, true),
     IA64_HOWTO (R_IA64_LDXMOV,	    "LDXMOV",	   0, false, true),
@@ -420,8 +417,8 @@
 }
 
 static reloc_howto_type*
-elf64_ia64_reloc_type_lookup (abfd, bfd_code)
-     bfd *abfd;
+elfNN_ia64_reloc_type_lookup (abfd, bfd_code)
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type bfd_code;
 {
   unsigned int rtype;
@@ -476,7 +473,6 @@
     case BFD_RELOC_IA64_LTOFF_FPTR64MSB: rtype = R_IA64_LTOFF_FPTR64MSB; break;
     case BFD_RELOC_IA64_LTOFF_FPTR64LSB: rtype = R_IA64_LTOFF_FPTR64LSB; break;
 
-    case BFD_RELOC_IA64_SEGBASE:	rtype = R_IA64_SEGBASE; break;
     case BFD_RELOC_IA64_SEGREL32MSB:	rtype = R_IA64_SEGREL32MSB; break;
     case BFD_RELOC_IA64_SEGREL32LSB:	rtype = R_IA64_SEGREL32LSB; break;
     case BFD_RELOC_IA64_SEGREL64MSB:	rtype = R_IA64_SEGREL64MSB; break;
@@ -499,8 +495,6 @@
 
     case BFD_RELOC_IA64_IPLTMSB:	rtype = R_IA64_IPLTMSB; break;
     case BFD_RELOC_IA64_IPLTLSB:	rtype = R_IA64_IPLTLSB; break;
-    case BFD_RELOC_IA64_EPLTMSB:	rtype = R_IA64_EPLTMSB; break;
-    case BFD_RELOC_IA64_EPLTLSB:	rtype = R_IA64_EPLTLSB; break;
     case BFD_RELOC_IA64_COPY:		rtype = R_IA64_COPY; break;
     case BFD_RELOC_IA64_LTOFF22X:	rtype = R_IA64_LTOFF22X; break;
     case BFD_RELOC_IA64_LDXMOV:		rtype = R_IA64_LDXMOV; break;
@@ -518,12 +512,12 @@
 /* Given a ELF reloc, return the matching HOWTO structure.  */
 
 static void
-elf64_ia64_info_to_howto (abfd, bfd_reloc, elf_reloc)
-     bfd *abfd;
+elfNN_ia64_info_to_howto (abfd, bfd_reloc, elf_reloc)
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *bfd_reloc;
-     Elf64_Internal_Rela *elf_reloc;
+     ElfNN_Internal_Rela *elf_reloc;
 {
-  bfd_reloc->howto = lookup_howto (ELF64_R_TYPE (elf_reloc->r_info));
+  bfd_reloc->howto = lookup_howto (ELFNN_R_TYPE (elf_reloc->r_info));
 }
 
 #define PLT_HEADER_SIZE		(3 * 16)
@@ -593,7 +587,7 @@
    relaxation of R_IA64_LTOFF22X and R_IA64_LDXMOV not yet supported.  */
 
 static boolean
-elf64_ia64_relax_section (abfd, sec, link_info, again)
+elfNN_ia64_relax_section (abfd, sec, link_info, again)
      bfd *abfd;
      asection *sec;
      struct bfd_link_info *link_info;
@@ -609,19 +603,19 @@
 
   Elf_Internal_Shdr *symtab_hdr;
   Elf_Internal_Rela *internal_relocs;
-  Elf_Internal_Rela *free_relocs;
+  Elf_Internal_Rela *free_relocs = NULL;
   Elf_Internal_Rela *irel, *irelend;
   bfd_byte *contents;
-  bfd_byte *free_contents;
-  Elf64_External_Sym *extsyms;
-  Elf64_External_Sym *free_extsyms;
-  struct elf64_ia64_link_hash_table *ia64_info;
+  bfd_byte *free_contents = NULL;
+  ElfNN_External_Sym *extsyms;
+  ElfNN_External_Sym *free_extsyms = NULL;
+  struct elfNN_ia64_link_hash_table *ia64_info;
   struct one_fixup *fixups = NULL;
   boolean changed_contents = false;
   boolean changed_relocs = false;
 
-  /* Assume we're not going to change any sizes, and we we'll only
-     need one pass.  */
+  /* Assume we're not going to change any sizes, and we'll only need
+     one pass.  */
   *again = false;
 
   /* Nothing to do if there are no relocations.  */
@@ -637,20 +631,20 @@
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
 
   /* Load the relocations for this section.  */
-  internal_relocs = (_bfd_elf64_link_read_relocs
+  internal_relocs = (_bfd_elfNN_link_read_relocs
 		     (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
 		      link_info->keep_memory));
   if (internal_relocs == NULL)
     goto error_return;
-  free_relocs = NULL;
+
   if (! link_info->keep_memory)
     free_relocs = internal_relocs;
 
-  ia64_info = elf64_ia64_hash_table (link_info);
+  ia64_info = elfNN_ia64_hash_table (link_info);
   irelend = internal_relocs + sec->reloc_count;
 
   for (irel = internal_relocs; irel < irelend; irel++)
-    if (ELF64_R_TYPE (irel->r_info) == (int) R_IA64_PCREL21B)
+    if (ELFNN_R_TYPE (irel->r_info) == (int) R_IA64_PCREL21B)
       break;
 
   /* No branch-type relocations.  */
@@ -662,7 +656,6 @@
     }
 
   /* Get the section contents.  */
-  free_contents = NULL;
   if (elf_section_data (sec)->this_hdr.contents != NULL)
     contents = elf_section_data (sec)->this_hdr.contents;
   else
@@ -678,12 +671,11 @@
     }
 
   /* Read this BFD's symbols.  */
-  free_extsyms = NULL;
   if (symtab_hdr->contents != NULL)
-    extsyms = (Elf64_External_Sym *) symtab_hdr->contents;
+    extsyms = (ElfNN_External_Sym *) symtab_hdr->contents;
   else
     {
-      extsyms = (Elf64_External_Sym *) bfd_malloc (symtab_hdr->sh_size);
+      extsyms = (ElfNN_External_Sym *) bfd_malloc (symtab_hdr->sh_size);
       if (extsyms == NULL)
 	goto error_return;
       free_extsyms = extsyms;
@@ -700,15 +692,15 @@
       asection *tsec;
       struct one_fixup *f;
 
-      if (ELF64_R_TYPE (irel->r_info) != (int) R_IA64_PCREL21B)
+      if (ELFNN_R_TYPE (irel->r_info) != (int) R_IA64_PCREL21B)
 	continue;
 
       /* Get the value of the symbol referred to by the reloc.  */
-      if (ELF64_R_SYM (irel->r_info) < symtab_hdr->sh_info)
+      if (ELFNN_R_SYM (irel->r_info) < symtab_hdr->sh_info)
 	{
 	  /* A local symbol.  */
-	  bfd_elf64_swap_symbol_in (abfd,
-				    extsyms + ELF64_R_SYM (irel->r_info),
+	  bfd_elfNN_swap_symbol_in (abfd,
+				    extsyms + ELFNN_R_SYM (irel->r_info),
 				    &isym);
 	  if (isym.st_shndx == SHN_UNDEF)
 	    continue;	/* We can't do anthing with undefined symbols.  */
@@ -727,9 +719,9 @@
 	{
 	  unsigned long indx;
 	  struct elf_link_hash_entry *h;
-          struct elf64_ia64_dyn_sym_info *dyn_i;
+          struct elfNN_ia64_dyn_sym_info *dyn_i;
 
-	  indx = ELF64_R_SYM (irel->r_info) - symtab_hdr->sh_info;
+	  indx = ELFNN_R_SYM (irel->r_info) - symtab_hdr->sh_info;
 	  h = elf_sym_hashes (abfd)[indx];
 	  BFD_ASSERT (h != NULL);
 
@@ -815,7 +807,7 @@
 	      memcpy (contents + trampoff, plt_full_entry, size);
 
 	      /* Hijack the old relocation for use as the PLTOFF reloc.  */
-	      irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
+	      irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
 					   R_IA64_PLTOFF22);
 	      irel->r_offset = trampoff;
 	    }
@@ -823,12 +815,12 @@
 	    {
 #ifdef USE_BRL
 	      memcpy (contents + trampoff, oor_brl, size);
-	      irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
+	      irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
 					   R_IA64_PCREL60B);
 	      irel->r_offset = trampoff + 2;
 #else
 	      memcpy (contents + trampoff, oor_ip, size);
-	      irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
+	      irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
 					   R_IA64_PCREL64I);
 	      irel->r_addend -= 16;
 	      irel->r_offset = trampoff + 2;
@@ -846,12 +838,12 @@
       else
 	{
 	  /* Nop out the reloc, since we're finalizing things here.  */
-	  irel->r_info = ELF64_R_INFO (0, R_IA64_NONE);
+	  irel->r_info = ELFNN_R_INFO (0, R_IA64_NONE);
 	}
 
       /* Fix up the existing branch to hit the trampoline.  Hope like
 	 hell this doesn't overflow too.  */
-      if (elf64_ia64_install_value (abfd, contents + roff,
+      if (elfNN_ia64_install_value (abfd, contents + roff,
 				    f->trampoff - (roff & -4),
 				    R_IA64_PCREL21B) != bfd_reloc_ok)
 	goto error_return;
@@ -914,9 +906,9 @@
    is called when elfcode.h finds a section with an unknown type.  */
 
 static boolean
-elf64_ia64_section_from_shdr (abfd, hdr, name)
+elfNN_ia64_section_from_shdr (abfd, hdr, name)
      bfd *abfd;
-     Elf64_Internal_Shdr *hdr;
+     ElfNN_Internal_Shdr *hdr;
      char *name;
 {
   asection *newsect;
@@ -946,8 +938,21 @@
     return false;
   newsect = hdr->bfd_section;
 
+  return true;
+}
+
+/* Convert IA-64 specific section flags to bfd internal section flags.  */
+
+/* ??? There is no bfd internal flag equivalent to the SHF_IA_64_NORECOV
+   flag.  */
+
+static boolean
+elfNN_ia64_section_flags (flags, hdr)
+     flagword *flags;
+     ElfNN_Internal_Shdr *hdr;
+{
   if (hdr->sh_flags & SHF_IA_64_SHORT)
-    newsect->flags |= SEC_SMALL_DATA;
+    *flags |= SEC_SMALL_DATA;
 
   return true;
 }
@@ -956,9 +961,9 @@
    section name, which is a hack, but ought to work.  */
 
 static boolean
-elf64_ia64_fake_sections (abfd, hdr, sec)
-     bfd *abfd;
-     Elf64_Internal_Shdr *hdr;
+elfNN_ia64_fake_sections (abfd, hdr, sec)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     ElfNN_Internal_Shdr *hdr;
      asection *sec;
 {
   register const char *name;
@@ -977,12 +982,12 @@
      * containing ELF relocation info.  We need this hack in order to
      * be able to generate ELF binaries that can be translated into
      * EFI applications (which are essentially COFF objects).  Those
-     * files contain a COFF ".reloc" section inside an ELF64 object,
+     * files contain a COFF ".reloc" section inside an ELFNN object,
      * which would normally cause BFD to segfault because it would
      * attempt to interpret this section as containing relocation
      * entries for section "oc".  With this hack enabled, ".reloc"
      * will be treated as a normal data section, which will avoid the
-     * segfault.  However, you won't be able to create an ELF64 binary
+     * segfault.  However, you won't be able to create an ELFNN binary
      * with a section named "oc" that needs relocations, but that's
      * the kind of ugly side-effects you get when detecting section
      * types based on their names...  In practice, this limitation is
@@ -1000,18 +1005,18 @@
    file.  We use it to put .comm items in .sbss, and not .bss.  */
 
 static boolean
-elf64_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
+elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
      bfd *abfd;
      struct bfd_link_info *info;
      const Elf_Internal_Sym *sym;
-     const char **namep;
-     flagword *flagsp;
+     const char **namep ATTRIBUTE_UNUSED;
+     flagword *flagsp ATTRIBUTE_UNUSED;
      asection **secp;
      bfd_vma *valp;
 {
   if (sym->st_shndx == SHN_COMMON
       && !info->relocateable
-      && sym->st_size <= bfd_get_gp_size (abfd))
+      && sym->st_size <= (unsigned) bfd_get_gp_size (abfd))
     {
       /* Common symbols less than or equal to -G nn bytes are
 	 automatically put into .sbss.  */
@@ -1038,7 +1043,7 @@
 /* Return the number of additional phdrs we will need.  */
 
 static int
-elf64_ia64_additional_program_headers (abfd)
+elfNN_ia64_additional_program_headers (abfd)
      bfd *abfd;
 {
   asection *s;
@@ -1058,7 +1063,7 @@
 }
 
 static boolean
-elf64_ia64_modify_segment_map (abfd)
+elfNN_ia64_modify_segment_map (abfd)
      bfd *abfd;
 {
   struct elf_segment_map *m, **pm;
@@ -1156,8 +1161,8 @@
    '.' are local.  */
 
 static boolean
-elf64_ia64_is_local_label_name (abfd, name)
-     bfd *abfd;
+elfNN_ia64_is_local_label_name (abfd, name)
+     bfd *abfd ATTRIBUTE_UNUSED;
      const char *name;
 {
   return name[0] == '.';
@@ -1166,7 +1171,7 @@
 /* Should we do dynamic things to this symbol?  */
 
 static boolean
-elf64_ia64_dynamic_symbol_p (h, info)
+elfNN_ia64_dynamic_symbol_p (h, info)
      struct elf_link_hash_entry *h;
      struct bfd_link_info *info;
 {
@@ -1194,9 +1199,9 @@
 }
 
 static boolean
-elf64_ia64_local_hash_table_init (ht, abfd, new)
-     struct elf64_ia64_local_hash_table *ht;
-     bfd *abfd;
+elfNN_ia64_local_hash_table_init (ht, abfd, new)
+     struct elfNN_ia64_local_hash_table *ht;
+     bfd *abfd ATTRIBUTE_UNUSED;
      new_hash_entry_func new;
 {
   memset (ht, 0, sizeof(*ht));
@@ -1204,13 +1209,13 @@
 }
 
 static struct bfd_hash_entry*
-elf64_ia64_new_loc_hash_entry (entry, table, string)
+elfNN_ia64_new_loc_hash_entry (entry, table, string)
      struct bfd_hash_entry *entry;
      struct bfd_hash_table *table;
      const char *string;
 {
-  struct elf64_ia64_local_hash_entry *ret;
-  ret = (struct elf64_ia64_local_hash_entry *) entry;
+  struct elfNN_ia64_local_hash_entry *ret;
+  ret = (struct elfNN_ia64_local_hash_entry *) entry;
 
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
@@ -1225,20 +1230,20 @@
   memset (ret, 0, sizeof(*ret));
 
   /* Call the allocation method of the superclass.  */
-  ret = ((struct elf64_ia64_local_hash_entry *)
+  ret = ((struct elfNN_ia64_local_hash_entry *)
 	 bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
 
   return (struct bfd_hash_entry *) ret;
 }
 
 static struct bfd_hash_entry*
-elf64_ia64_new_elf_hash_entry (entry, table, string)
+elfNN_ia64_new_elf_hash_entry (entry, table, string)
      struct bfd_hash_entry *entry;
      struct bfd_hash_table *table;
      const char *string;
 {
-  struct elf64_ia64_link_hash_entry *ret;
-  ret = (struct elf64_ia64_link_hash_entry *) entry;
+  struct elfNN_ia64_link_hash_entry *ret;
+  ret = (struct elfNN_ia64_link_hash_entry *) entry;
 
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
@@ -1253,7 +1258,7 @@
   memset (ret, 0, sizeof(*ret));
 
   /* Call the allocation method of the superclass.  */
-  ret = ((struct elf64_ia64_link_hash_entry *)
+  ret = ((struct elfNN_ia64_link_hash_entry *)
 	 _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
 				     table, string));
 
@@ -1261,13 +1266,13 @@
 }
 
 static void
-elf64_ia64_hash_copy_indirect (xdir, xind)
+elfNN_ia64_hash_copy_indirect (xdir, xind)
      struct elf_link_hash_entry *xdir, *xind;
 {
-  struct elf64_ia64_link_hash_entry *dir, *ind;
+  struct elfNN_ia64_link_hash_entry *dir, *ind;
 
-  dir = (struct elf64_ia64_link_hash_entry *)xdir;
-  ind = (struct elf64_ia64_link_hash_entry *)xind;
+  dir = (struct elfNN_ia64_link_hash_entry *)xdir;
+  ind = (struct elfNN_ia64_link_hash_entry *)xind;
 
   /* Copy down any references that we may have already seen to the 
      symbol which just became indirect.  */
@@ -1283,7 +1288,7 @@
 
   if (dir->info == NULL)
     {
-      struct elf64_ia64_dyn_sym_info *dyn_i;
+      struct elfNN_ia64_dyn_sym_info *dyn_i;
 
       dir->info = dyn_i = ind->info;
       ind->info = NULL;
@@ -1307,13 +1312,14 @@
 }
 
 static void
-elf64_ia64_hash_hide_symbol (xh)
+elfNN_ia64_hash_hide_symbol (info, xh)
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      struct elf_link_hash_entry *xh;
 {
-  struct elf64_ia64_link_hash_entry *h;
-  struct elf64_ia64_dyn_sym_info *dyn_i;
+  struct elfNN_ia64_link_hash_entry *h;
+  struct elfNN_ia64_dyn_sym_info *dyn_i;
 
-  h = (struct elf64_ia64_link_hash_entry *)xh;
+  h = (struct elfNN_ia64_link_hash_entry *)xh;
 
   h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
   h->root.dynindx = -1;
@@ -1327,57 +1333,57 @@
    linker (without using static variables).  */
 
 static struct bfd_link_hash_table*
-elf64_ia64_hash_table_create (abfd)
+elfNN_ia64_hash_table_create (abfd)
      bfd *abfd;
 {
-  struct elf64_ia64_link_hash_table *ret;
+  struct elfNN_ia64_link_hash_table *ret;
 
   ret = bfd_alloc (abfd, sizeof (*ret));
   if (!ret)
     return 0;
   if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
-				      elf64_ia64_new_elf_hash_entry))
+				      elfNN_ia64_new_elf_hash_entry))
     {
       bfd_release (abfd, ret);
       return 0;
     }
 
-  if (!elf64_ia64_local_hash_table_init (&ret->loc_hash_table, abfd,
-				         elf64_ia64_new_loc_hash_entry))
+  if (!elfNN_ia64_local_hash_table_init (&ret->loc_hash_table, abfd,
+				         elfNN_ia64_new_loc_hash_entry))
     return 0;
   return &ret->root.root;
 }
 
 /* Look up an entry in a Alpha ELF linker hash table.  */
 
-static INLINE struct elf64_ia64_local_hash_entry *
-elf64_ia64_local_hash_lookup(table, string, create, copy)
-     struct elf64_ia64_local_hash_table *table;
+static INLINE struct elfNN_ia64_local_hash_entry *
+elfNN_ia64_local_hash_lookup(table, string, create, copy)
+     struct elfNN_ia64_local_hash_table *table;
      const char *string;
      boolean create, copy;
 {
-  return ((struct elf64_ia64_local_hash_entry *)
+  return ((struct elfNN_ia64_local_hash_entry *)
 	  bfd_hash_lookup (&table->root, string, create, copy));
 }
 
 /* Traverse both local and global hash tables.  */
 
-struct elf64_ia64_dyn_sym_traverse_data
+struct elfNN_ia64_dyn_sym_traverse_data
 {
-  boolean (*func) PARAMS ((struct elf64_ia64_dyn_sym_info *, PTR));
+  boolean (*func) PARAMS ((struct elfNN_ia64_dyn_sym_info *, PTR));
   PTR data;
 };
 
 static boolean
-elf64_ia64_global_dyn_sym_thunk (xentry, xdata)
+elfNN_ia64_global_dyn_sym_thunk (xentry, xdata)
      struct bfd_hash_entry *xentry;
      PTR xdata;
 {
-  struct elf64_ia64_link_hash_entry *entry
-    = (struct elf64_ia64_link_hash_entry *) xentry;
-  struct elf64_ia64_dyn_sym_traverse_data *data
-    = (struct elf64_ia64_dyn_sym_traverse_data *) xdata;
-  struct elf64_ia64_dyn_sym_info *dyn_i;
+  struct elfNN_ia64_link_hash_entry *entry
+    = (struct elfNN_ia64_link_hash_entry *) xentry;
+  struct elfNN_ia64_dyn_sym_traverse_data *data
+    = (struct elfNN_ia64_dyn_sym_traverse_data *) xdata;
+  struct elfNN_ia64_dyn_sym_info *dyn_i;
 
   for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next)
     if (! (*data->func) (dyn_i, data->data))
@@ -1386,15 +1392,15 @@
 }
 
 static boolean
-elf64_ia64_local_dyn_sym_thunk (xentry, xdata)
+elfNN_ia64_local_dyn_sym_thunk (xentry, xdata)
      struct bfd_hash_entry *xentry;
      PTR xdata;
 {
-  struct elf64_ia64_local_hash_entry *entry
-    = (struct elf64_ia64_local_hash_entry *) xentry;
-  struct elf64_ia64_dyn_sym_traverse_data *data
-    = (struct elf64_ia64_dyn_sym_traverse_data *) xdata;
-  struct elf64_ia64_dyn_sym_info *dyn_i;
+  struct elfNN_ia64_local_hash_entry *entry
+    = (struct elfNN_ia64_local_hash_entry *) xentry;
+  struct elfNN_ia64_dyn_sym_traverse_data *data
+    = (struct elfNN_ia64_dyn_sym_traverse_data *) xdata;
+  struct elfNN_ia64_dyn_sym_info *dyn_i;
 
   for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next)
     if (! (*data->func) (dyn_i, data->data))
@@ -1403,35 +1409,34 @@
 }
 
 static void
-elf64_ia64_dyn_sym_traverse (ia64_info, func, data)
-     struct elf64_ia64_link_hash_table *ia64_info;
-     boolean (*func) PARAMS ((struct elf64_ia64_dyn_sym_info *, PTR));
+elfNN_ia64_dyn_sym_traverse (ia64_info, func, data)
+     struct elfNN_ia64_link_hash_table *ia64_info;
+     boolean (*func) PARAMS ((struct elfNN_ia64_dyn_sym_info *, PTR));
      PTR data;
 {
-  struct elf64_ia64_dyn_sym_traverse_data xdata;
+  struct elfNN_ia64_dyn_sym_traverse_data xdata;
 
   xdata.func = func;
   xdata.data = data;
 
   elf_link_hash_traverse (&ia64_info->root,
-			  elf64_ia64_global_dyn_sym_thunk, &xdata);
+			  elfNN_ia64_global_dyn_sym_thunk, &xdata);
   bfd_hash_traverse (&ia64_info->loc_hash_table.root,
-		     elf64_ia64_local_dyn_sym_thunk, &xdata);
+		     elfNN_ia64_local_dyn_sym_thunk, &xdata);
 }
 
 static boolean
-elf64_ia64_create_dynamic_sections (abfd, info)
+elfNN_ia64_create_dynamic_sections (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
-  struct elf64_ia64_link_hash_table *ia64_info;
-  struct elf_link_hash_entry *h;
+  struct elfNN_ia64_link_hash_table *ia64_info;
   asection *s;
 
   if (! _bfd_elf_create_dynamic_sections (abfd, info))
     return false;
 
-  ia64_info = elf64_ia64_hash_table (info);
+  ia64_info = elfNN_ia64_hash_table (info);
 
   ia64_info->plt_sec = bfd_get_section_by_name (abfd, ".plt");
   ia64_info->got_sec = bfd_get_section_by_name (abfd, ".got");
@@ -1472,37 +1477,37 @@
 /* Find and/or create a descriptor for dynamic symbol info.  This will
    vary based on global or local symbol, and the addend to the reloc.  */
 
-static struct elf64_ia64_dyn_sym_info *
+static struct elfNN_ia64_dyn_sym_info *
 get_dyn_sym_info (ia64_info, h, abfd, rel, create)
-     struct elf64_ia64_link_hash_table *ia64_info;
+     struct elfNN_ia64_link_hash_table *ia64_info;
      struct elf_link_hash_entry *h;
      bfd *abfd;
      const Elf_Internal_Rela *rel;
      boolean create;
 {
-  struct elf64_ia64_dyn_sym_info **pp;
-  struct elf64_ia64_dyn_sym_info *dyn_i;
+  struct elfNN_ia64_dyn_sym_info **pp;
+  struct elfNN_ia64_dyn_sym_info *dyn_i;
   bfd_vma addend = rel ? rel->r_addend : 0;
   
   if (h)
-    pp = &((struct elf64_ia64_link_hash_entry *)h)->info;
+    pp = &((struct elfNN_ia64_link_hash_entry *)h)->info;
   else
     {
-      struct elf64_ia64_local_hash_entry *loc_h;
+      struct elfNN_ia64_local_hash_entry *loc_h;
       char *addr_name;
       size_t len;
 
-      /* Construct a string for use in the elf64_ia64_local_hash_table.
+      /* Construct a string for use in the elfNN_ia64_local_hash_table.
          The name describes what was once anonymous memory.  */
 
       len = sizeof(void*)*2 + 1 + sizeof(bfd_vma)*4 + 1 + 1;
       len += 10;	/* %p slop */
 
       addr_name = alloca (len);
-      sprintf (addr_name, "%p:%lx", abfd, ELF64_R_SYM (rel->r_info));
+      sprintf (addr_name, "%p:%lx", (void *) abfd, ELFNN_R_SYM (rel->r_info));
 
       /* Collect the canonical entry data for this address.  */
-      loc_h = elf64_ia64_local_hash_lookup (&ia64_info->loc_hash_table,
+      loc_h = elfNN_ia64_local_hash_lookup (&ia64_info->loc_hash_table,
 					    addr_name, create, create);
       BFD_ASSERT (loc_h);
 
@@ -1514,7 +1519,7 @@
 
   if (dyn_i == NULL && create)
     {
-      dyn_i = (struct elf64_ia64_dyn_sym_info *)
+      dyn_i = (struct elfNN_ia64_dyn_sym_info *)
 	bfd_zalloc (abfd, sizeof *dyn_i);
       *pp = dyn_i;
       dyn_i->addend = addend;
@@ -1527,9 +1532,9 @@
 get_got (abfd, info, ia64_info)
      bfd *abfd;
      struct bfd_link_info *info;
-     struct elf64_ia64_link_hash_table *ia64_info;
+     struct elfNN_ia64_link_hash_table *ia64_info;
 {
-  asection *got, *srel;
+  asection *got;
   bfd *dynobj;
 
   got = ia64_info->got_sec;
@@ -1562,8 +1567,8 @@
 static asection *
 get_fptr (abfd, info, ia64_info)
      bfd *abfd;
-     struct bfd_link_info *info;
-     struct elf64_ia64_link_hash_table *ia64_info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     struct elfNN_ia64_link_hash_table *ia64_info;
 {
   asection *fptr;
   bfd *dynobj;
@@ -1599,8 +1604,8 @@
 static asection *
 get_pltoff (abfd, info, ia64_info)
      bfd *abfd;
-     struct bfd_link_info *info;
-     struct elf64_ia64_link_hash_table *ia64_info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     struct elfNN_ia64_link_hash_table *ia64_info;
 {
   asection *pltoff;
   bfd *dynobj;
@@ -1636,7 +1641,7 @@
 static asection *
 get_reloc_section (abfd, ia64_info, sec, create)
      bfd *abfd;
-     struct elf64_ia64_link_hash_table *ia64_info;
+     struct elfNN_ia64_link_hash_table *ia64_info;
      asection *sec;
      boolean create;
 {
@@ -1683,11 +1688,11 @@
 static boolean
 count_dyn_reloc (abfd, dyn_i, srel, type)
      bfd *abfd;
-     struct elf64_ia64_dyn_sym_info *dyn_i;
+     struct elfNN_ia64_dyn_sym_info *dyn_i;
      asection *srel;
      int type;
 {
-  struct elf64_ia64_dyn_reloc_entry *rent;
+  struct elfNN_ia64_dyn_reloc_entry *rent;
 
   for (rent = dyn_i->reloc_entries; rent; rent = rent->next)
     if (rent->srel == srel && rent->type == type)
@@ -1695,7 +1700,7 @@
 
   if (!rent)
     {
-      rent = (struct elf64_ia64_dyn_reloc_entry *)
+      rent = (struct elfNN_ia64_dyn_reloc_entry *)
 	bfd_alloc (abfd, sizeof (*rent));
       if (!rent)
 	return false;
@@ -1712,13 +1717,13 @@
 }
 
 static boolean
-elf64_ia64_check_relocs (abfd, info, sec, relocs)
+elfNN_ia64_check_relocs (abfd, info, sec, relocs)
      bfd *abfd;
      struct bfd_link_info *info;
      asection *sec;
      const Elf_Internal_Rela *relocs;
 {
-  struct elf64_ia64_link_hash_table *ia64_info;
+  struct elfNN_ia64_link_hash_table *ia64_info;
   const Elf_Internal_Rela *relend;
   Elf_Internal_Shdr *symtab_hdr;
   const Elf_Internal_Rela *rel;
@@ -1728,7 +1733,7 @@
     return true;
 
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
-  ia64_info = elf64_ia64_hash_table (info);
+  ia64_info = elfNN_ia64_hash_table (info);
 
   got = fptr = srel = NULL;
 
@@ -1746,11 +1751,11 @@
       };
 
       struct elf_link_hash_entry *h = NULL;
-      unsigned long r_symndx = ELF64_R_SYM (rel->r_info);
-      struct elf64_ia64_dyn_sym_info *dyn_i;
+      unsigned long r_symndx = ELFNN_R_SYM (rel->r_info);
+      struct elfNN_ia64_dyn_sym_info *dyn_i;
       int need_entry;
       boolean maybe_dynamic;
-      int dynrel_type;
+      int dynrel_type = R_IA64_NONE;
 
       if (r_symndx >= symtab_hdr->sh_info)
 	{
@@ -1776,7 +1781,7 @@
 	maybe_dynamic = true;
 
       need_entry = 0;
-      switch (ELF64_R_TYPE (rel->r_info))
+      switch (ELFNN_R_TYPE (rel->r_info))
 	{
 	case R_IA64_TPREL22:
 	case R_IA64_TPREL64MSB:
@@ -1850,6 +1855,14 @@
 	  dynrel_type = R_IA64_DIR64LSB;
 	  break;
 
+	case R_IA64_IPLTMSB:
+	case R_IA64_IPLTLSB:
+	  /* Shared objects will always need at least a REL relocation.  */
+	  if (info->shared || maybe_dynamic)
+	    need_entry = NEED_DYNREL;
+	  dynrel_type = R_IA64_IPLTLSB;
+	  break;
+
 	case R_IA64_PCREL22:
 	case R_IA64_PCREL64I:
 	case R_IA64_PCREL32MSB:
@@ -1903,7 +1916,7 @@
 	     dynamic symbol table.  */
 	  if (!h && info->shared)
 	    {
-	      if (! (_bfd_elf64_link_record_local_dynamic_symbol
+	      if (! (_bfd_elfNN_link_record_local_dynamic_symbol
 		     (info, abfd, r_symndx)))
 		return false;
 	    }
@@ -1939,7 +1952,7 @@
   return true;
 }
 
-struct elf64_ia64_allocate_data
+struct elfNN_ia64_allocate_data
 {
   struct bfd_link_info *info;
   bfd_size_type ofs;
@@ -1950,14 +1963,14 @@
 
 static boolean
 allocate_global_data_got (dyn_i, data)
-     struct elf64_ia64_dyn_sym_info *dyn_i;
+     struct elfNN_ia64_dyn_sym_info *dyn_i;
      PTR data;
 {
-  struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data;
+  struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
 
   if (dyn_i->want_got
       && ! dyn_i->want_fptr
-      && elf64_ia64_dynamic_symbol_p (dyn_i->h, x->info))
+      && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info))
      {
        dyn_i->got_offset = x->ofs;
        x->ofs += 8;
@@ -1969,14 +1982,14 @@
 
 static boolean
 allocate_global_fptr_got (dyn_i, data)
-     struct elf64_ia64_dyn_sym_info *dyn_i;
+     struct elfNN_ia64_dyn_sym_info *dyn_i;
      PTR data;
 {
-  struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data;
+  struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
 
   if (dyn_i->want_got
       && dyn_i->want_fptr
-      && elf64_ia64_dynamic_symbol_p (dyn_i->h, x->info))
+      && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info))
     {
       dyn_i->got_offset = x->ofs;
       x->ofs += 8;
@@ -1988,13 +2001,13 @@
 
 static boolean
 allocate_local_got (dyn_i, data)
-     struct elf64_ia64_dyn_sym_info *dyn_i;
+     struct elfNN_ia64_dyn_sym_info *dyn_i;
      PTR data;
 {
-  struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data;
+  struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
 
   if (dyn_i->want_got
-      && ! elf64_ia64_dynamic_symbol_p (dyn_i->h, x->info))
+      && ! elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info))
     {
       dyn_i->got_offset = x->ofs;
       x->ofs += 8;
@@ -2026,10 +2039,10 @@
 
 static boolean
 allocate_fptr (dyn_i, data)
-     struct elf64_ia64_dyn_sym_info *dyn_i;
+     struct elfNN_ia64_dyn_sym_info *dyn_i;
      PTR data;
 {
-  struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data;
+  struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
 
   if (dyn_i->want_fptr)
     {
@@ -2047,7 +2060,7 @@
 	      BFD_ASSERT ((h->root.type == bfd_link_hash_defined)
 			  || (h->root.type == bfd_link_hash_defweak));
 
-	      if (!_bfd_elf64_link_record_local_dynamic_symbol
+	      if (!_bfd_elfNN_link_record_local_dynamic_symbol
 		    (x->info, h->root.u.def.section->owner,
 		     global_sym_index (h)))
 		return false;
@@ -2070,10 +2083,10 @@
 
 static boolean
 allocate_plt_entries (dyn_i, data)
-     struct elf64_ia64_dyn_sym_info *dyn_i;
+     struct elfNN_ia64_dyn_sym_info *dyn_i;
      PTR data;
 {
-  struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data;
+  struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
 
   if (dyn_i->want_plt)
     {
@@ -2085,7 +2098,7 @@
 	  h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
       /* ??? Versioned symbols seem to lose ELF_LINK_HASH_NEEDS_PLT.  */
-      if (elf64_ia64_dynamic_symbol_p (h, x->info))
+      if (elfNN_ia64_dynamic_symbol_p (h, x->info))
 	{
 	  bfd_size_type offset = x->ofs;
 	  if (offset == 0)
@@ -2108,10 +2121,10 @@
 
 static boolean
 allocate_plt2_entries (dyn_i, data)
-     struct elf64_ia64_dyn_sym_info *dyn_i;
+     struct elfNN_ia64_dyn_sym_info *dyn_i;
      PTR data;
 {
-  struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data;
+  struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
 
   if (dyn_i->want_plt2)
     {
@@ -2136,10 +2149,10 @@
 
 static boolean
 allocate_pltoff_entries (dyn_i, data)
-     struct elf64_ia64_dyn_sym_info *dyn_i;
+     struct elfNN_ia64_dyn_sym_info *dyn_i;
      PTR data;
 {
-  struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data;
+  struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
 
   if (dyn_i->want_pltoff)
     {
@@ -2154,22 +2167,24 @@
 
 static boolean
 allocate_dynrel_entries (dyn_i, data)
-     struct elf64_ia64_dyn_sym_info *dyn_i;
+     struct elfNN_ia64_dyn_sym_info *dyn_i;
      PTR data;
 {
-  struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data;
-  struct elf64_ia64_link_hash_table *ia64_info;
-  struct elf64_ia64_dyn_reloc_entry *rent;
+  struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
+  struct elfNN_ia64_link_hash_table *ia64_info;
+  struct elfNN_ia64_dyn_reloc_entry *rent;
   boolean dynamic_symbol, shared;
 
-  ia64_info = elf64_ia64_hash_table (x->info);
-  dynamic_symbol = elf64_ia64_dynamic_symbol_p (dyn_i->h, x->info);
+  ia64_info = elfNN_ia64_hash_table (x->info);
+  dynamic_symbol = elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info);
   shared = x->info->shared;
 
   /* Take care of the normal data relocations.  */
 
   for (rent = dyn_i->reloc_entries; rent; rent = rent->next)
     {
+      int count = rent->count;
+
       switch (rent->type)
 	{
 	case R_IA64_FPTR64LSB:
@@ -2187,15 +2202,25 @@
 	  if (!dynamic_symbol && !shared)
 	    continue;
 	  break;
+	case R_IA64_IPLTLSB:
+	  if (!dynamic_symbol && !shared)
+	    continue;
+	  /* Use two REL relocations for IPLT relocations
+	     against local symbols.  */
+	  if (!dynamic_symbol)
+	    count *= 2;
+	  break;
+	default:
+	  abort ();
 	}
-      rent->srel->_raw_size += sizeof (Elf64_External_Rela) * rent->count;
+      rent->srel->_raw_size += sizeof (ElfNN_External_Rela) * count;
     }
 
   /* Take care of the GOT and PLT relocations.  */
 
   if (((dynamic_symbol || shared) && dyn_i->want_got)
       || (dyn_i->want_ltoff_fptr && dyn_i->h && dyn_i->h->dynindx != -1))
-    ia64_info->rel_got_sec->_raw_size += sizeof (Elf64_External_Rela);
+    ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
 
   if (dyn_i->want_pltoff)
     {
@@ -2205,9 +2230,9 @@
 	 shared libraries get two REL relocations.  Local symbols in
 	 main applications get nothing.  */
       if (dynamic_symbol)
-	t = sizeof (Elf64_External_Rela);
+	t = sizeof (ElfNN_External_Rela);
       else if (shared)
-	t = 2 * sizeof (Elf64_External_Rela);
+	t = 2 * sizeof (ElfNN_External_Rela);
 
       ia64_info->rel_pltoff_sec->_raw_size += t;
     }
@@ -2216,8 +2241,8 @@
 }
 
 static boolean
-elf64_ia64_adjust_dynamic_symbol (info, h)
-     struct bfd_link_info *info;
+elfNN_ia64_adjust_dynamic_symbol (info, h)
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      struct elf_link_hash_entry *h;
 {
   /* ??? Undefined symbols with PLT entries should be re-defined
@@ -2246,19 +2271,19 @@
 }
 
 static boolean
-elf64_ia64_size_dynamic_sections (output_bfd, info)
+elfNN_ia64_size_dynamic_sections (output_bfd, info)
      bfd *output_bfd;
      struct bfd_link_info *info;
 {
-  struct elf64_ia64_allocate_data data;
-  struct elf64_ia64_link_hash_table *ia64_info;
+  struct elfNN_ia64_allocate_data data;
+  struct elfNN_ia64_link_hash_table *ia64_info;
   asection *sec;
   bfd *dynobj;
   boolean reltext = false;
   boolean relplt = false;
 
   dynobj = elf_hash_table(info)->dynobj;
-  ia64_info = elf64_ia64_hash_table (info);
+  ia64_info = elfNN_ia64_hash_table (info);
   BFD_ASSERT(dynobj != NULL);
   data.info = info;
 
@@ -2272,44 +2297,14 @@
       sec->_raw_size = strlen (ELF_DYNAMIC_INTERPRETER) + 1;
     }
 
-  /* DT_INIT and DT_FINI get function descriptors not raw code addresses.
-     Force their symbols to have pltoff entries so we can use those.  */
-  if (ia64_info->root.dynamic_sections_created)
-    {
-      struct elf_link_hash_entry *h;
-      struct elf64_ia64_dyn_sym_info *dyn_i;
- 
-      if (info->init_function
-	  && (h = elf_link_hash_lookup (elf_hash_table (info), 
-					info->init_function, false,
-					false, false))
-          && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
-                                        | ELF_LINK_HASH_DEF_REGULAR)) != 0)
-        {
-	  dyn_i = get_dyn_sym_info (ia64_info, h, output_bfd, NULL, true);
-	  dyn_i->want_pltoff = 1;
-        }
-
-      if (info->fini_function
-	  && (h = elf_link_hash_lookup (elf_hash_table (info), 
-					info->fini_function, false,
-					false, false))
-          && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
-                                        | ELF_LINK_HASH_DEF_REGULAR)) != 0)
-        {
-	  dyn_i = get_dyn_sym_info (ia64_info, h, output_bfd, NULL, true);
-	  dyn_i->want_pltoff = 1;
-        }
-    }
-
   /* Allocate the GOT entries.  */
 
   if (ia64_info->got_sec)
     {
       data.ofs = 0;
-      elf64_ia64_dyn_sym_traverse (ia64_info, allocate_global_data_got, &data);
-      elf64_ia64_dyn_sym_traverse (ia64_info, allocate_global_fptr_got, &data);
-      elf64_ia64_dyn_sym_traverse (ia64_info, allocate_local_got, &data);
+      elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_data_got, &data);
+      elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_fptr_got, &data);
+      elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_local_got, &data);
       ia64_info->got_sec->_raw_size = data.ofs;
     }
 
@@ -2318,7 +2313,7 @@
   if (ia64_info->fptr_sec)
     {
       data.ofs = 0;
-      elf64_ia64_dyn_sym_traverse (ia64_info, allocate_fptr, &data);
+      elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_fptr, &data);
       ia64_info->fptr_sec->_raw_size = data.ofs;
     }
 
@@ -2328,7 +2323,7 @@
      this has the side-effect of clearing want_plt and want_plt2.  */
 
   data.ofs = 0;
-  elf64_ia64_dyn_sym_traverse (ia64_info, allocate_plt_entries, &data);
+  elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_plt_entries, &data);
 
   ia64_info->minplt_entries = 0;
   if (data.ofs)
@@ -2340,7 +2335,7 @@
   /* Align the pointer for the plt2 entries.  */
   data.ofs = (data.ofs + 31) & -32;
 
-  elf64_ia64_dyn_sym_traverse (ia64_info, allocate_plt2_entries, &data);
+  elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_plt2_entries, &data);
   if (data.ofs != 0)
     {
       BFD_ASSERT (ia64_info->root.dynamic_sections_created);
@@ -2358,7 +2353,7 @@
   if (ia64_info->pltoff_sec)
     {
       data.ofs = 0;
-      elf64_ia64_dyn_sym_traverse (ia64_info, allocate_pltoff_entries, &data);
+      elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_pltoff_entries, &data);
       ia64_info->pltoff_sec->_raw_size = data.ofs;
     }
 
@@ -2367,7 +2362,7 @@
       /* Allocate space for the dynamic relocations that turned out to be
 	 required.  */
 
-      elf64_ia64_dyn_sym_traverse (ia64_info, allocate_dynrel_entries, &data);
+      elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_dynrel_entries, &data);
     }
 
   /* We have now determined the sizes of the various dynamic sections.
@@ -2489,33 +2484,34 @@
 	{
 	  /* The DT_DEBUG entry is filled in by the dynamic linker and used
 	     by the debugger.  */
-	  if (!bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0))
+	  if (!bfd_elfNN_add_dynamic_entry (info, DT_DEBUG, 0))
 	    return false;
 	}
 
-      if (! bfd_elf64_add_dynamic_entry (info, DT_IA_64_PLT_RESERVE, 0))
+      if (! bfd_elfNN_add_dynamic_entry (info, DT_IA_64_PLT_RESERVE, 0))
 	return false;
-      if (! bfd_elf64_add_dynamic_entry (info, DT_PLTGOT, 0))
+      if (! bfd_elfNN_add_dynamic_entry (info, DT_PLTGOT, 0))
 	return false;
 
       if (relplt)
 	{
-	  if (! bfd_elf64_add_dynamic_entry (info, DT_PLTRELSZ, 0)
-	      || ! bfd_elf64_add_dynamic_entry (info, DT_PLTREL, DT_RELA)
-	      || ! bfd_elf64_add_dynamic_entry (info, DT_JMPREL, 0))
+	  if (! bfd_elfNN_add_dynamic_entry (info, DT_PLTRELSZ, 0)
+	      || ! bfd_elfNN_add_dynamic_entry (info, DT_PLTREL, DT_RELA)
+	      || ! bfd_elfNN_add_dynamic_entry (info, DT_JMPREL, 0))
 	    return false;
 	}
 
-      if (! bfd_elf64_add_dynamic_entry (info, DT_RELA, 0)
-	  || ! bfd_elf64_add_dynamic_entry (info, DT_RELASZ, 0)
-	  || ! bfd_elf64_add_dynamic_entry (info, DT_RELAENT,
-					    sizeof(Elf64_External_Rela)))
+      if (! bfd_elfNN_add_dynamic_entry (info, DT_RELA, 0)
+	  || ! bfd_elfNN_add_dynamic_entry (info, DT_RELASZ, 0)
+	  || ! bfd_elfNN_add_dynamic_entry (info, DT_RELAENT,
+					    sizeof(ElfNN_External_Rela)))
 	return false;
 
       if (reltext)
 	{
-	  if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
+	  if (! bfd_elfNN_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
@@ -2525,7 +2521,7 @@
 }
 
 static bfd_reloc_status_type
-elf64_ia64_install_value (abfd, hit_addr, val, r_type)
+elfNN_ia64_install_value (abfd, hit_addr, val, r_type)
      bfd *abfd;
      bfd_byte *hit_addr;
      bfd_vma val;
@@ -2624,25 +2620,6 @@
       break;
 
       /* Unsupported / Dynamic relocations.  */
-
-    case R_IA64_REL32MSB:
-    case R_IA64_REL32LSB:
-    case R_IA64_REL64MSB:
-    case R_IA64_REL64LSB:
-
-    case R_IA64_IPLTMSB:
-    case R_IA64_IPLTLSB:
-    case R_IA64_EPLTMSB:
-    case R_IA64_EPLTLSB:
-    case R_IA64_COPY:
-
-    case R_IA64_SEGBASE:
-
-    case R_IA64_TPREL22:
-    case R_IA64_TPREL64MSB:
-    case R_IA64_TPREL64LSB:
-    case R_IA64_LTOFF_TP22:
-
     default:
       return bfd_reloc_notsupported;
     }
@@ -2743,7 +2720,7 @@
 }
 
 static void
-elf64_ia64_install_dyn_reloc (abfd, info, sec, srel, offset, type,
+elfNN_ia64_install_dyn_reloc (abfd, info, sec, srel, offset, type,
 			      dynindx, addend)
      bfd *abfd;
      struct bfd_link_info *info;
@@ -2761,7 +2738,7 @@
 		     + offset);
 
   BFD_ASSERT (dynindx != -1);
-  outrel.r_info = ELF64_R_INFO (dynindx, type);
+  outrel.r_info = ELFNN_R_INFO (dynindx, type);
   outrel.r_addend = addend;
 
   if (elf_section_data (sec)->stab_info != NULL)
@@ -2778,17 +2755,17 @@
 	{
 	  /* Run for the hills.  We shouldn't be outputting a relocation
 	     for this.  So do what everyone else does and output a no-op.  */
-	  outrel.r_info = ELF64_R_INFO (0, R_IA64_NONE);
+	  outrel.r_info = ELFNN_R_INFO (0, R_IA64_NONE);
 	  outrel.r_addend = 0;
 	  offset = 0;
 	}
       outrel.r_offset = offset;
     }
 
-  bfd_elf64_swap_reloca_out (abfd, &outrel,
-			     ((Elf64_External_Rela *) srel->contents
+  bfd_elfNN_swap_reloca_out (abfd, &outrel,
+			     ((ElfNN_External_Rela *) srel->contents
 			      + srel->reloc_count++));
-  BFD_ASSERT (sizeof(Elf64_External_Rela) * srel->reloc_count
+  BFD_ASSERT (sizeof(ElfNN_External_Rela) * srel->reloc_count
 	      <= srel->_cooked_size);
 }
 
@@ -2799,16 +2776,16 @@
 set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
      bfd *abfd;
      struct bfd_link_info *info;
-     struct elf64_ia64_dyn_sym_info *dyn_i;
+     struct elfNN_ia64_dyn_sym_info *dyn_i;
      long dynindx;
      bfd_vma addend;
      bfd_vma value;
      unsigned int dyn_r_type;
 {
-  struct elf64_ia64_link_hash_table *ia64_info;
+  struct elfNN_ia64_link_hash_table *ia64_info;
   asection *got_sec;
 
-  ia64_info = elf64_ia64_hash_table (info);
+  ia64_info = elfNN_ia64_hash_table (info);
   got_sec = ia64_info->got_sec;
 
   BFD_ASSERT ((dyn_i->got_offset & 7) == 0);
@@ -2822,7 +2799,7 @@
 
       /* Install a dynamic relocation if needed.  */
       if (info->shared
-          || elf64_ia64_dynamic_symbol_p (dyn_i->h, info)
+          || elfNN_ia64_dynamic_symbol_p (dyn_i->h, info)
 	  || (dynindx != -1 && dyn_r_type == R_IA64_FPTR64LSB))
 	{
 	  if (dynindx == -1)
@@ -2851,7 +2828,7 @@
 		}
 	    }
 
-	  elf64_ia64_install_dyn_reloc (abfd, NULL, got_sec,
+	  elfNN_ia64_install_dyn_reloc (abfd, NULL, got_sec,
 					ia64_info->rel_got_sec,
 					dyn_i->got_offset, dyn_r_type,
 					dynindx, addend);
@@ -2873,13 +2850,13 @@
 set_fptr_entry (abfd, info, dyn_i, value)
      bfd *abfd;
      struct bfd_link_info *info;
-     struct elf64_ia64_dyn_sym_info *dyn_i;
+     struct elfNN_ia64_dyn_sym_info *dyn_i;
      bfd_vma value;
 {
-  struct elf64_ia64_link_hash_table *ia64_info;
+  struct elfNN_ia64_link_hash_table *ia64_info;
   asection *fptr_sec;
 
-  ia64_info = elf64_ia64_hash_table (info);
+  ia64_info = elfNN_ia64_hash_table (info);
   fptr_sec = ia64_info->fptr_sec;
 
   if (!dyn_i->fptr_done)
@@ -2907,14 +2884,14 @@
 set_pltoff_entry (abfd, info, dyn_i, value, is_plt)
      bfd *abfd;
      struct bfd_link_info *info;
-     struct elf64_ia64_dyn_sym_info *dyn_i;
+     struct elfNN_ia64_dyn_sym_info *dyn_i;
      bfd_vma value;
      boolean is_plt;
 {
-  struct elf64_ia64_link_hash_table *ia64_info;
+  struct elfNN_ia64_link_hash_table *ia64_info;
   asection *pltoff_sec;
 
-  ia64_info = elf64_ia64_hash_table (info);
+  ia64_info = elfNN_ia64_hash_table (info);
   pltoff_sec = ia64_info->pltoff_sec;
 
   /* Don't do anything if this symbol uses a real PLT entry.  In
@@ -2922,10 +2899,11 @@
   if ((! dyn_i->want_plt || is_plt)
       && !dyn_i->pltoff_done)
     {
+      bfd_vma gp = _bfd_get_gp_value (abfd);
+
       /* Fill in the function descriptor.  */
       bfd_put_64 (abfd, value, pltoff_sec->contents + dyn_i->pltoff_offset);
-      bfd_put_64 (abfd, _bfd_get_gp_value (abfd),
-		  pltoff_sec->contents + dyn_i->pltoff_offset + 8);
+      bfd_put_64 (abfd, gp, pltoff_sec->contents + dyn_i->pltoff_offset + 8);
 
       /* Install dynamic relocations if needed.  */
       if (!is_plt && info->shared)
@@ -2937,14 +2915,14 @@
 	  else
 	    dyn_r_type = R_IA64_REL64LSB;
 
-	  elf64_ia64_install_dyn_reloc (abfd, NULL, pltoff_sec,
+	  elfNN_ia64_install_dyn_reloc (abfd, NULL, pltoff_sec,
 					ia64_info->rel_pltoff_sec,
 					dyn_i->pltoff_offset,
-					dyn_r_type, 0, 0);
-	  elf64_ia64_install_dyn_reloc (abfd, NULL, pltoff_sec,
+					dyn_r_type, 0, value);
+	  elfNN_ia64_install_dyn_reloc (abfd, NULL, pltoff_sec,
 					ia64_info->rel_pltoff_sec,
 					dyn_i->pltoff_offset + 8,
-					dyn_r_type, 0, 0);
+					dyn_r_type, 0, gp);
 	}
 
       dyn_i->pltoff_done = 1;
@@ -2958,13 +2936,34 @@
   return value;
 }
 
+/* Called through qsort to sort the .IA_64.unwind section during a
+   non-relocatable link.  Set elfNN_ia64_unwind_entry_compare_bfd
+   to the output bfd so we can do proper endianness frobbing.  */
+
+static bfd *elfNN_ia64_unwind_entry_compare_bfd;
+
+static int
+elfNN_ia64_unwind_entry_compare (a, b)
+     PTR a;
+     PTR b;
+{
+  bfd_vma av, bv;
+
+  av = bfd_get_64 (elfNN_ia64_unwind_entry_compare_bfd, a);
+  bv = bfd_get_64 (elfNN_ia64_unwind_entry_compare_bfd, b);
+
+  return (av < bv ? -1 : av > bv ? 1 : 0);
+}
+
 static boolean
-elf64_ia64_final_link (abfd, info)
+elfNN_ia64_final_link (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
-  struct elf64_ia64_link_hash_table *ia64_info;
-  ia64_info = elf64_ia64_hash_table (info);
+  struct elfNN_ia64_link_hash_table *ia64_info;
+  asection *unwind_output_sec;
+
+  ia64_info = elfNN_ia64_hash_table (info);
 
   /* Make sure we've got ourselves a nice fat __gp value.  */
   if (!info->relocateable)
@@ -3076,54 +3075,44 @@
       _bfd_set_gp_value (abfd, gp_val);
     }
 
-  /* Tricky bits.  DT_INIT and DT_FINI use a pltoff entry, which is
-     normally initialized in finish_dynamic_sections.  Except that
-     we need all non-plt pltoff entries to be initialized before
-     finish_dynamic_symbols.  This because the array of relocations
-     used for plt entries (aka DT_JMPREL) begins after all the 
-     non-plt pltoff relocations.  If the order gets confused, we
-     munge either the array or the array base.  */
-  if (ia64_info->root.dynamic_sections_created)
+  /* If we're producing a final executable, we need to sort the contents
+     of the .IA_64.unwind section.  Force this section to be relocated
+     into memory rather than written immediately to the output file.  */
+  unwind_output_sec = NULL;
+  if (!info->relocateable)
     {
-      struct elf_link_hash_entry *h;
-      struct elf64_ia64_dyn_sym_info *dyn_i;
-      bfd_vma addr;
- 
-      if (info->init_function
-	  && (h = elf_link_hash_lookup (elf_hash_table (info), 
-					info->init_function, false,
-					false, false))
-          && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
-                                        | ELF_LINK_HASH_DEF_REGULAR)) != 0)
-        {
-	  dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, false);
-	  addr = (h->root.u.def.section->output_section->vma
-		  + h->root.u.def.section->output_offset
-		  + h->root.u.def.value);
-	  (void) set_pltoff_entry (abfd, info, dyn_i, addr, false);
-        }
-
-      if (info->fini_function
-	  && (h = elf_link_hash_lookup (elf_hash_table (info), 
-					info->fini_function, false,
-					false, false))
-          && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
-                                        | ELF_LINK_HASH_DEF_REGULAR)) != 0)
-        {
-	  dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, false);
-	  addr = (h->root.u.def.section->output_section->vma
-		  + h->root.u.def.section->output_offset
-		  + h->root.u.def.value);
-	  (void) set_pltoff_entry (abfd, info, dyn_i, addr, false);
-        }
+      asection *s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_unwind);
+      if (s)
+	{
+	  unwind_output_sec = s->output_section;
+	  unwind_output_sec->contents
+	    = bfd_malloc (unwind_output_sec->_raw_size);
+	  if (unwind_output_sec->contents == NULL)
+	    return false;
+	}
     }
 
   /* Invoke the regular ELF backend linker to do all the work.  */
-  return bfd_elf64_bfd_final_link (abfd, info);
+  if (!bfd_elfNN_bfd_final_link (abfd, info))
+    return false;
+
+  if (unwind_output_sec)
+    {
+      elfNN_ia64_unwind_entry_compare_bfd = abfd;
+      qsort (unwind_output_sec->contents, unwind_output_sec->_raw_size / 24,
+	     24, elfNN_ia64_unwind_entry_compare);
+
+      if (! bfd_set_section_contents (abfd, unwind_output_sec,
+				      unwind_output_sec->contents, 0,
+				      unwind_output_sec->_raw_size))
+	return false;
+    }
+
+  return true;
 }
 
 static boolean
-elf64_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
+elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
 			     contents, relocs, local_syms, local_sections)
      bfd *output_bfd;
      struct bfd_link_info *info;
@@ -3134,7 +3123,7 @@
      Elf_Internal_Sym *local_syms;
      asection **local_sections;
 {
-  struct elf64_ia64_link_hash_table *ia64_info;
+  struct elfNN_ia64_link_hash_table *ia64_info;
   Elf_Internal_Shdr *symtab_hdr;
   Elf_Internal_Rela *rel;
   Elf_Internal_Rela *relend;
@@ -3143,7 +3132,7 @@
   bfd_vma gp_val;
 
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
-  ia64_info = elf64_ia64_hash_table (info);
+  ia64_info = elfNN_ia64_hash_table (info);
 
   /* Infect various flags from the input section to the output section.  */
   if (info->relocateable)
@@ -3165,7 +3154,7 @@
   for (; rel < relend; ++rel)
     {
       struct elf_link_hash_entry *h;
-      struct elf64_ia64_dyn_sym_info *dyn_i;
+      struct elfNN_ia64_dyn_sym_info *dyn_i;
       bfd_reloc_status_type r;
       reloc_howto_type *howto;
       unsigned long r_symndx;
@@ -3177,7 +3166,7 @@
       boolean dynamic_symbol_p;
       boolean undef_weak_ref;
 
-      r_type = ELF64_R_TYPE (rel->r_info);
+      r_type = ELFNN_R_TYPE (rel->r_info);
       if (r_type > R_IA64_MAX_RELOC_CODE)
 	{
 	  (*_bfd_error_handler)
@@ -3188,7 +3177,7 @@
 	  continue;
 	}
       howto = lookup_howto (r_type);
-      r_symndx = ELF64_R_SYM (rel->r_info);
+      r_symndx = ELFNN_R_SYM (rel->r_info);
 
       if (info->relocateable)
 	{
@@ -3277,7 +3266,7 @@
 
       hit_addr = contents + rel->r_offset;
       value += rel->r_addend;
-      dynamic_symbol_p = elf64_ia64_dynamic_symbol_p (h, info);
+      dynamic_symbol_p = elfNN_ia64_dynamic_symbol_p (h, info);
 
       switch (r_type)
 	{
@@ -3298,6 +3287,7 @@
 	    {
 	      unsigned int dyn_r_type;
 	      long dynindx;
+	      bfd_vma addend;
 
 	      BFD_ASSERT (srel != NULL);
 
@@ -3305,7 +3295,11 @@
 		 matching RELATIVE relocation.  */
 	      dyn_r_type = r_type;
 	      if (dynamic_symbol_p)
-		dynindx = h->dynindx;
+		{
+		  dynindx = h->dynindx;
+		  addend = rel->r_addend;
+		  value = 0;
+		}
 	      else
 		{
 		  switch (r_type)
@@ -3337,11 +3331,12 @@
 		      continue;
 		    }
 		  dynindx = 0;
+		  addend = value;
 		}
 
-	      elf64_ia64_install_dyn_reloc (output_bfd, info, input_section,
+	      elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section,
 					    srel, rel->r_offset, dyn_r_type,
-					    dynindx, rel->r_addend);
+					    dynindx, addend);
 	    }
 	  /* FALLTHRU */
 
@@ -3349,7 +3344,7 @@
 	case R_IA64_LTV32LSB:
 	case R_IA64_LTV64MSB:
 	case R_IA64_LTV64LSB:
-	  r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type);
+	  r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
 	  break;
 
 	case R_IA64_GPREL22:
@@ -3367,7 +3362,7 @@
 	      continue;
 	    }
 	  value -= gp_val;
-	  r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type);
+	  r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
 	  break;
 
 	case R_IA64_LTOFF22:
@@ -3377,7 +3372,7 @@
 	  value = set_got_entry (input_bfd, info, dyn_i, (h ? h->dynindx : -1),
 				 rel->r_addend, value, R_IA64_DIR64LSB);
 	  value -= gp_val;
-	  r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type);
+	  r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
 	  break;
 
 	case R_IA64_PLTOFF22:
@@ -3387,7 +3382,7 @@
           dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, false);
 	  value = set_pltoff_entry (output_bfd, info, dyn_i, value, false);
 	  value -= gp_val;
-	  r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type);
+	  r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
 	  break;
 
 	case R_IA64_FPTR64I:
@@ -3423,13 +3418,13 @@
 			     (info, input_bfd, r_symndx));
 		}
 
-	      elf64_ia64_install_dyn_reloc (output_bfd, info, input_section,
+	      elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section,
 					    srel, rel->r_offset, r_type,
 					    dynindx, rel->r_addend);
 	      value = 0;
 	    }
 
-	  r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type);
+	  r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
 	  break;
 
 	case R_IA64_LTOFF_FPTR22:
@@ -3469,7 +3464,7 @@
 	    value = set_got_entry (output_bfd, info, dyn_i, dynindx,
 				   rel->r_addend, value, R_IA64_FPTR64LSB);
 	    value -= gp_val;
-	    r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type);
+	    r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
 	  }
 	  break;
 
@@ -3482,7 +3477,7 @@
 	    {
 	      BFD_ASSERT (srel != NULL);
 
-	      elf64_ia64_install_dyn_reloc (output_bfd, info, input_section,
+	      elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section,
 					    srel, rel->r_offset, r_type,
 					    h->dynindx, rel->r_addend);
 	    }
@@ -3549,7 +3544,7 @@
 	  value -= (input_section->output_section->vma
 		    + input_section->output_offset
 		    + rel->r_offset) & ~ (bfd_vma) 0x3;
-	  r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type);
+	  r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
 	  break;
 
 	case R_IA64_SEGREL32MSB:
@@ -3592,7 +3587,7 @@
 		  value -= p->p_vaddr;
 		else
 		  value = 0;
-		r = elf64_ia64_install_value (output_bfd, hit_addr, value,
+		r = elfNN_ia64_install_value (output_bfd, hit_addr, value,
 					      r_type);
 	      }
 	    break;
@@ -3607,26 +3602,52 @@
 	    value -= input_section->output_section->vma;
 	  else
 	    value = 0;
-	  r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type);
+	  r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
 	  break;
 
-	case R_IA64_SEGBASE:
-
-	case R_IA64_REL32MSB:
-	case R_IA64_REL32LSB:
-	case R_IA64_REL64MSB:
-	case R_IA64_REL64LSB:
-
 	case R_IA64_IPLTMSB:
 	case R_IA64_IPLTLSB:
-	case R_IA64_EPLTMSB:
-	case R_IA64_EPLTLSB:
-	case R_IA64_COPY:
+	  /* Install a dynamic relocation for this reloc.  */
+	  if ((dynamic_symbol_p || info->shared)
+	      && (input_section->flags & SEC_ALLOC) != 0)
+	    {
+	      BFD_ASSERT (srel != NULL);
 
-	case R_IA64_TPREL22:
-	case R_IA64_TPREL64MSB:
-	case R_IA64_TPREL64LSB:
-	case R_IA64_LTOFF_TP22:
+	      /* If we don't need dynamic symbol lookup, install two
+		 RELATIVE relocations.  */
+	      if (! dynamic_symbol_p)
+		{
+		  unsigned int dyn_r_type;
+		
+		  if (r_type == R_IA64_IPLTMSB)
+		    dyn_r_type = R_IA64_REL64MSB;
+		  else
+		    dyn_r_type = R_IA64_REL64LSB;
+
+		  elfNN_ia64_install_dyn_reloc (output_bfd, info,
+						input_section,
+						srel, rel->r_offset,
+						dyn_r_type, 0, value);
+		  elfNN_ia64_install_dyn_reloc (output_bfd, info,
+						input_section,
+						srel, rel->r_offset + 8,
+						dyn_r_type, 0, gp_val);
+		}
+	      else
+		elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section,
+					      srel, rel->r_offset, r_type,
+					      h->dynindx, rel->r_addend);
+	    }
+
+	  if (r_type == R_IA64_IPLTMSB)
+	    r_type = R_IA64_DIR64MSB;
+	  else
+	    r_type = R_IA64_DIR64LSB;
+	  elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type);
+	  r = elfNN_ia64_install_value (output_bfd, hit_addr + 8, gp_val,
+					r_type);
+	  break;
+
 	default:
 	  r = bfd_reloc_notsupported;
 	  break;
@@ -3704,16 +3725,16 @@
 }
 
 static boolean
-elf64_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
+elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
      bfd *output_bfd;
      struct bfd_link_info *info;
      struct elf_link_hash_entry *h;
      Elf_Internal_Sym *sym;
 {
-  struct elf64_ia64_link_hash_table *ia64_info;
-  struct elf64_ia64_dyn_sym_info *dyn_i;
+  struct elfNN_ia64_link_hash_table *ia64_info;
+  struct elfNN_ia64_dyn_sym_info *dyn_i;
 
-  ia64_info = elf64_ia64_hash_table (info);
+  ia64_info = elfNN_ia64_hash_table (info);
   dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, false);
 
   /* Fill in the PLT data, if required.  */
@@ -3723,7 +3744,7 @@
       bfd_byte *loc;
       asection *plt_sec;
       bfd_vma plt_addr, pltoff_addr, gp_val, index;
-      Elf64_External_Rela *rel;
+      ElfNN_External_Rela *rel;
 
       gp_val = _bfd_get_gp_value (output_bfd);
 
@@ -3734,8 +3755,8 @@
       loc = plt_sec->contents + dyn_i->plt_offset;
 
       memcpy (loc, plt_min_entry, PLT_MIN_ENTRY_SIZE);
-      elf64_ia64_install_value (output_bfd, loc, index, R_IA64_IMM22);
-      elf64_ia64_install_value (output_bfd, loc+2, -dyn_i->plt_offset,
+      elfNN_ia64_install_value (output_bfd, loc, index, R_IA64_IMM22);
+      elfNN_ia64_install_value (output_bfd, loc+2, -dyn_i->plt_offset,
 				R_IA64_PCREL21B);
 
       plt_addr = (plt_sec->output_section->vma
@@ -3749,7 +3770,7 @@
 	  loc = plt_sec->contents + dyn_i->plt2_offset;
 
 	  memcpy (loc, plt_full_entry, PLT_FULL_ENTRY_SIZE);
-	  elf64_ia64_install_value (output_bfd, loc, pltoff_addr - gp_val,
+	  elfNN_ia64_install_value (output_bfd, loc, pltoff_addr - gp_val,
 				    R_IA64_IMM22);
 
 	  /* Mark the symbol as undefined, rather than as defined in the
@@ -3763,9 +3784,9 @@
       /* Create the dynamic relocation.  */
       outrel.r_offset = pltoff_addr;
       if (bfd_little_endian (output_bfd))
-	outrel.r_info = ELF64_R_INFO (h->dynindx, R_IA64_IPLTLSB);
+	outrel.r_info = ELFNN_R_INFO (h->dynindx, R_IA64_IPLTLSB);
       else
-	outrel.r_info = ELF64_R_INFO (h->dynindx, R_IA64_IPLTMSB);
+	outrel.r_info = ELFNN_R_INFO (h->dynindx, R_IA64_IPLTMSB);
       outrel.r_addend = 0;
 
       /* This is fun.  In the .IA_64.pltoff section, we've got entries
@@ -3780,10 +3801,10 @@
 	 existing sec->reloc_count to be the base of the array of
 	 PLT relocations.  */
 
-      rel = (Elf64_External_Rela *)ia64_info->rel_pltoff_sec->contents;
+      rel = (ElfNN_External_Rela *)ia64_info->rel_pltoff_sec->contents;
       rel += ia64_info->rel_pltoff_sec->reloc_count;
 
-      bfd_elf64_swap_reloca_out (output_bfd, &outrel, rel + index);
+      bfd_elfNN_swap_reloca_out (output_bfd, &outrel, rel + index);
     }
 
   /* Mark some specially defined symbols as absolute.  */
@@ -3796,37 +3817,35 @@
 }
 
 static boolean
-elf64_ia64_finish_dynamic_sections (abfd, info)
+elfNN_ia64_finish_dynamic_sections (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
-  struct elf64_ia64_link_hash_table *ia64_info;
+  struct elfNN_ia64_link_hash_table *ia64_info;
   bfd *dynobj;
 
-  ia64_info = elf64_ia64_hash_table (info);
+  ia64_info = elfNN_ia64_hash_table (info);
   dynobj = ia64_info->root.dynobj;
 
   if (elf_hash_table (info)->dynamic_sections_created)
     {
-      Elf64_External_Dyn *dyncon, *dynconend;
+      ElfNN_External_Dyn *dyncon, *dynconend;
       asection *sdyn, *sgotplt;
       bfd_vma gp_val;
 
       sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
       sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
       BFD_ASSERT (sdyn != NULL);
-      dyncon = (Elf64_External_Dyn *) sdyn->contents;
-      dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+      dyncon = (ElfNN_External_Dyn *) sdyn->contents;
+      dynconend = (ElfNN_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
 
       gp_val = _bfd_get_gp_value (abfd);
 
       for (; dyncon < dynconend; dyncon++)
 	{
 	  Elf_Internal_Dyn dyn;
-	  const char *name;
-	  asection *s;
 
-	  bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn);
+	  bfd_elfNN_swap_dyn_in (dynobj, dyncon, &dyn);
 
 	  switch (dyn.d_tag)
 	    {
@@ -3836,7 +3855,7 @@
 
 	    case DT_PLTRELSZ:
 	      dyn.d_un.d_val = (ia64_info->minplt_entries
-				* sizeof (Elf64_External_Rela));
+				* sizeof (ElfNN_External_Rela));
 	      break;
 
 	    case DT_JMPREL:
@@ -3844,7 +3863,7 @@
 	      dyn.d_un.d_ptr = (ia64_info->rel_pltoff_sec->output_section->vma
 				+ ia64_info->rel_pltoff_sec->output_offset
 				+ (ia64_info->rel_pltoff_sec->reloc_count
-				   * sizeof (Elf64_External_Rela)));
+				   * sizeof (ElfNN_External_Rela)));
 	      break;
 
 	    case DT_IA_64_PLT_RESERVE:
@@ -3856,30 +3875,11 @@
 	      /* Do not have RELASZ include JMPREL.  This makes things
 		 easier on ld.so.  This is not what the rest of BFD set up. */
 	      dyn.d_un.d_val -= (ia64_info->minplt_entries
-				 * sizeof (Elf64_External_Rela));
+				 * sizeof (ElfNN_External_Rela));
 	      break;
-
-	    case DT_INIT:
-	    case DT_FINI:
-	      {
-		struct elf_link_hash_entry *h;
-		struct elf64_ia64_dyn_sym_info *dyn_i;
-		const char *which;
- 
-		if (dyn.d_tag == DT_INIT)
-		  which = info->init_function;
-		else
-		  which = info->fini_function;
-
-		h = elf_link_hash_lookup (elf_hash_table (info), which,
-					  false, false, false);
-		dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, false);
-		dyn.d_un.d_ptr = set_pltoff_entry (abfd, info, dyn_i,
-						   dyn.d_un.d_ptr, 0);
-	      }
 	    }
 
-	  bfd_elf64_swap_dyn_out (abfd, &dyn, dyncon);
+	  bfd_elfNN_swap_dyn_out (abfd, &dyn, dyncon);
 	}
 
       /* Initialize the PLT0 entry */
@@ -3894,7 +3894,7 @@
 		    + sgotplt->output_offset
 		    - gp_val);
 
-	  elf64_ia64_install_value (abfd, loc+1, pltres, R_IA64_GPREL22);
+	  elfNN_ia64_install_value (abfd, loc+1, pltres, R_IA64_GPREL22);
 	}
     }
 
@@ -3905,7 +3905,7 @@
 
 /* Function to keep IA-64 specific file flags. */
 static boolean
-elf64_ia64_set_private_flags (abfd, flags)
+elfNN_ia64_set_private_flags (abfd, flags)
      bfd *abfd;
      flagword flags;
 {
@@ -3919,7 +3919,7 @@
 
 /* Copy backend specific data from one object module to another */
 static boolean
-elf64_ia64_copy_private_bfd_data (ibfd, obfd)
+elfNN_ia64_copy_private_bfd_data (ibfd, obfd)
      bfd *ibfd, *obfd;
 {
   if (   bfd_get_flavour (ibfd) != bfd_target_elf_flavour
@@ -3938,7 +3938,7 @@
 /* Merge backend specific data from an object file to the output
    object file when linking.  */
 static boolean
-elf64_ia64_merge_private_bfd_data (ibfd, obfd)
+elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
      bfd *ibfd, *obfd;
 {
   flagword out_flags;
@@ -3972,6 +3972,10 @@
   if (in_flags == out_flags)
     return true;
 
+  /* Output has EF_IA_64_REDUCEDFP set only if all inputs have it set.  */
+  if (!(in_flags & EF_IA_64_REDUCEDFP) && (out_flags & EF_IA_64_REDUCEDFP))
+    elf_elfheader (obfd)->e_flags &= ~EF_IA_64_REDUCEDFP;
+
   if ((in_flags & EF_IA_64_TRAPNIL) != (out_flags & EF_IA_64_TRAPNIL))
     {
       (*_bfd_error_handler)
@@ -3999,12 +4003,31 @@
       bfd_set_error (bfd_error_bad_value);
       ok = false;
     }
+  if ((in_flags & EF_IA_64_CONS_GP) != (out_flags & EF_IA_64_CONS_GP))
+    {
+      (*_bfd_error_handler)
+	(_("%s: linking constant-gp files with non-constant-gp files"),
+	 bfd_get_filename (ibfd));
+
+      bfd_set_error (bfd_error_bad_value);
+      ok = false;
+    }
+  if ((in_flags & EF_IA_64_NOFUNCDESC_CONS_GP)
+      != (out_flags & EF_IA_64_NOFUNCDESC_CONS_GP))
+    {
+      (*_bfd_error_handler)
+	(_("%s: linking auto-pic files with non-auto-pic files"),
+	 bfd_get_filename (ibfd));
+
+      bfd_set_error (bfd_error_bad_value);
+      ok = false;
+    }
 
   return ok;
 }
 
 static boolean
-elf64_ia64_print_private_bfd_data (abfd, ptr)
+elfNN_ia64_print_private_bfd_data (abfd, ptr)
      bfd *abfd;
      PTR ptr;
 {
@@ -4013,19 +4036,24 @@
 
   BFD_ASSERT (abfd != NULL && ptr != NULL);
 
-  fprintf (file, "private flags = %s%s%s%s\n",
+  fprintf (file, "private flags = %s%s%s%s%s%s%s%s\n",
 	   (flags & EF_IA_64_TRAPNIL) ? "TRAPNIL, " : "",
 	   (flags & EF_IA_64_EXT) ? "EXT, " : "",
 	   (flags & EF_IA_64_BE) ? "BE, " : "LE, ",
+	   (flags & EF_IA_64_REDUCEDFP) ? "REDUCEDFP, " : "",
+	   (flags & EF_IA_64_CONS_GP) ? "CONS_GP, " : "",
+	   (flags & EF_IA_64_NOFUNCDESC_CONS_GP) ? "NOFUNCDESC_CONS_GP, " : "",
+	   (flags & EF_IA_64_ABSOLUTE) ? "ABSOLUTE, " : "",
 	   (flags & EF_IA_64_ABI64) ? "ABI64" : "ABI32");
+  
   _bfd_elf_print_private_bfd_data (abfd, ptr);
   return true;
 }
 
-#define TARGET_LITTLE_SYM		bfd_elf64_ia64_little_vec
-#define TARGET_LITTLE_NAME		"elf64-ia64-little"
-#define TARGET_BIG_SYM			bfd_elf64_ia64_big_vec
-#define TARGET_BIG_NAME			"elf64-ia64-big"
+#define TARGET_LITTLE_SYM		bfd_elfNN_ia64_little_vec
+#define TARGET_LITTLE_NAME		"elfNN-ia64-little"
+#define TARGET_BIG_SYM			bfd_elfNN_ia64_big_vec
+#define TARGET_BIG_NAME			"elfNN-ia64-big"
 #define ELF_ARCH			bfd_arch_ia64
 #define ELF_MACHINE_CODE		EM_IA_64
 #define ELF_MACHINE_ALT1		1999	/* EAS2.3 */
@@ -4033,53 +4061,55 @@
 #define ELF_MAXPAGESIZE			0x10000	/* 64KB */
 
 #define elf_backend_section_from_shdr \
-	elf64_ia64_section_from_shdr
+	elfNN_ia64_section_from_shdr
+#define elf_backend_section_flags \
+	elfNN_ia64_section_flags
 #define elf_backend_fake_sections \
-	elf64_ia64_fake_sections
+	elfNN_ia64_fake_sections
 #define elf_backend_add_symbol_hook \
-	elf64_ia64_add_symbol_hook
+	elfNN_ia64_add_symbol_hook
 #define elf_backend_additional_program_headers \
-	elf64_ia64_additional_program_headers
+	elfNN_ia64_additional_program_headers
 #define elf_backend_modify_segment_map \
-	elf64_ia64_modify_segment_map
+	elfNN_ia64_modify_segment_map
 #define elf_info_to_howto \
-	elf64_ia64_info_to_howto
+	elfNN_ia64_info_to_howto
 
-#define bfd_elf64_bfd_reloc_type_lookup \
-	elf64_ia64_reloc_type_lookup
-#define bfd_elf64_bfd_is_local_label_name \
-	elf64_ia64_is_local_label_name
-#define bfd_elf64_bfd_relax_section \
-	elf64_ia64_relax_section
+#define bfd_elfNN_bfd_reloc_type_lookup \
+	elfNN_ia64_reloc_type_lookup
+#define bfd_elfNN_bfd_is_local_label_name \
+	elfNN_ia64_is_local_label_name
+#define bfd_elfNN_bfd_relax_section \
+	elfNN_ia64_relax_section
 
 /* Stuff for the BFD linker: */
-#define bfd_elf64_bfd_link_hash_table_create \
-	elf64_ia64_hash_table_create
+#define bfd_elfNN_bfd_link_hash_table_create \
+	elfNN_ia64_hash_table_create
 #define elf_backend_create_dynamic_sections \
-	elf64_ia64_create_dynamic_sections
+	elfNN_ia64_create_dynamic_sections
 #define elf_backend_check_relocs \
-	elf64_ia64_check_relocs
+	elfNN_ia64_check_relocs
 #define elf_backend_adjust_dynamic_symbol \
-	elf64_ia64_adjust_dynamic_symbol
+	elfNN_ia64_adjust_dynamic_symbol
 #define elf_backend_size_dynamic_sections \
-	elf64_ia64_size_dynamic_sections
+	elfNN_ia64_size_dynamic_sections
 #define elf_backend_relocate_section \
-	elf64_ia64_relocate_section
+	elfNN_ia64_relocate_section
 #define elf_backend_finish_dynamic_symbol \
-	elf64_ia64_finish_dynamic_symbol
+	elfNN_ia64_finish_dynamic_symbol
 #define elf_backend_finish_dynamic_sections \
-	elf64_ia64_finish_dynamic_sections
-#define bfd_elf64_bfd_final_link \
-	elf64_ia64_final_link
+	elfNN_ia64_finish_dynamic_sections
+#define bfd_elfNN_bfd_final_link \
+	elfNN_ia64_final_link
 
-#define bfd_elf64_bfd_copy_private_bfd_data \
-	elf64_ia64_copy_private_bfd_data
-#define bfd_elf64_bfd_merge_private_bfd_data \
-	elf64_ia64_merge_private_bfd_data
-#define bfd_elf64_bfd_set_private_flags \
-	elf64_ia64_set_private_flags
-#define bfd_elf64_bfd_print_private_bfd_data \
-	elf64_ia64_print_private_bfd_data
+#define bfd_elfNN_bfd_copy_private_bfd_data \
+	elfNN_ia64_copy_private_bfd_data
+#define bfd_elfNN_bfd_merge_private_bfd_data \
+	elfNN_ia64_merge_private_bfd_data
+#define bfd_elfNN_bfd_set_private_flags \
+	elfNN_ia64_set_private_flags
+#define bfd_elfNN_bfd_print_private_bfd_data \
+	elfNN_ia64_print_private_bfd_data
 
 #define elf_backend_plt_readonly	1
 #define elf_backend_want_plt_sym	0
@@ -4091,7 +4121,7 @@
 #define elf_backend_may_use_rela_p	1
 #define elf_backend_default_use_rela_p	1
 #define elf_backend_want_dynbss		0
-#define elf_backend_copy_indirect_symbol elf64_ia64_hash_copy_indirect
-#define elf_backend_hide_symbol		elf64_ia64_hash_hide_symbol
+#define elf_backend_copy_indirect_symbol elfNN_ia64_hash_copy_indirect
+#define elf_backend_hide_symbol		elfNN_ia64_hash_hide_symbol
 
-#include "elf64-target.h"
+#include "elfNN-target.h"
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index b1f4867..6957e3a 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -237,6 +237,9 @@
 #ifndef elf_backend_section_from_shdr
 #define elf_backend_section_from_shdr	0
 #endif
+#ifndef elf_backend_section_flags
+#define elf_backend_section_flags	0
+#endif
 #ifndef elf_backend_section_from_phdr
 #define elf_backend_section_from_phdr	0
 #endif
@@ -313,7 +316,6 @@
 #define elf_backend_hide_symbol		_bfd_elf_link_hash_hide_symbol
 #endif
 
-
 /* Previously, backends could only use SHT_REL or SHT_RELA relocation
    sections, but not both.  They defined USE_REL to indicate SHT_REL
    sections, and left it undefined to indicated SHT_RELA sections.
@@ -354,6 +356,7 @@
 
 extern const struct elf_size_info _bfd_elfNN_size_info;
 
+#ifndef INCLUDED_TARGET_FILE
 static CONST struct elf_backend_data elfNN_bed =
 {
   ELF_ARCH,			/* arch */
@@ -368,6 +371,7 @@
   elf_backend_get_symbol_type,
   elf_backend_section_processing,
   elf_backend_section_from_shdr,
+  elf_backend_section_flags,
   elf_backend_section_from_phdr,
   elf_backend_fake_sections,
   elf_backend_section_from_bfd_section,
@@ -413,6 +417,7 @@
   elf_backend_can_gc_sections,
   elf_backend_want_dynbss
 };
+#endif
 
 /* Forward declaration for use when initialising alternative_target field.  */
 #ifdef TARGET_LITTLE_SYM
diff --git a/bfd/epoc-pe-arm.c b/bfd/epoc-pe-arm.c
index 48a277a..02eeb04 100644
--- a/bfd/epoc-pe-arm.c
+++ b/bfd/epoc-pe-arm.c
@@ -32,5 +32,6 @@
 #define bfd_arm_process_before_allocation \
 	bfd_arm_epoc_pe_process_before_allocation
 
-#include "pe-arm.c"
+#define EXTRA_S_FLAGS (SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_CODE | SEC_READONLY | SEC_DATA)
 
+#include "pe-arm.c"
diff --git a/bfd/epoc-pei-arm.c b/bfd/epoc-pei-arm.c
index 0f2548d..58c77df 100644
--- a/bfd/epoc-pei-arm.c
+++ b/bfd/epoc-pei-arm.c
@@ -25,5 +25,6 @@
 #define TARGET_BIG_SYM       arm_epoc_pei_big_vec
 #define TARGET_BIG_NAME      "epoc-pei-arm-big"
 
-#include "pei-arm.c"
+#define EXTRA_S_FLAGS (SEC_CODE | SEC_READONLY | SEC_DATA)
 
+#include "pei-arm.c"
diff --git a/bfd/format.c b/bfd/format.c
index c9f1f9c..714778c 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -125,20 +125,20 @@
 
   if (!bfd_read_p (abfd) ||
       ((int)(abfd->format) < (int)bfd_unknown) ||
-      ((int)(abfd->format) >= (int)bfd_type_end)) {
-    bfd_set_error (bfd_error_invalid_operation);
-    return false;
-  }
+      ((int)(abfd->format) >= (int)bfd_type_end))
+    {
+      bfd_set_error (bfd_error_invalid_operation);
+      return false;
+    }
 
   if (abfd->format != bfd_unknown)
     return (abfd->format == format)? true: false;
 
-
   /* Since the target type was defaulted, check them 
      all in the hope that one will be uniquely recognized.  */
-
   save_targ = abfd->xvec;
   match_count = 0;
+  
   if (matching)
     {
       matching_vector =
@@ -149,119 +149,147 @@
       matching_vector[0] = NULL;
       *matching = matching_vector;
     }
+  
   right_targ = 0;
 
-
-  /* presume the answer is yes */
+  /* Presume the answer is yes.  */
   abfd->format = format;
 
   /* If the target type was explicitly specified, just check that target.  */
+  if (!abfd->target_defaulted)
+    {
+      if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0)	/* rewind! */
+	return false;
+      
+      right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
+      
+      if (right_targ)
+	{
+	  abfd->xvec = right_targ;	/* Set the target as returned.  */
+	  
+	  if (matching)
+	    free (matching_vector);
+	  
+	  return true;			/* File position has moved, BTW.  */
+	}
 
-  if (!abfd->target_defaulted) {
-    if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0)	/* rewind! */
-      return false;
-    right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
-    if (right_targ) {
-      abfd->xvec = right_targ;		/* Set the target as returned */
-      if (matching)
-	free (matching_vector);
-      return true;			/* File position has moved, BTW */
+      /* For a long time the code has dropped through to check all
+	 targets if the specified target was wrong.  I don't know why,
+	 and I'm reluctant to change it.  However, in the case of an
+	 archive, it can cause problems.  If the specified target does
+	 not permit archives (e.g., the binary target), then we should
+	 not allow some other target to recognize it as an archive, but
+	 should instead allow the specified target to recognize it as an
+	 object.  When I first made this change, it broke the PE target,
+	 because the specified pei-i386 target did not recognize the
+	 actual pe-i386 archive.  Since there may be other problems of
+	 this sort, I changed this test to check only for the binary
+	 target.  */
+      if (format == bfd_archive && save_targ == &binary_vec)
+	{
+	  abfd->xvec = save_targ;
+	  abfd->format = bfd_unknown;
+	  
+	  if (matching)
+	    free (matching_vector);
+	  
+	  bfd_set_error (bfd_error_file_not_recognized);
+	  
+	  return false;
+	}
     }
 
-    /* For a long time the code has dropped through to check all
-       targets if the specified target was wrong.  I don't know why,
-       and I'm reluctant to change it.  However, in the case of an
-       archive, it can cause problems.  If the specified target does
-       not permit archives (e.g., the binary target), then we should
-       not allow some other target to recognize it as an archive, but
-       should instead allow the specified target to recognize it as an
-       object.  When I first made this change, it broke the PE target,
-       because the specified pei-i386 target did not recognize the
-       actual pe-i386 archive.  Since there may be other problems of
-       this sort, I changed this test to check only for the binary
-       target.  */
-
-    if (format == bfd_archive && save_targ == &binary_vec)
-      {
-	abfd->xvec = save_targ;
-	abfd->format = bfd_unknown;
-	if (matching)
-	  free (matching_vector);
-	bfd_set_error (bfd_error_file_not_recognized);
+  for (target = bfd_target_vector; *target != NULL; target++)
+    {
+      const bfd_target *temp;
+      
+      if (*target == &binary_vec)
+	continue;
+      
+      abfd->xvec = *target;	/* Change BFD's target temporarily */
+      
+      if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0)
 	return false;
-      }
-  }
+      
+      /* If _bfd_check_format neglects to set bfd_error, assume
+	 bfd_error_wrong_format.  We didn't used to even pay any
+	 attention to bfd_error, so I suspect that some
+	 _bfd_check_format might have this problem.  */
+      bfd_set_error (bfd_error_wrong_format);
 
-  for (target = bfd_target_vector; *target != NULL; target++) {
-    const bfd_target *temp;
-
-    if (*target == &binary_vec)
-      continue;
-
-    abfd->xvec = *target;	/* Change BFD's target temporarily */
-    if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0)
-      return false;
-    /* If _bfd_check_format neglects to set bfd_error, assume bfd_error_wrong_format.
-       We didn't used to even pay any attention to bfd_error, so I suspect
-       that some _bfd_check_format might have this problem.  */
-    bfd_set_error (bfd_error_wrong_format);
-    temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
-    if (temp) {				/* This format checks out as ok! */
-      right_targ = temp;
-      if (matching)
-	{
-	  matching_vector[match_count] = temp->name;
-	  matching_vector[match_count + 1] = NULL;
-	}
-      match_count++;
-      /* If this is the default target, accept it, even if other targets
-	 might match.  People who want those other targets have to set 
-	 the GNUTARGET variable.  */
-      if (temp == bfd_default_vector[0])
-	{
+      temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
+      
+      if (temp)
+	{		/* This format checks out as ok!  */
+	  right_targ = temp;
+	  
 	  if (matching)
 	    {
-	      matching_vector[0] = temp->name;
-	      matching_vector[1] = NULL;
+	      matching_vector[match_count] = temp->name;
+	      matching_vector[match_count + 1] = NULL;
 	    }
-	  match_count = 1;
-	  break;
-	}
+	  
+	  match_count++;
+	  
+	  /* If this is the default target, accept it, even if other
+	     targets might match.  People who want those other targets
+	     have to set the GNUTARGET variable.  */
+	  if (temp == bfd_default_vector[0])
+	    {
+	      if (matching)
+		{
+		  matching_vector[0] = temp->name;
+		  matching_vector[1] = NULL;
+		}
+	      match_count = 1;
+	      break;
+	    }
 #ifdef GNU960
-      /* Big- and little-endian b.out archives look the same, but it doesn't
-       * matter: there is no difference in their headers, and member file byte
-       * orders will (I hope) be handled appropriately by bfd.  Ditto for big
-       * and little coff archives.  And the 4 coff/b.out object formats are
-       * unambiguous.  So accept the first match we find.
-       */
-      break;
+	  /* Big- and little-endian b.out archives look the same, but it
+	     doesn't matter: there is no difference in their headers, and
+	     member file byte orders will (I hope) be handled appropriately
+	     by bfd.  Ditto for big and little coff archives.  And the 4
+	     coff/b.out object formats are unambiguous.  So accept the
+	     first match we find.  */
+	  break;
 #endif
-    } else if (bfd_get_error () != bfd_error_wrong_format) {
-      abfd->xvec = save_targ;
-      abfd->format = bfd_unknown;
-      if (matching && bfd_get_error () != bfd_error_file_ambiguously_recognized)
-	free (matching_vector);
-      return false;
+	}
+      else if (bfd_get_error () != bfd_error_wrong_format)
+	{
+	  abfd->xvec = save_targ;
+	  abfd->format = bfd_unknown;
+	  
+	  if (matching && bfd_get_error ()
+	      != bfd_error_file_ambiguously_recognized)
+	    free (matching_vector);
+	  
+	  return false;
+	}
     }
-  }
+  
+  if (match_count == 1)
+    {
+      abfd->xvec = right_targ;		/* Change BFD's target permanently.  */
+      
+      if (matching)
+	free (matching_vector);
+      
+      return true;			/* File position has moved, BTW.  */
+    }
 
-  if (match_count == 1) {
-    abfd->xvec = right_targ;		/* Change BFD's target permanently */
-    if (matching)
-      free (matching_vector);
-    return true;			/* File position has moved, BTW */
-  }
-
-  abfd->xvec = save_targ;		/* Restore original target type */
-  abfd->format = bfd_unknown;		/* Restore original format */
+  abfd->xvec = save_targ;		/* Restore original target type.  */
+  abfd->format = bfd_unknown;		/* Restore original format.  */
+  
   if (match_count == 0)
     {
       bfd_set_error (bfd_error_file_not_recognized);
+      
       if (matching)
 	free (matching_vector);
     }
   else
     bfd_set_error (bfd_error_file_ambiguously_recognized);
+  
   return false;
 }
 
@@ -277,7 +305,6 @@
 	format @var{format}. If the target set in the BFD does not
 	support the format requested, the format is invalid, or the BFD
 	is not open for writing, then an error occurs.
-
 */
 
 boolean
@@ -285,24 +312,25 @@
      bfd *abfd;
      bfd_format format;
 {
-
   if (bfd_read_p (abfd) ||
       ((int)abfd->format < (int)bfd_unknown) ||
-      ((int)abfd->format >= (int)bfd_type_end)) {
-    bfd_set_error (bfd_error_invalid_operation);
-    return false;
-  }
+      ((int)abfd->format >= (int)bfd_type_end))
+    {
+      bfd_set_error (bfd_error_invalid_operation);
+      return false;
+    }
 
   if (abfd->format != bfd_unknown)
-    return (abfd->format == format) ? true:false;
+    return (abfd->format == format) ? true : false;
 
-  /* presume the answer is yes */
+  /* Presume the answer is yes.  */
   abfd->format = format;
 
-  if (!BFD_SEND_FMT (abfd, _bfd_set_format, (abfd))) {
-    abfd->format = bfd_unknown;
-    return false;
-  }
+  if (!BFD_SEND_FMT (abfd, _bfd_set_format, (abfd)))
+    {
+      abfd->format = bfd_unknown;
+      return false;
+    }
 
   return true;
 }
@@ -329,14 +357,15 @@
       || ((int)format >=(int) bfd_type_end)) 
     return "invalid";
   
-  switch (format) {
-  case bfd_object:
-    return "object";		/* linker/assember/compiler output */
-  case bfd_archive: 
-    return "archive";		/* object archive file */
-  case bfd_core: 
-    return "core";		/* core dump */
-  default: 
-    return "unknown";
-  }
+  switch (format)
+    {
+    case bfd_object:
+      return "object";		/* Linker/assember/compiler output.  */
+    case bfd_archive: 
+      return "archive";		/* Object archive file.  */
+    case bfd_core: 
+      return "core";		/* Core dump.  */
+    default: 
+      return "unknown";
+    }
 }
diff --git a/bfd/go32stub.h b/bfd/go32stub.h
index 3e4388c..333eec0 100644
--- a/bfd/go32stub.h
+++ b/bfd/go32stub.h
@@ -1,128 +1,128 @@
 0x4d,0x5a,0x00,0x00,0x04,0x00,0x00,0x00,0x20,0x00,0x27,0x00,0xff,0xff,0x00,0x00,
-0x60,0x07,0x00,0x00,0x54,0x00,0x00,0x00,0x0d,0x0a,0x73,0x74,0x75,0x62,0x2e,0x68,
-0x20,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x64,0x20,0x66,0x72,0x6f,0x6d,0x20,
-0x73,0x74,0x75,0x62,0x2e,0x61,0x73,0x6d,0x20,0x62,0x79,0x20,0x64,0x6a,0x61,0x73,
-0x6d,0x2c,0x20,0x6f,0x6e,0x20,0x57,0x65,0x64,0x20,0x4a,0x75,0x6e,0x20,0x31,0x31,
-0x20,0x31,0x36,0x3a,0x30,0x39,0x3a,0x31,0x35,0x20,0x31,0x39,0x39,0x37,0x0d,0x0a,
-0x54,0x68,0x65,0x20,0x53,0x54,0x55,0x42,0x2e,0x45,0x58,0x45,0x20,0x73,0x74,0x75,
-0x62,0x20,0x6c,0x6f,0x61,0x64,0x65,0x72,0x20,0x69,0x73,0x20,0x43,0x6f,0x70,0x79,
-0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x43,0x29,0x20,0x31,0x39,0x39,0x33,0x2d,0x31,
-0x39,0x39,0x35,0x20,0x44,0x4a,0x20,0x44,0x65,0x6c,0x6f,0x72,0x69,0x65,0x2e,0x20,
-0x0d,0x0a,0x50,0x65,0x72,0x6d,0x69,0x73,0x73,0x69,0x6f,0x6e,0x20,0x67,0x72,0x61,
-0x6e,0x74,0x65,0x64,0x20,0x74,0x6f,0x20,0x75,0x73,0x65,0x20,0x66,0x6f,0x72,0x20,
-0x61,0x6e,0x79,0x20,0x70,0x75,0x72,0x70,0x6f,0x73,0x65,0x20,0x70,0x72,0x6f,0x76,
-0x69,0x64,0x65,0x64,0x20,0x74,0x68,0x69,0x73,0x20,0x63,0x6f,0x70,0x79,0x72,0x69,
-0x67,0x68,0x74,0x20,0x0d,0x0a,0x72,0x65,0x6d,0x61,0x69,0x6e,0x73,0x20,0x70,0x72,
-0x65,0x73,0x65,0x6e,0x74,0x20,0x61,0x6e,0x64,0x20,0x75,0x6e,0x6d,0x6f,0x64,0x69,
-0x66,0x69,0x65,0x64,0x2e,0x20,0x0d,0x0a,0x54,0x68,0x69,0x73,0x20,0x6f,0x6e,0x6c,
-0x79,0x20,0x61,0x70,0x70,0x6c,0x69,0x65,0x73,0x20,0x74,0x6f,0x20,0x74,0x68,0x65,
-0x20,0x73,0x74,0x75,0x62,0x2c,0x20,0x61,0x6e,0x64,0x20,0x6e,0x6f,0x74,0x20,0x6e,
-0x65,0x63,0x63,0x65,0x73,0x73,0x61,0x72,0x69,0x6c,0x79,0x20,0x74,0x68,0x65,0x20,
-0x77,0x68,0x6f,0x6c,0x65,0x20,0x70,0x72,0x6f,0x67,0x72,0x61,0x6d,0x2e,0x0a,0x0d,
-0x0a,0x24,0x49,0x64,0x3a,0x20,0x73,0x74,0x75,0x62,0x2e,0x61,0x73,0x6d,0x20,0x62,
-0x75,0x69,0x6c,0x74,0x20,0x30,0x36,0x2f,0x31,0x31,0x2f,0x39,0x37,0x20,0x31,0x36,
-0x3a,0x30,0x39,0x3a,0x31,0x35,0x20,0x62,0x79,0x20,0x64,0x6a,0x61,0x73,0x6d,0x20,
-0x24,0x0a,0x0d,0x0a,0x40,0x28,0x23,0x29,0x20,0x73,0x74,0x75,0x62,0x2e,0x61,0x73,
-0x6d,0x20,0x62,0x75,0x69,0x6c,0x74,0x20,0x30,0x36,0x2f,0x31,0x31,0x2f,0x39,0x37,
-0x20,0x31,0x36,0x3a,0x30,0x39,0x3a,0x31,0x35,0x20,0x62,0x79,0x20,0x64,0x6a,0x61,
-0x73,0x6d,0x0a,0x0d,0x0a,0x1a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x60,0x07,0x00,0x00,0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0d,0x0a,0x73,0x74,
+0x75,0x62,0x2e,0x68,0x20,0x67,0x65,0x6e,0x65,0x72,0x61,0x74,0x65,0x64,0x20,0x66,
+0x72,0x6f,0x6d,0x20,0x73,0x74,0x75,0x62,0x2e,0x61,0x73,0x6d,0x20,0x62,0x79,0x20,
+0x64,0x6a,0x61,0x73,0x6d,0x2c,0x20,0x6f,0x6e,0x20,0x57,0x65,0x64,0x20,0x4a,0x75,
+0x6e,0x20,0x32,0x38,0x20,0x31,0x31,0x3a,0x31,0x35,0x3a,0x30,0x34,0x20,0x32,0x30,
+0x30,0x30,0x0d,0x0a,0x54,0x68,0x65,0x20,0x53,0x54,0x55,0x42,0x2e,0x45,0x58,0x45,
+0x20,0x73,0x74,0x75,0x62,0x20,0x6c,0x6f,0x61,0x64,0x65,0x72,0x20,0x69,0x73,0x20,
+0x43,0x6f,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x43,0x29,0x20,0x31,0x39,
+0x39,0x33,0x2d,0x31,0x39,0x39,0x35,0x20,0x44,0x4a,0x20,0x44,0x65,0x6c,0x6f,0x72,
+0x69,0x65,0x2e,0x20,0x0d,0x0a,0x50,0x65,0x72,0x6d,0x69,0x73,0x73,0x69,0x6f,0x6e,
+0x20,0x67,0x72,0x61,0x6e,0x74,0x65,0x64,0x20,0x74,0x6f,0x20,0x75,0x73,0x65,0x20,
+0x66,0x6f,0x72,0x20,0x61,0x6e,0x79,0x20,0x70,0x75,0x72,0x70,0x6f,0x73,0x65,0x20,
+0x70,0x72,0x6f,0x76,0x69,0x64,0x65,0x64,0x20,0x74,0x68,0x69,0x73,0x20,0x63,0x6f,
+0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x0d,0x0a,0x72,0x65,0x6d,0x61,0x69,0x6e,
+0x73,0x20,0x70,0x72,0x65,0x73,0x65,0x6e,0x74,0x20,0x61,0x6e,0x64,0x20,0x75,0x6e,
+0x6d,0x6f,0x64,0x69,0x66,0x69,0x65,0x64,0x2e,0x20,0x0d,0x0a,0x54,0x68,0x69,0x73,
+0x20,0x6f,0x6e,0x6c,0x79,0x20,0x61,0x70,0x70,0x6c,0x69,0x65,0x73,0x20,0x74,0x6f,
+0x20,0x74,0x68,0x65,0x20,0x73,0x74,0x75,0x62,0x2c,0x20,0x61,0x6e,0x64,0x20,0x6e,
+0x6f,0x74,0x20,0x6e,0x65,0x63,0x65,0x73,0x73,0x61,0x72,0x69,0x6c,0x79,0x20,0x74,
+0x68,0x65,0x20,0x77,0x68,0x6f,0x6c,0x65,0x20,0x70,0x72,0x6f,0x67,0x72,0x61,0x6d,
+0x2e,0x0a,0x0d,0x0a,0x24,0x49,0x64,0x3a,0x20,0x73,0x74,0x75,0x62,0x2e,0x61,0x73,
+0x6d,0x20,0x62,0x75,0x69,0x6c,0x74,0x20,0x30,0x36,0x2f,0x32,0x38,0x2f,0x31,0x30,
+0x30,0x20,0x31,0x31,0x3a,0x31,0x35,0x3a,0x30,0x34,0x20,0x62,0x79,0x20,0x64,0x6a,
+0x61,0x73,0x6d,0x20,0x24,0x0a,0x0d,0x0a,0x40,0x28,0x23,0x29,0x20,0x73,0x74,0x75,
+0x62,0x2e,0x61,0x73,0x6d,0x20,0x62,0x75,0x69,0x6c,0x74,0x20,0x30,0x36,0x2f,0x32,
+0x38,0x2f,0x31,0x30,0x30,0x20,0x31,0x31,0x3a,0x31,0x35,0x3a,0x30,0x34,0x20,0x62,
+0x79,0x20,0x64,0x6a,0x61,0x73,0x6d,0x0a,0x0d,0x0a,0x1a,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x67,0x6f,0x33,0x32,0x73,0x74,0x75,0x62,0x2c,0x20,0x76,0x20,0x32,0x2e,0x30,0x30,
-0x54,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x67,0x6f,0x33,0x32,0x73,0x74,0x75,0x62,0x2c,0x20,0x76,0x20,0x32,0x2e,0x30,0x32,
+0x54,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x43,0x57,0x53,0x44,0x50,0x4d,0x49,0x2e,0x45,0x58,0x45,0x00,
 0x00,0x00,0x00,0x00,0x0e,0x1f,0x8c,0x1e,0x24,0x00,0x8c,0x06,0x60,0x07,0xfc,0xb4,
-0x30,0xcd,0x21,0x3c,0x03,0x73,0x06,0xba,0x86,0x05,0xe9,0xb2,0x03,0xa2,0x69,0x08,
-0xbb,0x70,0x08,0xa1,0x20,0x00,0x39,0xc3,0x73,0x02,0x89,0xc3,0x89,0x1e,0x20,0x00,
-0xfe,0xc7,0xb9,0x04,0xff,0xd3,0xeb,0xb4,0x4a,0xcd,0x21,0x73,0x0a,0xd3,0xe3,0xfe,
-0xcf,0x89,0x1e,0x20,0x00,0xeb,0xd9,0x26,0x8e,0x06,0x2c,0x00,0x31,0xff,0x30,0xc0,
-0xa9,0xf2,0xae,0x26,0x81,0x3d,0x50,0x41,0x75,0x15,0xaf,0x26,0x81,0x3d,0x54,0x48,
-0x75,0x0d,0xaf,0x26,0x80,0x3d,0x3d,0x75,0x06,0x47,0x89,0x3e,0x67,0x04,0x4f,0xae,
-0x75,0xdf,0xaf,0x06,0x57,0x31,0xc9,0x74,0x10,0xba,0x5d,0x05,0xe9,0x50,0x03,0x09,
-0xc9,0x75,0xf6,0x41,0xe8,0x92,0x03,0x72,0xf0,0xb8,0x87,0x16,0xcd,0x2f,0x09,0xc0,
-0x75,0xed,0x80,0xe3,0x01,0x74,0xe8,0x89,0x3e,0x00,0x06,0x8c,0x06,0x02,0x06,0x89,
-0x36,0x04,0x06,0x5f,0x07,0xe8,0xd5,0x02,0x89,0x3e,0x2a,0x00,0x89,0x36,0x62,0x07,
-0x80,0x3e,0x2c,0x00,0x00,0x74,0x24,0xb9,0x08,0x00,0xbf,0x2c,0x00,0x8a,0x05,0x47,
-0x08,0xc0,0x74,0x05,0x88,0x07,0x43,0xe2,0xf4,0x66,0xc7,0x07,0x2e,0x45,0x58,0x45,
-0x81,0xc3,0x04,0x00,0xc6,0x07,0x00,0x89,0x1e,0x62,0x07,0xb8,0x00,0x3d,0xba,0x64,
-0x07,0xcd,0x21,0x0f,0x82,0xb4,0x02,0xa3,0x06,0x06,0x89,0xc3,0xb9,0x06,0x00,0xba,
-0xb5,0x07,0xb4,0x3f,0xcd,0x21,0x31,0xd2,0x31,0xc9,0xa1,0xb5,0x07,0x3d,0x4c,0x01,
-0x74,0x1b,0x3d,0x4d,0x5a,0x0f,0x85,0x97,0x02,0x8b,0x16,0xb9,0x07,0xc1,0xe2,0x09,
-0x8b,0x1e,0xb7,0x07,0x09,0xdb,0x74,0x05,0x80,0xee,0x02,0x01,0xda,0x89,0x16,0xbb,
-0x07,0x89,0x0e,0xbd,0x07,0xb8,0x00,0x42,0x8b,0x1e,0x06,0x06,0xcd,0x21,0xb9,0xa8,
-0x00,0xba,0xbf,0x07,0xb4,0x3f,0xcd,0x21,0x3d,0xa8,0x00,0x75,0x06,0x81,0x3e,0xbf,
-0x07,0x4c,0x01,0x0f,0x85,0x5e,0x02,0x66,0xa1,0xe3,0x07,0x66,0xa3,0x10,0x06,0x66,
-0x8b,0x0e,0xbb,0x07,0x66,0xa1,0x03,0x08,0x66,0x01,0xc8,0x66,0xa3,0x08,0x06,0x66,
-0xa1,0x2b,0x08,0x66,0x01,0xc8,0x66,0xa3,0x0c,0x06,0x66,0x8b,0x1e,0x4b,0x08,0x66,
-0xa1,0x4f,0x08,0x66,0x01,0xc3,0x66,0xb8,0x01,0x00,0x01,0x00,0x66,0x39,0xc3,0x73,
-0x03,0x66,0x89,0xc3,0x66,0x81,0xc3,0xff,0xff,0x00,0x00,0x31,0xdb,0x66,0x89,0x1e,
-0x1c,0x00,0xe8,0xe8,0x02,0x8b,0x1e,0x04,0x06,0x09,0xdb,0x74,0x0a,0xb4,0x48,0xcd,
-0x21,0x0f,0x82,0x10,0x02,0x8e,0xc0,0xe8,0xfb,0x02,0xb8,0x01,0x00,0xff,0x1e,0x00,
-0x06,0x0f,0x82,0x08,0x02,0x8c,0x06,0x26,0x00,0x8c,0x0e,0x28,0x00,0x8c,0xd8,0xa3,
-0x22,0x00,0x8e,0xc0,0x31,0xc0,0xb9,0x01,0x00,0xcd,0x31,0x72,0x07,0xa3,0x14,0x06,
-0x31,0xc0,0xcd,0x31,0x0f,0x82,0xea,0x01,0xa3,0x16,0x06,0x66,0x8b,0x0e,0x1c,0x00,
-0xb8,0x01,0x05,0x8b,0x1e,0x1e,0x00,0xcd,0x31,0x0f,0x82,0xda,0x01,0x89,0x1e,0x1a,
-0x06,0x89,0x0e,0x18,0x06,0x89,0x36,0x1a,0x00,0x89,0x3e,0x18,0x00,0xb8,0x07,0x00,
-0x8b,0x1e,0x14,0x06,0x8b,0x0e,0x1a,0x06,0x8b,0x16,0x18,0x06,0xcd,0x31,0xb8,0x09,
-0x00,0x8c,0xc9,0x81,0xe1,0x03,0x00,0xc1,0xe1,0x05,0x51,0x81,0xc9,0x9b,0xc0,0xcd,
-0x31,0xb8,0x08,0x00,0x8b,0x0e,0x1e,0x00,0x49,0xba,0xff,0xff,0xcd,0x31,0xb8,0x07,
-0x00,0x8b,0x1e,0x16,0x06,0x8b,0x0e,0x1a,0x06,0x8b,0x16,0x18,0x06,0xcd,0x31,0xb8,
-0x09,0x00,0x59,0x81,0xc9,0x93,0xc0,0xcd,0x31,0xb8,0x08,0x00,0x8b,0x0e,0x1e,0x00,
-0x49,0xba,0xff,0xff,0xcd,0x31,0xb8,0x00,0x01,0xbb,0x00,0x0f,0xcd,0x31,0x73,0x10,
-0x3d,0x08,0x00,0x0f,0x85,0x65,0x01,0xb8,0x00,0x01,0xcd,0x31,0x0f,0x82,0x5c,0x01,
-0xa3,0x1c,0x06,0x89,0x16,0x1e,0x06,0xc1,0xe3,0x04,0x89,0x1e,0x20,0x06,0x66,0x8b,
-0x36,0x08,0x06,0x66,0x8b,0x3e,0xfb,0x07,0x66,0x8b,0x0e,0xff,0x07,0xe8,0x49,0x00,
-0x66,0x8b,0x36,0x0c,0x06,0x66,0x8b,0x3e,0x23,0x08,0x66,0x8b,0x0e,0x27,0x08,0xe8,
-0x37,0x00,0x8e,0x06,0x16,0x06,0x66,0x8b,0x3e,0x4b,0x08,0x66,0x8b,0x0e,0x4f,0x08,
-0x66,0x31,0xc0,0x66,0xc1,0xe9,0x02,0x67,0xf3,0x66,0xab,0xb4,0x3e,0x8b,0x1e,0x06,
-0x06,0xcd,0x21,0xb8,0x01,0x01,0x8b,0x16,0x1e,0x06,0xcd,0x31,0x1e,0x0f,0xa1,0x8e,
-0x1e,0x16,0x06,0x66,0x64,0xff,0x2e,0x10,0x06,0x66,0x89,0xf0,0x66,0x25,0xff,0x01,
-0x00,0x00,0x66,0x01,0xc1,0x29,0xc6,0x66,0x29,0xc7,0x66,0x89,0x0e,0x26,0x06,0x66,
-0x89,0x3e,0x22,0x06,0xe8,0xfe,0x00,0x89,0x36,0x3e,0x06,0x66,0xc1,0xee,0x10,0x89,
-0x36,0x42,0x06,0x8b,0x1e,0x06,0x06,0x89,0x1e,0x3a,0x06,0xc7,0x06,0x46,0x06,0x00,
-0x42,0xe8,0xf2,0x00,0xa1,0x1c,0x06,0xa3,0x4e,0x06,0xc7,0x06,0x3e,0x06,0x00,0x00,
-0xc6,0x06,0x47,0x06,0x3f,0xa1,0x28,0x06,0x09,0xc0,0x75,0x09,0xa1,0x26,0x06,0x3b,
-0x06,0x20,0x06,0x76,0x03,0xa1,0x20,0x06,0xa3,0x42,0x06,0xe8,0xc8,0x00,0x66,0x31,
-0xc9,0x8b,0x0e,0x46,0x06,0x66,0x8b,0x3e,0x22,0x06,0x66,0x01,0x0e,0x22,0x06,0x66,
-0x29,0x0e,0x26,0x06,0x66,0x31,0xf6,0xc1,0xe9,0x02,0x1e,0x06,0x8e,0x06,0x16,0x06,
-0x8e,0x1e,0x1e,0x06,0x67,0xf3,0x66,0xa5,0x07,0x1f,0x66,0x03,0x0e,0x26,0x06,0x75,
-0xaf,0xc3,0x3c,0x3a,0x74,0x06,0x3c,0x2f,0x74,0x02,0x3c,0x5c,0xc3,0xbe,0x64,0x07,
-0x89,0xf3,0x26,0x8a,0x05,0x47,0x88,0x04,0x38,0xe0,0x74,0x0e,0x08,0xc0,0x74,0x0a,
-0x46,0xe8,0xde,0xff,0x75,0xec,0x89,0xf3,0x74,0xe8,0xc3,0xba,0x26,0x05,0xeb,0x08,
-0xba,0x34,0x05,0xeb,0x03,0xba,0x3e,0x05,0x52,0x8b,0x1e,0x62,0x07,0xc6,0x07,0x24,
-0xbb,0x64,0x07,0xeb,0x1e,0xe8,0xed,0x00,0xba,0x78,0x05,0xeb,0x12,0xba,0x91,0x05,
-0xeb,0x0d,0xba,0xa3,0x05,0xeb,0x08,0xba,0xb5,0x05,0xeb,0x03,0xba,0x78,0x05,0x52,
-0xbb,0x19,0x05,0xe8,0x14,0x00,0x5b,0xe8,0x10,0x00,0xbb,0x42,0x04,0xe8,0x0a,0x00,
-0xb8,0xff,0x4c,0xcd,0x21,0x43,0xb4,0x02,0xcd,0x21,0x8a,0x17,0x80,0xfa,0x24,0x75,
-0xf4,0xc3,0x0d,0x0a,0x24,0x50,0x51,0x57,0x31,0xc0,0xbf,0x2a,0x06,0xb9,0x19,0x00,
-0xf3,0xab,0x5f,0x59,0x58,0xc3,0xb8,0x00,0x03,0xbb,0x21,0x00,0x31,0xc9,0x66,0xbf,
-0x2a,0x06,0x00,0x00,0xcd,0x31,0xc3,0x00,0x00,0x30,0xe4,0xe8,0x5f,0xff,0x89,0xde,
-0x8b,0x3e,0x67,0x04,0xeb,0x18,0xb4,0x3b,0xe8,0x52,0xff,0x81,0xfe,0x64,0x07,0x74,
-0x13,0x8a,0x84,0xff,0xff,0xe8,0x3a,0xff,0x74,0x04,0xc6,0x04,0x5c,0x46,0xe8,0x03,
-0x00,0x72,0xe3,0xc3,0xe8,0x36,0x00,0xbb,0x44,0x00,0x8a,0x07,0x88,0x04,0x43,0x46,
-0x08,0xc0,0x75,0xf6,0x06,0x57,0x1e,0x07,0xe8,0x9a,0xff,0xbb,0x2a,0x06,0x8c,0x9f,
-0x04,0x00,0x89,0x9f,0x02,0x00,0xba,0x64,0x07,0xb8,0x00,0x4b,0xcd,0x21,0x5f,0x07,
-0x72,0x09,0xb4,0x4d,0xcd,0x21,0x2d,0x00,0x03,0xf7,0xd8,0xeb,0x28,0x80,0x3e,0x69,
-0x08,0x05,0x72,0x20,0xb8,0x00,0x58,0xcd,0x21,0xa2,0x67,0x08,0xb8,0x02,0x58,0xcd,
-0x21,0xa2,0x68,0x08,0xb8,0x01,0x58,0xbb,0x80,0x00,0xcd,0x21,0xb8,0x03,0x58,0xbb,
-0x01,0x00,0xcd,0x21,0xc3,0x9c,0x80,0x3e,0x69,0x08,0x05,0x72,0x1a,0x50,0x53,0xb8,
-0x03,0x58,0x8a,0x1e,0x68,0x08,0x30,0xff,0xcd,0x21,0xb8,0x01,0x58,0x8a,0x1e,0x67,
-0x08,0x30,0xff,0xcd,0x21,0x5b,0x58,0x9d,0xc3,0x4c,0x6f,0x61,0x64,0x20,0x65,0x72,
-0x72,0x6f,0x72,0x3a,0x20,0x24,0x3a,0x20,0x63,0x61,0x6e,0x6e,0x6f,0x74,0x20,0x6f,
-0x70,0x65,0x6e,0x24,0x3a,0x20,0x6e,0x6f,0x74,0x20,0x45,0x58,0x45,0x24,0x3a,0x20,
-0x6e,0x6f,0x74,0x20,0x43,0x4f,0x46,0x46,0x20,0x28,0x43,0x68,0x65,0x63,0x6b,0x20,
-0x66,0x6f,0x72,0x20,0x76,0x69,0x72,0x75,0x73,0x65,0x73,0x29,0x24,0x6e,0x6f,0x20,
-0x44,0x50,0x4d,0x49,0x20,0x2d,0x20,0x47,0x65,0x74,0x20,0x63,0x73,0x64,0x70,0x6d,
-0x69,0x2a,0x62,0x2e,0x7a,0x69,0x70,0x24,0x6e,0x6f,0x20,0x44,0x4f,0x53,0x20,0x6d,
-0x65,0x6d,0x6f,0x72,0x79,0x24,0x6e,0x65,0x65,0x64,0x20,0x44,0x4f,0x53,0x20,0x33,
-0x24,0x63,0x61,0x6e,0x27,0x74,0x20,0x73,0x77,0x69,0x74,0x63,0x68,0x20,0x6d,0x6f,
-0x64,0x65,0x24,0x6e,0x6f,0x20,0x44,0x50,0x4d,0x49,0x20,0x73,0x65,0x6c,0x65,0x63,
-0x74,0x6f,0x72,0x73,0x24,0x6e,0x6f,0x20,0x44,0x50,0x4d,0x49,0x20,0x6d,0x65,0x6d,
-0x6f,0x72,0x79,0x24,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
-0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
-0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
+0x30,0xcd,0x21,0x3c,0x03,0x73,0x08,0xb0,0x6d,0xba,0xa7,0x05,0xe9,0xd4,0x03,0xa2,
+0x69,0x08,0xbe,0x20,0x00,0x8b,0x04,0x09,0xc0,0x75,0x02,0xb4,0xfe,0xbb,0x70,0x08,
+0x39,0xc3,0x73,0x02,0x89,0xc3,0x89,0x1c,0xfe,0xc7,0xb9,0x04,0xff,0xd3,0xeb,0xb4,
+0x4a,0xcd,0x21,0x73,0x08,0xd3,0xe3,0xfe,0xcf,0x89,0x1c,0xeb,0xd8,0x26,0x8e,0x06,
+0x2c,0x00,0x31,0xff,0x30,0xc0,0xa9,0xf2,0xae,0x26,0x81,0x3d,0x50,0x41,0x75,0x15,
+0xaf,0x26,0x81,0x3d,0x54,0x48,0x75,0x0d,0xaf,0x26,0x80,0x3d,0x3d,0x75,0x06,0x47,
+0x89,0x3e,0x8c,0x04,0x4f,0xae,0x75,0xdf,0xaf,0xb4,0x3e,0xbb,0x13,0x00,0xcd,0x21,
+0xb4,0x3e,0xbb,0x12,0x00,0xcd,0x21,0x06,0x57,0x31,0xc9,0x74,0x12,0xb0,0x6e,0xba,
+0x7e,0x05,0xe9,0x5e,0x03,0x09,0xc9,0x75,0xf4,0x41,0xe8,0xa1,0x03,0x72,0xee,0xb8,
+0x87,0x16,0xcd,0x2f,0x09,0xc0,0x75,0xed,0x80,0xe3,0x01,0x74,0xe8,0x89,0x3e,0x00,
+0x06,0x8c,0x06,0x02,0x06,0x89,0x36,0x04,0x06,0x5f,0x07,0xe8,0xd3,0x02,0x89,0x3e,
+0x2a,0x00,0x89,0x36,0x62,0x07,0x80,0x3e,0x2c,0x00,0x00,0x74,0x23,0xb9,0x08,0x00,
+0xbf,0x2c,0x00,0x8a,0x05,0x47,0x08,0xc0,0x74,0x05,0x88,0x07,0x43,0xe2,0xf4,0x66,
+0xc7,0x07,0x2e,0x45,0x58,0x45,0x83,0xc3,0x04,0xc6,0x07,0x00,0x89,0x1e,0x62,0x07,
+0xb8,0x00,0x3d,0xba,0x64,0x07,0xcd,0x21,0x0f,0x82,0xb3,0x02,0xa3,0x06,0x06,0x89,
+0xc3,0xb9,0x06,0x00,0xba,0xb5,0x07,0xb4,0x3f,0xcd,0x21,0x31,0xd2,0x31,0xc9,0xa1,
+0xb5,0x07,0x3d,0x4c,0x01,0x74,0x1b,0x3d,0x4d,0x5a,0x0f,0x85,0x98,0x02,0x8b,0x16,
+0xb9,0x07,0xc1,0xe2,0x09,0x8b,0x1e,0xb7,0x07,0x09,0xdb,0x74,0x05,0x80,0xee,0x02,
+0x01,0xda,0x89,0x16,0xbb,0x07,0x89,0x0e,0xbd,0x07,0xb8,0x00,0x42,0x8b,0x1e,0x06,
+0x06,0xcd,0x21,0xb9,0xa8,0x00,0xba,0xbf,0x07,0xb4,0x3f,0xcd,0x21,0x3d,0xa8,0x00,
+0x75,0x06,0x81,0x3e,0xbf,0x07,0x4c,0x01,0x0f,0x85,0x61,0x02,0x66,0xa1,0xe3,0x07,
+0x66,0xa3,0x10,0x06,0x66,0x8b,0x0e,0xbb,0x07,0x66,0xa1,0x03,0x08,0x66,0x01,0xc8,
+0x66,0xa3,0x08,0x06,0x66,0xa1,0x2b,0x08,0x66,0x01,0xc8,0x66,0xa3,0x0c,0x06,0x66,
+0x8b,0x1e,0x4b,0x08,0x66,0xa1,0x4f,0x08,0x66,0x01,0xc3,0x66,0xb8,0x01,0x00,0x01,
+0x00,0x66,0x39,0xc3,0x73,0x03,0x66,0x89,0xc3,0x66,0x81,0xc3,0xff,0xff,0x00,0x00,
+0x31,0xdb,0x66,0x89,0x1e,0x1c,0x00,0xe8,0xf5,0x02,0x8b,0x1e,0x04,0x06,0x09,0xdb,
+0x74,0x0a,0xb4,0x48,0xcd,0x21,0x0f,0x82,0x15,0x02,0x8e,0xc0,0xe8,0x08,0x03,0xb8,
+0x01,0x00,0xff,0x1e,0x00,0x06,0x0f,0x82,0x0f,0x02,0x8c,0x06,0x26,0x00,0x8c,0x0e,
+0x28,0x00,0x8c,0xd8,0xa3,0x22,0x00,0x8e,0xc0,0x31,0xc0,0xb9,0x01,0x00,0xcd,0x31,
+0x72,0x07,0xa3,0x14,0x06,0x31,0xc0,0xcd,0x31,0x0f,0x82,0xf3,0x01,0xa3,0x16,0x06,
+0x66,0x8b,0x0e,0x1c,0x00,0xb8,0x01,0x05,0x8b,0x1e,0x1e,0x00,0xcd,0x31,0x0f,0x82,
+0xe5,0x01,0x89,0x1e,0x1a,0x06,0x89,0x0e,0x18,0x06,0x89,0x36,0x1a,0x00,0x89,0x3e,
+0x18,0x00,0xb8,0x07,0x00,0x8b,0x1e,0x14,0x06,0x8b,0x0e,0x1a,0x06,0x8b,0x16,0x18,
+0x06,0xcd,0x31,0xb8,0x09,0x00,0x8c,0xc9,0x83,0xe1,0x03,0xc1,0xe1,0x05,0x51,0x81,
+0xc9,0x9b,0xc0,0xcd,0x31,0xb8,0x08,0x00,0x8b,0x0e,0x1e,0x00,0x49,0xba,0xff,0xff,
+0xcd,0x31,0xb8,0x07,0x00,0x8b,0x1e,0x16,0x06,0x8b,0x0e,0x1a,0x06,0x8b,0x16,0x18,
+0x06,0xcd,0x31,0xb8,0x09,0x00,0x59,0x81,0xc9,0x93,0xc0,0xcd,0x31,0xb8,0x08,0x00,
+0x8b,0x0e,0x1e,0x00,0x49,0xba,0xff,0xff,0xcd,0x31,0xb8,0x00,0x01,0xbb,0x00,0x0f,
+0xcd,0x31,0x73,0x10,0x3d,0x08,0x00,0x0f,0x85,0x73,0x01,0xb8,0x00,0x01,0xcd,0x31,
+0x0f,0x82,0x6a,0x01,0xa3,0x1c,0x06,0x89,0x16,0x1e,0x06,0xc1,0xe3,0x04,0x89,0x1e,
+0x20,0x06,0x66,0x8b,0x36,0x08,0x06,0x66,0x8b,0x3e,0xfb,0x07,0x66,0x8b,0x0e,0xff,
+0x07,0xe8,0x49,0x00,0x66,0x8b,0x36,0x0c,0x06,0x66,0x8b,0x3e,0x23,0x08,0x66,0x8b,
+0x0e,0x27,0x08,0xe8,0x37,0x00,0x8e,0x06,0x16,0x06,0x66,0x8b,0x3e,0x4b,0x08,0x66,
+0x8b,0x0e,0x4f,0x08,0x66,0x31,0xc0,0x66,0xc1,0xe9,0x02,0x67,0xf3,0x66,0xab,0xb4,
+0x3e,0x8b,0x1e,0x06,0x06,0xcd,0x21,0xb8,0x01,0x01,0x8b,0x16,0x1e,0x06,0xcd,0x31,
+0x1e,0x0f,0xa1,0x8e,0x1e,0x16,0x06,0x66,0x64,0xff,0x2e,0x10,0x06,0x66,0x89,0xf0,
+0x66,0x25,0xff,0x01,0x00,0x00,0x66,0x01,0xc1,0x29,0xc6,0x66,0x29,0xc7,0x66,0x89,
+0x0e,0x26,0x06,0x66,0x89,0x3e,0x22,0x06,0xe8,0x0f,0x01,0x89,0x36,0x3e,0x06,0x66,
+0xc1,0xee,0x10,0x89,0x36,0x42,0x06,0x8b,0x1e,0x06,0x06,0x89,0x1e,0x3a,0x06,0xc7,
+0x06,0x46,0x06,0x00,0x42,0xe8,0x03,0x01,0xa1,0x1c,0x06,0xa3,0x4e,0x06,0xc7,0x06,
+0x3e,0x06,0x00,0x00,0xc6,0x06,0x47,0x06,0x3f,0xa1,0x28,0x06,0x09,0xc0,0x75,0x09,
+0xa1,0x26,0x06,0x3b,0x06,0x20,0x06,0x76,0x03,0xa1,0x20,0x06,0xa3,0x42,0x06,0xe8,
+0xd9,0x00,0x66,0x31,0xc9,0x8b,0x0e,0x46,0x06,0x66,0x8b,0x3e,0x22,0x06,0x66,0x01,
+0x0e,0x22,0x06,0x66,0x29,0x0e,0x26,0x06,0x66,0x31,0xf6,0xc1,0xe9,0x02,0x1e,0x06,
+0x8e,0x06,0x16,0x06,0x8e,0x1e,0x1e,0x06,0x67,0xf3,0x66,0xa5,0x07,0x1f,0x66,0x03,
+0x0e,0x26,0x06,0x75,0xaf,0xc3,0x3c,0x3a,0x74,0x06,0x3c,0x2f,0x74,0x02,0x3c,0x5c,
+0xc3,0xbe,0x64,0x07,0x89,0xf3,0x26,0x8a,0x05,0x47,0x88,0x04,0x38,0xe0,0x74,0x0e,
+0x08,0xc0,0x74,0x0a,0x46,0xe8,0xde,0xff,0x75,0xec,0x89,0xf3,0x74,0xe8,0xc3,0xb0,
+0x66,0xba,0x48,0x05,0xeb,0x0c,0xb0,0x67,0xba,0x55,0x05,0xeb,0x05,0xb0,0x68,0xba,
+0x5f,0x05,0x52,0x8b,0x1e,0x62,0x07,0xc6,0x07,0x24,0xbb,0x64,0x07,0xeb,0x28,0xe8,
+0xf5,0x00,0xb0,0x69,0xba,0x99,0x05,0xeb,0x1a,0xb0,0x6a,0xba,0xb2,0x05,0xeb,0x13,
+0xb0,0x6b,0xba,0xc4,0x05,0xeb,0x0c,0xb0,0x6c,0xba,0xd6,0x05,0xeb,0x05,0xb0,0x69,
+0xba,0x99,0x05,0x52,0xbb,0x3b,0x05,0xe8,0x15,0x00,0x5b,0xe8,0x11,0x00,0xbb,0x67,
+0x04,0xe8,0x0b,0x00,0xb4,0x4c,0xcd,0x21,0x43,0x50,0xb4,0x02,0xcd,0x21,0x58,0x8a,
+0x17,0x80,0xfa,0x24,0x75,0xf2,0xc3,0x0d,0x0a,0x24,0x50,0x51,0x57,0x31,0xc0,0xbf,
+0x2a,0x06,0xb9,0x19,0x00,0xf3,0xab,0x5f,0x59,0x58,0xc3,0xb8,0x00,0x03,0xbb,0x21,
+0x00,0x31,0xc9,0x66,0xbf,0x2a,0x06,0x00,0x00,0xcd,0x31,0xc3,0x00,0x00,0x30,0xe4,
+0xe8,0x4e,0xff,0x89,0xde,0x8b,0x3e,0x8c,0x04,0xeb,0x17,0xb4,0x3b,0xe8,0x41,0xff,
+0x81,0xfe,0x64,0x07,0x74,0x12,0x8a,0x44,0xff,0xe8,0x2a,0xff,0x74,0x04,0xc6,0x04,
+0x5c,0x46,0xe8,0x03,0x00,0x72,0xe4,0xc3,0xe8,0x34,0x00,0xbb,0x44,0x00,0x8a,0x07,
+0x88,0x04,0x43,0x46,0x08,0xc0,0x75,0xf6,0x06,0x57,0x1e,0x07,0xe8,0x9b,0xff,0xbb,
+0x2a,0x06,0x8c,0x5f,0x04,0x89,0x5f,0x02,0xba,0x64,0x07,0xb8,0x00,0x4b,0xcd,0x21,
+0x5f,0x07,0x72,0x09,0xb4,0x4d,0xcd,0x21,0x2d,0x00,0x03,0xf7,0xd8,0xeb,0x28,0x80,
+0x3e,0x69,0x08,0x05,0x72,0x20,0xb8,0x00,0x58,0xcd,0x21,0xa2,0x67,0x08,0xb8,0x02,
+0x58,0xcd,0x21,0xa2,0x68,0x08,0xb8,0x01,0x58,0xbb,0x80,0x00,0xcd,0x21,0xb8,0x03,
+0x58,0xbb,0x01,0x00,0xcd,0x21,0xc3,0x9c,0x80,0x3e,0x69,0x08,0x05,0x72,0x1a,0x50,
+0x53,0xb8,0x03,0x58,0x8a,0x1e,0x68,0x08,0x30,0xff,0xcd,0x21,0xb8,0x01,0x58,0x8a,
+0x1e,0x67,0x08,0x30,0xff,0xcd,0x21,0x5b,0x58,0x9d,0xc3,0x4c,0x6f,0x61,0x64,0x20,
+0x65,0x72,0x72,0x6f,0x72,0x3a,0x20,0x24,0x3a,0x20,0x63,0x61,0x6e,0x27,0x74,0x20,
+0x6f,0x70,0x65,0x6e,0x24,0x3a,0x20,0x6e,0x6f,0x74,0x20,0x45,0x58,0x45,0x24,0x3a,
+0x20,0x6e,0x6f,0x74,0x20,0x43,0x4f,0x46,0x46,0x20,0x28,0x43,0x68,0x65,0x63,0x6b,
+0x20,0x66,0x6f,0x72,0x20,0x76,0x69,0x72,0x75,0x73,0x65,0x73,0x29,0x24,0x6e,0x6f,
+0x20,0x44,0x50,0x4d,0x49,0x20,0x2d,0x20,0x47,0x65,0x74,0x20,0x63,0x73,0x64,0x70,
+0x6d,0x69,0x2a,0x62,0x2e,0x7a,0x69,0x70,0x24,0x6e,0x6f,0x20,0x44,0x4f,0x53,0x20,
+0x6d,0x65,0x6d,0x6f,0x72,0x79,0x24,0x6e,0x65,0x65,0x64,0x20,0x44,0x4f,0x53,0x20,
+0x33,0x24,0x63,0x61,0x6e,0x27,0x74,0x20,0x73,0x77,0x69,0x74,0x63,0x68,0x20,0x6d,
+0x6f,0x64,0x65,0x24,0x6e,0x6f,0x20,0x44,0x50,0x4d,0x49,0x20,0x73,0x65,0x6c,0x65,
+0x63,0x74,0x6f,0x72,0x73,0x24,0x6e,0x6f,0x20,0x44,0x50,0x4d,0x49,0x20,0x6d,0x65,
+0x6d,0x6f,0x72,0x79,0x24,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90
diff --git a/bfd/hppa_stubs.h b/bfd/hppa_stubs.h
deleted file mode 100644
index ee893e8..0000000
--- a/bfd/hppa_stubs.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* HPPA linker stub instructions  */
-
-/* These are the instructions which the linker may insert into the
-   code stream when building final executables to handle out-of-range
-   calls and argument relocations.  */
-
-#define LDO_M4_R31_R31		0x37ff3ff9	/* ldo -4(%r31),%r31	  */
-#define LDIL_R1			0x20200000	/* ldil XXX,%r1		  */
-#define BE_SR4_R1		0xe0202000	/* be XXX(%sr4,%r1)	  */
-#define COPY_R31_R2          	0x081f0242	/* copy %r31,%r2	  */
-#define BLE_SR4_R0		0xe4002000	/* ble XXX(%sr4,%r0)	  */
-#define BLE_SR4_R1		0xe4202000	/* ble XXX(%sr4,%r1)	  */
-#define BV_N_0_R31		0xebe0c002	/* bv,n 0(%r31)		  */
-#define STW_R31_M8R30		0x6bdf3ff1	/* stw %r31,-8(%r30)	  */
-#define LDW_M8R30_R31		0x4bdf3ff1	/* ldw -8(%r30),%r31	  */
-#define STW_ARG_M16R30		0x6bc03fe1	/* stw %argX,-16(%r30)	  */
-#define LDW_M16R30_ARG		0x4bc03fe1	/* ldw -12(%r30),%argX	  */
-#define STW_ARG_M12R30		0x6bc03fe9	/* stw %argX,-16(%r30)	  */
-#define LDW_M12R30_ARG		0x4bc03fe9	/* ldw -12(%r30),%argX	  */
-#define FSTW_FARG_M16R30	0x27c11200	/* fstws %fargX,-16(%r30) */
-#define FLDW_M16R30_FARG	0x27c11000	/* fldws -16(%r30),%fargX */
-#define FSTD_FARG_M16R30	0x2fc11200	/* fstds %fargX,-16(%r30) */
-#define FLDD_M16R30_FARG	0x2fc11000	/* fldds -16(%r30),%fargX */
diff --git a/bfd/ieee.c b/bfd/ieee.c
index 71b967a..70f0d13 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -1343,27 +1343,21 @@
   ieee->h.abfd = abfd;
 
   if (this_byte (&(ieee->h)) != Module_Beginning)
-    {
-      abfd->tdata.ieee_ar_data = save;
-      goto got_wrong_format_error;
-    }
+    goto got_wrong_format_error;
 
   next_byte (&(ieee->h));
   library = read_id (&(ieee->h));
   if (strcmp (library, "LIBRARY") != 0)
-    {
-      bfd_release (abfd, ieee);
-      abfd->tdata.ieee_ar_data = save;
-      goto got_wrong_format_error;
-    }
-  /* Throw away the filename */
+    goto got_wrong_format_error;
+
+  /* Throw away the filename.  */
   read_id (&(ieee->h));
 
   ieee->element_count = 0;
   ieee->element_index = 0;
 
-  next_byte (&(ieee->h));	/* Drop the ad part */
-  must_parse_int (&(ieee->h));	/* And the two dummy numbers */
+  next_byte (&(ieee->h));	/* Drop the ad part.  */
+  must_parse_int (&(ieee->h));	/* And the two dummy numbers.  */
   must_parse_int (&(ieee->h));
 
   alc_elts = 10;
@@ -1371,7 +1365,7 @@
   if (elts == NULL)
     goto error_return;
 
-  /* Read the index of the BB table */
+  /* Read the index of the BB table.  */
   while (1)
     {
       int rec;
@@ -1400,14 +1394,14 @@
       t->file_offset = must_parse_int (&(ieee->h));
       t->abfd = (bfd *) NULL;
 
-      /* Make sure that we don't go over the end of the buffer */
-
+      /* Make sure that we don't go over the end of the buffer.  */
       if ((size_t) ieee_pos (abfd) > sizeof (buffer) / 2)
 	{
-	  /* Past half way, reseek and reprime */
+	  /* Past half way, reseek and reprime.  */
 	  buffer_offset += ieee_pos (abfd);
 	  if (bfd_seek (abfd, buffer_offset, SEEK_SET) != 0)
 	    goto error_return;
+
 	  /* FIXME: Check return value.  I'm not sure whether it needs
 	     to read the entire buffer or not.  */
 	  bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd);
@@ -1421,36 +1415,33 @@
 			       ieee->element_count * sizeof *ieee->elements));
   if (ieee->elements == NULL)
     goto error_return;
+
   memcpy (ieee->elements, elts,
 	  ieee->element_count * sizeof *ieee->elements);
   free (elts);
   elts = NULL;
 
-  /* Now scan the area again, and replace BB offsets with file */
-  /* offsets */
-
+  /* Now scan the area again, and replace BB offsets with file offsets.  */
   for (i = 2; i < ieee->element_count; i++)
     {
       if (bfd_seek (abfd, ieee->elements[i].file_offset, SEEK_SET) != 0)
 	goto error_return;
+
       /* FIXME: Check return value.  I'm not sure whether it needs to
 	 read the entire buffer or not.  */
       bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd);
       ieee->h.first_byte = buffer;
       ieee->h.input_p = buffer;
 
-      next_byte (&(ieee->h));	/* Drop F8 */
-      next_byte (&(ieee->h));	/* Drop 14 */
-      must_parse_int (&(ieee->h));	/* Drop size of block */
+      next_byte (&(ieee->h));		/* Drop F8.  */
+      next_byte (&(ieee->h));		/* Drop 14.  */
+      must_parse_int (&(ieee->h));	/* Drop size of block.  */
+      
       if (must_parse_int (&(ieee->h)) != 0)
-	{
-	  /* This object has been deleted */
-	  ieee->elements[i].file_offset = 0;
-	}
+	/* This object has been deleted.  */
+	ieee->elements[i].file_offset = 0;
       else
-	{
-	  ieee->elements[i].file_offset = must_parse_int (&(ieee->h));
-	}
+	ieee->elements[i].file_offset = must_parse_int (&(ieee->h));
     }
 
   /*  abfd->has_armap = ;*/
@@ -1458,10 +1449,14 @@
   return abfd->xvec;
 
  got_wrong_format_error:
+  bfd_release (abfd, ieee);
+  abfd->tdata.ieee_ar_data = save;
   bfd_set_error (bfd_error_wrong_format);
+
  error_return:
   if (elts != NULL)
     free (elts);
+
   return NULL;
 }
 
@@ -3197,11 +3192,8 @@
   block ();
 }
 
-/*
-  During linking, we we told about the bfds which made up our
-  contents, we have a list of them. They will still be open, so go to
-  the debug info in each, and copy it out, relocating it as we go.
-*/
+/* Gather together all the debug information from each input BFD into
+   one place, relocating it and emitting it as we go.  */
 
 static boolean
 ieee_write_debug_part (abfd)
@@ -3728,7 +3720,7 @@
      bfd *abfd;
 {
   ieee_symbol_type *new =
-    (ieee_symbol_type *) bfd_zmalloc (sizeof (ieee_symbol_type));
+    (ieee_symbol_type *) bfd_zalloc (abfd, sizeof (ieee_symbol_type));
   if (!new)
     return NULL;
   new->symbol.the_bfd = abfd;
diff --git a/bfd/libaout.h b/bfd/libaout.h
index 7001d3d..1682428 100644
--- a/bfd/libaout.h
+++ b/bfd/libaout.h
@@ -245,7 +245,8 @@
   M_SPARCLET_5 = 211,	/* 0xd3, reserved */
   M_SPARCLET_6 = 227,	/* 0xe3, reserved */
   /*  M_SPARCLET_7 = 243	/ * 0xf3, reserved */
-  M_SPARCLITE_LE = 243
+  M_SPARCLITE_LE = 243,
+  M_CRIS = 255		/* Axis CRIS binary.  */
 };
 
 #define N_DYNAMIC(exec) ((exec).a_info & 0x80000000)
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index aece1e1..fb5f210 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -59,9 +59,9 @@
   file_ptr first_file_filepos;
   /* Speed up searching the armap */
   struct ar_cache *cache;
-  bfd *archive_head;            /* Only interesting in output routines */
+  bfd *archive_head;		/* Only interesting in output routines */
   carsym *symdefs;		/* the symdef entries */
-  symindex symdef_count;             /* how many there are */
+  symindex symdef_count;	/* how many there are */
   char *extended_names;		/* clever intel extension */
   /* when more compilers are standard C, this can be a time_t */
   long  armap_timestamp;	/* Timestamp value written into armap.
@@ -79,9 +79,9 @@
 
 /* Goes in bfd's arelt_data slot */
 struct areltdata {
-  char * arch_header;			     /* it's actually a string */
-  unsigned int parsed_size;     /* octets of filesize not including ar_hdr */
-  char *filename;			     /* null-terminated */
+  char * arch_header;		/* it's actually a string */
+  unsigned int parsed_size;	/* octets of filesize not including ar_hdr */
+  char *filename;		/* null-terminated */
 };
 
 #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
@@ -128,11 +128,11 @@
 bfd *_bfd_new_bfd_contained_in PARAMS ((bfd *));
 const bfd_target *_bfd_dummy_target PARAMS ((bfd *abfd));
 
-void	bfd_dont_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
+void	bfd_dont_truncate_arname PARAMS ((bfd *abfd, const char *filename,
 					char *hdr));
-void	bfd_bsd_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
+void	bfd_bsd_truncate_arname PARAMS ((bfd *abfd, const char *filename,
 					char *hdr));
-void	bfd_gnu_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
+void	bfd_gnu_truncate_arname PARAMS ((bfd *abfd, const char *filename,
 					char *hdr));
 
 boolean	bsd_write_armap PARAMS ((bfd *arch, unsigned int elength,
@@ -365,7 +365,8 @@
 /* Find the nearest line using DWARF 2 debugging information.  */
 extern boolean _bfd_dwarf2_find_nearest_line
   PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
-	   const char **, unsigned int *, unsigned int));
+	   const char **, unsigned int *, unsigned int,
+	   PTR *));
 
 /* A routine to create entries for a bfd_link_hash_table.  */
 extern struct bfd_hash_entry *_bfd_link_hash_newfunc
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 1bc0f33..c570ddf 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -691,11 +691,31 @@
       
       if ((bfd_size_type) abfd->where > bim->size)
 	{
-	  abfd->where = bim->size;
-	  bfd_set_error (bfd_error_file_truncated);
-	  return -1;
+	  if ((abfd->direction == write_direction) || 
+	      (abfd->direction == both_direction))
+	    {
+	      long newsize, oldsize = (bim->size + 127) & ~127;
+	      bim->size = abfd->where;
+	      /* Round up to cut down on memory fragmentation */
+	      newsize = (bim->size + 127) & ~127;
+	      if (newsize > oldsize)
+	        {
+		  bim->buffer = bfd_realloc (bim->buffer, newsize);
+		  if (bim->buffer == 0)
+		    {
+		      bim->size = 0;
+		      bfd_set_error (bfd_error_no_memory);
+		      return -1;
+		    }
+	        }
+	    }
+	  else
+	    {
+	      abfd->where = bim->size;
+	      bfd_set_error (bfd_error_file_truncated);
+	      return -1;
+	    }   
 	}
-      
       return 0;
     }
 
@@ -1170,6 +1190,54 @@
   BFD_FAIL();
 #endif
 }
+
+void
+bfd_put_bits (data, addr, bits, big_p)
+     bfd_vma data;
+     bfd_byte *addr;
+     int bits;
+     boolean big_p;
+{
+  int i;
+  int bytes;
+
+  if (bits % 8 != 0)
+    abort ();
+
+  bytes = bits / 8;
+  for (i = 0; i < bytes; i++)
+    {
+      int index = big_p ? bytes - i - 1 : i;
+
+      addr[index] = (bfd_byte) data;
+      data >>= 8;
+    }
+}
+
+bfd_vma
+bfd_get_bits (addr, bits, big_p)
+     bfd_byte *addr;
+     int bits;
+     boolean big_p;
+{
+  bfd_vma data;
+  int i;
+  int bytes;
+
+  if (bits % 8 != 0)
+    abort ();
+
+  data = 0;
+  bytes = bits / 8;
+  for (i = 0; i < bytes; i++)
+    {
+      int index = big_p ? i : bytes - i - 1;
+      
+      data = (data << 8) | addr[index];
+    }
+
+  return data;
+}
 
 /* Default implementation */
 
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index effb0e8..7973575 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -59,9 +59,9 @@
   file_ptr first_file_filepos;
   /* Speed up searching the armap */
   struct ar_cache *cache;
-  bfd *archive_head;            /* Only interesting in output routines */
+  bfd *archive_head;		/* Only interesting in output routines */
   carsym *symdefs;		/* the symdef entries */
-  symindex symdef_count;             /* how many there are */
+  symindex symdef_count;	/* how many there are */
   char *extended_names;		/* clever intel extension */
   /* when more compilers are standard C, this can be a time_t */
   long  armap_timestamp;	/* Timestamp value written into armap.
@@ -79,9 +79,9 @@
 
 /* Goes in bfd's arelt_data slot */
 struct areltdata {
-  char * arch_header;			     /* it's actually a string */
-  unsigned int parsed_size;     /* octets of filesize not including ar_hdr */
-  char *filename;			     /* null-terminated */
+  char * arch_header;		/* it's actually a string */
+  unsigned int parsed_size;	/* octets of filesize not including ar_hdr */
+  char *filename;		/* null-terminated */
 };
 
 #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
@@ -128,11 +128,11 @@
 bfd *_bfd_new_bfd_contained_in PARAMS ((bfd *));
 const bfd_target *_bfd_dummy_target PARAMS ((bfd *abfd));
 
-void	bfd_dont_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
+void	bfd_dont_truncate_arname PARAMS ((bfd *abfd, const char *filename,
 					char *hdr));
-void	bfd_bsd_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
+void	bfd_bsd_truncate_arname PARAMS ((bfd *abfd, const char *filename,
 					char *hdr));
-void	bfd_gnu_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
+void	bfd_gnu_truncate_arname PARAMS ((bfd *abfd, const char *filename,
 					char *hdr));
 
 boolean	bsd_write_armap PARAMS ((bfd *arch, unsigned int elength,
@@ -365,7 +365,8 @@
 /* Find the nearest line using DWARF 2 debugging information.  */
 extern boolean _bfd_dwarf2_find_nearest_line
   PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
-	   const char **, unsigned int *, unsigned int));
+	   const char **, unsigned int *, unsigned int,
+	   PTR *));
 
 /* A routine to create entries for a bfd_link_hash_table.  */
 extern struct bfd_hash_entry *_bfd_link_hash_newfunc
@@ -562,7 +563,7 @@
 
 #define bfd_cache_lookup(x) \
     ((x)==bfd_last_cache? \
-      (FILE*)(bfd_last_cache->iostream): \
+      (FILE*) (bfd_last_cache->iostream): \
        bfd_cache_lookup_worker(x))
 boolean 
 bfd_cache_init  PARAMS ((bfd *abfd));
@@ -714,6 +715,14 @@
   "BFD_RELOC_386_RELATIVE",
   "BFD_RELOC_386_GOTOFF",
   "BFD_RELOC_386_GOTPC",
+  "BFD_RELOC_X86_64_GOT32",
+  "BFD_RELOC_X86_64_PLT32",
+  "BFD_RELOC_X86_64_COPY",
+  "BFD_RELOC_X86_64_GLOB_DAT",
+  "BFD_RELOC_X86_64_JUMP_SLOT",
+  "BFD_RELOC_X86_64_RELATIVE",
+  "BFD_RELOC_X86_64_GOTPCREL",
+  "BFD_RELOC_X86_64_32S",
   "BFD_RELOC_NS32K_IMM_8",
   "BFD_RELOC_NS32K_IMM_16",
   "BFD_RELOC_NS32K_IMM_32",
@@ -813,6 +822,11 @@
   "BFD_RELOC_SH_LABEL",
   "BFD_RELOC_SH_LOOP_START",
   "BFD_RELOC_SH_LOOP_END",
+  "BFD_RELOC_SH_COPY",
+  "BFD_RELOC_SH_GLOB_DAT",
+  "BFD_RELOC_SH_JMP_SLOT",
+  "BFD_RELOC_SH_RELATIVE",
+  "BFD_RELOC_SH_GOTPC",
   "BFD_RELOC_THUMB_PCREL_BRANCH9",
   "BFD_RELOC_THUMB_PCREL_BRANCH12",
   "BFD_RELOC_THUMB_PCREL_BRANCH23",
@@ -937,7 +951,6 @@
   "BFD_RELOC_IA64_LTOFF_FPTR64I",
   "BFD_RELOC_IA64_LTOFF_FPTR64MSB",
   "BFD_RELOC_IA64_LTOFF_FPTR64LSB",
-  "BFD_RELOC_IA64_SEGBASE",
   "BFD_RELOC_IA64_SEGREL32MSB",
   "BFD_RELOC_IA64_SEGREL32LSB",
   "BFD_RELOC_IA64_SEGREL64MSB",
@@ -956,8 +969,6 @@
   "BFD_RELOC_IA64_LTV64LSB",
   "BFD_RELOC_IA64_IPLTMSB",
   "BFD_RELOC_IA64_IPLTLSB",
-  "BFD_RELOC_IA64_EPLTMSB",
-  "BFD_RELOC_IA64_EPLTLSB",
   "BFD_RELOC_IA64_COPY",
   "BFD_RELOC_IA64_TPREL22",
   "BFD_RELOC_IA64_TPREL64MSB",
@@ -965,6 +976,46 @@
   "BFD_RELOC_IA64_LTOFF_TP22",
   "BFD_RELOC_IA64_LTOFF22X",
   "BFD_RELOC_IA64_LDXMOV",
+  "BFD_RELOC_M68HC11_HI8",
+  "BFD_RELOC_M68HC11_LO8",
+  "BFD_RELOC_M68HC11_3B",
+  "BFD_RELOC_CRIS_BDISP8",
+  "BFD_RELOC_CRIS_UNSIGNED_5",
+  "BFD_RELOC_CRIS_SIGNED_6",
+  "BFD_RELOC_CRIS_UNSIGNED_6",
+  "BFD_RELOC_CRIS_UNSIGNED_4",
+  "BFD_RELOC_860_COPY",
+  "BFD_RELOC_860_GLOB_DAT",
+  "BFD_RELOC_860_JUMP_SLOT",
+  "BFD_RELOC_860_RELATIVE",
+  "BFD_RELOC_860_PC26",
+  "BFD_RELOC_860_PLT26",
+  "BFD_RELOC_860_PC16",
+  "BFD_RELOC_860_LOW0",
+  "BFD_RELOC_860_SPLIT0",
+  "BFD_RELOC_860_LOW1",
+  "BFD_RELOC_860_SPLIT1",
+  "BFD_RELOC_860_LOW2",
+  "BFD_RELOC_860_SPLIT2",
+  "BFD_RELOC_860_LOW3",
+  "BFD_RELOC_860_LOGOT0",
+  "BFD_RELOC_860_SPGOT0",
+  "BFD_RELOC_860_LOGOT1",
+  "BFD_RELOC_860_SPGOT1",
+  "BFD_RELOC_860_LOGOTOFF0",
+  "BFD_RELOC_860_SPGOTOFF0",
+  "BFD_RELOC_860_LOGOTOFF1",
+  "BFD_RELOC_860_SPGOTOFF1",
+  "BFD_RELOC_860_LOGOTOFF2",
+  "BFD_RELOC_860_LOGOTOFF3",
+  "BFD_RELOC_860_LOPC",
+  "BFD_RELOC_860_HIGHADJ",
+  "BFD_RELOC_860_HAGOT",
+  "BFD_RELOC_860_HAGOTOFF",
+  "BFD_RELOC_860_HAPC",
+  "BFD_RELOC_860_HIGH",
+  "BFD_RELOC_860_HIGOT",
+  "BFD_RELOC_860_HIGOTOFF",
  "@@overflow: BFD_RELOC_UNUSED@@",
 };
 #endif
diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h
index 9b1a026..e5f5f9e 100644
--- a/bfd/libcoff-in.h
+++ b/bfd/libcoff-in.h
@@ -43,6 +43,7 @@
 #define obj_coff_strings(bfd)	(coff_data (bfd)->strings)
 #define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings)
 #define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
+#define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written)
 
 #define obj_coff_local_toc_table(bfd) (coff_data(bfd)->local_toc_sym_map)
 
@@ -83,6 +84,8 @@
   char *strings;
   /* If this is true, the strings may not be freed.  */
   boolean keep_strings;
+  /* If this is true, the strings have been written out already.  */
+  boolean strings_written;
 
   /* is this a PE format coff file */
   int pe;
@@ -97,6 +100,9 @@
   /* Used by coff_find_nearest_line.  */
   PTR line_info;
 
+  /* A place to stash dwarf2 info for this bfd. */
+  PTR dwarf2_find_line_info;
+
   /* The timestamp from the COFF file header.  */
   long timestamp;
 
@@ -126,6 +132,9 @@
   /* Basic COFF information.  */
   coff_data_type coff;
 
+  /* True if this is an XCOFF64 file. */
+  boolean xcoff64;
+
   /* True if a large a.out header should be generated.  */
   boolean full_aouthdr;
 
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index c72ffdb..5115538 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -43,6 +43,7 @@
 #define obj_coff_strings(bfd)	(coff_data (bfd)->strings)
 #define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings)
 #define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
+#define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written)
 
 #define obj_coff_local_toc_table(bfd) (coff_data(bfd)->local_toc_sym_map)
 
@@ -83,6 +84,8 @@
   char *strings;
   /* If this is true, the strings may not be freed.  */
   boolean keep_strings;
+  /* If this is true, the strings have been written out already.  */
+  boolean strings_written;
 
   /* is this a PE format coff file */
   int pe;
@@ -97,6 +100,9 @@
   /* Used by coff_find_nearest_line.  */
   PTR line_info;
 
+  /* A place to stash dwarf2 info for this bfd. */
+  PTR dwarf2_find_line_info;
+
   /* The timestamp from the COFF file header.  */
   long timestamp;
 
@@ -126,6 +132,9 @@
   /* Basic COFF information.  */
   coff_data_type coff;
 
+  /* True if this is an XCOFF64 file. */
+  boolean xcoff64;
+
   /* True if a large a.out header should be generated.  */
   boolean full_aouthdr;
 
@@ -575,32 +584,32 @@
 typedef struct coff_ptr_struct
 {
 
-        /* Remembers the offset from the first symbol in the file for
+       /* Remembers the offset from the first symbol in the file for
           this symbol. Generated by coff_renumber_symbols. */
 unsigned int offset;
 
-        /* Should the value of this symbol be renumbered.  Used for
+       /* Should the value of this symbol be renumbered.  Used for
           XCOFF C_BSTAT symbols.  Set by coff_slurp_symbol_table.  */
 unsigned int fix_value : 1;
 
-        /* Should the tag field of this symbol be renumbered.
+       /* Should the tag field of this symbol be renumbered.
           Created by coff_pointerize_aux. */
 unsigned int fix_tag : 1;
 
-        /* Should the endidx field of this symbol be renumbered.
+       /* Should the endidx field of this symbol be renumbered.
           Created by coff_pointerize_aux. */
 unsigned int fix_end : 1;
 
-        /* Should the x_csect.x_scnlen field be renumbered.
+       /* Should the x_csect.x_scnlen field be renumbered.
           Created by coff_pointerize_aux. */
 unsigned int fix_scnlen : 1;
 
-        /* Fix up an XCOFF C_BINCL/C_EINCL symbol.  The value is the
+       /* Fix up an XCOFF C_BINCL/C_EINCL symbol.  The value is the
           index into the line number entries.  Set by
           coff_slurp_symbol_table.  */
 unsigned int fix_line : 1;
 
-        /* The container for the symbol structure as read and translated
+       /* The container for the symbol structure as read and translated
            from the file. */
 
 union {
@@ -610,35 +619,35 @@
 } combined_entry_type;
 
 
- /* Each canonical asymbol really looks like this: */
+/* Each canonical asymbol really looks like this: */
 
 typedef struct coff_symbol_struct
 {
-    /* The actual symbol which the rest of BFD works with */
+   /* The actual symbol which the rest of BFD works with */
 asymbol symbol;
 
-    /* A pointer to the hidden information for this symbol */
+   /* A pointer to the hidden information for this symbol */
 combined_entry_type *native;
 
-    /* A pointer to the linenumber information for this symbol */
+   /* A pointer to the linenumber information for this symbol */
 struct lineno_cache_entry *lineno;
 
-    /* Have the line numbers been relocated yet ? */
+   /* Have the line numbers been relocated yet ? */
 boolean done_lineno;
 } coff_symbol_type;
- /* COFF symbol classifications.  */
+/* COFF symbol classifications.  */
 
 enum coff_symbol_classification
 {
-   /* Global symbol.  */
+  /* Global symbol.  */
   COFF_SYMBOL_GLOBAL,
-   /* Common symbol.  */
+  /* Common symbol.  */
   COFF_SYMBOL_COMMON,
-   /* Undefined symbol.  */
+  /* Undefined symbol.  */
   COFF_SYMBOL_UNDEFINED,
-   /* Local symbol.  */
+  /* Local symbol.  */
   COFF_SYMBOL_LOCAL,
-   /* PE section symbol.  */
+  /* PE section symbol.  */
   COFF_SYMBOL_PE_SECTION
 };
 
@@ -817,12 +826,12 @@
        struct bfd_link_info *info,
        bfd *abfd,
        const char *name,
-       flagword flags, 
+       flagword flags,
        asection *section,
        bfd_vma value,
        const char *string,
        boolean copy,
-       boolean collect, 
+       boolean collect,
        struct bfd_link_hash_entry **hashp));
 
  boolean (*_bfd_coff_link_output_has_begun) PARAMS ((
diff --git a/bfd/libhppa.h b/bfd/libhppa.h
index 7a8af9a..8ef8f53 100644
--- a/bfd/libhppa.h
+++ b/bfd/libhppa.h
@@ -21,8 +21,8 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-#ifndef _HPPA_H
-#define _HPPA_H
+#ifndef _LIBHPPA_H
+#define _LIBHPPA_H
 
 #define BYTES_IN_WORD 4
 #define PA_PAGESIZE 0x1000
@@ -159,224 +159,71 @@
   ((((bfd_signed_vma)(a)) << (BFD_ARCH_SIZE-22)) >> (BFD_ARCH_SIZE-22))
 #define HPPA_R_ADDEND(r, c)	\
   (((r) << 22) + ((c) & 0x3fffff))
-#define HPPA_WIDE	       (0) /* PSW W-bit, need to check! FIXME */
 
-/* These macros get bit fields using HP's numbering (MSB = 0),
- * but note that "MASK" assumes that the LSB bits are what's
- * wanted.
- */
-#ifndef GET_FIELD
-#define GET_FIELD(X, FROM, TO) \
-  ((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1))
-#endif
-#define GET_BIT(X, WHICH) \
-  GET_FIELD (X, WHICH, WHICH)
-
-#define MASK(SIZE) \
-  (~((-1) << SIZE))
-
-#define CATENATE(X, XSIZE, Y, YSIZE) \
-  (((X & MASK (XSIZE)) << YSIZE) | (Y & MASK (YSIZE)))
-
-#define ELEVEN(X) \
-  CATENATE (GET_BIT (X, 10), 1, GET_FIELD (X, 0, 9), 10)
 
 /* Some functions to manipulate PA instructions.  */
 
-/* NOTE: these use the HP convention that f{0} is the _left_ most
- *       bit (MSB) of f; they sometimes have to impose an assumption
- *       about the size of a field; and as far as I can tell, most
- *       aren't used.
- */
-
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
 /* Declare the functions with the unused attribute to avoid warnings.  */
-static INLINE unsigned int sign_extend (unsigned int, unsigned int)
-     __attribute__ ((__unused__));
-static INLINE unsigned int low_sign_extend (unsigned int, unsigned int)
-     __attribute__ ((__unused__));
-static INLINE unsigned int assemble_3 (unsigned int)
-     __attribute__ ((__unused__));
-static INLINE unsigned int assemble_6 (unsigned int, unsigned int)
-     __attribute__ ((__unused__));
-static INLINE unsigned int assemble_12 (unsigned int, unsigned int)
-     __attribute__ ((__unused__));
-static INLINE unsigned int assemble_16 (unsigned int, unsigned int)
-     __attribute__ ((__unused__));
-static INLINE unsigned int assemble_16a (unsigned int, unsigned int,
-					 unsigned int)
-     __attribute__ ((__unused__));
-static INLINE unsigned int assemble_17 (unsigned int, unsigned int,
-					unsigned int)
-     __attribute__ ((__unused__));
-static INLINE unsigned int assemble_21 (unsigned int)
-     __attribute ((__unused__));
-
-static INLINE unsigned int sign_unext (unsigned int, unsigned int)
-     __attribute__ ((__unused__));
-static INLINE unsigned int low_sign_unext (unsigned int, unsigned int)
-     __attribute__ ((__unused__));
-static INLINE unsigned int re_assemble_3 (unsigned int, unsigned int)
-     __attribute__ ((__unused__));
-static INLINE unsigned int re_assemble_12 (unsigned int, unsigned int)
-     __attribute__ ((__unused__));
-static INLINE unsigned int re_assemble_16 (unsigned int, unsigned int, int)
-     __attribute__ ((__unused__));
-static INLINE unsigned int re_assemble_17 (unsigned int, unsigned int)
-     __attribute__ ((__unused__));
-static INLINE unsigned int re_assemble_22 (unsigned int, unsigned int)
-     __attribute__ ((__unused__));
-static INLINE unsigned int re_assemble_21 (unsigned int, unsigned int)
-     __attribute__ ((__unused__));
-static INLINE bfd_signed_vma hppa_field_adjust (bfd_signed_vma, bfd_signed_vma,
-						enum hppa_reloc_field_selector_type_alt)
-     __attribute__ ((__unused__));
-static INLINE int bfd_hppa_insn2fmt (unsigned int)
-     __attribute__ ((__unused__));
-static INLINE  unsigned int hppa_rebuild_insn (bfd *, unsigned int,
-					       unsigned int, unsigned int)
-     __attribute__ ((__unused__));
-#endif /* gcc 2.7 or higher */
+static INLINE int sign_extend PARAMS ((int, int)) ATTRIBUTE_UNUSED;
+static INLINE int low_sign_extend PARAMS ((int, int)) ATTRIBUTE_UNUSED;
+static INLINE int sign_unext PARAMS ((int, int)) ATTRIBUTE_UNUSED;
+static INLINE int low_sign_unext PARAMS ((int, int)) ATTRIBUTE_UNUSED;
+static INLINE int re_assemble_3 PARAMS ((int)) ATTRIBUTE_UNUSED;
+static INLINE int re_assemble_12 PARAMS ((int)) ATTRIBUTE_UNUSED;
+static INLINE int re_assemble_14 PARAMS ((int)) ATTRIBUTE_UNUSED;
+static INLINE int re_assemble_16 PARAMS ((int)) ATTRIBUTE_UNUSED;
+static INLINE int re_assemble_17 PARAMS ((int)) ATTRIBUTE_UNUSED;
+static INLINE int re_assemble_21 PARAMS ((int)) ATTRIBUTE_UNUSED;
+static INLINE int re_assemble_22 PARAMS ((int)) ATTRIBUTE_UNUSED;
+static INLINE bfd_signed_vma hppa_field_adjust
+  PARAMS ((bfd_vma, bfd_signed_vma,
+	   enum hppa_reloc_field_selector_type_alt)) ATTRIBUTE_UNUSED;
+static INLINE int bfd_hppa_insn2fmt PARAMS ((bfd *, int)) ATTRIBUTE_UNUSED;
+static INLINE int hppa_rebuild_insn PARAMS ((int, int, int)) ATTRIBUTE_UNUSED;
 
 
-/* The *sign_extend and assemble_* functions are used to assemble
-   various bitfields taken from an instruction and return the
-   resulting immediate value.  They correspond to functions by the
-   same name in HP's PA-RISC 2.0 Architecture Reference Manual.  */
+/* The *sign_extend functions are used to assemble various bitfields
+   taken from an instruction and return the resulting immediate
+   value.  */
 
-static INLINE unsigned int
+static INLINE int
 sign_extend (x, len)
-     unsigned int x, len;
+     int x, len;
 {
-  unsigned int signbit = (1 << (len - 1));
-  unsigned int mask = (signbit << 1) - 1;
+  int signbit = (1 << (len - 1));
+  int mask = (signbit << 1) - 1;
   return ((x & mask) ^ signbit) - signbit;
 }
 
-static INLINE unsigned int
+static INLINE int
 low_sign_extend (x, len)
-     unsigned int x, len;
+     int x, len;
 {
   return (x >> 1) - ((x & 1) << (len - 1));
 }
 
-static INLINE unsigned int
-assemble_3 (x)
-     unsigned int x;
-{
-  return CATENATE (GET_BIT (x, 2), 1, GET_FIELD (x, 0, 1), 2);
-}
 
-static INLINE unsigned int
-assemble_6 (x, y)
-     unsigned int x, y;
-{
-  return (((x & 1) << 5) + (32 - (y & 0x1f)));
-}
+/* The re_assemble_* functions prepare an immediate value for
+   insertion into an opcode. pa-risc uses all sorts of weird bitfields
+   in the instruction to hold the value.  */
 
-static INLINE unsigned int
-assemble_12 (x, y)
-     unsigned int x, y;
-{
-  return CATENATE (CATENATE (y, 1, GET_BIT (x, 10), 1), 2,
- 		   GET_FIELD (x, 0, 9), 9);
-}
-
-static INLINE unsigned int
-assemble_16 (x, y)
-     unsigned int x, y;
-{
-  /* Depends on PSW W-bit !*/
-  unsigned int temp;
-
-  if (HPPA_WIDE)
-    temp = CATENATE (CATENATE (GET_BIT (y, 13), 1,
-			       (GET_BIT (y, 13) ^ GET_BIT (x, 0)), 1), 2,
-		     CATENATE ((GET_BIT (y, 13) ^ GET_BIT (x, 1)), 1,
-			       GET_FIELD (y, 0, 12), 13), 14);
-  else
-    temp = CATENATE (CATENATE (GET_BIT (y, 13), 1, GET_BIT (y, 13), 1), 2,
-		     CATENATE (GET_BIT (y, 13), 1, GET_FIELD (y, 0, 12), 13), 14);
-
-  return sign_extend (temp, 16);
-}
-
-static INLINE unsigned int
-assemble_16a (x, y, z)
-     unsigned int x, y, z;
-{
-  /* Depends on PSW W-bit !*/
-  unsigned int temp;
-
-  if (HPPA_WIDE)
-    temp = CATENATE (CATENATE (z, 1, (z ^ GET_BIT (x, 0)), 1), 2,
-		     CATENATE ((z ^ GET_BIT (x, 1)), 1, y, 11), 12);
-  else
-    temp = CATENATE (CATENATE (z, 1, z, 1), 2, CATENATE (z, 1, y, 11), 12);
-
-  return sign_extend ((temp << 2), 16);
-}
-
-static INLINE unsigned int
-assemble_17 (x, y, z)
-     unsigned int x, y, z;
-{
-  unsigned int temp;
-
-  temp = CATENATE (CATENATE (z, 1, x, 5), 6,
-		   CATENATE (GET_BIT (y, 10), 1, GET_FIELD (y, 0, 9), 10), 11);
-
-  return temp;
-}
-
-static INLINE unsigned int
-assemble_21 (x)
-     unsigned int x;
-{
-  unsigned int temp;
-
-  temp = ((  (x & 0x000001) << 20)
-	  | ((x & 0x000ffe) << 8)
-	  | ((x & 0x003000) >> 12)
-	  | ((x & 0x00c000) >> 7)
-	  | ((x & 0x1f0000) >> 14));
-  return temp;
-}
-
-static INLINE unsigned int
-assemble_22 (a,b,c,d)
-     unsigned int a,b,c,d;
-{
-  unsigned int temp;
-
-  temp = CATENATE (CATENATE (d, 1, a, 5), 6,
-		   CATENATE (b, 5, ELEVEN (c), 11), 16);
-
-  return sign_extend (temp, 22);
-}
-
-
-/* The re_assemble_* functions splice together an opcode and an
-   immediate value.  pa-risc uses all sorts of weird bitfields in the
-   instruction to hold the value.  */
-
-static INLINE unsigned int
+static INLINE int
 sign_unext (x, len)
-     unsigned int x, len;
+     int x, len;
 {
-  unsigned int len_ones;
+  int len_ones;
 
-  len_ones = ((unsigned int) 1 << len) - 1;
+  len_ones = (1 << len) - 1;
 
   return x & len_ones;
 }
 
-static INLINE unsigned int
+static INLINE int
 low_sign_unext (x, len)
-     unsigned int x, len;
+     int x, len;
 {
-  unsigned int temp;
-  unsigned int sign;
+  int temp;
+  int sign;
 
   sign = (x >> (len-1)) & 1;
 
@@ -385,83 +232,69 @@
   return (temp << 1) | sign;
 }
 
-static INLINE unsigned int
-re_assemble_3 (insn, as3)
-     unsigned int insn;
-     unsigned int as3;
+static INLINE int
+re_assemble_3 (as3)
+     int as3;
 {
-  return (insn
-	  | ((as3 & 4) << (13-2))
+  return ((  (as3 & 4) << (13-2))
 	  | ((as3 & 3) << (13+1)));
 }
 
-static INLINE unsigned int
-re_assemble_12 (insn, as12)
-     unsigned int insn;
-     unsigned int as12;
+static INLINE int
+re_assemble_12 (as12)
+     int as12;
 {
-  return (insn
-	  | ((as12 & 0x800) >> 11)
+  return ((  (as12 & 0x800) >> 11)
 	  | ((as12 & 0x400) >> (10 - 2))
 	  | ((as12 & 0x3ff) << (1 + 2)));
 }
 
-static INLINE unsigned int
-re_assemble_16 (insn, as16, wide)
-     unsigned int insn;
-     unsigned int as16;
-     int wide;
+static INLINE int
+re_assemble_14 (as14)
+     int as14;
 {
-  unsigned int s, t;
-
-  if (wide)
-    {
-      /* Unusual 16-bit encoding.  */
-      t = (as16 << 1) & 0xffff;
-      s = (as16 & 0x8000);
-      return insn | (t ^ s ^ (s >> 1)) | (s >> 15);
-    }
-  else
-    {
-      /* Standard 14-bit encoding.  */
-      t = (as16 << 1) & 0x3fff;
-      s = (as16 & 0x2000);
-      return insn | t | (s >> 13);
-    }
+  return ((  (as14 & 0x1fff) << 1)
+	  | ((as14 & 0x2000) >> 13));
 }
 
-static INLINE unsigned int
-re_assemble_17 (insn, as17)
-     unsigned int insn;
-     unsigned int as17;
+static INLINE int
+re_assemble_16 (as16)
+     int as16;
 {
-  return (insn
-	  | ((as17 & 0x10000) >> 16)
+  int s, t;
+
+  /* Unusual 16-bit encoding, for wide mode only.  */
+  t = (as16 << 1) & 0xffff;
+  s = (as16 & 0x8000);
+  return (t ^ s ^ (s >> 1)) | (s >> 15);
+}
+
+static INLINE int
+re_assemble_17 (as17)
+     int as17;
+{
+  return ((  (as17 & 0x10000) >> 16)
 	  | ((as17 & 0x0f800) << (16 - 11))
 	  | ((as17 & 0x00400) >> (10 - 2))
 	  | ((as17 & 0x003ff) << (1 + 2)));
 }
 
-static INLINE unsigned int
-re_assemble_21 (insn, as21)
-     unsigned int insn;
-     unsigned int as21;
+static INLINE int
+re_assemble_21 (as21)
+     int as21;
 {
-  return (insn
-	  | ((as21 & 0x100000) >> 20)
+  return ((  (as21 & 0x100000) >> 20)
 	  | ((as21 & 0x0ffe00) >> 8)
 	  | ((as21 & 0x000180) << 7)
 	  | ((as21 & 0x00007c) << 14)
 	  | ((as21 & 0x000003) << 12));
 }
 
-static INLINE unsigned int
-re_assemble_22 (insn, as22)
-     unsigned int insn;
-     unsigned int as22;
+static INLINE int
+re_assemble_22 (as22)
+     int as22;
 {
-  return (insn
-	  | ((as22 & 0x200000) >> 21)
+  return ((  (as22 & 0x200000) >> 21)
 	  | ((as22 & 0x1f0000) << (21 - 16))
 	  | ((as22 & 0x00f800) << (16 - 11))
 	  | ((as22 & 0x000400) >> (10 - 2))
@@ -481,7 +314,7 @@
 
 static INLINE bfd_signed_vma
 hppa_field_adjust (sym_val, addend, r_field)
-     bfd_signed_vma sym_val;
+     bfd_vma sym_val;
      bfd_signed_vma addend;
      enum hppa_reloc_field_selector_type_alt r_field;
 {
@@ -491,10 +324,18 @@
   switch (r_field)
     {
     case e_fsel:
-    case e_nsel:
       /* F: No change.  */
       break;
 
+    case e_nsel:
+      /* N: null selector.  I don't really understand what this is all
+	 about, but HP's documentation says "this indicates that zero
+	 bits are to be used for the displacement on the instruction.
+	 This fixup is used to identify three-instruction sequences to
+	 access data (for importing shared library data)."  */
+      value = 0;
+      break;
+
     case e_lsel:
     case e_nlsel:
       /* L:  Select top 21 bits.  */
@@ -558,123 +399,158 @@
 /* PA-RISC OPCODES */
 #define get_opcode(insn)	(((insn) >> 26) & 0x3f)
 
-/* FIXME: this list is incomplete.  It should also be an enumerated
-   type rather than #defines.  */
+enum hppa_opcode_type
+{
+  /* None of the opcodes in the first group generate relocs, so we
+     aren't too concerned about them.  */
+  OP_SYSOP   = 0x00,
+  OP_MEMMNG  = 0x01,
+  OP_ALU     = 0x02,
+  OP_NDXMEM  = 0x03,
+  OP_SPOP    = 0x04,
+  OP_DIAG    = 0x05,
+  OP_FMPYADD = 0x06,
+  OP_UNDEF07 = 0x07,
+  OP_COPRW   = 0x09,
+  OP_COPRDW  = 0x0b,
+  OP_COPR    = 0x0c,
+  OP_FLOAT   = 0x0e,
+  OP_PRDSPEC = 0x0f,
+  OP_UNDEF15 = 0x15,
+  OP_UNDEF1d = 0x1d,
+  OP_FMPYSUB = 0x26,
+  OP_FPFUSED = 0x2e,
+  OP_SHEXDP0 = 0x34,
+  OP_SHEXDP1 = 0x35,
+  OP_SHEXDP2 = 0x36,
+  OP_UNDEF37 = 0x37,
+  OP_SHEXDP3 = 0x3c,
+  OP_SHEXDP4 = 0x3d,
+  OP_MULTMED = 0x3e,
+  OP_UNDEF3f = 0x3f,
 
-#define LDO	0x0d
-#define LDB	0x10
-#define LDH	0x11
-#define LDW	0x12
-#define LDWM	0x13
-#define STB	0x18
-#define STH	0x19
-#define STW	0x1a
-#define STWM	0x1b
-#define COMICLR	0x24
-#define SUBI	0x25
-#define SUBIO	0x25
-#define ADDIT	0x2c
-#define ADDITO	0x2c
-#define ADDI	0x2d
-#define ADDIO	0x2d
-#define LDIL	0x08
-#define ADDIL	0x0a
+  OP_LDIL    = 0x08,
+  OP_ADDIL   = 0x0a,
 
-#define MOVB	0x32
-#define MOVIB	0x33
-#define COMBT	0x20
-#define COMBF	0x22
-#define COMIBT	0x21
-#define COMIBF	0x23
-#define ADDBT	0x28
-#define ADDBF	0x2a
-#define ADDIBT	0x29
-#define ADDIBF	0x2b
-#define BVB	0x30
-#define BB	0x31
+  OP_LDO     = 0x0d,
+  OP_LDB     = 0x10,
+  OP_LDH     = 0x11,
+  OP_LDW     = 0x12,
+  OP_LDWM    = 0x13,
+  OP_STB     = 0x18,
+  OP_STH     = 0x19,
+  OP_STW     = 0x1a,
+  OP_STWM    = 0x1b,
 
-#define BL	0x3a
-#define BLE	0x39
-#define BE	0x38
+  OP_LDD     = 0x14,
+  OP_STD     = 0x1c,
 
-#define CMPBDT	0x27
-#define CMPBDF	0x2f
-#define CMPIBD	0x3b
-#define LDD	0x14
-#define STD	0x1c
-#define LDWL	0x17
-#define STWL	0x1f
-#define FLDW    0x16
-#define FSTW    0x1e
+  OP_FLDW    = 0x16,
+  OP_LDWL    = 0x17,
+  OP_FSTW    = 0x1e,
+  OP_STWL    = 0x1f,
 
-/* Given a machine instruction, return its format.
+  OP_COMBT   = 0x20,
+  OP_COMIBT  = 0x21,
+  OP_COMBF   = 0x22,
+  OP_COMIBF  = 0x23,
+  OP_CMPBDT  = 0x27,
+  OP_ADDBT   = 0x28,
+  OP_ADDIBT  = 0x29,
+  OP_ADDBF   = 0x2a,
+  OP_ADDIBF  = 0x2b,
+  OP_CMPBDF  = 0x2f,
+  OP_BVB     = 0x30,
+  OP_BB      = 0x31,
+  OP_MOVB    = 0x32,
+  OP_MOVIB   = 0x33,
+  OP_CMPIBD  = 0x3b,
 
-   FIXME:  opcodes which do not map to a known format
-   should return an error of some sort.  */
+  OP_COMICLR = 0x24,
+  OP_SUBI    = 0x25,
+  OP_ADDIT   = 0x2c,
+  OP_ADDI    = 0x2d,
+
+  OP_BE      = 0x38,
+  OP_BLE     = 0x39,
+  OP_BL      = 0x3a
+};
+
+
+/* Given a machine instruction, return its format.  */
 
 static INLINE int
-bfd_hppa_insn2fmt (insn)
-     unsigned int insn;
+bfd_hppa_insn2fmt (abfd, insn)
+     bfd *abfd;
+     int insn;
 {
-  unsigned char op = get_opcode (insn);
+  enum hppa_opcode_type op = get_opcode (insn);
 
   switch (op)
     {
-    case ADDI:
-    case ADDIT:
-    case SUBI:
+    case OP_COMICLR:
+    case OP_SUBI:
+    case OP_ADDIT:
+    case OP_ADDI:
       return 11;
 
-    case MOVB:
-    case MOVIB:
-    case COMBT:
-    case COMBF:
-    case COMIBT:
-    case COMIBF:
-    case ADDBT:
-    case ADDBF:
-    case ADDIBT:
-    case ADDIBF:
-    case BVB:
-    case BB:
-    case CMPBDT:
-    case CMPBDF:
-    case CMPIBD:
+    case OP_COMBT:
+    case OP_COMIBT:
+    case OP_COMBF:
+    case OP_COMIBF:
+    case OP_CMPBDT:
+    case OP_ADDBT:
+    case OP_ADDIBT:
+    case OP_ADDBF:
+    case OP_ADDIBF:
+    case OP_CMPBDF:
+    case OP_BVB:
+    case OP_BB:
+    case OP_MOVB:
+    case OP_MOVIB:
+    case OP_CMPIBD:
       return 12;
 
-    case LDO:
-    case LDB:
-    case LDH:
-    case LDW:
-    case LDWM:
-    case STB:
-    case STH:
-    case STW:
-    case STWM:
+    case OP_LDO:
+    case OP_LDB:
+    case OP_LDH:
+    case OP_LDW:
+    case OP_LDWM:
+    case OP_STB:
+    case OP_STH:
+    case OP_STW:
+    case OP_STWM:
+      if (abfd->arch_info->mach >= 25)
+	return 16;	/* Wide mode, format 16.  */
       return 14;
 
-    case LDWL:
-    case STWL:
-    case FLDW:
-    case FSTW:
+    case OP_FLDW:
+    case OP_LDWL:
+    case OP_FSTW:
+    case OP_STWL:
       /* This is a hack.  Unfortunately, format 11 is already taken
 	 and we're using integers rather than an enum, so it's hard
 	 to describe the 11a format.  */
+      if (abfd->arch_info->mach >= 25)
+	return -16;	/* Wide mode, format 16a.  */
       return -11;
 
-    case LDD:
-    case STD:
+    case OP_LDD:
+    case OP_STD:
+      if (abfd->arch_info->mach >= 25)
+	return -10;	/* Wide mode, format 10a.  */
       return 10;
 
-    case BL:
-    case BE:
-    case BLE:
-      if ((insn & 0x00008000) != 0)
+    case OP_BL:
+      if ((insn & 0x8000) != 0)
 	return 22;
+      /* fall thru */
+    case OP_BE:
+    case OP_BLE:
       return 17;
 
-    case LDIL:
-    case ADDIL:
+    case OP_LDIL:
+    case OP_ADDIL:
       return 21;
 
     default:
@@ -687,21 +563,52 @@
 /* Insert VALUE into INSN using R_FORMAT to determine exactly what
    bits to change.  */
 
-static INLINE unsigned int
-hppa_rebuild_insn (abfd, insn, value, r_format)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     unsigned int insn;
-     unsigned int value;
-     unsigned int r_format;
+static INLINE int
+hppa_rebuild_insn (insn, value, r_format)
+     int insn;
+     int value;
+     int r_format;
 {
   switch (r_format)
     {
-    case 11: return (insn & ~ 0x7ff) | low_sign_unext (value, 11);
-    case 12: return re_assemble_12 (insn & ~ 0x1ffd, value);
-    case 14: return (insn & ~ 0x3fff) | low_sign_unext (value, 14);
-    case 17: return re_assemble_17 (insn & ~ 0x1f1ffd, value);
-    case 21: return re_assemble_21 (insn & ~ 0x1fffff, value);
-    case 32: return value;
+    case 11:
+      return (insn & ~ 0x7ff) | low_sign_unext (value, 11);
+
+    case 12:
+      return (insn & ~ 0x1ffd) | re_assemble_12 (value);
+
+
+    case 10:
+      return (insn & ~ 0x3ff1) | re_assemble_14 (value & -8);
+
+    case -11:
+      return (insn & ~ 0x3ff9) | re_assemble_14 (value & -4);
+
+    case 14:
+      return (insn & ~ 0x3fff) | re_assemble_14 (value);
+
+
+    case -10:
+      return (insn & ~ 0xfff1) | re_assemble_16 (value & -8);
+
+    case -16:
+      return (insn & ~ 0xfff9) | re_assemble_16 (value & -4);
+
+    case 16:
+      return (insn & ~ 0xffff) | re_assemble_16 (value);
+
+
+    case 17:
+      return (insn & ~ 0x1f1ffd) | re_assemble_17 (value);
+
+    case 21:
+      return (insn & ~ 0x1fffff) | re_assemble_21 (value);
+
+    case 22:
+      return (insn & ~ 0x3ff1ffd) | re_assemble_22 (value);
+
+    case 32:
+      return value;
 
     default:
       abort ();
@@ -709,4 +616,4 @@
   return insn;
 }
 
-#endif /* _HPPA_H */
+#endif /* _LIBHPPA_H */
diff --git a/bfd/m68klinux.c b/bfd/m68klinux.c
index 2251757..9c445bd 100644
--- a/bfd/m68klinux.c
+++ b/bfd/m68klinux.c
@@ -479,8 +479,8 @@
 				   (h->root.root.root.string
 				    + sizeof PLT_REF_PREFIX - 1),
 				   false, false, true);
-      /* h2 does not follow indirect symbols. */
-      h2 = linux_link_hash_lookup (linux_hash_table (info), 
+      /* h2 does not follow indirect symbols.  */
+      h2 = linux_link_hash_lookup (linux_hash_table (info),
 				   (h->root.root.root.string
 				    + sizeof PLT_REF_PREFIX - 1),
 				   false, false, false);
@@ -536,7 +536,7 @@
 	}
 
       /* Quick and dirty way of stripping these symbols from the
-	 symtab. */
+	 symtab.  */
       if (bfd_is_abs_section (h->root.root.u.def.section))
 	h->root.written = true;
     }
@@ -561,7 +561,7 @@
   if (output_bfd->xvec != &MY(vec))
     return true;
 
-  /* First find the fixups... */
+  /* First find the fixups...  */
   linux_link_hash_traverse (linux_hash_table (info),
 			    linux_tally_symbols,
 			    (PTR) info);
@@ -631,7 +631,7 @@
   fixups_written = 0;
 
 #ifdef LINUX_LINK_DEBUG
-  printf ("Fixup table file offset: %x  VMA: %x\n", 
+  printf ("Fixup table file offset: %x  VMA: %x\n",
 	  os->filepos + s->output_offset,
 	  os->vma + s->output_offset);
 #endif
@@ -733,7 +733,7 @@
 	}
     }
 
-  h = linux_link_hash_lookup (linux_hash_table (info), 
+  h = linux_link_hash_lookup (linux_hash_table (info),
 			      "__BUILTIN_FIXUPS__",
 			      false, false, false);
 
diff --git a/bfd/m68knetbsd.c b/bfd/m68knetbsd.c
index 24d1665..b350ec2 100644
--- a/bfd/m68knetbsd.c
+++ b/bfd/m68knetbsd.c
@@ -21,7 +21,7 @@
 #define TARGET_IS_BIG_ENDIAN_P
 
 /* Our m68k ports use either 4K or 8K pages, but object files always
-   assume 8K page alignment so they will work on all m68k machines. */
+   assume 8K page alignment so they will work on all m68k machines.  */
 #define TARGET_PAGE_SIZE	0x2000
 
 #define DEFAULT_ARCH	bfd_arch_m68k
diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c
index 7a680fb..7bed6a8 100644
--- a/bfd/mipsbsd.c
+++ b/bfd/mipsbsd.c
@@ -43,8 +43,8 @@
 #include "libaout.h"
 
 #define SET_ARCH_MACH(ABFD, EXEC) \
-  MY(set_arch_mach)(ABFD, N_MACHTYPE (EXEC)); \
-  MY(choose_reloc_size)(ABFD);
+  MY(set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \
+  MY(choose_reloc_size) (ABFD);
 static void MY(set_arch_mach) PARAMS ((bfd *abfd, int machtype));
 static void MY(choose_reloc_size) PARAMS ((bfd *abfd));
 
@@ -74,7 +74,7 @@
   enum bfd_architecture arch;
   long machine;
 
-  /* Determine the architecture and machine type of the object file. */
+  /* Determine the architecture and machine type of the object file.  */
   switch (machtype) {
 
   case M_MIPS1:
@@ -92,7 +92,7 @@
     machine = 0;
     break;
   }
-  bfd_set_arch_mach(abfd, arch, machine);  
+  bfd_set_arch_mach(abfd, arch, machine);
 }
 
 /* Determine the size of a relocation entry, based on the architecture */
@@ -160,7 +160,7 @@
     N_SET_MACHTYPE(*execp, M_UNKNOWN);
   }
 
-  MY(choose_reloc_size)(abfd);
+  MY(choose_reloc_size) (abfd);
 
   WRITE_HEADERS(abfd, execp);
 
@@ -195,8 +195,8 @@
      bfd *output_bfd;
 {
   bfd_vma relocation, pc;
- 
-  /* If this is a partial relocation, just continue. */
+
+  /* If this is a partial relocation, just continue.  */
   if (output_bfd != (bfd *)NULL)
     return bfd_reloc_continue;
 
@@ -205,7 +205,7 @@
       && (symbol->flags & BSF_WEAK) == 0)
     return bfd_reloc_undefined;
 
-  /* 
+  /*
    * Work out which section the relocation is targetted at and the
    * initial relocation command value.
    */
@@ -249,8 +249,8 @@
      char **error_message ATTRIBUTE_UNUSED;
 {
   bfd_vma relocation;
- 
-  /* If this is a partial relocation, just continue. */
+
+  /* If this is a partial relocation, just continue.  */
   if (output_bfd != (bfd *)NULL)
     return bfd_reloc_continue;
 
@@ -259,7 +259,7 @@
       && (symbol->flags & BSF_WEAK) == 0)
     return bfd_reloc_undefined;
 
-  /* 
+  /*
    * Work out which section the relocation is targetted at and the
    * initial relocation command value.
    */
@@ -329,7 +329,7 @@
  * own mapping of external reloc type values to howto entries.
  */
 long
-MY(canonicalize_reloc)(abfd, section, relptr, symbols)
+MY(canonicalize_reloc) (abfd, section, relptr, symbols)
       bfd *abfd;
       sec_ptr section;
       arelent **relptr;
@@ -339,7 +339,7 @@
   unsigned int count, c;
   extern reloc_howto_type NAME(aout,ext_howto_table)[];
 
-  /* If we have already read in the relocation table, return the values. */
+  /* If we have already read in the relocation table, return the values.  */
   if (section->flags & SEC_CONSTRUCTOR) {
     arelent_chain *chain = section->constructor_chain;
 
@@ -351,18 +351,18 @@
     return section->reloc_count;
   }
   if (tblptr && section->reloc_count) {
-    for (count = 0; count++ < section->reloc_count;) 
+    for (count = 0; count++ < section->reloc_count;)
       *relptr++ = tblptr++;
     *relptr = 0;
     return section->reloc_count;
   }
 
-  if (!NAME(aout,slurp_reloc_table)(abfd, section, symbols))
+  if (!NAME(aout,slurp_reloc_table) (abfd, section, symbols))
     return -1;
   tblptr = section->relocation;
 
   /* fix up howto entries */
-  for (count = 0; count++ < section->reloc_count;) 
+  for (count = 0; count++ < section->reloc_count;)
     {
       c = tblptr->howto - NAME(aout,ext_howto_table);
       tblptr->howto = &mips_howto_table_ext[c];
@@ -428,7 +428,7 @@
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   & aout_mips_big_vec,
-  
+
   (PTR) MY_backend_data
 };
 
@@ -469,6 +469,6 @@
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   & aout_mips_little_vec,
-  
+
   (PTR) MY_backend_data
 };
diff --git a/bfd/netbsd-core.c b/bfd/netbsd-core.c
index 828c2a1..b94c4a1 100644
--- a/bfd/netbsd-core.c
+++ b/bfd/netbsd-core.c
@@ -16,7 +16,7 @@
 
 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 "bfd.h"
 #include "sysdep.h"
@@ -29,7 +29,7 @@
 #include <sys/core.h>
 
 /*
- * FIXME: On NetBSD/sparc CORE_FPU_OFFSET should be (sizeof(struct trapframe))
+ * FIXME: On NetBSD/sparc CORE_FPU_OFFSET should be (sizeof (struct trapframe))
  */
 
 struct netbsd_core_struct {
@@ -98,7 +98,7 @@
 
 		offset += core.c_seghdrsize;
 
-		asect = (asection *) bfd_zalloc (abfd, sizeof(asection));
+		asect = (asection *) bfd_zalloc (abfd, sizeof (asection));
 		if (asect == NULL) {
 			bfd_set_error(bfd_error_no_memory);
 			goto punt;
@@ -118,7 +118,7 @@
 			asect->name = ".reg";
 			asect->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
 #ifdef CORE_FPU_OFFSET
-			/* Hackish... */
+			/* Hackish...  */
 			asect->_raw_size = CORE_FPU_OFFSET;
 			asect2 = (asection *)bfd_zalloc (abfd,
 							 sizeof (asection));
@@ -193,9 +193,9 @@
 
 /* If somebody calls any byte-swapping routines, shoot them.  */
 static void
-swap_abort()
+swap_abort ()
 {
-  abort(); /* This way doesn't require any declaration for ANSI to fuck up */
+  abort (); /* This way doesn't require any declaration for ANSI to fuck up */
 }
 #define	NO_GET	((bfd_vma (*) PARAMS ((   const bfd_byte *))) swap_abort )
 #define	NO_PUT	((void    (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
@@ -236,7 +236,7 @@
      bfd_false, bfd_false,
      bfd_false, bfd_false
     },
-    
+
        BFD_JUMP_TABLE_GENERIC (_bfd_generic),
        BFD_JUMP_TABLE_COPY (_bfd_generic),
        BFD_JUMP_TABLE_CORE (netbsd),
@@ -248,6 +248,6 @@
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
     NULL,
-    
+
     (PTR) 0			/* backend_data */
 };
diff --git a/bfd/netbsd.h b/bfd/netbsd.h
index 760ed95..d717824 100644
--- a/bfd/netbsd.h
+++ b/bfd/netbsd.h
@@ -19,33 +19,33 @@
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 USA.  */
 
-/* Check for our machine type (part of magic number). */
+/* Check for our machine type (part of magic number).  */
 #ifndef MACHTYPE_OK
 #define MACHTYPE_OK(m) ((m) == DEFAULT_MID || (m) == M_UNKNOWN)
 #endif
 
-/* This is the normal load address for executables. */
+/* This is the normal load address for executables.  */
 #define TEXT_START_ADDR		TARGET_PAGE_SIZE
 
 /* NetBSD ZMAGIC has its header in the text segment.  */
 #define N_HEADER_IN_TEXT(x)	1
 
-/* Determine if this is a shared library using the flags. */
+/* Determine if this is a shared library using the flags.  */
 #define N_SHARED_LIB(x) 	(N_DYNAMIC(x))
 
 /* We have 6 bits of flags and 10 bits of machine ID.  */
 #define N_MACHTYPE(exec) \
-	((enum machine_type)(((exec).a_info >> 16) & 0x03ff))
+	((enum machine_type) (((exec).a_info >> 16) & 0x03ff))
 #define N_FLAGS(exec) \
 	(((exec).a_info >> 26) & 0x3f)
 
 #define N_SET_INFO(exec, magic, type, flags) \
 	((exec).a_info = ((magic) & 0xffff) \
-	 | (((int)(type) & 0x3ff) << 16) \
+	 | (((int) (type) & 0x3ff) << 16) \
 	 | (((flags) & 0x3f) << 24))
 #define N_SET_MACHTYPE(exec, machtype) \
 	((exec).a_info = \
-         ((exec).a_info & 0xfb00ffff) | ((((int)(machtype))&0x3ff) << 16))
+         ((exec).a_info & 0xfb00ffff) | ((((int) (machtype))&0x3ff) << 16))
 #define N_SET_FLAGS(exec, flags) \
 	((exec).a_info = \
 	 ((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26))
diff --git a/bfd/newsos3.c b/bfd/newsos3.c
index 7ec7a75..c1389e1 100644
--- a/bfd/newsos3.c
+++ b/bfd/newsos3.c
@@ -24,7 +24,7 @@
 #define MY(OP) CAT(newsos3_,OP)
 #define TARGETNAME "a.out-newsos3"
 #define ENTRY_CAN_BE_ZERO
-#define N_SHARED_LIB(x) 0 /* Avoids warning when compiled with -Wall. */
+#define N_SHARED_LIB(x) 0 /* Avoids warning when compiled with -Wall.  */
 #define DEFAULT_ARCH bfd_arch_m68k
 #define TARGET_IS_BIG_ENDIAN_P
 #define N_HEADER_IN_TEXT(x) 0
diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h
index 5c1e255..5303c10 100644
--- a/bfd/nlm-target.h
+++ b/bfd/nlm-target.h
@@ -78,10 +78,10 @@
   /* object_flags: mask of all file flags */
   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
    | WP_TEXT),
-  
+
   /* section_flags: mask of all section flags */
   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
-   SEC_CODE | SEC_DATA), 
+   SEC_CODE | SEC_DATA),
 
    /* leading_symbol_char: is the first char of a user symbol
       predictable, and if so what is it */
@@ -147,7 +147,7 @@
 #else
   NULL,
 #endif
-  
+
   /* backend_data: */
   (PTR) TARGET_BACKEND_DATA
 };
@@ -171,10 +171,10 @@
   /* object_flags: mask of all file flags */
   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
    | WP_TEXT),
-  
+
   /* section_flags: mask of all section flags */
   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
-   SEC_DATA), 
+   SEC_DATA),
 
    /* leading_symbol_char: is the first char of a user symbol
       predictable, and if so what is it */
@@ -240,7 +240,7 @@
 #else
   NULL,
 #endif
-  
+
   /* backend_data: */
   (PTR) TARGET_BACKEND_DATA
 };
diff --git a/bfd/nlm32-alpha.c b/bfd/nlm32-alpha.c
index 24c8e51..c1a0cbe7 100644
--- a/bfd/nlm32-alpha.c
+++ b/bfd/nlm32-alpha.c
@@ -651,7 +651,7 @@
   while (sym -> rcnt < rcount)
     {
       asection *section;
-      
+
       if (nlm_alpha_read_reloc (abfd, sym, &section,
 				&nlm_relocs -> reloc)
 	  == false)
@@ -828,7 +828,7 @@
   arelent r;
 
   len = strlen (sym->name);
-  if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof(bfd_byte))
+  if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof (bfd_byte))
       || bfd_write (sym->name, len, 1, abfd) != len)
     return false;
 
diff --git a/bfd/nlm32-i386.c b/bfd/nlm32-i386.c
index f16c74d..356d00e 100644
--- a/bfd/nlm32-i386.c
+++ b/bfd/nlm32-i386.c
@@ -226,7 +226,7 @@
 	    }
 	}
     }
-  
+
   bfd_put_32 (abfd, val, temp);
   if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp))
     return false;
@@ -376,7 +376,7 @@
   while (sym -> rcnt < rcount)
     {
       asection *section;
-      
+
       if (nlm_i386_read_reloc (abfd, sym, &section,
 			       &nlm_relocs -> reloc)
 	  == false)
@@ -402,12 +402,12 @@
   unsigned char temp[NLM_TARGET_LONG_SIZE];
 
   len = strlen (sym->name);
-  if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof(bfd_byte))
+  if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof (bfd_byte))
       || bfd_write (sym->name, len, 1, abfd) != len)
     return false;
 
   bfd_put_32 (abfd, count, temp);
-  if (bfd_write (temp, sizeof(temp), 1, abfd) != sizeof (temp))
+  if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp))
     return false;
 
   for (i = 0; i < count; i++)
diff --git a/bfd/nlm32-ppc.c b/bfd/nlm32-ppc.c
index 5af4834..4eae8d0 100644
--- a/bfd/nlm32-ppc.c
+++ b/bfd/nlm32-ppc.c
@@ -200,344 +200,344 @@
 static reloc_howto_type nlm_powerpc_howto_table[] =
 {
   /* Standard 32 bit relocation.  */
-  HOWTO (0,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_POS",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_POS",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,            /* src_mask */
+	 0xffffffff,            /* dst_mask */
 	 false),                /* pcrel_offset */
 
   /* 32 bit relocation, but store negative value.  */
-  HOWTO (1,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 -2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (1,	                /* type */
+	 0,	                /* rightshift */
+	 -2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_NEG",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_NEG",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,            /* src_mask */
+	 0xffffffff,            /* dst_mask */
 	 false),                /* pcrel_offset */
 
   /* 32 bit PC relative relocation.  */
-  HOWTO (2,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 true,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (2,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 true,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_REL",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_REL",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,            /* src_mask */
+	 0xffffffff,            /* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* 16 bit TOC relative relocation.  */
-  HOWTO (3,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 1,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (3,	                /* type */
+	 0,	                /* rightshift */
+	 1,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_TOC",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_TOC",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* I don't really know what this is.  */
-  HOWTO (4,	                /* type */                                 
-	 1,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (4,	                /* type */
+	 1,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RTB",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,	        /* src_mask */                             
-	 0xffffffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RTB",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,	        /* src_mask */
+	 0xffffffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* External TOC relative symbol.  */
-  HOWTO (5,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (5,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_GL",                /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_GL",                /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Local TOC relative symbol.  */
-  HOWTO (6,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (6,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_TCL",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_TCL",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   { 7 },
-  
+
   /* Non modifiable absolute branch.  */
-  HOWTO (8,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 26,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (8,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 26,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_BA",                /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0x3fffffc,	        /* src_mask */                             
-	 0x3fffffc,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_BA",                /* name */
+	 true,	                /* partial_inplace */
+	 0x3fffffc,	        /* src_mask */
+	 0x3fffffc,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   { 9 },
 
   /* Non modifiable relative branch.  */
-  HOWTO (0xa,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 26,	                /* bitsize */                   
-	 true,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0xa,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 26,	                /* bitsize */
+	 true,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_BR",                /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0x3fffffc,	        /* src_mask */                             
-	 0x3fffffc,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_BR",                /* name */
+	 true,	                /* partial_inplace */
+	 0x3fffffc,	        /* src_mask */
+	 0x3fffffc,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   { 0xb },
 
   /* Indirect load.  */
-  HOWTO (0xc,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0xc,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RL",                /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RL",                /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Load address.  */
-  HOWTO (0xd,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0xd,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RLA",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RLA",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   { 0xe },
-  
+
   /* Non-relocating reference.  */
-  HOWTO (0xf,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0xf,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_REF",               /* name */                                 
-	 false,	                /* partial_inplace */                      
-	 0,		        /* src_mask */                             
-	 0,     	   	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_REF",               /* name */
+	 false,	                /* partial_inplace */
+	 0,		        /* src_mask */
+	 0,     	   	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   { 0x10 },
   { 0x11 },
-  
+
   /* TOC relative indirect load.  */
-  HOWTO (0x12,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x12,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_TRL",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_TRL",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* TOC relative load address.  */
-  HOWTO (0x13,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x13,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_TRLA",              /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_TRLA",              /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable relative branch.  */
-  HOWTO (0x14,	                /* type */                                 
-	 1,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x14,	                /* type */
+	 1,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RRTBI",             /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,	        /* src_mask */                             
-	 0xffffffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RRTBI",             /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,	        /* src_mask */
+	 0xffffffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable absolute branch.  */
-  HOWTO (0x15,	                /* type */                                 
-	 1,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x15,	                /* type */
+	 1,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RRTBA",             /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,	        /* src_mask */                             
-	 0xffffffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RRTBA",             /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,	        /* src_mask */
+	 0xffffffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable call absolute indirect.  */
-  HOWTO (0x16,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x16,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_CAI",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_CAI",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable call relative.  */
-  HOWTO (0x17,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x17,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_REL",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_REL",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable branch absolute.  */
-  HOWTO (0x18,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x18,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RBA",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RBA",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable branch absolute.  */
-  HOWTO (0x19,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x19,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_RBAC",              /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_RBAC",              /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable branch relative.  */
-  HOWTO (0x1a,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 26,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x1a,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 26,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_REL",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_REL",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false),                /* pcrel_offset */
-  
+
   /* Modifiable branch absolute.  */
-  HOWTO (0x1b,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 16,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0x1b,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 16,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_REL",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffff,	        /* src_mask */                             
-	 0xffff,        	/* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_REL",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffff,	        /* src_mask */
+	 0xffff,        	/* dst_mask */
 	 false)                 /* pcrel_offset */
 };
 
@@ -687,7 +687,7 @@
   while (sym -> rcnt < rcount)
     {
       asection *section;
-      
+
       if (nlm_powerpc_read_reloc (abfd, sym, &section,
 				  &nlm_relocs -> reloc)
 	  == false)
@@ -751,7 +751,7 @@
       val -= nlm_get_text_low (abfd);
       val |= NLM_HIBIT;
     }
-    
+
   if (! bfd_is_und_section (bfd_get_section (sym)))
     {
       /* This is an internal relocation fixup.  The second most
@@ -907,12 +907,12 @@
 #endif
 
   len = strlen (sym->name);
-  if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof(bfd_byte))
+  if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof (bfd_byte))
       || bfd_write (sym->name, len, 1, abfd) != len)
     return false;
 
   bfd_put_32 (abfd, count, temp);
-  if (bfd_write (temp, sizeof(temp), 1, abfd) != sizeof (temp))
+  if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp))
     return false;
 
   for (i = 0; i < count; i++)
diff --git a/bfd/nlm32-sparc.c b/bfd/nlm32-sparc.c
index ab4d80a..095b8bf 100644
--- a/bfd/nlm32-sparc.c
+++ b/bfd/nlm32-sparc.c
@@ -44,8 +44,8 @@
 enum reloc_type
   {
     R_SPARC_NONE = 0,
-    R_SPARC_8,		R_SPARC_16,		R_SPARC_32, 
-    R_SPARC_DISP8,	R_SPARC_DISP16,		R_SPARC_DISP32, 
+    R_SPARC_8,		R_SPARC_16,		R_SPARC_32,
+    R_SPARC_DISP8,	R_SPARC_DISP16,		R_SPARC_DISP32,
     R_SPARC_WDISP30,	R_SPARC_WDISP22,
     R_SPARC_HI22,	R_SPARC_22,
     R_SPARC_13,		R_SPARC_LO10,
@@ -78,7 +78,7 @@
 };
 #endif
 
-static reloc_howto_type nlm32_sparc_howto_table[] = 
+static reloc_howto_type nlm32_sparc_howto_table[] =
 {
   HOWTO(R_SPARC_NONE,    0,0, 0,false,0,complain_overflow_dont,    0,"R_SPARC_NONE",    false,0,0x00000000,true),
   HOWTO(R_SPARC_8,       0,0, 8,false,0,complain_overflow_bitfield,0,"R_SPARC_8",       false,0,0x000000ff,true),
@@ -145,7 +145,7 @@
   rel->howto = NULL;
 
   for (index = 0;
-       index < sizeof(nlm32_sparc_howto_table) / sizeof(reloc_howto_type);
+       index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
        index++)
     if (nlm32_sparc_howto_table[index].type == type) {
       rel->howto = &nlm32_sparc_howto_table[index];
@@ -174,9 +174,8 @@
   int type = -1;
   reloc_howto_type *tmp;
 
-  
   for (index = 0;
-       index < sizeof (nlm32_sparc_howto_table) / sizeof(reloc_howto_type);
+       index < sizeof (nlm32_sparc_howto_table) / sizeof (reloc_howto_type);
        index++) {
     tmp = &nlm32_sparc_howto_table[index];
 
@@ -192,7 +191,7 @@
     }
   }
   if (type == -1)
-    abort();
+    abort ();
 
   /*
    * Netware wants a list of relocs for each address.
@@ -219,7 +218,7 @@
 #endif
   bfd_put_32 (abfd, val, tmp_reloc.offset);
   bfd_put_32 (abfd, rel->addend, tmp_reloc.addend);
-  bfd_put_8 (abfd, (short)(rel->howto->type), tmp_reloc.type);
+  bfd_put_8 (abfd, (short) (rel->howto->type), tmp_reloc.type);
 
   if (bfd_write (&tmp_reloc, 12, 1, abfd) != 12)
     return false;
@@ -252,20 +251,20 @@
   bfd_byte temp[NLM_TARGET_LONG_SIZE];	/* temporary 32-bit value */
   unsigned char symlength;		/* length of symbol name */
   char *name;
-  
+
   /*
    * First, read in the number of relocation
    * entries for this symbol
    */
   if (bfd_read ((PTR) temp, 4, 1, abfd) != 4)
     return false;
-  
+
   rcount = bfd_get_32 (abfd, temp);
-  
+
   /*
    * Next, read in the length of the symbol
    */
-  
+
   if (bfd_read ((PTR) &symlength, sizeof (symlength), 1, abfd)
       != sizeof (symlength))
     return false;
@@ -273,11 +272,11 @@
   name = bfd_alloc (abfd, symlength + 1);
   if (name == NULL)
     return false;
-  
+
   /*
    * Then read in the symbol
    */
-  
+
   if (bfd_read (name, symlength, 1, abfd) != symlength)
     return false;
   name[symlength] = '\0';
@@ -285,11 +284,11 @@
   sym -> symbol.flags = 0;
   sym -> symbol.value = 0;
   sym -> symbol.section = bfd_und_section_ptr;
-  
+
   /*
    * Next, start reading in the relocs.
    */
-  
+
   nlm_relocs = ((struct nlm_relent *)
 		bfd_alloc (abfd, rcount * sizeof (struct nlm_relent)));
   if (!nlm_relocs)
@@ -299,7 +298,7 @@
   while (sym -> rcnt < rcount)
     {
       asection *section;
-      
+
       if (nlm_sparc_read_reloc (abfd, sym, &section,
 			      &nlm_relocs -> reloc)
 	  == false)
@@ -364,11 +363,11 @@
   unsigned char temp[NLM_TARGET_LONG_SIZE];
 
   bfd_put_32 (abfd, count, temp);
-  if (bfd_write (temp, sizeof(temp), 1, abfd) != sizeof (temp))
+  if (bfd_write (temp, sizeof (temp), 1, abfd) != sizeof (temp))
     return false;
 
   len = strlen (sym->name);
-  if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof(bfd_byte))
+  if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof (bfd_byte))
       || bfd_write (sym->name, len, 1, abfd) != len)
     return false;
 
diff --git a/bfd/nlmcode.h b/bfd/nlmcode.h
index ad1a2f8..b49c75e 100644
--- a/bfd/nlmcode.h
+++ b/bfd/nlmcode.h
@@ -52,9 +52,9 @@
 #define nlm_write_object_contents	nlmNAME(write_object_contents)
 
 #define nlm_swap_fixed_header_in(abfd,src,dst) \
-  (nlm_swap_fixed_header_in_func(abfd))(abfd,src,dst)
+  (nlm_swap_fixed_header_in_func(abfd)) (abfd,src,dst)
 #define nlm_swap_fixed_header_out(abfd,src,dst) \
-  (nlm_swap_fixed_header_out_func(abfd))(abfd,src,dst)
+  (nlm_swap_fixed_header_out_func(abfd)) (abfd,src,dst)
 
 /* Forward declarations of static functions */
 
@@ -142,7 +142,7 @@
   x_fxdhdr = NULL;
 
   /* Check to see if we have an NLM file for this backend by matching
-     the NLM signature. */
+     the NLM signature.  */
 
   signature = nlm_signature (abfd);
   if (signature != NULL
@@ -223,7 +223,7 @@
   return (NULL);
 }
 
-/* Add a section to the bfd. */
+/* Add a section to the bfd.  */
 
 static boolean
 add_bfd_section (abfd, name, offset, size, flags)
@@ -240,7 +240,7 @@
     {
       return (false);
     }
-  newsect->vma = 0;		/* NLM's are relocatable. */
+  newsect->vma = 0;		/* NLM's are relocatable.  */
   newsect->_raw_size = size;
   newsect->filepos = offset;
   newsect->flags = flags;
@@ -249,7 +249,7 @@
 }
 
 /* Read and swap in the variable length header.  All the fields must
-   exist in the NLM, and must exist in the order they are read here. */
+   exist in the NLM, and must exist in the order they are read here.  */
 
 static boolean
 nlm_swap_variable_header_in (abfd)
@@ -257,7 +257,7 @@
 {
   unsigned char temp[NLM_TARGET_LONG_SIZE];
 
-  /* Read the description length and text members. */
+  /* Read the description length and text members.  */
 
   if (bfd_read ((PTR) & nlm_variable_header (abfd)->descriptionLength,
 		sizeof (nlm_variable_header (abfd)->descriptionLength),
@@ -270,19 +270,19 @@
       (bfd_size_type) nlm_variable_header (abfd)->descriptionLength + 1)
     return (false);
 
-  /* Read and convert the stackSize field. */
+  /* Read and convert the stackSize field.  */
 
   if (bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp))
     return (false);
   nlm_variable_header (abfd)->stackSize = get_word (abfd, (bfd_byte *) temp);
 
-  /* Read and convert the reserved field. */
+  /* Read and convert the reserved field.  */
 
   if (bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp))
     return (false);
   nlm_variable_header (abfd)->reserved = get_word (abfd, (bfd_byte *) temp);
 
-  /* Read the oldThreadName field.  This field is a fixed length string. */
+  /* Read the oldThreadName field.  This field is a fixed length string.  */
 
   if (bfd_read ((PTR) nlm_variable_header (abfd)->oldThreadName,
 		sizeof (nlm_variable_header (abfd)->oldThreadName),
@@ -290,7 +290,7 @@
       sizeof (nlm_variable_header (abfd)->oldThreadName))
     return (false);
 
-  /* Read the screen name length and text members. */
+  /* Read the screen name length and text members.  */
 
   if (bfd_read ((PTR) & nlm_variable_header (abfd)->screenNameLength,
 		sizeof (nlm_variable_header (abfd)->screenNameLength),
@@ -303,7 +303,7 @@
       (bfd_size_type) nlm_variable_header (abfd)->screenNameLength + 1)
     return (false);
 
-  /* Read the thread name length and text members. */
+  /* Read the thread name length and text members.  */
 
   if (bfd_read ((PTR) & nlm_variable_header (abfd)->threadNameLength,
 		sizeof (nlm_variable_header (abfd)->threadNameLength),
@@ -327,7 +327,7 @@
 {
   unsigned char temp[NLM_TARGET_LONG_SIZE];
 
-  /* Write the description length and text members. */
+  /* Write the description length and text members.  */
 
   if (bfd_write ((PTR) & nlm_variable_header (abfd)->descriptionLength,
 		 sizeof (nlm_variable_header (abfd)->descriptionLength),
@@ -340,21 +340,21 @@
       (bfd_size_type) nlm_variable_header (abfd)->descriptionLength + 1)
     return (false);
 
-  /* Convert and write the stackSize field. */
+  /* Convert and write the stackSize field.  */
 
   put_word (abfd, (bfd_vma) nlm_variable_header (abfd)->stackSize,
 	    (bfd_byte *) temp);
   if (bfd_write ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp))
     return (false);
 
-  /* Convert and write the reserved field. */
+  /* Convert and write the reserved field.  */
 
   put_word (abfd, (bfd_vma) nlm_variable_header (abfd)->reserved,
 	    (bfd_byte *) temp);
   if (bfd_write ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp))
     return (false);
 
-  /* Write the oldThreadName field.  This field is a fixed length string. */
+  /* Write the oldThreadName field.  This field is a fixed length string.  */
 
   if (bfd_write ((PTR) nlm_variable_header (abfd)->oldThreadName,
 		 sizeof (nlm_variable_header (abfd)->oldThreadName),
@@ -362,7 +362,7 @@
       sizeof (nlm_variable_header (abfd)->oldThreadName))
     return (false);
 
-  /* Write the screen name length and text members. */
+  /* Write the screen name length and text members.  */
 
   if (bfd_write ((PTR) & nlm_variable_header (abfd)->screenNameLength,
 		 sizeof (nlm_variable_header (abfd)->screenNameLength),
@@ -375,7 +375,7 @@
       (bfd_size_type) nlm_variable_header (abfd)->screenNameLength + 1)
     return (false);
 
-  /* Write the thread name length and text members. */
+  /* Write the thread name length and text members.  */
 
   if (bfd_write ((PTR) & nlm_variable_header (abfd)->threadNameLength,
 		 sizeof (nlm_variable_header (abfd)->threadNameLength),
@@ -397,7 +397,7 @@
    of the auxiliary headers are, except by finding something that doesn't
    look like a known auxiliary header.  This means that the first new type
    of auxiliary header added will break all existing tools that don't
-   recognize it. */
+   recognize it.  */
 
 static boolean
 nlm_swap_auxiliary_headers_in (abfd)
@@ -511,7 +511,7 @@
 				 ->copyrightMessageLength),
 			1, 1, abfd) != 1)
 	    return (false);
-	  /* The copyright message is a variable length string. */
+	  /* The copyright message is a variable length string.  */
 	  if (bfd_read ((PTR) nlm_copyright_header (abfd)->copyrightMessage,
 		    nlm_copyright_header (abfd)->copyrightMessageLength + 1,
 			1, abfd) !=
@@ -820,7 +820,6 @@
 	return false;
     }
 
-
   /* Write out the copyright header if there is one.  */
   if (find_nonzero ((PTR) nlm_copyright_header (abfd),
 		    sizeof (Nlm_Internal_Copyright_Header)))
@@ -835,7 +834,7 @@
 	nlm_copyright_header (abfd)->copyrightMessageLength;
       if (bfd_write ((PTR) thdr.copyrightMessageLength, 1, 1, abfd) != 1)
 	return false;
-      /* The copyright message is a variable length string. */
+      /* The copyright message is a variable length string.  */
       if (bfd_write ((PTR) nlm_copyright_header (abfd)->copyrightMessage,
 		     nlm_copyright_header (abfd)->copyrightMessageLength + 1,
 		     1, abfd) !=
@@ -911,7 +910,7 @@
 
    Return the number of bytes required to hold the symtab vector, based on
    the count plus 1, since we will NULL terminate the vector allocated based
-   on this size. */
+   on this size.  */
 
 long
 nlm_get_symtab_upper_bound (abfd)
@@ -930,7 +929,7 @@
 }
 
 /* Note that bfd_get_symcount is guaranteed to be zero if slurping the
-   symbol table fails. */
+   symbol table fails.  */
 
 long
 nlm_get_symtab (abfd, alocation)
@@ -1048,7 +1047,7 @@
      Note that we allocate the initial bfd canonical symbol buffer based on a
      one-to-one mapping of the NLM symbols to canonical symbols.  We actually
      use all the NLM symbols, so there will be no space left over at the end.
-     When we have all the symbols, we build the caller's pointer vector. */
+     When we have all the symbols, we build the caller's pointer vector.  */
 
   abfd->symcount = 0;
   i_fxdhdrp = nlm_fixed_header (abfd);
@@ -1071,7 +1070,7 @@
 
   /* We use the bfd's symcount directly as the control count, so that early
      termination of the loop leaves the symcount correct for the symbols that
-     were read. */
+     were read.  */
 
   set_public_section_func = nlm_set_public_section_func (abfd);
   symcount = i_fxdhdrp->numberOfPublics;
diff --git a/bfd/nlmswap.h b/bfd/nlmswap.h
index 5a9ce72..e6d2886 100644
--- a/bfd/nlmswap.h
+++ b/bfd/nlmswap.h
@@ -36,7 +36,7 @@
 					       PTR));
 
 /* Translate an NLM fixed length file header in external format into an NLM
-   file header in internal format. */
+   file header in internal format.  */
 
 static void
 nlm_swap_fixed_header_in (abfd, realsrc, dst)
@@ -96,7 +96,7 @@
 }
 
 /* Translate an NLM fixed length file header in internal format into
-   an NLM file header in external format. */
+   an NLM file header in external format.  */
 
 static void
 nlm_swap_fixed_header_out (abfd, src, realdst)
diff --git a/bfd/ns32knetbsd.c b/bfd/ns32knetbsd.c
index a22356d..f7fd8ce 100644
--- a/bfd/ns32knetbsd.c
+++ b/bfd/ns32knetbsd.c
@@ -15,7 +15,7 @@
 
 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.  */
 
 #define	BYTES_IN_WORD	4
 #undef TARGET_IS_BIG_ENDIAN_P
@@ -49,5 +49,4 @@
   PARAMS((bfd *abfd AND
 	  bfd_reloc_code_real_type code));
 
-
 #include "netbsd.h"
diff --git a/bfd/peicode.h b/bfd/peicode.h
index 1c58ad0..22ddb2a 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -69,7 +69,6 @@
 static boolean pe_print_private_bfd_data PARAMS ((bfd *, PTR));
 #define coff_bfd_print_private_bfd_data pe_print_private_bfd_data
 
-
 static boolean (*pe_saved_coff_bfd_copy_private_bfd_data)
     PARAMS ((bfd *, bfd *)) =
 #ifndef coff_bfd_copy_private_bfd_data
@@ -138,7 +137,7 @@
 static void               pe_ILF_make_a_reloc     PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type, asection_ptr));
 static void               pe_ILF_make_a_symbol    PARAMS ((pe_ILF_vars *, const char *, const char *, asection_ptr, flagword));
 static void               pe_ILF_save_relocs      PARAMS ((pe_ILF_vars *, asection_ptr));
-static void		  pe_ILF_make_a_symbol_reloc  PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type,	   struct symbol_cache_entry **, unsigned int));
+static void		  pe_ILF_make_a_symbol_reloc  PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type, struct symbol_cache_entry **, unsigned int));
 static boolean            pe_ILF_build_a_bfd      PARAMS ((bfd *, unsigned short, bfd_byte *, bfd_byte *, unsigned int, unsigned int));
 static const bfd_target * pe_ILF_object_p         PARAMS ((bfd *));
 static const bfd_target * pe_bfd_object_p 	  PARAMS ((bfd *));
@@ -221,9 +220,14 @@
      correctly for a PEI file, check the e_magic number here, and, if
      it doesn't match, clobber the f_magic number so that we don't get
      a false match.  */
+#if 0
+  /* We can't assume that the PE header is at offset 0x80.  When it
+     isn't, the DOS header isn't read correctly, so we can't assume
+     e_magic is set even for valid PE files. */
   if (bfd_h_get_16 (abfd, (bfd_byte *) filehdr_src->e_magic) != DOSMAGIC)
     filehdr_dst->f_magic = -1;
 #endif
+#endif
 
   /* Other people's tools sometimes generate headers with an nsyms but
      a zero symptr.  */
@@ -243,7 +247,6 @@
 #define coff_swap_filehdr_out _bfd_pe_only_swap_filehdr_out
 #endif
 
-
 static void
 coff_swap_scnhdr_in (abfd, ext, in)
      bfd            *abfd;
@@ -986,10 +989,10 @@
       if (magic == MIPS_ARCH_MAGIC_WINCE)
 	{
 	  pe_ILF_make_a_symbol_reloc (& vars, 0, BFD_RELOC_HI16_S,
-				      (asection **) imp_sym, imp_index);
+				      (struct symbol_cache_entry **) imp_sym, imp_index);
 	  pe_ILF_make_a_reloc (& vars, 0, BFD_RELOC_LO16, text);
 	  pe_ILF_make_a_symbol_reloc (& vars, 4, BFD_RELOC_LO16,
-				      (asection **) imp_sym, imp_index);
+				      (struct symbol_cache_entry **) imp_sym, imp_index);
 	}
       else
 #endif
@@ -1166,9 +1169,9 @@
     case IMAGE_FILE_MACHINE_THUMB:
 #ifdef THUMBPEMAGIC
       {
-	extern bfd_target armpei_little_vec;
+	extern const bfd_target TARGET_LITTLE_SYM;
 	
-	if (abfd->xvec == & armpei_little_vec)
+	if (abfd->xvec == & TARGET_LITTLE_SYM)
 	  magic = THUMBPEMAGIC;
       }
 #endif      
diff --git a/bfd/peigen.c b/bfd/peigen.c
index 6c983ca..094920c 100644
--- a/bfd/peigen.c
+++ b/bfd/peigen.c
@@ -18,12 +18,10 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-/*
-Most of this hacked by  Steve Chamberlain,
-			sac@cygnus.com
+/* Most of this hacked by Steve Chamberlain <sac@cygnus.com>.
 
-PE/PEI rearrangement (and code added): Donn Terry
-				       Softway Systems, Inc.
+   PE/PEI rearrangement (and code added): Donn Terry
+					  Softway Systems, Inc.
 */
 
 /* Hey look, some documentation [and in a place you expect to find it]!
@@ -91,30 +89,35 @@
      PTR ext1;
      PTR in1;
 {
-  SYMENT *ext = (SYMENT *)ext1;
-  struct internal_syment      *in = (struct internal_syment *)in1;
+  SYMENT *ext = (SYMENT *) ext1;
+  struct internal_syment *in = (struct internal_syment *) in1;
 
-  if( ext->e.e_name[0] == 0) {
-    in->_n._n_n._n_zeroes = 0;
-    in->_n._n_n._n_offset = bfd_h_get_32(abfd, (bfd_byte *) ext->e.e.e_offset);
-  }
-  else {
-    memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN);
-  }
+  if (ext->e.e_name[0] == 0)
+    {
+      in->_n._n_n._n_zeroes = 0;
+      in->_n._n_n._n_offset =
+	bfd_h_get_32 (abfd, (bfd_byte *) ext->e.e.e_offset);
+    }
+  else
+    {
+      memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN);
+    }
 
-  in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value);
-  in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum);
-  if (sizeof(ext->e_type) == 2){
-    in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type);
-  }
-  else {
-    in->n_type = bfd_h_get_32(abfd, (bfd_byte *) ext->e_type);
-  }
-  in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass);
-  in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux);
+  in->n_value = bfd_h_get_32 (abfd, (bfd_byte *) ext->e_value);
+  in->n_scnum = bfd_h_get_16 (abfd, (bfd_byte *) ext->e_scnum);
+  if (sizeof (ext->e_type) == 2)
+    {
+      in->n_type = bfd_h_get_16 (abfd, (bfd_byte *) ext->e_type);
+    }
+  else
+    {
+      in->n_type = bfd_h_get_32 (abfd, (bfd_byte *) ext->e_type);
+    }
+  in->n_sclass = bfd_h_get_8 (abfd, ext->e_sclass);
+  in->n_numaux = bfd_h_get_8 (abfd, ext->e_numaux);
 
 #ifndef STRICT_PE_FORMAT
-  /* This is for Gnu-created DLLs */
+  /* This is for Gnu-created DLLs.  */
 
   /* The section symbols for the .idata$ sections have class 0x68
      (C_SECTION), which MS documentation indicates is a section
@@ -136,17 +139,19 @@
       /* I have tried setting the class to 3 and using the following
 	 to set the section number.  This will put the address of the
 	 pointer to the string kernel32.dll at addresses 0 and 0x10
-	 off start of idata section which is not correct */
-      /*    if (strcmp (in->_n._n_name, ".idata$4") == 0) */
-      /*      in->n_scnum = 3; */
-      /*    else */
-      /*      in->n_scnum = 2; */
+	 off start of idata section which is not correct.  */
+#if 0
+      if (strcmp (in->_n._n_name, ".idata$4") == 0)
+	in->n_scnum = 3;
+      else
+	in->n_scnum = 2;
+#endif
 #else
       /* Create synthetic empty sections as needed.  DJ */
       if (in->n_scnum == 0)
 	{
 	  asection *sec;
-	  for (sec=abfd->sections; sec; sec=sec->next)
+	  for (sec = abfd->sections; sec; sec = sec->next)
 	    {
 	      if (strcmp (sec->name, in->n_name) == 0)
 		{
@@ -160,9 +165,9 @@
 	  int unused_section_number = 0;
 	  asection *sec;
 	  char *name;
-	  for (sec=abfd->sections; sec; sec=sec->next)
+	  for (sec = abfd->sections; sec; sec = sec->next)
 	    if (unused_section_number <= sec->target_index)
-	      unused_section_number = sec->target_index+1;
+	      unused_section_number = sec->target_index + 1;
 
 	  name = bfd_alloc (abfd, strlen (in->n_name) + 10);
 	  if (name == NULL)
@@ -196,8 +201,8 @@
 
 #ifdef coff_swap_sym_in_hook
   /* This won't work in peigen.c, but since it's for PPC PE, it's not
-     worth fixing. */
-  coff_swap_sym_in_hook(abfd, ext1, in1);
+     worth fixing.  */
+  coff_swap_sym_in_hook (abfd, ext1, in1);
 #endif
 }
 
@@ -207,28 +212,30 @@
      PTR	inp;
      PTR	extp;
 {
-  struct internal_syment *in = (struct internal_syment *)inp;
-  SYMENT *ext =(SYMENT *)extp;
-  if(in->_n._n_name[0] == 0) {
-    bfd_h_put_32(abfd, 0, (bfd_byte *) ext->e.e.e_zeroes);
-    bfd_h_put_32(abfd, in->_n._n_n._n_offset, (bfd_byte *)  ext->e.e.e_offset);
-  }
-  else {
-    memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN);
-  }
-
-  bfd_h_put_32(abfd,  in->n_value , (bfd_byte *) ext->e_value);
-  bfd_h_put_16(abfd,  in->n_scnum , (bfd_byte *) ext->e_scnum);
-  if (sizeof(ext->e_type) == 2)
+  struct internal_syment *in = (struct internal_syment *) inp;
+  SYMENT *ext = (SYMENT *) extp;
+  if (in->_n._n_name[0] == 0)
     {
-      bfd_h_put_16(abfd,  in->n_type , (bfd_byte *) ext->e_type);
+      bfd_h_put_32 (abfd, 0, (bfd_byte *) ext->e.e.e_zeroes);
+      bfd_h_put_32 (abfd, in->_n._n_n._n_offset, (bfd_byte *) ext->e.e.e_offset);
     }
   else
     {
-      bfd_h_put_32(abfd,  in->n_type , (bfd_byte *) ext->e_type);
+      memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN);
     }
-  bfd_h_put_8(abfd,  in->n_sclass , ext->e_sclass);
-  bfd_h_put_8(abfd,  in->n_numaux , ext->e_numaux);
+
+  bfd_h_put_32 (abfd, in->n_value, (bfd_byte *) ext->e_value);
+  bfd_h_put_16 (abfd, in->n_scnum, (bfd_byte *) ext->e_scnum);
+  if (sizeof (ext->e_type) == 2)
+    {
+      bfd_h_put_16 (abfd, in->n_type, (bfd_byte *) ext->e_type);
+    }
+  else
+    {
+      bfd_h_put_32 (abfd, in->n_type, (bfd_byte *) ext->e_type);
+    }
+  bfd_h_put_8 (abfd, in->n_sclass, ext->e_sclass);
+  bfd_h_put_8 (abfd, in->n_numaux, ext->e_numaux);
 
   return SYMESZ;
 }
@@ -243,41 +250,45 @@
      int	     numaux ATTRIBUTE_UNUSED;
      PTR 	     in1;
 {
-  AUXENT    *ext = (AUXENT *)ext1;
-  union internal_auxent *in = (union internal_auxent *)in1;
+  AUXENT *ext = (AUXENT *) ext1;
+  union internal_auxent *in = (union internal_auxent *) in1;
 
-  switch (class) {
-  case C_FILE:
-    if (ext->x_file.x_fname[0] == 0) {
-      in->x_file.x_n.x_zeroes = 0;
-      in->x_file.x_n.x_offset =
-	bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
-    } else {
-      memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
-    }
-    return;
-
-
-  case C_STAT:
-  case C_LEAFSTAT:
-  case C_HIDDEN:
-    if (type == T_NULL) {
-      in->x_scn.x_scnlen = GET_SCN_SCNLEN(abfd, ext);
-      in->x_scn.x_nreloc = GET_SCN_NRELOC(abfd, ext);
-      in->x_scn.x_nlinno = GET_SCN_NLINNO(abfd, ext);
-      in->x_scn.x_checksum = bfd_h_get_32 (abfd,
-					   (bfd_byte *) ext->x_scn.x_checksum);
-      in->x_scn.x_associated =
-	bfd_h_get_16 (abfd, (bfd_byte *) ext->x_scn.x_associated);
-      in->x_scn.x_comdat = bfd_h_get_8 (abfd,
-					(bfd_byte *) ext->x_scn.x_comdat);
+  switch (class)
+    {
+    case C_FILE:
+      if (ext->x_file.x_fname[0] == 0)
+	{
+	  in->x_file.x_n.x_zeroes = 0;
+	  in->x_file.x_n.x_offset =
+	    bfd_h_get_32 (abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
+	}
+      else
+	{
+	  memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
+	}
       return;
-    }
-    break;
-  }
 
-  in->x_sym.x_tagndx.l = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_tagndx);
-  in->x_sym.x_tvndx = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_tvndx);
+    case C_STAT:
+    case C_LEAFSTAT:
+    case C_HIDDEN:
+      if (type == T_NULL)
+	{
+	  in->x_scn.x_scnlen = GET_SCN_SCNLEN (abfd, ext);
+	  in->x_scn.x_nreloc = GET_SCN_NRELOC (abfd, ext);
+	  in->x_scn.x_nlinno = GET_SCN_NLINNO (abfd, ext);
+	  in->x_scn.x_checksum =
+	    bfd_h_get_32 (abfd, (bfd_byte *) ext->x_scn.x_checksum);
+	  in->x_scn.x_associated =
+	    bfd_h_get_16 (abfd, (bfd_byte *) ext->x_scn.x_associated);
+	  in->x_scn.x_comdat =
+	    bfd_h_get_8 (abfd, (bfd_byte *) ext->x_scn.x_comdat);
+	  return;
+	}
+      break;
+    }
+
+  in->x_sym.x_tagndx.l = bfd_h_get_32 (abfd, (bfd_byte *) ext->x_sym.x_tagndx);
+  in->x_sym.x_tvndx = bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_tvndx);
 
   if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
     {
@@ -296,13 +307,16 @@
 	bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
     }
 
-  if (ISFCN(type)) {
-    in->x_sym.x_misc.x_fsize = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize);
-  }
-  else {
-    in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO(abfd, ext);
-    in->x_sym.x_misc.x_lnsz.x_size = GET_LNSZ_SIZE(abfd, ext);
-  }
+  if (ISFCN (type))
+    {
+      in->x_sym.x_misc.x_fsize =
+	bfd_h_get_32 (abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize);
+    }
+  else
+    {
+      in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO (abfd, ext);
+      in->x_sym.x_misc.x_lnsz.x_size = GET_LNSZ_SIZE (abfd, ext);
+    }
 }
 
 unsigned int
@@ -315,49 +329,52 @@
      int   numaux ATTRIBUTE_UNUSED;
      PTR   extp;
 {
-  union internal_auxent *in = (union internal_auxent *)inp;
-  AUXENT *ext = (AUXENT *)extp;
+  union internal_auxent *in = (union internal_auxent *) inp;
+  AUXENT *ext = (AUXENT *) extp;
 
-  memset((PTR)ext, 0, AUXESZ);
-  switch (class) {
-  case C_FILE:
-    if (in->x_file.x_fname[0] == 0) {
-      bfd_h_put_32(abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes);
-      bfd_h_put_32(abfd,
-	      in->x_file.x_n.x_offset,
-	      (bfd_byte *) ext->x_file.x_n.x_offset);
-    }
-    else {
-      memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
-    }
-    return AUXESZ;
-
-
-  case C_STAT:
-  case C_LEAFSTAT:
-  case C_HIDDEN:
-    if (type == T_NULL) {
-      PUT_SCN_SCNLEN(abfd, in->x_scn.x_scnlen, ext);
-      PUT_SCN_NRELOC(abfd, in->x_scn.x_nreloc, ext);
-      PUT_SCN_NLINNO(abfd, in->x_scn.x_nlinno, ext);
-      bfd_h_put_32 (abfd, in->x_scn.x_checksum,
-		    (bfd_byte *) ext->x_scn.x_checksum);
-      bfd_h_put_16 (abfd, in->x_scn.x_associated,
-		    (bfd_byte *) ext->x_scn.x_associated);
-      bfd_h_put_8 (abfd, in->x_scn.x_comdat,
-		   (bfd_byte *) ext->x_scn.x_comdat);
+  memset ((PTR) ext, 0, AUXESZ);
+  switch (class)
+    {
+    case C_FILE:
+      if (in->x_file.x_fname[0] == 0)
+	{
+	  bfd_h_put_32 (abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes);
+	  bfd_h_put_32 (abfd,
+			in->x_file.x_n.x_offset,
+			(bfd_byte *) ext->x_file.x_n.x_offset);
+	}
+      else
+	{
+	  memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
+	}
       return AUXESZ;
-    }
-    break;
-  }
 
-  bfd_h_put_32(abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx);
-  bfd_h_put_16(abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx);
+    case C_STAT:
+    case C_LEAFSTAT:
+    case C_HIDDEN:
+      if (type == T_NULL)
+	{
+	  PUT_SCN_SCNLEN (abfd, in->x_scn.x_scnlen, ext);
+	  PUT_SCN_NRELOC (abfd, in->x_scn.x_nreloc, ext);
+	  PUT_SCN_NLINNO (abfd, in->x_scn.x_nlinno, ext);
+	  bfd_h_put_32 (abfd, in->x_scn.x_checksum,
+			(bfd_byte *) ext->x_scn.x_checksum);
+	  bfd_h_put_16 (abfd, in->x_scn.x_associated,
+			(bfd_byte *) ext->x_scn.x_associated);
+	  bfd_h_put_8 (abfd, in->x_scn.x_comdat,
+		       (bfd_byte *) ext->x_scn.x_comdat);
+	  return AUXESZ;
+	}
+      break;
+    }
+
+  bfd_h_put_32 (abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx);
+  bfd_h_put_16 (abfd, in->x_sym.x_tvndx, (bfd_byte *) ext->x_sym.x_tvndx);
 
   if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
     {
-      PUT_FCN_LNNOPTR(abfd,  in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext);
-      PUT_FCN_ENDNDX(abfd,  in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext);
+      PUT_FCN_LNNOPTR (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr,  ext);
+      PUT_FCN_ENDNDX  (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext);
     }
   else
     {
@@ -373,7 +390,7 @@
 
   if (ISFCN (type))
     bfd_h_put_32 (abfd, in->x_sym.x_misc.x_fsize,
-	     (bfd_byte *)  ext->x_sym.x_misc.x_fsize);
+		  (bfd_byte *) ext->x_sym.x_misc.x_fsize);
   else
     {
       PUT_LNSZ_LNNO (abfd, in->x_sym.x_misc.x_lnsz.x_lnno, ext);
@@ -389,11 +406,11 @@
      PTR ext1;
      PTR in1;
 {
-  LINENO *ext = (LINENO *)ext1;
-  struct internal_lineno      *in = (struct internal_lineno *)in1;
+  LINENO *ext = (LINENO *) ext1;
+  struct internal_lineno *in = (struct internal_lineno *) in1;
 
-  in->l_addr.l_symndx = bfd_h_get_32(abfd, (bfd_byte *) ext->l_addr.l_symndx);
-  in->l_lnno = GET_LINENO_LNNO(abfd, ext);
+  in->l_addr.l_symndx = bfd_h_get_32 (abfd, (bfd_byte *) ext->l_addr.l_symndx);
+  in->l_lnno = GET_LINENO_LNNO (abfd, ext);
 }
 
 unsigned int
@@ -402,9 +419,9 @@
      PTR	inp;
      PTR	outp;
 {
-  struct internal_lineno *in = (struct internal_lineno *)inp;
-  struct external_lineno *ext = (struct external_lineno *)outp;
-  bfd_h_put_32(abfd, in->l_addr.l_symndx, (bfd_byte *)
+  struct internal_lineno *in = (struct internal_lineno *) inp;
+  struct external_lineno *ext = (struct external_lineno *) outp;
+  bfd_h_put_32 (abfd, in->l_addr.l_symndx, (bfd_byte *)
 	  ext->l_addr.l_symndx);
 
   PUT_LINENO_LNNO (abfd, in->l_lnno, ext);
@@ -418,12 +435,12 @@
      PTR aouthdr_int1;
 {
   struct internal_extra_pe_aouthdr *a;
-  PEAOUTHDR *src = (PEAOUTHDR *)(aouthdr_ext1);
+  PEAOUTHDR *src = (PEAOUTHDR *) (aouthdr_ext1);
   AOUTHDR        *aouthdr_ext = (AOUTHDR *) aouthdr_ext1;
   struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1;
 
-  aouthdr_int->magic = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->magic);
-  aouthdr_int->vstamp = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->vstamp);
+  aouthdr_int->magic = bfd_h_get_16 (abfd, (bfd_byte *) aouthdr_ext->magic);
+  aouthdr_int->vstamp = bfd_h_get_16 (abfd, (bfd_byte *) aouthdr_ext->vstamp);
   aouthdr_int->tsize =
     GET_AOUTHDR_TSIZE (abfd, (bfd_byte *) aouthdr_ext->tsize);
   aouthdr_int->dsize =
@@ -441,38 +458,46 @@
 #endif
 
   a = &aouthdr_int->pe;
-  a->ImageBase = GET_OPTHDR_IMAGE_BASE (abfd, (bfd_byte *)src->ImageBase);
-  a->SectionAlignment = bfd_h_get_32 (abfd, (bfd_byte *)src->SectionAlignment);
-  a->FileAlignment = bfd_h_get_32 (abfd, (bfd_byte *)src->FileAlignment);
+  a->ImageBase = GET_OPTHDR_IMAGE_BASE (abfd, (bfd_byte *) src->ImageBase);
+  a->SectionAlignment = bfd_h_get_32 (abfd, (bfd_byte *) src->SectionAlignment);
+  a->FileAlignment = bfd_h_get_32 (abfd, (bfd_byte *) src->FileAlignment);
   a->MajorOperatingSystemVersion =
-    bfd_h_get_16 (abfd, (bfd_byte *)src->MajorOperatingSystemVersion);
+    bfd_h_get_16 (abfd, (bfd_byte *) src->MajorOperatingSystemVersion);
   a->MinorOperatingSystemVersion =
-    bfd_h_get_16 (abfd, (bfd_byte *)src->MinorOperatingSystemVersion);
-  a->MajorImageVersion = bfd_h_get_16 (abfd, (bfd_byte *)src->MajorImageVersion);
-  a->MinorImageVersion = bfd_h_get_16 (abfd, (bfd_byte *)src->MinorImageVersion);
-  a->MajorSubsystemVersion = bfd_h_get_16 (abfd, (bfd_byte *)src->MajorSubsystemVersion);
-  a->MinorSubsystemVersion = bfd_h_get_16 (abfd, (bfd_byte *)src->MinorSubsystemVersion);
-  a->Reserved1 = bfd_h_get_32 (abfd, (bfd_byte *)src->Reserved1);
-  a->SizeOfImage = bfd_h_get_32 (abfd, (bfd_byte *)src->SizeOfImage);
-  a->SizeOfHeaders = bfd_h_get_32 (abfd, (bfd_byte *)src->SizeOfHeaders);
-  a->CheckSum = bfd_h_get_32 (abfd, (bfd_byte *)src->CheckSum);
-  a->Subsystem = bfd_h_get_16 (abfd, (bfd_byte *)src->Subsystem);
-  a->DllCharacteristics = bfd_h_get_16 (abfd, (bfd_byte *)src->DllCharacteristics);
-  a->SizeOfStackReserve = GET_OPTHDR_SIZE_OF_STACK_RESERVE (abfd, (bfd_byte *)src->SizeOfStackReserve);
-  a->SizeOfStackCommit = GET_OPTHDR_SIZE_OF_STACK_COMMIT (abfd, (bfd_byte *)src->SizeOfStackCommit);
-  a->SizeOfHeapReserve = GET_OPTHDR_SIZE_OF_HEAP_RESERVE (abfd, (bfd_byte *)src->SizeOfHeapReserve);
-  a->SizeOfHeapCommit = GET_OPTHDR_SIZE_OF_HEAP_COMMIT (abfd, (bfd_byte *)src->SizeOfHeapCommit);
-  a->LoaderFlags = bfd_h_get_32 (abfd, (bfd_byte *)src->LoaderFlags);
-  a->NumberOfRvaAndSizes = bfd_h_get_32 (abfd, (bfd_byte *)src->NumberOfRvaAndSizes);
+    bfd_h_get_16 (abfd, (bfd_byte *) src->MinorOperatingSystemVersion);
+  a->MajorImageVersion = bfd_h_get_16 (abfd, (bfd_byte *) src->MajorImageVersion);
+  a->MinorImageVersion = bfd_h_get_16 (abfd, (bfd_byte *) src->MinorImageVersion);
+  a->MajorSubsystemVersion = bfd_h_get_16 (abfd, (bfd_byte *) src->MajorSubsystemVersion);
+  a->MinorSubsystemVersion = bfd_h_get_16 (abfd, (bfd_byte *) src->MinorSubsystemVersion);
+  a->Reserved1 = bfd_h_get_32 (abfd, (bfd_byte *) src->Reserved1);
+  a->SizeOfImage = bfd_h_get_32 (abfd, (bfd_byte *) src->SizeOfImage);
+  a->SizeOfHeaders = bfd_h_get_32 (abfd, (bfd_byte *) src->SizeOfHeaders);
+  a->CheckSum = bfd_h_get_32 (abfd, (bfd_byte *) src->CheckSum);
+  a->Subsystem = bfd_h_get_16 (abfd, (bfd_byte *) src->Subsystem);
+  a->DllCharacteristics = bfd_h_get_16 (abfd, (bfd_byte *) src->DllCharacteristics);
+  a->SizeOfStackReserve = GET_OPTHDR_SIZE_OF_STACK_RESERVE (abfd, (bfd_byte *) src->SizeOfStackReserve);
+  a->SizeOfStackCommit = GET_OPTHDR_SIZE_OF_STACK_COMMIT (abfd, (bfd_byte *) src->SizeOfStackCommit);
+  a->SizeOfHeapReserve = GET_OPTHDR_SIZE_OF_HEAP_RESERVE (abfd, (bfd_byte *) src->SizeOfHeapReserve);
+  a->SizeOfHeapCommit = GET_OPTHDR_SIZE_OF_HEAP_COMMIT (abfd, (bfd_byte *) src->SizeOfHeapCommit);
+  a->LoaderFlags = bfd_h_get_32 (abfd, (bfd_byte *) src->LoaderFlags);
+  a->NumberOfRvaAndSizes = bfd_h_get_32 (abfd, (bfd_byte *) src->NumberOfRvaAndSizes);
 
   {
     int idx;
-    for (idx=0; idx < 16; idx++)
+    for (idx = 0; idx < 16; idx++)
       {
-	a->DataDirectory[idx].VirtualAddress =
-	  bfd_h_get_32 (abfd, (bfd_byte *)src->DataDirectory[idx][0]);
-	a->DataDirectory[idx].Size =
-	  bfd_h_get_32 (abfd, (bfd_byte *)src->DataDirectory[idx][1]);
+        /* If data directory is empty, rva also should be 0.  */
+	int size =
+	  bfd_h_get_32 (abfd, (bfd_byte *) src->DataDirectory[idx][1]);
+	a->DataDirectory[idx].Size = size;
+
+	if (size)
+	  {
+	    a->DataDirectory[idx].VirtualAddress =
+	      bfd_h_get_32 (abfd, (bfd_byte *) src->DataDirectory[idx][0]);
+	  }
+	else
+	  a->DataDirectory[idx].VirtualAddress = 0;
       }
   }
 
@@ -483,7 +508,7 @@
       aouthdr_int->entry &= 0xffffffff;
 #endif
     }
-  if (aouthdr_int->tsize) 
+  if (aouthdr_int->tsize)
     {
       aouthdr_int->text_start += a->ImageBase;
 #ifndef COFF_WITH_PEP64
@@ -492,7 +517,7 @@
     }
 #ifndef COFF_WITH_PEP64
   /* PE32+ does not have data_start member! */
-  if (aouthdr_int->dsize) 
+  if (aouthdr_int->dsize)
     {
       aouthdr_int->data_start += a->ImageBase;
       aouthdr_int->data_start &= 0xffffffff;
@@ -503,7 +528,7 @@
   /* These three fields are normally set up by ppc_relocate_section.
      In the case of reading a file in, we can pick them up from the
      DataDirectory.  */
-  first_thunk_address = a->DataDirectory[12].VirtualAddress ;
+  first_thunk_address = a->DataDirectory[12].VirtualAddress;
   thunk_size = a->DataDirectory[12].Size;
   import_table_size = a->DataDirectory[1].Size;
 #endif
@@ -527,9 +552,16 @@
       && (coff_section_data (abfd, sec) != NULL)
       && (pei_section_data (abfd, sec) != NULL))
     {
-      aout->DataDirectory[idx].VirtualAddress = (sec->vma - base) & 0xffffffff;
-      aout->DataDirectory[idx].Size = pei_section_data (abfd, sec)->virt_size;
-      sec->flags |= SEC_DATA;
+      /* If data directory is empty, rva also should be 0 */
+      int size = pei_section_data (abfd, sec)->virt_size;
+      aout->DataDirectory[idx].Size = size;
+
+      if (size)
+	{
+	  aout->DataDirectory[idx].VirtualAddress =
+	    (sec->vma - base) & 0xffffffff;
+	  sec->flags |= SEC_DATA;
+	}
     }
 }
 
@@ -539,9 +571,9 @@
      PTR	in;
      PTR	out;
 {
-  struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *)in;
+  struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *) in;
   struct internal_extra_pe_aouthdr *extra = &pe_data (abfd)->pe_opthdr;
-  PEAOUTHDR *aouthdr_out = (PEAOUTHDR *)out;
+  PEAOUTHDR *aouthdr_out = (PEAOUTHDR *) out;
   bfd_vma sa, fa, ib;
 
   /* The following definitely is required for EFI applications.
@@ -565,33 +597,32 @@
   fa = extra->FileAlignment;
   ib = extra->ImageBase;
 
-  if (aouthdr_in->tsize) 
+  if (aouthdr_in->tsize)
     {
       aouthdr_in->text_start -= ib;
       aouthdr_in->text_start &= 0xffffffff;
     }
-  if (aouthdr_in->dsize) 
+  if (aouthdr_in->dsize)
     {
       aouthdr_in->data_start -= ib;
       aouthdr_in->data_start &= 0xffffffff;
     }
-  if (aouthdr_in->entry) 
+  if (aouthdr_in->entry)
     {
       aouthdr_in->entry -= ib;
       aouthdr_in->entry &= 0xffffffff;
     }
 
-#define FA(x)  (((x) + fa -1 ) & (- fa))
-#define SA(x)  (((x) + sa -1 ) & (- sa))
+#define FA(x) (((x) + fa -1 ) & (- fa))
+#define SA(x) (((x) + sa -1 ) & (- sa))
 
-  /* We like to have the sizes aligned */
+  /* We like to have the sizes aligned.  */
 
   aouthdr_in->bsize = FA (aouthdr_in->bsize);
 
-
   extra->NumberOfRvaAndSizes = IMAGE_NUMBEROF_DIRECTORY_ENTRIES;
 
-  /* first null out all data directory entries .. */
+  /* first null out all data directory entries ..  */
   memset (extra->DataDirectory, sizeof (extra->DataDirectory), 0);
 
   add_data_entry (abfd, extra, 0, ".edata", ib);
@@ -602,9 +633,9 @@
 
   /* However, until other .idata fixes are made (pending patch), the
      entry for .idata is needed for backwards compatability.  FIXME.  */
-  add_data_entry (abfd, extra, 1, ".idata" , ib);
+  add_data_entry (abfd, extra, 1, ".idata", ib);
 
-  add_data_entry (abfd, extra, 2, ".rsrc" , ib);
+  add_data_entry (abfd, extra, 2, ".rsrc", ib);
 
   add_data_entry (abfd, extra, 3, ".pdata", ib);
 
@@ -618,9 +649,9 @@
 
   {
     asection *sec;
-    bfd_vma dsize= 0;
+    bfd_vma dsize = 0;
     bfd_vma isize = SA(abfd->sections->filepos);
-    bfd_vma tsize= 0;
+    bfd_vma tsize = 0;
 
     for (sec = abfd->sections; sec; sec = sec->next)
       {
@@ -644,7 +675,7 @@
   }
 
   extra->SizeOfHeaders = abfd->sections->filepos;
-  bfd_h_put_16(abfd, aouthdr_in->magic, (bfd_byte *) aouthdr_out->standard.magic);
+  bfd_h_put_16 (abfd, aouthdr_in->magic, (bfd_byte *) aouthdr_out->standard.magic);
 
 #define LINKER_VERSION 256 /* That is, 2.56 */
 
@@ -711,7 +742,7 @@
 		(bfd_byte *) aouthdr_out->NumberOfRvaAndSizes);
   {
     int idx;
-    for (idx=0; idx < 16; idx++)
+    for (idx = 0; idx < 16; idx++)
       {
 	bfd_h_put_32 (abfd, extra->DataDirectory[idx].VirtualAddress,
 		      (bfd_byte *) aouthdr_out->DataDirectory[idx][0]);
@@ -730,8 +761,8 @@
      PTR	out;
 {
   int idx;
-  struct internal_filehdr *filehdr_in = (struct internal_filehdr *)in;
-  struct external_PEI_filehdr *filehdr_out = (struct external_PEI_filehdr *)out;
+  struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
+  struct external_PEI_filehdr *filehdr_out = (struct external_PEI_filehdr *) out;
 
   if (pe_data (abfd)->has_reloc_section)
     filehdr_in->f_flags &= ~F_RELFLG;
@@ -754,19 +785,19 @@
   filehdr_in->pe.e_lfarlc   = 0x40;
   filehdr_in->pe.e_ovno     = 0x0;
 
-  for (idx=0; idx < 4; idx++)
+  for (idx = 0; idx < 4; idx++)
     filehdr_in->pe.e_res[idx] = 0x0;
 
   filehdr_in->pe.e_oemid   = 0x0;
   filehdr_in->pe.e_oeminfo = 0x0;
 
-  for (idx=0; idx < 10; idx++)
+  for (idx = 0; idx < 10; idx++)
     filehdr_in->pe.e_res2[idx] = 0x0;
 
   filehdr_in->pe.e_lfanew = 0x80;
 
-  /* this next collection of data are mostly just characters.  It appears
-     to be constant within the headers put on NT exes */
+  /* This next collection of data are mostly just characters.  It
+     appears to be constant within the headers put on NT exes.  */
   filehdr_in->pe.dos_message[0]  = 0x0eba1f0e;
   filehdr_in->pe.dos_message[1]  = 0xcd09b400;
   filehdr_in->pe.dos_message[2]  = 0x4c01b821;
@@ -785,68 +816,63 @@
   filehdr_in->pe.dos_message[15] = 0x0;
   filehdr_in->pe.nt_signature = NT_SIGNATURE;
 
+  bfd_h_put_16 (abfd, filehdr_in->f_magic, (bfd_byte *) filehdr_out->f_magic);
+  bfd_h_put_16 (abfd, filehdr_in->f_nscns, (bfd_byte *) filehdr_out->f_nscns);
 
-
-  bfd_h_put_16(abfd, filehdr_in->f_magic, (bfd_byte *) filehdr_out->f_magic);
-  bfd_h_put_16(abfd, filehdr_in->f_nscns, (bfd_byte *) filehdr_out->f_nscns);
-
-  bfd_h_put_32(abfd, time (0), (bfd_byte *) filehdr_out->f_timdat);
+  bfd_h_put_32 (abfd, time (0), (bfd_byte *) filehdr_out->f_timdat);
   PUT_FILEHDR_SYMPTR (abfd, (bfd_vma) filehdr_in->f_symptr,
 		      (bfd_byte *) filehdr_out->f_symptr);
-  bfd_h_put_32(abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms);
-  bfd_h_put_16(abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr);
-  bfd_h_put_16(abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags);
+  bfd_h_put_32 (abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms);
+  bfd_h_put_16 (abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr);
+  bfd_h_put_16 (abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags);
 
   /* put in extra dos header stuff.  This data remains essentially
      constant, it just has to be tacked on to the beginning of all exes
      for NT */
-  bfd_h_put_16(abfd, filehdr_in->pe.e_magic, (bfd_byte *) filehdr_out->e_magic);
-  bfd_h_put_16(abfd, filehdr_in->pe.e_cblp, (bfd_byte *) filehdr_out->e_cblp);
-  bfd_h_put_16(abfd, filehdr_in->pe.e_cp, (bfd_byte *) filehdr_out->e_cp);
-  bfd_h_put_16(abfd, filehdr_in->pe.e_crlc, (bfd_byte *) filehdr_out->e_crlc);
-  bfd_h_put_16(abfd, filehdr_in->pe.e_cparhdr,
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_magic, (bfd_byte *) filehdr_out->e_magic);
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_cblp, (bfd_byte *) filehdr_out->e_cblp);
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_cp, (bfd_byte *) filehdr_out->e_cp);
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_crlc, (bfd_byte *) filehdr_out->e_crlc);
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_cparhdr,
 	       (bfd_byte *) filehdr_out->e_cparhdr);
-  bfd_h_put_16(abfd, filehdr_in->pe.e_minalloc,
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_minalloc,
 	       (bfd_byte *) filehdr_out->e_minalloc);
-  bfd_h_put_16(abfd, filehdr_in->pe.e_maxalloc,
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_maxalloc,
 	       (bfd_byte *) filehdr_out->e_maxalloc);
-  bfd_h_put_16(abfd, filehdr_in->pe.e_ss, (bfd_byte *) filehdr_out->e_ss);
-  bfd_h_put_16(abfd, filehdr_in->pe.e_sp, (bfd_byte *) filehdr_out->e_sp);
-  bfd_h_put_16(abfd, filehdr_in->pe.e_csum, (bfd_byte *) filehdr_out->e_csum);
-  bfd_h_put_16(abfd, filehdr_in->pe.e_ip, (bfd_byte *) filehdr_out->e_ip);
-  bfd_h_put_16(abfd, filehdr_in->pe.e_cs, (bfd_byte *) filehdr_out->e_cs);
-  bfd_h_put_16(abfd, filehdr_in->pe.e_lfarlc, (bfd_byte *) filehdr_out->e_lfarlc);
-  bfd_h_put_16(abfd, filehdr_in->pe.e_ovno, (bfd_byte *) filehdr_out->e_ovno);
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_ss, (bfd_byte *) filehdr_out->e_ss);
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_sp, (bfd_byte *) filehdr_out->e_sp);
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_csum, (bfd_byte *) filehdr_out->e_csum);
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_ip, (bfd_byte *) filehdr_out->e_ip);
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_cs, (bfd_byte *) filehdr_out->e_cs);
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_lfarlc, (bfd_byte *) filehdr_out->e_lfarlc);
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_ovno, (bfd_byte *) filehdr_out->e_ovno);
   {
     int idx;
-    for (idx=0; idx < 4; idx++)
-      bfd_h_put_16(abfd, filehdr_in->pe.e_res[idx],
-		   (bfd_byte *) filehdr_out->e_res[idx]);
+    for (idx = 0; idx < 4; idx++)
+      bfd_h_put_16 (abfd, filehdr_in->pe.e_res[idx],
+		    (bfd_byte *) filehdr_out->e_res[idx]);
   }
-  bfd_h_put_16(abfd, filehdr_in->pe.e_oemid, (bfd_byte *) filehdr_out->e_oemid);
-  bfd_h_put_16(abfd, filehdr_in->pe.e_oeminfo,
-	       (bfd_byte *) filehdr_out->e_oeminfo);
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_oemid, (bfd_byte *) filehdr_out->e_oemid);
+  bfd_h_put_16 (abfd, filehdr_in->pe.e_oeminfo,
+		(bfd_byte *) filehdr_out->e_oeminfo);
   {
     int idx;
-    for (idx=0; idx < 10; idx++)
-      bfd_h_put_16(abfd, filehdr_in->pe.e_res2[idx],
-		   (bfd_byte *) filehdr_out->e_res2[idx]);
+    for (idx = 0; idx < 10; idx++)
+      bfd_h_put_16 (abfd, filehdr_in->pe.e_res2[idx],
+		    (bfd_byte *) filehdr_out->e_res2[idx]);
   }
-  bfd_h_put_32(abfd, filehdr_in->pe.e_lfanew, (bfd_byte *) filehdr_out->e_lfanew);
+  bfd_h_put_32 (abfd, filehdr_in->pe.e_lfanew, (bfd_byte *) filehdr_out->e_lfanew);
 
   {
     int idx;
-    for (idx=0; idx < 16; idx++)
-      bfd_h_put_32(abfd, filehdr_in->pe.dos_message[idx],
-		   (bfd_byte *) filehdr_out->dos_message[idx]);
+    for (idx = 0; idx < 16; idx++)
+      bfd_h_put_32 (abfd, filehdr_in->pe.dos_message[idx],
+		    (bfd_byte *) filehdr_out->dos_message[idx]);
   }
 
-  /* also put in the NT signature */
-  bfd_h_put_32(abfd, filehdr_in->pe.nt_signature,
-	       (bfd_byte *) filehdr_out->nt_signature);
-
-
-
+  /* Also put in the NT signature.  */
+  bfd_h_put_32 (abfd, filehdr_in->pe.nt_signature,
+		(bfd_byte *) filehdr_out->nt_signature);
 
   return FILHSZ;
 }
@@ -857,17 +883,17 @@
      PTR	in;
      PTR	out;
 {
-  struct internal_filehdr *filehdr_in = (struct internal_filehdr *)in;
-  FILHDR *filehdr_out = (FILHDR *)out;
+  struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
+  FILHDR *filehdr_out = (FILHDR *) out;
 
-  bfd_h_put_16(abfd, filehdr_in->f_magic, (bfd_byte *) filehdr_out->f_magic);
-  bfd_h_put_16(abfd, filehdr_in->f_nscns, (bfd_byte *) filehdr_out->f_nscns);
-  bfd_h_put_32(abfd, filehdr_in->f_timdat, (bfd_byte *) filehdr_out->f_timdat);
+  bfd_h_put_16 (abfd, filehdr_in->f_magic, (bfd_byte *) filehdr_out->f_magic);
+  bfd_h_put_16 (abfd, filehdr_in->f_nscns, (bfd_byte *) filehdr_out->f_nscns);
+  bfd_h_put_32 (abfd, filehdr_in->f_timdat, (bfd_byte *) filehdr_out->f_timdat);
   PUT_FILEHDR_SYMPTR (abfd, (bfd_vma) filehdr_in->f_symptr,
 		      (bfd_byte *) filehdr_out->f_symptr);
-  bfd_h_put_32(abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms);
-  bfd_h_put_16(abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr);
-  bfd_h_put_16(abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags);
+  bfd_h_put_32 (abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms);
+  bfd_h_put_16 (abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr);
+  bfd_h_put_16 (abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags);
 
   return FILHSZ;
 }
@@ -878,17 +904,17 @@
      PTR	in;
      PTR	out;
 {
-  struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *)in;
-  SCNHDR *scnhdr_ext = (SCNHDR *)out;
+  struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
+  SCNHDR *scnhdr_ext = (SCNHDR *) out;
   unsigned int ret = SCNHSZ;
   bfd_vma ps;
   bfd_vma ss;
 
-  memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof(scnhdr_int->s_name));
+  memcpy (scnhdr_ext->s_name, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
 
   PUT_SCNHDR_VADDR (abfd,
-		    ((scnhdr_int->s_vaddr 
-		      - pe_data(abfd)->pe_opthdr.ImageBase)
+		    ((scnhdr_int->s_vaddr
+		      - pe_data (abfd)->pe_opthdr.ImageBase)
 		     & 0xffffffff),
 		    (bfd_byte *) scnhdr_ext->s_vaddr);
 
@@ -910,7 +936,6 @@
   PUT_SCNHDR_SIZE (abfd, ss,
 		   (bfd_byte *) scnhdr_ext->s_size);
 
-
   /* s_paddr in PE is really the virtual size.  */
   PUT_SCNHDR_PADDR (abfd, ps, (bfd_byte *) scnhdr_ext->s_paddr);
 
@@ -937,7 +962,7 @@
 
   {
     int flags = scnhdr_int->s_flags;
-    bfd_h_put_32(abfd, flags, (bfd_byte *) scnhdr_ext->s_flags);
+    bfd_h_put_32 (abfd, flags, (bfd_byte *) scnhdr_ext->s_flags);
   }
 
   if (coff_data (abfd)->link_info
@@ -977,35 +1002,41 @@
 		      (bfd_byte *) scnhdr_ext->s_nreloc);
       else
 	{
-	  (*_bfd_error_handler) (_("%s: reloc overflow: 0x%lx > 0xffff"),
+	  /* PE can deal with large #s of relocs, but not here */
+	  bfd_h_put_16 (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc);
+	  scnhdr_int->s_flags |= IMAGE_SCN_LNK_NRELOC_OVFL;
+	  bfd_h_put_32 (abfd, scnhdr_int->s_flags,
+			(bfd_byte *) scnhdr_ext->s_flags);
+#if 0
+	  (*_bfd_error_handler) (_("%s: reloc overflow 1: 0x%lx > 0xffff"),
 				 bfd_get_filename (abfd),
 				 scnhdr_int->s_nreloc);
 	  bfd_set_error (bfd_error_file_truncated);
 	  bfd_h_put_16 (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc);
 	  ret = 0;
+#endif
 	}
     }
   return ret;
 }
 
-static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] =
-{
-  N_ ("Export Directory [.edata (or where ever we found it)]"),
-  N_ ("Import Directory [parts of .idata]"),
-  N_ ("Resource Directory [.rsrc]"),
-  N_ ("Exception Directory [.pdata]"),
-  N_ ("Security Directory"),
-  N_ ("Base Relocation Directory [.reloc]"),
-  N_ ("Debug Directory"),
-  N_ ("Description Directory"),
-  N_ ("Special Directory"),
-  N_ ("Thread Storage Directory [.tls]"),
-  N_ ("Load Configuration Directory"),
-  N_ ("Bound Import Directory"),
-  N_ ("Import Address Table Directory"),
-  N_ ("Delay Import Directory"),
-  N_ ("Reserved"),
-  N_ ("Reserved")
+static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] = {
+  N_("Export Directory [.edata (or where ever we found it)]"),
+  N_("Import Directory [parts of .idata]"),
+  N_("Resource Directory [.rsrc]"),
+  N_("Exception Directory [.pdata]"),
+  N_("Security Directory"),
+  N_("Base Relocation Directory [.reloc]"),
+  N_("Debug Directory"),
+  N_("Description Directory"),
+  N_("Special Directory"),
+  N_("Thread Storage Directory [.tls]"),
+  N_("Load Configuration Directory"),
+  N_("Bound Import Directory"),
+  N_("Import Address Table Directory"),
+  N_("Delay Import Directory"),
+  N_("Reserved"),
+  N_("Reserved")
 };
 
 /**********************************************************************/
@@ -1112,27 +1143,27 @@
       loadable_toc_address = bfd_get_32 (abfd, data + offset + 4);
       toc_address = loadable_toc_address - 32768;
 
-      fprintf(file,
-	      _("\nFunction descriptor located at the start address: %04lx\n"),
-	      (unsigned long int) (abfd->start_address));
+      fprintf (file,
+	       _("\nFunction descriptor located at the start address: %04lx\n"),
+	       (unsigned long int) (abfd->start_address));
       fprintf (file,
 	       _("\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n"),
 	       start_address, loadable_toc_address, toc_address);
     }
   else
     {
-      fprintf(file,
-	      _("\nNo reldata section! Function descriptor not decoded.\n"));
+      fprintf (file,
+	       _("\nNo reldata section! Function descriptor not decoded.\n"));
     }
 #endif
 
-  fprintf(file,
-	  _("\nThe Import Tables (interpreted %s section contents)\n"),
-	  section->name);
-  fprintf(file,
-	  _(" vma:            Hint    Time      Forward  DLL       First\n"));
-  fprintf(file,
-	  _("                 Table   Stamp     Chain    Name      Thunk\n"));
+  fprintf (file,
+	   _("\nThe Import Tables (interpreted %s section contents)\n"),
+	   section->name);
+  fprintf (file,
+	   _(" vma:            Hint    Time      Forward  DLL       First\n"));
+  fprintf (file,
+	   _("                 Table   Stamp     Chain    Name      Thunk\n"));
 
   data = (bfd_byte *) bfd_malloc (dataoff + datasize);
   if (data == NULL)
@@ -1161,7 +1192,7 @@
 
       if (i + 20 > datasize)
 	{
-	  /* check stuff */
+	  /* Check stuff.  */
 	  ;
 	}
 
@@ -1182,7 +1213,7 @@
 	break;
 
       dll = (char *) data + dll_name - adj;
-      fprintf(file, _("\n\tDLL Name: %s\n"), dll);
+      fprintf (file, _("\n\tDLL Name: %s\n"), dll);
 
       if (hint_addr != 0)
 	{
@@ -1249,19 +1280,19 @@
 		    {
 		      fprintf (file,
 			       _("\tThe Import Address Table (difference found)\n"));
-		      fprintf(file, _("\tvma:  Hint/Ord Member-Name\n"));
+		      fprintf (file, _("\tvma:  Hint/Ord Member-Name\n"));
 		      differ = 1;
 		    }
 		  if (iat_member == 0)
 		    {
-		      fprintf(file,
+		      fprintf (file,
 			      _("\t>>> Ran out of IAT members!\n"));
 		    }
 		  else
 		    {
 		      ordinal = bfd_get_16 (abfd, data + iat_member - adj);
 		      member_name = (char *) data + iat_member - adj + 2;
-		      fprintf(file, "\t%04lx\t %4d  %s\n",
+		      fprintf (file, "\t%04lx\t %4d  %s\n",
 			      (unsigned long) iat_member,
 			      ordinal,
 			      member_name);
@@ -1273,12 +1304,12 @@
 	    }
 	  if (differ == 0)
 	    {
-	      fprintf(file,
+	      fprintf (file,
 		      _("\tThe Import Address Table is identical\n"));
 	    }
 	}
 
-      fprintf(file, "\n");
+      fprintf (file, "\n");
 
     }
 
@@ -1301,20 +1332,19 @@
   bfd_size_type i;
 
   bfd_signed_vma adj;
-  struct EDT_type
-    {
-      long export_flags;             /* reserved - should be zero */
-      long time_stamp;
-      short major_ver;
-      short minor_ver;
-      bfd_vma name;                  /* rva - relative to image base */
-      long base;                     /* ordinal base */
-      unsigned long num_functions;   /* Number in the export address table */
-      unsigned long num_names;       /* Number in the name pointer table */
-      bfd_vma eat_addr;    /* rva to the export address table */
-      bfd_vma npt_addr;        /* rva to the Export Name Pointer Table */
-      bfd_vma ot_addr; /* rva to the Ordinal Table */
-    } edt;
+  struct EDT_type {
+    long export_flags;             /* reserved - should be zero */
+    long time_stamp;
+    short major_ver;
+    short minor_ver;
+    bfd_vma name;                  /* rva - relative to image base */
+    long base;                     /* ordinal base */
+    unsigned long num_functions;   /* Number in the export address table */
+    unsigned long num_names;       /* Number in the name pointer table */
+    bfd_vma eat_addr;    /* rva to the export address table */
+    bfd_vma npt_addr;        /* rva to the Export Name Pointer Table */
+    bfd_vma ot_addr; /* rva to the Ordinal Table */
+  } edt;
 
   pe_data_type *pe = pe_data (abfd);
   struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr;
@@ -1367,34 +1397,34 @@
 				  datasize))
     return false;
 
-  /* Go get Export Directory Table */
-  edt.export_flags   = bfd_get_32(abfd, data+0);
-  edt.time_stamp     = bfd_get_32(abfd, data+4);
-  edt.major_ver      = bfd_get_16(abfd, data+8);
-  edt.minor_ver      = bfd_get_16(abfd, data+10);
-  edt.name           = bfd_get_32(abfd, data+12);
-  edt.base           = bfd_get_32(abfd, data+16);
-  edt.num_functions  = bfd_get_32(abfd, data+20);
-  edt.num_names      = bfd_get_32(abfd, data+24);
-  edt.eat_addr       = bfd_get_32(abfd, data+28);
-  edt.npt_addr       = bfd_get_32(abfd, data+32);
-  edt.ot_addr        = bfd_get_32(abfd, data+36);
+  /* Go get Export Directory Table.  */
+  edt.export_flags   = bfd_get_32 (abfd, data +  0);
+  edt.time_stamp     = bfd_get_32 (abfd, data +  4);
+  edt.major_ver      = bfd_get_16 (abfd, data +  8);
+  edt.minor_ver      = bfd_get_16 (abfd, data + 10);
+  edt.name           = bfd_get_32 (abfd, data + 12);
+  edt.base           = bfd_get_32 (abfd, data + 16);
+  edt.num_functions  = bfd_get_32 (abfd, data + 20);
+  edt.num_names      = bfd_get_32 (abfd, data + 24);
+  edt.eat_addr       = bfd_get_32 (abfd, data + 28);
+  edt.npt_addr       = bfd_get_32 (abfd, data + 32);
+  edt.ot_addr        = bfd_get_32 (abfd, data + 36);
 
   adj = section->vma - extra->ImageBase + dataoff;
 
   /* Dump the EDT first first */
-  fprintf(file,
-	  _("\nThe Export Tables (interpreted %s section contents)\n\n"),
-	  section->name);
+  fprintf (file,
+	   _("\nThe Export Tables (interpreted %s section contents)\n\n"),
+	   section->name);
 
-  fprintf(file,
-	  _("Export Flags \t\t\t%lx\n"), (unsigned long) edt.export_flags);
+  fprintf (file,
+	   _("Export Flags \t\t\t%lx\n"), (unsigned long) edt.export_flags);
 
-  fprintf(file,
-	  _("Time/Date stamp \t\t%lx\n"), (unsigned long) edt.time_stamp);
+  fprintf (file,
+	   _("Time/Date stamp \t\t%lx\n"), (unsigned long) edt.time_stamp);
 
-  fprintf(file,
-	  _("Major/Minor \t\t\t%d/%d\n"), edt.major_ver, edt.minor_ver);
+  fprintf (file,
+	   _("Major/Minor \t\t\t%d/%d\n"), edt.major_ver, edt.minor_ver);
 
   fprintf (file,
 	   _("Name \t\t\t\t"));
@@ -1402,21 +1432,21 @@
   fprintf (file,
 	   " %s\n", data + edt.name - adj);
 
-  fprintf(file,
-	  _("Ordinal Base \t\t\t%ld\n"), edt.base);
+  fprintf (file,
+	   _("Ordinal Base \t\t\t%ld\n"), edt.base);
 
-  fprintf(file,
-	  _("Number in:\n"));
+  fprintf (file,
+	   _("Number in:\n"));
 
-  fprintf(file,
-	  _("\tExport Address Table \t\t%08lx\n"),
-	  edt.num_functions);
+  fprintf (file,
+	   _("\tExport Address Table \t\t%08lx\n"),
+	   edt.num_functions);
 
-  fprintf(file,
-	  _("\t[Name Pointer/Ordinal] Table\t%08lx\n"), edt.num_names);
+  fprintf (file,
+	   _("\t[Name Pointer/Ordinal] Table\t%08lx\n"), edt.num_names);
 
-  fprintf(file,
-	  _("Table Addresses\n"));
+  fprintf (file,
+	   _("Table Addresses\n"));
 
   fprintf (file,
 	   _("\tExport Address Table \t\t"));
@@ -1424,7 +1454,7 @@
   fprintf (file, "\n");
 
   fprintf (file,
-	  _("\tName Pointer Table \t\t"));
+	   _("\tName Pointer Table \t\t"));
   fprintf_vma (file, edt.npt_addr);
   fprintf (file, "\n");
 
@@ -1433,18 +1463,16 @@
   fprintf_vma (file, edt.ot_addr);
   fprintf (file, "\n");
 
-  
   /* The next table to find is the Export Address Table. It's basically
      a list of pointers that either locate a function in this dll, or
      forward the call to another dll. Something like:
-      typedef union
-      {
+      typedef union {
         long export_rva;
         long forwarder_rva;
       } export_address_table_entry;
   */
 
-  fprintf(file,
+  fprintf (file,
 	  _("\nExport Address Table -- Ordinal Base %ld\n"),
 	  edt.base);
 
@@ -1458,7 +1486,7 @@
       if (eat_member - adj <= datasize)
 	{
 	  /* This rva is to a name (forwarding function) in our section.  */
-	  /* Should locate a function descriptor */
+	  /* Should locate a function descriptor.  */
 	  fprintf (file,
 		   "\t[%4ld] +base[%4ld] %04lx %s -- %s\n",
 		   (long) i,
@@ -1469,7 +1497,7 @@
 	}
       else
 	{
-	  /* Should locate a function descriptor in the reldata section */
+	  /* Should locate a function descriptor in the reldata section.  */
 	  fprintf (file,
 		   "\t[%4ld] +base[%4ld] %04lx %s\n",
 		   (long) i,
@@ -1479,27 +1507,26 @@
 	}
     }
 
-  /* The Export Name Pointer Table is paired with the Export Ordinal Table */
-  /* Dump them in parallel for clarity */
-  fprintf(file,
-	  _("\n[Ordinal/Name Pointer] Table\n"));
+  /* The Export Name Pointer Table is paired with the Export Ordinal Table.  */
+  /* Dump them in parallel for clarity.  */
+  fprintf (file,
+	   _("\n[Ordinal/Name Pointer] Table\n"));
 
   for (i = 0; i < edt.num_names; ++i)
     {
-      bfd_vma name_ptr = bfd_get_32(abfd,
+      bfd_vma name_ptr = bfd_get_32 (abfd,
 				    data +
 				    edt.npt_addr
 				    + (i*4) - adj);
-      
+
       char *name = (char *) data + name_ptr - adj;
 
-      bfd_vma ord = bfd_get_16(abfd,
+      bfd_vma ord = bfd_get_16 (abfd,
 				    data +
 				    edt.ot_addr
 				    + (i*2) - adj);
-      fprintf(file,
+      fprintf (file,
 	      "\t[%4ld] %s\n", (long) ord, name);
-
     }
 
   free (data);
@@ -1511,9 +1538,10 @@
    consists of three dwords containing relative virtual addresses that
    specify the start and end address of the code range the entry
    covers and the address of the corresponding unwind info data.  */
+
 static boolean
 pe_print_pdata (abfd, vfile)
-     bfd  *abfd;
+     bfd *abfd;
      PTR vfile;
 {
 #ifdef COFF_WITH_PEP64
@@ -1532,18 +1560,19 @@
   if (section == NULL
       || coff_section_data (abfd, section) == NULL
       || pei_section_data (abfd, section) == NULL)
-     return true;
+    return true;
 
   stop = pei_section_data (abfd, section)->virt_size;
   if ((stop % onaline) != 0)
-    fprintf (file, _("Warning, .pdata section size (%ld) is not a multiple of %d\n"),
-	     (long)stop, onaline);
+    fprintf (file,
+	     _("Warning, .pdata section size (%ld) is not a multiple of %d\n"),
+	     (long) stop, onaline);
 
   fprintf (file,
 	   _("\nThe Function Table (interpreted .pdata section contents)\n"));
 #ifdef COFF_WITH_PEP64
-  fprintf(file,
-	  _(" vma:\t\t\tBegin Address    End Address      Unwind Info\n"));
+  fprintf (file,
+	   _(" vma:\t\t\tBegin Address    End Address      Unwind Info\n"));
 #else
   fprintf (file,
 	   _(" vma:\t\tBegin    End      EH       EH       PrologEnd  Exception\n"));
@@ -1578,12 +1607,12 @@
       if (i + PDATA_ROW_SIZE > stop)
 	break;
 
-      begin_addr = GET_PDATA_ENTRY(abfd, data+i);
-      end_addr = GET_PDATA_ENTRY(abfd, data+i+4);
-      eh_handler = GET_PDATA_ENTRY(abfd, data+i+8);
-      eh_data = GET_PDATA_ENTRY(abfd, data+i+12);
-      prolog_end_addr = GET_PDATA_ENTRY(abfd, data+i+16);
-      
+      begin_addr      = GET_PDATA_ENTRY (abfd, data + i     );
+      end_addr        = GET_PDATA_ENTRY (abfd, data + i +  4);
+      eh_handler      = GET_PDATA_ENTRY (abfd, data + i +  8);
+      eh_data         = GET_PDATA_ENTRY (abfd, data + i + 12);
+      prolog_end_addr = GET_PDATA_ENTRY (abfd, data + i + 16);
+
       if (begin_addr == 0 && end_addr == 0 && eh_handler == 0
 	  && eh_data == 0 && prolog_end_addr == 0)
 	{
@@ -1592,8 +1621,8 @@
 	}
 
       em_data = ((eh_handler & 0x1) << 2) | (prolog_end_addr & 0x3);
-      eh_handler &= ~ (bfd_vma) 0x3;
-      prolog_end_addr &= ~ (bfd_vma) 0x3;
+      eh_handler &= ~(bfd_vma) 0x3;
+      prolog_end_addr &= ~(bfd_vma) 0x3;
 
       fputc (' ', file);
       fprintf_vma (file, i + section->vma); fputc ('\t', file);
@@ -1610,9 +1639,8 @@
 #ifdef POWERPC_LE_PE
       if (eh_handler == 0 && eh_data != 0)
 	{
-	  /* Special bits here, although the meaning may */
-	  /* be a little mysterious. The only one I know */
-	  /* for sure is 0x03.                           */
+	  /* Special bits here, although the meaning may be a little
+	     mysterious. The only one I know for sure is 0x03.  */
 	  /* Code Significance                           */
 	  /* 0x00 None                                   */
 	  /* 0x01 Register Save Millicode                */
@@ -1621,20 +1649,20 @@
 	  switch (eh_data)
 	    {
 	    case 0x01:
-	      fprintf(file, _(" Register save millicode"));
+	      fprintf (file, _(" Register save millicode"));
 	      break;
 	    case 0x02:
-	      fprintf(file, _(" Register restore millicode"));
+	      fprintf (file, _(" Register restore millicode"));
 	      break;
 	    case 0x03:
-	      fprintf(file, _(" Glue code sequence"));
+	      fprintf (file, _(" Glue code sequence"));
 	      break;
 	    default:
 	      break;
 	    }
 	}
 #endif
-      fprintf(file, "\n");
+      fprintf (file, "\n");
     }
 
   free (data);
@@ -1643,21 +1671,20 @@
 }
 
 #define IMAGE_REL_BASED_HIGHADJ 4
-static const char * const tbl[] =
-{
-"ABSOLUTE",
-"HIGH",
-"LOW",
-"HIGHLOW",
-"HIGHADJ",
-"MIPS_JMPADDR",
-"SECTION",
-"REL32",
-"RESERVED1",
-"MIPS_JMPADDR16",
-"DIR64",
-"HIGH3ADJ"
-"UNKNOWN",   /* MUST be last */
+static const char * const tbl[] = {
+  "ABSOLUTE",
+  "HIGH",
+  "LOW",
+  "HIGHLOW",
+  "HIGHADJ",
+  "MIPS_JMPADDR",
+  "SECTION",
+  "REL32",
+  "RESERVED1",
+  "MIPS_JMPADDR16",
+  "DIR64",
+  "HIGH3ADJ"
+  "UNKNOWN",   /* MUST be last */
 };
 
 static boolean
@@ -1704,8 +1731,8 @@
       /* The .reloc section is a sequence of blocks, with a header consisting
 	 of two 32 bit quantities, followed by a number of 16 bit entries */
 
-      virtual_address = bfd_get_32(abfd, data+i);
-      size = bfd_get_32(abfd, data+i+4);
+      virtual_address = bfd_get_32 (abfd, data+i);
+      size = bfd_get_32 (abfd, data+i+4);
       number = (size - 8) / 2;
 
       if (size == 0)
@@ -1731,15 +1758,15 @@
 		   j, off, (long) (off + virtual_address), tbl[t]);
 
 	  /* HIGHADJ takes an argument, - the next record *is* the
-	     low 16 bits of addend.  */ 
+	     low 16 bits of addend.  */
 	  if (t == IMAGE_REL_BASED_HIGHADJ)
 	    {
-	       fprintf (file, " (%4x)",
-			((unsigned int)
-			 bfd_get_16 (abfd, data + i + 8 + j * 2 + 2)));
-	       j++;
+	      fprintf (file, " (%4x)",
+		       ((unsigned int)
+			bfd_get_16 (abfd, data + i + 8 + j * 2 + 2)));
+	      j++;
 	    }
-	  
+
 	  fprintf (file, "\n");
 	}
       i += size;
@@ -1768,7 +1795,7 @@
      emulate it here.  */
   fprintf (file, _("\nCharacteristics 0x%x\n"), pe->real_flags);
 #undef PF
-#define PF(x, y)    if (pe->real_flags & x) { fprintf (file, "\t%s\n", y); }
+#define PF(x, y) if (pe->real_flags & x) { fprintf (file, "\t%s\n", y); }
   PF (F_RELFLG, "relocations stripped");
   PF (F_EXEC, "executable");
   PF (F_LNNO, "line numbers stripped");
@@ -1783,22 +1810,22 @@
 
   /* ctime implies '\n'.  */
   fprintf (file, "\nTime/Date\t\t%s", ctime (&pe->coff.timestamp));
-  fprintf (file,"\nImageBase\t\t");
+  fprintf (file, "\nImageBase\t\t");
   fprintf_vma (file, i->ImageBase);
-  fprintf (file,"\nSectionAlignment\t");
+  fprintf (file, "\nSectionAlignment\t");
   fprintf_vma (file, i->SectionAlignment);
-  fprintf (file,"\nFileAlignment\t\t");
+  fprintf (file, "\nFileAlignment\t\t");
   fprintf_vma (file, i->FileAlignment);
-  fprintf (file,"\nMajorOSystemVersion\t%d\n", i->MajorOperatingSystemVersion);
-  fprintf (file,"MinorOSystemVersion\t%d\n", i->MinorOperatingSystemVersion);
-  fprintf (file,"MajorImageVersion\t%d\n", i->MajorImageVersion);
-  fprintf (file,"MinorImageVersion\t%d\n", i->MinorImageVersion);
-  fprintf (file,"MajorSubsystemVersion\t%d\n", i->MajorSubsystemVersion);
-  fprintf (file,"MinorSubsystemVersion\t%d\n", i->MinorSubsystemVersion);
-  fprintf (file,"Win32Version\t\t%08lx\n", i->Reserved1);
-  fprintf (file,"SizeOfImage\t\t%08lx\n", i->SizeOfImage);
-  fprintf (file,"SizeOfHeaders\t\t%08lx\n", i->SizeOfHeaders);
-  fprintf (file,"CheckSum\t\t%08lx\n", i->CheckSum);
+  fprintf (file, "\nMajorOSystemVersion\t%d\n", i->MajorOperatingSystemVersion);
+  fprintf (file, "MinorOSystemVersion\t%d\n", i->MinorOperatingSystemVersion);
+  fprintf (file, "MajorImageVersion\t%d\n", i->MajorImageVersion);
+  fprintf (file, "MinorImageVersion\t%d\n", i->MinorImageVersion);
+  fprintf (file, "MajorSubsystemVersion\t%d\n", i->MajorSubsystemVersion);
+  fprintf (file, "MinorSubsystemVersion\t%d\n", i->MinorSubsystemVersion);
+  fprintf (file, "Win32Version\t\t%08lx\n", i->Reserved1);
+  fprintf (file, "SizeOfImage\t\t%08lx\n", i->SizeOfImage);
+  fprintf (file, "SizeOfHeaders\t\t%08lx\n", i->SizeOfHeaders);
+  fprintf (file, "CheckSum\t\t%08lx\n", i->CheckSum);
   switch (i->Subsystem)
     {
     case IMAGE_SUBSYSTEM_UNKNOWN:
@@ -1826,25 +1853,25 @@
       subsystem_name = "EFI boot service driver";
       break;
     case IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:
-      subsystem_name = "EFI runtime driver"; 
+      subsystem_name = "EFI runtime driver";
       break;
     }
-  fprintf (file,"Subsystem\t\t%08x", i->Subsystem);
+  fprintf (file, "Subsystem\t\t%08x", i->Subsystem);
   if (subsystem_name)
     fprintf (file, "\t(%s)", subsystem_name);
-  fprintf (file,"\nDllCharacteristics\t%08x\n", i->DllCharacteristics);
-  fprintf (file,"SizeOfStackReserve\t");
+  fprintf (file, "\nDllCharacteristics\t%08x\n", i->DllCharacteristics);
+  fprintf (file, "SizeOfStackReserve\t");
   fprintf_vma (file, i->SizeOfStackReserve);
-  fprintf (file,"\nSizeOfStackCommit\t");
+  fprintf (file, "\nSizeOfStackCommit\t");
   fprintf_vma (file, i->SizeOfStackCommit);
-  fprintf (file,"\nSizeOfHeapReserve\t");
+  fprintf (file, "\nSizeOfHeapReserve\t");
   fprintf_vma (file, i->SizeOfHeapReserve);
-  fprintf (file,"\nSizeOfHeapCommit\t");
+  fprintf (file, "\nSizeOfHeapCommit\t");
   fprintf_vma (file, i->SizeOfHeapCommit);
-  fprintf (file,"\nLoaderFlags\t\t%08lx\n", i->LoaderFlags);
-  fprintf (file,"NumberOfRvaAndSizes\t%08lx\n", i->NumberOfRvaAndSizes);
+  fprintf (file, "\nLoaderFlags\t\t%08lx\n", i->LoaderFlags);
+  fprintf (file, "NumberOfRvaAndSizes\t%08lx\n", i->NumberOfRvaAndSizes);
 
-  fprintf (file,"\nThe Data Directory\n");
+  fprintf (file, "\nThe Data Directory\n");
   for (j = 0; j < IMAGE_NUMBEROF_DIRECTORY_ENTRIES; j++)
     {
       fprintf (file, "Entry %1x ", j);
@@ -1880,13 +1907,13 @@
      if we don't remove this entry as well.  */
   if (! pe_data (obfd)->has_reloc_section)
     {
-      pe_data(obfd)->pe_opthdr.DataDirectory[5].VirtualAddress = 0;
-      pe_data(obfd)->pe_opthdr.DataDirectory[5].Size = 0;
+      pe_data (obfd)->pe_opthdr.DataDirectory[5].VirtualAddress = 0;
+      pe_data (obfd)->pe_opthdr.DataDirectory[5].Size = 0;
     }
   return true;
 }
 
-/* Copy private section data. */
+/* Copy private section data.  */
 boolean
 _bfd_pe_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
      bfd *ibfd;
@@ -1918,7 +1945,7 @@
       pei_section_data (obfd, osec)->virt_size =
 	pei_section_data (ibfd, isec)->virt_size;
       pei_section_data (obfd, osec)->pe_flags =
-        pei_section_data (ibfd, isec)->pe_flags;
+	pei_section_data (ibfd, isec)->pe_flags;
     }
 
   return true;
@@ -1962,7 +1989,7 @@
 			      ".idata$2", false, false, true);
   if (h1 != NULL)
     {
-      pe_data(abfd)->pe_opthdr.DataDirectory[1].VirtualAddress =
+      pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress =
 	(h1->root.u.def.value
 	 + h1->root.u.def.section->output_section->vma
 	 + h1->root.u.def.section->output_offset);
@@ -1972,7 +1999,7 @@
 	((h1->root.u.def.value
 	  + h1->root.u.def.section->output_section->vma
 	  + h1->root.u.def.section->output_offset)
-	 - pe_data(abfd)->pe_opthdr.DataDirectory[1].VirtualAddress);
+	 - pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress);
 
       /* The import address table.  This is the size/address of
          .idata$5.  */
@@ -1988,7 +2015,7 @@
 	((h1->root.u.def.value
 	  + h1->root.u.def.section->output_section->vma
 	  + h1->root.u.def.section->output_offset)
-	 - pe_data(abfd)->pe_opthdr.DataDirectory[12].VirtualAddress);
+	 - pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress);
     }
 
   /* If we couldn't find idata$2, we either have an excessively
diff --git a/bfd/po/POTFILES.in b/bfd/po/POTFILES.in
index 94b8282..f75b4ca 100644
--- a/bfd/po/POTFILES.in
+++ b/bfd/po/POTFILES.in
@@ -1,14 +1,15 @@
 aix386-core.c
+aout0.c
+aout32.c
+aout64.c
 aout-adobe.c
 aout-arm.c
+aout-cris.c
+aoutf1.h
 aout-ns32k.c
 aout-sparcle.c
 aout-target.h
 aout-tic30.c
-aout0.c
-aout32.c
-aout64.c
-aoutf1.h
 aoutx.h
 archive.c
 archures.c
@@ -21,17 +22,21 @@
 cf-m68klynx.c
 cf-sparclynx.c
 cisco-core.c
+coff64-rs6000.c
 coff-a29k.c
 coff-alpha.c
 coff-apollo.c
 coff-arm.c
 coff-aux.c
+coffcode.h
+coffgen.c
 coff-go32.c
 coff-h8300.c
 coff-h8500.c
 coff-i386.c
 coff-i860.c
 coff-i960.c
+cofflink.c
 coff-m68k.c
 coff-m88k.c
 coff-mips.c
@@ -41,21 +46,21 @@
 coff-sparc.c
 coff-stgo32.c
 coff-svm68k.c
+coffswap.h
 coff-tic30.c
+coff-tic54x.c
 coff-tic80.c
 coff-u68k.c
 coff-w65.c
 coff-we32k.c
 coff-z8k.c
-coffcode.h
-coffgen.c
-cofflink.c
-coffswap.h
 corefile.c
 cpu-a29k.c
 cpu-alpha.c
 cpu-arc.c
 cpu-arm.c
+cpu-avr.c
+cpu-cris.c
 cpu-d10v.c
 cpu-d30v.c
 cpu-fr30.c
@@ -66,9 +71,12 @@
 cpu-i386.c
 cpu-i860.c
 cpu-i960.c
+cpu-ia64.c
 cpu-m10200.c
 cpu-m10300.c
 cpu-m32r.c
+cpu-m68hc11.c
+cpu-m68hc12.c
 cpu-m68k.c
 cpu-m88k.c
 cpu-mcore.c
@@ -80,6 +88,7 @@
 cpu-sh.c
 cpu-sparc.c
 cpu-tic30.c
+cpu-tic54x.c
 cpu-tic80.c
 cpu-v850.c
 cpu-vax.c
@@ -92,21 +101,26 @@
 ecoff.c
 ecofflink.c
 ecoffswap.h
-elf-bfd.h
-elf-m10200.c
-elf-m10300.c
-elf.c
+efi-app-ia32.c
+efi-app-ia64.c
 elf32-arc.c
 elf32-arm.h
+elf32-avr.c
+elf32.c
+elf32-cris.c
 elf32-d10v.c
 elf32-d30v.c
 elf32-fr30.c
 elf32-gen.c
+elf32-hppa.c
+elf32-hppa.h
 elf32-i370.c
 elf32-i386.c
 elf32-i860.c
 elf32-i960.c
 elf32-m32r.c
+elf32-m68hc11.c
+elf32-m68hc12.c
 elf32-m68k.c
 elf32-m88k.c
 elf32-mcore.c
@@ -114,22 +128,28 @@
 elf32-pj.c
 elf32-ppc.c
 elf32-sh.c
+elf32-sh-lin.c
 elf32-sparc.c
 elf32-v850.c
-elf32.c
 elf64-alpha.c
+elf64.c
 elf64-gen.c
 elf64-hppa.c
 elf64-hppa.h
 elf64-mips.c
 elf64-sparc.c
-elf64.c
+elf64-x86-64.c
 elfarm-nabi.c
 elfarm-oabi.c
+elf-bfd.h
+elf.c
 elfcode.h
 elfcore.h
+elf-hppa.h
 elflink.c
 elflink.h
+elf-m10200.c
+elf-m10300.c
 epoc-pe-arm.c
 epoc-pei-arm.c
 format.c
@@ -174,16 +194,16 @@
 mipsbsd.c
 netbsd.h
 newsos3.c
-nlm-target.h
-nlm.c
 nlm32-alpha.c
+nlm32.c
 nlm32-i386.c
 nlm32-ppc.c
 nlm32-sparc.c
-nlm32.c
 nlm64.c
+nlm.c
 nlmcode.h
 nlmswap.h
+nlm-target.h
 ns32k.h
 ns32knetbsd.c
 oasys.c
@@ -192,17 +212,21 @@
 pc532-mach.c
 pe-arm.c
 pe-i386.c
-pe-mcore.c
-pe-ppc.c
 pei-arm.c
-pei-i386.c
-pei-mcore.c
-pei-ppc.c
 peicode.h
 peigen.c
+pei-i386.c
+pei-mcore.c
+pei-mips.c
+pei-ppc.c
+pei-sh.c
+pe-mcore.c
+pe-mips.c
+pe-ppc.c
+pe-sh.c
 ppcboot.c
-reloc.c
 reloc16.c
+reloc.c
 riscix.c
 sco5-core.c
 section.c
@@ -212,8 +236,8 @@
 sparclynx.c
 sparcnetbsd.c
 srec.c
-stab-syms.c
 stabs.c
+stab-syms.c
 sunos.c
 syms.c
 targets.c
@@ -221,10 +245,11 @@
 trad-core.c
 vaxnetbsd.c
 versados.c
+vms.c
 vms-gsd.c
+vms.h
 vms-hdr.c
 vms-misc.c
 vms-tir.c
-vms.c
-vms.h
 xcofflink.c
+xcoff-target.h
diff --git a/bfd/po/bfd.pot b/bfd/po/bfd.pot
index 10ce322..bf17e1d 100644
--- a/bfd/po/bfd.pot
+++ b/bfd/po/bfd.pot
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-04-04 23:18+0930\n"
+"POT-Creation-Date: 2000-12-21 10:38-0800\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -14,140 +14,155 @@
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: ENCODING\n"
 
-#: aout-adobe.c:183
+#: aout-adobe.c:189
 #, c-format
 msgid "%s: Unknown section type in a.out.adobe file: %x\n"
 msgstr ""
 
-#: aoutx.h:1254 aoutx.h:1668
+#: aout-cris.c:205
+#, c-format
+msgid "%s: Invalid relocation type exported: %d"
+msgstr ""
+
+#: aout-cris.c:249
+#, c-format
+msgid "%s: Invalid relocation type imported: %d"
+msgstr ""
+
+#: aout-cris.c:260
+#, c-format
+msgid "%s: Bad relocation record imported: %d"
+msgstr ""
+
+#: aoutx.h:1259 aoutx.h:1673
 #, c-format
 msgid "%s: can not represent section `%s' in a.out object file format"
 msgstr ""
 
-#: aoutx.h:1638
+#: aoutx.h:1643
 #, c-format
 msgid ""
 "%s: can not represent section for symbol `%s' in a.out object file format"
 msgstr ""
 
-#: aoutx.h:1640
+#: aoutx.h:1645
 msgid "*unknown*"
 msgstr ""
 
-#: aoutx.h:3685
+#: aoutx.h:3684
 #, c-format
 msgid "%s: relocateable link from %s to %s not supported"
 msgstr ""
 
-#: archive.c:1724
+#: archive.c:1820
 msgid "Warning: writing archive was slow: rewriting timestamp\n"
 msgstr ""
 
-#: archive.c:1990
+#: archive.c:2086
 msgid "Reading archive file mod timestamp"
 msgstr ""
 
 #. FIXME: bfd can't call perror.
-#: archive.c:2014
+#: archive.c:2113
 msgid "Writing updated armap timestamp"
 msgstr ""
 
-#: bfd.c:274
+#: bfd.c:273
 msgid "No error"
 msgstr ""
 
-#: bfd.c:275
+#: bfd.c:274
 msgid "System call error"
 msgstr ""
 
-#: bfd.c:276
+#: bfd.c:275
 msgid "Invalid bfd target"
 msgstr ""
 
-#: bfd.c:277
+#: bfd.c:276
 msgid "File in wrong format"
 msgstr ""
 
-#: bfd.c:278
+#: bfd.c:277
 msgid "Invalid operation"
 msgstr ""
 
-#: bfd.c:279
+#: bfd.c:278
 msgid "Memory exhausted"
 msgstr ""
 
-#: bfd.c:280
+#: bfd.c:279
 msgid "No symbols"
 msgstr ""
 
-#: bfd.c:281
+#: bfd.c:280
 msgid "Archive has no index; run ranlib to add one"
 msgstr ""
 
-#: bfd.c:282
+#: bfd.c:281
 msgid "No more archived files"
 msgstr ""
 
-#: bfd.c:283
+#: bfd.c:282
 msgid "Malformed archive"
 msgstr ""
 
-#: bfd.c:284
+#: bfd.c:283
 msgid "File format not recognized"
 msgstr ""
 
-#: bfd.c:285
+#: bfd.c:284
 msgid "File format is ambiguous"
 msgstr ""
 
-#: bfd.c:286
+#: bfd.c:285
 msgid "Section has no contents"
 msgstr ""
 
-#: bfd.c:287
+#: bfd.c:286
 msgid "Nonrepresentable section on output"
 msgstr ""
 
-#: bfd.c:288
+#: bfd.c:287
 msgid "Symbol needs debug section which does not exist"
 msgstr ""
 
-#: bfd.c:289
+#: bfd.c:288
 msgid "Bad value"
 msgstr ""
 
-#: bfd.c:290
+#: bfd.c:289
 msgid "File truncated"
 msgstr ""
 
-#: bfd.c:291
+#: bfd.c:290
 msgid "File too big"
 msgstr ""
 
-#: bfd.c:292
+#: bfd.c:291
 msgid "#<Invalid error code>"
 msgstr ""
 
-#: bfd.c:679
+#: bfd.c:675
 #, c-format
 msgid "bfd assertion fail %s:%d"
 msgstr ""
 
-#: bfd.c:697
+#: bfd.c:693
 #, c-format
 msgid "BFD internal error, aborting at %s line %d in %s\n"
 msgstr ""
 
-#: bfd.c:701
+#: bfd.c:697
 #, c-format
 msgid "BFD internal error, aborting at %s line %d\n"
 msgstr ""
 
-#: bfd.c:703
+#: bfd.c:699
 msgid "Please report this bug.\n"
 msgstr ""
 
-#: binary.c:298
+#: binary.c:303
 #, c-format
 msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx."
 msgstr ""
@@ -156,19 +171,19 @@
 msgid "Missing IHCONST"
 msgstr ""
 
-#: coff-a29k.c:182
+#: coff-a29k.c:181
 msgid "Missing IHIHALF"
 msgstr ""
 
-#: coff-a29k.c:214
+#: coff-a29k.c:213
 msgid "Unrecognized reloc"
 msgstr ""
 
-#: coff-a29k.c:427
+#: coff-a29k.c:425
 msgid "missing IHCONST reloc"
 msgstr ""
 
-#: coff-a29k.c:518
+#: coff-a29k.c:516
 msgid "missing IHIHALF reloc"
 msgstr ""
 
@@ -176,126 +191,126 @@
 msgid "GP relative relocation used when GP not defined"
 msgstr ""
 
-#: coff-alpha.c:1486 elf64-alpha.c:3990
+#: coff-alpha.c:1486 elf64-alpha.c:4004
 msgid "using multiple gp values"
 msgstr ""
 
-#: coff-alpha.c:1992 coff-mips.c:1435
+#: coff-alpha.c:1992 coff-mips.c:1434
 msgid "GP relative relocation when GP not defined"
 msgstr ""
 
-#: coff-arm.c:1020 elf32-arm.h:258
+#: coff-arm.c:1018 elf32-arm.h:246
 #, c-format
 msgid "%s: unable to find THUMB glue '%s' for `%s'"
 msgstr ""
 
-#: coff-arm.c:1049 elf32-arm.h:291
+#: coff-arm.c:1047 elf32-arm.h:281
 #, c-format
 msgid "%s: unable to find ARM glue '%s' for `%s'"
 msgstr ""
 
-#: coff-arm.c:1331 coff-arm.c:1426 elf32-arm.h:857 elf32-arm.h:955
+#: coff-arm.c:1335 coff-arm.c:1430 elf32-arm.h:841 elf32-arm.h:946
 #, c-format
 msgid "%s(%s): warning: interworking not enabled."
 msgstr ""
 
-#: coff-arm.c:1335 elf32-arm.h:958
+#: coff-arm.c:1339 elf32-arm.h:949
 #, c-format
 msgid "  first occurrence: %s: arm call to thumb"
 msgstr ""
 
-#: coff-arm.c:1430 elf32-arm.h:860
+#: coff-arm.c:1434 elf32-arm.h:844
 #, c-format
 msgid "  first occurrence: %s: thumb call to arm"
 msgstr ""
 
-#: coff-arm.c:1433
+#: coff-arm.c:1437
 msgid "  consider relinking with --support-old-code enabled"
 msgstr ""
 
-#: coff-arm.c:1722 coff-tic80.c:682 cofflink.c:2980
+#: coff-arm.c:1726 coff-tic80.c:682 cofflink.c:2991
 #, c-format
 msgid "%s: bad reloc address 0x%lx in section `%s'"
 msgstr ""
 
-#: coff-arm.c:2060
+#: coff-arm.c:2063
 #, c-format
 msgid "%s: illegal symbol index in reloc: %d"
 msgstr ""
 
-#: coff-arm.c:2189
+#: coff-arm.c:2191
 #, c-format
 msgid "%s: ERROR: compiled for APCS-%d whereas target %s uses APCS-%d"
 msgstr ""
 
-#: coff-arm.c:2204
+#: coff-arm.c:2206
 #, c-format
 msgid ""
 "%s: ERROR: passes floats in float registers whereas target %s uses integer "
 "registers"
 msgstr ""
 
-#: coff-arm.c:2207
+#: coff-arm.c:2209
 #, c-format
 msgid ""
 "%s: ERROR: passes floats in integer registers whereas target %s uses float "
 "registers"
 msgstr ""
 
-#: coff-arm.c:2222
+#: coff-arm.c:2224
 #, c-format
 msgid ""
 "%s: ERROR: compiled as position independent code, whereas target %s is "
 "absolute position"
 msgstr ""
 
-#: coff-arm.c:2225
+#: coff-arm.c:2227
 #, c-format
 msgid ""
 "%s: ERROR: compiled as absolute position code, whereas target %s is position "
 "independent"
 msgstr ""
 
-#: coff-arm.c:2254
+#: coff-arm.c:2256
 #, c-format
 msgid "Warning: input file %s supports interworking, whereas %s does not."
 msgstr ""
 
-#: coff-arm.c:2257
+#: coff-arm.c:2259
 #, c-format
 msgid "Warning: input file %s does not support interworking, whereas %s does."
 msgstr ""
 
-#: coff-arm.c:2285
+#: coff-arm.c:2286
 #, c-format
 msgid "private flags = %x:"
 msgstr ""
 
-#: coff-arm.c:2293 elf32-arm.h:2089
+#: coff-arm.c:2294 elf32-arm.h:2210
 msgid " [floats passed in float registers]"
 msgstr ""
 
-#: coff-arm.c:2295 elf32-arm.h:2091
+#: coff-arm.c:2296
 msgid " [floats passed in integer registers]"
 msgstr ""
 
-#: coff-arm.c:2298 elf32-arm.h:2094
+#: coff-arm.c:2299 elf32-arm.h:2213
 msgid " [position independent]"
 msgstr ""
 
-#: coff-arm.c:2300 elf32-arm.h:2096
+#: coff-arm.c:2301
 msgid " [absolute position]"
 msgstr ""
 
-#: coff-arm.c:2304
+#: coff-arm.c:2305
 msgid " [interworking flag not initialised]"
 msgstr ""
 
-#: coff-arm.c:2306
+#: coff-arm.c:2307
 msgid " [interworking supported]"
 msgstr ""
 
-#: coff-arm.c:2308
+#: coff-arm.c:2309
 msgid " [interworking not supported]"
 msgstr ""
 
@@ -311,433 +326,475 @@
 msgid "Warning: Clearing the interworking flag of %s due to outside request"
 msgstr ""
 
-#: coff-i960.c:136 coff-i960.c:485
-msgid "uncertain calling convention for non-COFF symbol"
-msgstr ""
-
-#: coff-mips.c:875 elf32-mips.c:1406
-msgid "GP relative relocation when _gp not defined"
-msgstr ""
-
-#: coff-mips.c:2433
-msgid "unsupported reloc type"
-msgstr ""
-
-#. No other sections should appear in -membedded-pic
-#. code.
-#: coff-mips.c:2470
-msgid "reloc against unsupported section"
-msgstr ""
-
-#: coff-mips.c:2478
-msgid "reloc not properly aligned"
-msgstr ""
-
-#: coff-tic80.c:445
+#: coffcode.h:2136
 #, c-format
-msgid "Unrecognized reloc type 0x%x"
+msgid "Unrecognized TI COFF target id '0x%x'"
 msgstr ""
 
-#: coff-w65.c:383
-#, c-format
-msgid "ignoring reloc %s\n"
-msgstr ""
-
-#: coffcode.h:3965
+#: coffcode.h:4194
 #, c-format
 msgid "%s: warning: illegal symbol index %ld in line numbers"
 msgstr ""
 
-#: coffcode.h:3979
+#: coffcode.h:4208
 #, c-format
 msgid "%s: warning: duplicate line number information for `%s'"
 msgstr ""
 
-#: coffcode.h:4334
+#: coffcode.h:4568
 #, c-format
 msgid "%s: Unrecognized storage class %d for %s symbol `%s'"
 msgstr ""
 
-#: coffcode.h:4465
+#: coffcode.h:4699
 #, c-format
 msgid "warning: %s: local symbol `%s' has no section"
 msgstr ""
 
-#: coffcode.h:4578
+#: coff-tic54x.c:376 coffcode.h:4810
 #, c-format
 msgid "%s: warning: illegal symbol index %ld in relocs"
 msgstr ""
 
-#: coffcode.h:4616
+#: coffcode.h:4848
 #, c-format
 msgid "%s: illegal relocation type %d at address 0x%lx"
 msgstr ""
 
-#: coffgen.c:1613
+#: coffgen.c:1631
 #, c-format
 msgid "%s: bad string table size %lu"
 msgstr ""
 
-#: coffgen.c:2076
+#: coffgen.c:2093
 #, c-format
 msgid "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld"
 msgstr ""
 
-#: cofflink.c:518 elflink.h:1568
+#: coff-i960.c:136 coff-i960.c:485
+msgid "uncertain calling convention for non-COFF symbol"
+msgstr ""
+
+#: cofflink.c:526 elflink.h:1649
 #, c-format
 msgid "Warning: type of symbol `%s' changed from %d to %d in %s"
 msgstr ""
 
-#: cofflink.c:2285
+#: cofflink.c:2289
 #, c-format
 msgid "%s: relocs in section `%s', but it has no contents"
 msgstr ""
 
-#: cofflink.c:2619 coffswap.h:904
+#: cofflink.c:2628 coffswap.h:894
 #, c-format
 msgid "%s: %s: reloc overflow: 0x%lx > 0xffff"
 msgstr ""
 
-#: cofflink.c:2628 coffswap.h:891
+#: cofflink.c:2637 coffswap.h:880
 #, c-format
 msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff"
 msgstr ""
 
-#: dwarf2.c:429
+#: coff-m68k.c:475 coff-mips.c:2432 elf32-m68k.c:2265
+msgid "unsupported reloc type"
+msgstr ""
+
+#: coff-mips.c:875 elf32-mips.c:1417
+msgid "GP relative relocation when _gp not defined"
+msgstr ""
+
+#. No other sections should appear in -membedded-pic
+#. code.
+#: coff-mips.c:2469
+msgid "reloc against unsupported section"
+msgstr ""
+
+#: coff-mips.c:2477
+msgid "reloc not properly aligned"
+msgstr ""
+
+#: coff-tic54x.c:263 coff-tic80.c:445
+#, c-format
+msgid "Unrecognized reloc type 0x%x"
+msgstr ""
+
+#: coff-w65.c:369
+#, c-format
+msgid "ignoring reloc %s\n"
+msgstr ""
+
+#: dwarf2.c:423
 msgid "Dwarf Error: Can't find .debug_abbrev section."
 msgstr ""
 
-#: dwarf2.c:447
+#: dwarf2.c:441
 #, c-format
 msgid "Dwarf Error: Abbrev offset (%u) bigger than abbrev size (%u)."
 msgstr ""
 
-#: dwarf2.c:627
+#: dwarf2.c:624
 #, c-format
 msgid "Dwarf Error: Invalid or unhandled FORM value: %d."
 msgstr ""
 
-#: dwarf2.c:700
+#: dwarf2.c:697
 msgid "Dwarf Error: mangled line number section (bad file number)."
 msgstr ""
 
-#: dwarf2.c:791
+#: dwarf2.c:782
 msgid "Dwarf Error: Can't find .debug_line section."
 msgstr ""
 
-#: dwarf2.c:963
+#: dwarf2.c:806
+#, c-format
+msgid "Dwarf Error: Line offset (%u) bigger than line size (%u)."
+msgstr ""
+
+#: dwarf2.c:973
 msgid "Dwarf Error: mangled line number section."
 msgstr ""
 
-#: dwarf2.c:1151 dwarf2.c:1307
+#: dwarf2.c:1152 dwarf2.c:1306
 #, c-format
 msgid "Dwarf Error: Could not find abbrev number %d."
 msgstr ""
 
-#: dwarf2.c:1268
+#: dwarf2.c:1267
 #, c-format
 msgid ""
 "Dwarf Error: found dwarf version '%hu', this reader only handles version 2 "
 "information."
 msgstr ""
 
-#: dwarf2.c:1275
+#: dwarf2.c:1274
 #, c-format
 msgid ""
 "Dwarf Error: found address size '%u', this reader can not handle sizes "
 "greater than '%u'."
 msgstr ""
 
-#: dwarf2.c:1298
+#: dwarf2.c:1297
 #, c-format
 msgid "Dwarf Error: Bad abbrev number: %d."
 msgstr ""
 
-#: ecoff.c:1325
+#: ecoff.c:1323
 #, c-format
 msgid "Unknown basic type %d"
 msgstr ""
 
-#: ecoff.c:1597
+#: ecoff.c:1592
 #, c-format
 msgid ""
 "\n"
 "      End+1 symbol: %ld"
 msgstr ""
 
-#: ecoff.c:1604 ecoff.c:1607
+#: ecoff.c:1599 ecoff.c:1602
 #, c-format
 msgid ""
 "\n"
 "      First symbol: %ld"
 msgstr ""
 
-#: ecoff.c:1619
+#: ecoff.c:1614
 #, c-format
 msgid ""
 "\n"
 "      End+1 symbol: %-7ld   Type:  %s"
 msgstr ""
 
-#: ecoff.c:1626
+#: ecoff.c:1621
 #, c-format
 msgid ""
 "\n"
 "      Local symbol: %ld"
 msgstr ""
 
-#: ecoff.c:1634
+#: ecoff.c:1629
 #, c-format
 msgid ""
 "\n"
 "      struct; End+1 symbol: %ld"
 msgstr ""
 
-#: ecoff.c:1639
+#: ecoff.c:1634
 #, c-format
 msgid ""
 "\n"
 "      union; End+1 symbol: %ld"
 msgstr ""
 
-#: ecoff.c:1644
+#: ecoff.c:1639
 #, c-format
 msgid ""
 "\n"
 "      enum; End+1 symbol: %ld"
 msgstr ""
 
-#: ecoff.c:1650
+#: ecoff.c:1645
 #, c-format
 msgid ""
 "\n"
 "      Type: %s"
 msgstr ""
 
-#: elf-m10200.c:455 elf-m10300.c:670 elf32-arm.h:1853 elf32-d10v.c:493
-#: elf32-fr30.c:651 elf32-m32r.c:1265 elf32-v850.c:1677
-msgid "internal error: out of range error"
-msgstr ""
-
-#: elf-m10200.c:459 elf-m10300.c:674 elf32-arm.h:1857 elf32-d10v.c:497
-#: elf32-fr30.c:655 elf32-m32r.c:1269 elf32-v850.c:1681
-msgid "internal error: unsupported relocation error"
-msgstr ""
-
-#: elf-m10200.c:463 elf-m10300.c:678 elf32-arm.h:1861 elf32-d10v.c:501
-#: elf32-m32r.c:1273
-msgid "internal error: dangerous error"
-msgstr ""
-
-#: elf-m10200.c:467 elf-m10300.c:682 elf32-arm.h:1865 elf32-d10v.c:505
-#: elf32-fr30.c:663 elf32-m32r.c:1277 elf32-v850.c:1701
-msgid "internal error: unknown error"
-msgstr ""
-
-#: elf.c:323
+#: elf32-arm.h:1179
 #, c-format
-msgid "%s: invalid string offset %u >= %lu for section `%s'"
+msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'."
 msgstr ""
 
-#: elf.c:546
-msgid ""
-"\n"
-"Program Header:\n"
-msgstr ""
-
-#: elf.c:594
-msgid ""
-"\n"
-"Dynamic Section:\n"
-msgstr ""
-
-#: elf.c:696
-msgid ""
-"\n"
-"Version definitions:\n"
-msgstr ""
-
-#: elf.c:719
-msgid ""
-"\n"
-"Version References:\n"
-msgstr ""
-
-#: elf.c:724
+#: elf32-arm.h:1375
 #, c-format
-msgid "  required from %s:\n"
+msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'."
 msgstr ""
 
-#: elf.c:1286
-#, c-format
-msgid "%s: invalid link %lu for reloc section %s (index %u)"
-msgstr ""
-
-#: elf.c:2045
-#, c-format
-msgid ""
-"creating section symbol, name = %s, value = 0x%.8lx, index = %d, section = "
-"0x%.8lx\n"
-msgstr ""
-
-#: elf.c:2648
-#, c-format
-msgid "%s: Not enough room for program headers (allocated %u, need %u)"
-msgstr ""
-
-#: elf.c:2747
-#, c-format
-msgid "%s: Not enough room for program headers, try linking with -N"
-msgstr ""
-
-#: elf.c:2873
-#, c-format
-msgid "Error: First section in segment (%s) starts at 0x%x"
-msgstr ""
-
-#: elf.c:2876
-#, c-format
-msgid "       whereas segment starts at 0x%x"
-msgstr ""
-
-#: elf.c:3146
-#, c-format
-msgid "%s: warning: allocated section `%s' not in segment"
-msgstr ""
-
-#: elf.c:3528
-#, c-format
-msgid "%s: symbol `%s' required but not present"
-msgstr ""
-
-#: elf.c:3537
-#, c-format
-msgid ""
-"elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = %d, flags = "
-"0x%.8lx%s\n"
-msgstr ""
-
-#: elf.c:3679
-#, c-format
-msgid "%s: warning: Empty loadable segment detected\n"
-msgstr ""
-
-#: elf.c:4956
-#, c-format
-msgid "%s: unsupported relocation type %s"
-msgstr ""
-
-#: elf32-arm.h:1787 elf32-i386.c:1304 elf32-ppc.c:3092
+#: elf-hppa.h:1369 elf-hppa.h:1402 elf32-arm.h:1853 elf32-i386.c:1428
+#: elf32-ppc.c:3096 elf32-sh.c:2997 elf64-x86-64.c:271
 #, c-format
 msgid ""
 "%s: warning: unresolvable relocation against symbol `%s' from %s section"
 msgstr ""
 
-#: elf32-arm.h:1891
+#: elf-m10200.c:455 elf-m10300.c:669 elf32-arm.h:1927 elf32-avr.c:842
+#: elf32-cris.c:431 elf32-d10v.c:478 elf32-fr30.c:651 elf32-i860.c:1051
+#: elf32-m32r.c:1265 elf32-v850.c:1672
+msgid "internal error: out of range error"
+msgstr ""
+
+#: elf-m10200.c:459 elf-m10300.c:673 elf32-arm.h:1931 elf32-avr.c:846
+#: elf32-cris.c:435 elf32-d10v.c:482 elf32-fr30.c:655 elf32-i860.c:1055
+#: elf32-m32r.c:1269 elf32-v850.c:1676
+msgid "internal error: unsupported relocation error"
+msgstr ""
+
+#: elf-m10200.c:463 elf-m10300.c:677 elf32-arm.h:1935 elf32-d10v.c:486
+#: elf32-m32r.c:1273
+msgid "internal error: dangerous error"
+msgstr ""
+
+#: elf-m10200.c:467 elf-m10300.c:681 elf32-arm.h:1939 elf32-avr.c:854
+#: elf32-cris.c:443 elf32-d10v.c:490 elf32-fr30.c:663 elf32-i860.c:1063
+#: elf32-m32r.c:1277 elf32-v850.c:1696
+msgid "internal error: unknown error"
+msgstr ""
+
+#: elf32-arm.h:1967
 #, c-format
 msgid ""
 "Warning: Not setting interwork flag of %s since it has already been "
 "specified as non-interworking"
 msgstr ""
 
-#: elf32-arm.h:1895
+#: elf32-arm.h:1971
 #, c-format
 msgid "Warning: Clearing the interwork flag of %s due to outside request"
 msgstr ""
 
-#: elf32-arm.h:1943
+#: elf32-arm.h:2019
 #, c-format
 msgid ""
 "Warning: Clearing the interwork flag in %s because non-interworking code in "
 "%s has been linked with it"
 msgstr ""
 
-#: elf32-arm.h:1977
+#: elf32-arm.h:2113
 #, c-format
-msgid "%s: compiled for a %s endian system and target is %s endian"
+msgid ""
+"Error: %s compiled for EABI version %d, whereas %s is compiled for version %d"
 msgstr ""
 
-#: elf32-arm.h:2023
+#: elf32-arm.h:2127
 #, c-format
 msgid "Error: %s compiled for APCS-%d, whereas %s is compiled for APCS-%d"
 msgstr ""
 
-#: elf32-arm.h:2031
+#: elf32-arm.h:2138
 #, c-format
 msgid ""
 "Error: %s passes floats in %s registers, whereas %s passes them in %s "
 "registers"
 msgstr ""
 
-#: elf32-arm.h:2034 elf32-arm.h:2036
+#: elf32-arm.h:2141 elf32-arm.h:2143
 msgid "float"
 msgstr ""
 
-#: elf32-arm.h:2034 elf32-arm.h:2036
+#: elf32-arm.h:2141 elf32-arm.h:2143
 msgid "integer"
 msgstr ""
 
-#: elf32-arm.h:2039
+#: elf32-arm.h:2150
 #, c-format
-msgid "Error: %s is compiled as position %s code, whereas %s is not"
+msgid "Error: %s uses %s floating point, whereas %s uses %s floating point"
 msgstr ""
 
-#: elf32-arm.h:2042
-msgid "independent"
+#: elf32-arm.h:2153 elf32-arm.h:2155
+msgid "soft"
 msgstr ""
 
-#: elf32-arm.h:2042
-msgid "dependent"
+#: elf32-arm.h:2153 elf32-arm.h:2155
+msgid "hard"
 msgstr ""
 
-#: elf32-arm.h:2048
+#: elf32-arm.h:2162
 #, c-format
 msgid "Warning: %s %s interworking, whereas %s %s"
 msgstr ""
 
-#: elf32-arm.h:2051
+#: elf32-arm.h:2165
 msgid "supports"
 msgstr ""
 
-#: elf32-arm.h:2051
+#: elf32-arm.h:2165
 msgid "does not support"
 msgstr ""
 
-#: elf32-arm.h:2053
+#: elf32-arm.h:2167
 msgid "does not"
 msgstr ""
 
-#: elf32-arm.h:2053
+#: elf32-arm.h:2167
 msgid "does"
 msgstr ""
 
-#. Ignore init flag - it may not be set, despite the flags field containing valid data.
-#: elf32-arm.h:2076 elf32-m68k.c:430 elf32-mips.c:2634
+#. Ignore init flag - it may not be set, despite the flags field
+#. containing valid data.
+#: elf32-arm.h:2193 elf32-cris.c:615 elf32-m68k.c:430 elf32-mips.c:2695
 #, c-format
 msgid "private flags = %lx:"
 msgstr ""
 
-#: elf32-arm.h:2079
+#: elf32-arm.h:2202
 msgid " [interworking enabled]"
 msgstr ""
 
-#: elf32-arm.h:2081
-msgid " [interworking not enabled]"
-msgstr ""
-
-#: elf32-arm.h:2084
+#: elf32-arm.h:2205
 msgid " [APCS-26]"
 msgstr ""
 
-#: elf32-arm.h:2086
+#: elf32-arm.h:2207
 msgid " [APCS-32]"
 msgstr ""
 
-#: elf32-fr30.c:659 elf32-v850.c:1685
+#: elf32-arm.h:2216
+msgid " [new ABI]"
+msgstr ""
+
+#: elf32-arm.h:2219
+msgid " [old ABI]"
+msgstr ""
+
+#: elf32-arm.h:2222
+msgid " [software FP]"
+msgstr ""
+
+#: elf32-arm.h:2229
+msgid " [Version1 EABI]"
+msgstr ""
+
+#: elf32-arm.h:2232
+msgid " [sorted symbol table]"
+msgstr ""
+
+#: elf32-arm.h:2234
+msgid " [unsorted symbol table]"
+msgstr ""
+
+#: elf32-arm.h:2240
+msgid " <EABI version unrecognised>"
+msgstr ""
+
+#: elf32-arm.h:2247
+msgid " [relocatable executable]"
+msgstr ""
+
+#: elf32-arm.h:2250
+msgid " [has entry point]"
+msgstr ""
+
+#: elf32-arm.h:2255
+msgid "<Unrecognised flag bits set>"
+msgstr ""
+
+#: elf32-avr.c:850 elf32-cris.c:439 elf32-fr30.c:659 elf32-i860.c:1059
+#: elf32-v850.c:1680
 msgid "internal error: dangerous relocation"
 msgstr ""
 
-#: elf32-i386.c:239
+#: elf32-cris.c:618
+msgid " [symbols have a _ prefix]"
+msgstr ""
+
+#: elf32-cris.c:657
+#, c-format
+msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols"
+msgstr ""
+
+#: elf32-cris.c:658
+#, c-format
+msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols"
+msgstr ""
+
+#: elf32-hppa.c:606
+#, c-format
+msgid "%s(%s+0x%lx): cannot find stub entry %s"
+msgstr ""
+
+#: elf32-hppa.c:667
+#, c-format
+msgid "%s: cannot create stub entry %s"
+msgstr ""
+
+#: elf32-hppa.c:859
+#, c-format
+msgid "%s(%s+0x%lx): cannot relocate %s, recompile with -ffunction-sections"
+msgstr ""
+
+#: elf32-hppa.c:872 elf32-hppa.c:1568
+#, c-format
+msgid "Could not find relocation section for %s"
+msgstr ""
+
+#: elf32-hppa.c:1011 elf32-hppa.c:3362
+#, c-format
+msgid "%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections"
+msgstr ""
+
+#: elf32-hppa.c:1323
+#, c-format
+msgid ""
+"%s: relocation %s can not be used when making a shared object; recompile "
+"with -fPIC"
+msgstr ""
+
+#: elf32-hppa.c:1343
+#, c-format
+msgid ""
+"%s: relocation %s should not be used when making a shared object; recompile "
+"with -fPIC"
+msgstr ""
+
+#: elf32-hppa.c:2755
+#, c-format
+msgid "%s: duplicate export stub %s"
+msgstr ""
+
+#: elf32-hppa.c:3253
+#, c-format
+msgid "%s(%s+0x%lx): fixing %s"
+msgstr ""
+
+#: elf32-hppa.c:3856
+#, c-format
+msgid "%s(%s+0x%lx): cannot handle %s for %s"
+msgstr ""
+
+#: elf32-hppa.c:4173
+msgid ".got section not immediately after .plt section"
+msgstr ""
+
+#: elf32-i386.c:273
 #, c-format
 msgid "%s: invalid relocation type %d"
 msgstr ""
@@ -778,149 +835,151 @@
 msgid " [cpu32]"
 msgstr ""
 
-#: elf32-mcore.c:329
-#, c-format
-msgid "%s: compiled for a %s endian system and target is %s endian.\n"
-msgstr ""
-
-#: elf32-mcore.c:377 elf32-mcore.c:504
+#: elf32-mcore.c:366 elf32-mcore.c:493
 #, c-format
 msgid "%s: Relocation %s (%d) is not currently supported.\n"
 msgstr ""
 
-#: elf32-mcore.c:463
+#: elf32-mcore.c:452
 #, c-format
 msgid "%s: Unknown relocation type %d\n"
 msgstr ""
 
-#: elf32-mips.c:1565
+#: elf32-mips.c:1576
 msgid "32bits gp relative relocation occurs for an external symbol"
 msgstr ""
 
-#: elf32-mips.c:1714
+#: elf32-mips.c:1725
 #, c-format
 msgid "Linking mips16 objects into %s format is not supported"
 msgstr ""
 
-#: elf32-mips.c:2469 elf32-ppc.c:1408
-#, c-format
-msgid "%s: compiled for a big endian system and target is little endian"
-msgstr ""
-
-#: elf32-mips.c:2471 elf32-ppc.c:1410
-#, c-format
-msgid "%s: compiled for a little endian system and target is big endian"
-msgstr ""
-
-#: elf32-mips.c:2520
+#: elf32-mips.c:2582
 #, c-format
 msgid "%s: linking PIC files with non-PIC files"
 msgstr ""
 
-#: elf32-mips.c:2530
+#: elf32-mips.c:2592
 #, c-format
 msgid "%s: linking abicalls files with non-abicalls files"
 msgstr ""
 
-#: elf32-mips.c:2560
+#: elf32-mips.c:2621
 #, c-format
 msgid "%s: ISA mismatch (-mips%d) with previous modules (-mips%d)"
 msgstr ""
 
-#: elf32-mips.c:2569
+#: elf32-mips.c:2630
 #, c-format
 msgid "%s: ISA mismatch (%d) with previous modules (%d)"
 msgstr ""
 
-#: elf32-mips.c:2592
+#: elf32-mips.c:2653
 #, c-format
 msgid "%s: ABI mismatch: linking %s module with previous %s modules"
 msgstr ""
 
-#: elf32-mips.c:2606 elf32-ppc.c:1477 elf64-sparc.c:2844
+#: elf32-mips.c:2667 elf32-ppc.c:1477 elf64-sparc.c:2971
 #, c-format
 msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"
 msgstr ""
 
-#: elf32-mips.c:2637
+#: elf32-mips.c:2698
 msgid " [abi=O32]"
 msgstr ""
 
-#: elf32-mips.c:2639
+#: elf32-mips.c:2700
 msgid " [abi=O64]"
 msgstr ""
 
-#: elf32-mips.c:2641
+#: elf32-mips.c:2702
 msgid " [abi=EABI32]"
 msgstr ""
 
-#: elf32-mips.c:2643
+#: elf32-mips.c:2704
 msgid " [abi=EABI64]"
 msgstr ""
 
-#: elf32-mips.c:2645
+#: elf32-mips.c:2706
 msgid " [abi unknown]"
 msgstr ""
 
-#: elf32-mips.c:2647
+#: elf32-mips.c:2708
 msgid " [abi=N32]"
 msgstr ""
 
-#: elf32-mips.c:2649
+#: elf32-mips.c:2710
 msgid " [abi=64]"
 msgstr ""
 
-#: elf32-mips.c:2651
+#: elf32-mips.c:2712
 msgid " [no abi set]"
 msgstr ""
 
-#: elf32-mips.c:2654
+#: elf32-mips.c:2715
 msgid " [mips1]"
 msgstr ""
 
-#: elf32-mips.c:2656
+#: elf32-mips.c:2717
 msgid " [mips2]"
 msgstr ""
 
-#: elf32-mips.c:2658
+#: elf32-mips.c:2719
 msgid " [mips3]"
 msgstr ""
 
-#: elf32-mips.c:2660
+#: elf32-mips.c:2721
 msgid " [mips4]"
 msgstr ""
 
-#: elf32-mips.c:2662
+#: elf32-mips.c:2723
+msgid " [mips5]"
+msgstr ""
+
+#: elf32-mips.c:2725
+msgid " [mips32]"
+msgstr ""
+
+#: elf32-mips.c:2727
+msgid " [mips64]"
+msgstr ""
+
+#: elf32-mips.c:2729
 msgid " [unknown ISA]"
 msgstr ""
 
-#: elf32-mips.c:2665
+#: elf32-mips.c:2732
 msgid " [32bitmode]"
 msgstr ""
 
-#: elf32-mips.c:2667
+#: elf32-mips.c:2734
 msgid " [not 32bitmode]"
 msgstr ""
 
-#: elf32-mips.c:4270
+#: elf32-mips.c:4388
 msgid "static procedure (no name)"
 msgstr ""
 
-#: elf32-mips.c:4887 elf64-alpha.c:4364
+#: elf32-mips.c:5005 elf64-alpha.c:4377
 #, c-format
 msgid "%s: illegal section name `%s'"
 msgstr ""
 
-#: elf32-mips.c:5414
+#: elf32-mips.c:5570
 msgid "not enough GOT space for local GOT entries"
 msgstr ""
 
-#: elf32-mips.c:6493
+#: elf32-mips.c:6686
 #, c-format
 msgid "%s: %s+0x%lx: jump to stub routine which is not jal"
 msgstr ""
 
-#: elf32-mips.c:7521
+#: elf32-mips.c:7673
+#, c-format
+msgid "Malformed reloc detected for section %s"
+msgstr ""
+
+#: elf32-mips.c:7750
 #, c-format
 msgid "%s: CALL16 reloc at 0x%lx not against global symbol"
 msgstr ""
@@ -942,156 +1001,146 @@
 msgid "%s: Unknown special linker type %d"
 msgstr ""
 
-#: elf32-ppc.c:2251 elf32-ppc.c:2285 elf32-ppc.c:2320
+#: elf32-ppc.c:2245 elf32-ppc.c:2279 elf32-ppc.c:2314
 #, c-format
 msgid "%s: relocation %s cannot be used when making a shared object"
 msgstr ""
 
-#: elf32-ppc.c:3123
+#: elf32-ppc.c:3129
 #, c-format
 msgid "%s: unknown relocation type %d for symbol %s"
 msgstr ""
 
-#: elf32-ppc.c:3491 elf32-ppc.c:3513 elf32-ppc.c:3562
+#: elf32-ppc.c:3493 elf32-ppc.c:3514 elf32-ppc.c:3564
 #, c-format
 msgid ""
 "%s: The target (%s) of a %s relocation is in the wrong output section (%s)"
 msgstr ""
 
-#: elf32-ppc.c:3628
+#: elf32-ppc.c:3630
 #, c-format
 msgid "%s: Relocation %s is not yet supported for symbol %s."
 msgstr ""
 
-#: elf32-sh.c:681
+#: elf32-sh.c:1084
 #, c-format
 msgid "%s: 0x%lx: warning: bad R_SH_USES offset"
 msgstr ""
 
-#: elf32-sh.c:693
+#: elf32-sh.c:1096
 #, c-format
 msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x"
 msgstr ""
 
-#: elf32-sh.c:710
+#: elf32-sh.c:1113
 #, c-format
 msgid "%s: 0x%lx: warning: bad R_SH_USES load offset"
 msgstr ""
 
-#: elf32-sh.c:725
+#: elf32-sh.c:1128
 #, c-format
 msgid "%s: 0x%lx: warning: could not find expected reloc"
 msgstr ""
 
-#: elf32-sh.c:762
+#: elf32-sh.c:1165
 #, c-format
 msgid "%s: 0x%lx: warning: symbol in unexpected section"
 msgstr ""
 
-#: elf32-sh.c:884
+#: elf32-sh.c:1287
 #, c-format
 msgid "%s: 0x%lx: warning: could not find expected COUNT reloc"
 msgstr ""
 
-#: elf32-sh.c:893
+#: elf32-sh.c:1296
 #, c-format
 msgid "%s: 0x%lx: warning: bad count"
 msgstr ""
 
-#: elf32-sh.c:1279 elf32-sh.c:1666
+#: elf32-sh.c:1689 elf32-sh.c:2076
 #, c-format
 msgid "%s: 0x%lx: fatal: reloc overflow while relaxing"
 msgstr ""
 
-#: elf32-sparc.c:1486 elf64-sparc.c:2242
+#: elf32-sparc.c:1512 elf64-sparc.c:2262
 #, c-format
 msgid "%s: probably compiled without -fPIC?"
 msgstr ""
 
-#: elf32-sparc.c:1856
-#, c-format
-msgid "%s: compiled for a v8plus system and target is v8"
-msgstr ""
-
-#: elf32-sparc.c:1865
-#, c-format
-msgid "%s: compiled for a v8plusa system and target is v8plus"
-msgstr ""
-
-#: elf32-sparc.c:1873
+#: elf32-sparc.c:1962
 #, c-format
 msgid "%s: compiled for a 64 bit system and target is 32 bit"
 msgstr ""
 
-#: elf32-sparc.c:1888
+#: elf32-sparc.c:1976
 #, c-format
 msgid "%s: linking little endian files with big endian files"
 msgstr ""
 
-#: elf32-v850.c:680
+#: elf32-v850.c:677
 #, c-format
 msgid "Variable `%s' cannot occupy in multiple small data regions"
 msgstr ""
 
-#: elf32-v850.c:683
+#: elf32-v850.c:680
 #, c-format
 msgid ""
 "Variable `%s' can only be in one of the small, zero, and tiny data regions"
 msgstr ""
 
-#: elf32-v850.c:686
+#: elf32-v850.c:683
 #, c-format
 msgid ""
 "Variable `%s' cannot be in both small and zero data regions simultaneously"
 msgstr ""
 
-#: elf32-v850.c:689
+#: elf32-v850.c:686
 #, c-format
 msgid ""
 "Variable `%s' cannot be in both small and tiny data regions simultaneously"
 msgstr ""
 
-#: elf32-v850.c:692
+#: elf32-v850.c:689
 #, c-format
 msgid ""
 "Variable `%s' cannot be in both zero and tiny data regions simultaneously"
 msgstr ""
 
-#: elf32-v850.c:1070
+#: elf32-v850.c:1066
 msgid "FAILED to find previous HI16 reloc\n"
 msgstr ""
 
-#: elf32-v850.c:1689
+#: elf32-v850.c:1684
 msgid "could not locate special linker symbol __gp"
 msgstr ""
 
-#: elf32-v850.c:1693
+#: elf32-v850.c:1688
 msgid "could not locate special linker symbol __ep"
 msgstr ""
 
-#: elf32-v850.c:1697
+#: elf32-v850.c:1692
 msgid "could not locate special linker symbol __ctbp"
 msgstr ""
 
-#: elf32-v850.c:1886
+#: elf32-v850.c:1881
 #, c-format
 msgid "%s: Architecture mismatch with previous modules"
 msgstr ""
 
-#: elf32-v850.c:1905
+#: elf32-v850.c:1900
 #, c-format
 msgid "private flags = %lx: "
 msgstr ""
 
-#: elf32-v850.c:1910
+#: elf32-v850.c:1905
 msgid "v850 architecture"
 msgstr ""
 
-#: elf32-v850.c:1911
+#: elf32-v850.c:1906
 msgid "v850e architecture"
 msgstr ""
 
-#: elf32-v850.c:1912
+#: elf32-v850.c:1907
 msgid "v850ea architecture"
 msgstr ""
 
@@ -1099,82 +1148,175 @@
 msgid "GPDISP relocation did not find ldah and lda instructions"
 msgstr ""
 
-#: elf64-alpha.c:3004
+#: elf64-alpha.c:3014
 #, c-format
 msgid "%s: .got subsegment exceeds 64K (size %d)"
 msgstr ""
 
-#: elf64-sparc.c:1249
+#: elf64-sparc.c:1248
 #, c-format
 msgid "%s: check_relocs: unhandled reloc type %d"
 msgstr ""
 
-#: elf64-sparc.c:1286
+#: elf64-sparc.c:1285
 msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER"
 msgstr ""
 
-#: elf64-sparc.c:1306
+#: elf64-sparc.c:1305
 msgid ""
 "Register %%g%d used incompatibly: previously declared in %s to %s, in %s "
 "redefined to %s"
 msgstr ""
 
-#: elf64-sparc.c:1329
+#: elf64-sparc.c:1328
 #, c-format
 msgid "Symbol `%s' has differing types: previously %s, REGISTER in %s"
 msgstr ""
 
-#: elf64-sparc.c:1375
+#: elf64-sparc.c:1374
 #, c-format
 msgid "Symbol `%s' has differing types: REGISTER in %s, %s in %s"
 msgstr ""
 
-#: elf64-sparc.c:2825
+#: elf64-sparc.c:2952
 #, c-format
 msgid "%s: linking UltraSPARC specific with HAL specific code"
 msgstr ""
 
-#: elfcode.h:1061
+#: elf.c:325
+#, c-format
+msgid "%s: invalid string offset %u >= %lu for section `%s'"
+msgstr ""
+
+#: elf.c:566
+msgid ""
+"\n"
+"Program Header:\n"
+msgstr ""
+
+#: elf.c:614
+msgid ""
+"\n"
+"Dynamic Section:\n"
+msgstr ""
+
+#: elf.c:743
+msgid ""
+"\n"
+"Version definitions:\n"
+msgstr ""
+
+#: elf.c:766
+msgid ""
+"\n"
+"Version References:\n"
+msgstr ""
+
+#: elf.c:771
+#, c-format
+msgid "  required from %s:\n"
+msgstr ""
+
+#: elf.c:1359
+#, c-format
+msgid "%s: invalid link %lu for reloc section %s (index %u)"
+msgstr ""
+
+#: elf.c:2113
+#, c-format
+msgid ""
+"creating section symbol, name = %s, value = 0x%.8lx, index = %d, section = "
+"0x%.8lx\n"
+msgstr ""
+
+#: elf.c:2716
+#, c-format
+msgid "%s: Not enough room for program headers (allocated %u, need %u)"
+msgstr ""
+
+#: elf.c:2815
+#, c-format
+msgid "%s: Not enough room for program headers, try linking with -N"
+msgstr ""
+
+#: elf.c:2941
+#, c-format
+msgid "Error: First section in segment (%s) starts at 0x%x"
+msgstr ""
+
+#: elf.c:2944
+#, c-format
+msgid "       whereas segment starts at 0x%x"
+msgstr ""
+
+#: elf.c:3217
+#, c-format
+msgid "%s: warning: allocated section `%s' not in segment"
+msgstr ""
+
+#: elf.c:3616
+#, c-format
+msgid "%s: symbol `%s' required but not present"
+msgstr ""
+
+#: elf.c:3625
+#, c-format
+msgid ""
+"elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = %d, flags = "
+"0x%.8lx%s\n"
+msgstr ""
+
+#: elf.c:3866
+#, c-format
+msgid "%s: warning: Empty loadable segment detected\n"
+msgstr ""
+
+#: elf.c:5213
+#, c-format
+msgid "%s: unsupported relocation type %s"
+msgstr ""
+
+#: elfcode.h:1076
 #, c-format
 msgid "%s: version count (%ld) does not match symbol count (%ld)"
 msgstr ""
 
-#: elflink.c:423
+#: elflink.c:432
 #, c-format
 msgid "%s: Section %s is already to large to put hole of %ld bytes in"
 msgstr ""
 
-#: elflink.h:1388
+#: elflink.h:1466
 #, c-format
 msgid "%s: %s: invalid version %u (max %d)"
 msgstr ""
 
-#: elflink.h:1429
+#: elflink.h:1507
 #, c-format
 msgid "%s: %s: invalid needed version %d"
 msgstr ""
 
-#: elflink.h:1546
+#: elflink.h:1627
 #, c-format
 msgid "Warning: size of symbol `%s' changed from %lu to %lu in %s"
 msgstr ""
 
-#: elflink.h:1790
+#: elflink.h:1873
 #, c-format
 msgid "%s: warning: unexpected redefinition of `%s'"
 msgstr ""
 
-#: elflink.h:3480
+#: elflink.h:3660
 #, c-format
 msgid "warning: type and size of dynamic symbol `%s' are not defined"
 msgstr ""
 
-#: elflink.h:3752
+#: elflink.h:3932
 #, c-format
 msgid "%s: undefined versioned symbol name %s"
 msgstr ""
 
-#: elflink.h:4983
+#: elflink.h:5181
 #, c-format
 msgid "%s: could not find output section %s for input section %s"
 msgstr ""
@@ -1283,6 +1425,16 @@
 msgid "not mapping: env var not set\n"
 msgstr ""
 
+#: libbfd.c:1383
+#, c-format
+msgid "%s: compiled for a big endian system and target is little endian"
+msgstr ""
+
+#: libbfd.c:1385
+#, c-format
+msgid "%s: compiled for a little endian system and target is big endian"
+msgstr ""
+
 #: linker.c:2679
 #, c-format
 msgid "Attempt to do relocateable link with %s input and %s output"
@@ -1299,330 +1451,328 @@
 msgstr ""
 
 #. XXX code yet to be written.
-#: peicode.h:806
+#: peicode.h:809
 #, c-format
 msgid "%s: Unhandled import type; %x"
 msgstr ""
 
-#: peicode.h:811
+#: peicode.h:814
 #, c-format
 msgid "%s: Unrecognised import type; %x"
 msgstr ""
 
-#: peicode.h:825
+#: peicode.h:828
 #, c-format
 msgid "%s: Unrecognised import name type; %x"
 msgstr ""
 
-#: peicode.h:1182
+#: peicode.h:1185
 #, c-format
 msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive"
 msgstr ""
 
-#: peicode.h:1194
+#: peicode.h:1197
 #, c-format
 msgid ""
 "%s: Recognised but unhandled machine type (0x%x) in Import Library Format "
 "archive"
 msgstr ""
 
-#: peicode.h:1211
+#: peicode.h:1214
 #, c-format
 msgid "%s: size field is zero in Import Library Format header"
 msgstr ""
 
-#: peicode.h:1239
+#: peicode.h:1242
 #, c-format
 msgid "%s: string not null terminated in ILF object file."
 msgstr ""
 
-#: peigen.c:938
+#: peigen.c:993
 #, c-format
 msgid "%s: line number overflow: 0x%lx > 0xffff"
 msgstr ""
 
-#: peigen.c:950
+#: peigen.c:1011
 #, c-format
-msgid "%s: reloc overflow: 0x%lx > 0xffff"
+msgid "%s: reloc overflow 1: 0x%lx > 0xffff"
 msgstr ""
 
-#: peigen.c:963
+#: peigen.c:1024
 msgid "Export Directory [.edata (or where ever we found it)]"
 msgstr ""
 
-#: peigen.c:964
+#: peigen.c:1025
 msgid "Import Directory [parts of .idata]"
 msgstr ""
 
-#: peigen.c:965
+#: peigen.c:1026
 msgid "Resource Directory [.rsrc]"
 msgstr ""
 
-#: peigen.c:966
+#: peigen.c:1027
 msgid "Exception Directory [.pdata]"
 msgstr ""
 
-#: peigen.c:967
+#: peigen.c:1028
 msgid "Security Directory"
 msgstr ""
 
-#: peigen.c:968
+#: peigen.c:1029
 msgid "Base Relocation Directory [.reloc]"
 msgstr ""
 
-#: peigen.c:969
+#: peigen.c:1030
 msgid "Debug Directory"
 msgstr ""
 
-#: peigen.c:970
+#: peigen.c:1031
 msgid "Description Directory"
 msgstr ""
 
-#: peigen.c:971
+#: peigen.c:1032
 msgid "Special Directory"
 msgstr ""
 
-#: peigen.c:972
+#: peigen.c:1033
 msgid "Thread Storage Directory [.tls]"
 msgstr ""
 
-#: peigen.c:973
+#: peigen.c:1034
 msgid "Load Configuration Directory"
 msgstr ""
 
-#: peigen.c:974
+#: peigen.c:1035
 msgid "Bound Import Directory"
 msgstr ""
 
-#: peigen.c:975
+#: peigen.c:1036
 msgid "Import Address Table Directory"
 msgstr ""
 
-#: peigen.c:976 peigen.c:977 peigen.c:978
+#: peigen.c:1037
+msgid "Delay Import Directory"
+msgstr ""
+
+#: peigen.c:1038 peigen.c:1039
 msgid "Reserved"
 msgstr ""
 
-#: peigen.c:1022
-msgid ""
-"\n"
-"The import table is the .idata section\n"
-msgstr ""
-
-#: peigen.c:1044
+#: peigen.c:1103
 msgid ""
 "\n"
 "There is an import table, but the section containing it could not be found\n"
 msgstr ""
 
-#: peigen.c:1048
+#: peigen.c:1108
 #, c-format
 msgid ""
 "\n"
 "There is an import table in %s at 0x%lx\n"
 msgstr ""
 
-#: peigen.c:1089
+#: peigen.c:1147
 #, c-format
 msgid ""
 "\n"
 "Function descriptor located at the start address: %04lx\n"
 msgstr ""
 
-#: peigen.c:1092
+#: peigen.c:1150
 #, c-format
 msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n"
 msgstr ""
 
-#: peigen.c:1098
+#: peigen.c:1156
 msgid ""
 "\n"
 "No reldata section! Function descriptor not decoded.\n"
 msgstr ""
 
-#: peigen.c:1103
+#: peigen.c:1161
+#, c-format
 msgid ""
 "\n"
-"The Import Tables (interpreted .idata section contents)\n"
+"The Import Tables (interpreted %s section contents)\n"
 msgstr ""
 
-#: peigen.c:1105
+#: peigen.c:1164
 msgid " vma:            Hint    Time      Forward  DLL       First\n"
 msgstr ""
 
-#: peigen.c:1107
+#: peigen.c:1166
 msgid "                 Table   Stamp     Chain    Name      Thunk\n"
 msgstr ""
 
-#: peigen.c:1157
+#: peigen.c:1216
 #, c-format
 msgid ""
 "\n"
 "\tDLL Name: %s\n"
 msgstr ""
 
-#: peigen.c:1161 peigen.c:1224
+#: peigen.c:1220 peigen.c:1283
 msgid "\tvma:  Hint/Ord Member-Name\n"
 msgstr ""
 
-#: peigen.c:1223
+#: peigen.c:1282
 msgid "\tThe Import Address Table (difference found)\n"
 msgstr ""
 
-#: peigen.c:1230
+#: peigen.c:1289
 msgid "\t>>> Ran out of IAT members!\n"
 msgstr ""
 
-#: peigen.c:1248
+#: peigen.c:1308
 msgid "\tThe Import Address Table is identical\n"
 msgstr ""
 
-#: peigen.c:1297
-msgid ""
-"\n"
-"The export table is the .edata section\n"
-msgstr ""
-
-#: peigen.c:1319
+#: peigen.c:1381
 msgid ""
 "\n"
 "There is an export table, but the section containing it could not be found\n"
 msgstr ""
 
-#: peigen.c:1323
+#: peigen.c:1386
 #, c-format
 msgid ""
 "\n"
 "There is an export table in %s at 0x%lx\n"
 msgstr ""
 
-#: peigen.c:1355
+#: peigen.c:1417
+#, c-format
 msgid ""
 "\n"
-"The Export Tables (interpreted .edata section contents)\n"
+"The Export Tables (interpreted %s section contents)\n"
 "\n"
 msgstr ""
 
-#: peigen.c:1358
+#: peigen.c:1421
 #, c-format
 msgid "Export Flags \t\t\t%lx\n"
 msgstr ""
 
-#: peigen.c:1361
+#: peigen.c:1424
 #, c-format
 msgid "Time/Date stamp \t\t%lx\n"
 msgstr ""
 
-#: peigen.c:1364
+#: peigen.c:1427
 #, c-format
 msgid "Major/Minor \t\t\t%d/%d\n"
 msgstr ""
 
-#: peigen.c:1367
+#: peigen.c:1430
 msgid "Name \t\t\t\t"
 msgstr ""
 
-#: peigen.c:1373
+#: peigen.c:1436
 #, c-format
 msgid "Ordinal Base \t\t\t%ld\n"
 msgstr ""
 
-#: peigen.c:1376
+#: peigen.c:1439
 msgid "Number in:\n"
 msgstr ""
 
-#: peigen.c:1379
+#: peigen.c:1442
 #, c-format
-msgid "\tExport Address Table \t\t%lx\n"
+msgid "\tExport Address Table \t\t%08lx\n"
 msgstr ""
 
-#: peigen.c:1383
+#: peigen.c:1446
 #, c-format
-msgid "\t[Name Pointer/Ordinal] Table\t%lu\n"
+msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n"
 msgstr ""
 
-#: peigen.c:1386
+#: peigen.c:1449
 msgid "Table Addresses\n"
 msgstr ""
 
-#: peigen.c:1389
+#: peigen.c:1452
 msgid "\tExport Address Table \t\t"
 msgstr ""
 
-#: peigen.c:1394
+#: peigen.c:1457
 msgid "\tName Pointer Table \t\t"
 msgstr ""
 
-#: peigen.c:1399
+#: peigen.c:1462
 msgid "\tOrdinal Table \t\t\t"
 msgstr ""
 
-#: peigen.c:1415
+#: peigen.c:1476
 #, c-format
 msgid ""
 "\n"
 "Export Address Table -- Ordinal Base %ld\n"
 msgstr ""
 
-#: peigen.c:1436
+#: peigen.c:1495
 msgid "Forwarder RVA"
 msgstr ""
 
-#: peigen.c:1444
+#: peigen.c:1506
 msgid "Export RVA"
 msgstr ""
 
-#: peigen.c:1451
+#: peigen.c:1513
 msgid ""
 "\n"
 "[Ordinal/Name Pointer] Table\n"
 msgstr ""
 
-#: peigen.c:1496
+#: peigen.c:1568
 #, c-format
 msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n"
 msgstr ""
 
-#: peigen.c:1500
+#: peigen.c:1572
 msgid ""
 "\n"
 "The Function Table (interpreted .pdata section contents)\n"
 msgstr ""
 
-#: peigen.c:1502
+#: peigen.c:1575
+msgid " vma:\t\t\tBegin Address    End Address      Unwind Info\n"
+msgstr ""
+
+#: peigen.c:1578
 msgid " vma:\t\tBegin    End      EH       EH       PrologEnd  Exception\n"
 msgstr ""
 
-#: peigen.c:1504
+#: peigen.c:1580
 msgid "     \t\tAddress  Address  Handler  Data     Address    Mask\n"
 msgstr ""
 
-#: peigen.c:1576
+#: peigen.c:1652
 msgid " Register save millicode"
 msgstr ""
 
-#: peigen.c:1579
+#: peigen.c:1655
 msgid " Register restore millicode"
 msgstr ""
 
-#: peigen.c:1582
+#: peigen.c:1658
 msgid " Glue code sequence"
 msgstr ""
 
-#: peigen.c:1628
+#: peigen.c:1709
 msgid ""
 "\n"
 "\n"
 "PE File Base Relocations (interpreted .reloc section contents)\n"
 msgstr ""
 
-#: peigen.c:1663
+#: peigen.c:1744
 #, c-format
 msgid ""
 "\n"
 "Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"
 msgstr ""
 
-#: peigen.c:1676
+#: peigen.c:1757
 #, c-format
 msgid "\treloc %4d offset %4x [%4lx] %s"
 msgstr ""
@@ -1630,71 +1780,96 @@
 #. The MS dumpbin program reportedly ands with 0xff0f before
 #. printing the characteristics field.  Not sure why.  No reason to
 #. emulate it here.
-#: peigen.c:1714
+#: peigen.c:1796
 #, c-format
 msgid ""
 "\n"
 "Characteristics 0x%x\n"
 msgstr ""
 
-#: ppcboot.c:418
+#: pe-mips.c:657
+#, c-format
+msgid "%s: `ld -r' not supported with PE MIPS objects\n"
+msgstr ""
+
+#. OK, at this point the following variables are set up:
+#. src = VMA of the memory we're fixing up
+#. mem = pointer to memory we're fixing up
+#. val = VMA of what we need to refer to
+#.
+#: pe-mips.c:794
+#, c-format
+msgid "%s: unimplemented %s\n"
+msgstr ""
+
+#: pe-mips.c:820
+#, c-format
+msgid "%s: jump too far away\n"
+msgstr ""
+
+#: pe-mips.c:847
+#, c-format
+msgid "%s: bad pair/reflo after refhi\n"
+msgstr ""
+
+#: ppcboot.c:422
 msgid ""
 "\n"
 "ppcboot header:\n"
 msgstr ""
 
-#: ppcboot.c:419
+#: ppcboot.c:423
 #, c-format
 msgid "Entry offset        = 0x%.8lx (%ld)\n"
 msgstr ""
 
-#: ppcboot.c:420
+#: ppcboot.c:424
 #, c-format
 msgid "Length              = 0x%.8lx (%ld)\n"
 msgstr ""
 
-#: ppcboot.c:423
+#: ppcboot.c:427
 #, c-format
 msgid "Flag field          = 0x%.2x\n"
 msgstr ""
 
-#: ppcboot.c:429
+#: ppcboot.c:433
 #, c-format
 msgid "Partition name      = \"%s\"\n"
 msgstr ""
 
-#: ppcboot.c:448
+#: ppcboot.c:452
 #, c-format
 msgid ""
 "\n"
 "Partition[%d] start  = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"
 msgstr ""
 
-#: ppcboot.c:454
+#: ppcboot.c:458
 #, c-format
 msgid "Partition[%d] end    = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"
 msgstr ""
 
-#: ppcboot.c:460
+#: ppcboot.c:464
 #, c-format
 msgid "Partition[%d] sector = 0x%.8lx (%ld)\n"
 msgstr ""
 
-#: ppcboot.c:461
+#: ppcboot.c:465
 #, c-format
 msgid "Partition[%d] length = 0x%.8lx (%ld)\n"
 msgstr ""
 
-#: som.c:5335
+#: som.c:5365
 msgid "som_sizeof_headers unimplemented"
 msgstr ""
 
-#: srec.c:290
+#: srec.c:300
 #, c-format
 msgid "%s:%d: Unexpected character `%s' in S-record file\n"
 msgstr ""
 
-#: syms.c:974
+#: syms.c:968
 msgid "Unsupported .stab relocation"
 msgstr ""
 
@@ -1718,33 +1893,33 @@
 msgid "unknown gsd/egsd subtype %d"
 msgstr ""
 
-#: vms-hdr.c:405
+#: vms-hdr.c:408
 msgid "Object module NOT error-free !\n"
 msgstr ""
 
-#: vms-misc.c:541
+#: vms-misc.c:545
 #, c-format
 msgid "Stack overflow (%d) in _bfd_vms_push"
 msgstr ""
 
-#: vms-misc.c:560
+#: vms-misc.c:564
 msgid "Stack underflow in _bfd_vms_pop"
 msgstr ""
 
-#: vms-misc.c:931
+#: vms-misc.c:935
 msgid "_bfd_vms_output_counted called with zero bytes"
 msgstr ""
 
-#: vms-misc.c:936
+#: vms-misc.c:940
 msgid "_bfd_vms_output_counted called with too many bytes"
 msgstr ""
 
-#: vms-misc.c:1069
+#: vms-misc.c:1073
 #, c-format
 msgid "Symbol %s replaced by %s\n"
 msgstr ""
 
-#: vms-misc.c:1133
+#: vms-misc.c:1137
 #, c-format
 msgid "failed to enter %s"
 msgstr ""
@@ -1940,97 +2115,97 @@
 msgid "Unhandled relocation %s"
 msgstr ""
 
-#: xcofflink.c:1661
+#: xcofflink.c:1634
 #, c-format
 msgid "%s: `%s' has line numbers but no enclosing section"
 msgstr ""
 
-#: xcofflink.c:1713
+#: xcofflink.c:1686
 #, c-format
 msgid "%s: class %d symbol `%s' has no aux entries"
 msgstr ""
 
-#: xcofflink.c:1736
+#: xcofflink.c:1709
 #, c-format
 msgid "%s: symbol `%s' has unrecognized csect type %d"
 msgstr ""
 
-#: xcofflink.c:1748
+#: xcofflink.c:1721
 #, c-format
 msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"
 msgstr ""
 
-#: xcofflink.c:1787
+#: xcofflink.c:1760
 #, c-format
 msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d"
 msgstr ""
 
-#: xcofflink.c:1911
+#: xcofflink.c:1883
 #, c-format
 msgid "%s: symbol `%s' has unrecognized smclas %d"
 msgstr ""
 
-#: xcofflink.c:1930
+#: xcofflink.c:1902
 #, c-format
 msgid "%s: csect `%s' not in enclosing section"
 msgstr ""
 
-#: xcofflink.c:2034
+#: xcofflink.c:2006
 #, c-format
 msgid "%s: misplaced XTY_LD `%s'"
 msgstr ""
 
-#: xcofflink.c:2345
+#: xcofflink.c:2317
 #, c-format
 msgid "%s: reloc %s:%d not in csect"
 msgstr ""
 
-#: xcofflink.c:2480
+#: xcofflink.c:2452
 #, c-format
 msgid "%s: XCOFF shared object when not producing XCOFF output"
 msgstr ""
 
-#: xcofflink.c:2501
+#: xcofflink.c:2473
 #, c-format
 msgid "%s: dynamic object with no .loader section"
 msgstr ""
 
-#: xcofflink.c:3141
+#: xcofflink.c:3113
 #, c-format
 msgid "%s: no such symbol"
 msgstr ""
 
-#: xcofflink.c:3733
+#: xcofflink.c:3704
 #, c-format
 msgid "warning: attempt to export undefined symbol `%s'"
 msgstr ""
 
-#: xcofflink.c:4709
+#: xcofflink.c:4698
 #, c-format
 msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling"
 msgstr ""
 
-#: xcofflink.c:5534 xcofflink.c:5890 xcofflink.c:5927 xcofflink.c:6244
+#: xcofflink.c:5523 xcofflink.c:5879 xcofflink.c:5916 xcofflink.c:6233
 #, c-format
 msgid "%s: loader reloc in unrecognized section `%s'"
 msgstr ""
 
-#: xcofflink.c:5556 xcofflink.c:6255
+#: xcofflink.c:5545 xcofflink.c:6244
 #, c-format
 msgid "%s: `%s' in loader reloc but not loader sym"
 msgstr ""
 
-#: xcofflink.c:5571
+#: xcofflink.c:5560
 #, c-format
 msgid "%s: loader reloc in read-only section %s"
 msgstr ""
 
-#: xcofflink.c:6451
+#: xcofflink.c:6440
 #, c-format
 msgid "%s: unsupported relocation type 0x%02x"
 msgstr ""
 
-#: xcofflink.c:6497
+#: xcofflink.c:6486
 #, c-format
 msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"
 msgstr ""
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 7b86e37..ed02c63 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -728,9 +728,6 @@
 
 	  /* WTF?? */
 	  if (abfd->xvec->flavour == bfd_target_coff_flavour
-	      && strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0
-	      && strcmp (abfd->xvec->name, "aixcoff64-rs6000") != 0
-	      && strcmp (abfd->xvec->name, "xcoff-powermac") != 0
 	      && strcmp (abfd->xvec->name, "coff-Intel-little") != 0
 	      && strcmp (abfd->xvec->name, "coff-Intel-big") != 0)
 	    {
@@ -1125,9 +1122,6 @@
 
       /* WTF?? */
       if (abfd->xvec->flavour == bfd_target_coff_flavour
-	  && strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0
-	  && strcmp (abfd->xvec->name, "aixcoff64-rs6000") != 0
-	  && strcmp (abfd->xvec->name, "xcoff-powermac") != 0
 	  && strcmp (abfd->xvec->name, "coff-Intel-little") != 0
 	  && strcmp (abfd->xvec->name, "coff-Intel-big") != 0)
 	{
@@ -2084,6 +2078,25 @@
   i386/elf relocations
 
 ENUM
+  BFD_RELOC_X86_64_GOT32
+ENUMX
+  BFD_RELOC_X86_64_PLT32
+ENUMX
+  BFD_RELOC_X86_64_COPY
+ENUMX
+  BFD_RELOC_X86_64_GLOB_DAT
+ENUMX
+  BFD_RELOC_X86_64_JUMP_SLOT
+ENUMX
+  BFD_RELOC_X86_64_RELATIVE
+ENUMX
+  BFD_RELOC_X86_64_GOTPCREL
+ENUMX
+  BFD_RELOC_X86_64_32S
+ENUMDOC
+  x86-64/elf relocations
+
+ENUM
   BFD_RELOC_NS32K_IMM_8
 ENUMX
   BFD_RELOC_NS32K_IMM_16
@@ -2313,6 +2326,16 @@
   BFD_RELOC_SH_LOOP_START
 ENUMX
   BFD_RELOC_SH_LOOP_END
+ENUMX
+  BFD_RELOC_SH_COPY
+ENUMX
+  BFD_RELOC_SH_GLOB_DAT
+ENUMX
+  BFD_RELOC_SH_JMP_SLOT
+ENUMX
+  BFD_RELOC_SH_RELATIVE
+ENUMX
+  BFD_RELOC_SH_GOTPC
 ENUMDOC
   Hitachi SH relocs.  Not all of these appear in object files.
 
@@ -2830,8 +2853,6 @@
 ENUMX
   BFD_RELOC_IA64_LTOFF_FPTR64LSB
 ENUMX
-  BFD_RELOC_IA64_SEGBASE
-ENUMX
   BFD_RELOC_IA64_SEGREL32MSB
 ENUMX
   BFD_RELOC_IA64_SEGREL32LSB
@@ -2868,10 +2889,6 @@
 ENUMX
   BFD_RELOC_IA64_IPLTLSB
 ENUMX
-  BFD_RELOC_IA64_EPLTMSB
-ENUMX
-  BFD_RELOC_IA64_EPLTLSB
-ENUMX
   BFD_RELOC_IA64_COPY
 ENUMX
   BFD_RELOC_IA64_TPREL22
@@ -2887,6 +2904,104 @@
   BFD_RELOC_IA64_LDXMOV
 ENUMDOC
   Intel IA64 Relocations.
+
+ENUM
+  BFD_RELOC_M68HC11_HI8
+ENUMDOC
+  Motorola 68HC11 reloc.
+  This is the 8 bits high part of an absolute address.
+ENUM
+  BFD_RELOC_M68HC11_LO8
+ENUMDOC
+  Motorola 68HC11 reloc.
+  This is the 8 bits low part of an absolute address.
+ENUM
+  BFD_RELOC_M68HC11_3B
+ENUMDOC
+  Motorola 68HC11 reloc.
+  This is the 3 bits of a value.
+
+ENUM
+  BFD_RELOC_CRIS_BDISP8
+ENUMX
+  BFD_RELOC_CRIS_UNSIGNED_5
+ENUMX
+  BFD_RELOC_CRIS_SIGNED_6
+ENUMX
+  BFD_RELOC_CRIS_UNSIGNED_6
+ENUMX
+  BFD_RELOC_CRIS_UNSIGNED_4
+ENUMDOC
+  These relocs are only used within the CRIS assembler.  They are not
+  (at present) written to any object files.
+
+ENUM
+  BFD_RELOC_860_COPY
+ENUMX
+  BFD_RELOC_860_GLOB_DAT
+ENUMX
+  BFD_RELOC_860_JUMP_SLOT
+ENUMX
+  BFD_RELOC_860_RELATIVE
+ENUMX
+  BFD_RELOC_860_PC26
+ENUMX
+  BFD_RELOC_860_PLT26
+ENUMX
+  BFD_RELOC_860_PC16
+ENUMX
+  BFD_RELOC_860_LOW0
+ENUMX
+  BFD_RELOC_860_SPLIT0
+ENUMX
+  BFD_RELOC_860_LOW1
+ENUMX
+  BFD_RELOC_860_SPLIT1
+ENUMX
+  BFD_RELOC_860_LOW2
+ENUMX
+  BFD_RELOC_860_SPLIT2
+ENUMX
+  BFD_RELOC_860_LOW3
+ENUMX
+  BFD_RELOC_860_LOGOT0
+ENUMX
+  BFD_RELOC_860_SPGOT0
+ENUMX
+  BFD_RELOC_860_LOGOT1
+ENUMX
+  BFD_RELOC_860_SPGOT1
+ENUMX
+  BFD_RELOC_860_LOGOTOFF0
+ENUMX
+  BFD_RELOC_860_SPGOTOFF0
+ENUMX
+  BFD_RELOC_860_LOGOTOFF1
+ENUMX
+  BFD_RELOC_860_SPGOTOFF1
+ENUMX
+  BFD_RELOC_860_LOGOTOFF2
+ENUMX
+  BFD_RELOC_860_LOGOTOFF3
+ENUMX
+  BFD_RELOC_860_LOPC
+ENUMX
+  BFD_RELOC_860_HIGHADJ
+ENUMX
+  BFD_RELOC_860_HAGOT
+ENUMX
+  BFD_RELOC_860_HAGOTOFF
+ENUMX
+  BFD_RELOC_860_HAPC
+ENUMX
+  BFD_RELOC_860_HIGH
+ENUMX
+  BFD_RELOC_860_HIGOT
+ENUMX
+  BFD_RELOC_860_HIGOTOFF
+ENUMDOC
+  Intel i860 Relocations.
+
 ENDSENUM
   BFD_RELOC_UNUSED
 CODE_FRAGMENT
diff --git a/bfd/reloc16.c b/bfd/reloc16.c
index 0e7c18a..cb9636f 100644
--- a/bfd/reloc16.c
+++ b/bfd/reloc16.c
@@ -1,5 +1,5 @@
 /* 8 and 16 bit COFF relocation functions, for BFD.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 2000
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -19,10 +19,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-/* 
-Most of this hacked by  Steve Chamberlain,
-			sac@cygnus.com 
-*/
+/* Most of this hacked by Steve Chamberlain <sac@cygnus.com>.  */
 
 /* These routines are used by coff-h8300 and coff-z8k to do
    relocation.
@@ -53,7 +50,7 @@
   asymbol *symbol = *(reloc->sym_ptr_ptr);
   /* A symbol holds a pointer to a section, and an offset from the
      base of the section.  To relocate, we find where the section will
-     live in the output and add that in */
+     live in the output and add that in.  */
 
   if (bfd_is_und_section (symbol->section)
       || bfd_is_com_section (symbol->section))
@@ -79,29 +76,29 @@
 	value = h->u.c.size;
       else
 	{
-	  if (! ((*link_info->callbacks->undefined_symbol)
-		 (link_info, bfd_asymbol_name (symbol),
-		  input_section->owner, input_section, reloc->address,
-		  true)))
+	  if (!((*link_info->callbacks->undefined_symbol)
+		(link_info, bfd_asymbol_name (symbol),
+		 input_section->owner, input_section, reloc->address,
+		 true)))
 	    abort ();
 	  value = 0;
 	}
     }
-  else 
+  else
     {
-      value = symbol->value +
-	symbol->section->output_offset +
-	  symbol->section->output_section->vma;
+      value = symbol->value
+	+ symbol->section->output_offset
+	+ symbol->section->output_section->vma;
     }
-  
-  /* Add the value contained in the relocation */
+
+  /* Add the value contained in the relocation.  */
   value += reloc->addend;
-  
+
   return value;
 }
 
 void
-bfd_perform_slip(abfd, slip, input_section, value)
+bfd_perform_slip (abfd, slip, input_section, value)
      bfd *abfd;
      unsigned int slip;
      asection *input_section;
@@ -113,13 +110,13 @@
   BFD_ASSERT (s != (asymbol **) NULL);
 
   /* Find all symbols past this point, and make them know
-     what's happened */
-  while (*s) 
+     what's happened.  */
+  while (*s)
     {
       asymbol *p = *s;
-      if (p->section == input_section) 
+      if (p->section == input_section)
 	{
-	  /* This was pointing into this section, so mangle it */
+	  /* This was pointing into this section, so mangle it.  */
 	  if (p->value > value)
 	    {
 	      p->value -= slip;
@@ -136,17 +133,17 @@
 	    }
 	}
       s++;
-    }    
+    }
 }
 
-boolean 
+boolean
 bfd_coff_reloc16_relax_section (abfd, i, link_info, again)
      bfd *abfd;
      asection *i;
      struct bfd_link_info *link_info;
      boolean *again;
 {
-  /* Get enough memory to hold the stuff */
+  /* Get enough memory to hold the stuff.  */
   bfd *input_bfd = i->owner;
   asection *input_section = i;
   int *shrinks;
@@ -166,7 +163,7 @@
   if (!reloc_vector && reloc_size > 0)
     return false;
 
-  /* Get the relocs and think about them */
+  /* Get the relocs and think about them.  */
   reloc_count =
     bfd_canonicalize_reloc (input_bfd, input_section, reloc_vector,
 			    _bfd_generic_link_get_symbols (input_bfd));
@@ -190,7 +187,7 @@
      entire link, we could use the generic relaxing code in the linker
      and get better results, particularly for jsr->bsr and 24->16 bit
      memory reference relaxations.  */
-     
+
   if (reloc_count > 0)
     {
       int another_pass = 0;
@@ -208,7 +205,7 @@
 
 	another_pass = 0;
 
-	for (i = 0, parent = reloc_vector; *parent; parent++, i++) 
+	for (i = 0, parent = reloc_vector; *parent; parent++, i++)
 	  {
 	    /* Let the target/machine dependent code examine each reloc
 	       in this section and attempt to shrink it.  */
@@ -224,15 +221,15 @@
 		  shrinks[j] += shrink - shrinks[i];
 	      }
 	  }
-  
-      } while (another_pass);
+      }
+      while (another_pass);
 
       shrink = shrinks[reloc_count];
-      free((char *)shrinks);
+      free ((char *) shrinks);
     }
 
-  input_section->_cooked_size -= shrink;  
-  free((char *)reloc_vector);
+  input_section->_cooked_size -= shrink;
+  free ((char *) reloc_vector);
   return true;
 }
 
@@ -250,7 +247,7 @@
      boolean relocateable;
      asymbol **symbols;
 {
-  /* Get enough memory to hold the stuff */
+  /* Get enough memory to hold the stuff.  */
   bfd *input_bfd = link_order->u.indirect.section->owner;
   asection *input_section = link_order->u.indirect.section;
   long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
@@ -267,20 +264,19 @@
 						       data, relocateable,
 						       symbols);
 
-  /* read in the section */
-  if (! bfd_get_section_contents(input_bfd,
-				 input_section,
-				 data,
-				 0,
-				 input_section->_raw_size))
+  /* Read in the section.  */
+  if (!bfd_get_section_contents(input_bfd,
+				input_section,
+				data,
+				0,
+				input_section->_raw_size))
     return NULL;
-  
-  
-  reloc_vector = (arelent **) bfd_malloc((size_t) reloc_size);
+
+  reloc_vector = (arelent **) bfd_malloc ((size_t) reloc_size);
   if (!reloc_vector && reloc_size != 0)
     return NULL;
-  
-  reloc_count = bfd_canonicalize_reloc (input_bfd, 
+
+  reloc_count = bfd_canonicalize_reloc (input_bfd,
 					input_section,
 					reloc_vector,
 					symbols);
@@ -289,49 +285,46 @@
       free (reloc_vector);
       return NULL;
     }
-    
+
   if (reloc_count > 0)
     {
       arelent **parent = reloc_vector;
-      arelent *reloc ;
+      arelent *reloc;
       unsigned int dst_address = 0;
       unsigned int src_address = 0;
       unsigned int run;
       unsigned int idx;
-    
-      /* Find how long a run we can do */
-      while (dst_address < link_order->size) 
+
+      /* Find how long a run we can do.  */
+      while (dst_address < link_order->size)
 	{
 	  reloc = *parent;
-	  if (reloc) 
+	  if (reloc)
 	    {
 	      /* Note that the relaxing didn't tie up the addresses in the
 		 relocation, so we use the original address to work out the
-		 run of non-relocated data */
+		 run of non-relocated data.  */
 	      run = reloc->address - src_address;
 	      parent++;
 	    }
-	  else 
+	  else
 	    {
 	      run = link_order->size - dst_address;
 	    }
-	  /* Copy the bytes */
+
+	  /* Copy the bytes.  */
 	  for (idx = 0; idx < run; idx++)
-	    {
-	      data[dst_address++] = data[src_address++];
-	    }
-    
-	  /* Now do the relocation */
-    
-	  if (reloc) 
+	    data[dst_address++] = data[src_address++];
+
+	  /* Now do the relocation.  */
+	  if (reloc)
 	    {
 	      bfd_coff_reloc16_extra_cases (input_bfd, link_info, link_order,
 					    reloc, data, &src_address,
 					    &dst_address);
-	    }    
+	    }
 	}
     }
-  free((char *)reloc_vector);
+  free ((char *) reloc_vector);
   return data;
 }
-
diff --git a/bfd/riscix.c b/bfd/riscix.c
index b3eb18c..c4e9b7e 100644
--- a/bfd/riscix.c
+++ b/bfd/riscix.c
@@ -1,5 +1,6 @@
 /* BFD back-end for RISC iX (Acorn, arm) binaries.
-   Copyright (C) 1994, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1994, 95, 96, 97, 98, 99, 2000
+   Free Software Foundation, Inc.
    Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
    
 This file is part of BFD, the Binary File Descriptor library.
@@ -238,9 +239,9 @@
 }
 
 reloc_howto_type *
-DEFUN(riscix_reloc_type_lookup,(abfd,code),
-      bfd *abfd AND
-      bfd_reloc_code_real_type code)
+riscix_reloc_type_lookup (abfd, code)
+     bfd *abfd;
+     bfd_reloc_code_real_type code;
 {
 #define ASTD(i,j)       case i: return &riscix_std_reloc_howto[j]
   if (code == BFD_RELOC_CTOR)
diff --git a/bfd/rs6000-core.c b/bfd/rs6000-core.c
index 6de7441..7f6bec4 100644
--- a/bfd/rs6000-core.c
+++ b/bfd/rs6000-core.c
@@ -5,7 +5,7 @@
    Using the following chars caused a compiler warning on HIUX (so I replaced
    them with octal escapes), and isn't useful without an understanding of what
    character set it is.
-   Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365, 
+   Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365,
      and John Gilmore.
    Archive support from Damon A. Permezel.
    Contributed by IBM Corporation and Cygnus Support.
@@ -30,8 +30,6 @@
    compiled on an RS/6000 host.  -- no archive support, no core files.
    In all cases, it does not support writing.
 
-   FIXMEmgo comments are left from Metin Ozisik's original port.
-
    This is in a separate file from coff-rs6000.c, because it includes
    system include files that conflict with coff/rs6000.h.
   */
@@ -64,68 +62,216 @@
 
 
 /* ------------------------------------------------------------------------ */
-/*	Support for core file stuff.. 					    */
+/*	Support for core file stuff..					    */
 /* ------------------------------------------------------------------------ */
 
 #include <sys/user.h>
+#define __LDINFO_PTRACE32__	/* for __ld_info32 */
+#define __LDINFO_PTRACE64__	/* for __ld_info64 */
 #include <sys/ldr.h>
 #include <sys/core.h>
+#include <sys/systemcfg.h>
 
+#define	core_hdr(bfd)		((CoreHdr *) bfd->tdata.any)
 
-/* Number of special purpose registers supported by gdb.  This value
-   should match `tm.h' in gdb directory.  Clean this mess up and use
-   the macros in sys/reg.h.  FIXMEmgo. */
+/* AIX 4.1 changed the names and locations of a few items in the core file.
+   AIX 4.3 defined an entirely new structure, core_dumpx, but kept support for
+   the previous 4.1 structure, core_dump.
 
-#define	NUM_OF_SPEC_REGS  7
+   AIX_CORE_DUMPX_CORE is defined (by configure) on AIX 4.3+, and
+   CORE_VERSION_1 is defined (by AIX core.h) as 2 on AIX 4.3+ and as 1 on AIX
+   4.1 and 4.2.  AIX pre-4.1 (aka 3.x) either doesn't define CORE_VERSION_1
+   or else defines it as 0. */
 
-#define	core_hdr(bfd)		(((Rs6kCorData*)(bfd->tdata.any))->hdr)
+#if defined(CORE_VERSION_1) && !CORE_VERSION_1
+# undef CORE_VERSION_1
+#endif
 
-/* AIX 4.1 Changed the names and locations of a few items in the core file,
-   this seems to be the quickest/easiest way to deal with it. 
+/* The following union and macros allow this module to compile on all AIX
+   versions and to handle both core_dumpx and core_dump on 4.3+.  CNEW_*()
+   and COLD_*() macros respectively retrieve core_dumpx and core_dump
+   values. */
 
-   Note however that encoding magic addresses (STACK_END_ADDR) is going
-   to be _very_ fragile.  But I don't see any easy way to get that info
-   right now.
-   
-   AIX 4.3 defines an entirely new structure (core_dumpx).  Yet the
-   basic logic stays the same and we can still use our macro
-   redefinition mechanism to effect the necessary changes.  */
+/* Union of 32-bit and 64-bit versions of ld_info. */
+
+typedef union {
+#ifdef __ld_info32
+  struct __ld_info32 l32;
+  struct __ld_info64 l64;
+#else
+  struct ld_info l32;
+  struct ld_info l64;
+#endif
+} LdInfo;
+
+/* Union of old and new core dump structures. */
+
+typedef union {
+#ifdef AIX_CORE_DUMPX_CORE
+    struct core_dumpx new;	/* new AIX 4.3+ core dump */
+#else
+    struct core_dump new;	/* for simpler coding */
+#endif
+    struct core_dump old;	/* old AIX 4.2- core dump, still used on
+				   4.3+ with appropriate SMIT config */
+} CoreHdr;
+
+/* Union of old and new vm_info structures. */
+
+#ifdef CORE_VERSION_1
+typedef union {
+#ifdef AIX_CORE_DUMPX_CORE
+    struct vm_infox new;
+#else
+    struct vm_info new;
+#endif
+    struct vm_info old;
+} VmInfo;
+#endif
+
+/* Return whether CoreHdr C is in new or old format. */
 
 #ifdef AIX_CORE_DUMPX_CORE
-#define CORE_DATA_SIZE_FIELD c_dataorg
-#define CORE_COMM_FIELD c_u.U_proc.pi_comm
-#define SAVE_FIELD c_flt.hctx.r32
-#define STACK_END_ADDR coredata.c_stackorg + coredata.c_size
-#define LOADER_OFFSET_FIELD c_loader
-#define LOADER_REGION_SIZE coredata.c_lsize
-#define CORE_DUMP core_dumpx
+# define CORE_NEW(c)	(!(c).old.c_entries)
 #else
+# define CORE_NEW(c)	0
+#endif
+
+/* Return the c_stackorg field from struct core_dumpx C. */
+
+#ifdef AIX_CORE_DUMPX_CORE
+# define CNEW_STACKORG(c)	(c).c_stackorg
+#else
+# define CNEW_STACKORG(c)	0
+#endif
+
+/* Return the offset to the loader region from struct core_dump C. */
+
+#ifdef AIX_CORE_DUMPX_CORE
+# define CNEW_LOADER(c)	(c).c_loader
+#else
+# define CNEW_LOADER(c)	0
+#endif
+
+/* Return the offset to the loader region from struct core_dump C. */
+
+#define COLD_LOADER(c)	(c).c_tab
+
+/* Return the c_lsize field from struct core_dumpx C. */
+
+#ifdef AIX_CORE_DUMPX_CORE
+# define CNEW_LSIZE(c)	(c).c_lsize
+#else
+# define CNEW_LSIZE(c)	0
+#endif
+
+/* Return the c_dataorg field from struct core_dumpx C. */
+
+#ifdef AIX_CORE_DUMPX_CORE
+# define CNEW_DATAORG(c)	(c).c_dataorg
+#else
+# define CNEW_DATAORG(c)	0
+#endif
+
+/* Return the c_datasize field from struct core_dumpx C. */
+
+#ifdef AIX_CORE_DUMPX_CORE
+# define CNEW_DATASIZE(c)	(c).c_datasize
+#else
+# define CNEW_DATASIZE(c)	0
+#endif
+
+/* Return the c_impl field from struct core_dumpx C. */
+
+#ifdef AIX_CORE_DUMPX_CORE
+# define CNEW_IMPL(c)	(c).c_impl
+#else
+# define CNEW_IMPL(c)	0
+#endif
+
+/* Return the command string from struct core_dumpx C. */
+
+#ifdef AIX_CORE_DUMPX_CORE
+# define CNEW_COMM(c)	(c).c_u.U_proc.pi_comm
+#else
+# define CNEW_COMM(c)	0
+#endif
+
+/* Return the command string from struct core_dump C. */
+
 #ifdef CORE_VERSION_1
-#define CORE_DATA_SIZE_FIELD c_u.U_dsize
-#define CORE_COMM_FIELD c_u.U_comm
-#define SAVE_FIELD c_mst
-#define	STACK_END_ADDR 0x2ff23000
-#define LOADER_OFFSET_FIELD c_tab
-#define LOADER_REGION_SIZE 0x7ffffff
-#define CORE_DUMP core_dump
+# define COLD_COMM(c)	(c).c_u.U_comm
 #else
-#define CORE_DATA_SIZE_FIELD c_u.u_dsize
-#define CORE_COMM_FIELD c_u.u_comm
-#define SAVE_FIELD c_u.u_save
-#define	STACK_END_ADDR 0x2ff80000
-#define LOADER_OFFSET_FIELD c_tab
-#define LOADER_REGION_SIZE 0x7ffffff
-#define CORE_DUMP core_dump
-#endif
+# define COLD_COMM(c)	(c).c_u.u_comm
 #endif
 
-/* These are stored in the bfd's tdata */
-typedef struct {
-  struct CORE_DUMP hdr;		/* core file header */
-} Rs6kCorData;
+/* Return the struct __context64 pointer from struct core_dumpx C. */
 
-static asection *make_bfd_asection PARAMS ((bfd *, CONST char *, flagword,
-					    bfd_size_type, bfd_vma, file_ptr));
+#ifdef AIX_CORE_DUMPX_CORE
+# define CNEW_CONTEXT64(c)	(c).c_flt.hctx.r64
+#else
+# define CNEW_CONTEXT64(c)	c
+#endif
+
+/* Return the struct mstsave pointer from struct core_dumpx C. */
+
+#ifdef AIX_CORE_DUMPX_CORE
+# define CNEW_MSTSAVE(c)	(c).c_flt.hctx.r32
+#else
+# define CNEW_MSTSAVE(c)	c
+#endif
+
+/* Return the struct mstsave pointer from struct core_dump C. */
+
+#ifdef CORE_VERSION_1
+# define COLD_MSTSAVE(c)	(c).c_mst
+#else
+# define COLD_MSTSAVE(c)	(c).c_u.u_save
+#endif
+
+/* Return whether struct core_dumpx is from a 64-bit process. */
+
+#ifdef AIX_CORE_DUMPX_CORE
+# define CNEW_PROC64(c)		IS_PROC64(&(c).c_u.U_proc)
+#else
+# define CNEW_PROC64(c)		0
+#endif
+
+/* Magic end-of-stack addresses for old core dumps.  This is _very_ fragile,
+   but I don't see any easy way to get that info right now. */
+
+#ifdef CORE_VERSION_1
+# define COLD_STACKEND	0x2ff23000
+#else
+# define COLD_STACKEND	0x2ff80000
+#endif
+
+/* Size of the leading portion that old and new core dump structures have in
+   common. */
+#define CORE_COMMONSZ	((int)&((struct core_dump *)0)->c_entries + \
+			 sizeof (((struct core_dump *)0)->c_entries))
+
+/* Try to read into CORE the header from the core file associated with ABFD. 
+   Return success. */
+
+static boolean
+read_hdr (bfd *abfd, CoreHdr *core)
+{
+  bfd_size_type size;
+
+  if (bfd_seek (abfd, 0, SEEK_SET) != 0)
+    return false;
+
+  /* Read the leading portion that old and new core dump structures have in
+     common. */
+  if (bfd_read (core, CORE_COMMONSZ, 1, abfd) != CORE_COMMONSZ)
+    return false;
+
+  /* Read the trailing portion of the structure. */
+  size = CORE_NEW (*core) ? sizeof (core->new) : sizeof (core->old)
+    - CORE_COMMONSZ;
+  return bfd_read ((char *)core + CORE_COMMONSZ, size, 1, abfd) == size;
+}
 
 static asection *
 make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos)
@@ -158,22 +304,65 @@
 rs6000coff_core_p (abfd)
      bfd *abfd;
 {
-  struct CORE_DUMP coredata;
+  CoreHdr core;
   struct stat statbuf;
-  bfd_size_type nread;
+  bfd_size_type size;
   char *tmpptr;
 
-  if (bfd_seek (abfd, 0, SEEK_SET) != 0)
-    return NULL;
+  /* Values from new and old core structures. */
+  int c_flag;
+  file_ptr c_stack, c_regoff, c_loader;
+  bfd_size_type c_size, c_regsize, c_lsize;
+  bfd_vma c_stackend;
+  void *c_regptr;
+  int proc64;
 
-  nread = bfd_read (&coredata, 1, sizeof (struct CORE_DUMP), abfd);
-  if (nread != sizeof (struct CORE_DUMP))
+  if (!read_hdr (abfd, &core))
     {
       if (bfd_get_error () != bfd_error_system_call)
 	bfd_set_error (bfd_error_wrong_format);
       return NULL;
     }
 
+  /* Copy fields from new or old core structure. */
+  if (CORE_NEW (core))
+    {
+      c_flag = core.new.c_flag;
+      c_stack = (file_ptr) core.new.c_stack;
+      c_size = core.new.c_size;
+      c_stackend = CNEW_STACKORG (core.new) + c_size;
+      c_lsize = CNEW_LSIZE (core.new);
+      c_loader = CNEW_LOADER (core.new);
+      proc64 = CNEW_PROC64 (core.new);
+    }
+  else
+    {
+      c_flag = core.old.c_flag;
+      c_stack = (file_ptr) core.old.c_stack;
+      c_size = core.old.c_size;
+      c_stackend = COLD_STACKEND;
+      c_lsize = 0x7ffffff;
+      c_loader = (file_ptr) COLD_LOADER (core.old);
+      proc64 = 0;
+    }
+
+  if (proc64)
+    {
+      c_regsize = sizeof (CNEW_CONTEXT64 (core.new));
+      c_regptr = &CNEW_CONTEXT64 (core.new);
+    }
+  else if (CORE_NEW (core))
+    {
+      c_regsize = sizeof (CNEW_MSTSAVE (core.new));
+      c_regptr = &CNEW_MSTSAVE (core.new);
+    }
+  else
+    {
+      c_regsize = sizeof (COLD_MSTSAVE (core.old));
+      c_regptr = &COLD_MSTSAVE (core.old);
+    }
+  c_regoff = (char *)c_regptr - (char *)&core;
+
   if (bfd_stat (abfd, &statbuf) < 0)
     {
       bfd_set_error (bfd_error_system_call);
@@ -190,92 +379,92 @@
 
      For the data segment, we have no choice but to keep going if it's
      not there, since the default behavior is not to dump it (regardless
-     of the ulimit, it's based on SA_FULLDUMP).  But for the stack segment,
+     of the ulimit, it's based on SA_FULLDUMP).	 But for the stack segment,
      if it's not there, we refuse to have anything to do with this core
      file.  The usefulness of a core dump without a stack segment is pretty
      limited anyway.  */
-     
-  if (!(coredata.c_flag & UBLOCK_VALID)
-      || !(coredata.c_flag & LE_VALID))
+
+  if (!(c_flag & UBLOCK_VALID)
+      || !(c_flag & LE_VALID))
     {
       bfd_set_error (bfd_error_wrong_format);
       return NULL;
     }
 
-  if (!(coredata.c_flag & USTACK_VALID))
+  if (!(c_flag & USTACK_VALID))
     {
       bfd_set_error (bfd_error_file_truncated);
       return NULL;
     }
 
   /* Don't check the core file size for a full core, AIX 4.1 includes
-     additional shared library sections in a full core.  */
-  if (!(coredata.c_flag & (FULL_CORE | CORE_TRUNC))
-      && ((bfd_vma)coredata.c_stack + coredata.c_size) != statbuf.st_size)
+     additional shared library sections in a full core.	 */
+  if (!(c_flag & (FULL_CORE | CORE_TRUNC)))
     {
-      /* If the size is wrong, it means we're misinterpreting something.  */
-      bfd_set_error (bfd_error_wrong_format);
-      return NULL;
+      /* If the size is wrong, it means we're misinterpreting something. */
+      if (c_stack + (file_ptr) c_size != statbuf.st_size)
+	{
+	  bfd_set_error (bfd_error_wrong_format);
+	  return NULL;
+	}
     }
 
-#ifdef AIX_CORE_DUMPX_CORE
-  /* For the core_dumpx format, make sure c_entries == 0  If it does
-     not, the core file uses the old format */
-  if (coredata.c_entries != 0)
-    {
-      bfd_set_error (bfd_error_wrong_format);
-      return NULL;
-    }
-#else
   /* Sanity check on the c_tab field.  */
-  if ((u_long) coredata.c_tab < sizeof coredata ||
-      (u_long) coredata.c_tab >= statbuf.st_size ||
-      (long) coredata.c_tab >= (long)coredata.c_stack)
+  if (!CORE_NEW (core) && (c_loader < (file_ptr) sizeof core.old ||
+			   c_loader >= statbuf.st_size ||
+			   c_loader >= c_stack))
     {
       bfd_set_error (bfd_error_wrong_format);
       return NULL;
     }
-#endif
 
   /* Issue warning if the core file was truncated during writing.  */
-  if (coredata.c_flag & CORE_TRUNC)
+  if (c_flag & CORE_TRUNC)
     (*_bfd_error_handler) (_("%s: warning core file truncated"),
 			   bfd_get_filename (abfd));
 
-  /* Allocate core file header.  */
-  tmpptr = (char*) bfd_zalloc (abfd, sizeof (Rs6kCorData));
+  /* Allocate core file header.	 */
+  size = CORE_NEW (core) ? sizeof (core.new) : sizeof (core.old);
+  tmpptr = (char*) bfd_zalloc (abfd, size);
   if (!tmpptr)
     return NULL;
-      
-  set_tdata (abfd, tmpptr);
 
   /* Copy core file header.  */
-  core_hdr (abfd) = coredata;
+  memcpy (tmpptr, &core, size);
+  set_tdata (abfd, tmpptr);
+
+  /* Set architecture. */
+  if (CORE_NEW (core))
+    {
+      enum bfd_architecture arch;
+      unsigned long mach;
+
+      switch (CNEW_IMPL (core.new))
+	{
+	case POWER_RS1:
+	case POWER_RSC:
+	case POWER_RS2:
+	  arch = bfd_arch_rs6000;
+	  mach = bfd_mach_rs6k;
+	  break;
+	default:
+	  arch = bfd_arch_powerpc;
+	  mach = bfd_mach_ppc;
+	  break;
+      }
+      bfd_default_set_arch_mach (abfd, arch, mach);
+    }
 
   /* .stack section. */
   if (!make_bfd_asection (abfd, ".stack",
-  			  SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
-			  (bfd_size_type) coredata.c_size,
-			  (bfd_vma) (STACK_END_ADDR - coredata.c_size),
-			  (file_ptr) coredata.c_stack))
+			  SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
+			  c_size, c_stackend - c_size, c_stack))
     return NULL;
 
-  /* .reg section for GPRs and special registers. */
+  /* .reg section for all registers. */
   if (!make_bfd_asection (abfd, ".reg",
-  			  SEC_HAS_CONTENTS,
-			  (bfd_size_type) ((32 + NUM_OF_SPEC_REGS) * 4),
-			  (bfd_vma) 0,
-			  (file_ptr) ((char *) &coredata.SAVE_FIELD
-				      - (char *) &coredata)))
-    return NULL;
-
-  /* .reg2 section for FPRs (floating point registers). */
-  if (!make_bfd_asection (abfd, ".reg2",
-  			  SEC_HAS_CONTENTS,
-			  (bfd_size_type) 8 * 32,	/* 32 FPRs. */
-			  (bfd_vma) 0,
-			  (file_ptr) ((char *) &coredata.SAVE_FIELD.fpr[0]
-				      - (char *) &coredata)))
+			  SEC_HAS_CONTENTS,
+			  c_regsize, (bfd_vma) 0, c_regoff))
     return NULL;
 
   /* .ldinfo section.
@@ -283,10 +472,8 @@
      core dump would require going down the whole list of struct ld_info's.
      See if we can just fake it.  */
   if (!make_bfd_asection (abfd, ".ldinfo",
-  			  SEC_HAS_CONTENTS,
-			  (bfd_size_type) LOADER_REGION_SIZE,
-			  (bfd_vma) 0,
-			  (file_ptr) coredata.LOADER_OFFSET_FIELD))
+			  SEC_HAS_CONTENTS,
+			  c_lsize, (bfd_vma) 0, c_loader))
     return NULL;
 
 #ifndef CORE_VERSION_1
@@ -294,16 +481,16 @@
      AIX 3 dumps the complete data section and sets FULL_CORE if the
      ulimit is large enough, otherwise the data section is omitted.
      AIX 4 sets FULL_CORE even if the core file is truncated, we have
-     to examine coredata.c_datasize below to find out the actual size of
-     the .data section.  */
-  if (coredata.c_flag & FULL_CORE)
+     to examine core.c_datasize below to find out the actual size of
+     the .data section.	 */
+  if (c_flag & FULL_CORE)
     {
       if (!make_bfd_asection (abfd, ".data",
 			      SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
-			      (bfd_size_type) coredata.CORE_DATA_SIZE_FIELD,
+			      (bfd_size_type) core.old.c_u.u_dsize,
 			      (bfd_vma)
-				CDATA_ADDR (coredata.CORE_DATA_SIZE_FIELD),
-			      (file_ptr) coredata.c_stack + coredata.c_size))
+				CDATA_ADDR (core.old.c_u.u_dsize),
+			      c_stack + c_size))
 	return NULL;
     }
 #endif
@@ -313,68 +500,119 @@
      which can be found by examining ldinfo, and anonymously mmapped
      regions.  */
   {
-    struct ld_info ldinfo;
-    bfd_size_type ldinfo_size;
-    file_ptr ldinfo_offset = (file_ptr) coredata.LOADER_OFFSET_FIELD;
+    LdInfo ldinfo;
+    bfd_size_type ldi_datasize;
+    file_ptr ldi_core;
+    uint ldi_next;
+    bfd_vma ldi_dataorg;
+
+    /* Fields from new and old core structures. */
+    bfd_size_type c_datasize, c_vmregions;
+    file_ptr c_data, c_vmm;
+
+    if (CORE_NEW (core))
+      {
+	c_datasize = CNEW_DATASIZE (core.new);
+	c_data = (file_ptr) core.new.c_data;
+	c_vmregions = core.new.c_vmregions;
+	c_vmm = (file_ptr) core.new.c_vmm;
+      }
+    else
+      {
+	c_datasize = core.old.c_datasize;
+	c_data = (file_ptr) core.old.c_data;
+	c_vmregions = core.old.c_vmregions;
+	c_vmm = (file_ptr) core.old.c_vmm;
+      }
 
     /* .data section from executable.  */
-    if (coredata.c_datasize)
+    if (c_datasize)
       {
 	if (!make_bfd_asection (abfd, ".data",
 				SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
-				(bfd_size_type) coredata.c_datasize,
-				(bfd_vma)
-				  CDATA_ADDR (coredata.CORE_DATA_SIZE_FIELD),
-				(file_ptr) coredata.c_data))
+				c_datasize,
+				(bfd_vma) CDATA_ADDR (c_datasize),
+				c_data))
 	  return NULL;
       }
 
     /* .data sections from loaded objects.  */
-    ldinfo_size = (char *) &ldinfo.ldinfo_filename[0]
-		  - (char *) &ldinfo.ldinfo_next;
+    if (proc64)
+      size = (int)((LdInfo *)0)->l64.ldinfo_filename;
+    else
+      size = (int)((LdInfo *)0)->l32.ldinfo_filename;
+
     while (1)
       {
-	if (bfd_seek (abfd, ldinfo_offset, SEEK_SET) != 0)
+	if (bfd_seek (abfd, c_loader, SEEK_SET) != 0)
 	  return NULL;
-	if (bfd_read (&ldinfo, ldinfo_size, 1, abfd) != ldinfo_size)
+	if (bfd_read (&ldinfo, size, 1, abfd) != size)
 	  return NULL;
-	if (ldinfo.ldinfo_core)
+
+	if (proc64)
 	  {
-	    if (!make_bfd_asection (abfd, ".data",
-				    SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
-				    (bfd_size_type) ldinfo.ldinfo_datasize,
-				    (bfd_vma) ldinfo.ldinfo_dataorg,
-				    (file_ptr) ldinfo.ldinfo_core))
-	      return NULL;
+	    ldi_core = ldinfo.l64.ldinfo_core;
+	    ldi_datasize = ldinfo.l64.ldinfo_datasize;
+	    ldi_dataorg = (bfd_vma) ldinfo.l64.ldinfo_dataorg;
+	    ldi_next = ldinfo.l64.ldinfo_next;
 	  }
-	if (ldinfo.ldinfo_next == 0)
+	else
+	  {
+	    ldi_core = ldinfo.l32.ldinfo_core;
+	    ldi_datasize = ldinfo.l32.ldinfo_datasize;
+	    ldi_dataorg = (bfd_vma)(long) ldinfo.l32.ldinfo_dataorg;
+	    ldi_next = ldinfo.l32.ldinfo_next;
+	  }
+
+	if (ldi_core)
+	  if (!make_bfd_asection (abfd, ".data",
+				  SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
+				  ldi_datasize, ldi_dataorg, ldi_core))
+	      return NULL;
+
+	if (ldi_next == 0)
 	  break;
-	ldinfo_offset += ldinfo.ldinfo_next;
+	c_loader += ldi_next;
       }
 
     /* .vmdata sections from anonymously mmapped regions.  */
-    if (coredata.c_vmregions)
+    if (c_vmregions)
       {
-	int i;
+	bfd_size_type i;
 
-	if (bfd_seek (abfd, (file_ptr) coredata.c_vmm, SEEK_SET) != 0)
+	if (bfd_seek (abfd, c_vmm, SEEK_SET) != 0)
 	  return NULL;
 
-	for (i = 0; i < coredata.c_vmregions; i++)
+	for (i = 0; i < c_vmregions; i++)
 	  {
-	    struct vm_info vminfo;
+	    VmInfo vminfo;
+	    bfd_size_type vminfo_size;
+	    file_ptr vminfo_offset;
+	    bfd_vma vminfo_addr;
 
-	    if (bfd_read (&vminfo, sizeof (vminfo), 1, abfd) != sizeof (vminfo))
+	    size = CORE_NEW (core) ? sizeof (vminfo.new) : sizeof (vminfo.old);
+	    if (bfd_read (&vminfo, size, 1, abfd) != size)
 	      return NULL;
-	    if (vminfo.vminfo_offset)
+
+	    if (CORE_NEW (core))
 	      {
-		if (!make_bfd_asection (abfd, ".vmdata",
-					SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
-					(bfd_size_type) vminfo.vminfo_size,
-					(bfd_vma) vminfo.vminfo_addr,
-					(file_ptr) vminfo.vminfo_offset))
-		  return NULL;
+		vminfo_addr = (bfd_vma) vminfo.new.vminfo_addr;
+		vminfo_size = vminfo.new.vminfo_size;
+		vminfo_offset = vminfo.new.vminfo_offset;
 	      }
+	    else
+	      {
+		vminfo_addr = (bfd_vma)(long) vminfo.old.vminfo_addr;
+		vminfo_size = vminfo.old.vminfo_size;
+		vminfo_offset = vminfo.old.vminfo_offset;
+	      }
+
+	    if (vminfo_offset)
+	      if (!make_bfd_asection (abfd, ".vmdata",
+				      SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
+				      vminfo_size, vminfo_addr,
+				      vminfo_offset))
+		return NULL;
 	  }
       }
   }
@@ -391,23 +629,28 @@
      bfd *core_bfd;
      bfd *exec_bfd;
 {
-  struct CORE_DUMP coredata;
-  struct ld_info ldinfo;
+  CoreHdr core;
   bfd_size_type size;
   char *path, *s;
   size_t alloc;
   const char *str1, *str2;
   boolean ret;
+  file_ptr c_loader;
 
-  if (bfd_seek (core_bfd, 0, SEEK_SET) != 0
-      || bfd_read (&coredata, sizeof coredata, 1, core_bfd) != sizeof coredata)
+  if (!read_hdr (core_bfd, &core))
     return false;
 
-  if (bfd_seek (core_bfd, (long) coredata.LOADER_OFFSET_FIELD, SEEK_SET) != 0)
-    return false;
+  if (CORE_NEW (core))
+    c_loader = CNEW_LOADER (core.new);
+  else
+    c_loader = (file_ptr) COLD_LOADER (core.old);
 
-  size = (char *) &ldinfo.ldinfo_filename[0] - (char *) &ldinfo.ldinfo_next;
-  if (bfd_read (&ldinfo, size, 1, core_bfd) != size)
+  if (CORE_NEW (core) && CNEW_PROC64 (core.new))
+    size = (int)((LdInfo *)0)->l64.ldinfo_filename;
+  else
+    size = (int)((LdInfo *)0)->l32.ldinfo_filename;
+
+  if (bfd_seek (core_bfd, c_loader + size, SEEK_SET) != 0)
     return false;
 
   alloc = 100;
@@ -441,7 +684,7 @@
 	  path = n;
 	}
     }
-  
+
   str1 = strrchr (path, '/');
   str2 = strrchr (exec_bfd->filename, '/');
 
@@ -463,7 +706,10 @@
 rs6000coff_core_file_failing_command (abfd)
      bfd *abfd;
 {
-  char *com = core_hdr (abfd).CORE_COMM_FIELD;
+  CoreHdr *core = core_hdr (abfd);
+  char *com = CORE_NEW (*core) ?
+    CNEW_COMM (core->new) : COLD_COMM (core->old);
+
   if (*com)
     return com;
   else
@@ -474,65 +720,8 @@
 rs6000coff_core_file_failing_signal (abfd)
      bfd *abfd;
 {
-  return core_hdr (abfd).c_signo;
-}
-
-
-boolean
-rs6000coff_get_section_contents (abfd, section, location, offset, count)
-     bfd *abfd;
-     sec_ptr section;
-     PTR location;
-     file_ptr offset;
-     bfd_size_type count;
-{
-    if (count == 0)
-	return true;
-
-    /* Reading a core file's sections will be slightly different. For the
-       rest of them we can use bfd_generic_get_section_contents () I suppose. */
-    /* Make sure this routine works for any bfd and any section. FIXMEmgo. */
-
-    if (abfd->format == bfd_core && strcmp (section->name, ".reg") == 0) {
-
-      struct mstsave mstatus;
-      int    regoffset = (char*)&mstatus.gpr[0] - (char*)&mstatus;
-
-      /* Assert that the only way this code will be executed is reading the
-         whole section. */
-      if (offset || count != (sizeof(mstatus.gpr) + (4 * NUM_OF_SPEC_REGS)))
-        (*_bfd_error_handler)
-	  (_("ERROR! in rs6000coff_get_section_contents()\n"));
-
-      /* for `.reg' section, `filepos' is a pointer to the `mstsave' structure
-         in the core file. */
-
-      /* read GPR's into the location. */
-      if ( bfd_seek(abfd, section->filepos + regoffset, SEEK_SET) == -1
-	|| bfd_read(location, sizeof (mstatus.gpr), 1, abfd) != sizeof (mstatus.gpr))
-	return (false); /* on error */
-
-      /* increment location to the beginning of special registers in the section,
-         reset register offset value to the beginning of first special register
-	 in mstsave structure, and read special registers. */
-
-      location = (PTR) ((char*)location + sizeof (mstatus.gpr));
-      regoffset = (char*)&mstatus.iar - (char*)&mstatus;
-
-      if ( bfd_seek(abfd, section->filepos + regoffset, SEEK_SET) == -1
-	|| bfd_read(location, 4 * NUM_OF_SPEC_REGS, 1, abfd) != 
-							4 * NUM_OF_SPEC_REGS)
-	return (false); /* on error */
-      
-      /* increment location address, and read the special registers.. */
-      /* FIXMEmgo */
-      return (true);
-    }
-
-    /* else, use default bfd section content transfer. */
-    else
-      return _bfd_generic_get_section_contents 
-      			(abfd, section, location, offset, count);
+  CoreHdr *core = core_hdr (abfd);
+  return CORE_NEW (*core) ? core->new.c_signo : core->old.c_signo;
 }
 
 #endif /* AIX_CORE */
diff --git a/bfd/sco5-core.c b/bfd/sco5-core.c
index 46c97d2..5d5677e 100644
--- a/bfd/sco5-core.c
+++ b/bfd/sco5-core.c
@@ -84,7 +84,7 @@
     new->the_bfd = abfd;
   return new;
 }
- 
+
 static struct user *
 read_uarea(abfd, filepos)
      bfd *abfd;
@@ -109,7 +109,7 @@
     }
 
   /* Sanity check perhaps??? */
-  if (rawptr->u.u_dsize > 0x1000000)    /* Remember, it's in pages... */
+  if (rawptr->u.u_dsize > 0x1000000)    /* Remember, it's in pages...  */
     {
       bfd_set_error (bfd_error_wrong_format);
       return NULL;
@@ -154,7 +154,7 @@
       || (bfd_read ((void *)&coffset_siz, 1, sizeof coffset_siz, abfd)
 	  != sizeof coffset_siz) )
     {
-      bfd_set_error (bfd_error_wrong_format); 
+      bfd_set_error (bfd_error_wrong_format);
       return NULL;
     }
 
@@ -165,50 +165,49 @@
 	  != sizeof coffsets)
       || ((coffsets.u_info != 1) && (coffsets.u_info != C_VERSION)))
     {
-      bfd_set_error (bfd_error_wrong_format); 
+      bfd_set_error (bfd_error_wrong_format);
       return NULL;
     }
 
-
-  if (coffsets.u_info == 1) 
-    { 
+  if (coffsets.u_info == 1)
+    {
       /* Old version, no section heads, read info from user struct */
 
       u = read_uarea(abfd, coffsets.u_user);
       if (! u)
           return NULL;
 
-      if (!make_bfd_asection (abfd, ".reg", SEC_HAS_CONTENTS, 
+      if (!make_bfd_asection (abfd, ".reg", SEC_HAS_CONTENTS,
                               (bfd_size_type) coffsets.u_usize,
                               0 - (bfd_vma) u->u_ar0,
                               (file_ptr) coffsets.u_user))
         return NULL;
-    
-      if (!make_bfd_asection (abfd, ".data", 
+
+      if (!make_bfd_asection (abfd, ".data",
 			      SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
                               ((bfd_size_type) u->u_exdata.ux_dsize
 			       + u->u_exdata.ux_bsize),
                               (bfd_vma) u->u_exdata.ux_datorg,
                               (file_ptr) coffsets.u_data))
         return NULL;
-    
-      if (!make_bfd_asection (abfd, ".stack", 
-			      SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS, 
+
+      if (!make_bfd_asection (abfd, ".stack",
+			      SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
                               (bfd_size_type) u->u_ssize * NBPC,
                               (bfd_vma) u->u_sub,
                               (file_ptr) coffsets.u_stack))
         return NULL;
 
       return abfd->xvec;		/* Done for version 1 */
-    }      
+    }
 
   /* Immediately before coreoffsets region is a long with offset in core
      to first coresecthead (CORES_OFFSETS), the long before this is the
      number of section heads in the list. Read both longs and read the
      coresecthead and check its validity */
-    
-  if ((bfd_seek (abfd, 
-		 coresize - coffset_siz - 2 * sizeof coffset_siz, 
+
+  if ((bfd_seek (abfd,
+		 coresize - coffset_siz - 2 * sizeof coffset_siz,
 		 SEEK_SET) != 0)
       || (bfd_read ((void *)&nsecs, 1, sizeof nsecs, abfd) != sizeof nsecs)
       || (bfd_read ((void *)&cheadoffs, 1, sizeof cheadoffs, abfd)
@@ -226,16 +225,16 @@
 
   /* Now loop over all regions and map them */
   nsecs--;				/* We've seen CORES_OFFSETS already */
-  for (; nsecs; nsecs--) 
+  for (; nsecs; nsecs--)
     {
       if ((bfd_seek (abfd, chead.cs_hseek, SEEK_SET) != 0)
 	  || bfd_read ((void *)&chead, 1, sizeof chead, abfd) != sizeof chead)
         {
-          bfd_set_error (bfd_error_wrong_format); 
+          bfd_set_error (bfd_error_wrong_format);
           return NULL;
         }
 
-      switch (chead.cs_stype) 
+      switch (chead.cs_stype)
 	{
 	case CORES_MAGIC:			/* Core header, check magic */
 	  if (chead.cs_x.csx_magic != COREMAGIC_NUMBER)
@@ -259,7 +258,7 @@
 	     *u_ar0.  The other is that u_ar0 is sometimes an absolute
 	     address in kernel memory, and on other systems it is an
 	     offset from the beginning of the `struct user'.
-	
+
 	     As a practical matter, we don't know where the registers
 	     actually are, so we have to pass the whole area to GDB.
 	     We encode the value of u_ar0 by setting the .regs section
@@ -267,11 +266,10 @@
 	     pointed to by u_ar0 (by setting the vma of the start of
 	     the section to -u_ar0).  GDB uses this info to locate the
 	     regs, using minor trickery to get around the
-	     offset-or-absolute-addr problem. */
+	     offset-or-absolute-addr problem.  */
 
 	  chead.cs_vaddr = 0 - (bfd_vma) u->u_ar0;
 
-
           secname = ".reg";
           flags = SEC_HAS_CONTENTS;
 
@@ -345,8 +343,8 @@
 sco5_core_file_failing_signal (ignore_abfd)
      bfd *ignore_abfd;
 {
-  return ((ignore_abfd->tdata.sco5_core_data->u.u_sysabort != 0) 
-	  ? ignore_abfd->tdata.sco5_core_data->u.u_sysabort 
+  return ((ignore_abfd->tdata.sco5_core_data->u.u_sysabort != 0)
+	  ? ignore_abfd->tdata.sco5_core_data->u.u_sysabort
 	  : -1);
 }
 
@@ -371,9 +369,9 @@
 
 /* If somebody calls any byte-swapping routines, shoot them.  */
 static void
-swap_abort()
+swap_abort ()
 {
-  abort(); /* This way doesn't require any declaration for ANSI to fuck up */
+  abort (); /* This way doesn't require any declaration for ANSI to fuck up */
 }
 #define NO_GET  ((bfd_vma (*) PARAMS ((   const bfd_byte *))) swap_abort )
 #define NO_PUT  ((void    (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
@@ -426,6 +424,6 @@
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
     NULL,
-    
+
     (PTR) 0                     /* backend_data */
 };
diff --git a/bfd/section.c b/bfd/section.c
index ff977fd..13e10d3 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -1,5 +1,5 @@
 /* Object file "section" support for the BFD library.
-   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -111,7 +111,6 @@
 |     size            0x103   |
 |     output_section  --------|
 
-
 SUBSECTION
 	Link orders
 
@@ -133,7 +132,6 @@
 
 */
 
-
 #include "bfd.h"
 #include "sysdep.h"
 #include "libbfd.h"
@@ -150,10 +148,10 @@
 
 CODE_FRAGMENT
 .
-. {* This structure is used for a comdat section, as in PE.  A comdat
-.    section is associated with a particular symbol.  When the linker
-.    sees a comdat section, it keeps only one of the sections with a
-.    given name and associated with a given symbol. *}
+.{* This structure is used for a comdat section, as in PE.  A comdat
+.   section is associated with a particular symbol.  When the linker
+.   sees a comdat section, it keeps only one of the sections with a
+.   given name and associated with a given symbol.  *}
 .
 .struct bfd_comdat_info
 .{
@@ -165,350 +163,362 @@
 .     specific code; it is not an index into the list returned by
 .     bfd_canonicalize_symtab.  *}
 .  long symbol;
-.
-.  {* If this section is being discarded, the linker uses this field
-.     to point to the input section which is being kept.  *}
-.  struct sec *sec;
 .};
 .
 .typedef struct sec
 .{
-.        {* The name of the section; the name isn't a copy, the pointer is
-.        the same as that passed to bfd_make_section. *}
+.  {* The name of the section; the name isn't a copy, the pointer is
+.     the same as that passed to bfd_make_section.  *}
 .
-.    CONST char *name;
+.  const char *name;
 .
-.        {* Which section is it; 0..nth.      *}
+.  {* A unique sequence number.  *}
 .
-.   int index;
+.  int id;
 .
-.        {* The next section in the list belonging to the BFD, or NULL. *}
+.  {* Which section is it; 0..nth.  *}
 .
-.    struct sec *next;
+.  int index;
 .
-.        {* The field flags contains attributes of the section. Some
-.           flags are read in from the object file, and some are
-.           synthesized from other information.  *}
+.  {* The next section in the list belonging to the BFD, or NULL.  *}
 .
-.    flagword flags;
+.  struct sec *next;
+.
+.  {* The field flags contains attributes of the section. Some
+.     flags are read in from the object file, and some are
+.     synthesized from other information.  *}
+.
+.  flagword flags;
 .
 .#define SEC_NO_FLAGS   0x000
 .
-.        {* Tells the OS to allocate space for this section when loading.
-.           This is clear for a section containing debug information
-.           only. *}
+.  {* Tells the OS to allocate space for this section when loading.
+.     This is clear for a section containing debug information only.  *}
 .#define SEC_ALLOC      0x001
 .
-.        {* Tells the OS to load the section from the file when loading.
-.           This is clear for a .bss section. *}
+.  {* Tells the OS to load the section from the file when loading.
+.     This is clear for a .bss section.  *}
 .#define SEC_LOAD       0x002
 .
-.        {* The section contains data still to be relocated, so there is
-.           some relocation information too. *}
+.  {* The section contains data still to be relocated, so there is
+.     some relocation information too.  *}
 .#define SEC_RELOC      0x004
 .
 .#if 0   {* Obsolete ? *}
 .#define SEC_BALIGN     0x008
 .#endif
 .
-.        {* A signal to the OS that the section contains read only
-.          data. *}
+.  {* A signal to the OS that the section contains read only data.  *}
 .#define SEC_READONLY   0x010
 .
-.        {* The section contains code only. *}
+.  {* The section contains code only.  *}
 .#define SEC_CODE       0x020
 .
-.        {* The section contains data only. *}
+.  {* The section contains data only.  *}
 .#define SEC_DATA       0x040
 .
-.        {* The section will reside in ROM. *}
+.  {* The section will reside in ROM.  *}
 .#define SEC_ROM        0x080
 .
-.        {* The section contains constructor information. This section
-.           type is used by the linker to create lists of constructors and
-.           destructors used by <<g++>>. When a back end sees a symbol
-.           which should be used in a constructor list, it creates a new
-.           section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
-.           the symbol to it, and builds a relocation. To build the lists
-.           of constructors, all the linker has to do is catenate all the
-.           sections called <<__CTOR_LIST__>> and relocate the data
-.           contained within - exactly the operations it would peform on
-.           standard data. *}
+.  {* The section contains constructor information. This section
+.     type is used by the linker to create lists of constructors and
+.     destructors used by <<g++>>. When a back end sees a symbol
+.     which should be used in a constructor list, it creates a new
+.     section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
+.     the symbol to it, and builds a relocation. To build the lists
+.     of constructors, all the linker has to do is catenate all the
+.     sections called <<__CTOR_LIST__>> and relocate the data
+.     contained within - exactly the operations it would peform on
+.     standard data.  *}
 .#define SEC_CONSTRUCTOR 0x100
 .
-.        {* The section is a constructor, and should be placed at the
-.          end of the text, data, or bss section(?). *}
+.  {* The section is a constructor, and should be placed at the
+.     end of the text, data, or bss section(?).  *}
 .#define SEC_CONSTRUCTOR_TEXT 0x1100
 .#define SEC_CONSTRUCTOR_DATA 0x2100
 .#define SEC_CONSTRUCTOR_BSS  0x3100
 .
-.        {* The section has contents - a data section could be
-.           <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
-.           <<SEC_HAS_CONTENTS>> *}
+.  {* The section has contents - a data section could be
+.     <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
+.     <<SEC_HAS_CONTENTS>>  *}
 .#define SEC_HAS_CONTENTS 0x200
 .
-.        {* An instruction to the linker to not output the section
-.           even if it has information which would normally be written. *}
+.  {* An instruction to the linker to not output the section
+.     even if it has information which would normally be written.  *}
 .#define SEC_NEVER_LOAD 0x400
 .
-.        {* The section is a COFF shared library section.  This flag is
-.           only for the linker.  If this type of section appears in
-.           the input file, the linker must copy it to the output file
-.           without changing the vma or size.  FIXME: Although this
-.           was originally intended to be general, it really is COFF
-.           specific (and the flag was renamed to indicate this).  It
-.           might be cleaner to have some more general mechanism to
-.           allow the back end to control what the linker does with
-.           sections. *}
+.  {* The section is a COFF shared library section.  This flag is
+.     only for the linker.  If this type of section appears in
+.     the input file, the linker must copy it to the output file
+.     without changing the vma or size.  FIXME: Although this
+.     was originally intended to be general, it really is COFF
+.     specific (and the flag was renamed to indicate this).  It
+.     might be cleaner to have some more general mechanism to
+.     allow the back end to control what the linker does with
+.     sections.  *}
 .#define SEC_COFF_SHARED_LIBRARY 0x800
 .
-.        {* The section contains common symbols (symbols may be defined
-.           multiple times, the value of a symbol is the amount of
-.           space it requires, and the largest symbol value is the one
-.           used).  Most targets have exactly one of these (which we
-.	    translate to bfd_com_section_ptr), but ECOFF has two. *}
+.  {* The section has GOT references.  This flag is only for the
+.     linker, and is currently only used by the elf32-hppa back end.
+.     It will be set if global offset table references were detected
+.     in this section, which indicate to the linker that the section
+.     contains PIC code, and must be handled specially when doing a
+.     static link.  *}
+.#define SEC_HAS_GOT_REF 0x4000
+.
+.  {* The section contains common symbols (symbols may be defined
+.     multiple times, the value of a symbol is the amount of
+.     space it requires, and the largest symbol value is the one
+.     used).  Most targets have exactly one of these (which we
+.     translate to bfd_com_section_ptr), but ECOFF has two.  *}
 .#define SEC_IS_COMMON 0x8000
 .
-.        {* The section contains only debugging information.  For
-.           example, this is set for ELF .debug and .stab sections.
-.           strip tests this flag to see if a section can be
-.           discarded. *}
+.  {* The section contains only debugging information.  For
+.     example, this is set for ELF .debug and .stab sections.
+.     strip tests this flag to see if a section can be
+.     discarded.  *}
 .#define SEC_DEBUGGING 0x10000
 .
-.        {* The contents of this section are held in memory pointed to
-.           by the contents field.  This is checked by
-.           bfd_get_section_contents, and the data is retrieved from
-.           memory if appropriate.  *}
+.  {* The contents of this section are held in memory pointed to
+.     by the contents field.  This is checked by bfd_get_section_contents,
+.     and the data is retrieved from memory if appropriate.  *}
 .#define SEC_IN_MEMORY 0x20000
 .
-.        {* The contents of this section are to be excluded by the
-.	    linker for executable and shared objects unless those
-.	    objects are to be further relocated.  *}
+.  {* The contents of this section are to be excluded by the
+.     linker for executable and shared objects unless those
+.     objects are to be further relocated.  *}
 .#define SEC_EXCLUDE 0x40000
 .
-.	{* The contents of this section are to be sorted by the
-.	   based on the address specified in the associated symbol
-.	   table.  *}
+.  {* The contents of this section are to be sorted by the
+.     based on the address specified in the associated symbol
+.     table.  *}
 .#define SEC_SORT_ENTRIES 0x80000
 .
-.	{* When linking, duplicate sections of the same name should be
-.	   discarded, rather than being combined into a single section as
-.	   is usually done.  This is similar to how common symbols are
-.	   handled.  See SEC_LINK_DUPLICATES below.  *}
+.  {* When linking, duplicate sections of the same name should be
+.     discarded, rather than being combined into a single section as
+.     is usually done.  This is similar to how common symbols are
+.     handled.  See SEC_LINK_DUPLICATES below.  *}
 .#define SEC_LINK_ONCE 0x100000
 .
-.	{* If SEC_LINK_ONCE is set, this bitfield describes how the linker
-.	   should handle duplicate sections.  *}
+.  {* If SEC_LINK_ONCE is set, this bitfield describes how the linker
+.     should handle duplicate sections.  *}
 .#define SEC_LINK_DUPLICATES 0x600000
 .
-.	{* This value for SEC_LINK_DUPLICATES means that duplicate
-.	   sections with the same name should simply be discarded. *}
+.  {* This value for SEC_LINK_DUPLICATES means that duplicate
+.     sections with the same name should simply be discarded.  *}
 .#define SEC_LINK_DUPLICATES_DISCARD 0x0
 .
-.	{* This value for SEC_LINK_DUPLICATES means that the linker
-.	   should warn if there are any duplicate sections, although
-.	   it should still only link one copy.  *}
+.  {* This value for SEC_LINK_DUPLICATES means that the linker
+.     should warn if there are any duplicate sections, although
+.     it should still only link one copy.  *}
 .#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
 .
-.	{* This value for SEC_LINK_DUPLICATES means that the linker
-.	   should warn if any duplicate sections are a different size.  *}
+.  {* This value for SEC_LINK_DUPLICATES means that the linker
+.     should warn if any duplicate sections are a different size.  *}
 .#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
 .
-.	{* This value for SEC_LINK_DUPLICATES means that the linker
-.	   should warn if any duplicate sections contain different
-.	   contents.  *}
+.  {* This value for SEC_LINK_DUPLICATES means that the linker
+.     should warn if any duplicate sections contain different
+.     contents.  *}
 .#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
 .
-.	{* This section was created by the linker as part of dynamic
-.	   relocation or other arcane processing.  It is skipped when
-.	   going through the first-pass output, trusting that someone
-.	   else up the line will take care of it later.  *}
+.  {* This section was created by the linker as part of dynamic
+.     relocation or other arcane processing.  It is skipped when
+.     going through the first-pass output, trusting that someone
+.     else up the line will take care of it later.  *}
 .#define SEC_LINKER_CREATED 0x800000
 .
-.	{* This section should not be subject to garbage collection.  *}
+.  {* This section should not be subject to garbage collection.  *}
 .#define SEC_KEEP 0x1000000
 .
-.	{* This section contains "short" data, and should be placed
-.	   "near" the GP.  *}
+.  {* This section contains "short" data, and should be placed
+.     "near" the GP.  *}
 .#define SEC_SMALL_DATA 0x2000000
 .
-. 	{* This section contains data which may be shared with other
-.	   executables or shared objects.  *}
+.  {* This section contains data which may be shared with other
+.     executables or shared objects.  *}
 .#define SEC_SHARED 0x4000000
 .
-.	{* When a section with this flag is being linked, then if the size of
-.          the input section is less than a page, it should not cross a page
-.          boundary.  If the size of the input section is one page or more, it
-.          should be aligned on a page boundary.  *}
+.  {* When a section with this flag is being linked, then if the size of
+.     the input section is less than a page, it should not cross a page
+.     boundary.  If the size of the input section is one page or more, it
+.     should be aligned on a page boundary.  *}
 .#define SEC_BLOCK 0x8000000
 .
-.	{* Conditionally link this section; do not link if there are no
-.          references found to any symbol in the section.  *}
+.  {* Conditionally link this section; do not link if there are no
+.     references found to any symbol in the section.  *}
 .#define SEC_CLINK 0x10000000
 .
-.	{*  End of section flags.  *}
+.  {*  End of section flags.  *}
 .
-.	{* Some internal packed boolean fields.  *}
+.  {* Some internal packed boolean fields.  *}
 .
-.	{* See the vma field.  *}
-.	unsigned int user_set_vma : 1;
+.  {* See the vma field.  *}
+.  unsigned int user_set_vma : 1;
 .
-.	{* Whether relocations have been processed.  *}
-.	unsigned int reloc_done : 1;
+.  {* Whether relocations have been processed.  *}
+.  unsigned int reloc_done : 1;
 .
-.	{* A mark flag used by some of the linker backends.  *}
-.	unsigned int linker_mark : 1;
+.  {* A mark flag used by some of the linker backends.  *}
+.  unsigned int linker_mark : 1;
 .
-.	{* A mark flag used by some linker backends for garbage collection.  *}
-.	unsigned int gc_mark : 1;
+.  {* A mark flag used by some linker backends for garbage collection.  *}
+.  unsigned int gc_mark : 1;
 .
-.	{* End of internal packed boolean fields.  *}
+.  {* Used by the ELF code to mark sections which have been allocated to segments.  *}
+.  unsigned int segment_mark : 1;
 .
-.       {*  The virtual memory address of the section - where it will be
-.           at run time.  The symbols are relocated against this.  The
-.	    user_set_vma flag is maintained by bfd; if it's not set, the
-.	    backend can assign addresses (for example, in <<a.out>>, where
-.	    the default address for <<.data>> is dependent on the specific
-.	    target and various flags).  *}
+.  {* End of internal packed boolean fields.  *}
 .
-.   bfd_vma vma;
+.  {*  The virtual memory address of the section - where it will be
+.      at run time.  The symbols are relocated against this.  The
+.      user_set_vma flag is maintained by bfd; if it's not set, the
+.      backend can assign addresses (for example, in <<a.out>>, where
+.      the default address for <<.data>> is dependent on the specific
+.      target and various flags).  *}
 .
-.       {*  The load address of the section - where it would be in a
-.           rom image; really only used for writing section header
-.	    information. *}
+.  bfd_vma vma;
 .
-.   bfd_vma lma;
+.  {*  The load address of the section - where it would be in a
+.      rom image; really only used for writing section header
+.      information. *}
 .
-.        {* The size of the section in octets, as it will be output.
-.           Contains a value even if the section has no contents (e.g., the
-.           size of <<.bss>>).  This will be filled in after relocation.  *}
+.  bfd_vma lma;
 .
-.   bfd_size_type _cooked_size;
+.  {* The size of the section in octets, as it will be output.
+.     Contains a value even if the section has no contents (e.g., the
+.     size of <<.bss>>).  This will be filled in after relocation.  *}
 .
-.        {* The original size on disk of the section, in octets.  Normally this
-.	    value is the same as the size, but if some relaxing has
-.	    been done, then this value will be bigger.  *}
+.  bfd_size_type _cooked_size;
 .
-.   bfd_size_type _raw_size;
+.  {* The original size on disk of the section, in octets.  Normally this
+.     value is the same as the size, but if some relaxing has
+.     been done, then this value will be bigger.  *}
 .
-.        {* If this section is going to be output, then this value is the
-.           offset in *bytes* into the output section of the first byte in the
-.           input section (byte ==> smallest addressable unit on the
-.           target).  In most cases, if this was going to start at the
-.           100th octet (8-bit quantity) in the output section, this value
-.           would be 100.  However, if the target byte size is 16 bits
-.           (bfd_octets_per_byte is "2"), this value would be 50. *}
+.  bfd_size_type _raw_size;
 .
-.   bfd_vma output_offset;
+.  {* If this section is going to be output, then this value is the
+.     offset in *bytes* into the output section of the first byte in the
+.     input section (byte ==> smallest addressable unit on the
+.     target).  In most cases, if this was going to start at the
+.     100th octet (8-bit quantity) in the output section, this value
+.     would be 100.  However, if the target byte size is 16 bits
+.     (bfd_octets_per_byte is "2"), this value would be 50.  *}
 .
-.        {* The output section through which to map on output. *}
+.  bfd_vma output_offset;
 .
-.   struct sec *output_section;
+.  {* The output section through which to map on output.  *}
 .
-.        {* The alignment requirement of the section, as an exponent of 2 -
-.           e.g., 3 aligns to 2^3 (or 8). *}
+.  struct sec *output_section;
 .
-.   unsigned int alignment_power;
+.  {* The alignment requirement of the section, as an exponent of 2 -
+.     e.g., 3 aligns to 2^3 (or 8).  *}
 .
-.        {* If an input section, a pointer to a vector of relocation
-.           records for the data in this section. *}
+.  unsigned int alignment_power;
 .
-.   struct reloc_cache_entry *relocation;
+.  {* If an input section, a pointer to a vector of relocation
+.     records for the data in this section.  *}
 .
-.        {* If an output section, a pointer to a vector of pointers to
-.           relocation records for the data in this section. *}
+.  struct reloc_cache_entry *relocation;
 .
-.   struct reloc_cache_entry **orelocation;
+.  {* If an output section, a pointer to a vector of pointers to
+.     relocation records for the data in this section.  *}
 .
-.        {* The number of relocation records in one of the above  *}
+.  struct reloc_cache_entry **orelocation;
 .
-.   unsigned reloc_count;
+.  {* The number of relocation records in one of the above  *}
 .
-.        {* Information below is back end specific - and not always used
-.           or updated.  *}
+.  unsigned reloc_count;
 .
-.        {* File position of section data    *}
+.  {* Information below is back end specific - and not always used
+.     or updated.  *}
 .
-.   file_ptr filepos;
+.  {* File position of section data.  *}
 .
-.        {* File position of relocation info *}
+.  file_ptr filepos;
 .
-.   file_ptr rel_filepos;
+.  {* File position of relocation info.  *}
 .
-.        {* File position of line data       *}
+.  file_ptr rel_filepos;
 .
-.   file_ptr line_filepos;
+.  {* File position of line data.  *}
 .
-.        {* Pointer to data for applications *}
+.  file_ptr line_filepos;
 .
-.   PTR userdata;
+.  {* Pointer to data for applications.  *}
 .
-.        {* If the SEC_IN_MEMORY flag is set, this points to the actual
-.           contents.  *}
-.   unsigned char *contents;
+.  PTR userdata;
 .
-.        {* Attached line number information *}
+.  {* If the SEC_IN_MEMORY flag is set, this points to the actual
+.     contents.  *}
+.  unsigned char *contents;
 .
-.   alent *lineno;
+.  {* Attached line number information.  *}
 .
-.        {* Number of line number records   *}
+.  alent *lineno;
 .
-.   unsigned int lineno_count;
+.  {* Number of line number records.  *}
 .
-.	 {* Optional information about a COMDAT entry; NULL if not COMDAT *}
+.  unsigned int lineno_count;
 .
-.   struct bfd_comdat_info *comdat;
+.  {* Optional information about a COMDAT entry; NULL if not COMDAT.  *}
 .
-.        {* When a section is being output, this value changes as more
-.           linenumbers are written out *}
+.  struct bfd_comdat_info *comdat;
 .
-.   file_ptr moving_line_filepos;
+.  {* Points to the kept section if this section is a link-once section,
+.     and is discarded.  *}
+.  struct sec *kept_section;
 .
-.        {* What the section number is in the target world  *}
+.  {* When a section is being output, this value changes as more
+.     linenumbers are written out.  *}
 .
-.   int target_index;
+.  file_ptr moving_line_filepos;
 .
-.   PTR used_by_bfd;
+.  {* What the section number is in the target world.  *}
 .
-.        {* If this is a constructor section then here is a list of the
-.           relocations created to relocate items within it. *}
+.  int target_index;
 .
-.   struct relent_chain *constructor_chain;
+.  PTR used_by_bfd;
 .
-.        {* The BFD which owns the section. *}
+.  {* If this is a constructor section then here is a list of the
+.     relocations created to relocate items within it.  *}
 .
-.   bfd *owner;
+.  struct relent_chain *constructor_chain;
 .
-.	 {* A symbol which points at this section only *}
-.   struct symbol_cache_entry *symbol;
-.   struct symbol_cache_entry **symbol_ptr_ptr;
+.  {* The BFD which owns the section.  *}
 .
-.   struct bfd_link_order *link_order_head;
-.   struct bfd_link_order *link_order_tail;
+.  bfd *owner;
+.
+.  {* A symbol which points at this section only *}
+.  struct symbol_cache_entry *symbol;
+.  struct symbol_cache_entry **symbol_ptr_ptr;
+.
+.  struct bfd_link_order *link_order_head;
+.  struct bfd_link_order *link_order_tail;
 .} asection ;
 .
-.    {* These sections are global, and are managed by BFD.  The application
-.       and target back end are not permitted to change the values in
-.	these sections.  New code should use the section_ptr macros rather
-.       than referring directly to the const sections.  The const sections
-.       may eventually vanish.  *}
+.{* These sections are global, and are managed by BFD.  The application
+.   and target back end are not permitted to change the values in
+.   these sections.  New code should use the section_ptr macros rather
+.   than referring directly to the const sections.  The const sections
+.   may eventually vanish.  *}
 .#define BFD_ABS_SECTION_NAME "*ABS*"
 .#define BFD_UND_SECTION_NAME "*UND*"
 .#define BFD_COM_SECTION_NAME "*COM*"
 .#define BFD_IND_SECTION_NAME "*IND*"
 .
-.    {* the absolute section *}
+.{* the absolute section *}
 .extern const asection bfd_abs_section;
 .#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
 .#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
-.    {* Pointer to the undefined section *}
+.{* Pointer to the undefined section *}
 .extern const asection bfd_und_section;
 .#define bfd_und_section_ptr ((asection *) &bfd_und_section)
 .#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
-.    {* Pointer to the common section *}
+.{* Pointer to the common section *}
 .extern const asection bfd_com_section;
 .#define bfd_com_section_ptr ((asection *) &bfd_com_section)
-.    {* Pointer to the indirect section *}
+.{* Pointer to the indirect section *}
 .extern const asection bfd_ind_section;
 .#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
 .#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
@@ -548,29 +558,38 @@
   GLOBAL_SYM_INIT (BFD_IND_SECTION_NAME, &bfd_ind_section)
 };
 
-#define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX)	\
-  const asymbol * const SYM = (asymbol *) &global_syms[IDX]; \
-  const asection SEC = \
-    /* name, index, next, flags, set_vma, reloc_done, linker_mark, gc_mark */ \
-    { NAME,  0,     0,    FLAGS, 0,       0,          0,           0,	      \
-									      \
-    /* vma, lma, _cooked_size, _raw_size, output_offset, output_section, */   \
-       0,   0,   0,            0,         0,             (struct sec *) &SEC, \
-									      \
-    /* alig..., reloc..., orel..., reloc_count, filepos, rel_..., line_... */ \
-       0,       0,        0,       0,           0,       0, 	   0,	      \
-									      \
-    /* userdata, contents, lineno, lineno_count */ 			      \
-       0,        0,        0,      0,                      		      \
-									      \
-    /* comdat_info, moving_line_filepos, target_index, used_by_bfd,  */       \
-       NULL,        0,                   0,            0, 		      \
-									      \
-    /* cons..., owner, symbol */ 					      \
-       0,       0,     (struct symbol_cache_entry *) &global_syms[IDX],       \
-									      \
-    /* symbol_ptr_ptr,                      link_order_head, ..._tail */      \
-       (struct symbol_cache_entry **) &SYM, 0,               0                \
+#define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX)				\
+  const asymbol * const SYM = (asymbol *) &global_syms[IDX]; 		\
+  const asection SEC = 							\
+    /* name, id,  index, next, flags, user_set_vma, reloc_done,      */	\
+    { NAME,  IDX, 0,     NULL, FLAGS, 0,            0,			\
+									\
+    /* linker_mark, gc_mark, segment_mark, vma, lma, _cooked_size,   */	\
+       0,           1,       0,            0,   0,   0,            	\
+									\
+    /* _raw_size, output_offset, output_section,    alignment_power, */ \
+       0,         0,           (struct sec *) &SEC, 0,			\
+									\
+    /* relocation, orelocation, reloc_count, filepos, rel_filepos,   */	\
+       NULL,       NULL,        0,           0,       0,		\
+									\
+    /* line_filepos, userdata, contents, lineno, lineno_count,       */	\
+       0,            NULL,     NULL,     NULL,   0,			\
+									\
+    /* comdat, kept_section, moving_line_filepos, target_index,      */	\
+       NULL,   NULL,         0,                   0,			\
+									\
+    /* used_by_bfd, constructor_chain, owner,                        */	\
+       NULL,        NULL,              NULL,				\
+									\
+    /* symbol,                                                       */	\
+       (struct symbol_cache_entry *) &global_syms[IDX],			\
+									\
+    /* symbol_ptr_ptr,                                               */	\
+       (struct symbol_cache_entry **) &SYM,				\
+									\
+    /* link_order_head, link_order_tail                              */	\
+       NULL,            NULL						\
     }
 
 STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol,
@@ -595,7 +614,7 @@
 	bfd_get_section_by_name
 
 SYNOPSIS
-	asection *bfd_get_section_by_name(bfd *abfd, CONST char *name);
+	asection *bfd_get_section_by_name(bfd *abfd, const char *name);
 
 DESCRIPTION
 	Run through @var{abfd} and return the one of the
@@ -611,7 +630,7 @@
 asection *
 bfd_get_section_by_name (abfd, name)
      bfd *abfd;
-     CONST char *name;
+     const char *name;
 {
   asection *sect;
 
@@ -621,13 +640,62 @@
   return NULL;
 }
 
+/*
+FUNCTION
+	bfd_get_unique_section_name
+
+SYNOPSIS
+	char *bfd_get_unique_section_name(bfd *abfd,
+					  const char *templat,
+					  int *count);
+
+DESCRIPTION
+	Invent a section name that is unique in @var{abfd} by tacking
+	a dot and a digit suffix onto the original @var{templat}.  If
+	@var{count} is non-NULL, then it specifies the first number
+	tried as a suffix to generate a unique name.  The value
+	pointed to by @var{count} will be incremented in this case.
+*/
+
+char *
+bfd_get_unique_section_name (abfd, templat, count)
+     bfd *abfd;
+     const char *templat;
+     int *count;
+{
+  int num;
+  unsigned int len;
+  char *sname;
+
+  len = strlen (templat);
+  sname = bfd_malloc (len + 8);
+  if (sname == NULL)
+    return NULL;
+  strcpy (sname, templat);
+  num = 1;
+  if (count != NULL)
+    num = *count;
+
+  do
+    {
+      /* If we have a million sections, something is badly wrong.  */
+      if (num > 999999)
+	abort ();
+      sprintf (sname + len, ".%d", num++);
+    }
+  while (bfd_get_section_by_name (abfd, sname) != NULL);
+
+  if (count != NULL)
+    *count = num;
+  return sname;
+}
 
 /*
 FUNCTION
 	bfd_make_section_old_way
 
 SYNOPSIS
-	asection *bfd_make_section_old_way(bfd *abfd, CONST char *name);
+	asection *bfd_make_section_old_way(bfd *abfd, const char *name);
 
 DESCRIPTION
 	Create a new empty section called @var{name}
@@ -647,11 +715,10 @@
 
 */
 
-
 asection *
 bfd_make_section_old_way (abfd, name)
      bfd *abfd;
-     CONST char *name;
+     const char *name;
 {
   asection *sec = bfd_get_section_by_name (abfd, name);
   if (sec == (asection *) NULL)
@@ -666,7 +733,7 @@
 	bfd_make_section_anyway
 
 SYNOPSIS
-	asection *bfd_make_section_anyway(bfd *abfd, CONST char *name);
+	asection *bfd_make_section_anyway(bfd *abfd, const char *name);
 
 DESCRIPTION
    Create a new empty section called @var{name} and attach it to the end of
@@ -681,8 +748,9 @@
 sec_ptr
 bfd_make_section_anyway (abfd, name)
      bfd *abfd;
-     CONST char *name;
+     const char *name;
 {
+  static int section_id = 0x10;  /* id 0 to 3 used by STD_SECTION.  */
   asection *newsect;
   asection **prev = &abfd->sections;
   asection *sect = abfd->sections;
@@ -704,6 +772,7 @@
     return NULL;
 
   newsect->name = name;
+  newsect->id = section_id++;
   newsect->index = abfd->section_count++;
   newsect->flags = SEC_NO_FLAGS;
 
@@ -715,13 +784,17 @@
   newsect->line_filepos = 0;
   newsect->owner = abfd;
   newsect->comdat = NULL;
+  newsect->kept_section = NULL;
 
   /* Create a symbol whos only job is to point to this section. This is
      useful for things like relocs which are relative to the base of a
      section.  */
   newsect->symbol = bfd_make_empty_symbol (abfd);
   if (newsect->symbol == NULL)
-    return NULL;
+    {
+      bfd_release (abfd, newsect);
+      return NULL;
+    }
   newsect->symbol->name = name;
   newsect->symbol->value = 0;
   newsect->symbol->section = newsect;
@@ -731,7 +804,7 @@
 
   if (BFD_SEND (abfd, _new_section_hook, (abfd, newsect)) != true)
     {
-      free (newsect);
+      bfd_release (abfd, newsect);
       return NULL;
     }
 
@@ -744,7 +817,7 @@
 	bfd_make_section
 
 SYNOPSIS
-	asection *bfd_make_section(bfd *, CONST char *name);
+	asection *bfd_make_section(bfd *, const char *name);
 
 DESCRIPTION
    Like <<bfd_make_section_anyway>>, but return <<NULL>> (without calling
@@ -756,7 +829,7 @@
 asection *
 bfd_make_section (abfd, name)
      bfd *abfd;
-     CONST char *name;
+     const char *name;
 {
   asection *sect = abfd->sections;
 
@@ -789,7 +862,6 @@
   return bfd_make_section_anyway (abfd, name);
 }
 
-
 /*
 FUNCTION
 	bfd_set_section_flags
@@ -833,14 +905,13 @@
   return true;
 }
 
-
 /*
 FUNCTION
 	bfd_map_over_sections
 
 SYNOPSIS
 	void bfd_map_over_sections(bfd *abfd,
-				   void (*func)(bfd *abfd,
+				   void (*func) (bfd *abfd,
 						asection *sect,
 						PTR obj),
 				   PTR obj);
@@ -859,7 +930,6 @@
 |	   for (p = abfd->sections; p != NULL; p = p->next)
 |	      func(abfd, p, ...)
 
-
 */
 
 /*VARARGS2*/
@@ -879,7 +949,6 @@
     abort ();
 }
 
-
 /*
 FUNCTION
 	bfd_set_section_size
@@ -904,7 +973,7 @@
      bfd_size_type val;
 {
   /* Once you've started writing to any section you cannot create or change
-     the size of any others. */
+     the size of any others.  */
 
   if (abfd->output_has_begun)
     {
@@ -930,15 +999,12 @@
          file_ptr offset,
          bfd_size_type count);
 
-
 DESCRIPTION
 	Sets the contents of the section @var{section} in BFD
 	@var{abfd} to the data starting in memory at @var{data}. The
 	data is written to the output section starting at offset
 	@var{offset} for @var{count} octets.
 
-
-
 	Normally <<true>> is returned, else <<false>>. Possible error
 	returns are:
 	o <<bfd_error_no_contents>> -
@@ -949,7 +1015,6 @@
 	This routine is front end to the back end function
 	<<_bfd_set_section_contents>>.
 
-
 */
 
 #define bfd_get_section_size_now(abfd,sec) \
@@ -1003,6 +1068,11 @@
       break;
     }
 
+  /* Record a copy of the data in memory if desired.  */
+  if (section->contents
+      && location != section->contents + offset)
+    memcpy (section->contents + offset, location, count);
+
   if (BFD_SEND (abfd, _bfd_set_section_contents,
 		(abfd, section, location, offset, count)))
     {
@@ -1034,8 +1104,6 @@
 	with zeroes. If no errors occur, <<true>> is returned, else
 	<<false>>.
 
-
-
 */
 boolean
 bfd_get_section_contents (abfd, section, location, offset, count)
@@ -1169,7 +1237,7 @@
     }
 
   /* If the output section is empty, remove it too.  Careful about sections
-     that have been discarded in the link script -- they are mapped to 
+     that have been discarded in the link script -- they are mapped to
      bfd_abs_section, which has no owner.  */
   if (!keep_os && os->owner != NULL)
     {
diff --git a/bfd/som.c b/bfd/som.c
index 542b69f..93344e8 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -1,9 +1,9 @@
 /* bfd back-end for HP PA-RISC SOM objects.
-   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998, 2000
    Free Software Foundation, Inc.
 
    Contributed by the Center for Software Science at the
-   University of Utah (pa-gdb-bugs@cs.utah.edu).
+   University of Utah.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -22,6 +22,7 @@
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    02111-1307, USA.  */
 
+#include "alloca-conf.h"
 #include "bfd.h"
 #include "sysdep.h"
 
@@ -72,7 +73,6 @@
      ((__m_num) >= _PA_RISC1_1_ID && (__m_num) <= _PA_RISC_MAXID))
 #endif /* _PA_RISC_ID */
 
-
 /* HIUX in it's infinite stupidity changed the names for several "well
    known" constants.  Work around such braindamage.  Try the HPUX version
    first, then the HIUX version, and finally provide a default.  */
@@ -90,7 +90,7 @@
 
 /* Size (in chars) of the temporary buffers used during fixup and string
    table writes.   */
-   
+
 #define SOM_TMP_BUFSIZE 8192
 
 /* Size of the hash table in archives.  */
@@ -106,7 +106,7 @@
 /* SOM allows any one of the four previous relocations to be reused
    with a "R_PREV_FIXUP" relocation entry.  Since R_PREV_FIXUP
    relocations are always a single byte, using a R_PREV_FIXUP instead
-   of some multi-byte relocation makes object files smaller. 
+   of some multi-byte relocation makes object files smaller.
 
    Note one side effect of using a R_PREV_FIXUP is the relocation that
    is being repeated moves to the front of the queue.  */
@@ -197,7 +197,7 @@
 					      CONST char **,
 					      unsigned int *));
 static void som_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
-static asection * bfd_section_from_som_symbol PARAMS ((bfd *, 
+static asection * bfd_section_from_som_symbol PARAMS ((bfd *,
 					struct symbol_dictionary_record *));
 static int log2 PARAMS ((unsigned int));
 static bfd_reloc_status_type hppa_som_reloc PARAMS ((bfd *, arelent *,
@@ -268,11 +268,11 @@
 static boolean som_is_container PARAMS ((asection *, asection *));
 static boolean som_bfd_free_cached_info PARAMS ((bfd *));
 static boolean som_bfd_link_split_section PARAMS ((bfd *, asection *));
-	
+
 /* Map SOM section names to POSIX/BSD single-character symbol types.
 
-   This table includes all the standard subspaces as defined in the 
-   current "PRO ABI for PA-RISC Systems", $UNWIND$ which for 
+   This table includes all the standard subspaces as defined in the
+   current "PRO ABI for PA-RISC Systems", $UNWIND$ which for
    some reason was left out, and sections specific to embedded stabs.  */
 
 static const struct section_to_type stt[] = {
@@ -306,7 +306,7 @@
 
    Right now this table is only used to count and perform minimal
    processing on relocation streams so that they can be internalized
-   into BFD and symbolically printed by utilities.  To make actual use 
+   into BFD and symbolically printed by utilities.  To make actual use
    of them would be much more difficult, BFD's concept of relocations
    is far too simple to handle SOM relocations.  The basic assumption
    that a relocation can be completely processed independent of other
@@ -314,7 +314,7 @@
 
    The SOM relocations are meant to be processed as a stream, they
    specify copying of data from the input section to the output section
-   while possibly modifying the data in some manner.  They also can 
+   while possibly modifying the data in some manner.  They also can
    specify that a variable number of zeros or uninitialized data be
    inserted on in the output segment at the current offset.  Some
    relocations specify that some previous relocation be re-applied at
@@ -324,7 +324,7 @@
    in the BFD relocation data structure to store enough information to
    perform all the relocations.
 
-   Each entry in the table has three fields. 
+   Each entry in the table has three fields.
 
    The first entry is an index into this "class" of relocations.  This
    index can then be used as a variable within the relocation itself.
@@ -332,14 +332,14 @@
    The second field is a format string which actually controls processing
    of the relocation.  It uses a simple postfix machine to do calculations
    based on variables/constants found in the string and the relocation
-   stream.  
+   stream.
 
-   The third field specifys whether or not this relocation may use 
+   The third field specifys whether or not this relocation may use
    a constant (V) from the previous R_DATA_OVERRIDE rather than a constant
    stored in the instruction.
 
-   Variables:  
-  
+   Variables:
+
    L = input space byte count
    D = index into class of relocations
    M = output space byte count
@@ -351,25 +351,25 @@
    U = second 32 bits of stack unwind information
    V = a literal constant (usually used in the next relocation)
    P = a previous relocation
-  
-   Lower case letters (starting with 'b') refer to following 
+
+   Lower case letters (starting with 'b') refer to following
    bytes in the relocation stream.  'b' is the next 1 byte,
-   c is the next 2 bytes, d is the next 3 bytes, etc...  
+   c is the next 2 bytes, d is the next 3 bytes, etc...
    This is the variable part of the relocation entries that
    makes our life a living hell.
 
    numerical constants are also used in the format string.  Note
-   the constants are represented in decimal. 
+   the constants are represented in decimal.
 
    '+', "*" and "=" represents the obvious postfix operators.
-   '<' represents a left shift. 
+   '<' represents a left shift.
 
    Stack Operations:
 
    Parameter Relocation Bits:
 
-   Unwind Entries:  
-   
+   Unwind Entries:
+
    Previous Relocations:  The index field represents which in the queue
    of 4 previous fixups should be re-applied.
 
@@ -382,7 +382,7 @@
 struct fixup_format
 {
   int D;
-  char *format;
+  const char *format;
 };
 
 static const struct fixup_format som_fixup_formats[256] =
@@ -789,266 +789,266 @@
 
 static reloc_howto_type som_hppa_howto_table[] =
 {
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_NO_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_NO_RELOCATION"},
-  {R_ZEROES, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ZEROES"},
-  {R_ZEROES, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ZEROES"},
-  {R_UNINIT, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_UNINIT"},
-  {R_UNINIT, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_UNINIT"},
-  {R_RELOCATION, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RELOCATION"},
-  {R_DATA_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DATA_ONE_SYMBOL"},
-  {R_DATA_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DATA_ONE_SYMBOL"},
-  {R_DATA_PLABEL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DATA_PLABEL"},
-  {R_DATA_PLABEL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DATA_PLABEL"},
-  {R_SPACE_REF, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_SPACE_REF"},
-  {R_REPEATED_INIT, 0, 0, 32, false, 0, 0, hppa_som_reloc, "REPEATED_INIT"},
-  {R_REPEATED_INIT, 0, 0, 32, false, 0, 0, hppa_som_reloc, "REPEATED_INIT"},
-  {R_REPEATED_INIT, 0, 0, 32, false, 0, 0, hppa_som_reloc, "REPEATED_INIT"},
-  {R_REPEATED_INIT, 0, 0, 32, false, 0, 0, hppa_som_reloc, "REPEATED_INIT"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_PCREL_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PCREL_CALL"},
-  {R_PCREL_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PCREL_CALL"},
-  {R_PCREL_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PCREL_CALL"},
-  {R_PCREL_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PCREL_CALL"},
-  {R_PCREL_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PCREL_CALL"},
-  {R_PCREL_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PCREL_CALL"},
-  {R_PCREL_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PCREL_CALL"},
-  {R_PCREL_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PCREL_CALL"},
-  {R_PCREL_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PCREL_CALL"},
-  {R_PCREL_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PCREL_CALL"},
-  {R_PCREL_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PCREL_CALL"},
-  {R_PCREL_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PCREL_CALL"},
-  {R_PCREL_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PCREL_CALL"},
-  {R_PCREL_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PCREL_CALL"},
-  {R_SHORT_PCREL_MODE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_SHORT_PCREL_MODE"},
-  {R_LONG_PCREL_MODE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_LONG_PCREL_MODE"},
-  {R_ABS_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ABS_CALL"},
-  {R_ABS_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ABS_CALL"},
-  {R_ABS_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ABS_CALL"},
-  {R_ABS_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ABS_CALL"},
-  {R_ABS_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ABS_CALL"},
-  {R_ABS_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ABS_CALL"},
-  {R_ABS_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ABS_CALL"},
-  {R_ABS_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ABS_CALL"},
-  {R_ABS_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ABS_CALL"},
-  {R_ABS_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ABS_CALL"},
-  {R_ABS_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ABS_CALL"},
-  {R_ABS_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ABS_CALL"},
-  {R_ABS_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ABS_CALL"},
-  {R_ABS_CALL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ABS_CALL"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_DP_RELATIVE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DP_RELATIVE"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_DLT_REL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DLT_REL"},
-  {R_DLT_REL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DLT_REL"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_CODE_ONE_SYMBOL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_ONE_SYMBOL"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_MILLI_REL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_MILLI_REL"},
-  {R_MILLI_REL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_MILLI_REL"},
-  {R_CODE_PLABEL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_PLABEL"},
-  {R_CODE_PLABEL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_PLABEL"},
-  {R_BREAKPOINT, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_BREAKPOINT"},
-  {R_ENTRY, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ENTRY"},
-  {R_ENTRY, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ENTRY"},
-  {R_ALT_ENTRY, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_ALT_ENTRY"},
-  {R_EXIT, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_EXIT"},
-  {R_BEGIN_TRY, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_BEGIN_TRY"},
-  {R_END_TRY, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_END_TRY"},
-  {R_END_TRY, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_END_TRY"},
-  {R_END_TRY, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_END_TRY"},
-  {R_BEGIN_BRTAB, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_BEGIN_BRTAB"},
-  {R_END_BRTAB, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_END_BRTAB"},
-  {R_STATEMENT, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_STATEMENT"},
-  {R_STATEMENT, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_STATEMENT"},
-  {R_STATEMENT, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_STATEMENT"},
-  {R_DATA_EXPR, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DATA_EXPR"},
-  {R_CODE_EXPR, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_CODE_EXPR"},
-  {R_FSEL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_FSEL"},
-  {R_LSEL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_LSEL"},
-  {R_RSEL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RSEL"},
-  {R_N_MODE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_N_MODE"},
-  {R_S_MODE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_S_MODE"},
-  {R_D_MODE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_D_MODE"},
-  {R_R_MODE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_R_MODE"},
-  {R_DATA_OVERRIDE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DATA_OVERRIDE"},
-  {R_DATA_OVERRIDE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DATA_OVERRIDE"},
-  {R_DATA_OVERRIDE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DATA_OVERRIDE"},
-  {R_DATA_OVERRIDE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DATA_OVERRIDE"},
-  {R_DATA_OVERRIDE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_DATA_OVERRIDE"},
-  {R_TRANSLATED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_TRANSLATED"},
-  {R_AUX_UNWIND, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_AUX_UNWIND"},
-  {R_COMP1, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_COMP1"},
-  {R_COMP2, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_COMP2"},
-  {R_COMP3, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_COMP3"},
-  {R_PREV_FIXUP, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PREV_FIXUP"},
-  {R_PREV_FIXUP, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PREV_FIXUP"},
-  {R_PREV_FIXUP, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PREV_FIXUP"},
-  {R_PREV_FIXUP, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_PREV_FIXUP"},
-  {R_SEC_STMT, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_SEC_STMT"},
-  {R_N0SEL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_N0SEL"},
-  {R_N1SEL, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_N1SEL"},
-  {R_LINETAB, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_LINETAB"},
-  {R_LINETAB_ESC, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_LINETAB_ESC"},
-  {R_LTP_OVERRIDE, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_LTP_OVERRIDE"},
-  {R_COMMENT, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_COMMENT"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"},
-  {R_RESERVED, 0, 0, 32, false, 0, 0, hppa_som_reloc, "R_RESERVED"}};
-  
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_NO_RELOCATION, "R_NO_RELOCATION"),
+  SOM_HOWTO (R_ZEROES, "R_ZEROES"),
+  SOM_HOWTO (R_ZEROES, "R_ZEROES"),
+  SOM_HOWTO (R_UNINIT, "R_UNINIT"),
+  SOM_HOWTO (R_UNINIT, "R_UNINIT"),
+  SOM_HOWTO (R_RELOCATION, "R_RELOCATION"),
+  SOM_HOWTO (R_DATA_ONE_SYMBOL, "R_DATA_ONE_SYMBOL"),
+  SOM_HOWTO (R_DATA_ONE_SYMBOL, "R_DATA_ONE_SYMBOL"),
+  SOM_HOWTO (R_DATA_PLABEL, "R_DATA_PLABEL"),
+  SOM_HOWTO (R_DATA_PLABEL, "R_DATA_PLABEL"),
+  SOM_HOWTO (R_SPACE_REF, "R_SPACE_REF"),
+  SOM_HOWTO (R_REPEATED_INIT, "REPEATED_INIT"),
+  SOM_HOWTO (R_REPEATED_INIT, "REPEATED_INIT"),
+  SOM_HOWTO (R_REPEATED_INIT, "REPEATED_INIT"),
+  SOM_HOWTO (R_REPEATED_INIT, "REPEATED_INIT"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_PCREL_CALL, "R_PCREL_CALL"),
+  SOM_HOWTO (R_PCREL_CALL, "R_PCREL_CALL"),
+  SOM_HOWTO (R_PCREL_CALL, "R_PCREL_CALL"),
+  SOM_HOWTO (R_PCREL_CALL, "R_PCREL_CALL"),
+  SOM_HOWTO (R_PCREL_CALL, "R_PCREL_CALL"),
+  SOM_HOWTO (R_PCREL_CALL, "R_PCREL_CALL"),
+  SOM_HOWTO (R_PCREL_CALL, "R_PCREL_CALL"),
+  SOM_HOWTO (R_PCREL_CALL, "R_PCREL_CALL"),
+  SOM_HOWTO (R_PCREL_CALL, "R_PCREL_CALL"),
+  SOM_HOWTO (R_PCREL_CALL, "R_PCREL_CALL"),
+  SOM_HOWTO (R_PCREL_CALL, "R_PCREL_CALL"),
+  SOM_HOWTO (R_PCREL_CALL, "R_PCREL_CALL"),
+  SOM_HOWTO (R_PCREL_CALL, "R_PCREL_CALL"),
+  SOM_HOWTO (R_PCREL_CALL, "R_PCREL_CALL"),
+  SOM_HOWTO (R_SHORT_PCREL_MODE, "R_SHORT_PCREL_MODE"),
+  SOM_HOWTO (R_LONG_PCREL_MODE, "R_LONG_PCREL_MODE"),
+  SOM_HOWTO (R_ABS_CALL, "R_ABS_CALL"),
+  SOM_HOWTO (R_ABS_CALL, "R_ABS_CALL"),
+  SOM_HOWTO (R_ABS_CALL, "R_ABS_CALL"),
+  SOM_HOWTO (R_ABS_CALL, "R_ABS_CALL"),
+  SOM_HOWTO (R_ABS_CALL, "R_ABS_CALL"),
+  SOM_HOWTO (R_ABS_CALL, "R_ABS_CALL"),
+  SOM_HOWTO (R_ABS_CALL, "R_ABS_CALL"),
+  SOM_HOWTO (R_ABS_CALL, "R_ABS_CALL"),
+  SOM_HOWTO (R_ABS_CALL, "R_ABS_CALL"),
+  SOM_HOWTO (R_ABS_CALL, "R_ABS_CALL"),
+  SOM_HOWTO (R_ABS_CALL, "R_ABS_CALL"),
+  SOM_HOWTO (R_ABS_CALL, "R_ABS_CALL"),
+  SOM_HOWTO (R_ABS_CALL, "R_ABS_CALL"),
+  SOM_HOWTO (R_ABS_CALL, "R_ABS_CALL"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_DLT_REL, "R_DLT_REL"),
+  SOM_HOWTO (R_DLT_REL, "R_DLT_REL"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_CODE_ONE_SYMBOL, "R_CODE_ONE_SYMBOL"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_MILLI_REL, "R_MILLI_REL"),
+  SOM_HOWTO (R_MILLI_REL, "R_MILLI_REL"),
+  SOM_HOWTO (R_CODE_PLABEL, "R_CODE_PLABEL"),
+  SOM_HOWTO (R_CODE_PLABEL, "R_CODE_PLABEL"),
+  SOM_HOWTO (R_BREAKPOINT, "R_BREAKPOINT"),
+  SOM_HOWTO (R_ENTRY, "R_ENTRY"),
+  SOM_HOWTO (R_ENTRY, "R_ENTRY"),
+  SOM_HOWTO (R_ALT_ENTRY, "R_ALT_ENTRY"),
+  SOM_HOWTO (R_EXIT, "R_EXIT"),
+  SOM_HOWTO (R_BEGIN_TRY, "R_BEGIN_TRY"),
+  SOM_HOWTO (R_END_TRY, "R_END_TRY"),
+  SOM_HOWTO (R_END_TRY, "R_END_TRY"),
+  SOM_HOWTO (R_END_TRY, "R_END_TRY"),
+  SOM_HOWTO (R_BEGIN_BRTAB, "R_BEGIN_BRTAB"),
+  SOM_HOWTO (R_END_BRTAB, "R_END_BRTAB"),
+  SOM_HOWTO (R_STATEMENT, "R_STATEMENT"),
+  SOM_HOWTO (R_STATEMENT, "R_STATEMENT"),
+  SOM_HOWTO (R_STATEMENT, "R_STATEMENT"),
+  SOM_HOWTO (R_DATA_EXPR, "R_DATA_EXPR"),
+  SOM_HOWTO (R_CODE_EXPR, "R_CODE_EXPR"),
+  SOM_HOWTO (R_FSEL, "R_FSEL"),
+  SOM_HOWTO (R_LSEL, "R_LSEL"),
+  SOM_HOWTO (R_RSEL, "R_RSEL"),
+  SOM_HOWTO (R_N_MODE, "R_N_MODE"),
+  SOM_HOWTO (R_S_MODE, "R_S_MODE"),
+  SOM_HOWTO (R_D_MODE, "R_D_MODE"),
+  SOM_HOWTO (R_R_MODE, "R_R_MODE"),
+  SOM_HOWTO (R_DATA_OVERRIDE, "R_DATA_OVERRIDE"),
+  SOM_HOWTO (R_DATA_OVERRIDE, "R_DATA_OVERRIDE"),
+  SOM_HOWTO (R_DATA_OVERRIDE, "R_DATA_OVERRIDE"),
+  SOM_HOWTO (R_DATA_OVERRIDE, "R_DATA_OVERRIDE"),
+  SOM_HOWTO (R_DATA_OVERRIDE, "R_DATA_OVERRIDE"),
+  SOM_HOWTO (R_TRANSLATED, "R_TRANSLATED"),
+  SOM_HOWTO (R_AUX_UNWIND, "R_AUX_UNWIND"),
+  SOM_HOWTO (R_COMP1, "R_COMP1"),
+  SOM_HOWTO (R_COMP2, "R_COMP2"),
+  SOM_HOWTO (R_COMP3, "R_COMP3"),
+  SOM_HOWTO (R_PREV_FIXUP, "R_PREV_FIXUP"),
+  SOM_HOWTO (R_PREV_FIXUP, "R_PREV_FIXUP"),
+  SOM_HOWTO (R_PREV_FIXUP, "R_PREV_FIXUP"),
+  SOM_HOWTO (R_PREV_FIXUP, "R_PREV_FIXUP"),
+  SOM_HOWTO (R_SEC_STMT, "R_SEC_STMT"),
+  SOM_HOWTO (R_N0SEL, "R_N0SEL"),
+  SOM_HOWTO (R_N1SEL, "R_N1SEL"),
+  SOM_HOWTO (R_LINETAB, "R_LINETAB"),
+  SOM_HOWTO (R_LINETAB_ESC, "R_LINETAB_ESC"),
+  SOM_HOWTO (R_LTP_OVERRIDE, "R_LTP_OVERRIDE"),
+  SOM_HOWTO (R_COMMENT, "R_COMMENT"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED"),
+  SOM_HOWTO (R_RESERVED, "R_RESERVED")};
+
 /* Initialize the SOM relocation queue.  By definition the queue holds
    the last four multibyte fixups.  */
-  
+
 static void
 som_initialize_reloc_queue (queue)
      struct reloc_queue *queue;
@@ -1130,7 +1130,7 @@
       queue[1].size = tmp2;
       return;
     }
-  abort();
+  abort ();
 }
 
 /* Search for a particular relocation in the relocation queue.  */
@@ -1158,7 +1158,7 @@
 
 static unsigned char *
 try_prev_fixup (abfd, subspace_reloc_sizep, p, size, queue)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      int *subspace_reloc_sizep;
      unsigned char *p;
      unsigned int size;
@@ -1169,7 +1169,7 @@
   if (queue_index != -1)
     {
       /* Found this in a previous fixup.  Undo the fixup we
-	 just built and use R_PREV_FIXUP instead.  We saved 
+	 just built and use R_PREV_FIXUP instead.  We saved
 	 a total of size - 1 bytes in the fixup stream.  */
       bfd_put_8 (abfd, R_PREV_FIXUP + queue_index, p);
       p += 1;
@@ -1187,7 +1187,7 @@
 
 /* Emit the proper R_NO_RELOCATION fixups to map the next SKIP
    bytes without any relocation.  Update the size of the subspace
-   relocation stream via SUBSPACE_RELOC_SIZE_P; also return the 
+   relocation stream via SUBSPACE_RELOC_SIZE_P; also return the
    current pointer into the relocation stream.  */
 
 static unsigned char *
@@ -1218,8 +1218,8 @@
 	     most recent fixup.  */
 	}
     }
-  
-  /* The difference must be less than 0x1000000.  Use one 
+
+  /* The difference must be less than 0x1000000.  Use one
      more R_NO_RELOCATION entry to get to the right difference.  */
   if ((skip & 3) == 0 && skip <= 0xc0000 && skip > 0)
     {
@@ -1270,11 +1270,11 @@
      unsigned int *subspace_reloc_sizep;
      struct reloc_queue *queue;
 {
-  if ((unsigned)(addend) + 0x80 < 0x100)
+  if ((unsigned) (addend) + 0x80 < 0x100)
     {
       bfd_put_8 (abfd, R_DATA_OVERRIDE + 1, p);
       bfd_put_8 (abfd, addend, p + 1);
-      p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 2, queue); 
+      p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 2, queue);
     }
   else if ((unsigned) (addend) + 0x8000 < 0x10000)
     {
@@ -1312,11 +1312,11 @@
   int arg_bits = HPPA_R_ARG_RELOC (bfd_reloc->addend);
   int rtn_bits = arg_bits & 0x3;
   int type, done = 0;
-  
+
   /* You'll never believe all this is necessary to handle relocations
      for function calls.  Having to compute and pack the argument
      relocation bits is the real nightmare.
-     
+
      If you're interested in how this works, just forget it.  You really
      do not want to know about this braindamage.  */
 
@@ -1368,7 +1368,7 @@
 	  done = 1;
 	}
     }
-  
+
   /* If this could not be handled with a simple relocation, then do a hard
      one.  Hard relocations occur if the symbol number was too high or if
      the encoding of argument relocation bits is too complex.  */
@@ -1385,14 +1385,14 @@
 	type += 9 * 4;
       else
 	type += (3 * (arg_bits >> 4 & 3) + (arg_bits >> 2 & 3)) * 4;
-      
+
       /* Output the first two bytes of the relocation.  These describe
 	 the length of the relocation and encoding style.  */
       bfd_put_8 (abfd, bfd_reloc->howto->type + 10
 		 + 2 * (sym_num >= 0x100) + (type >= 0x100),
 		 p);
       bfd_put_8 (abfd, type, p + 1);
-      
+
       /* Now output the symbol index and see if this bizarre relocation
 	 just happened to be in the relocation queue.  */
       if (sym_num < 0x100)
@@ -1410,8 +1410,7 @@
   return p;
 }
 
-
-/* Return the logarithm of X, base 2, considering X unsigned. 
+/* Return the logarithm of X, base 2, considering X unsigned.
    Abort -1 if X is not a power or two or is zero.  */
 
 static int
@@ -1432,13 +1431,13 @@
 static bfd_reloc_status_type
 hppa_som_reloc (abfd, reloc_entry, symbol_in, data,
 		input_section, output_bfd, error_message)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
-     asymbol *symbol_in;
-     PTR data;
+     asymbol *symbol_in ATTRIBUTE_UNUSED;
+     PTR data ATTRIBUTE_UNUSED;
      asection *input_section;
      bfd *output_bfd;
-     char **error_message;
+     char **error_message ATTRIBUTE_UNUSED;
 {
   if (output_bfd)
     {
@@ -1467,7 +1466,7 @@
   if (!final_types || !final_type)
     return NULL;
 
-  /* The field selector may require additional relocations to be 
+  /* The field selector may require additional relocations to be
      generated.  It's impossible to know at this moment if additional
      relocations will be needed, so we make them.  The code to actually
      write the relocation/fixup stream is responsible for removing
@@ -1573,7 +1572,7 @@
 	*final_type = base_type;
 	break;
     }
-  
+
   switch (base_type)
     {
     case R_HPPA:
@@ -1648,7 +1647,6 @@
 	}
       break;
 
-
     case R_HPPA_GOTOFF:
       /* More PLABEL special cases.  */
       if (field == e_psel
@@ -1721,7 +1719,7 @@
 /*ARGSUSED*/
 static reloc_howto_type *
 som_bfd_reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   if ((int) code < (int) R_NO_RELOCATION + 255)
@@ -1795,7 +1793,7 @@
 
      It's about time, OSF has used the new id since at least 1992;
      HPUX didn't start till nearly 1995!.
-    
+
      The new approach examines the entry field.  If it's zero or not 4
      byte aligned then it's not a proper code address and we guess it's
      really the executable flags.  */
@@ -1824,7 +1822,7 @@
   bfd_default_set_arch_mach (abfd, bfd_arch_hppa, pa10);
   bfd_get_symcount (abfd) = file_hdrp->symbol_total;
 
-  /* Initialize the saved symbol table and string table to NULL.  
+  /* Initialize the saved symbol table and string table to NULL.
      Save important offsets and sizes from the SOM header into
      the BFD.  */
   obj_som_stringtab (abfd) = (char  *) NULL;
@@ -1864,7 +1862,7 @@
   if (!space_strings && file_hdr->space_strings_size != 0)
     goto error_return;
 
-  if (bfd_seek (abfd, current_offset + file_hdr->space_strings_location, 
+  if (bfd_seek (abfd, current_offset + file_hdr->space_strings_location,
   		SEEK_SET) < 0)
     goto error_return;
   if (bfd_read (space_strings, 1, file_hdr->space_strings_size, abfd)
@@ -1897,7 +1895,7 @@
       if (!newname)
 	goto error_return;
       strcpy (newname, space.name.n_name);
-			   
+
       space_asect = bfd_make_section_anyway (abfd, newname);
       if (!space_asect)
 	goto error_return;
@@ -1972,7 +1970,7 @@
 						 subspace.quadrant) == false)
 	    goto error_return;
 
-	  /* Keep an easy mapping between subspaces and sections. 
+	  /* Keep an easy mapping between subspaces and sections.
 	     Note we do not necessarily read the subspaces in the
 	     same order in which they appear in the object file.
 
@@ -1988,12 +1986,12 @@
 	     by the access_control_bits in the subspace header.  */
 	  switch (subspace.access_control_bits >> 4)
 	    {
-	    /* Readonly data.  */  
+	    /* Readonly data.  */
 	    case 0x0:
 	      subspace_asect->flags |= SEC_DATA | SEC_READONLY;
 	      break;
 
-	    /* Normal data.  */  
+	    /* Normal data.  */
 	    case 0x1:
 	      subspace_asect->flags |= SEC_DATA;
 	      break;
@@ -2014,8 +2012,8 @@
 	      subspace_asect->flags |= SEC_CODE;
 	      break;
 	    }
-	  
-	  if (subspace.dup_common || subspace.is_common) 
+
+	  if (subspace.dup_common || subspace.is_common)
 	    subspace_asect->flags |= SEC_IS_COMMON;
 	  else if (subspace.subspace_length > 0)
 	    subspace_asect->flags |= SEC_HAS_CONTENTS;
@@ -2044,7 +2042,7 @@
 	      subspace_asect->rel_filepos = subspace.fixup_request_index;
 	      som_section_data (subspace_asect)->reloc_size
 		= subspace.fixup_request_quantity;
-	      /* We can not determine this yet.  When we read in the 
+	      /* We can not determine this yet.  When we read in the
 		 relocation table the correct value will be filled in.  */
 	      subspace_asect->reloc_count = -1;
 	    }
@@ -2099,7 +2097,7 @@
     }
   qsort (subspace_sections, total_subspaces,
 	 sizeof (asection *), compare_subspaces);
-  
+
   /* subspace_sections is now sorted in the order in which the subspaces
      appear in the object file.  Assign an index to each one now.  */
   for (i = 0; i < total_subspaces; i++)
@@ -2133,7 +2131,7 @@
   unsigned long current_offset = 0;
   struct lst_header lst_header;
   struct som_entry som_entry;
-#define ENTRY_SIZE sizeof(struct som_entry)
+#define ENTRY_SIZE sizeof (struct som_entry)
 
   if (bfd_read ((PTR) & file_hdr, 1, FILE_HDR_SIZE, abfd) != FILE_HDR_SIZE)
     {
@@ -2320,7 +2318,7 @@
      a wise thing to do, it makes comparing objects during a multi-stage
      bootstrap difficult.  */
   file_hdr->file_time.secs = 0;
-  file_hdr->file_time.nanosecs = 0; 
+  file_hdr->file_time.nanosecs = 0;
 
   file_hdr->entry_space = 0;
   file_hdr->entry_subspace = 0;
@@ -2336,7 +2334,7 @@
 	 subspace.  */
       if (!som_is_space (section) && !som_is_subspace (section))
 	continue;
-      
+
       if (som_is_space (section))
 	{
 	  /* Allocate space for the space dictionary.  */
@@ -2351,11 +2349,11 @@
 	  som_section_data (section)->space_dict->init_pointer_index = -1;
 
 	  /* Set more attributes that were stuffed away in private data.  */
-	  som_section_data (section)->space_dict->sort_key = 
+	  som_section_data (section)->space_dict->sort_key =
 	    som_section_data (section)->copy_data->sort_key;
-	  som_section_data (section)->space_dict->is_defined = 
+	  som_section_data (section)->space_dict->is_defined =
 	    som_section_data (section)->copy_data->is_defined;
-	  som_section_data (section)->space_dict->is_private = 
+	  som_section_data (section)->space_dict->is_private =
 	    som_section_data (section)->copy_data->is_private;
 	  som_section_data (section)->space_dict->space_number =
 	    som_section_data (section)->copy_data->space_number;
@@ -2384,13 +2382,13 @@
 	  if (section->flags & SEC_CODE)
 	    som_section_data (section)->subspace_dict->code_only = 1;
 
-	  som_section_data (section)->subspace_dict->subspace_start = 
+	  som_section_data (section)->subspace_dict->subspace_start =
 	    section->vma;
 	  som_section_data (section)->subspace_dict->subspace_length =
 	    bfd_section_size (abfd, section);
 	  som_section_data (section)->subspace_dict->initialization_length =
 	    bfd_section_size (abfd, section);
-	  som_section_data (section)->subspace_dict->alignment = 
+	  som_section_data (section)->subspace_dict->alignment =
 	    1 << section->alignment_power;
 
 	  /* Set more attributes that were stuffed away in private data.  */
@@ -2507,7 +2505,7 @@
   asymbol **sym1 = (asymbol **) arg1;
   asymbol **sym2 = (asymbol **) arg2;
   unsigned int count1, count2;
-  
+
   /* Get relocation count for each symbol.  Note that the count
      is stored in the udata pointer for section symbols!  */
   if ((*sym1)->flags & BSF_SECTION_SYM)
@@ -2539,8 +2537,7 @@
 {
   asection **subspace1 = (asection **) arg1;
   asection **subspace2 = (asection **) arg2;
-  unsigned int count1, count2;
-  
+
   if ((*subspace1)->target_index < (*subspace2)->target_index)
     return -1;
   else if ((*subspace2)->target_index < (*subspace1)->target_index)
@@ -2604,7 +2601,7 @@
 	      || bfd_is_abs_section ((*reloc->sym_ptr_ptr)->section))
 	    continue;
 
-	  /* Scaling to encourage symbols involved in R_DP_RELATIVE 
+	  /* Scaling to encourage symbols involved in R_DP_RELATIVE
 	     and R_CODE_ONE_SYMBOL relocations to come first.  These
 	     two relocations have single byte versions if the symbol
 	     index is very small.  */
@@ -2712,7 +2709,7 @@
 	  som_section_data (subsection)->subspace_dict->fixup_request_index
 	    = total_reloc_size;
 
-	  /* To make life easier start over with a clean slate for 
+	  /* To make life easier start over with a clean slate for
 	     each subspace.  Seek to the start of the relocation stream
 	     for this subspace in preparation for writing out its fixup
 	     stream.  */
@@ -2730,7 +2727,7 @@
 	  current_call_mode = R_SHORT_PCREL_MODE;
 #endif
 
-	  /* Translate each BFD relocation into one or more SOM 
+	  /* Translate each BFD relocation into one or more SOM
 	     relocations.  */
 	  for (j = 0; j < subsection->reloc_count; j++)
 	    {
@@ -2738,16 +2735,16 @@
 	      unsigned int skip;
 	      int sym_num;
 
-	      /* Get the symbol number.  Remember it's stored in a 
+	      /* Get the symbol number.  Remember it's stored in a
 		 special place for section symbols.  */
 	      if ((*bfd_reloc->sym_ptr_ptr)->flags & BSF_SECTION_SYM)
 		sym_num = (*bfd_reloc->sym_ptr_ptr)->udata.i;
 	      else
 		sym_num = som_symbol_data (*bfd_reloc->sym_ptr_ptr)->index;
-	      
+
 	      /* If there is not enough room for the next couple relocations,
 		 then dump the current buffer contents now.  Also reinitialize
-		 the relocation queue. 
+		 the relocation queue.
 
 		 No single BFD relocation could ever translate into more
 		 than 100 bytes of SOM relocations (20bytes is probably the
@@ -2818,7 +2815,7 @@
 		case R_DP_RELATIVE:
 		  /* Account for any addend.  */
 		  if (bfd_reloc->addend)
-		    p = som_reloc_addend (abfd, bfd_reloc->addend, p, 
+		    p = som_reloc_addend (abfd, bfd_reloc->addend, p,
 					  &subspace_reloc_size, reloc_queue);
 
 		  if (sym_num < 0x20)
@@ -2838,7 +2835,7 @@
 		    {
 		      bfd_put_8 (abfd, bfd_reloc->howto->type + 33, p);
 		      bfd_put_8 (abfd, sym_num >> 16, p + 1);
-		      bfd_put_16 (abfd, sym_num, p + 2); 
+		      bfd_put_16 (abfd, sym_num, p + 2);
 		      p = try_prev_fixup (abfd, &subspace_reloc_size,
 					  p, 4, reloc_queue);
 		    }
@@ -2853,7 +2850,7 @@
 		  /* Account for any addend using R_DATA_OVERRIDE.  */
 		  if (bfd_reloc->howto->type != R_DATA_ONE_SYMBOL
 		      && bfd_reloc->addend)
-		    p = som_reloc_addend (abfd, bfd_reloc->addend, p, 
+		    p = som_reloc_addend (abfd, bfd_reloc->addend, p,
 					  &subspace_reloc_size, reloc_queue);
 
 		  if (sym_num < 0x100)
@@ -2867,7 +2864,7 @@
 		    {
 		      bfd_put_8 (abfd, bfd_reloc->howto->type + 1, p);
 		      bfd_put_8 (abfd, sym_num >> 16, p + 1);
-		      bfd_put_16 (abfd, sym_num, p + 2); 
+		      bfd_put_16 (abfd, sym_num, p + 2);
 		      p = try_prev_fixup (abfd, &subspace_reloc_size,
 					  p, 4, reloc_queue);
 		    }
@@ -2888,7 +2885,7 @@
 		       the R_ENTRY relocation, and the rest in the R_EXIT
 		       relocation.  */
 		    bfd_put_32 (abfd, bfd_reloc->addend, p + 1);
-		
+
 		    /* Find the next R_EXIT relocation.  */
 		    for (tmp = j; tmp < subsection->reloc_count; tmp++)
 		      {
@@ -2905,7 +2902,7 @@
 					p, 9, reloc_queue);
 		    break;
 		  }
-		  
+
 		case R_N_MODE:
 		case R_S_MODE:
 		case R_D_MODE:
@@ -2971,9 +2968,9 @@
 					  p, 4, reloc_queue);
 		    }
 		  break;
-		      
+
 		case R_COMP1:
-		  /* The only time we generate R_COMP1, R_COMP2 and 
+		  /* The only time we generate R_COMP1, R_COMP2 and
 		     R_CODE_EXPR relocs is for the difference of two
 		     symbols.  Hence we can cheat here.  */
 		  bfd_put_8 (abfd, bfd_reloc->howto->type, p);
@@ -2983,7 +2980,7 @@
 		  break;
 
 		case R_COMP2:
-		  /* The only time we generate R_COMP1, R_COMP2 and 
+		  /* The only time we generate R_COMP1, R_COMP2 and
 		     R_CODE_EXPR relocs is for the difference of two
 		     symbols.  Hence we can cheat here.  */
 		  bfd_put_8 (abfd, bfd_reloc->howto->type, p);
@@ -2996,7 +2993,7 @@
 
 		case R_CODE_EXPR:
 		case R_DATA_EXPR:
-		  /* The only time we generate R_COMP1, R_COMP2 and 
+		  /* The only time we generate R_COMP1, R_COMP2 and
 		     R_CODE_EXPR relocs is for the difference of two
 		     symbols.  Hence we can cheat here.  */
 		  bfd_put_8 (abfd, bfd_reloc->howto->type, p);
@@ -3017,7 +3014,7 @@
 
 	  /* Last BFD relocation for a subspace has been processed.
 	     Map the rest of the subspace with R_NO_RELOCATION fixups.  */
-	  p = som_reloc_skip (abfd, bfd_section_size (abfd, subsection) 
+	  p = som_reloc_skip (abfd, bfd_section_size (abfd, subsection)
 			              - reloc_offset,
 			      p, &subspace_reloc_size, reloc_queue);
 
@@ -3047,14 +3044,12 @@
 {
   /* Chunk of memory that we can use as buffer space, then throw
      away.  */
-  unsigned char tmp_space[SOM_TMP_BUFSIZE];
-  unsigned char *p;
+  size_t tmp_space_size = SOM_TMP_BUFSIZE;
+  unsigned char *tmp_space = alloca (tmp_space_size);
+  unsigned char *p = tmp_space;
   unsigned int strings_size = 0;
   asection *section;
 
-  memset (tmp_space, 0, SOM_TMP_BUFSIZE);
-  p = tmp_space;
-
   /* Seek to the start of the space strings in preparation for writing
      them out.  */
   if (bfd_seek (abfd, current_offset, SEEK_SET) < 0)
@@ -3064,7 +3059,7 @@
      building up and writing string table entries for their names.  */
   for (section = abfd->sections; section != NULL; section = section->next)
     {
-      int length;
+      size_t length;
 
       /* Only work with space/subspaces; avoid any other sections
 	 which might have been made (.text for example).  */
@@ -3075,14 +3070,32 @@
       length = strlen (section->name);
 
       /* If there is not enough room for the next entry, then dump the
-	 current buffer contents now.  Each entry will take 4 bytes to
-	 hold the string length + the string itself + null terminator.  */
-      if (p - tmp_space + 5 + length > SOM_TMP_BUFSIZE)
+         current buffer contents now and maybe allocate a larger
+         buffer.  Each entry will take 4 bytes to hold the string
+         length + the string itself + null terminator.  */
+      if (p - tmp_space + 5 + length > tmp_space_size)
 	{
+	  /* Flush buffer before refilling or reallocating.  */
 	  if (bfd_write ((PTR) &tmp_space[0], p - tmp_space, 1, abfd)
-	      != p - tmp_space) 
+	      != p - tmp_space)
 	    return false;
-	  /* Reset to beginning of the buffer space.  */
+
+	  /* Reallocate if now empty buffer still too small.  */
+	  if (5 + length > tmp_space_size)
+	    {
+	      /* Ensure a minimum growth factor to avoid O(n**2) space
+                 consumption for n strings.  The optimal minimum
+                 factor seems to be 2, as no other value can guarantee
+                 wasting less then 50% space.  (Note that we cannot
+                 deallocate space allocated by `alloca' without
+                 returning from this function.)  The same technique is
+                 used a few more times below when a buffer is
+                 reallocated.  */
+	      tmp_space_size = MAX (2 * tmp_space_size, 5 + length);
+	      tmp_space = alloca (tmp_space_size);
+	    }
+
+	  /* Reset to beginning of the (possibly new) buffer space.  */
 	  p = tmp_space;
 	}
 
@@ -3133,11 +3146,13 @@
      COMPUNIT *compilation_unit;
 {
   unsigned int i;
-  
+
   /* Chunk of memory that we can use as buffer space, then throw
      away.  */
-  unsigned char tmp_space[SOM_TMP_BUFSIZE];
-  unsigned char *p;
+  size_t tmp_space_size = SOM_TMP_BUFSIZE;
+  unsigned char *tmp_space = alloca (tmp_space_size);
+  unsigned char *p = tmp_space;
+
   unsigned int strings_size = 0;
   unsigned char *comp[4];
 
@@ -3155,9 +3170,6 @@
       comp[3] = compilation_unit->version_id.n_name;
     }
 
-  memset (tmp_space, 0, SOM_TMP_BUFSIZE);
-  p = tmp_space;
-
   /* Seek to the start of the space strings in preparation for writing
      them out.  */
   if (bfd_seek (abfd, current_offset, SEEK_SET) < 0)
@@ -3167,16 +3179,28 @@
     {
       for (i = 0; i < 4; i++)
 	{
-	  int length = strlen (comp[i]);
+	  size_t length = strlen (comp[i]);
 
 	  /* If there is not enough room for the next entry, then dump
-	     the current buffer contents now.  */
-	  if (p - tmp_space + 5 + length > SOM_TMP_BUFSIZE)
+	     the current buffer contents now and maybe allocate a
+	     larger buffer.  */
+	  if (p - tmp_space + 5 + length > tmp_space_size)
 	    {
+	      /* Flush buffer before refilling or reallocating.  */
 	      if (bfd_write ((PTR) &tmp_space[0], p - tmp_space, 1, abfd)
 		  != p - tmp_space)
 		return false;
-	      /* Reset to beginning of the buffer space.  */
+
+	      /* Reallocate if now empty buffer still too small.  */
+	      if (5 + length > tmp_space_size)
+		{
+		  /* See alloca above for discussion of new size.  */
+		  tmp_space_size = MAX (2 * tmp_space_size, 5 + length);
+		  tmp_space = alloca (tmp_space_size);
+		}
+
+	      /* Reset to beginning of the (possibly new) buffer
+                 space.  */
 	      p = tmp_space;
 	    }
 
@@ -3193,19 +3217,19 @@
 
 	  switch (i)
 	    {
-	    case 0:	
+	    case 0:
 	      obj_som_compilation_unit (abfd)->name.n_strx = strings_size;
 	      break;
 	    case 1:
-	      obj_som_compilation_unit (abfd)->language_name.n_strx = 
+	      obj_som_compilation_unit (abfd)->language_name.n_strx =
 		strings_size;
 	      break;
 	    case 2:
-	      obj_som_compilation_unit (abfd)->product_id.n_strx = 
+	      obj_som_compilation_unit (abfd)->product_id.n_strx =
 		strings_size;
 	      break;
 	    case 3:
-	      obj_som_compilation_unit (abfd)->version_id.n_strx = 
+	      obj_som_compilation_unit (abfd)->version_id.n_strx =
 		strings_size;
 	      break;
 	    }
@@ -3225,16 +3249,26 @@
 
   for (i = 0; i < num_syms; i++)
     {
-      int length = strlen (syms[i]->name);
+      size_t length = strlen (syms[i]->name);
 
       /* If there is not enough room for the next entry, then dump the
-	 current buffer contents now.  */
-     if (p - tmp_space + 5 + length > SOM_TMP_BUFSIZE)
+	 current buffer contents now and maybe allocate a larger buffer.  */
+     if (p - tmp_space + 5 + length > tmp_space_size)
 	{
+	  /* Flush buffer before refilling or reallocating.  */
 	  if (bfd_write ((PTR) &tmp_space[0], p - tmp_space, 1, abfd)
 	      != p - tmp_space)
 	    return false;
-	  /* Reset to beginning of the buffer space.  */
+
+	  /* Reallocate if now empty buffer still too small.  */
+	  if (5 + length > tmp_space_size)
+	    {
+	      /* See alloca above for discussion of new size.  */
+	      tmp_space_size = MAX (2 * tmp_space_size, 5 + length);
+	      tmp_space = alloca (tmp_space_size);
+	    }
+
+	  /* Reset to beginning of the (possibly new) buffer space.  */
 	  p = tmp_space;
 	}
 
@@ -3270,23 +3304,22 @@
   return true;
 }
 
-/* Compute variable information to be placed in the SOM headers, 
+/* Compute variable information to be placed in the SOM headers,
    space/subspace dictionaries, relocation streams, etc.  Begin
    writing parts of the object file.  */
 
-static boolean 
+static boolean
 som_begin_writing (abfd)
      bfd *abfd;
 {
   unsigned long current_offset = 0;
   int strings_size = 0;
-  unsigned int total_reloc_size = 0;
   unsigned long num_spaces, num_subspaces, i;
   asection *section;
   unsigned int total_subspaces = 0;
   struct som_exec_auxhdr *exec_header = NULL;
 
-  /* The file header will always be first in an object file, 
+  /* The file header will always be first in an object file,
      everything else can be in random locations.  To keep things
      "simple" BFD will lay out the object file in the manner suggested
      by the PRO ABI for PA-RISC Systems.  */
@@ -3298,7 +3331,7 @@
 
   /* Make room for the file header, it's contents are not complete
      yet, so it can not be written at this time.  */
-  current_offset += sizeof (struct header);  
+  current_offset += sizeof (struct header);
 
   /* Any auxiliary headers will follow the file header.  Right now
      we support only the copyright and version headers.  */
@@ -3401,7 +3434,7 @@
   if (current_offset % 4)
     current_offset += (4 - (current_offset % 4));
 
-  /* Mark the offset of the space/subspace string table in the 
+  /* Mark the offset of the space/subspace string table in the
      file header.  */
   obj_som_file_hdr (abfd)->space_strings_location = current_offset;
 
@@ -3414,13 +3447,13 @@
   obj_som_file_hdr (abfd)->space_strings_size = strings_size;
   current_offset += strings_size;
 
-  /* Next is the compilation unit. */
+  /* Next is the compilation unit.  */
   obj_som_file_hdr (abfd)->compiler_location = current_offset;
   obj_som_file_hdr (abfd)->compiler_total = 0;
-  if (obj_som_compilation_unit (abfd)) 
+  if (obj_som_compilation_unit (abfd))
     {
       obj_som_file_hdr (abfd)->compiler_total = 1;
-      current_offset += COMPUNITSZ; 
+      current_offset += COMPUNITSZ;
     }
 
   /* Now compute the file positions for the loadable subspaces, taking
@@ -3482,7 +3515,7 @@
 
 	      /* Keep track of exactly where we are within a particular
 		 space.  This is necessary as the braindamaged HPUX
-		 loader will create holes between subspaces *and* 
+		 loader will create holes between subspaces *and*
 		 subspace alignments are *NOT* preserved.  What a crock.  */
 	      subspace_offset = subsection->vma;
 
@@ -3511,7 +3544,6 @@
 	      subspace_offset += subsection->vma - subspace_offset;
 	    }
 
-
 	  subsection->target_index = total_subspaces++;
 	  /* This is real data to be loaded from the file.  */
 	  if (subsection->flags & SEC_LOAD)
@@ -3526,7 +3558,7 @@
 	      som_section_data (subsection)->subspace_dict->file_loc_init_value
 		= current_offset;
 	      subsection->filepos = current_offset;
-	      current_offset += bfd_section_size (abfd, subsection); 
+	      current_offset += bfd_section_size (abfd, subsection);
 	      subspace_offset += bfd_section_size (abfd, subsection);
 	    }
 	  /* Looks like uninitialized data.  */
@@ -3543,7 +3575,7 @@
 	    }
 	}
       /* Goto the next section.  */
-      section = section->next; 
+      section = section->next;
     }
 
   /* Finally compute the file positions for unloadable subspaces.
@@ -3571,7 +3603,7 @@
 	   subsection != NULL;
 	   subsection = subsection->next)
 	{
-	  
+
 	  if (!som_is_subspace (subsection)
 	      || !som_is_container (section, subsection)
 	      || (subsection->flags & SEC_ALLOC) != 0)
@@ -3584,7 +3616,7 @@
 	      som_section_data (subsection)->subspace_dict->file_loc_init_value
 		= current_offset;
 	      subsection->filepos = current_offset;
-	      current_offset += bfd_section_size (abfd, subsection); 
+	      current_offset += bfd_section_size (abfd, subsection);
 	    }
 	  /* Looks like uninitialized data.  */
 	  else
@@ -3596,7 +3628,7 @@
 	    }
 	}
       /* Goto the next section.  */
-      section = section->next; 
+      section = section->next;
     }
 
   /* If building an executable, then make sure to seek to and write
@@ -3645,7 +3677,7 @@
      The names of the symbols are stored in a separate string table,
      and the index for each symbol name into the string table is computed
      below.  Therefore, it is not possible to write the symbol table
-     at this time. 
+     at this time.
 
      These used to be output before the subspace contents, but they
      were moved here to work around a stupid bug in the hpux linker
@@ -3654,7 +3686,7 @@
 
   /* Make sure we're on a word boundary.  */
   if (current_offset % 4)
-    current_offset += (4 - (current_offset % 4)); 
+    current_offset += (4 - (current_offset % 4));
 
   num_syms = bfd_get_symcount (abfd);
   obj_som_file_hdr (abfd)->symbol_location = current_offset;
@@ -3687,7 +3719,7 @@
   /* At the end of the file is the fixup stream which starts on a
      word boundary.  */
   if (current_offset % 4)
-    current_offset += (4 - (current_offset % 4)); 
+    current_offset += (4 - (current_offset % 4));
   obj_som_file_hdr (abfd)->fixup_request_location = current_offset;
 
   /* Write the fixups and update fields in subspace headers which
@@ -3700,7 +3732,7 @@
 
   /* Done.  Store the total size of the SOM.  */
   obj_som_file_hdr (abfd)->som_length = current_offset + total_reloc_size;
- 
+
   /* Now that the symbol table information is complete, build and
      write the symbol table.  */
   if (som_build_and_write_symbol_table (abfd) == false)
@@ -3729,7 +3761,7 @@
 	   subsection != NULL;
 	   subsection = subsection->next)
 	{
-	  
+
 	  /* Skip any section which does not correspond to a space
 	     or subspace.  Or does not have SEC_ALLOC set (and therefore
 	     has no real bits on the disk).  */
@@ -3757,7 +3789,7 @@
 	  /* Mark the index of the current space within the subspace's
 	     dictionary record.  */
 	  som_section_data (subsection)->subspace_dict->space_index = i;
-	  
+
 	  /* Dump the current subspace header.  */
 	  if (bfd_write ((PTR) som_section_data (subsection)->subspace_dict,
 			 sizeof (struct subspace_dictionary_record), 1, abfd)
@@ -3765,7 +3797,7 @@
 	    return false;
 	}
       /* Goto the next section.  */
-      section = section->next; 
+      section = section->next;
     }
 
   /* Now repeat the process for unloadable subspaces.  */
@@ -3784,7 +3816,7 @@
 	   subsection != NULL;
 	   subsection = subsection->next)
 	{
-	  
+
 	  /* Skip any section which does not correspond to a space or
 	     subspace, or which SEC_ALLOC set (and therefore handled
 	     in the loadable spaces/subspaces code above).  */
@@ -3808,12 +3840,12 @@
 	  /* Increment the number of subspaces seen and the number of
 	     subspaces contained within the current space.  */
 	  som_section_data (section)->space_dict->subspace_quantity++;
-	  subspace_index++; 
+	  subspace_index++;
 
 	  /* Mark the index of the current space within the subspace's
 	     dictionary record.  */
 	  som_section_data (subsection)->subspace_dict->space_index = i;
-	  
+
 	  /* Dump this subspace header.  */
 	  if (bfd_write ((PTR) som_section_data (subsection)->subspace_dict,
 			 sizeof (struct subspace_dictionary_record), 1, abfd)
@@ -3821,7 +3853,7 @@
 	    return false;
 	}
       /* Goto the next section.  */
-      section = section->next; 
+      section = section->next;
     }
 
   /* All the subspace dictiondary records are written, and all the
@@ -3947,7 +3979,7 @@
 
 static void
 som_bfd_derive_misc_symbol_info (abfd, sym, info)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asymbol *sym;
      struct som_misc_symbol_info *info;
 {
@@ -3958,7 +3990,7 @@
      all symbols (including undefined symbols!).  Unfortunately,
      the type specified in an import/export statement does not
      always match what the linker wants.  Severe braindamage.  */
-	 
+
   /* Section symbols will not have a SOM symbol type assigned to
      them yet.  Assign all section symbols type ST_DATA.  */
   if (sym->flags & BSF_SECTION_SYM)
@@ -4008,7 +4040,7 @@
 	  else
 	    info->symbol_type = ST_DATA;
 	}
-  
+
       else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_UNKNOWN)
 	info->symbol_type = ST_DATA;
 
@@ -4028,13 +4060,14 @@
       else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_SEC_PROG)
 	info->symbol_type = ST_SEC_PROG;
     }
-	
+
   /* Now handle the symbol's scope.  Exported data which is not
      in the common section has scope SS_UNIVERSAL.  Note scope
      of common symbols was handled earlier!  */
   if (bfd_is_und_section (sym->section))
     info->symbol_scope = SS_UNSAT;
-  else if (sym->flags & BSF_EXPORT && ! bfd_is_com_section (sym->section))
+  else if (sym->flags & (BSF_EXPORT | BSF_WEAK)
+	   && ! bfd_is_com_section (sym->section))
     info->symbol_scope = SS_UNIVERSAL;
   /* Anything else which is not in the common section has scope
      SS_LOCAL.  */
@@ -4049,7 +4082,7 @@
       || bfd_is_und_section (sym->section)
       || bfd_is_abs_section (sym->section))
     info->symbol_info = 0;
-  /* For all other symbols, the symbol_info field contains the 
+  /* For all other symbols, the symbol_info field contains the
      subspace index of the space this symbol is contained in.  */
   else
     info->symbol_info = sym->section->target_index;
@@ -4091,8 +4124,8 @@
     {
       struct som_misc_symbol_info info;
 
-      /* This is really an index into the symbol strings table.  
-	 By the time we get here, the index has already been 
+      /* This is really an index into the symbol strings table.
+	 By the time we get here, the index has already been
 	 computed and stored into the name field in the BFD symbol.  */
       som_symtab[i].name.n_strx = som_symbol_data(bfd_syms[i])->stringtab_offset;
 
@@ -4126,7 +4159,7 @@
   return false;
 }
 
-/* Write an object in SOM format.  */  
+/* Write an object in SOM format.  */
 
 static boolean
 som_write_object_contents (abfd)
@@ -4176,12 +4209,12 @@
 
   if (bfd_seek (abfd, obj_som_str_filepos (abfd), SEEK_SET) < 0)
     return false;
-  
+
   if (bfd_read (stringtab, obj_som_stringtab_size (abfd), 1, abfd)
       != obj_som_stringtab_size (abfd))
     return false;
 
-  /* Save our results and return success. */
+  /* Save our results and return success.  */
   obj_som_stringtab (abfd) = stringtab;
   return true;
 }
@@ -4285,7 +4318,7 @@
     goto error_return;
   if (bfd_seek (abfd, obj_som_sym_filepos (abfd), SEEK_SET) < 0)
     goto error_return;
-  if (bfd_read (buf, symbol_count * symsize, 1, abfd) 
+  if (bfd_read (buf, symbol_count * symsize, 1, abfd)
       != symbol_count * symsize)
     goto error_return;
 
@@ -4350,7 +4383,6 @@
 	     undefined function symbols.  */
 	  if (bufp->symbol_scope == SS_UNSAT)
 	    sym->symbol.flags |= BSF_FUNCTION;
-	     
 
 	default:
 	  break;
@@ -4478,7 +4510,7 @@
 
 static void
 som_print_symbol (ignore_abfd, afile, symbol, how)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      PTR afile;
      asymbol *symbol;
      bfd_print_symbol_type how;
@@ -4507,7 +4539,7 @@
 
 static boolean
 som_bfd_is_local_label_name (abfd, name)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      const char *name;
 {
   return (name[0] == 'L' && name[1] == '$');
@@ -4522,7 +4554,7 @@
    variables rptr, section, and symbols have no meaning.
 
    Return the number of relocations requested by the fixup stream.  When
-   not just counting 
+   not just counting
 
    This needs at least two or three more passes to get it cleaned up.  */
 
@@ -4538,7 +4570,7 @@
   unsigned int op, varname, deallocate_contents = 0;
   unsigned char *end_fixups = &fixup[end];
   const struct fixup_format *fp;
-  char *cp;
+  const char *cp;
   unsigned char *save_fixup;
   int variables[26], stack[20], c, v, count, prev_fixup, *sp, saved_unwind_bits;
   const int *subop;
@@ -4605,7 +4637,7 @@
       cp = fp->format;
 
       /* Process the format string.  Parsing happens in two phases,
-	 parse RHS, then assign to LHS.  Repeat until no more 
+	 parse RHS, then assign to LHS.  Repeat until no more
 	 characters in the format string.  */
       while (*cp)
 	{
@@ -4799,7 +4831,7 @@
       else if (fixup > save_fixup + 1)
 	som_reloc_queue_insert (save_fixup, fixup - save_fixup, reloc_queue);
 
-      /* We do not pass R_DATA_OVERRIDE or R_NO_RELOCATION 
+      /* We do not pass R_DATA_OVERRIDE or R_NO_RELOCATION
 	 fixups to BFD.  */
       if (som_hppa_howto_table[op].type != R_DATA_OVERRIDE
 	  && som_hppa_howto_table[op].type != R_NO_RELOCATION)
@@ -4816,8 +4848,6 @@
 		;
 	      else if (som_hppa_howto_table[op].type == R_DATA_ONE_SYMBOL)
 		{
-		  unsigned addend = var ('V');
-
 		  /* Try what was specified in R_DATA_OVERRIDE first
 		     (if anything).  Then the hard way using the
 		     section contents.  */
@@ -4843,7 +4873,7 @@
 		    rptr->addend = bfd_get_32 (section->owner,
 					       (section->contents
 						+ offset - var ('L')));
-			
+
 		}
 	      else
 		rptr->addend = var ('V');
@@ -4867,9 +4897,9 @@
 #undef emptystack
 }
 
-/* Read in the relocs (aka fixups in SOM terms) for a section. 
+/* Read in the relocs (aka fixups in SOM terms) for a section.
 
-   som_get_reloc_upper_bound calls this routine with JUST_COUNT 
+   som_get_reloc_upper_bound calls this routine with JUST_COUNT
    set to true to indicate it only needs a count of the number
    of actual relocations.  */
 
@@ -4890,14 +4920,14 @@
   if (section->reloc_count == 0)
     return true;
 
-  /* If reloc_count is -1, then the relocation stream has not been 
+  /* If reloc_count is -1, then the relocation stream has not been
      parsed.  We must do so now to know how many relocations exist.  */
   if (section->reloc_count == -1)
     {
       external_relocs = (char *) bfd_malloc (fixup_stream_size);
       if (external_relocs == (char *) NULL)
 	return false;
-      /* Read in the external forms. */
+      /* Read in the external forms.  */
       if (bfd_seek (abfd,
 		    obj_som_reloc_filepos (abfd) + section->rel_filepos,
 		    SEEK_SET)
@@ -4927,7 +4957,7 @@
   if (section->relocation != (arelent *) NULL)
     return true;
 
-  internal_relocs = (arelent *) 
+  internal_relocs = (arelent *)
     bfd_zalloc (abfd, (num_relocs * sizeof (arelent)));
   if (internal_relocs == (arelent *) NULL)
     return false;
@@ -4946,7 +4976,7 @@
 }
 
 /* Return the number of bytes required to store the relocation
-   information associated with the given section.  */ 
+   information associated with the given section.  */
 
 static long
 som_get_reloc_upper_bound (abfd, asect)
@@ -5123,7 +5153,7 @@
   return true;
 }
 
-/* Set backend info for subsections which can not be described 
+/* Set backend info for subsections which can not be described
    in the BFD data structures.  */
 
 boolean
@@ -5260,8 +5290,8 @@
 {
   if (count == 0 || ((section->flags & SEC_HAS_CONTENTS) == 0))
     return true;
-  if ((bfd_size_type)(offset+count) > section->_raw_size
-      || bfd_seek (abfd, (file_ptr)(section->filepos + offset), SEEK_SET) == -1
+  if ((bfd_size_type) (offset+count) > section->_raw_size
+      || bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) == -1
       || bfd_read (location, (bfd_size_type)1, count, abfd) != count)
     return (false); /* on error */
   return (true);
@@ -5294,7 +5324,7 @@
 
   /* Seek to the proper offset within the object file and write the
      data.  */
-  offset += som_section_data (section)->subspace_dict->file_loc_init_value; 
+  offset += som_section_data (section)->subspace_dict->file_loc_init_value;
   if (bfd_seek (abfd, offset, SEEK_SET) == -1)
     return false;
 
@@ -5316,21 +5346,21 @@
 static boolean
 som_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
 			functionname_ptr, line_ptr)
-     bfd *abfd;
-     asection *section;
-     asymbol **symbols;
-     bfd_vma offset;
-     CONST char **filename_ptr;
-     CONST char **functionname_ptr;
-     unsigned int *line_ptr;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *section ATTRIBUTE_UNUSED;
+     asymbol **symbols ATTRIBUTE_UNUSED;
+     bfd_vma offset ATTRIBUTE_UNUSED;
+     CONST char **filename_ptr ATTRIBUTE_UNUSED;
+     CONST char **functionname_ptr ATTRIBUTE_UNUSED;
+     unsigned int *line_ptr ATTRIBUTE_UNUSED;
 {
   return (false);
 }
 
 static int
 som_sizeof_headers (abfd, reloc)
-     bfd *abfd;
-     boolean reloc;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     boolean reloc ATTRIBUTE_UNUSED;
 {
   (*_bfd_error_handler) (_("som_sizeof_headers unimplemented"));
   fflush (stderr);
@@ -5387,7 +5417,7 @@
 
 static void
 som_get_symbol_info (ignore_abfd, symbol, ret)
-     bfd *ignore_abfd;
+     bfd *ignore_abfd ATTRIBUTE_UNUSED;
      asymbol *symbol;
      symbol_info *ret;
 {
@@ -5412,7 +5442,7 @@
   unsigned int *hash_table = NULL;
   file_ptr lst_filepos = bfd_tell (abfd) - sizeof (struct lst_header);
 
-  hash_table = 
+  hash_table =
     (unsigned int *) bfd_malloc (lst_header->hash_size
 				 * sizeof (unsigned int));
   if (hash_table == NULL && lst_header->hash_size != 0)
@@ -5490,7 +5520,7 @@
   struct som_entry *som_dict = NULL;
   file_ptr lst_filepos = bfd_tell (abfd) - sizeof (struct lst_header);
 
-  hash_table = 
+  hash_table =
     (unsigned int *) bfd_malloc (lst_header->hash_size
 				 * sizeof (unsigned int));
   if (hash_table == NULL && lst_header->hash_size != 0)
@@ -5513,7 +5543,7 @@
   if (bfd_seek (abfd, lst_filepos + lst_header->dir_loc, SEEK_SET) < 0)
     goto error_return;
 
-  if (bfd_read ((PTR) som_dict, lst_header->module_count, 
+  if (bfd_read ((PTR) som_dict, lst_header->module_count,
 		sizeof (struct som_entry), abfd)
       != lst_header->module_count * sizeof (struct som_entry))
     goto error_return;
@@ -5578,7 +5608,7 @@
 	    goto error_return;
 
 	  /* Seek to the name length & string and read them in.  */
-	  if (bfd_seek (abfd, lst_filepos + lst_header->string_loc 
+	  if (bfd_seek (abfd, lst_filepos + lst_header->string_loc
 				+ lst_symbol.name.n_strx - 4, SEEK_SET) < 0)
 	    goto error_return;
 
@@ -5603,7 +5633,7 @@
 	  set++;
 	}
     }
-  /* If we haven't died by now, then we successfully read the entire 
+  /* If we haven't died by now, then we successfully read the entire
      archive symbol table.  */
   if (hash_table != NULL)
     free (hash_table);
@@ -5689,7 +5719,7 @@
     return false;
 
   /* Get back to the start of the library symbol table.  */
-  if (bfd_seek (abfd, ardata->first_file_filepos - parsed_size 
+  if (bfd_seek (abfd, ardata->first_file_filepos - parsed_size
 			+ sizeof (struct lst_header), SEEK_SET) < 0)
     return false;
 
@@ -5810,7 +5840,7 @@
 
 /* Do the bulk of the work required to write the SOM library
    symbol table.  */
-   
+
 static boolean
 som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst, elength)
      bfd *abfd;
@@ -5850,7 +5880,7 @@
   /* Some initialization.  */
   memset (hash_table, 0, 4 * lst.hash_size);
   memset (som_dict, 0, lst.module_count * sizeof (struct som_entry));
-  memset (last_hash_entry, 0, 	
+  memset (last_hash_entry, 0,
 	  lst.hash_size * sizeof (struct lst_symbol_record *));
 
   /* Symbols have som_index fields, so we have to keep track of the
@@ -5876,7 +5906,7 @@
   /* Make sure we're properly aligned.  */
   curr_som_offset = (curr_som_offset + 0x1) & ~0x1;
 
-  /* FIXME should be done with buffers just like everything else... */
+  /* FIXME should be done with buffers just like everything else...  */
   lst_syms = bfd_malloc (nsyms * sizeof (struct lst_symbol_record));
   if (lst_syms == NULL && nsyms != 0)
     goto error_return;
@@ -5973,7 +6003,7 @@
 	      tmp = last_hash_entry[curr_lst_sym->symbol_key % lst.hash_size];
 	      tmp->next_entry
 		= (curr_lst_sym - lst_syms) * sizeof (struct lst_symbol_record)
-		  + lst.hash_size * 4 
+		  + lst.hash_size * 4
 		  + lst.module_count * sizeof (struct som_entry)
 		  + sizeof (struct lst_header);
 	    }
@@ -5982,7 +6012,7 @@
 	      /* First entry in this hash chain.  */
 	      hash_table[curr_lst_sym->symbol_key % lst.hash_size]
 		= (curr_lst_sym - lst_syms) * sizeof (struct lst_symbol_record)
-		  + lst.hash_size * 4 
+		  + lst.hash_size * 4
 		  + lst.module_count * sizeof (struct som_entry)
 		  + sizeof (struct lst_header);
 	    }
@@ -5992,7 +6022,6 @@
 	  last_hash_entry[curr_lst_sym->symbol_key % lst.hash_size]
 	    = curr_lst_sym;
 
-
 	  /* Update the string table.  */
 	  bfd_put_32 (abfd, strlen (sym->symbol.name), p);
 	  p += 4;
@@ -6011,7 +6040,7 @@
       /* Keep track of where each SOM will finally reside; then look
 	 at the next BFD.  */
       curr_som_offset += arelt_size (curr_bfd) + sizeof (struct ar_hdr);
- 
+
       /* A particular object in the archive may have an odd length; the
 	 linker requires objects begin on an even boundary.  So round
 	 up the current offset as necessary.  */
@@ -6076,9 +6105,9 @@
 som_write_armap (abfd, elength, map, orl_count, stridx)
      bfd *abfd;
      unsigned int elength;
-     struct orl *map;
-     unsigned int orl_count;
-     int stridx;
+     struct orl *map ATTRIBUTE_UNUSED;
+     unsigned int orl_count ATTRIBUTE_UNUSED;
+     int stridx ATTRIBUTE_UNUSED;
 {
   bfd *curr_bfd;
   struct stat statbuf;
@@ -6086,7 +6115,7 @@
   struct ar_hdr hdr;
   struct lst_header lst;
   int *p;
- 
+
   /* We'll use this for the archive's date and mode later.  */
   if (stat (abfd->filename, &statbuf) != 0)
     {
@@ -6191,7 +6220,7 @@
   if (som_bfd_ar_write_symbol_stuff (abfd, nsyms, stringsize, lst, elength)
       == false)
     return false;
-  
+
   /* Done.  */
   return true;
 }
@@ -6225,12 +6254,12 @@
   return true;
 }
 
-/* End of miscellaneous support functions. */
+/* End of miscellaneous support functions.  */
 
 /* Linker support functions.  */
 static boolean
 som_bfd_link_split_section (abfd, sec)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
 {
   return (som_is_subspace (sec) && sec->_raw_size > 240000);
@@ -6265,7 +6294,6 @@
 
 #define som_bfd_gc_sections		bfd_generic_gc_sections
 
-
 const bfd_target som_vec =
 {
   "som",			/* name */
@@ -6319,7 +6347,7 @@
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   NULL,
-  
+
   (PTR) 0
 };
 
diff --git a/bfd/som.h b/bfd/som.h
index af37804..eedef8c 100644
--- a/bfd/som.h
+++ b/bfd/som.h
@@ -46,8 +46,8 @@
 #define _PA_RISC_ID(__m_num) 1
 #endif /* HOST_HPPABSD */
 
-#define FILE_HDR_SIZE sizeof(struct header)
-#define AUX_HDR_SIZE sizeof(struct som_exec_auxhdr)
+#define FILE_HDR_SIZE sizeof (struct header)
+#define AUX_HDR_SIZE sizeof (struct som_exec_auxhdr)
 
 typedef struct som_symbol
   {
@@ -77,7 +77,7 @@
     int reloc_count;
 
     /* During object file writing, the offset of the name of this symbol
-       in the SOM string table. */
+       in the SOM string table.  */
     int stringtab_offset;
   }
 som_symbol_type;
@@ -159,7 +159,7 @@
     int space_number;
 
     /* Add more stuff here as needed.  Good examples of information
-       we might want to pass would be initialization pointers, 
+       we might want to pass would be initialization pointers,
        and the many subspace flags we do not represent yet.  */
   };
 
@@ -167,7 +167,7 @@
 
    reloc_size holds the size of the relocation stream, note this
    is very different from the number of relocations as SOM relocations
-   are variable length. 
+   are variable length.
 
    reloc_stream is the actual stream of relocation entries.  */
 
@@ -198,14 +198,13 @@
   ((struct som_section_data_struct *)sec->used_by_bfd)
 #define som_symbol_data(symbol)		((som_symbol_type *) symbol)
 
-
 /* Defines groups of basic relocations.  FIXME:  These should
    be the only basic relocations created by GAS.  The rest
    should be internal to the BFD backend.
 
    The idea is both SOM and ELF define these basic relocation
    types so they map into a SOM or ELF specific reloation as
-   appropriate.  This allows GAS to share much more code 
+   appropriate.  This allows GAS to share much more code
    between the two object formats.  */
 
 #define R_HPPA_NONE			R_NO_RELOCATION
diff --git a/bfd/sparclinux.c b/bfd/sparclinux.c
index 73a29b3..57bf6c6 100644
--- a/bfd/sparclinux.c
+++ b/bfd/sparclinux.c
@@ -95,7 +95,7 @@
 #define IS_GOT_SYM(name) \
   (strncmp (name, GOT_REF_PREFIX, sizeof GOT_REF_PREFIX - 1) == 0)
 
-/* See if a symbol name is a reference to the procedure linkage table. */
+/* See if a symbol name is a reference to the procedure linkage table.  */
 
 #ifndef PLT_REF_PREFIX
 #define        PLT_REF_PREFIX  "__PLT_"
@@ -478,7 +478,7 @@
                                   (h->root.root.root.string
                                    + sizeof PLT_REF_PREFIX - 1),
                                   false, false, true);
-      /* h2 does not follow indirect symbols. */
+      /* h2 does not follow indirect symbols.  */
       h2 = linux_link_hash_lookup (linux_hash_table (info),
                                   (h->root.root.root.string
                                    + sizeof PLT_REF_PREFIX - 1),
@@ -535,7 +535,7 @@
        }
 
       /* Quick and dirty way of stripping these symbols from the
-        symtab. */
+        symtab.  */
       if (bfd_is_abs_section (h->root.root.u.def.section))
        h->root.written = true;
     }
@@ -560,7 +560,7 @@
   if (output_bfd->xvec != &MY(vec))
     return true;
 
-  /* First find the fixups... */
+  /* First find the fixups...  */
   linux_link_hash_traverse (linux_hash_table (info),
                            linux_tally_symbols,
                            (PTR) info);
diff --git a/bfd/sparclynx.c b/bfd/sparclynx.c
index dbfcae5..92454dc 100644
--- a/bfd/sparclynx.c
+++ b/bfd/sparclynx.c
@@ -46,7 +46,7 @@
 /* This is needed to reject a NewsOS file, e.g. in
    gdb/testsuite/gdb.t10/crossload.exp. <kingdon@cygnus.com>
    I needed to add M_UNKNOWN to recognize a 68000 object, so this will
-   probably no longer reject a NewsOS object.  <ian@cygnus.com>. */
+   probably no longer reject a NewsOS object.  <ian@cygnus.com>.  */
 #define MACHTYPE_OK(mtype) ((mtype) == M_UNKNOWN \
 			    || (mtype) == M_68010 \
 			    || (mtype) == M_68020 \
@@ -90,7 +90,7 @@
 
     case M_UNKNOWN:
       /* Some Sun3s make magic numbers without cpu types in them, so
-	 we'll default to the 68000. */
+	 we'll default to the 68000.  */
       arch = bfd_arch_m68k;
       machine = bfd_mach_m68000;
       break;
@@ -137,7 +137,7 @@
 }
 
 #define SET_ARCH_MACH(ABFD, EXEC) \
-  NAME(lynx,set_arch_mach)(ABFD, N_MACHTYPE (EXEC)); \
+  NAME(lynx,set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \
   choose_reloc_size(ABFD);
 
 /* Determine the size of a relocation entry, based on the architecture */
diff --git a/bfd/sparcnetbsd.c b/bfd/sparcnetbsd.c
index 4277bb8..c21f063 100644
--- a/bfd/sparcnetbsd.c
+++ b/bfd/sparcnetbsd.c
@@ -21,7 +21,7 @@
 #define TARGET_IS_BIG_ENDIAN_P
 
 /* SPARC chips use either 4K or 8K pages, but object files always
-   assume 8K page alignment so they will work on either one. */
+   assume 8K page alignment so they will work on either one.  */
 #define TARGET_PAGE_SIZE 0x2000
 
 #define DEFAULT_ARCH	bfd_arch_sparc
diff --git a/bfd/srec.c b/bfd/srec.c
index 31f69b0..5602239 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -1,5 +1,5 @@
 /* BFD back-end for s-record objects.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
 
@@ -24,7 +24,7 @@
 	S-Record handling
 
 DESCRIPTION
-	
+
 	Ordinary S-Records cannot hold anything but addresses and
 	data, so that's all that we implement.
 
@@ -42,10 +42,10 @@
 	up and output them when it's time to close the bfd.
 
 	An s record looks like:
-	
+
 EXAMPLE
 	S<type><length><address><data><checksum>
-	
+
 DESCRIPTION
 	Where
 	o length
@@ -61,7 +61,7 @@
 	7) four byte address termination record
 	8) three byte address termination record
 	9) two byte address termination record
-	
+
 	o address
 	is the start address of the data following, or in the case of
 	a termination record, the start address of the image
@@ -71,7 +71,6 @@
 	is the sum of all the raw byte data in the record, from the length
 	upwards, modulo 256 and subtracted from 255.
 
-
 SUBSECTION
 	Symbol S-Record handling
 
@@ -101,7 +100,7 @@
 DESCRIPTION
 	We allow symbols to be anywhere in the data stream - the module names
 	are always ignored.
-		
+
 */
 
 #include "bfd.h"
@@ -142,7 +141,7 @@
 static long srec_get_symtab_upper_bound PARAMS ((bfd *));
 static long srec_get_symtab PARAMS ((bfd *, asymbol **));
 
-/* Macros for converting between hex and binary. */
+/* Macros for converting between hex and binary.  */
 
 static CONST char digs[] = "0123456789ABCDEF";
 
@@ -154,7 +153,7 @@
 	ch += ((x) & 0xff);
 #define	ISHEX(x)  hex_p(x)
 
-/* Initialize by filling in the hex conversion array. */
+/* Initialize by filling in the hex conversion array.  */
 
 static void
 srec_init ()
@@ -168,10 +167,21 @@
     }
 }
 
-/* The maximum number of bytes on a line is FF */
+/* The maximum number of bytes on a line is FF.  */
 #define MAXCHUNK 0xff
-/* The number of bytes we fit onto a line on output */
-#define CHUNK 16
+
+/* Default size for a CHUNK.  */
+#define DEFAULT_CHUNK 16
+
+/* The number of bytes we actually fit onto a line on output.
+   This variable can be modified by objcopy's --srec-len parameter.
+   For a 0x75 byte record you should set --srec-len=0x70.  */
+unsigned int Chunk = DEFAULT_CHUNK;
+
+/* The type of srec output (free or forced to S3).
+   This variable can be modified by objcopy's --srec-forceS3
+   parameter.  */
+boolean S3Forced = 0;
 
 /* When writing an S-record file, the S-records can not be output as
    they are seen.  This structure is used to hold them in memory.  */
@@ -467,7 +477,8 @@
 	      if (! srec_new_symbol (abfd, symname, symval))
 		goto error_return;
 	    }
-	  while (c == ' ' || c == '\t');
+	  while (c == ' ' || c == '\t')
+	    ;
 
 	  if (c == '\n')
 	    ++lineno;
@@ -478,7 +489,7 @@
 	    }
 
 	  break;
-    
+
 	case 'S':
 	  {
 	    file_ptr pos;
@@ -839,7 +850,7 @@
   return bfd_default_set_arch_mach (abfd, arch, mach);
 }
 
-/* we have to save up all the Srecords for a splurge before output */
+/* We have to save up all the Srecords for a splurge before output.  */
 
 static boolean
 srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
@@ -866,19 +877,17 @@
 	return false;
       memcpy ((PTR) data, location, (size_t) bytes_to_do);
 
-      if ((section->lma + offset + bytes_to_do - 1) <= 0xffff)
-	{
-
-	}
+      /* Ff S3Forced is true then always select S3 records,
+	 regardless of the siez of the addresses.  */
+      if (S3Forced)
+	tdata->type = 3;
+      else if ((section->lma + offset + bytes_to_do - 1) <= 0xffff)
+	;  /* The default, S1, is OK.  */
       else if ((section->lma + offset + bytes_to_do - 1) <= 0xffffff
 	       && tdata->type <= 2)
-	{
-	  tdata->type = 2;
-	}
+	tdata->type = 2;
       else
-	{
-	  tdata->type = 3;
-	}
+	tdata->type = 3;
 
       entry->data = data;
       entry->where = section->lma + offset;
@@ -912,8 +921,8 @@
 
 /* Write a record of type, of the supplied number of bytes. The
    supplied bytes and length don't have a checksum. That's worked out
-   here
-*/
+   here.  */
+
 static boolean
 srec_write_record (abfd, type, address, data, end)
      bfd *abfd;
@@ -933,7 +942,7 @@
   *dst++ = '0' + type;
 
   length = dst;
-  dst += 2;			/* leave room for dst*/
+  dst += 2;			/* Leave room for dst.  */
 
   switch (type)
     {
@@ -961,7 +970,7 @@
       dst += 2;
     }
 
-  /* Fill in the length */
+  /* Fill in the length.  */
   TOHEX (length, (dst - length) / 2, check_sum);
   check_sum &= 0xff;
   check_sum = 255 - check_sum;
@@ -976,8 +985,6 @@
   return true;
 }
 
-
-
 static boolean
 srec_write_header (abfd)
      bfd *abfd;
@@ -986,11 +993,10 @@
   bfd_byte *dst = buffer;
   unsigned int i;
 
-  /* I'll put an arbitary 40 char limit on header size */
+  /* I'll put an arbitary 40 char limit on header size.  */
   for (i = 0; i < 40 && abfd->filename[i]; i++)
-    {
-      *dst++ = abfd->filename[i];
-    }
+    *dst++ = abfd->filename[i];
+
   return srec_write_record (abfd, 0, 0, buffer, dst);
 }
 
@@ -1008,8 +1014,8 @@
       bfd_vma address;
       unsigned int octets_this_chunk = list->size - octets_written;
 
-      if (octets_this_chunk > CHUNK)
-	octets_this_chunk = CHUNK;
+      if (octets_this_chunk > Chunk)
+	octets_this_chunk = Chunk;
 
       address = list->where + octets_written / bfd_octets_per_byte (abfd);
 
@@ -1038,14 +1044,12 @@
 			    abfd->start_address, buffer, buffer);
 }
 
-
-
 static boolean
 srec_write_symbols (abfd)
      bfd *abfd;
 {
   char buffer[MAXCHUNK];
-  /* Dump out the symbols of a bfd */
+  /* Dump out the symbols of a bfd.  */
   int i;
   int count = bfd_get_symcount (abfd);
 
@@ -1065,7 +1069,7 @@
 	  if (! bfd_is_local_label (abfd, s)
 	      && (s->flags & BSF_DEBUGGING) == 0)
 	    {
-	      /* Just dump out non debug symbols */
+	      /* Just dump out non debug symbols.  */
 	      bfd_size_type l;
 	      char buf2[40], *p;
 
@@ -1107,7 +1111,7 @@
   if (! srec_write_header (abfd))
     return false;
 
-  /* Now wander though all the sections provided and output them */
+  /* Now wander though all the sections provided and output them.  */
   list = tdata->head;
 
   while (list != (srec_data_list_type *) NULL)
@@ -1133,7 +1137,6 @@
   return internal_srec_write_object_contents (abfd, 1);
 }
 
-/*ARGSUSED*/
 static int
 srec_sizeof_headers (abfd, exec)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -1195,7 +1198,7 @@
 	  c->udata.p = NULL;
 	}
     }
-	
+
   for (i = 0; i < symcount; i++)
     *alocation++ = csymbols++;
   *alocation = NULL;
@@ -1203,7 +1206,6 @@
   return symcount;
 }
 
-/*ARGSUSED*/
 static void
 srec_get_symbol_info (ignore_abfd, symbol, ret)
      bfd *ignore_abfd ATTRIBUTE_UNUSED;
@@ -1213,7 +1215,6 @@
   bfd_symbol_info (symbol, ret);
 }
 
-/*ARGSUSED*/
 static void
 srec_print_symbol (ignore_abfd, afile, symbol, how)
      bfd *ignore_abfd ATTRIBUTE_UNUSED;
@@ -1316,12 +1317,10 @@
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   NULL,
-  
+
   (PTR) 0
 };
 
-
-
 const bfd_target symbolsrec_vec =
 {
   "symbolsrec",			/* name */
@@ -1373,6 +1372,6 @@
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   NULL,
-  
+
   (PTR) 0
 };
diff --git a/bfd/stab-syms.c b/bfd/stab-syms.c
index f4fe6c8..4b0827f 100644
--- a/bfd/stab-syms.c
+++ b/bfd/stab-syms.c
@@ -20,7 +20,7 @@
 
 #include "bfd.h"
 
-#define ARCH_SIZE 32		/* Value doesn't matter. */
+#define ARCH_SIZE 32		/* Value doesn't matter.  */
 #include "libaout.h"
 #include "aout/aout64.h"
 
@@ -32,13 +32,13 @@
 /* These are not really stab symbols, but it is
    convenient to have them here for the sake of nm.
    For completeness, we could also add N_TEXT etc, but those
-   are never needed, since nm treats those specially. */
+   are never needed, since nm treats those specially.  */
 #define EXTRA_SYMBOLS \
   __define_name (N_SETA, "SETA")/* Absolute set element symbol */ \
   __define_name (N_SETT, "SETT")/* Text set element symbol */ \
   __define_name (N_SETD, "SETD")/* Data set element symbol */ \
   __define_name (N_SETB, "SETB")/* Bss set element symbol */ \
-  __define_name (N_SETV, "SETV")/* Pointer to set vector in data area. */ \
+  __define_name (N_SETV, "SETV")/* Pointer to set vector in data area.  */ \
   __define_name (N_INDR, "INDR") \
   __define_name (N_WARNING, "WARNING")
 
diff --git a/bfd/stabs.c b/bfd/stabs.c
index e9ac167..eb9ce8a 100644
--- a/bfd/stabs.c
+++ b/bfd/stabs.c
@@ -108,7 +108,7 @@
      as the input offsets, because no stabs have been deleted from
      this section.  Otherwise the i'th entry is the number of
      bytes of stabs that have been deleted prior to the i'th
-     stab. */
+     stab.  */
   bfd_size_type *cumulative_skips;
 
   /* This is an array of string indices.  For each stab symbol, we
@@ -464,7 +464,7 @@
   sinfo->stabstr->_cooked_size = _bfd_stringtab_size (sinfo->strings);
 
   /* Calculate the `cumulative_skips' array now that stabs have been
-     deleted for this section. */
+     deleted for this section.  */
 
   if (skip != 0)
     {
diff --git a/bfd/sunos.c b/bfd/sunos.c
index ada6857..53372be 100644
--- a/bfd/sunos.c
+++ b/bfd/sunos.c
@@ -508,7 +508,7 @@
 					    * sizeof (arelent))));
       if (info->canonical_dynrel == NULL && info->dynrel_count != 0)
 	return -1;
-      
+
       to = info->canonical_dynrel;
 
       if (obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE)
@@ -1421,7 +1421,7 @@
       s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
       if (s->contents == NULL && s->_raw_size != 0)
 	return false;
-      
+
       /* The number of buckets is just the number of symbols divided
 	 by four.  To compute the final size of the hash table, we
 	 must actually compute the hash table.  Normally we need
@@ -2274,16 +2274,16 @@
 	      PUT_WORD (output_bfd, r_address, srel->r_address);
 	      if (bfd_header_big_endian (output_bfd))
 		{
-		  srel->r_index[0] = (bfd_byte)(h->dynindx >> 16);
-		  srel->r_index[1] = (bfd_byte)(h->dynindx >> 8);
-		  srel->r_index[2] = (bfd_byte)(h->dynindx);
+		  srel->r_index[0] = (bfd_byte) (h->dynindx >> 16);
+		  srel->r_index[1] = (bfd_byte) (h->dynindx >> 8);
+		  srel->r_index[2] = (bfd_byte) (h->dynindx);
 		  srel->r_type[0] = (RELOC_STD_BITS_EXTERN_BIG
 				     | RELOC_STD_BITS_JMPTABLE_BIG);
 		}
 	      else
 		{
-		  srel->r_index[2] = (bfd_byte)(h->dynindx >> 16);
-		  srel->r_index[1] = (bfd_byte)(h->dynindx >> 8);
+		  srel->r_index[2] = (bfd_byte) (h->dynindx >> 16);
+		  srel->r_index[1] = (bfd_byte) (h->dynindx >> 8);
 		  srel->r_index[0] = (bfd_byte)h->dynindx;
 		  srel->r_type[0] = (RELOC_STD_BITS_EXTERN_LITTLE
 				     | RELOC_STD_BITS_JMPTABLE_LITTLE);
@@ -2297,8 +2297,8 @@
 	      PUT_WORD (output_bfd, r_address, erel->r_address);
 	      if (bfd_header_big_endian (output_bfd))
 		{
-		  erel->r_index[0] = (bfd_byte)(h->dynindx >> 16);
-		  erel->r_index[1] = (bfd_byte)(h->dynindx >> 8);
+		  erel->r_index[0] = (bfd_byte) (h->dynindx >> 16);
+		  erel->r_index[1] = (bfd_byte) (h->dynindx >> 8);
 		  erel->r_index[2] = (bfd_byte)h->dynindx;
 		  erel->r_type[0] =
 		    (RELOC_EXT_BITS_EXTERN_BIG
@@ -2306,8 +2306,8 @@
 		}
 	      else
 		{
-		  erel->r_index[2] = (bfd_byte)(h->dynindx >> 16);
-		  erel->r_index[1] = (bfd_byte)(h->dynindx >> 8);
+		  erel->r_index[2] = (bfd_byte) (h->dynindx >> 16);
+		  erel->r_index[1] = (bfd_byte) (h->dynindx >> 8);
 		  erel->r_index[0] = (bfd_byte)h->dynindx;
 		  erel->r_type[0] =
 		    (RELOC_EXT_BITS_EXTERN_LITTLE
@@ -2594,8 +2594,8 @@
 			    srel->r_address);
 		  if (bfd_header_big_endian (dynobj))
 		    {
-		      srel->r_index[0] = (bfd_byte)(indx >> 16);
-		      srel->r_index[1] = (bfd_byte)(indx >> 8);
+		      srel->r_index[0] = (bfd_byte) (indx >> 16);
+		      srel->r_index[1] = (bfd_byte) (indx >> 8);
 		      srel->r_index[2] = (bfd_byte)indx;
 		      if (h == NULL)
 			srel->r_type[0] = 2 << RELOC_STD_BITS_LENGTH_SH_BIG;
@@ -2608,8 +2608,8 @@
 		    }
 		  else
 		    {
-		      srel->r_index[2] = (bfd_byte)(indx >> 16);
-		      srel->r_index[1] = (bfd_byte)(indx >> 8);
+		      srel->r_index[2] = (bfd_byte) (indx >> 16);
+		      srel->r_index[1] = (bfd_byte) (indx >> 8);
 		      srel->r_index[0] = (bfd_byte)indx;
 		      if (h == NULL)
 			srel->r_type[0] = 2 << RELOC_STD_BITS_LENGTH_SH_LITTLE;
@@ -2633,8 +2633,8 @@
 			    erel->r_address);
 		  if (bfd_header_big_endian (dynobj))
 		    {
-		      erel->r_index[0] = (bfd_byte)(indx >> 16);
-		      erel->r_index[1] = (bfd_byte)(indx >> 8);
+		      erel->r_index[0] = (bfd_byte) (indx >> 16);
+		      erel->r_index[1] = (bfd_byte) (indx >> 8);
 		      erel->r_index[2] = (bfd_byte)indx;
 		      if (h == NULL)
 			erel->r_type[0] =
@@ -2646,8 +2646,8 @@
 		    }
 		  else
 		    {
-		      erel->r_index[2] = (bfd_byte)(indx >> 16);
-		      erel->r_index[1] = (bfd_byte)(indx >> 8);
+		      erel->r_index[2] = (bfd_byte) (indx >> 16);
+		      erel->r_index[1] = (bfd_byte) (indx >> 8);
 		      erel->r_index[0] = (bfd_byte)indx;
 		      if (h == NULL)
 			erel->r_type[0] =
@@ -2726,14 +2726,14 @@
 		srel->r_address);
       if (bfd_header_big_endian (dynobj))
 	{
-	  srel->r_index[0] = (bfd_byte)(indx >> 16);
-	  srel->r_index[1] = (bfd_byte)(indx >> 8);
+	  srel->r_index[0] = (bfd_byte) (indx >> 16);
+	  srel->r_index[1] = (bfd_byte) (indx >> 8);
 	  srel->r_index[2] = (bfd_byte)indx;
 	}
       else
 	{
-	  srel->r_index[2] = (bfd_byte)(indx >> 16);
-	  srel->r_index[1] = (bfd_byte)(indx >> 8);
+	  srel->r_index[2] = (bfd_byte) (indx >> 16);
+	  srel->r_index[1] = (bfd_byte) (indx >> 8);
 	  srel->r_index[0] = (bfd_byte)indx;
 	}
       /* FIXME: We may have to change the addend for a PC relative
@@ -2751,14 +2751,14 @@
 		erel->r_address);
       if (bfd_header_big_endian (dynobj))
 	{
-	  erel->r_index[0] = (bfd_byte)(indx >> 16);
-	  erel->r_index[1] = (bfd_byte)(indx >> 8);
+	  erel->r_index[0] = (bfd_byte) (indx >> 16);
+	  erel->r_index[1] = (bfd_byte) (indx >> 8);
 	  erel->r_index[2] = (bfd_byte)indx;
 	}
       else
 	{
-	  erel->r_index[2] = (bfd_byte)(indx >> 16);
-	  erel->r_index[1] = (bfd_byte)(indx >> 8);
+	  erel->r_index[2] = (bfd_byte) (indx >> 16);
+	  erel->r_index[1] = (bfd_byte) (indx >> 8);
 	  erel->r_index[0] = (bfd_byte)indx;
 	}
       if (pcrel && h != NULL)
@@ -2933,7 +2933,7 @@
       PUT_WORD (dynobj,
 		BFD_ALIGN (obj_textsec (abfd)->_raw_size, 0x2000),
 		esdl.ld_text);
-  
+
       if (! bfd_set_section_contents (abfd, sdyn->output_section, &esdl,
 				      (sdyn->output_offset
 				       + sizeof esd
diff --git a/bfd/syms.c b/bfd/syms.c
index 6546f58..8f4c92f 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -1,5 +1,5 @@
 /* Generic symbol-table support for the BFD library.
-   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -91,7 +91,6 @@
 	All storage for the symbols themselves is in an objalloc
 	connected to the BFD; it is freed when the BFD is closed.
 
-
 INODE
 Writing Symbols, Mini Symbols, Reading Symbols, Symbols
 SUBSECTION
@@ -163,8 +162,6 @@
 
 */
 
-
-
 /*
 DOCDD
 INODE
@@ -390,14 +387,12 @@
 	Return the actual number of symbol pointers, not
 	including the NULL.
 
-
 .#define bfd_canonicalize_symtab(abfd, location) \
 .     BFD_SEND (abfd, _bfd_canonicalize_symtab,\
 .                  (abfd, location))
 
 */
 
-
 /*
 FUNCTION
 	bfd_set_symtab
@@ -474,7 +469,6 @@
 	       : ((type & BSF_OBJECT) ? 'O' : ' '))));
 }
 
-
 /*
 FUNCTION
 	bfd_make_empty_symbol
@@ -537,7 +531,7 @@
 };
 
 /* Return the single-character symbol type corresponding to
-   section S, or '?' for an unknown COFF section.  
+   section S, or '?' for an unknown COFF section.
 
    Check for any leading string which matches, so .text5 returns
    't' as well as .text */
@@ -548,7 +542,7 @@
 {
   CONST struct section_to_type *t;
 
-  for (t = &stt[0]; t->section; t++) 
+  for (t = &stt[0]; t->section; t++)
     if (!strncmp (s, t->section, strlen (t->section)))
       return t->type;
 
@@ -631,7 +625,7 @@
 
 /*
 FUNCTION
-	bfd_is_undefined_symclass 
+	bfd_is_undefined_symclass
 
 DESCRIPTION
 	Returns non-zero if the class symbol returned by
@@ -668,12 +662,12 @@
      symbol_info *ret;
 {
   ret->type = bfd_decode_symclass (symbol);
-  
+
   if (bfd_is_undefined_symclass (ret->type))
     ret->value = 0;
   else
     ret->value = symbol->value + symbol->section->vma;
-  
+
   ret->name = symbol->name;
 }
 
@@ -788,8 +782,8 @@
 
 static int
 cmpindexentry (a, b)
-     const PTR *a;
-     const PTR *b;
+     const PTR a;
+     const PTR b;
 {
   const struct indexentry *contestantA = (const struct indexentry *) a;
   const struct indexentry *contestantB = (const struct indexentry *) b;
@@ -1005,7 +999,7 @@
 	      if (bfd_get_32 (abfd, stab + STRDXOFF) == 0)
 		continue;
 
-	      /* if we did not see a function def, leave space for one. */
+	      /* if we did not see a function def, leave space for one.  */
 	      if (saw_fun == 0)
 		++info->indextablesize;
 
@@ -1027,7 +1021,7 @@
 
       if (saw_fun == 0)
 	++info->indextablesize;
-      
+
       if (info->indextablesize == 0)
 	return true;
       ++info->indextablesize;
@@ -1063,8 +1057,8 @@
 	      /* The following code creates a new indextable entry with
 	         a NULL function name if there were no N_FUNs in a file.
 	         Note that a N_SO without a file name is an EOF and
-	         there could be 2 N_SO following it with the new filename 
-	         and directory. */
+	         there could be 2 N_SO following it with the new filename
+	         and directory.  */
 	      if (saw_fun == 0)
 		{
 		  info->indextable[i].val = bfd_get_32 (abfd, last_stab + VALOFF);
@@ -1076,7 +1070,7 @@
 		  ++i;
 		}
 	      saw_fun = 0;
-	      
+
 	      file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
 	      if (*file_name == '\0')
 		{
@@ -1262,7 +1256,7 @@
 
   *pfound = true;
 
-  if (file_name[0] == '/' || directory_name == NULL)
+  if (IS_ABSOLUTE_PATH(file_name) || directory_name == NULL)
     *pfilename = file_name;
   else
     {
diff --git a/bfd/sysdep.h b/bfd/sysdep.h
index bf3eac0..e344eaf 100644
--- a/bfd/sysdep.h
+++ b/bfd/sysdep.h
@@ -127,7 +127,7 @@
 #ifdef ENABLE_NLS
 #include <libintl.h>
 /* Note the use of dgetext() and PACKAGE here, rather than gettext().
-   
+
    This is because the code in this directory is used to build a library which
    will be linked with code in other directories to form programs.  We want to
    maintain a seperate translation file for this directory however, rather
diff --git a/bfd/targets.c b/bfd/targets.c
index 1421552..589ba23 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -25,7 +25,7 @@
 #include "fnmatch.h"
 
 /*
-SECTION 
+SECTION
 	Targets
 
 DESCRIPTION
@@ -34,7 +34,7 @@
 	part of BFD is a structure containing pointers to functions
 	which perform certain low level operations on files. BFD
 	translates the applications's requests through a pointer into
-	calls to the back end routines. 
+	calls to the back end routines.
 
 	When a file is opened with <<bfd_openr>>, its format and
 	target are unknown. BFD uses various mechanisms to determine
@@ -42,11 +42,11 @@
 
 	o Create a BFD by calling the internal routine
 	<<_bfd_new_bfd>>, then call <<bfd_find_target>> with the
-	target string supplied to <<bfd_openr>> and the new BFD pointer. 
+	target string supplied to <<bfd_openr>> and the new BFD pointer.
 
 	o If a null target string was provided to <<bfd_find_target>>,
 	look up the environment variable <<GNUTARGET>> and use
-	that as the target string. 
+	that as the target string.
 
 	o If the target string is still <<NULL>>, or the target string is
 	<<default>>, then use the first item in the target vector
@@ -56,7 +56,7 @@
 
 	o Otherwise, inspect the elements in the target vector
 	one by one, until a match on target name is found. When found,
-	use it. 
+	use it.
 
 	o Otherwise return the error <<bfd_error_invalid_target>> to
 	<<bfd_openr>>.
@@ -66,7 +66,7 @@
 
 	Once the BFD has been opened and the target selected, the file
 	format may be determined. This is done by calling
-	<<bfd_check_format>> on the BFD with a suggested format. 
+	<<bfd_check_format>> on the BFD with a suggested format.
 	If <<target_defaulted>> has been set, each possible target
 	type is tried to see if it recognizes the specified format.
 	<<bfd_check_format>> returns <<true>> when the caller guesses right.
@@ -75,7 +75,6 @@
 @end menu
 */
 
-
 /*
 
 INODE
@@ -87,17 +86,17 @@
 DESCRIPTION
 	This structure contains everything that BFD knows about a
 	target. It includes things like its byte order, name, and which
-	routines to call to do various operations.   
+	routines to call to do various operations.
 
 	Every BFD points to a target structure with its <<xvec>>
-	member. 
+	member.
 
 	The macros below are used to dispatch to functions through the
 	<<bfd_target>> vector. They are used in a number of macros further
 	down in @file{bfd.h}, and are also used when calling various
 	routines by hand inside the BFD implementation.  The @var{arglist}
 	argument must be parenthesized; it contains all the arguments
-	to the called function. 
+	to the called function.
 
 	They make the documentation (more) unpleasant to read, so if
 	someone wants to fix this and not break the above, please do.
@@ -116,13 +115,13 @@
 	For operations which index on the BFD format:
 
 .#define BFD_SEND_FMT(bfd, message, arglist) \
-.            (((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
+.            (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
 .
 .#ifdef DEBUG_BFD_SEND
 .#undef BFD_SEND_FMT
 .#define BFD_SEND_FMT(bfd, message, arglist) \
 .  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
-.   (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) : \
+.   (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
 .   (bfd_assert (__FILE__,__LINE__), NULL))
 .#endif
 
@@ -131,16 +130,16 @@
 	module that implements access to a different target under BFD,
 	defines one of these.
 
-
 	FIXME, these names should be rationalised with the names of
 	the entry points which call them. Too bad we can't have one
-	macro to define them both! 
+	macro to define them both!
 
 .enum bfd_flavour {
 .  bfd_target_unknown_flavour,
 .  bfd_target_aout_flavour,
 .  bfd_target_coff_flavour,
 .  bfd_target_ecoff_flavour,
+.  bfd_target_xcoff_flavour,
 .  bfd_target_elf_flavour,
 .  bfd_target_ieee_flavour,
 .  bfd_target_nlm_flavour,
@@ -184,21 +183,21 @@
 A mask of all the flags which an executable may have set -
 from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>.
 
-.  flagword object_flags;       
+.  flagword object_flags;
 
 A mask of all the flags which a section may have set - from
 the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>.
 
 .  flagword section_flags;
 
-The character normally found at the front of a symbol 
+The character normally found at the front of a symbol
 (if any), perhaps `_'.
 
 .  char symbol_leading_char;
 
 The pad character for file names within an archive header.
 
-.  char ar_pad_char;            
+.  char ar_pad_char;
 
 The maximum number of characters in an archive header.
 
@@ -233,15 +232,15 @@
 Format dependent routines: these are vectors of entry points
 within the target vector structure, one for each format to check.
 
-Check the format of a file being read.  Return a <<bfd_target *>> or zero. 
+Check the format of a file being read.  Return a <<bfd_target *>> or zero.
 
 .  const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
 
-Set the format of a file being written.  
+Set the format of a file being written.
 
 .  boolean             (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
 
-Write cached information into a file being written, at <<bfd_close>>. 
+Write cached information into a file being written, at <<bfd_close>>.
 
 .  boolean             (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
 
@@ -264,7 +263,7 @@
 .  {* Called when a new section is created.  *}
 .  boolean       (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
 .  {* Read the contents of a section.  *}
-.  boolean       (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR, 
+.  boolean       (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
 .                                            file_ptr, bfd_size_type));
 .  boolean       (*_bfd_get_section_contents_in_window)
 .                          PARAMS ((bfd *, sec_ptr, bfd_window *,
@@ -288,7 +287,7 @@
 .     to another.  *}
 .  boolean       (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
 .                                                       bfd *, sec_ptr));
-.  {* Called to copy BFD private symbol data from one symbol 
+.  {* Called to copy BFD private symbol data from one symbol
 .     to another.  *}
 .  boolean       (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
 .							   bfd *, asymbol *));
@@ -324,10 +323,10 @@
 .  boolean  (*_bfd_construct_extended_name_table)
 .             PARAMS ((bfd *, char **, bfd_size_type *, const char **));
 .  void     (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
-.  boolean  (*write_armap) PARAMS ((bfd *arch, 
+.  boolean  (*write_armap) PARAMS ((bfd *arch,
 .                              unsigned int elength,
 .                              struct orl *map,
-.                              unsigned int orl_count, 
+.                              unsigned int orl_count,
 .                              int stridx));
 .  PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
 .  bfd *    (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
@@ -467,15 +466,15 @@
 endianness.  The function open_output() in ld/ldlang.c uses this field
 to find an alternative output format that is suitable.
 
-. {* Opposite endian version of this target.  *}  
+. {* Opposite endian version of this target.  *}
 . const struct bfd_target * alternative_target;
-. 
+.
 
 Data for use by back-end routines, which isn't generic enough to belong
 in this structure.
 
 . PTR backend_data;
-. 
+.
 .} bfd_target;
 
 */
@@ -511,6 +510,7 @@
 extern const bfd_target bfd_elf64_hppa_vec;
 extern const bfd_target bfd_elf64_ia64_little_vec;
 extern const bfd_target bfd_elf64_ia64_big_vec;
+extern const bfd_target bfd_elf32_ia64_big_vec;
 extern const bfd_target bfd_elf32_avr_vec;
 extern const bfd_target bfd_elf32_bigarc_vec;
 extern const bfd_target bfd_elf32_bigarm_vec;
@@ -521,17 +521,22 @@
 extern const bfd_target bfd_elf32_big_generic_vec;
 extern const bfd_target bfd_elf32_bigmips_vec;
 extern const bfd_target bfd_elf64_bigmips_vec;
+extern const bfd_target bfd_elf32_cris_vec;
+extern const bfd_target bfd_elf32_us_cris_vec;
 extern const bfd_target bfd_elf32_d10v_vec;
 extern const bfd_target bfd_elf32_d30v_vec;
 extern const bfd_target bfd_elf32_hppa_vec;
 extern const bfd_target bfd_elf32_i370_vec;
 extern const bfd_target bfd_elf32_i386_vec;
 extern const bfd_target bfd_elf32_i860_vec;
+extern const bfd_target bfd_elf32_i860_little_vec;
 extern const bfd_target bfd_elf32_i960_vec;
 extern const bfd_target bfd_elf32_little_generic_vec;
 extern const bfd_target bfd_elf32_littlemips_vec;
 extern const bfd_target bfd_elf64_littlemips_vec;
 extern const bfd_target bfd_elf32_m32r_vec;
+extern const bfd_target bfd_elf32_m68hc11_vec;
+extern const bfd_target bfd_elf32_m68hc12_vec;
 extern const bfd_target bfd_elf32_m68k_vec;
 extern const bfd_target bfd_elf32_m88k_vec;
 extern const bfd_target bfd_elf32_mn10200_vec;
@@ -542,7 +547,12 @@
 extern const bfd_target bfd_elf32_powerpcle_vec;
 extern const bfd_target bfd_elf32_sh_vec;
 extern const bfd_target bfd_elf32_shl_vec;
+extern const bfd_target bfd_elf32_shlin_vec;
+extern const bfd_target bfd_elf32_shblin_vec;
 extern const bfd_target bfd_elf32_sparc_vec;
+extern const bfd_target bfd_elf64_x86_64_vec;
+extern const bfd_target bfd_elf32_tradbigmips_vec;
+extern const bfd_target bfd_elf32_tradlittlemips_vec;
 extern const bfd_target bfd_elf32_v850_vec;
 extern const bfd_target bfd_elf32_fr30_vec;
 extern const bfd_target bfd_elf32_mcore_big_vec;
@@ -550,6 +560,7 @@
 extern const bfd_target bfd_elf64_big_generic_vec;
 extern const bfd_target bfd_elf64_little_generic_vec;
 extern const bfd_target bfd_elf64_sparc_vec;
+extern const bfd_target cris_aout_vec;
 extern const bfd_target demo_64_vec;
 extern const bfd_target ecoff_big_vec;
 extern const bfd_target ecoff_little_vec;
@@ -719,12 +730,18 @@
 #ifdef BFD64
 	&bfd_elf64_bigmips_vec,
 #endif
+	&bfd_elf32_cris_vec,
+	&bfd_elf32_us_cris_vec,
 	&bfd_elf32_d10v_vec,
 	&bfd_elf32_d30v_vec,
 	&bfd_elf32_hppa_vec,
 	&bfd_elf32_i370_vec,
 	&bfd_elf32_i386_vec,
+#ifdef BFD64
+        &bfd_elf64_x86_64_vec,
+#endif
 	&bfd_elf32_i860_vec,
+	&bfd_elf32_i860_little_vec,
 	&bfd_elf32_i960_vec,
 	&bfd_elf32_little_generic_vec,
 	&bfd_elf32_littlearc_vec,
@@ -737,6 +754,8 @@
 	&bfd_elf32_m32r_vec,
 	&bfd_elf32_mn10200_vec,
 	&bfd_elf32_mn10300_vec,
+	&bfd_elf32_m68hc11_vec,
+	&bfd_elf32_m68hc12_vec,
 	&bfd_elf32_m68k_vec,
 	&bfd_elf32_m88k_vec,
 	&bfd_elf32_sparc_vec,
@@ -748,6 +767,8 @@
 	&bfd_elf32_fr30_vec,
 	&bfd_elf32_mcore_big_vec,
 	&bfd_elf32_mcore_little_vec,
+	&bfd_elf32_tradbigmips_vec,
+	&bfd_elf32_tradlittlemips_vec,
 #ifdef BFD64			/* No one seems to use this.  */
 	&bfd_elf64_big_generic_vec,
 	&bfd_elf64_little_generic_vec,
@@ -758,6 +779,8 @@
 	/* We don't include cisco_core_*_vec.  Although it has a magic number,
 	   the magic number isn't at the beginning of the file, and thus
 	   might spuriously match other kinds of files.  */
+
+        &cris_aout_vec,
 #ifdef BFD64
 	&demo_64_vec,	/* Only compiled if host has long-long support */
 #endif
@@ -862,7 +885,7 @@
 	&riscix_vec,
 #endif
 #if 0
-	/* This has the same magic number as RS/6000. */
+	/* This has the same magic number as RS/6000.  */
 	&pmac_xcoff_vec,
 #endif
 	&rs6000coff_vec,
@@ -958,7 +981,7 @@
 /* When there is an ambiguous match, bfd_check_format_matches puts the
    names of the matching targets in an array.  This variable is the maximum
    number of entries that the array could possibly need.  */
-const size_t _bfd_target_vector_entries = sizeof(bfd_target_vector)/sizeof(*bfd_target_vector);
+const size_t _bfd_target_vector_entries = sizeof (bfd_target_vector)/sizeof (*bfd_target_vector);
 
 /* This array maps configuration triplets onto BFD vectors.  */
 
@@ -1058,7 +1081,7 @@
 	variable to "default" will cause the first entry in the target
 	list to be returned, and "target_defaulted" will be set in the
 	BFD.  This causes <<bfd_check_format>> to loop over all the
-	targets to find the one that matches the file being read.   
+	targets to find the one that matches the file being read.
 */
 
 const bfd_target *
@@ -1141,7 +1164,7 @@
 	bfd_seach_for_target
 
 SYNOPSIS
-	const bfd_target * bfd_search_for_target (int (* search_func)(const bfd_target *, void *), void *);
+	const bfd_target * bfd_search_for_target (int (* search_func) (const bfd_target *, void *), void *);
 
 DESCRIPTION
 	Return a pointer to the first transfer vector in the list of
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index b1ffe75..e5fa95a 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -24,11 +24,11 @@
 	Tektronix Hex Format handling
 
 DESCRIPTION
-	
+
 	Tek Hex records can hold symbols and data, but not
 	relocations. Their main application is communication with
 	devices like PROM programmers and ICE equipment.
-	
+
 	It seems that the sections are descibed as being really big,
         the example I have says that the text section is 0..ffffffff.
 	BFD would barf with this, many apps would try to alloc 4GB to
@@ -49,11 +49,10 @@
 	Any number of sections may be created for output, we save them
 	up and output them when it's time to close the bfd.
 
-
 	A TekHex record looks like:
 EXAMPLE
 	%<block length><type><checksum><stuff><cr>
-	
+
 DESCRIPTION
 	Where
 	o length
@@ -63,7 +62,6 @@
 	3) symbol record
 	6) data record
 	8) termination record
-	
 
 The data can come out of order, and may be discontigous. This is a
 serial protocol, so big files are unlikely, so we keep a list of 8k chunks
@@ -123,7 +121,7 @@
 static boolean tekhex_mkobject PARAMS ((bfd *));
 static long tekhex_get_symtab_upper_bound PARAMS ((bfd *));
 static long tekhex_get_symtab PARAMS ((bfd *, asymbol **));
-static void pass_over PARAMS ((bfd *, void (*)(bfd*, int, char *)));
+static void pass_over PARAMS ((bfd *, void (*) (bfd*, int, char *)));
 static void first_phase PARAMS ((bfd *, int, char *));
 static void insert_byte PARAMS ((bfd *, int, bfd_vma));
 static struct data_struct *find_chunk PARAMS ((bfd *, bfd_vma));
@@ -216,7 +214,6 @@
 00000000  g       T_SEGMENT $
 00000010  g       T_SEGMENT $
 
-
 RELOCATION RECORDS FOR [D00000000]: (none)
 
 RELOCATION RECORDS FOR [D00008000]: (none)
@@ -425,7 +422,7 @@
 	  char *n = bfd_alloc (abfd, len + 1);
 
 	  if (!n)
-	    abort();		/* FIXME */
+	    abort ();		/* FIXME */
 	  memcpy (n, sym, len + 1);
 	  section = bfd_make_section (abfd, n);
 	}
@@ -454,7 +451,7 @@
 		char type = (*src);
 
 		if (!new)
-		  abort();	/* FIXME */
+		  abort ();	/* FIXME */
 		new->symbol.the_bfd = abfd;
 		src++;
 		abfd->symcount++;
@@ -464,7 +461,7 @@
 		len = getsym (sym, &src);
 		new->symbol.name = bfd_alloc (abfd, len + 1);
 		if (!new->symbol.name)
-		  abort();	/* FIXME */
+		  abort ();	/* FIXME */
 		memcpy ((char *) (new->symbol.name), sym, len + 1);
 		new->symbol.section = section;
 		if (type <= '4')
@@ -1063,6 +1060,6 @@
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   NULL,
-  
+
   (PTR) 0
 };
diff --git a/bfd/trad-core.c b/bfd/trad-core.c
index 9cd12c0..194da15 100644
--- a/bfd/trad-core.c
+++ b/bfd/trad-core.c
@@ -46,7 +46,7 @@
 #include TRAD_HEADER
 #endif
 
-  struct trad_core_struct 
+  struct trad_core_struct
     {
       asection *data_section;
       asection *stack_section;
@@ -85,7 +85,7 @@
   if (bfd_seek (abfd, TRAD_CORE_USER_OFFSET, SEEK_SET) != 0)
     return 0;
 #endif
-    
+
   val = bfd_read ((void *)&u, 1, sizeof u, abfd);
   if (val != sizeof u)
     {
@@ -95,7 +95,7 @@
     }
 
   /* Sanity check perhaps??? */
-  if (u.u_dsize > 0x1000000)	/* Remember, it's in pages... */
+  if (u.u_dsize > 0x1000000)	/* Remember, it's in pages...  */
     {
       bfd_set_error (bfd_error_wrong_format);
       return 0;
@@ -152,7 +152,7 @@
 		bfd_zmalloc (sizeof (struct trad_core_struct));
   if (rawptr == NULL)
     return 0;
-  
+
   abfd->tdata.trad_core_data = rawptr;
 
   rawptr->u = u; /*Copy the uarea into the tdata part of the bfd */
@@ -207,13 +207,13 @@
      from *u_ar0.  The other is that u_ar0 is sometimes an absolute address
      in kernel memory, and on other systems it is an offset from the beginning
      of the `struct user'.
-     
+
      As a practical matter, we don't know where the registers actually are,
      so we have to pass the whole area to GDB.  We encode the value of u_ar0
      by setting the .regs section up so that its virtual memory address
      0 is at the place pointed to by u_ar0 (by setting the vma of the start
      of the section to -u_ar0).  GDB uses this info to locate the regs,
-     using minor trickery to get around the offset-or-absolute-addr problem. */
+     using minor trickery to get around the offset-or-absolute-addr problem.  */
   core_regsec (abfd)->vma = - (bfd_vma) u.u_ar0;
 
   core_datasec (abfd)->filepos = NBPG * UPAGES;
@@ -273,9 +273,9 @@
 
 /* If somebody calls any byte-swapping routines, shoot them.  */
 static void
-swap_abort()
+swap_abort ()
 {
-  abort(); /* This way doesn't require any declaration for ANSI to fuck up */
+  abort (); /* This way doesn't require any declaration for ANSI to fuck up */
 }
 #define	NO_GET	((bfd_vma (*) PARAMS ((   const bfd_byte *))) swap_abort )
 #define	NO_PUT	((void    (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
@@ -316,7 +316,7 @@
      bfd_false, bfd_false,
      bfd_false, bfd_false
     },
-    
+
        BFD_JUMP_TABLE_GENERIC (_bfd_generic),
        BFD_JUMP_TABLE_COPY (_bfd_generic),
        BFD_JUMP_TABLE_CORE (trad_unix),
@@ -328,6 +328,6 @@
        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
     NULL,
-    
+
     (PTR) 0			/* backend_data */
 };
diff --git a/bfd/vaxnetbsd.c b/bfd/vaxnetbsd.c
index e137d09..d7a0e5f 100644
--- a/bfd/vaxnetbsd.c
+++ b/bfd/vaxnetbsd.c
@@ -15,7 +15,7 @@
 
 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.  */
 
 #define	BYTES_IN_WORD	4
 #undef TARGET_IS_BIG_ENDIAN_P
diff --git a/bfd/versados.c b/bfd/versados.c
index d3ebda4..28c3dd2 100644
--- a/bfd/versados.c
+++ b/bfd/versados.c
@@ -36,7 +36,6 @@
    o Object Text Recrod
    o End Record
 
-
  */
 
 #include "bfd.h"
@@ -44,18 +43,15 @@
 #include "libbfd.h"
 #include "libiberty.h"
 
-
 static boolean versados_mkobject PARAMS ((bfd *));
 static boolean versados_scan PARAMS ((bfd *));
 static const bfd_target *versados_object_p PARAMS ((bfd *));
 
-
 #define VHEADER '1'
 #define VESTDEF '2'
 #define VOTR '3'
 #define VEND '4'
 
-
 #define ES_BASE 17		/* first symbol has esdid 17 */
 
 /* Per file target dependent information */
@@ -145,11 +141,7 @@
     struct ext_otr otr;
   };
 
-/* Initialize by filling in the hex conversion array. */
-
-
-
-
+/* Initialize by filling in the hex conversion array.  */
 
 /* Set up the tdata information.  */
 
@@ -171,13 +163,10 @@
   return true;
 }
 
-
 /* Report a problem in an S record file.  FIXME: This probably should
    not call fprintf, but we really do need some mechanism for printing
    error messages.  */
 
-
-
 static asymbol *
 versados_new_symbol (abfd, snum, name, val, sec)
      bfd *abfd;
@@ -195,7 +184,6 @@
   return n;
 }
 
-
 static int
 get_record (abfd, ptr)
      bfd *abfd;
@@ -244,7 +232,6 @@
   return n;
 }
 
-
 static void
 process_esd (abfd, esd, pass)
      bfd *abfd;
@@ -296,7 +283,6 @@
 	  }
 	  break;
 
-
 	case ESD_ABS:
 	  size = get_4 (&ptr);
 	  start = get_4 (&ptr);
@@ -356,7 +342,6 @@
 	 "-v32", true, 0xffffffff, 0xffffffff, false),
 };
 
-
 static int
 get_offset (len, ptr)
      int len;
@@ -405,7 +390,6 @@
 	  int offsetlen = flag & 0x7;
 	  int j;
 
-
 	  if (esdids == 0)
 	    {
 	      /* A zero esdid means the new pc is the offset given */
@@ -433,7 +417,7 @@
 		      int rn = EDATA (abfd, otr->esdid - 1).relocs++;
 		      if (pass == 1)
 			{
-			  /* this is the first pass over the data, 
+			  /* this is the first pass over the data,
 			     just remember that we need a reloc */
 			}
 		      else
@@ -471,7 +455,6 @@
   if (!contents && need_contents)
     esdid->contents = (unsigned char *) bfd_alloc (abfd, esdid->section->_raw_size);
 
-
 }
 
 static boolean
@@ -586,8 +569,6 @@
   return 1;
 }
 
-
-
 /* Check whether an existing file is a versados  file.  */
 
 static const bfd_target *
@@ -633,7 +614,6 @@
   return abfd->xvec;
 }
 
-
 static boolean
 versados_pass_2 (abfd)
      bfd *abfd;
@@ -648,7 +628,6 @@
 
   VDATA (abfd)->es_done = ES_BASE;
 
-
   /* read records till we get to where we want to be */
 
   while (1)
@@ -701,8 +680,6 @@
   return false;
 }
 
-
-/*ARGSUSED */
 static int
 versados_sizeof_headers (abfd, exec)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -755,7 +732,6 @@
   return symcount;
 }
 
-/*ARGSUSED */
 void
 versados_get_symbol_info (ignore_abfd, symbol, ret)
      bfd *ignore_abfd ATTRIBUTE_UNUSED;
@@ -765,7 +741,6 @@
   bfd_symbol_info (symbol, ret);
 }
 
-/*ARGSUSED */
 void
 versados_print_symbol (ignore_abfd, afile, symbol, how)
      bfd *ignore_abfd ATTRIBUTE_UNUSED;
@@ -796,7 +771,6 @@
   return (asect->reloc_count + 1) * sizeof (arelent *);
 }
 
-
 long
 versados_canonicalize_reloc (abfd, section, relptr, symbols)
      bfd *abfd;
@@ -922,6 +896,6 @@
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
   NULL,
-  
+
   (PTR) 0
 };
diff --git a/bfd/vms-gsd.c b/bfd/vms-gsd.c
index ac3fe69..769c0a5 100644
--- a/bfd/vms-gsd.c
+++ b/bfd/vms-gsd.c
@@ -21,7 +21,6 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-
 #include <ctype.h>
 
 #include "bfd.h"
@@ -85,7 +84,6 @@
 	(SEC_IN_MEMORY|SEC_DATA|SEC_HAS_CONTENTS|SEC_ALLOC|SEC_LOAD) }
 };
 
-
 /* These flags are deccrtl/vaxcrtl (openVMS 6.2 Alpha) compatible  */
 
 static struct sec_flags_struct evax_section_flags[] = {
@@ -170,7 +168,6 @@
   return section_flags[i].flags_always;
 }
 
-
 /* Retrieve vms section flags by name and size  */
 
 static flagword
@@ -653,7 +650,7 @@
 		    new_flags |= BSF_FUNCTION;
 		  }
 		symbol->value = bfd_getl64 (vms_rec+8);
-		symbol->section = (asection *)((unsigned long) bfd_getl32 (vms_rec+28));
+		symbol->section = (asection *) ((unsigned long) bfd_getl32 (vms_rec+28));
 #if VMS_DEBUG
 		vms_debug(4, "egsd sym def #%d (%s, %d, %04x=%s)\n", abfd->symcount,
 			   symbol->name, (int)symbol->section, old_flags, flag2str(gsyflagdesc, old_flags));
@@ -899,9 +896,9 @@
 	    {
 	      _bfd_vms_output_quad (abfd, symbol->value);
 	      _bfd_vms_output_quad (abfd,
-				     ((asymbol *)(symbol->udata.p))->value);
+				     ((asymbol *) (symbol->udata.p))->value);
 	      _bfd_vms_output_long (abfd,
-				     (((asymbol *)(symbol->udata.p))
+				     (((asymbol *) (symbol->udata.p))
 				      ->section->index));
 	      _bfd_vms_output_long (abfd, symbol->section->index);
 	    }
@@ -921,7 +918,7 @@
 
   _bfd_vms_output_alignment (abfd, 8);
   _bfd_vms_output_pop (abfd);
-  _bfd_vms_output_end (abfd); 
+  _bfd_vms_output_end (abfd);
 
   return 0;
 }
diff --git a/bfd/vms-hdr.c b/bfd/vms-hdr.c
index 3b36b32..d547753 100644
--- a/bfd/vms-hdr.c
+++ b/bfd/vms-hdr.c
@@ -33,9 +33,11 @@
 
 #include "vms.h"
 
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
 /*---------------------------------------------------------------------------*/
 
-
 /* Read & process emh record
    return 0 on success, -1 on error  */
 
@@ -196,11 +198,9 @@
   return 0;
 }
 
-
 /*-----------------------------------------------------------------------------*/
 /* Output routines.  */
 
-
 /* Manufacure a VMS like time on a unix based system.
    stolen from obj-vms.c  */
 
@@ -240,7 +240,6 @@
   return tbuf;
 }
 
-
 /* write object header for bfd abfd  */
 
 int
@@ -253,7 +252,6 @@
   int had_case = 0;
   int had_file = 0;
 
-
 #if VMS_DEBUG
   vms_debug (2, "vms_write_hdr (%p)\n", abfd);
 #endif
@@ -392,7 +390,7 @@
 
   vms_rec = PRIV(vms_rec);
 
-  if ((objtype == OBJ_S_C_EOM) 
+  if ((objtype == OBJ_S_C_EOM)
      || (objtype == OBJ_S_C_EOMW))
     {
     }
@@ -420,7 +418,6 @@
   return 0;
 }
 
-
 /* Write eom record for bfd abfd  */
 
 int
@@ -433,7 +430,7 @@
 #endif
 
   _bfd_vms_output_begin (abfd, objtype, -1);
-  _bfd_vms_output_long (abfd, (unsigned long)(PRIV(vms_linkage_index) >> 1));
+  _bfd_vms_output_long (abfd, (unsigned long) (PRIV(vms_linkage_index) >> 1));
   _bfd_vms_output_byte (abfd, 0);	/* completion code */
   _bfd_vms_output_byte (abfd, 0);	/* fill byte */
 
@@ -448,7 +445,7 @@
 	  return -1;
 	}
       _bfd_vms_output_short (abfd, 0);
-      _bfd_vms_output_long (abfd, (unsigned long)(section->index));
+      _bfd_vms_output_long (abfd, (unsigned long) (section->index));
       _bfd_vms_output_long (abfd,
 			     (unsigned long) bfd_get_start_address (abfd));
       _bfd_vms_output_long (abfd, 0);
diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c
index 311192c..48029dd 100644
--- a/bfd/vms-misc.c
+++ b/bfd/vms-misc.c
@@ -18,7 +18,6 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-
 #if __STDC__
 #include <stdarg.h>
 #endif
@@ -38,7 +37,7 @@
    evaluates environment variable VMS_DEBUG for a
    numerical value on the first call
    all error levels below this value are printed
-  
+
    levels:
    1	toplevel bfd calls (functions from the bfd vector)
    2	functions called by bfd calls
@@ -74,10 +73,10 @@
   if (abslvl > min_level)
     return;
 
-  while(--level>0)
-    fprintf(output, " ");
+  while (--level>0)
+    fprintf (output, " ");
   va_start(args, format);
-  vfprintf(output, format, args);
+  vfprintf (output, format, args);
   fflush(output);
   va_end(args);
 
@@ -112,16 +111,15 @@
   if (level > min_level)
     return;
 
-  while(--level>0)
-    fprintf(output, " ");
-  fprintf(output, format, a1, a2, a3, a4, a5, a6);
+  while (--level>0)
+    fprintf (output, " ");
+  fprintf (output, format, a1, a2, a3, a4, a5, a6);
   fflush(output);
 
   return;
 }
 #endif /* __STDC__ */
 
-
 /* a debug function
    hex dump 'size' bytes starting at 'ptr'  */
 
@@ -235,43 +233,41 @@
   vms_debug (10, "_bfd_vms_get_header_values type %x, length %x\n", (type?*type:0), (length?*length:0));
 #endif
 
-
   return;
 }
 
-
 /* Get next record from object file to vms_buf
    set PRIV(buf_size) and return it
-  
+
    this is a little tricky since it should be portable.
-  
+
    the openVMS object file has 'variable length' which means that
    read() returns data in chunks of (hopefully) correct and expected
    size. The linker (and other tools on vms) depend on that. Unix doesn't
    know about 'formatted' files, so reading and writing such an object
    file in a unix environment is not trivial.
-  
+
    With the tool 'file' (available on all vms ftp sites), one
    can view and change the attributes of a file. Changing from
    'variable length' to 'fixed length, 512 bytes' reveals the
    record length at the first 2 bytes of every record. The same
    happens during the transfer of object files from vms to unix,
    at least with ucx, dec's implementation of tcp/ip.
-  
+
    The vms format repeats the length at bytes 2 & 3 of every record.
-  
+
    On the first call (file_format == FF_UNKNOWN) we check if
    the first and the third byte pair (!) of the record match.
    If they do it's an object file in an unix environment or with
    wrong attributes (FF_FOREIGN), else we should be in a vms
    environment where read() returns the record size (FF_NATIVE).
-  
+
    reading is always done in 2 steps.
    first just the record header is read and the length extracted
    by get_header_values
    then the read buffer is adjusted and the remaining bytes are
    read in.
-  
+
    all file i/o is always done on even file positions  */
 
 int
@@ -313,22 +309,23 @@
 
   switch (PRIV(file_format))
     {
-      case FF_UNKNOWN:
-      case FF_FOREIGN:
-	test_len = 6;			/* probe 6 bytes */
-	test_start = 2;			/* where the record starts */
+    case FF_UNKNOWN:
+    case FF_FOREIGN:
+      test_len = 6;			/* probe 6 bytes */
+      test_start = 2;			/* where the record starts */
       break;
 
-      case FF_NATIVE:
-	test_len = 4;
-	test_start = 0;
+    case FF_NATIVE:
+      test_len = 4;
+      test_start = 0;
       break;
 
-      case FF_VAX:
-	test_len = 0;
-	test_start = 0;
+    default:
+    case FF_VAX:
+      test_len = 0;
+      test_start = 0;
       break;
-  }
+    }
 
   /* skip odd alignment byte  */
 
@@ -436,7 +433,6 @@
   return PRIV(rec_length);
 }
 
-
 /* get next vms record from file
    update vms_rec and rec_length to new (remaining) values  */
 
@@ -459,6 +455,9 @@
 	return -1;
     }
 
+  if (!PRIV(vms_rec))
+    return -1;
+
   if (PRIV(is_vax))
     {
       PRIV(rec_type) = *(PRIV(vms_rec));
@@ -480,7 +479,6 @@
   return PRIV(rec_type);
 }
 
-
 
 /* Copy sized string (string with fixed length) to new allocated area
    size is string length (size of record)  */
@@ -544,7 +542,6 @@
   return;
 }
 
-
 /* Pop value and section index  */
 
 uquad
@@ -606,7 +603,6 @@
   return newptr;
 }
 
-
 /* Save section data & offset to an vms_section structure
    vms_section_table[] holds the vms_section chain  */
 
@@ -635,7 +631,6 @@
   return true;
 }
 
-
 /* Get vms_section pointer to saved contents for section # index  */
 
 vms_section *
@@ -690,7 +685,6 @@
   return;
 }
 
-
 /* Set record/subrecord alignment  */
 
 void
@@ -706,7 +700,6 @@
   return;
 }
 
-
 /* Prepare for subrecord fields  */
 
 void
@@ -722,7 +715,6 @@
   return;
 }
 
-
 /* End of subrecord fields  */
 
 void
@@ -745,7 +737,6 @@
   return;
 }
 
-
 /* Flush unwritten output, ends current record  */
 
 void
@@ -775,7 +766,7 @@
   vms_debug (6, "align: adding %d bytes\n", aligncount);
 #endif
 
-  while(aligncount-- > 0)
+  while (aligncount-- > 0)
     {
       PRIV(output_buf)[real_size++] = 0;
 #if 0
@@ -810,7 +801,6 @@
   return;
 }
 
-
 /* End record output  */
 
 void
@@ -826,7 +816,6 @@
   return;
 }
 
-
 /* check remaining buffer size
 
    return what's left.  */
@@ -843,7 +832,6 @@
   return (MAX_OUTREC_SIZE - (PRIV(output_size) + size + MIN_OUTREC_LUFT));
 }
 
-
 /* Output byte (8 bit) value  */
 
 void
@@ -860,7 +848,6 @@
   return;
 }
 
-
 /* Output short (16 bit) value  */
 
 void
@@ -877,7 +864,6 @@
   return;
 }
 
-
 /* Output long (32 bit) value  */
 
 void
@@ -894,7 +880,6 @@
   return;
 }
 
-
 /* Output quad (64 bit) value  */
 
 void
@@ -911,7 +896,6 @@
   return;
 }
 
-
 /* Output c-string as counted string  */
 
 void
@@ -940,7 +924,6 @@
   _bfd_vms_output_dump (abfd, (unsigned char *)value, len);
 }
 
-
 /* Output character area  */
 
 void
@@ -962,7 +945,6 @@
   return;
 }
 
-
 /* Output count bytes of value  */
 
 void
@@ -1071,7 +1053,6 @@
   return outbuf;
 }
 
-
 /* Allocate and initialize a new symbol.  */
 
 static asymbol *
@@ -1094,7 +1075,6 @@
   return symbol;
 }
 
-
 /* Allocate and enter a new private symbol.  */
 
 vms_symbol_entry *
diff --git a/bfd/vms-tir.c b/bfd/vms-tir.c
index 124b1b3..cf91180 100644
--- a/bfd/vms-tir.c
+++ b/bfd/vms-tir.c
@@ -24,7 +24,6 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-
 /* The following type abbreviations are used:
 
 	cs	counted string (ascii string with length byte)
@@ -96,7 +95,6 @@
   return;
 }
 
-
 /* Increment image buffer pointer by offset  */
 
 static void
@@ -113,7 +111,6 @@
   return;
 }
 
-
 /* Dump multiple bytes to section image  */
 
 static void
@@ -136,7 +133,6 @@
   return;
 }
 
-
 /* Write byte to section image  */
 
 static void
@@ -155,7 +151,6 @@
   return;
 }
 
-
 /* Write 2-byte word to image  */
 
 static void
@@ -176,7 +171,6 @@
   return;
 }
 
-
 /* Write 4-byte long to image  */
 
 static void
@@ -197,7 +191,6 @@
   return;
 }
 
-
 /* Write 8-byte quad to image  */
 
 static void
@@ -222,12 +215,12 @@
 #define HIGHBIT(op) ((op & 0x80000000L) == 0x80000000L)
 
 /* etir_sta
-  
+
    vms stack commands
-  
+
    handle sta_xxx commands in etir section
    ptr points to data area in record
-  
+
    see table B-8 of the openVMS linker manual  */
 
 static boolean
@@ -268,7 +261,7 @@
 	    }
 	  else
 	    {
-	      _bfd_vms_push (abfd, (uquad)(entry->symbol->value), -1);
+	      _bfd_vms_push (abfd, (uquad) (entry->symbol->value), -1);
 	    }
 	}
       break;
@@ -336,15 +329,14 @@
   return true;
 }
 
-
 /*
    etir_sto
-  
+
    vms store commands
-  
+
    handle sto_xxx commands in etir section
    ptr points to data area in record
-  
+
    see table B-9 of the openVMS linker manual  */
 
 static boolean
@@ -438,7 +430,7 @@
 	    return false;
 	  }
 	else
-	  image_write_q (abfd, (uquad)(entry->symbol->value));	/* FIXME, reloc */
+	  image_write_q (abfd, (uquad) (entry->symbol->value));	/* FIXME, reloc */
       }
       break;
 
@@ -459,7 +451,7 @@
 	    return false;
 	  }
 	else
-	  image_write_q (abfd, (uquad)(entry->symbol->value));	/* FIXME, reloc */
+	  image_write_q (abfd, (uquad) (entry->symbol->value));	/* FIXME, reloc */
       }
       break;
 
@@ -518,7 +510,7 @@
 	    image_write_l (abfd, (unsigned long)0);	/* FIXME, reloc */
 	  }
 	else
-	  image_write_l (abfd, (unsigned long)(entry->symbol->value));	/* FIXME, reloc */
+	  image_write_l (abfd, (unsigned long) (entry->symbol->value));	/* FIXME, reloc */
       }
       break;
 
@@ -552,7 +544,7 @@
    all 32 bit signed arithmetic
    all word just like a stack calculator
    arguments are popped from stack, results are pushed on stack
-  
+
    see table B-10 of the openVMS linker manual  */
 
 static boolean
@@ -582,7 +574,7 @@
     case ETIR_S_C_OPR_ADD:
       op1 = (long)_bfd_vms_pop (abfd, NULL);
       op2 = (long)_bfd_vms_pop (abfd, NULL);
-      _bfd_vms_push (abfd, (uquad)(op1 + op2), -1);
+      _bfd_vms_push (abfd, (uquad) (op1 + op2), -1);
       break;
 
       /* subtract  */
@@ -590,7 +582,7 @@
     case ETIR_S_C_OPR_SUB:
       op1 = (long)_bfd_vms_pop (abfd, NULL);
       op2 = (long)_bfd_vms_pop (abfd, NULL);
-      _bfd_vms_push (abfd, (uquad)(op2 - op1), -1);
+      _bfd_vms_push (abfd, (uquad) (op2 - op1), -1);
       break;
 
       /* multiply  */
@@ -598,7 +590,7 @@
     case ETIR_S_C_OPR_MUL:
       op1 = (long)_bfd_vms_pop (abfd, NULL);
       op2 = (long)_bfd_vms_pop (abfd, NULL);
-      _bfd_vms_push (abfd, (uquad)(op1 * op2), -1);
+      _bfd_vms_push (abfd, (uquad) (op1 * op2), -1);
       break;
 
       /* divide  */
@@ -609,7 +601,7 @@
       if (op2 == 0)
 	_bfd_vms_push (abfd, (uquad)0L, -1);
       else
-	_bfd_vms_push (abfd, (uquad)(op2 / op1), -1);
+	_bfd_vms_push (abfd, (uquad) (op2 / op1), -1);
       break;
 
       /* logical and  */
@@ -617,7 +609,7 @@
     case ETIR_S_C_OPR_AND:
       op1 = (long)_bfd_vms_pop (abfd, NULL);
       op2 = (long)_bfd_vms_pop (abfd, NULL);
-      _bfd_vms_push (abfd, (uquad)(op1 & op2), -1);
+      _bfd_vms_push (abfd, (uquad) (op1 & op2), -1);
       break;
 
       /* logical inclusive or	 */
@@ -625,7 +617,7 @@
     case ETIR_S_C_OPR_IOR:
       op1 = (long)_bfd_vms_pop (abfd, NULL);
       op2 = (long)_bfd_vms_pop (abfd, NULL);
-      _bfd_vms_push (abfd, (uquad)(op1 | op2), -1);
+      _bfd_vms_push (abfd, (uquad) (op1 | op2), -1);
       break;
 
       /* logical exclusive or  */
@@ -633,21 +625,21 @@
     case ETIR_S_C_OPR_EOR:
       op1 = (long)_bfd_vms_pop (abfd, NULL);
       op2 = (long)_bfd_vms_pop (abfd, NULL);
-      _bfd_vms_push (abfd, (uquad)(op1 ^ op2), -1);
+      _bfd_vms_push (abfd, (uquad) (op1 ^ op2), -1);
       break;
 
       /* negate  */
 
     case ETIR_S_C_OPR_NEG:
       op1 = (long)_bfd_vms_pop (abfd, NULL);
-      _bfd_vms_push (abfd, (uquad)(-op1), -1);
+      _bfd_vms_push (abfd, (uquad) (-op1), -1);
       break;
 
       /* complement  */
 
     case ETIR_S_C_OPR_COM:
       op1 = (long)_bfd_vms_pop (abfd, NULL);
-      _bfd_vms_push (abfd, (uquad)(op1 ^ -1L), -1);
+      _bfd_vms_push (abfd, (uquad) (op1 ^ -1L), -1);
       break;
 
       /* insert field  */
@@ -714,9 +706,8 @@
   return true;
 }
 
-
 /* control commands
-  
+
    see table B-11 of the openVMS linker manual  */
 
 static boolean
@@ -782,9 +773,8 @@
   return true;
 }
 
-
 /* store conditional commands
-  
+
    see table B-12 and B-13 of the openVMS linker manual  */
 
 static boolean
@@ -904,7 +894,6 @@
   return true;
 }
 
-
 static asection *
 new_section (abfd, idx)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -943,7 +932,6 @@
   return section;
 }
 
-
 static int
 alloc_section (abfd, idx)
      bfd *abfd;
@@ -969,7 +957,6 @@
   return 0;
 }
 
-
 /*
  * tir_sta
  *
@@ -1010,7 +997,7 @@
 	  if (entry == (vms_symbol_entry *)NULL)
 	    return 0;
 
-	  _bfd_vms_push (abfd, (unsigned long)(entry->symbol->value), -1);
+	  _bfd_vms_push (abfd, (unsigned long) (entry->symbol->value), -1);
 	  ptr += *ptr + 1;
 	}
       break;
@@ -1292,7 +1279,6 @@
   return ptr;
 }
 
-
 /*
  * tir_sto
  *
@@ -1464,7 +1450,6 @@
   return ptr;
 }
 
-
 /*
  * stack operator commands
  * all 32 bit signed arithmetic
@@ -1498,7 +1483,7 @@
 	 */
 	op1 = (long)_bfd_vms_pop (abfd, NULL);
 	op2 = (long)_bfd_vms_pop (abfd, NULL);
-	_bfd_vms_push (abfd, (unsigned long)(op1 + op2), -1);
+	_bfd_vms_push (abfd, (unsigned long) (op1 + op2), -1);
       break;
 
       case TIR_S_C_OPR_SUB:
@@ -1507,7 +1492,7 @@
 	 */
 	op1 = (long)_bfd_vms_pop (abfd, NULL);
 	op2 = (long)_bfd_vms_pop (abfd, NULL);
-	_bfd_vms_push (abfd, (unsigned long)(op2 - op1), -1);
+	_bfd_vms_push (abfd, (unsigned long) (op2 - op1), -1);
       break;
 
       case TIR_S_C_OPR_MUL:
@@ -1516,7 +1501,7 @@
 	 */
 	op1 = (long)_bfd_vms_pop (abfd, NULL);
 	op2 = (long)_bfd_vms_pop (abfd, NULL);
-	_bfd_vms_push (abfd, (unsigned long)(op1 * op2), -1);
+	_bfd_vms_push (abfd, (unsigned long) (op1 * op2), -1);
       break;
 
       case TIR_S_C_OPR_DIV:
@@ -1528,7 +1513,7 @@
 	if (op2 == 0)
 	  _bfd_vms_push (abfd, (unsigned long)0L, -1);
 	else
-	  _bfd_vms_push (abfd, (unsigned long)(op2 / op1), -1);
+	  _bfd_vms_push (abfd, (unsigned long) (op2 / op1), -1);
       break;
 
       case TIR_S_C_OPR_AND:
@@ -1537,7 +1522,7 @@
 	 */
 	op1 = (long)_bfd_vms_pop (abfd, NULL);
 	op2 = (long)_bfd_vms_pop (abfd, NULL);
-	_bfd_vms_push (abfd, (unsigned long)(op1 & op2), -1);
+	_bfd_vms_push (abfd, (unsigned long) (op1 & op2), -1);
       break;
 
       case TIR_S_C_OPR_IOR:
@@ -1546,7 +1531,7 @@
 	 * logical inclusive or
 	 */
 	op2 = (long)_bfd_vms_pop (abfd, NULL);
-	_bfd_vms_push (abfd, (unsigned long)(op1 | op2), -1);
+	_bfd_vms_push (abfd, (unsigned long) (op1 | op2), -1);
       break;
 
       case TIR_S_C_OPR_EOR:
@@ -1555,7 +1540,7 @@
 	 */
 	op1 = (long)_bfd_vms_pop (abfd, NULL);
 	op2 = (long)_bfd_vms_pop (abfd, NULL);
-	_bfd_vms_push (abfd, (unsigned long)(op1 ^ op2), -1);
+	_bfd_vms_push (abfd, (unsigned long) (op1 ^ op2), -1);
       break;
 
       case TIR_S_C_OPR_NEG:
@@ -1563,7 +1548,7 @@
 	 * negate
 	 */
 	op1 = (long)_bfd_vms_pop (abfd, NULL);
-	_bfd_vms_push (abfd, (unsigned long)(-op1), -1);
+	_bfd_vms_push (abfd, (unsigned long) (-op1), -1);
       break;
 
       case TIR_S_C_OPR_COM:
@@ -1571,7 +1556,7 @@
 	 * complement
 	 */
 	op1 = (long)_bfd_vms_pop (abfd, NULL);
-	_bfd_vms_push (abfd, (unsigned long)(op1 ^ -1L), -1);
+	_bfd_vms_push (abfd, (unsigned long) (op1 ^ -1L), -1);
       break;
 
       case TIR_S_C_OPR_INSV:
@@ -1660,7 +1645,6 @@
   return ptr;
 }
 
-
 static unsigned char *
 tir_ctl (bfd *abfd, unsigned char *ptr)
 /*
@@ -1729,7 +1713,6 @@
   return ptr;
 }
 
-
 /*
  * handle command from TIR section
  */
@@ -1740,7 +1723,7 @@
   struct {
     int mincod;
     int maxcod;
-    unsigned char * (*explain)(bfd *, unsigned char *);
+    unsigned char * (*explain) (bfd *, unsigned char *);
   } tir_table[] = {
     { 0,		 TIR_S_C_MAXSTACOD, tir_sta }
    ,{ TIR_S_C_MINSTOCOD, TIR_S_C_MAXSTOCOD, tir_sto }
@@ -1765,7 +1748,7 @@
     {
       while (tir_table[i].mincod >= 0)
 	{
-	  if ( (tir_table[i].mincod <= *ptr) 
+	  if ( (tir_table[i].mincod <= *ptr)
 	    && (*ptr <= tir_table[i].maxcod))
 	    {
 	      ptr = tir_table[i].explain (abfd, ptr);
@@ -1783,7 +1766,6 @@
   return ptr;
 }
 
-
 /* handle command from ETIR section  */
 
 static int
@@ -1814,7 +1796,7 @@
 
   while (etir_table[i].mincod >= 0)
     {
-      if ( (etir_table[i].mincod <= cmd) 
+      if ( (etir_table[i].mincod <= cmd)
 	&& (cmd <= etir_table[i].maxcod))
 	{
 	  if (!etir_table[i].explain (abfd, cmd, ptr))
@@ -1830,7 +1812,6 @@
   return 0;
 }
 
-
 /* Text Information and Relocation Records (OBJ$C_TIR)
    handle tir record  */
 
@@ -1858,7 +1839,6 @@
   return 0;
 }
 
-
 /* Text Information and Relocation Records (EOBJ$C_ETIR)
    handle etir record  */
 
@@ -1895,9 +1875,8 @@
   return result;
 }
 
-
 /* process ETIR record
-  
+
    return 0 on success, -1 on error  */
 
 int
@@ -1931,10 +1910,9 @@
   return result;
 }
 
-
 /* process EDBG record
    return 0 on success, -1 on error
-  
+
    not implemented yet  */
 
 int
@@ -1950,10 +1928,9 @@
   return 0;
 }
 
-
 /* process ETBT record
    return 0 on success, -1 on error
-  
+
    not implemented yet  */
 
 int
@@ -1968,10 +1945,9 @@
   return 0;
 }
 
-
 /* process LNK record
    return 0 on success, -1 on error
-  
+
    not implemented yet  */
 
 int
@@ -2032,7 +2008,7 @@
 	}
 
       _bfd_vms_output_begin (abfd, ETIR_S_C_STO_IMM, -1);
-      _bfd_vms_output_long (abfd, (unsigned long)(size));
+      _bfd_vms_output_long (abfd, (unsigned long) (size));
       _bfd_vms_output_dump (abfd, cptr, size);
       _bfd_vms_output_flush (abfd);
 
@@ -2077,14 +2053,13 @@
   return;
 }
 
-
 /* end etir record  */
 static void
 end_etir_record (abfd)
     bfd *abfd;
 {
   _bfd_vms_output_pop (abfd);
-  _bfd_vms_output_end (abfd); 
+  _bfd_vms_output_end (abfd);
 }
 
 /* write section contents for bfd abfd  */
@@ -2115,7 +2090,7 @@
     {
 
 #if VMS_DEBUG
-      _bfd_vms_debug (4, "writing %d. section '%s' (%d bytes)\n", section->index, section->name, (int)(section->_raw_size));

+      _bfd_vms_debug (4, "writing %d. section '%s' (%d bytes)\n", section->index, section->name, (int) (section->_raw_size));

 #endif
 
       if (section->flags & SEC_RELOC)
@@ -2138,7 +2113,7 @@
 		  _bfd_vms_debug (4, "sym %s in sec %s, value %08lx, addr %08lx, off %08lx, len %d: %s\n",
 			      (*(*rptr)->sym_ptr_ptr)->name,
 			      (*(*rptr)->sym_ptr_ptr)->section->name,
-			      (long)(*(*rptr)->sym_ptr_ptr)->value,
+			      (long) (*(*rptr)->sym_ptr_ptr)->value,
 			      (*rptr)->address, (*rptr)->addend,
 			      bfd_get_reloc_size((*rptr)->howto),
 			      (*rptr)->howto->name);
@@ -2160,7 +2135,7 @@
 	      return -1;
 	    }
 
-	  vaddr = (bfd_vma)(sptr->offset);
+	  vaddr = (bfd_vma) (sptr->offset);
 
 	  start_etir_record (abfd, section->index, (uquad) sptr->offset,
 			     false);
@@ -2259,9 +2234,9 @@
 							    ETIR_S_C_STA_PQ,
 							    -1);
 				    _bfd_vms_output_long (abfd,
-							   (unsigned long)(sec->index));
+							   (unsigned long) (sec->index));
 				    _bfd_vms_output_quad (abfd,
-							   ((uquad)(*rptr)->addend
+							   ((uquad) (*rptr)->addend
 							    + (uquad)sym->value));
 				    _bfd_vms_output_flush (abfd);
 				    _bfd_vms_output_begin (abfd,
@@ -2325,9 +2300,9 @@
 							    ETIR_S_C_STA_PQ,
 							    -1);
 				    _bfd_vms_output_long (abfd,
-							   (unsigned long)(sec->index));
+							   (unsigned long) (sec->index));
 				    _bfd_vms_output_quad (abfd,
-							   ((uquad)(*rptr)->addend
+							   ((uquad) (*rptr)->addend
 							    + (uquad)sym->value));
 				    _bfd_vms_output_flush (abfd);
 				    _bfd_vms_output_begin (abfd,
@@ -2348,7 +2323,7 @@
 				sptr->size = hint_size;
 #if 0
 				vms_output_begin(abfd, ETIR_S_C_STO_HINT_GBL, -1);
-				vms_output_long(abfd, (unsigned long)(sec->index));
+				vms_output_long(abfd, (unsigned long) (sec->index));
 				vms_output_quad(abfd, (uquad)addr);
 
 				vms_output_counted(abfd, _bfd_vms_length_hash_symbol (abfd, sym->name, EOBJ_S_C_SYMSIZ));
@@ -2456,7 +2431,6 @@
   return 0;
 }
 
-
 /* write traceback data for bfd abfd  */
 
 int
@@ -2471,7 +2445,6 @@
   return 0;
 }
 
-
 /* write debug info for bfd abfd  */
 
 int
diff --git a/bfd/vms.c b/bfd/vms.c
index 5f91ba4..b52d817 100644
--- a/bfd/vms.c
+++ b/bfd/vms.c
@@ -170,7 +170,7 @@
   BFD_JUMP_TABLE_DYNAMIC (vms),
 
   NULL,
-  
+
   (PTR) 0
 };
 
@@ -216,7 +216,7 @@
   BFD_JUMP_TABLE_DYNAMIC (vms),
 
   NULL,
-  
+
   (PTR) 0
 };
 
@@ -306,7 +306,6 @@
   return true;
 }
 
-
 /* Fill symbol->section with section ptr
    symbol->section is filled with the section index for defined symbols
    during reading the GSD/EGSD section. But we need the pointer to the
@@ -345,7 +344,6 @@
   return true;
 }
 
-
 /* Fixup sections
    set up all pointers and arrays, counters and sizes are fixed now
 
@@ -369,7 +367,7 @@
   /* can't provide section count as argument to fill_section_ptr().  */
   priv_section_count = PRIV(section_count);
   bfd_hash_traverse (PRIV(vms_symbol_table), fill_section_ptr,
-		    (PTR)(PRIV(sections)));
+		    (PTR) (PRIV(sections)));
 
   PRIV(fixup_done) = true;
 
@@ -416,7 +414,7 @@
       if (_bfd_vms_next_record (abfd) < 0)
 	{
 #if VMS_DEBUG
-	  vms_debug (2, "next_record failed\n");      
+	  vms_debug (2, "next_record failed\n");
 #endif
 	  bfd_set_error (bfd_error_wrong_format);
 	  return 0;
@@ -501,7 +499,7 @@
 	}
 
       /* set arch_info to vax  */
- 
+
       arch = bfd_scan_arch ("vax");
       PRIV (is_vax) = 1;
 #if VMS_DEBUG
@@ -511,7 +509,7 @@
   else if (target_vector == &vms_alpha_vec)
     {
       /* set arch_info to alpha  */
- 
+
       arch = bfd_scan_arch ("alpha");
       PRIV (is_vax) = 0;
 #if VMS_DEBUG
@@ -532,7 +530,6 @@
   return target_vector;
 }
 
-
 /* Check the format for a file being read.
    Return a (bfd_target *) if it's an archive file or zero.  */
 
@@ -547,7 +544,6 @@
   return 0;
 }
 
-
 /* Set the format of a file being written.  */
 
 static boolean
@@ -581,7 +577,6 @@
   return true;
 }
 
-
 /* Write cached information into a file being written, at bfd_close.  */
 
 static boolean
@@ -717,7 +712,6 @@
   return true;
 }
 
-
 /* Ask the BFD to free all cached information.  */
 static boolean
 vms_bfd_free_cached_info (abfd)
@@ -729,7 +723,6 @@
   return true;
 }
 
-
 /* Called when a new section is created.  */
 
 static boolean
@@ -761,7 +754,6 @@
   return true;
 }
 
-
 /* Read the contents of a section.
    buf points to a buffer of buf_size bytes to be filled with
    section data (starting at offset into section)  */
@@ -822,7 +814,6 @@
   return true;
 }
 
-
 /* Merge private BFD information from the BFD @var{ibfd} to the
    the output file BFD @var{obfd} when linking.  Return <<true>>
    on success, <<false>> on error.  Possible error returns are:
@@ -841,7 +832,6 @@
   return true;
 }
 
-
 /* Set private BFD flag information in the BFD @var{abfd}.
    Return <<true>> on success, <<false>> on error.  Possible error
    returns are:
@@ -860,7 +850,6 @@
   return true;
 }
 
-
 /* Called to copy BFD private section data from one object file
    to another.  */
 
@@ -881,7 +870,7 @@
 /* Called to copy BFD private symbol data from one object file
    to another.  */
 
-static boolean 
+static boolean
 vms_bfd_copy_private_symbol_data (ibfd, isym, obfd, osym)
      bfd *ibfd ATTRIBUTE_UNUSED;
      asymbol *isym ATTRIBUTE_UNUSED;
@@ -910,7 +899,6 @@
   return 0;
 }
 
-
 /* Returns the signal number which caused the core dump which
    generated the file the BFD abfd is attached to.  */
 
@@ -924,7 +912,6 @@
   return 0;
 }
 
-
 /* Return true if the core file attached to core_bfd was generated
    by a run of the executable file attached to exec_bfd, false otherwise.  */
 
@@ -954,7 +941,6 @@
   return false;
 }
 
-
 /* ???	do something with an extended name table.
    Return false on error, true otherwise.  */
 
@@ -968,7 +954,6 @@
   return false;
 }
 
-
 /* ???	do something with an extended name table.
    Return false on error, true otherwise.  */
 
@@ -985,7 +970,6 @@
   return false;
 }
 
-
 /* Truncate the name of an archive to match system-dependent restrictions  */
 
 static void
@@ -1000,7 +984,6 @@
   return;
 }
 
-
 /* ???	write archive map  */
 
 static boolean
@@ -1030,7 +1013,6 @@
   return (PTR)0;
 }
 
-
 /* Provided a BFD, @var{archive}, containing an archive and NULL, open
    an input BFD on the first contained element and returns that.
    Subsequent calls should pass the archive and the previous return value
@@ -1048,7 +1030,6 @@
   return NULL;
 }
 
-
 /* Return the BFD which is referenced by the symbol in ABFD indexed by
    INDEX.  INDEX should have been returned by bfd_get_next_mapent.  */
 
@@ -1063,7 +1044,6 @@
   return _bfd_generic_get_elt_at_index(abfd, index);
 }
 
-
 /* ???
    -> bfd_generic_stat_arch_elt  */
 
@@ -1078,7 +1058,6 @@
   return bfd_generic_stat_arch_elt(abfd, stat);
 }
 
-
 /* This is a new function in bfd 2.5  */
 
 static boolean
@@ -1105,10 +1084,9 @@
 #if VMS_DEBUG
   vms_debug (1, "vms_get_symtab_upper_bound(%p), %d symbols\n", abfd, PRIV(gsd_sym_count));
 #endif
-  return (PRIV(gsd_sym_count)+1) * sizeof(asymbol *);
+  return (PRIV(gsd_sym_count)+1) * sizeof (asymbol *);
 }
 
-
 /* Copy symbols from hash table to symbol vector
 
    called from bfd_hash_traverse in vms_get_symtab
@@ -1129,7 +1107,6 @@
   return true;
 }
 
-
 /* Read the symbols from the BFD abfd, and fills in the vector
    location with pointers to the symbols and a trailing NULL.
 
@@ -1157,7 +1134,6 @@
   return PRIV(gsd_sym_count);
 }
 
-
 /* Create a new asymbol structure for the BFD abfd and return a pointer
    to it.
    This routine is necessary because each back end has private information
@@ -1168,7 +1144,7 @@
 _bfd_vms_make_empty_symbol (abfd)
      bfd *abfd;
 {
-  asymbol *symbol = (asymbol *)bfd_zalloc(abfd, sizeof(asymbol));
+  asymbol *symbol = (asymbol *)bfd_zalloc(abfd, sizeof (asymbol));
 
 #if VMS_DEBUG
   vms_debug (1, "_bfd_vms_make_empty_symbol(%p)\n", abfd);
@@ -1184,7 +1160,6 @@
   return symbol;
 }
 
-
 /* Print symbol to file according to how. how is one of
    bfd_print_symbol_name	just print the name
    bfd_print_symbol_more	print more (???)
@@ -1205,7 +1180,7 @@
     {
       case bfd_print_symbol_name:
       case bfd_print_symbol_more:
-	fprintf((FILE *)file," %s", symbol->name);
+	fprintf ((FILE *)file," %s", symbol->name);
       break;
 
       break;
@@ -1216,14 +1191,13 @@
 
 	  bfd_print_symbol_vandf((PTR)file,symbol);
 
-	  fprintf((FILE *)file," %-8s %s", section_name, symbol->name);
+	  fprintf ((FILE *)file," %-8s %s", section_name, symbol->name);
         }
       break;
     }
   return;
 }
 
-
 /* Return information about symbol in ret.
 
    fill type, value and name
@@ -1281,7 +1255,6 @@
   return;
 }
 
-
 /* Return true if the given symbol sym in the BFD abfd is
    a compiler generated local label, else return false.  */
 
@@ -1296,7 +1269,6 @@
   return name[0] == '$';
 }
 
-
 /* Get source line number for symbol  */
 
 static alent *
@@ -1310,7 +1282,6 @@
   return 0;
 }
 
-
 /* Provided a BFD, a section and an offset into the section, calculate and
    return the name of the source file and the line nearest to the wanted
    location.  */
@@ -1332,7 +1303,6 @@
   return false;
 }
 
-
 /* Back-door to allow format-aware applications to create debug symbols
    while using BFD for everything else.  Currently used by the assembler
    when creating COFF files.  */
@@ -1349,7 +1319,6 @@
   return 0;
 }
 
-
 /* Read minisymbols.  For minisymbols, we use the unmodified a.out
    symbols.  The minisymbol_to_symbol function translates these into
    BFD asymbol structures.  */
@@ -1401,7 +1370,6 @@
   return -1L;
 }
 
-
 /* Call the back end associated with the open BFD abfd and translate the
    external form of the relocation information attached to sec into the
    internal canonical form.  Place the table into memory at loc, which has
@@ -1710,7 +1678,6 @@
   return &alpha_howto_table[alpha_type];
 }
 
-
 /*-- Part 4.7, writing an object file ---------------------------------------*/
 
 /* Set the architecture and machine type in BFD abfd to arch and mach.
@@ -1731,7 +1698,6 @@
   return true;
 }
 
-
 /* Sets the contents of the section section in BFD abfd to the data starting
    in memory at data. The data is written to the output section starting at
    offset offset for count bytes.
@@ -1757,7 +1723,6 @@
   return _bfd_save_vms_section(abfd, section, location, offset, count);
 }
 
-
 /*-- Part 4.8, linker -------------------------------------------------------*/
 
 /* Get the size of the section headers.  */
@@ -1773,7 +1738,6 @@
   return 0;
 }
 
-
 /* Provides default handling of relocation effort for back ends
    which can't be bothered to do it efficiently.  */
 
@@ -1794,7 +1758,6 @@
   return 0;
 }
 
-
 /* ???  */
 
 static boolean
@@ -1822,7 +1785,6 @@
   return true;
 }
 
-
 /* Create a hash table for the linker.  Different backends store
    different information in this table.  */
 
@@ -1836,7 +1798,6 @@
   return 0;
 }
 
-
 /* Add symbols from this object file into the hash table.  */
 
 static boolean
@@ -1850,7 +1811,6 @@
   return false;
 }
 
-
 /* Do a link based on the link_order structures attached to each
    section of the BFD.  */
 
@@ -1903,7 +1863,6 @@
   return 0;
 }
 
-
 /* Read in the dynamic symbols.  */
 
 static long
@@ -1917,7 +1876,6 @@
   return 0L;
 }
 
-
 /* Get the amount of memory required to hold the dynamic relocs.  */
 
 static long
@@ -1930,7 +1888,6 @@
   return 0L;
 }
 
-
 /* Read in the dynamic relocs.  */
 
 static long
diff --git a/bfd/vms.h b/bfd/vms.h
index 7143986..943b4ea 100644
--- a/bfd/vms.h
+++ b/bfd/vms.h
@@ -23,7 +23,6 @@
 #ifndef VMS_H
 #define VMS_H
 
-
 /* Constants starting with 'Exxx_' are for openVMS/Alpha (EVAX object language)  */
 
 /* VMS Text, information and relocation record (TIR/ETIR) definitions.  */
@@ -531,7 +530,6 @@
   char *hdr_c_ttl;
 };
 
-
 /* vms end of module  */
 
 struct eom_struc {
diff --git a/bfd/xcoff-target.h b/bfd/xcoff-target.h
index a103ac9..18084e6 100644
--- a/bfd/xcoff-target.h
+++ b/bfd/xcoff-target.h
@@ -57,7 +57,6 @@
 #undef CORE_FILE_P
 #define CORE_FILE_P rs6000coff_core_p
 extern const bfd_target * rs6000coff_core_p ();
-extern boolean rs6000coff_get_section_contents ();
 extern boolean rs6000coff_core_file_matches_executable_p ();
 
 #undef	coff_core_file_matches_executable_p
@@ -71,9 +70,6 @@
 extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd));
 #undef coff_core_file_failing_signal
 #define coff_core_file_failing_signal rs6000coff_core_file_failing_signal
-
-#undef	coff_get_section_contents
-#define	coff_get_section_contents	rs6000coff_get_section_contents
 #endif /* AIX_CORE */
 
 #ifdef LYNX_CORE
@@ -155,7 +151,7 @@
 const bfd_target TARGET_SYM =
 {
   TARGET_NAME,
-  bfd_target_coff_flavour,
+  bfd_target_xcoff_flavour,
   BFD_ENDIAN_BIG,		/* data byte order is big */
   BFD_ENDIAN_BIG,		/* header byte order is big */
 
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index 17517b0..3ab7dfc 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -29,15 +29,6 @@
 
 #define STRING_SIZE_SIZE (4)
 
-/* In order to support linking different object file formats into an
-   XCOFF format, we need to be able to determine whether a particular
-   bfd_target is an XCOFF vector.  FIXME: We need to rethink this
-   whole approach.  */
-#define XCOFF_XVECP(xv) \
-  (strcmp ((xv)->name, "aixcoff-rs6000") == 0 \
-   || strcmp ((xv)->name, "aixcoff64-rs6000") == 0 \
-   || strcmp ((xv)->name, "xcoff-powermac") == 0)
-
 /* Get the XCOFF hash table entries for a BFD.  */
 #define obj_xcoff_sym_hashes(bfd) \
   ((struct xcoff_link_hash_entry **) obj_coff_sym_hashes (bfd))
@@ -76,8 +67,7 @@
 
 /* The remaining words of global linkage code.  */
 
-static unsigned long xcoff_glink_code[] =
-{
+static unsigned long xcoff_glink_code[] = {
   0x90410014,	/* stw r2,20(r1) */
   0x800c0000,	/* lwz r0,0(r12) */
   0x804c0004,	/* lwz r2,4(r12) */
@@ -99,8 +89,7 @@
 /* The ldhdr structure.  This appears at the start of the .loader
    section.  */
 
-struct internal_ldhdr
-{
+struct internal_ldhdr {
   /* The version number: currently always 1.  */
   unsigned long l_version;
   /* The number of symbol table entries.  */
@@ -121,8 +110,7 @@
   bfd_size_type l_stoff;
 };
 
-struct external_ldhdr
-{
+struct external_ldhdr {
   bfd_byte l_version[4];
   bfd_byte l_nsyms[4];
   bfd_byte l_nreloc[4];
@@ -138,21 +126,18 @@
 /* The ldsym structure.  This is used to represent a symbol in the
    .loader section.  */
 
-struct internal_ldsym
-{
-  union
-    {
-      /* The symbol name if <= SYMNMLEN characters.  */
-      char _l_name[SYMNMLEN];
-      struct
-	{
-	  /* Zero if the symbol name is more than SYMNMLEN characters.  */
-	  long _l_zeroes;
-	  /* The offset in the string table if the symbol name is more
-             than SYMNMLEN characters.  */
-	  long _l_offset;
-	} _l_l;
-    } _l;
+struct internal_ldsym {
+  union {
+    /* The symbol name if <= SYMNMLEN characters.  */
+    char _l_name[SYMNMLEN];
+    struct {
+      /* Zero if the symbol name is more than SYMNMLEN characters.  */
+      long _l_zeroes;
+      /* The offset in the string table if the symbol name is more
+	 than SYMNMLEN characters.  */
+      long _l_offset;
+    } _l_l;
+  } _l;
   /* The symbol value.  */
   bfd_vma l_value;
   /* The symbol section number.  */
@@ -167,17 +152,14 @@
   bfd_size_type l_parm;
 };
 
-struct external_ldsym
-{
-  union
-    {
-      bfd_byte _l_name[SYMNMLEN];
-      struct
-	{
-	  bfd_byte _l_zeroes[4];
-	  bfd_byte _l_offset[4];
-	} _l_l;
-    } _l;
+struct external_ldsym {
+  union {
+    bfd_byte _l_name[SYMNMLEN];
+    struct {
+      bfd_byte _l_zeroes[4];
+      bfd_byte _l_offset[4];
+    } _l_l;
+  } _l;
   bfd_byte l_value[4];
   bfd_byte l_scnum[2];
   bfd_byte l_smtype[1];
@@ -201,8 +183,7 @@
 /* The ldrel structure.  This is used to represent a reloc in the
    .loader section.  */
 
-struct internal_ldrel
-{
+struct internal_ldrel {
   /* The reloc address.  */
   bfd_vma l_vaddr;
   /* The symbol table index in the .loader section symbol table.  */
@@ -213,8 +194,7 @@
   short l_rsecnm;
 };
 
-struct external_ldrel
-{
+struct external_ldrel {
   bfd_byte l_vaddr[4];
   bfd_byte l_symndx[4];
   bfd_byte l_rtype[2];
@@ -225,8 +205,7 @@
 
 /* The list of import files.  */
 
-struct xcoff_import_file
-{
+struct xcoff_import_file {
   /* The next entry in the list.  */
   struct xcoff_import_file *next;
   /* The path.  */
@@ -239,8 +218,7 @@
 
 /* An entry in the XCOFF linker hash table.  */
 
-struct xcoff_link_hash_entry
-{
+struct xcoff_link_hash_entry {
   struct bfd_link_hash_entry root;
 
   /* Symbol index in output file.  Set to -1 initially.  Set to -2 if
@@ -251,15 +229,14 @@
      section which holds it.  */
   asection *toc_section;
 
-  union
-    {
-      /* If we have created a TOC entry (the XCOFF_SET_TOC flag is
-	 set), this is the offset in toc_section.  */
-      bfd_vma toc_offset;
-      /* If the TOC entry comes from an input file, this is set to the
-         symbol index of the C_HIDEXT XMC_TC or XMC_TD symbol.  */
-      long toc_indx;
-    } u;
+  union {
+    /* If we have created a TOC entry (the XCOFF_SET_TOC flag is set),
+       this is the offset in toc_section.  */
+    bfd_vma toc_offset;
+    /* If the TOC entry comes from an input file, this is set to the
+       symbol index of the C_HIDEXT XMC_TC or XMC_TD symbol.  */
+    long toc_indx;
+  } u;
 
   /* If this symbol is a function entry point which is called, this
      field holds a pointer to the function descriptor.  If this symbol
@@ -312,8 +289,7 @@
 
 /* The XCOFF linker hash table.  */
 
-struct xcoff_link_hash_table
-{
+struct xcoff_link_hash_table {
   struct bfd_link_hash_table root;
 
   /* The .debug string hash table.  We need to compute this while
@@ -358,12 +334,11 @@
   boolean gc;
 
   /* A linked list of symbols for which we have size information.  */
-  struct xcoff_link_size_list
-    {
-      struct xcoff_link_size_list *next;
-      struct xcoff_link_hash_entry *h;
-      bfd_size_type size;
-    } *size_list;
+  struct xcoff_link_size_list {
+    struct xcoff_link_size_list *next;
+    struct xcoff_link_hash_entry *h;
+    bfd_size_type size;
+  } *size_list;
 
   /* Magic sections: _text, _etext, _data, _edata, _end, end.  */
   asection *special_sections[6];
@@ -372,8 +347,7 @@
 /* Information we keep for each section in the output file during the
    final link phase.  */
 
-struct xcoff_link_section_info
-{
+struct xcoff_link_section_info {
   /* The relocs to be output.  */
   struct internal_reloc *relocs;
   /* For each reloc against a global symbol whose index was not known
@@ -383,18 +357,16 @@
      index of the TOC symbol is not known when the reloc was handled,
      an entry is added to this linked list.  This is not an array,
      like rel_hashes, because this case is quite uncommon.  */
-  struct xcoff_toc_rel_hash
-    {
-      struct xcoff_toc_rel_hash *next;
-      struct xcoff_link_hash_entry *h;
-      struct internal_reloc *rel;
-    } *toc_rel_hashes;
+  struct xcoff_toc_rel_hash {
+    struct xcoff_toc_rel_hash *next;
+    struct xcoff_link_hash_entry *h;
+    struct internal_reloc *rel;
+  } *toc_rel_hashes;
 };
 
 /* Information that we pass around while doing the final link step.  */
 
-struct xcoff_final_link_info
-{
+struct xcoff_final_link_info {
   /* General link information.  */
   struct bfd_link_info *info;
   /* Output BFD.  */
@@ -793,18 +765,18 @@
 /* The typical dynamic reloc.  */
 
 static reloc_howto_type xcoff_dynamic_reloc =
-  HOWTO (0,	                /* type */                                 
-	 0,	                /* rightshift */                           
-	 2,	                /* size (0 = byte, 1 = short, 2 = long) */ 
-	 32,	                /* bitsize */                   
-	 false,	                /* pc_relative */                          
-	 0,	                /* bitpos */                               
+  HOWTO (0,	                /* type */
+	 0,	                /* rightshift */
+	 2,	                /* size (0 = byte, 1 = short, 2 = long) */
+	 32,	                /* bitsize */
+	 false,	                /* pc_relative */
+	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 0,		        /* special_function */                     
-	 "R_POS",               /* name */                                 
-	 true,	                /* partial_inplace */                      
-	 0xffffffff,            /* src_mask */                             
-	 0xffffffff,            /* dst_mask */                             
+	 0,		        /* special_function */
+	 "R_POS",               /* name */
+	 true,	                /* partial_inplace */
+	 0xffffffff,            /* src_mask */
+	 0xffffffff,            /* dst_mask */
 	 false);                /* pcrel_offset */
 
 /* Get the dynamic relocs.  */
@@ -1895,12 +1867,11 @@
 	     the csect storage mapping class, so that the linker can
 	     accumulate similar csects together.  */
 	  {
-	    static const char *csect_name_by_class[] =
-	      {
-		".pr", ".ro", ".db", ".tc", ".ua", ".rw", ".gl", ".xo",
-		".sv", ".bs", ".ds", ".uc", ".ti", ".tb", NULL, ".tc0",
-		".td"
-	      };
+	    static const char *csect_name_by_class[] = {
+	      ".pr", ".ro", ".db", ".tc", ".ua", ".rw", ".gl", ".xo",
+	      ".sv", ".bs", ".ds", ".uc", ".ti", ".tb", NULL, ".tc0",
+	      ".td"
+	    };
 	    const char *csect_name;
 	    asection *enclosing;
 
@@ -2290,7 +2261,7 @@
 	      else
 		{
 		  (*sym_hash)->root.u.c.p->alignment_power
-		     = csect->alignment_power;
+		    = csect->alignment_power;
 		}
 	    }
 
@@ -2405,7 +2376,7 @@
 
 	  /* Reset SEC_RELOC and the reloc_count, since the reloc
 	     information is now attached to the csects.  */
-	  o->flags &=~ SEC_RELOC;
+	  o->flags &= ~SEC_RELOC;
 	  o->reloc_count = 0;
 
 	  /* If we are not keeping memory, free the reloc information.  */
@@ -2916,7 +2887,7 @@
   struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
   struct xcoff_link_size_list *n;
 
-  if (! XCOFF_XVECP (output_bfd->xvec))
+  if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
     return true;
 
   /* This will hardly ever be called.  I don't want to burn four bytes
@@ -2952,7 +2923,7 @@
 {
   struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
 
-  if (! XCOFF_XVECP (output_bfd->xvec))
+  if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
     return true;
 
   /* A symbol name which starts with a period is the code for a
@@ -3066,7 +3037,7 @@
 {
   struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
 
-  if (! XCOFF_XVECP (output_bfd->xvec))
+  if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
     return true;
 
   h->flags |= XCOFF_EXPORT;
@@ -3131,7 +3102,7 @@
 {
   struct xcoff_link_hash_entry *h;
 
-  if (! XCOFF_XVECP (output_bfd->xvec))
+  if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
     return true;
 
   h = ((struct xcoff_link_hash_entry *)
@@ -3146,7 +3117,7 @@
 
   h->flags |= XCOFF_REF_REGULAR | XCOFF_LDREL;
   ++xcoff_hash_table (info)->ldrel_count;
-  
+
   /* Mark the symbol to avoid garbage collection.  */
   if (! xcoff_mark_symbol (info, h))
     return false;
@@ -3165,7 +3136,7 @@
 {
   struct xcoff_link_hash_entry *h;
 
-  if (! XCOFF_XVECP (output_bfd->xvec))
+  if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
     return true;
 
   h = xcoff_link_hash_lookup (xcoff_hash_table (info), name, true, true,
@@ -3181,8 +3152,7 @@
 /* This structure is used to pass information through
    xcoff_link_hash_traverse.  */
 
-struct xcoff_loader_info
-{
+struct xcoff_loader_info {
   /* Set if a problem occurred.  */
   boolean failed;
   /* Output BFD.  */
@@ -3250,7 +3220,7 @@
   struct bfd_strtab_hash *debug_strtab;
   bfd_byte *debug_contents = NULL;
 
-  if (! XCOFF_XVECP (output_bfd->xvec))
+  if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour)
     {
       for (i = 0; i < 6; i++)
 	special_sections[i] = NULL;
@@ -4102,7 +4072,7 @@
 	  finfo.section_info[o->target_index].rel_hashes =
 	    ((struct xcoff_link_hash_entry **)
 	     bfd_malloc (o->reloc_count
-		     * sizeof (struct xcoff_link_hash_entry *)));
+			 * sizeof (struct xcoff_link_hash_entry *)));
 	  if (finfo.section_info[o->target_index].relocs == NULL
 	      || finfo.section_info[o->target_index].rel_hashes == NULL)
 	    goto error_return;
@@ -4688,21 +4658,39 @@
 	  else
 	    {
 	      bfd_vma tocval, tocend;
+	      bfd *inp;
 
 	      tocval = ((*csectpp)->output_section->vma
 			+ (*csectpp)->output_offset
 			+ isym.n_value
 			- (*csectpp)->vma);
+
 	      /* We want to find out if tocval is a good value to use
                  as the TOC anchor--that is, whether we can access all
                  of the TOC using a 16 bit offset from tocval.  This
                  test assumes that the TOC comes at the end of the
                  output section, as it does in the default linker
-                 script.  FIXME: This doesn't handle .tocbss sections
-                 created from XMC_TD common symbols correctly.  */
-
+                 script.  */
 	      tocend = ((*csectpp)->output_section->vma
 			+ (*csectpp)->output_section->_raw_size);
+	      for (inp = finfo->info->input_bfds;
+		   inp != NULL;
+		   inp = inp->link_next)
+		{
+		  asection *o;
+
+		  for (o = inp->sections; o != NULL; o = o->next)
+		    if (strcmp (o->name, ".tocbss") == 0)
+		      {
+			bfd_vma new_toc_end;
+			new_toc_end = (o->output_section->vma
+				       + o->output_offset
+				       + o->_cooked_size);
+			if (new_toc_end > tocend)
+			  tocend = new_toc_end;
+		      }
+
+		}
 
 	      if (tocval + 0x10000 < tocend)
 		{
@@ -6335,7 +6323,7 @@
 	  addend = 0;
 	}
       else
-	{    
+	{
 	  h = obj_xcoff_sym_hashes (input_bfd)[symndx];
 	  sym = syms + symndx;
 	  addend = - sym->n_value;
@@ -6586,13 +6574,14 @@
 	      || strcmp (h->root.root.string, "._ptrgl") == 0)
 	    {
 	      if (next == 0x4def7b82		/* cror 15,15,15 */
-		  || next == 0x4ffffb82)	/* cror 31,31,31 */
+		  || next == 0x4ffffb82		/* cror 31,31,31 */
+		  || next == 0x60000000)	/* ori r0,r0,0 */
 		bfd_put_32 (input_bfd, 0x80410014, pnext); /* lwz r1,20(r1) */
 	    }
 	  else
 	    {
 	      if (next == 0x80410014)		/* lwz r1,20(r1) */
-		bfd_put_32 (input_bfd, 0x4ffffb82, pnext); /* cror 31,31,31 */
+		bfd_put_32 (input_bfd, 0x60000000, pnext); /* ori r0,r0,0 */
 	    }
 	}
 
diff --git a/config-ml.in b/config-ml.in
index 503f7cf..c968bf0 100644
--- a/config-ml.in
+++ b/config-ml.in
@@ -280,6 +280,17 @@
 	    esac
 	  done
 	fi
+	if [ x"$enable_nofmult" = xno ]
+	then
+	  old_multidirs="${multidirs}"
+	  multidirs=""
+	  for x in ${old_multidirs}; do
+	    case "$x" in
+	      *nofmult* ) : ;;
+	      *) multidirs="${multidirs} ${x}" ;;
+	    esac
+	  done
+	fi
 	;;
 m68*-*-*)
 	if [ x$enable_softfloat = xno ]
@@ -362,6 +373,28 @@
 	    esac
 	  done
 	fi
+	case " $multidirs " in
+	*" mabi=64 "*)
+	  # We will not be able to create libraries with -mabi=64 if
+	  # we cannot even link a trivial program.  It usually
+	  # indicates the 64bit libraries are missing.
+	  if echo 'main() {}' > conftest.c &&
+	     ${CC-gcc} -mabi=64 conftest.c -o conftest; then
+	    :
+	  else
+	    echo Could not link program with -mabi=64, disabling it.
+	    old_multidirs="${multidirs}"
+	    multidirs=""
+	    for x in ${old_multidirs}; do
+	      case "$x" in
+	      *mabi=64* ) : ;;
+	      *) multidirs="${multidirs} ${x}" ;;
+	      esac
+	    done
+	  fi
+	  rm -f conftest.c conftest
+	  ;;
+	esac
 	;;
 powerpc*-*-* | rs6000*-*-*)
 	if [ x$enable_softfloat = xno ]
@@ -442,6 +475,30 @@
 	  done
 	fi
 	;;
+sparc*-*-*)
+	case " $multidirs " in
+	*" m64 "*)
+	  # We will not be able to create libraries with -m64 if
+	  # we cannot even link a trivial program.  It usually
+	  # indicates the 64bit libraries are missing.
+	  if echo 'main() {}' > conftest.c &&
+	     ${CC-gcc} -m64 conftest.c -o conftest; then
+	    :
+	  else
+	    echo Could not link program with -m64, disabling it.
+	    old_multidirs="${multidirs}"
+	    multidirs=""
+	    for x in ${old_multidirs}; do
+	      case "$x" in
+	      *m64* ) : ;;
+	      *) multidirs="${multidirs} ${x}" ;;
+	      esac
+	    done
+	  fi
+	  rm -f conftest.c conftest
+	  ;;
+	esac
+	;;
 esac
 
 # Remove extraneous blanks from multidirs.
@@ -472,6 +529,8 @@
 		flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
 		if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \
 				CFLAGS="$(CFLAGS) $${flags}" \
+				prefix="$(prefix)" \
+				exec_prefix="$(exec_prefix)" \
 				CXXFLAGS="$(CXXFLAGS) $${flags}" \
 				LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
 				LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
@@ -615,7 +674,24 @@
       echo "pwd: `pwd`"
     fi
 
-    if [ -d ${ml_dir} ]; then true; else mkdir ${ml_dir}; fi
+    if [ -d ${ml_dir} ]; then true; else
+      # ``mkdir -p ${ml_dir}'' See also mkinstalldirs.
+      pathcomp=""
+      for d in `echo ":${ml_dir}" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`; do
+        pathcomp="$pathcomp$d"
+        case "$pathcomp" in
+          -* ) pathcomp=./$pathcomp ;;
+        esac
+        if test ! -d "$pathcomp"; then
+           echo "mkdir $pathcomp" 1>&2
+           mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
+        fi
+        if test ! -d "$pathcomp"; then
+	   exit $lasterr
+        fi
+        pathcomp="$pathcomp/"
+      done
+    fi
     if [ -d ${ml_dir}/${ml_libdir} ]; then true; else mkdir ${ml_dir}/${ml_libdir}; fi
 
     # Eg: if ${ml_dir} = m68000/m68881, dotdot = ../../
@@ -666,9 +742,86 @@
     cd ${ml_dir}/${ml_libdir}
 
     if [ -f ${ml_newsrcdir}/configure ]; then
-      ml_recprog=${ml_newsrcdir}/configure
+      ml_recprog="${ml_newsrcdir}/configure --cache-file=../config.cache"
     fi
-    if eval ${ml_config_shell} ${ml_recprog} \
+
+    # find compiler flag corresponding to ${ml_dir}
+    for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do 
+      dir=`echo $i | sed -e 's/;.*$//'`
+      if [ "${dir}" = "${ml_dir}" ]; then
+        flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
+        break
+      fi
+    done
+    ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags"'
+
+    if [ "${with_target_subdir}" = "." ]; then
+	CC_=$CC' '
+	CXX_=$CXX' '
+    else
+	# Create a regular expression that matches any string as long
+	# as ML_POPDIR.
+	popdir_rx=`echo ${ML_POPDIR} | sed 's,.,.,g'`
+	CC_=
+	for arg in ${CC}; do
+	  case $arg in
+	  -[BIL]"${ML_POPDIR}"/*)
+	    CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\1/p"`' ' ;;
+	  "${ML_POPDIR}"/*)
+	    CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
+	  *)
+	    CC_="${CC_}${arg} " ;;
+	  esac
+	done
+
+	CXX_=
+	for arg in ${CXX}; do
+	  case $arg in
+	  -[BIL]"${ML_POPDIR}"/*)
+	    CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
+	  "${ML_POPDIR}"/*)
+	    CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
+	  *)
+	    CXX_="${CXX_}${arg} " ;;
+	  esac
+	done
+
+	if test "x${LD_LIBRARY_PATH+set}" = xset; then
+	  LD_LIBRARY_PATH_=
+	  for arg in `echo "$LD_LIBRARY_PATH" | tr ':' ' '`; do
+	    case "$arg" in
+	    "${ML_POPDIR}"/*)
+	      arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`
+	      ;;
+	    esac
+	    if test "x$LD_LIBRARY_PATH_" != x; then
+	      LD_LIBRARY_PATH_=$LD_LIBRARY_PATH_:$arg
+	    else
+	      LD_LIBRARY_PATH_=$arg
+	    fi
+          done
+	  ml_config_env="$ml_config_env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_"
+	fi
+
+	if test "x${SHLIB_PATH+set}" = xset; then
+	  SHLIB_PATH_=
+	  for arg in `echo "$SHLIB_PATH" | tr ':' ' '`; do
+	    case "$arg" in
+	    "${ML_POPDIR}"/*)
+	      arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`
+	      ;;
+	    esac
+	    if test "x$SHLIB_PATH_" != x; then
+	      SHLIB_PATH_=$SHLIB_PATH_:$arg
+	    else
+	      SHLIB_PATH_=$arg
+	    fi
+          done
+	  ml_config_env="$ml_config_env SHLIB_PATH=$SHLIB_PATH_"
+	fi
+    fi
+
+    if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \
 	--with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \
 	${ml_arguments} ${ml_srcdiroption} ; then
       true
diff --git a/config.guess b/config.guess
index b4faaed..08e8a75 100755
--- a/config.guess
+++ b/config.guess
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
 #   Free Software Foundation, Inc.
 
-version='2000-05-30'
+version='2000-09-05'
 
 # 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
@@ -119,7 +119,7 @@
 	# object file format.
 	# Determine the machine/vendor (is the vendor relevant).
 	case "${UNAME_MACHINE}" in
-	    amiga) machine=m68k-cbm ;;
+	    amiga) machine=m68k-unknown ;;
 	    arm32) machine=arm-unknown ;;
 	    atari*) machine=m68k-atari ;;
 	    sun3*) machine=m68k-sun ;;
@@ -215,7 +215,7 @@
 	echo alpha-dec-winnt3.5
 	exit 0 ;;
     Amiga*:UNIX_System_V:4.0:*)
-	echo m68k-cbm-sysv4
+	echo m68k-unknown-sysv4
 	exit 0;;
     amiga:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
@@ -669,6 +669,9 @@
     i*:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit 0 ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit 0 ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -687,6 +690,9 @@
     *:GNU:*:*)
 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit 0 ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit 0 ;;
     *:Linux:*:*)
 
 	# The BFD linker knows what the default object file format is, so
@@ -709,8 +715,7 @@
 		exit 0
 		;;
 	  elf_i?86)
-		echo "${UNAME_MACHINE}-pc-linux"
-		exit 0
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
 		;;
 	  i?86coff)
 		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
@@ -853,6 +858,8 @@
 	  rm -f $dummy.c $dummy
 	elif test "${UNAME_MACHINE}" = "s390"; then
 	  echo s390-ibm-linux && exit 0
+	elif test "${UNAME_MACHINE}" = "x86_64"; then
+	  echo x86_64-unknown-linux-gnu && exit 0
 	else
 	  # Either a pre-BFD a.out linker (linux-gnuoldld)
 	  # or one that does not give us useful --help.
@@ -897,6 +904,7 @@
 EOF
 	  $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
 	  rm -f $dummy.c $dummy
+	  test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
 	fi ;;
 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
 # are messed up and put the nodename in both sysname and nodename.
@@ -1033,7 +1041,7 @@
     mc68*:A/UX:*:*)
 	echo m68k-apple-aux${UNAME_RELEASE}
 	exit 0 ;;
-    news*:NEWS-OS:*:6*)
+    news*:NEWS-OS:6*:*)
 	echo mips-sony-newsos6
 	exit 0 ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
@@ -1076,7 +1084,7 @@
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit 0 ;;
-    NSR-W:NONSTOP_KERNEL:*:*)
+    NSR-[KW]:NONSTOP_KERNEL:*:*)
 	echo nsr-tandem-nsk${UNAME_RELEASE}
 	exit 0 ;;
     BS2000:POSIX*:*:*)
@@ -1085,6 +1093,17 @@
     DS/*:UNIX_System_V:*:*)
 	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
 	exit 0 ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit 0 ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
diff --git a/config.if b/config.if
index bcc0269..625a407 100644
--- a/config.if
+++ b/config.if
@@ -21,9 +21,15 @@
   if_topsrcdir=${top_srcdir}
 fi
 
-if [ -f ${if_topsrcdir}/libstdc++/Makefile.in ]; then
+if [ "${enable_libstdcxx_v3}" = "yes" ] ; then
+  libstdcxx_srcdir=${if_topsrcdir}/libstdc++-v3
+else
+  libstdcxx_srcdir=${if_topsrcdir}/libstdc++
+fi
+
+if [ -f ${libstdcxx_srcdir}/Makefile.in ]; then
 # We check libstdc++ for libstdcxx_interface.
-libstdcxx_interface=`grep "^INTERFACE" ${if_topsrcdir}/libstdc++/Makefile.in | sed 's/INTERFACE[ 	]*=[ 	]*\(.*\)/\1/'`
+libstdcxx_interface=`grep "^INTERFACE" ${libstdcxx_srcdir}/Makefile.in | sed 's/INTERFACE[ 	]*=[ 	]*\(.*\)/\1/'`
 else
 libstdcxx_interface=
 fi
diff --git a/config.sub b/config.sub
index f414a43..f8d46e4 100755
--- a/config.sub
+++ b/config.sub
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
 #   Free Software Foundation, Inc.
 
-version='2000-05-30'
+version='2000-11-02'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -29,7 +29,6 @@
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
-# Written by Per Bothner <bothner@cygnus.com>.
 # Please send patches to <config-patches@gnu.org>.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
@@ -106,7 +105,7 @@
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu*)
+  nto-qnx* | linux-gnu* | storm-chaos*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -132,7 +131,7 @@
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple)
+	-apple | -axis)
 		os=
 		basic_machine=$1
 		;;
@@ -146,6 +145,14 @@
 		os=-vxworks
 		basic_machine=$1
 		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
 	-hiux*)
 		os=-hiuxwe2
 		;;
@@ -204,30 +211,37 @@
 case $basic_machine in
 	# Recognize the basic CPU types without company name.
 	# Some are omitted here because they have special meanings below.
-	tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
-		| arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
+	tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \
+	        | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \
+		| pyramid | mn10200 | mn10300 | tron | a29k \
 		| 580 | i960 | h8300 \
-		| x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \
+		| x86 | ppcbe | mipsbe | mipsle | shbe | shle \
 		| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
 		| hppa64 \
 		| alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
 		| alphaev6[78] \
-		| we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
+		| we32k | ns16k | clipper | i370 | sh | sh[34] \
+		| powerpc | powerpcle \
 		| 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
 		| mips64orion | mips64orionel | mipstx39 | mipstx39el \
 		| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
 		| mips64vr5000 | miprs64vr5000el | mcore \
 		| sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
-		| thumb | d10v | fr30 | avr)
+		| thumb | d10v | d30v | fr30 | avr)
 		basic_machine=$basic_machine-unknown
 		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
 	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
 		;;
 
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
-	i[34567]86)
+	i[234567]86 | x86_64)
 	  basic_machine=$basic_machine-pc
 	  ;;
 	# Object if more than one company name word.
@@ -237,12 +251,13 @@
 		;;
 	# Recognize the basic CPU types with company name.
 	# FIXME: clean up the formatting here.
-	vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
-	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
+	vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
+	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \
+	      | arm-*  | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \
 	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
 	      | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
 	      | xmp-* | ymp-* \
-	      | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \
+	      | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \
 	      | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
 	      | hppa2.0n-* | hppa64-* \
 	      | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
@@ -254,10 +269,10 @@
 	      | mips64el-* | mips64orion-* | mips64orionel-* \
 	      | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
 	      | mipstx39-* | mipstx39el-* | mcore-* \
-	      | f301-* | armv*-* | s390-* | sv1-* | t3e-* \
+	      | f301-* | s390-* | sv1-* | t3e-* \
 	      | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
 	      | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
-	      | bs2000-*)
+	      | bs2000-* | tic54x-* | c54x-* | x86_64-*)
 		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
@@ -294,14 +309,14 @@
 		os=-sysv
 		;;
 	amiga | amiga-*)
-		basic_machine=m68k-cbm
+		basic_machine=m68k-unknown
 		;;
 	amigaos | amigados)
-		basic_machine=m68k-cbm
+		basic_machine=m68k-unknown
 		os=-amigaos
 		;;
 	amigaunix | amix)
-		basic_machine=m68k-cbm
+		basic_machine=m68k-unknown
 		os=-sysv4
 		;;
 	apollo68)
@@ -355,6 +370,9 @@
 	crds | unos)
 		basic_machine=m68k-crds
 		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
 	da30 | da30-*)
 		basic_machine=m68k-da30
 		;;
@@ -509,6 +527,10 @@
 		basic_machine=i386-unknown
 		os=-mingw32
 		;;
+	i[34567]86-pw32 | pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
 	iris | iris4d)
 		basic_machine=mips-sgi
 		case $os in
@@ -666,7 +688,7 @@
 	pentium | p5 | k5 | k6 | nexen)
 		basic_machine=i586-pc
 		;;
-	pentiumpro | p6 | 6x86)
+	pentiumpro | p6 | 6x86 | athlon)
 		basic_machine=i686-pc
 		;;
 	pentiumii | pentium2)
@@ -675,7 +697,7 @@
 	pentium-* | p5-* | k5-* | k6-* | nexen-*)
 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	pentiumpro-* | p6-* | 6x86-*)
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	pentiumii-* | pentium2-*)
@@ -790,6 +812,10 @@
 		basic_machine=t3e-cray
 		os=-unicos
 		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
 	tx39)
 		basic_machine=mipstx39-unknown
 		;;
@@ -891,6 +917,9 @@
 	we32k)
 		basic_machine=we32k-att
 		;;
+	sh3 | sh4)
+		base_machine=sh-unknown
+		;;
 	sparc | sparcv9)
 		basic_machine=sparc-sun
 		;;
@@ -969,10 +998,11 @@
 	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
 	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
-	      | -openstep* | -oskit*)
+	      | -openstep* | -oskit* | -conix* | -pw32* | -storm-chaos*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1033,7 +1063,7 @@
 	-ns2 )
 	        os=-nextstep2
 		;;
-	-nsk)
+	-nsk*)
 		os=-nsk
 		;;
 	# Preserve the version number of sinix5.
diff --git a/config/ChangeLog b/config/ChangeLog
index b5746b1..920ab32 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,16 @@
+Fri Jul 14 18:13:23 2000  Mark P Mitchell  <mark@codesourcery.com>
+
+	* mh-irix6 (CC): Don't set it.
+
+2000-06-21  Branko Cibej  <branko.cibej@hermes.si>
+
+	* mh-sparcpic: Use single instead of double quotes.
+	* mt-sparcpic: Likewise.
+
+2000-06-19  Syd Polk <spolk@redhat.com>
+
+	* acinclude.m4: Updated for Incr Tcl 3.0.
+
 2000-02-23  Linas Vepstas <linas@linas.org>
 
 	* mh-i370pic: New file.
@@ -12,6 +25,10 @@
 	* mh-aix43: Delete, move to mt-aix43.
 	* mt-aix43: New file.
 
+Tue Sep  7 23:31:01 1999  Linas Vepstas  <linas@linas.org>
+
+	* mh-openedition: New file.
+
 1999-04-07  Michael Meissner  <meissner@cygnus.com>
 
 	* mt-d30v: New file, pass -g -Os -Wa,-C as default options.
diff --git a/config/acinclude.m4 b/config/acinclude.m4
index f799ced..6187b5a 100755
--- a/config/acinclude.m4
+++ b/config/acinclude.m4
@@ -1045,6 +1045,7 @@
     AC_SUBST(TCL_RANLIB)
     AC_SUBST(TCL_BUILD_LIB_SPEC)
     AC_SUBST(TCL_LIB_SPEC)
+    AC_SUBST(TCL_BIN_DIR)
 dnl AC_SUBST(TCL_LIB_VERSIONS_OK)
 
 dnl not used, don't export to save symbols
diff --git a/config/mh-ia64pic b/config/mh-ia64pic
new file mode 100644
index 0000000..92e48d9
--- /dev/null
+++ b/config/mh-ia64pic
@@ -0,0 +1 @@
+PICFLAG=-fpic
diff --git a/config/mh-irix6 b/config/mh-irix6
index 6d25c16..e792678 100644
--- a/config/mh-irix6
+++ b/config/mh-irix6
@@ -1,7 +1,3 @@
 # Makefile changes for SGI's running IRIX-6.x.
 SYSV = -DSYSV
 RANLIB = true
-# Specify the ABI, to ensure that all Irix 6 systems will behave the same.
-# Also, using -32 avoids bugs that exist in the n32/n64 support in some
-# versions of the SGI compiler.
-CC = cc -32
diff --git a/config/mh-openedition b/config/mh-openedition
new file mode 100644
index 0000000..e99ef15
--- /dev/null
+++ b/config/mh-openedition
@@ -0,0 +1,2 @@
+RANLIB = true
+CC = c89
diff --git a/config/mh-sparcpic b/config/mh-sparcpic
index f6dbc22..e218bb4 100644
--- a/config/mh-sparcpic
+++ b/config/mh-sparcpic
@@ -1 +1 @@
-PICFLAG=`case "${LIBCFLAGS} ${LIBCXXFLAGS}" in *-fpic* ) echo -fpic ;; * ) echo -fPIC ;; esac`
+PICFLAG=`case '${LIBCFLAGS} ${LIBCXXFLAGS}' in *-fpic* ) echo -fpic ;; * ) echo -fPIC ;; esac`
diff --git a/config/mt-ia64pic b/config/mt-ia64pic
new file mode 100644
index 0000000..ff98727
--- /dev/null
+++ b/config/mt-ia64pic
@@ -0,0 +1 @@
+PICFLAG_FOR_TARGET=-fpic
diff --git a/config/mt-sparcpic b/config/mt-sparcpic
index fd0ec27..a62b38b 100644
--- a/config/mt-sparcpic
+++ b/config/mt-sparcpic
@@ -1 +1 @@
-PICFLAG_FOR_TARGET=`case "${LIBCFLAGS} ${LIBCXXFLAGS}" in *-fpic* ) echo -fpic ;; * ) echo -fPIC ;; esac`
+PICFLAG_FOR_TARGET=`case '${LIBCFLAGS} ${LIBCXXFLAGS}' in *-fpic* ) echo -fpic ;; * ) echo -fPIC ;; esac`
diff --git a/configure b/configure
index 06bd1a1..dfc1762 100755
--- a/configure
+++ b/configure
@@ -237,7 +237,7 @@
 		esac
 
 		enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
-		eval "$enableopt='$optarg'"
+		eval "$enableopt=\$optarg"
 		enableoptions="$enableoptions '$option'"
 		;;
 	--exec-prefix* | --ex*)
@@ -370,7 +370,7 @@
 		esac
 
 		withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
-		eval $withopt="$optarg"
+		eval $withopt="\$optarg"
 		withoptions="$withoptions $option"
 		;;
 	--without-*)
@@ -518,7 +518,8 @@
 
 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
 moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
-topsrcdir=`cd \`dirname ${progname}\`; pwd`
+## the sed command below emulates the dirname command
+topsrcdir=`cd \`echo ${progname} | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'\`; pwd`
 
 
 # this is a hack.  sun4 must always be a valid host alias or this will fail.
@@ -576,7 +577,6 @@
         fi
 esac
 
-
 # default exec_prefix
 case "${exec_prefixoption}" in
 "") exec_prefix="\$(prefix)" ;;
@@ -912,9 +912,10 @@
   tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
   tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
   tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
+  tools="${tools} OBJCOPY OBJDUMP"
 
   for var in ${tools}; do
-    if [ -z "`eval 'echo $'"${var}"`" ] && [ -r Makefile ]; then
+    if eval [ -z \"\$${var}\" ] && [ -r Makefile ]; then
       sed -n -e ':loop
 /\\$/ N
 s/\\\n//g
@@ -923,7 +924,7 @@
 	< Makefile > Makefile.v
       t=`tail -1 Makefile.v`
       if [ -n "${t}" ]; then
-	eval "${var}='${t}'"
+	eval "${var}=\${t}"
       fi
       rm -f Makefile.v
     fi
@@ -955,6 +956,8 @@
   RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
   WINDRES=${WINDRES-${host_alias}-windres}
   WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
+  OBJCOPY=${OBJCOPY-${host_alias}-objcopy}
+  OBJDUMP=${OBJDUMP-${host_alias}-objdump}
 
   if [ -z "${YACC}" ]; then
     IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
@@ -1005,6 +1008,8 @@
   export NM
   export RANLIB
   export WINDRES
+  export OBJCOPY
+  export OBJDUMP
 else
   # If CC is still not set, try to get gcc.
   if [ -z "${CC}" ]; then
@@ -1408,6 +1413,7 @@
                     -e "s:^program_suffix[ 	]*=.*$:program_suffix = ${program_suffix}:" \
                     -e "s:^program_transform_name[ 	]*=.*$:program_transform_name = ${program_transform_name}:" \
                     -e "s|^tooldir[ 	]*=.*$|tooldir = ${tooldir}|" \
+                    -e "s|^build_tooldir[ 	]*=.*$|build_tooldir = ${tooldir}|" \
 		    -e "s:^DEFAULT_YACC[	 ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
 		    -e "s:^DEFAULT_LEX[	 ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
 		    -e "s:^DEFAULT_M4[  ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \
@@ -1420,7 +1426,7 @@
 	    # tools.
 	    if [ "${build}" != "${host}" ]; then
 		for var in ${tools}; do
-		    val=`eval 'echo $'"${var}"`
+		    eval val=\$${var}
 		    sed -e "/^${var}[ 	]*=/{
 			   :loop1
 			   /\\\\$/ N
diff --git a/configure.in b/configure.in
index c14f135..f79d9a3 100644
--- a/configure.in
+++ b/configure.in
@@ -47,10 +47,20 @@
 	host_libs="${host_libs} libgui"
 fi
 
+# Set up configure/Makefile variables if libstdc++-v3 is to be built.
+if [ "${enable_libstdcxx_v3}" = "yes" ] && test -d $srcdir/libstdc++-v3; then
+        libstdcxx_version="target-libstdc++-v3"
+	# Don't use libstdc++-v3's flags to configure/build itself.
+	libstdcxx_flags='`case $$dir in libstdc++-v3) ;; *) cat $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/libstdc++.INC 2>/dev/null || : ;; esac` -L$$r/$(TARGET_SUBDIR)/libstd++-v3/src -L$$r/$(TARGET_SUBDIR)/libstd++-v3/src/.libs'
+else
+        libstdcxx_version="target-libio target-libstdc++"
+        libstdcxx_flags='-isystem $$s/libstdc++ -isystem $$s/libstdc++/std -isystem $$s/libstdc++/stl -isystem $$s/libio/ -isystem $$s/libio/stdio -L$$r/$(TARGET_SUBDIR)/libstdc++'
+fi
+
 # these tools are built for the host environment
 # Note, the powerpc-eabi build depends on sim occurring before gdb in order to
 # know that we are building the simulator.
-host_tools="texinfo byacc flex bison binutils ld gas gcc sim gdb make patch prms send-pr gprof gdbtest tgas etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool ispell grep diff rcs cvssrc fileutils shellutils time textutils wdiff find emacs emacs19 uudecode hello tar gzip indent recode release sed utils guile perl apache inet gawk findutils snavigator libtool gettext zip"
+host_tools="texinfo byacc flex bison binutils ld gas gcc cgen sim gdb make patch prms send-pr gprof gdbtest tgas etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool ispell grep diff rcs cvssrc fileutils shellutils time textutils wdiff find emacs emacs19 uudecode hello tar gzip indent recode release sed utils guile perl apache inet gawk findutils snavigator libtool gettext zip"
 
 # these libraries are built for the target environment, and are built after
 # the host libraries and the host tools (which may be a cross compiler)
@@ -58,10 +68,15 @@
 target_libs="target-libiberty \
 		target-libgloss \
 		target-newlib \
-		target-libio \
-		target-librx \
-		target-libstdc++ \
-		target-libg++"
+		${libstdcxx_version} \
+		target-libf2c \
+		target-libchill \
+		target-libffi \
+		target-libjava \
+		target-zlib \
+		target-boehm-gc \
+		target-qthreads \
+		target-libobjc"
 
 # these tools are built using the target libs, and are intended to run only
 # in the target environment
@@ -154,6 +169,9 @@
   mips*-*-sysv*)
     host_makefile_frag="${host_makefile_frag} config/mh-riscos"
     ;;
+  i370-ibm-opened*)
+    host_makefile_frag="${host_makefile_frag} config/mh-openedition"
+    ;;
   i[3456]86-*-sysv5*)
     host_makefile_frag="${host_makefile_frag} config/mh-sysv5"
     ;;
@@ -291,6 +309,9 @@
     i370-*-*)
       host_makefile_frag="${host_makefile_frag} config/mh-i370pic"
       ;;
+    ia64-*-*)
+      host_makefile_frag="${host_makefile_frag} config/mh-ia64pic"
+      ;;
     sparc64-*-*)
       host_makefile_frag="${host_makefile_frag} config/mh-sparcpic"
       ;;
@@ -524,7 +545,7 @@
     noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl apache inet itcl tix db snavigator gnuserv gettext"
     ;;
   i[3456]86-*-go32* | i[3456]86-*-msdosdjgpp*)
-    noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl apache inet itcl tix db snavigator gnuserv gettext"
+    noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl apache inet itcl tix db snavigator gnuserv gettext libffi"
 	;;
   i[3456]86-*-mingw32*)
     # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl apache inet itcl tix db snavigator gnuserv"
@@ -542,18 +563,21 @@
   ppc*-*-pe)
      noconfigdirs="patch diff make tk tcl expect dejagnu cvssrc autoconf automake texinfo bison send-pr gprof rcs guile perl apache inet itcl tix db snavigator gnuserv"
     ;;
+  powerpc-*-beos*)
+    noconfigdirs="$noconfigdirs tk itcl tix libgui gdb dejagnu readline"
+    ;;
 esac
 
 
 case "${target}" in
   *-*-netware)
-    noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-librx target-newlib target-libiberty target-libgloss"
+    noconfigdirs="$noconfigdirs ${libstdcxx_version} target-newlib target-libiberty target-libgloss target-libffi"
     ;;
   *-*-rtems*)
-    noconfigdirs="$noconfigdirs target-libgloss"
+    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
     ;;
   *-*-vxworks*)
-    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+    noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libffi"
     ;;
   alpha*-dec-osf*)
     # ld works, but does not support shared libraries.  emacs doesn't
@@ -562,13 +586,7 @@
     noconfigdirs="$noconfigdirs gas ld emacs fileutils target-newlib target-libgloss"
     ;;
   alpha*-*-*vms*)
-    noconfigdirs="$noconfigdirs gdb ld target-newlib target-libgloss"
-    ;;
-  alpha*-*-linux*)
-    # newlib is not 64 bit ready
-    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
-    # linux has rx in libc
-    skipdirs="$skipdirs target-librx"
+    noconfigdirs="$noconfigdirs gdb ld target-newlib target-libgloss target-libffi"
     ;;
   alpha*-*-*)
     # newlib is not 64 bit ready
@@ -577,20 +595,20 @@
   sh*-*-pe|mips*-*-pe|*arm-wince-pe)
     noconfigdirs="$noconfigdirs target-libjava target-libffi target-zlib"
     noconfigdirs="$noconfigdirs target-boehm-gc target-qthreads target-examples"
-    noconfigdirs="$noconfigdirs target-librx target-libiberty texinfo send-pr"
+    noconfigdirs="$noconfigdirs target-libiberty texinfo send-pr"
     noconfigdirs="$noconfigdirs tcl tix tk itcl libgui sim"
     noconfigdirs="$noconfigdirs expect dejagnu"
     # the C++ libraries don't build on top of CE's C libraries
-    noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio"
+    noconfigdirs="$noconfigdirs ${libstdcxx_version}"
     skipdirs="$skipdirs target-newlib"
     case "${host}" in
       *-*-cygwin*) ;; # keep gdb and readline
-      *) noconfigdirs="$noconfigdirs gdb readline target-libio target-libstdc++ target-libg++"
+      *) noconfigdirs="$noconfigdirs gdb readline ${libstdcxx_version}"
 	 ;;
     esac
     ;;
   arc-*-*)
-    noconfigdirs="$noconfigdirs target-libgloss"
+    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
     ;;
   arm-*-pe*)
     noconfigdirs="$noconfigdirs target-libgloss"
@@ -608,40 +626,55 @@
     fi
     ;;
   arm-*-oabi*)
-    noconfigdirs="$noconfigdirs target-libgloss"
-    ;;
-  c4x-*-*)
-    noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss"
+    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
     ;;
   thumb-*-coff)
-    noconfigdirs="$noconfigdirs target-libgloss"
+    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
     ;;
   thumb-*-elf)
-    noconfigdirs="$noconfigdirs target-libgloss"
+    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
     ;;
   thumb-*-oabi)
-    noconfigdirs="$noconfigdirs target-libgloss"
+    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
     ;;
   strongarm-*-elf)
-    noconfigdirs="$noconfigdirs target-libgloss"
+    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
     if [ x${is_cross_compiler} != xno ] ; then
 	   target_configdirs="${target_configdirs} target-bsp target-cygmon"
     fi
     ;;
   strongarm-*-coff)
-    noconfigdirs="$noconfigdirs target-libgloss"
+    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
+    if [ x${is_cross_compiler} != xno ] ; then
+	   target_configdirs="${target_configdirs} target-bsp target-cygmon"
+    fi
+    ;;
+  xscale-*-elf)
+    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
+    if [ x${is_cross_compiler} != xno ] ; then
+	   target_configdirs="${target_configdirs} target-bsp target-cygmon"
+    fi
+    ;;
+  xscale-*-coff)
+    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
     if [ x${is_cross_compiler} != xno ] ; then
 	   target_configdirs="${target_configdirs} target-bsp target-cygmon"
     fi
     ;;
   thumb-*-pe)
-    noconfigdirs="$noconfigdirs target-libgloss"
+    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
     ;;
   arm-*-riscix*)
-    noconfigdirs="$noconfigdirs ld target-libgloss"
+    noconfigdirs="$noconfigdirs ld target-libgloss target-libffi"
+    ;;
+  c4x-*-*)
+    noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi"
+    ;;
+  c54x*-*-* | tic54x-*-*)
+    noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi gcc gdb newlib"
     ;;
   d10v-*-*)
-    noconfigdirs="$noconfigdirs target-librx target-libg++ target-libstdc++ target-libio"
+    noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi"
     ;;
   d30v-*-*)
     ;;
@@ -652,13 +685,13 @@
     ;;
   h8300*-*-* | \
   h8500-*-*)
-    noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss"
+    noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi"
     ;;
   hppa*-*-*elf* | \
   hppa*-*-linux-gnu* | \
   hppa*-*-lites* | \
   hppa*64*-*-*)
-    # Do configure ld/binutils/gas for the above cases.
+    # Do configure ld/binutils/gas for this case.
     ;;
   hppa*-*-*)
     # HP's C compiler doesn't handle Emacs correctly (but on BSD and Mach
@@ -681,11 +714,11 @@
     ;;
   i[3456]86-*-go32* | i[3456]-*-msdosdjgpp*)
     # but don't build gdb
-    noconfigdirs="$noconfigdirs gdb target-libg++ target-libstdc++ target-libio target-librx"
+    noconfigdirs="$noconfigdirs gdb ${libstdcxx_version} target-libffi"
     ;;
   i[3456]86-*-mingw32*)
     target_configdirs="$target_configdirs target-mingw"
-    noconfigdirs="$noconfigdirs expect target-libgloss"
+    noconfigdirs="$noconfigdirs expect target-libgloss target-libffi"
 
     # Can't build gdb for mingw32 if not native.
     case "${host}" in
@@ -696,7 +729,7 @@
     ;;    
   *-*-cygwin*)
     target_configdirs="$target_configdirs target-libtermcap target-winsup"
-    noconfigdirs="$noconfigdirs target-libgloss"
+    noconfigdirs="$noconfigdirs target-gperf target-libgloss target-libffi"
     # always build newlib.
     skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
 
@@ -708,15 +741,15 @@
     esac
     ;;    
   i[3456]86-*-pe)
-    noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss"
+    noconfigdirs="$noconfigdirs ${libstdcxx_version} target-libgloss target-libffi"
     ;;
   i[3456]86-*-sco3.2v5*)
     # The linker does not yet know about weak symbols in COFF,
     # and is not configured to handle mixed ELF and COFF.
-    noconfigdirs="$noconfigdirs ld target-libgloss"
+    noconfigdirs="$noconfigdirs ld target-libgloss target-libffi"
     ;;
   i[3456]86-*-sco*)
-    noconfigdirs="$noconfigdirs gprof target-libgloss"
+    noconfigdirs="$noconfigdirs gprof target-libgloss target-libffi"
     ;;
   i[3456]86-*-solaris2*)
     noconfigdirs="$noconfigdirs target-libgloss"
@@ -728,12 +761,15 @@
         *) ;;
     esac
     # but that's okay since emacs doesn't work anyway
-    noconfigdirs="$noconfigdirs emacs emacs19 target-libgloss"
+    noconfigdirs="$noconfigdirs emacs emacs19 target-libgloss target-libffi"
     ;;
   i[3456]86-*-beos*)
      noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
      ;;
-  m68k-*-elf*)
+ m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
+    noconfigdirs="$noconfigdirs target-libiberty target-librx target-libg++ target-libstdc++ target-libio target-libf2c target-libchill target-zlib target-libobjc"
+    ;;
+ m68k-*-elf*)
     if [ x${is_cross_compiler} != xno ] ; then
 	   target_configdirs="${target_configdirs} target-bsp target-cygmon"
     fi
@@ -744,13 +780,13 @@
     fi
     ;;
   mn10200-*-*)
-    noconfigdirs="$noconfigdirs"
+    noconfigdirs="$noconfigdirs target-libffi"
     if [ x${is_cross_compiler} != xno ] ; then
 	   target_configdirs="${target_configdirs} target-libstub target-cygmon"
     fi
     ;;
   mn10300-*-*)
-    noconfigdirs="$noconfigdirs"
+    noconfigdirs="$noconfigdirs target-libffi"
     if [ x${is_cross_compiler} != xno ] ; then
 	   target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
     fi
@@ -761,18 +797,21 @@
     # GNU ld is known to be broken for AIX 4.2 and 4.3 (at least)
     # The symptom is that GDBtk 4.18 fails at startup with a segfault
     # if linked by GNU ld, but not if linked by the native ld.
-    noconfigdirs="$noconfigdirs gprof cvssrc target-libgloss ld"
+    noconfigdirs="$noconfigdirs gprof cvssrc target-libgloss target-libffi ld"
     use_gnu_ld=no
     ;;
   powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe)
     target_configdirs="$target_configdirs target-winsup"
-    noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix db snavigator gnuserv"
+    noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix db snavigator gnuserv target-libffi"
     # always build newlib.
     skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
     ;;
     # This is temporary until we can link against shared libraries
   powerpcle-*-solaris*)
-    noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix db snavigator gnuserv"
+    noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix db snavigator gnuserv target-libffi"
+    ;;
+  powerpc-*-beos*)
+    noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
     ;;
   powerpc-*-eabi)
     if [ x${is_cross_compiler} != xno ] ; then
@@ -781,22 +820,21 @@
     ;;
   rs6000-*-lynxos*)
     # The CVS server code doesn't work on the RS/6000
-    # Newlib makes problems for libg++ in crosses.
-    noconfigdirs="$noconfigdirs target-newlib gprof cvssrc"
+    noconfigdirs="$noconfigdirs target-newlib gprof cvssrc target-libffi"
     ;;
   rs6000-*-aix*)
     # The configure and build of ld are currently disabled because
     # GNU ld is known to be broken for AIX 4.2 and 4.3 (at least)
     # The symptom is that GDBtk 4.18 fails at startup with a segfault
     # if linked by GNU ld, but not if linked by the native ld.
-    noconfigdirs="$noconfigdirs gprof ld"
+    noconfigdirs="$noconfigdirs gprof target-libffi ld"
     use_gnu_ld=no
     ;;
   rs6000-*-*)
-    noconfigdirs="$noconfigdirs gprof"
+    noconfigdirs="$noconfigdirs gprof target-libffi"
     ;;
   m68k-apollo-*)
-    noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss"
+    noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss target-libffi"
     ;;
   mips*-*-irix5*)
     # The GNU linker does not support shared libraries.
@@ -808,26 +846,21 @@
     # emacs is emacs 18, which does not work on Irix 5 (emacs19 does work)
     noconfigdirs="$noconfigdirs gas gprof emacs target-libgloss"
     ;;
-  mips*-*-linux*)
-    noconfigdirs="$noconfigdirs gprof"
-    # linux has rx in libc
-    skipdirs="$skipdirs target-librx"
-    ;;
   mips*-dec-bsd*)
-    noconfigdirs="$noconfigdirs gprof target-libgloss"
+    noconfigdirs="$noconfigdirs gprof target-libgloss target-libffi"
     ;;
   mips*-*-bsd*)
-    noconfigdirs="$noconfigdirs gprof target-libgloss"
+    noconfigdirs="$noconfigdirs gprof target-libgloss target-libffi"
     ;;
   mipstx39-*-*)
-    noconfigdirs="$noconfigdirs gprof"   # same as generic mips
+    noconfigdirs="$noconfigdirs gprof target-libffi"   # same as generic mips
     target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
    ;;
   mips*-*-*)
-    noconfigdirs="$noconfigdirs gprof"
+    noconfigdirs="$noconfigdirs gprof target-libffi"
     ;;
   romp-*-*)
-    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss"
+    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss target-libffi"
     ;;
   sh-*-*)
     case "${host}" in
@@ -836,7 +869,7 @@
       i[3456]86-*-msdosdjgpp*) ;; # don't add gprof back in
       *) skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'` ;;
     esac
-    noconfigdirs="$noconfigdirs target-libgloss"
+    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
     ;;
   sparc-*-elf*)
     if [ x${is_cross_compiler} != xno ] ; then
@@ -847,11 +880,13 @@
     if [ x${is_cross_compiler} != xno ] ; then
 	   target_configdirs="${target_configdirs} target-libstub target-cygmon"
     fi
+    noconfigdirs="target-libffi"
     ;;
   sparclite-*-*)
     if [ x${is_cross_compiler} != xno ] ; then
 	   target_configdirs="${target_configdirs} target-bsp target-libstub target-cygmon"
     fi
+    noconfigdirs="target-libffi"
     ;;
   sparc-*-sunos4*)
     if [ x${is_cross_compiler} != xno ] ; then
@@ -861,35 +896,31 @@
     fi
     ;;
   v810-*-*)
-    noconfigdirs="$noconfigdirs bfd binutils gas gcc gdb ld target-libio target-libg++ target-libstdc++ opcodes target-libgloss"
+    noconfigdirs="$noconfigdirs bfd binutils gas gcc gdb ld ${libstdcxx_version} opcodes target-libgloss target-libffi"
     ;;
   v850-*-*)
-    noconfigdirs="$noconfigdirs target-libgloss"
+    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
     ;;
   v850e-*-*)
-    noconfigdirs="$noconfigdirs target-libgloss"
+    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
     ;;
   v850ea-*-*)
-    noconfigdirs="$noconfigdirs target-libgloss"
+    noconfigdirs="$noconfigdirs target-libgloss target-libffi"
     ;;
   vax-*-vms)
-    noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes target-libgloss"
+    noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes target-libgloss target-libffi"
     ;;
   vax-*-*)
-    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
-    ;;
-  *-*-linux*)
-    # linux has rx in libc
-    skipdirs="$skipdirs target-librx"
+    noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libffi"
     ;;
   *-*-lynxos*)
-    # Newlib makes problems for libg++ in crosses.
-    noconfigdirs="$noconfigdirs target-newlib target-libgloss"
+    noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libffi"
     ;; 
   *-*-macos* | \
   *-*-mpw*)
     # Macs want a resource compiler.
     configdirs="$configdirs grez"
+    noconfigdirs="target-libffi"
     ;;    
 esac
 
@@ -900,6 +931,11 @@
   *target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;;
 esac
 
+# Only configure cgen if --enable-cgen-maint.
+if [ "x$enable_cgen_maint" != xyes ] ; then
+    noconfigdirs="$noconfigdirs cgen"
+fi
+
 # Make sure we don't let GNU ld be added if we didn't want it.
 if [ x$with_gnu_ld = xno ]; then
   use_gnu_ld=no
@@ -912,6 +948,55 @@
   noconfigdirs="$noconfigdirs gas"
 fi
 
+# Figure out what language subdirectories are present.
+# Look if the user specified --enable-languages="..."; if not, use
+# the environment variable $LANGUAGES if defined. $LANGUAGES might
+# go away some day.
+if test x"${enable_languages+set}" != xset; then
+	if test x"${LANGUAGES+set}" = xset; then
+		enable_languages="`echo ${LANGUAGES} | tr ' ' ','`"
+	else
+		enable_languages=all
+	fi
+else
+	if test x"${enable_languages}" = x; then
+		echo configure.in: --enable-languages needs at least one argument 1>&2
+		exit 1
+	fi
+fi
+subdirs=
+for lang in ${srcdir}/gcc/*/config-lang.in ..
+do
+	case $lang in
+	..) ;;
+	# The odd quoting in the next line works around
+	# an apparent bug in bash 1.12 on linux.
+	${srcdir}/gcc/[*]/config-lang.in) ;;
+	*)
+	  lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ 	]*\).*$,\1,p' $lang`
+	  this_lang_libs=`sed -n -e 's,^target_libs=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^target_libs=\([^ 	]*\).*$,\1,p' $lang`
+	  build_by_default=`sed -n -e 's,^build_by_default=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^build_by_default=\([^ 	]*\).*$,\1,p' $lang`
+	  if test "x$lang_alias" = x
+	  then
+		echo "$lang doesn't set \$language." 1>&2
+		exit 1
+	  fi
+	  case ${build_by_default},${enable_languages}, in
+	  *,$lang_alias,*) add_this_lang=yes ;;
+	  no,*) add_this_lang=no ;;
+	  *,all,*) add_this_lang=yes ;;
+	  *) add_this_lang=no ;;
+	  esac
+	  if test x"${add_this_lang}" = xyes; then
+	      eval target_libs='"$target_libs "'\"$this_lang_libs\"
+	  else
+	      eval noconfigdirs='"$noconfigdirs "'\"$this_lang_libs\"
+	  fi
+	  ;;
+	esac
+done
+
+
 # Remove the entries in $skipdirs and $noconfigdirs from $configdirs and
 # $target_configdirs.
 # If we have the source for $noconfigdirs entries, add them to $notsupp.
@@ -1052,6 +1137,9 @@
     i[3456]86-*)
       target_makefile_frag="${target_makefile_frag} config/mt-x86pic"
       ;;
+    ia64-*)
+      target_makefile_frag="${target_makefile_frag} config/mt-ia64pic"
+      ;;
     powerpc*-*-aix*)
       # We don't want -fPIC on AIX.
       ;;
@@ -1173,7 +1261,7 @@
 
 # provide a proper gxx_include_dir.
 # Note, if you change the default, make sure to fix both here and in
-# the gcc, libio, libstdc++ and libg++ subdirectories.
+# the gcc, libio, and libstdc++ subdirectories.
 # Check whether --with-gxx-include-dir or --without-gxx-include-dir was given.
 gxx_include_dir=
 if test -n "${with_gxx_include_dir}"; then
@@ -1200,9 +1288,113 @@
   gxx_include_dir=${gxx_include_dir}
 fi
 
-targargs="--host=${target_alias} --build=${build_alias} ${targargs}"
+FLAGS_FOR_TARGET=
+case " $skipdirs " in
+*" target-newlib "*) ;;
+*)
+   case "$target" in
+   *-cygwin*)
+     FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup -L$$r/$(TARGET_SUBDIR)/winsup/cygwin -L$$r/$(TARGET_SUBDIR)/winsup/w32api/lib -isystem $$s/winsup/include -isystem $$s/winsup/cygwin/include -isystem $$s/winsup/w32api/include -isystem $$s/newlib/libc/sys/cygwin -isystem $$s/newlib/libc/sys/cygwin32' ;;
+   esac
+
+   # If we're not building GCC, don't discard standard headers.
+   if test -d ${topsrcdir}/gcc; then
+     FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -nostdinc'
+
+     if test "${build}" != "${host}"; then
+       # On Canadian crosses, CC_FOR_TARGET will have already been set
+       # by `configure', so we won't have an opportunity to add -Bgcc/
+       # to it.  This is right: we don't want to search that directory
+       # for binaries, but we want the header files in there, so add
+       # them explicitly.
+       FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/gcc/include'
+
+       # Someone might think of using the pre-installed headers on
+       # Canadian crosses, in case the installed compiler is not fully
+       # compatible with the compiler being built.  In this case, it
+       # would be better to flag an error than risking having
+       # incompatible object files being constructed.  We can't
+       # guarantee that an error will be flagged, but let's hope the
+       # compiler will do it, when presented with incompatible header
+       # files.
+     fi
+   fi
+
+   # If we're building newlib, use its generic headers last, but search
+   # for any libc-related directories first (so make it the last -B
+   # switch).
+   FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/ -isystem $$r/$(TARGET_SUBDIR)/newlib/targ-include -isystem $$s/newlib/libc/include'
+   ;;
+esac
+
+# On Canadian crosses, we'll be searching the right directories for
+# the previously-installed cross compiler, so don't bother to add
+# flags for directories within the install tree of the compiler
+# being built; programs in there won't even run.
+if test "${build}" = "${host}" && test -d ${topsrcdir}/gcc; then
+  # Search for pre-installed headers if nothing else fits.
+  FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include'
+fi
+
+if test "x${use_gnu_ld}" = x && test "x${with_gnu_ld}" != xno &&
+   echo " ${configdirs} " | grep " ld " > /dev/null &&
+   test -d ${srcdir}/ld; then
+  # Arrange for us to find uninstalled linker scripts.
+  FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/ld'
+fi
+
+if test "x${CC_FOR_TARGET+set}" = xset; then
+  :
+elif test -d ${topsrcdir}/gcc; then
+  CC_FOR_TARGET='$$r/gcc/xgcc -B$$r/gcc/'
+elif test "$host" = "$target"; then
+  CC_FOR_TARGET='$(CC)'
+else
+  CC_FOR_TARGET=`echo gcc | sed -e 's/x/x/' ${program_transform_name}`
+fi
+# On Canadian crosses, configure reads CC_FOR_TARGET from Makefile,
+# if Makefile exists.  Prevent $(FLAGS_FOR_TARGET) from being duplicated.
+case $CC_FOR_TARGET in
+*' $(FLAGS_FOR_TARGET)') ;;
+*) CC_FOR_TARGET=$CC_FOR_TARGET' $(FLAGS_FOR_TARGET)' ;;
+esac
+
+if test "x${CHILL_FOR_TARGET+set}" = xset; then
+  :
+elif test -d ${topsrcdir}/gcc; then
+  CHILL_FOR_TARGET='$$r/gcc/xgcc -B$$r/gcc/ -L$$r/gcc/ch/runtime/'
+elif test "$host" = "$target"; then
+  CHILL_FOR_TARGET='$(CC)'
+else
+  CHILL_FOR_TARGET=`echo gcc | sed -e 's/x/x/' ${program_transform_name}`
+fi
+case $CHILL_FOR_TARGET in
+*' $(FLAGS_FOR_TARGET)') ;;
+*) CHILL_FOR_TARGET=$CHILL_FOR_TARGET' $(FLAGS_FOR_TARGET)' ;;
+esac
+
+if test "x${CXX_FOR_TARGET+set}" = xset; then
+  :
+elif test -d ${topsrcdir}/gcc; then
+  CXX_FOR_TARGET='$$r/gcc/g++ -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags
+elif test "$host" = "$target"; then
+  CXX_FOR_TARGET='$(CXX)'
+else
+  CXX_FOR_TARGET=`echo c++ | sed -e 's/x/x/' ${program_transform_name}`
+fi
+case $CXX_FOR_TARGET in
+*' $(FLAGS_FOR_TARGET)') ;;
+*) CXX_FOR_TARGET=$CXX_FOR_TARGET' $(FLAGS_FOR_TARGET)' ;;
+esac
+qCXX_FOR_TARGET=`echo "$CXX_FOR_TARGET" | sed 's,&,\\\&,g'`
+
+targargs="--cache-file=../config.cache --host=${target_alias} --build=${build_alias} ${targargs}"
 sed -e "s:^TARGET_CONFIGDIRS[ 	]*=.*$:TARGET_CONFIGDIRS = ${target_configdirs}:" \
     -e "s%^CONFIG_ARGUMENTS[ 	]*=.*$%CONFIG_ARGUMENTS = ${targargs}%" \
+    -e "s%^FLAGS_FOR_TARGET[ 	]*=.*$%FLAGS_FOR_TARGET = ${FLAGS_FOR_TARGET}%" \
+    -e "s%^CC_FOR_TARGET[ 	]*=.*$%CC_FOR_TARGET = ${CC_FOR_TARGET}%" \
+    -e "s%^CHILL_FOR_TARGET[ 	]*=.*$%CHILL_FOR_TARGET = ${CHILL_FOR_TARGET}%" \
+    -e "s%^CXX_FOR_TARGET[ 	]*=.*$%CXX_FOR_TARGET = ${qCXX_FOR_TARGET}%" \
     -e "s%^TARGET_SUBDIR[ 	]*=.*$%TARGET_SUBDIR = ${target_subdir}%" \
     -e "s%^gxx_include_dir[ 	]*=.*$%gxx_include_dir=${gxx_include_dir}%" \
        Makefile > Makefile.tem
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6b51c40..0576b00 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,13 +1,3826 @@
+2000-12-22  Mark Kettenis  <kettenis@gnu.org>
+
+	* solib.c (solib_open): If path is relative, look for it
+	literally.  This matches the behaviour of the GNU dynamic linker
+	more closely.
+
+2000-12-22  Fernando Nasser  <fnasser@redhat.com>
+
+	* README: Suggest building in an empty directory.
+
+2000-12-21  Mark Kettenis  <kettenis@gnu.org>
+
+	* i386-tdep.c: Add missing ')' in comment.
+	(i386_extract_return_value): Return directly after issuing the
+	warning and filling *VALBUF with zeroes if we cannot get at the
+	floating-point registers.
+	(i386_store_return_value): New function.
+	* config/i386/tm-i386.h (STORE_RETURN_VALUE): Simply call
+	i386_store_return_value.
+	Add prototype for i386_store_return_value.
+
+	* i386-linux-nat.c (store_fpxregs): Add code to detect support for
+	the PTRACE_GETFPXREGS request, and return zero if it's not.
+
+2000-12-21  Fernando Nasser  <fnasser@redhat.com>
+
+	* TODO: Add pre-uiout code removal to 5.2 cleanups.
+
+2000-12-20  Fernando Nasser  <fnasser@redhat.com>
+
+	* configure.in: Rename CONFIG_LOBS to CONFIG_LIB_OBS.
+	* Makefile.in: Ditto.
+	* configure: Regenerate.
+
+2000-12-20  Fernando Nasser  <fnasser@redhat.com>
+
+	* command.h: Register date when it was deprecated.
+	* call-cmds.h: Ditto.
+
+2000-12-20  Fernando Nasser  <fnasser@redhat.com>
+
+	* Makefile.in (UIOUT_CFLAGS): New macro. CFLAGS needed for uiout code
+	to be compiled.  Defines UI_OUT.
+	(SUBDIR_MI_CFLAGS): Defines MI_OUT, not UI_OUT.
+	(INTERNAL_WARN_CFLAGS): Also include UIOUT_CFLAGS.
+	* configure.in (UIOUT_CFLAGS): New configuration variable.
+	(--with-uiout): New configuration option.  Causes uiout code to
+	be compiled, instead of the old *printf one.
+	* configure: Regenerate.
+	* top.c (print_gdb_version): Test for and print MI_OUT, not UI_OUT.
+
+2000-12-20  Fernando Nasser  <fnasser@redhat.com>
+
+	* complaints.c (complain): Call warning_hook if defined, instead of
+	writting to gdb_stderr.
+	(clear_complaints): Do not write anything to gdb_stderr if warning_hook
+	is defined.
+
+2000-12-19  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* sh-tdep.c (sh_print_register): Don't leave regnum 0 out of the
+        non-pseudo-regs group.
+
+2000-12-19  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* sh-tdep.c (sh_gdbarch_init): Move setting of breakpoint_from_pc
+	to before switch statement.
+	
+2000-12-17  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+        * sh-tdep.c (sh_gdbarch_init): Initialize do_registers_info.
+
+	* config/sh/tm-sh.h: Don't remove SR_REGNUM from enum.
+	(DO_REGISTERS_INFO): Remove macro. Use multiarch version instead.
+
+Fri Dec 15 23:12:15 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* i386gnu-nat.c: Include "gdb_assert.h" instead of <assert.h>.
+ 	(gnu_store_registers): Replace assert with gdb_assert.
+	
+2000-12-15  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh3e_show_regs,
+ 	sh3_dsp_show_regs, sh4_show_regs, sh_dsp_show_regs): SR_REGNUM is
+ 	now part of gdbarch_tdep structure.
+	(sh_gdbarch_init): Initialize SR_REGNUM.
+
+	* config/sh/tm-sh.h (struct gdbarch_tdep): Add field SR_REGNUM.
+
+	* sh-tdep.c (sh_do_pseudo_register): Indent properly. Call
+ 	do_dr_register_info() only for DR registers.
+	(sh_sh4_register_name): Add comments with numbers.
+	(_initialize_sh_tdep): Move assignment to disassemble printing
+ 	function from here...
+	(sh_gdbarch_init):...to here. Move some more general settings to
+ 	before the architecture is recognized.
+
+Fri Dec 15 23:27:56 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* remote.c (remote_fetch_registers): Replace #ifdef
+ 	REGISTER_BYTES_OK with REGISTER_BYTES_OK_P.
+
+	* gdbarch.sh (REGISTER_BYTES_OK): Multi-arch.
+	* gdbarch.h, gdbarch.c: Re-generate.
+
+Fri Dec 15 22:58:59 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* serial.c (serial_printf): Call xvasprintf instead of vasprintf.
+
+2000-12-14  Matthew Green  <mrg@eterna.com.au>
+
+	* solib-svr4.c (solib_break_names): Add NetBSD's `_rtld_debug_state'.
+
+2000-12-14  Kevin Buettner  <kevinb@redhat.com>
+
+	* defs.h, utils.c (xfree): New function.
+	* alpha-tdep.c, altos-xdep.c, arch-utils.c, arm-xdep.c,
+	ax-general.c, bcache.c, blockframe.c, breakpoint.c,
+	buildsym.c, c-typeprint.c, coffread.c, completer.c,
+	convex-tdep.c, convex-xdep.c, corefile.c, corelow.c,
+	cp-valprint.c, cxux-nat.c, d10v-tdep.c, d30v-tdep.c,
+	dbxread.c, dcache.c, defs.h, demangle.c, dstread.c,
+	dve3900-rom.c, dwarf2read.c, dwarfread.c, elfread.c,
+	environ.c, event-loop.c, event-top.c, exec.c, f-lang.c,
+	gdb-events.c, gdbarch.c, gdbtypes.c, gnu-nat.c, h8500-tdep.c,
+	hp-psymtab-read.c, hppah-nat.c, infcmd.c, inflow.c, infrun.c,
+	infttrace.c, irix5-nat.c, jv-typeprint.c, kod-cisco.c, kod.c,
+	language.c, lin-lwp.c, lin-thread.c, linespec.c,
+	linux-thread.c, main.c, maint.c, mdebugread.c, minsyms.c,
+	mips-tdep.c, monitor.c, nlmread.c, objfiles.c, osfsolib.c,
+	p-valprint.c, pa64solib.c, parse.c, printcmd.c,
+	proc-service.c, procfs.c, pyr-xdep.c, remote-adapt.c,
+	remote-bug.c, remote-eb.c, remote-es.c, remote-mips.c,
+	remote-mm.c, remote-nindy.c, remote-rdi.c, remote-rdp.c,
+	remote-udi.c, remote-vx.c, remote.c, rs6000-nat.c, ser-pipe.c,
+	serial.c, solib-svr4.c, solib.c, somread.c, somsolib.c,
+	source.c, sparcl-tdep.c, stabsread.c, stack.c, sun386-nat.c,
+	symfile.c, symmisc.c, symtab.c, target.c, thread-db.c,
+	thread.c, top.c, tracepoint.c, ui-file.c, ui-out.c,
+	umax-xdep.c, utils.c, valops.c, valprint.c, values.c,
+	varobj.c, win32-nat.c, wince.c, xcoffread.c, cli/cli-cmds.c,
+	cli/cli-decode.c, cli/cli-script.c, cli/cli-setshow.c:
+	Replace occurrences of free() with xfree().
+
+2000-12-14  J.T. Conklin  <jtc@redback.com>
+
+	* configure.tgt (hppa*-*-bsd*, hppa*-*-osf*, m68*-*-sunos4*,
+ 	rs6000-*-lynxos*, sparc-*-sunos4*): Add gdbserver to configdirs.
+
+2000-12-13  Michael Chastain  <chastain@redhat.com>
+
+	* MAINTAINERS: Add Michael Chastain to Write After Approval list.
+
+2000-12-11  Fernando Nasser  <fnasser@redhat.com>
+
+        * Makefile.in (CONFIG_LOBS): New macro.  Configured to the files
+	that must be added to the gdblib itself.
+	(DEPFILES): Use CONFIG_LOBS, not CONFIG_OBS.
+	(INIT_FILES): Include CONFIG_OBS.
+	(gdb$(EXEEXT)): Depend on CONFIG_OBS and link with it.
+	(kdb): Ditto.
+	* configure.in (CONFIG_LOBS): New variable. Object files that must
+	be added to gdblib for the specific configuration.
+	* configure: Regenerate.
+
+2000-12-11  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* sh-tdep.c (sh_extract_struct_value_address): Protoize.
+
+2000-12-11  Michael Snyder  <msnyder@mvstp600e.cygnus.com>
+
+	* blockframe.c (get_prev_frame): Add missing paren omitted in 
+	last check-in.
+
+2000-12-11  Fernando Nasser  <fnasser@redhat.com>
+
+        * Makefile.in (SUBDIR_GDBTK_OBS, SUBDIR_GDBTK_SRCS,
+	SUBDIR_GDBTK_DEPS, SUBDIR_GDBTK_INITS, SUBDIR_GDBTK_LDFLAGS,
+	SUBDIR_GDBTK_CFLAGS): New macros.  For gdbtk subdir.
+	* configure.in: Fix typo.  It is CONFIG_OBS not CONFIG_OJS.
+	Use the SUBDIR_GDBTK_* macros instead of hard coded file names.
+	* configure: Regenerate.
+
+2000-12-11  Michael Snyder  <msnyder@mvstp600e.cygnus.com>
+
+	* blockframe.c (get_prev_frame): Zero all fields of prev by
+	default using memset (instead of one at a time).
+
+2000-12-11  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* sh-tdep.c (sh_extract_struct_value_address): For consistancy,
+	change decl from "CORE_ADDR static" to "static CORE_ADDR".
+
+2000-12-11  Fernando Nasser  <fnasser@redhat.com>
+
+	* configure.in: Fix typos.  It is CONFIG_SRCS not CONFIG_SRS.
+	* configure: Regenerate.
+
+2000-12-11  Fernando Nasser  <fnasser@redhat.com>
+
+	* configure.in: Fix a couple of typos in the handling of the
+	enable_gdbcli option.  Make it check enableval for the result
+	of AC_ARG_ENABLE.
+	* configure: Regenerate.
+
+2000-12-08  Michael Snyder  <msnyder@mvstp600e.cygnus.com>
+
+	* dwarf2read.c (DWARF2_REG_TO_REGNUM): New macro.  Provide default
+	definition.  Will be used to translate between the compiler's
+	register numbering and GDB's (for register variables etc).
+	(new_symbol): Use DWARF2_REG_TO_REGNUM to translate register ids.
+	* alpha-tdep.c: Fix typo in comment.
+	* dbxread.c: Fix typo in comment.
+	* fr30-tdep.c: Fix typo: newline missing after comment.
+	* mcore-tdep.c: Fix typo in comment.	
+
+2000-12-07  J.T. Conklin  <jtc@redback.com>
+
+	* gdbserver/low-hppabsd.c (buf2, environ, quit, quit_flag):
+ 	Removed unused variables and declarations.
+	* gdbserver/low-linux.c (buf2, environ, query, quit, quit_flag):
+	Likewise.
+	* gdbserver/low-nbsd.c (buf2, environ, quit, quit_flag):
+	Likewise.
+	* gdbserver/low-sparc.c (buf2, environ, query, quit, quit_flag):
+	Likewise.
+	* gdbserver/low-sun.c (buf2, environ, query, quit, quit_flag):
+	Likewise.
+
+	* gdbserver/low-hppabsd.c, gdbserver/low-linux.c,
+ 	gdbserver/low-nbsd.c, gdbserver/low-sparc.c, gdbserver/low-sun3.c
+ 	(create_inferior): Update comment.
+
+	* gdbserver/low-nbsd.c (initialize_arch, fetch_inferior_registers,
+	store_inferior_registers): Provide implementations for the m68k 
+	and ns32k.
+	* config/m68k/nbsd.mt (GDBSERVER_DEPFILES): Add low-nbsd.o
+	* config/ns32k/nbsd.mt (GDBSERVER_DEPFILES): Likewise.
+	* configure.tgt (m68*-*-netbsd*, ns32k-*-netbsd*): Add gdbserver
+ 	to configdirs.
+
+2000-12-07  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* config/sh/tm-sh.h (struct gdbarch_tdep): Rename fields
+ 	{FP15,DR14,FV12}_REGNUM to {FP,DR,FV}_LAST_REGNUM.
+	* sh-tdep.c (sh_sh3e_register_virtual_type,
+ 	sh_sh4_register_virtual_type, sh_do_registers_info,
+ 	sh_gdbarch_init, sh_sh4_register_byte, sh_sh4_register_raw_size,
+ 	sh_sh4_register_convertible, sh_sh4_register_convert_to_virtual,
+ 	sh_sh4_register_convert_to_raw, sh_fetch_pseudo_register,
+ 	sh_store_pseudo_register, sh_do_pseudo_register): Ditto.
+
+	* sh-tdep.c (sh_gdbarch_init): Use a function pointer to set the
+ 	disassembly print function.
+	(_initialize_sh_tdep): Initialize tm_print_insn using the function
+ 	pointer.
+
+2000-12-07  Mark Kettenis  <kettenis@gnu.org>
+
+	From Richard Henderson <rth@twiddle.net>:
+	* alpha-nat.c (supply_gregset, fill_gregset): Use gdb_gregset_t.
+	(supply_fpregset, fill_fpregset): Use gdb_fpregset_t.
+
+2000-12-06  Fernando Nasser  <fnasser@redhat.com>
+
+	* cli/cli-decode.c (add_abbrev_cmd): Reinstate. Add comment saying
+	that is not currently used.
+
+2000-12-06  Fernando Nasser  <fnasser@redhat.com>
+
+	* cli/cli-decode.c (lookup_cmd): Change disabled code into comment.
+
+2000-12-06  Fernando Nasser  <fnasser@redhat.com>
+
+	* cli/cli-decode.c (lookup_cmd): Remove old stale copy of this routine
+	which was not being used for quite some time.
+
+2000-12-05  Mark Kettenis  <kettenis@gnu.org>
+
+	* gdb-stabs.h (SECT_OFF_MAX): Increase to 64.
+	* symfile.h (MAX_SECTIONS): Increase to 64.
+
+2000-12-05  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* config/sh/tm-sh.h (struct gdbarch_tdep): Get rid of
+ 	DR{2,4,6,8,10,12}_REGNUM, FV{4,8}_REGNUM, they are not used
+ 	anywhere.
+	* sh-tdep.c (sh_gdbarch_init): Don't initialize
+ 	DR{2,4,6,8,10,12}_REGNUM, FV{4,8}_REGNUM.
+
+2000-12-04  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* utils.c (internal_verror): Fix typo in error msg.
+
+2000-12-03  Mark Kettenis  <kettenis@gnu.org>
+
+	* Makefile.in (symfile.o): Add gdb-stabs.h to dependencies list.
+
+2000-12-04  Kevin Buettner  <kevinb@redhat.com>
+
+	* elfread.c (record_minimal_symbol_and_info): Don't guess
+	at the section index; instead just always use the bfd index.
+	(elf_symtab_read): Handle weak symbols appearing in data
+	sections.
+
+Mon Dec  4 14:36:39 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdbarch.sh (STAB_REG_TO_REGNUM, ECOFF_REG_TO_REGNUM,
+ 	DWARF_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM):
+ 	Add.
+	* gdbarch.h, gdbarch.c: Regenerate.
+	* arch-utils.c (no_op_reg_to_regnum): New function.
+	* arch-utils.h (no_op_reg_to_regnum): Declare.
+
+	* dwarfread.c (DWARF_REG_TO_REGNUM), coffread.c
+ 	(SDB_REG_TO_REGNUM), stabsread.h (STAB_REG_TO_REGNUM),
+ 	mdebugread.c (ECOFF_REG_TO_REGNUM): Delete macro.
+
+	* config/mips/tm-mips.h (ECOFF_REG_TO_REGNUM, STAB_REG_TO_REGNUM):
+ 	Delete.  Moved to mips-tdep.c.
+	* mips-tdep.c (mips_ecoff_reg_to_regnum, mips_stab_reg_to_regnum):
+ 	New functions.
+	(mips_gdbarch_init): Add ``mips_ecoff_reg_to_regnum'' and
+ 	``mips_stab_reg_to_regnum'' to multi-arch vector.
+
+2000-12-03  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* m68hc11-tdep.c (m68hc11_gdbarch_init): Remove elf_flags, cleanup.
+	(gdbarch_tdep): Likewise.
+
+2000-12-03  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* m68hc11-tdep.c (SOFT_D1_REGNUM): Soft registers start at 14.
+	(m68hc11_register_names): Add null for register 13.
+
+2000-12-03  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* m68hc11-tdep.c (m68hc11_frame_args_address): Fix args address
+	computation.
+	(m68hc11_frame_init_saved_regs): Frame pointer is saved only if
+	the symbol exist.
+	(m68hc11_analyze_instruction): New function.
+	(m6811_prologue, m6812_prologue): New prologue description tables.
+	(m68hc11_guess_from_prologue): Use the above.
+	(m68hc11_gdbarch_init): Setup gdbarch_tdep for the prologue
+	descriptions.
+
+Sun Dec  3 02:28:26 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* ser-pipe.c (pipe_open): Only use vfork when available.
+	* fork-child.c (fork_inferior): Fix #ifdef HAVE_VFORK test.
+	(clone_and_follow_inferior): Ditto.
+
+	* configure.in (AC_CHECK_FUNCS): Check for vfork.
+	* configure, config.in: Regenerate.
+
+Sun Dec  3 01:54:49 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* ser-unix.c (wait_for): Initialize the FD_SET before every select
+ 	call.
+	(ser_unix_wait_for): Ditto.
+
+Sun Dec  3 01:01:02 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* Makefile.in (varobj.o): Delete special .c.o rule supressing
+ 	-Werror flag.
+
+Sun Dec  3 00:29:31 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* m32r-rom.c (m32r_load_section): Update to match
+ 	bfd_map_over_sections's ``func'' arg.
+
+Thu Nov 30 01:24:37 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* mips-tdep.c (struct upk_mips16): Delete fields ``inst'' and
+ 	``fmt''.  Make ``offset'' a CORE_ADDR.
+	(print_unpack): Delete.
+	(extended_offset): Construct and return a CORE_ADDR.
+	(fetch_mips_16): Return an int.  Don't assume short is 16 bits.
+	(unpack_mips16): Rewrite.  Add ``extension'' parameter instead of
+ 	incorrectly guessing if the instruction had an extension.
+	(map16): Delete array.
+	(mips16_op): Delete macro.
+	(extended_mips16_next_pc): Rewrite of old mips16_next_pc function.
+  	When an extended instruction do a recursive call.
+	(mips16_next_pc): Call extended_mips16_next_pc.
+	(mips_next_pc): Cleanup.
+	
+Sat Dec  2 10:40:16 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* ser-e7kpc.c (e7000pc_setstopbits): New function.
+	(e7000pc_ops): Add e7000pc_setstopbits.
+
+	* remote-e7000.c (e7000_detach, e7000_resume,
+ 	e7000_xfer_inferior_memory, e7000_files_info, e7000_files_info,
+ 	e7000_insert_breakpoint, e7000_remove_breakpoint, e7000_kill):
+ 	Update function signature to match target vector.
+
+	* h8300-tdep.c (h8300_command, h8300h_command, h8300s_command):
+ 	h8500-tdep.c (small_command, big_command, medium_command,
+ 	compact_command): Update function signature to match add_cmd.
+
+2000-12-01  Fernando Nasser  <fnasser@redhat.com>
+
+	* p-exp.y: Define strncasecmp as strnicmp for MSVC.
+	(yylex): Use strncasecmp, not strnicmp.
+
+2000-12-01  Fernando Nasser  <fnasser@redhat.com>
+
+	* cli/cli-decode.c: New file. Handle lists of commands, their decoding
+	and documentation.
+	(add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd,
+	add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc,
+	add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd,
+	add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list,
+	help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1,
+	undef_cmd_error, lookup_cmd, deprecated_cmd_warning,
+	lookup_cmd_composition, complete_on_cmdlist, complete_on_enum):
+	Moved here from command.c.
+	(add_info, add_info_alias, add_com, add_com_alias): Moved here from
+	top.c.
+	* cli/cli-decode.h: Definitions/declarations for the above.
+	* cli/cli-cmds.c: New file.  GDB CLI commands.
+	(error_no_arg, info_command, show_command, help_command, show_version, 
+	quit_command, pwd_command, cd_command, echo_command, shell_escape,
+	make_command, show_user, set_debug, show_debug, init_cmd_lists):
+	Moved here from top.c.
+	(apropos_command): Moved here from command.c.
+	(complete_command, source_command): Moved here (part) from top.c.
+	(is_complete_command): New function. Checks if a command is the
+	"complete" command.
+	(init_cli_cmds): New function. Add commands to the CLI (from code
+	previously in top.c.
+	* cli/cli-cmds.h: Definitions/declarations for the above.
+	* cli/cli-script.c: New file. GDB CLI command scripting.
+	(build_command_line, get_command_line, print_command_lines,
+	print_command_line, execute_user_command, execute_control_command,
+	while_command, if_command, arg_cleanup, setup_user_args, locate_arg,
+	insert_args, realloc_body_list, read_next_line,
+	recurse_read_control_structure, read_command_lines, free_command_lines,
+	do_free_command_lines_cleanup, make_cleanup_free_command_lines,
+	validate_comname, user_defined_command, define_command,
+	document_command, source_cleanup_lines, do_fclose_cleanup,
+	show_user_1): Moved here from top.c.
+	(script_from_file): New function. Implements execution of a script
+	contained in a file (part of code for the source_command() that used
+	to exist in top.c).
+	* cli/cli-script.h: Definitions/declarations for the above.
+	* cli/cli-setshow.c: New file. Handle set and show GDB CLI commands.
+	(parse_auto_binary_operation, parse_binary_operation,
+	do_setshow_command, cmd_show_list): Moved here from command.c.
+	* cli/cli-setshow.h: Definitions/declarations for the above.
+	* top.c: Remove all CLI code, except the command loop.
+	(gdb_init): Call init_cli_cmds().
+	* command.c: Remove obsolete file.
+	* command.h: Mark as DEPRECATED.
+	* gdbcmd.h: Ditto.
+	* call-cmds.h: Ditto.
+	* Makefile.in (SFILES): Remove command.c.
+	(COMMON_OBS): Remove command.o.
+	(command.o): Remove obsolete target.
+	(cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros.
+	Refer to CLI header files.
+	(cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets.
+	(SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS,
+	SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN,
+	SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli
+	subdirectory.
+	* configure.in (enable_gdbcli): New option. Include the CLI in the
+	executable (cannot be disabled yet).
+	(CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS,
+	CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add
+	the corresponding SUBDIR_CLI_* macros if CLI requested.
+	* configure: Regenerate.
+
+2000-10-27  Pierre Muller  <muller@ics.u-strasbg.fr>
+
+	* p-exp.y (yylex): avoid problem with symbol name 
+	starting as a operator name.
+
+2000-11-30  Fernando Nasser  <fnasser@redhat.com>
+
+	* linespec.h: New file. Declarations for linespec.c.
+	* linespec.c, alpha-tdep.c, breakpoint.c, parse.c, source.c,
+	symtab.c, tracepoint.c: Include the above.
+	* completer.c: New file. Line completion stuff for GDB.
+	(get_gdb_completer_word_break_characters,
+	get_gdb_completer_quote_characters): New functions. Accessors for
+	useful completer internal data.
+	(filename_completer, line_completion_function, skip_quoted): Moved
+	here from top.c.
+	* completer.h: New file. Declarations for the above.
+	* linespec.c (decode_line_1): Use
+	get_gdb_completer_word_break_characters and
+        get_gdb_completer_quote_characters.
+	* top.c: Include completer.h.
+	(filename_completer, line_completion_function, skip_quoted):
+	Moved to completer.c.
+	* corefile.c, exec.c, source.c, symfile.c, linespec.c: Include
+	completer.h.
+	* Makefile.in (SFILES): Add completer.c.
+	(COMMON_OBS): Add completer.o.
+	(completer.o): New target.
+	(linespec.o, alpha-tdep.o, breakpoint.o, parse.o, source.o,
+        symtab.o, tracepoint.o): Add linespec.h to dependencies list.
+	(corefile.o, exec.o, source.o, symfile.o, linespec.o): Add completer.h
+	to dependencies list.
+
+Thu Nov 30 13:19:16 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdbarch.c: Regenerate.
+
+Thu Nov 30 01:14:21 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* varobj.c (varobj_create): Initialize ``old_fi''.
+	(varobj_update): Initialize ``templist''.
+
+	* kod-cisco.c (cisco_kod_request): Simplify allocation of
+ 	``sync_ids'' eliminating uninitialized variable.
+
+2000-11-28  Mark Salter  <msalter@redhat.com>
+
+	* MAINTAINERS: Add Mark Salter to Write After Approval list.
+
+Tue Nov 28 12:24:43 2000  Christopher Faylor <cgf@cygnus.com>
+
+	* win32-nat.c (dll_code_sections_add): strdup -> xstrdup.
+
+Mon Nov 27 11:45:52 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* remote.c (remote_write_bytes): Add default case to switch
+ 	initializing ``todo''. Ditto for ``nr_bytes''.
+ 	* top.c (catch_errors): Always initialize ``val''.
+	* solib.c (info_sharedlibrary_command): Handle bfd_get_arch_size
+ 	returning an unknown size.
+	* gdbtypes.c (count_virtual_fns): Always initialize ``vfuncs''.
+	* breakpoint.c (break_at_finish_at_depth_command_1): Initialise
+ 	extra_args to NULL.
+	(break_at_finish_command_1): Ditto.
+ 
+Mon Nov 27 11:27:06 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* TODO: Add GFDL updates to 5.1 release criteria.
+
+2000-11-26  Nick Clifton  <nickc@redhat.com>
+
+        * configure.tgt (xscale-*): Add.
+        * configure.host (xscale-*): Add.
+
+2000-11-24  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* m68hc11-tdep.c  (gdb_print_insn_m68hc11): New function.
+	(_initialize_m68hc11_tdep): Install it. Register bfd_arch_m68hc12.
+
+2000-11-24  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* m68hc11-tdep.c (gdbarch_tdep): Move stack_correction global to here.
+	(STACK_CORRECTION): Get stack correction using gdbarch_tdep.
+	(m68hc11_saved_pc_after_call): Use STACK_CORRECTION.
+	(m68hc11_frame_chain): Likewise.
+	(m68hc11_frame_init_saved_regs): Likewise.
+	(m68hc11_init_extra_frame_info): Likewise.
+	(m68hc11_push_arguments): Likewise.
+	(m68hc11_push_arguments): Likewise.
+	(m68hc11_store_struct_return): Likewise.
+	(m68hc11_push_return_address): Likewise.
+	(m68hc11_gdbarch_init): Setup stack_correction according to arch.
+
+Mon Nov 20 13:59:29 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure.in: Add support for configure option
+ 	--enable-gdb-build-warnings. Mention need to update doco.
+	* configure: Regenerate.
+
+2000-11-21  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
+
+	* target.h (TARGET_SIGNAL_REALTIME_64):  Added for IRIX 6.
+	* target.c (target_signal_from_host, do_target_signal_to_host):
+	Handle TARGET_SIGNAL_REALTIME_64.
+
+2000-11-21  Kevin Buettner  <kevinb@redhat.com>
+
+	* solib.c (solib_open): Handle the case where
+	solib_absolute_prefix is NULL.
+
+2000-11-20  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* solist.h: Declare new function solib_open.
+	* solib.c (solib_open): New function.  Abstracts some of the
+	code from solib_map_sections, for finding the binary solib file.
+	(solib_map_sections): Call solib_open.
+	* solib-svr4.c (enable_break): Call solib_open.
+
+2000-11-20  J.T. Conklin  <jtc@redback.com>
+
+	* gdbserver/low-nbsd.c (fetch_inferior_registers,
+ 	store_inferior_registers): Support older NetBSD/powerpc systems
+ 	from before fp reg support was added.  Adapt to register number
+ 	changes caused when powerpc target was multi-arched.
+
+2000-11-20  H.J. Lu  <hjl@gnu.org>
+
+	* ia64-tdep.c (gdbarch_tdep): Change reference from
+	ELFOSABI_MONTEREY to ELFOSABI_AIX.
+
+2000-11-20  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
+
+	* c-valprint.c (print_function_pointer_address):  New function
+	to automatically dereference a function pointer for printing
+	if necessary.
+	(c_val_print):  Use print_function_pointer_address when printing
+	function pointer addresses.
+
+2000-11-20  J.T. Conklin  <jtc@redback.com>
+
+	* gdbserver/low-nbsd.c: Fix typos.
+
+2000-11-20  Jeffrey A Law  (law@cygnus.com)
+
+        * pa64solib.c (add_to_solib): Pass TARGET to pa64_solib_load_symbols.
+
+Mon Nov 20 23:21:53 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* MAINTAINERS: Peter Schauer and Kevin Buettner maintain AIX.  Jim
+ 	Blandy, Kevin Buettner and Peter Schauer share shared libs.
+
+	From Nick Duffek:
+ 	* MAINTAINERS: Share responsibility for
+ 	Solaris/x86 between co-maintainers.
+
+	* MAINTAINERS: Add linespec as a separate component.
+	
+Mon Nov 20 14:29:39 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* command.h (error_no_arg): Add noreturn attribute to declaration.
+
+Fri Nov 17 16:07:23 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* utils.c (xvasprintf, xasprintf): New functions.
+	* defs.h (xvasprintf, xasprintf): Add declarations.
+
+	* remote.c (add_packet_config_cmd): Use function xasprintf instead
+ 	of asprintf.
+	* utils.c (vfprintf_maybe_filtered, vfprintf_unfiltered): Use
+ 	function xvasprintf instead of vasprintf.
+
+	* TODO (xasprintf): Update.
+
+Mon Nov 20 12:22:32 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* TODO: Mention ``extern'' and ``STREQ'' cleanups.
+
+2000-11-19  Jim Blandy  <jimb@redhat.com>
+
+	* symtab.c (no_symtab_msg): Remove definition.
+	(sources_info): Replace use of no_symtab_msg with the string
+ 	itself.
+	* linespec.c (no_symtab_msg): Remove declaration.
+	(decode_line_1): Replace uses of no_symtab_msg with the string
+ 	itself.
+
+2000-11-17  Kevin Buettner  <kevinb@redhat.com>
+
+	* rs6000-tdep.c (refine_prologue_limit): New function.
+	(skip_prologue): When zero, attempt to obtain value for
+	lim_pc by calling refine_prologue_limit().  Also, fix
+	fencepost error regarding the limit in the loop.
+
+	From Peter Schauer:
+	* rs6000-tdep.c (skip_prologue):  Handle optimizer code motions into
+	the prologue by continuing the prologue search, if we have no valid
+	frame yet or if the return address is not yet saved in the frame.
+
+2000-11-17  Kevin Buettner  <kevinb@redhat.com>
+
+	* wrapper.c (gdb_value_assign, wrap_value_assign): Protoize.
+
+2000-11-16  Christopher Faylor  <cgf@redhat.com>
+
+	* thread.c (thread_apply_all_command): Save the command before
+	executing it because it may be modified.  Restore the saved command so
+	that the same command is executed on next thread.
+	(thread_apply_command): Same correction.
+
+2000-11-16  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* regcache.c (read_register_bytes): Failing to set register_valid
+	is not necessarily an error, if the register is a pseudo-register.
+	Some pseudo-registers are never marked as valid, so that they will
+	be read anew every time.  Determining if a pseudo-register is valid
+	(or should be marked invalid) may be difficult, whereas just 
+	recomputing it may be cheap.
+
+Thu Nov 16 09:47:57 2000  David Taylor  <taylor@redhat.com>
+
+	* tracepoint.c (trace_find_tracepoint_command): Replace call to
+	parse_and_eval_address with a call to parse_and_eval_long as
+	we are evaluating an integer, not an address.
+	* top.c (show_commands): Ditto.
+
+2000-11-15  Kevin Buettner  <kevinb@redhat.com>
+
+	* xcoffread.c (arrange_linetable, xcoff_initial_scan): Protoize.
+
+Wed Nov 15 09:31:39 2000  David Taylor  <taylor@redhat.com>
+
+	* utils.c (strlen_paddr, paddr, paddr_nz): Use TARGET_ADDR_BIT,
+	not TARGET_PTR_BIT, since we are dealing with addresses, not
+	pointers.
+	
+2000-11-14  Daniel Berlin  <dberlin@redhat.com>
+
+	From Kenneth Block <kenneth.block@compaq.com>
+
+        * demangle.c : Use libibery list of demanglers instead of out of
+        date local copy.
+
+Wed Nov 15 00:29:46 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	From Klaus Espenlaub <espenlaub@informatik.uni-ulm.de>
+	* remote.c (_initialize_remote): Call
+ 	show_memory_write_packet_size when ``show remotewritesize''
+ 	command.
+
+2000-11-13  Eli Zaretskii <eliz@is.elta.co.il>
+
+	* config/djgpp/config.sed: Fix tweaking "VPATH=.:foo", and handle
+        the gettext's posrcprefix correctly with drive letters.
+
+2000-11-10  Jim Blandy  <jimb@redhat.com>
+
+	* stabsread.c (read_range_type): Properly construct complex
+	type nodes.
+
+2000-11-10  Fernando Nasser  <fnasser@totem.toronto.redhat.com>
+
+	* symtab.c (decode_line_1, total_number_of_methods, find_methods,
+	build_command_line_spec, find_toplevel_char, decode_line_2):
+	Move to linespec.c.
+	* linespec.c: New file. Routines that handle linespecs, formerly
+	in symtab.c.
+	* symtab.h: Export find_line_symtab and find_function_start_sal.
+	* Makefile.in (SFILES): Add linespec.c.
+	(COMMON_OBS): Add linespec.o.
+	(linespec.o): New target.
+
+2000-11-10  Christopher Faylor <cgf@cygnus.com>
+
+	* inferior.h (step_over_calls_kind): New enum to clarify values in
+	step_over_calls.
+	* infcmd.c (step_over_calls): Change definition.
+	(step_1): Use new enum values in relation to step_over_calls.
+	(step_once): Ditto.
+	(until_next_command): Ditto.
+	* infrun.c (clear_proceed_status): Ditto.
+	(handle_inferior_event): Ditto.
+
+2000-11-10  Stephane Carrez  <Stephane.Carrez@sun.com>
+
+	* inferior.h (step_stop_if_no_debug): New variable.
+	* infrun.c (step_stop_if_no_debug): Declare.
+	(handle_inferior_event): Stop the step command if we entered a function
+	without line info.
+	(_initialize_infrun): New command 'set step-mode' to control the step
+	command.
+	* infcmd.c (step_once): Switch to stepi mode if there is no line info
+	(and switching is enabled).
+
+2000-11-10  J.T. Conklin  <jtc@redback.com>
+
+	* target.c (do_xfer_memory): Only perform a single memory transfer
+ 	instead of iterating to tranfer the entire region.  Higher layers
+ 	are expected to call this function multiple times for partial
+ 	transfers.
+	(target_xfer_memory_partial): Remove unused local variables.
+
+2000-11-10  Nick Duffek  <nsd@redhat.com>
+
+	* target.c (target_xfer_memory_partial): Return bytes transferred
+	instead of 0.
+
+2000-11-09  Kevin Buettner  <kevinb@redhat.com>
+
+	* values.c (value_being_returned, using_struct_return): Protoize.
+	* varobj.c (child_exists, cplus_class_num_children): Protoize.
+
+2000-11-09  Kevin Buettner  <kevinb@redhat.com>
+
+	Changes based on a patch from Ulrich Drepper:
+	* solib-svr4.c (svr4_relocate_main_executable): New function.
+	(svr4_solib_create_inferior_hook):  Call
+	svr4_relocate_main_executable.
+	
+2000-11-09  J.T. Conklin  <jtc@redback.com>
+
+	* config/i386/nbsd.mh: Remove solib.o, solib-svr4.o from NATDEPFILES.
+	* config/i386/nbsdelf.mh: Likewise.
+	* config/m68k/nbsd.mh: Likewise.
+	* config/ns32k/nbsd.mh: Likewise.
+	* config/powerpc/nbsd.mh: Likewise.
+	* config/sparc/nbsd.mh: Likewise.
+	* config/sparc/nbsdelf.mh: Likewise.
+	* config/i386/nbsd.mt: Add solib.o, solib-svr4.o to TDEPFILES.
+	* config/i386/nbsdelf.mt: Likewise.
+	* config/m68k/nbsd.mt: Likewise.
+	* config/ns32k/nbsd.mt: Likewise.
+	* config/powerpc/nbsd.mt: Likewise.
+	* config/sparc/nbsd.mt: Likewise.
+
+2000-11-09  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
+
+	Add auto-solib-add support for AIX, remove obsolete and unused
+	SOLIB_SYMBOLS_MANUAL code, cleanup of AIX shared library handling code.
+	* rs6000-nat.c (vmap_symtab):  Do not try to modify offsets
+	if symbols are not yet loaded.
+	(vmap_add_symbols):  New function to add symbols for a vmap entry.
+	(add_vmap):  Turn errors into warnings, return NULL vmap upon
+	failure. Add symbols via vmap_add_symbols only if requested.
+	(xcoff_relocate_core):  Allow debugging of core files without an
+	executable file. Handle NULL returns from add_vmap gracefully.
+	* xcoffsolib.c (solib_add):  Remove, no longer needed.
+	(solib_info):  Do not check for new shared libraries if there is no
+	inferior process.
+	(sharedlibrary_command):  Made static.
+	Do not check for new shared libraries if there is no inferior process.
+	Add symbols for requested shared libraries via vmap_add_symbols.
+	(_initialize_solib):  Add `set auto-solib-add' command.
+	* xcoffsolib.h (vmap_add_symbols):  Add prototype declaration.
+
+	* config/rs6000/tm-rs6000.h (PC_LOAD_SEGMENT):  Move from here ...
+	* config/rs6000/nm-rs6000.h:  ... to here, this is an AIX native
+	feature.
+	* config/powerpc/tm-macos.h, config/powerpc/tm-ppc-eabi.h,
+	config/powerpc/tm-ppc-nw.h, config/rs6000/tm-rs6000ly.h:
+	Remove #undef PC_LOAD_SEGMENT.
+	* config/powerpc/aix.mt, config/rs6000/aix4.mt, config/rs6000/rs6000.mt
+	(TDEPFILES):  Move xcoffsolib.o from here ...
+	* config/powerpc/aix.mh, config/rs6000/aix4.mh, config/rs6000/rs6000.mh
+	(NATDEPFILES):  ... to here, xcoffsolib.o contains AIX native code
+	only.
+	* rs6000-tdep.c:  Remove #include xcoffsolib.h, no longer needed.
+	* xcoffsolib.h (xcoff_relocate_symtab_hook):  Remove declaration.
+	* rs6000-nat.c (_initialize_core_rs6000):  Remove setting of
+	xcoff_relocate_symtab_hook, no longer needed.
+	* xcoffsolib.c (solib_info, sharedlibrary_command):  Remove
+	xcoff_relocate_symtab_hook indirection, call xcoff_relocate_symtab
+	directly, as xcoffsolib.c is now compiled in native AIX configurations
+	only.
+	* Makefile.in:  Update dependencies for rs6000-tdep.o, rs6000-nat.o
+	and xcoffsolib.o.
+
+Thu Nov  9 17:16:29 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* MAINTAINERS: Specify the vax-dec-vms5.5 target tupple.
+	* vax-tdep.c: Include "gdbcore.h", "frame.h" and "value.h".
+	(vax_print_insn): Change ``d'' to a const char pointer.
+
+2000-11-08  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* gdbarch.sh: Spelling correction: registrary -> registry.
+	* gdbarch.c: Ditto.
+
+Wed Nov  8 23:08:48 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* m68k-tdep.c (m68k_get_longjmp_target): Work around targets that
+ 	don't define JB_PC or JB_ELEMENT_SIZE.
+
+Wed Nov  8 22:46:43 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* m68k-tdep.c (m68k_get_longjmp_target): Rename function
+ 	get_longjmp_target.  Remove wrapping #ifdef GET_LONGJMP_TARGET.
+	* config/m68k/tm-m68k.h (m68k_get_longjmp_target): Add function
+ 	declaration.
+
+	* config/m68k/tm-vx68.h, config/m68k/tm-sun3.h,
+ 	config/m68k/tm-m68kv4.h, config/m68k/tm-linux.h,
+ 	config/m68k/tm-es1800.h, config/m68k/tm-cisco.h: Update definition
+ 	of GET_LONGJMP_TARGET.  Delete get_longjmp_target function
+ 	declaratation.
+
+Wed Nov  8 15:32:23 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdbserver/configure.in (files): Don't link nm-empty.h when a
+ 	non-native target.
+	* gdbserver/configure: Regenerate.
+
+2000-11-07  Kevin Buettner  <kevinb@redhat.com>
+
+	* valops.c (typecmp): Protoize.
+	* valprint.c (strcat_longest): Protoize.
+
+2000-11-07  Kevin Buettner  <kevinb@redhat.com>
+
+	* ia64-tdep.c (native_find_global_pointer):  New global variable.
+	(struct gdbarch_tdep): Add member find_global_pointer.
+	(ia64_gdbarch_init): Initialize find_global_pointer member.  Also,
+	tell the gdbarch machinery that we have floating point registers.
+	(FIND_GLOBAL_POINTER): New macro.
+	(generic_elf_find_global_pointer):  Renamed from find_global_pointer.
+	(find_func_descr, ia64_push_return_address):  Call
+	FIND_GLOBAL_POINTER instead of find_global_pointer.
+	(process_note_abi_tag_sections):  Enable code previously disabled
+	by #if 0.
+
+2000-11-07  Daniel Berlin  <dberlin@redhat.com>
+
+	* dwarf2read.c: Revert June 5th change for caching of types,
+	as per Jim Blandy's request.
+
+2000-11-06  Fernando Nasser  <fnasser@totem.toronto.redhat.com>
+
+	* wrapper.c (gdb_value_assign): New function.  Longjump-free
+	version of value_assign.
+	(wrap_value_assign): New function. Wrapper for value_assign.
+	* wrapper.h: Add declaration for the above.
+	* varobj.c (varobj_set_value): Use gdb_value_assign, not
+	value_assign which can longjump.  Do not change varobj value if
+	assign fails.
+	
+2000-11-06  Fernando Nasser  <fnasser@cygnus.com>
+
+	From  Steven Johnson  <sbjohnson@ozemail.com.au>:
+
+        This set of changes add "hookpost-" as an expansion on the original
+	hooking of commands to GDB. A Hook may now be run "AFTER" execution of
+	a command as well as before.
+
+	* command.h (struct cmd_list_element): Changed elements hook and hookee
+	to hook_pre and hookee_pre respectively. Added hook_post and hookee_post
+	for the post hook command operation. Added hook_in so that an executing
+	hook can be flagged to prevent recursion.
+	* command.c (add_cmd): Changed initilization of cmd_list_element to
+	reflect above changes.
+	(delete_cmd): Remove both pre and post hooks.
+	(help_cmd): Notify that the command has pre and/or post hooks.
+	* infrun.c (normal_stop): Change references to hook_pre from hook.
+	* top.c (execute_command): Run both pre and post hooks.
+	(define_command): Allow definition of both pre and post hooks.
+	The definition of pre-hooks is done as before, with the "hook-"
+	prefix for backward compatibility.
+
+2000-11-06  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
+
+	* stack.c (return_command):  Pop dummy frame if we just returned from
+	a stop in a call dummy.
+
+2000-11-05  Kevin Buettner  <kevinb@redhat.com>
+
+	* v850-tdep.c (handle_prepare, handle_pushm): Remove extraneous
+	blank line after function declarator.
+	* v850ice.c (v850ice_xfer_memory, do_gdb): Protoize.
+
+2000-11-03  Kevin Buettner  <kevinb@redhat.com>
+
+	* utils.c (add_continuation, add_intermediate_continuation,
+	printchar): Protoize.
+
+2000-11-03  Kevin Buettner  <kevinb@redhat.com>
+
+	* dwarf2read.c (new_symbol): Relocate address of symbol by the
+	base address of the section it is in rather than always using
+	the base address of the .text section.
+
+2000-11-01  J.T. Conklin  <jtc@redback.com>
+
+	* TODO: Note abstraction layer violation where "ocd reset" command
+	must invalidate the dcache, and how this might be fixed.
+
+	* monitor.c (#include "dcache.h"): Removed.
+	(remote_dcache): Removed.
+	(monitor_open): Removed code that created local dcache.
+	(flush_monitor_dcache): Removed (unused function).
+	(monitor_resume): Removed call to dcache_invd().
+	(monitor_load): Likewise.
+	(monitor_xfer_memory): Changed to call monitor_write_memory(),
+	monitor_write_memory_block(), and monitor_read_memory() instead
+	of dcache_xfer_memory().
+	* monitor.h (flush_monitor_dcache): Removed (unused function).
+	* ocd.c (#include "dcache.h"): Removed.
+	(ocd_dcache): Removed.
+	(ocd_open): Removed code that created local dcache.
+	(ocd_resume): Removed call to dcache_invd().
+	(ocd_xfer_memory): Changed to call ocd_write_bytes() and 
+	ocd_read_bytes() instead of dcache_xfer_memory().
+	(bdm_reset_command): Invalidate target dcache.
+	* remote-bug.c (bug_load): Remove call to dcache_invd().
+	(bug_resume): Likewise.
+	(bug_settings): Remove dcache, readfunc, and writefunc fields
+	from initializer.
+	(bug_xfer_memory): Changed to call bug_read_memory() and 
+	bug_write_memory() instead of dcache_xfer_memory().
+	* remote-nindy.c (#include "dcache.h"): Removed.
+	(nindy_dcache): Removed.
+	(nindy_open): Removed code that created local dcache.
+	(nindy_resume): Removed call to dcache_invd().
+	(nindy_load): Likewise.
+	(nindy_xfer_inferior_memory): Changed to call ninMemPut() and 
+	ninMemGet() instead of dcache_xfer_memory().
+	* remote-sds.c (#include "dcache.h"): Removed.
+	(sds_dcache): Removed.
+	(sds_open): Removed code that created local dcache.
+	(sds_resume): Removed call to dcache_invd().
+	(sds_xfer_memory): Changed to call sds_write_bytes() and 
+	sds_read_bytes() instead of dcache_xfer_memory().
+	* remote-utils.c (gr_open): Removed code that created local dcache.
+	* remote-utils.h (#include "dcache.h"): Removed.
+	(struct gr_settings): Removed dcache, readfunc, and writefunc fields.
+	(gr_get_dcache, gr_set_dcache): Removed macro definitions.
+	* remote.c (#include "dcache.h"): Removed.
+	(remote_dcache): Removed.
+	(remote_open_1): Removed code that created local dcache.
+	(remote_async_open_1): Likewise.
+	(remote_resume): Removed call to dcache_invd().
+	(remote_async_resume): Likewise.
+	(remote_xfer_memory): Changed to call remote_write_bytes() and
+	remote_read_bytes() instead of dcache_xfer_memory().
+	* wince.c (#include "dcache.h"): Removed.
+	(remote_dcache): Removed.
+	(child_create_inferior): Removed code that created local dcache.
+	(child_xfer_memory): Changed to call remote_write_bytes() and
+	remote_read_bytes() instead of dcache_xfer_memory().
+	(child_resume): Removed call to dcache_invd().
+	
+	* target.c (target_dcache): Added.
+	(target_load): Invalidate target_dcache.
+	(do_xfer_memory): New function.
+	(target_xfer_memory): Reimplement in terms of dcache_xfer_memory().
+	(target_xfer_memory_partial): Likewise.
+	(initialize_targets): Create target_dcache.
+	* target.h (#include "dcache.h"): Added.
+	(target_open): Invalidate target_dcache.
+	(target_resume): Likewise.
+	(do_xfer_memory): New declaration.
+	
+	* dcache.c (dcache_init): Removed reading and writing arguments.
+	(dcache_struct): Removed read_memory and write_memory fields.
+	(dcache_write_line): Call do_xfer_memory.
+	(dcache_read_line): Likewise.
+	(dcache_xfer_memory): Likewise.
+	(dcache_invalidate): Renamed from dcache_invd.
+	(dcache_init): Updated.
+	(dcache_xfer_memory): Updated.
+	* dcache.h (memxferfunc): Removed definition.
+	(dcache_init): Removed reading and writing arguments.
+	
+2000-11-03  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
+
+	* objfiles.c (objfile_relocate):  Relocate ei.entry_point with
+	its section offset, use SECT_OFF_TEXT only as a fallback.
+
+2000-11-01  Kevin Buettner  <kevinb@redhat.com>
+
+	* symm-nat.c (print_1167_regs): Remove extraneous blank line
+	after function declarator.
+	* symtab.c (search_symbols): Likewise.
+	* ultra3-nat.c (fetch_core_registers): Protoize.
+
+2000-10-30  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* config/sh/tm-linux.h: New file.  Include generic tm-linux.h, 
+	plus tm-sh.h, then define SVR4_FETCH_LINK_MAP_OFFSETS to use
+	the sh target function instead of the default link map offsets.
+	* config/sh/sh.mt: Add solib.o and solib-svr4.o to TDEPFILES.
+	Use sh/tm-linux.h instead of sh/tm-sh.h.
+	* sh-tdep.c (sh_linux_svr4_fetch_link_map_offsets): 
+	New function.  Construct target-specific link map offsets.
+	* i386-linux-tdep.c (i386_linux_svr4_fetch_link_map_offsets:
+	New function.  Construct target-specific link map offsets.
+	* config/i386/tm-linux.h: Use above function instead of default.
+
+2000-10-30  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* config/i386/tm-linux.h: Remove definition of SVR4_SHARED_LIBS,
+	and inclusion of solib.h.  Move up into ../tm-linux.h.
+	config/tm-linux.h: Define SVR4_SHARED_LIBS, include solib.h.
+
+2000-10-30  Kevin Buettner  <kevinb@redhat.com>
+
+	* top.c (simplified_command_loop, add_info, add_com,
+	help_command): Protoize.
+	* ui-out.c (gdb_query): Protoize.
+
+2000-10-30  Kevin Buettner  <kevinb@redhat.com>
+
+	Changes based on analysis from Peter Schauer:
+	* solist.h (struct so_list): Remove field lmend.
+	(struct target_so_ops): Remove field lm_addr.  Add field
+	relocate_section_addresses.  Add comments for all fields
+	in this structure
+	(TARGET_SO_LM_ADDR): Remove.
+	(TARGET_SO_RELOCATE_SECTION_ADDRESSES): New macro.
+	* solib-svr4.c (svr4_relocate_section_addresses): New function.
+	(_initialize_svr4_solib): Remove lm_addr initialization.  Add
+	initialization for relocate_section_addresses.
+	* solib.c (solib_map_sections): Invoke 
+	TARGET_SO_RELOCATE_SECTION_ADDRESSES instead of using now
+	defunct TARGET_SO_LM_ADDR to relocate the section addresses.
+	Also, eliminate assignment to the lmend field since this
+	field no longer exists.
+	(symbol_add_stub): Remove machinery for determining the lowest
+	section.
+	(info_sharedlibrary_command): Print the text section starting
+	and ending addresses.
+	(solib_address): Don't use TARGET_SO_LM_ADDR, nor so->lmend to
+	determine if an address is in a shared object.  Instead, scan
+	the section table and test against the starting and ending
+	addresses for each section.
+
+2000-10-30  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* config/m68k/linux.mh: Remove solib.c, solib-svr4.c from NATDEPFILES.
+	* config/powerpc/linux.mh: ditto.
+	* config/ia64/linux.mh: ditto.
+	* config/i386/linux.mh: ditto.
+	* config/alpha/alpha-linux.mh: ditto.
+	* config/arm/linux.mh: ditto.
+	* config/m68k/linux.mt: Add solib.c, solib-svr4.c to TDEPFILES.
+	* config/powerpc/linux.mt: ditto.
+	* config/ia64/linux.mt: ditto.
+	* config/i386/linux.mt: ditto.
+	* config/alpha/alpha-linux.mt: ditto.
+	* config/arm/linux.mt: ditto.
+
+2000-10-30  J.T. Conklin  <jtc@redback.com>
+
+	* gdbarch.sh, hp-psymtab-read.c, hpread.c, m3-nat.c, mcore-tdep.c, 
+	mips-tdep.c, monitor.c, regcache.c, remote-es.c, ser-unix.c, 
+	somread.c, tracepoint.c: Fix spelling errors in comments.
+	* gdbarch.c: Regenerate.
+
+	* gnu-nat.c (S_exception_raise_request): Fix typos and spelling 
+	errors in strings.
+	* m3-nat.c (intercept_exec_calls, mach_thread_parse_id): Likewise.
+	* mcore-tdep.c (mcore_analyze_prologue): Likewise.
+	* mips-tdep.c (mips16_next_pc, _initialize_mips_tdep): Likewise.
+	* remote-e7000.c (e7000_start_remote): Likewise.
+	* remote-rdp.c (handle_swi): Likewise.
+	* remote-vx.c (vx_load_command): Likewise.
+	* sh-tdep.c (sh_do_pseudo_register): Likewise.
+	* sol-thread.c (td_err_string): Likewise.
+	* symtab.c (decode_line_2): Likewise.
+	
+Mon Oct 30 10:19:01 2000  David Taylor  <taylor@redhat.com>
+
+	* eval.c (parse_and_eval_long): New function.
+	* value.h: Declare it.
+	
+	* breakpoint.c (breakpoints_info, maintenance_info_breakpoints):
+	Call parse_and_eval_long, not parse_and_eval_address.
+	* command.c (do_setshow_command): Ditto.
+	* infcmd.c (step_1, signal_command, continue_command): Ditto.
+	* infrun.c (signals_info): Ditto.
+	* stack.c (set_backtrace_limit_command, backtrace_command_1,
+	up_silently_base, down_silently_base): Ditto.
+	* tracepoints.c (tracepoints_info, trace_find_command,
+ 	trace_find_tracepoint_command): Ditto.
+	* valprint.c (set_radix): Ditto.
+	* values.c (show_values): Ditto.
+
+2000-10-28  Kevin Buettner  <kevinb@redhat.com>
+
+	* symtab.c (decode_line_2, file_matches, search_symbols): Protoize.
+	* thread.c (iterate_over_threads): Protoize.
+
+2000-10-27  J.T. Conklin  <jtc@redback.com>
+
+	* arch-utils.c (set_architecture, set_architecture_from_arch_mach,
+ 	set_gdbarch_from_file): Fix spelling error in string.
+	* v850-tdep.c (v850_target_architecture_hook): Likewise.
+	* gdbarch.sh: Fix spelling errors in comments.
+	* gdbarch.c, gdbarch.h: Regenerate.
+
+	* ppcnbsd-nat.c (fetch_core_registers, fetch_inferior_registers,
+ 	store_inferior_registers): Support older NetBSD/powerpc systems
+ 	from before fp reg support was added.  Adapt to register number
+	changes caused when powerpc target was multi-arched.
+
+2000-10-26  David B. Anderson <davea@sgi.com>
+
+	* breakpoint.c breakpoint.h hppab-nat.c infrun.c
+	language.h mcore-tdep.c mips-tdep.c symfile.c symtab.c
+	symtab.h target.c tm-mips.h xm-sun4sol2.h: Corrected
+	spelling errors in comments.
+	* gdbarch.c gdbarch.sh: Removed word from comment.
+
+2000-10-26  Kevin Buettner  <kevinb@redhat.com>
+
+	* sun3-nat.c (fetch_core_registers): Protoize.
+	* symm-nat.c (print_1167_regs, child_xfer_memory): Protoize.
+
+2000-10-26  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* stabsread.c (define_symbol): Update comment.
+
+2000-10-26 Pierre Muller <muller@ics.u-strasbg.fr>
+
+     	* stabsread.c (define_symbol): Set the type_name of the type
+	of the new symbol to the symbol name for type symbol, if the
+	language is Pascal.
+	
+2000-10-26  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
+
+	* arch-utils.c, arch-utils.h (default_convert_from_func_ptr_addr):
+	New function.
+	* gdbarch.sh (CONVERT_FROM_FUNC_PTR_ADDR):  Add.
+	* gdbarch.c, gdbarch.h:  Regenerate.
+	* valops.c (find_function_addr):  Use CONVERT_FROM_FUNC_PTR_ADDR
+	unconditionally.
+
+	* config/rs6000/tm-rs6000.h (CONVERT_FROM_FUNC_PTR_ADDR):  Delete
+	definition.
+	* config/powerpc/tm-linux.h (CONVERT_FROM_FUNC_PTR_ADDR):  Remove
+	undef.
+	* rs6000-tdep.c (rs6000_convert_from_func_ptr_addr):  Fix comment.
+	(rs6000_gdbarch_init):  Register rs6000_convert_from_func_ptr_addr
+	if not ELFOSABI_LINUX.
+
+2000-10-25  Kevin Buettner  <kevinb@redhat.com>
+
+	* config/rs6000/rs6000lynx.mt (TDEPFILES): Revert 2000-10-24
+	change in which solib-svr4.o was inadvertently added to this
+	list.
+
+2000-10-25  Fred Fish  <fnf@cygnus.com>
+
+	* mips-tdep.c (MIPS_DEFAULT_MASK_ADDRESS_P): Define using either
+	the current arch or use zero.
+
+2000-10-25  Fernando Nasser  <fnasser@cygnus.com>
+
+	* ser-unix.c (do_unix_readchar): Coding style improvement only.
+
+2000-10-25  Fernando Nasser  <fnasser@cygnus.com>
+
+        * target.c (generic_mourn_inferior): Notify GUI that inferior is gone
+        by calling detach_hook, if defined.
+
+2000-10-24  Kevin Buettner  <kevinb@redhat.com>
+
+	* coffread.c (coff_end_symtab): When calling end_symtab(),
+	use SECT_OFF_TEXT() instead of 0 to represent the .text
+	section.
+	* hp-symtab-read.c (hpread_expand_symtab): Likewise.
+	* hpread.c (hpread_expand_symtab, hpread_process_one_debug_symbol):
+	Likewise.
+
+2000-10-24  Kevin Buettner  <kevinb@redhat.com>
+
+	* solib-svr4.c: New file created out of much of solib.c...
+	* solib.c (_SYSCALL32, BKPT_AT_SYMBOL): Move these defines to
+	solib-svr4.c.
+	(sys/types.h, signal.h, sys/param.h, fcntl.h, a.out.h,
+	elf/external.h, link.h): Move these includes to solib-svr4.c.
+	(bkpt_names, debug_base_symbols, main_name_list,
+	solib_extract_address, SOLIB_EXTRACT_ADDRESS, dynamic_copy,
+	ld_2_copy, debug_addr, flag_addr, LM_ADDR, LM_NEXT, LM_NAME,
+	IGNORE_FIRST_LINK_MAP_ENTRY, breakpoint_addr,
+	allocate_rt_common_objfile, solib_add_common_symbols,
+	bfd_lookup_symbol, look_for_base, elf_locate_base, locate_base,
+	first_link_map_member, open_symbol_file_object, match_main,
+	current_sos, interp_text_sect_low, interp_text_sect_high,
+	interp_plt_sect_low, interp_plt_sect_high,
+	in_svr4_dynsym_resolve_code, disable_break, enable_break,
+	special_symbol_handling): Moved to solib-svr4.c.
+	(debug32_copy, shadow_contents, fdmatch)
+	Removed entirely.
+	(struct so_list): Moved to solist.h
+	(MAX_PATH_SIZE): Moved to solist.h and renamed to
+	SO_NAME_MAX_PATH_SIZE.
+
+	* solist.h: New file created from struct so_list in solib.c.
+	(struct lm_info): Add forward declaration.
+	(struct so_list): Remove fields lm, lm32, lmaddr.  Replace with a
+	single field, lm_info, which will be a pointer to target specific
+	data.
+	(struct target_so_ops): New struct.
+	(free_so): Add extern declaration.
+	(current_target_so_ops): Declare new global variable.
+	(solib_map_sections): 
+	(TARGET_SO_LM_ADDR, TARGET_SO_FREE_SO, TARGET_SO_CLEAR_SOLIB,
+	TARGET_SO_SOLIB_CREATE_INFERIOR_HOOK,
+	TARGET_SO_SPECIAL_SYMBOL_HANDLING, TARGET_SO_CURRENT_SOS,
+	TARGET_SO_OPEN_SYMBOL_FILE_OBJECT):  New macros.
+	* solib.c (solib_map_sections, free_so, symbol_add_stub,
+	update_solib_list, solib_add, info_shared_library_command,
+	solib_address, clear_solib, solib_create_inferior_hook):  Use
+	new TARGET_SO_* macros to call function on target specific
+	side indirectly.
+	(current_target_so_ops): Define new global variable.
+	(_initialize_solib): Eliminate HAVE_LINK_H ifdef.
+	* solib-svr4.h: New file; defines struct link_map_offsets and
+	SVR4_FETCH_LINK_MAP_OFFSETS.
+	* solib-svr4.c (_initialize_svr4_solib, svr4_clear_solib,
+	svr4_free_so): New functions.
+	(special_symbol_handling, solib_create_inferior_function_hook,
+	current_sos): Rename by adding a svr4_ prefix.
+	(default_svr4_fetch_link_map_offsets): New function.
+	(LM_ADDR, LM_NEXT, LM_NAME, IGNORE_FIRST_LINK_MAP_ENTRY,
+	first_link_map_member, open_symbol_file_object, svr4_current_sos):
+	Remove dependence on existence of link.h by calling
+	SVR4_FETCH_LINK_MAP_OFFSETS to obtain the offsets of shared library
+	data.  As a result, SVR4 and non-SVR4 versions of many of these
+	functions coalesce into a single function and HAVE_STRUCT_LINK_MAP32
+	ugliness is moved into default_svr4_fetch_link_map_offsets where it
+	is relatively contained.
+	(SOLIB_EXTRACT_ADDRESS): Revert 2000-08-29 change in which
+	solib_extract_address() is called instead of extract_address().
+	(solib_extract_address): Removed.
+
+	* Makefile.in (solib.o): Add solist.h as a dependency.
+	(solib-svr4.o): Add dependencies.
+	* config/alpha/alpha-linux.mh, config/alpha/fbsd.mh,
+	config/arm/linux.mh, config/i386/fbsd.mh,
+	config/i386/i386dgux.mh, config/i386/i386gnu.mh,
+	config/i386/i386sco5.mh, config/i386/i386sol2.mt,
+	config/i386/i386v4.mh, config/i386/i386v42mp.mh,
+	config/i386/linux.mh, config/i386/nbsd.mh,
+	config/i386/nbsdelf.mh, config/i386/ncr3000.mt,
+	config/i386/ptx4.mh, config/i386/sun386.mt,
+	config/ia64/linux.mh, config/m68k/linux.mh,
+	config/m68k/m68kv4.mh, config/m68k/nbsd.mh,
+	config/m68k/sun2os4.mt, config/m68k/sun3os4.mt,
+	config/m88k/delta88v4.mh, config/mips/mipsv4.mh,
+	config/ns32k/nbsd.mh, config/powerpc/linux.mh,
+	config/powerpc/nbsd.mh, config/powerpc/solaris.mh,
+	config/rs6000/rs6000lynx.mt, config/sparc/linux.mt,
+	config/sparc/nbsd.mh, config/sparc/nbsdelf.mh,
+	config/sparc/sun4os4.mt, config/sparc/sun4sol2.mh
+	(NATDEPFILES):  Add solib-svr4.o to list.
+
+	* sparc-tdep.c (gregset.h): Don't include unless USE_PROC_FS is
+	defined.
+
+2000-10-24  Kevin Buettner  <kevinb@redhat.com>
+
+	* stabsread.c (dbx_lookup_type, dbx_alloc_type,
+	read_sun_builtin_type, read_sun_floating_type,
+	read_range_type): Protoize.
+
+Wed Oct 25 01:19:26 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* solib.c (open_symbol_file_object): Update function signature to
+ 	match catch_errors function argument.
+
+Wed Oct 25 00:08:01 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	From 2000-09-06 Angela Marie Thomas <angela@cygnus.com>:
+	* infttrace.c (get_dictionary_entry_of_page): Function
+	require_memory_page_dictionary takes no args.
+
+Tue Oct 24 16:12:00 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdba.el: Delete file.
+	* NEWS: Mention.
+
+2000-10-23 David B Anderson <davea@sgi.com>
+
+	* TODO: Correct spelling errors
+	* command.c (_initialize_command) corelow.c (core_open)
+	main.c (captured_command_loop) mips-tdep.c (mips32_next_pc)
+	remote.c serial.h top.c utils.c config/nm-lynx.h:
+	Correct spelling errors in comments
+
+2000-10-22  Kevin Buettner  <kevinb@redhat.com>
+
+	* sparc-nat.c (fetch_core_registers): Protoize.
+	* sparcl-tdep.c (download): Protoize.
+
+Fri Oct 20 19:08:47 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* MAINTAINERS: Add Fred Fish to Blanket Write Privs list.
+
+2000-10-19  Josef Ezra <jezra@emc.com>
+
+	* ax-gdb.c (gen_struct_ref): while generating data code, cases of
+ 	"collect p1->p2->data" where not covered if p2 is a 'typedefed'
+ 	type. this simple fix should forward the type pointer to the real
+ 	type.
+	
+2000-10-19  Kevin Buettner  <kevinb@redhat.com>
+
+	* solib.c (LM_ADDR, LM_NEXT, LM_NAME, IGNORE_FIRST_LINK_MAP_ENTRY,
+	open_symbol_file_object): Protoize.
+
+2000-10-17  Kevin Buettner  <kevinb@redhat.com>
+
+	* remote-vx29k.c (vx29k_frame_chain_valid): Protoize.
+	* remote.c (remote_xfer_memory, remote_search): Protoize.
+	* sol-thread.c (sol_thread_xfer_memory): Protoize.
+
+2000-10-16  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
+
+	* sparc-tdep.c (sparc_fix_call_dummy):  Improve comments.
+	Adjust call_dummy_breakpoint_offset, so that `finish' after a stop
+	in a call dummy works.
+	(sparc_gdbarch_init):  Fix setting of pc_in_call_dummy, it depends
+	on SPARC32/64_CALL_DUMMY_ON_STACK, not DO_CALL_DUMMY_ON_STACK.
+
+2000-10-15  Kevin Buettner  <kevinb@redhat.com>
+
+	* remote-st.c (st2000_xfer_inferior_memory): Protoize.
+	* remote-utils.c (gr_multi_scan): Protoize.
+	* remote-vx.c (vx_xfer_memory, net_get_symbols): Protoize.
+
+2000-10-13  Fernando Nasser  <fnasser@cygnus.com>
+
+	* remote.c (putpkt_binary): Call read_frame, not getpkt. Log message.
+	(read_frame): Do not call error() on communication error when
+	reading checksum, but return failure instead and log message.
+
+2000-10-13  Fernando Nasser  <fnasser@totem.to.cygnus.com>
+
+	* varobj.c (type_changeable): Arrays are not changeable.
+	Trying to check for updates was causing an error if the array lived
+	in a register as gdb value_equal() cannot handle that case yet.
+
+2000-10-13  Fernando Nasser  <fnasser@totem.to.cygnus.com>
+
+	* varobj.c (varobj_update): Prevent uninitialized error code to be
+	returned on type_changed.  Also, prevent value_equal() to be called
+	for the types we do not want to test for updates.
+
+2000-10-11  Fernando Nasser  <fnasser@totem.to.cygnus.com>
+
+	From Grant Edwards <grante@visi.com>
+	This keeps the GUI alive while running an RDI target and lets the
+	STOP button be used to stop the target.
+	* remote-rdi.c (arm_rdi_stop): New function.  Implements target_stop.
+	(init_rdi_ops): Set to_stop target vector entry to the above.
+	* rdi-share/ardi.c (stop_request): New variable.  Tells when a stop
+	has been requested.
+	(angel_RDI_stop_request): New function. Registers that a stop has
+	been requested.
+	(angel_RDI_ExecuteOrStep): Add call to ui_loop_hook() in loop that
+	waits while target is executing.  Initialize and reset stop_request.
+	* rdi-share/ardi.h: Add declaration of angel_RDI_stop_request().
+
+2000-10-12  Kevin Buettner  <kevinb@redhat.com>
+
+	* remote-rdp.c (remote_rdp_xfer_inferior_memory): Protoize.
+	* remote-sds.c (sds_xfer_memory): Protoize.
+	* remote-sim.c (gdbsim_xfer_inferior_memory): Protoize.
+
+2000-10-12  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	From Daniel Berlin <dberlin@redhat.com> :
+
+	* symtab.h (SYMBOL_INIT_DEMANGLED_NAME): Initialize the symbol
+ 	language to auto instead of unknown, so it will try to demangle
+ 	the symbol.
+	* symtab.h (OPNAME_PREFIX_P): Change operator prefix to correct value.
+	* symtab.c (gdb_mangle_name): Properly handle C++ operators.
+	
+2000-10-12  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	From Daniel Berlin <dberlin@redhat.com> :
+
+	* symtab.c (lookup_symbol_aux): New function. Renamed from
+ 	lookup_symbol. Move code to do demangling/case sensitivity to
+ 	lookup_symbol().
+  	(lookup_symbol): Now wrapper for lookup_symbol_aux, so we can
+ 	perform case sensitivity/demangling without leaking memory.  Move
+ 	code to do demangling/case sensitivity from old_lookup_symbol to
+ 	here.
+	(lookup_partial_symbol): Use SYMBOL_SOURCE_NAME instead of
+ 	SYMBOL_NAME.
+	(lookup_block_symbol): Use SYMBOL_SOURCE_NAME instead of
+ 	SYMBOL_NAME. Don't do linear search in case of C++.
+
+  	* symfile.c (compare_symbols): Use SYMBOL_SOURCE_NAME instead of
+ 	SYMBOL_NAME.
+  	(compare_psymbols): Same here.
+
+2000-10-09  Kevin Buettner  <kevinb@redhat.com>
+
+	* remote-nindy.c (non_dle, nindy_xfer_inferior_memory): Protoize.
+	* remote-os9k.c (rombug_xfer_inferior_memory): Protoize.
+	* remote-rdi.c (arm_rdi_xfer_memory): Protoize.
+
+2000-10-09  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
+
+	* config/i386/i386sol2.mh:  Add XM_CLIBS definition to resolve
+	reference to gethostbyname.
+
+2000-10-06  Kevin Buettner  <kevinb@redhat.com>
+
+	* remote-eb.c (eb_xfer_inferior_memory): Protoize.
+	* remote-es.c (es1800_xfer_inferior_memory, es1800_files_info):
+	Protoize.
+	* remote-mm.c (expect_msg): Protoize.
+
+2000-10-04  Kevin Buettner  <kevinb@redhat.com>
+
+	* rs6000-tdep.c (skip_prologue): Add new parameter lim_pc.
+	Update all callers.
+
+2000-10-03  Kevin Buettner  <kevinb@redhat.com>
+
+	* remote-bug.c (bug_xfer_memory, bug_insert_breakpoint,
+	bug_remove_breakpoint): Protoize.
+	* remote-e7000.c (fetch_regs_from_dump, e7000_xfer_inferior_memory):
+	Protoize.
+
+2000-10-01  Kevin Buettner  <kevinb@redhat.com>
+
+	* remote-adapt.c (adapt_insert_breakpoint, adapt_remove_breakpoint):
+	Protoize.
+	* remote-array.c (write_monitor, array_xfer_memory): Protoize.
+
+2000-09-29  Kevin Buettner  <kevinb@redhat.com>
+
+	* ppc-linux-nat.c (supply_gregset, fill_gregset): Change type
+	of first argument from gregset_t to gdb_gregset_t in order
+	to match declarations in gregset.h.
+	(supply_fpregset, fill_fpregset): Change type of first argument
+	from fpregset_t to gdb_fpregset_t in order to match declarations
+	in gregset.h.
+
+2000-09-29  Kevin Buettner  <kevinb@redhat.com>
+
+	* procfs.c (proc_iterate_over_mappings, proc_iterate_over_threads,
+	procfs_xfer_memory): Protoize.
+	* ptx4-nat.c (proc_iterate_over_mappings): Protoize.
+
+2000-09-28  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
+
+	* sol-thread.c (ps_pdmodel):  Return PR_MODEL_UNKNOWN instead of
+	PS_ERR if exec_bfd is not yet open.
+
+2000-09-28  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
+
+	* target.c (target_signal_from_host, do_target_signal_to_host):
+	Add support for Solaris realtime signals.
+
+2000-09-27  Kevin Buettner  <kevinb@redhat.com>
+
+	* os9kread.c (os9k_symfile_read, os9k_end_psymtab): Protoize.
+	* osfsolib.c (find_solib): Protoize.
+
+2000-09-25  Kevin Buettner  <kevinb@redhat.com>
+
+	* ns32knbsd-nat.c (fetch_core_registers): Protoize.
+	* ocd.c (ocd_xfer_memory): Protoize.
+
+2000-09-25  Andrew Cagney  <ac131313@cygnus.com>
+
+	* MAINTAINERS: Add Mark Kettenis to ``Blanket Write Privs'' list.
+
+2000-09-24  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
+
+	* rs6000-tdep.c (rs6000_pop_frame):  Use PC_IN_CALL_DUMMY to test
+	for call dummy instead of accessing stop_stack_dummy, which does
+	not work if we `return' from a stop in a call dummy.
+	(rs6000_gdbarch_init):  Use generic_save_dummy_frame_tos for
+	dummy_frame_tos function to make PC_IN_CALL_DUMMY work.
+
+2000-09-23  Kevin Buettner  <kevinb@redhat.com>
+
+	* mdebugread.c (mdebug_next_symbol_text): Protoize.
+	* monitor.c (monitor_xfer_memory): Protoize.
+
+2000-09-22  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
+
+	* i386-linux-nat.c (OLD_CANNOT_FETCH_REGISTER,
+	OLD_CANNOT_FETCH_REGISTER):  New definitions for accessible registers
+	when accessing the registers via the U area.
+	(fetch_register, store_register):  Use them.
+	(cannot_fetch_register, cannot_store_register):  New functions,
+	all registers should be accessible if we have GETREGS support.
+	* config/i386/nm-linux.h:  Use cannot_fetch/store_register for
+	CANNOT_FETCH/STORE_REGISTER definitions.
+
+2000-09-06  Fred Fish  <fnf@cygnus.com>
+
+	* infttrace.c (update_thread_state_after_attach): Pass address
+	of ttstate_t object, not the object itself.
+
+2000-09-18  Mark Kettenis  <kettenis@gnu.org>
+
+	* lin-lwp.c (stop_wait_callback): Remove bogus assertions in the
+	code that deals with exiting/signalled threads.  Replace with
+	code similar to what's done in lin_lwp_wait.
+
+2000-09-17  Kevin Buettner  <kevinb@redhat.com>
+
+	* ppc-linux-nat.c (fill_gregset, fill_fpregset): New functions.
+	* config/powerpc/linux.mh (NATDEPFILES): Remove linux-thread.o.
+	Add proc-service.o, thread-db.o, and lin-lwp.o.
+	(LOADLIBES): Define.
+	* config/powerpc/nm-linux.h (ATTACH_DETACH, SVR4_SHARED_LIBS):
+	Remove defines which are already present in ../nm-linux.h.
+	(solib.h): Don't include this file; it's already included by
+	../nm-linux.h.
+	(PREPARE_TO_PROCEED, GET_THREAD_SIGNALS, ATTACH_LWP): Define
+	to use the following lin-lwp.c functions...
+	(lin_lwp_prepare_to_proceed, lin_thread_get_thread_signals,
+	lin_lwp_attach_lwp): Declare.
+
+2000-09-17  Kevin Buettner  <kevinb@redhat.com>
+
+	* m88k-nat.c (fetch_inferior_registers): Protoize.
+	* m88k-tdep.c (m88k_skip_prologue): Protoize.
+
+2000-09-15  Fernando Nasser  <fnasser@totem.to.cygnus.com>
+
+	* varobj.c (varobj_set_value): Call wrapped version of
+	parse_exp_1() to avoid longjumps.
+
+2000-09-15  Fernando Nasser  <fnasser@totem.to.cygnus.com>
+
+	* remote.c (putpkt_binary): Call read_frame, not getpkt. Log message.
+	(read_frame): Do not call error() on communication error when
+	reading checksum, but return failure instead and log message.
+
+2000-09-15  Fernando Nasser  <fnasser@cygnus.com>
+
+	* ser-unix.c (do_unix_readchar): Prevent infinite read wait to be
+	interrupted after 32K seconds.
+
+2000-09-15  Kevin Buettner  <kevinb@redhat.com>
+
+	* language.c (show_case_command, set_case_command): Protoize.
+	* m3-nat.c (m3_xfer_memory, fetch_thread_info): Protoize.
+
+2000-09-12  Kevin Buettner  <kevinb@redhat.com>
+
+	* lin-thread.c (threadlist_iter, get_lwp_from_thread_id,
+	thread_db_xfer_memory): Protoize.
+	* linux-thread.c (iterate_active_threads): Protoize.
+
+2000-09-12  Kevin Buettner  <kevinb@redhat.com>
+
+	* objfiles.c (objfile_relocate): Don't assume that offsets
+	associated with one of SECT_OFF_TEXT, SECT_OFF_DATA, or
+	SECT_OFF_BSS will be adequate for relocating all of the
+	sections in an objfile.
+
+2000-09-12  Fernando Nasser  <fnasser@cygnus.com>
+
+	* remote-rdi.c (arm_rdi_open): Fix typo in error message.
+
+Wed Sep 13 03:08:32 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* remote-mips.c (mips_expect, mips_getstring, mips_send_packet,
+ 	mips_send_packet, pmon_insert_breakpoint, send_srec,
+ 	pmon_check_ack, pmon_check_entry_address,
+ 	_initialize_remote_mips): Replace the magic two seconds with
+ 	``remote_timeout''.
+	(pmon_check_entry_address, pmon_check_total): New functions.  Use
+ 	``remote_timeout'' instead of magic two seconds.
+	(pmon_end_download): Rewrite.  Use pmon_check_entry_address and
+ 	pmon_check_total.
+
+2000-09-12  Alexandre Oliva  <aoliva@redhat.com>
+
+	* MAINTAINERS: Added myself.
+
+2000-09-11  Alexandre Oliva  <aoliva@redhat.com>
+
+	* acinclude.m4 (CY_GNU_GETTEXT): Add dummy definition, so that the
+	one brought in by ../bfd/acinclude.m4 prevails.
+	* aclocal.m4, configure: Rebuilt.
+
+2000-09-11  Kevin Buettner  <kevinb@redhat.com>
+
+	* configure.in (HAVE_STRUCT_LINK_MAP32): Change test to use
+	AC_TRY_COMPILE instead of AC_TRY_RUN.
+	* configure: Regenerate.
+
+2000-09-11  Kevin Buettner  <kevinb@redhat.com>
+
+	* irix4-nat.c (fetch_core_registers): Protoize.
+	* irix5-nat.c (fetch_core_registers, find_solib): Protoize.
+
+2000-09-06  Mark Kettenis  <kettenis@gnu.org>
+
+	* lin-lwp.c (normal_mask, blocked_mask): New variables.
+	(lin_lwp_wait): Block SIGCHLD here if it isn't already blocked.
+	(lin_lwp_mourn_inferior): Restore the origional signal mask, and
+	reset the mask of blocked signals.
+	(_initialize_lin_lwp): Don't block SIGCHLD here, but do initialize
+	suspend_mask and blocked_mask.  This makes us pass
+	gdb.base/sigall.exp for Linux/x86 now.
+	(lin_thread_get_thread_signals): Treat the LinuxThreads "cancel"
+	signal similarly to SIGCHLD in the generic code.  Avoids GDB being
+	terminated by a Real-time signal.
+
+2000-09-08  Kevin Buettner  <kevinb@redhat.com>
+
+	* infptrace.c, infttrace.c (child_xfer_memory): Protoize.
+
+2000-09-07  J.T. Conklin  <jtc@redback.com>
+
+	* config/i386/nbsd.mt (TDEPFILES): Add i386nbsd-tdep.o.
+	* i386nbsd-nat.c (i386nbsd_use_struct_convention): Moved from here.
+	* i386nbsd-tdep.c (i386nbsd_use_struct_convention): To here.
+	* i386nbsd-tdep.c: New file.
+
+2000-09-07  Kevin Buettner  <kevinb@redhat.com>
+
+	* i386mach-nat.c (fetch_inferior_registers, fetch_core_registers):
+	Protoize.
+	* i960-tdep.c (i960_skip_prologue, leafproc_return, mem): Protoize.
+
+Thu Sep  7 21:59:23 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* aclocal.m4: Regenerate.
+	* config.in, configure: Regenerate.
+
+Wed Sep  6 23:15:43 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* remote-rdi.c (voiddummy): Update function signature to match
+ 	struct Dbg_HostosInterface's reset method.
+	* remote-rdp.c (rdp_step): Fix handle parameter to
+ 	remote_rdp_insert_breakpoint and remote_rdp_remove_breakpoint.
+
+	* arm-tdep.c (SIGCONTEXT_REGISTER_ADDRESS_P): Provide default
+ 	definition.
+	(arm_init_extra_frame_info): Use.
+
+2000-09-06  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* m68hc11-tdep.c (m68hc11_store_return_value): Store the value
+	in D and X if it's larger than 16-bits.
+	(m68hc11_extract_return_value): Fix extractions for 1 and 3 bytes
+	return.
+	(m68hc11_push_return_address): Use CALL_DUMMY_ADDRESS for the
+	return address.
+	(m68hc11_use_struct_convention): Check for struct and union.
+	(m68hc11_return_value_on_stack): Use the struct convention.
+	(m68hc11_call_dummy_address): Use the entry point address.
+	(m68hc11_push_arguments): Fix alignment and padding.
+	(m68hc11_stack_align): New function.
+	(m68hc11_gdbarch_init): Register it.
+
+2000-09-06  Scott Bambrough <scottb@netwinder.org>
+
+	* arm-linux-tdep.c (arm_linux_skip_solib_resolver):
+	Removed debug print statement.  Removed arm_pc_is_thumb prototype.
+	* config/arm/tm-arm.h (arm_pc_is_thumb, arm_pc_is_thumb_dummy):
+	Move prototypes here from tm-embed.h.
+	* config/arm/tm-embed.h (arm_pc_is_thumb, arm_pc_is_thumb_dummy):
+	Remove prototypes.  Moved to tm-arm.h.
+
+2000-09-06  H.J. Lu  <hjl@gnu.org>
+
+	* TODO: Add hardware watchpoint problems on x86 OSes for 5.1.
+
+2000-09-06  Kevin Buettner  <kevinb@redhat.com>
+
+	* ia64-tdep.c (examine_prologue): Add rotating register rename
+	support for the general registers.
+	(ia64_get_saved_register): Add rotating register rename support
+	for the predicate registers and the floating-point registers.
+
+2000-09-05  Kevin Buettner  <kevinb@redhat.com>
+
+	* config/arm/tm-linux.h (arm_linux_sigcontext_register_address,
+	arm_linux_in_sigtramp): Declare.
+	(IN_SIGTRAMP, SIGCONTEXT_REGISTER_ADDRESS): Define.
+	* arm-tdep.c (SIGCONTEXT_REGISTER_ADDRESS): Define to be 0
+	if not already defined by tm.h.
+	(arm_scan_prologue): Don't assume that the prologue instructions
+	will be in a contiguous clump.
+	(arm_init_extra_frame_info): Add support for sigtramp frames.
+	(arm_pc_is_thumb, arm_pc_is_thumb_dummy): Change type of
+	`memaddr' from bfd_vma to CORE_ADDR.
+	* arm-linux-tdep.c (gdbcore.h, frame.h): Include.
+	(arm_pc_is_thumb): Declare.
+	(arm_linux_skip_solib_resolver): Fix printf() statement.  [Which
+	shouldn't be there anyway.]
+	(ARM_LINUX_SIGRETURN_INSTR, ARM_LINUX_RT_SIGRETURN_INSTR): New
+	defines.
+	(arm_linux_in_sigtramp, arm_linux_sigcontext_register_address):
+	New functions.
+
+2000-09-05  Kevin Buettner  <kevinb@redhat.com>
+
+	* i386aix-nat.c (fetch_core_registers): Protoize.
+	* hpux-thread.c (hpux_thread_xfer_memory): Protoize.
+
+2000-09-06  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* m68hc11-tdep.c (m68hc11_frame_chain): Check for pc in call dummy.
+	(m68hc11_guess_from_prologue): 'des' instruction to allocate 1 byte
+	on the stack can appear in the prologue.
+	
+2000-09-05  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* sol-thread.c (ps_pdmodel): Protect with an ifdef.
+
+Mon Sep  4 16:21:31 2000  Andrew Cagney  <cagney@amy.cygnus.com>
+
+	* gdbarch.sh: Use printf instead of echo.
+ 	(do_read): During read, pad ``::'' with spaces and then strip out
+ 	those spaces.  Avoid problems with IFS=:.
+
+2000-09-04  Mark Kettenis  <kettenis@gnu.org>
+
+	* config/i386/nm-linux.h: Include <signal.h>.
+
+2000-09-04 Pierre Muller <muller@ics.u-strasbg.fr>
+
+	* c-typeprint.c (c_typedef_print): remove (replaced by 
+	typedef_print in typeprint.c).
+	* typeprint.c (typedef_print): new function. (old c_typedef_print
+	function with pascal language support added).
+	* value.h (c_printdef_print): removed.
+	(typedef_print): declare.
+	* symtab.c (print_symbol_info): call to c_typedef_print replaced
+	by call to typedef_print.
+
+2000-09-03  Mark Kettenis  <kettenis@gnu.org>
+
+	* config/i386/nm-linux.h (PREPARE_TO_PROCEED, ATTCH_LWP,
+	GET_THREAD_SIGNALS): New defines.
+	* config/i386/linux.mh (NATDEPFILES): Remove lin-thread.o and
+	linux-threads.o.  Add proc-service.o, thread-db.o and lin-lwp.o.
+	* proc-service.c: New file.
+	* thread-db.c: New file.
+	* lin-lwp.c: New file.
+
+	* gdb_assert.h: New file.
+
+	* gdb_thread_db.h [HAVE_THREAD_DB_H]: Include <thread_db.h>.
+	[!HAVE_THREAD_DB_H]: Update from current glibc thread_db.h.  Deal
+	with absence of <stdint.h> here.
+
+	* gdb_proc_service.h: Add copyright notice.
+	Protect against multiple inclusion.
+	Add fix for broken prfpregset_t here.
+	(struct ps_prochandle): Declare here.
+	[HAVE_PROC_SERVICE_H]: Include <proc_service.h>.
+	[!HAVE_PROC_SERVICE_H]: Include "gregset.h", define prgregset_t
+	and prfpregset_t in terms of gdb_gregset_t and gdb_fpregset_t if
+	necessary.
+	* lin-thread.c: Unconditionally include "gdb_proc_service.h".
+	Remove fix for broken prfpregset_t here.
+	(struct ps_prochandle): Don't declare here.
+
+	* MAINTAINERS: Add myself as threads co-maintainer.
+
+2000-09-01  David Anderson  <davea@sgi.com>
+
+	* arch-utils.c arch-utils.h blockframe.c fork-child.c:
+	Corrected comment spelling dependant->dependent.
+	* corelow.c (default_core_sniffer): Corrected comment 
+	spelling.
+	* cp-valprint.c (cp_print_value_fields): Corrected 
+	comment spelling.
+	* d10v-tdep.c dbxread.c: Corrected comment spelling 
+	dependan->dependen.
+	* defs.h: Corrected spelling, meant 64, not 32, in comment.
+	* dst.h eval.c event-loop.c: Corrected comment spelling.
+	* event-top.c gdb-events.sh: Corrected comment spelling.
+	* gdbarch.c: Corrected comment spelling.
+	* gdbarch.h gdbarch.sh: Corrected comment spelling,
+	dependant->dependent.
+	* gdbtypes.c gdbtypes.h: Corrected comment spelling.
+	* infcmd.c infrun.c: Corrected comment spelling.
+	* symfile.c symfile.h target.h: Corrected comment spelling,
+	dependant->dependent.
+	* tracepoint.h: Corrected comment spelling.
+
+2000-09-01  Kevin Buettner  <kevinb@redhat.com>
+
+	* hppa-tdep.c (record_text_segment_lowaddr): Protoize.
+	* hppah-nat.c (child_xfer_memory): Protoize.
+
+2000-09-01  Kevin Buettner  <kevinb@redhat.com>
+
+	* symtab.c (decode_line_1):  Make sure leading character is
+	actually a colon before skipping over leading colons in global
+	namespace specification.
+
+2000-09-01  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* regcache.c (reg_flush_command): New function.  Maintainer-mode
+	command, flushes GDB's register cache, for testing purposes.
+
+2000-08-31  J.T. Conklin  <jtc@redback.com>
+
+	* dcache.c (dcache_info): Output a cache line's state vector so it
+ 	lines up under the data vector.
+
+	* dcache.c (dcache_read_line): New function.
+	(dcache_peek_byte): Use it.
+	(dcache_alloc): Return NULL if write of reclaimed cache line fails.
+	(dcache_peek_byte, dcache_poke_byte): Return failure if
+ 	dcache_alloc() returns a NULL data block pointer.  
+	(dcache_xfer_memory): Don't force writeback unless we were writing.
+
+	* monitor.c (monitor_expect): Change places where immediate_quit
+ 	is set to 1 or 0 to increments and decrements respectively.  This
+	allows such changes to nest properly.
+	* ocd.c (ocd_start_remote): Likewise.
+	* remote-adapt.c (expect): Likewise.
+	* remote-array.c (expect): Likewise.
+	* remote-eb.c (expect): Likewise.
+	* remote-e7000.c (e7000_start_remote): Likewise.
+	* remote-mips.c (mips_expect_timeout, mips_getstring): Likewise.
+	* remote-nrom.c (expect): Likewise.
+	* remote-os9k.c (expect): Likewise.
+	* remote-sds.c (sds_start_remote): Likewise.
+	* remote-st.c (expect): Likewise.
+	* remote-utils.c (sr_expect): Likewise.
+	* remote.c (remote_start_remote): Likewise.
+	* tracepoint.c (read_actions): Likewise.
+
+	* remote-mips.c (mips_getstring): Balance changes to immediate_quit.
+
+2000-08-31  David Anderson  <davea@sgi.com>
+
+	* MAINTAINERS: Add myself to write-after-approval list.
+
+2000-08-30  Kevin Buettner  <kevinb@redhat.com>
+
+	* gnu-nat.c (gnu_xfer_memory): Protoize.
+	* hp-psymtab-read.c (scan_procs, hp_quick_traverse): Protoize.
+
+2000-08-30  Kevin Buettner  <kevinb@redhat.com>
+
+	* solib.c (solib_extract_address, LM_ADDR, LM_NEXT, LM_NAME,
+	LM_ADDR, IGNORE_FIRST_LINK_MAP_ENTRY, first_link_map_member,
+	open_symbol_file_object, current_sos): Rename
+	bfd_elf_get_arch_size to bfd_get_arch_size().
+	* sol-thread.c (rw_common, ps_pdmodel): Likewise.
+
+2000-08-30  David Edelsohn  <dje@watson.ibm.com>
+
+	Patch applied by Kevin Buettner <kevinb@redhat.com>:
+
+	* rs6000-nat.c (xcoff_relocate_symtab): Pass correct size
+	to xrealloc().
+
+2000-08-29  Michael Snyder  <msnyder@seadog.cygnus.com>
+
+	* valops.c (value_cast): Indentation fix-up.
+	* acconfig.h (HAVE_PRGREGSET32_T, HAVE_PRFPREGSET32_T, 
+	HAVE_STRUCT_LINK_MAP32): New configure macros.
+	* config.in: Ditto.
+	* configure.in: Test for the above new macros.
+	* breakpoint.c: Update copyright date.
+	* core-sol2.c: Include v9/sys/privregs.h directly to 
+	work around a bug in Sun's Solaris 8 header files.
+	(fetch_core_registers): Use the above new configure macros to
+	handle cross-debugging of 32-bit core files on a 64-bit host.
+	* sol-thread.c (ps_pdmodel) New function.
+	(rw_common): For debugging of 32-bit apps on a 64-bit host, 
+	truncate addresses to 32 bits.
+	* solib.c (solib_extract_address): Functionize.  Make 32/64 aware.
+	(LM_ADDR, LM_NEXT, LM_NAME): Ditto.
+	(IGNORE_FIRST_LINK_MAP): Ditto.
+	(first_link_map_member): Make 32/64 aware.
+	(open_symbol_file_object): Ditto.
+	(current_sos): Ditto.
+
+2000-08-29  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* i386-linux-nat.c (i386_linux_skip_solib_resolver, 
+	skip_hurd_resolver, find_minsym_and_objfile): Move these
+	solib functions into i386-linux-tdep.c for cross debugging.
+	* i386-linux-tdep.c: Receive the above functions.
+
+2000-08-29  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* m68hc11-tdep.c (stack_correction): New variable for stack offset
+	correction (1 for 68hc11, 0 for 68hc12).
+	(m68hc11_saved_pc_after_call): Use it.
+	(m68hc11_frame_chain): Likewise.
+	(m68hc11_frame_init_saved_regs): Likewise.
+	(m68hc11_init_extra_frame_info): Likewise.
+	(m68hc11_push_return_address): Likewise.
+	(m68hc11_push_arguments): Struct address must be corrected by
+	applying the stack_correction offset.
+	(m68hc11_store_struct_return): Likewise.
+
+2000-08-28  Kevin Buettner  <kevinb@redhat.com>
+
+	* gdbserver/utils.c (error, fatal): Protoize.
+
+2000-08-27  Mark Kettenis  <kettenis@gnu.org>
+
+	* i386-linux-nat.c (fetch_inferior_registers): Move call to
+	dummy_sse_values ...
+	(supply_fpregset): ... here.
+
+2000-08-27  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* pa64solib.c (pa64_solib_load_symbols): Don't use ANOFFSET as an
+ 	lvalue.
+	* xcoffread.c (xcoff_symfile_offsets): Ditto
+	* somsolib.c (som_solib_section_offsets): Ditto.
+	* somread.c (som_symfile_offsets): Ditto.
+	* rs6000-nat.c (vmap_symtab): Ditto.
+	* remote-vx.c (vx_add_symbols): Ditto.
+	* remote-os9k.c (rombug_wait): Ditto.
+
+2000-08-27  Mark Kettenis  <kettenis@gnu.org>
+
+	* gregset.h: Protect against multiple inclusion.  Remove some
+	redundant spaces.
+
+Sun Aug 27 00:00:04 2000  Christopher Faylor <cgf@cygnus.com>
+
+	* win32-nat.c (dll_symbol_command): Tack a .dll on the end of a
+	supplied argument if it is missing an extension.
+
+2000-08-24  Egor Duda <deo@logos-m.ru>
+
+	* corelow.c: Define O_BINARY if it isn't defined.
+	(core_open): Open core file in binary mode.
+	* config/i386/tm-cygwin.h (child_clear_solibs): Rename from
+	child_clear_solib.
+	* config/i386/cygwin.mh: Add dependency from corelow.o.
+	* win32-nat.c (register_loaded_dll): New function.  Add dll to the list
+	of currently loaded dlls.
+	(handle_load_dll): Use register_loaded_dll.
+	(child_solib_add): Distinguish between active process and core targets.
+	(solib_symbols_add): Load symbols from loaded dll.
+	(core_dll_symbols_add): New function.  Load symbols from dll referenced
+	in core.
+	(core_section_load_dll_symbols): New function.
+	(dll_code_sections_add): New function.
+	(map_single_dll_code_section): New function.
+	(fetch_elf_core_registers): New function.
+	(_initialize_core_win32): New function.
+
+2000-08-26  Kevin Buettner  <kevinb@redhat.com>
+
+	* gdbserver/gdbreplay.c (main): Protoize.
+	* gdbserver/server.c (start_inferior, main): Protoize.
+
+2000-08-26  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* m68hc11-tdep.c (m68hc11_register_names): Update name of registers.
+	(m68hc11_get_register_info): New function.
+	(m68hc11_initialize_register_info): New function to get addresses
+	of soft registers.
+	(m68hc11_which_soft_register): New function.
+	(m68hc11_fetch_pseudo_register, m68hc11_store_pseudo_register):
+	New functions to translate read/write of soft registers into a
+	memory read/write.
+	(m68hc11_guess_from_prologue): Initialize soft register addresses.
+	Use the soft register addresses to guess the prologue.
+	(m68hc11_gdbarch_init): Install the pseudo registers.
+
+	* m68hc11-tdep.c (m68hc11_register_name, m68hc11_breakpoint_from_pc,
+	m68hc11_saved_pc_after_call, m68hc11_frame_saved_pc,
+	m68hc11_frame_args_address, m68hc11_frame_locals_address,
+	m68hc11_guess_from_prologue, m68hc11_push_arguments,
+	m68hc11_call_dummy_address, m68hc11_call_dymmy_address,
+	m68hc11_register_virtual_type, m68hc11_store_struct_return,
+	m68hc11_store_return_value, m68hc11_extract_return_value,
+	m68hc11_use_struct_convention, m68hc11_return_value_on_stack,
+	m68hc11_extract_struct_value_address, m68hc11_push_return_address,
+	m68hc11_register_byte, m68hc11_register_raw_size,
+	m68hc11_gdbarch_init): New functions for multi-arch support.
+	(m68hc11_not_yet): Remove.
+
+Fri Aug 25 16:57:05 2000  David Taylor  <taylor@texas.cygnus.com>
+
+	* regcache.c (register_changed): New function.
+	* value.h: Declare it.
+	
+Fri Aug 25 12:11:21 2000  David Taylor  <taylor@texas.cygnus.com>
+
+	* symtab.c (search_symbols): Fix off by one error in index for
+ 	initializing variables ourtype, ourtype2, ourtype3, and ourtype4.
+	(symtab_symbol_info): fix similar off by one error.
+	
+Fri Aug 25 12:03:15 2000  David Taylor  <taylor@texas.cygnus.com>
+
+	* gdbarch.sh (TARGET_ADDR_BIT): New macro for the number
+	of bits in gdb's representation of a target address.
+	* gdbarch.c, gdbarch.h: Regenerated.
+	* gdbtypes.c (build_gdbtypes): Use TARGET_ADDR_BIT instead of
+ 	TARGET_PTR_BIT when initializing builtin_type_CORE_ADDR.
+	* printcmd.c (print_address_numeric): Use TARGET_ADDR_BIT instead
+ 	of TARGET_PTR_BIT, because we're printing an address, not a pointer.
+
+2000-08-25  Pierre Muller  <muller@ics.u-strasbg.fr>
+
+       * Makefile.in: add rules to compile and link pascal specific files.
+       * config/djgpp/fnchange.lst: add substitution for p-exp.tab.c.
+
+2000-08-20  Michael Chastain  <chastain@redhat.com>
+
+        * remote.c (read_frame): Handle SERIAL_TIMEOUT while reading
+ 	checksum.
+
+2000-08-23  Kevin Buettner  <kevinb@redhat.com>
+
+	* dstread.c (dst_symfile_offsets): Protoize.
+	* fork-child.c (fork_inferior): Protoize.
+
+2000-08-21  Kevin Buettner  <kevinb@redhat.com>
+
+	* dbxread (dbx_symfile_read, process_later): Protoize.
+	* dsrec.c (load_srec): Protoize.
+
+2000-08-18  Andrew Cagney  <cagney@ops1.cygnus.com>
+
+	* mips-tdep.c (mips_gdbarch_init): Check arches->gdbarch and not
+	current_gdbarch for a match.
+
+2000-08-18  J.T. Conklin  <jtc@redback.com>
+
+	* MAINTAINERS: Add myself as dcache.c maintainer.
+
+	* remote-nindy.c (nindy_load): Invalidate dcache.
+
+	* dcache.c (dcache_invd): Renamed from dcache_flush.  The term
+ 	flush with respect to caches usually implies that data will be 
+	written to memory.
+	(dcache_init, dcache_xfer_memory): Updated.
+	* monitor.c (flush_monitor_dcache, monitor_resume, monitor_load): 
+	Updated.
+	* ocd.c (ocd_open, ocd_resume, bdm_reset_command): Updated.
+	* remote-bug.c (bug_load, bug_resume): Updated.
+	* remote-nindy.c (nindy_open, nindy_resume): Updated.
+	* remote-sds.c (sds_open, sds_resume): Updated.
+	* remote-utils.c (gr_open): Updated.
+	* remote.c (remote_open_1, remote_resume, remote_async_resume,
+	remote_cisco_open): Updated.
+	* wince.c (child_create_inferior, child_resume): Updated.
+
+	* monitor.c (monitor_open): Free dcache before creating a new one.
+	* dcache.c (dcache_free): New function.
+	* dcache.h (dcache_free): New prototype.
+
+2000-08-18  Andrew Cagney  <cagney@ops1.cygnus.com>
+
+	* remote-array.c (array_fetch_register): Pass dummy parameter to
+	array_fetch_registers.
+	(array_store_register): Ditto.
+
+2000-08-16  Eli Zaretskii <eliz@is.elta.co.il>
+
+	* value.h (struct value) <lazy>: Add a comment about its use for
+        watchpoints.
+
+2000-08-12  Kevin Buettner  <kevinb@redhat.com>
+
+	* cxux-nat.c (fetch_inferior_registers): Protoize.
+	* d10v-tdep.c (d10v_frame_chain_valid, d10v_extract_return_value):
+	Protoize.
+	* d30v-tdep.c (d30v_frame_chain_valid, d30v_extract_return_value):
+	Protoize.
+
+Fri Aug 11 19:00:51 2000  Andrew Cagney  <cagney@makita.cygnus.com>
+
+	* config/mn10300/tm-mn10300.h (REGISTER_SIZE,
+ 	MAX_REGISTER_RAW_SIZE, REGISTER_VIRTUAL_TYPE, REGISTER_BYTE,
+ 	REGISTER_VIRTUAL_SIZE, REGISTER_RAW_SIZE): Disable.
+	* mn10300-tdep.c (mn10300_do_registers_info,
+ 	mn10300_print_register): New functions.  Pretty print registers.
+	(mn10300_register_virtual_type, mn10300_register_byte,
+	mn10300_register_virtual_size, mn10300_register_raw_size): New
+ 	functions.
+ 	(mn10300_gdbarch_init): Update.
+
+	* mn10300-tdep.c (mn10300_gdbarch_init): Check for mn10300 variant
+	and not mips variant in the info struct.
+
+2000-08-11  Mark Kettenis  <kettenis@gnu.org>
+
+	* i386-linux-nat.c [! HAVE_PTRACE_GETFPXREGS] (fetch_fpxregs,
+	store_fpxregs): Return 0.
+
+2000-08-11  Andrew Cagney  <cagney@lulu.cygnus.com>
+
+	* regcache.c (GET_SAVED_REGISTER): Restore definition.  Was lost
+	as part of 2000-08-10 Andrew Cagney <cagney@ops1.cygnus.com>.
+
+2000-08-11  J.T. Conklin  <jtc@redback.com>
+
+	* dcache.c (dcache_info): Don't print cache state if last_cache 
+	is NULL.
+
+2000-08-10  Andrew Cagney  <cagney@ops1.cygnus.com>
+
+	* config/mn10300/tm-mn10300.h, mn10300-tdep.c
+ 	(mn10300_push_arguments): Fix function signature to match gdbarch
+ 	vector.
+	* config/mn10300/tm-mn10300.h (REGISTER_NAME): Delete.
+	* mn10300-tdep.c (struct gdbarch_tdep): Define.
+	(mn10300_generic_register_names, am33_register_names): Convert to
+	functions.
+	(set_machine_hook): Delete.
+	(register_name): New function.
+	(mn10300_register_name): Delete.
+	(mn10300_dump_tdep, mn10300_gdbarch_init): New functions.
+	(_initialize_mn10300_tdep): Call register_gdbarch_init instead of
+	specify_exec_file_hook.
+	(AM33_MODE): Define.
+	(set_movm_offsets): Update.
+	
+2000-08-10  Mark Kettenis  <kettenis@gnu.org>
+
+	Adapt support for SSE registers in Linux/x86 for Linux 2.4.
+	* i386-linux-nat.c: Various doc fixes.  Include "i387-nat.h".
+	(GETFPXREGS_SUPPLIES): Renamed from GETXFPREGS_SUPPLIES.
+	(have_ptrace_getfpxregs): Renamed from have_ptrace_getxfpregs.
+	(convert_to_gregset): Removed.  Moved logic to ...
+	(fill_gregset): ... here.  Simplified function.
+	(fetch_regs): Use perror_with_name for error reporting.
+	(store_regs): Add `regno' parameter.  Use perror_with_name for
+	error reporting.  Call fill_gregset instead of convert_to_gregset.
+	(FPREG_ADDR): Remove.
+	(supply_fpregset): Implement by calling i387_supply_fsave.
+	(convert_to_fpregset): Remove.
+	(fill_fpregset): Implement by calling i387_fill_fsave.
+	(fetch_fpregs): Use perror_with_name fro error reporting.
+	(store_fpregs) Add `regno' parameter.  Use perror_with_name fro
+	error reporting.  Call fill_fpregset instead of
+	convert_to_fpregset.
+	(supply_xfpregset, convert_to_xfpregset): Removed.
+	(supply_fpxregset, fill_fpxregset): New functions.
+	(fetch_fpxregs): Renamed from fetch_xfpregs.  Use perror_with_name
+	for error reporting.  Call supply_fpxregset instead of
+	supply_xfpregset.
+	(store_xfpregs): Removed.
+	(store_fpxregs): New function.
+	(fetch_inferior_registers): Adjust for xfp -> fpx change.  Tweak
+	message in call to internal_error.
+	(store_inferior_registers): Adjust for xfp ->fpx change.  Pass
+	REGNO to store_regs, store_fpregs and store_fpxregs.
+	(fetch_core_registers): Adjust for xfp -> fpx change.
+	* acconfig.h (HAVE_PTRACE_GETFPXREGS): Renamed from
+	HAVE_PTRACE_GETXFPREGS.
+	* config.in: Regenerated.
+	* configure.in: Replace check for PTRACE_GETXFPREGS with check for
+	PTRACE_GETFPXREGS.  Remove comment about Cygnus SSE extensions.
+	* configure: Regenerated.
+	* config/i386/linux.mh (NATDEPFILES): Add i387-nat.o.
+	* config/i386/tm-linux.h: Base definition of HAVE_SSE_REGS on
+	HAVE_PTRACE_GETFPXREGS instead of HAVE_PTRACE_GETXFPREGS.
+
+2000-08-10  Andrew Cagney  <cagney@ops1.cygnus.com>
+
+	* regcache.c (TARGET_WRITE_PC, TARGET_READ_PC, TARGET_READ_FP,
+	TARGET_WRITE_FP, TARGET_READ_SP, TARGET_WRITE_SP): Move
+	initialization from here.
+	* gdbarch.sh: To here.
+	* gdbarch.h, gdbarch.c: Regenerate.
+
+Thu Aug 10 18:58:04 2000  Andrew Cagney  <cagney@makita.cygnus.com>
+
+	* defs.h (TARGET_BFD_VMA_BIT, TARGET_SHORT_BIT, TARGET_INT_BIT,
+ 	TARGET_LONG_BIT, TARGET_LONG_LONG_BIT, TARGET_FLOAT_BIT,
+ 	TARGET_DOUBLE_BIT, TARGET_LONG_DOUBLE_BIT, TARGET_PTR_BIT): Move
+ 	non- multi-arch handling from here.
+	* gdbarch.sh: To here. Update printf gdbarch_update_p.  Make more
+ 	portable.
+	* gdbarch.h, gdbarch.c: Regenerate.
+	
+2000-08-10  Andrew Cagney  <cagney@ops1.cygnus.com>
+
+	* partial-stab.h (DBX_READ): Eliminate redundant check for null
+	``pst''.  Also fixes GCC warning.
+
+2000-08-10  Andrew Cagney  <cagney@ops1.cygnus.com>
+
+	* rs6000-nat.c (set_host_arch): Check value returned by
+	gdbarch_update_p.
+	* gdbarch.sh (gdbarch_update_p): Rename gdbarch_update.
+	* gdbarch.h, gdbarch.c: Regenerate
+	* arch-utils.c (set_gdbarch_from_file,
+ 	initialize_current_architecture, set_endian): Update.
+
+2000-08-10  Jimmy Guo  <guo@cup.hp.com>
+
+	* c-lang.c: Set case sensitivity on for c_language_defn,
+	cplus_language_defn, and asm_language_defn.
+	* ch-lang.c: Set case sensitivity on for chill_language_defn.
+	* f-lang.c: Set case sensivitity off for f_language_defn.
+	* jv-lang.c: Set case sensitivity on for java_language_defn.
+	* language.h: Add enum case_mode, case_sensitivity.
+	* language.c: Define case_mode, case_sensitivity.  Set case
+	sensitivity on for unknown_language_defn, auto_language_defn,
+	and local_language_defn.
+	(show_case_command,set_case_command,set_case_str): New static func.
+	(set_type_range_case): New static func, replaces set_type_range ().
+	(set_language_command,set_type_command,set_range_command,set_language):
+	Call set_type_range_case ().
+	(language_info): Print case sensitivity setting.
+	(_initialize_language): Add set/show commands for 'case-sensitive'.
+	Set default case mode 'auto'.  Set default language 'auto'.
+	* m2-lang.c: Set case sensitivity on for m2_language_defn.
+	* p-lang.c: Set case sensitivity on for pascal_language_defn.
+	* scm-lang.c: Set case sensitivity off for scm_language_defn.
+	* symtab.c (lookup_symbol): Downcase symbol name if case sensivitity
+	is off.
+
+2000-08-10  Jimmy Guo  <guo@cup.hp.com>
+
+	* MAINTAINERS: Change my contact email for hp tests maintainership.
+
+Thu Aug 10 15:28:17 2000  Andrew Cagney  <cagney@ryobi.cygnus.com>
+
+	* sparc-tdep.c (sparc_init_extra_frame_info): Fix number of
+ 	arguments to fetch_instruction.
+
+2000-08-10  Kazu Hirata  <kazu@hxi.com>
+
+	* hppa_tdep.c: Fix a comment typo.
+	* gdba.el: Likewise.
+
+2000-08-10  Tom Tromey  <tromey@cygnus.com>
+
+	* MAINTAINERS: Added myself with write-after-approval access.
+
+2000-08-10  J.T. Conklin  <jtc@redback.com>
+
+	* monitor.c (monitor_open): If a dcache has already been created,
+	invalidate it rather than creating another.
+	* ocd.c (ocd_open): Likewise.
+	* remote-nindy.c (nindy_open): Likewise.
+	* remote-sds.c (sds_open): Likewise.
+	* remote-utils.c (gr_open): Likewise.
+	* remote.c (remote_open_1, remote_cisco_open): Likewise.
+
+	* dcache.c (dcache_alloc): Changed to take address of line as an
+ 	argument, and to invalidate cache line before returning.
+	(dcache_peek_byte): Updated.
+	(dcache_poke_byte): Updated.
+
+2000-08-10  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	From Greg McGary <greg@mcgary.org>:
+	* partial-stab.h: Don't crash if pst is null. 
+
+2000-08-10  Mark Kettenis  <kettenis@gnu.org>
+
+	* i387-nat.h (i387_supply_fsave, i387_fill_fsave): Make extern.
+	(i387_supply_fxsave, i387_fill_fxsave): New prototypes.
+	* i387-nat.c (i387_supply_fsave): Declare `val' as `unsigned int'.
+	(fxsave_offset): New variable.
+	(FXSAVE_ADDR): New macro.
+	(i387_supply_fxsave, i387_fill_fxsave, i387_tag): New functions.
+
+2000-08-08  Tom Tromey  <tromey@cygnus.com>
+
+	* jv-valprint.c (java_value_print): Only print non-null Strings.
+
+2000-08-09  Kevin Buettner  <kevinb@redhat.com>
+
+	* core-sol2.c (fetch_core_registers): Protoize; add prefatory
+	comment.
+	* corefile.c (specify_exec_file_hook, generic_search): Protoize.
+
+2000-08-09  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* blockframe.c (sigtramp_saved_pc): Use dynamic allocation, 
+	since TARGET_PTR_BIT is no longer a constant (MULTI_ARCH).
+	* irix4-nat.c (get_longjmp_target): Ditto.
+	* irix5-nat.c (get_longjmp_target): Ditto.
+	* jv-valprint.c (java_value_print): Ditto.
+	* m3-nat.c (get_cprocs):            Ditto.
+	* m68k-tdep.c (get_longjmp_target): Ditto.
+	* mips-nat.c  (get_longjmp_target): Ditto.
+	* mipsv4-nat.c(get_longjmp_target): Ditto.
+	* pa64solib.c (read_dynamic_info):  Ditto.
+	* solib.c (elf_locate_base):        Ditto.
+
+Mon Aug  7 23:21:22 2000  David Taylor  <taylor@texas.cygnus.com>
+
+	* TODO: remove build_parse entry.
+
+2000-08-07  Kevin Buettner  <kevinb@redhat.com>
+
+	* command.c (add_cmd, add_abbrev_cmd, add_prefix_cmd, 
+	add_abbrev_prefix_cmd): Protoize.
+
+2000-08-07  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* objfiles.h (SECT_OFF_BSS): Don't detect invalid sect_index_bss
+ 	here, let the users of the macro do it.
+	* symtab.h (ANOFFSET): Detect here if the section index is not
+ 	initialized.
+	* xcoffread.c (find_targ_sec): Don't treat .bss as special,
+ 	because some objfiles may not have that section at all.
+	* coffread.c (cs_to_section): Ditto.
+	* elfread.c (elf_symtab_read): Detect an uninitialized index
+ 	value.
+	(elfstab_offset_sections): The macro ANOFFSET cannot be used as an
+ 	lvalue anymore.
+	* remote.c (get_offsets, remote_cisco_objfile_relocate): Don't use
+ 	ANOFFSET as an lvalue.
+	* objfiles.c (objfile_relocate, objfile_relocate): Don't use
+ 	ANOFFSET as an lvalue.
+	* symfile.c (default_symfile_offsets): Don't use ANOFFSET as an
+ 	lvalue.
+
+Mon Aug  7 10:24:30 2000  David Taylor  <taylor@texas.cygnus.com>
+
+	* parse.c (build_parse): don't write off the end of the std_regs
+ 	array.
+
+2000-05-21  Mark Kettenis  <kettenis@gnu.org>
+
+	* solib.c (bfd_lookup_symbol): Fall back on the dynamic symbol
+	table if the symbol couldn't be found in the normal symbol table
+	(i.e. if the shared object in question was stripped).
+
+2000-08-06  Kevin Buettner  <kevinb@redhat.com>
+
+	* ch-exp.c (parse_opt_name_string): Protoize.  [Thanks to Eli
+	Zaretskii for the prefatory comment.]
+	* core-regset.c (fetch_core_registers): Protoize; revise
+	comment.
+
+2000-08-06  Christopher Faylor  <cgf@cygnus.com>
+
+	* win32-nat.c: Perform various gcc warning cleanups.
+	(safe_symbol_file_add_cleanup): Reset stdout to saved stdout, not
+	stderr.
+	(dll_symbol_command): Pass OBJF_USERLOADED to safe_symbol_file_add.
+	(get_child_debug_event): Always reset last_sig.  Always reset inferior
+	pid appropriately.
+	(do_initial_child_stuff): New function.  Called when attaching or
+	starting a new inferior process.
+	(child_attach): Use do_initial_child_stuff.
+	(child_create_inferior): Ditto.
+	* config/i386/cygwin.mh (NAT_FILE): Set to modern location.
+	* config/i386/tm-cygwin.h: Define ATTACH_NO_WAIT.
+
+2000-08-05  Eli Zaretskii <eliz@is.elta.co.il>
+
+	* go32-nat.c: (go32_wait): If child_cwd[] is empty, initialize
+	it to GDB's current directory.
+	(go32_create_inferior, init_go32_ops): Initialize child_cwd[] to
+	an empty string, to signal an uninitialized value.
+	From Robert Hoehne <robert.hoehne@gmx.net>.
+
+2000-08-04  Kevin Buettner  <kevinb@redhat.com>
+
+	* symtab.h (fixup_psymbol_section): Declare.
+	* symtab.c (fixup_psymbol_section): Make extern.
+	(fixup_section): Fix up section as well as bfd_section.
+	* objfiles.c (objfile_relocate): Call fixup_symbol_section
+	or fixup_psymbol_section before attempting to access
+	the SYMBOL_SECTION component of a symbol or partial symbol.
+
+2000-08-04  Kevin Buettner  <kevinb@redhat.com>
+
+	* minsyms.c (build_minimal_symbol_hash_tables): New function.
+	(compact_minimal_symbols): Don't construct hash tables here.
+	(install_minimal_symbols): Instead, construct them here.
+	(msymbols_sort): And rebuild them here too.
+
+	* dwarf2read.c (struct comp_unit_head): Add fields offset_size
+	and initial_length_size.  Change type of ``length'' field to long.
+	(read_initial_length, read_offset): New functions.
+	(dwarf2_build_psymtabs_easy): Call read_initial_length() instead
+	of just reading 4 bytes.
+	(read_comp_unit_head): Likewise; also, call read_offset() to
+	fetch the offset instead of just reading 4 bytes.
+	(dwarf_decode_lines): Likewise.
+	(read_comp_unit_head): Fix internal error message so it
+	accurately reflects the function in which the error occurred.
+	(dwarf2_build_psymtabs_hard): Properly account for size of the
+	initial length field in the section.
+	(read_attribute, dwarf2_get_ref_die_offset): Add a case for
+	DW_ORM_ref8.
+	(dwarf2_build_psymtabs_hard, psymtabs_to_symtab_1): Don't
+	assume that the .text section will have index 0 in the
+	section_offsets table.
+
+Fri Aug  4 18:00:41 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* remote.c (enum Z_packet_type): Define.
+	(remote_protocol_Z): Change to an array of size NR_Z_PACKET_TYPES.
+	(remote_insert_watchpoint): Check watchpoint type.
+	(watchpoint_to_Z_packet): New function.
+	(enum packet_result): Define.
+	(packet_ok): New function. Return enum packet_result.
+	(init_all_packet_configs): New function.
+	(remote_open_1, remote_async_open_1, remote_cisco_open): Use
+ 	init_all_packet_configs instead of initializing remote_protocol_P,
+ 	remote_protocol_Z, remote_protocol_binary_download separatly.
+	(remote_remove_hw_breakpoint, remote_insert_hw_breakpoint,
+ 	remote_remove_watchpoint, remote_insert_watchpoint): Use
+ 	watchpoint_to_Z_packet and packet_ok.  Remove #ifdef
+ 	TARGET_HAS_HARDWARE_WATCHPOINTS.
+	(set_remote_protocol_Z_software_bp_packet_cmd,
+ 	show_remote_protocol_Z_software_bp_packet_cmd,
+ 	set_remote_protocol_Z_hardware_bp_packet_cmd,
+ 	show_remote_protocol_Z_hardware_bp_packet_cmd,
+ 	set_remote_protocol_Z_write_wp_packet_cmd,
+ 	show_remote_protocol_Z_write_wp_packet_cmd,
+ 	set_remote_protocol_Z_read_wp_packet_cmd,
+ 	show_remote_protocol_Z_read_wp_packet_cmd,
+ 	set_remote_protocol_Z_access_wp_packet_cmd,
+ 	show_remote_protocol_Z_access_wp_packet_cmd): New functions.
+	(remote_Z_packet_packet_detect): New variable.
+	(show_remote_protocol_Z_packet_cmd,
+ 	set_remote_protocol_Z_packet_cmd): Iterate over all ``Z'' packet
+ 	variants.
+	(add_packet_config_cmd): Add argument legacy.  Change syntax to
+ 	``set/show remote FULL_NAME-packet ...'' command.  Add ``set/show
+ 	remote XXX-packet ...'' command using add_alias_cmd when legacy.
+	(set_packet_config_cmd): Delete.
+	(show_remote_cmd): New function.
+  	
+	* TODO: Update.
+
+Fri Aug  4 14:05:57 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* Makefile.in (infodir, SER_HARDWIRE): Fix merge problems from
+ 	2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>.
+	
+Wed Aug  2 21:15:26 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdbarch.sh (EXTRA_STACK_ALIGNMENT_NEEDED): Add.
+	* gdbarch.h, gdbarch.c: Regenerate.
+	* valops.c (hand_function_call): Replace #ifndef
+ 	NO_EXTRA_ALIGNMENT_NEEDED with if EXTRA_STACK_ALIGNMENT_NEEDED.
+
+	* d10v-tdep.c (d10v_gdbarch_init): Set
+ 	extra_stack_alignment_needed to 0.
+	* config/d10v/tm-d10v.h (NO_EXTRA_ALIGNMENT_NEEDED): Delete.
+	* config/pa/tm-hppa.h (EXTRA_STACK_ALIGNMENT_NEEDED): Replace
+ 	NO_EXTRA_ALIGNMENT_NEEDED.
+
+2000-08-03  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* MAINTAINERS (m68hc11): Stephane Carrez is maintainer.
+
+2000-08-03  Kevin Buettner  <kevinb@redhat.com>
+
+	* breakpoint.c (bpstat_alloc, map_catch_names,
+	map_breakpoint_numbers): Protoize.
+
+Thu Aug  3 15:02:23 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* remote-mips.c (mips_expect, mips_expect_timeout, common_open,
+ 	fputs_readable): Make string pointer arguments constant.
+
+Thu Aug  3 18:39:10 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* MAINTAINERS, TODO: Tweeks.
+
+Thu Aug  3 15:46:43 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* TODO (5.1): Update.
+
+2000-08-02  Kevin Buettner  <kevinb@redhat.com>
+
+ 	* alpha-tdep.c (alpha_extract_return_value): Protoize.
+
+2000-08-02  Jimmy Guo  <guo@hpcleara.cup.hp.com>
+
+	* gdbarch.sh: Add print_p field for CALL_DUMMY_BREAKPINT_OFFSET
+        to be printed only if CALL_DUMMY_BREAKPOINT_OFFSET_P.
+
+	* gdbarch.c: Regenerated.
+
+2000-08-02  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* remote-vx.c (vx_add_symbols): Fix typos.
+
+Wed Aug  2 19:15:34 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* arch-utils.h, gdbarch.c (default_register_sim_regno): New
+ 	function.
+	* gdbarch.sh (REGISTER_SIM_REGNO): Add.
+	* gdbarch.h, gdbarch.c: Regenerate.
+	* remote-sim.c (REGISTER_SIM_REGNO): Delete definition.
+
+	* config/d10v/tm-d10v.h (REGISTER_SIM_REGNO): Delete.
+	* d10v-tdep.c (d10v_gdbarch_init): Update.
+	(struct gdbarch_tdep): Delete member register_sim_regno.
+	(d10v_register_sim_regno): Delete function.
+
+Wed Aug  2 14:46:18 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* remote.c (enum packet_detect, packet_support_enums,
+ 	packet_support_auto, packet_enable, packet_disable): Delete.
+	(show_packet_config_cmd, set_packet_config_cmd,
+ 	init_packet_config): Use add_set_auto_boolean_cmd.
+	* TODO: Update.
+	
+Wed Aug  2 13:06:25 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* remote-udi.c (udi_xfer_inferior_memory, udi_files_info,
+ 	udi_kill): Update function signatures so that match target vector.
+	* MAINTAINERS: Update.
+
+Wed Aug  2 11:04:15 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* TODO: Updates.
+
+2000-08-01  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+        * gdbarch.sh: Multiarch DO_REGISTERS_INFO macro.
+        * gdbarch.h, gdbarch.c: Regenerate.
+        * infcmd.c (do_registers_info): Make not static and
+        unconditionalize.
+        * inferior.h (do_registers_info): Export.
+
+2000-08-01  Kazu Hirata  <kazu@hxi.com>
+
+	* MAINTAINERS: Add myself to "Write After Approval" list.
+
+Tue Aug  1 21:02:42 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* MAINTAINERS: Update list of target maintainers.  List all
+ 	targets explicitly.
+	(sh): Elena Zannoni is maintainer.
+	(powerpc): Nick Duffek is a maintainer.
+	
+Tue Aug  1 17:45:12 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdbarch.sh: Parse and save comments in the function_list.  Print
+ 	them out as part of the header.  Convert all function definitions
+ 	to ISO-C form.
+	* gdbarch.h, gdbarch.c: Regenerate.
+	
+Tue Aug  1 14:50:55 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* top.c (get_prompt_1), tracepoint.c (replace_comma): Update
+ 	function signatures so that they match catch_errors and
+ 	make_cleanup callbacks.
+
+	* tracepoint.c (encode_actions): Fix arguments passed to
+ 	stringify_collection_list.
+
+2000-07-31  Kevin Buettner  <kevinb@redhat.com>
+
+	* ppc-tdep.h: New file.
+	* Makefile.in (ppc-linux-tdep.o, rs6000-tdep.o): Add ppc-tdep.h
+	as a dependency.
+	* ppc-linux-tdep.c, rs6000-tdep.c (ppc-tdep.h): Include.
+
+	* ppc-linux-tdep.c (ppc_linux_at_sigtramp_return_path): Made static.
+
+	* rs6000-tdep.c (elf-bfd.h): Include.
+	(gdbarch_tdep): Add field osabi to this struct.
+	(rs6000_init_extra_frame_info, rs6000_frame_init_saved_regs,
+	rs6000_frameless_function_invocation, rs6000_frame_saved_pc,
+	rs6000_frame_chain): No longer static.
+	(process_note_abi_tag_sections, get_elfosabi): New static
+	functions.
+	(rs6000_gdbarch_init): Revised to accomodate ELF executables;
+	also use Linux specific methods when the target is Linux.
+
+	* config/powerpc/aix.mt, config/powerpc/cygwin.mt,
+	config/powerpc/macos.mt, config/powerpc/nbsd.mt,
+	config/powerpc/ppc-eabi.mt, config/powerpc/ppc-nw.mt,
+	config/powerpc/ppc-sim.mt, config/powerpc/ppcle-eabi.mt,
+	config/powerpc/ppcle-sim.mt, config/powerpc/solaris.mt,
+	config/powerpc/vxworks.mt, config/rs6000/aix4.mt,
+	config/rs6000/rs6000.mt, config/rs6000/rs6000lynx.mt
+	(TDEPFILES): Add ppc-linux-tdep.o.
+
+	* config/tm-linux.h (SIGCONTEXT_PC_OFFSET, FRAME_SAVED_PC,
+	INIT_EXTRA_FRAME_INFO, FRAMELESS_FUNCTION_INVOCATION,
+	FRAME_INIT_SAVED_REGS, FRAME_CHAIN, PUSH_ARGUMENTS,
+	MEMORY_REMOVE_BREAKPOINT: Removed defines.
+	(ppc_linux_frame_saved_pc, ppc_linux_init_extra_frame_info,
+	ppc_linux_frameless_function_invocation,
+	ppc_linux_frame_init_saved_regs, ppc_linux_frame_chain,
+	ppc_sysv_abi_push_arguments, ppc_linux_memory_remove_breakpoint):
+	Removed declarations.
+	(CANNOT_FETCH_REGISTER, CANNOT_STORE_REGISTER): Disabled.
+
+	* dink32-rom.c (dink32_regnames): Make array size implicit.
+
+	* ppc-bdm.h (ppc-tdep.h): Include.
+
+	* rs6000-tdep.c, ppc-linux-tdep.c, ppc-bdm.h, ppc-tdep.h
+	(GP0_REGNUM, TOC_REGNUM, PS_REGNUM, CR_REGNUM, LR_REGNUM,
+	CTR_REGNUM, XER_REGNUM, MQ_REGNUM): Add PPC_ prefix.
+
+	From Nick Duffek:
+	* ppc-tdep.h (ppc_linux_frame_saved_pc, rs6000_frame_saved_pc):
+	Change return type to CORE_ADDR.
+	* ppc-linux-tdep.c (ppc_linux_frame_saved_pc): Likewise.
+
+2000-07-31  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+        * sh-tdep.c (sh_push_arguments): Make header match prototype.
+
+	* remote-e7000.c (e7000_start_remote): Use void *, not char * as
+ 	parameter to avoid compiler warning.
+	(fetch_regs_from_dump): Call get_hex() with the correct number of
+ 	parameters.
+
+2000-07-31  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* config/djgpp/fnchange.lst: Add file mappings as per last weekly
+	snapshot.
+
+2000-07-29  Kevin Buettner  <kevinb@redhat.com>
+
+	* a29k-tdep.c, a68v-nat.c, abug-rom.c, alpha-nat.c,
+	alpha-tdep.c, annotate.c, arc-tdep.c, arch-utils.c, ax-gdb.c,
+	ax-general.c, blockframe.c, breakpoint.c, buildsym.c,
+	c-lang.c, c-typeprint.c, c-valprint.c, ch-exp.c, ch-lang.c,
+	ch-typeprint.c, ch-valprint.c, cli-out.c, coff-solib.c,
+	coffread.c, command.c, complaints.c, copying.c, core-aout.c,
+	core-regset.c, core-sol2.c, corefile.c, corelow.c,
+	cp-valprint.c, cpu32bug-rom.c, cxux-nat.c, d10v-tdep.c,
+	d30v-tdep.c, dbug-rom.c, dbxread.c, dcache.c, delta68-nat.c,
+	demangle.c, dink32-rom.c, dpx2-nat.c, dsrec.c, dstread.c,
+	dve3900-rom.c, dwarf2read.c, dwarfread.c, elfread.c,
+	environ.c, eval.c, event-top.c, exec.c, expprint.c, f-lang.c,
+	f-typeprint.c, f-valprint.c, findvar.c, fork-child.c,
+	fr30-tdep.c, gdbarch.c, gdbserver/gdbreplay.c,
+	gdbserver/low-hppabsd.c, gdbserver/low-linux.c,
+	gdbserver/low-lynx.c, gdbserver/low-nbsd.c,
+	gdbserver/low-sim.c, gdbserver/low-sparc.c,
+	gdbserver/low-sun3.c, gdbserver/remote-utils.c,
+	gdbserver/utils.c, gdbtypes.c, gnu-nat.c, h8300-tdep.c,
+	h8500-tdep.c, hp-psymtab-read.c, hp-symtab-read.c,
+	hp300ux-nat.c, hppa-tdep.c, hppab-nat.c, hppah-nat.c,
+	hppam3-nat.c, hpread.c, hpux-thread.c, i386-linux-nat.c,
+	i386-stub.c, i386-tdep.c, i386aix-nat.c, i386b-nat.c,
+	i386ly-tdep.c, i386m3-nat.c, i386mach-nat.c, i386nbsd-nat.c,
+	i386v-nat.c, i386v4-nat.c, i387-tdep.c, i960-tdep.c,
+	ia64-linux-nat.c, ia64-tdep.c, infcmd.c, inflow.c,
+	infptrace.c, infrun.c, inftarg.c, infttrace.c, irix4-nat.c,
+	irix5-nat.c, jv-lang.c, jv-typeprint.c, jv-valprint.c,
+	kdb-start.c, kod-cisco.c, kod.c, language.c, lin-thread.c,
+	linux-thread.c, lynx-nat.c, m2-lang.c, m2-typeprint.c,
+	m2-valprint.c, m3-nat.c, m32r-rom.c, m32r-stub.c, m32r-tdep.c,
+	m68hc11-tdep.c, m68k-stub.c, m68k-tdep.c, m68klinux-nat.c,
+	m68knbsd-nat.c, m88k-nat.c, m88k-tdep.c, mac-nat.c,
+	mac-xdep.c, maint.c, mcore-rom.c, mcore-tdep.c, mdebugread.c,
+	mem-break.c, mi/mi-cmds.c, mi/mi-main.c, mi/mi-out.c,
+	mi/mi-parse.c, minsyms.c, mips-nat.c, mips-tdep.c,
+	mipsm3-nat.c, mipsread.c, mipsv4-nat.c, mn10200-tdep.c,
+	mn10300-tdep.c, mon960-rom.c, monitor.c, news-xdep.c,
+	nindy-tdep.c, nlm/gdbserve.c, nlm/i386.c, nlm/ppc.c,
+	nlmread.c, ns32k-tdep.c, ns32km3-nat.c, ns32knbsd-nat.c,
+	objfiles.c, ocd.c, op50-rom.c, os9kread.c, osfsolib.c,
+	p-lang.c, p-typeprint.c, p-valprint.c, pa64solib.c, parse.c,
+	ppc-bdm.c, ppc-linux-nat.c, ppc-linux-tdep.c, ppcbug-rom.c,
+	ppcnbsd-nat.c, printcmd.c, proc-api.c, proc-events.c,
+	proc-flags.c, proc-why.c, procfs.c, ptx4-nat.c,
+	remote-adapt.c, remote-array.c, remote-bug.c, remote-e7000.c,
+	remote-eb.c, remote-es.c, remote-est.c, remote-hms.c,
+	remote-mips.c, remote-mm.c, remote-nindy.c, remote-nrom.c,
+	remote-os9k.c, remote-rdi.c, remote-rdp.c, remote-sds.c,
+	remote-sim.c, remote-st.c, remote-udi.c, remote-utils.c,
+	remote-vx.c, remote-vx29k.c, remote-vx68.c, remote-vx960.c,
+	remote-vxmips.c, remote-vxsparc.c, remote.c, rom68k-rom.c,
+	rs6000-tdep.c, scm-exp.c, scm-lang.c, scm-valprint.c,
+	ser-e7kpc.c, ser-go32.c, ser-mac.c, ser-ocd.c, ser-unix.c,
+	sh-stub.c, sh-tdep.c, sh3-rom.c, sol-thread.c, solib.c,
+	somread.c, somsolib.c, source.c, sparc-nat.c, sparc-stub.c,
+	sparc-tdep.c, sparcl-stub.c, sparcl-tdep.c, sparclet-rom.c,
+	sparclet-stub.c, stabsread.c, stack.c, standalone.c,
+	stop-gdb.c, stuff.c, sun3-nat.c, sun386-nat.c, symfile.c,
+	symm-nat.c, symm-tdep.c, symmisc.c, symtab.c, target.c,
+	thread.c, tic80-tdep.c, top.c, tracepoint.c, tui/tui-file.c,
+	tui/tui.c, tui/tuiLayout.c, tui/tuiRegs.c, tui/tuiStack.c,
+	tui/tuiWin.c, typeprint.c, ui-file.c, ui-out.c, ultra3-nat.c,
+	ultra3-xdep.c, umax-xdep.c, utils.c, v850-tdep.c, v850ice.c,
+	valarith.c, valops.c, valprint.c, values.c, varobj.c,
+	vax-tdep.c, w65-tdep.c, w89k-rom.c, win32-nat.c, wince.c,
+	wrapper.c, xcoffread.c, xcoffsolib.c, xmodem.c, z8k-tdep.c: 
+	Convert old-style, pre-ISO function definitions to prototyped
+	form.
+
+2000-07-28  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* sh-tdep.c (sh_gdbarch_init): For sh4 initialize
+ 	register_convert_to_raw, register_convert_to_virtual,
+ 	register_convertible.
+	(sh_sh4_register_convertible): New function.
+	(sh_sh4_register_convert_to_virtual): New function.
+	(sh_sh4_register_convert_to_raw): New function.
+	Include floatformat.h.
+
+Thu Jul 27 14:06:27 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	From 2000-06-25 Stephane Carrez <Stephane.Carrez@worldnet.fr>:
+	* configure.tgt: Recognize the 68hc11.
+	* m68hc11-tdep.c: New file for 68hc11 target.
+	* config/m68hc11/m68hc11.mt: New file for 68hc11 port.
+	
+	* configure.tgt: When 68hc11, set gdb_multi_arch.
+
+Wed Jul 26 17:22:53 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure.in (GDB_MULTI_ARCH): Define from configure.tgt
+ 	or makefile fragment.
+	* acconfig.h (GDB_MULTI_ARCH): Add.
+	* config.in, configure: Regenerate.
+	
+	* gdbarch.sh (GDB_MULTI_ARCH): Delete definition, moved to
+ 	configure.in and defs.h.  Use GDB_MULTI_ARCH_TM,
+ 	GDB_MULTI_ARCH_PARTIAL and GDB_MULTI_ARCH_PURE in tests.
+	* gdbarch.h, gdbarch.c: Regenerate.
+
+	* defs.h (GDB_MULTI_ARCH_PARTIAL, GDB_MULTI_ARCH_TM, ,
+ 	GDB_MULTI_ARCH_PURE): Define.  Only include "tm.h" when the target
+ 	is less than pure multi-arch.
+
+2000-07-26  Jimmy Guo       <guo@cup.hp.com>
+
+	* config/convex/tm-convex.h: Remove stray control characters.
+	* config/m68k/tm-altos.h: Ditto.
+	* config/tahoe/tm-tahoe.h: Ditto.
+
+2000-07-26  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* sh-tdep.c (sh_sh4_register_name, sh_sh4_register_byte,
+ 	sh_sh4_register_raw_size, sh_sh4_register_virtual_type,
+ 	sh_fetch_pseudo_register, sh_store_pseudo_register,
+ 	sh_do_pseudo_register, sh_gdbarch_init): Fix names for pseudoregs,
+ 	they should be numbered as drx fvy where x and y are multiples of
+ 	2 and 4 respectively.
+	
+	* config/sh/tm-sh.h: Fix names of pseudo regs.
+
+2000-07-24  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* config/sh/tm-sh.h (struct gdbarch_tdep): Add sh4 specific
+ 	pseudo registers.
+	(DO_REGISTERS_INFO): Define.
+
+	* sh-tdep.c (sh_sh4_register_name): New function.
+	(sh_generic_show_regs, sh3_show_regs, sh3e_show_regs,
+ 	sh3_dsp_show_regs, sh4_show_regs, sh_dsp_show_regs): Update
+ 	signature.
+	(sh_show_regs_command): New function. Actual function called by
+ 	the 'regs' command.
+	(sh_register_byte): Rename to...
+	(sh_default_register_byte): ...New function.
+	(sh_sh4_register_byte): New function.
+	(sh_register_raw_size): Rename to...
+	(sh_default_register_raw_size): ...New function.
+	(sh_sh4_register_raw_size): New function.
+	(sh_sh4_register_virtual_type): New function.
+	(sh_sh4_build_float_register_type): New function.
+	(sh_fetch_pseudo_register, sh_store_pseudo_register): New
+ 	functions.
+	(fv_reg_base_num, dr_reg_base_num): New functions.
+	(do_fv_register_info, do_dr_register_info, sh_do_pseudo_register,
+ 	sh_do_fp_register, sh_do_register, sh_print_register,
+ 	sh_do_registers_info): New functions.
+	(sh_gdbarch_init): Initialize sh4 pseudo registers to -1. Update
+ 	architecture specific parts.
+	(_initialize_sh_tdep): Use sh_show_regs_command for 'regs' command.
+
+2000-07-24  Jim Blandy  <jimb@redhat.com>
+
+	* dwarf2read.c (read_structure_scope): Correct overzealous
+	addition of cu_header argument.
+
+Mon Jul 24 07:47:46 2000  Anthony Green  <green@redhat.com>
+
+	* TODO: Update.  Two of my java patches are in. 
+
+2000-07-24  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+         * gdbarch.sh: Add FETCH_PSEUDO_REGISTER and STORE_PSEUDO_REGISTER
+         to the gdbarch structure.
+         * gdbarch.c: Regenerate.
+         * gdbarch.h: Regenerate.
+         * inferior.h (FETCH_PSEUDO_REGISTER, STORE_PSEUDO_REGISTER):
+         Delete macros.
+         * regcache.c (write_register, read_register, write_register_bytes,
+         write_register_gen, read_register_bytes, read_register_gen):
+         Rename ARCH_FECTH_PSEUDO_REGISTERS to FETCH_PSEUDO_REGISTERS and
+         ARCH_STORE_PSEUDO_REGISTER to STORE_PSEUDO_REGISTER.
+
+2000-07-24  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* gdbarch.sh: Add NUM_PSEUDO_REGS to the gdbarch structure.
+	* gdbarch.c: Regenerate. 
+	* gdbarch.h: Regenerate.
+	* inferior.h (NUM_PSEUDO_REGS): Delete macro.
+
+Sun Jul 23 21:40:55 2000  Anthony Green  <green@redhat.com>
+
+	* language.c: Include jv-lang.h.
+	(lang_bool_type): Add case for java booleans.
+
+Mon Jul 24 11:23:14 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* dwarf2read.c (address_size): Delete file wide global.
+	(struct comp_unit_head): Add signed_addr_p;
+	(read_comp_unit_head): New function.
+	(psymtab_to_symtab_1, dwarf2_build_psymtabs_hard): Use
+ 	read_comp_unit_head to parse the debug_info header.
+	(read_address): Add parameters cu_header and bytes_read.  When
+ 	specified, sign extend the address.
+	
+	* dwarf2read.c (add_partial_symbol, decode_locdesc,
+ 	die_containing_type, die_type, dwarf_decode_lines,
+ 	dwarf2_add_field, dwarf2_add_member_fn,
+ 	dwarf2_build_psymtabs_hard, dwarf2_const_value, new_symbol,
+ 	process_die, psymtab_to_symtab_1, read_array_type,
+ 	read_enumeration, read_attribute, read_common_block,
+ 	read_comp_unit, read_file_scope, read_full_die, read_func_scope,
+ 	read_lexical_block_scope, read_partial_die, scan_partial_symbols,
+ 	read_structure_scope, read_subroutine_type, read_tag_const_type,
+ 	read_tag_pointer_type, read_tag_ptr_to_member_type,
+ 	read_tag_reference_type, read_type_die, read_typedef,
+ 	tag_type_to_type): Pass cu_header parameter.
+
+2000-07-21  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+        * regcache.c (read_register, read_register_bytes): Fix typos.
+
+2000-07-21  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* thread.c (thread_apply_all_command): Update thread list first.
+	* printcmd.c (printf_command): Guard against 0-length string.
+	* config/i386/tm-i386.h: treat PC and FP as unsigned.
+	(SAVED_PC_AFTER_CALL): Use read_memory_unsigned_integer.
+	(FRAME_SAVED_PC): Ditto.
+	(FRAME_CHAIN): Ditto.
+
+2000-07-20  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* valarith.c (value_sub): Call check_typedef.
+
+2000-07-19  Nicholas Duffek  <nsd@redhat.com>
+
+	* thread.c (free_thread): New function.
+	(init_thread_list): Always zero highest_thread_num.  Call
+	free_thread() instead of free().
+	(delete_thread): Move thread cleanup code to free_thread().
+
+2000-07-19  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+        Multiarch the sh target.
+	* sh-tdep.c:
+	(sh_generic_reg_names, sh_reg_names,sh3_reg_names, sh3e_reg_names,
+ 	sh_dsp_reg_names, sh3_dsp_reg_names, sh_processor_type_table):
+ 	Remove.
+	(XMALLOC): Define.
+	(struct frame_extra_info): Define.
+	(sh_register_raw_size, sh_register_virtual_size,
+ 	sh_register_virtual_type, sh_register_byte, sh_breakpoint_from_pc,
+ 	sh_frame_saved_pc, sh_skip_prologue,
+ 	sh_nofp_frame_init_saved_regs, sh_fp_frame_init_saved_regs,
+ 	sh_extract_struct_value_address, sh_use_struct_convention,
+ 	sh_store_struct_return, sh_push_arguments, sh_push_return_address,
+ 	sh_saved_pc_after_call, sh_generic_register_name,
+ 	sh_sh_register_name, sh_sh3_register_name, sh_sh3e_register_name,
+ 	sh_sh_dsp_register_name, sh_sh3_dsp_register_name,
+ 	sh_frame_args_address, sh_frame_locals_address,
+ 	sh_coerce_float_to_double, sh_default_store_return_value,
+ 	sh3e_sh4_store_return_value, sh_generic_show_regs,
+ 	sh3_show_regs,sh3e_show_regs, sh3_dsp_show_regs, sh4_show_regs,
+ 	sh_dsp_show_regs, sh_register_byte, sh_register_raw_size,
+ 	sh_register_virtual_size, sh_sh3e_register_virtual_type,
+ 	sh_default_register_virtual_type, sh_gdbarch_init): New functions.
+	(sh_target_architecture_hook, sh_frame_find_saved_regs,
+ 	sh_show_regs): Delete functions.
+	(sh_frame_chain, sh_find_callers_reg, sh_init_extra_frame_info,
+ 	sh_pop_frame, sh_extract_return_value): Update
+
+	* config/sh/tm-sh.h (GDB_MULTI_ARCH): Define to 1.
+	(struct gdbarch_tdep): Define.
+	Remove all unnecessary defines. 	
+
+	* remote-e7000.c ({PR,GBR,SR,MACL,VBR,MACH}_REGNUM): Define to -1,
+ 	for h8300 case.
+	(want_sh,want_nopc_sh,want_nopc_sh3): Make nomenclature
+ 	consistent.
+	(e7000_fetch_registers): Remove ifdef GDB_TARGET_IS_SH, use
+ 	runtime check instead.
+	(e7000_wait): Ditto.
+
+	* sh3-rom.c (sh3_supply_register): Use gdbarch_tdep to get the SSR
+ 	and SPC register numbers.
+	(sh3_regnames, sh3e_regnames): Don't specify a size.
+
+	* config/h8300/tm-h8300.h: Add comment.
+
+Wed Jul 19 12:50:16 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* solib.c (elf_locate_base, info_sharedlibrary_command): Rename
+ 	bfd_elf_get_arch_size to bfd_get_arch_size.
+
+Tue Jul 18 17:13:01 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	From Richard Henderson <rth@cygnus.com>:
+	* dwarf2read.c (dwarf2_empty_hash_tables): Renamed from
+	dwarf2_empty_die_ref_table; zero dwarf2_cached_types as well.
+	Update all callers.
+
+2000-07-17  Daniel Berlin  <dberlin@redhat.com>
+
+	* valops.c (value_struct_elt): Change error message
+
+2000-07-17  matthew green  <mrg@redhat.com>
+
+	* config/sparc/nm-nbsd.h (GDB_GREGSET_T, GDB_FPREGSET_T): Define.
+
+Mon Jul 17 13:08:10 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* values.c (value_as_pointer): When VAL is an integer, explictly
+ 	cast to a pointer before converting to a CORE_ADDR.
+	* gdbtypes.c (build_gdbtypes): For builtin_type_ptr, construct a
+ 	real void pointer instead of an integer.
+
+2000-07-15  Daniel Berlin  <dberlin@redhat.com>
+
+	* valops.c (typecmp):  Seperate loop into two, add support for
+	references. This way, we can  say a reference to a pointer to a
+	char is	compatible with a pointer to a char. Before, this would
+	not be true.
+
+2000-07-14  Nicholas Duffek  <nsd@redhat.com>
+
+	* ppcbug-rom.c (ppcbug_regnames[]): Make array size implicit.
+	* rs6000-tdep.c (DEFAULT_LR_SAVE): Move to config/*/tm-*.h.
+	(rs6000_gdbarch_init): Use generic_pc_in_call_dummy instead of
+	rs6000_pc_in_call_dummy.
+	* config/rs6000/tm-rs6000.h (DEFAULT_LR_SAVE): Move here from
+	rs6000-tdep.c.
+	* config/powerpc/tm-ppc-eabi.h: Remove various definitions
+	handled by multi-arched rs6000-tdep.c.
+
+2000-07-14  Nick Clifton  <nickc@cygnus.com>
+
+	* config/mcore/tm-mcore.h (SKIP_PROLOGUE): Fix defintion to avoid
+	assignment.
+
+2000-07-13  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* parse.c: Include inferior.h.
+
+2000-07-12  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* regcache.c (registers_changed, registers_fetched): Use 
+	ARCH_NUM_REGS directly, eliminating an unnecessary variable.
+
+	This change adds pseudo-register capability to GDB.
+	Pseudo-registers are handled like registers, but they
+	don't come from or live on the target.  They may be 
+	aliases for an existing register, or they may be computed.
+	* inferior.h (NUM_PSEUDO_REGISTERS): Define default of zero.
+	(ARCH_FETCH_PSEUDO_REGISTERS): Define default of no-op.
+	(ARCH_STORE_PSEUDO_REGISTERS): Define default of no-op.
+	# regcache.c (registers_changed): Mark pseudo-registers 
+	invalid, as well as real registers.
+	(registers_fetched): Do not mark pseudo-registers as fetched
+	at the same time as other (real) registers.
+	(read_register_bytes): Fetch pseudo-registers (if any) from
+	the target architecture module instead of from the target.
+	(read_register_gen): Ditto.
+	(read_register): Ditto.
+	(write_register_bytes): Store pseudo-registers (if any) to
+	the target architecture module instead of to the target.
+	(write_register_gen): Ditto.
+	(write_register): Ditto.
+	(build_regcache): Allocate enough register_valid space for
+	pseudo-registers as well as normal (real) ones.
+	* parse.c (target_map_name_to_register): Include pseudo-regs.
+	
+Tue Jul 11 19:45:42 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+ 	* valops.c (value_cast): Allow cast from INT, ENUM or RANGE to
+ 	POINTER.
+
+2000-07-11  Scott Bambrough <scottb@netwinder.org>
+
+	* command.c (do_setshow_command): Fix typo in var_auto_boolean
+	case.
+
+Tue Jul 11 20:38:36 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* mips-tdep.c: General cleanup.  Delete all #if 0 code.  Convert
+ 	all old style K&R function definitions to ISO-C.
+	(struct gdbarch_tdep): Add mips_abi_string.
+	(mips_gdbarch_init): Initialize.
+ 	(mips_dump_tdep): Print mips_abi_string and other values.
+	(mips_push_arguments): Add more detailed tracing.
+
+Tue Jul 11 20:16:09 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* mips-tdep.c (mips32_next_pc, mips16_next_pc,
+ 	read_next_frame_reg, mips_push_dummy_frame, mips_skip_stub,
+ 	mips_saved_pc_after_call): Use read_signed_register when
+ 	extracting register value.  Ensures all addresses are sign
+ 	extended.
+	(mips_read_pc): New function.  Return sign extended address.
+	(mips_gdbarch_init): Set gdbarch_read_pc.
+
+Tue Jul 11 19:06:29 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* remote-mips.c (mips_request): Change all arguments to ULONGEST.
+	(mips_exit_debug, mips_resume, mips_initialize, mips_wait,
+ 	mips_fetch_registers, mips_store_registers, mips_fetch_word):
+ 	Update.
+	(mips_xfer_memory): When mask_address_p, mask MEMADDR down to just
+ 	32 bits.
+	(_initialize_remote_mips): Add ``set mask-address'' command.
+
+	* mips-tdep.c (_initialize_mips_tdep): Replace "set mask-address"
+ 	with "set mips mask-address".  Implement using
+ 	add_set_auto_boolean_cmd.
+	(struct gdbarch_tdep): Add default_mask_address_p.
+	(mips_mask_address_p, show_mask_address): New functions.
+	(mips_addr_bits_remove): Use mips_mask_address_p() to determine if
+ 	masking is needed.
+	(mips_gdbarch_init): Set default_mask_address_p to zero.
+	(mips_dump_tdep): Print value of mask_address_p.
+
+Tue Jul 11 18:32:40 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* printcmd.c (print_scalar_formatted): Move masking of 'a' address
+ 	from here.
+	(print_address_numeric): To here.
+	* TODO: Update.
+
+Tue Jul 11 17:50:31 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* symtab.c: Use paddr_nz() to print addresses.
+
+Tue Jul 11 12:52:31 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* value.h (read_register, read_signed_register): Change return
+ 	type to ULONGEST.
+	(read_signed_register, read_signed_register_pid): Declare.
+
+	* regcache.c (read_register, read_register_pid): Update.
+	(read_signed_register_pid, read_signed_register): New functions.
+	
+Mon Jul 10 18:06:18 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* mips-tdep.c (mips_push_arguments): Always align struct_addr on a
+ 	16 byte boundary. Align allocated argument space using
+ 	MIPS_STACK_ARGSIZE.  Reserve space on stack for the struct return
+ 	and floating-point registers.  Use fp_register_arg_p to determine
+ 	if float_argreg should be aligned.
+
+2000-07-10  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* config/sh/tm-sh.h (STORE_RETURN_VALUE): Redefine as
+ 	sh_store_return_value().
+	* sh-tdep.c (sh_store_return_value): New function. Store the
+ 	value returned by a function into the appropriate register.
+
+2000-07-10  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+        * sh-tdep.c (sh_skip_prologue): Before looking at the actual
+ 	instructions, try to see if the symbol table can be of help, by
+ 	calling after_prologue(). If this doesn't work, call
+ 	skip_prologue_hard_way().
+	(skip_prologue_hard_way): Renamed from sh_skip_prologue. Add some
+ 	more instruction pattern matching for pushing of arguments, and
+ 	manipulation of r14.
+	(after_prologue): New function. Use symbol table info to determine
+ 	the end of the prologue, if possible.
+
+2000-07-07  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
+	generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
+	generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
+	generic_target_write_pc, generic_target_read_pc, write_pc_pid, 
+	read_pc_pid, supply_register, write_register_pid, write_register,
+	read_register_pid, read_register, write_register_bytes, 
+	read_register_bytes, write_register_gen, read_register_gen, 
+	registers_fetched, registers_changed, find_saved_register, 
+	read_relative_register_raw_bytes, default_get_saved_register, 
+	read_relative_register_raw_bytes_for_frame, get_saved_register):
+	Move from this file into new file regcache.c.
+	(register_valid, registers_pid, registers): Ditto.
+	* regcache.c: New file to hold the register cache.
+	(register_cached): New function to read register_valid array.
+	* value.h (register_cached): Declare.
+	* defs.h (default_get_saved_register): Delete decl of static function.
+	* Makefile.in: Add regcache module.
+	
+Mon Jul 10 15:02:35 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	From 2000-07-05 Pierre Muller <muller@ics.u-strasbg.fr>:
+	* p-typeprint.c (pascal_type_print_method_args): Add braces around
+ 	isdigit after while keyword.
+
+2000-07-06  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+        * TODO: Remove readline 4.1 import item.
+
+2000-07-09  Nick Duffek  <nsd@redhat.com>
+
+	* gdbtypes.c (is_ancestor): Infer type equivalence from name
+	equivalence.
+	(rank_one_type): Use strcmp instead of == to compare type names.
+	Don't swap parm with arg when checking TYPE_CODE_REF types.
+	* valops.c (find_overload_match): Fix indentation.  Compare
+	parameter rankings to 0..9, 10..99, and 100+ instead of 0, 10,
+	and 100.
+
+2000-07-07  David Edelsohn  <edelsohn@gnu.org>
+
+	* xcoffread.c (read_symbol_nvalue): Return CORE_ADDR.
+	* rs6000-tdep.c (rs6000_pop_frame): Make addr CORE_ADDR type.
+
+Fri Jul  7 18:29:51 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* config/mips/tm-mips.h (IEEE_FLOAT, SKIP_PROLOGUE,
+ 	SAVED_PC_AFTER_CALL, DECR_PC_AFTER_BREAK, BREAKPOINT_FROM_PC,
+ 	INNER_THAN): Macros.
+
+	* mips-tdep.c (mips_in_lenient_prologue): Delete function.
+	(mips32_skip_prologue, mips16_skip_prologue, mips_skip_prologue):
+ 	Remove ``lenient'' argument.
+	(mips_saved_pc_after_call): New function.
+ 	(mips_gdbarch_init): Initialize gdbarch members inner_than,
+ 	breakpoint_from_pc, decr_pc_after_break, ieee_float,
+ 	skip_prologue, saved_pc_after_call.
+
+2000-07-07  Mark Kettenis  <kettenis@gnu.org>
+
+	* config/i386/tm-linux.h: Add longjmp support.
+	(JB_ELEMENT_SIZE, JB_PC): New defines.
+	(GET_LONGJMP_TARGET): Define.
+	(get_longjmp_target): Add prototype.
+
+	* breakpoint.c (bpstat_what): Keep returning
+	BPSTAT_WHAT_SET_LONGJMP_RESUME when hitting multiple longjmp()
+	breakpoints instead of signalling an error by returning
+	BPSTAT_WHAT_STOP_NOISY.
+
+2000-07-06  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* mips-tdep.c: Replace '16' with bfd_mach_mips16 where appropriate.
+
+2000-07-06  Christopher Faylor  <cgf@cygnus.com>
+
+	* infcmd.c (attach_command): Move "stop_soon_quietly" setting
+	inside ATTACH_NO_WAIT conditional since we are not about to
+	stop soon if we're not calling wait_for_inferior.
+
+Wed Jul  5 21:06:39 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* config/i386/fbsd.mh (NATDEPFILES): Keep NATDEPFILES to a single
+ 	line.  configure.in assumes this.
+
+Wed Jul  5 20:48:22 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure.in (SER_HARDWIRE): When go32 or DJGPP, set to
+ 	ser-go32.c.
+	* configure: Re-generate.
+	
+Wed Jul  5 20:28:32 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* top.h (command_loop_marker), top.c (command_loop_marker):
+ 	Delete.
+	* event-top.c (command_handler), top.c (simplified_command_loop,
+ 	command_loop): Use null_cleanup instead of command_loop_marker.
+
+Wed Jul  5 20:09:41 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* event-loop.c: Include either <poll.h> or <sys/poll.h>.
+
+	* configure.in (targ_archs): Check for <poll.h> and <sys/poll.h>.
+	* configure, config.in: Re-generate.
+	
+Wed Jul  5 18:10:44 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	From 2000-06-12 Bill Nottingham <notting@redhat.com>:
+	* Makefile.in: add $(infodir) to FLAGS_TO_PASS
+	
+Wed Jul  5 18:03:55 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* TODO: Updates.
+
+2000-07-05  Mark Kettenis  <kettenis@gnu.org>
+
+	* TODO: Update.
+
+2000-07-03  Chris Faylor  <cfg@cygnus.com>
+
+        Committed by Elena Zannoni <ezannoni@cygnus.com>
+	* sh-tdep.c (sh_skip_prologue): Change prologue matching for modern
+	compilers.
+	(sh_frame_find_saved_regs): Ditto.
+	(sh_find_callers_reg): Stop if pc is zero.
+
+Sat Jul  1 17:47:08 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* ser-unix.c (do_unix_readchar): Revert Tue Mar 28 18:19:50 2000
+ 	Andrew Cagney <cagney@b1.cygnus.com>.  Locks up when no data is
+ 	pending.
+
+Sat Jul  1 15:40:14 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* Makefile.in (SER_HARDWIRE): Restore code to set it by configure.
+
+2000-06-26  Kevin Buettner  <kevinb@redhat.com>
+
+	* copying.awk: Eliminate use of PARAMS from this file.
+
+Fri Jun 23 20:47:03 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* mips-tdep.c (mips_push_arguments): Use the variable stack_used_p
+ 	to determine if any arguments were written to the stack.  Do not
+ 	rely on NUMARG>=8.
+
+Mon Jun 19 11:29:35 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* command.h (add_set_auto_boolean_cmd): Add declaration.
+	(enum var_types): Add var_auto_boolean.
+
+	* command.c (add_set_auto_boolean_cmd): New function.
+	(do_setshow_command): Recognize auto_boolean.
+	(parse_binary_operation): Recognize enable and disable.
+	(parse_auto_binary_operation): Parse auto binary variables.
+
+	* TODO: Update
+
+Fri Jun 23 16:20:21 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* mips-tdep.c (fp_register_arg_p): New function.
+	(mips_push_arguments): Use.  Do not pass floating point arguments
+ 	on in an integer register.
+
+2000-06-21  Pierre Muller  <muller@ics.u-strasbg.fr>
+
+	* symfile.c (init_filename_language_table): add ".pas", ".p" and ".pp"
+	as pascal source file extensions.
+
+2000-06-19  J.T. Conklin  <jtc@redback.com>
+
+	* remote-nindy.c (nindy_fetch_word, nindy_store_word): Removed
+	(nindy_xfer_inferior_memory): Use dcache_xfer_memory() instead of
+ 	breaking transfer into chunks and using nindy_fetch_word() and
+	nindy_store_word().
+
+	* remote-bug.c (bug_xfer_memory): Use dcache_xfer_memory() instead
+ 	of breaking transfer into chunks and using gr_fetch_word() and
+ 	gr_store_word().
+
+	* remote.c (remote_fetch_word, remote_store_word): Removed.
+
+	* remote-utils.h (gr_fetch_word, gr_store_word): Removed.
+	* remote-utils.c (gr_fetch_word, gr_store_word): Removed.
+
+	* dcache.h (dcache_fetch, dcache_poke, dcache_poke_block): Removed.
+	* dcache.c (dcache_fetch, dcache_poke): Removed.
+
+2000-06-16  Pierre Muller  <muller@ics.u-strasbg.fr>
+
+	* defs.h: define language_pascal in language enumeration.
+	* language.h: define _LANG_pascal macro.
+	* language.c: add language_pascal support in all language dependant
+   functions.
+
+Sun Jun 18 01:01:09 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* mips-tdep.c (mips_debug): New variable.
+ 	(_initialize_mips_tdep): Add command "set debug mips".
+	(mips_push_arguments): Add code to dump the argument list as it is
+ 	created.
+
+Sun Jun 18 00:27:15 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* mips-tdep.c (mips_push_arguments): For MIPS_EABI, squeeze a
+ 	strut containing a floating-point into an FP register.
+
+Sat Jun 17 16:00:56 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* remote-mips.c: Include <ctype.h>
+ 	(mips_receive_header): Write printable characters to gdb_stdtarg
+ 	instead of gdb_stdlog.  Only count non-printables as invalid.
+	(mips_syn_garbage): Reduce to 10.
+
+Sat Jun 17 15:39:28 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* mips-tdep.c (mips_gdbarch_init): When the object file header
+ 	specifies EABI64, select EABI64 and not EABI32.
+
+2000-06-16  Nicholas Duffek  <nsd@redhat.com>
+
+	* rs6000-tdep.c: Changes throughout for multi-arch 64-bit
+	support.  Incorporate most of tm-rs6000.h.
+	(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
+	(rs6000_set_host_arch_hook): Declare.
+	(read_memory_addr): Define.
+	(pop_frame): Rename to rs6000_pop_frame.
+	(rs6000_pop_frame, rs6000_fix_call_dummy, rs6000_push_arguments,
+	rs6000_frame_saved_pc, rs6000_frame_chain): Remove non-generic
+	dummy frame handling.
+	(branch_dest, rs6000_pop_frame, rs6000_skip_trampoline_code,
+	rs6000_frame_saved_pc, frame_get_saved_regs,
+	frame_initial_stack_address, rs6000_frame_chain,
+	rs6000_convert_from_func_ptr_addr): Call read_memory_addr instead
+	of read_memory_integer.
+	(branch_dest, rs6000_pop_frame, rs6000_push_arguments,
+	rs6000_skip_trampoline_code, rs6000_frame_saved_pc,
+	frame_get_saved_regs, frame_initial_stack_address,
+	rs6000_frame_chain): Replace 4 with TDEP->wordsize.
+	(skip_prologue): Recognize some 64-bit stack adjustments.
+	(push_dummy_frame, pop_dummy_frame, set_processor,
+	show_processor): Delete.
+	(frame_get_saved_regs): Manipulate saved register addresses using
+	CORE_ADDR instead of int.
+	(rs6000_create_inferior): New function.
+	(register_names_*[]): Change to struct reg registers_*[].
+	(variants[]): Assimilate into multi-arch approach.
+	(register_names_*[], variants[]): Refer to pre-PowerPC
+	architectures as POWER instead of RS6000.
+	* rs6000-nat.c: Ubiquitous changes for 64-bit support.
+	(vmap_secs, xcoff_relocate_symtab): Cast addresses
+	to unsigned long to avoid sign-extension errors.
+	(set_host_arch): New function.
+	(xcoff_relocate_symtab): Try disabling usleep(36000) workaround.
+	(rs6000_core_fns): Use new bfd_target_xcoff_flavour.
+	(_initialize_core_rs6000): Initialize rs6000_set_host_arch_hook.
+	* symfile.c (find_sym_fns): Remove special xcoff kludge.
+	* xcoffread.c (secnum_to_bfd_section): Initialize args.objfile.
+	(process_linenos): Query line struct size from coff
+	backend instead of using compile-time constant.
+	(enter_line_range): Likewise.
+	(read_xcoff_symtab): Pass "XCOFF64" instead of "XCOFF" to
+	record_debugformat() if appropriate.
+	(process_xcoff_symbol): Access symbol addresses using
+	SYMBOL_VALUE_ADDRESS instead of SYMBOL_VALUE.
+	(read_symbol_lineno): Retrieve XCOFF64 symbol names from strtbl.
+	(scan_xcoff_symtab): Likewise.  Query syment struct size from
+	coff backend instead of using compile-time constant.
+	(xcoff_sym_fns): Set flavour to bfd_target_xcoff_flavour.
+	* Makefile.in (INTERNAL_LDFLAGS): Add $(MH_LDFLAGS) to list of flags
+	that this Makefile variable get set to.  (From Kevin Buettner.)
+	* config/powerpc/aix.mh (MH_LDFLAGS): Add linker flags so that
+	the TOC doesn't overflow.  (From Kevin Buettner.)
+	* config/powerpc/tm-ppc-aix.h: Move config decisions to
+	multi-arched rs6000-tdep.c.
+	* config/rs6000/tm-rs6000.h: Likewise.
+	(GDB_MULTI_ARCH): Define.
+	(skip_trampoline_code): Rename to rs6000_skip_trampoline_code.
+	(is_magic_function_pointer): Replace with
+	rs6000_convert_from_func_ptr_addr.
+	(TARGET_CREATE_INFERIOR_HOOK): Define.
+	(find_toc_address_hook): Rename to rs6000_find_toc_address_hook.
+	(rs6000_set_host_arch_hook): Declare.
+	* config/rs6000/nm-rs6000.h (CHILD_XFER_MEMORY): Define.
+
+2000-06-15  Kevin Buettner  <kevinb@redhat.com>
+
+	* v850ice.c: Eliminate use of PARAMS from this file.
+
+2000-06-15  Michael Snyder  <msnyder@cygnus.com>
+
+	* valops.c (value_cast): Break up long lines.
+	* utils.c: Fix comment typo.
+
+2000-06-14  Jim Blandy  <jimb@redhat.com>
+
+	* dwarf2read.c (dump_die): Use the proper printf format for
+ 	printing DW_UNSND values; they're longs now.
+
+	* dwarf2read.c (dump_die): We can read DW_FORM_data8 now, on
+	at least some platforms, so print it out too.
+
+2000-06-14  James E. Wilson  <wilson@bletchleypark.cygnus.com>
+
+	* dwarf2read.c (struct attribute): Change unsnd and snd field types
+	to long.
+	(read_8_bytes): Change return type to long.
+	(read_unsigned_leb128): Change return type to long.  Change type of
+	local result to long.  Cast argument of left shift to long.
+	(read_signed_leb128): Likewise.
+
+2000-06-14  Pierre Muller  <muller@ics.u-strasbg.fr>
+
+	Add support for Pascal language. Part 1: new files.
+	* p-exp.y, p-lang.c, p-lang.h, p-typeprint.c, p-valprint.c: New files.
+
+2000-06-13  Kevin Buettner  <kevinb@redhat.com>
+
+	* ser-ocd.c, symtab.c: Eliminate use of PARAMS from these files.
+
+Tue Jun 13 09:21:23 2000  Jeffrey A Law  (law@cygnus.com)
+
+	* configure.host (hppa*64*): Renamed from hppa2.0w per
+	gcc/binutils changes.
+	* configure.tgt: Similarly.
+
+2000-06-12  Bill Nottingham <notting@redhat.com>
+
+	Patch applied by Kevin Buettner <kevinb@redhat.com>:
+
+	* ia64-linux-nat.c, gdbserver/low-linux.c (u_offsets):  PT_CR_IFS
+	is deprecated.  Use PT_CFM instead.
+
+2000-06-12  Michael Snyder  <msnyder@cygnus.com>
+
+	* breakpoint.c (breakpoint_thread_match): Fix comment.
+
+2000-06-12  Fernando Nasser  <fnasser@cygnus.com>
+
+	* valops.c (value_assign): Adjust the length to take into
+	consideration that we are not starting from the beginning.
+
+2000-06-12  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* symfile.c (add_symbol_file_command): Properly reformat "else if"
+ 	code.
+	* coffread.c (coff_symtab_read): Ditto.
+	
+Mon Jun 12 15:24:04 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* Makefile.in (SER_HARDWIRE): Set using autoconf.
+	* configure.in (SER_HARDWIRE): Define, add ser-tcp.o.
+	* configure: Re-generate.
+
+	* config/i386/go32.mh (SER_HARDWIRE): Delete.  Handled by
+ 	configure.in.
+	* config/sparc/sun4sol2.mh, config/sparc/sun4os4.mh,
+ 	config/sparc/sparclynx.mh, config/sparc/nbsdelf.mh,
+ 	config/sparc/nbsd.mh, config/sparc/linux.mh,
+ 	config/rs6000/rs6000lynx.mh, config/powerpc/solaris.mh,
+ 	config/powerpc/nbsd.mh, config/powerpc/linux.mh,
+ 	config/powerpc/cygwin.mh, config/pa/hpux11w.mh,
+ 	config/pa/hpux11.mh, config/pa/hpux1020.mh, config/pa/hppaosf.mh,
+ 	config/pa/hppahpux.mh, config/pa/hppabsd.mh, config/ns32k/nbsd.mh,
+ 	config/mips/irix5.mh, config/mips/irix4.mh, config/m68k/nbsd.mh,
+ 	config/m68k/m68klynx.mh, config/m68k/linux.mh,
+ 	config/i386/nbsdelf.mh, config/i386/nbsd.mh, config/i386/linux.mh,
+ 	config/i386/i386sco5.mh, config/i386/i386lynx.mh,
+ 	config/i386/i386dgux.mh, config/i386/fbsd.mh,
+ 	config/i386/cygwin.mh, config/arm/linux.mh, config/alpha/fbsd.mh,
+ 	config/alpha/alpha-osf3.mh, config/alpha/alpha-linux.mh: Remove
+ 	ser-tcp.o from XDEPFILES.
+	* config/ia64/linux.mh: Ditto.
+
+	* TODO: Update.
+
+Mon Jun 12 14:26:02 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* mips-tdep.c (GDB_TARGET_IS_MIPS64): Define.
+	(struct gdbarch_tdep): Add gdb_target_is_mips64.
+	(mips_addr_bits_remove): Update.
+	(mips_gdbarch_init): Initialize.
+
+	* config/mips/tm-mips64.h (GDB_TARGET_IS_MIPS64,
+ 	GDB_TARGET_IS_MIPS64): Delete.
+
+Mon Jun 12 12:17:20 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* mips-tdep.c: Include "symcat.h".
+ 	(mips_dump_tdep): Print all known but not yet multi-arched values.
+
+2000-06-12  Mark Kettenis  <kettenis@gnu.org>
+
+	* config/i386/tm-i386.h: Add forward declaration of `struct value'.
+	(FIX_CALL_DUMMY): Redefined to call i386_fix_call_dummy.
+	(i386_fix_call_dummy): Add prototype.
+	* i386-tdep.c (i386_fix_call_dummy): New function based on the
+	code from the old FIX_CALL_DUMMY macro.
+
+2000-06-12  Kevin Buettner  <kevinb@redhat.com>
+
+	* procfs.c, remote.c: Eliminate use of PARAMS from these files.
+
+Mon Jun 12 10:21:24 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdbarch.sh (gdbarch_dump): When non multi-arch skip macros that
+ 	return void.
+
+Sun Jun 11 12:06:21 2000  Christopher Faylor <cgf@cygnus.com>
+
+	* exec.c (exec_file_attach): Add .exe extension when __CYGWIN__.
+
+Sat Jun 10 22:31:46 2000  Christopher Faylor <cgf@cygnus.com>
+
+	* win32-nat.c (safe_symbol_file_add_args): Store old gdb_stderr and
+	gdb_stdout here.
+	(safe_symbol_file_add_stub): Redirect gdb_stdout as well as stderr.
+	(safe_symbol_file_add_cleanup): Restore gdb_stdout.
+	(info_dll_command): Use the pager for displaying DLLs since there are
+	often quite a few.
+
+Sun Jun 11 11:34:05 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	From Sat Jun 10 17:54:04 2000 Hans-Peter Nilsson <hp@axis.com>:
+	* configure.in (targ_archs): Clear out secondary components.
+	* configure: Regenerate.
+
+Fri Jun  9 15:06:37 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdbarch.sh (struct gdbarch): Add member dump_tdep.
+	(struct gdbarch_registration): Ditto.
+	(gdbarch_dump): Add ui_file and gdbarch arguments.  Add support
+ 	for external dump functions.  Dump the macro value.  Call target
+ 	dump routine.
+	(gdbarch_register): New function.
+	(gdbarch_registrary): Replace gdbarch_init_registrary.
+	* gdbarch.h, gdbarch.c: Re-generate.
+	* arch-utils.c (set_arch): Update.
+	
+	* mips-tdep.c (mips_dump_tdep): New function. Move dump code here.
+	(mips_gdbarch_init): From here.
+
+	* maint.c (maintenance_print_architecture): New function.
+	(_initialize_maint_cmds): Add command ``maintenance print
+ 	architecture''.
+
+2000-06-08  Kevin Buettner  <kevinb@redhat.com>
+
+	* command.h, monitor.h: Eliminate use of PARAMS from these
+	files.
+
+2000-06-08  Fernando Nasser  <fnasser@cygnus.com>
+
+	* config/i386/tm-embed.h: New file.  Specific for embedded targets
+	like i386-elf, i386-coff and i386-aout.
+	* config/i386/embed.mt (): Specify tm-embed.h instead of the System V
+	header file.
+
+2000-06-08  Fernando Nasser  <fnasser@cygnus.com>
+
+	* MAINTAINERS: Add myself to gdbtk list.
+
+2000-06-08  Kevin Buettner  <kevinb@redhat.com>
+
+	* config/ia64/nm-linux.h (U_REGS_OFFSET): Define.
+
+2000-06-08  Fernando Nasser  <fnasser@cygnus.com>
+
+	* configure.in: Replace misplaced CONFIG_ADD by the correct
+	CONFIG_CLEAN.
+	* configure, config.in: Regenerate.
+
+2000-06-08  Fernando Nasser  <fnasser@cygnus.com>
+
+	* values.c (value_primitive_field): Copy VALUE_REGNO as well.
+	With typed registers we may have the location information in this field,
+	in addition to VALUE_ADDRESS (which was already being copied).
+
+Thu Jun  8 15:26:44 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* config/mips/tm-mips.h (GDB_MULTI_ARCH): Define as 1.
+	(CALL_DUMMY, TARGET_BYTE_ORDER_SELECTABLE_P,
+ 	COERCE_FLOAT_TO_DOUBLE): Delete.
+	* config/mips/tm-vr5000el.h, config/mips/tm-vr5000.h,
+ 	config/mips/tm-vr4xxxel.h, config/mips/tm-vr4xxx.h,
+ 	config/mips/tm-vr4100.h, config/mips/tm-tx39l.h
+ 	config/mips/tm-tx39.h, config/mips/tm-irix5.h: Delete
+ 	GDB_MULTI_ARCH.
+
+	* config/mips/tm-mips64.h (TARGET_LONG_BIT, TARGET_LONG_LONG_BIT,
+ 	TARGET_PTR_BIT): Delete definitions.
+	* config/mips/tm-vr5000el.h, config/mips/tm-vr5000.h,
+ 	config/mips/tm-tx39l.h, config/mips/tm-vr4100.h,
+ 	config/mips/tm-tx39.h: Delete definition of MIPS_EABI.
+	* mips-tdep.c (mips_gdbarch_init): Use the ISA to determine the
+ 	ABI.  If all else fails, assume O32.
+
+	* TODO, NEWS: Update.  Mention MIPS is multi-arch.
+
+Thu Jun  8 14:23:12 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* config/mips/tm-vr4xxxel.h, config/mips/tm-vr4xxx.h,
+ 	config/mips/tm-vr4100.h, config/mips/tm-tx39l.h,
+ 	config/mips/tm-tx39.h: Delete definition of
+ 	MIPS_DEFAULT_FPU_TYPE. Enable multi-arch.
+	* mips-tdep.c: (mips_gdbarch_init): The bfd_mach_mips3900 has no
+ 	FPU.  bfd_mach_mips4650 FPU is single precision.
+
+	* config/mips/tm-mips.h (MIPS_FPU_SINGLE_REGSIZE): 
+	(MIPS_FPU_DOUBLE_REGSIZE): Move from here.
+	* mips-tdep.c: To here.  Change to an enum.
+
+Wed Jun  7 18:27:51 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure.in (DEFAULT_BFD_ARCH, DEFAULT_BFD_VEC): Use config.bfd
+ 	to determine the default architecture / target.
+	* acconfig (DEFAULT_BFD_ARCH, DEFAULT_BFD_VEC): Add.
+	* configure, config.in: Regenerate.
+	
+	* arch-utils.c (set_endian): Better separate multi-arch and non-
+ 	multi-arch cases.
+	(set_endian_from_file): Call internal_error when multi-arch.
+	(initialize_current_architecture): Rewrite logic selecting a byte
+ 	order.  Use DEFAULT_BFD_ARCH DEFAULT_BFD_VEC.
+	(version.h): Include.
+
+	* config/mips/tm-mips.h, config/mips/tm-bigmips64.h,
+ 	config/mips/tm-bigmips.h: Delete definition of
+ 	TARGET_BYTE_ORDER_DEFAULT.
+
+Thu Jun  8 11:41:41 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* infrun.c (follow_inferior_fork): Bad merge from below.  Compare
+ 	strings using follow_fork_mode_ask and not "ask".
+
+Wed Jun  7 15:13:04 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* command.h (add_set_enum_cmd): Make ``enumlist'' and ``var''
+ 	constant char pointers.
+	(complete_on_enum): Change ``enumlist'' to a constant char
+ 	pointer.
+	(struct cmd_list_element): Ditto for member ``enums''.
+	* command.c (complete_on_enum, add_set_enum_cmd,
+ 	do_setshow_command): Update.
+
+	* infrun.c (follow_fork_mode_ask, follow_fork_mode_parent,
+ 	follow_fork_mode_both, follow_fork_mode_child): New.  Use to
+ 	construct the follow_fork_mode_kind_names.
+	(set_follow_fork_mode_command): Delete function.
+	(_initialize_infrun): Update.
+	(follow_inferior_fork): Do not strdup follow_fork_mode_string.
+  	Use follow_fork_mode_* variables directly instead.  Call
+ 	internal_error instead of error when unimplemented "ask" mode.
+
+	* infrun.c (scheduler_enums, scheduler_mode, schedlock_off,
+ 	schedlock_on, schedlock_step): Update.
+	* serial.c (serial_logbase, logbase_hex, logbase_octal,
+ 	logbase_ascii, logbase_enums): Update.
+	* remote.c (packet_support_enums, packet_support_auto,
+ 	packet_enable, packet_disable, struct packet_config): Update.
+	* arch-utils.c (initialize_current_architecture,
+ 	set_architecture_string): Update.
+	(endian_big, endian_little, endian_auto, endian_enum,
+ 	set_endian_string): Update.
+	* i386-tdep.c (valid_flavors, att_flavor, intel_flavor,
+ 	disassembly_flavor): Update.
+	* mips-tdep.c (size_enums, size_64, size_32, size_auto,
+ 	mips_stack_argsize_string, mips_saved_regsize_string): Update.
+	* arm-tdep.c (disassembly_flavor, valid_flavors): Update.
+	(_initialize_arm_tdep): Ditto.
+
+	* TODO: Update.
+
+Mon Jun  5 18:44:14 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* thread.c (make_cleanup_restore_current_thread,
+ 	do_restore_current_thread_cleanup): New functions.
+	(thread_apply_all_command, thread_apply_command): Use. Call
+ 	do_cleanups when finished.
+
+	* defs.h (make_cleanup_func): Delete typedef.
+	* TODO: Update.
+
+Wed Jun  7 11:34:54 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* arch-utils.c (target_byte_order, target_byte_order_auto,
+ 	show_endian, set_endian, set_endian_big, set_endian_little,
+ 	set_endian_auto, set_endian_from_file, enum set_arch,
+ 	target_architecture_auto, set_architecture_string,
+ 	target_architecture_hook, target_architecture, arch_ok, set_arch,
+ 	set_architecture_from_arch_mach, set_architecture_from_file,
+ 	show_architecture, set_architecture, info_architecture,
+ 	set_gdbarch_from_file, initialize_current_architecture): Copy from
+ 	gdbarch.c.  Rewrite ``set architecture'' and ``set endian''
+ 	commands to use enums.
+	(_initialize_gdbarch_utils): Fix name.
+	* arch-utils.h (set_architecture_from_arch_mach,
+ 	target_architecture_hook): Copy from gdbarch.h.
+	* gdbarch.sh: Update.
+	* gdbarch.h, gdbarch.c: Re-generate.
+
+	* TODO: Update.
+
+	* v850-tdep.c, sh3-rom.c, sh-tdep.c, i386-tdep.c: Include
+ 	"arch-utils.h".
+	* Makefile.in (v850-tdep.o): Specify dependencies.
+	(i386-tdep.o, sh3-rom.o, sh-tdep.o): Add arch-utils.h to
+ 	dependency list.
+
+2000-06-06  Michael Snyder  <msnyder@cygnus.com>
+
+	* configure.in: Enable autoconf to find curses.h on Solaris 2.8.
+	* configure: Regenerate.
+
+Tue Jun  6 21:14:47 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* command.c (do_setshow_command): Accept an enum option immediatly
+ 	when it is an exact match.
+
+Tue Jun  6 16:46:37 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* config/mips/tm-vr5000el.h, config/mips/tm-vr5000.h,
+ 	config/mips/tm-vr4xxxel.h, config/mips/tm-vr4xxx.h,
+ 	config/mips/tm-vr4300el.h, config/mips/tm-vr4100.h,
+ 	config/mips/tm-vr4300.h, config/mips/tm-tx39l.h,
+ 	config/mips/tm-tx39.h, config/mips/tm-embedl64.h,
+ 	config/mips/tm-embedl.h, config/mips/tm-embed64.h,
+ 	config/mips/tm-embed.h: Delete TARGET_BYTE_ORDER_SELECTABLE_P.
+
+	* tm-mips.h (TARGET_BYTE_ORDER_SELECTABLE_P): Define as 1.
+	
+Tue Jun  6 16:21:14 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdbarch.sh (generic_register_convertible_not,
+ 	frame_num_args_unknown): Move from here.
+	* arch-utils.c (generic_register_convertible_not,
+ 	frame_num_args_unknown): To here.
+	* arch-utils.h (frame_num_args_unknown): Add declaration.
+	* gdbarch.h, gdbarch.c: Re-generate.
+
+Tue Jun  6 15:07:08 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* remote-mips.c (mips_open): Select the default monitor prompt
+ 	based on the target ISA.
+
+	* config/mips/tm-vr4100.h (TARGET_MONITOR_PROMPT),
+ 	config/mips/tm-vr4300el.h (TARGET_MONITOR_PROMPT),
+ 	config/mips/tm-vr4300.h (TARGET_MONITOR_PROMPT),
+ 	config/mips/tm-vr4xxx.h (TARGET_MONITOR_PROMPT),
+ 	config/mips/tm-vr4xxxel.h (TARGET_MONITOR_PROMPT),
+ 	config/mips/tm-vr5000el.h (TARGET_MONITOR_PROMPT),
+ 	config/mips/tm-vr5000.h (TARGET_MONITOR_PROMPT),
+	config/mips/tm-mips.h (TARGET_MONITOR_PROMPT): Delete macro.
+
 2000-06-05  Daniel Berlin  <dan@cgsoftware.com>
 
 	* c-exp.y (yylex): template handling fixes.
 
 2000-06-03  Daniel Berlin  <dan@cgsoftware.com>
 
-	* symtab.h (VTBL_PREFIX_P): Add newer g++ vtbl prefix to prefix list.
+	* symtab.h (VTBL_PREFIX_P): Add newer g++ vtbl prefix to prefix
+	list.
 
-	* symtab.c (lookup_partial_symbol): Change to stop forcing linear searches
-	on C++ when we fail the binary search, by doing the binary search right.
+	* symtab.c (lookup_partial_symbol): Change to stop forcing linear
+	searches on C++ when we fail the binary search, by doing the
+	binary search right.
 
 2000-05-30  Daniel Berlin  <dan@cgsoftware.com>
 
@@ -167,7 +3980,7 @@
 
 	* config/alpha/nm-fbsd.h (CANNOT_STEP_BREAKPOINT): Define.
 
-2000-06-01  Michael Snyder  <msnyder@seadog.cygnus.com>
+2000-06-01  Michael Snyder  <msnyder@cygnus.com>
 
 	* sol-thread.c (rw_common): Circumstances (eg. a bug in Sun's 
 	thread_db library) may cause this function to be called with an
@@ -178,6 +3991,11 @@
 
 	* TODO: More suggestions added.
 
+2000-06-01  Klee Dienes  <kdienes@apple.com>
+
+	* MAINTAINERS: Add Klee Dienes and Jim Ingham as maintainers for
+	Mac OS X and Objective C components (to be contributed).
+
 2000-05-31  J.T. Conklin  <jtc@redback.com>
 
 	* configure.host: Add patterns for i[3456]86-*-netbsdaout*
@@ -352,7 +4170,7 @@
 	xcoffsolib.c, xmodem.h, z8k-tdep.c: Remove PARAMS from function
 	declarations.
 
-2000-05-26  Michael Snyder  <msnyder@seadog.cygnus.com>
+2000-05-26  Michael Snyder  <msnyder@cygnus.com>
 
 	* gregset.h: New file.  Typedefs for gdb_gregset_t and 
 	gdb_fpregset_t, prototypes for supply_gregset and friends.
@@ -473,7 +4291,7 @@
 	* config/i386/fbsd.mh (NATDEPFILES): Remove i386b-nat.o.  Add
 	core-regset.o i387-nat.o i386bsd-nat.o.
 
-2000-05-24  Michael Snyder  <msnyder@seadog.cygnus.com>
+2000-05-24  Michael Snyder  <msnyder@cygnus.com>
 
 	* findvar.c (value_from_register): Factor code, simplify logic.
 
@@ -532,7 +4350,7 @@
 
 	* TODO: Update.
 
-2000-05-17  Michael Snyder  <msnyder@seadog.cygnus.com>
+2000-05-17  Michael Snyder  <msnyder@cygnus.com>
 
 	* config/sparc/tm-sun4sol2.h: Turn on multi-arch.
 	* sparc-tdep.c (gdb_print_insn_sparc): Remove temp. multi-arch hack.
@@ -804,7 +4622,7 @@
  	value.
 	* mdebugread.c (START_PSYMTAB): Add paren to avoid x=x=x.
 
-2000-05-12  Michael Snyder  <msnyder@.cygnus.com>
+2000-05-12  Michael Snyder  <msnyder@cygnus.com>
 
 	* config/i386/tm-i386sol2.h (COERCE_FLOAT_TO_DOUBLE): Define.
 	
@@ -881,7 +4699,7 @@
         * elfread.c (record_minimal_symbol_and_info): Use the section 
 	where the symbol lives to get the index, instead of guessing.
 
-2000-05-10  Michael Snyder  <msnyder@.cygnus.com>
+2000-05-10  Michael Snyder  <msnyder@cygnus.com>
 
 	Make Sparc a Multi-Arch target.  Discard PARAMS macro (require ANSI).
 	* sparc-tdep.c: include arch-utils.h.
@@ -955,7 +4773,7 @@
 	avoid using deprecated REGISTER_NAMES macro.
 	* Makefile.in: Let sparc-tdep.c depend on arch-utils.h.
 
-2000-05-08  Michael Snyder  <msnyder@.cygnus.com>
+2000-05-08  Michael Snyder  <msnyder@cygnus.com>
 
 	* gdbarch.sh: Add FP0_REGNUM to list of multi-arched register numbers.
 	* gdbarch.c, gdbarch.h: Regenerate.
@@ -1014,7 +4832,7 @@
 	* proc-utils.h (PROCFS_NOTE, PROC_PRETTYFPRINT_STATUS): Always
  	define.
 
-2000-05-05  Michael Snyder  <msnyder@.cygnus.com>
+2000-05-05  Michael Snyder  <msnyder@cygnus.com>
 
 	* procfs.c: Cleanup of procfs tracing.  Move defines and 
 	prototypes to proc-utils.h
@@ -1034,7 +4852,7 @@
         used must be the index of the section where 'sym' resides,
         not .text.
 
-2000-05-05  Michael Snyder  <msnyder@.cygnus.com>
+2000-05-05  Michael Snyder  <msnyder@cygnus.com>
 
 	* procfs.c (many functions): change int cmd; to long cmd;
 	Solaris /proc API calls this parameter a long, and requires it
@@ -1089,7 +4907,7 @@
  	(MIPS_NUM_ARG_REGS), config/mips/tm-mips.h (MIPS_NUM_FP_ARG_REGS):
  	Delete unused macros.
 
-2000-05-03  Michael Snyder  <msnyder@.cygnus.com>
+2000-05-03  Michael Snyder  <msnyder@cygnus.com>
 
 	* solib.c (elf_locate_base, info_sharedlibrary_command):
 	Look at the bfd to determine if it is elf32 or elf64, rather
@@ -1624,8 +5442,7 @@
  	config/h8300/tm-h8300.h, config/i386/tm-i386.h,
  	config/i960/tm-i960.h, config/m88k/tm-m88k.h,
  	config/mips/tm-mips.h, config/pa/tm-hppa.h,
- 	config/sparc/tm-sparc.h, config/delta/tm-delta.h,
- 	config/frv/tm-frv.h (IEEE_FLOAT): For all ports that #define
+ 	config/sparc/tm-sparc.h (IEEE_FLOAT): For all ports that #define
 	IEEE_FLOAT, make sure they give it the value (1).
 
 	Provide the hooks needed to support architectures on which
diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS
index 2eafd67..4307784 100644
--- a/gdb/MAINTAINERS
+++ b/gdb/MAINTAINERS
@@ -5,9 +5,11 @@
 
 Jim Blandy			jimb@cygnus.com
 Andrew Cagney			ac131313@cygnus.com
+Mark Kettenis           	kettenis@gnu.org
 Stan Shebs			shebs@apple.com
 Michael Snyder			msnyder@cygnus.com
 Peter Schauer			Peter.Schauer@regent.e-technik.tu-muenchen.de
+Fred Fish			fnf@ninemoons.com
 
 
 			Various Maintainers
@@ -30,48 +32,110 @@
 host maintainer when resolving build issues.  The Target/Architecture
 maintainer works with the native maintainer when resolving API issues.
 
-d10v target		Andrew Cagney		cagney@cygnus.com
-d30v target		David Taylor		taylor@cygnus.com
-mips target		Andrew Cagney		cagney@cygnus.com
-mn10300 target		Andrew Cagney		cagney@cygnus.com
-powerpc target		Kevin Buettner		kevinb@cygnus.com
-			Elena Zannoni		ezannoni@cygnus.com
-arm target		Fernando Nasser		fnasser@cygnus.com
+	a29k		maintenance only (a29k-amd-udi -Werror)
+	alpha		maintenance only (alpha-dec-osf4.0a)
+	arc		maintenance only (arc-elf)
+
+	arm		Fernando Nasser		fnasser@cygnus.com
 			Jim Ingham		jingham@apple.com
 			Scott Bambrough		scottb@netwinder.org
-m32r target		Michael Snyder		msnyder@cygnus.com
-IA-64 target		Kevin Buettner		kevinb@cygnus.com
-x86			Mark Kettenis           kettenis@gnu.org
-sparc target		David Taylor		taylor@cygnus.com
+
+	convex		OBSOLETE
+
+	d10v		Andrew Cagney		cagney@cygnus.com
+
+	d30v		David Taylor		taylor@cygnus.com
+
+	djgpp		(see native and host)
+
+	fr30		maintenance only (fr30-elf)
+	h8300		maintenance only (h8300hms)
+	h8500		maintenance only (h8500hms)
+
+	i386		Mark Kettenis           kettenis@gnu.org
+
+	i960		maintenance only (i960-coff)
+
+	ia64		Kevin Buettner		kevinb@cygnus.com
+	m32r		Michael Snyder		msnyder@cygnus.com
+
+	m68hc11		Stephane Carrez		Stephane.Carrez@worldnet.fr
+
+	m68k		maintenance only (m68k-aout, m68k-coff, m68k-elf)
+	m88k		maintenance only (?)
+	mcore		maintenance only (?)
+
+	mips		Andrew Cagney		cagney@cygnus.com
+
+	mn10200		maintenance only (mn10200-elf)
+
+	mn10300		Andrew Cagney		cagney@cygnus.com
+
+	ns32k		maintenance only (?)
+
+	pa		Jeff Law		law@cygnus.com
+
+	powerpc		Kevin Buettner		kevinb@cygnus.com
+			Nick Duffek		nsd@cygnus.com
+
+	pyramid		OBSOLETE
+
+	romp		maintenance only (?)
+
+	rs6000		(see rs6000 native and ppc target)
+
+	sh		Elena Zannoni		ezannoni@cygnus.com
+
+	sparc		David Taylor		taylor@cygnus.com
+
+	tahoe		OBSOLETE
+
+	tic80		maintenance only (tic80-coff)
+	v850		maintenance only (v850-elf)
+	vax		maintenance only (vax-dec-vms5.5)
+	w65		maintenance only (?)
+	z8k		maintenance only (?)
+
+All maintainers can make arbitrary changes to OBSOLETE targets.
+
+All maintainers can make mechanical (params, spelling, indentation,
+multi-arch, -W..., ....) changes to ``maintenance only'' targets.
+Please sanity check the change by compiling with one of the listed
+targets.
 
 
 
 Host/Native:
 
-The Native maintainer is responsible for target specific
-native support - typically shared libraries and quirks to
-procfs/ptrace/...  The Native maintainer works with the Arch and Core
-maintainers when resolving more generic problems.
+The Native maintainer is responsible for target specific native
+support - typically shared libraries and quirks to procfs/ptrace/...
+The Native maintainer works with the Arch and Core maintainers when
+resolving more generic problems.
 
 The host maintainer ensures that gdb (including mmalloc) can be built
 as a cross debugger on their platform.
 
+AIX			Peter Schauer		Peter.Schauer@regent.e-technik.tu-muenchen.de
+			Kevin Buettner		kevinb@cygnus.com
+
 djgpp native		Eli Zaretskii		eliz@gnu.org
 			DJ Delorie		dj@cygnus.com
-MS Windows (N.T., CE, '00) host & native
+MS Windows (NT, CE, '00, 9x, Me) host & native
 			Chris Faylor		cgf@cygnus.com
 GNU/Linux/x86 native & host
 			Mark Kettenis		kettenis@gnu.org
 			Jim Blandy		jimb@cygnus.com
 GNU/Linux PPC native	Kevin Buettner		kevinb@cygnus.com
+FreeBSD native & host	Mark Kettenis		kettenis@gnu.org
+			David O'Brien		obrien@freebsd.org
 hurd native		Mark Kettenis		kettenis@gnu.org
 macos host & native	Stan Shebs		shebs@apple.com
 hpux, hp pa native	Jeff Law		law@cygnus.com
-NetBSD			J.T. Conklin		jtc@redback.com
+NetBSD native & host	J.T. Conklin		jtc@redback.com
 SCO/Unixware		Nick Duffek		nsd@cygnus.com
 			Robert Lipe		rjl@sco.com
 GNU/Linux ARM native	Scott Bambrough		scottb@netwinder.org
-Solaris/x86 native & host
+Solaris/x86 native & host (devolved)
 			Nick Duffek		nsd@cygnus.com
 			Peter Schauer		Peter.Schauer@regent.e-technik.tu-muenchen.de
 Solaris/SPARC native & host
@@ -79,6 +143,8 @@
 Mac OS X		Klee Dienes		kdienes@apple.com
 			Jim Ingham		jingham@apple.com
 
+
+
 Core: Generic components used by all of GDB
 
 generic arch support	Andrew Cagney		cagney@cygnus.com
@@ -87,6 +153,7 @@
 target vector		Andrew Cagney		cagney@cygnus.com
 main (main.c, top.c)	Elena Zannoni		ezannoni@cygnus.com
 event loop		Elena Zannoni           ezannoni@cygnus.com
+
 generic symtabs		Jim Blandy		jimb@cygnus.com
 			Elena Zannoni		ezannoni@cygnus.com
   dwarf readers		Jim Blandy		jimb@cygnus.com
@@ -96,10 +163,15 @@
   stabs reader		Jim Blandy		jimb@cygnus.com
 			Elena Zannoni		ezannoni@cygnus.com
   coff reader		Philippe De Muyter	phdm@macqel.be
+  linespec		Jim Blandy		jimb@cygnus.com
+			Elena Zannoni		ezannoni@cygnus.com
+			Fernando Nasser		fnasser@cygnus.com
+
 tracing bytecode stuff  Jim Blandy              jimb@cygnus.com
 tracing			Michael Snyder		msnyder@cygnus.com
 threads			Michael Snyder		msnyder@cygnus.com
-breakpoint.c		Michael Snyder		msnyder@cygnus.com
+			Mark Kettenis		kettenis@gnu.org
+breakpoints		Michael Snyder		msnyder@cygnus.com
 			Jim Blandy		jimb@cygnus.com
 language support	David Taylor		taylor@cygnus.com
   C++ support		Daniel Berlin		dan@cgsoftware.com
@@ -111,7 +183,11 @@
 defs.h			David Taylor		taylor@cygnus.com
 utils.c			David Taylor		taylor@cygnus.com
 Scheme support		Jim Blandy		jimb@cygnus.com
-svr4 shlibs (solib.c)	Jim Blandy		jimb@cygnus.com
+
+shared libs (devolved)	Jim Blandy		jimb@cygnus.com
+			Kevin Buettner		kevinb@cygnus.com
+  xcoffsolib		Peter Schauer		Peter.Schauer@regent.e-technik.tu-muenchen.de
+
 remote.c		Andrew Cagney		cagney@cygnus.com
 			J.T. Conklin		jtc@redback.com
 include/remote-sim.h, remote-sim.c
@@ -125,9 +201,10 @@
 			Eli Zaretskii		eliz@gnu.org
 testsuite	 	Stan Shebs		shebs@apple.com
 			Fernando Nasser		fnasser@cygnus.com
-  hp tests (gdb.hp)	*Jimmy Guo	 adl-debugger-wdb-merge-guru@cup.hp.com
+  hp tests (gdb.hp)	Jimmy Guo		guo@cup.hp.com
   Java tests (gdb.java)	Anthony Green 		green@cygnus.com
 Kernel Object Display	Fernando Nasser		fnasser@cygnus.com
+dcache.c		J.T. Conklin		jtc@redback.com
 
 
 UI: External (user) interfaces.
@@ -135,6 +212,7 @@
 command interpreter	Fernando Nasser		fnasser@cygnus.com
 gdbtk (c & tcl)		Syd Polk		spolk@cygnus.com
 			Jim Ingham		jingham@apple.com
+			Fernando Nasser         fnasser@cygnus.com
 libgui (w/foundry, sn)	Syd Polk		spolk@cygnus.com
 			Jim Ingham		jingham@apple.com
 mi (gdb/mi)		Andrew Cagney		cagney@cygnus.com
@@ -165,6 +243,7 @@
 
 		Write After Approval
 
+David Anderson					davea@sgi.com
 Jim Kingdon					kingdon@redhat.com
 Jason Molenda					jsm@cygnus.com
 H.J. Lu						hjl@lucon.org
@@ -173,9 +252,17 @@
 Glen McCready					gkm@cygnus.com
 Gary Thomas					gthomas@redhat.com
 Pierre Muller					muller@sourceware.cygnus.com
+Kazu Hirata					kazu@hxi.com
+Tom Tromey					tromey@cygnus.com
+Alexandre Oliva					aoliva@redhat.com
+Mark Salter					msalter@redhat.com
+Michael Chastain				chastain@redhat.com
+Orjan Friberg					orjanf@axis.com
 
 
 * Indicates folks we need to get Kerberos/SSH accounts ready so they
 can write in the source tree
 
-+ Indicates folks that have been caught up in a paper trail.
+
+Folks that have been caught up in a paper trail:
+
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 32a1d21..2e1ca71 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1,5 +1,5 @@
-# Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
-# Free Software Foundation, Inc.
+# Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+# 1998, 1999, 2000 Free Software Foundation, Inc.
 
 # This file is part of GDB.
 
@@ -106,6 +106,9 @@
 MMALLOC = @MMALLOC@
 MMALLOC_CFLAGS = @MMALLOC_CFLAGS@
 
+# Configured by the --with-uiout option to configure.
+UIOUT_CFLAGS = @UIOUT_CFLAGS@
+
 # We are using our own version of REGEX now to be consistent across
 # machines.
 REGEX = @REGEX@
@@ -135,6 +138,22 @@
 INTL_CFLAGS = -I$(INTL_DIR) -I$(INTL_SRC)
 
 #
+# CLI sub directory definitons
+#
+SUBDIR_CLI_OBS = \
+	cli-decode.o cli-script.o cli-cmds.o cli-setshow.o
+SUBDIR_CLI_SRCS = \
+	cli/cli-decode.c cli/cli-script.c cli/cli-cmds.c cli/cli-setshow.c
+SUBDIR_CLI_DEPS =
+SUBDIR_CLI_INITS =
+SUBDIR_CLI_LDFLAGS=
+SUBDIR_CLI_CFLAGS=
+SUBDIR_CLI_ALL=
+SUBDIR_CLI_CLEAN=
+SUBDIR_CLI_INSTALL=
+SUBDIR_CLI_UNINSTALL=
+
+#
 # MI sub directory definitons
 #
 SUBDIR_MI_OBS = \
@@ -150,10 +169,10 @@
 	mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c
 SUBDIR_MI_DEPS =
 SUBDIR_MI_INITS = \
-	mi/mi-cmds.c mi/mi-parse.c mi/mi-main.c
+	mi/mi-cmds.c mi/mi-parse.c mi/mi-main.c mi/mi-out.c
 SUBDIR_MI_LDFLAGS=
 SUBDIR_MI_CFLAGS= \
-	-DUI_OUT=1
+	-DMI_OUT=1
 SUBDIR_MI_ALL=
 SUBDIR_MI_CLEAN=
 SUBDIR_MI_INSTALL=
@@ -243,12 +262,25 @@
 LIBGUI = @LIBGUI@
 GUI_CFLAGS_X = @GUI_CFLAGS_X@
 IDE_CFLAGS=$(GUI_CFLAGS_X) $(IDE_CFLAGS_X)
+
+SUBDIR_GDBTK_OBS = \
+	gdbtk.o gdbtk-cmds.o gdbtk-hooks.o gdbtk-varobj.o gdbtk-wrapper.o
+SUBDIR_GDBTK_SRCS = \
+	gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-cmds.c \
+	gdbtk/generic/gdbtk-hooks.c gdbtk/generic/gdbtk-varobj.c \
+	gdbtk/generic/gdbtk-wrapper.c
+SUBDIR_GDBTK_DEPS = \
+	$(LIBGUI) $(ITCL_DEPS) $(ITK_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)
+SUBDIR_GDBTK_INITS = gdbtk/generic/gdbtk.c
+SUBDIR_GDBTK_LDFLAGS=
+SUBDIR_GDBTK_CFLAGS= -DGDBTK
 SUBDIR_GDBTK_ALL= all-gdbtk
 SUBDIR_GDBTK_CLEAN= clean-gdbtk
 SUBDIR_GDBTK_INSTALL= install-gdbtk
 SUBDIR_GDBTK_UNINSTALL= 
 
 CONFIG_OBS= @CONFIG_OBS@
+CONFIG_LIB_OBS= @CONFIG_LIB_OBS@
 CONFIG_SRCS= @CONFIG_SRCS@
 CONFIG_DEPS= @CONFIG_DEPS@
 CONFIG_INITS= @CONFIG_INITS@
@@ -289,7 +321,7 @@
 	$(CFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \
 	$(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) \
 	$(BFD_CFLAGS) $(MMALLOC_CFLAGS) $(INCLUDE_CFLAGS) \
-	$(INTL_CFLAGS) $(ENABLE_CFLAGS) \
+	$(INTL_CFLAGS) $(ENABLE_CFLAGS) $(UIOUT_CFLAGS) \
 	$(GDB_WARN_CFLAGS)
 INTERNAL_CFLAGS = $(INTERNAL_WARN_CFLAGS) $(GDB_WERROR_CFLAGS)
 
@@ -299,7 +331,7 @@
 # Profiling options need to go here to work.
 # I think it's perfectly reasonable for a user to set -pg in CFLAGS
 # and have it work; that's why CFLAGS is here.
-INTERNAL_LDFLAGS = $(CFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) $(LDFLAGS) $(CONFIG_LDFLAGS) @HLDFLAGS@
+INTERNAL_LDFLAGS = $(CFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) $(MH_LDFLAGS) $(LDFLAGS) $(CONFIG_LDFLAGS) @HLDFLAGS@
 HLDENV = @HLDENV@
 
 # If your system is missing alloca(), or, more likely, it's there but
@@ -342,7 +374,7 @@
 # part of libiberty) a POSIX interface.  But at least for now the
 # host-dependent makefile fragment might need to use something else
 # besides ser-unix.o
-SER_HARDWIRE = ser-unix.o ser-pipe.o
+SER_HARDWIRE = @SER_HARDWIRE@
 
 # The `remote' debugging target is supported for most architectures,
 # but not all (e.g. 960)
@@ -368,6 +400,7 @@
 FLAGS_TO_PASS = \
 	"prefix=$(prefix)" \
 	"exec_prefix=$(exec_prefix)" \
+	"infodir=$(infodir)" \
 	"against=$(against)" \
 	"AR=$(AR)" \
 	"AR_FLAGS=$(AR_FLAGS)" \
@@ -476,21 +509,22 @@
 SFILES = ax-general.c ax-gdb.c bcache.c blockframe.c breakpoint.c \
 	buildsym.c c-exp.y c-lang.c c-typeprint.c c-valprint.c \
 	ch-exp.c ch-lang.c ch-typeprint.c ch-valprint.c coffread.c \
-	command.c complaints.c corefile.c cp-valprint.c dbxread.c \
+	complaints.c completer.c corefile.c cp-valprint.c dbxread.c \
 	demangle.c dwarfread.c dwarf2read.c elfread.c environ.c eval.c \
 	event-loop.c event-top.c \
 	expprint.c f-exp.y f-lang.c f-typeprint.c f-valprint.c \
-	findvar.c gdbarch.c arch-utils.c gdbtypes.c \
+	findvar.c regcache.c gdbarch.c arch-utils.c gdbtypes.c \
 	inf-loop.c infcmd.c inflow.c infrun.c language.c \
 	kod.c kod-cisco.c \
 	ui-out.c cli-out.c \
 	varobj.c wrapper.c \
 	jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c \
 	m2-exp.y m2-lang.c m2-typeprint.c m2-valprint.c main.c maint.c \
-	mem-break.c minsyms.c mipsread.c nlmread.c objfiles.c parse.c \
+	mem-break.c minsyms.c mipsread.c nlmread.c objfiles.c \
+	p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c \
 	printcmd.c remote.c remote-nrom.c scm-exp.c scm-lang.c \
 	scm-valprint.c source.c stabsread.c stack.c symfile.c \
-	symmisc.c symtab.c target.c thread.c top.c tracepoint.c \
+	symmisc.c symtab.c linespec.c target.c thread.c top.c tracepoint.c \
 	typeprint.c utils.c valarith.c valops.c valprint.c values.c \
 	serial.c ser-unix.c mdebugread.c os9kread.c \
 	tui/tui.c tui/tui.h tui/tuiCommand.c tui/tuiCommand.h \
@@ -546,9 +580,12 @@
 
 command_h =	command.h
 gdbcmd_h =	gdbcmd.h $(command_h)
-
 call_cmds_h =	call-cmds.h
-defs_h =	defs.h xm.h tm.h nm.h config.status config.h gdbarch.h ui-file.h
+
+xm_h =		@xm_h@
+tm_h =		@tm_h@
+nm_h =		@nm_h@
+defs_h =	defs.h $(xm_h) $(tm_h) $(nm_h) config.status config.h gdbarch.h ui-file.h
 
 top_h =		top.h
 inferior_h =	inferior.h $(breakpoint_h)
@@ -563,6 +600,11 @@
 cli_out_h =	cli-out.h
 arch_utils_h = arch-utils.h
 
+cli_decode_h =	$(srcdir)/cli/cli-decode.h
+cli_cmds_h =	$(srcdir)/cli/cli-cmds.h
+cli_script_h =	$(srcdir)/cli/cli-script.h
+cli_setshow_h =	$(srcdir)/cli/cli-setshow.h
+
 # Header files that need to have srcdir added.  Note that in the cases
 # where we use a macro like $(gdbcmd_h), things are carefully arranged
 # so that each .h file is listed exactly once (M-x tags-search works
@@ -576,7 +618,7 @@
 	symfile.h stabsread.h target.h terminal.h typeprint.h xcoffsolib.h \
 	c-lang.h ch-lang.h f-lang.h \
 	jv-lang.h \
-	m2-lang.h \
+	m2-lang.h  p-lang.h \
 	complaints.h valprint.h \
 	29k-share/udi/udiids.h 29k-share/udi_soc nindy-share/b.out.h \
 	nindy-share/block_io.h nindy-share/coff.h \
@@ -605,7 +647,7 @@
 # Makefile.in
 
 DEPFILES = $(TDEPFILES) $(XDEPFILES) $(SER_HARDWIRE) $(NATDEPFILES) \
-	   $(REMOTE_OBS) $(SIM_OBS) $(CONFIG_OBS)
+	   $(REMOTE_OBS) $(SIM_OBS) $(CONFIG_LIB_OBS)
 
 SOURCES = $(SFILES) $(ALLDEPFILES) $(YYFILES) $(CONFIG_SRCS)
 # Don't include YYFILES (*.tab.c) because we already include *.y in SFILES,
@@ -614,11 +656,11 @@
 	$(POSSLIBS)
 TAGFILES_WITH_SRCDIR = $(HFILES_WITH_SRCDIR)
 
-COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o stack.o thread.o \
+COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o regcache.o \
 	source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o \
-	symtab.o symfile.o symmisc.o infcmd.o infrun.o command.o \
-	expprint.o environ.o \
-	event-loop.o event-top.o inf-loop.o \
+	symtab.o symfile.o symmisc.o linespec.o infcmd.o infrun.o \
+	expprint.o environ.o stack.o thread.o \
+	event-loop.o event-top.o inf-loop.o completer.o \
 	gdbarch.o arch-utils.o gdbtypes.o copying.o $(DEPFILES) \
 	mem-break.o target.o parse.o language.o $(YYOBJ) buildsym.o \
 	kod.o kod-cisco.o \
@@ -630,7 +672,7 @@
 	ui-out.o cli-out.o \
 	varobj.o wrapper.o \
 	jv-lang.o jv-valprint.o jv-typeprint.o \
-	m2-lang.o \
+	m2-lang.o p-lang.o p-typeprint.o p-valprint.o \
 	scm-exp.o scm-lang.o scm-valprint.o complaints.o typeprint.o \
 	c-typeprint.o ch-typeprint.o f-typeprint.o m2-typeprint.o \
 	c-valprint.o cp-valprint.o ch-valprint.o f-valprint.o m2-valprint.o \
@@ -650,10 +692,10 @@
 # For now, shortcut the "configure GDB for fewer languages" stuff.
 YYFILES = c-exp.tab.c \
 	jv-exp.tab.c \
-	f-exp.tab.c m2-exp.tab.c
+	f-exp.tab.c m2-exp.tab.c p-exp.tab.c
 YYOBJ = c-exp.tab.o \
 	jv-exp.tab.o \
-	f-exp.tab.o m2-exp.tab.o
+	f-exp.tab.o m2-exp.tab.o p-exp.tab.o
 
 # Things which need to be built when making a distribution.
 
@@ -737,7 +779,7 @@
 # tui-file.c.
 #
 
-INIT_FILES = $(OBS) $(TSOBS) $(CONFIG_INITS)
+INIT_FILES = $(OBS) $(TSOBS) $(CONFIG_OBS) $(CONFIG_INITS)
 init.c: $(INIT_FILES)
 	@echo Making init.c
 	@rm -f init.c-tmp init.l-tmp
@@ -778,9 +820,11 @@
 init.o: init.c $(defs_h) $(call_cmds_h)
 
 # Removing the old gdb first works better if it is running, at least on SunOS.
-gdb$(EXEEXT): main.o libgdb.a $(ADD_DEPS) $(CDEPS) $(TDEPLIBS)
+gdb$(EXEEXT): main.o libgdb.a $(CONFIG_OBS) $(ADD_DEPS) $(CDEPS) $(TDEPLIBS)
 	rm -f gdb$(EXEEXT)
-	$(HLDENV) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) -o gdb$(EXEEXT) main.o libgdb.a $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
+	$(HLDENV) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) -o gdb$(EXEEXT) \
+	main.o libgdb.a $(CONFIG_OBS) $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS)\
+	$(LOADLIBES)
 
 nlm:	force
 	rootme=`pwd`; export rootme; $(MAKE) $(TARGET_FLAGS_TO_PASS) DO=all DODIRS=nlm subdir_do
@@ -801,11 +845,13 @@
 	#unload $(srcdir)/c-exp.y
 	#unload $(srcdir)/jv-exp.y
 	#unload $(srcdir)/m2-exp.y
+	#unload $(srcdir)/p-exp.y
 	#unload vx-share/*.h
 	#unload nindy-share/[A-Z]*
 	#load c-exp.tab.c
 	#load jv-exp.tab.c
 	#load m2-exp.tab.c
+	#load p-exp.tab.c
 	#load copying.c version.c
 	#load ../opcodes/libopcodes.a
 	#load ../libiberty/libiberty.a
@@ -847,9 +893,9 @@
 xm-vaxult.h: xm-vax.h
 xm-vaxbsd.h: xm-vax.h
 
-kdb:	$(NTSSTART) $(OBS) $(NTSOBS) $(ADD_DEPS) $(CDEPS)
-	ld -o kdb $(NTSSTART) $(OBS) $(NTSOBS) init.o $(ADD_FILES) \
-	  -lc $(CLIBS)
+kdb:	$(NTSSTART) $(OBS) $(CONFIG_OBS) $(NTSOBS) $(ADD_DEPS) $(CDEPS)
+	ld -o kdb $(NTSSTART) $(OBS) $(CONFIG_OBS) $(NTSOBS) init.o \
+	 $(ADD_FILES) -lc $(CLIBS)
 
 # Put the proper machine-specific files first, so M-. on a machine
 # specific routine gets the one for the correct machine.  (FIXME: those
@@ -898,7 +944,7 @@
 	@echo "it deletes files that may require special tools to rebuild."
 	rm -f c-exp.tab.c \
 		jv-exp.tab \
-		f-exp.tab.c m2-exp.tab.c
+		f-exp.tab.c m2-exp.tab.c p-exp.tab.c
 	rm -f TAGS $(INFOFILES)
 	rm -f $(YYFILES)
 	rm -f nm.h tm.h xm.h config.status
@@ -1032,9 +1078,27 @@
 	-rm m2-exp.tmp
 	mv m2-exp.new ./m2-exp.tab.c
 
+# p-exp.tab.c is generated in objdir from p-exp.y if it doesn't exist
+# in srcdir, then compiled in objdir to p-exp.tab.o.
+# Remove bogus decls for malloc/realloc/free which conflict with everything
+# else.
+p-exp.tab.o: p-exp.tab.c
+p-exp.tab.c: p-exp.y
+	$(SHELL) $(YLWRAP) "$(YACC)" $(srcdir)/p-exp.y  y.tab.c p-exp.tmp -- $(YFLAGS)
+	-sed -e '/extern.*malloc/d' \
+	     -e '/extern.*realloc/d' \
+	     -e '/extern.*free/d' \
+	     -e '/include.*malloc.h/d' \
+	     -e 's/malloc/xmalloc/g' \
+	     -e 's/realloc/xrealloc/g' \
+	     -e '/^#line.*y.tab.c/d' \
+	  < p-exp.tmp > p-exp.new
+	-rm p-exp.tmp
+	mv p-exp.new ./p-exp.tab.c
+
 # These files are updated atomically, so make never has to remove them
 .PRECIOUS: m2-exp.tab.c f-exp.tab.c c-exp.tab.c
-.PRECIOUS: jv-exp.tab.c
+.PRECIOUS: jv-exp.tab.c p-exp.tab.c
 
 lint: $(LINTFILES)
 	$(LINT) $(INCLUDE_CFLAGS) $(LINTFLAGS) $(LINTFILES) \
@@ -1123,7 +1187,7 @@
 alpha-nat.o: alpha-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) target.h
 
 alpha-tdep.o: alpha-tdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
-	$(inferior_h) $(symtab_h) $(dis-asm.h) gdb_string.h
+	$(inferior_h) $(symtab_h) $(dis-asm.h) gdb_string.h linespec.h
 
 # OBSOLETE altos-xdep.o: altos-xdep.c $(defs_h) $(gdbcore_h) $(inferior_h)
 
@@ -1145,7 +1209,7 @@
 
 breakpoint.o: breakpoint.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
 	$(inferior_h) language.h target.h gdbthread.h gdb_string.h \
-	gdb-events.h
+	gdb-events.h linespec.h
 
 buildsym.o: buildsym.c $(bfd_h) buildsym.h complaints.h $(defs_h) \
 	objfiles.h symfile.h $(symtab_h) gdb_string.h
@@ -1189,8 +1253,8 @@
 	symfile.h $(symtab_h) gdb-stabs.h stabsread.h target.h \
 	gdb_string.h
 
-command.o: command.c $(defs_h) $(expression_h) $(gdbcmd_h) \
-	$(gdbtypes_h) $(symtab_h) $(value_h) gdb_string.h gdb_wait.h
+# OBSOLETE command.o: command.c $(defs_h) $(expression_h) $(gdbcmd_h) \
+# OBSOLETE 	$(gdbtypes_h) $(symtab_h) $(value_h) gdb_string.h gdb_wait.h
 
 complaints.o: complaints.c complaints.h $(defs_h) $(gdbcmd_h)
 
@@ -1213,7 +1277,7 @@
 	$(inferior_h) target.h gdb_string.h
 
 corefile.o: corefile.c $(dis-asm_h) $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
-	$(inferior_h) target.h language.h gdb_string.h
+	$(inferior_h) target.h language.h gdb_string.h completer.h
 
 corelow.o: corelow.c $(command_h) $(defs_h) $(gdbcore_h) $(inferior_h) \
 	target.h gdbthread.h gdb_string.h
@@ -1267,7 +1331,7 @@
 	 $(event_top_h)
 
 exec.o: exec.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) $(inferior_h) \
-	target.h language.h gdb_string.h
+	target.h language.h gdb_string.h completer.h
 
 expprint.o: expprint.c $(defs_h) $(expression_h) $(gdbtypes_h) \
 	language.h parser-defs.h $(symtab_h) $(value_h)
@@ -1275,6 +1339,8 @@
 findvar.o: findvar.c $(defs_h) $(gdbcore_h) $(inferior_h) target.h \
 	gdb_string.h
 
+regcache.o: regcache.c $(defs_h) $(inferior_h) target.h 
+
 fork-child.o: fork-child.c gdb_wait.h $(defs_h) $(gdbcore_h) \
 	$(inferior_h) target.h terminal.h gdbthread.h gdb_string.h
 
@@ -1363,9 +1429,13 @@
 	$(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS)\
 		$(srcdir)/v850ice.c
 
+v850-tdep.o: v850-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(obstack_h) \
+	$(target_h) $(value_h) $(bfd_h) $(gdb_string_h) $(gdbcore_h) \
+	$(symfile_h) $(arch_utils_h)
+
 tracepoint.o: tracepoint.c $(defs_h) $(symtab_h) $(frame_h) $(tracepoint_h) \
 	$(gdbtypes_h) $(expression_h) $(gdbcmd_h) $(value_h) target.h \
-	language.h gdb_string.h $(readline_headers) $(remote_h)
+	language.h gdb_string.h $(readline_headers) $(remote_h) linespec.h
 
 gdbarch.o: gdbarch.c $(defs_h) $(bfd_h) $(gdbcmd_h)
 
@@ -1401,7 +1471,7 @@
 
 i386-tdep.o: i386-tdep.c $(defs_h) gdb_string.h $(frame_h)	\
 	$(inferior_h) $(gdbcore_h) target.h $(floatformat_h)	\
-	$(symtab_h) $(gdbcmd_h) $(command_h)
+	$(symtab_h) $(gdbcmd_h) $(command_h) $(arch_utils_h)
 
 i386aix-nat.o: i386aix-nat.c $(defs_h) $(frame_h) $(inferior_h) \
 	language.h $(gdbcore_h) $(floatformat_h) target.h
@@ -1500,6 +1570,16 @@
 m3-nat.o: m3-nat.c $(defs_h) $(inferior_h) $(value_h) language.h target.h \
 	gdb_wait.h $(gdbcmd_h) $(gdbcore_h)
 
+p-lang.o: p-lang.c p-lang.h $(defs_h) $(expression_h) $(gdbtypes_h) \
+	language.h parser-defs.h $(symtab_h) gdb_string.h
+
+p-typeprint.o: p-typeprint.c p-lang.h $(defs_h) $(expression_h) \
+	$(gdbcmd_h) $(gdbcore_h) $(gdbtypes_h) language.h $(symtab_h) \
+	target.h typeprint.h $(value_h) gdb_string.h
+
+p-valprint.o: p-valprint.c p-lang.h $(defs_h) $(expression_h) $(gdbtypes_h) \
+	language.h $(symtab_h) valprint.h $(value_h) gdb_string.h
+
 m68k-tdep.o: m68k-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(value_h) \
 	$(gdbcore_h) gdb_string.h
 
@@ -1611,7 +1691,7 @@
 
 parse.o: parse.c $(command_h) $(defs_h) $(expression_h) $(frame_h) \
 	$(gdbtypes_h) language.h parser-defs.h $(symtab_h) $(value_h) \
-	gdb_string.h
+	gdb_string.h linespec.h
 
 ppc-bdm.o: ppc-bdm.c $(defs_h) $(gdbcore_h) gdb_string.h $(frame_h) \
 	$(inferior_h) $(bfd_h) symfile.h target.h gdb_wait.h $(gdbcmd_h) \
@@ -1621,7 +1701,7 @@
 	$(inferior_h) target.h
 
 ppc-linux-tdep.o: ppc-linux-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
-	target.h
+	target.h ppc-tdep.h
 
 ppcbug-rom.o: ppcbug-rom.c monitor.h $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \
 	$(inferior_h) target.h serial.h terminal.h
@@ -1760,10 +1840,10 @@
 	$(inferior_h) target.h serial.h terminal.h
 
 rs6000-nat.o: rs6000-nat.c $(bfd_h) $(defs_h) $(inferior_h) target.h \
-	xcoffsolib.h
+	$(gdbcore_h) xcoffsolib.h symfile.h objfiles.h gdb-stabs.h
 
 rs6000-tdep.o: rs6000-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
-	target.h xcoffsolib.h
+	target.h ppc-tdep.h
 
 scm-exp.o: $(defs_h) $(value_h) parser-defs.h language.h c-lang.h \
 	scm-lang.h scm-tags.h
@@ -1790,20 +1870,24 @@
 
 sh-tdep.o: sh-tdep.c $(bfd_h) $(dis-asm_h) \
 	$(srcdir)/../opcodes/sh-opc.h $(defs_h) $(expression_h) $(frame_h) \
-	$(gdbcmd_h) $(gdbtypes_h) $(symtab_h) $(value_h)
+	$(gdbcmd_h) $(gdbtypes_h) $(symtab_h) $(value_h) $(arch_utils_h)
 
 sh3-rom.o: sh3-rom.c monitor.h $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \
-	$(inferior_h) target.h serial.h terminal.h
+	$(inferior_h) target.h serial.h terminal.h $(arch_utils_h)
 
 mon960-rom.o: mon960-rom.c monitor.h $(bfd_h) gdb_wait.h $(defs_h) $(gdbcmd_h) \
 	$(inferior_h) target.h serial.h terminal.h
 
 solib.o: solib.c $(command_h) $(defs_h) $(gdbcore_h) $(inferior_h) \
-	objfiles.h gnu-regex.h symfile.h target.h gdb_string.h
+	objfiles.h gnu-regex.h symfile.h target.h gdb_string.h solist.h
+
+solib-svr4.o: solib.c $(command_h) $(defs_h) $(gdbcore_h) $(inferior_h) \
+	objfiles.h gnu-regex.h symfile.h target.h gdb_string.h solist.h \
+	solib-svr4.h
 
 source.o: source.c $(defs_h) $(expression_h) $(frame_h) $(gdbcmd_h) \
 	$(gdbcore_h) language.h objfiles.h gnu-regex.h symfile.h $(symtab_h) \
-	gdb_string.h source.h
+	gdb_string.h source.h completer.h linespec.h
 
 sparc-nat.o: sparc-nat.c $(bfd_h) $(defs_h) $(inferior_h) $(gdbcore_h) \
 	target.h
@@ -1837,9 +1921,9 @@
 sun386-nat.o: sun386-nat.c $(defs_h) $(inferior_h) $(gdbcore_h)
 
 symfile.o: symfile.c $(breakpoint_h) complaints.h $(defs_h) \
-	$(expression_h) $(gdbcmd_h) $(gdbcore_h) $(gdbtypes_h) \
-	language.h objfiles.h symfile.h $(symtab_h) target.h \
-	gdb_string.h
+	$(expression_h) gdb-stabs.h $(gdbcmd_h) $(gdbcore_h) \
+	$(gdbtypes_h) language.h objfiles.h symfile.h $(symtab_h) \
+	target.h gdb_string.h completer.h
 
 symm-tdep.o: symm-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h)
 
@@ -1852,7 +1936,11 @@
 symtab.o: symtab.c call-cmds.h $(defs_h) $(expression_h) $(frame_h) \
 	$(gdbcmd_h) $(gdbcore_h) $(gdbtypes_h) language.h objfiles.h \
 	gnu-regex.h symfile.h $(symtab_h) target.h $(value_h) \
-	gdb_string.h
+	gdb_string.h linespec.h
+
+linespec.o: linespec.c linespec.h $(defs_h) $(frame_h) $(value_h) \
+	objfiles.h symfile.h completer.h $(symtab_h) \
+	$(INCLUDE_DIR)/demangle.h command.h
 
 # OBSOLETE tahoe-tdep.o: tahoe-tdep.c $(OP_INCLUDE)/tahoe.h $(defs_h) \
 # OBSOLETE	$(symtab_h)
@@ -1864,9 +1952,13 @@
 
 thread.o: thread.c $(defs_h) gdbthread.h $(gdbcmd_h) target.h
 
+completer.o: completer.c completer.h $(gdbtypes_h) $(symtab_h) \
+	$(defs_h) $(gdbcmd_h) $(expression_h) $(readline_headers)
+
 top.o: top.c top.h $(bfd_h) $(getopt_h) $(readline_headers) call-cmds.h \
 	$(defs_h) $(gdbcmd_h) $(inferior_h) language.h signals.h \
-	$(remote_utils_h) gdb_string.h $(event_loop_h) $(event_top_h) $(version_h)
+	$(remote_utils_h) gdb_string.h $(event_loop_h) $(event_top_h) \
+	completer.h $(version_h)
 
 typeprint.o: typeprint.c $(defs_h) $(expression_h) $(gdbcmd_h) \
 	$(gdbcore_h) $(gdbtypes_h) language.h $(symtab_h) target.h \
@@ -1922,7 +2014,8 @@
 	complaints.h $(defs_h) $(gdbtypes_h) objfiles.h stabsread.h symfile.h \
 	$(symtab_h) partial-stab.h gdb_string.h
 
-xcoffsolib.o: xcoffsolib.c $(bfd_h) $(defs_h) xcoffsolib.h
+xcoffsolib.o: xcoffsolib.c $(bfd_h) $(defs_h) xcoffsolib.h $(inferior_h) \
+	$(gdbcmd_h) symfile.h $(frame_h) gnu-regex.h
 
 # FIXME: z8k-tdep.c calls _initialize_gdbtypes().  Since that isn't
 # declared -Wimplicit fails. It should be using the GDBARCH framework.
@@ -1946,16 +2039,47 @@
 	language.h m2-lang.h parser-defs.h $(symtab_h) $(value_h) \
 	$(bfd_h) objfiles.h symfile.h
 
+p-exp.tab.o: p-exp.tab.c $(defs_h) $(expression_h) $(gdbtypes_h) \
+	language.h p-lang.h parser-defs.h $(symtab_h) $(value_h) \
+	$(bfd_h) objfiles.h symfile.h
+
 gdb-events.o: gdb-events.c gdb-events.h $(defs_h) $(gdbcmd_h)
 
 ui-out.o: ui-out.c $(defs_h) $(ui_out_h) expression.h language.h
 cli-out.o: cli-out.c $(defs_h) $(ui_out_h) $(cli_out_h)
+
 varobj.o: varobj.c $(defs_h) $(frame_h) $(value_h) \
 	$(language_h) valprint.h varobj.h wrapper.h
-	$(CC) -c $(INTERNAL_WARN_CFLAGS) $(NO_WERROR_CFLAGS) $<
+
 wrapper.o: wrapper.c $(defs_h) $(frame_h) $(value_h) wrapper.h
 
 #
+# CLI dependencies
+#
+# Need to explicitly specify the compile rule as make will do nothing
+# or try to compile the object file into the cli directory.
+
+cli-decode.o: $(srcdir)/cli/cli-decode.c $(cli_decode_h) \
+		$(cli_cmds_h) $(defs_h) $(ui_out_h) \
+		$(symtab_h) gnu-regex.h
+	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-decode.c
+
+cli-cmds.o: $(srcdir)/cli/cli-cmds.c  $(cli_cmds_h) $(cli_decode_h) \
+		$(cli_script_h) $(cli_setshow_h) top.h completer.h $(defs_h) \
+		$(target_h) gdb_wait.h gnu-regex.h $(ui_out_h)
+	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-cmds.c
+
+cli-setshow.o: $(srcdir)/cli/cli-setshow.c $(cli_setshow_h) \
+		$(cli_decode_h) $(cli_cmds_h) $(defs_h) \
+		$(value_h) $(ui_out_h)
+	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-setshow.c
+
+cli-script.o: $(srcdir)/cli/cli-script.c $(cli_script_h) \
+		$(cli_cmds_h) $(cli_decode_h) top.h \
+		$(defs_h) $(value_h) language.h $(ui_out_h)
+	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-script.c
+
+#
 # MI dependencies
 #
 # Need to explicitly specify the compile rule as make will do nothing
diff --git a/gdb/NEWS b/gdb/NEWS
index 4f68e81..177181e 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -8,7 +8,23 @@
 Alpha FreeBSD					alpha*-*-freebsd*
 x86 FreeBSD 3.x and 4.x				i[3456]86*-freebsd[34]*
 
-FreeBSD versions before 2.2 are no longer supported.
+* New targets
+
+* OBSOLETE configurations
+
+x86 FreeBSD before 2.2				i[3456]86*-freebsd{1,2.[01]}*, 
+
+* Deleted configurations
+
+* Other news:
+
+* All MIPS configurations are multi-arched.
+
+Multi-arch support is enabled for all MIPS configurations.
+
+* gdba.el deleted
+
+GUD support is now a standard part of the EMACS distribution.
 
 *** Changes in GDB 5.0:
 
diff --git a/gdb/README b/gdb/README
index cd8c6c2..c718b6f 100644
--- a/gdb/README
+++ b/gdb/README
@@ -35,13 +35,26 @@
   config-ml.in  gdb           missing        mpw-install
   config.guess  include       mkinstalldirs  opcodes
 
-To build GDB, you can just do:
+You can build GDB right in the source directory:
 
 	cd gdb-5.0
 	./configure
 	make
 	cp gdb/gdb /usr/local/bin/gdb	(or wherever you want)
 
+However, we recommend that an empty directory be used instead.
+This way you do not clutter your source tree with binary files
+and will be able to create different builds with different 
+configuration options.
+
+You can build GDB in any empty build directory:
+
+     
+     mkdir build
+     cd build
+     <full path to your sources>/gdb-5.0/configure
+     make
+
 (Building GDB with DJGPP tools for MS-DOS/MS-Windows is slightly
 different; see the file gdb-5.0/gdb/config/djgpp/README for details.)
 
diff --git a/gdb/TODO b/gdb/TODO
index bef7155..91aea53 100644
--- a/gdb/TODO
+++ b/gdb/TODO
@@ -4,23 +4,31 @@
 find out whether anyone else is working on it.
 
 
-		Known problems in GDB 5.0
-		=========================
+			GDB 5.1 - Fixes
+			===============
 
 Below is a list of problems identified during the GDB 5.0 release
-cycle.  People hope to have these problems fixed in a follow-on
-release.
+cycle.  People hope to have these problems fixed in 5.1.
 
 --
 
-The BFD directory requires bug-fixed AUTOMAKE et.al.
+Hardware watchpint problems on x86 OSes, including Linux:
 
-AUTOMAKE 1.4 incorrectly set the TEXINPUTS environment variable.  It
-contained the full path to texinfo.tex when it should have only
-contained the directory.  The bug has been fixed in the current
-AUTOMAKE sources.  Automake snapshots can be found in:
-	ftp://sourceware.cygnus.com/pub/gdb/snapshots
-and	ftp://sourceware.cygnus.com/pub/binutils
+1. Delete/disable hardware watchpoints should free hardware debug
+registers. 
+2. Watch for different values on a viariable with one hardware debug
+register.
+
+According to Eli Zaretskii <eliz@delorie.com>:
+
+These are not GDB/ia32 issues per se: the above features are all
+implemented in the DJGPP port of GDB and work in v5.0.  Every
+x86-based target should be able to lift the relevant parts of
+go32-nat.c and use them almost verbatim.  You get debug register
+sharing through reference counts, and the ability to watch large
+regions (up to 16 bytes) using multiple registers.  (The required
+infrastructure in high-level GDB application code, mostly in
+breakpoint.c, is also working since v5.0.)
 
 --
 
@@ -35,24 +43,14 @@
 x86 linux GDB and SIGALRM (???)
 http://sourceware.cygnus.com/ml/gdb/2000-q1/msg00803.html
 
-I know there are problems with single stepping through signal
-handlers.  These problems were present in 4.18.  They were just masked
-because 4.18 failed to recognize signal handlers.  Fixing it is not
-easy, and will require changes to handle_inferior_event(), that I
-prefer not to make before the 5.0 release.
+This problem has been fixed, but a regression test still needs to be
+added to the testsuite:
+http://sourceware.cygnus.com/ml/gdb-patches/2000-05/msg00309.html
 
 Mark
 
 --
 
-Revised UDP support (was: Re: [Fwd: [patch] UDP transport support])
-http://sourceware.cygnus.com/ml/gdb-patches/2000-04/msg00000.html
-
-(Broken) support for GDB's remote protocol across UDP is to be
-included in the follow-on release.
-
---
-
 Can't build IRIX -> arm GDB.
 http://sourceware.cygnus.com/ml/gdb-patches/2000-04/msg00356.html
 
@@ -73,7 +71,7 @@
 > stoping in weak functions. 
 > 
 > It stops in a function that is defined as weak, not in the function
-> that is actualy run... 
+> that is actually run... 
 
 --
 
@@ -81,11 +79,136 @@
 
 --
 
-		Code Cleanups: Next Release
-		===========================
+Thread support.  Right now, as soon as a thread finishes and exits,
+you're hosed.  This problem is reported once a week or so.
 
-The following are small cleanups that will hopefully be completed by
-the follow on to 5.0.
+--
+
+Wow, three bug reports for the same problem in one day!  We should
+probably make fixing this a real priority :-).
+
+Anyway, thanks for reporting.
+
+The following patch will fix the problems with setting breakpoints in
+dynamically loaded objects:
+
+   http://sourceware.cygnus.com/ml/gdb-patches/2000-05/msg00230.html
+
+This patch isn't checked in yet (ping Michael/JimB), but I hope this
+will be in the next GDB release.
+
+There should really be a test in the testsuite for this problem, since
+it keeps coming up :-(.  Any volunteers?
+
+Mark
+
+--
+
+Re: GDB 5.0.1?
+http://sources.redhat.com/ml/gdb/2000-07/msg00038.html
+
+Is the Solaris 8 x86 problem fixed?  When you configure it, configure
+incorrectly determines that I have no curses.h.  This causes mucho
+compilation errors later on.
+
+Simply editing the config.h to define CURSES_H fixes the problem, and
+then the build works fine.
+
+The status for this problem:
+
+Solaris 8 x86 (PIII-560)
+gcc 2.95.2
+
+I had the same problem with several of the snapshots shortly before
+5.0 became official, and 5.0 has the same problem.
+
+I sent some mail in about it long ago, and never saw a reply.
+
+I haven't had time to figure it out myself, especially since I get all
+confused trying to figure out what configure does, I was happy to find
+the workaround.
+
+Mike
+
+--
+
+		GDB 5.1 - New features
+		======================
+
+The following new features should be included in 5.1.
+
+--
+
+Enable MI by default.  Old code can be deleted after 5.1 is out.
+
+--
+
+Pascal (Pierre Muller, David Taylor)
+
+Pierre Muller has contributed patches for adding Pascal Language
+support to GDB.
+
+2 pascal language patches inserted in database
+http://sourceware.cygnus.com/ml/gdb/2000-q1/msg00521.html
+
+Indent -gnu ?
+http://sourceware.cygnus.com/ml/gdb/2000-q1/msg00496.html
+
+--
+
+Java (Anthony Green, David Taylor)
+
+Anthony Green has a number of Java patches that did not make it into
+the 5.0 release.  The first two are in cvs now, but the third needs
+some fixing up before it can go in.
+
+Patch: java tests
+http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00512.html
+
+Patch: java booleans
+http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00515.html
+
+Patch: handle N_MAIN stab
+http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00527.html
+
+--
+
+[Comming...]
+
+Modify gdb to work correctly with Pascal.
+
+--
+
+Revised UDP support (was: Re: [Fwd: [patch] UDP transport support])
+http://sourceware.cygnus.com/ml/gdb-patches/2000-04/msg00000.html
+
+(Broken) support for GDB's remote protocol across UDP is to be
+included in the follow-on release.
+
+It should be noted that UDP can only work when the [Gg] packet fits in
+a single UDP packet.
+
+There is also much debate over the merit of this.
+
+--
+
+		GDB 5.1 - Cleanups
+		==================
+
+The following code cleanups will hopefully be applied to GDB 5.1.
+
+--
+
+Change documentation to GFDL license.
+
+``It is time to make an effort to start using the GFDL more
+thoroughly.  Would all GNU maintainers please change the license to
+the GFDL, for all manuals and other major documentation files?
+
+The GFDL and some instructions for using it can be found in
+http://www.gnu.org/copyleft/''
+
+	RMS
 
 --
 
@@ -95,20 +218,6 @@
 
 --
 
-Purge PARAMS.
-
-Eliminate all uses of PARAMS in GDB's source code.
-
---
-
-Elimination of make_cleanup_func. (Andrew Cagney)
-
-make_cleanup_func elimination
-http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00791.html
-http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00814.html
-
---
-
 Fix copyright notices.
 
 Turns out that ``1998-2000'' isn't considered valid :-(
@@ -117,6 +226,88 @@
 
 --
 
+Purge PARAMS.
+
+Eliminate all uses of PARAMS in GDB's source code.
+
+--
+
+printcmd.c (print_address_numeric):
+
+NOTE: This assumes that the significant address information is kept in
+the least significant bits of ADDR - the upper bits were either zero
+or sign extended.  Should ADDRESS_TO_POINTER() or some
+ADDRESS_TO_PRINTABLE() be used to do the conversion?
+
+--
+
+Compiler warnings.
+
+Eliminate all warnings for at least one host/target for the flags:
+-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs -Wformat -Wparentheses
+-Wpointer-arith -Wuninitialized
+
+--
+
+Follow through `make check' with --enable-shared.
+
+When the srcware tree is configured with --enable-shared, the `expect'
+program won't run properly.  Jim Wilson found out gdb has a local hack
+to set LD_LIBRARY_PATH, but, AFAIK, no other project has been hacked
+similarly.
+
+http://sourceware.cygnus.com/ml/gdb/2000-q1/msg00845.html
+
+--
+
+		GDB 5.2 - Fixes
+		===============
+
+--
+
+Fix at least one thread bug.
+
+--
+
+		GDB 5.2 - New features
+		======================
+
+--
+
+Objective C/C++ Support.  Bu hopefully sooner...
+
+--
+
+		GDB 5.2 - Cleanups
+		==================
+
+The following cleanups have been identified as part of GDB 5.2.
+
+--
+
+Remove old code that does not use ui_out functions and all the related
+"ifdef"s.
+
+--
+
+Eliminate more compiler warnings.
+
+--
+
+Restructure gdb directory tree so that it avoids any 8.3 and 14
+filename problems.
+
+--
+
+Convert GDB build process to AUTOMAKE.
+
+See also sub-directory configure below.
+
+The current convention is (kind of) to use $(<header>_h) in all
+dependency lists.  It isn't done in a consistent way.
+
+--
+
 		Code Cleanups: General
 		======================
 
@@ -125,6 +316,27 @@
 
 --
 
+The BFD directory requires bug-fixed AUTOMAKE et.al.
+
+AUTOMAKE 1.4 incorrectly set the TEXINPUTS environment variable.  It
+contained the full path to texinfo.tex when it should have only
+contained the directory.  The bug has been fixed in the current
+AUTOMAKE sources.  Automake snapshots can be found in:
+	ftp://sourceware.cygnus.com/pub/gdb/snapshots
+and	ftp://sourceware.cygnus.com/pub/binutils
+
+--
+
+Find something better than DEFAULT_BFD_ARCH, DEFAULT_BFD_VEC to
+determine the default isa/byte-order.
+
+--
+
+Rely on BFD_BIG_ENDIAN and BFD_LITTLE_ENDIAN instead of host dependent
+BIG_ENDIAN and LITTLE_ENDIAN.
+
+--
+
 Eliminate more compiler warnings.
 
 Of course there also needs to be the usual debate over which warnings
@@ -143,6 +355,12 @@
 Elimination of ``(catch_errors_ftype *) func''.
 
 Like make_cleanup_func it isn't portable.
+http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00791.html
+http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00814.html
+
+--
+
+Nuke #define CONST_PTR.
 
 --
 
@@ -166,13 +384,6 @@
 
 --
 
-Replace asprintf() calls with xasprintf() calls.
-
-As with things like strdup() most calls to asprintf() don't check the
-return value.
-
---
-
 Replace strsave() + mstrsave() with libiberty:xstrdup().
 
 --
@@ -226,6 +437,10 @@
 
 --
 
+Add __LINE__ and __FILE__ to internal_error().
+
+--
+
 GDB probably doesn't build on FreeBSD pre 2.2.x
 http://sourceware.cygnus.com/ml/gdb-patches/2000-05/msg00378.html
 
@@ -234,14 +449,6 @@
 
 --
 
-Updated readline
-
-Readline 4.? is out.  A merge wouldn't hurt.  Patches are in:
-
-http://sourceware.cygnus.com/ml/gdb-patches/2000-05/msg00436.html
-
---
-
 Deprecate "fg".  Apparently ``fg'' is actually continue.
 
 http://sourceware.cygnus.com/ml/gdb-patches/2000-05/msg00417.html
@@ -274,29 +481,66 @@
 
 --
 
-Always build ser-tcp.c.
-
-The patch as submitted was just going to add ser-tcp.c to the Alpha's
-makefile.  A better patch is to instead add ser-tcp.c to SER_HARDWARE
-and make it a standard part of all debuggers.
-
-If problems occure then configure.in can sort them out.
-
-http://sourceware.cygnus.com/ml/gdb-patches/2000-04/msg00544.html
+The ``maintenance deprecate set endian big'' command doesn't notice
+that it is deprecating ``set endian'' and not ``set endian big'' (big
+is implemented using an enum).  Is anyone going to notice this?
 
 --
 
-Follow through `make check' with --enable-shared.
-
-When the srcware tree is configured with --enable-shared, the `expect'
-program won't run properly.  Jim Wilson found out gdb has a local hack
-to set LD_LIBRARY_PATH, but, AFAIK, no other project has been hacked
-similarly.
-
-http://sourceware.cygnus.com/ml/gdb/2000-q1/msg00845.html
+When tab expanding something like ``set arch<tab>'' ignore the
+deprecated ``set archdebug'' and expand to ``set architecture''.
 
 --
 
+Eliminate ``arm_register_names[j] = (char *) regnames[j]'' and the
+like from arm-tdep.c.
+
+--
+
+Fix uses of ->function.cfunc = set_function().
+
+The command.c code calls sfunc() when a set command.  Rather than
+change it suggest fixing the callback function so that it is more
+useful.  See:
+
+http://sourceware.cygnus.com/ml/gdb-patches/2000-06/msg00062.html
+
+See also ``Fix implementation of  ``target xxx''.'' below.
+
+--
+
+IRIX 3.x support is probably broken.
+
+--
+
+Delete sim/SIM_HAVE_BREAKPOINTS and gdb/SIM_HAS_BREAKPOINTS.
+http://sourceware.cygnus.com/ml/gdb-patches/2000-07/msg00042.html
+
+Apart from the d30v, are there any sim/common simulators that make use
+of this?
+
+A brief summary of what happened is that sim/common/sim-break.c was
+created as a good idea.  It turned out a better idea was to use
+SIM_SIGBREAK and have GDB pass back sim_resume (..., SIGBREAK).
+
+--
+
+Move remote_remove_hw_breakpoint, remote_insert_hw_breakpoint,
+remote_remove_watchpoint, remote_insert_watchpoint into target vector.
+
+--
+
+Eliminate ``extern'' from C files.
+
+--
+
+Replace ``STREQ()'' et.al. with ``strcmp() == 0'' et.al.
+
+Extreme care is recommeded - perhaps only modify tests that are
+exercised by the testsuite (as determined using some type of code
+coverage analysis).
+
+--
 
 			New Features and Fixes
 			======================
@@ -309,12 +553,6 @@
 Add built-by, build-date, tm, xm, nm and anything else into gdb binary
 so that you can see how the GDB was created.
 
-Some of these (*m.h) would be added to the generated config.h.  That
-in turn would fix a long standing bug where by the build process many
-not notice a changed tm.h file.  Since everything depends on config.h,
-a change to *m.h forces a change to config.h and, consequently forces
-a rebuild.
-
 --
 
 Add an "info bfd" command that displays supported object formats,
@@ -330,9 +568,10 @@
 
 --
 
-Convert GDB build process to AUTOMAKE.
-
-See also sub-directory configure below.
+Add support for:
+ 
+(gdb) p fwprintf(stdout,L"%S\n", f)
+No symbol "L" in current context.
 
 --
 
@@ -346,11 +585,6 @@
 
 --
 
-Restructure gdb directory tree so that it avoids any 8.3 and 14
-filename problems.
-
---
-
 Add a transcript mechanism to GDB.
 
 Such a mechanism might log all gdb input and output to a file in a
@@ -375,8 +609,6 @@
 
 Update texinfo.tex to latest?
 
-
-
 --
 
 Incorporate agentexpr.texi into gdb.texinfo
@@ -395,7 +627,7 @@
 
 ``(gdb) catch signal SIGNAL''
 
-Overlaps with ``handle SIGNAL'' but the implied behavour is different.
+Overlaps with ``handle SIGNAL'' but the implied behavior is different.
 You can attach commands to a catch but not a handle.  A handle has a
 limited number of hardwired actions.
 
@@ -425,11 +657,29 @@
 
 --
 
+Change the (char *list[]) to (const char (*)[]) so that dynamic lists can
+be passed.
+
+--
+
+When tab expanding something like ``set arch<tab>'' ignore the
+deprecated ``set archdebug'' and expand to ``set architecture''.
+
+--
+
 Replace the code that uses the host FPU with an emulator of the target
 FPU.
 
 --
 
+The "ocd reset" command needs to flush the dcache, which requires breaking
+the abstraction layer between the target independent and target code.  One
+way to address this is provide a generic "reset" command and target vector.
+
+http://sources.redhat.com/ml/gdb-patches/2000-10/msg00011.html
+
+--
+
 			Thread Support
 			==============
 
@@ -502,41 +752,6 @@
 
 --
 
-Pascal (Pierre Muller, David Taylor)
-
-Pierre Muller has contributed patches for adding Pascal Language
-support to GDB.
-
-2 pascal language patches inserted in database
-http://sourceware.cygnus.com/ml/gdb/2000-q1/msg00521.html
-
-Indent -gnu ?
-http://sourceware.cygnus.com/ml/gdb/2000-q1/msg00496.html
-
---
-
-Java (Anthony Green, David Taylor)
-
-Anthony Green has a number of Java patches that did not make it into
-the 5.0 release.
-
-Patch: java tests
-http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00512.html
-
-Patch: java booleans
-http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00515.html
-
-Patch: handle N_MAIN stab
-http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00527.html
-
---
-
-[Comming...]
-
-Modify gdb to work correctly with Pascal.
-
---
-
 Re: Various C++ things
 
 value_headof/value_from_vtable_info are worthless, and should be
@@ -569,13 +784,6 @@
 
 --
 
-set/show remote X-packet ...
-
-``(gdb) help set remote X-packet'' doesn't list the applicable
-responses.  The help message needs to be expanded.
-
---
-
 Remote protocol doco feedback.
 
 Too much feedback to mention needs to be merged in (901660).  Search
@@ -595,7 +803,7 @@
 fixing this this is making GDB's remote protocol packet more robust.
 
 While downloading to a remote protocol target, gdb ignores packet
-errors in so far as it will continue to edownload with chunk N+1 even
+errors in so far as it will continue to download with chunk N+1 even
 if chunk N was not correctly sent.  This causes gdb.base/remote.exp to
 take a painfully long time to run.  As a PS that test needs to be
 fixed so that it builds on 16 bit machines.
@@ -620,12 +828,16 @@
 
 --
 
+Rename read_register{,_pid}() to read_unsigned_register{,_pid}().
+
+--
+
 			Symbol Support
 			==============
 
 If / when GDB starts to support the debugging of multi-processor
 (rather than multi-thread) applications the symtab code will need to
-be updated a little so that several independant symbol tables are
+be updated a little so that several independent symbol tables are
 active at a given time.
 
 The other interesting change is a clarification of the exact meaning
@@ -657,6 +869,12 @@
 
 --
 
+GDB truncates 64 bit enums.
+
+http://sourceware.cygnus.com/ml/gdb-patches/2000-06/msg00290.html
+
+--
+
 			Testsuite Support
 			=================
 
@@ -715,7 +933,7 @@
 construct a virtual frame-handle from the stack pointer and various
 other bits of string.
 
-Unfortunatly GDB still treats this synthetic FP register as though it
+Unfortunately GDB still treats this synthetic FP register as though it
 is real.  That in turn really confuses users (arm and ``print $fp'' VS
 ``info registers fp'').  The synthetic FP should be separated out of
 the true register set presented to the user.
@@ -769,10 +987,10 @@
              |
         map random cache
         bytes to target
-        dependant i-face
+        dependent i-face
             /|\
              |
-       target dependant
+       target dependent
         such as [gG] packet
         or ptrace buffer
 
@@ -803,7 +1021,7 @@
 
         o       a mechanism that clearly separates the
                 gdb internal register cache from any
-                target (not architecture) dependant
+                target (not architecture) dependent
                 specifics such as [gG] packets.
 
 Of course, like anything, it sounds good in theory.  In reality, it
@@ -884,19 +1102,11 @@
 
 --
 
-Fix ``set architecture <tab>''
-
-This command should expand to a list of all supported architectures.
-At present ``info architecture'' needs to be used.  That is simply
-wrong.  It involves the use of add_set_enum_cmd().
-
---
-
 Fix target_signal_from_host() etc.
 
 The name is wrong for starters.  ``target_signal'' should probably be
 ``gdb_signal''.  ``from_host'' should be ``from_target_signal''.
-After that it needs to be multi-arched and made independant of any
+After that it needs to be multi-arched and made independent of any
 host signal numbering.
 
 --
@@ -934,6 +1144,12 @@
 
 --
 
+Make MIPS pure multi-arch.
+
+It is only at the multi-arch enabled stage.
+
+--
+
 Truly multi-arch.
 
 Enable the code to recognize --enable-targets=.... like BINUTILS does.
@@ -1037,7 +1253,7 @@
 
 --
 
-Make MI interface accessable from existing CLI.
+Make MI interface accessible from existing CLI.
 
 --
 
@@ -1088,6 +1304,36 @@
 
 --
 
+do_setshow_command contains a 1024 byte buffer.
+
+The function assumes that there will never be any more than 1024 bytes
+of enum.  It should use mem_file.
+
+--
+
+Should struct cmd_list_element . completer take the command as an
+argument?
+
+--
+
+Should the bulk of top.c:line_completion_function() be moved to
+command.[hc]?  complete_on_cmdlist() and complete_on_enums() could
+then be made private.
+
+--
+
+top.c (execute_command): Should a command being valid when the target
+is running be made an attribute (predicate) to the command rather than
+an explicit set of tests.
+
+--
+
+top.c (execute_command): Should the bulk of this function be moved
+into command.[hc] so that top.c doesn't grub around in the command
+internals?
+
+--
+
 		Architectural Change: Async
 		===========================
 
@@ -1122,7 +1368,7 @@
 open an asynchronous target that may need to perform background tasks
 as part of the ``attach'' phase.
 
-Unfortunatly, due to limitations in the old/creaking command.h
+Unfortunately, due to limitations in the old/creaking command.h
 interface, that isn't possible.  The function being called isn't told
 of the ``xxx'' or any other context information.
 
@@ -1132,6 +1378,9 @@
 for that command.  Other changes such as making ``struct command''
 opaque may also help.
 
+See also:
+http://sourceware.cygnus.com/ml/gdb-patches/2000-06/msg00062.html
+
 --
 
 Make "target xxx" command interruptible.
diff --git a/gdb/a29k-tdep.c b/gdb/a29k-tdep.c
index 5370106..4d307b7 100644
--- a/gdb/a29k-tdep.c
+++ b/gdb/a29k-tdep.c
@@ -46,9 +46,7 @@
 /* Should call_function allocate stack space for a struct return?  */
 /* On the a29k objects over 16 words require the caller to allocate space.  */
 int
-a29k_use_struct_convention (gcc_p, type)
-     int gcc_p;
-     struct type *type;
+a29k_use_struct_convention (int gcc_p, struct type *type)
 {
   return (TYPE_LENGTH (type) > 16 * 4);
 }
@@ -83,11 +81,7 @@
    frame pointer is being used.  */
 
 CORE_ADDR
-examine_prologue (pc, rsize, msize, mfp_used)
-     CORE_ADDR pc;
-     unsigned *msize;
-     unsigned *rsize;
-     int *mfp_used;
+examine_prologue (CORE_ADDR pc, unsigned *rsize, unsigned *msize, int *mfp_used)
 {
   long insn;
   CORE_ADDR p = pc;
@@ -338,8 +332,7 @@
    to reach some "real" code.  */
 
 CORE_ADDR
-a29k_skip_prologue (pc)
-     CORE_ADDR pc;
+a29k_skip_prologue (CORE_ADDR pc)
 {
   return examine_prologue (pc, NULL, NULL, NULL);
 }
@@ -355,12 +348,8 @@
  */
 
 static int			/* 0/1 - failure/success of finding the tag word  */
-examine_tag (p, is_trans, argcount, msize, mfp_used)
-     CORE_ADDR p;
-     int *is_trans;
-     int *argcount;
-     unsigned *msize;
-     int *mfp_used;
+examine_tag (CORE_ADDR p, int *is_trans, int *argcount, unsigned *msize,
+	     int *mfp_used)
 {
   unsigned int tag1, tag2;
 
@@ -398,9 +387,7 @@
    of stacks and the frame cache in tm-a29k.h for more detail.  */
 
 static void
-init_frame_info (innermost_frame, frame)
-     int innermost_frame;
-     struct frame_info *frame;
+init_frame_info (int innermost_frame, struct frame_info *frame)
 {
   CORE_ADDR p;
   long insn;
@@ -505,8 +492,7 @@
 }
 
 void
-init_extra_frame_info (frame)
-     struct frame_info *frame;
+init_extra_frame_info (struct frame_info *frame)
 {
   if (frame->next == 0)
     /* Assume innermost frame.  May produce strange results for "info frame"
@@ -521,9 +507,7 @@
 }
 
 void
-init_frame_pc (fromleaf, frame)
-     int fromleaf;
-     struct frame_info *frame;
+init_frame_pc (int fromleaf, struct frame_info *frame)
 {
   frame->pc = (fromleaf ? SAVED_PC_AFTER_CALL (frame->next) :
 	       frame->next ? FRAME_SAVED_PC (frame->next) : read_pc ());
@@ -535,8 +519,7 @@
    saved_msp (gcc).  */
 
 CORE_ADDR
-frame_locals_address (fi)
-     struct frame_info *fi;
+frame_locals_address (struct frame_info *fi)
 {
   if (fi->flags & MFP_USED)
     return fi->saved_msp;
@@ -556,11 +539,8 @@
    on where it came from.  The contents written into MYADDR are in
    target format.  */
 void
-read_register_stack (memaddr, myaddr, actual_mem_addr, lval)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     CORE_ADDR *actual_mem_addr;
-     enum lval_type *lval;
+read_register_stack (CORE_ADDR memaddr, char *myaddr,
+		     CORE_ADDR *actual_mem_addr, enum lval_type *lval)
 {
   long rfb = read_register (RFB_REGNUM);
   long rsp = read_register (RSP_REGNUM);
@@ -616,9 +596,7 @@
 /* Analogous to read_memory_integer
    except the length is understood to be 4.  */
 long
-read_register_stack_integer (memaddr, len)
-     CORE_ADDR memaddr;
-     int len;
+read_register_stack_integer (CORE_ADDR memaddr, int len)
 {
   char buf[4];
   read_register_stack (memaddr, buf, NULL, NULL);
@@ -629,10 +607,8 @@
    at MEMADDR and put the actual address written into in
    *ACTUAL_MEM_ADDR.  */
 static void
-write_register_stack (memaddr, myaddr, actual_mem_addr)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     CORE_ADDR *actual_mem_addr;
+write_register_stack (CORE_ADDR memaddr, char *myaddr,
+		      CORE_ADDR *actual_mem_addr)
 {
   long rfb = read_register (RFB_REGNUM);
   long rsp = read_register (RSP_REGNUM);
@@ -673,13 +649,9 @@
    The argument RAW_BUFFER must point to aligned memory.  */
 
 void
-a29k_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lvalp)
-     char *raw_buffer;
-     int *optimized;
-     CORE_ADDR *addrp;
-     struct frame_info *frame;
-     int regnum;
-     enum lval_type *lvalp;
+a29k_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
+			 struct frame_info *frame, int regnum,
+			 enum lval_type *lvalp)
 {
   struct frame_info *fi;
   CORE_ADDR addr;
@@ -762,7 +734,7 @@
    restoring all saved registers.  */
 
 void
-pop_frame ()
+pop_frame (void)
 {
   struct frame_info *frame = get_current_frame ();
   CORE_ADDR rfb = read_register (RFB_REGNUM);
@@ -825,7 +797,7 @@
 /* Push an empty stack frame, to record the current PC, etc.  */
 
 void
-push_dummy_frame ()
+push_dummy_frame (void)
 {
   long w;
   CORE_ADDR rab, gr1;
@@ -910,9 +882,7 @@
    good job.  */
 
 struct frame_info *
-setup_arbitrary_frame (argc, argv)
-     int argc;
-     CORE_ADDR *argv;
+setup_arbitrary_frame (int argc, CORE_ADDR *argv)
 {
   struct frame_info *frame;
 
@@ -939,9 +909,7 @@
 }
 
 int
-gdb_print_insn_a29k (memaddr, info)
-     bfd_vma memaddr;
-     disassemble_info *info;
+gdb_print_insn_a29k (bfd_vma memaddr, disassemble_info *info)
 {
   if (TARGET_BYTE_ORDER == BIG_ENDIAN)
     return print_insn_big_a29k (memaddr, info);
@@ -952,7 +920,7 @@
 enum a29k_processor_types processor_type = a29k_unknown;
 
 void
-a29k_get_processor_type ()
+a29k_get_processor_type (void)
 {
   unsigned int cfg_reg = (unsigned int) read_register (CFG_REGNUM);
 
@@ -1002,8 +970,7 @@
    This routine returns true on success */
 
 int
-get_longjmp_target (pc)
-     CORE_ADDR *pc;
+get_longjmp_target (CORE_ADDR *pc)
 {
   CORE_ADDR jb_addr;
   char buf[sizeof (CORE_ADDR)];
@@ -1020,7 +987,7 @@
 #endif /* GET_LONGJMP_TARGET */
 
 void
-_initialize_a29k_tdep ()
+_initialize_a29k_tdep (void)
 {
   extern CORE_ADDR text_end;
 
diff --git a/gdb/a68v-nat.c b/gdb/a68v-nat.c
index 3b4c271..7ad39a6 100644
--- a/gdb/a68v-nat.c
+++ b/gdb/a68v-nat.c
@@ -30,8 +30,7 @@
 extern int errno;
 
 void
-fetch_inferior_registers (ignored)
-     int ignored;
+fetch_inferior_registers (int ignored)
 {
   struct ptrace_$data_regs_m68k inferior_registers;
   struct ptrace_$floating_regs_m68k inferior_fp_registers;
@@ -72,8 +71,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   struct ptrace_$data_regs_m68k inferior_registers;
   struct ptrace_$floating_regs_m68k inferior_fp_registers;
diff --git a/gdb/abug-rom.c b/gdb/abug-rom.c
index 0ade234..68f48a2 100644
--- a/gdb/abug-rom.c
+++ b/gdb/abug-rom.c
@@ -31,11 +31,7 @@
 static void abug_open (char *args, int from_tty);
 
 static void
-abug_supply_register (regname, regnamelen, val, vallen)
-     char *regname;
-     int regnamelen;
-     char *val;
-     int vallen;
+abug_supply_register (char *regname, int regnamelen, char *val, int vallen)
 {
   int regno;
 
@@ -148,15 +144,13 @@
 };
 
 static void
-abug_open (args, from_tty)
-     char *args;
-     int from_tty;
+abug_open (char *args, int from_tty)
 {
   monitor_open (args, &abug_cmds, from_tty);
 }
 
 void
-_initialize_abug_rom ()
+_initialize_abug_rom (void)
 {
   init_abug_cmds ();
   init_monitor_ops (&abug_ops);
diff --git a/gdb/acconfig.h b/gdb/acconfig.h
index 74c3b6f..ba09e81 100644
--- a/gdb/acconfig.h
+++ b/gdb/acconfig.h
@@ -31,6 +31,15 @@
 /* Define if <sys/procfs.h> has psaddr_t. */
 #undef HAVE_PSADDR_T
 
+/* Define if <sys/procfs.h> has prgregset32_t. */
+#undef HAVE_PRGREGSET32_T
+
+/* Define if <sys/procfs.h> has prfpregset32_t. */
+#undef HAVE_PRFPREGSET32_T
+
+/* Define if <sys/link.h> has struct link_map32 */
+#undef HAVE_STRUCT_LINK_MAP32
+
 /* Define if the prfpregset_t type is broken. */
 #undef PRFPREGSET_T_BROKEN
 
@@ -110,8 +119,26 @@
 /* Define if <sys/ptrace.h> defines the PTRACE_GETREGS request.  */
 #undef HAVE_PTRACE_GETREGS
 
-/* Define if <sys/ptrace.h> defines the PTRACE_GETXFPREGS request.  */
-#undef HAVE_PTRACE_GETXFPREGS
+/* Define if <sys/ptrace.h> defines the PTRACE_GETFPXREGS request.  */
+#undef HAVE_PTRACE_GETFPXREGS
 
 /* Define if gnu-regex.c included with GDB should be used. */
 #undef USE_INCLUDED_REGEX
+
+/* BFD's default architecture. */
+#undef DEFAULT_BFD_ARCH
+
+/* BFD's default target vector. */
+#undef DEFAULT_BFD_VEC
+
+/* Multi-arch enabled. */
+#undef GDB_MULTI_ARCH
+
+/* hostfile */
+#undef GDB_XM_FILE
+
+/* targetfile */
+#undef GDB_TM_FILE
+
+/* nativefile */
+#undef GDB_NM_FILE
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index d614f2a..a55e36f 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -859,3 +859,10 @@
     AC_SUBST(TIX_BUILD_LIB_SPEC)
 dnl    AC_SUBST(TIX_LIB_SPEC)
 ])
+
+dnl sinclude(../gettext.m4) already included by bfd/acinclude.m4
+dnl The lines below arrange for aclocal not to bring gettext.m4's
+dnl CY_GNU_GETTEXT into aclocal.m4.
+ifelse(yes,no,[
+AC_DEFUN([CY_GNU_GETTEXT],)
+])
diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
index de9e2d5..5bfb0a1 100644
--- a/gdb/aclocal.m4
+++ b/gdb/aclocal.m4
@@ -872,6 +872,13 @@
 dnl    AC_SUBST(TIX_LIB_SPEC)
 ])
 
+dnl sinclude(../gettext.m4) already included by bfd/acinclude.m4
+dnl The lines below arrange for aclocal not to bring gettext.m4's
+dnl CY_GNU_GETTEXT into aclocal.m4.
+ifelse(yes,no,[
+AC_DEFUN([CY_GNU_GETTEXT],)
+])
+
 # Add --enable-maintainer-mode option to configure.
 # From Jim Meyering
 
@@ -993,348 +1000,3 @@
 esac
 ])
 
-# 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, 1, [Define to 1 if NLS is requested])
-      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, 1,
-			[Define as 1 if you have gettext and don't want to use GNU 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, 1, [Define if you have the stpcpy function])
-   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, 1,
-		[Define if your locale.h file contains LC_MESSAGES.])
-    fi
-  fi])
-
diff --git a/gdb/alpha-nat.c b/gdb/alpha-nat.c
index 4bf33b3..eb12b0d 100644
--- a/gdb/alpha-nat.c
+++ b/gdb/alpha-nat.c
@@ -55,8 +55,7 @@
    This routine returns true on success. */
 
 int
-get_longjmp_target (pc)
-     CORE_ADDR *pc;
+get_longjmp_target (CORE_ADDR *pc)
 {
   CORE_ADDR jb_addr;
   char raw_buffer[MAX_REGISTER_RAW_SIZE];
@@ -85,11 +84,8 @@
  */
 
 static void
-fetch_osf_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR reg_addr;
+fetch_osf_core_registers (char *core_reg_sect, unsigned core_reg_size,
+			  int which, CORE_ADDR reg_addr)
 {
   register int regno;
   register int addr;
@@ -138,11 +134,8 @@
 }
 
 static void
-fetch_elf_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR reg_addr;
+fetch_elf_core_registers (char *core_reg_sect, unsigned core_reg_size,
+			  int which, CORE_ADDR reg_addr)
 {
   if (core_reg_size < 32 * 8)
     {
@@ -181,15 +174,13 @@
 /* Return the ptrace ``address'' of register REGNO. */
 
 CORE_ADDR
-register_addr (regno, blockend)
-     int regno;
-     CORE_ADDR blockend;
+register_addr (int regno, CORE_ADDR blockend)
 {
   return REGISTER_PTRACE_ADDR (regno);
 }
 
 int
-kernel_u_size ()
+kernel_u_size (void)
 {
   return (sizeof (struct user));
 }
@@ -205,8 +196,7 @@
  */
 
 void
-supply_gregset (gregsetp)
-     gregset_t *gregsetp;
+supply_gregset (gdb_gregset_t *gregsetp)
 {
   register int regi;
   register long *regp = ALPHA_REGSET_BASE (gregsetp);
@@ -224,9 +214,7 @@
 }
 
 void
-fill_gregset (gregsetp, regno)
-     gregset_t *gregsetp;
-     int regno;
+fill_gregset (gdb_gregset_t *gregsetp, int regno)
 {
   int regi;
   register long *regp = ALPHA_REGSET_BASE (gregsetp);
@@ -245,8 +233,7 @@
  */
 
 void
-supply_fpregset (fpregsetp)
-     fpregset_t *fpregsetp;
+supply_fpregset (gdb_fpregset_t *fpregsetp)
 {
   register int regi;
   register long *regp = ALPHA_REGSET_BASE (fpregsetp);
@@ -256,9 +243,7 @@
 }
 
 void
-fill_fpregset (fpregsetp, regno)
-     fpregset_t *fpregsetp;
-     int regno;
+fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
 {
   int regi;
   register long *regp = ALPHA_REGSET_BASE (fpregsetp);
@@ -298,7 +283,7 @@
 };
 
 void
-_initialize_core_alpha ()
+_initialize_core_alpha (void)
 {
   add_core_fns (&alpha_osf_core_fns);
   add_core_fns (&alpha_elf_core_fns);
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 465efac..571c3d6 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -29,6 +29,7 @@
 #include "symfile.h"
 #include "objfiles.h"
 #include "gdb_string.h"
+#include "linespec.h"
 
 /* FIXME: Some of this code should perhaps be merged with mips-tdep.c.  */
 
@@ -171,8 +172,7 @@
 long alpha_linux_sigtramp_offset (CORE_ADDR pc);
 #endif
 long
-alpha_linux_sigtramp_offset (pc)
-     CORE_ADDR pc;
+alpha_linux_sigtramp_offset (CORE_ADDR pc)
 {
   unsigned int i[3], w;
   long off;
@@ -215,9 +215,7 @@
 /* Under OSF/1, the __sigtramp routine is frameless and has a frame
    size of zero, but we are able to backtrace through it.  */
 CORE_ADDR
-alpha_osf_skip_sigtramp_frame (frame, pc)
-     struct frame_info *frame;
-     CORE_ADDR pc;
+alpha_osf_skip_sigtramp_frame (struct frame_info *frame, CORE_ADDR pc)
 {
   char *name;
   find_pc_partial_function (pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
@@ -233,8 +231,7 @@
    descriptor is added to the linked_proc_desc_table.  */
 
 static alpha_extra_func_info_t
-push_sigtramp_desc (low_addr)
-     CORE_ADDR low_addr;
+push_sigtramp_desc (CORE_ADDR low_addr)
 {
   struct linked_proc_info *link;
   alpha_extra_func_info_t proc_desc;
@@ -265,8 +262,7 @@
    NULL).  */
 
 void
-alpha_find_saved_regs (frame)
-     struct frame_info *frame;
+alpha_find_saved_regs (struct frame_info *frame)
 {
   int ireg;
   CORE_ADDR reg_position;
@@ -354,9 +350,7 @@
 }
 
 static CORE_ADDR
-read_next_frame_reg (fi, regno)
-     struct frame_info *fi;
-     int regno;
+read_next_frame_reg (struct frame_info *fi, int regno)
 {
   for (; fi; fi = fi->next)
     {
@@ -376,8 +370,7 @@
 }
 
 CORE_ADDR
-alpha_frame_saved_pc (frame)
-     struct frame_info *frame;
+alpha_frame_saved_pc (struct frame_info *frame)
 {
   alpha_extra_func_info_t proc_desc = frame->proc_desc;
   /* We have to get the saved pc from the sigcontext
@@ -391,8 +384,7 @@
 }
 
 CORE_ADDR
-alpha_saved_pc_after_call (frame)
-     struct frame_info *frame;
+alpha_saved_pc_after_call (struct frame_info *frame)
 {
   CORE_ADDR pc = frame->pc;
   CORE_ADDR tmp;
@@ -421,8 +413,7 @@
    $zero,($ra),1" on alpha. */
 
 static int
-alpha_about_to_return (pc)
-     CORE_ADDR pc;
+alpha_about_to_return (CORE_ADDR pc)
 {
   return read_memory_integer (pc, 4) == 0x6bfa8001;
 }
@@ -434,8 +425,7 @@
    lines.  */
 
 static CORE_ADDR
-heuristic_proc_start (pc)
-     CORE_ADDR pc;
+heuristic_proc_start (CORE_ADDR pc)
 {
   CORE_ADDR start_pc = pc;
   CORE_ADDR fence = start_pc - heuristic_fence_post;
@@ -488,9 +478,8 @@
 }
 
 static alpha_extra_func_info_t
-heuristic_proc_desc (start_pc, limit_pc, next_frame)
-     CORE_ADDR start_pc, limit_pc;
-     struct frame_info *next_frame;
+heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
+		     struct frame_info *next_frame)
 {
   CORE_ADDR sp = read_next_frame_reg (next_frame, SP_REGNUM);
   CORE_ADDR cur_pc;
@@ -612,9 +601,7 @@
    find the prologue, then return 0.  */
 
 static CORE_ADDR
-after_prologue (pc, proc_desc)
-     CORE_ADDR pc;
-     alpha_extra_func_info_t proc_desc;
+after_prologue (CORE_ADDR pc, alpha_extra_func_info_t proc_desc)
 {
   struct symtab_and_line sal;
   CORE_ADDR func_addr, func_end;
@@ -652,9 +639,7 @@
    are definitively *not* in a function prologue.  */
 
 static int
-alpha_in_prologue (pc, proc_desc)
-     CORE_ADDR pc;
-     alpha_extra_func_info_t proc_desc;
+alpha_in_prologue (CORE_ADDR pc, alpha_extra_func_info_t proc_desc)
 {
   CORE_ADDR after_prologue_pc;
 
@@ -668,9 +653,7 @@
 }
 
 static alpha_extra_func_info_t
-find_proc_desc (pc, next_frame)
-     CORE_ADDR pc;
-     struct frame_info *next_frame;
+find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame)
 {
   alpha_extra_func_info_t proc_desc;
   struct block *b;
@@ -792,8 +775,7 @@
 alpha_extra_func_info_t cached_proc_desc;
 
 CORE_ADDR
-alpha_frame_chain (frame)
-     struct frame_info *frame;
+alpha_frame_chain (struct frame_info *frame)
 {
   alpha_extra_func_info_t proc_desc;
   CORE_ADDR saved_pc = FRAME_SAVED_PC (frame);
@@ -827,8 +809,7 @@
 }
 
 void
-init_extra_frame_info (frame)
-     struct frame_info *frame;
+init_extra_frame_info (struct frame_info *frame)
 {
   /* Use proc_desc calculated in frame_chain */
   alpha_extra_func_info_t proc_desc =
@@ -900,9 +881,7 @@
    arguments without difficulty.  */
 
 struct frame_info *
-setup_arbitrary_frame (argc, argv)
-     int argc;
-     CORE_ADDR *argv;
+setup_arbitrary_frame (int argc, CORE_ADDR *argv)
 {
   if (argc != 2)
     error ("ALPHA frame specifications require two arguments: sp and pc");
@@ -921,12 +900,8 @@
    structure to be returned is passed as a hidden first argument.  */
 
 CORE_ADDR
-alpha_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     int struct_return;
-     CORE_ADDR struct_addr;
+alpha_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+		      int struct_return, CORE_ADDR struct_addr)
 {
   int i;
   int accumulate_size = struct_return ? 8 : 0;
@@ -1007,7 +982,7 @@
 }
 
 void
-alpha_push_dummy_frame ()
+alpha_push_dummy_frame (void)
 {
   int ireg;
   struct linked_proc_info *link;
@@ -1123,7 +1098,7 @@
 }
 
 void
-alpha_pop_frame ()
+alpha_pop_frame (void)
 {
   register int regnum;
   struct frame_info *frame = get_current_frame ();
@@ -1179,7 +1154,7 @@
       else
 	linked_proc_desc_table = pi_ptr->next;
 
-      free (pi_ptr);
+      xfree (pi_ptr);
     }
 }
 
@@ -1189,13 +1164,11 @@
    LENIENT, then we must skip everything which is involved in setting
    up the frame (it's OK to skip more, just so long as we don't skip
    anything which might clobber the registers which are being saved.
-   Currently we must not skip more on the alpha, but we might the lenient
-   stuff some day.  */
+   Currently we must not skip more on the alpha, but we might need the
+   lenient stuff some day.  */
 
 CORE_ADDR
-alpha_skip_prologue (pc, lenient)
-     CORE_ADDR pc;
-     int lenient;
+alpha_skip_prologue (CORE_ADDR pc, int lenient)
 {
   unsigned long inst;
   int offset;
@@ -1272,9 +1245,7 @@
    STARTADDR?  */
 
 static int
-alpha_in_lenient_prologue (startaddr, pc)
-     CORE_ADDR startaddr;
-     CORE_ADDR pc;
+alpha_in_lenient_prologue (CORE_ADDR startaddr, CORE_ADDR pc)
 {
   CORE_ADDR end_prologue = alpha_skip_prologue (startaddr, 1);
   return pc >= startaddr && pc < end_prologue;
@@ -1288,11 +1259,8 @@
    memory format is an integer with 4 bytes or less, as the representation
    of integers in floating point registers is different. */
 void
-alpha_register_convert_to_virtual (regnum, valtype, raw_buffer, virtual_buffer)
-     int regnum;
-     struct type *valtype;
-     char *raw_buffer;
-     char *virtual_buffer;
+alpha_register_convert_to_virtual (int regnum, struct type *valtype,
+				   char *raw_buffer, char *virtual_buffer)
 {
   if (TYPE_LENGTH (valtype) >= REGISTER_RAW_SIZE (regnum))
     {
@@ -1317,11 +1285,8 @@
 }
 
 void
-alpha_register_convert_to_raw (valtype, regnum, virtual_buffer, raw_buffer)
-     struct type *valtype;
-     int regnum;
-     char *virtual_buffer;
-     char *raw_buffer;
+alpha_register_convert_to_raw (struct type *valtype, int regnum,
+			       char *virtual_buffer, char *raw_buffer)
 {
   if (TYPE_LENGTH (valtype) >= REGISTER_RAW_SIZE (regnum))
     {
@@ -1352,10 +1317,8 @@
    extract and copy its value into `valbuf'.  */
 
 void
-alpha_extract_return_value (valtype, regbuf, valbuf)
-     struct type *valtype;
-     char regbuf[REGISTER_BYTES];
-     char *valbuf;
+alpha_extract_return_value (struct type *valtype,
+			    char regbuf[REGISTER_BYTES], char *valbuf)
 {
   if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
     alpha_register_convert_to_virtual (FP0_REGNUM, valtype,
@@ -1369,9 +1332,7 @@
    write its value into the appropriate register.  */
 
 void
-alpha_store_return_value (valtype, valbuf)
-     struct type *valtype;
-     char *valbuf;
+alpha_store_return_value (struct type *valtype, char *valbuf)
 {
   char raw_buffer[MAX_REGISTER_RAW_SIZE];
   int regnum = V0_REGNUM;
@@ -1393,10 +1354,7 @@
    callable as an sfunc.  */
 
 static void
-reinit_frame_cache_sfunc (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+reinit_frame_cache_sfunc (char *args, int from_tty, struct cmd_list_element *c)
 {
   reinit_frame_cache ();
 }
@@ -1407,7 +1365,7 @@
  */
 
 CORE_ADDR
-alpha_call_dummy_address ()
+alpha_call_dummy_address (void)
 {
   CORE_ADDR entry;
   struct minimal_symbol *sym;
@@ -1426,7 +1384,7 @@
 }
 
 void
-_initialize_alpha_tdep ()
+_initialize_alpha_tdep (void)
 {
   struct cmd_list_element *c;
 
diff --git a/gdb/altos-xdep.c b/gdb/altos-xdep.c
index bc7245a..2ccefac 100644
--- a/gdb/altos-xdep.c
+++ b/gdb/altos-xdep.c
@@ -59,7 +59,7 @@
 /* OBSOLETE      and mark data and stack spaces as empty.  *x/ */
 /* OBSOLETE  */
 /* OBSOLETE   if (corefile) */
-/* OBSOLETE     free (corefile); */
+/* OBSOLETE     xfree (corefile); */
 /* OBSOLETE   corefile = 0; */
 /* OBSOLETE  */
 /* OBSOLETE   if (corechan >= 0) */
@@ -76,7 +76,7 @@
 /* OBSOLETE   if (filename) */
 /* OBSOLETE     { */
 /* OBSOLETE       filename = tilde_expand (filename); */
-/* OBSOLETE       make_cleanup (free, filename); */
+/* OBSOLETE       make_cleanup (xfree, filename); */
 /* OBSOLETE        */
 /* OBSOLETE       if (have_inferior_p ()) */
 /* OBSOLETE     error ("To look at a core file, you must kill the program with \"kill\"."); */
diff --git a/gdb/annotate.c b/gdb/annotate.c
index ee26290..c5879e3 100644
--- a/gdb/annotate.c
+++ b/gdb/annotate.c
@@ -43,8 +43,7 @@
 static int ignore_count_changed = 0;
 
 static void
-print_value_flags (t)
-     struct type *t;
+print_value_flags (struct type *t)
 {
   if (can_dereference (t))
     printf_filtered ("*");
@@ -53,7 +52,7 @@
 }
 
 void
-breakpoints_changed ()
+breakpoints_changed (void)
 {
   if (annotation_level > 1)
     {
@@ -78,31 +77,28 @@
 }
 
 void
-annotate_breakpoint (num)
-     int num;
+annotate_breakpoint (int num)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032breakpoint %d\n", num);
 }
 
 void
-annotate_catchpoint (num)
-     int num;
+annotate_catchpoint (int num)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032catchpoint %d\n", num);
 }
 
 void
-annotate_watchpoint (num)
-     int num;
+annotate_watchpoint (int num)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032watchpoint %d\n", num);
 }
 
 void
-annotate_starting ()
+annotate_starting (void)
 {
 
   if (annotate_starting_hook)
@@ -117,7 +113,7 @@
 }
 
 void
-annotate_stopped ()
+annotate_stopped (void)
 {
   if (annotate_stopped_hook)
     annotate_stopped_hook ();
@@ -134,8 +130,7 @@
 }
 
 void
-annotate_exited (exitstatus)
-     int exitstatus;
+annotate_exited (int exitstatus)
 {
   if (annotate_exited_hook)
     annotate_exited_hook ();
@@ -147,7 +142,7 @@
 }
 
 void
-annotate_signalled ()
+annotate_signalled (void)
 {
   if (annotate_signalled_hook)
     annotate_signalled_hook ();
@@ -157,35 +152,35 @@
 }
 
 void
-annotate_signal_name ()
+annotate_signal_name (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032signal-name\n");
 }
 
 void
-annotate_signal_name_end ()
+annotate_signal_name_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032signal-name-end\n");
 }
 
 void
-annotate_signal_string ()
+annotate_signal_string (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032signal-string\n");
 }
 
 void
-annotate_signal_string_end ()
+annotate_signal_string_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032signal-string-end\n");
 }
 
 void
-annotate_signal ()
+annotate_signal (void)
 {
   if (annotate_signal_hook)
     annotate_signal_hook ();
@@ -195,43 +190,42 @@
 }
 
 void
-annotate_breakpoints_headers ()
+annotate_breakpoints_headers (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032breakpoints-headers\n");
 }
 
 void
-annotate_field (num)
-     int num;
+annotate_field (int num)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032field %d\n", num);
 }
 
 void
-annotate_breakpoints_table ()
+annotate_breakpoints_table (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032breakpoints-table\n");
 }
 
 void
-annotate_record ()
+annotate_record (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032record\n");
 }
 
 void
-annotate_breakpoints_table_end ()
+annotate_breakpoints_table_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032breakpoints-table-end\n");
 }
 
 void
-annotate_frames_invalid ()
+annotate_frames_invalid (void)
 {
   if (annotation_level > 1)
     {
@@ -241,8 +235,7 @@
 }
 
 void
-annotate_field_begin (type)
-     struct type *type;
+annotate_field_begin (struct type *type)
 {
   if (annotation_level > 1)
     {
@@ -253,51 +246,49 @@
 }
 
 void
-annotate_field_name_end ()
+annotate_field_name_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032field-name-end\n");
 }
 
 void
-annotate_field_value ()
+annotate_field_value (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032field-value\n");
 }
 
 void
-annotate_field_end ()
+annotate_field_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032field-end\n");
 }
 
 void
-annotate_quit ()
+annotate_quit (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032quit\n");
 }
 
 void
-annotate_error ()
+annotate_error (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032error\n");
 }
 
 void
-annotate_error_begin ()
+annotate_error_begin (void)
 {
   if (annotation_level > 1)
     fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n");
 }
 
 void
-annotate_value_history_begin (histindex, type)
-     int histindex;
-     struct type *type;
+annotate_value_history_begin (int histindex, struct type *type)
 {
   if (annotation_level > 1)
     {
@@ -308,8 +299,7 @@
 }
 
 void
-annotate_value_begin (type)
-     struct type *type;
+annotate_value_begin (struct type *type)
 {
   if (annotation_level > 1)
     {
@@ -320,92 +310,91 @@
 }
 
 void
-annotate_value_history_value ()
+annotate_value_history_value (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032value-history-value\n");
 }
 
 void
-annotate_value_history_end ()
+annotate_value_history_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032value-history-end\n");
 }
 
 void
-annotate_value_end ()
+annotate_value_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032value-end\n");
 }
 
 void
-annotate_display_begin ()
+annotate_display_begin (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032display-begin\n");
 }
 
 void
-annotate_display_number_end ()
+annotate_display_number_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032display-number-end\n");
 }
 
 void
-annotate_display_format ()
+annotate_display_format (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032display-format\n");
 }
 
 void
-annotate_display_expression ()
+annotate_display_expression (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032display-expression\n");
 }
 
 void
-annotate_display_expression_end ()
+annotate_display_expression_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032display-expression-end\n");
 }
 
 void
-annotate_display_value ()
+annotate_display_value (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032display-value\n");
 }
 
 void
-annotate_display_end ()
+annotate_display_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032display-end\n");
 }
 
 void
-annotate_arg_begin ()
+annotate_arg_begin (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032arg-begin\n");
 }
 
 void
-annotate_arg_name_end ()
+annotate_arg_name_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032arg-name-end\n");
 }
 
 void
-annotate_arg_value (type)
-     struct type *type;
+annotate_arg_value (struct type *type)
 {
   if (annotation_level > 1)
     {
@@ -416,19 +405,14 @@
 }
 
 void
-annotate_arg_end ()
+annotate_arg_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032arg-end\n");
 }
 
 void
-annotate_source (filename, line, character, mid, pc)
-     char *filename;
-     int line;
-     int character;
-     int mid;
-     CORE_ADDR pc;
+annotate_source (char *filename, int line, int character, int mid, CORE_ADDR pc)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032source ");
@@ -443,9 +427,7 @@
 }
 
 void
-annotate_frame_begin (level, pc)
-     int level;
-     CORE_ADDR pc;
+annotate_frame_begin (int level, CORE_ADDR pc)
 {
   if (annotation_level > 1)
     {
@@ -456,100 +438,98 @@
 }
 
 void
-annotate_function_call ()
+annotate_function_call (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032function-call\n");
 }
 
 void
-annotate_signal_handler_caller ()
+annotate_signal_handler_caller (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032signal-handler-caller\n");
 }
 
 void
-annotate_frame_address ()
+annotate_frame_address (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032frame-address\n");
 }
 
 void
-annotate_frame_address_end ()
+annotate_frame_address_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032frame-address-end\n");
 }
 
 void
-annotate_frame_function_name ()
+annotate_frame_function_name (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032frame-function-name\n");
 }
 
 void
-annotate_frame_args ()
+annotate_frame_args (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032frame-args\n");
 }
 
 void
-annotate_frame_source_begin ()
+annotate_frame_source_begin (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032frame-source-begin\n");
 }
 
 void
-annotate_frame_source_file ()
+annotate_frame_source_file (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032frame-source-file\n");
 }
 
 void
-annotate_frame_source_file_end ()
+annotate_frame_source_file_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032frame-source-file-end\n");
 }
 
 void
-annotate_frame_source_line ()
+annotate_frame_source_line (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032frame-source-line\n");
 }
 
 void
-annotate_frame_source_end ()
+annotate_frame_source_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032frame-source-end\n");
 }
 
 void
-annotate_frame_where ()
+annotate_frame_where (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032frame-where\n");
 }
 
 void
-annotate_frame_end ()
+annotate_frame_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032frame-end\n");
 }
 
 void
-annotate_array_section_begin (index, elttype)
-     int index;
-     struct type *elttype;
+annotate_array_section_begin (int index, struct type *elttype)
 {
   if (annotation_level > 1)
     {
@@ -560,43 +540,41 @@
 }
 
 void
-annotate_elt_rep (repcount)
-     unsigned int repcount;
+annotate_elt_rep (unsigned int repcount)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032elt-rep %u\n", repcount);
 }
 
 void
-annotate_elt_rep_end ()
+annotate_elt_rep_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032elt-rep-end\n");
 }
 
 void
-annotate_elt ()
+annotate_elt (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032elt\n");
 }
 
 void
-annotate_array_section_end ()
+annotate_array_section_end (void)
 {
   if (annotation_level > 1)
     printf_filtered ("\n\032\032array-section-end\n");
 }
 
 static void
-breakpoint_changed (b)
-     struct breakpoint *b;
+breakpoint_changed (struct breakpoint *b)
 {
   breakpoints_changed ();
 }
 
 void
-_initialize_annotate ()
+_initialize_annotate (void)
 {
   if (annotation_level > 1)
     {
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index 8b69770..fc20d8b 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -114,8 +114,7 @@
    : codestream_buf[codestream_off++])
 
 static unsigned int
-codestream_fill (peek_flag)
-     int peek_flag;
+codestream_fill (int peek_flag)
 {
   codestream_addr = codestream_next_addr;
   codestream_next_addr += CODESTREAM_BUFSIZ * sizeof (codestream_buf[0]);
@@ -142,8 +141,7 @@
 }
 
 static void
-codestream_seek (place)
-     CORE_ADDR place;
+codestream_seek (CORE_ADDR place)
 {
   codestream_next_addr = place / CODESTREAM_BUFSIZ;
   codestream_next_addr *= CODESTREAM_BUFSIZ;
@@ -156,9 +154,7 @@
 /* This function is currently unused but leave in for now.  */
 
 static void
-codestream_read (buf, count)
-     unsigned int *buf;
-     int count;
+codestream_read (unsigned int *buf, int count)
 {
   unsigned int *p;
   int i;
@@ -170,8 +166,7 @@
 /* Set up prologue scanning and return the first insn.  */
 
 static unsigned int
-setup_prologue_scan (pc)
-     CORE_ADDR pc;
+setup_prologue_scan (CORE_ADDR pc)
 {
   unsigned int insn;
 
@@ -189,8 +184,7 @@
  */
 
 static long
-arc_get_frame_setup (pc)
-     CORE_ADDR pc;
+arc_get_frame_setup (CORE_ADDR pc)
 {
   unsigned int insn;
   /* Size of frame or -1 if unrecognizable prologue.  */
@@ -277,9 +271,7 @@
    This allows a quicker answer.  */
 
 CORE_ADDR
-arc_skip_prologue (pc, frameless_p)
-     CORE_ADDR pc;
-     int frameless_p;
+arc_skip_prologue (CORE_ADDR pc, int frameless_p)
 {
   unsigned int insn;
   int i, frame_size;
@@ -310,8 +302,7 @@
    This is taken from frameless_look_for_prologue.  */
 
 CORE_ADDR
-arc_frame_saved_pc (frame)
-     struct frame_info *frame;
+arc_frame_saved_pc (struct frame_info *frame)
 {
   CORE_ADDR func_start;
   unsigned int insn;
@@ -357,9 +348,7 @@
  */
 
 void
-frame_find_saved_regs (fip, fsrp)
-     struct frame_info *fip;
-     struct frame_saved_regs *fsrp;
+frame_find_saved_regs (struct frame_info *fip, struct frame_saved_regs *fsrp)
 {
   long locals;
   unsigned int insn;
@@ -472,9 +461,7 @@
 /* ??? Need to verify all cases are properly handled.  */
 
 static insn_type
-get_insn_type (insn, pc, target)
-     unsigned long insn;
-     CORE_ADDR pc, *target;
+get_insn_type (unsigned long insn, CORE_ADDR pc, CORE_ADDR *target)
 {
   unsigned long limm;
 
@@ -535,9 +522,8 @@
    set up a simulated single-step, we undo our damage.  */
 
 void
-arc_software_single_step (ignore, insert_breakpoints_p)
-     enum target_signal ignore;	/* sig but we don't need it */
-     int insert_breakpoints_p;
+arc_software_single_step (enum target_signal ignore,	/* sig but we don't need it */
+			  int insert_breakpoints_p)
 {
   static CORE_ADDR next_pc, target;
   static int brktrg_p;
@@ -593,8 +579,7 @@
    This routine returns true on success. */
 
 int
-get_longjmp_target (pc)
-     CORE_ADDR *pc;
+get_longjmp_target (CORE_ADDR *pc)
 {
   char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
   CORE_ADDR sp, jb_addr;
@@ -621,9 +606,7 @@
 /* Disassemble one instruction.  */
 
 static int
-arc_print_insn (vma, info)
-     bfd_vma vma;
-     disassemble_info *info;
+arc_print_insn (bfd_vma vma, disassemble_info *info)
 {
   static int current_mach;
   static int current_endian;
@@ -670,9 +653,7 @@
 }
 
 static void
-arc_show_cpu_type_command (args, from_tty)
-     char *args;
-     int from_tty;
+arc_show_cpu_type_command (char *args, int from_tty)
 {
 }
 
@@ -680,8 +661,7 @@
    Result is a boolean indicating success.  */
 
 static int
-arc_set_cpu_type (str)
-     char *str;
+arc_set_cpu_type (char *str)
 {
   int i, j;
 
@@ -702,7 +682,7 @@
 }
 
 void
-_initialize_arc_tdep ()
+_initialize_arc_tdep (void)
 {
   struct cmd_list_element *c;
 
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index be2433d..7a80628 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -41,6 +41,8 @@
 #include "symfile.h"		/* for overlay functions */
 #endif
 
+#include "version.h"
+
 #include "floatformat.h"
 
 /* Convenience macro for allocting typesafe memory. */
@@ -149,17 +151,13 @@
 /* Helper functions for INNER_THAN */
 
 int
-core_addr_lessthan (lhs, rhs)
-     CORE_ADDR lhs;
-     CORE_ADDR rhs;
+core_addr_lessthan (CORE_ADDR lhs, CORE_ADDR rhs)
 {
   return (lhs < rhs);
 }
 
 int
-core_addr_greaterthan (lhs, rhs)
-     CORE_ADDR lhs;
-     CORE_ADDR rhs;
+core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs)
 {
   return (lhs > rhs);
 }
@@ -206,11 +204,514 @@
     }
 }
 
-/* */
+/* Misc helper functions for targets. */
 
-extern initialize_file_ftype __initialize_gdbarch_utils;
+int
+frame_num_args_unknown (struct frame_info *fi)
+{
+  return -1;
+}
+
+
+int
+generic_register_convertible_not (int num)
+{
+  return 0;
+}
+  
+
+int
+default_register_sim_regno (int num)
+{
+  return num;
+}
+
+
+CORE_ADDR
+default_convert_from_func_ptr_addr (CORE_ADDR addr)
+{
+  return addr;
+}
+
+int
+no_op_reg_to_regnum (int reg)
+{
+  return reg;
+}
+
+/* Functions to manipulate the endianness of the target.  */
+
+#ifdef TARGET_BYTE_ORDER_SELECTABLE
+/* compat - Catch old targets that expect a selectable byte-order to
+   default to BIG_ENDIAN */
+#ifndef TARGET_BYTE_ORDER_DEFAULT
+#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN
+#endif
+#endif
+#if !TARGET_BYTE_ORDER_SELECTABLE_P
+#ifndef TARGET_BYTE_ORDER_DEFAULT
+/* compat - Catch old non byte-order selectable targets that do not
+   define TARGET_BYTE_ORDER_DEFAULT and instead expect
+   TARGET_BYTE_ORDER to be used as the default.  For targets that
+   defined neither TARGET_BYTE_ORDER nor TARGET_BYTE_ORDER_DEFAULT the
+   below will get a strange compiler warning. */
+#define TARGET_BYTE_ORDER_DEFAULT TARGET_BYTE_ORDER
+#endif
+#endif
+#ifndef TARGET_BYTE_ORDER_DEFAULT
+#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN /* arbitrary */
+#endif
+/* ``target_byte_order'' is only used when non- multi-arch.
+   Multi-arch targets obtain the current byte order using
+   TARGET_BYTE_ORDER which is controlled by gdbarch.*. */
+int target_byte_order = TARGET_BYTE_ORDER_DEFAULT;
+int target_byte_order_auto = 1;
+
+static const char endian_big[] = "big";
+static const char endian_little[] = "little";
+static const char endian_auto[] = "auto";
+static const char *endian_enum[] =
+{
+  endian_big,
+  endian_little,
+  endian_auto,
+  NULL,
+};
+static const char *set_endian_string;
+
+/* Called by ``show endian''.  */
+
+static void
+show_endian (char *args, int from_tty)
+{
+  if (TARGET_BYTE_ORDER_AUTO)
+    printf_unfiltered ("The target endianness is set automatically (currently %s endian)\n",
+		       (TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little"));
+  else
+    printf_unfiltered ("The target is assumed to be %s endian\n",
+		       (TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little"));
+}
+
+static void
+set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c)
+{
+  if (!TARGET_BYTE_ORDER_SELECTABLE_P)
+    {
+      printf_unfiltered ("Byte order is not selectable.");
+    }
+  else if (set_endian_string == endian_auto)
+    {
+      target_byte_order_auto = 1;
+    }
+  else if (set_endian_string == endian_little)
+    {
+      target_byte_order_auto = 0;
+      if (GDB_MULTI_ARCH)
+	{
+	  struct gdbarch_info info;
+	  memset (&info, 0, sizeof info);
+	  info.byte_order = LITTLE_ENDIAN;
+	  if (! gdbarch_update_p (info))
+	    {
+	      printf_unfiltered ("Little endian target not supported by GDB\n");
+	    }
+	}
+      else
+	{
+	  target_byte_order = LITTLE_ENDIAN;
+	}
+    }
+  else if (set_endian_string == endian_big)
+    {
+      target_byte_order_auto = 0;
+      if (GDB_MULTI_ARCH)
+	{
+	  struct gdbarch_info info;
+	  memset (&info, 0, sizeof info);
+	  info.byte_order = BIG_ENDIAN;
+	  if (! gdbarch_update_p (info))
+	    {
+	      printf_unfiltered ("Big endian target not supported by GDB\n");
+	    }
+	}
+      else
+	{
+	  target_byte_order = BIG_ENDIAN;
+	}
+    }
+  else
+    internal_error ("set_endian: bad value");
+  show_endian (NULL, from_tty);
+}
+
+/* Set the endianness from a BFD.  */
+
+static void
+set_endian_from_file (bfd *abfd)
+{
+  if (GDB_MULTI_ARCH)
+    internal_error ("set_endian_from_file: not for multi-arch");
+  if (TARGET_BYTE_ORDER_SELECTABLE_P)
+    {
+      int want;
+      
+      if (bfd_big_endian (abfd))
+	want = BIG_ENDIAN;
+      else
+	want = LITTLE_ENDIAN;
+      if (TARGET_BYTE_ORDER_AUTO)
+	target_byte_order = want;
+      else if (TARGET_BYTE_ORDER != want)
+	warning ("%s endian file does not match %s endian target.",
+		 want == BIG_ENDIAN ? "big" : "little",
+		 TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little");
+    }
+  else
+    {
+      if (bfd_big_endian (abfd)
+	  ? TARGET_BYTE_ORDER != BIG_ENDIAN
+	  : TARGET_BYTE_ORDER == BIG_ENDIAN)
+	warning ("%s endian file does not match %s endian target.",
+		 bfd_big_endian (abfd) ? "big" : "little",
+		 TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little");
+    }
+}
+
+
+/* Functions to manipulate the architecture of the target */
+
+enum set_arch { set_arch_auto, set_arch_manual };
+
+int target_architecture_auto = 1;
+
+const char *set_architecture_string;
+
+/* Old way of changing the current architecture. */
+
+extern const struct bfd_arch_info bfd_default_arch_struct;
+const struct bfd_arch_info *target_architecture = &bfd_default_arch_struct;
+int (*target_architecture_hook) (const struct bfd_arch_info *ap);
+
+static int
+arch_ok (const struct bfd_arch_info *arch)
+{
+  if (GDB_MULTI_ARCH)
+    internal_error ("arch_ok: not multi-arched");
+  /* Should be performing the more basic check that the binary is
+     compatible with GDB. */
+  /* Check with the target that the architecture is valid. */
+  return (target_architecture_hook == NULL
+	  || target_architecture_hook (arch));
+}
+
+static void
+set_arch (const struct bfd_arch_info *arch,
+          enum set_arch type)
+{
+  if (GDB_MULTI_ARCH)
+    internal_error ("set_arch: not multi-arched");
+  switch (type)
+    {
+    case set_arch_auto:
+      if (!arch_ok (arch))
+	warning ("Target may not support %s architecture",
+		 arch->printable_name);
+      target_architecture = arch;
+      break;
+    case set_arch_manual:
+      if (!arch_ok (arch))
+	{
+	  printf_unfiltered ("Target does not support `%s' architecture.\n",
+			     arch->printable_name);
+	}
+      else
+	{
+	  target_architecture_auto = 0;
+	  target_architecture = arch;
+	}
+      break;
+    }
+  if (gdbarch_debug)
+    gdbarch_dump (current_gdbarch, gdb_stdlog);
+}
+
+/* Set the architecture from arch/machine (deprecated) */
 
 void
-__initialize_gdbarch_utils (void)
+set_architecture_from_arch_mach (enum bfd_architecture arch,
+				 unsigned long mach)
 {
+  const struct bfd_arch_info *wanted = bfd_lookup_arch (arch, mach);
+  if (GDB_MULTI_ARCH)
+    internal_error ("set_architecture_from_arch_mach: not multi-arched");
+  if (wanted != NULL)
+    set_arch (wanted, set_arch_manual);
+  else
+    internal_error ("gdbarch: hardwired architecture/machine not recognized");
+}
+
+/* Set the architecture from a BFD (deprecated) */
+
+static void
+set_architecture_from_file (bfd *abfd)
+{
+  const struct bfd_arch_info *wanted = bfd_get_arch_info (abfd);
+  if (GDB_MULTI_ARCH)
+    internal_error ("set_architecture_from_file: not multi-arched");
+  if (target_architecture_auto)
+    {
+      set_arch (wanted, set_arch_auto);
+    }
+  else if (wanted != target_architecture)
+    {
+      warning ("%s architecture file may be incompatible with %s target.",
+	       wanted->printable_name,
+	       target_architecture->printable_name);
+    }
+}
+
+
+/* Called if the user enters ``show architecture'' without an
+   argument. */
+
+static void
+show_architecture (char *args, int from_tty)
+{
+  const char *arch;
+  arch = TARGET_ARCHITECTURE->printable_name;
+  if (target_architecture_auto)
+    printf_filtered ("The target architecture is set automatically (currently %s)\n", arch);
+  else
+    printf_filtered ("The target architecture is assumed to be %s\n", arch);
+}
+
+
+/* Called if the user enters ``set architecture'' with or without an
+   argument. */
+
+static void
+set_architecture (char *ignore_args, int from_tty, struct cmd_list_element *c)
+{
+  if (strcmp (set_architecture_string, "auto") == 0)
+    {
+      target_architecture_auto = 1;
+    }
+  else if (GDB_MULTI_ARCH)
+    {
+      struct gdbarch_info info;
+      memset (&info, 0, sizeof info);
+      info.bfd_arch_info = bfd_scan_arch (set_architecture_string);
+      if (info.bfd_arch_info == NULL)
+	internal_error ("set_architecture: bfd_scan_arch failed");
+      if (gdbarch_update_p (info))
+	target_architecture_auto = 0;
+      else
+	printf_unfiltered ("Architecture `%s' not recognized.\n",
+			   set_architecture_string);
+    }
+  else
+    {
+      const struct bfd_arch_info *arch
+	= bfd_scan_arch (set_architecture_string);
+      if (arch == NULL)
+	internal_error ("set_architecture: bfd_scan_arch failed");
+      set_arch (arch, set_arch_manual);
+    }
+  show_architecture (NULL, from_tty);
+}
+
+/* Called if the user enters ``info architecture'' without an argument. */
+
+static void
+info_architecture (char *args, int from_tty)
+{
+  printf_filtered ("Available architectures are:\n");
+  if (GDB_MULTI_ARCH)
+    {
+      const char **arches = gdbarch_printable_names ();
+      const char **arch;
+      for (arch = arches; *arch != NULL; arch++)
+	{
+	  printf_filtered (" %s", *arch);
+	}
+      xfree (arches);
+    }
+  else
+    {
+      enum bfd_architecture a;
+      for (a = bfd_arch_obscure + 1; a < bfd_arch_last; a++)
+	{
+	  const struct bfd_arch_info *ap;
+	  for (ap = bfd_lookup_arch (a, 0);
+	       ap != NULL;
+	       ap = ap->next)
+	    {
+	      printf_filtered (" %s", ap->printable_name);
+	      ap = ap->next;
+	    }
+	}
+    }
+  printf_filtered ("\n");
+}
+
+/* Set the dynamic target-system-dependent parameters (architecture,
+   byte-order) using information found in the BFD */
+
+void
+set_gdbarch_from_file (bfd *abfd)
+{
+  if (GDB_MULTI_ARCH)
+    {
+      struct gdbarch_info info;
+      memset (&info, 0, sizeof info);
+      info.abfd = abfd;
+      if (! gdbarch_update_p (info))
+	error ("Architecture of file not recognized.\n");
+    }
+  else
+    {
+      set_architecture_from_file (abfd);
+      set_endian_from_file (abfd);
+    }
+}
+
+/* Initialize the current architecture.  Update the ``set
+   architecture'' command so that it specifies a list of valid
+   architectures.  */
+
+#ifdef DEFAULT_BFD_ARCH
+extern const bfd_arch_info_type DEFAULT_BFD_ARCH;
+static const bfd_arch_info_type *default_bfd_arch = &DEFAULT_BFD_ARCH;
+#else
+static const bfd_arch_info_type *default_bfd_arch;
+#endif
+
+#ifdef DEFAULT_BFD_VEC
+extern const bfd_target DEFAULT_BFD_VEC;
+static const bfd_target *default_bfd_vec = &DEFAULT_BFD_VEC;
+#else
+static const bfd_target *default_bfd_vec;
+#endif
+
+void
+initialize_current_architecture (void)
+{
+  const char **arches = gdbarch_printable_names ();
+
+  /* determine a default architecture and byte order. */
+  struct gdbarch_info info;
+  memset (&info, 0, sizeof (info));
+  
+  /* Find a default architecture. */
+  if (info.bfd_arch_info == NULL
+      && default_bfd_arch != NULL)
+    info.bfd_arch_info = default_bfd_arch;
+  if (info.bfd_arch_info == NULL)
+    {
+      /* Choose the architecture by taking the first one
+	 alphabetically. */
+      const char *chosen = arches[0];
+      const char **arch;
+      for (arch = arches; *arch != NULL; arch++)
+	{
+	  if (strcmp (*arch, chosen) < 0)
+	    chosen = *arch;
+	}
+      if (chosen == NULL)
+	internal_error ("initialize_current_architecture: No arch");
+      info.bfd_arch_info = bfd_scan_arch (chosen);
+      if (info.bfd_arch_info == NULL)
+	internal_error ("initialize_current_architecture: Arch not found");
+    }
+
+  /* take several guesses at a byte order. */
+  /* NB: can't use TARGET_BYTE_ORDER_DEFAULT as its definition is
+     forced above. */
+  if (info.byte_order == 0
+      && default_bfd_vec != NULL)
+    {
+      /* Extract BFD's default vector's byte order. */
+      switch (default_bfd_vec->byteorder)
+	{
+	case BFD_ENDIAN_BIG:
+	  info.byte_order = BIG_ENDIAN;
+	  break;
+	case BFD_ENDIAN_LITTLE:
+	  info.byte_order = LITTLE_ENDIAN;
+	  break;
+	default:
+	  break;
+	}
+    }
+  if (info.byte_order == 0)
+    {
+      /* look for ``*el-*'' in the target name. */
+      const char *chp;
+      chp = strchr (target_name, '-');
+      if (chp != NULL
+	  && chp - 2 >= target_name
+	  && strncmp (chp - 2, "el", 2) == 0)
+	info.byte_order = LITTLE_ENDIAN;
+    }
+  if (info.byte_order == 0)
+    {
+      /* Wire it to big-endian!!! */
+      info.byte_order = BIG_ENDIAN;
+    }
+
+  if (GDB_MULTI_ARCH)
+    {
+      if (! gdbarch_update_p (info))
+	{
+	  internal_error ("initialize_current_architecture: Selection of initial architecture failed");
+	}
+    }
+
+  /* Create the ``set architecture'' command appending ``auto'' to the
+     list of architectures. */
+  {
+    struct cmd_list_element *c;
+    /* Append ``auto''. */
+    int nr;
+    for (nr = 0; arches[nr] != NULL; nr++);
+    arches = xrealloc (arches, sizeof (char*) * (nr + 2));
+    arches[nr + 0] = "auto";
+    arches[nr + 1] = NULL;
+    /* FIXME: add_set_enum_cmd() uses an array of ``char *'' instead
+       of ``const char *''.  We just happen to know that the casts are
+       safe. */
+    c = add_set_enum_cmd ("architecture", class_support,
+			  arches, &set_architecture_string,
+			  "Set architecture of target.",
+			  &setlist);
+    c->function.sfunc = set_architecture;
+    add_alias_cmd ("processor", "architecture", class_support, 1, &setlist);
+    /* Don't use set_from_show - need to print both auto/manual and
+       current setting. */
+    add_cmd ("architecture", class_support, show_architecture,
+	     "Show the current target architecture", &showlist);
+    c = add_cmd ("architecture", class_support, info_architecture,
+		 "List supported target architectures", &infolist);
+    deprecate_cmd (c, "set architecture");
+  }
+}
+
+
+/* */
+
+extern initialize_file_ftype _initialize_gdbarch_utils;
+
+void
+_initialize_gdbarch_utils (void)
+{
+  struct cmd_list_element *c;
+  c = add_set_enum_cmd ("endian", class_support,
+			endian_enum, &set_endian_string,
+			"Set endianness of target.",
+			&setlist);
+  c->function.sfunc = set_endian;
+  /* Don't use set_from_show - need to print both auto/manual and
+     current setting. */
+  add_cmd ("endian", class_support, show_endian,
+	   "Show the current byte-order", &showlist);
 }
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index a9ff6f5..523b58d 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -67,4 +67,38 @@
 extern const struct floatformat *default_float_format (struct gdbarch *gdbarch);
 extern const struct floatformat *default_double_format (struct gdbarch *gdbarch);
 
+/* Helper function for targets that don't know how my arguments are
+   being passed */
+extern int frame_num_args_unknown (struct frame_info *fi);
+
+
+/* The following DEPRECATED interfaces are for pre- multi-arch legacy
+   targets. */
+
+/* DEPRECATED pre- multi-arch interface.  Explicitly set the dynamic
+   target-system-dependent parameters based on bfd_architecture and
+   machine.  This function is deprecated, use
+   set_gdbarch_from_arch_machine(). */
+
+extern void set_architecture_from_arch_mach (enum bfd_architecture, unsigned long);
+
+/* DEPRECATED pre- multi-arch interface.  Notify the target dependent
+   backend of a change to the selected architecture. A zero return
+   status indicates that the target did not like the change. */
+
+extern int (*target_architecture_hook) (const struct bfd_arch_info *);
+
+
+/* Default raw->sim register re-numbering - does nothing. */
+
+extern int default_register_sim_regno (int reg_nr);
+
+/* Default conversion of function pointer address - returns address.  */
+
+extern CORE_ADDR default_convert_from_func_ptr_addr (CORE_ADDR addr);
+
+/* No-op conversion of reg to regnum. */
+
+extern int no_op_reg_to_regnum (int reg);
+
 #endif
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index cbe8c18..f50f712 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -23,6 +23,8 @@
 #include "value.h"
 #include "gdbtypes.h"
 #include "floatformat.h"
+#include "gdbcore.h"
+#include "frame.h"
 
 /* For arm_linux_skip_solib_resolver.  */
 #include "symtab.h"
@@ -425,14 +427,94 @@
 
   /* Plug in functions for other kinds of resolvers here.  */
   result = skip_hurd_resolver (pc);
-  printf ("Result = 0x%08x\n");
+
   if (result)
     return result;
-
   
   return 0;
 }
 
+/* The constants below were determined by examining the following files
+   in the linux kernel sources:
+
+      arch/arm/kernel/signal.c
+	  - see SWI_SYS_SIGRETURN and SWI_SYS_RT_SIGRETURN
+      include/asm-arm/unistd.h
+	  - see __NR_sigreturn, __NR_rt_sigreturn, and __NR_SYSCALL_BASE */
+
+#define ARM_LINUX_SIGRETURN_INSTR	0xef900077
+#define ARM_LINUX_RT_SIGRETURN_INSTR	0xef9000ad
+
+/* arm_linux_in_sigtramp determines if PC points at one of the
+   instructions which cause control to return to the Linux kernel upon
+   return from a signal handler.  FUNC_NAME is unused.  */
+
+int
+arm_linux_in_sigtramp (CORE_ADDR pc, char *func_name)
+{
+  unsigned long inst;
+
+  inst = read_memory_integer (pc, 4);
+
+  return (inst == ARM_LINUX_SIGRETURN_INSTR
+	  || inst == ARM_LINUX_RT_SIGRETURN_INSTR);
+
+}
+
+/* arm_linux_sigcontext_register_address returns the address in the
+   sigcontext of register REGNO given a stack pointer value SP and
+   program counter value PC.  The value 0 is returned if PC is not
+   pointing at one of the signal return instructions or if REGNO is
+   not saved in the sigcontext struct.  */
+
+CORE_ADDR
+arm_linux_sigcontext_register_address (CORE_ADDR sp, CORE_ADDR pc, int regno)
+{
+  unsigned long inst;
+  CORE_ADDR reg_addr = 0;
+
+  inst = read_memory_integer (pc, 4);
+
+  if (inst == ARM_LINUX_SIGRETURN_INSTR || inst == ARM_LINUX_RT_SIGRETURN_INSTR)
+    {
+      CORE_ADDR sigcontext_addr;
+
+      /* The sigcontext structure is at different places for the two
+         signal return instructions.  For ARM_LINUX_SIGRETURN_INSTR,
+	 it starts at the SP value.  For ARM_LINUX_RT_SIGRETURN_INSTR,
+	 it is at SP+8.  For the latter instruction, it may also be
+	 the case that the address of this structure may be determined
+	 by reading the 4 bytes at SP, but I'm not convinced this is
+	 reliable.
+
+	 In any event, these magic constants (0 and 8) may be
+	 determined by examining struct sigframe and struct
+	 rt_sigframe in arch/arm/kernel/signal.c in the Linux kernel
+	 sources.  */
+
+      if (inst == ARM_LINUX_RT_SIGRETURN_INSTR)
+	sigcontext_addr = sp + 8;
+      else /* inst == ARM_LINUX_SIGRETURN_INSTR */
+        sigcontext_addr = sp + 0;
+
+      /* The layout of the sigcontext structure for ARM GNU/Linux is
+         in include/asm-arm/sigcontext.h in the Linux kernel sources.
+
+	 There are three 4-byte fields which precede the saved r0
+	 field.  (This accounts for the 12 in the code below.)  The
+	 sixteen registers (4 bytes per field) follow in order.  The
+	 PSR value follows the sixteen registers which accounts for
+	 the constant 19 below. */
+
+      if (0 <= regno && regno <= PC_REGNUM)
+	reg_addr = sigcontext_addr + 12 + (4 * regno);
+      else if (regno == PS_REGNUM)
+	reg_addr = sigcontext_addr + 19 * 4;
+    }
+
+  return reg_addr;
+}
+
 void
 _initialize_arm_linux_tdep (void)
 {
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 84a350a..00d63cc 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -30,6 +30,36 @@
 #include "dis-asm.h"		/* For register flavors. */
 #include <ctype.h>		/* for isupper () */
 
+/* Each OS has a different mechanism for accessing the various
+   registers stored in the sigcontext structure.
+
+   SIGCONTEXT_REGISTER_ADDRESS should be defined to the name (or
+   function pointer) which may be used to determine the addresses
+   of the various saved registers in the sigcontext structure.
+
+   For the ARM target, there are three parameters to this function. 
+   The first is the pc value of the frame under consideration, the
+   second the stack pointer of this frame, and the last is the
+   register number to fetch.  
+
+   If the tm.h file does not define this macro, then it's assumed that
+   no mechanism is needed and we define SIGCONTEXT_REGISTER_ADDRESS to
+   be 0. 
+   
+   When it comes time to multi-arching this code, see the identically
+   named machinery in ia64-tdep.c for an example of how it could be
+   done.  It should not be necessary to modify the code below where
+   this macro is used.  */
+
+#ifdef SIGCONTEXT_REGISTER_ADDRESS
+#ifndef SIGCONTEXT_REGISTER_ADDRESS_P
+#define SIGCONTEXT_REGISTER_ADDRESS_P() 1
+#endif
+#else
+#define SIGCONTEXT_REGISTER_ADDRESS(SP,PC,REG) 0
+#define SIGCONTEXT_REGISTER_ADDRESS_P() 0
+#endif
+
 extern void _initialize_arm_tdep (void);
 
 /* Number of different reg name sets (options). */
@@ -52,10 +82,10 @@
 char **arm_register_names = arm_register_name_strings;
 
 /* Valid register name flavors.  */
-static char **valid_flavors;
+static const char **valid_flavors;
 
 /* Disassembly flavor to use. Default to "std" register names. */
-static char *disassembly_flavor;
+static const char *disassembly_flavor;
 static int current_option;	/* Index to that option in the opcodes table. */
 
 /* This is used to keep the bfd arch_info in sync with the disassembly
@@ -226,7 +256,7 @@
    function.  */
 
 int
-arm_pc_is_thumb (bfd_vma memaddr)
+arm_pc_is_thumb (CORE_ADDR memaddr)
 {
   struct minimal_symbol *sym;
 
@@ -250,7 +280,7 @@
    dummy being called from a Thumb function.  */
 
 int
-arm_pc_is_thumb_dummy (bfd_vma memaddr)
+arm_pc_is_thumb_dummy (CORE_ADDR memaddr)
 {
   CORE_ADDR sp = read_sp ();
 
@@ -725,14 +755,42 @@
      the symbol table, peek in the stack frame to find the PC.  */
   if (find_pc_partial_function (fi->pc, NULL, &prologue_start, &prologue_end))
     {
-      /* Assume the prologue is everything between the first instruction
-         in the function and the first source line.  */
-      struct symtab_and_line sal = find_pc_line (prologue_start, 0);
+      /* One way to find the end of the prologue (which works well
+         for unoptimized code) is to do the following:
 
-      if (sal.line == 0)	/* no line info, use current PC */
-	prologue_end = fi->pc;
-      else if (sal.end < prologue_end)	/* next line begins after fn end */
-	prologue_end = sal.end;	/* (probably means no prologue)  */
+	    struct symtab_and_line sal = find_pc_line (prologue_start, 0);
+
+	    if (sal.line == 0)
+	      prologue_end = fi->pc;
+	    else if (sal.end < prologue_end)
+	      prologue_end = sal.end;
+
+	 This mechanism is very accurate so long as the optimizer
+	 doesn't move any instructions from the function body into the
+	 prologue.  If this happens, sal.end will be the last
+	 instruction in the first hunk of prologue code just before
+	 the first instruction that the scheduler has moved from
+	 the body to the prologue.
+
+	 In order to make sure that we scan all of the prologue
+	 instructions, we use a slightly less accurate mechanism which
+	 may scan more than necessary.  To help compensate for this
+	 lack of accuracy, the prologue scanning loop below contains
+	 several clauses which'll cause the loop to terminate early if
+	 an implausible prologue instruction is encountered.  
+	 
+	 The expression
+	 
+	      prologue_start + 64
+	    
+	 is a suitable endpoint since it accounts for the largest
+	 possible prologue plus up to five instructions inserted by
+	 the scheduler. */
+         
+      if (prologue_end > prologue_start + 64)
+	{
+	  prologue_end = prologue_start + 64;	/* See above. */
+	}
     }
   else
     {
@@ -740,10 +798,7 @@
          PC is the address of the stmfd + 8.  */
       prologue_start = ADDR_BITS_REMOVE (read_memory_integer (fi->frame, 4))
 	- 8;
-      prologue_end = prologue_start + 64;	/* This is all the insn's
-						   that could be in the prologue,
-						   plus room for 5 insn's inserted
-						   by the scheduler.  */
+      prologue_end = prologue_start + 64;	/* See above. */
     }
 
   /* Now search the prologue looking for instructions that set up the
@@ -833,6 +888,10 @@
 		  fi->fsr.regs[fp_start_reg++] = sp_offset;
 		}
 	    }
+	  else if ((insn & 0xf0000000) != 0xe0000000)
+	    break;	/* Condition not true, exit early */
+	  else if ((insn & 0xfe200000) == 0xe8200000) /* ldm? */
+	    break;	/* Don't scan past a block load */
 	  else
 	    /* The optimizer might shove anything into the prologue,
 	       so we just skip what we don't recognize. */
@@ -973,6 +1032,40 @@
     }
   else
 #endif
+
+  /* Determine whether or not we're in a sigtramp frame. 
+     Unfortunately, it isn't sufficient to test
+     fi->signal_handler_caller because this value is sometimes set
+     after invoking INIT_EXTRA_FRAME_INFO.  So we test *both*
+     fi->signal_handler_caller and IN_SIGTRAMP to determine if we need
+     to use the sigcontext addresses for the saved registers.
+
+     Note: If an ARM IN_SIGTRAMP method ever needs to compare against
+     the name of the function, the code below will have to be changed
+     to first fetch the name of the function and then pass this name
+     to IN_SIGTRAMP. */
+
+  if (SIGCONTEXT_REGISTER_ADDRESS_P () 
+      && (fi->signal_handler_caller || IN_SIGTRAMP (fi->pc, 0)))
+    {
+      CORE_ADDR sp;
+
+      if (!fi->next)
+	sp = read_sp();
+      else
+	sp = fi->next->frame - fi->next->frameoffset + fi->next->framesize;
+
+      for (reg = 0; reg < NUM_REGS; reg++)
+	fi->fsr.regs[reg] = SIGCONTEXT_REGISTER_ADDRESS (sp, fi->pc, reg);
+
+      /* FIXME: What about thumb mode? */
+      fi->framereg = SP_REGNUM;
+      fi->frame = read_memory_integer (fi->fsr.regs[fi->framereg], 4);
+      fi->framesize = 0;
+      fi->frameoffset = 0;
+
+    }
+  else
     {
       arm_scan_prologue (fi);
 
@@ -2037,7 +2130,9 @@
   struct ui_file *stb;
   long length;
   struct cmd_list_element *new_cmd;
-  const char *setname, *setdesc, **regnames;
+  const char *setname;
+  const char *setdesc;
+  const char **regnames;
   int numregs, i, j;
   static char *helptext;
 
@@ -2059,13 +2154,13 @@
   for (i = 0; i < num_flavor_options; i++)
     {
       numregs = get_arm_regnames (i, &setname, &setdesc, &regnames);
-      valid_flavors[i] = (char *) setname;
+      valid_flavors[i] = setname;
       fprintf_unfiltered (stb, "%s - %s\n", setname,
 			  setdesc);
       /* Copy the default names (if found) and synchronize disassembler. */
       if (!strcmp (setname, "std"))
 	{
-          disassembly_flavor = (char *) setname;
+          disassembly_flavor = setname;
           current_option = i;
 	  for (j = 0; j < numregs; j++)
             arm_register_names[j] = (char *) regnames[j];
diff --git a/gdb/arm-xdep.c b/gdb/arm-xdep.c
index 64ca900..b38d26c 100644
--- a/gdb/arm-xdep.c
+++ b/gdb/arm-xdep.c
@@ -172,7 +172,7 @@
 /* OBSOLETE      and mark data and stack spaces as empty.  *x/ */
 /* OBSOLETE  */
 /* OBSOLETE   if (corefile) */
-/* OBSOLETE     free (corefile); */
+/* OBSOLETE     xfree (corefile); */
 /* OBSOLETE   corefile = 0; */
 /* OBSOLETE  */
 /* OBSOLETE   if (corechan >= 0) */
@@ -189,7 +189,7 @@
 /* OBSOLETE   if (filename) */
 /* OBSOLETE     { */
 /* OBSOLETE       filename = tilde_expand (filename); */
-/* OBSOLETE       make_cleanup (free, filename); */
+/* OBSOLETE       make_cleanup (xfree, filename); */
 /* OBSOLETE  */
 /* OBSOLETE       if (have_inferior_p ()) */
 /* OBSOLETE 	error ("To look at a core file, you must kill the program with \"kill\"."); */
@@ -320,7 +320,7 @@
 /* OBSOLETE      Mark text segment as empty.  *x/ */
 /* OBSOLETE  */
 /* OBSOLETE   if (execfile) */
-/* OBSOLETE     free (execfile); */
+/* OBSOLETE     xfree (execfile); */
 /* OBSOLETE   execfile = 0; */
 /* OBSOLETE   data_start = 0; */
 /* OBSOLETE   data_end -= exec_data_start; */
@@ -343,7 +343,7 @@
 /* OBSOLETE   if (filename) */
 /* OBSOLETE     { */
 /* OBSOLETE       filename = tilde_expand (filename); */
-/* OBSOLETE       make_cleanup (free, filename); */
+/* OBSOLETE       make_cleanup (xfree, filename); */
 /* OBSOLETE  */
 /* OBSOLETE       execchan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0, */
 /* OBSOLETE 			&execfile); */
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index e0d6ce5..1635364 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -154,8 +154,7 @@
    proletariat?  */
 
 static struct value *
-const_var_ref (var)
-     struct symbol *var;
+const_var_ref (struct symbol *var)
 {
   struct type *type = SYMBOL_TYPE (var);
 
@@ -178,8 +177,7 @@
    advanced to the end of it.  If we return zero, *PC could be
    anywhere.  */
 static struct value *
-const_expr (pc)
-     union exp_element **pc;
+const_expr (union exp_element **pc)
 {
   enum exp_opcode op = (*pc)->opcode;
   struct value *v1;
@@ -220,8 +218,7 @@
 /* Like const_expr, but guarantee also that *PC is undisturbed if the
    expression is not constant.  */
 static struct value *
-maybe_const_expr (pc)
-     union exp_element **pc;
+maybe_const_expr (union exp_element **pc)
 {
   union exp_element *tentative_pc = *pc;
   struct value *v = const_expr (&tentative_pc);
@@ -307,9 +304,7 @@
    the value.  Useful on the left side of a comma, and at the end of
    an expression being used for tracing.  */
 static void
-gen_traced_pop (ax, value)
-     struct agent_expr *ax;
-     struct axs_value *value;
+gen_traced_pop (struct agent_expr *ax, struct axs_value *value)
 {
   if (trace_kludge)
     switch (value->kind)
@@ -354,9 +349,7 @@
 /* Assume that the lower bits of the top of the stack is a value of
    type TYPE, and the upper bits are zero.  Sign-extend if necessary.  */
 static void
-gen_sign_extend (ax, type)
-     struct agent_expr *ax;
-     struct type *type;
+gen_sign_extend (struct agent_expr *ax, struct type *type)
 {
   /* Do we need to sign-extend this?  */
   if (!TYPE_UNSIGNED (type))
@@ -368,9 +361,7 @@
    TYPE, and the upper bits are garbage.  Sign-extend or truncate as
    needed.  */
 static void
-gen_extend (ax, type)
-     struct agent_expr *ax;
-     struct type *type;
+gen_extend (struct agent_expr *ax, struct type *type)
 {
   int bits = type->length * TARGET_CHAR_BIT;
   /* I just had to.  */
@@ -382,9 +373,7 @@
    to TYPE"; generate code to fetch its value.  Note that TYPE is the
    target type, not the pointer type.  */
 static void
-gen_fetch (ax, type)
-     struct agent_expr *ax;
-     struct type *type;
+gen_fetch (struct agent_expr *ax, struct type *type)
 {
   if (trace_kludge)
     {
@@ -440,9 +429,7 @@
    right shift it by -DISTANCE bits if DISTANCE < 0.  This generates
    unsigned (logical) right shifts.  */
 static void
-gen_left_shift (ax, distance)
-     struct agent_expr *ax;
-     int distance;
+gen_left_shift (struct agent_expr *ax, int distance)
 {
   if (distance > 0)
     {
@@ -463,8 +450,7 @@
 /* Generate code to push the base address of the argument portion of
    the top stack frame.  */
 static void
-gen_frame_args_address (ax)
-     struct agent_expr *ax;
+gen_frame_args_address (struct agent_expr *ax)
 {
   long frame_reg, frame_offset;
 
@@ -477,8 +463,7 @@
 /* Generate code to push the base address of the locals portion of the
    top stack frame.  */
 static void
-gen_frame_locals_address (ax)
-     struct agent_expr *ax;
+gen_frame_locals_address (struct agent_expr *ax)
 {
   long frame_reg, frame_offset;
 
@@ -494,9 +479,7 @@
    programming in ML, it would be clearer why these are the same
    thing.  */
 static void
-gen_offset (ax, offset)
-     struct agent_expr *ax;
-     int offset;
+gen_offset (struct agent_expr *ax, int offset)
 {
   /* It would suffice to simply push the offset and add it, but this
      makes it easier to read positive and negative offsets in the
@@ -518,9 +501,7 @@
    address (stack frame, base register, etc.)  Generate code to add
    VAR's value to the top of the stack.  */
 static void
-gen_sym_offset (ax, var)
-     struct agent_expr *ax;
-     struct symbol *var;
+gen_sym_offset (struct agent_expr *ax, struct symbol *var)
 {
   gen_offset (ax, SYMBOL_VALUE (var));
 }
@@ -530,10 +511,7 @@
    symbol VAR.  Set VALUE to describe the result.  */
 
 static void
-gen_var_ref (ax, value, var)
-     struct agent_expr *ax;
-     struct axs_value *value;
-     struct symbol *var;
+gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
 {
   /* Dereference any typedefs. */
   value->type = check_typedef (SYMBOL_TYPE (var));
@@ -648,11 +626,8 @@
 /* Generating bytecode from GDB expressions: literals */
 
 static void
-gen_int_literal (ax, value, k, type)
-     struct agent_expr *ax;
-     struct axs_value *value;
-     LONGEST k;
-     struct type *type;
+gen_int_literal (struct agent_expr *ax, struct axs_value *value, LONGEST k,
+		 struct type *type)
 {
   ax_const_l (ax, k);
   value->kind = axs_rvalue;
@@ -667,9 +642,7 @@
    try to make an rvalue out of it.  Signal an error if we can't do
    that.  */
 static void
-require_rvalue (ax, value)
-     struct agent_expr *ax;
-     struct axs_value *value;
+require_rvalue (struct agent_expr *ax, struct axs_value *value)
 {
   switch (value->kind)
     {
@@ -714,9 +687,7 @@
    lvalue through unchanged, and let `+' raise an error.  */
 
 static void
-gen_usual_unary (ax, value)
-     struct agent_expr *ax;
-     struct axs_value *value;
+gen_usual_unary (struct agent_expr *ax, struct axs_value *value)
 {
   /* We don't have to generate any code for the usual integral
      conversions, since values are always represented as full-width on
@@ -763,8 +734,7 @@
 /* Return non-zero iff the type TYPE1 is considered "wider" than the
    type TYPE2, according to the rules described in gen_usual_arithmetic.  */
 static int
-type_wider_than (type1, type2)
-     struct type *type1, *type2;
+type_wider_than (struct type *type1, struct type *type2)
 {
   return (TYPE_LENGTH (type1) > TYPE_LENGTH (type2)
 	  || (TYPE_LENGTH (type1) == TYPE_LENGTH (type2)
@@ -775,8 +745,7 @@
 
 /* Return the "wider" of the two types TYPE1 and TYPE2.  */
 static struct type *
-max_type (type1, type2)
-     struct type *type1, *type2;
+max_type (struct type *type1, struct type *type2)
 {
   return type_wider_than (type1, type2) ? type1 : type2;
 }
@@ -784,9 +753,7 @@
 
 /* Generate code to convert a scalar value of type FROM to type TO.  */
 static void
-gen_conversion (ax, from, to)
-     struct agent_expr *ax;
-     struct type *from, *to;
+gen_conversion (struct agent_expr *ax, struct type *from, struct type *to)
 {
   /* Perhaps there is a more graceful way to state these rules.  */
 
@@ -816,8 +783,7 @@
 /* Return non-zero iff the type FROM will require any bytecodes to be
    emitted to be converted to the type TO.  */
 static int
-is_nontrivial_conversion (from, to)
-     struct type *from, *to;
+is_nontrivial_conversion (struct type *from, struct type *to)
 {
   struct agent_expr *ax = new_agent_expr (0);
   int nontrivial;
@@ -841,9 +807,8 @@
    and promotes each argument to that type.  *VALUE1 and *VALUE2
    describe the values as they are passed in, and as they are left.  */
 static void
-gen_usual_arithmetic (ax, value1, value2)
-     struct agent_expr *ax;
-     struct axs_value *value1, *value2;
+gen_usual_arithmetic (struct agent_expr *ax, struct axs_value *value1,
+		      struct axs_value *value2)
 {
   /* Do the usual binary conversions.  */
   if (TYPE_CODE (value1->type) == TYPE_CODE_INT
@@ -879,9 +844,7 @@
    the value on the top of the stack, as described by VALUE.  Assume
    the value has integral type.  */
 static void
-gen_integral_promotions (ax, value)
-     struct agent_expr *ax;
-     struct axs_value *value;
+gen_integral_promotions (struct agent_expr *ax, struct axs_value *value)
 {
   if (!type_wider_than (value->type, builtin_type_int))
     {
@@ -898,10 +861,7 @@
 
 /* Generate code for a cast to TYPE.  */
 static void
-gen_cast (ax, value, type)
-     struct agent_expr *ax;
-     struct axs_value *value;
-     struct type *type;
+gen_cast (struct agent_expr *ax, struct axs_value *value, struct type *type)
 {
   /* GCC does allow casts to yield lvalues, so this should be fixed
      before merging these changes into the trunk.  */
@@ -956,10 +916,7 @@
 /* Scale the integer on the top of the stack by the size of the target
    of the pointer type TYPE.  */
 static void
-gen_scale (ax, op, type)
-     struct agent_expr *ax;
-     enum agent_op op;
-     struct type *type;
+gen_scale (struct agent_expr *ax, enum agent_op op, struct type *type)
 {
   struct type *element = TYPE_TARGET_TYPE (type);
 
@@ -977,10 +934,8 @@
    they've undergone the usual binary conversions.  Used by both
    BINOP_ADD and BINOP_SUBSCRIPT.  NAME is used in error messages.  */
 static void
-gen_add (ax, value, value1, value2, name)
-     struct agent_expr *ax;
-     struct axs_value *value, *value1, *value2;
-     char *name;
+gen_add (struct agent_expr *ax, struct axs_value *value,
+	 struct axs_value *value1, struct axs_value *value2, char *name)
 {
   /* Is it INT+PTR?  */
   if (value1->type->code == TYPE_CODE_INT
@@ -1026,9 +981,8 @@
    value; we assume VALUE1 and VALUE2 describe the two operands, and
    that they've undergone the usual binary conversions.  */
 static void
-gen_sub (ax, value, value1, value2)
-     struct agent_expr *ax;
-     struct axs_value *value, *value1, *value2;
+gen_sub (struct agent_expr *ax, struct axs_value *value,
+	 struct axs_value *value1, struct axs_value *value2)
 {
   if (value1->type->code == TYPE_CODE_PTR)
     {
@@ -1080,12 +1034,9 @@
    result needs to be extended.  NAME is the English name of the
    operator, used in error messages */
 static void
-gen_binop (ax, value, value1, value2, op, op_unsigned, may_carry, name)
-     struct agent_expr *ax;
-     struct axs_value *value, *value1, *value2;
-     enum agent_op op, op_unsigned;
-     int may_carry;
-     char *name;
+gen_binop (struct agent_expr *ax, struct axs_value *value,
+	   struct axs_value *value1, struct axs_value *value2, enum agent_op op,
+	   enum agent_op op_unsigned, int may_carry, char *name)
 {
   /* We only handle INT op INT.  */
   if ((value1->type->code != TYPE_CODE_INT)
@@ -1102,9 +1053,7 @@
 
 
 static void
-gen_logical_not (ax, value)
-     struct agent_expr *ax;
-     struct axs_value *value;
+gen_logical_not (struct agent_expr *ax, struct axs_value *value)
 {
   if (TYPE_CODE (value->type) != TYPE_CODE_INT
       && TYPE_CODE (value->type) != TYPE_CODE_PTR)
@@ -1117,9 +1066,7 @@
 
 
 static void
-gen_complement (ax, value)
-     struct agent_expr *ax;
-     struct axs_value *value;
+gen_complement (struct agent_expr *ax, struct axs_value *value)
 {
   if (TYPE_CODE (value->type) != TYPE_CODE_INT)
     error ("Illegal type of operand to `~'.");
@@ -1136,9 +1083,7 @@
 
 /* Dereference the value on the top of the stack.  */
 static void
-gen_deref (ax, value)
-     struct agent_expr *ax;
-     struct axs_value *value;
+gen_deref (struct agent_expr *ax, struct axs_value *value)
 {
   /* The caller should check the type, because several operators use
      this, and we don't know what error message to generate.  */
@@ -1158,9 +1103,7 @@
 
 /* Produce the address of the lvalue on the top of the stack.  */
 static void
-gen_address_of (ax, value)
-     struct agent_expr *ax;
-     struct axs_value *value;
+gen_address_of (struct agent_expr *ax, struct axs_value *value)
 {
   /* Special case for taking the address of a function.  The ANSI
      standard describes this as a special case, too, so this
@@ -1192,9 +1135,7 @@
 /* Find the field in the structure type TYPE named NAME, and return
    its index in TYPE's field array.  */
 static int
-find_field (type, name)
-     struct type *type;
-     char *name;
+find_field (struct type *type, char *name)
 {
   int i;
 
@@ -1227,11 +1168,8 @@
    starting and one-past-ending *bit* numbers of the field within the
    structure.  */
 static void
-gen_bitfield_ref (ax, value, type, start, end)
-     struct agent_expr *ax;
-     struct axs_value *value;
-     struct type *type;
-     int start, end;
+gen_bitfield_ref (struct agent_expr *ax, struct axs_value *value,
+		  struct type *type, int start, int end)
 {
   /* Note that ops[i] fetches 8 << i bits.  */
   static enum agent_op ops[]
@@ -1390,12 +1328,8 @@
    the operator being compiled, and OPERAND_NAME is the kind of thing
    it operates on; we use them in error messages.  */
 static void
-gen_struct_ref (ax, value, field, operator_name, operand_name)
-     struct agent_expr *ax;
-     struct axs_value *value;
-     char *field;
-     char *operator_name;
-     char *operand_name;
+gen_struct_ref (struct agent_expr *ax, struct axs_value *value, char *field,
+		char *operator_name, char *operand_name)
 {
   struct type *type;
   int i;
@@ -1408,7 +1342,7 @@
       gen_usual_unary (ax, value);
       gen_deref (ax, value);
     }
-  type = value->type;
+  type = check_typedef (value->type);
 
   /* This must yield a structure or a union.  */
   if (TYPE_CODE (type) != TYPE_CODE_STRUCT
@@ -1450,10 +1384,8 @@
    stack slots, doing weird things with sizeof, etc.  So we require
    the right operand to be a constant expression.  */
 static void
-gen_repeat (pc, ax, value)
-     union exp_element **pc;
-     struct agent_expr *ax;
-     struct axs_value *value;
+gen_repeat (union exp_element **pc, struct agent_expr *ax,
+	    struct axs_value *value)
 {
   struct axs_value value1;
   /* We don't want to turn this into an rvalue, so no conversions
@@ -1495,10 +1427,8 @@
    *PC should point at the start of the operand expression; we advance it
    to the first instruction after the operand.  */
 static void
-gen_sizeof (pc, ax, value)
-     union exp_element **pc;
-     struct agent_expr *ax;
-     struct axs_value *value;
+gen_sizeof (union exp_element **pc, struct agent_expr *ax,
+	    struct axs_value *value)
 {
   /* We don't care about the value of the operand expression; we only
      care about its type.  However, in the current arrangement, the
@@ -1522,10 +1452,8 @@
 /* A gen_expr function written by a Gen-X'er guy.
    Append code for the subexpression of EXPR starting at *POS_P to AX.  */
 static void
-gen_expr (pc, ax, value)
-     union exp_element **pc;
-     struct agent_expr *ax;
-     struct axs_value *value;
+gen_expr (union exp_element **pc, struct agent_expr *ax,
+	  struct axs_value *value)
 {
   /* Used to hold the descriptions of operand expressions.  */
   struct axs_value value1, value2;
@@ -1770,9 +1698,7 @@
    which computes its value.  Return the agent expression, and set
    *VALUE to describe its type, and whether it's an lvalue or rvalue.  */
 struct agent_expr *
-expr_to_agent (expr, value)
-     struct expression *expr;
-     struct axs_value *value;
+expr_to_agent (struct expression *expr, struct axs_value *value)
 {
   struct cleanup *old_chain = 0;
   struct agent_expr *ax = new_agent_expr (0);
@@ -1799,8 +1725,7 @@
 
    Not sure this function is useful at all.  */
 struct agent_expr *
-expr_to_address_and_size (expr)
-     struct expression *expr;
+expr_to_address_and_size (struct expression *expr)
 {
   struct axs_value value;
   struct agent_expr *ax = expr_to_agent (expr, &value);
@@ -1825,9 +1750,7 @@
    caller can then use the ax_reqs function to discover which
    registers it relies upon.  */
 struct agent_expr *
-gen_trace_for_expr (scope, expr)
-     CORE_ADDR scope;
-     struct expression *expr;
+gen_trace_for_expr (CORE_ADDR scope, struct expression *expr)
 {
   struct cleanup *old_chain = 0;
   struct agent_expr *ax = new_agent_expr (scope);
@@ -1858,9 +1781,7 @@
 /* The "agent" command, for testing: compile and disassemble an expression.  */
 
 static void
-print_axs_value (f, value)
-     struct ui_file *f;
-     struct axs_value *value;
+print_axs_value (struct ui_file *f, struct axs_value *value)
 {
   switch (value->kind)
     {
@@ -1883,9 +1804,7 @@
 
 
 static void
-agent_command (exp, from_tty)
-     char *exp;
-     int from_tty;
+agent_command (char *exp, int from_tty)
 {
   struct cleanup *old_chain = 0;
   struct expression *expr;
@@ -1920,7 +1839,7 @@
 
 void _initialize_ax_gdb (void);
 void
-_initialize_ax_gdb ()
+_initialize_ax_gdb (void)
 {
   add_cmd ("agent", class_maintenance, agent_command,
 	   "Translate an expression into remote agent bytecode.",
diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index 0c851eb..60e9edf 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -40,8 +40,7 @@
 
 /* Allocate a new, empty agent expression.  */
 struct agent_expr *
-new_agent_expr (scope)
-     CORE_ADDR scope;
+new_agent_expr (CORE_ADDR scope)
 {
   struct agent_expr *x = xmalloc (sizeof (*x));
   x->len = 0;
@@ -55,11 +54,10 @@
 
 /* Free a agent expression.  */
 void
-free_agent_expr (x)
-     struct agent_expr *x;
+free_agent_expr (struct agent_expr *x)
 {
-  free (x->buf);
-  free (x);
+  xfree (x->buf);
+  xfree (x);
 }
 
 static void
@@ -78,9 +76,7 @@
 /* Make sure that X has room for at least N more bytes.  This doesn't
    affect the length, just the allocated size.  */
 static void
-grow_expr (x, n)
-     struct agent_expr *x;
-     int n;
+grow_expr (struct agent_expr *x, int n)
 {
   if (x->len + n > x->size)
     {
@@ -95,10 +91,7 @@
 /* Append the low N bytes of VAL as an N-byte integer to the
    expression X, in big-endian order.  */
 static void
-append_const (x, val, n)
-     struct agent_expr *x;
-     LONGEST val;
-     int n;
+append_const (struct agent_expr *x, LONGEST val, int n)
 {
   int i;
 
@@ -115,9 +108,7 @@
 /* Extract an N-byte big-endian unsigned integer from expression X at
    offset O.  */
 static LONGEST
-read_const (x, o, n)
-     struct agent_expr *x;
-     int o, n;
+read_const (struct agent_expr *x, int o, int n)
 {
   int i;
   LONGEST accum = 0;
@@ -135,9 +126,7 @@
 
 /* Append a simple operator OP to EXPR.  */
 void
-ax_simple (x, op)
-     struct agent_expr *x;
-     enum agent_op op;
+ax_simple (struct agent_expr *x, enum agent_op op)
 {
   grow_expr (x, 1);
   x->buf[x->len++] = op;
@@ -147,10 +136,7 @@
 /* Append a sign-extension or zero-extension instruction to EXPR, to
    extend an N-bit value.  */
 static void
-generic_ext (x, op, n)
-     struct agent_expr *x;
-     enum agent_op op;
-     int n;
+generic_ext (struct agent_expr *x, enum agent_op op, int n)
 {
   /* N must fit in a byte.  */
   if (n < 0 || n > 255)
@@ -167,9 +153,7 @@
 
 /* Append a sign-extension instruction to EXPR, to extend an N-bit value.  */
 void
-ax_ext (x, n)
-     struct agent_expr *x;
-     int n;
+ax_ext (struct agent_expr *x, int n)
 {
   generic_ext (x, aop_ext, n);
 }
@@ -177,9 +161,7 @@
 
 /* Append a zero-extension instruction to EXPR, to extend an N-bit value.  */
 void
-ax_zero_ext (x, n)
-     struct agent_expr *x;
-     int n;
+ax_zero_ext (struct agent_expr *x, int n)
 {
   generic_ext (x, aop_zero_ext, n);
 }
@@ -187,9 +169,7 @@
 
 /* Append a trace_quick instruction to EXPR, to record N bytes.  */
 void
-ax_trace_quick (x, n)
-     struct agent_expr *x;
-     int n;
+ax_trace_quick (struct agent_expr *x, int n)
 {
   /* N must fit in a byte.  */
   if (n < 0 || n > 255)
@@ -208,9 +188,7 @@
    can backpatch it once we do know the target offset.  Use ax_label
    to do the backpatching.  */
 int
-ax_goto (x, op)
-     struct agent_expr *x;
-     enum agent_op op;
+ax_goto (struct agent_expr *x, enum agent_op op)
 {
   grow_expr (x, 3);
   x->buf[x->len + 0] = op;
@@ -225,10 +203,7 @@
    ax_label (EXPR, PATCH, TARGET)
    to patch TARGET into the ax_goto instruction.  */
 void
-ax_label (x, patch, target)
-     struct agent_expr *x;
-     int patch;
-     int target;
+ax_label (struct agent_expr *x, int patch, int target)
 {
   /* Make sure the value is in range.  Don't accept 0xffff as an
      offset; that's our magic sentinel value for unpatched branches.  */
@@ -242,9 +217,7 @@
 
 /* Assemble code to push a constant on the stack.  */
 void
-ax_const_l (x, l)
-     struct agent_expr *x;
-     LONGEST l;
+ax_const_l (struct agent_expr *x, LONGEST l)
 {
   static enum agent_op ops[]
   =
@@ -274,9 +247,7 @@
 
 
 void
-ax_const_d (x, d)
-     struct agent_expr *x;
-     LONGEST d;
+ax_const_d (struct agent_expr *x, LONGEST d)
 {
   /* FIXME: floating-point support not present yet.  */
   error ("GDB bug: ax-general.c (ax_const_d): floating point not supported yet");
@@ -286,9 +257,7 @@
 /* Assemble code to push the value of register number REG on the
    stack.  */
 void
-ax_reg (x, reg)
-     struct agent_expr *x;
-     int reg;
+ax_reg (struct agent_expr *x, int reg)
 {
   /* Make sure the register number is in range.  */
   if (reg < 0 || reg > 0xffff)
@@ -361,9 +330,7 @@
 
 /* Disassemble the expression EXPR, writing to F.  */
 void
-ax_print (f, x)
-     struct ui_file *f;
-     struct agent_expr *x;
+ax_print (struct ui_file *f, struct agent_expr *x)
 {
   int i;
   int is_float = 0;
@@ -411,9 +378,7 @@
 /* Given an agent expression AX, fill in an agent_reqs structure REQS
    describing it.  */
 void
-ax_reqs (ax, reqs)
-     struct agent_expr *ax;
-     struct agent_reqs *reqs;
+ax_reqs (struct agent_expr *ax, struct agent_reqs *reqs)
 {
   int i;
   int height;
@@ -451,7 +416,7 @@
       if (ax->buf[i] > (sizeof (aop_map) / sizeof (aop_map[0])))
 	{
 	  reqs->flaw = agent_flaw_bad_instruction;
-	  free (reg_mask);
+	  xfree (reg_mask);
 	  return;
 	}
 
@@ -460,14 +425,14 @@
       if (!op->name)
 	{
 	  reqs->flaw = agent_flaw_bad_instruction;
-	  free (reg_mask);
+	  xfree (reg_mask);
 	  return;
 	}
 
       if (i + 1 + op->op_size > ax->len)
 	{
 	  reqs->flaw = agent_flaw_incomplete_instruction;
-	  free (reg_mask);
+	  xfree (reg_mask);
 	  return;
 	}
 
@@ -476,7 +441,7 @@
       if (targets[i] && (heights[i] != height))
 	{
 	  reqs->flaw = agent_flaw_height_mismatch;
-	  free (reg_mask);
+	  xfree (reg_mask);
 	  return;
 	}
 
@@ -503,7 +468,7 @@
 	  if (target < 0 || target >= ax->len)
 	    {
 	      reqs->flaw = agent_flaw_bad_jump;
-	      free (reg_mask);
+	      xfree (reg_mask);
 	      return;
 	    }
 	  /* Have we already found other jumps to the same location?  */
@@ -512,7 +477,7 @@
 	      if (heights[i] != height)
 		{
 		  reqs->flaw = agent_flaw_height_mismatch;
-		  free (reg_mask);
+		  xfree (reg_mask);
 		  return;
 		}
 	    }
@@ -531,7 +496,7 @@
 	  if (!targets[i + 3])
 	    {
 	      reqs->flaw = agent_flaw_hole;
-	      free (reg_mask);
+	      xfree (reg_mask);
 	      return;
 	    }
 
@@ -566,7 +531,7 @@
     if (targets[i] && !boundary[i])
       {
 	reqs->flaw = agent_flaw_bad_jump;
-	free (reg_mask);
+	xfree (reg_mask);
 	return;
       }
 
diff --git a/gdb/bcache.c b/gdb/bcache.c
index fcff55e..84e6424 100644
--- a/gdb/bcache.c
+++ b/gdb/bcache.c
@@ -111,7 +111,7 @@
 
   /* Plug in the new table.  */
   if (bcache->bucket)
-    free (bcache->bucket);
+    xfree (bcache->bucket);
   bcache->bucket = new_buckets;
   bcache->num_buckets = new_num_buckets;
 }
@@ -173,7 +173,7 @@
 {
   obstack_free (&bcache->cache, 0);
   if (bcache->bucket)
-    free (bcache->bucket);
+    xfree (bcache->bucket);
 
   /* This isn't necessary, but at least the bcache is always in a
      consistent state.  */
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index ccc80db..8e5bc21 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -41,9 +41,7 @@
    frame is the outermost one and has no caller. */
 
 int
-file_frame_chain_valid (chain, thisframe)
-     CORE_ADDR chain;
-     struct frame_info *thisframe;
+file_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
 {
   return ((chain) != 0
 	  && !inside_entry_file (FRAME_SAVED_PC (thisframe)));
@@ -54,9 +52,7 @@
    the comments in objfiles.h. */
 
 int
-func_frame_chain_valid (chain, thisframe)
-     CORE_ADDR chain;
-     struct frame_info *thisframe;
+func_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
 {
   return ((chain) != 0
 	  && !inside_main_func ((thisframe)->pc)
@@ -66,9 +62,7 @@
 /* A very simple method of determining a valid frame */
 
 int
-nonnull_frame_chain_valid (chain, thisframe)
-     CORE_ADDR chain;
-     struct frame_info *thisframe;
+nonnull_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
 {
   return ((chain) != 0);
 }
@@ -82,8 +76,7 @@
    A PC of zero is always considered to be the bottom of the stack. */
 
 int
-inside_entry_file (addr)
-     CORE_ADDR addr;
+inside_entry_file (CORE_ADDR addr)
 {
   if (addr == 0)
     return 1;
@@ -110,8 +103,7 @@
    A PC of zero is always considered to be the bottom of the stack. */
 
 int
-inside_main_func (pc)
-     CORE_ADDR pc;
+inside_main_func (CORE_ADDR pc)
 {
   if (pc == 0)
     return 1;
@@ -149,8 +141,7 @@
    A PC of zero is always considered to be the bottom of the stack. */
 
 int
-inside_entry_func (pc)
-     CORE_ADDR pc;
+inside_entry_func (CORE_ADDR pc)
 {
   if (pc == 0)
     return 1;
@@ -179,15 +170,13 @@
 static struct obstack frame_cache_obstack;
 
 void *
-frame_obstack_alloc (size)
-     unsigned long size;
+frame_obstack_alloc (unsigned long size)
 {
   return obstack_alloc (&frame_cache_obstack, size);
 }
 
 void
-frame_saved_regs_zalloc (fi)
-     struct frame_info *fi;
+frame_saved_regs_zalloc (struct frame_info *fi)
 {
   fi->saved_regs = (CORE_ADDR *)
     frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS);
@@ -198,7 +187,7 @@
 /* Return the innermost (currently executing) stack frame.  */
 
 struct frame_info *
-get_current_frame ()
+get_current_frame (void)
 {
   if (current_frame == NULL)
     {
@@ -211,8 +200,7 @@
 }
 
 void
-set_current_frame (frame)
-     struct frame_info *frame;
+set_current_frame (struct frame_info *frame)
 {
   current_frame = frame;
 }
@@ -221,9 +209,7 @@
    Always returns a non-NULL value.  */
 
 struct frame_info *
-create_new_frame (addr, pc)
-     CORE_ADDR addr;
-     CORE_ADDR pc;
+create_new_frame (CORE_ADDR addr, CORE_ADDR pc)
 {
   struct frame_info *fi;
   char *name;
@@ -252,8 +238,7 @@
    frame).  */
 
 struct frame_info *
-get_next_frame (frame)
-     struct frame_info *frame;
+get_next_frame (struct frame_info *frame)
 {
   return frame->next;
 }
@@ -261,7 +246,7 @@
 /* Flush the entire frame cache.  */
 
 void
-flush_cached_frames ()
+flush_cached_frames (void)
 {
   /* Since we can't really be sure what the first object allocated was */
   obstack_free (&frame_cache_obstack, 0);
@@ -275,7 +260,7 @@
 /* Flush the frame cache, and start a new one if necessary.  */
 
 void
-reinit_frame_cache ()
+reinit_frame_cache (void)
 {
   flush_cached_frames ();
 
@@ -291,8 +276,7 @@
    function.  */
 
 int
-frameless_look_for_prologue (frame)
-     struct frame_info *frame;
+frameless_look_for_prologue (struct frame_info *frame)
 {
   CORE_ADDR func_start, after_prologue;
 
@@ -335,8 +319,7 @@
    if there is no such frame.  */
 
 struct frame_info *
-get_prev_frame (next_frame)
-     struct frame_info *next_frame;
+get_prev_frame (struct frame_info *next_frame)
 {
   CORE_ADDR address = 0;
   struct frame_info *prev;
@@ -410,13 +393,13 @@
     obstack_alloc (&frame_cache_obstack,
 		   sizeof (struct frame_info));
 
-  prev->saved_regs = NULL;
+  /* Zero all fields by default.  */
+  memset (prev, 0, sizeof (struct frame_info));
+
   if (next_frame)
     next_frame->prev = prev;
   prev->next = next_frame;
-  prev->prev = (struct frame_info *) 0;
   prev->frame = address;
-  prev->signal_handler_caller = 0;
 
 /* This change should not be needed, FIXME!  We should
    determine whether any targets *need* INIT_FRAME_PC to happen
@@ -496,8 +479,7 @@
 }
 
 CORE_ADDR
-get_frame_pc (frame)
-     struct frame_info *frame;
+get_frame_pc (struct frame_info *frame)
 {
   return frame->pc;
 }
@@ -509,9 +491,8 @@
 /* Find the addresses in which registers are saved in FRAME.  */
 
 void
-get_frame_saved_regs (frame, saved_regs_addr)
-     struct frame_info *frame;
-     struct frame_saved_regs *saved_regs_addr;
+get_frame_saved_regs (struct frame_info *frame,
+		      struct frame_saved_regs *saved_regs_addr)
 {
   if (frame->saved_regs == NULL)
     {
@@ -536,8 +517,7 @@
    in a specified stack frame.  The frame address is assumed valid.  */
 
 struct block *
-get_frame_block (frame)
-     struct frame_info *frame;
+get_frame_block (struct frame_info *frame)
 {
   CORE_ADDR pc;
 
@@ -554,14 +534,13 @@
 }
 
 struct block *
-get_current_block ()
+get_current_block (void)
 {
   return block_for_pc (read_pc ());
 }
 
 CORE_ADDR
-get_pc_function_start (pc)
-     CORE_ADDR pc;
+get_pc_function_start (CORE_ADDR pc)
 {
   register struct block *bl;
   register struct symbol *symbol;
@@ -588,8 +567,7 @@
 /* Return the symbol for the function executing in frame FRAME.  */
 
 struct symbol *
-get_frame_function (frame)
-     struct frame_info *frame;
+get_frame_function (struct frame_info *frame)
 {
   register struct block *bl = get_frame_block (frame);
   if (bl == 0)
@@ -604,12 +582,8 @@
    is NULL, we don't pass this information back to the caller.  */
 
 struct blockvector *
-blockvector_for_pc_sect (pc, section, pindex, symtab)
-     register CORE_ADDR pc;
-     struct sec *section;
-     int *pindex;
-     struct symtab *symtab;
-
+blockvector_for_pc_sect (register CORE_ADDR pc, struct sec *section,
+			 int *pindex, struct symtab *symtab)
 {
   register struct block *b;
   register int bot, top, half;
@@ -662,9 +636,7 @@
    Backward compatibility, no section.  */
 
 struct blockvector *
-blockvector_for_pc (pc, pindex)
-     register CORE_ADDR pc;
-     int *pindex;
+blockvector_for_pc (register CORE_ADDR pc, int *pindex)
 {
   return blockvector_for_pc_sect (pc, find_pc_mapped_section (pc),
 				  pindex, NULL);
@@ -674,9 +646,7 @@
    in the specified section, or 0 if there is none.  */
 
 struct block *
-block_for_pc_sect (pc, section)
-     register CORE_ADDR pc;
-     struct sec *section;
+block_for_pc_sect (register CORE_ADDR pc, struct sec *section)
 {
   register struct blockvector *bl;
   int index;
@@ -691,8 +661,7 @@
    or 0 if there is none.  Backward compatibility, no section.  */
 
 struct block *
-block_for_pc (pc)
-     register CORE_ADDR pc;
+block_for_pc (register CORE_ADDR pc)
 {
   return block_for_pc_sect (pc, find_pc_mapped_section (pc));
 }
@@ -701,9 +670,7 @@
    Returns 0 if function is not known.  */
 
 struct symbol *
-find_pc_sect_function (pc, section)
-     CORE_ADDR pc;
-     struct sec *section;
+find_pc_sect_function (CORE_ADDR pc, struct sec *section)
 {
   register struct block *b = block_for_pc_sect (pc, section);
   if (b == 0)
@@ -715,8 +682,7 @@
    Returns 0 if function is not known.  Backward compatibility, no section */
 
 struct symbol *
-find_pc_function (pc)
-     CORE_ADDR pc;
+find_pc_function (CORE_ADDR pc)
 {
   return find_pc_sect_function (pc, find_pc_mapped_section (pc));
 }
@@ -732,7 +698,7 @@
 /* Clear cache, e.g. when symbol table is discarded. */
 
 void
-clear_pc_function_cache ()
+clear_pc_function_cache (void)
 {
   cache_pc_function_low = 0;
   cache_pc_function_high = 0;
@@ -752,12 +718,8 @@
    returns 0.  */
 
 int
-find_pc_sect_partial_function (pc, section, name, address, endaddr)
-     CORE_ADDR pc;
-     asection *section;
-     char **name;
-     CORE_ADDR *address;
-     CORE_ADDR *endaddr;
+find_pc_sect_partial_function (CORE_ADDR pc, asection *section, char **name,
+			       CORE_ADDR *address, CORE_ADDR *endaddr)
 {
   struct partial_symtab *pst;
   struct symbol *f;
@@ -924,11 +886,8 @@
 /* Backward compatibility, no section argument */
 
 int
-find_pc_partial_function (pc, name, address, endaddr)
-     CORE_ADDR pc;
-     char **name;
-     CORE_ADDR *address;
-     CORE_ADDR *endaddr;
+find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address,
+			  CORE_ADDR *endaddr)
 {
   asection *section;
 
@@ -940,8 +899,7 @@
    or NULL if there is no such frame.  If BLOCK is NULL, just return NULL.  */
 
 struct frame_info *
-block_innermost_frame (block)
-     struct block *block;
+block_innermost_frame (struct block *block)
 {
   struct frame_info *frame;
   register CORE_ADDR start;
@@ -968,8 +926,7 @@
    or NULL if no FRAME on the chain corresponds to CORE_ADDR.  */
 
 struct frame_info *
-find_frame_addr_in_frame_chain (frame_addr)
-     CORE_ADDR frame_addr;
+find_frame_addr_in_frame_chain (CORE_ADDR frame_addr)
 {
   struct frame_info *frame = NULL;
 
@@ -990,14 +947,14 @@
 /* Get saved user PC for sigtramp from sigcontext for BSD style sigtramp.  */
 
 CORE_ADDR
-sigtramp_saved_pc (frame)
-     struct frame_info *frame;
+sigtramp_saved_pc (struct frame_info *frame)
 {
   CORE_ADDR sigcontext_addr;
-  char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
+  char *buf;
   int ptrbytes = TARGET_PTR_BIT / TARGET_CHAR_BIT;
   int sigcontext_offs = (2 * TARGET_INT_BIT) / TARGET_CHAR_BIT;
 
+  buf = alloca (ptrbytes);
   /* Get sigcontext address, it is the third parameter on the stack.  */
   if (frame->next)
     sigcontext_addr = read_memory_integer (FRAME_ARGS_ADDRESS (frame->next)
@@ -1024,20 +981,16 @@
 extern CORE_ADDR text_end;
 
 int
-pc_in_call_dummy_before_text_end (pc, sp, frame_address)
-     CORE_ADDR pc;
-     CORE_ADDR sp;
-     CORE_ADDR frame_address;
+pc_in_call_dummy_before_text_end (CORE_ADDR pc, CORE_ADDR sp,
+				  CORE_ADDR frame_address)
 {
   return ((pc) >= text_end - CALL_DUMMY_LENGTH
 	  && (pc) <= text_end + DECR_PC_AFTER_BREAK);
 }
 
 int
-pc_in_call_dummy_after_text_end (pc, sp, frame_address)
-     CORE_ADDR pc;
-     CORE_ADDR sp;
-     CORE_ADDR frame_address;
+pc_in_call_dummy_after_text_end (CORE_ADDR pc, CORE_ADDR sp,
+				 CORE_ADDR frame_address)
 {
   return ((pc) >= text_end
 	  && (pc) <= text_end + CALL_DUMMY_LENGTH + DECR_PC_AFTER_BREAK);
@@ -1062,10 +1015,7 @@
    allocate other kinds of code on the stack.  */
 
 int
-pc_in_call_dummy_on_stack (pc, sp, frame_address)
-     CORE_ADDR pc;
-     CORE_ADDR sp;
-     CORE_ADDR frame_address;
+pc_in_call_dummy_on_stack (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address)
 {
   return (INNER_THAN ((sp), (pc))
 	  && (frame_address != 0)
@@ -1073,10 +1023,8 @@
 }
 
 int
-pc_in_call_dummy_at_entry_point (pc, sp, frame_address)
-     CORE_ADDR pc;
-     CORE_ADDR sp;
-     CORE_ADDR frame_address;
+pc_in_call_dummy_at_entry_point (CORE_ADDR pc, CORE_ADDR sp,
+				 CORE_ADDR frame_address)
 {
   return ((pc) >= CALL_DUMMY_ADDRESS ()
 	  && (pc) <= (CALL_DUMMY_ADDRESS () + DECR_PC_AFTER_BREAK));
@@ -1089,7 +1037,7 @@
  * The following code serves to maintain the dummy stack frames for
  * inferior function calls (ie. when gdb calls into the inferior via
  * call_function_by_hand).  This code saves the machine state before 
- * the call in host memory, so we must maintain an independant stack 
+ * the call in host memory, so we must maintain an independent stack 
  * and keep it consistant etc.  I am attempting to make this code 
  * generic enough to be used by many targets.
  *
@@ -1123,9 +1071,7 @@
    This is the work-horse for pc_in_call_dummy and read_register_dummy     */
 
 char *
-generic_find_dummy_frame (pc, fp)
-     CORE_ADDR pc;
-     CORE_ADDR fp;
+generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp)
 {
   struct dummy_frame *dummyframe;
 
@@ -1147,10 +1093,7 @@
    Return true if this is a dummy frame created by gdb for an inferior call */
 
 int
-generic_pc_in_call_dummy (pc, sp, fp)
-     CORE_ADDR pc;
-     CORE_ADDR sp;
-     CORE_ADDR fp;
+generic_pc_in_call_dummy (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR fp)
 {
   /* if find_dummy_frame succeeds, then PC is in a call dummy */
   /* Note: SP and not FP is passed on. */
@@ -1161,10 +1104,7 @@
    Find a saved register from before GDB calls a function in the inferior */
 
 CORE_ADDR
-generic_read_register_dummy (pc, fp, regno)
-     CORE_ADDR pc;
-     CORE_ADDR fp;
-     int regno;
+generic_read_register_dummy (CORE_ADDR pc, CORE_ADDR fp, int regno)
 {
   char *dummy_regs = generic_find_dummy_frame (pc, fp);
 
@@ -1183,7 +1123,7 @@
    where a breakpoint is laying in wait.  */
 
 void
-generic_push_dummy_frame ()
+generic_push_dummy_frame (void)
 {
   struct dummy_frame *dummy_frame;
   CORE_ADDR fp = (get_current_frame ())->frame;
@@ -1197,8 +1137,8 @@
     if (INNER_THAN (dummy_frame->fp, fp))	/* stale -- destroy! */
       {
 	dummy_frame_stack = dummy_frame->next;
-	free (dummy_frame->registers);
-	free (dummy_frame);
+	xfree (dummy_frame->registers);
+	xfree (dummy_frame);
 	dummy_frame = dummy_frame_stack;
       }
     else
@@ -1217,8 +1157,7 @@
 }
 
 void
-generic_save_dummy_frame_tos (sp)
-     CORE_ADDR sp;
+generic_save_dummy_frame_tos (CORE_ADDR sp)
 {
   dummy_frame_stack->top = sp;
 }
@@ -1241,7 +1180,7 @@
    Restore the machine state from a saved dummy stack frame. */
 
 void
-generic_pop_dummy_frame ()
+generic_pop_dummy_frame (void)
 {
   struct dummy_frame *dummy_frame = dummy_frame_stack;
 
@@ -1254,8 +1193,8 @@
   write_register_bytes (0, dummy_frame->registers, REGISTER_BYTES);
   flush_cached_frames ();
 
-  free (dummy_frame->registers);
-  free (dummy_frame);
+  xfree (dummy_frame->registers);
+  xfree (dummy_frame);
 }
 
 /* Function: frame_chain_valid 
@@ -1263,9 +1202,7 @@
    and false for the CRT0 start-up frame.  Purpose is to terminate backtrace */
 
 int
-generic_file_frame_chain_valid (fp, fi)
-     CORE_ADDR fp;
-     struct frame_info *fi;
+generic_file_frame_chain_valid (CORE_ADDR fp, struct frame_info *fi)
 {
   if (PC_IN_CALL_DUMMY (FRAME_SAVED_PC (fi), fp, fp))
     return 1;			/* don't prune CALL_DUMMY frames */
@@ -1276,9 +1213,7 @@
 }
 
 int
-generic_func_frame_chain_valid (fp, fi)
-     CORE_ADDR fp;
-     struct frame_info *fi;
+generic_func_frame_chain_valid (CORE_ADDR fp, struct frame_info *fi)
 {
   if (PC_IN_CALL_DUMMY ((fi)->pc, fp, fp))
     return 1;			/* don't prune CALL_DUMMY frames */
@@ -1294,14 +1229,8 @@
    the frame being created */
 
 void
-generic_fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p)
-     char *dummy;
-     CORE_ADDR pc;
-     CORE_ADDR fun;
-     int nargs;
-     struct value **args;
-     struct type *type;
-     int gcc_p;
+generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
+			struct value **args, struct type *type, int gcc_p)
 {
   return;
 }
@@ -1331,13 +1260,9 @@
    The argument RAW_BUFFER must point to aligned memory.  */
 
 void
-generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
-     char *raw_buffer;
-     int *optimized;
-     CORE_ADDR *addrp;
-     struct frame_info *frame;
-     int regnum;
-     enum lval_type *lval;
+generic_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.");
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index c80c453..5dae6ab 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1,5 +1,5 @@
 /* Everything about breakpoints, for GDB.
-   Copyright 1986, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright 1986, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999, 2000
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -39,6 +39,7 @@
 #include "annotate.h"
 #include "symfile.h"
 #include "objfiles.h"
+#include "linespec.h"
 #ifdef UI_OUT
 #include "ui-out.h"
 #endif
@@ -328,8 +329,7 @@
 /* Set breakpoint count to NUM.  */
 
 void
-set_breakpoint_count (num)
-     int num;
+set_breakpoint_count (int num)
 {
   breakpoint_count = num;
   set_internalvar (lookup_internalvar ("bpnum"),
@@ -339,7 +339,7 @@
 /* Used in run_command to zero the hit count when a new run starts. */
 
 void
-clear_breakpoint_hit_counts ()
+clear_breakpoint_hit_counts (void)
 {
   struct breakpoint *b;
 
@@ -369,9 +369,7 @@
    TRAILER is a character which can be found after the number; most
    commonly this is `-'.  If you don't want a trailer, use \0.  */ 
 static int
-get_number_trailer (pp, trailer)
-     char **pp;
-     int trailer;
+get_number_trailer (char **pp, int trailer)
 {
   int retval = 0;	/* default */
   char *p = *pp;
@@ -435,8 +433,7 @@
 
 /* Like get_number_trailer, but don't allow a trailer.  */
 int
-get_number (pp)
-     char **pp;
+get_number (char **pp)
 {
   return get_number_trailer (pp, '\0');
 }
@@ -458,8 +455,7 @@
  */
 
 int 
-get_number_or_range (pp)
-     char **pp;
+get_number_or_range (char **pp)
 {
   static int last_retval, end_value;
   static char *end_ptr;
@@ -523,9 +519,7 @@
 /* condition N EXP -- set break condition of breakpoint N to EXP.  */
 
 static void
-condition_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+condition_command (char *arg, int from_tty)
 {
   register struct breakpoint *b;
   char *p;
@@ -544,11 +538,11 @@
     {
       if (b->cond)
 	{
-	  free ((PTR) b->cond);
+	  xfree (b->cond);
 	  b->cond = 0;
 	}
       if (b->cond_string != NULL)
-	free ((PTR) b->cond_string);
+	xfree (b->cond_string);
 
       if (*p == 0)
 	{
@@ -576,9 +570,7 @@
 
 /* ARGSUSED */
 static void
-commands_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+commands_command (char *arg, int from_tty)
 {
   register struct breakpoint *b;
   char *p;
@@ -623,10 +615,7 @@
    shadow contents, not the breakpoints themselves.  From breakpoint.c.  */
 
 int
-read_memory_nobpt (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     unsigned len;
+read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len)
 {
   int status;
   struct breakpoint *b;
@@ -728,7 +717,7 @@
    or an `errno' value if could not write the inferior.  */
 
 int
-insert_breakpoints ()
+insert_breakpoints (void)
 {
   register struct breakpoint *b, *temp;
   int return_val = 0;	/* return success code. */
@@ -1038,7 +1027,7 @@
 
 
 int
-remove_breakpoints ()
+remove_breakpoints (void)
 {
   register struct breakpoint *b;
   int val;
@@ -1077,8 +1066,7 @@
 }
 
 int
-reattach_breakpoints (pid)
-     int pid;
+reattach_breakpoints (int pid)
 {
   register struct breakpoint *b;
   int val;
@@ -1107,7 +1095,7 @@
 }
 
 void
-update_breakpoints_after_exec ()
+update_breakpoints_after_exec (void)
 {
   struct breakpoint *b;
   struct breakpoint *temp;
@@ -1222,8 +1210,7 @@
 }
 
 int
-detach_breakpoints (pid)
-     int pid;
+detach_breakpoints (int pid)
 {
   register struct breakpoint *b;
   int val;
@@ -1251,9 +1238,7 @@
 }
 
 static int
-remove_breakpoint (b, is)
-     struct breakpoint *b;
-     insertion_state_t is;
+remove_breakpoint (struct breakpoint *b, insertion_state_t is)
 {
   int val;
 
@@ -1282,7 +1267,7 @@
 	  /* Check to see if breakpoint is in an overlay section;
 	     if so, we should remove the breakpoint at the LMA address.
 	     If that is not equal to the raw address, then we should 
-	     presumable remove the breakpoint there as well.  */
+	     presumably remove the breakpoint there as well.  */
 	  if (overlay_debugging && b->section &&
 	      section_is_overlay (b->section))
 	    {
@@ -1417,7 +1402,7 @@
 /* Clear the "inserted" flag in all breakpoints.  */
 
 void
-mark_breakpoints_out ()
+mark_breakpoints_out (void)
 {
   register struct breakpoint *b;
 
@@ -1438,8 +1423,7 @@
 
 
 void
-breakpoint_init_inferior (context)
-     enum inf_context context;
+breakpoint_init_inferior (enum inf_context context)
 {
   register struct breakpoint *b, *temp;
   static int warning_needed = 0;
@@ -1506,8 +1490,7 @@
      the target, to advance the PC past the breakpoint.  */
 
 enum breakpoint_here
-breakpoint_here_p (pc)
-     CORE_ADDR pc;
+breakpoint_here_p (CORE_ADDR pc)
 {
   register struct breakpoint *b;
   int any_breakpoint_here = 0;
@@ -1536,8 +1519,7 @@
    at PC.  */
 
 int
-breakpoint_inserted_here_p (pc)
-     CORE_ADDR pc;
+breakpoint_inserted_here_p (CORE_ADDR pc)
 {
   register struct breakpoint *b;
 
@@ -1563,8 +1545,7 @@
    bp_call_dummy breakpoint.  */
 
 int
-frame_in_dummy (frame)
-     struct frame_info *frame;
+frame_in_dummy (struct frame_info *frame)
 {
   struct breakpoint *b;
 
@@ -1589,13 +1570,11 @@
   return 0;
 }
 
-/* breakpoint_match_thread (PC, PID) returns true if the breakpoint at PC
-   is valid for process/thread PID.  */
+/* breakpoint_thread_match (PC, PID) returns true if the breakpoint at
+   PC is valid for process/thread PID.  */
 
 int
-breakpoint_thread_match (pc, pid)
-     CORE_ADDR pc;
-     int pid;
+breakpoint_thread_match (CORE_ADDR pc, int pid)
 {
   struct breakpoint *b;
   int thread;
@@ -1625,8 +1604,7 @@
    in breakpoint.h.  */
 
 int
-ep_is_catchpoint (ep)
-     struct breakpoint *ep;
+ep_is_catchpoint (struct breakpoint *ep)
 {
   return
     (ep->type == bp_catch_load)
@@ -1643,8 +1621,7 @@
 }
 
 int
-ep_is_shlib_catchpoint (ep)
-     struct breakpoint *ep;
+ep_is_shlib_catchpoint (struct breakpoint *ep)
 {
   return
     (ep->type == bp_catch_load)
@@ -1653,8 +1630,7 @@
 }
 
 int
-ep_is_exception_catchpoint (ep)
-     struct breakpoint *ep;
+ep_is_exception_catchpoint (struct breakpoint *ep)
 {
   return
     (ep->type == bp_catch_catch)
@@ -1666,8 +1642,7 @@
    Also free any storage that is part of a bpstat.  */
 
 void
-bpstat_clear (bsp)
-     bpstat *bsp;
+bpstat_clear (bpstat *bsp)
 {
   bpstat p;
   bpstat q;
@@ -1680,7 +1655,7 @@
       q = p->next;
       if (p->old_val != NULL)
 	value_free (p->old_val);
-      free ((PTR) p);
+      xfree (p);
       p = q;
     }
   *bsp = NULL;
@@ -1690,8 +1665,7 @@
    is part of the bpstat is copied as well.  */
 
 bpstat
-bpstat_copy (bs)
-     bpstat bs;
+bpstat_copy (bpstat bs)
 {
   bpstat p = NULL;
   bpstat tmp;
@@ -1718,9 +1692,7 @@
 /* Find the bpstat associated with this breakpoint */
 
 bpstat
-bpstat_find_breakpoint (bsp, breakpoint)
-     bpstat bsp;
-     struct breakpoint *breakpoint;
+bpstat_find_breakpoint (bpstat bsp, struct breakpoint *breakpoint)
 {
   if (bsp == NULL)
     return NULL;
@@ -1742,8 +1714,7 @@
 
    See wait_for_inferior's use of this function.  */
 struct breakpoint *
-bpstat_find_step_resume_breakpoint (bsp)
-     bpstat bsp;
+bpstat_find_step_resume_breakpoint (bpstat bsp)
 {
   if (bsp == NULL)
     error ("Internal error (bpstat_find_step_resume_breakpoint)");
@@ -1766,8 +1737,7 @@
    Return 0 if passed a bpstat which does not indicate any breakpoints.  */
 
 int
-bpstat_num (bsp)
-     bpstat *bsp;
+bpstat_num (bpstat *bsp)
 {
   struct breakpoint *b;
 
@@ -1787,8 +1757,7 @@
 /* Modify BS so that the actions will not be performed.  */
 
 void
-bpstat_clear_actions (bs)
-     bpstat bs;
+bpstat_clear_actions (bpstat bs)
 {
   for (; bs != NULL; bs = bs->next)
     {
@@ -1804,8 +1773,7 @@
 /* Stub for cleaning up our state if we error-out of a breakpoint command */
 /* ARGSUSED */
 static void
-cleanup_executing_breakpoints (ignore)
-     PTR ignore;
+cleanup_executing_breakpoints (PTR ignore)
 {
   executing_breakpoint_commands = 0;
 }
@@ -1816,8 +1784,7 @@
    the global "breakpoint_proceeded" after each command.  */
 
 void
-bpstat_do_actions (bsp)
-     bpstat *bsp;
+bpstat_do_actions (bpstat *bsp)
 {
   bpstat bs;
   struct cleanup *old_chain;
@@ -1892,8 +1859,7 @@
    analysis.  */
 
 static enum print_stop_action
-print_it_typical (bs)
-     bpstat bs;
+print_it_typical (bpstat bs)
 {
 #ifdef UI_OUT
   struct cleanup *old_chain;
@@ -2242,8 +2208,7 @@
    further info to be printed.*/
 
 enum print_stop_action
-bpstat_print (bs)
-     bpstat bs;
+bpstat_print (bpstat bs)
 {
   int val;
 
@@ -2271,8 +2236,7 @@
    make it pass through catch_errors.  */
 
 static int
-breakpoint_cond_eval (exp)
-     PTR exp;
+breakpoint_cond_eval (PTR exp)
 {
   value_ptr mark = value_mark ();
   int i = !value_true (evaluate_expression ((struct expression *) exp));
@@ -2283,9 +2247,7 @@
 /* Allocate a new bpstat and chain it to the current one.  */
 
 static bpstat
-bpstat_alloc (b, cbs)
-     register struct breakpoint *b;
-     bpstat cbs;		/* Current "bs" value */
+bpstat_alloc (struct breakpoint *b, bpstat cbs /* Current "bs" value */ )
 {
   bpstat bs;
 
@@ -2314,8 +2276,7 @@
 /* Check watchpoint condition.  */
 
 static int
-watchpoint_check (p)
-     PTR p;
+watchpoint_check (PTR p)
 {
   bpstat bs = (bpstat) p;
   struct breakpoint *b;
@@ -2423,9 +2384,7 @@
    commands, FIXME??? fields.  */
 
 bpstat
-bpstat_stop_status (pc, not_a_breakpoint)
-     CORE_ADDR *pc;
-     int not_a_breakpoint;
+bpstat_stop_status (CORE_ADDR *pc, int not_a_breakpoint)
 {
   register struct breakpoint *b, *temp;
   CORE_ADDR bp_addr;
@@ -2743,8 +2702,7 @@
 
 /* Tell what to do about this bpstat.  */
 struct bpstat_what
-bpstat_what (bs)
-     bpstat bs;
+bpstat_what (bpstat bs)
 {
   /* Classify each bpstat as one of the following.  */
   enum class
@@ -2823,7 +2781,7 @@
      back and decide something of a lower priority is better.  The
      ordering is:
 
-     kc   < clr sgl shl slr sn sr ss ts
+     kc   < clr sgl shl shlr slr sn sr ss ts
      sgl  < clrs shl shlr slr sn sr ss ts
      slr  < err shl shlr sn sr ss ts
      clr  < clrs err shl shlr sn sr ss ts
@@ -2868,7 +2826,7 @@
 /*bp_noisy */
     {sn, sn, sn, sn, sn, sn, sn, sr, ts, shl, shlr},
 /*long_jump */
-    {slr, ss, sn, slr, err, err, err, sr, ts, shl, shlr},
+    {slr, ss, sn, slr, slr, err, err, sr, ts, shl, shlr},
 /*long_resume */
     {clr, ss, sn, clrs, err, err, err, sr, ts, shl, shlr},
 /*step_resume */
@@ -3021,7 +2979,7 @@
    just to things like whether watchpoints are set.  */
 
 int
-bpstat_should_step ()
+bpstat_should_step (void)
 {
   struct breakpoint *b;
   ALL_BREAKPOINTS (b)
@@ -3032,7 +2990,7 @@
 
 /* Nonzero if there are enabled hardware watchpoints. */
 int
-bpstat_have_active_hw_watchpoints ()
+bpstat_have_active_hw_watchpoints (void)
 {
   struct breakpoint *b;
   ALL_BREAKPOINTS (b)
@@ -3050,9 +3008,7 @@
    function returns another bpstat which contains only the catchpoints
    on that first list, if any. */
 void
-bpstat_get_triggered_catchpoints (ep_list, cp_list)
-     bpstat ep_list;
-     bpstat *cp_list;
+bpstat_get_triggered_catchpoints (bpstat ep_list, bpstat *cp_list)
 {
   struct bpstats root_bs[1];
   bpstat bs = root_bs;
@@ -3088,7 +3044,7 @@
          catchpoint triggers.  Clients who may wish to know the name
          later must get it from the catchpoint itself.) */
       if (ep->triggered_dll_pathname != NULL)
-	free (ep->triggered_dll_pathname);
+	xfree (ep->triggered_dll_pathname);
       if (ep->type == bp_catch_load)
 	dll_pathname = SOLIB_LOADED_LIBRARY_PATHNAME (inferior_pid);
       else
@@ -3567,9 +3523,7 @@
    is nonzero, process only watchpoints.  */
 
 static void
-breakpoint_1 (bnum, allflag)
-     int bnum;
-     int allflag;
+breakpoint_1 (int bnum, int allflag)
 {
   register struct breakpoint *b;
   CORE_ADDR last_addr = (CORE_ADDR) -1;
@@ -3680,28 +3634,24 @@
 
 /* ARGSUSED */
 static void
-breakpoints_info (bnum_exp, from_tty)
-     char *bnum_exp;
-     int from_tty;
+breakpoints_info (char *bnum_exp, int from_tty)
 {
   int bnum = -1;
 
   if (bnum_exp)
-    bnum = parse_and_eval_address (bnum_exp);
+    bnum = parse_and_eval_long (bnum_exp);
 
   breakpoint_1 (bnum, 0);
 }
 
 /* ARGSUSED */
 static void
-maintenance_info_breakpoints (bnum_exp, from_tty)
-     char *bnum_exp;
-     int from_tty;
+maintenance_info_breakpoints (char *bnum_exp, int from_tty)
 {
   int bnum = -1;
 
   if (bnum_exp)
-    bnum = parse_and_eval_address (bnum_exp);
+    bnum = parse_and_eval_long (bnum_exp);
 
   breakpoint_1 (bnum, 1);
 }
@@ -3709,9 +3659,7 @@
 /* Print a message describing any breakpoints set at PC.  */
 
 static void
-describe_other_breakpoints (pc, section)
-     CORE_ADDR pc;
-     asection *section;
+describe_other_breakpoints (CORE_ADDR pc, asection *section)
 {
   register int others = 0;
   register struct breakpoint *b;
@@ -3750,11 +3698,8 @@
    for the `break' command with no arguments.  */
 
 void
-set_default_breakpoint (valid, addr, symtab, line)
-     int valid;
-     CORE_ADDR addr;
-     struct symtab *symtab;
-     int line;
+set_default_breakpoint (int valid, CORE_ADDR addr, struct symtab *symtab,
+			int line)
 {
   default_breakpoint_valid = valid;
   default_breakpoint_address = addr;
@@ -3769,9 +3714,7 @@
    the official one, and the rest as duplicates.  */
 
 static void
-check_duplicates (address, section)
-     CORE_ADDR address;
-     asection *section;
+check_duplicates (CORE_ADDR address, asection *section)
 {
   register struct breakpoint *b;
   register int count = 0;
@@ -3838,8 +3781,7 @@
    your arguments BEFORE calling this routine!  */
 
 struct breakpoint *
-set_raw_breakpoint (sal)
-     struct symtab_and_line sal;
+set_raw_breakpoint (struct symtab_and_line sal)
 {
   register struct breakpoint *b, *b1;
 
@@ -3902,8 +3844,7 @@
 #ifdef GET_LONGJMP_TARGET
 
 static void
-create_longjmp_breakpoint (func_name)
-     char *func_name;
+create_longjmp_breakpoint (char *func_name)
 {
   struct symtab_and_line sal;
   struct breakpoint *b;
@@ -3941,7 +3882,7 @@
    set_longjmp_resume_breakpoint() to figure out where we are going. */
 
 void
-enable_longjmp_breakpoint ()
+enable_longjmp_breakpoint (void)
 {
   register struct breakpoint *b;
 
@@ -3954,7 +3895,7 @@
 }
 
 void
-disable_longjmp_breakpoint ()
+disable_longjmp_breakpoint (void)
 {
   register struct breakpoint *b;
 
@@ -3968,8 +3909,7 @@
 }
 
 struct breakpoint *
-create_thread_event_breakpoint (address)
-     CORE_ADDR address;
+create_thread_event_breakpoint (CORE_ADDR address)
 {
   struct breakpoint *b;
   struct symtab_and_line sal;
@@ -4005,7 +3945,7 @@
 
 #ifdef SOLIB_ADD
 void
-remove_solib_event_breakpoints ()
+remove_solib_event_breakpoints (void)
 {
   register struct breakpoint *b, *temp;
 
@@ -4015,8 +3955,7 @@
 }
 
 struct breakpoint *
-create_solib_event_breakpoint (address)
-     CORE_ADDR address;
+create_solib_event_breakpoint (CORE_ADDR address)
 {
   struct breakpoint *b;
   struct symtab_and_line sal;
@@ -4036,8 +3975,7 @@
    apply to enabled breakpoints, disabled ones can just stay disabled.  */
 
 void
-disable_breakpoints_in_shlibs (silent)
-     int silent;
+disable_breakpoints_in_shlibs (int silent)
 {
   struct breakpoint *b;
   int disabled_shlib_breaks = 0;
@@ -4070,7 +4008,7 @@
 
 /* Try to reenable any breakpoints in shared libraries.  */
 void
-re_enable_breakpoints_in_shlibs ()
+re_enable_breakpoints_in_shlibs (void)
 {
   struct breakpoint *b;
 
@@ -4089,12 +4027,8 @@
 #endif
 
 static void
-solib_load_unload_1 (hookname, tempflag, dll_pathname, cond_string, bp_kind)
-     char *hookname;
-     int tempflag;
-     char *dll_pathname;
-     char *cond_string;
-     enum bptype bp_kind;
+solib_load_unload_1 (char *hookname, int tempflag, char *dll_pathname,
+		     char *cond_string, enum bptype bp_kind)
 {
   struct breakpoint *b;
   struct symtabs_and_lines sals;
@@ -4125,13 +4059,13 @@
 
   /* Make sure that all storage allocated in decode_line_1 gets freed
      in case the following errors out.  */
-  old_chain = make_cleanup (free, sals.sals);
+  old_chain = make_cleanup (xfree, sals.sals);
   if (canonical != (char **) NULL)
     {
-      make_cleanup (free, canonical);
+      make_cleanup (xfree, canonical);
       canonical_strings_chain = make_cleanup (null_cleanup, 0);
       if (canonical[0] != NULL)
-	make_cleanup (free, canonical[0]);
+	make_cleanup (xfree, canonical[0]);
     }
 
   resolve_sal_pc (&sals.sals[0]);
@@ -4170,34 +4104,24 @@
 }
 
 void
-create_solib_load_event_breakpoint (hookname, tempflag, 
-				    dll_pathname, cond_string)
-     char *hookname;
-     int tempflag;
-     char *dll_pathname;
-     char *cond_string;
+create_solib_load_event_breakpoint (char *hookname, int tempflag,
+				    char *dll_pathname, char *cond_string)
 {
   solib_load_unload_1 (hookname, tempflag, dll_pathname, 
 		       cond_string, bp_catch_load);
 }
 
 void
-create_solib_unload_event_breakpoint (hookname, tempflag, 
-				      dll_pathname, cond_string)
-     char *hookname;
-     int tempflag;
-     char *dll_pathname;
-     char *cond_string;
+create_solib_unload_event_breakpoint (char *hookname, int tempflag,
+				      char *dll_pathname, char *cond_string)
 {
   solib_load_unload_1 (hookname,tempflag, dll_pathname, 
 		       cond_string, bp_catch_unload);
 }
 
 static void
-create_fork_vfork_event_catchpoint (tempflag, cond_string, bp_kind)
-     int tempflag;
-     char *cond_string;
-     enum bptype bp_kind;
+create_fork_vfork_event_catchpoint (int tempflag, char *cond_string,
+				    enum bptype bp_kind)
 {
   struct symtab_and_line sal;
   struct breakpoint *b;
@@ -4226,25 +4150,19 @@
 }
 
 void
-create_fork_event_catchpoint (tempflag, cond_string)
-     int tempflag;
-     char *cond_string;
+create_fork_event_catchpoint (int tempflag, char *cond_string)
 {
   create_fork_vfork_event_catchpoint (tempflag, cond_string, bp_catch_fork);
 }
 
 void
-create_vfork_event_catchpoint (tempflag, cond_string)
-     int tempflag;
-     char *cond_string;
+create_vfork_event_catchpoint (int tempflag, char *cond_string)
 {
   create_fork_vfork_event_catchpoint (tempflag, cond_string, bp_catch_vfork);
 }
 
 void
-create_exec_event_catchpoint (tempflag, cond_string)
-     int tempflag;
-     char *cond_string;
+create_exec_event_catchpoint (int tempflag, char *cond_string)
 {
   struct symtab_and_line sal;
   struct breakpoint *b;
@@ -4272,7 +4190,7 @@
 }
 
 static int
-hw_breakpoint_used_count ()
+hw_breakpoint_used_count (void)
 {
   register struct breakpoint *b;
   int i = 0;
@@ -4287,9 +4205,7 @@
 }
 
 static int
-hw_watchpoint_used_count (type, other_type_used)
-     enum bptype type;
-     int *other_type_used;
+hw_watchpoint_used_count (enum bptype type, int *other_type_used)
 {
   register struct breakpoint *b;
   int i = 0;
@@ -4318,9 +4234,7 @@
    that gets deleted automatically... */
 
 void
-set_longjmp_resume_breakpoint (pc, frame)
-     CORE_ADDR pc;
-     struct frame_info *frame;
+set_longjmp_resume_breakpoint (CORE_ADDR pc, struct frame_info *frame)
 {
   register struct breakpoint *b;
 
@@ -4339,7 +4253,7 @@
 }
 
 void
-disable_watchpoints_before_interactive_call_start ()
+disable_watchpoints_before_interactive_call_start (void)
 {
   struct breakpoint *b;
 
@@ -4359,7 +4273,7 @@
 }
 
 void
-enable_watchpoints_after_interactive_call_stop ()
+enable_watchpoints_after_interactive_call_stop (void)
 {
   struct breakpoint *b;
 
@@ -4384,10 +4298,8 @@
    Restrict it to frame FRAME if FRAME is nonzero.  */
 
 struct breakpoint *
-set_momentary_breakpoint (sal, frame, type)
-     struct symtab_and_line sal;
-     struct frame_info *frame;
-     enum bptype type;
+set_momentary_breakpoint (struct symtab_and_line sal, struct frame_info *frame,
+			  enum bptype type)
 {
   register struct breakpoint *b;
   b = set_raw_breakpoint (sal);
@@ -4409,8 +4321,7 @@
 /* Tell the user we have just set a breakpoint B.  */
 
 static void
-mention (b)
-     struct breakpoint *b;
+mention (struct breakpoint *b)
 {
   int say_where = 0;
 #ifdef UI_OUT
@@ -4736,9 +4647,7 @@
    second bit : 0 normal breakpoint, 1 hardware breakpoint. */
 
 static void
-break_command_1 (arg, flag, from_tty)
-     char *arg;
-     int flag, from_tty;
+break_command_1 (char *arg, int flag, int from_tty)
 {
   int tempflag, hardwareflag;
   struct symtabs_and_lines sals;
@@ -4769,18 +4678,18 @@
   old_chain = make_cleanup (null_cleanup, 0);
 
   /* Make sure that all storage allocated to SALS gets freed.  */
-  make_cleanup (free, sals.sals);
+  make_cleanup (xfree, sals.sals);
 
   /* Cleanup the addr_string array but not its contents. */
-  make_cleanup (free, addr_string);
+  make_cleanup (xfree, addr_string);
 
   /* Allocate space for all the cond expressions. */
   cond = xcalloc (sals.nelts, sizeof (struct expression *));
-  make_cleanup (free, cond);
+  make_cleanup (xfree, cond);
 
   /* Allocate space for all the cond strings. */
   cond_string = xcalloc (sals.nelts, sizeof (char **));
-  make_cleanup (free, cond_string);
+  make_cleanup (xfree, cond_string);
 
   /* ----------------------------- SNIP -----------------------------
      Anything added to the cleanup chain beyond this point is assumed
@@ -4794,7 +4703,7 @@
   for (i = 0; i < sals.nelts; i++)
     {
       if (addr_string[i] != NULL)
-	make_cleanup (free, addr_string[i]);
+	make_cleanup (xfree, addr_string[i]);
     }
 
   /* Resolve all line numbers to PC's and verify that the addresses
@@ -4828,10 +4737,10 @@
 	    {
 	      tok = cond_start = end_tok + 1;
 	      cond[i] = parse_exp_1 (&tok, block_for_pc (sals.sals[i].pc), 0);
-	      make_cleanup (free, cond[i]);
+	      make_cleanup (xfree, cond[i]);
 	      cond_end = tok;
 	      cond_string[i] = savestring (cond_start, cond_end - cond_start);
-	      make_cleanup (free, cond_string[i]);
+	      make_cleanup (xfree, cond_string[i]);
 	    }
 	  else if (toklen >= 1 && strncmp (tok, "thread", toklen) == 0)
 	    {
@@ -4910,18 +4819,18 @@
   old_chain = make_cleanup (null_cleanup, 0);
 
   /* Always have a addr_string array, even if it is empty. */
-  make_cleanup (free, addr_string);
+  make_cleanup (xfree, addr_string);
 
   /* Make sure that all storage allocated to SALS gets freed.  */
-  make_cleanup (free, sals.sals);
+  make_cleanup (xfree, sals.sals);
 
   /* Allocate space for all the cond expressions. */
   cond = xcalloc (sals.nelts, sizeof (struct expression *));
-  make_cleanup (free, cond);
+  make_cleanup (xfree, cond);
 
   /* Allocate space for all the cond strings. */
   cond_string = xcalloc (sals.nelts, sizeof (char **));
-  make_cleanup (free, cond_string);
+  make_cleanup (xfree, cond_string);
 
   /* ----------------------------- SNIP -----------------------------
      Anything added to the cleanup chain beyond this point is assumed
@@ -4935,7 +4844,7 @@
   for (i = 0; i < sals.nelts; i++)
     {
       if (addr_string[i] != NULL)
-	make_cleanup (free, addr_string[i]);
+	make_cleanup (xfree, addr_string[i]);
     }
 
   /* Wait until now before checking for garbage at the end of the
@@ -4957,7 +4866,7 @@
 	  cond[i] = parse_exp_1 (&tok, block_for_pc (sals.sals[i].pc), 0);
 	  if (*tok != '\0')
 	    error ("Garbage %s follows condition", tok);
-	  make_cleanup (free, cond[i]);
+	  make_cleanup (xfree, cond[i]);
 	  cond_string[i] = xstrdup (args->condition);
 	}
     }
@@ -4993,14 +4902,13 @@
 
 
 static void
-break_at_finish_at_depth_command_1 (arg, flag, from_tty)
-     char *arg;
-     int flag;
-     int from_tty;
+break_at_finish_at_depth_command_1 (char *arg, int flag, int from_tty)
 {
   struct frame_info *frame;
   CORE_ADDR low, high, selected_pc = 0;
-  char *extra_args, *level_arg, *addr_string;
+  char *extra_args = NULL;
+  char *level_arg;
+  char *addr_string;
   int extra_args_len = 0, if_arg = 0;
 
   if (!arg ||
@@ -5060,7 +4968,7 @@
 	  else
 	    sprintf (addr_string, "*0x%s", paddr_nz (high));
 	  break_command_1 (addr_string, flag, from_tty);
-	  free (addr_string);
+	  xfree (addr_string);
 	}
       else
 	error ("No function contains the specified address");
@@ -5071,17 +4979,14 @@
 
 
 static void
-break_at_finish_command_1 (arg, flag, from_tty)
-     char *arg;
-     int flag;
-     int from_tty;
+break_at_finish_command_1 (char *arg, int flag, int from_tty)
 {
   char *addr_string, *break_string, *beg_addr_string;
   CORE_ADDR low, high;
   struct symtabs_and_lines sals;
   struct symtab_and_line sal;
   struct cleanup *old_chain;
-  char *extra_args;
+  char *extra_args = NULL;
   int extra_args_len = 0;
   int i, if_arg = 0;
 
@@ -5132,8 +5037,8 @@
   sals = decode_line_1 (&addr_string, 1, (struct symtab *) NULL, 0,
 			(char ***) NULL);
 
-  free (beg_addr_string);
-  old_chain = make_cleanup (free, sals.sals);
+  xfree (beg_addr_string);
+  old_chain = make_cleanup (xfree, sals.sals);
   for (i = 0; (i < sals.nelts); i++)
     {
       sal = sals.sals[i];
@@ -5145,7 +5050,7 @@
 	  else
 	    sprintf (break_string, "*0x%s", paddr_nz (high));
 	  break_command_1 (break_string, flag, from_tty);
-	  free (break_string);
+	  xfree (break_string);
 	}
       else
 	error ("No function contains the specified address");
@@ -5162,8 +5067,7 @@
 /* Helper function for break_command_1 and disassemble_command.  */
 
 void
-resolve_sal_pc (sal)
-     struct symtab_and_line *sal;
+resolve_sal_pc (struct symtab_and_line *sal)
 {
   CORE_ADDR pc;
 
@@ -5210,65 +5114,49 @@
 }
 
 void
-break_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+break_command (char *arg, int from_tty)
 {
   break_command_1 (arg, 0, from_tty);
 }
 
 static void
-break_at_finish_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+break_at_finish_command (char *arg, int from_tty)
 {
   break_at_finish_command_1 (arg, 0, from_tty);
 }
 
 static void
-break_at_finish_at_depth_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+break_at_finish_at_depth_command (char *arg, int from_tty)
 {
   break_at_finish_at_depth_command_1 (arg, 0, from_tty);
 }
 
 void
-tbreak_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+tbreak_command (char *arg, int from_tty)
 {
   break_command_1 (arg, BP_TEMPFLAG, from_tty);
 }
 
 static void
-tbreak_at_finish_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+tbreak_at_finish_command (char *arg, int from_tty)
 {
   break_at_finish_command_1 (arg, BP_TEMPFLAG, from_tty);
 }
 
 static void
-hbreak_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+hbreak_command (char *arg, int from_tty)
 {
   break_command_1 (arg, BP_HARDWAREFLAG, from_tty);
 }
 
 static void
-thbreak_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+thbreak_command (char *arg, int from_tty)
 {
   break_command_1 (arg, (BP_TEMPFLAG | BP_HARDWAREFLAG), from_tty);
 }
 
 static void
-stop_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+stop_command (char *arg, int from_tty)
 {
   printf_filtered ("Specify the type of breakpoint to set.\n\
 Usage: stop in <function | address>\n\
@@ -5276,9 +5164,7 @@
 }
 
 static void
-stopin_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+stopin_command (char *arg, int from_tty)
 {
   int badInput = 0;
 
@@ -5311,9 +5197,7 @@
 }
 
 static void
-stopat_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+stopat_command (char *arg, int from_tty)
 {
   int badInput = 0;
 
@@ -5349,10 +5233,7 @@
                 hw_read:   watch read, 
 		hw_access: watch access (read or write) */
 static void
-watch_command_1 (arg, accessflag, from_tty)
-     char *arg;
-     int accessflag;
-     int from_tty;
+watch_command_1 (char *arg, int accessflag, int from_tty)
 {
   struct breakpoint *b;
   struct symtab_and_line sal;
@@ -5532,8 +5413,7 @@
 #endif
 
 static int
-can_use_hardware_watchpoint (v)
-     struct value *v;
+can_use_hardware_watchpoint (struct value *v)
 {
   int found_memory_cnt = 0;
   struct value *head = v;
@@ -5606,51 +5486,39 @@
 
 #ifdef UI_OUT
 void
-watch_command_wrapper (arg, from_tty)
-     char *arg;
-     int from_tty;
+watch_command_wrapper (char *arg, int from_tty)
 {
   watch_command (arg, from_tty);
 }
 #endif
 static void
-watch_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+watch_command (char *arg, int from_tty)
 {
   watch_command_1 (arg, hw_write, from_tty);
 }
 
 #ifdef UI_OUT
 void
-rwatch_command_wrapper (arg, from_tty)
-     char *arg;
-     int from_tty;
+rwatch_command_wrapper (char *arg, int from_tty)
 {
   rwatch_command (arg, from_tty);
 }
 #endif
 static void
-rwatch_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+rwatch_command (char *arg, int from_tty)
 {
   watch_command_1 (arg, hw_read, from_tty);
 }
 
 #ifdef UI_OUT
 void
-awatch_command_wrapper (arg, from_tty)
-     char *arg;
-     int from_tty;
+awatch_command_wrapper (char *arg, int from_tty)
 {
   awatch_command (arg, from_tty);
 }
 #endif
 static void
-awatch_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+awatch_command (char *arg, int from_tty)
 {
   watch_command_1 (arg, hw_access, from_tty);
 }
@@ -5674,9 +5542,7 @@
 
 /* ARGSUSED */
 void
-until_break_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+until_break_command (char *arg, int from_tty)
 {
   struct symtabs_and_lines sals;
   struct symtab_and_line sal;
@@ -5702,7 +5568,7 @@
     error ("Couldn't get information on specified line.");
 
   sal = sals.sals[0];
-  free ((PTR) sals.sals);	/* malloc'd, so freed */
+  xfree (sals.sals);	/* malloc'd, so freed */
 
   if (*arg)
     error ("Junk at end of arguments.");
@@ -5761,23 +5627,22 @@
 /* These aren't used; I don't konw what they were for.  */
 /* Set a breakpoint at the catch clause for NAME.  */
 static int
-catch_breakpoint (name)
-     char *name;
+catch_breakpoint (char *name)
 {
 }
 
 static int
-disable_catch_breakpoint ()
+disable_catch_breakpoint (void)
 {
 }
 
 static int
-delete_catch_breakpoint ()
+delete_catch_breakpoint (void)
 {
 }
 
 static int
-enable_catch_breakpoint ()
+enable_catch_breakpoint (void)
 {
 }
 #endif /* 0 */
@@ -5797,9 +5662,7 @@
 /* For each catch clause identified in ARGS, run FUNCTION
    with that clause as an argument.  */
 static struct symtabs_and_lines
-map_catch_names (args, function)
-     char *args;
-     int (*function) ();
+map_catch_names (char *args, int (*function) ())
 {
   register char *p = args;
   register char *p1;
@@ -5858,8 +5721,7 @@
 /* This shares a lot of code with `print_frame_label_vars' from stack.c.  */
 
 static struct symtabs_and_lines
-get_catch_sals (this_level_only)
-     int this_level_only;
+get_catch_sals (int this_level_only)
 {
   register struct blockvector *bl;
   register struct block *block;
@@ -5971,8 +5833,7 @@
 }
 
 static void
-ep_skip_leading_whitespace (s)
-     char **s;
+ep_skip_leading_whitespace (char **s)
 {
   if ((s == NULL) || (*s == NULL))
     return;
@@ -5986,8 +5847,7 @@
    the token is returned.  Else, NULL is returned. */
 
 static char *
-ep_find_event_name_end (arg)
-     char *arg;
+ep_find_event_name_end (char *arg)
 {
   char *s = arg;
   char *event_name_end = NULL;
@@ -6020,8 +5880,7 @@
    if clause in the arg string. */
 
 static char *
-ep_parse_optional_if_clause (arg)
-     char **arg;
+ep_parse_optional_if_clause (char **arg)
 {
   char *cond_string;
 
@@ -6053,8 +5912,7 @@
    Note that clients needing to preserve the returned filename for
    future access should copy it to their own buffers. */
 static char *
-ep_parse_optional_filename (arg)
-     char **arg;
+ep_parse_optional_filename (char **arg)
 {
   static char filename[1024];
   char *arg_p = *arg;
@@ -6093,11 +5951,8 @@
 				  char *arg, int tempflag, int from_tty);
 
 static void
-catch_fork_command_1 (fork_kind, arg, tempflag, from_tty)
-     catch_fork_kind fork_kind;
-     char *arg;
-     int tempflag;
-     int from_tty;
+catch_fork_command_1 (catch_fork_kind fork_kind, char *arg, int tempflag,
+		      int from_tty)
 {
   char *cond_string = NULL;
 
@@ -6132,10 +5987,7 @@
 
 #if defined(CHILD_INSERT_EXEC_CATCHPOINT)
 static void
-catch_exec_command_1 (arg, tempflag, from_tty)
-     char *arg;
-     int tempflag;
-     int from_tty;
+catch_exec_command_1 (char *arg, int tempflag, int from_tty)
 {
   char *cond_string = NULL;
 
@@ -6159,10 +6011,7 @@
 
 #if defined(SOLIB_ADD)
 static void
-catch_load_command_1 (arg, tempflag, from_tty)
-     char *arg;
-     int tempflag;
-     int from_tty;
+catch_load_command_1 (char *arg, int tempflag, int from_tty)
 {
   char *dll_pathname = NULL;
   char *cond_string = NULL;
@@ -6204,10 +6053,7 @@
 }
 
 static void
-catch_unload_command_1 (arg, tempflag, from_tty)
-     char *arg;
-     int tempflag;
-     int from_tty;
+catch_unload_command_1 (char *arg, int tempflag, int from_tty)
 {
   char *dll_pathname = NULL;
   char *cond_string = NULL;
@@ -6255,11 +6101,9 @@
    exception event callback */
 
 static void
-create_exception_catchpoint (tempflag, cond_string, ex_event, sal)
-     int tempflag;
-     char *cond_string;
-     enum exception_event_kind ex_event;
-     struct symtab_and_line *sal;
+create_exception_catchpoint (int tempflag, char *cond_string,
+			     enum exception_event_kind ex_event,
+			     struct symtab_and_line *sal)
 {
   struct breakpoint *b;
   int thread = -1;		/* All threads. */
@@ -6296,11 +6140,8 @@
 /* Deal with "catch catch" and "catch throw" commands */
 
 static void
-catch_exception_command_1 (ex_event, arg, tempflag, from_tty)
-     enum exception_event_kind ex_event;
-     char *arg;
-     int tempflag;
-     int from_tty;
+catch_exception_command_1 (enum exception_event_kind ex_event, char *arg,
+			   int tempflag, int from_tty)
 {
   char *cond_string = NULL;
   struct symtab_and_line *sal = NULL;
@@ -6351,8 +6192,7 @@
    inside a catch_errors */
 
 static int
-cover_target_enable_exception_callback (arg)
-     PTR arg;
+cover_target_enable_exception_callback (PTR arg)
 {
   args_for_catchpoint_enable *args = arg;
   struct symtab_and_line *sal;
@@ -6380,10 +6220,7 @@
 
 
 static void
-handle_gnu_4_16_catch_command (arg, tempflag, from_tty)
-     char *arg;
-     int tempflag;
-     int from_tty;
+handle_gnu_4_16_catch_command (char *arg, int tempflag, int from_tty)
 {
   /* First, translate ARG into something we can deal with in terms
      of breakpoints.  */
@@ -6472,15 +6309,14 @@
       warning ("Multiple breakpoints were set.");
       warning ("Use the \"delete\" command to delete unwanted breakpoints.");
     }
-  free ((PTR) sals.sals);
+  xfree (sals.sals);
 }
 
 #if 0
 /* This creates a temporary internal breakpoint
    just to placate infrun */
 static struct breakpoint *
-create_temp_exception_breakpoint (pc)
-     CORE_ADDR pc;
+create_temp_exception_breakpoint (CORE_ADDR pc)
 {
   struct symtab_and_line sal;
   struct breakpoint *b;
@@ -6504,10 +6340,7 @@
 #endif
 
 static void
-catch_command_1 (arg, tempflag, from_tty)
-     char *arg;
-     int tempflag;
-     int from_tty;
+catch_command_1 (char *arg, int tempflag, int from_tty)
 {
 
   /* The first argument may be an event name, such as "start" or "load".
@@ -6630,8 +6463,7 @@
 /* Used by the gui, could be made a worker for other things. */
 
 struct breakpoint *
-set_breakpoint_sal (sal)
-     struct symtab_and_line sal;
+set_breakpoint_sal (struct symtab_and_line sal)
 {
   struct breakpoint *b;
   b = set_raw_breakpoint (sal);
@@ -6647,51 +6479,42 @@
 /* These aren't used; I don't know what they were for.  */
 /* Disable breakpoints on all catch clauses described in ARGS.  */
 static void
-disable_catch (args)
-     char *args;
+disable_catch (char *args)
 {
   /* Map the disable command to catch clauses described in ARGS.  */
 }
 
 /* Enable breakpoints on all catch clauses described in ARGS.  */
 static void
-enable_catch (args)
-     char *args;
+enable_catch (char *args)
 {
   /* Map the disable command to catch clauses described in ARGS.  */
 }
 
 /* Delete breakpoints on all catch clauses in the active scope.  */
 static void
-delete_catch (args)
-     char *args;
+delete_catch (char *args)
 {
   /* Map the delete command to catch clauses described in ARGS.  */
 }
 #endif /* 0 */
 
 static void
-catch_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+catch_command (char *arg, int from_tty)
 {
   catch_command_1 (arg, 0, from_tty);
 }
 
 
 static void
-tcatch_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+tcatch_command (char *arg, int from_tty)
 {
   catch_command_1 (arg, 1, from_tty);
 }
 
 
 static void
-clear_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+clear_command (char *arg, int from_tty)
 {
   register struct breakpoint *b, *b1;
   int default_match;
@@ -6821,7 +6644,7 @@
       if (from_tty)
 	putchar_unfiltered ('\n');
     }
-  free ((PTR) sals.sals);
+  xfree (sals.sals);
 }
 
 /* Delete breakpoint in BS if they are `delete' breakpoints and
@@ -6829,8 +6652,7 @@
    This is called after any breakpoint is hit, or after errors.  */
 
 void
-breakpoint_auto_delete (bs)
-     bpstat bs;
+breakpoint_auto_delete (bpstat bs)
 {
   struct breakpoint *b, *temp;
 
@@ -6850,8 +6672,7 @@
    structures. */
 
 void
-delete_breakpoint (bpt)
-     struct breakpoint *bpt;
+delete_breakpoint (struct breakpoint *bpt)
 {
   register struct breakpoint *b;
   register bpstat bs;
@@ -6982,25 +6803,25 @@
 
   free_command_lines (&bpt->commands);
   if (bpt->cond)
-    free (bpt->cond);
+    xfree (bpt->cond);
   if (bpt->cond_string != NULL)
-    free (bpt->cond_string);
+    xfree (bpt->cond_string);
   if (bpt->addr_string != NULL)
-    free (bpt->addr_string);
+    xfree (bpt->addr_string);
   if (bpt->exp != NULL)
-    free (bpt->exp);
+    xfree (bpt->exp);
   if (bpt->exp_string != NULL)
-    free (bpt->exp_string);
+    xfree (bpt->exp_string);
   if (bpt->val != NULL)
     value_free (bpt->val);
   if (bpt->source_file != NULL)
-    free (bpt->source_file);
+    xfree (bpt->source_file);
   if (bpt->dll_pathname != NULL)
-    free (bpt->dll_pathname);
+    xfree (bpt->dll_pathname);
   if (bpt->triggered_dll_pathname != NULL)
-    free (bpt->triggered_dll_pathname);
+    xfree (bpt->triggered_dll_pathname);
   if (bpt->exec_pathname != NULL)
-    free (bpt->exec_pathname);
+    xfree (bpt->exec_pathname);
 
   /* Be sure no bpstat's are pointing at it after it's been freed.  */
   /* FIXME, how can we find all bpstat's?
@@ -7022,7 +6843,7 @@
      bp, we mark it as deleted before freeing its storage. */
   bpt->type = bp_none;
 
-  free ((PTR) bpt);
+  xfree (bpt);
 }
 
 static void
@@ -7044,9 +6865,7 @@
 }
 
 void
-delete_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+delete_command (char *arg, int from_tty)
 {
   struct breakpoint *b, *temp;
 
@@ -7089,8 +6908,7 @@
    Unused in this case.  */
 
 static int
-breakpoint_re_set_one (bint)
-     PTR bint;
+breakpoint_re_set_one (PTR bint)
 {
   /* get past catch_errs */
   struct breakpoint *b = (struct breakpoint *) bint;
@@ -7135,7 +6953,7 @@
 	    {
 	      s = b->cond_string;
 	      if (b->cond)
-		free ((PTR) b->cond);
+		xfree (b->cond);
 	      b->cond = parse_exp_1 (&s, block_for_pc (sals.sals[i].pc), 0);
 	    }
 
@@ -7154,7 +6972,7 @@
 	    )
 	    {
 	      if (b->source_file != NULL)
-		free (b->source_file);
+		xfree (b->source_file);
 	      if (sals.sals[i].symtab == NULL)
 		b->source_file = NULL;
 	      else
@@ -7183,7 +7001,7 @@
 	  check_duplicates (b->address, b->section);
 
 	}
-      free ((PTR) sals.sals);
+      xfree (sals.sals);
       break;
 
     case bp_watchpoint:
@@ -7201,7 +7019,7 @@
 
       /* So for now, just use a global context.  */
       if (b->exp)
-	free ((PTR) b->exp);
+	xfree (b->exp);
       b->exp = parse_expression (b->exp_string);
       b->exp_valid_block = innermost_block;
       mark = value_mark ();
@@ -7216,7 +7034,7 @@
 	{
 	  s = b->cond_string;
 	  if (b->cond)
-	    free ((PTR) b->cond);
+	    xfree (b->cond);
 	  b->cond = parse_exp_1 (&s, (struct block *) 0, 0);
 	}
       if (b->enable == enabled)
@@ -7269,7 +7087,7 @@
 
 /* Re-set all breakpoints after symbols have been re-loaded.  */
 void
-breakpoint_re_set ()
+breakpoint_re_set (void)
 {
   struct breakpoint *b, *temp;
   enum language save_language;
@@ -7313,8 +7131,7 @@
    - If the breakpoint is for all threads, leave it as-is.
    - Else, reset it to the current thread for inferior_pid. */
 void
-breakpoint_re_set_thread (b)
-     struct breakpoint *b;
+breakpoint_re_set_thread (struct breakpoint *b)
 {
   if (b->thread != -1)
     {
@@ -7324,8 +7141,7 @@
 }
 
 void
-set_ignore_count (bptnum, count, from_tty)
-     int bptnum, count, from_tty;
+set_ignore_count (int bptnum, int count, int from_tty)
 {
   register struct breakpoint *b;
 
@@ -7356,7 +7172,7 @@
 
 /* Clear the ignore counts of all breakpoints.  */
 void
-breakpoint_clear_ignore_counts ()
+breakpoint_clear_ignore_counts (void)
 {
   struct breakpoint *b;
 
@@ -7367,9 +7183,7 @@
 /* Command to set ignore-count of breakpoint N to COUNT.  */
 
 static void
-ignore_command (args, from_tty)
-     char *args;
-     int from_tty;
+ignore_command (char *args, int from_tty)
 {
   char *p = args;
   register int num;
@@ -7394,9 +7208,7 @@
    whose numbers are given in ARGS.  */
 
 static void
-map_breakpoint_numbers (args, function)
-     char *args;
-     void (*function) (struct breakpoint *);
+map_breakpoint_numbers (char *args, void (*function) (struct breakpoint *))
 {
   register char *p = args;
   char *p1;
@@ -7437,8 +7249,7 @@
 }
 
 void
-disable_breakpoint (bpt)
-     struct breakpoint *bpt;
+disable_breakpoint (struct breakpoint *bpt)
 {
   /* Never disable a watchpoint scope breakpoint; we want to
      hit them when we leave scope so we can delete both the
@@ -7461,9 +7272,7 @@
 
 /* ARGSUSED */
 static void
-disable_command (args, from_tty)
-     char *args;
-     int from_tty;
+disable_command (char *args, int from_tty)
 {
   register struct breakpoint *bpt;
   if (args == 0)
@@ -7496,9 +7305,7 @@
 }
 
 static void
-do_enable_breakpoint (bpt, disposition)
-     struct breakpoint *bpt;
-     enum bpdisp disposition;
+do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition)
 {
   struct frame_info *save_selected_frame = NULL;
   int save_selected_frame_level = -1;
@@ -7593,8 +7400,7 @@
 }
 
 void
-enable_breakpoint (bpt)
-     struct breakpoint *bpt;
+enable_breakpoint (struct breakpoint *bpt)
 {
   do_enable_breakpoint (bpt, bpt->disposition);
 }
@@ -7605,9 +7411,7 @@
 
 /* ARGSUSED */
 static void
-enable_command (args, from_tty)
-     char *args;
-     int from_tty;
+enable_command (char *args, int from_tty)
 {
   register struct breakpoint *bpt;
   if (args == 0)
@@ -7640,33 +7444,27 @@
 }
 
 static void
-enable_once_breakpoint (bpt)
-     struct breakpoint *bpt;
+enable_once_breakpoint (struct breakpoint *bpt)
 {
   do_enable_breakpoint (bpt, disable);
 }
 
 /* ARGSUSED */
 static void
-enable_once_command (args, from_tty)
-     char *args;
-     int from_tty;
+enable_once_command (char *args, int from_tty)
 {
   map_breakpoint_numbers (args, enable_once_breakpoint);
 }
 
 static void
-enable_delete_breakpoint (bpt)
-     struct breakpoint *bpt;
+enable_delete_breakpoint (struct breakpoint *bpt)
 {
   do_enable_breakpoint (bpt, del);
 }
 
 /* ARGSUSED */
 static void
-enable_delete_command (args, from_tty)
-     char *args;
-     int from_tty;
+enable_delete_command (char *args, int from_tty)
 {
   map_breakpoint_numbers (args, enable_delete_breakpoint);
 }
@@ -7674,9 +7472,7 @@
 /* Use default_breakpoint_'s, or nothing if they aren't valid.  */
 
 struct symtabs_and_lines
-decode_line_spec_1 (string, funfirstline)
-     char *string;
-     int funfirstline;
+decode_line_spec_1 (char *string, int funfirstline)
 {
   struct symtabs_and_lines sals;
   if (string == 0)
@@ -7695,7 +7491,7 @@
 }
 
 void
-_initialize_breakpoint ()
+_initialize_breakpoint (void)
 {
   struct cmd_list_element *c;
 
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index c25ab41..6fef5bd 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -280,17 +280,17 @@
     char *dll_pathname;
 
     /* Filename of a dll whose state change (e.g., load or unload)
-       triggered this catchpoint.  This field is only vaid immediately
+       triggered this catchpoint.  This field is only valid immediately
        after this catchpoint has triggered.  */
     char *triggered_dll_pathname;
 
     /* Process id of a child process whose forking triggered this
-       catchpoint.  This field is only vaid immediately after this
+       catchpoint.  This field is only valid immediately after this
        catchpoint has triggered.  */
     int forked_inferior_pid;
 
     /* Filename of a program whose exec triggered this catchpoint.
-       This field is only vaid immediately after this catchpoint has
+       This field is only valid immediately after this catchpoint has
        triggered.  */
     char *exec_pathname;
 
@@ -620,7 +620,7 @@
    cause the inferior to stop in places where this frame is visible,
    and that can cause execution control to become very confused.
 
-   Note that if a user sets breakpoints in an interactively call
+   Note that if a user sets breakpoints in an interactively called
    function, the call_disabled watchpoints will have been reenabled
    when the first such breakpoint is reached.  However, on targets
    that are unable to unwind through the call dummy frame, watches
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 70105be..24ef12a 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -171,7 +171,7 @@
   for (next = free_pendings; next; next = next1)
     {
       next1 = next->next;
-      free ((void *) next);
+      xfree ((void *) next);
     }
   free_pendings = NULL;
 
@@ -180,14 +180,14 @@
   for (next = file_symbols; next != NULL; next = next1)
     {
       next1 = next->next;
-      free ((void *) next);
+      xfree ((void *) next);
     }
   file_symbols = NULL;
 
   for (next = global_symbols; next != NULL; next = next1)
     {
       next1 = next->next;
-      free ((void *) next);
+      xfree ((void *) next);
     }
   global_symbols = NULL;
 }
@@ -205,7 +205,7 @@
   for (bnext = pending_blocks; bnext; bnext = bnext1)
     {
       bnext1 = bnext->next;
-      free ((void *) bnext);
+      xfree ((void *) bnext);
     }
 #endif
   pending_blocks = NULL;
@@ -486,7 +486,7 @@
   for (next = pending_blocks; next; next = next1)
     {
       next1 = next->next;
-      free (next);
+      xfree (next);
     }
 #endif
   pending_blocks = NULL;
@@ -684,7 +684,7 @@
     }
   name = link->name;
   subfile_stack = link->next;
-  free ((void *) link);
+  xfree ((void *) link);
   return (name);
 }
 
@@ -993,23 +993,23 @@
 	}
       if (subfile->name != NULL)
 	{
-	  free ((void *) subfile->name);
+	  xfree ((void *) subfile->name);
 	}
       if (subfile->dirname != NULL)
 	{
-	  free ((void *) subfile->dirname);
+	  xfree ((void *) subfile->dirname);
 	}
       if (subfile->line_vector != NULL)
 	{
-	  free ((void *) subfile->line_vector);
+	  xfree ((void *) subfile->line_vector);
 	}
       if (subfile->debugformat != NULL)
 	{
-	  free ((void *) subfile->debugformat);
+	  xfree ((void *) subfile->debugformat);
 	}
 
       nextsub = subfile->next;
-      free ((void *) subfile);
+      xfree ((void *) subfile);
     }
 
   /* Set this for the main source file.  */
@@ -1104,7 +1104,7 @@
    corresponding to a psymtab.  */
 
 void
-buildsym_init ()
+buildsym_init (void)
 {
   free_pendings = NULL;
   file_symbols = NULL;
@@ -1117,7 +1117,7 @@
    file, e.g. a shared library).  */
 
 void
-buildsym_new_init ()
+buildsym_new_init (void)
 {
   buildsym_init ();
 }
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 10d54e6..e505395 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -35,10 +35,7 @@
    characters and strings is language specific. */
 
 static void
-c_emit_char (c, stream, quoter)
-     register int c;
-     struct ui_file *stream;
-     int quoter;
+c_emit_char (register int c, struct ui_file *stream, int quoter)
 {
   c &= 0xFF;			/* Avoid sign bit follies */
 
@@ -83,9 +80,7 @@
 }
 
 void
-c_printchar (c, stream)
-     int c;
-     struct ui_file *stream;
+c_printchar (int c, struct ui_file *stream)
 {
   fputc_filtered ('\'', stream);
   LA_EMIT_CHAR (c, stream, '\'');
@@ -99,12 +94,8 @@
    printing LENGTH characters, or if FORCE_ELLIPSES.  */
 
 void
-c_printstr (stream, string, length, width, force_ellipses)
-     struct ui_file *stream;
-     char *string;
-     unsigned int length;
-     int width;
-     int force_ellipses;
+c_printstr (struct ui_file *stream, char *string, unsigned int length,
+	    int width, int force_ellipses)
 {
   register unsigned int i;
   unsigned int things_printed = 0;
@@ -223,9 +214,7 @@
    debugging information supplied by the compiler.  fnf@cygnus.com */
 
 struct type *
-c_create_fundamental_type (objfile, typeid)
-     struct objfile *objfile;
-     int typeid;
+c_create_fundamental_type (struct objfile *objfile, int typeid)
 {
   register struct type *type = NULL;
 
@@ -420,6 +409,7 @@
   c_builtin_types,
   range_check_off,
   type_check_off,
+  case_sensitive_on,
   c_parse,
   c_error,
   evaluate_subexp_standard,
@@ -471,6 +461,7 @@
   cplus_builtin_types,
   range_check_off,
   type_check_off,
+  case_sensitive_on,
   c_parse,
   c_error,
   evaluate_subexp_standard,
@@ -499,6 +490,7 @@
   c_builtin_types,
   range_check_off,
   type_check_off,
+  case_sensitive_on,
   c_parse,
   c_error,
   evaluate_subexp_standard,
@@ -521,7 +513,7 @@
 };
 
 void
-_initialize_c_language ()
+_initialize_c_language (void)
 {
   add_language (&c_language_defn);
   add_language (&cplus_language_defn);
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index acfbc6f..566e68f 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -58,67 +58,12 @@
 
 
 
-/* Print a description of a type in the format of a 
-   typedef for the current language.
-   NEW is the new name for a type TYPE. */
-
-void
-c_typedef_print (type, new, stream)
-     struct type *type;
-     struct symbol *new;
-     struct ui_file *stream;
-{
-  CHECK_TYPEDEF (type);
-  switch (current_language->la_language)
-    {
-#ifdef _LANG_c
-    case language_c:
-    case language_cplus:
-      fprintf_filtered (stream, "typedef ");
-      type_print (type, "", stream, 0);
-      if (TYPE_NAME ((SYMBOL_TYPE (new))) == 0
-	  || !STREQ (TYPE_NAME ((SYMBOL_TYPE (new))), SYMBOL_NAME (new)))
-	fprintf_filtered (stream, " %s", SYMBOL_SOURCE_NAME (new));
-      break;
-#endif
-#ifdef _LANG_m2
-    case language_m2:
-      fprintf_filtered (stream, "TYPE ");
-      if (!TYPE_NAME (SYMBOL_TYPE (new)) ||
-	  !STREQ (TYPE_NAME (SYMBOL_TYPE (new)), SYMBOL_NAME (new)))
-	fprintf_filtered (stream, "%s = ", SYMBOL_SOURCE_NAME (new));
-      else
-	fprintf_filtered (stream, "<builtin> = ");
-      type_print (type, "", stream, 0);
-      break;
-#endif
-#ifdef _LANG_chill
-    case language_chill:
-      fprintf_filtered (stream, "SYNMODE ");
-      if (!TYPE_NAME (SYMBOL_TYPE (new)) ||
-	  !STREQ (TYPE_NAME (SYMBOL_TYPE (new)), SYMBOL_NAME (new)))
-	fprintf_filtered (stream, "%s = ", SYMBOL_SOURCE_NAME (new));
-      else
-	fprintf_filtered (stream, "<builtin> = ");
-      type_print (type, "", stream, 0);
-      break;
-#endif
-    default:
-      error ("Language not supported.");
-    }
-  fprintf_filtered (stream, ";\n");
-}
-
 
 /* LEVEL is the depth to indent lines by.  */
 
 void
-c_print_type (type, varstring, stream, show, level)
-     struct type *type;
-     char *varstring;
-     struct ui_file *stream;
-     int show;
-     int level;
+c_print_type (struct type *type, char *varstring, struct ui_file *stream,
+	      int show, int level)
 {
   register enum type_code code;
   int demangled_args;
@@ -182,9 +127,7 @@
    derivation via protected inheritance, so gdb can print it out */
 
 static void
-cp_type_print_derivation_info (stream, type)
-     struct ui_file *stream;
-     struct type *type;
+cp_type_print_derivation_info (struct ui_file *stream, struct type *type)
 {
   char *name;
   int i;
@@ -207,12 +150,8 @@
 /* Print the C++ method arguments ARGS to the file STREAM.  */
 
 static void
-cp_type_print_method_args (args, prefix, varstring, staticp, stream)
-     struct type **args;
-     char *prefix;
-     char *varstring;
-     int staticp;
-     struct ui_file *stream;
+cp_type_print_method_args (struct type **args, char *prefix, char *varstring,
+			   int staticp, struct ui_file *stream)
 {
   int i;
 
@@ -256,11 +195,8 @@
    SHOW is always zero on recursive calls.  */
 
 void
-c_type_print_varspec_prefix (type, stream, show, passed_a_ptr)
-     struct type *type;
-     struct ui_file *stream;
-     int show;
-     int passed_a_ptr;
+c_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
+			     int show, int passed_a_ptr)
 {
   char *name;
   if (type == 0)
@@ -354,11 +290,8 @@
    NEED_SPACE = 1 indicates an initial white space is needed */
 
 static void
-c_type_print_cv_qualifier (type, stream, need_pre_space, need_post_space)
-     struct type *type;
-     struct ui_file *stream;
-     int need_pre_space;
-     int need_post_space;
+c_type_print_cv_qualifier (struct type *type, struct ui_file *stream,
+			   int need_pre_space, int need_post_space)
 {
   int flag = 0;
 
@@ -386,9 +319,7 @@
 
 
 static void
-c_type_print_args (type, stream)
-     struct type *type;
-     struct ui_file *stream;
+c_type_print_args (struct type *type, struct ui_file *stream)
 {
   int i;
   struct type **args;
@@ -567,12 +498,8 @@
    Args work like c_type_print_varspec_prefix.  */
 
 void
-c_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args)
-     struct type *type;
-     struct ui_file *stream;
-     int show;
-     int passed_a_ptr;
-     int demangled_args;
+c_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
+			     int show, int passed_a_ptr, int demangled_args)
 {
   if (type == 0)
     return;
@@ -690,11 +617,8 @@
    We increase it for some recursive calls.  */
 
 void
-c_type_print_base (type, stream, show, level)
-     struct type *type;
-     struct ui_file *stream;
-     int show;
-     int level;
+c_type_print_base (struct type *type, struct ui_file *stream, int show,
+		   int level)
 {
   register int i;
   register int len;
@@ -1071,15 +995,15 @@
 			  strncpy (demangled_no_static, demangled_no_class, length);
 			  *(demangled_no_static + length) = '\0';
 			  fputs_filtered (demangled_no_static, stream);
-			  free (demangled_no_static);
+			  xfree (demangled_no_static);
 			}
 		      else
 			fputs_filtered (demangled_no_class, stream);
-		      free (demangled_name);
+		      xfree (demangled_name);
 		    }
 
 		  if (TYPE_FN_FIELD_STUB (f, j))
-		    free (mangled_name);
+		    xfree (mangled_name);
 
 		  fprintf_filtered (stream, ";\n");
 		}
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index f9dbd03..b6e761a 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -30,6 +30,26 @@
 #include "c-lang.h"
 
 
+/* Print function pointer with inferior address ADDRESS onto stdio
+   stream STREAM.  */
+
+static void
+print_function_pointer_address (CORE_ADDR address, struct ui_file *stream)
+{
+  CORE_ADDR func_addr = CONVERT_FROM_FUNC_PTR_ADDR (address);
+
+  /* If the function pointer is represented by a description, print the
+     address of the description.  */
+  if (addressprint && func_addr != address)
+    {
+      fputs_filtered ("@", stream);
+      print_address_numeric (address, 1, stream);
+      fputs_filtered (": ", stream);
+    }
+  print_address_demangle (func_addr, stream, demangle);
+}
+
+
 /* Print data of type TYPE located at VALADDR (within GDB), which came from
    the inferior at address ADDRESS, onto stdio stream STREAM according to
    FORMAT (a letter or 0 for natural format).  The data at VALADDR is in
@@ -44,17 +64,9 @@
    The PRETTY parameter controls prettyprinting.  */
 
 int
-c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref, recurse,
-	     pretty)
-     struct type *type;
-     char *valaddr;
-     int embedded_offset;
-     CORE_ADDR address;
-     struct ui_file *stream;
-     int format;
-     int deref_ref;
-     int recurse;
-     enum val_prettyprint pretty;
+c_val_print (struct type *type, char *valaddr, int embedded_offset,
+	     CORE_ADDR address, struct ui_file *stream, int format,
+	     int deref_ref, int recurse, enum val_prettyprint pretty)
 {
   register unsigned int i = 0;	/* Number of characters printed */
   unsigned len;
@@ -137,7 +149,7 @@
 	     -fvtable_thunks.  (Otherwise, look under TYPE_CODE_STRUCT.) */
 	  CORE_ADDR addr
 	    = extract_typed_address (valaddr + embedded_offset, type);
-	  print_address_demangle (addr, stream, demangle);
+	  print_function_pointer_address (addr, stream);
 	  break;
 	}
       elttype = check_typedef (TYPE_TARGET_TYPE (type));
@@ -160,7 +172,7 @@
 	  if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
 	    {
 	      /* Try to print what function it points to.  */
-	      print_address_demangle (addr, stream, demangle);
+	      print_function_pointer_address (addr, stream);
 	      /* Return value is irrelevant except for string pointers.  */
 	      return (0);
 	    }
@@ -302,7 +314,7 @@
 	  CORE_ADDR addr
 	    = extract_typed_address (valaddr + offset, field_type);
 
-	  print_address_demangle (addr, stream, demangle);
+	  print_function_pointer_address (addr, stream);
 	}
       else
 	cp_print_value_fields (type, type, valaddr, embedded_offset, address, stream, format,
@@ -454,11 +466,8 @@
 }
 
 int
-c_value_print (val, stream, format, pretty)
-     value_ptr val;
-     struct ui_file *stream;
-     int format;
-     enum val_prettyprint pretty;
+c_value_print (value_ptr val, struct ui_file *stream, int format,
+	       enum val_prettyprint pretty)
 {
   struct type *type = VALUE_TYPE (val);
   struct type *real_type;
diff --git a/gdb/call-cmds.h b/gdb/call-cmds.h
index c96b736..b8673fa 100644
--- a/gdb/call-cmds.h
+++ b/gdb/call-cmds.h
@@ -1,3 +1,10 @@
+/* ***DEPRECATED***  The gdblib files must not be calling/using things in any
+   of the possible command languages.  If necessary, a hook (that may be
+   present or not) must be used and set to the appropriate routine by any
+   command language that cares about it.  If you are having to include this
+   file you are possibly doing things the old way.  This file will disapear.
+   2000-12-01 fnasser@redhat.com    */
+
 /* Prototypes for GDB commands that are called internally by other functions.
    Copyright 1992 Free Software Foundation, Inc.
 
diff --git a/gdb/ch-exp.c b/gdb/ch-exp.c
index 4811f7c..32eb2eb 100644
--- a/gdb/ch-exp.c
+++ b/gdb/ch-exp.c
@@ -200,7 +200,7 @@
 /*int current_token, lookahead_token; */
 
 INLINE static enum ch_terminal
-PEEK_TOKEN ()
+PEEK_TOKEN (void)
 {
   if (terminal_buffer[0] == TOKEN_NOT_READ)
     {
@@ -213,8 +213,7 @@
 #define PEEK_TOKEN1() peek_token_(1)
 #define PEEK_TOKEN2() peek_token_(2)
 static enum ch_terminal
-peek_token_ (i)
-     int i;
+peek_token_ (int i)
 {
   if (i > MAX_LOOK_AHEAD)
     internal_error ("ch-exp.c - too much lookahead");
@@ -229,9 +228,7 @@
 #if 0
 
 static void
-pushback_token (code, node)
-     enum ch_terminal code;
-     YYSTYPE node;
+pushback_token (enum ch_terminal code, YYSTYPE node)
 {
   int i;
   if (terminal_buffer[MAX_LOOK_AHEAD] != TOKEN_NOT_READ)
@@ -248,7 +245,7 @@
 #endif
 
 static void
-forward_token_ ()
+forward_token_ (void)
 {
   int i;
   for (i = 0; i < MAX_LOOK_AHEAD; i++)
@@ -264,8 +261,7 @@
    if it isn't TOKEN, the parser is broken. */
 
 static void
-require (token)
-     enum ch_terminal token;
+require (enum ch_terminal token)
 {
   if (PEEK_TOKEN () != token)
     {
@@ -275,8 +271,7 @@
 }
 
 static int
-check_token (token)
-     enum ch_terminal token;
+check_token (enum ch_terminal token)
 {
   if (PEEK_TOKEN () != token)
     return 0;
@@ -288,9 +283,7 @@
    else return 1.
  */
 static int
-expect (token, message)
-     enum ch_terminal token;
-     char *message;
+expect (enum ch_terminal token, char *message)
 {
   if (PEEK_TOKEN () != token)
     {
@@ -308,9 +301,10 @@
 }
 
 #if 0
+/* Parse a name string.  If ALLOW_ALL is 1, ALL is allowed as a postfix. */
+
 static tree
-parse_opt_name_string (allow_all)
-     int allow_all;		/* 1 if ALL is allowed as a postfix */
+parse_opt_name_string (int allow_all)
 {
   int token = PEEK_TOKEN ();
   tree name;
@@ -347,7 +341,7 @@
 }
 
 static tree
-parse_simple_name_string ()
+parse_simple_name_string (void)
 {
   int token = PEEK_TOKEN ();
   tree name;
@@ -362,7 +356,7 @@
 }
 
 static tree
-parse_name_string ()
+parse_name_string (void)
 {
   tree name = parse_opt_name_string (0);
   if (name)
@@ -377,7 +371,7 @@
    Returns if pass 2: a decl or value for identifier. */
 
 static tree
-parse_name ()
+parse_name (void)
 {
   tree name = parse_name_string ();
   if (pass == 1 || ignoring)
@@ -404,8 +398,7 @@
 
 #if 0
 static void
-pushback_paren_expr (expr)
-     tree expr;
+pushback_paren_expr (tree expr)
 {
   if (pass == 1 && !ignoring)
     expr = build1 (PAREN_EXPR, NULL_TREE, expr);
@@ -416,7 +409,7 @@
 /* Matches: <case label> */
 
 static void
-parse_case_label ()
+parse_case_label (void)
 {
   if (check_token (ELSE))
     error ("ELSE in tuples labels not implemented");
@@ -430,7 +423,7 @@
 }
 
 static int
-parse_opt_untyped_expr ()
+parse_opt_untyped_expr (void)
 {
   switch (PEEK_TOKEN ())
     {
@@ -445,7 +438,7 @@
 }
 
 static void
-parse_unary_call ()
+parse_unary_call (void)
 {
   FORWARD_TOKEN ();
   expect ('(', NULL);
@@ -458,7 +451,7 @@
 #if 0
 
 static struct type *
-parse_mode_call ()
+parse_mode_call (void)
 {
   struct type *type;
   FORWARD_TOKEN ();
@@ -474,7 +467,7 @@
 #endif
 
 static struct type *
-parse_mode_or_normal_call ()
+parse_mode_or_normal_call (void)
 {
   struct type *type;
   FORWARD_TOKEN ();
@@ -497,7 +490,7 @@
    Assume we have parsed the function, and are at the '('. */
 
 static void
-parse_call ()
+parse_call (void)
 {
   int arg_count;
   require ('(');
@@ -534,7 +527,7 @@
 }
 
 static void
-parse_named_record_element ()
+parse_named_record_element (void)
 {
   struct stoken label;
   char buf[256];
@@ -556,8 +549,7 @@
 /* Returns one or more TREE_LIST nodes, in reverse order. */
 
 static void
-parse_tuple_element (type)
-     struct type *type;
+parse_tuple_element (struct type *type)
 {
   if (PEEK_TOKEN () == DOT_FIELD_NAME)
     {
@@ -622,8 +614,7 @@
 /* Matches:  a COMMA-separated list of tuple elements.
    Returns a list (of TREE_LIST nodes). */
 static void
-parse_opt_element_list (type)
-     struct type *type;
+parse_opt_element_list (struct type *type)
 {
   arglist_len = 0;
   if (PEEK_TOKEN () == ']')
@@ -643,8 +634,7 @@
    If modename is non-NULL it prefixed the tuple.  */
 
 static void
-parse_tuple (mode)
-     struct type *mode;
+parse_tuple (struct type *mode)
 {
   struct type *type;
   if (mode)
@@ -672,7 +662,7 @@
 }
 
 static void
-parse_primval ()
+parse_primval (void)
 {
   struct type *type;
   enum exp_opcode op;
@@ -942,7 +932,7 @@
 }
 
 static void
-parse_operand6 ()
+parse_operand6 (void)
 {
   if (check_token (RECEIVE))
     {
@@ -959,7 +949,7 @@
 }
 
 static void
-parse_operand5 ()
+parse_operand5 (void)
 {
   enum exp_opcode op;
   /* We are supposed to be looking for a <string repetition operator>,
@@ -990,7 +980,7 @@
 }
 
 static void
-parse_operand4 ()
+parse_operand4 (void)
 {
   enum exp_opcode op;
   parse_operand5 ();
@@ -1020,7 +1010,7 @@
 }
 
 static void
-parse_operand3 ()
+parse_operand3 (void)
 {
   enum exp_opcode op;
   parse_operand4 ();
@@ -1047,7 +1037,7 @@
 }
 
 static void
-parse_operand2 ()
+parse_operand2 (void)
 {
   enum exp_opcode op;
   parse_operand3 ();
@@ -1091,7 +1081,7 @@
 }
 
 static void
-parse_operand1 ()
+parse_operand1 (void)
 {
   enum exp_opcode op;
   parse_operand2 ();
@@ -1115,7 +1105,7 @@
 }
 
 static void
-parse_operand0 ()
+parse_operand0 (void)
 {
   enum exp_opcode op;
   parse_operand1 ();
@@ -1142,7 +1132,7 @@
 }
 
 static void
-parse_expr ()
+parse_expr (void)
 {
   parse_operand0 ();
   if (check_token (GDB_ASSIGNMENT))
@@ -1153,14 +1143,14 @@
 }
 
 static void
-parse_then_alternative ()
+parse_then_alternative (void)
 {
   expect (THEN, "missing 'THEN' in 'IF' expression");
   parse_expr ();
 }
 
 static void
-parse_else_alternative ()
+parse_else_alternative (void)
 {
   if (check_token (ELSIF))
     parse_if_expression_body ();
@@ -1173,7 +1163,7 @@
 /* Matches: <boolean expression> <then alternative> <else alternative> */
 
 static void
-parse_if_expression_body ()
+parse_if_expression_body (void)
 {
   parse_expr ();
   parse_then_alternative ();
@@ -1182,7 +1172,7 @@
 }
 
 static void
-parse_if_expression ()
+parse_if_expression (void)
 {
   require (IF);
   parse_if_expression_body ();
@@ -1196,7 +1186,7 @@
    You should call convert() to fix up the <untyped_expr>. */
 
 static void
-parse_untyped_expr ()
+parse_untyped_expr (void)
 {
   switch (PEEK_TOKEN ())
     {
@@ -1226,7 +1216,7 @@
 }
 
 int
-chill_parse ()
+chill_parse (void)
 {
   terminal_buffer[0] = TOKEN_NOT_READ;
   if (PEEK_TOKEN () == TYPENAME && PEEK_TOKEN1 () == END_TOKEN)
@@ -1271,8 +1261,7 @@
    on demand. */
 
 static void
-growbuf_by_size (count)
-     int count;
+growbuf_by_size (int count)
 {
   int growby;
 
@@ -1293,7 +1282,7 @@
    in symbol table lookups.  If not successful, returns NULL. */
 
 static char *
-match_simple_name_string ()
+match_simple_name_string (void)
 {
   char *tokptr = lexptr;
 
@@ -1321,10 +1310,7 @@
    digits we have encountered. */
 
 static int
-decode_integer_value (base, tokptrptr, ivalptr)
-     int base;
-     char **tokptrptr;
-     LONGEST *ivalptr;
+decode_integer_value (int base, char **tokptrptr, LONGEST *ivalptr)
 {
   char *tokptr = *tokptrptr;
   int temp;
@@ -1395,9 +1381,7 @@
 }
 
 static int
-decode_integer_literal (valptr, tokptrptr)
-     LONGEST *valptr;
-     char **tokptrptr;
+decode_integer_literal (LONGEST *valptr, char **tokptrptr)
 {
   char *tokptr = *tokptrptr;
   int base = 0;
@@ -1480,7 +1464,7 @@
    legal floating point value. */
 
 static enum ch_terminal
-match_float_literal ()
+match_float_literal (void)
 {
   char *tokptr = lexptr;
   char *buf;
@@ -1610,7 +1594,7 @@
    a string, it is simply doubled (I.E. "this""is""one""string") */
 
 static enum ch_terminal
-match_string_literal ()
+match_string_literal (void)
 {
   char *tokptr = lexptr;
   int in_ctrlseq = 0;
@@ -1706,7 +1690,7 @@
  */
 
 static enum ch_terminal
-match_character_literal ()
+match_character_literal (void)
 {
   char *tokptr = lexptr;
   LONGEST ival = 0;
@@ -1788,7 +1772,7 @@
    in any integer literal. */
 
 static enum ch_terminal
-match_integer_literal ()
+match_integer_literal (void)
 {
   char *tokptr = lexptr;
   LONGEST ival;
@@ -1817,7 +1801,7 @@
    in any bit-string literal. */
 
 static enum ch_terminal
-match_bitstring_literal ()
+match_bitstring_literal (void)
 {
   register char *tokptr = lexptr;
   int bitoffset = 0;
@@ -1989,7 +1973,7 @@
    operators used are compatible.  */
 
 static enum ch_terminal
-ch_lex ()
+ch_lex (void)
 {
   unsigned int i;
   enum ch_terminal token;
@@ -2226,9 +2210,8 @@
 }
 
 static void
-write_lower_upper_value (opcode, type)
-     enum exp_opcode opcode;	/* Either UNOP_LOWER or UNOP_UPPER */
-     struct type *type;
+write_lower_upper_value (enum exp_opcode opcode,	/* Either UNOP_LOWER or UNOP_UPPER */
+			 struct type *type)
 {
   if (type == NULL)
     write_exp_elt_opcode (opcode);
@@ -2244,8 +2227,7 @@
 }
 
 void
-chill_error (msg)
-     char *msg;
+chill_error (char *msg)
 {
   /* Never used. */
 }
diff --git a/gdb/ch-lang.c b/gdb/ch-lang.c
index 44e621e..c8e12be 100644
--- a/gdb/ch-lang.c
+++ b/gdb/ch-lang.c
@@ -53,8 +53,7 @@
    characters to derive the demangled form. */
 
 char *
-chill_demangle (mangled)
-     const char *mangled;
+chill_demangle (const char *mangled)
 {
   const char *joiner = NULL;
   char *demangled;
@@ -81,9 +80,7 @@
 }
 
 static void
-chill_printchar (c, stream)
-     register int c;
-     struct ui_file *stream;
+chill_printchar (register int c, struct ui_file *stream)
 {
   c &= 0xFF;			/* Avoid sign bit follies */
 
@@ -112,12 +109,8 @@
  */
 
 static void
-chill_printstr (stream, string, length, width, force_ellipses)
-     struct ui_file *stream;
-     char *string;
-     unsigned int length;
-     int width;
-     int force_ellipses;
+chill_printstr (struct ui_file *stream, char *string, unsigned int length,
+		int width, int force_ellipses)
 {
   register unsigned int i;
   unsigned int things_printed = 0;
@@ -228,9 +221,7 @@
 }
 
 static struct type *
-chill_create_fundamental_type (objfile, typeid)
-     struct objfile *objfile;
-     int typeid;
+chill_create_fundamental_type (struct objfile *objfile, int typeid)
 {
   register struct type *type = NULL;
 
@@ -346,10 +337,8 @@
    *RESULT_TYPE is the appropriate type for the result. */
 
 LONGEST
-type_lower_upper (op, type, result_type)
-     enum exp_opcode op;	/* Either UNOP_LOWER or UNOP_UPPER */
-     struct type *type;
-     struct type **result_type;
+type_lower_upper (enum exp_opcode op,	/* Either UNOP_LOWER or UNOP_UPPER */
+		  struct type *type, struct type **result_type)
 {
   LONGEST low, high;
   *result_type = type;
@@ -400,8 +389,7 @@
 }
 
 static value_ptr
-value_chill_length (val)
-     value_ptr val;
+value_chill_length (value_ptr val)
 {
   LONGEST tmp;
   struct type *type = VALUE_TYPE (val);
@@ -429,8 +417,7 @@
 }
 
 static value_ptr
-value_chill_card (val)
-     value_ptr val;
+value_chill_card (value_ptr val)
 {
   LONGEST tmp = 0;
   struct type *type = VALUE_TYPE (val);
@@ -454,9 +441,7 @@
 }
 
 static value_ptr
-value_chill_max_min (op, val)
-     enum exp_opcode op;
-     value_ptr val;
+value_chill_max_min (enum exp_opcode op, value_ptr val)
 {
   LONGEST tmp = 0;
   struct type *type = VALUE_TYPE (val);
@@ -509,11 +494,9 @@
 }
 
 static value_ptr
-evaluate_subexp_chill (expect_type, exp, pos, noside)
-     struct type *expect_type;
-     register struct expression *exp;
-     register int *pos;
-     enum noside noside;
+evaluate_subexp_chill (struct type *expect_type,
+		       register struct expression *exp, register int *pos,
+		       enum noside noside)
 {
   int pc = *pos;
   struct type *type;
@@ -625,6 +608,7 @@
   chill_builtin_types,
   range_check_on,
   type_check_on,
+  case_sensitive_on,
   chill_parse,			/* parser */
   chill_error,			/* parser error function */
   evaluate_subexp_chill,
@@ -649,7 +633,7 @@
 /* Initialization for Chill */
 
 void
-_initialize_chill_language ()
+_initialize_chill_language (void)
 {
   builtin_type_chill_bool =
     init_type (TYPE_CODE_BOOL, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
diff --git a/gdb/ch-typeprint.c b/gdb/ch-typeprint.c
index 2a655ab..dc22957 100644
--- a/gdb/ch-typeprint.c
+++ b/gdb/ch-typeprint.c
@@ -40,12 +40,8 @@
 static void chill_type_print_base (struct type *, struct ui_file *, int, int);
 
 void
-chill_print_type (type, varstring, stream, show, level)
-     struct type *type;
-     char *varstring;
-     struct ui_file *stream;
-     int show;
-     int level;
+chill_print_type (struct type *type, char *varstring, struct ui_file *stream,
+		  int show, int level)
 {
   if (varstring != NULL && *varstring != '\0')
     {
@@ -68,11 +64,8 @@
    We increase it for some recursive calls.  */
 
 static void
-chill_type_print_base (type, stream, show, level)
-     struct type *type;
-     struct ui_file *stream;
-     int show;
-     int level;
+chill_type_print_base (struct type *type, struct ui_file *stream, int show,
+		       int level)
 {
   register int len;
   register int i;
diff --git a/gdb/ch-valprint.c b/gdb/ch-valprint.c
index 6fc3985..60fcaca 100644
--- a/gdb/ch-valprint.c
+++ b/gdb/ch-valprint.c
@@ -53,10 +53,7 @@
    decimal integer values. */
 
 static void
-chill_print_type_scalar (type, val, stream)
-     struct type *type;
-     LONGEST val;
-     struct ui_file *stream;
+chill_print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
 {
   switch (TYPE_CODE (type))
     {
@@ -99,16 +96,10 @@
    element indexes (in Chill syntax). */
 
 static void
-chill_val_print_array_elements (type, valaddr, address, stream,
-				format, deref_ref, recurse, pretty)
-     struct type *type;
-     char *valaddr;
-     CORE_ADDR address;
-     struct ui_file *stream;
-     int format;
-     int deref_ref;
-     int recurse;
-     enum val_prettyprint pretty;
+chill_val_print_array_elements (struct type *type, char *valaddr,
+				CORE_ADDR address, struct ui_file *stream,
+				int format, int deref_ref, int recurse,
+				enum val_prettyprint pretty)
 {
   unsigned int i = 0;
   unsigned int things_printed = 0;
@@ -199,17 +190,9 @@
    The PRETTY parameter controls prettyprinting.  */
 
 int
-chill_val_print (type, valaddr, embedded_offset, address,
-		 stream, format, deref_ref, recurse, pretty)
-     struct type *type;
-     char *valaddr;
-     int embedded_offset;
-     CORE_ADDR address;
-     struct ui_file *stream;
-     int format;
-     int deref_ref;
-     int recurse;
-     enum val_prettyprint pretty;
+chill_val_print (struct type *type, char *valaddr, int embedded_offset,
+		 CORE_ADDR address, struct ui_file *stream, int format,
+		 int deref_ref, int recurse, enum val_prettyprint pretty)
 {
   LONGEST val;
   unsigned int i = 0;		/* Number of characters printed.  */
@@ -514,15 +497,9 @@
    should not print, or zero if called from top level.  */
 
 static void
-chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
-			  dont_print)
-     struct type *type;
-     char *valaddr;
-     struct ui_file *stream;
-     int format;
-     int recurse;
-     enum val_prettyprint pretty;
-     struct type **dont_print;
+chill_print_value_fields (struct type *type, char *valaddr,
+			  struct ui_file *stream, int format, int recurse,
+			  enum val_prettyprint pretty, struct type **dont_print)
 {
   int i, len;
   int fields_seen = 0;
@@ -586,11 +563,8 @@
 }
 
 int
-chill_value_print (val, stream, format, pretty)
-     value_ptr val;
-     struct ui_file *stream;
-     int format;
-     enum val_prettyprint pretty;
+chill_value_print (value_ptr val, struct ui_file *stream, int format,
+		   enum val_prettyprint pretty)
 {
   struct type *type = VALUE_TYPE (val);
   struct type *real_type = check_typedef (type);
diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index cfe6a21..127f77d 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -102,18 +102,14 @@
 /* Mark beginning of a table */
 
 void
-cli_table_begin (uiout, nbrofcols, tblid)
-     struct ui_out *uiout;
-     int nbrofcols;
-     char *tblid;
+cli_table_begin (struct ui_out *uiout, int nbrofcols, char *tblid)
 {
 }
 
 /* Mark beginning of a table body */
 
 void
-cli_table_body (uiout)
-     struct ui_out *uiout;
+cli_table_body (struct ui_out *uiout)
 {
   /* first, close the table header line */
   cli_text (uiout, "\n");
@@ -122,19 +118,15 @@
 /* Mark end of a table */
 
 void
-cli_table_end (uiout)
-     struct ui_out *uiout;
+cli_table_end (struct ui_out *uiout)
 {
 }
 
 /* Specify table header */
 
 void
-cli_table_header (uiout, width, alignment, colhdr)
-     struct ui_out *uiout;
-     int width;
-     enum ui_align alignment;
-     char *colhdr;
+cli_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
+		  char *colhdr)
 {
   cli_field_string (uiout, 0, width, alignment, 0, colhdr);
 }
@@ -142,32 +134,22 @@
 /* Mark beginning of a list */
 
 void
-cli_list_begin (uiout, list_flag, lstid)
-     struct ui_out *uiout;
-     int list_flag;
-     char *lstid;
+cli_list_begin (struct ui_out *uiout, int list_flag, char *lstid)
 {
 }
 
 /* Mark end of a list */
 
 void
-cli_list_end (uiout, list_flag)
-     struct ui_out *uiout;
-     int list_flag;
+cli_list_end (struct ui_out *uiout, int list_flag)
 {
 }
 
 /* output an int field */
 
 void
-cli_field_int (uiout, fldno, width, alignment, fldname, value)
-     struct ui_out *uiout;
-     int fldno;
-     int width;
-     enum ui_align alignment;
-     char *fldname;
-     int value;
+cli_field_int (struct ui_out *uiout, int fldno, int width,
+	       enum ui_align alignment, char *fldname, int value)
 {
   char buffer[20];		/* FIXME: how many chars long a %d can become? */
 
@@ -178,12 +160,8 @@
 /* used to ommit a field */
 
 void
-cli_field_skip (uiout, fldno, width, alignment, fldname)
-     struct ui_out *uiout;
-     int fldno;
-     int width;
-     enum ui_align alignment;
-     char *fldname;
+cli_field_skip (struct ui_out *uiout, int fldno, int width,
+		enum ui_align alignment, char *fldname)
 {
   cli_field_string (uiout, fldno, width, alignment, fldname, "");
 }
@@ -251,18 +229,14 @@
 }
 
 void
-cli_spaces (uiout, numspaces)
-     struct ui_out *uiout;
-     int numspaces;
+cli_spaces (struct ui_out *uiout, int numspaces)
 {
   struct ui_out_data *data = ui_out_data (uiout);
   print_spaces_filtered (numspaces, data->stream);
 }
 
 void
-cli_text (uiout, string)
-     struct ui_out *uiout;
-     char *string;
+cli_text (struct ui_out *uiout, char *string)
 {
   struct ui_out_data *data = ui_out_data (uiout);
   fputs_filtered (string, data->stream);
@@ -277,16 +251,13 @@
 }
 
 void
-cli_wrap_hint (uiout, identstring)
-     struct ui_out *uiout;
-     char *identstring;
+cli_wrap_hint (struct ui_out *uiout, char *identstring)
 {
   wrap_here (identstring);
 }
 
 void
-cli_flush (uiout)
-     struct ui_out *uiout;
+cli_flush (struct ui_out *uiout)
 {
   struct ui_out_data *data = ui_out_data (uiout);
   gdb_flush (data->stream);
@@ -314,7 +285,7 @@
 /* access to ui_out format private members */
 
 static void
-field_separator ()
+field_separator (void)
 {
   struct ui_out_data *data = ui_out_data (uiout);
   fputc_filtered (' ', data->stream);
@@ -334,7 +305,7 @@
 
 /* standard gdb initialization hook */
 void
-_initialize_cli_out ()
+_initialize_cli_out (void)
 {
   /* nothing needs to be done */
 }
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
new file mode 100644
index 0000000..edf9b4d
--- /dev/null
+++ b/gdb/cli/cli-cmds.c
@@ -0,0 +1,801 @@
+/* GDB CLI commands.
+   Copyright 2000 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 "completer.h"
+#include "target.h"	 /* For baud_rate, remote_debug and remote_timeout */
+#include "gdb_wait.h"		/* For shell escape implementation */
+#include "gnu-regex.h"		/* Used by apropos_command */
+
+#ifdef UI_OUT
+#include "ui-out.h"
+#endif
+
+#include "top.h"
+#include "cli/cli-decode.h"
+#include "cli/cli-script.h"
+#include "cli/cli-setshow.h"
+#include "cli/cli-cmds.h"
+
+#ifndef GDBINIT_FILENAME
+#define GDBINIT_FILENAME        ".gdbinit"
+#endif
+
+/* FIXME: this should be auto-configured!  */
+#ifdef __MSDOS__
+# define CANT_FORK
+#endif
+
+/* From gdb/top.c */
+
+extern void dont_repeat (void);
+
+extern void set_verbose (char *, int, struct cmd_list_element *);
+
+extern void show_history (char *, int);
+
+extern void set_history (char *, int);
+
+extern void show_commands (char *, int);
+
+/* Prototypes for local functions */
+
+static void complete_command (char *, int);
+
+static void echo_command (char *, int);
+
+static void pwd_command (char *, int);
+
+static void show_version (char *, int);
+
+static void validate_comname (char *);
+
+static void help_command (char *, int);
+
+static void show_command (char *, int);
+
+static void info_command (char *, int);
+
+static void show_debug (char *, int);
+
+static void set_debug (char *, int);
+
+static void show_user (char *, int);
+
+static void make_command (char *, int);
+
+static void shell_escape (char *, int);
+
+void apropos_command (char *, int);
+
+/* Define all cmd_list_elements.  */
+
+/* Chain containing all defined commands.  */
+
+struct cmd_list_element *cmdlist;
+
+/* Chain containing all defined info subcommands.  */
+
+struct cmd_list_element *infolist;
+
+/* Chain containing all defined enable subcommands. */
+
+struct cmd_list_element *enablelist;
+
+/* Chain containing all defined disable subcommands. */
+
+struct cmd_list_element *disablelist;
+
+/* Chain containing all defined toggle subcommands. */
+
+struct cmd_list_element *togglelist;
+
+/* Chain containing all defined stop subcommands. */
+
+struct cmd_list_element *stoplist;
+
+/* Chain containing all defined delete subcommands. */
+
+struct cmd_list_element *deletelist;
+
+/* Chain containing all defined "enable breakpoint" subcommands. */
+
+struct cmd_list_element *enablebreaklist;
+
+/* Chain containing all defined set subcommands */
+
+struct cmd_list_element *setlist;
+
+/* Chain containing all defined unset subcommands */
+
+struct cmd_list_element *unsetlist;
+
+/* Chain containing all defined show subcommands.  */
+
+struct cmd_list_element *showlist;
+
+/* Chain containing all defined \"set history\".  */
+
+struct cmd_list_element *sethistlist;
+
+/* Chain containing all defined \"show history\".  */
+
+struct cmd_list_element *showhistlist;
+
+/* Chain containing all defined \"unset history\".  */
+
+struct cmd_list_element *unsethistlist;
+
+/* Chain containing all defined maintenance subcommands. */
+
+struct cmd_list_element *maintenancelist;
+
+/* Chain containing all defined "maintenance info" subcommands. */
+
+struct cmd_list_element *maintenanceinfolist;
+
+/* Chain containing all defined "maintenance print" subcommands. */
+
+struct cmd_list_element *maintenanceprintlist;
+
+struct cmd_list_element *setprintlist;
+
+struct cmd_list_element *showprintlist;
+
+struct cmd_list_element *setdebuglist;
+
+struct cmd_list_element *showdebuglist;
+
+struct cmd_list_element *setchecklist;
+
+struct cmd_list_element *showchecklist;
+
+/* Utility used everywhere when at least one argument is needed and
+   none is supplied. */
+
+void
+error_no_arg (char *why)
+{
+  error ("Argument required (%s).", why);
+}
+
+/* The "info" command is defined as a prefix, with allow_unknown = 0.
+   Therefore, its own definition is called only for "info" with no args.  */
+
+/* ARGSUSED */
+static void
+info_command (char *arg, int from_tty)
+{
+  printf_unfiltered ("\"info\" must be followed by the name of an info command.\n");
+  help_list (infolist, "info ", -1, gdb_stdout);
+}
+
+/* The "show" command with no arguments shows all the settings.  */
+
+/* ARGSUSED */
+static void
+show_command (char *arg, int from_tty)
+{
+  cmd_show_list (showlist, from_tty, "");
+}
+
+/* Provide documentation on command or list given by COMMAND.  FROM_TTY
+   is ignored.  */
+
+/* ARGSUSED */
+static void
+help_command (char *command, int from_tty)
+{
+  help_cmd (command, gdb_stdout);
+}
+
+/* The "complete" command is used by Emacs to implement completion.  */
+
+/* ARGSUSED */
+static void
+complete_command (char *arg, int from_tty)
+{
+  int i;
+  int argpoint;
+  char *completion;
+
+  dont_repeat ();
+
+  if (arg == NULL)
+    arg = "";
+  argpoint = strlen (arg);
+
+  for (completion = line_completion_function (arg, i = 0, arg, argpoint);
+       completion;
+       completion = line_completion_function (arg, ++i, arg, argpoint))
+    {
+      printf_unfiltered ("%s\n", completion);
+      xfree (completion);
+    }
+}
+
+int is_complete_command (void (*func) (char *args, int from_tty))
+{
+  return func == complete_command;
+}
+
+/* ARGSUSED */
+static void
+show_version (char *args, int from_tty)
+{
+  immediate_quit++;
+  print_gdb_version (gdb_stdout);
+  printf_filtered ("\n");
+  immediate_quit--;
+}
+
+/* Handle the quit command.  */
+
+void
+quit_command (char *args, int from_tty)
+{
+  if (!quit_confirm ())
+    error ("Not confirmed.");
+  quit_force (args, from_tty);
+}
+
+/* ARGSUSED */
+static void
+pwd_command (char *args, int from_tty)
+{
+  if (args)
+    error ("The \"pwd\" command does not take an argument: %s", args);
+  getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+
+  if (!STREQ (gdb_dirbuf, current_directory))
+    printf_unfiltered ("Working directory %s\n (canonically %s).\n",
+		       current_directory, gdb_dirbuf);
+  else
+    printf_unfiltered ("Working directory %s.\n", current_directory);
+}
+
+void
+cd_command (char *dir, int from_tty)
+{
+  int len;
+  /* Found something other than leading repetitions of "/..".  */
+  int found_real_path;
+  char *p;
+
+  /* If the new directory is absolute, repeat is a no-op; if relative,
+     repeat might be useful but is more likely to be a mistake.  */
+  dont_repeat ();
+
+  if (dir == 0)
+    error_no_arg ("new working directory");
+
+  dir = tilde_expand (dir);
+  make_cleanup (xfree, dir);
+
+  if (chdir (dir) < 0)
+    perror_with_name (dir);
+
+#if defined(_WIN32) || defined(__MSDOS__)
+  /* There's too much mess with DOSish names like "d:", "d:.",
+     "d:./foo" etc.  Instead of having lots of special #ifdef'ed code,
+     simply get the canonicalized name of the current directory.  */
+  dir = getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+#endif
+
+  len = strlen (dir);
+  if (SLASH_P (dir[len - 1]))
+    {
+      /* Remove the trailing slash unless this is a root directory
+         (including a drive letter on non-Unix systems).  */
+      if (!(len == 1)		/* "/" */
+#if defined(_WIN32) || defined(__MSDOS__)
+	  && !(!SLASH_P (*dir) && ROOTED_P (dir) && len <= 3)	/* "d:/" */
+#endif
+	  )
+	len--;
+    }
+
+  dir = savestring (dir, len);
+  if (ROOTED_P (dir))
+    current_directory = dir;
+  else
+    {
+      if (SLASH_P (current_directory[strlen (current_directory) - 1]))
+	current_directory = concat (current_directory, dir, NULL);
+      else
+	current_directory = concat (current_directory, SLASH_STRING, dir, NULL);
+      xfree (dir);
+    }
+
+  /* Now simplify any occurrences of `.' and `..' in the pathname.  */
+
+  found_real_path = 0;
+  for (p = current_directory; *p;)
+    {
+      if (SLASH_P (p[0]) && p[1] == '.' && (p[2] == 0 || SLASH_P (p[2])))
+	strcpy (p, p + 2);
+      else if (SLASH_P (p[0]) && p[1] == '.' && p[2] == '.'
+	       && (p[3] == 0 || SLASH_P (p[3])))
+	{
+	  if (found_real_path)
+	    {
+	      /* Search backwards for the directory just before the "/.."
+	         and obliterate it and the "/..".  */
+	      char *q = p;
+	      while (q != current_directory && !SLASH_P (q[-1]))
+		--q;
+
+	      if (q == current_directory)
+		/* current_directory is
+		   a relative pathname ("can't happen"--leave it alone).  */
+		++p;
+	      else
+		{
+		  strcpy (q - 1, p + 3);
+		  p = q - 1;
+		}
+	    }
+	  else
+	    /* We are dealing with leading repetitions of "/..", for example
+	       "/../..", which is the Mach super-root.  */
+	    p += 3;
+	}
+      else
+	{
+	  found_real_path = 1;
+	  ++p;
+	}
+    }
+
+  forget_cached_source_info ();
+
+  if (from_tty)
+    pwd_command ((char *) 0, 1);
+}
+
+void
+source_command (char *args, int from_tty)
+{
+  FILE *stream;
+  struct cleanup *old_cleanups;
+  char *file = args;
+
+  if (file == NULL)
+    {
+      error ("source command requires pathname of file to source.");
+    }
+
+  file = tilde_expand (file);
+  old_cleanups = make_cleanup (xfree, file);
+
+  stream = fopen (file, FOPEN_RT);
+  if (!stream)
+    {
+      if (from_tty)
+	perror_with_name (file);
+      else
+	return;
+    }
+
+  script_from_file (stream, file);
+
+  do_cleanups (old_cleanups);
+}
+
+/* ARGSUSED */
+static void
+echo_command (char *text, int from_tty)
+{
+  char *p = text;
+  register int c;
+
+  if (text)
+    while ((c = *p++) != '\0')
+      {
+	if (c == '\\')
+	  {
+	    /* \ at end of argument is used after spaces
+	       so they won't be lost.  */
+	    if (*p == 0)
+	      return;
+
+	    c = parse_escape (&p);
+	    if (c >= 0)
+	      printf_filtered ("%c", c);
+	  }
+	else
+	  printf_filtered ("%c", c);
+      }
+
+  /* Force this output to appear now.  */
+  wrap_here ("");
+  gdb_flush (gdb_stdout);
+}
+
+/* ARGSUSED */
+static void
+shell_escape (char *arg, int from_tty)
+{
+#ifdef CANT_FORK
+  /* If ARG is NULL, they want an inferior shell, but `system' just
+     reports if the shell is available when passed a NULL arg.  */
+  int rc = system (arg ? arg : "");
+
+  if (!arg)
+    arg = "inferior shell";
+
+  if (rc == -1)
+    {
+      fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", arg,
+			  safe_strerror (errno));
+      gdb_flush (gdb_stderr);
+    }
+  else if (rc)
+    {
+      fprintf_unfiltered (gdb_stderr, "%s exited with status %d\n", arg, rc);
+      gdb_flush (gdb_stderr);
+    }
+#ifdef __DJGPP__
+  /* Make sure to return to the directory GDB thinks it is, in case the
+     shell command we just ran changed it.  */
+  chdir (current_directory);
+#endif
+#else /* Can fork.  */
+  int rc, status, pid;
+  char *p, *user_shell;
+
+  if ((user_shell = (char *) getenv ("SHELL")) == NULL)
+    user_shell = "/bin/sh";
+
+  /* Get the name of the shell for arg0 */
+  if ((p = strrchr (user_shell, '/')) == NULL)
+    p = user_shell;
+  else
+    p++;			/* Get past '/' */
+
+  if ((pid = fork ()) == 0)
+    {
+      if (!arg)
+	execl (user_shell, p, 0);
+      else
+	execl (user_shell, p, "-c", arg, 0);
+
+      fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", user_shell,
+			  safe_strerror (errno));
+      gdb_flush (gdb_stderr);
+      _exit (0177);
+    }
+
+  if (pid != -1)
+    while ((rc = wait (&status)) != pid && rc != -1)
+      ;
+  else
+    error ("Fork failed");
+#endif /* Can fork.  */
+}
+
+static void
+make_command (char *arg, int from_tty)
+{
+  char *p;
+
+  if (arg == 0)
+    p = "make";
+  else
+    {
+      p = xmalloc (sizeof ("make ") + strlen (arg));
+      strcpy (p, "make ");
+      strcpy (p + sizeof ("make ") - 1, arg);
+    }
+
+  shell_escape (p, from_tty);
+}
+
+/* ARGSUSED */
+static void
+show_user (char *args, int from_tty)
+{
+  struct cmd_list_element *c;
+  extern struct cmd_list_element *cmdlist;
+
+  if (args)
+    {
+      c = lookup_cmd (&args, cmdlist, "", 0, 1);
+      if (c->class != class_user)
+	error ("Not a user command.");
+      show_user_1 (c, gdb_stdout);
+    }
+  else
+    {
+      for (c = cmdlist; c; c = c->next)
+	{
+	  if (c->class == class_user)
+	    show_user_1 (c, gdb_stdout);
+	}
+    }
+}
+
+/* Search through names of commands and documentations for a certain
+   regular expression.
+*/
+void 
+apropos_command (char *searchstr, int from_tty)
+{
+  extern struct cmd_list_element *cmdlist; /*This is the main command list*/
+  regex_t pattern;
+  char *pattern_fastmap;
+  char errorbuffer[512];
+  pattern_fastmap=calloc(256,sizeof(char));
+  if (searchstr == NULL)
+      error("REGEXP string is empty");
+
+  if (regcomp(&pattern,searchstr,REG_ICASE) == 0)
+    {
+      pattern.fastmap=pattern_fastmap;
+      re_compile_fastmap(&pattern);
+      apropos_cmd (gdb_stdout,cmdlist,&pattern,"");
+    }
+  else
+    {
+      regerror(regcomp(&pattern,searchstr,REG_ICASE),NULL,errorbuffer,512);
+      error("Error in regular expression:%s",errorbuffer);
+    }
+  free(pattern_fastmap);
+}
+
+static void
+set_debug (char *arg, int from_tty)
+{
+  printf_unfiltered ("\"set debug\" must be followed by the name of a print subcommand.\n");
+  help_list (setdebuglist, "set debug ", -1, gdb_stdout);
+}
+
+static void
+show_debug (char *args, int from_tty)
+{
+  cmd_show_list (showdebuglist, from_tty, "");
+}
+
+void
+init_cmd_lists (void)
+{
+  cmdlist = NULL;
+  infolist = NULL;
+  enablelist = NULL;
+  disablelist = NULL;
+  togglelist = NULL;
+  stoplist = NULL;
+  deletelist = NULL;
+  enablebreaklist = NULL;
+  setlist = NULL;
+  unsetlist = NULL;
+  showlist = NULL;
+  sethistlist = NULL;
+  showhistlist = NULL;
+  unsethistlist = NULL;
+  maintenancelist = NULL;
+  maintenanceinfolist = NULL;
+  maintenanceprintlist = NULL;
+  setprintlist = NULL;
+  showprintlist = NULL;
+  setchecklist = NULL;
+  showchecklist = NULL;
+}
+
+
+void
+init_cli_cmds (void)
+{
+  struct cmd_list_element *c;
+
+  /* Define the classes of commands.
+     They will appear in the help list in the reverse of this order.  */
+
+  add_cmd ("internals", class_maintenance, NO_FUNCTION,
+	   "Maintenance commands.\n\
+Some gdb commands are provided just for use by gdb maintainers.\n\
+These commands are subject to frequent change, and may not be as\n\
+well documented as user commands.",
+	   &cmdlist);
+  add_cmd ("obscure", class_obscure, NO_FUNCTION, "Obscure features.", &cmdlist);
+  add_cmd ("aliases", class_alias, NO_FUNCTION, "Aliases of other commands.", &cmdlist);
+  add_cmd ("user-defined", class_user, NO_FUNCTION, "User-defined commands.\n\
+The commands in this class are those defined by the user.\n\
+Use the \"define\" command to define a command.", &cmdlist);
+  add_cmd ("support", class_support, NO_FUNCTION, "Support facilities.", &cmdlist);
+  if (!dbx_commands)
+    add_cmd ("status", class_info, NO_FUNCTION, "Status inquiries.", &cmdlist);
+  add_cmd ("files", class_files, NO_FUNCTION, "Specifying and examining files.", &cmdlist);
+  add_cmd ("breakpoints", class_breakpoint, NO_FUNCTION, "Making program stop at certain points.", &cmdlist);
+  add_cmd ("data", class_vars, NO_FUNCTION, "Examining data.", &cmdlist);
+  add_cmd ("stack", class_stack, NO_FUNCTION, "Examining the stack.\n\
+The stack is made up of stack frames.  Gdb assigns numbers to stack frames\n\
+counting from zero for the innermost (currently executing) frame.\n\n\
+At any time gdb identifies one frame as the \"selected\" frame.\n\
+Variable lookups are done with respect to the selected frame.\n\
+When the program being debugged stops, gdb selects the innermost frame.\n\
+The commands below can be used to select other frames by number or address.",
+	   &cmdlist);
+  add_cmd ("running", class_run, NO_FUNCTION, "Running the program.", &cmdlist);
+
+  /* Define general commands. */
+
+  add_com ("pwd", class_files, pwd_command,
+	"Print working directory.  This is used for your program as well.");
+  c = add_cmd ("cd", class_files, cd_command,
+	       "Set working directory to DIR for debugger and program being debugged.\n\
+The change does not take effect for the program being debugged\n\
+until the next time it is started.", &cmdlist);
+  c->completer = filename_completer;
+
+  add_com ("echo", class_support, echo_command,
+	   "Print a constant string.  Give string as argument.\n\
+C escape sequences may be used in the argument.\n\
+No newline is added at the end of the argument;\n\
+use \"\\n\" if you want a newline to be printed.\n\
+Since leading and trailing whitespace are ignored in command arguments,\n\
+if you want to print some you must use \"\\\" before leading whitespace\n\
+to be printed or after trailing whitespace.");
+  add_com ("document", class_support, document_command,
+	   "Document a user-defined command.\n\
+Give command name as argument.  Give documentation on following lines.\n\
+End with a line of just \"end\".");
+  add_com ("define", class_support, define_command,
+	   "Define a new command name.  Command name is argument.\n\
+Definition appears on following lines, one command per line.\n\
+End with a line of just \"end\".\n\
+Use the \"document\" command to give documentation for the new command.\n\
+Commands defined in this way may have up to ten arguments.");
+
+#ifdef __STDC__
+  c = add_cmd ("source", class_support, source_command,
+	       "Read commands from a file named FILE.\n\
+Note that the file \"" GDBINIT_FILENAME "\" is read automatically in this way\n\
+when gdb is started.", &cmdlist);
+#else
+  /* Punt file name, we can't help it easily.  */
+  c = add_cmd ("source", class_support, source_command,
+	       "Read commands from a file named FILE.\n\
+Note that the file \".gdbinit\" is read automatically in this way\n\
+when gdb is started.", &cmdlist);
+#endif
+  c->completer = filename_completer;
+
+  add_com ("quit", class_support, quit_command, "Exit gdb.");
+  add_com ("help", class_support, help_command, "Print list of commands.");
+  add_com_alias ("q", "quit", class_support, 1);
+  add_com_alias ("h", "help", class_support, 1);
+
+  c = add_set_cmd ("verbose", class_support, var_boolean, (char *) &info_verbose,
+		   "Set ",
+		   &setlist),
+    add_show_from_set (c, &showlist);
+  c->function.sfunc = set_verbose;
+  set_verbose (NULL, 0, c);
+
+  add_prefix_cmd ("history", class_support, set_history,
+		  "Generic command for setting command history parameters.",
+		  &sethistlist, "set history ", 0, &setlist);
+  add_prefix_cmd ("history", class_support, show_history,
+		  "Generic command for showing command history parameters.",
+		  &showhistlist, "show history ", 0, &showlist);
+
+  add_show_from_set
+    (add_set_cmd ("expansion", no_class, var_boolean, (char *) &history_expansion_p,
+		  "Set history expansion on command input.\n\
+Without an argument, history expansion is enabled.", &sethistlist),
+     &showhistlist);
+
+  add_prefix_cmd ("info", class_info, info_command,
+     "Generic command for showing things about the program being debugged.",
+		  &infolist, "info ", 0, &cmdlist);
+  add_com_alias ("i", "info", class_info, 1);
+
+  add_com ("complete", class_obscure, complete_command,
+	   "List the completions for the rest of the line as a command.");
+
+  add_prefix_cmd ("show", class_info, show_command,
+		  "Generic command for showing things about the debugger.",
+		  &showlist, "show ", 0, &cmdlist);
+  /* Another way to get at the same thing.  */
+  add_info ("set", show_command, "Show all GDB settings.");
+
+  add_cmd ("commands", no_class, show_commands,
+	   "Show the history of commands you typed.\n\
+You can supply a command number to start with, or a `+' to start after\n\
+the previous command number shown.",
+	   &showlist);
+
+  add_cmd ("version", no_class, show_version,
+	   "Show what version of GDB this is.", &showlist);
+
+  add_com ("while", class_support, while_command,
+	   "Execute nested commands WHILE the conditional expression is non zero.\n\
+The conditional expression must follow the word `while' and must in turn be\n\
+followed by a new line.  The nested commands must be entered one per line,\n\
+and should be terminated by the word `end'.");
+
+  add_com ("if", class_support, if_command,
+	   "Execute nested commands once IF the conditional expression is non zero.\n\
+The conditional expression must follow the word `if' and must in turn be\n\
+followed by a new line.  The nested commands must be entered one per line,\n\
+and should be terminated by the word 'else' or `end'.  If an else clause\n\
+is used, the same rules apply to its nested commands as to the first ones.");
+
+  /* If target is open when baud changes, it doesn't take effect until the
+     next open (I think, not sure).  */
+  add_show_from_set (add_set_cmd ("remotebaud", no_class,
+				  var_zinteger, (char *) &baud_rate,
+				  "Set baud rate for remote serial I/O.\n\
+This value is used to set the speed of the serial port when debugging\n\
+using remote targets.", &setlist),
+		     &showlist);
+
+  c = add_set_cmd ("remotedebug", no_class, var_zinteger,
+		   (char *) &remote_debug,
+		   "Set debugging of remote protocol.\n\
+When enabled, each packet sent or received with the remote target\n\
+is displayed.", &setlist);
+  deprecate_cmd (c, "set debug remote");
+  deprecate_cmd (add_show_from_set (c, &showlist), "show debug remote");
+
+  add_show_from_set (add_set_cmd ("remote", no_class, var_zinteger,
+				  (char *) &remote_debug,
+				  "Set debugging of remote protocol.\n\
+When enabled, each packet sent or received with the remote target\n\
+is displayed.", &setdebuglist),
+		     &showdebuglist);
+
+  add_show_from_set (
+		      add_set_cmd ("remotetimeout", no_class, var_integer, (char *) &remote_timeout,
+				   "Set timeout limit to wait for target to respond.\n\
+This value is used to set the time limit for gdb to wait for a response\n\
+from the target.", &setlist),
+		      &showlist);
+
+  add_prefix_cmd ("debug", no_class, set_debug,
+		  "Generic command for setting gdb debugging flags",
+		  &setdebuglist, "set debug ", 0, &setlist);
+
+  add_prefix_cmd ("debug", no_class, show_debug,
+		  "Generic command for showing gdb debugging flags",
+		  &showdebuglist, "show debug ", 0, &showlist);
+
+  add_com ("shell", class_support, shell_escape,
+	   "Execute the rest of the line as a shell command.  \n\
+With no arguments, run an inferior shell.");
+
+  /* NOTE: cagney/2000-03-20: Being able to enter ``(gdb) !ls'' would
+     be a really useful feature.  Unfortunately, the below wont do
+     this.  Instead it adds support for the form ``(gdb) ! ls''
+     (i.e. the space is required).  If the ``!'' command below is
+     added the complains about no ``!'' command would be replaced by
+     complains about how the ``!'' command is broken :-) */
+  if (xdb_commands)
+    add_com_alias ("!", "shell", class_support, 0);
+
+  add_com ("make", class_support, make_command,
+       "Run the ``make'' program using the rest of the line as arguments.");
+  add_cmd ("user", no_class, show_user,
+	   "Show definitions of user defined commands.\n\
+Argument is the name of the user defined command.\n\
+With no argument, show definitions of all user defined commands.", &showlist);
+  add_com ("apropos", class_support, apropos_command, "Search for commands matching a REGEXP");
+}
diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h
new file mode 100644
index 0000000..906277e
--- /dev/null
+++ b/gdb/cli/cli-cmds.h
@@ -0,0 +1,125 @@
+/* Header file for GDB CLI command implementation library.
+   Copyright (C) 2000 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.  */
+
+#if !defined (CLI_CMDS_H)
+#define CLI_CMDS_H 1
+
+/* Chain containing all defined commands.  */
+
+extern struct cmd_list_element *cmdlist;
+
+/* Chain containing all defined info subcommands.  */
+
+extern struct cmd_list_element *infolist;
+
+/* Chain containing all defined enable subcommands. */
+
+extern struct cmd_list_element *enablelist;
+
+/* Chain containing all defined disable subcommands. */
+
+extern struct cmd_list_element *disablelist;
+
+/* Chain containing all defined delete subcommands. */
+
+extern struct cmd_list_element *deletelist;
+
+/* Chain containing all defined toggle subcommands. */
+
+extern struct cmd_list_element *togglelist;
+
+/* Chain containing all defined stop subcommands. */
+
+extern struct cmd_list_element *stoplist;
+
+/* Chain containing all defined "enable breakpoint" subcommands. */
+
+extern struct cmd_list_element *enablebreaklist;
+
+/* Chain containing all defined set subcommands */
+
+extern struct cmd_list_element *setlist;
+
+/* Chain containing all defined unset subcommands */
+
+extern struct cmd_list_element *unsetlist;
+
+/* Chain containing all defined show subcommands.  */
+
+extern struct cmd_list_element *showlist;
+
+/* Chain containing all defined \"set history\".  */
+
+extern struct cmd_list_element *sethistlist;
+
+/* Chain containing all defined \"show history\".  */
+
+extern struct cmd_list_element *showhistlist;
+
+/* Chain containing all defined \"unset history\".  */
+
+extern struct cmd_list_element *unsethistlist;
+
+/* Chain containing all defined maintenance subcommands. */
+
+extern struct cmd_list_element *maintenancelist;
+
+/* Chain containing all defined "maintenance info" subcommands. */
+
+extern struct cmd_list_element *maintenanceinfolist;
+
+/* Chain containing all defined "maintenance print" subcommands. */
+
+extern struct cmd_list_element *maintenanceprintlist;
+
+extern struct cmd_list_element *setprintlist;
+
+extern struct cmd_list_element *showprintlist;
+
+extern struct cmd_list_element *setdebuglist;
+
+extern struct cmd_list_element *showdebuglist;
+
+extern struct cmd_list_element *setchecklist;
+
+extern struct cmd_list_element *showchecklist;
+
+/* Exported to gdb/top.c */
+
+void init_cmd_lists (void);
+
+void init_cli_cmds (void);
+
+int is_complete_command (void (*func) (char *args, int from_tty));
+
+/* Exported to gdb/main.c */
+
+extern void cd_command (char *, int);
+
+/* Exported to gdb/top.c and gdb/main.c */
+
+extern void quit_command (char *, int);
+
+extern void source_command (char *, int);
+
+/* Used everywhere whenever at least one parameter is required and
+  none is specified. */
+
+extern NORETURN void error_no_arg (char *) ATTR_NORETURN;
+
+#endif /* !defined (CLI_CMDS_H) */
diff --git a/gdb/command.c b/gdb/cli/cli-decode.c
similarity index 60%
rename from gdb/command.c
rename to gdb/cli/cli-decode.c
index 02ee474..42c1267 100644
--- a/gdb/command.c
+++ b/gdb/cli/cli-decode.c
@@ -17,52 +17,29 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
-#include "gdbcmd.h"
 #include "symtab.h"
-#include "value.h"
 #include <ctype.h>
-#include "gdb_string.h"
+#include "gnu-regex.h"
+
 #ifdef UI_OUT
 #include "ui-out.h"
 #endif
 
-#include "gdb_wait.h"
-#include "gnu-regex.h"
-/* FIXME: this should be auto-configured!  */
-#ifdef __MSDOS__
-# define CANT_FORK
-#endif
+#include "cli/cli-cmds.h"
+#include "cli/cli-decode.h"
 
 /* Prototypes for local functions */
 
 static void undef_cmd_error (char *, char *);
 
-static void show_user (char *, int);
-
-static void show_user_1 (struct cmd_list_element *, struct ui_file *);
-
-static void make_command (char *, int);
-
-static void shell_escape (char *, int);
-
-static int parse_binary_operation (char *);
-
-static void print_doc_line (struct ui_file *, char *);
-
 static struct cmd_list_element *find_cmd (char *command,
 					  int len,
 					  struct cmd_list_element *clist,
 					  int ignore_help_classes,
 					  int *nfound);
-static void apropos_cmd_helper (struct ui_file *, struct cmd_list_element *, 
-		    		struct re_pattern_buffer *, char *);
 
 static void help_all (struct ui_file *stream);
-
-void apropos_command (char *, int);
-
-void _initialize_command (void);
-
+
 /* Add element named NAME.
    CLASS is the top level category into which commands are broken down
    for "help" purposes.
@@ -81,12 +58,8 @@
    of *LIST). */
 
 struct cmd_list_element *
-add_cmd (name, class, fun, doc, list)
-     char *name;
-     enum command_class class;
-     void (*fun) (char *, int);
-     char *doc;
-     struct cmd_list_element **list;
+add_cmd (char *name, enum command_class class, void (*fun) (char *, int),
+	 char *doc, struct cmd_list_element **list)
 {
   register struct cmd_list_element *c
   = (struct cmd_list_element *) xmalloc (sizeof (struct cmd_list_element));
@@ -116,7 +89,9 @@
   c->doc = doc;
   c->flags = 0;
   c->replacement = NULL;
-  c->hook = NULL;
+  c->hook_pre  = NULL;
+  c->hook_post = NULL;
+  c->hook_in = 0;
   c->prefixlist = NULL;
   c->prefixname = NULL;
   c->allow_unknown = 0;
@@ -127,12 +102,26 @@
   c->var_type = var_boolean;
   c->enums = NULL;
   c->user_commands = NULL;
-  c->hookee = NULL;
+  c->hookee_pre = NULL;
+  c->hookee_post = NULL;
   c->cmd_pointer = NULL;
 
   return c;
 }
 
+/* Same as above, except that the abbrev_flag is set. */
+/* Note: Doesn't seem to be used anywhere currently. */
+
+struct cmd_list_element *
+add_abbrev_cmd (char *name, enum command_class class, void (*fun) (char *, int),
+		char *doc, struct cmd_list_element **list)
+{
+  register struct cmd_list_element *c
+  = add_cmd (name, class, fun, doc, list);
+
+  c->abbrev_flag = 1;
+  return c;
+}
 
 /* Deprecates a command CMD.
    REPLACEMENT is the name of the command which should be used in place
@@ -145,9 +134,7 @@
    Returns a pointer to the deprecated command.  */
 
 struct cmd_list_element *
-deprecate_cmd (cmd, replacement)
-     struct cmd_list_element *cmd;
-     char *replacement;
+deprecate_cmd (struct cmd_list_element *cmd, char *replacement)
 {
   cmd->flags |= (CMD_DEPRECATED | DEPRECATED_WARN_USER);
 
@@ -159,35 +146,9 @@
   return cmd;
 }
 
-
-/* Same as above, except that the abbrev_flag is set. */
-
-#if 0				/* Currently unused */
-
 struct cmd_list_element *
-add_abbrev_cmd (name, class, fun, doc, list)
-     char *name;
-     enum command_class class;
-     void (*fun) (char *, int);
-     char *doc;
-     struct cmd_list_element **list;
-{
-  register struct cmd_list_element *c
-  = add_cmd (name, class, fun, doc, list);
-
-  c->abbrev_flag = 1;
-  return c;
-}
-
-#endif
-
-struct cmd_list_element *
-add_alias_cmd (name, oldname, class, abbrev_flag, list)
-     char *name;
-     char *oldname;
-     enum command_class class;
-     int abbrev_flag;
-     struct cmd_list_element **list;
+add_alias_cmd (char *name, char *oldname, enum command_class class,
+	       int abbrev_flag, struct cmd_list_element **list)
 {
   /* Must do this since lookup_cmd tries to side-effect its first arg */
   char *copied_name;
@@ -218,16 +179,10 @@
    of the variable containing that list.  */
 
 struct cmd_list_element *
-add_prefix_cmd (name, class, fun, doc, prefixlist, prefixname,
-		allow_unknown, list)
-     char *name;
-     enum command_class class;
-     void (*fun) (char *, int);
-     char *doc;
-     struct cmd_list_element **prefixlist;
-     char *prefixname;
-     int allow_unknown;
-     struct cmd_list_element **list;
+add_prefix_cmd (char *name, enum command_class class, void (*fun) (char *, int),
+		char *doc, struct cmd_list_element **prefixlist,
+		char *prefixname, int allow_unknown,
+		struct cmd_list_element **list)
 {
   register struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
   c->prefixlist = prefixlist;
@@ -239,16 +194,10 @@
 /* Like add_prefix_cmd but sets the abbrev_flag on the new command. */
 
 struct cmd_list_element *
-add_abbrev_prefix_cmd (name, class, fun, doc, prefixlist, prefixname,
-		       allow_unknown, list)
-     char *name;
-     enum command_class class;
-     void (*fun) (char *, int);
-     char *doc;
-     struct cmd_list_element **prefixlist;
-     char *prefixname;
-     int allow_unknown;
-     struct cmd_list_element **list;
+add_abbrev_prefix_cmd (char *name, enum command_class class,
+		       void (*fun) (char *, int), char *doc,
+		       struct cmd_list_element **prefixlist, char *prefixname,
+		       int allow_unknown, struct cmd_list_element **list)
 {
   register struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
   c->prefixlist = prefixlist;
@@ -260,9 +209,7 @@
 
 /* This is an empty "cfunc".  */
 void
-not_just_help_class_command (args, from_tty)
-     char *args;
-     int from_tty;
+not_just_help_class_command (char *args, int from_tty)
 {
 }
 
@@ -270,10 +217,7 @@
 static void empty_sfunc (char *, int, struct cmd_list_element *);
 
 static void
-empty_sfunc (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+empty_sfunc (char *args, int from_tty, struct cmd_list_element *c)
 {
 }
 
@@ -315,8 +259,8 @@
 struct cmd_list_element *
 add_set_enum_cmd (char *name,
 		  enum command_class class,
-		  char *enumlist[],
-		  char **var,
+		  const char *enumlist[],
+		  const char **var,
 		  char *doc,
 		  struct cmd_list_element **list)
 {
@@ -327,13 +271,31 @@
   return c;
 }
 
+/* Add element named NAME to command list LIST (the list for set
+   or some sublist thereof).
+   CLASS is as in add_cmd.
+   VAR is address of the variable which will contain the value.
+   DOC is the documentation string.  */
+struct cmd_list_element *
+add_set_auto_boolean_cmd (char *name,
+			  enum command_class class,
+			  enum cmd_auto_boolean *var,
+			  char *doc,
+			  struct cmd_list_element **list)
+{
+  static const char *auto_boolean_enums[] = { "on", "off", "auto", NULL };
+  struct cmd_list_element *c;
+  c = add_set_cmd (name, class, var_auto_boolean, var, doc, list);
+  c->enums = auto_boolean_enums;
+  return c;
+}
+
 /* Where SETCMD has already been added, add the corresponding show
    command to LIST and return a pointer to the added command (not 
    necessarily the head of LIST).  */
 struct cmd_list_element *
-add_show_from_set (setcmd, list)
-     struct cmd_list_element *setcmd;
-     struct cmd_list_element **list;
+add_show_from_set (struct cmd_list_element *setcmd,
+		   struct cmd_list_element **list)
 {
   struct cmd_list_element *showcmd =
   (struct cmd_list_element *) xmalloc (sizeof (struct cmd_list_element));
@@ -372,19 +334,19 @@
 /* Remove the command named NAME from the command list.  */
 
 void
-delete_cmd (name, list)
-     char *name;
-     struct cmd_list_element **list;
+delete_cmd (char *name, struct cmd_list_element **list)
 {
   register struct cmd_list_element *c;
   struct cmd_list_element *p;
 
   while (*list && STREQ ((*list)->name, name))
     {
-      if ((*list)->hookee)
-	(*list)->hookee->hook = 0;	/* Hook slips out of its mouth */
+      if ((*list)->hookee_pre)
+      (*list)->hookee_pre->hook_pre = 0;   /* Hook slips out of its mouth */
+      if ((*list)->hookee_post)
+      (*list)->hookee_post->hook_post = 0; /* Hook slips out of its bottom  */
       p = (*list)->next;
-      free ((PTR) * list);
+      xfree (* list);
       *list = p;
     }
 
@@ -393,22 +355,62 @@
       {
 	if (STREQ (c->next->name, name))
 	  {
-	    if (c->next->hookee)
-	      c->next->hookee->hook = 0;	/* hooked cmd gets away.  */
+          if (c->next->hookee_pre)
+            c->next->hookee_pre->hook_pre = 0; /* hooked cmd gets away.  */
+          if (c->next->hookee_post)
+            c->next->hookee_post->hook_post = 0; /* remove post hook */
+                                               /* :( no fishing metaphore */
 	    p = c->next->next;
-	    free ((PTR) c->next);
+	    xfree (c->next);
 	    c->next = p;
 	  }
 	else
 	  c = c->next;
       }
 }
+
+/* Shorthands to the commands above. */
+
+/* Add an element to the list of info subcommands.  */
+
+struct cmd_list_element *
+add_info (char *name, void (*fun) (char *, int), char *doc)
+{
+  return add_cmd (name, no_class, fun, doc, &infolist);
+}
+
+/* Add an alias to the list of info subcommands.  */
+
+struct cmd_list_element *
+add_info_alias (char *name, char *oldname, int abbrev_flag)
+{
+  return add_alias_cmd (name, oldname, 0, abbrev_flag, &infolist);
+}
+
+/* Add an element to the list of commands.  */
+
+struct cmd_list_element *
+add_com (char *name, enum command_class class, void (*fun) (char *, int),
+	 char *doc)
+{
+  return add_cmd (name, class, fun, doc, &cmdlist);
+}
+
+/* Add an alias or abbreviation command to the list of commands.  */
+
+struct cmd_list_element *
+add_com_alias (char *name, char *oldname, enum command_class class,
+	       int abbrev_flag)
+{
+  return add_alias_cmd (name, oldname, class, abbrev_flag, &cmdlist);
+}
+
 /* Recursively walk the commandlist structures, and print out the
    documentation of commands that match our regex in either their
    name, or their documentation.
 */
-static void 
-apropos_cmd_helper (struct ui_file *stream, struct cmd_list_element *commandlist,
+void 
+apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
 			 struct re_pattern_buffer *regex, char *prefix)
 {
   register struct cmd_list_element *c;
@@ -452,38 +454,10 @@
 	  /* Recursively call ourselves on the subcommand list,
 	     passing the right prefix in.
 	  */
-	  apropos_cmd_helper(stream,*c->prefixlist,regex,c->prefixname);
+	  apropos_cmd (stream,*c->prefixlist,regex,c->prefixname);
 	}
     }
 }
-/* Search through names of commands and documentations for a certain
-   regular expression.
-*/
-void 
-apropos_command (char *searchstr, int from_tty)
-{
-  extern struct cmd_list_element *cmdlist; /*This is the main command list*/
-  regex_t pattern;
-  char *pattern_fastmap;
-  char errorbuffer[512];
-  pattern_fastmap=calloc(256,sizeof(char));
-  if (searchstr == NULL)
-      error("REGEXP string is empty");
-
-  if (regcomp(&pattern,searchstr,REG_ICASE) == 0)
-    {
-      pattern.fastmap=pattern_fastmap;
-      re_compile_fastmap(&pattern);
-      apropos_cmd_helper(gdb_stdout,cmdlist,&pattern,"");
-    }
-  else
-    {
-      regerror(regcomp(&pattern,searchstr,REG_ICASE),NULL,errorbuffer,512);
-      error("Error in regular expression:%s",errorbuffer);
-    }
-  free(pattern_fastmap);
-}
-
 
 /* This command really has to deal with two things:
  *     1) I want documentation on *this string* (usually called by
@@ -497,9 +471,7 @@
  */
 
 void
-help_cmd (command, stream)
-     char *command;
-     struct ui_file *stream;
+help_cmd (char *command, struct ui_file *stream)
 {
   struct cmd_list_element *c;
   extern struct cmd_list_element *cmdlist;
@@ -548,9 +520,18 @@
   if (c->function.cfunc == NULL)
     help_list (cmdlist, "", c->class, stream);
 
-  if (c->hook)
-    fprintf_filtered (stream, "\nThis command has a hook defined: %s\n",
-		      c->hook->name);
+  if (c->hook_pre || c->hook_post)
+    fprintf_filtered (stream,
+                      "\nThis command has a hook (or hooks) defined:\n");
+
+  if (c->hook_pre)
+    fprintf_filtered (stream, 
+                      "\tThis command is run after  : %s (pre hook)\n",
+                    c->hook_pre->name);
+  if (c->hook_post)
+    fprintf_filtered (stream, 
+                      "\tThis command is run before : %s (post hook)\n",
+                    c->hook_post->name);
 }
 
 /*
@@ -566,11 +547,8 @@
  * If you call this routine with a class >= 0, it recurses.
  */
 void
-help_list (list, cmdtype, class, stream)
-     struct cmd_list_element *list;
-     char *cmdtype;
-     enum command_class class;
-     struct ui_file *stream;
+help_list (struct cmd_list_element *list, char *cmdtype,
+	   enum command_class class, struct ui_file *stream)
 {
   int len;
   char *cmdtype1, *cmdtype2;
@@ -629,10 +607,8 @@
 }
 
 /* Print only the first line of STR on STREAM.  */
-static void
-print_doc_line (stream, str)
-     struct ui_file *stream;
-     char *str;
+void
+print_doc_line (struct ui_file *stream, char *str)
 {
   static char *line_buffer = 0;
   static int line_size;
@@ -650,7 +626,7 @@
   if (p - str > line_size - 1)
     {
       line_size = p - str + 1;
-      free ((PTR) line_buffer);
+      xfree (line_buffer);
       line_buffer = (char *) xmalloc (line_size);
     }
   strncpy (line_buffer, str, p - str);
@@ -681,12 +657,8 @@
  * is at the low level, not the high-level).
  */
 void
-help_cmd_list (list, class, prefix, recurse, stream)
-     struct cmd_list_element *list;
-     enum command_class class;
-     char *prefix;
-     int recurse;
-     struct ui_file *stream;
+help_cmd_list (struct cmd_list_element *list, enum command_class class,
+	       char *prefix, int recurse, struct ui_file *stream)
 {
   register struct cmd_list_element *c;
 
@@ -714,12 +686,8 @@
    found in nfound */
 
 static struct cmd_list_element *
-find_cmd (command, len, clist, ignore_help_classes, nfound)
-     char *command;
-     int len;
-     struct cmd_list_element *clist;
-     int ignore_help_classes;
-     int *nfound;
+find_cmd (char *command, int len, struct cmd_list_element *clist,
+	  int ignore_help_classes, int *nfound)
 {
   struct cmd_list_element *found, *c;
 
@@ -777,10 +745,8 @@
    the struct cmd_list_element is NULL).  */
 
 struct cmd_list_element *
-lookup_cmd_1 (text, clist, result_list, ignore_help_classes)
-     char **text;
-     struct cmd_list_element *clist, **result_list;
-     int ignore_help_classes;
+lookup_cmd_1 (char **text, struct cmd_list_element *clist,
+	      struct cmd_list_element **result_list, int ignore_help_classes)
 {
   char *p, *command;
   int len, tmp, nfound;
@@ -912,8 +878,7 @@
 /* All this hair to move the space to the front of cmdtype */
 
 static void
-undef_cmd_error (cmdtype, q)
-     char *cmdtype, *q;
+undef_cmd_error (char *cmdtype, char *q)
 {
   error ("Undefined %scommand: \"%s\".  Try \"help%s%.*s\".",
 	 cmdtype,
@@ -938,25 +903,15 @@
    the function field of the struct cmd_list_element is 0).  */
 
 struct cmd_list_element *
-lookup_cmd (line, list, cmdtype, allow_unknown, ignore_help_classes)
-     char **line;
-     struct cmd_list_element *list;
-     char *cmdtype;
-     int allow_unknown;
-     int ignore_help_classes;
+lookup_cmd (char **line, struct cmd_list_element *list, char *cmdtype,
+	    int allow_unknown, int ignore_help_classes)
 {
   struct cmd_list_element *last_list = 0;
   struct cmd_list_element *c =
   lookup_cmd_1 (line, list, &last_list, ignore_help_classes);
-#if 0
-  /* This is wrong for complete_command.  */
-  char *ptr = (*line) + strlen (*line) - 1;
 
-  /* Clear off trailing whitespace.  */
-  while (ptr >= *line && (*ptr == ' ' || *ptr == '\t'))
-    ptr--;
-  *(ptr + 1) = '\0';
-#endif
+  /* Note: Do not remove trailing whitespace here because this
+     would be wrong for complete_command.  Jim Kingdon  */
 
   if (!c)
     {
@@ -1245,146 +1200,6 @@
     }
 }
 
-
-
-
-#if 0
-/* Look up the contents of *LINE as a command in the command list LIST.
-   LIST is a chain of struct cmd_list_element's.
-   If it is found, return the struct cmd_list_element for that command
-   and update *LINE to point after the command name, at the first argument.
-   If not found, call error if ALLOW_UNKNOWN is zero
-   otherwise (or if error returns) return zero.
-   Call error if specified command is ambiguous,
-   unless ALLOW_UNKNOWN is negative.
-   CMDTYPE precedes the word "command" in the error message.  */
-
-struct cmd_list_element *
-lookup_cmd (line, list, cmdtype, allow_unknown)
-     char **line;
-     struct cmd_list_element *list;
-     char *cmdtype;
-     int allow_unknown;
-{
-  register char *p;
-  register struct cmd_list_element *c, *found;
-  int nfound;
-  char ambbuf[100];
-  char *processed_cmd;
-  int i, cmd_len;
-
-  /* Skip leading whitespace.  */
-
-  while (**line == ' ' || **line == '\t')
-    (*line)++;
-
-  /* Clear out trailing whitespace.  */
-
-  p = *line + strlen (*line);
-  while (p != *line && (p[-1] == ' ' || p[-1] == '\t'))
-    p--;
-  *p = 0;
-
-  /* Find end of command name.  */
-
-  p = *line;
-  while (*p == '-' || isalnum (*p))
-    p++;
-
-  /* Look up the command name.
-     If exact match, keep that.
-     Otherwise, take command abbreviated, if unique.  Note that (in my
-     opinion) a null string does *not* indicate ambiguity; simply the
-     end of the argument.  */
-
-  if (p == *line)
-    {
-      if (!allow_unknown)
-	error ("Lack of needed %scommand", cmdtype);
-      return 0;
-    }
-
-  /* Copy over to a local buffer, converting to lowercase on the way.
-     This is in case the command being parsed is a subcommand which
-     doesn't match anything, and that's ok.  We want the original
-     untouched for the routine of the original command.  */
-
-  processed_cmd = (char *) alloca (p - *line + 1);
-  for (cmd_len = 0; cmd_len < p - *line; cmd_len++)
-    {
-      char x = (*line)[cmd_len];
-      if (isupper (x))
-	processed_cmd[cmd_len] = tolower (x);
-      else
-	processed_cmd[cmd_len] = x;
-    }
-  processed_cmd[cmd_len] = '\0';
-
-  /* Check all possibilities in the current command list.  */
-  found = 0;
-  nfound = 0;
-  for (c = list; c; c = c->next)
-    {
-      if (!strncmp (processed_cmd, c->name, cmd_len))
-	{
-	  found = c;
-	  nfound++;
-	  if (c->name[cmd_len] == 0)
-	    {
-	      nfound = 1;
-	      break;
-	    }
-	}
-    }
-
-  /* Report error for undefined command name.  */
-
-  if (nfound != 1)
-    {
-      if (nfound > 1 && allow_unknown >= 0)
-	{
-	  ambbuf[0] = 0;
-	  for (c = list; c; c = c->next)
-	    if (!strncmp (processed_cmd, c->name, cmd_len))
-	      {
-		if (strlen (ambbuf) + strlen (c->name) + 6 < sizeof ambbuf)
-		  {
-		    if (strlen (ambbuf))
-		      strcat (ambbuf, ", ");
-		    strcat (ambbuf, c->name);
-		  }
-		else
-		  {
-		    strcat (ambbuf, "..");
-		    break;
-		  }
-	      }
-	  error ("Ambiguous %scommand \"%s\": %s.", cmdtype,
-		 processed_cmd, ambbuf);
-	}
-      else if (!allow_unknown)
-	error ("Undefined %scommand: \"%s\".", cmdtype, processed_cmd);
-      return 0;
-    }
-
-  /* Skip whitespace before the argument.  */
-
-  while (*p == ' ' || *p == '\t')
-    p++;
-  *line = p;
-
-  if (found->prefixlist && *p)
-    {
-      c = lookup_cmd (line, *found->prefixlist, found->prefixname,
-		      found->allow_unknown);
-      if (c)
-	return c;
-    }
-
-  return found;
-}
-#endif
-
 /* Helper function for SYMBOL_COMPLETION_FUNCTION.  */
 
 /* Return a vector of char pointers which point to the different
@@ -1396,10 +1211,7 @@
    "oobar"; if WORD is "baz/foo", return "baz/foobar".  */
 
 char **
-complete_on_cmdlist (list, text, word)
-     struct cmd_list_element *list;
-     char *text;
-     char *word;
+complete_on_cmdlist (struct cmd_list_element *list, char *text, char *word)
 {
   struct cmd_list_element *ptr;
   char **matchlist;
@@ -1446,7 +1258,7 @@
 
   if (matches == 0)
     {
-      free ((PTR) matchlist);
+      xfree (matchlist);
       matchlist = 0;
     }
   else
@@ -1470,17 +1282,16 @@
    "oobar"; if WORD is "baz/foo", return "baz/foobar".  */
 
 char **
-complete_on_enum (enumlist, text, word)
-     char **enumlist;
-     char *text;
-     char *word;
+complete_on_enum (const char *enumlist[],
+		  char *text,
+		  char *word)
 {
   char **matchlist;
   int sizeof_matchlist;
   int matches;
   int textlen = strlen (text);
   int i;
-  char *name;
+  const char *name;
 
   sizeof_matchlist = 10;
   matchlist = (char **) xmalloc (sizeof_matchlist * sizeof (char *));
@@ -1518,7 +1329,7 @@
 
   if (matches == 0)
     {
-      free ((PTR) matchlist);
+      xfree (matchlist);
       matchlist = 0;
     }
   else
@@ -1531,518 +1342,3 @@
   return matchlist;
 }
 
-static int
-parse_binary_operation (arg)
-     char *arg;
-{
-  int length;
-
-  if (!arg || !*arg)
-    return 1;
-
-  length = strlen (arg);
-
-  while (arg[length - 1] == ' ' || arg[length - 1] == '\t')
-    length--;
-
-  if (!strncmp (arg, "on", length)
-      || !strncmp (arg, "1", length)
-      || !strncmp (arg, "yes", length))
-    return 1;
-  else if (!strncmp (arg, "off", length)
-	   || !strncmp (arg, "0", length)
-	   || !strncmp (arg, "no", length))
-    return 0;
-  else
-    {
-      error ("\"on\" or \"off\" expected.");
-      return 0;
-    }
-}
-
-/* Do a "set" or "show" command.  ARG is NULL if no argument, or the text
-   of the argument, and FROM_TTY is nonzero if this command is being entered
-   directly by the user (i.e. these are just like any other
-   command).  C is the command list element for the command.  */
-void
-do_setshow_command (arg, from_tty, c)
-     char *arg;
-     int from_tty;
-     struct cmd_list_element *c;
-{
-  if (c->type == set_cmd)
-    {
-      switch (c->var_type)
-	{
-	case var_string:
-	  {
-	    char *new;
-	    char *p;
-	    char *q;
-	    int ch;
-
-	    if (arg == NULL)
-	      arg = "";
-	    new = (char *) xmalloc (strlen (arg) + 2);
-	    p = arg;
-	    q = new;
-	    while ((ch = *p++) != '\000')
-	      {
-		if (ch == '\\')
-		  {
-		    /* \ at end of argument is used after spaces
-		       so they won't be lost.  */
-		    /* This is obsolete now that we no longer strip
-		       trailing whitespace and actually, the backslash
-		       didn't get here in my test, readline or
-		       something did something funky with a backslash
-		       right before a newline.  */
-		    if (*p == 0)
-		      break;
-		    ch = parse_escape (&p);
-		    if (ch == 0)
-		      break;	/* C loses */
-		    else if (ch > 0)
-		      *q++ = ch;
-		  }
-		else
-		  *q++ = ch;
-	      }
-#if 0
-	    if (*(p - 1) != '\\')
-	      *q++ = ' ';
-#endif
-	    *q++ = '\0';
-	    new = (char *) xrealloc (new, q - new);
-	    if (*(char **) c->var != NULL)
-	      free (*(char **) c->var);
-	    *(char **) c->var = new;
-	  }
-	  break;
-	case var_string_noescape:
-	  if (arg == NULL)
-	    arg = "";
-	  if (*(char **) c->var != NULL)
-	    free (*(char **) c->var);
-	  *(char **) c->var = savestring (arg, strlen (arg));
-	  break;
-	case var_filename:
-	  if (arg == NULL)
-	    error_no_arg ("filename to set it to.");
-	  if (*(char **) c->var != NULL)
-	    free (*(char **) c->var);
-	  *(char **) c->var = tilde_expand (arg);
-	  break;
-	case var_boolean:
-	  *(int *) c->var = parse_binary_operation (arg);
-	  break;
-	case var_uinteger:
-	  if (arg == NULL)
-	    error_no_arg ("integer to set it to.");
-	  *(unsigned int *) c->var = parse_and_eval_address (arg);
-	  if (*(unsigned int *) c->var == 0)
-	    *(unsigned int *) c->var = UINT_MAX;
-	  break;
-	case var_integer:
-	  {
-	    unsigned int val;
-	    if (arg == NULL)
-	      error_no_arg ("integer to set it to.");
-	    val = parse_and_eval_address (arg);
-	    if (val == 0)
-	      *(int *) c->var = INT_MAX;
-	    else if (val >= INT_MAX)
-	      error ("integer %u out of range", val);
-	    else
-	      *(int *) c->var = val;
-	    break;
-	  }
-	case var_zinteger:
-	  if (arg == NULL)
-	    error_no_arg ("integer to set it to.");
-	  *(int *) c->var = parse_and_eval_address (arg);
-	  break;
-	case var_enum:
-	  {
-	    int i;
-	    int len;
-	    int nmatches;
-	    char *match = NULL;
-	    char *p;
-
-	    /* if no argument was supplied, print an informative error message */
-	    if (arg == NULL)
-	      {
-		char msg[1024];
-		strcpy (msg, "Requires an argument. Valid arguments are ");
-		for (i = 0; c->enums[i]; i++)
-		  {
-		    if (i != 0)
-		      strcat (msg, ", ");
-		    strcat (msg, c->enums[i]);
-		  }
-		strcat (msg, ".");
-		error (msg);
-	      }
-
-	    p = strchr (arg, ' ');
-
-	    if (p)
-	      len = p - arg;
-	    else
-	      len = strlen (arg);
-
-	    nmatches = 0;
-	    for (i = 0; c->enums[i]; i++)
-	      if (strncmp (arg, c->enums[i], len) == 0)
-		{
-		  match = c->enums[i];
-		  nmatches++;
-		}
-
-	    if (nmatches <= 0)
-	      error ("Undefined item: \"%s\".", arg);
-
-	    if (nmatches > 1)
-	      error ("Ambiguous item \"%s\".", arg);
-
-	    *(char **) c->var = match;
-	  }
-	  break;
-	default:
-	  error ("gdb internal error: bad var_type in do_setshow_command");
-	}
-    }
-  else if (c->type == show_cmd)
-    {
-#ifdef UI_OUT
-      struct cleanup *old_chain;
-      struct ui_stream *stb;
-      int quote;
-
-      stb = ui_out_stream_new (uiout);
-      old_chain = make_cleanup_ui_out_stream_delete (stb);
-#endif /* UI_OUT */
-
-      /* Print doc minus "show" at start.  */
-      print_doc_line (gdb_stdout, c->doc + 5);
-
-#ifdef UI_OUT
-      ui_out_text (uiout, " is ");
-      ui_out_wrap_hint (uiout, "    ");
-      quote = 0;
-      switch (c->var_type)
-	{
-	case var_string:
-	  {
-	    unsigned char *p;
-
-	    if (*(unsigned char **) c->var)
-	      fputstr_filtered (*(unsigned char **) c->var, '"', stb->stream);
-	    quote = 1;
-	  }
-	  break;
-	case var_string_noescape:
-	case var_filename:
-	case var_enum:
-	  if (*(char **) c->var)
-	    fputs_filtered (*(char **) c->var, stb->stream);
-	  quote = 1;
-	  break;
-	case var_boolean:
-	  fputs_filtered (*(int *) c->var ? "on" : "off", stb->stream);
-	  break;
-	case var_uinteger:
-	  if (*(unsigned int *) c->var == UINT_MAX)
-	    {
-	      fputs_filtered ("unlimited", stb->stream);
-	      break;
-	    }
-	  /* else fall through */
-	case var_zinteger:
-	  fprintf_filtered (stb->stream, "%u", *(unsigned int *) c->var);
-	  break;
-	case var_integer:
-	  if (*(int *) c->var == INT_MAX)
-	    {
-	      fputs_filtered ("unlimited", stb->stream);
-	    }
-	  else
-	    fprintf_filtered (stb->stream, "%d", *(int *) c->var);
-	  break;
-
-	default:
-	  error ("gdb internal error: bad var_type in do_setshow_command");
-	}
-      if (quote)
-	ui_out_text (uiout, "\"");
-      ui_out_field_stream (uiout, "value", stb);
-      if (quote)
-	ui_out_text (uiout, "\"");
-      ui_out_text (uiout, ".\n");
-      do_cleanups (old_chain);
-#else
-      fputs_filtered (" is ", gdb_stdout);
-      wrap_here ("    ");
-      switch (c->var_type)
-	{
-	case var_string:
-	  {
-	    fputs_filtered ("\"", gdb_stdout);
-	    if (*(unsigned char **) c->var)
-	      fputstr_filtered (*(unsigned char **) c->var, '"', gdb_stdout);
-	    fputs_filtered ("\"", gdb_stdout);
-	  }
-	  break;
-	case var_string_noescape:
-	case var_filename:
-	case var_enum:
-	  fputs_filtered ("\"", gdb_stdout);
-	  if (*(char **) c->var)
-	    fputs_filtered (*(char **) c->var, gdb_stdout);
-	  fputs_filtered ("\"", gdb_stdout);
-	  break;
-	case var_boolean:
-	  fputs_filtered (*(int *) c->var ? "on" : "off", gdb_stdout);
-	  break;
-	case var_uinteger:
-	  if (*(unsigned int *) c->var == UINT_MAX)
-	    {
-	      fputs_filtered ("unlimited", gdb_stdout);
-	      break;
-	    }
-	  /* else fall through */
-	case var_zinteger:
-	  fprintf_filtered (gdb_stdout, "%u", *(unsigned int *) c->var);
-	  break;
-	case var_integer:
-	  if (*(int *) c->var == INT_MAX)
-	    {
-	      fputs_filtered ("unlimited", gdb_stdout);
-	    }
-	  else
-	    fprintf_filtered (gdb_stdout, "%d", *(int *) c->var);
-	  break;
-
-	default:
-	  error ("gdb internal error: bad var_type in do_setshow_command");
-	}
-      fputs_filtered (".\n", gdb_stdout);
-#endif
-    }
-  else
-    error ("gdb internal error: bad cmd_type in do_setshow_command");
-  (*c->function.sfunc) (NULL, from_tty, c);
-  if (c->type == set_cmd && set_hook)
-    set_hook (c);
-}
-
-/* Show all the settings in a list of show commands.  */
-
-void
-cmd_show_list (list, from_tty, prefix)
-     struct cmd_list_element *list;
-     int from_tty;
-     char *prefix;
-{
-#ifdef UI_OUT
-  ui_out_list_begin (uiout, "showlist");
-#endif
-  for (; list != NULL; list = list->next)
-    {
-      /* If we find a prefix, run its list, prefixing our output by its
-         prefix (with "show " skipped).  */
-#ifdef UI_OUT
-      if (list->prefixlist && !list->abbrev_flag)
-	{
-	  ui_out_list_begin (uiout, "optionlist");
-	  ui_out_field_string (uiout, "prefix", list->prefixname + 5);
-	  cmd_show_list (*list->prefixlist, from_tty, list->prefixname + 5);
-	  ui_out_list_end (uiout);
-	}
-      if (list->type == show_cmd)
-	{
-	  ui_out_list_begin (uiout, "option");
-	  ui_out_text (uiout, prefix);
-	  ui_out_field_string (uiout, "name", list->name);
-	  ui_out_text (uiout, ":  ");
-	  do_setshow_command ((char *) NULL, from_tty, list);
-	  ui_out_list_end (uiout);
-	}
-#else
-      if (list->prefixlist && !list->abbrev_flag)
-	cmd_show_list (*list->prefixlist, from_tty, list->prefixname + 5);
-      if (list->type == show_cmd)
-	{
-	  fputs_filtered (prefix, gdb_stdout);
-	  fputs_filtered (list->name, gdb_stdout);
-	  fputs_filtered (":  ", gdb_stdout);
-	  do_setshow_command ((char *) NULL, from_tty, list);
-	}
-#endif
-    }
-#ifdef UI_OUT
-  ui_out_list_end (uiout);
-#endif
-}
-
-/* ARGSUSED */
-static void
-shell_escape (arg, from_tty)
-     char *arg;
-     int from_tty;
-{
-#ifdef CANT_FORK
-  /* If ARG is NULL, they want an inferior shell, but `system' just
-     reports if the shell is available when passed a NULL arg.  */
-  int rc = system (arg ? arg : "");
-
-  if (!arg)
-    arg = "inferior shell";
-
-  if (rc == -1)
-    {
-      fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", arg,
-			  safe_strerror (errno));
-      gdb_flush (gdb_stderr);
-    }
-  else if (rc)
-    {
-      fprintf_unfiltered (gdb_stderr, "%s exited with status %d\n", arg, rc);
-      gdb_flush (gdb_stderr);
-    }
-#ifdef __DJGPP__
-  /* Make sure to return to the directory GDB thinks it is, in case the
-     shell command we just ran changed it.  */
-  chdir (current_directory);
-#endif
-#else /* Can fork.  */
-  int rc, status, pid;
-  char *p, *user_shell;
-
-  if ((user_shell = (char *) getenv ("SHELL")) == NULL)
-    user_shell = "/bin/sh";
-
-  /* Get the name of the shell for arg0 */
-  if ((p = strrchr (user_shell, '/')) == NULL)
-    p = user_shell;
-  else
-    p++;			/* Get past '/' */
-
-  if ((pid = fork ()) == 0)
-    {
-      if (!arg)
-	execl (user_shell, p, 0);
-      else
-	execl (user_shell, p, "-c", arg, 0);
-
-      fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", user_shell,
-			  safe_strerror (errno));
-      gdb_flush (gdb_stderr);
-      _exit (0177);
-    }
-
-  if (pid != -1)
-    while ((rc = wait (&status)) != pid && rc != -1)
-      ;
-  else
-    error ("Fork failed");
-#endif /* Can fork.  */
-}
-
-static void
-make_command (arg, from_tty)
-     char *arg;
-     int from_tty;
-{
-  char *p;
-
-  if (arg == 0)
-    p = "make";
-  else
-    {
-      p = xmalloc (sizeof ("make ") + strlen (arg));
-      strcpy (p, "make ");
-      strcpy (p + sizeof ("make ") - 1, arg);
-    }
-
-  shell_escape (p, from_tty);
-}
-
-static void
-show_user_1 (c, stream)
-     struct cmd_list_element *c;
-     struct ui_file *stream;
-{
-  register struct command_line *cmdlines;
-
-  cmdlines = c->user_commands;
-  if (!cmdlines)
-    return;
-  fputs_filtered ("User command ", stream);
-  fputs_filtered (c->name, stream);
-  fputs_filtered (":\n", stream);
-
-#ifdef UI_OUT
-  print_command_lines (uiout, cmdlines, 1);
-  fputs_filtered ("\n", stream);
-#else
-  while (cmdlines)
-    {
-      print_command_line (cmdlines, 4, stream);
-      cmdlines = cmdlines->next;
-    }
-  fputs_filtered ("\n", stream);
-#endif
-}
-
-/* ARGSUSED */
-static void
-show_user (args, from_tty)
-     char *args;
-     int from_tty;
-{
-  struct cmd_list_element *c;
-  extern struct cmd_list_element *cmdlist;
-
-  if (args)
-    {
-      c = lookup_cmd (&args, cmdlist, "", 0, 1);
-      if (c->class != class_user)
-	error ("Not a user command.");
-      show_user_1 (c, gdb_stdout);
-    }
-  else
-    {
-      for (c = cmdlist; c; c = c->next)
-	{
-	  if (c->class == class_user)
-	    show_user_1 (c, gdb_stdout);
-	}
-    }
-}
-
-void
-_initialize_command ()
-{
-  add_com ("shell", class_support, shell_escape,
-	   "Execute the rest of the line as a shell command.  \n\
-With no arguments, run an inferior shell.");
-
-  /* NOTE: cagney/2000-03-20: Being able to enter ``(gdb) !ls'' would
-     be a really useful feature.  Unfortunatly, the below wont do
-     this.  Instead it adds support for the form ``(gdb) ! ls''
-     (i.e. the space is required).  If the ``!'' command below is
-     added the complains about no ``!'' command would be replaced by
-     complains about how the ``!'' command is broken :-) */
-  if (xdb_commands)
-    add_com_alias ("!", "shell", class_support, 0);
-
-  add_com ("make", class_support, make_command,
-       "Run the ``make'' program using the rest of the line as arguments.");
-  add_cmd ("user", no_class, show_user,
-	   "Show definitions of user defined commands.\n\
-Argument is the name of the user defined command.\n\
-With no argument, show definitions of all user defined commands.", &showlist);
-  add_com ("apropos", class_support, apropos_command, "Search for commands matching a REGEXP");
-}
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
new file mode 100644
index 0000000..a456e9a
--- /dev/null
+++ b/gdb/cli/cli-decode.h
@@ -0,0 +1,357 @@
+/* Header file for GDB command decoding library.
+   Copyright (C) 2000 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.  */
+
+#if !defined (CLI_DECODE_H)
+#define CLI_DECODE_H 1
+
+#include "gnu-regex.h"   /* Needed by apropos_cmd. */
+
+/* Command classes are top-level categories into which commands are broken
+   down for "help" purposes.  
+   Notes on classes: class_alias is for alias commands which are not
+   abbreviations of the original command.  class-pseudo is for
+   commands which are not really commands nor help topics ("stop").  */
+
+enum command_class
+{
+  /* Special args to help_list */
+  class_deprecated, all_classes = -2, all_commands = -1,
+  /* Classes of commands */
+  no_class = -1, class_run = 0, class_vars, class_stack,
+  class_files, class_support, class_info, class_breakpoint, class_trace,
+  class_alias, class_obscure, class_user, class_maintenance,
+  class_pseudo, class_tui, class_xdb
+};
+
+/* Not a set/show command.  Note that some commands which begin with
+   "set" or "show" might be in this category, if their syntax does
+   not fall into one of the following categories.  */
+typedef enum cmd_types
+  {
+    not_set_cmd,
+    set_cmd,
+    show_cmd
+  }
+cmd_types;
+
+/* Reasonable values for an AUTO_BOOLEAN variable. */
+enum cmd_auto_boolean
+{
+  CMD_AUTO_BOOLEAN_TRUE,
+  CMD_AUTO_BOOLEAN_FALSE,
+  CMD_AUTO_BOOLEAN_AUTO
+};
+
+/* Types of "set" or "show" command.  */
+typedef enum var_types
+  {
+    /* "on" or "off".  *VAR is an integer which is nonzero for on,
+       zero for off.  */
+    var_boolean,
+
+    /* "on" / "true" / "enable" or "off" / "false" / "disable" or
+       "auto.  *VAR is an ``enum cmd_auto_boolean''.  NOTE: In general
+       a custom show command will need to be implemented - one that
+       for "auto" prints both the "auto" and the current auto-selected
+       value. */
+    var_auto_boolean,
+
+    /* Unsigned Integer.  *VAR is an unsigned int.  The user can type 0
+       to mean "unlimited", which is stored in *VAR as UINT_MAX.  */
+    var_uinteger,
+
+    /* Like var_uinteger but signed.  *VAR is an int.  The user can type 0
+       to mean "unlimited", which is stored in *VAR as INT_MAX.  */
+    var_integer,
+
+    /* String which the user enters with escapes (e.g. the user types \n and
+       it is a real newline in the stored string).
+       *VAR is a malloc'd string, or NULL if the string is empty.  */
+    var_string,
+    /* String which stores what the user types verbatim.
+       *VAR is a malloc'd string, or NULL if the string is empty.  */
+    var_string_noescape,
+    /* String which stores a filename.
+       *VAR is a malloc'd string, or NULL if the string is empty.  */
+    var_filename,
+    /* ZeroableInteger.  *VAR is an int.  Like Unsigned Integer except
+       that zero really means zero.  */
+    var_zinteger,
+    /* Enumerated type.  Can only have one of the specified values.  *VAR is a
+       char pointer to the name of the element that we find.  */
+    var_enum
+  }
+var_types;
+
+/* This structure records one command'd definition.  */
+
+
+/* This flag is used by the code executing commands to warn the user 
+   the first time a deprecated command is used, see the 'flags' field in
+   the following struct.
+*/
+#define CMD_DEPRECATED            0x1
+#define DEPRECATED_WARN_USER      0x2
+#define MALLOCED_REPLACEMENT      0x4
+
+struct cmd_list_element
+  {
+    /* Points to next command in this list.  */
+    struct cmd_list_element *next;
+
+    /* Name of this command.  */
+    char *name;
+
+    /* Command class; class values are chosen by application program.  */
+    enum command_class class;
+
+    /* Function definition of this command.
+       NO_FUNCTION for command class names and for help topics that
+       are not really commands.  */
+    union
+      {
+	/* If type is not_set_cmd, call it like this:  */
+	void (*cfunc) (char *args, int from_tty);
+
+	/* If type is cmd_set or show_cmd, first set the variables, and
+	   then call this.  */
+	void (*sfunc) (char *args, int from_tty, struct cmd_list_element * c);
+      }
+    function;
+#define NO_FUNCTION ((void (*) (char *args, int from_tty)) 0)
+
+    /* Documentation of this command (or help topic).
+       First line is brief documentation; remaining lines form, with it,
+       the full documentation.  First line should end with a period.
+       Entire string should also end with a period, not a newline.  */
+    char *doc;
+
+    /* flags : a bitfield 
+       
+       bit 0: (LSB) CMD_DEPRECATED, when 1 indicated that this command
+       is deprecated. It may be removed from gdb's command set in the
+       future.
+
+       bit 1: DEPRECATED_WARN_USER, the user needs to be warned that
+       this is a deprecated command.  The user should only be warned
+       the first time a command is used.
+        
+       bit 2: MALLOCED_REPLACEMENT, when functions are deprecated at
+       compile time (this is the way it should, in general, be done)
+       the memory containing the replacement string is statically
+       allocated.  In some cases it makes sense to deprecate commands
+       at runtime (the testsuite is one example).  In this case the
+       memory for replacement is malloc'ed.  When a command is
+       undeprecated or re-deprecated at runtime we don't want to risk
+       calling free on statically allocated memory, so we check this
+       flag.  
+     */
+    int flags;
+
+    /* if this command is deprecated, this is the replacement name */
+    char *replacement;
+
+    /* Hook for another command to be executed before this command.  */
+    struct cmd_list_element *hook_pre;
+
+    /* Hook for another command to be executed after this command.  */
+    struct cmd_list_element *hook_post;
+
+    /* Flag that specifies if this command is already running it's hook. */
+    /* Prevents the possibility of hook recursion. */
+    int hook_in;
+
+    /* Nonzero identifies a prefix command.  For them, the address
+       of the variable containing the list of subcommands.  */
+    struct cmd_list_element **prefixlist;
+
+    /* For prefix commands only:
+       String containing prefix commands to get here: this one
+       plus any others needed to get to it.  Should end in a space.
+       It is used before the word "command" in describing the
+       commands reached through this prefix.  */
+    char *prefixname;
+
+    /* For prefix commands only:
+       nonzero means do not get an error if subcommand is not
+       recognized; call the prefix's own function in that case.  */
+    char allow_unknown;
+
+    /* Nonzero says this is an abbreviation, and should not
+       be mentioned in lists of commands.
+       This allows "br<tab>" to complete to "break", which it
+       otherwise wouldn't.  */
+    char abbrev_flag;
+
+    /* Completion routine for this command.  TEXT is the text beyond
+       what was matched for the command itself (leading whitespace is
+       skipped).  It stops where we are supposed to stop completing
+       (rl_point) and is '\0' terminated.
+
+       Return value is a malloc'd vector of pointers to possible completions
+       terminated with NULL.  If there are no completions, returning a pointer
+       to a NULL would work but returning NULL itself is also valid.
+       WORD points in the same buffer as TEXT, and completions should be
+       returned relative to this position.  For example, suppose TEXT is "foo"
+       and we want to complete to "foobar".  If WORD is "oo", return
+       "oobar"; if WORD is "baz/foo", return "baz/foobar".  */
+    char **(*completer) (char *text, char *word);
+
+    /* Type of "set" or "show" command (or SET_NOT_SET if not "set"
+       or "show").  */
+    cmd_types type;
+
+    /* Pointer to variable affected by "set" and "show".  Doesn't matter
+       if type is not_set.  */
+    void *var;
+
+    /* What kind of variable is *VAR?  */
+    var_types var_type;
+
+    /* Pointer to NULL terminated list of enumerated values (like argv).  */
+    const char **enums;
+
+    /* Pointer to command strings of user-defined commands */
+    struct command_line *user_commands;
+
+    /* Pointer to command that is hooked by this one, (by hook_pre)
+       so the hook can be removed when this one is deleted.  */
+    struct cmd_list_element *hookee_pre;
+
+    /* Pointer to command that is hooked by this one, (by hook_post)
+       so the hook can be removed when this one is deleted.  */
+    struct cmd_list_element *hookee_post;
+
+    /* Pointer to command that is aliased by this one, so the
+       aliased command can be located in case it has been hooked.  */
+    struct cmd_list_element *cmd_pointer;
+  };
+
+/* API to the manipulation of command lists.  */
+
+extern struct cmd_list_element *add_cmd (char *, enum command_class,
+					 void (*fun) (char *, int), char *,
+					 struct cmd_list_element **);
+
+extern struct cmd_list_element *add_alias_cmd (char *, char *,
+					       enum command_class, int,
+					       struct cmd_list_element **);
+
+extern struct cmd_list_element *add_prefix_cmd (char *, enum command_class,
+						void (*fun) (char *, int),
+						char *,
+						struct cmd_list_element **,
+						char *, int,
+						struct cmd_list_element **);
+
+extern struct cmd_list_element *add_abbrev_prefix_cmd (char *,
+						       enum command_class,
+						       void (*fun) (char *,
+								    int),
+						       char *,
+						       struct cmd_list_element
+						       **, char *, int,
+						       struct cmd_list_element
+						       **);
+
+extern struct cmd_list_element *lookup_cmd (char **,
+					    struct cmd_list_element *, char *,
+					    int, int);
+
+extern struct cmd_list_element *lookup_cmd_1 (char **,
+					      struct cmd_list_element *,
+					      struct cmd_list_element **,
+					      int);
+
+extern struct cmd_list_element *
+  deprecate_cmd (struct cmd_list_element *, char * );
+
+extern void
+  deprecated_cmd_warning (char **);
+
+extern int
+  lookup_cmd_composition (char *text,
+                        struct cmd_list_element **alias,
+                        struct cmd_list_element **prefix_cmd,
+                        struct cmd_list_element **cmd);
+
+extern struct cmd_list_element *add_com (char *, enum command_class,
+					 void (*fun) (char *, int), char *);
+
+extern struct cmd_list_element *add_com_alias (char *, char *,
+					       enum command_class, int);
+
+extern struct cmd_list_element *add_info (char *, void (*fun) (char *, int),
+					  char *);
+
+extern struct cmd_list_element *add_info_alias (char *, char *, int);
+
+extern char **complete_on_cmdlist (struct cmd_list_element *, char *, char *);
+
+extern char **complete_on_enum (const char *enumlist[], char *, char *);
+
+extern void delete_cmd (char *, struct cmd_list_element **);
+
+extern void help_cmd_list (struct cmd_list_element *, enum command_class,
+			   char *, int, struct ui_file *);
+
+extern struct cmd_list_element *add_set_cmd (char *name, enum
+					     command_class class,
+					     var_types var_type, void *var,
+					     char *doc,
+					     struct cmd_list_element **list);
+
+extern struct cmd_list_element *add_set_enum_cmd (char *name,
+						  enum command_class class,
+						  const char *enumlist[],
+						  const char **var,
+						  char *doc,
+						  struct cmd_list_element **list);
+
+extern struct cmd_list_element *add_set_auto_boolean_cmd (char *name,
+							  enum command_class class,
+							  enum cmd_auto_boolean *var,
+							  char *doc,
+							  struct cmd_list_element **list);
+
+extern struct cmd_list_element *add_show_from_set (struct cmd_list_element *,
+						   struct cmd_list_element
+						   **);
+
+/* Functions that implement commands about CLI commands. */
+
+extern void help_cmd (char *, struct ui_file *);
+
+extern void help_list (struct cmd_list_element *, char *,
+		       enum command_class, struct ui_file *);
+
+extern void apropos_cmd (struct ui_file *, struct cmd_list_element *,
+                         struct re_pattern_buffer *, char *);
+
+/* Used to mark commands that don't do anything.  If we just leave the
+   function field NULL, the command is interpreted as a help topic, or
+   as a class of commands.  */
+
+extern void not_just_help_class_command (char *arg, int from_tty);
+
+/* Exported to cli/cli-setshow.c */
+
+extern void print_doc_line (struct ui_file *, char *);
+
+
+#endif /* !defined (CLI_DECODE_H) */
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
new file mode 100644
index 0000000..66aa4fa
--- /dev/null
+++ b/gdb/cli/cli-script.c
@@ -0,0 +1,1315 @@
+/* GDB CLI command scripting.
+   Copyright 1986-2000 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 "value.h"
+#include "language.h"		/* For value_true */
+#include <ctype.h>
+
+#ifdef UI_OUT
+#include "ui-out.h"
+#endif
+
+#include "top.h"
+#include "cli/cli-cmds.h"
+#include "cli/cli-decode.h"
+#include "cli/cli-script.h"
+
+/* From gdb/top.c */
+
+extern void dont_repeat (void);
+
+extern void do_restore_instream_cleanup (void *stream);
+
+/* Prototypes for local functions */
+
+static struct cleanup *
+	make_cleanup_free_command_lines (struct command_line **arg);
+
+static enum command_control_type
+	recurse_read_control_structure (struct command_line *current_cmd);
+
+static char *insert_args (char *line);
+
+static struct cleanup * setup_user_args (char *p);
+
+static void validate_comname (char *);
+
+/* Level of control structure.  */
+static int control_level;
+
+/* Source command state variable. */
+static int source_error_allocated;
+
+/* Structure for arguments to user defined functions.  */
+#define MAXUSERARGS 10
+struct user_args
+  {
+    struct user_args *next;
+    struct
+      {
+	char *arg;
+	int len;
+      }
+    a[MAXUSERARGS];
+    int count;
+  }
+ *user_args;
+
+
+/* Allocate, initialize a new command line structure for one of the
+   control commands (if/while).  */
+
+static struct command_line *
+build_command_line (enum command_control_type type, char *args)
+{
+  struct command_line *cmd;
+
+  if (args == NULL)
+    error ("if/while commands require arguments.\n");
+
+  cmd = (struct command_line *) xmalloc (sizeof (struct command_line));
+  cmd->next = NULL;
+  cmd->control_type = type;
+
+  cmd->body_count = 1;
+  cmd->body_list
+    = (struct command_line **) xmalloc (sizeof (struct command_line *)
+					* cmd->body_count);
+  memset (cmd->body_list, 0, sizeof (struct command_line *) * cmd->body_count);
+  cmd->line = savestring (args, strlen (args));
+  return cmd;
+}
+
+/* Build and return a new command structure for the control commands
+   such as "if" and "while".  */
+
+static struct command_line *
+get_command_line (enum command_control_type type, char *arg)
+{
+  struct command_line *cmd;
+  struct cleanup *old_chain = NULL;
+
+  /* Allocate and build a new command line structure.  */
+  cmd = build_command_line (type, arg);
+
+  old_chain = make_cleanup_free_command_lines (&cmd);
+
+  /* Read in the body of this command.  */
+  if (recurse_read_control_structure (cmd) == invalid_control)
+    {
+      warning ("error reading in control structure\n");
+      do_cleanups (old_chain);
+      return NULL;
+    }
+
+  discard_cleanups (old_chain);
+  return cmd;
+}
+
+/* Recursively print a command (including full control structures).  */
+#ifdef UI_OUT
+void
+print_command_lines (struct ui_out *uiout, struct command_line *cmd,
+		     unsigned int depth)
+{
+  struct command_line *list;
+
+  list = cmd;
+  while (list)
+    {
+
+      if (depth)
+	ui_out_spaces (uiout, 2 * depth);
+
+      /* A simple command, print it and continue.  */
+      if (list->control_type == simple_control)
+	{
+	  ui_out_field_string (uiout, NULL, list->line);
+	  ui_out_text (uiout, "\n");
+	  list = list->next;
+	  continue;
+	}
+
+      /* loop_continue to jump to the start of a while loop, print it
+         and continue. */
+      if (list->control_type == continue_control)
+	{
+	  ui_out_field_string (uiout, NULL, "loop_continue");
+	  ui_out_text (uiout, "\n");
+	  list = list->next;
+	  continue;
+	}
+
+      /* loop_break to break out of a while loop, print it and continue.  */
+      if (list->control_type == break_control)
+	{
+	  ui_out_field_string (uiout, NULL, "loop_break");
+	  ui_out_text (uiout, "\n");
+	  list = list->next;
+	  continue;
+	}
+
+      /* A while command.  Recursively print its subcommands and continue.  */
+      if (list->control_type == while_control)
+	{
+	  ui_out_text (uiout, "while ");
+	  ui_out_field_fmt (uiout, NULL, "while %s", list->line);
+	  ui_out_text (uiout, "\n");
+	  print_command_lines (uiout, *list->body_list, depth + 1);
+	  ui_out_field_string (uiout, NULL, "end");
+	  if (depth)
+	    ui_out_spaces (uiout, 2 * depth);
+	  ui_out_text (uiout, "end\n");
+	  list = list->next;
+	  continue;
+	}
+
+      /* An if command.  Recursively print both arms before continueing.  */
+      if (list->control_type == if_control)
+	{
+	  ui_out_text (uiout, "if ");
+	  ui_out_field_fmt (uiout, NULL, "if %s", list->line);
+	  ui_out_text (uiout, "\n");
+	  /* The true arm. */
+	  print_command_lines (uiout, list->body_list[0], depth + 1);
+
+	  /* Show the false arm if it exists.  */
+	  if (list->body_count == 2)
+	    {
+	      if (depth)
+		ui_out_spaces (uiout, 2 * depth);
+	      ui_out_field_string (uiout, NULL, "else");
+	      ui_out_text (uiout, "else\n");
+	      print_command_lines (uiout, list->body_list[1], depth + 1);
+	    }
+
+	  ui_out_field_string (uiout, NULL, "end");
+	  if (depth)
+	    ui_out_spaces (uiout, 2 * depth);
+	  ui_out_text (uiout, "end\n");
+	  list = list->next;
+	  continue;
+	}
+
+      /* ignore illegal command type and try next */
+      list = list->next;
+    }				/* while (list) */
+}
+#else
+void
+print_command_line (struct command_line *cmd, unsigned int depth,
+		    struct ui_file *stream)
+{
+  unsigned int i;
+
+  if (depth)
+    {
+      for (i = 0; i < depth; i++)
+	fputs_filtered ("  ", stream);
+    }
+
+  /* A simple command, print it and return.  */
+  if (cmd->control_type == simple_control)
+    {
+      fputs_filtered (cmd->line, stream);
+      fputs_filtered ("\n", stream);
+      return;
+    }
+
+  /* loop_continue to jump to the start of a while loop, print it
+     and return. */
+  if (cmd->control_type == continue_control)
+    {
+      fputs_filtered ("loop_continue\n", stream);
+      return;
+    }
+
+  /* loop_break to break out of a while loop, print it and return.  */
+  if (cmd->control_type == break_control)
+    {
+      fputs_filtered ("loop_break\n", stream);
+      return;
+    }
+
+  /* A while command.  Recursively print its subcommands before returning.  */
+  if (cmd->control_type == while_control)
+    {
+      struct command_line *list;
+      fputs_filtered ("while ", stream);
+      fputs_filtered (cmd->line, stream);
+      fputs_filtered ("\n", stream);
+      list = *cmd->body_list;
+      while (list)
+	{
+	  print_command_line (list, depth + 1, stream);
+	  list = list->next;
+	}
+    }
+
+  /* An if command.  Recursively print both arms before returning.  */
+  if (cmd->control_type == if_control)
+    {
+      fputs_filtered ("if ", stream);
+      fputs_filtered (cmd->line, stream);
+      fputs_filtered ("\n", stream);
+      /* The true arm. */
+      print_command_line (cmd->body_list[0], depth + 1, stream);
+
+      /* Show the false arm if it exists.  */
+      if (cmd->body_count == 2)
+	{
+	  if (depth)
+	    {
+	      for (i = 0; i < depth; i++)
+		fputs_filtered ("  ", stream);
+	    }
+	  fputs_filtered ("else\n", stream);
+	  print_command_line (cmd->body_list[1], depth + 1, stream);
+	}
+      if (depth)
+	{
+	  for (i = 0; i < depth; i++)
+	    fputs_filtered ("  ", stream);
+	}
+      fputs_filtered ("end\n", stream);
+    }
+}
+#endif
+
+/* Execute the command in CMD.  */
+
+void
+execute_user_command (struct cmd_list_element *c, char *args)
+{
+  register struct command_line *cmdlines;
+  struct cleanup *old_chain;
+  enum command_control_type ret;
+
+  old_chain = setup_user_args (args);
+
+  cmdlines = c->user_commands;
+  if (cmdlines == 0)
+    /* Null command */
+    return;
+
+  /* Set the instream to 0, indicating execution of a
+     user-defined function.  */
+  old_chain = make_cleanup (do_restore_instream_cleanup, instream);
+  instream = (FILE *) 0;
+  while (cmdlines)
+    {
+      ret = execute_control_command (cmdlines);
+      if (ret != simple_control && ret != break_control)
+	{
+	  warning ("Error in control structure.\n");
+	  break;
+	}
+      cmdlines = cmdlines->next;
+    }
+  do_cleanups (old_chain);
+}
+
+enum command_control_type
+execute_control_command (struct command_line *cmd)
+{
+  struct expression *expr;
+  struct command_line *current;
+  struct cleanup *old_chain = 0;
+  value_ptr val;
+  value_ptr val_mark;
+  int loop;
+  enum command_control_type ret;
+  char *new_line;
+
+  switch (cmd->control_type)
+    {
+    case simple_control:
+      /* A simple command, execute it and return.  */
+      new_line = insert_args (cmd->line);
+      if (!new_line)
+	return invalid_control;
+      old_chain = make_cleanup (free_current_contents, &new_line);
+      execute_command (new_line, 0);
+      ret = cmd->control_type;
+      break;
+
+    case continue_control:
+    case break_control:
+      /* Return for "continue", and "break" so we can either
+         continue the loop at the top, or break out.  */
+      ret = cmd->control_type;
+      break;
+
+    case while_control:
+      {
+	/* Parse the loop control expression for the while statement.  */
+	new_line = insert_args (cmd->line);
+	if (!new_line)
+	  return invalid_control;
+	old_chain = make_cleanup (free_current_contents, &new_line);
+	expr = parse_expression (new_line);
+	make_cleanup (free_current_contents, &expr);
+
+	ret = simple_control;
+	loop = 1;
+
+	/* Keep iterating so long as the expression is true.  */
+	while (loop == 1)
+	  {
+	    int cond_result;
+
+	    QUIT;
+
+	    /* Evaluate the expression.  */
+	    val_mark = value_mark ();
+	    val = evaluate_expression (expr);
+	    cond_result = value_true (val);
+	    value_free_to_mark (val_mark);
+
+	    /* If the value is false, then break out of the loop.  */
+	    if (!cond_result)
+	      break;
+
+	    /* Execute the body of the while statement.  */
+	    current = *cmd->body_list;
+	    while (current)
+	      {
+		ret = execute_control_command (current);
+
+		/* If we got an error, or a "break" command, then stop
+		   looping.  */
+		if (ret == invalid_control || ret == break_control)
+		  {
+		    loop = 0;
+		    break;
+		  }
+
+		/* If we got a "continue" command, then restart the loop
+		   at this point.  */
+		if (ret == continue_control)
+		  break;
+
+		/* Get the next statement.  */
+		current = current->next;
+	      }
+	  }
+
+	/* Reset RET so that we don't recurse the break all the way down.  */
+	if (ret == break_control)
+	  ret = simple_control;
+
+	break;
+      }
+
+    case if_control:
+      {
+	new_line = insert_args (cmd->line);
+	if (!new_line)
+	  return invalid_control;
+	old_chain = make_cleanup (free_current_contents, &new_line);
+	/* Parse the conditional for the if statement.  */
+	expr = parse_expression (new_line);
+	make_cleanup (free_current_contents, &expr);
+
+	current = NULL;
+	ret = simple_control;
+
+	/* Evaluate the conditional.  */
+	val_mark = value_mark ();
+	val = evaluate_expression (expr);
+
+	/* Choose which arm to take commands from based on the value of the
+	   conditional expression.  */
+	if (value_true (val))
+	  current = *cmd->body_list;
+	else if (cmd->body_count == 2)
+	  current = *(cmd->body_list + 1);
+	value_free_to_mark (val_mark);
+
+	/* Execute commands in the given arm.  */
+	while (current)
+	  {
+	    ret = execute_control_command (current);
+
+	    /* If we got an error, get out.  */
+	    if (ret != simple_control)
+	      break;
+
+	    /* Get the next statement in the body.  */
+	    current = current->next;
+	  }
+
+	break;
+      }
+
+    default:
+      warning ("Invalid control type in command structure.");
+      return invalid_control;
+    }
+
+  if (old_chain)
+    do_cleanups (old_chain);
+
+  return ret;
+}
+
+/* "while" command support.  Executes a body of statements while the
+   loop condition is nonzero.  */
+
+void
+while_command (char *arg, int from_tty)
+{
+  struct command_line *command = NULL;
+
+  control_level = 1;
+  command = get_command_line (while_control, arg);
+
+  if (command == NULL)
+    return;
+
+  execute_control_command (command);
+  free_command_lines (&command);
+}
+
+/* "if" command support.  Execute either the true or false arm depending
+   on the value of the if conditional.  */
+
+void
+if_command (char *arg, int from_tty)
+{
+  struct command_line *command = NULL;
+
+  control_level = 1;
+  command = get_command_line (if_control, arg);
+
+  if (command == NULL)
+    return;
+
+  execute_control_command (command);
+  free_command_lines (&command);
+}
+
+/* Cleanup */
+static void
+arg_cleanup (void *ignore)
+{
+  struct user_args *oargs = user_args;
+  if (!user_args)
+    internal_error ("Internal error, arg_cleanup called with no user args.\n");
+
+  user_args = user_args->next;
+  xfree (oargs);
+}
+
+/* Bind the incomming arguments for a user defined command to
+   $arg0, $arg1 ... $argMAXUSERARGS.  */
+
+static struct cleanup *
+setup_user_args (char *p)
+{
+  struct user_args *args;
+  struct cleanup *old_chain;
+  unsigned int arg_count = 0;
+
+  args = (struct user_args *) xmalloc (sizeof (struct user_args));
+  memset (args, 0, sizeof (struct user_args));
+
+  args->next = user_args;
+  user_args = args;
+
+  old_chain = make_cleanup (arg_cleanup, 0/*ignored*/);
+
+  if (p == NULL)
+    return old_chain;
+
+  while (*p)
+    {
+      char *start_arg;
+      int squote = 0;
+      int dquote = 0;
+      int bsquote = 0;
+
+      if (arg_count >= MAXUSERARGS)
+	{
+	  error ("user defined function may only have %d arguments.\n",
+		 MAXUSERARGS);
+	  return old_chain;
+	}
+
+      /* Strip whitespace.  */
+      while (*p == ' ' || *p == '\t')
+	p++;
+
+      /* P now points to an argument.  */
+      start_arg = p;
+      user_args->a[arg_count].arg = p;
+
+      /* Get to the end of this argument.  */
+      while (*p)
+	{
+	  if (((*p == ' ' || *p == '\t')) && !squote && !dquote && !bsquote)
+	    break;
+	  else
+	    {
+	      if (bsquote)
+		bsquote = 0;
+	      else if (*p == '\\')
+		bsquote = 1;
+	      else if (squote)
+		{
+		  if (*p == '\'')
+		    squote = 0;
+		}
+	      else if (dquote)
+		{
+		  if (*p == '"')
+		    dquote = 0;
+		}
+	      else
+		{
+		  if (*p == '\'')
+		    squote = 1;
+		  else if (*p == '"')
+		    dquote = 1;
+		}
+	      p++;
+	    }
+	}
+
+      user_args->a[arg_count].len = p - start_arg;
+      arg_count++;
+      user_args->count++;
+    }
+  return old_chain;
+}
+
+/* Given character string P, return a point to the first argument ($arg),
+   or NULL if P contains no arguments.  */
+
+static char *
+locate_arg (char *p)
+{
+  while ((p = strchr (p, '$')))
+    {
+      if (strncmp (p, "$arg", 4) == 0 && isdigit (p[4]))
+	return p;
+      p++;
+    }
+  return NULL;
+}
+
+/* Insert the user defined arguments stored in user_arg into the $arg
+   arguments found in line, with the updated copy being placed into nline.  */
+
+static char *
+insert_args (char *line)
+{
+  char *p, *save_line, *new_line;
+  unsigned len, i;
+
+  /* First we need to know how much memory to allocate for the new line.  */
+  save_line = line;
+  len = 0;
+  while ((p = locate_arg (line)))
+    {
+      len += p - line;
+      i = p[4] - '0';
+
+      if (i >= user_args->count)
+	{
+	  error ("Missing argument %d in user function.\n", i);
+	  return NULL;
+	}
+      len += user_args->a[i].len;
+      line = p + 5;
+    }
+
+  /* Don't forget the tail.  */
+  len += strlen (line);
+
+  /* Allocate space for the new line and fill it in.  */
+  new_line = (char *) xmalloc (len + 1);
+  if (new_line == NULL)
+    return NULL;
+
+  /* Restore pointer to beginning of old line.  */
+  line = save_line;
+
+  /* Save pointer to beginning of new line.  */
+  save_line = new_line;
+
+  while ((p = locate_arg (line)))
+    {
+      int i, len;
+
+      memcpy (new_line, line, p - line);
+      new_line += p - line;
+      i = p[4] - '0';
+
+      len = user_args->a[i].len;
+      if (len)
+	{
+	  memcpy (new_line, user_args->a[i].arg, len);
+	  new_line += len;
+	}
+      line = p + 5;
+    }
+  /* Don't forget the tail.  */
+  strcpy (new_line, line);
+
+  /* Return a pointer to the beginning of the new line.  */
+  return save_line;
+}
+
+
+/* Expand the body_list of COMMAND so that it can hold NEW_LENGTH
+   code bodies.  This is typically used when we encounter an "else"
+   clause for an "if" command.  */
+
+static void
+realloc_body_list (struct command_line *command, int new_length)
+{
+  int n;
+  struct command_line **body_list;
+
+  n = command->body_count;
+
+  /* Nothing to do?  */
+  if (new_length <= n)
+    return;
+
+  body_list = (struct command_line **)
+    xmalloc (sizeof (struct command_line *) * new_length);
+
+  memcpy (body_list, command->body_list, sizeof (struct command_line *) * n);
+
+  xfree (command->body_list);
+  command->body_list = body_list;
+  command->body_count = new_length;
+}
+
+/* Read one line from the input stream.  If the command is an "else" or
+   "end", return such an indication to the caller.  */
+
+static enum misc_command_type
+read_next_line (struct command_line **command)
+{
+  char *p, *p1, *prompt_ptr, control_prompt[256];
+  int i = 0;
+
+  if (control_level >= 254)
+    error ("Control nesting too deep!\n");
+
+  /* Set a prompt based on the nesting of the control commands.  */
+  if (instream == stdin || (instream == 0 && readline_hook != NULL))
+    {
+      for (i = 0; i < control_level; i++)
+	control_prompt[i] = ' ';
+      control_prompt[i] = '>';
+      control_prompt[i + 1] = '\0';
+      prompt_ptr = (char *) &control_prompt[0];
+    }
+  else
+    prompt_ptr = NULL;
+
+  p = command_line_input (prompt_ptr, instream == stdin, "commands");
+
+  /* Not sure what to do here.  */
+  if (p == NULL)
+    return end_command;
+
+  /* Strip leading and trailing whitespace.  */
+  while (*p == ' ' || *p == '\t')
+    p++;
+
+  p1 = p + strlen (p);
+  while (p1 != p && (p1[-1] == ' ' || p1[-1] == '\t'))
+    p1--;
+
+  /* Blanks and comments don't really do anything, but we need to
+     distinguish them from else, end and other commands which can be
+     executed.  */
+  if (p1 == p || p[0] == '#')
+    return nop_command;
+
+  /* Is this the end of a simple, while, or if control structure?  */
+  if (p1 - p == 3 && !strncmp (p, "end", 3))
+    return end_command;
+
+  /* Is the else clause of an if control structure?  */
+  if (p1 - p == 4 && !strncmp (p, "else", 4))
+    return else_command;
+
+  /* Check for while, if, break, continue, etc and build a new command
+     line structure for them.  */
+  if (p1 - p > 5 && !strncmp (p, "while", 5))
+    *command = build_command_line (while_control, p + 6);
+  else if (p1 - p > 2 && !strncmp (p, "if", 2))
+    *command = build_command_line (if_control, p + 3);
+  else if (p1 - p == 10 && !strncmp (p, "loop_break", 10))
+    {
+      *command = (struct command_line *)
+	xmalloc (sizeof (struct command_line));
+      (*command)->next = NULL;
+      (*command)->line = NULL;
+      (*command)->control_type = break_control;
+      (*command)->body_count = 0;
+      (*command)->body_list = NULL;
+    }
+  else if (p1 - p == 13 && !strncmp (p, "loop_continue", 13))
+    {
+      *command = (struct command_line *)
+	xmalloc (sizeof (struct command_line));
+      (*command)->next = NULL;
+      (*command)->line = NULL;
+      (*command)->control_type = continue_control;
+      (*command)->body_count = 0;
+      (*command)->body_list = NULL;
+    }
+  else
+    {
+      /* A normal command.  */
+      *command = (struct command_line *)
+	xmalloc (sizeof (struct command_line));
+      (*command)->next = NULL;
+      (*command)->line = savestring (p, p1 - p);
+      (*command)->control_type = simple_control;
+      (*command)->body_count = 0;
+      (*command)->body_list = NULL;
+    }
+
+  /* Nothing special.  */
+  return ok_command;
+}
+
+/* Recursively read in the control structures and create a command_line 
+   structure from them.
+
+   The parent_control parameter is the control structure in which the
+   following commands are nested.  */
+
+static enum command_control_type
+recurse_read_control_structure (struct command_line *current_cmd)
+{
+  int current_body, i;
+  enum misc_command_type val;
+  enum command_control_type ret;
+  struct command_line **body_ptr, *child_tail, *next;
+
+  child_tail = NULL;
+  current_body = 1;
+
+  /* Sanity checks.  */
+  if (current_cmd->control_type == simple_control)
+    {
+      error ("Recursed on a simple control type\n");
+      return invalid_control;
+    }
+
+  if (current_body > current_cmd->body_count)
+    {
+      error ("Allocated body is smaller than this command type needs\n");
+      return invalid_control;
+    }
+
+  /* Read lines from the input stream and build control structures.  */
+  while (1)
+    {
+      dont_repeat ();
+
+      next = NULL;
+      val = read_next_line (&next);
+
+      /* Just skip blanks and comments.  */
+      if (val == nop_command)
+	continue;
+
+      if (val == end_command)
+	{
+	  if (current_cmd->control_type == while_control
+	      || current_cmd->control_type == if_control)
+	    {
+	      /* Success reading an entire control structure.  */
+	      ret = simple_control;
+	      break;
+	    }
+	  else
+	    {
+	      ret = invalid_control;
+	      break;
+	    }
+	}
+
+      /* Not the end of a control structure.  */
+      if (val == else_command)
+	{
+	  if (current_cmd->control_type == if_control
+	      && current_body == 1)
+	    {
+	      realloc_body_list (current_cmd, 2);
+	      current_body = 2;
+	      child_tail = NULL;
+	      continue;
+	    }
+	  else
+	    {
+	      ret = invalid_control;
+	      break;
+	    }
+	}
+
+      if (child_tail)
+	{
+	  child_tail->next = next;
+	}
+      else
+	{
+	  body_ptr = current_cmd->body_list;
+	  for (i = 1; i < current_body; i++)
+	    body_ptr++;
+
+	  *body_ptr = next;
+
+	}
+
+      child_tail = next;
+
+      /* If the latest line is another control structure, then recurse
+         on it.  */
+      if (next->control_type == while_control
+	  || next->control_type == if_control)
+	{
+	  control_level++;
+	  ret = recurse_read_control_structure (next);
+	  control_level--;
+
+	  if (ret != simple_control)
+	    break;
+	}
+    }
+
+  dont_repeat ();
+
+  return ret;
+}
+
+/* Read lines from the input stream and accumulate them in a chain of
+   struct command_line's, which is then returned.  For input from a
+   terminal, the special command "end" is used to mark the end of the
+   input, and is not included in the returned chain of commands. */
+
+#define END_MESSAGE "End with a line saying just \"end\"."
+
+struct command_line *
+read_command_lines (char *prompt_arg, int from_tty)
+{
+  struct command_line *head, *tail, *next;
+  struct cleanup *old_chain;
+  enum command_control_type ret;
+  enum misc_command_type val;
+
+  control_level = 0;
+  if (readline_begin_hook)
+    {
+      /* Note - intentional to merge messages with no newline */
+      (*readline_begin_hook) ("%s  %s\n", prompt_arg, END_MESSAGE);
+    }
+  else if (from_tty && input_from_terminal_p ())
+    {
+      printf_unfiltered ("%s\n%s\n", prompt_arg, END_MESSAGE);
+      gdb_flush (gdb_stdout);
+    }
+
+  head = tail = NULL;
+  old_chain = NULL;
+
+  while (1)
+    {
+      val = read_next_line (&next);
+
+      /* Ignore blank lines or comments.  */
+      if (val == nop_command)
+	continue;
+
+      if (val == end_command)
+	{
+	  ret = simple_control;
+	  break;
+	}
+
+      if (val != ok_command)
+	{
+	  ret = invalid_control;
+	  break;
+	}
+
+      if (next->control_type == while_control
+	  || next->control_type == if_control)
+	{
+	  control_level++;
+	  ret = recurse_read_control_structure (next);
+	  control_level--;
+
+	  if (ret == invalid_control)
+	    break;
+	}
+
+      if (tail)
+	{
+	  tail->next = next;
+	}
+      else
+	{
+	  head = next;
+	  old_chain = make_cleanup_free_command_lines (&head);
+	}
+      tail = next;
+    }
+
+  dont_repeat ();
+
+  if (head)
+    {
+      if (ret != invalid_control)
+	{
+	  discard_cleanups (old_chain);
+	}
+      else
+	do_cleanups (old_chain);
+    }
+
+  if (readline_end_hook)
+    {
+      (*readline_end_hook) ();
+    }
+  return (head);
+}
+
+/* Free a chain of struct command_line's.  */
+
+void
+free_command_lines (struct command_line **lptr)
+{
+  register struct command_line *l = *lptr;
+  register struct command_line *next;
+  struct command_line **blist;
+  int i;
+
+  while (l)
+    {
+      if (l->body_count > 0)
+	{
+	  blist = l->body_list;
+	  for (i = 0; i < l->body_count; i++, blist++)
+	    free_command_lines (blist);
+	}
+      next = l->next;
+      xfree (l->line);
+      xfree (l);
+      l = next;
+    }
+}
+
+static void
+do_free_command_lines_cleanup (void *arg)
+{
+  free_command_lines (arg);
+}
+
+static struct cleanup *
+make_cleanup_free_command_lines (struct command_line **arg)
+{
+  return make_cleanup (do_free_command_lines_cleanup, arg);
+}
+
+static void
+validate_comname (char *comname)
+{
+  register char *p;
+
+  if (comname == 0)
+    error_no_arg ("name of command to define");
+
+  p = comname;
+  while (*p)
+    {
+      if (!isalnum (*p) && *p != '-' && *p != '_')
+	error ("Junk in argument list: \"%s\"", p);
+      p++;
+    }
+}
+
+/* This is just a placeholder in the command data structures.  */
+static void
+user_defined_command (char *ignore, int from_tty)
+{
+}
+
+void
+define_command (char *comname, int from_tty)
+{
+#define MAX_TMPBUF 128   
+  enum cmd_hook_type
+    {
+      CMD_NO_HOOK = 0,
+      CMD_PRE_HOOK,
+      CMD_POST_HOOK
+    };
+  register struct command_line *cmds;
+  register struct cmd_list_element *c, *newc, *oldc, *hookc = 0;
+  char *tem = comname;
+  char *tem2; 
+  char tmpbuf[MAX_TMPBUF];
+  int  hook_type      = CMD_NO_HOOK;
+  int  hook_name_size = 0;
+   
+#define	HOOK_STRING	"hook-"
+#define	HOOK_LEN 5
+#define HOOK_POST_STRING "hookpost-"
+#define HOOK_POST_LEN    9
+
+  validate_comname (comname);
+
+  /* Look it up, and verify that we got an exact match.  */
+  c = lookup_cmd (&tem, cmdlist, "", -1, 1);
+  if (c && !STREQ (comname, c->name))
+    c = 0;
+
+  if (c)
+    {
+      if (c->class == class_user || c->class == class_alias)
+	tem = "Redefine command \"%s\"? ";
+      else
+	tem = "Really redefine built-in command \"%s\"? ";
+      if (!query (tem, c->name))
+	error ("Command \"%s\" not redefined.", c->name);
+    }
+
+  /* If this new command is a hook, then mark the command which it
+     is hooking.  Note that we allow hooking `help' commands, so that
+     we can hook the `stop' pseudo-command.  */
+
+  if (!strncmp (comname, HOOK_STRING, HOOK_LEN))
+    {
+       hook_type      = CMD_PRE_HOOK;
+       hook_name_size = HOOK_LEN;
+    }
+  else if (!strncmp (comname, HOOK_POST_STRING, HOOK_POST_LEN))
+    {
+      hook_type      = CMD_POST_HOOK;
+      hook_name_size = HOOK_POST_LEN;
+    }
+   
+  if (hook_type != CMD_NO_HOOK)
+    {
+      /* Look up cmd it hooks, and verify that we got an exact match.  */
+      tem = comname + hook_name_size;
+      hookc = lookup_cmd (&tem, cmdlist, "", -1, 0);
+      if (hookc && !STREQ (comname + hook_name_size, hookc->name))
+	hookc = 0;
+      if (!hookc)
+	{
+	  warning ("Your new `%s' command does not hook any existing command.",
+		   comname);
+	  if (!query ("Proceed? "))
+	    error ("Not confirmed.");
+	}
+    }
+
+  comname = savestring (comname, strlen (comname));
+
+  /* If the rest of the commands will be case insensitive, this one
+     should behave in the same manner. */
+  for (tem = comname; *tem; tem++)
+    if (isupper (*tem))
+      *tem = tolower (*tem);
+
+  sprintf (tmpbuf, "Type commands for definition of \"%s\".", comname);
+  cmds = read_command_lines (tmpbuf, from_tty);
+
+  if (c && c->class == class_user)
+    free_command_lines (&c->user_commands);
+
+  newc = add_cmd (comname, class_user, user_defined_command,
+		  (c && c->class == class_user)
+		  ? c->doc : savestring ("User-defined.", 13), &cmdlist);
+  newc->user_commands = cmds;
+
+  /* If this new command is a hook, then mark both commands as being
+     tied.  */
+  if (hookc)
+    {
+      switch (hook_type)
+        {
+        case CMD_PRE_HOOK:
+          hookc->hook_pre  = newc;  /* Target gets hooked.  */
+          newc->hookee_pre = hookc; /* We are marked as hooking target cmd. */
+          break;
+        case CMD_POST_HOOK:
+          hookc->hook_pre  = newc;  /* Target gets hooked.  */
+          newc->hookee_pre = hookc; /* We are marked as hooking target cmd. */
+          break;
+        default:
+          /* Should never come here as hookc would be 0. */
+        }
+    }
+}
+
+void
+document_command (char *comname, int from_tty)
+{
+  struct command_line *doclines;
+  register struct cmd_list_element *c;
+  char *tem = comname;
+  char tmpbuf[128];
+
+  validate_comname (comname);
+
+  c = lookup_cmd (&tem, cmdlist, "", 0, 1);
+
+  if (c->class != class_user)
+    error ("Command \"%s\" is built-in.", comname);
+
+  sprintf (tmpbuf, "Type documentation for \"%s\".", comname);
+  doclines = read_command_lines (tmpbuf, from_tty);
+
+  if (c->doc)
+    xfree (c->doc);
+
+  {
+    register struct command_line *cl1;
+    register int len = 0;
+
+    for (cl1 = doclines; cl1; cl1 = cl1->next)
+      len += strlen (cl1->line) + 1;
+
+    c->doc = (char *) xmalloc (len + 1);
+    *c->doc = 0;
+
+    for (cl1 = doclines; cl1; cl1 = cl1->next)
+      {
+	strcat (c->doc, cl1->line);
+	if (cl1->next)
+	  strcat (c->doc, "\n");
+      }
+  }
+
+  free_command_lines (&doclines);
+}
+
+struct source_cleanup_lines_args
+{
+  int old_line;
+  char *old_file;
+  char *old_pre_error;
+  char *old_error_pre_print;
+};
+
+static void
+source_cleanup_lines (PTR args)
+{
+  struct source_cleanup_lines_args *p =
+  (struct source_cleanup_lines_args *) args;
+  source_line_number = p->old_line;
+  source_file_name = p->old_file;
+  source_pre_error = p->old_pre_error;
+  error_pre_print = p->old_error_pre_print;
+}
+
+/* ARGSUSED */
+static void
+do_fclose_cleanup (void *stream)
+{
+  fclose (stream);
+}
+
+/* Used to implement source_command */
+
+void
+script_from_file (FILE *stream, char *file)
+{
+  struct cleanup *old_cleanups;
+  struct source_cleanup_lines_args old_lines;
+  int needed_length;
+
+  if (stream == NULL)
+    {
+      internal_error ("called with NULL file pointer!");
+    }
+
+  old_cleanups = make_cleanup (do_fclose_cleanup, stream);
+
+  old_lines.old_line = source_line_number;
+  old_lines.old_file = source_file_name;
+  old_lines.old_pre_error = source_pre_error;
+  old_lines.old_error_pre_print = error_pre_print;
+  make_cleanup (source_cleanup_lines, &old_lines);
+  source_line_number = 0;
+  source_file_name = file;
+  source_pre_error = error_pre_print == NULL ? "" : error_pre_print;
+  source_pre_error = savestring (source_pre_error, strlen (source_pre_error));
+  make_cleanup (xfree, source_pre_error);
+  /* This will get set every time we read a line.  So it won't stay "" for
+     long.  */
+  error_pre_print = "";
+
+  needed_length = strlen (source_file_name) + strlen (source_pre_error) + 80;
+  if (source_error_allocated < needed_length)
+    {
+      source_error_allocated *= 2;
+      if (source_error_allocated < needed_length)
+	source_error_allocated = needed_length;
+      if (source_error == NULL)
+	source_error = xmalloc (source_error_allocated);
+      else
+	source_error = xrealloc (source_error, source_error_allocated);
+    }
+
+  read_command_file (stream);
+
+  do_cleanups (old_cleanups);
+}
+
+void
+show_user_1 (struct cmd_list_element *c, struct ui_file *stream)
+{
+  register struct command_line *cmdlines;
+
+  cmdlines = c->user_commands;
+  if (!cmdlines)
+    return;
+  fputs_filtered ("User command ", stream);
+  fputs_filtered (c->name, stream);
+  fputs_filtered (":\n", stream);
+
+#ifdef UI_OUT
+  print_command_lines (uiout, cmdlines, 1);
+  fputs_filtered ("\n", stream);
+#else
+  while (cmdlines)
+    {
+      print_command_line (cmdlines, 4, stream);
+      cmdlines = cmdlines->next;
+    }
+  fputs_filtered ("\n", stream);
+#endif
+}
+
diff --git a/gdb/cli/cli-script.h b/gdb/cli/cli-script.h
new file mode 100644
index 0000000..de08428
--- /dev/null
+++ b/gdb/cli/cli-script.h
@@ -0,0 +1,50 @@
+/* Header file for GDB CLI command implementation library.
+   Copyright (C) 2000 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.  */
+
+#if !defined (CLI_SCRIPT_H)
+#define CLI_SCRIPT_H 1
+
+/* Exported to cli/cli-cmds.c */
+
+extern void script_from_file (FILE *stream, char *file);
+
+extern void document_command (char *, int);
+
+extern void define_command (char *, int);
+
+extern void while_command (char *arg, int from_tty);
+
+extern void if_command (char *arg, int from_tty);
+
+extern void show_user_1 (struct cmd_list_element *c, struct ui_file *stream);
+
+/* Exported to gdb/breakpoint.c */
+
+extern enum command_control_type
+	execute_control_command (struct command_line *cmd);
+
+#ifdef UI_OUT
+extern void print_command_lines (struct ui_out *,
+				 struct command_line *, unsigned int);
+#endif
+
+/* Exported to gdb/infrun.c */
+
+extern void execute_user_command (struct cmd_list_element *c, char *args);
+
+#endif /* !defined (CLI_SCRIPT_H) */
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
new file mode 100644
index 0000000..b6cbfed
--- /dev/null
+++ b/gdb/cli/cli-setshow.c
@@ -0,0 +1,462 @@
+/* Handle set and show GDB commands.
+   Copyright 2000 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.  */
+
+#include "defs.h"
+#include "value.h"
+#include <ctype.h>
+#if 0
+#include "gdb_string.h"
+#endif
+
+#ifdef UI_OUT
+#include "ui-out.h"
+#endif
+
+#include "cli/cli-decode.h"
+#include "cli/cli-cmds.h"
+#include "cli/cli-setshow.h"
+
+/* Prototypes for local functions */
+
+static int parse_binary_operation (char *);
+
+static enum cmd_auto_boolean parse_auto_binary_operation (const char *arg);
+
+static enum cmd_auto_boolean
+parse_auto_binary_operation (const char *arg)
+{
+  if (arg != NULL && *arg != '\0')
+    {
+      int length = strlen (arg);
+      while (isspace (arg[length - 1]) && length > 0)
+	length--;
+      if (strncmp (arg, "on", length) == 0
+	  || strncmp (arg, "1", length) == 0
+	  || strncmp (arg, "yes", length) == 0
+	  || strncmp (arg, "enable", length) == 0)
+	return CMD_AUTO_BOOLEAN_TRUE;
+      else if (strncmp (arg, "off", length) == 0
+	       || strncmp (arg, "0", length) == 0
+	       || strncmp (arg, "no", length) == 0
+	       || strncmp (arg, "disable", length) == 0)
+	return CMD_AUTO_BOOLEAN_FALSE;
+      else if (strncmp (arg, "auto", length) == 0
+	       || (strncmp (arg, "-1", length) == 0 && length > 1))
+	return CMD_AUTO_BOOLEAN_AUTO;
+    }
+  error ("\"on\", \"off\" or \"auto\" expected.");
+  return CMD_AUTO_BOOLEAN_AUTO; /* pacify GCC */
+}
+
+static int
+parse_binary_operation (char *arg)
+{
+  int length;
+
+  if (!arg || !*arg)
+    return 1;
+
+  length = strlen (arg);
+
+  while (arg[length - 1] == ' ' || arg[length - 1] == '\t')
+    length--;
+
+  if (strncmp (arg, "on", length) == 0
+      || strncmp (arg, "1", length) == 0
+      || strncmp (arg, "yes", length) == 0
+      || strncmp (arg, "enable", length) == 0)
+    return 1;
+  else if (strncmp (arg, "off", length) == 0
+	   || strncmp (arg, "0", length) == 0
+	   || strncmp (arg, "no", length) == 0
+	   || strncmp (arg, "disable", length) == 0)
+    return 0;
+  else
+    {
+      error ("\"on\" or \"off\" expected.");
+      return 0;
+    }
+}
+
+/* Do a "set" or "show" command.  ARG is NULL if no argument, or the text
+   of the argument, and FROM_TTY is nonzero if this command is being entered
+   directly by the user (i.e. these are just like any other
+   command).  C is the command list element for the command.  */
+
+void
+do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
+{
+  if (c->type == set_cmd)
+    {
+      switch (c->var_type)
+	{
+	case var_string:
+	  {
+	    char *new;
+	    char *p;
+	    char *q;
+	    int ch;
+
+	    if (arg == NULL)
+	      arg = "";
+	    new = (char *) xmalloc (strlen (arg) + 2);
+	    p = arg;
+	    q = new;
+	    while ((ch = *p++) != '\000')
+	      {
+		if (ch == '\\')
+		  {
+		    /* \ at end of argument is used after spaces
+		       so they won't be lost.  */
+		    /* This is obsolete now that we no longer strip
+		       trailing whitespace and actually, the backslash
+		       didn't get here in my test, readline or
+		       something did something funky with a backslash
+		       right before a newline.  */
+		    if (*p == 0)
+		      break;
+		    ch = parse_escape (&p);
+		    if (ch == 0)
+		      break;	/* C loses */
+		    else if (ch > 0)
+		      *q++ = ch;
+		  }
+		else
+		  *q++ = ch;
+	      }
+#if 0
+	    if (*(p - 1) != '\\')
+	      *q++ = ' ';
+#endif
+	    *q++ = '\0';
+	    new = (char *) xrealloc (new, q - new);
+	    if (*(char **) c->var != NULL)
+	      xfree (*(char **) c->var);
+	    *(char **) c->var = new;
+	  }
+	  break;
+	case var_string_noescape:
+	  if (arg == NULL)
+	    arg = "";
+	  if (*(char **) c->var != NULL)
+	    xfree (*(char **) c->var);
+	  *(char **) c->var = savestring (arg, strlen (arg));
+	  break;
+	case var_filename:
+	  if (arg == NULL)
+	    error_no_arg ("filename to set it to.");
+	  if (*(char **) c->var != NULL)
+	    xfree (*(char **) c->var);
+	  *(char **) c->var = tilde_expand (arg);
+	  break;
+	case var_boolean:
+	  *(int *) c->var = parse_binary_operation (arg);
+	  break;
+	case var_auto_boolean:
+	  *(enum cmd_auto_boolean *) c->var = parse_auto_binary_operation (arg);
+	  break;
+	case var_uinteger:
+	  if (arg == NULL)
+	    error_no_arg ("integer to set it to.");
+	  *(unsigned int *) c->var = parse_and_eval_long (arg);
+	  if (*(unsigned int *) c->var == 0)
+	    *(unsigned int *) c->var = UINT_MAX;
+	  break;
+	case var_integer:
+	  {
+	    unsigned int val;
+	    if (arg == NULL)
+	      error_no_arg ("integer to set it to.");
+	    val = parse_and_eval_long (arg);
+	    if (val == 0)
+	      *(int *) c->var = INT_MAX;
+	    else if (val >= INT_MAX)
+	      error ("integer %u out of range", val);
+	    else
+	      *(int *) c->var = val;
+	    break;
+	  }
+	case var_zinteger:
+	  if (arg == NULL)
+	    error_no_arg ("integer to set it to.");
+	  *(int *) c->var = parse_and_eval_long (arg);
+	  break;
+	case var_enum:
+	  {
+	    int i;
+	    int len;
+	    int nmatches;
+	    const char *match = NULL;
+	    char *p;
+
+	    /* if no argument was supplied, print an informative error message */
+	    if (arg == NULL)
+	      {
+		char msg[1024];
+		strcpy (msg, "Requires an argument. Valid arguments are ");
+		for (i = 0; c->enums[i]; i++)
+		  {
+		    if (i != 0)
+		      strcat (msg, ", ");
+		    strcat (msg, c->enums[i]);
+		  }
+		strcat (msg, ".");
+		error (msg);
+	      }
+
+	    p = strchr (arg, ' ');
+
+	    if (p)
+	      len = p - arg;
+	    else
+	      len = strlen (arg);
+
+	    nmatches = 0;
+	    for (i = 0; c->enums[i]; i++)
+	      if (strncmp (arg, c->enums[i], len) == 0)
+		{
+		  if (c->enums[i][len] == '\0')
+		    {
+		      match = c->enums[i];
+		      nmatches = 1;
+		      break; /* exact match. */
+		    }
+		  else
+		    {
+		      match = c->enums[i];
+		      nmatches++;
+		    }
+		}
+
+	    if (nmatches <= 0)
+	      error ("Undefined item: \"%s\".", arg);
+
+	    if (nmatches > 1)
+	      error ("Ambiguous item \"%s\".", arg);
+
+	    *(const char **) c->var = match;
+	  }
+	  break;
+	default:
+	  error ("gdb internal error: bad var_type in do_setshow_command");
+	}
+    }
+  else if (c->type == show_cmd)
+    {
+#ifdef UI_OUT
+      struct cleanup *old_chain;
+      struct ui_stream *stb;
+      int quote;
+
+      stb = ui_out_stream_new (uiout);
+      old_chain = make_cleanup_ui_out_stream_delete (stb);
+#endif /* UI_OUT */
+
+      /* Print doc minus "show" at start.  */
+      print_doc_line (gdb_stdout, c->doc + 5);
+
+#ifdef UI_OUT
+      ui_out_text (uiout, " is ");
+      ui_out_wrap_hint (uiout, "    ");
+      quote = 0;
+      switch (c->var_type)
+	{
+	case var_string:
+	  {
+	    unsigned char *p;
+
+	    if (*(unsigned char **) c->var)
+	      fputstr_filtered (*(unsigned char **) c->var, '"', stb->stream);
+	    quote = 1;
+	  }
+	  break;
+	case var_string_noescape:
+	case var_filename:
+	case var_enum:
+	  if (*(char **) c->var)
+	    fputs_filtered (*(char **) c->var, stb->stream);
+	  quote = 1;
+	  break;
+	case var_boolean:
+	  fputs_filtered (*(int *) c->var ? "on" : "off", stb->stream);
+	  break;
+	case var_auto_boolean:
+	  switch (*(enum cmd_auto_boolean*) c->var)
+	    {
+	    case CMD_AUTO_BOOLEAN_TRUE:
+	      fputs_filtered ("on", stb->stream);
+	      break;
+	    case CMD_AUTO_BOOLEAN_FALSE:
+	      fputs_filtered ("off", stb->stream);
+	      break;
+	    case CMD_AUTO_BOOLEAN_AUTO:
+	      fputs_filtered ("auto", stb->stream);
+	      break;
+	    default:
+	      internal_error ("do_setshow_command: invalid var_auto_boolean");
+	      break;
+	    }
+	  break;
+	case var_uinteger:
+	  if (*(unsigned int *) c->var == UINT_MAX)
+	    {
+	      fputs_filtered ("unlimited", stb->stream);
+	      break;
+	    }
+	  /* else fall through */
+	case var_zinteger:
+	  fprintf_filtered (stb->stream, "%u", *(unsigned int *) c->var);
+	  break;
+	case var_integer:
+	  if (*(int *) c->var == INT_MAX)
+	    {
+	      fputs_filtered ("unlimited", stb->stream);
+	    }
+	  else
+	    fprintf_filtered (stb->stream, "%d", *(int *) c->var);
+	  break;
+
+	default:
+	  error ("gdb internal error: bad var_type in do_setshow_command");
+	}
+      if (quote)
+	ui_out_text (uiout, "\"");
+      ui_out_field_stream (uiout, "value", stb);
+      if (quote)
+	ui_out_text (uiout, "\"");
+      ui_out_text (uiout, ".\n");
+      do_cleanups (old_chain);
+#else
+      fputs_filtered (" is ", gdb_stdout);
+      wrap_here ("    ");
+      switch (c->var_type)
+	{
+	case var_string:
+	  {
+	    fputs_filtered ("\"", gdb_stdout);
+	    if (*(unsigned char **) c->var)
+	      fputstr_filtered (*(unsigned char **) c->var, '"', gdb_stdout);
+	    fputs_filtered ("\"", gdb_stdout);
+	  }
+	  break;
+	case var_string_noescape:
+	case var_filename:
+	case var_enum:
+	  fputs_filtered ("\"", gdb_stdout);
+	  if (*(char **) c->var)
+	    fputs_filtered (*(char **) c->var, gdb_stdout);
+	  fputs_filtered ("\"", gdb_stdout);
+	  break;
+	case var_boolean:
+	  fputs_filtered (*(int *) c->var ? "on" : "off", gdb_stdout);
+	  break;
+	case var_auto_boolean:
+	  switch (*(enum cmd_auto_boolean*) c->var)
+	    {
+	    case CMD_AUTO_BOOLEAN_TRUE:
+	      fputs_filtered ("on", gdb_stdout);
+	      break;
+	    case CMD_AUTO_BOOLEAN_FALSE:
+	      fputs_filtered ("off", gdb_stdout);
+	      break;
+	    case CMD_AUTO_BOOLEAN_AUTO:
+	      fputs_filtered ("auto", gdb_stdout);
+	      break;
+	    default:
+	      internal_error ("do_setshow_command: invalid var_auto_boolean");
+	      break;
+	    }
+	  break;
+	case var_uinteger:
+	  if (*(unsigned int *) c->var == UINT_MAX)
+	    {
+	      fputs_filtered ("unlimited", gdb_stdout);
+	      break;
+	    }
+	  /* else fall through */
+	case var_zinteger:
+	  fprintf_filtered (gdb_stdout, "%u", *(unsigned int *) c->var);
+	  break;
+	case var_integer:
+	  if (*(int *) c->var == INT_MAX)
+	    {
+	      fputs_filtered ("unlimited", gdb_stdout);
+	    }
+	  else
+	    fprintf_filtered (gdb_stdout, "%d", *(int *) c->var);
+	  break;
+
+	default:
+	  error ("gdb internal error: bad var_type in do_setshow_command");
+	}
+      fputs_filtered (".\n", gdb_stdout);
+#endif
+    }
+  else
+    error ("gdb internal error: bad cmd_type in do_setshow_command");
+  (*c->function.sfunc) (NULL, from_tty, c);
+  if (c->type == set_cmd && set_hook)
+    set_hook (c);
+}
+
+/* Show all the settings in a list of show commands.  */
+
+void
+cmd_show_list (struct cmd_list_element *list, int from_tty, char *prefix)
+{
+#ifdef UI_OUT
+  ui_out_list_begin (uiout, "showlist");
+#endif
+  for (; list != NULL; list = list->next)
+    {
+      /* If we find a prefix, run its list, prefixing our output by its
+         prefix (with "show " skipped).  */
+#ifdef UI_OUT
+      if (list->prefixlist && !list->abbrev_flag)
+	{
+	  ui_out_list_begin (uiout, "optionlist");
+	  ui_out_field_string (uiout, "prefix", list->prefixname + 5);
+	  cmd_show_list (*list->prefixlist, from_tty, list->prefixname + 5);
+	  ui_out_list_end (uiout);
+	}
+      if (list->type == show_cmd)
+	{
+	  ui_out_list_begin (uiout, "option");
+	  ui_out_text (uiout, prefix);
+	  ui_out_field_string (uiout, "name", list->name);
+	  ui_out_text (uiout, ":  ");
+	  do_setshow_command ((char *) NULL, from_tty, list);
+	  ui_out_list_end (uiout);
+	}
+#else
+      if (list->prefixlist && !list->abbrev_flag)
+	cmd_show_list (*list->prefixlist, from_tty, list->prefixname + 5);
+      if (list->type == show_cmd)
+	{
+	  fputs_filtered (prefix, gdb_stdout);
+	  fputs_filtered (list->name, gdb_stdout);
+	  fputs_filtered (":  ", gdb_stdout);
+	  do_setshow_command ((char *) NULL, from_tty, list);
+	}
+#endif
+    }
+#ifdef UI_OUT
+  ui_out_list_end (uiout);
+#endif
+}
+
diff --git a/gdb/cli/cli-setshow.h b/gdb/cli/cli-setshow.h
new file mode 100644
index 0000000..bb2fbe9
--- /dev/null
+++ b/gdb/cli/cli-setshow.h
@@ -0,0 +1,32 @@
+/* Header file for GDB CLI set and show commands implementation.
+   Copyright (C) 2000 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.  */
+
+#if !defined (CLI_SETSHOW_H)
+#define CLI_SETSHOW_H 1
+
+/* Exported to cli/cli-cmds.c and gdb/top.c */
+
+extern void do_setshow_command (char *arg, int from_tty,
+				struct cmd_list_element *c);
+
+/* Exported to cli/cli-cmds.c and gdb/top.c, language.c and valprint.c */
+
+extern void cmd_show_list (struct cmd_list_element *list, int from_tty,
+			   char *prefix);
+
+#endif /* !defined (CLI_SETSHOW_H) */
diff --git a/gdb/coff-solib.c b/gdb/coff-solib.c
index 9c68fa4..e36b276 100644
--- a/gdb/coff-solib.c
+++ b/gdb/coff-solib.c
@@ -48,10 +48,7 @@
  */
 
 void
-coff_solib_add (arg_string, from_tty, target)
-     char *arg_string;
-     int from_tty;
-     struct target_ops *target;
+coff_solib_add (char *arg_string, int from_tty, struct target_ops *target)
 {
   asection *libsect;
 
@@ -126,7 +123,7 @@
  */
 
 void
-coff_solib_create_inferior_hook ()
+coff_solib_create_inferior_hook (void)
 {
   coff_solib_add ((char *) 0, 0, (struct target_ops *) 0);
 }
diff --git a/gdb/coffread.c b/gdb/coffread.c
index f64fb9c..414f537 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -68,14 +68,6 @@
 
 #define SDB_TYPE(type) (BTYPE(type) | (type & N_TMASK))
 
-/* Convert from an sdb register number to an internal gdb register number.
-   This should be defined in tm.h, if REGISTER_NAMES is not set up
-   to map one to one onto the sdb register numbers.  */
-
-#ifndef SDB_REG_TO_REGNUM
-#define SDB_REG_TO_REGNUM(value)     (value)
-#endif
-
 /* Core address of start and end of text of current source file.
    This comes from a ".text" symbol where x_nlinno > 0.  */
 
@@ -260,10 +252,7 @@
    -kingdon).  */
 
 static void
-coff_locate_sections (abfd, sectp, csip)
-     bfd *abfd;
-     asection *sectp;
-     PTR csip;
+coff_locate_sections (bfd *abfd, asection *sectp, PTR csip)
 {
   register struct coff_symfile_info *csi;
   const char *name;
@@ -307,7 +296,7 @@
 	  /* This will be run after coffstab_build_psymtabs is called
 	     in coff_symfile_read, at which point we no longer need
 	     the information.  */
-	  make_cleanup (free, n);
+	  make_cleanup (xfree, n);
 	}
     }
 }
@@ -324,10 +313,7 @@
 static void find_targ_sec (bfd *, asection *, void *);
 
 static void
-find_targ_sec (abfd, sect, obj)
-     bfd *abfd;
-     asection *sect;
-     PTR obj;
+find_targ_sec (bfd *abfd, asection *sect, PTR obj)
 {
   struct find_targ_sec_arg *args = (struct find_targ_sec_arg *) obj;
   if (sect->target_index == args->targ_index)
@@ -336,9 +322,7 @@
 
 /* Return the section number (SECT_OFF_*) that CS points to.  */
 static int
-cs_to_section (cs, objfile)
-     struct coff_symbol *cs;
-     struct objfile *objfile;
+cs_to_section (struct coff_symbol *cs, struct objfile *objfile)
 {
   asection *sect = NULL;
   struct find_targ_sec_arg args;
@@ -355,7 +339,8 @@
       else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
 	off = SECT_OFF_DATA (objfile);
       else
-	off = SECT_OFF_BSS (objfile);
+	/* Just return the bfd section index. */
+	off = sect->index;
     }
   return off;
 }
@@ -365,9 +350,7 @@
 static CORE_ADDR cs_section_address (struct coff_symbol *, bfd *);
 
 static CORE_ADDR
-cs_section_address (cs, abfd)
-     struct coff_symbol *cs;
-     bfd *abfd;
+cs_section_address (struct coff_symbol *cs, bfd *abfd)
 {
   asection *sect = NULL;
   struct find_targ_sec_arg args;
@@ -389,8 +372,7 @@
    or for associating a new type with the index.  */
 
 static struct type **
-coff_lookup_type (index)
-     register int index;
+coff_lookup_type (register int index)
 {
   if (index >= type_vector_length)
     {
@@ -414,8 +396,7 @@
    This can create an empty (zeroed) type object.  */
 
 static struct type *
-coff_alloc_type (index)
-     int index;
+coff_alloc_type (int index)
 {
   register struct type **type_addr = coff_lookup_type (index);
   register struct type *type = *type_addr;
@@ -436,8 +417,7 @@
    it indicates the start of data for one original source file.  */
 
 static void
-coff_start_symtab (name)
-     char *name;
+coff_start_symtab (char *name)
 {
   start_symtab (
   /* We fill in the filename later.  start_symtab puts
@@ -459,13 +439,10 @@
    text address for the file, and SIZE is the number of bytes of text.  */
 
 static void
-complete_symtab (name, start_addr, size)
-     char *name;
-     CORE_ADDR start_addr;
-     unsigned int size;
+complete_symtab (char *name, CORE_ADDR start_addr, unsigned int size)
 {
   if (last_source_file != NULL)
-    free (last_source_file);
+    xfree (last_source_file);
   last_source_file = savestring (name, strlen (name));
   current_source_start_addr = start_addr;
   current_source_end_addr = start_addr + size;
@@ -484,14 +461,13 @@
    struct symtab for that file and put it in the list of all such. */
 
 static void
-coff_end_symtab (objfile)
-     struct objfile *objfile;
+coff_end_symtab (struct objfile *objfile)
 {
   struct symtab *symtab;
 
   last_source_start_addr = current_source_start_addr;
 
-  symtab = end_symtab (current_source_end_addr, objfile, 0);
+  symtab = end_symtab (current_source_end_addr, objfile, SECT_OFF_TEXT (objfile));
 
   if (symtab != NULL)
     free_named_symtabs (symtab->filename);
@@ -501,11 +477,8 @@
 }
 
 static void
-record_minimal_symbol (name, address, type, objfile)
-     char *name;
-     CORE_ADDR address;
-     enum minimal_symbol_type type;
-     struct objfile *objfile;
+record_minimal_symbol (char *name, CORE_ADDR address,
+		       enum minimal_symbol_type type, struct objfile *objfile)
 {
   /* We don't want TDESC entry points in the minimal symbol table */
   if (name[0] == '@')
@@ -528,8 +501,7 @@
    The ultimate result is a new symtab (or, FIXME, eventually a psymtab).  */
 
 static void
-coff_symfile_init (objfile)
-     struct objfile *objfile;
+coff_symfile_init (struct objfile *objfile)
 {
   /* Allocate struct to keep track of stab reading. */
   objfile->sym_stab_info = (struct dbx_symfile_info *)
@@ -557,10 +529,7 @@
 
 /* ARGSUSED */
 static void
-find_linenos (abfd, asect, vpinfo)
-     bfd *abfd;
-     sec_ptr asect;
-     PTR vpinfo;
+find_linenos (bfd *abfd, sec_ptr asect, PTR vpinfo)
 {
   struct coff_symfile_info *info;
   int size, count;
@@ -597,9 +566,7 @@
 
 /* ARGSUSED */
 static void
-coff_symfile_read (objfile, mainline)
-     struct objfile *objfile;
-     int mainline;
+coff_symfile_read (struct objfile *objfile, int mainline)
 {
   struct coff_symfile_info *info;
   struct dbx_symfile_info *dbxinfo;
@@ -725,8 +692,7 @@
 }
 
 static void
-coff_new_init (ignore)
-     struct objfile *ignore;
+coff_new_init (struct objfile *ignore)
 {
 }
 
@@ -736,8 +702,7 @@
    objfile struct from the global list of known objfiles. */
 
 static void
-coff_symfile_finish (objfile)
-     struct objfile *objfile;
+coff_symfile_finish (struct objfile *objfile)
 {
   if (objfile->sym_private != NULL)
     {
@@ -755,10 +720,8 @@
    We read them one at a time using read_one_sym ().  */
 
 static void
-coff_symtab_read (symtab_offset, nsyms, objfile)
-     long symtab_offset;
-     unsigned int nsyms;
-     struct objfile *objfile;
+coff_symtab_read (long symtab_offset, unsigned int nsyms,
+		  struct objfile *objfile)
 {
   register struct context_stack *new;
   struct coff_symbol coff_symbol;
@@ -811,7 +774,7 @@
   memset (opaque_type_chain, 0, sizeof opaque_type_chain);
 
   if (type_vector)		/* Get rid of previous one */
-    free ((PTR) type_vector);
+    xfree (type_vector);
   type_vector_length = 160;
   type_vector = (struct type **)
     xmalloc (type_vector_length * sizeof (struct type *));
@@ -982,22 +945,20 @@
 		      SMASH_TEXT_ADDRESS (tmpaddr);
 #endif
 		  }
+		else if (sec == SECT_OFF_DATA (objfile))
+		  {
+		    ms_type =
+		      cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
+		      mst_data : mst_file_data;
+		  }
+		else if (sec == SECT_OFF_BSS (objfile))
+		  {
+		    ms_type =
+		      cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
+		      mst_data : mst_file_data;
+		  }
 		else
-		  if  (sec == SECT_OFF_DATA (objfile))
-		    {
-		    ms_type =
-		      cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
-		      mst_data : mst_file_data;
-		    }
-		  else
-		    if (sec == SECT_OFF_BSS (objfile))
-		      {
-		    ms_type =
-		      cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
-		      mst_data : mst_file_data;
-		      }
-		    else
-		      ms_type = mst_unknown;
+		  ms_type = mst_unknown;
 	      }
 
 	    if (cs->c_name[0] != '@' /* Skip tdesc symbols */ )
@@ -1171,10 +1132,9 @@
    in internal_auxent form, and skip any other auxents.  */
 
 static void
-read_one_sym (cs, sym, aux)
-     register struct coff_symbol *cs;
-     register struct internal_syment *sym;
-     register union internal_auxent *aux;
+read_one_sym (register struct coff_symbol *cs,
+	      register struct internal_syment *sym,
+	      register union internal_auxent *aux)
 {
   int i;
 
@@ -1241,9 +1201,7 @@
 static char *stringtab = NULL;
 
 static int
-init_stringtab (abfd, offset)
-     bfd *abfd;
-     long offset;
+init_stringtab (bfd *abfd, long offset)
 {
   long length;
   int val;
@@ -1282,10 +1240,10 @@
 }
 
 static void
-free_stringtab ()
+free_stringtab (void)
 {
   if (stringtab)
-    free (stringtab);
+    xfree (stringtab);
   stringtab = NULL;
 }
 
@@ -1296,8 +1254,7 @@
 }
 
 static char *
-getsymname (symbol_entry)
-     struct internal_syment *symbol_entry;
+getsymname (struct internal_syment *symbol_entry)
 {
   static char buffer[SYMNMLEN + 1];
   char *result;
@@ -1322,8 +1279,7 @@
    is only good for temporary use.  */
 
 static char *
-coff_getfilename (aux_entry)
-     union internal_auxent *aux_entry;
+coff_getfilename (union internal_auxent *aux_entry)
 {
   static char buffer[BUFSIZ];
   register char *temp;
@@ -1357,10 +1313,7 @@
    them into GDB's data structures.  */
 
 static int
-init_lineno (abfd, offset, size)
-     bfd *abfd;
-     long offset;
-     int size;
+init_lineno (bfd *abfd, long offset, int size)
 {
   int val;
 
@@ -1389,10 +1342,10 @@
 }
 
 static void
-free_linetab ()
+free_linetab (void)
 {
   if (linetab)
-    free (linetab);
+    xfree (linetab);
   linetab = NULL;
 }
 
@@ -1407,11 +1360,8 @@
 #endif
 
 static void
-enter_linenos (file_offset, first_line, last_line, objfile)
-     long file_offset;
-     register int first_line;
-     register int last_line;
-     struct objfile *objfile;
+enter_linenos (long file_offset, register int first_line,
+	       register int last_line, struct objfile *objfile)
 {
   register char *rawptr;
   struct internal_lineno lptr;
@@ -1448,9 +1398,7 @@
 }
 
 static void
-patch_type (type, real_type)
-     struct type *type;
-     struct type *real_type;
+patch_type (struct type *type, struct type *real_type)
 {
   register struct type *target = TYPE_TARGET_TYPE (type);
   register struct type *real_target = TYPE_TARGET_TYPE (real_type);
@@ -1465,7 +1413,7 @@
   if (TYPE_NAME (real_target))
     {
       if (TYPE_NAME (target))
-	free (TYPE_NAME (target));
+	xfree (TYPE_NAME (target));
       TYPE_NAME (target) = concat (TYPE_NAME (real_target), NULL);
     }
 }
@@ -1474,8 +1422,7 @@
    so that they can be used to print out opaque data structures properly.  */
 
 static void
-patch_opaque_types (s)
-     struct symtab *s;
+patch_opaque_types (struct symtab *s)
 {
   register struct block *b;
   register int i;
@@ -1536,10 +1483,9 @@
 }
 
 static struct symbol *
-process_coff_symbol (cs, aux, objfile)
-     register struct coff_symbol *cs;
-     register union internal_auxent *aux;
-     struct objfile *objfile;
+process_coff_symbol (register struct coff_symbol *cs,
+		     register union internal_auxent *aux,
+		     struct objfile *objfile)
 {
   register struct symbol *sym
   = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
@@ -1763,10 +1709,8 @@
 /* Decode a coff type specifier;  return the type that is meant.  */
 
 static struct type *
-decode_type (cs, c_type, aux)
-     register struct coff_symbol *cs;
-     unsigned int c_type;
-     register union internal_auxent *aux;
+decode_type (register struct coff_symbol *cs, unsigned int c_type,
+	     register union internal_auxent *aux)
 {
   register struct type *type = 0;
   unsigned int new_c_type;
@@ -1844,10 +1788,8 @@
    return the type that the function returns.  */
 
 static struct type *
-decode_function_type (cs, c_type, aux)
-     register struct coff_symbol *cs;
-     unsigned int c_type;
-     register union internal_auxent *aux;
+decode_function_type (register struct coff_symbol *cs, unsigned int c_type,
+		      register union internal_auxent *aux)
 {
   if (aux->x_sym.x_tagndx.l == 0)
     cs->c_naux = 0;		/* auxent refers to function, not base type */
@@ -1858,10 +1800,8 @@
 /* basic C types */
 
 static struct type *
-decode_base_type (cs, c_type, aux)
-     register struct coff_symbol *cs;
-     unsigned int c_type;
-     register union internal_auxent *aux;
+decode_base_type (register struct coff_symbol *cs, unsigned int c_type,
+		  register union internal_auxent *aux)
 {
   struct type *type;
 
@@ -2012,10 +1952,7 @@
    object describing the type.  */
 
 static struct type *
-coff_read_struct_type (index, length, lastsym)
-     int index;
-     int length;
-     int lastsym;
+coff_read_struct_type (int index, int length, int lastsym)
 {
   struct nextfield
     {
@@ -2110,10 +2047,7 @@
 
 /* ARGSUSED */
 static struct type *
-coff_read_enum_type (index, length, lastsym)
-     int index;
-     int length;
-     int lastsym;
+coff_read_enum_type (int index, int length, int lastsym)
 {
   register struct symbol *sym;
   register struct type *type;
@@ -2230,7 +2164,7 @@
 };
 
 void
-_initialize_coffread ()
+_initialize_coffread (void)
 {
   add_symtab_fns (&coff_sym_fns);
 }
diff --git a/gdb/command.h b/gdb/command.h
index f6c46e9..ec75b67 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -1,3 +1,10 @@
+/* ***DEPRECATED***  The gdblib files must not be calling/using things in any
+   of the possible command languages.  If necessary, a hook (that may be
+   present or not) must be used and set to the appropriate routine by any
+   command language that cares about it.  If you are having to include this
+   file you are possibly doing things the old way.  This file will disapear.
+   2000-12-01 fnasser@redhat.com    */
+
 /* Header file for command-reading library command.c.
    Copyright (C) 1986, 1989, 1990, 2000 Free Software Foundation, Inc.
 
@@ -47,12 +54,28 @@
   }
 cmd_types;
 
+/* Reasonable values for an AUTO_BOOLEAN variable. */
+enum cmd_auto_boolean
+{
+  CMD_AUTO_BOOLEAN_TRUE,
+  CMD_AUTO_BOOLEAN_FALSE,
+  CMD_AUTO_BOOLEAN_AUTO
+};
+
 /* Types of "set" or "show" command.  */
 typedef enum var_types
   {
     /* "on" or "off".  *VAR is an integer which is nonzero for on,
        zero for off.  */
     var_boolean,
+
+    /* "on" / "true" / "enable" or "off" / "false" / "disable" or
+       "auto.  *VAR is an ``enum cmd_auto_boolean''.  NOTE: In general
+       a custom show command will need to be implemented - one that
+       for "auto" prints both the "auto" and the current auto-selected
+       value. */
+    var_auto_boolean,
+
     /* Unsigned Integer.  *VAR is an unsigned int.  The user can type 0
        to mean "unlimited", which is stored in *VAR as UINT_MAX.  */
     var_uinteger,
@@ -115,7 +138,7 @@
 	void (*sfunc) (char *args, int from_tty, struct cmd_list_element * c);
       }
     function;
-#define NO_FUNCTION ((void (*) PARAMS((char *args, int from_tty))) 0)
+#define NO_FUNCTION ((void (*) (char *args, int from_tty)) 0)
 
     /* Documentation of this command (or help topic).
        First line is brief documentation; remaining lines form, with it,
@@ -149,7 +172,14 @@
     char *replacement;
 
     /* Hook for another command to be executed before this command.  */
-    struct cmd_list_element *hook;
+    struct cmd_list_element *hook_pre;
+
+    /* Hook for another command to be executed after this command.  */
+    struct cmd_list_element *hook_post;
+
+    /* Flag that specifies if this command is already running it's hook. */
+    /* Prevents the possibility of hook recursion. */
+    int hook_in;
 
     /* Nonzero identifies a prefix command.  For them, the address
        of the variable containing the list of subcommands.  */
@@ -199,14 +229,18 @@
     var_types var_type;
 
     /* Pointer to NULL terminated list of enumerated values (like argv).  */
-    char **enums;
+    const char **enums;
 
     /* Pointer to command strings of user-defined commands */
     struct command_line *user_commands;
 
-    /* Pointer to command that is hooked by this one,
+    /* Pointer to command that is hooked by this one, (by hook_pre)
        so the hook can be removed when this one is deleted.  */
-    struct cmd_list_element *hookee;
+    struct cmd_list_element *hookee_pre;
+
+    /* Pointer to command that is hooked by this one, (by hook_post)
+       so the hook can be removed when this one is deleted.  */
+    struct cmd_list_element *hookee_post;
 
     /* Pointer to command that is aliased by this one, so the
        aliased command can be located in case it has been hooked.  */
@@ -274,7 +308,7 @@
 
 extern char **complete_on_cmdlist (struct cmd_list_element *, char *, char *);
 
-extern char **complete_on_enum (char **enumlist, char *, char *);
+extern char **complete_on_enum (const char *enumlist[], char *, char *);
 
 extern void delete_cmd (char *, struct cmd_list_element **);
 
@@ -294,11 +328,17 @@
 
 extern struct cmd_list_element *add_set_enum_cmd (char *name,
 						  enum command_class class,
-						  char *enumlist[],
-						  char **var,
+						  const char *enumlist[],
+						  const char **var,
 						  char *doc,
 						  struct cmd_list_element **list);
 
+extern struct cmd_list_element *add_set_auto_boolean_cmd (char *name,
+							  enum command_class class,
+							  enum cmd_auto_boolean *var,
+							  char *doc,
+							  struct cmd_list_element **list);
+
 extern struct cmd_list_element *add_show_from_set (struct cmd_list_element *,
 						   struct cmd_list_element
 						   **);
@@ -314,7 +354,7 @@
 
 extern void cmd_show_list (struct cmd_list_element *, int, char *);
 
-extern void error_no_arg (char *);
+extern NORETURN void error_no_arg (char *) ATTR_NORETURN;
 
 extern void dont_repeat (void);
 
diff --git a/gdb/complaints.c b/gdb/complaints.c
index ee877fb..198e64f 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -83,30 +83,45 @@
 
       /* Isolated messages, must be self-explanatory.  */
     case 0:
-      begin_line ();
-      fputs_filtered ("During symbol reading, ", gdb_stderr);
-      wrap_here ("");
-      vfprintf_filtered (gdb_stderr, complaint->message, args);
-      fputs_filtered (".\n", gdb_stderr);
+      if (warning_hook)
+        (*warning_hook) (complaint->message, args);
+      else
+        {
+          begin_line ();
+          fputs_filtered ("During symbol reading, ", gdb_stderr);
+          wrap_here ("");
+          vfprintf_filtered (gdb_stderr, complaint->message, args);
+          fputs_filtered (".\n", gdb_stderr);
+        }
       break;
 
       /* First of a series, without `set verbose'.  */
     case 1:
-      begin_line ();
-      fputs_filtered ("During symbol reading...", gdb_stderr);
-      vfprintf_filtered (gdb_stderr, complaint->message, args);
-      fputs_filtered ("...", gdb_stderr);
-      wrap_here ("");
-      complaint_series++;
+      if (warning_hook)
+        (*warning_hook) (complaint->message, args);
+      else
+        {
+          begin_line ();
+          fputs_filtered ("During symbol reading...", gdb_stderr);
+          vfprintf_filtered (gdb_stderr, complaint->message, args);
+          fputs_filtered ("...", gdb_stderr);
+          wrap_here ("");
+          complaint_series++;
+        }
       break;
 
       /* Subsequent messages of a series, or messages under `set verbose'.
          (We'll already have produced a "Reading in symbols for XXX..."
          message and will clean up at the end with a newline.)  */
     default:
-      vfprintf_filtered (gdb_stderr, complaint->message, args);
-      fputs_filtered ("...", gdb_stderr);
-      wrap_here ("");
+      if (warning_hook)
+        (*warning_hook) (complaint->message, args);
+      else
+        {
+          vfprintf_filtered (gdb_stderr, complaint->message, args);
+          fputs_filtered ("...", gdb_stderr);
+          wrap_here ("");
+        }
     }
   /* If GDB dumps core, we'd like to see the complaints first.  Presumably
      GDB will not be sending so many complaints that this becomes a
@@ -124,9 +139,7 @@
    context for the user to figure it out.  */
 
 void
-clear_complaints (sym_reading, noisy)
-     int sym_reading;
-     int noisy;
+clear_complaints (int sym_reading, int noisy)
 {
   struct complaint *p;
 
@@ -135,7 +148,7 @@
       p->counter = 0;
     }
 
-  if (!sym_reading && !noisy && complaint_series > 1)
+  if (!sym_reading && !noisy && complaint_series > 1 && !warning_hook)
     {
       /* Terminate previous series, since caller won't.  */
       puts_filtered ("\n");
@@ -145,7 +158,7 @@
 }
 
 void
-_initialize_complaints ()
+_initialize_complaints (void)
 {
   add_show_from_set
     (add_set_cmd ("complaints", class_support, var_zinteger,
diff --git a/gdb/completer.c b/gdb/completer.c
new file mode 100644
index 0000000..9a665b6
--- /dev/null
+++ b/gdb/completer.c
@@ -0,0 +1,470 @@
+/* Line completion stuff for GDB, the GNU debugger.
+   Copyright 2000 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 "symtab.h"
+#include "gdbtypes.h"
+#include "expression.h"
+
+/* FIXME: This is needed because of lookup_cmd_1().
+   We should be calling a hook instead so we eliminate the CLI dependency. */
+#include "gdbcmd.h"
+
+/* Needed for rl_completer_word_break_characters() */
+#include <readline/readline.h>
+
+/* readline defines this.  */
+#undef savestring
+
+#include "completer.h"
+
+/* Prototypes for local functions */
+
+/* readline uses the word breaks for two things:
+   (1) In figuring out where to point the TEXT parameter to the
+   rl_completion_entry_function.  Since we don't use TEXT for much,
+   it doesn't matter a lot what the word breaks are for this purpose, but
+   it does affect how much stuff M-? lists.
+   (2) If one of the matches contains a word break character, readline
+   will quote it.  That's why we switch between
+   gdb_completer_word_break_characters and
+   gdb_completer_command_word_break_characters.  I'm not sure when
+   we need this behavior (perhaps for funky characters in C++ symbols?).  */
+
+/* Variables which are necessary for fancy command line editing.  */
+static char *gdb_completer_word_break_characters =
+" \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,-";
+
+/* When completing on command names, we remove '-' from the list of
+   word break characters, since we use it in command names.  If the
+   readline library sees one in any of the current completion strings,
+   it thinks that the string needs to be quoted and automatically supplies
+   a leading quote. */
+static char *gdb_completer_command_word_break_characters =
+" \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,";
+
+/* When completing on file names, we remove from the list of word
+   break characters any characters that are commonly used in file
+   names, such as '-', '+', '~', etc.  Otherwise, readline displays
+   incorrect completion candidates.  */
+static char *gdb_completer_file_name_break_characters = " \t\n*|\"';:?/><";
+
+/* Characters that can be used to quote completion strings.  Note that we
+   can't include '"' because the gdb C parser treats such quoted sequences
+   as strings. */
+static char *gdb_completer_quote_characters = "'";
+
+/* Accessor for some completer data that may interest other files. */
+
+char *
+get_gdb_completer_word_break_characters (void)
+{
+  return gdb_completer_word_break_characters;
+}
+
+char *
+get_gdb_completer_quote_characters (void)
+{
+  return gdb_completer_quote_characters;
+}
+
+/* Complete on filenames.  */
+char **
+filename_completer (char *text, char *word)
+{
+  /* From readline.  */
+extern char *filename_completion_function (char *, int);
+  int subsequent_name;
+  char **return_val;
+  int return_val_used;
+  int return_val_alloced;
+
+  return_val_used = 0;
+  /* Small for testing.  */
+  return_val_alloced = 1;
+  return_val = (char **) xmalloc (return_val_alloced * sizeof (char *));
+
+  subsequent_name = 0;
+  while (1)
+    {
+      char *p;
+      p = filename_completion_function (text, subsequent_name);
+      if (return_val_used >= return_val_alloced)
+	{
+	  return_val_alloced *= 2;
+	  return_val =
+	    (char **) xrealloc (return_val,
+				return_val_alloced * sizeof (char *));
+	}
+      if (p == NULL)
+	{
+	  return_val[return_val_used++] = p;
+	  break;
+	}
+      /* We need to set subsequent_name to a non-zero value before the
+	 continue line below, because otherwise, if the first file seen
+	 by GDB is a backup file whose name ends in a `~', we will loop
+	 indefinitely.  */
+      subsequent_name = 1;
+      /* Like emacs, don't complete on old versions.  Especially useful
+         in the "source" command.  */
+      if (p[strlen (p) - 1] == '~')
+	continue;
+
+      {
+	char *q;
+	if (word == text)
+	  /* Return exactly p.  */
+	  return_val[return_val_used++] = p;
+	else if (word > text)
+	  {
+	    /* Return some portion of p.  */
+	    q = xmalloc (strlen (p) + 5);
+	    strcpy (q, p + (word - text));
+	    return_val[return_val_used++] = q;
+	    xfree (p);
+	  }
+	else
+	  {
+	    /* Return some of TEXT plus p.  */
+	    q = xmalloc (strlen (p) + (text - word) + 5);
+	    strncpy (q, word, text - word);
+	    q[text - word] = '\0';
+	    strcat (q, p);
+	    return_val[return_val_used++] = q;
+	    xfree (p);
+	  }
+      }
+    }
+#if 0
+  /* There is no way to do this just long enough to affect quote inserting
+     without also affecting the next completion.  This should be fixed in
+     readline.  FIXME.  */
+  /* Insure that readline does the right thing
+     with respect to inserting quotes.  */
+  rl_completer_word_break_characters = "";
+#endif
+  return return_val;
+}
+
+/* Here are some useful test cases for completion.  FIXME: These should
+   be put in the test suite.  They should be tested with both M-? and TAB.
+
+   "show output-" "radix"
+   "show output" "-radix"
+   "p" ambiguous (commands starting with p--path, print, printf, etc.)
+   "p "  ambiguous (all symbols)
+   "info t foo" no completions
+   "info t " no completions
+   "info t" ambiguous ("info target", "info terminal", etc.)
+   "info ajksdlfk" no completions
+   "info ajksdlfk " no completions
+   "info" " "
+   "info " ambiguous (all info commands)
+   "p \"a" no completions (string constant)
+   "p 'a" ambiguous (all symbols starting with a)
+   "p b-a" ambiguous (all symbols starting with a)
+   "p b-" ambiguous (all symbols)
+   "file Make" "file" (word break hard to screw up here)
+   "file ../gdb.stabs/we" "ird" (needs to not break word at slash)
+ */
+
+/* Generate completions one by one for the completer.  Each time we are
+   called return another potential completion to the caller.
+   line_completion just completes on commands or passes the buck to the
+   command's completer function, the stuff specific to symbol completion
+   is in make_symbol_completion_list.
+
+   TEXT is the caller's idea of the "word" we are looking at.
+
+   MATCHES is the number of matches that have currently been collected from
+   calling this completion function.  When zero, then we need to initialize,
+   otherwise the initialization has already taken place and we can just
+   return the next potential completion string.
+
+   LINE_BUFFER is available to be looked at; it contains the entire text
+   of the line.  POINT is the offset in that line of the cursor.  You
+   should pretend that the line ends at POINT.
+
+   Returns NULL if there are no more completions, else a pointer to a string
+   which is a possible completion, it is the caller's responsibility to
+   free the string.  */
+
+char *
+line_completion_function (char *text, int matches, char *line_buffer, int point)
+{
+  static char **list = (char **) NULL;	/* Cache of completions */
+  static int index;		/* Next cached completion */
+  char *output = NULL;
+  char *tmp_command, *p;
+  /* Pointer within tmp_command which corresponds to text.  */
+  char *word;
+  struct cmd_list_element *c, *result_list;
+
+  if (matches == 0)
+    {
+      /* The caller is beginning to accumulate a new set of completions, so
+         we need to find all of them now, and cache them for returning one at
+         a time on future calls. */
+
+      if (list)
+	{
+	  /* Free the storage used by LIST, but not by the strings inside.
+	     This is because rl_complete_internal () frees the strings. */
+	  xfree (list);
+	}
+      list = 0;
+      index = 0;
+
+      /* Choose the default set of word break characters to break completions.
+         If we later find out that we are doing completions on command strings
+         (as opposed to strings supplied by the individual command completer
+         functions, which can be any string) then we will switch to the
+         special word break set for command strings, which leaves out the
+         '-' character used in some commands.  */
+
+      rl_completer_word_break_characters =
+	gdb_completer_word_break_characters;
+
+      /* Decide whether to complete on a list of gdb commands or on symbols. */
+      tmp_command = (char *) alloca (point + 1);
+      p = tmp_command;
+
+      strncpy (tmp_command, line_buffer, point);
+      tmp_command[point] = '\0';
+      /* Since text always contains some number of characters leading up
+         to point, we can find the equivalent position in tmp_command
+         by subtracting that many characters from the end of tmp_command.  */
+      word = tmp_command + point - strlen (text);
+
+      if (point == 0)
+	{
+	  /* An empty line we want to consider ambiguous; that is, it
+	     could be any command.  */
+	  c = (struct cmd_list_element *) -1;
+	  result_list = 0;
+	}
+      else
+	{
+	  c = lookup_cmd_1 (&p, cmdlist, &result_list, 1);
+	}
+
+      /* Move p up to the next interesting thing.  */
+      while (*p == ' ' || *p == '\t')
+	{
+	  p++;
+	}
+
+      if (!c)
+	{
+	  /* It is an unrecognized command.  So there are no
+	     possible completions.  */
+	  list = NULL;
+	}
+      else if (c == (struct cmd_list_element *) -1)
+	{
+	  char *q;
+
+	  /* lookup_cmd_1 advances p up to the first ambiguous thing, but
+	     doesn't advance over that thing itself.  Do so now.  */
+	  q = p;
+	  while (*q && (isalnum (*q) || *q == '-' || *q == '_'))
+	    ++q;
+	  if (q != tmp_command + point)
+	    {
+	      /* There is something beyond the ambiguous
+	         command, so there are no possible completions.  For
+	         example, "info t " or "info t foo" does not complete
+	         to anything, because "info t" can be "info target" or
+	         "info terminal".  */
+	      list = NULL;
+	    }
+	  else
+	    {
+	      /* We're trying to complete on the command which was ambiguous.
+	         This we can deal with.  */
+	      if (result_list)
+		{
+		  list = complete_on_cmdlist (*result_list->prefixlist, p,
+					      word);
+		}
+	      else
+		{
+		  list = complete_on_cmdlist (cmdlist, p, word);
+		}
+	      /* Insure that readline does the right thing with respect to
+	         inserting quotes.  */
+	      rl_completer_word_break_characters =
+		gdb_completer_command_word_break_characters;
+	    }
+	}
+      else
+	{
+	  /* We've recognized a full command.  */
+
+	  if (p == tmp_command + point)
+	    {
+	      /* There is no non-whitespace in the line beyond the command.  */
+
+	      if (p[-1] == ' ' || p[-1] == '\t')
+		{
+		  /* The command is followed by whitespace; we need to complete
+		     on whatever comes after command.  */
+		  if (c->prefixlist)
+		    {
+		      /* It is a prefix command; what comes after it is
+		         a subcommand (e.g. "info ").  */
+		      list = complete_on_cmdlist (*c->prefixlist, p, word);
+
+		      /* Insure that readline does the right thing
+		         with respect to inserting quotes.  */
+		      rl_completer_word_break_characters =
+			gdb_completer_command_word_break_characters;
+		    }
+		  else if (c->enums)
+		    {
+		      list = complete_on_enum (c->enums, p, word);
+		      rl_completer_word_break_characters =
+			gdb_completer_command_word_break_characters;
+		    }
+		  else
+		    {
+		      /* It is a normal command; what comes after it is
+		         completed by the command's completer function.  */
+		      list = (*c->completer) (p, word);
+		      if (c->completer == filename_completer)
+			rl_completer_word_break_characters =
+			  gdb_completer_file_name_break_characters;
+		    }
+		}
+	      else
+		{
+		  /* The command is not followed by whitespace; we need to
+		     complete on the command itself.  e.g. "p" which is a
+		     command itself but also can complete to "print", "ptype"
+		     etc.  */
+		  char *q;
+
+		  /* Find the command we are completing on.  */
+		  q = p;
+		  while (q > tmp_command)
+		    {
+		      if (isalnum (q[-1]) || q[-1] == '-' || q[-1] == '_')
+			--q;
+		      else
+			break;
+		    }
+
+		  list = complete_on_cmdlist (result_list, q, word);
+
+		  /* Insure that readline does the right thing
+		     with respect to inserting quotes.  */
+		  rl_completer_word_break_characters =
+		    gdb_completer_command_word_break_characters;
+		}
+	    }
+	  else
+	    {
+	      /* There is non-whitespace beyond the command.  */
+
+	      if (c->prefixlist && !c->allow_unknown)
+		{
+		  /* It is an unrecognized subcommand of a prefix command,
+		     e.g. "info adsfkdj".  */
+		  list = NULL;
+		}
+	      else if (c->enums)
+		{
+		  list = complete_on_enum (c->enums, p, word);
+		}
+	      else
+		{
+		  /* It is a normal command.  */
+		  list = (*c->completer) (p, word);
+		  if (c->completer == filename_completer)
+		    rl_completer_word_break_characters =
+		      gdb_completer_file_name_break_characters;
+		}
+	    }
+	}
+    }
+
+  /* If we found a list of potential completions during initialization then
+     dole them out one at a time.  The vector of completions is NULL
+     terminated, so after returning the last one, return NULL (and continue
+     to do so) each time we are called after that, until a new list is
+     available. */
+
+  if (list)
+    {
+      output = list[index];
+      if (output)
+	{
+	  index++;
+	}
+    }
+
+#if 0
+  /* Can't do this because readline hasn't yet checked the word breaks
+     for figuring out whether to insert a quote.  */
+  if (output == NULL)
+    /* Make sure the word break characters are set back to normal for the
+       next time that readline tries to complete something.  */
+    rl_completer_word_break_characters =
+      gdb_completer_word_break_characters;
+#endif
+
+  return (output);
+}
+/* Skip over a possibly quoted word (as defined by the quote characters
+   and word break characters the completer uses).  Returns pointer to the
+   location after the "word". */
+
+char *
+skip_quoted (char *str)
+{
+  char quote_char = '\0';
+  char *scan;
+
+  for (scan = str; *scan != '\0'; scan++)
+    {
+      if (quote_char != '\0')
+	{
+	  /* Ignore everything until the matching close quote char */
+	  if (*scan == quote_char)
+	    {
+	      /* Found matching close quote. */
+	      scan++;
+	      break;
+	    }
+	}
+      else if (strchr (gdb_completer_quote_characters, *scan))
+	{
+	  /* Found start of a quoted string. */
+	  quote_char = *scan;
+	}
+      else if (strchr (gdb_completer_word_break_characters, *scan))
+	{
+	  break;
+	}
+    }
+  return (scan);
+}
+
diff --git a/gdb/completer.h b/gdb/completer.h
new file mode 100644
index 0000000..518b300
--- /dev/null
+++ b/gdb/completer.h
@@ -0,0 +1,34 @@
+/* Header for GDB line completion.
+   Copyright 2000 Free Software Foundation.
+
+   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.  */
+
+#if !defined (COMPLETER_H)
+#define COMPLETER_H 1
+
+extern char *line_completion_function (char *, int, char *, int);
+
+extern char **filename_completer (char *, char *);
+
+extern char *get_gdb_completer_word_break_characters (void); 
+
+extern char *get_gdb_completer_quote_characters (void);
+
+/* Exported to linespec.c */
+
+extern char *skip_quoted (char *str);
+
+#endif /* defined (COMPLETER_H) */
diff --git a/gdb/config.in b/gdb/config.in
index faf5cd4..f6f0031 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -68,6 +68,9 @@
 /* Define if your struct reg has r_gs.  */
 #undef HAVE_STRUCT_REG_R_GS
 
+/* Define if <sys/link.h> has struct link_map32 */
+#undef HAVE_STRUCT_LINK_MAP32
+
 /* Define if the prfpregset_t type is broken. */
 #undef PRFPREGSET_T_BROKEN
 
@@ -129,12 +132,30 @@
 /* Define if <sys/ptrace.h> defines the PTRACE_GETREGS request.  */
 #undef HAVE_PTRACE_GETREGS
 
-/* Define if <sys/ptrace.h> defines the PTRACE_GETXFPREGS request.  */
-#undef HAVE_PTRACE_GETXFPREGS
+/* Define if <sys/ptrace.h> defines the PTRACE_GETFPXREGS request.  */
+#undef HAVE_PTRACE_GETFPXREGS
 
 /* Define if gnu-regex.c included with GDB should be used. */
 #undef USE_INCLUDED_REGEX
 
+/* BFD's default architecture. */
+#undef DEFAULT_BFD_ARCH
+
+/* BFD's default target vector. */
+#undef DEFAULT_BFD_VEC
+
+/* Multi-arch enabled. */
+#undef GDB_MULTI_ARCH
+
+/* hostfile */
+#undef GDB_XM_FILE
+
+/* targetfile */
+#undef GDB_TM_FILE
+
+/* nativefile */
+#undef GDB_NM_FILE
+
 /* Define if you have the __argz_count function.  */
 #undef HAVE___ARGZ_COUNT
 
@@ -204,6 +225,9 @@
 /* Define if you have the strchr function.  */
 #undef HAVE_STRCHR
 
+/* Define if you have the vfork function.  */
+#undef HAVE_VFORK
+
 /* Define if you have the <argz.h> header file.  */
 #undef HAVE_ARGZ_H
 
@@ -249,6 +273,9 @@
 /* Define if you have the <objlist.h> header file.  */
 #undef HAVE_OBJLIST_H
 
+/* Define if you have the <poll.h> header file.  */
+#undef HAVE_POLL_H
+
 /* Define if you have the <proc_service.h> header file.  */
 #undef HAVE_PROC_SERVICE_H
 
@@ -285,6 +312,9 @@
 /* Define if you have the <sys/param.h> header file.  */
 #undef HAVE_SYS_PARAM_H
 
+/* Define if you have the <sys/poll.h> header file.  */
+#undef HAVE_SYS_POLL_H
+
 /* Define if you have the <sys/procfs.h> header file.  */
 #undef HAVE_SYS_PROCFS_H
 
@@ -393,6 +423,12 @@
 /* Define if <sys/procfs.h> has prfpregset_t. */
 #undef HAVE_PRFPREGSET_T
 
+/* Define if <sys/procfs.h> has prgregset32_t. */
+#undef HAVE_PRGREGSET32_T
+
+/* Define if <sys/procfs.h> has prfpregset32_t. */
+#undef HAVE_PRFPREGSET32_T
+
 /* Define if <sys/procfs.h> has lwpid_t. */
 #undef HAVE_LWPID_T
 
diff --git a/gdb/config/alpha/alpha-linux.mh b/gdb/config/alpha/alpha-linux.mh
index 9a73388..c7575ae 100644
--- a/gdb/config/alpha/alpha-linux.mh
+++ b/gdb/config/alpha/alpha-linux.mh
@@ -1,9 +1,9 @@
 # Host: Little-endian Alpha running Linux
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 XM_FILE= xm-alphalinux.h
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o \
-	fork-child.o solib.o linux-thread.o lin-thread.o 
+	fork-child.o linux-thread.o lin-thread.o 
 
 LOADLIBES = -ldl -rdynamic
 
diff --git a/gdb/config/alpha/alpha-linux.mt b/gdb/config/alpha/alpha-linux.mt
index 7789252..a487907 100644
--- a/gdb/config/alpha/alpha-linux.mt
+++ b/gdb/config/alpha/alpha-linux.mt
@@ -1,3 +1,3 @@
 # Target: Little-endian Alpha
-TDEPFILES= alpha-tdep.o
+TDEPFILES= alpha-tdep.o solib.o solib-svr4.o 
 TM_FILE= tm-alphalinux.h
diff --git a/gdb/config/alpha/alpha-osf3.mh b/gdb/config/alpha/alpha-osf3.mh
index 61594a7..6af2808 100644
--- a/gdb/config/alpha/alpha-osf3.mh
+++ b/gdb/config/alpha/alpha-osf3.mh
@@ -1,5 +1,5 @@
 # Host: Little-endian Alpha running OSF/1-3.x and higher using procfs
-XDEPFILES= ser-tcp.o ser-pipe.o
+XDEPFILES=
 XM_FILE= xm-alphaosf.h
 NAT_FILE= nm-osf3.h
 NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o fork-child.o \
diff --git a/gdb/config/alpha/fbsd.mh b/gdb/config/alpha/fbsd.mh
index 9c2b5e5..17fb44d 100644
--- a/gdb/config/alpha/fbsd.mh
+++ b/gdb/config/alpha/fbsd.mh
@@ -1,6 +1,6 @@
 # Host: FreeBSD/Alpha
-XDEPFILES= ser-tcp.o
-NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o \
+XDEPFILES=
+NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o solib-svr4.o \
 	corelow.o core-regset.o alphabsd-nat.o
 XM_FILE= xm-fbsd.h
 NAT_FILE= nm-fbsd.h
diff --git a/gdb/config/arm/linux.mh b/gdb/config/arm/linux.mh
index 98e0e93..c373f72 100644
--- a/gdb/config/arm/linux.mh
+++ b/gdb/config/arm/linux.mh
@@ -1,10 +1,10 @@
 # Host: ARM based machine running GNU/Linux
 
 XM_FILE= xm-linux.h
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 
 NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
 	     core-regset.o arm-linux-nat.o linux-thread.o lin-thread.o
 
 LOADLIBES= -ldl -rdynamic
diff --git a/gdb/config/arm/linux.mt b/gdb/config/arm/linux.mt
index 4939d56..827447c 100644
--- a/gdb/config/arm/linux.mt
+++ b/gdb/config/arm/linux.mt
@@ -1,5 +1,5 @@
 # Target: ARM based machine running GNU/Linux
 TM_FILE= tm-linux.h
-TDEPFILES= arm-tdep.o arm-linux-tdep.o
+TDEPFILES= arm-tdep.o arm-linux-tdep.o solib.o solib-svr4.o 
 
 GDBSERVER_DEPFILES= low-linux.o
diff --git a/gdb/config/arm/tm-arm.h b/gdb/config/arm/tm-arm.h
index ed8e80c..190b8b2 100644
--- a/gdb/config/arm/tm-arm.h
+++ b/gdb/config/arm/tm-arm.h
@@ -513,4 +513,11 @@
 /* The first 0x20 bytes are the trap vectors.  */
 #define LOWEST_PC	0x20
 
+/* Function to determine whether MEMADDR is in a Thumb function.  */
+extern int arm_pc_is_thumb (bfd_vma memaddr);
+
+/* Function to determine whether MEMADDR is in a call dummy called from
+   a Thumb function.  */
+extern int arm_pc_is_thumb_dummy (bfd_vma memaddr);
+
 #endif /* TM_ARM_H */
diff --git a/gdb/config/arm/tm-embed.h b/gdb/config/arm/tm-embed.h
index c2a856b..5069f3f 100644
--- a/gdb/config/arm/tm-embed.h
+++ b/gdb/config/arm/tm-embed.h
@@ -53,14 +53,6 @@
 extern int arm_in_call_stub (CORE_ADDR pc, char *name);
 extern CORE_ADDR arm_skip_stub (CORE_ADDR pc);
 
-/* Function to determine whether MEMADDR is in a Thumb function.  */
-extern int arm_pc_is_thumb (bfd_vma memaddr);
-
-/* Function to determine whether MEMADDR is in a call dummy called from
-   a Thumb function.  */
-extern int arm_pc_is_thumb_dummy (bfd_vma memaddr);
-
-
 #undef  IN_SIGTRAMP
 #define IN_SIGTRAMP(pc, name) 0
 
diff --git a/gdb/config/arm/tm-linux.h b/gdb/config/arm/tm-linux.h
index 9dcd666..8f18e00 100644
--- a/gdb/config/arm/tm-linux.h
+++ b/gdb/config/arm/tm-linux.h
@@ -135,4 +135,26 @@
 #define IN_SOLIB_DYNSYM_RESOLVE_CODE  in_svr4_dynsym_resolve_code */
 #endif
 
+/* When the ARM Linux kernel invokes a signal handler, the return
+   address points at a special instruction which'll trap back into
+   the kernel.  These definitions are used to identify this bit of
+   code as a signal trampoline in order to support backtracing
+   through calls to signal handlers. */
+
+int arm_linux_in_sigtramp (CORE_ADDR pc, char *name);
+#define IN_SIGTRAMP(pc, name) arm_linux_in_sigtramp (pc, name)
+
+/* Each OS has different mechanisms for accessing the various
+   registers stored in the sigcontext structure.  These definitions
+   provide a mechanism by which the generic code in arm-tdep.c can
+   find the addresses at which various registers are saved at in the
+   sigcontext structure.  If SIGCONTEXT_REGISTER_ADDRESS is not
+   defined, arm-tdep.c will define it to be 0.  (See ia64-tdep.c and
+   ia64-linux-tdep.c to see what a similar mechanism looks like when
+   multi-arched.) */
+
+extern CORE_ADDR arm_linux_sigcontext_register_address (CORE_ADDR, CORE_ADDR,
+                                                        int);
+#define SIGCONTEXT_REGISTER_ADDRESS arm_linux_sigcontext_register_address
+
 #endif /* TM_ARMLINUX_H */
diff --git a/gdb/config/convex/tm-convex.h b/gdb/config/convex/tm-convex.h
index 884719f..5ddd1f4 100644
--- a/gdb/config/convex/tm-convex.h
+++ b/gdb/config/convex/tm-convex.h
Binary files differ
diff --git a/gdb/config/d10v/tm-d10v.h b/gdb/config/d10v/tm-d10v.h
index 44c8c7c..e073425 100644
--- a/gdb/config/d10v/tm-d10v.h
+++ b/gdb/config/d10v/tm-d10v.h
@@ -1,5 +1,5 @@
 /* Target-specific definition for the Mitsubishi D10V
-   Copyright (C) 1996,1999 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1999, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -22,7 +22,4 @@
 
 #define GDB_MULTI_ARCH 1
 
-extern int d10v_register_sim_regno (int reg);
-#define REGISTER_SIM_REGNO(NR) d10v_register_sim_regno((NR))
-
 #define NO_EXTRA_ALIGNMENT_NEEDED 1
diff --git a/gdb/config/djgpp/config.sed b/gdb/config/djgpp/config.sed
index c53dc02..5159579 100644
--- a/gdb/config/djgpp/config.sed
+++ b/gdb/config/djgpp/config.sed
@@ -10,7 +10,7 @@
   s,\\.info\\*,.inf* *.i[1-9] *.i[1-9][0-9],\
   s,\\.gdbinit,gdb.ini,g\
   /TEXINPUTS=/s,:,';',g\
-  /VPATH *=/s,:,;,g\
+  /VPATH *=/s,\\([^A-z]\\):,\1;,g\
   /\\$\\$file-\\[0-9\\]/s,echo,& *.i[1-9] *.i[1-9][0-9],\
   /\\$\\$file-\\[0-9\\]/s,rm -f \\$\\$file,& \\${PACKAGE}.i[1-9] \\${PACKAGE}.i[1-9][0-9],\
   s,config\\.h\\.in,config.h-in,g\
@@ -29,3 +29,4 @@
 /\$]\*) INSTALL=/s,\[/\$\]\*,&|[A-z]:/*,
 /\$]\*) ac_rel_source=/s,\[/\$\]\*,&|[A-z]:/*,
 /ac_file_inputs=/s,\( -e "s%\^%\$ac_given_srcdir/%"\)\( -e "s%:% $ac_given_srcdir/%g"\),\2\1,
+/^[ 	]*if test "x`echo /s,sed 's@/,sed -e 's@^[A-z]:@@' -e 's@/,
diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst
index 582142b..a33a11c 100644
--- a/gdb/config/djgpp/fnchange.lst
+++ b/gdb/config/djgpp/fnchange.lst
@@ -136,6 +136,7 @@
 @V@/gdb/jv-exp.tab.c @V@/gdb/jv-exp_tab.c
 @V@/gdb/f-exp.tab.c @V@/gdb/f-exp_tab.c
 @V@/gdb/m2-exp.tab.c @V@/gdb/m2-exp_tab.c
+@V@/gdb/p-exp.tab.c @V@/gdb/p-exp_tab.c
 @V@/gdb/testsuite/gdb.c++ @V@/gdb/testsuite/gdb.cxx
 @V@/gdb/testsuite/gdb.c++/Makefile.in @V@/gdb/testsuite/gdb.cxx/Makefile.in
 @V@/gdb/testsuite/gdb.c++/ambiguous.cc @V@/gdb/testsuite/gdb.cxx/ambiguous.cc
@@ -181,3 +182,205 @@
 @V@/gdb/testsuite/gdb.mi/mi-var-cmd.exp @V@/gdb/testsuite/gdb.mi/mi-varcmd.exp
 @V@/gdb/testsuite/.gdbinit @V@/gdb/testsuite/gdb.ini
 @V@/sim/ppc/.gdbinit @V@/sim/ppc/gdb.ini
+@V@/tcl/cygwin/tclConfig.sh.in @V@/tcl/cygwin/tclConfig.sh-in
+@V@/tcl/mac/tclMacProjects.sea.hqx @V@/tcl/mac/tclMacProjects.shqx
+@V@/tcl/unix/tclConfig.sh.in @V@/tcl/unix/tclConfig.sh-in
+@V@/tk/doc/tk4.0.ps @V@/tk/doc/tk4-0.ps - too many dots
+@V@/tk/mac/tkMacProjects.sit.hqx @V@/tk/mac/tkMacProjects.shqx
+@V@/tk/unix/tkConfig.sh.in @V@/tk/unix/tkConfig.sh-in
+@V@/itcl/itcl/itclConfig.sh.in @V@/itcl/itcl/itclConfig.sh-in
+@V@/itcl/itcl/unix/pkgIndex.tcl.in @V@/itcl/itcl/unix/pkgIndex.t-in
+@V@/itcl/itk/itkConfig.sh.in @V@/itcl/itk/itkConfig.sh-in
+@V@/itcl/itk/unix/pkgIndex.tcl.in @V@/itcl/itk/unix/pkgIndex.t-in
+@V@/itcl/iwidgets3.0.0 @V@/itcl/iwidgets3.0-0
+@V@/itcl/iwidgets3.0.0/demos/html/buttonbox.n.html @V@/itcl/iwidgets3.0-0/demos/html/buttonbox.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/canvasprintbox.n.html @V@/itcl/iwidgets3.0-0/demos/html/cprintbox.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/canvasprintdialog.n.html @V@/itcl/iwidgets3.0-0/demos/html/cprintdialog.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/combobox.n.html @V@/itcl/iwidgets3.0-0/demos/html/combobox.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/dialog.n.html @V@/itcl/iwidgets3.0-0/demos/html/dialog.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/dialogshell.n.html @V@/itcl/iwidgets3.0-0/demos/html/dialogshell.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/entryfield.n.html @V@/itcl/iwidgets3.0-0/demos/html/entryfield.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/feedback.n.html @V@/itcl/iwidgets3.0-0/demos/html/feedback.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/fileselectionbox.n.html @V@/itcl/iwidgets3.0-0/demos/html/fselectbox.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/fileselectiondialog.n.html @V@/itcl/iwidgets3.0-0/demos/html/fselectdialog.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/hyperhelp.n.html @V@/itcl/iwidgets3.0-0/demos/html/hyperhelp.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/iwidgets2.2.0UserCmds.html @V@/itcl/iwidgets3.0-0/demos/html/iw220UserCmds.html
+@V@/itcl/iwidgets3.0.0/demos/html/labeledwidget.n.html @V@/itcl/iwidgets3.0-0/demos/html/labeledwidget.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/menubar.n.html @V@/itcl/iwidgets3.0-0/demos/html/menubar.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/messagedialog.n.html @V@/itcl/iwidgets3.0-0/demos/html/messagedialog.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/notebook.n.html @V@/itcl/iwidgets3.0-0/demos/html/notebook.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/optionmenu.n.html @V@/itcl/iwidgets3.0-0/demos/html/optionmenu.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/panedwindow.n.html @V@/itcl/iwidgets3.0-0/demos/html/panedwindow.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/promptdialog.n.html @V@/itcl/iwidgets3.0-0/demos/html/promptdialog.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/pushbutton.n.html @V@/itcl/iwidgets3.0-0/demos/html/pushbutton.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/radiobox.n.html @V@/itcl/iwidgets3.0-0/demos/html/radiobox.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/scrolledcanvas.n.html @V@/itcl/iwidgets3.0-0/demos/html/scrolcanvas.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/scrolledframe.n.html @V@/itcl/iwidgets3.0-0/demos/html/scrolframe.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/scrolledhtml.n.html @V@/itcl/iwidgets3.0-0/demos/html/scrolhtml.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/scrolledlistbox.n.html @V@/itcl/iwidgets3.0-0/demos/html/scrollistbox.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/scrolledtext.n.html @V@/itcl/iwidgets3.0-0/demos/html/scroltext.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/selectionbox.n.html @V@/itcl/iwidgets3.0-0/demos/html/selectbox.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/selectiondialog.n.html @V@/itcl/iwidgets3.0-0/demos/html/selectdialog.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/shell.n.html @V@/itcl/iwidgets3.0-0/demos/html/shell.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/spindate.n.html @V@/itcl/iwidgets3.0-0/demos/html/spindate.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/spinint.n.html @V@/itcl/iwidgets3.0-0/demos/html/spinint.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/spinner.n.html @V@/itcl/iwidgets3.0-0/demos/html/spinner.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/spintime.n.html @V@/itcl/iwidgets3.0-0/demos/html/spintime.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/tabnotebook.n.html @V@/itcl/iwidgets3.0-0/demos/html/tabnotebook.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/tabset.n.html @V@/itcl/iwidgets3.0-0/demos/html/tabset.n-html
+@V@/itcl/iwidgets3.0.0/demos/html/toolbar.n.html @V@/itcl/iwidgets3.0-0/demos/html/toolbar.n-html
+@V@/itcl/iwidgets3.0.0/doc/scopedobject.n.backup @V@/itcl/iwidgets3.0-0/doc/scopedobject.n-backup
+@V@/itcl/iwidgets3.0.0/unix/iwidgets.tcl.in @V@/itcl/iwidgets3.0-0/unix/iwidgets.t-in
+@V@/itcl/iwidgets3.0.0/unix/pkgIndex.tcl.in @V@/itcl/iwidgets3.0-0/unix/pkgIndex.t-in
+@V@/tix/tixConfig.sh.in @V@/tix/tixConfig.sh-in
+@V@/tix/docs/Release-4.1.0.html @V@/tix/docs/Rel4_10.html
+@V@/tix/docs/Release-4.1.0.txt @V@/tix/docs/Rel4_10.txt
+@V@/tix/docs/Release-4.1a2.html @V@/tix/docs/Rel4_1a2.html
+@V@/tix/docs/Release-4.1a2.txt @V@/tix/docs/Rel4_1a2.txt
+@V@/tix/docs/Release-4.1a3.html @V@/tix/docs/Rel4_1a3.html
+@V@/tix/docs/Release-4.1a3.txt @V@/tix/docs/Rel4_1a3.txt
+@V@/tix/docs/Release-4.1b1.html @V@/tix/docs/Rel4_1b1.html
+@V@/tix/docs/Release-4.1b1.txt @V@/tix/docs/Rel4_1b1.txt
+@V@/tix/docs/Release-4.1b2.html @V@/tix/docs/Rel4_1b2.html
+@V@/tix/docs/Release-4.1b2.txt @V@/tix/docs/Rel4_1b2.txt
+@V@/tix/unix/tk4.2/pkgIndex.tcl.in @V@/tix/unix/tk4.2/pkgIndex.t-in
+@V@/tix/unix/tk8.0/pkgIndex.tcl.in @V@/tix/unix/tk8.0/pkgIndex.t-in
+@V@/tix/unix/tk8.1/pkgIndex.tcl.in @V@/tix/unix/tk8.1/pkgIndex.t-in
+@V@/libgui/config.h.in @V@/libgui/config.h-in
+@V@/expect/Dbg_cf.h.in @V@/expect/Dbg_cf.h-in
+@V@/expect/expect_cf.h.in @V@/expect/expect_cf.h-in
+@V@/expect/example/beer.exp.out @V@/expect/example/beer_exp.out
+@V@/expect/example/chesslib++.c @V@/expect/example/chesslibxx.c
+@V@/dejagnu/contrib/test-g++ @V@/dejagnu/contrib/test-gxx
+@V@/dejagnu/doc/.cvsignore @V@/dejagnu/doc/_cvsignore
+@V@/dejagnu/example/calc/calc.h.in @V@/dejagnu/example/calc/calc.h-in
+@V@/itcl/iwidgets3.0.0/generic/canvasprintbox.itk @V@/itcl/iwidgets3.0-0/generic/cprintbox.itk
+@V@/itcl/iwidgets3.0.0/generic/canvasprintdialog.itk @V@/itcl/iwidgets3.0-0/generic/cprintdialog.itk
+@V@/itcl/iwidgets3.0.0/doc/canvasprintbox.n @V@/itcl/iwidgets3.0-0/doc/cprintbox.n
+@V@/itcl/iwidgets3.0.0/doc/canvasprintdialog.n @V@/itcl/iwidgets3.0-0/doc/cprintdialog.n
+@V@/itcl/iwidgets3.0.0/tests/canvasprintbox.test @V@/itcl/iwidgets3.0-0/tests/cprintbox.test
+@V@/itcl/iwidgets3.0.0/tests/canvasprintdialog.test @V@/itcl/iwidgets3.0-0/tests/cprintdialog.test
+@V@/expect/example/chesslib2.c @V@/expect/example/chesslb2.c
+@V@/tk/doc/ConfigWidg.3 @V@/tk/doc/CfgWidg.3
+@V@/tk/doc/ConfigWind.3 @V@/tk/doc/CfgWind.3
+@V@/bfd/cpu-ia64-opc.c @V@/bfd/cpuia64-opc.c
+@V@/bfd/cpu-m68hc11.c @V@/bfd/cm68hc11.c
+@V@/bfd/cpu-m68hc12.c @V@/bfd/cm68hc12.c
+@V@/sim/m68hc11/dv-m68hc11eepr.c @V@/sim/m68hc11/dv-eepr.c
+@V@/sim/m68hc11/dv-m68hc11sio.c @V@/sim/m68hc11/dv-sio.c
+@V@/sim/m68hc11/dv-m68hc11spi.c @V@/sim/m68hc11/dv-spi.c
+@V@/sim/m68hc11/dv-m68hc11tim.c @V@/sim/m68hc11/dv-tim.c
+@V@/bfd/efi-app-ia32.c @V@/bfd/efi-ia32-app.c
+@V@/bfd/efi-app-ia64.c @V@/bfd/efi-ia64-app.c
+@V@/bfd/elf32-m68hc11.c @V@/bfd/em68hc11.c
+@V@/bfd/elf32-m68hc12.c @V@/bfd/em68hc12.c
+@V@/bfd/elf32-m68k.c @V@/bfd/em68k.c
+@V@/tcl/doc/ExprLongObj.3 @V@/tcl/doc/ExprLObj.3
+@V@/expect/exp_main_sub.c @V@/expect/exp_m_sub.c
+@V@/expect/exp_main_tk.c @V@/expect/exp_m_tk.c
+@V@/itcl/iwidgets3.0.0/demos/extfileselectionbox @V@/itcl/iwidgets3.0-0/demos/efselbox
+@V@/itcl/iwidgets3.0.0/demos/extfileselectiondialog @V@/itcl/iwidgets3.0-0/demos/efseldialog
+@V@/itcl/iwidgets3.0.0/generic/extfileselectionbox.itk @V@/itcl/iwidgets3.0-0/generic/efselbox.itk
+@V@/itcl/iwidgets3.0.0/generic/extfileselectiondialog.itk @V@/itcl/iwidgets3.0-0/generic/efseldialog.itk
+@V@/itcl/iwidgets3.0.0/doc/extfileselectionbox.n @V@/itcl/iwidgets3.0-0/doc/efselbox.n
+@V@/itcl/iwidgets3.0.0/doc/extfileselectiondialog.n @V@/itcl/iwidgets3.0-0/doc/efseldialog.n
+@V@/itcl/iwidgets3.0.0/tests/extfileselectionbox.test @V@/itcl/iwidgets3.0-0/tests/efselbox.test
+@V@/itcl/iwidgets3.0.0/tests/extfileselectiondialog.test @V@/itcl/iwidgets3.0-0/tests/efseldialog.test
+@V@/itcl/iwidgets3.0.0/demos/fileselectionbox @V@/itcl/iwidgets3.0-0/demos/fselectbox
+@V@/itcl/iwidgets3.0.0/demos/fileselectiondialog @V@/itcl/iwidgets3.0-0/demos/fselectdialog
+@V@/itcl/iwidgets3.0.0/generic/fileselectionbox.itk @V@/itcl/iwidgets3.0-0/generic/fselectbox.itk
+@V@/itcl/iwidgets3.0.0/generic/fileselectiondialog.itk @V@/itcl/iwidgets3.0-0/generic/fselectdialog.itk
+@V@/itcl/iwidgets3.0.0/doc/fileselectionbox.n @V@/itcl/iwidgets3.0-0/doc/fselectbox.n
+@V@/itcl/iwidgets3.0.0/doc/fileselectiondialog.n @V@/itcl/iwidgets3.0-0/doc/fselectdialog.n
+@V@/itcl/iwidgets3.0.0/tests/fileselectionbox.test @V@/itcl/iwidgets3.0-0/tests/fselectbox.test
+@V@/itcl/iwidgets3.0.0/tests/fileselectiondialog.test @V@/itcl/iwidgets3.0-0/tests/fselectdialog.test
+@V@/opcodes/ia64-opc-a.c @V@/opcodes/ia64opca.c
+@V@/opcodes/ia64-opc-b.c @V@/opcodes/ia64opcb.c
+@V@/opcodes/ia64-opc-d.c @V@/opcodes/ia64opcd.c
+@V@/opcodes/ia64-opc-f.c @V@/opcodes/ia64opcf.c
+@V@/opcodes/ia64-opc-i.c @V@/opcodes/ia64opci.c
+@V@/opcodes/ia64-opc-m.c @V@/opcodes/ia64opcm.c
+@V@/opcodes/ia64-opc-x.c @V@/opcodes/ia64opcx.c
+@V@/opcodes/ia64-opc.c @V@/opcodes/ia64-opc.c
+@V@/opcodes/m68hc11-dis.c @V@/opcodes/m68hc11dis.c
+@V@/opcodes/m68hc11-opc.c @V@/opcodes/m68hc11opc.c
+@V@/dejagnu/baseboards/mn10200-cygmon.exp @V@/dejagnu/baseboards/mn10200cygmon.exp
+@V@/dejagnu/baseboards/mn10200-sim.exp @V@/dejagnu/baseboards/mn10200sim.exp
+@V@/dejagnu/baseboards/mn10300-cygmon.exp @V@/dejagnu/baseboards/mn10300cygmon.exp
+@V@/dejagnu/baseboards/mn10300-sim.exp @V@/dejagnu/baseboards/mn10300sim.exp
+@V@/tcl/tests/namespace-old.test @V@/tcl/tests/namespace.otest
+@V@/tk/tests/option.file1 @V@/tk/tests/option1.file
+@V@/tk/tests/option.file2 @V@/tk/tests/option2.file
+@V@/tix/unix/tk8.0/pkgIndex.tcl.in @V@/tix/unix/tk8.0/pkgIndex.t-in
+@V@/dejagnu/baseboards/powerpc-bug1.exp @V@/dejagnu/baseboards/powerpc1-bug.exp
+@V@/dejagnu/baseboards/powerpc-sim.exp @V@/dejagnu/baseboards/powerpcsim.exp
+@V@/tk/library/images/pwrdLogo100.gif @V@/tk/library/images/pwLogo100.gif
+@V@/tk/library/images/pwrdLogo150.gif @V@/tk/library/images/pwLogo150.gif
+@V@/tk/library/images/pwrdLogo175.gif @V@/tk/library/images/pwLogo175.gif
+@V@/tk/library/images/pwrdLogo200.gif @V@/tk/library/images/pwLogo200.gif
+@V@/tk/library/images/pwrdLogo75.gif @V@/tk/library/images/pwLogo75.gif
+@V@/itcl/iwidgets3.0.0/demos/scrolledcanvas @V@/itcl/iwidgets3.0-0/demos/scrolcanvas
+@V@/itcl/iwidgets3.0.0/demos/scrolledframe @V@/itcl/iwidgets3.0-0/demos/scrolframe
+@V@/itcl/iwidgets3.0.0/demos/scrolledhtml @V@/itcl/iwidgets3.0-0/demos/scrolhtml
+@V@/itcl/iwidgets3.0.0/demos/scrolledlistbox @V@/itcl/iwidgets3.0-0/demos/scroldlistbox
+@V@/itcl/iwidgets3.0.0/demos/scrolledtext @V@/itcl/iwidgets3.0-0/demos/scroltext
+@V@/itcl/iwidgets3.0.0/generic/scrolledcanvas.itk @V@/itcl/iwidgets3.0-0/generic/scrolcanvas.itk
+@V@/itcl/iwidgets3.0.0/generic/scrolledframe.itk @V@/itcl/iwidgets3.0-0/generic/scrolframe.itk
+@V@/itcl/iwidgets3.0.0/generic/scrolledhtml.itk @V@/itcl/iwidgets3.0-0/generic/scrolhtml.itk
+@V@/itcl/iwidgets3.0.0/generic/scrolledlistbox.itk @V@/itcl/iwidgets3.0-0/generic/scrollistbox.itk
+@V@/itcl/iwidgets3.0.0/generic/scrolledtext.itk @V@/itcl/iwidgets3.0-0/generic/scroltext.itk
+@V@/itcl/iwidgets3.0.0/generic/scrolledwidget.itk @V@/itcl/iwidgets3.0-0/generic/scrolwidget.itk
+@V@/itcl/iwidgets3.0.0/doc/scrolledcanvas.n @V@/itcl/iwidgets3.0-0/doc/scrolcanvas.n
+@V@/itcl/iwidgets3.0.0/doc/scrolledframe.n @V@/itcl/iwidgets3.0-0/doc/scrolframe.n
+@V@/itcl/iwidgets3.0.0/doc/scrolledhtml.n @V@/itcl/iwidgets3.0-0/doc/scrolhtml.n
+@V@/itcl/iwidgets3.0.0/doc/scrolledlistbox.n @V@/itcl/iwidgets3.0-0/doc/scrollistbox.n
+@V@/itcl/iwidgets3.0.0/doc/scrolledtext.n @V@/itcl/iwidgets3.0-0/doc/scroltext.n
+@V@/itcl/iwidgets3.0.0/tests/scrolledcanvas.test @V@/itcl/iwidgets3.0-0/tests/scrolcanvas.test
+@V@/itcl/iwidgets3.0.0/tests/scrolledframe.test @V@/itcl/iwidgets3.0-0/tests/scrolframe.test
+@V@/itcl/iwidgets3.0.0/tests/scrolledhtml.test @V@/itcl/iwidgets3.0-0/tests/scrolhtml.test
+@V@/itcl/iwidgets3.0.0/tests/scrolledlistbox.test @V@/itcl/iwidgets3.0-0/tests/scrollistbox.test
+@V@/itcl/iwidgets3.0.0/tests/scrolledtext.test @V@/itcl/iwidgets3.0-0/tests/scroltext.test
+@V@/itcl/iwidgets3.0.0/demos/selectionbox @V@/itcl/iwidgets3.0-0/demos/selectbox
+@V@/itcl/iwidgets3.0.0/demos/selectiondialog @V@/itcl/iwidgets3.0-0/demos/selectdialog
+@V@/itcl/iwidgets3.0.0/generic/selectionbox.itk @V@/itcl/iwidgets3.0-0/generic/selectbox.itk
+@V@/itcl/iwidgets3.0.0/generic/selectiondialog.itk @V@/itcl/iwidgets3.0-0/generic/selectdialog.itk
+@V@/itcl/iwidgets3.0.0/doc/selectionbox.n @V@/itcl/iwidgets3.0-0/doc/selectbox.n
+@V@/itcl/iwidgets3.0.0/doc/selectiondialog.n @V@/itcl/iwidgets3.0-0/doc/selectdialog.n
+@V@/itcl/iwidgets3.0.0/tests/selectionbox.test @V@/itcl/iwidgets3.0-0/tests/selectbox.test
+@V@/itcl/iwidgets3.0.0/tests/selectiondialog.test @V@/itcl/iwidgets3.0-0/tests/selectdialog.test
+@V@/dejagnu/baseboards/sparclite-coff.exp @V@/dejagnu/baseboards/sl-coff.exp
+@V@/dejagnu/baseboards/sparclite-cygmon.exp @V@/dejagnu/baseboards/sl-cygmon.exp
+@V@/dejagnu/baseboards/sparclite-sim-le.exp @V@/dejagnu/baseboards/sl-sim-le.exp
+@V@/dejagnu/baseboards/sparclite-sim.exp @V@/dejagnu/baseboards/sl-sim.exp
+@V@/tcl/unix/tclLoadAix.c @V@/tcl/unix/tclLdAix.c
+@V@/tcl/unix/tclLoadAout.c @V@/tcl/unix/tclLdAout.c
+@V@/tcl/unix/tclLoadDl.c @V@/tcl/unix/tclLdDl.c
+@V@/tcl/unix/tclLoadDld.c @V@/tcl/unix/tclLdDld.c
+@V@/tcl/mac/tclMacBOAAppInit.c @V@/tcl/mac/tclBOAAppInit.c
+@V@/tcl/mac/tclMacBOAMain.c @V@/tcl/mac/tclBOAMain.c
+@V@/tcl/mac/tclMacInit.c @V@/tcl/mac/tclInit.c
+@V@/tcl/mac/tclMacInterupt.c @V@/tcl/mac/tclInterupt.c
+@V@/tcl/unix/tclUnixFCmd.c @V@/tcl/unix/tclFCmd.c
+@V@/tcl/unix/tclUnixFile.c @V@/tcl/unix/tclFile.c
+@V@/tcl/unix/tclUnixTest.c @V@/tcl/unix/tclTest.c
+@V@/tcl/unix/tclUnixTime.c @V@/tcl/unix/tclTime.c
+@V@/tix/win/tkConsole41.c @V@/tix/win/tkCon41.c
+@V@/tix/win/tkConsole42.c @V@/tix/win/tkCon42.c
+@V@/tix/win/tkConsole80a1.c @V@/tix/win/tkCon80a1.c
+@V@/tix/win/tkConsole80b1.c @V@/tix/win/tkCon80b1.c
+@V@/tix/win/tkConsole81.c @V@/tix/win/tkCon81.c
+@V@/tk/mac/tkMacMenu.c @V@/tk/mac/tkMenu.c
+@V@/tk/mac/tkMacMenubutton.c @V@/tk/mac/tkMenubutton.c
+@V@/tk/mac/tkMacMenus.c @V@/tk/mac/tkMenus.c
+@V@/libgui/src/tkTableCell.c @V@/libgui/src/tkTabCell.c
+@V@/libgui/src/tkTableCmd.c @V@/libgui/src/tkTabCmd.c
+@V@/tk/unix/tkUnixFocus.c @V@/tk/unix/tkFocus.c
+@V@/tk/unix/tkUnixFont.c @V@/tk/unix/tkFont.c
+@V@/tk/unix/tkUnixMenu.c @V@/tk/unix/tkMenu.c
+@V@/tk/unix/tkUnixMenubu.c @V@/tk/unix/tkMenubu.c
+@V@/tk/unix/tkUnixScale.c @V@/tk/unix/tkScale.c
+@V@/tk/unix/tkUnixScrlbr.c @V@/tk/unix/tkScrlbr.c
+@V@/tk/unix/tkUnixSelect.c @V@/tk/unix/tkSelect.c
+@V@/tk/unix/tkUnixSend.c @V@/tk/unix/tkSend.c
+@V@/libgui/src/tkWinPrintCanvas.c @V@/libgui/src/tkWPrtCanvas.c
+@V@/libgui/src/tkWinPrintText.c @V@/libgui/src/tkWPrtText.c
diff --git a/gdb/config/h8300/tm-h8300.h b/gdb/config/h8300/tm-h8300.h
index 27a79d7..1223373 100644
--- a/gdb/config/h8300/tm-h8300.h
+++ b/gdb/config/h8300/tm-h8300.h
@@ -1,5 +1,5 @@
 /* Parameters for execution on a H8/300 series machine.
-   Copyright 1992, 1993 Free Software Foundation, Inc.
+   Copyright 1992, 1993, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -25,7 +25,12 @@
 struct value;
 struct type;
 
-/* 1 if debugging H8/300H application */
+/* 1 if debugging H8/300H application */ 
+
+/* NOTE: ezannoni 2000-07-18: these variables are part of sim, defined
+   in sim/h8300/compile.c.  They really should not be used this
+   way. Because of this we cannot get rid of the macro
+   GDB_TARGET_IS_H8300 in remote-e7000.c */
 extern int h8300hmode;
 extern int h8300smode;
 
diff --git a/gdb/config/i386/cygwin.mh b/gdb/config/i386/cygwin.mh
index d93acb6..454f489 100644
--- a/gdb/config/i386/cygwin.mh
+++ b/gdb/config/i386/cygwin.mh
@@ -1,6 +1,6 @@
 MH_CFLAGS=
 XM_FILE=xm-cygwin.h
-XDEPFILES=ser-tcp.o
-NATDEPFILES= win32-nat.o
-NAT_FILE=../nm-empty.h
+XDEPFILES=
+NATDEPFILES= win32-nat.o corelow.o
+NAT_FILE=../none/nm-none.h
 XM_CLIBS=
diff --git a/gdb/config/i386/embed.mt b/gdb/config/i386/embed.mt
index e717974..d301453 100644
--- a/gdb/config/i386/embed.mt
+++ b/gdb/config/i386/embed.mt
@@ -1,3 +1,3 @@
 # Target: Embedded Intel 386 
 TDEPFILES= i386-tdep.o i387-tdep.o
-TM_FILE= tm-i386v.h
+TM_FILE= tm-embed.h
diff --git a/gdb/config/i386/fbsd.mh b/gdb/config/i386/fbsd.mh
index 243d0a6..f2a01fa 100644
--- a/gdb/config/i386/fbsd.mh
+++ b/gdb/config/i386/fbsd.mh
@@ -1,6 +1,6 @@
 # Host: Intel 386 running FreeBSD
-XDEPFILES= ser-tcp.o
-NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o \
-	corelow.o core-aout.o core-regset.o i387-nat.o i386bsd-nat.o
+XDEPFILES=
+# NOTE: Do not spread NATDEPFILES over several lines - it hurts BSD make.
+NATDEPFILES= fork-child.o infptrace.o inftarg.o solib.o solib-svr4.o corelow.o core-aout.o core-regset.o i387-nat.o i386bsd-nat.o
 XM_FILE= xm-fbsd.h
 NAT_FILE= nm-fbsd.h
diff --git a/gdb/config/i386/go32.mh b/gdb/config/i386/go32.mh
index d4fa352..ce6c532 100644
--- a/gdb/config/i386/go32.mh
+++ b/gdb/config/i386/go32.mh
@@ -12,7 +12,6 @@
 
 TERMCAP= 
 HOST_IPC=
-SER_HARDWIRE= ser-go32.o
 CC= gcc
 XM_CLIBS= -ldbg
 
diff --git a/gdb/config/i386/i386dgux.mh b/gdb/config/i386/i386dgux.mh
index ab8eab2..ca74480 100644
--- a/gdb/config/i386/i386dgux.mh
+++ b/gdb/config/i386/i386dgux.mh
@@ -1,10 +1,10 @@
 # Host: Intel 386 running DGUX, cloned from SVR4
 
 XM_FILE= xm-i386v4.h
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 # for network communication
 XM_CLIBS= -lsocket -lnsl
 
 NAT_FILE= nm-i386v4.h
-NATDEPFILES= corelow.o core-regset.o solib.o fork-child.o i386v4-nat.o \
+NATDEPFILES= corelow.o core-regset.o solib.o solib-svr4.o fork-child.o i386v4-nat.o \
 	procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o
diff --git a/gdb/config/i386/i386gnu.mh b/gdb/config/i386/i386gnu.mh
index 9997264..e871eff 100644
--- a/gdb/config/i386/i386gnu.mh
+++ b/gdb/config/i386/i386gnu.mh
@@ -1,6 +1,6 @@
 # Host: Intel 386 running the GNU Hurd
 XDEPFILES= i387-tdep.o
-NATDEPFILES= i386gnu-nat.o gnu-nat.o fork-child.o solib.o corelow.o notify_S.o process_reply_S.o msg_reply_S.o msg_U.o exc_request_U.o exc_request_S.o
+NATDEPFILES= i386gnu-nat.o gnu-nat.o fork-child.o solib.o solib-svr4.o corelow.o notify_S.o process_reply_S.o msg_reply_S.o msg_U.o exc_request_U.o exc_request_S.o
 XM_FILE= xm-i386gnu.h
 NAT_FILE= nm-gnu.h
 MH_CFLAGS = -D_GNU_SOURCE
diff --git a/gdb/config/i386/i386lynx.mh b/gdb/config/i386/i386lynx.mh
index 9cb086f..6fe9d95 100644
--- a/gdb/config/i386/i386lynx.mh
+++ b/gdb/config/i386/i386lynx.mh
@@ -2,7 +2,7 @@
 
 XM_FILE= xm-i386lynx.h
 XM_CLIBS= -lbsd
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 
 NAT_FILE= nm-i386lynx.h
 NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o lynx-nat.o
diff --git a/gdb/config/i386/i386sco5.mh b/gdb/config/i386/i386sco5.mh
index 3bea87a..d53a2df 100644
--- a/gdb/config/i386/i386sco5.mh
+++ b/gdb/config/i386/i386sco5.mh
@@ -8,10 +8,10 @@
 # runtime, but all come with the development system, so we always
 # have socket(), gethostbyname(), and friends.
 #
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 XM_CLIBS= -lPW -lsocket
 
 NAT_FILE= nm-i386sco5.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o corefile.o core-aout.o \
-	corelow.o i386v-nat.o solib.o
+	corelow.o i386v-nat.o solib.o solib-svr4.o
 
diff --git a/gdb/config/i386/i386sol2.mh b/gdb/config/i386/i386sol2.mh
index f080429..1b8169d 100644
--- a/gdb/config/i386/i386sol2.mh
+++ b/gdb/config/i386/i386sol2.mh
@@ -2,6 +2,7 @@
 
 XM_FILE= xm-i386v4.h
 XDEPFILES= 
+XM_CLIBS= -lsocket -lnsl
 
 NAT_FILE= nm-i386sol2.h
 NATDEPFILES= core-regset.o fork-child.o i386v4-nat.o corelow.o procfs.o \
diff --git a/gdb/config/i386/i386sol2.mt b/gdb/config/i386/i386sol2.mt
index 80b576f..0c4524e 100644
--- a/gdb/config/i386/i386sol2.mt
+++ b/gdb/config/i386/i386sol2.mt
@@ -1,3 +1,3 @@
 # Target: Intel 386 running SVR4
-TDEPFILES= i386-tdep.o i387-tdep.o solib.o
+TDEPFILES= i386-tdep.o i387-tdep.o solib.o solib-svr4.o
 TM_FILE= tm-i386sol2.h
diff --git a/gdb/config/i386/i386v4.mh b/gdb/config/i386/i386v4.mh
index 191b492..b203a23 100644
--- a/gdb/config/i386/i386v4.mh
+++ b/gdb/config/i386/i386v4.mh
@@ -6,5 +6,5 @@
 XM_CLIBS= -lsocket -lnsl
 
 NAT_FILE= nm-i386v4.h
-NATDEPFILES= corelow.o core-regset.o solib.o fork-child.o i386v4-nat.o \
+NATDEPFILES= corelow.o core-regset.o solib.o solib-svr4.o fork-child.o i386v4-nat.o \
 	procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o
diff --git a/gdb/config/i386/i386v42mp.mh b/gdb/config/i386/i386v42mp.mh
index 185b5f0..b696f2f 100644
--- a/gdb/config/i386/i386v42mp.mh
+++ b/gdb/config/i386/i386v42mp.mh
@@ -8,6 +8,6 @@
 # we don't want nm-i386v4.h since that defines LOSING_POLL which isn't
 # appropriate for i386v42mp
 NAT_FILE= nm-i386v42mp.h
-NATDEPFILES= corelow.o core-regset.o solib.o fork-child.o i386v4-nat.o \
+NATDEPFILES= corelow.o core-regset.o solib.o solib-svr4.o fork-child.o i386v4-nat.o \
 	procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o uw-thread.o
 
diff --git a/gdb/config/i386/linux.mh b/gdb/config/i386/linux.mh
index febed9a..9b329be 100644
--- a/gdb/config/i386/linux.mh
+++ b/gdb/config/i386/linux.mh
@@ -1,10 +1,11 @@
 # Host: Intel 386 running GNU/Linux
 
 XM_FILE= xm-linux.h
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 
 NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \
-	core-aout.o i386v-nat.o i386-linux-nat.o linux-thread.o lin-thread.o
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
+	core-aout.o i386v-nat.o i386-linux-nat.o i387-nat.o \
+	proc-service.o thread-db.o lin-lwp.o
 
 LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/i386/linux.mt b/gdb/config/i386/linux.mt
index df17b18..1721827 100644
--- a/gdb/config/i386/linux.mt
+++ b/gdb/config/i386/linux.mt
@@ -1,5 +1,5 @@
 # Target: Intel 386 running GNU/Linux
-TDEPFILES= i386-tdep.o i386-linux-tdep.o i387-tdep.o
+TDEPFILES= i386-tdep.o i386-linux-tdep.o i387-tdep.o solib.o solib-svr4.o 
 TM_FILE= tm-linux.h
 
 GDBSERVER_DEPFILES= low-linux.o
diff --git a/gdb/config/i386/nbsd.mh b/gdb/config/i386/nbsd.mh
index aea6a77..78fed46 100644
--- a/gdb/config/i386/nbsd.mh
+++ b/gdb/config/i386/nbsd.mh
@@ -1,6 +1,5 @@
 # Host: Intel 386 running NetBSD
-XDEPFILES= ser-tcp.o
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o \
-	i386nbsd-nat.o solib.o
+XDEPFILES=
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o
 XM_FILE= xm-nbsd.h
 NAT_FILE= nm-nbsd.h
diff --git a/gdb/config/i386/nbsd.mt b/gdb/config/i386/nbsd.mt
index 7564b73..4fa592c 100644
--- a/gdb/config/i386/nbsd.mt
+++ b/gdb/config/i386/nbsd.mt
@@ -1,5 +1,5 @@
 # Target: Intel 386 running NetBSD
-TDEPFILES= i386-tdep.o i387-tdep.o
+TDEPFILES= i386-tdep.o i387-tdep.o i386nbsd-tdep.o solib.o solib-svr4.o
 TM_FILE= tm-nbsd.h
 
 GDBSERVER_DEPFILES= low-nbsd.o
diff --git a/gdb/config/i386/nbsdelf.mh b/gdb/config/i386/nbsdelf.mh
index 4c19754..993be01 100644
--- a/gdb/config/i386/nbsdelf.mh
+++ b/gdb/config/i386/nbsdelf.mh
@@ -1,6 +1,5 @@
 # Host: Intel 386 running NetBSD
-XDEPFILES= ser-tcp.o
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o \
-	i386nbsd-nat.o solib.o
+XDEPFILES=
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o
 XM_FILE= xm-nbsd.h
 NAT_FILE= nm-nbsdelf.h
diff --git a/gdb/config/i386/nbsdelf.mt b/gdb/config/i386/nbsdelf.mt
index 2782173..e7bff44 100644
--- a/gdb/config/i386/nbsdelf.mt
+++ b/gdb/config/i386/nbsdelf.mt
@@ -1,5 +1,5 @@
 # Target: Intel 386 running NetBSD
-TDEPFILES= i386-tdep.o i387-tdep.o
+TDEPFILES= i386-tdep.o i387-tdep.o solib.o solib-svr4.o
 TM_FILE= tm-nbsdelf.h
 
 GDBSERVER_DEPFILES= low-nbsd.o
diff --git a/gdb/config/i386/ncr3000.mt b/gdb/config/i386/ncr3000.mt
index 0bbf9b3..6ebefc5 100644
--- a/gdb/config/i386/ncr3000.mt
+++ b/gdb/config/i386/ncr3000.mt
@@ -1,3 +1,3 @@
 # Target: Intel 386 running SVR4
-TDEPFILES= i386-tdep.o i387-tdep.o solib.o
+TDEPFILES= i386-tdep.o i387-tdep.o solib.o solib-svr4.o
 TM_FILE= tm-i386v4.h
diff --git a/gdb/config/i386/nm-linux.h b/gdb/config/i386/nm-linux.h
index f95c6fe..c6bd54d 100644
--- a/gdb/config/i386/nm-linux.h
+++ b/gdb/config/i386/nm-linux.h
@@ -1,5 +1,5 @@
-/* Native support for GNU/Linux, for GDB, the GNU debugger.
-   Copyright (C) 1986, 1987, 1989, 1992, 1996, 1998, 2000
+/* Native support for Linux/x86.
+   Copyright 1986, 1987, 1989, 1992, 1996, 1998, 2000
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -65,12 +65,14 @@
 /* Override copies of {fetch,store}_inferior_registers in `infptrace.c'.  */
 #define FETCH_INFERIOR_REGISTERS
 
-/* Nevertheless, define CANNOT_{FETCH,STORE}_REGISTER, because we fall
+/* Nevertheless, define CANNOT_{FETCH,STORE}_REGISTER, because we might fall
    back on the code `infptrace.c' (well a copy of that code in
    `i386-linux-nat.c' for now) and we can access only the
    general-purpose registers in that way.  */
-#define CANNOT_FETCH_REGISTER(regno) ((regno) >= NUM_GREGS)
-#define CANNOT_STORE_REGISTER(regno) CANNOT_FETCH_REGISTER (regno)
+extern int cannot_fetch_register (int regno);
+extern int cannot_store_register (int regno);
+#define CANNOT_FETCH_REGISTER(regno) cannot_store_register (regno)
+#define CANNOT_STORE_REGISTER(regno) cannot_fetch_register (regno)
 
 /* Override child_resume in `infptrace.c'.  */
 #define CHILD_RESUME
@@ -79,4 +81,20 @@
 extern int i386_insert_watchpoint (int pid, CORE_ADDR addr, int len, int rw);
 extern int i386_remove_watchpoint (int pid, CORE_ADDR addr, int len);
 
-#endif /* #ifndef NM_LINUX_H */
+/* FIXME: kettenis/2000-09-03: This should be moved to ../nm-linux.h
+   once we have converted all Linux targets to use the new threads
+   stuff (without the #undef of course).  */
+
+extern int lin_lwp_prepare_to_proceed (void);
+#undef PREPARE_TO_PROCEED
+#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
+
+extern void lin_lwp_attach_lwp (int pid, int verbose);
+#define ATTACH_LWP(pid, verbose) lin_lwp_attach_lwp ((pid), (verbose))
+
+#include <signal.h>
+
+extern void lin_thread_get_thread_signals (sigset_t *mask);
+#define GET_THREAD_SIGNALS(mask) lin_thread_get_thread_signals (mask)
+
+#endif /* nm_linux.h */
diff --git a/gdb/config/i386/ptx4.mh b/gdb/config/i386/ptx4.mh
index 7b9d11b..ba951f0 100644
--- a/gdb/config/i386/ptx4.mh
+++ b/gdb/config/i386/ptx4.mh
@@ -1,7 +1,7 @@
 # Host: Sequent Symmetry running ptx 1.3, with Weitek 1167 or i387
 
 XM_FILE= xm-ptx4.h
-XDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o core-aout.o solib.o core-regset.o
+XDEPFILES= inftarg.o fork-child.o symm-nat.o corelow.o core-aout.o solib.o solib-svr4.o core-regset.o
 XM_CLIBS= -lseq
 
 NAT_FILE= nm-ptx4.h
diff --git a/gdb/config/i386/sun386.mt b/gdb/config/i386/sun386.mt
index 665ca64..152a4a3 100644
--- a/gdb/config/i386/sun386.mt
+++ b/gdb/config/i386/sun386.mt
@@ -1,3 +1,3 @@
 # Target: Sun 386i target configuration file.
-TDEPFILES= i386-tdep.o solib.o
+TDEPFILES= i386-tdep.o solib.o solib-svr4.o
 TM_FILE= tm-sun386.h
diff --git a/gdb/config/i386/tm-cygwin.h b/gdb/config/i386/tm-cygwin.h
index 5ae97bb..1c6046a 100644
--- a/gdb/config/i386/tm-cygwin.h
+++ b/gdb/config/i386/tm-cygwin.h
@@ -30,14 +30,15 @@
 extern CORE_ADDR skip_trampoline_code (CORE_ADDR pc, char *name);
 #endif
 
+#define ATTACH_NO_WAIT
 #define SOLIB_ADD(filename, from_tty, targ) child_solib_add(filename, from_tty, targ)
 #define SOLIB_LOADED_LIBRARY_PATHNAME(pid) child_solib_loaded_library_pathname(pid)
-#define CLEAR_SOLIB child_clear_solib
+#define CLEAR_SOLIB child_clear_solibs
 #define ADD_SHARED_SYMBOL_FILES dll_symbol_command
 
 struct target_ops;
 char *cygwin_pid_to_str (int pid);
 void child_solib_add (char *, int, struct target_ops *);
 char *child_solib_loaded_library_pathname(int);
-void child_clear_solib (void);
+void child_clear_solibs (void);
 void dll_symbol_command (char *, int);
diff --git a/gdb/config/i386/tm-embed.h b/gdb/config/i386/tm-embed.h
new file mode 100644
index 0000000..6d29e0e
--- /dev/null
+++ b/gdb/config/i386/tm-embed.h
@@ -0,0 +1,26 @@
+/* Macro definitions for i386 running as an embedded target
+   (i386-*-aout, i386-*-elf, i386-*-coff)
+   Copyright 2000 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.  */
+
+
+/* Most of the rest can be assumed as similar to a SYSV target */
+
+#include "i386/tm-i386v.h"
+
diff --git a/gdb/config/i386/tm-i386.h b/gdb/config/i386/tm-i386.h
index 918d62a..fc89c3a 100644
--- a/gdb/config/i386/tm-i386.h
+++ b/gdb/config/i386/tm-i386.h
@@ -21,9 +21,10 @@
 #ifndef TM_I386_H
 #define TM_I386_H 1
 
-/* Forward decl's for prototypes */
+/* Forward declarations for prototypes.  */
 struct frame_info;
 struct frame_saved_regs;
+struct value;
 struct type;
 
 #define TARGET_BYTE_ORDER LITTLE_ENDIAN
@@ -68,7 +69,8 @@
    through the frames for this because on some machines the new frame is not
    set up until the new function executes some instructions.  */
 
-#define SAVED_PC_AFTER_CALL(frame) (read_memory_integer (read_register (SP_REGNUM), 4))
+#define SAVED_PC_AFTER_CALL(frame) \
+     (read_memory_unsigned_integer (read_register (SP_REGNUM), 4))
 
 /* Stack grows downward.  */
 
@@ -294,17 +296,11 @@
 extern void i386_extract_return_value (struct type *type, char *regbuf,
 				       char *valbuf);
 
-/* Write into appropriate registers a function return value of type TYPE, given
-   in virtual format.  */
-
-#define STORE_RETURN_VALUE(TYPE,VALBUF) \
-  {    	       	       	       	       	       	       	       	       	     \
-    if (TYPE_CODE (TYPE) == TYPE_CODE_FLT)				     \
-      write_register_bytes (REGISTER_BYTE (FP0_REGNUM), (VALBUF),	     \
-			    TYPE_LENGTH (TYPE));			     \
-    else								     \
-      write_register_bytes (0, (VALBUF), TYPE_LENGTH (TYPE));  		     \
-  }
+/* Write into the appropriate registers a function return value stored
+   in VALBUF of type TYPE, given in virtual format.  */
+#define STORE_RETURN_VALUE(type, valbuf) \
+  i386_store_return_value ((type), (valbuf))
+extern void i386_store_return_value (struct type *type, char *valbuf);
 
 /* 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
@@ -326,7 +322,7 @@
   ((thisframe)->signal_handler_caller \
    ? (thisframe)->frame \
    : (!inside_entry_file ((thisframe)->pc) \
-      ? read_memory_integer ((thisframe)->frame, 4) \
+      ? read_memory_unsigned_integer ((thisframe)->frame, 4) \
       : 0))
 
 /* A macro that tells us whether the function invocation represented
@@ -341,7 +337,7 @@
 #define FRAME_SAVED_PC(FRAME) \
   (((FRAME)->signal_handler_caller \
     ? sigtramp_saved_pc (FRAME) \
-    : read_memory_integer ((FRAME)->frame + 4, 4)) \
+    : read_memory_unsigned_integer ((FRAME)->frame + 4, 4)) \
    )
 
 extern CORE_ADDR sigtramp_saved_pc (struct frame_info *);
@@ -408,19 +404,13 @@
 /* Insert the specified number of args and function address
    into a call sequence of the above form stored at DUMMYNAME.  */
 
-#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p)   \
-{ \
-	int from, to, delta, loc; \
-	loc = (int)(read_register (SP_REGNUM) - CALL_DUMMY_LENGTH); \
-	from = loc + 5; \
-	to = (int)(fun); \
-	delta = to - from; \
-	*((char *)(dummyname) + 1) = (delta & 0xff); \
-	*((char *)(dummyname) + 2) = ((delta >> 8) & 0xff); \
-	*((char *)(dummyname) + 3) = ((delta >> 16) & 0xff); \
-	*((char *)(dummyname) + 4) = ((delta >> 24) & 0xff); \
-}
+#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
+  i386_fix_call_dummy (dummyname, pc, fun, nargs, args, type, gcc_p)
+extern void i386_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
+				 int nargs, struct value **args,
+				 struct type *type, int gcc_p);
 
+/* FIXME: kettenis/2000-06-12: These do not belong here.  */
 extern void print_387_control_word (unsigned int);
 extern void print_387_status_word (unsigned int);
 
diff --git a/gdb/config/i386/tm-linux.h b/gdb/config/i386/tm-linux.h
index d6a4616..a707a03 100644
--- a/gdb/config/i386/tm-linux.h
+++ b/gdb/config/i386/tm-linux.h
@@ -1,5 +1,5 @@
 /* Definitions to target GDB to GNU/Linux on 386.
-   Copyright 1992, 1993 Free Software Foundation, Inc.
+   Copyright 1992, 1993, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -23,13 +23,17 @@
 
 #define I386_GNULINUX_TARGET
 #define HAVE_I387_REGS
-#ifdef HAVE_PTRACE_GETXFPREGS
+#ifdef HAVE_PTRACE_GETFPXREGS
 #define HAVE_SSE_REGS
 #endif
 
 #include "i386/tm-i386.h"
 #include "tm-linux.h"
 
+/* Use target_specific function to define link map offsets.  */
+extern struct link_map_offsets *i386_linux_svr4_fetch_link_map_offsets (void);
+#define SVR4_FETCH_LINK_MAP_OFFSETS() i386_linux_svr4_fetch_link_map_offsets ()
+
 /* FIXME: kettenis/2000-03-26: We should get rid of this last piece of
    Linux-specific `long double'-support code, probably by adding code
    to valprint.c:print_floating() to recognize various extended
@@ -136,5 +140,22 @@
 /* N_FUN symbols in shared libaries have 0 for their values and need
    to be relocated. */
 #define SOFUN_ADDRESS_MAYBE_MISSING
+
+
+/* Support for longjmp.  */
+
+/* Details about jmp_buf.  It's supposed to be an array of integers.  */
+
+#define JB_ELEMENT_SIZE 4	/* Size of elements in jmp_buf.  */
+#define JB_PC		5	/* Array index of saved PC.  */
+
+/* Figure out where the longjmp will land.  Slurp the args out of the
+   stack.  We expect the first arg to be a pointer to the jmp_buf
+   structure from which we extract the pc (JB_PC) that we will land
+   at.  The pc is copied into ADDR.  This routine returns true on
+   success.  */
+
+#define GET_LONGJMP_TARGET(addr) get_longjmp_target (addr)
+extern int get_longjmp_target (CORE_ADDR *addr);
 
 #endif /* #ifndef TM_LINUX_H */
diff --git a/gdb/config/ia64/linux.mh b/gdb/config/ia64/linux.mh
index e2edafe..5f10b09 100644
--- a/gdb/config/ia64/linux.mh
+++ b/gdb/config/ia64/linux.mh
@@ -1,10 +1,10 @@
 # Host: Intel IA-64 running GNU/Linux
 
 XM_FILE= xm-linux.h
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 
 NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
 	core-aout.o core-regset.o ia64-linux-nat.o linux-thread.o lin-thread.o
 
 LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/ia64/linux.mt b/gdb/config/ia64/linux.mt
index 8e5b910..441055d 100644
--- a/gdb/config/ia64/linux.mt
+++ b/gdb/config/ia64/linux.mt
@@ -1,5 +1,5 @@
 # Target: Intel IA-64 running GNU/Linux
-TDEPFILES= ia64-tdep.o ia64-linux-tdep.o
+TDEPFILES= ia64-tdep.o ia64-linux-tdep.o solib.o solib-svr4.o 
 TM_FILE= tm-linux.h
 
 GDBSERVER_DEPFILES= low-linux.o
diff --git a/gdb/config/ia64/nm-linux.h b/gdb/config/ia64/nm-linux.h
index 9077725..4422d1d 100644
--- a/gdb/config/ia64/nm-linux.h
+++ b/gdb/config/ia64/nm-linux.h
@@ -41,6 +41,8 @@
 extern int ia64_register_u_addr(int, int);
 #endif /* GDBSERVER */
 
+#define U_REGS_OFFSET 0
+
 #define PTRACE_ARG3_TYPE long
 #define PTRACE_XFER_TYPE long
 
diff --git a/gdb/config/m68hc11/m68hc11.mt b/gdb/config/m68hc11/m68hc11.mt
new file mode 100644
index 0000000..5e25eee
--- /dev/null
+++ b/gdb/config/m68hc11/m68hc11.mt
@@ -0,0 +1,6 @@
+# Target: Motorola 68HC11 processor
+TDEPFILES= m68hc11-tdep.o
+TM_FILE= tm-m68hc11.h
+SIM_OBS= remote-sim.o
+SIM= ../sim/m68hc11/libsim.a -lm
+
diff --git a/gdb/config/m68k/linux.mh b/gdb/config/m68k/linux.mh
index 510248d..20c1330 100644
--- a/gdb/config/m68k/linux.mh
+++ b/gdb/config/m68k/linux.mh
@@ -1,10 +1,10 @@
 # Host: Motorola m68k running Linux
 
 XM_FILE= xm-linux.h
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 
 NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o \
+NATDEPFILES= infptrace.o inftarg.o fork-child.o \
 	corelow.o core-aout.o core-regset.o m68klinux-nat.o linux-thread.o
 
 GDBSERVER_DEPFILES= low-linux.o
diff --git a/gdb/config/m68k/linux.mt b/gdb/config/m68k/linux.mt
index 0c0a149..6c4abff 100644
--- a/gdb/config/m68k/linux.mt
+++ b/gdb/config/m68k/linux.mt
@@ -1,3 +1,3 @@
 # Target: Motorola m68k with a.out and ELF
-TDEPFILES= m68k-tdep.o
+TDEPFILES= m68k-tdep.o solib.o solib-svr4.o 
 TM_FILE= tm-linux.h
diff --git a/gdb/config/m68k/m68klynx.mh b/gdb/config/m68k/m68klynx.mh
index 48fdf29..ee0800c 100644
--- a/gdb/config/m68k/m68klynx.mh
+++ b/gdb/config/m68k/m68klynx.mh
@@ -2,7 +2,7 @@
 
 XM_FILE= xm-m68klynx.h
 XM_CLIBS= -lbsd
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 
 NAT_FILE= nm-m68klynx.h
 NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o lynx-nat.o
diff --git a/gdb/config/m68k/m68kv4.mh b/gdb/config/m68k/m68kv4.mh
index 714f415..08171ab 100644
--- a/gdb/config/m68k/m68kv4.mh
+++ b/gdb/config/m68k/m68kv4.mh
@@ -4,5 +4,5 @@
 XDEPFILES=
 
 NAT_FILE= nm-sysv4.h
-NATDEPFILES= corelow.o core-regset.o solib.o fork-child.o procfs.o \
+NATDEPFILES= corelow.o core-regset.o solib.o solib-svr4.o fork-child.o procfs.o \
 	proc-api.o proc-events.o proc-flags.o proc-why.o
diff --git a/gdb/config/m68k/nbsd.mh b/gdb/config/m68k/nbsd.mh
index 2d11709..0815d71 100644
--- a/gdb/config/m68k/nbsd.mh
+++ b/gdb/config/m68k/nbsd.mh
@@ -1,6 +1,5 @@
 # Host: Motorola m68k running NetBSD
-XDEPFILES= ser-tcp.o
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
-	m68knbsd-nat.o solib.o
+XDEPFILES=
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o m68knbsd-nat.o
 XM_FILE= xm-nbsd.h
 NAT_FILE= nm-nbsd.h
diff --git a/gdb/config/m68k/nbsd.mt b/gdb/config/m68k/nbsd.mt
index ab0deaa..ce5e4ee 100644
--- a/gdb/config/m68k/nbsd.mt
+++ b/gdb/config/m68k/nbsd.mt
@@ -1,3 +1,5 @@
 # Target: Motorola m68k running NetBSD
-TDEPFILES= m68k-tdep.o
+TDEPFILES= m68k-tdep.o solib.o solib-svr4.o
 TM_FILE= tm-nbsd.h
+
+GDBSERVER_DEPFILES= low-nbsd.o
diff --git a/gdb/config/m68k/sun2os4.mt b/gdb/config/m68k/sun2os4.mt
index d0c56fe..20211a3 100644
--- a/gdb/config/m68k/sun2os4.mt
+++ b/gdb/config/m68k/sun2os4.mt
@@ -1,3 +1,3 @@
 # Target: Sun 2, running SunOS 4
-TDEPFILES= solib.o m68k-tdep.o
+TDEPFILES= solib.o solib-svr4.o m68k-tdep.o
 TM_FILE= tm-sun2os4.h
diff --git a/gdb/config/m68k/sun3os4.mt b/gdb/config/m68k/sun3os4.mt
index dbc265f..248b8ad 100644
--- a/gdb/config/m68k/sun3os4.mt
+++ b/gdb/config/m68k/sun3os4.mt
@@ -1,3 +1,3 @@
 # Target: Sun 3, running SunOS 4, as a target system
-TDEPFILES= solib.o m68k-tdep.o
+TDEPFILES= solib.o solib-svr4.o m68k-tdep.o
 TM_FILE= tm-sun3os4.h
diff --git a/gdb/config/m68k/tm-altos.h b/gdb/config/m68k/tm-altos.h
index 26a0302..7c14009 100644
--- a/gdb/config/m68k/tm-altos.h
+++ b/gdb/config/m68k/tm-altos.h
Binary files differ
diff --git a/gdb/config/m68k/tm-cisco.h b/gdb/config/m68k/tm-cisco.h
index e27432d..80eee53b7 100644
--- a/gdb/config/m68k/tm-cisco.h
+++ b/gdb/config/m68k/tm-cisco.h
@@ -47,8 +47,7 @@
    we extract the pc (JB_PC) that we will land at.  The pc is copied into ADDR.
    This routine returns true on success */
 
-#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
-extern int get_longjmp_target (CORE_ADDR *);
+#define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR)
 
 /* BFD handles finding the registers in the core file, so they are at
    the start of the BFD .reg section.  */
diff --git a/gdb/config/m68k/tm-es1800.h b/gdb/config/m68k/tm-es1800.h
index b6f1588..602e73b 100644
--- a/gdb/config/m68k/tm-es1800.h
+++ b/gdb/config/m68k/tm-es1800.h
@@ -56,5 +56,4 @@
    we extract the pc (JB_PC) that we will land at.  The pc is copied into ADDR.
    This routine returns true on success */
 
-#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
-extern int get_longjmp_target (CORE_ADDR *);
+#define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR)
diff --git a/gdb/config/m68k/tm-linux.h b/gdb/config/m68k/tm-linux.h
index 1d47d46..fbb30a7 100644
--- a/gdb/config/m68k/tm-linux.h
+++ b/gdb/config/m68k/tm-linux.h
@@ -93,7 +93,7 @@
    we extract the pc (JB_PC) that we will land at.  The pc is copied into ADDR.
    This routine returns true on success */
 
-#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
+#define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR)
 
 /* Offset to saved PC in sigcontext, from <asm/sigcontext.h>.  */
 #define SIGCONTEXT_PC_OFFSET 26
diff --git a/gdb/config/m68k/tm-m68k.h b/gdb/config/m68k/tm-m68k.h
index 38068c6..2623446 100644
--- a/gdb/config/m68k/tm-m68k.h
+++ b/gdb/config/m68k/tm-m68k.h
@@ -386,3 +386,10 @@
 #define SP_ARG0 (1 * 4)
 
 #define TARGET_M68K
+
+/* Figure out where the longjmp will land.  Slurp the args out of the stack.
+   We expect the first arg to be a pointer to the jmp_buf structure from which
+   we extract the pc (JB_PC) that we will land at.  The pc is copied into ADDR.
+   This routine returns true on success */
+
+extern int m68k_get_longjmp_target (CORE_ADDR *);
diff --git a/gdb/config/m68k/tm-m68kv4.h b/gdb/config/m68k/tm-m68kv4.h
index 8f6f15e..6763135 100644
--- a/gdb/config/m68k/tm-m68kv4.h
+++ b/gdb/config/m68k/tm-m68kv4.h
@@ -64,8 +64,7 @@
    we extract the pc (JB_PC) that we will land at.  The pc is copied into ADDR.
    This routine returns true on success */
 
-#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
-extern int get_longjmp_target (CORE_ADDR *);
+#define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR)
 
 /* Convert a DWARF register number to a gdb REGNUM.  */
 #define DWARF_REG_TO_REGNUM(num) ((num) < 16 ? (num) : (num)+FP0_REGNUM-16)
diff --git a/gdb/config/m68k/tm-sun3.h b/gdb/config/m68k/tm-sun3.h
index 0c8651a..0307852 100644
--- a/gdb/config/m68k/tm-sun3.h
+++ b/gdb/config/m68k/tm-sun3.h
@@ -74,8 +74,7 @@
    we extract the pc (JB_PC) that we will land at.  The pc is copied into ADDR.
    This routine returns true on success */
 
-#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
-extern int get_longjmp_target (CORE_ADDR *);
+#define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR)
 
 /* If sun3 pcc says that a parameter is a short, it's a short.  */
 #define BELIEVE_PCC_PROMOTION_TYPE
diff --git a/gdb/config/m68k/tm-vx68.h b/gdb/config/m68k/tm-vx68.h
index 9ce812d..53950f1 100644
--- a/gdb/config/m68k/tm-vx68.h
+++ b/gdb/config/m68k/tm-vx68.h
@@ -76,8 +76,7 @@
    we extract the pc (JB_PC) that we will land at.  The pc is copied into ADDR.
    This routine returns true on success */
 
-#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
-extern int get_longjmp_target (CORE_ADDR *);
+#define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR)
 
 /* Number of registers in a ptrace_getregs call. */
 
diff --git a/gdb/config/m88k/delta88v4.mh b/gdb/config/m88k/delta88v4.mh
index 5eec21a..a225c18 100644
--- a/gdb/config/m88k/delta88v4.mh
+++ b/gdb/config/m88k/delta88v4.mh
@@ -4,5 +4,5 @@
 XDEPFILES= 
 
 NAT_FILE= nm-delta88v4.h
-NATDEPFILES= fork-child.o m88k-nat.o corelow.o core-regset.o solib.o \
+NATDEPFILES= fork-child.o m88k-nat.o corelow.o core-regset.o solib.o solib-svr4.o \
 	procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o
diff --git a/gdb/config/mcore/tm-mcore.h b/gdb/config/mcore/tm-mcore.h
index 10aebec..b18738b 100644
--- a/gdb/config/mcore/tm-mcore.h
+++ b/gdb/config/mcore/tm-mcore.h
@@ -101,7 +101,7 @@
     mcore_extract_struct_value_address (REGBUF)
 
 extern CORE_ADDR mcore_skip_prologue (CORE_ADDR pc);
-#define SKIP_PROLOGUE(PC) (PC) = mcore_skip_prologue ((PC))
+#define SKIP_PROLOGUE(PC) mcore_skip_prologue (PC)
 
 #define FRAME_ARGS_SKIP 0
 extern CORE_ADDR mcore_frame_args_address (struct frame_info *fi);
diff --git a/gdb/config/mips/irix4.mh b/gdb/config/mips/irix4.mh
index ad61b66..c54b384 100644
--- a/gdb/config/mips/irix4.mh
+++ b/gdb/config/mips/irix4.mh
@@ -1,5 +1,5 @@
 # Host: SGI Iris running irix 4.x
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 XM_FILE= xm-irix4.h
 NAT_FILE= nm-irix4.h
 NATDEPFILES= fork-child.o irix4-nat.o corelow.o procfs.o \
diff --git a/gdb/config/mips/irix5.mh b/gdb/config/mips/irix5.mh
index 5413f41..0d94937 100644
--- a/gdb/config/mips/irix5.mh
+++ b/gdb/config/mips/irix5.mh
@@ -1,5 +1,5 @@
 # Host: SGI Iris running irix 5.x
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 XM_FILE= xm-irix5.h
 NAT_FILE= nm-irix5.h
 NATDEPFILES= fork-child.o irix5-nat.o corelow.o procfs.o \
diff --git a/gdb/config/mips/mipsv4.mh b/gdb/config/mips/mipsv4.mh
index ab8e239..61d0ce2 100644
--- a/gdb/config/mips/mipsv4.mh
+++ b/gdb/config/mips/mipsv4.mh
@@ -1,5 +1,5 @@
 # Host: Mips running SVR4
 XM_FILE= xm-mipsv4.h
 NAT_FILE= ../nm-sysv4.h
-NATDEPFILES= fork-child.o mipsv4-nat.o corelow.o core-regset.o solib.o \
+NATDEPFILES= fork-child.o mipsv4-nat.o corelow.o core-regset.o solib.o solib-svr4.o \
 	procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o
diff --git a/gdb/config/mips/tm-bigmips.h b/gdb/config/mips/tm-bigmips.h
index 7035b98..10c80e9 100644
--- a/gdb/config/mips/tm-bigmips.h
+++ b/gdb/config/mips/tm-bigmips.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1990 Free Software Foundation, Inc.
+/* Copyright (C) 1990, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,6 +17,4 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN
-
 #include "mips/tm-mips.h"
diff --git a/gdb/config/mips/tm-bigmips64.h b/gdb/config/mips/tm-bigmips64.h
index a456d20..9f171ee 100644
--- a/gdb/config/mips/tm-bigmips64.h
+++ b/gdb/config/mips/tm-bigmips64.h
@@ -1,5 +1,5 @@
 /* Target machine parameters for MIPS r4000
-   Copyright 1994 Free Software Foundation, Inc.
+   Copyright 1994, 2000 Free Software Foundation, Inc.
    Contributed by Ian Lance Taylor (ian@cygnus.com)
 
    This file is part of GDB.
@@ -19,6 +19,4 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN
-
 #include "mips/tm-mips64.h"
diff --git a/gdb/config/mips/tm-embed.h b/gdb/config/mips/tm-embed.h
index faaffee..fc67206 100644
--- a/gdb/config/mips/tm-embed.h
+++ b/gdb/config/mips/tm-embed.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,8 +17,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define TARGET_BYTE_ORDER_SELECTABLE_P 1
-
 #include "mips/tm-bigmips.h"
 
 #undef DEFAULT_MIPS_TYPE
diff --git a/gdb/config/mips/tm-embed64.h b/gdb/config/mips/tm-embed64.h
index d1467d0..006fb0b 100644
--- a/gdb/config/mips/tm-embed64.h
+++ b/gdb/config/mips/tm-embed64.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,6 +17,4 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define TARGET_BYTE_ORDER_SELECTABLE_P 1
-
 #include "mips/tm-bigmips64.h"
diff --git a/gdb/config/mips/tm-embedl.h b/gdb/config/mips/tm-embedl.h
index 416a7e3..5b3221d 100644
--- a/gdb/config/mips/tm-embedl.h
+++ b/gdb/config/mips/tm-embedl.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,6 +17,4 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define TARGET_BYTE_ORDER_SELECTABLE_P 1
-
 #include "mips/tm-mips.h"
diff --git a/gdb/config/mips/tm-embedl64.h b/gdb/config/mips/tm-embedl64.h
index 77e368d..a33b13c 100644
--- a/gdb/config/mips/tm-embedl64.h
+++ b/gdb/config/mips/tm-embedl64.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,6 +17,4 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define TARGET_BYTE_ORDER_SELECTABLE_P 1
-
 #include "mips/tm-mips64.h"
diff --git a/gdb/config/mips/tm-irix5.h b/gdb/config/mips/tm-irix5.h
index 19b8dbe..25bbae5 100644
--- a/gdb/config/mips/tm-irix5.h
+++ b/gdb/config/mips/tm-irix5.h
@@ -18,17 +18,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* If we're being built for n32, enable multi-arch. */
-/* FIXME: cagney/2000-04-04: Testing the _MIPS_SIM_NABI32 and
-   _MIPS_SIM in a tm-*.h file is simply wrong!  Those are
-   host-dependant macros (provided by /usr/include) and stop any
-   chance of the target being cross compiled */
-#if 0 && defined (_MIPS_SIM_NABI32) && _MIPS_SIM == _MIPS_SIM_NABI32
-/* FIXME: Don't enable multi-arch for IRIX/n32.  The test
-   ``gdb.base/corefile.exp: up in corefile.exp'' fails.  */
-#define GDB_MULTI_ARCH 1
-#endif
-
 #include "mips/tm-irix3.h"
 
 /* FIXME: cagney/2000-04-04: Testing the _MIPS_SIM_NABI32 and
diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h
index 9d07e87..9de7fba 100644
--- a/gdb/config/mips/tm-mips.h
+++ b/gdb/config/mips/tm-mips.h
@@ -24,6 +24,8 @@
 #ifndef TM_MIPS_H
 #define TM_MIPS_H 1
 
+#define GDB_MULTI_ARCH 1
+
 struct frame_info;
 struct symbol;
 struct type;
@@ -33,22 +35,10 @@
 #include "coff/sym.h"		/* Needed for PDR below.  */
 #include "coff/symconst.h"
 
-#if !defined (TARGET_BYTE_ORDER_DEFAULT)
-#define TARGET_BYTE_ORDER_DEFAULT LITTLE_ENDIAN
-#endif
-
-#if !defined (GDB_TARGET_IS_MIPS64)
-#define GDB_TARGET_IS_MIPS64 0
-#endif
-
 #if !defined (MIPS_EABI)
 #define MIPS_EABI 0
 #endif
 
-#if !defined (TARGET_MONITOR_PROMPT)
-#define TARGET_MONITOR_PROMPT "<IDT>"
-#endif
-
 /* PC should be masked to remove possible MIPS16 flag */
 #if !defined (GDB_TARGET_MASK_DISAS_PC)
 #define GDB_TARGET_MASK_DISAS_PC(addr) UNMAKE_MIPS16_ADDR(addr)
@@ -57,9 +47,6 @@
 #define GDB_TARGET_UNMASK_DISAS_PC(addr) MAKE_MIPS16_ADDR(addr)
 #endif
 
-/* Floating point is IEEE compliant */
-#define IEEE_FLOAT (1)
-
 /* The name of the usual type of MIPS processor that is in the target
    system.  */
 
@@ -79,50 +66,17 @@
 
 #define FUNCTION_START_OFFSET 0
 
-/* Advance PC across any function entry prologue instructions
-   to reach some "real" code.  */
-
-#define SKIP_PROLOGUE(pc) (mips_skip_prologue (pc, 0))
-extern CORE_ADDR mips_skip_prologue (CORE_ADDR addr, int lenient);
-
 /* Return non-zero if PC points to an instruction which will cause a step
    to execute both the instruction at PC and an instruction at PC+4.  */
 extern int mips_step_skips_delay (CORE_ADDR);
 #define STEP_SKIPS_DELAY_P (1)
 #define STEP_SKIPS_DELAY(pc) (mips_step_skips_delay (pc))
 
-/* Immediately after a function call, return the saved pc.
-   Can't always go through the frames for this because on some machines
-   the new frame is not set up until the new function executes
-   some instructions.  */
-
-#define SAVED_PC_AFTER_CALL(frame)	read_register(RA_REGNUM)
-
 /* Are we currently handling a signal */
 
 extern int in_sigtramp (CORE_ADDR, char *);
 #define IN_SIGTRAMP(pc, name)	in_sigtramp(pc, name)
 
-/* Stack grows downward.  */
-
-#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
-
-/* BREAKPOINT_FROM_PC uses the program counter value to determine whether a
-   16- or 32-bit breakpoint should be used.  It returns a pointer
-   to a string of bytes that encode a breakpoint instruction, stores
-   the length of the string to *lenptr, and adjusts the pc (if necessary) to
-   point to the actual memory location where the breakpoint should be
-   inserted.  */
-
-extern breakpoint_from_pc_fn mips_breakpoint_from_pc;
-#define BREAKPOINT_FROM_PC(pcptr, lenptr) mips_breakpoint_from_pc(pcptr, lenptr)
-
-/* Amount PC must be decremented by after a breakpoint.
-   This is often the number of bytes in BREAKPOINT
-   but not always.  */
-
-#define DECR_PC_AFTER_BREAK 0
-
 /* Say how long (ordinary) registers are.  This is a piece of bogosity
    used in push_word and a few other places; REGISTER_RAW_SIZE is the
    real way to know how big a register is.  */
@@ -137,11 +91,6 @@
 #define MIPS_REGSIZE 4
 #endif
 
-/* The sizes of floating point registers.  */
-
-#define MIPS_FPU_SINGLE_REGSIZE 4
-#define MIPS_FPU_DOUBLE_REGSIZE 8
-
 /* Number of machine registers */
 
 #ifndef NUM_REGS
@@ -420,10 +369,6 @@
 #define POP_FRAME		mips_pop_frame()
 extern void mips_pop_frame (void);
 
-#if !GDB_MULTI_ARCH
-#define CALL_DUMMY { 0 }
-#endif
-
 #define CALL_DUMMY_START_OFFSET (0)
 
 #define CALL_DUMMY_BREAKPOINT_OFFSET (0)
@@ -487,35 +432,11 @@
    multiple functions with the same SP.  But on the MIPS we can't do
    that since the PC is not stored in the same part of the frame every
    time.  This does not seem to be a very clever way to set up frames,
-   but there is nothing we can do about that).  */
+   but there is nothing we can do about that.  */
 
 #define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv)
 extern struct frame_info *setup_arbitrary_frame (int, CORE_ADDR *);
 
-/* Convert a dbx stab register number (from `r' declaration) to a gdb REGNUM */
-
-#define STAB_REG_TO_REGNUM(num) ((num) < 32 ? (num) : (num)+FP0_REGNUM-38)
-
-/* Convert a ecoff register number to a gdb REGNUM */
-
-#define ECOFF_REG_TO_REGNUM(num) ((num) < 32 ? (num) : (num)+FP0_REGNUM-32)
-
-#if !GDB_MULTI_ARCH
-/* If the current gcc for for this target does not produce correct debugging
-   information for float parameters, both prototyped and unprototyped, then
-   define this macro.  This forces gdb to  always assume that floats are
-   passed as doubles and then converted in the callee.
-
-   For the mips chip, it appears that the debug info marks the parameters as
-   floats regardless of whether the function is prototyped, but the actual
-   values are passed as doubles for the non-prototyped case and floats for
-   the prototyped case.  Thus we choose to make the non-prototyped case work
-   for C and break the prototyped case, since the non-prototyped case is
-   probably much more common.  (FIXME). */
-
-#define COERCE_FLOAT_TO_DOUBLE(formal, actual) (current_language -> la_language == language_c)
-#endif
-
 /* Select the default mips disassembler */
 
 #define TM_PRINT_INSN_MACH 0
diff --git a/gdb/config/mips/tm-mips64.h b/gdb/config/mips/tm-mips64.h
index 0031695..cb193e6 100644
--- a/gdb/config/mips/tm-mips64.h
+++ b/gdb/config/mips/tm-mips64.h
@@ -1,5 +1,5 @@
 /* Target machine parameters for MIPS r4000
-   Copyright 1994, 1996 Free Software Foundation, Inc.
+   Copyright 1994, 1996, 2000 Free Software Foundation, Inc.
    Contributed by Ian Lance Taylor (ian@cygnus.com)
 
    This file is part of GDB.
@@ -19,8 +19,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define GDB_TARGET_IS_MIPS64 1
-
 /* Use eight byte registers.  */
 #define MIPS_REGSIZE 8
 
@@ -35,21 +33,5 @@
 #define OP_LDFPR 065		/* ldc1 */
 #define OP_LDGPR 067		/* ld */
 
-#if defined(MIPS_EABI) && (MIPS_EABI != 0)
-/* Define sizes for 64-bit data types, allow specific targets to override
-   these values.  Doing so may violate the strict EABI, but it's necessary
-   for some MIPS III and MIPS IV machines that want 64bit longs, but 32bit
-   pointers.  */
-#ifndef TARGET_LONG_BIT
-#define TARGET_LONG_BIT      64
-#endif
-#ifndef TARGET_LONG_LONG_BIT
-#define TARGET_LONG_LONG_BIT 64
-#endif
-#ifndef TARGET_PTR_BIT
-#define TARGET_PTR_BIT       64
-#endif
-#endif /* MIPS_EABI */
-
 /* Get the basic MIPS definitions.  */
 #include "tm-mips.h"
diff --git a/gdb/config/mips/tm-tx39.h b/gdb/config/mips/tm-tx39.h
index e212a51..c4cc851 100644
--- a/gdb/config/mips/tm-tx39.h
+++ b/gdb/config/mips/tm-tx39.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,10 +17,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define TARGET_BYTE_ORDER_SELECTABLE_P 1
-#define MIPS_EABI 1
-#define MIPS_DEFAULT_FPU_TYPE MIPS_FPU_NONE
-
 #include "mips/tm-bigmips.h"
 
 #undef  MIPS_REGISTER_NAMES
diff --git a/gdb/config/mips/tm-tx39l.h b/gdb/config/mips/tm-tx39l.h
index 5488830..f8f942e 100644
--- a/gdb/config/mips/tm-tx39l.h
+++ b/gdb/config/mips/tm-tx39l.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,10 +17,6 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define TARGET_BYTE_ORDER_SELECTABLE_P 1
-#define MIPS_EABI 1
-#define MIPS_DEFAULT_FPU_TYPE MIPS_FPU_NONE
-
 #include "mips/tm-mips.h"
 
 #undef  MIPS_REGISTER_NAMES
diff --git a/gdb/config/mips/tm-vr4100.h b/gdb/config/mips/tm-vr4100.h
index c139f97..36d5bce 100644
--- a/gdb/config/mips/tm-vr4100.h
+++ b/gdb/config/mips/tm-vr4100.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,10 +17,4 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define TARGET_BYTE_ORDER_SELECTABLE_P 1
-#define MIPS_EABI 1
-#define MIPS_DEFAULT_FPU_TYPE MIPS_FPU_NONE
-#define TARGET_MONITOR_PROMPT "<RISQ> "
-#define TARGET_PTR_BIT 64
-
 #include "mips/tm-bigmips64.h"
diff --git a/gdb/config/mips/tm-vr4300.h b/gdb/config/mips/tm-vr4300.h
index 273161e..b8dc550 100644
--- a/gdb/config/mips/tm-vr4300.h
+++ b/gdb/config/mips/tm-vr4300.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1996, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,7 +17,4 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define TARGET_BYTE_ORDER_SELECTABLE_P 1
-#define TARGET_MONITOR_PROMPT "<RISQ> "
-
 #include "mips/tm-bigmips64.h"
diff --git a/gdb/config/mips/tm-vr4300el.h b/gdb/config/mips/tm-vr4300el.h
index 1a938f3..953b075 100644
--- a/gdb/config/mips/tm-vr4300el.h
+++ b/gdb/config/mips/tm-vr4300el.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1996, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,7 +17,4 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define TARGET_BYTE_ORDER_SELECTABLE_P 1
-#define TARGET_MONITOR_PROMPT "<RISQ> "
-
 #include "mips/tm-mips64.h"
diff --git a/gdb/config/mips/tm-vr4xxx.h b/gdb/config/mips/tm-vr4xxx.h
index 1f2a131..36d5bce 100644
--- a/gdb/config/mips/tm-vr4xxx.h
+++ b/gdb/config/mips/tm-vr4xxx.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,9 +17,4 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define GDB_MULTI_ARCH 1
-#define MIPS_DEFAULT_FPU_TYPE MIPS_FPU_DOUBLE
-#define TARGET_BYTE_ORDER_SELECTABLE_P 1
-#define TARGET_MONITOR_PROMPT "<RISQ> "
-
 #include "mips/tm-bigmips64.h"
diff --git a/gdb/config/mips/tm-vr4xxxel.h b/gdb/config/mips/tm-vr4xxxel.h
index ae5227b..5193747 100644
--- a/gdb/config/mips/tm-vr4xxxel.h
+++ b/gdb/config/mips/tm-vr4xxxel.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,9 +17,4 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define GDB_MULTI_ARCH 1
-#define MIPS_DEFAULT_FPU_TYPE MIPS_FPU_DOUBLE
-#define TARGET_BYTE_ORDER_SELECTABLE_P 1
-#define TARGET_MONITOR_PROMPT "<RISQ> "
-
 #include "mips/tm-mips64.h"
diff --git a/gdb/config/mips/tm-vr5000.h b/gdb/config/mips/tm-vr5000.h
index e3f66f0..9f1fbba 100644
--- a/gdb/config/mips/tm-vr5000.h
+++ b/gdb/config/mips/tm-vr5000.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,9 +17,4 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define GDB_MULTI_ARCH 1
-#define TARGET_BYTE_ORDER_SELECTABLE_P 1
-#define TARGET_MONITOR_PROMPT "<RISQ> "
-#define MIPS_EABI 1
-
 #include "mips/tm-bigmips64.h"
diff --git a/gdb/config/mips/tm-vr5000el.h b/gdb/config/mips/tm-vr5000el.h
index 9fa4700..e20adaa 100644
--- a/gdb/config/mips/tm-vr5000el.h
+++ b/gdb/config/mips/tm-vr5000el.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,9 +17,4 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define GDB_MULTI_ARCH 1
-#define TARGET_BYTE_ORDER_SELECTABLE_P 1
-#define TARGET_MONITOR_PROMPT "<RISQ> "
-#define MIPS_EABI 1
-
 #include "mips/tm-mips64.h"
diff --git a/gdb/config/mn10300/tm-mn10300.h b/gdb/config/mn10300/tm-mn10300.h
index 28981ab..de8eb53 100644
--- a/gdb/config/mn10300/tm-mn10300.h
+++ b/gdb/config/mn10300/tm-mn10300.h
@@ -1,5 +1,5 @@
 /* Parameters for execution on a Matsushita mn10300 processor.
-   Copyright 1996, 1997 Free Software Foundation, Inc. 
+   Copyright 1996, 1997, 2000 Free Software Foundation, Inc. 
 
    Contributed by Geoffrey Noer <noer@cygnus.com>
 
@@ -20,27 +20,32 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#define GDB_MULTI_ARCH 1
+
 /* The mn10300 is little endian.  */
 #define TARGET_BYTE_ORDER_DEFAULT LITTLE_ENDIAN
 
 /* All registers are 32bits (phew!).  */
+#if !GDB_MULTI_ARCH
 #define REGISTER_SIZE 4
 #define MAX_REGISTER_RAW_SIZE 4
 #define NUM_REGS 32
+#endif
 
+#if !GDB_MULTI_ARCH
 #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
+#endif
 
+#if !GDB_MULTI_ARCH
 #define REGISTER_BYTE(REG) ((REG) * 4)
 #define REGISTER_VIRTUAL_SIZE(REG) 4
 #define REGISTER_RAW_SIZE(REG) 4
+#endif
 
 #define MAX_REGISTER_VIRTUAL_SIZE 4
 
 #define REGISTER_BYTES (NUM_REGS * REGISTER_SIZE)
 
-extern char *mn10300_register_name (int regnr);
-#define REGISTER_NAME(i) (mn10300_register_name (i))
-
 #define D2_REGNUM 2
 #define D3_REGNUM 3
 #define A2_REGNUM 6
@@ -141,7 +146,7 @@
 
 extern CORE_ADDR
 mn10300_push_arguments (int, struct value **, CORE_ADDR,
-			unsigned char, CORE_ADDR);
+			int, CORE_ADDR);
 #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
   (mn10300_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
 
diff --git a/gdb/config/nm-empty.h b/gdb/config/nm-empty.h
deleted file mode 100644
index 7069d8c..0000000
--- a/gdb/config/nm-empty.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* This is just a dummy file to symlink to when GDB is configured as a
-   cross-only debugger.  */
diff --git a/gdb/config/nm-lynx.h b/gdb/config/nm-lynx.h
index 4a6f6e4..bdb1dfb 100644
--- a/gdb/config/nm-lynx.h
+++ b/gdb/config/nm-lynx.h
@@ -73,7 +73,7 @@
 extern int child_wait (int pid, struct target_waitstatus *status);
 
 /* Lynx needs a special definition of this so that we can
-   print out the pid and thread number seperatly.  */
+   print out the pid and thread number seperately.  */
 
 
 /* override child_pid_to_str in inftarg.c */
diff --git a/gdb/config/ns32k/nbsd.mh b/gdb/config/ns32k/nbsd.mh
index 30fb192..14d374c 100644
--- a/gdb/config/ns32k/nbsd.mh
+++ b/gdb/config/ns32k/nbsd.mh
@@ -1,6 +1,5 @@
 # Host: PC532 running NetBSD
-XDEPFILES= ser-tcp.o
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o \
-	ns32knbsd-nat.o solib.o
+XDEPFILES=
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ns32knbsd-nat.o
 XM_FILE= xm-nbsd.h
 NAT_FILE= nm-nbsd.h
diff --git a/gdb/config/ns32k/nbsd.mt b/gdb/config/ns32k/nbsd.mt
index 14d37f9..1656978b 100644
--- a/gdb/config/ns32k/nbsd.mt
+++ b/gdb/config/ns32k/nbsd.mt
@@ -1,3 +1,5 @@
 # Target: PC532 running NetBSD
-TDEPFILES= ns32k-tdep.o
+TDEPFILES= ns32k-tdep.o solib.o solib-svr4.o
 TM_FILE= tm-nbsd.h
+
+GDBSERVER_DEPFILES= low-nbsd.o
diff --git a/gdb/config/pa/hppabsd.mh b/gdb/config/pa/hppabsd.mh
index dfd2d4c..38daeaa 100644
--- a/gdb/config/pa/hppabsd.mh
+++ b/gdb/config/pa/hppabsd.mh
@@ -1,5 +1,5 @@
 # Host: Hewlett-Packard PA-RISC machine, running BSD
-XDEPFILES=  ser-tcp.o
+XDEPFILES=
 XM_FILE= xm-hppab.h
 NAT_FILE= nm-hppab.h
 NATDEPFILES= hppab-nat.o corelow.o core-aout.o inftarg.o fork-child.o somread.o infptrace.o hp-psymtab-read.o hp-symtab-read.o somsolib.o
diff --git a/gdb/config/pa/hppahpux.mh b/gdb/config/pa/hppahpux.mh
index 0d30244..16003c9 100644
--- a/gdb/config/pa/hppahpux.mh
+++ b/gdb/config/pa/hppahpux.mh
@@ -1,7 +1,7 @@
 # Host: Hewlett-Packard PA-RISC machine, running HPUX
 
 XM_FILE= xm-hppah.h
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 
 NAT_FILE= nm-hppah.h
 NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o somread.o infptrace.o hp-psymtab-read.o hp-symtab-read.o somsolib.o
diff --git a/gdb/config/pa/hppaosf.mh b/gdb/config/pa/hppaosf.mh
index 6bde9c0..8a38312 100644
--- a/gdb/config/pa/hppaosf.mh
+++ b/gdb/config/pa/hppaosf.mh
@@ -1,5 +1,5 @@
 # Host: Hewlett-Packard PA-RISC machine, running BSD
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 XM_FILE= xm-hppab.h
 NAT_FILE= nm-hppao.h
 NATDEPFILES= fork-child.o m3-nat.o hppam3-nat.o somread.o hp-psymtab-read.o hp-symtab-read.o somsolib.o
diff --git a/gdb/config/pa/hpux1020.mh b/gdb/config/pa/hpux1020.mh
index 28eae11..af6ccda 100644
--- a/gdb/config/pa/hpux1020.mh
+++ b/gdb/config/pa/hpux1020.mh
@@ -3,7 +3,7 @@
 MH_CFLAGS = -D__HP_CURSES
 
 XM_FILE= xm-hppah.h
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 
 NAT_FILE= nm-hppah.h
 NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infptrace.o somread.o hp-psymtab-read.o hp-symtab-read.o somsolib.o
diff --git a/gdb/config/pa/hpux11.mh b/gdb/config/pa/hpux11.mh
index 10fbd7e..44fe649 100644
--- a/gdb/config/pa/hpux11.mh
+++ b/gdb/config/pa/hpux11.mh
@@ -3,7 +3,7 @@
 MH_CFLAGS = -D__HP_CURSES
 
 XM_FILE= xm-hppah.h
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 
 NAT_FILE= nm-hppah11.h
 NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infttrace.o somread.o hp-psymtab-read.o hp-symtab-read.o somsolib.o
diff --git a/gdb/config/pa/hpux11w.mh b/gdb/config/pa/hpux11w.mh
index 248bb6e..0a60cd2 100644
--- a/gdb/config/pa/hpux11w.mh
+++ b/gdb/config/pa/hpux11w.mh
@@ -3,7 +3,7 @@
 MH_CFLAGS = -D__HP_CURSES
 
 XM_FILE= xm-hppah.h
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 
 NAT_FILE= nm-hppah11.h
 NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infttrace.o hp-psymtab-read.o hp-symtab-read.o pa64solib.o
diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h
index 2dbb74b..269e30f 100644
--- a/gdb/config/pa/tm-hppa.h
+++ b/gdb/config/pa/tm-hppa.h
@@ -106,7 +106,7 @@
    On hppa the sp must always be kept 64-bit aligned */
 
 #define STACK_ALIGN(arg) ( ((arg)%8) ? (((arg)+7)&-8) : (arg))
-#define NO_EXTRA_ALIGNMENT_NEEDED 1
+#define EXTRA_STACK_ALIGNMENT_NEEDED 0
 
 /* Sequence of bytes for breakpoint instruction.  */
 
diff --git a/gdb/config/powerpc/aix.mh b/gdb/config/powerpc/aix.mh
index bac3e30..30e4080 100644
--- a/gdb/config/powerpc/aix.mh
+++ b/gdb/config/powerpc/aix.mh
@@ -4,8 +4,12 @@
 XDEPFILES= 
 
 NAT_FILE= nm-aix.h
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o rs6000-nat.o xcoffread.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o rs6000-nat.o \
+	     xcoffread.o xcoffsolib.o
 
 # When compiled with cc, for debugging, this argument should be passed.
 # We have no idea who our current compiler is though, so we skip it.
 # MH_CFLAGS = -bnodelcsect
+
+# gdb is too big for all of its external symbols to fit in a small TOC
+MH_LDFLAGS = -Wl,-bbigtoc
diff --git a/gdb/config/powerpc/aix.mt b/gdb/config/powerpc/aix.mt
index 6d03b7d..985f71b 100644
--- a/gdb/config/powerpc/aix.mt
+++ b/gdb/config/powerpc/aix.mt
@@ -1,3 +1,3 @@
 # Target: PowerPC running AIX
-TDEPFILES= rs6000-tdep.o xcoffsolib.o
+TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o
 TM_FILE= tm-ppc-aix.h
diff --git a/gdb/config/powerpc/cygwin.mh b/gdb/config/powerpc/cygwin.mh
index 0c25709..9001a7d 100644
--- a/gdb/config/powerpc/cygwin.mh
+++ b/gdb/config/powerpc/cygwin.mh
@@ -1,5 +1,5 @@
 MH_CFLAGS=
 XM_FILE=xm-cygwin.h
-XDEP_FILES=ser-tcp.o
+XDEP_FILES=
 NATDEPFILES=win32-nat.o
 XM_CLIBS=-lkernel32
diff --git a/gdb/config/powerpc/cygwin.mt b/gdb/config/powerpc/cygwin.mt
index b86b2af..13a60f1 100644
--- a/gdb/config/powerpc/cygwin.mt
+++ b/gdb/config/powerpc/cygwin.mt
@@ -1,5 +1,5 @@
 # Target: Powerpc running cygnus's unix api over win32
-TDEPFILES= rs6000-tdep.o
+TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o
 TM_FILE= tm-cygwin.h
 
 
diff --git a/gdb/config/powerpc/linux.mh b/gdb/config/powerpc/linux.mh
index b4621f4..6890357 100644
--- a/gdb/config/powerpc/linux.mh
+++ b/gdb/config/powerpc/linux.mh
@@ -1,10 +1,13 @@
 # Host: PowerPC, running Linux
 
 XM_FILE= xm-linux.h
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 XM_CLIBS=
 
 NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o core-aout.o core-regset.o ppc-linux-nat.o linux-thread.o
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
+core-aout.o core-regset.o ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o
+
+LOADLIBES = -ldl -rdynamic
 
 GDBSERVER_DEPFILES= low-linux.o
diff --git a/gdb/config/powerpc/linux.mt b/gdb/config/powerpc/linux.mt
index a7c1bed..b809a6e 100644
--- a/gdb/config/powerpc/linux.mt
+++ b/gdb/config/powerpc/linux.mt
@@ -1,3 +1,3 @@
 # Target: Motorola PPC on Linux
-TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o
+TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o 
 TM_FILE= tm-linux.h
diff --git a/gdb/config/powerpc/macos.mt b/gdb/config/powerpc/macos.mt
index 07ad0d2..061d9d6 100644
--- a/gdb/config/powerpc/macos.mt
+++ b/gdb/config/powerpc/macos.mt
@@ -1,3 +1,3 @@
 # Target: PowerMac (PowerPC running MacOS)
-TDEPFILES= rs6000-tdep.o xcoffread.o
+TDEPFILES= rs6000-tdep.o xcoffread.o ppc-linux-tdep.o
 TM_FILE= tm-macos.h
diff --git a/gdb/config/powerpc/nbsd.mh b/gdb/config/powerpc/nbsd.mh
index e79f84a..341fa44 100644
--- a/gdb/config/powerpc/nbsd.mh
+++ b/gdb/config/powerpc/nbsd.mh
@@ -1,5 +1,5 @@
 # Host: PowerPC, running NetBSD
-XDEPFILES= ser-tcp.o
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o solib.o ppcnbsd-nat.o
+XDEPFILES=
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ppcnbsd-nat.o
 XM_FILE= xm-nbsd.h
 NAT_FILE= nm-nbsd.h
diff --git a/gdb/config/powerpc/nbsd.mt b/gdb/config/powerpc/nbsd.mt
index 2173f65..8045fa5 100644
--- a/gdb/config/powerpc/nbsd.mt
+++ b/gdb/config/powerpc/nbsd.mt
@@ -1,5 +1,5 @@
 # Target: PowerPC, running NetBSD
-TDEPFILES= rs6000-tdep.o
+TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o
 TM_FILE= tm-nbsd.h
 
 GDBSERVER_DEPFILES= low-nbsd.o
diff --git a/gdb/config/powerpc/nm-linux.h b/gdb/config/powerpc/nm-linux.h
index 0ef531c..5eac7d3 100644
--- a/gdb/config/powerpc/nm-linux.h
+++ b/gdb/config/powerpc/nm-linux.h
@@ -28,9 +28,6 @@
 #define KERNEL_U_SIZE kernel_u_size()
 extern int kernel_u_size (void);
 
-/* Tell gdb that we can attach and detach other processes */
-#define ATTACH_DETACH
-
 #define U_REGS_OFFSET 0
 
 #define REGISTER_U_ADDR(addr, blockend, regno) \
@@ -40,25 +37,20 @@
 
 #define NO_SYS_REG_H
 
-#ifdef HAVE_LINK_H
-#include "solib.h"             /* Support for shared libraries. */
-#define SVR4_SHARED_LIBS
-#endif
+/* FIXME: kettenis/2000-09-03: This should be moved to ../nm-linux.h
+   once we have converted all Linux targets to use the new threads
+   stuff (without the #undef of course).  */
 
-/* Support for Linuxthreads. */
+extern int lin_lwp_prepare_to_proceed (void);
+#undef PREPARE_TO_PROCEED
+#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
 
-#ifdef __STDC__
-struct objfile;
-#endif
+extern void lin_lwp_attach_lwp (int pid, int verbose);
+#define ATTACH_LWP(pid, verbose) lin_lwp_attach_lwp ((pid), (verbose))
 
-extern void linuxthreads_new_objfile (struct objfile *objfile);
-#define target_new_objfile(OBJFILE) linuxthreads_new_objfile (OBJFILE)
+#include <signal.h>
 
-extern char *linuxthreads_pid_to_str (int pid);
-#define target_pid_to_str(PID) linuxthreads_pid_to_str (PID)
-
-extern int linuxthreads_prepare_to_proceed (int step);
-#define PREPARE_TO_PROCEED(select_it) linuxthreads_prepare_to_proceed (1)
-
+extern void lin_thread_get_thread_signals (sigset_t *mask);
+#define GET_THREAD_SIGNALS(mask) lin_thread_get_thread_signals (mask)
 
 #endif /* #ifndef NM_LINUX_H */
diff --git a/gdb/config/powerpc/ppc-eabi.mt b/gdb/config/powerpc/ppc-eabi.mt
index c4e21c8..a142c86 100644
--- a/gdb/config/powerpc/ppc-eabi.mt
+++ b/gdb/config/powerpc/ppc-eabi.mt
@@ -1,3 +1,3 @@
 # Target: PowerPC running eabi
-TDEPFILES= ser-ocd.o rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o
+TDEPFILES= ser-ocd.o rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o ppc-linux-tdep.o
 TM_FILE= tm-ppc-eabi.h
diff --git a/gdb/config/powerpc/ppc-nw.mt b/gdb/config/powerpc/ppc-nw.mt
index 0eaa23d..3601b4e 100644
--- a/gdb/config/powerpc/ppc-nw.mt
+++ b/gdb/config/powerpc/ppc-nw.mt
@@ -1,3 +1,3 @@
 # Target: PowerPC running Netware
-TDEPFILES= rs6000-tdep.o
+TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o
 TM_FILE= tm-ppc-nw.h
diff --git a/gdb/config/powerpc/ppc-sim.mt b/gdb/config/powerpc/ppc-sim.mt
index c73fef2..a798d10 100644
--- a/gdb/config/powerpc/ppc-sim.mt
+++ b/gdb/config/powerpc/ppc-sim.mt
@@ -1,5 +1,5 @@
 # Target: PowerPC running eabi and including the simulator
-TDEPFILES= ser-ocd.o rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o
+TDEPFILES= ser-ocd.o rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o ppc-linux-tdep.o
 TM_FILE= tm-ppc-eabi.h
 
 SIM_OBS = remote-sim.o
diff --git a/gdb/config/powerpc/ppcle-eabi.mt b/gdb/config/powerpc/ppcle-eabi.mt
index b336a11..6de3f1d 100644
--- a/gdb/config/powerpc/ppcle-eabi.mt
+++ b/gdb/config/powerpc/ppcle-eabi.mt
@@ -1,3 +1,3 @@
 # Target: PowerPC running eabi in little endian mode
-TDEPFILES= ser-ocd.o rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o
+TDEPFILES= ser-ocd.o rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-linux-tdep.o
 TM_FILE= tm-ppcle-eabi.h
diff --git a/gdb/config/powerpc/ppcle-sim.mt b/gdb/config/powerpc/ppcle-sim.mt
index f08dafe..401a809 100644
--- a/gdb/config/powerpc/ppcle-sim.mt
+++ b/gdb/config/powerpc/ppcle-sim.mt
@@ -1,5 +1,5 @@
 # Target: PowerPC running eabi in little endian mode under the simulator
-TDEPFILES= ser-ocd.o rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o
+TDEPFILES= ser-ocd.o rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-linux-tdep.o
 TM_FILE= tm-ppcle-eabi.h
 
 SIM_OBS = remote-sim.o
diff --git a/gdb/config/powerpc/solaris.mh b/gdb/config/powerpc/solaris.mh
index 9c740ea..29ad094 100644
--- a/gdb/config/powerpc/solaris.mh
+++ b/gdb/config/powerpc/solaris.mh
@@ -1,11 +1,11 @@
 # Host: PowerPC, running Solaris 2
 
 XM_FILE= xm-solaris.h
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 XM_CLIBS= -lsocket -lnsl
 
 NAT_FILE= nm-solaris.h
-NATDEPFILES= corelow.o core-sol2.o solib.o fork-child.o procfs.o \
+NATDEPFILES= corelow.o core-sol2.o solib.o solib-svr4.o fork-child.o procfs.o \
 	proc-api.o proc-events.o proc-flags.o proc-why.o
 
 # If you are compiling with Sun's compiler, add the -xs option to CC
diff --git a/gdb/config/powerpc/solaris.mt b/gdb/config/powerpc/solaris.mt
index a6e421e..a18ba52 100644
--- a/gdb/config/powerpc/solaris.mt
+++ b/gdb/config/powerpc/solaris.mt
@@ -1,3 +1,3 @@
 # Target: PowerPC, running Solaris 2
-TDEPFILES= rs6000-tdep.o
+TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o
 TM_FILE= tm-solaris.h
diff --git a/gdb/config/powerpc/tm-linux.h b/gdb/config/powerpc/tm-linux.h
index b1abb0e..cf3275e 100644
--- a/gdb/config/powerpc/tm-linux.h
+++ b/gdb/config/powerpc/tm-linux.h
@@ -42,9 +42,6 @@
    in symfile.c) */
 #undef IBM6000_TARGET
 
-/* Offset to saved PC in sigcontext, from <linux/signal.h>.  */
-#define SIGCONTEXT_PC_OFFSET 184
-
 extern CORE_ADDR ppc_linux_skip_trampoline_code (CORE_ADDR pc);
 #undef SKIP_TRAMPOLINE_CODE
 #define	SKIP_TRAMPOLINE_CODE(pc) ppc_linux_skip_trampoline_code (pc)
@@ -53,39 +50,10 @@
 #undef IN_SIGTRAMP
 #define IN_SIGTRAMP(pc,func_name) ppc_linux_in_sigtramp (pc,func_name)
 
-extern unsigned long ppc_linux_frame_saved_pc (struct frame_info *);
-#undef FRAME_SAVED_PC
-#define FRAME_SAVED_PC(FRAME) ppc_linux_frame_saved_pc (FRAME)
-
-extern void ppc_linux_init_extra_frame_info (int fromleaf, struct frame_info *);
-#undef  INIT_EXTRA_FRAME_INFO
-#define	INIT_EXTRA_FRAME_INFO(fromleaf, fi) \
-  ppc_linux_init_extra_frame_info (fromleaf, fi)
-
-extern int ppc_linux_frameless_function_invocation (struct frame_info *);
-#undef FRAMELESS_FUNCTION_INVOCATION
-#define FRAMELESS_FUNCTION_INVOCATION(FI) \
-  (ppc_linux_frameless_function_invocation (FI))
-
-extern void ppc_linux_frame_init_saved_regs (struct frame_info *);
-#undef FRAME_INIT_SAVED_REGS
-#define FRAME_INIT_SAVED_REGS(FI) ppc_linux_frame_init_saved_regs (FI)
-
-CORE_ADDR ppc_linux_frame_chain (struct frame_info *);
-#undef FRAME_CHAIN
-#define FRAME_CHAIN(thisframe) ppc_linux_frame_chain (thisframe)
-
-CORE_ADDR ppc_sysv_abi_push_arguments (int, struct value **, CORE_ADDR, int,
-				       CORE_ADDR);
-#undef PUSH_ARGUMENTS
-#define	PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
-  (ppc_sysv_abi_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)))
-
+#if 0
 #define CANNOT_FETCH_REGISTER(regno) ((regno) >= MQ_REGNUM)
 #define CANNOT_STORE_REGISTER(regno) ((regno) >= MQ_REGNUM)
-
-/* Linux doesn't use the PowerOpen ABI for function pointer representation */
-#undef CONVERT_FROM_FUNC_PTR_ADDR
+#endif
 
 #if 0 /* If skip_prologue() isn't too greedy, we don't need this */
 /* There is some problem with the debugging symbols generated by the
@@ -94,13 +62,6 @@
 #define PROLOGUE_FIRSTLINE_OVERLAP
 #endif
 
-/* Needed to handled the self-modifying code situation due to the dynamic
-   linker. */
-int ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache);
-#undef MEMORY_REMOVE_BREAKPOINT
-#define MEMORY_REMOVE_BREAKPOINT(addr, contents_cache) \
-  ppc_linux_memory_remove_breakpoint(addr, contents_cache)
-
 /* N_FUN symbols in shared libaries have 0 for their values and need
    to be relocated. */
 #define SOFUN_ADDRESS_MAYBE_MISSING
diff --git a/gdb/config/powerpc/tm-macos.h b/gdb/config/powerpc/tm-macos.h
index bfd7a73..1cb5050 100644
--- a/gdb/config/powerpc/tm-macos.h
+++ b/gdb/config/powerpc/tm-macos.h
@@ -22,6 +22,3 @@
 #include "rs6000/tm-rs6000.h"
 
 #define GDB_TARGET_POWERPC
-
-/* This is no use to us.  */
-#undef PC_LOAD_SEGMENT
diff --git a/gdb/config/powerpc/tm-ppc-aix.h b/gdb/config/powerpc/tm-ppc-aix.h
index ae55e07..eae2362 100644
--- a/gdb/config/powerpc/tm-ppc-aix.h
+++ b/gdb/config/powerpc/tm-ppc-aix.h
@@ -24,23 +24,4 @@
 /* Use generic RS6000 definitions. */
 #include "rs6000/tm-rs6000.h"
 
-#define GDB_TARGET_POWERPC
-
-#undef PUSH_DUMMY_FRAME
-#define PUSH_DUMMY_FRAME             generic_push_dummy_frame ()
-
-#define PUSH_RETURN_ADDRESS(PC, SP)      ppc_push_return_address (PC, SP)
-
-/* override the standard get_saved_register function with 
-   one that takes account of generic CALL_DUMMY frames */
-#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
-      generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
-
-#define USE_GENERIC_DUMMY_FRAMES 1
-#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
-#define CALL_DUMMY_LOCATION          AT_ENTRY_POINT
-#define CALL_DUMMY_ADDRESS()         entry_point_address ()
-#undef CALL_DUMMY_START_OFFSET
-#define CALL_DUMMY_START_OFFSET      0
-
 #endif /* TM_PPC_AIX_H */
diff --git a/gdb/config/powerpc/tm-ppc-eabi.h b/gdb/config/powerpc/tm-ppc-eabi.h
index 2e333a8..aef54dc 100644
--- a/gdb/config/powerpc/tm-ppc-eabi.h
+++ b/gdb/config/powerpc/tm-ppc-eabi.h
@@ -30,9 +30,6 @@
 #undef	DEFAULT_LR_SAVE
 #define	DEFAULT_LR_SAVE 4	/* eabi saves LR at 4 off of SP */
 
-#define GDB_TARGET_POWERPC
-
-#undef PC_LOAD_SEGMENT
 #undef PROCESS_LINENUMBER_HOOK
 
 #undef TEXT_SEGMENT_BASE
@@ -43,38 +40,6 @@
 
 #define TARGET_BYTE_ORDER_SELECTABLE_P 1
 
-/* return true if a given `pc' value is in `call dummy' function. */
-/* FIXME: This just checks for the end of the stack, which is broken
-   for things like stepping through gcc nested function stubs.  */
-#undef PC_IN_CALL_DUMMY
-
-/* generic dummy frame stuff */
-
-
-
-/* target-specific dummy_frame stuff */
-
-extern struct frame_info *rs6000_pop_frame (struct frame_info *frame);
-
-extern CORE_ADDR ppc_push_return_address (CORE_ADDR, CORE_ADDR);
-
-#undef PUSH_DUMMY_FRAME
-#define PUSH_DUMMY_FRAME             generic_push_dummy_frame ()
-
-#define PUSH_RETURN_ADDRESS(PC, SP)      ppc_push_return_address (PC, SP)
-
-/* override the standard get_saved_register function with 
-   one that takes account of generic CALL_DUMMY frames */
-#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
-      generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
-
-#define USE_GENERIC_DUMMY_FRAMES 1
-#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
-#define CALL_DUMMY_LOCATION          AT_ENTRY_POINT
-#define CALL_DUMMY_ADDRESS()         entry_point_address ()
-#undef CALL_DUMMY_START_OFFSET
-#define CALL_DUMMY_START_OFFSET      0
-
 /* The value of symbols of type N_SO and N_FUN maybe null when 
    it shouldn't be. */
 #define SOFUN_ADDRESS_MAYBE_MISSING
diff --git a/gdb/config/powerpc/tm-ppc-nw.h b/gdb/config/powerpc/tm-ppc-nw.h
index 7306ea0..32a58f4 100644
--- a/gdb/config/powerpc/tm-ppc-nw.h
+++ b/gdb/config/powerpc/tm-ppc-nw.h
@@ -26,7 +26,6 @@
 
 #define GDB_TARGET_POWERPC
 
-#undef PC_LOAD_SEGMENT
 #undef PROCESS_LINENUMBER_HOOK
 
 #endif /* TM_PPC_NW_H */
diff --git a/gdb/config/powerpc/vxworks.mt b/gdb/config/powerpc/vxworks.mt
index 1c71413..11d8ef2 100644
--- a/gdb/config/powerpc/vxworks.mt
+++ b/gdb/config/powerpc/vxworks.mt
@@ -1,3 +1,3 @@
 # Target: Powerpc running VxWorks
-TDEPFILES= rs6000-tdep.o
+TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o
 TM_FILE= tm-vxworks.h
diff --git a/gdb/config/rs6000/aix4.mh b/gdb/config/rs6000/aix4.mh
index c5bc2da..8d105d9 100644
--- a/gdb/config/rs6000/aix4.mh
+++ b/gdb/config/rs6000/aix4.mh
@@ -4,7 +4,8 @@
 XDEPFILES= 
 
 NAT_FILE= nm-rs6000.h
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o rs6000-nat.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o rs6000-nat.o \
+	     xcoffsolib.o
 
 # When compiled with cc, for debugging, this argument should be passed.
 # We have no idea who our current compiler is though, so we skip it.
diff --git a/gdb/config/rs6000/aix4.mt b/gdb/config/rs6000/aix4.mt
index f213f0f..f1082b3 100644
--- a/gdb/config/rs6000/aix4.mt
+++ b/gdb/config/rs6000/aix4.mt
@@ -1,3 +1,3 @@
 # Target: IBM RS/6000 running AIX4
-TDEPFILES= rs6000-tdep.o xcoffsolib.o xcoffread.o
+TDEPFILES= rs6000-tdep.o xcoffread.o ppc-linux-tdep.o
 TM_FILE= tm-rs6000-aix4.h
diff --git a/gdb/config/rs6000/nm-rs6000.h b/gdb/config/rs6000/nm-rs6000.h
index 3d237bc..d405aec 100644
--- a/gdb/config/rs6000/nm-rs6000.h
+++ b/gdb/config/rs6000/nm-rs6000.h
@@ -29,6 +29,10 @@
 
 #define FETCH_INFERIOR_REGISTERS
 
+/* Override child_xfer_memory in infptrace.c. */
+
+#define CHILD_XFER_MEMORY
+
 /* When a child process is just starting, we sneak in and relocate
    the symbol table (and other stuff) after the dynamic linker has
    figured out where they go.  */
@@ -53,6 +57,11 @@
 struct target_ops;
 extern void xcoff_relocate_core (struct target_ops *);
 
+/* Load segment of a given pc value. */
+
+#define	PC_LOAD_SEGMENT(PC)	pc_load_segment_name(PC)
+extern char *pc_load_segment_name (CORE_ADDR);
+
 /* Return sizeof user struct to callers in less machine dependent routines */
 
 #define KERNEL_U_SIZE kernel_u_size()
diff --git a/gdb/config/rs6000/rs6000.mh b/gdb/config/rs6000/rs6000.mh
index 600d616..ec877e7 100644
--- a/gdb/config/rs6000/rs6000.mh
+++ b/gdb/config/rs6000/rs6000.mh
@@ -4,7 +4,8 @@
 XDEPFILES= 
 
 NAT_FILE= nm-rs6000.h
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o rs6000-nat.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o rs6000-nat.o \
+	     xcoffsolib.o
 
 # When compiled with cc, for debugging, this argument should be passed.
 # We have no idea who our current compiler is though, so we skip it.
diff --git a/gdb/config/rs6000/rs6000.mt b/gdb/config/rs6000/rs6000.mt
index a2294b2..a9afe89 100644
--- a/gdb/config/rs6000/rs6000.mt
+++ b/gdb/config/rs6000/rs6000.mt
@@ -1,3 +1,3 @@
 # Target: IBM RS/6000 running AIX
-TDEPFILES= rs6000-tdep.o xcoffsolib.o xcoffread.o
+TDEPFILES= rs6000-tdep.o xcoffread.o ppc-linux-tdep.o
 TM_FILE= tm-rs6000.h
diff --git a/gdb/config/rs6000/rs6000lynx.mh b/gdb/config/rs6000/rs6000lynx.mh
index b938152..b7f03c7 100644
--- a/gdb/config/rs6000/rs6000lynx.mh
+++ b/gdb/config/rs6000/rs6000lynx.mh
@@ -1,7 +1,7 @@
 # Host: RS6000 running LynxOS
 
 XM_FILE= xm-rs6000ly.h
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 XM_CLIBS= -lbsd
 
 NAT_FILE= nm-rs6000ly.h
diff --git a/gdb/config/rs6000/rs6000lynx.mt b/gdb/config/rs6000/rs6000lynx.mt
index 978030c..fae6d8c 100644
--- a/gdb/config/rs6000/rs6000lynx.mt
+++ b/gdb/config/rs6000/rs6000lynx.mt
@@ -1,3 +1,3 @@
 # Target: IBM RS6000 running LynxOS
-TDEPFILES= coff-solib.o rs6000-tdep.o
+TDEPFILES= coff-solib.o rs6000-tdep.o ppc-linux-tdep.o
 TM_FILE= tm-rs6000ly.h
diff --git a/gdb/config/rs6000/tm-rs6000.h b/gdb/config/rs6000/tm-rs6000.h
index 5bba778..6ed2955 100644
--- a/gdb/config/rs6000/tm-rs6000.h
+++ b/gdb/config/rs6000/tm-rs6000.h
@@ -20,97 +20,22 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* Forward decls for prototypes */
-struct frame_info;
-struct type;
-struct value;
+#define GDB_MULTI_ARCH 1
 
 /* Minimum possible text address in AIX */
 
 #define TEXT_SEGMENT_BASE	0x10000000
 
-/* Load segment of a given pc value. */
-
-#define	PC_LOAD_SEGMENT(PC)	pc_load_segment_name(PC)
-extern char *pc_load_segment_name (CORE_ADDR);
-
-/* AIX cc seems to get this right.  */
-
-#define BELIEVE_PCC_PROMOTION 1
-
-/* return true if a given `pc' value is in `call dummy' function. */
-/* FIXME: This just checks for the end of the stack, which is broken
-   for things like stepping through gcc nested function stubs.  */
-#define	PC_IN_CALL_DUMMY(STOP_PC, STOP_SP, STOP_FRAME_ADDR)	\
-	(STOP_SP < STOP_PC && STOP_PC < STACK_END_ADDR)
-
-#if 0
-extern unsigned int text_start, data_start;
-extern char *corefile;
-#endif
-extern int inferior_pid;
-
-/* We are missing register descriptions in the system header files. Sigh! */
-
-struct regs
-  {
-    int gregs[32];		/* general purpose registers */
-    int pc;			/* program conter       */
-    int ps;			/* processor status, or machine state */
-  };
-
-struct fp_status
-  {
-    double fpregs[32];		/* floating GP registers */
-  };
-
-
-/* To be used by skip_prologue. */
-
-struct rs6000_framedata
-  {
-    int offset;			/* total size of frame --- the distance
-				   by which we decrement sp to allocate
-				   the frame */
-    int saved_gpr;		/* smallest # of saved gpr */
-    int saved_fpr;		/* smallest # of saved fpr */
-    int alloca_reg;		/* alloca register number (frame ptr) */
-    char frameless;		/* true if frameless functions. */
-    char nosavedpc;		/* true if pc not saved. */
-    int gpr_offset;		/* offset of saved gprs from prev sp */
-    int fpr_offset;		/* offset of saved fprs from prev sp */
-    int lr_offset;		/* offset of saved lr */
-    int cr_offset;		/* offset of saved cr */
-  };
-
-/* Define the byte order of the machine.  */
-
-#define TARGET_BYTE_ORDER_DEFAULT	BIG_ENDIAN
-
 /* AIX's assembler doesn't grok dollar signs in identifiers.
    So we use dots instead.  This item must be coordinated with G++. */
 #undef CPLUS_MARKER
 #define CPLUS_MARKER '.'
 
-/* Offset from address of function to start of its code.
-   Zero on most machines.  */
-
-#define FUNCTION_START_OFFSET 0
-
-/* Advance PC across any function entry prologue instructions
-   to reach some "real" code.  */
-
-extern CORE_ADDR rs6000_skip_prologue (CORE_ADDR);
-#define SKIP_PROLOGUE(pc) (rs6000_skip_prologue (pc))
-
-extern CORE_ADDR skip_prologue (CORE_ADDR, struct rs6000_framedata *);
-
-
 /* If PC is in some function-call trampoline code, return the PC
    where the function itself actually starts.  If not, return NULL.  */
 
-#define	SKIP_TRAMPOLINE_CODE(pc)	skip_trampoline_code (pc)
-extern CORE_ADDR skip_trampoline_code (CORE_ADDR);
+#define	SKIP_TRAMPOLINE_CODE(pc)	rs6000_skip_trampoline_code (pc)
+extern CORE_ADDR rs6000_skip_trampoline_code (CORE_ADDR);
 
 /* Number of trap signals we need to skip over, once the inferior process
    starts running. */
@@ -138,57 +63,6 @@
 #define	PROCESS_LINENUMBER_HOOK()	aix_process_linenos ()
 extern void aix_process_linenos (void);
 
-/* Immediately after a function call, return the saved pc.
-   Can't go through the frames for this because on some machines
-   the new frame is not set up until the new function executes
-   some instructions.  */
-
-#define	SAVED_PC_AFTER_CALL(frame) read_register (LR_REGNUM)
-
-/* Address of end of stack space.  */
-
-#define STACK_END_ADDR 0x2ff80000
-
-/* Stack grows downward.  */
-
-#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
-
-/* This is how arguments pushed onto stack or passed in registers.
-   Stack must be aligned on 64-bit boundaries when synthesizing
-   function calls.  We don't need STACK_ALIGN, PUSH_ARGUMENTS will
-   handle it. */
-
-#define	PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
-  (rs6000_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)))
-extern CORE_ADDR rs6000_push_arguments (int, struct value **, CORE_ADDR, int,
-					CORE_ADDR);
-
-/* BREAKPOINT_FROM_PC uses the program counter value to determine the
-   breakpoint that should be used */
-extern breakpoint_from_pc_fn rs6000_breakpoint_from_pc;
-#define BREAKPOINT_FROM_PC(pcptr, lenptr) rs6000_breakpoint_from_pc (pcptr, lenptr)
-
-/* Amount PC must be decremented by after a breakpoint.
-   This is often the number of bytes in BREAKPOINT
-   but not always.  */
-
-#define DECR_PC_AFTER_BREAK 0
-
-/* Say how long (ordinary) registers are.  This is a piece of bogosity
-   used in push_word and a few other places; REGISTER_RAW_SIZE is the
-   real way to know how big a register is.  */
-#define REGISTER_SIZE 4
-
-
-/* Return the name of register number REG.  This may return "" to
-   indicate a register number that's not used on this variant.
-   (Register numbers may be sparse for consistency between variants.)  */
-#define REGISTER_NAME(reg) (rs6000_register_name(reg))
-extern char *rs6000_register_name (int reg);
-
-/* Number of machine registers */
-#define NUM_REGS 183
-
 /* Register numbers of various important registers.
    Note that some of these values are "real" register numbers,
    and correspond to the general registers of the machine,
@@ -196,350 +70,28 @@
    to be actual register numbers as far as the user is concerned
    but do serve to get the desired values when passed to read_register.  */
 
-#define FP_REGNUM 1		/* Contains address of executing stack frame */
-#define SP_REGNUM 1		/* Contains address of top of stack */
-#define	TOC_REGNUM 2		/* TOC register */
 #define FP0_REGNUM 32		/* Floating point register 0 */
-#define	GP0_REGNUM 0		/* GPR register 0 */
-#define FP0_REGNUM 32		/* FPR (Floating point) register 0 */
 #define FPLAST_REGNUM 63	/* Last floating point register */
 
-/* Special purpose registers... */
-/* P.S. keep these in the same order as in /usr/mstsave.h `mstsave'
-   structure, for easier processing */
-
-#define PC_REGNUM 64		/* Program counter (instruction address %iar) */
-#define PS_REGNUM 65		/* Processor (or machine) status (%msr) */
-#define	CR_REGNUM 66		/* Condition register */
-#define	LR_REGNUM 67		/* Link register */
-#define	CTR_REGNUM 68		/* Count register */
-#define	XER_REGNUM 69		/* Fixed point exception registers */
-#define	MQ_REGNUM 70		/* Multiply/quotient register */
-
 /* These #defines are used to parse core files and talk to ptrace, so they
    must remain fixed.  */
 #define	FIRST_UISA_SP_REGNUM 64	/* first special register number */
 #define LAST_UISA_SP_REGNUM  70	/* last special register number */
 
-/* This is the offset in REG_NAMES at which the `set processor'
-   command starts plugging in its names.  */
-#define FIRST_VARIANT_REGISTER 66
-
-/* Total amount of space needed to store our copies of the machine's
-   register state, the array `registers'.
-   32 4-byte gpr's
-   32 8-byte fpr's
-   7  4-byte UISA special purpose registers, 
-   16 4-byte segment registers,
-   32 4-byte standard OEA special-purpose registers,
-   and up to 64 4-byte non-standard OEA special purpose regs.
-   total: (+ (* 32 4) (* 32 8) (* 7 4) (* 16 4) (* 32 4) (* 64 4)) 860 bytes
-   Keep some extra space for now, in case to add more. */
-#define REGISTER_BYTES 880
-
-
-/* Index within `registers' of the first byte of the space for
-   register N.  */
-
-#define REGISTER_BYTE(N)  \
- (								\
-  ((N) > FPLAST_REGNUM) ? ((((N) - FPLAST_REGNUM -1) * 4) + 384)\
-  :((N) >= FP0_REGNUM) ? ((((N) - FP0_REGNUM) * 8) + 128)	\
-  :((N) * 4) )
-
-/* Number of bytes of storage in the actual machine representation
-   for register N. */
-/* Note that the unsigned cast here forces the result of the
-   subtraction to very high positive values if N < FP0_REGNUM */
-
-#define REGISTER_RAW_SIZE(N) (((unsigned)(N) - FP0_REGNUM) < 32 ? 8 : 4)
-
-/* Number of bytes of storage in the program's representation
-   for register N.  On the RS6000, all regs are 4 bytes
-   except the floating point regs which are 8-byte doubles.  */
-
-#define REGISTER_VIRTUAL_SIZE(N) (((unsigned)(N) - FP0_REGNUM) < 32 ? 8 : 4)
-
-/* Largest value REGISTER_RAW_SIZE can have.  */
-
-#define MAX_REGISTER_RAW_SIZE 8
-
-/* Largest value REGISTER_VIRTUAL_SIZE can have.  */
-
-#define MAX_REGISTER_VIRTUAL_SIZE 8
-
 /* convert a dbx stab register number (from `r' declaration) to a gdb REGNUM */
 
 #define STAB_REG_TO_REGNUM(value)	(value)
 
-/* Nonzero if register N requires conversion
-   from raw format to virtual format.
-   The register format for rs6000 floating point registers is always
-   double, we need a conversion if the memory format is float.  */
-
-#define REGISTER_CONVERTIBLE(N) ((N) >= FP0_REGNUM && (N) <= FPLAST_REGNUM)
-
-/* Convert data from raw format for register REGNUM in buffer FROM
-   to virtual format with type TYPE in buffer TO.  */
-
-#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
-{ \
-  if (TYPE_LENGTH (TYPE) != REGISTER_RAW_SIZE (REGNUM)) \
-    { \
-      double val = extract_floating ((FROM), REGISTER_RAW_SIZE (REGNUM)); \
-      store_floating ((TO), TYPE_LENGTH (TYPE), val); \
-    } \
-  else \
-    memcpy ((TO), (FROM), REGISTER_RAW_SIZE (REGNUM)); \
-}
-
-/* Convert data from virtual format with type TYPE in buffer FROM
-   to raw format for register REGNUM in buffer TO.  */
-
-#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO)	\
-{ \
-  if (TYPE_LENGTH (TYPE) != REGISTER_RAW_SIZE (REGNUM)) \
-    { \
-      double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
-      store_floating ((TO), REGISTER_RAW_SIZE (REGNUM), val); \
-    } \
-  else \
-    memcpy ((TO), (FROM), REGISTER_RAW_SIZE (REGNUM)); \
-}
-
-/* Return the GDB type object for the "standard" data type
-   of data in register N.  */
-
-#define REGISTER_VIRTUAL_TYPE(N) \
- (((unsigned)(N) - FP0_REGNUM) < 32 ? builtin_type_double : builtin_type_int)
-
-/* Store the address of the place in which to copy the structure the
-   subroutine will return.  This is called from call_function. */
-/* in RS6000, struct return addresses are passed as an extra parameter in r3.
-   In function return, callee is not responsible of returning this address back.
-   Since gdb needs to find it, we will store in a designated variable
-   `rs6000_struct_return_address'. */
-
-extern CORE_ADDR rs6000_struct_return_address;
-
-#define STORE_STRUCT_RETURN(ADDR, SP)	\
-  { write_register (3, (ADDR));		\
-    rs6000_struct_return_address = (ADDR); }
-
-/* Extract from an array REGBUF containing the (raw) register state
-   a function return value of type TYPE, and copy that, in virtual format,
-   into VALBUF.  */
-
-/* #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
-   memcpy (VALBUF, REGBUF, TYPE_LENGTH (TYPE)) */
-
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
-  extract_return_value(TYPE,REGBUF,VALBUF)
-extern void extract_return_value (struct type *, char[], char *);
-
-/* Write into appropriate registers a function return value
-   of type TYPE, given in virtual format.  */
-
-#define STORE_RETURN_VALUE(TYPE,VALBUF) \
-  {									\
-    if (TYPE_CODE (TYPE) == TYPE_CODE_FLT)				\
-									\
-     /* Floating point values are returned starting from FPR1 and up.	\
-	Say a double_double_double type could be returned in		\
-	FPR1/FPR2/FPR3 triple. */					\
-									\
-      write_register_bytes (REGISTER_BYTE (FP0_REGNUM+1), (VALBUF),	\
-						TYPE_LENGTH (TYPE));	\
-    else								\
-      /* Everything else is returned in GPR3 and up. */			\
-      write_register_bytes (REGISTER_BYTE (GP0_REGNUM+3), (VALBUF),	\
-						TYPE_LENGTH (TYPE));	\
-  }
-
-
-/* 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).  */
-
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF)	rs6000_struct_return_address
-
-/* Describe the pointer in each stack frame to the previous stack frame
-   (its caller).  */
-
-/* FRAME_CHAIN takes a frame's nominal address
-   and produces the frame's chain-pointer. */
-
-/* In the case of the RS6000, the frame's nominal address
-   is the address of a 4-byte word containing the calling frame's address.  */
-
-#define FRAME_CHAIN(thisframe) rs6000_frame_chain (thisframe)
-CORE_ADDR rs6000_frame_chain (struct frame_info *);
-
 /* Define other aspects of the stack frame.  */
 
-/* A macro that tells us whether the function invocation represented
-   by FI does not have a frame on the stack associated with it.  If it
-   does not, FRAMELESS is set to 1, else 0.  */
-
-extern int rs6000_frameless_function_invocation (struct frame_info *);
-#define FRAMELESS_FUNCTION_INVOCATION(FI) \
-  (rs6000_frameless_function_invocation (FI))
-
 #define INIT_FRAME_PC_FIRST(fromleaf, prev) \
   prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \
 	      prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ());
 #define INIT_FRAME_PC(fromleaf, prev)	/* nothing */
-extern void rs6000_init_extra_frame_info (int fromleaf, struct frame_info *);
-#define	INIT_EXTRA_FRAME_INFO(fromleaf, fi) rs6000_init_extra_frame_info (fromleaf, fi)
-
-/* If the kernel has to deliver a signal, it pushes a sigcontext
-   structure on the stack and then calls the signal handler, passing
-   the address of the sigcontext in an argument register. Usually
-   the signal handler doesn't save this register, so we have to
-   access the sigcontext structure via an offset from the signal handler
-   frame.
-   The following constants were determined by experimentation on AIX 3.2.  */
-#define SIG_FRAME_PC_OFFSET 96
-#define SIG_FRAME_LR_OFFSET 108
-#define SIG_FRAME_FP_OFFSET 284
 
 /* Default offset from SP where the LR is stored */
 #define	DEFAULT_LR_SAVE 8
 
-/* Return saved PC from a frame */
-#define FRAME_SAVED_PC(FRAME)  rs6000_frame_saved_pc (FRAME)
-
-extern unsigned long rs6000_frame_saved_pc (struct frame_info *);
-
-extern CORE_ADDR rs6000_frame_args_address (struct frame_info *);
-#define FRAME_ARGS_ADDRESS(FI) rs6000_frame_args_address (FI)
-
-#define FRAME_LOCALS_ADDRESS(FI)	FRAME_ARGS_ADDRESS(FI)
-
-
-/* Set VAL to the number of args passed to frame described by FI.
-   Can set VAL to -1, meaning no way to tell.  */
-
-/* We can't tell how many args there are
-   now that the C compiler delays popping them.  */
-
-#define FRAME_NUM_ARGS(fi) (-1)
-
-/* Return number of bytes at start of arglist that are not really args.  */
-
-#define FRAME_ARGS_SKIP 8	/* Not sure on this. FIXMEmgo */
-
-/* Put here the code to store, into a struct frame_saved_regs,
-   the addresses of 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.  */
-/* In the following implementation for RS6000, we did *not* save sp. I am
-   not sure if it will be needed. The following macro takes care of gpr's
-   and fpr's only. */
-
-extern void rs6000_frame_init_saved_regs (struct frame_info *);
-#define FRAME_INIT_SAVED_REGS(FI) rs6000_frame_init_saved_regs (FI)
-
-/* Things needed for making the inferior call functions.  */
-
-/* Push an empty stack frame, to record the current PC, etc.  */
-/* Change these names into rs6k_{push, pop}_frame(). FIXMEmgo. */
-
-#define PUSH_DUMMY_FRAME	push_dummy_frame ()
-extern void push_dummy_frame (void);
-
-/* Discard from the stack the innermost frame, 
-   restoring all saved registers.  */
-
-#define POP_FRAME	pop_frame ()
-extern void pop_frame (void);
-
-/* This sequence of words is the instructions:
-
-   mflr r0              // 0x7c0802a6
-   // save fpr's
-   stfd r?, num(r1)     // 0xd8010000 there should be 32 of this??
-   // save gpr's
-   stm  r0, num(r1)     // 0xbc010000
-   stu  r1, num(r1)     // 0x94210000
-
-   // the function we want to branch might be in a different load 
-   // segment. reset the toc register. Note that the actual toc address
-   // will be fix by fix_call_dummy () along with function address.
-
-   st   r2, 0x14(r1)    // 0x90410014 save toc register
-   liu  r2, 0x1234      // 0x3c401234 reset a new toc value 0x12345678
-   oril r2, r2,0x5678   // 0x60425678   
-
-   // load absolute address 0x12345678 to r0
-   liu  r0, 0x1234      // 0x3c001234
-   oril r0, r0,0x5678   // 0x60005678
-   mtctr        r0              // 0x7c0903a6 ctr <- r0
-   bctrl                        // 0x4e800421 jump subroutine 0x12345678 (%ctr)
-   cror 0xf, 0xf, 0xf   // 0x4def7b82
-   brpt                 // 0x7d821008, breakpoint
-   cror 0xf, 0xf, 0xf   // 0x4def7b82 (for 8 byte alignment)
-
-
-   We actually start executing by saving the toc register first, since the pushing 
-   of the registers is done by PUSH_DUMMY_FRAME.  If this were real code,
-   the arguments for the function called by the `bctrl' would be pushed
-   between the `stu' and the `bctrl', and we could allow it to execute through.
-   But the arguments have to be pushed by GDB after the PUSH_DUMMY_FRAME is done,
-   and we cannot allow to push the registers again.
- */
-
-#define CALL_DUMMY {0x7c0802a6, 0xd8010000, 0xbc010000, 0x94210000, \
-		    0x90410014, 0x3c401234, 0x60425678,		    \
-		    0x3c001234, 0x60005678, 0x7c0903a6, 0x4e800421, \
-		    0x4def7b82, 0x7d821008, 0x4def7b82 }
-
-
-/* keep this as multiple of 8 (%sp requires 8 byte alignment) */
-#define CALL_DUMMY_LENGTH 56
-
-#define CALL_DUMMY_START_OFFSET 16
-
-/* Insert the specified number of args and function address into a
-   call sequence of the above form stored at DUMMYNAME.  */
-
-#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
-  rs6000_fix_call_dummy (dummyname, pc, fun, nargs, args, type, gcc_p)
-extern void rs6000_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR,
-				   int, struct value **, struct type *, int);
-
-/* Hook in rs6000-tdep.c for determining the TOC address when
-   calling functions in the inferior.  */
-extern
-CORE_ADDR (*find_toc_address_hook) (CORE_ADDR);
-
-/* xcoffread.c provides a function to determine the TOC offset
-   for a given object file.
-   It is used under native AIX configurations for determining the
-   TOC address when calling functions in the inferior.  */
-
-struct objfile;
-extern CORE_ADDR get_toc_offset (struct objfile *);
-
-/* Usually a function pointer's representation is simply the address
-   of the function. On the RS/6000 however, a function pointer is
-   represented by a pointer to a TOC entry. This TOC entry contains
-   three words, the first word is the address of the function, the
-   second word is the TOC pointer (r2), and the third word is the
-   static chain value.  Throughout GDB it is currently assumed that a
-   function pointer contains the address of the function, which is not
-   easy to fix.  In addition, the conversion of a function address to
-   a function pointer would require allocation of a TOC entry in the
-   inferior's memory space, with all its drawbacks.  To be able to
-   call C++ virtual methods in the inferior (which are called via
-   function pointers), find_function_addr uses this macro to get the
-   function address from a function pointer.  */
-
-#define CONVERT_FROM_FUNC_PTR_ADDR(ADDR) \
-  (is_magic_function_pointer (ADDR) ? read_memory_integer (ADDR, 4) : (ADDR))
-extern int is_magic_function_pointer (CORE_ADDR);
-
 /* Flag for machine-specific stuff in shared files.  FIXME */
 #define IBM6000_TARGET
 
@@ -549,14 +101,17 @@
 extern void rs6000_software_single_step (unsigned int, int);
 #define SOFTWARE_SINGLE_STEP(sig,bp_p) rs6000_software_single_step (sig, bp_p)
 
-/* If the current gcc for for this target does not produce correct debugging
-   information for float parameters, both prototyped and unprototyped, then
-   define this macro.  This forces gdb to  always assume that floats are
-   passed as doubles and then converted in the callee.
+/* Notice when a new child process is started. */
 
-   For the PowerPC, it appears that the debug info marks the parameters as
-   floats regardless of whether the function is prototyped, but the actual
-   values are always passed in as doubles.  Thus by setting this to 1, both
-   types of calls will work. */
+#define TARGET_CREATE_INFERIOR_HOOK rs6000_create_inferior
+extern void rs6000_create_inferior (int);
 
-#define COERCE_FLOAT_TO_DOUBLE(formal, actual) (1)
+/* Hook in rs6000-tdep.c for determining the TOC address when
+   calling functions in the inferior.  */
+
+extern CORE_ADDR (*rs6000_find_toc_address_hook) (CORE_ADDR);
+
+/* Hook in rs6000-tdep.c to set the current architecture when starting a
+   child process. */
+
+extern void (*rs6000_set_host_arch_hook) (int);
diff --git a/gdb/config/rs6000/tm-rs6000ly.h b/gdb/config/rs6000/tm-rs6000ly.h
index ce55513..7dd57a4 100644
--- a/gdb/config/rs6000/tm-rs6000ly.h
+++ b/gdb/config/rs6000/tm-rs6000ly.h
@@ -26,8 +26,6 @@
 /* Use generic RS6000 definitions. */
 #include "rs6000/tm-rs6000.h"
 
-#undef PC_LOAD_SEGMENT
-
 #define CANNOT_STORE_REGISTER(regno) (regno == PS_REGNUM)
 
 #endif /* TM_RS6000LYNX_H */
diff --git a/gdb/config/sh/sh.mt b/gdb/config/sh/sh.mt
index a6604d4..25540b3 100644
--- a/gdb/config/sh/sh.mt
+++ b/gdb/config/sh/sh.mt
@@ -1,6 +1,6 @@
 # Target: Hitachi Super-H with ICE and simulator
-TDEPFILES= sh-tdep.o monitor.o sh3-rom.o remote-e7000.o ser-e7kpc.o dsrec.o
-TM_FILE= tm-sh.h
+TDEPFILES= sh-tdep.o monitor.o sh3-rom.o remote-e7000.o ser-e7kpc.o dsrec.o solib.o solib-svr4.o
+TM_FILE= tm-linux.h
 
 SIM_OBS = remote-sim.o
 SIM = ../sim/sh/libsim.a
diff --git a/gdb/config/sh/tm-linux.h b/gdb/config/sh/tm-linux.h
new file mode 100644
index 0000000..bf9a384
--- /dev/null
+++ b/gdb/config/sh/tm-linux.h
@@ -0,0 +1,30 @@
+/* Target-specific definitions for Linux running on a Hitachi Super-H.
+   Copyright (C) 2000 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.  */
+
+/* Pull in Linux generic defs */
+#include "tm-linux.h"
+
+/* Pull in sh-target defs */
+#include "sh/tm-sh.h"
+
+/* Use target_specific function to define link map offsets.  */
+extern struct link_map_offsets *sh_linux_svr4_fetch_link_map_offsets (void);
+#define SVR4_FETCH_LINK_MAP_OFFSETS() sh_linux_svr4_fetch_link_map_offsets ()
+
diff --git a/gdb/config/sh/tm-sh.h b/gdb/config/sh/tm-sh.h
index ca6d9e5..b0c13ea 100644
--- a/gdb/config/sh/tm-sh.h
+++ b/gdb/config/sh/tm-sh.h
@@ -1,5 +1,5 @@
 /* Target-specific definition for a Hitachi Super-H.
-   Copyright (C) 1993 Free Software Foundation, Inc.
+   Copyright (C) 1993, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -20,275 +20,58 @@
 
 /* Contributed by Steve Chamberlain sac@cygnus.com */
 
-struct frame_info;
-struct frame_saved_regs;
-struct value;
-struct type;
+#define GDB_MULTI_ARCH 1
 
-#define GDB_TARGET_IS_SH
+/* Information that is dependent on the processor variant. */
+struct gdbarch_tdep
+  {
+    int FPUL_REGNUM;  /*                       sh3e, sh4 */
+    int FPSCR_REGNUM; /*                       sh3e, sh4 */
+    int SR_REGNUM;    /* sh-dsp, sh3, sh3-dsp, sh3e, sh4 */
+    int DSR_REGNUM;   /* sh-dsp,      sh3-dsp            */
+    int FP_LAST_REGNUM; /*                     sh3e, sh4 */
+    int A0G_REGNUM;   /* sh-dsp,      sh3-dsp            */
+    int A0_REGNUM;    /* sh-dsp,      sh3-dsp            */
+    int A1G_REGNUM;   /* sh-dsp,      sh3-dsp            */
+    int A1_REGNUM;    /* sh-dsp,      sh3-dsp            */
+    int M0_REGNUM;    /* sh-dsp,      sh3-dsp            */
+    int M1_REGNUM;    /* sh-dsp,      sh3-dsp            */
+    int X0_REGNUM;    /* sh-dsp,      sh3-dsp            */
+    int X1_REGNUM;    /* sh-dsp,      sh3-dsp            */
+    int Y0_REGNUM;    /* sh-dsp,      sh3-dsp            */
+    int Y1_REGNUM;    /* sh-dsp,      sh3-dsp            */
+    int MOD_REGNUM;   /* sh-dsp,      sh3-dsp            */
+    int SSR_REGNUM;   /*         sh3, sh3-dsp, sh3e, sh4 */
+    int SPC_REGNUM;   /*         sh3, sh3-dsp, sh3e, sh4 */
+    int RS_REGNUM;    /* sh-dsp,      sh3-dsp            */
+    int RE_REGNUM;    /* sh-dsp,      sh3-dsp            */
+    int DR0_REGNUM;   /*                             sh4 */
+    int DR_LAST_REGNUM; /*                           sh4 */
+    int FV0_REGNUM;   /*                             sh4 */
+    int FV_LAST_REGNUM; /*                           sh4 */
+  };
 
-#define IEEE_FLOAT (1)
+/* Registers common to all the SH variants. */
+enum
+  {
+    R0_REGNUM = 0,
+    STRUCT_RETURN_REGNUM = 2,
+    ARG0_REGNUM = 4,
+    ARGLAST_REGNUM = 7,
+    PR_REGNUM = 17,
+    GBR_REGNUM = 18,
+    VBR_REGNUM = 19,
+    MACH_REGNUM = 20,
+    MACL_REGNUM = 21,
+    SR_REGNUM = 22
+  };
 
-/* Define the bit, byte, and word ordering of the machine.  */
+#define NUM_REALREGS 59 /* used in remote-e7000.c which is not multiarched. */
 
-#define TARGET_BYTE_ORDER_SELECTABLE
+#define REGISTER_TYPE  long /* used in standalone.c */
 
+#define BIG_REMOTE_BREAKPOINT    { 0xc3, 0x20 } /* Used in remote.c */
+#define LITTLE_REMOTE_BREAKPOINT { 0x20, 0xc3 } /* Used in remote.c */
 
-/* Offset from address of function to start of its code.
-   Zero on most machines.  */
-
-#define FUNCTION_START_OFFSET 0
-
-/* Advance PC across any function entry prologue instructions
-   to reach some "real" code.  */
-
-extern CORE_ADDR sh_skip_prologue (CORE_ADDR);
-#define SKIP_PROLOGUE(ip) (sh_skip_prologue (ip))
-
-/* Immediately after a function call, return the saved pc.
-   Can't always go through the frames for this because on some machines
-   the new frame is not set up until the new function executes
-   some instructions.
-
-   The return address is the value saved in the PR register + 4  */
-
-#define SAVED_PC_AFTER_CALL(frame) (ADDR_BITS_REMOVE(read_register(PR_REGNUM)))
-
-/* Stack grows downward.  */
-
-#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
-
-/* Illegal instruction - used by the simulator for breakpoint
-   detection */
-
-#define BREAKPOINT {0xc3, 0xc3}	/* 0xc3c3 is trapa #c3, and it works in big
-				   and little endian modes  */
-
-#define BIG_REMOTE_BREAKPOINT    { 0xc3, 0x20 }
-#define LITTLE_REMOTE_BREAKPOINT { 0x20, 0xc3 }
-
-/* If your kernel resets the pc after the trap happens you may need to
-   define this before including this file.  */
-#define DECR_PC_AFTER_BREAK 0
-
-/* Say how long registers are.  */
-#define REGISTER_TYPE  long
-
-/* Say how much memory is needed to store a copy of the register set */
-#define REGISTER_BYTES    (NUM_REGS*4)
-
-/* Index within `registers' of the first byte of the space for
-   register N.  */
-
-#define REGISTER_BYTE(N)  ((N)*4)
-
-/* Number of bytes of storage in the actual machine representation
-   for register N.  */
-
-#define REGISTER_RAW_SIZE(N) 4
-
-#define REGISTER_VIRTUAL_SIZE(N) 4
-
-/* Largest value REGISTER_RAW_SIZE can have.  */
-
-#define MAX_REGISTER_RAW_SIZE 4
-
-/* Largest value REGISTER_VIRTUAL_SIZE can have.  */
-
-#define MAX_REGISTER_VIRTUAL_SIZE 4
-
-/* Return the GDB type object for the "standard" data type
-   of data in register N.  */
-
-#define REGISTER_VIRTUAL_TYPE(N) \
-	(((((N) >= FP0_REGNUM && (N) <= FP15_REGNUM)		\
-	   || (N) == FPUL_REGNUM)				\
-	  && TARGET_ARCHITECTURE->mach != bfd_mach_sh_dsp	\
-	  && TARGET_ARCHITECTURE->mach != bfd_mach_sh3_dsp)	\
-	 ? builtin_type_float : builtin_type_int)
-
-/* Initializer for an array of names of registers.
-   Entries beyond the first NUM_REGS are ignored.  */
-
-extern char **sh_register_names;
-#define REGISTER_NAME(i) sh_register_names[i]
-
-#define NUM_REGS 59
-
-/* Register numbers of various important registers.  Note that some of
-   these values are "real" register numbers, and correspond to the
-   general registers of the machine, and some are "phony" register
-   numbers which are too large to be actual register numbers as far as
-   the user is concerned but do serve to get the desired values when
-   passed to read_register.  */
-
-#define R0_REGNUM	0
-#define STRUCT_RETURN_REGNUM 2
-#define ARG0_REGNUM     4
-#define ARGLAST_REGNUM  7
-#define FP_REGNUM 	14
-#define SP_REGNUM 	15
-#define PC_REGNUM 	16
-#define PR_REGNUM 	17
-#define GBR_REGNUM 	18
-#define VBR_REGNUM 	19
-#define MACH_REGNUM 	20
-#define MACL_REGNUM 	21
-#define SR_REGNUM 	22
-#define FPUL_REGNUM	23
-#define FPSCR_REGNUM	24
-#define DSR_REGNUM	24
-#define FP0_REGNUM	25
-#define FP15_REGNUM	40
-#define A0G_REGNUM	25
-#define A0_REGNUM	26
-#define A1G_REGNUM	27
-#define A1_REGNUM	28
-#define M0_REGNUM	29
-#define M1_REGNUM	30
-#define X0_REGNUM	31
-#define X1_REGNUM	32
-#define Y0_REGNUM	33
-#define Y1_REGNUM	34
-#define MOD_REGNUM	40
-#define SSR_REGNUM	41
-#define SPC_REGNUM	42
-#define R0B0_REGNUM	43
-#define R0B1_REGNUM	51
-#define RS_REGNUM	43
-#define RE_REGNUM	44
-#define R0B_REGNUM	51
-
-#define NUM_REALREGS	59
-
-/* Store the address of the place in which to copy the structure the
-   subroutine will return.  This is called from call_function.
-
-   We store structs through a pointer passed in R0 */
-
-#define STORE_STRUCT_RETURN(ADDR, SP) \
-    { write_register (STRUCT_RETURN_REGNUM, (ADDR));  }
-
-extern use_struct_convention_fn sh_use_struct_convention;
-#define USE_STRUCT_CONVENTION(gcc_p, type) sh_use_struct_convention (gcc_p, type)
-
-/* Extract from an array REGBUF containing the (raw) register state
-   a function return value of type TYPE, and copy that, in virtual format,
-   into VALBUF.  */
-
-extern void sh_extract_return_value (struct type *, void *, void *);
-#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
-	sh_extract_return_value (TYPE, REGBUF, VALBUF)
-
-/* Write into appropriate registers a function return value
-   of type TYPE, given in virtual format.
-
-   Things always get returned in R0/R1 */
-
-#define STORE_RETURN_VALUE(TYPE,VALBUF) \
-  write_register_bytes (REGISTER_BYTE(0), VALBUF, TYPE_LENGTH (TYPE))
-
-/* 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).  */
-
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
-     extract_address (REGBUF, REGISTER_RAW_SIZE (0))
-
-
-/* Define other aspects of the stack frame.
-   we keep a copy of the worked out return pc lying around, since it
-   is a useful bit of info */
-
-#define EXTRA_FRAME_INFO \
-    CORE_ADDR return_pc; \
-    int leaf_function;   \
-    int f_offset;
-
-#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \
-    sh_init_extra_frame_info(fromleaf, fi)
-extern void sh_init_extra_frame_info (int, struct frame_info *);
-
-/* A macro that tells us whether the function invocation represented
-   by FI does not have a frame on the stack associated with it.  If it
-   does not, FRAMELESS is set to 1, else 0.  */
-
-#define FRAMELESS_FUNCTION_INVOCATION(FI) \
-  (frameless_look_for_prologue(FI))
-
-#define FRAME_SAVED_PC(FRAME)		((FRAME)->return_pc)
-#define FRAME_ARGS_ADDRESS(fi)   	((fi)->frame)
-#define FRAME_LOCALS_ADDRESS(fi) 	((fi)->frame)
-
-/* Set VAL to the number of args passed to frame described by FI.
-   Can set VAL to -1, meaning no way to tell.  */
-
-/* We can't tell how many args there are */
-
-#define FRAME_NUM_ARGS(fi) (-1)
-
-/* Return number of bytes at start of arglist that are not really args.  */
-
-#define FRAME_ARGS_SKIP 0
-
-extern void sh_frame_find_saved_regs (struct frame_info *fi,
-				      struct frame_saved_regs *fsr);
-
-/* Put here the code to store, into a struct frame_saved_regs,
-   the addresses of 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.  */
-
-#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs)	    \
-   sh_frame_find_saved_regs(frame_info, &(frame_saved_regs))
-
-typedef unsigned short INSN_WORD;
-
-extern CORE_ADDR sh_push_arguments (int nargs,
-				    struct value **args,
-				    CORE_ADDR sp,
-				    unsigned char struct_return,
-				    CORE_ADDR struct_addr);
-
-#define USE_GENERIC_DUMMY_FRAMES 1
-#define CALL_DUMMY                   {0}
-#define CALL_DUMMY_LENGTH            (0)
-#define CALL_DUMMY_START_OFFSET      (0)
-#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
-#define FIX_CALL_DUMMY(DUMMY, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP)
-#define CALL_DUMMY_LOCATION          AT_ENTRY_POINT
-#define CALL_DUMMY_ADDRESS()         entry_point_address ()
-extern CORE_ADDR sh_push_return_address (CORE_ADDR, CORE_ADDR);
-#define PUSH_RETURN_ADDRESS(PC, SP)  sh_push_return_address (PC, SP)
-
-
-extern CORE_ADDR sh_frame_chain (struct frame_info *);
-#define FRAME_CHAIN(FRAME)           sh_frame_chain(FRAME)
-#define PUSH_DUMMY_FRAME             generic_push_dummy_frame ()
-#define FRAME_CHAIN_VALID(FP, FRAME) generic_file_frame_chain_valid (FP, FRAME)
-#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
-#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
-    (sh_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
-
-/* override the standard get_saved_register function with
-   one that takes account of generic CALL_DUMMY frames */
-#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
-     generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
-
-/* Discard from the stack the innermost frame, restoring all saved
-   registers.  */
-
-extern void sh_pop_frame (void);
-#define POP_FRAME sh_pop_frame();
-
-#define NOP   {0x20, 0x0b}
-
-#define REGISTER_SIZE 4
-
-#define COERCE_FLOAT_TO_DOUBLE(formal, actual) (1)
-
-#define BELIEVE_PCC_PROMOTION 1
+/*#define NOP   {0x20, 0x0b}*/ /* Who uses this???*/
 
-/* Need this for WinGDB.  See gdb/mswin/{regdoc.h, gdbwin.c, gui.cpp}.  */
-#define TARGET_SH
diff --git a/gdb/config/sparc/linux.mh b/gdb/config/sparc/linux.mh
index 4ad98c2..937be17 100644
--- a/gdb/config/sparc/linux.mh
+++ b/gdb/config/sparc/linux.mh
@@ -1,5 +1,5 @@
 # Host: Sparcstation, running Linux
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 XM_FILE= xm-linux.h
 NAT_FILE= nm-linux.h
 NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \
diff --git a/gdb/config/sparc/linux.mt b/gdb/config/sparc/linux.mt
index ca422e9..186c650 100644
--- a/gdb/config/sparc/linux.mt
+++ b/gdb/config/sparc/linux.mt
@@ -1,3 +1,3 @@
 # Target: Sparcstation, running Linux
-TDEPFILES= sparc-tdep.o solib.o
+TDEPFILES= sparc-tdep.o solib.o solib-svr4.o
 TM_FILE= tm-linux.h
diff --git a/gdb/config/sparc/nbsd.mh b/gdb/config/sparc/nbsd.mh
index 292cc2b..8974e75 100644
--- a/gdb/config/sparc/nbsd.mh
+++ b/gdb/config/sparc/nbsd.mh
@@ -1,6 +1,6 @@
 # Host: Sun 4 or Sparcstation, running NetBSD
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 XM_FILE= xm-nbsd.h
 NAT_FILE= nm-nbsd.h
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o solib.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o
 HOST_IPC=-DBSD_IPC
diff --git a/gdb/config/sparc/nbsd.mt b/gdb/config/sparc/nbsd.mt
index 5c89318..7735cf2 100644
--- a/gdb/config/sparc/nbsd.mt
+++ b/gdb/config/sparc/nbsd.mt
@@ -1,3 +1,3 @@
 # Target: Sun 4 or Sparcstation, running NetBSD
-TDEPFILES= sparc-tdep.o
+TDEPFILES= sparc-tdep.o solib.o solib-svr4.o
 TM_FILE= tm-nbsd.h
diff --git a/gdb/config/sparc/nbsdelf.mh b/gdb/config/sparc/nbsdelf.mh
index d76e7cb..8211a4f 100644
--- a/gdb/config/sparc/nbsdelf.mh
+++ b/gdb/config/sparc/nbsdelf.mh
@@ -1,6 +1,6 @@
 # Host: Sun 4 or Sparcstation, running NetBSD
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 XM_FILE= xm-nbsd.h
 NAT_FILE= nm-nbsdelf.h
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o solib.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o 
 HOST_IPC=-DBSD_IPC
diff --git a/gdb/config/sparc/nm-nbsd.h b/gdb/config/sparc/nm-nbsd.h
index 72f77b9..2188aa3 100644
--- a/gdb/config/sparc/nm-nbsd.h
+++ b/gdb/config/sparc/nm-nbsd.h
@@ -53,4 +53,7 @@
 #define PTRACE_SETREGS	 PT_SETREGS
 #define PTRACE_SETFPREGS PT_SETFPREGS
 
+#define GDB_GREGSET_T	struct reg
+#define GDB_FPREGSET_T	struct fpreg
+
 #endif /* NM_NBSD_H */
diff --git a/gdb/config/sparc/sparclynx.mh b/gdb/config/sparc/sparclynx.mh
index 6fddddd..4f5bb4d 100644
--- a/gdb/config/sparc/sparclynx.mh
+++ b/gdb/config/sparc/sparclynx.mh
@@ -1,7 +1,7 @@
 # Host: Sparc running LynxOS
 
 XM_FILE= xm-sparclynx.h
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 XM_CLIBS= -lbsd
 
 NAT_FILE= nm-sparclynx.h
diff --git a/gdb/config/sparc/sun4os4.mh b/gdb/config/sparc/sun4os4.mh
index 4047c5c..4392a0c 100644
--- a/gdb/config/sparc/sun4os4.mh
+++ b/gdb/config/sparc/sun4os4.mh
@@ -1,5 +1,5 @@
 # Host: Sun 4 or Sparcstation, running SunOS 4
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 XM_FILE= xm-sun4os4.h
 NAT_FILE= nm-sun4os4.h
 NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o
diff --git a/gdb/config/sparc/sun4os4.mt b/gdb/config/sparc/sun4os4.mt
index 5a4ecb9..0dd4bc0 100644
--- a/gdb/config/sparc/sun4os4.mt
+++ b/gdb/config/sparc/sun4os4.mt
@@ -1,3 +1,3 @@
 # Target: Sun 4 or Sparcstation, running SunOS 4
-TDEPFILES= sparc-tdep.o solib.o
+TDEPFILES= sparc-tdep.o solib.o solib-svr4.o
 TM_FILE= tm-sun4os4.h
diff --git a/gdb/config/sparc/sun4sol2.mh b/gdb/config/sparc/sun4sol2.mh
index b9ab28e..4ab69c5 100644
--- a/gdb/config/sparc/sun4sol2.mh
+++ b/gdb/config/sparc/sun4sol2.mh
@@ -1,11 +1,11 @@
 # Host: Sun 4 or Sparcstation, running Solaris 2
 
 XM_FILE= xm-sun4sol2.h
-XDEPFILES= ser-tcp.o
+XDEPFILES=
 XM_CLIBS= -lsocket -lnsl
 
 NAT_FILE= nm-sun4sol2.h
-NATDEPFILES= corelow.o core-sol2.o solib.o fork-child.o procfs.o \
+NATDEPFILES= corelow.o core-sol2.o solib.o solib-svr4.o fork-child.o procfs.o \
 	proc-api.o proc-events.o proc-flags.o proc-why.o
 
 # If you are compiling with Sun's compiler, add the -xs option to CC
diff --git a/gdb/config/sparc/xm-sun4sol2.h b/gdb/config/sparc/xm-sun4sol2.h
index 3edb5ab..43f6166 100644
--- a/gdb/config/sparc/xm-sun4sol2.h
+++ b/gdb/config/sparc/xm-sun4sol2.h
@@ -39,5 +39,5 @@
 
 /* On sol2.7, <curses.h> emits a bunch of 'macro redefined'
    warnings, which makes autoconf think curses.h doesn't
-   exist.  Compensate fot that here. */
+   exist.  Compensate for that here. */
 #define HAVE_CURSES_H 1
diff --git a/gdb/config/tahoe/tm-tahoe.h b/gdb/config/tahoe/tm-tahoe.h
index 0dc3e0e..b68e278 100644
--- a/gdb/config/tahoe/tm-tahoe.h
+++ b/gdb/config/tahoe/tm-tahoe.h
Binary files differ
diff --git a/gdb/config/tm-linux.h b/gdb/config/tm-linux.h
index d1040ac..0b4db5a 100644
--- a/gdb/config/tm-linux.h
+++ b/gdb/config/tm-linux.h
@@ -34,3 +34,12 @@
 /* We need this file for the SOLIB_TRAMPOLINE stuff. */
 
 #include "tm-sysv4.h"
+
+/* We define SVR4_SHARED_LIBS unconditionally, on the assumption that
+   link.h is available on all linux platforms.  For I386 and SH3/4, 
+   we hard-code the information rather than use link.h anyway (for 
+   the benefit of cross-debugging).  We may move to doing that for
+   other architectures as well.  */
+
+#define SVR4_SHARED_LIBS
+#include "solib.h"		/* Support for shared libraries. */
diff --git a/gdb/configure b/gdb/configure
index 9c5c4a6..09170ed 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -21,14 +21,20 @@
 ac_help="$ac_help
   --enable-multi-ice            Build the multi-ice-gdb-server"
 ac_help="$ac_help
+  --enable-gdbcli            Enable GDB-CLI interface"
+ac_help="$ac_help
   --enable-gdbmi            Enable GDB-MI interface"
 ac_help="$ac_help
+  --with-uiout          Use new uiout functions intead of *printf's"
+ac_help="$ac_help
   --enable-tui            Enable full-screen terminal user interface"
 ac_help="$ac_help
   --enable-netrom         Enable NetROM support"
 ac_help="$ac_help
   --enable-build-warnings Enable build-time compiler warnings if gcc is used"
 ac_help="$ac_help
+  --enable-gdb-build-warnings Enable GDB specific build-time compiler warnings if gcc is used"
+ac_help="$ac_help
   --with-mmalloc          Use memory mapped malloc package"
 ac_help="$ac_help
   --with-included-regex          Use included regex"
@@ -73,6 +79,7 @@
 program_transform_name=s,x,x,
 silent=
 site=
+sitefile=
 srcdir=
 target=NONE
 verbose=
@@ -187,6 +194,7 @@
   --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
@@ -357,6 +365,11 @@
   -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=*)
@@ -522,12 +535,16 @@
 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"
+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
@@ -568,7 +585,7 @@
 
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:572: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:589: 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"
@@ -594,7 +611,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:598: checking for $ac_word" >&5
+echo "configure:615: 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
@@ -624,7 +641,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:628: checking for $ac_word" >&5
+echo "configure:645: 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
@@ -675,7 +692,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:679: checking for $ac_word" >&5
+echo "configure:696: 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
@@ -707,7 +724,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:711: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:728: 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.
@@ -718,12 +735,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 722 "configure"
+#line 739 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:744: \"$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
@@ -749,12 +766,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:753: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:770: 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:758: checking whether we are using GNU C" >&5
+echo "configure:775: 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
@@ -763,7 +780,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:767: \"$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:784: \"$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
@@ -782,7 +799,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:786: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:803: 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
@@ -814,7 +831,7 @@
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:818: checking how to run the C preprocessor" >&5
+echo "configure:835: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -829,23 +846,6 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 833 "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:839: \"$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 850 "configure"
 #include "confdefs.h"
 #include <assert.h>
@@ -861,7 +861,7 @@
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  CPP="${CC-cc} -nologo -E"
+  CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
 #line 867 "configure"
 #include "confdefs.h"
@@ -878,6 +878,23 @@
   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 884 "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:890: \"$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*
@@ -894,9 +911,9 @@
 echo "$ac_t""$CPP" 1>&6
 
 echo $ac_n "checking for AIX""... $ac_c" 1>&6
-echo "configure:898: checking for AIX" >&5
+echo "configure:915: checking for AIX" >&5
 cat > conftest.$ac_ext <<EOF
-#line 900 "configure"
+#line 917 "configure"
 #include "confdefs.h"
 #ifdef _AIX
   yes
@@ -918,7 +935,7 @@
 
 
 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:922: checking for POSIXized ISC" >&5
+echo "configure:939: 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
@@ -942,7 +959,7 @@
 
 
 echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
-echo "configure:946: checking for ${CC-cc} option to accept ANSI C" >&5
+echo "configure:963: checking for ${CC-cc} option to accept ANSI C" >&5
 if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -958,7 +975,7 @@
 do
   CC="$ac_save_CC $ac_arg"
   cat > conftest.$ac_ext <<EOF
-#line 962 "configure"
+#line 979 "configure"
 #include "confdefs.h"
 #include <stdarg.h>
 #include <stdio.h>
@@ -995,7 +1012,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:999: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1016: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   am_cv_prog_cc_stdc="$ac_arg"; break
 else
@@ -1066,7 +1083,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:1070: checking host system type" >&5
+echo "configure:1087: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -1087,7 +1104,7 @@
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:1091: checking target system type" >&5
+echo "configure:1108: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
@@ -1105,7 +1122,7 @@
 echo "$ac_t""$target" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1109: checking build system type" >&5
+echo "configure:1126: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -1130,7 +1147,7 @@
 
 ALL_LINGUAS=
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1134: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1151: 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
@@ -1159,7 +1176,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:1163: checking for $ac_word" >&5
+echo "configure:1180: 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
@@ -1187,12 +1204,12 @@
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1191: checking for ANSI C header files" >&5
+echo "configure:1208: 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 1196 "configure"
+#line 1213 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1200,7 +1217,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1221: \"$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*
@@ -1217,7 +1234,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 1221 "configure"
+#line 1238 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1235,7 +1252,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 1239 "configure"
+#line 1256 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1256,7 +1273,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1260 "configure"
+#line 1277 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1267,7 +1284,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:1271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1291,12 +1308,12 @@
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1295: checking for working const" >&5
+echo "configure:1312: 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 1300 "configure"
+#line 1317 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1345,7 +1362,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1349: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1366: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -1366,21 +1383,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:1370: checking for inline" >&5
+echo "configure:1387: 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 1377 "configure"
+#line 1394 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:1384: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1401: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -1406,12 +1423,12 @@
 esac
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:1410: checking for off_t" >&5
+echo "configure:1427: 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 1415 "configure"
+#line 1432 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1439,12 +1456,12 @@
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1443: checking for size_t" >&5
+echo "configure:1460: 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 1448 "configure"
+#line 1465 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1474,19 +1491,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:1478: checking for working alloca.h" >&5
+echo "configure:1495: 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 1483 "configure"
+#line 1500 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:1490: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1507: \"$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
@@ -1507,12 +1524,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:1511: checking for alloca" >&5
+echo "configure:1528: 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 1516 "configure"
+#line 1533 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -1540,7 +1557,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:1544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1561: \"$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
@@ -1572,12 +1589,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:1576: checking whether alloca needs Cray hooks" >&5
+echo "configure:1593: 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 1581 "configure"
+#line 1598 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -1602,12 +1619,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:1606: checking for $ac_func" >&5
+echo "configure:1623: 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 1611 "configure"
+#line 1628 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1630,7 +1647,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1651: \"$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
@@ -1657,7 +1674,7 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:1661: checking stack direction for C alloca" >&5
+echo "configure:1678: 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
@@ -1665,7 +1682,7 @@
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 1669 "configure"
+#line 1686 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -1684,7 +1701,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:1688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1705: \"$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
@@ -1709,17 +1726,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1713: checking for $ac_hdr" >&5
+echo "configure:1730: 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 1718 "configure"
+#line 1735 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1723: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1740: \"$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*
@@ -1748,12 +1765,12 @@
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1752: checking for $ac_func" >&5
+echo "configure:1769: 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 1757 "configure"
+#line 1774 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1776,7 +1793,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1797: \"$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
@@ -1801,7 +1818,7 @@
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:1805: checking for working mmap" >&5
+echo "configure:1822: 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
@@ -1809,7 +1826,7 @@
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 1813 "configure"
+#line 1830 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -1949,7 +1966,7 @@
 }
 
 EOF
-if { (eval echo configure:1953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1970: \"$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
@@ -1977,17 +1994,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1981: checking for $ac_hdr" >&5
+echo "configure:1998: 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 1986 "configure"
+#line 2003 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1991: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2008: \"$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*
@@ -2017,12 +2034,12 @@
 __argz_count __argz_stringify __argz_next
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2021: checking for $ac_func" >&5
+echo "configure:2038: 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 2026 "configure"
+#line 2043 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2045,7 +2062,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2066: \"$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
@@ -2074,12 +2091,12 @@
      for ac_func in stpcpy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2078: checking for $ac_func" >&5
+echo "configure:2095: 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 2083 "configure"
+#line 2100 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2102,7 +2119,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2123: \"$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
@@ -2136,19 +2153,19 @@
 
    if test $ac_cv_header_locale_h = yes; then
     echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:2140: checking for LC_MESSAGES" >&5
+echo "configure:2157: 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 2145 "configure"
+#line 2162 "configure"
 #include "confdefs.h"
 #include <locale.h>
 int main() {
 return LC_MESSAGES
 ; return 0; }
 EOF
-if { (eval echo configure:2152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2169: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   am_cv_val_LC_MESSAGES=yes
 else
@@ -2169,7 +2186,7 @@
     fi
   fi
    echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:2173: checking whether NLS is requested" >&5
+echo "configure:2190: 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"
@@ -2189,7 +2206,7 @@
 EOF
 
       echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:2193: checking whether included gettext is requested" >&5
+echo "configure:2210: 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"
@@ -2208,17 +2225,17 @@
 
 	ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:2212: checking for libintl.h" >&5
+echo "configure:2229: 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 2217 "configure"
+#line 2234 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2222: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2239: \"$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*
@@ -2235,19 +2252,19 @@
 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:2239: checking for gettext in libc" >&5
+echo "configure:2256: 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 2244 "configure"
+#line 2261 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:2251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   gt_cv_func_gettext_libc=yes
 else
@@ -2263,7 +2280,7 @@
 
 	   if test "$gt_cv_func_gettext_libc" != "yes"; then
 	     echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:2267: checking for bindtextdomain in -lintl" >&5
+echo "configure:2284: 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
@@ -2271,7 +2288,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lintl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2275 "configure"
+#line 2292 "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
@@ -2282,7 +2299,7 @@
 bindtextdomain()
 ; return 0; }
 EOF
-if { (eval echo configure:2286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2303: \"$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
@@ -2298,19 +2315,19 @@
 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:2302: checking for gettext in libintl" >&5
+echo "configure:2319: 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 2307 "configure"
+#line 2324 "configure"
 #include "confdefs.h"
 
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:2314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   gt_cv_func_gettext_libintl=yes
 else
@@ -2338,7 +2355,7 @@
 	      # 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:2342: checking for $ac_word" >&5
+echo "configure:2359: 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
@@ -2372,12 +2389,12 @@
 		for ac_func in dcgettext
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2376: checking for $ac_func" >&5
+echo "configure:2393: 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 2381 "configure"
+#line 2398 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2400,7 +2417,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2421: \"$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
@@ -2427,7 +2444,7 @@
 		# 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:2431: checking for $ac_word" >&5
+echo "configure:2448: 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
@@ -2463,7 +2480,7 @@
 		# 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:2467: checking for $ac_word" >&5
+echo "configure:2484: 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
@@ -2495,7 +2512,7 @@
 fi
 
 		cat > conftest.$ac_ext <<EOF
-#line 2499 "configure"
+#line 2516 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2503,7 +2520,7 @@
 			       return _nl_msg_cat_cntr
 ; return 0; }
 EOF
-if { (eval echo configure:2507: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   CATOBJEXT=.gmo
 		   DATADIRNAME=share
@@ -2535,7 +2552,7 @@
         # 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:2539: checking for $ac_word" >&5
+echo "configure:2556: 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
@@ -2569,7 +2586,7 @@
         # 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:2573: checking for $ac_word" >&5
+echo "configure:2590: 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
@@ -2605,7 +2622,7 @@
         # 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:2609: checking for $ac_word" >&5
+echo "configure:2626: 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
@@ -2695,7 +2712,7 @@
        LINGUAS=
      else
        echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:2699: checking for catalogs to be installed" >&5
+echo "configure:2716: checking for catalogs to be installed" >&5
        NEW_LINGUAS=
        for lang in ${LINGUAS=$ALL_LINGUAS}; do
          case "$ALL_LINGUAS" in
@@ -2723,17 +2740,17 @@
       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:2727: checking for linux/version.h" >&5
+echo "configure:2744: 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 2732 "configure"
+#line 2749 "configure"
 #include "confdefs.h"
 #include <linux/version.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2737: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2754: \"$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*
@@ -2797,6 +2814,7 @@
 
 
 CONFIG_OBS=
+CONFIG_LIB_OBS=
 CONFIG_DEPS=
 CONFIG_SRCS=
 CONFIG_INITS=
@@ -2829,13 +2847,33 @@
 
 . ${srcdir}/configure.tgt
 
+targ=${target} ; . ${srcdir}/../bfd/config.bfd
+
+
+targ=${target}
+. ${srcdir}/../bfd/config.bfd
+
+targ_archs=`echo ${targ_archs} | sed -e 's/ .*//;'`
+
+if test x"${targ_archs}" != x ; then
+    cat >> confdefs.h <<EOF
+#define DEFAULT_BFD_ARCH ${targ_archs}
+EOF
+
+fi
+if test x"${targ_defvec}" != x ; then
+    cat >> confdefs.h <<EOF
+#define DEFAULT_BFD_VEC ${targ_defvec}
+EOF
+
+fi
 
 for ac_prog in mawk gawk nawk awk
 do
 # 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:2839: checking for $ac_word" >&5
+echo "configure:2877: 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
@@ -2876,7 +2914,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:2880: checking for a BSD compatible install" >&5
+echo "configure:2918: 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
@@ -2937,7 +2975,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:2941: checking for $ac_word" >&5
+echo "configure:2979: 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
@@ -2969,7 +3007,7 @@
 # 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:2973: checking for $ac_word" >&5
+echo "configure:3011: 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
@@ -3001,7 +3039,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:3005: checking for $ac_word" >&5
+echo "configure:3043: 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
@@ -3036,7 +3074,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:3040: checking for $ac_word" >&5
+echo "configure:3078: 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
@@ -3068,7 +3106,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:3072: checking for $ac_word" >&5
+echo "configure:3110: 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
@@ -3102,7 +3140,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:3106: checking for $ac_word" >&5
+echo "configure:3144: 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
@@ -3136,7 +3174,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:3140: checking for $ac_word" >&5
+echo "configure:3178: 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
@@ -3187,12 +3225,12 @@
 
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:3191: checking return type of signal handlers" >&5
+echo "configure:3229: 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 3196 "configure"
+#line 3234 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -3209,7 +3247,7 @@
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:3213: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3251: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -3229,12 +3267,12 @@
 
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:3233: checking for ANSI C header files" >&5
+echo "configure:3271: 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 3238 "configure"
+#line 3276 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -3242,7 +3280,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3246: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3284: \"$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*
@@ -3259,7 +3297,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 3263 "configure"
+#line 3301 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -3277,7 +3315,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 3281 "configure"
+#line 3319 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -3298,7 +3336,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 3302 "configure"
+#line 3340 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -3309,7 +3347,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:3313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3351: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -3334,7 +3372,7 @@
 
 
 
-case $host_os in solaris2.7) case "$GCC" in yes)
+case $host_os in solaris2.7 | solaris2.8) case "$GCC" in yes)
     cat >> confdefs.h <<\EOF
 #define _MSE_INT_H 1
 EOF
@@ -3348,21 +3386,22 @@
 	wchar.h wctype.h asm/debugreg.h sys/debugreg.h sys/select.h \
 	time.h sys/ioctl.h sys/user.h \
 	dirent.h sys/ndir.h sys/dir.h ndir.h \
-	curses.h ncurses.h
+	curses.h ncurses.h \
+	poll.h sys/poll.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3356: checking for $ac_hdr" >&5
+echo "configure:3395: 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 3361 "configure"
+#line 3400 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3366: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3405: \"$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*
@@ -3389,12 +3428,12 @@
 done
 
 echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:3393: checking whether stat file-mode macros are broken" >&5
+echo "configure:3432: 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 3398 "configure"
+#line 3437 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -3446,12 +3485,12 @@
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:3450: checking for working const" >&5
+echo "configure:3489: 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 3455 "configure"
+#line 3494 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3500,7 +3539,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3504: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3543: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -3521,15 +3560,15 @@
 fi
 
 
-for ac_func in setpgid sbrk sigaction isascii bzero bcopy btowc poll sigprocmask
+for ac_func in setpgid sbrk sigaction isascii bzero bcopy btowc poll sigprocmask vfork
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3528: checking for $ac_func" >&5
+echo "configure:3567: 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 3533 "configure"
+#line 3572 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3552,7 +3591,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3556: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3595: \"$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
@@ -3579,19 +3618,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:3583: checking for working alloca.h" >&5
+echo "configure:3622: 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 3588 "configure"
+#line 3627 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:3595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3634: \"$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
@@ -3612,12 +3651,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:3616: checking for alloca" >&5
+echo "configure:3655: 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 3621 "configure"
+#line 3660 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -3645,7 +3684,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:3649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3688: \"$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
@@ -3677,12 +3716,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:3681: checking whether alloca needs Cray hooks" >&5
+echo "configure:3720: 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 3686 "configure"
+#line 3725 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -3707,12 +3746,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:3711: checking for $ac_func" >&5
+echo "configure:3750: 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 3716 "configure"
+#line 3755 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3735,7 +3774,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3778: \"$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
@@ -3762,7 +3801,7 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:3766: checking stack direction for C alloca" >&5
+echo "configure:3805: 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
@@ -3770,7 +3809,7 @@
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 3774 "configure"
+#line 3813 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -3789,7 +3828,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:3793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3832: \"$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
@@ -3814,19 +3853,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:3818: checking for r_fs in struct reg" >&5
+echo "configure:3857: 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 3823 "configure"
+#line 3862 "configure"
 #include "confdefs.h"
 #include <machine/reg.h>
 int main() {
 struct reg r; r.r_fs;
 ; return 0; }
 EOF
-if { (eval echo configure:3830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_struct_reg_r_fs=yes
 else
@@ -3846,19 +3885,19 @@
 
 fi
 echo $ac_n "checking for r_gs in struct reg""... $ac_c" 1>&6
-echo "configure:3850: checking for r_gs in struct reg" >&5
+echo "configure:3889: 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 3855 "configure"
+#line 3894 "configure"
 #include "confdefs.h"
 #include <machine/reg.h>
 int main() {
 struct reg r; r.r_gs;
 ; return 0; }
 EOF
-if { (eval echo configure:3862: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_struct_reg_r_gs=yes
 else
@@ -3879,19 +3918,19 @@
 fi
 
 echo $ac_n "checking for PTRACE_GETREGS""... $ac_c" 1>&6
-echo "configure:3883: checking for PTRACE_GETREGS" >&5
+echo "configure:3922: 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 3888 "configure"
+#line 3927 "configure"
 #include "confdefs.h"
 #include <sys/ptrace.h>
 int main() {
 PTRACE_GETREGS;
 ; return 0; }
 EOF
-if { (eval echo configure:3895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_ptrace_getregs=yes
 else
@@ -3911,41 +3950,41 @@
 
 fi
 
-echo $ac_n "checking for PTRACE_GETXFPREGS""... $ac_c" 1>&6
-echo "configure:3916: checking for PTRACE_GETXFPREGS" >&5
-if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getxfpregs'+set}'`\" = set"; then
+echo $ac_n "checking for PTRACE_GETFPXREGS""... $ac_c" 1>&6
+echo "configure:3955: 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 3921 "configure"
+#line 3960 "configure"
 #include "confdefs.h"
 #include <sys/ptrace.h>
 int main() {
-PTRACE_GETXFPREGS;
+PTRACE_GETFPXREGS;
 ; return 0; }
 EOF
-if { (eval echo configure:3928: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3967: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  gdb_cv_have_ptrace_getxfpregs=yes
+  gdb_cv_have_ptrace_getfpxregs=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  gdb_cv_have_ptrace_getxfpregs=no
+  gdb_cv_have_ptrace_getfpxregs=no
 fi
 rm -f conftest*
 fi
 
-echo "$ac_t""$gdb_cv_have_ptrace_getxfpregs" 1>&6
-if test $gdb_cv_have_ptrace_getxfpregs = yes; then
+echo "$ac_t""$gdb_cv_have_ptrace_getfpxregs" 1>&6
+if test $gdb_cv_have_ptrace_getfpxregs = yes; then
   cat >> confdefs.h <<\EOF
-#define HAVE_PTRACE_GETXFPREGS 1
+#define HAVE_PTRACE_GETFPXREGS 1
 EOF
 
 fi
 
 echo $ac_n "checking for socketpair in -lsocket""... $ac_c" 1>&6
-echo "configure:3949: checking for socketpair in -lsocket" >&5
+echo "configure:3988: checking for socketpair in -lsocket" >&5
 ac_lib_var=`echo socket'_'socketpair | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3953,7 +3992,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3957 "configure"
+#line 3996 "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
@@ -3964,7 +4003,7 @@
 socketpair()
 ; return 0; }
 EOF
-if { (eval echo configure:3968: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4007: \"$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
@@ -3994,12 +4033,12 @@
 for ac_func in socketpair
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3998: checking for $ac_func" >&5
+echo "configure:4037: 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 4003 "configure"
+#line 4042 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4022,7 +4061,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4065: \"$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
@@ -4049,12 +4088,12 @@
 
 
 echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6
-echo "configure:4053: checking whether malloc must be declared" >&5
+echo "configure:4092: 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 4058 "configure"
+#line 4097 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4075,7 +4114,7 @@
 char *(*pfn) = (char *(*)) malloc
 ; return 0; }
 EOF
-if { (eval echo configure:4079: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_malloc=no
 else
@@ -4096,12 +4135,12 @@
 fi
 
 echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6
-echo "configure:4100: checking whether realloc must be declared" >&5
+echo "configure:4139: 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 4105 "configure"
+#line 4144 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4122,7 +4161,7 @@
 char *(*pfn) = (char *(*)) realloc
 ; return 0; }
 EOF
-if { (eval echo configure:4126: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4165: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_realloc=no
 else
@@ -4143,12 +4182,12 @@
 fi
 
 echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6
-echo "configure:4147: checking whether free must be declared" >&5
+echo "configure:4186: 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 4152 "configure"
+#line 4191 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4169,7 +4208,7 @@
 char *(*pfn) = (char *(*)) free
 ; return 0; }
 EOF
-if { (eval echo configure:4173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4212: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_free=no
 else
@@ -4190,12 +4229,12 @@
 fi
 
 echo $ac_n "checking whether strerror must be declared""... $ac_c" 1>&6
-echo "configure:4194: checking whether strerror must be declared" >&5
+echo "configure:4233: 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 4199 "configure"
+#line 4238 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4216,7 +4255,7 @@
 char *(*pfn) = (char *(*)) strerror
 ; return 0; }
 EOF
-if { (eval echo configure:4220: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4259: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_strerror=no
 else
@@ -4237,12 +4276,12 @@
 fi
 
 echo $ac_n "checking whether strdup must be declared""... $ac_c" 1>&6
-echo "configure:4241: checking whether strdup must be declared" >&5
+echo "configure:4280: 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 4246 "configure"
+#line 4285 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4263,7 +4302,7 @@
 char *(*pfn) = (char *(*)) strdup
 ; return 0; }
 EOF
-if { (eval echo configure:4267: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4306: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_strdup=no
 else
@@ -4284,12 +4323,12 @@
 fi
 
 echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6
-echo "configure:4288: checking whether strstr must be declared" >&5
+echo "configure:4327: 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 4293 "configure"
+#line 4332 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -4310,7 +4349,7 @@
 char *(*pfn) = (char *(*)) strstr
 ; return 0; }
 EOF
-if { (eval echo configure:4314: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4353: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_strstr=no
 else
@@ -4337,9 +4376,9 @@
 # could be expunged. --jsm 1999-03-22
 
 echo $ac_n "checking for HPUX save_state structure""... $ac_c" 1>&6
-echo "configure:4341: checking for HPUX save_state structure" >&5
+echo "configure:4380: checking for HPUX save_state structure" >&5
 cat > conftest.$ac_ext <<EOF
-#line 4343 "configure"
+#line 4382 "configure"
 #include "confdefs.h"
 #include <machine/save_state.h>
 EOF
@@ -4354,7 +4393,7 @@
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 4358 "configure"
+#line 4397 "configure"
 #include "confdefs.h"
 #include <machine/save_state.h>
 EOF
@@ -4418,19 +4457,21 @@
 
 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:4422: checking for pstatus_t in sys/procfs.h" >&5
+echo "configure:4461: 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 4427 "configure"
+#line 4466 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 pstatus_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4434: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4475: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_pstatus_t=yes
 else
@@ -4452,19 +4493,21 @@
  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:4456: checking for prrun_t in sys/procfs.h" >&5
+echo "configure:4497: 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 4461 "configure"
+#line 4502 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 prrun_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4511: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prrun_t=yes
 else
@@ -4486,19 +4529,21 @@
  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:4490: checking for gregset_t in sys/procfs.h" >&5
+echo "configure:4533: 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 4495 "configure"
+#line 4538 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 gregset_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4502: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4547: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_gregset_t=yes
 else
@@ -4520,19 +4565,21 @@
  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:4524: checking for fpregset_t in sys/procfs.h" >&5
+echo "configure:4569: 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 4529 "configure"
+#line 4574 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 fpregset_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4536: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4583: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_fpregset_t=yes
 else
@@ -4554,19 +4601,21 @@
  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:4558: checking for prgregset_t in sys/procfs.h" >&5
+echo "configure:4605: 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 4563 "configure"
+#line 4610 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 prgregset_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prgregset_t=yes
 else
@@ -4588,19 +4637,21 @@
  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:4592: checking for prfpregset_t in sys/procfs.h" >&5
+echo "configure:4641: 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 4597 "configure"
+#line 4646 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 prfpregset_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prfpregset_t=yes
 else
@@ -4621,20 +4672,94 @@
  fi
  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:4677: 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 4682 "configure"
+#include "confdefs.h"
+
+#define _SYSCALL32
+#include <sys/procfs.h>
+int main() {
+prgregset32_t avar
+; return 0; }
+EOF
+if { (eval echo configure:4691: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_prgregset32_t=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_prgregset32_t=no
+   
+fi
+rm -f conftest*
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_prgregset32_t = yes; then
+   cat >> confdefs.h <<\EOF
+#define HAVE_PRGREGSET32_T 1
+EOF
+
+ fi
+ 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:4713: 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 4718 "configure"
+#include "confdefs.h"
+
+#define _SYSCALL32
+#include <sys/procfs.h>
+int main() {
+prfpregset32_t avar
+; return 0; }
+EOF
+if { (eval echo configure:4727: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_prfpregset32_t=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  bfd_cv_have_sys_procfs_type_prfpregset32_t=no
+   
+fi
+rm -f conftest*
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_prfpregset32_t = yes; then
+   cat >> confdefs.h <<\EOF
+#define HAVE_PRFPREGSET32_T 1
+EOF
+
+ fi
+ 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:4626: checking for lwpid_t in sys/procfs.h" >&5
+echo "configure:4749: 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 4631 "configure"
+#line 4754 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 lwpid_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4763: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_lwpid_t=yes
 else
@@ -4656,19 +4781,21 @@
  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:4660: checking for psaddr_t in sys/procfs.h" >&5
+echo "configure:4785: 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 4665 "configure"
+#line 4790 "configure"
 #include "confdefs.h"
+
+#define _SYSCALL32
 #include <sys/procfs.h>
 int main() {
 psaddr_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:4672: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4799: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_psaddr_t=yes
 else
@@ -4690,11 +4817,46 @@
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_psaddr_t" 1>&6
 
 
+    
+  echo $ac_n "checking for struct link_map32 in sys/link.h""... $ac_c" 1>&6
+echo "configure:4823: 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 4828 "configure"
+#include "confdefs.h"
+#define _SYSCALL32
+#include <sys/link.h>
+int main() {
+struct link_map32 l;
+; return 0; }
+EOF
+if { (eval echo configure:4836: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  gdb_cv_have_struct_link_map32=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  gdb_cv_have_struct_link_map32=no
+fi
+rm -f conftest*
+fi
+
+  echo "$ac_t""$gdb_cv_have_struct_link_map32" 1>&6
+  if test $gdb_cv_have_struct_link_map32 = yes; then
+    cat >> confdefs.h <<\EOF
+#define HAVE_STRUCT_LINK_MAP32 1
+EOF
+
+  fi
+
   
         
   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:4698: checking whether prfpregset_t type is broken" >&5
+echo "configure:4860: 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
@@ -4702,7 +4864,7 @@
   gdb_cv_prfpregset_t_broken=yes
 else
   cat > conftest.$ac_ext <<EOF
-#line 4706 "configure"
+#line 4868 "configure"
 #include "confdefs.h"
 #include <sys/procfs.h>
        int main ()
@@ -4712,7 +4874,7 @@
          return 0;
        }
 EOF
-if { (eval echo configure:4716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4878: \"$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
@@ -4737,12 +4899,12 @@
 
   
   echo $ac_n "checking for PIOCSET ioctl entry in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:4741: checking for PIOCSET ioctl entry in sys/procfs.h" >&5
+echo "configure:4903: 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 4746 "configure"
+#line 4908 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 #include <sys/types.h>
@@ -4755,7 +4917,7 @@
   
 ; return 0; }
 EOF
-if { (eval echo configure:4759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4921: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_procfs_piocset=yes
 else
@@ -4777,7 +4939,7 @@
 fi
 
 echo $ac_n "checking for main in -lm""... $ac_c" 1>&6
-echo "configure:4781: checking for main in -lm" >&5
+echo "configure:4943: 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
@@ -4785,14 +4947,14 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4789 "configure"
+#line 4951 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:4796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4958: \"$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
@@ -4821,7 +4983,7 @@
 
 
 echo $ac_n "checking for wctype in -lc""... $ac_c" 1>&6
-echo "configure:4825: checking for wctype in -lc" >&5
+echo "configure:4987: checking for wctype in -lc" >&5
 ac_lib_var=`echo c'_'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
@@ -4829,7 +4991,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4833 "configure"
+#line 4995 "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
@@ -4840,7 +5002,7 @@
 wctype()
 ; return 0; }
 EOF
-if { (eval echo configure:4844: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5006: \"$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
@@ -4859,7 +5021,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for wctype in -lw""... $ac_c" 1>&6
-echo "configure:4863: checking for wctype in -lw" >&5
+echo "configure:5025: 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
@@ -4867,7 +5029,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lw  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4871 "configure"
+#line 5033 "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
@@ -4878,7 +5040,7 @@
 wctype()
 ; return 0; }
 EOF
-if { (eval echo configure:4882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5044: \"$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
@@ -4910,12 +5072,12 @@
 
 
 echo $ac_n "checking for long long support in compiler""... $ac_c" 1>&6
-echo "configure:4914: checking for long long support in compiler" >&5
+echo "configure:5076: 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 4919 "configure"
+#line 5081 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -4925,7 +5087,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4929: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5091: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_c_long_long=yes
 else
@@ -4947,7 +5109,7 @@
 
 
 echo $ac_n "checking for long long support in printf""... $ac_c" 1>&6
-echo "configure:4951: checking for long long support in printf" >&5
+echo "configure:5113: 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
@@ -4955,7 +5117,7 @@
   gdb_cv_printf_has_long_long=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4959 "configure"
+#line 5121 "configure"
 #include "confdefs.h"
 
 int main () {
@@ -4969,7 +5131,7 @@
   return (strcmp ("0x0123456789abcdef", buf));
 }
 EOF
-if { (eval echo configure:4973: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5135: \"$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
@@ -4993,19 +5155,19 @@
 
 
 echo $ac_n "checking for long double support in compiler""... $ac_c" 1>&6
-echo "configure:4997: checking for long double support in compiler" >&5
+echo "configure:5159: 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 5002 "configure"
+#line 5164 "configure"
 #include "confdefs.h"
 
 int main() {
 long double foo;
 ; return 0; }
 EOF
-if { (eval echo configure:5009: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5171: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_long_double=yes
 else
@@ -5027,7 +5189,7 @@
 
 
 echo $ac_n "checking for long double support in printf""... $ac_c" 1>&6
-echo "configure:5031: checking for long double support in printf" >&5
+echo "configure:5193: 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
@@ -5035,7 +5197,7 @@
   gdb_cv_printf_has_long_double=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 5039 "configure"
+#line 5201 "configure"
 #include "confdefs.h"
 
 int main () {
@@ -5045,7 +5207,7 @@
   return (strncmp ("3.14159", buf, 7));
 }
 EOF
-if { (eval echo configure:5049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5211: \"$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
@@ -5069,7 +5231,7 @@
 
 
 echo $ac_n "checking for long double support in scanf""... $ac_c" 1>&6
-echo "configure:5073: checking for long double support in scanf" >&5
+echo "configure:5235: 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
@@ -5077,7 +5239,7 @@
   gdb_cv_scanf_has_long_double=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 5081 "configure"
+#line 5243 "configure"
 #include "confdefs.h"
 
 int main () {
@@ -5087,7 +5249,7 @@
   return !(f > 3.14159 && f < 3.14160);
 }
 EOF
-if { (eval echo configure:5091: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5253: \"$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
@@ -5113,17 +5275,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5117: checking for $ac_hdr" >&5
+echo "configure:5279: 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 5122 "configure"
+#line 5284 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5127: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5289: \"$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*
@@ -5152,12 +5314,12 @@
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5156: checking for $ac_func" >&5
+echo "configure:5318: 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 5161 "configure"
+#line 5323 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5180,7 +5342,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5346: \"$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
@@ -5205,7 +5367,7 @@
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:5209: checking for working mmap" >&5
+echo "configure:5371: 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
@@ -5213,7 +5375,7 @@
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 5217 "configure"
+#line 5379 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -5353,7 +5515,7 @@
 }
 
 EOF
-if { (eval echo configure:5357: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5519: \"$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
@@ -5382,7 +5544,7 @@
    case ${host_os} in
    hpux*)
       echo $ac_n "checking for HPUX/OSF thread support""... $ac_c" 1>&6
-echo "configure:5386: checking for HPUX/OSF thread support" >&5
+echo "configure:5548: 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
@@ -5390,7 +5552,7 @@
 #define HAVE_HPUX_THREAD_SUPPORT 1
 EOF
 
-            CONFIG_OBS="${CONFIG_OJS} hpux-thread.o"
+            CONFIG_LIB_OBS="${CONFIG_LIB_OBS} hpux-thread.o"
             CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c"
          else
             echo "$ac_t""no (suppressed because you are not using GCC)" 1>&6
@@ -5401,17 +5563,17 @@
       ;;
    solaris*)
       echo $ac_n "checking for Solaris thread debugging library""... $ac_c" 1>&6
-echo "configure:5405: checking for Solaris thread debugging library" >&5
+echo "configure:5567: 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
 #define HAVE_THREAD_DB_LIB 1
 EOF
 
-         CONFIG_OBS="${CONFIG_OBS} sol-thread.o"
+         CONFIG_LIB_OBS="${CONFIG_LIB_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:5415: checking for dlopen in -ldl" >&5
+echo "configure:5577: 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
@@ -5419,7 +5581,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5423 "configure"
+#line 5585 "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
@@ -5430,7 +5592,7 @@
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:5434: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5596: \"$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
@@ -5462,17 +5624,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:5466: checking for the ld -export-dynamic flag" >&5
+echo "configure:5628: checking for the ld -export-dynamic flag" >&5
             LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
             cat > conftest.$ac_ext <<EOF
-#line 5469 "configure"
+#line 5631 "configure"
 #include "confdefs.h"
 
 int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:5476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5638: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   found=yes
 else
@@ -5491,13 +5653,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:5495: checking if <proc_service.h> is old" >&5
+echo "configure:5657: 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 5501 "configure"
+#line 5663 "configure"
 #include "confdefs.h"
 
 		#include <proc_service.h>
@@ -5508,7 +5670,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5512: \"$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*
   gdb_cv_proc_service_is_old=no
 else
@@ -5537,6 +5699,42 @@
 fi
 
 
+# Check whether --enable-gdbcli or --disable-gdbcli was given.
+if test "${enable_gdbcli+set}" = set; then
+  enableval="$enable_gdbcli"
+  
+  case "${enableval}" in
+    yes) enable_gdbcli=yes ;;
+    "") enable_gdbcli=yes ;;
+    no) 
+      { echo "configure: error: The CLI cannot be disabled yet" 1>&2; exit 1; }
+    ;;
+    *)
+      { echo "configure: error: Bad value for --enable-gdbcli: ${enableval}" 1>&2; exit 1; }
+    ;;
+  esac
+
+else
+  enable_gdbcli=yes
+fi
+
+case ${enable_gdbcli} in
+  "yes" )
+    if test -d "${srcdir}/cli" ; then
+      CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_CLI_OBS)"
+      CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_CLI_DEPS)"
+      CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_CLI_SRCS)"
+      CONFIG_INITS="${CONFIG_INITS} \$(SUBDIR_CLI_INITS)"
+      ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_CLI_CFLAGS)"
+      CONFIG_ALL="${CONFIG_ALL} \$(SUBDIR_CLI_ALL)"
+      CONFIG_CLEAN="${CONFIG_CLEAN} \$(SUBDIR_CLI_CLEAN)"
+      CONFIG_INSTALL="${CONFIG_INSTALL} \$(SUBDIR_CLI_INSTALL)"
+      CONFIG_UNINSTALL="${CONFIG_UNINSTALL} \$(SUBDIR_CLI_UNINSTALL)"
+    fi
+    ;;
+esac
+
+
 # Check whether --enable-gdbmi or --disable-gdbmi was given.
 if test "${enable_gdbmi+set}" = set; then
   enableval="$enable_gdbmi"
@@ -5556,7 +5754,7 @@
     if test -d "${srcdir}/mi" ; then
       CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_MI_OBS)"
       CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_MI_DEPS)"
-      CONFIG_SRCS="${CONFIG_SRS} \$(SUBDIR_MI_SRCS)"
+      CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_MI_SRCS)"
       CONFIG_INITS="${CONFIG_INITS} \$(SUBDIR_MI_INITS)"
       ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_MI_CFLAGS)"
       CONFIG_ALL="${CONFIG_ALL} \$(SUBDIR_MI_ALL)"
@@ -5567,6 +5765,32 @@
     ;;
 esac
 
+# Configure UI_OUT by default (before 5.2 it can be disabled)
+# It must be configured if gdbmi is configured
+
+UIOUT_CFLAGS=
+
+
+# Check whether --with-uiout or --without-uiout was given.
+if test "${with_uiout+set}" = set; then
+  withval="$with_uiout"
+  case "${withval}" in
+  yes)  want_uiout=true ;;
+  no)   if test $enable_gdbmi = yes; then
+          { echo "configure: error: uiout is needed for MI and cannot be disabled" 1>&2; exit 1; }
+        else
+           want_uiout=false
+        fi ;;
+  *)    { echo "configure: error: bad value ${withval} for GDB with-uiout option" 1>&2; exit 1; } ;;
+esac
+else
+  want_uiout=true
+fi
+
+if test $want_uiout = true; then
+   UIOUT_CFLAGS="-DUI_OUT=1"
+fi
+
 # Check whether --enable-tui or --disable-tui was given.
 if test "${enable_tui+set}" = set; then
   enableval="$enable_tui"
@@ -5586,7 +5810,7 @@
     if test -d "${srcdir}/tui" ; then
       CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_TUI_OBS)"
       CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_TUI_DEPS)"
-      CONFIG_SRCS="${CONFIG_SRS} \$(SUBDIR_TUI_SRCS)"
+      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} \$(SUBDIR_TUI_ALL)"
@@ -5609,13 +5833,15 @@
 
 
 if test "${enable_netrom}" = "yes"; then
-	CONFIG_OBS="${CONFIG_OBS} remote-nrom.o" 
+	CONFIG_LIB_OBS="${CONFIG_LIB_OBS} remote-nrom.o" 
         CONFIG_SRCS="${CONFIG_SRCS} remote-nrom.c"
 fi
 
 
-# Don't add -Wall or -Wunused, they include -Wunused-parameter which
-# causes noise.
+# NOTE: Don't add -Wall or -Wunused, they both include
+# -Wunused-parameter which reports bogus warnings.
+# NOTE: If you add to this list, remember to update
+# gdb/doc/gdbint.texinfo.
 build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
 -Wformat -Wparentheses -Wpointer-arith -Wuninitialized"
 # Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
@@ -5640,12 +5866,28 @@
   echo "Setting compiler warning flags = $build_warnings" 6>&1
 fi
 fi
+# Check whether --enable-gdb-build-warnings or --disable-gdb-build-warnings was given.
+if test "${enable_gdb_build_warnings+set}" = set; then
+  enableval="$enable_gdb_build_warnings"
+  case "${enableval}" in
+  yes)	;;
+  no)	build_warnings="-w";;
+  ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+        build_warnings="${build_warnings} ${t}";;
+  *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+        build_warnings="${t} ${build_warnings}";;
+  *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+esac
+if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
+  echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
+fi
+fi
 WARN_CFLAGS=""
 WERROR_CFLAGS=""
 if test "x${build_warnings}" != x -a "x$GCC" = xyes
 then
     echo $ac_n "checking compiler warning flags""... $ac_c" 1>&6
-echo "configure:5649: checking compiler warning flags" >&5
+echo "configure:5891: 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
@@ -5708,12 +5950,12 @@
 
 if test $want_included_regex = false; then
   echo $ac_n "checking for GNU regex""... $ac_c" 1>&6
-echo "configure:5712: checking for GNU regex" >&5
+echo "configure:5954: 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 5717 "configure"
+#line 5959 "configure"
 #include "confdefs.h"
 #include <gnu-versions.h>
 #include <sys/types.h>
@@ -5725,7 +5967,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5729: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5971: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_gnu_regex=yes
 else
@@ -5754,12 +5996,12 @@
 
 # In the Cygwin environment, we need some additional flags.
 echo $ac_n "checking for cygwin""... $ac_c" 1>&6
-echo "configure:5758: checking for cygwin" >&5
+echo "configure:6000: 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 5763 "configure"
+#line 6005 "configure"
 #include "confdefs.h"
 
 #if defined (__CYGWIN__) || defined (__CYGWIN32__)
@@ -5780,6 +6022,15 @@
 
 echo "$ac_t""$gdb_cv_os_cygwin" 1>&6
 
+
+SER_HARDWIRE="ser-unix.o ser-pipe.o ser-tcp.o"
+case ${host} in
+  *go32* ) SER_HARDWIRE=ser-go32.o ;;
+  *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
+esac
+
+
+
 if test x$gdb_host = xgo32; then
   TERM_LIB=
 else
@@ -5788,7 +6039,7 @@
 else
   TERM_LIB=
   echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6
-echo "configure:5792: checking for tgetent in -lncurses" >&5
+echo "configure:6043: checking for tgetent in -lncurses" >&5
 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5796,7 +6047,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5800 "configure"
+#line 6051 "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
@@ -5807,7 +6058,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:5811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6062: \"$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
@@ -5826,7 +6077,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for tgetent in -lHcurses""... $ac_c" 1>&6
-echo "configure:5830: checking for tgetent in -lHcurses" >&5
+echo "configure:6081: checking for tgetent in -lHcurses" >&5
 ac_lib_var=`echo Hcurses'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5834,7 +6085,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lHcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5838 "configure"
+#line 6089 "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
@@ -5845,7 +6096,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:5849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6100: \"$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
@@ -5864,7 +6115,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for tgetent in -ltermlib""... $ac_c" 1>&6
-echo "configure:5868: checking for tgetent in -ltermlib" >&5
+echo "configure:6119: checking for tgetent in -ltermlib" >&5
 ac_lib_var=`echo termlib'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5872,7 +6123,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ltermlib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5876 "configure"
+#line 6127 "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
@@ -5883,7 +6134,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:5887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6138: \"$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
@@ -5902,7 +6153,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
-echo "configure:5906: checking for tgetent in -ltermcap" >&5
+echo "configure:6157: checking for tgetent in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5910,7 +6161,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5914 "configure"
+#line 6165 "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
@@ -5921,7 +6172,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:5925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6176: \"$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
@@ -5940,7 +6191,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6
-echo "configure:5944: checking for tgetent in -lcurses" >&5
+echo "configure:6195: checking for tgetent in -lcurses" >&5
 ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5948,7 +6199,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5952 "configure"
+#line 6203 "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
@@ -5959,7 +6210,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:5963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6214: \"$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
@@ -5978,7 +6229,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for tgetent in -lterminfo""... $ac_c" 1>&6
-echo "configure:5982: checking for tgetent in -lterminfo" >&5
+echo "configure:6233: checking for tgetent in -lterminfo" >&5
 ac_lib_var=`echo terminfo'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5986,7 +6237,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lterminfo  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5990 "configure"
+#line 6241 "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
@@ -5997,7 +6248,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:6001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6252: \"$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
@@ -6155,7 +6406,7 @@
 fi
 
   echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6
-echo "configure:6159: checking for Tcl configuration" >&5
+echo "configure:6410: 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
@@ -6263,7 +6514,7 @@
 fi
 
   echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6
-echo "configure:6267: checking for Tk configuration" >&5
+echo "configure:6518: 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
@@ -6359,7 +6610,7 @@
 
 no_tcl=true
 echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6
-echo "configure:6363: checking for Tcl private headers. dir=${configdir}" >&5
+echo "configure:6614: 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"
@@ -6425,17 +6676,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:6429: checking for tclInt.h" >&5
+echo "configure:6680: 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 6434 "configure"
+#line 6685 "configure"
 #include "confdefs.h"
 #include <tclInt.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6439: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6690: \"$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*
@@ -6495,7 +6746,7 @@
 #
 no_tk=true
 echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6
-echo "configure:6499: checking for Tk private headers" >&5
+echo "configure:6750: 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"
@@ -6561,17 +6812,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:6565: checking for tk.h" >&5
+echo "configure:6816: 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 6570 "configure"
+#line 6821 "configure"
 #include "confdefs.h"
 #include <tk.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6575: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6826: \"$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*
@@ -6617,7 +6868,7 @@
 
 	   
 echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6
-echo "configure:6621: checking for Itcl private headers. srcdir=${srcdir}" >&5
+echo "configure:6872: 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
@@ -6640,7 +6891,7 @@
 
 	   
 echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6
-echo "configure:6644: checking for Itk private headers. srcdir=${srcdir}" >&5
+echo "configure:6895: 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
@@ -6663,7 +6914,7 @@
 
 	   
 echo $ac_n "checking for Tix private headers. srcdir=${srcdir}""... $ac_c" 1>&6
-echo "configure:6667: checking for Tix private headers. srcdir=${srcdir}" >&5
+echo "configure:6918: checking for Tix private headers. srcdir=${srcdir}" >&5
 if test x"${ac_cv_c_tixh}" = x ; then
   for i in ${srcdir}/../tix ${srcdir}/../../tix ${srcdir}/../../../tix ; do
     if test -f $i/generic/tix.h ; then
@@ -6701,7 +6952,7 @@
 fi
 
   echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6
-echo "configure:6705: checking for Itcl configuration" >&5
+echo "configure:6956: 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
@@ -6813,7 +7064,7 @@
 fi
 
   echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6
-echo "configure:6817: checking for Itk configuration" >&5
+echo "configure:7068: 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
@@ -6925,7 +7176,7 @@
 fi
 
   echo $ac_n "checking for Tix configuration""... $ac_c" 1>&6
-echo "configure:6929: checking for Tix configuration" >&5
+echo "configure:7180: checking for Tix configuration" >&5
   if eval "test \"`echo '$''{'ac_cv_c_tixconfig'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7010,7 +7261,7 @@
 	     TIX_DEPS="${TIX_BUILD_LOCATION}/${TIX_LIB_FILE}"
            fi
 
-           ENABLE_CFLAGS="$ENABLE_CFLAGS -DGDBTK"
+           ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_GDBTK_CFLAGS)"
 	   # Tcl/Tk 8.1 require -fwritable strings.  I don't
            # know whether 8.2 will or not, but I bet it will.
            # I don't have to worry about 7.x since we don't support it.
@@ -7023,18 +7274,19 @@
 
 	   # Include some libraries that Tcl and Tk want.
 	   TCL_LIBS='$(LIBGUI) $(ITCL) $(ITK) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
-	   CONFIG_DEPS='$(LIBGUI) $(ITCL_DEPS) $(ITK_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)'
 	   # Yes, the ordering seems wrong here.  But it isn't.
 	   # TK_LIBS is the list of libraries that need to be linked
 	   # after Tcl/Tk.  Note that this isn't put into LIBS.  If it
 	   # were in LIBS then any link tests after this point would
 	   # try to include things like `$(LIBGUI)', which wouldn't work.
 	   GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}"
-	   CONFIG_SRCS="${CONFIG_SRCS} gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c gdbtk/generic/gdbtk-varobj.c gdbtk/generic/gdbtk-wrapper.c"
-	   CONFIG_OBS="${CONFIG_OBS} gdbtk.o gdbtk-cmds.o gdbtk-hooks.o gdbtk-varobj.o gdbtk-wrapper.o"
-	   CONFIG_INITS="${CONFIG_INITS} gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c gdbtk/generic/gdbtk-varobj.c gdbtk/generic/gdbtk-wrapper.c"
+
+           CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_GDBTK_OBS)"
+           CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_GDBTK_DEPS)"
+           CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_GDBTK_SRCS)"
+           CONFIG_INITS="${CONFIG_INITS} \$(SUBDIR_GDBTK_INITS)"
 	   CONFIG_ALL="${CONFIG_ALL} \$(SUBDIR_GDBTK_ALL)"
-	   CONFIG_CLEAN="${CONFIG_ALL} \$(SUBDIR_GDBTK_CLEAN)"
+	   CONFIG_CLEAN="${CONFIG_CLEAN} \$(SUBDIR_GDBTK_CLEAN)"
 	   CONFIG_INSTALL="${CONFIG_INSTALL} \$(SUBDIR_GDBTK_INSTALL)"
 	   CONFIG_UNINSTALL="${CONFIG_UNINSTALL} \$(SUBDIR_GDBTK_UNINSTALL)"
 
@@ -7064,7 +7316,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:7068: checking for X" >&5
+echo "configure:7320: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -7126,12 +7378,12 @@
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 7130 "configure"
+#line 7382 "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:7135: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7387: \"$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*
@@ -7200,14 +7452,14 @@
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7204 "configure"
+#line 7456 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:7211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7463: \"$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.
@@ -7346,6 +7598,7 @@
 
 
 
+
 # Begin stuff to support --enable-shared
 # Check whether --enable-shared or --disable-shared was given.
 if test "${enable_shared+set}" = set; then
@@ -7441,6 +7694,10 @@
 s/TM_FILE[ 	]*=[ 	]*\([^ 	]*\)/\1/p
 ' ${target_makefile_frag}`
 
+GDB_MULTI_ARCH=`sed -n '
+s/GDB_MULTI_ARCH[ 	]*=[ 	]*\([^ 	]*\)[ 	]*/\1/p
+' ${target_makefile_frag}`
+
 # these really aren't orthogonal true/false values of the same condition,
 # but shells are slow enough that I like to reuse the test conditions
 # whenever possible
@@ -7454,6 +7711,37 @@
 fi
 
 
+# New targets should just set gdb_multi_arch=yes in configure.tgt.
+# Old targets being converted can either do that or set GDB_MULTI_ARCH
+# in the target specific makefile frag.  Eventually gdb_multi_arch=yes
+# will be the default.
+if test x"${GDB_MULTI_ARCH}" = x ; then
+    case "${gdb_multi_arch}" in
+    yes ) GDB_MULTI_ARCH=GDB_MULTI_ARCH_PURE ;;
+    no ) GDB_MULTI_ARCH=0 ;;
+    0|1|2 ) GDB_MULTI_ARCH=${gdb_multi_arch} ;;
+    esac
+fi
+if test x"${GDB_MULTI_ARCH}" != x ; then
+    cat >> confdefs.h <<EOF
+#define GDB_MULTI_ARCH ${GDB_MULTI_ARCH}
+EOF
+
+fi
+# Warn the user when they use an old pratice
+case "${GDB_MULTI_ARCH}" in
+    "" ) ;;
+    0 | GDB_MULTI_ARCH_PARTIAL | 1 | GDB_MULTI_ARCH_TM | 2 )
+	echo "configure: warning: "GDB: Target is not pure multi-arch"" 1>&2 ;;
+    GDB_MULTI_ARCH_PURE )
+	if test x"${targetfile}" != x ; then
+	    echo "configure: warning: "GDB: Ingoring TM_FILE in ${target_makefile_frag}"" 1>&2
+	    targetfile=""
+	fi ;;
+    *)  { echo "configure: error: "GDB: Unknown GDB_MULTI_ARCH value ${GDB_MULTI_ARCH}"" 1>&2; exit 1; };;
+esac
+
+
 SUBDIRS="doc testsuite nlm"
 if test "${enable_multi_ice}" = "yes"; then
   SUBDIRS="${SUBDIRS} multi-ice"
@@ -7462,34 +7750,56 @@
 
 
 # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
-# (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the
-# corresponding links.  But we have to remove the xm.h files and tm.h
-# files anyway, e.g. when switching from "configure host" to
-# "configure none".
+# (NAT_FILE) is not set in config/*/*.m[ht] files, we link to an empty
+# version.
 
 files=
 links=
+
 rm -f xm.h
+xm_h=""
 if test "${hostfile}" != ""; then
-files="${files} config/${gdb_host_cpu}/${hostfile}"
-links="${links} xm.h"
+    xm_h=xm.h
+    GDB_XM_FILE="config/${gdb_host_cpu}/${hostfile}"
+    files="${files} ${GDB_XM_FILE}"
+    links="${links} xm.h"
+    cat >> confdefs.h <<EOF
+#define GDB_XM_FILE ${GDB_XM_FILE}
+EOF
+
 fi
+
+
 rm -f tm.h
+tm_h=""
 if test "${targetfile}" != ""; then
-files="${files} config/${gdb_target_cpu}/${targetfile}"
-links="${links} tm.h"
+    tm_h=tm.h
+    GDB_TM_FILE="config/${gdb_target_cpu}/${targetfile}"
+    files="${files} ${GDB_TM_FILE}"
+    links="${links} tm.h"
+    cat >> confdefs.h <<EOF
+#define GDB_TM_FILE ${GDB_TM_FILE}
+EOF
+
 fi
+
+
 rm -f nm.h
+nm_h=""
 if test "${nativefile}" != ""; then
-files="${files} config/${gdb_host_cpu}/${nativefile}"
-links="${links} nm.h"
-else
-# A cross-only configuration.
-files="${files} config/nm-empty.h"
-links="${links} nm.h"
+    nm_h=nm.h
+    GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}"
+    files="${files} ${GDB_NM_FILE}"
+    links="${links} nm.h"
+    cat >> confdefs.h <<EOF
+#define GDB_NM_FILE ${GDB_NM_FILE}
+EOF
+
 fi
+
+
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:7493: checking whether ln -s works" >&5
+echo "configure:7803: 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
@@ -7513,12 +7823,12 @@
 
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:7517: checking for Cygwin environment" >&5
+echo "configure:7827: 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 7522 "configure"
+#line 7832 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -7529,7 +7839,7 @@
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:7533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7843: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -7546,19 +7856,19 @@
 CYGWIN=
 test "$ac_cv_cygwin" = yes && CYGWIN=yes
 echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:7550: checking for mingw32 environment" >&5
+echo "configure:7860: 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 7555 "configure"
+#line 7865 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:7562: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -7577,7 +7887,7 @@
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:7581: checking for executable suffix" >&5
+echo "configure:7891: checking for executable suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7587,10 +7897,10 @@
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:7591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:7901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
-      *.c | *.o | *.obj) ;;
+      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
       *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
       esac
     done
@@ -7796,11 +8106,13 @@
 s%@YACC@%$YACC%g
 s%@MIG@%$MIG%g
 s%@CONFIG_LDFLAGS@%$CONFIG_LDFLAGS%g
+s%@UIOUT_CFLAGS@%$UIOUT_CFLAGS%g
 s%@WARN_CFLAGS@%$WARN_CFLAGS%g
 s%@WERROR_CFLAGS@%$WERROR_CFLAGS%g
 s%@MMALLOC_CFLAGS@%$MMALLOC_CFLAGS%g
 s%@MMALLOC@%$MMALLOC%g
 s%@REGEX@%$REGEX%g
+s%@SER_HARDWIRE@%$SER_HARDWIRE%g
 s%@TERM_LIB@%$TERM_LIB%g
 s%@WIN32LIBS@%$WIN32LIBS%g
 s%@LIBGUI@%$LIBGUI%g
@@ -7862,6 +8174,7 @@
 s%@IGNORE_SIM_OBS@%$IGNORE_SIM_OBS%g
 s%@ENABLE_CFLAGS@%$ENABLE_CFLAGS%g
 s%@CONFIG_OBS@%$CONFIG_OBS%g
+s%@CONFIG_LIB_OBS@%$CONFIG_LIB_OBS%g
 s%@CONFIG_DEPS@%$CONFIG_DEPS%g
 s%@CONFIG_SRCS@%$CONFIG_SRCS%g
 s%@CONFIG_INITS@%$CONFIG_INITS%g
@@ -7878,6 +8191,9 @@
 s%@target_makefile_frag@%%g
 s%@frags@%$frags%g
 s%@SUBDIRS@%$SUBDIRS%g
+s%@xm_h@%$xm_h%g
+s%@tm_h@%$tm_h%g
+s%@nm_h@%$nm_h%g
 s%@LN_S@%$LN_S%g
 s%@EXEEXT@%$EXEEXT%g
 s%@subdirs@%$subdirs%g
diff --git a/gdb/configure.host b/gdb/configure.host
index db720b1..1c35df0 100644
--- a/gdb/configure.host
+++ b/gdb/configure.host
@@ -44,7 +44,7 @@
 hppa*-*-bsd*)		gdb_host=hppabsd ;;
 hppa*-*-hiux*)		gdb_host=hppahpux ;;
 hppa*-*-hpux10.20)	gdb_host=hpux1020 ;;
-hppa2.0w-*-hpux11*)	gdb_host=hpux11w ;;
+hppa*64*-*-hpux11*)	gdb_host=hpux11w ;;
 hppa*-*-hpux11*)	gdb_host=hpux11 ;;
 hppa*-*-hpux*)		gdb_host=hppahpux ;;
 hppa*-*-osf*)		gdb_host=hppaosf ;;
@@ -162,6 +162,7 @@
 sparc64-*-*)		gdb_host=sun4sol2 ;;
 
 strongarm-*-*)		gdb_host=arm ;;
+xscale-*-*)		gdb_host=arm ;;
 
 # OBSOLETE tahoe-*-*)		gdb_host=tahoe ;;
 
diff --git a/gdb/configure.in b/gdb/configure.in
index d7a725e..438e404 100644
--- a/gdb/configure.in
+++ b/gdb/configure.in
@@ -1,5 +1,5 @@
 dnl Autoconf configure script for GDB, the GNU debugger.
-dnl Copyright 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+dnl Copyright 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 dnl
 dnl This file is part of GDB.
 dnl 
@@ -40,6 +40,7 @@
 dnl List of object files added by configure.
 
 CONFIG_OBS=
+CONFIG_LIB_OBS=
 CONFIG_DEPS=
 CONFIG_SRCS=
 CONFIG_INITS=
@@ -71,9 +72,26 @@
 
 . ${srcdir}/configure.tgt
 
+targ=${target} ; . ${srcdir}/../bfd/config.bfd
+
 dnl
 changequote([,])dnl
 
+dnl use BFD to determine the default architecture and byte order
+dnl (bfd_vec->byteorder provides the latter).
+targ=${target}
+. ${srcdir}/../bfd/config.bfd
+
+dnl We only want the first arch, if there is more than one.
+targ_archs=`echo ${targ_archs} | sed -e 's/ .*//;'`
+
+if test x"${targ_archs}" != x ; then
+    AC_DEFINE_UNQUOTED(DEFAULT_BFD_ARCH, ${targ_archs})
+fi
+if test x"${targ_defvec}" != x ; then
+    AC_DEFINE_UNQUOTED(DEFAULT_BFD_VEC, ${targ_defvec})
+fi
+
 AC_PROG_AWK
 AC_PROG_INSTALL
 AC_CHECK_TOOL(AR, ar)
@@ -95,7 +113,7 @@
 dnl and <wchar.h> that causes AC_CHECK_HEADERS to think <curses.h> doesn't
 dnl exist.
 
-case $host_os in solaris2.7) case "$GCC" in yes)
+case $host_os in solaris2.7 | solaris2.8) case "$GCC" in yes)
     AC_DEFINE(_MSE_INT_H)
 esac; esac
 
@@ -106,12 +124,13 @@
 	wchar.h wctype.h asm/debugreg.h sys/debugreg.h sys/select.h \
 	time.h sys/ioctl.h sys/user.h \
 	dirent.h sys/ndir.h sys/dir.h ndir.h \
-	curses.h ncurses.h)
+	curses.h ncurses.h \
+	poll.h sys/poll.h)
 AC_HEADER_STAT
 
 AC_C_CONST
 
-AC_CHECK_FUNCS(setpgid sbrk sigaction isascii bzero bcopy btowc poll sigprocmask)
+AC_CHECK_FUNCS(setpgid sbrk sigaction isascii bzero bcopy btowc poll sigprocmask vfork)
 AC_FUNC_ALLOCA
 
 # See if machine/reg.h supports the %fs and %gs i386 segment registers.
@@ -141,22 +160,16 @@
   AC_DEFINE(HAVE_PTRACE_GETREGS)
 fi
 
-dnl See if ptrace.h provides the PTRACE_GETXFPREGS request.
-dnl PTRACE_GETXFPREGS is a Cygnus invention, since we wrote our own
-dnl Linux kernel patch for SSE support.  That patch may or may not
-dnl actually make it into the official distribution.  If you find that
-dnl years have gone by since this configure test was added, and Linux
-dnl isn't using PTRACE_GETXFPREGS, that means that our patch didn't
-dnl make it, and you can delete this code.
-AC_MSG_CHECKING(for PTRACE_GETXFPREGS)
-AC_CACHE_VAL(gdb_cv_have_ptrace_getxfpregs,
+dnl See if ptrace.h provides the PTRACE_GETFPXREGS request.
+AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
+AC_CACHE_VAL(gdb_cv_have_ptrace_getfpxregs,
 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
-		[PTRACE_GETXFPREGS;],
-		[gdb_cv_have_ptrace_getxfpregs=yes],
-		[gdb_cv_have_ptrace_getxfpregs=no])])
-AC_MSG_RESULT($gdb_cv_have_ptrace_getxfpregs)
-if test $gdb_cv_have_ptrace_getxfpregs = yes; then
-  AC_DEFINE(HAVE_PTRACE_GETXFPREGS)
+		[PTRACE_GETFPXREGS;],
+		[gdb_cv_have_ptrace_getfpxregs=yes],
+		[gdb_cv_have_ptrace_getfpxregs=no])])
+AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
+if test $gdb_cv_have_ptrace_getfpxregs = yes; then
+  AC_DEFINE(HAVE_PTRACE_GETFPXREGS)
 fi
 
 AC_CHECK_LIB(socket, socketpair)
@@ -217,9 +230,25 @@
   BFD_HAVE_SYS_PROCFS_TYPE(fpregset_t)
   BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
   BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t)
+  BFD_HAVE_SYS_PROCFS_TYPE(prgregset32_t)
+  BFD_HAVE_SYS_PROCFS_TYPE(prfpregset32_t)
   BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
   BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
 
+  dnl Check for struct link_map32 type, which allows a 64-bit Solaris
+  dnl debugger to debug a 32-bit Solaris app with 32-bit shared libraries.
+
+  AC_MSG_CHECKING(for struct link_map32 in sys/link.h)
+  AC_CACHE_VAL(gdb_cv_have_struct_link_map32, 
+    [AC_TRY_COMPILE([#define _SYSCALL32
+#include <sys/link.h>], [struct link_map32 l;],
+     gdb_cv_have_struct_link_map32=yes,
+     gdb_cv_have_struct_link_map32=no)])
+  AC_MSG_RESULT($gdb_cv_have_struct_link_map32)
+  if test $gdb_cv_have_struct_link_map32 = yes; then
+    AC_DEFINE(HAVE_STRUCT_LINK_MAP32)
+  fi
+
   dnl Check for broken prfpregset_t type
 
   dnl For Linux/i386, glibc 2.1.3 was released with a bogus
@@ -379,7 +408,7 @@
          if test "$GCC" = "yes" ; then
             AC_MSG_RESULT(yes)
             AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT)
-            CONFIG_OBS="${CONFIG_OJS} hpux-thread.o"
+            CONFIG_LIB_OBS="${CONFIG_LIB_OBS} hpux-thread.o"
             CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c"
          else
             AC_MSG_RESULT(no (suppressed because you are not using GCC))
@@ -393,7 +422,7 @@
       if test -f /usr/lib/libthread_db.so.1 ; then
          AC_MSG_RESULT(yes)
          AC_DEFINE(HAVE_THREAD_DB_LIB)
-         CONFIG_OBS="${CONFIG_OBS} sol-thread.o"
+         CONFIG_LIB_OBS="${CONFIG_LIB_OBS} sol-thread.o"
          CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c"
          AC_CHECK_LIB(dl, dlopen)
          if test "$GCC" = "yes" ; then
@@ -432,6 +461,40 @@
    AC_SUBST(CONFIG_LDFLAGS)
 fi
 
+dnl The CLI cannot be disabled yet, but may be in the future  
+
+dnl Handle CLI sub-directory configury.
+AC_ARG_ENABLE(gdbcli,
+[  --enable-gdbcli            Enable GDB-CLI interface],
+[
+  case "${enableval}" in
+    yes) enable_gdbcli=yes ;;
+    "") enable_gdbcli=yes ;;
+    no) 
+      AC_MSG_ERROR(The CLI cannot be disabled yet)
+    ;;
+    *)
+      AC_MSG_ERROR(Bad value for --enable-gdbcli: ${enableval})
+    ;;
+  esac
+],
+[enable_gdbcli=yes])
+case ${enable_gdbcli} in
+  "yes" )
+    if test -d "${srcdir}/cli" ; then
+      CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_CLI_OBS)"
+      CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_CLI_DEPS)"
+      CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_CLI_SRCS)"
+      CONFIG_INITS="${CONFIG_INITS} \$(SUBDIR_CLI_INITS)"
+      ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_CLI_CFLAGS)"
+      CONFIG_ALL="${CONFIG_ALL} \$(SUBDIR_CLI_ALL)"
+      CONFIG_CLEAN="${CONFIG_CLEAN} \$(SUBDIR_CLI_CLEAN)"
+      CONFIG_INSTALL="${CONFIG_INSTALL} \$(SUBDIR_CLI_INSTALL)"
+      CONFIG_UNINSTALL="${CONFIG_UNINSTALL} \$(SUBDIR_CLI_UNINSTALL)"
+    fi
+    ;;
+esac
+
 dnl Handle optional features that can be enabled.
 
 dnl Handle MI sub-directory configury.
@@ -451,7 +514,7 @@
     if test -d "${srcdir}/mi" ; then
       CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_MI_OBS)"
       CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_MI_DEPS)"
-      CONFIG_SRCS="${CONFIG_SRS} \$(SUBDIR_MI_SRCS)"
+      CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_MI_SRCS)"
       CONFIG_INITS="${CONFIG_INITS} \$(SUBDIR_MI_INITS)"
       ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_MI_CFLAGS)"
       CONFIG_ALL="${CONFIG_ALL} \$(SUBDIR_MI_ALL)"
@@ -462,6 +525,29 @@
     ;;
 esac
 
+# Configure UI_OUT by default (before 5.2 it can be disabled)
+# It must be configured if gdbmi is configured
+
+UIOUT_CFLAGS=
+AC_SUBST(UIOUT_CFLAGS)
+
+AC_ARG_WITH(uiout,
+[  --with-uiout          Use new uiout functions intead of *printf's],
+[case "${withval}" in
+  yes)  want_uiout=true ;;
+  no)   if test $enable_gdbmi = yes; then
+          AC_MSG_ERROR(uiout is needed for MI and cannot be disabled)
+        else
+           want_uiout=false
+        fi ;;
+  *)    AC_MSG_ERROR(bad value ${withval} for GDB with-uiout option) ;;
+esac],
+[want_uiout=true])dnl
+
+if test $want_uiout = true; then
+   UIOUT_CFLAGS="-DUI_OUT=1"
+fi
+
 AC_ARG_ENABLE(tui,
 [  --enable-tui            Enable full-screen terminal user interface],
 [
@@ -478,7 +564,7 @@
     if test -d "${srcdir}/tui" ; then
       CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_TUI_OBS)"
       CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_TUI_DEPS)"
-      CONFIG_SRCS="${CONFIG_SRS} \$(SUBDIR_TUI_SRCS)"
+      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} \$(SUBDIR_TUI_ALL)"
@@ -498,13 +584,15 @@
 esac])
 
 if test "${enable_netrom}" = "yes"; then
-	CONFIG_OBS="${CONFIG_OBS} remote-nrom.o" 
+	CONFIG_LIB_OBS="${CONFIG_LIB_OBS} remote-nrom.o" 
         CONFIG_SRCS="${CONFIG_SRCS} remote-nrom.c"
 fi
 
 
-# Don't add -Wall or -Wunused, they include -Wunused-parameter which
-# causes noise.
+# NOTE: Don't add -Wall or -Wunused, they both include
+# -Wunused-parameter which reports bogus warnings.
+# NOTE: If you add to this list, remember to update
+# gdb/doc/gdbint.texinfo.
 build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
 -Wformat -Wparentheses -Wpointer-arith -Wuninitialized"
 # Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
@@ -527,6 +615,20 @@
 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
   echo "Setting compiler warning flags = $build_warnings" 6>&1
 fi])dnl
+AC_ARG_ENABLE(gdb-build-warnings,
+[  --enable-gdb-build-warnings Enable GDB specific build-time compiler warnings if gcc is used],
+[case "${enableval}" in
+  yes)	;;
+  no)	build_warnings="-w";;
+  ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+        build_warnings="${build_warnings} ${t}";;
+  *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+        build_warnings="${t} ${build_warnings}";;
+  *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+esac
+if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
+  echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
+fi])dnl
 WARN_CFLAGS=""
 WERROR_CFLAGS=""
 if test "x${build_warnings}" != x -a "x$GCC" = xyes
@@ -609,6 +711,16 @@
 lose
 #endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
 
+
+dnl Figure out which of the many generic ser-*.c files the _host_ supports.
+SER_HARDWIRE="ser-unix.o ser-pipe.o ser-tcp.o"
+case ${host} in
+  *go32* ) SER_HARDWIRE=ser-go32.o ;;
+  *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
+esac
+AC_SUBST(SER_HARDWIRE)
+
+
 dnl Figure out which term library to use.
 if test x$gdb_host = xgo32; then
   TERM_LIB=
@@ -785,7 +897,7 @@
 	     TIX_DEPS="${TIX_BUILD_LOCATION}/${TIX_LIB_FILE}"
            fi
 
-           ENABLE_CFLAGS="$ENABLE_CFLAGS -DGDBTK"
+           ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_GDBTK_CFLAGS)"
 	   # Tcl/Tk 8.1 require -fwritable strings.  I don't
            # know whether 8.2 will or not, but I bet it will.
            # I don't have to worry about 7.x since we don't support it.
@@ -798,18 +910,19 @@
 
 	   # Include some libraries that Tcl and Tk want.
 	   TCL_LIBS='$(LIBGUI) $(ITCL) $(ITK) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
-	   CONFIG_DEPS='$(LIBGUI) $(ITCL_DEPS) $(ITK_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)'
 	   # Yes, the ordering seems wrong here.  But it isn't.
 	   # TK_LIBS is the list of libraries that need to be linked
 	   # after Tcl/Tk.  Note that this isn't put into LIBS.  If it
 	   # were in LIBS then any link tests after this point would
 	   # try to include things like `$(LIBGUI)', which wouldn't work.
 	   GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}"
-	   CONFIG_SRCS="${CONFIG_SRCS} gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c gdbtk/generic/gdbtk-varobj.c gdbtk/generic/gdbtk-wrapper.c"
-	   CONFIG_OBS="${CONFIG_OBS} gdbtk.o gdbtk-cmds.o gdbtk-hooks.o gdbtk-varobj.o gdbtk-wrapper.o"
-	   CONFIG_INITS="${CONFIG_INITS} gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c gdbtk/generic/gdbtk-varobj.c gdbtk/generic/gdbtk-wrapper.c"
+
+           CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_GDBTK_OBS)"
+           CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_GDBTK_DEPS)"
+           CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_GDBTK_SRCS)"
+           CONFIG_INITS="${CONFIG_INITS} \$(SUBDIR_GDBTK_INITS)"
 	   CONFIG_ALL="${CONFIG_ALL} \$(SUBDIR_GDBTK_ALL)"
-	   CONFIG_CLEAN="${CONFIG_ALL} \$(SUBDIR_GDBTK_CLEAN)"
+	   CONFIG_CLEAN="${CONFIG_CLEAN} \$(SUBDIR_GDBTK_CLEAN)"
 	   CONFIG_INSTALL="${CONFIG_INSTALL} \$(SUBDIR_GDBTK_INSTALL)"
 	   CONFIG_UNINSTALL="${CONFIG_UNINSTALL} \$(SUBDIR_GDBTK_UNINSTALL)"
 
@@ -873,6 +986,7 @@
 AC_SUBST(ENABLE_CFLAGS)
 
 AC_SUBST(CONFIG_OBS)
+AC_SUBST(CONFIG_LIB_OBS)
 AC_SUBST(CONFIG_DEPS)
 AC_SUBST(CONFIG_SRCS)
 AC_SUBST(CONFIG_INITS)
@@ -975,6 +1089,10 @@
 s/TM_FILE[ 	]*=[ 	]*\([^ 	]*\)/\1/p
 ' ${target_makefile_frag}`
 
+GDB_MULTI_ARCH=`sed -n '
+s/GDB_MULTI_ARCH[ 	]*=[ 	]*\([^ 	]*\)[ 	]*/\1/p
+' ${target_makefile_frag}`
+
 # these really aren't orthogonal true/false values of the same condition,
 # but shells are slow enough that I like to reuse the test conditions
 # whenever possible
@@ -988,6 +1106,34 @@
 fi
 changequote([,])
 
+# New targets should just set gdb_multi_arch=yes in configure.tgt.
+# Old targets being converted can either do that or set GDB_MULTI_ARCH
+# in the target specific makefile frag.  Eventually gdb_multi_arch=yes
+# will be the default.
+if test x"${GDB_MULTI_ARCH}" = x ; then
+    case "${gdb_multi_arch}" in
+    yes ) GDB_MULTI_ARCH=GDB_MULTI_ARCH_PURE ;;
+    no ) GDB_MULTI_ARCH=0 ;;
+    0|1|2 ) GDB_MULTI_ARCH=${gdb_multi_arch} ;;
+    esac
+fi
+if test x"${GDB_MULTI_ARCH}" != x ; then
+    AC_DEFINE_UNQUOTED(GDB_MULTI_ARCH, ${GDB_MULTI_ARCH})
+fi
+# Warn the user when they use an old pratice
+case "${GDB_MULTI_ARCH}" in
+    "" ) ;;
+    0 | GDB_MULTI_ARCH_PARTIAL | 1 | GDB_MULTI_ARCH_TM | 2 )
+	AC_MSG_WARN("GDB: Target is not pure multi-arch") ;;
+    GDB_MULTI_ARCH_PURE )
+	if test x"${targetfile}" != x ; then
+	    AC_MSG_WARN("GDB: Ingoring TM_FILE in ${target_makefile_frag}")
+	    targetfile=""
+	fi ;;
+    *)  AC_MSG_ERROR("GDB: Unknown GDB_MULTI_ARCH value ${GDB_MULTI_ARCH}");;
+esac
+
+
 SUBDIRS="doc testsuite nlm"
 if test "${enable_multi_ice}" = "yes"; then
   SUBDIRS="${SUBDIRS} multi-ice"
@@ -996,32 +1142,45 @@
 AC_SUBST(SUBDIRS)
 
 # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
-# (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the
-# corresponding links.  But we have to remove the xm.h files and tm.h
-# files anyway, e.g. when switching from "configure host" to
-# "configure none".
+# (NAT_FILE) is not set in config/*/*.m[ht] files, we link to an empty
+# version.
 
 files=
 links=
+
 rm -f xm.h
+xm_h=""
 if test "${hostfile}" != ""; then
-files="${files} config/${gdb_host_cpu}/${hostfile}"
-links="${links} xm.h"
+    xm_h=xm.h
+    GDB_XM_FILE="config/${gdb_host_cpu}/${hostfile}"
+    files="${files} ${GDB_XM_FILE}"
+    links="${links} xm.h"
+    AC_DEFINE_UNQUOTED(GDB_XM_FILE, ${GDB_XM_FILE})
 fi
+AC_SUBST(xm_h)
+
 rm -f tm.h
+tm_h=""
 if test "${targetfile}" != ""; then
-files="${files} config/${gdb_target_cpu}/${targetfile}"
-links="${links} tm.h"
+    tm_h=tm.h
+    GDB_TM_FILE="config/${gdb_target_cpu}/${targetfile}"
+    files="${files} ${GDB_TM_FILE}"
+    links="${links} tm.h"
+    AC_DEFINE_UNQUOTED(GDB_TM_FILE, ${GDB_TM_FILE})
 fi
+AC_SUBST(tm_h)
+
 rm -f nm.h
+nm_h=""
 if test "${nativefile}" != ""; then
-files="${files} config/${gdb_host_cpu}/${nativefile}"
-links="${links} nm.h"
-else
-# A cross-only configuration.
-files="${files} config/nm-empty.h"
-links="${links} nm.h"
+    nm_h=nm.h
+    GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}"
+    files="${files} ${GDB_NM_FILE}"
+    links="${links} nm.h"
+    AC_DEFINE_UNQUOTED(GDB_NM_FILE, ${GDB_NM_FILE})
 fi
+AC_SUBST(nm_h)
+
 AC_PROG_LN_S
 
 AC_LINK_FILES($files, $links)
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 99deff2..e1133fc 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -17,6 +17,7 @@
 # OBSOLETE c[12])		gdb_target_cpu=convex ;;
 hppa*)			gdb_target_cpu=pa ;;
 i[3456]86*)		gdb_target_cpu=i386 ;;
+m68hc11*|m6811*)	gdb_target_cpu=m68hc11 ;;
 m68*)			gdb_target_cpu=m68k ;;
 m88*)			gdb_target_cpu=m88k ;;
 mips*)			gdb_target_cpu=mips ;;
@@ -25,6 +26,7 @@
 sparc*)			gdb_target_cpu=sparc ;;
 thumb*)			gdb_target_cpu=arm ;;
 strongarm*)		gdb_target_cpu=arm ;;
+xscale*)		gdb_target_cpu=arm ;;
 v850*)			gdb_target_cpu=v850 ;;
 *)			gdb_target_cpu=$target_cpu ;;
 
@@ -58,6 +60,9 @@
 			gdb_target=embed
                         configdirs="$configdirs rdi-share"
                         ;;
+xscale-*-*)		gdb_target=embed
+                        configdirs="$configdirs rdi-share"
+                        ;;
 # OBSOLETE c1-*-*)		gdb_target=convex ;;
 # OBSOLETE c2-*-*)		gdb_target=convex ;;
 
@@ -71,12 +76,14 @@
 fr30-*-elf*)		gdb_target=fr30 ;;
 
 
-hppa*-*-bsd*)		gdb_target=hppabsd ;;
+hppa*-*-bsd*)		gdb_target=hppabsd
+		configdirs="${configdirs} gdbserver" ;;
 hppa*-*-pro*)		gdb_target=hppapro ;;
-hppa2.0w-*-hpux11*)	gdb_target=hppa64 ;;
+hppa*64*-*-hpux11*)	gdb_target=hppa64 ;;
 hppa*-*-hpux*)		gdb_target=hppahpux ;;
 hppa*-*-hiux*)		gdb_target=hppahpux ;;
-hppa*-*-osf*)		gdb_target=hppaosf ;;
+hppa*-*-osf*)		gdb_target=hppaosf
+		configdirs="${configdirs} gdbserver" ;;
 
 i[3456]86-sequent-bsd*)	gdb_target=symmetry ;;
 i[3456]86-sequent-sysv4*) gdb_target=ptx4 ;;
@@ -133,6 +140,8 @@
 
 m32r-*-elf*)		gdb_target=m32r ;;
 
+m68hc11*-*-*|m6811*-*-*)	gdb_target=m68hc11 ;;
+
 m68000-*-sunos3*)	gdb_target=sun2os3 ;;
 m68000-*-sunos4*)	gdb_target=sun2os4 ;;
 
@@ -160,10 +169,12 @@
 		configdirs="${configdirs} gdbserver" ;;
 m68*-*-lynxos*)		gdb_target=m68klynx
 		configdirs="${configdirs} gdbserver" ;;
-m68*-*-netbsd*)		gdb_target=nbsd ;;
+m68*-*-netbsd*)		gdb_target=nbsd
+		configdirs="${configdirs} gdbserver" ;;
 m68*-*-os68k*)		gdb_target=os68k ;;
 m68*-*-sunos3*)		gdb_target=sun3os3 ;;
-m68*-*-sunos4*)		gdb_target=sun3os4 ;;
+m68*-*-sunos4*)		gdb_target=sun3os4
+		configdirs="${configdirs} gdbserver" ;;
 m68*-*-sysv4*)		gdb_target=m68kv4 ;;
 m68*-*-vxworks*)	gdb_target=vxworks68 ;;
 
@@ -215,7 +226,8 @@
 none-*-*)		gdb_target=none ;;
 
 ns32k-*-mach3*)		gdb_target=ns32km3 ;;
-ns32k-*-netbsd*)	gdb_target=nbsd ;;
+ns32k-*-netbsd*)	gdb_target=nbsd
+		configdirs="${configdirs} gdbserver" ;;
 ns32k-utek-sysv*)	gdb_target=merlin ;;
 ns32k-utek-*)		gdb_target=umax ;;
 
@@ -245,7 +257,8 @@
 
 # OBSOLETE pyramid-*-*)		gdb_target=pyramid ;;
 
-rs6000-*-lynxos*)	gdb_target=rs6000lynx ;;
+rs6000-*-lynxos*)	gdb_target=rs6000lynx
+		configdirs="${configdirs} gdbserver" ;;
 rs6000-*-aix4*)		gdb_target=aix4 ;;
 rs6000-*-*)		gdb_target=rs6000 ;;
 
@@ -260,7 +273,8 @@
 		configdirs="${configdirs} gdbserver" ;;
 sparc-*-netbsd*)	gdb_target=nbsd ;;
 sparc-*-solaris2*)	gdb_target=sun4sol2 ;;
-sparc-*-sunos4*)	gdb_target=sun4os4 ;;
+sparc-*-sunos4*)	gdb_target=sun4os4
+		configdirs="${configdirs} gdbserver" ;;
 sparc-*-sunos5*)	gdb_target=sun4sol2 ;;
 sparc-*-vxworks*)	gdb_target=vxsparc ;;
 sparc-*-*)		gdb_target=sun4os4 ;;
@@ -299,3 +313,9 @@
 
 esac
 
+
+# map GDB target onto multi-arch support
+
+case "${gdb_target}" in
+m68hc11)	gdb_multi_arch=yes ;;
+esac
diff --git a/gdb/convex-tdep.c b/gdb/convex-tdep.c
index 957518a..5106241 100644
--- a/gdb/convex-tdep.c
+++ b/gdb/convex-tdep.c
@@ -114,7 +114,7 @@
 /* OBSOLETE      Mark text segment as empty.  *x/ */
 /* OBSOLETE  */
 /* OBSOLETE   if (execfile) */
-/* OBSOLETE     free (execfile); */
+/* OBSOLETE     xfree (execfile); */
 /* OBSOLETE   execfile = 0; */
 /* OBSOLETE   data_start = 0; */
 /* OBSOLETE   data_end = 0; */
@@ -133,7 +133,7 @@
 /* OBSOLETE   if (filename) */
 /* OBSOLETE     { */
 /* OBSOLETE       filename = tilde_expand (filename); */
-/* OBSOLETE       make_cleanup (free, filename); */
+/* OBSOLETE       make_cleanup (xfree, filename); */
 /* OBSOLETE        */
 /* OBSOLETE       execchan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0, */
 /* OBSOLETE                     &execfile); */
diff --git a/gdb/convex-xdep.c b/gdb/convex-xdep.c
index a1c293a..ea9fcd5 100644
--- a/gdb/convex-xdep.c
+++ b/gdb/convex-xdep.c
@@ -806,7 +806,7 @@
 /* OBSOLETE      and mark data and stack spaces as empty.  *x/ */
 /* OBSOLETE  */
 /* OBSOLETE   if (corefile) */
-/* OBSOLETE     free (corefile); */
+/* OBSOLETE     xfree (corefile); */
 /* OBSOLETE   corefile = 0; */
 /* OBSOLETE  */
 /* OBSOLETE   if (corechan >= 0) */
@@ -824,7 +824,7 @@
 /* OBSOLETE   if (filename) */
 /* OBSOLETE     { */
 /* OBSOLETE       filename = tilde_expand (filename); */
-/* OBSOLETE       make_cleanup (free, filename); */
+/* OBSOLETE       make_cleanup (xfree, filename); */
 /* OBSOLETE        */
 /* OBSOLETE       if (have_inferior_p ()) */
 /* OBSOLETE     error ("To look at a core file, you must kill the program with \"kill\"."); */
diff --git a/gdb/copying.awk b/gdb/copying.awk
index 4f53e92..53f7a6f 100644
--- a/gdb/copying.awk
+++ b/gdb/copying.awk
@@ -7,11 +7,11 @@
 	  print "#include \"command.h\""
 	  print "#include \"gdbcmd.h\""
 	  print ""
-	  print "static void show_copying_command PARAMS ((char *, int));"
+	  print "static void show_copying_command (char *, int);"
 	  print ""
-	  print "static void show_warranty_command PARAMS ((char *, int));"
+	  print "static void show_warranty_command (char *, int);"
 	  print ""
-	  print "void _initialize_copying PARAMS ((void));"
+	  print "void _initialize_copying (void);"
 	  print ""
 	  print "extern int immediate_quit;";
 	  print "static void";
diff --git a/gdb/copying.c b/gdb/copying.c
index 76414bd..a78a862 100644
--- a/gdb/copying.c
+++ b/gdb/copying.c
@@ -13,9 +13,7 @@
 
 extern int immediate_quit;
 static void
-show_copying_command (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+show_copying_command (char *ignore, int from_tty)
 {
   immediate_quit++;
   printf_filtered ("		    GNU GENERAL PUBLIC LICENSE\n");
@@ -279,9 +277,7 @@
 }
 
 static void
-show_warranty_command (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+show_warranty_command (char *ignore, int from_tty)
 {
   immediate_quit++;
   printf_filtered ("			    NO WARRANTY\n");
@@ -310,7 +306,7 @@
 }
 
 void
-_initialize_copying ()
+_initialize_copying (void)
 {
   add_cmd ("copying", no_class, show_copying_command,
 	   "Conditions for redistributing copies of GDB.",
diff --git a/gdb/core-aout.c b/gdb/core-aout.c
index ad64720..367090f 100644
--- a/gdb/core-aout.c
+++ b/gdb/core-aout.c
@@ -73,11 +73,8 @@
  */
 
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR reg_addr;
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+		      CORE_ADDR reg_addr)
 {
   int regno;
   CORE_ADDR addr;
@@ -115,9 +112,7 @@
    BLOCKEND is the address of the end of the user structure.  */
 
 CORE_ADDR
-register_addr (regno, blockend)
-     int regno;
-     CORE_ADDR blockend;
+register_addr (int regno, CORE_ADDR blockend)
 {
   CORE_ADDR addr;
 
@@ -144,7 +139,7 @@
 };
 
 void
-_initialize_core_aout ()
+_initialize_core_aout (void)
 {
   add_core_fns (&aout_core_fns);
 }
diff --git a/gdb/core-regset.c b/gdb/core-regset.c
index 2070da6..a3aa52e 100644
--- a/gdb/core-regset.c
+++ b/gdb/core-regset.c
@@ -72,20 +72,16 @@
    Read the values of either the general register set (WHICH equals 0)
    or the floating point register set (WHICH equals 2) from the core
    file data (pointed to by CORE_REG_SECT), and update gdb's idea of
-   their current values.  The CORE_REG_SIZE parameter is ignored.
+   their current values.  The CORE_REG_SIZE parameter is compared to
+   the size of the gregset or fpgregset structures (as appropriate) to
+   validate the size of the structure from the core file.  The
+   REG_ADDR parameter is ignored.
 
-   NOTES
-
-   Use the indicated sizes to validate the gregset and fpregset
-   structures.
  */
 
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR reg_addr;	/* Unused in this version */
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+		      CORE_ADDR reg_addr)
 {
 #if defined (HAVE_GREGSET_T) && defined (HAVE_FPREGSET_T)
   gregset_t gregset;
@@ -133,7 +129,7 @@
 };
 
 void
-_initialize_core_regset ()
+_initialize_core_regset (void)
 {
   add_core_fns (&regset_core_fns);
 }
diff --git a/gdb/core-sol2.c b/gdb/core-sol2.c
index 46b5eb6..5a32c04 100644
--- a/gdb/core-sol2.c
+++ b/gdb/core-sol2.c
@@ -1,5 +1,5 @@
 /* Machine independent support for Solaris 2 core files for GDB.
-   Copyright 1994 Free Software Foundation, Inc.
+   Copyright 1994, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -26,7 +26,15 @@
    This file combines the core register fetching from core-regset.c
    and sparc-nat.c to be able to read both flavours.  */
 
+/* for Sparc64 cross Sparc32 */
+#define _SYSCALL32
 #include "defs.h"
+
+#if defined (__sparcv9)
+/* Fails to get included by the Solaris system header files.  */
+# include <v9/sys/privregs.h>
+#endif
+
 #include <time.h>
 #include <sys/types.h>
 #include <sys/regset.h>
@@ -45,26 +53,46 @@
 
 static void fetch_core_registers (char *, unsigned, int, CORE_ADDR);
 
+/* Fetch registers from core file data pointed to by CORE_REG_SECT.  When
+   WHICH is 0, the the general register set is fetched; when WHICH is
+   2, the floating point registers are fetched.  CORE_REG_SIZE is used
+   to validate the size of the data pointed to by CORE_REG_SECT.  REG_ADDR
+   is unused. */
+
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR reg_addr;	/* Unused in this version */
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+		      CORE_ADDR reg_addr)
 {
-  prgregset_t prgregset;
-  prfpregset_t prfpregset;
+  int i;
 
   if (which == 0)
     {
-      if (core_reg_size == sizeof (prgregset))
+      prgregset_t prgregset;
+
+      if (core_reg_size == sizeof (prgregset_t))
 	{
 	  memcpy ((char *) &prgregset, core_reg_sect, sizeof (prgregset));
 	  supply_gregset (&prgregset);
 	}
+#if defined (HAVE_PRGREGSET32_T)
+      /* 32-bit corefile, 64-bit debugger.  */
+      else if (core_reg_size == sizeof (prgregset32_t))
+	{
+	  prgreg32_t *core_gregs;
+
+	  /* Can't use memcpy here, because the core file contains
+	     32-bit regs; supply_register expects 64-bit regs.  */
+	  core_gregs = (prgreg32_t *) core_reg_sect;
+	  for (i = 0; i < NPRGREG; i++)
+	    prgregset[i] = core_gregs[i];
+
+	  supply_gregset (&prgregset);
+	}
+#endif /* HAVE_PRGREGSET32_T */
       else if (core_reg_size == sizeof (struct regs))
 	{
-#define gregs ((struct regs *)core_reg_sect)
+	  struct regs *gregs = (struct regs *) core_reg_sect;
+
 	  /* G0 *always* holds 0.  */
 	  *(int *) &registers[REGISTER_BYTE (0)] = 0;
 
@@ -100,14 +128,41 @@
     }
   else if (which == 2)
     {
-      if (core_reg_size == sizeof (prfpregset))
+      prfpregset_t prfpregset;
+
+      if (core_reg_size == sizeof (prfpregset_t))
 	{
 	  memcpy ((char *) &prfpregset, core_reg_sect, sizeof (prfpregset));
 	  supply_fpregset (&prfpregset);
 	}
+#if defined (HAVE_PRFPREGSET32_T)
+      /* 32-bit corefile, 64-bit debugger.  */
+      else if (core_reg_size == sizeof (prfpregset32_t))
+	{
+	  prfpregset32_t *core_fpregset;
+
+	  /* Can't use memcpy here, because the core file contains
+	     32-bit regs; supply_fpregset expects 64-bit regs.  */
+
+	  core_fpregset = (prfpregset32_t *) core_reg_sect;
+	  for (i = 0; i < 16; i++)
+	    prfpregset.pr_fr.pr_dregs[i] = core_fpregset->pr_fr.pr_dregs[i];
+	  while (i < 32)
+	    prfpregset.pr_fr.pr_dregs[i++] = 0;
+
+	  prfpregset.pr_fsr         = core_fpregset->pr_fsr;
+	  prfpregset.pr_qcnt        = core_fpregset->pr_qcnt;
+	  prfpregset.pr_q_entrysize = core_fpregset->pr_q_entrysize;
+	  prfpregset.pr_en          = core_fpregset->pr_en;
+	  /* We will not use the pr_q array.  */
+
+	  supply_fpregset (&prfpregset);
+	}
+#endif /* HAVE_PRFPREGSET32_T */
       else if (core_reg_size >= sizeof (struct fpu))
 	{
-#define fpuregs  ((struct fpu *) core_reg_sect)
+	  struct fpu *fpuregs = (struct fpu *) core_reg_sect;
+
 	  memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &fpuregs->fpu_fr,
 		  sizeof (fpuregs->fpu_fr));
 	  memcpy (&registers[REGISTER_BYTE (FPS_REGNUM)], &fpuregs->fpu_fsr,
@@ -133,7 +188,7 @@
 };
 
 void
-_initialize_core_solaris ()
+_initialize_core_solaris (void)
 {
   add_core_fns (&solaris_core_fns);
 }
diff --git a/gdb/corefile.c b/gdb/corefile.c
index c8772de..4447f77 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -37,6 +37,7 @@
 #include "gdb_stat.h"
 #include "symfile.h"
 #include "objfiles.h"
+#include "completer.h"
 
 /* Local function declarations.  */
 
@@ -65,9 +66,7 @@
 /* Backward compatability with old way of specifying core files.  */
 
 void
-core_file_command (filename, from_tty)
-     char *filename;
-     int from_tty;
+core_file_command (char *filename, int from_tty)
 {
   struct target_ops *t;
 
@@ -92,7 +91,7 @@
 	      {
 		char *symfile_copy = xstrdup (symfile);
 
-		make_cleanup (free, symfile_copy);
+		make_cleanup (xfree, symfile_copy);
 		symbol_file_command (symfile_copy, from_tty);
 	      }
 	    else
@@ -110,8 +109,7 @@
  * this function will call all of the hook functions. */
 
 static void
-call_extra_exec_file_hooks (filename)
-     char *filename;
+call_extra_exec_file_hooks (char *filename)
 {
   int i;
 
@@ -123,8 +121,7 @@
    This is called from the x-window display code.  */
 
 void
-specify_exec_file_hook (hook)
-     void (*hook) (char *);
+specify_exec_file_hook (void (*hook) (char *))
 {
   hook_type *new_array;
 
@@ -160,7 +157,7 @@
    be reopened.  */
 
 void
-close_exec_file ()
+close_exec_file (void)
 {
 #if 0				/* FIXME */
   if (exec_bfd)
@@ -169,7 +166,7 @@
 }
 
 void
-reopen_exec_file ()
+reopen_exec_file (void)
 {
 #if 0				/* FIXME */
   if (exec_bfd)
@@ -186,7 +183,7 @@
 
   /* If the timestamp of the exec file has changed, reopen it. */
   filename = xstrdup (bfd_get_filename (exec_bfd));
-  make_cleanup (free, filename);
+  make_cleanup (xfree, filename);
   mtime = bfd_get_mtime (exec_bfd);
   res = stat (filename, &st);
 
@@ -199,7 +196,7 @@
    print a warning if they don't go together.  */
 
 void
-validate_files ()
+validate_files (void)
 {
   if (exec_bfd && core_bfd)
     {
@@ -215,8 +212,7 @@
    otherwise return 0 in that case.  */
 
 char *
-get_exec_file (err)
-     int err;
+get_exec_file (int err)
 {
   if (exec_bfd)
     return bfd_get_filename (exec_bfd);
@@ -232,9 +228,7 @@
 /* Report a memory error with error().  */
 
 void
-memory_error (status, memaddr)
-     int status;
-     CORE_ADDR memaddr;
+memory_error (int status, CORE_ADDR memaddr)
 {
   struct ui_file *tmp_stream = mem_fileopen ();
   make_cleanup_ui_file_delete (tmp_stream);
@@ -259,10 +253,7 @@
 
 /* Same as target_read_memory, but report an error if can't read.  */
 void
-read_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+read_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int status;
   status = target_read_memory (memaddr, myaddr, len);
@@ -272,40 +263,29 @@
 
 /* Like target_read_memory, but slightly different parameters.  */
 int
-dis_asm_read_memory (memaddr, myaddr, len, info)
-     bfd_vma memaddr;
-     bfd_byte *myaddr;
-     unsigned int len;
-     disassemble_info *info;
+dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr, unsigned int len,
+		     disassemble_info *info)
 {
   return target_read_memory (memaddr, (char *) myaddr, len);
 }
 
 /* Like memory_error with slightly different parameters.  */
 void
-dis_asm_memory_error (status, memaddr, info)
-     int status;
-     bfd_vma memaddr;
-     disassemble_info *info;
+dis_asm_memory_error (int status, bfd_vma memaddr, disassemble_info *info)
 {
   memory_error (status, memaddr);
 }
 
 /* Like print_address with slightly different parameters.  */
 void
-dis_asm_print_address (addr, info)
-     bfd_vma addr;
-     struct disassemble_info *info;
+dis_asm_print_address (bfd_vma addr, struct disassemble_info *info)
 {
   print_address (addr, info->stream);
 }
 
 /* Same as target_write_memory, but report an error if can't write.  */
 void
-write_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+write_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int status;
 
@@ -317,9 +297,7 @@
 /* Read an integer from debugged memory, given address and number of bytes.  */
 
 LONGEST
-read_memory_integer (memaddr, len)
-     CORE_ADDR memaddr;
-     int len;
+read_memory_integer (CORE_ADDR memaddr, int len)
 {
   char buf[sizeof (LONGEST)];
 
@@ -328,9 +306,7 @@
 }
 
 ULONGEST
-read_memory_unsigned_integer (memaddr, len)
-     CORE_ADDR memaddr;
-     int len;
+read_memory_unsigned_integer (CORE_ADDR memaddr, int len)
 {
   char buf[sizeof (ULONGEST)];
 
@@ -339,10 +315,7 @@
 }
 
 void
-read_memory_string (memaddr, buffer, max_len)
-     CORE_ADDR memaddr;
-     char *buffer;
-     int max_len;
+read_memory_string (CORE_ADDR memaddr, char *buffer, int max_len)
 {
   register char *cp;
   register int i;
@@ -376,17 +349,9 @@
    if the protocol has a less general search function, they can call this
    in the cases it can't handle.  */
 void
-generic_search (len, data, mask, startaddr, increment, lorange, hirange
-		addr_found, data_found)
-     int len;
-     char *data;
-     char *mask;
-     CORE_ADDR startaddr;
-     int increment;
-     CORE_ADDR lorange;
-     CORE_ADDR hirange;
-     CORE_ADDR *addr_found;
-     char *data_found;
+generic_search (int len, char *data, char *mask, CORE_ADDR startaddr,
+		int increment, CORE_ADDR lorange, CORE_ADDR hirange,
+		CORE_ADDR *addr_found, char *data_found)
 {
   int i;
   CORE_ADDR curaddr = startaddr;
@@ -419,10 +384,7 @@
 static void set_gnutarget_command (char *, int, struct cmd_list_element *);
 
 static void
-set_gnutarget_command (ignore, from_tty, c)
-     char *ignore;
-     int from_tty;
-     struct cmd_list_element *c;
+set_gnutarget_command (char *ignore, int from_tty, struct cmd_list_element *c)
 {
   if (STREQ (gnutarget_string, "auto"))
     gnutarget = NULL;
@@ -432,17 +394,16 @@
 
 /* Set the gnutarget.  */
 void
-set_gnutarget (newtarget)
-     char *newtarget;
+set_gnutarget (char *newtarget)
 {
   if (gnutarget_string != NULL)
-    free (gnutarget_string);
+    xfree (gnutarget_string);
   gnutarget_string = savestring (newtarget, strlen (newtarget));
   set_gnutarget_command (NULL, 0, NULL);
 }
 
 void
-_initialize_core ()
+_initialize_core (void)
 {
   struct cmd_list_element *c;
   c = add_cmd ("core-file", class_files, core_file_command,
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 43163d9..78e50ae 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -33,6 +33,10 @@
 #include "gdbcore.h"
 #include "gdbthread.h"
 
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
 /* List of all available core_fns.  On gdb startup, each core file register
    reader calls add_core_fns() to register information on each core format it
    is prepared to read. */
@@ -84,8 +88,7 @@
    handle. */
 
 void
-add_core_fns (cf)
-     struct core_fns *cf;
+add_core_fns (struct core_fns *cf)
 {
   cf->next = core_file_fns;
   core_file_fns = cf;
@@ -96,9 +99,7 @@
    reading the core file. */
 
 int
-default_core_sniffer (our_fns, abfd)
-     struct core_fns *our_fns;
-     bfd *abfd;
+default_core_sniffer (struct core_fns *our_fns, bfd *abfd)
 {
   int result;
 
@@ -108,12 +109,11 @@
 
 /* Walk through the list of core functions to find a set that can
    handle the core file open on ABFD.  Default to the first one in the
-   list of nothing matches.  Returns pointer to set that is
+   list if nothing matches.  Returns pointer to set that is
    selected. */
 
 static struct core_fns *
-sniff_core_bfd (abfd)
-     bfd *abfd;
+sniff_core_bfd (bfd *abfd)
 {
   struct core_fns *cf;
   struct core_fns *yummy = NULL;
@@ -149,8 +149,7 @@
    core file handler that recognizes it. */
 
 int
-default_check_format (abfd)
-     bfd *abfd;
+default_check_format (bfd *abfd)
 {
   return (0);
 }
@@ -158,8 +157,7 @@
 /* Attempt to recognize core file formats that BFD rejects. */
 
 static boolean 
-gdb_check_format (abfd)
-     bfd *abfd;
+gdb_check_format (bfd *abfd)
 {
   struct core_fns *cf;
 
@@ -178,8 +176,7 @@
 
 /* ARGSUSED */
 static void
-core_close (quitting)
-     int quitting;
+core_close (int quitting)
 {
   char *name;
 
@@ -197,11 +194,11 @@
       if (!bfd_close (core_bfd))
 	warning ("cannot close \"%s\": %s",
 		 name, bfd_errmsg (bfd_get_error ()));
-      free (name);
+      xfree (name);
       core_bfd = NULL;
       if (core_ops.to_sections)
 	{
-	  free ((PTR) core_ops.to_sections);
+	  xfree (core_ops.to_sections);
 	  core_ops.to_sections = NULL;
 	  core_ops.to_sections_end = NULL;
 	}
@@ -220,8 +217,7 @@
    is really an int * which points to from_tty.  */
 
 static int
-solib_add_stub (from_ttyp)
-     PTR from_ttyp;
+solib_add_stub (PTR from_ttyp)
 {
   SOLIB_ADD (NULL, *(int *) from_ttyp, &current_target);
   re_enable_breakpoints_in_shlibs ();
@@ -233,10 +229,7 @@
    list of threads in a core file.  */
 
 static void
-add_to_thread_list (abfd, asect, reg_sect_arg)
-     bfd *abfd;
-     asection *asect;
-     PTR reg_sect_arg;
+add_to_thread_list (bfd *abfd, asection *asect, PTR reg_sect_arg)
 {
   int thread_id;
   asection *reg_sect = (asection *) reg_sect_arg;
@@ -258,9 +251,7 @@
 /* This routine opens and sets up the core file bfd.  */
 
 static void
-core_open (filename, from_tty)
-     char *filename;
-     int from_tty;
+core_open (char *filename, int from_tty)
 {
   const char *p;
   int siggy;
@@ -282,13 +273,13 @@
   if (filename[0] != '/')
     {
       temp = concat (current_directory, "/", filename, NULL);
-      free (filename);
+      xfree (filename);
       filename = temp;
     }
 
-  old_chain = make_cleanup (free, filename);
+  old_chain = make_cleanup (xfree, filename);
 
-  scratch_chan = open (filename, write_files ? O_RDWR : O_RDONLY, 0);
+  scratch_chan = open (filename, O_BINARY | ( write_files ? O_RDWR : O_RDONLY ), 0);
   if (scratch_chan < 0)
     perror_with_name (filename);
 
@@ -338,7 +329,7 @@
   siggy = bfd_core_file_failing_signal (core_bfd);
   if (siggy > 0)
     /* NOTE: target_signal_from_host() converts a target signal value
-       into gdb's internal signal value.  Unfortunatly gdb's internal
+       into gdb's internal signal value.  Unfortunately gdb's internal
        value is called ``target_signal'' and this function got the
        name ..._from_host(). */
     printf_filtered ("Program terminated with signal %d, %s.\n", siggy,
@@ -375,9 +366,7 @@
 }
 
 static void
-core_detach (args, from_tty)
-     char *args;
-     int from_tty;
+core_detach (char *args, int from_tty)
 {
   if (args)
     error ("Too many arguments");
@@ -451,8 +440,7 @@
 
 /* ARGSUSED */
 static void
-get_core_registers (regno)
-     int regno;
+get_core_registers (int regno)
 {
   int status;
 
@@ -472,8 +460,7 @@
 }
 
 static char *
-core_file_to_sym_file (core)
-     char *core;
+core_file_to_sym_file (char *core)
 {
   CONST char *failing_command;
   char *p;
@@ -535,8 +522,7 @@
 }
 
 static void
-core_files_info (t)
-     struct target_ops *t;
+core_files_info (struct target_ops *t)
 {
   print_section_info (t, core_bfd);
 }
@@ -545,9 +531,7 @@
    `gdb internal error' (since generic_mourn calls breakpoint_init_inferior).  */
 
 static int
-ignore (addr, contents)
-     CORE_ADDR addr;
-     char *contents;
+ignore (CORE_ADDR addr, char *contents)
 {
   return 0;
 }
@@ -560,8 +544,7 @@
    behaviour.
  */
 static int
-core_file_thread_alive (tid)
-     int tid;
+core_file_thread_alive (int tid)
 {
   return 1;
 }
@@ -569,7 +552,7 @@
 /* Fill in core_ops with its defined operations and properties.  */
 
 static void
-init_core_ops ()
+init_core_ops (void)
 {
   core_ops.to_shortname = "core";
   core_ops.to_longname = "Local core dump file";
@@ -606,7 +589,7 @@
 int coreops_suppress_target;
 
 void
-_initialize_corelow ()
+_initialize_corelow (void)
 {
   init_core_ops ();
 
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 58bbc7c..7f48a12 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -63,10 +63,7 @@
 
 
 void
-cp_print_class_method (valaddr, type, stream)
-     char *valaddr;
-     struct type *type;
-     struct ui_file *stream;
+cp_print_class_method (char *valaddr, struct type *type, struct ui_file *stream)
 {
   struct type *domain;
   struct fn_field *f = NULL;
@@ -155,7 +152,7 @@
       else
 	{
 	  fputs_filtered (demangled_name, stream);
-	  free (demangled_name);
+	  xfree (demangled_name);
 	}
     }
   else
@@ -184,8 +181,7 @@
    "pointer to virtual function".  */
 
 int
-cp_is_vtbl_ptr_type (type)
-     struct type *type;
+cp_is_vtbl_ptr_type (struct type *type)
 {
   char *typename = type_name_no_tag (type);
 
@@ -198,8 +194,7 @@
    "pointer to virtual function table".  */
 
 int
-cp_is_vtbl_member (type)
-     struct type *type;
+cp_is_vtbl_member (struct type *type)
 {
   if (TYPE_CODE (type) == TYPE_CODE_PTR)
     {
@@ -232,19 +227,10 @@
    should not print, or zero if called from top level.  */
 
 void
-cp_print_value_fields (type, real_type, valaddr, offset, address, stream, format, recurse, pretty,
-		       dont_print_vb, dont_print_statmem)
-     struct type *type;
-     struct type *real_type;
-     char *valaddr;
-     int offset;
-     CORE_ADDR address;
-     struct ui_file *stream;
-     int format;
-     int recurse;
-     enum val_prettyprint pretty;
-     struct type **dont_print_vb;
-     int dont_print_statmem;
+cp_print_value_fields (struct type *type, struct type *real_type, char *valaddr,
+		       int offset, CORE_ADDR address, struct ui_file *stream,
+		       int format, int recurse, enum val_prettyprint pretty,
+		       struct type **dont_print_vb, int dont_print_statmem)
 {
   int i, len, n_baseclasses;
   struct obstack tmp_obstack;
@@ -472,7 +458,7 @@
 	    }			/* non-RRBC case */
 	  else
 	    {
-	      /* FIXME -- seem comments above */
+	      /* FIXME -- see comments above */
 	      /* RRBC support present; function pointers are found
 	       * by indirection through the class segment entries. */
 
@@ -495,18 +481,10 @@
    baseclasses.  */
 
 static void
-cp_print_value (type, real_type, valaddr, offset, address, stream, format, recurse, pretty,
-		dont_print_vb)
-     struct type *type;
-     struct type *real_type;
-     char *valaddr;
-     int offset;
-     CORE_ADDR address;
-     struct ui_file *stream;
-     int format;
-     int recurse;
-     enum val_prettyprint pretty;
-     struct type **dont_print_vb;
+cp_print_value (struct type *type, struct type *real_type, char *valaddr,
+		int offset, CORE_ADDR address, struct ui_file *stream,
+		int format, int recurse, enum val_prettyprint pretty,
+		struct type **dont_print_vb)
 {
   struct obstack tmp_obstack;
   struct type **last_dont_print
@@ -627,13 +605,8 @@
    have the same meanings as in c_val_print.  */
 
 static void
-cp_print_static_field (type, val, stream, format, recurse, pretty)
-     struct type *type;
-     value_ptr val;
-     struct ui_file *stream;
-     int format;
-     int recurse;
-     enum val_prettyprint pretty;
+cp_print_static_field (struct type *type, value_ptr val, struct ui_file *stream,
+		       int format, int recurse, enum val_prettyprint pretty)
 {
   if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
     {
@@ -668,11 +641,8 @@
 }
 
 void
-cp_print_class_member (valaddr, domain, stream, prefix)
-     char *valaddr;
-     struct type *domain;
-     struct ui_file *stream;
-     char *prefix;
+cp_print_class_member (char *valaddr, struct type *domain,
+		       struct ui_file *stream, char *prefix)
 {
 
   /* VAL is a byte offset into the structure type DOMAIN.
@@ -746,14 +716,10 @@
 
 
 static void
-cp_print_hpacc_virtual_table_entries (type, vfuncs, v, stream, format, recurse, pretty)
-     struct type *type;
-     int *vfuncs;
-     value_ptr v;
-     struct ui_file *stream;
-     int format;
-     int recurse;
-     enum val_prettyprint pretty;
+cp_print_hpacc_virtual_table_entries (struct type *type, int *vfuncs,
+				      value_ptr v, struct ui_file *stream,
+				      int format, int recurse,
+				      enum val_prettyprint pretty)
 {
   int fn, oi;
 
@@ -798,7 +764,7 @@
 
 
 void
-_initialize_cp_valprint ()
+_initialize_cp_valprint (void)
 {
   add_show_from_set
     (add_set_cmd ("static-members", class_support, var_boolean,
@@ -827,5 +793,5 @@
   obstack_begin (&dont_print_vb_obstack, 32 * sizeof (struct type *));
   obstack_specify_allocation (&dont_print_statmem_obstack,
 			      32 * sizeof (CORE_ADDR), sizeof (CORE_ADDR),
-			      xmalloc, free);
+			      xmalloc, xfree);
 }
diff --git a/gdb/cpu32bug-rom.c b/gdb/cpu32bug-rom.c
index 8bd0ea2..6b77506 100644
--- a/gdb/cpu32bug-rom.c
+++ b/gdb/cpu32bug-rom.c
@@ -29,11 +29,7 @@
 static void cpu32bug_open (char *args, int from_tty);
 
 static void
-cpu32bug_supply_register (regname, regnamelen, val, vallen)
-     char *regname;
-     int regnamelen;
-     char *val;
-     int vallen;
+cpu32bug_supply_register (char *regname, int regnamelen, char *val, int vallen)
 {
   int regno;
 
@@ -146,15 +142,13 @@
 };				/* init_cpu32bug_cmds */
 
 static void
-cpu32bug_open (args, from_tty)
-     char *args;
-     int from_tty;
+cpu32bug_open (char *args, int from_tty)
 {
   monitor_open (args, &cpu32bug_cmds, from_tty);
 }
 
 void
-_initialize_cpu32bug_rom ()
+_initialize_cpu32bug_rom (void)
 {
   init_cpu32bug_cmds ();
   init_monitor_ops (&cpu32bug_ops);
diff --git a/gdb/cxux-nat.c b/gdb/cxux-nat.c
index 93ed232..74b2010 100644
--- a/gdb/cxux-nat.c
+++ b/gdb/cxux-nat.c
@@ -66,8 +66,7 @@
 extern int errno;
 
 void
-fetch_inferior_registers (regno)
-     int regno;			/* Original value discarded */
+fetch_inferior_registers (int regno)
 {
   register unsigned int regaddr;
   char buf[MAX_REGISTER_RAW_SIZE];
@@ -139,8 +138,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   register unsigned int regaddr;
   char buf[80];
@@ -249,8 +247,7 @@
 
 /* blockend is the address of the end of the user structure */
 
-m88k_register_u_addr (blockend, regnum)
-     int blockend, regnum;
+m88k_register_u_addr (int blockend, int regnum)
 {
   struct USER u;
   int ustart = blockend - sizeof (struct USER);
@@ -289,8 +286,7 @@
    register values. */
 
 void
-supply_gregset (gregsetp)
-     gregset_t *gregsetp;
+supply_gregset (gregset_t *gregsetp)
 {
   register int regi;
   register greg_t *regp = (greg_t *) gregsetp;
@@ -307,9 +303,7 @@
 }
 
 void
-fill_gregset (gregsetp, regno)
-     gregset_t *gregsetp;
-     int regno;
+fill_gregset (gregset_t *gregsetp, int regno)
 {
   int regi;
   register greg_t *regp = (greg_t *) gregsetp;
@@ -357,7 +351,7 @@
 #endif
 
 void
-add_shared_symbol_files ()
+add_shared_symbol_files (void)
 {
   void *desc;
   struct link_map *ld_map, *lm, lms;
@@ -392,7 +386,7 @@
 	      section_addrs.other[0].addr = lms.l_addr;
               section_addrs.other[0].name = ".text";
 	      symbol_file_add (path_name, 1, &section_addrs, 0, 0);
-	      free (path_name);
+	      xfree (path_name);
 	    }
 	}
       /* traverse links in reverse order so that we get the
@@ -410,8 +404,7 @@
 #include <sys/regset.h>
 
 unsigned int
-m88k_harris_core_register_addr (regno, reg_ptr)
-     int regno, reg_ptr;
+m88k_harris_core_register_addr (int regno, int reg_ptr)
 {
   unsigned int word_offset;
 
@@ -447,7 +440,7 @@
 #endif /* _ES_MP */
 
 void
-_initialize_m88k_nat ()
+_initialize_m88k_nat (void)
 {
 #ifdef _ES_MP
   /* Enable 88110 support, as we don't support the 88100 under ES/MP.  */
@@ -465,8 +458,7 @@
    register values. */
 
 void
-supply_gregset (gregsetp)
-     gregset_t *gregsetp;
+supply_gregset (gregset_t *gregsetp)
 {
   register int regi;
   register greg_t *regp = (greg_t *) gregsetp;
@@ -488,8 +480,7 @@
    idea of the current floating point register values.  */
 
 void
-supply_fpregset (fpregsetp)
-     fpregset_t *fpregsetp;
+supply_fpregset (fpregset_t *fpregsetp)
 {
   register int regi;
   char *from;
diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c
index 3aab494..ee14aba 100644
--- a/gdb/d10v-tdep.c
+++ b/gdb/d10v-tdep.c
@@ -55,7 +55,6 @@
     int nr_dmap_regs;
     unsigned long (*dmap_register) (int nr);
     unsigned long (*imap_register) (int nr);
-    int (*register_sim_regno) (int nr);
   };
 
 /* These are the addresses the D10V-EVA board maps data and
@@ -100,9 +99,7 @@
 static void do_d10v_pop_frame (struct frame_info *fi);
 
 int
-d10v_frame_chain_valid (chain, frame)
-     CORE_ADDR chain;
-     struct frame_info *frame;	/* not used here */
+d10v_frame_chain_valid (CORE_ADDR chain, struct frame_info *frame)
 {
   return ((chain) != 0 && (frame) != 0 && (frame)->pc > IMEM_START);
 }
@@ -121,18 +118,14 @@
    registers. */
 
 int
-d10v_use_struct_convention (gcc_p, type)
-     int gcc_p;
-     struct type *type;
+d10v_use_struct_convention (int gcc_p, struct type *type)
 {
   return (TYPE_LENGTH (type) > 8);
 }
 
 
 unsigned char *
-d10v_breakpoint_from_pc (pcptr, lenptr)
-     CORE_ADDR *pcptr;
-     int *lenptr;
+d10v_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
 {
   static unsigned char breakpoint[] =
   {0x2f, 0x90, 0x5e, 0x00};
@@ -198,7 +191,7 @@
   return register_names[reg_nr];
 }
 
-/* Access the DMAP/IMAP registers in a target independant way. */
+/* Access the DMAP/IMAP registers in a target independent way. */
 
 static unsigned long
 d10v_ts2_dmap_register (int reg_nr)
@@ -278,18 +271,11 @@
   return nr;
 }
 
-int
-d10v_register_sim_regno (int nr)
-{
-  return gdbarch_tdep (current_gdbarch)->register_sim_regno (nr);
-}
-
 /* Index within `registers' of the first byte of the space for
    register REG_NR.  */
 
 int
-d10v_register_byte (reg_nr)
-     int reg_nr;
+d10v_register_byte (int reg_nr)
 {
   if (reg_nr < A0_REGNUM)
     return (reg_nr * 2);
@@ -306,8 +292,7 @@
    register REG_NR.  */
 
 int
-d10v_register_raw_size (reg_nr)
-     int reg_nr;
+d10v_register_raw_size (int reg_nr)
 {
   if (reg_nr < A0_REGNUM)
     return 2;
@@ -321,8 +306,7 @@
    for register N.  */
 
 int
-d10v_register_virtual_size (reg_nr)
-     int reg_nr;
+d10v_register_virtual_size (int reg_nr)
 {
   return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (reg_nr));
 }
@@ -331,8 +315,7 @@
    of data in register N.  */
 
 struct type *
-d10v_register_virtual_type (reg_nr)
-     int reg_nr;
+d10v_register_virtual_type (int reg_nr)
 {
   if (reg_nr >= A0_REGNUM
       && reg_nr < (A0_REGNUM + NR_A_REGS))
@@ -346,18 +329,14 @@
 
 /* convert $pc and $sp to/from virtual addresses */
 int
-d10v_register_convertible (nr)
-     int nr;
+d10v_register_convertible (int nr)
 {
   return ((nr) == PC_REGNUM || (nr) == SP_REGNUM);
 }
 
 void
-d10v_register_convert_to_virtual (regnum, type, from, to)
-     int regnum;
-     struct type *type;
-     char *from;
-     char *to;
+d10v_register_convert_to_virtual (int regnum, struct type *type, char *from,
+				  char *to)
 {
   ULONGEST x = extract_unsigned_integer (from, REGISTER_RAW_SIZE (regnum));
   if (regnum == PC_REGNUM)
@@ -368,11 +347,8 @@
 }
 
 void
-d10v_register_convert_to_raw (type, regnum, from, to)
-     struct type *type;
-     int regnum;
-     char *from;
-     char *to;
+d10v_register_convert_to_raw (struct type *type, int regnum, char *from,
+			      char *to)
 {
   ULONGEST x = extract_unsigned_integer (from, TYPE_LENGTH (type));
   x &= 0x3ffff;
@@ -383,44 +359,38 @@
 
 
 CORE_ADDR
-d10v_make_daddr (x)
-     CORE_ADDR x;
+d10v_make_daddr (CORE_ADDR x)
 {
   return ((x) | DMEM_START);
 }
 
 CORE_ADDR
-d10v_make_iaddr (x)
-     CORE_ADDR x;
+d10v_make_iaddr (CORE_ADDR x)
 {
   return (((x) << 2) | IMEM_START);
 }
 
 int
-d10v_daddr_p (x)
-     CORE_ADDR x;
+d10v_daddr_p (CORE_ADDR x)
 {
   return (((x) & 0x3000000) == DMEM_START);
 }
 
 int
-d10v_iaddr_p (x)
-     CORE_ADDR x;
+d10v_iaddr_p (CORE_ADDR x)
 {
   return (((x) & 0x3000000) == IMEM_START);
 }
 
 
 CORE_ADDR
-d10v_convert_iaddr_to_raw (x)
-     CORE_ADDR x;
+d10v_convert_iaddr_to_raw (CORE_ADDR x)
 {
   return (((x) >> 2) & 0xffff);
 }
 
 CORE_ADDR
-d10v_convert_daddr_to_raw (x)
-     CORE_ADDR x;
+d10v_convert_daddr_to_raw (CORE_ADDR x)
 {
   return ((x) & 0xffff);
 }
@@ -432,9 +402,7 @@
    register. */
 
 void
-d10v_store_struct_return (addr, sp)
-     CORE_ADDR addr;
-     CORE_ADDR sp;
+d10v_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
 {
   write_register (ARG1_REGNUM, (addr));
 }
@@ -445,9 +413,7 @@
    Things always get returned in RET1_REGNUM, RET2_REGNUM, ... */
 
 void
-d10v_store_return_value (type, valbuf)
-     struct type *type;
-     char *valbuf;
+d10v_store_return_value (struct type *type, char *valbuf)
 {
   write_register_bytes (REGISTER_BYTE (RET1_REGNUM),
 			valbuf,
@@ -459,8 +425,7 @@
    as a CORE_ADDR (or an expression that can be used as one).  */
 
 CORE_ADDR
-d10v_extract_struct_value_address (regbuf)
-     char *regbuf;
+d10v_extract_struct_value_address (char *regbuf)
 {
   return (extract_address ((regbuf) + REGISTER_BYTE (ARG1_REGNUM),
 			   REGISTER_RAW_SIZE (ARG1_REGNUM))
@@ -468,22 +433,19 @@
 }
 
 CORE_ADDR
-d10v_frame_saved_pc (frame)
-     struct frame_info *frame;
+d10v_frame_saved_pc (struct frame_info *frame)
 {
   return ((frame)->extra_info->return_pc);
 }
 
 CORE_ADDR
-d10v_frame_args_address (fi)
-     struct frame_info *fi;
+d10v_frame_args_address (struct frame_info *fi)
 {
   return (fi)->frame;
 }
 
 CORE_ADDR
-d10v_frame_locals_address (fi)
-     struct frame_info *fi;
+d10v_frame_locals_address (struct frame_info *fi)
 {
   return (fi)->frame;
 }
@@ -493,8 +455,7 @@
    the stack and that may not be written yet. */
 
 CORE_ADDR
-d10v_saved_pc_after_call (frame)
-     struct frame_info *frame;
+d10v_saved_pc_after_call (struct frame_info *frame)
 {
   return ((read_register (LR_REGNUM) << 2)
 	  | IMEM_START);
@@ -504,14 +465,13 @@
    registers.  */
 
 void
-d10v_pop_frame ()
+d10v_pop_frame (void)
 {
   generic_pop_current_frame (do_d10v_pop_frame);
 }
 
 static void
-do_d10v_pop_frame (fi)
-     struct frame_info *fi;
+do_d10v_pop_frame (struct frame_info *fi)
 {
   CORE_ADDR fp;
   int regnum;
@@ -550,8 +510,7 @@
 }
 
 static int
-check_prologue (op)
-     unsigned short op;
+check_prologue (unsigned short op)
 {
   /* st  rn, @-sp */
   if ((op & 0x7E1F) == 0x6C1F)
@@ -585,8 +544,7 @@
 }
 
 CORE_ADDR
-d10v_skip_prologue (pc)
-     CORE_ADDR pc;
+d10v_skip_prologue (CORE_ADDR pc)
 {
   unsigned long op;
   unsigned short op1, op2;
@@ -654,8 +612,7 @@
  */
 
 CORE_ADDR
-d10v_frame_chain (fi)
-     struct frame_info *fi;
+d10v_frame_chain (struct frame_info *fi)
 {
   d10v_frame_init_saved_regs (fi);
 
@@ -683,10 +640,7 @@
 static int next_addr, uses_frame;
 
 static int
-prologue_find_regs (op, fi, addr)
-     unsigned short op;
-     struct frame_info *fi;
-     CORE_ADDR addr;
+prologue_find_regs (unsigned short op, struct frame_info *fi, CORE_ADDR addr)
 {
   int n;
 
@@ -757,8 +711,7 @@
    for it IS the sp for the next frame. */
 
 void
-d10v_frame_init_saved_regs (fi)
-     struct frame_info *fi;
+d10v_frame_init_saved_regs (struct frame_info *fi)
 {
   CORE_ADDR fp, pc;
   unsigned long op;
@@ -859,9 +812,7 @@
 }
 
 void
-d10v_init_extra_frame_info (fromleaf, fi)
-     int fromleaf;
-     struct frame_info *fi;
+d10v_init_extra_frame_info (int fromleaf, struct frame_info *fi)
 {
   fi->extra_info = (struct frame_extra_info *)
     frame_obstack_alloc (sizeof (struct frame_extra_info));
@@ -884,9 +835,7 @@
 }
 
 static void
-show_regs (args, from_tty)
-     char *args;
-     int from_tty;
+show_regs (char *args, int from_tty)
 {
   int a;
   printf_filtered ("PC=%04lx (0x%lx) PSW=%04lx RPT_S=%04lx RPT_E=%04lx RPT_C=%04lx\n",
@@ -946,8 +895,7 @@
 }
 
 CORE_ADDR
-d10v_read_pc (pid)
-     int pid;
+d10v_read_pc (int pid)
 {
   int save_pid;
   CORE_ADDR pc;
@@ -962,9 +910,7 @@
 }
 
 void
-d10v_write_pc (val, pid)
-     CORE_ADDR val;
-     int pid;
+d10v_write_pc (CORE_ADDR val, int pid)
 {
   int save_pid;
 
@@ -975,27 +921,25 @@
 }
 
 CORE_ADDR
-d10v_read_sp ()
+d10v_read_sp (void)
 {
   return (D10V_MAKE_DADDR (read_register (SP_REGNUM)));
 }
 
 void
-d10v_write_sp (val)
-     CORE_ADDR val;
+d10v_write_sp (CORE_ADDR val)
 {
   write_register (SP_REGNUM, D10V_CONVERT_DADDR_TO_RAW (val));
 }
 
 void
-d10v_write_fp (val)
-     CORE_ADDR val;
+d10v_write_fp (CORE_ADDR val)
 {
   write_register (FP_REGNUM, D10V_CONVERT_DADDR_TO_RAW (val));
 }
 
 CORE_ADDR
-d10v_read_fp ()
+d10v_read_fp (void)
 {
   return (D10V_MAKE_DADDR (read_register (FP_REGNUM)));
 }
@@ -1005,9 +949,7 @@
    Needed for targets where we don't actually execute a JSR/BSR instruction */
 
 CORE_ADDR
-d10v_push_return_address (pc, sp)
-     CORE_ADDR pc;
-     CORE_ADDR sp;
+d10v_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
 {
   write_register (LR_REGNUM, D10V_CONVERT_IADDR_TO_RAW (CALL_DUMMY_ADDRESS ()));
   return sp;
@@ -1027,10 +969,7 @@
 static struct stack_item *push_stack_item (struct stack_item *prev,
 					   void *contents, int len);
 static struct stack_item *
-push_stack_item (prev, contents, len)
-     struct stack_item *prev;
-     void *contents;
-     int len;
+push_stack_item (struct stack_item *prev, void *contents, int len)
 {
   struct stack_item *si;
   si = xmalloc (sizeof (struct stack_item));
@@ -1043,24 +982,19 @@
 
 static struct stack_item *pop_stack_item (struct stack_item *si);
 static struct stack_item *
-pop_stack_item (si)
-     struct stack_item *si;
+pop_stack_item (struct stack_item *si)
 {
   struct stack_item *dead = si;
   si = si->prev;
-  free (dead->data);
-  free (dead);
+  xfree (dead->data);
+  xfree (dead);
   return si;
 }
 
 
 CORE_ADDR
-d10v_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     int struct_return;
-     CORE_ADDR struct_addr;
+d10v_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+		     int struct_return, CORE_ADDR struct_addr)
 {
   int i;
   int regnum = ARG1_REGNUM;
@@ -1156,10 +1090,8 @@
    extract and copy its value into `valbuf'.  */
 
 void
-d10v_extract_return_value (type, regbuf, valbuf)
-     struct type *type;
-     char regbuf[REGISTER_BYTES];
-     char *valbuf;
+d10v_extract_return_value (struct type *type, char regbuf[REGISTER_BYTES],
+			   char *valbuf)
 {
   int len;
   /*    printf("RET: TYPE=%d len=%d r%d=0x%x\n",type->code, TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM, (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM)));  */
@@ -1285,9 +1217,7 @@
 trace_data;
 
 static void
-trace_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_command (char *args, int from_tty)
 {
   /* Clear the host-side trace buffer, allocating space if needed.  */
   trace_data.size = 0;
@@ -1302,9 +1232,7 @@
 }
 
 static void
-untrace_command (args, from_tty)
-     char *args;
-     int from_tty;
+untrace_command (char *args, int from_tty)
 {
   tracing = 0;
 
@@ -1312,9 +1240,7 @@
 }
 
 static void
-trace_info (args, from_tty)
-     char *args;
-     int from_tty;
+trace_info (char *args, int from_tty)
 {
   int i;
 
@@ -1341,9 +1267,7 @@
    on STREAM.  Returns length of the instruction, in bytes.  */
 
 static int
-print_insn (memaddr, stream)
-     CORE_ADDR memaddr;
-     struct ui_file *stream;
+print_insn (CORE_ADDR memaddr, struct ui_file *stream)
 {
   /* If there's no disassembler, something is very wrong.  */
   if (tm_print_insn == NULL)
@@ -1357,7 +1281,7 @@
 }
 
 static void
-d10v_eva_prepare_to_trace ()
+d10v_eva_prepare_to_trace (void)
 {
   if (!tracing)
     return;
@@ -1369,7 +1293,7 @@
    more useful for display.  */
 
 static void
-d10v_eva_get_trace_data ()
+d10v_eva_get_trace_data (void)
 {
   int count, i, j, oldsize;
   int trace_addr, trace_seg, trace_cnt, next_cnt;
@@ -1422,16 +1346,14 @@
   oldsize = trace_data.size;
   trace_data.size += count;
 
-  free (tmpspace);
+  xfree (tmpspace);
 
   if (trace_display)
     display_trace (oldsize, trace_data.size);
 }
 
 static void
-tdisassemble_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+tdisassemble_command (char *arg, int from_tty)
 {
   int i, count;
   CORE_ADDR low, high;
@@ -1466,8 +1388,7 @@
 }
 
 static void
-display_trace (low, high)
-     int low, high;
+display_trace (int low, int high)
 {
   int i, count, trace_show_source, first, suppress;
   CORE_ADDR next_address;
@@ -1527,9 +1448,7 @@
 static gdbarch_init_ftype d10v_gdbarch_init;
 
 static struct gdbarch *
-d10v_gdbarch_init (info, arches)
-     struct gdbarch_info info;
-     struct gdbarch_list *arches;
+d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
   static LONGEST d10v_call_dummy_words[] =
   {0};
@@ -1537,6 +1456,7 @@
   int d10v_num_regs;
   struct gdbarch_tdep *tdep;
   gdbarch_register_name_ftype *d10v_register_name;
+  gdbarch_register_sim_regno_ftype *d10v_register_sim_regno;
 
   /* Find a candidate among the list of pre-declared architectures. */
   arches = gdbarch_list_lookup_by_info (arches, &info);
@@ -1553,9 +1473,9 @@
     case bfd_mach_d10v_ts2:
       d10v_num_regs = 37;
       d10v_register_name = d10v_ts2_register_name;
+      d10v_register_sim_regno = d10v_ts2_register_sim_regno;
       tdep->a0_regnum = TS2_A0_REGNUM;
       tdep->nr_dmap_regs = TS2_NR_DMAP_REGS;
-      tdep->register_sim_regno = d10v_ts2_register_sim_regno;
       tdep->dmap_register = d10v_ts2_dmap_register;
       tdep->imap_register = d10v_ts2_imap_register;
       break;
@@ -1563,9 +1483,9 @@
     case bfd_mach_d10v_ts3:
       d10v_num_regs = 42;
       d10v_register_name = d10v_ts3_register_name;
+      d10v_register_sim_regno = d10v_ts3_register_sim_regno;
       tdep->a0_regnum = TS3_A0_REGNUM;
       tdep->nr_dmap_regs = TS3_NR_DMAP_REGS;
-      tdep->register_sim_regno = d10v_ts3_register_sim_regno;
       tdep->dmap_register = d10v_ts3_dmap_register;
       tdep->imap_register = d10v_ts3_imap_register;
       break;
@@ -1678,6 +1598,9 @@
   set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
   set_gdbarch_stack_align (gdbarch, d10v_stack_align);
 
+  set_gdbarch_register_sim_regno (gdbarch, d10v_register_sim_regno);
+  set_gdbarch_extra_stack_alignment_needed (gdbarch, 0);
+
   return gdbarch;
 }
 
@@ -1686,7 +1609,7 @@
 extern void (*target_wait_loop_hook) (void);
 
 void
-_initialize_d10v_tdep ()
+_initialize_d10v_tdep (void)
 {
   register_gdbarch_init (bfd_arch_d10v, d10v_gdbarch_init);
 
diff --git a/gdb/d30v-tdep.c b/gdb/d30v-tdep.c
index cea0350..b85d0b7 100644
--- a/gdb/d30v-tdep.c
+++ b/gdb/d30v-tdep.c
@@ -97,9 +97,7 @@
 
 
 int
-d30v_frame_chain_valid (chain, fi)
-     CORE_ADDR chain;
-     struct frame_info *fi;	/* not used here */
+d30v_frame_chain_valid (CORE_ADDR chain, struct frame_info *fi)
 {
 #if 0
   return ((chain) != 0 && (fi) != 0 && (fi)->return_pc != 0);
@@ -112,7 +110,7 @@
    registers.  */
 
 void
-d30v_pop_frame ()
+d30v_pop_frame (void)
 {
   struct frame_info *frame = get_current_frame ();
   CORE_ADDR fp;
@@ -159,8 +157,7 @@
 }
 
 static int
-check_prologue (op)
-     unsigned long op;
+check_prologue (unsigned long op)
 {
   /* add sp,sp,imm -- observed */
   if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_SP_IMM)
@@ -234,8 +231,7 @@
 }
 
 CORE_ADDR
-d30v_skip_prologue (pc)
-     CORE_ADDR pc;
+d30v_skip_prologue (CORE_ADDR pc)
 {
   unsigned long op[2];
   unsigned long opl, opr;	/* left / right sub operations */
@@ -320,8 +316,7 @@
  */
 
 CORE_ADDR
-d30v_frame_chain (frame)
-     struct frame_info *frame;
+d30v_frame_chain (struct frame_info *frame)
 {
   struct frame_saved_regs fsr;
 
@@ -351,10 +346,8 @@
 static int frame_size;
 
 static int
-prologue_find_regs (op, fsr, addr)
-     unsigned long op;
-     struct frame_saved_regs *fsr;
-     CORE_ADDR addr;
+prologue_find_regs (unsigned long op, struct frame_saved_regs *fsr,
+		    CORE_ADDR addr)
 {
   int n;
   int offset;
@@ -503,9 +496,7 @@
    ways in the stack frame.  sp is even more special: the address we
    return for it IS the sp for the next frame. */
 void
-d30v_frame_find_saved_regs (fi, fsr)
-     struct frame_info *fi;
-     struct frame_saved_regs *fsr;
+d30v_frame_find_saved_regs (struct frame_info *fi, struct frame_saved_regs *fsr)
 {
   CORE_ADDR fp, pc;
   unsigned long opl, opr;
@@ -556,9 +547,8 @@
 }
 
 void
-d30v_frame_find_saved_regs_offsets (fi, fsr)
-     struct frame_info *fi;
-     struct frame_saved_regs *fsr;
+d30v_frame_find_saved_regs_offsets (struct frame_info *fi,
+				    struct frame_saved_regs *fsr)
 {
   CORE_ADDR fp, pc;
   unsigned long opl, opr;
@@ -677,9 +667,7 @@
 }
 
 void
-d30v_init_extra_frame_info (fromleaf, fi)
-     int fromleaf;
-     struct frame_info *fi;
+d30v_init_extra_frame_info (int fromleaf, struct frame_info *fi)
 {
   struct frame_saved_regs dummy;
 
@@ -709,9 +697,7 @@
 }
 
 void
-d30v_init_frame_pc (fromleaf, prev)
-     int fromleaf;
-     struct frame_info *prev;
+d30v_init_frame_pc (int fromleaf, struct frame_info *prev)
 {
   /* default value, put here so we can breakpoint on it and
      see if the default value is really the right thing to use */
@@ -722,9 +708,7 @@
 static void d30v_print_register (int regnum, int tabular);
 
 static void
-d30v_print_register (regnum, tabular)
-     int regnum;
-     int tabular;
+d30v_print_register (int regnum, int tabular)
 {
   if (regnum < A0_REGNUM)
     {
@@ -754,7 +738,7 @@
 }
 
 static void
-d30v_print_flags ()
+d30v_print_flags (void)
 {
   long psw = read_register (PSW_REGNUM);
   printf_filtered ("flags #1");
@@ -778,17 +762,13 @@
 }
 
 static void
-print_flags_command (args, from_tty)
-     char *args;
-     int from_tty;
+print_flags_command (char *args, int from_tty)
 {
   d30v_print_flags ();
 }
 
 void
-d30v_do_registers_info (regnum, fpregs)
-     int regnum;
-     int fpregs;
+d30v_do_registers_info (int regnum, int fpregs)
 {
   long long num1, num2;
   long psw;
@@ -886,14 +866,8 @@
 }
 
 CORE_ADDR
-d30v_fix_call_dummy (dummyname, start_sp, fun, nargs, args, type, gcc_p)
-     char *dummyname;
-     CORE_ADDR start_sp;
-     CORE_ADDR fun;
-     int nargs;
-     value_ptr *args;
-     struct type *type;
-     int gcc_p;
+d30v_fix_call_dummy (char *dummyname, CORE_ADDR start_sp, CORE_ADDR fun,
+		     int nargs, value_ptr *args, struct type *type, int gcc_p)
 {
   int regnum;
   CORE_ADDR sp;
@@ -916,8 +890,7 @@
 }
 
 static void
-d30v_pop_dummy_frame (fi)
-     struct frame_info *fi;
+d30v_pop_dummy_frame (struct frame_info *fi)
 {
   CORE_ADDR sp = fi->dummy;
   int regnum;
@@ -932,12 +905,8 @@
 
 
 CORE_ADDR
-d30v_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     int struct_return;
-     CORE_ADDR struct_addr;
+d30v_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+		     int struct_return, CORE_ADDR struct_addr)
 {
   int i, len, index = 0, regnum = 2;
   char buffer[4], *contents;
@@ -1035,7 +1004,7 @@
 /* restored. */
 
 CORE_ADDR
-d30v_call_dummy_address ()
+d30v_call_dummy_address (void)
 {
   CORE_ADDR entry;
   struct minimal_symbol *sym;
@@ -1057,10 +1026,8 @@
    extract and copy its value into `valbuf'.  */
 
 void
-d30v_extract_return_value (valtype, regbuf, valbuf)
-     struct type *valtype;
-     char regbuf[REGISTER_BYTES];
-     char *valbuf;
+d30v_extract_return_value (struct type *valtype, char regbuf[REGISTER_BYTES],
+			   char *valbuf)
 {
   memcpy (valbuf, regbuf + REGISTER_BYTE (2), TYPE_LENGTH (valtype));
 }
@@ -1126,9 +1093,7 @@
 trace_data;
 
 static void
-trace_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_command (char *args, int from_tty)
 {
   /* Clear the host-side trace buffer, allocating space if needed.  */
   trace_data.size = 0;
@@ -1143,9 +1108,7 @@
 }
 
 static void
-untrace_command (args, from_tty)
-     char *args;
-     int from_tty;
+untrace_command (char *args, int from_tty)
 {
   tracing = 0;
 
@@ -1153,9 +1116,7 @@
 }
 
 static void
-trace_info (args, from_tty)
-     char *args;
-     int from_tty;
+trace_info (char *args, int from_tty)
 {
   int i;
 
@@ -1181,9 +1142,7 @@
    on STREAM.  Returns length of the instruction, in bytes.  */
 
 static int
-print_insn (memaddr, stream)
-     CORE_ADDR memaddr;
-     struct ui_file *stream;
+print_insn (CORE_ADDR memaddr, struct ui_file *stream)
 {
   /* If there's no disassembler, something is very wrong.  */
   if (tm_print_insn == NULL)
@@ -1197,7 +1156,7 @@
 }
 
 void
-d30v_eva_prepare_to_trace ()
+d30v_eva_prepare_to_trace (void)
 {
   if (!tracing)
     return;
@@ -1209,7 +1168,7 @@
    more useful for display.  */
 
 void
-d30v_eva_get_trace_data ()
+d30v_eva_get_trace_data (void)
 {
   int count, i, j, oldsize;
   int trace_addr, trace_seg, trace_cnt, next_cnt;
@@ -1262,16 +1221,14 @@
   oldsize = trace_data.size;
   trace_data.size += count;
 
-  free (tmpspace);
+  xfree (tmpspace);
 
   if (trace_display)
     display_trace (oldsize, trace_data.size);
 }
 
 static void
-tdisassemble_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+tdisassemble_command (char *arg, int from_tty)
 {
   int i, count;
   CORE_ADDR low, high;
@@ -1308,8 +1265,7 @@
 }
 
 static void
-display_trace (low, high)
-     int low, high;
+display_trace (int low, int high)
 {
   int i, count, trace_show_source, first, suppress;
   CORE_ADDR next_address;
@@ -1369,7 +1325,7 @@
 extern void (*target_wait_loop_hook) (void);
 
 void
-_initialize_d30v_tdep ()
+_initialize_d30v_tdep (void)
 {
   tm_print_insn = print_insn_d30v;
 
diff --git a/gdb/dbug-rom.c b/gdb/dbug-rom.c
index 4d95012..dff1a3b 100644
--- a/gdb/dbug-rom.c
+++ b/gdb/dbug-rom.c
@@ -34,11 +34,7 @@
 static void dbug_open (char *args, int from_tty);
 
 static void
-dbug_supply_register (regname, regnamelen, val, vallen)
-     char *regname;
-     int regnamelen;
-     char *val;
-     int vallen;
+dbug_supply_register (char *regname, int regnamelen, char *val, int vallen)
 {
   int regno;
 
@@ -143,15 +139,13 @@
 }				/* init_debug_ops */
 
 static void
-dbug_open (args, from_tty)
-     char *args;
-     int from_tty;
+dbug_open (char *args, int from_tty)
 {
   monitor_open (args, &dbug_cmds, from_tty);
 }
 
 void
-_initialize_dbug_rom ()
+_initialize_dbug_rom (void)
 {
   init_dbug_cmds ();
   init_monitor_ops (&dbug_ops);
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 10e1535..071be76 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -319,11 +319,11 @@
 /* Free up old header file tables */
 
 static void
-free_header_files ()
+free_header_files (void)
 {
   if (this_object_header_files)
     {
-      free ((PTR) this_object_header_files);
+      xfree (this_object_header_files);
       this_object_header_files = NULL;
     }
   n_allocated_this_object_header_files = 0;
@@ -332,7 +332,7 @@
 /* Allocate new header file tables */
 
 static void
-init_header_files ()
+init_header_files (void)
 {
   n_allocated_this_object_header_files = 10;
   this_object_header_files = (int *) xmalloc (10 * sizeof (int));
@@ -342,8 +342,7 @@
    at the next successive FILENUM.  */
 
 static void
-add_this_object_header_file (i)
-     int i;
+add_this_object_header_file (int i)
 {
   if (n_this_object_header_files == n_allocated_this_object_header_files)
     {
@@ -362,9 +361,7 @@
    symbol tables for the same header file.  */
 
 static void
-add_old_header_file (name, instance)
-     char *name;
-     int instance;
+add_old_header_file (char *name, int instance)
 {
   register struct header_file *p = HEADER_FILES (current_objfile);
   register int i;
@@ -390,9 +387,7 @@
    so we record the file when its "begin" is seen and ignore the "end".  */
 
 static void
-add_new_header_file (name, instance)
-     char *name;
-     int instance;
+add_new_header_file (char *name, int instance)
 {
   register int i;
   register struct header_file *hfile;
@@ -435,8 +430,7 @@
 
 #if 0
 static struct type **
-explicit_lookup_type (real_filenum, index)
-     int real_filenum, index;
+explicit_lookup_type (int real_filenum, int index)
 {
   register struct header_file *f = &HEADER_FILES (current_objfile)[real_filenum];
 
@@ -453,11 +447,8 @@
 #endif
 
 static void
-record_minimal_symbol (name, address, type, objfile)
-     char *name;
-     CORE_ADDR address;
-     int type;
-     struct objfile *objfile;
+record_minimal_symbol (char *name, CORE_ADDR address, int type,
+		       struct objfile *objfile)
 {
   enum minimal_symbol_type ms_type;
   int section;
@@ -558,9 +549,7 @@
    table (as opposed to a shared lib or dynamically loaded file).  */
 
 static void
-dbx_symfile_read (objfile, mainline)
-     struct objfile *objfile;
-     int mainline;		/* FIXME comments above */
+dbx_symfile_read (struct objfile *objfile, int mainline)
 {
   bfd *sym_bfd;
   int val;
@@ -626,8 +615,7 @@
    file, e.g. a shared library).  */
 
 static void
-dbx_new_init (ignore)
-     struct objfile *ignore;
+dbx_new_init (struct objfile *ignore)
 {
   stabsread_new_init ();
   buildsym_new_init ();
@@ -651,8 +639,7 @@
 #define DBX_STRINGTAB_SIZE_SIZE sizeof(long)	/* FIXME */
 
 static void
-dbx_symfile_init (objfile)
-     struct objfile *objfile;
+dbx_symfile_init (struct objfile *objfile)
 {
   int val;
   bfd *sym_bfd = objfile->obfd;
@@ -769,8 +756,7 @@
    objfile struct from the global list of known objfiles. */
 
 static void
-dbx_symfile_finish (objfile)
-     struct objfile *objfile;
+dbx_symfile_finish (struct objfile *objfile)
 {
   if (objfile->sym_stab_info != NULL)
     {
@@ -781,10 +767,10 @@
 
 	  while (--i >= 0)
 	    {
-	      free (hfiles[i].name);
-	      free (hfiles[i].vector);
+	      xfree (hfiles[i].name);
+	      xfree (hfiles[i].vector);
 	    }
-	  free ((PTR) hfiles);
+	  xfree (hfiles);
 	}
       mfree (objfile->md, objfile->sym_stab_info);
     }
@@ -802,15 +788,15 @@
    completed after all the stabs are read.  */
 struct cont_elem
   {
-    /* sym and stabsstring for continuing information in cfront */
+    /* sym and stabstring for continuing information in cfront */
     struct symbol *sym;
     char *stabs;
-    /* state dependancies (statics that must be preserved) */
+    /* state dependencies (statics that must be preserved) */
     int sym_idx;
     int sym_end;
     int symnum;
     int (*func) (struct objfile *, struct symbol *, char *);
-    /* other state dependancies include:
+    /* other state dependencies include:
        (assumption is that these will not change since process_now FIXME!!)
        stringtab_global
        n_stabs
@@ -825,10 +811,8 @@
 /* Arrange for function F to be called with arguments SYM and P later
    in the stabs reading process.  */
 void
-process_later (sym, p, f)
-     struct symbol *sym;
-     char *p;
-     int (*f) (struct objfile *, struct symbol *, char *);
+process_later (struct symbol *sym, char *p,
+	       int (*f) (struct objfile *, struct symbol *, char *))
 {
 
   /* Allocate more space for the deferred list.  */
@@ -857,8 +841,7 @@
 /* Call deferred funtions in CONT_LIST.  */
 
 static void
-process_now (objfile)
-     struct objfile *objfile;
+process_now (struct objfile *objfile)
 {
   int i;
   int save_symbuf_idx;
@@ -927,8 +910,7 @@
    (into the string table) but this does no harm.  */
 
 static void
-fill_symbuf (sym_bfd)
-     bfd *sym_bfd;
+fill_symbuf (bfd *sym_bfd)
 {
   unsigned int count;
   int nbytes;
@@ -991,8 +973,7 @@
    call this function to get the continuation.  */
 
 static char *
-dbx_next_symbol_text (objfile)
-     struct objfile *objfile;
+dbx_next_symbol_text (struct objfile *objfile)
 {
   struct internal_nlist nlist;
 
@@ -1012,9 +993,7 @@
    allocated.  */
 
 static void
-init_bincl_list (number, objfile)
-     int number;
-     struct objfile *objfile;
+init_bincl_list (int number, struct objfile *objfile)
 {
   bincls_allocated = number;
   next_bincl = bincl_list = (struct header_file_location *)
@@ -1024,10 +1003,7 @@
 /* Add a bincl to the list.  */
 
 static void
-add_bincl_to_list (pst, name, instance)
-     struct partial_symtab *pst;
-     char *name;
-     int instance;
+add_bincl_to_list (struct partial_symtab *pst, char *name, int instance)
 {
   if (next_bincl >= bincl_list + bincls_allocated)
     {
@@ -1048,9 +1024,7 @@
    with that header_file_location.  */
 
 static struct partial_symtab *
-find_corresponding_bincl_psymtab (name, instance)
-     char *name;
-     int instance;
+find_corresponding_bincl_psymtab (char *name, int instance)
 {
   struct header_file_location *bincl;
 
@@ -1066,8 +1040,7 @@
 /* Free the storage allocated for the bincl list.  */
 
 static void
-free_bincl_list (objfile)
-     struct objfile *objfile;
+free_bincl_list (struct objfile *objfile)
 {
   mfree (objfile->md, (PTR) bincl_list);
   bincls_allocated = 0;
@@ -1089,8 +1062,7 @@
    add them to the minimal symbol table.  */
 
 static void
-read_dbx_dynamic_symtab (objfile)
-     struct objfile *objfile;
+read_dbx_dynamic_symtab (struct objfile *objfile)
 {
   bfd *abfd = objfile->obfd;
   struct cleanup *back_to;
@@ -1121,7 +1093,7 @@
     return;
 
   dynsyms = (asymbol **) xmalloc (dynsym_size);
-  back_to = make_cleanup (free, dynsyms);
+  back_to = make_cleanup (xfree, dynsyms);
 
   dynsym_count = bfd_canonicalize_dynamic_symtab (abfd, dynsyms);
   if (dynsym_count < 0)
@@ -1184,7 +1156,7 @@
     }
 
   dynrels = (arelent **) xmalloc (dynrel_size);
-  make_cleanup (free, dynrels);
+  make_cleanup (xfree, dynrels);
 
   dynrel_count = bfd_canonicalize_dynamic_reloc (abfd, dynrels, dynsyms);
   if (dynrel_count < 0)
@@ -1232,8 +1204,7 @@
    debugging information is available. */
 
 static void
-read_dbx_symtab (objfile)
-     struct objfile *objfile;
+read_dbx_symtab (struct objfile *objfile)
 {
   register struct external_nlist *bufp = 0;	/* =0 avoids gcc -Wall glitch */
   struct internal_nlist nlist;
@@ -1395,13 +1366,9 @@
 
 
 static struct partial_symtab *
-start_psymtab (objfile, filename, textlow, ldsymoff, global_syms, static_syms)
-     struct objfile *objfile;
-     char *filename;
-     CORE_ADDR textlow;
-     int ldsymoff;
-     struct partial_symbol **global_syms;
-     struct partial_symbol **static_syms;
+start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow,
+	       int ldsymoff, struct partial_symbol **global_syms,
+	       struct partial_symbol **static_syms)
 {
   struct partial_symtab *result =
   start_psymtab_common (objfile, objfile->section_offsets,
@@ -1434,16 +1401,10 @@
    FIXME:  List variables and peculiarities of same.  */
 
 struct partial_symtab *
-end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
-	capping_text, dependency_list, number_dependencies, textlow_not_set)
-     struct partial_symtab *pst;
-     char **include_list;
-     int num_includes;
-     int capping_symbol_offset;
-     CORE_ADDR capping_text;
-     struct partial_symtab **dependency_list;
-     int number_dependencies;
-     int textlow_not_set;
+end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes,
+	     int capping_symbol_offset, CORE_ADDR capping_text,
+	     struct partial_symtab **dependency_list, int number_dependencies,
+	     int textlow_not_set)
 {
   int i;
   struct objfile *objfile = pst->objfile;
@@ -1607,8 +1568,7 @@
 }
 
 static void
-dbx_psymtab_to_symtab_1 (pst)
-     struct partial_symtab *pst;
+dbx_psymtab_to_symtab_1 (struct partial_symtab *pst)
 {
   struct cleanup *old_chain;
   int i;
@@ -1665,8 +1625,7 @@
    Be verbose about it if the user wants that.  */
 
 static void
-dbx_psymtab_to_symtab (pst)
-     struct partial_symtab *pst;
+dbx_psymtab_to_symtab (struct partial_symtab *pst)
 {
   bfd *sym_bfd;
 
@@ -1709,8 +1668,7 @@
 /* Read in a defined section of a specific object file's symbols. */
 
 static void
-read_ofile_symtab (pst)
-     struct partial_symtab *pst;
+read_ofile_symtab (struct partial_symtab *pst)
 {
   register char *namestring;
   register struct external_nlist *bufp;
@@ -1878,7 +1836,7 @@
 
   pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile));
 
-  /* Process items which we had to "process_later" due to dependancies 
+  /* Process items which we had to "process_later" due to dependencies 
      on other stabs.  */
   process_now (objfile);
 
@@ -1903,12 +1861,9 @@
    It is used in end_symtab.  */
 
 void
-process_one_symbol (type, desc, valu, name, section_offsets, objfile)
-     int type, desc;
-     CORE_ADDR valu;
-     char *name;
-     struct section_offsets *section_offsets;
-     struct objfile *objfile;
+process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
+		    struct section_offsets *section_offsets,
+		    struct objfile *objfile)
 {
 #ifdef SUN_FIXED_LBRAC_BUG
   /* If SUN_FIXED_LBRAC_BUG is defined, then it tells us whether we need
@@ -2491,16 +2446,10 @@
    adjusted for coff details. */
 
 void
-coffstab_build_psymtabs (objfile, mainline,
-			 textaddr, textsize, stabsects,
-			 stabstroffset, stabstrsize)
-     struct objfile *objfile;
-     int mainline;
-     CORE_ADDR textaddr;
-     unsigned int textsize;
-     struct stab_section_list *stabsects;
-     file_ptr stabstroffset;
-     unsigned int stabstrsize;
+coffstab_build_psymtabs (struct objfile *objfile, int mainline,
+			 CORE_ADDR textaddr, unsigned int textsize,
+			 struct stab_section_list *stabsects,
+			 file_ptr stabstroffset, unsigned int stabstrsize)
 {
   int val;
   bfd *sym_bfd = objfile->obfd;
@@ -2592,15 +2541,9 @@
    adjusted for elf details. */
 
 void
-elfstab_build_psymtabs (objfile, mainline,
-			staboffset, stabsize,
-			stabstroffset, stabstrsize)
-     struct objfile *objfile;
-     int mainline;
-     file_ptr staboffset;
-     unsigned int stabsize;
-     file_ptr stabstroffset;
-     unsigned int stabstrsize;
+elfstab_build_psymtabs (struct objfile *objfile, int mainline,
+			file_ptr staboffset, unsigned int stabsize,
+			file_ptr stabstroffset, unsigned int stabstrsize)
 {
   int val;
   bfd *sym_bfd = objfile->obfd;
@@ -2668,13 +2611,8 @@
    This routine is mostly copied from dbx_symfile_init and dbx_symfile_read. */
 
 void
-stabsect_build_psymtabs (objfile, mainline, stab_name,
-			 stabstr_name, text_name)
-     struct objfile *objfile;
-     int mainline;
-     char *stab_name;
-     char *stabstr_name;
-     char *text_name;
+stabsect_build_psymtabs (struct objfile *objfile, int mainline, char *stab_name,
+			 char *stabstr_name, char *text_name)
 {
   int val;
   bfd *sym_bfd = objfile->obfd;
@@ -2750,7 +2688,7 @@
 };
 
 void
-_initialize_dbxread ()
+_initialize_dbxread (void)
 {
   add_symtab_fns (&aout_sym_fns);
 }
diff --git a/gdb/dcache.c b/gdb/dcache.c
index 538f77e..cdfe476 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -1,7 +1,5 @@
-/* Caching code.  Typically used by remote back ends for
-   caching remote memory.
-
-   Copyright 1992-1993, 1995, 1998-1999 Free Software Foundation, Inc.
+/* Caching code.
+   Copyright 1992-1993, 1995, 1998-1999, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -25,6 +23,7 @@
 #include "gdbcmd.h"
 #include "gdb_string.h"
 #include "gdbcore.h"
+#include "target.h"
 
 /* 
    The data cache could lead to incorrect results because it doesn't know
@@ -126,12 +125,6 @@
 
 struct dcache_struct
   {
-    /* Function to actually read the target memory. */
-    memxferfunc read_memory;
-
-    /* Function to actually write the target memory */
-    memxferfunc write_memory;
-
     /* free list */
     struct dcache_block *free_head;
     struct dcache_block *free_tail;
@@ -149,17 +142,19 @@
     int cache_has_stuff;
   };
 
-static int dcache_poke_byte (DCACHE * dcache, CORE_ADDR addr, char *ptr);
+static int dcache_poke_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr);
 
-static int dcache_peek_byte (DCACHE * dcache, CORE_ADDR addr, char *ptr);
+static int dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr);
 
-static struct dcache_block *dcache_hit (DCACHE * dcache, CORE_ADDR addr);
+static struct dcache_block *dcache_hit (DCACHE *dcache, CORE_ADDR addr);
 
-static int dcache_write_line (DCACHE * dcache, struct dcache_block *db);
+static int dcache_write_line (DCACHE *dcache, struct dcache_block *db);
 
-static struct dcache_block *dcache_alloc (DCACHE * dcache);
+static int dcache_read_line (DCACHE *dcache, struct dcache_block *db);
 
-static int dcache_writeback (DCACHE * dcache);
+static struct dcache_block *dcache_alloc (DCACHE *dcache, CORE_ADDR addr);
+
+static int dcache_writeback (DCACHE *dcache);
 
 static void dcache_info (char *exp, int tty);
 
@@ -173,8 +168,7 @@
 /* Free all the data cache blocks, thus discarding all cached data.  */
 
 void
-dcache_flush (dcache)
-     DCACHE *dcache;
+dcache_invalidate (DCACHE *dcache)
 {
   int i;
   dcache->valid_head = 0;
@@ -204,9 +198,7 @@
    containing it. */
 
 static struct dcache_block *
-dcache_hit (dcache, addr)
-     DCACHE *dcache;
-     CORE_ADDR addr;
+dcache_hit (DCACHE *dcache, CORE_ADDR addr)
 {
   register struct dcache_block *db;
 
@@ -230,13 +222,11 @@
    be written is. */
 
 static int
-dcache_write_line (dcache, db)
-     DCACHE *dcache;
-     register struct dcache_block *db;
+dcache_write_line (DCACHE *dcache, register struct dcache_block *db)
 {
   int s;
   int e;
-  s = 0;
+
   if (db->anydirty)
     {
       for (s = 0; s < LINE_SIZE; s++)
@@ -253,10 +243,10 @@
 		int done = 0;
 		while (done < len)
 		  {
-		    int t = dcache->write_memory (db->addr + s + done,
-						  db->data + s + done,
-						  len - done);
-		    if (t == 0)
+		    int t = do_xfer_memory (db->addr + s + done,
+					    db->data + s + done,
+					    len - done, 1);
+		    if (t <= 0)
 		      return 0;
 		    done += t;
 		  }
@@ -270,18 +260,49 @@
   return 1;
 }
 
+/* Read cache line */
+static int
+dcache_read_line (DCACHE *dcache, struct dcache_block *db)
+{
+  CORE_ADDR memaddr;
+  char *myaddr;
+  int len;
+  int res;
+
+  /* If there are any dirty bytes in the line, it must be written
+     before a new line can be read */
+  if (db->anydirty)
+    {
+      if (!dcache_write_line (dcache, db))
+	return 0;
+    }
+  
+  len = LINE_SIZE;
+  memaddr = db->addr;
+  myaddr  = db->data;
+
+  while (len > 0)
+    {
+      res = do_xfer_memory (memaddr, myaddr, len, 0);
+      if (res <= 0)
+	return 0;
+
+      memaddr += res;
+      myaddr  += res;
+      len     -= res;
+    }
+
+  memset (db->state, ENTRY_OK, sizeof (db->data));
+  db->anydirty = 0;
+  
+  return 1;
+}
 
 /* Get a free cache block, put or keep it on the valid list,
-   and return its address.  The caller should store into the block
-   the address and data that it describes, then remque it from the
-   free list and insert it into the valid list.  This procedure
-   prevents errors from creeping in if a memory retrieval is
-   interrupted (which used to put garbage blocks in the valid
-   list...).  */
+   and return its address.  */
 
 static struct dcache_block *
-dcache_alloc (dcache)
-     DCACHE *dcache;
+dcache_alloc (DCACHE *dcache, CORE_ADDR addr)
 {
   register struct dcache_block *db;
 
@@ -298,11 +319,18 @@
     {
       /* Nothing left on free list, so grab one from the valid list */
       db = dcache->valid_head;
-      dcache->valid_head = db->p;
 
-      dcache_write_line (dcache, db);
+      if (!dcache_write_line (dcache, db))
+	return NULL;
+      
+      dcache->valid_head = db->p;
     }
 
+  db->addr = MASK(addr);
+  db->refs = 0;
+  db->anydirty = 0;
+  memset (db->state, ENTRY_BAD, sizeof (db->data));
+
   /* append this line to end of valid list */
   if (!dcache->valid_head)
     dcache->valid_head = db;
@@ -314,55 +342,9 @@
   return db;
 }
 
-/* Using the data cache DCACHE return the contents of the byte at
-   address ADDR in the remote machine.  
-
-   Returns 0 on error. */
-
-static int
-dcache_peek_byte (dcache, addr, ptr)
-     DCACHE *dcache;
-     CORE_ADDR addr;
-     char *ptr;
-{
-  register struct dcache_block *db = dcache_hit (dcache, addr);
-  int ok = 1;
-  int done = 0;
-  if (db == 0
-      || db->state[XFORM (addr)] == ENTRY_BAD)
-    {
-      if (db)
-	{
-	  dcache_write_line (dcache, db);
-	}
-      else
-	db = dcache_alloc (dcache);
-      immediate_quit++;
-      db->addr = MASK (addr);
-      while (done < LINE_SIZE)
-	{
-	  int try =
-	  (*dcache->read_memory)
-	  (db->addr + done,
-	   db->data + done,
-	   LINE_SIZE - done);
-	  if (try == 0)
-	    return 0;
-	  done += try;
-	}
-      immediate_quit--;
-
-      memset (db->state, ENTRY_OK, sizeof (db->data));
-      db->anydirty = 0;
-    }
-  *ptr = db->data[XFORM (addr)];
-  return ok;
-}
-
 /* Writeback any dirty lines to the remote. */
 static int
-dcache_writeback (dcache)
-     DCACHE *dcache;
+dcache_writeback (DCACHE *dcache)
 {
   struct dcache_block *db;
 
@@ -378,19 +360,31 @@
 }
 
 
-/* Using the data cache DCACHE return the contents of the word at
-   address ADDR in the remote machine.  */
-int
-dcache_fetch (dcache, addr)
-     DCACHE *dcache;
-     CORE_ADDR addr;
+/* Using the data cache DCACHE return the contents of the byte at
+   address ADDR in the remote machine.  
+
+   Returns 0 on error. */
+
+static int
+dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr)
 {
-  int res;
+  register struct dcache_block *db = dcache_hit (dcache, addr);
 
-  if (dcache_xfer_memory (dcache, addr, (char *) &res, sizeof res, 0) != sizeof res)
-    memory_error (EIO, addr);
+  if (!db)
+    {
+      db = dcache_alloc (dcache, addr);
+      if (!db)
+	return 0;
+    }
+  
+  if (db->state[XFORM (addr)] == ENTRY_BAD)
+    {
+      if (!dcache_read_line(dcache, db))
+         return 0;
+    }
 
-  return res;
+  *ptr = db->data[XFORM (addr)];
+  return 1;
 }
 
 
@@ -399,18 +393,15 @@
  */
 
 static int
-dcache_poke_byte (dcache, addr, ptr)
-     DCACHE *dcache;
-     CORE_ADDR addr;
-     char *ptr;
+dcache_poke_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr)
 {
   register struct dcache_block *db = dcache_hit (dcache, addr);
 
   if (!db)
     {
-      db = dcache_alloc (dcache);
-      db->addr = MASK (addr);
-      memset (db->state, ENTRY_BAD, sizeof (db->data));
+      db = dcache_alloc (dcache, addr);
+      if (!db)
+	return 0;
     }
 
   db->data[XFORM (addr)] = *ptr;
@@ -419,45 +410,35 @@
   return 1;
 }
 
-/* Write the word at ADDR both in the data cache and in the remote machine.  
-   Return zero on write error.
- */
-
-int
-dcache_poke (dcache, addr, data)
-     DCACHE *dcache;
-     CORE_ADDR addr;
-     int data;
-{
-  if (dcache_xfer_memory (dcache, addr, (char *) &data, sizeof data, 1) != sizeof data)
-    return 0;
-
-  return dcache_writeback (dcache);
-}
-
-
 /* Initialize the data cache.  */
 DCACHE *
-dcache_init (reading, writing)
-     memxferfunc reading;
-     memxferfunc writing;
+dcache_init (void)
 {
   int csize = sizeof (struct dcache_block) * DCACHE_SIZE;
   DCACHE *dcache;
 
   dcache = (DCACHE *) xmalloc (sizeof (*dcache));
-  dcache->read_memory = reading;
-  dcache->write_memory = writing;
 
   dcache->the_cache = (struct dcache_block *) xmalloc (csize);
   memset (dcache->the_cache, 0, csize);
 
-  dcache_flush (dcache);
+  dcache_invalidate (dcache);
 
   last_cache = dcache;
   return dcache;
 }
 
+/* Free a data cache */
+void
+dcache_free (DCACHE *dcache)
+{
+  if (last_cache == dcache)
+    last_cache = NULL;
+
+  xfree (dcache->the_cache);
+  xfree (dcache);
+}
+
 /* Read or write LEN bytes from inferior memory at MEMADDR, transferring
    to or from debugger address MYADDR.  Write to inferior if SHOULD_WRITE is
    nonzero. 
@@ -467,18 +448,14 @@
    This routine is indended to be called by remote_xfer_ functions. */
 
 int
-dcache_xfer_memory (dcache, memaddr, myaddr, len, should_write)
-     DCACHE *dcache;
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int should_write;
+dcache_xfer_memory (DCACHE *dcache, CORE_ADDR memaddr, char *myaddr, int len,
+		    int should_write)
 {
   int i;
 
   if (dcache_enabled_p)
     {
-      int (*xfunc) (DCACHE * dcache, CORE_ADDR addr, char *ptr);
+      int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, char *ptr);
       xfunc = should_write ? dcache_poke_byte : dcache_peek_byte;
 
       for (i = 0; i < len; i++)
@@ -486,26 +463,24 @@
 	  if (!xfunc (dcache, memaddr + i, myaddr + i))
 	    return 0;
 	}
+
+      if (should_write)
+	dcache_writeback (dcache);
+
       dcache->cache_has_stuff = 1;
-      dcache_writeback (dcache);
     }
   else
     {
-      memxferfunc xfunc;
-      xfunc = should_write ? dcache->write_memory : dcache->read_memory;
-
       if (dcache->cache_has_stuff)
-	dcache_flush (dcache);
+	dcache_invalidate (dcache);
 
-      len = xfunc (memaddr, myaddr, len);
+      len = do_xfer_memory(memaddr, myaddr, len, should_write);
     }
   return len;
 }
 
 static void
-dcache_info (exp, tty)
-     char *exp;
-     int tty;
+dcache_info (char *exp, int tty)
 {
   struct dcache_block *p;
 
@@ -517,21 +492,24 @@
   printf_filtered ("Dcache enabled, line width %d, depth %d\n",
 		   LINE_SIZE, DCACHE_SIZE);
 
-  printf_filtered ("Cache state:\n");
-
-  for (p = last_cache->valid_head; p; p = p->p)
+  if (last_cache)
     {
-      int j;
-      printf_filtered ("Line at %s, referenced %d times\n",
-		       paddr (p->addr), p->refs);
+      printf_filtered ("Cache state:\n");
 
-      for (j = 0; j < LINE_SIZE; j++)
-	printf_filtered ("%02x", p->data[j] & 0xFF);
-      printf_filtered ("\n");
+      for (p = last_cache->valid_head; p; p = p->p)
+	{
+	  int j;
+	  printf_filtered ("Line at %s, referenced %d times\n",
+			   paddr (p->addr), p->refs);
 
-      for (j = 0; j < LINE_SIZE; j++)
-	printf_filtered (" %2x", p->state[j]);
-      printf_filtered ("\n");
+	  for (j = 0; j < LINE_SIZE; j++)
+	    printf_filtered ("%02x", p->data[j] & 0xFF);
+	  printf_filtered ("\n");
+
+	  for (j = 0; j < LINE_SIZE; j++)
+	    printf_filtered ("%2x", p->state[j]);
+	  printf_filtered ("\n");
+	}
     }
 }
 
@@ -543,7 +521,7 @@
 }
 
 void
-_initialize_dcache ()
+_initialize_dcache (void)
 {
   add_show_from_set
     (add_set_cmd ("remotecache", class_support, var_boolean,
diff --git a/gdb/dcache.h b/gdb/dcache.h
index d13708f..079b037 100644
--- a/gdb/dcache.h
+++ b/gdb/dcache.h
@@ -23,31 +23,22 @@
 #ifndef DCACHE_H
 #define DCACHE_H
 
-typedef int (*memxferfunc) (CORE_ADDR memaddr, char *myaddr, int len);
-
 typedef struct dcache_struct DCACHE;
 
-/* Using the data cache DCACHE return the contents of the word at
-   address ADDR in the remote machine.  */
-int dcache_fetch (DCACHE * dcache, CORE_ADDR addr);
-
-/* Flush DCACHE. */
-void dcache_flush (DCACHE * dcache);
+/* Invalidate DCACHE. */
+void dcache_invalidate (DCACHE *dcache);
 
 /* Initialize DCACHE. */
-DCACHE *dcache_init (memxferfunc reading, memxferfunc writing);
+DCACHE *dcache_init (void);
 
-/* Write the word at ADDR both in the data cache and in the remote machine.  */
-int dcache_poke (DCACHE * dcache, CORE_ADDR addr, int data);
+/* Free a DCACHE */
+void dcache_free (DCACHE *);
 
 /* Simple to call from <remote>_xfer_memory */
 
-int dcache_xfer_memory (DCACHE * cache, CORE_ADDR mem, char *my, int len,
+int dcache_xfer_memory (DCACHE *cache, CORE_ADDR mem, char *my, int len,
 			int should_write);
 
-/* Write the bytes at ADDR into the data cache and the remote machine. */
-int dcache_poke_block (DCACHE * cache, CORE_ADDR mem, char *my, int len);
-
 /* Turn dcache state on or off */
 void set_dcache_state (int);
 
diff --git a/gdb/defs.h b/gdb/defs.h
index 400f630..87e570f 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -65,6 +65,26 @@
 /* For BFD64 and bfd_vma.  */
 #include "bfd.h"
 
+
+/* The target is partially multi-arched.  Both "tm.h" and the
+   multi-arch vector provide definitions.  "tm.h" normally overrides
+   the multi-arch vector (but there are a few exceptions).  */
+
+#define GDB_MULTI_ARCH_PARTIAL 1
+
+/* The target is multi-arched.  The MULTI-ARCH vector provides all
+   definitions.  "tm.h" is included and may provide definitions of
+   non- multi-arch macros..  */
+
+#define GDB_MULTI_ARCH_TM 2
+
+/* The target is pure multi-arch.  The MULTI-ARCH vector provides all
+   definitions.  "tm.h" is linked to an empty file. */
+
+#define GDB_MULTI_ARCH_PURE 3
+
+
+
 /* An address in the program being debugged.  Host byte order.  Rather
    than duplicate all the logic in BFD which figures out what type
    this is (long, long long, etc.) and whether it needs to be 64
@@ -196,7 +216,8 @@
     language_fortran,		/* Fortran */
     language_m2,		/* Modula-2 */
     language_asm,		/* Assembly language */
-    language_scm		/* Scheme / Guile */
+    language_scm,    		/* Scheme / Guile */
+    language_pascal		/* Pascal */
   };
 
 enum precision_type
@@ -306,13 +327,6 @@
 extern void discard_exec_error_cleanups (struct cleanup *);
 extern void discard_my_cleanups (struct cleanup **, struct cleanup *);
 
-/* DEPRECATED: cagney/2000-03-04: Do not use this typedef to cast
-   function pointers so that they match the argument to the various
-   cleanup functions.  Post GDB 5.0, this typedef will be
-   deleted. [Editors note: cagney was the person that added most of
-   those type casts] */
-typedef void (*make_cleanup_func) (void *);
-
 /* NOTE: cagney/2000-03-04: This typedef is strictly for the
    make_cleanup function declarations below. Do not use this typedef
    as a cast when passing functions into the make_cleanup() code.
@@ -353,6 +367,8 @@
 
 extern void null_cleanup (void *);
 
+extern void xfree (void *);
+
 extern int myread (int, char *, int);
 
 extern int query (char *, ...) ATTR_FORMAT (printf, 1, 2);
@@ -593,11 +609,6 @@
 
 struct frame_info;
 
-void default_get_saved_register (char *raw_buffer, int *optimized,
-				 CORE_ADDR * addrp,
-				 struct frame_info *frame, int regnum,
-				 enum lval_type *lval);
-
 /* From readline (but not in any readline .h files).  */
 
 extern char *tilde_expand (char *);
@@ -701,20 +712,40 @@
   };
 
 
-/* Host machine definition.  This will be a symlink to one of the
-   xm-*.h files, built by the `configure' script.  */
+/* Optional host machine definition.  Pure autoconf targets will not
+   need a "xm.h" file.  This will be a symlink to one of the xm-*.h
+   files, built by the `configure' script.  */
 
+#ifdef GDB_XM_FILE
 #include "xm.h"
+#endif
 
-/* Native machine support.  This will be a symlink to one of the
-   nm-*.h files, built by the `configure' script.  */
+/* Optional native machine support.  Non-native (and possibly pure
+   multi-arch) targets do not need a "nm.h" file.  This will be a
+   symlink to one of the nm-*.h files, built by the `configure'
+   script.  */
 
+#ifdef GDB_NM_FILE
 #include "nm.h"
+#endif
 
-/* Target machine definition.  This will be a symlink to one of the
+/* Optional target machine definition.  Pure multi-arch configurations
+   do not need a "tm.h" file.  This will be a symlink to one of the
    tm-*.h files, built by the `configure' script.  */
 
+#ifdef GDB_TM_FILE
 #include "tm.h"
+#endif
+
+/* GDB_MULTI_ARCH is normally set by configure.in using information
+   from configure.tgt or the config/%/%.mt Makefile fragment.  Since
+   some targets have defined it in their "tm.h" file, delay providing
+   a default definition until after "tm.h" has been included.. */
+
+#ifndef GDB_MULTI_ARCH
+#define GDB_MULTI_ARCH 0
+#endif
+
 
 /* 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
@@ -772,10 +803,10 @@
 #endif
 
 #if !defined (ULONGEST_MAX)
-#define	ULONGEST_MAX (~(ULONGEST)0)        /* 0xFFFFFFFFFFFFFFFF for 32-bits */
+#define	ULONGEST_MAX (~(ULONGEST)0)        /* 0xFFFFFFFFFFFFFFFF for 64-bits */
 #endif
 
-#if !defined (LONGEST_MAX)                 /* 0x7FFFFFFFFFFFFFFF for 32-bits */
+#if !defined (LONGEST_MAX)                 /* 0x7FFFFFFFFFFFFFFF for 64-bits */
 #define	LONGEST_MAX ((LONGEST)(ULONGEST_MAX >> 1))
 #endif
 
@@ -806,6 +837,11 @@
 extern PTR xmrealloc (PTR, PTR, long);
 #endif
 
+/* Like asprintf/vasprintf but get an internal_error if the call
+   fails. */
+extern void xasprintf (char **ret, const char *format, ...) ATTR_FORMAT (printf, 2, 3);
+extern void xvasprintf (char **ret, const char *format, va_list ap);
+
 extern int parse_escape (char **);
 
 /* Message to be printed before the error message, when an error occurs.  */
@@ -996,51 +1032,6 @@
 #define TARGET_CHAR_BIT 8
 #endif
 
-/* Number of bits in a short or unsigned short for the target machine. */
-#if !defined (TARGET_SHORT_BIT)
-#define TARGET_SHORT_BIT (2 * TARGET_CHAR_BIT)
-#endif
-
-/* Number of bits in an int or unsigned int for the target machine. */
-#if !defined (TARGET_INT_BIT)
-#define TARGET_INT_BIT (4 * TARGET_CHAR_BIT)
-#endif
-
-/* Number of bits in a long or unsigned long for the target machine. */
-#if !defined (TARGET_LONG_BIT)
-#define TARGET_LONG_BIT (4 * TARGET_CHAR_BIT)
-#endif
-
-/* Number of bits in a long long or unsigned long long for the target machine. */
-#if !defined (TARGET_LONG_LONG_BIT)
-#define TARGET_LONG_LONG_BIT (2 * TARGET_LONG_BIT)
-#endif
-
-/* Number of bits in a float for the target machine. */
-#if !defined (TARGET_FLOAT_BIT)
-#define TARGET_FLOAT_BIT (4 * TARGET_CHAR_BIT)
-#endif
-
-/* Number of bits in a double for the target machine. */
-#if !defined (TARGET_DOUBLE_BIT)
-#define TARGET_DOUBLE_BIT (8 * TARGET_CHAR_BIT)
-#endif
-
-/* Number of bits in a long double for the target machine.  */
-#if !defined (TARGET_LONG_DOUBLE_BIT)
-#define TARGET_LONG_DOUBLE_BIT (2 * TARGET_DOUBLE_BIT)
-#endif
-
-/* Number of bits in a pointer for the target machine */
-#if !defined (TARGET_PTR_BIT)
-#define TARGET_PTR_BIT TARGET_INT_BIT
-#endif
-
-/* Number of bits in a BFD_VMA for the target object file format. */
-#if !defined (TARGET_BFD_VMA_BIT)
-#define TARGET_BFD_VMA_BIT TARGET_PTR_BIT
-#endif
-
 /* If we picked up a copy of CHAR_BIT from a configuration file
    (which may get it by including <limits.h>) then use it to set
    the number of bits in a host char.  If not, use the same size
diff --git a/gdb/delta68-nat.c b/gdb/delta68-nat.c
index f54f1b8..bf81b84 100644
--- a/gdb/delta68-nat.c
+++ b/gdb/delta68-nat.c
@@ -34,9 +34,7 @@
    BLOCKEND is the address of the end of the user structure.  */
 
 CORE_ADDR
-register_addr (regno, blockend)
-     int regno;
-     CORE_ADDR blockend;
+register_addr (int regno, CORE_ADDR blockend)
 {
   static int sysv68reg[] =
   {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, -1, 15, 16};
@@ -64,7 +62,7 @@
 
 /* Read the value of the u area from the kernel.  */
 void
-_initialize_delta68_nat ()
+_initialize_delta68_nat (void)
 {
   struct nlist nl[2];
 
@@ -79,14 +77,14 @@
     }
 }
 
-clear_insn_cache ()
+clear_insn_cache (void)
 {
 #ifdef MCT_TEXT			/* in sys/signal.h on sysV68 R3V7.1 */
   memctl (0, 4096, MCT_TEXT);
 #endif
 }
 
-kernel_u_size ()
+kernel_u_size (void)
 {
   return sizeof (struct user);
 }
diff --git a/gdb/demangle.c b/gdb/demangle.c
index b0fd138..2c59dec 100644
--- a/gdb/demangle.c
+++ b/gdb/demangle.c
@@ -49,58 +49,6 @@
 
 static char *current_demangling_style_string;
 
-/* List of supported demangling styles.  Contains the name of the style as
-   seen by the user, and the enum value that corresponds to that style. */
-
-static const struct demangler
-  {
-    char *demangling_style_name;
-    enum demangling_styles demangling_style;
-    char *demangling_style_doc;
-  }
-demanglers[] =
-{
-  {
-    AUTO_DEMANGLING_STYLE_STRING,
-      auto_demangling,
-      "Automatic selection based on executable"
-  }
-  ,
-  {
-    GNU_DEMANGLING_STYLE_STRING,
-      gnu_demangling,
-      "GNU (g++) style demangling"
-  }
-  ,
-  {
-    LUCID_DEMANGLING_STYLE_STRING,
-      lucid_demangling,
-      "Lucid (lcc) style demangling"
-  }
-  ,
-  {
-    ARM_DEMANGLING_STYLE_STRING,
-      arm_demangling,
-      "ARM style demangling"
-  }
-  ,
-  {
-    HP_DEMANGLING_STYLE_STRING,
-      hp_demangling,
-      "HP (aCC) style demangling"
-  }
-  ,
-  {
-    EDG_DEMANGLING_STYLE_STRING,
-      edg_demangling,
-      "EDG style demangling"
-  }
-  ,
-  {
-    NULL, unknown_demangling, NULL
-  }
-};
-
 static void set_demangling_command (char *, int, struct cmd_list_element *);
 
 /* Set current demangling style.  Called by the "set demangle-style"
@@ -120,19 +68,18 @@
    a malloc'd string, even if it is a null-string. */
 
 static void
-set_demangling_command (ignore, from_tty, c)
-     char *ignore;
-     int from_tty;
-     struct cmd_list_element *c;
+set_demangling_command (char *ignore, int from_tty, struct cmd_list_element *c)
 {
-  const struct demangler *dem;
+  const struct demangler_engine *dem;
 
   /*  First just try to match whatever style name the user supplied with
      one of the known ones.  Don't bother special casing for an empty
      name, we just treat it as any other style name that doesn't match.
      If we match, update the current demangling style enum. */
 
-  for (dem = demanglers; dem->demangling_style_name != NULL; dem++)
+  for (dem = libiberty_demanglers; 
+       dem->demangling_style != unknown_demangling; 
+       dem++)
     {
       if (STREQ (current_demangling_style_string,
 		 dem->demangling_style_name))
@@ -146,7 +93,7 @@
      style name and supply a list of valid ones.  FIXME:  This should
      probably be done with some sort of completion and with help. */
 
-  if (dem->demangling_style_name == NULL)
+  if (dem->demangling_style == unknown_demangling)
     {
       if (*current_demangling_style_string != '\0')
 	{
@@ -154,13 +101,15 @@
 			     current_demangling_style_string);
 	}
       printf_unfiltered ("The currently understood settings are:\n\n");
-      for (dem = demanglers; dem->demangling_style_name != NULL; dem++)
+      for (dem = libiberty_demanglers; 
+	   dem->demangling_style != unknown_demangling; 
+	   dem++)
 	{
 	  printf_unfiltered ("%-10s %s\n", dem->demangling_style_name,
 			     dem->demangling_style_doc);
 	  if (dem->demangling_style == current_demangling_style)
 	    {
-	      free (current_demangling_style_string);
+	      xfree (current_demangling_style_string);
 	      current_demangling_style_string =
 		savestring (dem->demangling_style_name,
 			    strlen (dem->demangling_style_name));
@@ -171,10 +120,11 @@
 	  /* This can happen during initialization if gdb is compiled with
 	     a DEMANGLING_STYLE value that is unknown, so pick the first
 	     one as the default. */
-	  current_demangling_style = demanglers[0].demangling_style;
+	  current_demangling_style = libiberty_demanglers[0].demangling_style;
 	  current_demangling_style_string =
-	    savestring (demanglers[0].demangling_style_name,
-			strlen (demanglers[0].demangling_style_name));
+	    savestring (
+              libiberty_demanglers[0].demangling_style_name,
+	      strlen (libiberty_demanglers[0].demangling_style_name));
 	  warning ("`%s' style demangling chosen as the default.\n",
 		   current_demangling_style_string);
 	}
@@ -184,12 +134,11 @@
 /* Fake a "set demangle-style" command. */
 
 void
-set_demangling_style (style)
-     char *style;
+set_demangling_style (char *style)
 {
   if (current_demangling_style_string != NULL)
     {
-      free (current_demangling_style_string);
+      xfree (current_demangling_style_string);
     }
   current_demangling_style_string = savestring (style, strlen (style));
   set_demangling_command ((char *) NULL, 0, (struct cmd_list_element *) NULL);
@@ -215,14 +164,13 @@
 {CPLUS_MARKER, '.', '$', '\0'};
 
 int
-is_cplus_marker (c)
-     int c;
+is_cplus_marker (int c)
 {
   return c && strchr (cplus_markers, c) != NULL;
 }
 
 void
-_initialize_demangler ()
+_initialize_demangler (void)
 {
   struct cmd_list_element *set, *show;
 
diff --git a/gdb/dink32-rom.c b/gdb/dink32-rom.c
index 1d6f4d0..2ad9c61 100644
--- a/gdb/dink32-rom.c
+++ b/gdb/dink32-rom.c
@@ -30,11 +30,7 @@
 static void dink32_open (char *args, int from_tty);
 
 static void
-dink32_supply_register (regname, regnamelen, val, vallen)
-     char *regname;
-     int regnamelen;
-     char *val;
-     int vallen;
+dink32_supply_register (char *regname, int regnamelen, char *val, int vallen)
 {
   int regno = 0;
 
@@ -100,10 +96,7 @@
 }
 
 static void
-dink32_load (monops, filename, from_tty)
-     struct monitor_ops *monops;
-     char *filename;
-     int from_tty;
+dink32_load (struct monitor_ops *monops, char *filename, int from_tty)
 {
   extern int inferior_pid;
 
@@ -122,7 +115,7 @@
    different names than GDB does, and don't support all the registers
    either.  */
 
-static char *dink32_regnames[NUM_REGS] =
+static char *dink32_regnames[] =
 {
   "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
   "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
@@ -145,15 +138,13 @@
 static struct monitor_ops dink32_cmds;
 
 static void
-dink32_open (args, from_tty)
-     char *args;
-     int from_tty;
+dink32_open (char *args, int from_tty)
 {
   monitor_open (args, &dink32_cmds, from_tty);
 }
 
 void
-_initialize_dink32_rom ()
+_initialize_dink32_rom (void)
 {
   dink32_cmds.flags = MO_HEX_PREFIX | MO_GETMEM_NEEDS_RANGE | MO_FILL_USES_ADDR | MO_HANDLE_NL | MO_32_REGS_PAIRED | MO_SETREG_INTERACTIVE | MO_SETMEM_INTERACTIVE | MO_GETMEM_16_BOUNDARY | MO_CLR_BREAK_1_BASED | MO_SREC_ACK | MO_SREC_ACK_ROTATE;
   dink32_cmds.init = dink32_inits;
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 8d95eba..8fa44e6 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,72 @@
+2000-12-25  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* refcard.tex: Version and copyright fixed.  From Phil Edwards
+	<pedwards@disaster.jaj.com>.
+
+Thu Nov 30 16:57:19 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdbint.texinfo (ECOFF_REG_TO_REGNUM, DWARF_REG_TO_REGNUM,
+ 	DWARF2_REG_TO_REGNUM): Document.
+
+Mon Nov 20 21:29:35 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdbint.texinfo (Coding): Update current value of
+ 	--enable-build-warnings.  Mention --enable-gdb-build-warnings.
+
+2000-11-19  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* gdb.texinfo (Continuing and Stepping):  Fixed markup and typos,
+	as suggested by Dmitry Sivachenko <dima@Chg.RU>.
+
+2000-11-10  Christopher Faylor <cgf@cygnus.com>
+
+	* gdb.texinfo: Document new 'set step-mode' command.
+
+2000-10-16  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* gdb.texinfo (Contributors, MIPS Embedded): Minor spelling
+	changes from Dmitry Sivachenko <dima@Chg.RU>.
+
+2000-09-26  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* gdb.texinfo (Hooks): Document the new post-hook functionality.
+	From Steven Johnson <sbjohnson@ozemail.com.au>.
+
+2000-08-10  Mark Kettenis  <kettenis@gnu.org>
+
+	* gdbint.texinfo (Overall Structure): Spelling fix.
+
+2000-08-10  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* gdbint.texinfo (Target Architecture Definition): Document that
+	REGISTER_CONVERT_TO_VIRTUAL should only be called on a register
+	for which REGISTER_CONVERTIBLE returns a zero value.
+
+2000-07-08  Christopher Faylor <cgf@cygnus.com>
+
+	* Makefile.in (install-info): Find files to install in either the
+	build or source directories (adapted from Makefile.am).
+
+2000-07-07  Nicholas Duffek  <nsd@redhat.com>
+
+	* stabs.texinfo: Fix spelling errors.
+	(String Field): FILE-NUMBER starts from 0, not 1.
+
+2000-07-05  Eli Zaretskii <eliz@is.elta.co.il>
+
+	* refcard.tex: Remove \centerline from the blurb.  Patch from
+        Brian Youmans.
+
+2000-06-25  Eli Zaretskii <eliz@is.elta.co.il>
+
+	* Makefile.in (install-info): Support installation from outside of
+        the source directory.  Reported by Mark Harig
+        <markh@frazier.landmark.com>.
+
+2000-06-20  J.T. Conklin  <jtc@redback.com>
+
+	* gdb.texinfo: Fix typo, $bpnum is set to last breakpoint number.
+
 Fri May 26 15:55:33 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* Makefile.in (pdf, gdbint.pdf, gdb.pdf, stabs.pdf): New targets.
diff --git a/gdb/doc/Makefile.in b/gdb/doc/Makefile.in
index 025c20e..d591f5a 100644
--- a/gdb/doc/Makefile.in
+++ b/gdb/doc/Makefile.in
@@ -62,6 +62,9 @@
 SET_TEXINPUTS = \
    TEXINPUTS=${TEXIDIR}:.:$(srcdir):$(READLINE_DIR):$(GDBMI_DIR):$$TEXINPUTS
 
+# Files which should be generated via 'info' and installed by 'install-info'
+INFO_DEPS = gdb.info gdbint.info stabs.info
+
 # There may be alternate predefined collections of switches to configure
 # the GDB manual.  Normally this is not done in synch with the software
 # config system, since this choice tends to be independent; most people
@@ -108,7 +111,7 @@
 
 all install:
 
-info: gdb.info gdbint.info stabs.info
+info: $(INFO_DEPS)
 dvi: gdb.dvi gdbint.dvi stabs.dvi refcard.dvi
 ps: gdb.ps gdbint.ps stabs.ps refcard.ps
 html: gdb_toc.html gdbint_toc.html stabs_toc.html
@@ -116,13 +119,20 @@
 all-doc: info dvi ps # pdf
 diststuff: info
 
-install-info: info
+install-info: $(INFO_DEPS)
 	$(SHELL) $(srcdir)/../../mkinstalldirs $(infodir)
-	for i in *.info* ; do \
-		$(INSTALL_DATA) $$i $(infodir)/$$i ; \
+	@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 $(infodir)/$$ifile"; \
+	      $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile; \
+	    else : ; fi; \
+	  done; \
 	done
 	@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
-	  list='gdb.info gdbint.info stabs.info'; \
+	  list='$(INFO_DEPS)'; \
 	  for file in $$list; do \
 	    echo " install-info --info-dir=$(infodir) $(infodir)/$$file";\
 	    install-info --info-dir=$(infodir) $(infodir)/$$file || :;\
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 914e0ab..aa92565 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -325,7 +325,7 @@
 David Johnson wrote the original COFF support; Pace Willison did
 the original support for encapsulated COFF.
 
-Brent Benson of Harris Computer Systems contributed DWARF 2 support.
+Brent Benson of Harris Computer Systems contributed DWARF2 support.
 
 Adam de Boor and Bradley Davis contributed the ISI Optimum V support.
 Per Bothner, Noboyuki Hikichi, and Alessandro Forin contributed MIPS
@@ -2324,7 +2324,7 @@
 @cindex latest breakpoint
 Breakpoints are set with the @code{break} command (abbreviated
 @code{b}).  The debugger convenience variable @samp{$bpnum} records the
-number of the breakpoints you've set most recently; see @ref{Convenience
+number of the breakpoint you've set most recently; see @ref{Convenience
 Vars,, Convenience variables}, for a discussion of what you can do with
 convenience variables.
 
@@ -3281,12 +3281,12 @@
 below.
 @end quotation
 
-The @code{step} command only stops at the first instruction of a
-source line.  This prevents the multiple stops that could otherwise occur in
-switch statements, for loops, etc.  @code{step} continues to stop if a
-function that has debugging information is called within the line.
-In other words, @code{step} @emph{steps inside} any functions called
-within the line.
+The @code{step} command only stops at the first instruction of a source
+line.  This prevents the multiple stops that could otherwise occur in
+@code{switch} statements, @code{for} loops, etc.  @code{step} continues
+to stop if a function that has debugging information is called within
+the line.  In other words, @code{step} @emph{steps inside} any functions
+called within the line.
 
 Also, the @code{step} command only enters a function if there is line
 number information for the function.  Otherwise it acts like the
@@ -3321,7 +3321,24 @@
 
 The @code{next} command only stops at the first instruction of a
 source line.  This prevents multiple stops that could otherwise occur in
-switch statements, for loops, etc.
+@code{switch} statements, @code{for} loops, etc.
+
+@kindex set step-mode
+@item set step-mode
+@cindex functions without line info, and stepping
+@cindex stepping into functions with no line info
+@itemx set step-mode on
+The @code{set step-mode on} command causes the @code{step} command to
+stop at the first instruction of a function which contains no debug line
+information rather than stepping over it.
+
+This is useful in cases where you may be interested in inspecting the
+machine instructions of a function which has no symbolic info and do not
+want @value{GDBN} to automatically skip over this function.
+
+@item set step-mode off
+Causes the @code{step} command to step over any functions which contains no
+debug information.  This is the default.
 
 @kindex finish
 @item finish
@@ -4500,7 +4517,7 @@
 formats.  For example, @value{NGCC}, the @sc{gnu} C/C++ compiler usually
 supports the @samp{-gstabs} option.  @samp{-gstabs} produces debug info
 in a format that is superior to formats such as COFF.  You may be able
-to use DWARF-2 (@samp{-gdwarf-2}), which is also an effective form for
+to use DWARF2 (@samp{-gdwarf-2}), which is also an effective form for
 debug info.  See @ref{Debugging Options,,Options for Debugging Your
 Program or @sc{gnu} CC, gcc.info, Using @sc{gnu} CC}, for more
 information.
@@ -10869,7 +10886,7 @@
 Use the @code{set processor} command to set the type of MIPS
 processor when you want to access processor-type-specific registers.
 For example, @code{set processor @var{r3041}} tells @value{GDBN}
-to use the CPO registers appropriate for the 3041 chip.
+to use the CPU registers appropriate for the 3041 chip.
 Use the @code{show processor} command to see what MIPS processor @value{GDBN}
 is using.  Use the @code{info reg} command to see what registers
 @value{GDBN} is using.
@@ -11859,12 +11876,30 @@
 @section User-defined command hooks
 @cindex command hooks
 @cindex hooks, for commands
+@cindex hooks, pre-command
 
-You may define @emph{hooks}, which are a special kind of user-defined
+@kindex hook
+@kindex hook-
+You may define @dfn{hooks}, which are a special kind of user-defined
 command.  Whenever you run the command @samp{foo}, if the user-defined
 command @samp{hook-foo} exists, it is executed (with no arguments)
 before that command.
 
+@cindex hooks, post-command
+@kindex hookpost
+@kindex hookpost-
+A hook may also be defined which is run after the command you executed.
+Whenever you run the command @samp{foo}, if the user-defined command
+@samp{hookpost-foo} exists, it is executed (with no arguments) after
+that command.  Post-execution hooks may exist simultaneously with
+pre-execution hooks, for the same command.
+
+It is valid for a hook to call the command which it hooks.  If this
+occurs, the hook is not re-executed, thereby avoiding infinte recursion.
+
+@c It would be nice if hookpost could be passed a parameter indicating
+@c if the command it hooks executed properly or not.  FIXME!
+
 @kindex stop@r{, a pseudo-command}
 In addition, a pseudo-command, @samp{stop} exists.  Defining
 (@samp{hook-stop}) makes the associated commands execute every time
@@ -11889,6 +11924,25 @@
 end
 @end example
 
+As a further example, to hook at the begining and end of the @code{echo}
+command, and to add extra text to the beginning and end of the message, 
+you could define:
+
+@example
+define hook-echo
+echo <<<---
+end
+
+define hookpost-echo
+echo --->>>\n
+end
+
+(@value{GDBP}) echo Hello World
+<<<---Hello World--->>>
+(@value{GDBP})
+
+@end example
+
 You can define a hook for any single-word command in @value{GDBN}, but
 not for command aliases; you should define a hook for the basic command
 name, e.g.  @code{backtrace} rather than @code{bt}.
diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
index 532d223..0a54d24 100644
--- a/gdb/doc/gdbint.texinfo
+++ b/gdb/doc/gdbint.texinfo
@@ -137,7 +137,7 @@
 @value{GDBN} consists of three major subsystems: user interface, symbol handling
 (the ``symbol side''), and target system handling (the ``target side'').
 
-Ther user interface consists of several actual interfaces, plus
+The user interface consists of several actual interfaces, plus
 supporting code.
 
 The symbol side consists of object file readers, debugging info
@@ -1368,6 +1368,9 @@
 @deftypefn {Target Macro} int REGISTER_CONVERTIBLE (int @var{reg})
 Return non-zero if register number @var{reg}'s value needs different raw
 and virtual formats.
+
+You should not use @code{REGISTER_CONVERT_TO_VIRTUAL} for a register
+unless this macro returns a non-zero value for that register.
 @end deftypefn
 
 @deftypefn {Target Macro} int REGISTER_RAW_SIZE (int @var{reg})
@@ -1395,8 +1398,13 @@
 at @var{from} holds the register's value in raw format; the macro should
 convert the value to virtual format, and place it at @var{to}.
 
-Note that REGISTER_CONVERT_TO_VIRTUAL and REGISTER_CONVERT_TO_RAW take
-their @var{reg} and @var{type} arguments in different orders.
+Note that @code{REGISTER_CONVERT_TO_VIRTUAL} and
+@code{REGISTER_CONVERT_TO_RAW} take their @var{reg} and @var{type}
+arguments in different orders.
+
+You should only use @code{REGISTER_CONVERT_TO_VIRTUAL} with registers
+for which the @code{REGISTER_CONVERTIBLE} macro returns a non-zero
+value.
 @end deftypefn
 
 @deftypefn {Target Macro} void REGISTER_CONVERT_TO_RAW (struct type *@var{type}, int @var{reg}, char *@var{from}, char *@var{to})
@@ -1632,6 +1640,18 @@
 @item DO_REGISTERS_INFO
 If defined, use this to print the value of a register or all registers.
 
+@item DWARF_REG_TO_REGNUM
+Convert DWARF register number into @value{GDBN} regnum.  If not defined,
+no conversion will be performed.
+
+@item DWARF2_REG_TO_REGNUM
+Convert DWARF2 register number into @value{GDBN} regnum.  If not
+defined, no conversion will be performed.
+
+@item ECOFF_REG_TO_REGNUM
+Convert ECOFF register number into @value{GDBN} regnum.  If not defined,
+no conversion will be performed.
+
 @item END_OF_TEXT_DEFAULT
 This is an expression that should designate the end of the text section
 (? FIXME ?)
@@ -2765,11 +2785,12 @@
 @value{GDBN} follows an additional set of coding standards specific to @value{GDBN},
 as described in the following sections.
 
-You can configure with @samp{--enable-build-warnings} to get GCC to
-check on a number of these rules.  @value{GDBN} sources ought not to engender any
-complaints, unless they are caused by bogus host systems.  (The exact
-set of enabled warnings is currently @samp{-Wall -Wpointer-arith
--Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations}.
+You can configure with @samp{--enable-build-warnings} or
+@samp{--enable-gdb-build-warnings} to get GCC to check on a number of
+these rules.  @value{GDBN} sources ought not to engender any complaints,
+unless they are caused by bogus host systems.  (The exact set of enabled
+warnings is currently @samp{-Wimplicit -Wreturn-type -Wcomment
+-Wtrigraphs -Wformat -Wparentheses -Wpointer-arith -Wuninitialized}.
 
 @subsection Formatting
 
diff --git a/gdb/doc/refcard.tex b/gdb/doc/refcard.tex
index d2b72de..6464b5b 100644
--- a/gdb/doc/refcard.tex
+++ b/gdb/doc/refcard.tex
@@ -240,7 +240,7 @@
 }
 }
 
-{\vbbf GDB QUICK REFERENCE}\hfil{\smrm GDB Version 4}\qquad
+{\vbbf GDB QUICK REFERENCE}\hfil{\smrm GDB Version 5}\qquad
 
 \sec Essential Commands;
 gdb {\it program} \opt{{\it core}}&debug {\it program} \opt{using
@@ -304,7 +304,7 @@
 \line{\smrm \opt{ } surround optional arguments \hfill $\ldots$ show
 one or more arguments}
 \vskip\baselineskip
-\centerline{\smrm \copyright 1998 Free Software Foundation, Inc.\qquad Permissions on back}
+\centerline{\smrm \copyright 1998,2000 Free Software Foundation, Inc.\qquad Permissions on back}
 \eject
 \sec Breakpoints and Watchpoints;
 break \opt{\it file\tt:}{\it line}\par
@@ -628,15 +628,16 @@
 
 \vfill
 {\smrm\parskip=6pt
-\centerline{Copyright \copyright 1991, '92, '93, '98 Free Software Foundation, Inc.}
-\centerline{Roland H. Pesch}
-\centerline{The author assumes no responsibility for any errors on this card.}
+Copyright \copyright 1991,'92,'93,'98,2000 Free Software Foundation, Inc. 
+Author: Roland H. Pesch
+
+The author assumes no responsibility for any errors on this card.
 
 This card may be freely distributed under the terms of the GNU
 General Public License.
 
-\centerline{Please contribute to development of this card by
-annotating it.  Improvements can be sent to bug-gdb@gnu.org.}
+Please contribute to development of this card by
+annotating it.  Improvements can be sent to bug-gdb@gnu.org.
 
 GDB itself is free software; you are welcome to distribute copies of
 it under the terms of the GNU General Public License.  There is
diff --git a/gdb/doc/stabs.texinfo b/gdb/doc/stabs.texinfo
index a4ea1dc..e96674d 100644
--- a/gdb/doc/stabs.texinfo
+++ b/gdb/doc/stabs.texinfo
@@ -79,7 +79,7 @@
 * Symbol Descriptors::		Table of symbol descriptors
 * Type Descriptors::		Table of type descriptors
 * Expanded Reference::		Reference information by stab type
-* Questions::			Questions and anomolies
+* Questions::			Questions and anomalies
 * Stab Sections::		In some object file formats, stabs are
                                 in sections.
 * Symbol Types Index::          Index of symbolic stab symbol type names.
@@ -246,9 +246,8 @@
 additionally permit a @var{type-number} to be a pair
 (@var{file-number},@var{filetype-number}) (the parentheses appear in the
 string, and serve to distinguish the two cases).  The @var{file-number}
-is a number starting with 1 which is incremented for each seperate
-source file in the compilation (e.g., in C, each header file gets a
-different number).  The @var{filetype-number} is a number starting with
+is 0 for the base source file, 1 for the first included file, 2 for the
+next, and so on.  The @var{filetype-number} is a number starting with
 1 which is incremented for each new type defined in the file.
 (Separating the file number and the type number permits the
 @code{N_BINCL} optimization to succeed more often; see @ref{Include
@@ -486,7 +485,7 @@
 If the linker detects that two source files have identical stabs between
 an @code{N_BINCL} and @code{N_EINCL} pair (as will generally be the case
 for a header file), then it only puts out the stabs once.  Each
-additional occurance is replaced by an @code{N_EXCL} symbol.  I believe
+additional occurrence is replaced by an @code{N_EXCL} symbol.  I believe
 the GNU linker and the Sun (both SunOS4 and Solaris) linker are the only
 ones which supports this feature.
 
@@ -1320,7 +1319,7 @@
 would need to know about the type---in some cases they merely specify
 enough information to distinguish the type from other types.
 
-The traditional way to define builtin types is convolunted, so new ways
+The traditional way to define builtin types is convoluted, so new ways
 have been invented to describe them.  Sun's @code{acc} uses special
 builtin type descriptors (@samp{b} and @samp{R}), and IBM uses negative
 type numbers.  GDB accepts all three ways, as of version 4.8; dbx just
@@ -1328,7 +1327,7 @@
 formats.  The following sections describe each of these formats.
 
 @menu
-* Traditional Builtin Types::	Put on your seatbelts and prepare for kludgery
+* Traditional Builtin Types::	Put on your seat belts and prepare for kludgery
 * Builtin Type Descriptors::	Builtin types with special type descriptors
 * Negative Type Numbers::	Builtin types using negative type numbers
 @end menu
@@ -1482,7 +1481,7 @@
 These are for complex numbers.  A comment in the GDB source describes
 them as Fortran @code{complex}, @code{double complex}, and
 @code{complex*16}, respectively, but what does that mean?  (i.e., Single
-precision?  Double precison?).
+precision?  Double precision?).
 
 @item 6 (NF_LDOUBLE)
 Long double.  This should probably only be used for Sun format
@@ -1821,7 +1820,7 @@
 the argument list.
 
 @item a @var{register-number}
-The bound is pased by reference in register number
+The bound is passed by reference in register number
 @var{register-number}.
 
 @item t @var{register-number}
@@ -2014,9 +2013,9 @@
 
 The following source code declares a structure tag and defines an
 instance of the structure in global scope. Then a @code{typedef} equates the
-structure tag with a new type.  Seperate stabs are generated for the
+structure tag with a new type.  Separate stabs are generated for the
 structure tag, the structure @code{typedef}, and the structure instance.  The
-stabs for the tag and the @code{typedef} are emited when the definitions are
+stabs for the tag and the @code{typedef} are emitted when the definitions are
 encountered.  Since the structure elements are not initialized, the
 stab and code for the structure variable itself is located at the end
 of the program in the bss section.
@@ -2056,7 +2055,7 @@
 element description is a simple type reference.  The other two structure
 elements are new types.  In this case there is a type definition
 embedded after the @samp{@var{name}:}.  The type definition for the
-array element looks just like a type definition for a standalone array.
+array element looks just like a type definition for a stand-alone array.
 The @code{s_next} field is a pointer to the same kind of structure that
 the field is an element of.  So the definition of structure type 16
 contains a type definition for an element which is a pointer to type 16.
@@ -2123,7 +2122,7 @@
 the procedure in which it is defined.  The stab type is @code{N_LSYM}.  This
 would seem to imply that the union type is file scope, like the struct
 type @code{s_tag}.  This is not true.  The contents and position of the stab
-for @code{u_type} do not convey any infomation about its procedure local
+for @code{u_type} do not convey any information about its procedure local
 scope.
 
 @c FIXME: phony line break.  Can probably be fixed by using an example
@@ -2402,7 +2401,7 @@
 * Protections::
 * Method Modifiers::
 * Virtual Methods::
-* Inheritence::
+* Inheritance::
 * Virtual Base Classes::
 * Static Members::
 @end menu
@@ -2528,7 +2527,7 @@
 A stab describing a C++ class type is similar in format to a stab
 describing a C struct, with each class member shown as a field in the
 structure.  The part of the struct format describing fields is
-expanded to include extra information relevent to C++ class members.
+expanded to include extra information relevant to C++ class members.
 In addition, if the class has multiple base classes or virtual
 functions the struct format outside of the field parts is also
 augmented.
@@ -2563,7 +2562,7 @@
 occur in the @var{operator-name} string.
 
 The next part of the method description represents the arguments to the
-method, preceeded by a colon and ending with a semi-colon.  The types of
+method, preceded by a colon and ending with a semi-colon.  The types of
 the arguments are expressed in the same way argument types are expressed
 in C++ name mangling.  In this example an @code{int} and a @code{char}
 map to @samp{ic}.
@@ -2655,7 +2654,7 @@
 @c GDB.  But gpcompare.texi doesn't seem to be in the FSF GCC.
 
 @example
-.stabs "name:symbol_desriptor(global function)return_type(int)",
+.stabs "name:symbol_descriptor(global function)return_type(int)",
         N_FUN, NIL, NIL, code_addr_of_method_start
 
 .stabs "Ameth__5baseAic:F1",36,0,0,_Ameth__5baseAic
@@ -2664,8 +2663,8 @@
 Here is the stab for the @code{this} pointer implicit argument.  The
 name of the @code{this} pointer is always @code{this}.  Type 19, the
 @code{this} pointer is defined as a pointer to type 20, @code{baseA},
-but a stab defining @code{baseA} has not yet been emited.  Since the
-compiler knows it will be emited shortly, here it just outputs a cross
+but a stab defining @code{baseA} has not yet been emitted.  Since the
+compiler knows it will be emitted shortly, here it just outputs a cross
 reference to the undefined symbol, by prefixing the symbol name with
 @samp{xs}.
 
@@ -2733,8 +2732,8 @@
 @section Protections
 
 In the simple class definition shown above all member data and
-functions were publicly accessable.  The example that follows
-contrasts public, protected and privately accessable fields and shows
+functions were publicly accessible.  The example that follows
+contrasts public, protected and privately accessible fields and shows
 how these protections are encoded in C++ stabs.
 
 If the character following the @samp{@var{field-name}:} part of the
@@ -2777,7 +2776,7 @@
 (@samp{2}) and offset and size @samp{,32,8;}.  The @code{pub} field has
 type float (@samp{12}), and offset and size @samp{,64,32;}.
 
-Protections for member functions are signified by one digit embeded in
+Protections for member functions are signified by one digit embedded in
 the field part of the stab describing the method.  The digit is 0 if
 private, 1 if protected and 2 if public.  Consider the C++ class
 definition below:
@@ -2803,7 +2802,7 @@
         meth_name::type_def(22)=sym_desc(method)returning(int);
         :args(int);protection(private)modifier(normal)virtual(no);
         meth_name::type_def(23)=sym_desc(method)returning(char);
-        :args(char);protection(protected)modifier(normal)virual(no);
+        :args(char);protection(protected)modifier(normal)virtual(no);
         meth_name::type_def(24)=sym_desc(method)returning(float);
         :args(float);protection(public)modifier(normal)virtual(no);;",
         N_LSYM,NIL,NIL,NIL
@@ -2844,7 +2843,7 @@
         meth_name(VolatileMeth)::type_def(22)=sym_desc(method)
         returning(char);:arg(char);protection(public)modifier(volatile)virt(no)
         meth_name(ConstVolMeth)::type_def(23)=sym_desc(method)
-        returning(float);:arg(float);protection(public)modifer(const volatile)
+        returning(float);:arg(float);protection(public)modifier(const volatile)
         virtual(no);;", @dots{}
 @end display
 
@@ -2907,7 +2906,7 @@
 semi-colon.
 
 The second number is a type reference to the first base class in the
-inheritence hierarchy defining the virtual member function.  In this
+inheritance hierarchy defining the virtual member function.  In this
 case the class stab describes a base class so the virtual function is
 not overriding any other definition of the method.  Therefore the
 reference is to the type number of the class that the stab is
@@ -2919,7 +2918,7 @@
 
 For classes containing virtual functions the very last section of the
 string part of the stab holds a type reference to the first base
-class.  This is preceeded by @samp{~%} and followed by a final semi-colon.
+class.  This is preceded by @samp{~%} and followed by a final semi-colon.
 
 @display
 .stabs "class_name(A):type_def(20)=sym_desc(struct)struct_bytes(8)
@@ -2940,22 +2939,22 @@
         A_virt::23=##1;:i;2A*-2147483647;20;;;~%20;",128,0,0,0
 @end example
 
-@node Inheritence
-@section Inheritence
+@node Inheritance
+@section Inheritance
 
 Stabs describing C++ derived classes include additional sections that
-describe the inheritence hierarchy of the class.  A derived class stab
+describe the inheritance hierarchy of the class.  A derived class stab
 also encodes the number of base classes.  For each base class it tells
-if the base class is virtual or not, and if the inheritence is private
+if the base class is virtual or not, and if the inheritance is private
 or public.  It also gives the offset into the object of the portion of
 the object corresponding to each base class.
 
-This additional information is embeded in the class stab following the
+This additional information is embedded in the class stab following the
 number of bytes in the struct.  First the number of base classes
 appears bracketed by an exclamation point and a comma.
 
 Then for each base type there repeats a series: a virtual character, a
-visibilty character, a number, a comma, another number, and a
+visibility character, a number, a comma, another number, and a
 semi-colon.
 
 The virtual character is @samp{1} if the base class is virtual and
@@ -3033,11 +3032,11 @@
 @display
 .stabs "derived_class_name:symbol_descriptors(struct tag&type)=
         type_descriptor(struct)struct_bytes(32)!num_bases(3),
-        base_virtual(no)inheritence_public(no)base_offset(0),
+        base_virtual(no)inheritance_public(no)base_offset(0),
         base_class_type_ref(A);
-        base_virtual(yes)inheritence_public(no)base_offset(NIL),
+        base_virtual(yes)inheritance_public(no)base_offset(NIL),
         base_class_type_ref(B);
-        base_virtual(no)inheritence_public(yes)base_offset(64),
+        base_virtual(no)inheritance_public(yes)base_offset(64),
         base_class_type_ref(C); @dots{}
 @end display
 
@@ -3055,7 +3054,7 @@
 A derived class object consists of a concatenation in memory of the data
 areas defined by each base class, starting with the leftmost and ending
 with the rightmost in the list of base classes.  The exception to this
-rule is for virtual inheritence.  In the example above, class @code{D}
+rule is for virtual inheritance.  In the example above, class @code{D}
 inherits virtually from base class @code{B}.  This means that an
 instance of a @code{D} object will not contain its own @code{B} part but
 merely a pointer to a @code{B} part, known as a virtual base pointer.
@@ -3509,7 +3508,7 @@
 @item b
 Pascal space type (AIX); see @ref{Miscellaneous Types}.  Builtin integer
 type (Sun); see @ref{Builtin Type Descriptors}.  Const and volatile
-qualfied type (OS9000).
+qualified type (OS9000).
 
 @item B
 Volatile-qualified type; see @ref{Miscellaneous Types}.
@@ -3858,11 +3857,11 @@
 structures, unions, and enums (symbol descriptor @samp{T}) and typedefs
 (symbol descriptor @samp{t}) defined at file scope from types defined locally
 to a procedure or other more local scope.  They all use the @code{N_LSYM}
-stab type.  Types defined at procedure scope are emited after the
+stab type.  Types defined at procedure scope are emitted after the
 @code{N_RBRAC} of the preceding function and before the code of the
 procedure in which they are defined.  This is exactly the same as
 types defined in the source file between the two procedure bodies.
-GDB overcompensates by placing all types in block #1, the block for
+GDB over-compensates by placing all types in block #1, the block for
 symbols of file scope.  This is true for default, @samp{-ansi} and
 @samp{-traditional} compiler options. (Bugs gcc/1063, gdb/1066.)
 
diff --git a/gdb/dpx2-nat.c b/gdb/dpx2-nat.c
index d039a13..37275fe 100644
--- a/gdb/dpx2-nat.c
+++ b/gdb/dpx2-nat.c
@@ -47,9 +47,7 @@
  */
 
 int
-dpx2_register_u_addr (blockend, regnum)
-     int blockend;
-     int regnum;
+dpx2_register_u_addr (int blockend, int regnum)
 {
   if (regnum < FP0_REGNUM)
     return (blockend + 4 * regmap[regnum]);
@@ -73,7 +71,7 @@
 CORE_ADDR kernel_u_addr;
 
 void
-_initialize_dpx2_nat ()
+_initialize_dpx2_nat (void)
 {
   struct utsname uts;
 
diff --git a/gdb/dsrec.c b/gdb/dsrec.c
index 31b8fc2..6065380 100644
--- a/gdb/dsrec.c
+++ b/gdb/dsrec.c
@@ -44,14 +44,8 @@
    and returns non-zero if the ack is read correctly.  */
 
 void
-load_srec (desc, file, load_offset, maxrecsize, flags, hashmark, waitack)
-     serial_t desc;
-     const char *file;
-     bfd_vma load_offset;
-     int maxrecsize;
-     int flags;
-     int hashmark;
-     int (*waitack) (void);
+load_srec (serial_t desc, const char *file, bfd_vma load_offset, int maxrecsize,
+	   int flags, int hashmark, int (*waitack) (void))
 {
   bfd *abfd;
   asection *s;
@@ -218,14 +212,8 @@
  */
 
 static int
-make_srec (srec, targ_addr, abfd, sect, sectoff, maxrecsize, flags)
-     char *srec;
-     CORE_ADDR targ_addr;
-     bfd *abfd;
-     asection *sect;
-     int sectoff;
-     int *maxrecsize;
-     int flags;
+make_srec (char *srec, CORE_ADDR targ_addr, bfd *abfd, asection *sect,
+	   int sectoff, int *maxrecsize, int flags)
 {
   unsigned char checksum;
   int tmp;
diff --git a/gdb/dst.h b/gdb/dst.h
index 31261d1..b72c58c 100644
--- a/gdb/dst.h
+++ b/gdb/dst.h
@@ -541,7 +541,7 @@
   }
 dst_var_loc_t;
 
-/* Locations come in two versions. The sort, and the long. The difference
+/* Locations come in two versions. The short, and the long. The difference
  * between the short and the long is the addition of a statement number
  * field to the start andend of the range of the long, and and unkown
  * purpose field in the middle. Also, loc_type and loc_index aren't
diff --git a/gdb/dstread.c b/gdb/dstread.c
index a5f7f35..344717d 100644
--- a/gdb/dstread.c
+++ b/gdb/dstread.c
@@ -78,9 +78,7 @@
 /* FIXME: Use record_line instead.  */
 
 static void
-dst_record_line (line, pc)
-     int line;
-     CORE_ADDR pc;
+dst_record_line (int line, CORE_ADDR pc)
 {
   struct linetable_entry *e;
   /* Make sure line vector is big enough.  */
@@ -104,12 +102,12 @@
 /* FIXME: use start_symtab, like coffread.c now does.  */
 
 static void
-dst_start_symtab ()
+dst_start_symtab (void)
 {
   /* Initialize the source file line number information for this file.  */
 
   if (line_vector)		/* Unlikely, but maybe possible? */
-    free ((PTR) line_vector);
+    xfree (line_vector);
   line_vector_index = 0;
   line_vector_length = 1000;
   prev_line_number = -2;	/* Force first line number to be explicit */
@@ -124,10 +122,7 @@
    text address for the file, and SIZE is the number of bytes of text.  */
 
 static void
-complete_symtab (name, start_addr, size)
-     char *name;
-     CORE_ADDR start_addr;
-     unsigned int size;
+complete_symtab (char *name, CORE_ADDR start_addr, unsigned int size)
 {
   last_source_file = savestring (name, strlen (name));
   cur_src_start_addr = start_addr;
@@ -148,8 +143,7 @@
 /* FIXME: Use end_symtab, like coffread.c now does.  */
 
 static void
-dst_end_symtab (objfile)
-     struct objfile *objfile;
+dst_end_symtab (struct objfile *objfile)
 {
   register struct symtab *symtab;
   register struct blockvector *blockvector;
@@ -194,8 +188,7 @@
    The ultimate result is a new symtab (or, FIXME, eventually a psymtab).  */
 
 static void
-dst_symfile_init (objfile)
-     struct objfile *objfile;
+dst_symfile_init (struct objfile *objfile)
 {
   asection *section;
   bfd *abfd = objfile->obfd;
@@ -210,10 +203,7 @@
 
 /* ARGSUSED */
 static void
-find_dst_sections (abfd, asect, vpinfo)
-     bfd *abfd;
-     sec_ptr asect;
-     PTR vpinfo;
+find_dst_sections (bfd *abfd, sec_ptr asect, PTR vpinfo)
 {
   int size, count;
   long base;
@@ -252,9 +242,7 @@
 
 /* ARGSUSED */
 static void
-dst_symfile_read (objfile, mainline)
-     struct objfile *objfile;
-     int mainline;
+dst_symfile_read (struct objfile *objfile, int mainline)
 {
   bfd *abfd = objfile->obfd;
   char *name = bfd_get_filename (abfd);
@@ -301,8 +289,7 @@
 }
 
 static void
-dst_new_init (ignore)
-     struct objfile *ignore;
+dst_new_init (struct objfile *ignore)
 {
   /* Nothin' to do */
 }
@@ -313,8 +300,7 @@
    objfile struct from the global list of known objfiles. */
 
 static void
-dst_symfile_finish (objfile)
-     struct objfile *objfile;
+dst_symfile_finish (struct objfile *objfile)
 {
   /* Nothing to do */
 }
@@ -327,9 +313,7 @@
  * this is what was really intended.
  */
 static int
-get_dst_line (buffer, pc)
-     signed char **buffer;
-     long *pc;
+get_dst_line (signed char **buffer, long *pc)
 {
   static last_pc = 0;
   static long last_line = 0;
@@ -433,18 +417,14 @@
 }
 
 static void
-enter_all_lines (buffer, address)
-     char *buffer;
-     long address;
+enter_all_lines (char *buffer, long address)
 {
   if (buffer)
     while (get_dst_line (&buffer, &address));
 }
 
 static int
-get_dst_entry (buffer, ret_entry)
-     char *buffer;
-     dst_rec_ptr_t *ret_entry;
+get_dst_entry (char *buffer, dst_rec_ptr_t *ret_entry)
 {
   int size;
   dst_rec_ptr_t entry;
@@ -666,10 +646,7 @@
 }
 
 static int
-next_dst_entry (buffer, entry, table)
-     char **buffer;
-     dst_rec_ptr_t *entry;
-     dst_sec *table;
+next_dst_entry (char **buffer, dst_rec_ptr_t *entry, dst_sec *table)
 {
   if (*buffer - table->buffer >= table->size)
     {
@@ -687,8 +664,7 @@
 static dst_rec_ptr_t section_table = NULL;
 
 char *
-get_sec_ref (ref)
-     dst_sect_ref_t *ref;
+get_sec_ref (dst_sect_ref_t *ref)
 {
   dst_sec *section = NULL;
   long offset;
@@ -720,8 +696,7 @@
 }
 
 CORE_ADDR
-dst_sym_addr (ref)
-     dst_sect_ref_t *ref;
+dst_sym_addr (dst_sect_ref_t *ref)
 {
   if (!section_table || !ref->sect_index)
     return 0;
@@ -730,8 +705,7 @@
 }
 
 static struct type *
-create_new_type (objfile)
-     struct objfile *objfile;
+create_new_type (struct objfile *objfile)
 {
   struct type *type;
 
@@ -742,9 +716,7 @@
 }
 
 static struct symbol *
-create_new_symbol (objfile, name)
-     struct objfile *objfile;
-     char *name;
+create_new_symbol (struct objfile *objfile, char *name)
 {
   struct symbol *sym = (struct symbol *)
   obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
@@ -761,10 +733,8 @@
 static struct type *decode_dst_type (struct objfile *, dst_rec_ptr_t);
 
 static struct type *
-decode_type_desc (objfile, type_desc, base)
-     struct objfile *objfile;
-     dst_type_t *type_desc;
-     dst_rec_ptr_t base;
+decode_type_desc (struct objfile *objfile, dst_type_t *type_desc,
+		  dst_rec_ptr_t base)
 {
   struct type *type;
   dst_rec_ptr_t entry;
@@ -862,8 +832,7 @@
 static struct structure_list *struct_list = NULL;
 
 static struct type *
-find_dst_structure (name)
-     char *name;
+find_dst_structure (char *name)
 {
   struct structure_list *element;
 
@@ -875,11 +844,8 @@
 
 
 static struct type *
-decode_dst_structure (objfile, entry, code, version)
-     struct objfile *objfile;
-     dst_rec_ptr_t entry;
-     int code;
-     int version;
+decode_dst_structure (struct objfile *objfile, dst_rec_ptr_t entry, int code,
+		      int version)
 {
   struct type *type, *child_type;
   char *struct_name;
@@ -895,13 +861,13 @@
   type = find_dst_structure (name);
   if (type)
     {
-      free ((PTR) name);
+      xfree (name);
       return type;
     }
   type = create_new_type (objfile);
   TYPE_NAME (type) = obstack_copy0 (&objfile->symbol_obstack,
 				    name, strlen (name));
-  free ((PTR) name);
+  xfree (name);
   TYPE_CODE (type) = code;
   TYPE_LENGTH (type) = DST_record (entry).size;
   TYPE_NFIELDS (type) = DST_record (entry).nfields;
@@ -981,9 +947,7 @@
 }
 
 static struct type *
-decode_dst_type (objfile, entry)
-     struct objfile *objfile;
-     dst_rec_ptr_t entry;
+decode_dst_type (struct objfile *objfile, dst_rec_ptr_t entry)
 {
   struct type *child_type, *type, *range_type, *index_type;
 
@@ -1047,9 +1011,7 @@
 static int total_globals = 0;
 
 static void
-decode_dst_locstring (locstr, sym)
-     char *locstr;
-     struct symbol *sym;
+decode_dst_locstring (char *locstr, struct symbol *sym)
 {
   dst_loc_entry_t *entry, *next_entry;
   CORE_ADDR temp;
@@ -1166,11 +1128,8 @@
 }
 
 static struct symbol_list *
-process_dst_symbols (objfile, entry, name, nsyms_ret)
-     struct objfile *objfile;
-     dst_rec_ptr_t entry;
-     char *name;
-     int *nsyms_ret;
+process_dst_symbols (struct objfile *objfile, dst_rec_ptr_t entry, char *name,
+		     int *nsyms_ret)
 {
   struct symbol_list *list = NULL, *element;
   struct symbol *sym;
@@ -1308,11 +1267,8 @@
 
 
 static struct symbol *
-process_dst_function (objfile, entry, name, address)
-     struct objfile *objfile;
-     dst_rec_ptr_t entry;
-     char *name;
-     CORE_ADDR address;
+process_dst_function (struct objfile *objfile, dst_rec_ptr_t entry, char *name,
+		      CORE_ADDR address)
 {
   struct symbol *sym;
   struct type *type, *ftype;
@@ -1369,9 +1325,7 @@
 }
 
 static struct block *
-process_dst_block (objfile, entry)
-     struct objfile *objfile;
-     dst_rec_ptr_t entry;
+process_dst_block (struct objfile *objfile, dst_rec_ptr_t entry)
 {
   struct block *block;
   struct symbol *function = NULL;
@@ -1447,7 +1401,7 @@
 
       block->sym[symnum] = symlist->symbol;
 
-      free ((PTR) symlist);
+      xfree (symlist);
       symlist = nextsym;
       symnum++;
     }
@@ -1498,8 +1452,7 @@
 
 
 static void
-read_dst_symtab (objfile)
-     struct objfile *objfile;
+read_dst_symtab (struct objfile *objfile)
 {
   char *buffer;
   dst_rec_ptr_t entry, file_table, root_block;
@@ -1544,7 +1497,7 @@
 	      global_block->sym[symnum] =
 		dst_global_symbols->symbol;
 
-	      free ((PTR) dst_global_symbols);
+	      xfree (dst_global_symbols);
 	      dst_global_symbols = nextsym;
 	    }
 	  dst_global_symbols = NULL;
@@ -1581,7 +1534,7 @@
     {
       element = struct_list;
       struct_list = element->next;
-      free ((PTR) element);
+      xfree (element);
     }
 }
 
@@ -1595,9 +1548,7 @@
    external (unswapped) format in memory; we'll swap them as we enter
    them into GDB's data structures.  */
 static int
-init_one_section (chan, secinfo)
-     int chan;
-     dst_sec *secinfo;
+init_one_section (int chan, dst_sec *secinfo)
 {
   if (secinfo->size == 0
       || lseek (chan, secinfo->position, 0) == -1
@@ -1609,8 +1560,7 @@
 }
 
 static int
-init_dst_sections (chan)
-     int chan;
+init_dst_sections (int chan)
 {
 
   if (!init_one_section (chan, &blocks_info) ||
@@ -1627,9 +1577,7 @@
 {0};
 
 void
-dst_symfile_offsets (objfile, addr)
-     struct objfile *objfile;
-     struct section_addr_info *addrs;
+dst_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs)
 {
   objfile->num_sections = 1;
   objfile->section_offsets = &dst_symfile_faker;
@@ -1652,7 +1600,7 @@
 };
 
 void
-_initialize_dstread ()
+_initialize_dstread (void)
 {
   add_symtab_fns (&dst_sym_fns);
 }
diff --git a/gdb/dve3900-rom.c b/gdb/dve3900-rom.c
index 4cd035f..5c6755a 100644
--- a/gdb/dve3900-rom.c
+++ b/gdb/dve3900-rom.c
@@ -373,11 +373,7 @@
    the hex value before passing it to monitor_supply_register.  */
 
 static void
-r3900_supply_register (regname, regnamelen, val, vallen)
-     char *regname;
-     int regnamelen;
-     char *val;
-     int vallen;
+r3900_supply_register (char *regname, int regnamelen, char *val, int vallen)
 {
   int regno = -1;
   int i;
@@ -416,7 +412,7 @@
    you modify it.  */
 
 static void
-fetch_bad_vaddr ()
+fetch_bad_vaddr (void)
 {
   char buf[20];
 
@@ -431,8 +427,7 @@
    combined binary value.  */
 
 static unsigned long
-fetch_fields (bf)
-     struct bit_field *bf;
+fetch_fields (struct bit_field *bf)
 {
   char buf[20];
   unsigned long val = 0;
@@ -456,9 +451,7 @@
 
 
 static void
-fetch_bitmapped_register (regno, bf)
-     int regno;
-     struct bit_field *bf;
+fetch_bitmapped_register (int regno, struct bit_field *bf)
 {
   unsigned long val;
   unsigned char regbuf[MAX_REGISTER_RAW_SIZE];
@@ -482,8 +475,7 @@
    a very unusual fashion by the monitor, and must be handled specially.  */
 
 static void
-r3900_fetch_registers (regno)
-     int regno;
+r3900_fetch_registers (int regno)
 {
   switch (regno)
     {
@@ -505,9 +497,7 @@
 /* Write the new value of the bitmapped register to the monitor.  */
 
 static void
-store_bitmapped_register (regno, bf)
-     int regno;
-     struct bit_field *bf;
+store_bitmapped_register (int regno, struct bit_field *bf)
 {
   unsigned long oldval, newval;
 
@@ -537,8 +527,7 @@
 
 
 static void
-r3900_store_registers (regno)
-     int regno;
+r3900_store_registers (int regno)
 {
   switch (regno)
     {
@@ -557,9 +546,7 @@
 /* Write a 4-byte integer to the buffer in big-endian order.  */
 
 static void
-write_long (buf, n)
-     char *buf;
-     long n;
+write_long (char *buf, long n)
 {
   buf[0] = (n >> 24) & 0xff;
   buf[1] = (n >> 16) & 0xff;
@@ -571,9 +558,7 @@
 /* Write a 4-byte integer to the buffer in little-endian order.  */
 
 static void
-write_long_le (buf, n)
-     char *buf;
-     long n;
+write_long_le (char *buf, long n)
 {
   buf[0] = n & 0xff;
   buf[1] = (n >> 8) & 0xff;
@@ -587,8 +572,7 @@
    character in hexadecimal; otherwise, print it in ASCII.  */
 
 static int
-debug_readchar (hex)
-     int hex;
+debug_readchar (int hex)
 {
   char buf[10];
   int c = monitor_readchar ();
@@ -614,9 +598,7 @@
    print the sent buffer in hex.  */
 
 static void
-debug_write (buf, buflen)
-     unsigned char *buf;
-     int buflen;
+debug_write (unsigned char *buf, int buflen)
 {
   char s[10];
 
@@ -649,7 +631,7 @@
  */
 
 static void
-ignore_packet ()
+ignore_packet (void)
 {
   int c;
   int len;
@@ -688,10 +670,7 @@
  */
 
 static void
-send_packet (type, buf, buflen, seq)
-     char type;
-     unsigned char *buf;
-     int buflen, seq;
+send_packet (char type, unsigned char *buf, int buflen, int seq)
 {
   unsigned char hdr[4];
   int len = buflen;
@@ -764,9 +743,7 @@
  */
 
 static void
-process_read_request (buf, buflen)
-     unsigned char *buf;
-     int buflen;
+process_read_request (unsigned char *buf, int buflen)
 {
   unsigned char len[4];
   int i, chunk;
@@ -802,10 +779,7 @@
 /* Count loadable sections (helper function for r3900_load).  */
 
 static void
-count_section (abfd, s, section_count)
-     bfd *abfd;
-     asection *s;
-     unsigned int *section_count;
+count_section (bfd *abfd, asection *s, unsigned int *section_count)
 {
   if (s->flags & SEC_LOAD && bfd_section_size (abfd, s) != 0)
     (*section_count)++;
@@ -827,10 +801,7 @@
  */
 
 static void
-load_section (abfd, s, data_count)
-     bfd *abfd;
-     asection *s;
-     unsigned int *data_count;
+load_section (bfd *abfd, asection *s, unsigned int *data_count)
 {
   if (s->flags & SEC_LOAD)
     {
@@ -862,7 +833,7 @@
       buffer = (unsigned char *) xmalloc (section_size);
       bfd_get_section_contents (abfd, s, buffer, 0, section_size);
       process_read_request (buffer, section_size);
-      free (buffer);
+      xfree (buffer);
     }
 }
 
@@ -886,9 +857,7 @@
  */
 
 static void
-r3900_load (filename, from_tty)
-     char *filename;
-     int from_tty;
+r3900_load (char *filename, int from_tty)
 {
   bfd *abfd;
   unsigned int data_count = 0;
@@ -990,9 +959,7 @@
 static struct monitor_ops r3900_cmds;
 
 static void
-r3900_open (args, from_tty)
-     char *args;
-     int from_tty;
+r3900_open (char *args, int from_tty)
 {
   char buf[64];
   int i;
@@ -1023,7 +990,7 @@
 }
 
 void
-_initialize_r3900_rom ()
+_initialize_r3900_rom (void)
 {
   r3900_cmds.flags = MO_NO_ECHO_ON_OPEN |
     MO_ADDR_BITS_REMOVE |
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index b6a340f..7f75672 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -43,6 +43,11 @@
 #include "gdb_string.h"
 #include <sys/types.h>
 
+#ifndef DWARF2_REG_TO_REGNUM
+#define DWARF2_REG_TO_REGNUM(REG) (REG)
+#endif
+
+#if 0
 /* .debug_info header for a compilation unit
    Because of alignment constraints, this structure has padding and cannot
    be mapped directly onto the beginning of the .debug_info section.  */
@@ -57,6 +62,7 @@
   }
 _COMP_UNIT_HEADER;
 #define _ACTUAL_COMP_UNIT_HEADER_SIZE 11
+#endif
 
 /* .debug_pubnames header
    Because of alignment constraints, this structure has padding and cannot
@@ -146,13 +152,18 @@
 
 /* local data types */
 
-/* The data in a compilation unit header looks like this.  */
+/* The data in a compilation unit header, after target2host
+   translation, looks like this.  */
 struct comp_unit_head
   {
-    unsigned int length;
+    unsigned long length;
     short version;
     unsigned int abbrev_offset;
     unsigned char addr_size;
+    unsigned char signed_addr_p;
+    unsigned int offset_size;	/* size of file offsets; either 4 or 8 */
+    unsigned int initial_length_size; /* size of the length field; either
+                                         4 or 12 */
   };
 
 /* The data in the .debug_line statement prologue looks like this.  */
@@ -228,8 +239,8 @@
       {
 	char *str;
 	struct dwarf_block *blk;
-	unsigned int unsnd;
-	int snd;
+	unsigned long unsnd;
+	long int snd;
 	CORE_ADDR addr;
       }
     u;
@@ -268,11 +279,6 @@
 
 static struct die_info *die_ref_table[REF_HASH_SIZE];
 
-#ifndef TYPE_HASH_SIZE
-#define TYPE_HASH_SIZE 4096
-#endif
-static struct type *dwarf2_cached_types[TYPE_HASH_SIZE];
-
 /* Obstack for allocating temporary storage used during symbol reading.  */
 static struct obstack dwarf2_tmp_obstack;
 
@@ -545,12 +551,6 @@
   "unsupported const value attribute form: '%s'", 0, 0
 };
 
-/* Remember the addr_size read from the dwarf.
-   If a target expects to link compilation units with differing address
-   sizes, gdb needs to be sure that the appropriate size is here for
-   whatever scope is currently getting read. */
-static int address_size;
-
 /* Externals references.  */
 extern int info_verbose;	/* From main.c; nonzero => verbose */
 
@@ -565,9 +565,11 @@
 static void dwarf2_build_psymtabs_hard (struct objfile *, int);
 
 static char *scan_partial_symbols (char *, struct objfile *,
-				   CORE_ADDR *, CORE_ADDR *);
+				   CORE_ADDR *, CORE_ADDR *,
+				   const struct comp_unit_head *);
 
-static void add_partial_symbol (struct partial_die_info *, struct objfile *);
+static void add_partial_symbol (struct partial_die_info *, struct objfile *,
+				const struct comp_unit_head *);
 
 static void dwarf2_psymtab_to_symtab (struct partial_symtab *);
 
@@ -582,12 +584,14 @@
 static struct abbrev_info *dwarf2_lookup_abbrev (unsigned int);
 
 static char *read_partial_die (struct partial_die_info *,
-			       bfd *, char *, int *);
+			       bfd *, char *, int *,
+			       const struct comp_unit_head *);
 
-static char *read_full_die (struct die_info **, bfd *, char *);
+static char *read_full_die (struct die_info **, bfd *, char *,
+			    const struct comp_unit_head *);
 
 static char *read_attribute (struct attribute *, struct attr_abbrev *,
-			     bfd *, char *);
+			     bfd *, char *, const struct comp_unit_head *);
 
 static unsigned int read_1_byte (bfd *, char *);
 
@@ -597,17 +601,24 @@
 
 static unsigned int read_4_bytes (bfd *, char *);
 
-static unsigned int read_8_bytes (bfd *, char *);
+static unsigned long read_8_bytes (bfd *, char *);
 
-static CORE_ADDR read_address (bfd *, char *);
+static CORE_ADDR read_address (bfd *, char *ptr, const struct comp_unit_head *,
+			       int *bytes_read);
+
+static LONGEST read_initial_length (bfd *, char *,
+                                    struct comp_unit_head *, int *bytes_read);
+
+static LONGEST read_offset (bfd *, char *, const struct comp_unit_head *,
+                            int *bytes_read);
 
 static char *read_n_bytes (bfd *, char *, unsigned int);
 
 static char *read_string (bfd *, char *, unsigned int *);
 
-static unsigned int read_unsigned_leb128 (bfd *, char *, unsigned int *);
+static unsigned long read_unsigned_leb128 (bfd *, char *, unsigned int *);
 
-static int read_signed_leb128 (bfd *, char *, unsigned int *);
+static long read_signed_leb128 (bfd *, char *, unsigned int *);
 
 static void set_cu_language (unsigned int);
 
@@ -615,91 +626,113 @@
 
 static int die_is_declaration (struct die_info *);
 
-static void dwarf_decode_lines (unsigned int, char *, bfd *);
+static void dwarf_decode_lines (unsigned int, char *, bfd *,
+				const struct comp_unit_head *);
 
 static void dwarf2_start_subfile (char *, char *);
 
 static struct symbol *new_symbol (struct die_info *, struct type *,
-				  struct objfile *);
+				  struct objfile *, const struct comp_unit_head *);
 
 static void dwarf2_const_value (struct attribute *, struct symbol *,
-				struct objfile *);
+				struct objfile *, const struct comp_unit_head *);
 
 static void dwarf2_const_value_data (struct attribute *attr,
 				     struct symbol *sym,
 				     int bits);
 
-static struct type *die_type (struct die_info *, struct objfile *);
+static struct type *die_type (struct die_info *, struct objfile *,
+			      const struct comp_unit_head *);
 
-static struct type *die_containing_type (struct die_info *, struct objfile *);
+static struct type *die_containing_type (struct die_info *, struct objfile *,
+					 const struct comp_unit_head *);
 
 #if 0
 static struct type *type_at_offset (unsigned int, struct objfile *);
 #endif
 
-static struct type *tag_type_to_type (struct die_info *, struct objfile *);
+static struct type *tag_type_to_type (struct die_info *, struct objfile *,
+				      const struct comp_unit_head *);
 
-static void read_type_die (struct die_info *, struct objfile *);
+static void read_type_die (struct die_info *, struct objfile *,
+			   const struct comp_unit_head *);
 
-static void read_typedef (struct die_info *, struct objfile *);
+static void read_typedef (struct die_info *, struct objfile *,
+			  const struct comp_unit_head *);
 
 static void read_base_type (struct die_info *, struct objfile *);
 
-static void read_file_scope (struct die_info *, struct objfile *);
+static void read_file_scope (struct die_info *, struct objfile *,
+			     const struct comp_unit_head *);
 
-static void read_func_scope (struct die_info *, struct objfile *);
+static void read_func_scope (struct die_info *, struct objfile *,
+			     const struct comp_unit_head *);
 
-static void read_lexical_block_scope (struct die_info *, struct objfile *);
+static void read_lexical_block_scope (struct die_info *, struct objfile *,
+				      const struct comp_unit_head *);
 
 static int dwarf2_get_pc_bounds (struct die_info *,
 				 CORE_ADDR *, CORE_ADDR *, struct objfile *);
 
 static void dwarf2_add_field (struct field_info *, struct die_info *,
-			      struct objfile *);
+			      struct objfile *, const struct comp_unit_head *);
 
 static void dwarf2_attach_fields_to_type (struct field_info *,
 					  struct type *, struct objfile *);
 
 static void dwarf2_add_member_fn (struct field_info *,
 				  struct die_info *, struct type *,
-				  struct objfile *objfile);
+				  struct objfile *objfile,
+				  const struct comp_unit_head *);
 
 static void dwarf2_attach_fn_fields_to_type (struct field_info *,
 					     struct type *, struct objfile *);
 
-static void read_structure_scope (struct die_info *, struct objfile *);
+static void read_structure_scope (struct die_info *, struct objfile *,
+				  const struct comp_unit_head *);
 
-static void read_common_block (struct die_info *, struct objfile *);
+static void read_common_block (struct die_info *, struct objfile *,
+			       const struct comp_unit_head *);
 
-static void read_enumeration (struct die_info *, struct objfile *);
+static void read_enumeration (struct die_info *, struct objfile *,
+			      const struct comp_unit_head *);
 
 static struct type *dwarf_base_type (int, int, struct objfile *);
 
-static CORE_ADDR decode_locdesc (struct dwarf_block *, struct objfile *);
+static CORE_ADDR decode_locdesc (struct dwarf_block *, struct objfile *,
+				 const struct comp_unit_head *);
 
-static void read_array_type (struct die_info *, struct objfile *);
+static void read_array_type (struct die_info *, struct objfile *,
+			     const struct comp_unit_head *);
 
-static void read_tag_pointer_type (struct die_info *, struct objfile *);
+static void read_tag_pointer_type (struct die_info *, struct objfile *,
+				   const struct comp_unit_head *);
 
-static void read_tag_ptr_to_member_type (struct die_info *, struct objfile *);
+static void read_tag_ptr_to_member_type (struct die_info *, struct objfile *,
+					 const struct comp_unit_head *);
 
-static void read_tag_reference_type (struct die_info *, struct objfile *);
+static void read_tag_reference_type (struct die_info *, struct objfile *,
+				     const struct comp_unit_head *);
 
-static void read_tag_const_type (struct die_info *, struct objfile *);
+static void read_tag_const_type (struct die_info *, struct objfile *,
+				 const struct comp_unit_head *);
 
-static void read_tag_volatile_type (struct die_info *, struct objfile *);
+static void read_tag_volatile_type (struct die_info *, struct objfile *,
+				    const struct comp_unit_head *);
 
 static void read_tag_string_type (struct die_info *, struct objfile *);
 
-static void read_subroutine_type (struct die_info *, struct objfile *);
+static void read_subroutine_type (struct die_info *, struct objfile *,
+				  const struct comp_unit_head *);
 
-struct die_info *read_comp_unit (char *, bfd *);
+struct die_info *read_comp_unit (char *, bfd *, const struct comp_unit_head *);
 
 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 objfile *);
+static void process_die (struct die_info *, struct objfile *,
+			 const struct comp_unit_head *);
 
 static char *dwarf2_linkage_name (struct die_info *);
 
@@ -729,7 +762,7 @@
 
 void store_in_ref_table (unsigned int, struct die_info *);
 
-static void dwarf2_empty_die_ref_table (void);
+static void dwarf2_empty_hash_tables (void);
 
 static unsigned int dwarf2_get_ref_die_offset (struct attribute *);
 
@@ -751,8 +784,7 @@
    information and return true if we have enough to do something.  */
 
 int
-dwarf2_has_info (abfd)
-     bfd *abfd;
+dwarf2_has_info (bfd *abfd)
 {
   dwarf_info_offset = dwarf_abbrev_offset = dwarf_line_offset = 0;
   bfd_map_over_sections (abfd, dwarf2_locate_sections, NULL);
@@ -771,10 +803,7 @@
    in.  */
 
 static void
-dwarf2_locate_sections (ignore_abfd, sectp, ignore_ptr)
-     bfd *ignore_abfd;
-     asection *sectp;
-     PTR ignore_ptr;
+dwarf2_locate_sections (bfd *ignore_abfd, asection *sectp, PTR ignore_ptr)
 {
   if (STREQ (sectp->name, INFO_SECTION))
     {
@@ -821,9 +850,7 @@
 /* Build a partial symbol table.  */
 
 void
-dwarf2_build_psymtabs (objfile, mainline)
-     struct objfile *objfile;
-     int mainline;
+dwarf2_build_psymtabs (struct objfile *objfile, int mainline)
 {
 
   /* We definitely need the .debug_info and .debug_abbrev sections */
@@ -866,9 +893,7 @@
    .debug_pubnames and .debug_aranges sections.  */
 
 static void
-dwarf2_build_psymtabs_easy (objfile, mainline)
-     struct objfile *objfile;
-     int mainline;
+dwarf2_build_psymtabs_easy (struct objfile *objfile, int mainline)
 {
   bfd *abfd = objfile->obfd;
   char *aranges_buffer, *pubnames_buffer;
@@ -881,8 +906,12 @@
   pubnames_ptr = pubnames_buffer;
   while ((pubnames_ptr - pubnames_buffer) < dwarf_pubnames_size)
     {
-      entry_length = read_4_bytes (abfd, pubnames_ptr);
-      pubnames_ptr += 4;
+      struct comp_unit_head cu_header;
+      int bytes_read;
+
+      entry_length = read_initial_length (abfd, pubnames_ptr, &cu_header,
+                                         &bytes_read);
+      pubnames_ptr += bytes_read;
       version = read_1_byte (abfd, pubnames_ptr);
       pubnames_ptr += 1;
       info_offset = read_4_bytes (abfd, pubnames_ptr);
@@ -898,20 +927,43 @@
 }
 #endif
 
+/* Read in the comp unit header information from the debug_info at
+   info_ptr. */
+
+static char *
+read_comp_unit_head (struct comp_unit_head *cu_header,
+		     char *info_ptr, bfd *abfd)
+{
+  int signed_addr;
+  int bytes_read;
+  cu_header->length = read_initial_length (abfd, info_ptr, cu_header,
+                                           &bytes_read);
+  info_ptr += bytes_read;
+  cu_header->version = read_2_bytes (abfd, info_ptr);
+  info_ptr += 2;
+  cu_header->abbrev_offset = read_offset (abfd, info_ptr, cu_header,
+                                          &bytes_read);
+  info_ptr += bytes_read;
+  cu_header->addr_size = read_1_byte (abfd, info_ptr);
+  info_ptr += 1;
+  signed_addr = bfd_get_sign_extend_vma (abfd);
+  if (signed_addr < 0)
+    internal_error ("read_comp_unit_head: dwarf from non elf file");
+  cu_header->signed_addr_p = signed_addr;
+  return info_ptr;
+}
+
 /* Build the partial symbol table by doing a quick pass through the
    .debug_info and .debug_abbrev sections.  */
 
 static void
-dwarf2_build_psymtabs_hard (objfile, mainline)
-     struct objfile *objfile;
-     int mainline;
+dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline)
 {
   /* Instead of reading this into a big buffer, we should probably use
      mmap()  on architectures that support it. (FIXME) */
   bfd *abfd = objfile->obfd;
   char *info_ptr, *abbrev_ptr;
   char *beg_of_comp_unit;
-  struct comp_unit_head cu_header;
   struct partial_die_info comp_unit_die;
   struct partial_symtab *pst;
   struct cleanup *back_to;
@@ -927,16 +979,9 @@
   while ((unsigned int) (info_ptr - dwarf_info_buffer)
 	 + ((info_ptr - dwarf_info_buffer) % 4) < dwarf_info_size)
     {
+      struct comp_unit_head cu_header;
       beg_of_comp_unit = info_ptr;
-      cu_header.length = read_4_bytes (abfd, info_ptr);
-      info_ptr += 4;
-      cu_header.version = read_2_bytes (abfd, info_ptr);
-      info_ptr += 2;
-      cu_header.abbrev_offset = read_4_bytes (abfd, info_ptr);
-      info_ptr += 4;
-      cu_header.addr_size = read_1_byte (abfd, info_ptr);
-      info_ptr += 1;
-      address_size = cu_header.addr_size;
+      info_ptr = read_comp_unit_head (&cu_header, info_ptr, abfd);
 
       if (cu_header.version != 2)
 	{
@@ -950,7 +995,7 @@
 		 (long) (beg_of_comp_unit - dwarf_info_buffer));
 	  return;
 	}
-      if (beg_of_comp_unit + cu_header.length + 4
+      if (beg_of_comp_unit + cu_header.length + cu_header.initial_length_size
 	  > dwarf_info_buffer + dwarf_info_size)
 	{
 	  error ("Dwarf Error: bad length (0x%lx) in compilation unit header (offset 0x%lx + 0).",
@@ -963,8 +1008,8 @@
       make_cleanup (dwarf2_empty_abbrev_table, NULL);
 
       /* Read the compilation unit die */
-      info_ptr = read_partial_die (&comp_unit_die, abfd,
-				   info_ptr, &comp_unit_has_pc_info);
+      info_ptr = read_partial_die (&comp_unit_die, abfd, info_ptr,
+				   &comp_unit_has_pc_info, &cu_header);
 
       /* Set the language we're debugging */
       set_cu_language (comp_unit_die.language);
@@ -984,7 +1029,7 @@
       DWARF_ABBREV_BUFFER (pst) = dwarf_abbrev_buffer;
       DWARF_ABBREV_SIZE (pst) = dwarf_abbrev_size;
       DWARF_LINE_BUFFER (pst) = dwarf_line_buffer;
-      baseaddr = ANOFFSET (objfile->section_offsets, 0);
+      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;
@@ -994,7 +1039,8 @@
          If not, there's no more debug_info for this comp unit. */
       if (comp_unit_die.has_children)
 	{
-	  info_ptr = scan_partial_symbols (info_ptr, objfile, &lowpc, &highpc);
+	  info_ptr = scan_partial_symbols (info_ptr, objfile, &lowpc, &highpc,
+					   &cu_header);
 
 	  /* If the compilation unit didn't have an explicit address range,
 	     then use the information extracted from its child dies.  */
@@ -1018,7 +1064,8 @@
          also happen.) This happens in VxWorks.  */
       free_named_symtabs (pst->filename);
 
-      info_ptr = beg_of_comp_unit + cu_header.length + 4;
+      info_ptr = beg_of_comp_unit + cu_header.length 
+                                  + cu_header.initial_length_size;
     }
   do_cleanups (back_to);
 }
@@ -1026,11 +1073,9 @@
 /* Read in all interesting dies to the end of the compilation unit.  */
 
 static char *
-scan_partial_symbols (info_ptr, objfile, lowpc, highpc)
-     char *info_ptr;
-     struct objfile *objfile;
-     CORE_ADDR *lowpc;
-     CORE_ADDR *highpc;
+scan_partial_symbols (char *info_ptr, struct objfile *objfile,
+		      CORE_ADDR *lowpc, CORE_ADDR *highpc,
+		      const struct comp_unit_head *cu_header)
 {
   bfd *abfd = objfile->obfd;
   struct partial_die_info pdi;
@@ -1049,7 +1094,8 @@
 
   while (nesting_level)
     {
-      info_ptr = read_partial_die (&pdi, abfd, info_ptr, &has_pc_info);
+      info_ptr = read_partial_die (&pdi, abfd, info_ptr,
+				   &has_pc_info, cu_header);
 
       if (pdi.name)
 	{
@@ -1069,7 +1115,7 @@
 		  if ((pdi.is_external || nesting_level == 1)
 		      && !pdi.is_declaration)
 		    {
-		      add_partial_symbol (&pdi, objfile);
+		      add_partial_symbol (&pdi, objfile, cu_header);
 		    }
 		}
 	      break;
@@ -1082,20 +1128,20 @@
 	      if ((pdi.is_external || nesting_level == 1)
 		  && !pdi.is_declaration)
 		{
-		  add_partial_symbol (&pdi, objfile);
+		  add_partial_symbol (&pdi, objfile, cu_header);
 		}
 	      break;
 	    case DW_TAG_enumerator:
 	      /* File scope enumerators are added to the partial symbol
 	         table.  */
 	      if (nesting_level == 2)
-		add_partial_symbol (&pdi, objfile);
+		add_partial_symbol (&pdi, objfile, cu_header);
 	      break;
 	    case DW_TAG_base_type:
 	      /* File scope base type definitions are added to the partial
 	         symbol table.  */
 	      if (nesting_level == 1)
-		add_partial_symbol (&pdi, objfile);
+		add_partial_symbol (&pdi, objfile, cu_header);
 	      break;
 	    default:
 	      break;
@@ -1130,9 +1176,8 @@
 }
 
 static void
-add_partial_symbol (pdi, objfile)
-     struct partial_die_info *pdi;
-     struct objfile *objfile;
+add_partial_symbol (struct partial_die_info *pdi, struct objfile *objfile,
+		    const struct comp_unit_head *cu_header)
 {
   CORE_ADDR addr = 0;
 
@@ -1175,7 +1220,7 @@
 	     table building.  */
 
 	  if (pdi->locdesc)
-	    addr = decode_locdesc (pdi->locdesc, objfile);
+	    addr = decode_locdesc (pdi->locdesc, objfile, cu_header);
 	  if (pdi->locdesc || pdi->has_type)
 	    add_psymbol_to_list (pdi->name, strlen (pdi->name),
 				 VAR_NAMESPACE, LOC_STATIC,
@@ -1187,7 +1232,7 @@
 	  /* Static Variable. Skip symbols without location descriptors.  */
 	  if (pdi->locdesc == NULL)
 	    return;
-	  addr = decode_locdesc (pdi->locdesc, objfile);
+	  addr = decode_locdesc (pdi->locdesc, objfile, cu_header);
 	  /*prim_record_minimal_symbol (pdi->name, addr + baseaddr,
 	     mst_file_data, objfile); */
 	  add_psymbol_to_list (pdi->name, strlen (pdi->name),
@@ -1239,8 +1284,7 @@
 /* Expand this partial symbol table into a full symbol table.  */
 
 static void
-dwarf2_psymtab_to_symtab (pst)
-     struct partial_symtab *pst;
+dwarf2_psymtab_to_symtab (struct partial_symtab *pst)
 {
   /* FIXME: This is barely more than a stub.  */
   if (pst != NULL)
@@ -1267,8 +1311,7 @@
 }
 
 static void
-psymtab_to_symtab_1 (pst)
-     struct partial_symtab *pst;
+psymtab_to_symtab_1 (struct partial_symtab *pst)
 {
   struct objfile *objfile = pst->objfile;
   bfd *abfd = objfile->obfd;
@@ -1287,7 +1330,7 @@
   dwarf_abbrev_buffer = DWARF_ABBREV_BUFFER (pst);
   dwarf_abbrev_size = DWARF_ABBREV_SIZE (pst);
   dwarf_line_buffer = DWARF_LINE_BUFFER (pst);
-  baseaddr = ANOFFSET (pst->section_offsets, 0);
+  baseaddr = ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (objfile));
   cu_header_offset = offset;
   info_ptr = dwarf_info_buffer + offset;
 
@@ -1298,25 +1341,18 @@
   make_cleanup (really_free_pendings, NULL);
 
   /* read in the comp_unit header  */
-  cu_header.length = read_4_bytes (abfd, info_ptr);
-  info_ptr += 4;
-  cu_header.version = read_2_bytes (abfd, info_ptr);
-  info_ptr += 2;
-  cu_header.abbrev_offset = read_4_bytes (abfd, info_ptr);
-  info_ptr += 4;
-  cu_header.addr_size = read_1_byte (abfd, info_ptr);
-  info_ptr += 1;
+  info_ptr = read_comp_unit_head (&cu_header, info_ptr, abfd);
 
   /* Read the abbrevs for this compilation unit  */
   dwarf2_read_abbrevs (abfd, cu_header.abbrev_offset);
   make_cleanup (dwarf2_empty_abbrev_table, NULL);
 
-  dies = read_comp_unit (info_ptr, abfd);
+  dies = read_comp_unit (info_ptr, abfd, &cu_header);
 
   make_cleanup_free_die_list (dies);
 
   /* Do line number decoding in read_file_scope () */
-  process_die (dies, objfile);
+  process_die (dies, objfile, &cu_header);
 
   if (!dwarf2_get_pc_bounds (dies, &lowpc, &highpc, objfile))
     {
@@ -1342,7 +1378,7 @@
 	    }
 	}
     }
-  symtab = end_symtab (highpc + baseaddr, objfile, 0);
+  symtab = end_symtab (highpc + baseaddr, objfile, SECT_OFF_TEXT (objfile));
 
   /* Set symtab language to language from DW_AT_language.
      If the compilation is from a C file generated by language preprocessors,
@@ -1362,20 +1398,19 @@
 /* Process a die and its children.  */
 
 static void
-process_die (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+process_die (struct die_info *die, struct objfile *objfile,
+	     const struct comp_unit_head *cu_header)
 {
   switch (die->tag)
     {
     case DW_TAG_padding:
       break;
     case DW_TAG_compile_unit:
-      read_file_scope (die, objfile);
+      read_file_scope (die, objfile, cu_header);
       break;
     case DW_TAG_subprogram:
-      read_subroutine_type (die, objfile);
-      read_func_scope (die, objfile);
+      read_subroutine_type (die, objfile, cu_header);
+      read_func_scope (die, objfile, cu_header);
       break;
     case DW_TAG_inlined_subroutine:
       /* FIXME:  These are ignored for now.
@@ -1383,30 +1418,30 @@
          of a function and make GDB `next' properly over inlined functions.  */
       break;
     case DW_TAG_lexical_block:
-      read_lexical_block_scope (die, objfile);
+      read_lexical_block_scope (die, objfile, cu_header);
       break;
     case DW_TAG_class_type:
     case DW_TAG_structure_type:
     case DW_TAG_union_type:
-      read_structure_scope (die, objfile);
+      read_structure_scope (die, objfile, cu_header);
       break;
     case DW_TAG_enumeration_type:
-      read_enumeration (die, objfile);
+      read_enumeration (die, objfile, cu_header);
       break;
     case DW_TAG_subroutine_type:
-      read_subroutine_type (die, objfile);
+      read_subroutine_type (die, objfile, cu_header);
       break;
     case DW_TAG_array_type:
-      read_array_type (die, objfile);
+      read_array_type (die, objfile, cu_header);
       break;
     case DW_TAG_pointer_type:
-      read_tag_pointer_type (die, objfile);
+      read_tag_pointer_type (die, objfile, cu_header);
       break;
     case DW_TAG_ptr_to_member_type:
-      read_tag_ptr_to_member_type (die, objfile);
+      read_tag_ptr_to_member_type (die, objfile, cu_header);
       break;
     case DW_TAG_reference_type:
-      read_tag_reference_type (die, objfile);
+      read_tag_reference_type (die, objfile, cu_header);
       break;
     case DW_TAG_string_type:
       read_tag_string_type (die, objfile);
@@ -1416,24 +1451,23 @@
       if (dwarf_attr (die, DW_AT_name))
 	{
 	  /* Add a typedef symbol for the base type definition.  */
-	  new_symbol (die, die->type, objfile);
+	  new_symbol (die, die->type, objfile, cu_header);
 	}
       break;
     case DW_TAG_common_block:
-      read_common_block (die, objfile);
+      read_common_block (die, objfile, cu_header);
       break;
     case DW_TAG_common_inclusion:
       break;
     default:
-      new_symbol (die, NULL, objfile);
+      new_symbol (die, NULL, objfile, cu_header);
       break;
     }
 }
 
 static void
-read_file_scope (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_file_scope (struct die_info *die, struct objfile *objfile,
+		 const struct comp_unit_head *cu_header)
 {
   unsigned int line_offset = 0;
   CORE_ADDR lowpc = ((CORE_ADDR) -1);
@@ -1528,7 +1562,7 @@
   if (attr)
     {
       line_offset = DW_UNSND (attr);
-      dwarf_decode_lines (line_offset, comp_dir, abfd);
+      dwarf_decode_lines (line_offset, comp_dir, abfd, cu_header);
     }
 
   /* Process all dies in compilation unit.  */
@@ -1537,16 +1571,15 @@
       child_die = die->next;
       while (child_die && child_die->tag)
 	{
-	  process_die (child_die, objfile);
+	  process_die (child_die, objfile, cu_header);
 	  child_die = sibling_die (child_die);
 	}
     }
 }
 
 static void
-read_func_scope (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_func_scope (struct die_info *die, struct objfile *objfile,
+		 const struct comp_unit_head *cu_header)
 {
   register struct context_stack *new;
   CORE_ADDR lowpc;
@@ -1579,7 +1612,7 @@
   attr = dwarf_attr (die, DW_AT_frame_base);
   if (attr)
     {
-      CORE_ADDR addr = decode_locdesc (DW_BLOCK (attr), objfile);
+      CORE_ADDR addr = decode_locdesc (DW_BLOCK (attr), objfile, cu_header);
       if (isderef)
 	complain (&dwarf2_unsupported_at_frame_base, name);
       else if (isreg)
@@ -1594,7 +1627,7 @@
     }
 
   new = push_context (0, lowpc);
-  new->name = new_symbol (die, die->type, objfile);
+  new->name = new_symbol (die, die->type, objfile, cu_header);
   list_in_scope = &local_symbols;
 
   if (die->has_children)
@@ -1602,7 +1635,7 @@
       child_die = die->next;
       while (child_die && child_die->tag)
 	{
-	  process_die (child_die, objfile);
+	  process_die (child_die, objfile, cu_header);
 	  child_die = sibling_die (child_die);
 	}
     }
@@ -1618,9 +1651,8 @@
    a new scope, process the dies, and then close the scope.  */
 
 static void
-read_lexical_block_scope (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_lexical_block_scope (struct die_info *die, struct objfile *objfile,
+			  const struct comp_unit_head *cu_header)
 {
   register struct context_stack *new;
   CORE_ADDR lowpc, highpc;
@@ -1638,7 +1670,7 @@
       child_die = die->next;
       while (child_die && child_die->tag)
 	{
-	  process_die (child_die, objfile);
+	  process_die (child_die, objfile, cu_header);
 	  child_die = sibling_die (child_die);
 	}
     }
@@ -1656,11 +1688,8 @@
    Return 1 if the attributes are present and valid, otherwise, return 0.  */
 
 static int
-dwarf2_get_pc_bounds (die, lowpc, highpc, objfile)
-     struct die_info *die;
-     CORE_ADDR *lowpc;
-     CORE_ADDR *highpc;
-     struct objfile *objfile;
+dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, CORE_ADDR *highpc,
+		      struct objfile *objfile)
 {
   struct attribute *attr;
   CORE_ADDR low;
@@ -1699,10 +1728,9 @@
 /* Add an aggregate field to the field list.  */
 
 static void
-dwarf2_add_field (fip, die, objfile)
-     struct field_info *fip;
-     struct die_info *die;
-     struct objfile *objfile;
+dwarf2_add_field (struct field_info *fip, struct die_info *die,
+		  struct objfile *objfile,
+		  const struct comp_unit_head *cu_header)
 {
   struct nextfield *new_field;
   struct attribute *attr;
@@ -1711,7 +1739,7 @@
 
   /* Allocate a new field list entry and link it in.  */
   new_field = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-  make_cleanup (free, new_field);
+  make_cleanup (xfree, new_field);
   memset (new_field, 0, sizeof (struct nextfield));
   new_field->next = fip->fields;
   fip->fields = new_field;
@@ -1739,7 +1767,7 @@
   if (die->tag == DW_TAG_member)
     {
       /* Get type of field.  */
-      fp->type = die_type (die, objfile);
+      fp->type = die_type (die, objfile, cu_header);
 
       /* Get bit size of field (zero if none).  */
       attr = dwarf_attr (die, DW_AT_bit_size);
@@ -1757,7 +1785,7 @@
       if (attr)
 	{
 	  FIELD_BITPOS (*fp) =
-	    decode_locdesc (DW_BLOCK (attr), objfile) * bits_per_byte;
+	    decode_locdesc (DW_BLOCK (attr), objfile, cu_header) * bits_per_byte;
 	}
       else
 	FIELD_BITPOS (*fp) = 0;
@@ -1837,7 +1865,7 @@
 
       SET_FIELD_PHYSNAME (*fp, obsavestring (physname, strlen (physname),
 					     &objfile->type_obstack));
-      FIELD_TYPE (*fp) = die_type (die, objfile);
+      FIELD_TYPE (*fp) = die_type (die, objfile, cu_header);
       FIELD_NAME (*fp) = obsavestring (fieldname, strlen (fieldname),
 				       &objfile->type_obstack);
     }
@@ -1846,9 +1874,10 @@
       /* C++ base class field.  */
       attr = dwarf_attr (die, DW_AT_data_member_location);
       if (attr)
-	FIELD_BITPOS (*fp) = decode_locdesc (DW_BLOCK (attr), objfile) * bits_per_byte;
+	FIELD_BITPOS (*fp) = (decode_locdesc (DW_BLOCK (attr), objfile, cu_header)
+			      * bits_per_byte);
       FIELD_BITSIZE (*fp) = 0;
-      FIELD_TYPE (*fp) = die_type (die, objfile);
+      FIELD_TYPE (*fp) = die_type (die, objfile, cu_header);
       FIELD_NAME (*fp) = type_name_no_tag (fp->type);
       fip->nbaseclasses++;
     }
@@ -1857,10 +1886,8 @@
 /* Create the vector of fields, and attach it to the type.  */
 
 static void
-dwarf2_attach_fields_to_type (fip, type, objfile)
-     struct field_info *fip;
-     struct type *type;
-     struct objfile *objfile;
+dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type,
+			      struct objfile *objfile)
 {
   int nfields = fip->nfields;
 
@@ -1946,11 +1973,9 @@
 /* Add a member function to the proper fieldlist.  */
 
 static void
-dwarf2_add_member_fn (fip, die, type, objfile)
-     struct field_info *fip;
-     struct die_info *die;
-     struct type *type;
-     struct objfile *objfile;
+dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
+		      struct type *type, struct objfile *objfile,
+		      const struct comp_unit_head *cu_header)
 {
   struct attribute *attr;
   struct fnfieldlist *flp;
@@ -2001,7 +2026,7 @@
   /* Create a new member function field and chain it to the field list
      entry. */
   new_fnfield = (struct nextfnfield *) xmalloc (sizeof (struct nextfnfield));
-  make_cleanup (free, new_fnfield);
+  make_cleanup (xfree, new_fnfield);
   memset (new_fnfield, 0, sizeof (struct nextfnfield));
   new_fnfield->next = flp->head;
   flp->head = new_fnfield;
@@ -2047,7 +2072,7 @@
 
   /* Get fcontext from DW_AT_containing_type if present.  */
   if (dwarf_attr (die, DW_AT_containing_type) != NULL)
-    fnp->fcontext = die_containing_type (die, objfile);
+    fnp->fcontext = die_containing_type (die, objfile, cu_header);
 
   /* dwarf2 doesn't have stubbed physical names, so the setting of is_const
      and is_volatile is irrelevant, as it is needed by gdb_mangle_name only.  */
@@ -2070,16 +2095,14 @@
   /* Get index in virtual function table if it is a virtual member function.  */
   attr = dwarf_attr (die, DW_AT_vtable_elem_location);
   if (attr)
-    fnp->voffset = decode_locdesc (DW_BLOCK (attr), objfile) + 2;
+    fnp->voffset = decode_locdesc (DW_BLOCK (attr), objfile, cu_header) + 2;
 }
 
 /* Create the vector of member function fields, and attach it to the type.  */
 
 static void
-dwarf2_attach_fn_fields_to_type (fip, type, objfile)
-     struct field_info *fip;
-     struct type *type;
-     struct objfile *objfile;
+dwarf2_attach_fn_fields_to_type (struct field_info *fip, struct type *type,
+				 struct objfile *objfile)
 {
   struct fnfieldlist *flp;
   int total_length = 0;
@@ -2126,9 +2149,8 @@
    suppresses creating a symbol table entry itself).  */
 
 static void
-read_structure_scope (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_structure_scope (struct die_info *die, struct objfile *objfile,
+		      const struct comp_unit_head *cu_header)
 {
   struct type *type;
   struct attribute *attr;
@@ -2188,27 +2210,27 @@
 	{
 	  if (child_die->tag == DW_TAG_member)
 	    {
-	      dwarf2_add_field (&fi, child_die, objfile);
+	      dwarf2_add_field (&fi, child_die, objfile, cu_header);
 	    }
 	  else if (child_die->tag == DW_TAG_variable)
 	    {
 	      /* C++ static member.  */
-	      dwarf2_add_field (&fi, child_die, objfile);
+	      dwarf2_add_field (&fi, child_die, objfile, cu_header);
 	    }
 	  else if (child_die->tag == DW_TAG_subprogram)
 	    {
 	      /* C++ member function. */
-	      process_die (child_die, objfile);
-	      dwarf2_add_member_fn (&fi, child_die, type, objfile);
+	      process_die (child_die, objfile, cu_header);
+	      dwarf2_add_member_fn (&fi, child_die, type, objfile, cu_header);
 	    }
 	  else if (child_die->tag == DW_TAG_inheritance)
 	    {
 	      /* C++ base class field.  */
-	      dwarf2_add_field (&fi, child_die, objfile);
+	      dwarf2_add_field (&fi, child_die, objfile, cu_header);
 	    }
 	  else
 	    {
-	      process_die (child_die, objfile);
+	      process_die (child_die, objfile, cu_header);
 	    }
 	  child_die = sibling_die (child_die);
 	}
@@ -2226,7 +2248,7 @@
 
 	  if (dwarf_attr (die, DW_AT_containing_type) != NULL)
 	    {
-	      struct type *t = die_containing_type (die, objfile);
+	      struct type *t = die_containing_type (die, objfile, cu_header);
 
 	      TYPE_VPTR_BASETYPE (type) = t;
 	      if (type == t)
@@ -2262,7 +2284,7 @@
 	    }
 	}
 
-      new_symbol (die, type, objfile);
+      new_symbol (die, type, objfile, cu_header);
 
       do_cleanups (back_to);
     }
@@ -2285,9 +2307,8 @@
    NOTE: We reverse the order of the element list.  */
 
 static void
-read_enumeration (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_enumeration (struct die_info *die, struct objfile *objfile,
+		  const struct comp_unit_head *cu_header)
 {
   struct die_info *child_die;
   struct type *type;
@@ -2327,14 +2348,14 @@
 	{
 	  if (child_die->tag != DW_TAG_enumerator)
 	    {
-	      process_die (child_die, objfile);
+	      process_die (child_die, objfile, cu_header);
 	    }
 	  else
 	    {
 	      attr = dwarf_attr (child_die, DW_AT_name);
 	      if (attr)
 		{
-		  sym = new_symbol (child_die, type, objfile);
+		  sym = new_symbol (child_die, type, objfile, cu_header);
 		  if (SYMBOL_VALUE (sym) < 0)
 		    unsigned_enum = 0;
 
@@ -2365,13 +2386,13 @@
 	    TYPE_ALLOC (type, sizeof (struct field) * num_fields);
 	  memcpy (TYPE_FIELDS (type), fields,
 		  sizeof (struct field) * num_fields);
-	  free (fields);
+	  xfree (fields);
 	}
       if (unsigned_enum)
 	TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
     }
   die->type = type;
-  new_symbol (die, type, objfile);
+  new_symbol (die, type, objfile, cu_header);
 }
 
 /* Extract all information from a DW_TAG_array_type DIE and put it in
@@ -2379,9 +2400,8 @@
    arrays.  */
 
 static void
-read_array_type (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_array_type (struct die_info *die, struct objfile *objfile,
+		 const struct comp_unit_head *cu_header)
 {
   struct die_info *child_die;
   struct type *type = NULL;
@@ -2397,7 +2417,7 @@
       return;
     }
 
-  element_type = die_type (die, objfile);
+  element_type = die_type (die, objfile, cu_header);
 
   /* Irix 6.2 native cc creates array types without children for
      arrays with unspecified length.  */
@@ -2426,7 +2446,7 @@
 	      low = 1;
 	    }
 
-	  index_type = die_type (child_die, objfile);
+	  index_type = die_type (child_die, objfile, cu_header);
 	  attr = dwarf_attr (child_die, DW_AT_lower_bound);
 	  if (attr)
 	    {
@@ -2518,9 +2538,8 @@
 /* First cut: install each common block member as a global variable.  */
 
 static void
-read_common_block (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_common_block (struct die_info *die, struct objfile *objfile,
+		   const struct comp_unit_head *cu_header)
 {
   struct die_info *child_die;
   struct attribute *attr;
@@ -2530,19 +2549,19 @@
   attr = dwarf_attr (die, DW_AT_location);
   if (attr)
     {
-      base = decode_locdesc (DW_BLOCK (attr), objfile);
+      base = decode_locdesc (DW_BLOCK (attr), objfile, cu_header);
     }
   if (die->has_children)
     {
       child_die = die->next;
       while (child_die && child_die->tag)
 	{
-	  sym = new_symbol (child_die, NULL, objfile);
+	  sym = new_symbol (child_die, NULL, objfile, cu_header);
 	  attr = dwarf_attr (child_die, DW_AT_data_member_location);
 	  if (attr)
 	    {
 	      SYMBOL_VALUE_ADDRESS (sym) =
-		base + decode_locdesc (DW_BLOCK (attr), objfile);
+		base + decode_locdesc (DW_BLOCK (attr), objfile, cu_header);
 	      add_symbol_to_list (sym, &global_symbols);
 	    }
 	  child_die = sibling_die (child_die);
@@ -2554,9 +2573,8 @@
    the user defined type vector.  */
 
 static void
-read_tag_pointer_type (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_tag_pointer_type (struct die_info *die, struct objfile *objfile,
+		       const struct comp_unit_head *cu_header)
 {
   struct type *type;
   struct attribute *attr;
@@ -2566,7 +2584,7 @@
       return;
     }
 
-  type = lookup_pointer_type (die_type (die, objfile));
+  type = lookup_pointer_type (die_type (die, objfile, cu_header));
   attr = dwarf_attr (die, DW_AT_byte_size);
   if (attr)
     {
@@ -2574,7 +2592,7 @@
     }
   else
     {
-      TYPE_LENGTH (type) = address_size;
+      TYPE_LENGTH (type) = cu_header->addr_size;
     }
   die->type = type;
 }
@@ -2583,9 +2601,8 @@
    the user defined type vector.  */
 
 static void
-read_tag_ptr_to_member_type (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_tag_ptr_to_member_type (struct die_info *die, struct objfile *objfile,
+			     const struct comp_unit_head *cu_header)
 {
   struct type *type;
   struct type *to_type;
@@ -2597,8 +2614,8 @@
     }
 
   type = alloc_type (objfile);
-  to_type = die_type (die, objfile);
-  domain = die_containing_type (die, objfile);
+  to_type = die_type (die, objfile, cu_header);
+  domain = die_containing_type (die, objfile, cu_header);
   smash_to_member_type (type, domain, to_type);
 
   die->type = type;
@@ -2608,9 +2625,8 @@
    the user defined type vector.  */
 
 static void
-read_tag_reference_type (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_tag_reference_type (struct die_info *die, struct objfile *objfile,
+			 const struct comp_unit_head *cu_header)
 {
   struct type *type;
   struct attribute *attr;
@@ -2620,7 +2636,7 @@
       return;
     }
 
-  type = lookup_reference_type (die_type (die, objfile));
+  type = lookup_reference_type (die_type (die, objfile, cu_header));
   attr = dwarf_attr (die, DW_AT_byte_size);
   if (attr)
     {
@@ -2628,15 +2644,14 @@
     }
   else
     {
-      TYPE_LENGTH (type) = address_size;
+      TYPE_LENGTH (type) = cu_header->addr_size;
     }
   die->type = type;
 }
 
 static void
-read_tag_const_type (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_tag_const_type (struct die_info *die, struct objfile *objfile,
+		     const struct comp_unit_head *cu_header)
 {
   if (die->type)
     {
@@ -2644,13 +2659,12 @@
     }
 
   complain (&dwarf2_const_ignored);
-  die->type = die_type (die, objfile);
+  die->type = die_type (die, objfile, cu_header);
 }
 
 static void
-read_tag_volatile_type (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_tag_volatile_type (struct die_info *die, struct objfile *objfile,
+			const struct comp_unit_head *cu_header)
 {
   if (die->type)
     {
@@ -2658,7 +2672,7 @@
     }
 
   complain (&dwarf2_volatile_ignored);
-  die->type = die_type (die, objfile);
+  die->type = die_type (die, objfile, cu_header);
 }
 
 /* Extract all information from a DW_TAG_string_type DIE and add to
@@ -2667,9 +2681,7 @@
    attribute to reference it.  */
 
 static void
-read_tag_string_type (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_tag_string_type (struct die_info *die, struct objfile *objfile)
 {
   struct type *type, *range_type, *index_type, *char_type;
   struct attribute *attr;
@@ -2708,9 +2720,8 @@
  */
 
 static void
-read_subroutine_type (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_subroutine_type (struct die_info *die, struct objfile *objfile,
+		      const struct comp_unit_head *cu_header)
 {
   struct type *type;		/* Type that this function returns */
   struct type *ftype;		/* Function that returns above type */
@@ -2721,7 +2732,7 @@
     {
       return;
     }
-  type = die_type (die, objfile);
+  type = die_type (die, objfile, cu_header);
   ftype = lookup_function_type (type);
 
   /* All functions in C++ have prototypes.  */
@@ -2769,7 +2780,8 @@
 		TYPE_FIELD_ARTIFICIAL (ftype, iparams) = DW_UNSND (attr);
 	      else
 		TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
-	      TYPE_FIELD_TYPE (ftype, iparams) = die_type (child_die, objfile);
+	      TYPE_FIELD_TYPE (ftype, iparams) = die_type (child_die, objfile,
+							   cu_header);
 	      iparams++;
 	    }
 	  child_die = sibling_die (child_die);
@@ -2780,9 +2792,8 @@
 }
 
 static void
-read_typedef (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_typedef (struct die_info *die, struct objfile *objfile,
+	      const struct comp_unit_head *cu_header)
 {
   struct type *type;
 
@@ -2791,7 +2802,7 @@
       struct attribute *attr;
       struct type *xtype;
 
-      xtype = die_type (die, objfile);
+      xtype = die_type (die, objfile, cu_header);
 
       type = alloc_type (objfile);
       TYPE_CODE (type) = TYPE_CODE_TYPEDEF;
@@ -2811,9 +2822,7 @@
    it in the TYPE field of the die.  */
 
 static void
-read_base_type (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_base_type (struct die_info *die, struct objfile *objfile)
 {
   struct type *type;
   struct attribute *attr;
@@ -2884,23 +2893,23 @@
 /* Read a whole compilation unit into a linked list of dies.  */
 
 struct die_info *
-read_comp_unit (info_ptr, abfd)
-     char *info_ptr;
-     bfd *abfd;
+read_comp_unit (char *info_ptr, bfd *abfd,
+		const struct comp_unit_head *cu_header)
 {
   struct die_info *first_die, *last_die, *die;
   char *cur_ptr;
   int nesting_level;
 
-  /* Reset die reference table, we are building a new one now. */
-  dwarf2_empty_die_ref_table ();
+  /* Reset die reference table; we are
+     building new ones now.  */
+  dwarf2_empty_hash_tables ();
 
   cur_ptr = info_ptr;
   nesting_level = 0;
   first_die = last_die = NULL;
   do
     {
-      cur_ptr = read_full_die (&die, abfd, cur_ptr);
+      cur_ptr = read_full_die (&die, abfd, cur_ptr, cu_header);
       if (die->has_children)
 	{
 	  nesting_level++;
@@ -2932,8 +2941,7 @@
 /* Free a linked list of dies.  */
 
 static void
-free_die_list (dies)
-     struct die_info *dies;
+free_die_list (struct die_info *dies)
 {
   struct die_info *die, *next;
 
@@ -2941,8 +2949,8 @@
   while (die)
     {
       next = die->next;
-      free (die->attrs);
-      free (die);
+      xfree (die->attrs);
+      xfree (die);
       die = next;
     }
 }
@@ -2964,10 +2972,8 @@
    object file specified by OBJFILE into the psymbol_obstack and return it.  */
 
 static char *
-dwarf2_read_section (objfile, offset, size)
-     struct objfile *objfile;
-     file_ptr offset;
-     unsigned int size;
+dwarf2_read_section (struct objfile *objfile, file_ptr offset,
+		     unsigned int size)
 {
   bfd *abfd = objfile->obfd;
   char *buf;
@@ -2992,9 +2998,7 @@
    in a hash table.  */
 
 static void
-dwarf2_read_abbrevs (abfd, offset)
-     bfd *abfd;
-     unsigned int offset;
+dwarf2_read_abbrevs (bfd *abfd, unsigned int offset)
 {
   char *abbrev_ptr;
   struct abbrev_info *cur_abbrev;
@@ -3067,8 +3071,7 @@
 
 /* ARGSUSED */
 static void
-dwarf2_empty_abbrev_table (ignore)
-     PTR ignore;
+dwarf2_empty_abbrev_table (PTR ignore)
 {
   int i;
   struct abbrev_info *abbrev, *next;
@@ -3080,8 +3083,8 @@
       while (abbrev)
 	{
 	  next = abbrev->next;
-	  free (abbrev->attrs);
-	  free (abbrev);
+	  xfree (abbrev->attrs);
+	  xfree (abbrev);
 	  abbrev = next;
 	}
       dwarf2_abbrevs[i] = NULL;
@@ -3091,8 +3094,7 @@
 /* Lookup an abbrev_info structure in the abbrev hash table.  */
 
 static struct abbrev_info *
-dwarf2_lookup_abbrev (number)
-     unsigned int number;
+dwarf2_lookup_abbrev (unsigned int number)
 {
   unsigned int hash_number;
   struct abbrev_info *abbrev;
@@ -3113,11 +3115,9 @@
 /* Read a minimal amount of information into the minimal die structure.  */
 
 static char *
-read_partial_die (part_die, abfd, info_ptr, has_pc_info)
-     struct partial_die_info *part_die;
-     bfd *abfd;
-     char *info_ptr;
-     int *has_pc_info;
+read_partial_die (struct partial_die_info *part_die, bfd *abfd,
+		  char *info_ptr, int *has_pc_info,
+		  const struct comp_unit_head *cu_header)
 {
   unsigned int abbrev_number, bytes_read, i;
   struct abbrev_info *abbrev;
@@ -3146,7 +3146,8 @@
 
   for (i = 0; i < abbrev->num_attrs; ++i)
     {
-      info_ptr = read_attribute (&attr, &abbrev->attrs[i], abfd, info_ptr);
+      info_ptr = read_attribute (&attr, &abbrev->attrs[i], abfd,
+				 info_ptr, cu_header);
 
       /* Store the data if it is of an attribute we want to keep in a
          partial symbol table.  */
@@ -3213,7 +3214,7 @@
       int dummy;
 
       spec_ptr = dwarf_info_buffer + dwarf2_get_ref_die_offset (&spec_attr);
-      read_partial_die (&spec_die, abfd, spec_ptr, &dummy);
+      read_partial_die (&spec_die, abfd, spec_ptr, &dummy, cu_header);
       if (spec_die.name)
 	{
 	  part_die->name = spec_die.name;
@@ -3244,10 +3245,8 @@
    point to a newly allocated die with its information.  */
 
 static char *
-read_full_die (diep, abfd, info_ptr)
-     struct die_info **diep;
-     bfd *abfd;
-     char *info_ptr;
+read_full_die (struct die_info **diep, bfd *abfd, char *info_ptr,
+	       const struct comp_unit_head *cu_header)
 {
   unsigned int abbrev_number, bytes_read, i, offset;
   struct abbrev_info *abbrev;
@@ -3285,7 +3284,7 @@
   for (i = 0; i < abbrev->num_attrs; ++i)
     {
       info_ptr = read_attribute (&die->attrs[i], &abbrev->attrs[i],
-				 abfd, info_ptr);
+				 abfd, info_ptr, cu_header);
     }
 
   *diep = die;
@@ -3295,11 +3294,9 @@
 /* Read an attribute described by an abbreviated attribute.  */
 
 static char *
-read_attribute (attr, abbrev, abfd, info_ptr)
-     struct attribute *attr;
-     struct attr_abbrev *abbrev;
-     bfd *abfd;
-     char *info_ptr;
+read_attribute (struct attribute *attr, struct attr_abbrev *abbrev,
+		bfd *abfd, char *info_ptr,
+		const struct comp_unit_head *cu_header)
 {
   unsigned int bytes_read;
   struct dwarf_block *blk;
@@ -3310,8 +3307,8 @@
     {
     case DW_FORM_addr:
     case DW_FORM_ref_addr:
-      DW_ADDR (attr) = read_address (abfd, info_ptr);
-      info_ptr += address_size;
+      DW_ADDR (attr) = read_address (abfd, info_ptr, cu_header, &bytes_read);
+      info_ptr += bytes_read;
       break;
     case DW_FORM_block2:
       blk = dwarf_alloc_block ();
@@ -3389,6 +3386,10 @@
       DW_UNSND (attr) = read_4_bytes (abfd, info_ptr);
       info_ptr += 4;
       break;
+    case DW_FORM_ref8:
+      DW_UNSND (attr) = read_8_bytes (abfd, info_ptr);
+      info_ptr += 8;
+      break;
     case DW_FORM_ref_udata:
       DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
       info_ptr += bytes_read;
@@ -3405,92 +3406,177 @@
 /* read dwarf information from a buffer */
 
 static unsigned int
-read_1_byte (abfd, buf)
-     bfd *abfd;
-     char *buf;
+read_1_byte (bfd *abfd, char *buf)
 {
   return bfd_get_8 (abfd, (bfd_byte *) buf);
 }
 
 static int
-read_1_signed_byte (abfd, buf)
-     bfd *abfd;
-     char *buf;
+read_1_signed_byte (bfd *abfd, char *buf)
 {
   return bfd_get_signed_8 (abfd, (bfd_byte *) buf);
 }
 
 static unsigned int
-read_2_bytes (abfd, buf)
-     bfd *abfd;
-     char *buf;
+read_2_bytes (bfd *abfd, char *buf)
 {
   return bfd_get_16 (abfd, (bfd_byte *) buf);
 }
 
 static int
-read_2_signed_bytes (abfd, buf)
-     bfd *abfd;
-     char *buf;
+read_2_signed_bytes (bfd *abfd, char *buf)
 {
   return bfd_get_signed_16 (abfd, (bfd_byte *) buf);
 }
 
 static unsigned int
-read_4_bytes (abfd, buf)
-     bfd *abfd;
-     char *buf;
+read_4_bytes (bfd *abfd, char *buf)
 {
   return bfd_get_32 (abfd, (bfd_byte *) buf);
 }
 
 static int
-read_4_signed_bytes (abfd, buf)
-     bfd *abfd;
-     char *buf;
+read_4_signed_bytes (bfd *abfd, char *buf)
 {
   return bfd_get_signed_32 (abfd, (bfd_byte *) buf);
 }
 
-static unsigned int
-read_8_bytes (abfd, buf)
-     bfd *abfd;
-     char *buf;
+static unsigned long
+read_8_bytes (bfd *abfd, char *buf)
 {
   return bfd_get_64 (abfd, (bfd_byte *) buf);
 }
 
 static CORE_ADDR
-read_address (abfd, buf)
-     bfd *abfd;
-     char *buf;
+read_address (bfd *abfd, char *buf, const struct comp_unit_head *cu_header,
+	      int *bytes_read)
 {
   CORE_ADDR retval = 0;
 
-  switch (address_size)
+  if (cu_header->signed_addr_p)
     {
-    case 2:
-      retval = bfd_get_16 (abfd, (bfd_byte *) buf);
-      break;
+      switch (cu_header->addr_size)
+	{
+	case 2:
+	  retval = bfd_get_signed_16 (abfd, (bfd_byte *) buf);
+	  break;
+	case 4:
+	  retval = bfd_get_signed_32 (abfd, (bfd_byte *) buf);
+	  break;
+	case 8:
+	  retval = bfd_get_signed_64 (abfd, (bfd_byte *) buf);
+	  break;
+	default:
+	  internal_error ("read_address: bad switch, signed");
+	}
+    }
+  else
+    {
+      switch (cu_header->addr_size)
+	{
+	case 2:
+	  retval = bfd_get_16 (abfd, (bfd_byte *) buf);
+	  break;
+	case 4:
+	  retval = bfd_get_32 (abfd, (bfd_byte *) buf);
+	  break;
+	case 8:
+	  retval = bfd_get_64 (abfd, (bfd_byte *) buf);
+	  break;
+	default:
+	  internal_error ("read_address: bad switch, unsigned");
+	}
+    }
+
+  *bytes_read = cu_header->addr_size;
+  return retval;
+}
+
+/* Reads the initial length from a section.  The (draft) DWARF 2.1
+   specification allows the initial length to take up either 4 bytes
+   or 12 bytes.  If the first 4 bytes are 0xffffffff, then the next 8
+   bytes describe the length and all offsets will be 8 bytes in length
+   instead of 4.
+
+   The value returned via bytes_read should be used to increment
+   the relevant pointer after calling read_initial_length().
+   
+   As a side effect, this function sets the fields initial_length_size
+   and offset_size in cu_header to the values appropriate for the
+   length field.  (The format of the initial length field determines
+   the width of file offsets to be fetched later with fetch_offset().)
+   
+   [ Note:  read_initial_length() and read_offset() are based on the
+     document entitled "DWARF Debugging Information Format", revision
+     2.1, draft 4, dated July 20, 2000.  This document was obtained
+     from:
+
+	http://reality.sgi.com/dehnert_engr/dwarf/dwarf2p1-draft4-000720.pdf
+     
+     This document is only a draft and is subject to change.  (So beware.)
+
+     - Kevin, Aug 4, 2000
+   ] */
+
+static LONGEST
+read_initial_length (bfd *abfd, char *buf, struct comp_unit_head *cu_header,
+                     int *bytes_read)
+{
+  LONGEST retval = 0;
+
+  retval = bfd_get_32 (abfd, (bfd_byte *) buf);
+
+  if (retval == 0xffffffff)
+    {
+      retval = bfd_get_64 (abfd, (bfd_byte *) buf + 4);
+      *bytes_read = 12;
+      if (cu_header != NULL)
+	{
+	  cu_header->initial_length_size = 12;
+	  cu_header->offset_size = 8;
+	}
+    }
+  else
+    {
+      *bytes_read = 4;
+      if (cu_header != NULL)
+	{
+	  cu_header->initial_length_size = 4;
+	  cu_header->offset_size = 4;
+	}
+    }
+
+ return retval;
+}
+
+/* Read an offset from the data stream.  The size of the offset is
+   given by cu_header->offset_size. */
+
+static LONGEST
+read_offset (bfd *abfd, char *buf, const struct comp_unit_head *cu_header,
+             int *bytes_read)
+{
+  LONGEST retval = 0;
+
+  switch (cu_header->offset_size)
+    {
     case 4:
       retval = bfd_get_32 (abfd, (bfd_byte *) buf);
+      *bytes_read = 4;
       break;
     case 8:
       retval = bfd_get_64 (abfd, (bfd_byte *) buf);
+      *bytes_read = 8;
       break;
     default:
-      /* *THE* alternative is 8, right? */
-      abort ();
+      internal_error ("read_offset: bad switch");
     }
 
  return retval;
 }
 
 static char *
-read_n_bytes (abfd, buf, size)
-     bfd *abfd;
-     char *buf;
-     unsigned int size;
+read_n_bytes (bfd *abfd, char *buf, unsigned int size)
 {
   /* If the size of a host char is 8 bits, we can return a pointer
      to the buffer, otherwise we have to copy the data to a buffer
@@ -3512,10 +3598,7 @@
 }
 
 static char *
-read_string (abfd, buf, bytes_read_ptr)
-     bfd *abfd;
-     char *buf;
-     unsigned int *bytes_read_ptr;
+read_string (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
 {
   /* If the size of a host char is 8 bits, we can return a pointer
      to the string, otherwise we have to copy the string to a buffer
@@ -3549,13 +3632,11 @@
 #endif
 }
 
-static unsigned int
-read_unsigned_leb128 (abfd, buf, bytes_read_ptr)
-     bfd *abfd;
-     char *buf;
-     unsigned int *bytes_read_ptr;
+static unsigned long
+read_unsigned_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
 {
-  unsigned int result, num_read;
+  unsigned long result;
+  unsigned int num_read;
   int i, shift;
   unsigned char byte;
 
@@ -3568,7 +3649,7 @@
       byte = bfd_get_8 (abfd, (bfd_byte *) buf);
       buf++;
       num_read++;
-      result |= ((byte & 127) << shift);
+      result |= ((unsigned long)(byte & 127) << shift);
       if ((byte & 128) == 0)
 	{
 	  break;
@@ -3579,13 +3660,10 @@
   return result;
 }
 
-static int
-read_signed_leb128 (abfd, buf, bytes_read_ptr)
-     bfd *abfd;
-     char *buf;
-     unsigned int *bytes_read_ptr;
+static long
+read_signed_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
 {
-  int result;
+  long result;
   int i, shift, size, num_read;
   unsigned char byte;
 
@@ -3599,7 +3677,7 @@
       byte = bfd_get_8 (abfd, (bfd_byte *) buf);
       buf++;
       num_read++;
-      result |= ((byte & 127) << shift);
+      result |= ((long)(byte & 127) << shift);
       shift += 7;
       if ((byte & 128) == 0)
 	{
@@ -3615,8 +3693,7 @@
 }
 
 static void
-set_cu_language (lang)
-     unsigned int lang;
+set_cu_language (unsigned int lang)
 {
   switch (lang)
     {
@@ -3649,9 +3726,7 @@
 /* Return the named attribute or NULL if not there.  */
 
 static struct attribute *
-dwarf_attr (die, name)
-     struct die_info *die;
-     unsigned int name;
+dwarf_attr (struct die_info *die, unsigned int name)
 {
   unsigned int i;
   struct attribute *spec = NULL;
@@ -3709,10 +3784,8 @@
   };
 
 static void
-dwarf_decode_lines (offset, comp_dir, abfd)
-     unsigned int offset;
-     char *comp_dir;
-     bfd *abfd;
+dwarf_decode_lines (unsigned int offset, char *comp_dir, bfd *abfd,
+		    const struct comp_unit_head *cu_header)
 {
   char *line_ptr;
   char *line_end;
@@ -3743,13 +3816,13 @@
   line_ptr = dwarf_line_buffer + offset;
 
   /* read in the prologue */
-  lh.total_length = read_4_bytes (abfd, line_ptr);
-  line_ptr += 4;
+  lh.total_length = read_initial_length (abfd, line_ptr, NULL, &bytes_read);
+  line_ptr += bytes_read;
   line_end = line_ptr + lh.total_length;
   lh.version = read_2_bytes (abfd, line_ptr);
   line_ptr += 2;
-  lh.prologue_length = read_4_bytes (abfd, line_ptr);
-  line_ptr += 4;
+  lh.prologue_length = read_offset (abfd, line_ptr, cu_header, &bytes_read);
+  line_ptr += bytes_read;
   lh.minimum_instruction_length = read_1_byte (abfd, line_ptr);
   line_ptr += 1;
   lh.default_is_stmt = read_1_byte (abfd, line_ptr);
@@ -3860,8 +3933,9 @@
 		     not the ends.  This is a weakness of GDB.  */
 		  break;
 		case DW_LNE_set_address:
-		  address = read_address (abfd, line_ptr) + baseaddr;
-		  line_ptr += address_size;
+		  address = read_address (abfd, line_ptr, cu_header, &bytes_read);
+		  line_ptr += bytes_read;
+		  address += baseaddr;
 		  break;
 		case DW_LNE_define_file:
 		  cur_file = read_string (abfd, line_ptr, &bytes_read);
@@ -3975,9 +4049,7 @@
    subfile, so that `break /srcdir/list0.c:1' works as expected.  */
 
 static void
-dwarf2_start_subfile (filename, dirname)
-     char *filename;
-     char *dirname;
+dwarf2_start_subfile (char *filename, char *dirname)
 {
   /* If the filename isn't absolute, try to match an existing subfile
      with the full pathname.  */
@@ -3992,11 +4064,11 @@
 	  if (STREQ (subfile->name, fullname))
 	    {
 	      current_subfile = subfile;
-	      free (fullname);
+	      xfree (fullname);
 	      return;
 	    }
 	}
-      free (fullname);
+      xfree (fullname);
     }
   start_subfile (filename, dirname);
 }
@@ -4008,10 +4080,8 @@
    used the passed type.  */
 
 static struct symbol *
-new_symbol (die, type, objfile)
-     struct die_info *die;
-     struct type *type;
-     struct objfile *objfile;
+new_symbol (struct die_info *die, struct type *type, struct objfile *objfile,
+	    const struct comp_unit_head *cu_header)
 {
   struct symbol *sym = NULL;
   char *name;
@@ -4036,7 +4106,7 @@
       if (type != NULL)
 	SYMBOL_TYPE (sym) = type;
       else
-	SYMBOL_TYPE (sym) = die_type (die, objfile);
+	SYMBOL_TYPE (sym) = die_type (die, objfile, cu_header);
       attr = dwarf_attr (die, DW_AT_decl_line);
       if (attr)
 	{
@@ -4087,7 +4157,7 @@
 	  attr = dwarf_attr (die, DW_AT_const_value);
 	  if (attr)
 	    {
-	      dwarf2_const_value (attr, sym, objfile);
+	      dwarf2_const_value (attr, sym, objfile, cu_header);
 	      attr2 = dwarf_attr (die, DW_AT_external);
 	      if (attr2 && (DW_UNSND (attr2) != 0))
 		add_symbol_to_list (sym, &global_symbols);
@@ -4102,7 +4172,7 @@
 	      if (attr2 && (DW_UNSND (attr2) != 0))
 		{
 		  SYMBOL_VALUE_ADDRESS (sym) =
-		    decode_locdesc (DW_BLOCK (attr), objfile);
+		    decode_locdesc (DW_BLOCK (attr), objfile, cu_header);
 		  add_symbol_to_list (sym, &global_symbols);
 
 		  /* In shared libraries the address of the variable
@@ -4114,7 +4184,10 @@
 		     the variable is referenced.  */
 		  if (SYMBOL_VALUE_ADDRESS (sym))
 		    {
-		      SYMBOL_VALUE_ADDRESS (sym) += baseaddr;
+		      fixup_symbol_section (sym, objfile);
+		      SYMBOL_VALUE_ADDRESS (sym) +=
+			ANOFFSET (objfile->section_offsets,
+			          SYMBOL_SECTION (sym));
 		      SYMBOL_CLASS (sym) = LOC_STATIC;
 		    }
 		  else
@@ -4123,7 +4196,7 @@
 	      else
 		{
 		  SYMBOL_VALUE (sym) = addr =
-		    decode_locdesc (DW_BLOCK (attr), objfile);
+		    decode_locdesc (DW_BLOCK (attr), objfile, cu_header);
 		  add_symbol_to_list (sym, list_in_scope);
 		  if (optimized_out)
 		    {
@@ -4132,11 +4205,13 @@
 		  else if (isreg)
 		    {
 		      SYMBOL_CLASS (sym) = LOC_REGISTER;
+		      SYMBOL_VALUE (sym) = 
+			DWARF2_REG_TO_REGNUM (SYMBOL_VALUE (sym));
 		    }
 		  else if (offreg)
 		    {
 		      SYMBOL_CLASS (sym) = LOC_BASEREG;
-		      SYMBOL_BASEREG (sym) = basereg;
+		      SYMBOL_BASEREG (sym) = DWARF2_REG_TO_REGNUM (basereg);
 		    }
 		  else if (islocal)
 		    {
@@ -4144,8 +4219,11 @@
 		    }
 		  else
 		    {
+		      fixup_symbol_section (sym, objfile);
+		      SYMBOL_VALUE_ADDRESS (sym) =
+		        addr + ANOFFSET (objfile->section_offsets,
+			                 SYMBOL_SECTION (sym));
 		      SYMBOL_CLASS (sym) = LOC_STATIC;
-		      SYMBOL_VALUE_ADDRESS (sym) = addr + baseaddr;
 		    }
 		}
 	    }
@@ -4170,10 +4248,13 @@
 	  attr = dwarf_attr (die, DW_AT_location);
 	  if (attr)
 	    {
-	      SYMBOL_VALUE (sym) = decode_locdesc (DW_BLOCK (attr), objfile);
+	      SYMBOL_VALUE (sym) =
+		decode_locdesc (DW_BLOCK (attr), objfile, cu_header);
 	      if (isreg)
 		{
 		  SYMBOL_CLASS (sym) = LOC_REGPARM;
+		  SYMBOL_VALUE (sym) = 
+		    DWARF2_REG_TO_REGNUM (SYMBOL_VALUE (sym));
 		}
 	      else if (offreg)
 		{
@@ -4186,7 +4267,7 @@
 		  else
 		    {
 		      SYMBOL_CLASS (sym) = LOC_BASEREG_ARG;
-		      SYMBOL_BASEREG (sym) = basereg;
+		      SYMBOL_BASEREG (sym) = DWARF2_REG_TO_REGNUM (basereg);
 		    }
 		}
 	      else
@@ -4197,7 +4278,7 @@
 	  attr = dwarf_attr (die, DW_AT_const_value);
 	  if (attr)
 	    {
-	      dwarf2_const_value (attr, sym, objfile);
+	      dwarf2_const_value (attr, sym, objfile, cu_header);
 	    }
 	  add_symbol_to_list (sym, list_in_scope);
 	  break;
@@ -4242,7 +4323,7 @@
 	  attr = dwarf_attr (die, DW_AT_const_value);
 	  if (attr)
 	    {
-	      dwarf2_const_value (attr, sym, objfile);
+	      dwarf2_const_value (attr, sym, objfile, cu_header);
 	    }
 	  add_symbol_to_list (sym, list_in_scope);
 	  break;
@@ -4261,22 +4342,22 @@
 /* Copy constant value from an attribute to a symbol.  */
 
 static void
-dwarf2_const_value (attr, sym, objfile)
-     struct attribute *attr;
-     struct symbol *sym;
-     struct objfile *objfile;
+dwarf2_const_value (struct attribute *attr, struct symbol *sym,
+		    struct objfile *objfile,
+		    const struct comp_unit_head *cu_header)
 {
   struct dwarf_block *blk;
 
   switch (attr->form)
     {
     case DW_FORM_addr:
-      if (TYPE_LENGTH (SYMBOL_TYPE (sym)) != (unsigned int) address_size)
+      if (TYPE_LENGTH (SYMBOL_TYPE (sym)) != cu_header->addr_size)
 	complain (&dwarf2_const_value_length_mismatch, SYMBOL_NAME (sym),
-		  address_size, TYPE_LENGTH (SYMBOL_TYPE (sym)));
+		  cu_header->addr_size, TYPE_LENGTH (SYMBOL_TYPE (sym)));
       SYMBOL_VALUE_BYTES (sym) = (char *)
-	obstack_alloc (&objfile->symbol_obstack, address_size);
-      store_address (SYMBOL_VALUE_BYTES (sym), address_size, DW_ADDR (attr));
+	obstack_alloc (&objfile->symbol_obstack, cu_header->addr_size);
+      store_address (SYMBOL_VALUE_BYTES (sym), cu_header->addr_size,
+		     DW_ADDR (attr));
       SYMBOL_CLASS (sym) = LOC_CONST_BYTES;
       break;
     case DW_FORM_block1:
@@ -4356,9 +4437,8 @@
 /* Return the type of the die in question using its DW_AT_type attribute.  */
 
 static struct type *
-die_type (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+die_type (struct die_info *die, struct objfile *objfile,
+	  const struct comp_unit_head *cu_header)
 {
   struct type *type;
   struct attribute *type_attr;
@@ -4381,7 +4461,7 @@
 	  return NULL;
 	}
     }
-  type = tag_type_to_type (type_die, objfile);
+  type = tag_type_to_type (type_die, objfile, cu_header);
   if (!type)
     {
       dump_die (type_die);
@@ -4394,9 +4474,8 @@
    DW_AT_containing_type attribute.  */
 
 static struct type *
-die_containing_type (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+die_containing_type (struct die_info *die, struct objfile *objfile,
+		     const struct comp_unit_head *cu_header)
 {
   struct type *type = NULL;
   struct attribute *type_attr;
@@ -4413,7 +4492,7 @@
 	  error ("Dwarf Error: Cannot find referent at offset %d.", ref);
 	  return NULL;
 	}
-      type = tag_type_to_type (type_die, objfile);
+      type = tag_type_to_type (type_die, objfile, cu_header);
     }
   if (!type)
     {
@@ -4426,9 +4505,7 @@
 
 #if 0
 static struct type *
-type_at_offset (offset, objfile)
-     unsigned int offset;
-     struct objfile *objfile;
+type_at_offset (unsigned int offset, struct objfile *objfile)
 {
   struct die_info *die;
   struct type *type;
@@ -4445,9 +4522,8 @@
 #endif
 
 static struct type *
-tag_type_to_type (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+tag_type_to_type (struct die_info *die, struct objfile *objfile,
+		  const struct comp_unit_head *cu_header)
 {
   if (die->type)
     {
@@ -4455,38 +4531,7 @@
     }
   else
     {
-      struct attribute *attr;
-      attr = dwarf_attr (die, DW_AT_name);
-      if (attr && DW_STRING (attr))
-	{
-	  char *attrname=DW_STRING (attr);
-	  unsigned long hashval=hash(attrname, strlen(attrname)) % TYPE_HASH_SIZE;
-
-	  if (dwarf2_cached_types[hashval] != NULL)
-	    {
-	      const char *nameoftype;
-	      nameoftype = TYPE_NAME(dwarf2_cached_types[hashval]) == NULL ? TYPE_TAG_NAME(dwarf2_cached_types[hashval]) : TYPE_NAME(dwarf2_cached_types[hashval]);
-	      if (strcmp(attrname, nameoftype) == 0)
-		{
-		  die->type=dwarf2_cached_types[hashval];
-		}
-	      else
-		{
-		  read_type_die (die, objfile);
-		  dwarf2_cached_types[hashval] = die->type;
-		}
-	    }
-	  else
-	    {
-	      read_type_die (die, objfile);
-	      dwarf2_cached_types[hashval] = die->type;
-	    }
-	}
-      else
-	{
-	  read_type_die (die, objfile);
-	}
-
+      read_type_die (die, objfile, cu_header);
       if (!die->type)
 	{
 	  dump_die (die);
@@ -4497,47 +4542,46 @@
 }
 
 static void
-read_type_die (die, objfile)
-     struct die_info *die;
-     struct objfile *objfile;
+read_type_die (struct die_info *die, struct objfile *objfile,
+	       const struct comp_unit_head *cu_header)
 {
   switch (die->tag)
     {
     case DW_TAG_class_type:
     case DW_TAG_structure_type:
     case DW_TAG_union_type:
-      read_structure_scope (die, objfile);
+      read_structure_scope (die, objfile, cu_header);
       break;
     case DW_TAG_enumeration_type:
-      read_enumeration (die, objfile);
+      read_enumeration (die, objfile, cu_header);
       break;
     case DW_TAG_subprogram:
     case DW_TAG_subroutine_type:
-      read_subroutine_type (die, objfile);
+      read_subroutine_type (die, objfile, cu_header);
       break;
     case DW_TAG_array_type:
-      read_array_type (die, objfile);
+      read_array_type (die, objfile, cu_header);
       break;
     case DW_TAG_pointer_type:
-      read_tag_pointer_type (die, objfile);
+      read_tag_pointer_type (die, objfile, cu_header);
       break;
     case DW_TAG_ptr_to_member_type:
-      read_tag_ptr_to_member_type (die, objfile);
+      read_tag_ptr_to_member_type (die, objfile, cu_header);
       break;
     case DW_TAG_reference_type:
-      read_tag_reference_type (die, objfile);
+      read_tag_reference_type (die, objfile, cu_header);
       break;
     case DW_TAG_const_type:
-      read_tag_const_type (die, objfile);
+      read_tag_const_type (die, objfile, cu_header);
       break;
     case DW_TAG_volatile_type:
-      read_tag_volatile_type (die, objfile);
+      read_tag_volatile_type (die, objfile, cu_header);
       break;
     case DW_TAG_string_type:
       read_tag_string_type (die, objfile);
       break;
     case DW_TAG_typedef:
-      read_typedef (die, objfile);
+      read_typedef (die, objfile, cu_header);
       break;
     case DW_TAG_base_type:
       read_base_type (die, objfile);
@@ -4549,10 +4593,7 @@
 }
 
 static struct type *
-dwarf_base_type (encoding, size, objfile)
-     int encoding;
-     int size;
-     struct objfile *objfile;
+dwarf_base_type (int encoding, int size, struct objfile *objfile)
 {
   /* FIXME - this should not produce a new (struct type *)
      every time.  It should cache base types.  */
@@ -4629,8 +4670,7 @@
 
 #if 0
 struct die_info *
-copy_die (old_die)
-     struct die_info *old_die;
+copy_die (struct die_info *old_die)
 {
   struct die_info *new_die;
   int i, num_attrs;
@@ -4664,8 +4704,7 @@
 /* Return sibling of die, NULL if no sibling.  */
 
 struct die_info *
-sibling_die (die)
-     struct die_info *die;
+sibling_die (struct die_info *die)
 {
   int nesting_level = 0;
 
@@ -4709,8 +4748,7 @@
 /* Get linkage name of a die, return NULL if not found.  */
 
 static char *
-dwarf2_linkage_name (die)
-     struct die_info *die;
+dwarf2_linkage_name (struct die_info *die)
 {
   struct attribute *attr;
 
@@ -4726,8 +4764,7 @@
 /* Convert a DIE tag into its string name.  */
 
 static char *
-dwarf_tag_name (tag)
-     register unsigned tag;
+dwarf_tag_name (register unsigned tag)
 {
   switch (tag)
     {
@@ -4843,8 +4880,7 @@
 /* Convert a DWARF attribute code into its string name.  */
 
 static char *
-dwarf_attr_name (attr)
-     register unsigned attr;
+dwarf_attr_name (register unsigned attr)
 {
   switch (attr)
     {
@@ -5010,8 +5046,7 @@
 /* Convert a DWARF value form code into its string name.  */
 
 static char *
-dwarf_form_name (form)
-     register unsigned form;
+dwarf_form_name (register unsigned form)
 {
   switch (form)
     {
@@ -5065,8 +5100,7 @@
 /* Convert a DWARF stack opcode into its string name.  */
 
 static char *
-dwarf_stack_op_name (op)
-     register unsigned op;
+dwarf_stack_op_name (register unsigned op)
 {
   switch (op)
     {
@@ -5366,8 +5400,7 @@
 }
 
 static char *
-dwarf_bool_name (mybool)
-     unsigned mybool;
+dwarf_bool_name (unsigned mybool)
 {
   if (mybool)
     return "TRUE";
@@ -5378,8 +5411,7 @@
 /* Convert a DWARF type code into its string name.  */
 
 static char *
-dwarf_type_encoding_name (enc)
-     register unsigned enc;
+dwarf_type_encoding_name (register unsigned enc)
 {
   switch (enc)
     {
@@ -5408,8 +5440,7 @@
 
 #if 0
 static char *
-dwarf_cfi_name (cfi_opc)
-     register unsigned cfi_opc;
+dwarf_cfi_name (register unsigned cfi_opc)
 {
   switch (cfi_opc)
     {
@@ -5459,8 +5490,7 @@
 #endif
 
 void
-dump_die (die)
-     struct die_info *die;
+dump_die (struct die_info *die)
 {
   unsigned int i;
 
@@ -5491,12 +5521,13 @@
 	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 (stderr, "constant: %d", DW_UNSND (&die->attrs[i]));
+	  fprintf (stderr, "constant: %ld", DW_UNSND (&die->attrs[i]));
 	  break;
 	case DW_FORM_string:
 	  fprintf (stderr, "string: \"%s\"",
@@ -5512,7 +5543,6 @@
 	case DW_FORM_strp:	/* we do not support separate string
 				   section yet */
 	case DW_FORM_indirect:	/* we do not handle indirect yet */
-	case DW_FORM_data8:	/* we do not have 64 bit quantities */
 	default:
 	  fprintf (stderr, "unsupported attribute form: %d.",
 		   die->attrs[i].form);
@@ -5522,8 +5552,7 @@
 }
 
 void
-dump_die_list (die)
-     struct die_info *die;
+dump_die_list (struct die_info *die)
 {
   while (die)
     {
@@ -5533,9 +5562,7 @@
 }
 
 void
-store_in_ref_table (offset, die)
-     unsigned int offset;
-     struct die_info *die;
+store_in_ref_table (unsigned int offset, struct die_info *die)
 {
   int h;
   struct die_info *old;
@@ -5548,14 +5575,13 @@
 
 
 static void
-dwarf2_empty_die_ref_table ()
+dwarf2_empty_hash_tables (void)
 {
   memset (die_ref_table, 0, sizeof (die_ref_table));
 }
 
 static unsigned int
-dwarf2_get_ref_die_offset (attr)
-     struct attribute *attr;
+dwarf2_get_ref_die_offset (struct attribute *attr)
 {
   unsigned int result = 0;
 
@@ -5567,6 +5593,7 @@
     case DW_FORM_ref1:
     case DW_FORM_ref2:
     case DW_FORM_ref4:
+    case DW_FORM_ref8:
     case DW_FORM_ref_udata:
       result = cu_header_offset + DW_UNSND (attr);
       break;
@@ -5577,8 +5604,7 @@
 }
 
 struct die_info *
-follow_die_ref (offset)
-     unsigned int offset;
+follow_die_ref (unsigned int offset)
 {
   struct die_info *die;
   int h;
@@ -5597,9 +5623,7 @@
 }
 
 static struct type *
-dwarf2_fundamental_type (objfile, typeid)
-     struct objfile *objfile;
-     int typeid;
+dwarf2_fundamental_type (struct objfile *objfile, int typeid)
 {
   if (typeid < 0 || typeid >= FT_NUM_MEMBERS)
     {
@@ -5648,9 +5672,8 @@
    Note that stack overflow is not yet handled.  */
 
 static CORE_ADDR
-decode_locdesc (blk, objfile)
-     struct dwarf_block *blk;
-     struct objfile *objfile;
+decode_locdesc (struct dwarf_block *blk, struct objfile *objfile,
+		const struct comp_unit_head *cu_header)
 {
   int i;
   int size = blk->size;
@@ -5787,8 +5810,9 @@
 	  break;
 
 	case DW_OP_addr:
-	  stack[++stacki] = read_address (objfile->obfd, &data[i]);
-	  i += address_size;
+	  stack[++stacki] = read_address (objfile->obfd, &data[i],
+					  cu_header, &bytes_read);
+	  i += bytes_read;
 	  break;
 
 	case DW_OP_const1u:
@@ -5867,14 +5891,13 @@
 
 /* ARGSUSED */
 static void
-dwarf2_free_tmp_obstack (ignore)
-     PTR ignore;
+dwarf2_free_tmp_obstack (PTR ignore)
 {
   obstack_free (&dwarf2_tmp_obstack, NULL);
 }
 
 static struct dwarf_block *
-dwarf_alloc_block ()
+dwarf_alloc_block (void)
 {
   struct dwarf_block *blk;
 
@@ -5884,7 +5907,7 @@
 }
 
 static struct abbrev_info *
-dwarf_alloc_abbrev ()
+dwarf_alloc_abbrev (void)
 {
   struct abbrev_info *abbrev;
 
@@ -5894,7 +5917,7 @@
 }
 
 static struct die_info *
-dwarf_alloc_die ()
+dwarf_alloc_die (void)
 {
   struct die_info *die;
 
diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c
index c56155e..7055717 100644
--- a/gdb/dwarfread.c
+++ b/gdb/dwarfread.c
@@ -189,11 +189,6 @@
 #define CHILL_PRODUCER "GNU Chill "
 #endif
 
-/* Provide a default mapping from a DWARF register number to a gdb REGNUM.  */
-#ifndef DWARF_REG_TO_REGNUM
-#define DWARF_REG_TO_REGNUM(num) (num)
-#endif
-
 /* Flags to target_to_host() that tell whether or not the data object is
    expected to be signed.  Used, for example, when fetching a signed
    integer in the target environment which is used as a signed integer
@@ -576,9 +571,7 @@
  */
 
 static struct type *
-dwarf_fundamental_type (objfile, typeid)
-     struct objfile *objfile;
-     int typeid;
+dwarf_fundamental_type (struct objfile *objfile, int typeid)
 {
   if (typeid < 0 || typeid >= FT_NUM_MEMBERS)
     {
@@ -621,8 +614,7 @@
  */
 
 static void
-set_cu_language (dip)
-     struct dieinfo *dip;
+set_cu_language (struct dieinfo *dip)
 {
   switch (dip->at_language)
     {
@@ -690,14 +682,9 @@
  */
 
 void
-dwarf_build_psymtabs (objfile, mainline, dbfoff, dbfsize,
-		      lnoffset, lnsize)
-     struct objfile *objfile;
-     int mainline;
-     file_ptr dbfoff;
-     unsigned int dbfsize;
-     file_ptr lnoffset;
-     unsigned int lnsize;
+dwarf_build_psymtabs (struct objfile *objfile, int mainline, file_ptr dbfoff,
+		      unsigned int dbfsize, file_ptr lnoffset,
+		      unsigned int lnsize)
 {
   bfd *abfd = objfile->obfd;
   struct cleanup *back_to;
@@ -709,10 +696,10 @@
   if ((bfd_seek (abfd, dbfoff, SEEK_SET) != 0) ||
       (bfd_read (dbbase, dbsize, 1, abfd) != dbsize))
     {
-      free (dbbase);
+      xfree (dbbase);
       error ("can't read DWARF data from '%s'", bfd_get_filename (abfd));
     }
-  back_to = make_cleanup (free, dbbase);
+  back_to = make_cleanup (xfree, dbbase);
 
   /* If we are reinitializing, or if we have never loaded syms yet, init.
      Since we have no idea how many DIES we are looking at, we just guess
@@ -758,11 +745,8 @@
  */
 
 static void
-read_lexical_block_scope (dip, thisdie, enddie, objfile)
-     struct dieinfo *dip;
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+read_lexical_block_scope (struct dieinfo *dip, char *thisdie, char *enddie,
+			  struct objfile *objfile)
 {
   register struct context_stack *new;
 
@@ -797,8 +781,7 @@
  */
 
 static struct type *
-lookup_utype (die_ref)
-     DIE_REF die_ref;
+lookup_utype (DIE_REF die_ref)
 {
   struct type *type = NULL;
   int utypeidx;
@@ -838,9 +821,7 @@
  */
 
 static struct type *
-alloc_utype (die_ref, utypep)
-     DIE_REF die_ref;
-     struct type *utypep;
+alloc_utype (DIE_REF die_ref, struct type *utypep)
 {
   struct type **typep;
   int utypeidx;
@@ -886,10 +867,9 @@
  */
 
 static void
-free_utypes (dummy)
-     PTR dummy;
+free_utypes (PTR dummy)
 {
-  free (utypes);
+  xfree (utypes);
   utypes = NULL;
   numutypes = 0;
 }
@@ -913,8 +893,7 @@
  */
 
 static struct type *
-decode_die_type (dip)
-     struct dieinfo *dip;
+decode_die_type (struct dieinfo *dip)
 {
   struct type *type = NULL;
 
@@ -965,11 +944,8 @@
  */
 
 static struct type *
-struct_type (dip, thisdie, enddie, objfile)
-     struct dieinfo *dip;
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+struct_type (struct dieinfo *dip, char *thisdie, char *enddie,
+	     struct objfile *objfile)
 {
   struct type *type;
   struct nextfield
@@ -1163,11 +1139,8 @@
  */
 
 static void
-read_structure_scope (dip, thisdie, enddie, objfile)
-     struct dieinfo *dip;
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+read_structure_scope (struct dieinfo *dip, char *thisdie, char *enddie,
+		      struct objfile *objfile)
 {
   struct type *type;
   struct symbol *sym;
@@ -1207,8 +1180,7 @@
  */
 
 static struct type *
-decode_array_element_type (scan)
-     char *scan;
+decode_array_element_type (char *scan)
 {
   struct type *typep;
   DIE_REF die_ref;
@@ -1302,9 +1274,7 @@
  */
 
 static struct type *
-decode_subscript_data_item (scan, end)
-     char *scan;
-     char *end;
+decode_subscript_data_item (char *scan, char *end)
 {
   struct type *typep = NULL;	/* Array type we are building */
   struct type *nexttype;	/* Type of each element (may be array) */
@@ -1384,8 +1354,7 @@
  */
 
 static void
-dwarf_read_array_type (dip)
-     struct dieinfo *dip;
+dwarf_read_array_type (struct dieinfo *dip)
 {
   struct type *type;
   struct type *utype;
@@ -1449,8 +1418,7 @@
  */
 
 static void
-read_tag_pointer_type (dip)
-     struct dieinfo *dip;
+read_tag_pointer_type (struct dieinfo *dip)
 {
   struct type *type;
   struct type *utype;
@@ -1492,8 +1460,7 @@
  */
 
 static void
-read_tag_string_type (dip)
-     struct dieinfo *dip;
+read_tag_string_type (struct dieinfo *dip)
 {
   struct type *utype;
   struct type *indextype;
@@ -1564,10 +1531,7 @@
  */
 
 static void
-read_subroutine_type (dip, thisdie, enddie)
-     struct dieinfo *dip;
-     char *thisdie;
-     char *enddie;
+read_subroutine_type (struct dieinfo *dip, char *thisdie, char *enddie)
 {
   struct type *type;		/* Type that this function returns */
   struct type *ftype;		/* Function that returns above type */
@@ -1624,11 +1588,8 @@
  */
 
 static void
-read_enumeration (dip, thisdie, enddie, objfile)
-     struct dieinfo *dip;
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+read_enumeration (struct dieinfo *dip, char *thisdie, char *enddie,
+		  struct objfile *objfile)
 {
   struct type *type;
   struct symbol *sym;
@@ -1677,9 +1638,7 @@
  */
 
 static struct type *
-enum_type (dip, objfile)
-     struct dieinfo *dip;
-     struct objfile *objfile;
+enum_type (struct dieinfo *dip, struct objfile *objfile)
 {
   struct type *type;
   struct nextfield
@@ -1805,11 +1764,8 @@
  */
 
 static void
-read_func_scope (dip, thisdie, enddie, objfile)
-     struct dieinfo *dip;
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+read_func_scope (struct dieinfo *dip, char *thisdie, char *enddie,
+		 struct objfile *objfile)
 {
   register struct context_stack *new;
 
@@ -1855,8 +1811,7 @@
  */
 
 static void
-handle_producer (producer)
-     char *producer;
+handle_producer (char *producer)
 {
 
   /* If this compilation unit was compiled with g++ or gcc, then set the
@@ -1916,11 +1871,8 @@
  */
 
 static void
-read_file_scope (dip, thisdie, enddie, objfile)
-     struct dieinfo *dip;
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+read_file_scope (struct dieinfo *dip, char *thisdie, char *enddie,
+		 struct objfile *objfile)
 {
   struct cleanup *back_to;
   struct symtab *symtab;
@@ -1972,10 +1924,7 @@
  */
 
 static void
-process_dies (thisdie, enddie, objfile)
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+process_dies (char *thisdie, char *enddie, struct objfile *objfile)
 {
   char *nextdie;
   struct dieinfo di;
@@ -2118,8 +2067,7 @@
  */
 
 static void
-decode_line_numbers (linetable)
-     char *linetable;
+decode_line_numbers (char *linetable)
 {
   char *tblscan;
   char *tblend;
@@ -2192,8 +2140,7 @@
  */
 
 static int
-locval (dip)
-     struct dieinfo *dip;
+locval (struct dieinfo *dip)
 {
   unsigned short nbytes;
   unsigned short locsize;
@@ -2294,8 +2241,7 @@
  */
 
 static void
-read_ofile_symtab (pst)
-     struct partial_symtab *pst;
+read_ofile_symtab (struct partial_symtab *pst)
 {
   struct cleanup *back_to;
   unsigned long lnsize;
@@ -2319,10 +2265,10 @@
   if (bfd_seek (abfd, foffset, SEEK_SET) ||
       (bfd_read (dbbase, dbsize, 1, abfd) != dbsize))
     {
-      free (dbbase);
+      xfree (dbbase);
       error ("can't read DWARF data");
     }
-  back_to = make_cleanup (free, dbbase);
+  back_to = make_cleanup (xfree, dbbase);
 
   /* If there is a line number table associated with this compilation unit
      then read the size of this fragment in bytes, from the fragment itself.
@@ -2344,10 +2290,10 @@
       if (bfd_seek (abfd, LNFOFF (pst), SEEK_SET) ||
 	  (bfd_read (lnbase, lnsize, 1, abfd) != lnsize))
 	{
-	  free (lnbase);
+	  xfree (lnbase);
 	  error ("can't read DWARF line numbers");
 	}
-      make_cleanup (free, lnbase);
+      make_cleanup (xfree, lnbase);
     }
 
   process_dies (dbbase, dbbase + dbsize, pst->objfile);
@@ -2374,8 +2320,7 @@
  */
 
 static void
-psymtab_to_symtab_1 (pst)
-     struct partial_symtab *pst;
+psymtab_to_symtab_1 (struct partial_symtab *pst)
 {
   int i;
   struct cleanup *old_chain;
@@ -2447,8 +2392,7 @@
  */
 
 static void
-dwarf_psymtab_to_symtab (pst)
-     struct partial_symtab *pst;
+dwarf_psymtab_to_symtab (struct partial_symtab *pst)
 {
 
   if (pst != NULL)
@@ -2507,9 +2451,7 @@
  */
 
 static void
-add_enum_psymbol (dip, objfile)
-     struct dieinfo *dip;
-     struct objfile *objfile;
+add_enum_psymbol (struct dieinfo *dip, struct objfile *objfile)
 {
   char *scan;
   char *listend;
@@ -2558,9 +2500,7 @@
  */
 
 static void
-add_partial_symbol (dip, objfile)
-     struct dieinfo *dip;
-     struct objfile *objfile;
+add_partial_symbol (struct dieinfo *dip, struct objfile *objfile)
 {
   switch (dip->die_tag)
     {
@@ -2685,10 +2625,7 @@
 
 
 static void
-scan_partial_symbols (thisdie, enddie, objfile)
-     char *thisdie;
-     char *enddie;
-     struct objfile *objfile;
+scan_partial_symbols (char *thisdie, char *enddie, struct objfile *objfile)
 {
   char *nextdie;
   char *temp;
@@ -2809,12 +2746,8 @@
  */
 
 static void
-scan_compilation_units (thisdie, enddie, dbfoff, lnoffset, objfile)
-     char *thisdie;
-     char *enddie;
-     file_ptr dbfoff;
-     file_ptr lnoffset;
-     struct objfile *objfile;
+scan_compilation_units (char *thisdie, char *enddie, file_ptr dbfoff,
+			file_ptr lnoffset, struct objfile *objfile)
 {
   char *nextdie;
   struct dieinfo di;
@@ -2904,9 +2837,7 @@
  */
 
 static struct symbol *
-new_symbol (dip, objfile)
-     struct dieinfo *dip;
-     struct objfile *objfile;
+new_symbol (struct dieinfo *dip, struct objfile *objfile)
 {
   struct symbol *sym = NULL;
 
@@ -3066,10 +2997,8 @@
  */
 
 static void
-synthesize_typedef (dip, objfile, type)
-     struct dieinfo *dip;
-     struct objfile *objfile;
-     struct type *type;
+synthesize_typedef (struct dieinfo *dip, struct objfile *objfile,
+		    struct type *type)
 {
   struct symbol *sym = NULL;
 
@@ -3113,8 +3042,7 @@
  */
 
 static struct type *
-decode_mod_fund_type (typedata)
-     char *typedata;
+decode_mod_fund_type (char *typedata)
 {
   struct type *typep = NULL;
   unsigned short modcount;
@@ -3160,8 +3088,7 @@
  */
 
 static struct type *
-decode_mod_u_d_type (typedata)
-     char *typedata;
+decode_mod_u_d_type (char *typedata)
 {
   struct type *typep = NULL;
   unsigned short modcount;
@@ -3224,10 +3151,7 @@
  */
 
 static struct type *
-decode_modified_type (modifiers, modcount, mtype)
-     char *modifiers;
-     unsigned int modcount;
-     int mtype;
+decode_modified_type (char *modifiers, unsigned int modcount, int mtype)
 {
   struct type *typep = NULL;
   unsigned short fundtype;
@@ -3313,8 +3237,7 @@
  */
 
 static struct type *
-decode_fund_type (fundtype)
-     unsigned int fundtype;
+decode_fund_type (unsigned int fundtype)
 {
   struct type *typep = NULL;
 
@@ -3446,9 +3369,7 @@
  */
 
 static char *
-create_name (name, obstackp)
-     char *name;
-     struct obstack *obstackp;
+create_name (char *name, struct obstack *obstackp)
 {
   int length;
   char *newname;
@@ -3514,10 +3435,7 @@
  */
 
 static void
-basicdieinfo (dip, diep, objfile)
-     struct dieinfo *dip;
-     char *diep;
-     struct objfile *objfile;
+basicdieinfo (struct dieinfo *dip, char *diep, struct objfile *objfile)
 {
   curdie = dip;
   memset (dip, 0, sizeof (struct dieinfo));
@@ -3576,9 +3494,7 @@
  */
 
 static void
-completedieinfo (dip, objfile)
-     struct dieinfo *dip;
-     struct objfile *objfile;
+completedieinfo (struct dieinfo *dip, struct objfile *objfile)
 {
   char *diep;			/* Current pointer into raw DIE data */
   char *end;			/* Terminate DIE scan here */
@@ -3790,11 +3706,8 @@
  */
 
 static CORE_ADDR
-target_to_host (from, nbytes, signextend, objfile)
-     char *from;
-     int nbytes;
-     int signextend;		/* FIXME:  Unused */
-     struct objfile *objfile;
+target_to_host (char *from, int nbytes, int signextend,	/* FIXME:  Unused */
+		struct objfile *objfile)
 {
   CORE_ADDR rtnval;
 
@@ -3841,8 +3754,7 @@
  */
 
 static int
-attribute_size (attr)
-     unsigned int attr;
+attribute_size (unsigned int attr)
 {
   int nbytes;			/* Size of next data for this attribute */
   unsigned short form;		/* Form of the attribute */
diff --git a/gdb/elfread.c b/gdb/elfread.c
index edd4786..2a5e536 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -108,10 +108,7 @@
    -kingdon).  */
 
 static void
-elf_locate_sections (ignore_abfd, sectp, eip)
-     bfd *ignore_abfd;
-     asection *sectp;
-     PTR eip;
+elf_locate_sections (bfd *ignore_abfd, asection *sectp, PTR eip)
 {
   register struct elfinfo *ei;
 
@@ -143,8 +140,7 @@
 #if 0				/* Currently unused */
 
 char *
-elf_interpreter (abfd)
-     bfd *abfd;
+elf_interpreter (bfd *abfd)
 {
   sec_ptr interp_sec;
   unsigned size;
@@ -171,41 +167,17 @@
 #endif
 
 static struct minimal_symbol *
-record_minimal_symbol_and_info (name, address, ms_type, info, bfd_section,
-				objfile)
-     char *name;
-     CORE_ADDR address;
-     enum minimal_symbol_type ms_type;
-     char *info;		/* FIXME, is this really char *? */
-     asection *bfd_section;
-     struct objfile *objfile;
+record_minimal_symbol_and_info (char *name, CORE_ADDR address,
+				enum minimal_symbol_type ms_type, char *info,	/* FIXME, is this really char *? */
+				asection *bfd_section, struct objfile *objfile)
 {
-  int section;
-
-  /* Guess the section from the type.  This is likely to be wrong in
-     some cases.  */
-  switch (ms_type)
-    {
-    case mst_text:
-    case mst_file_text:
-      section = bfd_section->index;
 #ifdef SMASH_TEXT_ADDRESS
-      SMASH_TEXT_ADDRESS (address);
+  if (ms_type == mst_text || ms_type == mst_file_text)
+    SMASH_TEXT_ADDRESS (address);
 #endif
-      break;
-    case mst_data:
-    case mst_file_data:
-    case mst_bss:
-    case mst_file_bss:
-      section = bfd_section->index;
-      break;
-    default:
-      section = -1;
-      break;
-    }
 
   return prim_record_minimal_symbol_and_info
-    (name, address, ms_type, info, section, bfd_section, objfile);
+    (name, address, ms_type, info, bfd_section->index, bfd_section, objfile);
 }
 
 /*
@@ -233,9 +205,7 @@
  */
 
 static void
-elf_symtab_read (objfile, dynamic)
-     struct objfile *objfile;
-     int dynamic;
+elf_symtab_read (struct objfile *objfile, int dynamic)
 {
   long storage_needed;
   asymbol *sym;
@@ -279,7 +249,7 @@
   if (storage_needed > 0)
     {
       symbol_table = (asymbol **) xmalloc (storage_needed);
-      back_to = make_cleanup (free, symbol_table);
+      back_to = make_cleanup (xfree, symbol_table);
       if (dynamic)
 	number_of_symbols = bfd_canonicalize_dynamic_symtab (objfile->obfd,
 							     symbol_table);
@@ -434,7 +404,7 @@
 		}
 	      else if (sym->section->flags & SEC_ALLOC)
 		{
-		  if (sym->flags & BSF_GLOBAL)
+		  if (sym->flags & (BSF_GLOBAL | BSF_WEAK))
 		    {
 		      if (sym->section->flags & SEC_LOAD)
 			{
@@ -485,11 +455,16 @@
 				    (char *) filesym->name;
 				}
 			    }
-			  if (sectinfo->sections[index] != 0)
-			    {
-			      complain (&section_info_dup_complaint,
-					sectinfo->filename);
+			  if (index != -1)
+			    { 
+			      if (sectinfo->sections[index] != 0)
+				{
+				  complain (&section_info_dup_complaint,
+					    sectinfo->filename);
+				}
 			    }
+			  else
+			    internal_error ("Section index uninitialized.");
 			  /* Bfd symbols are section relative. */
 			  symaddr = sym->value + sym->section->vma;
 			  /* Relocate non-absolute symbols by the section offset. */
@@ -497,7 +472,10 @@
 			    {
 			      symaddr += offset;
 			    }
-			  sectinfo->sections[index] = symaddr;
+			  if (index != -1)
+			    sectinfo->sections[index] = symaddr;
+			  else
+			    internal_error ("Section index uninitialized.");
 			  /* The special local symbols don't go in the
 			     minimal symbol table, so ignore this one. */
 			  continue;
@@ -578,9 +556,7 @@
    capability even for files compiled without -g.  */
 
 static void
-elf_symfile_read (objfile, mainline)
-     struct objfile *objfile;
-     int mainline;
+elf_symfile_read (struct objfile *objfile, int mainline)
 {
   bfd *abfd = objfile->obfd;
   struct elfinfo ei;
@@ -688,8 +664,7 @@
    stab_section_info's, that might be dangling from it.  */
 
 static void
-free_elfinfo (objp)
-     PTR objp;
+free_elfinfo (PTR objp)
 {
   struct objfile *objfile = (struct objfile *) objp;
   struct dbx_symfile_info *dbxinfo = objfile->sym_stab_info;
@@ -714,8 +689,7 @@
    We reinitialize buildsym, since we may be reading stabs from an ELF file.  */
 
 static void
-elf_new_init (ignore)
-     struct objfile *ignore;
+elf_new_init (struct objfile *ignore)
 {
   stabsread_new_init ();
   buildsym_new_init ();
@@ -727,8 +701,7 @@
    objfile struct from the global list of known objfiles. */
 
 static void
-elf_symfile_finish (objfile)
-     struct objfile *objfile;
+elf_symfile_finish (struct objfile *objfile)
 {
   if (objfile->sym_stab_info != NULL)
     {
@@ -746,8 +719,7 @@
    just a stub. */
 
 static void
-elf_symfile_init (objfile)
-     struct objfile *objfile;
+elf_symfile_init (struct objfile *objfile)
 {
   /* ELF objects may be reordered, so set OBJF_REORDERED.  If we
      find this causes a significant slowdown in gdb then we could
@@ -764,9 +736,7 @@
    with wierd names.  Go get 'em when needed.  */
 
 void
-elfstab_offset_sections (objfile, pst)
-     struct objfile *objfile;
-     struct partial_symtab *pst;
+elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst)
 {
   char *filename = pst->filename;
   struct dbx_symfile_info *dbx = objfile->sym_stab_info;
@@ -809,7 +779,7 @@
       pst->section_offsets = (struct section_offsets *)
 	obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS);
       for (i = 0; i < SECT_OFF_MAX; i++)
-	ANOFFSET (pst->section_offsets, i) = maybe->sections[i];
+	(pst->section_offsets)->offsets[i] = maybe->sections[i];
       return;
     }
 
@@ -832,7 +802,7 @@
 };
 
 void
-_initialize_elfread ()
+_initialize_elfread (void)
 {
   add_symtab_fns (&elf_sym_fns);
 }
diff --git a/gdb/environ.c b/gdb/environ.c
index c4a5adc..4ce0080 100644
--- a/gdb/environ.c
+++ b/gdb/environ.c
@@ -28,7 +28,7 @@
 /* Return a new environment object.  */
 
 struct environ *
-make_environ ()
+make_environ (void)
 {
   register struct environ *e;
 
@@ -43,15 +43,14 @@
 /* Free an environment and all the strings in it.  */
 
 void
-free_environ (e)
-     register struct environ *e;
+free_environ (register struct environ *e)
 {
   register char **vector = e->vector;
 
   while (*vector)
-    free (*vector++);
+    xfree (*vector++);
 
-  free (e);
+  xfree (e);
 }
 
 /* Copy the environment given to this process into E.
@@ -59,8 +58,7 @@
    that all strings in these environments are safe to free.  */
 
 void
-init_environ (e)
-     register struct environ *e;
+init_environ (register struct environ *e)
 {
   extern char **environ;
   register int i;
@@ -92,8 +90,7 @@
    This is used to get something to pass to execve.  */
 
 char **
-environ_vector (e)
-     struct environ *e;
+environ_vector (struct environ *e)
 {
   return e->vector;
 }
@@ -101,9 +98,7 @@
 /* Return the value in environment E of variable VAR.  */
 
 char *
-get_in_environ (e, var)
-     const struct environ *e;
-     const char *var;
+get_in_environ (const struct environ *e, const char *var)
 {
   register int len = strlen (var);
   register char **vector = e->vector;
@@ -119,10 +114,7 @@
 /* Store the value in E of VAR as VALUE.  */
 
 void
-set_in_environ (e, var, value)
-     struct environ *e;
-     const char *var;
-     const char *value;
+set_in_environ (struct environ *e, const char *var, const char *value)
 {
   register int i;
   register int len = strlen (var);
@@ -145,7 +137,7 @@
       vector[i + 1] = 0;
     }
   else
-    free (s);
+    xfree (s);
 
   s = (char *) xmalloc (len + strlen (value) + 2);
   strcpy (s, var);
@@ -169,9 +161,7 @@
 /* Remove the setting for variable VAR from environment E.  */
 
 void
-unset_in_environ (e, var)
-     struct environ *e;
-     char *var;
+unset_in_environ (struct environ *e, char *var)
 {
   register int len = strlen (var);
   register char **vector = e->vector;
@@ -181,7 +171,7 @@
     {
       if (STREQN (s, var, len) && s[len] == '=')
 	{
-	  free (s);
+	  xfree (s);
 	  /* Walk through the vector, shuffling args down by one, including
 	     the NULL terminator.  Can't use memcpy() here since the regions
 	     overlap, and memmove() might not be available. */
diff --git a/gdb/eval.c b/gdb/eval.c
index 9cfac7b..044641d 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -65,11 +65,8 @@
 inline
 #endif
 static value_ptr
-evaluate_subexp (expect_type, exp, pos, noside)
-     struct type *expect_type;
-     register struct expression *exp;
-     register int *pos;
-     enum noside noside;
+evaluate_subexp (struct type *expect_type, register struct expression *exp,
+		 register int *pos, enum noside noside)
 {
   return (*exp->language_defn->evaluate_exp) (expect_type, exp, pos, noside);
 }
@@ -78,8 +75,7 @@
    and return the result as a number.  */
 
 CORE_ADDR
-parse_and_eval_address (exp)
-     char *exp;
+parse_and_eval_address (char *exp)
 {
   struct expression *expr = parse_expression (exp);
   register CORE_ADDR addr;
@@ -95,8 +91,7 @@
    and advanced that variable across the characters parsed.  */
 
 CORE_ADDR
-parse_and_eval_address_1 (expptr)
-     char **expptr;
+parse_and_eval_address_1 (char **expptr)
 {
   struct expression *expr = parse_exp_1 (expptr, (struct block *) 0, 0);
   register CORE_ADDR addr;
@@ -108,9 +103,23 @@
   return addr;
 }
 
+/* Like parse_and_eval_address, but treats the value of the expression
+   as an integer, not an address, returns a LONGEST, not a CORE_ADDR */
+LONGEST
+parse_and_eval_long (char *exp)
+{
+  struct expression *expr = parse_expression (exp);
+  register LONGEST retval;
+  register struct cleanup *old_chain =
+    make_cleanup (free_current_contents, &expr);
+
+  retval = value_as_long (evaluate_expression (expr));
+  do_cleanups (old_chain);
+  return (retval);
+}
+
 value_ptr
-parse_and_eval (exp)
-     char *exp;
+parse_and_eval (char *exp)
 {
   struct expression *expr = parse_expression (exp);
   register value_ptr val;
@@ -127,8 +136,7 @@
    EXPP is advanced to point to the comma.  */
 
 value_ptr
-parse_to_comma_and_eval (expp)
-     char **expp;
+parse_to_comma_and_eval (char **expp)
 {
   struct expression *expr = parse_exp_1 (expp, (struct block *) 0, 1);
   register value_ptr val;
@@ -146,8 +154,7 @@
    See expression.h for info on the format of an expression.  */
 
 value_ptr
-evaluate_expression (exp)
-     struct expression *exp;
+evaluate_expression (struct expression *exp)
 {
   int pc = 0;
   return evaluate_subexp (NULL_TYPE, exp, &pc, EVAL_NORMAL);
@@ -157,8 +164,7 @@
    and getting a value whose type alone is correct.  */
 
 value_ptr
-evaluate_type (exp)
-     struct expression *exp;
+evaluate_type (struct expression *exp)
 {
   int pc = 0;
   return evaluate_subexp (NULL_TYPE, exp, &pc, EVAL_AVOID_SIDE_EFFECTS);
@@ -168,9 +174,7 @@
    returning the label.  Otherwise, does nothing and returns NULL. */
 
 static char *
-get_label (exp, pos)
-     register struct expression *exp;
-     int *pos;
+get_label (register struct expression *exp, int *pos)
 {
   if (exp->elts[*pos].opcode == OP_LABELED)
     {
@@ -184,16 +188,12 @@
     return NULL;
 }
 
-/* This function evaluates tupes (in Chill) or brace-initializers
+/* This function evaluates tuples (in Chill) or brace-initializers
    (in C/C++) for structure types.  */
 
 static value_ptr
-evaluate_struct_tuple (struct_val, exp, pos, noside, nargs)
-     value_ptr struct_val;
-     register struct expression *exp;
-     register int *pos;
-     enum noside noside;
-     int nargs;
+evaluate_struct_tuple (value_ptr struct_val, register struct expression *exp,
+		       register int *pos, enum noside noside, int nargs)
 {
   struct type *struct_type = check_typedef (VALUE_TYPE (struct_val));
   struct type *substruct_type = struct_type;
@@ -335,12 +335,9 @@
    Returns last index value.  */
 
 static LONGEST
-init_array_element (array, element, exp, pos, noside, low_bound, high_bound)
-     value_ptr array, element;
-     register struct expression *exp;
-     register int *pos;
-     enum noside noside;
-     LONGEST low_bound, high_bound;
+init_array_element (value_ptr array, value_ptr element,
+		    register struct expression *exp, register int *pos,
+		    enum noside noside, LONGEST low_bound, LONGEST high_bound)
 {
   LONGEST index;
   int element_size = TYPE_LENGTH (VALUE_TYPE (element));
@@ -379,11 +376,9 @@
 }
 
 value_ptr
-evaluate_subexp_standard (expect_type, exp, pos, noside)
-     struct type *expect_type;
-     register struct expression *exp;
-     register int *pos;
-     enum noside noside;
+evaluate_subexp_standard (struct type *expect_type,
+			  register struct expression *exp, register int *pos,
+			  enum noside noside)
 {
   enum exp_opcode op;
   int tem, tem2, tem3;
@@ -1781,10 +1776,8 @@
    then only the type of the result need be correct.  */
 
 static value_ptr
-evaluate_subexp_for_address (exp, pos, noside)
-     register struct expression *exp;
-     register int *pos;
-     enum noside noside;
+evaluate_subexp_for_address (register struct expression *exp, register int *pos,
+			     enum noside noside)
 {
   enum exp_opcode op;
   register int pc;
@@ -1863,10 +1856,8 @@
  */
 
 value_ptr
-evaluate_subexp_with_coercion (exp, pos, noside)
-     register struct expression *exp;
-     register int *pos;
-     enum noside noside;
+evaluate_subexp_with_coercion (register struct expression *exp,
+			       register int *pos, enum noside noside)
 {
   register enum exp_opcode op;
   register int pc;
@@ -1902,9 +1893,7 @@
    Advance *POS over the subexpression.  */
 
 static value_ptr
-evaluate_subexp_for_sizeof (exp, pos)
-     register struct expression *exp;
-     register int *pos;
+evaluate_subexp_for_sizeof (register struct expression *exp, register int *pos)
 {
   enum exp_opcode op;
   register int pc;
@@ -1954,9 +1943,7 @@
 /* Parse a type expression in the string [P..P+LENGTH). */
 
 struct type *
-parse_and_eval_type (p, length)
-     char *p;
-     int length;
+parse_and_eval_type (char *p, int length)
 {
   char *tmp = (char *) alloca (length + 4);
   struct expression *expr;
@@ -1972,8 +1959,7 @@
 }
 
 int
-calc_f77_array_dims (array_type)
-     struct type *array_type;
+calc_f77_array_dims (struct type *array_type)
 {
   int ndimen = 1;
   struct type *tmp_type;
diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index 6a66ff0..ad7ba66f 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -23,9 +23,15 @@
 #include "top.h"
 #include "event-loop.h"
 #include "event-top.h"
+
 #ifdef HAVE_POLL
+#if defined (HAVE_POLL_H)
 #include <poll.h>
+#elif defined (HAVE_SYS_POLL_H)
+#include <sys/poll.h>
 #endif
+#endif
+
 #include <sys/types.h>
 #include <string.h>
 #include <errno.h>
@@ -90,7 +96,7 @@
    ready. The procedure PROC associated with each event is always the
    same (handle_file_event).  Its duty is to invoke the handler
    associated with the file descriptor whose state change generated
-   the event, plus doing other cleanups adn such. */
+   the event, plus doing other cleanups and such. */
 
 struct gdb_event
   {
@@ -242,7 +248,7 @@
   }
 sighandler_list;
 
-/* Is any of the handlers ready?  Check this variable using
+/* Are any of the handlers ready?  Check this variable using
    check_async_ready. This is used by process_event, to determine
    whether or not to invoke the invoke_async_signal_handler
    function. */
@@ -371,7 +377,7 @@
 	  if (event_ptr->next_event == NULL)
 	    event_queue.last_event = prev_ptr;
 	}
-      free ((char *) event_ptr);
+      xfree (event_ptr);
 
       /* Now call the procedure associated with the event. */
       (*proc) (fd);
@@ -386,7 +392,7 @@
    wait for something to happen (via gdb_wait_for_event), then process
    it.  Returns >0 if something was done otherwise returns <0 (this
    can happen if there are no event sources to wait for).  If an error
-   occures catch_errors() which calls this function returns zero. */
+   occurs catch_errors() which calls this function returns zero. */
 
 static int
 gdb_do_one_event (void *data)
@@ -614,7 +620,7 @@
 	      j++;
 	    }
 	}
-      free (gdb_notifier.poll_fds);
+      xfree (gdb_notifier.poll_fds);
       gdb_notifier.poll_fds = new_poll_fds;
       gdb_notifier.num_fds--;
 #else
@@ -662,7 +668,7 @@
 	;
       prev_ptr->next_file = file_ptr->next_file;
     }
-  free ((char *) file_ptr);
+  xfree (file_ptr);
 }
 
 /* Handle the given event by calling the procedure associated to the
@@ -967,7 +973,7 @@
       if (sighandler_list.last_handler == (*async_handler_ptr))
 	sighandler_list.last_handler = prev_ptr;
     }
-  free ((char *) (*async_handler_ptr));
+  xfree ((*async_handler_ptr));
   (*async_handler_ptr) = NULL;
 }
 
@@ -1074,7 +1080,7 @@
 	;
       prev_timer->next = timer_ptr->next;
     }
-  free ((char *) timer_ptr);
+  xfree (timer_ptr);
 
   gdb_notifier.timeout_valid = 0;
 }
@@ -1105,7 +1111,7 @@
       timer_ptr = timer_ptr->next;
       /* Call the procedure associated with that timer. */
       (*saved_timer->proc) (saved_timer->client_data);
-      free (saved_timer);
+      xfree (saved_timer);
     }
 
   gdb_notifier.timeout_valid = 0;
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 34bf5df..e2c511c 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -157,7 +157,7 @@
 readline_input_state;
 
 
-/* Wrapper function foe calling into the readline library. The event
+/* Wrapper function for calling into the readline library. The event
    loop expects the callback function to have a paramter, while readline 
    expects none. */
 static void
@@ -393,13 +393,13 @@
        in effect, until the user does another 'set prompt'. */
     if (strcmp (PROMPT (0), PROMPT (-1)))
       {
-	free (PROMPT (-1));
+	xfree (PROMPT (-1));
 	PROMPT (-1) = savestring (PROMPT (0), strlen (PROMPT (0)));
       }
 
-  free (PREFIX (0));
-  free (PROMPT (0));
-  free (SUFFIX (0));
+  xfree (PREFIX (0));
+  xfree (PROMPT (0));
+  xfree (SUFFIX (0));
   the_prompts.top--;
 }
 
@@ -487,7 +487,7 @@
   quit_flag = 0;
   if (instream == stdin && stdin_is_tty)
     reinitialize_more_filter ();
-  old_chain = make_cleanup (command_loop_marker, 0);
+  old_chain = make_cleanup (null_cleanup, 0);
 
 #if defined(TUI)
   insert_mode = 0;
@@ -515,7 +515,7 @@
   execute_command (command, instream == stdin);
 
   /* Set things up for this function to be compete later, once the
-     executin has completed, if we are doing an execution command,
+     execution has completed, if we are doing an execution command,
      otherwise, just go ahead and finish. */
   if (target_can_async_p () && target_executing)
     {
@@ -643,7 +643,7 @@
     {
       strcpy (linebuffer, readline_input_state.linebuffer);
       p = readline_input_state.linebuffer_ptr;
-      free (readline_input_state.linebuffer);
+      xfree (readline_input_state.linebuffer);
       more_to_come = 0;
       pop_prompt ();
     }
@@ -690,7 +690,7 @@
   while (*p1)
     *p++ = *p1++;
 
-  free (rl);			/* Allocated in readline.  */
+  xfree (rl);			/* Allocated in readline.  */
 
   if (*(p - 1) == '\\')
     {
@@ -749,7 +749,7 @@
 	  /* If there was an error, call this function again.  */
 	  if (expanded < 0)
 	    {
-	      free (history_value);
+	      xfree (history_value);
 	      return;
 	    }
 	  if (strlen (history_value) > linelength)
@@ -759,7 +759,7 @@
 	    }
 	  strcpy (linebuffer, history_value);
 	  p = linebuffer + strlen (linebuffer);
-	  free (history_value);
+	  xfree (history_value);
 	}
     }
 
@@ -868,7 +868,7 @@
 	       if we are called again fgetc will still return EOF and
 	       we'll return NULL then.  */
 	    break;
-	  free (result);
+	  xfree (result);
 	  (*input_handler) (0);
 	}
 
@@ -1016,8 +1016,7 @@
 /* Tell the event loop what to do if SIGHUP is received. 
    See event-signal.c. */
 static void
-handle_sighup (sig)
-     int sig;
+handle_sighup (int sig)
 {
   mark_async_signal_handler_wrapper (sighup_token);
   signal (sig, handle_sighup);
diff --git a/gdb/exec.c b/gdb/exec.c
index 76d4928..6c956bf 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -27,6 +27,7 @@
 #include "language.h"
 #include "symfile.h"
 #include "objfiles.h"
+#include "completer.h"
 
 #ifdef USG
 #include <sys/types.h>
@@ -95,8 +96,7 @@
 
 /* ARGSUSED */
 static void
-exec_close (quitting)
-     int quitting;
+exec_close (int quitting)
 {
   int need_symtab_cleanup = 0;
   struct vmap *vp, *nxt;
@@ -126,7 +126,7 @@
          FIXME-as-well: free_objfile already free'd vp->name, so it isn't
          valid here.  */
       free_named_symtabs (vp->name);
-      free (vp);
+      xfree (vp);
     }
 
   vmap = NULL;
@@ -138,13 +138,13 @@
       if (!bfd_close (exec_bfd))
 	warning ("cannot close \"%s\": %s",
 		 name, bfd_errmsg (bfd_get_error ()));
-      free (name);
+      xfree (name);
       exec_bfd = NULL;
     }
 
   if (exec_ops.to_sections)
     {
-      free ((PTR) exec_ops.to_sections);
+      xfree (exec_ops.to_sections);
       exec_ops.to_sections = NULL;
       exec_ops.to_sections_end = NULL;
     }
@@ -168,9 +168,7 @@
    we're supplying the exec pathname late for good reason.) */
 
 void
-exec_file_attach (args, from_tty)
-     char *args;
-     int from_tty;
+exec_file_attach (char *args, int from_tty)
 {
   char **argv;
   char *filename;
@@ -201,12 +199,12 @@
 	error ("No executable file name was specified");
 
       filename = tilde_expand (*argv);
-      make_cleanup (free, filename);
+      make_cleanup (xfree, filename);
 
       scratch_chan = openp (getenv ("PATH"), 1, filename,
 		   write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY, 0,
 			    &scratch_pathname);
-#if defined(__GO32__) || defined(_WIN32)
+#if defined(__GO32__) || defined(_WIN32) || defined(__CYGWIN__)
       if (scratch_chan < 0)
 	{
 	  char *exename = alloca (strlen (filename) + 5);
@@ -228,7 +226,7 @@
          via the exec_bfd->name pointer, so we need to make another copy and
          leave exec_bfd as the new owner of the original copy. */
       scratch_pathname = xstrdup (scratch_pathname);
-      make_cleanup (free, scratch_pathname);
+      make_cleanup (xfree, scratch_pathname);
 
       if (!bfd_check_format (exec_bfd, bfd_object))
 	{
@@ -311,9 +309,7 @@
    which can take multiple args. */
 
 void
-exec_file_command (args, from_tty)
-     char *args;
-     int from_tty;
+exec_file_command (char *args, int from_tty)
 {
   target_preopen (from_tty);
   exec_file_attach (args, from_tty);
@@ -324,9 +320,7 @@
    command was added?  */
 
 static void
-file_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+file_command (char *arg, int from_tty)
 {
   /* FIXME, if we lose on reading the symbol file, we should revert
      the exec file, but that's rough.  */
@@ -342,10 +336,7 @@
    we cast it back to its proper type.  */
 
 static void
-add_to_section_table (abfd, asect, table_pp_char)
-     bfd *abfd;
-     sec_ptr asect;
-     PTR table_pp_char;
+add_to_section_table (bfd *abfd, sec_ptr asect, PTR table_pp_char)
 {
   struct section_table **table_pp = (struct section_table **) table_pp_char;
   flagword aflag;
@@ -366,15 +357,14 @@
    Returns 0 if OK, 1 on error.  */
 
 int
-build_section_table (some_bfd, start, end)
-     bfd *some_bfd;
-     struct section_table **start, **end;
+build_section_table (bfd *some_bfd, struct section_table **start,
+		     struct section_table **end)
 {
   unsigned count;
 
   count = bfd_count_sections (some_bfd);
   if (*start)
-    free ((PTR) * start);
+    xfree (* start);
   *start = (struct section_table *) xmalloc (count * sizeof (**start));
   *end = *start;
   bfd_map_over_sections (some_bfd, add_to_section_table, (char *) end);
@@ -385,10 +375,7 @@
 }
 
 static void
-bfdsec_to_vmap (abfd, sect, arg3)
-     bfd *abfd;
-     sec_ptr sect;
-     PTR arg3;
+bfdsec_to_vmap (bfd *abfd, sec_ptr sect, PTR arg3)
 {
   struct vmap_and_bfd *vmap_bfd = (struct vmap_and_bfd *) arg3;
   struct vmap *vp;
@@ -418,9 +405,7 @@
    Return the new vmap.  */
 
 struct vmap *
-map_vmap (abfd, arch)
-     bfd *abfd;
-     bfd *arch;
+map_vmap (bfd *abfd, bfd *arch)
 {
   struct vmap_and_bfd vmap_bfd;
   struct vmap *vp, **vpp;
@@ -463,12 +448,8 @@
    we just tail-call it with more arguments to select between them.  */
 
 int
-xfer_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;
+xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+	     struct target_ops *target)
 {
   boolean res;
   struct section_table *p;
@@ -528,9 +509,7 @@
 
 
 void
-print_section_info (t, abfd)
-     struct target_ops *t;
-     bfd *abfd;
+print_section_info (struct target_ops *t, bfd *abfd)
 {
   struct section_table *p;
 
@@ -561,8 +540,7 @@
 }
 
 static void
-exec_files_info (t)
-     struct target_ops *t;
+exec_files_info (struct target_ops *t)
 {
   print_section_info (t, exec_bfd);
 
@@ -596,10 +574,8 @@
    in the exec objfile.  */
 
 void
-exec_set_section_offsets (text_off, data_off, bss_off)
-     bfd_signed_vma text_off;
-     bfd_signed_vma data_off;
-     bfd_signed_vma bss_off;
+exec_set_section_offsets (bfd_signed_vma text_off, bfd_signed_vma data_off,
+			  bfd_signed_vma bss_off)
 {
   struct section_table *sect;
 
@@ -630,9 +606,7 @@
 }
 
 static void
-set_section_command (args, from_tty)
-     char *args;
-     int from_tty;
+set_section_command (char *args, int from_tty)
 {
   struct section_table *p;
   char *secname;
@@ -676,9 +650,7 @@
    breakpoint_init_inferior).  */
 
 static int
-ignore (addr, contents)
-     CORE_ADDR addr;
-     char *contents;
+ignore (CORE_ADDR addr, char *contents)
 {
   return 0;
 }
@@ -687,7 +659,7 @@
    defined.  */
 
 void
-init_exec_ops ()
+init_exec_ops (void)
 {
   exec_ops.to_shortname = "exec";
   exec_ops.to_longname = "Local exec file";
@@ -710,7 +682,7 @@
 }
 
 void
-_initialize_exec ()
+_initialize_exec (void)
 {
   struct cmd_list_element *c;
 
diff --git a/gdb/expprint.c b/gdb/expprint.c
index edf4f8c..a21b723 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -36,9 +36,7 @@
 			  enum precedence);
 
 void
-print_expression (exp, stream)
-     struct expression *exp;
-     struct ui_file *stream;
+print_expression (struct expression *exp, struct ui_file *stream)
 {
   int pc = 0;
   print_subexp (exp, &pc, stream, PREC_NULL);
@@ -50,11 +48,8 @@
    parentheses are needed here.  */
 
 static void
-print_subexp (exp, pos, stream, prec)
-     register struct expression *exp;
-     register int *pos;
-     struct ui_file *stream;
-     enum precedence prec;
+print_subexp (register struct expression *exp, register int *pos,
+	      struct ui_file *stream, enum precedence prec)
 {
   register unsigned tem;
   register const struct op_print *op_print_tab;
@@ -488,8 +483,7 @@
    a string.   NULL indicates that the opcode was not found in the
    current language table.  */
 char *
-op_string (op)
-     enum exp_opcode op;
+op_string (enum exp_opcode op)
 {
   int tem;
   register const struct op_print *op_print_tab;
@@ -507,8 +501,7 @@
 static char *op_name (int opcode);
 
 static char *
-op_name (opcode)
-     int opcode;
+op_name (int opcode)
 {
   switch (opcode)
     {
@@ -693,10 +686,8 @@
 }
 
 void
-dump_prefix_expression (exp, stream, note)
-     struct expression *exp;
-     struct ui_file *stream;
-     char *note;
+dump_prefix_expression (struct expression *exp, struct ui_file *stream,
+			char *note)
 {
   int elt;
   char *opcode_name;
@@ -740,10 +731,7 @@
 			int elt);
 
 static int
-dump_subexp (exp, stream, elt)
-     struct expression *exp;
-     struct ui_file *stream;
-     int elt;
+dump_subexp (struct expression *exp, struct ui_file *stream, int elt)
 {
   static int indent = 0;
   int i;
@@ -973,10 +961,8 @@
 }
 
 void
-dump_postfix_expression (exp, stream, note)
-     struct expression *exp;
-     struct ui_file *stream;
-     char *note;
+dump_postfix_expression (struct expression *exp, struct ui_file *stream,
+			 char *note)
 {
   int elt;
 
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 7a5f861..c466c51 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -98,10 +98,7 @@
    be replaced with a true F77 version.  */
 
 static void
-f_emit_char (c, stream, quoter)
-     register int c;
-     struct ui_file *stream;
-     int quoter;
+f_emit_char (register int c, struct ui_file *stream, int quoter)
 {
   c &= 0xFF;			/* Avoid sign bit follies */
 
@@ -147,9 +144,7 @@
    be replaced with a true F77version. */
 
 static void
-f_printchar (c, stream)
-     int c;
-     struct ui_file *stream;
+f_printchar (int c, struct ui_file *stream)
 {
   fputs_filtered ("'", stream);
   LA_EMIT_CHAR (c, stream, '\'');
@@ -164,12 +159,8 @@
    be replaced with a true F77 version. */
 
 static void
-f_printstr (stream, string, length, width, force_ellipses)
-     struct ui_file *stream;
-     char *string;
-     unsigned int length;
-     int width;
-     int force_ellipses;
+f_printstr (struct ui_file *stream, char *string, unsigned int length,
+	    int width, int force_ellipses)
 {
   register unsigned int i;
   unsigned int things_printed = 0;
@@ -256,9 +247,7 @@
    by an experienced F77 programmer. */
 
 static struct type *
-f_create_fundamental_type (objfile, typeid)
-     struct objfile *objfile;
-     int typeid;
+f_create_fundamental_type (struct objfile *objfile, int typeid)
 {
   register struct type *type = NULL;
 
@@ -471,6 +460,7 @@
   f_builtin_types,
   range_check_on,
   type_check_on,
+  case_sensitive_off,
   f_parse,			/* parser */
   f_error,			/* parser error function */
   evaluate_subexp_standard,
@@ -493,7 +483,7 @@
 };
 
 void
-_initialize_f_language ()
+_initialize_f_language (void)
 {
   builtin_type_f_void =
     init_type (TYPE_CODE_VOID, 1,
@@ -576,7 +566,7 @@
 
 #if 0
 static SAVED_BF_PTR
-allocate_saved_bf_node ()
+allocate_saved_bf_node (void)
 {
   SAVED_BF_PTR new;
 
@@ -585,7 +575,7 @@
 }
 
 static SAVED_FUNCTION *
-allocate_saved_function_node ()
+allocate_saved_function_node (void)
 {
   SAVED_FUNCTION *new;
 
@@ -594,7 +584,7 @@
 }
 
 static SAVED_F77_COMMON_PTR
-allocate_saved_f77_common_node ()
+allocate_saved_f77_common_node (void)
 {
   SAVED_F77_COMMON_PTR new;
 
@@ -603,7 +593,7 @@
 }
 
 static COMMON_ENTRY_PTR
-allocate_common_entry_node ()
+allocate_common_entry_node (void)
 {
   COMMON_ENTRY_PTR new;
 
@@ -630,11 +620,7 @@
    the global common block chain */
 
 static void
-add_common_block (name, offset, secnum, func_stab)
-     char *name;
-     CORE_ADDR offset;
-     int secnum;
-     char *func_stab;
+add_common_block (char *name, CORE_ADDR offset, int secnum, char *func_stab)
 {
   SAVED_F77_COMMON_PTR tmp;
   char *c, *local_copy_func_stab;
@@ -649,7 +635,7 @@
       STREQ (name, BLANK_COMMON_NAME_MF77))
     {
 
-      free (name);
+      xfree (name);
       name = alloca (strlen (BLANK_COMMON_NAME_LOCAL) + 1);
       strcpy (name, BLANK_COMMON_NAME_LOCAL);
     }
@@ -703,8 +689,7 @@
 
 #if 0
 static void
-add_common_entry (entry_sym_ptr)
-     struct symbol *entry_sym_ptr;
+add_common_entry (struct symbol *entry_sym_ptr)
 {
   COMMON_ENTRY_PTR tmp;
 
@@ -741,8 +726,7 @@
 
 #if 0
 static SAVED_F77_COMMON_PTR
-find_first_common_named (name)
-     char *name;
+find_first_common_named (char *name)
 {
 
   SAVED_F77_COMMON_PTR tmp;
@@ -764,9 +748,7 @@
    that belongs to function funcname */
 
 SAVED_F77_COMMON_PTR
-find_common_for_function (name, funcname)
-     char *name;
-     char *funcname;
+find_common_for_function (char *name, char *funcname)
 {
 
   SAVED_F77_COMMON_PTR tmp;
@@ -791,10 +773,7 @@
    "name."  */
 
 static void
-patch_common_entries (blk, offset, secnum)
-     SAVED_F77_COMMON_PTR blk;
-     CORE_ADDR offset;
-     int secnum;
+patch_common_entries (SAVED_F77_COMMON_PTR blk, CORE_ADDR offset, int secnum)
 {
   COMMON_ENTRY_PTR entry;
 
@@ -819,10 +798,7 @@
    (which is where common data lives). */
 
 static void
-patch_all_commons_by_name (name, offset, secnum)
-     char *name;
-     CORE_ADDR offset;
-     int secnum;
+patch_all_commons_by_name (char *name, CORE_ADDR offset, int secnum)
 {
 
   SAVED_F77_COMMON_PTR tmp;
@@ -833,7 +809,7 @@
   if ((STREQ (name, BLANK_COMMON_NAME_ORIGINAL)) ||
       (STREQ (name, BLANK_COMMON_NAME_MF77)))
     {
-      free (name);
+      xfree (name);
       name = alloca (strlen (BLANK_COMMON_NAME_LOCAL) + 1);
       strcpy (name, BLANK_COMMON_NAME_LOCAL);
     }
@@ -890,7 +866,7 @@
 
 #if 0
 static void
-clear_bf_list ()
+clear_bf_list (void)
 {
 
   SAVED_BF_PTR tmp = saved_bf_list;
@@ -899,7 +875,7 @@
   while (tmp != NULL)
     {
       next = tmp->next;
-      free (tmp);
+      xfree (tmp);
       tmp = next;
     }
   saved_bf_list = NULL;
@@ -911,8 +887,7 @@
 #if 0
 
 static long
-get_bf_for_fcn (the_function)
-     long the_function;
+get_bf_for_fcn (long the_function)
 {
   SAVED_BF_PTR tmp;
   int nprobes = 0;
@@ -963,7 +938,7 @@
 static SAVED_FUNCTION_PTR saved_function_list_end = NULL;
 
 static void
-clear_function_list ()
+clear_function_list (void)
 {
   SAVED_FUNCTION_PTR tmp = saved_function_list;
   SAVED_FUNCTION_PTR next = NULL;
@@ -971,7 +946,7 @@
   while (tmp != NULL)
     {
       next = tmp->next;
-      free (tmp);
+      xfree (tmp);
       tmp = next;
     }
 
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index db6e001..681b449 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -59,12 +59,8 @@
 /* LEVEL is the depth to indent lines by.  */
 
 void
-f_print_type (type, varstring, stream, show, level)
-     struct type *type;
-     char *varstring;
-     struct ui_file *stream;
-     int show;
-     int level;
+f_print_type (struct type *type, char *varstring, struct ui_file *stream,
+	      int show, int level)
 {
   register enum type_code code;
   int demangled_args;
@@ -103,11 +99,8 @@
    SHOW is always zero on recursive calls.  */
 
 void
-f_type_print_varspec_prefix (type, stream, show, passed_a_ptr)
-     struct type *type;
-     struct ui_file *stream;
-     int show;
-     int passed_a_ptr;
+f_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
+			     int show, int passed_a_ptr)
 {
   if (type == 0)
     return;
@@ -161,9 +154,7 @@
 #if 0				/* Currently unused */
 
 static void
-f_type_print_args (type, stream)
-     struct type *type;
-     struct ui_file *stream;
+f_type_print_args (struct type *type, struct ui_file *stream)
 {
   int i;
   struct type **args;
@@ -201,12 +192,8 @@
    Args work like c_type_print_varspec_prefix.  */
 
 static void
-f_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args)
-     struct type *type;
-     struct ui_file *stream;
-     int show;
-     int passed_a_ptr;
-     int demangled_args;
+f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
+			     int show, int passed_a_ptr, int demangled_args)
 {
   int upper_bound, lower_bound;
   int lower_bound_was_default = 0;
@@ -312,9 +299,7 @@
 }
 
 static void
-print_equivalent_f77_float_type (type, stream)
-     struct type *type;
-     struct ui_file *stream;
+print_equivalent_f77_float_type (struct type *type, struct ui_file *stream)
 {
   /* Override type name "float" and make it the
      appropriate real. XLC stupidly outputs -12 as a type
@@ -337,11 +322,8 @@
    We increase it for some recursive calls.  */
 
 void
-f_type_print_base (type, stream, show, level)
-     struct type *type;
-     struct ui_file *stream;
-     int show;
-     int level;
+f_type_print_base (struct type *type, struct ui_file *stream, int show,
+		   int level)
 {
   int retcode;
   int upper_bound;
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index a91766d..56b48dd 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -66,9 +66,7 @@
 #define F77_DIM_OFFSET(n) (f77_array_offset_tbl[n][0])
 
 int
-f77_get_dynamic_lowerbound (type, lower_bound)
-     struct type *type;
-     int *lower_bound;
+f77_get_dynamic_lowerbound (struct type *type, int *lower_bound)
 {
   CORE_ADDR current_frame_addr;
   CORE_ADDR ptr_to_lower_bound;
@@ -126,9 +124,7 @@
 }
 
 int
-f77_get_dynamic_upperbound (type, upper_bound)
-     struct type *type;
-     int *upper_bound;
+f77_get_dynamic_upperbound (struct type *type, int *upper_bound)
 {
   CORE_ADDR current_frame_addr = 0;
   CORE_ADDR ptr_to_upper_bound;
@@ -193,8 +189,7 @@
 /* Obtain F77 adjustable array dimensions */
 
 static void
-f77_get_dynamic_length_of_aggregate (type)
-     struct type *type;
+f77_get_dynamic_length_of_aggregate (struct type *type)
 {
   int upper_bound = -1;
   int lower_bound = 1;
@@ -232,9 +227,7 @@
    type "type".  */
 
 static void
-f77_create_arrayprint_offset_tbl (type, stream)
-     struct type *type;
-     struct ui_file *stream;
+f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream)
 {
   struct type *tmp_type;
   int eltlen;
@@ -281,18 +274,9 @@
    the superior.  Address == the address in the inferior.  */
 
 static void
-f77_print_array_1 (nss, ndimensions, type, valaddr, address,
-		   stream, format, deref_ref, recurse, pretty)
-     int nss;
-     int ndimensions;
-     struct type *type;
-     char *valaddr;
-     CORE_ADDR address;
-     struct ui_file *stream;
-     int format;
-     int deref_ref;
-     int recurse;
-     enum val_prettyprint pretty;
+f77_print_array_1 (int nss, int ndimensions, struct type *type, char *valaddr,
+		   CORE_ADDR address, struct ui_file *stream, int format,
+		   int deref_ref, int recurse, enum val_prettyprint pretty)
 {
   int i;
 
@@ -331,16 +315,9 @@
    stuff and then immediately call f77_print_array_1() */
 
 static void
-f77_print_array (type, valaddr, address, stream, format, deref_ref, recurse,
-		 pretty)
-     struct type *type;
-     char *valaddr;
-     CORE_ADDR address;
-     struct ui_file *stream;
-     int format;
-     int deref_ref;
-     int recurse;
-     enum val_prettyprint pretty;
+f77_print_array (struct type *type, char *valaddr, CORE_ADDR address,
+		 struct ui_file *stream, int format, int deref_ref, int recurse,
+		 enum val_prettyprint pretty)
 {
   int ndimensions;
 
@@ -375,17 +352,9 @@
    The PRETTY parameter controls prettyprinting.  */
 
 int
-f_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref, recurse,
-	     pretty)
-     struct type *type;
-     char *valaddr;
-     int embedded_offset;
-     CORE_ADDR address;
-     struct ui_file *stream;
-     int format;
-     int deref_ref;
-     int recurse;
-     enum val_prettyprint pretty;
+f_val_print (struct type *type, char *valaddr, int embedded_offset,
+	     CORE_ADDR address, struct ui_file *stream, int format,
+	     int deref_ref, int recurse, enum val_prettyprint pretty)
 {
   register unsigned int i = 0;	/* Number of characters printed */
   struct type *elttype;
@@ -583,8 +552,7 @@
 }
 
 static void
-list_all_visible_commons (funname)
-     char *funname;
+list_all_visible_commons (char *funname)
 {
   SAVED_F77_COMMON_PTR tmp;
 
@@ -606,9 +574,7 @@
    given name */
 
 static void
-info_common_command (comname, from_tty)
-     char *comname;
-     int from_tty;
+info_common_command (char *comname, int from_tty)
 {
   SAVED_F77_COMMON_PTR the_common;
   COMMON_ENTRY_PTR entry;
@@ -703,8 +669,7 @@
 
 #if 0
 static int
-there_is_a_visible_common_named (comname)
-     char *comname;
+there_is_a_visible_common_named (char *comname)
 {
   SAVED_F77_COMMON_PTR the_common;
   struct frame_info *fi;
@@ -764,7 +729,7 @@
 #endif
 
 void
-_initialize_f_valprint ()
+_initialize_f_valprint (void)
 {
   add_info ("common", info_common_command,
 	    "Print out the values contained in a Fortran COMMON block.");
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 5571ede..002f3f3 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -37,18 +37,6 @@
 
 const struct floatformat floatformat_unknown;
 
-/* Registers we shouldn't try to store.  */
-#if !defined (CANNOT_STORE_REGISTER)
-#define CANNOT_STORE_REGISTER(regno) 0
-#endif
-
-void write_register_gen (int, char *);
-
-static int
-read_relative_register_raw_bytes_for_frame (int regnum,
-					    char *myaddr,
-					    struct frame_info *frame);
-
 /* Basic byte-swapping routines.  GDB has needed these for a long time...
    All extract a target-format integer at ADDR which is LEN bytes long.  */
 
@@ -391,200 +379,6 @@
       error ("Can't deal with a floating point number of %d bytes.", len);
     }
 }
-
-
-/* Return the address in which frame FRAME's value of register REGNUM
-   has been saved in memory.  Or return zero if it has not been saved.
-   If REGNUM specifies the SP, the value we return is actually
-   the SP value, not an address where it was saved.  */
-
-CORE_ADDR
-find_saved_register (frame, regnum)
-     struct frame_info *frame;
-     int regnum;
-{
-  register struct frame_info *frame1 = NULL;
-  register CORE_ADDR addr = 0;
-
-  if (frame == NULL)		/* No regs saved if want current frame */
-    return 0;
-
-#ifdef HAVE_REGISTER_WINDOWS
-  /* We assume that a register in a register window will only be saved
-     in one place (since the name changes and/or disappears as you go
-     towards inner frames), so we only call get_frame_saved_regs on
-     the current frame.  This is directly in contradiction to the
-     usage below, which assumes that registers used in a frame must be
-     saved in a lower (more interior) frame.  This change is a result
-     of working on a register window machine; get_frame_saved_regs
-     always returns the registers saved within a frame, within the
-     context (register namespace) of that frame. */
-
-  /* However, note that we don't want this to return anything if
-     nothing is saved (if there's a frame inside of this one).  Also,
-     callers to this routine asking for the stack pointer want the
-     stack pointer saved for *this* frame; this is returned from the
-     next frame.  */
-
-  if (REGISTER_IN_WINDOW_P (regnum))
-    {
-      frame1 = get_next_frame (frame);
-      if (!frame1)
-	return 0;		/* Registers of this frame are active.  */
-
-      /* Get the SP from the next frame in; it will be this
-         current frame.  */
-      if (regnum != SP_REGNUM)
-	frame1 = frame;
-
-      FRAME_INIT_SAVED_REGS (frame1);
-      return frame1->saved_regs[regnum];	/* ... which might be zero */
-    }
-#endif /* HAVE_REGISTER_WINDOWS */
-
-  /* Note that this next routine assumes that registers used in
-     frame x will be saved only in the frame that x calls and
-     frames interior to it.  This is not true on the sparc, but the
-     above macro takes care of it, so we should be all right. */
-  while (1)
-    {
-      QUIT;
-      frame1 = get_prev_frame (frame1);
-      if (frame1 == 0 || frame1 == frame)
-	break;
-      FRAME_INIT_SAVED_REGS (frame1);
-      if (frame1->saved_regs[regnum])
-	addr = frame1->saved_regs[regnum];
-    }
-
-  return addr;
-}
-
-/* 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).  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).  Set *ADDRP to the address, either in memory
-   on as a REGISTER_BYTE offset into the registers array.
-
-   Note that this implementation never sets *LVAL to not_lval.  But
-   it can be replaced by defining GET_SAVED_REGISTER and supplying
-   your own.
-
-   The argument RAW_BUFFER must point to aligned memory.  */
-
-void
-default_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
-     char *raw_buffer;
-     int *optimized;
-     CORE_ADDR *addrp;
-     struct frame_info *frame;
-     int regnum;
-     enum lval_type *lval;
-{
-  CORE_ADDR addr;
-
-  if (!target_has_registers)
-    error ("No registers.");
-
-  /* Normal systems don't optimize out things with register numbers.  */
-  if (optimized != NULL)
-    *optimized = 0;
-  addr = find_saved_register (frame, regnum);
-  if (addr != 0)
-    {
-      if (lval != NULL)
-	*lval = lval_memory;
-      if (regnum == SP_REGNUM)
-	{
-	  if (raw_buffer != NULL)
-	    {
-	      /* Put it back in target format.  */
-	      store_address (raw_buffer, REGISTER_RAW_SIZE (regnum),
-			     (LONGEST) addr);
-	    }
-	  if (addrp != NULL)
-	    *addrp = 0;
-	  return;
-	}
-      if (raw_buffer != NULL)
-	read_memory (addr, raw_buffer, REGISTER_RAW_SIZE (regnum));
-    }
-  else
-    {
-      if (lval != NULL)
-	*lval = lval_register;
-      addr = REGISTER_BYTE (regnum);
-      if (raw_buffer != NULL)
-	read_register_gen (regnum, raw_buffer);
-    }
-  if (addrp != NULL)
-    *addrp = addr;
-}
-
-#if !defined (GET_SAVED_REGISTER)
-#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
-  default_get_saved_register(raw_buffer, optimized, addrp, frame, regnum, lval)
-#endif
-void
-get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
-     char *raw_buffer;
-     int *optimized;
-     CORE_ADDR *addrp;
-     struct frame_info *frame;
-     int regnum;
-     enum lval_type *lval;
-{
-  GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame, regnum, lval);
-}
-
-/* Copy the bytes of register REGNUM, relative to the input stack frame,
-   into our memory at MYADDR, in target byte order.
-   The number of bytes copied is REGISTER_RAW_SIZE (REGNUM).
-
-   Returns 1 if could not be read, 0 if could.  */
-
-static int
-read_relative_register_raw_bytes_for_frame (regnum, myaddr, frame)
-     int regnum;
-     char *myaddr;
-     struct frame_info *frame;
-{
-  int optim;
-  if (regnum == FP_REGNUM && frame)
-    {
-      /* Put it back in target format. */
-      store_address (myaddr, REGISTER_RAW_SIZE (FP_REGNUM),
-		     (LONGEST) FRAME_FP (frame));
-
-      return 0;
-    }
-
-  get_saved_register (myaddr, &optim, (CORE_ADDR *) NULL, frame,
-		      regnum, (enum lval_type *) NULL);
-
-  if (register_valid[regnum] < 0)
-    return 1;			/* register value not available */
-
-  return optim;
-}
-
-/* Copy the bytes of register REGNUM, relative to the current stack frame,
-   into our memory at MYADDR, in target byte order.
-   The number of bytes copied is REGISTER_RAW_SIZE (REGNUM).
-
-   Returns 1 if could not be read, 0 if could.  */
-
-int
-read_relative_register_raw_bytes (regnum, myaddr)
-     int regnum;
-     char *myaddr;
-{
-  return read_relative_register_raw_bytes_for_frame (regnum, myaddr,
-						     selected_frame);
-}
 
 /* Return a `value' with the contents of register REGNUM
    in its virtual format, with the type specified by
@@ -594,8 +388,7 @@
    Caller will check return value or die!  */
 
 value_ptr
-value_of_register (regnum)
-     int regnum;
+value_of_register (int regnum)
 {
   CORE_ADDR addr;
   int optim;
@@ -606,7 +399,7 @@
   get_saved_register (raw_buffer, &optim, &addr,
 		      selected_frame, regnum, &lval);
 
-  if (register_valid[regnum] < 0)
+  if (register_cached (regnum) < 0)
     return NULL;		/* register value not available */
 
   reg_val = allocate_value (REGISTER_VIRTUAL_TYPE (regnum));
@@ -633,579 +426,6 @@
   VALUE_OPTIMIZED_OUT (reg_val) = optim;
   return reg_val;
 }
-
-/* Low level examining and depositing of registers.
-
-   The caller is responsible for making
-   sure that the inferior is stopped before calling the fetching routines,
-   or it will get garbage.  (a change from GDB version 3, in which
-   the caller got the value from the last stop).  */
-
-/* Contents and state of the registers (in target byte order). */
-
-char *registers;
-
-/* VALID_REGISTER is non-zero if it has been fetched, -1 if the
-   register value was not available. */
-
-signed char *register_valid;
-
-/* The thread/process associated with the current set of registers.  For now,
-   -1 is special, and means `no current process'.  */
-int registers_pid = -1;
-
-/* Indicate that registers may have changed, so invalidate the cache.  */
-
-void
-registers_changed ()
-{
-  int i;
-  int numregs = ARCH_NUM_REGS;
-
-  registers_pid = -1;
-
-  /* Force cleanup of any alloca areas if using C alloca instead of
-     a builtin alloca.  This particular call is used to clean up
-     areas allocated by low level target code which may build up
-     during lengthy interactions between gdb and the target before
-     gdb gives control to the user (ie watchpoints).  */
-  alloca (0);
-
-  for (i = 0; i < numregs; i++)
-    register_valid[i] = 0;
-
-  if (registers_changed_hook)
-    registers_changed_hook ();
-}
-
-/* Indicate that all registers have been fetched, so mark them all valid.  */
-void
-registers_fetched ()
-{
-  int i;
-  int numregs = ARCH_NUM_REGS;
-  for (i = 0; i < numregs; i++)
-    register_valid[i] = 1;
-}
-
-/* read_register_bytes and write_register_bytes are generally a *BAD*
-   idea.  They are inefficient because they need to check for partial
-   updates, which can only be done by scanning through all of the
-   registers and seeing if the bytes that are being read/written fall
-   inside of an invalid register.  [The main reason this is necessary
-   is that register sizes can vary, so a simple index won't suffice.]
-   It is far better to call read_register_gen and write_register_gen
-   if you want to get at the raw register contents, as it only takes a
-   regno as an argument, and therefore can't do a partial register
-   update.
-
-   Prior to the recent fixes to check for partial updates, both read
-   and write_register_bytes always checked to see if any registers
-   were stale, and then called target_fetch_registers (-1) to update
-   the whole set.  This caused really slowed things down for remote
-   targets.  */
-
-/* Copy INLEN bytes of consecutive data from registers
-   starting with the INREGBYTE'th byte of register data
-   into memory at MYADDR.  */
-
-void
-read_register_bytes (inregbyte, myaddr, inlen)
-     int inregbyte;
-     char *myaddr;
-     int inlen;
-{
-  int inregend = inregbyte + inlen;
-  int regno;
-
-  if (registers_pid != inferior_pid)
-    {
-      registers_changed ();
-      registers_pid = inferior_pid;
-    }
-
-  /* See if we are trying to read bytes from out-of-date registers.  If so,
-     update just those registers.  */
-
-  for (regno = 0; regno < NUM_REGS; regno++)
-    {
-      int regstart, regend;
-
-      if (register_valid[regno])
-	continue;
-
-      if (REGISTER_NAME (regno) == NULL || *REGISTER_NAME (regno) == '\0')
-	continue;
-
-      regstart = REGISTER_BYTE (regno);
-      regend = regstart + REGISTER_RAW_SIZE (regno);
-
-      if (regend <= inregbyte || inregend <= regstart)
-	/* The range the user wants to read doesn't overlap with regno.  */
-	continue;
-
-      /* We've found an invalid register where at least one byte will be read.
-         Update it from the target.  */
-      target_fetch_registers (regno);
-
-      if (!register_valid[regno])
-	error ("read_register_bytes:  Couldn't update register %d.", regno);
-    }
-
-  if (myaddr != NULL)
-    memcpy (myaddr, &registers[inregbyte], inlen);
-}
-
-/* Read register REGNO into memory at MYADDR, which must be large enough
-   for REGISTER_RAW_BYTES (REGNO).  Target byte-order.
-   If the register is known to be the size of a CORE_ADDR or smaller,
-   read_register can be used instead.  */
-void
-read_register_gen (regno, myaddr)
-     int regno;
-     char *myaddr;
-{
-  if (registers_pid != inferior_pid)
-    {
-      registers_changed ();
-      registers_pid = inferior_pid;
-    }
-
-  if (!register_valid[regno])
-    target_fetch_registers (regno);
-  memcpy (myaddr, &registers[REGISTER_BYTE (regno)],
-	  REGISTER_RAW_SIZE (regno));
-}
-
-/* Write register REGNO at MYADDR to the target.  MYADDR points at
-   REGISTER_RAW_BYTES(REGNO), which must be in target byte-order.  */
-
-void
-write_register_gen (regno, myaddr)
-     int regno;
-     char *myaddr;
-{
-  int size;
-
-  /* On the sparc, writing %g0 is a no-op, so we don't even want to change
-     the registers array if something writes to this register.  */
-  if (CANNOT_STORE_REGISTER (regno))
-    return;
-
-  if (registers_pid != inferior_pid)
-    {
-      registers_changed ();
-      registers_pid = inferior_pid;
-    }
-
-  size = REGISTER_RAW_SIZE (regno);
-
-  /* If we have a valid copy of the register, and new value == old value,
-     then don't bother doing the actual store. */
-
-  if (register_valid[regno]
-      && memcmp (&registers[REGISTER_BYTE (regno)], myaddr, size) == 0)
-    return;
-
-  target_prepare_to_store ();
-
-  memcpy (&registers[REGISTER_BYTE (regno)], myaddr, size);
-
-  register_valid[regno] = 1;
-
-  target_store_registers (regno);
-}
-
-/* Copy INLEN bytes of consecutive data from memory at MYADDR
-   into registers starting with the MYREGSTART'th byte of register data.  */
-
-void
-write_register_bytes (myregstart, myaddr, inlen)
-     int myregstart;
-     char *myaddr;
-     int inlen;
-{
-  int myregend = myregstart + inlen;
-  int regno;
-
-  target_prepare_to_store ();
-
-  /* Scan through the registers updating any that are covered by the range
-     myregstart<=>myregend using write_register_gen, which does nice things
-     like handling threads, and avoiding updates when the new and old contents
-     are the same.  */
-
-  for (regno = 0; regno < NUM_REGS; regno++)
-    {
-      int regstart, regend;
-
-      regstart = REGISTER_BYTE (regno);
-      regend = regstart + REGISTER_RAW_SIZE (regno);
-
-      /* Is this register completely outside the range the user is writing?  */
-      if (myregend <= regstart || regend <= myregstart)
-	/* do nothing */ ;		
-
-      /* Is this register completely within the range the user is writing?  */
-      else if (myregstart <= regstart && regend <= myregend)
-	write_register_gen (regno, myaddr + (regstart - myregstart));
-
-      /* The register partially overlaps the range being written.  */
-      else
-	{
-	  char regbuf[MAX_REGISTER_RAW_SIZE];
-	  /* What's the overlap between this register's bytes and
-             those the caller wants to write?  */
-	  int overlapstart = max (regstart, myregstart);
-	  int overlapend   = min (regend,   myregend);
-
-	  /* We may be doing a partial update of an invalid register.
-	     Update it from the target before scribbling on it.  */
-	  read_register_gen (regno, regbuf);
-
-	  memcpy (registers + overlapstart,
-		  myaddr + (overlapstart - myregstart),
-		  overlapend - overlapstart);
-
-	  target_store_registers (regno);
-	}
-    }
-}
-
-
-/* Return the raw contents of register REGNO, regarding it as an integer.  */
-/* This probably should be returning LONGEST rather than CORE_ADDR.  */
-
-CORE_ADDR
-read_register (regno)
-     int regno;
-{
-  if (registers_pid != inferior_pid)
-    {
-      registers_changed ();
-      registers_pid = inferior_pid;
-    }
-
-  if (!register_valid[regno])
-    target_fetch_registers (regno);
-
-  return ((CORE_ADDR)
-	  extract_unsigned_integer (&registers[REGISTER_BYTE (regno)],
-				    REGISTER_RAW_SIZE (regno)));
-}
-
-CORE_ADDR
-read_register_pid (regno, pid)
-     int regno, pid;
-{
-  int save_pid;
-  CORE_ADDR retval;
-
-  if (pid == inferior_pid)
-    return read_register (regno);
-
-  save_pid = inferior_pid;
-
-  inferior_pid = pid;
-
-  retval = read_register (regno);
-
-  inferior_pid = save_pid;
-
-  return retval;
-}
-
-/* Store VALUE, into the raw contents of register number REGNO.
-   This should probably write a LONGEST rather than a CORE_ADDR */
-
-void
-write_register (regno, val)
-     int regno;
-     LONGEST val;
-{
-  PTR buf;
-  int size;
-
-  /* On the sparc, writing %g0 is a no-op, so we don't even want to change
-     the registers array if something writes to this register.  */
-  if (CANNOT_STORE_REGISTER (regno))
-    return;
-
-  if (registers_pid != inferior_pid)
-    {
-      registers_changed ();
-      registers_pid = inferior_pid;
-    }
-
-  size = REGISTER_RAW_SIZE (regno);
-  buf = alloca (size);
-  store_signed_integer (buf, size, (LONGEST) val);
-
-  /* If we have a valid copy of the register, and new value == old value,
-     then don't bother doing the actual store. */
-
-  if (register_valid[regno]
-      && memcmp (&registers[REGISTER_BYTE (regno)], buf, size) == 0)
-    return;
-
-  target_prepare_to_store ();
-
-  memcpy (&registers[REGISTER_BYTE (regno)], buf, size);
-
-  register_valid[regno] = 1;
-
-  target_store_registers (regno);
-}
-
-void
-write_register_pid (regno, val, pid)
-     int regno;
-     CORE_ADDR val;
-     int pid;
-{
-  int save_pid;
-
-  if (pid == inferior_pid)
-    {
-      write_register (regno, val);
-      return;
-    }
-
-  save_pid = inferior_pid;
-
-  inferior_pid = pid;
-
-  write_register (regno, val);
-
-  inferior_pid = save_pid;
-}
-
-/* Record that register REGNO contains VAL.
-   This is used when the value is obtained from the inferior or core dump,
-   so there is no need to store the value there.
-
-   If VAL is a NULL pointer, then it's probably an unsupported register.  We
-   just set it's value to all zeros.  We might want to record this fact, and
-   report it to the users of read_register and friends.
- */
-
-void
-supply_register (regno, val)
-     int regno;
-     char *val;
-{
-#if 1
-  if (registers_pid != inferior_pid)
-    {
-      registers_changed ();
-      registers_pid = inferior_pid;
-    }
-#endif
-
-  register_valid[regno] = 1;
-  if (val)
-    memcpy (&registers[REGISTER_BYTE (regno)], val, REGISTER_RAW_SIZE (regno));
-  else
-    memset (&registers[REGISTER_BYTE (regno)], '\000', REGISTER_RAW_SIZE (regno));
-
-  /* On some architectures, e.g. HPPA, there are a few stray bits in some
-     registers, that the rest of the code would like to ignore.  */
-#ifdef CLEAN_UP_REGISTER_VALUE
-  CLEAN_UP_REGISTER_VALUE (regno, &registers[REGISTER_BYTE (regno)]);
-#endif
-}
-
-
-/* This routine is getting awfully cluttered with #if's.  It's probably
-   time to turn this into READ_PC and define it in the tm.h file.
-   Ditto for write_pc.
-
-   1999-06-08: The following were re-written so that it assumes the
-   existance of a TARGET_READ_PC et.al. macro.  A default generic
-   version of that macro is made available where needed.
-
-   Since the ``TARGET_READ_PC'' et.al. macro is going to be controlled
-   by the multi-arch framework, it will eventually be possible to
-   eliminate the intermediate read_pc_pid().  The client would call
-   TARGET_READ_PC directly. (cagney). */
-
-#ifndef TARGET_READ_PC
-#define TARGET_READ_PC generic_target_read_pc
-#endif
-
-CORE_ADDR
-generic_target_read_pc (int pid)
-{
-#ifdef PC_REGNUM
-  if (PC_REGNUM >= 0)
-    {
-      CORE_ADDR pc_val = ADDR_BITS_REMOVE ((CORE_ADDR) read_register_pid (PC_REGNUM, pid));
-      return pc_val;
-    }
-#endif
-  internal_error ("generic_target_read_pc");
-  return 0;
-}
-
-CORE_ADDR
-read_pc_pid (pid)
-     int pid;
-{
-  int saved_inferior_pid;
-  CORE_ADDR pc_val;
-
-  /* In case pid != inferior_pid. */
-  saved_inferior_pid = inferior_pid;
-  inferior_pid = pid;
-
-  pc_val = TARGET_READ_PC (pid);
-
-  inferior_pid = saved_inferior_pid;
-  return pc_val;
-}
-
-CORE_ADDR
-read_pc ()
-{
-  return read_pc_pid (inferior_pid);
-}
-
-#ifndef TARGET_WRITE_PC
-#define TARGET_WRITE_PC generic_target_write_pc
-#endif
-
-void
-generic_target_write_pc (pc, pid)
-     CORE_ADDR pc;
-     int pid;
-{
-#ifdef PC_REGNUM
-  if (PC_REGNUM >= 0)
-    write_register_pid (PC_REGNUM, pc, pid);
-  if (NPC_REGNUM >= 0)
-    write_register_pid (NPC_REGNUM, pc + 4, pid);
-  if (NNPC_REGNUM >= 0)
-    write_register_pid (NNPC_REGNUM, pc + 8, pid);
-#else
-  internal_error ("generic_target_write_pc");
-#endif
-}
-
-void
-write_pc_pid (pc, pid)
-     CORE_ADDR pc;
-     int pid;
-{
-  int saved_inferior_pid;
-
-  /* In case pid != inferior_pid. */
-  saved_inferior_pid = inferior_pid;
-  inferior_pid = pid;
-
-  TARGET_WRITE_PC (pc, pid);
-
-  inferior_pid = saved_inferior_pid;
-}
-
-void
-write_pc (pc)
-     CORE_ADDR pc;
-{
-  write_pc_pid (pc, inferior_pid);
-}
-
-/* Cope with strage ways of getting to the stack and frame pointers */
-
-#ifndef TARGET_READ_SP
-#define TARGET_READ_SP generic_target_read_sp
-#endif
-
-CORE_ADDR
-generic_target_read_sp ()
-{
-#ifdef SP_REGNUM
-  if (SP_REGNUM >= 0)
-    return read_register (SP_REGNUM);
-#endif
-  internal_error ("generic_target_read_sp");
-}
-
-CORE_ADDR
-read_sp ()
-{
-  return TARGET_READ_SP ();
-}
-
-#ifndef TARGET_WRITE_SP
-#define TARGET_WRITE_SP generic_target_write_sp
-#endif
-
-void
-generic_target_write_sp (val)
-     CORE_ADDR val;
-{
-#ifdef SP_REGNUM
-  if (SP_REGNUM >= 0)
-    {
-      write_register (SP_REGNUM, val);
-      return;
-    }
-#endif
-  internal_error ("generic_target_write_sp");
-}
-
-void
-write_sp (val)
-     CORE_ADDR val;
-{
-  TARGET_WRITE_SP (val);
-}
-
-#ifndef TARGET_READ_FP
-#define TARGET_READ_FP generic_target_read_fp
-#endif
-
-CORE_ADDR
-generic_target_read_fp ()
-{
-#ifdef FP_REGNUM
-  if (FP_REGNUM >= 0)
-    return read_register (FP_REGNUM);
-#endif
-  internal_error ("generic_target_read_fp");
-}
-
-CORE_ADDR
-read_fp ()
-{
-  return TARGET_READ_FP ();
-}
-
-#ifndef TARGET_WRITE_FP
-#define TARGET_WRITE_FP generic_target_write_fp
-#endif
-
-void
-generic_target_write_fp (val)
-     CORE_ADDR val;
-{
-#ifdef FP_REGNUM
-  if (FP_REGNUM >= 0)
-    {
-      write_register (FP_REGNUM, val);
-      return;
-    }
-#endif
-  internal_error ("generic_target_write_fp");
-}
-
-void
-write_fp (val)
-     CORE_ADDR val;
-{
-  TARGET_WRITE_FP (val);
-}
-
 
 /* Given a pointer of type TYPE in target form in BUF, return the
    address it represents.  */
@@ -1239,8 +459,7 @@
    up caring what frame it is being evaluated relative to?  SYM must
    be non-NULL.  */
 int
-symbol_read_needs_frame (sym)
-     struct symbol *sym;
+symbol_read_needs_frame (struct symbol *sym)
 {
   switch (SYMBOL_CLASS (sym))
     {
@@ -1285,9 +504,7 @@
    If FRAME is NULL, use the selected_frame.  */
 
 value_ptr
-read_var_value (var, frame)
-     register struct symbol *var;
-     struct frame_info *frame;
+read_var_value (register struct symbol *var, struct frame_info *frame)
 {
   register value_ptr v;
   struct type *type = SYMBOL_TYPE (var);
@@ -1492,10 +709,7 @@
    Caller will check return value or die!  */
 
 value_ptr
-value_from_register (type, regnum, frame)
-     struct type *type;
-     int regnum;
-     struct frame_info *frame;
+value_from_register (struct type *type, int regnum, struct frame_info *frame)
 {
   char raw_buffer[MAX_REGISTER_RAW_SIZE];
   CORE_ADDR addr;
@@ -1578,7 +792,7 @@
 			      page_regnum,
 			      &lval);
 
-	  if (register_valid[page_regnum] == -1)
+	  if (register_cached (page_regnum) == -1)
 	    return NULL;	/* register value not available */
 
 	  if (lval == lval_register)
@@ -1595,7 +809,7 @@
 			      regnum,
 			      &lval);
 
-	  if (register_valid[regnum] == -1)
+	  if (register_cached (regnum) == -1)
 	    return NULL;	/* register value not available */
 
 	  if (lval == lval_register)
@@ -1621,7 +835,7 @@
 				local_regnum,
 				&lval);
 
-	    if (register_valid[local_regnum] == -1)
+	    if (register_cached (local_regnum) == -1)
 	      return NULL;	/* register value not available */
 
 	    if (regnum == local_regnum)
@@ -1686,7 +900,7 @@
 
   get_saved_register (raw_buffer, &optim, &addr, frame, regnum, &lval);
 
-  if (register_valid[regnum] == -1)
+  if (register_cached (regnum) == -1)
     return NULL;		/* register value not available */
 
   VALUE_OPTIMIZED_OUT (v) = optim;
@@ -1740,9 +954,7 @@
    address.  */
 
 value_ptr
-locate_var_value (var, frame)
-     register struct symbol *var;
-     struct frame_info *frame;
+locate_var_value (register struct symbol *var, struct frame_info *frame)
 {
   CORE_ADDR addr = 0;
   struct type *type = SYMBOL_TYPE (var);
@@ -1782,29 +994,3 @@
     }
   return 0;			/* For lint -- never reached */
 }
-
-
-static void build_findvar (void);
-static void
-build_findvar ()
-{
-  /* We allocate some extra slop since we do a lot of memcpy's around
-     `registers', and failing-soft is better than failing hard.  */
-  int sizeof_registers = REGISTER_BYTES + /* SLOP */ 256;
-  int sizeof_register_valid = NUM_REGS * sizeof (*register_valid);
-  registers = xmalloc (sizeof_registers);
-  memset (registers, 0, sizeof_registers);
-  register_valid = xmalloc (sizeof_register_valid);
-  memset (register_valid, 0, sizeof_register_valid);
-}
-
-void _initialize_findvar (void);
-void
-_initialize_findvar ()
-{
-  build_findvar ();
-
-  register_gdbarch_swap (&registers, sizeof (registers), NULL);
-  register_gdbarch_swap (&register_valid, sizeof (register_valid), NULL);
-  register_gdbarch_swap (NULL, 0, build_findvar);
-}
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 0996fbd..e97f451 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -46,11 +46,7 @@
  * the four arguments "a", "b", "c", "d".
  */
 static void
-breakup_args (
-	       scratch,
-	       argv)
-     char *scratch;
-     char **argv;
+breakup_args (char *scratch, char **argv)
 {
   char *cp = scratch;
 
@@ -98,15 +94,9 @@
    or NULL if we should pick one.  Errors reported with error().  */
 
 void
-fork_inferior (exec_file, allargs, env, traceme_fun, init_trace_fun,
-	       pre_trace_fun, shell_file)
-     char *exec_file;
-     char *allargs;
-     char **env;
-     void (*traceme_fun) (void);
-     void (*init_trace_fun) (int);
-     void (*pre_trace_fun) (void);
-     char *shell_file;
+fork_inferior (char *exec_file, char *allargs, char **env,
+	       void (*traceme_fun) (void), void (*init_trace_fun) (int),
+	       void (*pre_trace_fun) (void), char *shell_file)
 {
   int pid;
   char *shell_command;
@@ -254,13 +244,13 @@
   if (pre_trace_fun != NULL)
     (*pre_trace_fun) ();
 
-#if defined(USG) && !defined(HAVE_VFORK)
-  pid = fork ();
-#else
+#ifdef HAVE_VFORK
   if (debug_fork)
     pid = fork ();
   else
     pid = vfork ();
+#else
+  pid = fork ();
 #endif
 
   if (pid < 0)
@@ -368,7 +358,7 @@
      correct program, and are poised at the first instruction of the
      new program.  */
 
-  /* Allow target dependant code to play with the new process.  This might be
+  /* 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);
@@ -388,9 +378,7 @@
    clone will set it TRUE.
  */
 void
-clone_and_follow_inferior (child_pid, followed_child)
-     int child_pid;
-     int *followed_child;
+clone_and_follow_inferior (int child_pid, int *followed_child)
 {
   extern int auto_solib_add;
 
@@ -428,13 +416,13 @@
     error ("error getting pipe for handoff semaphore");
 
   /* Clone the debugger. */
-#if defined(USG) && !defined(HAVE_VFORK)
-  debugger_pid = fork ();
-#else
+#ifdef HAVE_VFORK
   if (debug_fork)
     debugger_pid = fork ();
   else
     debugger_pid = vfork ();
+#else
+  debugger_pid = fork ();
 #endif
 
   if (debugger_pid < 0)
@@ -512,8 +500,7 @@
 /* Accept NTRAPS traps from the inferior.  */
 
 void
-startup_inferior (ntraps)
-     int ntraps;
+startup_inferior (int ntraps)
 {
   int pending_execs = ntraps;
   int terminal_initted;
diff --git a/gdb/fr30-tdep.c b/gdb/fr30-tdep.c
index c35201d..c06542a 100644
--- a/gdb/fr30-tdep.c
+++ b/gdb/fr30-tdep.c
@@ -32,8 +32,7 @@
 /* An expression that tells us whether the function invocation represented
    by FI does not have a frame on the stack associated with it.  */
 int
-fr30_frameless_function_invocation (fi)
-     struct frame_info *fi;
+fr30_frameless_function_invocation (struct frame_info *fi)
 {
   int frameless;
   CORE_ADDR func_start, after_prologue;
@@ -50,7 +49,7 @@
    command, or the call dummy breakpoint gets hit.  */
 
 void
-fr30_pop_frame ()
+fr30_pop_frame (void)
 {
   struct frame_info *frame = get_current_frame ();
   int regnum;
@@ -159,12 +158,8 @@
  */
 
 CORE_ADDR
-fr30_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     int struct_return;
-     CORE_ADDR struct_addr;
+fr30_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+		     int struct_return, CORE_ADDR struct_addr)
 {
   int argreg;
   int argnum;
@@ -245,7 +240,7 @@
 void _initialize_fr30_tdep (void);
 
 void
-_initialize_fr30_tdep ()
+_initialize_fr30_tdep (void)
 {
   extern int print_insn_fr30 (bfd_vma, disassemble_info *);
   tm_print_insn = print_insn_fr30;
@@ -272,8 +267,7 @@
 static struct frame_info prologue_cache;
 
 static int
-check_prologue_cache (fi)
-     struct frame_info *fi;
+check_prologue_cache (struct frame_info *fi)
 {
   int i;
 
@@ -296,8 +290,7 @@
  */
 
 static void
-save_prologue_cache (fi)
-     struct frame_info *fi;
+save_prologue_cache (struct frame_info *fi)
 {
   int i;
 
@@ -323,8 +316,7 @@
    be determined till after we have scanned the prologue.  */
 
 static void
-fr30_scan_prologue (fi)
-     struct frame_info *fi;
+fr30_scan_prologue (struct frame_info *fi)
 {
   int sp_offset, fp_offset;
   CORE_ADDR prologue_start, prologue_end, current_pc;
@@ -460,8 +452,7 @@
    pointer just prior to calling the target function (see run_stack_dummy).  */
 
 void
-fr30_init_extra_frame_info (fi)
-     struct frame_info *fi;
+fr30_init_extra_frame_info (struct frame_info *fi)
 {
   int reg;
 
@@ -485,10 +476,11 @@
     fi->frame = read_register (fi->framereg);
   else
     /* not the innermost frame */
-    /* If we have an FP,  the callee saved it. */ if (fi->framereg == FP_REGNUM)
-    if (fi->next->fsr.regs[fi->framereg] != 0)
-      fi->frame = read_memory_integer (fi->next->fsr.regs[fi->framereg],
-				       4);
+    /* If we have an FP,  the callee saved it. */
+    if (fi->framereg == FP_REGNUM)
+      if (fi->next->fsr.regs[fi->framereg] != 0)
+	fi->frame = read_memory_integer (fi->next->fsr.regs[fi->framereg], 4);
+
   /* Calculate actual addresses of saved registers using offsets determined
      by fr30_scan_prologue.  */
   for (reg = 0; reg < NUM_REGS; reg++)
@@ -507,9 +499,7 @@
    frame.  */
 
 CORE_ADDR
-fr30_find_callers_reg (fi, regnum)
-     struct frame_info *fi;
-     int regnum;
+fr30_find_callers_reg (struct frame_info *fi, int regnum)
 {
   for (; fi; fi = fi->next)
     if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
@@ -531,8 +521,7 @@
 
 
 CORE_ADDR
-fr30_frame_chain (fi)
-     struct frame_info *fi;
+fr30_frame_chain (struct frame_info *fi)
 {
   CORE_ADDR fn_start, callers_pc, fp;
   struct frame_info caller_fi;
@@ -580,8 +569,7 @@
    will be found.  */
 
 CORE_ADDR
-fr30_frame_saved_pc (fi)
-     struct frame_info *fi;
+fr30_frame_saved_pc (struct frame_info *fi)
 {
   if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
     return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
@@ -597,14 +585,8 @@
  */
 
 int
-fr30_fix_call_dummy (dummy, sp, fun, nargs, args, type, gcc_p)
-     char *dummy;
-     CORE_ADDR sp;
-     CORE_ADDR fun;
-     int nargs;
-     value_ptr *args;
-     struct type *type;
-     int gcc_p;
+fr30_fix_call_dummy (char *dummy, CORE_ADDR sp, CORE_ADDR fun, int nargs,
+		     value_ptr *args, struct type *type, int gcc_p)
 {
   long offset24;
 
diff --git a/gdb/gdb-events.c b/gdb/gdb-events.c
index 15aeefa..708e931 100644
--- a/gdb/gdb-events.c
+++ b/gdb/gdb-events.c
@@ -179,7 +179,7 @@
     {
       struct event *event = delivering_events;
       delivering_events = event->next;
-      free (event);
+      xfree (event);
     }
   /* Process any pending events.  Because one of the deliveries could
      bail out we move everything off of the pending queue onto an
@@ -206,7 +206,7 @@
 	  break;
 	}
       delivering_events = event->next;
-      free (event);
+      xfree (event);
     }
 }
 
diff --git a/gdb/gdb-events.sh b/gdb/gdb-events.sh
index 3e4a01b..ef64b46 100755
--- a/gdb/gdb-events.sh
+++ b/gdb/gdb-events.sh
@@ -34,7 +34,7 @@
 # here with respect to annotate.  We might need to accomodate a hook
 # stack that allows several ui blocks to install their own events.
 
-# Each of the variable events (as currently generated) is converteded
+# Each of the variable events (as currently generated) is converted
 # to either a straight function call or a function call with a
 # predicate.
 
diff --git a/gdb/gdb-stabs.h b/gdb/gdb-stabs.h
index 3ec1393..7f6a606 100644
--- a/gdb/gdb-stabs.h
+++ b/gdb/gdb-stabs.h
@@ -1,5 +1,5 @@
 /* Definitions for symbol-reading containing "stabs", for GDB.
-   Copyright 1992 Free Software Foundation, Inc.
+   Copyright 1992, 2000 Free Software Foundation, Inc.
    Contributed by Cygnus Support.  Written by John Gilmore.
 
    This file is part of GDB.
@@ -28,7 +28,7 @@
 #if !defined (GDBSTABS_H)
 #define GDBSTABS_H
 
-#define	SECT_OFF_MAX	40	/* Count of possible values */
+#define	SECT_OFF_MAX	64	/* Count of possible values */
 
 /* The stab_section_info chain remembers info from the ELF symbol table,
    while psymtabs are being built for the other symbol tables in the 
diff --git a/gdb/gdb_assert.h b/gdb/gdb_assert.h
new file mode 100644
index 0000000..85e3dee
--- /dev/null
+++ b/gdb/gdb_assert.h
@@ -0,0 +1,51 @@
+/* GDB-friendly replacement for <assert.h>.
+   Copyright 2000 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 GDB_ASSERT_H
+#define GDB_ASSERT_H
+
+#define gdb_assert(expr)                                                      \
+  ((void) ((expr) ? 0 :                                                       \
+	   (gdb_assert_fail (#expr, __FILE__, __LINE__, ASSERT_FUNCTION), 0)))
+
+/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
+   which contains the name of the function currently being defined.
+   This is broken in G++ before version 2.6.
+   C9x has a similar variable called __func__, but prefer the GCC one since
+   it demangles C++ function names.  */
+#if (GCC_VERSION >= 2004)
+#define ASSERT_FUNCTION		__PRETTY_FUNCTION__
+#else
+#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#define ASSERT_FUNCTION		__func__
+#else
+#define ASSERT_FUNCTION		((const char *) 0)
+#endif
+#endif
+
+/* This prints an "Assertion failed" message, aksing the user if they
+   want to continue, dump core, or just exit.  */
+#define gdb_assert_fail(assertion, file, line, function)                      \
+  internal_error ("%s:%u: %s%sAssertion `%s' failed.",                        \
+		  file, line,                                                 \
+		  function ? function : "", function ? ": " : "",             \
+		  assertion)
+
+#endif /* gdb_assert.h */
diff --git a/gdb/gdb_proc_service.h b/gdb/gdb_proc_service.h
index 1f1ff9e..e77cdf6 100644
--- a/gdb/gdb_proc_service.h
+++ b/gdb/gdb_proc_service.h
@@ -1,19 +1,51 @@
-typedef enum {
-  PS_OK,          /* generic "call succeeded" */
-  PS_ERR,         /* generic. */
-  PS_BADPID,      /* bad process handle */
-  PS_BADLID,      /* bad lwp identifier */
-  PS_BADADDR,     /* bad address */
-  PS_NOSYM,       /* p_lookup() could not find given symbol */
-        PS_NOFREGS
-  /*
-   * FPU register set not available for given
-   * lwp
-   */
-}       ps_err_e;
+/* <proc_service.h> replacement for systems that don't have it.
+   Copyright 2000 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 GDB_PROC_SERVICE_H
+#define GDB_PROC_SERVICE_H
+
+#include <sys/types.h>
+
+#ifdef HAVE_PROC_SERVICE_H
+#include <proc_service.h>
+#else
+
+#ifdef HAVE_SYS_PROCFS_H
+#include <sys/procfs.h>
+#endif
+
+#include "gregset.h"
+
+typedef enum
+{
+  PS_OK,			/* Success.  */
+  PS_ERR,			/* Generic error.  */
+  PS_BADPID,			/* Bad process handle.  */
+  PS_BADLID,			/* Bad LWP id.  */
+  PS_BADADDR,			/* Bad address.  */
+  PS_NOSYM,			/* Symbol not found.  */
+  PS_NOFREGS			/* FPU register set not available.  */
+} ps_err_e;
 
 #ifndef HAVE_LWPID_T
-typedef unsigned int  lwpid_t;
+typedef unsigned int lwpid_t;
 #endif
 
 typedef unsigned long paddr_t;
@@ -23,11 +55,32 @@
 #endif
 
 #ifndef HAVE_PRGREGSET_T
-typedef gregset_t  prgregset_t;		/* BOGUS BOGUS BOGUS */
+typedef gdb_gregset_t prgregset_t;
 #endif
 
 #ifndef HAVE_PRFPREGSET_T
-typedef fpregset_t prfpregset_t;	/* BOGUS BOGUS BOGUS */
+typedef gdb_fpregset_t prfpregset_t;
 #endif
 
-struct ps_prochandle;		/* user defined. */
+#endif /* HAVE_PROC_SERVICE_H */
+
+/* Fix-up some broken systems.  */
+
+/* Unfortunately glibc 2.1.3 was released with a broken prfpregset_t
+   type.  We let configure check for this lossage, and make
+   appropriate typedefs here.  */
+
+#ifdef PRFPREGSET_T_BROKEN
+typedef gdb_fpregset_t gdb_prfpregset_t;
+#else
+typedef prfpregset_t gdb_prfpregset_t;
+#endif
+
+/* Structure that identifies the target process.  */
+struct ps_prochandle
+{
+  /* The process id is all we need.  */
+  pid_t pid;
+};
+
+#endif /* gdb_proc_service.h */
diff --git a/gdb/gdb_thread_db.h b/gdb/gdb_thread_db.h
index 5bb1963..8c868c2 100644
--- a/gdb/gdb_thread_db.h
+++ b/gdb/gdb_thread_db.h
@@ -1,3 +1,16 @@
+#ifdef HAVE_THREAD_DB_H
+#include <thread_db.h>
+#else
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+typedef uint32_t gdb_uint32_t;
+#define GDB_UINT32_C(c)	UINT32_C(c)
+#else
+typedef unsigned int gdb_uint32_t;
+#define GDB_UINT32_C(c)	c ## U
+#endif
+
 /* Copyright (C) 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -23,35 +36,34 @@
    modelled closely after the interface with same names in Solaris with
    the goal to share the same code in the debugger.  */
 #include <pthread.h>
-#include <stdint.h>
 #include <sys/types.h>
-/*#include <sys/ucontext.h>*/
+#include <sys/procfs.h>
 
 
 /* Error codes of the library.  */
 typedef enum
 {
-  TD_OK,	/* No error.  */
-  TD_ERR,	/* No further specified error.  */
-  TD_NOTHR,	/* No matching thread found.  */
-  TD_NOSV,	/* No matching synchronization handle found.  */
-  TD_NOLWP,	/* No matching light-weighted process found.  */
-  TD_BADPH,	/* Invalid process handle.  */
-  TD_BADTH,	/* Invalid thread handle.  */
-  TD_BADSH,	/* Invalid synchronization handle.  */
-  TD_BADTA,	/* Invalid thread agent.  */
-  TD_BADKEY,	/* Invalid key.  */
-  TD_NOMSG,	/* No event available.  */
-  TD_NOFPREGS,	/* No floating-point register content available.  */
-  TD_NOLIBTHREAD,	/* Application not linked with thread library.  */
-  TD_NOEVENT,	/* Requested event is not supported.  */
-  TD_NOCAPAB,	/* Capability not available.  */
-  TD_DBERR,	/* Internal debug library error.  */
-  TD_NOAPLIC,	/* Operation is not applicable.  */
-  TD_NOTSD,	/* No thread-specific data available.  */
-  TD_MALLOC,	/* Out of memory.  */
-  TD_PARTIALREG,/* Not entire register set was read or written.  */
-  TD_NOXREGS	/* X register set not available for given thread.  */
+  TD_OK,	  /* No error.  */
+  TD_ERR,	  /* No further specified error.  */
+  TD_NOTHR,	  /* No matching thread found.  */
+  TD_NOSV,	  /* No matching synchronization handle found.  */
+  TD_NOLWP,	  /* No matching light-weighted process found.  */
+  TD_BADPH,	  /* Invalid process handle.  */
+  TD_BADTH,	  /* Invalid thread handle.  */
+  TD_BADSH,	  /* Invalid synchronization handle.  */
+  TD_BADTA,	  /* Invalid thread agent.  */
+  TD_BADKEY,	  /* Invalid key.  */
+  TD_NOMSG,	  /* No event available.  */
+  TD_NOFPREGS,	  /* No floating-point register content available.  */
+  TD_NOLIBTHREAD, /* Application not linked with thread library.  */
+  TD_NOEVENT,	  /* Requested event is not supported.  */
+  TD_NOCAPAB,	  /* Capability not available.  */
+  TD_DBERR,	  /* Internal debug library error.  */
+  TD_NOAPLIC,	  /* Operation is not applicable.  */
+  TD_NOTSD,	  /* No thread-specific data available.  */
+  TD_MALLOC,	  /* Out of memory.  */
+  TD_PARTIALREG,  /* Not entire register set was read or written.  */
+  TD_NOXREGS	  /* X register set not available for given thread.  */
 } td_err_e;
 
 
@@ -81,9 +93,6 @@
 
 /* Types of the debugging library.  */
 
-/* Addresses.  */
-/*typedef void *psaddr_t;*/
-
 /* Handle for a process.  This type is opaque.  */
 typedef struct td_thragent td_thragent_t;
 
@@ -109,14 +118,14 @@
 /* Bitmask of enabled events. */
 typedef struct td_thr_events
 {
-  uint32_t event_bits[TD_EVENTSIZE];
+  gdb_uint32_t event_bits[TD_EVENTSIZE];
 } td_thr_events_t;
 
 /* Event set manipulation macros. */
 #define __td_eventmask(n) \
-  (UINT32_C (1) << (((n) - 1) & BT_UIMASK))
+  (GDB_UINT32_C (1) << (((n) - 1) & BT_UIMASK))
 #define __td_eventword(n) \
-  ((UINT32_C ((n) - 1)) >> BT_UISHIFT)
+  ((GDB_UINT32_C ((n) - 1)) >> BT_UISHIFT)
 
 #define td_event_emptyset(setp) \
   do {									      \
@@ -129,7 +138,7 @@
   do {									      \
     int __i;								      \
     for (__i = TD_EVENTSIZE; __i > 0; --__i)				      \
-      (setp)->event_bits[__i - 1] = UINT32_C (0xffffffff);		      \
+      (setp)->event_bits[__i - 1] = GDB_UINT32_C (0xffffffff);		      \
   } while (0)
 
 #define td_event_addset(setp, n) \
@@ -196,13 +205,21 @@
   const td_thrhandle_t *th_p;	/* Thread reporting the event.  */
   union
   {
-# if 0
+#if 0
     td_synchandle_t *sh;	/* Handle of synchronization object.  */
 #endif
     uintptr_t data;		/* Event specific data.  */
   } msg;
 } td_event_msg_t;
 
+/* Structure containing event data available in each thread structure.  */
+typedef struct
+{
+  td_thr_events_t eventmask;	/* Mask of enabled events.  */
+  td_event_e eventnum;		/* Number of last event.  */
+  void *eventdata;		/* Data associated with event.  */
+} td_eventbuf_t;
+
 
 /* Gathered statistics about the process.  */
 typedef struct td_ta_stats
@@ -229,26 +246,18 @@
 typedef pthread_t thread_t;
 typedef pthread_key_t thread_key_t;
 
-/* Linux has different names for the register set types.  */
-/*typedef gregset_t prgregset_t;*/
-/*typedef fpregset_t prfpregset_t;*/
-
 
 /* Callback for iteration over threads.  */
-typedef int td_thr_iter_f __P ((const td_thrhandle_t *, void *));
+typedef int td_thr_iter_f (const td_thrhandle_t *, void *);
 
 /* Callback for iteration over thread local data.  */
-typedef int td_key_iter_f __P ((thread_key_t, void (*) (void *), void *));
+typedef int td_key_iter_f (thread_key_t, void (*) (void *), void *);
 
 
 
 /* Forward declaration.  This has to be defined by the user.  */
 struct ps_prochandle;
 
-/* We don't have any differences between processes and threads, therefore
-   have only one PID type.  */
-/*typedef pid_t lwpid_t;*/
-
 
 /* Information about the thread.  */
 typedef struct td_thrinfo
@@ -334,6 +343,18 @@
 extern td_err_e td_ta_event_addr (const td_thragent_t *__ta,
 				  td_event_e __event, td_notify_t *__ptr);
 
+/* Enable EVENT in global mask.  */
+extern td_err_e td_ta_set_event (const td_thragent_t *__ta,
+				 td_thr_events_t *__event);
+
+/* Disable EVENT in global mask.  */
+extern td_err_e td_ta_clear_event (const td_thragent_t *__ta,
+				   td_thr_events_t *__event);
+
+/* Return information about last event.  */
+extern td_err_e td_ta_event_getmsg (const td_thragent_t *__ta,
+				    td_event_msg_t *msg);
+
 
 /* Set suggested concurrency level for process associated with TA.  */
 extern td_err_e td_ta_setconcurrency (const td_thragent_t *__ta, int __level);
@@ -425,3 +446,5 @@
 extern td_err_e td_thr_dbresume (const td_thrhandle_t *__th);
 
 #endif	/* thread_db.h */
+
+#endif /* HAVE_THREAD_DB_H */
diff --git a/gdb/gdba.el b/gdb/gdba.el
deleted file mode 100644
index 0f71586..0000000
--- a/gdb/gdba.el
+++ /dev/null
@@ -1,2607 +0,0 @@
-(defmacro gud (form)
-  (` (save-excursion (set-buffer "*gud-a.out*") (, form))))
-
-(defun dbug (foo &optional fun)
-  (save-excursion
-    (set-buffer (get-buffer-create "*trace*"))
-    (goto-char (point-max))
-    (insert "***" (symbol-name foo) "\n")
-    (if fun
-	(funcall fun))))
-
-
-;;; gud.el --- Grand Unified Debugger mode for gdb, sdb, dbx, or xdb
-;;;            under Emacs
-
-;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
-;; Maintainer: FSF
-;; Version: 1.3
-;; Keywords: unix, tools
-
-;; Copyright (C) 1992, 1993 Free Software Foundation, Inc.
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs 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.
-
-;; GNU Emacs 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 GNU Emacs; if not, write to the Free Software
-;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; The ancestral gdb.el was by W. Schelter <wfs@rascal.ics.utexas.edu>
-;; It was later rewritten by rms.  Some ideas were due to Masanobu. 
-;; Grand Unification (sdb/dbx support) by Eric S. Raymond <esr@thyrsus.com>
-;; The overloading code was then rewritten by Barry Warsaw <bwarsaw@cen.com>,
-;; who also hacked the mode to use comint.el.  Shane Hartman <shane@spr.com>
-;; added support for xdb (HPUX debugger).
-
-;; Cygnus Support added support for gdb's --annotate=2.
-
-;;; Code:
-
-(require 'comint)
-(require 'etags)
-
-;; ======================================================================
-;; GUD commands must be visible in C buffers visited by GUD
-
-(defvar gud-key-prefix "\C-x\C-a"
-  "Prefix of all GUD commands valid in C buffers.")
-
-(global-set-key (concat gud-key-prefix "\C-l") 'gud-refresh)
-(global-set-key "\C-x " 'gud-break)	;; backward compatibility hack
-
-;; ======================================================================
-;; the overloading mechanism
-
-(defun gud-overload-functions (gud-overload-alist)
-  "Overload functions defined in GUD-OVERLOAD-ALIST.
-This association list has elements of the form
-     (ORIGINAL-FUNCTION-NAME  OVERLOAD-FUNCTION)"
-  (mapcar
-   (function (lambda (p) (fset (car p) (symbol-function (cdr p)))))
-   gud-overload-alist))
-
-(defun gud-massage-args (file args)
-  (error "GUD not properly entered."))
-
-(defun gud-marker-filter (str)
-  (error "GUD not properly entered."))
-
-(defun gud-find-file (f)
-  (error "GUD not properly entered."))
-
-;; ======================================================================
-;; command definition
-
-;; This macro is used below to define some basic debugger interface commands.
-;; Of course you may use `gud-def' with any other debugger command, including
-;; user defined ones.
-
-;; A macro call like (gud-def FUNC NAME KEY DOC) expands to a form
-;; which defines FUNC to send the command NAME to the debugger, gives
-;; it the docstring DOC, and binds that function to KEY in the GUD
-;; major mode.  The function is also bound in the global keymap with the
-;; GUD prefix.
-
-(defmacro gud-def (func cmd key &optional doc)
-  "Define FUNC to be a command sending STR and bound to KEY, with
-optional doc string DOC.  Certain %-escapes in the string arguments
-are interpreted specially if present.  These are:
-
-  %f	name (without directory) of current source file. 
-  %d	directory of current source file. 
-  %l	number of current source line
-  %e	text of the C lvalue or function-call expression surrounding point.
-  %a	text of the hexadecimal address surrounding point
-  %p	prefix argument to the command (if any) as a number
-
-  The `current' source file is the file of the current buffer (if
-we're in a C file) or the source file current at the last break or
-step (if we're in the GUD buffer).
-  The `current' line is that of the current buffer (if we're in a
-source file) or the source line number at the last break or step (if
-we're in the GUD buffer)."
-  (list 'progn
-	(list 'defun func '(arg)
-	      (or doc "")
-	      '(interactive "p")
-	      (list 'gud-call cmd 'arg))
-	(if key
-	    (list 'define-key
-		  '(current-local-map)
-		  (concat "\C-c" key)
-		  (list 'quote func)))
-	(if key
-	    (list 'global-set-key
-		  (list 'concat 'gud-key-prefix key)
-		  (list 'quote func)))))
-
-;; Where gud-display-frame should put the debugging arrow.  This is
-;; set by the marker-filter, which scans the debugger's output for
-;; indications of the current program counter.
-(defvar gud-last-frame nil)
-
-;; Used by gud-refresh, which should cause gud-display-frame to redisplay
-;; the last frame, even if it's been called before and gud-last-frame has
-;; been set to nil.
-(defvar gud-last-last-frame nil)
-
-;; All debugger-specific information is collected here.
-;; Here's how it works, in case you ever need to add a debugger to the mode.
-;;
-;; Each entry must define the following at startup:
-;;
-;;<name>
-;; comint-prompt-regexp
-;; gud-<name>-massage-args
-;; gud-<name>-marker-filter
-;; gud-<name>-find-file
-;;
-;; The job of the massage-args method is to modify the given list of
-;; debugger arguments before running the debugger.
-;;
-;; The job of the marker-filter method is to detect file/line markers in
-;; strings and set the global gud-last-frame to indicate what display
-;; action (if any) should be triggered by the marker.  Note that only
-;; whatever the method *returns* is displayed in the buffer; thus, you
-;; can filter the debugger's output, interpreting some and passing on
-;; the rest.
-;;
-;; The job of the find-file method is to visit and return the buffer indicated
-;; by the car of gud-tag-frame.  This may be a file name, a tag name, or
-;; something else.
-
-;; ======================================================================
-;; gdb functions
-
-;;; History of argument lists passed to gdb.
-(defvar gud-gdb-history nil)
-
-(defun gud-gdb-massage-args (file args)
-  (cons "--annotate=2" (cons file args)))
-
-
-;;
-;; In this world, there are gdb instance objects (of unspecified 
-;; representation) and buffers associated with those objects.
-;;
-
-;; 
-;; gdb-instance objects
-;; 
-
-(defun make-gdb-instance (proc)
-  "Create a gdb instance object from a gdb process."
-  (setq last-proc proc)
-  (let ((instance (cons 'gdb-instance proc)))
-    (save-excursion
-      (set-buffer (process-buffer proc))
-      (setq gdb-buffer-instance instance)
-      (progn
-	(mapcar 'make-variable-buffer-local gdb-instance-variables)
-	(setq gdb-buffer-type 'gud)
-	;; If we're taking over the buffer of another process,
-	;; take over it's ancillery buffers as well.
-	;;
-	(let ((dead (or old-gdb-buffer-instance)))
-	  (mapcar
-	   (function
-	    (lambda (b)
-	      (progn
-		(set-buffer b)
-		(if (eq dead gdb-buffer-instance)
-		    (setq gdb-buffer-instance instance)))))
-	     (buffer-list)))))
-    instance))
-
-(defun gdb-instance-process (inst) (cdr inst))
-
-;;; The list of instance variables is built up by the expansions of
-;;; DEF-GDB-VARIABLE
-;;;
-(defvar gdb-instance-variables '()
-  "A list of variables that are local to the gud buffer associated
-with a gdb instance.") 
-
-(defmacro def-gdb-variable
-  (name accessor setter &optional default doc)
-  (`
-   (progn
-     (defvar (, name) (, default) (, (or doc "undocumented")))
-     (if (not (memq '(, name) gdb-instance-variables))
-	 (setq gdb-instance-variables
-	       (cons '(, name) gdb-instance-variables)))
-     (, (and accessor
-	     (`
-	      (defun (, accessor) (instance)
-		(let
-		    ((buffer (gdb-get-instance-buffer instance 'gud)))
-		  (and buffer
-		       (save-excursion
-			 (set-buffer buffer)
-			 (, name))))))))
-     (, (and setter
-	     (`
-	      (defun (, setter) (instance val)
-		(let
-		    ((buffer (gdb-get-instance-buffer instance 'gud)))
-		  (and buffer
-		       (save-excursion
-			 (set-buffer buffer)
-			 (setq (, name) val)))))))))))
-
-(defmacro def-gdb-var (root-symbol &optional default doc)
-  (let* ((root (symbol-name root-symbol))
-	 (accessor (intern (concat "gdb-instance-" root)))
-	 (setter (intern (concat "set-gdb-instance-" root)))
-	 (var-name (intern (concat "gdb-" root))))
-    (` (def-gdb-variable
-	 (, var-name) (, accessor) (, setter)
-	 (, default) (, doc)))))
-
-(def-gdb-var buffer-instance nil
-  "In an instance buffer, the buffer's instance.")
-
-(def-gdb-var buffer-type nil
-  "One of the symbols bound in gdb-instance-buffer-rules")
-
-(def-gdb-var burst ""
-  "A string of characters from gdb that have not yet been processed.")
-
-(def-gdb-var input-queue ()
-  "A list of high priority gdb command objects.")
-
-(def-gdb-var idle-input-queue ()
-  "A list of low priority gdb command objects.")
-
-(def-gdb-var prompting nil
-  "True when gdb is idle with no pending input.")
-
-(def-gdb-var output-sink 'user
-  "The disposition of the output of the current gdb command.
-Possible values are these symbols:
-
-    user -- gdb output should be copied to the gud buffer 
-            for the user to see.
-
-    inferior -- gdb output should be copied to the inferior-io buffer
-
-    pre-emacs -- output should be ignored util the post-prompt
-                 annotation is received.  Then the output-sink
-		 becomes:...
-    emacs -- output should be collected in the partial-output-buffer
-	     for subsequent processing by a command.  This is the
-	     disposition of output generated by commands that
-	     gud mode sends to gdb on its own behalf.
-    post-emacs -- ignore input until the prompt annotation is 
-		  received, then go to USER disposition.
-")
-
-(def-gdb-var current-item nil
-  "The most recent command item sent to gdb.")
-
-(def-gdb-var pending-triggers '()
-  "A list of trigger functions that have run later than their output
-handlers.")
-
-(defun in-gdb-instance-context (instance form)
-  "Funcall `form' in the gud buffer of `instance'"
-  (save-excursion
-    (set-buffer (gdb-get-instance-buffer instance 'gud))
-    (funcall form)))
-
-;; end of instance vars
-
-;;
-;; finding instances
-;;
-
-(defun gdb-proc->instance (proc)
-  (save-excursion
-    (set-buffer (process-buffer proc))
-    gdb-buffer-instance))
-
-(defun gdb-mru-instance-buffer ()
-  "Return the most recently used (non-auxiliary) gdb gud buffer."
-  (save-excursion
-    (gdb-goto-first-gdb-instance (buffer-list))))
-
-(defun gdb-goto-first-gdb-instance (blist)
-  "Use gdb-mru-instance-buffer -- not this."
-  (and blist
-       (progn
-	 (set-buffer (car blist))
-	 (or (and gdb-buffer-instance
-		  (eq gdb-buffer-type 'gud)
-		  (car blist))
-	     (gdb-goto-first-gdb-instance (cdr blist))))))
-
-(defun buffer-gdb-instance (buf)
-  (save-excursion
-    (set-buffer buf)
-    gdb-buffer-instance))
-
-(defun gdb-needed-default-instance ()
-  "Return the most recently used gdb instance or signal an error."
-  (let ((buffer (gdb-mru-instance-buffer)))
-    (or (and buffer (buffer-gdb-instance buffer))
-	(error "No instance of gdb found."))))
-
-(defun gdb-instance-target-string (instance)
-  "The apparent name of the program being debugged by a gdb instance.
-For sure this the root string used in smashing together the gud 
-buffer's name, even if that doesn't happen to be the name of a 
-program."
-  (in-gdb-instance-context
-   instance
-   (function (lambda () gud-target-name))))
-
-
-
-;;
-;; Instance Buffers.
-;;
-
-;; More than one buffer can be associated with a gdb instance.
-;;
-;; Each buffer has a TYPE -- a symbol that identifies the function
-;; of that particular buffer.
-;;
-;; The usual gud interaction buffer is given the type `gud' and
-;; is constructed specially.  
-;;
-;; Others are constructed by gdb-get-create-instance-buffer and 
-;; named according to the rules set forth in the gdb-instance-buffer-rules-assoc
-
-(defun gdb-get-instance-buffer (instance key)
-  "Return the instance buffer for `instance' tagged with type `key'.
-The key should be one of the cars in `gdb-instance-buffer-rules-assoc'."
-  (save-excursion
-    (gdb-look-for-tagged-buffer instance key (buffer-list))))
-
-(defun gdb-get-create-instance-buffer (instance key)
-  "Create a new gdb instance buffer of the type specified by `key'.
-The key should be one of the cars in `gdb-instance-buffer-rules-assoc'."
-  (or (gdb-get-instance-buffer instance key)
-      (let* ((rules (assoc key gdb-instance-buffer-rules-assoc))
-	     (name (funcall (gdb-rules-name-maker rules) instance))
-	     (new (get-buffer-create name)))
-	(save-excursion
-	  (set-buffer new)
-	  (make-variable-buffer-local 'gdb-buffer-type)
-	  (setq gdb-buffer-type key)
-	  (make-variable-buffer-local 'gdb-buffer-instance)
-	  (setq gdb-buffer-instance instance)
-	  (if (cdr (cdr rules))
-	      (funcall (car (cdr (cdr rules)))))
-	  new))))
-
-(defun gdb-rules-name-maker (rules) (car (cdr rules)))
-
-(defun gdb-look-for-tagged-buffer (instance key bufs)
-  (let ((retval nil))
-    (while (and (not retval) bufs)
-      (set-buffer (car bufs))
-      (if (and (eq gdb-buffer-instance instance)
-	       (eq gdb-buffer-type key))
-	  (setq retval (car bufs)))
-      (setq bufs (cdr bufs))
-      )
-    retval))
-
-(defun gdb-instance-buffer-p (buf)
-  (save-excursion
-    (set-buffer buf)
-    (and gdb-buffer-type
-	 (not (eq gdb-buffer-type 'gud)))))
-
-;;
-;; This assoc maps buffer type symbols to rules.  Each rule is a list of
-;; at least one and possible more functions.  The functions have these
-;; roles in defining a buffer type:
-;;
-;;     NAME - take an instance, return a name for this type buffer for that 
-;;	      instance.
-;; The remaining function(s) are optional:
-;;
-;;     MODE - called in new new buffer with no arguments, should establish
-;;	      the proper mode for the buffer.
-;;
-
-(defvar gdb-instance-buffer-rules-assoc '())
-
-(defun gdb-set-instance-buffer-rules (buffer-type &rest rules)
-  (let ((binding (assoc buffer-type gdb-instance-buffer-rules-assoc)))
-    (if binding
-	(setcdr binding rules)
-      (setq gdb-instance-buffer-rules-assoc
-	    (cons (cons buffer-type rules)
-		  gdb-instance-buffer-rules-assoc)))))
-
-(gdb-set-instance-buffer-rules 'gud 'error) ; gud buffers are an exception to the rules
-
-;;
-;; partial-output buffers
-;;
-;; These accumulate output from a command executed on
-;; behalf of emacs (rather than the user).  
-;;
-
-(gdb-set-instance-buffer-rules 'gdb-partial-output-buffer
-			       'gdb-partial-output-name)
-
-(defun gdb-partial-output-name (instance)
-  (concat "*partial-output-"
-	  (gdb-instance-target-string instance)
-	  "*"))
-
-
-(gdb-set-instance-buffer-rules 'gdb-inferior-io
-			       'gdb-inferior-io-name
-			       'gud-inferior-io-mode)
-
-(defun gdb-inferior-io-name (instance)
-  (concat "*input/output of "
-	  (gdb-instance-target-string instance)
-	  "*"))
-
-(defvar gdb-inferior-io-mode-map (copy-keymap comint-mode-map))
-(define-key comint-mode-map "\C-c\C-c" 'gdb-inferior-io-interrupt)
-(define-key comint-mode-map "\C-c\C-z" 'gdb-inferior-io-stop)
-(define-key comint-mode-map "\C-c\C-\\" 'gdb-inferior-io-quit)
-(define-key comint-mode-map "\C-c\C-d" 'gdb-inferior-io-eof)
-
-(defun gud-inferior-io-mode ()
-  "Major mode for gud inferior-io.
-
-\\{comint-mode-map}"
-  ;; We want to use comint because it has various nifty and familiar
-  ;; features.  We don't need a process, but comint wants one, so create
-  ;; a dummy one.
-  (make-comint (substring (buffer-name) 1 (- (length (buffer-name)) 1))
-	       "/bin/cat")
-  (setq major-mode 'gud-inferior-io-mode)
-  (setq mode-name "Debuggee I/O")
-  (setq comint-input-sender 'gud-inferior-io-sender)
-)
-
-(defun gud-inferior-io-sender (proc string)
-  (save-excursion
-    (set-buffer (process-buffer proc))
-    (let ((instance gdb-buffer-instance))
-      (set-buffer (gdb-get-instance-buffer instance 'gud))
-      (let ((gud-proc (get-buffer-process (current-buffer))))
-	(process-send-string gud-proc string)
-	(process-send-string gud-proc "\n")
-    ))
-    ))
-
-(defun gdb-inferior-io-interrupt (instance)
-  "Interrupt the program being debugged."
-  (interactive (list (gdb-needed-default-instance)))
-  (interrupt-process
-   (get-buffer-process (gdb-get-instance-buffer instance 'gud)) comint-ptyp))
-
-(defun gdb-inferior-io-quit (instance)
-  "Send quit signal to the program being debugged."
-  (interactive (list (gdb-needed-default-instance)))
-  (quit-process
-   (get-buffer-process (gdb-get-instance-buffer instance 'gud)) comint-ptyp))
-
-(defun gdb-inferior-io-stop (instance)
-  "Stop the program being debugged."
-  (interactive (list (gdb-needed-default-instance)))
-  (stop-process
-   (get-buffer-process (gdb-get-instance-buffer instance 'gud)) comint-ptyp))
-
-(defun gdb-inferior-io-eof (instance)
-  "Send end-of-file to the program being debugged."
-  (interactive (list (gdb-needed-default-instance)))
-  (process-send-eof
-   (get-buffer-process (gdb-get-instance-buffer instance 'gud))))
-
-
-;;
-;; gdb communications
-;;
-
-;; INPUT: things sent to gdb
-;;
-;; Each instance has a high and low priority 
-;; input queue.  Low priority input is sent only 
-;; when the high priority queue is idle.
-;;
-;; The queues are lists.  Each element is either 
-;; a string (indicating user or user-like input)
-;; or a list of the form:
-;;
-;;    (INPUT-STRING  HANDLER-FN)
-;;
-;;
-;; The handler function will be called from the 
-;; partial-output buffer when the command completes.
-;; This is the way to write commands which 
-;; invoke gdb commands autonomously.
-;;
-;; These lists are consumed tail first.
-;;
-
-(defun gdb-send (proc string)
-  "A comint send filter for gdb.
-This filter may simply queue output for a later time."
-  (let ((instance (gdb-proc->instance proc)))
-    (gdb-instance-enqueue-input instance (concat string "\n"))))
-
-;; Note: Stuff enqueued here will be sent to the next prompt, even if it
-;; is a query, or other non-top-level prompt.  To guarantee stuff will get
-;; sent to the top-level prompt, currently it must be put in the idle queue.
-;;				 ^^^^^^^^^
-;; [This should encourage gud extentions that invoke gdb commands to let
-;;  the user go first; it is not a bug.     -t]
-;;
-
-(defun gdb-instance-enqueue-input (instance item)
-  (if (gdb-instance-prompting instance)
-      (progn
-	(gdb-send-item instance item)
-	(set-gdb-instance-prompting instance nil))
-    (set-gdb-instance-input-queue
-     instance
-     (cons item (gdb-instance-input-queue instance)))))
-
-(defun gdb-instance-dequeue-input (instance)
-  (let ((queue (gdb-instance-input-queue instance)))
-    (and queue
-       (if (not (cdr queue))
-	   (let ((answer (car queue)))
-	     (set-gdb-instance-input-queue instance '())
-	     answer)
-	 (gdb-take-last-elt queue)))))
-
-(defun gdb-instance-enqueue-idle-input (instance item)
-  (if (and (gdb-instance-prompting instance)
-	   (not (gdb-instance-input-queue instance)))
-      (progn
-	(gdb-send-item instance item)
-	(set-gdb-instance-prompting instance nil))
-    (set-gdb-instance-idle-input-queue
-     instance
-     (cons item (gdb-instance-idle-input-queue instance)))))
-
-(defun gdb-instance-dequeue-idle-input (instance)
-  (let ((queue (gdb-instance-idle-input-queue instance)))
-    (and queue
-       (if (not (cdr queue))
-	   (let ((answer (car queue)))
-	     (set-gdb-instance-idle-input-queue instance '())
-	     answer)
-	 (gdb-take-last-elt queue)))))
-
-; Don't use this in general.
-(defun gdb-take-last-elt (l)
-  (if (cdr (cdr l))
-      (gdb-take-last-elt (cdr l))
-    (let ((answer (car (cdr l))))
-      (setcdr l '())
-      answer)))
-
-
-;;
-;; output -- things gdb prints to emacs
-;;
-;; GDB output is a stream interrupted by annotations.
-;; Annotations can be recognized by their beginning
-;; with \C-j\C-z\C-z<tag><opt>\C-j
-;;
-;; The tag is a string obeying symbol syntax.
-;;
-;; The optional part `<opt>' can be either the empty string
-;; or a space followed by more data relating to the annotation.
-;; For example, the SOURCE annotation is followed by a filename,
-;; line number and various useless goo.  This data must not include
-;; any newlines.
-;;
-
-
-(defun gud-gdb-marker-filter (string)
-  "A gud marker filter for gdb."
-  ;; Bogons don't tell us the process except through scoping crud.
-  (let ((instance (gdb-proc->instance proc)))
-    (gdb-output-burst instance string)))
-
-(defvar gdb-annotation-rules
-  '(("frames-invalid" gdb-invalidate-frames)
-    ("breakpoints-invalid" gdb-invalidate-breakpoints)
-    ("pre-prompt" gdb-pre-prompt)
-    ("prompt" gdb-prompt)
-    ("commands" gdb-subprompt)
-    ("overload-choice" gdb-subprompt)
-    ("query" gdb-subprompt)
-    ("prompt-for-continue" gdb-subprompt)
-    ("post-prompt" gdb-post-prompt)
-    ("source" gdb-source)
-    ("starting" gdb-starting)
-    ("exited" gdb-stopping)
-    ("signalled" gdb-stopping)
-    ("signal" gdb-stopping)
-    ("breakpoint" gdb-stopping)
-    ("watchpoint" gdb-stopping)
-    ("stopped" gdb-stopped)
-    )
-  "An assoc mapping annotation tags to functions which process them.")
-
-
-(defun gdb-ignore-annotation (instance args)
-  nil)
-
-(defconst gdb-source-spec-regexp
-  "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:0x[a-f0-9]*")
-
-;; Do not use this except as an annotation handler."
-(defun gdb-source (instance args)
-  (string-match gdb-source-spec-regexp args)
-  ;; Extract the frame position from the marker.
-  (setq gud-last-frame
-	(cons
-	 (substring args (match-beginning 1) (match-end 1))
-	 (string-to-int (substring args
-				   (match-beginning 2)
-				   (match-end 2))))))
-
-;; An annotation handler for `prompt'.
-;; This sends the next command (if any) to gdb.
-(defun gdb-prompt (instance ignored)
-  (let ((sink (gdb-instance-output-sink instance)))
-    (cond
-     ((eq sink 'user) t)
-     ((eq sink 'post-emacs)
-      (set-gdb-instance-output-sink instance 'user))
-     (t
-      (set-gdb-instance-output-sink instance 'user)
-      (error "Phase error in gdb-prompt (got %s)" sink))))
-  (let ((highest (gdb-instance-dequeue-input instance)))
-    (if highest
-	(gdb-send-item instance highest)
-      (let ((lowest (gdb-instance-dequeue-idle-input instance)))
-	(if lowest
-	    (gdb-send-item instance lowest)
-	  (progn
-	    (set-gdb-instance-prompting instance t)
-	    (gud-display-frame)))))))
-
-;; An annotation handler for non-top-level prompts.
-(defun gdb-subprompt (instance ignored)
-  (let ((highest (gdb-instance-dequeue-input instance)))
-    (if highest
-	(gdb-send-item instance highest)
-      (set-gdb-instance-prompting instance t))))
-
-(defun gdb-send-item (instance item)
-  (set-gdb-instance-current-item instance item)
-  (if (stringp item)
-      (progn
-	(set-gdb-instance-output-sink instance 'user)
-	(process-send-string (gdb-instance-process instance)
-			     item))
-    (progn
-      (gdb-clear-partial-output instance)
-      (set-gdb-instance-output-sink instance 'pre-emacs)
-      (process-send-string (gdb-instance-process instance)
-			   (car item)))))
-
-;; An annotation handler for `pre-prompt'.
-;; This terminates the collection of output from a previous
-;; command if that happens to be in effect.
-(defun gdb-pre-prompt (instance ignored)
-  (let ((sink (gdb-instance-output-sink instance)))
-    (cond
-     ((eq sink 'user) t)
-     ((eq sink 'emacs)
-      (set-gdb-instance-output-sink instance 'post-emacs)
-      (let ((handler
-	     (car (cdr (gdb-instance-current-item instance)))))
-	(save-excursion
-	  (set-buffer (gdb-get-create-instance-buffer
-		       instance 'gdb-partial-output-buffer))
-	  (funcall handler))))
-     (t
-      (set-gdb-instance-output-sink instance 'user)
-      (error "Output sink phase error 1.")))))
-
-;; An annotation handler for `starting'.  This says that I/O for the subprocess
-;; is now the program being debugged, not GDB.
-(defun gdb-starting (instance ignored)
-  (let ((sink (gdb-instance-output-sink instance)))
-    (cond
-     ((eq sink 'user)
-      (set-gdb-instance-output-sink instance 'inferior)
-      ;; FIXME: need to send queued input
-      )
-     (t (error "Unexpected `starting' annotation")))))
-
-;; An annotation handler for `exited' and other annotations which say that
-;; I/O for the subprocess is now GDB, not the program being debugged.
-(defun gdb-stopping (instance ignored)
-  (let ((sink (gdb-instance-output-sink instance)))
-    (cond
-     ((eq sink 'inferior)
-      (set-gdb-instance-output-sink instance 'user)
-      )
-     (t (error "Unexpected stopping annotation")))))
-
-;; An annotation handler for `stopped'.  It is just like gdb-stopping, except
-;; that if we already set the output sink to 'user in gdb-stopping, that is 
-;; fine.
-(defun gdb-stopped (instance ignored)
-  (let ((sink (gdb-instance-output-sink instance)))
-    (cond
-     ((eq sink 'inferior)
-      (set-gdb-instance-output-sink instance 'user)
-      )
-     ((eq sink 'user)
-      t)
-     (t (error "Unexpected stopping annotation")))))
-
-;; An annotation handler for `post-prompt'.
-;; This begins the collection of output from the current
-;; command if that happens to be appropriate."
-(defun gdb-post-prompt (instance ignored)
-  (gdb-invalidate-registers instance ignored)
-  (let ((sink (gdb-instance-output-sink instance)))
-    (cond
-     ((eq sink 'user) t)
-     ((eq sink 'pre-emacs)
-      (set-gdb-instance-output-sink instance 'emacs))
-
-     (t
-      (set-gdb-instance-output-sink instance 'user)
-      (error "Output sink phase error 3.")))))
-
-;; Handle a burst of output from a gdb instance.
-;; This function is (indirectly) used as a gud-marker-filter.
-;; It must return output (if any) to be insterted in the gud 
-;; buffer.
-
-(defun gdb-output-burst (instance string)
-  "Handle a burst of output from a gdb instance.
-This function is (indirectly) used as a gud-marker-filter.
-It must return output (if any) to be insterted in the gud 
-buffer."
-
-  (save-match-data
-    (let (
-	  ;; Recall the left over burst from last time
-	  (burst (concat (gdb-instance-burst instance) string))
-	  ;; Start accumulating output for the gud buffer
-	  (output ""))
-
-      ;; Process all the complete markers in this chunk.
-
-      (while (string-match "\n\032\032\\(.*\\)\n" burst)
-	(let ((annotation (substring burst
-				     (match-beginning 1)
-				     (match-end 1))))
-	    
-	  ;; Stuff prior to the match is just ordinary output.
-	  ;; It is either concatenated to OUTPUT or directed
-	  ;; elsewhere.
-	  (setq output
-		(gdb-concat-output
-		 instance
-		 output
-		 (substring burst 0 (match-beginning 0))))
-
-	  ;; Take that stuff off the burst.
-	  (setq burst (substring burst (match-end 0)))
-	    
-	  ;; Parse the tag from the annotation, and maybe its arguments.
-	  (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation)
-	  (let* ((annotation-type (substring annotation
-					     (match-beginning 1)
-					     (match-end 1)))
-		 (annotation-arguments (substring annotation
-						  (match-beginning 2)
-						  (match-end 2)))
-		 (annotation-rule (assoc annotation-type
-					 gdb-annotation-rules)))
-	    ;; Call the handler for this annotation.
-	    (if annotation-rule
-		(funcall (car (cdr annotation-rule))
-			 instance
-			 annotation-arguments)
-	      ;; Else the annotation is not recognized.  Ignore it silently,
-	      ;; so that GDB can add new annotations without causing
-	      ;; us to blow up.
-	      ))))
-
-
-      ;; Does the remaining text end in a partial line?
-      ;; If it does, then keep part of the burst until we get more.
-      (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'"
-			burst)
-	  (progn
-	    ;; Everything before the potential marker start can be output.
-	    (setq output
-		  (gdb-concat-output
-		   instance
-		   output
-		   (substring burst 0 (match-beginning 0))))
-
-	    ;; Everything after, we save, to combine with later input.
-	    (setq burst (substring burst (match-beginning 0))))
-
-	;; In case we know the burst contains no partial annotations:
-	(progn
-	  (setq output (gdb-concat-output instance output burst))
-	  (setq burst "")))
-
-      ;; Save the remaining burst for the next call to this function.
-      (set-gdb-instance-burst instance burst)
-      output)))
-
-(defun gdb-concat-output (instance so-far new)
-  (let ((sink (gdb-instance-output-sink instance)))
-    (cond
-     ((eq sink 'user) (concat so-far new))
-     ((or (eq sink 'pre-emacs) (eq sink 'post-emacs)) so-far)
-     ((eq sink 'emacs)
-      (gdb-append-to-partial-output instance new)
-      so-far)
-     ((eq sink 'inferior)
-      (gdb-append-to-inferior-io instance new)
-      so-far)
-     (t (error "Bogon output sink %S" sink)))))
-
-(defun gdb-append-to-partial-output (instance string)
-  (save-excursion
-    (set-buffer
-     (gdb-get-create-instance-buffer
-      instance 'gdb-partial-output-buffer))
-    (goto-char (point-max))
-    (insert string)))
-
-(defun gdb-clear-partial-output (instance)
-  (save-excursion
-    (set-buffer
-     (gdb-get-create-instance-buffer
-      instance 'gdb-partial-output-buffer))
-    (delete-region (point-min) (point-max))))
-
-(defun gdb-append-to-inferior-io (instance string)
-  (save-excursion
-    (set-buffer
-     (gdb-get-create-instance-buffer
-      instance 'gdb-inferior-io))
-    (goto-char (point-max))
-    (insert-before-markers string))
-  (gud-display-buffer
-   (gdb-get-create-instance-buffer instance
-				   'gdb-inferior-io)))
-
-(defun gdb-clear-inferior-io (instance)
-  (save-excursion
-    (set-buffer
-     (gdb-get-create-instance-buffer
-      instance 'gdb-inferior-io))
-    (delete-region (point-min) (point-max))))
-
-
-
-;; One trick is to have a command who's output is always available in
-;; a buffer of it's own, and is always up to date.  We build several 
-;; buffers of this type.
-;;
-;; There are two aspects to this: gdb has to tell us when the output
-;; for that command might have changed, and we have to be able to run
-;; the command behind the user's back.
-;;
-;; The idle input queue and the output phasing associated with 
-;; the instance variable `(gdb-instance-output-sink instance)' help
-;; us to run commands behind the user's back.
-;; 
-;; Below is the code for specificly managing buffers of output from one 
-;; command.
-;;
-
-
-;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES
-;; It adds an idle input for the command we are tracking.  It should be the
-;; annotation rule binding of whatever gdb sends to tell us this command
-;; might have changed it's output.
-;;
-;; NAME is the fucntion name.  DEMAND-PREDICATE tests if output is really needed.
-;; GDB-COMMAND is a string of such.  OUTPUT-HANDLER is the function bound to the
-;; input in the input queue (see comment about ``gdb communications'' above).
-(defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command output-handler)
-  (`
-   (defun (, name) (instance &optional ignored)
-     (if (and ((, demand-predicate) instance)
-	      (not (member '(, name)
-			   (gdb-instance-pending-triggers instance))))
-	 (progn
-	   (gdb-instance-enqueue-idle-input
-	    instance
-	    (list (, gdb-command) '(, output-handler)))
-	   (set-gdb-instance-pending-triggers
-	    instance
-	    (cons '(, name)
-		  (gdb-instance-pending-triggers instance))))))))
-		
-(defmacro def-gdb-auto-update-handler (name trigger buf-key)
-  (`
-   (defun (, name) ()
-     (set-gdb-instance-pending-triggers
-      instance
-      (delq '(, trigger)
-	    (gdb-instance-pending-triggers instance)))
-     (let ((buf (gdb-get-instance-buffer instance
-					  '(, buf-key))))
-       (and buf
-	    (save-excursion
-	      (set-buffer buf)
-	      (let ((p (point))
-		    (buffer-read-only nil))
-		(delete-region (point-min) (point-max))
-		(insert-buffer (gdb-get-create-instance-buffer
-				instance
-				'gdb-partial-output-buffer))
-		(goto-char p))))))))
-
-(defmacro def-gdb-auto-updated-buffer
-  (buffer-key trigger-name gdb-command output-handler-name)
-  (`
-   (progn
-     (def-gdb-auto-update-trigger (, trigger-name)
-       ;; The demand predicate:
-       (lambda (instance)
-	 (gdb-get-instance-buffer instance '(, buffer-key)))
-       (, gdb-command)
-       (, output-handler-name))
-     (def-gdb-auto-update-handler (, output-handler-name)
-       (, trigger-name) (, buffer-key)))))
-
-
-
-;;
-;; Breakpoint buffers
-;; 
-;; These display the output of `info breakpoints'.
-;;
-
-       
-(gdb-set-instance-buffer-rules 'gdb-breakpoints-buffer
-			       'gdb-breakpoints-buffer-name
-			       'gud-breakpoints-mode)
-
-(def-gdb-auto-updated-buffer gdb-breakpoints-buffer
-  ;; This defines the auto update rule for buffers of type
-  ;; `gdb-breakpoints-buffer'.
-  ;;
-  ;; It defines a function to serve as the annotation handler that
-  ;; handles the `foo-invalidated' message.  That function is called:
-  gdb-invalidate-breakpoints
-
-  ;; To update the buffer, this command is sent to gdb.
-  "server info breakpoints\n"
-
-  ;; This also defines a function to be the handler for the output
-  ;; from the command above.  That function will copy the output into
-  ;; the appropriately typed buffer.  That function will be called:
-  gdb-info-breakpoints-handler)
-
-(defun gdb-breakpoints-buffer-name (instance)
-  (save-excursion
-    (set-buffer (process-buffer (gdb-instance-process instance)))
-    (concat "*breakpoints of " (gdb-instance-target-string instance) "*")))
-
-(defun gud-display-breakpoints-buffer (instance)
-  (interactive (list (gdb-needed-default-instance)))
-  (gud-display-buffer
-   (gdb-get-create-instance-buffer instance
-				    'gdb-breakpoints-buffer)))
-
-(defun gud-frame-breakpoints-buffer (instance)
-  (interactive (list (gdb-needed-default-instance)))
-  (gud-frame-buffer
-   (gdb-get-create-instance-buffer instance
-				    'gdb-breakpoints-buffer)))
-
-(defvar gud-breakpoints-mode-map nil)
-(setq gud-breakpoints-mode-map (make-keymap))
-(suppress-keymap gud-breakpoints-mode-map)
-(define-key gud-breakpoints-mode-map " " 'gud-toggle-bp-this-line)
-(define-key gud-breakpoints-mode-map "d" 'gud-delete-bp-this-line)
-
-(defun gud-breakpoints-mode ()
-  "Major mode for gud breakpoints.
-
-\\{gud-breakpoints-mode-map}"
-  (setq major-mode 'gud-breakpoints-mode)
-  (setq mode-name "Breakpoints")
-  (use-local-map gud-breakpoints-mode-map)
-  (setq buffer-read-only t)
-  (gdb-invalidate-breakpoints gdb-buffer-instance))
-
-(defun gud-toggle-bp-this-line ()
-  (interactive)
-  (save-excursion
-    (beginning-of-line 1)
-    (if (not (looking-at "\\([0-9]*\\)\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)"))
-	(error "Not recognized as breakpoint line (demo foo).")
-      (gdb-instance-enqueue-idle-input
-       gdb-buffer-instance
-       (list
-	(concat
-	 (if (eq ?y (char-after (match-beginning 2)))
-	     "server disable "
-	   "server enable ")
-	 (buffer-substring (match-beginning 0)
-			   (match-end 1))
-	 "\n")
-	'(lambda () nil)))
-      )))
-
-(defun gud-delete-bp-this-line ()
-  (interactive)
-  (save-excursion
-    (beginning-of-line 1)
-    (if (not (looking-at "\\([0-9]*\\)\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)"))
-	(error "Not recognized as breakpoint line (demo foo).")
-      (gdb-instance-enqueue-idle-input
-       gdb-buffer-instance
-       (list
-	(concat
-	 "server delete "
-	 (buffer-substring (match-beginning 0)
-			   (match-end 1))
-	 "\n")
-	'(lambda () nil)))
-      )))
-
-
-
-
-;;
-;; Frames buffers.  These display a perpetually correct bactracktrace
-;; (from the command `where').
-;;
-;; Alas, if your stack is deep, they are costly.
-;;
-
-(gdb-set-instance-buffer-rules 'gdb-stack-buffer
-			       'gdb-stack-buffer-name
-			       'gud-frames-mode)
-
-(def-gdb-auto-updated-buffer gdb-stack-buffer
-  gdb-invalidate-frames
-  "server where\n"
-  gdb-info-frames-handler)
-
-(defun gdb-stack-buffer-name (instance)
-  (save-excursion
-    (set-buffer (process-buffer (gdb-instance-process instance)))
-    (concat "*stack frames of "
-	    (gdb-instance-target-string instance) "*")))
-
-(defun gud-display-stack-buffer (instance)
-  (interactive (list (gdb-needed-default-instance)))
-  (gud-display-buffer
-   (gdb-get-create-instance-buffer instance
-				    'gdb-stack-buffer)))
-
-(defun gud-frame-stack-buffer (instance)
-  (interactive (list (gdb-needed-default-instance)))
-  (gud-frame-buffer
-   (gdb-get-create-instance-buffer instance
-				    'gdb-stack-buffer)))
-
-(defvar gud-frames-mode-map nil)
-(setq gud-frames-mode-map (make-keymap))
-(suppress-keymap gud-frames-mode-map)
-(define-key gud-frames-mode-map [mouse-2]
-  'gud-frames-select-by-mouse)
-
-(defun gud-frames-mode ()
-  "Major mode for gud frames.
-
-\\{gud-frames-mode-map}"
-  (setq major-mode 'gud-frames-mode)
-  (setq mode-name "Frames")
-  (setq buffer-read-only t)
-  (use-local-map gud-frames-mode-map)
-  (gdb-invalidate-frames gdb-buffer-instance))
-
-(defun gud-get-frame-number ()
-  (save-excursion
-    (let* ((pos (re-search-backward "^#\\([0-9]*\\)" nil t))
-	   (n (or (and pos
-		       (string-to-int
-			(buffer-substring (match-beginning 1)
-					  (match-end 1))))
-		  0)))
-      n)))
-
-(defun gud-frames-select-by-mouse (e)
-  (interactive "e")
-  (let (selection)
-    (save-excursion
-      (set-buffer (window-buffer (posn-window (event-end e))))
-      (save-excursion
-	(goto-char (posn-point (event-end e)))
-	(setq selection (gud-get-frame-number))))
-    (select-window (posn-window (event-end e)))
-    (save-excursion
-      (set-buffer (gdb-get-instance-buffer (gdb-needed-default-instance) 'gud))
-      (gud-call "fr %p" selection)
-      (gud-display-frame))))
-
-
-;;
-;; Registers buffers
-;;
-
-(def-gdb-auto-updated-buffer gdb-registers-buffer
-  gdb-invalidate-registers
-  "server info registers\n"
-  gdb-info-registers-handler)
-
-(gdb-set-instance-buffer-rules 'gdb-registers-buffer
-			       'gdb-registers-buffer-name
-			       'gud-registers-mode)
-
-(defvar gud-registers-mode-map nil)
-(setq gud-registers-mode-map (make-keymap))
-(suppress-keymap gud-registers-mode-map)
-
-(defun gud-registers-mode ()
-  "Major mode for gud registers.
-
-\\{gud-registers-mode-map}"
-  (setq major-mode 'gud-registers-mode)
-  (setq mode-name "Registers")
-  (setq buffer-read-only t)
-  (use-local-map gud-registers-mode-map)
-  (gdb-invalidate-registers gdb-buffer-instance))
-
-(defun gdb-registers-buffer-name (instance)
-  (save-excursion
-    (set-buffer (process-buffer (gdb-instance-process instance)))
-    (concat "*registers of " (gdb-instance-target-string instance) "*")))
-
-(defun gud-display-registers-buffer (instance)
-  (interactive (list (gdb-needed-default-instance)))
-  (gud-display-buffer
-   (gdb-get-create-instance-buffer instance
-				    'gdb-registers-buffer)))
-
-(defun gud-frame-registers-buffer (instance)
-  (interactive (list (gdb-needed-default-instance)))
-  (gud-frame-buffer
-   (gdb-get-create-instance-buffer instance
-				    'gdb-registers-buffer)))
-
-
-
-;;;; Menu windows:
-
-
-;; MENU-LIST is ((option option option...) (option option ...)...)
-;; 
-(defun gud-display-menu (menu-list)
-  (setq fill-column (min 120 (- (window-width)
-				(min 8 (window-width)))))
-  (while menu-list
-    (mapcar (function (lambda (x) (insert (symbol-name x) " "))) (car menu-list))
-    (fill-paragraph nil)
-    (insert "\n\n")
-    (setq menu-list (cdr menu-list)))
-  (goto-char (point-min))
-  (while (re-search-forward "\\([^ \n]+\\)\\(\n\\| \\)" nil t)
-    (put-text-property (match-beginning 1) (match-end 1)
-		       'mouse-face 'highlight))
-  (goto-char (point-min)))
-
-(defun gud-goto-menu (menu)
-  (setq gud-menu-position menu)
-  (let ((buffer-read-only nil))
-    (delete-region (point-min) (point-max))
-    (gud-display-menu menu)))
-
-(defun gud-menu-pick (event)
-  "Choose an item from a gdb command menu."
-  (interactive "e")
-  (let (choice)
-    (save-excursion
-      (set-buffer (window-buffer (posn-window (event-start event))))
-      (goto-char (posn-point (event-start event)))
-      (let (beg end)
-	(skip-chars-forward "^ \t\n")
-	(setq end (point))
-	(skip-chars-backward "^ \t\n")
-	(setq beg (point))
-	(setq choice (buffer-substring beg end))
-	(message choice)
-	(gud-invoke-menu (intern choice))))))
-
-(defun gud-invoke-menu (symbol)
-  (let ((meaning (assoc symbol gud-menu-rules)))
-    (cond
-     ((and (consp meaning)
-	   (consp (car (cdr meaning))))
-      (gud-goto-menu (car (cdr meaning))))
-     (meaning (call-interactively (car (cdr meaning)))))))
-
-
-
-(gdb-set-instance-buffer-rules 'gdb-command-buffer
-			       'gdb-command-buffer-name
-			       'gud-command-mode)
-
-(defvar gud-command-mode-map nil)
-(setq gud-command-mode-map (make-keymap))
-(suppress-keymap gud-command-mode-map)
-(define-key gud-command-mode-map [mouse-2] 'gud-menu-pick)
-
-(defun gud-command-mode ()
-  "Major mode for gud menu.
-
-\\{gud-command-mode-map}" (interactive) (setq major-mode 'gud-command-mode)
-  (setq mode-name "Menu") (setq buffer-read-only t) (use-local-map
-  gud-command-mode-map) (make-variable-buffer-local 'gud-menu-position)
-  (if (not gud-menu-position) (gud-goto-menu gud-running-menu)))
-
-(defun gdb-command-buffer-name (instance)
-  (save-excursion
-    (set-buffer (process-buffer (gdb-instance-process instance)))
-    (concat "*menu of " (gdb-instance-target-string instance) "*")))
-
-(defun gud-display-command-buffer (instance)
-  (interactive (list (gdb-needed-default-instance)))
-  (gud-display-buffer
-   (gdb-get-create-instance-buffer instance
-				   'gdb-command-buffer)
-   6))
-
-(defun gud-frame-command-buffer (instance)
-  (interactive (list (gdb-needed-default-instance)))
-  (gud-frame-buffer
-   (gdb-get-create-instance-buffer instance
-				    'gdb-command-buffer)))
-
-(defvar gud-selected-menu-titles ())
-(setq gud-selected-menu-titles 
-      '(RUNNING STACK DATA BREAKPOINTS FILES))  
-
-(setq gud-running-menu
-  (list
-   '(RUNNING stack breakpoints files)
-   '(target run next step continue finish stepi kill help-running)))
-  
-(setq gud-stack-menu
-  (list
-   '(running STACK breakpoints files)
-   '(up down frame backtrace return help-stack)))
-  
-(setq gud-data-menu
-  (list
-   '(running stack DATA breakpoints files)
-   '(whatis ptype print set display undisplay disassemble help-data)))
-
-(setq gud-breakpoints-menu
-  (list
-   '(running stack BREAKPOINTS files)
-   '(awatch rwatch watch break delete enable disable condition ignore help-breakpoints)))
-  
-(setq gud-files-menu
-  (list
-   '(running stack breakpoints FILES)
-   '(file core-file help-files)
-   '(exec-file load symbol-file add-symbol-file sharedlibrary)))
-
-(setq gud-menu-rules
-      (list
-       (list 'running gud-running-menu)
-       (list 'RUNNING gud-running-menu)
-       (list 'stack gud-stack-menu)
-       (list 'STACK gud-stack-menu)
-       (list 'data gud-data-menu)
-       (list 'DATA gud-data-menu)
-       (list 'breakpoints gud-breakpoints-menu)
-       (list 'BREAKPOINTS gud-breakpoints-menu)
-       (list 'files gud-files-menu)
-       (list 'FILES gud-files-menu)
-
-       (list 'target 'gud-target)
-       (list 'kill 'gud-kill)
-       (list 'stepi 'gud-stepi)
-       (list 'step 'gud-step)
-       (list 'next 'gud-next)
-       (list 'finish 'gud-finish)
-       (list 'continue 'gud-cont)
-       (list 'run 'gud-run)
-
-       (list 'backtrace 'gud-backtrace)
-       (list 'frame 'gud-frame)
-       (list 'down 'gud-down)
-       (list 'up 'gud-up)
-       (list 'return 'gud-return)
-
-       (list 'file 'gud-file)
-       (list 'core-file 'gud-core-file)
-       (list 'cd 'gud-cd)
-
-       (list 'exec-file 'gud-exec-file)
-       (list 'load 'gud-load)
-       (list 'symbol-file 'gud-symbol-file)
-       (list 'add-symbol-file 'gud-add-symbol-file)
-       (list 'sharedlibrary 'gud-sharedlibrary)
-       ))
-       
-
-
-
-(defun gdb-call-showing-gud (instance command)
-  (gud-display-gud-buffer instance)
-  (comint-input-sender (gdb-instance-process instance) command))
-
-(defvar gud-target-history ())
-
-(defun gud-temp-buffer-show (buf)
-  (let ((ow (selected-window)))
-    (unwind-protect
-	(progn
-	  (pop-to-buffer buf)
-
-	  ;; This insertion works around a bug in emacs.
-	  ;; The bug is that all the empty space after a
-	  ;; highlighted word that terminates a buffer
-	  ;; gets highlighted.  That's really ugly, so
-	  ;; make sure a highlighted word can't ever
-	  ;; terminate the buffer.
-	  (goto-char (point-max))
-	  (insert "\n")
-	  (goto-char (point-min))
-
-	  (if (< (window-height) 10)
-	      (enlarge-window (- 10 (window-height)))))
-      (select-window ow))))
-
-(defun gud-target (instance command)
-  (interactive 
-   (let* ((instance (gdb-needed-default-instance))
-	  (temp-buffer-show-function (function gud-temp-buffer-show))
-	  (target-name (completing-read (format "Target type: ")
-					'(("remote")
-					  ("core")
-					  ("child")
-					  ("exec"))
-					nil
-					t
-					nil
-					'gud-target-history)))
-     (list instance
-	   (cond
-	    ((equal target-name "child") "run")
-
-	    ((equal target-name "core")
-	     (concat "target core "
-		     (read-file-name "core file: "
-				     nil
-				     "core"
-				     t)))
-
-	    ((equal target-name "exec")
-	     (concat "target exec "
-		     (read-file-name "exec file: "
-				     nil
-				     "a.out"
-				     t)))
-
-	    ((equal target-name "remote")
-	     (concat "target remote "
-		     (read-file-name "serial line for remote: "
-				     "/dev/"
-				     "ttya"
-				     t)))
-
-	    (t "echo No such target command!")))))
-
-  (gud-display-gud-buffer instance)
-  (apply comint-input-sender
-	 (list (gdb-instance-process instance) command)))
-
-(defun gud-backtrace ()
-  (interactive)
-  (let ((instance  (gdb-needed-default-instance)))
-    (gud-display-gud-buffer instance)
-    (apply comint-input-sender
-	   (list (gdb-instance-process instance)
-		 "backtrace"))))
-
-(defun gud-frame ()
-  (interactive)
-  (let ((instance  (gdb-needed-default-instance)))
-    (apply comint-input-sender
-	   (list (gdb-instance-process instance)
-		 "frame"))))
-
-(defun gud-return (instance command)
-   (interactive
-    (let ((temp-buffer-show-function (function gud-temp-buffer-show)))
-      (list (gdb-needed-default-instance)
-	    (concat "return " (read-string "Expression to return: ")))))
-   (gud-display-gud-buffer instance)
-   (apply comint-input-sender
-	  (list (gdb-instance-process instance) command)))
-
-
-(defun gud-file (instance command)
-  (interactive
-   (let ((temp-buffer-show-function (function gud-temp-buffer-show)))
-     (list (gdb-needed-default-instance)
-	   (concat "file " (read-file-name "Executable to debug: "
-					   nil
-					   "a.out"
-					   t)))))
-  (gud-display-gud-buffer instance)
-  (apply comint-input-sender
-	 (list (gdb-instance-process instance) command)))
-
-(defun gud-core-file (instance command)
-  (interactive
-   (let ((temp-buffer-show-function (function gud-temp-buffer-show)))
-     (list (gdb-needed-default-instance)
-	   (concat "core " (read-file-name "Core file to debug: "
-					   nil
-					   "core-file"
-					   t)))))
-  (gud-display-gud-buffer instance)
-  (apply comint-input-sender
-	 (list (gdb-instance-process instance) command)))
-
-(defun gud-cd (dir)
-  (interactive "FChange GDB's default directory: ")
-  (let ((instance (gdb-needed-default-instance)))
-    (save-excursion
-      (set-buffer (gdb-get-instance-buffer instance 'gud))
-      (cd dir))
-    (gud-display-gud-buffer instance)
-    (apply comint-input-sender
-	   (list (gdb-instance-process instance)
-		 (concat "cd " dir)))))
-
-
-(defun gud-exec-file (instance command)
-  (interactive
-   (let ((temp-buffer-show-function (function gud-temp-buffer-show)))
-     (list (gdb-needed-default-instance)
-	   (concat "exec-file " (read-file-name "Init memory from executable: "
-						nil
-						"a.out"
-						t)))))
-  (gud-display-gud-buffer instance)
-  (apply comint-input-sender
-	 (list (gdb-instance-process instance) command)))
-
-(defun gud-load (instance command)
-  (interactive
-   (let ((temp-buffer-show-function (function gud-temp-buffer-show)))
-     (list (gdb-needed-default-instance)
-	   (concat "load " (read-file-name "Dynamicly load from file: "
-					   nil
-					   "a.out"
-					   t)))))
-  (gud-display-gud-buffer instance)
-  (apply comint-input-sender
-	 (list (gdb-instance-process instance) command)))
-
-(defun gud-symbol-file (instance command)
-  (interactive
-   (let ((temp-buffer-show-function (function gud-temp-buffer-show)))
-     (list (gdb-needed-default-instance)
-	   (concat "symbol-file " (read-file-name "Read symbol table from file: "
-						  nil
-						  "a.out"
-						  t)))))
-  (gud-display-gud-buffer instance)
-  (apply comint-input-sender
-	 (list (gdb-instance-process instance) command)))
-
-
-(defun gud-add-symbol-file (instance command)
-  (interactive
-   (let ((temp-buffer-show-function (function gud-temp-buffer-show)))
-     (list (gdb-needed-default-instance)
-	   (concat "add-symbol-file "
-		   (read-file-name "Add symbols from file: "
-				   nil
-				   "a.out"
-				   t)))))
-  (gud-display-gud-buffer instance)
-  (apply comint-input-sender
-	 (list (gdb-instance-process instance) command)))
-
-
-(defun gud-sharedlibrary (instance command)
-  (interactive
-   (let ((temp-buffer-show-function (function gud-temp-buffer-show)))
-     (list (gdb-needed-default-instance)
-	   (concat "sharedlibrary "
-		   (read-string "Load symbols for files matching regexp: ")))))
-  (gud-display-gud-buffer instance)
-  (apply comint-input-sender
-	 (list (gdb-instance-process instance) command)))
-
-
-
-
-
-;;;; Window management
-
-
-;;; FIXME: This should only return true for buffers in the current instance
-(defun gud-protected-buffer-p (buffer)
-  "Is BUFFER a buffer which we want to leave displayed?"
-  (save-excursion
-    (set-buffer buffer)
-    (or gdb-buffer-type
-	overlay-arrow-position)))
-
-;;; The way we abuse the dedicated-p flag is pretty gross, but seems
-;;; to do the right thing.  Seeing as there is no way for Lisp code to
-;;; get at the use_time field of a window, I'm not sure there exists a
-;;; more elegant solution without writing C code.
-
-(defun gud-display-buffer (buf &optional size)
-  (let ((must-split nil)
-	(answer nil))
-    (unwind-protect
-	(progn
-	  (walk-windows
-	   '(lambda (win)
-	      (if (gud-protected-buffer-p (window-buffer win))
-		  (set-window-dedicated-p win t))))
-	  (setq answer (get-buffer-window buf))
-	  (if (not answer)
-	      (let ((window (get-lru-window)))
-		(if window
-		    (progn
-		      (set-window-buffer window buf)
-		      (setq answer window))
-		  (setq must-split t)))))
-      (walk-windows
-       '(lambda (win)
-	  (if (gud-protected-buffer-p (window-buffer win))
-	      (set-window-dedicated-p win nil)))))
-    (if must-split
-	(let* ((largest (get-largest-window))
-	       (cur-size (window-height largest))
-	       (new-size (and size (< size cur-size) (- cur-size size))))
-	  (setq answer (split-window largest new-size))
-	  (set-window-buffer answer buf)))
-    answer))
-
-(defun existing-source-window (buffer)
-  (catch 'found
-    (save-excursion
-      (walk-windows
-       (function
-	(lambda (win)
-	  (if (and overlay-arrow-position
-		   (eq (window-buffer win)
-		       (marker-buffer overlay-arrow-position)))
-	      (progn
-		(set-window-buffer win buffer)
-		(throw 'found win))))))
-      nil)))
-      
-(defun gud-display-source-buffer (buffer)
-  (or (existing-source-window buffer)
-      (gud-display-buffer buffer)))
-
-(defun gud-frame-buffer (buf)
-  (save-excursion
-    (set-buffer buf)
-    (make-frame)))
-
-
-
-;;; Shared keymap initialization:
-
-(defun make-windows-menu (map)
-  (define-key map [menu-bar displays]
-    (cons "GDB-Windows" (make-sparse-keymap "GDB-Windows")))
-  (define-key map [menu-bar displays gdb]
-    '("Gdb" . gud-display-gud-buffer))
-  (define-key map [menu-bar displays registers]
-    '("Registers" . gud-display-registers-buffer))
-  (define-key map [menu-bar displays frames]
-    '("Stack" . gud-display-stack-buffer))
-  (define-key map [menu-bar displays breakpoints]
-    '("Breakpoints" . gud-display-breakpoints-buffer))
-  (define-key map [menu-bar displays commands]
-    '("Commands" . gud-display-command-buffer)))
-
-(defun gud-display-gud-buffer (instance)
-  (interactive (list (gdb-needed-default-instance)))
-  (gud-display-buffer
-   (gdb-get-create-instance-buffer instance 'gud)))
-
-(make-windows-menu gud-breakpoints-mode-map)
-(make-windows-menu gud-frames-mode-map)
-(make-windows-menu gud-registers-mode-map)
-
-
-
-(defun make-frames-menu (map)
-  (define-key map [menu-bar frames]
-    (cons "GDB-Frames" (make-sparse-keymap "GDB-Frames")))
-  (define-key map [menu-bar frames gdb]
-    '("Gdb" . gud-frame-gud-buffer))
-  (define-key map [menu-bar frames registers]
-    '("Registers" . gud-frame-registers-buffer))
-  (define-key map [menu-bar frames frames]
-    '("Stack" . gud-frame-stack-buffer))
-  (define-key map [menu-bar frames breakpoints]
-    '("Breakpoints" . gud-frame-breakpoints-buffer))
-  (define-key map [menu-bar displays commands]
-    '("Commands" . gud-display-command-buffer)))
-
-(defun gud-frame-gud-buffer (instance)
-  (interactive (list (gdb-needed-default-instance)))
-  (gud-frame-buffer
-   (gdb-get-create-instance-buffer instance 'gud)))
-
-(make-frames-menu gud-breakpoints-mode-map)
-(make-frames-menu gud-frames-mode-map)
-(make-frames-menu gud-registers-mode-map)
-
-
-(defun gud-gdb-find-file (f)
-  (find-file-noselect f))
-
-;;;###autoload
-(defun gdb (command-line)
-  "Run gdb on program FILE in buffer *gud-FILE*.
-The directory containing FILE becomes the initial working directory
-and source-file directory for your debugger."
-  (interactive
-   (list (read-from-minibuffer "Run gdb (like this): "
-			       (if (consp gud-gdb-history)
-				   (car gud-gdb-history)
-				 "gdb ")
-			       nil nil
-			       '(gud-gdb-history . 1))))
-  (gud-overload-functions
-   '((gud-massage-args . gud-gdb-massage-args)
-     (gud-marker-filter . gud-gdb-marker-filter)
-     (gud-find-file . gud-gdb-find-file)
-     ))
-
-  (let* ((words (gud-chop-words command-line))
-	 (program (car words))
-	 (file-word (let ((w (cdr words)))
-		      (while (and w (= ?- (aref (car w) 0)))
-			(setq w (cdr w)))
-		      (car w)))
-	 (args (delq file-word (cdr words)))
-	 (file (expand-file-name file-word))
-	 (filepart (file-name-nondirectory file))
-	 (buffer-name (concat "*gud-" filepart "*")))
-    (setq gdb-first-time (not (get-buffer-process buffer-name))))
-
-  (gud-common-init command-line)
-
-  (gud-def gud-break  "break %f:%l"  "\C-b" "Set breakpoint at current line.")
-  (gud-def gud-tbreak "tbreak %f:%l" "\C-t" "Set breakpoint at current line.")
-  (gud-def gud-remove "clear %l"     "\C-d" "Remove breakpoint at current line")
-  (gud-def gud-kill   "kill"	     nil    "Kill the program.")
-  (gud-def gud-run    "run"	     nil    "Run the program.")
-  (gud-def gud-stepi  "stepi %p"     "\C-i" "Step one instruction with display.")
-  (gud-def gud-step   "step %p"      "\C-s" "Step one source line with display.")
-  (gud-def gud-next   "next %p"      "\C-n" "Step one line (skip functions).")
-  (gud-def gud-finish "finish"       "\C-f" "Finish executing current function.")
-  (gud-def gud-cont   "cont"         "\C-r" "Continue with display.")
-  (gud-def gud-up     "up %p"        "<" "Up N stack frames (numeric arg).")
-  (gud-def gud-down   "down %p"      ">" "Down N stack frames (numeric arg).")
-  (gud-def gud-print  "print %e"     "\C-p" "Evaluate C expression at point.")
-
-  (setq comint-prompt-regexp "^(.*gdb[+]?) *")
-  (setq comint-input-sender 'gdb-send)
-  (run-hooks 'gdb-mode-hook)
-  (let ((instance
-	 (make-gdb-instance (get-buffer-process (current-buffer)))
-	 ))
-    (if gdb-first-time (gdb-clear-inferior-io instance)))
-  )
-
-
-;; ======================================================================
-;; sdb functions
-
-;;; History of argument lists passed to sdb.
-(defvar gud-sdb-history nil)
-
-(defvar gud-sdb-needs-tags (not (file-exists-p "/var"))
-  "If nil, we're on a System V Release 4 and don't need the tags hack.")
-
-(defvar gud-sdb-lastfile nil)
-
-(defun gud-sdb-massage-args (file args)
-  (cons file args))
-
-(defun gud-sdb-marker-filter (string)
-  (cond 
-   ;; System V Release 3.2 uses this format
-   ((string-match "\\(^0x\\w* in \\|^\\|\n\\)\\([^:\n]*\\):\\([0-9]*\\):.*\n"
-		    string)
-    (setq gud-last-frame
-	  (cons
-	   (substring string (match-beginning 2) (match-end 2))
-	   (string-to-int 
-	    (substring string (match-beginning 3) (match-end 3))))))
-   ;; System V Release 4.0 
-   ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n"
-		       string)
-    (setq gud-sdb-lastfile
-	  (substring string (match-beginning 2) (match-end 2))))
-   ((and gud-sdb-lastfile (string-match "^\\([0-9]+\\):" string))
-	 (setq gud-last-frame
-	       (cons
-		gud-sdb-lastfile
-		(string-to-int 
-		 (substring string (match-beginning 1) (match-end 1))))))
-   (t 
-    (setq gud-sdb-lastfile nil)))
-  string)
-
-(defun gud-sdb-find-file (f)
-  (if gud-sdb-needs-tags
-      (find-tag-noselect f)
-    (find-file-noselect f)))
-
-;;;###autoload
-(defun sdb (command-line)
-  "Run sdb on program FILE in buffer *gud-FILE*.
-The directory containing FILE becomes the initial working directory
-and source-file directory for your debugger."
-  (interactive
-   (list (read-from-minibuffer "Run sdb (like this): "
-			       (if (consp gud-sdb-history)
-				   (car gud-sdb-history)
-				 "sdb ")
-			       nil nil
-			       '(gud-sdb-history . 1))))
-  (if (and gud-sdb-needs-tags
-	   (not (and (boundp 'tags-file-name) (file-exists-p tags-file-name))))
-      (error "The sdb support requires a valid tags table to work."))
-  (gud-overload-functions '((gud-massage-args . gud-sdb-massage-args)
-			    (gud-marker-filter . gud-sdb-marker-filter)
-			    (gud-find-file . gud-sdb-find-file)
-			    ))
-
-  (gud-common-init command-line)
-
-  (gud-def gud-break  "%l b" "\C-b"   "Set breakpoint at current line.")
-  (gud-def gud-tbreak "%l c" "\C-t"   "Set temporary breakpoint at current line.")
-  (gud-def gud-remove "%l d" "\C-d"   "Remove breakpoint at current line")
-  (gud-def gud-step   "s %p" "\C-s"   "Step one source line with display.")
-  (gud-def gud-stepi  "i %p" "\C-i"   "Step one instruction with display.")
-  (gud-def gud-next   "S %p" "\C-n"   "Step one line (skip functions).")
-  (gud-def gud-cont   "c"    "\C-r"   "Continue with display.")
-  (gud-def gud-print  "%e/"  "\C-p"   "Evaluate C expression at point.")
-
-  (setq comint-prompt-regexp  "\\(^\\|\n\\)\\*")
-  (run-hooks 'sdb-mode-hook)
-  )
-
-;; ======================================================================
-;; dbx functions
-
-;;; History of argument lists passed to dbx.
-(defvar gud-dbx-history nil)
-
-(defun gud-dbx-massage-args (file args)
-  (cons file args))
-
-(defun gud-dbx-marker-filter (string)
-  (if (or (string-match
-         "stopped in .* at line \\([0-9]*\\) in file \"\\([^\"]*\\)\""
-         string)
-        (string-match
-         "signal .* in .* at line \\([0-9]*\\) in file \"\\([^\"]*\\)\""
-         string))
-      (setq gud-last-frame
-	    (cons
-	     (substring string (match-beginning 2) (match-end 2))
-	     (string-to-int 
-	      (substring string (match-beginning 1) (match-end 1))))))
-  string)
-
-(defun gud-dbx-find-file (f)
-  (find-file-noselect f))
-
-;;;###autoload
-(defun dbx (command-line)
-  "Run dbx on program FILE in buffer *gud-FILE*.
-The directory containing FILE becomes the initial working directory
-and source-file directory for your debugger."
-  (interactive
-   (list (read-from-minibuffer "Run dbx (like this): "
-			       (if (consp gud-dbx-history)
-				   (car gud-dbx-history)
-				 "dbx ")
-			       nil nil
-			       '(gud-dbx-history . 1))))
-  (gud-overload-functions '((gud-massage-args . gud-dbx-massage-args)
-			    (gud-marker-filter . gud-dbx-marker-filter)
-			    (gud-find-file . gud-dbx-find-file)
-			    ))
-
-  (gud-common-init command-line)
-
-  (gud-def gud-break  "file \"%d%f\"\nstop at %l"
-	   			  "\C-b" "Set breakpoint at current line.")
-;;  (gud-def gud-break  "stop at \"%f\":%l"
-;;	   			  "\C-b" "Set breakpoint at current line.")
-  (gud-def gud-remove "clear %l"  "\C-d" "Remove breakpoint at current line")
-  (gud-def gud-step   "step %p"	  "\C-s" "Step one line with display.")
-  (gud-def gud-stepi  "stepi %p"  "\C-i" "Step one instruction with display.")
-  (gud-def gud-next   "next %p"	  "\C-n" "Step one line (skip functions).")
-  (gud-def gud-cont   "cont"	  "\C-r" "Continue with display.")
-  (gud-def gud-up     "up %p"	  "<" "Up (numeric arg) stack frames.")
-  (gud-def gud-down   "down %p"	  ">" "Down (numeric arg) stack frames.")
-  (gud-def gud-print  "print %e"  "\C-p" "Evaluate C expression at point.")
-
-  (setq comint-prompt-regexp  "^[^)]*dbx) *")
-  (run-hooks 'dbx-mode-hook)
-  )
-
-;; ======================================================================
-;; xdb (HP PARISC debugger) functions
-
-;;; History of argument lists passed to xdb.
-(defvar gud-xdb-history nil)
-
-(defvar gud-xdb-directories nil
-  "*A list of directories that xdb should search for source code.
-If nil, only source files in the program directory
-will be known to xdb.
-
-The file names should be absolute, or relative to the directory
-containing the executable being debugged.")
-
-(defun gud-xdb-massage-args (file args)
-  (nconc (let ((directories gud-xdb-directories)
-	       (result nil))
-	   (while directories
-	     (setq result (cons (car directories) (cons "-d" result)))
-	     (setq directories (cdr directories)))
-	   (nreverse (cons file result)))
-	 args))
-
-(defun gud-xdb-file-name (f)
-  "Transform a relative pathname to a full pathname in xdb mode"
-  (let ((result nil))
-    (if (file-exists-p f)
-        (setq result (expand-file-name f))
-      (let ((directories gud-xdb-directories))
-        (while directories
-          (let ((path (concat (car directories) "/" f)))
-            (if (file-exists-p path)
-                (setq result (expand-file-name path)
-                      directories nil)))
-          (setq directories (cdr directories)))))
-    result))
-
-;; xdb does not print the lines all at once, so we have to accumulate them
-(defvar gud-xdb-accumulation "")
-
-(defun gud-xdb-marker-filter (string)
-  (let (result)
-    (if (or (string-match comint-prompt-regexp string)
-            (string-match ".*\012" string))
-        (setq result (concat gud-xdb-accumulation string)
-              gud-xdb-accumulation "")
-      (setq gud-xdb-accumulation (concat gud-xdb-accumulation string)))
-    (if result
-        (if (or (string-match "\\([^\n \t:]+\\): [^:]+: \\([0-9]+\\):" result)
-                (string-match "[^: \t]+:[ \t]+\\([^:]+\\): [^:]+: \\([0-9]+\\):"
-                              result))
-            (let ((line (string-to-int 
-                         (substring result (match-beginning 2) (match-end 2))))
-                  (file (gud-xdb-file-name
-                         (substring result (match-beginning 1) (match-end 1)))))
-              (if file
-                  (setq gud-last-frame (cons file line))))))
-    (or result "")))    
-               
-(defun gud-xdb-find-file (f)
-  (let ((realf (gud-xdb-file-name f)))
-    (if realf (find-file-noselect realf))))
-
-;;;###autoload
-(defun xdb (command-line)
-  "Run xdb on program FILE in buffer *gud-FILE*.
-The directory containing FILE becomes the initial working directory
-and source-file directory for your debugger.
-
-You can set the variable 'gud-xdb-directories' to a list of program source
-directories if your program contains sources from more than one directory."
-  (interactive
-   (list (read-from-minibuffer "Run xdb (like this): "
-			       (if (consp gud-xdb-history)
-				   (car gud-xdb-history)
-				 "xdb ")
-			       nil nil
-			       '(gud-xdb-history . 1))))
-  (gud-overload-functions '((gud-massage-args . gud-xdb-massage-args)
-			    (gud-marker-filter . gud-xdb-marker-filter)
-			    (gud-find-file . gud-xdb-find-file)))
-
-  (gud-common-init command-line)
-
-  (gud-def gud-break  "b %f:%l"    "\C-b" "Set breakpoint at current line.")
-  (gud-def gud-tbreak "b %f:%l\\t" "\C-t"
-           "Set temporary breakpoint at current line.")
-  (gud-def gud-remove "db"         "\C-d" "Remove breakpoint at current line")
-  (gud-def gud-step   "s %p"	   "\C-s" "Step one line with display.")
-  (gud-def gud-next   "S %p"	   "\C-n" "Step one line (skip functions).")
-  (gud-def gud-cont   "c"	   "\C-r" "Continue with display.")
-  (gud-def gud-up     "up %p"	   "<"    "Up (numeric arg) stack frames.")
-  (gud-def gud-down   "down %p"	   ">"    "Down (numeric arg) stack frames.")
-  (gud-def gud-finish "bu\\t"      "\C-f" "Finish executing current function.")
-  (gud-def gud-print  "p %e"       "\C-p" "Evaluate C expression at point.")
-
-  (setq comint-prompt-regexp  "^>")
-  (make-local-variable 'gud-xdb-accumulation)
-  (setq gud-xdb-accumulation "")
-  (run-hooks 'xdb-mode-hook))
-
-;; ======================================================================
-;; perldb functions
-
-;;; History of argument lists passed to perldb.
-(defvar gud-perldb-history nil)
-
-(defun gud-perldb-massage-args (file args)
-  (cons "-d" (cons file (cons "-emacs" args))))
-
-;; There's no guarantee that Emacs will hand the filter the entire
-;; marker at once; it could be broken up across several strings.  We
-;; might even receive a big chunk with several markers in it.  If we
-;; receive a chunk of text which looks like it might contain the
-;; beginning of a marker, we save it here between calls to the
-;; filter.
-(defvar gud-perldb-marker-acc "")
-
-(defun gud-perldb-marker-filter (string)
-  (save-match-data
-    (setq gud-perldb-marker-acc (concat gud-perldb-marker-acc string))
-    (let ((output ""))
-
-      ;; Process all the complete markers in this chunk.
-      (while (string-match "^\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n"
-			   gud-perldb-marker-acc)
-	(setq
-
-	 ;; Extract the frame position from the marker.
-	 gud-last-frame
-	 (cons (substring gud-perldb-marker-acc (match-beginning 1) (match-end 1))
-	       (string-to-int (substring gud-perldb-marker-acc
-					 (match-beginning 2)
-					 (match-end 2))))
-
-	 ;; Append any text before the marker to the output we're going
-	 ;; to return - we don't include the marker in this text.
-	 output (concat output
-			(substring gud-perldb-marker-acc 0 (match-beginning 0)))
-
-	 ;; Set the accumulator to the remaining text.
-	 gud-perldb-marker-acc (substring gud-perldb-marker-acc (match-end 0))))
-
-      ;; Does the remaining text look like it might end with the
-      ;; beginning of another marker?  If it does, then keep it in
-      ;; gud-perldb-marker-acc until we receive the rest of it.  Since we
-      ;; know the full marker regexp above failed, it's pretty simple to
-      ;; test for marker starts.
-      (if (string-match "^\032.*\\'" gud-perldb-marker-acc)
-	  (progn
-	    ;; Everything before the potential marker start can be output.
-	    (setq output (concat output (substring gud-perldb-marker-acc
-						   0 (match-beginning 0))))
-
-	    ;; Everything after, we save, to combine with later input.
-	    (setq gud-perldb-marker-acc
-		  (substring gud-perldb-marker-acc (match-beginning 0))))
-
-	(setq output (concat output gud-perldb-marker-acc)
-	      gud-perldb-marker-acc ""))
-
-      output)))
-
-(defun gud-perldb-find-file (f)
-  (find-file-noselect f))
-
-;;;###autoload
-(defun perldb (command-line)
-  "Run perldb on program FILE in buffer *gud-FILE*.
-The directory containing FILE becomes the initial working directory
-and source-file directory for your debugger."
-  (interactive
-   (list (read-from-minibuffer "Run perldb (like this): "
-			       (if (consp gud-perldb-history)
-				   (car gud-perldb-history)
-				 "perl ")
-			       nil nil
-			       '(gud-perldb-history . 1))))
-  (gud-overload-functions '((gud-massage-args . gud-perldb-massage-args)
-			    (gud-marker-filter . gud-perldb-marker-filter)
-			    (gud-find-file . gud-perldb-find-file)
-			    ))
-
-  (gud-common-init command-line)
-
-  (gud-def gud-break  "b %l"         "\C-b" "Set breakpoint at current line.")
-  (gud-def gud-remove "d %l"         "\C-d" "Remove breakpoint at current line")
-  (gud-def gud-step   "s"            "\C-s" "Step one source line with display.")
-  (gud-def gud-next   "n"            "\C-n" "Step one line (skip functions).")
-  (gud-def gud-cont   "c"            "\C-r" "Continue with display.")
-;  (gud-def gud-finish "finish"       "\C-f" "Finish executing current function.")
-;  (gud-def gud-up     "up %p"        "<" "Up N stack frames (numeric arg).")
-;  (gud-def gud-down   "down %p"      ">" "Down N stack frames (numeric arg).")
-  (gud-def gud-print  "%e"           "\C-p" "Evaluate perl expression at point.")
-
-  (setq comint-prompt-regexp "^  DB<[0-9]+> ")
-  (run-hooks 'perldb-mode-hook)
-  )
-
-;;
-;; End of debugger-specific information
-;;
-
-
-;;; When we send a command to the debugger via gud-call, it's annoying
-;;; to see the command and the new prompt inserted into the debugger's
-;;; buffer; we have other ways of knowing the command has completed.
-;;;
-;;; If the buffer looks like this:
-;;; --------------------
-;;; (gdb) set args foo bar
-;;; (gdb) -!-
-;;; --------------------
-;;; (the -!- marks the location of point), and we type `C-x SPC' in a
-;;; source file to set a breakpoint, we want the buffer to end up like
-;;; this:
-;;; --------------------
-;;; (gdb) set args foo bar
-;;; Breakpoint 1 at 0x92: file make-docfile.c, line 49.
-;;; (gdb) -!-
-;;; --------------------
-;;; Essentially, the old prompt is deleted, and the command's output
-;;; and the new prompt take its place.
-;;;
-;;; Not echoing the command is easy enough; you send it directly using
-;;; comint-input-sender, and it never enters the buffer.  However,
-;;; getting rid of the old prompt is trickier; you don't want to do it
-;;; when you send the command, since that will result in an annoying
-;;; flicker as the prompt is deleted, redisplay occurs while Emacs
-;;; waits for a response from the debugger, and the new prompt is
-;;; inserted.  Instead, we'll wait until we actually get some output
-;;; from the subprocess before we delete the prompt.  If the command
-;;; produced no output other than a new prompt, that prompt will most
-;;; likely be in the first chunk of output received, so we will delete
-;;; the prompt and then replace it with an identical one.  If the
-;;; command produces output, the prompt is moving anyway, so the
-;;; flicker won't be annoying.
-;;;
-;;; So - when we want to delete the prompt upon receipt of the next
-;;; chunk of debugger output, we position gud-delete-prompt-marker at
-;;; the start of the prompt; the process filter will notice this, and
-;;; delete all text between it and the process output marker.  If
-;;; gud-delete-prompt-marker points nowhere, we leave the current
-;;; prompt alone.
-(defvar gud-delete-prompt-marker nil)
-
-
-(defvar gdbish-comint-mode-map (copy-keymap comint-mode-map))
-(define-key gdbish-comint-mode-map "\C-c\M-\C-r" 'gud-display-registers-buffer)
-(define-key gdbish-comint-mode-map "\C-c\M-\C-f" 'gud-display-stack-buffer)
-(define-key gdbish-comint-mode-map "\C-c\M-\C-b" 'gud-display-breakpoints-buffer)
-
-(make-windows-menu gdbish-comint-mode-map)
-(make-frames-menu gdbish-comint-mode-map)
-
-(defun gud-mode ()
-  "Major mode for interacting with an inferior debugger process.
-
-   You start it up with one of the commands M-x gdb, M-x sdb, M-x dbx,
-or M-x xdb.  Each entry point finishes by executing a hook; `gdb-mode-hook',
-`sdb-mode-hook', `dbx-mode-hook' or `xdb-mode-hook' respectively.
-
-After startup, the following commands are available in both the GUD
-interaction buffer and any source buffer GUD visits due to a breakpoint stop
-or step operation:
-
-\\[gud-break] sets a breakpoint at the current file and line.  In the
-GUD buffer, the current file and line are those of the last breakpoint or
-step.  In a source buffer, they are the buffer's file and current line.
-
-\\[gud-remove] removes breakpoints on the current file and line.
-
-\\[gud-refresh] displays in the source window the last line referred to
-in the gud buffer.
-
-\\[gud-step], \\[gud-next], and \\[gud-stepi] do a step-one-line,
-step-one-line (not entering function calls), and step-one-instruction
-and then update the source window with the current file and position.
-\\[gud-cont] continues execution.
-
-\\[gud-print] tries to find the largest C lvalue or function-call expression
-around point, and sends it to the debugger for value display.
-
-The above commands are common to all supported debuggers except xdb which
-does not support stepping instructions.
-
-Under gdb, sdb and xdb, \\[gud-tbreak] behaves exactly like \\[gud-break],
-except that the breakpoint is temporary; that is, it is removed when
-execution stops on it.
-
-Under gdb, dbx, and xdb, \\[gud-up] pops up through an enclosing stack
-frame.  \\[gud-down] drops back down through one.
-
-If you are using gdb or xdb, \\[gud-finish] runs execution to the return from
-the current function and stops.
-
-All the keystrokes above are accessible in the GUD buffer
-with the prefix C-c, and in all buffers through the prefix C-x C-a.
-
-All pre-defined functions for which the concept make sense repeat
-themselves the appropriate number of times if you give a prefix
-argument.
-
-You may use the `gud-def' macro in the initialization hook to define other
-commands.
-
-Other commands for interacting with the debugger process are inherited from
-comint mode, which see."
-  (interactive)
-  (comint-mode)
-  (setq major-mode 'gud-mode)
-  (setq mode-name "Debugger")
-  (setq mode-line-process '(": %s"))
-  (use-local-map (copy-keymap gdbish-comint-mode-map))
-  (setq gud-last-frame nil)
-  (make-local-variable 'comint-prompt-regexp)
-  (make-local-variable 'gud-delete-prompt-marker)
-  (setq gud-delete-prompt-marker (make-marker))
-  (run-hooks 'gud-mode-hook)
-)
-
-(defvar gud-comint-buffer nil)
-
-;; Chop STRING into words separated by SPC or TAB and return a list of them.
-(defun gud-chop-words (string)
-  (let ((i 0) (beg 0)
-	(len (length string))
-	(words nil))
-    (while (< i len)
-      (if (memq (aref string i) '(?\t ? ))
-	  (progn
-	    (setq words (cons (substring string beg i) words)
-		  beg (1+ i))
-	    (while (and (< beg len) (memq (aref string beg) '(?\t ? )))
-	      (setq beg (1+ beg)))
-	    (setq i (1+ beg)))
-	(setq i (1+ i))))
-    (if (< beg len)
-	(setq words (cons (substring string beg) words)))
-    (nreverse words)))
-
-(defvar gud-target-name "--unknown--"
-  "The apparent name of the program being debugged in a gud buffer.
-For sure this the root string used in smashing together the gud 
-buffer's name, even if that doesn't happen to be the name of a 
-program.")
-
-;; Perform initializations common to all debuggers.
-(defun gud-common-init (command-line)
-  (let* ((words (gud-chop-words command-line))
-	 (program (car words))
-	 (file-word (let ((w (cdr words)))
-		      (while (and w (= ?- (aref (car w) 0)))
-			(setq w (cdr w)))
-		      (car w)))
-	 (args (delq file-word (cdr words)))
-	 (file (expand-file-name file-word))
-	 (filepart (file-name-nondirectory file))
-	 (buffer-name (concat "*gud-" filepart "*")))
-    (switch-to-buffer buffer-name)
-    (setq default-directory (file-name-directory file))
-    (or (bolp) (newline))
-    (insert "Current directory is " default-directory "\n")
-    (let ((old-instance gdb-buffer-instance))
-      (apply 'make-comint (concat "gud-" filepart) program nil
-	     (gud-massage-args file args))
-      (gud-mode)
-      (make-variable-buffer-local 'old-gdb-buffer-instance)
-      (setq old-gdb-buffer-instance old-instance))
-    (make-variable-buffer-local 'gud-target-name)
-    (setq gud-target-name filepart))
-  (set-process-filter (get-buffer-process (current-buffer)) 'gud-filter)
-  (set-process-sentinel (get-buffer-process (current-buffer)) 'gud-sentinel)
-  (gud-set-buffer)
-  )
-
-(defun gud-set-buffer ()
-  (cond ((eq major-mode 'gud-mode)
-	(setq gud-comint-buffer (current-buffer)))))
-
-;; These functions are responsible for inserting output from your debugger
-;; into the buffer.  The hard work is done by the method that is
-;; the value of gud-marker-filter.
-
-(defun gud-filter (proc string)
-  ;; Here's where the actual buffer insertion is done
-  (let ((inhibit-quit t))
-    (save-excursion
-      (set-buffer (process-buffer proc))
-      (let (moving output-after-point)
-	(save-excursion
-	  (goto-char (process-mark proc))
-	  ;; If we have been so requested, delete the debugger prompt.
-	  (if (marker-buffer gud-delete-prompt-marker)
-	      (progn
-		(delete-region (point) gud-delete-prompt-marker)
-		(set-marker gud-delete-prompt-marker nil)))
-	  (insert-before-markers (gud-marker-filter string))
-	  (setq moving (= (point) (process-mark proc)))
-	  (setq output-after-point (< (point) (process-mark proc)))
-	  ;; Check for a filename-and-line number.
-	  ;; Don't display the specified file
-	  ;; unless (1) point is at or after the position where output appears
-	  ;; and (2) this buffer is on the screen.
-	  (if (and gud-last-frame
-		   (not output-after-point)
-		   (get-buffer-window (current-buffer)))
-	      (gud-display-frame)))
-	(if moving (goto-char (process-mark proc)))))))
-
-(defun gud-proc-died (proc)
-  ;; Stop displaying an arrow in a source file.
-  (setq overlay-arrow-position nil)
-
-  ;; Kill the dummy process, so that C-x C-c won't worry about it.
-  (save-excursion
-    (set-buffer (process-buffer proc))
-    (kill-process
-     (get-buffer-process
-      (gdb-get-instance-buffer gdb-buffer-instance 'gdb-inferior-io))))
-  )
-
-(defun gud-sentinel (proc msg)
-  (cond ((null (buffer-name (process-buffer proc)))
-	 ;; buffer killed
-	 (gud-proc-died proc)
-	 (set-process-buffer proc nil))
-	((memq (process-status proc) '(signal exit))
-	 (gud-proc-died proc)
-
-	 ;; Fix the mode line.
-	 (setq mode-line-process
-	       (concat ": "
-		       (symbol-name (process-status proc))))
-	 (let* ((obuf (current-buffer)))
-	   ;; save-excursion isn't the right thing if
-	   ;;  process-buffer is current-buffer
-	   (unwind-protect
-	       (progn
-		 ;; Write something in *compilation* and hack its mode line,
-		 (set-buffer (process-buffer proc))
-		 ;; Force mode line redisplay soon
-		 (set-buffer-modified-p (buffer-modified-p))
-		 (if (eobp)
-		     (insert ?\n mode-name " " msg)
-		   (save-excursion
-		     (goto-char (point-max))
-		     (insert ?\n mode-name " " msg)))
-		 ;; If buffer and mode line will show that the process
-		 ;; is dead, we can delete it now.  Otherwise it
-		 ;; will stay around until M-x list-processes.
-		 (delete-process proc))
-	     ;; Restore old buffer, but don't restore old point
-	     ;; if obuf is the gud buffer.
-	     (set-buffer obuf))))))
-
-(defun gud-display-frame ()
-  "Find and obey the last filename-and-line marker from the debugger.
-Obeying it means displaying in another window the specified file and line."
-  (interactive)
-  (if gud-last-frame
-   (progn
-;     (gud-set-buffer)
-     (gud-display-line (car gud-last-frame) (cdr gud-last-frame))
-     (setq gud-last-last-frame gud-last-frame
-	   gud-last-frame nil))))
-
-;; Make sure the file named TRUE-FILE is in a buffer that appears on the screen
-;; and that its line LINE is visible.
-;; Put the overlay-arrow on the line LINE in that buffer.
-;; Most of the trickiness in here comes from wanting to preserve the current
-;; region-restriction if that's possible.  We use an explicit display-buffer
-;; to get around the fact that this is called inside a save-excursion.
-
-(defun gud-display-line (true-file line)
-  (let* ((buffer (gud-find-file true-file))
-	 (window (gud-display-source-buffer buffer))
-	 (pos))
-    (if (not window)
-	(error "foo bar baz"))
-;;;    (if (equal buffer (current-buffer))
-;;;	nil
-;;;      (setq buffer-read-only nil))
-    (save-excursion
-;;;      (setq buffer-read-only t)
-      (set-buffer buffer)
-      (save-restriction
-	(widen)
-	(goto-line line)
-	(setq pos (point))
-	(setq overlay-arrow-string "=>")
-	(or overlay-arrow-position
-	    (setq overlay-arrow-position (make-marker)))
-	(set-marker overlay-arrow-position (point) (current-buffer)))
-      (cond ((or (< pos (point-min)) (> pos (point-max)))
-	     (widen)
-	     (goto-char pos))))
-    (set-window-point window overlay-arrow-position)))
-
-;;; The gud-call function must do the right thing whether its invoking
-;;; keystroke is from the GUD buffer itself (via major-mode binding)
-;;; or a C buffer.  In the former case, we want to supply data from
-;;; gud-last-frame.  Here's how we do it:
-
-(defun gud-format-command (str arg)
-  (let ((insource (not (eq (current-buffer) gud-comint-buffer))))
-    (if (string-match "\\(.*\\)%f\\(.*\\)" str)
-	(setq str (concat
-		   (substring str (match-beginning 1) (match-end 1))
-		   (file-name-nondirectory (if insource
-					       (buffer-file-name)
-					     (car gud-last-frame)))
-		   (substring str (match-beginning 2) (match-end 2)))))
-    (if (string-match "\\(.*\\)%d\\(.*\\)" str)
-	(setq str (concat
-		   (substring str (match-beginning 1) (match-end 1))
-		   (file-name-directory (if insource
-					    (buffer-file-name)
-					  (car gud-last-frame)))
-		   (substring str (match-beginning 2) (match-end 2)))))
-    (if (string-match "\\(.*\\)%l\\(.*\\)" str)
-	(setq str (concat
-		   (substring str (match-beginning 1) (match-end 1))
-		   (if insource
-		       (save-excursion
-			 (beginning-of-line)
-			 (save-restriction (widen) 
-					   (1+ (count-lines 1 (point)))))
-		     (cdr gud-last-frame))
-		   (substring str (match-beginning 2) (match-end 2)))))
-    (if (string-match "\\(.*\\)%e\\(.*\\)" str)
-	(setq str (concat
-		   (substring str (match-beginning 1) (match-end 1))
-		   (find-c-expr)
-		   (substring str (match-beginning 2) (match-end 2)))))
-    (if (string-match "\\(.*\\)%a\\(.*\\)" str)
-	(setq str (concat
-		   (substring str (match-beginning 1) (match-end 1))
-		   (gud-read-address)
-		   (substring str (match-beginning 2) (match-end 2)))))
-    (if (string-match "\\(.*\\)%p\\(.*\\)" str)
-	(setq str (concat
-		   (substring str (match-beginning 1) (match-end 1))
-		   (if arg (int-to-string arg) "")
-		   (substring str (match-beginning 2) (match-end 2)))))
-    )
-  str
-  )
-
-(defun gud-read-address ()
-  "Return a string containing the core-address found in the buffer at point."
-  (save-excursion
-    (let ((pt (point)) found begin)
-      (setq found (if (search-backward "0x" (- pt 7) t) (point)))
-      (cond
-       (found (forward-char 2)
-	      (buffer-substring found
-				(progn (re-search-forward "[^0-9a-f]")
-				       (forward-char -1)
-				       (point))))
-       (t (setq begin (progn (re-search-backward "[^0-9]") 
-			     (forward-char 1)
-			     (point)))
-	  (forward-char 1)
-	  (re-search-forward "[^0-9]")
-	  (forward-char -1)
-	  (buffer-substring begin (point)))))))
-
-(defun gud-call (fmt &optional arg)
-  (let ((msg (gud-format-command fmt arg)))
-    (message "Command: %s" msg)
-    (sit-for 0)
-    (gud-basic-call msg)))
-
-(defun gud-basic-call (command)
-  "Invoke the debugger COMMAND displaying source in other window."
-  (interactive)
-  (gud-set-buffer)
-  (let ((proc (get-buffer-process gud-comint-buffer)))
-
-    ;; Arrange for the current prompt to get deleted.
-    (save-excursion
-      (set-buffer gud-comint-buffer)
-      (goto-char (process-mark proc))
-      (beginning-of-line)
-      (if (looking-at comint-prompt-regexp)
-	  (set-marker gud-delete-prompt-marker (point)))
-      (apply comint-input-sender (list proc command)))))
-
-(defun gud-refresh (&optional arg)
-  "Fix up a possibly garbled display, and redraw the arrow."
-  (interactive "P")
-  (recenter arg)
-  (or gud-last-frame (setq gud-last-frame gud-last-last-frame))
-  (gud-display-frame))
-
-;;; Code for parsing expressions out of C code.  The single entry point is
-;;; find-c-expr, which tries to return an lvalue expression from around point.
-;;;
-;;; The rest of this file is a hacked version of gdbsrc.el by
-;;; Debby Ayers <ayers@asc.slb.com>,
-;;; Rich Schaefer <schaefer@asc.slb.com> Schlumberger, Austin, Tx.
-
-(defun find-c-expr ()
-  "Returns the C expr that surrounds point."
-  (interactive)
-  (save-excursion
-    (let ((p) (expr) (test-expr))
-      (setq p (point))
-      (setq expr (expr-cur))
-      (setq test-expr (expr-prev))
-      (while (expr-compound test-expr expr)
-	(setq expr (cons (car test-expr) (cdr expr)))
-	(goto-char (car expr))
-	(setq test-expr (expr-prev)))
-      (goto-char p)
-      (setq test-expr (expr-next))
-      (while (expr-compound expr test-expr)
-	(setq expr (cons (car expr) (cdr test-expr)))
-	(setq test-expr (expr-next))
-	)
-      (buffer-substring (car expr) (cdr expr)))))
-
-(defun expr-cur ()
-  "Returns the expr that point is in; point is set to beginning of expr.
-The expr is represented as a cons cell, where the car specifies the point in
-the current buffer that marks the beginning of the expr and the cdr specifies 
-the character after the end of the expr."
-  (let ((p (point)) (begin) (end))
-    (expr-backward-sexp)
-    (setq begin (point))
-    (expr-forward-sexp)
-    (setq end (point))
-    (if (>= p end) 
-	(progn
-	 (setq begin p)
-	 (goto-char p)
-	 (expr-forward-sexp)
-	 (setq end (point))
-	 )
-      )
-    (goto-char begin)
-    (cons begin end)))
-
-(defun expr-backward-sexp ()
-  "Version of `backward-sexp' that catches errors."
-  (condition-case nil
-      (backward-sexp)
-    (error t)))
-
-(defun expr-forward-sexp ()
-  "Version of `forward-sexp' that catches errors."
-  (condition-case nil
-     (forward-sexp)
-    (error t)))
-
-(defun expr-prev ()
-  "Returns the previous expr, point is set to beginning of that expr.
-The expr is represented as a cons cell, where the car specifies the point in
-the current buffer that marks the beginning of the expr and the cdr specifies 
-the character after the end of the expr"
-  (let ((begin) (end))
-    (expr-backward-sexp)
-    (setq begin (point))
-    (expr-forward-sexp)
-    (setq end (point))
-    (goto-char begin)
-    (cons begin end)))
-
-(defun expr-next ()
-  "Returns the following expr, point is set to beginning of that expr.
-The expr is represented as a cons cell, where the car specifies the point in
-the current buffer that marks the beginning of the expr and the cdr specifies 
-the character after the end of the expr."
-  (let ((begin) (end))
-    (expr-forward-sexp)
-    (expr-forward-sexp)
-    (setq end (point))
-    (expr-backward-sexp)
-    (setq begin (point))
-    (cons begin end)))
-
-(defun expr-compound-sep (span-start span-end)
-  "Returns '.' for '->' & '.', returns ' ' for white space,
-returns '?' for other punctuation."
-  (let ((result ? )
-	(syntax))
-    (while (< span-start span-end)
-      (setq syntax (char-syntax (char-after span-start)))
-      (cond
-       ((= syntax ? ) t)
-       ((= syntax ?.) (setq syntax (char-after span-start))
-	(cond 
-	 ((= syntax ?.) (setq result ?.))
-	 ((and (= syntax ?-) (= (char-after (+ span-start 1)) ?>))
-	  (setq result ?.)
-	  (setq span-start (+ span-start 1)))
-	 (t (setq span-start span-end)
-	    (setq result ??)))))
-      (setq span-start (+ span-start 1)))
-    result))
-
-(defun expr-compound (first second)
-  "Non-nil if concatenating FIRST and SECOND makes a single C token.
-The two exprs are represented as a cons cells, where the car 
-specifies the point in the current buffer that marks the beginning of the 
-expr and the cdr specifies the character after the end of the expr.
-Link exprs of the form:
-      Expr -> Expr
-      Expr . Expr
-      Expr (Expr)
-      Expr [Expr]
-      (Expr) Expr
-      [Expr] Expr"
-  (let ((span-start (cdr first))
-	(span-end (car second))
-	(syntax))
-    (setq syntax (expr-compound-sep span-start span-end))
-    (cond
-     ((= (car first) (car second)) nil)
-     ((= (cdr first) (cdr second)) nil)
-     ((= syntax ?.) t)
-     ((= syntax ? )
-	 (setq span-start (char-after (- span-start 1)))
-	 (setq span-end (char-after span-end))
-	 (cond
-	  ((= span-start ?) ) t )
-	  ((= span-start ?] ) t )
-          ((= span-end ?( ) t )
-	  ((= span-end ?[ ) t )
-	  (t nil))
-	 )
-     (t nil))))
-
-(provide 'gud)
-
-;;; gud.el ends here
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 55afe11..d9c038d 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -22,13 +22,13 @@
 
 /* This file was created with the aid of ``gdbarch.sh''.
 
-   The bourn shell script ``gdbarch.sh'' creates the files
+   The Bourne shell script ``gdbarch.sh'' creates the files
    ``new-gdbarch.c'' and ``new-gdbarch.h and then compares them
    against the existing ``gdbarch.[hc]''.  Any differences found
    being reported.
 
    If editing this file, please also run gdbarch.sh and merge any
-   changes into that script. Conversely, when makeing sweeping changes
+   changes into that script. Conversely, when making sweeping changes
    to this file, modifying gdbarch.sh and using its output may prove
    easier. */
 
@@ -93,6 +93,7 @@
 
   /* target specific vector. */
   struct gdbarch_tdep *tdep;
+  gdbarch_dump_tdep_ftype *dump_tdep;
 
   /* per-architecture data-pointers */
   int nr_data;
@@ -116,7 +117,7 @@
      verify_gdbarch(): Confirm that the target updated the field
      correctly.
 
-     gdbarch_dump(): Add a fprintf_unfiltered call to so that the new
+     gdbarch_dump(): Add a fprintf_unfiltered call so that the new
      field is dumped out
 
      ``startup_gdbarch()'': Append an initial value to the static
@@ -127,8 +128,6 @@
 
      */
 
-  int bfd_vma_bit;
-  int ptr_bit;
   int short_bit;
   int int_bit;
   int long_bit;
@@ -136,6 +135,9 @@
   int float_bit;
   int double_bit;
   int long_double_bit;
+  int ptr_bit;
+  int addr_bit;
+  int bfd_vma_bit;
   int ieee_float;
   gdbarch_read_pc_ftype *read_pc;
   gdbarch_write_pc_ftype *write_pc;
@@ -144,12 +146,18 @@
   gdbarch_read_sp_ftype *read_sp;
   gdbarch_write_sp_ftype *write_sp;
   int num_regs;
+  int num_pseudo_regs;
   int sp_regnum;
   int fp_regnum;
   int pc_regnum;
   int fp0_regnum;
   int npc_regnum;
   int nnpc_regnum;
+  gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum;
+  gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum;
+  gdbarch_dwarf_reg_to_regnum_ftype *dwarf_reg_to_regnum;
+  gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum;
+  gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum;
   gdbarch_register_name_ftype *register_name;
   int register_size;
   int register_bytes;
@@ -159,6 +167,9 @@
   gdbarch_register_virtual_size_ftype *register_virtual_size;
   int max_register_virtual_size;
   gdbarch_register_virtual_type_ftype *register_virtual_type;
+  gdbarch_do_registers_info_ftype *do_registers_info;
+  gdbarch_register_sim_regno_ftype *register_sim_regno;
+  gdbarch_register_bytes_ok_ftype *register_bytes_ok;
   int use_generic_dummy_frames;
   int call_dummy_location;
   gdbarch_call_dummy_address_ftype *call_dummy_address;
@@ -180,6 +191,8 @@
   gdbarch_register_convertible_ftype *register_convertible;
   gdbarch_register_convert_to_virtual_ftype *register_convert_to_virtual;
   gdbarch_register_convert_to_raw_ftype *register_convert_to_raw;
+  gdbarch_fetch_pseudo_register_ftype *fetch_pseudo_register;
+  gdbarch_store_pseudo_register_ftype *store_pseudo_register;
   gdbarch_pointer_to_address_ftype *pointer_to_address;
   gdbarch_address_to_pointer_ftype *address_to_pointer;
   gdbarch_return_value_on_stack_ftype *return_value_on_stack;
@@ -219,11 +232,13 @@
   gdbarch_saved_pc_after_call_ftype *saved_pc_after_call;
   gdbarch_frame_num_args_ftype *frame_num_args;
   gdbarch_stack_align_ftype *stack_align;
+  int extra_stack_alignment_needed;
   gdbarch_reg_struct_has_addr_ftype *reg_struct_has_addr;
   gdbarch_save_dummy_frame_tos_ftype *save_dummy_frame_tos;
   const struct floatformat * float_format;
   const struct floatformat * double_format;
   const struct floatformat * long_double_format;
+  gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr;
 };
 
 
@@ -232,17 +247,16 @@
 
 extern const struct bfd_arch_info bfd_default_arch_struct;
 
-struct gdbarch startup_gdbarch = {
+struct gdbarch startup_gdbarch =
+{
   /* basic architecture information */
   &bfd_default_arch_struct,
   BIG_ENDIAN,
-  /* target specific vector */
-  NULL,
+  /* target specific vector and its dump routine */
+  NULL, NULL,
   /*per-architecture data-pointers and swap regions */
   0, NULL, NULL,
   /* Multi-arch values */
-  8 * sizeof (void*),
-  8 * sizeof (void*),
   8 * sizeof (short),
   8 * sizeof (int),
   8 * sizeof (long),
@@ -250,6 +264,18 @@
   8 * sizeof (float),
   8 * sizeof (double),
   8 * sizeof (long double),
+  8 * sizeof (void*),
+  8 * sizeof (void*),
+  8 * sizeof (void*),
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
   0,
   0,
   0,
@@ -338,12 +364,17 @@
   0,
   0,
   0,
+  0,
+  0,
+  0,
+  0,
   /* startup_gdbarch() */
 };
+
 struct gdbarch *current_gdbarch = &startup_gdbarch;
 
 
-/* Create a new ``struct gdbarch'' based in information provided by
+/* Create a new ``struct gdbarch'' based on information provided by
    ``struct gdbarch_info''. */
 
 struct gdbarch *
@@ -359,7 +390,21 @@
   gdbarch->byte_order = info->byte_order;
 
   /* Force the explicit initialization of these. */
+  gdbarch->short_bit = 2*TARGET_CHAR_BIT;
+  gdbarch->int_bit = 4*TARGET_CHAR_BIT;
+  gdbarch->long_bit = 4*TARGET_CHAR_BIT;
+  gdbarch->long_long_bit = 2*TARGET_LONG_BIT;
+  gdbarch->float_bit = 4*TARGET_CHAR_BIT;
+  gdbarch->double_bit = 8*TARGET_CHAR_BIT;
+  gdbarch->long_double_bit = 2*TARGET_DOUBLE_BIT;
+  gdbarch->ptr_bit = TARGET_INT_BIT;
   gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address;
+  gdbarch->read_pc = generic_target_read_pc;
+  gdbarch->write_pc = generic_target_write_pc;
+  gdbarch->read_fp = generic_target_read_fp;
+  gdbarch->write_fp = generic_target_write_fp;
+  gdbarch->read_sp = generic_target_read_sp;
+  gdbarch->write_sp = generic_target_write_sp;
   gdbarch->num_regs = -1;
   gdbarch->sp_regnum = -1;
   gdbarch->fp_regnum = -1;
@@ -367,11 +412,18 @@
   gdbarch->fp0_regnum = -1;
   gdbarch->npc_regnum = -1;
   gdbarch->nnpc_regnum = -1;
+  gdbarch->stab_reg_to_regnum = no_op_reg_to_regnum;
+  gdbarch->ecoff_reg_to_regnum = no_op_reg_to_regnum;
+  gdbarch->dwarf_reg_to_regnum = no_op_reg_to_regnum;
+  gdbarch->sdb_reg_to_regnum = no_op_reg_to_regnum;
+  gdbarch->dwarf2_reg_to_regnum = no_op_reg_to_regnum;
   gdbarch->register_name = legacy_register_name;
   gdbarch->register_size = -1;
   gdbarch->register_bytes = -1;
   gdbarch->max_register_raw_size = -1;
   gdbarch->max_register_virtual_size = -1;
+  gdbarch->do_registers_info = do_registers_info;
+  gdbarch->register_sim_regno = default_register_sim_regno;
   gdbarch->use_generic_dummy_frames = -1;
   gdbarch->call_dummy_start_offset = -1;
   gdbarch->call_dummy_breakpoint_offset = -1;
@@ -395,6 +447,8 @@
   gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address;
   gdbarch->frame_args_skip = -1;
   gdbarch->frameless_function_invocation = generic_frameless_function_invocation_not;
+  gdbarch->extra_stack_alignment_needed = 1;
+  gdbarch->convert_from_func_ptr_addr = default_convert_from_func_ptr_addr;
   /* gdbarch_alloc() */
 
   return gdbarch;
@@ -406,6 +460,7 @@
    However, if an architecture's init function encounters an error
    building the structure, it may need to clean up a partially
    constructed gdbarch.  */
+
 void
 gdbarch_free (struct gdbarch *arch)
 {
@@ -420,7 +475,7 @@
 verify_gdbarch (struct gdbarch *gdbarch)
 {
   /* Only perform sanity checks on a multi-arch target. */
-  if (GDB_MULTI_ARCH <= 0)
+  if (!GDB_MULTI_ARCH)
     return;
   /* fundamental */
   if (gdbarch->byte_order == 0)
@@ -428,53 +483,28 @@
   if (gdbarch->bfd_arch_info == NULL)
     internal_error ("verify_gdbarch: bfd_arch_info unset");
   /* Check those that need to be defined for the given multi-arch level. */
+  /* Skip verify of short_bit, invalid_p == 0 */
+  /* Skip verify of int_bit, invalid_p == 0 */
+  /* Skip verify of long_bit, invalid_p == 0 */
+  /* Skip verify of long_long_bit, invalid_p == 0 */
+  /* Skip verify of float_bit, invalid_p == 0 */
+  /* Skip verify of double_bit, invalid_p == 0 */
+  /* Skip verify of long_double_bit, invalid_p == 0 */
+  /* Skip verify of ptr_bit, invalid_p == 0 */
+  if (gdbarch->addr_bit == 0)
+    gdbarch->addr_bit = TARGET_PTR_BIT;
   /* Skip verify of bfd_vma_bit, invalid_p == 0 */
-  if ((GDB_MULTI_ARCH >= 1)
-      && (gdbarch->ptr_bit == 0))
-    internal_error ("gdbarch: verify_gdbarch: ptr_bit invalid");
-  if ((GDB_MULTI_ARCH >= 1)
-      && (gdbarch->short_bit == 0))
-    internal_error ("gdbarch: verify_gdbarch: short_bit invalid");
-  if ((GDB_MULTI_ARCH >= 1)
-      && (gdbarch->int_bit == 0))
-    internal_error ("gdbarch: verify_gdbarch: int_bit invalid");
-  if ((GDB_MULTI_ARCH >= 1)
-      && (gdbarch->long_bit == 0))
-    internal_error ("gdbarch: verify_gdbarch: long_bit invalid");
-  if ((GDB_MULTI_ARCH >= 1)
-      && (gdbarch->long_long_bit == 0))
-    internal_error ("gdbarch: verify_gdbarch: long_long_bit invalid");
-  if ((GDB_MULTI_ARCH >= 1)
-      && (gdbarch->float_bit == 0))
-    internal_error ("gdbarch: verify_gdbarch: float_bit invalid");
-  if ((GDB_MULTI_ARCH >= 1)
-      && (gdbarch->double_bit == 0))
-    internal_error ("gdbarch: verify_gdbarch: double_bit invalid");
-  if ((GDB_MULTI_ARCH >= 1)
-      && (gdbarch->long_double_bit == 0))
-    internal_error ("gdbarch: verify_gdbarch: long_double_bit invalid");
   /* Skip verify of ieee_float, invalid_p == 0 */
-  if ((GDB_MULTI_ARCH >= 1)
-      && (gdbarch->read_pc == 0))
-    internal_error ("gdbarch: verify_gdbarch: read_pc invalid");
-  if ((GDB_MULTI_ARCH >= 1)
-      && (gdbarch->write_pc == 0))
-    internal_error ("gdbarch: verify_gdbarch: write_pc invalid");
-  if ((GDB_MULTI_ARCH >= 1)
-      && (gdbarch->read_fp == 0))
-    internal_error ("gdbarch: verify_gdbarch: read_fp invalid");
-  if ((GDB_MULTI_ARCH >= 1)
-      && (gdbarch->write_fp == 0))
-    internal_error ("gdbarch: verify_gdbarch: write_fp invalid");
-  if ((GDB_MULTI_ARCH >= 1)
-      && (gdbarch->read_sp == 0))
-    internal_error ("gdbarch: verify_gdbarch: read_sp invalid");
-  if ((GDB_MULTI_ARCH >= 1)
-      && (gdbarch->write_sp == 0))
-    internal_error ("gdbarch: verify_gdbarch: write_sp invalid");
+  /* Skip verify of read_pc, invalid_p == 0 */
+  /* Skip verify of write_pc, invalid_p == 0 */
+  /* Skip verify of read_fp, invalid_p == 0 */
+  /* Skip verify of write_fp, invalid_p == 0 */
+  /* Skip verify of read_sp, invalid_p == 0 */
+  /* Skip verify of write_sp, invalid_p == 0 */
   if ((GDB_MULTI_ARCH >= 2)
       && (gdbarch->num_regs == -1))
     internal_error ("gdbarch: verify_gdbarch: num_regs invalid");
+  /* Skip verify of num_pseudo_regs, invalid_p == 0 */
   if ((GDB_MULTI_ARCH >= 2)
       && (gdbarch->sp_regnum == -1))
     internal_error ("gdbarch: verify_gdbarch: sp_regnum invalid");
@@ -487,6 +517,11 @@
   /* Skip verify of fp0_regnum, invalid_p == 0 */
   /* Skip verify of npc_regnum, invalid_p == 0 */
   /* Skip verify of nnpc_regnum, invalid_p == 0 */
+  /* Skip verify of stab_reg_to_regnum, invalid_p == 0 */
+  /* Skip verify of ecoff_reg_to_regnum, invalid_p == 0 */
+  /* Skip verify of dwarf_reg_to_regnum, invalid_p == 0 */
+  /* Skip verify of sdb_reg_to_regnum, invalid_p == 0 */
+  /* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */
   /* Skip verify of register_name, invalid_p == 0 */
   if ((GDB_MULTI_ARCH >= 2)
       && (gdbarch->register_size == -1))
@@ -512,6 +547,9 @@
   if ((GDB_MULTI_ARCH >= 2)
       && (gdbarch->register_virtual_type == 0))
     internal_error ("gdbarch: verify_gdbarch: register_virtual_type invalid");
+  /* Skip verify of do_registers_info, invalid_p == 0 */
+  /* Skip verify of register_sim_regno, invalid_p == 0 */
+  /* Skip verify of register_bytes_ok, has predicate */
   if ((GDB_MULTI_ARCH >= 1)
       && (gdbarch->use_generic_dummy_frames == -1))
     internal_error ("gdbarch: verify_gdbarch: use_generic_dummy_frames invalid");
@@ -557,6 +595,8 @@
   /* Skip verify of register_convertible, invalid_p == 0 */
   /* Skip verify of register_convert_to_virtual, invalid_p == 0 */
   /* Skip verify of register_convert_to_raw, invalid_p == 0 */
+  /* Skip verify of fetch_pseudo_register, invalid_p == 0 */
+  /* Skip verify of store_pseudo_register, invalid_p == 0 */
   /* Skip verify of pointer_to_address, invalid_p == 0 */
   /* Skip verify of address_to_pointer, invalid_p == 0 */
   /* Skip verify of return_value_on_stack, invalid_p == 0 */
@@ -642,6 +682,7 @@
       && (gdbarch->frame_num_args == 0))
     internal_error ("gdbarch: verify_gdbarch: frame_num_args invalid");
   /* Skip verify of stack_align, has predicate */
+  /* Skip verify of extra_stack_alignment_needed, invalid_p == 0 */
   /* Skip verify of reg_struct_has_addr, has predicate */
   /* Skip verify of save_dummy_frame_tos, has predicate */
   if (gdbarch->float_format == 0)
@@ -650,572 +691,1384 @@
     gdbarch->double_format = default_double_format (gdbarch);
   if (gdbarch->long_double_format == 0)
     gdbarch->long_double_format = &floatformat_unknown;
+  /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
 }
 
 
 /* Print out the details of the current architecture. */
 
+/* NOTE/WARNING: The parameter is called ``current_gdbarch'' so that it
+   just happens to match the global variable ``current_gdbarch''.  That
+   way macros refering to that variable get the local and not the global
+   version - ulgh.  Once everything is parameterised with gdbarch, this
+   will go away. */
+
 void
-gdbarch_dump (void)
+gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
 {
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: GDB_MULTI_ARCH = %d\n",
+                      GDB_MULTI_ARCH);
+#ifdef TARGET_ARCHITECTURE
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_ARCHITECTURE # %s\n",
+                      XSTRING (TARGET_ARCHITECTURE));
+#endif
+#ifdef TARGET_BYTE_ORDER
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_BYTE_ORDER # %s\n",
+                      XSTRING (TARGET_BYTE_ORDER));
+#endif
+#ifdef TARGET_SHORT_BIT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_SHORT_BIT # %s\n",
+                      XSTRING (TARGET_SHORT_BIT));
+#endif
+#ifdef TARGET_INT_BIT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_INT_BIT # %s\n",
+                      XSTRING (TARGET_INT_BIT));
+#endif
+#ifdef TARGET_LONG_BIT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_LONG_BIT # %s\n",
+                      XSTRING (TARGET_LONG_BIT));
+#endif
+#ifdef TARGET_LONG_LONG_BIT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_LONG_LONG_BIT # %s\n",
+                      XSTRING (TARGET_LONG_LONG_BIT));
+#endif
+#ifdef TARGET_FLOAT_BIT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_FLOAT_BIT # %s\n",
+                      XSTRING (TARGET_FLOAT_BIT));
+#endif
+#ifdef TARGET_DOUBLE_BIT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_DOUBLE_BIT # %s\n",
+                      XSTRING (TARGET_DOUBLE_BIT));
+#endif
+#ifdef TARGET_LONG_DOUBLE_BIT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_LONG_DOUBLE_BIT # %s\n",
+                      XSTRING (TARGET_LONG_DOUBLE_BIT));
+#endif
+#ifdef TARGET_PTR_BIT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_PTR_BIT # %s\n",
+                      XSTRING (TARGET_PTR_BIT));
+#endif
+#ifdef TARGET_ADDR_BIT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_ADDR_BIT # %s\n",
+                      XSTRING (TARGET_ADDR_BIT));
+#endif
+#ifdef TARGET_BFD_VMA_BIT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_BFD_VMA_BIT # %s\n",
+                      XSTRING (TARGET_BFD_VMA_BIT));
+#endif
+#ifdef IEEE_FLOAT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: IEEE_FLOAT # %s\n",
+                      XSTRING (IEEE_FLOAT));
+#endif
+#ifdef TARGET_READ_PC
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "TARGET_READ_PC(pid)",
+                      XSTRING (TARGET_READ_PC (pid)));
+#endif
+#if defined (TARGET_WRITE_PC) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "TARGET_WRITE_PC(val, pid)",
+                      XSTRING (TARGET_WRITE_PC (val, pid)));
+#endif
+#ifdef TARGET_READ_FP
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "TARGET_READ_FP()",
+                      XSTRING (TARGET_READ_FP ()));
+#endif
+#if defined (TARGET_WRITE_FP) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "TARGET_WRITE_FP(val)",
+                      XSTRING (TARGET_WRITE_FP (val)));
+#endif
+#ifdef TARGET_READ_SP
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "TARGET_READ_SP()",
+                      XSTRING (TARGET_READ_SP ()));
+#endif
+#if defined (TARGET_WRITE_SP) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "TARGET_WRITE_SP(val)",
+                      XSTRING (TARGET_WRITE_SP (val)));
+#endif
+#ifdef NUM_REGS
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: NUM_REGS # %s\n",
+                      XSTRING (NUM_REGS));
+#endif
+#ifdef NUM_PSEUDO_REGS
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: NUM_PSEUDO_REGS # %s\n",
+                      XSTRING (NUM_PSEUDO_REGS));
+#endif
+#ifdef SP_REGNUM
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: SP_REGNUM # %s\n",
+                      XSTRING (SP_REGNUM));
+#endif
+#ifdef FP_REGNUM
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: FP_REGNUM # %s\n",
+                      XSTRING (FP_REGNUM));
+#endif
+#ifdef PC_REGNUM
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: PC_REGNUM # %s\n",
+                      XSTRING (PC_REGNUM));
+#endif
+#ifdef FP0_REGNUM
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: FP0_REGNUM # %s\n",
+                      XSTRING (FP0_REGNUM));
+#endif
+#ifdef NPC_REGNUM
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: NPC_REGNUM # %s\n",
+                      XSTRING (NPC_REGNUM));
+#endif
+#ifdef NNPC_REGNUM
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: NNPC_REGNUM # %s\n",
+                      XSTRING (NNPC_REGNUM));
+#endif
+#ifdef STAB_REG_TO_REGNUM
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "STAB_REG_TO_REGNUM(stab_regnr)",
+                      XSTRING (STAB_REG_TO_REGNUM (stab_regnr)));
+#endif
+#ifdef ECOFF_REG_TO_REGNUM
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "ECOFF_REG_TO_REGNUM(ecoff_regnr)",
+                      XSTRING (ECOFF_REG_TO_REGNUM (ecoff_regnr)));
+#endif
+#ifdef DWARF_REG_TO_REGNUM
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "DWARF_REG_TO_REGNUM(dwarf_regnr)",
+                      XSTRING (DWARF_REG_TO_REGNUM (dwarf_regnr)));
+#endif
+#ifdef SDB_REG_TO_REGNUM
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "SDB_REG_TO_REGNUM(sdb_regnr)",
+                      XSTRING (SDB_REG_TO_REGNUM (sdb_regnr)));
+#endif
+#ifdef DWARF2_REG_TO_REGNUM
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "DWARF2_REG_TO_REGNUM(dwarf2_regnr)",
+                      XSTRING (DWARF2_REG_TO_REGNUM (dwarf2_regnr)));
+#endif
+#ifdef REGISTER_NAME
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "REGISTER_NAME(regnr)",
+                      XSTRING (REGISTER_NAME (regnr)));
+#endif
+#ifdef REGISTER_SIZE
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: REGISTER_SIZE # %s\n",
+                      XSTRING (REGISTER_SIZE));
+#endif
+#ifdef REGISTER_BYTES
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: REGISTER_BYTES # %s\n",
+                      XSTRING (REGISTER_BYTES));
+#endif
+#ifdef REGISTER_BYTE
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "REGISTER_BYTE(reg_nr)",
+                      XSTRING (REGISTER_BYTE (reg_nr)));
+#endif
+#ifdef REGISTER_RAW_SIZE
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "REGISTER_RAW_SIZE(reg_nr)",
+                      XSTRING (REGISTER_RAW_SIZE (reg_nr)));
+#endif
+#ifdef MAX_REGISTER_RAW_SIZE
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: MAX_REGISTER_RAW_SIZE # %s\n",
+                      XSTRING (MAX_REGISTER_RAW_SIZE));
+#endif
+#ifdef REGISTER_VIRTUAL_SIZE
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "REGISTER_VIRTUAL_SIZE(reg_nr)",
+                      XSTRING (REGISTER_VIRTUAL_SIZE (reg_nr)));
+#endif
+#ifdef MAX_REGISTER_VIRTUAL_SIZE
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: MAX_REGISTER_VIRTUAL_SIZE # %s\n",
+                      XSTRING (MAX_REGISTER_VIRTUAL_SIZE));
+#endif
+#ifdef REGISTER_VIRTUAL_TYPE
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "REGISTER_VIRTUAL_TYPE(reg_nr)",
+                      XSTRING (REGISTER_VIRTUAL_TYPE (reg_nr)));
+#endif
+#if defined (DO_REGISTERS_INFO) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "DO_REGISTERS_INFO(reg_nr, fpregs)",
+                      XSTRING (DO_REGISTERS_INFO (reg_nr, fpregs)));
+#endif
+#ifdef REGISTER_SIM_REGNO
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "REGISTER_SIM_REGNO(reg_nr)",
+                      XSTRING (REGISTER_SIM_REGNO (reg_nr)));
+#endif
+#ifdef REGISTER_BYTES_OK
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "REGISTER_BYTES_OK(nr_bytes)",
+                      XSTRING (REGISTER_BYTES_OK (nr_bytes)));
+#endif
+#ifdef USE_GENERIC_DUMMY_FRAMES
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: USE_GENERIC_DUMMY_FRAMES # %s\n",
+                      XSTRING (USE_GENERIC_DUMMY_FRAMES));
+#endif
+#ifdef CALL_DUMMY_LOCATION
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: CALL_DUMMY_LOCATION # %s\n",
+                      XSTRING (CALL_DUMMY_LOCATION));
+#endif
+#ifdef CALL_DUMMY_ADDRESS
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "CALL_DUMMY_ADDRESS()",
+                      XSTRING (CALL_DUMMY_ADDRESS ()));
+#endif
+#ifdef CALL_DUMMY_START_OFFSET
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: CALL_DUMMY_START_OFFSET # %s\n",
+                      XSTRING (CALL_DUMMY_START_OFFSET));
+#endif
+#ifdef CALL_DUMMY_BREAKPOINT_OFFSET
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET # %s\n",
+                      XSTRING (CALL_DUMMY_BREAKPOINT_OFFSET));
+#endif
+#ifdef CALL_DUMMY_BREAKPOINT_OFFSET_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET_P # %s\n",
+                      XSTRING (CALL_DUMMY_BREAKPOINT_OFFSET_P));
+#endif
+#ifdef CALL_DUMMY_LENGTH
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: CALL_DUMMY_LENGTH # %s\n",
+                      XSTRING (CALL_DUMMY_LENGTH));
+#endif
+#ifdef PC_IN_CALL_DUMMY
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "PC_IN_CALL_DUMMY(pc, sp, frame_address)",
+                      XSTRING (PC_IN_CALL_DUMMY (pc, sp, frame_address)));
+#endif
+#ifdef CALL_DUMMY_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: CALL_DUMMY_P # %s\n",
+                      XSTRING (CALL_DUMMY_P));
+#endif
+#ifdef CALL_DUMMY_WORDS
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: CALL_DUMMY_WORDS # %s\n",
+                      XSTRING (CALL_DUMMY_WORDS));
+#endif
+#ifdef SIZEOF_CALL_DUMMY_WORDS
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: SIZEOF_CALL_DUMMY_WORDS # %s\n",
+                      XSTRING (SIZEOF_CALL_DUMMY_WORDS));
+#endif
+#ifdef CALL_DUMMY_STACK_ADJUST_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: CALL_DUMMY_STACK_ADJUST_P # %s\n",
+                      XSTRING (CALL_DUMMY_STACK_ADJUST_P));
+#endif
+#ifdef CALL_DUMMY_STACK_ADJUST
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: CALL_DUMMY_STACK_ADJUST # %s\n",
+                      XSTRING (CALL_DUMMY_STACK_ADJUST));
+#endif
+#if defined (FIX_CALL_DUMMY) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p)",
+                      XSTRING (FIX_CALL_DUMMY (dummy, pc, fun, nargs, args, type, gcc_p)));
+#endif
+#ifdef BELIEVE_PCC_PROMOTION
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: BELIEVE_PCC_PROMOTION # %s\n",
+                      XSTRING (BELIEVE_PCC_PROMOTION));
+#endif
+#ifdef BELIEVE_PCC_PROMOTION_TYPE
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: BELIEVE_PCC_PROMOTION_TYPE # %s\n",
+                      XSTRING (BELIEVE_PCC_PROMOTION_TYPE));
+#endif
+#ifdef COERCE_FLOAT_TO_DOUBLE
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "COERCE_FLOAT_TO_DOUBLE(formal, actual)",
+                      XSTRING (COERCE_FLOAT_TO_DOUBLE (formal, actual)));
+#endif
+#if defined (GET_SAVED_REGISTER) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval)",
+                      XSTRING (GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame, regnum, lval)));
+#endif
+#ifdef REGISTER_CONVERTIBLE
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "REGISTER_CONVERTIBLE(nr)",
+                      XSTRING (REGISTER_CONVERTIBLE (nr)));
+#endif
+#if defined (REGISTER_CONVERT_TO_VIRTUAL) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "REGISTER_CONVERT_TO_VIRTUAL(regnum, type, from, to)",
+                      XSTRING (REGISTER_CONVERT_TO_VIRTUAL (regnum, type, from, to)));
+#endif
+#if defined (REGISTER_CONVERT_TO_RAW) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "REGISTER_CONVERT_TO_RAW(type, regnum, from, to)",
+                      XSTRING (REGISTER_CONVERT_TO_RAW (type, regnum, from, to)));
+#endif
+#if defined (FETCH_PSEUDO_REGISTER) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "FETCH_PSEUDO_REGISTER(regnum)",
+                      XSTRING (FETCH_PSEUDO_REGISTER (regnum)));
+#endif
+#if defined (STORE_PSEUDO_REGISTER) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "STORE_PSEUDO_REGISTER(regnum)",
+                      XSTRING (STORE_PSEUDO_REGISTER (regnum)));
+#endif
+#ifdef POINTER_TO_ADDRESS
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "POINTER_TO_ADDRESS(type, buf)",
+                      XSTRING (POINTER_TO_ADDRESS (type, buf)));
+#endif
+#if defined (ADDRESS_TO_POINTER) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "ADDRESS_TO_POINTER(type, buf, addr)",
+                      XSTRING (ADDRESS_TO_POINTER (type, buf, addr)));
+#endif
+#ifdef RETURN_VALUE_ON_STACK
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "RETURN_VALUE_ON_STACK(type)",
+                      XSTRING (RETURN_VALUE_ON_STACK (type)));
+#endif
+#if defined (EXTRACT_RETURN_VALUE) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "EXTRACT_RETURN_VALUE(type, regbuf, valbuf)",
+                      XSTRING (EXTRACT_RETURN_VALUE (type, regbuf, valbuf)));
+#endif
+#ifdef PUSH_ARGUMENTS
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr)",
+                      XSTRING (PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr)));
+#endif
+#if defined (PUSH_DUMMY_FRAME) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "PUSH_DUMMY_FRAME(-)",
+                      XSTRING (PUSH_DUMMY_FRAME (-)));
+#endif
+#ifdef PUSH_RETURN_ADDRESS
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "PUSH_RETURN_ADDRESS(pc, sp)",
+                      XSTRING (PUSH_RETURN_ADDRESS (pc, sp)));
+#endif
+#if defined (POP_FRAME) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "POP_FRAME(-)",
+                      XSTRING (POP_FRAME (-)));
+#endif
+#ifdef D10V_MAKE_DADDR
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "D10V_MAKE_DADDR(x)",
+                      XSTRING (D10V_MAKE_DADDR (x)));
+#endif
+#ifdef D10V_MAKE_IADDR
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "D10V_MAKE_IADDR(x)",
+                      XSTRING (D10V_MAKE_IADDR (x)));
+#endif
+#ifdef D10V_DADDR_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "D10V_DADDR_P(x)",
+                      XSTRING (D10V_DADDR_P (x)));
+#endif
+#ifdef D10V_IADDR_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "D10V_IADDR_P(x)",
+                      XSTRING (D10V_IADDR_P (x)));
+#endif
+#ifdef D10V_CONVERT_DADDR_TO_RAW
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "D10V_CONVERT_DADDR_TO_RAW(x)",
+                      XSTRING (D10V_CONVERT_DADDR_TO_RAW (x)));
+#endif
+#ifdef D10V_CONVERT_IADDR_TO_RAW
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "D10V_CONVERT_IADDR_TO_RAW(x)",
+                      XSTRING (D10V_CONVERT_IADDR_TO_RAW (x)));
+#endif
+#if defined (STORE_STRUCT_RETURN) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "STORE_STRUCT_RETURN(addr, sp)",
+                      XSTRING (STORE_STRUCT_RETURN (addr, sp)));
+#endif
+#if defined (STORE_RETURN_VALUE) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "STORE_RETURN_VALUE(type, valbuf)",
+                      XSTRING (STORE_RETURN_VALUE (type, valbuf)));
+#endif
+#ifdef EXTRACT_STRUCT_VALUE_ADDRESS
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "EXTRACT_STRUCT_VALUE_ADDRESS(regbuf)",
+                      XSTRING (EXTRACT_STRUCT_VALUE_ADDRESS (regbuf)));
+#endif
+#ifdef USE_STRUCT_CONVENTION
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "USE_STRUCT_CONVENTION(gcc_p, value_type)",
+                      XSTRING (USE_STRUCT_CONVENTION (gcc_p, value_type)));
+#endif
+#if defined (FRAME_INIT_SAVED_REGS) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "FRAME_INIT_SAVED_REGS(frame)",
+                      XSTRING (FRAME_INIT_SAVED_REGS (frame)));
+#endif
+#if defined (INIT_EXTRA_FRAME_INFO) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "INIT_EXTRA_FRAME_INFO(fromleaf, frame)",
+                      XSTRING (INIT_EXTRA_FRAME_INFO (fromleaf, frame)));
+#endif
+#ifdef SKIP_PROLOGUE
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "SKIP_PROLOGUE(ip)",
+                      XSTRING (SKIP_PROLOGUE (ip)));
+#endif
+#ifdef PROLOGUE_FRAMELESS_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "PROLOGUE_FRAMELESS_P(ip)",
+                      XSTRING (PROLOGUE_FRAMELESS_P (ip)));
+#endif
+#ifdef INNER_THAN
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "INNER_THAN(lhs, rhs)",
+                      XSTRING (INNER_THAN (lhs, rhs)));
+#endif
+#ifdef BREAKPOINT_FROM_PC
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "BREAKPOINT_FROM_PC(pcptr, lenptr)",
+                      XSTRING (BREAKPOINT_FROM_PC (pcptr, lenptr)));
+#endif
+#ifdef MEMORY_INSERT_BREAKPOINT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "MEMORY_INSERT_BREAKPOINT(addr, contents_cache)",
+                      XSTRING (MEMORY_INSERT_BREAKPOINT (addr, contents_cache)));
+#endif
+#ifdef MEMORY_REMOVE_BREAKPOINT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "MEMORY_REMOVE_BREAKPOINT(addr, contents_cache)",
+                      XSTRING (MEMORY_REMOVE_BREAKPOINT (addr, contents_cache)));
+#endif
+#ifdef DECR_PC_AFTER_BREAK
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: DECR_PC_AFTER_BREAK # %s\n",
+                      XSTRING (DECR_PC_AFTER_BREAK));
+#endif
+#ifdef FUNCTION_START_OFFSET
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: FUNCTION_START_OFFSET # %s\n",
+                      XSTRING (FUNCTION_START_OFFSET));
+#endif
+#if defined (REMOTE_TRANSLATE_XFER_ADDRESS) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "REMOTE_TRANSLATE_XFER_ADDRESS(gdb_addr, gdb_len, rem_addr, rem_len)",
+                      XSTRING (REMOTE_TRANSLATE_XFER_ADDRESS (gdb_addr, gdb_len, rem_addr, rem_len)));
+#endif
+#ifdef FRAME_ARGS_SKIP
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: FRAME_ARGS_SKIP # %s\n",
+                      XSTRING (FRAME_ARGS_SKIP));
+#endif
+#ifdef FRAMELESS_FUNCTION_INVOCATION
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "FRAMELESS_FUNCTION_INVOCATION(fi)",
+                      XSTRING (FRAMELESS_FUNCTION_INVOCATION (fi)));
+#endif
+#ifdef FRAME_CHAIN
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "FRAME_CHAIN(frame)",
+                      XSTRING (FRAME_CHAIN (frame)));
+#endif
+#ifdef FRAME_CHAIN_VALID
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "FRAME_CHAIN_VALID(chain, thisframe)",
+                      XSTRING (FRAME_CHAIN_VALID (chain, thisframe)));
+#endif
+#ifdef FRAME_SAVED_PC
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "FRAME_SAVED_PC(fi)",
+                      XSTRING (FRAME_SAVED_PC (fi)));
+#endif
+#ifdef FRAME_ARGS_ADDRESS
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "FRAME_ARGS_ADDRESS(fi)",
+                      XSTRING (FRAME_ARGS_ADDRESS (fi)));
+#endif
+#ifdef FRAME_LOCALS_ADDRESS
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "FRAME_LOCALS_ADDRESS(fi)",
+                      XSTRING (FRAME_LOCALS_ADDRESS (fi)));
+#endif
+#ifdef SAVED_PC_AFTER_CALL
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "SAVED_PC_AFTER_CALL(frame)",
+                      XSTRING (SAVED_PC_AFTER_CALL (frame)));
+#endif
+#ifdef FRAME_NUM_ARGS
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "FRAME_NUM_ARGS(frame)",
+                      XSTRING (FRAME_NUM_ARGS (frame)));
+#endif
+#ifdef STACK_ALIGN
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "STACK_ALIGN(sp)",
+                      XSTRING (STACK_ALIGN (sp)));
+#endif
+#ifdef EXTRA_STACK_ALIGNMENT_NEEDED
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: EXTRA_STACK_ALIGNMENT_NEEDED # %s\n",
+                      XSTRING (EXTRA_STACK_ALIGNMENT_NEEDED));
+#endif
+#ifdef REG_STRUCT_HAS_ADDR
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "REG_STRUCT_HAS_ADDR(gcc_p, type)",
+                      XSTRING (REG_STRUCT_HAS_ADDR (gcc_p, type)));
+#endif
+#if defined (SAVE_DUMMY_FRAME_TOS) && GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "SAVE_DUMMY_FRAME_TOS(sp)",
+                      XSTRING (SAVE_DUMMY_FRAME_TOS (sp)));
+#endif
+#ifdef TARGET_FLOAT_FORMAT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_FLOAT_FORMAT # %s\n",
+                      XSTRING (TARGET_FLOAT_FORMAT));
+#endif
+#ifdef TARGET_DOUBLE_FORMAT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_DOUBLE_FORMAT # %s\n",
+                      XSTRING (TARGET_DOUBLE_FORMAT));
+#endif
+#ifdef TARGET_LONG_DOUBLE_FORMAT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_LONG_DOUBLE_FORMAT # %s\n",
+                      XSTRING (TARGET_LONG_DOUBLE_FORMAT));
+#endif
+#ifdef CONVERT_FROM_FUNC_PTR_ADDR
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "CONVERT_FROM_FUNC_PTR_ADDR(addr)",
+                      XSTRING (CONVERT_FROM_FUNC_PTR_ADDR (addr)));
+#endif
 #ifdef TARGET_ARCHITECTURE
   if (TARGET_ARCHITECTURE != NULL)
-    fprintf_unfiltered (gdb_stdlog,
-                        "gdbarch_update: TARGET_ARCHITECTURE = %s\n",
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: TARGET_ARCHITECTURE = %s\n",
                         TARGET_ARCHITECTURE->printable_name);
 #endif
 #ifdef TARGET_BYTE_ORDER
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_BYTE_ORDER = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_BYTE_ORDER = %ld\n",
                       (long) TARGET_BYTE_ORDER);
 #endif
-#ifdef TARGET_BFD_VMA_BIT
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_BFD_VMA_BIT = %ld\n",
-                      (long) TARGET_BFD_VMA_BIT);
-#endif
-#ifdef TARGET_PTR_BIT
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_PTR_BIT = %ld\n",
-                      (long) TARGET_PTR_BIT);
-#endif
 #ifdef TARGET_SHORT_BIT
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_SHORT_BIT = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_SHORT_BIT = %ld\n",
                       (long) TARGET_SHORT_BIT);
 #endif
 #ifdef TARGET_INT_BIT
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_INT_BIT = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_INT_BIT = %ld\n",
                       (long) TARGET_INT_BIT);
 #endif
 #ifdef TARGET_LONG_BIT
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_LONG_BIT = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_LONG_BIT = %ld\n",
                       (long) TARGET_LONG_BIT);
 #endif
 #ifdef TARGET_LONG_LONG_BIT
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_LONG_LONG_BIT = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_LONG_LONG_BIT = %ld\n",
                       (long) TARGET_LONG_LONG_BIT);
 #endif
 #ifdef TARGET_FLOAT_BIT
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_FLOAT_BIT = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_FLOAT_BIT = %ld\n",
                       (long) TARGET_FLOAT_BIT);
 #endif
 #ifdef TARGET_DOUBLE_BIT
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_DOUBLE_BIT = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_DOUBLE_BIT = %ld\n",
                       (long) TARGET_DOUBLE_BIT);
 #endif
 #ifdef TARGET_LONG_DOUBLE_BIT
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_LONG_DOUBLE_BIT = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_LONG_DOUBLE_BIT = %ld\n",
                       (long) TARGET_LONG_DOUBLE_BIT);
 #endif
+#ifdef TARGET_PTR_BIT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_PTR_BIT = %ld\n",
+                      (long) TARGET_PTR_BIT);
+#endif
+#ifdef TARGET_ADDR_BIT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_ADDR_BIT = %ld\n",
+                      (long) TARGET_ADDR_BIT);
+#endif
+#ifdef TARGET_BFD_VMA_BIT
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_BFD_VMA_BIT = %ld\n",
+                      (long) TARGET_BFD_VMA_BIT);
+#endif
 #ifdef IEEE_FLOAT
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: IEEE_FLOAT = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: IEEE_FLOAT = %ld\n",
                       (long) IEEE_FLOAT);
 #endif
 #ifdef TARGET_READ_PC
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_READ_PC = 0x%08lx\n",
-                      (long) current_gdbarch->read_pc
-                      /*TARGET_READ_PC ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: TARGET_READ_PC = 0x%08lx\n",
+                        (long) current_gdbarch->read_pc
+                        /*TARGET_READ_PC ()*/);
 #endif
 #ifdef TARGET_WRITE_PC
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_WRITE_PC = 0x%08lx\n",
-                      (long) current_gdbarch->write_pc
-                      /*TARGET_WRITE_PC ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: TARGET_WRITE_PC = 0x%08lx\n",
+                        (long) current_gdbarch->write_pc
+                        /*TARGET_WRITE_PC ()*/);
 #endif
 #ifdef TARGET_READ_FP
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_READ_FP = 0x%08lx\n",
-                      (long) current_gdbarch->read_fp
-                      /*TARGET_READ_FP ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: TARGET_READ_FP = 0x%08lx\n",
+                        (long) current_gdbarch->read_fp
+                        /*TARGET_READ_FP ()*/);
 #endif
 #ifdef TARGET_WRITE_FP
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_WRITE_FP = 0x%08lx\n",
-                      (long) current_gdbarch->write_fp
-                      /*TARGET_WRITE_FP ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: TARGET_WRITE_FP = 0x%08lx\n",
+                        (long) current_gdbarch->write_fp
+                        /*TARGET_WRITE_FP ()*/);
 #endif
 #ifdef TARGET_READ_SP
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_READ_SP = 0x%08lx\n",
-                      (long) current_gdbarch->read_sp
-                      /*TARGET_READ_SP ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: TARGET_READ_SP = 0x%08lx\n",
+                        (long) current_gdbarch->read_sp
+                        /*TARGET_READ_SP ()*/);
 #endif
 #ifdef TARGET_WRITE_SP
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_WRITE_SP = 0x%08lx\n",
-                      (long) current_gdbarch->write_sp
-                      /*TARGET_WRITE_SP ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: TARGET_WRITE_SP = 0x%08lx\n",
+                        (long) current_gdbarch->write_sp
+                        /*TARGET_WRITE_SP ()*/);
 #endif
 #ifdef NUM_REGS
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: NUM_REGS = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: NUM_REGS = %ld\n",
                       (long) NUM_REGS);
 #endif
+#ifdef NUM_PSEUDO_REGS
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: NUM_PSEUDO_REGS = %ld\n",
+                      (long) NUM_PSEUDO_REGS);
+#endif
 #ifdef SP_REGNUM
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: SP_REGNUM = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: SP_REGNUM = %ld\n",
                       (long) SP_REGNUM);
 #endif
 #ifdef FP_REGNUM
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: FP_REGNUM = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: FP_REGNUM = %ld\n",
                       (long) FP_REGNUM);
 #endif
 #ifdef PC_REGNUM
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: PC_REGNUM = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: PC_REGNUM = %ld\n",
                       (long) PC_REGNUM);
 #endif
 #ifdef FP0_REGNUM
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: FP0_REGNUM = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: FP0_REGNUM = %ld\n",
                       (long) FP0_REGNUM);
 #endif
 #ifdef NPC_REGNUM
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: NPC_REGNUM = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: NPC_REGNUM = %ld\n",
                       (long) NPC_REGNUM);
 #endif
 #ifdef NNPC_REGNUM
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: NNPC_REGNUM = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: NNPC_REGNUM = %ld\n",
                       (long) NNPC_REGNUM);
 #endif
+#ifdef STAB_REG_TO_REGNUM
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: STAB_REG_TO_REGNUM = 0x%08lx\n",
+                        (long) current_gdbarch->stab_reg_to_regnum
+                        /*STAB_REG_TO_REGNUM ()*/);
+#endif
+#ifdef ECOFF_REG_TO_REGNUM
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: ECOFF_REG_TO_REGNUM = 0x%08lx\n",
+                        (long) current_gdbarch->ecoff_reg_to_regnum
+                        /*ECOFF_REG_TO_REGNUM ()*/);
+#endif
+#ifdef DWARF_REG_TO_REGNUM
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: DWARF_REG_TO_REGNUM = 0x%08lx\n",
+                        (long) current_gdbarch->dwarf_reg_to_regnum
+                        /*DWARF_REG_TO_REGNUM ()*/);
+#endif
+#ifdef SDB_REG_TO_REGNUM
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: SDB_REG_TO_REGNUM = 0x%08lx\n",
+                        (long) current_gdbarch->sdb_reg_to_regnum
+                        /*SDB_REG_TO_REGNUM ()*/);
+#endif
+#ifdef DWARF2_REG_TO_REGNUM
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: DWARF2_REG_TO_REGNUM = 0x%08lx\n",
+                        (long) current_gdbarch->dwarf2_reg_to_regnum
+                        /*DWARF2_REG_TO_REGNUM ()*/);
+#endif
 #ifdef REGISTER_NAME
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: REGISTER_NAME = 0x%08lx\n",
-                      (long) current_gdbarch->register_name
-                      /*REGISTER_NAME ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: REGISTER_NAME = 0x%08lx\n",
+                        (long) current_gdbarch->register_name
+                        /*REGISTER_NAME ()*/);
 #endif
 #ifdef REGISTER_SIZE
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: REGISTER_SIZE = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: REGISTER_SIZE = %ld\n",
                       (long) REGISTER_SIZE);
 #endif
 #ifdef REGISTER_BYTES
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: REGISTER_BYTES = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: REGISTER_BYTES = %ld\n",
                       (long) REGISTER_BYTES);
 #endif
 #ifdef REGISTER_BYTE
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: REGISTER_BYTE = 0x%08lx\n",
-                      (long) current_gdbarch->register_byte
-                      /*REGISTER_BYTE ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: REGISTER_BYTE = 0x%08lx\n",
+                        (long) current_gdbarch->register_byte
+                        /*REGISTER_BYTE ()*/);
 #endif
 #ifdef REGISTER_RAW_SIZE
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: REGISTER_RAW_SIZE = 0x%08lx\n",
-                      (long) current_gdbarch->register_raw_size
-                      /*REGISTER_RAW_SIZE ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: REGISTER_RAW_SIZE = 0x%08lx\n",
+                        (long) current_gdbarch->register_raw_size
+                        /*REGISTER_RAW_SIZE ()*/);
 #endif
 #ifdef MAX_REGISTER_RAW_SIZE
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: MAX_REGISTER_RAW_SIZE = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: MAX_REGISTER_RAW_SIZE = %ld\n",
                       (long) MAX_REGISTER_RAW_SIZE);
 #endif
 #ifdef REGISTER_VIRTUAL_SIZE
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: REGISTER_VIRTUAL_SIZE = 0x%08lx\n",
-                      (long) current_gdbarch->register_virtual_size
-                      /*REGISTER_VIRTUAL_SIZE ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: REGISTER_VIRTUAL_SIZE = 0x%08lx\n",
+                        (long) current_gdbarch->register_virtual_size
+                        /*REGISTER_VIRTUAL_SIZE ()*/);
 #endif
 #ifdef MAX_REGISTER_VIRTUAL_SIZE
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: MAX_REGISTER_VIRTUAL_SIZE = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: MAX_REGISTER_VIRTUAL_SIZE = %ld\n",
                       (long) MAX_REGISTER_VIRTUAL_SIZE);
 #endif
 #ifdef REGISTER_VIRTUAL_TYPE
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: REGISTER_VIRTUAL_TYPE = 0x%08lx\n",
-                      (long) current_gdbarch->register_virtual_type
-                      /*REGISTER_VIRTUAL_TYPE ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: REGISTER_VIRTUAL_TYPE = 0x%08lx\n",
+                        (long) current_gdbarch->register_virtual_type
+                        /*REGISTER_VIRTUAL_TYPE ()*/);
+#endif
+#ifdef DO_REGISTERS_INFO
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: DO_REGISTERS_INFO = 0x%08lx\n",
+                        (long) current_gdbarch->do_registers_info
+                        /*DO_REGISTERS_INFO ()*/);
+#endif
+#ifdef REGISTER_SIM_REGNO
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: REGISTER_SIM_REGNO = 0x%08lx\n",
+                        (long) current_gdbarch->register_sim_regno
+                        /*REGISTER_SIM_REGNO ()*/);
+#endif
+#ifdef REGISTER_BYTES_OK
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: REGISTER_BYTES_OK = 0x%08lx\n",
+                        (long) current_gdbarch->register_bytes_ok
+                        /*REGISTER_BYTES_OK ()*/);
 #endif
 #ifdef USE_GENERIC_DUMMY_FRAMES
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: USE_GENERIC_DUMMY_FRAMES = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: USE_GENERIC_DUMMY_FRAMES = %ld\n",
                       (long) USE_GENERIC_DUMMY_FRAMES);
 #endif
 #ifdef CALL_DUMMY_LOCATION
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: CALL_DUMMY_LOCATION = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: CALL_DUMMY_LOCATION = %ld\n",
                       (long) CALL_DUMMY_LOCATION);
 #endif
 #ifdef CALL_DUMMY_ADDRESS
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: CALL_DUMMY_ADDRESS = 0x%08lx\n",
-                      (long) current_gdbarch->call_dummy_address
-                      /*CALL_DUMMY_ADDRESS ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: CALL_DUMMY_ADDRESS = 0x%08lx\n",
+                        (long) current_gdbarch->call_dummy_address
+                        /*CALL_DUMMY_ADDRESS ()*/);
 #endif
 #ifdef CALL_DUMMY_START_OFFSET
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: CALL_DUMMY_START_OFFSET = 0x%08lx\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: CALL_DUMMY_START_OFFSET = 0x%08lx\n",
                       (long) CALL_DUMMY_START_OFFSET);
 #endif
 #ifdef CALL_DUMMY_BREAKPOINT_OFFSET
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: CALL_DUMMY_BREAKPOINT_OFFSET = 0x%08lx\n",
-                      (long) CALL_DUMMY_BREAKPOINT_OFFSET);
+  if (CALL_DUMMY_BREAKPOINT_OFFSET_P)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET = 0x%08lx\n",
+                        (long) CALL_DUMMY_BREAKPOINT_OFFSET);
 #endif
 #ifdef CALL_DUMMY_BREAKPOINT_OFFSET_P
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: CALL_DUMMY_BREAKPOINT_OFFSET_P = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: CALL_DUMMY_BREAKPOINT_OFFSET_P = %ld\n",
                       (long) CALL_DUMMY_BREAKPOINT_OFFSET_P);
 #endif
 #ifdef CALL_DUMMY_LENGTH
   if (CALL_DUMMY_LOCATION == BEFORE_TEXT_END || CALL_DUMMY_LOCATION == AFTER_TEXT_END)
-    fprintf_unfiltered (gdb_stdlog,
-                        "gdbarch_update: CALL_DUMMY_LENGTH = %ld\n",
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: CALL_DUMMY_LENGTH = %ld\n",
                         (long) CALL_DUMMY_LENGTH);
 #endif
 #ifdef PC_IN_CALL_DUMMY
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: PC_IN_CALL_DUMMY = 0x%08lx\n",
-                      (long) current_gdbarch->pc_in_call_dummy
-                      /*PC_IN_CALL_DUMMY ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: PC_IN_CALL_DUMMY = 0x%08lx\n",
+                        (long) current_gdbarch->pc_in_call_dummy
+                        /*PC_IN_CALL_DUMMY ()*/);
 #endif
 #ifdef CALL_DUMMY_P
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: CALL_DUMMY_P = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: CALL_DUMMY_P = %ld\n",
                       (long) CALL_DUMMY_P);
 #endif
 #ifdef CALL_DUMMY_WORDS
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: CALL_DUMMY_WORDS = 0x%08lx\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: CALL_DUMMY_WORDS = 0x%08lx\n",
                       (long) CALL_DUMMY_WORDS);
 #endif
 #ifdef SIZEOF_CALL_DUMMY_WORDS
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: SIZEOF_CALL_DUMMY_WORDS = 0x%08lx\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: SIZEOF_CALL_DUMMY_WORDS = 0x%08lx\n",
                       (long) SIZEOF_CALL_DUMMY_WORDS);
 #endif
 #ifdef CALL_DUMMY_STACK_ADJUST_P
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: CALL_DUMMY_STACK_ADJUST_P = 0x%08lx\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: CALL_DUMMY_STACK_ADJUST_P = 0x%08lx\n",
                       (long) CALL_DUMMY_STACK_ADJUST_P);
 #endif
 #ifdef CALL_DUMMY_STACK_ADJUST
   if (CALL_DUMMY_STACK_ADJUST_P)
-    fprintf_unfiltered (gdb_stdlog,
-                        "gdbarch_update: CALL_DUMMY_STACK_ADJUST = 0x%08lx\n",
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: CALL_DUMMY_STACK_ADJUST = 0x%08lx\n",
                         (long) CALL_DUMMY_STACK_ADJUST);
 #endif
 #ifdef FIX_CALL_DUMMY
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: FIX_CALL_DUMMY = 0x%08lx\n",
-                      (long) current_gdbarch->fix_call_dummy
-                      /*FIX_CALL_DUMMY ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: FIX_CALL_DUMMY = 0x%08lx\n",
+                        (long) current_gdbarch->fix_call_dummy
+                        /*FIX_CALL_DUMMY ()*/);
 #endif
 #ifdef BELIEVE_PCC_PROMOTION
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: BELIEVE_PCC_PROMOTION = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: BELIEVE_PCC_PROMOTION = %ld\n",
                       (long) BELIEVE_PCC_PROMOTION);
 #endif
 #ifdef BELIEVE_PCC_PROMOTION_TYPE
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: BELIEVE_PCC_PROMOTION_TYPE = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: BELIEVE_PCC_PROMOTION_TYPE = %ld\n",
                       (long) BELIEVE_PCC_PROMOTION_TYPE);
 #endif
 #ifdef COERCE_FLOAT_TO_DOUBLE
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: COERCE_FLOAT_TO_DOUBLE = 0x%08lx\n",
-                      (long) current_gdbarch->coerce_float_to_double
-                      /*COERCE_FLOAT_TO_DOUBLE ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: COERCE_FLOAT_TO_DOUBLE = 0x%08lx\n",
+                        (long) current_gdbarch->coerce_float_to_double
+                        /*COERCE_FLOAT_TO_DOUBLE ()*/);
 #endif
 #ifdef GET_SAVED_REGISTER
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: GET_SAVED_REGISTER = 0x%08lx\n",
-                      (long) current_gdbarch->get_saved_register
-                      /*GET_SAVED_REGISTER ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: GET_SAVED_REGISTER = 0x%08lx\n",
+                        (long) current_gdbarch->get_saved_register
+                        /*GET_SAVED_REGISTER ()*/);
 #endif
 #ifdef REGISTER_CONVERTIBLE
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: REGISTER_CONVERTIBLE = 0x%08lx\n",
-                      (long) current_gdbarch->register_convertible
-                      /*REGISTER_CONVERTIBLE ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: REGISTER_CONVERTIBLE = 0x%08lx\n",
+                        (long) current_gdbarch->register_convertible
+                        /*REGISTER_CONVERTIBLE ()*/);
 #endif
 #ifdef REGISTER_CONVERT_TO_VIRTUAL
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: REGISTER_CONVERT_TO_VIRTUAL = 0x%08lx\n",
-                      (long) current_gdbarch->register_convert_to_virtual
-                      /*REGISTER_CONVERT_TO_VIRTUAL ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: REGISTER_CONVERT_TO_VIRTUAL = 0x%08lx\n",
+                        (long) current_gdbarch->register_convert_to_virtual
+                        /*REGISTER_CONVERT_TO_VIRTUAL ()*/);
 #endif
 #ifdef REGISTER_CONVERT_TO_RAW
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: REGISTER_CONVERT_TO_RAW = 0x%08lx\n",
-                      (long) current_gdbarch->register_convert_to_raw
-                      /*REGISTER_CONVERT_TO_RAW ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: REGISTER_CONVERT_TO_RAW = 0x%08lx\n",
+                        (long) current_gdbarch->register_convert_to_raw
+                        /*REGISTER_CONVERT_TO_RAW ()*/);
+#endif
+#ifdef FETCH_PSEUDO_REGISTER
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: FETCH_PSEUDO_REGISTER = 0x%08lx\n",
+                        (long) current_gdbarch->fetch_pseudo_register
+                        /*FETCH_PSEUDO_REGISTER ()*/);
+#endif
+#ifdef STORE_PSEUDO_REGISTER
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: STORE_PSEUDO_REGISTER = 0x%08lx\n",
+                        (long) current_gdbarch->store_pseudo_register
+                        /*STORE_PSEUDO_REGISTER ()*/);
 #endif
 #ifdef POINTER_TO_ADDRESS
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: POINTER_TO_ADDRESS = 0x%08lx\n",
-                      (long) current_gdbarch->pointer_to_address
-                      /*POINTER_TO_ADDRESS ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: POINTER_TO_ADDRESS = 0x%08lx\n",
+                        (long) current_gdbarch->pointer_to_address
+                        /*POINTER_TO_ADDRESS ()*/);
 #endif
 #ifdef ADDRESS_TO_POINTER
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: ADDRESS_TO_POINTER = 0x%08lx\n",
-                      (long) current_gdbarch->address_to_pointer
-                      /*ADDRESS_TO_POINTER ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: ADDRESS_TO_POINTER = 0x%08lx\n",
+                        (long) current_gdbarch->address_to_pointer
+                        /*ADDRESS_TO_POINTER ()*/);
 #endif
 #ifdef RETURN_VALUE_ON_STACK
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: RETURN_VALUE_ON_STACK = 0x%08lx\n",
-                      (long) current_gdbarch->return_value_on_stack
-                      /*RETURN_VALUE_ON_STACK ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: RETURN_VALUE_ON_STACK = 0x%08lx\n",
+                        (long) current_gdbarch->return_value_on_stack
+                        /*RETURN_VALUE_ON_STACK ()*/);
 #endif
 #ifdef EXTRACT_RETURN_VALUE
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: EXTRACT_RETURN_VALUE = 0x%08lx\n",
-                      (long) current_gdbarch->extract_return_value
-                      /*EXTRACT_RETURN_VALUE ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: EXTRACT_RETURN_VALUE = 0x%08lx\n",
+                        (long) current_gdbarch->extract_return_value
+                        /*EXTRACT_RETURN_VALUE ()*/);
 #endif
 #ifdef PUSH_ARGUMENTS
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: PUSH_ARGUMENTS = 0x%08lx\n",
-                      (long) current_gdbarch->push_arguments
-                      /*PUSH_ARGUMENTS ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: PUSH_ARGUMENTS = 0x%08lx\n",
+                        (long) current_gdbarch->push_arguments
+                        /*PUSH_ARGUMENTS ()*/);
 #endif
 #ifdef PUSH_DUMMY_FRAME
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: PUSH_DUMMY_FRAME = 0x%08lx\n",
-                      (long) current_gdbarch->push_dummy_frame
-                      /*PUSH_DUMMY_FRAME ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: PUSH_DUMMY_FRAME = 0x%08lx\n",
+                        (long) current_gdbarch->push_dummy_frame
+                        /*PUSH_DUMMY_FRAME ()*/);
 #endif
 #ifdef PUSH_RETURN_ADDRESS
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: PUSH_RETURN_ADDRESS = 0x%08lx\n",
-                      (long) current_gdbarch->push_return_address
-                      /*PUSH_RETURN_ADDRESS ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: PUSH_RETURN_ADDRESS = 0x%08lx\n",
+                        (long) current_gdbarch->push_return_address
+                        /*PUSH_RETURN_ADDRESS ()*/);
 #endif
 #ifdef POP_FRAME
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: POP_FRAME = 0x%08lx\n",
-                      (long) current_gdbarch->pop_frame
-                      /*POP_FRAME ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: POP_FRAME = 0x%08lx\n",
+                        (long) current_gdbarch->pop_frame
+                        /*POP_FRAME ()*/);
 #endif
 #ifdef D10V_MAKE_DADDR
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: D10V_MAKE_DADDR = 0x%08lx\n",
-                      (long) current_gdbarch->d10v_make_daddr
-                      /*D10V_MAKE_DADDR ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: D10V_MAKE_DADDR = 0x%08lx\n",
+                        (long) current_gdbarch->d10v_make_daddr
+                        /*D10V_MAKE_DADDR ()*/);
 #endif
 #ifdef D10V_MAKE_IADDR
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: D10V_MAKE_IADDR = 0x%08lx\n",
-                      (long) current_gdbarch->d10v_make_iaddr
-                      /*D10V_MAKE_IADDR ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: D10V_MAKE_IADDR = 0x%08lx\n",
+                        (long) current_gdbarch->d10v_make_iaddr
+                        /*D10V_MAKE_IADDR ()*/);
 #endif
 #ifdef D10V_DADDR_P
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: D10V_DADDR_P = 0x%08lx\n",
-                      (long) current_gdbarch->d10v_daddr_p
-                      /*D10V_DADDR_P ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: D10V_DADDR_P = 0x%08lx\n",
+                        (long) current_gdbarch->d10v_daddr_p
+                        /*D10V_DADDR_P ()*/);
 #endif
 #ifdef D10V_IADDR_P
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: D10V_IADDR_P = 0x%08lx\n",
-                      (long) current_gdbarch->d10v_iaddr_p
-                      /*D10V_IADDR_P ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: D10V_IADDR_P = 0x%08lx\n",
+                        (long) current_gdbarch->d10v_iaddr_p
+                        /*D10V_IADDR_P ()*/);
 #endif
 #ifdef D10V_CONVERT_DADDR_TO_RAW
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: D10V_CONVERT_DADDR_TO_RAW = 0x%08lx\n",
-                      (long) current_gdbarch->d10v_convert_daddr_to_raw
-                      /*D10V_CONVERT_DADDR_TO_RAW ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: D10V_CONVERT_DADDR_TO_RAW = 0x%08lx\n",
+                        (long) current_gdbarch->d10v_convert_daddr_to_raw
+                        /*D10V_CONVERT_DADDR_TO_RAW ()*/);
 #endif
 #ifdef D10V_CONVERT_IADDR_TO_RAW
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: D10V_CONVERT_IADDR_TO_RAW = 0x%08lx\n",
-                      (long) current_gdbarch->d10v_convert_iaddr_to_raw
-                      /*D10V_CONVERT_IADDR_TO_RAW ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: D10V_CONVERT_IADDR_TO_RAW = 0x%08lx\n",
+                        (long) current_gdbarch->d10v_convert_iaddr_to_raw
+                        /*D10V_CONVERT_IADDR_TO_RAW ()*/);
 #endif
 #ifdef STORE_STRUCT_RETURN
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: STORE_STRUCT_RETURN = 0x%08lx\n",
-                      (long) current_gdbarch->store_struct_return
-                      /*STORE_STRUCT_RETURN ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: STORE_STRUCT_RETURN = 0x%08lx\n",
+                        (long) current_gdbarch->store_struct_return
+                        /*STORE_STRUCT_RETURN ()*/);
 #endif
 #ifdef STORE_RETURN_VALUE
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: STORE_RETURN_VALUE = 0x%08lx\n",
-                      (long) current_gdbarch->store_return_value
-                      /*STORE_RETURN_VALUE ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: STORE_RETURN_VALUE = 0x%08lx\n",
+                        (long) current_gdbarch->store_return_value
+                        /*STORE_RETURN_VALUE ()*/);
 #endif
 #ifdef EXTRACT_STRUCT_VALUE_ADDRESS
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: EXTRACT_STRUCT_VALUE_ADDRESS = 0x%08lx\n",
-                      (long) current_gdbarch->extract_struct_value_address
-                      /*EXTRACT_STRUCT_VALUE_ADDRESS ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: EXTRACT_STRUCT_VALUE_ADDRESS = 0x%08lx\n",
+                        (long) current_gdbarch->extract_struct_value_address
+                        /*EXTRACT_STRUCT_VALUE_ADDRESS ()*/);
 #endif
 #ifdef USE_STRUCT_CONVENTION
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: USE_STRUCT_CONVENTION = 0x%08lx\n",
-                      (long) current_gdbarch->use_struct_convention
-                      /*USE_STRUCT_CONVENTION ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: USE_STRUCT_CONVENTION = 0x%08lx\n",
+                        (long) current_gdbarch->use_struct_convention
+                        /*USE_STRUCT_CONVENTION ()*/);
 #endif
 #ifdef FRAME_INIT_SAVED_REGS
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: FRAME_INIT_SAVED_REGS = 0x%08lx\n",
-                      (long) current_gdbarch->frame_init_saved_regs
-                      /*FRAME_INIT_SAVED_REGS ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: FRAME_INIT_SAVED_REGS = 0x%08lx\n",
+                        (long) current_gdbarch->frame_init_saved_regs
+                        /*FRAME_INIT_SAVED_REGS ()*/);
 #endif
 #ifdef INIT_EXTRA_FRAME_INFO
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: INIT_EXTRA_FRAME_INFO = 0x%08lx\n",
-                      (long) current_gdbarch->init_extra_frame_info
-                      /*INIT_EXTRA_FRAME_INFO ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: INIT_EXTRA_FRAME_INFO = 0x%08lx\n",
+                        (long) current_gdbarch->init_extra_frame_info
+                        /*INIT_EXTRA_FRAME_INFO ()*/);
 #endif
 #ifdef SKIP_PROLOGUE
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: SKIP_PROLOGUE = 0x%08lx\n",
-                      (long) current_gdbarch->skip_prologue
-                      /*SKIP_PROLOGUE ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: SKIP_PROLOGUE = 0x%08lx\n",
+                        (long) current_gdbarch->skip_prologue
+                        /*SKIP_PROLOGUE ()*/);
 #endif
 #ifdef PROLOGUE_FRAMELESS_P
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: PROLOGUE_FRAMELESS_P = 0x%08lx\n",
-                      (long) current_gdbarch->prologue_frameless_p
-                      /*PROLOGUE_FRAMELESS_P ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: PROLOGUE_FRAMELESS_P = 0x%08lx\n",
+                        (long) current_gdbarch->prologue_frameless_p
+                        /*PROLOGUE_FRAMELESS_P ()*/);
 #endif
 #ifdef INNER_THAN
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: INNER_THAN = 0x%08lx\n",
-                      (long) current_gdbarch->inner_than
-                      /*INNER_THAN ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: INNER_THAN = 0x%08lx\n",
+                        (long) current_gdbarch->inner_than
+                        /*INNER_THAN ()*/);
 #endif
 #ifdef BREAKPOINT_FROM_PC
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: BREAKPOINT_FROM_PC = 0x%08lx\n",
-                      (long) current_gdbarch->breakpoint_from_pc
-                      /*BREAKPOINT_FROM_PC ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: BREAKPOINT_FROM_PC = 0x%08lx\n",
+                        (long) current_gdbarch->breakpoint_from_pc
+                        /*BREAKPOINT_FROM_PC ()*/);
 #endif
 #ifdef MEMORY_INSERT_BREAKPOINT
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: MEMORY_INSERT_BREAKPOINT = 0x%08lx\n",
-                      (long) current_gdbarch->memory_insert_breakpoint
-                      /*MEMORY_INSERT_BREAKPOINT ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: MEMORY_INSERT_BREAKPOINT = 0x%08lx\n",
+                        (long) current_gdbarch->memory_insert_breakpoint
+                        /*MEMORY_INSERT_BREAKPOINT ()*/);
 #endif
 #ifdef MEMORY_REMOVE_BREAKPOINT
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: MEMORY_REMOVE_BREAKPOINT = 0x%08lx\n",
-                      (long) current_gdbarch->memory_remove_breakpoint
-                      /*MEMORY_REMOVE_BREAKPOINT ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: MEMORY_REMOVE_BREAKPOINT = 0x%08lx\n",
+                        (long) current_gdbarch->memory_remove_breakpoint
+                        /*MEMORY_REMOVE_BREAKPOINT ()*/);
 #endif
 #ifdef DECR_PC_AFTER_BREAK
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: DECR_PC_AFTER_BREAK = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: DECR_PC_AFTER_BREAK = %ld\n",
                       (long) DECR_PC_AFTER_BREAK);
 #endif
 #ifdef FUNCTION_START_OFFSET
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: FUNCTION_START_OFFSET = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: FUNCTION_START_OFFSET = %ld\n",
                       (long) FUNCTION_START_OFFSET);
 #endif
 #ifdef REMOTE_TRANSLATE_XFER_ADDRESS
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: REMOTE_TRANSLATE_XFER_ADDRESS = 0x%08lx\n",
-                      (long) current_gdbarch->remote_translate_xfer_address
-                      /*REMOTE_TRANSLATE_XFER_ADDRESS ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: REMOTE_TRANSLATE_XFER_ADDRESS = 0x%08lx\n",
+                        (long) current_gdbarch->remote_translate_xfer_address
+                        /*REMOTE_TRANSLATE_XFER_ADDRESS ()*/);
 #endif
 #ifdef FRAME_ARGS_SKIP
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: FRAME_ARGS_SKIP = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: FRAME_ARGS_SKIP = %ld\n",
                       (long) FRAME_ARGS_SKIP);
 #endif
 #ifdef FRAMELESS_FUNCTION_INVOCATION
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: FRAMELESS_FUNCTION_INVOCATION = 0x%08lx\n",
-                      (long) current_gdbarch->frameless_function_invocation
-                      /*FRAMELESS_FUNCTION_INVOCATION ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: FRAMELESS_FUNCTION_INVOCATION = 0x%08lx\n",
+                        (long) current_gdbarch->frameless_function_invocation
+                        /*FRAMELESS_FUNCTION_INVOCATION ()*/);
 #endif
 #ifdef FRAME_CHAIN
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: FRAME_CHAIN = 0x%08lx\n",
-                      (long) current_gdbarch->frame_chain
-                      /*FRAME_CHAIN ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: FRAME_CHAIN = 0x%08lx\n",
+                        (long) current_gdbarch->frame_chain
+                        /*FRAME_CHAIN ()*/);
 #endif
 #ifdef FRAME_CHAIN_VALID
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: FRAME_CHAIN_VALID = 0x%08lx\n",
-                      (long) current_gdbarch->frame_chain_valid
-                      /*FRAME_CHAIN_VALID ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: FRAME_CHAIN_VALID = 0x%08lx\n",
+                        (long) current_gdbarch->frame_chain_valid
+                        /*FRAME_CHAIN_VALID ()*/);
 #endif
 #ifdef FRAME_SAVED_PC
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: FRAME_SAVED_PC = 0x%08lx\n",
-                      (long) current_gdbarch->frame_saved_pc
-                      /*FRAME_SAVED_PC ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: FRAME_SAVED_PC = 0x%08lx\n",
+                        (long) current_gdbarch->frame_saved_pc
+                        /*FRAME_SAVED_PC ()*/);
 #endif
 #ifdef FRAME_ARGS_ADDRESS
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: FRAME_ARGS_ADDRESS = 0x%08lx\n",
-                      (long) current_gdbarch->frame_args_address
-                      /*FRAME_ARGS_ADDRESS ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: FRAME_ARGS_ADDRESS = 0x%08lx\n",
+                        (long) current_gdbarch->frame_args_address
+                        /*FRAME_ARGS_ADDRESS ()*/);
 #endif
 #ifdef FRAME_LOCALS_ADDRESS
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: FRAME_LOCALS_ADDRESS = 0x%08lx\n",
-                      (long) current_gdbarch->frame_locals_address
-                      /*FRAME_LOCALS_ADDRESS ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: FRAME_LOCALS_ADDRESS = 0x%08lx\n",
+                        (long) current_gdbarch->frame_locals_address
+                        /*FRAME_LOCALS_ADDRESS ()*/);
 #endif
 #ifdef SAVED_PC_AFTER_CALL
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: SAVED_PC_AFTER_CALL = 0x%08lx\n",
-                      (long) current_gdbarch->saved_pc_after_call
-                      /*SAVED_PC_AFTER_CALL ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: SAVED_PC_AFTER_CALL = 0x%08lx\n",
+                        (long) current_gdbarch->saved_pc_after_call
+                        /*SAVED_PC_AFTER_CALL ()*/);
 #endif
 #ifdef FRAME_NUM_ARGS
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: FRAME_NUM_ARGS = 0x%08lx\n",
-                      (long) current_gdbarch->frame_num_args
-                      /*FRAME_NUM_ARGS ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: FRAME_NUM_ARGS = 0x%08lx\n",
+                        (long) current_gdbarch->frame_num_args
+                        /*FRAME_NUM_ARGS ()*/);
 #endif
 #ifdef STACK_ALIGN
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: STACK_ALIGN = 0x%08lx\n",
-                      (long) current_gdbarch->stack_align
-                      /*STACK_ALIGN ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: STACK_ALIGN = 0x%08lx\n",
+                        (long) current_gdbarch->stack_align
+                        /*STACK_ALIGN ()*/);
+#endif
+#ifdef EXTRA_STACK_ALIGNMENT_NEEDED
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: EXTRA_STACK_ALIGNMENT_NEEDED = %ld\n",
+                      (long) EXTRA_STACK_ALIGNMENT_NEEDED);
 #endif
 #ifdef REG_STRUCT_HAS_ADDR
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: REG_STRUCT_HAS_ADDR = 0x%08lx\n",
-                      (long) current_gdbarch->reg_struct_has_addr
-                      /*REG_STRUCT_HAS_ADDR ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: REG_STRUCT_HAS_ADDR = 0x%08lx\n",
+                        (long) current_gdbarch->reg_struct_has_addr
+                        /*REG_STRUCT_HAS_ADDR ()*/);
 #endif
 #ifdef SAVE_DUMMY_FRAME_TOS
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: SAVE_DUMMY_FRAME_TOS = 0x%08lx\n",
-                      (long) current_gdbarch->save_dummy_frame_tos
-                      /*SAVE_DUMMY_FRAME_TOS ()*/);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: SAVE_DUMMY_FRAME_TOS = 0x%08lx\n",
+                        (long) current_gdbarch->save_dummy_frame_tos
+                        /*SAVE_DUMMY_FRAME_TOS ()*/);
 #endif
 #ifdef TARGET_FLOAT_FORMAT
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_FLOAT_FORMAT = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_FLOAT_FORMAT = %ld\n",
                       (long) TARGET_FLOAT_FORMAT);
 #endif
 #ifdef TARGET_DOUBLE_FORMAT
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_DOUBLE_FORMAT = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_DOUBLE_FORMAT = %ld\n",
                       (long) TARGET_DOUBLE_FORMAT);
 #endif
 #ifdef TARGET_LONG_DOUBLE_FORMAT
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: TARGET_LONG_DOUBLE_FORMAT = %ld\n",
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: TARGET_LONG_DOUBLE_FORMAT = %ld\n",
                       (long) TARGET_LONG_DOUBLE_FORMAT);
 #endif
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: GDB_MULTI_ARCH = %d\n",
-                      GDB_MULTI_ARCH);
+#ifdef CONVERT_FROM_FUNC_PTR_ADDR
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: CONVERT_FROM_FUNC_PTR_ADDR = 0x%08lx\n",
+                        (long) current_gdbarch->convert_from_func_ptr_addr
+                        /*CONVERT_FROM_FUNC_PTR_ADDR ()*/);
+#endif
+  if (current_gdbarch->dump_tdep != NULL)
+    current_gdbarch->dump_tdep (current_gdbarch, file);
 }
 
 struct gdbarch_tdep *
@@ -1244,43 +2097,9 @@
 }
 
 int
-gdbarch_bfd_vma_bit (struct gdbarch *gdbarch)
-{
-  /* Skip verify of bfd_vma_bit, invalid_p == 0 */
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_vma_bit called\n");
-  return gdbarch->bfd_vma_bit;
-}
-
-void
-set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch,
-                         int bfd_vma_bit)
-{
-  gdbarch->bfd_vma_bit = bfd_vma_bit;
-}
-
-int
-gdbarch_ptr_bit (struct gdbarch *gdbarch)
-{
-  if (gdbarch->ptr_bit == 0)
-    internal_error ("gdbarch: gdbarch_ptr_bit invalid");
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_ptr_bit called\n");
-  return gdbarch->ptr_bit;
-}
-
-void
-set_gdbarch_ptr_bit (struct gdbarch *gdbarch,
-                     int ptr_bit)
-{
-  gdbarch->ptr_bit = ptr_bit;
-}
-
-int
 gdbarch_short_bit (struct gdbarch *gdbarch)
 {
-  if (gdbarch->short_bit == 0)
-    internal_error ("gdbarch: gdbarch_short_bit invalid");
+  /* Skip verify of short_bit, invalid_p == 0 */
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_short_bit called\n");
   return gdbarch->short_bit;
@@ -1296,8 +2115,7 @@
 int
 gdbarch_int_bit (struct gdbarch *gdbarch)
 {
-  if (gdbarch->int_bit == 0)
-    internal_error ("gdbarch: gdbarch_int_bit invalid");
+  /* Skip verify of int_bit, invalid_p == 0 */
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_int_bit called\n");
   return gdbarch->int_bit;
@@ -1313,8 +2131,7 @@
 int
 gdbarch_long_bit (struct gdbarch *gdbarch)
 {
-  if (gdbarch->long_bit == 0)
-    internal_error ("gdbarch: gdbarch_long_bit invalid");
+  /* Skip verify of long_bit, invalid_p == 0 */
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_long_bit called\n");
   return gdbarch->long_bit;
@@ -1330,8 +2147,7 @@
 int
 gdbarch_long_long_bit (struct gdbarch *gdbarch)
 {
-  if (gdbarch->long_long_bit == 0)
-    internal_error ("gdbarch: gdbarch_long_long_bit invalid");
+  /* Skip verify of long_long_bit, invalid_p == 0 */
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_long_long_bit called\n");
   return gdbarch->long_long_bit;
@@ -1347,8 +2163,7 @@
 int
 gdbarch_float_bit (struct gdbarch *gdbarch)
 {
-  if (gdbarch->float_bit == 0)
-    internal_error ("gdbarch: gdbarch_float_bit invalid");
+  /* Skip verify of float_bit, invalid_p == 0 */
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_float_bit called\n");
   return gdbarch->float_bit;
@@ -1364,8 +2179,7 @@
 int
 gdbarch_double_bit (struct gdbarch *gdbarch)
 {
-  if (gdbarch->double_bit == 0)
-    internal_error ("gdbarch: gdbarch_double_bit invalid");
+  /* Skip verify of double_bit, invalid_p == 0 */
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_double_bit called\n");
   return gdbarch->double_bit;
@@ -1381,8 +2195,7 @@
 int
 gdbarch_long_double_bit (struct gdbarch *gdbarch)
 {
-  if (gdbarch->long_double_bit == 0)
-    internal_error ("gdbarch: gdbarch_long_double_bit invalid");
+  /* Skip verify of long_double_bit, invalid_p == 0 */
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_bit called\n");
   return gdbarch->long_double_bit;
@@ -1396,6 +2209,55 @@
 }
 
 int
+gdbarch_ptr_bit (struct gdbarch *gdbarch)
+{
+  /* Skip verify of ptr_bit, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_ptr_bit called\n");
+  return gdbarch->ptr_bit;
+}
+
+void
+set_gdbarch_ptr_bit (struct gdbarch *gdbarch,
+                     int ptr_bit)
+{
+  gdbarch->ptr_bit = ptr_bit;
+}
+
+int
+gdbarch_addr_bit (struct gdbarch *gdbarch)
+{
+  if (gdbarch->addr_bit == 0)
+    internal_error ("gdbarch: gdbarch_addr_bit invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_addr_bit called\n");
+  return gdbarch->addr_bit;
+}
+
+void
+set_gdbarch_addr_bit (struct gdbarch *gdbarch,
+                      int addr_bit)
+{
+  gdbarch->addr_bit = addr_bit;
+}
+
+int
+gdbarch_bfd_vma_bit (struct gdbarch *gdbarch)
+{
+  /* Skip verify of bfd_vma_bit, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_vma_bit called\n");
+  return gdbarch->bfd_vma_bit;
+}
+
+void
+set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch,
+                         int bfd_vma_bit)
+{
+  gdbarch->bfd_vma_bit = bfd_vma_bit;
+}
+
+int
 gdbarch_ieee_float (struct gdbarch *gdbarch)
 {
   /* Skip verify of ieee_float, invalid_p == 0 */
@@ -1531,6 +2393,22 @@
 }
 
 int
+gdbarch_num_pseudo_regs (struct gdbarch *gdbarch)
+{
+  /* Skip verify of num_pseudo_regs, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_num_pseudo_regs called\n");
+  return gdbarch->num_pseudo_regs;
+}
+
+void
+set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch,
+                             int num_pseudo_regs)
+{
+  gdbarch->num_pseudo_regs = num_pseudo_regs;
+}
+
+int
 gdbarch_sp_regnum (struct gdbarch *gdbarch)
 {
   if (gdbarch->sp_regnum == -1)
@@ -1629,6 +2507,91 @@
   gdbarch->nnpc_regnum = nnpc_regnum;
 }
 
+int
+gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, int stab_regnr)
+{
+  if (gdbarch->stab_reg_to_regnum == 0)
+    internal_error ("gdbarch: gdbarch_stab_reg_to_regnum invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stab_reg_to_regnum called\n");
+  return gdbarch->stab_reg_to_regnum (stab_regnr);
+}
+
+void
+set_gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch,
+                                gdbarch_stab_reg_to_regnum_ftype stab_reg_to_regnum)
+{
+  gdbarch->stab_reg_to_regnum = stab_reg_to_regnum;
+}
+
+int
+gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, int ecoff_regnr)
+{
+  if (gdbarch->ecoff_reg_to_regnum == 0)
+    internal_error ("gdbarch: gdbarch_ecoff_reg_to_regnum invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_ecoff_reg_to_regnum called\n");
+  return gdbarch->ecoff_reg_to_regnum (ecoff_regnr);
+}
+
+void
+set_gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch,
+                                 gdbarch_ecoff_reg_to_regnum_ftype ecoff_reg_to_regnum)
+{
+  gdbarch->ecoff_reg_to_regnum = ecoff_reg_to_regnum;
+}
+
+int
+gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int dwarf_regnr)
+{
+  if (gdbarch->dwarf_reg_to_regnum == 0)
+    internal_error ("gdbarch: gdbarch_dwarf_reg_to_regnum invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf_reg_to_regnum called\n");
+  return gdbarch->dwarf_reg_to_regnum (dwarf_regnr);
+}
+
+void
+set_gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch,
+                                 gdbarch_dwarf_reg_to_regnum_ftype dwarf_reg_to_regnum)
+{
+  gdbarch->dwarf_reg_to_regnum = dwarf_reg_to_regnum;
+}
+
+int
+gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, int sdb_regnr)
+{
+  if (gdbarch->sdb_reg_to_regnum == 0)
+    internal_error ("gdbarch: gdbarch_sdb_reg_to_regnum invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_sdb_reg_to_regnum called\n");
+  return gdbarch->sdb_reg_to_regnum (sdb_regnr);
+}
+
+void
+set_gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch,
+                               gdbarch_sdb_reg_to_regnum_ftype sdb_reg_to_regnum)
+{
+  gdbarch->sdb_reg_to_regnum = sdb_reg_to_regnum;
+}
+
+int
+gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2_regnr)
+{
+  if (gdbarch->dwarf2_reg_to_regnum == 0)
+    internal_error ("gdbarch: gdbarch_dwarf2_reg_to_regnum invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_dwarf2_reg_to_regnum called\n");
+  return gdbarch->dwarf2_reg_to_regnum (dwarf2_regnr);
+}
+
+void
+set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch,
+                                  gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
+{
+  gdbarch->dwarf2_reg_to_regnum = dwarf2_reg_to_regnum;
+}
+
 char *
 gdbarch_register_name (struct gdbarch *gdbarch, int regnr)
 {
@@ -1782,6 +2745,63 @@
   gdbarch->register_virtual_type = register_virtual_type;
 }
 
+void
+gdbarch_do_registers_info (struct gdbarch *gdbarch, int reg_nr, int fpregs)
+{
+  if (gdbarch->do_registers_info == 0)
+    internal_error ("gdbarch: gdbarch_do_registers_info invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_do_registers_info called\n");
+  gdbarch->do_registers_info (reg_nr, fpregs);
+}
+
+void
+set_gdbarch_do_registers_info (struct gdbarch *gdbarch,
+                               gdbarch_do_registers_info_ftype do_registers_info)
+{
+  gdbarch->do_registers_info = do_registers_info;
+}
+
+int
+gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr)
+{
+  if (gdbarch->register_sim_regno == 0)
+    internal_error ("gdbarch: gdbarch_register_sim_regno invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_register_sim_regno called\n");
+  return gdbarch->register_sim_regno (reg_nr);
+}
+
+void
+set_gdbarch_register_sim_regno (struct gdbarch *gdbarch,
+                                gdbarch_register_sim_regno_ftype register_sim_regno)
+{
+  gdbarch->register_sim_regno = register_sim_regno;
+}
+
+int
+gdbarch_register_bytes_ok_p (struct gdbarch *gdbarch)
+{
+  return gdbarch->register_bytes_ok != 0;
+}
+
+int
+gdbarch_register_bytes_ok (struct gdbarch *gdbarch, long nr_bytes)
+{
+  if (gdbarch->register_bytes_ok == 0)
+    internal_error ("gdbarch: gdbarch_register_bytes_ok invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_register_bytes_ok called\n");
+  return gdbarch->register_bytes_ok (nr_bytes);
+}
+
+void
+set_gdbarch_register_bytes_ok (struct gdbarch *gdbarch,
+                               gdbarch_register_bytes_ok_ftype register_bytes_ok)
+{
+  gdbarch->register_bytes_ok = register_bytes_ok;
+}
+
 int
 gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch)
 {
@@ -2133,6 +3153,40 @@
   gdbarch->register_convert_to_raw = register_convert_to_raw;
 }
 
+void
+gdbarch_fetch_pseudo_register (struct gdbarch *gdbarch, int regnum)
+{
+  if (gdbarch->fetch_pseudo_register == 0)
+    internal_error ("gdbarch: gdbarch_fetch_pseudo_register invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_fetch_pseudo_register called\n");
+  gdbarch->fetch_pseudo_register (regnum);
+}
+
+void
+set_gdbarch_fetch_pseudo_register (struct gdbarch *gdbarch,
+                                   gdbarch_fetch_pseudo_register_ftype fetch_pseudo_register)
+{
+  gdbarch->fetch_pseudo_register = fetch_pseudo_register;
+}
+
+void
+gdbarch_store_pseudo_register (struct gdbarch *gdbarch, int regnum)
+{
+  if (gdbarch->store_pseudo_register == 0)
+    internal_error ("gdbarch: gdbarch_store_pseudo_register invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_store_pseudo_register called\n");
+  gdbarch->store_pseudo_register (regnum);
+}
+
+void
+set_gdbarch_store_pseudo_register (struct gdbarch *gdbarch,
+                                   gdbarch_store_pseudo_register_ftype store_pseudo_register)
+{
+  gdbarch->store_pseudo_register = store_pseudo_register;
+}
+
 CORE_ADDR
 gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, void *buf)
 {
@@ -2803,6 +3857,22 @@
 }
 
 int
+gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch)
+{
+  /* Skip verify of extra_stack_alignment_needed, invalid_p == 0 */
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_extra_stack_alignment_needed called\n");
+  return gdbarch->extra_stack_alignment_needed;
+}
+
+void
+set_gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch,
+                                          int extra_stack_alignment_needed)
+{
+  gdbarch->extra_stack_alignment_needed = extra_stack_alignment_needed;
+}
+
+int
 gdbarch_reg_struct_has_addr_p (struct gdbarch *gdbarch)
 {
   return gdbarch->reg_struct_has_addr != 0;
@@ -2893,8 +3963,25 @@
   gdbarch->long_double_format = long_double_format;
 }
 
+CORE_ADDR
+gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
+{
+  if (gdbarch->convert_from_func_ptr_addr == 0)
+    internal_error ("gdbarch: gdbarch_convert_from_func_ptr_addr invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_from_func_ptr_addr called\n");
+  return gdbarch->convert_from_func_ptr_addr (addr);
+}
 
-/* Keep a registrary of per-architecture data-pointers required by GDB
+void
+set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+                                        gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr)
+{
+  gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr;
+}
+
+
+/* Keep a registry of per-architecture data-pointers required by GDB
    modules. */
 
 struct gdbarch_data
@@ -2909,13 +3996,13 @@
   struct gdbarch_data_registration *next;
 };
 
-struct gdbarch_data_registrary
+struct gdbarch_data_registry
 {
   int nr;
   struct gdbarch_data_registration *registrations;
 };
 
-struct gdbarch_data_registrary gdbarch_data_registrary =
+struct gdbarch_data_registry gdbarch_data_registry =
 {
   0, NULL,
 };
@@ -2924,14 +4011,14 @@
 register_gdbarch_data (gdbarch_data_ftype *init)
 {
   struct gdbarch_data_registration **curr;
-  for (curr = &gdbarch_data_registrary.registrations;
+  for (curr = &gdbarch_data_registry.registrations;
        (*curr) != NULL;
        curr = &(*curr)->next);
   (*curr) = XMALLOC (struct gdbarch_data_registration);
   (*curr)->next = NULL;
   (*curr)->init = init;
   (*curr)->data = XMALLOC (struct gdbarch_data);
-  (*curr)->data->index = gdbarch_data_registrary.nr++;
+  (*curr)->data->index = gdbarch_data_registry.nr++;
   return (*curr)->data;
 }
 
@@ -2942,9 +4029,9 @@
 init_gdbarch_data (struct gdbarch *gdbarch)
 {
   struct gdbarch_data_registration *rego;
-  gdbarch->nr_data = gdbarch_data_registrary.nr + 1;
+  gdbarch->nr_data = gdbarch_data_registry.nr + 1;
   gdbarch->data = xmalloc (sizeof (void*) * gdbarch->nr_data);
-  for (rego = gdbarch_data_registrary.registrations;
+  for (rego = gdbarch_data_registry.registrations;
        rego != NULL;
        rego = rego->next)
     {
@@ -2958,8 +4045,7 @@
    data-pointer. */
 
 void *
-gdbarch_data (data)
-     struct gdbarch_data *data;
+gdbarch_data (struct gdbarch_data *data)
 {
   if (data->index >= current_gdbarch->nr_data)
     internal_error ("gdbarch_data: request for non-existant data.");
@@ -2968,7 +4054,7 @@
 
 
 
-/* Keep a registrary of swaped data required by GDB modules. */
+/* Keep a registry of swapped data required by GDB modules. */
 
 struct gdbarch_swap
 {
@@ -2985,13 +4071,13 @@
   struct gdbarch_swap_registration *next;
 };
 
-struct gdbarch_swap_registrary
+struct gdbarch_swap_registry
 {
   int nr;
   struct gdbarch_swap_registration *registrations;
 };
 
-struct gdbarch_swap_registrary gdbarch_swap_registrary = 
+struct gdbarch_swap_registry gdbarch_swap_registry = 
 {
   0, NULL,
 };
@@ -3002,7 +4088,7 @@
 		       gdbarch_swap_ftype *init)
 {
   struct gdbarch_swap_registration **rego;
-  for (rego = &gdbarch_swap_registrary.registrations;
+  for (rego = &gdbarch_swap_registry.registrations;
        (*rego) != NULL;
        rego = &(*rego)->next);
   (*rego) = XMALLOC (struct gdbarch_swap_registration);
@@ -3018,7 +4104,7 @@
 {
   struct gdbarch_swap_registration *rego;
   struct gdbarch_swap **curr = &gdbarch->swap;
-  for (rego = gdbarch_swap_registrary.registrations;
+  for (rego = gdbarch_swap_registry.registrations;
        rego != NULL;
        rego = rego->next)
     {
@@ -3057,32 +4143,78 @@
 }
 
 
-/* Keep a registrary of the architectures known by GDB. */
+/* Keep a registry of the architectures known by GDB. */
 
-struct gdbarch_init_registration
+struct gdbarch_registration
 {
   enum bfd_architecture bfd_architecture;
   gdbarch_init_ftype *init;
+  gdbarch_dump_tdep_ftype *dump_tdep;
   struct gdbarch_list *arches;
-  struct gdbarch_init_registration *next;
+  struct gdbarch_registration *next;
 };
 
-static struct gdbarch_init_registration *gdbarch_init_registrary = NULL;
+static struct gdbarch_registration *gdbarch_registry = NULL;
+
+static void
+append_name (const char ***buf, int *nr, const char *name)
+{
+  *buf = xrealloc (*buf, sizeof (char**) * (*nr + 1));
+  (*buf)[*nr] = name;
+  *nr += 1;
+}
+
+const char **
+gdbarch_printable_names (void)
+{
+  if (GDB_MULTI_ARCH)
+    {
+      /* Accumulate a list of names based on the registed list of
+         architectures. */
+      enum bfd_architecture a;
+      int nr_arches = 0;
+      const char **arches = NULL;
+      struct gdbarch_registration *rego;
+      for (rego = gdbarch_registry;
+	   rego != NULL;
+	   rego = rego->next)
+	{
+	  const struct bfd_arch_info *ap;
+	  ap = bfd_lookup_arch (rego->bfd_architecture, 0);
+	  if (ap == NULL)
+	    internal_error ("gdbarch_architecture_names: multi-arch unknown");
+	  do
+	    {
+	      append_name (&arches, &nr_arches, ap->printable_name);
+	      ap = ap->next;
+	    }
+	  while (ap != NULL);
+	}
+      append_name (&arches, &nr_arches, NULL);
+      return arches;
+    }
+  else
+    /* Just return all the architectures that BFD knows.  Assume that
+       the legacy architecture framework supports them. */
+    return bfd_arch_list ();
+}
+
 
 void
-register_gdbarch_init (enum bfd_architecture bfd_architecture,
-                       gdbarch_init_ftype *init)
+gdbarch_register (enum bfd_architecture bfd_architecture,
+                  gdbarch_init_ftype *init,
+		  gdbarch_dump_tdep_ftype *dump_tdep)
 {
-  struct gdbarch_init_registration **curr;
+  struct gdbarch_registration **curr;
   const struct bfd_arch_info *bfd_arch_info;
-  /* Check that BFD reconizes this architecture */
+  /* Check that BFD recognizes this architecture */
   bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0);
   if (bfd_arch_info == NULL)
     {
       internal_error ("gdbarch: Attempt to register unknown architecture (%d)", bfd_architecture);
     }
   /* Check that we haven't seen this architecture before */
-  for (curr = &gdbarch_init_registrary;
+  for (curr = &gdbarch_registry;
        (*curr) != NULL;
        curr = &(*curr)->next)
     {
@@ -3096,13 +4228,26 @@
 			bfd_arch_info->printable_name,
 			(long) init);
   /* Append it */
-  (*curr) = XMALLOC (struct gdbarch_init_registration);
+  (*curr) = XMALLOC (struct gdbarch_registration);
   (*curr)->bfd_architecture = bfd_architecture;
   (*curr)->init = init;
+  (*curr)->dump_tdep = dump_tdep;
   (*curr)->arches = NULL;
   (*curr)->next = NULL;
+  /* When non- multi-arch, install whatever target dump routine we've
+     been provided - hopefully that routine has been written correctly
+     and works regardless of multi-arch. */
+  if (!GDB_MULTI_ARCH && dump_tdep != NULL
+      && startup_gdbarch.dump_tdep == NULL)
+    startup_gdbarch.dump_tdep = dump_tdep;
 }
-  
+
+void
+register_gdbarch_init (enum bfd_architecture bfd_architecture,
+		       gdbarch_init_ftype *init)
+{
+  gdbarch_register (bfd_architecture, init, NULL);
+}
 
 
 /* Look for an architecture using gdbarch_info.  Base search on only
@@ -3128,11 +4273,11 @@
    failed. */
 
 int
-gdbarch_update (struct gdbarch_info info)
+gdbarch_update_p (struct gdbarch_info info)
 {
   struct gdbarch *new_gdbarch;
   struct gdbarch_list **list;
-  struct gdbarch_init_registration *rego;
+  struct gdbarch_registration *rego;
 
   /* Fill in any missing bits. Most important is the bfd_architecture
      which is used to select the target architecture. */
@@ -3166,9 +4311,11 @@
   /* A default for abfd? */
 
   /* Find the target that knows about this architecture. */
-  for (rego = gdbarch_init_registrary;
-       rego != NULL && rego->bfd_architecture != info.bfd_architecture;
-       rego = rego->next);
+  for (rego = gdbarch_registry;
+       rego != NULL;
+       rego = rego->next)
+    if (rego->bfd_architecture == info.bfd_architecture)
+      break;
   if (rego == NULL)
     {
       if (gdbarch_debug)
@@ -3233,7 +4380,8 @@
       if ((*list)->gdbarch == new_gdbarch)
 	{
 	  if (gdbarch_debug)
-	    fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Previous architecture 0x%08lx (%s) selected\n",
+	    fprintf_unfiltered (gdb_stdlog,
+                                "gdbarch_update: Previous architecture 0x%08lx (%s) selected\n",
 				(long) new_gdbarch,
 				new_gdbarch->bfd_arch_info->printable_name);
 	  current_gdbarch = new_gdbarch;
@@ -3241,7 +4389,7 @@
 	  return 1;
 	}
     }
-    
+
   /* Append this new architecture to this targets list. */
   (*list) = XMALLOC (struct gdbarch_list);
   (*list)->next = NULL;
@@ -3255,10 +4403,11 @@
 			  "gdbarch_update: New architecture 0x%08lx (%s) selected\n",
 			  (long) new_gdbarch,
 			  new_gdbarch->bfd_arch_info->printable_name);
-      gdbarch_dump ();
     }
   
-  /* Check that the newly installed architecture is valid.  */
+  /* Check that the newly installed architecture is valid.  Plug in
+     any post init values.  */
+  new_gdbarch->dump_tdep = rego->dump_tdep;
   verify_gdbarch (new_gdbarch);
 
   /* Initialize the per-architecture memory (swap) areas.
@@ -3271,366 +4420,13 @@
      must be updated before these modules are called. */
   init_gdbarch_data (new_gdbarch);
   
+  if (gdbarch_debug)
+    gdbarch_dump (current_gdbarch, gdb_stdlog);
+
   return 1;
 }
 
 
-
-/* Functions to manipulate the endianness of the target.  */
-
-#ifdef TARGET_BYTE_ORDER_SELECTABLE
-/* compat - Catch old targets that expect a selectable byte-order to
-   default to BIG_ENDIAN */
-#ifndef TARGET_BYTE_ORDER_DEFAULT
-#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN
-#endif
-#endif
-#if !TARGET_BYTE_ORDER_SELECTABLE_P
-#ifndef TARGET_BYTE_ORDER_DEFAULT
-/* compat - Catch old non byte-order selectable targets that do not
-   define TARGET_BYTE_ORDER_DEFAULT and instead expect
-   TARGET_BYTE_ORDER to be used as the default.  For targets that
-   defined neither TARGET_BYTE_ORDER nor TARGET_BYTE_ORDER_DEFAULT the
-   below will get a strange compiler warning. */
-#define TARGET_BYTE_ORDER_DEFAULT TARGET_BYTE_ORDER
-#endif
-#endif
-#ifndef TARGET_BYTE_ORDER_DEFAULT
-#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN /* arbitrary */
-#endif
-int target_byte_order = TARGET_BYTE_ORDER_DEFAULT;
-int target_byte_order_auto = 1;
-
-/* Chain containing the \"set endian\" commands.  */
-static struct cmd_list_element *endianlist = NULL;
-
-/* Called by ``show endian''.  */
-static void
-show_endian (char *args, int from_tty)
-{
-  char *msg =
-    (TARGET_BYTE_ORDER_AUTO
-     ? "The target endianness is set automatically (currently %s endian)\n"
-     : "The target is assumed to be %s endian\n");
-  printf_unfiltered (msg, (TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little"));
-}
-
-/* Called if the user enters ``set endian'' without an argument.  */
-static void
-set_endian (char *args, int from_tty)
-{
-  printf_unfiltered ("\"set endian\" must be followed by \"auto\", \"big\" or \"little\".\n");
-  show_endian (args, from_tty);
-}
-
-/* Called by ``set endian big''.  */
-static void
-set_endian_big (char *args, int from_tty)
-{
-  if (TARGET_BYTE_ORDER_SELECTABLE_P)
-    {
-      target_byte_order = BIG_ENDIAN;
-      target_byte_order_auto = 0;
-      if (GDB_MULTI_ARCH)
-	{
-	  struct gdbarch_info info;
-	  memset (&info, 0, sizeof info);
-	  info.byte_order = BIG_ENDIAN;
-	  gdbarch_update (info);
-	}
-    }
-  else
-    {
-      printf_unfiltered ("Byte order is not selectable.");
-      show_endian (args, from_tty);
-    }
-}
-
-/* Called by ``set endian little''.  */
-static void
-set_endian_little (char *args, int from_tty)
-{
-  if (TARGET_BYTE_ORDER_SELECTABLE_P)
-    {
-      target_byte_order = LITTLE_ENDIAN;
-      target_byte_order_auto = 0;
-      if (GDB_MULTI_ARCH)
-	{
-	  struct gdbarch_info info;
-	  memset (&info, 0, sizeof info);
-	  info.byte_order = LITTLE_ENDIAN;
-	  gdbarch_update (info);
-	}
-    }
-  else
-    {
-      printf_unfiltered ("Byte order is not selectable.");
-      show_endian (args, from_tty);
-    }
-}
-
-/* Called by ``set endian auto''.  */
-static void
-set_endian_auto (char *args, int from_tty)
-{
-  if (TARGET_BYTE_ORDER_SELECTABLE_P)
-    {
-      target_byte_order_auto = 1;
-    }
-  else
-    {
-      printf_unfiltered ("Byte order is not selectable.");
-      show_endian (args, from_tty);
-    }
-}
-
-/* Set the endianness from a BFD.  */
-static void
-set_endian_from_file (bfd *abfd)
-{
-  if (TARGET_BYTE_ORDER_SELECTABLE_P)
-    {
-      int want;
-      
-      if (bfd_big_endian (abfd))
-	want = BIG_ENDIAN;
-      else
-	want = LITTLE_ENDIAN;
-      if (TARGET_BYTE_ORDER_AUTO)
-	target_byte_order = want;
-      else if (TARGET_BYTE_ORDER != want)
-	warning ("%s endian file does not match %s endian target.",
-		 want == BIG_ENDIAN ? "big" : "little",
-		 TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little");
-    }
-  else
-    {
-      if (bfd_big_endian (abfd)
-	  ? TARGET_BYTE_ORDER != BIG_ENDIAN
-	  : TARGET_BYTE_ORDER == BIG_ENDIAN)
-	warning ("%s endian file does not match %s endian target.",
-		 bfd_big_endian (abfd) ? "big" : "little",
-		 TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little");
-    }
-}
-
-
-
-/* Functions to manipulate the architecture of the target */
-
-enum set_arch { set_arch_auto, set_arch_manual };
-
-int target_architecture_auto = 1;
-extern const struct bfd_arch_info bfd_default_arch_struct;
-const struct bfd_arch_info *target_architecture = &bfd_default_arch_struct;
-int (*target_architecture_hook) (const struct bfd_arch_info *ap);
-
-static void show_endian (char *, int);
-static void set_endian (char *, int);
-static void set_endian_big (char *, int);
-static void set_endian_little (char *, int);
-static void set_endian_auto (char *, int);
-static void set_endian_from_file (bfd *);
-static int arch_ok (const struct bfd_arch_info *arch);
-static void set_arch (const struct bfd_arch_info *arch, enum set_arch type);
-static void show_architecture (char *, int);
-static void set_architecture (char *, int);
-static void info_architecture (char *, int);
-static void set_architecture_from_file (bfd *);
-
-/* Do the real work of changing the current architecture */
-
-static int
-arch_ok (const struct bfd_arch_info *arch)
-{
-  /* Should be performing the more basic check that the binary is
-     compatible with GDB. */
-  /* Check with the target that the architecture is valid. */
-  return (target_architecture_hook == NULL
-	  || target_architecture_hook (arch));
-}
-
-static void
-set_arch (const struct bfd_arch_info *arch,
-          enum set_arch type)
-{
-  switch (type)
-    {
-    case set_arch_auto:
-      if (!arch_ok (arch))
-	warning ("Target may not support %s architecture",
-		 arch->printable_name);
-      target_architecture = arch;
-      break;
-    case set_arch_manual:
-      if (!arch_ok (arch))
-	{
-	  printf_unfiltered ("Target does not support `%s' architecture.\n",
-			     arch->printable_name);
-	}
-      else
-	{
-	  target_architecture_auto = 0;
-	  target_architecture = arch;
-	}
-      break;
-    }
-  if (gdbarch_debug)
-    gdbarch_dump ();
-}
-
-/* Called if the user enters ``show architecture'' without an argument. */
-static void
-show_architecture (char *args, int from_tty)
-{
-  const char *arch;
-  arch = TARGET_ARCHITECTURE->printable_name;
-  if (target_architecture_auto)
-    printf_filtered ("The target architecture is set automatically (currently %s)\n", arch);
-  else
-    printf_filtered ("The target architecture is assumed to be %s\n", arch);
-}
-
-/* Called if the user enters ``set architecture'' with or without an
-   argument. */
-static void
-set_architecture (char *args, int from_tty)
-{
-  if (args == NULL)
-    {
-      printf_unfiltered ("\"set architecture\" must be followed by \"auto\" or an architecture name.\n");
-    }
-  else if (strcmp (args, "auto") == 0)
-    {
-      target_architecture_auto = 1;
-    }
-  else if (GDB_MULTI_ARCH)
-    {
-      const struct bfd_arch_info *arch = bfd_scan_arch (args);
-      if (arch == NULL)
-	printf_unfiltered ("Architecture `%s' not reconized.\n", args);
-      else
-	{
-	  struct gdbarch_info info;
-	  memset (&info, 0, sizeof info);
-	  info.bfd_arch_info = arch;
-	  if (gdbarch_update (info))
-	    target_architecture_auto = 0;
-	  else
-	    printf_unfiltered ("Architecture `%s' not reconized.\n", args);
-	}
-    }
-  else
-    {
-      const struct bfd_arch_info *arch = bfd_scan_arch (args);
-      if (arch != NULL)
-	set_arch (arch, set_arch_manual);
-      else
-	printf_unfiltered ("Architecture `%s' not reconized.\n", args);
-    }
-}
-
-/* Called if the user enters ``info architecture'' without an argument. */
-static void
-info_architecture (char *args, int from_tty)
-{
-  enum bfd_architecture a;
-  if (GDB_MULTI_ARCH)
-    {
-      if (gdbarch_init_registrary != NULL)
-	{
-	  struct gdbarch_init_registration *rego;
-	  printf_filtered ("Available architectures are:\n");
-	  for (rego = gdbarch_init_registrary;
-	       rego != NULL;
-	       rego = rego->next)
-	    {
-	      const struct bfd_arch_info *ap;
-	      ap = bfd_lookup_arch (rego->bfd_architecture, 0);
-	      if (ap != NULL)
-		{
-		  do
-		    {
-		      printf_filtered (" %s", ap->printable_name);
-		      ap = ap->next;
-		    }
-		  while (ap != NULL);
-		  printf_filtered ("\n");
-		}
-	    }
-	}
-      else
-	{
-	  printf_filtered ("There are no available architectures.\n");
-	}
-      return;
-    }
-  printf_filtered ("Available architectures are:\n");
-  for (a = bfd_arch_obscure + 1; a < bfd_arch_last; a++)
-    {
-      const struct bfd_arch_info *ap = bfd_lookup_arch (a, 0);
-      if (ap != NULL)
-	{
-	  do
-	    {
-	      printf_filtered (" %s", ap->printable_name);
-	      ap = ap->next;
-	    }
-	  while (ap != NULL);
-	  printf_filtered ("\n");
-	}
-    }
-}
-
-/* Set the architecture from arch/machine */
-void
-set_architecture_from_arch_mach (arch, mach)
-     enum bfd_architecture arch;
-     unsigned long mach;
-{
-  const struct bfd_arch_info *wanted = bfd_lookup_arch (arch, mach);
-  if (wanted != NULL)
-    set_arch (wanted, set_arch_manual);
-  else
-    internal_error ("gdbarch: hardwired architecture/machine not reconized");
-}
-
-/* Set the architecture from a BFD */
-static void
-set_architecture_from_file (bfd *abfd)
-{
-  const struct bfd_arch_info *wanted = bfd_get_arch_info (abfd);
-  if (target_architecture_auto)
-    {
-      set_arch (wanted, set_arch_auto);
-    }
-  else if (wanted != target_architecture)
-    {
-      warning ("%s architecture file may be incompatible with %s target.",
-	       wanted->printable_name,
-	       target_architecture->printable_name);
-    }
-}
-
-
-/* Misc helper functions for targets. */
-
-int
-frame_num_args_unknown (fi)
-     struct frame_info *fi;
-{
-  return -1;
-}
-
-
-int
-generic_register_convertible_not (num)
-     int num;
-{
-  return 0;
-}
-  
-
 /* Disassembler */
 
 /* Pointer to the target-dependent disassembly function.  */
@@ -3638,82 +4434,13 @@
 disassemble_info tm_print_insn_info;
 
 
-
-/* Set the dynamic target-system-dependant parameters (architecture,
-   byte-order) using information found in the BFD */
-
-void
-set_gdbarch_from_file (abfd)
-     bfd *abfd;
-{
-  if (GDB_MULTI_ARCH)
-    {
-      struct gdbarch_info info;
-      memset (&info, 0, sizeof info);
-      info.abfd = abfd;
-      gdbarch_update (info);
-      return;
-    }
-  set_architecture_from_file (abfd);
-  set_endian_from_file (abfd);
-}
-
-
-/* Initialize the current architecture.  */
-void
-initialize_current_architecture ()
-{
-  if (GDB_MULTI_ARCH)
-    {
-      struct gdbarch_init_registration *rego;
-      const struct bfd_arch_info *chosen = NULL;
-      for (rego = gdbarch_init_registrary; rego != NULL; rego = rego->next)
-	{
-	  const struct bfd_arch_info *ap
-	    = bfd_lookup_arch (rego->bfd_architecture, 0);
-
-	  /* Choose the first architecture alphabetically.  */
-	  if (chosen == NULL
-	      || strcmp (ap->printable_name, chosen->printable_name) < 0)
-	    chosen = ap;
-	}
-
-      if (chosen != NULL)
-	{
-	  struct gdbarch_info info;
-	  memset (&info, 0, sizeof info);
-	  info.bfd_arch_info = chosen;
-	  gdbarch_update (info);
-	}
-    }
-}
-
 extern void _initialize_gdbarch (void);
+
 void
-_initialize_gdbarch ()
+_initialize_gdbarch (void)
 {
   struct cmd_list_element *c;
 
-  add_prefix_cmd ("endian", class_support, set_endian,
-		  "Set endianness of target.",
-		  &endianlist, "set endian ", 0, &setlist);
-  add_cmd ("big", class_support, set_endian_big,
-	   "Set target as being big endian.", &endianlist);
-  add_cmd ("little", class_support, set_endian_little,
-	   "Set target as being little endian.", &endianlist);
-  add_cmd ("auto", class_support, set_endian_auto,
-	   "Select target endianness automatically.", &endianlist);
-  add_cmd ("endian", class_support, show_endian,
-	   "Show endianness of target.", &showlist);
-
-  add_cmd ("architecture", class_support, set_architecture,
-	   "Set architecture of target.", &setlist);
-  add_alias_cmd ("processor", "architecture", class_support, 1, &setlist);
-  add_cmd ("architecture", class_support, show_architecture,
-	   "Show architecture of target.", &showlist);
-  add_cmd ("architecture", class_support, info_architecture,
-	   "List supported target architectures", &infolist);
-
   INIT_DISASSEMBLE_INFO_NO_ARCH (tm_print_insn_info, gdb_stdout, (fprintf_ftype)fprintf_filtered);
   tm_print_insn_info.flavour = bfd_target_unknown_flavour;
   tm_print_insn_info.read_memory_func = dis_asm_read_memory;
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 1875774..2ba9371 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -22,13 +22,13 @@
 
 /* This file was created with the aid of ``gdbarch.sh''.
 
-   The bourn shell script ``gdbarch.sh'' creates the files
+   The Bourne shell script ``gdbarch.sh'' creates the files
    ``new-gdbarch.c'' and ``new-gdbarch.h and then compares them
    against the existing ``gdbarch.[hc]''.  Any differences found
    being reported.
 
    If editing this file, please also run gdbarch.sh and merge any
-   changes into that script. Conversely, when makeing sweeping changes
+   changes into that script. Conversely, when making sweeping changes
    to this file, modifying gdbarch.sh and using its output may prove
    easier. */
 
@@ -39,17 +39,9 @@
 struct value;
 
 
-#ifndef GDB_MULTI_ARCH
-#define GDB_MULTI_ARCH 0
-#endif
-
 extern struct gdbarch *current_gdbarch;
 
 
-/* See gdb/doc/gdbint.texi for a discussion of the GDB_MULTI_ARCH
-   macro */
-
-
 /* If any of the following are defined, the target wasn't correctly
    converted. */
 
@@ -71,7 +63,7 @@
 extern const struct bfd_arch_info * gdbarch_bfd_arch_info (struct gdbarch *gdbarch);
 /* set_gdbarch_bfd_arch_info() - not applicable - pre-initialized. */
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_ARCHITECTURE)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_ARCHITECTURE)
 #define TARGET_ARCHITECTURE (gdbarch_bfd_arch_info (current_gdbarch))
 #endif
 #endif
@@ -79,154 +71,270 @@
 extern int gdbarch_byte_order (struct gdbarch *gdbarch);
 /* set_gdbarch_byte_order() - not applicable - pre-initialized. */
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_BYTE_ORDER)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_BYTE_ORDER)
 #define TARGET_BYTE_ORDER (gdbarch_byte_order (current_gdbarch))
 #endif
 #endif
 
 
-/* The following are initialized by the target dependant code. */
+/* The following are initialized by the target dependent code. */
+
+/* Number of bits in a char or unsigned char for the target machine.
+   Just like CHAR_BIT in <limits.h> but describes the target machine.
+   v::TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):8::0:
+  
+   Number of bits in a short or unsigned short for the target machine. */
 
 /* Default (value) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (TARGET_BFD_VMA_BIT)
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_SHORT_BIT)
+#define TARGET_SHORT_BIT (2*TARGET_CHAR_BIT)
+#endif
+
+extern int gdbarch_short_bit (struct gdbarch *gdbarch);
+extern void set_gdbarch_short_bit (struct gdbarch *gdbarch, int short_bit);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_SHORT_BIT)
+#define TARGET_SHORT_BIT (gdbarch_short_bit (current_gdbarch))
+#endif
+#endif
+
+/* Number of bits in an int or unsigned int for the target machine. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_INT_BIT)
+#define TARGET_INT_BIT (4*TARGET_CHAR_BIT)
+#endif
+
+extern int gdbarch_int_bit (struct gdbarch *gdbarch);
+extern void set_gdbarch_int_bit (struct gdbarch *gdbarch, int int_bit);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_INT_BIT)
+#define TARGET_INT_BIT (gdbarch_int_bit (current_gdbarch))
+#endif
+#endif
+
+/* Number of bits in a long or unsigned long for the target machine. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_LONG_BIT)
+#define TARGET_LONG_BIT (4*TARGET_CHAR_BIT)
+#endif
+
+extern int gdbarch_long_bit (struct gdbarch *gdbarch);
+extern void set_gdbarch_long_bit (struct gdbarch *gdbarch, int long_bit);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_LONG_BIT)
+#define TARGET_LONG_BIT (gdbarch_long_bit (current_gdbarch))
+#endif
+#endif
+
+/* Number of bits in a long long or unsigned long long for the target
+   machine. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_LONG_LONG_BIT)
+#define TARGET_LONG_LONG_BIT (2*TARGET_LONG_BIT)
+#endif
+
+extern int gdbarch_long_long_bit (struct gdbarch *gdbarch);
+extern void set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int long_long_bit);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_LONG_LONG_BIT)
+#define TARGET_LONG_LONG_BIT (gdbarch_long_long_bit (current_gdbarch))
+#endif
+#endif
+
+/* Number of bits in a float for the target machine. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_FLOAT_BIT)
+#define TARGET_FLOAT_BIT (4*TARGET_CHAR_BIT)
+#endif
+
+extern int gdbarch_float_bit (struct gdbarch *gdbarch);
+extern void set_gdbarch_float_bit (struct gdbarch *gdbarch, int float_bit);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_FLOAT_BIT)
+#define TARGET_FLOAT_BIT (gdbarch_float_bit (current_gdbarch))
+#endif
+#endif
+
+/* Number of bits in a double for the target machine. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_DOUBLE_BIT)
+#define TARGET_DOUBLE_BIT (8*TARGET_CHAR_BIT)
+#endif
+
+extern int gdbarch_double_bit (struct gdbarch *gdbarch);
+extern void set_gdbarch_double_bit (struct gdbarch *gdbarch, int double_bit);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_DOUBLE_BIT)
+#define TARGET_DOUBLE_BIT (gdbarch_double_bit (current_gdbarch))
+#endif
+#endif
+
+/* Number of bits in a long double for the target machine. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_LONG_DOUBLE_BIT)
+#define TARGET_LONG_DOUBLE_BIT (2*TARGET_DOUBLE_BIT)
+#endif
+
+extern int gdbarch_long_double_bit (struct gdbarch *gdbarch);
+extern void set_gdbarch_long_double_bit (struct gdbarch *gdbarch, int long_double_bit);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_LONG_DOUBLE_BIT)
+#define TARGET_LONG_DOUBLE_BIT (gdbarch_long_double_bit (current_gdbarch))
+#endif
+#endif
+
+/* For most targets, a pointer on the target and its representation as an
+   address in GDB have the same size and "look the same".  For such a
+   target, you need only set TARGET_PTR_BIT / ptr_bit and TARGET_ADDR_BIT
+   / addr_bit will be set from it.
+  
+   If TARGET_PTR_BIT and TARGET_ADDR_BIT are different, you'll probably
+   also need to set POINTER_TO_ADDRESS and ADDRESS_TO_POINTER as well.
+  
+   ptr_bit is the size of a pointer on the target */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_PTR_BIT)
+#define TARGET_PTR_BIT (TARGET_INT_BIT)
+#endif
+
+extern int gdbarch_ptr_bit (struct gdbarch *gdbarch);
+extern void set_gdbarch_ptr_bit (struct gdbarch *gdbarch, int ptr_bit);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_PTR_BIT)
+#define TARGET_PTR_BIT (gdbarch_ptr_bit (current_gdbarch))
+#endif
+#endif
+
+/* addr_bit is the size of a target address as represented in gdb */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_ADDR_BIT)
+#define TARGET_ADDR_BIT (TARGET_PTR_BIT)
+#endif
+
+extern int gdbarch_addr_bit (struct gdbarch *gdbarch);
+extern void set_gdbarch_addr_bit (struct gdbarch *gdbarch, int addr_bit);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_ADDR_BIT)
+#define TARGET_ADDR_BIT (gdbarch_addr_bit (current_gdbarch))
+#endif
+#endif
+
+/* Number of bits in a BFD_VMA for the target object file format. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_BFD_VMA_BIT)
 #define TARGET_BFD_VMA_BIT (TARGET_ARCHITECTURE->bits_per_address)
 #endif
 
 extern int gdbarch_bfd_vma_bit (struct gdbarch *gdbarch);
 extern void set_gdbarch_bfd_vma_bit (struct gdbarch *gdbarch, int bfd_vma_bit);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_BFD_VMA_BIT)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_BFD_VMA_BIT)
 #define TARGET_BFD_VMA_BIT (gdbarch_bfd_vma_bit (current_gdbarch))
 #endif
 #endif
 
-extern int gdbarch_ptr_bit (struct gdbarch *gdbarch);
-extern void set_gdbarch_ptr_bit (struct gdbarch *gdbarch, int ptr_bit);
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_PTR_BIT)
-#define TARGET_PTR_BIT (gdbarch_ptr_bit (current_gdbarch))
-#endif
-#endif
-
-extern int gdbarch_short_bit (struct gdbarch *gdbarch);
-extern void set_gdbarch_short_bit (struct gdbarch *gdbarch, int short_bit);
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_SHORT_BIT)
-#define TARGET_SHORT_BIT (gdbarch_short_bit (current_gdbarch))
-#endif
-#endif
-
-extern int gdbarch_int_bit (struct gdbarch *gdbarch);
-extern void set_gdbarch_int_bit (struct gdbarch *gdbarch, int int_bit);
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_INT_BIT)
-#define TARGET_INT_BIT (gdbarch_int_bit (current_gdbarch))
-#endif
-#endif
-
-extern int gdbarch_long_bit (struct gdbarch *gdbarch);
-extern void set_gdbarch_long_bit (struct gdbarch *gdbarch, int long_bit);
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_LONG_BIT)
-#define TARGET_LONG_BIT (gdbarch_long_bit (current_gdbarch))
-#endif
-#endif
-
-extern int gdbarch_long_long_bit (struct gdbarch *gdbarch);
-extern void set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int long_long_bit);
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_LONG_LONG_BIT)
-#define TARGET_LONG_LONG_BIT (gdbarch_long_long_bit (current_gdbarch))
-#endif
-#endif
-
-extern int gdbarch_float_bit (struct gdbarch *gdbarch);
-extern void set_gdbarch_float_bit (struct gdbarch *gdbarch, int float_bit);
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_FLOAT_BIT)
-#define TARGET_FLOAT_BIT (gdbarch_float_bit (current_gdbarch))
-#endif
-#endif
-
-extern int gdbarch_double_bit (struct gdbarch *gdbarch);
-extern void set_gdbarch_double_bit (struct gdbarch *gdbarch, int double_bit);
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_DOUBLE_BIT)
-#define TARGET_DOUBLE_BIT (gdbarch_double_bit (current_gdbarch))
-#endif
-#endif
-
-extern int gdbarch_long_double_bit (struct gdbarch *gdbarch);
-extern void set_gdbarch_long_double_bit (struct gdbarch *gdbarch, int long_double_bit);
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_LONG_DOUBLE_BIT)
-#define TARGET_LONG_DOUBLE_BIT (gdbarch_long_double_bit (current_gdbarch))
-#endif
-#endif
-
 /* Default (value) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (IEEE_FLOAT)
+#if (!GDB_MULTI_ARCH) && !defined (IEEE_FLOAT)
 #define IEEE_FLOAT (0)
 #endif
 
 extern int gdbarch_ieee_float (struct gdbarch *gdbarch);
 extern void set_gdbarch_ieee_float (struct gdbarch *gdbarch, int ieee_float);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (IEEE_FLOAT)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (IEEE_FLOAT)
 #define IEEE_FLOAT (gdbarch_ieee_float (current_gdbarch))
 #endif
 #endif
 
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_READ_PC)
+#define TARGET_READ_PC(pid) (generic_target_read_pc (pid))
+#endif
+
 typedef CORE_ADDR (gdbarch_read_pc_ftype) (int pid);
 extern CORE_ADDR gdbarch_read_pc (struct gdbarch *gdbarch, int pid);
 extern void set_gdbarch_read_pc (struct gdbarch *gdbarch, gdbarch_read_pc_ftype *read_pc);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_READ_PC)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_READ_PC)
 #define TARGET_READ_PC(pid) (gdbarch_read_pc (current_gdbarch, pid))
 #endif
 #endif
 
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_WRITE_PC)
+#define TARGET_WRITE_PC(val, pid) (generic_target_write_pc (val, pid))
+#endif
+
 typedef void (gdbarch_write_pc_ftype) (CORE_ADDR val, int pid);
 extern void gdbarch_write_pc (struct gdbarch *gdbarch, CORE_ADDR val, int pid);
 extern void set_gdbarch_write_pc (struct gdbarch *gdbarch, gdbarch_write_pc_ftype *write_pc);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_WRITE_PC)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_WRITE_PC)
 #define TARGET_WRITE_PC(val, pid) (gdbarch_write_pc (current_gdbarch, val, pid))
 #endif
 #endif
 
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_READ_FP)
+#define TARGET_READ_FP() (generic_target_read_fp ())
+#endif
+
 typedef CORE_ADDR (gdbarch_read_fp_ftype) (void);
 extern CORE_ADDR gdbarch_read_fp (struct gdbarch *gdbarch);
 extern void set_gdbarch_read_fp (struct gdbarch *gdbarch, gdbarch_read_fp_ftype *read_fp);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_READ_FP)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_READ_FP)
 #define TARGET_READ_FP() (gdbarch_read_fp (current_gdbarch))
 #endif
 #endif
 
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_WRITE_FP)
+#define TARGET_WRITE_FP(val) (generic_target_write_fp (val))
+#endif
+
 typedef void (gdbarch_write_fp_ftype) (CORE_ADDR val);
 extern void gdbarch_write_fp (struct gdbarch *gdbarch, CORE_ADDR val);
 extern void set_gdbarch_write_fp (struct gdbarch *gdbarch, gdbarch_write_fp_ftype *write_fp);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_WRITE_FP)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_WRITE_FP)
 #define TARGET_WRITE_FP(val) (gdbarch_write_fp (current_gdbarch, val))
 #endif
 #endif
 
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_READ_SP)
+#define TARGET_READ_SP() (generic_target_read_sp ())
+#endif
+
 typedef CORE_ADDR (gdbarch_read_sp_ftype) (void);
 extern CORE_ADDR gdbarch_read_sp (struct gdbarch *gdbarch);
 extern void set_gdbarch_read_sp (struct gdbarch *gdbarch, gdbarch_read_sp_ftype *read_sp);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_READ_SP)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_READ_SP)
 #define TARGET_READ_SP() (gdbarch_read_sp (current_gdbarch))
 #endif
 #endif
 
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_WRITE_SP)
+#define TARGET_WRITE_SP(val) (generic_target_write_sp (val))
+#endif
+
 typedef void (gdbarch_write_sp_ftype) (CORE_ADDR val);
 extern void gdbarch_write_sp (struct gdbarch *gdbarch, CORE_ADDR val);
 extern void set_gdbarch_write_sp (struct gdbarch *gdbarch, gdbarch_write_sp_ftype *write_sp);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_WRITE_SP)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_WRITE_SP)
 #define TARGET_WRITE_SP(val) (gdbarch_write_sp (current_gdbarch, val))
 #endif
 #endif
@@ -234,15 +342,33 @@
 extern int gdbarch_num_regs (struct gdbarch *gdbarch);
 extern void set_gdbarch_num_regs (struct gdbarch *gdbarch, int num_regs);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (NUM_REGS)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (NUM_REGS)
 #define NUM_REGS (gdbarch_num_regs (current_gdbarch))
 #endif
 #endif
 
+/* This macro gives the number of pseudo-registers that live in the
+   register namespace but do not get fetched or stored on the target.
+   These pseudo-registers may be aliases for other registers,
+   combinations of other registers, or they may be computed by GDB. */
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (NUM_PSEUDO_REGS)
+#define NUM_PSEUDO_REGS (0)
+#endif
+
+extern int gdbarch_num_pseudo_regs (struct gdbarch *gdbarch);
+extern void set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch, int num_pseudo_regs);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (NUM_PSEUDO_REGS)
+#define NUM_PSEUDO_REGS (gdbarch_num_pseudo_regs (current_gdbarch))
+#endif
+#endif
+
 extern int gdbarch_sp_regnum (struct gdbarch *gdbarch);
 extern void set_gdbarch_sp_regnum (struct gdbarch *gdbarch, int sp_regnum);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (SP_REGNUM)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SP_REGNUM)
 #define SP_REGNUM (gdbarch_sp_regnum (current_gdbarch))
 #endif
 #endif
@@ -250,7 +376,7 @@
 extern int gdbarch_fp_regnum (struct gdbarch *gdbarch);
 extern void set_gdbarch_fp_regnum (struct gdbarch *gdbarch, int fp_regnum);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (FP_REGNUM)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FP_REGNUM)
 #define FP_REGNUM (gdbarch_fp_regnum (current_gdbarch))
 #endif
 #endif
@@ -258,52 +384,132 @@
 extern int gdbarch_pc_regnum (struct gdbarch *gdbarch);
 extern void set_gdbarch_pc_regnum (struct gdbarch *gdbarch, int pc_regnum);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (PC_REGNUM)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PC_REGNUM)
 #define PC_REGNUM (gdbarch_pc_regnum (current_gdbarch))
 #endif
 #endif
 
 /* Default (value) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (FP0_REGNUM)
+#if (!GDB_MULTI_ARCH) && !defined (FP0_REGNUM)
 #define FP0_REGNUM (-1)
 #endif
 
 extern int gdbarch_fp0_regnum (struct gdbarch *gdbarch);
 extern void set_gdbarch_fp0_regnum (struct gdbarch *gdbarch, int fp0_regnum);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (FP0_REGNUM)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FP0_REGNUM)
 #define FP0_REGNUM (gdbarch_fp0_regnum (current_gdbarch))
 #endif
 #endif
 
 /* Default (value) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (NPC_REGNUM)
+#if (!GDB_MULTI_ARCH) && !defined (NPC_REGNUM)
 #define NPC_REGNUM (-1)
 #endif
 
 extern int gdbarch_npc_regnum (struct gdbarch *gdbarch);
 extern void set_gdbarch_npc_regnum (struct gdbarch *gdbarch, int npc_regnum);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (NPC_REGNUM)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (NPC_REGNUM)
 #define NPC_REGNUM (gdbarch_npc_regnum (current_gdbarch))
 #endif
 #endif
 
 /* Default (value) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (NNPC_REGNUM)
+#if (!GDB_MULTI_ARCH) && !defined (NNPC_REGNUM)
 #define NNPC_REGNUM (-1)
 #endif
 
 extern int gdbarch_nnpc_regnum (struct gdbarch *gdbarch);
 extern void set_gdbarch_nnpc_regnum (struct gdbarch *gdbarch, int nnpc_regnum);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (NNPC_REGNUM)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (NNPC_REGNUM)
 #define NNPC_REGNUM (gdbarch_nnpc_regnum (current_gdbarch))
 #endif
 #endif
 
+/* Convert stab register number (from `r' declaration) to a gdb REGNUM. */
+
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (REGISTER_NAME)
+#if (!GDB_MULTI_ARCH) && !defined (STAB_REG_TO_REGNUM)
+#define STAB_REG_TO_REGNUM(stab_regnr) (no_op_reg_to_regnum (stab_regnr))
+#endif
+
+typedef int (gdbarch_stab_reg_to_regnum_ftype) (int stab_regnr);
+extern int gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, int stab_regnr);
+extern void set_gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (STAB_REG_TO_REGNUM)
+#define STAB_REG_TO_REGNUM(stab_regnr) (gdbarch_stab_reg_to_regnum (current_gdbarch, stab_regnr))
+#endif
+#endif
+
+/* Provide a default mapping from a ecoff register number to a gdb REGNUM. */
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (ECOFF_REG_TO_REGNUM)
+#define ECOFF_REG_TO_REGNUM(ecoff_regnr) (no_op_reg_to_regnum (ecoff_regnr))
+#endif
+
+typedef int (gdbarch_ecoff_reg_to_regnum_ftype) (int ecoff_regnr);
+extern int gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, int ecoff_regnr);
+extern void set_gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (ECOFF_REG_TO_REGNUM)
+#define ECOFF_REG_TO_REGNUM(ecoff_regnr) (gdbarch_ecoff_reg_to_regnum (current_gdbarch, ecoff_regnr))
+#endif
+#endif
+
+/* Provide a default mapping from a DWARF register number to a gdb REGNUM. */
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DWARF_REG_TO_REGNUM)
+#define DWARF_REG_TO_REGNUM(dwarf_regnr) (no_op_reg_to_regnum (dwarf_regnr))
+#endif
+
+typedef int (gdbarch_dwarf_reg_to_regnum_ftype) (int dwarf_regnr);
+extern int gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int dwarf_regnr);
+extern void set_gdbarch_dwarf_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_dwarf_reg_to_regnum_ftype *dwarf_reg_to_regnum);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DWARF_REG_TO_REGNUM)
+#define DWARF_REG_TO_REGNUM(dwarf_regnr) (gdbarch_dwarf_reg_to_regnum (current_gdbarch, dwarf_regnr))
+#endif
+#endif
+
+/* Convert from an sdb register number to an internal gdb register number.
+   This should be defined in tm.h, if REGISTER_NAMES is not set up
+   to map one to one onto the sdb register numbers. */
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (SDB_REG_TO_REGNUM)
+#define SDB_REG_TO_REGNUM(sdb_regnr) (no_op_reg_to_regnum (sdb_regnr))
+#endif
+
+typedef int (gdbarch_sdb_reg_to_regnum_ftype) (int sdb_regnr);
+extern int gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, int sdb_regnr);
+extern void set_gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SDB_REG_TO_REGNUM)
+#define SDB_REG_TO_REGNUM(sdb_regnr) (gdbarch_sdb_reg_to_regnum (current_gdbarch, sdb_regnr))
+#endif
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DWARF2_REG_TO_REGNUM)
+#define DWARF2_REG_TO_REGNUM(dwarf2_regnr) (no_op_reg_to_regnum (dwarf2_regnr))
+#endif
+
+typedef int (gdbarch_dwarf2_reg_to_regnum_ftype) (int dwarf2_regnr);
+extern int gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2_regnr);
+extern void set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DWARF2_REG_TO_REGNUM)
+#define DWARF2_REG_TO_REGNUM(dwarf2_regnr) (gdbarch_dwarf2_reg_to_regnum (current_gdbarch, dwarf2_regnr))
+#endif
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_NAME)
 #define REGISTER_NAME(regnr) (legacy_register_name (regnr))
 #endif
 
@@ -311,7 +517,7 @@
 extern char * gdbarch_register_name (struct gdbarch *gdbarch, int regnr);
 extern void set_gdbarch_register_name (struct gdbarch *gdbarch, gdbarch_register_name_ftype *register_name);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_NAME)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_NAME)
 #define REGISTER_NAME(regnr) (gdbarch_register_name (current_gdbarch, regnr))
 #endif
 #endif
@@ -319,7 +525,7 @@
 extern int gdbarch_register_size (struct gdbarch *gdbarch);
 extern void set_gdbarch_register_size (struct gdbarch *gdbarch, int register_size);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_SIZE)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_SIZE)
 #define REGISTER_SIZE (gdbarch_register_size (current_gdbarch))
 #endif
 #endif
@@ -327,7 +533,7 @@
 extern int gdbarch_register_bytes (struct gdbarch *gdbarch);
 extern void set_gdbarch_register_bytes (struct gdbarch *gdbarch, int register_bytes);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_BYTES)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_BYTES)
 #define REGISTER_BYTES (gdbarch_register_bytes (current_gdbarch))
 #endif
 #endif
@@ -336,7 +542,7 @@
 extern int gdbarch_register_byte (struct gdbarch *gdbarch, int reg_nr);
 extern void set_gdbarch_register_byte (struct gdbarch *gdbarch, gdbarch_register_byte_ftype *register_byte);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_BYTE)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_BYTE)
 #define REGISTER_BYTE(reg_nr) (gdbarch_register_byte (current_gdbarch, reg_nr))
 #endif
 #endif
@@ -345,7 +551,7 @@
 extern int gdbarch_register_raw_size (struct gdbarch *gdbarch, int reg_nr);
 extern void set_gdbarch_register_raw_size (struct gdbarch *gdbarch, gdbarch_register_raw_size_ftype *register_raw_size);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_RAW_SIZE)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_RAW_SIZE)
 #define REGISTER_RAW_SIZE(reg_nr) (gdbarch_register_raw_size (current_gdbarch, reg_nr))
 #endif
 #endif
@@ -353,7 +559,7 @@
 extern int gdbarch_max_register_raw_size (struct gdbarch *gdbarch);
 extern void set_gdbarch_max_register_raw_size (struct gdbarch *gdbarch, int max_register_raw_size);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (MAX_REGISTER_RAW_SIZE)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (MAX_REGISTER_RAW_SIZE)
 #define MAX_REGISTER_RAW_SIZE (gdbarch_max_register_raw_size (current_gdbarch))
 #endif
 #endif
@@ -362,7 +568,7 @@
 extern int gdbarch_register_virtual_size (struct gdbarch *gdbarch, int reg_nr);
 extern void set_gdbarch_register_virtual_size (struct gdbarch *gdbarch, gdbarch_register_virtual_size_ftype *register_virtual_size);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_VIRTUAL_SIZE)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_VIRTUAL_SIZE)
 #define REGISTER_VIRTUAL_SIZE(reg_nr) (gdbarch_register_virtual_size (current_gdbarch, reg_nr))
 #endif
 #endif
@@ -370,7 +576,7 @@
 extern int gdbarch_max_register_virtual_size (struct gdbarch *gdbarch);
 extern void set_gdbarch_max_register_virtual_size (struct gdbarch *gdbarch, int max_register_virtual_size);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (MAX_REGISTER_VIRTUAL_SIZE)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (MAX_REGISTER_VIRTUAL_SIZE)
 #define MAX_REGISTER_VIRTUAL_SIZE (gdbarch_max_register_virtual_size (current_gdbarch))
 #endif
 #endif
@@ -379,15 +585,75 @@
 extern struct type * gdbarch_register_virtual_type (struct gdbarch *gdbarch, int reg_nr);
 extern void set_gdbarch_register_virtual_type (struct gdbarch *gdbarch, gdbarch_register_virtual_type_ftype *register_virtual_type);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_VIRTUAL_TYPE)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_VIRTUAL_TYPE)
 #define REGISTER_VIRTUAL_TYPE(reg_nr) (gdbarch_register_virtual_type (current_gdbarch, reg_nr))
 #endif
 #endif
 
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DO_REGISTERS_INFO)
+#define DO_REGISTERS_INFO(reg_nr, fpregs) (do_registers_info (reg_nr, fpregs))
+#endif
+
+typedef void (gdbarch_do_registers_info_ftype) (int reg_nr, int fpregs);
+extern void gdbarch_do_registers_info (struct gdbarch *gdbarch, int reg_nr, int fpregs);
+extern void set_gdbarch_do_registers_info (struct gdbarch *gdbarch, gdbarch_do_registers_info_ftype *do_registers_info);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DO_REGISTERS_INFO)
+#define DO_REGISTERS_INFO(reg_nr, fpregs) (gdbarch_do_registers_info (current_gdbarch, reg_nr, fpregs))
+#endif
+#endif
+
+/* MAP a GDB RAW register number onto a simulator register number.  See
+   also include/...-sim.h. */
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_SIM_REGNO)
+#define REGISTER_SIM_REGNO(reg_nr) (default_register_sim_regno (reg_nr))
+#endif
+
+typedef int (gdbarch_register_sim_regno_ftype) (int reg_nr);
+extern int gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr);
+extern void set_gdbarch_register_sim_regno (struct gdbarch *gdbarch, gdbarch_register_sim_regno_ftype *register_sim_regno);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_SIM_REGNO)
+#define REGISTER_SIM_REGNO(reg_nr) (gdbarch_register_sim_regno (current_gdbarch, reg_nr))
+#endif
+#endif
+
+#if defined (REGISTER_BYTES_OK)
+/* Legacy for systems yet to multi-arch REGISTER_BYTES_OK */
+#define REGISTER_BYTES_OK_P() (1)
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_BYTES_OK_P)
+#define REGISTER_BYTES_OK_P() (0)
+#endif
+
+extern int gdbarch_register_bytes_ok_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_BYTES_OK_P)
+#define REGISTER_BYTES_OK_P() (gdbarch_register_bytes_ok_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_BYTES_OK)
+#define REGISTER_BYTES_OK(nr_bytes) (internal_error ("REGISTER_BYTES_OK"), 0)
+#endif
+
+typedef int (gdbarch_register_bytes_ok_ftype) (long nr_bytes);
+extern int gdbarch_register_bytes_ok (struct gdbarch *gdbarch, long nr_bytes);
+extern void set_gdbarch_register_bytes_ok (struct gdbarch *gdbarch, gdbarch_register_bytes_ok_ftype *register_bytes_ok);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_BYTES_OK)
+#define REGISTER_BYTES_OK(nr_bytes) (gdbarch_register_bytes_ok (current_gdbarch, nr_bytes))
+#endif
+#endif
+
 extern int gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch);
 extern void set_gdbarch_use_generic_dummy_frames (struct gdbarch *gdbarch, int use_generic_dummy_frames);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (USE_GENERIC_DUMMY_FRAMES)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (USE_GENERIC_DUMMY_FRAMES)
 #define USE_GENERIC_DUMMY_FRAMES (gdbarch_use_generic_dummy_frames (current_gdbarch))
 #endif
 #endif
@@ -395,7 +661,7 @@
 extern int gdbarch_call_dummy_location (struct gdbarch *gdbarch);
 extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, int call_dummy_location);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_LOCATION)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_LOCATION)
 #define CALL_DUMMY_LOCATION (gdbarch_call_dummy_location (current_gdbarch))
 #endif
 #endif
@@ -404,7 +670,7 @@
 extern CORE_ADDR gdbarch_call_dummy_address (struct gdbarch *gdbarch);
 extern void set_gdbarch_call_dummy_address (struct gdbarch *gdbarch, gdbarch_call_dummy_address_ftype *call_dummy_address);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_ADDRESS)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_ADDRESS)
 #define CALL_DUMMY_ADDRESS() (gdbarch_call_dummy_address (current_gdbarch))
 #endif
 #endif
@@ -412,7 +678,7 @@
 extern CORE_ADDR gdbarch_call_dummy_start_offset (struct gdbarch *gdbarch);
 extern void set_gdbarch_call_dummy_start_offset (struct gdbarch *gdbarch, CORE_ADDR call_dummy_start_offset);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_START_OFFSET)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_START_OFFSET)
 #define CALL_DUMMY_START_OFFSET (gdbarch_call_dummy_start_offset (current_gdbarch))
 #endif
 #endif
@@ -420,7 +686,7 @@
 extern CORE_ADDR gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch);
 extern void set_gdbarch_call_dummy_breakpoint_offset (struct gdbarch *gdbarch, CORE_ADDR call_dummy_breakpoint_offset);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_BREAKPOINT_OFFSET)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_BREAKPOINT_OFFSET)
 #define CALL_DUMMY_BREAKPOINT_OFFSET (gdbarch_call_dummy_breakpoint_offset (current_gdbarch))
 #endif
 #endif
@@ -428,7 +694,7 @@
 extern int gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch);
 extern void set_gdbarch_call_dummy_breakpoint_offset_p (struct gdbarch *gdbarch, int call_dummy_breakpoint_offset_p);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_BREAKPOINT_OFFSET_P)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_BREAKPOINT_OFFSET_P)
 #define CALL_DUMMY_BREAKPOINT_OFFSET_P (gdbarch_call_dummy_breakpoint_offset_p (current_gdbarch))
 #endif
 #endif
@@ -436,7 +702,7 @@
 extern int gdbarch_call_dummy_length (struct gdbarch *gdbarch);
 extern void set_gdbarch_call_dummy_length (struct gdbarch *gdbarch, int call_dummy_length);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_LENGTH)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_LENGTH)
 #define CALL_DUMMY_LENGTH (gdbarch_call_dummy_length (current_gdbarch))
 #endif
 #endif
@@ -445,7 +711,7 @@
 extern int gdbarch_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address);
 extern void set_gdbarch_pc_in_call_dummy (struct gdbarch *gdbarch, gdbarch_pc_in_call_dummy_ftype *pc_in_call_dummy);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (PC_IN_CALL_DUMMY)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PC_IN_CALL_DUMMY)
 #define PC_IN_CALL_DUMMY(pc, sp, frame_address) (gdbarch_pc_in_call_dummy (current_gdbarch, pc, sp, frame_address))
 #endif
 #endif
@@ -453,33 +719,33 @@
 extern int gdbarch_call_dummy_p (struct gdbarch *gdbarch);
 extern void set_gdbarch_call_dummy_p (struct gdbarch *gdbarch, int call_dummy_p);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_P)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_P)
 #define CALL_DUMMY_P (gdbarch_call_dummy_p (current_gdbarch))
 #endif
 #endif
 
 /* Default (value) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (CALL_DUMMY_WORDS)
+#if (!GDB_MULTI_ARCH) && !defined (CALL_DUMMY_WORDS)
 #define CALL_DUMMY_WORDS (legacy_call_dummy_words)
 #endif
 
 extern LONGEST * gdbarch_call_dummy_words (struct gdbarch *gdbarch);
 extern void set_gdbarch_call_dummy_words (struct gdbarch *gdbarch, LONGEST * call_dummy_words);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_WORDS)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_WORDS)
 #define CALL_DUMMY_WORDS (gdbarch_call_dummy_words (current_gdbarch))
 #endif
 #endif
 
 /* Default (value) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (SIZEOF_CALL_DUMMY_WORDS)
+#if (!GDB_MULTI_ARCH) && !defined (SIZEOF_CALL_DUMMY_WORDS)
 #define SIZEOF_CALL_DUMMY_WORDS (legacy_sizeof_call_dummy_words)
 #endif
 
 extern int gdbarch_sizeof_call_dummy_words (struct gdbarch *gdbarch);
 extern void set_gdbarch_sizeof_call_dummy_words (struct gdbarch *gdbarch, int sizeof_call_dummy_words);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (SIZEOF_CALL_DUMMY_WORDS)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SIZEOF_CALL_DUMMY_WORDS)
 #define SIZEOF_CALL_DUMMY_WORDS (gdbarch_sizeof_call_dummy_words (current_gdbarch))
 #endif
 #endif
@@ -487,7 +753,7 @@
 extern int gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch);
 extern void set_gdbarch_call_dummy_stack_adjust_p (struct gdbarch *gdbarch, int call_dummy_stack_adjust_p);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_STACK_ADJUST_P)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_STACK_ADJUST_P)
 #define CALL_DUMMY_STACK_ADJUST_P (gdbarch_call_dummy_stack_adjust_p (current_gdbarch))
 #endif
 #endif
@@ -495,7 +761,7 @@
 extern int gdbarch_call_dummy_stack_adjust (struct gdbarch *gdbarch);
 extern void set_gdbarch_call_dummy_stack_adjust (struct gdbarch *gdbarch, int call_dummy_stack_adjust);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (CALL_DUMMY_STACK_ADJUST)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CALL_DUMMY_STACK_ADJUST)
 #define CALL_DUMMY_STACK_ADJUST (gdbarch_call_dummy_stack_adjust (current_gdbarch))
 #endif
 #endif
@@ -504,7 +770,7 @@
 extern void gdbarch_fix_call_dummy (struct gdbarch *gdbarch, char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p);
 extern void set_gdbarch_fix_call_dummy (struct gdbarch *gdbarch, gdbarch_fix_call_dummy_ftype *fix_call_dummy);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (FIX_CALL_DUMMY)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FIX_CALL_DUMMY)
 #define FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p) (gdbarch_fix_call_dummy (current_gdbarch, dummy, pc, fun, nargs, args, type, gcc_p))
 #endif
 #endif
@@ -512,7 +778,7 @@
 extern int gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch);
 extern void set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch, int believe_pcc_promotion);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (BELIEVE_PCC_PROMOTION)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (BELIEVE_PCC_PROMOTION)
 #define BELIEVE_PCC_PROMOTION (gdbarch_believe_pcc_promotion (current_gdbarch))
 #endif
 #endif
@@ -520,13 +786,13 @@
 extern int gdbarch_believe_pcc_promotion_type (struct gdbarch *gdbarch);
 extern void set_gdbarch_believe_pcc_promotion_type (struct gdbarch *gdbarch, int believe_pcc_promotion_type);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (BELIEVE_PCC_PROMOTION_TYPE)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (BELIEVE_PCC_PROMOTION_TYPE)
 #define BELIEVE_PCC_PROMOTION_TYPE (gdbarch_believe_pcc_promotion_type (current_gdbarch))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (COERCE_FLOAT_TO_DOUBLE)
+#if (!GDB_MULTI_ARCH) && !defined (COERCE_FLOAT_TO_DOUBLE)
 #define COERCE_FLOAT_TO_DOUBLE(formal, actual) (default_coerce_float_to_double (formal, actual))
 #endif
 
@@ -534,7 +800,7 @@
 extern int gdbarch_coerce_float_to_double (struct gdbarch *gdbarch, struct type *formal, struct type *actual);
 extern void set_gdbarch_coerce_float_to_double (struct gdbarch *gdbarch, gdbarch_coerce_float_to_double_ftype *coerce_float_to_double);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (COERCE_FLOAT_TO_DOUBLE)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (COERCE_FLOAT_TO_DOUBLE)
 #define COERCE_FLOAT_TO_DOUBLE(formal, actual) (gdbarch_coerce_float_to_double (current_gdbarch, formal, actual))
 #endif
 #endif
@@ -543,13 +809,13 @@
 extern void gdbarch_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval);
 extern void set_gdbarch_get_saved_register (struct gdbarch *gdbarch, gdbarch_get_saved_register_ftype *get_saved_register);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (GET_SAVED_REGISTER)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (GET_SAVED_REGISTER)
 #define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (gdbarch_get_saved_register (current_gdbarch, raw_buffer, optimized, addrp, frame, regnum, lval))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (REGISTER_CONVERTIBLE)
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_CONVERTIBLE)
 #define REGISTER_CONVERTIBLE(nr) (generic_register_convertible_not (nr))
 #endif
 
@@ -557,13 +823,13 @@
 extern int gdbarch_register_convertible (struct gdbarch *gdbarch, int nr);
 extern void set_gdbarch_register_convertible (struct gdbarch *gdbarch, gdbarch_register_convertible_ftype *register_convertible);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_CONVERTIBLE)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_CONVERTIBLE)
 #define REGISTER_CONVERTIBLE(nr) (gdbarch_register_convertible (current_gdbarch, nr))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (REGISTER_CONVERT_TO_VIRTUAL)
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_CONVERT_TO_VIRTUAL)
 #define REGISTER_CONVERT_TO_VIRTUAL(regnum, type, from, to) (internal_error ("REGISTER_CONVERT_TO_VIRTUAL"), 0)
 #endif
 
@@ -571,13 +837,13 @@
 extern void gdbarch_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum, struct type *type, char *from, char *to);
 extern void set_gdbarch_register_convert_to_virtual (struct gdbarch *gdbarch, gdbarch_register_convert_to_virtual_ftype *register_convert_to_virtual);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_CONVERT_TO_VIRTUAL)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_CONVERT_TO_VIRTUAL)
 #define REGISTER_CONVERT_TO_VIRTUAL(regnum, type, from, to) (gdbarch_register_convert_to_virtual (current_gdbarch, regnum, type, from, to))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (REGISTER_CONVERT_TO_RAW)
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_CONVERT_TO_RAW)
 #define REGISTER_CONVERT_TO_RAW(type, regnum, from, to) (internal_error ("REGISTER_CONVERT_TO_RAW"), 0)
 #endif
 
@@ -585,13 +851,49 @@
 extern void gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type, int regnum, char *from, char *to);
 extern void set_gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, gdbarch_register_convert_to_raw_ftype *register_convert_to_raw);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (REGISTER_CONVERT_TO_RAW)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_CONVERT_TO_RAW)
 #define REGISTER_CONVERT_TO_RAW(type, regnum, from, to) (gdbarch_register_convert_to_raw (current_gdbarch, type, regnum, from, to))
 #endif
 #endif
 
+/* This function is called when the value of a pseudo-register needs to
+   be updated.  Typically it will be defined on a per-architecture
+   basis. */
+
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (POINTER_TO_ADDRESS)
+#if (!GDB_MULTI_ARCH) && !defined (FETCH_PSEUDO_REGISTER)
+#define FETCH_PSEUDO_REGISTER(regnum) (internal_error ("FETCH_PSEUDO_REGISTER"), 0)
+#endif
+
+typedef void (gdbarch_fetch_pseudo_register_ftype) (int regnum);
+extern void gdbarch_fetch_pseudo_register (struct gdbarch *gdbarch, int regnum);
+extern void set_gdbarch_fetch_pseudo_register (struct gdbarch *gdbarch, gdbarch_fetch_pseudo_register_ftype *fetch_pseudo_register);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FETCH_PSEUDO_REGISTER)
+#define FETCH_PSEUDO_REGISTER(regnum) (gdbarch_fetch_pseudo_register (current_gdbarch, regnum))
+#endif
+#endif
+
+/* This function is called when the value of a pseudo-register needs to
+   be set or stored.  Typically it will be defined on a
+   per-architecture basis. */
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (STORE_PSEUDO_REGISTER)
+#define STORE_PSEUDO_REGISTER(regnum) (internal_error ("STORE_PSEUDO_REGISTER"), 0)
+#endif
+
+typedef void (gdbarch_store_pseudo_register_ftype) (int regnum);
+extern void gdbarch_store_pseudo_register (struct gdbarch *gdbarch, int regnum);
+extern void set_gdbarch_store_pseudo_register (struct gdbarch *gdbarch, gdbarch_store_pseudo_register_ftype *store_pseudo_register);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (STORE_PSEUDO_REGISTER)
+#define STORE_PSEUDO_REGISTER(regnum) (gdbarch_store_pseudo_register (current_gdbarch, regnum))
+#endif
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (POINTER_TO_ADDRESS)
 #define POINTER_TO_ADDRESS(type, buf) (unsigned_pointer_to_address (type, buf))
 #endif
 
@@ -599,13 +901,13 @@
 extern CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, void *buf);
 extern void set_gdbarch_pointer_to_address (struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype *pointer_to_address);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (POINTER_TO_ADDRESS)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (POINTER_TO_ADDRESS)
 #define POINTER_TO_ADDRESS(type, buf) (gdbarch_pointer_to_address (current_gdbarch, type, buf))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (ADDRESS_TO_POINTER)
+#if (!GDB_MULTI_ARCH) && !defined (ADDRESS_TO_POINTER)
 #define ADDRESS_TO_POINTER(type, buf, addr) (unsigned_address_to_pointer (type, buf, addr))
 #endif
 
@@ -613,13 +915,13 @@
 extern void gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, void *buf, CORE_ADDR addr);
 extern void set_gdbarch_address_to_pointer (struct gdbarch *gdbarch, gdbarch_address_to_pointer_ftype *address_to_pointer);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (ADDRESS_TO_POINTER)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (ADDRESS_TO_POINTER)
 #define ADDRESS_TO_POINTER(type, buf, addr) (gdbarch_address_to_pointer (current_gdbarch, type, buf, addr))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (RETURN_VALUE_ON_STACK)
+#if (!GDB_MULTI_ARCH) && !defined (RETURN_VALUE_ON_STACK)
 #define RETURN_VALUE_ON_STACK(type) (generic_return_value_on_stack_not (type))
 #endif
 
@@ -627,7 +929,7 @@
 extern int gdbarch_return_value_on_stack (struct gdbarch *gdbarch, struct type *type);
 extern void set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch, gdbarch_return_value_on_stack_ftype *return_value_on_stack);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (RETURN_VALUE_ON_STACK)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (RETURN_VALUE_ON_STACK)
 #define RETURN_VALUE_ON_STACK(type) (gdbarch_return_value_on_stack (current_gdbarch, type))
 #endif
 #endif
@@ -636,7 +938,7 @@
 extern void gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf);
 extern void set_gdbarch_extract_return_value (struct gdbarch *gdbarch, gdbarch_extract_return_value_ftype *extract_return_value);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (EXTRACT_RETURN_VALUE)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (EXTRACT_RETURN_VALUE)
 #define EXTRACT_RETURN_VALUE(type, regbuf, valbuf) (gdbarch_extract_return_value (current_gdbarch, type, regbuf, valbuf))
 #endif
 #endif
@@ -645,7 +947,7 @@
 extern CORE_ADDR gdbarch_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr);
 extern void set_gdbarch_push_arguments (struct gdbarch *gdbarch, gdbarch_push_arguments_ftype *push_arguments);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (PUSH_ARGUMENTS)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_ARGUMENTS)
 #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (gdbarch_push_arguments (current_gdbarch, nargs, args, sp, struct_return, struct_addr))
 #endif
 #endif
@@ -654,7 +956,7 @@
 extern void gdbarch_push_dummy_frame (struct gdbarch *gdbarch);
 extern void set_gdbarch_push_dummy_frame (struct gdbarch *gdbarch, gdbarch_push_dummy_frame_ftype *push_dummy_frame);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (PUSH_DUMMY_FRAME)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_DUMMY_FRAME)
 #define PUSH_DUMMY_FRAME (gdbarch_push_dummy_frame (current_gdbarch))
 #endif
 #endif
@@ -663,7 +965,7 @@
 extern CORE_ADDR gdbarch_push_return_address (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR sp);
 extern void set_gdbarch_push_return_address (struct gdbarch *gdbarch, gdbarch_push_return_address_ftype *push_return_address);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (PUSH_RETURN_ADDRESS)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_RETURN_ADDRESS)
 #define PUSH_RETURN_ADDRESS(pc, sp) (gdbarch_push_return_address (current_gdbarch, pc, sp))
 #endif
 #endif
@@ -672,13 +974,15 @@
 extern void gdbarch_pop_frame (struct gdbarch *gdbarch);
 extern void set_gdbarch_pop_frame (struct gdbarch *gdbarch, gdbarch_pop_frame_ftype *pop_frame);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (POP_FRAME)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (POP_FRAME)
 #define POP_FRAME (gdbarch_pop_frame (current_gdbarch))
 #endif
 #endif
 
+/* I wish that these would just go away.... */
+
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (D10V_MAKE_DADDR)
+#if (!GDB_MULTI_ARCH) && !defined (D10V_MAKE_DADDR)
 #define D10V_MAKE_DADDR(x) (internal_error ("D10V_MAKE_DADDR"), 0)
 #endif
 
@@ -686,13 +990,13 @@
 extern CORE_ADDR gdbarch_d10v_make_daddr (struct gdbarch *gdbarch, CORE_ADDR x);
 extern void set_gdbarch_d10v_make_daddr (struct gdbarch *gdbarch, gdbarch_d10v_make_daddr_ftype *d10v_make_daddr);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (D10V_MAKE_DADDR)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (D10V_MAKE_DADDR)
 #define D10V_MAKE_DADDR(x) (gdbarch_d10v_make_daddr (current_gdbarch, x))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (D10V_MAKE_IADDR)
+#if (!GDB_MULTI_ARCH) && !defined (D10V_MAKE_IADDR)
 #define D10V_MAKE_IADDR(x) (internal_error ("D10V_MAKE_IADDR"), 0)
 #endif
 
@@ -700,13 +1004,13 @@
 extern CORE_ADDR gdbarch_d10v_make_iaddr (struct gdbarch *gdbarch, CORE_ADDR x);
 extern void set_gdbarch_d10v_make_iaddr (struct gdbarch *gdbarch, gdbarch_d10v_make_iaddr_ftype *d10v_make_iaddr);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (D10V_MAKE_IADDR)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (D10V_MAKE_IADDR)
 #define D10V_MAKE_IADDR(x) (gdbarch_d10v_make_iaddr (current_gdbarch, x))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (D10V_DADDR_P)
+#if (!GDB_MULTI_ARCH) && !defined (D10V_DADDR_P)
 #define D10V_DADDR_P(x) (internal_error ("D10V_DADDR_P"), 0)
 #endif
 
@@ -714,13 +1018,13 @@
 extern int gdbarch_d10v_daddr_p (struct gdbarch *gdbarch, CORE_ADDR x);
 extern void set_gdbarch_d10v_daddr_p (struct gdbarch *gdbarch, gdbarch_d10v_daddr_p_ftype *d10v_daddr_p);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (D10V_DADDR_P)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (D10V_DADDR_P)
 #define D10V_DADDR_P(x) (gdbarch_d10v_daddr_p (current_gdbarch, x))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (D10V_IADDR_P)
+#if (!GDB_MULTI_ARCH) && !defined (D10V_IADDR_P)
 #define D10V_IADDR_P(x) (internal_error ("D10V_IADDR_P"), 0)
 #endif
 
@@ -728,13 +1032,13 @@
 extern int gdbarch_d10v_iaddr_p (struct gdbarch *gdbarch, CORE_ADDR x);
 extern void set_gdbarch_d10v_iaddr_p (struct gdbarch *gdbarch, gdbarch_d10v_iaddr_p_ftype *d10v_iaddr_p);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (D10V_IADDR_P)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (D10V_IADDR_P)
 #define D10V_IADDR_P(x) (gdbarch_d10v_iaddr_p (current_gdbarch, x))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (D10V_CONVERT_DADDR_TO_RAW)
+#if (!GDB_MULTI_ARCH) && !defined (D10V_CONVERT_DADDR_TO_RAW)
 #define D10V_CONVERT_DADDR_TO_RAW(x) (internal_error ("D10V_CONVERT_DADDR_TO_RAW"), 0)
 #endif
 
@@ -742,13 +1046,13 @@
 extern CORE_ADDR gdbarch_d10v_convert_daddr_to_raw (struct gdbarch *gdbarch, CORE_ADDR x);
 extern void set_gdbarch_d10v_convert_daddr_to_raw (struct gdbarch *gdbarch, gdbarch_d10v_convert_daddr_to_raw_ftype *d10v_convert_daddr_to_raw);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (D10V_CONVERT_DADDR_TO_RAW)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (D10V_CONVERT_DADDR_TO_RAW)
 #define D10V_CONVERT_DADDR_TO_RAW(x) (gdbarch_d10v_convert_daddr_to_raw (current_gdbarch, x))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (D10V_CONVERT_IADDR_TO_RAW)
+#if (!GDB_MULTI_ARCH) && !defined (D10V_CONVERT_IADDR_TO_RAW)
 #define D10V_CONVERT_IADDR_TO_RAW(x) (internal_error ("D10V_CONVERT_IADDR_TO_RAW"), 0)
 #endif
 
@@ -756,7 +1060,7 @@
 extern CORE_ADDR gdbarch_d10v_convert_iaddr_to_raw (struct gdbarch *gdbarch, CORE_ADDR x);
 extern void set_gdbarch_d10v_convert_iaddr_to_raw (struct gdbarch *gdbarch, gdbarch_d10v_convert_iaddr_to_raw_ftype *d10v_convert_iaddr_to_raw);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (D10V_CONVERT_IADDR_TO_RAW)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (D10V_CONVERT_IADDR_TO_RAW)
 #define D10V_CONVERT_IADDR_TO_RAW(x) (gdbarch_d10v_convert_iaddr_to_raw (current_gdbarch, x))
 #endif
 #endif
@@ -765,7 +1069,7 @@
 extern void gdbarch_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp);
 extern void set_gdbarch_store_struct_return (struct gdbarch *gdbarch, gdbarch_store_struct_return_ftype *store_struct_return);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (STORE_STRUCT_RETURN)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (STORE_STRUCT_RETURN)
 #define STORE_STRUCT_RETURN(addr, sp) (gdbarch_store_struct_return (current_gdbarch, addr, sp))
 #endif
 #endif
@@ -774,7 +1078,7 @@
 extern void gdbarch_store_return_value (struct gdbarch *gdbarch, struct type *type, char *valbuf);
 extern void set_gdbarch_store_return_value (struct gdbarch *gdbarch, gdbarch_store_return_value_ftype *store_return_value);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (STORE_RETURN_VALUE)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (STORE_RETURN_VALUE)
 #define STORE_RETURN_VALUE(type, valbuf) (gdbarch_store_return_value (current_gdbarch, type, valbuf))
 #endif
 #endif
@@ -783,7 +1087,7 @@
 extern CORE_ADDR gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, char *regbuf);
 extern void set_gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, gdbarch_extract_struct_value_address_ftype *extract_struct_value_address);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (EXTRACT_STRUCT_VALUE_ADDRESS)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (EXTRACT_STRUCT_VALUE_ADDRESS)
 #define EXTRACT_STRUCT_VALUE_ADDRESS(regbuf) (gdbarch_extract_struct_value_address (current_gdbarch, regbuf))
 #endif
 #endif
@@ -792,7 +1096,7 @@
 extern int gdbarch_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type);
 extern void set_gdbarch_use_struct_convention (struct gdbarch *gdbarch, gdbarch_use_struct_convention_ftype *use_struct_convention);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (USE_STRUCT_CONVENTION)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (USE_STRUCT_CONVENTION)
 #define USE_STRUCT_CONVENTION(gcc_p, value_type) (gdbarch_use_struct_convention (current_gdbarch, gcc_p, value_type))
 #endif
 #endif
@@ -801,7 +1105,7 @@
 extern void gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch, struct frame_info *frame);
 extern void set_gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch, gdbarch_frame_init_saved_regs_ftype *frame_init_saved_regs);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_INIT_SAVED_REGS)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_INIT_SAVED_REGS)
 #define FRAME_INIT_SAVED_REGS(frame) (gdbarch_frame_init_saved_regs (current_gdbarch, frame))
 #endif
 #endif
@@ -810,7 +1114,7 @@
 extern void gdbarch_init_extra_frame_info (struct gdbarch *gdbarch, int fromleaf, struct frame_info *frame);
 extern void set_gdbarch_init_extra_frame_info (struct gdbarch *gdbarch, gdbarch_init_extra_frame_info_ftype *init_extra_frame_info);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (INIT_EXTRA_FRAME_INFO)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (INIT_EXTRA_FRAME_INFO)
 #define INIT_EXTRA_FRAME_INFO(fromleaf, frame) (gdbarch_init_extra_frame_info (current_gdbarch, fromleaf, frame))
 #endif
 #endif
@@ -819,13 +1123,13 @@
 extern CORE_ADDR gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip);
 extern void set_gdbarch_skip_prologue (struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype *skip_prologue);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (SKIP_PROLOGUE)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SKIP_PROLOGUE)
 #define SKIP_PROLOGUE(ip) (gdbarch_skip_prologue (current_gdbarch, ip))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (PROLOGUE_FRAMELESS_P)
+#if (!GDB_MULTI_ARCH) && !defined (PROLOGUE_FRAMELESS_P)
 #define PROLOGUE_FRAMELESS_P(ip) (generic_prologue_frameless_p (ip))
 #endif
 
@@ -833,7 +1137,7 @@
 extern int gdbarch_prologue_frameless_p (struct gdbarch *gdbarch, CORE_ADDR ip);
 extern void set_gdbarch_prologue_frameless_p (struct gdbarch *gdbarch, gdbarch_prologue_frameless_p_ftype *prologue_frameless_p);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (PROLOGUE_FRAMELESS_P)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PROLOGUE_FRAMELESS_P)
 #define PROLOGUE_FRAMELESS_P(ip) (gdbarch_prologue_frameless_p (current_gdbarch, ip))
 #endif
 #endif
@@ -842,13 +1146,13 @@
 extern int gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs);
 extern void set_gdbarch_inner_than (struct gdbarch *gdbarch, gdbarch_inner_than_ftype *inner_than);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (INNER_THAN)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (INNER_THAN)
 #define INNER_THAN(lhs, rhs) (gdbarch_inner_than (current_gdbarch, lhs, rhs))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (BREAKPOINT_FROM_PC)
+#if (!GDB_MULTI_ARCH) && !defined (BREAKPOINT_FROM_PC)
 #define BREAKPOINT_FROM_PC(pcptr, lenptr) (legacy_breakpoint_from_pc (pcptr, lenptr))
 #endif
 
@@ -856,13 +1160,13 @@
 extern unsigned char * gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr);
 extern void set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (BREAKPOINT_FROM_PC)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (BREAKPOINT_FROM_PC)
 #define BREAKPOINT_FROM_PC(pcptr, lenptr) (gdbarch_breakpoint_from_pc (current_gdbarch, pcptr, lenptr))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (MEMORY_INSERT_BREAKPOINT)
+#if (!GDB_MULTI_ARCH) && !defined (MEMORY_INSERT_BREAKPOINT)
 #define MEMORY_INSERT_BREAKPOINT(addr, contents_cache) (default_memory_insert_breakpoint (addr, contents_cache))
 #endif
 
@@ -870,13 +1174,13 @@
 extern int gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache);
 extern void set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (MEMORY_INSERT_BREAKPOINT)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (MEMORY_INSERT_BREAKPOINT)
 #define MEMORY_INSERT_BREAKPOINT(addr, contents_cache) (gdbarch_memory_insert_breakpoint (current_gdbarch, addr, contents_cache))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (MEMORY_REMOVE_BREAKPOINT)
+#if (!GDB_MULTI_ARCH) && !defined (MEMORY_REMOVE_BREAKPOINT)
 #define MEMORY_REMOVE_BREAKPOINT(addr, contents_cache) (default_memory_remove_breakpoint (addr, contents_cache))
 #endif
 
@@ -884,7 +1188,7 @@
 extern int gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, char *contents_cache);
 extern void set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (MEMORY_REMOVE_BREAKPOINT)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (MEMORY_REMOVE_BREAKPOINT)
 #define MEMORY_REMOVE_BREAKPOINT(addr, contents_cache) (gdbarch_memory_remove_breakpoint (current_gdbarch, addr, contents_cache))
 #endif
 #endif
@@ -892,7 +1196,7 @@
 extern CORE_ADDR gdbarch_decr_pc_after_break (struct gdbarch *gdbarch);
 extern void set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (DECR_PC_AFTER_BREAK)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DECR_PC_AFTER_BREAK)
 #define DECR_PC_AFTER_BREAK (gdbarch_decr_pc_after_break (current_gdbarch))
 #endif
 #endif
@@ -900,13 +1204,13 @@
 extern CORE_ADDR gdbarch_function_start_offset (struct gdbarch *gdbarch);
 extern void set_gdbarch_function_start_offset (struct gdbarch *gdbarch, CORE_ADDR function_start_offset);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (FUNCTION_START_OFFSET)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FUNCTION_START_OFFSET)
 #define FUNCTION_START_OFFSET (gdbarch_function_start_offset (current_gdbarch))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (REMOTE_TRANSLATE_XFER_ADDRESS)
+#if (!GDB_MULTI_ARCH) && !defined (REMOTE_TRANSLATE_XFER_ADDRESS)
 #define REMOTE_TRANSLATE_XFER_ADDRESS(gdb_addr, gdb_len, rem_addr, rem_len) (generic_remote_translate_xfer_address (gdb_addr, gdb_len, rem_addr, rem_len))
 #endif
 
@@ -914,7 +1218,7 @@
 extern void gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len);
 extern void set_gdbarch_remote_translate_xfer_address (struct gdbarch *gdbarch, gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (REMOTE_TRANSLATE_XFER_ADDRESS)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REMOTE_TRANSLATE_XFER_ADDRESS)
 #define REMOTE_TRANSLATE_XFER_ADDRESS(gdb_addr, gdb_len, rem_addr, rem_len) (gdbarch_remote_translate_xfer_address (current_gdbarch, gdb_addr, gdb_len, rem_addr, rem_len))
 #endif
 #endif
@@ -922,13 +1226,13 @@
 extern CORE_ADDR gdbarch_frame_args_skip (struct gdbarch *gdbarch);
 extern void set_gdbarch_frame_args_skip (struct gdbarch *gdbarch, CORE_ADDR frame_args_skip);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_ARGS_SKIP)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_ARGS_SKIP)
 #define FRAME_ARGS_SKIP (gdbarch_frame_args_skip (current_gdbarch))
 #endif
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (FRAMELESS_FUNCTION_INVOCATION)
+#if (!GDB_MULTI_ARCH) && !defined (FRAMELESS_FUNCTION_INVOCATION)
 #define FRAMELESS_FUNCTION_INVOCATION(fi) (generic_frameless_function_invocation_not (fi))
 #endif
 
@@ -936,7 +1240,7 @@
 extern int gdbarch_frameless_function_invocation (struct gdbarch *gdbarch, struct frame_info *fi);
 extern void set_gdbarch_frameless_function_invocation (struct gdbarch *gdbarch, gdbarch_frameless_function_invocation_ftype *frameless_function_invocation);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (FRAMELESS_FUNCTION_INVOCATION)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAMELESS_FUNCTION_INVOCATION)
 #define FRAMELESS_FUNCTION_INVOCATION(fi) (gdbarch_frameless_function_invocation (current_gdbarch, fi))
 #endif
 #endif
@@ -945,7 +1249,7 @@
 extern CORE_ADDR gdbarch_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame);
 extern void set_gdbarch_frame_chain (struct gdbarch *gdbarch, gdbarch_frame_chain_ftype *frame_chain);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_CHAIN)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_CHAIN)
 #define FRAME_CHAIN(frame) (gdbarch_frame_chain (current_gdbarch, frame))
 #endif
 #endif
@@ -954,7 +1258,7 @@
 extern int gdbarch_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe);
 extern void set_gdbarch_frame_chain_valid (struct gdbarch *gdbarch, gdbarch_frame_chain_valid_ftype *frame_chain_valid);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_CHAIN_VALID)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_CHAIN_VALID)
 #define FRAME_CHAIN_VALID(chain, thisframe) (gdbarch_frame_chain_valid (current_gdbarch, chain, thisframe))
 #endif
 #endif
@@ -963,7 +1267,7 @@
 extern CORE_ADDR gdbarch_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi);
 extern void set_gdbarch_frame_saved_pc (struct gdbarch *gdbarch, gdbarch_frame_saved_pc_ftype *frame_saved_pc);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_SAVED_PC)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_SAVED_PC)
 #define FRAME_SAVED_PC(fi) (gdbarch_frame_saved_pc (current_gdbarch, fi))
 #endif
 #endif
@@ -972,7 +1276,7 @@
 extern CORE_ADDR gdbarch_frame_args_address (struct gdbarch *gdbarch, struct frame_info *fi);
 extern void set_gdbarch_frame_args_address (struct gdbarch *gdbarch, gdbarch_frame_args_address_ftype *frame_args_address);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_ARGS_ADDRESS)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_ARGS_ADDRESS)
 #define FRAME_ARGS_ADDRESS(fi) (gdbarch_frame_args_address (current_gdbarch, fi))
 #endif
 #endif
@@ -981,7 +1285,7 @@
 extern CORE_ADDR gdbarch_frame_locals_address (struct gdbarch *gdbarch, struct frame_info *fi);
 extern void set_gdbarch_frame_locals_address (struct gdbarch *gdbarch, gdbarch_frame_locals_address_ftype *frame_locals_address);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_LOCALS_ADDRESS)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_LOCALS_ADDRESS)
 #define FRAME_LOCALS_ADDRESS(fi) (gdbarch_frame_locals_address (current_gdbarch, fi))
 #endif
 #endif
@@ -990,7 +1294,7 @@
 extern CORE_ADDR gdbarch_saved_pc_after_call (struct gdbarch *gdbarch, struct frame_info *frame);
 extern void set_gdbarch_saved_pc_after_call (struct gdbarch *gdbarch, gdbarch_saved_pc_after_call_ftype *saved_pc_after_call);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (SAVED_PC_AFTER_CALL)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SAVED_PC_AFTER_CALL)
 #define SAVED_PC_AFTER_CALL(frame) (gdbarch_saved_pc_after_call (current_gdbarch, frame))
 #endif
 #endif
@@ -999,7 +1303,7 @@
 extern int gdbarch_frame_num_args (struct gdbarch *gdbarch, struct frame_info *frame);
 extern void set_gdbarch_frame_num_args (struct gdbarch *gdbarch, gdbarch_frame_num_args_ftype *frame_num_args);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (FRAME_NUM_ARGS)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_NUM_ARGS)
 #define FRAME_NUM_ARGS(frame) (gdbarch_frame_num_args (current_gdbarch, frame))
 #endif
 #endif
@@ -1010,17 +1314,17 @@
 #endif
 
 /* Default predicate for non- multi-arch targets. */
-#if (GDB_MULTI_ARCH == 0) && !defined (STACK_ALIGN_P)
+#if (!GDB_MULTI_ARCH) && !defined (STACK_ALIGN_P)
 #define STACK_ALIGN_P() (0)
 #endif
 
 extern int gdbarch_stack_align_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > 1) || !defined (STACK_ALIGN_P)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (STACK_ALIGN_P)
 #define STACK_ALIGN_P() (gdbarch_stack_align_p (current_gdbarch))
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (STACK_ALIGN)
+#if (!GDB_MULTI_ARCH) && !defined (STACK_ALIGN)
 #define STACK_ALIGN(sp) (internal_error ("STACK_ALIGN"), 0)
 #endif
 
@@ -1028,28 +1332,41 @@
 extern CORE_ADDR gdbarch_stack_align (struct gdbarch *gdbarch, CORE_ADDR sp);
 extern void set_gdbarch_stack_align (struct gdbarch *gdbarch, gdbarch_stack_align_ftype *stack_align);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (STACK_ALIGN)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (STACK_ALIGN)
 #define STACK_ALIGN(sp) (gdbarch_stack_align (current_gdbarch, sp))
 #endif
 #endif
 
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (EXTRA_STACK_ALIGNMENT_NEEDED)
+#define EXTRA_STACK_ALIGNMENT_NEEDED (1)
+#endif
+
+extern int gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch);
+extern void set_gdbarch_extra_stack_alignment_needed (struct gdbarch *gdbarch, int extra_stack_alignment_needed);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (EXTRA_STACK_ALIGNMENT_NEEDED)
+#define EXTRA_STACK_ALIGNMENT_NEEDED (gdbarch_extra_stack_alignment_needed (current_gdbarch))
+#endif
+#endif
+
 #if defined (REG_STRUCT_HAS_ADDR)
 /* Legacy for systems yet to multi-arch REG_STRUCT_HAS_ADDR */
 #define REG_STRUCT_HAS_ADDR_P() (1)
 #endif
 
 /* Default predicate for non- multi-arch targets. */
-#if (GDB_MULTI_ARCH == 0) && !defined (REG_STRUCT_HAS_ADDR_P)
+#if (!GDB_MULTI_ARCH) && !defined (REG_STRUCT_HAS_ADDR_P)
 #define REG_STRUCT_HAS_ADDR_P() (0)
 #endif
 
 extern int gdbarch_reg_struct_has_addr_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > 1) || !defined (REG_STRUCT_HAS_ADDR_P)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REG_STRUCT_HAS_ADDR_P)
 #define REG_STRUCT_HAS_ADDR_P() (gdbarch_reg_struct_has_addr_p (current_gdbarch))
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (REG_STRUCT_HAS_ADDR)
+#if (!GDB_MULTI_ARCH) && !defined (REG_STRUCT_HAS_ADDR)
 #define REG_STRUCT_HAS_ADDR(gcc_p, type) (internal_error ("REG_STRUCT_HAS_ADDR"), 0)
 #endif
 
@@ -1057,7 +1374,7 @@
 extern int gdbarch_reg_struct_has_addr (struct gdbarch *gdbarch, int gcc_p, struct type *type);
 extern void set_gdbarch_reg_struct_has_addr (struct gdbarch *gdbarch, gdbarch_reg_struct_has_addr_ftype *reg_struct_has_addr);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (REG_STRUCT_HAS_ADDR)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REG_STRUCT_HAS_ADDR)
 #define REG_STRUCT_HAS_ADDR(gcc_p, type) (gdbarch_reg_struct_has_addr (current_gdbarch, gcc_p, type))
 #endif
 #endif
@@ -1068,17 +1385,17 @@
 #endif
 
 /* Default predicate for non- multi-arch targets. */
-#if (GDB_MULTI_ARCH == 0) && !defined (SAVE_DUMMY_FRAME_TOS_P)
+#if (!GDB_MULTI_ARCH) && !defined (SAVE_DUMMY_FRAME_TOS_P)
 #define SAVE_DUMMY_FRAME_TOS_P() (0)
 #endif
 
 extern int gdbarch_save_dummy_frame_tos_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > 1) || !defined (SAVE_DUMMY_FRAME_TOS_P)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SAVE_DUMMY_FRAME_TOS_P)
 #define SAVE_DUMMY_FRAME_TOS_P() (gdbarch_save_dummy_frame_tos_p (current_gdbarch))
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (SAVE_DUMMY_FRAME_TOS)
+#if (!GDB_MULTI_ARCH) && !defined (SAVE_DUMMY_FRAME_TOS)
 #define SAVE_DUMMY_FRAME_TOS(sp) (internal_error ("SAVE_DUMMY_FRAME_TOS"), 0)
 #endif
 
@@ -1086,50 +1403,64 @@
 extern void gdbarch_save_dummy_frame_tos (struct gdbarch *gdbarch, CORE_ADDR sp);
 extern void set_gdbarch_save_dummy_frame_tos (struct gdbarch *gdbarch, gdbarch_save_dummy_frame_tos_ftype *save_dummy_frame_tos);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (SAVE_DUMMY_FRAME_TOS)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SAVE_DUMMY_FRAME_TOS)
 #define SAVE_DUMMY_FRAME_TOS(sp) (gdbarch_save_dummy_frame_tos (current_gdbarch, sp))
 #endif
 #endif
 
 /* Default (value) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (TARGET_FLOAT_FORMAT)
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_FLOAT_FORMAT)
 #define TARGET_FLOAT_FORMAT (default_float_format (current_gdbarch))
 #endif
 
 extern const struct floatformat * gdbarch_float_format (struct gdbarch *gdbarch);
 extern void set_gdbarch_float_format (struct gdbarch *gdbarch, const struct floatformat * float_format);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_FLOAT_FORMAT)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_FLOAT_FORMAT)
 #define TARGET_FLOAT_FORMAT (gdbarch_float_format (current_gdbarch))
 #endif
 #endif
 
 /* Default (value) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (TARGET_DOUBLE_FORMAT)
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_DOUBLE_FORMAT)
 #define TARGET_DOUBLE_FORMAT (default_double_format (current_gdbarch))
 #endif
 
 extern const struct floatformat * gdbarch_double_format (struct gdbarch *gdbarch);
 extern void set_gdbarch_double_format (struct gdbarch *gdbarch, const struct floatformat * double_format);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_DOUBLE_FORMAT)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_DOUBLE_FORMAT)
 #define TARGET_DOUBLE_FORMAT (gdbarch_double_format (current_gdbarch))
 #endif
 #endif
 
 /* Default (value) for non- multi-arch platforms. */
-#if (GDB_MULTI_ARCH == 0) && !defined (TARGET_LONG_DOUBLE_FORMAT)
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_LONG_DOUBLE_FORMAT)
 #define TARGET_LONG_DOUBLE_FORMAT (&floatformat_unknown)
 #endif
 
 extern const struct floatformat * gdbarch_long_double_format (struct gdbarch *gdbarch);
 extern void set_gdbarch_long_double_format (struct gdbarch *gdbarch, const struct floatformat * long_double_format);
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > 1) || !defined (TARGET_LONG_DOUBLE_FORMAT)
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_LONG_DOUBLE_FORMAT)
 #define TARGET_LONG_DOUBLE_FORMAT (gdbarch_long_double_format (current_gdbarch))
 #endif
 #endif
 
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (CONVERT_FROM_FUNC_PTR_ADDR)
+#define CONVERT_FROM_FUNC_PTR_ADDR(addr) (default_convert_from_func_ptr_addr (addr))
+#endif
+
+typedef CORE_ADDR (gdbarch_convert_from_func_ptr_addr_ftype) (CORE_ADDR addr);
+extern CORE_ADDR gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr);
+extern void set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr);
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (CONVERT_FROM_FUNC_PTR_ADDR)
+#define CONVERT_FROM_FUNC_PTR_ADDR(addr) (gdbarch_convert_from_func_ptr_addr (current_gdbarch, addr))
+#endif
+#endif
+
 extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
 
 
@@ -1142,7 +1473,7 @@
 
    The mechanisms below ensures that there is only a loose connection
    between the set-architecture command and the various GDB
-   components.  Each component can independantly register their need
+   components.  Each component can independently register their need
    to maintain architecture specific data with gdbarch.
 
    Pragmatics:
@@ -1152,7 +1483,7 @@
 
    The more traditional mega-struct containing architecture specific
    data for all the various GDB components was also considered.  Since
-   GDB is built from a variable number of (fairly independant)
+   GDB is built from a variable number of (fairly independent)
    components it was determined that the global aproach was not
    applicable. */
 
@@ -1176,12 +1507,15 @@
    that the INFO.BYTE_ORDER is non-zero.
 
    The INIT function shall return any of: NULL - indicating that it
-   doesn't reconize the selected architecture; an existing ``struct
+   doesn't recognize the selected architecture; an existing ``struct
    gdbarch'' from the ARCHES list - indicating that the new
    architecture is just a synonym for an earlier architecture (see
    gdbarch_list_lookup_by_info()); a newly created ``struct gdbarch''
-   - that describes the selected architecture (see
-   gdbarch_alloc()). */
+   - that describes the selected architecture (see gdbarch_alloc()).
+
+   The DUMP_TDEP function shall print out all target specific values.
+   Care should be taken to ensure that the function works in both the
+   multi-arch and non- multi-arch cases. */
 
 struct gdbarch_list
 {
@@ -1208,9 +1542,23 @@
 };
 
 typedef struct gdbarch *(gdbarch_init_ftype) (struct gdbarch_info info, struct gdbarch_list *arches);
+typedef void (gdbarch_dump_tdep_ftype) (struct gdbarch *gdbarch, struct ui_file *file);
 
+/* DEPRECATED - use gdbarch_register() */
 extern void register_gdbarch_init (enum bfd_architecture architecture, gdbarch_init_ftype *);
 
+extern void gdbarch_register (enum bfd_architecture architecture,
+                              gdbarch_init_ftype *,
+                              gdbarch_dump_tdep_ftype *);
+
+
+/* Return a freshly allocated, NULL terminated, array of the valid
+   architecture names.  Since architectures are registered during the
+   _initialize phase this function only returns useful information
+   once initialization has been completed. */
+
+extern const char **gdbarch_printable_names (void);
+
 
 /* Helper function.  Search the list of ARCHES for a GDBARCH that
    matches the information provided by INFO. */
@@ -1226,7 +1574,10 @@
 extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, struct gdbarch_tdep *tdep);
 
 
-/* Helper function.  Free a partially-constructed ``struct gdbarch''.  */
+/* Helper function.  Free a partially-constructed ``struct gdbarch''.
+   It is assumed that the caller freeds the ``struct
+   gdbarch_tdep''. */
+
 extern void gdbarch_free (struct gdbarch *);
 
 
@@ -1235,13 +1586,15 @@
    architecture manipulation commands.
 
    The INFO parameter shall be fully initialized (``memset (&INFO,
-   sizeof (info), 0)'' set relevant fields) before gdbarch_update() is
-   called.  gdbarch_update() shall initialize any ``default'' fields
-   using information obtained from the previous architecture or
+   sizeof (info), 0)'' set relevant fields) before gdbarch_update_p()
+   is called.  gdbarch_update_p() shall initialize any ``default''
+   fields using information obtained from the previous architecture or
    INFO.ABFD (if specified) before calling the corresponding
-   architectures INIT function. */
+   architectures INIT function.
 
-extern int gdbarch_update (struct gdbarch_info info);
+   Returns non-zero if the update succeeds */
+
+extern int gdbarch_update_p (struct gdbarch_info info);
 
 
 
@@ -1290,7 +1643,7 @@
 
 
 
-/* The target-system-dependant byte order is dynamic */
+/* The target-system-dependent byte order is dynamic */
 
 /* TARGET_BYTE_ORDER_SELECTABLE_P determines if the target endianness
    is selectable at runtime.  The user can use the ``set endian''
@@ -1330,7 +1683,7 @@
 
 
 
-/* The target-system-dependant BFD architecture is dynamic */
+/* The target-system-dependent BFD architecture is dynamic */
 
 extern int target_architecture_auto;
 #ifndef TARGET_ARCHITECTURE_AUTO
@@ -1342,15 +1695,8 @@
 #define TARGET_ARCHITECTURE (target_architecture + 0)
 #endif
 
-/* Notify the target dependant backend of a change to the selected
-   architecture. A zero return status indicates that the target did
-   not like the change. */
 
-extern int (*target_architecture_hook) (const struct bfd_arch_info *);
-
-
-
-/* The target-system-dependant disassembler is semi-dynamic */
+/* The target-system-dependent disassembler is semi-dynamic */
 
 #include "dis-asm.h"		/* Get defs for disassemble_info */
 
@@ -1391,32 +1737,21 @@
 #endif
 
 
-/* Set the dynamic target-system-dependant parameters (architecture,
+/* Set the dynamic target-system-dependent parameters (architecture,
    byte-order, ...) using information found in the BFD */
 
 extern void set_gdbarch_from_file (bfd *);
 
 
-/* Explicitly set the dynamic target-system-dependant parameters based
-   on bfd_architecture and machine. */
-
-extern void set_architecture_from_arch_mach (enum bfd_architecture, unsigned long);
-
-
 /* Initialize the current architecture to the "first" one we find on
    our list.  */
 
 extern void initialize_current_architecture (void);
 
-/* Helper function for targets that don't know how my arguments are
-   being passed */
-
-extern int frame_num_args_unknown (struct frame_info *fi);
-
 
 /* gdbarch trace variable */
 extern int gdbarch_debug;
 
-extern void gdbarch_dump (void);
+extern void gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file);
 
 #endif
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index bf7b47c..167e55b 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -1,4 +1,4 @@
-#!/usr/local/bin/bash -u
+#!/bin/sh -u
 
 # Architecture commands for GDB, the GNU debugger.
 # Copyright 1998-2000 Free Software Foundation, Inc.
@@ -22,7 +22,7 @@
 compare_new ()
 {
     file=$1
-    if ! test -r ${file}
+    if test ! -r ${file}
     then
 	echo "${file} missing? cp new-${file} ${file}" 1>&2
     elif diff -c ${file} new-${file}
@@ -39,46 +39,90 @@
 
 do_read ()
 {
-    if eval read $read
-    then
-	test "${staticdefault}" || staticdefault=0
-	# NOT YET: Breaks BELIEVE_PCC_PROMOTION and confuses non-
-	# multi-arch defaults.
-	# test "${predefault}" || predefault=0
-	test "${fmt}" || fmt="%ld"
-	test "${print}" || print="(long) ${macro}"
-	case "${invalid_p}" in
-	    0 ) valid_p=1 ;;
-	    "" )
-		if [ "${predefault}" ]
-		then
-		    #invalid_p="gdbarch->${function} == ${predefault}"
-		    valid_p="gdbarch->${function} != ${predefault}"
-		else
-		    #invalid_p="gdbarch->${function} == 0"
-		    valid_p="gdbarch->${function} != 0"
-		fi
-		;;
-	    * ) valid_p="!(${invalid_p})"
-	esac
-
-	# PREDEFAULT is a valid fallback definition of MEMBER when
-	# multi-arch is not enabled.  This ensures that the default
-	# value, when multi-arch is the same as the default value when
-	# not multi-arch.  POSTDEFAULT is always a valid definition of
-	# MEMBER as this again ensures consistency.
-	if [ "${postdefault}" != "" ]
+    comment=""
+    class=""
+    while read line
+    do
+	if test "${line}" = ""
 	then
-	    fallbackdefault="${postdefault}"
-	elif [ "${predefault}" != "" ]
+	    continue
+	elif test "${line}" = "#" -a "${comment}" = ""
 	then
-	    fallbackdefault="${predefault}"
+	    continue
+	elif expr "${line}" : "#" > /dev/null
+	then
+	    comment="${comment}
+${line}"
 	else
-	    fallbackdefault=""
+
+	    # The semantics of IFS varies between different SH's.  Some
+	    # treat ``::' as three fields while some treat it as just too.
+	    # Work around this by eliminating ``::'' ....
+	    line="`echo "${line}" | sed -e 's/::/: :/g' -e 's/::/: :/g'`"
+
+	    OFS="${IFS}" ; IFS="[:]"
+	    eval read ${read} <<EOF
+${line}
+EOF
+	    IFS="${OFS}"
+
+	    # .... and then going back through each field and strip out those
+	    # that ended up with just that space character.
+	    for r in ${read}
+	    do
+		if eval test \"\${${r}}\" = \"\ \"
+		then
+		    eval ${r}=""
+		fi
+	    done
+
+	    test "${staticdefault}" || staticdefault=0
+	    # NOT YET: Breaks BELIEVE_PCC_PROMOTION and confuses non-
+	    # multi-arch defaults.
+	    # test "${predefault}" || predefault=0
+	    test "${fmt}" || fmt="%ld"
+	    test "${print}" || print="(long) ${macro}"
+	    case "${invalid_p}" in
+		0 ) valid_p=1 ;;
+		"" )
+		    if [ "${predefault}" ]
+		    then
+			#invalid_p="gdbarch->${function} == ${predefault}"
+			valid_p="gdbarch->${function} != ${predefault}"
+		    else
+			#invalid_p="gdbarch->${function} == 0"
+			valid_p="gdbarch->${function} != 0"
+		    fi
+		    ;;
+		* ) valid_p="!(${invalid_p})"
+	    esac
+
+	    # PREDEFAULT is a valid fallback definition of MEMBER when
+	    # multi-arch is not enabled.  This ensures that the
+	    # default value, when multi-arch is the same as the
+	    # default value when not multi-arch.  POSTDEFAULT is
+	    # always a valid definition of MEMBER as this again
+	    # ensures consistency.
+
+	    if [ "${postdefault}" != "" ]
+	    then
+		fallbackdefault="${postdefault}"
+	    elif [ "${predefault}" != "" ]
+	    then
+		fallbackdefault="${predefault}"
+	    else
+		fallbackdefault=""
+	    fi
+
+	    #NOT YET: See gdbarch.log for basic verification of
+	    # database
+
+	    break
 	fi
-	#NOT YET:
-	# See gdbarch.log for basic verification of database
-	:
+    done
+    if [ "${class}" ]
+    then
+	true
     else
 	false
     fi
@@ -250,6 +294,7 @@
 	# An optional indicator for any predicte to wrap around the
 	# print member code.
 
+	#   () -> Call a custom function to do the dump.
 	#   exp -> Wrap print up in ``if (${print_p}) ...
 	#   ``'' -> No predicate
 
@@ -263,42 +308,80 @@
   esac
 done
 
-IFS=:
 
 function_list ()
 {
   # See below (DOCO) for description of each field
-  cat <<EOF |
+  cat <<EOF
 i:2:TARGET_ARCHITECTURE:const struct bfd_arch_info *:bfd_arch_info::::&bfd_default_arch_struct::::%s:TARGET_ARCHITECTURE->printable_name:TARGET_ARCHITECTURE != NULL
 #
 i:2:TARGET_BYTE_ORDER:int:byte_order::::BIG_ENDIAN
+# Number of bits in a char or unsigned char for the target machine.
+# Just like CHAR_BIT in <limits.h> but describes the target machine.
+# v::TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):8::0:
 #
-v:1:TARGET_BFD_VMA_BIT:int:bfd_vma_bit::::8 * sizeof (void*):TARGET_ARCHITECTURE->bits_per_address::0
-v:1:TARGET_PTR_BIT:int:ptr_bit::::8 * sizeof (void*):0
-#v:1:TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):0
-v:1:TARGET_SHORT_BIT:int:short_bit::::8 * sizeof (short):0
-v:1:TARGET_INT_BIT:int:int_bit::::8 * sizeof (int):0
-v:1:TARGET_LONG_BIT:int:long_bit::::8 * sizeof (long):0
-v:1:TARGET_LONG_LONG_BIT:int:long_long_bit::::8 * sizeof (LONGEST):0
-v:1:TARGET_FLOAT_BIT:int:float_bit::::8 * sizeof (float):0
-v:1:TARGET_DOUBLE_BIT:int:double_bit::::8 * sizeof (double):0
-v:1:TARGET_LONG_DOUBLE_BIT:int:long_double_bit::::8 * sizeof (long double):0
-v:1:IEEE_FLOAT:int:ieee_float::::0:0::0:::
+# Number of bits in a short or unsigned short for the target machine.
+v::TARGET_SHORT_BIT:int:short_bit::::8 * sizeof (short):2*TARGET_CHAR_BIT::0
+# Number of bits in an int or unsigned int for the target machine.
+v::TARGET_INT_BIT:int:int_bit::::8 * sizeof (int):4*TARGET_CHAR_BIT::0
+# Number of bits in a long or unsigned long for the target machine.
+v::TARGET_LONG_BIT:int:long_bit::::8 * sizeof (long):4*TARGET_CHAR_BIT::0
+# Number of bits in a long long or unsigned long long for the target
+# machine.
+v::TARGET_LONG_LONG_BIT:int:long_long_bit::::8 * sizeof (LONGEST):2*TARGET_LONG_BIT::0
+# Number of bits in a float for the target machine.
+v::TARGET_FLOAT_BIT:int:float_bit::::8 * sizeof (float):4*TARGET_CHAR_BIT::0
+# Number of bits in a double for the target machine.
+v::TARGET_DOUBLE_BIT:int:double_bit::::8 * sizeof (double):8*TARGET_CHAR_BIT::0
+# Number of bits in a long double for the target machine.
+v::TARGET_LONG_DOUBLE_BIT:int:long_double_bit::::8 * sizeof (long double):2*TARGET_DOUBLE_BIT::0
+# For most targets, a pointer on the target and its representation as an
+# address in GDB have the same size and "look the same".  For such a
+# target, you need only set TARGET_PTR_BIT / ptr_bit and TARGET_ADDR_BIT
+# / addr_bit will be set from it.
 #
-f:1:TARGET_READ_PC:CORE_ADDR:read_pc:int pid:pid::0:0
-f:1:TARGET_WRITE_PC:void:write_pc:CORE_ADDR val, int pid:val, pid::0:0
-f:1:TARGET_READ_FP:CORE_ADDR:read_fp:void:::0:0
-f:1:TARGET_WRITE_FP:void:write_fp:CORE_ADDR val:val::0:0
-f:1:TARGET_READ_SP:CORE_ADDR:read_sp:void:::0:0
-f:1:TARGET_WRITE_SP:void:write_sp:CORE_ADDR val:val::0:0
+# If TARGET_PTR_BIT and TARGET_ADDR_BIT are different, you'll probably
+# also need to set POINTER_TO_ADDRESS and ADDRESS_TO_POINTER as well.
+#
+# ptr_bit is the size of a pointer on the target
+v::TARGET_PTR_BIT:int:ptr_bit::::8 * sizeof (void*):TARGET_INT_BIT::0
+# addr_bit is the size of a target address as represented in gdb
+v::TARGET_ADDR_BIT:int:addr_bit::::8 * sizeof (void*):0:TARGET_PTR_BIT:
+# Number of bits in a BFD_VMA for the target object file format.
+v::TARGET_BFD_VMA_BIT:int:bfd_vma_bit::::8 * sizeof (void*):TARGET_ARCHITECTURE->bits_per_address::0
+#
+v::IEEE_FLOAT:int:ieee_float::::0:0::0:::
+#
+f::TARGET_READ_PC:CORE_ADDR:read_pc:int pid:pid::0:generic_target_read_pc::0
+f::TARGET_WRITE_PC:void:write_pc:CORE_ADDR val, int pid:val, pid::0:generic_target_write_pc::0
+f::TARGET_READ_FP:CORE_ADDR:read_fp:void:::0:generic_target_read_fp::0
+f::TARGET_WRITE_FP:void:write_fp:CORE_ADDR val:val::0:generic_target_write_fp::0
+f::TARGET_READ_SP:CORE_ADDR:read_sp:void:::0:generic_target_read_sp::0
+f::TARGET_WRITE_SP:void:write_sp:CORE_ADDR val:val::0:generic_target_write_sp::0
 #
 v:2:NUM_REGS:int:num_regs::::0:-1
+# This macro gives the number of pseudo-registers that live in the
+# register namespace but do not get fetched or stored on the target.
+# These pseudo-registers may be aliases for other registers,
+# combinations of other registers, or they may be computed by GDB.
+v:2:NUM_PSEUDO_REGS:int:num_pseudo_regs::::0:0::0:::
 v:2:SP_REGNUM:int:sp_regnum::::0:-1
 v:2:FP_REGNUM:int:fp_regnum::::0:-1
 v:2:PC_REGNUM:int:pc_regnum::::0:-1
 v:2:FP0_REGNUM:int:fp0_regnum::::0:-1::0
 v:2:NPC_REGNUM:int:npc_regnum::::0:-1::0
 v:2:NNPC_REGNUM:int:nnpc_regnum::::0:-1::0
+# Convert stab register number (from \`r\' declaration) to a gdb REGNUM.
+f:2:STAB_REG_TO_REGNUM:int:stab_reg_to_regnum:int stab_regnr:stab_regnr:::no_op_reg_to_regnum::0
+# Provide a default mapping from a ecoff register number to a gdb REGNUM.
+f:2:ECOFF_REG_TO_REGNUM:int:ecoff_reg_to_regnum:int ecoff_regnr:ecoff_regnr:::no_op_reg_to_regnum::0
+# Provide a default mapping from a DWARF register number to a gdb REGNUM.
+f:2:DWARF_REG_TO_REGNUM:int:dwarf_reg_to_regnum:int dwarf_regnr:dwarf_regnr:::no_op_reg_to_regnum::0
+# Convert from an sdb register number to an internal gdb register number.
+# This should be defined in tm.h, if REGISTER_NAMES is not set up
+# to map one to one onto the sdb register numbers.
+f:2:SDB_REG_TO_REGNUM:int:sdb_reg_to_regnum:int sdb_regnr:sdb_regnr:::no_op_reg_to_regnum::0
+f:2:DWARF2_REG_TO_REGNUM:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr:::no_op_reg_to_regnum::0
 f:2:REGISTER_NAME:char *:register_name:int regnr:regnr:::legacy_register_name::0
 v:2:REGISTER_SIZE:int:register_size::::0:-1
 v:2:REGISTER_BYTES:int:register_bytes::::0:-1
@@ -308,12 +391,17 @@
 f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::0:0
 v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1
 f:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0
+f:2:DO_REGISTERS_INFO:void:do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs:::do_registers_info::0
+# MAP a GDB RAW register number onto a simulator register number.  See
+# also include/...-sim.h.
+f:2:REGISTER_SIM_REGNO:int:register_sim_regno:int reg_nr:reg_nr:::default_register_sim_regno::0
+F:2:REGISTER_BYTES_OK:int:register_bytes_ok:long nr_bytes:nr_bytes::0:0
 #
 v:1:USE_GENERIC_DUMMY_FRAMES:int:use_generic_dummy_frames::::0:-1
 v:2:CALL_DUMMY_LOCATION:int:call_dummy_location::::0:0
 f:2:CALL_DUMMY_ADDRESS:CORE_ADDR:call_dummy_address:void:::0:0::gdbarch->call_dummy_location == AT_ENTRY_POINT && gdbarch->call_dummy_address == 0
 v:2:CALL_DUMMY_START_OFFSET:CORE_ADDR:call_dummy_start_offset::::0:-1:::0x%08lx
-v:2:CALL_DUMMY_BREAKPOINT_OFFSET:CORE_ADDR:call_dummy_breakpoint_offset::::0:-1:::0x%08lx
+v:2:CALL_DUMMY_BREAKPOINT_OFFSET:CORE_ADDR:call_dummy_breakpoint_offset::::0:-1:::0x%08lx::CALL_DUMMY_BREAKPOINT_OFFSET_P
 v:1:CALL_DUMMY_BREAKPOINT_OFFSET_P:int:call_dummy_breakpoint_offset_p::::0:-1
 v:2:CALL_DUMMY_LENGTH:int:call_dummy_length::::0:-1:::::CALL_DUMMY_LOCATION == BEFORE_TEXT_END || CALL_DUMMY_LOCATION == AFTER_TEXT_END
 f:2:PC_IN_CALL_DUMMY:int:pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::0:0
@@ -332,6 +420,14 @@
 f:1:REGISTER_CONVERTIBLE:int:register_convertible:int nr:nr:::generic_register_convertible_not::0
 f:2:REGISTER_CONVERT_TO_VIRTUAL:void:register_convert_to_virtual:int regnum, struct type *type, char *from, char *to:regnum, type, from, to:::0::0
 f:2:REGISTER_CONVERT_TO_RAW:void:register_convert_to_raw:struct type *type, int regnum, char *from, char *to:type, regnum, from, to:::0::0
+# This function is called when the value of a pseudo-register needs to
+# be updated.  Typically it will be defined on a per-architecture
+# basis.
+f:2:FETCH_PSEUDO_REGISTER:void:fetch_pseudo_register:int regnum:regnum:::0::0
+# This function is called when the value of a pseudo-register needs to
+# be set or stored.  Typically it will be defined on a
+# per-architecture basis.
+f:2:STORE_PSEUDO_REGISTER:void:store_pseudo_register:int regnum:regnum:::0::0
 #
 f:2:POINTER_TO_ADDRESS:CORE_ADDR:pointer_to_address:struct type *type, void *buf:type, buf:::unsigned_pointer_to_address::0
 f:2:ADDRESS_TO_POINTER:void:address_to_pointer:struct type *type, void *buf, CORE_ADDR addr:type, buf, addr:::unsigned_address_to_pointer::0
@@ -381,40 +477,37 @@
 f:2:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame::0:0
 #
 F:2:STACK_ALIGN:CORE_ADDR:stack_align:CORE_ADDR sp:sp::0:0
+v:1:EXTRA_STACK_ALIGNMENT_NEEDED:int:extra_stack_alignment_needed::::0:1::0:::
 F:2:REG_STRUCT_HAS_ADDR:int:reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type::0:0
 F:2:SAVE_DUMMY_FRAME_TOS:void:save_dummy_frame_tos:CORE_ADDR sp:sp::0:0
 #
 v:2:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format::::::default_float_format (gdbarch)
 v:2:TARGET_DOUBLE_FORMAT:const struct floatformat *:double_format::::::default_double_format (gdbarch)
 v:2:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat *:long_double_format::::::&floatformat_unknown
+f:2:CONVERT_FROM_FUNC_PTR_ADDR:CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr:addr:::default_convert_from_func_ptr_addr::0
 EOF
-  grep -v '^#'
 }
 
 #
 # The .log file
 #
 exec > new-gdbarch.log
-function_list | while do_read # eval read $read
+function_list | while do_read
 do
     cat <<EOF
 ${class} ${macro}(${actual})
   ${returntype} ${function} ($formal)${attrib}
-    level=${level}
-    staticdefault=${staticdefault}
-    predefault=${predefault}
-    postdefault=${postdefault}
-    fallbackdefault=${fallbackdefault}
-    invalid_p=${invalid_p}
-    valid_p=${valid_p}
-    fmt=${fmt}
-    print=${print}
-    print_p=${print_p}
-    description=${description}
 EOF
+    for r in ${read}
+    do
+	eval echo \"\ \ \ \ ${r}=\${${r}}\"
+    done
+#    #fallbackdefault=${fallbackdefault}
+#    #valid_p=${valid_p}
+#EOF
     if class_is_predicate_p && fallback_default_p
     then
-	echo "Error: predicate function can not have a non- multi-arch default" 1>&2
+	echo "Error: predicate function ${macro} can not have a non- multi-arch default" 1>&2
 	kill $$
 	exit 1
     fi
@@ -424,6 +517,7 @@
 	kill $$
 	exit 1
     fi
+    echo ""
 done
 
 exec 1>&2
@@ -457,13 +551,13 @@
 
 /* This file was created with the aid of \`\`gdbarch.sh''.
 
-   The bourn shell script \`\`gdbarch.sh'' creates the files
+   The Bourne shell script \`\`gdbarch.sh'' creates the files
    \`\`new-gdbarch.c'' and \`\`new-gdbarch.h and then compares them
    against the existing \`\`gdbarch.[hc]''.  Any differences found
    being reported.
 
    If editing this file, please also run gdbarch.sh and merge any
-   changes into that script. Conversely, when makeing sweeping changes
+   changes into that script. Conversely, when making sweeping changes
    to this file, modifying gdbarch.sh and using its output may prove
    easier. */
 
@@ -484,17 +578,9 @@
 struct value;
 
 
-#ifndef GDB_MULTI_ARCH
-#define GDB_MULTI_ARCH 0
-#endif
-
 extern struct gdbarch *current_gdbarch;
 
 
-/* See gdb/doc/gdbint.texi for a discussion of the GDB_MULTI_ARCH
-   macro */
-
-
 /* If any of the following are defined, the target wasn't correctly
    converted. */
 
@@ -512,108 +598,115 @@
 EOF
 
 # function typedef's
-echo ""
-echo ""
-echo "/* The following are pre-initialized by GDBARCH. */"
-function_list | while do_read # eval read $read
+printf "\n"
+printf "\n"
+printf "/* The following are pre-initialized by GDBARCH. */\n"
+function_list | while do_read
 do
     if class_is_info_p
     then
-	echo ""
-	echo "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);"
-	echo "/* set_gdbarch_${function}() - not applicable - pre-initialized. */"
-	echo "#if GDB_MULTI_ARCH"
-	echo "#if (GDB_MULTI_ARCH > 1) || !defined (${macro})"
-	echo "#define ${macro} (gdbarch_${function} (current_gdbarch))"
-	echo "#endif"
-	echo "#endif"
+	printf "\n"
+	printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
+	printf "/* set_gdbarch_${function}() - not applicable - pre-initialized. */\n"
+	printf "#if GDB_MULTI_ARCH\n"
+	printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})\n"
+	printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
+	printf "#endif\n"
+	printf "#endif\n"
     fi
 done
 
 # function typedef's
-echo ""
-echo ""
-echo "/* The following are initialized by the target dependant code. */"
-function_list | while do_read # eval read $read
+printf "\n"
+printf "\n"
+printf "/* The following are initialized by the target dependent code. */\n"
+function_list | while do_read
 do
+    if [ "${comment}" ]
+    then
+	echo "${comment}" | sed \
+	    -e '2 s,#,/*,' \
+	    -e '3,$ s,#,  ,' \
+	    -e '$ s,$, */,'
+    fi
     if class_is_predicate_p
     then
-	echo ""
-	echo "#if defined (${macro})"
-	echo "/* Legacy for systems yet to multi-arch ${macro} */"
-#	echo "#if (GDB_MULTI_ARCH <= 2) && defined (${macro})"
-	echo "#define ${macro}_P() (1)"
-	echo "#endif"
-	echo ""
-	echo "/* Default predicate for non- multi-arch targets. */"
-	echo "#if (GDB_MULTI_ARCH == 0) && !defined (${macro}_P)"
-	echo "#define ${macro}_P() (0)"
-	echo "#endif"
-	echo ""
-	echo "extern int gdbarch_${function}_p (struct gdbarch *gdbarch);"
-	echo "#if (GDB_MULTI_ARCH > 1) || !defined (${macro}_P)"
-	echo "#define ${macro}_P() (gdbarch_${function}_p (current_gdbarch))"
-	echo "#endif"
+	printf "\n"
+	printf "#if defined (${macro})\n"
+	printf "/* Legacy for systems yet to multi-arch ${macro} */\n"
+#	printf "#if (GDB_MULTI_ARCH <= GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n"
+	printf "#define ${macro}_P() (1)\n"
+	printf "#endif\n"
+	printf "\n"
+	printf "/* Default predicate for non- multi-arch targets. */\n"
+	printf "#if (!GDB_MULTI_ARCH) && !defined (${macro}_P)\n"
+	printf "#define ${macro}_P() (0)\n"
+	printf "#endif\n"
+	printf "\n"
+	printf "extern int gdbarch_${function}_p (struct gdbarch *gdbarch);\n"
+	printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro}_P)\n"
+	printf "#define ${macro}_P() (gdbarch_${function}_p (current_gdbarch))\n"
+	printf "#endif\n"
     fi
     if class_is_variable_p
     then
 	if fallback_default_p || class_is_predicate_p
 	then
-	    echo ""
-	    echo "/* Default (value) for non- multi-arch platforms. */"
-	    echo "#if (GDB_MULTI_ARCH == 0) && !defined (${macro})"
+	    printf "\n"
+	    printf "/* Default (value) for non- multi-arch platforms. */\n"
+	    printf "#if (!GDB_MULTI_ARCH) && !defined (${macro})\n"
 	    echo "#define ${macro} (${fallbackdefault})" \
 		| sed -e 's/\([^a-z_]\)\(gdbarch[^a-z_]\)/\1current_\2/g'
-	    echo "#endif"
+	    printf "#endif\n"
 	fi
-	echo ""
-	echo "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);"
-	echo "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, ${returntype} ${function});"
-	echo "#if GDB_MULTI_ARCH"
-	echo "#if (GDB_MULTI_ARCH > 1) || !defined (${macro})"
-	echo "#define ${macro} (gdbarch_${function} (current_gdbarch))"
-	echo "#endif"
-	echo "#endif"
+	printf "\n"
+	printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
+	printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, ${returntype} ${function});\n"
+	printf "#if GDB_MULTI_ARCH\n"
+	printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})\n"
+	printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
+	printf "#endif\n"
+	printf "#endif\n"
     fi
     if class_is_function_p
     then
 	if fallback_default_p || class_is_predicate_p
 	then
-	    echo ""
-	    echo "/* Default (function) for non- multi-arch platforms. */"
-	    echo "#if (GDB_MULTI_ARCH == 0) && !defined (${macro})"
+	    printf "\n"
+	    printf "/* Default (function) for non- multi-arch platforms. */\n"
+	    printf "#if (!GDB_MULTI_ARCH) && !defined (${macro})\n"
 	    if [ "${fallbackdefault}" = "0" ]
 	    then
-		echo "#define ${macro}(${actual}) (internal_error (\"${macro}\"), 0)"
+		printf "#define ${macro}(${actual}) (internal_error (\"${macro}\"), 0)\n"
 	    else
 		# FIXME: Should be passing current_gdbarch through!
 		echo "#define ${macro}(${actual}) (${fallbackdefault} (${actual}))" \
 		    | sed -e 's/\([^a-z_]\)\(gdbarch[^a-z_]\)/\1current_\2/g'
 	    fi
-	    echo "#endif"
+	    printf "#endif\n"
 	fi
-	echo ""
-	echo "typedef ${returntype} (gdbarch_${function}_ftype) (${formal});"
+	printf "\n"
+	printf "typedef ${returntype} (gdbarch_${function}_ftype) (${formal});\n"
 	if [ "${formal}" = "void" ]
 	then
-	  echo "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);"
+	  printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
 	else
-	  echo "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch, ${formal});"
+	  printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch, ${formal});\n"
 	fi
-	echo "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, gdbarch_${function}_ftype *${function});"
-	echo "#if GDB_MULTI_ARCH"
-	echo "#if (GDB_MULTI_ARCH > 1) || !defined (${macro})"
+	printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, gdbarch_${function}_ftype *${function});\n"
+	printf "#if GDB_MULTI_ARCH\n"
+	printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})\n"
 	if [ "${actual}" = "" ]
 	then
-	  echo "#define ${macro}() (gdbarch_${function} (current_gdbarch))"
+	  printf "#define ${macro}() (gdbarch_${function} (current_gdbarch))\n"
 	elif [ "${actual}" = "-" ]
 	then
-	  echo "#define ${macro} (gdbarch_${function} (current_gdbarch))"
+	  printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
 	else
-	  echo "#define ${macro}(${actual}) (gdbarch_${function} (current_gdbarch, ${actual}))"
+	  printf "#define ${macro}(${actual}) (gdbarch_${function} (current_gdbarch, ${actual}))\n"
 	fi
-	echo "#endif"
-	echo "#endif"
+	printf "#endif\n"
+	printf "#endif\n"
     fi
 done
 
@@ -632,7 +725,7 @@
 
    The mechanisms below ensures that there is only a loose connection
    between the set-architecture command and the various GDB
-   components.  Each component can independantly register their need
+   components.  Each component can independently register their need
    to maintain architecture specific data with gdbarch.
 
    Pragmatics:
@@ -642,7 +735,7 @@
 
    The more traditional mega-struct containing architecture specific
    data for all the various GDB components was also considered.  Since
-   GDB is built from a variable number of (fairly independant)
+   GDB is built from a variable number of (fairly independent)
    components it was determined that the global aproach was not
    applicable. */
 
@@ -666,12 +759,15 @@
    that the INFO.BYTE_ORDER is non-zero.
 
    The INIT function shall return any of: NULL - indicating that it
-   doesn't reconize the selected architecture; an existing \`\`struct
+   doesn't recognize the selected architecture; an existing \`\`struct
    gdbarch'' from the ARCHES list - indicating that the new
    architecture is just a synonym for an earlier architecture (see
    gdbarch_list_lookup_by_info()); a newly created \`\`struct gdbarch''
-   - that describes the selected architecture (see
-   gdbarch_alloc()). */
+   - that describes the selected architecture (see gdbarch_alloc()).
+
+   The DUMP_TDEP function shall print out all target specific values.
+   Care should be taken to ensure that the function works in both the
+   multi-arch and non- multi-arch cases. */
 
 struct gdbarch_list
 {
@@ -698,9 +794,23 @@
 };
 
 typedef struct gdbarch *(gdbarch_init_ftype) (struct gdbarch_info info, struct gdbarch_list *arches);
+typedef void (gdbarch_dump_tdep_ftype) (struct gdbarch *gdbarch, struct ui_file *file);
 
+/* DEPRECATED - use gdbarch_register() */
 extern void register_gdbarch_init (enum bfd_architecture architecture, gdbarch_init_ftype *);
 
+extern void gdbarch_register (enum bfd_architecture architecture,
+                              gdbarch_init_ftype *,
+                              gdbarch_dump_tdep_ftype *);
+
+
+/* Return a freshly allocated, NULL terminated, array of the valid
+   architecture names.  Since architectures are registered during the
+   _initialize phase this function only returns useful information
+   once initialization has been completed. */
+
+extern const char **gdbarch_printable_names (void);
+
 
 /* Helper function.  Search the list of ARCHES for a GDBARCH that
    matches the information provided by INFO. */
@@ -716,7 +826,10 @@
 extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, struct gdbarch_tdep *tdep);
 
 
-/* Helper function.  Free a partially-constructed \`\`struct gdbarch''.  */
+/* Helper function.  Free a partially-constructed \`\`struct gdbarch''.
+   It is assumed that the caller freeds the \`\`struct
+   gdbarch_tdep''. */
+
 extern void gdbarch_free (struct gdbarch *);
 
 
@@ -725,13 +838,15 @@
    architecture manipulation commands.
 
    The INFO parameter shall be fully initialized (\`\`memset (&INFO,
-   sizeof (info), 0)'' set relevant fields) before gdbarch_update() is
-   called.  gdbarch_update() shall initialize any \`\`default'' fields
-   using information obtained from the previous architecture or
+   sizeof (info), 0)'' set relevant fields) before gdbarch_update_p()
+   is called.  gdbarch_update_p() shall initialize any \`\`default''
+   fields using information obtained from the previous architecture or
    INFO.ABFD (if specified) before calling the corresponding
-   architectures INIT function. */
+   architectures INIT function.
 
-extern int gdbarch_update (struct gdbarch_info info);
+   Returns non-zero if the update succeeds */
+
+extern int gdbarch_update_p (struct gdbarch_info info);
 
 
 
@@ -780,7 +895,7 @@
 
 
 
-/* The target-system-dependant byte order is dynamic */
+/* The target-system-dependent byte order is dynamic */
 
 /* TARGET_BYTE_ORDER_SELECTABLE_P determines if the target endianness
    is selectable at runtime.  The user can use the \`\`set endian''
@@ -820,7 +935,7 @@
 
 
 
-/* The target-system-dependant BFD architecture is dynamic */
+/* The target-system-dependent BFD architecture is dynamic */
 
 extern int target_architecture_auto;
 #ifndef TARGET_ARCHITECTURE_AUTO
@@ -832,15 +947,8 @@
 #define TARGET_ARCHITECTURE (target_architecture + 0)
 #endif
 
-/* Notify the target dependant backend of a change to the selected
-   architecture. A zero return status indicates that the target did
-   not like the change. */
 
-extern int (*target_architecture_hook) (const struct bfd_arch_info *);
-
-
-
-/* The target-system-dependant disassembler is semi-dynamic */
+/* The target-system-dependent disassembler is semi-dynamic */
 
 #include "dis-asm.h"		/* Get defs for disassemble_info */
 
@@ -881,33 +989,22 @@
 #endif
 
 
-/* Set the dynamic target-system-dependant parameters (architecture,
+/* Set the dynamic target-system-dependent parameters (architecture,
    byte-order, ...) using information found in the BFD */
 
 extern void set_gdbarch_from_file (bfd *);
 
 
-/* Explicitly set the dynamic target-system-dependant parameters based
-   on bfd_architecture and machine. */
-
-extern void set_architecture_from_arch_mach (enum bfd_architecture, unsigned long);
-
-
 /* Initialize the current architecture to the "first" one we find on
    our list.  */
 
 extern void initialize_current_architecture (void);
 
-/* Helper function for targets that don't know how my arguments are
-   being passed */
-
-extern int frame_num_args_unknown (struct frame_info *fi);
-
 
 /* gdbarch trace variable */
 extern int gdbarch_debug;
 
-extern void gdbarch_dump (void);
+extern void gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file);
 
 #endif
 EOF
@@ -976,30 +1073,31 @@
 EOF
 
 # gdbarch open the gdbarch object
-echo ""
-echo "/* Maintain the struct gdbarch object */"
-echo ""
-echo "struct gdbarch"
-echo "{"
-echo "  /* basic architectural information */"
-function_list | while do_read # eval read $read
+printf "\n"
+printf "/* Maintain the struct gdbarch object */\n"
+printf "\n"
+printf "struct gdbarch\n"
+printf "{\n"
+printf "  /* basic architectural information */\n"
+function_list | while do_read
 do
     if class_is_info_p
     then
-	echo "  ${returntype} ${function};"
+	printf "  ${returntype} ${function};\n"
     fi
 done
-echo ""
-echo "  /* target specific vector. */"
-echo "  struct gdbarch_tdep *tdep;"
-echo ""
-echo "  /* per-architecture data-pointers */"
-echo "  int nr_data;"
-echo "  void **data;"
-echo ""
-echo "  /* per-architecture swap-regions */"
-echo "  struct gdbarch_swap *swap;"
-echo ""
+printf "\n"
+printf "  /* target specific vector. */\n"
+printf "  struct gdbarch_tdep *tdep;\n"
+printf "  gdbarch_dump_tdep_ftype *dump_tdep;\n"
+printf "\n"
+printf "  /* per-architecture data-pointers */\n"
+printf "  int nr_data;\n"
+printf "  void **data;\n"
+printf "\n"
+printf "  /* per-architecture swap-regions */\n"
+printf "  struct gdbarch_swap *swap;\n"
+printf "\n"
 cat <<EOF
   /* Multi-arch values.
 
@@ -1016,7 +1114,7 @@
      verify_gdbarch(): Confirm that the target updated the field
      correctly.
 
-     gdbarch_dump(): Add a fprintf_unfiltered call to so that the new
+     gdbarch_dump(): Add a fprintf_unfiltered call so that the new
      field is dumped out
 
      \`\`startup_gdbarch()'': Append an initial value to the static
@@ -1028,65 +1126,67 @@
      */
 
 EOF
-function_list | while do_read # eval read $read
+function_list | while do_read
 do
     if class_is_variable_p
     then
-	echo "  ${returntype} ${function};"
+	printf "  ${returntype} ${function};\n"
     elif class_is_function_p
     then
-	echo "  gdbarch_${function}_ftype *${function}${attrib};"
+	printf "  gdbarch_${function}_ftype *${function}${attrib};\n"
     fi
 done
-echo "};"
+printf "};\n"
 
 # A pre-initialized vector
-echo ""
-echo ""
+printf "\n"
+printf "\n"
 cat <<EOF
 /* The default architecture uses host values (for want of a better
    choice). */
 EOF
-echo ""
-echo "extern const struct bfd_arch_info bfd_default_arch_struct;"
-echo ""
-echo "struct gdbarch startup_gdbarch = {"
-echo "  /* basic architecture information */"
-function_list | while do_read # eval read $read
+printf "\n"
+printf "extern const struct bfd_arch_info bfd_default_arch_struct;\n"
+printf "\n"
+printf "struct gdbarch startup_gdbarch =\n"
+printf "{\n"
+printf "  /* basic architecture information */\n"
+function_list | while do_read
 do
     if class_is_info_p
     then
-	echo "  ${staticdefault},"
+	printf "  ${staticdefault},\n"
     fi
 done
 cat <<EOF
-  /* target specific vector */
-  NULL,
+  /* target specific vector and its dump routine */
+  NULL, NULL,
   /*per-architecture data-pointers and swap regions */
   0, NULL, NULL,
   /* Multi-arch values */
 EOF
-function_list | while do_read # eval read $read
+function_list | while do_read
 do
     if class_is_function_p || class_is_variable_p
     then
-	echo "  ${staticdefault},"
+	printf "  ${staticdefault},\n"
     fi
 done
 cat <<EOF
   /* startup_gdbarch() */
 };
+
 struct gdbarch *current_gdbarch = &startup_gdbarch;
 EOF
 
 # Create a new gdbarch struct
-echo ""
-echo ""
+printf "\n"
+printf "\n"
 cat <<EOF
-/* Create a new \`\`struct gdbarch'' based in information provided by
+/* Create a new \`\`struct gdbarch'' based on information provided by
    \`\`struct gdbarch_info''. */
 EOF
-echo ""
+printf "\n"
 cat <<EOF
 struct gdbarch *
 gdbarch_alloc (const struct gdbarch_info *info,
@@ -1097,23 +1197,23 @@
 
   gdbarch->tdep = tdep;
 EOF
-echo ""
-function_list | while do_read # eval read $read
+printf "\n"
+function_list | while do_read
 do
     if class_is_info_p
     then
-	echo "  gdbarch->${function} = info->${function};"
+	printf "  gdbarch->${function} = info->${function};\n"
     fi
 done
-echo ""
-echo "  /* Force the explicit initialization of these. */"
-function_list | while do_read # eval read $read
+printf "\n"
+printf "  /* Force the explicit initialization of these. */\n"
+function_list | while do_read
 do
     if class_is_function_p || class_is_variable_p
     then
 	if [ "${predefault}" != "" -a "${predefault}" != "0" ]
 	then
-	  echo "  gdbarch->${function} = ${predefault};"
+	  printf "  gdbarch->${function} = ${predefault};\n"
 	fi
     fi
 done
@@ -1125,14 +1225,15 @@
 EOF
 
 # Free a gdbarch struct.
-echo ""
-echo ""
+printf "\n"
+printf "\n"
 cat <<EOF
 /* Free a gdbarch struct.  This should never happen in normal
    operation --- once you've created a gdbarch, you keep it around.
    However, if an architecture's init function encounters an error
    building the structure, it may need to clean up a partially
    constructed gdbarch.  */
+
 void
 gdbarch_free (struct gdbarch *arch)
 {
@@ -1142,16 +1243,16 @@
 EOF
 
 # verify a new architecture
-echo ""
-echo ""
-echo "/* Ensure that all values in a GDBARCH are reasonable. */"
-echo ""
+printf "\n"
+printf "\n"
+printf "/* Ensure that all values in a GDBARCH are reasonable. */\n"
+printf "\n"
 cat <<EOF
 static void
 verify_gdbarch (struct gdbarch *gdbarch)
 {
   /* Only perform sanity checks on a multi-arch target. */
-  if (GDB_MULTI_ARCH <= 0)
+  if (!GDB_MULTI_ARCH)
     return;
   /* fundamental */
   if (gdbarch->byte_order == 0)
@@ -1160,39 +1261,39 @@
     internal_error ("verify_gdbarch: bfd_arch_info unset");
   /* Check those that need to be defined for the given multi-arch level. */
 EOF
-function_list | while do_read # eval read $read
+function_list | while do_read
 do
     if class_is_function_p || class_is_variable_p
     then
 	if [ "${invalid_p}" = "0" ]
 	then
-	    echo "  /* Skip verify of ${function}, invalid_p == 0 */"
+	    printf "  /* Skip verify of ${function}, invalid_p == 0 */\n"
 	elif class_is_predicate_p
 	then
-	    echo "  /* Skip verify of ${function}, has predicate */"
+	    printf "  /* Skip verify of ${function}, has predicate */\n"
 	# FIXME: See do_read for potential simplification
  	elif [ "${invalid_p}" -a "${postdefault}" ]
 	then
-	    echo "  if (${invalid_p})"
-	    echo "    gdbarch->${function} = ${postdefault};"
+	    printf "  if (${invalid_p})\n"
+	    printf "    gdbarch->${function} = ${postdefault};\n"
 	elif [ "${predefault}" -a "${postdefault}" ]
 	then
-	    echo "  if (gdbarch->${function} == ${predefault})"
-	    echo "    gdbarch->${function} = ${postdefault};"
+	    printf "  if (gdbarch->${function} == ${predefault})\n"
+	    printf "    gdbarch->${function} = ${postdefault};\n"
 	elif [ "${postdefault}" ]
 	then
-	    echo "  if (gdbarch->${function} == 0)"
-	    echo "    gdbarch->${function} = ${postdefault};"
+	    printf "  if (gdbarch->${function} == 0)\n"
+	    printf "    gdbarch->${function} = ${postdefault};\n"
 	elif [ "${invalid_p}" ]
 	then
-	    echo "  if ((GDB_MULTI_ARCH >= ${level})"
-	    echo "      && (${invalid_p}))"
-	    echo "    internal_error (\"gdbarch: verify_gdbarch: ${function} invalid\");"
+	    printf "  if ((GDB_MULTI_ARCH >= ${level})\n"
+	    printf "      && (${invalid_p}))\n"
+	    printf "    internal_error (\"gdbarch: verify_gdbarch: ${function} invalid\");\n"
 	elif [ "${predefault}" ]
 	then
-	    echo "  if ((GDB_MULTI_ARCH >= ${level})"
-	    echo "      && (gdbarch->${function} == ${predefault}))"
-	    echo "    internal_error (\"gdbarch: verify_gdbarch: ${function} invalid\");"
+	    printf "  if ((GDB_MULTI_ARCH >= ${level})\n"
+	    printf "      && (gdbarch->${function} == ${predefault}))\n"
+	    printf "    internal_error (\"gdbarch: verify_gdbarch: ${function} invalid\");\n"
 	fi
     fi
 done
@@ -1201,144 +1302,179 @@
 EOF
 
 # dump the structure
-echo ""
-echo ""
-echo "/* Print out the details of the current architecture. */"
-echo ""
+printf "\n"
+printf "\n"
 cat <<EOF
+/* Print out the details of the current architecture. */
+
+/* NOTE/WARNING: The parameter is called \`\`current_gdbarch'' so that it
+   just happens to match the global variable \`\`current_gdbarch''.  That
+   way macros refering to that variable get the local and not the global
+   version - ulgh.  Once everything is parameterised with gdbarch, this
+   will go away. */
+
 void
-gdbarch_dump (void)
+gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
 {
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: GDB_MULTI_ARCH = %d\\n",
+                      GDB_MULTI_ARCH);
 EOF
-function_list | while do_read # eval read $read
+function_list | while do_read
 do
-    echo "#ifdef ${macro}"
+    if [ "${returntype}" = "void" ]
+    then
+	printf "#if defined (${macro}) && GDB_MULTI_ARCH\n"
+	printf "  /* Macro might contain \`[{}]' when not multi-arch */\n"
+    else
+	printf "#ifdef ${macro}\n"
+    fi
     if class_is_function_p
     then
-	echo "  fprintf_unfiltered (gdb_stdlog,"
-	echo "                      \"gdbarch_update: ${macro} = 0x%08lx\\n\","
-	echo "                      (long) current_gdbarch->${function}"
-	echo "                      /*${macro} ()*/);"
+	printf "  fprintf_unfiltered (file,\n"
+	printf "                      \"gdbarch_dump: %%s # %%s\\\\n\",\n"
+	printf "                      \"${macro}(${actual})\",\n"
+	printf "                      XSTRING (${macro} (${actual})));\n"
     else
-	if [ "${print_p}" ]
-	then
-	  echo "  if (${print_p})"
-	  echo "    fprintf_unfiltered (gdb_stdlog,"
-	  echo "                        \"gdbarch_update: ${macro} = ${fmt}\\n\","
-	  echo "                        ${print});"
-	else
-	  echo "  fprintf_unfiltered (gdb_stdlog,"
-	  echo "                      \"gdbarch_update: ${macro} = ${fmt}\\n\","
-	  echo "                      ${print});"
-	fi
+	printf "  fprintf_unfiltered (file,\n"
+	printf "                      \"gdbarch_dump: ${macro} # %%s\\\\n\",\n"
+	printf "                      XSTRING (${macro}));\n"
     fi
-    echo "#endif"
+    printf "#endif\n"
+done
+function_list | while do_read
+do
+    printf "#ifdef ${macro}\n"
+    if [ "${print_p}" = "()" ]
+    then
+	printf "  gdbarch_dump_${function} (current_gdbarch);\n"
+    elif [ "${print_p}" = "0" ]
+    then
+	printf "  /* skip print of ${macro}, print_p == 0. */\n"
+    elif [ "${print_p}" ]
+    then
+	printf "  if (${print_p})\n"
+	printf "    fprintf_unfiltered (file,\n"
+	printf "                        \"gdbarch_dump: ${macro} = %s\\\\n\",\n" "${fmt}"
+	printf "                        ${print});\n"
+    elif class_is_function_p
+    then
+	printf "  if (GDB_MULTI_ARCH)\n"
+	printf "    fprintf_unfiltered (file,\n"
+	printf "                        \"gdbarch_dump: ${macro} = 0x%%08lx\\\\n\",\n"
+	printf "                        (long) current_gdbarch->${function}\n"
+	printf "                        /*${macro} ()*/);\n"
+    else
+	printf "  fprintf_unfiltered (file,\n"
+	printf "                      \"gdbarch_dump: ${macro} = %s\\\\n\",\n" "${fmt}"
+	printf "                      ${print});\n"
+    fi
+    printf "#endif\n"
 done
 cat <<EOF
-  fprintf_unfiltered (gdb_stdlog,
-                      "gdbarch_update: GDB_MULTI_ARCH = %d\\n",
-                      GDB_MULTI_ARCH);
+  if (current_gdbarch->dump_tdep != NULL)
+    current_gdbarch->dump_tdep (current_gdbarch, file);
 }
 EOF
 
 
 # GET/SET
-echo ""
+printf "\n"
 cat <<EOF
 struct gdbarch_tdep *
 gdbarch_tdep (struct gdbarch *gdbarch)
 {
   if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\n");
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\\n");
   return gdbarch->tdep;
 }
 EOF
-echo ""
-function_list | while do_read # eval read $read
+printf "\n"
+function_list | while do_read
 do
     if class_is_predicate_p
     then
-	echo ""
-	echo "int"
-	echo "gdbarch_${function}_p (struct gdbarch *gdbarch)"
-	echo "{"
+	printf "\n"
+	printf "int\n"
+	printf "gdbarch_${function}_p (struct gdbarch *gdbarch)\n"
+	printf "{\n"
 	if [ "${valid_p}" ]
 	then
-	    echo "  return ${valid_p};"
+	    printf "  return ${valid_p};\n"
 	else
-	    echo "#error \"gdbarch_${function}_p: not defined\""
+	    printf "#error \"gdbarch_${function}_p: not defined\"\n"
 	fi
-	echo "}"
+	printf "}\n"
     fi
     if class_is_function_p
     then
-	echo ""
-	echo "${returntype}"
+	printf "\n"
+	printf "${returntype}\n"
 	if [ "${formal}" = "void" ]
 	then
-	  echo "gdbarch_${function} (struct gdbarch *gdbarch)"
+	  printf "gdbarch_${function} (struct gdbarch *gdbarch)\n"
 	else
-	  echo "gdbarch_${function} (struct gdbarch *gdbarch, ${formal})"
+	  printf "gdbarch_${function} (struct gdbarch *gdbarch, ${formal})\n"
 	fi
-	echo "{"
-        echo "  if (gdbarch->${function} == 0)"
-        echo "    internal_error (\"gdbarch: gdbarch_${function} invalid\");"
-	echo "  if (gdbarch_debug >= 2)"
-	echo "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\n\");"
+	printf "{\n"
+        printf "  if (gdbarch->${function} == 0)\n"
+        printf "    internal_error (\"gdbarch: gdbarch_${function} invalid\");\n"
+	printf "  if (gdbarch_debug >= 2)\n"
+	printf "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n"
         test "${actual}" = "-" && actual=""
        	if [ "${returntype}" = "void" ]
 	then
-	  echo "  gdbarch->${function} (${actual});"
+	  printf "  gdbarch->${function} (${actual});\n"
 	else
-	  echo "  return gdbarch->${function} (${actual});"
+	  printf "  return gdbarch->${function} (${actual});\n"
 	fi
-	echo "}"
-	echo ""
-	echo "void"
-	echo "set_gdbarch_${function} (struct gdbarch *gdbarch,"
-        echo "            `echo ${function} | sed -e 's/./ /g'`  gdbarch_${function}_ftype ${function})"
-	echo "{"
-	echo "  gdbarch->${function} = ${function};"
-	echo "}"
+	printf "}\n"
+	printf "\n"
+	printf "void\n"
+	printf "set_gdbarch_${function} (struct gdbarch *gdbarch,\n"
+        printf "            `echo ${function} | sed -e 's/./ /g'`  gdbarch_${function}_ftype ${function})\n"
+	printf "{\n"
+	printf "  gdbarch->${function} = ${function};\n"
+	printf "}\n"
     elif class_is_variable_p
     then
-	echo ""
-	echo "${returntype}"
-	echo "gdbarch_${function} (struct gdbarch *gdbarch)"
-	echo "{"
+	printf "\n"
+	printf "${returntype}\n"
+	printf "gdbarch_${function} (struct gdbarch *gdbarch)\n"
+	printf "{\n"
 	if [ "${invalid_p}" = "0" ]
 	then
-	    echo "  /* Skip verify of ${function}, invalid_p == 0 */"
+	    printf "  /* Skip verify of ${function}, invalid_p == 0 */\n"
 	elif [ "${invalid_p}" ]
 	then
-	  echo "  if (${invalid_p})"
-	  echo "    internal_error (\"gdbarch: gdbarch_${function} invalid\");"
+	  printf "  if (${invalid_p})\n"
+	  printf "    internal_error (\"gdbarch: gdbarch_${function} invalid\");\n"
 	elif [ "${predefault}" ]
 	then
-	  echo "  if (gdbarch->${function} == ${predefault})"
-	  echo "    internal_error (\"gdbarch: gdbarch_${function} invalid\");"
+	  printf "  if (gdbarch->${function} == ${predefault})\n"
+	  printf "    internal_error (\"gdbarch: gdbarch_${function} invalid\");\n"
 	fi
-	echo "  if (gdbarch_debug >= 2)"
-	echo "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\n\");"
-	echo "  return gdbarch->${function};"
-	echo "}"
-	echo ""
-	echo "void"
-	echo "set_gdbarch_${function} (struct gdbarch *gdbarch,"
-        echo "            `echo ${function} | sed -e 's/./ /g'`  ${returntype} ${function})"
-	echo "{"
-	echo "  gdbarch->${function} = ${function};"
-	echo "}"
+	printf "  if (gdbarch_debug >= 2)\n"
+	printf "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n"
+	printf "  return gdbarch->${function};\n"
+	printf "}\n"
+	printf "\n"
+	printf "void\n"
+	printf "set_gdbarch_${function} (struct gdbarch *gdbarch,\n"
+        printf "            `echo ${function} | sed -e 's/./ /g'`  ${returntype} ${function})\n"
+	printf "{\n"
+	printf "  gdbarch->${function} = ${function};\n"
+	printf "}\n"
     elif class_is_info_p
     then
-	echo ""
-	echo "${returntype}"
-	echo "gdbarch_${function} (struct gdbarch *gdbarch)"
-	echo "{"
-	echo "  if (gdbarch_debug >= 2)"
-	echo "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\n\");"
-	echo "  return gdbarch->${function};"
-	echo "}"
+	printf "\n"
+	printf "${returntype}\n"
+	printf "gdbarch_${function} (struct gdbarch *gdbarch)\n"
+	printf "{\n"
+	printf "  if (gdbarch_debug >= 2)\n"
+	printf "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n"
+	printf "  return gdbarch->${function};\n"
+	printf "}\n"
     fi
 done
 
@@ -1346,7 +1482,7 @@
 cat <<EOF
 
 
-/* Keep a registrary of per-architecture data-pointers required by GDB
+/* Keep a registry of per-architecture data-pointers required by GDB
    modules. */
 
 struct gdbarch_data
@@ -1361,13 +1497,13 @@
   struct gdbarch_data_registration *next;
 };
 
-struct gdbarch_data_registrary
+struct gdbarch_data_registry
 {
   int nr;
   struct gdbarch_data_registration *registrations;
 };
 
-struct gdbarch_data_registrary gdbarch_data_registrary =
+struct gdbarch_data_registry gdbarch_data_registry =
 {
   0, NULL,
 };
@@ -1376,14 +1512,14 @@
 register_gdbarch_data (gdbarch_data_ftype *init)
 {
   struct gdbarch_data_registration **curr;
-  for (curr = &gdbarch_data_registrary.registrations;
+  for (curr = &gdbarch_data_registry.registrations;
        (*curr) != NULL;
        curr = &(*curr)->next);
   (*curr) = XMALLOC (struct gdbarch_data_registration);
   (*curr)->next = NULL;
   (*curr)->init = init;
   (*curr)->data = XMALLOC (struct gdbarch_data);
-  (*curr)->data->index = gdbarch_data_registrary.nr++;
+  (*curr)->data->index = gdbarch_data_registry.nr++;
   return (*curr)->data;
 }
 
@@ -1394,9 +1530,9 @@
 init_gdbarch_data (struct gdbarch *gdbarch)
 {
   struct gdbarch_data_registration *rego;
-  gdbarch->nr_data = gdbarch_data_registrary.nr + 1;
+  gdbarch->nr_data = gdbarch_data_registry.nr + 1;
   gdbarch->data = xmalloc (sizeof (void*) * gdbarch->nr_data);
-  for (rego = gdbarch_data_registrary.registrations;
+  for (rego = gdbarch_data_registry.registrations;
        rego != NULL;
        rego = rego->next)
     {
@@ -1410,8 +1546,7 @@
    data-pointer. */
 
 void *
-gdbarch_data (data)
-     struct gdbarch_data *data;
+gdbarch_data (struct gdbarch_data *data)
 {
   if (data->index >= current_gdbarch->nr_data)
     internal_error ("gdbarch_data: request for non-existant data.");
@@ -1420,7 +1555,7 @@
 
 
 
-/* Keep a registrary of swaped data required by GDB modules. */
+/* Keep a registry of swapped data required by GDB modules. */
 
 struct gdbarch_swap
 {
@@ -1437,13 +1572,13 @@
   struct gdbarch_swap_registration *next;
 };
 
-struct gdbarch_swap_registrary
+struct gdbarch_swap_registry
 {
   int nr;
   struct gdbarch_swap_registration *registrations;
 };
 
-struct gdbarch_swap_registrary gdbarch_swap_registrary = 
+struct gdbarch_swap_registry gdbarch_swap_registry = 
 {
   0, NULL,
 };
@@ -1454,7 +1589,7 @@
 		       gdbarch_swap_ftype *init)
 {
   struct gdbarch_swap_registration **rego;
-  for (rego = &gdbarch_swap_registrary.registrations;
+  for (rego = &gdbarch_swap_registry.registrations;
        (*rego) != NULL;
        rego = &(*rego)->next);
   (*rego) = XMALLOC (struct gdbarch_swap_registration);
@@ -1470,7 +1605,7 @@
 {
   struct gdbarch_swap_registration *rego;
   struct gdbarch_swap **curr = &gdbarch->swap;
-  for (rego = gdbarch_swap_registrary.registrations;
+  for (rego = gdbarch_swap_registry.registrations;
        rego != NULL;
        rego = rego->next)
     {
@@ -1509,32 +1644,78 @@
 }
 
 
-/* Keep a registrary of the architectures known by GDB. */
+/* Keep a registry of the architectures known by GDB. */
 
-struct gdbarch_init_registration
+struct gdbarch_registration
 {
   enum bfd_architecture bfd_architecture;
   gdbarch_init_ftype *init;
+  gdbarch_dump_tdep_ftype *dump_tdep;
   struct gdbarch_list *arches;
-  struct gdbarch_init_registration *next;
+  struct gdbarch_registration *next;
 };
 
-static struct gdbarch_init_registration *gdbarch_init_registrary = NULL;
+static struct gdbarch_registration *gdbarch_registry = NULL;
+
+static void
+append_name (const char ***buf, int *nr, const char *name)
+{
+  *buf = xrealloc (*buf, sizeof (char**) * (*nr + 1));
+  (*buf)[*nr] = name;
+  *nr += 1;
+}
+
+const char **
+gdbarch_printable_names (void)
+{
+  if (GDB_MULTI_ARCH)
+    {
+      /* Accumulate a list of names based on the registed list of
+         architectures. */
+      enum bfd_architecture a;
+      int nr_arches = 0;
+      const char **arches = NULL;
+      struct gdbarch_registration *rego;
+      for (rego = gdbarch_registry;
+	   rego != NULL;
+	   rego = rego->next)
+	{
+	  const struct bfd_arch_info *ap;
+	  ap = bfd_lookup_arch (rego->bfd_architecture, 0);
+	  if (ap == NULL)
+	    internal_error ("gdbarch_architecture_names: multi-arch unknown");
+	  do
+	    {
+	      append_name (&arches, &nr_arches, ap->printable_name);
+	      ap = ap->next;
+	    }
+	  while (ap != NULL);
+	}
+      append_name (&arches, &nr_arches, NULL);
+      return arches;
+    }
+  else
+    /* Just return all the architectures that BFD knows.  Assume that
+       the legacy architecture framework supports them. */
+    return bfd_arch_list ();
+}
+
 
 void
-register_gdbarch_init (enum bfd_architecture bfd_architecture,
-                       gdbarch_init_ftype *init)
+gdbarch_register (enum bfd_architecture bfd_architecture,
+                  gdbarch_init_ftype *init,
+		  gdbarch_dump_tdep_ftype *dump_tdep)
 {
-  struct gdbarch_init_registration **curr;
+  struct gdbarch_registration **curr;
   const struct bfd_arch_info *bfd_arch_info;
-  /* Check that BFD reconizes this architecture */
+  /* Check that BFD recognizes this architecture */
   bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0);
   if (bfd_arch_info == NULL)
     {
       internal_error ("gdbarch: Attempt to register unknown architecture (%d)", bfd_architecture);
     }
   /* Check that we haven't seen this architecture before */
-  for (curr = &gdbarch_init_registrary;
+  for (curr = &gdbarch_registry;
        (*curr) != NULL;
        curr = &(*curr)->next)
     {
@@ -1548,13 +1729,26 @@
 			bfd_arch_info->printable_name,
 			(long) init);
   /* Append it */
-  (*curr) = XMALLOC (struct gdbarch_init_registration);
+  (*curr) = XMALLOC (struct gdbarch_registration);
   (*curr)->bfd_architecture = bfd_architecture;
   (*curr)->init = init;
+  (*curr)->dump_tdep = dump_tdep;
   (*curr)->arches = NULL;
   (*curr)->next = NULL;
+  /* When non- multi-arch, install whatever target dump routine we've
+     been provided - hopefully that routine has been written correctly
+     and works regardless of multi-arch. */
+  if (!GDB_MULTI_ARCH && dump_tdep != NULL
+      && startup_gdbarch.dump_tdep == NULL)
+    startup_gdbarch.dump_tdep = dump_tdep;
 }
-  
+
+void
+register_gdbarch_init (enum bfd_architecture bfd_architecture,
+		       gdbarch_init_ftype *init)
+{
+  gdbarch_register (bfd_architecture, init, NULL);
+}
 
 
 /* Look for an architecture using gdbarch_info.  Base search on only
@@ -1580,11 +1774,11 @@
    failed. */
 
 int
-gdbarch_update (struct gdbarch_info info)
+gdbarch_update_p (struct gdbarch_info info)
 {
   struct gdbarch *new_gdbarch;
   struct gdbarch_list **list;
-  struct gdbarch_init_registration *rego;
+  struct gdbarch_registration *rego;
 
   /* Fill in any missing bits. Most important is the bfd_architecture
      which is used to select the target architecture. */
@@ -1618,38 +1812,40 @@
   /* A default for abfd? */
 
   /* Find the target that knows about this architecture. */
-  for (rego = gdbarch_init_registrary;
-       rego != NULL && rego->bfd_architecture != info.bfd_architecture;
-       rego = rego->next);
+  for (rego = gdbarch_registry;
+       rego != NULL;
+       rego = rego->next)
+    if (rego->bfd_architecture == info.bfd_architecture)
+      break;
   if (rego == NULL)
     {
       if (gdbarch_debug)
-	fprintf_unfiltered (gdb_stdlog, "gdbarch_update: No matching architecture\n");
+	fprintf_unfiltered (gdb_stdlog, "gdbarch_update: No matching architecture\\n");
       return 0;
     }
 
   if (gdbarch_debug)
     {
       fprintf_unfiltered (gdb_stdlog,
-			  "gdbarch_update: info.bfd_architecture %d (%s)\n",
+			  "gdbarch_update: info.bfd_architecture %d (%s)\\n",
 			  info.bfd_architecture,
 			  bfd_lookup_arch (info.bfd_architecture, 0)->printable_name);
       fprintf_unfiltered (gdb_stdlog,
-			  "gdbarch_update: info.bfd_arch_info %s\n",
+			  "gdbarch_update: info.bfd_arch_info %s\\n",
 			  (info.bfd_arch_info != NULL
 			   ? info.bfd_arch_info->printable_name
 			   : "(null)"));
       fprintf_unfiltered (gdb_stdlog,
-			  "gdbarch_update: info.byte_order %d (%s)\n",
+			  "gdbarch_update: info.byte_order %d (%s)\\n",
 			  info.byte_order,
 			  (info.byte_order == BIG_ENDIAN ? "big"
 			   : info.byte_order == LITTLE_ENDIAN ? "little"
 			   : "default"));
       fprintf_unfiltered (gdb_stdlog,
-			  "gdbarch_update: info.abfd 0x%lx\n",
+			  "gdbarch_update: info.abfd 0x%lx\\n",
 			  (long) info.abfd);
       fprintf_unfiltered (gdb_stdlog,
-			  "gdbarch_update: info.tdep_info 0x%lx\n",
+			  "gdbarch_update: info.tdep_info 0x%lx\\n",
 			  (long) info.tdep_info);
     }
 
@@ -1660,7 +1856,7 @@
   if (new_gdbarch == NULL)
     {
       if (gdbarch_debug)
-	fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Target rejected architecture\n");
+	fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Target rejected architecture\\n");
       return 0;
     }
 
@@ -1668,7 +1864,7 @@
   if (current_gdbarch == new_gdbarch)
     {
       if (gdbarch_debug)
-	fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Architecture 0x%08lx (%s) unchanged\n",
+	fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Architecture 0x%08lx (%s) unchanged\\n",
 			    (long) new_gdbarch,
 			    new_gdbarch->bfd_arch_info->printable_name);
       return 1;
@@ -1685,7 +1881,8 @@
       if ((*list)->gdbarch == new_gdbarch)
 	{
 	  if (gdbarch_debug)
-	    fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Previous architecture 0x%08lx (%s) selected\n",
+	    fprintf_unfiltered (gdb_stdlog,
+                                "gdbarch_update: Previous architecture 0x%08lx (%s) selected\\n",
 				(long) new_gdbarch,
 				new_gdbarch->bfd_arch_info->printable_name);
 	  current_gdbarch = new_gdbarch;
@@ -1693,7 +1890,7 @@
 	  return 1;
 	}
     }
-    
+
   /* Append this new architecture to this targets list. */
   (*list) = XMALLOC (struct gdbarch_list);
   (*list)->next = NULL;
@@ -1704,13 +1901,14 @@
   if (gdbarch_debug)
     {
       fprintf_unfiltered (gdb_stdlog,
-			  "gdbarch_update: New architecture 0x%08lx (%s) selected\n",
+			  "gdbarch_update: New architecture 0x%08lx (%s) selected\\n",
 			  (long) new_gdbarch,
 			  new_gdbarch->bfd_arch_info->printable_name);
-      gdbarch_dump ();
     }
   
-  /* Check that the newly installed architecture is valid.  */
+  /* Check that the newly installed architecture is valid.  Plug in
+     any post init values.  */
+  new_gdbarch->dump_tdep = rego->dump_tdep;
   verify_gdbarch (new_gdbarch);
 
   /* Initialize the per-architecture memory (swap) areas.
@@ -1723,366 +1921,13 @@
      must be updated before these modules are called. */
   init_gdbarch_data (new_gdbarch);
   
+  if (gdbarch_debug)
+    gdbarch_dump (current_gdbarch, gdb_stdlog);
+
   return 1;
 }
 
 
-
-/* Functions to manipulate the endianness of the target.  */
-
-#ifdef TARGET_BYTE_ORDER_SELECTABLE
-/* compat - Catch old targets that expect a selectable byte-order to
-   default to BIG_ENDIAN */
-#ifndef TARGET_BYTE_ORDER_DEFAULT
-#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN
-#endif
-#endif
-#if !TARGET_BYTE_ORDER_SELECTABLE_P
-#ifndef TARGET_BYTE_ORDER_DEFAULT
-/* compat - Catch old non byte-order selectable targets that do not
-   define TARGET_BYTE_ORDER_DEFAULT and instead expect
-   TARGET_BYTE_ORDER to be used as the default.  For targets that
-   defined neither TARGET_BYTE_ORDER nor TARGET_BYTE_ORDER_DEFAULT the
-   below will get a strange compiler warning. */
-#define TARGET_BYTE_ORDER_DEFAULT TARGET_BYTE_ORDER
-#endif
-#endif
-#ifndef TARGET_BYTE_ORDER_DEFAULT
-#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN /* arbitrary */
-#endif
-int target_byte_order = TARGET_BYTE_ORDER_DEFAULT;
-int target_byte_order_auto = 1;
-
-/* Chain containing the \"set endian\" commands.  */
-static struct cmd_list_element *endianlist = NULL;
-
-/* Called by \`\`show endian''.  */
-static void
-show_endian (char *args, int from_tty)
-{
-  char *msg =
-    (TARGET_BYTE_ORDER_AUTO
-     ? "The target endianness is set automatically (currently %s endian)\n"
-     : "The target is assumed to be %s endian\n");
-  printf_unfiltered (msg, (TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little"));
-}
-
-/* Called if the user enters \`\`set endian'' without an argument.  */
-static void
-set_endian (char *args, int from_tty)
-{
-  printf_unfiltered ("\"set endian\" must be followed by \"auto\", \"big\" or \"little\".\n");
-  show_endian (args, from_tty);
-}
-
-/* Called by \`\`set endian big''.  */
-static void
-set_endian_big (char *args, int from_tty)
-{
-  if (TARGET_BYTE_ORDER_SELECTABLE_P)
-    {
-      target_byte_order = BIG_ENDIAN;
-      target_byte_order_auto = 0;
-      if (GDB_MULTI_ARCH)
-	{
-	  struct gdbarch_info info;
-	  memset (&info, 0, sizeof info);
-	  info.byte_order = BIG_ENDIAN;
-	  gdbarch_update (info);
-	}
-    }
-  else
-    {
-      printf_unfiltered ("Byte order is not selectable.");
-      show_endian (args, from_tty);
-    }
-}
-
-/* Called by \`\`set endian little''.  */
-static void
-set_endian_little (char *args, int from_tty)
-{
-  if (TARGET_BYTE_ORDER_SELECTABLE_P)
-    {
-      target_byte_order = LITTLE_ENDIAN;
-      target_byte_order_auto = 0;
-      if (GDB_MULTI_ARCH)
-	{
-	  struct gdbarch_info info;
-	  memset (&info, 0, sizeof info);
-	  info.byte_order = LITTLE_ENDIAN;
-	  gdbarch_update (info);
-	}
-    }
-  else
-    {
-      printf_unfiltered ("Byte order is not selectable.");
-      show_endian (args, from_tty);
-    }
-}
-
-/* Called by \`\`set endian auto''.  */
-static void
-set_endian_auto (char *args, int from_tty)
-{
-  if (TARGET_BYTE_ORDER_SELECTABLE_P)
-    {
-      target_byte_order_auto = 1;
-    }
-  else
-    {
-      printf_unfiltered ("Byte order is not selectable.");
-      show_endian (args, from_tty);
-    }
-}
-
-/* Set the endianness from a BFD.  */
-static void
-set_endian_from_file (bfd *abfd)
-{
-  if (TARGET_BYTE_ORDER_SELECTABLE_P)
-    {
-      int want;
-      
-      if (bfd_big_endian (abfd))
-	want = BIG_ENDIAN;
-      else
-	want = LITTLE_ENDIAN;
-      if (TARGET_BYTE_ORDER_AUTO)
-	target_byte_order = want;
-      else if (TARGET_BYTE_ORDER != want)
-	warning ("%s endian file does not match %s endian target.",
-		 want == BIG_ENDIAN ? "big" : "little",
-		 TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little");
-    }
-  else
-    {
-      if (bfd_big_endian (abfd)
-	  ? TARGET_BYTE_ORDER != BIG_ENDIAN
-	  : TARGET_BYTE_ORDER == BIG_ENDIAN)
-	warning ("%s endian file does not match %s endian target.",
-		 bfd_big_endian (abfd) ? "big" : "little",
-		 TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little");
-    }
-}
-
-
-
-/* Functions to manipulate the architecture of the target */
-
-enum set_arch { set_arch_auto, set_arch_manual };
-
-int target_architecture_auto = 1;
-extern const struct bfd_arch_info bfd_default_arch_struct;
-const struct bfd_arch_info *target_architecture = &bfd_default_arch_struct;
-int (*target_architecture_hook) (const struct bfd_arch_info *ap);
-
-static void show_endian (char *, int);
-static void set_endian (char *, int);
-static void set_endian_big (char *, int);
-static void set_endian_little (char *, int);
-static void set_endian_auto (char *, int);
-static void set_endian_from_file (bfd *);
-static int arch_ok (const struct bfd_arch_info *arch);
-static void set_arch (const struct bfd_arch_info *arch, enum set_arch type);
-static void show_architecture (char *, int);
-static void set_architecture (char *, int);
-static void info_architecture (char *, int);
-static void set_architecture_from_file (bfd *);
-
-/* Do the real work of changing the current architecture */
-
-static int
-arch_ok (const struct bfd_arch_info *arch)
-{
-  /* Should be performing the more basic check that the binary is
-     compatible with GDB. */
-  /* Check with the target that the architecture is valid. */
-  return (target_architecture_hook == NULL
-	  || target_architecture_hook (arch));
-}
-
-static void
-set_arch (const struct bfd_arch_info *arch,
-          enum set_arch type)
-{
-  switch (type)
-    {
-    case set_arch_auto:
-      if (!arch_ok (arch))
-	warning ("Target may not support %s architecture",
-		 arch->printable_name);
-      target_architecture = arch;
-      break;
-    case set_arch_manual:
-      if (!arch_ok (arch))
-	{
-	  printf_unfiltered ("Target does not support \`%s' architecture.\n",
-			     arch->printable_name);
-	}
-      else
-	{
-	  target_architecture_auto = 0;
-	  target_architecture = arch;
-	}
-      break;
-    }
-  if (gdbarch_debug)
-    gdbarch_dump ();
-}
-
-/* Called if the user enters \`\`show architecture'' without an argument. */
-static void
-show_architecture (char *args, int from_tty)
-{
-  const char *arch;
-  arch = TARGET_ARCHITECTURE->printable_name;
-  if (target_architecture_auto)
-    printf_filtered ("The target architecture is set automatically (currently %s)\n", arch);
-  else
-    printf_filtered ("The target architecture is assumed to be %s\n", arch);
-}
-
-/* Called if the user enters \`\`set architecture'' with or without an
-   argument. */
-static void
-set_architecture (char *args, int from_tty)
-{
-  if (args == NULL)
-    {
-      printf_unfiltered ("\"set architecture\" must be followed by \"auto\" or an architecture name.\n");
-    }
-  else if (strcmp (args, "auto") == 0)
-    {
-      target_architecture_auto = 1;
-    }
-  else if (GDB_MULTI_ARCH)
-    {
-      const struct bfd_arch_info *arch = bfd_scan_arch (args);
-      if (arch == NULL)
-	printf_unfiltered ("Architecture \`%s' not reconized.\n", args);
-      else
-	{
-	  struct gdbarch_info info;
-	  memset (&info, 0, sizeof info);
-	  info.bfd_arch_info = arch;
-	  if (gdbarch_update (info))
-	    target_architecture_auto = 0;
-	  else
-	    printf_unfiltered ("Architecture \`%s' not reconized.\n", args);
-	}
-    }
-  else
-    {
-      const struct bfd_arch_info *arch = bfd_scan_arch (args);
-      if (arch != NULL)
-	set_arch (arch, set_arch_manual);
-      else
-	printf_unfiltered ("Architecture \`%s' not reconized.\n", args);
-    }
-}
-
-/* Called if the user enters \`\`info architecture'' without an argument. */
-static void
-info_architecture (char *args, int from_tty)
-{
-  enum bfd_architecture a;
-  if (GDB_MULTI_ARCH)
-    {
-      if (gdbarch_init_registrary != NULL)
-	{
-	  struct gdbarch_init_registration *rego;
-	  printf_filtered ("Available architectures are:\n");
-	  for (rego = gdbarch_init_registrary;
-	       rego != NULL;
-	       rego = rego->next)
-	    {
-	      const struct bfd_arch_info *ap;
-	      ap = bfd_lookup_arch (rego->bfd_architecture, 0);
-	      if (ap != NULL)
-		{
-		  do
-		    {
-		      printf_filtered (" %s", ap->printable_name);
-		      ap = ap->next;
-		    }
-		  while (ap != NULL);
-		  printf_filtered ("\n");
-		}
-	    }
-	}
-      else
-	{
-	  printf_filtered ("There are no available architectures.\n");
-	}
-      return;
-    }
-  printf_filtered ("Available architectures are:\n");
-  for (a = bfd_arch_obscure + 1; a < bfd_arch_last; a++)
-    {
-      const struct bfd_arch_info *ap = bfd_lookup_arch (a, 0);
-      if (ap != NULL)
-	{
-	  do
-	    {
-	      printf_filtered (" %s", ap->printable_name);
-	      ap = ap->next;
-	    }
-	  while (ap != NULL);
-	  printf_filtered ("\n");
-	}
-    }
-}
-
-/* Set the architecture from arch/machine */
-void
-set_architecture_from_arch_mach (arch, mach)
-     enum bfd_architecture arch;
-     unsigned long mach;
-{
-  const struct bfd_arch_info *wanted = bfd_lookup_arch (arch, mach);
-  if (wanted != NULL)
-    set_arch (wanted, set_arch_manual);
-  else
-    internal_error ("gdbarch: hardwired architecture/machine not reconized");
-}
-
-/* Set the architecture from a BFD */
-static void
-set_architecture_from_file (bfd *abfd)
-{
-  const struct bfd_arch_info *wanted = bfd_get_arch_info (abfd);
-  if (target_architecture_auto)
-    {
-      set_arch (wanted, set_arch_auto);
-    }
-  else if (wanted != target_architecture)
-    {
-      warning ("%s architecture file may be incompatible with %s target.",
-	       wanted->printable_name,
-	       target_architecture->printable_name);
-    }
-}
-
-
-/* Misc helper functions for targets. */
-
-int
-frame_num_args_unknown (fi)
-     struct frame_info *fi;
-{
-  return -1;
-}
-
-
-int
-generic_register_convertible_not (num)
-     int num;
-{
-  return 0;
-}
-  
-
 /* Disassembler */
 
 /* Pointer to the target-dependent disassembly function.  */
@@ -2090,82 +1935,13 @@
 disassemble_info tm_print_insn_info;
 
 
-
-/* Set the dynamic target-system-dependant parameters (architecture,
-   byte-order) using information found in the BFD */
-
-void
-set_gdbarch_from_file (abfd)
-     bfd *abfd;
-{
-  if (GDB_MULTI_ARCH)
-    {
-      struct gdbarch_info info;
-      memset (&info, 0, sizeof info);
-      info.abfd = abfd;
-      gdbarch_update (info);
-      return;
-    }
-  set_architecture_from_file (abfd);
-  set_endian_from_file (abfd);
-}
-
-
-/* Initialize the current architecture.  */
-void
-initialize_current_architecture ()
-{
-  if (GDB_MULTI_ARCH)
-    {
-      struct gdbarch_init_registration *rego;
-      const struct bfd_arch_info *chosen = NULL;
-      for (rego = gdbarch_init_registrary; rego != NULL; rego = rego->next)
-	{
-	  const struct bfd_arch_info *ap
-	    = bfd_lookup_arch (rego->bfd_architecture, 0);
-
-	  /* Choose the first architecture alphabetically.  */
-	  if (chosen == NULL
-	      || strcmp (ap->printable_name, chosen->printable_name) < 0)
-	    chosen = ap;
-	}
-
-      if (chosen != NULL)
-	{
-	  struct gdbarch_info info;
-	  memset (&info, 0, sizeof info);
-	  info.bfd_arch_info = chosen;
-	  gdbarch_update (info);
-	}
-    }
-}
-
 extern void _initialize_gdbarch (void);
+
 void
-_initialize_gdbarch ()
+_initialize_gdbarch (void)
 {
   struct cmd_list_element *c;
 
-  add_prefix_cmd ("endian", class_support, set_endian,
-		  "Set endianness of target.",
-		  &endianlist, "set endian ", 0, &setlist);
-  add_cmd ("big", class_support, set_endian_big,
-	   "Set target as being big endian.", &endianlist);
-  add_cmd ("little", class_support, set_endian_little,
-	   "Set target as being little endian.", &endianlist);
-  add_cmd ("auto", class_support, set_endian_auto,
-	   "Select target endianness automatically.", &endianlist);
-  add_cmd ("endian", class_support, show_endian,
-	   "Show endianness of target.", &showlist);
-
-  add_cmd ("architecture", class_support, set_architecture,
-	   "Set architecture of target.", &setlist);
-  add_alias_cmd ("processor", "architecture", class_support, 1, &setlist);
-  add_cmd ("architecture", class_support, show_architecture,
-	   "Show architecture of target.", &showlist);
-  add_cmd ("architecture", class_support, info_architecture,
-	   "List supported target architectures", &infolist);
-
   INIT_DISASSEMBLE_INFO_NO_ARCH (tm_print_insn_info, gdb_stdout, (fprintf_ftype)fprintf_filtered);
   tm_print_insn_info.flavour = bfd_target_unknown_flavour;
   tm_print_insn_info.read_memory_func = dis_asm_read_memory;
@@ -2176,14 +1952,14 @@
 				  class_maintenance,
 				  var_zinteger,
 				  (char *)&gdbarch_debug,
-				  "Set architecture debugging.\n\\
+				  "Set architecture debugging.\\n\\
 When non-zero, architecture debugging is enabled.", &setdebuglist),
 		     &showdebuglist);
   c = add_set_cmd ("archdebug",
 		   class_maintenance,
 		   var_zinteger,
 		   (char *)&gdbarch_debug,
-		   "Set architecture debugging.\n\\
+		   "Set architecture debugging.\\n\\
 When non-zero, architecture debugging is enabled.", &setlist);
 
   deprecate_cmd (c, "set debug arch");
diff --git a/gdb/gdbcmd.h b/gdb/gdbcmd.h
index 489b31c..dd6a4dc 100644
--- a/gdb/gdbcmd.h
+++ b/gdb/gdbcmd.h
@@ -1,3 +1,10 @@
+/* ***DEPRECATED***  The gdblib files must not be calling/using things in any
+   of the possible command languages.  If necessary, a hook (that may be
+   present or not) must be used and set to the appropriate routine by any
+   command language that cares about it.  If you are having to include this
+   file you are possibly doing things the old way.  This file will disapear.
+   fnasser@redhat.com    */
+
 /* Header file for GDB-specific command-line stuff.
    Copyright 1986, 1989, 1990, 1992, 2000 Free Software Foundation, Inc.
 
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index a160c85..c3b2ee8 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12 
+# 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
@@ -28,6 +28,7 @@
 program_transform_name=s,x,x,
 silent=
 site=
+sitefile=
 srcdir=
 target=NONE
 verbose=
@@ -49,6 +50,7 @@
 # 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
 
@@ -141,6 +143,7 @@
   --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
@@ -311,6 +314,11 @@
   -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=*)
@@ -332,7 +340,7 @@
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.12"
+    echo "configure generated by autoconf version 2.13"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -476,12 +484,16 @@
 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"
+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
@@ -502,9 +514,11 @@
 # 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'
+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
@@ -561,33 +575,33 @@
 
 
 # Make sure we can run config.sub.
-if $ac_config_sub sun4 >/dev/null 2>&1; then :
+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:570: checking host system type" >&5
+echo "configure:584: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
 NONE)
   case $nonopt in
   NONE)
-    if host_alias=`$ac_config_guess`; then :
+    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=`$ac_config_sub $host_alias`
+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 target system type""... $ac_c" 1>&6
-echo "configure:591: checking target system type" >&5
+echo "configure:605: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
@@ -598,14 +612,14 @@
   esac ;;
 esac
 
-target=`$ac_config_sub $target_alias`
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
 target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
 target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo "$ac_t""$target" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:609: checking build system type" >&5
+echo "configure:623: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -616,7 +630,7 @@
   esac ;;
 esac
 
-build=`$ac_config_sub $build_alias`
+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/'`
@@ -634,28 +648,30 @@
 # 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:642: checking for a BSD compatible install" >&5
+echo "configure:657: 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}:"
+    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.
-      for ac_prog in ginstall installbsd scoinst install; do
+      # 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.
-	    # OSF/1 installbsd also uses dspmsg, but is usable.
 	    :
 	  else
 	    ac_cv_path_install="$ac_dir/$ac_prog -c"
@@ -685,6 +701,8 @@
 # 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'
 
 
@@ -746,11 +764,6 @@
 if test "${nativefile}" != ""; then
 	files="${files} ../config/${gdb_host_cpu}/${nativefile}"
 	links="${links} nm.h"
-# temporary scaffolding until all hosts have the host/target/native
-# split in place.
-else
-	files="${files} ../config/nm-empty.h"
-	links="${links} nm.h"
 fi
 
 
@@ -777,7 +790,7 @@
 # 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` in
+  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 \).
@@ -856,7 +869,7 @@
     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"
+    echo "$CONFIG_STATUS generated by autoconf version 2.13"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -876,9 +889,11 @@
  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
@@ -913,6 +928,7 @@
 s%@build_vendor@%$build_vendor%g
 s%@build_os@%$build_os%g
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
 /@host_makefile_frag@/r $host_makefile_frag
 s%@host_makefile_frag@%%g
diff --git a/gdb/gdbserver/configure.in b/gdb/gdbserver/configure.in
index 856ae62..ebf8762 100644
--- a/gdb/gdbserver/configure.in
+++ b/gdb/gdbserver/configure.in
@@ -84,11 +84,6 @@
 if test "${nativefile}" != ""; then
 	files="${files} ../config/${gdb_host_cpu}/${nativefile}"
 	links="${links} nm.h"
-# temporary scaffolding until all hosts have the host/target/native
-# split in place.
-else
-	files="${files} ../config/nm-empty.h"
-	links="${links} nm.h"
 fi
 AC_LINK_FILES($files, $links)
 
diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
index 9e88a75..e15f77e 100644
--- a/gdb/gdbserver/gdbreplay.c
+++ b/gdb/gdbserver/gdbreplay.c
@@ -41,8 +41,7 @@
    Then return to command level.  */
 
 void
-perror_with_name (string)
-     char *string;
+perror_with_name (char *string)
 {
 #ifndef STDC_HEADERS
   extern int sys_nerr;
@@ -63,11 +62,7 @@
 }
 
 static void
-sync_error (fp, desc, expect, got)
-     FILE *fp;
-     char *desc;
-     int expect;
-     int got;
+sync_error (FILE *fp, char *desc, int expect, int got)
 {
   fprintf (stderr, "\n%s\n", desc);
   fprintf (stderr, "At logfile offset %ld, expected '0x%x' got '0x%x'\n",
@@ -77,7 +72,7 @@
 }
 
 void
-remote_close ()
+remote_close (void)
 {
   close (remote_desc);
 }
@@ -86,8 +81,7 @@
    NAME is the filename used for communication.  */
 
 void
-remote_open (name)
-     char *name;
+remote_open (char *name)
 {
   extern char *strchr ();
 
@@ -159,8 +153,7 @@
 }
 
 static int
-tohex (ch)
-     int ch;
+tohex (int ch)
 {
   if (ch >= '0' && ch <= '9')
     {
@@ -180,8 +173,7 @@
 }
 
 static int
-logchar (fp)
-     FILE *fp;
+logchar (FILE *fp)
 {
   int ch;
   int ch2;
@@ -244,8 +236,7 @@
    blank) up until a \n is read from fp (which is not matched) */
 
 void
-expect (fp)
-     FILE *fp;
+expect (FILE *fp)
 {
   int fromlog;
   unsigned char fromgdb;
@@ -276,8 +267,7 @@
    \n is read from fp (which is discarded and not sent to gdb). */
 
 void
-play (fp)
-     FILE *fp;
+play (FILE *fp)
 {
   int fromlog;
   char ch;
@@ -295,9 +285,7 @@
 }
 
 int
-main (argc, argv)
-     int argc;
-     char *argv[];
+main (int argc, char *argv[])
 {
   FILE *fp;
   int ch;
diff --git a/gdb/gdbserver/low-hppabsd.c b/gdb/gdbserver/low-hppabsd.c
index de78ad5..d031e30 100644
--- a/gdb/gdbserver/low-hppabsd.c
+++ b/gdb/gdbserver/low-hppabsd.c
@@ -33,34 +33,22 @@
 #include <fcntl.h>
 
 /***************Begin MY defs*********************/
-int quit_flag = 0;
 static char my_registers[REGISTER_BYTES];
 char *registers = my_registers;
-
-/* Index within `registers' of the first byte of the space for
-   register N.  */
-
-
-char buf2[MAX_REGISTER_RAW_SIZE];
 /***************End MY defs*********************/
 
 #include <sys/ptrace.h>
 #include <machine/reg.h>
 
-extern char **environ;
 extern int errno;
 extern int inferior_pid;
-void quit (), perror_with_name ();
-int query ();
+void perror_with_name ();
 
 /* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args.
-   ENV is the environment vector to pass.  */
+   ALLARGS is a vector of program-name and args. */
 
 int
-create_inferior (program, allargs)
-     char *program;
-     char **allargs;
+create_inferior (char *program, char **allargs)
 {
   int pid;
 
@@ -86,7 +74,7 @@
 /* Kill the inferior process.  Make us have no inferior.  */
 
 void
-kill_inferior ()
+kill_inferior (void)
 {
   if (inferior_pid == 0)
     return;
@@ -97,8 +85,7 @@
 
 /* Return nonzero if the given thread is still alive.  */
 int
-mythread_alive (pid)
-     int pid;
+mythread_alive (int pid)
 {
   return 1;
 }
@@ -106,8 +93,7 @@
 /* Wait for process, returns status */
 
 unsigned char
-mywait (status)
-     char *status;
+mywait (char *status)
 {
   int pid;
   union wait w;
@@ -140,9 +126,7 @@
    If SIGNAL is nonzero, give it that signal.  */
 
 void
-myresume (step, signal)
-     int step;
-     int signal;
+myresume (int step, int signal)
 {
   errno = 0;
   ptrace (step ? PT_STEP : PT_CONTINUE, inferior_pid, 1, signal, 0);
@@ -164,9 +148,7 @@
 #endif
 
 CORE_ADDR
-register_addr (regno, blockend)
-     int regno;
-     CORE_ADDR blockend;
+register_addr (int regno, CORE_ADDR blockend)
 {
   CORE_ADDR addr;
 
@@ -181,8 +163,7 @@
 /* Fetch one register.  */
 
 static void
-fetch_register (regno)
-     int regno;
+fetch_register (int regno)
 {
   register unsigned int regaddr;
   char buf[MAX_REGISTER_RAW_SIZE];
@@ -217,8 +198,7 @@
 /* Fetch all registers, or just one, from the child process.  */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   if (regno == -1 || regno == 0)
     for (regno = 0; regno < NUM_REGS; regno++)
@@ -232,8 +212,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   register unsigned int regaddr;
   char buf[80];
@@ -295,10 +274,7 @@
 /* Copy LEN bytes from inferior's memory starting at MEMADDR
    to debugger memory starting at MYADDR.  */
 
-read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -325,10 +301,7 @@
    returns the value of errno.  */
 
 int
-write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -369,6 +342,6 @@
 }
 
 void
-initialize_low ()
+initialize_low (void)
 {
 }
diff --git a/gdb/gdbserver/low-linux.c b/gdb/gdbserver/low-linux.c
index 666dadf..c718c4e 100644
--- a/gdb/gdbserver/low-linux.c
+++ b/gdb/gdbserver/low-linux.c
@@ -33,15 +33,8 @@
 #include <fcntl.h>
 
 /***************Begin MY defs*********************/
-int quit_flag = 0;
 static char my_registers[REGISTER_BYTES];
 char *registers = my_registers;
-
-/* Index within `registers' of the first byte of the space for
-   register N.  */
-
-
-char buf2[MAX_REGISTER_RAW_SIZE];
 /***************End MY defs*********************/
 
 #ifdef HAVE_SYS_REG_H
@@ -53,22 +46,17 @@
 #define PTRACE_XFER_TYPE int
 #endif
 
-extern char **environ;
 extern int errno;
 extern int inferior_pid;
-void quit (), perror_with_name ();
-int query ();
+void perror_with_name ();
 
 static void initialize_arch (void);
 
 /* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args.
-   ENV is the environment vector to pass.  */
+   ALLARGS is a vector of program-name and args. */
 
 int
-create_inferior (program, allargs)
-     char *program;
-     char **allargs;
+create_inferior (char *program, char **allargs)
 {
   int pid;
 
@@ -94,7 +82,7 @@
 /* Kill the inferior process.  Make us have no inferior.  */
 
 void
-kill_inferior ()
+kill_inferior (void)
 {
   if (inferior_pid == 0)
     return;
@@ -105,8 +93,7 @@
 
 /* Return nonzero if the given thread is still alive.  */
 int
-mythread_alive (pid)
-     int pid;
+mythread_alive (int pid)
 {
   return 1;
 }
@@ -114,8 +101,7 @@
 /* Wait for process, returns status */
 
 unsigned char
-mywait (status)
-     char *status;
+mywait (char *status)
 {
   int pid;
   union wait w;
@@ -148,9 +134,7 @@
    If SIGNAL is nonzero, give it that signal.  */
 
 void
-myresume (step, signal)
-     int step;
-     int signal;
+myresume (int step, int signal)
 {
   errno = 0;
   ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, inferior_pid, 1, signal);
@@ -191,7 +175,7 @@
 int i386_register_byte[MAX_NUM_REGS];
 
 static void
-initialize_arch ()
+initialize_arch (void)
 {
   /* Initialize the table saying where each register starts in the
      register file.  */
@@ -218,9 +202,7 @@
 };
 
 int
-i386_register_u_addr (blockend, regnum)
-     int blockend;
-     int regnum;
+i386_register_u_addr (int blockend, int regnum)
 {
 #if 0
   /* this will be needed if fp registers are reinstated */
@@ -242,7 +224,7 @@
 }
 #elif defined(TARGET_M68K)
 static void
-initialize_arch ()
+initialize_arch (void)
 {
   return;
 }
@@ -270,9 +252,7 @@
    is stored.  */
 
 int
-m68k_linux_register_u_addr (blockend, regnum)
-     int blockend;
-     int regnum;
+m68k_linux_register_u_addr (int blockend, int regnum)
 {
   return (blockend + 4 * regmap[regnum]);
 }
@@ -476,7 +456,7 @@
     PT_PR,
     PT_CR_IIP,	/* ip */
     PT_CR_IPSR, /* psr */
-    PT_CR_IFS,	/* cfm */
+    PT_CFM,	/* cfm */
     /* kernel registers not visible via ptrace interface (?) */
     -1, -1, -1, -1, -1, -1, -1, -1,
     /* hole */
@@ -551,16 +531,14 @@
 }
 
 static void
-initialize_arch ()
+initialize_arch (void)
 {
   return;
 }
 #endif
 
 CORE_ADDR
-register_addr (regno, blockend)
-     int regno;
-     CORE_ADDR blockend;
+register_addr (int regno, CORE_ADDR blockend)
 {
   CORE_ADDR addr;
 
@@ -575,8 +553,7 @@
 /* Fetch one register.  */
 
 static void
-fetch_register (regno)
-     int regno;
+fetch_register (int regno)
 {
   CORE_ADDR regaddr;
   register int i;
@@ -610,8 +587,7 @@
 /* Fetch all registers, or just one, from the child process.  */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   if (regno == -1 || regno == 0)
     for (regno = 0; regno < NUM_REGS - NUM_FREGS; regno++)
@@ -625,8 +601,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   CORE_ADDR regaddr;
   int i;
@@ -690,10 +665,7 @@
    to debugger memory starting at MYADDR.  */
 
 void
-read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -722,10 +694,7 @@
    returns the value of errno.  */
 
 int
-write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -766,7 +735,7 @@
 }
 
 void
-initialize_low ()
+initialize_low (void)
 {
   initialize_arch ();
 }
diff --git a/gdb/gdbserver/low-lynx.c b/gdb/gdbserver/low-lynx.c
index 6669565..d16201e 100644
--- a/gdb/gdbserver/low-lynx.c
+++ b/gdb/gdbserver/low-lynx.c
@@ -53,9 +53,7 @@
    ALLARGS is a vector of program-name and args. */
 
 int
-create_inferior (program, allargs)
-     char *program;
-     char **allargs;
+create_inferior (char *program, char **allargs)
 {
   int pid;
 
@@ -91,7 +89,7 @@
 /* Kill the inferior process.  Make us have no inferior.  */
 
 void
-kill_inferior ()
+kill_inferior (void)
 {
   if (inferior_pid == 0)
     return;
@@ -103,8 +101,7 @@
 
 /* Return nonzero if the given thread is still alive.  */
 int
-mythread_alive (pid)
-     int pid;
+mythread_alive (int pid)
 {
   /* Arggh.  Apparently pthread_kill only works for threads within
      the process that calls pthread_kill.
@@ -122,8 +119,7 @@
 /* Wait for process, returns status */
 
 unsigned char
-mywait (status)
-     char *status;
+mywait (char *status)
 {
   int pid;
   union wait w;
@@ -186,9 +182,7 @@
    If SIGNAL is nonzero, give it that signal.  */
 
 void
-myresume (step, signal)
-     int step;
-     int signal;
+myresume (int step, int signal)
 {
   errno = 0;
   ptrace (step ? PTRACE_SINGLESTEP_ONE : PTRACE_CONT,
@@ -352,8 +346,7 @@
    It also handles knows where to find the I & L regs on the stack.  */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
 #if 0
   int whatregs = 0;
@@ -457,8 +450,7 @@
    this point.  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
 #if 0
   int whatregs = 0;
@@ -566,7 +558,7 @@
    saved context block.  */
 
 static unsigned long
-lynx_registers_addr ()
+lynx_registers_addr (void)
 {
   CORE_ADDR stblock;
   int ecpoff = offsetof (st_t, ecp);
@@ -591,8 +583,7 @@
    marking them as valid so we won't fetch them again.  */
 
 void
-fetch_inferior_registers (ignored)
-     int ignored;
+fetch_inferior_registers (int ignored)
 {
   int regno;
   unsigned long reg;
@@ -623,8 +614,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (ignored)
-     int ignored;
+store_inferior_registers (int ignored)
 {
   int regno;
   unsigned long reg;
@@ -662,10 +652,7 @@
    to debugger memory starting at MYADDR.  */
 
 void
-read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -692,10 +679,7 @@
    returns the value of errno.  */
 
 int
-write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -748,6 +732,6 @@
 }
 
 void
-initialize_low ()
+initialize_low (void)
 {
 }
diff --git a/gdb/gdbserver/low-nbsd.c b/gdb/gdbserver/low-nbsd.c
index 4aa3409..fc54845 100644
--- a/gdb/gdbserver/low-nbsd.c
+++ b/gdb/gdbserver/low-nbsd.c
@@ -27,24 +27,17 @@
 #include <errno.h>
 
 /***************Begin MY defs*********************/
-int quit_flag = 0;
 static char my_registers[REGISTER_BYTES];
 char *registers = my_registers;
-
-/* Index within `registers' of the first byte of the space for
-   register N.  */
-
-char buf2[MAX_REGISTER_RAW_SIZE];
 /***************End MY defs*********************/
 
 #include <sys/ptrace.h>
 #include <machine/reg.h>
 
-extern int sys_nerr;
+// extern int sys_nerr;
 // extern char **sys_errlist;
-extern char **environ;
 extern int inferior_pid;
-void quit (), perror_with_name ();
+void perror_with_name ();
 
 #define RF(dst, src) \
 	memcpy(&registers[REGISTER_BYTE(dst)], &src, sizeof(src))
@@ -89,7 +82,7 @@
 int i386_register_byte[MAX_NUM_REGS];
 
 static void       
-initialize_arch()
+initialize_arch (void)
 {
   /* Initialize the table saying where each register starts in the
      register file.  */
@@ -106,22 +99,35 @@
 }       
 #endif	/* !__i386__ */
 
-#ifdef __powerpc__
+#ifdef __m68k__
 static void
-initialize_arch()
+initialize_arch (void)
+{
+}
+#endif	/* !__m68k__ */
+
+#ifdef __ns32k__
+static void
+initialize_arch (void)
+{
+}
+#endif	/* !__ns32k__ */
+
+#ifdef __powerpc__
+#include "ppc-tdep.h"
+
+static void
+initialize_arch (void)
 {
 }
 #endif	/* !__powerpc__ */
 
 
 /* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args.
-   ENV is the environment vector to pass.  */
+   ALLARGS is a vector of program-name and args. */
 
 int
-create_inferior (program, allargs)
-     char *program;
-     char **allargs;
+create_inferior (char *program, char **allargs)
 {
   int pid;
 
@@ -147,7 +153,7 @@
 /* Kill the inferior process.  Make us have no inferior.  */
 
 void
-kill_inferior ()
+kill_inferior (void)
 {
   if (inferior_pid == 0)
     return;
@@ -158,8 +164,7 @@
 
 /* Return nonzero if the given thread is still alive.  */
 int
-mythread_alive (pid)
-     int pid;
+mythread_alive (int pid)
 {
   return 1;
 }
@@ -167,8 +172,7 @@
 /* Wait for process, returns status */
 
 unsigned char
-mywait (status)
-     char *status;
+mywait (char *status)
 {
   int pid;
   int w;
@@ -201,9 +205,7 @@
    If SIGNAL is nonzero, give it that signal.  */
 
 void
-myresume (step, signal)
-     int step;
-     int signal;
+myresume (int step, int signal)
 {
   errno = 0;
   ptrace (step ? PT_STEP : PT_CONTINUE, inferior_pid, 
@@ -219,8 +221,7 @@
    marking them as valid so we won't fetch them again.  */
 
 void
-fetch_inferior_registers (ignored)
-     int ignored;
+fetch_inferior_registers (int ignored)
 {
   struct reg inferior_registers;
   struct env387 inferior_fp_registers;
@@ -247,23 +248,23 @@
   RF (14, inferior_registers.r_fs);
   RF (15, inferior_registers.r_gs);
 
-  RF (FP0_REGNUM,     inferior_fpregisters.regs[0]);
-  RF (FP0_REGNUM + 1, inferior_fpregisters.regs[1]);
-  RF (FP0_REGNUM + 2, inferior_fpregisters.regs[2]);
-  RF (FP0_REGNUM + 3, inferior_fpregisters.regs[3]);
-  RF (FP0_REGNUM + 4, inferior_fpregisters.regs[4]);
-  RF (FP0_REGNUM + 5, inferior_fpregisters.regs[5]);
-  RF (FP0_REGNUM + 6, inferior_fpregisters.regs[6]);
-  RF (FP0_REGNUM + 7, inferior_fpregisters.regs[7]);
+  RF (FP0_REGNUM,     inferior_fp_registers.regs[0]);
+  RF (FP0_REGNUM + 1, inferior_fp_registers.regs[1]);
+  RF (FP0_REGNUM + 2, inferior_fp_registers.regs[2]);
+  RF (FP0_REGNUM + 3, inferior_fp_registers.regs[3]);
+  RF (FP0_REGNUM + 4, inferior_fp_registers.regs[4]);
+  RF (FP0_REGNUM + 5, inferior_fp_registers.regs[5]);
+  RF (FP0_REGNUM + 6, inferior_fp_registers.regs[6]);
+  RF (FP0_REGNUM + 7, inferior_fp_registers.regs[7]);
   
-  RF (FCTRL_REGNUM,   inferior_fpregisters.control);
-  RF (FSTAT_REGNUM,   inferior_fpregisters.status);
-  RF (FTAG_REGNUM,    inferior_fpregisters.tag);
-  RF (FCS_REGNUM,     inferior_fpregisters.code_seg);
-  RF (FCOFF_REGNUM,   inferior_fpregisters.eip);
-  RF (FDS_REGNUM,     inferior_fpregisters.operand_seg);
-  RF (FDOFF_REGNUM,   inferior_fpregisters.operand);
-  RF (FOP_REGNUM,     inferior_fpregisters.opcode);
+  RF (FCTRL_REGNUM,   inferior_fp_registers.control);
+  RF (FSTAT_REGNUM,   inferior_fp_registers.status);
+  RF (FTAG_REGNUM,    inferior_fp_registers.tag);
+  RF (FCS_REGNUM,     inferior_fp_registers.code_seg);
+  RF (FCOFF_REGNUM,   inferior_fp_registers.eip);
+  RF (FDS_REGNUM,     inferior_fp_registers.operand_seg);
+  RF (FDOFF_REGNUM,   inferior_fp_registers.operand);
+  RF (FOP_REGNUM,     inferior_fp_registers.opcode);
 }
 
 /* Store our register values back into the inferior.
@@ -271,8 +272,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (ignored)
-     int ignored;
+store_inferior_registers (int ignored)
 {
   struct reg inferior_registers;
   struct env387 inferior_fp_registers;
@@ -294,23 +294,23 @@
   RS (14, inferior_registers.r_fs);
   RS (15, inferior_registers.r_gs);
 
-  RS (FP0_REGNUM,     inferior_fpregisters.regs[0]);
-  RS (FP0_REGNUM + 1, inferior_fpregisters.regs[1]);
-  RS (FP0_REGNUM + 2, inferior_fpregisters.regs[2]);
-  RS (FP0_REGNUM + 3, inferior_fpregisters.regs[3]);
-  RS (FP0_REGNUM + 4, inferior_fpregisters.regs[4]);
-  RS (FP0_REGNUM + 5, inferior_fpregisters.regs[5]);
-  RS (FP0_REGNUM + 6, inferior_fpregisters.regs[6]);
-  RS (FP0_REGNUM + 7, inferior_fpregisters.regs[7]);
+  RS (FP0_REGNUM,     inferior_fp_registers.regs[0]);
+  RS (FP0_REGNUM + 1, inferior_fp_registers.regs[1]);
+  RS (FP0_REGNUM + 2, inferior_fp_registers.regs[2]);
+  RS (FP0_REGNUM + 3, inferior_fp_registers.regs[3]);
+  RS (FP0_REGNUM + 4, inferior_fp_registers.regs[4]);
+  RS (FP0_REGNUM + 5, inferior_fp_registers.regs[5]);
+  RS (FP0_REGNUM + 6, inferior_fp_registers.regs[6]);
+  RS (FP0_REGNUM + 7, inferior_fp_registers.regs[7]);
   
-  RS (FCTRL_REGNUM,   inferior_fpregisters.control);
-  RS (FSTAT_REGNUM,   inferior_fpregisters.status);
-  RS (FTAG_REGNUM,    inferior_fpregisters.tag);
-  RS (FCS_REGNUM,     inferior_fpregisters.code_seg);
-  RS (FCOFF_REGNUM,   inferior_fpregisters.eip);
-  RS (FDS_REGNUM,     inferior_fpregisters.operand_seg);
-  RS (FDOFF_REGNUM,   inferior_fpregisters.operand);
-  RS (FOP_REGNUM,     inferior_fpregisters.opcode);
+  RS (FCTRL_REGNUM,   inferior_fp_registers.control);
+  RS (FSTAT_REGNUM,   inferior_fp_registers.status);
+  RS (FTAG_REGNUM,    inferior_fp_registers.tag);
+  RS (FCS_REGNUM,     inferior_fp_registers.code_seg);
+  RS (FCOFF_REGNUM,   inferior_fp_registers.eip);
+  RS (FDS_REGNUM,     inferior_fp_registers.operand_seg);
+  RS (FDOFF_REGNUM,   inferior_fp_registers.operand);
+  RS (FOP_REGNUM,     inferior_fp_registers.opcode);
 
   ptrace (PT_SETREGS, inferior_pid,
 	  (PTRACE_ARG3_TYPE) &inferior_registers, 0);
@@ -319,34 +319,26 @@
 }
 #endif	/* !__i386__ */
 
-#ifdef __powerpc__
+#ifdef __m68k__
 /* Fetch one or more registers from the inferior.  REGNO == -1 to get
    them all.  We actually fetch more than requested, when convenient,
    marking them as valid so we won't fetch them again.  */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   struct reg inferior_registers;
   struct fpreg inferior_fp_registers;
-  int i;
 
   ptrace (PT_GETREGS, inferior_pid,
-	  (PTRACE_ARG3_TYPE) & inferior_registers, 0);
+          (PTRACE_ARG3_TYPE) & inferior_registers, 0);
+  memcpy (&registers[REGISTER_BYTE (0)], &inferior_registers,
+          sizeof (inferior_registers));
+
   ptrace (PT_GETFPREGS, inferior_pid,
-	  (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
-
-  for (i = 0; i < 32; i++)
-    RF (i, inferior_registers.fixreg[i]);
-  RF (LR_REGNUM, inferior_registers.lr);
-  RF (CR_REGNUM, inferior_registers.cr);
-  RF (XER_REGNUM, inferior_registers.xer);
-  RF (CTR_REGNUM, inferior_registers.ctr);
-  RF (PC_REGNUM, inferior_registers.pc);
-
-  for (i = 0; i < 32; i++)
-    RF (FP0_REGNUM + i, inferior_fp_registers.r_regs[i]);
+          (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
+  memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
+          sizeof (inferior_fp_registers));
 }
 
 /* Store our register values back into the inferior.
@@ -354,28 +346,168 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   struct reg inferior_registers;
   struct fpreg inferior_fp_registers;
+
+  memcpy (&inferior_registers, &registers[REGISTER_BYTE (0)],
+          sizeof (inferior_registers));
+  ptrace (PT_SETREGS, inferior_pid,
+          (PTRACE_ARG3_TYPE) & inferior_registers, 0);
+
+  memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
+          sizeof (inferior_fp_registers));
+  ptrace (PT_SETFPREGS, inferior_pid,
+          (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
+}
+#endif	/* !__m68k__ */
+
+
+#ifdef __ns32k__
+/* Fetch one or more registers from the inferior.  REGNO == -1 to get
+   them all.  We actually fetch more than requested, when convenient,
+   marking them as valid so we won't fetch them again.  */
+
+void
+fetch_inferior_registers (int regno)
+{
+  struct reg inferior_registers;
+  struct fpreg inferior_fpregisters;
+
+  ptrace (PT_GETREGS, inferior_pid,
+          (PTRACE_ARG3_TYPE) & inferior_registers, 0);
+  ptrace (PT_GETFPREGS, inferior_pid,
+          (PTRACE_ARG3_TYPE) & inferior_fpregisters, 0);
+
+  RF (R0_REGNUM + 0, inferior_registers.r_r0);
+  RF (R0_REGNUM + 1, inferior_registers.r_r1);
+  RF (R0_REGNUM + 2, inferior_registers.r_r2);
+  RF (R0_REGNUM + 3, inferior_registers.r_r3);
+  RF (R0_REGNUM + 4, inferior_registers.r_r4);
+  RF (R0_REGNUM + 5, inferior_registers.r_r5);
+  RF (R0_REGNUM + 6, inferior_registers.r_r6);
+  RF (R0_REGNUM + 7, inferior_registers.r_r7);
+
+  RF (SP_REGNUM, inferior_registers.r_sp);
+  RF (FP_REGNUM, inferior_registers.r_fp);
+  RF (PC_REGNUM, inferior_registers.r_pc);
+  RF (PS_REGNUM, inferior_registers.r_psr);
+
+  RF (FPS_REGNUM, inferior_fpregisters.r_fsr);
+  RF (FP0_REGNUM + 0, inferior_fpregisters.r_freg[0]);
+  RF (FP0_REGNUM + 2, inferior_fpregisters.r_freg[2]);
+  RF (FP0_REGNUM + 4, inferior_fpregisters.r_freg[4]);
+  RF (FP0_REGNUM + 6, inferior_fpregisters.r_freg[6]);
+  RF (LP0_REGNUM + 1, inferior_fpregisters.r_freg[1]);
+  RF (LP0_REGNUM + 3, inferior_fpregisters.r_freg[3]);
+  RF (LP0_REGNUM + 5, inferior_fpregisters.r_freg[5]);
+  RF (LP0_REGNUM + 7, inferior_fpregisters.r_freg[7]);
+}
+
+/* Store our register values back into the inferior.
+   If REGNO is -1, do this for all registers.
+   Otherwise, REGNO specifies which register (so we can save time).  */
+
+void
+store_inferior_registers (int regno)
+{
+  struct reg inferior_registers;
+  struct fpreg inferior_fpregisters;
+
+  RS (R0_REGNUM + 0, inferior_registers.r_r0);
+  RS (R0_REGNUM + 1, inferior_registers.r_r1);
+  RS (R0_REGNUM + 2, inferior_registers.r_r2);
+  RS (R0_REGNUM + 3, inferior_registers.r_r3);
+  RS (R0_REGNUM + 4, inferior_registers.r_r4);
+  RS (R0_REGNUM + 5, inferior_registers.r_r5);
+  RS (R0_REGNUM + 6, inferior_registers.r_r6);
+  RS (R0_REGNUM + 7, inferior_registers.r_r7);
+  
+  RS (SP_REGNUM, inferior_registers.r_sp);
+  RS (FP_REGNUM, inferior_registers.r_fp);
+  RS (PC_REGNUM, inferior_registers.r_pc);
+  RS (PS_REGNUM, inferior_registers.r_psr);
+  
+  RS (FPS_REGNUM, inferior_fpregisters.r_fsr);
+  RS (FP0_REGNUM + 0, inferior_fpregisters.r_freg[0]);
+  RS (FP0_REGNUM + 2, inferior_fpregisters.r_freg[2]);
+  RS (FP0_REGNUM + 4, inferior_fpregisters.r_freg[4]);
+  RS (FP0_REGNUM + 6, inferior_fpregisters.r_freg[6]);
+  RS (LP0_REGNUM + 1, inferior_fpregisters.r_freg[1]);
+  RS (LP0_REGNUM + 3, inferior_fpregisters.r_freg[3]);
+  RS (LP0_REGNUM + 5, inferior_fpregisters.r_freg[5]);
+  RS (LP0_REGNUM + 7, inferior_fpregisters.r_freg[7]);
+  
+  ptrace (PT_SETREGS, inferior_pid,
+          (PTRACE_ARG3_TYPE) & inferior_registers, 0);
+  ptrace (PT_SETFPREGS, inferior_pid,
+          (PTRACE_ARG3_TYPE) & inferior_fpregisters, 0);
+
+}
+#endif	/* !__ns32k__ */
+
+#ifdef __powerpc__
+/* Fetch one or more registers from the inferior.  REGNO == -1 to get
+   them all.  We actually fetch more than requested, when convenient,
+   marking them as valid so we won't fetch them again.  */
+
+void
+fetch_inferior_registers (int regno)
+{
+  struct reg inferior_registers;
+#ifdef PT_GETFPREGS
+  struct fpreg inferior_fp_registers;
+#endif
+  int i;
+
+  ptrace (PT_GETREGS, inferior_pid,
+	  (PTRACE_ARG3_TYPE) & inferior_registers, 0);
+  for (i = 0; i < 32; i++)
+    RF (i, inferior_registers.fixreg[i]);
+  RF (PPC_LR_REGNUM, inferior_registers.lr);
+  RF (PPC_CR_REGNUM, inferior_registers.cr);
+  RF (PPC_XER_REGNUM, inferior_registers.xer);
+  RF (PPC_CTR_REGNUM, inferior_registers.ctr);
+  RF (PC_REGNUM, inferior_registers.pc);
+
+#ifdef PT_GETFPREGS
+  ptrace (PT_GETFPREGS, inferior_pid,
+	  (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
+  for (i = 0; i < 32; i++)
+    RF (FP0_REGNUM + i, inferior_fp_registers.r_regs[i]);
+#endif
+}
+
+/* Store our register values back into the inferior.
+   If REGNO is -1, do this for all registers.
+   Otherwise, REGNO specifies which register (so we can save time).  */
+
+void
+store_inferior_registers (int regno)
+{
+  struct reg inferior_registers;
+#ifdef PT_SETFPREGS
+  struct fpreg inferior_fp_registers;
+#endif
   int i;
 
   for (i = 0; i < 32; i++)
     RS (i, inferior_registers.fixreg[i]);
-  RS (LR_REGNUM, inferior_registers.lr);
-  RS (CR_REGNUM, inferior_registers.cr);
-  RS (XER_REGNUM, inferior_registers.xer);
-  RS (CTR_REGNUM, inferior_registers.ctr);
+  RS (PPC_LR_REGNUM, inferior_registers.lr);
+  RS (PPC_CR_REGNUM, inferior_registers.cr);
+  RS (PPC_XER_REGNUM, inferior_registers.xer);
+  RS (PPC_CTR_REGNUM, inferior_registers.ctr);
   RS (PC_REGNUM, inferior_registers.pc);
-
-  for (i = 0; i < 32; i++)
-    RS (FP0_REGNUM + i, inferior_fp_registers.r_regs[i]);
-
   ptrace (PT_SETREGS, inferior_pid,
 	  (PTRACE_ARG3_TYPE) & inferior_registers, 0);
+
+#ifdef PT_SETFPREGS
+  for (i = 0; i < 32; i++)
+    RS (FP0_REGNUM + i, inferior_fp_registers.r_regs[i]);
   ptrace (PT_SETFPREGS, inferior_pid,
 	  (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
+#endif
 }
 #endif	/* !__powerpc__ */
 
@@ -388,10 +520,7 @@
 /* Copy LEN bytes from inferior's memory starting at MEMADDR
    to debugger memory starting at MYADDR.  */
 
-read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -418,10 +547,7 @@
    returns the value of errno.  */
 
 int
-write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -462,7 +588,7 @@
 }
 
 void 
-initialize_low ()
+initialize_low (void)
 {
   initialize_arch ();
 }
diff --git a/gdb/gdbserver/low-sim.c b/gdb/gdbserver/low-sim.c
index 8d7c2e6..a0a9aa6 100644
--- a/gdb/gdbserver/low-sim.c
+++ b/gdb/gdbserver/low-sim.c
@@ -41,8 +41,7 @@
    does not support loading itself.  */
 
 static void
-generic_load (loadfile_bfd)
-     bfd *loadfile_bfd;
+generic_load (bfd *loadfile_bfd)
 {
   asection *s;
 
@@ -85,9 +84,7 @@
 }
 
 int
-create_inferior (program, argv)
-     char *program;
-     char **argv;
+create_inferior (char *program, char **argv)
 {
   bfd *abfd;
   int pid = 0;
@@ -145,7 +142,7 @@
 /* Kill the inferior process.  Make us have no inferior.  */
 
 void
-kill_inferior ()
+kill_inferior (void)
 {
   sim_close (gdbsim_desc, 0);
   default_callback.shutdown (&default_callback);
@@ -154,8 +151,7 @@
 /* Fetch one register.  */
 
 static void
-fetch_register (regno)
-     int regno;
+fetch_register (int regno)
 {
   sim_fetch_register (gdbsim_desc, regno, &registers[REGISTER_BYTE (regno)],
 		      REGISTER_RAW_SIZE (regno));
@@ -164,8 +160,7 @@
 /* Fetch all registers, or just one, from the child process.  */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   if (regno == -1 || regno == 0)
     for (regno = 0; regno < NUM_REGS /*-NUM_FREGS*/ ; regno++)
@@ -179,8 +174,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   if (regno == -1)
     {
@@ -194,8 +188,7 @@
 
 /* Return nonzero if the given thread is still alive.  */
 int
-mythread_alive (pid)
-     int pid;
+mythread_alive (int pid)
 {
   return 1;
 }
@@ -203,8 +196,7 @@
 /* Wait for process, returns status */
 
 unsigned char
-mywait (status)
-     char *status;
+mywait (char *status)
 {
   int sigrc;
   enum sim_stop reason;
@@ -240,9 +232,7 @@
    If SIGNAL is nonzero, give it that signal.  */
 
 void
-myresume (step, signo)
-     int step;
-     int signo;
+myresume (int step, int signo)
 {
   /* Should be using target_signal_to_host() or signal numbers in target.h
      to convert GDB signal number to target signal number.  */
@@ -253,10 +243,7 @@
    to debugger memory starting at MYADDR.  */
 
 void
-read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   sim_read (gdbsim_desc, memaddr, myaddr, len);
 }
@@ -267,16 +254,13 @@
    returns the value of errno.  */
 
 int
-write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   sim_write (gdbsim_desc, memaddr, myaddr, len);	/* should check for error.  FIXME!! */
   return 0;
 }
 
 void
-initialize_low ()
+initialize_low (void)
 {
 }
diff --git a/gdb/gdbserver/low-sparc.c b/gdb/gdbserver/low-sparc.c
index 178afc7..34e4192 100644
--- a/gdb/gdbserver/low-sparc.c
+++ b/gdb/gdbserver/low-sparc.c
@@ -36,15 +36,8 @@
 #include <fcntl.h>
 
 /***************Begin MY defs*********************/
-int quit_flag = 0;
 static char my_registers[REGISTER_BYTES];
 char *registers = my_registers;
-
-/* Index within `registers' of the first byte of the space for
-   register N.  */
-
-
-char buf2[MAX_REGISTER_RAW_SIZE];
 /***************End MY defs*********************/
 
 #include <sys/ptrace.h>
@@ -52,20 +45,15 @@
 
 extern int sys_nerr;
 extern char **sys_errlist;
-extern char **environ;
 extern int errno;
 extern int inferior_pid;
-void quit (), perror_with_name ();
-int query ();
+void perror_with_name ();
 
 /* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args.
-   ENV is the environment vector to pass.  */
+   ALLARGS is a vector of program-name and args. */
 
 int
-create_inferior (program, allargs)
-     char *program;
-     char **allargs;
+create_inferior (char *program, char **allargs)
 {
   int pid;
 
@@ -91,7 +79,7 @@
 /* Kill the inferior process.  Make us have no inferior.  */
 
 void
-kill_inferior ()
+kill_inferior (void)
 {
   if (inferior_pid == 0)
     return;
@@ -102,8 +90,7 @@
 
 /* Return nonzero if the given thread is still alive.  */
 int
-mythread_alive (pid)
-     int pid;
+mythread_alive (int pid)
 {
   return 1;
 }
@@ -111,8 +98,7 @@
 /* Wait for process, returns status */
 
 unsigned char
-mywait (status)
-     char *status;
+mywait (char *status)
 {
   int pid;
   union wait w;
@@ -145,9 +131,7 @@
    If SIGNAL is nonzero, give it that signal.  */
 
 void
-myresume (step, signal)
-     int step;
-     int signal;
+myresume (int step, int signal)
 {
   errno = 0;
   ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, inferior_pid, 1, signal);
@@ -160,8 +144,7 @@
    marking them as valid so we won't fetch them again.  */
 
 void
-fetch_inferior_registers (ignored)
-     int ignored;
+fetch_inferior_registers (int ignored)
 {
   struct regs inferior_registers;
   struct fp_status inferior_fp_registers;
@@ -207,8 +190,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (ignored)
-     int ignored;
+store_inferior_registers (int ignored)
 {
   struct regs inferior_registers;
   struct fp_status inferior_fp_registers;
@@ -250,10 +232,7 @@
 /* Copy LEN bytes from inferior's memory starting at MEMADDR
    to debugger memory starting at MYADDR.  */
 
-read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -280,10 +259,7 @@
    returns the value of errno.  */
 
 int
-write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -324,6 +300,6 @@
 }
 
 void
-initialize_low ()
+initialize_low (void)
 {
 }
diff --git a/gdb/gdbserver/low-sun3.c b/gdb/gdbserver/low-sun3.c
index 71a151e..e1e64b6 100644
--- a/gdb/gdbserver/low-sun3.c
+++ b/gdb/gdbserver/low-sun3.c
@@ -33,15 +33,8 @@
 #include <fcntl.h>
 
 /***************Begin MY defs*********************/
-int quit_flag = 0;
 static char my_registers[REGISTER_BYTES];
 char *registers = my_registers;
-
-/* Index within `registers' of the first byte of the space for
-   register N.  */
-
-
-char buf2[MAX_REGISTER_RAW_SIZE];
 /***************End MY defs*********************/
 
 #include <sys/ptrace.h>
@@ -49,20 +42,15 @@
 
 extern int sys_nerr;
 extern char **sys_errlist;
-extern char **environ;
 extern int errno;
 extern int inferior_pid;
-void quit (), perror_with_name ();
-int query ();
+void perror_with_name ();
 
 /* Start an inferior process and returns its pid.
-   ALLARGS is a vector of program-name and args.
-   ENV is the environment vector to pass.  */
+   ALLARGS is a vector of program-name and args. */
 
 int
-create_inferior (program, allargs)
-     char *program;
-     char **allargs;
+create_inferior (char *program, char **allargs)
 {
   int pid;
 
@@ -88,7 +76,7 @@
 /* Kill the inferior process.  Make us have no inferior.  */
 
 void
-kill_inferior ()
+kill_inferior (void)
 {
   if (inferior_pid == 0)
     return;
@@ -99,8 +87,7 @@
 
 /* Return nonzero if the given thread is still alive.  */
 int
-mythread_alive (pid)
-     int pid;
+mythread_alive (int pid)
 {
   return 1;
 }
@@ -108,8 +95,7 @@
 /* Wait for process, returns status */
 
 unsigned char
-mywait (status)
-     char *status;
+mywait (char *status)
 {
   int pid;
   union wait w;
@@ -142,9 +128,7 @@
    If SIGNAL is nonzero, give it that signal.  */
 
 void
-myresume (step, signal)
-     int step;
-     int signal;
+myresume (int step, int signal)
 {
   errno = 0;
   ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, inferior_pid, 1, signal);
@@ -157,8 +141,7 @@
    marking them as valid so we won't fetch them again.  */
 
 void
-fetch_inferior_registers (ignored)
-     int ignored;
+fetch_inferior_registers (int ignored)
 {
   struct regs inferior_registers;
   struct fp_status inferior_fp_registers;
@@ -190,8 +173,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (ignored)
-     int ignored;
+store_inferior_registers (int ignored)
 {
   struct regs inferior_registers;
   struct fp_status inferior_fp_registers;
@@ -229,10 +211,7 @@
 /* Copy LEN bytes from inferior's memory starting at MEMADDR
    to debugger memory starting at MYADDR.  */
 
-read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -259,10 +238,7 @@
    returns the value of errno.  */
 
 int
-write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -303,6 +279,6 @@
 }
 
 void
-initialize_low ()
+initialize_low (void)
 {
 }
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 2b632d6..614466d 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -41,8 +41,7 @@
    NAME is the filename used for communication.  */
 
 void
-remote_open (name)
-     char *name;
+remote_open (char *name)
 {
   int save_fcntl_flags;
 
@@ -162,7 +161,7 @@
 }
 
 void
-remote_close ()
+remote_close (void)
 {
   close (remote_desc);
 }
@@ -170,8 +169,7 @@
 /* Convert hex digit A to a number.  */
 
 static int
-fromhex (a)
-     int a;
+fromhex (int a)
 {
   if (a >= '0' && a <= '9')
     return a - '0';
@@ -184,8 +182,7 @@
 /* Convert number NIB to a hex digit.  */
 
 static int
-tohex (nib)
-     int nib;
+tohex (int nib)
 {
   if (nib < 10)
     return '0' + nib;
@@ -197,8 +194,7 @@
    The data of the packet is in BUF.  Returns >= 0 on success, -1 otherwise. */
 
 int
-putpkt (buf)
-     char *buf;
+putpkt (char *buf)
 {
   int i;
   unsigned char csum = 0;
@@ -262,7 +258,7 @@
    will cause us to send a SIGINT to the child.  */
 
 static void
-input_interrupt ()
+input_interrupt (void)
 {
   int cc;
   char c;
@@ -279,13 +275,13 @@
 }
 
 void
-enable_async_io ()
+enable_async_io (void)
 {
   signal (SIGIO, input_interrupt);
 }
 
 void
-disable_async_io ()
+disable_async_io (void)
 {
   signal (SIGIO, SIG_IGN);
 }
@@ -293,7 +289,7 @@
 /* Returns next char from remote GDB.  -1 if error.  */
 
 static int
-readchar ()
+readchar (void)
 {
   static char buf[BUFSIZ];
   static int bufcnt = 0;
@@ -323,8 +319,7 @@
    and store it in BUF.  Returns length of packet, or negative if error. */
 
 int
-getpkt (buf)
-     char *buf;
+getpkt (char *buf)
 {
   char *bp;
   unsigned char csum, c1, c2;
@@ -380,8 +375,7 @@
 }
 
 void
-write_ok (buf)
-     char *buf;
+write_ok (char *buf)
 {
   buf[0] = 'O';
   buf[1] = 'K';
@@ -389,8 +383,7 @@
 }
 
 void
-write_enn (buf)
-     char *buf;
+write_enn (char *buf)
 {
   buf[0] = 'E';
   buf[1] = 'N';
@@ -399,9 +392,7 @@
 }
 
 void
-convert_int_to_ascii (from, to, n)
-     char *from, *to;
-     int n;
+convert_int_to_ascii (char *from, char *to, int n)
 {
   int nib;
   char ch;
@@ -418,9 +409,7 @@
 
 
 void
-convert_ascii_to_int (from, to, n)
-     char *from, *to;
-     int n;
+convert_ascii_to_int (char *from, char *to, int n)
 {
   int nib1, nib2;
   while (n--)
@@ -432,9 +421,7 @@
 }
 
 static char *
-outreg (regno, buf)
-     int regno;
-     char *buf;
+outreg (int regno, char *buf)
 {
   int regsize = REGISTER_RAW_SIZE (regno);
 
@@ -453,10 +440,7 @@
 }
 
 void
-prepare_resume_reply (buf, status, signo)
-     char *buf;
-     char status;
-     unsigned char signo;
+prepare_resume_reply (char *buf, char status, unsigned char signo)
 {
   int nib;
 
@@ -512,10 +496,7 @@
 }
 
 void
-decode_m_packet (from, mem_addr_ptr, len_ptr)
-     char *from;
-     CORE_ADDR *mem_addr_ptr;
-     unsigned int *len_ptr;
+decode_m_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int *len_ptr)
 {
   int i = 0, j = 0;
   char ch;
@@ -537,10 +518,8 @@
 }
 
 void
-decode_M_packet (from, mem_addr_ptr, len_ptr, to)
-     char *from, *to;
-     CORE_ADDR *mem_addr_ptr;
-     unsigned int *len_ptr;
+decode_M_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int *len_ptr,
+		 char *to)
 {
   int i = 0;
   char ch;
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 48a7e0f..8e6e8bd 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -29,9 +29,7 @@
 int inferior_pid;
 
 static unsigned char
-start_inferior (argv, statusptr)
-     char *argv[];
-     char *statusptr;
+start_inferior (char *argv[], char *statusptr)
 {
   inferior_pid = create_inferior (argv[0], argv);
   fprintf (stderr, "Process %s created; pid = %d\n", argv[0], inferior_pid);
@@ -43,9 +41,7 @@
 extern int remote_debug;
 
 int
-main (argc, argv)
-     int argc;
-     char *argv[];
+main (int argc, char *argv[])
 {
   char ch, status, own_buf[PBUFSIZ], mem_buf[2000];
   int i = 0;
diff --git a/gdb/gdbserver/utils.c b/gdb/gdbserver/utils.c
index 2603beb..a22889c 100644
--- a/gdb/gdbserver/utils.c
+++ b/gdb/gdbserver/utils.c
@@ -29,8 +29,7 @@
    Then return to command level.  */
 
 void
-perror_with_name (string)
-     char *string;
+perror_with_name (char *string)
 {
 #ifndef STDC_HEADERS
   extern int sys_nerr;
@@ -57,33 +56,14 @@
    STRING is the error message, used as a fprintf string,
    and ARG is passed as an argument to it.  */
 
-#ifdef ANSI_PROTOTYPES
 NORETURN void
 error (const char *string,...)
-#else
-void
-error (va_alist)
-     va_dcl
-#endif
 {
   extern jmp_buf toplevel;
   va_list args;
-#ifdef ANSI_PROTOTYPES
   va_start (args, string);
-#else
-  va_start (args);
-#endif
   fflush (stdout);
-#ifdef ANSI_PROTOTYPES
   vfprintf (stderr, string, args);
-#else
-  {
-    char *string1;
-
-    string1 = va_arg (args, char *);
-    vfprintf (stderr, string1, args);
-  }
-#endif
   fprintf (stderr, "\n");
   longjmp (toplevel, 1);
 }
@@ -94,21 +74,10 @@
 
 /* VARARGS */
 NORETURN void
-#ifdef ANSI_PROTOTYPES
 fatal (char *string,...)
-#else
-fatal (va_alist)
-     va_dcl
-#endif
 {
   va_list args;
-#ifdef ANSI_PROTOTYPES
   va_start (args, string);
-#else
-  char *string;
-  va_start (args);
-  string = va_arg (args, char *);
-#endif
   fprintf (stderr, "gdb: ");
   vfprintf (stderr, string, args);
   fprintf (stderr, "\n");
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 0f6eef9..26d9059 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -82,7 +82,7 @@
   {
     char str[128];
     int len;
-  };				/* maximum extention is 128! FIXME */
+  };				/* maximum extension is 128! FIXME */
 
 static void add_name (struct extra *, char *);
 static void add_mangled_type (struct extra *, struct type *);
@@ -101,8 +101,7 @@
    in that objfile's type_obstack. */
 
 struct type *
-alloc_type (objfile)
-     struct objfile *objfile;
+alloc_type (struct objfile *objfile)
 {
   register struct type *type;
 
@@ -136,9 +135,7 @@
    We allocate new memory if needed.  */
 
 struct type *
-make_pointer_type (type, typeptr)
-     struct type *type;
-     struct type **typeptr;
+make_pointer_type (struct type *type, struct type **typeptr)
 {
   register struct type *ntype;	/* New type */
   struct objfile *objfile;
@@ -179,7 +176,9 @@
   TYPE_LENGTH (ntype) = TARGET_PTR_BIT / TARGET_CHAR_BIT;
   TYPE_CODE (ntype) = TYPE_CODE_PTR;
 
-  /* pointers are unsigned */
+  /* Mark pointers as unsigned.  The target converts between pointers
+     and addresses (CORE_ADDRs) using POINTER_TO_ADDRESS() and
+     ADDRESS_TO_POINTER(). */
   TYPE_FLAGS (ntype) |= TYPE_FLAG_UNSIGNED;
 
   if (!TYPE_POINTER_TYPE (type))	/* Remember it, if don't have one.  */
@@ -192,8 +191,7 @@
    May need to construct such a type if this is the first use.  */
 
 struct type *
-lookup_pointer_type (type)
-     struct type *type;
+lookup_pointer_type (struct type *type)
 {
   return make_pointer_type (type, (struct type **) 0);
 }
@@ -204,9 +202,7 @@
    We allocate new memory if needed.  */
 
 struct type *
-make_reference_type (type, typeptr)
-     struct type *type;
-     struct type **typeptr;
+make_reference_type (struct type *type, struct type **typeptr)
 {
   register struct type *ntype;	/* New type */
   struct objfile *objfile;
@@ -257,8 +253,7 @@
 /* Same as above, but caller doesn't care about memory allocation details.  */
 
 struct type *
-lookup_reference_type (type)
-     struct type *type;
+lookup_reference_type (struct type *type)
 {
   return make_reference_type (type, (struct type **) 0);
 }
@@ -269,9 +264,7 @@
    We allocate new memory if needed.  */
 
 struct type *
-make_function_type (type, typeptr)
-     struct type *type;
-     struct type **typeptr;
+make_function_type (struct type *type, struct type **typeptr)
 {
   register struct type *ntype;	/* New type */
   struct objfile *objfile;
@@ -304,8 +297,7 @@
    May need to construct such a type if this is the first use.  */
 
 struct type *
-lookup_function_type (type)
-     struct type *type;
+lookup_function_type (struct type *type)
 {
   return make_function_type (type, (struct type **) 0);
 }
@@ -322,11 +314,7 @@
    We allocate new memory if needed.  */
 
 struct type *
-make_cv_type (cnst, voltl, type, typeptr)
-     int cnst;
-     int voltl;
-     struct type *type;
-     struct type **typeptr;
+make_cv_type (int cnst, int voltl, struct type *type, struct type **typeptr)
 {
   register struct type *ntype;	/* New type */
   register struct type *tmp_type = type;	/* tmp type */
@@ -400,9 +388,7 @@
    of the aggregate that the member belongs to.  */
 
 struct type *
-lookup_member_type (type, domain)
-     struct type *type;
-     struct type *domain;
+lookup_member_type (struct type *type, struct type *domain)
 {
   register struct type *mtype;
 
@@ -418,8 +404,7 @@
    This always returns a fresh type.   */
 
 struct type *
-allocate_stub_method (type)
-     struct type *type;
+allocate_stub_method (struct type *type)
 {
   struct type *mtype;
 
@@ -443,11 +428,8 @@
    sure it is TYPE_CODE_UNDEF before we bash it into a range type? */
 
 struct type *
-create_range_type (result_type, index_type, low_bound, high_bound)
-     struct type *result_type;
-     struct type *index_type;
-     int low_bound;
-     int high_bound;
+create_range_type (struct type *result_type, struct type *index_type,
+		   int low_bound, int high_bound)
 {
   if (result_type == NULL)
     {
@@ -479,9 +461,7 @@
    will fit in LONGEST), or -1 otherwise. */
 
 int
-get_discrete_bounds (type, lowp, highp)
-     struct type *type;
-     LONGEST *lowp, *highp;
+get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
 {
   CHECK_TYPEDEF (type);
   switch (TYPE_CODE (type))
@@ -555,10 +535,8 @@
    sure it is TYPE_CODE_UNDEF before we bash it into an array type? */
 
 struct type *
-create_array_type (result_type, element_type, range_type)
-     struct type *result_type;
-     struct type *element_type;
-     struct type *range_type;
+create_array_type (struct type *result_type, struct type *element_type,
+		   struct type *range_type)
 {
   LONGEST low_bound, high_bound;
 
@@ -599,9 +577,7 @@
    sure it is TYPE_CODE_UNDEF before we bash it into a string type? */
 
 struct type *
-create_string_type (result_type, range_type)
-     struct type *result_type;
-     struct type *range_type;
+create_string_type (struct type *result_type, struct type *range_type)
 {
   result_type = create_array_type (result_type,
 				   *current_language->string_char_type,
@@ -611,9 +587,7 @@
 }
 
 struct type *
-create_set_type (result_type, domain_type)
-     struct type *result_type;
-     struct type *domain_type;
+create_set_type (struct type *result_type, struct type *domain_type)
 {
   LONGEST low_bound, high_bound, bit_length;
   if (result_type == NULL)
@@ -691,10 +665,8 @@
    allocated.  */
 
 void
-smash_to_member_type (type, domain, to_type)
-     struct type *type;
-     struct type *domain;
-     struct type *to_type;
+smash_to_member_type (struct type *type, struct type *domain,
+		      struct type *to_type)
 {
   struct objfile *objfile;
 
@@ -716,11 +688,8 @@
    allocated.  */
 
 void
-smash_to_method_type (type, domain, to_type, args)
-     struct type *type;
-     struct type *domain;
-     struct type *to_type;
-     struct type **args;
+smash_to_method_type (struct type *type, struct type *domain,
+		      struct type *to_type, struct type **args)
 {
   struct objfile *objfile;
 
@@ -739,8 +708,7 @@
    "union ", or "enum ".  If the type has a NULL name, return NULL.  */
 
 char *
-type_name_no_tag (type)
-     register const struct type *type;
+type_name_no_tag (register const struct type *type)
 {
   if (TYPE_TAG_NAME (type) != NULL)
     return TYPE_TAG_NAME (type);
@@ -755,8 +723,7 @@
    Return zero if NAME is not a primitive type. */
 
 struct type *
-lookup_primitive_typename (name)
-     char *name;
+lookup_primitive_typename (char *name)
 {
   struct type **const *p;
 
@@ -775,10 +742,7 @@
    If NOERR is nonzero, return zero if NAME is not suitably defined.  */
 
 struct type *
-lookup_typename (name, block, noerr)
-     char *name;
-     struct block *block;
-     int noerr;
+lookup_typename (char *name, struct block *block, int noerr)
 {
   register struct symbol *sym;
   register struct type *tmp;
@@ -804,8 +768,7 @@
 }
 
 struct type *
-lookup_unsigned_typename (name)
-     char *name;
+lookup_unsigned_typename (char *name)
 {
   char *uns = alloca (strlen (name) + 10);
 
@@ -815,8 +778,7 @@
 }
 
 struct type *
-lookup_signed_typename (name)
-     char *name;
+lookup_signed_typename (char *name)
 {
   struct type *t;
   char *uns = alloca (strlen (name) + 8);
@@ -834,9 +796,7 @@
    visible in lexical block BLOCK.  */
 
 struct type *
-lookup_struct (name, block)
-     char *name;
-     struct block *block;
+lookup_struct (char *name, struct block *block)
 {
   register struct symbol *sym;
 
@@ -858,9 +818,7 @@
    visible in lexical block BLOCK.  */
 
 struct type *
-lookup_union (name, block)
-     char *name;
-     struct block *block;
+lookup_union (char *name, struct block *block)
 {
   register struct symbol *sym;
   struct type *t;
@@ -892,9 +850,7 @@
    visible in lexical block BLOCK.  */
 
 struct type *
-lookup_enum (name, block)
-     char *name;
-     struct block *block;
+lookup_enum (char *name, struct block *block)
 {
   register struct symbol *sym;
 
@@ -915,10 +871,7 @@
    visible in lexical block BLOCK.  */
 
 struct type *
-lookup_template_type (name, type, block)
-     char *name;
-     struct type *type;
-     struct block *block;
+lookup_template_type (char *name, struct type *type, struct block *block)
 {
   struct symbol *sym;
   char *nam = (char *) alloca (strlen (name) + strlen (type->name) + 4);
@@ -951,10 +904,7 @@
    If NAME is the name of a baseclass type, return that type.  */
 
 struct type *
-lookup_struct_elt_type (type, name, noerr)
-     struct type *type;
-     char *name;
-     int noerr;
+lookup_struct_elt_type (struct type *type, char *name, int noerr)
 {
   int i;
 
@@ -1036,8 +986,7 @@
    will remain NULL.  */
 
 void
-fill_in_vptr_fieldno (type)
-     struct type *type;
+fill_in_vptr_fieldno (struct type *type)
 {
   CHECK_TYPEDEF (type);
 
@@ -1066,10 +1015,7 @@
    Return 1 if the destructor was found, otherwise, return 0.  */
 
 int
-get_destructor_fn_field (t, method_indexp, field_indexp)
-     struct type *t;
-     int *method_indexp;
-     int *field_indexp;
+get_destructor_fn_field (struct type *t, int *method_indexp, int *field_indexp)
 {
   int i;
 
@@ -1108,8 +1054,7 @@
 {"stub type has NULL name", 0, 0};
 
 struct type *
-check_typedef (type)
-     register struct type *type;
+check_typedef (register struct type *type)
 {
   struct type *orig_type = type;
   while (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
@@ -1224,9 +1169,7 @@
 #define ADD_EXTRA(c) { pextras->str[pextras->len++]=c; }
 
 static void
-add_name (pextras, n)
-     struct extra *pextras;
-     char *n;
+add_name (struct extra *pextras, char *n)
 {
   int nlen;
 
@@ -1237,9 +1180,7 @@
 }
 
 static void
-add_mangled_type (pextras, t)
-     struct extra *pextras;
-     struct type *t;
+add_mangled_type (struct extra *pextras, struct type *t)
 {
   enum type_code tcode;
   int tlen, tflags;
@@ -1369,10 +1310,7 @@
 
 #if 0
 void
-cfront_mangle_name (type, i, j)
-     struct type *type;
-     int i;
-     int j;
+cfront_mangle_name (struct type *type, int i, int j)
 {
   struct fn_field *f;
   char *mangled_name = gdb_mangle_name (type, i, j);
@@ -1414,7 +1352,7 @@
 	printf ("add_mangled_type: %s\n", extras.str);	/* FIXME */
       arm_mangled_name = malloc (strlen (mangled_name) + extras.len);
       sprintf (arm_mangled_name, "%s%s", mangled_name, extras.str);
-      free (mangled_name);
+      xfree (mangled_name);
       mangled_name = arm_mangled_name;
     }
 }
@@ -1458,10 +1396,7 @@
    the space required for them.  */
 
 void
-check_stub_method (type, method_id, signature_id)
-     struct type *type;
-     int method_id;
-     int signature_id;
+check_stub_method (struct type *type, int method_id, int signature_id)
 {
   struct fn_field *f;
   char *mangled_name = gdb_mangle_name (type, method_id, signature_id);
@@ -1549,7 +1484,7 @@
       argtypes[argcount] = NULL;	/* Ellist terminator */
     }
 
-  free (demangled_name);
+  xfree (demangled_name);
 
   f = TYPE_FN_FIELDLIST1 (type, method_id);
 
@@ -1566,8 +1501,7 @@
 const struct cplus_struct_type cplus_struct_default;
 
 void
-allocate_cplus_struct_type (type)
-     struct type *type;
+allocate_cplus_struct_type (struct type *type)
 {
   if (!HAVE_CPLUS_STRUCT (type))
     {
@@ -1585,12 +1519,8 @@
    in particular, where init_type is called with a NULL value for NAME). */
 
 struct type *
-init_type (code, length, flags, name, objfile)
-     enum type_code code;
-     int length;
-     int flags;
-     char *name;
-     struct objfile *objfile;
+init_type (enum type_code code, int length, int flags, char *name,
+	   struct objfile *objfile)
 {
   register struct type *type;
 
@@ -1639,9 +1569,7 @@
 
 
 struct type *
-lookup_fundamental_type (objfile, typeid)
-     struct objfile *objfile;
-     int typeid;
+lookup_fundamental_type (struct objfile *objfile, int typeid)
 {
   register struct type **typep;
   register int nbytes;
@@ -1676,8 +1604,7 @@
 }
 
 int
-can_dereference (t)
-     struct type *t;
+can_dereference (struct type *t)
 {
   /* FIXME: Should we return true for references as well as pointers?  */
   CHECK_TYPEDEF (t);
@@ -1688,8 +1615,7 @@
 }
 
 int
-is_integral_type (t)
-     struct type *t;
+is_integral_type (struct type *t)
 {
   CHECK_TYPEDEF (t);
   return
@@ -1708,8 +1634,7 @@
    Return true if TYPE is such a Chill varying type. */
 
 int
-chill_varying_type (type)
-     struct type *type;
+chill_varying_type (struct type *type)
 {
   if (TYPE_CODE (type) != TYPE_CODE_STRUCT
       || TYPE_NFIELDS (type) != 2
@@ -1725,9 +1650,7 @@
    the ancestor relationship even if they're identical */
 
 int
-is_ancestor (base, dclass)
-     struct type *base;
-     struct type *dclass;
+is_ancestor (struct type *base, struct type *dclass)
 {
   int i;
 
@@ -1736,6 +1659,9 @@
 
   if (base == dclass)
     return 1;
+  if (TYPE_NAME (base) && TYPE_NAME (dclass) &&
+      !strcmp (TYPE_NAME (base), TYPE_NAME (dclass)))
+    return 1;
 
   for (i = 0; i < TYPE_N_BASECLASSES (dclass); i++)
     if (is_ancestor (base, TYPE_BASECLASS (dclass, i)))
@@ -1751,8 +1677,7 @@
    runtime models.  Return 1 => Yes, 0 => No.  */
 
 int
-has_vtable (dclass)
-     struct type *dclass;
+has_vtable (struct type *dclass)
 {
   /* In the HP ANSI C++ runtime model, a class has a vtable only if it
      has virtual functions or virtual bases.  */
@@ -1794,8 +1719,7 @@
    and may not work with other runtime models.  */
 
 struct type *
-primary_base_class (dclass)
-     struct type *dclass;
+primary_base_class (struct type *dclass)
 {
   /* In HP ANSI C++'s runtime model, a "primary base class" of a class
      is the first directly inherited, non-virtual base class that
@@ -1827,8 +1751,7 @@
    copies the items out in reverse order.  */
 
 static void
-virtual_base_list_aux (dclass)
-     struct type *dclass;
+virtual_base_list_aux (struct type *dclass)
 {
   struct vbase *tmp_vbase;
   register int i;
@@ -1886,8 +1809,7 @@
    and then copies the result into an array to save space.  */
 
 struct type **
-virtual_base_list (dclass)
-     struct type *dclass;
+virtual_base_list (struct type *dclass)
 {
   register struct vbase *tmp_vbase;
   register struct vbase *tmp_vbase_2;
@@ -1913,7 +1835,7 @@
   while (tmp_vbase)
     {
       tmp_vbase = tmp_vbase->next;
-      free (tmp_vbase_2);
+      xfree (tmp_vbase_2);
       tmp_vbase_2 = tmp_vbase;
     }
 
@@ -1924,8 +1846,7 @@
 /* Return the length of the virtual base list of the type DCLASS.  */
 
 int
-virtual_base_list_length (dclass)
-     struct type *dclass;
+virtual_base_list_length (struct type *dclass)
 {
   register int i;
   register struct vbase *tmp_vbase;
@@ -1943,8 +1864,7 @@
    primary base, recursively).  */
 
 int
-virtual_base_list_length_skip_primaries (dclass)
-     struct type *dclass;
+virtual_base_list_length_skip_primaries (struct type *dclass)
 {
   register int i;
   register struct vbase *tmp_vbase;
@@ -1973,9 +1893,7 @@
    indicates "not found" or a problem.  */
 
 int
-virtual_base_index (base, dclass)
-     struct type *base;
-     struct type *dclass;
+virtual_base_index (struct type *base, struct type *dclass)
 {
   register struct type *vbase;
   register int i;
@@ -2005,9 +1923,7 @@
    found" or a problem.  */
 
 int
-virtual_base_index_skip_primaries (base, dclass)
-     struct type *base;
-     struct type *dclass;
+virtual_base_index_skip_primaries (struct type *base, struct type *dclass)
 {
   register struct type *vbase;
   register int i, j;
@@ -2039,8 +1955,7 @@
  * Position returned is 0-based. */
 
 int
-class_index_in_primary_list (dclass)
-     struct type *dclass;
+class_index_in_primary_list (struct type *dclass)
 {
   struct type *pbc;		/* primary base class */
 
@@ -2062,8 +1977,7 @@
  */
 
 int
-count_virtual_fns (dclass)
-     struct type *dclass;
+count_virtual_fns (struct type *dclass)
 {
   int fn, oi;			/* function and overloaded instance indices */
   int vfuncs;			/* count to return */
@@ -2072,6 +1986,8 @@
   struct type *pbc = primary_base_class (dclass);
   if (pbc)
     vfuncs = count_virtual_fns (pbc);
+  else
+    vfuncs = 0;
 
   for (fn = 0; fn < TYPE_NFN_FIELDS (dclass); fn++)
     for (oi = 0; oi < TYPE_FN_FIELDLIST_LENGTH (dclass, fn); oi++)
@@ -2092,9 +2008,7 @@
  * 3 => A is worse than B */
 
 int
-compare_badness (a, b)
-     struct badness_vector *a;
-     struct badness_vector *b;
+compare_badness (struct badness_vector *a, struct badness_vector *b)
 {
   int i;
   int tmp;
@@ -2137,11 +2051,7 @@
  * Return a pointer to a badness vector. This has NARGS + 1 entries. */
 
 struct badness_vector *
-rank_function (parms, nparms, args, nargs)
-     struct type **parms;
-     int nparms;
-     struct type **args;
-     int nargs;
+rank_function (struct type **parms, int nparms, struct type **args, int nargs)
 {
   int i;
   struct badness_vector *bv;
@@ -2182,9 +2092,7 @@
  * Generally the "bad" conversions are all uniformly assigned a 100 */
 
 int
-rank_one_type (parm, arg)
-     struct type *parm;
-     struct type *arg;
+rank_one_type (struct type *parm, struct type *arg)
 {
   /* Identical type pointers */
   /* However, this still doesn't catch all cases of same type for arg
@@ -2206,7 +2114,8 @@
      really are the same.
   */
 
-  if (TYPE_NAME (parm) == TYPE_NAME (arg))
+  if (TYPE_NAME (parm) && TYPE_NAME (arg) &&
+      !strcmp (TYPE_NAME (parm), TYPE_NAME (arg)))
       return 0;
 
   /* Check if identical after resolving typedefs */
@@ -2216,10 +2125,10 @@
   /* See through references, since we can almost make non-references
      references. */
   if (TYPE_CODE (arg) == TYPE_CODE_REF)
-    return (rank_one_type (TYPE_TARGET_TYPE (arg), parm)
+    return (rank_one_type (parm, TYPE_TARGET_TYPE (arg))
 	    + REFERENCE_CONVERSION_BADNESS);
   if (TYPE_CODE (parm) == TYPE_CODE_REF)
-    return (rank_one_type (arg, TYPE_TARGET_TYPE (parm))
+    return (rank_one_type (TYPE_TARGET_TYPE (parm), arg)
 	    + REFERENCE_CONVERSION_BADNESS);
   if (overload_debug)
   /* Debugging only. */
@@ -2514,9 +2423,7 @@
 /* End of functions for overload resolution */
 
 static void
-print_bit_vector (bits, nbits)
-     B_TYPE *bits;
-     int nbits;
+print_bit_vector (B_TYPE *bits, int nbits)
 {
   int bitno;
 
@@ -2544,9 +2451,7 @@
    include it since we may get into a infinitely recursive situation. */
 
 static void
-print_arg_types (args, spaces)
-     struct type **args;
-     int spaces;
+print_arg_types (struct type **args, int spaces)
 {
   if (args != NULL)
     {
@@ -2562,9 +2467,7 @@
 }
 
 static void
-dump_fn_fieldlists (type, spaces)
-     struct type *type;
-     int spaces;
+dump_fn_fieldlists (struct type *type, int spaces)
 {
   int method_idx;
   int overload_idx;
@@ -2627,9 +2530,7 @@
 }
 
 static void
-print_cplus_stuff (type, spaces)
-     struct type *type;
-     int spaces;
+print_cplus_stuff (struct type *type, int spaces)
 {
   printfi_filtered (spaces, "n_baseclasses %d\n",
 		    TYPE_N_BASECLASSES (type));
@@ -2680,9 +2581,7 @@
 static struct obstack dont_print_type_obstack;
 
 void
-recursive_dump_type (type, spaces)
-     struct type *type;
-     int spaces;
+recursive_dump_type (struct type *type, int spaces)
 {
   int idx;
 
@@ -2887,7 +2786,7 @@
 
 static void build_gdbtypes (void);
 static void
-build_gdbtypes ()
+build_gdbtypes (void)
 {
   builtin_type_void =
     init_type (TYPE_CODE_VOID, 1,
@@ -3030,12 +2929,9 @@
   /* NOTE: At present there is no way of differentiating between at
      target address and the target C language pointer type type even
      though the two can be different (cf d10v) */
-  builtin_type_ptr =
-    init_type (TYPE_CODE_INT, TARGET_PTR_BIT / 8,
-	       TYPE_FLAG_UNSIGNED,
-	       "__ptr", (struct objfile *) NULL);
+  builtin_type_ptr = make_pointer_type (builtin_type_void, NULL);
   builtin_type_CORE_ADDR =
-    init_type (TYPE_CODE_INT, TARGET_PTR_BIT / 8,
+    init_type (TYPE_CODE_INT, TARGET_ADDR_BIT / 8,
 	       TYPE_FLAG_UNSIGNED,
 	       "__CORE_ADDR", (struct objfile *) NULL);
   builtin_type_bfd_vma =
@@ -3047,7 +2943,7 @@
 
 extern void _initialize_gdbtypes (void);
 void
-_initialize_gdbtypes ()
+_initialize_gdbtypes (void)
 {
   struct cmd_list_element *c;
   build_gdbtypes ();
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 19fd152..b7a9a75 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -147,7 +147,7 @@
 
 /* No sign for this type.  In C++, "char", "signed char", and "unsigned
    char" are distinct types; so we need an extra flag to indicate the
-   absence ofa sign! */
+   absence of a sign! */
 
 #define TYPE_FLAG_NOSIGN	(1 << 1)
 
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 243e264..cceef39 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -627,13 +627,13 @@
       mach_port_deallocate (mach_task_self (), proc->port);
     }
 
-  free (proc);
+  xfree (proc);
   return next;
 }
 
 
 struct inf *
-make_inf ()
+make_inf (void)
 {
   struct inf *inf = malloc (sizeof (struct inf));
 
@@ -1659,13 +1659,13 @@
 	{
 	  if (thread->exc_port == port)
 	    {
-	      inf_debug (waiting_inf, "Handler is thread exeption port <%d>",
+	      inf_debug (waiting_inf, "Handler is thread exception port <%d>",
 			 thread->saved_exc_port);
 	      inf->wait.exc.handler = thread->saved_exc_port;
 	    }
 	  else
 	    {
-	      inf_debug (waiting_inf, "Handler is task exeption port <%d>",
+	      inf_debug (waiting_inf, "Handler is task exception port <%d>",
 			 inf->task->saved_exc_port);
 	      inf->wait.exc.handler = inf->task->saved_exc_port;
 	      assert (inf->task->exc_port == port);
@@ -1994,7 +1994,7 @@
 
 
 static void
-gnu_kill_inferior ()
+gnu_kill_inferior (void)
 {
   struct proc *task = current_inferior->task;
   if (task)
@@ -2008,7 +2008,7 @@
 
 /* Clean up after the inferior dies.  */
 static void
-gnu_mourn_inferior ()
+gnu_mourn_inferior (void)
 {
   inf_debug (current_inferior, "rip");
   inf_detach (current_inferior);
@@ -2021,7 +2021,7 @@
 
 /* Set INFERIOR_PID to the first thread available in the child, if any.  */
 static int
-inf_pick_first_thread ()
+inf_pick_first_thread (void)
 {
   if (current_inferior->task && current_inferior->threads)
     /* The first thread.  */
@@ -2032,7 +2032,7 @@
 }
 
 static struct inf *
-cur_inf ()
+cur_inf (void)
 {
   if (!current_inferior)
     current_inferior = make_inf ();
@@ -2040,10 +2040,7 @@
 }
 
 static void
-gnu_create_inferior (exec_file, allargs, env)
-     char *exec_file;
-     char *allargs;
-     char **env;
+gnu_create_inferior (char *exec_file, char *allargs, char **env)
 {
   struct inf *inf = cur_inf ();
 
@@ -2099,7 +2096,7 @@
 /* Mark our target-struct as eligible for stray "run" and "attach"
    commands.  */
 static int
-gnu_can_run ()
+gnu_can_run (void)
 {
   return 1;
 }
@@ -2110,9 +2107,7 @@
 /* Attach to process PID, then initialize for debugging it
    and wait for the trace-trap that results from attaching.  */
 static void
-gnu_attach (args, from_tty)
-     char *args;
-     int from_tty;
+gnu_attach (char *args, int from_tty)
 {
   int pid;
   char *exec_file;
@@ -2174,9 +2169,7 @@
    previously attached.  It *might* work if the program was
    started via fork.  */
 static void
-gnu_detach (args, from_tty)
-     char *args;
-     int from_tty;
+gnu_detach (char *args, int from_tty)
 {
   if (from_tty)
     {
@@ -2199,7 +2192,7 @@
 
 
 static void
-gnu_terminal_init_inferior ()
+gnu_terminal_init_inferior (void)
 {
   assert (current_inferior);
   terminal_init_inferior_with_pgrp (current_inferior->pid);
@@ -2211,7 +2204,7 @@
    that registers contains all the registers from the program being
    debugged.  */
 static void
-gnu_prepare_to_store ()
+gnu_prepare_to_store (void)
 {
 #ifdef CHILD_PREPARE_TO_STORE
   CHILD_PREPARE_TO_STORE ();
@@ -2219,21 +2212,19 @@
 }
 
 static void
-gnu_open (arg, from_tty)
-     char *arg;
-     int from_tty;
+gnu_open (char *arg, int from_tty)
 {
   error ("Use the \"run\" command to start a Unix child process.");
 }
 
 static void
-gnu_stop ()
+gnu_stop (void)
 {
   error ("to_stop target function not implemented");
 }
 
 static char *
-gnu_pid_to_exec_file ()
+gnu_pid_to_exec_file (void)
 {
   error ("to_pid_to_exec_file target function not implemented");
   return NULL;
@@ -2252,11 +2243,7 @@
    gdb's address space.  Return 0 on failure; number of bytes read
    otherwise.  */
 int
-gnu_read_inferior (task, addr, myaddr, length)
-     task_t task;
-     CORE_ADDR addr;
-     char *myaddr;
-     int length;
+gnu_read_inferior (task_t task, CORE_ADDR addr, char *myaddr, int length)
 {
   error_t err;
   vm_address_t low_address = (vm_address_t) trunc_page (addr);
@@ -2300,11 +2287,7 @@
 /* Write gdb's LEN bytes from MYADDR and copy it to ADDR in inferior
    task's address space.  */
 int
-gnu_write_inferior (task, addr, myaddr, length)
-     task_t task;
-     CORE_ADDR addr;
-     char *myaddr;
-     int length;
+gnu_write_inferior (task_t task, CORE_ADDR addr, char *myaddr, int length)
 {
   error_t err = 0;
   vm_address_t low_address = (vm_address_t) trunc_page (addr);
@@ -2459,14 +2442,11 @@
 }
 
 
-/* Return 0 on failure, number of bytes handled otherwise.  */
+/* Return 0 on failure, number of bytes handled otherwise.  TARGET
+   is ignored. */
 static int
-gnu_xfer_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* IGNORED */
+gnu_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		 struct target_ops *target)
 {
   task_t task = (current_inferior
 		 ? (current_inferior->task
@@ -2672,7 +2652,7 @@
 
 /* Returns the alive thread named by INFERIOR_PID, or signals an error.  */
 static struct proc *
-cur_thread ()
+cur_thread (void)
 {
   struct inf *inf = cur_inf ();
   struct proc *thread = inf_tid_to_thread (inf, inferior_pid);
@@ -2683,7 +2663,7 @@
 
 /* Returns the current inferior, but signals an error if it has no task.  */
 static struct inf *
-active_inf ()
+active_inf (void)
 {
   struct inf *inf = cur_inf ();
   if (!inf->task)
@@ -3361,8 +3341,7 @@
    end up looping in mysterious Bpt traps */
 
 void
-flush_inferior_icache (pc, amount)
-     CORE_ADDR pc;
+flush_inferior_icache (CORE_ADDR pc, int amount)
 {
   vm_machine_attribute_val_t flush = MATTR_VAL_ICACHE_FLUSH;
   error_t ret;
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 6668f06..4117006 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -389,6 +389,13 @@
      point of changing back to where GDB thinks is its cwd, when we
      return control to the debugger, but restore child's cwd before we
      run it.  */
+  /* Initialize child_cwd, before the first call to run_child and not
+     in the initialization, so the child get also the changed directory
+     set with the gdb-command "cd ..." */
+  if (!*child_cwd)
+    /* Initialize child's cwd with the current one.  */
+    getcwd (child_cwd, sizeof (child_cwd));
+    
   chdir (child_cwd);
 
 #if __DJGPP_MINOR__ < 3
@@ -603,6 +610,11 @@
     }
   resume_signal = -1;
   resume_is_step = 0;
+
+  /* Initialize child's cwd as empty to be initialized when starting
+     the child.  */
+  *child_cwd = 0;
+
   /* Init command line storage.  */
   if (redir_debug_init (&child_cmd) == -1)
     internal_error ("Cannot allocate redirection storage: not enough memory.\n");
@@ -1224,8 +1236,9 @@
   go32_ops.to_has_execution = 1;
   go32_ops.to_magic = OPS_MAGIC;
 
-  /* Initialize child's cwd with the current one.  */
-  getcwd (child_cwd, sizeof (child_cwd));
+  /* Initialize child's cwd as empty to be initialized when starting
+     the child.  */
+  *child_cwd = 0;
 
   /* Initialize child's command line storage.  */
   if (redir_debug_init (&child_cmd) == -1)
diff --git a/gdb/gregset.h b/gdb/gregset.h
index 3a85397..dc4aa4e 100644
--- a/gdb/gregset.h
+++ b/gdb/gregset.h
@@ -1,5 +1,5 @@
 /* Interface for functions using gregset and fpregset types.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -18,6 +18,9 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef GREGSET_H
+#define GREGSET_H
+
 #ifndef GDB_GREGSET_T
 #define GDB_GREGSET_T gregset_t
 #endif
@@ -26,7 +29,7 @@
 #define GDB_FPREGSET_T fpregset_t
 #endif
 
-typedef GDB_GREGSET_T  gdb_gregset_t;
+typedef GDB_GREGSET_T gdb_gregset_t;
 typedef GDB_FPREGSET_T gdb_fpregset_t;
 
 /* A gregset is a data structure supplied by the native OS containing
@@ -36,15 +39,17 @@
    structures were originally a part of the /proc interface, but have
    been borrowed or copied by other GDB targets, eg. Linux.  */
 
-/* Copy register values from the native target gregset / fpregset
+/* Copy register values from the native target gregset/fpregset
    into GDB's internal register cache.  */
 
-extern void supply_gregset  (gdb_gregset_t *gregs);
+extern void supply_gregset (gdb_gregset_t *gregs);
 extern void supply_fpregset (gdb_fpregset_t *fpregs);
 
 /* Copy register values from GDB's register cache into
-   the native target gregset / fpregset.  If regno is -1, 
+   the native target gregset/fpregset.  If regno is -1, 
    copy all the registers.  */
 
-extern void fill_gregset    (gdb_gregset_t *gregs, int regno);
-extern void fill_fpregset   (gdb_fpregset_t *fpregs, int regno);
+extern void fill_gregset (gdb_gregset_t *gregs, int regno);
+extern void fill_fpregset (gdb_fpregset_t *fpregs, int regno);
+
+#endif
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index af2530c..84e190b 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -72,8 +72,7 @@
 void h8300_frame_find_saved_regs ();
 
 CORE_ADDR
-h8300_skip_prologue (start_pc)
-     CORE_ADDR start_pc;
+h8300_skip_prologue (CORE_ADDR start_pc)
 {
   short int w;
   int adjust = 0;
@@ -143,9 +142,7 @@
 }
 
 int
-gdb_print_insn_h8300 (memaddr, info)
-     bfd_vma memaddr;
-     disassemble_info *info;
+gdb_print_insn_h8300 (bfd_vma memaddr, disassemble_info *info)
 {
   if (h8300smode)
     return print_insn_h8300s (memaddr, info);
@@ -163,8 +160,7 @@
    the function prologue to determine the caller's sp value, and return it.  */
 
 CORE_ADDR
-h8300_frame_chain (thisframe)
-     struct frame_info *thisframe;
+h8300_frame_chain (struct frame_info *thisframe)
 {
   if (PC_IN_CALL_DUMMY (thisframe->pc, thisframe->frame, thisframe->frame))
     {				/* initialize the from_pc now */
@@ -187,9 +183,8 @@
    fairly expensive.  */
 
 void
-h8300_frame_find_saved_regs (fi, fsr)
-     struct frame_info *fi;
-     struct frame_saved_regs *fsr;
+h8300_frame_find_saved_regs (struct frame_info *fi,
+			     struct frame_saved_regs *fsr)
 {
   register struct frame_saved_regs *cache_fsr;
   CORE_ADDR ip;
@@ -232,10 +227,7 @@
    of the instruction. */
 
 CORE_ADDR
-NEXT_PROLOGUE_INSN (addr, lim, pword1)
-     CORE_ADDR addr;
-     CORE_ADDR lim;
-     INSN_WORD *pword1;
+NEXT_PROLOGUE_INSN (CORE_ADDR addr, CORE_ADDR lim, INSN_WORD *pword1)
 {
   char buf[2];
   if (addr < lim + 8)
@@ -258,12 +250,9 @@
    to reflect the offsets of the arg pointer and the locals pointer.  */
 
 static CORE_ADDR
-examine_prologue (ip, limit, after_prolog_fp, fsr, fi)
-     register CORE_ADDR ip;
-     register CORE_ADDR limit;
-     CORE_ADDR after_prolog_fp;
-     struct frame_saved_regs *fsr;
-     struct frame_info *fi;
+examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit,
+		  CORE_ADDR after_prolog_fp, struct frame_saved_regs *fsr,
+		  struct frame_info *fi)
 {
   register CORE_ADDR next_ip;
   int r;
@@ -416,9 +405,7 @@
 }
 
 void
-h8300_init_extra_frame_info (fromleaf, fi)
-     int fromleaf;
-     struct frame_info *fi;
+h8300_init_extra_frame_info (int fromleaf, struct frame_info *fi)
 {
   fi->fsr = 0;			/* Not yet allocated */
   fi->args_pointer = 0;		/* Unknown */
@@ -436,8 +423,7 @@
    just use the register SRP_REGNUM itself.  */
 
 CORE_ADDR
-h8300_frame_saved_pc (frame)
-     struct frame_info *frame;
+h8300_frame_saved_pc (struct frame_info *frame)
 {
   if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
     return generic_read_register_dummy (frame->pc, frame->frame, PC_REGNUM);
@@ -446,8 +432,7 @@
 }
 
 CORE_ADDR
-frame_locals_address (fi)
-     struct frame_info *fi;
+frame_locals_address (struct frame_info *fi)
 {
   if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
     return (CORE_ADDR) 0;	/* Not sure what else to do... */
@@ -465,8 +450,7 @@
    described by FI.  Returns 0 if the address is unknown.  */
 
 CORE_ADDR
-frame_args_address (fi)
-     struct frame_info *fi;
+frame_args_address (struct frame_info *fi)
 {
   if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
     return (CORE_ADDR) 0;	/* Not sure what else to do... */
@@ -519,12 +503,8 @@
    the other arguments passed in via registers R0 to R2.  */
 
 CORE_ADDR
-h8300_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     struct value **args;
-     CORE_ADDR sp;
-     unsigned char struct_return;
-     CORE_ADDR struct_addr;
+h8300_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
+		      unsigned char struct_return, CORE_ADDR struct_addr)
 {
   int stack_align, stack_alloc, stack_offset;
   int wordsize;
@@ -613,9 +593,7 @@
    a JSR/BSR instruction.  */
 
 CORE_ADDR
-h8300_push_return_address (pc, sp)
-     CORE_ADDR pc;
-     CORE_ADDR sp;
+h8300_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
 {
   unsigned char buf[4];
   int wordsize;
@@ -637,7 +615,7 @@
    call_function_by_hand after the dummy_frame is finished. */
 
 void
-h8300_pop_frame ()
+h8300_pop_frame (void)
 {
   unsigned regnum;
   struct frame_saved_regs fsr;
@@ -673,10 +651,7 @@
    Copy that into VALBUF.  Be sure to account for CPU type.   */
 
 void
-h8300_extract_return_value (type, regbuf, valbuf)
-     struct type *type;
-     char *regbuf;
-     char *valbuf;
+h8300_extract_return_value (struct type *type, char *regbuf, char *valbuf)
 {
   int wordsize, len;
 
@@ -716,9 +691,7 @@
    Primarily used by the RETURN command.  */
 
 void
-h8300_store_return_value (type, valbuf)
-     struct type *type;
-     char *valbuf;
+h8300_store_return_value (struct type *type, char *valbuf)
 {
   int wordsize, len, regval;
 
@@ -756,7 +729,7 @@
 struct cmd_list_element *setmemorylist;
 
 static void
-set_register_names ()
+set_register_names (void)
 {
   if (h8300hmode != 0)
     h8300_register_names = h8300h_register_names;
@@ -765,7 +738,7 @@
 }
 
 static void
-h8300_command (args, from_tty)
+h8300_command (char *args, int from_tty)
 {
   extern int h8300hmode;
   h8300hmode = 0;
@@ -774,7 +747,7 @@
 }
 
 static void
-h8300h_command (args, from_tty)
+h8300h_command (char *args, int from_tty)
 {
   extern int h8300hmode;
   h8300hmode = 1;
@@ -783,7 +756,7 @@
 }
 
 static void
-h8300s_command (args, from_tty)
+h8300s_command (char *args, int from_tty)
 {
   extern int h8300smode;
   extern int h8300hmode;
@@ -794,9 +767,7 @@
 
 
 static void
-set_machine (args, from_tty)
-     char *args;
-     int from_tty;
+set_machine (char *args, int from_tty)
 {
   printf_unfiltered ("\"set machine\" must be followed by h8300, h8300h");
   printf_unfiltered ("or h8300s");
@@ -810,8 +781,7 @@
    to be 16 or 32 bits as appropriate for the machine.  */
 
 static void
-set_machine_hook (filename)
-     char *filename;
+set_machine_hook (char *filename)
 {
   if (bfd_get_mach (exec_bfd) == bfd_mach_h8300s)
     {
@@ -832,7 +802,7 @@
 }
 
 void
-_initialize_h8300m ()
+_initialize_h8300m (void)
 {
   add_prefix_cmd ("machine", no_class, set_machine,
 		  "set the machine type",
@@ -856,7 +826,7 @@
 
 
 void
-print_register_hook (regno)
+print_register_hook (int regno)
 {
   if (regno == 8)
     {
@@ -901,7 +871,7 @@
 }
 
 void
-_initialize_h8300_tdep ()
+_initialize_h8300_tdep (void)
 {
   tm_print_insn = gdb_print_insn_h8300;
 }
diff --git a/gdb/h8500-tdep.c b/gdb/h8500-tdep.c
index b6ac28c..aa53d69 100644
--- a/gdb/h8500-tdep.c
+++ b/gdb/h8500-tdep.c
@@ -78,8 +78,7 @@
 int minimum_mode = 1;
 
 CORE_ADDR
-h8500_skip_prologue (start_pc)
-     CORE_ADDR start_pc;
+h8500_skip_prologue (CORE_ADDR start_pc)
 {
   short int w;
 
@@ -100,8 +99,7 @@
 }
 
 CORE_ADDR
-h8500_addr_bits_remove (addr)
-     CORE_ADDR addr;
+h8500_addr_bits_remove (CORE_ADDR addr)
 {
   return ((addr) & 0xffffff);
 }
@@ -114,8 +112,7 @@
    the function prologue to determine the caller's sp value, and return it.  */
 
 CORE_ADDR
-h8500_frame_chain (thisframe)
-     struct frame_info *thisframe;
+h8500_frame_chain (struct frame_info *thisframe)
 {
   if (!inside_entry_file (thisframe->pc))
     return (read_memory_integer (FRAME_FP (thisframe), PTR_SIZE));
@@ -129,10 +126,7 @@
    of the instruction. */
 
 CORE_ADDR
-NEXT_PROLOGUE_INSN (addr, lim, pword1)
-     CORE_ADDR addr;
-     CORE_ADDR lim;
-     char *pword1;
+NEXT_PROLOGUE_INSN (CORE_ADDR addr, CORE_ADDR lim, char *pword1)
 {
   if (addr < lim + 8)
     {
@@ -156,14 +150,13 @@
 /* Return the saved PC from this frame. */
 
 CORE_ADDR
-frame_saved_pc (frame)
-     struct frame_info *frame;
+frame_saved_pc (struct frame_info *frame)
 {
   return read_memory_integer (FRAME_FP (frame) + 2, PTR_SIZE);
 }
 
 void
-h8500_pop_frame ()
+h8500_pop_frame (void)
 {
   unsigned regnum;
   struct frame_saved_regs fsr;
@@ -181,8 +174,7 @@
 }
 
 void
-print_register_hook (regno)
-     int regno;
+print_register_hook (int regno)
 {
   if (regno == CCR_REGNUM)
     {
@@ -228,8 +220,7 @@
 }
 
 int
-h8500_register_size (regno)
-     int regno;
+h8500_register_size (int regno)
 {
   switch (regno)
     {
@@ -265,8 +256,7 @@
 }
 
 struct type *
-h8500_register_virtual_type (regno)
-     int regno;
+h8500_register_virtual_type (int regno)
 {
   switch (regno)
     {
@@ -307,9 +297,8 @@
    the address we return for it IS the sp for the next frame.  */
 
 void
-frame_find_saved_regs (frame_info, frame_saved_regs)
-     struct frame_info *frame_info;
-     struct frame_saved_regs *frame_saved_regs;
+frame_find_saved_regs (struct frame_info *frame_info,
+		       struct frame_saved_regs *frame_saved_regs)
 {
   register int regnum;
   register int regmask;
@@ -387,7 +376,7 @@
 }
 
 CORE_ADDR
-saved_pc_after_call ()
+saved_pc_after_call (void)
 {
   int x;
   int a = read_register (SP_REGNUM);
@@ -404,8 +393,7 @@
 }
 
 void
-h8500_set_pointer_size (newsize)
-     int newsize;
+h8500_set_pointer_size (int newsize)
 {
   static int oldsize = 0;
 
@@ -426,7 +414,7 @@
 }
 
 static void
-big_command ()
+big_command (char *arg, int from_tty)
 {
   h8500_set_pointer_size (32);
   code_size = 4;
@@ -434,7 +422,7 @@
 }
 
 static void
-medium_command ()
+medium_command (char *arg, int from_tty)
 {
   h8500_set_pointer_size (32);
   code_size = 4;
@@ -442,7 +430,7 @@
 }
 
 static void
-compact_command ()
+compact_command (char *arg, int from_tty)
 {
   h8500_set_pointer_size (32);
   code_size = 2;
@@ -450,7 +438,7 @@
 }
 
 static void
-small_command ()
+small_command (char *arg, int from_tty)
 {
   h8500_set_pointer_size (16);
   code_size = 2;
@@ -460,9 +448,7 @@
 static struct cmd_list_element *setmemorylist;
 
 static void
-set_memory (args, from_tty)
-     char *args;
-     int from_tty;
+set_memory (char *args, int from_tty)
 {
   printf_unfiltered ("\"set memory\" must be followed by the name of a memory subcommand.\n");
   help_list (setmemorylist, "set memory ", -1, gdb_stdout);
@@ -471,8 +457,7 @@
 /* See if variable name is ppc or pr[0-7] */
 
 int
-h8500_is_trapped_internalvar (name)
-     char *name;
+h8500_is_trapped_internalvar (char *name)
 {
   if (name[0] != 'p')
     return 0;
@@ -490,8 +475,7 @@
 }
 
 value_ptr
-h8500_value_of_trapped_internalvar (var)
-     struct internalvar *var;
+h8500_value_of_trapped_internalvar (struct internalvar *var)
 {
   LONGEST regval;
   unsigned char regbuf[4];
@@ -526,7 +510,7 @@
   get_saved_register (regbuf, NULL, NULL, selected_frame, regnum, NULL);
   regval |= regbuf[0] << 8 | regbuf[1];		/* XXX host/target byte order */
 
-  free (var->value);		/* Free up old value */
+  xfree (var->value);		/* Free up old value */
 
   var->value = value_from_longest (builtin_type_unsigned_long, regval);
   release_value (var->value);	/* Unchain new value */
@@ -537,10 +521,8 @@
 }
 
 void
-h8500_set_trapped_internalvar (var, newval, bitpos, bitsize, offset)
-     struct internalvar *var;
-     int offset, bitpos, bitsize;
-     value_ptr newval;
+h8500_set_trapped_internalvar (struct internalvar *var, value_ptr newval,
+			       int bitpos, int bitsize, int offset)
 {
   char *page_regnum, *regnum;
   char expression[100];
@@ -590,48 +572,43 @@
 }
 
 CORE_ADDR
-h8500_read_sp ()
+h8500_read_sp (void)
 {
   return read_register (PR7_REGNUM);
 }
 
 void
-h8500_write_sp (v)
-     CORE_ADDR v;
+h8500_write_sp (CORE_ADDR v)
 {
   write_register (PR7_REGNUM, v);
 }
 
 CORE_ADDR
-h8500_read_pc (pid)
-     int pid;
+h8500_read_pc (int pid)
 {
   return read_register (PC_REGNUM);
 }
 
 void
-h8500_write_pc (v, pid)
-     CORE_ADDR v;
-     int pid;
+h8500_write_pc (CORE_ADDR v, int pid)
 {
   write_register (PC_REGNUM, v);
 }
 
 CORE_ADDR
-h8500_read_fp ()
+h8500_read_fp (void)
 {
   return read_register (PR6_REGNUM);
 }
 
 void
-h8500_write_fp (v)
-     CORE_ADDR v;
+h8500_write_fp (CORE_ADDR v)
 {
   write_register (PR6_REGNUM, v);
 }
 
 void
-_initialize_h8500_tdep ()
+_initialize_h8500_tdep (void)
 {
   tm_print_insn = print_insn_h8500;
 
diff --git a/gdb/hp-psymtab-read.c b/gdb/hp-psymtab-read.c
index f1aa475..007b23e 100644
--- a/gdb/hp-psymtab-read.c
+++ b/gdb/hp-psymtab-read.c
@@ -70,10 +70,9 @@
 #include <stdlib.h>
 #include <string.h>
 
-/* check for the existance of a file, given its full pathname */
+/* check for the existence of a file, given its full pathname */
 int
-file_exists (filename)
-     char *filename;
+file_exists (char *filename)
 {
   if (filename)
     return (access (filename, F_OK) == 0);
@@ -84,8 +83,7 @@
 /* Translate from the "hp_language" enumeration in hp-symtab.h
    used in the debug info to gdb's generic enumeration in defs.h. */
 static enum language
-trans_lang (in_lang)
-     enum hp_language in_lang;
+trans_lang (enum hp_language in_lang)
 {
   if (in_lang == HP_LANGUAGE_C)
     return language_c;
@@ -105,15 +103,14 @@
 /* Call PXDB to process our file.
 
    Approach copied from DDE's "dbgk_run_pxdb".  Note: we
-   don't check for BSD location of pxdb, nor for existance
+   don't check for BSD location of pxdb, nor for existence
    of pxdb itself, etc.
 
    NOTE: uses system function and string functions directly.
 
    Return value: 1 if ok, 0 if not */
 int
-hpread_call_pxdb (file_name)
-     char *file_name;
+hpread_call_pxdb (char *file_name)
 {
   char *p;
   int status;
@@ -146,8 +143,7 @@
    and the file therefore needs to be re-loaded.  Otherwise
    return 0. */
 int
-hpread_pxdb_needed (sym_bfd)
-     bfd *sym_bfd;
+hpread_pxdb_needed (bfd *sym_bfd)
 {
   asection *pinfo_section, *debug_section, *header_section;
   unsigned int do_pxdb;
@@ -277,8 +273,7 @@
    If so, call pxdb. */
 
 void
-do_pxdb (sym_bfd)
-     bfd *sym_bfd;
+do_pxdb (bfd *sym_bfd)
 {
   /* The following code is HP-specific.  The "right" way of
      doing this is unknown, but we bet would involve a target-
@@ -373,7 +368,7 @@
 
 /* Set up psymtab symbol index stuff */
 static void
-init_pst_syms ()
+init_pst_syms (void)
 {
   pst_syms_count = 0;
   pst_syms_size = 20;
@@ -382,19 +377,17 @@
 
 /* Clean up psymtab symbol index stuff */
 static void
-clear_pst_syms ()
+clear_pst_syms (void)
 {
   pst_syms_count = 0;
   pst_syms_size = 0;
-  free (pst_syms_array);
+  xfree (pst_syms_array);
   pst_syms_array = 0;
 }
 
 /* Add information about latest psymtab to symbol index table */
 static void
-record_pst_syms (start_sym, end_sym)
-     int start_sym;
-     int end_sym;
+record_pst_syms (int start_sym, int end_sym)
 {
   if (++pst_syms_count > pst_syms_size)
     {
@@ -416,8 +409,7 @@
 
    Return 0 => not found */
 static int
-find_next_pst_start (index)
-     int index;
+find_next_pst_start (int index)
 {
   int i;
 
@@ -442,11 +434,8 @@
 
    Return 0 => not found */
 static int
-find_next_file_isym (index, qFD, curr_fd, pxdb_header_p)
-     int index;
-     quick_file_entry *qFD;
-     int curr_fd;
-     PXDB_header_ptr pxdb_header_p;
+find_next_file_isym (int index, quick_file_entry *qFD, int curr_fd,
+		     PXDB_header_ptr pxdb_header_p)
 {
   while (VALID_CURR_FILE)
     {
@@ -464,11 +453,8 @@
 
    Return 0 => not found */
 static int
-find_next_proc_isym (index, qPD, curr_pd, pxdb_header_p)
-     int index;
-     quick_procedure_entry *qPD;
-     int curr_pd;
-     PXDB_header_ptr pxdb_header_p;
+find_next_proc_isym (int index, quick_procedure_entry *qPD, int curr_pd,
+		     PXDB_header_ptr pxdb_header_p)
 {
   while (VALID_CURR_PROC)
     {
@@ -486,11 +472,8 @@
 
    Return 0 => not found */
 static int
-find_next_module_isym (index, qMD, curr_md, pxdb_header_p)
-     int index;
-     quick_module_entry *qMD;
-     int curr_md;
-     PXDB_header_ptr pxdb_header_p;
+find_next_module_isym (int index, quick_module_entry *qMD, int curr_md,
+		       PXDB_header_ptr pxdb_header_p)
 {
   while (VALID_CURR_MODULE)
     {
@@ -505,20 +488,23 @@
    pointed to by CURR_PD_P, and between code addresses START_ADR and END_ADR.
    Other parameters are explained in comments below. */
 
-/* This used to be inline in hpread_quick_traverse, but now that we do essentially the
-   same thing for two different cases (modules and module-less files), it's better
-   organized in a separate routine, although it does take lots of arguments. pai/1997-10-08 */
+/* This used to be inline in hpread_quick_traverse, but now that we do
+   essentially the same thing for two different cases (modules and
+   module-less files), it's better organized in a separate routine,
+   although it does take lots of arguments.  pai/1997-10-08
+   
+   CURR_PD_P is the pointer to the current proc index. QPD is the
+   procedure quick lookup table.  MAX_PROCS is the number of entries
+   in the proc. table.  START_ADR is the beginning of the code range
+   for the current psymtab.  end_adr is the end of the code range for
+   the current psymtab.  PST is the current psymtab.  VT_bits is
+   a pointer to the strings table of SOM debug space.  OBJFILE is
+   the current object file. */
 
 static int
-scan_procs (curr_pd_p, qPD, max_procs, start_adr, end_adr, pst, vt_bits, objfile)
-     int *curr_pd_p;		/* pointer to current proc index */
-     quick_procedure_entry *qPD;	/* the procedure quick lookup table */
-     int max_procs;		/* number of entries in proc. table */
-     CORE_ADDR start_adr;	/* beginning of code range for current psymtab */
-     CORE_ADDR end_adr;		/* end of code range for current psymtab */
-     struct partial_symtab *pst;	/* current psymtab */
-     char *vt_bits;		/* strings table of SOM debug space */
-     struct objfile *objfile;	/* current object file */
+scan_procs (int *curr_pd_p, quick_procedure_entry *qPD, int max_procs,
+	    CORE_ADDR start_adr, CORE_ADDR end_adr, struct partial_symtab *pst,
+	    char *vt_bits, struct objfile *objfile)
 {
   union dnttentry *dn_bufp;
   int symbol_count = 0;		/* Total number of symbols in this psymtab */
@@ -640,11 +626,8 @@
    entry for it, so in such cases we create a psymtab for the file.  */
 
 int
-hpread_quick_traverse (objfile, gntt_bits, vt_bits, pxdb_header_p)
-     struct objfile *objfile;	/* The object file descriptor */
-     char *gntt_bits;		/* GNTT entries, loaded in from the file */
-     char *vt_bits;		/* VT (string) entries ditto. */
-     PXDB_header_ptr pxdb_header_p;	/* Pointer to pxdb header ditto */
+hpread_quick_traverse (struct objfile *objfile, char *gntt_bits,
+		       char *vt_bits, PXDB_header_ptr pxdb_header_p)
 {
   struct partial_symtab *pst;
 
@@ -1042,7 +1025,7 @@
 	      /* Prepare for the next psymtab. */
 	      global_syms = objfile->global_psymbols.next;
 	      static_syms = objfile->static_psymbols.next;
-	      free (class_entered);
+	      xfree (class_entered);
 
 	      curr_fd++;
 	    }			/* Psymtab for file */
@@ -1271,7 +1254,7 @@
 	      /* Prepare for the next psymtab. */
 	      global_syms = objfile->global_psymbols.next;
 	      static_syms = objfile->static_psymbols.next;
-	      free (class_entered);
+	      xfree (class_entered);
 
 	      curr_md++;
 	      curr_fd++;
@@ -1348,9 +1331,7 @@
 /* Get appropriate header, based on pxdb type. 
    Return value: 1 if ok, 0 if not */
 int
-hpread_get_header (objfile, pxdb_header_p)
-     struct objfile *objfile;
-     PXDB_header_ptr pxdb_header_p;
+hpread_get_header (struct objfile *objfile, PXDB_header_ptr pxdb_header_p)
 {
   asection *pinfo_section, *debug_section, *header_section;
 
@@ -1468,8 +1449,7 @@
    FIXME, there should be a cleaner peephole into the BFD environment
    here. */
 void
-hpread_symfile_init (objfile)
-     struct objfile *objfile;
+hpread_symfile_init (struct objfile *objfile)
 {
   asection *vt_section, *slt_section, *lntt_section, *gntt_section;
 
@@ -1566,9 +1546,7 @@
    opposed to a shared lib or dynamically loaded file). */
 
 void
-hpread_build_psymtabs (objfile, mainline)
-     struct objfile *objfile;
-     int mainline;
+hpread_build_psymtabs (struct objfile *objfile, int mainline)
 {
 
 #ifdef DUMPING
@@ -2091,8 +2069,7 @@
    objfile struct from the global list of known objfiles. */
 
 void
-hpread_symfile_finish (objfile)
-     struct objfile *objfile;
+hpread_symfile_finish (struct objfile *objfile)
 {
   if (objfile->sym_private != NULL)
     {
@@ -2106,42 +2083,33 @@
 /* Various small functions to get entries in the debug symbol sections.  */
 
 union dnttentry *
-hpread_get_lntt (index, objfile)
-     int index;
-     struct objfile *objfile;
+hpread_get_lntt (int index, struct objfile *objfile)
 {
   return (union dnttentry *)
     &(LNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
 }
 
 static union dnttentry *
-hpread_get_gntt (index, objfile)
-     int index;
-     struct objfile *objfile;
+hpread_get_gntt (int index, struct objfile *objfile)
 {
   return (union dnttentry *)
     &(GNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
 }
 
 union sltentry *
-hpread_get_slt (index, objfile)
-     int index;
-     struct objfile *objfile;
+hpread_get_slt (int index, struct objfile *objfile)
 {
   return (union sltentry *) &(SLT (objfile)[index * sizeof (union sltentry)]);
 }
 
 /* Get the low address associated with some symbol (typically the start
    of a particular source file or module).  Since that information is not
-   stored as part of the DNTT_TYPE_MODULE or DNTT_TYPE_SRCFILE symbol we must infer it from
-   the existance of DNTT_TYPE_FUNCTION symbols.  */
+   stored as part of the DNTT_TYPE_MODULE or DNTT_TYPE_SRCFILE symbol we
+   must infer it from the existence of DNTT_TYPE_FUNCTION symbols.  */
 
 static unsigned long
-hpread_get_textlow (global, index, objfile, symcount)
-     int global;
-     int index;
-     struct objfile *objfile;
-     int symcount;
+hpread_get_textlow (int global, int index, struct objfile *objfile,
+		    int symcount)
 {
   union dnttentry *dn_bufp;
   struct minimal_symbol *msymbol;
@@ -2193,14 +2161,10 @@
    (normal). */
 
 static struct partial_symtab *
-hpread_start_psymtab (objfile,
-		      filename, textlow, ldsymoff, global_syms, static_syms)
-     struct objfile *objfile;
-     char *filename;
-     CORE_ADDR textlow;
-     int ldsymoff;
-     struct partial_symbol **global_syms;
-     struct partial_symbol **static_syms;
+hpread_start_psymtab (struct objfile *objfile, char *filename,
+		      CORE_ADDR textlow, int ldsymoff,
+		      struct partial_symbol **global_syms,
+		      struct partial_symbol **static_syms)
 {
   int offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
   extern void hpread_psymtab_to_symtab ();
@@ -2228,15 +2192,11 @@
    FIXME:  List variables and peculiarities of same.  */
 
 static struct partial_symtab *
-hpread_end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
-		    capping_text, dependency_list, number_dependencies)
-     struct partial_symtab *pst;
-     char **include_list;
-     int num_includes;
-     int capping_symbol_offset;
-     CORE_ADDR capping_text;
-     struct partial_symtab **dependency_list;
-     int number_dependencies;
+hpread_end_psymtab (struct partial_symtab *pst, char **include_list,
+		    int num_includes, int capping_symbol_offset,
+		    CORE_ADDR capping_text,
+		    struct partial_symtab **dependency_list,
+		    int number_dependencies)
 {
   int i;
   struct objfile *objfile = pst->objfile;
diff --git a/gdb/hp-symtab-read.c b/gdb/hp-symtab-read.c
index e4c10f5..f45054f 100644
--- a/gdb/hp-symtab-read.c
+++ b/gdb/hp-symtab-read.c
@@ -169,9 +169,7 @@
 /* Get the nesting depth for the source line identified by INDEX.  */
 
 static unsigned long
-hpread_get_scope_start (index, objfile)
-     sltpointer index;
-     struct objfile *objfile;
+hpread_get_scope_start (sltpointer index, struct objfile *objfile)
 {
   union sltentry *sl_bufp;
 
@@ -182,9 +180,7 @@
 /* Get the source line number the the line identified by INDEX.  */
 
 static unsigned long
-hpread_get_line (index, objfile)
-     sltpointer index;
-     struct objfile *objfile;
+hpread_get_line (sltpointer index, struct objfile *objfile)
 {
   union sltentry *sl_bufp;
 
@@ -195,9 +191,7 @@
 /* Find the code address associated with a given sltpointer */
 
 static CORE_ADDR
-hpread_get_location (index, objfile)
-     sltpointer index;
-     struct objfile *objfile;
+hpread_get_location (sltpointer index, struct objfile *objfile)
 {
   union sltentry *sl_bufp;
   int i;
@@ -236,8 +230,7 @@
  */
 
 int
-hpread_has_name (kind)
-     enum dntt_entry_type kind;
+hpread_has_name (enum dntt_entry_type kind)
 {
   switch (kind)
     {
@@ -311,8 +304,7 @@
    table.  */
 
 static void
-hpread_psymtab_to_symtab_1 (pst)
-     struct partial_symtab *pst;
+hpread_psymtab_to_symtab_1 (struct partial_symtab *pst)
 {
   struct cleanup *old_chain;
   int i;
@@ -370,8 +362,7 @@
    Be verbose about it if the user wants that.  */
 
 void
-hpread_psymtab_to_symtab (pst)
-     struct partial_symtab *pst;
+hpread_psymtab_to_symtab (struct partial_symtab *pst)
 {
   /* Get out quick if given junk.  */
   if (!pst)
@@ -427,15 +418,9 @@
    SECTION_OFFSETS are the relocation offsets which get added to each symbol. */
 
 static struct symtab *
-hpread_expand_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
-		      section_offsets, filename)
-     struct objfile *objfile;
-     int sym_offset;
-     int sym_size;
-     CORE_ADDR text_offset;
-     int text_size;
-     struct section_offsets *section_offsets;
-     char *filename;
+hpread_expand_symtab (struct objfile *objfile, int sym_offset, int sym_size,
+		      CORE_ADDR text_offset, int text_size,
+		      struct section_offsets *section_offsets, char *filename)
 {
   char *namestring;
   union dnttentry *dn_bufp;
@@ -531,7 +516,7 @@
   current_objfile = NULL;
   hp_som_som_object_present = 1;	/* Indicate we've processed an HP SOM SOM file */
 
-  return end_symtab (text_offset + text_size, objfile, 0);
+  return end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile));
 }
 
 
@@ -540,8 +525,7 @@
 /* Convert basic types from HP debug format into GDB internal format.  */
 
 static int
-hpread_type_translate (typep)
-     dnttpointer typep;
+hpread_type_translate (dnttpointer typep)
 {
   if (!typep.dntti.immediate)
     {
@@ -632,9 +616,7 @@
  */
 
 static struct type **
-hpread_lookup_type (hp_type, objfile)
-     dnttpointer hp_type;
-     struct objfile *objfile;
+hpread_lookup_type (dnttpointer hp_type, struct objfile *objfile)
 {
   unsigned old_len;
   int index = hp_type.dnttp.index;
@@ -720,9 +702,7 @@
    have it lying around.  */
 
 static struct type *
-hpread_alloc_type (hp_type, objfile)
-     dnttpointer hp_type;
-     struct objfile *objfile;
+hpread_alloc_type (dnttpointer hp_type, struct objfile *objfile)
 {
   struct type **type_addr;
 
@@ -744,10 +724,8 @@
 /* Read a native enumerated type and return it in GDB internal form.  */
 
 static struct type *
-hpread_read_enum_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_enum_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+		       struct objfile *objfile)
 {
   struct type *type;
   struct pending **symlist, *osyms, *syms;
@@ -839,11 +817,8 @@
 /* Read and internalize a native function debug symbol.  */
 
 static struct type *
-hpread_read_function_type (hp_type, dn_bufp, objfile, newblock)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
-     int newblock;
+hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+			   struct objfile *objfile, int newblock)
 {
   struct type *type, *type1;
   struct pending *syms;
@@ -1025,11 +1000,8 @@
  * volatile, please leave it this way.
  */
 static struct type *
-hpread_read_doc_function_type (hp_type, dn_bufp, objfile, newblock)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
-     int newblock;
+hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+			       struct objfile *objfile, int newblock)
 {
   struct type *type, *type1;
   struct pending *syms;
@@ -1218,10 +1190,8 @@
  */
 
 static struct type *
-hpread_read_struct_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+			 struct objfile *objfile)
 {
   /* The data members get linked together into a list of struct nextfield's */
   struct nextfield
@@ -2059,10 +2029,8 @@
    Void return */
 
 static void
-fix_static_member_physnames (type, class_name, objfile)
-     struct type *type;
-     char *class_name;
-     struct objfile *objfile;
+fix_static_member_physnames (struct type *type, char *class_name,
+			     struct objfile *objfile)
 {
   int i;
 
@@ -2092,10 +2060,8 @@
  * Void return. */
 
 static void
-fixup_class_method_type (class, method, objfile)
-     struct type *class;
-     struct type *method;
-     struct objfile *objfile;
+fixup_class_method_type (struct type *class, struct type *method,
+			 struct objfile *objfile)
 {
   int i, j, k;
 
@@ -2156,9 +2122,7 @@
  * This is called from hpread_type_lookup().
  */
 static struct type *
-hpread_get_nth_template_arg (objfile, n)
-     struct objfile *objfile;
-     int n;
+hpread_get_nth_template_arg (struct objfile *objfile, int n)
 {
   if (current_template != NULL)
     return TYPE_TEMPLATE_ARG (current_template, n).type;
@@ -2169,11 +2133,8 @@
 /* Read in and internalize a TEMPL_ARG (template arg) symbol.  */
 
 static struct type *
-hpread_read_templ_arg_type (hp_type, dn_bufp, objfile, name)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
-     char *name;
+hpread_read_templ_arg_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+			    struct objfile *objfile, char *name)
 {
   struct type *type;
 
@@ -2193,10 +2154,8 @@
 /* Read in and internalize a set debug symbol.  */
 
 static struct type *
-hpread_read_set_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_set_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+		      struct objfile *objfile)
 {
   struct type *type;
 
@@ -2217,10 +2176,8 @@
 /* Read in and internalize an array debug symbol.  */
 
 static struct type *
-hpread_read_array_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_array_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+			struct objfile *objfile)
 {
   struct type *type;
 
@@ -2277,10 +2234,8 @@
 
 /* Read in and internalize a subrange debug symbol.  */
 static struct type *
-hpread_read_subrange_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_subrange_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+			   struct objfile *objfile)
 {
   struct type *type;
 
@@ -2340,9 +2295,7 @@
  *     a struct/class type, etc).
  */
 static struct type *
-hpread_type_lookup (hp_type, objfile)
-     dnttpointer hp_type;
-     struct objfile *objfile;
+hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile)
 {
   union dnttentry *dn_bufp;
   struct type *tmp_type;
@@ -2701,11 +2654,9 @@
 }
 
 static sltpointer
-hpread_record_lines (subfile, s_idx, e_idx, objfile, offset)
-     struct subfile *subfile;
-     sltpointer s_idx, e_idx;
-     struct objfile *objfile;
-     CORE_ADDR offset;
+hpread_record_lines (struct subfile *subfile, sltpointer s_idx,
+		     sltpointer e_idx, struct objfile *objfile,
+		     CORE_ADDR offset)
 {
   union sltentry *sl_bufp;
 
@@ -2733,8 +2684,7 @@
  * If "f" is not a member function, return NULL.
  */
 char *
-class_of (functype)
-     struct type *functype;
+class_of (struct type *functype)
 {
   struct type *first_param_type;
   char *first_param_name;
@@ -2794,19 +2744,11 @@
  */
 
 static void
-hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
-				 text_offset, text_size, filename,
-				 index, at_module_boundary_p
-)
-     union dnttentry *dn_bufp;
-     char *name;
-     struct section_offsets *section_offsets;
-     struct objfile *objfile;
-     CORE_ADDR text_offset;
-     int text_size;
-     char *filename;
-     int index;
-     int *at_module_boundary_p;
+hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
+				 struct section_offsets *section_offsets,
+				 struct objfile *objfile, CORE_ADDR text_offset,
+				 int text_size, char *filename, int index,
+				 int *at_module_boundary_p)
 {
   unsigned long desc;
   int type;
@@ -3916,10 +3858,8 @@
 
 
 static int
-hpread_get_scope_depth (dn_bufp, objfile, report_nested)
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
-     int report_nested;
+hpread_get_scope_depth (union dnttentry *dn_bufp, struct objfile *objfile,
+			int report_nested)
 {
   register int index;
   register union dnttentry *dn_tmp;
@@ -3964,9 +3904,7 @@
    enclosing structure instead of relative to the union itself. */
 
 static void
-hpread_adjust_bitoffsets (type, bits)
-     struct type *type;
-     int bits;
+hpread_adjust_bitoffsets (struct type *type, int bits)
 {
   register int i;
 
@@ -4000,11 +3938,9 @@
    is a dnttpointer for the new field after all the skipped ones */
 
 static dnttpointer
-hpread_get_next_skip_over_anon_unions (skip_fields, field, fieldp, objfile)
-     int skip_fields;
-     dnttpointer field;
-     union dnttentry **fieldp;
-     struct objfile *objfile;
+hpread_get_next_skip_over_anon_unions (int skip_fields, dnttpointer field,
+				       union dnttentry **fieldp,
+				       struct objfile *objfile)
 {
   struct type *anon_type;
   register int i;
diff --git a/gdb/hp300ux-nat.c b/gdb/hp300ux-nat.c
index 6a01e33..ca0a802 100644
--- a/gdb/hp300ux-nat.c
+++ b/gdb/hp300ux-nat.c
@@ -60,7 +60,7 @@
 
 /* read the value of the u area from the hp-ux kernel */
 void
-_initialize_hp300ux_nat ()
+_initialize_hp300ux_nat (void)
 {
 #ifndef HPUX_VERSION_5
   nlist ("/hp-ux", nl);
@@ -77,9 +77,7 @@
    - kernel_u_addr)
 
 static void
-fetch_inferior_register (regno, regaddr)
-     register int regno;
-     register unsigned int regaddr;
+fetch_inferior_register (register int regno, register unsigned int regaddr)
 {
 #ifndef HPUX_VERSION_5
   if (regno == PS_REGNUM)
@@ -115,10 +113,7 @@
 }
 
 static void
-store_inferior_register_1 (regno, regaddr, val)
-     int regno;
-     unsigned int regaddr;
-     int val;
+store_inferior_register_1 (int regno, unsigned int regaddr, int val)
 {
   errno = 0;
   ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, val, 0);
@@ -137,9 +132,7 @@
 }
 
 static void
-store_inferior_register (regno, regaddr)
-     register int regno;
-     register unsigned int regaddr;
+store_inferior_register (register int regno, register unsigned int regaddr)
 {
 #ifndef HPUX_VERSION_5
   if (regno == PS_REGNUM)
@@ -173,8 +166,7 @@
 }
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   struct user u;
   register unsigned int ar0_offset;
@@ -199,8 +191,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     register int regno;
+store_inferior_registers (register int regno)
 {
   struct user u;
   register unsigned int ar0_offset;
@@ -226,7 +217,7 @@
 }
 
 int
-getpagesize ()
+getpagesize (void)
 {
   return 4096;
 }
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 20ad6c0..551fd8e 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -150,9 +150,7 @@
 
 /* Should call_function allocate stack space for a struct return?  */
 int
-hppa_use_struct_convention (gcc_p, type)
-     int gcc_p;
-     struct type *type;
+hppa_use_struct_convention (int gcc_p, struct type *type)
 {
   return (TYPE_LENGTH (type) > 2 * REGISTER_SIZE);
 }
@@ -165,8 +163,7 @@
    value. */
 
 static int
-sign_extend (val, bits)
-     unsigned val, bits;
+sign_extend (unsigned val, unsigned bits)
 {
   return (int) (val >> (bits - 1) ? (-1 << bits) | val : val);
 }
@@ -174,8 +171,7 @@
 /* For many immediate values the sign bit is the low bit! */
 
 static int
-low_sign_extend (val, bits)
-     unsigned val, bits;
+low_sign_extend (unsigned val, unsigned bits)
 {
   return (int) ((val & 0x1 ? (-1 << (bits - 1)) : 0) | val >> 1);
 }
@@ -183,8 +179,7 @@
 /* extract the immediate field from a ld{bhw}s instruction */
 
 static int
-extract_5_load (word)
-     unsigned word;
+extract_5_load (unsigned word)
 {
   return low_sign_extend (word >> 16 & MASK_5, 5);
 }
@@ -192,8 +187,7 @@
 /* extract the immediate field from a break instruction */
 
 static unsigned
-extract_5r_store (word)
-     unsigned word;
+extract_5r_store (unsigned word)
 {
   return (word & MASK_5);
 }
@@ -201,8 +195,7 @@
 /* extract the immediate field from a {sr}sm instruction */
 
 static unsigned
-extract_5R_store (word)
-     unsigned word;
+extract_5R_store (unsigned word)
 {
   return (word >> 16 & MASK_5);
 }
@@ -210,8 +203,7 @@
 /* extract a 14 bit immediate field */
 
 static int
-extract_14 (word)
-     unsigned word;
+extract_14 (unsigned word)
 {
   return low_sign_extend (word & MASK_14, 14);
 }
@@ -219,9 +211,7 @@
 /* deposit a 14 bit constant in a word */
 
 static unsigned
-deposit_14 (opnd, word)
-     int opnd;
-     unsigned word;
+deposit_14 (int opnd, unsigned word)
 {
   unsigned sign = (opnd < 0 ? 1 : 0);
 
@@ -231,8 +221,7 @@
 /* extract a 21 bit constant */
 
 static int
-extract_21 (word)
-     unsigned word;
+extract_21 (unsigned word)
 {
   int val;
 
@@ -255,8 +244,7 @@
    the low 21 bits of opnd are relevant */
 
 static unsigned
-deposit_21 (opnd, word)
-     unsigned opnd, word;
+deposit_21 (unsigned opnd, unsigned word)
 {
   unsigned val = 0;
 
@@ -276,8 +264,7 @@
    19 bit signed value. */
 
 static int
-extract_17 (word)
-     unsigned word;
+extract_17 (unsigned word)
 {
   return sign_extend (GET_FIELD (word, 19, 28) |
 		      GET_FIELD (word, 29, 29) << 10 |
@@ -291,9 +278,7 @@
    larger than the first, and zero if they are equal.  */
 
 static int
-compare_unwind_entries (arg1, arg2)
-     const void *arg1;
-     const void *arg2;
+compare_unwind_entries (const void *arg1, const void *arg2)
 {
   const struct unwind_table_entry *a = arg1;
   const struct unwind_table_entry *b = arg2;
@@ -309,10 +294,7 @@
 static CORE_ADDR low_text_segment_address;
 
 static void
-record_text_segment_lowaddr (abfd, section, ignored)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     asection *section;
-     PTR ignored ATTRIBUTE_UNUSED;
+record_text_segment_lowaddr (bfd *abfd, asection *section, void *ignored)
 {
   if ((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
        == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
@@ -321,12 +303,9 @@
 }
 
 static void
-internalize_unwinds (objfile, table, section, entries, size, text_offset)
-     struct objfile *objfile;
-     struct unwind_table_entry *table;
-     asection *section;
-     unsigned int entries, size;
-     CORE_ADDR text_offset;
+internalize_unwinds (struct objfile *objfile, struct unwind_table_entry *table,
+		     asection *section, unsigned int entries, unsigned int size,
+		     CORE_ADDR text_offset)
 {
   /* We will read the unwind entries into temporary memory, then
      fill in the actual unwind table.  */
@@ -418,8 +397,7 @@
    gets freed when the objfile is destroyed.  */
 
 static void
-read_unwind_info (objfile)
-     struct objfile *objfile;
+read_unwind_info (struct objfile *objfile)
 {
   asection *unwind_sec, *stub_unwind_sec;
   unsigned unwind_size, stub_unwind_size, total_size;
@@ -561,8 +539,7 @@
    search of the unwind tables, we depend upon them to be sorted.  */
 
 struct unwind_table_entry *
-find_unwind_entry (pc)
-     CORE_ADDR pc;
+find_unwind_entry (CORE_ADDR pc)
 {
   int first, middle, last;
   struct objfile *objfile;
@@ -624,8 +601,7 @@
    bizarre way in which someone (?) decided they wanted to handle
    frame pointerless code in GDB.  */
 int
-hpread_adjust_stack_address (func_addr)
-     CORE_ADDR func_addr;
+hpread_adjust_stack_address (CORE_ADDR func_addr)
 {
   struct unwind_table_entry *u;
 
@@ -640,8 +616,7 @@
    kind.  */
 
 static int
-pc_in_interrupt_handler (pc)
-     CORE_ADDR pc;
+pc_in_interrupt_handler (CORE_ADDR pc)
 {
   struct unwind_table_entry *u;
   struct minimal_symbol *msym_us;
@@ -663,8 +638,7 @@
    ?!? Need to handle stubs which appear in PA64 code.  */
 
 static int
-pc_in_linker_stub (pc)
-     CORE_ADDR pc;
+pc_in_linker_stub (CORE_ADDR pc)
 {
   int found_magic_instruction = 0;
   int i;
@@ -729,8 +703,7 @@
 }
 
 static int
-find_return_regnum (pc)
-     CORE_ADDR pc;
+find_return_regnum (CORE_ADDR pc)
 {
   struct unwind_table_entry *u;
 
@@ -747,8 +720,7 @@
 
 /* Return size of frame, or -1 if we should use a frame pointer.  */
 static int
-find_proc_framesize (pc)
-     CORE_ADDR pc;
+find_proc_framesize (CORE_ADDR pc)
 {
   struct unwind_table_entry *u;
   struct minimal_symbol *msym_us;
@@ -783,8 +755,7 @@
 static int rp_saved (CORE_ADDR);
 
 static int
-rp_saved (pc)
-     CORE_ADDR pc;
+rp_saved (CORE_ADDR pc)
 {
   struct unwind_table_entry *u;
 
@@ -823,8 +794,7 @@
 }
 
 int
-frameless_function_invocation (frame)
-     struct frame_info *frame;
+frameless_function_invocation (struct frame_info *frame)
 {
   struct unwind_table_entry *u;
 
@@ -837,8 +807,7 @@
 }
 
 CORE_ADDR
-saved_pc_after_call (frame)
-     struct frame_info *frame;
+saved_pc_after_call (struct frame_info *frame)
 {
   int ret_regnum;
   CORE_ADDR pc;
@@ -857,8 +826,7 @@
 }
 
 CORE_ADDR
-hppa_frame_saved_pc (frame)
-     struct frame_info *frame;
+hppa_frame_saved_pc (struct frame_info *frame)
 {
   CORE_ADDR pc = get_frame_pc (frame);
   struct unwind_table_entry *u;
@@ -1037,9 +1005,7 @@
    in a system call.  */
 
 void
-init_extra_frame_info (fromleaf, frame)
-     int fromleaf;
-     struct frame_info *frame;
+init_extra_frame_info (int fromleaf, struct frame_info *frame)
 {
   int flags;
   int framesize;
@@ -1096,8 +1062,7 @@
    a frame pointer calls code without a frame pointer.  */
 
 CORE_ADDR
-frame_chain (frame)
-     struct frame_info *frame;
+frame_chain (struct frame_info *frame)
 {
   int my_framesize, caller_framesize;
   struct unwind_table_entry *u;
@@ -1353,9 +1318,7 @@
    was compiled with gcc. */
 
 int
-hppa_frame_chain_valid (chain, thisframe)
-     CORE_ADDR chain;
-     struct frame_info *thisframe;
+hppa_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
 {
   struct minimal_symbol *msym_us;
   struct minimal_symbol *msym_start;
@@ -1416,8 +1379,7 @@
    to be aligned to a 64-byte boundary. */
 
 void
-push_dummy_frame (inf_status)
-     struct inferior_status *inf_status;
+push_dummy_frame (struct inferior_status *inf_status)
 {
   CORE_ADDR sp, pc, pcspace;
   register int regnum;
@@ -1494,9 +1456,8 @@
 }
 
 static void
-find_dummy_frame_regs (frame, frame_saved_regs)
-     struct frame_info *frame;
-     struct frame_saved_regs *frame_saved_regs;
+find_dummy_frame_regs (struct frame_info *frame,
+		       struct frame_saved_regs *frame_saved_regs)
 {
   CORE_ADDR fp = frame->frame;
   int i;
@@ -1536,7 +1497,7 @@
 }
 
 void
-hppa_pop_frame ()
+hppa_pop_frame (void)
 {
   register struct frame_info *frame = get_current_frame ();
   register CORE_ADDR fp, npc, target_pc;
@@ -1634,8 +1595,7 @@
    queue space registers. */
 
 static int
-restore_pc_queue (fsr)
-     struct frame_saved_regs *fsr;
+restore_pc_queue (struct frame_saved_regs *fsr)
 {
   CORE_ADDR pc = read_pc ();
   CORE_ADDR new_pc = read_memory_integer (fsr->regs[PCOQ_HEAD_REGNUM],
@@ -1705,12 +1665,8 @@
    to the callee, so we do that too.  */
    
 CORE_ADDR
-hppa_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     int struct_return;
-     CORE_ADDR struct_addr;
+hppa_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+		     int struct_return, CORE_ADDR struct_addr)
 {
   /* array of arguments' offsets */
   int *offset = (int *) alloca (nargs * sizeof (int));
@@ -1828,12 +1784,8 @@
    arguments into registers as needed by the ABI. */
    
 CORE_ADDR
-hppa_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     int struct_return;
-     CORE_ADDR struct_addr;
+hppa_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+		     int struct_return, CORE_ADDR struct_addr)
 {
   /* array of arguments' offsets */
   int *offset = (int *) alloca (nargs * sizeof (int));
@@ -1922,9 +1874,7 @@
    gets the value from the stack rather than from the buffer where all the
    registers were saved when the function called completed. */
 value_ptr
-hppa_value_returned_from_stack (valtype, addr)
-     register struct type *valtype;
-     CORE_ADDR addr;
+hppa_value_returned_from_stack (register struct type *valtype, CORE_ADDR addr)
 {
   register value_ptr val;
 
@@ -1957,9 +1907,7 @@
    man entry for shl_findsym */
 
 CORE_ADDR
-find_stub_with_shl_get (function, handle)
-     struct minimal_symbol *function;
-     CORE_ADDR handle;
+find_stub_with_shl_get (struct minimal_symbol *function, CORE_ADDR handle)
 {
   struct symbol *get_sym, *symbol2;
   struct minimal_symbol *buff_minsym, *msymbol;
@@ -2058,14 +2006,8 @@
    Please contact Jeff Law (law@cygnus.com) before changing this code.  */
 
 CORE_ADDR
-hppa_fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p)
-     char *dummy;
-     CORE_ADDR pc;
-     CORE_ADDR fun;
-     int nargs;
-     value_ptr *args;
-     struct type *type;
-     int gcc_p;
+hppa_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
+		     value_ptr *args, struct type *type, int gcc_p)
 {
   CORE_ADDR dyncall_addr;
   struct minimal_symbol *msymbol;
@@ -2441,8 +2383,7 @@
    We'll return zero in that case, rather than attempting to read it
    and cause a warning. */
 CORE_ADDR
-target_read_fp (pid)
-     int pid;
+target_read_fp (int pid)
 {
   int flags = read_register (FLAGS_REGNUM);
 
@@ -2461,8 +2402,7 @@
    bits.  */
 
 CORE_ADDR
-target_read_pc (pid)
-     int pid;
+target_read_pc (int pid)
 {
   int flags = read_register_pid (FLAGS_REGNUM, pid);
 
@@ -2479,9 +2419,7 @@
    PC value into %r31.  */
 
 void
-target_write_pc (v, pid)
-     CORE_ADDR v;
-     int pid;
+target_write_pc (CORE_ADDR v, int pid)
 {
   int flags = read_register_pid (FLAGS_REGNUM, pid);
 
@@ -2501,8 +2439,7 @@
    alignment required by their fields. */
 
 static int
-hppa_alignof (type)
-     struct type *type;
+hppa_alignof (struct type *type)
 {
   int max_align, align, i;
   CHECK_TYPEDEF (type);
@@ -2536,9 +2473,7 @@
 /* Print the register regnum, or all registers if regnum is -1 */
 
 void
-pa_do_registers_info (regnum, fpregs)
-     int regnum;
-     int fpregs;
+pa_do_registers_info (int regnum, int fpregs)
 {
   char raw_regs[REGISTER_BYTES];
   int i;
@@ -2581,11 +2516,8 @@
 
 /********** new function ********************/
 void
-pa_do_strcat_registers_info (regnum, fpregs, stream, precision)
-     int regnum;
-     int fpregs;
-     struct ui_file *stream;
-     enum precision_type precision;
+pa_do_strcat_registers_info (int regnum, int fpregs, struct ui_file *stream,
+			     enum precision_type precision)
 {
   char raw_regs[REGISTER_BYTES];
   int i;
@@ -2634,10 +2566,7 @@
    Note that reg_val is really expected to be an array of longs,
    with two elements. */
 static void
-pa_register_look_aside (raw_regs, regnum, raw_val)
-     char *raw_regs;
-     int regnum;
-     long *raw_val;
+pa_register_look_aside (char *raw_regs, int regnum, long *raw_val)
 {
   static int know_which = 0;	/* False */
 
@@ -2740,10 +2669,7 @@
 /* "Info all-reg" command */
 
 static void
-pa_print_registers (raw_regs, regnum, fpregs)
-     char *raw_regs;
-     int regnum;
-     int fpregs;
+pa_print_registers (char *raw_regs, int regnum, int fpregs)
 {
   int i, j;
   /* Alas, we are compiled so that "long long" is 32 bits */
@@ -2795,11 +2721,8 @@
 
 /************* new function ******************/
 static void
-pa_strcat_registers (raw_regs, regnum, fpregs, stream)
-     char *raw_regs;
-     int regnum;
-     int fpregs;
-     struct ui_file *stream;
+pa_strcat_registers (char *raw_regs, int regnum, int fpregs,
+		     struct ui_file *stream)
 {
   int i, j;
   long raw_val[2];		/* Alas, we are compiled so that "long long" is 32 bits */
@@ -2846,8 +2769,7 @@
 }
 
 static void
-pa_print_fp_reg (i)
-     int i;
+pa_print_fp_reg (int i)
 {
   char raw_buffer[MAX_REGISTER_RAW_SIZE];
   char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
@@ -2890,10 +2812,7 @@
 
 /*************** new function ***********************/
 static void
-pa_strcat_fp_reg (i, stream, precision)
-     int i;
-     struct ui_file *stream;
-     enum precision_type precision;
+pa_strcat_fp_reg (int i, struct ui_file *stream, enum precision_type precision)
 {
   char raw_buffer[MAX_REGISTER_RAW_SIZE];
   char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
@@ -2936,9 +2855,7 @@
    just shared library trampolines (import, export).  */
 
 int
-in_solib_call_trampoline (pc, name)
-     CORE_ADDR pc;
-     char *name;
+in_solib_call_trampoline (CORE_ADDR pc, char *name)
 {
   struct minimal_symbol *minsym;
   struct unwind_table_entry *u;
@@ -2980,7 +2897,7 @@
        instructions long. */
     insn = read_memory_integer (pc, 4);
 
-    /* Find out where we we think we are within the stub.  */
+    /* Find out where we think we are within the stub.  */
     if ((insn & 0xffffc00e) == 0x53610000)
       addr = pc;
     else if ((insn & 0xffffffff) == 0xe820d000)
@@ -3098,9 +3015,7 @@
    just shared library trampolines (import, export).  */
 
 int
-in_solib_return_trampoline (pc, name)
-     CORE_ADDR pc;
-     char *name;
+in_solib_return_trampoline (CORE_ADDR pc, char *name)
 {
   struct unwind_table_entry *u;
 
@@ -3173,9 +3088,7 @@
    used in dynamic executables.  */
 
 CORE_ADDR
-skip_trampoline_code (pc, name)
-     CORE_ADDR pc;
-     char *name;
+skip_trampoline_code (CORE_ADDR pc, char *name)
 {
   long orig_pc = pc;
   long prev_inst, curr_inst, loc;
@@ -3450,8 +3363,7 @@
    This only handles instructions commonly found in prologues.  */
 
 static int
-prologue_inst_adjust_sp (inst)
-     unsigned long inst;
+prologue_inst_adjust_sp (unsigned long inst)
 {
   /* This must persist across calls.  */
   static int save_high21;
@@ -3490,8 +3402,7 @@
 /* Return nonzero if INST is a branch of some kind, else return zero.  */
 
 static int
-is_branch (inst)
-     unsigned long inst;
+is_branch (unsigned long inst)
 {
   switch (inst >> 26)
     {
@@ -3524,8 +3435,7 @@
    zero it INST does not save a GR.  */
 
 static int
-inst_saves_gr (inst)
-     unsigned long inst;
+inst_saves_gr (unsigned long inst)
 {
   /* Does it look like a stw?  */
   if ((inst >> 26) == 0x1a || (inst >> 26) == 0x1b
@@ -3564,8 +3474,7 @@
    FIXME: What about argument stores with the HP compiler in ANSI mode? */
 
 static int
-inst_saves_fr (inst)
-     unsigned long inst;
+inst_saves_fr (unsigned long inst)
 {
   /* is this an FSTD ? */
   if ((inst & 0xfc00dfc0) == 0x2c001200)
@@ -3588,8 +3497,7 @@
 
 
 CORE_ADDR
-skip_prologue_hard_way (pc)
-     CORE_ADDR pc;
+skip_prologue_hard_way (CORE_ADDR pc)
 {
   char buf[4];
   CORE_ADDR orig_pc = pc;
@@ -3821,8 +3729,7 @@
    we can determine it from the debug symbols.  Else return zero.  */
 
 static CORE_ADDR
-after_prologue (pc)
-     CORE_ADDR pc;
+after_prologue (CORE_ADDR pc)
 {
   struct symtab_and_line sal;
   CORE_ADDR func_addr, func_end;
@@ -3863,8 +3770,7 @@
    stuff some day.  */
 
 CORE_ADDR
-hppa_skip_prologue (pc)
-     CORE_ADDR pc;
+hppa_skip_prologue (CORE_ADDR pc)
 {
   unsigned long inst;
   int offset;
@@ -3896,9 +3802,8 @@
    the address we return for it IS the sp for the next frame.  */
 
 void
-hppa_frame_find_saved_regs (frame_info, frame_saved_regs)
-     struct frame_info *frame_info;
-     struct frame_saved_regs *frame_saved_regs;
+hppa_frame_find_saved_regs (struct frame_info *frame_info,
+			    struct frame_saved_regs *frame_saved_regs)
 {
   CORE_ADDR pc;
   struct unwind_table_entry *u;
@@ -4185,7 +4090,7 @@
    0 => success
    1 => failure  */
 int
-setup_d_pid_in_inferior ()
+setup_d_pid_in_inferior (void)
 {
   CORE_ADDR anaddr;
   struct minimal_symbol *msymbol;
@@ -4219,7 +4124,7 @@
    1 => success          */
 
 static int
-initialize_hp_cxx_exception_support ()
+initialize_hp_cxx_exception_support (void)
 {
   struct symtabs_and_lines sals;
   struct cleanup *old_chain;
@@ -4440,9 +4345,7 @@
    address was found. */
 
 struct symtab_and_line *
-child_enable_exception_callback (kind, enable)
-     enum exception_event_kind kind;
-     int enable;
+child_enable_exception_callback (enum exception_event_kind kind, int enable)
 {
   char buf[4];
 
@@ -4532,7 +4435,7 @@
    and where it will be caught.  More information may be reported
    in the future */
 struct exception_event_record *
-child_get_current_exception_event ()
+child_get_current_exception_event (void)
 {
   CORE_ADDR event_kind;
   CORE_ADDR throw_addr;
@@ -4591,9 +4494,7 @@
 }
 
 static void
-unwind_command (exp, from_tty)
-     char *exp;
-     int from_tty;
+unwind_command (char *exp, int from_tty)
 {
   CORE_ADDR address;
   struct unwind_table_entry *u;
@@ -4698,7 +4599,7 @@
    here, that's what counts, as core gdb is the one which is
    putting the BPT instruction in and taking it out. */
 int
-hppa_prepare_to_proceed ()
+hppa_prepare_to_proceed (void)
 {
   pid_t old_thread;
   pid_t current_thread;
@@ -4743,7 +4644,7 @@
 #endif /* PREPARE_TO_PROCEED */
 
 void
-hppa_skip_permanent_breakpoint ()
+hppa_skip_permanent_breakpoint (void)
 {
   /* To step over a breakpoint instruction on the PA takes some
      fiddling with the instruction address queue.
@@ -4767,7 +4668,7 @@
 }
 
 void
-_initialize_hppa_tdep ()
+_initialize_hppa_tdep (void)
 {
   tm_print_insn = print_insn_hppa;
 
diff --git a/gdb/hppab-nat.c b/gdb/hppab-nat.c
index 29d22eb..17a4dc7 100644
--- a/gdb/hppab-nat.c
+++ b/gdb/hppab-nat.c
@@ -50,8 +50,7 @@
 /* Fetch one register.  */
 
 static void
-fetch_register (regno)
-     int regno;
+fetch_register (int regno)
 {
   register unsigned int regaddr;
   char buf[MAX_REGISTER_RAW_SIZE];
@@ -87,8 +86,7 @@
 /* Fetch all registers, or just one, from the child process.  */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   if (regno == -1)
     for (regno = 0; regno < NUM_REGS; regno++)
@@ -102,8 +100,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   register unsigned int regaddr;
   char buf[80];
@@ -185,13 +182,12 @@
 
    This call may fail if the given addresses are not valid in the inferior
    process.  This most often happens when restarting a program which
-   as watchpoints inserted on heap or stack memory.  */
+   has watchpoints inserted on heap or stack memory.  */
 
 #define PT_PROT 21
 
 int
-hppa_set_watchpoint (addr, len, flag)
-     int addr, len, flag;
+hppa_set_watchpoint (int addr, int len, int flag)
 {
   int pt_args[3];
   pt_args[0] = addr;
diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c
index 30e7ab9..549ea19 100644
--- a/gdb/hppah-nat.c
+++ b/gdb/hppah-nat.c
@@ -36,8 +36,7 @@
 static void fetch_register (int);
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   if (regno == -1)
     for (regno = 0; regno < NUM_REGS; regno++)
@@ -54,8 +53,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   register unsigned int regaddr;
   char buf[80];
@@ -178,8 +176,7 @@
 
 /* Fetch a register's value from the process's U area.  */
 static void
-fetch_register (regno)
-     int regno;
+fetch_register (int regno)
 {
   char buf[MAX_REGISTER_RAW_SIZE];
   unsigned int addr, len, offset;
@@ -265,15 +262,11 @@
    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.  */
+   anyway.  TARGET is ignored.  */
 
 int
-child_xfer_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* ignored */
+child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		   struct target_ops *target)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -347,7 +340,7 @@
 	      /* No, we still fail.  Okay, time to punt. */
 	      if ((pt_status == -1) && errno)
 		{
-		  free (buffer);
+		  xfree (buffer);
 		  return 0;
 		}
 	    }
@@ -363,7 +356,7 @@
 				   inferior_pid, (PTRACE_ARG3_TYPE) addr, 0);
 	  if (errno)
 	    {
-	      free (buffer);
+	      xfree (buffer);
 	      return 0;
 	    }
 	  QUIT;
@@ -372,13 +365,13 @@
       /* Copy appropriate bytes out of the buffer.  */
       memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
     }
-  free (buffer);
+  xfree (buffer);
   return len;
 }
 
 
 void
-child_post_follow_inferior_by_clone ()
+child_post_follow_inferior_by_clone (void)
 {
   int status;
 
@@ -396,11 +389,8 @@
 
 
 void
-child_post_follow_vfork (parent_pid, followed_parent, child_pid, followed_child)
-     int parent_pid;
-     int followed_parent;
-     int child_pid;
-     int followed_child;
+child_post_follow_vfork (int parent_pid, int followed_parent, int child_pid,
+			 int followed_child)
 {
   /* Are we a debugger that followed the parent of a vfork?  If so,
      then recall that the child's vfork event was delivered to us
@@ -438,8 +428,7 @@
 /* Format a process id, given PID.  Be sure to terminate
    this with a null--it's going to be printed via a "%s".  */
 char *
-child_pid_to_str (pid)
-     pid_t pid;
+child_pid_to_str (pid_t pid)
 {
   /* Static because address returned */
   static char buf[30];
@@ -456,8 +445,7 @@
    Note: This is a core-gdb tid, not the actual system tid.
    See infttrace.c for details.  */
 char *
-hppa_tid_to_str (tid)
-     pid_t tid;
+hppa_tid_to_str (pid_t tid)
 {
   /* Static because address returned */
   static char buf[30];
@@ -515,10 +503,7 @@
    child_acknowledge_created_inferior.)  */
 
 int
-parent_attach_all (pid, addr, data)
-     int pid;
-     PTRACE_ARG3_TYPE addr;
-     int data;
+parent_attach_all (int pid, PTRACE_ARG3_TYPE addr, int data)
 {
   int pt_status = 0;
 
@@ -555,8 +540,7 @@
 #endif
 
 int
-hppa_require_attach (pid)
-     int pid;
+hppa_require_attach (int pid)
 {
   int pt_status;
   CORE_ADDR pc;
@@ -589,9 +573,7 @@
 }
 
 int
-hppa_require_detach (pid, signal)
-     int pid;
-     int signal;
+hppa_require_detach (int pid, int signal)
 {
   errno = 0;
   call_ptrace (PT_DETACH, pid, (PTRACE_ARG3_TYPE) 1, signal);
@@ -604,58 +586,42 @@
    dummy versions, which perform no useful work.  */
 
 void
-hppa_enable_page_protection_events (pid)
-     int pid;
+hppa_enable_page_protection_events (int pid)
 {
 }
 
 void
-hppa_disable_page_protection_events (pid)
-     int pid;
+hppa_disable_page_protection_events (int pid)
 {
 }
 
 int
-hppa_insert_hw_watchpoint (pid, start, len, type)
-     int pid;
-     CORE_ADDR start;
-     LONGEST len;
-     int type;
+hppa_insert_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type)
 {
   error ("Hardware watchpoints not implemented on this platform.");
 }
 
 int
-hppa_remove_hw_watchpoint (pid, start, len, type)
-     int pid;
-     CORE_ADDR start;
-     LONGEST len;
-     enum bptype type;
+hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len,
+			   enum bptype type)
 {
   error ("Hardware watchpoints not implemented on this platform.");
 }
 
 int
-hppa_can_use_hw_watchpoint (type, cnt, ot)
-     enum bptype type;
-     int cnt;
-     enum bptype ot;
+hppa_can_use_hw_watchpoint (enum bptype type, int cnt, enum bptype ot)
 {
   return 0;
 }
 
 int
-hppa_range_profitable_for_hw_watchpoint (pid, start, len)
-     int pid;
-     CORE_ADDR start;
-     LONGEST len;
+hppa_range_profitable_for_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len)
 {
   error ("Hardware watchpoints not implemented on this platform.");
 }
 
 char *
-hppa_pid_or_tid_to_str (id)
-     pid_t id;
+hppa_pid_or_tid_to_str (pid_t id)
 {
   /* In the ptrace world, there are only processes. */
   return child_pid_to_str (id);
@@ -666,15 +632,13 @@
    hppa-tdep.c. */
 
 pid_t
-hppa_switched_threads (pid)
-     pid_t pid;
+hppa_switched_threads (pid_t pid)
 {
   return (pid_t) 0;
 }
 
 void
-hppa_ensure_vforking_parent_remains_stopped (pid)
-     int pid;
+hppa_ensure_vforking_parent_remains_stopped (int pid)
 {
   /* This assumes that the vforked parent is presently stopped, and
      that the vforked child has just delivered its first exec event.
@@ -686,14 +650,13 @@
 }
 
 int
-hppa_resume_execd_vforking_child_to_get_parent_vfork ()
+hppa_resume_execd_vforking_child_to_get_parent_vfork (void)
 {
   return 1;			/* Yes, the child must be resumed. */
 }
 
 void
-require_notification_of_events (pid)
-     int pid;
+require_notification_of_events (int pid)
 {
 #if defined(PT_SET_EVENT_MASK)
   int pt_status;
@@ -758,8 +721,7 @@
 }
 
 void
-require_notification_of_exec_events (pid)
-     int pid;
+require_notification_of_exec_events (int pid)
 {
 #if defined(PT_SET_EVENT_MASK)
   int pt_status;
@@ -800,8 +762,7 @@
    ID of the child process, after the debugger has forked.  */
 
 void
-child_acknowledge_created_inferior (pid)
-     int pid;
+child_acknowledge_created_inferior (int pid)
 {
   /* We need a memory home for a constant.  */
   int tc_magic_parent = PT_VERSION;
@@ -848,22 +809,19 @@
 }
 
 void
-child_post_startup_inferior (pid)
-     int pid;
+child_post_startup_inferior (int pid)
 {
   require_notification_of_events (pid);
 }
 
 void
-child_post_attach (pid)
-     int pid;
+child_post_attach (int pid)
 {
   require_notification_of_events (pid);
 }
 
 int
-child_insert_fork_catchpoint (pid)
-     int pid;
+child_insert_fork_catchpoint (int pid)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_SET_EVENT_MASK)
@@ -877,8 +835,7 @@
 }
 
 int
-child_remove_fork_catchpoint (pid)
-     int pid;
+child_remove_fork_catchpoint (int pid)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_SET_EVENT_MASK)
@@ -892,8 +849,7 @@
 }
 
 int
-child_insert_vfork_catchpoint (pid)
-     int pid;
+child_insert_vfork_catchpoint (int pid)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_SET_EVENT_MASK)
@@ -907,8 +863,7 @@
 }
 
 int
-child_remove_vfork_catchpoint (pid)
-     int pid;
+child_remove_vfork_catchpoint (int pid)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_SET_EVENT_MASK)
@@ -922,9 +877,7 @@
 }
 
 int
-child_has_forked (pid, childpid)
-     int pid;
-     int *childpid;
+child_has_forked (int pid, int *childpid)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_GET_PROCESS_STATE)
@@ -955,9 +908,7 @@
 }
 
 int
-child_has_vforked (pid, childpid)
-     int pid;
-     int *childpid;
+child_has_vforked (int pid, int *childpid)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_GET_PROCESS_STATE)
@@ -989,15 +940,14 @@
 }
 
 int
-child_can_follow_vfork_prior_to_exec ()
+child_can_follow_vfork_prior_to_exec (void)
 {
   /* ptrace doesn't allow this. */
   return 0;
 }
 
 int
-child_insert_exec_catchpoint (pid)
-     int pid;
+child_insert_exec_catchpoint (int pid)
 {
   /* This request is only available on HPUX 10.0 and later.   */
 #if !defined(PT_SET_EVENT_MASK)
@@ -1012,8 +962,7 @@
 }
 
 int
-child_remove_exec_catchpoint (pid)
-     int pid;
+child_remove_exec_catchpoint (int pid)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_SET_EVENT_MASK)
@@ -1028,9 +977,7 @@
 }
 
 int
-child_has_execd (pid, execd_pathname)
-     int pid;
-     char **execd_pathname;
+child_has_execd (int pid, char **execd_pathname)
 {
   /* This request is only available on HPUX 10.0 and later.  */
 #if !defined(PT_GET_PROCESS_STATE)
@@ -1063,16 +1010,13 @@
 }
 
 int
-child_reported_exec_events_per_exec_call ()
+child_reported_exec_events_per_exec_call (void)
 {
   return 2;			/* ptrace reports the event twice per call. */
 }
 
 int
-child_has_syscall_event (pid, kind, syscall_id)
-     int pid;
-     enum target_waitkind *kind;
-     int *syscall_id;
+child_has_syscall_event (int pid, enum target_waitkind *kind, int *syscall_id)
 {
   /* This request is only available on HPUX 10.30 and later, via
      the ttrace interface.  */
@@ -1083,8 +1027,7 @@
 }
 
 char *
-child_pid_to_exec_file (pid)
-     int pid;
+child_pid_to_exec_file (int pid)
 {
   static char exec_file_buffer[1024];
   int pt_status;
@@ -1150,7 +1093,7 @@
 }
 
 void
-pre_fork_inferior ()
+pre_fork_inferior (void)
 {
   int status;
 
@@ -1176,8 +1119,7 @@
    return "TRUE".  */
 
 int
-child_thread_alive (pid)
-     int pid;
+child_thread_alive (int pid)
 {
   return 1;
 }
diff --git a/gdb/hppam3-nat.c b/gdb/hppam3-nat.c
index aa89379..a3d4e5b 100644
--- a/gdb/hppam3-nat.c
+++ b/gdb/hppam3-nat.c
@@ -37,8 +37,7 @@
  */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   kern_return_t ret;
   thread_state_data_t state;
@@ -76,8 +75,7 @@
  * On mach3 all registers are always saved in one call.
  */
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   kern_return_t ret;
   thread_state_data_t state;
diff --git a/gdb/hpread.c b/gdb/hpread.c
index f49f01e..d87edd6 100644
--- a/gdb/hpread.c
+++ b/gdb/hpread.c
@@ -213,8 +213,7 @@
    FIXME, there should be a cleaner peephole into the BFD environment here.  */
 
 void
-hpread_symfile_init (objfile)
-     struct objfile *objfile;
+hpread_symfile_init (struct objfile *objfile)
 {
   asection *vt_section, *slt_section, *lntt_section, *gntt_section;
 
@@ -301,9 +300,7 @@
    table (as opposed to a shared lib or dynamically loaded file).  */
 
 void
-hpread_build_psymtabs (objfile, mainline)
-     struct objfile *objfile;
-     int mainline;
+hpread_build_psymtabs (struct objfile *objfile, int mainline)
 {
   char *namestring;
   int past_first_source_file = 0;
@@ -626,8 +623,7 @@
    objfile struct from the global list of known objfiles. */
 
 void
-hpread_symfile_finish (objfile)
-     struct objfile *objfile;
+hpread_symfile_finish (struct objfile *objfile)
 {
   if (objfile->sym_private != NULL)
     {
@@ -641,41 +637,32 @@
 /* Various small functions to get entries in the debug symbol sections.  */
 
 static union dnttentry *
-hpread_get_lntt (index, objfile)
-     int index;
-     struct objfile *objfile;
+hpread_get_lntt (int index, struct objfile *objfile)
 {
   return (union dnttentry *)
     &(LNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
 }
 
 static union dnttentry *
-hpread_get_gntt (index, objfile)
-     int index;
-     struct objfile *objfile;
+hpread_get_gntt (int index, struct objfile *objfile)
 {
   return (union dnttentry *)
     &(GNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
 }
 
 static union sltentry *
-hpread_get_slt (index, objfile)
-     int index;
-     struct objfile *objfile;
+hpread_get_slt (int index, struct objfile *objfile)
 {
   return (union sltentry *) &(SLT (objfile)[index * sizeof (union sltentry)]);
 }
 
 /* Get the low address associated with some symbol (typically the start
    of a particular source file or module).  Since that information is not
-   stored as part of the DNTT_TYPE_MODULE or DNTT_TYPE_SRCFILE symbol we must infer it from
-   the existance of DNTT_TYPE_FUNCTION symbols.  */
+   stored as part of the DNTT_TYPE_MODULE or DNTT_TYPE_SRCFILE symbol we
+   must infer it from the existence of DNTT_TYPE_FUNCTION symbols.  */
 
 static unsigned long
-hpread_get_textlow (global, index, objfile)
-     int global;
-     int index;
-     struct objfile *objfile;
+hpread_get_textlow (int global, int index, struct objfile *objfile)
 {
   union dnttentry *dn_bufp;
   struct minimal_symbol *msymbol;
@@ -708,9 +695,7 @@
 /* Get the nesting depth for the source line identified by INDEX.  */
 
 static unsigned long
-hpread_get_depth (index, objfile)
-     sltpointer index;
-     struct objfile *objfile;
+hpread_get_depth (sltpointer index, struct objfile *objfile)
 {
   union sltentry *sl_bufp;
 
@@ -721,9 +706,7 @@
 /* Get the source line number the the line identified by INDEX.  */
 
 static unsigned long
-hpread_get_line (index, objfile)
-     sltpointer index;
-     struct objfile *objfile;
+hpread_get_line (sltpointer index, struct objfile *objfile)
 {
   union sltentry *sl_bufp;
 
@@ -732,9 +715,7 @@
 }
 
 static CORE_ADDR
-hpread_get_location (index, objfile)
-     sltpointer index;
-     struct objfile *objfile;
+hpread_get_location (sltpointer index, struct objfile *objfile)
 {
   union sltentry *sl_bufp;
   int i;
@@ -763,8 +744,7 @@
    it, else return 0.  */
 
 static int
-hpread_has_name (kind)
-     enum dntt_entry_type kind;
+hpread_has_name (enum dntt_entry_type kind)
 {
   switch (kind)
     {
@@ -815,14 +795,10 @@
    (normal). */
 
 static struct partial_symtab *
-hpread_start_psymtab (objfile, filename, textlow, ldsymoff, global_syms,
-		      static_syms)
-     struct objfile *objfile;
-     char *filename;
-     CORE_ADDR textlow;
-     int ldsymoff;
-     struct partial_symbol **global_syms;
-     struct partial_symbol **static_syms;
+hpread_start_psymtab (struct objfile *objfile, char *filename,
+		      CORE_ADDR textlow, int ldsymoff,
+		      struct partial_symbol **global_syms,
+		      struct partial_symbol **static_syms)
 {
   struct partial_symtab *result =
   start_psymtab_common (objfile, section_offsets,
@@ -843,15 +819,11 @@
    FIXME:  List variables and peculiarities of same.  */
 
 static struct partial_symtab *
-hpread_end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
-		    capping_text, dependency_list, number_dependencies)
-     struct partial_symtab *pst;
-     char **include_list;
-     int num_includes;
-     int capping_symbol_offset;
-     CORE_ADDR capping_text;
-     struct partial_symtab **dependency_list;
-     int number_dependencies;
+hpread_end_psymtab (struct partial_symtab *pst, char **include_list,
+		    int num_includes, int capping_symbol_offset,
+		    CORE_ADDR capping_text,
+		    struct partial_symtab **dependency_list,
+		    int number_dependencies)
 {
   int i;
   struct objfile *objfile = pst->objfile;
@@ -941,8 +913,7 @@
    table.  */
 
 static void
-hpread_psymtab_to_symtab_1 (pst)
-     struct partial_symtab *pst;
+hpread_psymtab_to_symtab_1 (struct partial_symtab *pst)
 {
   struct cleanup *old_chain;
   int i;
@@ -1000,8 +971,7 @@
    Be verbose about it if the user wants that.  */
 
 static void
-hpread_psymtab_to_symtab (pst)
-     struct partial_symtab *pst;
+hpread_psymtab_to_symtab (struct partial_symtab *pst)
 {
   /* Get out quick if given junk.  */
   if (!pst)
@@ -1048,15 +1018,9 @@
    SECTION_OFFSETS are the relocation offsets which get added to each symbol. */
 
 static struct symtab *
-hpread_expand_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
-		      section_offsets, filename)
-     struct objfile *objfile;
-     int sym_offset;
-     int sym_size;
-     CORE_ADDR text_offset;
-     int text_size;
-     struct section_offsets *section_offsets;
-     char *filename;
+hpread_expand_symtab (struct objfile *objfile, int sym_offset, int sym_size,
+		      CORE_ADDR text_offset, int text_size,
+		      struct section_offsets *section_offsets, char *filename)
 {
   char *namestring;
   union dnttentry *dn_bufp;
@@ -1100,15 +1064,14 @@
 
   current_objfile = NULL;
 
-  return end_symtab (text_offset + text_size, objfile, 0);
+  return end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile));
 }
 
 
 /* Convert basic types from HP debug format into GDB internal format.  */
 
 static int
-hpread_type_translate (typep)
-     dnttpointer typep;
+hpread_type_translate (dnttpointer typep)
 {
   if (!typep.dntti.immediate)
     abort ();
@@ -1180,9 +1143,7 @@
 /* Return the type associated with the index found in HP_TYPE.  */
 
 static struct type **
-hpread_lookup_type (hp_type, objfile)
-     dnttpointer hp_type;
-     struct objfile *objfile;
+hpread_lookup_type (dnttpointer hp_type, struct objfile *objfile)
 {
   unsigned old_len;
   int index = hp_type.dnttp.index;
@@ -1223,9 +1184,7 @@
    have it lying around.  */
 
 static struct type *
-hpread_alloc_type (hp_type, objfile)
-     dnttpointer hp_type;
-     struct objfile *objfile;
+hpread_alloc_type (dnttpointer hp_type, struct objfile *objfile)
 {
   struct type **type_addr;
 
@@ -1241,10 +1200,8 @@
 /* Read a native enumerated type and return it in GDB internal form.  */
 
 static struct type *
-hpread_read_enum_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_enum_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+		       struct objfile *objfile)
 {
   struct type *type;
   struct pending **symlist, *osyms, *syms;
@@ -1320,10 +1277,8 @@
 /* Read and internalize a native function debug symbol.  */
 
 static struct type *
-hpread_read_function_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+			   struct objfile *objfile)
 {
   struct type *type, *type1;
   struct pending **symlist, *osyms, *syms;
@@ -1430,10 +1385,8 @@
 /* Read in and internalize a structure definition.  */
 
 static struct type *
-hpread_read_struct_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+			 struct objfile *objfile)
 {
   struct nextfield
     {
@@ -1510,10 +1463,8 @@
 /* Read in and internalize a set debug symbol.  */
 
 static struct type *
-hpread_read_set_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_set_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+		      struct objfile *objfile)
 {
   struct type *type;
 
@@ -1534,10 +1485,8 @@
 /* Read in and internalize an array debug symbol.  */
 
 static struct type *
-hpread_read_array_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_array_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+			struct objfile *objfile)
 {
   struct type *type;
   union dnttentry save;
@@ -1576,10 +1525,8 @@
 
 /* Read in and internalize a subrange debug symbol.  */
 static struct type *
-hpread_read_subrange_type (hp_type, dn_bufp, objfile)
-     dnttpointer hp_type;
-     union dnttentry *dn_bufp;
-     struct objfile *objfile;
+hpread_read_subrange_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+			   struct objfile *objfile)
 {
   struct type *type;
 
@@ -1611,9 +1558,7 @@
 }
 
 static struct type *
-hpread_type_lookup (hp_type, objfile)
-     dnttpointer hp_type;
-     struct objfile *objfile;
+hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile)
 {
   union dnttentry *dn_bufp;
 
@@ -1729,11 +1674,9 @@
 }
 
 static sltpointer
-hpread_record_lines (subfile, s_idx, e_idx, objfile, offset)
-     struct subfile *subfile;
-     sltpointer s_idx, e_idx;
-     struct objfile *objfile;
-     CORE_ADDR offset;
+hpread_record_lines (struct subfile *subfile, sltpointer s_idx,
+		     sltpointer e_idx, struct objfile *objfile,
+		     CORE_ADDR offset)
 {
   union sltentry *sl_bufp;
 
@@ -1753,16 +1696,10 @@
 /* Internalize one native debug symbol.  */
 
 static void
-hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
-				 text_offset, text_size, filename, index)
-     union dnttentry *dn_bufp;
-     char *name;
-     struct section_offsets *section_offsets;
-     struct objfile *objfile;
-     CORE_ADDR text_offset;
-     int text_size;
-     char *filename;
-     int index;
+hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
+				 struct section_offsets *section_offsets,
+				 struct objfile *objfile, CORE_ADDR text_offset,
+				 int text_size, char *filename, int index)
 {
   unsigned long desc;
   int type;
@@ -1885,7 +1822,7 @@
 	case DNTT_TYPE_MODULE:
 	  /* Ending a module ends the symbol table for that module.  */
 	  valu = text_offset + text_size + offset;
-	  (void) end_symtab (valu, objfile, 0);
+	  (void) end_symtab (valu, objfile, SECT_OFF_TEXT (objfile));
 	  break;
 
 	case DNTT_TYPE_FUNCTION:
diff --git a/gdb/hpux-thread.c b/gdb/hpux-thread.c
index f27d12b..af456f1 100644
--- a/gdb/hpux-thread.c
+++ b/gdb/hpux-thread.c
@@ -100,14 +100,13 @@
 
 
 static struct cleanup *
-save_inferior_pid ()
+save_inferior_pid (void)
 {
   return make_cleanup (restore_inferior_pid, inferior_pid);
 }
 
 static void
-restore_inferior_pid (pid)
-     int pid;
+restore_inferior_pid (int pid)
 {
   inferior_pid = pid;
 }
@@ -119,7 +118,7 @@
 static cma__t_int_tcb cached_tcb;
 
 static int
-find_active_thread ()
+find_active_thread (void)
 {
   static cma__t_int_tcb tcb;
   CORE_ADDR tcb_ptr;
@@ -139,8 +138,7 @@
 static cma__t_int_tcb *find_tcb (int thread);
 
 static cma__t_int_tcb *
-find_tcb (thread)
-     int thread;
+find_tcb (int thread)
 {
   cma__t_known_object queue_header;
   cma__t_queue *queue_ptr;
@@ -179,9 +177,7 @@
 
 /* ARGSUSED */
 static void
-hpux_thread_open (arg, from_tty)
-     char *arg;
-     int from_tty;
+hpux_thread_open (char *arg, int from_tty)
 {
   child_ops.to_open (arg, from_tty);
 }
@@ -190,9 +186,7 @@
    and wait for the trace-trap that results from attaching.  */
 
 static void
-hpux_thread_attach (args, from_tty)
-     char *args;
-     int from_tty;
+hpux_thread_attach (char *args, int from_tty)
 {
   child_ops.to_attach (args, from_tty);
 
@@ -208,9 +202,7 @@
    started via the normal ptrace (PTRACE_TRACEME).  */
 
 static void
-hpux_thread_detach (args, from_tty)
-     char *args;
-     int from_tty;
+hpux_thread_detach (char *args, int from_tty)
 {
   child_ops.to_detach (args, from_tty);
 }
@@ -221,10 +213,7 @@
    for procfs.  */
 
 static void
-hpux_thread_resume (pid, step, signo)
-     int pid;
-     int step;
-     enum target_signal signo;
+hpux_thread_resume (int pid, int step, enum target_signal signo)
 {
   struct cleanup *old_chain;
 
@@ -253,9 +242,7 @@
    to a LWP id, and vice versa on the way out.  */
 
 static int
-hpux_thread_wait (pid, ourstatus)
-     int pid;
-     struct target_waitstatus *ourstatus;
+hpux_thread_wait (int pid, struct target_waitstatus *ourstatus)
 {
   int rtnval;
   struct cleanup *old_chain;
@@ -303,8 +290,7 @@
 };
 
 static void
-hpux_thread_fetch_registers (regno)
-     int regno;
+hpux_thread_fetch_registers (int regno)
 {
   cma__t_int_tcb tcb, *tcb_ptr;
   struct cleanup *old_chain;
@@ -366,8 +352,7 @@
 }
 
 static void
-hpux_thread_store_registers (regno)
-     int regno;
+hpux_thread_store_registers (int regno)
 {
   cma__t_int_tcb tcb, *tcb_ptr;
   struct cleanup *old_chain;
@@ -442,18 +427,14 @@
    debugged.  */
 
 static void
-hpux_thread_prepare_to_store ()
+hpux_thread_prepare_to_store (void)
 {
   child_ops.to_prepare_to_store ();
 }
 
 static int
-hpux_thread_xfer_memory (memaddr, myaddr, len, dowrite, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int dowrite;
-     struct target_ops *target;	/* ignored */
+hpux_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
+			 int dowrite, struct target_ops *target)
 {
   int retval;
   struct cleanup *old_chain;
@@ -472,21 +453,19 @@
 /* Print status information about what we're accessing.  */
 
 static void
-hpux_thread_files_info (ignore)
-     struct target_ops *ignore;
+hpux_thread_files_info (struct target_ops *ignore)
 {
   child_ops.to_files_info (ignore);
 }
 
 static void
-hpux_thread_kill_inferior ()
+hpux_thread_kill_inferior (void)
 {
   child_ops.to_kill ();
 }
 
 static void
-hpux_thread_notice_signals (pid)
-     int pid;
+hpux_thread_notice_signals (int pid)
 {
   child_ops.to_notice_signals (pid);
 }
@@ -494,10 +473,7 @@
 /* Fork an inferior process, and start debugging it with /proc.  */
 
 static void
-hpux_thread_create_inferior (exec_file, allargs, env)
-     char *exec_file;
-     char *allargs;
-     char **env;
+hpux_thread_create_inferior (char *exec_file, char *allargs, char **env)
 {
   child_ops.to_create_inferior (exec_file, allargs, env);
 
@@ -527,8 +503,7 @@
 static void (*target_new_objfile_chain) (struct objfile *);
 
 void
-hpux_thread_new_objfile (objfile)
-     struct objfile *objfile;
+hpux_thread_new_objfile (struct objfile *objfile)
 {
   struct minimal_symbol *ms;
 
@@ -562,7 +537,7 @@
 /* Clean up after the inferior dies.  */
 
 static void
-hpux_thread_mourn_inferior ()
+hpux_thread_mourn_inferior (void)
 {
   child_ops.to_mourn_inferior ();
 }
@@ -570,20 +545,19 @@
 /* Mark our target-struct as eligible for stray "run" and "attach" commands.  */
 
 static int
-hpux_thread_can_run ()
+hpux_thread_can_run (void)
 {
   return child_suppress_run;
 }
 
 static int
-hpux_thread_alive (pid)
-     int pid;
+hpux_thread_alive (int pid)
 {
   return 1;
 }
 
 static void
-hpux_thread_stop ()
+hpux_thread_stop (void)
 {
   child_ops.to_stop ();
 }
@@ -591,8 +565,7 @@
 /* Convert a pid to printable form. */
 
 char *
-hpux_pid_to_str (pid)
-     int pid;
+hpux_pid_to_str (int pid)
 {
   static char buf[100];
 
@@ -602,7 +575,7 @@
 }
 
 static void
-init_hpux_thread_ops ()
+init_hpux_thread_ops (void)
 {
   hpux_thread_ops.to_shortname = "hpux-threads";
   hpux_thread_ops.to_longname = "HPUX threads and pthread.";
@@ -641,7 +614,7 @@
 }
 
 void
-_initialize_hpux_thread ()
+_initialize_hpux_thread (void)
 {
   init_hpux_thread_ops ();
   add_target (&hpux_thread_ops);
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 6a37558..cf703b7 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -1,5 +1,5 @@
-/* Native-dependent code for Linux running on i386's, for GDB.
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+/* Native-dependent code for Linux/x86.
+   Copyright 1999, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -22,11 +22,6 @@
 #include "inferior.h"
 #include "gdbcore.h"
 
-/* For i386_linux_skip_solib_resolver.  */
-#include "symtab.h"
-#include "symfile.h"
-#include "objfiles.h"
-
 #include <sys/ptrace.h>
 #include <sys/user.h>
 #include <sys/procfs.h>
@@ -35,9 +30,15 @@
 #include <sys/reg.h>
 #endif
 
-/* Prototypes for supply_gregset etc. */
+/* Prototypes for supply_gregset etc.  */
 #include "gregset.h"
 
+/* Prototypes for i387_supply_fsave etc.  */
+#include "i387-nat.h"
+
+/* Prototypes for local functions.  */
+static void dummy_sse_values (void);
+
 /* On Linux, threads are implemented as pseudo-processes, in which
    case we may be tracing more than one process at a time.  In that
    case, inferior_pid will contain the main process ID and the
@@ -49,7 +50,7 @@
 #define PIDGET(PID)	PID
 #define TIDGET(PID)	0
 #endif
-
+
 
 /* The register sets used in Linux ELF core-dumps are identical to the
    register sets in `struct user' that is used for a.out core-dumps,
@@ -79,7 +80,7 @@
   (0 <= (regno) && (regno) <= 15)
 #define GETFPREGS_SUPPLIES(regno) \
   (FP0_REGNUM <= (regno) && (regno) <= LAST_FPU_CTRL_REGNUM)
-#define GETXFPREGS_SUPPLIES(regno) \
+#define GETFPXREGS_SUPPLIES(regno) \
   (FP0_REGNUM <= (regno) && (regno) <= MXCSR_REGNUM)
 
 /* Does the current host support the GETREGS request?  */
@@ -91,30 +92,23 @@
 #endif
 ;
 
-/* Does the current host support the GETXFPREGS request?  The header
+/* Does the current host support the GETFPXREGS request?  The header
    file may or may not define it, and even if it is defined, the
    kernel will return EIO if it's running on a pre-SSE processor.
 
-   PTRACE_GETXFPREGS is a Cygnus invention, since we wrote our own
-   Linux kernel patch for SSE support.  That patch may or may not
-   actually make it into the official distribution.  If you find that
-   years have gone by since this stuff was added, and Linux isn't
-   using PTRACE_GETXFPREGS, that means that our patch didn't make it,
-   and you can delete this, and the related code.
-
    My instinct is to attach this to some architecture- or
    target-specific data structure, but really, a particular GDB
    process can only run on top of one kernel at a time.  So it's okay
    for this to be a simple variable.  */
-int have_ptrace_getxfpregs =
-#ifdef HAVE_PTRACE_GETXFPREGS
+int have_ptrace_getfpxregs =
+#ifdef HAVE_PTRACE_GETFPXREGS
   1
 #else
   0
 #endif
 ;
-
 
+
 /* Fetching registers directly from the U area, one at a time.  */
 
 /* FIXME: kettenis/2000-03-05: This duplicates code from `inptrace.c'.
@@ -139,15 +133,12 @@
 #endif
 
 /* Registers we shouldn't try to fetch.  */
-#if !defined (CANNOT_FETCH_REGISTER)
-#define CANNOT_FETCH_REGISTER(regno) 0
-#endif
+#define OLD_CANNOT_FETCH_REGISTER(regno) ((regno) >= NUM_GREGS)
 
 /* Fetch one register.  */
 
 static void
-fetch_register (regno)
-     int regno;
+fetch_register (int regno)
 {
   /* This isn't really an address.  But ptrace thinks of it as one.  */
   CORE_ADDR regaddr;
@@ -157,7 +148,7 @@
   char buf[MAX_REGISTER_RAW_SIZE];
   int tid;
 
-  if (CANNOT_FETCH_REGISTER (regno))
+  if (OLD_CANNOT_FETCH_REGISTER (regno))
     {
       memset (buf, '\0', REGISTER_RAW_SIZE (regno));	/* Supply zeroes */
       supply_register (regno, buf);
@@ -192,8 +183,7 @@
    Otherwise, REGNO specifies which register (so we can save time). */
 
 void
-old_fetch_inferior_registers (regno)
-     int regno;
+old_fetch_inferior_registers (int regno)
 {
   if (regno >= 0)
     {
@@ -209,15 +199,12 @@
 }
 
 /* Registers we shouldn't try to store.  */
-#if !defined (CANNOT_STORE_REGISTER)
-#define CANNOT_STORE_REGISTER(regno) 0
-#endif
+#define OLD_CANNOT_STORE_REGISTER(regno) ((regno) >= NUM_GREGS)
 
 /* Store one register. */
 
 static void
-store_register (regno)
-     int regno;
+store_register (int regno)
 {
   /* This isn't really an address.  But ptrace thinks of it as one.  */
   CORE_ADDR regaddr;
@@ -226,7 +213,7 @@
   unsigned int offset;		/* Offset of registers within the u area.  */
   int tid;
 
-  if (CANNOT_STORE_REGISTER (regno))
+  if (OLD_CANNOT_STORE_REGISTER (regno))
     {
       return;
     }
@@ -258,8 +245,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-old_store_inferior_registers (regno)
-     int regno;
+old_store_inferior_registers (int regno)
 {
   if (regno >= 0)
     {
@@ -273,8 +259,8 @@
 	}
     }
 }
-
 
+
 /* Transfering the general-purpose registers between GDB, inferiors
    and core files.  */
 
@@ -285,49 +271,25 @@
 supply_gregset (elf_gregset_t *gregsetp)
 {
   elf_greg_t *regp = (elf_greg_t *) gregsetp;
-  int regi;
+  int i;
 
-  for (regi = 0; regi < NUM_GREGS; regi++)
-    supply_register (regi, (char *) (regp + regmap[regi]));
-}
-
-/* Convert the valid general-purpose register values in GDB's register
-   array to `struct user' format and store them in *GREGSETP.  The
-   array VALID indicates which register values are valid.  If VALID is
-   NULL, all registers are assumed to be valid.  */
-
-static void
-convert_to_gregset (elf_gregset_t *gregsetp, signed char *valid)
-{
-  elf_greg_t *regp = (elf_greg_t *) gregsetp;
-  int regi;
-
-  for (regi = 0; regi < NUM_GREGS; regi++)
-    if (! valid || valid[regi])
-      *(regp + regmap[regi]) = * (int *) &registers[REGISTER_BYTE (regi)];
+  for (i = 0; i < NUM_GREGS; i++)
+    supply_register (i, (char *) (regp + regmap[i]));
 }
 
 /* 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)
 {
-  if (regno == -1)
-    {
-      convert_to_gregset (gregsetp, NULL);
-      return;
-    }
+  elf_greg_t *regp = (elf_greg_t *) gregsetp;
+  int i;
 
-  if (GETREGS_SUPPLIES (regno))
-    {
-      signed char valid[NUM_GREGS];
-
-      memset (valid, 0, sizeof (valid));
-      valid[regno] = 1;
-
-      convert_to_gregset (gregsetp, valid);
-    }
+  for (i = 0; i < NUM_GREGS; i++)
+    if ((regno == -1 || regno == i))
+      *(regp + regmap[i]) = *(elf_greg_t *) &registers[REGISTER_BYTE (i)];
 }
 
 #ifdef HAVE_PTRACE_GETREGS
@@ -339,10 +301,8 @@
 fetch_regs (int tid)
 {
   elf_gregset_t regs;
-  int ret;
 
-  ret = ptrace (PTRACE_GETREGS, tid, 0, (int) &regs);
-  if (ret < 0)
+  if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
     {
       if (errno == EIO)
 	{
@@ -352,8 +312,7 @@
 	  return;
 	}
 
-      warning ("Couldn't get registers.");
-      return;
+      perror_with_name ("Couldn't get registers");
     }
 
   supply_gregset (&regs);
@@ -363,40 +322,28 @@
    into the process/thread specified by TID.  */
 
 static void
-store_regs (int tid)
+store_regs (int tid, int regno)
 {
   elf_gregset_t regs;
-  int ret;
 
-  ret = ptrace (PTRACE_GETREGS, tid, 0, (int) &regs);
-  if (ret < 0)
-    {
-      warning ("Couldn't get registers.");
-      return;
-    }
+  if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
+    perror_with_name ("Couldn't get registers");
 
-  convert_to_gregset (&regs, register_valid);
-
-  ret = ptrace (PTRACE_SETREGS, tid, 0, (int) &regs);
-  if (ret < 0)
-    {
-      warning ("Couldn't write registers.");
-      return;
-    }
+  fill_gregset (&regs, regno);
+  
+  if (ptrace (PTRACE_SETREGS, tid, 0, (int) &regs) < 0)
+    perror_with_name ("Couldn't write registers");
 }
 
 #else
 
 static void fetch_regs (int tid) {}
-static void store_regs (int tid) {}
+static void store_regs (int tid, int regno) {}
 
 #endif
-
 
-/* Transfering floating-point registers between GDB, inferiors and cores.  */
 
-/* What is the address of st(N) within the floating-point register set F?  */
-#define FPREG_ADDR(f, n) ((char *) &(f)->st_space + (n) * 10)
+/* Transfering floating-point registers between GDB, inferiors and cores.  */
 
 /* Fill GDB's register array with the floating-point register values in
    *FPREGSETP.  */
@@ -404,86 +351,8 @@
 void 
 supply_fpregset (elf_fpregset_t *fpregsetp)
 {
-  int reg;
-  long l;
-
-  /* Supply the floating-point registers.  */
-  for (reg = 0; reg < 8; reg++)
-    supply_register (FP0_REGNUM + reg, FPREG_ADDR (fpregsetp, reg));
-
-  /* We have to mask off the reserved bits in *FPREGSETP before
-     storing the values in GDB's register file.  */
-#define supply(REGNO, MEMBER)                                           \
-  l = fpregsetp->MEMBER & 0xffff;                                       \
-  supply_register (REGNO, (char *) &l)
-
-  supply (FCTRL_REGNUM, cwd);
-  supply (FSTAT_REGNUM, swd);
-  supply (FTAG_REGNUM, twd);
-  supply_register (FCOFF_REGNUM, (char *) &fpregsetp->fip);
-  supply (FDS_REGNUM, fos);
-  supply_register (FDOFF_REGNUM, (char *) &fpregsetp->foo);
-
-#undef supply
-
-  /* Extract the code segment and opcode from the  "fcs" member.  */
-  l = fpregsetp->fcs & 0xffff;
-  supply_register (FCS_REGNUM, (char *) &l);
-
-  l = (fpregsetp->fcs >> 16) & ((1 << 11) - 1);
-  supply_register (FOP_REGNUM, (char *) &l);
-}
-
-/* Convert the valid floating-point register values in GDB's register
-   array to `struct user' format and store them in *FPREGSETP.  The
-   array VALID indicates which register values are valid.  If VALID is
-   NULL, all registers are assumed to be valid.  */
-
-static void
-convert_to_fpregset (elf_fpregset_t *fpregsetp, signed char *valid)
-{
-  int reg;
-
-  /* Fill in the floating-point registers.  */
-  for (reg = 0; reg < 8; reg++)
-    if (!valid || valid[reg])
-      memcpy (FPREG_ADDR (fpregsetp, reg),
-	      &registers[REGISTER_BYTE (FP0_REGNUM + reg)],
-	      REGISTER_RAW_SIZE(FP0_REGNUM + reg));
-
-  /* We're not supposed to touch the reserved bits in *FPREGSETP.  */
-
-#define fill(MEMBER, REGNO)						\
-  if (! valid || valid[(REGNO)])					\
-    fpregsetp->MEMBER                                                   \
-      = ((fpregsetp->MEMBER & ~0xffff)                                  \
-         | (* (int *) &registers[REGISTER_BYTE (REGNO)] & 0xffff))
-
-#define fill_register(MEMBER, REGNO)                                    \
-  if (! valid || valid[(REGNO)])                                        \
-    memcpy (&fpregsetp->MEMBER, &registers[REGISTER_BYTE (REGNO)],      \
-            sizeof (fpregsetp->MEMBER))
-
-  fill (cwd, FCTRL_REGNUM);
-  fill (swd, FSTAT_REGNUM);
-  fill (twd, FTAG_REGNUM);
-  fill_register (fip, FCOFF_REGNUM);
-  fill (foo, FDOFF_REGNUM);
-  fill_register (fos, FDS_REGNUM);
-
-#undef fill
-#undef fill_register
-
-  if (! valid || valid[FCS_REGNUM])
-    fpregsetp->fcs
-      = ((fpregsetp->fcs & ~0xffff)
-	 | (* (int *) &registers[REGISTER_BYTE (FCS_REGNUM)] & 0xffff));
-
-  if (! valid || valid[FOP_REGNUM])
-    fpregsetp->fcs
-      = ((fpregsetp->fcs & 0xffff)
-	 | ((*(int *) &registers[REGISTER_BYTE (FOP_REGNUM)] & ((1 << 11) - 1))
-	    << 16));
+  i387_supply_fsave ((char *) fpregsetp);
+  dummy_sse_values ();
 }
 
 /* Fill register REGNO (if it is a floating-point register) in
@@ -493,21 +362,7 @@
 void
 fill_fpregset (elf_fpregset_t *fpregsetp, int regno)
 {
-  if (regno == -1)
-    {
-      convert_to_fpregset (fpregsetp, NULL);
-      return;
-    }
-
-  if (GETFPREGS_SUPPLIES(regno))
-    {
-      signed char valid[MAX_NUM_REGS];
-      
-      memset (valid, 0, sizeof (valid));
-      valid[regno] = 1;
-	      
-      convert_to_fpregset (fpregsetp, valid);
-    }
+  i387_fill_fsave ((char *) fpregsetp, regno);
 }
 
 #ifdef HAVE_PTRACE_GETREGS
@@ -519,14 +374,9 @@
 fetch_fpregs (int tid)
 {
   elf_fpregset_t fpregs;
-  int ret;
 
-  ret = ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs);
-  if (ret < 0)
-    {
-      warning ("Couldn't get floating point status.");
-      return;
-    }
+  if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
+    perror_with_name ("Couldn't get floating point status");
 
   supply_fpregset (&fpregs);
 }
@@ -535,199 +385,104 @@
    into the process/thread specified by TID.  */
 
 static void
-store_fpregs (int tid)
+store_fpregs (int tid, int regno)
 {
   elf_fpregset_t fpregs;
-  int ret;
 
-  ret = ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs);
-  if (ret < 0)
-    {
-      warning ("Couldn't get floating point status.");
-      return;
-    }
+  if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
+    perror_with_name ("Couldn't get floating point status");
 
-  convert_to_fpregset (&fpregs, register_valid);
+  fill_fpregset (&fpregs, regno);
 
-  ret = ptrace (PTRACE_SETFPREGS, tid, 0, (int) &fpregs);
-  if (ret < 0)
-    {
-      warning ("Couldn't write floating point status.");
-      return;
-    }
+  if (ptrace (PTRACE_SETFPREGS, tid, 0, (int) &fpregs) < 0)
+    perror_with_name ("Couldn't write floating point status");
 }
 
 #else
 
 static void fetch_fpregs (int tid) {}
-static void store_fpregs (int tid) {}
+static void store_fpregs (int tid, int regno) {}
 
 #endif
-
 
+
 /* Transfering floating-point and SSE registers to and from GDB.  */
 
-/* PTRACE_GETXFPREGS is a Cygnus invention, since we wrote our own
-   Linux kernel patch for SSE support.  That patch may or may not
-   actually make it into the official distribution.  If you find that
-   years have gone by since this code was added, and Linux isn't using
-   PTRACE_GETXFPREGS, that means that our patch didn't make it, and
-   you can delete this code.  */
-
-#ifdef HAVE_PTRACE_GETXFPREGS
+#ifdef HAVE_PTRACE_GETFPXREGS
 
 /* Fill GDB's register array with the floating-point and SSE register
-   values in *XFPREGS.  */
+   values in *FPXREGSETP.  */
 
 static void
-supply_xfpregset (struct user_xfpregs_struct *xfpregs)
+supply_fpxregset (elf_fpxregset_t *fpxregsetp)
 {
-  int reg;
-
-  /* Supply the floating-point registers.  */
-  for (reg = 0; reg < 8; reg++)
-    supply_register (FP0_REGNUM + reg, (char *) &xfpregs->st_space[reg]);
-
-  {
-    supply_register (FCTRL_REGNUM, (char *) &xfpregs->cwd);
-    supply_register (FSTAT_REGNUM, (char *) &xfpregs->swd);
-    supply_register (FTAG_REGNUM,  (char *) &xfpregs->twd);
-    supply_register (FCOFF_REGNUM, (char *) &xfpregs->fip);
-    supply_register (FDS_REGNUM,   (char *) &xfpregs->fos);
-    supply_register (FDOFF_REGNUM, (char *) &xfpregs->foo);
-  
-    /* Extract the code segment and opcode from the  "fcs" member.  */
-    {
-      long l;
-      
-      l = xfpregs->fcs & 0xffff;
-      supply_register (FCS_REGNUM, (char *) &l);
-
-      l = (xfpregs->fcs >> 16) & ((1 << 11) - 1);
-      supply_register (FOP_REGNUM, (char *) &l);
-    }
-  }
-
-  /* Supply the SSE registers.  */
-  for (reg = 0; reg < 8; reg++)
-    supply_register (XMM0_REGNUM + reg, (char *) &xfpregs->xmm_space[reg]);
-  supply_register (MXCSR_REGNUM, (char *) &xfpregs->mxcsr);
+  i387_supply_fxsave ((char *) fpxregsetp);
 }
 
-/* Convert the valid floating-point and SSE registers in GDB's
-   register array to `struct user' format and store them in *XFPREGS.
-   The array VALID indicates which registers are valid.  If VALID is
-   NULL, all registers are assumed to be valid.  */
+/* Fill register REGNO (if it is a floating-point or SSE register) in
+   *FPXREGSETP with the value in GDB's register array.  If REGNO is
+   -1, do this for all registers.  */
 
 static void
-convert_to_xfpregset (struct user_xfpregs_struct *xfpregs,
-		      signed char *valid)
+fill_fpxregset (elf_fpxregset_t *fpxregsetp, int regno)
 {
-  int reg;
-
-  /* Fill in the floating-point registers.  */
-  for (reg = 0; reg < 8; reg++)
-    if (!valid || valid[reg])
-      memcpy (&xfpregs->st_space[reg],
-	      &registers[REGISTER_BYTE (FP0_REGNUM + reg)],
-	      REGISTER_RAW_SIZE(FP0_REGNUM + reg));
-
-#define fill(MEMBER, REGNO)						\
-  if (! valid || valid[(REGNO)])					\
-    memcpy (&xfpregs->MEMBER, &registers[REGISTER_BYTE (REGNO)],	\
-	    sizeof (xfpregs->MEMBER))
-
-  fill (cwd, FCTRL_REGNUM);
-  fill (swd, FSTAT_REGNUM);
-  fill (twd, FTAG_REGNUM);
-  fill (fip, FCOFF_REGNUM);
-  fill (foo, FDOFF_REGNUM);
-  fill (fos, FDS_REGNUM);
-
-#undef fill
-
-  if (! valid || valid[FCS_REGNUM])
-    xfpregs->fcs
-      = ((xfpregs->fcs & ~0xffff)
-	 | (* (int *) &registers[REGISTER_BYTE (FCS_REGNUM)] & 0xffff));
-
-  if (! valid || valid[FOP_REGNUM])
-    xfpregs->fcs
-      = ((xfpregs->fcs & 0xffff)
-	 | ((*(int *) &registers[REGISTER_BYTE (FOP_REGNUM)] & ((1 << 11) - 1))
-	    << 16));
-
-  /* Fill in the XMM registers.  */
-  for (reg = 0; reg < 8; reg++)
-    if (! valid || valid[reg])
-      memcpy (&xfpregs->xmm_space[reg],
-	      &registers[REGISTER_BYTE (XMM0_REGNUM + reg)],
-	      REGISTER_RAW_SIZE (XMM0_REGNUM + reg));
+  i387_fill_fxsave ((char *) fpxregsetp, regno);
 }
 
-/* Fetch all registers covered by the PTRACE_SETXFPREGS request from
+/* Fetch all registers covered by the PTRACE_GETFPXREGS request from
    process/thread TID and store their values in GDB's register array.
    Return non-zero if successful, zero otherwise.  */
 
 static int
-fetch_xfpregs (int tid)
+fetch_fpxregs (int tid)
 {
-  struct user_xfpregs_struct xfpregs;
-  int ret;
+  elf_fpxregset_t fpxregs;
 
-  if (! have_ptrace_getxfpregs) 
+  if (! have_ptrace_getfpxregs)
     return 0;
 
-  ret = ptrace (PTRACE_GETXFPREGS, tid, 0, &xfpregs);
-  if (ret == -1)
+  if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0)
     {
       if (errno == EIO)
 	{
-	  have_ptrace_getxfpregs = 0;
+	  have_ptrace_getfpxregs = 0;
 	  return 0;
 	}
 
-      warning ("Couldn't read floating-point and SSE registers.");
-      return 0;
+      perror_with_name ("Couldn't read floating-point and SSE registers");
     }
 
-  supply_xfpregset (&xfpregs);
+  supply_fpxregset (&fpxregs);
   return 1;
 }
 
 /* Store all valid registers in GDB's register array covered by the
-   PTRACE_SETXFPREGS request into the process/thread specified by TID.
+   PTRACE_SETFPXREGS request into the process/thread specified by TID.
    Return non-zero if successful, zero otherwise.  */
 
 static int
-store_xfpregs (int tid)
+store_fpxregs (int tid, int regno)
 {
-  struct user_xfpregs_struct xfpregs;
-  int ret;
+  elf_fpxregset_t fpxregs;
 
-  if (! have_ptrace_getxfpregs)
+  if (! have_ptrace_getfpxregs)
     return 0;
-
-  ret = ptrace (PTRACE_GETXFPREGS, tid, 0, &xfpregs);
-  if (ret == -1)
+  
+  if (ptrace (PTRACE_GETFPXREGS, tid, 0, &fpxregs) == -1)
     {
       if (errno == EIO)
 	{
-	  have_ptrace_getxfpregs = 0;
+	  have_ptrace_getfpxregs = 0;
 	  return 0;
 	}
 
-      warning ("Couldn't read floating-point and SSE registers.");
-      return 0;
+      perror_with_name ("Couldn't read floating-point and SSE registers");
     }
 
-  convert_to_xfpregset (&xfpregs, register_valid);
+  fill_fpxregset (&fpxregs, regno);
 
-  if (ptrace (PTRACE_SETXFPREGS, tid, 0, &xfpregs) < 0)
-    {
-      warning ("Couldn't write floating-point and SSE registers.");
-      return 0;
-    }
+  if (ptrace (PTRACE_SETFPXREGS, tid, 0, &fpxregs) == -1)
+    perror_with_name ("Couldn't write floating-point and SSE registers");
 
   return 1;
 }
@@ -753,17 +508,35 @@
 
 #else
 
-/* Stub versions of the above routines, for systems that don't have
-   PTRACE_GETXFPREGS.  */
-static int store_xfpregs (int tid) { return 0; }
-static int fetch_xfpregs (int tid) { return 0; }
+static int fetch_fpxregs (int tid) { return 0; }
+static int store_fpxregs (int tid, int regno) { return 0; }
 static void dummy_sse_values (void) {}
 
-#endif
-
+#endif /* HAVE_PTRACE_GETFPXREGS */
 
+
 /* Transferring arbitrary registers between GDB and inferior.  */
 
+/* Check if register REGNO in the child process is accessible.
+   If we are accessing registers directly via the U area, only the
+   general-purpose registers are available.
+   All registers should be accessible if we have GETREGS support.  */
+   
+int
+cannot_fetch_register (int regno)
+{
+  if (! have_ptrace_getregs)
+    return OLD_CANNOT_FETCH_REGISTER (regno);
+  return 0;
+}
+int
+cannot_store_register (int regno)
+{
+  if (! have_ptrace_getregs)
+    return OLD_CANNOT_STORE_REGISTER (regno);
+  return 0;
+}
+
 /* Fetch register REGNO from the child process.  If REGNO is -1, do
    this for all registers (including the floating point and SSE
    registers).  */
@@ -785,9 +558,9 @@
   if ((tid = TIDGET (inferior_pid)) == 0)
     tid = inferior_pid;		/* Not a threaded program.  */
 
-  /* Use the PTRACE_GETXFPREGS request whenever possible, since it
+  /* Use the PTRACE_GETFPXREGS request whenever possible, since it
      transfers more registers in one system call, and we'll cache the
-     results.  But remember that fetch_xfpregs can fail, and return
+     results.  But remember that fetch_fpxregs can fail, and return
      zero.  */
   if (regno == -1)
     {
@@ -800,7 +573,7 @@
 	  return;
 	}
 
-      if (fetch_xfpregs (tid))
+      if (fetch_fpxregs (tid))
 	return;
       fetch_fpregs (tid);
       return;
@@ -812,9 +585,9 @@
       return;
     }
 
-  if (GETXFPREGS_SUPPLIES (regno))
+  if (GETFPXREGS_SUPPLIES (regno))
     {
-      if (fetch_xfpregs (tid))
+      if (fetch_fpxregs (tid))
 	return;
 
       /* Either our processor or our kernel doesn't support the SSE
@@ -824,12 +597,10 @@
 	 gdbarch.  Until then, this will at least make things work
 	 plausibly.  */
       fetch_fpregs (tid);
-      dummy_sse_values ();
       return;
     }
 
-  internal_error ("i386-linux-nat.c (fetch_inferior_registers): "
-		  "got request for bad register number %d", regno);
+  internal_error ("Got request for bad register number %d.", regno);
 }
 
 /* Store register REGNO back into the child process.  If REGNO is -1,
@@ -852,40 +623,40 @@
   if ((tid = TIDGET (inferior_pid)) == 0)
     tid = inferior_pid;		/* Not a threaded program.  */
 
-  /* Use the PTRACE_SETXFPREGS requests whenever possibl, since it
+  /* Use the PTRACE_SETFPXREGS requests whenever possible, since it
      transfers more registers in one system call.  But remember that
-     store_xfpregs can fail, and return zero.  */
+     store_fpxregs can fail, and return zero.  */
   if (regno == -1)
     {
-      store_regs (tid);
-      if (store_xfpregs (tid))
+      store_regs (tid, regno);
+      if (store_fpxregs (tid, regno))
 	return;
-      store_fpregs (tid);
+      store_fpregs (tid, regno);
       return;
     }
 
   if (GETREGS_SUPPLIES (regno))
     {
-      store_regs (tid);
+      store_regs (tid, regno);
       return;
     }
 
-  if (GETXFPREGS_SUPPLIES (regno))
+  if (GETFPXREGS_SUPPLIES (regno))
     {
-      if (store_xfpregs (tid))
+      if (store_fpxregs (tid, regno))
 	return;
 
       /* Either our processor or our kernel doesn't support the SSE
 	 registers, so just write the FP registers in the traditional
 	 way.  */
-      store_fpregs (tid);
+      store_fpregs (tid, regno);
       return;
     }
 
   internal_error ("Got request to store bad register number %d.", regno);
 }
-
 
+
 /* Interpreting register set info found in core files.  */
 
 /* Provide registers to GDB from a core file.
@@ -893,7 +664,7 @@
    (We can't use the generic version of this function in
    core-regset.c, because Linux has *three* different kinds of
    register set notes.  core-regset.c would have to call
-   supply_xfpregset, which most platforms don't have.)
+   supply_fpxregset, which most platforms don't have.)
 
    CORE_REG_SECT points to an array of bytes, which are the contents
    of a `note' from a core file which BFD thinks might contain
@@ -902,8 +673,7 @@
    WHICH says which register set corelow suspects this is:
      0 --- the general-purpose register set, in elf_gregset_t format
      2 --- the floating-point register set, in elf_fpregset_t format
-     3 --- the extended floating-point register set, in struct
-           user_xfpregs_struct format
+     3 --- the extended floating-point register set, in elf_fpxregset_t format
 
    REG_ADDR isn't used on Linux.  */
 
@@ -936,17 +706,17 @@
 	}
       break;
 
-#ifdef HAVE_PTRACE_GETXFPREGS
+#ifdef HAVE_PTRACE_GETFPXREGS
       {
-	struct user_xfpregs_struct xfpregset;
+	elf_fpxregset_t fpxregset;
 
       case 3:
-	if (core_reg_size != sizeof (xfpregset))
-	  warning ("Wrong size user_xfpregs_struct in core file.");
+	if (core_reg_size != sizeof (fpxregset))
+	  warning ("Wrong size fpxregset in core file.");
 	else
 	  {
-	    memcpy (&xfpregset, core_reg_sect, sizeof (xfpregset));
-	    supply_xfpregset (&xfpregset);
+	    memcpy (&fpxregset, core_reg_sect, sizeof (fpxregset));
+	    supply_fpxregset (&fpxregset);
 	  }
 	break;
       }
@@ -959,8 +729,8 @@
       break;
     }
 }
-
 
+
 /* The instruction for a Linux system call is:
        int $0x80
    or 0xcd 0x80.  */
@@ -1044,101 +814,8 @@
   if (ptrace (request, pid, 0, target_signal_to_host (signal)) == -1)
     perror_with_name ("ptrace");
 }
-
 
-/* Calling functions in shared libraries.  */
-/* FIXME: kettenis/2000-03-05: Doesn't this belong in a
-   target-dependent file?  The function
-   `i386_linux_skip_solib_resolver' is mentioned in
-   `config/i386/tm-linux.h'.  */
 
-/* Find the minimal symbol named NAME, and return both the minsym
-   struct and its objfile.  This probably ought to be in minsym.c, but
-   everything there is trying to deal with things like C++ and
-   SOFUN_ADDRESS_MAYBE_TURQUOISE, ...  Since this is so simple, it may
-   be considered too special-purpose for general consumption.  */
-
-static struct minimal_symbol *
-find_minsym_and_objfile (char *name, struct objfile **objfile_p)
-{
-  struct objfile *objfile;
-
-  ALL_OBJFILES (objfile)
-    {
-      struct minimal_symbol *msym;
-
-      ALL_OBJFILE_MSYMBOLS (objfile, msym)
-	{
-	  if (SYMBOL_NAME (msym)
-	      && STREQ (SYMBOL_NAME (msym), name))
-	    {
-	      *objfile_p = objfile;
-	      return msym;
-	    }
-	}
-    }
-
-  return 0;
-}
-
-
-static CORE_ADDR
-skip_hurd_resolver (CORE_ADDR pc)
-{
-  /* The HURD dynamic linker is part of the GNU C library, so many
-     GNU/Linux distributions use it.  (All ELF versions, as far as I
-     know.)  An unresolved PLT entry points to "_dl_runtime_resolve",
-     which calls "fixup" to patch the PLT, and then passes control to
-     the function.
-
-     We look for the symbol `_dl_runtime_resolve', and find `fixup' in
-     the same objfile.  If we are at the entry point of `fixup', then
-     we set a breakpoint at the return address (at the top of the
-     stack), and continue.
-  
-     It's kind of gross to do all these checks every time we're
-     called, since they don't change once the executable has gotten
-     started.  But this is only a temporary hack --- upcoming versions
-     of Linux will provide a portable, efficient interface for
-     debugging programs that use shared libraries.  */
-
-  struct objfile *objfile;
-  struct minimal_symbol *resolver 
-    = find_minsym_and_objfile ("_dl_runtime_resolve", &objfile);
-
-  if (resolver)
-    {
-      struct minimal_symbol *fixup
-	= lookup_minimal_symbol ("fixup", 0, objfile);
-
-      if (fixup && SYMBOL_VALUE_ADDRESS (fixup) == pc)
-	return (SAVED_PC_AFTER_CALL (get_current_frame ()));
-    }
-
-  return 0;
-}      
-
-/* See the comments for SKIP_SOLIB_RESOLVER at the top of infrun.c.
-   This function:
-   1) decides whether a PLT has sent us into the linker to resolve
-      a function reference, and 
-   2) if so, tells us where to set a temporary breakpoint that will
-      trigger when the dynamic linker is done.  */
-
-CORE_ADDR
-i386_linux_skip_solib_resolver (CORE_ADDR pc)
-{
-  CORE_ADDR result;
-
-  /* Plug in functions for other kinds of resolvers here.  */
-  result = skip_hurd_resolver (pc);
-  if (result)
-    return result;
-
-  return 0;
-}
-
-
 /* Register that we are able to handle Linux ELF core file formats.  */
 
 static struct core_fns linux_elf_core_fns =
@@ -1151,7 +828,7 @@
 };
 
 void
-_initialize_i386_linux_nat ()
+_initialize_i386_linux_nat (void)
 {
   add_core_fns (&linux_elf_core_fns);
 }
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 38d6bcb..e7fbc38 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -23,6 +23,12 @@
 #include "frame.h"
 #include "value.h"
 
+/* For i386_linux_skip_solib_resolver.  */
+#include "symtab.h"
+#include "symfile.h"
+#include "objfiles.h"
+#include "solib-svr4.h"	/* for struct link_map_offsets */
+
 
 /* Recognizing signal handler frames.  */
 
@@ -279,3 +285,133 @@
 
   return read_memory_integer (read_register (SP_REGNUM), 4);
 }
+
+
+
+/* Calling functions in shared libraries.  */
+/* Find the minimal symbol named NAME, and return both the minsym
+   struct and its objfile.  This probably ought to be in minsym.c, but
+   everything there is trying to deal with things like C++ and
+   SOFUN_ADDRESS_MAYBE_TURQUOISE, ...  Since this is so simple, it may
+   be considered too special-purpose for general consumption.  */
+
+static struct minimal_symbol *
+find_minsym_and_objfile (char *name, struct objfile **objfile_p)
+{
+  struct objfile *objfile;
+
+  ALL_OBJFILES (objfile)
+    {
+      struct minimal_symbol *msym;
+
+      ALL_OBJFILE_MSYMBOLS (objfile, msym)
+	{
+	  if (SYMBOL_NAME (msym)
+	      && STREQ (SYMBOL_NAME (msym), name))
+	    {
+	      *objfile_p = objfile;
+	      return msym;
+	    }
+	}
+    }
+
+  return 0;
+}
+
+static CORE_ADDR
+skip_hurd_resolver (CORE_ADDR pc)
+{
+  /* The HURD dynamic linker is part of the GNU C library, so many
+     GNU/Linux distributions use it.  (All ELF versions, as far as I
+     know.)  An unresolved PLT entry points to "_dl_runtime_resolve",
+     which calls "fixup" to patch the PLT, and then passes control to
+     the function.
+
+     We look for the symbol `_dl_runtime_resolve', and find `fixup' in
+     the same objfile.  If we are at the entry point of `fixup', then
+     we set a breakpoint at the return address (at the top of the
+     stack), and continue.
+  
+     It's kind of gross to do all these checks every time we're
+     called, since they don't change once the executable has gotten
+     started.  But this is only a temporary hack --- upcoming versions
+     of Linux will provide a portable, efficient interface for
+     debugging programs that use shared libraries.  */
+
+  struct objfile *objfile;
+  struct minimal_symbol *resolver 
+    = find_minsym_and_objfile ("_dl_runtime_resolve", &objfile);
+
+  if (resolver)
+    {
+      struct minimal_symbol *fixup
+	= lookup_minimal_symbol ("fixup", 0, objfile);
+
+      if (fixup && SYMBOL_VALUE_ADDRESS (fixup) == pc)
+	return (SAVED_PC_AFTER_CALL (get_current_frame ()));
+    }
+
+  return 0;
+}      
+
+/* See the comments for SKIP_SOLIB_RESOLVER at the top of infrun.c.
+   This function:
+   1) decides whether a PLT has sent us into the linker to resolve
+      a function reference, and 
+   2) if so, tells us where to set a temporary breakpoint that will
+      trigger when the dynamic linker is done.  */
+
+CORE_ADDR
+i386_linux_skip_solib_resolver (CORE_ADDR pc)
+{
+  CORE_ADDR result;
+
+  /* Plug in functions for other kinds of resolvers here.  */
+  result = skip_hurd_resolver (pc);
+  if (result)
+    return result;
+
+  return 0;
+}
+
+/* Fetch (and possibly build) an appropriate link_map_offsets structure
+   for native i386 linux targets using the struct offsets defined in
+   link.h (but without actual reference to that file).
+
+   This makes it possible to access i386-linux shared libraries from
+   a gdb that was not built on an i386-linux host (for cross debugging).
+   */
+
+struct link_map_offsets *
+i386_linux_svr4_fetch_link_map_offsets (void)
+{
+  static struct link_map_offsets lmo;
+  static struct link_map_offsets *lmp = 0;
+
+  if (lmp == 0)
+    {
+      lmp = &lmo;
+
+      lmo.r_debug_size = 8;	/* 20 not actual size but all we need */
+
+      lmo.r_map_offset = 4;
+      lmo.r_map_size   = 4;
+
+      lmo.link_map_size = 20;	/* 552 not actual size but all we need */
+
+      lmo.l_addr_offset = 0;
+      lmo.l_addr_size   = 4;
+
+      lmo.l_name_offset = 4;
+      lmo.l_name_size   = 4;
+
+      lmo.l_next_offset = 12;
+      lmo.l_next_size   = 4;
+
+      lmo.l_prev_offset = 16;
+      lmo.l_prev_size   = 4;
+    }
+
+    return lmp;
+}
+
diff --git a/gdb/i386-stub.c b/gdb/i386-stub.c
index 157779c..2b08e34 100644
--- a/gdb/i386-stub.c
+++ b/gdb/i386-stub.c
@@ -449,7 +449,7 @@
 /* scan for the sequence $<data>#<checksum>     */
 
 unsigned char *
-getpacket ()
+getpacket (void)
 {
   unsigned char *buffer = &remcomInBuffer[0];
   unsigned char checksum;
@@ -562,7 +562,7 @@
 static volatile int mem_err = 0;
 
 void
-set_mem_err ()
+set_mem_err (void)
 {
   mem_err = 1;
 }
@@ -572,16 +572,13 @@
    to mem_fault, they won't get restored, so there better not be any
    saved).  */
 int
-get_char (addr)
-     char *addr;
+get_char (char *addr)
 {
   return *addr;
 }
 
 void
-set_char (addr, val)
-     char *addr;
-     int val;
+set_char (char *addr, int val)
 {
   *addr = val;
 }
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index e2ebffa..0750efc 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -29,6 +29,7 @@
 #include "symtab.h"
 #include "gdbcmd.h"
 #include "command.h"
+#include "arch-utils.h"
 
 static long i386_get_frame_setup (CORE_ADDR);
 
@@ -74,15 +75,15 @@
 
 /* This is the variable the is set with "set disassembly-flavor",
    and its legitimate values. */
-static char att_flavor[] = "att";
-static char intel_flavor[] = "intel";
-static char *valid_flavors[] =
+static const char att_flavor[] = "att";
+static const char intel_flavor[] = "intel";
+static const char *valid_flavors[] =
 {
   att_flavor,
   intel_flavor,
   NULL
 };
-static char *disassembly_flavor = att_flavor;
+static const char *disassembly_flavor = att_flavor;
 
 static void i386_print_register (char *, int, int);
 
@@ -122,8 +123,7 @@
 			 codestream_fill(0) : codestream_buf[codestream_off++])
 
 static unsigned char
-codestream_fill (peek_flag)
-     int peek_flag;
+codestream_fill (int peek_flag)
 {
   codestream_addr = codestream_next_addr;
   codestream_next_addr += CODESTREAM_BUFSIZ;
@@ -138,8 +138,7 @@
 }
 
 static void
-codestream_seek (place)
-     CORE_ADDR place;
+codestream_seek (CORE_ADDR place)
 {
   codestream_next_addr = place / CODESTREAM_BUFSIZ;
   codestream_next_addr *= CODESTREAM_BUFSIZ;
@@ -150,9 +149,7 @@
 }
 
 static void
-codestream_read (buf, count)
-     unsigned char *buf;
-     int count;
+codestream_read (unsigned char *buf, int count)
 {
   unsigned char *p;
   int i;
@@ -164,7 +161,7 @@
 /* next instruction is a jump, move to target */
 
 static void
-i386_follow_jump ()
+i386_follow_jump (void)
 {
   unsigned char buf[4];
   long delta;
@@ -222,8 +219,7 @@
  */
 
 static long
-i386_get_frame_setup (pc)
-     CORE_ADDR pc;
+i386_get_frame_setup (CORE_ADDR pc)
 {
   unsigned char op;
 
@@ -374,8 +370,7 @@
    Can return -1, meaning no way to tell.  */
 
 int
-i386_frame_num_args (fi)
-     struct frame_info *fi;
+i386_frame_num_args (struct frame_info *fi)
 {
 #if 1
   return -1;
@@ -476,8 +471,7 @@
  */
 
 void
-i386_frame_init_saved_regs (fip)
-     struct frame_info *fip;
+i386_frame_init_saved_regs (struct frame_info *fip)
 {
   long locals = -1;
   unsigned char op;
@@ -538,8 +532,7 @@
 /* return pc of first real instruction */
 
 int
-i386_skip_prologue (pc)
-     int pc;
+i386_skip_prologue (int pc)
 {
   unsigned char op;
   int i;
@@ -620,7 +613,7 @@
 }
 
 void
-i386_push_dummy_frame ()
+i386_push_dummy_frame (void)
 {
   CORE_ADDR sp = read_register (SP_REGNUM);
   int regnum;
@@ -637,8 +630,28 @@
   write_register (SP_REGNUM, sp);
 }
 
+/* Insert the (relative) function address into the call sequence
+   stored at DYMMY.  */
+
 void
-i386_pop_frame ()
+i386_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
+		     value_ptr *args, struct type *type, int gcc_p)
+{
+  int from, to, delta, loc;
+
+  loc = (int)(read_register (SP_REGNUM) - CALL_DUMMY_LENGTH);
+  from = loc + 5;
+  to = (int)(fun);
+  delta = to - from;
+
+  *((char *)(dummy) + 1) = (delta & 0xff);
+  *((char *)(dummy) + 2) = ((delta >> 8) & 0xff);
+  *((char *)(dummy) + 3) = ((delta >> 16) & 0xff);
+  *((char *)(dummy) + 4) = ((delta >> 24) & 0xff);
+}
+
+void
+i386_pop_frame (void)
 {
   struct frame_info *frame = get_current_frame ();
   CORE_ADDR fp;
@@ -673,8 +686,7 @@
    This routine returns true on success. */
 
 int
-get_longjmp_target (pc)
-     CORE_ADDR *pc;
+get_longjmp_target (CORE_ADDR *pc)
 {
   char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
   CORE_ADDR sp, jb_addr;
@@ -701,7 +713,7 @@
 
 /* These registers are used for returning integers (and on some
    targets also for returning `struct' and `union' values when their
-   size and alignment match an integer type.  */
+   size and alignment match an integer type).  */
 #define LOW_RETURN_REGNUM 0	/* %eax */
 #define HIGH_RETURN_REGNUM 2	/* %edx */
 
@@ -720,6 +732,7 @@
 	{
 	  warning ("Cannot find floating-point return value.");
 	  memset (valbuf, 0, len);
+	  return;
 	}
 
       /* Floating-point return values can be found in %st(0).  */
@@ -762,6 +775,64 @@
     }
 }
 
+/* Write into the appropriate registers a function return value stored
+   in VALBUF of type TYPE, given in virtual format.  */
+
+void
+i386_store_return_value (struct type *type, char *valbuf)
+{
+  int len = TYPE_LENGTH (type);
+
+  if (TYPE_CODE_FLT == TYPE_CODE (type))
+    {
+      if (NUM_FREGS == 0)
+	{
+	  warning ("Cannot set floating-point return value.");
+	  return;
+	}
+
+      /* Floating-point return values can be found in %st(0).  */
+      if (len == TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT
+	  && TARGET_LONG_DOUBLE_FORMAT == &floatformat_i387_ext)
+	{
+	  /* Copy straight over.  */
+	  write_register_bytes (REGISTER_BYTE (FP0_REGNUM), valbuf,
+				FPU_REG_RAW_SIZE);
+	}
+      else
+	{
+	  char buf[FPU_REG_RAW_SIZE];
+	  DOUBLEST val;
+
+	  /* Convert the value found in VALBUF to the extended
+             floating point format used by the FPU.  This is probably
+             not exactly how it would happen on the target itself, but
+             it is the best we can do.  */
+	  val = extract_floating (valbuf, TYPE_LENGTH (type));
+	  floatformat_from_doublest (&floatformat_i387_ext, &val, buf);
+	  write_register_bytes (REGISTER_BYTE (FP0_REGNUM), buf,
+				FPU_REG_RAW_SIZE);
+	}
+    }
+  else
+    {
+      int low_size = REGISTER_RAW_SIZE (LOW_RETURN_REGNUM);
+      int high_size = REGISTER_RAW_SIZE (HIGH_RETURN_REGNUM);
+
+      if (len <= low_size)
+	write_register_bytes (REGISTER_BYTE (LOW_RETURN_REGNUM), valbuf, len);
+      else if (len <= (low_size + high_size))
+	{
+	  write_register_bytes (REGISTER_BYTE (LOW_RETURN_REGNUM),
+				valbuf, low_size);
+	  write_register_bytes (REGISTER_BYTE (HIGH_RETURN_REGNUM),
+				valbuf + low_size, len - low_size);
+	}
+      else
+	internal_error ("Cannot store return value of %d bytes long.", len);
+    }
+}
+
 /* Convert data from raw format for register REGNUM in buffer FROM to
    virtual format with type TYPE in buffer TO.  In principle both
    formats are identical except that the virtual format has two extra
@@ -793,8 +864,7 @@
    for all three variants of SVR4 sigtramps.  */
 
 CORE_ADDR
-i386v4_sigtramp_saved_pc (frame)
-     struct frame_info *frame;
+i386v4_sigtramp_saved_pc (struct frame_info *frame)
 {
   CORE_ADDR saved_pc_offset = 4;
   char *name = NULL;
@@ -822,8 +892,7 @@
    it is done for C too.  */
 
 char *
-sunpro_static_transform_name (name)
-     char *name;
+sunpro_static_transform_name (char *name)
 {
   char *p;
   if (IS_STATIC_TRANSFORM_NAME (name))
@@ -848,9 +917,7 @@
 /* Stuff for WIN32 PE style DLL's but is pretty generic really. */
 
 CORE_ADDR
-skip_trampoline_code (pc, name)
-     CORE_ADDR pc;
-     char *name;
+skip_trampoline_code (CORE_ADDR pc, char *name)
 {
   if (pc && read_memory_unsigned_integer (pc, 2) == 0x25ff)	/* jmp *(dest) */
     {
@@ -870,9 +937,7 @@
 }
 
 static int
-gdb_print_insn_i386 (memaddr, info)
-     bfd_vma memaddr;
-     disassemble_info *info;
+gdb_print_insn_i386 (bfd_vma memaddr, disassemble_info *info)
 {
   if (disassembly_flavor == att_flavor)
     return print_insn_i386_att (memaddr, info);
@@ -888,16 +953,14 @@
    command, and does that.  */
 
 static void
-set_disassembly_flavor_sfunc (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+set_disassembly_flavor_sfunc (char *args, int from_tty,
+			      struct cmd_list_element *c)
 {
   set_disassembly_flavor ();
 }
 
 static void
-set_disassembly_flavor ()
+set_disassembly_flavor (void)
 {
   if (disassembly_flavor == att_flavor)
     set_architecture_from_arch_mach (bfd_arch_i386, bfd_mach_i386_i386);
@@ -907,7 +970,7 @@
 
 
 void
-_initialize_i386_tdep ()
+_initialize_i386_tdep (void)
 {
   /* Initialize the table saying where each register starts in the
      register file.  */
diff --git a/gdb/i386aix-nat.c b/gdb/i386aix-nat.c
index 03154d2..c32f151 100644
--- a/gdb/i386aix-nat.c
+++ b/gdb/i386aix-nat.c
@@ -70,9 +70,7 @@
  */
 
 int
-i386_register_u_addr (blockend, regnum)
-     int blockend;
-     int regnum;
+i386_register_u_addr (int blockend, int regnum)
 {
 #if 0
   /* this will be needed if fp registers are reinstated */
@@ -115,9 +113,7 @@
 };
 
 static
-print_387_status (status, ep)
-     unsigned short status;
-     struct env387 *ep;
+print_387_status (unsigned short status, struct env387 *ep)
 {
   int i;
   int bothstatus;
@@ -183,7 +179,7 @@
 static struct env387 core_env387;
 
 void
-i386_float_info ()
+i386_float_info (void)
 {
   struct env387 fps;
   int fpsaved = 0;
@@ -232,8 +228,7 @@
 
 /* Fetch one register.  */
 static void
-fetch_register (regno)
-     int regno;
+fetch_register (int regno)
 {
   char buf[MAX_REGISTER_RAW_SIZE];
   if (regno < FP0_REGNUM)
@@ -246,8 +241,7 @@
 }
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   if (regno < 0)
     for (regno = 0; regno < NUM_REGS; regno++)
@@ -258,8 +252,7 @@
 
 /* store one register */
 static void
-store_register (regno)
-     int regno;
+store_register (int regno)
 {
   char buf[80];
   errno = 0;
@@ -281,8 +274,7 @@
    If REGNO is -1, do this for all registers.
    Otherwise, REGNO specifies which register (so we can save time).  */
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   if (regno < 0)
     for (regno = 0; regno < NUM_REGS; regno++)
@@ -322,12 +314,21 @@
   CD_DS, CD_ES, CD_FS, CD_GS,
 };
 
+/* Provide registers to GDB from a core file.
+
+   CORE_REG_SECT points to an array of bytes, which were obtained from
+   a core file which BFD thinks might contain register contents. 
+   CORE_REG_SIZE is its size.
+
+   WHICH says which register set corelow suspects this is:
+     0 --- the general-purpose register set
+     2 --- the floating-point register set
+
+   REG_ADDR isn't used.  */
+
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR reg_addr;	/* ignored */
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
+		      int which, CORE_ADDR reg_addr)
 {
 
   if (which == 0)
@@ -366,7 +367,7 @@
 };
 
 void
-_initialize_core_i386aix ()
+_initialize_core_i386aix (void)
 {
   add_core_fns (&i386aix_core_fns);
 }
diff --git a/gdb/i386b-nat.c b/gdb/i386b-nat.c
index dfa0a70..12a27a9 100644
--- a/gdb/i386b-nat.c
+++ b/gdb/i386b-nat.c
@@ -29,8 +29,7 @@
 #include "gdbcore.h" /* for registers_fetched() */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   struct reg inferior_registers;
 
@@ -40,8 +39,7 @@
 }
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   struct reg inferior_registers;
 
@@ -56,11 +54,8 @@
 };
 
 void
-fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR ignore;
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+		      CORE_ADDR ignore)
 {
   struct md_core *core_reg = (struct md_core *) core_reg_sect;
 
@@ -108,9 +103,7 @@
    place where ES is stored.  */
 
 int
-i386_register_u_addr (blockend, regnum)
-     int blockend;
-     int regnum;
+i386_register_u_addr (int blockend, int regnum)
 {
   /* The following condition is a kludge to get at the proper register map
      depending upon the state of pcb_flag.
@@ -174,9 +167,7 @@
   };
 
 static void
-print_387_status (status, ep)
-     unsigned short status;
-     struct env387 *ep;
+print_387_status (unsigned short status, struct env387 *ep)
 {
   int i;
   int bothstatus;
@@ -239,7 +230,7 @@
     }
 }
 
-i386_float_info ()
+i386_float_info (void)
 {
   struct user u;		/* just for address computations */
   int i;
@@ -288,7 +279,7 @@
 }
 
 int
-kernel_u_size ()
+kernel_u_size (void)
 {
   return (sizeof (struct user));
 }
diff --git a/gdb/i386gnu-nat.c b/gdb/i386gnu-nat.c
index 7554d1a..fca14e4 100644
--- a/gdb/i386gnu-nat.c
+++ b/gdb/i386gnu-nat.c
@@ -22,7 +22,7 @@
 #include "inferior.h"
 #include "floatformat.h"
 
-#include <assert.h>
+#include "gdb_assert.h"
 #include <stdio.h>
 #include <errno.h>
 
@@ -321,7 +321,7 @@
 	{
 	  proc_debug (thread, "storing register %s", REGISTER_NAME (regno));
 
-	  assert (register_valid[regno]);
+	  gdb_assert (register_valid[regno]);
 	  fill (state, regno);
 	}
 
diff --git a/gdb/i386ly-tdep.c b/gdb/i386ly-tdep.c
index 1b01121..0122479 100644
--- a/gdb/i386ly-tdep.c
+++ b/gdb/i386ly-tdep.c
@@ -30,8 +30,7 @@
    system calls use a different calling sequence.  */
 
 CORE_ADDR
-i386lynx_saved_pc_after_call (frame)
-     struct frame_info *frame;
+i386lynx_saved_pc_after_call (struct frame_info *frame)
 {
   char opcode[7];
   static const unsigned char call_inst[] =
diff --git a/gdb/i386m3-nat.c b/gdb/i386m3-nat.c
index 61fd384..5f3d130 100644
--- a/gdb/i386m3-nat.c
+++ b/gdb/i386m3-nat.c
@@ -101,8 +101,7 @@
  */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   kern_return_t ret;
   thread_state_data_t state;
@@ -147,8 +146,7 @@
  * On mach3 all registers are always saved in one call.
  */
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   kern_return_t ret;
   thread_state_data_t state;
@@ -221,9 +219,7 @@
  */
 
 CORE_ADDR
-register_addr (regno, blockend)
-     int regno;
-     CORE_ADDR blockend;
+register_addr (int regno, CORE_ADDR blockend)
 {
   CORE_ADDR addr;
 
@@ -261,9 +257,7 @@
  * Should move it to i387-tdep.c but you need to export struct env387
  */
 private
-print_387_status (status, ep)
-     unsigned short status;
-     struct env387 *ep;
+print_387_status (unsigned short status, struct env387 *ep)
 {
   int i;
   int bothstatus;
@@ -358,8 +352,7 @@
 /* Mach 3 specific routines.
  */
 private boolean_t
-get_i387_state (fstate)
-     struct fpstate *fstate;
+get_i387_state (struct fpstate *fstate)
 {
   kern_return_t ret;
   thread_state_data_t state;
@@ -396,8 +389,7 @@
 }
 
 private boolean_t
-get_i387_core_state (fstate)
-     struct fpstate *fstate;
+get_i387_core_state (struct fpstate *fstate)
 {
   /* Not implemented yet. Core files do not contain float state. */
   return FALSE;
@@ -407,7 +399,7 @@
  * This is called by "info float" command
  */
 void
-i386_mach3_float_info ()
+i386_mach3_float_info (void)
 {
   char buf[sizeof (struct fpstate) + 2 * sizeof (int)];
   boolean_t valid = FALSE;
diff --git a/gdb/i386mach-nat.c b/gdb/i386mach-nat.c
index ded044b..1759b0f 100644
--- a/gdb/i386mach-nat.c
+++ b/gdb/i386mach-nat.c
@@ -40,8 +40,7 @@
 static void fetch_core_registers (char *, unsigned, int, CORE_ADDR);
 
 void
-fetch_inferior_registers (regno)
-     int regno;			/* Original value discarded */
+fetch_inferior_registers (int regno)
 {
   struct regs inferior_registers;
   struct fp_state inferior_fp_registers;
@@ -68,8 +67,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   struct regs inferior_registers;
   struct fp_state inferior_fp_registers;
@@ -110,14 +108,21 @@
 
 
 
-/* Work with core files, for GDB. */
+/* Provide registers to GDB from a core file.
+
+   CORE_REG_SECT points to an array of bytes, which were obtained from
+   a core file which BFD thinks might contain register contents. 
+   CORE_REG_SIZE is its size.
+
+   WHICH says which register set corelow suspects this is:
+     0 --- the general-purpose register set
+     2 --- the floating-point register set
+
+   REG_ADDR isn't used.  */
 
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR reg_addr;	/* Unused in this version */
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
+		      int which, CORE_ADDR reg_addr)
 {
   int val;
 
@@ -156,7 +161,7 @@
 };
 
 void
-_initialize_core_i386mach ()
+_initialize_core_i386mach (void)
 {
   add_core_fns (&i386mach_core_fns);
 }
diff --git a/gdb/i386nbsd-nat.c b/gdb/i386nbsd-nat.c
index c1d2cd7..0c069d1 100644
--- a/gdb/i386nbsd-nat.c
+++ b/gdb/i386nbsd-nat.c
@@ -51,8 +51,7 @@
   };
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   struct reg inferior_registers;
   struct env387 inferior_fpregisters;
@@ -101,8 +100,7 @@
 }
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   struct reg inferior_registers;
   struct env387 inferior_fpregisters;
@@ -149,15 +147,6 @@
 	  (PTRACE_ARG3_TYPE) &inferior_fpregisters, 0);
 }
 
-int
-i386nbsd_use_struct_convention (int gcc_p, struct type *type)
-{
-  return !(TYPE_LENGTH (type) == 1
-	   || TYPE_LENGTH (type) == 2
-	   || TYPE_LENGTH (type) == 4
-	   || TYPE_LENGTH (type) == 8);
-}
-
 struct md_core
 {
   struct reg intreg;
@@ -165,11 +154,8 @@
 };
 
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR ignore;
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+		      CORE_ADDR ignore)
 {
   struct md_core *core_reg = (struct md_core *) core_reg_sect;
 
@@ -212,7 +198,7 @@
 };
 
 void
-_initialize_i386nbsd_nat ()
+_initialize_i386nbsd_nat (void)
 {
   add_core_fns (&i386nbsd_core_fns);
 }
diff --git a/gdb/i386nbsd-tdep.c b/gdb/i386nbsd-tdep.c
new file mode 100644
index 0000000..4dfa627
--- /dev/null
+++ b/gdb/i386nbsd-tdep.c
@@ -0,0 +1,40 @@
+/* Target-dependent code for NetBSD/i386, for GDB.
+   Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000
+   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 "gdbtypes.h"
+#if 0
+#include <sys/types.h>
+#include <sys/ptrace.h>
+#include <machine/reg.h>
+#include <machine/frame.h>
+#include "inferior.h"
+#include "gdbcore.h" /* for registers_fetched() */
+#endif
+
+int
+i386nbsd_use_struct_convention (int gcc_p, struct type *type)
+{
+  return !(TYPE_LENGTH (type) == 1
+	   || TYPE_LENGTH (type) == 2
+	   || TYPE_LENGTH (type) == 4
+	   || TYPE_LENGTH (type) == 8);
+}
diff --git a/gdb/i386v-nat.c b/gdb/i386v-nat.c
index 9ae5716..54cf387 100644
--- a/gdb/i386v-nat.c
+++ b/gdb/i386v-nat.c
@@ -87,9 +87,7 @@
  */
 
 int
-i386_register_u_addr (blockend, regnum)
-     int blockend;
-     int regnum;
+i386_register_u_addr (int blockend, int regnum)
 {
   struct user u;
   int fpstate;
@@ -116,7 +114,7 @@
 }
 
 int
-kernel_u_size ()
+kernel_u_size (void)
 {
   return (sizeof (struct user));
 }
@@ -142,22 +140,14 @@
 /* Insert a watchpoint.  */
 
 int
-i386_insert_watchpoint (pid, addr, len, rw)
-     int pid;
-     CORE_ADDR addr;
-     int len;
-     int rw;
+i386_insert_watchpoint (int pid, CORE_ADDR addr, int len, int rw)
 {
   return i386_insert_aligned_watchpoint (pid, addr, addr, len, rw);
 }
 
 static int
-i386_insert_aligned_watchpoint (pid, waddr, addr, len, rw)
-     int pid;
-     CORE_ADDR waddr;
-     CORE_ADDR addr;
-     int len;
-     int rw;
+i386_insert_aligned_watchpoint (int pid, CORE_ADDR waddr, CORE_ADDR addr,
+				int len, int rw)
 {
   int i;
   int read_write_bits, len_bits;
@@ -216,12 +206,8 @@
 }
 
 static int
-i386_insert_nonaligned_watchpoint (pid, waddr, addr, len, rw)
-     int pid;
-     CORE_ADDR waddr;
-     CORE_ADDR addr;
-     int len;
-     int rw;
+i386_insert_nonaligned_watchpoint (int pid, CORE_ADDR waddr, CORE_ADDR addr,
+				   int len, int rw)
 {
   int align;
   int size;
@@ -257,10 +243,7 @@
 /* Remove a watchpoint.  */
 
 int
-i386_remove_watchpoint (pid, addr, len)
-     int pid;
-     CORE_ADDR addr;
-     int len;
+i386_remove_watchpoint (int pid, CORE_ADDR addr, int len)
 {
   int i;
   int register_number;
@@ -285,8 +268,7 @@
 /* Check if stopped by a watchpoint.  */
 
 CORE_ADDR
-i386_stopped_by_watchpoint (pid)
-     int pid;
+i386_stopped_by_watchpoint (int pid)
 {
   int i;
   int status;
diff --git a/gdb/i386v4-nat.c b/gdb/i386v4-nat.c
index a266423..9750647 100644
--- a/gdb/i386v4-nat.c
+++ b/gdb/i386v4-nat.c
@@ -112,8 +112,7 @@
    register values. */
 
 void
-supply_gregset (gregsetp)
-     gregset_t *gregsetp;
+supply_gregset (gregset_t *gregsetp)
 {
   register int regi;
   register greg_t *regp = (greg_t *) gregsetp;
@@ -126,9 +125,7 @@
 }
 
 void
-fill_gregset (gregsetp, regno)
-     gregset_t *gregsetp;
-     int regno;
+fill_gregset (gregset_t *gregsetp, int regno)
 {
   int regi;
   register greg_t *regp = (greg_t *) gregsetp;
@@ -176,8 +173,7 @@
 };
 
 void
-supply_fpregset (fpregsetp)
-     fpregset_t *fpregsetp;
+supply_fpregset (fpregset_t *fpregsetp)
 {
   int regi;
   
@@ -212,9 +208,7 @@
    them all. */
 
 void
-fill_fpregset (fpregsetp, regno)
-     fpregset_t *fpregsetp;
-     int regno;
+fill_fpregset (fpregset_t *fpregsetp, int regno)
 {
   int regi;
 
diff --git a/gdb/i387-nat.c b/gdb/i387-nat.c
index 17e67b4..7698608 100644
--- a/gdb/i387-nat.c
+++ b/gdb/i387-nat.c
@@ -1,5 +1,5 @@
 /* Native-dependent code for the i387.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -71,7 +71,7 @@
       if (i >= FIRST_FPU_CTRL_REGNUM
 	  && i != FCOFF_REGNUM && i != FDOFF_REGNUM)
 	{
-	  unsigned val = *(unsigned short *) (FSAVE_ADDR (fsave, i));
+	  unsigned int val = *(unsigned short *) (FSAVE_ADDR (fsave, i));
 
 	  if (i == FOP_REGNUM)
 	    {
@@ -123,3 +123,210 @@
 		  REGISTER_RAW_SIZE (i));
       }
 }
+
+
+/* At fxsave_offset[REGNO] you'll find the offset to the location in
+   the data structure used by the "fxsave" instruction where GDB
+   register REGNO is stored.  */
+
+static int fxsave_offset[] =
+{
+  32,				/* FP0_REGNUM through ...  */
+  48,
+  64,
+  80,
+  96,
+  112,
+  128,
+  144,				/* ... FP7_REGNUM (80 bits each).  */
+  0,				/* FCTRL_REGNUM (16 bits).  */
+  2,				/* FSTAT_REGNUM (16 bits).  */
+  4,				/* FTAG_REGNUM (16 bits).  */
+  12,				/* FCS_REGNUM (16 bits).  */
+  8,				/* FCOFF_REGNUM.  */
+  20,				/* FDS_REGNUM (16 bits).  */
+  16,				/* FDOFF_REGNUM.  */
+  6,				/* FOP_REGNUM (bottom 11 bits).  */
+  160,				/* XMM0_REGNUM through ...  */
+  176,
+  192,
+  208,
+  224,
+  240,
+  256,
+  272,				/* ... XMM7_REGNUM (128 bits each).  */
+  24,				/* MXCSR_REGNUM.  */
+};
+
+#define FXSAVE_ADDR(fxsave, regnum) \
+  (fxsave + fxsave_offset[regnum - FP0_REGNUM])
+
+static int i387_tag (unsigned char *raw);
+
+
+/* Fill GDB's register array with the floating-point and SSE register
+   values in *FXSAVE.  This function masks off any of the reserved
+   bits in *FXSAVE.  */
+
+void
+i387_supply_fxsave (char *fxsave)
+{
+  int i;
+
+  for (i = FP0_REGNUM; i <= MXCSR_REGNUM; i++)
+    {
+      /* Most of the FPU control registers occupy only 16 bits in
+	 the fxsave area.  Give those a special treatment.  */
+      if (i >= FIRST_FPU_CTRL_REGNUM && i < XMM0_REGNUM
+	  && i != FCOFF_REGNUM && i != FDOFF_REGNUM)
+	{
+	  unsigned long val = *(unsigned short *) (FXSAVE_ADDR (fxsave, i));
+
+	  if (i == FOP_REGNUM)
+	    {
+	      val &= ((1 << 11) - 1);
+	      supply_register (i, (char *) &val);
+	    }
+	  else if (i== FTAG_REGNUM)
+	    {
+	      /* The fxsave area contains a simplified version of the
+                 tag word.  We have to look at the actual 80-bit FP
+                 data to recreate the traditional i387 tag word.  */
+
+	      unsigned long ftag = 0;
+	      unsigned long fstat;
+	      int fpreg;
+	      int top;
+
+	      fstat = *(unsigned short *) (FXSAVE_ADDR (fxsave, FSTAT_REGNUM));
+	      top = ((fstat >> 11) & 0x111);
+
+	      for (fpreg = 7; fpreg >= 0; fpreg--)
+		{
+		  int tag = 0x11;
+
+		  if (val & (1 << fpreg))
+		    {
+		      int regnum = (fpreg + 8 - top) % 8 + FP0_REGNUM;
+		      tag = i387_tag (FXSAVE_ADDR (fxsave, regnum));
+		    }
+
+		  ftag |= tag << (2 * fpreg);
+		}
+	      supply_register (i, (char *) &ftag);
+	    }
+	  else
+	    supply_register (i, (char *) &val);
+	}
+      else
+	supply_register (i, FXSAVE_ADDR (fxsave, i));
+    }
+}
+
+/* Fill register REGNO (if it is a floating-point or SSE register) in
+   *FXSAVE with the value in GDB's register array.  If REGNO is -1, do
+   this for all registers.  This function doesn't touch any of the
+   reserved bits in *FXSAVE.  */
+
+void
+i387_fill_fxsave (char *fxsave, int regno)
+{
+  int i;
+
+  for (i = FP0_REGNUM; i <= MXCSR_REGNUM; i++)
+    if (regno == -1 || regno == i)
+      {
+	/* Most of the FPU control registers occupy only 16 bits in
+           the fxsave area.  Give those a special treatment.  */
+	if (i >= FIRST_FPU_CTRL_REGNUM && i < XMM0_REGNUM
+	    && i != FCOFF_REGNUM && i != FDOFF_REGNUM)
+	  {
+	    if (i == FOP_REGNUM)
+	      {
+		unsigned short oldval, newval;
+
+		/* The opcode occupies only 11 bits.  */
+		oldval = (*(unsigned short *) (FXSAVE_ADDR (fxsave, i)));
+		newval = *(unsigned short *) &registers[REGISTER_BYTE (i)];
+		newval &= ((1 << 11) - 1);
+		newval |= oldval & ~((1 << 11) - 1);
+		memcpy (FXSAVE_ADDR (fxsave, i), &newval, 2);
+	      }
+	    else if (i == FTAG_REGNUM)
+	      {
+		/* Converting back is much easier.  */
+
+		unsigned char val = 0;
+		unsigned short ftag;
+		int fpreg;
+
+		ftag = *(unsigned short *) &registers[REGISTER_BYTE (i)];
+
+		for (fpreg = 7; fpreg >= 0; fpreg--)
+		  {
+		    int tag = (ftag >> (fpreg * 2)) & 0x11;
+
+		    if (tag != 0x11)
+		      val |= (1 << fpreg);
+		  }
+
+		memcpy (FXSAVE_ADDR (fxsave, i), &val, 2);
+	      }
+	    else
+	      memcpy (FXSAVE_ADDR (fxsave, i),
+		      &registers[REGISTER_BYTE (i)], 2);
+	  }
+	else
+	  memcpy (FXSAVE_ADDR (fxsave, i), &registers[REGISTER_BYTE (i)],
+		  REGISTER_RAW_SIZE (i));
+      }
+}
+
+/* Recreate the FTW (tag word) valid bits from the 80-bit FP data in
+   *RAW.  */
+
+static int
+i387_tag (unsigned char *raw)
+{
+  int integer;
+  unsigned int exponent;
+  unsigned long fraction[2];
+
+  integer = raw[7] & 0x80;
+  exponent = (((raw[9] & 0x7f) << 8) | raw[8]);
+  fraction[0] = ((raw[3] << 24) | (raw[2] << 16) | (raw[1] << 8) | raw[0]);
+  fraction[1] = (((raw[7] & 0x7f) << 24) | (raw[6] << 16)
+		 | (raw[5] << 8) | raw[4]);
+
+  if (exponent == 0x7fff)
+    {
+      /* Special.  */
+      return (0x10);
+    }
+  else if (exponent == 0x0000)
+    {
+      if (integer)
+	{
+	  /* Valid.  */
+	  return (0x00);
+	}
+      else
+	{
+	  /* Special.  */
+	  return (0x10);
+	}
+    }
+  else
+    {
+      if (fraction[0] == 0x0000 && fraction[1] == 0x0000 && !integer)
+	{
+	  /* Zero.  */
+	  return (0x01);
+	}
+      else
+	{
+	  /* Special.  */
+	  return (0x10);
+	}
+    }
+}
diff --git a/gdb/i387-nat.h b/gdb/i387-nat.h
index c23c267..85efc8e 100644
--- a/gdb/i387-nat.h
+++ b/gdb/i387-nat.h
@@ -1,5 +1,5 @@
 /* Native-dependent code for the i387.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -25,13 +25,26 @@
    in *FSAVE.  This function masks off any of the reserved
    bits in *FSAVE.  */
 
-void i387_supply_fsave (char *fsave);
+extern void i387_supply_fsave (char *fsave);
 
 /* Fill register REGNO (if it is a floating-point register) in *FSAVE
    with the value in GDB's register array.  If REGNO is -1, do this
    for all registers.  This function doesn't touch any of the reserved
    bits in *FSAVE.  */
 
-void i387_fill_fsave (char *fsave, int regno);
+extern void i387_fill_fsave (char *fsave, int regno);
+
+/* Fill GDB's register array with the floating-point and SSE register
+   values in *FXSAVE.  This function masks off any of the reserved
+   bits in *FXSAVE.  */
+
+extern void i387_supply_fxsave (char *fxsave);
+
+/* Fill register REGNO (if it is a floating-point or SSE register) in
+   *FXSAVE with the value in GDB's register array.  If REGNO is -1, do
+   this for all registers.  This function doesn't touch any of the
+   reserved bits in *FXSAVE.  */
+
+extern void i387_fill_fxsave (char *fxsave, int regno);
 
 #endif /* i387-nat.h */
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index 4f180fa..88b65a4 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -34,17 +34,13 @@
 void double_to_i387 (char *from, char *to);
 
 void
-i387_to_double (from, to)
-     char *from;
-     char *to;
+i387_to_double (char *from, char *to)
 {
   floatformat_to_double (&floatformat_i387_ext, from, (double *) to);
 }
 
 void
-double_to_i387 (from, to)
-     char *from;
-     char *to;
+double_to_i387 (char *from, char *to)
 {
   floatformat_from_double (&floatformat_i387_ext, (double *) from, to);
 }
@@ -60,8 +56,7 @@
 static void print_387_status_bits (unsigned int status);
 
 static void
-print_387_control_bits (control)
-     unsigned int control;
+print_387_control_bits (unsigned int control)
 {
   switch ((control >> 8) & 3)
     {
@@ -117,8 +112,7 @@
 }
 
 void
-print_387_control_word (control)
-     unsigned int control;
+print_387_control_word (unsigned int control)
 {
   printf_filtered ("control %s:", local_hex_string(control & 0xffff));
   print_387_control_bits (control);
@@ -126,8 +120,7 @@
 }
 
 static void
-print_387_status_bits (status)
-     unsigned int status;
+print_387_status_bits (unsigned int status)
 {
   printf_unfiltered (" flags %d%d%d%d; ",
 		     (status & 0x4000) != 0,
@@ -149,8 +142,7 @@
 }
 
 void
-print_387_status_word (status)
-     unsigned int status;
+print_387_status_word (unsigned int status)
 {
   printf_filtered ("status %s:", local_hex_string (status & 0xffff));
   print_387_status_bits (status);
diff --git a/gdb/i960-tdep.c b/gdb/i960-tdep.c
index f7aab5f..21eb754 100644
--- a/gdb/i960-tdep.c
+++ b/gdb/i960-tdep.c
@@ -47,9 +47,7 @@
    If it's more than 16 bytes long, g13 pointed to it on entry.  */
 
 int
-i960_use_struct_convention (gcc_p, type)
-     int gcc_p;
-     struct type *type;
+i960_use_struct_convention (int gcc_p, struct type *type)
 {
   return (TYPE_LENGTH (type) > 16);
 }
@@ -58,7 +56,7 @@
    This routine must be called as part of gdb initialization.  */
 
 static void
-check_host ()
+check_host (void)
 {
   int i;
 
@@ -170,11 +168,8 @@
   (((addr) < (lim)) ? next_insn (addr, pword1, pword2) : 0)
 
 static CORE_ADDR
-examine_prologue (ip, limit, frame_addr, fsr)
-     register CORE_ADDR ip;
-     register CORE_ADDR limit;
-     CORE_ADDR frame_addr;
-     struct frame_saved_regs *fsr;
+examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit,
+		  CORE_ADDR frame_addr, struct frame_saved_regs *fsr)
 {
   register CORE_ADDR next_ip;
   register int src, dst;
@@ -336,8 +331,7 @@
    prologue.  */
 
 CORE_ADDR
-i960_skip_prologue (ip)
-CORE_ADDR (ip);
+i960_skip_prologue (CORE_ADDR ip)
 {
   struct frame_saved_regs saved_regs_dummy;
   struct symtab_and_line sal;
@@ -359,9 +353,7 @@
    fairly expensive.  */
 
 void
-frame_find_saved_regs (fi, fsr)
-     struct frame_info *fi;
-     struct frame_saved_regs *fsr;
+frame_find_saved_regs (struct frame_info *fi, struct frame_saved_regs *fsr)
 {
   register CORE_ADDR next_addr;
   register CORE_ADDR *saved_regs;
@@ -427,8 +419,7 @@
    described by FI.  Returns 0 if the address is unknown.  */
 
 CORE_ADDR
-frame_args_address (fi, must_be_correct)
-     struct frame_info *fi;
+frame_args_address (struct frame_info *fi, int must_be_correct)
 {
   struct frame_saved_regs fsr;
   CORE_ADDR ap;
@@ -459,8 +450,7 @@
    described by FI.  Returns 0 if the address is unknown.  */
 
 CORE_ADDR
-frame_struct_result_address (fi)
-     struct frame_info *fi;
+frame_struct_result_address (struct frame_info *fi)
 {
   struct frame_saved_regs fsr;
   CORE_ADDR ap;
@@ -488,9 +478,11 @@
 }
 
 /* Return address to which the currently executing leafproc will return,
-   or 0 if ip is not in a leafproc (or if we can't tell if it is).
+   or 0 if IP, the value of the instruction pointer from the currently
+   executing function, is not in a leafproc (or if we can't tell if it
+   is).
 
-   Do this by finding the starting address of the routine in which ip lies.
+   Do this by finding the starting address of the routine in which IP lies.
    If the instruction there is "mov g14, gx" (where x is in [0,7]), this
    is a leafproc and the return address is in register gx.  Well, this is
    true unless the return address points at a RET instruction in the current
@@ -498,8 +490,7 @@
    has been entered through the CALL entry point.  */
 
 CORE_ADDR
-leafproc_return (ip)
-     CORE_ADDR ip;		/* ip from currently executing function */
+leafproc_return (CORE_ADDR ip)
 {
   register struct minimal_symbol *msymbol;
   char *p;
@@ -551,8 +542,7 @@
    unless the function is a leaf procedure.  */
 
 CORE_ADDR
-saved_pc_after_call (frame)
-     struct frame_info *frame;
+saved_pc_after_call (struct frame_info *frame)
 {
   CORE_ADDR saved_pc;
 
@@ -620,8 +610,7 @@
    corresponds.  */
 
 enum target_signal
-i960_fault_to_signal (fault)
-     int fault;
+i960_fault_to_signal (int fault)
 {
   switch (fault)
     {
@@ -695,12 +684,13 @@
   char numops;
 };
 
-static int			/* returns instruction length: 4 or 8 */
-mem (memaddr, word1, word2, noprint)
-     unsigned long memaddr;
-     unsigned long word1, word2;
-     int noprint;		/* If TRUE, return instruction length, but
-				   don't output any text.  */
+/* Return instruction length, either 4 or 8.  When NOPRINT is non-zero
+   (TRUE), don't output any text.  (Actually, as implemented, if NOPRINT
+   is 0, abort() is called.) */
+
+static int
+mem (unsigned long memaddr, unsigned long word1, unsigned long word2,
+     int noprint)
 {
   int i, j;
   int len;
@@ -794,9 +784,7 @@
    'pword2'.  */
 
 static CORE_ADDR
-next_insn (memaddr, pword1, pword2)
-     unsigned int *pword1, *pword2;
-     CORE_ADDR memaddr;
+next_insn (CORE_ADDR memaddr, unsigned int *pword1, unsigned int *pword2)
 {
   int len;
   char buf[8];
@@ -852,9 +840,7 @@
    they display this frame.  */
 
 int
-mon960_frame_chain_valid (chain, curframe)
-     CORE_ADDR chain;
-     struct frame_info *curframe;
+mon960_frame_chain_valid (CORE_ADDR chain, struct frame_info *curframe)
 {
   struct symbol *sym;
   struct minimal_symbol *msymbol;
@@ -898,7 +884,7 @@
 
 
 void
-_initialize_i960_tdep ()
+_initialize_i960_tdep (void)
 {
   check_host ();
 
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index 339c58b..bd07c3b 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -236,7 +236,7 @@
     PT_PR,
     PT_CR_IIP,	/* ip */
     PT_CR_IPSR, /* psr */
-    PT_CR_IFS,	/* cfm */
+    PT_CFM,	/* cfm */
     /* kernel registers not visible via ptrace interface (?) */
     -1, -1, -1, -1, -1, -1, -1, -1,
     /* hole */
@@ -296,9 +296,7 @@
   };
 
 CORE_ADDR
-register_addr (regno, blockend)
-     int regno;
-     CORE_ADDR blockend;
+register_addr (int regno, CORE_ADDR blockend)
 {
   CORE_ADDR addr;
 
@@ -356,8 +354,7 @@
 }
 
 void
-supply_gregset (gregsetp)
-     gregset_t *gregsetp;
+supply_gregset (gregset_t *gregsetp)
 {
   int regi;
   greg_t *regp = (greg_t *) gregsetp;
@@ -393,9 +390,7 @@
 }
 
 void
-fill_gregset (gregsetp, regno)
-     gregset_t *gregsetp;
-     int regno;
+fill_gregset (gregset_t *gregsetp, int regno)
 {
   int regi;
   greg_t *regp = (greg_t *) gregsetp;
@@ -439,8 +434,7 @@
    idea of the current floating point register values. */
 
 void
-supply_fpregset (fpregsetp)
-     fpregset_t *fpregsetp;
+supply_fpregset (fpregset_t *fpregsetp)
 {
   register int regi;
   char *from;
@@ -458,9 +452,7 @@
    them all. */
 
 void
-fill_fpregset (fpregsetp, regno)
-     fpregset_t *fpregsetp;
-     int regno;
+fill_fpregset (fpregset_t *fpregsetp, int regno)
 {
   int regi;
   char *to;
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index e220e27..dbda2ef 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -30,6 +30,19 @@
 #include "elf/common.h"		/* for DT_PLTGOT value */
 #include "elf-bfd.h"
 
+/* Hook for determining the global pointer when calling functions in
+   the inferior under AIX.  The initialization code in ia64-aix-nat.c
+   sets this hook to the address of a function which will find the
+   global pointer for a given address.  
+   
+   The generic code which uses the dynamic section in the inferior for
+   finding the global pointer is not of much use on AIX since the
+   values obtained from the inferior have not been relocated.  */
+
+CORE_ADDR (*native_find_global_pointer) (CORE_ADDR) = 0;
+
+/* An enumeration of the different IA-64 instruction types.  */
+
 typedef enum instruction_type
 {
   A,			/* Integer ALU ;    I-unit or M-unit */
@@ -213,15 +226,19 @@
 struct gdbarch_tdep
   {
     int os_ident;	/* From the ELF header, one of the ELFOSABI_
-                           constants: ELFOSABI_LINUX, ELFOSABI_MONTEREY,
+                           constants: ELFOSABI_LINUX, ELFOSABI_AIX,
 			   etc. */
     CORE_ADDR (*sigcontext_register_address) (CORE_ADDR, int);
     			/* OS specific function which, given a frame address
 			   and register number, returns the offset to the
 			   given register from the start of the frame. */
+    CORE_ADDR (*find_global_pointer) (CORE_ADDR);
   };
 
-#define SIGCONTEXT_REGISTER_ADDRESS (gdbarch_tdep (current_gdbarch)->sigcontext_register_address)
+#define SIGCONTEXT_REGISTER_ADDRESS \
+  (gdbarch_tdep (current_gdbarch)->sigcontext_register_address)
+#define FIND_GLOBAL_POINTER \
+  (gdbarch_tdep (current_gdbarch)->find_global_pointer)
 
 static char *
 ia64_register_name (int reg)
@@ -564,9 +581,7 @@
 /* We don't really want to use this, but remote.c needs to call it in order
    to figure out if Z-packets are supported or not.  Oh, well. */
 unsigned char *
-ia64_breakpoint_from_pc (pcptr, lenptr)
-     CORE_ADDR *pcptr;
-     int *lenptr;
+ia64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
 {
   static unsigned char breakpoint[] =
     { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
@@ -986,6 +1001,13 @@
   if (do_fsr_stuff) {
     int i;
     CORE_ADDR addr;
+    int sor, rrb_gr;
+    
+    /* Extract the size of the rotating portion of the stack
+       frame and the register rename base from the current
+       frame marker. */
+    sor = ((frame->extra_info->cfm >> 14) & 0xf) * 8;
+    rrb_gr = (frame->extra_info->cfm >> 18) & 0x7f;
 
     for (i = 0, addr = frame->extra_info->bsp;
 	 i < frame->extra_info->sof;
@@ -995,7 +1017,11 @@
 	  {
 	    addr += 8;
 	  }
-	frame->saved_regs[IA64_GR32_REGNUM + i] = addr;
+	if (i < sor)
+	  frame->saved_regs[IA64_GR32_REGNUM + ((i + (sor - rrb_gr)) % sor)] 
+	    = addr;
+	else
+	  frame->saved_regs[IA64_GR32_REGNUM + i] = addr;
 
 	if (i+32 == cfm_reg)
 	  frame->saved_regs[IA64_CFM_REGNUM] = addr;
@@ -1127,6 +1153,16 @@
       int prN_val;
       ia64_get_saved_register (pr_raw_buffer, &pr_optim, &pr_addr,
                                frame, IA64_PR_REGNUM, &pr_lval);
+      if (IA64_PR16_REGNUM <= regnum && regnum <= IA64_PR63_REGNUM)
+	{
+	  /* Fetch predicate register rename base from current frame
+	     marker for this frame. */
+	  int rrb_pr = (frame->extra_info->cfm >> 32) & 0x3f;
+
+	  /* Adjust the register number to account for register rotation. */
+	  regnum = IA64_PR16_REGNUM 
+	         + ((regnum - IA64_PR16_REGNUM) + rrb_pr) % 48;
+	}
       prN_val = extract_bit_field ((unsigned char *) pr_raw_buffer,
                                    regnum - IA64_PR0_REGNUM, 1);
       store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), prN_val);
@@ -1217,6 +1253,18 @@
     }
   else
     {
+      if (IA64_FR32_REGNUM <= regnum && regnum <= IA64_FR127_REGNUM)
+	{
+	  /* Fetch floating point register rename base from current
+	     frame marker for this frame. */
+	  int rrb_fr = (frame->extra_info->cfm >> 25) & 0x7f;
+
+	  /* Adjust the floating point register number to account for
+	     register rotation. */
+	  regnum = IA64_FR32_REGNUM
+	         + ((regnum - IA64_FR32_REGNUM) + rrb_fr) % 96;
+	}
+
       generic_get_saved_register (raw_buffer, optimized, addrp, frame,
                                   regnum, lval);
     }
@@ -1439,7 +1487,7 @@
    d_un.d_ptr value is the global pointer.  */
 
 static CORE_ADDR
-find_global_pointer (CORE_ADDR faddr)
+generic_elf_find_global_pointer (CORE_ADDR faddr)
 {
   struct obj_section *faddr_sect;
      
@@ -1560,7 +1608,7 @@
       fdesc = *fdaptr;
       *fdaptr += 16;
 
-      global_pointer = find_global_pointer (faddr);
+      global_pointer = FIND_GLOBAL_POINTER (faddr);
 
       if (global_pointer == 0)
 	global_pointer = read_register (IA64_GR1_REGNUM);
@@ -1741,7 +1789,7 @@
 CORE_ADDR
 ia64_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
 {
-  CORE_ADDR global_pointer = find_global_pointer (pc);
+  CORE_ADDR global_pointer = FIND_GLOBAL_POINTER (pc);
 
   if (global_pointer != 0)
     write_register (IA64_GR1_REGNUM, global_pointer);
@@ -1867,14 +1915,12 @@
 	    case 0 :
 	      *os_ident_ptr = ELFOSABI_LINUX;
 	      break;
-#if 0	/* FIXME: Enable after internal repository is synced with sourceware */
 	    case 1 :
 	      *os_ident_ptr = ELFOSABI_HURD;
 	      break;
 	    case 2 :
 	      *os_ident_ptr = ELFOSABI_SOLARIS;
 	      break;
-#endif
 	    default :
 	      internal_error (
 		"process_note_abi_sections: unknown OS number %d", os_number);
@@ -1928,6 +1974,19 @@
   else
     tdep->sigcontext_register_address = 0;
 
+  /* We know that Linux won't have to resort to the native_find_global_pointer
+     hackery.  But that's the only one we know about so far, so if
+     native_find_global_pointer is set to something non-zero, then use
+     it.  Otherwise fall back to using generic_elf_find_global_pointer.  
+     This arrangement should (in theory) allow us to cross debug Linux
+     binaries from an AIX machine.  */
+  if (os_ident == ELFOSABI_LINUX)
+    tdep->find_global_pointer = generic_elf_find_global_pointer;
+  else if (native_find_global_pointer != 0)
+    tdep->find_global_pointer = native_find_global_pointer;
+  else
+    tdep->find_global_pointer = generic_elf_find_global_pointer;
+
   set_gdbarch_short_bit (gdbarch, 16);
   set_gdbarch_int_bit (gdbarch, 32);
   set_gdbarch_long_bit (gdbarch, 64);
@@ -1941,6 +2000,7 @@
   set_gdbarch_sp_regnum (gdbarch, sp_regnum);
   set_gdbarch_fp_regnum (gdbarch, fp_regnum);
   set_gdbarch_pc_regnum (gdbarch, pc_regnum);
+  set_gdbarch_fp0_regnum (gdbarch, IA64_FR0_REGNUM);
 
   set_gdbarch_register_name (gdbarch, ia64_register_name);
   set_gdbarch_register_size (gdbarch, 8);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index f00b0e3..fb788f8 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -72,10 +72,6 @@
 
 static void interrupt_target_command (char *args, int from_tty);
 
-#if !defined (DO_REGISTERS_INFO)
-static void do_registers_info (int, int);
-#endif
-
 static void unset_environment_command (char *, int);
 
 static void set_environment_command (char *, int);
@@ -182,11 +178,7 @@
 
 CORE_ADDR step_sp;
 
-/* 1 means step over all subroutine calls.
-   0 means don't step over calls (used by stepi).
-   -1 means step over calls to undebuggable functions.  */
-
-int step_over_calls;
+enum step_over_calls_kind step_over_calls;
 
 /* If stepping, nonzero means step count is > 1
    so don't print frame next time inferior stops
@@ -205,8 +197,7 @@
    of a command. If it has, it removes it and returns 1. Otherwise it
    does nothing and returns 0. */
 static int
-strip_bg_char (args)
-     char **args;
+strip_bg_char (char **args)
 {
   char *p = NULL;
 
@@ -233,9 +224,7 @@
 
 /* ARGSUSED */
 void
-tty_command (file, from_tty)
-     char *file;
-     int from_tty;
+tty_command (char *file, int from_tty)
 {
   if (file == 0)
     error_no_arg ("terminal name for running target process");
@@ -244,9 +233,7 @@
 }
 
 static void
-run_command (args, from_tty)
-     char *args;
-     int from_tty;
+run_command (char *args, int from_tty)
 {
   char *exec_file;
 
@@ -313,7 +300,7 @@
       if (args)
 	{
 	  cmd = concat ("set args ", args, NULL);
-	  make_cleanup (free, cmd);
+	  make_cleanup (xfree, cmd);
 	  execute_command (cmd, from_tty);
 	}
     }
@@ -346,9 +333,7 @@
 
 
 static void
-run_no_args_command (args, from_tty)
-     char *args;
-     int from_tty;
+run_no_args_command (char *args, int from_tty)
 {
   execute_command ("set args", from_tty);
   run_command ((char *) NULL, from_tty);
@@ -356,9 +341,7 @@
 
 
 void
-continue_command (proc_count_exp, from_tty)
-     char *proc_count_exp;
-     int from_tty;
+continue_command (char *proc_count_exp, int from_tty)
 {
   int async_exec = 0;
   ERROR_NO_INFERIOR;
@@ -394,7 +377,7 @@
       while (num != 0)
 	{
 	  set_ignore_count (num,
-			    parse_and_eval_address (proc_count_exp) - 1,
+			    parse_and_eval_long (proc_count_exp) - 1,
 			    from_tty);
 	  /* set_ignore_count prints a message ending with a period.
 	     So print two spaces before "Continuing.".  */
@@ -416,9 +399,7 @@
 
 /* ARGSUSED */
 static void
-step_command (count_string, from_tty)
-     char *count_string;
-     int from_tty;
+step_command (char *count_string, int from_tty)
 {
   step_1 (0, 0, count_string);
 }
@@ -427,9 +408,7 @@
 
 /* ARGSUSED */
 static void
-next_command (count_string, from_tty)
-     char *count_string;
-     int from_tty;
+next_command (char *count_string, int from_tty)
 {
   step_1 (1, 0, count_string);
 }
@@ -438,18 +417,14 @@
 
 /* ARGSUSED */
 void
-stepi_command (count_string, from_tty)
-     char *count_string;
-     int from_tty;
+stepi_command (char *count_string, int from_tty)
 {
   step_1 (0, 1, count_string);
 }
 
 /* ARGSUSED */
 void
-nexti_command (count_string, from_tty)
-     char *count_string;
-     int from_tty;
+nexti_command (char *count_string, int from_tty)
 {
   step_1 (1, 1, count_string);
 }
@@ -461,10 +436,7 @@
 }
 
 static void
-step_1 (skip_subroutines, single_inst, count_string)
-     int skip_subroutines;
-     int single_inst;
-     char *count_string;
+step_1 (int skip_subroutines, int single_inst, char *count_string)
 {
   register int count = 1;
   struct frame_info *frame;
@@ -489,7 +461,7 @@
       async_disable_stdin ();
     }
 
-  count = count_string ? parse_and_eval_address (count_string) : 1;
+  count = count_string ? parse_and_eval_long (count_string) : 1;
 
   if (!single_inst || skip_subroutines)		/* leave si command alone */
     {
@@ -537,11 +509,11 @@
 		/* It is stepi.
 		   Don't step over function calls, not even to functions lacking
 		   line numbers.  */
-		step_over_calls = 0;
+		step_over_calls = STEP_OVER_NONE;
 	    }
 
 	  if (skip_subroutines)
-	    step_over_calls = 1;
+	    step_over_calls = STEP_OVER_ALL;
 
 	  step_multi = (count > 1);
 	  proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
@@ -578,8 +550,7 @@
    proceed(), via step_once(). Basically it is like step_once and
    step_1_continuation are co-recursive. */
 static void
-step_1_continuation (arg)
-     struct continuation_arg *arg;
+step_1_continuation (struct continuation_arg *arg)
 {
   int count;
   int skip_subroutines;
@@ -632,7 +603,13 @@
       if (!single_inst)
 	{
 	  find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
-	  if (step_range_end == 0)
+
+	  /* If we have no line info, switch to stepi mode.  */
+	  if (step_range_end == 0 && step_stop_if_no_debug)
+	    {
+	      step_range_start = step_range_end = 1;
+	    }
+	  else if (step_range_end == 0)
 	    {
 	      char *name;
 	      if (find_pc_partial_function (stop_pc, &name, &step_range_start,
@@ -653,11 +630,11 @@
 	    /* It is stepi.
 	       Don't step over function calls, not even to functions lacking
 	       line numbers.  */
-	    step_over_calls = 0;
+	    step_over_calls = STEP_OVER_NONE;
 	}
 
       if (skip_subroutines)
-	step_over_calls = 1;
+	step_over_calls = STEP_OVER_ALL;
 
       step_multi = (count > 1);
       arg1 =
@@ -681,9 +658,7 @@
 /* Continue program at specified address.  */
 
 static void
-jump_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+jump_command (char *arg, int from_tty)
 {
   register CORE_ADDR addr;
   struct symtabs_and_lines sals;
@@ -721,7 +696,7 @@
     }
 
   sal = sals.sals[0];
-  free ((PTR) sals.sals);
+  xfree (sals.sals);
 
   if (sal.symtab == 0 && sal.pc == 0)
     error ("No source file has been specified.");
@@ -771,9 +746,7 @@
 
 /* Go to line or address in current procedure */
 static void
-go_command (line_no, from_tty)
-     char *line_no;
-     int from_tty;
+go_command (char *line_no, int from_tty)
 {
   if (line_no == (char *) NULL || !*line_no)
     printf_filtered (GO_USAGE);
@@ -788,9 +761,7 @@
 /* Continue program giving it specified signal.  */
 
 static void
-signal_command (signum_exp, from_tty)
-     char *signum_exp;
-     int from_tty;
+signal_command (char *signum_exp, int from_tty)
 {
   enum target_signal oursig;
 
@@ -808,7 +779,7 @@
   if (oursig == TARGET_SIGNAL_UNKNOWN)
     {
       /* No, try numeric.  */
-      int num = parse_and_eval_address (signum_exp);
+      int num = parse_and_eval_long (signum_exp);
 
       if (num == 0)
 	oursig = TARGET_SIGNAL_0;
@@ -837,8 +808,7 @@
    pointed to by arg (which is really a bpstat *).  */
 
 static void
-breakpoint_auto_delete_contents (arg)
-     PTR arg;
+breakpoint_auto_delete_contents (PTR arg)
 {
   breakpoint_auto_delete (*(bpstat *) arg);
 }
@@ -866,9 +836,7 @@
    will eventually be popped when we do hit the dummy end breakpoint).  */
 
 int
-run_stack_dummy (addr, buffer)
-     CORE_ADDR addr;
-     char *buffer;
+run_stack_dummy (CORE_ADDR addr, char *buffer)
 {
   struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0);
   int saved_async = 0;
@@ -956,8 +924,7 @@
 
 /* ARGSUSED */
 static void
-until_next_command (from_tty)
-     int from_tty;
+until_next_command (int from_tty)
 {
   struct frame_info *frame;
   CORE_ADDR pc;
@@ -993,7 +960,7 @@
       step_range_end = sal.end;
     }
 
-  step_over_calls = 1;
+  step_over_calls = STEP_OVER_ALL;
   step_frame_address = FRAME_FP (frame);
   step_sp = read_sp ();
 
@@ -1003,9 +970,7 @@
 }
 
 static void
-until_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+until_command (char *arg, int from_tty)
 {
   int async_exec = 0;
 
@@ -1104,10 +1069,9 @@
    only chance we have to complete this command is in
    fetch_inferior_event, which is called by the event loop as soon as it
    detects that the target has stopped. This function is called via the
-   cmd_continaution pointer. */
+   cmd_continuation pointer. */
 void
-finish_command_continuation (arg)
-     struct continuation_arg *arg;
+finish_command_continuation (struct continuation_arg *arg)
 {
   register struct symbol *function;
   struct breakpoint *breakpoint;
@@ -1150,9 +1114,7 @@
    the selected frame will return to, then continue.  */
 
 static void
-finish_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+finish_command (char *arg, int from_tty)
 {
   struct symtab_and_line sal;
   register struct frame_info *frame;
@@ -1277,9 +1239,7 @@
 
 /* ARGSUSED */
 static void
-program_info (args, from_tty)
-     char *args;
-     int from_tty;
+program_info (char *args, int from_tty)
 {
   bpstat bs = stop_bpstat;
   int num = bpstat_num (&bs);
@@ -1326,9 +1286,7 @@
 }
 
 static void
-environment_info (var, from_tty)
-     char *var;
-     int from_tty;
+environment_info (char *var, int from_tty)
 {
   if (var)
     {
@@ -1359,9 +1317,7 @@
 }
 
 static void
-set_environment_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+set_environment_command (char *arg, int from_tty)
 {
   register char *p, *val, *var;
   int nullset = 0;
@@ -1419,13 +1375,11 @@
     }
   else
     set_in_environ (inferior_environ, var, val);
-  free (var);
+  xfree (var);
 }
 
 static void
-unset_environment_command (var, from_tty)
-     char *var;
-     int from_tty;
+unset_environment_command (char *var, int from_tty)
 {
   if (var == 0)
     {
@@ -1447,9 +1401,7 @@
 
 /* ARGSUSED */
 static void
-path_info (args, from_tty)
-     char *args;
-     int from_tty;
+path_info (char *args, int from_tty)
 {
   puts_filtered ("Executable and object file path: ");
   puts_filtered (get_in_environ (inferior_environ, path_var_name));
@@ -1459,9 +1411,7 @@
 /* Add zero or more directories to the front of the execution path.  */
 
 static void
-path_command (dirname, from_tty)
-     char *dirname;
-     int from_tty;
+path_command (char *dirname, int from_tty)
 {
   char *exec_path;
   char *env;
@@ -1473,7 +1423,7 @@
   exec_path = strsave (env);
   mod_path (dirname, &exec_path);
   set_in_environ (inferior_environ, path_var_name, exec_path);
-  free (exec_path);
+  xfree (exec_path);
   if (from_tty)
     path_info ((char *) NULL, from_tty);
 }
@@ -1493,14 +1443,8 @@
    all the registers, define the macro DO_REGISTERS_INFO(regnum, fp)
    to provide that format.  */
 
-#if !defined (DO_REGISTERS_INFO)
-
-#define DO_REGISTERS_INFO(regnum, fp) do_registers_info(regnum, fp)
-
-static void
-do_registers_info (regnum, fpregs)
-     int regnum;
-     int fpregs;
+void
+do_registers_info (int regnum, int fpregs)
 {
   register int i;
   int numregs = ARCH_NUM_REGS;
@@ -1602,12 +1546,9 @@
       printf_filtered ("\n");
     }
 }
-#endif /* no DO_REGISTERS_INFO.  */
 
 void
-registers_info (addr_exp, fpregs)
-     char *addr_exp;
-     int fpregs;
+registers_info (char *addr_exp, int fpregs)
 {
   int regnum, numregs;
   register char *end;
@@ -1654,17 +1595,13 @@
 }
 
 void
-all_registers_info (addr_exp, from_tty)
-     char *addr_exp;
-     int from_tty;
+all_registers_info (char *addr_exp, int from_tty)
 {
   registers_info (addr_exp, 1);
 }
 
 void
-nofp_registers_info (addr_exp, from_tty)
-     char *addr_exp;
-     int from_tty;
+nofp_registers_info (char *addr_exp, int from_tty)
 {
   registers_info (addr_exp, 0);
 }
@@ -1687,9 +1624,7 @@
    and wait for the trace-trap that results from attaching.  */
 
 void
-attach_command (args, from_tty)
-     char *args;
-     int from_tty;
+attach_command (char *args, int from_tty)
 {
 #ifdef SOLIB_ADD
   extern int auto_solib_add;
@@ -1721,11 +1656,11 @@
      wait_for_inferior as soon as the target reports a stop.  */
   init_wait_for_inferior ();
   clear_proceed_status ();
-  stop_soon_quietly = 1;
 
   /* No traps are generated when attaching to inferior under Mach 3
      or GNU hurd.  */
 #ifndef ATTACH_NO_WAIT
+  stop_soon_quietly = 1;
   wait_for_inferior ();
 #endif
 
@@ -1786,9 +1721,7 @@
  */
 
 static void
-detach_command (args, from_tty)
-     char *args;
-     int from_tty;
+detach_command (char *args, int from_tty)
 {
   dont_repeat ();		/* Not for the faint of heart */
   target_detach (args, from_tty);
@@ -1803,17 +1736,13 @@
    the backgound. */
 #ifdef UI_OUT
 void
-interrupt_target_command_wrapper (args, from_tty)
-     char *args;
-     int from_tty;
+interrupt_target_command_wrapper (char *args, int from_tty)
 {
   interrupt_target_command (args, from_tty);
 }
 #endif
 static void
-interrupt_target_command (args, from_tty)
-     char *args;
-     int from_tty;
+interrupt_target_command (char *args, int from_tty)
 {
   if (event_loop_p && target_can_async_p ())
     {
@@ -1824,9 +1753,7 @@
 
 /* ARGSUSED */
 static void
-float_info (addr_exp, from_tty)
-     char *addr_exp;
-     int from_tty;
+float_info (char *addr_exp, int from_tty)
 {
 #ifdef FLOAT_INFO
   FLOAT_INFO;
@@ -1837,9 +1764,7 @@
 
 /* ARGSUSED */
 static void
-unset_command (args, from_tty)
-     char *args;
-     int from_tty;
+unset_command (char *args, int from_tty)
 {
   printf_filtered ("\"unset\" must be followed by the name of ");
   printf_filtered ("an unset subcommand.\n");
@@ -1847,7 +1772,7 @@
 }
 
 void
-_initialize_infcmd ()
+_initialize_infcmd (void)
 {
   struct cmd_list_element *c;
 
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 26798a5..474d278 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -52,7 +52,8 @@
 
 /* This macro gives the number of registers actually in use by the
    inferior.  This may be less than the total number of registers,
-   perhaps depending on the actual CPU in use or program being run.  */
+   perhaps depending on the actual CPU in use or program being run.  
+   FIXME: This could be replaced by the new MULTI_ARCH capability.  */
 
 #ifndef ARCH_NUM_REGS
 #define ARCH_NUM_REGS NUM_REGS
@@ -124,6 +125,11 @@
 
 extern void proceed (CORE_ADDR, enum target_signal, int);
 
+/* When set, stop the 'step' command if we enter a function which has
+   no line number information.  The normal behavior is that we step
+   over such function.  */
+extern int step_stop_if_no_debug;
+
 extern void kill_inferior (void);
 
 extern void generic_mourn_inferior (void);
@@ -185,6 +191,8 @@
 
 /* From misc files */
 
+extern void do_registers_info (int, int);
+
 extern void store_inferior_registers (int);
 
 extern void fetch_inferior_registers (int);
@@ -332,7 +340,12 @@
 /* 1 means step over all subroutine calls.
    -1 means step over calls to undebuggable functions.  */
 
-extern int step_over_calls;
+enum step_over_calls_kind
+  {
+    STEP_OVER_NONE,
+    STEP_OVER_ALL,
+    STEP_OVER_UNDEBUGGABLE,
+  } step_over_calls;
 
 /* If stepping, nonzero means step count is > 1
    so don't print frame next time inferior stops
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 0b98f83..17bce7f 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -120,7 +120,7 @@
 
 /* Does GDB have a terminal (on stdin)?  */
 int
-gdb_has_a_terminal ()
+gdb_has_a_terminal (void)
 {
   switch (gdb_has_a_terminal_flag)
     {
@@ -178,15 +178,14 @@
    before we actually run the inferior.  */
 
 void
-terminal_init_inferior_with_pgrp (pgrp)
-     int pgrp;
+terminal_init_inferior_with_pgrp (int pgrp)
 {
   if (gdb_has_a_terminal ())
     {
       /* We could just as well copy our_ttystate (if we felt like adding
          a new function SERIAL_COPY_TTY_STATE).  */
       if (inferior_ttystate)
-	free (inferior_ttystate);
+	xfree (inferior_ttystate);
       inferior_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);
 
 #ifdef PROCESS_GROUP_TYPE
@@ -201,7 +200,7 @@
 }
 
 void
-terminal_init_inferior ()
+terminal_init_inferior (void)
 {
 #ifdef PROCESS_GROUP_TYPE
   /* This is for Lynx, and should be cleaned up by having Lynx be a separate
@@ -218,7 +217,7 @@
    This is preparation for starting or resuming the inferior.  */
 
 void
-terminal_inferior ()
+terminal_inferior (void)
 {
   if (gdb_has_a_terminal () && terminal_is_ours
       && inferior_thisrun_terminal == 0)
@@ -288,7 +287,7 @@
    should be called to get back to a normal state of affairs.  */
 
 void
-terminal_ours_for_output ()
+terminal_ours_for_output (void)
 {
   terminal_ours_1 (1);
 }
@@ -298,7 +297,7 @@
    so they can be restored properly later.  */
 
 void
-terminal_ours ()
+terminal_ours (void)
 {
   terminal_ours_1 (0);
 }
@@ -308,8 +307,7 @@
    flags.  */
 
 static void
-terminal_ours_1 (output_only)
-     int output_only;
+terminal_ours_1 (int output_only)
 {
   /* Checking inferior_thisrun_terminal is necessary so that
      if GDB is running in the background, it won't block trying
@@ -333,7 +331,7 @@
 #endif
 
       if (inferior_ttystate)
-	free (inferior_ttystate);
+	xfree (inferior_ttystate);
       inferior_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);
 #ifdef HAVE_TERMIOS
       inferior_process_group = tcgetpgrp (0);
@@ -411,18 +409,14 @@
 
 /* ARGSUSED */
 void
-term_info (arg, from_tty)
-     char *arg;
-     int from_tty;
+term_info (char *arg, int from_tty)
 {
   target_terminal_info (arg, from_tty);
 }
 
 /* ARGSUSED */
 void
-child_terminal_info (args, from_tty)
-     char *args;
-     int from_tty;
+child_terminal_info (char *args, int from_tty)
 {
   if (!gdb_has_a_terminal ())
     {
@@ -506,8 +500,7 @@
    the terminal specified in the NEW_TTY_PREFORK call.  */
 
 void
-new_tty_prefork (ttyname)
-     char *ttyname;
+new_tty_prefork (char *ttyname)
 {
   /* Save the name for later, for determining whether we and the child
      are sharing a tty.  */
@@ -515,7 +508,7 @@
 }
 
 void
-new_tty ()
+new_tty (void)
 {
   register int tty;
 
@@ -576,9 +569,7 @@
 
 /* ARGSUSED */
 static void
-kill_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+kill_command (char *arg, int from_tty)
 {
   /* FIXME:  This should not really be inferior_pid (or target_has_execution).
      It should be a distinct flag that indicates that a target is active, cuz
@@ -609,8 +600,7 @@
 
 /* ARGSUSED */
 static void
-pass_signal (signo)
-     int signo;
+pass_signal (int signo)
 {
 #ifndef _WIN32
   kill (PIDGET (inferior_pid), SIGINT);
@@ -620,7 +610,7 @@
 static void (*osig) ();
 
 void
-set_sigint_trap ()
+set_sigint_trap (void)
 {
   if (attach_flag || inferior_thisrun_terminal)
     {
@@ -629,7 +619,7 @@
 }
 
 void
-clear_sigint_trap ()
+clear_sigint_trap (void)
 {
   if (attach_flag || inferior_thisrun_terminal)
     {
@@ -641,8 +631,7 @@
 static void (*old_sigio) ();
 
 static void
-handle_sigio (signo)
-     int signo;
+handle_sigio (int signo)
 {
   int numfds;
   fd_set readfds;
@@ -664,7 +653,7 @@
 static int old_fcntl_flags;
 
 void
-set_sigio_trap ()
+set_sigio_trap (void)
 {
   if (target_activity_function)
     {
@@ -676,7 +665,7 @@
 }
 
 void
-clear_sigio_trap ()
+clear_sigio_trap (void)
 {
   if (target_activity_function)
     {
@@ -686,14 +675,14 @@
 }
 #else /* No SIGIO.  */
 void
-set_sigio_trap ()
+set_sigio_trap (void)
 {
   if (target_activity_function)
     abort ();
 }
 
 void
-clear_sigio_trap ()
+clear_sigio_trap (void)
 {
   if (target_activity_function)
     abort ();
@@ -711,7 +700,7 @@
    calls setpgrp and a setpgrp which does nothing (any system with job control
    will have one or the other).  */
 int
-gdb_setpgid ()
+gdb_setpgid (void)
 {
   int retval = 0;
 
@@ -736,7 +725,7 @@
 }
 
 void
-_initialize_inflow ()
+_initialize_inflow (void)
 {
   add_info ("terminal", term_info,
 	    "Print inferior's saved terminal status.");
diff --git a/gdb/infptrace.c b/gdb/infptrace.c
index 52ff7a3..30ceb87 100644
--- a/gdb/infptrace.c
+++ b/gdb/infptrace.c
@@ -132,10 +132,7 @@
    It exists so that all calls to ptrace are isolated in this 
    machine-dependent file. */
 int
-call_ptrace (request, pid, addr, data)
-     int request, pid;
-     PTRACE_ARG3_TYPE addr;
-     int data;
+call_ptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data)
 {
   int pt_status = 0;
 
@@ -216,9 +213,7 @@
    hook before returning.  */
 
 int
-ptrace_wait (pid, status)
-     int pid;
-     int *status;
+ptrace_wait (int pid, int *status)
 {
   int wstate;
 
@@ -228,7 +223,7 @@
 }
 
 void
-kill_inferior ()
+kill_inferior (void)
 {
   int status;
 
@@ -255,10 +250,7 @@
    If SIGNAL is nonzero, give it that signal.  */
 
 void
-child_resume (pid, step, signal)
-     int pid;
-     int step;
-     enum target_signal signal;
+child_resume (int pid, int step, enum target_signal signal)
 {
   errno = 0;
 
@@ -300,8 +292,7 @@
 #ifdef ATTACH_DETACH
 /* Start debugging the process whose number is PID.  */
 int
-attach (pid)
-     int pid;
+attach (int pid)
 {
   errno = 0;
   ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0);
@@ -316,8 +307,7 @@
    SIGNAL = 0 means just continue it.  */
 
 void
-detach (signal)
-     int signal;
+detach (int signal)
 {
   errno = 0;
   ptrace (PT_DETACH, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal);
@@ -340,7 +330,7 @@
 #endif /* KERNEL_U_ADDR_BSD.  */
 
 void
-_initialize_kernel_u_addr ()
+_initialize_kernel_u_addr (void)
 {
 #if defined (KERNEL_U_ADDR_BSD) && !defined (FETCH_INFERIOR_REGISTERS)
   struct nlist names[2];
@@ -376,8 +366,7 @@
 /* Fetch one register.  */
 
 static void
-fetch_register (regno)
-     int regno;
+fetch_register (int regno)
 {
   /* This isn't really an address.  But ptrace thinks of it as one.  */
   CORE_ADDR regaddr;
@@ -423,8 +412,7 @@
    Otherwise, REGNO specifies which register (so we can save time). */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   if (regno >= 0)
     {
@@ -447,8 +435,7 @@
 /* Store one register. */
 
 static void
-store_register (regno)
-     int regno;
+store_register (int regno)
 {
   /* This isn't really an address.  But ptrace thinks of it as one.  */
   CORE_ADDR regaddr;
@@ -489,8 +476,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   if (regno >= 0)
     {
@@ -516,7 +502,7 @@
 
 /* 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.
+   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 child_ops
@@ -524,12 +510,8 @@
    anyway.  */
 
 int
-child_xfer_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* ignored */
+child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		   struct target_ops *target)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -613,9 +595,7 @@
 
 
 static void
-udot_info (dummy1, dummy2)
-     char *dummy1;
-     int dummy2;
+udot_info (char *dummy1, int dummy2)
 {
 #if defined (KERNEL_U_SIZE)
   int udot_off;			/* Offset into user struct */
@@ -665,7 +645,7 @@
 
 
 void
-_initialize_infptrace ()
+_initialize_infptrace (void)
 {
 #if !defined (CHILD_XFER_MEMORY)
   add_info ("udot", udot_info,
diff --git a/gdb/infrun.c b/gdb/infrun.c
index d607577..e934c9d 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -84,6 +84,11 @@
 int inferior_ignoring_startup_exec_events = 0;
 int inferior_ignoring_leading_exec_events = 0;
 
+/* When set, stop the 'step' command if we enter a function which has
+   no line number information.  The normal behavior is that we step
+   over such function.  */
+int step_stop_if_no_debug = 0;
+
 /* In asynchronous mode, but simulating synchronous execution. */
 
 int sync_execution = 0;
@@ -434,17 +439,25 @@
    follow-fork-mode.) */
 static int follow_vfork_when_exec;
 
-static char *follow_fork_mode_kind_names[] =
+static const char follow_fork_mode_ask[] = "ask";
+static const char follow_fork_mode_both[] = "both";
+static const char follow_fork_mode_child[] = "child";
+static const char follow_fork_mode_parent[] = "parent";
+
+static const char *follow_fork_mode_kind_names[] =
 {
+  follow_fork_mode_ask,
   /* ??rehrauer: The "both" option is broken, by what may be a 10.20
      kernel problem.  It's also not terribly useful without a GUI to
      help the user drive two debuggers.  So for now, I'm disabling the
      "both" option. */
-  /* "parent", "child", "both", "ask" */
-  "parent", "child", "ask", NULL
+  /* follow_fork_mode_both, */
+  follow_fork_mode_child,
+  follow_fork_mode_parent,
+  NULL
 };
 
-static char *follow_fork_mode_string = NULL;
+static const char *follow_fork_mode_string = follow_fork_mode_parent;
 
 
 static void
@@ -455,23 +468,19 @@
   int followed_child = 0;
 
   /* Which process did the user want us to follow? */
-  char *follow_mode =
-    savestring (follow_fork_mode_string, strlen (follow_fork_mode_string));
+  const char *follow_mode = follow_fork_mode_string;
 
   /* Or, did the user not know, and want us to ask? */
-  if (STREQ (follow_fork_mode_string, "ask"))
+  if (follow_fork_mode_string == follow_fork_mode_ask)
     {
-      char requested_mode[100];
-
-      free (follow_mode);
-      error ("\"ask\" mode NYI");
-      follow_mode = savestring (requested_mode, strlen (requested_mode));
+      internal_error ("follow_inferior_fork: \"ask\" mode not implemented");
+      /* follow_mode = follow_fork_mode_...; */
     }
 
   /* If we're to be following the parent, then detach from child_pid.
      We're already following the parent, so need do nothing explicit
      for it. */
-  if (STREQ (follow_mode, "parent"))
+  if (follow_mode == follow_fork_mode_parent)
     {
       followed_parent = 1;
 
@@ -496,7 +505,7 @@
 
   /* If we're to be following the child, then attach to it, detach
      from inferior_pid, and set inferior_pid to child_pid. */
-  else if (STREQ (follow_mode, "child"))
+  else if (follow_mode == follow_fork_mode_child)
     {
       char child_pid_spelling[100];	/* Arbitrary length. */
 
@@ -558,7 +567,7 @@
 
   /* If we're to be following both parent and child, then fork ourselves,
      and attach the debugger clone to the child. */
-  else if (STREQ (follow_mode, "both"))
+  else if (follow_mode == follow_fork_mode_both)
     {
       char pid_suffix[100];	/* Arbitrary length. */
 
@@ -614,8 +623,6 @@
 
   pending_follow.fork_event.saw_parent_fork = 0;
   pending_follow.fork_event.saw_child_fork = 0;
-
-  free (follow_mode);
 }
 
 static void
@@ -639,7 +646,7 @@
       pending_follow.fork_event.saw_child_exec = 0;
       pending_follow.kind = TARGET_WAITKIND_SPURIOUS;
       follow_exec (inferior_pid, pending_follow.execd_pathname);
-      free (pending_follow.execd_pathname);
+      xfree (pending_follow.execd_pathname);
     }
 }
 
@@ -757,11 +764,11 @@
   normal_stop ();
 }
 
-static char schedlock_off[] = "off";
-static char schedlock_on[] = "on";
-static char schedlock_step[] = "step";
-static char *scheduler_mode = schedlock_off;
-static char *scheduler_enums[] =
+static const char schedlock_off[] = "off";
+static const char schedlock_on[] = "on";
+static const char schedlock_step[] = "step";
+static const char *scheduler_mode = schedlock_off;
+static const char *scheduler_enums[] =
 {
   schedlock_off,
   schedlock_on,
@@ -938,7 +945,7 @@
   step_range_start = 0;
   step_range_end = 0;
   step_frame_address = 0;
-  step_over_calls = -1;
+  step_over_calls = STEP_OVER_UNDEBUGGABLE;
   stop_after_trap = 0;
   stop_soon_quietly = 0;
   proceed_to_finish = 0;
@@ -1106,7 +1113,7 @@
 
   /* Always go on waiting for the target, regardless of the mode. */
   /* FIXME: cagney/1999-09-23: At present it isn't possible to
-     indicate th wait_for_inferior that a target should timeout if
+     indicate to wait_for_inferior that a target should timeout if
      nothing is returned (instead of just blocking).  Because of this,
      targets expecting an immediate response need to, internally, set
      things up so that the target_wait() is forced to eventually
@@ -1307,8 +1314,7 @@
 struct execution_control_state *async_ecs;
 
 void
-fetch_inferior_event (client_data)
-     void *client_data;
+fetch_inferior_event (void *client_data)
 {
   static struct cleanup *old_cleanups;
 
@@ -1430,7 +1436,7 @@
 	insert_breakpoints ();
 
 	/* We need to restart all the threads now,
-	 * unles we're running in scheduler-locked mode. 
+	 * unless we're running in scheduler-locked mode. 
 	 * FIXME: shouldn't we look at currently_stepping ()?
 	 */
 	if (scheduler_mode == schedlock_on)
@@ -1709,7 +1715,7 @@
 	/* This causes the eventpoints and symbol table to be reset.  Must
 	   do this now, before trying to determine whether to stop. */
 	follow_exec (inferior_pid, pending_follow.execd_pathname);
-	free (pending_follow.execd_pathname);
+	xfree (pending_follow.execd_pathname);
 
 	stop_pc = read_pc_pid (ecs->pid);
 	ecs->saved_inferior_pid = inferior_pid;
@@ -2611,7 +2617,7 @@
        loader dynamic symbol resolution code, we keep on single stepping
        until we exit the run time loader code and reach the callee's
        address.  */
-    if (step_over_calls < 0 && IN_SOLIB_DYNSYM_RESOLVE_CODE (stop_pc))
+    if (step_over_calls == STEP_OVER_UNDEBUGGABLE && IN_SOLIB_DYNSYM_RESOLVE_CODE (stop_pc))
       {
 	CORE_ADDR pc_after_resolver = SKIP_SOLIB_RESOLVER (stop_pc);
 
@@ -2732,7 +2738,7 @@
       {
 	/* It's a subroutine call.  */
 
-	if (step_over_calls == 0)
+	if (step_over_calls == STEP_OVER_NONE)
 	  {
 	    /* I presume that step_over_calls is only 0 when we're
 	       supposed to be stepping at the assembly language level
@@ -2743,7 +2749,7 @@
 	    return;
 	  }
 
-	if (step_over_calls > 0 || IGNORE_HELPER_CALL (stop_pc))
+	if (step_over_calls == STEP_OVER_ALL || IGNORE_HELPER_CALL (stop_pc))
 	  {
 	    /* We're doing a "next".  */
 
@@ -2809,6 +2815,18 @@
 	      return;
 	    }
 	}
+
+	/* If we have no line number and the step-stop-if-no-debug
+	   is set, we stop the step so that the user has a chance to
+	   switch in assembly mode.  */
+	if (step_over_calls == STEP_OVER_UNDEBUGGABLE && step_stop_if_no_debug)
+	  {
+	    stop_step = 1;
+	    print_stop_reason (END_STEPPING_RANGE, 0);
+	    stop_stepping (ecs);
+	    return;
+	  }
+
 	step_over_function (ecs);
 	keep_going (ecs);
 	return;
@@ -3445,9 +3463,9 @@
 
   /* Look up the hook_stop and run it if it exists.  */
 
-  if (stop_command && stop_command->hook)
+  if (stop_command && stop_command->hook_pre)
     {
-      catch_errors (hook_stop_stub, stop_command->hook,
+      catch_errors (hook_stop_stub, stop_command->hook_pre,
 		    "Error while running hook_stop:\n", RETURN_MASK_ALL);
     }
 
@@ -3873,7 +3891,7 @@
 	  else
 	    printf_filtered ("Invalid signal handling flag.\n");
 	  if (argBuf)
-	    free (argBuf);
+	    xfree (argBuf);
 	}
     }
   do_cleanups (old_chain);
@@ -3898,7 +3916,7 @@
 	{
 	  /* No, try numeric.  */
 	  oursig =
-	    target_signal_from_command (parse_and_eval_address (signum_exp));
+	    target_signal_from_command (parse_and_eval_long (signum_exp));
 	}
       sig_print_info (oursig);
       return;
@@ -3933,7 +3951,7 @@
   CORE_ADDR step_range_start;
   CORE_ADDR step_range_end;
   CORE_ADDR step_frame_address;
-  int step_over_calls;
+  enum step_over_calls_kind step_over_calls;
   CORE_ADDR step_resume_break_address;
   int stop_after_trap;
   int stop_soon_quietly;
@@ -3964,9 +3982,9 @@
 static void
 free_inferior_status (struct inferior_status *inf_status)
 {
-  free (inf_status->registers);
-  free (inf_status->stop_registers);
-  free (inf_status);
+  xfree (inf_status->registers);
+  xfree (inf_status->stop_registers);
+  xfree (inf_status);
 }
 
 void
@@ -4133,20 +4151,6 @@
   free_inferior_status (inf_status);
 }
 
-static void
-set_follow_fork_mode_command (char *arg, int from_tty,
-			      struct cmd_list_element *c)
-{
-  if (!STREQ (arg, "parent") &&
-      !STREQ (arg, "child") &&
-      !STREQ (arg, "both") &&
-      !STREQ (arg, "ask"))
-    error ("follow-fork-mode must be one of \"parent\", \"child\", \"both\" or \"ask\".");
-
-  if (follow_fork_mode_string != NULL)
-    free (follow_fork_mode_string);
-  follow_fork_mode_string = savestring (arg, strlen (arg));
-}
 
 static void
 build_infrun (void)
@@ -4309,8 +4313,6 @@
 /*  c->function.sfunc = ; */
   add_show_from_set (c, &showlist);
 
-  set_follow_fork_mode_command ("parent", 0, NULL);
-
   c = add_set_enum_cmd ("scheduler-locking", class_run,
 			scheduler_enums,	/* array of string names */
 			&scheduler_mode,	/* current mode  */
@@ -4324,4 +4326,13 @@
 
   c->function.sfunc = set_schedlock_func;	/* traps on target vector */
   add_show_from_set (c, &showlist);
+
+  c = add_set_cmd ("step-mode", class_run,
+		   var_boolean, (char*) &step_stop_if_no_debug,
+"Set mode of the step operation. When set, doing a step over a\n\
+function without debug line information will stop at the first\n\
+instruction of that function. Otherwise, the function is skipped and\n\
+the step command stops at a different source line.",
+			&setlist);
+  add_show_from_set (c, &showlist);
 }
diff --git a/gdb/inftarg.c b/gdb/inftarg.c
index 53c53e4..90762f8 100644
--- a/gdb/inftarg.c
+++ b/gdb/inftarg.c
@@ -116,9 +116,7 @@
    of error; store status through argument pointer OURSTATUS.  */
 
 static int
-child_wait (pid, ourstatus)
-     int pid;
-     struct target_waitstatus *ourstatus;
+child_wait (int pid, struct target_waitstatus *ourstatus)
 {
   int save_errno;
   int status;
@@ -228,9 +226,7 @@
 
 #if !defined(CHILD_POST_WAIT)
 void
-child_post_wait (pid, wait_status)
-     int pid;
-     int wait_status;
+child_post_wait (int pid, int wait_status)
 {
   /* This version of Unix doesn't require a meaningful "post wait"
      operation.
@@ -247,8 +243,7 @@
    for now we're going to try and be compatable with the old thread
    code.  */
 int
-child_thread_alive (pid)
-     int pid;
+child_thread_alive (int pid)
 {
   return (kill (pid, 0) != -1);
 }
@@ -256,10 +251,7 @@
 #endif
 
 static void
-child_attach_to_process (args, from_tty, after_fork)
-     char *args;
-     int from_tty;
-     int after_fork;
+child_attach_to_process (char *args, int from_tty, int after_fork)
 {
   if (!args)
     error_no_arg ("process-id to attach");
@@ -312,17 +304,14 @@
 /* Attach to process PID, then initialize for debugging it.  */
 
 static void
-child_attach (args, from_tty)
-     char *args;
-     int from_tty;
+child_attach (char *args, int from_tty)
 {
   child_attach_to_process (args, from_tty, 0);
 }
 
 #if !defined(CHILD_POST_ATTACH)
 void
-child_post_attach (pid)
-     int pid;
+child_post_attach (int pid)
 {
   /* This version of Unix doesn't require a meaningful "post attach"
      operation by a debugger.  */
@@ -330,19 +319,13 @@
 #endif
 
 static void
-child_require_attach (args, from_tty)
-     char *args;
-     int from_tty;
+child_require_attach (char *args, int from_tty)
 {
   child_attach_to_process (args, from_tty, 1);
 }
 
 static void
-child_detach_from_process (pid, args, from_tty, after_fork)
-     int pid;
-     char *args;
-     int from_tty;
-     int after_fork;
+child_detach_from_process (int pid, char *args, int from_tty, int after_fork)
 {
 #ifdef ATTACH_DETACH
   {
@@ -383,9 +366,7 @@
    started via the normal ptrace (PTRACE_TRACEME).  */
 
 static void
-child_detach (args, from_tty)
-     char *args;
-     int from_tty;
+child_detach (char *args, int from_tty)
 {
   child_detach_from_process (inferior_pid, args, from_tty, 0);
   inferior_pid = 0;
@@ -393,10 +374,7 @@
 }
 
 static void
-child_require_detach (pid, args, from_tty)
-     int pid;
-     char *args;
-     int from_tty;
+child_require_detach (int pid, char *args, int from_tty)
 {
   child_detach_from_process (pid, args, from_tty, 1);
 }
@@ -409,7 +387,7 @@
    debugged.  */
 
 static void
-child_prepare_to_store ()
+child_prepare_to_store (void)
 {
 #ifdef CHILD_PREPARE_TO_STORE
   CHILD_PREPARE_TO_STORE ();
@@ -419,8 +397,7 @@
 /* Print status information about what we're accessing.  */
 
 static void
-child_files_info (ignore)
-     struct target_ops *ignore;
+child_files_info (struct target_ops *ignore)
 {
   printf_unfiltered ("\tUsing the running image of %s %s.\n",
       attach_flag ? "attached" : "child", target_pid_to_str (inferior_pid));
@@ -428,9 +405,7 @@
 
 /* ARGSUSED */
 static void
-child_open (arg, from_tty)
-     char *arg;
-     int from_tty;
+child_open (char *arg, int from_tty)
 {
   error ("Use the \"run\" command to start a Unix child process.");
 }
@@ -439,7 +414,7 @@
    by its parent process.  */
 
 static void
-ptrace_me ()
+ptrace_me (void)
 {
   /* "Trace me, Dr. Memory!" */
   call_ptrace (0, 0, (PTRACE_ARG3_TYPE) 0, 0);
@@ -449,8 +424,7 @@
    the child process.  */
 
 static void
-ptrace_him (pid)
-     int pid;
+ptrace_him (int pid)
 {
   push_target (&child_ops);
 
@@ -480,10 +454,7 @@
    ENV is the environment vector to pass.  Errors reported with error().  */
 
 static void
-child_create_inferior (exec_file, allargs, env)
-     char *exec_file;
-     char *allargs;
-     char **env;
+child_create_inferior (char *exec_file, char *allargs, char **env)
 {
 #ifdef HPUXHPPA
   fork_inferior (exec_file, allargs, env, ptrace_me, ptrace_him, pre_fork_inferior, NULL);
@@ -497,8 +468,7 @@
 
 #if !defined(CHILD_POST_STARTUP_INFERIOR)
 void
-child_post_startup_inferior (pid)
-     int pid;
+child_post_startup_inferior (int pid)
 {
   /* This version of Unix doesn't require a meaningful "post startup inferior"
      operation by a debugger.
@@ -508,8 +478,7 @@
 
 #if !defined(CHILD_ACKNOWLEDGE_CREATED_INFERIOR)
 void
-child_acknowledge_created_inferior (pid)
-     int pid;
+child_acknowledge_created_inferior (int pid)
 {
   /* This version of Unix doesn't require a meaningful "acknowledge created inferior"
      operation by a debugger.
@@ -519,9 +488,7 @@
 
 
 void
-child_clone_and_follow_inferior (child_pid, followed_child)
-     int child_pid;
-     int *followed_child;
+child_clone_and_follow_inferior (int child_pid, int *followed_child)
 {
   clone_and_follow_inferior (child_pid, followed_child);
 
@@ -533,7 +500,7 @@
 
 #if !defined(CHILD_POST_FOLLOW_INFERIOR_BY_CLONE)
 void
-child_post_follow_inferior_by_clone ()
+child_post_follow_inferior_by_clone (void)
 {
   /* This version of Unix doesn't require a meaningful "post follow inferior"
      operation by a clone debugger.
@@ -543,8 +510,7 @@
 
 #if !defined(CHILD_INSERT_FORK_CATCHPOINT)
 int
-child_insert_fork_catchpoint (pid)
-     int pid;
+child_insert_fork_catchpoint (int pid)
 {
   /* This version of Unix doesn't support notification of fork events.  */
   return 0;
@@ -553,8 +519,7 @@
 
 #if !defined(CHILD_REMOVE_FORK_CATCHPOINT)
 int
-child_remove_fork_catchpoint (pid)
-     int pid;
+child_remove_fork_catchpoint (int pid)
 {
   /* This version of Unix doesn't support notification of fork events.  */
   return 0;
@@ -563,8 +528,7 @@
 
 #if !defined(CHILD_INSERT_VFORK_CATCHPOINT)
 int
-child_insert_vfork_catchpoint (pid)
-     int pid;
+child_insert_vfork_catchpoint (int pid)
 {
   /* This version of Unix doesn't support notification of vfork events.  */
   return 0;
@@ -573,8 +537,7 @@
 
 #if !defined(CHILD_REMOVE_VFORK_CATCHPOINT)
 int
-child_remove_vfork_catchpoint (pid)
-     int pid;
+child_remove_vfork_catchpoint (int pid)
 {
   /* This version of Unix doesn't support notification of vfork events.  */
   return 0;
@@ -583,9 +546,7 @@
 
 #if !defined(CHILD_HAS_FORKED)
 int
-child_has_forked (pid, child_pid)
-     int pid;
-     int *child_pid;
+child_has_forked (int pid, int *child_pid)
 {
   /* This version of Unix doesn't support notification of fork events.  */
   return 0;
@@ -595,9 +556,7 @@
 
 #if !defined(CHILD_HAS_VFORKED)
 int
-child_has_vforked (pid, child_pid)
-     int pid;
-     int *child_pid;
+child_has_vforked (int pid, int *child_pid)
 {
   /* This version of Unix doesn't support notification of vfork events.
    */
@@ -608,7 +567,7 @@
 
 #if !defined(CHILD_CAN_FOLLOW_VFORK_PRIOR_TO_EXEC)
 int
-child_can_follow_vfork_prior_to_exec ()
+child_can_follow_vfork_prior_to_exec (void)
 {
   /* This version of Unix doesn't support notification of vfork events.
      However, if it did, it probably wouldn't allow vforks to be followed
@@ -621,11 +580,8 @@
 
 #if !defined(CHILD_POST_FOLLOW_VFORK)
 void
-child_post_follow_vfork (parent_pid, followed_parent, child_pid, followed_child)
-     int parent_pid;
-     int followed_parent;
-     int child_pid;
-     int followed_child;
+child_post_follow_vfork (int parent_pid, int followed_parent, int child_pid,
+			 int followed_child)
 {
   /* This version of Unix doesn't require a meaningful "post follow vfork"
      operation by a clone debugger.
@@ -635,8 +591,7 @@
 
 #if !defined(CHILD_INSERT_EXEC_CATCHPOINT)
 int
-child_insert_exec_catchpoint (pid)
-     int pid;
+child_insert_exec_catchpoint (int pid)
 {
   /* This version of Unix doesn't support notification of exec events.  */
   return 0;
@@ -645,8 +600,7 @@
 
 #if !defined(CHILD_REMOVE_EXEC_CATCHPOINT)
 int
-child_remove_exec_catchpoint (pid)
-     int pid;
+child_remove_exec_catchpoint (int pid)
 {
   /* This version of Unix doesn't support notification of exec events.  */
   return 0;
@@ -655,9 +609,7 @@
 
 #if !defined(CHILD_HAS_EXECD)
 int
-child_has_execd (pid, execd_pathname)
-     int pid;
-     char **execd_pathname;
+child_has_execd (int pid, char **execd_pathname)
 {
   /* This version of Unix doesn't support notification of exec events.
    */
@@ -668,7 +620,7 @@
 
 #if !defined(CHILD_REPORTED_EXEC_EVENTS_PER_EXEC_CALL)
 int
-child_reported_exec_events_per_exec_call ()
+child_reported_exec_events_per_exec_call (void)
 {
   /* This version of Unix doesn't support notification of exec events.
    */
@@ -679,10 +631,7 @@
 
 #if !defined(CHILD_HAS_SYSCALL_EVENT)
 int
-child_has_syscall_event (pid, kind, syscall_id)
-     int pid;
-     enum target_waitkind *kind;
-     int *syscall_id;
+child_has_syscall_event (int pid, enum target_waitkind *kind, int *syscall_id)
 {
   /* This version of Unix doesn't support notification of syscall events.
    */
@@ -693,10 +642,7 @@
 
 #if !defined(CHILD_HAS_EXITED)
 int
-child_has_exited (pid, wait_status, exit_status)
-     int pid;
-     int wait_status;
-     int *exit_status;
+child_has_exited (int pid, int wait_status, int *exit_status)
 {
   if (WIFEXITED (wait_status))
     {
@@ -719,14 +665,14 @@
 
 
 static void
-child_mourn_inferior ()
+child_mourn_inferior (void)
 {
   unpush_target (&child_ops);
   generic_mourn_inferior ();
 }
 
 static int
-child_can_run ()
+child_can_run (void)
 {
   /* This variable is controlled by modules that sit atop inftarg that may layer
      their own process structure atop that provided here.  hpux-thread.c does
@@ -742,7 +688,7 @@
    killpg() instead of kill (-pgrp). */
 
 static void
-child_stop ()
+child_stop (void)
 {
   extern pid_t inferior_process_group;
 
@@ -751,9 +697,7 @@
 
 #if !defined(CHILD_ENABLE_EXCEPTION_CALLBACK)
 struct symtab_and_line *
-child_enable_exception_callback (kind, enable)
-     enum exception_event_kind kind;
-     int enable;
+child_enable_exception_callback (enum exception_event_kind kind, int enable)
 {
   return (struct symtab_and_line *) NULL;
 }
@@ -761,7 +705,7 @@
 
 #if !defined(CHILD_GET_CURRENT_EXCEPTION_EVENT)
 struct exception_event_record *
-child_get_current_exception_event ()
+child_get_current_exception_event (void)
 {
   return (struct exception_event_record *) NULL;
 }
@@ -770,8 +714,7 @@
 
 #if !defined(CHILD_PID_TO_EXEC_FILE)
 char *
-child_pid_to_exec_file (pid)
-     int pid;
+child_pid_to_exec_file (int pid)
 {
   /* This version of Unix doesn't support translation of a process ID
      to the filename of the executable file.
@@ -781,8 +724,7 @@
 #endif
 
 char *
-child_core_file_to_sym_file (core)
-     char *core;
+child_core_file_to_sym_file (char *core)
 {
   /* The target stratum for a running executable need not support
      this operation.
@@ -793,15 +735,14 @@
 
 #if !defined(CHILD_PID_TO_STR)
 char *
-child_pid_to_str (pid)
-     int pid;
+child_pid_to_str (int pid)
 {
   return normal_pid_to_str (pid);
 }
 #endif
 
 static void
-init_child_ops ()
+init_child_ops (void)
 {
   child_ops.to_shortname = "child";
   child_ops.to_longname = "Unix child process";
@@ -866,7 +807,7 @@
 }
 
 void
-_initialize_inftarg ()
+_initialize_inftarg (void)
 {
 #ifdef HAVE_OPTIONAL_PROC_FS
   char procname[32];
diff --git a/gdb/infttrace.c b/gdb/infttrace.c
index 89edab4..a6fbc7f 100644
--- a/gdb/infttrace.c
+++ b/gdb/infttrace.c
@@ -390,8 +390,7 @@
  *************************************************
  */
 CORE_ADDR
-get_raw_pc (ttid)
-     lwpid_t ttid;
+get_raw_pc (lwpid_t ttid)
 {
   unsigned long pc_val;
   int offset;
@@ -414,8 +413,7 @@
 }
 
 static char *
-get_printable_name_of_stepping_mode (mode)
-     stepping_mode_t mode;
+get_printable_name_of_stepping_mode (stepping_mode_t mode)
 {
   switch (mode)
     {
@@ -434,8 +432,7 @@
  * ttrace event being reported.
  */
 char *
-get_printable_name_of_ttrace_event (event)
-     ttevents_t event;
+get_printable_name_of_ttrace_event (ttevents_t event)
 {
   /* This enumeration is "gappy", so don't use a table. */
   switch (event)
@@ -478,8 +475,7 @@
  * name.
  */
 char *
-get_printable_name_of_ttrace_request (request)
-     ttreq_t request;
+get_printable_name_of_ttrace_request (ttreq_t request)
 {
   if (!IS_TTRACE_REQ (request))
     return "?bad req?";
@@ -550,8 +546,7 @@
  * name.
  */
 static char *
-get_printable_name_of_process_state (process_state)
-     process_state_t process_state;
+get_printable_name_of_process_state (process_state_t process_state)
 {
   switch (process_state)
     {
@@ -573,8 +568,7 @@
 /* Set a ttrace thread state to a safe, initial state.
  */
 static void
-clear_ttstate_t (tts)
-     ttstate_t *tts;
+clear_ttstate_t (ttstate_t *tts)
 {
   tts->tts_pid = 0;
   tts->tts_lwpid = 0;
@@ -585,9 +579,7 @@
 /* Copy ttrace thread state TTS_FROM into TTS_TO.
  */
 static void
-copy_ttstate_t (tts_to, tts_from)
-     ttstate_t *tts_to;
-     ttstate_t *tts_from;
+copy_ttstate_t (ttstate_t *tts_to, ttstate_t *tts_from)
 {
   memcpy ((char *) tts_to, (char *) tts_from, sizeof (*tts_to));
 }
@@ -595,7 +587,7 @@
 /* Are there any live threads we know about?
  */
 static int
-any_thread_records ()
+any_thread_records (void)
 {
   return (thread_head.count > 0);
 }
@@ -603,9 +595,7 @@
 /* Create, fill in and link in a thread descriptor.
  */
 static thread_info *
-create_thread_info (pid, tid)
-     int pid;
-     lwpid_t tid;
+create_thread_info (int pid, lwpid_t tid)
 {
   thread_info *new_p;
   thread_info *p;
@@ -681,7 +671,7 @@
 /* Get rid of our thread info.
  */
 static void
-clear_thread_info ()
+clear_thread_info (void)
 {
   thread_info *p;
   thread_info *q;
@@ -696,7 +686,7 @@
     {
       q = p;
       p = p->next;
-      free (q);
+      xfree (q);
     }
 
   thread_head.head = NULL;
@@ -708,7 +698,7 @@
     {
       q = p;
       p = p->next;
-      free (q);
+      xfree (q);
     }
 
   deleted_threads.head = NULL;
@@ -723,8 +713,7 @@
 /* Given a tid, find the thread block for it.
  */
 static thread_info *
-find_thread_info (tid)
-     lwpid_t tid;
+find_thread_info (lwpid_t tid)
 {
   thread_info *p;
 
@@ -755,8 +744,7 @@
  * deleted threads.  We do the map, but we don't like it.
  */
 static lwpid_t
-map_from_gdb_tid (gdb_tid)
-     lwpid_t gdb_tid;
+map_from_gdb_tid (lwpid_t gdb_tid)
 {
   thread_info *p;
 
@@ -805,8 +793,7 @@
  * also need to consider deleted threads.
  */
 static lwpid_t
-map_to_gdb_tid (real_tid)
-     lwpid_t real_tid;
+map_to_gdb_tid (lwpid_t real_tid)
 {
   thread_info *p;
 
@@ -836,7 +823,7 @@
 /* Do any threads have saved signals?
  */
 static int
-saved_signals_exist ()
+saved_signals_exist (void)
 {
   thread_info *p;
 
@@ -854,8 +841,7 @@
 /* Is this the tid for the zero-th thread?
  */
 static int
-is_pseudo_thread (tid)
-     lwpid_t tid;
+is_pseudo_thread (lwpid_t tid)
 {
   thread_info *p = find_thread_info (tid);
   if (NULL == p || p->terminated)
@@ -867,8 +853,7 @@
 /* Is this thread terminated?
  */
 static int
-is_terminated (tid)
-     lwpid_t tid;
+is_terminated (lwpid_t tid)
 {
   thread_info *p = find_thread_info (tid);
 
@@ -881,8 +866,7 @@
 /* Is this pid a real PID or a TID?
  */
 static int
-is_process_id (pid)
-     int pid;
+is_process_id (int pid)
 {
   lwpid_t tid;
   thread_info *tinfo;
@@ -921,9 +905,7 @@
 /* Add a thread to our info.  Prevent duplicate entries.
  */
 static thread_info *
-add_tthread (pid, tid)
-     int pid;
-     lwpid_t tid;
+add_tthread (int pid, lwpid_t tid)
 {
   thread_info *p;
 
@@ -937,8 +919,7 @@
 /* Notice that a thread was deleted.
  */
 static void
-del_tthread (tid)
-     lwpid_t tid;
+del_tthread (lwpid_t tid)
 {
   thread_info *p;
   thread_info *chase;
@@ -1023,8 +1004,7 @@
 /* Get the pid for this tid. (Has to be a real TID!).
  */
 static int
-get_pid_for (tid)
-     lwpid_t tid;
+get_pid_for (lwpid_t tid)
 {
   thread_info *p;
 
@@ -1050,9 +1030,7 @@
 /* Note that this thread's current event has been handled.
  */
 static void
-set_handled (pid, tid)
-     int pid;
-     lwpid_t tid;
+set_handled (int pid, lwpid_t tid)
 {
   thread_info *p;
 
@@ -1066,8 +1044,7 @@
 /* Was this thread's current event handled?
  */
 static int
-was_handled (tid)
-     lwpid_t tid;
+was_handled (lwpid_t tid)
 {
   thread_info *p;
 
@@ -1081,8 +1058,7 @@
 /* Set this thread to unhandled.
  */
 static void
-clear_handled (tid)
-     lwpid_t tid;
+clear_handled (lwpid_t tid)
 {
   thread_info *p;
 
@@ -1101,7 +1077,7 @@
 /* Set all threads to unhandled.
  */
 static void
-clear_all_handled ()
+clear_all_handled (void)
 {
   thread_info *p;
 
@@ -1124,8 +1100,7 @@
 /* Set this thread to default stepping mode.
  */
 static void
-clear_stepping_mode (tid)
-     lwpid_t tid;
+clear_stepping_mode (lwpid_t tid)
 {
   thread_info *p;
 
@@ -1144,7 +1119,7 @@
 /* Set all threads to do default continue on resume.
  */
 static void
-clear_all_stepping_mode ()
+clear_all_stepping_mode (void)
 {
   thread_info *p;
 
@@ -1167,7 +1142,7 @@
 /* Set all threads to unseen on this pass.
  */
 static void
-set_all_unseen ()
+set_all_unseen (void)
 {
   thread_info *p;
 
@@ -1181,8 +1156,7 @@
 /* debugging routine.
  */
 static void
-print_tthread (p)
-     thread_info *p;
+print_tthread (thread_info *p)
 {
   printf (" Thread pid %d, tid %d", p->pid, p->tid);
   if (p->have_state)
@@ -1214,7 +1188,7 @@
 }
 
 static void
-print_tthreads ()
+print_tthreads (void)
 {
   thread_info *p;
 
@@ -1254,7 +1228,7 @@
 /* Update the thread list based on the "seen" bits.
  */
 static void
-update_thread_list ()
+update_thread_list (void)
 {
   thread_info *p;
   thread_info *chase;
@@ -1302,11 +1276,8 @@
  * No other "raw" calls to ttrace should exist in this module.
  */
 static int
-call_real_ttrace (request, pid, tid, addr, data, addr2)
-     ttreq_t request;
-     pid_t pid;
-     lwpid_t tid;
-     TTRACE_ARG_TYPE addr, data, addr2;
+call_real_ttrace (ttreq_t request, pid_t pid, lwpid_t tid, TTRACE_ARG_TYPE addr,
+		  TTRACE_ARG_TYPE data, TTRACE_ARG_TYPE addr2)
 {
   int tt_status;
 
@@ -1359,12 +1330,8 @@
  * No "raw" calls to ttrace_wait should exist elsewhere.
  */
 static int
-call_real_ttrace_wait (pid, tid, option, tsp, tsp_size)
-     int pid;
-     lwpid_t tid;
-     ttwopt_t option;
-     ttstate_t *tsp;
-     size_t tsp_size;
+call_real_ttrace_wait (int pid, lwpid_t tid, ttwopt_t option, ttstate_t *tsp,
+		       size_t tsp_size)
 {
   int ttw_status;
   thread_info *tinfo = NULL;
@@ -1394,9 +1361,7 @@
    to iterate over the IDs of all stopped threads of this process.
  */
 static lwpid_t
-get_process_first_stopped_thread_id (pid, thread_state)
-     int pid;
-     ttstate_t *thread_state;
+get_process_first_stopped_thread_id (int pid, ttstate_t *thread_state)
 {
   int tt_status;
 
@@ -1444,9 +1409,7 @@
    to iterate over the IDs of all stopped threads of this process.
  */
 static lwpid_t
-get_process_next_stopped_thread_id (pid, thread_state)
-     int pid;
-     ttstate_t *thread_state;
+get_process_next_stopped_thread_id (int pid, ttstate_t *thread_state)
 {
   int tt_status;
 
@@ -1488,8 +1451,7 @@
    NOTE: currently not called.
  */
 static lwpid_t
-get_active_tid_of_pid (pid)
-     int pid;
+get_active_tid_of_pid (int pid)
 {
   ttstate_t thread_state;
 
@@ -1500,8 +1462,7 @@
  * operates upon all threads of a (i.e., the entire) process.
  */
 int
-is_process_ttrace_request (tt_request)
-     ttreq_t tt_request;
+is_process_ttrace_request (ttreq_t tt_request)
 {
   return IS_TTRACE_PROCREQ (tt_request);
 }
@@ -1511,8 +1472,7 @@
  * the equivalent process request for a one-thread process.
  */
 static ttreq_t
-make_process_version (request)
-     ttreq_t request;
+make_process_version (ttreq_t request)
 {
   if (!IS_TTRACE_REQ (request))
     {
@@ -1556,10 +1516,8 @@
  * reasons).
  */
 static int
-call_ttrace (request, gdb_tid, addr, data, addr2)
-     ttreq_t request;
-     int gdb_tid;
-     TTRACE_ARG_TYPE addr, data, addr2;
+call_ttrace (ttreq_t request, int gdb_tid, TTRACE_ARG_TYPE addr,
+	     TTRACE_ARG_TYPE data, TTRACE_ARG_TYPE addr2)
 {
   lwpid_t real_tid;
   int real_pid;
@@ -1757,8 +1715,7 @@
  *       very careful, and only call TT_PROC_STOP when you mean it!
  */
 static void
-stop_all_threads_of_process (real_pid)
-     pid_t real_pid;
+stop_all_threads_of_process (pid_t real_pid)
 {
   int ttw_status;
 
@@ -1796,9 +1753,7 @@
   (((evt) == TTEVT_VFORK) && ((pid) == inferior_pid))
 
 static int
-can_touch_threads_of_process (pid, stopping_event)
-     int pid;
-     ttevents_t stopping_event;
+can_touch_threads_of_process (int pid, ttevents_t stopping_event)
 {
   if (CHILD_VFORKED (stopping_event, pid))
     {
@@ -1826,9 +1781,7 @@
  * been stopped, undefined behaviour is guaranteed!
  */
 static int
-select_stopped_thread_of_process (pid, tsp)
-     int pid;
-     ttstate_t *tsp;
+select_stopped_thread_of_process (int pid, ttstate_t *tsp)
 {
   lwpid_t candidate_tid, tid;
   ttstate_t candidate_tstate, tstate;
@@ -1982,8 +1935,7 @@
 /* Check our internal thread data against the real thing.
  */
 static void
-check_thread_consistency (real_pid)
-     pid_t real_pid;
+check_thread_consistency (pid_t real_pid)
 {
   int tid;			/* really lwpid_t */
   ttstate_t tstate;
@@ -2049,11 +2001,7 @@
  * Return value is the status of the pseudo wait.
  */
 static int
-call_ttrace_wait (pid, option, tsp, tsp_size)
-     int pid;
-     ttwopt_t option;
-     ttstate_t *tsp;
-     size_t tsp_size;
+call_ttrace_wait (int pid, ttwopt_t option, ttstate_t *tsp, size_t tsp_size)
 {
   /* This holds the actual, for-real, true process ID.
    */
@@ -2350,7 +2298,7 @@
 
 #if defined(CHILD_REPORTED_EXEC_EVENTS_PER_EXEC_CALL)
 int
-child_reported_exec_events_per_exec_call ()
+child_reported_exec_events_per_exec_call (void)
 {
   return 1;			/* ttrace reports the event once per call. */
 }
@@ -2400,7 +2348,7 @@
 
 
 static void
-require_memory_page_dictionary ()
+require_memory_page_dictionary (void)
 {
   int i;
 
@@ -2422,7 +2370,7 @@
 
 
 static void
-retire_memory_page_dictionary ()
+retire_memory_page_dictionary (void)
 {
   memory_page_dictionary.page_count = (LONGEST) - 1;
 }
@@ -2433,9 +2381,7 @@
    Returns the original permissions of the page.
  */
 static int
-write_protect_page (pid, page_start)
-     int pid;
-     CORE_ADDR page_start;
+write_protect_page (int pid, CORE_ADDR page_start)
 {
   int tt_status;
   int original_permissions;
@@ -2474,10 +2420,7 @@
    (what we must assume are) its original permissions.
  */
 static void
-unwrite_protect_page (pid, page_start, original_permissions)
-     int pid;
-     CORE_ADDR page_start;
-     int original_permissions;
+unwrite_protect_page (int pid, CORE_ADDR page_start, int original_permissions)
 {
   int tt_status;
 
@@ -2500,8 +2443,7 @@
    presently should be write-protected), write-protect it.
  */
 void
-hppa_enable_page_protection_events (pid)
-     int pid;
+hppa_enable_page_protection_events (int pid)
 {
   int bucket;
 
@@ -2528,8 +2470,7 @@
    presently is or should be write-protected), un-write-protect it.
  */
 void
-hppa_disable_page_protection_events (pid)
-     int pid;
+hppa_disable_page_protection_events (int pid)
 {
   int bucket;
 
@@ -2556,9 +2497,7 @@
  * Note: we could just scan our own thread list.  FIXME!
  */
 static int
-count_unhandled_events (real_pid, real_tid)
-     int real_pid;
-     lwpid_t real_tid;
+count_unhandled_events (int real_pid, lwpid_t real_tid)
 {
   ttstate_t tstate;
   lwpid_t ttid;
@@ -2656,9 +2595,7 @@
  * Note: used by core gdb and so uses the pseudo-pid (really tid).
  */
 int
-ptrace_wait (pid, status)
-     int pid;
-     int *status;
+ptrace_wait (int pid, int *status)
 {
   ttstate_t tsp;
   int ttwait_return;
@@ -3000,7 +2937,7 @@
    child_acknowledge_created_inferior.)
  */
 int
-parent_attach_all ()
+parent_attach_all (void)
 {
   int tt_status;
 
@@ -3059,8 +2996,7 @@
  * have to be the common part of both.
  */
 static void
-require_notification_of_events (real_pid)
-     int real_pid;
+require_notification_of_events (int real_pid)
 {
   int tt_status;
   ttevent_t notifiable_events;
@@ -3110,8 +3046,7 @@
 }
 
 static void
-require_notification_of_exec_events (real_pid)
-     int real_pid;
+require_notification_of_exec_events (int real_pid)
 {
   int tt_status;
   ttevent_t notifiable_events;
@@ -3155,8 +3090,7 @@
  * ID of the child process, after the debugger has forked.
  */
 void
-child_acknowledge_created_inferior (pid)
-     int pid;
+child_acknowledge_created_inferior (int pid)
 {
   /* We need a memory home for a constant, to pass it to ttrace.
      The value of the constant is arbitrary, so long as both
@@ -3215,8 +3149,7 @@
  * calling require_notification_of_events.
  */
 void
-child_post_startup_inferior (real_pid)
-     int real_pid;
+child_post_startup_inferior (int real_pid)
 {
   require_notification_of_events (real_pid);
 }
@@ -3224,8 +3157,7 @@
 /* From here on, we should expect tids rather than pids.
  */
 static void
-hppa_enable_catch_fork (tid)
-     int tid;
+hppa_enable_catch_fork (int tid)
 {
   int tt_status;
   ttevent_t ttrace_events;
@@ -3259,8 +3191,7 @@
 
 
 static void
-hppa_disable_catch_fork (tid)
-     int tid;
+hppa_disable_catch_fork (int tid)
 {
   int tt_status;
   ttevent_t ttrace_events;
@@ -3297,8 +3228,7 @@
 
 #if defined(CHILD_INSERT_FORK_CATCHPOINT)
 int
-child_insert_fork_catchpoint (tid)
-     int tid;
+child_insert_fork_catchpoint (int tid)
 {
   /* Enable reporting of fork events from the kernel. */
   /* ??rehrauer: For the moment, we're always enabling these events,
@@ -3311,8 +3241,7 @@
 
 #if defined(CHILD_REMOVE_FORK_CATCHPOINT)
 int
-child_remove_fork_catchpoint (tid)
-     int tid;
+child_remove_fork_catchpoint (int tid)
 {
   /* Disable reporting of fork events from the kernel. */
   /* ??rehrauer: For the moment, we're always enabling these events,
@@ -3324,8 +3253,7 @@
 
 
 static void
-hppa_enable_catch_vfork (tid)
-     int tid;
+hppa_enable_catch_vfork (int tid)
 {
   int tt_status;
   ttevent_t ttrace_events;
@@ -3361,8 +3289,7 @@
 
 
 static void
-hppa_disable_catch_vfork (tid)
-     int tid;
+hppa_disable_catch_vfork (int tid)
 {
   int tt_status;
   ttevent_t ttrace_events;
@@ -3397,8 +3324,7 @@
 
 #if defined(CHILD_INSERT_VFORK_CATCHPOINT)
 int
-child_insert_vfork_catchpoint (tid)
-     int tid;
+child_insert_vfork_catchpoint (int tid)
 {
   /* Enable reporting of vfork events from the kernel. */
   /* ??rehrauer: For the moment, we're always enabling these events,
@@ -3411,8 +3337,7 @@
 
 #if defined(CHILD_REMOVE_VFORK_CATCHPOINT)
 int
-child_remove_vfork_catchpoint (tid)
-     int tid;
+child_remove_vfork_catchpoint (int tid)
 {
   /* Disable reporting of vfork events from the kernel. */
   /* ??rehrauer: For the moment, we're always enabling these events,
@@ -3431,9 +3356,7 @@
  *    start the mapping.
  */
 int
-child_has_forked (tid, childpid)
-     int tid;
-     int *childpid;
+child_has_forked (int tid, int *childpid)
 {
   int tt_status;
   ttstate_t ttrace_state;
@@ -3478,9 +3401,7 @@
 /* See child_has_forked for pid discussion.
  */
 int
-child_has_vforked (tid, childpid)
-     int tid;
-     int *childpid;
+child_has_vforked (int tid, int *childpid)
 {
   int tt_status;
   ttstate_t ttrace_state;
@@ -3520,7 +3441,7 @@
 
 #if defined(CHILD_CAN_FOLLOW_VFORK_PRIOR_TO_EXEC)
 int
-child_can_follow_vfork_prior_to_exec ()
+child_can_follow_vfork_prior_to_exec (void)
 {
   /* ttrace does allow this.
 
@@ -3535,8 +3456,7 @@
 
 #if defined(CHILD_INSERT_EXEC_CATCHPOINT)
 int
-child_insert_exec_catchpoint (tid)
-     int tid;
+child_insert_exec_catchpoint (int tid)
 {
   /* Enable reporting of exec events from the kernel. */
   /* ??rehrauer: For the moment, we're always enabling these events,
@@ -3549,8 +3469,7 @@
 
 #if defined(CHILD_REMOVE_EXEC_CATCHPOINT)
 int
-child_remove_exec_catchpoint (tid)
-     int tid;
+child_remove_exec_catchpoint (int tid)
 {
   /* Disable reporting of execevents from the kernel. */
   /* ??rehrauer: For the moment, we're always enabling these events,
@@ -3563,9 +3482,7 @@
 
 #if defined(CHILD_HAS_EXECD)
 int
-child_has_execd (tid, execd_pathname)
-     int tid;
-     char **execd_pathname;
+child_has_execd (int tid, char **execd_pathname)
 {
   int tt_status;
   ttstate_t ttrace_state;
@@ -3609,10 +3526,7 @@
 
 #if defined(CHILD_HAS_SYSCALL_EVENT)
 int
-child_has_syscall_event (pid, kind, syscall_id)
-     int pid;
-     enum target_waitkind *kind;
-     int *syscall_id;
+child_has_syscall_event (int pid, enum target_waitkind *kind, int *syscall_id)
 {
   int tt_status;
   ttstate_t ttrace_state;
@@ -3667,8 +3581,7 @@
  * May need a FIXME for that reason.
  */
 int
-child_thread_alive (gdb_tid)
-     lwpid_t gdb_tid;
+child_thread_alive (lwpid_t gdb_tid)
 {
   lwpid_t tid;
 
@@ -3694,11 +3607,8 @@
    undefined it this function fails.
  */
 int
-read_from_register_save_state (tid, ss_offset, buf, sizeof_buf)
-     int tid;
-     TTRACE_ARG_TYPE ss_offset;
-     char *buf;
-     int sizeof_buf;
+read_from_register_save_state (int tid, TTRACE_ARG_TYPE ss_offset, char *buf,
+			       int sizeof_buf)
 {
   int tt_status;
   register_value_t register_value = 0;
@@ -3729,11 +3639,8 @@
    are undefined it this function fails.
  */
 int
-write_to_register_save_state (tid, ss_offset, buf, sizeof_buf)
-     int tid;
-     TTRACE_ARG_TYPE ss_offset;
-     char *buf;
-     int sizeof_buf;
+write_to_register_save_state (int tid, TTRACE_ARG_TYPE ss_offset, char *buf,
+			      int sizeof_buf)
 {
   int tt_status;
   register_value_t register_value = 0;
@@ -3758,11 +3665,7 @@
    process-specific, ttrace equivalents.
  */
 int
-call_ptrace (pt_request, gdb_tid, addr, data)
-     int pt_request;
-     int gdb_tid;
-     PTRACE_ARG3_TYPE addr;
-     int data;
+call_ptrace (int pt_request, int gdb_tid, PTRACE_ARG3_TYPE addr, int data)
 {
   ttreq_t tt_request;
   TTRACE_ARG_TYPE tt_addr = (TTRACE_ARG_TYPE) addr;
@@ -3903,7 +3806,7 @@
 /* Kill that pesky process!
  */
 void
-kill_inferior ()
+kill_inferior (void)
 {
   int tid;
   int wait_status;
@@ -3965,7 +3868,7 @@
       t = t->next;
     }
 
-  free (paranoia);
+  xfree (paranoia);
 
   call_ttrace (TT_PROC_STOP,
 	       inferior_pid,
@@ -3982,8 +3885,7 @@
 /* Sanity check a thread about to be continued.
  */
 static void
-thread_dropping_event_check (p)
-     thread_info *p;
+thread_dropping_event_check (thread_info *p)
 {
   if (!p->handled)
     {
@@ -4044,9 +3946,7 @@
  * the one specified, which is to be stepped.
  */
 static void
-threads_continue_all_but_one (gdb_tid, signal)
-     lwpid_t gdb_tid;
-     int signal;
+threads_continue_all_but_one (lwpid_t gdb_tid, int signal)
 {
   thread_info *p;
   int thread_signal;
@@ -4183,9 +4083,7 @@
  * This is done when a signal must be sent to any of the threads.
  */
 static void
-threads_continue_all_with_signals (gdb_tid, signal)
-     lwpid_t gdb_tid;
-     int signal;
+threads_continue_all_with_signals (lwpid_t gdb_tid, int signal)
 {
   thread_info *p;
   int thread_signal;
@@ -4301,9 +4199,7 @@
 /* Step one thread only.  
  */
 static void
-thread_fake_step (tid, signal)
-     lwpid_t tid;
-     enum target_signal signal;
+thread_fake_step (lwpid_t tid, enum target_signal signal)
 {
   thread_info *p;
 
@@ -4356,9 +4252,7 @@
 /* Continue one thread when a signal must be sent to it.
  */
 static void
-threads_continue_one_with_signal (gdb_tid, signal)
-     lwpid_t gdb_tid;
-     int signal;
+threads_continue_one_with_signal (lwpid_t gdb_tid, int signal)
 {
   thread_info *p;
   lwpid_t real_tid;
@@ -4428,10 +4322,7 @@
  *       |                           user command.
  */
 void
-child_resume (gdb_tid, step, signal)
-     lwpid_t gdb_tid;
-     int step;
-     enum target_signal signal;
+child_resume (lwpid_t gdb_tid, int step, enum target_signal signal)
 {
   int resume_all_threads;
   lwpid_t tid;
@@ -4761,9 +4652,7 @@
  * 
  */
 static void
-update_thread_state_after_attach (pid, kind_of_go)
-     int pid;
-     attach_continue_t kind_of_go;
+update_thread_state_after_attach (int pid, attach_continue_t kind_of_go)
 {
   int tt_status;
   ttstate_t thread_state;
@@ -4822,7 +4711,7 @@
       if (NULL == p)		/* ?We just added it! */
 	error ("Internal error adding a thread on attach.");
 
-      copy_ttstate_t (&p->last_stop_state, thread_state);
+      copy_ttstate_t (&p->last_stop_state, &thread_state);
       p->have_state = 1;
 
       if (DO_ATTACH_CONTINUE == kind_of_go)
@@ -4934,8 +4823,7 @@
  * (A _real_ pid).
  */
 int
-attach (pid)
-     int pid;
+attach (int pid)
 {
   int tt_status;
 
@@ -4966,8 +4854,7 @@
 
 #if defined(CHILD_POST_ATTACH)
 void
-child_post_attach (pid)
-     int pid;
+child_post_attach (int pid)
 {
 #ifdef THREAD_DEBUG
   if (debug_on)
@@ -4984,8 +4871,7 @@
    SIGNAL = 0 means just continue it.
  */
 void
-detach (signal)
-     int signal;
+detach (int signal)
 {
   errno = 0;
   call_ttrace (TT_PROC_DETACH,
@@ -5008,7 +4894,7 @@
 #endif
 
 void
-_initialize_kernel_u_addr ()
+_initialize_kernel_u_addr (void)
 {
 }
 
@@ -5021,7 +4907,7 @@
 
 /* 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.
+   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 child_ops
@@ -5029,12 +4915,8 @@
    anyway.  */
 
 int
-child_xfer_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* ignored */
+child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		   struct target_ops *target)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -5128,7 +5010,7 @@
 
 
 static void
-udot_info ()
+udot_info (void)
 {
   int udot_off;			/* Offset into user struct */
   int udot_val;			/* Value from user struct at udot_off */
@@ -5181,8 +5063,7 @@
 /* TTrace version of "target_pid_to_exec_file"
  */
 char *
-child_pid_to_exec_file (tid)
-     int tid;
+child_pid_to_exec_file (int tid)
 {
   static char exec_file_buffer[1024];
   int tt_status;
@@ -5254,7 +5135,7 @@
 
 
 void
-pre_fork_inferior ()
+pre_fork_inferior (void)
 {
   int status;
 
@@ -5283,8 +5164,7 @@
  * seems odd--it always fails in our test system.
  */
 int
-hppa_require_attach (pid)
-     int pid;
+hppa_require_attach (int pid)
 {
   int tt_status;
   CORE_ADDR pc;
@@ -5342,9 +5222,7 @@
 }
 
 int
-hppa_require_detach (pid, signal)
-     int pid;
-     int signal;
+hppa_require_detach (int pid, int signal)
 {
   int tt_status;
 
@@ -5376,8 +5254,7 @@
    the memory page dictionary.
  */
 static int
-get_dictionary_bucket_of_page (page_start)
-     CORE_ADDR page_start;
+get_dictionary_bucket_of_page (CORE_ADDR page_start)
 {
   int hash;
 
@@ -5394,16 +5271,14 @@
    count of 0 (if the page was newly-added to the dictionary).
  */
 static memory_page_t *
-get_dictionary_entry_of_page (pid, page_start)
-     int pid;
-     CORE_ADDR page_start;
+get_dictionary_entry_of_page (int pid, CORE_ADDR page_start)
 {
   int bucket;
   memory_page_t *page = NULL;
   memory_page_t *previous_page = NULL;
 
   /* We're going to be using the dictionary now, than-kew. */
-  require_memory_page_dictionary (pid);
+  require_memory_page_dictionary ();
 
   /* Try to find an existing dictionary entry for this page.  Hash
      on the page's starting address.
@@ -5445,9 +5320,7 @@
 
 
 static void
-remove_dictionary_entry_of_page (pid, page)
-     int pid;
-     memory_page_t *page;
+remove_dictionary_entry_of_page (int pid, memory_page_t *page)
 {
   /* Restore the page's original permissions. */
   unwrite_protect_page (pid, page->page_start, page->original_permissions);
@@ -5463,13 +5336,12 @@
 
   memory_page_dictionary.page_count--;
 
-  free (page);
+  xfree (page);
 }
 
 
 static void
-hppa_enable_syscall_events (pid)
-     int pid;
+hppa_enable_syscall_events (int pid)
 {
   int tt_status;
   ttevent_t ttrace_events;
@@ -5498,8 +5370,7 @@
 
 
 static void
-hppa_disable_syscall_events (pid)
-     int pid;
+hppa_disable_syscall_events (int pid)
 {
   int tt_status;
   ttevent_t ttrace_events;
@@ -5540,11 +5411,7 @@
    from the TYPE that is passed to hppa_remove_hw_watchpoint.)
  */
 int
-hppa_insert_hw_watchpoint (pid, start, len, type)
-     int pid;
-     CORE_ADDR start;
-     LONGEST len;
-     int type;
+hppa_insert_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len, int type)
 {
   CORE_ADDR page_start;
   int dictionary_was_empty;
@@ -5617,11 +5484,8 @@
    watchpoints.
  */
 int
-hppa_remove_hw_watchpoint (pid, start, len, type)
-     int pid;
-     CORE_ADDR start;
-     LONGEST len;
-     enum bptype type;
+hppa_remove_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len,
+			   enum bptype type)
 {
   CORE_ADDR page_start;
   int dictionary_is_empty;
@@ -5681,10 +5545,7 @@
    hardware support.
  */
 int
-hppa_can_use_hw_watchpoint (type, cnt, ot)
-     enum bptype type;
-     int cnt;
-     enum bptype ot;
+hppa_can_use_hw_watchpoint (enum bptype type, int cnt, enum bptype ot)
 {
   return (type == bp_hardware_watchpoint);
 }
@@ -5696,10 +5557,7 @@
    on the address...
  */
 int
-hppa_range_profitable_for_hw_watchpoint (pid, start, len)
-     int pid;
-     CORE_ADDR start;
-     LONGEST len;
+hppa_range_profitable_for_hw_watchpoint (int pid, CORE_ADDR start, LONGEST len)
 {
   int range_is_stack_based;
   int range_is_accessible;
@@ -5766,8 +5624,7 @@
 
 
 char *
-hppa_pid_or_tid_to_str (id)
-     pid_t id;
+hppa_pid_or_tid_to_str (pid_t id)
 {
   static char buf[100];		/* Static because address returned. */
 
@@ -5792,8 +5649,7 @@
  * the old thread id, else return 0.
  */
 pid_t
-hppa_switched_threads (gdb_pid)
-     pid_t gdb_pid;
+hppa_switched_threads (pid_t gdb_pid)
 {
   if (gdb_pid == old_gdb_pid)
     {
@@ -5844,8 +5700,7 @@
 }
 
 void
-hppa_ensure_vforking_parent_remains_stopped (pid)
-     int pid;
+hppa_ensure_vforking_parent_remains_stopped (int pid)
 {
   /* Nothing to do when using ttrace.  Only the ptrace-based implementation
      must do real work.
@@ -5854,7 +5709,7 @@
 
 
 int
-hppa_resume_execd_vforking_child_to_get_parent_vfork ()
+hppa_resume_execd_vforking_child_to_get_parent_vfork (void)
 {
   return 0;			/* No, the parent vfork is available now. */
 }
@@ -5867,10 +5722,7 @@
    This is horribly gross and disgusting.  */
  
 int
-ttrace_write_reg_64 (gdb_tid, dest_addr, src_addr)
-     int gdb_tid;
-     CORE_ADDR dest_addr;
-     CORE_ADDR src_addr;
+ttrace_write_reg_64 (int gdb_tid, CORE_ADDR dest_addr, CORE_ADDR src_addr)
 {
   pid_t 	pid;
   lwpid_t 	tid;
@@ -5911,7 +5763,7 @@
 }
 
 void
-_initialize_infttrace ()
+_initialize_infttrace (void)
 {
   /* Initialize the ttrace-based hardware watchpoint implementation. */
   memory_page_dictionary.page_count = (LONGEST) - 1;
diff --git a/gdb/irix4-nat.c b/gdb/irix4-nat.c
index b3e288c..506d57b 100644
--- a/gdb/irix4-nat.c
+++ b/gdb/irix4-nat.c
@@ -46,8 +46,7 @@
  */
 
 void
-supply_gregset (gregsetp)
-     gregset_t *gregsetp;
+supply_gregset (gregset_t *gregsetp)
 {
   register int regi;
   register greg_t *regp = (greg_t *) (gregsetp->gp_regs);
@@ -69,9 +68,7 @@
 }
 
 void
-fill_gregset (gregsetp, regno)
-     gregset_t *gregsetp;
-     int regno;
+fill_gregset (gregset_t *gregsetp, int regno)
 {
   int regi;
   register greg_t *regp = (greg_t *) (gregsetp->gp_regs);
@@ -103,8 +100,7 @@
  */
 
 void
-supply_fpregset (fpregsetp)
-     fpregset_t *fpregsetp;
+supply_fpregset (fpregset_t *fpregsetp)
 {
   register int regi;
   static char zerobuf[MAX_REGISTER_RAW_SIZE] =
@@ -121,9 +117,7 @@
 }
 
 void
-fill_fpregset (fpregsetp, regno)
-     fpregset_t *fpregsetp;
-     int regno;
+fill_fpregset (fpregset_t *fpregsetp, int regno)
 {
   int regi;
   char *from, *to;
@@ -149,12 +143,12 @@
    This routine returns true on success. */
 
 int
-get_longjmp_target (pc)
-     CORE_ADDR *pc;
+get_longjmp_target (CORE_ADDR *pc)
 {
-  char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
+  char *buf;
   CORE_ADDR jb_addr;
 
+  buf = alloca (TARGET_PTR_BIT / TARGET_CHAR_BIT);
   jb_addr = read_register (A0_REGNUM);
 
   if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf,
@@ -166,12 +160,22 @@
   return 1;
 }
 
+/* Provide registers to GDB from a core file.
+
+   CORE_REG_SECT points to an array of bytes, which were obtained from
+   a core file which BFD thinks might contain register contents. 
+   CORE_REG_SIZE is its size.
+
+   Normally, WHICH says which register set corelow suspects this is:
+     0 --- the general-purpose register set
+     2 --- the floating-point register set
+   However, for Irix 4, WHICH isn't used.
+
+   REG_ADDR is also unused.  */
+
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;			/* Unused */
-     CORE_ADDR reg_addr;	/* Unused */
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
+		      int which, CORE_ADDR reg_addr)
 {
   if (core_reg_size != REGISTER_BYTES)
     {
@@ -196,7 +200,7 @@
 };
 
 void
-_initialize_core_irix4 ()
+_initialize_core_irix4 (void)
 {
   add_core_fns (&irix4_core_fns);
 }
diff --git a/gdb/irix5-nat.c b/gdb/irix5-nat.c
index ea37b8c..5fe41fa 100644
--- a/gdb/irix5-nat.c
+++ b/gdb/irix5-nat.c
@@ -50,8 +50,7 @@
  */
 
 void
-supply_gregset (gregsetp)
-     gregset_t *gregsetp;
+supply_gregset (gregset_t *gregsetp)
 {
   register int regi;
   register greg_t *regp = &(*gregsetp)[0];
@@ -72,9 +71,7 @@
 }
 
 void
-fill_gregset (gregsetp, regno)
-     gregset_t *gregsetp;
-     int regno;
+fill_gregset (gregset_t *gregsetp, int regno)
 {
   int regi;
   register greg_t *regp = &(*gregsetp)[0];
@@ -119,8 +116,7 @@
  */
 
 void
-supply_fpregset (fpregsetp)
-     fpregset_t *fpregsetp;
+supply_fpregset (fpregset_t *fpregsetp)
 {
   register int regi;
   static char zerobuf[MAX_REGISTER_RAW_SIZE] =
@@ -139,9 +135,7 @@
 }
 
 void
-fill_fpregset (fpregsetp, regno)
-     fpregset_t *fpregsetp;
-     int regno;
+fill_fpregset (fpregset_t *fpregsetp, int regno)
 {
   int regi;
   char *from, *to;
@@ -169,12 +163,12 @@
    This routine returns true on success. */
 
 int
-get_longjmp_target (pc)
-     CORE_ADDR *pc;
+get_longjmp_target (CORE_ADDR *pc)
 {
-  char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
+  char *buf;
   CORE_ADDR jb_addr;
 
+  buf = alloca (TARGET_PTR_BIT / TARGET_CHAR_BIT);
   jb_addr = read_register (A0_REGNUM);
 
   if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf,
@@ -186,12 +180,22 @@
   return 1;
 }
 
+/* Provide registers to GDB from a core file.
+
+   CORE_REG_SECT points to an array of bytes, which were obtained from
+   a core file which BFD thinks might contain register contents. 
+   CORE_REG_SIZE is its size.
+
+   Normally, WHICH says which register set corelow suspects this is:
+     0 --- the general-purpose register set
+     2 --- the floating-point register set
+   However, for Irix 5, WHICH isn't used.
+
+   REG_ADDR is also unused.  */
+
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;			/* Unused */
-     CORE_ADDR reg_addr;	/* Unused */
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
+		      int which, CORE_ADDR reg_addr)
 {
   if (core_reg_size == REGISTER_BYTES)
     {
@@ -405,7 +409,7 @@
   bfd *abfd;
 
   filename = tilde_expand (so->so_name);
-  old_chain = make_cleanup (free, filename);
+  old_chain = make_cleanup (xfree, filename);
 
   scratch_chan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0,
 			&scratch_pathname);
@@ -511,7 +515,7 @@
  */
 
 static CORE_ADDR
-locate_base ()
+locate_base (void)
 {
   struct minimal_symbol *msymbol;
   CORE_ADDR address = 0;
@@ -542,7 +546,7 @@
  */
 
 static struct link_map *
-first_link_map_member ()
+first_link_map_member (void)
 {
   struct obj_list *listp;
   struct obj_list list_old;
@@ -610,8 +614,7 @@
  */
 
 static struct link_map *
-next_link_map_member (so_list_ptr)
-     struct so_list *so_list_ptr;
+next_link_map_member (struct so_list *so_list_ptr)
 {
   struct link_map *lm = &so_list_ptr->lm;
   CORE_ADDR next_lladdr = lm->l_next;
@@ -670,9 +673,7 @@
  */
 
 static void
-xfer_link_map_member (so_list_ptr, lm)
-     struct so_list *so_list_ptr;
-     struct link_map *lm;
+xfer_link_map_member (struct so_list *so_list_ptr, struct link_map *lm)
 {
   struct obj_list list_old;
   CORE_ADDR lladdr = lm->l_lladdr;
@@ -773,8 +774,7 @@
  */
 
 static struct so_list *
-find_solib (so_list_ptr)
-     struct so_list *so_list_ptr;	/* Last lm or NULL for first one */
+find_solib (struct so_list *so_list_ptr)
 {
   struct so_list *so_list_next = NULL;
   struct link_map *lm = NULL;
@@ -868,10 +868,7 @@
  */
 
 void
-solib_add (arg_string, from_tty, target)
-     char *arg_string;
-     int from_tty;
-     struct target_ops *target;
+solib_add (char *arg_string, int from_tty, struct target_ops *target)
 {
   register struct so_list *so = NULL;	/* link map state variable */
 
@@ -968,9 +965,7 @@
  */
 
 static void
-info_sharedlibrary_command (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+info_sharedlibrary_command (char *ignore, int from_tty)
 {
   register struct so_list *so = NULL;	/* link map state variable */
   int header_done = 0;
@@ -1031,8 +1026,7 @@
  */
 
 char *
-solib_address (address)
-     CORE_ADDR address;
+solib_address (CORE_ADDR address)
 {
   register struct so_list *so = 0;	/* link map state variable */
 
@@ -1051,7 +1045,7 @@
 /* Called by free_all_symtabs */
 
 void
-clear_solib ()
+clear_solib (void)
 {
   struct so_list *next;
   char *bfd_filename;
@@ -1062,7 +1056,7 @@
     {
       if (so_list_head->sections)
 	{
-	  free ((PTR) so_list_head->sections);
+	  xfree (so_list_head->sections);
 	}
       if (so_list_head->abfd)
 	{
@@ -1077,9 +1071,9 @@
 
       next = so_list_head->next;
       if (bfd_filename)
-	free ((PTR) bfd_filename);
-      free (so_list_head->so_name);
-      free ((PTR) so_list_head);
+	xfree (bfd_filename);
+      xfree (so_list_head->so_name);
+      xfree (so_list_head);
       so_list_head = next;
     }
   debug_base = 0;
@@ -1103,7 +1097,7 @@
  */
 
 static int
-disable_break ()
+disable_break (void)
 {
   int status = 1;
 
@@ -1145,7 +1139,7 @@
  */
 
 static int
-enable_break ()
+enable_break (void)
 {
   if (symfile_objfile != NULL
       && target_insert_breakpoint (symfile_objfile->ei.entry_point,
@@ -1211,7 +1205,7 @@
  */
 
 void
-solib_create_inferior_hook ()
+solib_create_inferior_hook (void)
 {
   if (!enable_break ())
     {
@@ -1276,16 +1270,14 @@
  */
 
 static void
-sharedlibrary_command (args, from_tty)
-     char *args;
-     int from_tty;
+sharedlibrary_command (char *args, int from_tty)
 {
   dont_repeat ();
   solib_add (args, from_tty, (struct target_ops *) 0);
 }
 
 void
-_initialize_solib ()
+_initialize_solib (void)
 {
   add_com ("sharedlibrary", class_files, sharedlibrary_command,
 	   "Load shared object library symbols for files matching REGEXP.");
@@ -1318,7 +1310,7 @@
 };
 
 void
-_initialize_core_irix5 ()
+_initialize_core_irix5 (void)
 {
   add_core_fns (&irix5_core_fns);
 }
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index 4c08c73..37fab62 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -69,7 +69,7 @@
 static struct type *java_link_class_type (struct type *, value_ptr);
 
 static struct objfile *
-get_dynamics_objfile ()
+get_dynamics_objfile (void)
 {
   if (dynamics_objfile == NULL)
     {
@@ -88,7 +88,7 @@
 static int class_symtab_space;
 
 static struct symtab *
-get_java_class_symtab ()
+get_java_class_symtab (void)
 {
   if (class_symtab == NULL)
     {
@@ -127,8 +127,7 @@
 }
 
 static void
-add_class_symtab_symbol (sym)
-     struct symbol *sym;
+add_class_symtab_symbol (struct symbol *sym)
 {
   struct symtab *symtab = get_java_class_symtab ();
   struct blockvector *bv = BLOCKVECTOR (symtab);
@@ -152,9 +151,7 @@
 static struct symbol *add_class_symbol (struct type *type, CORE_ADDR addr);
 
 static struct symbol *
-add_class_symbol (type, addr)
-     struct type *type;
-     CORE_ADDR addr;
+add_class_symbol (struct type *type, CORE_ADDR addr)
 {
   struct symbol *sym;
   sym = (struct symbol *)
@@ -172,8 +169,7 @@
 #endif
 
 struct type *
-java_lookup_class (name)
-     char *name;
+java_lookup_class (char *name)
 {
   struct symbol *sym;
   sym = lookup_symbol (name, expression_context_block, STRUCT_NAMESPACE,
@@ -210,9 +206,7 @@
    a name given by NAME (which has type Utf8Const*). */
 
 char *
-get_java_utf8_name (obstack, name)
-     struct obstack *obstack;
-     value_ptr name;
+get_java_utf8_name (struct obstack *obstack, value_ptr name)
 {
   char *chrs;
   value_ptr temp = name;
@@ -229,8 +223,7 @@
 }
 
 value_ptr
-java_class_from_object (obj_val)
-     value_ptr obj_val;
+java_class_from_object (value_ptr obj_val)
 {
   /* This is all rather inefficient, since the offsets of vtable and
      class are fixed.  FIXME */
@@ -247,8 +240,7 @@
 
 /* Check if CLASS_IS_PRIMITIVE(value of clas): */
 static int
-java_class_is_primitive (clas)
-     value_ptr clas;
+java_class_is_primitive (value_ptr clas)
 {
   value_ptr vtable = value_struct_elt (&clas, NULL, "vtable", NULL, "struct");
   CORE_ADDR i = value_as_pointer (vtable);
@@ -258,8 +250,7 @@
 /* Read a GCJ Class object, and generated a gdb (TYPE_CODE_STRUCT) type. */
 
 struct type *
-type_from_class (clas)
-     value_ptr clas;
+type_from_class (value_ptr clas)
 {
   struct type *type;
   char *name;
@@ -346,9 +337,7 @@
 /* Fill in class TYPE with data from the CLAS value. */
 
 struct type *
-java_link_class_type (type, clas)
-     struct type *type;
-     value_ptr clas;
+java_link_class_type (struct type *type, value_ptr clas)
 {
   value_ptr temp;
   char *unqualified_name;
@@ -583,7 +572,7 @@
 static struct type *java_object_type;
 
 struct type *
-get_java_object_type ()
+get_java_object_type (void)
 {
   if (java_object_type == NULL)
     {
@@ -598,7 +587,7 @@
 }
 
 int
-get_java_object_header_size ()
+get_java_object_header_size (void)
 {
   struct type *objtype = get_java_object_type ();
   if (objtype == NULL)
@@ -608,8 +597,7 @@
 }
 
 int
-is_object_type (type)
-     struct type *type;
+is_object_type (struct type *type)
 {
   CHECK_TYPEDEF (type);
   if (TYPE_CODE (type) == TYPE_CODE_PTR)
@@ -635,8 +623,7 @@
 }
 
 struct type *
-java_primitive_type (signature)
-     int signature;
+java_primitive_type (int signature)
 {
   switch (signature)
     {
@@ -666,9 +653,7 @@
    return that type.  Otherwise, return NULL. */
 
 struct type *
-java_primitive_type_from_name (name, namelen)
-     char *name;
-     int namelen;
+java_primitive_type_from_name (char *name, int namelen)
 {
   switch (name[0])
     {
@@ -713,8 +698,7 @@
    signature string SIGNATURE. */
 
 static int
-java_demangled_signature_length (signature)
-     char *signature;
+java_demangled_signature_length (char *signature)
 {
   int array = 0;
   for (; *signature == '['; signature++)
@@ -732,9 +716,7 @@
 /* Demangle the Java type signature SIGNATURE, leaving the result in RESULT. */
 
 static void
-java_demangled_signature_copy (result, signature)
-     char *result;
-     char *signature;
+java_demangled_signature_copy (char *result, char *signature)
 {
   int array = 0;
   char *ptr;
@@ -776,8 +758,7 @@
    as a freshly allocated copy. */
 
 char *
-java_demangle_type_signature (signature)
-     char *signature;
+java_demangle_type_signature (char *signature)
 {
   int length = java_demangled_signature_length (signature);
   char *result = xmalloc (length + 1);
@@ -787,8 +768,7 @@
 }
 
 struct type *
-java_lookup_type (signature)
-     char *signature;
+java_lookup_type (char *signature)
 {
   switch (signature[0])
     {
@@ -804,9 +784,7 @@
    If DIMS == 0, TYPE is returned. */
 
 struct type *
-java_array_type (type, dims)
-     struct type *type;
-     int dims;
+java_array_type (struct type *type, int dims)
 {
   struct type *range_type;
 
@@ -823,9 +801,7 @@
 /* Create a Java string in the inferior from a (Utf8) literal. */
 
 static value_ptr
-java_value_string (ptr, len)
-     char *ptr;
-     int len;
+java_value_string (char *ptr, int len)
 {
   error ("not implemented - java_value_string");	/* FIXME */
 }
@@ -835,10 +811,7 @@
    characters and strings is language specific. */
 
 static void
-java_emit_char (c, stream, quoter)
-     int c;
-     struct ui_file *stream;
-     int quoter;
+java_emit_char (int c, struct ui_file *stream, int quoter)
 {
   switch (c)
     {
@@ -871,11 +844,8 @@
 }
 
 static value_ptr
-evaluate_subexp_java (expect_type, exp, pos, noside)
-     struct type *expect_type;
-     register struct expression *exp;
-     register int *pos;
-     enum noside noside;
+evaluate_subexp_java (struct type *expect_type, register struct expression *exp,
+		      register int *pos, enum noside noside)
 {
   int pc = *pos;
   int i;
@@ -986,9 +956,7 @@
 }
 
 static struct type *
-java_create_fundamental_type (objfile, typeid)
-     struct objfile *objfile;
-     int typeid;
+java_create_fundamental_type (struct objfile *objfile, int typeid)
 {
   switch (typeid)
     {
@@ -1065,6 +1033,7 @@
   c_builtin_types,
   range_check_off,
   type_check_off,
+  case_sensitive_on,
   java_parse,
   java_error,
   evaluate_subexp_java,
@@ -1087,7 +1056,7 @@
 };
 
 void
-_initialize_java_language ()
+_initialize_java_language (void)
 {
 
   java_int_type = init_type (TYPE_CODE_INT, 4, 0, "int", NULL);
@@ -1109,7 +1078,7 @@
 
 extern void java_rerun_cleanup (void);
 void
-java_rerun_cleanup ()
+java_rerun_cleanup (void)
 {
   if (class_symtab != NULL)
     {
diff --git a/gdb/jv-typeprint.c b/gdb/jv-typeprint.c
index 1b60830..7747ad1 100644
--- a/gdb/jv-typeprint.c
+++ b/gdb/jv-typeprint.c
@@ -36,9 +36,7 @@
 				  int level);
 
 static void
-java_type_print_derivation_info (stream, type)
-     struct ui_file *stream;
-     struct type *type;
+java_type_print_derivation_info (struct ui_file *stream, struct type *type)
 {
   char *name;
   int i;
@@ -84,11 +82,8 @@
    We increase it for some recursive calls.  */
 
 static void
-java_type_print_base (type, stream, show, level)
-     struct type *type;
-     struct ui_file *stream;
-     int show;
-     int level;
+java_type_print_base (struct type *type, struct ui_file *stream, int show,
+		      int level)
 {
   register int i;
   register int len;
@@ -127,7 +122,7 @@
 	{			/* array type */
 	  char *name = java_demangle_type_signature (TYPE_TAG_NAME (type));
 	  fputs_filtered (name, stream);
-	  free (name);
+	  xfree (name);
 	  break;
 	}
 
@@ -304,11 +299,11 @@
 		      }
 
 		    fputs_filtered (demangled_no_class, stream);
-		    free (demangled_name);
+		    xfree (demangled_name);
 		  }
 
 		  if (TYPE_FN_FIELD_STUB (f, j))
-		    free (mangled_name);
+		    xfree (mangled_name);
 
 		  fprintf_filtered (stream, ";\n");
 		}
@@ -329,12 +324,8 @@
 					 int, int, int);
 
 void
-java_print_type (type, varstring, stream, show, level)
-     struct type *type;
-     char *varstring;
-     struct ui_file *stream;
-     int show;
-     int level;
+java_print_type (struct type *type, char *varstring, struct ui_file *stream,
+		 int show, int level)
 {
   int demangled_args;
 
diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c
index 6f9273d..758e1f6 100644
--- a/gdb/jv-valprint.c
+++ b/gdb/jv-valprint.c
@@ -41,11 +41,8 @@
 
 
 int
-java_value_print (val, stream, format, pretty)
-     value_ptr val;
-     struct ui_file *stream;
-     int format;
-     enum val_prettyprint pretty;
+java_value_print (value_ptr val, struct ui_file *stream, int format,
+		  enum val_prettyprint pretty)
 {
   struct type *type;
   CORE_ADDR address;
@@ -99,8 +96,9 @@
 
 	  while (i < length && things_printed < print_max)
 	    {
-	      char buf[TARGET_PTR_BIT / HOST_CHAR_BIT];
+	      char *buf;
 
+	      buf = alloca (TARGET_PTR_BIT / HOST_CHAR_BIT);
 	      fputs_filtered (", ", stream);
 	      wrap_here (n_spaces (2));
 
@@ -200,9 +198,10 @@
   if (TYPE_CODE (type) == TYPE_CODE_PTR
       && TYPE_TARGET_TYPE (type)
       && TYPE_NAME (TYPE_TARGET_TYPE (type))
-    && strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "java.lang.String") == 0
+      && strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "java.lang.String") == 0
       && (format == 0 || format == 's')
-      && address != 0)
+      && address != 0
+      && value_as_pointer (val) != 0)
     {
       value_ptr data_val;
       CORE_ADDR data;
@@ -241,15 +240,9 @@
    should not print, or zero if called from top level.  */
 
 static void
-java_print_value_fields (type, valaddr, address, stream,
-			 format, recurse, pretty)
-     struct type *type;
-     char *valaddr;
-     CORE_ADDR address;
-     struct ui_file *stream;
-     int format;
-     int recurse;
-     enum val_prettyprint pretty;
+java_print_value_fields (struct type *type, char *valaddr, CORE_ADDR address,
+			 struct ui_file *stream, int format, int recurse,
+			 enum val_prettyprint pretty)
 {
   int i, len, n_baseclasses;
 
@@ -450,17 +443,9 @@
    The PRETTY parameter controls prettyprinting.  */
 
 int
-java_val_print (type, valaddr, embedded_offset, address, stream, format,
-		deref_ref, recurse, pretty)
-     struct type *type;
-     char *valaddr;
-     int embedded_offset;
-     CORE_ADDR address;
-     struct ui_file *stream;
-     int format;
-     int deref_ref;
-     int recurse;
-     enum val_prettyprint pretty;
+java_val_print (struct type *type, char *valaddr, int embedded_offset,
+		CORE_ADDR address, struct ui_file *stream, int format,
+		int deref_ref, int recurse, enum val_prettyprint pretty)
 {
   register unsigned int i = 0;	/* Number of characters printed */
   struct type *target_type;
diff --git a/gdb/kdb-start.c b/gdb/kdb-start.c
index 7a4acb7..ce4d299 100644
--- a/gdb/kdb-start.c
+++ b/gdb/kdb-start.c
@@ -28,7 +28,7 @@
 
 char **environ;
 
-start ()
+start (void)
 {
   INIT_STACK (kdb_stack_beg, kdb_stack_end);
 
diff --git a/gdb/kod-cisco.c b/gdb/kod-cisco.c
index 06ea9a7..9351734 100644
--- a/gdb/kod-cisco.c
+++ b/gdb/kod-cisco.c
@@ -90,13 +90,13 @@
 
 /* Close the connection.  */
 void
-cisco_kod_close ()
+cisco_kod_close (void)
 {
 }
 
 /* Print a "bad packet" message.  */
 static void
-bad_packet ()
+bad_packet (void)
 {
   (*gdb_kod_display) ("Remote target returned malformed packet.\n");
 }
@@ -112,7 +112,7 @@
   int done = 0, i;
   int fail = 0;
 
-  char **sync_ids;
+  char **sync_ids = NULL;
   int sync_len = 0;
   int sync_next = 0;
   char *prev_id = NULL;
@@ -216,12 +216,8 @@
       buffer[off + 8] = '\0';
       off += 9;
 
-      if (sync_len == 0)
-	sync_ids = (char **) xmalloc (count * sizeof (char *));
-      else
-	sync_ids = (char **) xrealloc (sync_ids,
-				       (sync_len + count) * sizeof (char *));
       sync_len += count;
+      sync_ids = (char **) xrealloc (sync_ids, sync_len * sizeof (char *));
 
       for (i = 0; i < count; ++i)
 	{
@@ -316,6 +312,6 @@
 
   /* Free memory.  */
   for (i = 0; i < sync_next; ++i)
-    free (sync_ids[i]);
-  free (sync_ids);
+    xfree (sync_ids[i]);
+  xfree (sync_ids);
 }
diff --git a/gdb/kod.c b/gdb/kod.c
index 0a90677..6aa6769 100644
--- a/gdb/kod.c
+++ b/gdb/kod.c
@@ -143,7 +143,7 @@
   if (old_operating_system)
     {
       delete_cmd (old_operating_system, &infolist);
-      free (old_operating_system);
+      xfree (old_operating_system);
     }
   old_operating_system = xstrdup (operating_system);
 
@@ -175,7 +175,7 @@
 	p = "Unknown KOD library";
       printf_filtered ("%s - %s\n", operating_system, p);
 
-      free (kodlib);
+      xfree (kodlib);
     }
 }
 
@@ -216,7 +216,7 @@
 }
 
 void
-_initialize_kod ()
+_initialize_kod (void)
 {
   struct cmd_list_element *c;
 
diff --git a/gdb/language.c b/gdb/language.c
index 60f43d3..a5b2a86 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -41,6 +41,7 @@
 #include "language.h"
 #include "target.h"
 #include "parser-defs.h"
+#include "jv-lang.h"
 
 extern void _initialize_language (void);
 
@@ -56,6 +57,12 @@
 
 static void set_range_command (char *, int);
 
+static void show_case_command (char *, int);
+
+static void set_case_command (char *, int);
+
+static void set_case_str (void);
+
 static void set_range_str (void);
 
 static void set_type_str (void);
@@ -70,7 +77,7 @@
 
 static void set_check (char *, int);
 
-static void set_type_range (void);
+static void set_type_range_case (void);
 
 static void unk_lang_emit_char (int c, struct ui_file *stream, int quoter);
 
@@ -104,6 +111,8 @@
 enum range_check range_check = range_check_off;
 enum type_mode type_mode = type_mode_auto;
 enum type_check type_check = type_check_off;
+enum case_mode case_mode = case_mode_auto;
+enum case_sensitivity case_sensitivity = case_sensitive_on;
 
 /* The current language and language_mode (see language.h) */
 
@@ -131,6 +140,7 @@
 static char *language;
 static char *type;
 static char *range;
+static char *case_sensitive;
 
 /* Warning issued when current_language and the language of the current
    frame do not match. */
@@ -144,9 +154,7 @@
 /* Show command.  Display a warning if the language set
    does not match the frame. */
 static void
-show_language_command (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+show_language_command (char *ignore, int from_tty)
 {
   enum language flang;		/* The language of the current frame */
 
@@ -159,9 +167,7 @@
 
 /* Set command.  Change the current working language. */
 static void
-set_language_command (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+set_language_command (char *ignore, int from_tty)
 {
   int i;
   enum language flang;
@@ -214,7 +220,7 @@
 	      /* Enter manual mode.  Set the specified language.  */
 	      language_mode = language_mode_manual;
 	      current_language = languages[i];
-	      set_type_range ();
+	      set_type_range_case ();
 	      set_lang_str ();
 	      expected_language = current_language;
 	      return;
@@ -225,7 +231,7 @@
   /* Reset the language (esp. the global string "language") to the 
      correct values. */
   err_lang = savestring (language, strlen (language));
-  make_cleanup (free, err_lang);	/* Free it after error */
+  make_cleanup (xfree, err_lang);	/* Free it after error */
   set_language (current_language->la_language);
   error ("Unknown language `%s'.", err_lang);
 }
@@ -233,9 +239,7 @@
 /* Show command.  Display a warning if the type setting does
    not match the current language. */
 static void
-show_type_command (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+show_type_command (char *ignore, int from_tty)
 {
   if (type_check != current_language->la_type_check)
     printf_unfiltered (
@@ -244,9 +248,7 @@
 
 /* Set command.  Change the setting for type checking. */
 static void
-set_type_command (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+set_type_command (char *ignore, int from_tty)
 {
   if (STREQ (type, "on"))
     {
@@ -266,9 +268,9 @@
   else if (STREQ (type, "auto"))
     {
       type_mode = type_mode_auto;
-      set_type_range ();
+      set_type_range_case ();
       /* Avoid hitting the set_type_str call below.  We
-         did it in set_type_range. */
+         did it in set_type_range_case. */
       return;
     }
   else
@@ -282,9 +284,7 @@
 /* Show command.  Display a warning if the range setting does
    not match the current language. */
 static void
-show_range_command (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+show_range_command (char *ignore, int from_tty)
 {
 
   if (range_check != current_language->la_range_check)
@@ -294,9 +294,7 @@
 
 /* Set command.  Change the setting for range checking. */
 static void
-set_range_command (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+set_range_command (char *ignore, int from_tty)
 {
   if (STREQ (range, "on"))
     {
@@ -316,9 +314,9 @@
   else if (STREQ (range, "auto"))
     {
       range_mode = range_mode_auto;
-      set_type_range ();
+      set_type_range_case ();
       /* Avoid hitting the set_range_str call below.  We
-         did it in set_type_range. */
+         did it in set_type_range_case. */
       return;
     }
   else
@@ -329,12 +327,52 @@
   show_range_command ((char *) 0, from_tty);
 }
 
-/* Set the status of range and type checking based on
+/* Show command.  Display a warning if the case sensitivity setting does
+   not match the current language. */
+static void
+show_case_command (char *ignore, int from_tty)
+{
+   if (case_sensitivity != current_language->la_case_sensitivity)
+      printf_unfiltered(
+"Warning: the current case sensitivity setting does not match the language.\n");
+}
+
+/* Set command.  Change the setting for case sensitivity. */
+static void
+set_case_command (char *ignore, int from_tty)
+{
+   if (STREQ (case_sensitive, "on"))
+   {
+      case_sensitivity = case_sensitive_on;
+      case_mode = case_mode_manual;
+   }
+   else if (STREQ (case_sensitive, "off"))
+   {
+      case_sensitivity = case_sensitive_off;
+      case_mode = case_mode_manual;
+   }
+   else if (STREQ (case_sensitive, "auto"))
+   {
+      case_mode = case_mode_auto;
+      set_type_range_case ();
+      /* Avoid hitting the set_case_str call below.  We
+         did it in set_type_range_case. */
+      return;
+   }
+   else
+   {
+      warning ("Unrecognized case-sensitive setting: \"%s\"", case_sensitive);
+   }
+   set_case_str();
+   show_case_command ((char *) NULL, from_tty);
+}
+
+/* Set the status of range and type checking and case sensitivity based on
    the current modes and the current language.
    If SHOW is non-zero, then print out the current language,
    type and range checking status. */
 static void
-set_type_range ()
+set_type_range_case (void)
 {
 
   if (range_mode == range_mode_auto)
@@ -343,15 +381,18 @@
   if (type_mode == type_mode_auto)
     type_check = current_language->la_type_check;
 
+  if (case_mode == case_mode_auto)
+    case_sensitivity = current_language->la_case_sensitivity;
+
   set_type_str ();
   set_range_str ();
+  set_case_str ();
 }
 
 /* Set current language to (enum language) LANG.  Returns previous language. */
 
 enum language
-set_language (lang)
-     enum language lang;
+set_language (enum language lang)
 {
   int i;
   enum language prev_language;
@@ -363,7 +404,7 @@
       if (languages[i]->la_language == lang)
 	{
 	  current_language = languages[i];
-	  set_type_range ();
+	  set_type_range_case ();
 	  set_lang_str ();
 	  break;
 	}
@@ -375,12 +416,12 @@
 /* This page contains functions that update the global vars
    language, type and range. */
 static void
-set_lang_str ()
+set_lang_str (void)
 {
   char *prefix = "";
 
   if (language)
-    free (language);
+    xfree (language);
   if (language_mode == language_mode_auto)
     prefix = "auto; currently ";
 
@@ -388,12 +429,12 @@
 }
 
 static void
-set_type_str ()
+set_type_str (void)
 {
   char *tmp = NULL, *prefix = "";
 
   if (type)
-    free (type);
+    xfree (type);
   if (type_mode == type_mode_auto)
     prefix = "auto; currently ";
 
@@ -416,7 +457,7 @@
 }
 
 static void
-set_range_str ()
+set_range_str (void)
 {
   char *tmp, *pref = "";
 
@@ -439,17 +480,39 @@
     }
 
   if (range)
-    free (range);
+    xfree (range);
   range = concat (pref, tmp, NULL);
 }
 
+static void
+set_case_str()
+{
+   char *tmp = NULL, *prefix = "";
+
+   if (case_mode==case_mode_auto)
+      prefix = "auto; currently ";
+
+   switch (case_sensitivity)
+   {
+   case case_sensitive_on:
+     tmp = "on";
+     break;
+   case case_sensitive_off:
+     tmp = "off";
+     break;
+   default:
+     error ("Unrecognized case-sensitive setting.");
+   }
+
+   xfree (case_sensitive);
+   case_sensitive = concat (prefix, tmp, NULL);
+}
 
 /* Print out the current language settings: language, range and
    type checking.  If QUIETLY, print only what has changed.  */
 
 void
-language_info (quietly)
-     int quietly;
+language_info (int quietly)
 {
   if (quietly && expected_language == current_language)
     return;
@@ -464,6 +527,8 @@
       show_type_command ((char *) 0, 1);
       printf_unfiltered ("Range checking:    %s\n", range);
       show_range_command ((char *) 0, 1);
+      printf_unfiltered ("Case sensitivity:  %s\n", case_sensitive);
+      show_case_command ((char *) 0, 1);
     }
 }
 
@@ -472,8 +537,7 @@
 #if 0				/* Currently unused */
 
 struct type *
-binop_result_type (v1, v2)
-     value_ptr v1, v2;
+binop_result_type (value_ptr v1, value_ptr v2)
 {
   int size, uns;
   struct type *t1 = check_typedef (VALUE_TYPE (v1));
@@ -520,8 +584,7 @@
 /* Returns the appropriate printf format for hexadecimal
    numbers. */
 char *
-local_hex_format_custom (pre)
-     char *pre;
+local_hex_format_custom (char *pre)
 {
   static char form[50];
 
@@ -542,8 +605,7 @@
    static string.  Returns a pointer to this string. */
 
 char *
-longest_raw_hex_string (num)
-     LONGEST num;
+longest_raw_hex_string (LONGEST num)
 {
   static char res_longest_raw_hex_string[50];
   long long ll = num;		/* MERGEBUG ?? see below */
@@ -560,8 +622,7 @@
 /* Converts a number to hexadecimal and stores it in a static
    string.  Returns a pointer to this string. */
 char *
-local_hex_string (num)
-     unsigned long num;
+local_hex_string (unsigned long num)
 {
   static char res[50];
 
@@ -572,8 +633,7 @@
 /* Converts a LONGEST number to hexadecimal and stores it in a static
    string.  Returns a pointer to this string. */
 char *
-longest_local_hex_string (num)
-     LONGEST num;
+longest_local_hex_string (LONGEST num)
 {
   return longest_local_hex_string_custom (num, "l");
 }
@@ -581,9 +641,7 @@
 /* Converts a number to custom hexadecimal and stores it in a static
    string.  Returns a pointer to this string. */
 char *
-local_hex_string_custom (num, pre)
-     unsigned long num;
-     char *pre;
+local_hex_string_custom (unsigned long num, char *pre)
 {
   static char res[50];
 
@@ -596,9 +654,7 @@
    should end with "l", e.g. "08l" as with calls to local_hex_string_custom */
 
 char *
-longest_local_hex_string_custom (num, width)
-     LONGEST num;
-     char *width;
+longest_local_hex_string_custom (LONGEST num, char *width)
 {
 #define RESULT_BUF_LEN 50
   static char res2[RESULT_BUF_LEN];
@@ -693,8 +749,7 @@
 /* Returns the appropriate printf format for octal
    numbers. */
 char *
-local_octal_format_custom (pre)
-     char *pre;
+local_octal_format_custom (char *pre)
 {
   static char form[50];
 
@@ -708,8 +763,7 @@
 
 /* Returns the appropriate printf format for decimal numbers. */
 char *
-local_decimal_format_custom (pre)
-     char *pre;
+local_decimal_format_custom (char *pre)
 {
   static char form[50];
 
@@ -740,8 +794,7 @@
    both Modula-2 and for C.  In the C case, TYPE_CODE_CHAR will never occur,
    and thus will never cause the failure of the test. */
 int
-simple_type (type)
-     struct type *type;
+simple_type (struct type *type)
 {
   CHECK_TYPEDEF (type);
   switch (TYPE_CODE (type))
@@ -764,8 +817,7 @@
    properties of "greater than", "less than", etc, or for which the
    operations "increment" or "decrement" make sense. */
 int
-ordered_type (type)
-     struct type *type;
+ordered_type (struct type *type)
 {
   CHECK_TYPEDEF (type);
   switch (TYPE_CODE (type))
@@ -784,8 +836,7 @@
 
 /* Returns non-zero if the two types are the same */
 int
-same_type (arg1, arg2)
-     struct type *arg1, *arg2;
+same_type (struct type *arg1, struct type *arg2)
 {
   CHECK_TYPEDEF (type);
   if (structured_type (arg1) ? !structured_type (arg2) : structured_type (arg2))
@@ -803,8 +854,7 @@
 
 /* Returns non-zero if the type is integral */
 int
-integral_type (type)
-     struct type *type;
+integral_type (struct type *type)
 {
   CHECK_TYPEDEF (type);
   switch (current_language->la_language)
@@ -814,6 +864,7 @@
       return (TYPE_CODE (type) != TYPE_CODE_INT) &&
 	(TYPE_CODE (type) != TYPE_CODE_ENUM) ? 0 : 1;
     case language_m2:
+    case language_pascal:
       return TYPE_CODE (type) != TYPE_CODE_INT ? 0 : 1;
     case language_chill:
       error ("Missing Chill support in function integral_type.");	/*FIXME */
@@ -824,8 +875,7 @@
 
 /* Returns non-zero if the value is numeric */
 int
-numeric_type (type)
-     struct type *type;
+numeric_type (struct type *type)
 {
   CHECK_TYPEDEF (type);
   switch (TYPE_CODE (type))
@@ -841,14 +891,14 @@
 
 /* Returns non-zero if the value is a character type */
 int
-character_type (type)
-     struct type *type;
+character_type (struct type *type)
 {
   CHECK_TYPEDEF (type);
   switch (current_language->la_language)
     {
     case language_chill:
     case language_m2:
+    case language_pascal:
       return TYPE_CODE (type) != TYPE_CODE_CHAR ? 0 : 1;
 
     case language_c:
@@ -863,14 +913,14 @@
 
 /* Returns non-zero if the value is a string type */
 int
-string_type (type)
-     struct type *type;
+string_type (struct type *type)
 {
   CHECK_TYPEDEF (type);
   switch (current_language->la_language)
     {
     case language_chill:
     case language_m2:
+    case language_pascal:
       return TYPE_CODE (type) != TYPE_CODE_STRING ? 0 : 1;
 
     case language_c:
@@ -884,8 +934,7 @@
 
 /* Returns non-zero if the value is a boolean type */
 int
-boolean_type (type)
-     struct type *type;
+boolean_type (struct type *type)
 {
   CHECK_TYPEDEF (type);
   if (TYPE_CODE (type) == TYPE_CODE_BOOL)
@@ -906,8 +955,7 @@
 
 /* Returns non-zero if the value is a floating-point type */
 int
-float_type (type)
-     struct type *type;
+float_type (struct type *type)
 {
   CHECK_TYPEDEF (type);
   return TYPE_CODE (type) == TYPE_CODE_FLT;
@@ -915,8 +963,7 @@
 
 /* Returns non-zero if the value is a pointer type */
 int
-pointer_type (type)
-     struct type *type;
+pointer_type (struct type *type)
 {
   return TYPE_CODE (type) == TYPE_CODE_PTR ||
     TYPE_CODE (type) == TYPE_CODE_REF;
@@ -924,8 +971,7 @@
 
 /* Returns non-zero if the value is a structured type */
 int
-structured_type (type)
-     struct type *type;
+structured_type (struct type *type)
 {
   CHECK_TYPEDEF (type);
   switch (current_language->la_language)
@@ -935,6 +981,11 @@
       return (TYPE_CODE (type) == TYPE_CODE_STRUCT) ||
 	(TYPE_CODE (type) == TYPE_CODE_UNION) ||
 	(TYPE_CODE (type) == TYPE_CODE_ARRAY);
+   case language_pascal:
+      return (TYPE_CODE(type) == TYPE_CODE_STRUCT) ||
+	 (TYPE_CODE(type) == TYPE_CODE_UNION) ||
+	 (TYPE_CODE(type) == TYPE_CODE_SET) ||
+	    (TYPE_CODE(type) == TYPE_CODE_ARRAY);
     case language_m2:
       return (TYPE_CODE (type) == TYPE_CODE_STRUCT) ||
 	(TYPE_CODE (type) == TYPE_CODE_SET) ||
@@ -948,7 +999,7 @@
 #endif
 
 struct type *
-lang_bool_type ()
+lang_bool_type (void)
 {
   struct symbol *sym;
   struct type *type;
@@ -966,7 +1017,11 @@
 	}
       return builtin_type_f_logical_s2;
     case language_cplus:
-      sym = lookup_symbol ("bool", NULL, VAR_NAMESPACE, NULL, NULL);
+    case language_pascal:
+      if (current_language->la_language==language_cplus)
+        {sym = lookup_symbol ("bool", NULL, VAR_NAMESPACE, NULL, NULL);}
+      else
+        {sym = lookup_symbol ("boolean", NULL, VAR_NAMESPACE, NULL, NULL);}
       if (sym)
 	{
 	  type = SYMBOL_TYPE (sym);
@@ -974,6 +1029,15 @@
 	    return type;
 	}
       return builtin_type_bool;
+    case language_java:
+      sym = lookup_symbol ("boolean", NULL, VAR_NAMESPACE, NULL, NULL);
+      if (sym)
+	{
+	  type = SYMBOL_TYPE (sym);
+	  if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
+	    return type;
+	}
+      return java_boolean_type;
     default:
       return builtin_type_int;
     }
@@ -984,8 +1048,7 @@
 
 /* Returns non-zero if the value VAL represents a true value. */
 int
-value_true (val)
-     value_ptr val;
+value_true (value_ptr val)
 {
   /* It is possible that we should have some sort of error if a non-boolean
      value is used in this context.  Possibly dependent on some kind of
@@ -1002,9 +1065,7 @@
 #if 0				/* Currently unused */
 
 void
-binop_type_check (arg1, arg2, op)
-     value_ptr arg1, arg2;
-     int op;
+binop_type_check (value_ptr arg1, value_ptr arg2, int op)
 {
   struct type *t1, *t2;
 
@@ -1160,6 +1221,21 @@
 	    }
 #endif
 
+#ifdef _LANG_pascal
+      case language_pascal:
+	 switch(op)
+	 {
+	 case BINOP_DIV:
+	    if (!float_type(t1) && !float_type(t2))
+	       type_op_error ("Arguments to %s must be floating point numbers.",op);
+	    break;
+	 case BINOP_INTDIV:
+	    if (!integral_type(t1) || !integral_type(t2))
+	       type_op_error ("Arguments to %s must be of integral type.",op);
+	    break;
+	 }
+#endif
+
 #ifdef _LANG_chill
 	case language_chill:
 	  error ("Missing Chill support in function binop_type_check.");	/*FIXME */
@@ -1181,10 +1257,7 @@
    this is an error and error () is called.  Otherwise, it is
    a warning and printf() is called. */
 void
-op_error (fmt, op, fatal)
-     char *fmt;
-     enum exp_opcode op;
-     int fatal;
+op_error (char *fmt, enum exp_opcode op, int fatal)
 {
   if (fatal)
     error (fmt, op_string (op));
@@ -1243,8 +1316,7 @@
 /* Return the language enum for a given language string. */
 
 enum language
-language_enum (str)
-     char *str;
+language_enum (char *str)
 {
   int i;
 
@@ -1258,8 +1330,7 @@
 /* Return the language struct for a given language enum. */
 
 const struct language_defn *
-language_def (lang)
-     enum language lang;
+language_def (enum language lang)
 {
   int i;
 
@@ -1275,8 +1346,7 @@
 
 /* Return the language as a string */
 char *
-language_str (lang)
-     enum language lang;
+language_str (enum language lang)
 {
   int i;
 
@@ -1291,9 +1361,7 @@
 }
 
 static void
-set_check (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+set_check (char *ignore, int from_tty)
 {
   printf_unfiltered (
      "\"set check\" must be followed by the name of a check subcommand.\n");
@@ -1301,9 +1369,7 @@
 }
 
 static void
-show_check (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+show_check (char *ignore, int from_tty)
 {
   cmd_show_list (showchecklist, from_tty, "");
 }
@@ -1311,8 +1377,7 @@
 /* Add a language to the set of known languages.  */
 
 void
-add_language (lang)
-     const struct language_defn *lang;
+add_language (const struct language_defn *lang)
 {
   if (lang->la_magic != LANG_MAGIC)
     {
@@ -1339,87 +1404,60 @@
 /* Define the language that is no language.  */
 
 static int
-unk_lang_parser ()
+unk_lang_parser (void)
 {
   return 1;
 }
 
 static void
-unk_lang_error (msg)
-     char *msg;
+unk_lang_error (char *msg)
 {
   error ("Attempted to parse an expression with unknown language");
 }
 
 static void
-unk_lang_emit_char (c, stream, quoter)
-     register int c;
-     struct ui_file *stream;
-     int quoter;
+unk_lang_emit_char (register int c, struct ui_file *stream, int quoter)
 {
   error ("internal error - unimplemented function unk_lang_emit_char called.");
 }
 
 static void
-unk_lang_printchar (c, stream)
-     register int c;
-     struct ui_file *stream;
+unk_lang_printchar (register int c, struct ui_file *stream)
 {
   error ("internal error - unimplemented function unk_lang_printchar called.");
 }
 
 static void
-unk_lang_printstr (stream, string, length, width, force_ellipses)
-     struct ui_file *stream;
-     char *string;
-     unsigned int length;
-     int width;
-     int force_ellipses;
+unk_lang_printstr (struct ui_file *stream, char *string, unsigned int length,
+		   int width, int force_ellipses)
 {
   error ("internal error - unimplemented function unk_lang_printstr called.");
 }
 
 static struct type *
-unk_lang_create_fundamental_type (objfile, typeid)
-     struct objfile *objfile;
-     int typeid;
+unk_lang_create_fundamental_type (struct objfile *objfile, int typeid)
 {
   error ("internal error - unimplemented function unk_lang_create_fundamental_type called.");
 }
 
 static void
-unk_lang_print_type (type, varstring, stream, show, level)
-     struct type *type;
-     char *varstring;
-     struct ui_file *stream;
-     int show;
-     int level;
+unk_lang_print_type (struct type *type, char *varstring, struct ui_file *stream,
+		     int show, int level)
 {
   error ("internal error - unimplemented function unk_lang_print_type called.");
 }
 
 static int
-unk_lang_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
-		    recurse, pretty)
-     struct type *type;
-     char *valaddr;
-     int embedded_offset;
-     CORE_ADDR address;
-     struct ui_file *stream;
-     int format;
-     int deref_ref;
-     int recurse;
-     enum val_prettyprint pretty;
+unk_lang_val_print (struct type *type, char *valaddr, int embedded_offset,
+		    CORE_ADDR address, struct ui_file *stream, int format,
+		    int deref_ref, int recurse, enum val_prettyprint pretty)
 {
   error ("internal error - unimplemented function unk_lang_val_print called.");
 }
 
 static int
-unk_lang_value_print (val, stream, format, pretty)
-     value_ptr val;
-     struct ui_file *stream;
-     int format;
-     enum val_prettyprint pretty;
+unk_lang_value_print (value_ptr val, struct ui_file *stream, int format,
+		      enum val_prettyprint pretty)
 {
   error ("internal error - unimplemented function unk_lang_value_print called.");
 }
@@ -1440,6 +1478,7 @@
   &unknown_builtin_types[0],
   range_check_off,
   type_check_off,
+  case_sensitive_on,
   unk_lang_parser,
   unk_lang_error,
   evaluate_subexp_standard,
@@ -1469,6 +1508,7 @@
   &unknown_builtin_types[0],
   range_check_off,
   type_check_off,
+  case_sensitive_on,
   unk_lang_parser,
   unk_lang_error,
   evaluate_subexp_standard,
@@ -1497,6 +1537,7 @@
   &unknown_builtin_types[0],
   range_check_off,
   type_check_off,
+  case_sensitive_on,
   unk_lang_parser,
   unk_lang_error,
   evaluate_subexp_standard,
@@ -1521,7 +1562,7 @@
 /* Initialize the language routines */
 
 void
-_initialize_language ()
+_initialize_language (void)
 {
   struct cmd_list_element *set, *show;
 
@@ -1563,16 +1604,24 @@
   set->function.cfunc = set_range_command;
   show->function.cfunc = show_range_command;
 
+  set = add_set_cmd ("case-sensitive", class_support, var_string_noescape,
+                     (char *) &case_sensitive,
+                     "Set case sensitivity in name search.  (on/off/auto)\n\
+For Fortran the default is off; for other languages the default is on.",
+                     &setlist);
+  show = add_show_from_set (set, &showlist);
+  set->function.cfunc = set_case_command;
+  show->function.cfunc = show_case_command;
+
   add_language (&unknown_language_defn);
   add_language (&local_language_defn);
   add_language (&auto_language_defn);
 
   language = savestring ("auto", strlen ("auto"));
-  set_language_command (language, 0);
-
   type = savestring ("auto", strlen ("auto"));
-  set_type_command (NULL, 0);
-
   range = savestring ("auto", strlen ("auto"));
-  set_range_command (NULL, 0);
+  case_sensitive = savestring ("auto",strlen ("auto"));
+
+  /* Have the above take effect */
+  set_language (language_auto);
 }
diff --git a/gdb/language.h b/gdb/language.h
index 185bc91..503e338 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -30,12 +30,13 @@
 /* enum exp_opcode;     ANSI's `wisdom' didn't include forward enum decls. */
 
 /* This used to be included to configure GDB for one or more specific
-   languages.  Now it is shortcutted to configure for all of them.  FIXME.  */
+   languages.  Now it is left out to configure for all of them.  FIXME.  */
 /* #include "lang_def.h" */
 #define	_LANG_c
 #define	_LANG_m2
 #define	_LANG_chill
-#define _LANG_fortran
+#define  _LANG_fortran
+#define  _LANG_pascal
 
 #define MAX_FORTRAN_DIMS  7	/* Maximum number of F77 array dims */
 
@@ -80,6 +81,26 @@
     type_check_off, type_check_warn, type_check_on
   }
 type_check;
+
+/* case_mode ==
+   case_mode_auto:   case_sensitivity set upon selection of scope 
+   case_mode_manual: case_sensitivity set only by user.  */
+
+extern enum case_mode
+  {
+    case_mode_auto, case_mode_manual
+  }
+case_mode;
+
+/* case_sensitivity ==
+   case_sensitive_on:   Case sensitivity in name matching is used
+   case_sensitive_off:  Case sensitivity in name matching is not used  */
+
+extern enum case_sensitivity
+  {
+    case_sensitive_on, case_sensitive_off
+  }
+case_sensitivity;
 
 /* Information for doing language dependent formatting of printed values. */
 
@@ -139,6 +160,9 @@
 
     enum type_check la_type_check;
 
+    /* Default case sensitivity */
+    enum case_sensitivity la_case_sensitivity;
+
     /* Parser function. */
 
     int (*la_parser) (void);
@@ -231,7 +255,7 @@
    its own language and we should keep track of that regardless of the
    language when symbols are read.  If we want some manual setting for
    the language of symbol files (e.g. detecting when ".c" files are
-   C++), it should be a seprate setting from the current_language.  */
+   C++), it should be a separate setting from the current_language.  */
 
 extern const struct language_defn *current_language;
 
diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c
new file mode 100644
index 0000000..bf52e2f
--- /dev/null
+++ b/gdb/lin-lwp.c
@@ -0,0 +1,1101 @@
+/* Multi-threaded debugging support for Linux (LWP layer).
+   Copyright 2000 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 <errno.h>
+#include <signal.h>
+#include <sys/ptrace.h>
+#include "gdb_wait.h"
+
+#include "gdbthread.h"
+#include "inferior.h"
+#include "target.h"
+
+#define DEBUG 1
+
+#if DEBUG
+extern const char *strsignal (int sig);
+#endif
+
+/* On 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 LinuxThreads 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 Linux 2.4 or above.
+
+   Note that there are some peculiarities in 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 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 origional parent and
+     keeps it around as a "zombie".  Somehow, the LinuxThreads 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.  */
+
+/* Structure describing a LWP.  */
+struct lwp_info
+{
+  /* The process id of the LWP.  This is a combination of the LWP id
+     and overall process id.  */
+  int pid;
+
+  /* Non-zero if we sent this LWP a SIGSTOP (but the LWP didn't report
+     it back yet).  */
+  int signalled;
+
+  /* Non-zero if this LWP is stopped.  */
+  int stopped;
+
+  /* If non-zero, a pending wait status.  */
+  int status;
+
+  /* Non-zero if we were stepping this LWP.  */
+  int step;
+
+  /* Next LWP in list.  */
+  struct lwp_info *next;
+};
+
+/* 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;
+
+
+#ifndef TIDGET
+#define TIDGET(PID)		(((PID) & 0x7fffffff) >> 16)
+#define PIDGET(PID)		(((PID) & 0xffff))
+#define MERGEPID(PID, TID)	(((PID) & 0xffff) | ((TID) << 16))
+#endif
+
+#define THREAD_FLAG		0x80000000
+#define is_lwp(pid)		(((pid) & THREAD_FLAG) == 0 && TIDGET (pid))
+#define GET_LWP(pid)		TIDGET (pid)
+#define GET_PID(pid)		PIDGET (pid)
+#define BUILD_LWP(tid, pid)	MERGEPID (pid, tid)
+
+#define is_cloned(pid)	(GET_LWP (pid) != GET_PID (pid))
+
+/* If the last reported event was a SIGTRAP, this variable is set to
+   the process id of the LWP/thread that got it.  */
+int trap_pid;
+
+
+/* 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
+   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
+   origional 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.  */
+
+/* Origional 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 void lin_lwp_mourn_inferior (void);
+
+
+/* Initialize the list of LWPs.  */
+
+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 (int pid)
+{
+  struct lwp_info *lp;
+
+  gdb_assert (is_lwp (pid));
+
+  lp = (struct lwp_info *) xmalloc (sizeof (struct lwp_info));
+
+  memset (lp, 0, sizeof (struct lwp_info));
+
+  lp->pid = pid;
+
+  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 (int pid)
+{
+  struct lwp_info *lp, *lpprev;
+
+  lpprev = NULL;
+
+  for (lp = lwp_list; lp; lpprev = lp, lp = lp->next)
+    if (lp->pid == pid)
+      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 (int pid)
+{
+  struct lwp_info *lp;
+
+  if (is_lwp (pid))
+    pid = GET_LWP (pid);
+
+  for (lp = lwp_list; lp; lp = lp->next)
+    if (pid == GET_LWP (lp->pid))
+      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;
+
+  for (lp = lwp_list; lp; lp = lp->next)
+    if ((*callback) (lp, data))
+      return lp;
+
+  return NULL;
+}
+
+
+/* Helper functions.  */
+
+static void
+restore_inferior_pid (void *arg)
+{
+  int *saved_pid_ptr = arg;
+  inferior_pid = *saved_pid_ptr;
+  xfree (arg);
+}
+
+static struct cleanup *
+save_inferior_pid (void)
+{
+  int *saved_pid_ptr;
+
+  saved_pid_ptr = xmalloc (sizeof (int));
+  *saved_pid_ptr = inferior_pid;
+  return make_cleanup (restore_inferior_pid, saved_pid_ptr);
+}
+
+
+/* Implementation of the PREPARE_TO_PROCEED hook for the Linux LWP layer.  */
+
+int
+lin_lwp_prepare_to_proceed (void)
+{
+  if (trap_pid && inferior_pid != trap_pid)
+    {
+      /* Switched over from TRAP_PID.  */
+      CORE_ADDR stop_pc = read_pc ();
+      CORE_ADDR trap_pc;
+
+      /* Avoid switching where it wouldn't do any good, i.e. if both
+         threads are at the same breakpoint.  */
+      trap_pc = read_pc_pid (trap_pid);
+      if (trap_pc != stop_pc && breakpoint_here_p (trap_pc))
+	{
+	  /* User hasn't deleted the breakpoint.  Return non-zero, and
+             switch back to TRAP_PID.  */
+	  inferior_pid = trap_pid;
+
+	  /* FIXME: Is this stuff really necessary?  */
+	  flush_cached_frames ();
+	  registers_changed ();
+
+	  return 1;
+	}
+    }
+
+  return 0;
+}
+
+
+#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 (int pid, int verbose)
+{
+  struct lwp_info *lp;
+
+  gdb_assert (is_lwp (pid));
+
+  if (verbose)
+    printf_filtered ("[New %s]\n", target_pid_to_str (pid));
+
+  if (ptrace (PTRACE_ATTACH, GET_LWP (pid), 0, 0) < 0)
+    error ("Can't attach %s: %s", target_pid_to_str (pid), strerror (errno));
+
+  lp = add_lwp (pid);
+  lp->signalled = 1;
+}
+
+static void
+lin_lwp_attach (char *args, int from_tty)
+{
+  /* FIXME: We should probably accept a list of process id's, and
+     attach all of them.  */
+  error("Not implemented yet");
+}
+
+static void
+lin_lwp_detach (char *args, int from_tty)
+{
+  /* FIXME: Provide implementation when we implement lin_lwp_attach.  */
+  error ("Not implemented yet");
+}
+
+
+struct private_thread_info
+{
+  int lwpid;
+};
+
+/* Return non-zero if TP corresponds to the LWP specified by DATA
+   (which is assumed to be a pointer to a `struct lwp_info'.  */
+
+static int
+find_lwp_callback (struct thread_info *tp, void *data)
+{
+  struct lwp_info *lp = data;
+
+  if (tp->private->lwpid == GET_LWP (lp->pid))
+    return 1;
+
+  return 0;
+}
+
+/* Resume LP.  */
+
+static int
+resume_callback (struct lwp_info *lp, void *data)
+{
+  if (lp->stopped && lp->status == 0)
+    {
+      struct thread_info *tp;
+
+#if 1
+      /* FIXME: kettenis/2000-08-26: This should really be handled
+         properly by core GDB.  */
+
+      tp = find_thread_pid (lp->pid);
+      if (tp == NULL)
+	tp = iterate_over_threads (find_lwp_callback, lp);
+      gdb_assert (tp);
+
+      /* If we were previously stepping the thread, and now continue
+         the thread we must invalidate the stepping range.  However,
+         if there is a step_resume breakpoint for this thread, we must
+         preserve the stepping range to make it possible to continue
+         stepping once we hit it.  */
+      if (tp->step_range_end && tp->step_resume_breakpoint == NULL)
+	{
+	  gdb_assert (lp->step);
+	  tp->step_range_start = tp->step_range_end = 0;
+	}
+#endif
+
+      child_resume (GET_LWP (lp->pid), 0, TARGET_SIGNAL_0);
+      lp->stopped = 0;
+      lp->step = 0;
+    }
+
+  return 0;
+}
+
+static void
+lin_lwp_resume (int pid, int step, enum target_signal signo)
+{
+  struct lwp_info *lp;
+  int resume_all;
+
+  /* Apparently the interpretation of PID is dependent on STEP: If
+     STEP is non-zero, a specific PID means `step only this process
+     id'.  But if STEP is zero, then PID means `continue *all*
+     processes, but give the signal only to this one'.  */
+  resume_all = (pid == -1) || !step;
+
+  /* If PID is -1, it's the current inferior that should be
+     handled special.  */
+  if (pid == -1)
+    pid = inferior_pid;
+
+  lp = find_lwp_pid (pid);
+  if (lp)
+    {
+      pid = GET_LWP (lp->pid);
+
+      /* Mark LWP as not stopped to prevent it from being continued by
+	 resume_callback.  */
+      lp->stopped = 0;
+
+      /* Remember if we're stepping.  */
+      lp->step = step;
+
+      /* 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;
+	}
+    }
+
+  if (resume_all)
+    iterate_over_lwps (resume_callback, NULL);
+
+  child_resume (pid, step, signo);
+}
+
+
+/* Send a SIGSTOP to LP.  */
+
+static int
+stop_callback (struct lwp_info *lp, void *data)
+{
+  if (! lp->stopped && ! lp->signalled)
+    {
+      int ret;
+
+      ret = kill (GET_LWP (lp->pid), SIGSTOP);
+      gdb_assert (ret == 0);
+
+      lp->signalled = 1;
+      gdb_assert (lp->status == 0);
+    }
+
+  return 0;
+}
+
+/* Wait until LP is stopped.  */
+
+static int
+stop_wait_callback (struct lwp_info *lp, void *data)
+{
+  if (! lp->stopped && lp->signalled)
+    {
+      pid_t pid;
+      int status;
+
+      gdb_assert (lp->status == 0);
+
+      pid = waitpid (GET_LWP (lp->pid), &status,
+		     is_cloned (lp->pid) ? __WCLONE : 0);
+      if (pid == -1 && errno == ECHILD)
+	/* OK, the proccess has disappeared.  We'll catch the actual
+	   exit event in lin_lwp_wait.  */
+	return 0;
+
+      gdb_assert (pid == GET_LWP (lp->pid));
+
+      if (WIFEXITED (status) || WIFSIGNALED (status))
+	{
+	  gdb_assert (num_lwps > 1);
+
+	  if (in_thread_list (lp->pid))
+	    {
+	      /* Core GDB cannot deal with us deleting the current
+		 thread.  */
+	      if (lp->pid != inferior_pid)
+		delete_thread (lp->pid);
+	      printf_unfiltered ("[%s exited]\n",
+				 target_pid_to_str (lp->pid));
+	    }
+#if DEBUG
+	  printf ("%s exited.\n", target_pid_to_str (lp->pid));
+#endif
+	  delete_lwp (lp->pid);
+	  return 0;
+	}
+
+      gdb_assert (WIFSTOPPED (status));
+      lp->stopped = 1;
+
+      if (WSTOPSIG (status) != SIGSTOP)
+	{
+	  if (WSTOPSIG (status) == SIGTRAP
+	      && breakpoint_inserted_here_p (read_pc_pid (pid)
+					     - DECR_PC_AFTER_BREAK))
+	    {
+	      /* 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.  */
+#if DEBUG
+	      printf ("Tripped breakpoint at %lx in LWP %d"
+		      " while waiting for SIGSTOP.\n",
+		      (long) read_pc_pid (lp->pid), pid);
+#endif
+	      /* Set the PC to before the trap.  */
+	      if (DECR_PC_AFTER_BREAK)
+		write_pc_pid (read_pc_pid (pid) - DECR_PC_AFTER_BREAK, pid);
+	    }
+	  else
+	    {
+#if DEBUG
+	      printf ("Received %s in LWP %d while waiting for SIGSTOP.\n",
+		      strsignal (WSTOPSIG (status)), pid);
+#endif
+	      /* The thread was stopped with a signal other than
+		 SIGSTOP, and didn't accidentiliy trip a breakpoint.
+		 Record the wait status.  */
+	      lp->status = status;
+	    }
+	}
+      else
+	{
+	  /* We caught the SIGSTOP that we intended to catch, so
+             there's no SIGSTOP pending.  */
+	  lp->signalled = 0;
+	}
+    }
+
+  return 0;
+}
+
+/* Return non-zero if LP has a wait status pending.  */
+
+static int
+status_callback (struct lwp_info *lp, void *data)
+{
+  return (lp->status != 0);
+}
+
+/* Return non-zero if LP isn't stopped.  */
+
+static int
+running_callback (struct lwp_info *lp, void *data)
+{
+  return (lp->stopped == 0);
+}
+
+static int
+lin_lwp_wait (int pid, struct target_waitstatus *ourstatus)
+{
+  struct lwp_info *lp = NULL;
+  int options = 0;
+  int status = 0;
+
+  /* Make sure SIGCHLD is blocked.  */
+  if (! sigismember (&blocked_mask, SIGCHLD))
+    {
+      sigaddset (&blocked_mask, SIGCHLD);
+      sigprocmask (SIG_BLOCK, &blocked_mask, NULL);
+    }
+
+ retry:
+
+  /* First check if there is a LWP with a wait status pending.  */
+  if (pid == -1)
+    {
+      /* Any LWP will do.  */
+      lp = iterate_over_lwps (status_callback, NULL);
+      if (lp)
+	{
+#if DEBUG
+	  printf ("Using pending wait status for LWP %d.\n",
+		  GET_LWP (lp->pid));
+#endif
+	  status = lp->status;
+	  lp->status = 0;
+	}
+
+      /* 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 (pid))
+    {
+#if DEBUG
+      printf ("Waiting for specific LWP %d.\n", GET_LWP (pid));
+#endif
+      /* We have a specific LWP to check.  */
+      lp = find_lwp_pid (GET_LWP (pid));
+      gdb_assert (lp);
+      status = lp->status;
+      lp->status = 0;
+#if DEBUG
+      if (status)
+	  printf ("Using pending wait status for LWP %d.\n",
+		  GET_LWP (lp->pid));
+#endif
+
+      /* 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 = is_cloned (lp->pid) ? __WCLONE : 0;
+      pid = GET_LWP (pid);
+    }
+
+  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.  */
+      child_resume (GET_LWP (lp->pid), lp->step, TARGET_SIGNAL_0);
+      lp->stopped = 0;
+
+      /* 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);
+
+	  lp = find_lwp_pid (lwpid);
+	  if (! lp)
+	    {
+	      lp = add_lwp (BUILD_LWP (lwpid, inferior_pid));
+	      if (threaded)
+		{
+		  gdb_assert (WIFSTOPPED (status)
+			      && WSTOPSIG (status) == SIGSTOP);
+		  lp->signalled = 1;
+
+		  if (! in_thread_list (inferior_pid))
+		    {
+		      inferior_pid = BUILD_LWP (inferior_pid, inferior_pid);
+		      add_thread (inferior_pid);
+		    }
+
+		  add_thread (lp->pid);
+		  printf_unfiltered ("[New %s]\n",
+				     target_pid_to_str (lp->pid));
+		}
+	    }
+
+	  /* Make sure we don't report a TARGET_WAITKIND_EXITED or
+             TARGET_WAITKIND_SIGNALLED event if there are still LWP's
+             left in the process.  */
+	  if ((WIFEXITED (status) || WIFSIGNALED (status)) && num_lwps > 1)
+	    {
+	      if (in_thread_list (lp->pid))
+		{
+		  /* Core GDB cannot deal with us deleting the current
+                     thread.  */
+		  if (lp->pid != inferior_pid)
+		    delete_thread (lp->pid);
+		  printf_unfiltered ("[%s exited]\n",
+				     target_pid_to_str (lp->pid));
+		}
+#if DEBUG
+	      printf ("%s exited.\n", target_pid_to_str (lp->pid));
+#endif
+	      delete_lwp (lp->pid);
+
+	      /* 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
+	      printf ("Delayed SIGSTOP caught for %s.\n",
+		      target_pid_to_str (lp->pid));
+#endif
+	      /* This is a delayed SIGSTOP.  */
+	      lp->signalled = 0;
+
+	      child_resume (GET_LWP (lp->pid), lp->step, TARGET_SIGNAL_0);
+	      lp->stopped = 0;
+
+	      /* 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)
+	{
+	  child_resume (GET_LWP (lp->pid), lp->step, signo);
+	  lp->stopped = 0;
+	  status = 0;
+	  goto retry;
+	}
+    }
+
+  /* This LWP is stopped now.  */
+  lp->stopped = 1;
+
+  /* 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, NULL);
+
+  /* If we're not running in "threaded" mode, we'll report the bare
+     process id.  */
+
+  if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP)
+    trap_pid = (threaded ? lp->pid : GET_LWP (lp->pid));
+  else
+    trap_pid = 0;
+
+  store_waitstatus (ourstatus, status);
+  return (threaded ? lp->pid : GET_LWP (lp->pid));
+}
+
+static int
+kill_callback (struct lwp_info *lp, void *data)
+{
+  ptrace (PTRACE_KILL, GET_LWP (lp->pid), 0, 0);
+  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 (is_cloned (lp->pid))
+    {
+      do
+	{
+	  pid = waitpid (GET_LWP (lp->pid), NULL, __WCLONE);
+	}
+      while (pid == GET_LWP (lp->pid));
+
+      gdb_assert (pid == -1 && errno == ECHILD);
+    }
+
+  do
+    {
+      pid = waitpid (GET_LWP (lp->pid), NULL, 0);
+    }
+  while (pid == GET_LWP (lp->pid));
+
+  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)
+{
+  struct target_ops *target_beneath;
+
+  init_lwp_list ();
+
+#if 0
+  target_beneath = find_target_beneath (&lin_lwp_ops);
+#else
+  target_beneath = &child_ops;
+#endif
+  target_beneath->to_create_inferior (exec_file, allargs, env);
+}
+
+static void  
+lin_lwp_mourn_inferior (void)
+{
+  struct target_ops *target_beneath;
+
+  init_lwp_list ();
+
+  trap_pid = 0;
+
+  /* Restore the origional signal mask.  */
+  sigprocmask (SIG_SETMASK, &normal_mask, NULL);
+  sigemptyset (&blocked_mask);
+
+#if 0
+  target_beneath = find_target_beneath (&lin_lwp_ops);
+#else
+  target_beneath = &child_ops;
+#endif
+  target_beneath->to_mourn_inferior ();
+}
+
+static void
+lin_lwp_fetch_registers (int regno)
+{
+  struct cleanup *old_chain = save_inferior_pid ();
+
+  if (is_lwp (inferior_pid))
+    inferior_pid = GET_LWP (inferior_pid);
+
+  fetch_inferior_registers (regno);
+
+  do_cleanups (old_chain);
+}
+
+static void
+lin_lwp_store_registers (int regno)
+{
+  struct cleanup *old_chain = save_inferior_pid ();
+
+  if (is_lwp (inferior_pid))
+    inferior_pid = GET_LWP (inferior_pid);
+
+  store_inferior_registers (regno);
+
+  do_cleanups (old_chain);
+}
+
+static int
+lin_lwp_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		     struct target_ops *target)
+{
+  struct cleanup *old_chain = save_inferior_pid ();
+  int xfer;
+
+  if (is_lwp (inferior_pid))
+    inferior_pid = GET_LWP (inferior_pid);
+
+  xfer = child_xfer_memory (memaddr, myaddr, len, write, target);
+
+  do_cleanups (old_chain);
+  return xfer;
+}
+
+static int
+lin_lwp_thread_alive (int pid)
+{
+  gdb_assert (is_lwp (pid));
+
+  errno = 0;
+  ptrace (PTRACE_PEEKUSER, GET_LWP (pid), 0, 0);
+  if (errno)
+    return 0;
+
+  return 1;
+}
+
+static char *
+lin_lwp_pid_to_str (int pid)
+{
+  static char buf[64];
+
+  if (is_lwp (pid))
+    {
+      snprintf (buf, sizeof (buf), "LWP %d", GET_LWP (pid));
+      return buf;
+    }
+
+  return normal_pid_to_str (pid);
+}
+
+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;
+  lin_lwp_ops.to_fetch_registers = lin_lwp_fetch_registers;
+  lin_lwp_ops.to_store_registers = lin_lwp_store_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_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 origional 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);
+}
+
+
+/* FIXME: kettenis/2000-08-26: The stuff on this page is specific to
+   the LinuxThreads 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 LinuxThreads 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/lin-thread.c b/gdb/lin-thread.c
index cd9ab99..b3fd14c 100644
--- a/gdb/lin-thread.c
+++ b/gdb/lin-thread.c
@@ -110,11 +110,7 @@
 #include <sys/procfs.h>
 #endif
 
-#if defined (HAVE_PROC_SERVICE_H)
-#include <proc_service.h>	/* defines incoming API (ps_* callbacks) */
-#else
 #include "gdb_proc_service.h"
-#endif
 
 #if defined HAVE_STDINT_H	/* Pre-5.2 systems don't have this header */
 #if defined (HAVE_THREAD_DB_H)
@@ -173,16 +169,6 @@
 typedef size_t gdb_ps_size_t;
 #endif
 
-/* Unfortunately glibc 2.1.3 was released with a broken prfpregset_t
-   type.  We let configure check for this lossage, and make
-   appropriate typedefs here.  */
-
-#ifdef PRFPREGSET_T_BROKEN
-typedef elf_fpregset_t gdb_prfpregset_t;
-#else
-typedef prfpregset_t gdb_prfpregset_t;
-#endif
-
 /* 
  * proc_service callback functions, called by thread_db.
  */
@@ -321,10 +307,6 @@
 static char *thr_err_string   (td_err_e);
 static char *thr_state_string (td_thr_state_e);
 
-struct ps_prochandle {
-  int pid;
-};
-
 struct ps_prochandle main_prochandle;
 td_thragent_t *      main_threadagent;
 
@@ -555,7 +537,7 @@
  */
 
 static int
-init_thread_db_library ()
+init_thread_db_library (void)
 {
   void *dlhandle;
   td_err_e ret;
@@ -683,7 +665,7 @@
 {
   int *saved_pid_ptr = arg;
   inferior_pid = *saved_pid_ptr;
-  free (arg);
+  xfree (arg);
 }
 
 /*
@@ -704,8 +686,7 @@
  */
 
 static char *
-thr_err_string (errcode)
-     td_err_e errcode;
+thr_err_string (td_err_e errcode)
 {
   static char buf[50];
 
@@ -755,8 +736,7 @@
  */
 
 static char *
-thr_state_string (statecode)
-     td_thr_state_e statecode;
+thr_state_string (td_thr_state_e statecode)
 {
   static char buf[50];
 
@@ -794,11 +774,7 @@
 #define THREADLIST_ALLOC 100	/* chunk size by which to expand table */
 
 static threadinfo *
-insert_thread (tid, lid, state, type)
-     int            tid;
-     int            lid;
-     td_thr_state_e state;
-     td_thr_type_e  type;
+insert_thread (int tid, int lid, td_thr_state_e state, td_thr_type_e type)
 {
   if (threadlist_top >= threadlist_max)
     {
@@ -819,13 +795,13 @@
 }
 
 static void
-empty_threadlist ()
+empty_threadlist (void)
 {
   threadlist_top = 0;
 }
 
 static threadinfo *
-next_pending_event ()
+next_pending_event (void)
 {
   int i;
 
@@ -837,11 +813,8 @@
 }
 
 static void
-threadlist_iter (func, data, state, type)
-     int (*func) ();
-     void *data;
-     td_thr_state_e state;
-     td_thr_type_e  type;
+threadlist_iter (int (*func) (), void *data, td_thr_state_e state,
+		 td_thr_type_e type)
 {
   int i;
 
@@ -910,8 +883,7 @@
    The thread-specific enabling is handled per-thread elsewhere.  */
 
 static void
-enable_thread_event_reporting (ta)
-     td_thragent_t *ta;
+enable_thread_event_reporting (td_thragent_t *ta)
 {
   td_thr_events_t events;
   td_notify_t     notify;
@@ -970,8 +942,7 @@
    The thread-specific enabling is handled per-thread elsewhere.  */
 
 static void
-disable_thread_event_reporting (ta)
-     td_thragent_t *ta;
+disable_thread_event_reporting (td_thragent_t *ta)
 {
   td_thr_events_t events;
 
@@ -1133,8 +1104,7 @@
  */
 
 static int
-thread_db_alive (pid)
-     int pid;
+thread_db_alive (int pid)
 {
   if (is_thread (pid))		/* user-space (non-kernel) thread */
     {
@@ -1159,8 +1129,7 @@
  */
 
 static int	/* lwpid_t or pid_t */
-get_lwp_from_thread_handle (th)
-     td_thrhandle_t *th;
+get_lwp_from_thread_handle (td_thrhandle_t *th)
 {
   td_thrinfo_t ti;
   td_err_e     ret;
@@ -1177,8 +1146,7 @@
  */
 
 static int	/* lwpid_t or pid_t */
-get_lwp_from_thread_id (tid)
-     int tid;	/* thread_t? */
+get_lwp_from_thread_id (int tid	/* thread_t? */)
 {
   td_thrhandle_t th;
   td_err_e       ret;
@@ -1246,12 +1214,8 @@
  */
 
 static int
-thread_db_xfer_memory (memaddr, myaddr, len, dowrite, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int dowrite;
-     struct target_ops *target;	/* ignored */
+thread_db_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
+		       struct target_ops *target)
 {
   struct cleanup *old_chain;
   int ret;
@@ -1279,8 +1243,7 @@
  */
 
 static void
-thread_db_fetch_registers (regno)
-     int regno;
+thread_db_fetch_registers (int regno)
 {
   td_thrhandle_t thandle;
   gdb_prfpregset_t fpregset;
@@ -1330,8 +1293,7 @@
  */
 
 static void
-thread_db_store_registers (regno)
-     int regno;
+thread_db_store_registers (int regno)
 {
   td_thrhandle_t thandle;
   gdb_prfpregset_t fpregset;
@@ -1382,10 +1344,9 @@
 }
 
 static void
-handle_new_thread (tid, lid, verbose)
-     int tid;	/* user thread id */
-     int lid;	/* kernel thread id */
-     int verbose;
+handle_new_thread (int tid,	/* user thread id */
+		   int lid,	/* kernel thread id */
+		   int verbose)
 {
   int gdb_pid = BUILD_THREAD (tid, main_prochandle.pid);
   int wait_pid, wait_status;
@@ -1405,10 +1366,7 @@
 }
 
 static void
-test_for_new_thread (tid, lid, verbose)
-     int tid;
-     int lid;
-     int verbose;
+test_for_new_thread (int tid, int lid, int verbose)
 {
   if (!in_thread_list (BUILD_THREAD (tid, main_prochandle.pid)))
     handle_new_thread (tid, lid, verbose);
@@ -1420,9 +1378,7 @@
  */
 
 static int
-find_new_threads_callback (th, ignored)
-     const td_thrhandle_t *th;
-     void *ignored;
+find_new_threads_callback (const td_thrhandle_t *th, void *ignored)
 {
   td_thrinfo_t ti;
   td_err_e     ret;
@@ -1448,7 +1404,7 @@
  */
 
 static void
-thread_db_find_new_threads ()
+thread_db_find_new_threads (void)
 {
   if (inferior_pid == -1)	/* FIXME: still necessary? */
     {
@@ -1487,9 +1443,7 @@
  */
 
 static int
-resume_thread_callback (th, data)
-     const td_thrhandle_t *th;
-     void *data;
+resume_thread_callback (const td_thrhandle_t *th, void *data)
 {
   td_thrinfo_t ti;
   td_err_e     ret;
@@ -1517,9 +1471,7 @@
 }
 
 static int
-new_resume_thread_callback (thread, data)
-     threadinfo *thread;
-     void *data;
+new_resume_thread_callback (threadinfo *thread, void *data)
 {
   if (thread->lid != event_pid &&
       thread->lid != main_prochandle.pid)
@@ -1536,10 +1488,7 @@
 static int last_resume_signo;
 
 static void
-thread_db_resume (pid, step, signo)
-     int pid;
-     int step;
-     enum target_signal signo;
+thread_db_resume (int pid, int step, enum target_signal signo)
 {
   last_resume_pid   = pid;
   last_resume_step  = step;
@@ -1632,8 +1581,7 @@
  */
 
 static void
-wait_for_stop (pid)
-     int pid;
+wait_for_stop (int pid)
 {
   int i;
   int retpid;
@@ -1763,9 +1711,7 @@
 }
 
 static int
-new_wait_thread_callback (thread, data)
-     threadinfo *thread;
-     void *data;
+new_wait_thread_callback (threadinfo *thread, void *data)
 {
   /* don't wait on the event thread -- it's already stopped and waited.  
      Ditto the main thread.  */
@@ -1898,9 +1844,7 @@
  */
 
 static int
-kill_thread_callback (th, data)
-     td_thrhandle_t *th;
-     void *data;
+kill_thread_callback (td_thrhandle_t *th, void *data)
 {
   td_thrinfo_t ti;
   td_err_e     ret;
@@ -1990,9 +1934,7 @@
  */
 
 static int
-detach_thread_callback (th, data)
-     td_thrhandle_t *th;
-     void *data;
+detach_thread_callback (td_thrhandle_t *th, void *data)
 {
   /* Called once per thread.  */
   td_thrinfo_t ti;
@@ -2075,10 +2017,7 @@
  */
 
 static void
-thread_db_create_inferior (exec_file, allargs, env)
-     char *exec_file;
-     char *allargs;
-     char **env;
+thread_db_create_inferior (char *exec_file, char *allargs, char **env)
 {
   thread_db_unpush_target ();
   find_default_create_inferior (exec_file, allargs, env);
@@ -2089,7 +2028,7 @@
  */
 
 void
-init_thread_db_ops ()
+init_thread_db_ops (void)
 {
   thread_db_ops.to_shortname        = "multi-thread";
   thread_db_ops.to_longname         = "multi-threaded child process.";
@@ -2122,7 +2061,7 @@
 
 
 void
-_initialize_thread_db ()
+_initialize_thread_db (void)
 {
 #ifdef HAVE_STDINT_H	/* stub out entire module, leave initializer empty */
   if (init_thread_db_library ())
diff --git a/gdb/linespec.c b/gdb/linespec.c
new file mode 100644
index 0000000..ae0b51a
--- /dev/null
+++ b/gdb/linespec.c
@@ -0,0 +1,1267 @@
+/* Parser for linespec for the GNU debugger, GDB.
+   Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+   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 "symtab.h"
+#include "frame.h"
+#include "command.h"
+#include "symfile.h"
+#include "objfiles.h"
+#include "demangle.h"
+#include "value.h"
+#include "completer.h"
+
+/* Prototype for one function in parser-defs.h,
+   instead of including that entire file. */
+
+extern char *find_template_name_end (char *);
+
+/* We share this one with symtab.c, but it is not exported widely. */
+
+extern char *operator_chars (char *, char **);
+
+/* Prototypes for local functions */
+
+static void cplusplus_hint (char *name);
+
+static int total_number_of_methods (struct type *type);
+
+static int find_methods (struct type *, char *, struct symbol **);
+
+static void build_canonical_line_spec (struct symtab_and_line *,
+				       char *, char ***);
+
+static char *find_toplevel_char (char *s, char c);
+
+static struct symtabs_and_lines decode_line_2 (struct symbol *[],
+					       int, int, char ***);
+
+/* Helper functions. */
+
+/* While the C++ support is still in flux, issue a possibly helpful hint on
+   using the new command completion feature on single quoted demangled C++
+   symbols.  Remove when loose ends are cleaned up.   FIXME -fnf */
+
+static void
+cplusplus_hint (char *name)
+{
+  while (*name == '\'')
+    name++;
+  printf_filtered ("Hint: try '%s<TAB> or '%s<ESC-?>\n", name, name);
+  printf_filtered ("(Note leading single quote.)\n");
+}
+
+/* Return the number of methods described for TYPE, including the
+   methods from types it derives from. This can't be done in the symbol
+   reader because the type of the baseclass might still be stubbed
+   when the definition of the derived class is parsed.  */
+
+static int
+total_number_of_methods (struct type *type)
+{
+  int n;
+  int count;
+
+  CHECK_TYPEDEF (type);
+  if (TYPE_CPLUS_SPECIFIC (type) == NULL)
+    return 0;
+  count = TYPE_NFN_FIELDS_TOTAL (type);
+
+  for (n = 0; n < TYPE_N_BASECLASSES (type); n++)
+    count += total_number_of_methods (TYPE_BASECLASS (type, n));
+
+  return count;
+}
+
+/* Recursive helper function for decode_line_1.
+   Look for methods named NAME in type T.
+   Return number of matches.
+   Put matches in SYM_ARR, which should have been allocated with
+   a size of total_number_of_methods (T) * sizeof (struct symbol *).
+   Note that this function is g++ specific.  */
+
+static int
+find_methods (struct type *t, char *name, struct symbol **sym_arr)
+{
+  int i1 = 0;
+  int ibase;
+  struct symbol *sym_class;
+  char *class_name = type_name_no_tag (t);
+
+  /* Ignore this class if it doesn't have a name.  This is ugly, but
+     unless we figure out how to get the physname without the name of
+     the class, then the loop can't do any good.  */
+  if (class_name
+      && (sym_class = lookup_symbol (class_name,
+				     (struct block *) NULL,
+				     STRUCT_NAMESPACE,
+				     (int *) NULL,
+				     (struct symtab **) NULL)))
+    {
+      int method_counter;
+
+      /* FIXME: Shouldn't this just be CHECK_TYPEDEF (t)?  */
+      t = SYMBOL_TYPE (sym_class);
+
+      /* Loop over each method name.  At this level, all overloads of a name
+         are counted as a single name.  There is an inner loop which loops over
+         each overload.  */
+
+      for (method_counter = TYPE_NFN_FIELDS (t) - 1;
+	   method_counter >= 0;
+	   --method_counter)
+	{
+	  int field_counter;
+	  char *method_name = TYPE_FN_FIELDLIST_NAME (t, method_counter);
+	  char dem_opname[64];
+
+	  if (strncmp (method_name, "__", 2) == 0 ||
+	      strncmp (method_name, "op", 2) == 0 ||
+	      strncmp (method_name, "type", 4) == 0)
+	    {
+	      if (cplus_demangle_opname (method_name, dem_opname, DMGL_ANSI))
+		method_name = dem_opname;
+	      else if (cplus_demangle_opname (method_name, dem_opname, 0))
+		method_name = dem_opname;
+	    }
+
+	  if (STREQ (name, method_name))
+	    /* Find all the overloaded methods with that name.  */
+	    for (field_counter = TYPE_FN_FIELDLIST_LENGTH (t, method_counter) - 1;
+		 field_counter >= 0;
+		 --field_counter)
+	      {
+		struct fn_field *f;
+		char *phys_name;
+
+		f = TYPE_FN_FIELDLIST1 (t, method_counter);
+
+		if (TYPE_FN_FIELD_STUB (f, field_counter))
+		  {
+		    char *tmp_name;
+
+		    tmp_name = gdb_mangle_name (t,
+						method_counter,
+						field_counter);
+		    phys_name = alloca (strlen (tmp_name) + 1);
+		    strcpy (phys_name, tmp_name);
+		    xfree (tmp_name);
+		  }
+		else
+		  phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
+
+		/* Destructor is handled by caller, dont add it to the list */
+		if (DESTRUCTOR_PREFIX_P (phys_name))
+		  continue;
+
+		sym_arr[i1] = lookup_symbol (phys_name,
+					     NULL, VAR_NAMESPACE,
+					     (int *) NULL,
+					     (struct symtab **) NULL);
+		if (sym_arr[i1])
+		  i1++;
+		else
+		  {
+		    /* This error message gets printed, but the method
+		       still seems to be found
+		       fputs_filtered("(Cannot find method ", gdb_stdout);
+		       fprintf_symbol_filtered (gdb_stdout, phys_name,
+		       language_cplus,
+		       DMGL_PARAMS | DMGL_ANSI);
+		       fputs_filtered(" - possibly inlined.)\n", gdb_stdout);
+		     */
+		  }
+	      }
+	}
+    }
+
+  /* Only search baseclasses if there is no match yet, since names in
+     derived classes override those in baseclasses.
+
+     FIXME: The above is not true; it is only true of member functions
+     if they have the same number of arguments (??? - section 13.1 of the
+     ARM says the function members are not in the same scope but doesn't
+     really spell out the rules in a way I understand.  In any case, if
+     the number of arguments differ this is a case in which we can overload
+     rather than hiding without any problem, and gcc 2.4.5 does overload
+     rather than hiding in this case).  */
+
+  if (i1 == 0)
+    for (ibase = 0; ibase < TYPE_N_BASECLASSES (t); ibase++)
+      i1 += find_methods (TYPE_BASECLASS (t, ibase), name, sym_arr + i1);
+
+  return i1;
+}
+
+/* Helper function for decode_line_1.
+   Build a canonical line spec in CANONICAL if it is non-NULL and if
+   the SAL has a symtab.
+   If SYMNAME is non-NULL the canonical line spec is `filename:symname'.
+   If SYMNAME is NULL the line number from SAL is used and the canonical
+   line spec is `filename:linenum'.  */
+
+static void
+build_canonical_line_spec (struct symtab_and_line *sal, char *symname,
+			   char ***canonical)
+{
+  char **canonical_arr;
+  char *canonical_name;
+  char *filename;
+  struct symtab *s = sal->symtab;
+
+  if (s == (struct symtab *) NULL
+      || s->filename == (char *) NULL
+      || canonical == (char ***) NULL)
+    return;
+
+  canonical_arr = (char **) xmalloc (sizeof (char *));
+  *canonical = canonical_arr;
+
+  filename = s->filename;
+  if (symname != NULL)
+    {
+      canonical_name = xmalloc (strlen (filename) + strlen (symname) + 2);
+      sprintf (canonical_name, "%s:%s", filename, symname);
+    }
+  else
+    {
+      canonical_name = xmalloc (strlen (filename) + 30);
+      sprintf (canonical_name, "%s:%d", filename, sal->line);
+    }
+  canonical_arr[0] = canonical_name;
+}
+
+
+
+/* Find an instance of the character C in the string S that is outside
+   of all parenthesis pairs, single-quoted strings, and double-quoted
+   strings.  */
+static char *
+find_toplevel_char (char *s, char c)
+{
+  int quoted = 0;		/* zero if we're not in quotes;
+				   '"' if we're in a double-quoted string;
+				   '\'' if we're in a single-quoted string.  */
+  int depth = 0;		/* number of unclosed parens we've seen */
+  char *scan;
+
+  for (scan = s; *scan; scan++)
+    {
+      if (quoted)
+	{
+	  if (*scan == quoted)
+	    quoted = 0;
+	  else if (*scan == '\\' && *(scan + 1))
+	    scan++;
+	}
+      else if (*scan == c && ! quoted && depth == 0)
+	return scan;
+      else if (*scan == '"' || *scan == '\'')
+	quoted = *scan;
+      else if (*scan == '(')
+	depth++;
+      else if (*scan == ')' && depth > 0)
+	depth--;
+    }
+
+  return 0;
+}
+
+/* Given a list of NELTS symbols in SYM_ARR, return a list of lines to
+   operate on (ask user if necessary).
+   If CANONICAL is non-NULL return a corresponding array of mangled names
+   as canonical line specs there.  */
+
+static struct symtabs_and_lines
+decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline,
+	       char ***canonical)
+{
+  struct symtabs_and_lines values, return_values;
+  char *args, *arg1;
+  int i;
+  char *prompt;
+  char *symname;
+  struct cleanup *old_chain;
+  char **canonical_arr = (char **) NULL;
+
+  values.sals = (struct symtab_and_line *)
+    alloca (nelts * sizeof (struct symtab_and_line));
+  return_values.sals = (struct symtab_and_line *)
+    xmalloc (nelts * sizeof (struct symtab_and_line));
+  old_chain = make_cleanup (xfree, return_values.sals);
+
+  if (canonical)
+    {
+      canonical_arr = (char **) xmalloc (nelts * sizeof (char *));
+      make_cleanup (xfree, canonical_arr);
+      memset (canonical_arr, 0, nelts * sizeof (char *));
+      *canonical = canonical_arr;
+    }
+
+  i = 0;
+  printf_unfiltered ("[0] cancel\n[1] all\n");
+  while (i < nelts)
+    {
+      INIT_SAL (&return_values.sals[i]);	/* initialize to zeroes */
+      INIT_SAL (&values.sals[i]);
+      if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK)
+	{
+	  values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline);
+	  printf_unfiltered ("[%d] %s at %s:%d\n",
+			     (i + 2),
+			     SYMBOL_SOURCE_NAME (sym_arr[i]),
+			     values.sals[i].symtab->filename,
+			     values.sals[i].line);
+	}
+      else
+	printf_unfiltered ("?HERE\n");
+      i++;
+    }
+
+  if ((prompt = getenv ("PS2")) == NULL)
+    {
+      prompt = "> ";
+    }
+  args = command_line_input (prompt, 0, "overload-choice");
+
+  if (args == 0 || *args == 0)
+    error_no_arg ("one or more choice numbers");
+
+  i = 0;
+  while (*args)
+    {
+      int num;
+
+      arg1 = args;
+      while (*arg1 >= '0' && *arg1 <= '9')
+	arg1++;
+      if (*arg1 && *arg1 != ' ' && *arg1 != '\t')
+	error ("Arguments must be choice numbers.");
+
+      num = atoi (args);
+
+      if (num == 0)
+	error ("canceled");
+      else if (num == 1)
+	{
+	  if (canonical_arr)
+	    {
+	      for (i = 0; i < nelts; i++)
+		{
+		  if (canonical_arr[i] == NULL)
+		    {
+		      symname = SYMBOL_NAME (sym_arr[i]);
+		      canonical_arr[i] = savestring (symname, strlen (symname));
+		    }
+		}
+	    }
+	  memcpy (return_values.sals, values.sals,
+		  (nelts * sizeof (struct symtab_and_line)));
+	  return_values.nelts = nelts;
+	  discard_cleanups (old_chain);
+	  return return_values;
+	}
+
+      if (num >= nelts + 2)
+	{
+	  printf_unfiltered ("No choice number %d.\n", num);
+	}
+      else
+	{
+	  num -= 2;
+	  if (values.sals[num].pc)
+	    {
+	      if (canonical_arr)
+		{
+		  symname = SYMBOL_NAME (sym_arr[num]);
+		  make_cleanup (xfree, symname);
+		  canonical_arr[i] = savestring (symname, strlen (symname));
+		}
+	      return_values.sals[i++] = values.sals[num];
+	      values.sals[num].pc = 0;
+	    }
+	  else
+	    {
+	      printf_unfiltered ("duplicate request for %d ignored.\n", num);
+	    }
+	}
+
+      args = arg1;
+      while (*args == ' ' || *args == '\t')
+	args++;
+    }
+  return_values.nelts = i;
+  discard_cleanups (old_chain);
+  return return_values;
+}
+
+/* The parser of linespec itself. */
+
+/* Parse a string that specifies a line number.
+   Pass the address of a char * variable; that variable will be
+   advanced over the characters actually parsed.
+
+   The string can be:
+
+   LINENUM -- that line number in current file.  PC returned is 0.
+   FILE:LINENUM -- that line in that file.  PC returned is 0.
+   FUNCTION -- line number of openbrace of that function.
+   PC returned is the start of the function.
+   VARIABLE -- line number of definition of that variable.
+   PC returned is 0.
+   FILE:FUNCTION -- likewise, but prefer functions in that file.
+   *EXPR -- line in which address EXPR appears.
+
+   This may all be followed by an "if EXPR", which we ignore.
+
+   FUNCTION may be an undebuggable function found in minimal symbol table.
+
+   If the argument FUNFIRSTLINE is nonzero, we want the first line
+   of real code inside a function when a function is specified, and it is
+   not OK to specify a variable or type to get its line number.
+
+   DEFAULT_SYMTAB specifies the file to use if none is specified.
+   It defaults to current_source_symtab.
+   DEFAULT_LINE specifies the line number to use for relative
+   line numbers (that start with signs).  Defaults to current_source_line.
+   If CANONICAL is non-NULL, store an array of strings containing the canonical
+   line specs there if necessary. Currently overloaded member functions and
+   line numbers 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 callers responsibility to free them.
+
+   Note that it is possible to return zero for the symtab
+   if no file is validly specified.  Callers must check that.
+   Also, the line number returned may be invalid.  */
+
+/* We allow single quotes in various places.  This is a hideous
+   kludge, which exists because the completer can't yet deal with the
+   lack of single quotes.  FIXME: write a linespec_completer which we
+   can use as appropriate instead of make_symbol_completion_list.  */
+
+struct symtabs_and_lines
+decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+	       int default_line, char ***canonical)
+{
+  struct symtabs_and_lines values;
+#ifdef HPPA_COMPILER_BUG
+  /* FIXME: The native HP 9000/700 compiler has a bug which appears
+     when optimizing this file with target i960-vxworks.  I haven't
+     been able to construct a simple test case.  The problem is that
+     in the second call to SKIP_PROLOGUE below, the compiler somehow
+     does not realize that the statement val = find_pc_line (...) will
+     change the values of the fields of val.  It extracts the elements
+     into registers at the top of the block, and does not update the
+     registers after the call to find_pc_line.  You can check this by
+     inserting a printf at the end of find_pc_line to show what values
+     it is returning for val.pc and val.end and another printf after
+     the call to see what values the function actually got (remember,
+     this is compiling with cc -O, with this patch removed).  You can
+     also examine the assembly listing: search for the second call to
+     skip_prologue; the LDO statement before the next call to
+     find_pc_line loads the address of the structure which
+     find_pc_line will return; if there is a LDW just before the LDO,
+     which fetches an element of the structure, then the compiler
+     still has the bug.
+
+     Setting val to volatile avoids the problem.  We must undef
+     volatile, because the HPPA native compiler does not define
+     __STDC__, although it does understand volatile, and so volatile
+     will have been defined away in defs.h.  */
+#undef volatile
+  volatile struct symtab_and_line val;
+#define volatile		/*nothing */
+#else
+  struct symtab_and_line val;
+#endif
+  register char *p, *p1;
+  char *q, *pp, *ii, *p2;
+#if 0
+  char *q1;
+#endif
+  register struct symtab *s;
+
+  register struct symbol *sym;
+  /* The symtab that SYM was found in.  */
+  struct symtab *sym_symtab;
+
+  register CORE_ADDR pc;
+  register struct minimal_symbol *msymbol;
+  char *copy;
+  struct symbol *sym_class;
+  int i1;
+  int is_quoted;
+  int is_quote_enclosed;
+  int has_parens;
+  int has_if = 0;
+  int has_comma = 0;
+  struct symbol **sym_arr;
+  struct type *t;
+  char *saved_arg = *argptr;
+  extern char *gdb_completer_quote_characters;
+
+  INIT_SAL (&val);		/* initialize to zeroes */
+
+  /* Defaults have defaults.  */
+
+  if (default_symtab == 0)
+    {
+      default_symtab = current_source_symtab;
+      default_line = current_source_line;
+    }
+
+  /* See if arg is *PC */
+
+  if (**argptr == '*')
+    {
+      (*argptr)++;
+      pc = parse_and_eval_address_1 (argptr);
+
+      values.sals = (struct symtab_and_line *)
+	xmalloc (sizeof (struct symtab_and_line));
+
+      values.nelts = 1;
+      values.sals[0] = find_pc_line (pc, 0);
+      values.sals[0].pc = pc;
+      values.sals[0].section = find_pc_overlay (pc);
+
+      return values;
+    }
+
+  /* 'has_if' is for the syntax:
+   *     (gdb) break foo if (a==b)
+   */
+  if ((ii = strstr (*argptr, " if ")) != NULL ||
+      (ii = strstr (*argptr, "\tif ")) != NULL ||
+      (ii = strstr (*argptr, " if\t")) != NULL ||
+      (ii = strstr (*argptr, "\tif\t")) != NULL ||
+      (ii = strstr (*argptr, " if(")) != NULL ||
+      (ii = strstr (*argptr, "\tif( ")) != NULL)
+    has_if = 1;
+  /* Temporarily zap out "if (condition)" to not
+   * confuse the parenthesis-checking code below.
+   * This is undone below. Do not change ii!!
+   */
+  if (has_if)
+    {
+      *ii = '\0';
+    }
+
+  /* Set various flags.
+   * 'has_parens' is important for overload checking, where
+   * we allow things like: 
+   *     (gdb) break c::f(int)
+   */
+
+  /* Maybe arg is FILE : LINENUM or FILE : FUNCTION */
+
+  is_quoted = (**argptr
+	       && strchr (get_gdb_completer_quote_characters (),
+			  **argptr) != NULL);
+
+  has_parens = ((pp = strchr (*argptr, '(')) != NULL
+		&& (pp = strrchr (pp, ')')) != NULL);
+
+  /* Now that we're safely past the has_parens check,
+   * put back " if (condition)" so outer layers can see it 
+   */
+  if (has_if)
+    *ii = ' ';
+
+  /* Maybe we were called with a line range FILENAME:LINENUM,FILENAME:LINENUM
+     and we must isolate the first half.  Outer layers will call again later
+     for the second half.
+
+     Don't count commas that appear in argument lists of overloaded
+     functions, or in quoted strings.  It's stupid to go to this much
+     trouble when the rest of the function is such an obvious roach hotel.  */
+  ii = find_toplevel_char (*argptr, ',');
+  has_comma = (ii != 0);
+
+  /* Temporarily zap out second half to not
+   * confuse the code below.
+   * This is undone below. Do not change ii!!
+   */
+  if (has_comma)
+    {
+      *ii = '\0';
+    }
+
+  /* Maybe arg is FILE : LINENUM or FILE : FUNCTION */
+  /* May also be CLASS::MEMBER, or NAMESPACE::NAME */
+  /* Look for ':', but ignore inside of <> */
+
+  s = NULL;
+  p = *argptr;
+  if (p[0] == '"')
+    {
+      is_quote_enclosed = 1;
+      p++;
+    }
+  else
+    is_quote_enclosed = 0;
+  for (; *p; p++)
+    {
+      if (p[0] == '<')
+	{
+	  char *temp_end = find_template_name_end (p);
+	  if (!temp_end)
+	    error ("malformed template specification in command");
+	  p = temp_end;
+	}
+      /* Check for the end of the first half of the linespec.  End of line,
+         a tab, a double colon or the last single colon, or a space.  But
+         if enclosed in double quotes we do not break on enclosed spaces */
+      if (!*p
+	  || p[0] == '\t'
+	  || ((p[0] == ':')
+	      && ((p[1] == ':') || (strchr (p + 1, ':') == NULL)))
+	  || ((p[0] == ' ') && !is_quote_enclosed))
+	break;
+      if (p[0] == '.' && strchr (p, ':') == NULL)	/* Java qualified method. */
+	{
+	  /* Find the *last* '.', since the others are package qualifiers. */
+	  for (p1 = p; *p1; p1++)
+	    {
+	      if (*p1 == '.')
+		p = p1;
+	    }
+	  break;
+	}
+    }
+  while (p[0] == ' ' || p[0] == '\t')
+    p++;
+
+  /* if the closing double quote was left at the end, remove it */
+  if (is_quote_enclosed)
+    {
+      char *closing_quote = strchr (p, '"');
+      if (closing_quote && closing_quote[1] == '\0')
+	*closing_quote = '\0';
+    }
+
+  /* Now that we've safely parsed the first half,
+   * put back ',' so outer layers can see it 
+   */
+  if (has_comma)
+    *ii = ',';
+
+  if ((p[0] == ':' || p[0] == '.') && !has_parens)
+    {
+      /*  C++ */
+      /*  ... or Java */
+      if (is_quoted)
+	*argptr = *argptr + 1;
+      if (p[0] == '.' || p[1] == ':')
+	{
+	  char *saved_arg2 = *argptr;
+	  char *temp_end;
+	  /* First check for "global" namespace specification,
+	     of the form "::foo". If found, skip over the colons
+	     and jump to normal symbol processing */
+	  if (p[0] == ':' 
+	      && ((*argptr == p) || (p[-1] == ' ') || (p[-1] == '\t')))
+	    saved_arg2 += 2;
+
+	  /* We have what looks like a class or namespace
+	     scope specification (A::B), possibly with many
+	     levels of namespaces or classes (A::B::C::D).
+
+	     Some versions of the HP ANSI C++ compiler (as also possibly
+	     other compilers) generate class/function/member names with
+	     embedded double-colons if they are inside namespaces. To
+	     handle this, we loop a few times, considering larger and
+	     larger prefixes of the string as though they were single
+	     symbols.  So, if the initially supplied string is
+	     A::B::C::D::foo, we have to look up "A", then "A::B",
+	     then "A::B::C", then "A::B::C::D", and finally
+	     "A::B::C::D::foo" as single, monolithic symbols, because
+	     A, B, C or D may be namespaces.
+
+	     Note that namespaces can nest only inside other
+	     namespaces, and not inside classes.  So we need only
+	     consider *prefixes* of the string; there is no need to look up
+	     "B::C" separately as a symbol in the previous example. */
+
+	  p2 = p;		/* save for restart */
+	  while (1)
+	    {
+	      /* Extract the class name.  */
+	      p1 = p;
+	      while (p != *argptr && p[-1] == ' ')
+		--p;
+	      copy = (char *) alloca (p - *argptr + 1);
+	      memcpy (copy, *argptr, p - *argptr);
+	      copy[p - *argptr] = 0;
+
+	      /* Discard the class name from the arg.  */
+	      p = p1 + (p1[0] == ':' ? 2 : 1);
+	      while (*p == ' ' || *p == '\t')
+		p++;
+	      *argptr = p;
+
+	      sym_class = lookup_symbol (copy, 0, STRUCT_NAMESPACE, 0,
+					 (struct symtab **) NULL);
+
+	      if (sym_class &&
+		  (t = check_typedef (SYMBOL_TYPE (sym_class)),
+		   (TYPE_CODE (t) == TYPE_CODE_STRUCT
+		    || TYPE_CODE (t) == TYPE_CODE_UNION)))
+		{
+		  /* Arg token is not digits => try it as a function name
+		     Find the next token(everything up to end or next blank). */
+		  if (**argptr
+		      && strchr (get_gdb_completer_quote_characters (),
+				 **argptr) != NULL)
+		    {
+		      p = skip_quoted (*argptr);
+		      *argptr = *argptr + 1;
+		    }
+		  else
+		    {
+		      p = *argptr;
+		      while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p != ':')
+			p++;
+		    }
+/*
+   q = operator_chars (*argptr, &q1);
+   if (q1 - q)
+   {
+   char *opname;
+   char *tmp = alloca (q1 - q + 1);
+   memcpy (tmp, q, q1 - q);
+   tmp[q1 - q] = '\0';
+   opname = cplus_mangle_opname (tmp, DMGL_ANSI);
+   if (opname == NULL)
+   {
+   error_begin ();
+   printf_filtered ("no mangling for \"%s\"\n", tmp);
+   cplusplus_hint (saved_arg);
+   return_to_top_level (RETURN_ERROR);
+   }
+   copy = (char*) alloca (3 + strlen(opname));
+   sprintf (copy, "__%s", opname);
+   p = q1;
+   }
+   else
+ */
+		  {
+		    copy = (char *) alloca (p - *argptr + 1);
+		    memcpy (copy, *argptr, p - *argptr);
+		    copy[p - *argptr] = '\0';
+		    if (p != *argptr
+			&& copy[p - *argptr - 1]
+			&& strchr (get_gdb_completer_quote_characters (),
+				   copy[p - *argptr - 1]) != NULL)
+		      copy[p - *argptr - 1] = '\0';
+		  }
+
+		  /* no line number may be specified */
+		  while (*p == ' ' || *p == '\t')
+		    p++;
+		  *argptr = p;
+
+		  sym = 0;
+		  i1 = 0;	/*  counter for the symbol array */
+		  sym_arr = (struct symbol **) alloca (total_number_of_methods (t)
+						* sizeof (struct symbol *));
+
+		  if (destructor_name_p (copy, t))
+		    {
+		      /* Destructors are a special case.  */
+		      int m_index, f_index;
+
+		      if (get_destructor_fn_field (t, &m_index, &f_index))
+			{
+			  struct fn_field *f = TYPE_FN_FIELDLIST1 (t, m_index);
+
+			  sym_arr[i1] =
+			    lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, f_index),
+					   NULL, VAR_NAMESPACE, (int *) NULL,
+					   (struct symtab **) NULL);
+			  if (sym_arr[i1])
+			    i1++;
+			}
+		    }
+		  else
+		    i1 = find_methods (t, copy, sym_arr);
+		  if (i1 == 1)
+		    {
+		      /* There is exactly one field with that name.  */
+		      sym = sym_arr[0];
+
+		      if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
+			{
+			  values.sals = (struct symtab_and_line *)
+			    xmalloc (sizeof (struct symtab_and_line));
+			  values.nelts = 1;
+			  values.sals[0] = find_function_start_sal (sym,
+							      funfirstline);
+			}
+		      else
+			{
+			  values.nelts = 0;
+			}
+		      return values;
+		    }
+		  if (i1 > 0)
+		    {
+		      /* There is more than one field with that name
+		         (overloaded).  Ask the user which one to use.  */
+		      return decode_line_2 (sym_arr, i1, funfirstline, canonical);
+		    }
+		  else
+		    {
+		      char *tmp;
+
+		      if (OPNAME_PREFIX_P (copy))
+			{
+			  tmp = (char *) alloca (strlen (copy + 3) + 9);
+			  strcpy (tmp, "operator ");
+			  strcat (tmp, copy + 3);
+			}
+		      else
+			tmp = copy;
+		      error_begin ();
+		      if (tmp[0] == '~')
+			printf_filtered
+			  ("the class `%s' does not have destructor defined\n",
+			   SYMBOL_SOURCE_NAME (sym_class));
+		      else
+			printf_filtered
+			  ("the class %s does not have any method named %s\n",
+			   SYMBOL_SOURCE_NAME (sym_class), tmp);
+		      cplusplus_hint (saved_arg);
+		      return_to_top_level (RETURN_ERROR);
+		    }
+		}
+
+	      /* Move pointer up to next possible class/namespace token */
+	      p = p2 + 1;	/* restart with old value +1 */
+	      /* Move pointer ahead to next double-colon */
+	      while (*p && (p[0] != ' ') && (p[0] != '\t') && (p[0] != '\''))
+		{
+		  if (p[0] == '<')
+		    {
+		      temp_end = find_template_name_end (p);
+		      if (!temp_end)
+			error ("malformed template specification in command");
+		      p = temp_end;
+		    }
+		  else if ((p[0] == ':') && (p[1] == ':'))
+		    break;	/* found double-colon */
+		  else
+		    p++;
+		}
+
+	      if (*p != ':')
+		break;		/* out of the while (1) */
+
+	      p2 = p;		/* save restart for next time around */
+	      *argptr = saved_arg2;	/* restore argptr */
+	    }			/* while (1) */
+
+	  /* Last chance attempt -- check entire name as a symbol */
+	  /* Use "copy" in preparation for jumping out of this block,
+	     to be consistent with usage following the jump target */
+	  copy = (char *) alloca (p - saved_arg2 + 1);
+	  memcpy (copy, saved_arg2, p - saved_arg2);
+	  /* Note: if is_quoted should be true, we snuff out quote here anyway */
+	  copy[p - saved_arg2] = '\000';
+	  /* Set argptr to skip over the name */
+	  *argptr = (*p == '\'') ? p + 1 : p;
+	  /* Look up entire name */
+	  sym = lookup_symbol (copy, 0, VAR_NAMESPACE, 0, &sym_symtab);
+	  s = (struct symtab *) 0;
+	  /* Prepare to jump: restore the " if (condition)" so outer layers see it */
+	  /* Symbol was found --> jump to normal symbol processing.
+	     Code following "symbol_found" expects "copy" to have the
+	     symbol name, "sym" to have the symbol pointer, "s" to be
+	     a specified file's symtab, and sym_symtab to be the symbol's
+	     symtab. */
+	  /* By jumping there we avoid falling through the FILE:LINE and
+	     FILE:FUNC processing stuff below */
+	  if (sym)
+	    goto symbol_found;
+
+	  /* Couldn't find any interpretation as classes/namespaces, so give up */
+	  error_begin ();
+	  /* The quotes are important if copy is empty.  */
+	  printf_filtered
+	    ("Can't find member of namespace, class, struct, or union named \"%s\"\n", copy);
+	  cplusplus_hint (saved_arg);
+	  return_to_top_level (RETURN_ERROR);
+	}
+      /*  end of C++  */
+
+
+      /* Extract the file name.  */
+      p1 = p;
+      while (p != *argptr && p[-1] == ' ')
+	--p;
+      if ((*p == '"') && is_quote_enclosed)
+	--p;
+      copy = (char *) alloca (p - *argptr + 1);
+      if ((**argptr == '"') && is_quote_enclosed)
+	{
+	  memcpy (copy, *argptr + 1, p - *argptr - 1);
+	  /* It may have the ending quote right after the file name */
+	  if (copy[p - *argptr - 2] == '"')
+	    copy[p - *argptr - 2] = 0;
+	  else
+	    copy[p - *argptr - 1] = 0;
+	}
+      else
+	{
+	  memcpy (copy, *argptr, p - *argptr);
+	  copy[p - *argptr] = 0;
+	}
+
+      /* Find that file's data.  */
+      s = lookup_symtab (copy);
+      if (s == 0)
+	{
+	  if (!have_full_symbols () && !have_partial_symbols ())
+	    error ("No symbol table is loaded.  Use the \"file\" command.");
+	  error ("No source file named %s.", copy);
+	}
+
+      /* Discard the file name from the arg.  */
+      p = p1 + 1;
+      while (*p == ' ' || *p == '\t')
+	p++;
+      *argptr = p;
+    }
+#if 0
+  /* No one really seems to know why this was added. It certainly
+     breaks the command line, though, whenever the passed
+     name is of the form ClassName::Method. This bit of code
+     singles out the class name, and if funfirstline is set (for
+     example, you are setting a breakpoint at this function),
+     you get an error. This did not occur with earlier
+     verions, so I am ifdef'ing this out. 3/29/99 */
+  else
+    {
+      /* Check if what we have till now is a symbol name */
+
+      /* We may be looking at a template instantiation such
+         as "foo<int>".  Check here whether we know about it,
+         instead of falling through to the code below which
+         handles ordinary function names, because that code
+         doesn't like seeing '<' and '>' in a name -- the
+         skip_quoted call doesn't go past them.  So see if we
+         can figure it out right now. */
+
+      copy = (char *) alloca (p - *argptr + 1);
+      memcpy (copy, *argptr, p - *argptr);
+      copy[p - *argptr] = '\000';
+      sym = lookup_symbol (copy, 0, VAR_NAMESPACE, 0, &sym_symtab);
+      if (sym)
+	{
+	  /* Yes, we have a symbol; jump to symbol processing */
+	  /* Code after symbol_found expects S, SYM_SYMTAB, SYM, 
+	     and COPY to be set correctly */
+	  *argptr = (*p == '\'') ? p + 1 : p;
+	  s = (struct symtab *) 0;
+	  goto symbol_found;
+	}
+      /* Otherwise fall out from here and go to file/line spec
+         processing, etc. */
+    }
+#endif
+
+  /* S is specified file's symtab, or 0 if no file specified.
+     arg no longer contains the file name.  */
+
+  /* Check whether arg is all digits (and sign) */
+
+  q = *argptr;
+  if (*q == '-' || *q == '+')
+    q++;
+  while (*q >= '0' && *q <= '9')
+    q++;
+
+  if (q != *argptr && (*q == 0 || *q == ' ' || *q == '\t' || *q == ','))
+    {
+      /* We found a token consisting of all digits -- at least one digit.  */
+      enum sign
+	{
+	  none, plus, minus
+	}
+      sign = none;
+
+      /* We might need a canonical line spec if no file was specified.  */
+      int need_canonical = (s == 0) ? 1 : 0;
+
+      /* This is where we need to make sure that we have good defaults.
+         We must guarantee that this section of code is never executed
+         when we are called with just a function name, since
+         select_source_symtab calls us with such an argument  */
+
+      if (s == 0 && default_symtab == 0)
+	{
+	  select_source_symtab (0);
+	  default_symtab = current_source_symtab;
+	  default_line = current_source_line;
+	}
+
+      if (**argptr == '+')
+	sign = plus, (*argptr)++;
+      else if (**argptr == '-')
+	sign = minus, (*argptr)++;
+      val.line = atoi (*argptr);
+      switch (sign)
+	{
+	case plus:
+	  if (q == *argptr)
+	    val.line = 5;
+	  if (s == 0)
+	    val.line = default_line + val.line;
+	  break;
+	case minus:
+	  if (q == *argptr)
+	    val.line = 15;
+	  if (s == 0)
+	    val.line = default_line - val.line;
+	  else
+	    val.line = 1;
+	  break;
+	case none:
+	  break;		/* No need to adjust val.line.  */
+	}
+
+      while (*q == ' ' || *q == '\t')
+	q++;
+      *argptr = q;
+      if (s == 0)
+	s = default_symtab;
+
+      /* It is possible that this source file has more than one symtab, 
+         and that the new line number specification has moved us from the
+         default (in s) to a new one.  */
+      val.symtab = find_line_symtab (s, val.line, NULL, NULL);
+      if (val.symtab == 0)
+	val.symtab = s;
+
+      val.pc = 0;
+      values.sals = (struct symtab_and_line *)
+	xmalloc (sizeof (struct symtab_and_line));
+      values.sals[0] = val;
+      values.nelts = 1;
+      if (need_canonical)
+	build_canonical_line_spec (values.sals, NULL, canonical);
+      return values;
+    }
+
+  /* Arg token is not digits => try it as a variable name
+     Find the next token (everything up to end or next whitespace).  */
+
+  if (**argptr == '$')		/* May be a convenience variable */
+    p = skip_quoted (*argptr + (((*argptr)[1] == '$') ? 2 : 1));	/* One or two $ chars possible */
+  else if (is_quoted)
+    {
+      p = skip_quoted (*argptr);
+      if (p[-1] != '\'')
+	error ("Unmatched single quote.");
+    }
+  else if (has_parens)
+    {
+      p = pp + 1;
+    }
+  else
+    {
+      p = skip_quoted (*argptr);
+    }
+
+  if (is_quote_enclosed && **argptr == '"')
+    (*argptr)++;
+
+  copy = (char *) alloca (p - *argptr + 1);
+  memcpy (copy, *argptr, p - *argptr);
+  copy[p - *argptr] = '\0';
+  if (p != *argptr
+      && copy[0]
+      && copy[0] == copy[p - *argptr - 1]
+      && strchr (get_gdb_completer_quote_characters (), copy[0]) != NULL)
+    {
+      copy[p - *argptr - 1] = '\0';
+      copy++;
+    }
+  while (*p == ' ' || *p == '\t')
+    p++;
+  *argptr = p;
+
+  /* If it starts with $: may be a legitimate variable or routine name
+     (e.g. HP-UX millicode routines such as $$dyncall), or it may
+     be history value, or it may be a convenience variable */
+
+  if (*copy == '$')
+    {
+      value_ptr valx;
+      int index = 0;
+      int need_canonical = 0;
+
+      p = (copy[1] == '$') ? copy + 2 : copy + 1;
+      while (*p >= '0' && *p <= '9')
+	p++;
+      if (!*p)			/* reached end of token without hitting non-digit */
+	{
+	  /* We have a value history reference */
+	  sscanf ((copy[1] == '$') ? copy + 2 : copy + 1, "%d", &index);
+	  valx = access_value_history ((copy[1] == '$') ? -index : index);
+	  if (TYPE_CODE (VALUE_TYPE (valx)) != TYPE_CODE_INT)
+	    error ("History values used in line specs must have integer values.");
+	}
+      else
+	{
+	  /* Not all digits -- may be user variable/function or a
+	     convenience variable */
+
+	  /* Look up entire name as a symbol first */
+	  sym = lookup_symbol (copy, 0, VAR_NAMESPACE, 0, &sym_symtab);
+	  s = (struct symtab *) 0;
+	  need_canonical = 1;
+	  /* Symbol was found --> jump to normal symbol processing.
+	     Code following "symbol_found" expects "copy" to have the
+	     symbol name, "sym" to have the symbol pointer, "s" to be
+	     a specified file's symtab, and sym_symtab to be the symbol's
+	     symtab. */
+	  if (sym)
+	    goto symbol_found;
+
+	  /* If symbol was not found, look in minimal symbol tables */
+	  msymbol = lookup_minimal_symbol (copy, 0, 0);
+	  /* Min symbol was found --> jump to minsym processing. */
+	  if (msymbol)
+	    goto minimal_symbol_found;
+
+	  /* Not a user variable or function -- must be convenience variable */
+	  need_canonical = (s == 0) ? 1 : 0;
+	  valx = value_of_internalvar (lookup_internalvar (copy + 1));
+	  if (TYPE_CODE (VALUE_TYPE (valx)) != TYPE_CODE_INT)
+	    error ("Convenience variables used in line specs must have integer values.");
+	}
+
+      /* Either history value or convenience value from above, in valx */
+      val.symtab = s ? s : default_symtab;
+      val.line = value_as_long (valx);
+      val.pc = 0;
+
+      values.sals = (struct symtab_and_line *) xmalloc (sizeof val);
+      values.sals[0] = val;
+      values.nelts = 1;
+
+      if (need_canonical)
+	build_canonical_line_spec (values.sals, NULL, canonical);
+
+      return values;
+    }
+
+
+  /* Look up that token as a variable.
+     If file specified, use that file's per-file block to start with.  */
+
+  sym = lookup_symbol (copy,
+		       (s ? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK)
+			: get_selected_block ()),
+		       VAR_NAMESPACE, 0, &sym_symtab);
+
+symbol_found:			/* We also jump here from inside the C++ class/namespace 
+				   code on finding a symbol of the form "A::B::C" */
+
+  if (sym != NULL)
+    {
+      if (SYMBOL_CLASS (sym) == LOC_BLOCK)
+	{
+	  /* Arg is the name of a function */
+	  values.sals = (struct symtab_and_line *)
+	    xmalloc (sizeof (struct symtab_and_line));
+	  values.sals[0] = find_function_start_sal (sym, funfirstline);
+	  values.nelts = 1;
+
+	  /* Don't use the SYMBOL_LINE; if used at all it points to
+	     the line containing the parameters or thereabouts, not
+	     the first line of code.  */
+
+	  /* We might need a canonical line spec if it is a static
+	     function.  */
+	  if (s == 0)
+	    {
+	      struct blockvector *bv = BLOCKVECTOR (sym_symtab);
+	      struct block *b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+	      if (lookup_block_symbol (b, copy, VAR_NAMESPACE) != NULL)
+		build_canonical_line_spec (values.sals, copy, canonical);
+	    }
+	  return values;
+	}
+      else
+	{
+	  if (funfirstline)
+	    error ("\"%s\" is not a function", copy);
+	  else if (SYMBOL_LINE (sym) != 0)
+	    {
+	      /* We know its line number.  */
+	      values.sals = (struct symtab_and_line *)
+		xmalloc (sizeof (struct symtab_and_line));
+	      values.nelts = 1;
+	      memset (&values.sals[0], 0, sizeof (values.sals[0]));
+	      values.sals[0].symtab = sym_symtab;
+	      values.sals[0].line = SYMBOL_LINE (sym);
+	      return values;
+	    }
+	  else
+	    /* This can happen if it is compiled with a compiler which doesn't
+	       put out line numbers for variables.  */
+	    /* FIXME: Shouldn't we just set .line and .symtab to zero
+	       and return?  For example, "info line foo" could print
+	       the address.  */
+	    error ("Line number not known for symbol \"%s\"", copy);
+	}
+    }
+
+  msymbol = lookup_minimal_symbol (copy, NULL, NULL);
+
+minimal_symbol_found:		/* We also jump here from the case for variables
+				   that begin with '$' */
+
+  if (msymbol != NULL)
+    {
+      values.sals = (struct symtab_and_line *)
+	xmalloc (sizeof (struct symtab_and_line));
+      values.sals[0] = find_pc_sect_line (SYMBOL_VALUE_ADDRESS (msymbol),
+					  (struct sec *) 0, 0);
+      values.sals[0].section = SYMBOL_BFD_SECTION (msymbol);
+      if (funfirstline)
+	{
+	  values.sals[0].pc += FUNCTION_START_OFFSET;
+	  values.sals[0].pc = SKIP_PROLOGUE (values.sals[0].pc);
+	}
+      values.nelts = 1;
+      return values;
+    }
+
+  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.", copy);
+  return values;		/* for lint */
+}
diff --git a/gdb/linespec.h b/gdb/linespec.h
new file mode 100644
index 0000000..4c5d021
--- /dev/null
+++ b/gdb/linespec.h
@@ -0,0 +1,27 @@
+/* Header for GDB line completion.
+   Copyright 2000 Free Software Foundation.
+
+   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.  */
+
+#if !defined (LINESPEC_H)
+#define LINESPEC_H 1
+
+extern struct symtabs_and_lines
+	decode_line_1 (char **argptr, int funfirstline,
+		       struct symtab *default_symtab, int default_line,
+		       char ***canonical);
+
+#endif /* defined (LINESPEC_H) */
diff --git a/gdb/linux-thread.c b/gdb/linux-thread.c
index f25c763..32f6cbe 100644
--- a/gdb/linux-thread.c
+++ b/gdb/linux-thread.c
@@ -205,8 +205,7 @@
 #endif
 /* Check to see if the given thread is alive.  */
 static int
-linuxthreads_thread_alive (pid)
-     int pid;
+linuxthreads_thread_alive (int pid)
 {
   errno = 0;
   return ptrace (PT_READ_U, pid, (PTRACE_ARG3_TYPE)0, 0) >= 0 || errno == 0;
@@ -230,9 +229,7 @@
    our efforts to debug it, accept them with wait, but don't pass them
    through to PID.  Do pass all other signals through.  */   
 static int
-linuxthreads_find_trap (pid, stop)
-    int pid;
-    int stop;
+linuxthreads_find_trap (int pid, int stop)
 {
   int i;
   int rpid;
@@ -382,7 +379,7 @@
 {
   int *saved_pid_ptr = arg;
   inferior_pid = *saved_pid_ptr;
-  free (arg);
+  xfree (arg);
 }
 
 /* Register a cleanup to restore the value of inferior_pid.  */
@@ -397,8 +394,7 @@
 }
 
 static void
-sigchld_handler (signo)
-    int signo;
+sigchld_handler (int signo)
 {
   /* This handler is used to get an EINTR while doing waitpid()
      when an event is received */
@@ -407,8 +403,7 @@
 /* Have we already collected a wait status for PID in the
    linuxthreads_wait bag?  */
 static int
-linuxthreads_pending_status (pid)
-    int pid;
+linuxthreads_pending_status (int pid)
 {
   int i;
   for (i = linuxthreads_wait_last; i >= 0; i--)
@@ -425,9 +420,7 @@
    in OBJFILE, so we complain if it's required, but not there.
    Return true iff things are okay.  */
 static int
-find_signal_var (sig, objfile)
-     struct linuxthreads_signal *sig;
-     struct objfile *objfile;
+find_signal_var (struct linuxthreads_signal *sig, struct objfile *objfile)
 {
   struct minimal_symbol *ms = lookup_minimal_symbol (sig->var, NULL, objfile);
 
@@ -453,8 +446,7 @@
 }
 
 static int
-find_all_signal_vars (objfile)
-     struct objfile *objfile;
+find_all_signal_vars (struct objfile *objfile)
 {
   return (   find_signal_var (&linuxthreads_sig_restart, objfile)
 	  && find_signal_var (&linuxthreads_sig_cancel,  objfile)
@@ -468,8 +460,7 @@
    been initialized yet.  If it has, tell GDB to pass that signal
    through to the inferior silently.  */
 static void
-check_signal_number (sig)
-     struct linuxthreads_signal *sig;
+check_signal_number (struct linuxthreads_signal *sig)
 {
   int num;
 
@@ -505,7 +496,7 @@
 }
 
 void
-check_all_signal_numbers ()
+check_all_signal_numbers (void)
 {
   /* If this isn't a LinuxThreads program, quit early.  */
   if (! linuxthreads_max)
@@ -538,8 +529,7 @@
    talking to an executable that uses LinuxThreads, so we clear the
    signal number and variable address too.  */
 static void
-restore_signal (sig)
-     struct linuxthreads_signal *sig;
+restore_signal (struct linuxthreads_signal *sig)
 {
   if (! sig->signal)
     return;
@@ -559,7 +549,7 @@
    talking to an executable that uses LinuxThreads, so we clear the
    signal number and variable address too.  */
 static void
-restore_all_signals ()
+restore_all_signals (void)
 {
   restore_signal (&linuxthreads_sig_restart);
   restore_signal (&linuxthreads_sig_cancel);
@@ -578,9 +568,7 @@
    If ALL is non-zero, process all threads.
    If ALL is zero, skip threads with pending status.  */
 static void
-iterate_active_threads (func, all)
-    void (*func)(int);
-    int all;
+iterate_active_threads (void (*func) (int), int all)
 {
   CORE_ADDR descr;
   int pid;
@@ -610,8 +598,7 @@
    This is the worker function for linuxthreads_insert_breakpoint,
    which passes it to iterate_active_threads.  */
 static void
-insert_breakpoint (pid)
-    int pid;
+insert_breakpoint (int pid)
 {
   int j;
 
@@ -637,8 +624,7 @@
    breakpoint if the thread's PC is pointing at the breakpoint being
    removed.  */
 static void
-remove_breakpoint (pid)
-    int pid;
+remove_breakpoint (int pid)
 {
   int j;
 
@@ -663,8 +649,7 @@
 
 /* Kill a thread */
 static void
-kill_thread (pid)
-    int pid;
+kill_thread (int pid)
 {
   if (in_thread_list (pid))
     {
@@ -678,8 +663,7 @@
 
 /* Resume a thread */
 static void
-resume_thread (pid)
-    int pid;
+resume_thread (int pid)
 {
   if (pid != inferior_pid
       && in_thread_list (pid)
@@ -698,8 +682,7 @@
 
 /* Detach a thread */
 static void
-detach_thread (pid)
-    int pid;
+detach_thread (int pid)
 {
   if (in_thread_list (pid) && linuxthreads_thread_alive (pid))
     {
@@ -714,8 +697,7 @@
 
 /* Attach a thread */
 void
-attach_thread (pid)
-     int pid;
+attach_thread (int pid)
 {
   if (ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0) != 0)
     perror_with_name ("attach_thread");
@@ -723,8 +705,7 @@
 
 /* Stop a thread */
 static void
-stop_thread (pid)
-    int pid;
+stop_thread (int pid)
 {
   if (pid != inferior_pid)
     {
@@ -752,8 +733,7 @@
 
 /* Wait for a thread */
 static void
-wait_thread (pid)
-    int pid;
+wait_thread (int pid)
 {
   int status;
   int rpid;
@@ -815,8 +795,7 @@
 /* Walk through the linuxthreads handles in order to detect all
    threads and stop them */
 static void
-update_stop_threads (test_pid)
-    int test_pid;
+update_stop_threads (int test_pid)
 {
   struct cleanup *old_chain = NULL;
 
@@ -905,8 +884,7 @@
 static void (*target_new_objfile_chain) (struct objfile *);
 
 void
-linuxthreads_new_objfile (objfile)
-    struct objfile *objfile;
+linuxthreads_new_objfile (struct objfile *objfile)
 {
   struct minimal_symbol *ms;
 
@@ -1076,8 +1054,7 @@
    return 1 otherwise 0.  */
 
 int
-linuxthreads_prepare_to_proceed (step)
-    int step;
+linuxthreads_prepare_to_proceed (int step)
 {
   if (!linuxthreads_max
       || !linuxthreads_manager_pid
@@ -1098,8 +1075,7 @@
 /* Convert a pid to printable form. */
 
 char *
-linuxthreads_pid_to_str (pid)
-    int pid;
+linuxthreads_pid_to_str (int pid)
 {
   static char buf[100];
 
@@ -1115,9 +1091,7 @@
    and wait for the trace-trap that results from attaching.  */
 
 static void
-linuxthreads_attach (args, from_tty)
-    char *args;
-    int from_tty;
+linuxthreads_attach (char *args, int from_tty)
 {
   if (!args)
     error_no_arg ("process-id to attach");
@@ -1143,9 +1117,7 @@
    started via the normal ptrace (PTRACE_TRACEME).  */
 
 static void
-linuxthreads_detach (args, from_tty)
-    char *args;
-    int from_tty;
+linuxthreads_detach (char *args, int from_tty)
 {
   if (linuxthreads_max)
     {
@@ -1209,10 +1181,7 @@
    signal activated.  */
 
 static void
-linuxthreads_resume (pid, step, signo)
-    int pid;
-    int step;
-    enum target_signal signo;
+linuxthreads_resume (int pid, int step, enum target_signal signo)
 {
   if (!linuxthreads_max || stop_soon_quietly || linuxthreads_manager_pid == 0)
     {
@@ -1288,10 +1257,7 @@
 
 /* Abstract out the child_wait functionality.  */
 int
-linux_child_wait (pid, rpid, status)
-     int pid;
-     int *rpid;
-     int *status;
+linux_child_wait (int pid, int *rpid, int *status)
 {
   int save_errno;
 
@@ -1345,9 +1311,7 @@
    to a LWP id, and vice versa on the way out.  */
 
 static int
-linuxthreads_wait (pid, ourstatus)
-     int pid;
-     struct target_waitstatus *ourstatus;
+linuxthreads_wait (int pid, struct target_waitstatus *ourstatus)
 {
   int status;
   int rpid;
@@ -1582,10 +1546,7 @@
 /* Fork an inferior process, and start debugging it with ptrace.  */
 
 static void
-linuxthreads_create_inferior (exec_file, allargs, env)
-    char *exec_file;
-    char *allargs;
-    char **env;
+linuxthreads_create_inferior (char *exec_file, char *allargs, char **env)
 {
   if (!exec_file && !exec_bfd)
     {
@@ -1607,7 +1568,7 @@
 }
 
 void
-linuxthreads_discard_global_state ()
+linuxthreads_discard_global_state (void)
 {
   linuxthreads_inferior_pid = 0;
   linuxthreads_breakpoint_pid = 0;
@@ -1622,7 +1583,7 @@
 /* Clean up after the inferior dies.  */
 
 static void
-linuxthreads_mourn_inferior ()
+linuxthreads_mourn_inferior (void)
 {
   if (linuxthreads_max)
     {
@@ -1641,7 +1602,7 @@
 /* Kill the inferior process */
 
 static void
-linuxthreads_kill ()
+linuxthreads_kill (void)
 {
   int rpid;
   int status;
@@ -1702,9 +1663,7 @@
 /* Insert a breakpoint */
 
 static int
-linuxthreads_insert_breakpoint (addr, contents_cache)
-    CORE_ADDR addr;
-    char *contents_cache;
+linuxthreads_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   if (linuxthreads_max && linuxthreads_manager_pid != 0)
     {
@@ -1719,9 +1678,7 @@
 /* Remove a breakpoint */
 
 static int
-linuxthreads_remove_breakpoint (addr, contents_cache)
-    CORE_ADDR addr;
-    char *contents_cache;
+linuxthreads_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   if (linuxthreads_max && linuxthreads_manager_pid != 0)
     {
@@ -1736,14 +1693,14 @@
 /* Mark our target-struct as eligible for stray "run" and "attach" commands.  */
 
 static int
-linuxthreads_can_run ()
+linuxthreads_can_run (void)
 {
   return child_suppress_run;
 }
 
 
 static void
-init_linuxthreads_ops ()
+init_linuxthreads_ops (void)
 {
   linuxthreads_ops.to_shortname = "linuxthreads";
   linuxthreads_ops.to_longname  = "LINUX threads and pthread.";
@@ -1765,7 +1722,7 @@
 }
 
 void
-_initialize_linuxthreads ()
+_initialize_linuxthreads (void)
 {
   struct sigaction sact;
   sigset_t linuxthreads_wait_mask;	  /* sigset with SIGCHLD */
diff --git a/gdb/lynx-nat.c b/gdb/lynx-nat.c
index 3974018..20a7e16 100644
--- a/gdb/lynx-nat.c
+++ b/gdb/lynx-nat.c
@@ -260,8 +260,7 @@
    It also handles knows where to find the I & L regs on the stack.  */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   int whatregs = 0;
 
@@ -361,8 +360,7 @@
    this point.  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   int whatregs = 0;
 
@@ -469,8 +467,7 @@
    saved context block.  */
 
 static unsigned long
-registers_addr (pid)
-     int pid;
+registers_addr (int pid)
 {
   CORE_ADDR stblock;
   int ecpoff = offsetof (st_t, ecp);
@@ -495,8 +492,7 @@
    marking them as valid so we won't fetch them again.  */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   int reglo, reghi;
   int i;
@@ -547,8 +543,7 @@
 #endif
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   int reglo, reghi;
   int i;
@@ -595,9 +590,7 @@
    of error; store status through argument pointer OURSTATUS.  */
 
 int
-child_wait (pid, ourstatus)
-     int pid;
-     struct target_waitstatus *ourstatus;
+child_wait (int pid, struct target_waitstatus *ourstatus)
 {
   int save_errno;
   int thread;
@@ -716,8 +709,7 @@
 
 /* Return nonzero if the given thread is still alive.  */
 int
-child_thread_alive (pid)
-     int pid;
+child_thread_alive (int pid)
 {
   /* Arggh.  Apparently pthread_kill only works for threads within
      the process that calls pthread_kill.
@@ -736,10 +728,7 @@
    If SIGNAL is nonzero, give it that signal.  */
 
 void
-child_resume (pid, step, signal)
-     int pid;
-     int step;
-     enum target_signal signal;
+child_resume (int pid, int step, enum target_signal signal)
 {
   int func;
 
@@ -775,8 +764,7 @@
    buffer.  */
 
 char *
-child_pid_to_str (pid)
-     int pid;
+child_pid_to_str (int pid)
 {
   static char buf[40];
 
@@ -799,11 +787,8 @@
  */
 
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR reg_addr;
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+		      CORE_ADDR reg_addr)
 {
   struct st_entry s;
   unsigned int regno;
@@ -835,7 +820,7 @@
 };
 
 void
-_initialize_core_lynx ()
+_initialize_core_lynx (void)
 {
   add_core_fns (&lynx_core_fns);
 }
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 8b93810..3896c2d 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -44,10 +44,7 @@
  */
 
 static void
-m2_emit_char (c, stream, quoter)
-     register int c;
-     struct ui_file *stream;
-     int quoter;
+m2_emit_char (register int c, struct ui_file *stream, int quoter)
 {
 
   c &= 0xFF;			/* Avoid sign bit follies */
@@ -96,9 +93,7 @@
    be replaced with a true Modula version. */
 
 static void
-m2_printchar (c, stream)
-     int c;
-     struct ui_file *stream;
+m2_printchar (int c, struct ui_file *stream)
 {
   fputs_filtered ("'", stream);
   LA_EMIT_CHAR (c, stream, '\'');
@@ -113,12 +108,8 @@
    be replaced with a true Modula version. */
 
 static void
-m2_printstr (stream, string, length, width, force_ellipses)
-     struct ui_file *stream;
-     char *string;
-     unsigned int length;
-     int width;
-     int force_ellipses;
+m2_printstr (struct ui_file *stream, char *string, unsigned int length,
+	     int width, int force_ellipses)
 {
   register unsigned int i;
   unsigned int things_printed = 0;
@@ -205,9 +196,7 @@
    by an experienced Modula programmer. */
 
 static struct type *
-m2_create_fundamental_type (objfile, typeid)
-     struct objfile *objfile;
-     int typeid;
+m2_create_fundamental_type (struct objfile *objfile, int typeid)
 {
   register struct type *type = NULL;
 
@@ -425,6 +414,7 @@
   m2_builtin_types,
   range_check_on,
   type_check_on,
+  case_sensitive_on,
   m2_parse,			/* parser */
   m2_error,			/* parser error function */
   evaluate_subexp_standard,
@@ -449,7 +439,7 @@
 /* Initialization for Modula-2 */
 
 void
-_initialize_m2_language ()
+_initialize_m2_language (void)
 {
   /* Modula-2 "pervasive" types.  NOTE:  these can be redefined!!! */
   builtin_type_m2_int =
diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c
index ee7e836..3278bd0 100644
--- a/gdb/m2-typeprint.c
+++ b/gdb/m2-typeprint.c
@@ -37,12 +37,8 @@
 #include <errno.h>
 
 void
-m2_print_type (type, varstring, stream, show, level)
-     struct type *type;
-     char *varstring;
-     struct ui_file *stream;
-     int show;
-     int level;
+m2_print_type (struct type *type, char *varstring, struct ui_file *stream,
+	       int show, int level)
 {
   extern void c_print_type (struct type *, char *, struct ui_file *, int,
 			    int);
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index 903d96b..a59bed3 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -28,17 +28,9 @@
 /* FIXME:  For now, just explicitly declare c_val_print and use it instead */
 
 int
-m2_val_print (type, valaddr, embedded_offset, address,
-	      stream, format, deref_ref, recurse, pretty)
-     struct type *type;
-     char *valaddr;
-     int embedded_offset;
-     CORE_ADDR address;
-     struct ui_file *stream;
-     int format;
-     int deref_ref;
-     int recurse;
-     enum val_prettyprint pretty;
+m2_val_print (struct type *type, char *valaddr, int embedded_offset,
+	      CORE_ADDR address, struct ui_file *stream, int format,
+	      int deref_ref, int recurse, enum val_prettyprint pretty)
 {
   extern int c_val_print (struct type *, char *, int, CORE_ADDR,
 			  struct ui_file *, int, int, int,
diff --git a/gdb/m3-nat.c b/gdb/m3-nat.c
index c6b9679..b63b75f 100644
--- a/gdb/m3-nat.c
+++ b/gdb/m3-nat.c
@@ -207,9 +207,7 @@
 
 /* "Temporary" debug stuff */
 void
-xx_debug (fmt, a, b, c)
-     char *fmt;
-     int a, b, c;
+xx_debug (char *fmt, int a, int b, int c)
 {
   if (debug_level)
     warning (fmt, a, b, c);
@@ -318,10 +316,7 @@
 port_chain_t notify_chain = (port_chain_t) NULL;
 
 port_chain_t
-port_chain_insert (list, name, type)
-     port_chain_t list;
-     mach_port_t name;
-     int type;
+port_chain_insert (port_chain_t list, mach_port_t name, int type)
 {
   kern_return_t ret;
   port_chain_t new;
@@ -363,9 +358,7 @@
 }
 
 port_chain_t
-port_chain_delete (list, elem)
-     port_chain_t list;
-     mach_port_t elem;
+port_chain_delete (port_chain_t list, mach_port_t elem)
 {
   if (list)
     if (list->port == elem)
@@ -382,17 +375,14 @@
 }
 
 void
-port_chain_destroy (ostack)
-     struct obstack *ostack;
+port_chain_destroy (struct obstack *ostack)
 {
   obstack_free (ostack, 0);
   obstack_init (ostack);
 }
 
 port_chain_t
-port_chain_member (list, elem)
-     port_chain_t list;
-     mach_port_t elem;
+port_chain_member (port_chain_t list, mach_port_t elem)
 {
   while (list)
     {
@@ -404,9 +394,7 @@
 }
 
 int
-map_port_name_to_mid (name, type)
-     mach_port_t name;
-     int type;
+map_port_name_to_mid (mach_port_t name, int type)
 {
   port_chain_t elem;
 
@@ -445,8 +433,7 @@
 
 /* Guard for currently_waiting_for and singlestepped_thread_port */
 static void
-discard_single_step (thread)
-     thread_t thread;
+discard_single_step (thread_t thread)
 {
   currently_waiting_for = inferior_wait_port_set;
 
@@ -455,9 +442,7 @@
     setup_single_step (thread, FALSE);
 }
 
-setup_single_step (thread, start_step)
-     thread_t thread;
-     boolean_t start_step;
+setup_single_step (thread_t thread, boolean_t start_step)
 {
   kern_return_t ret;
 
@@ -545,10 +530,7 @@
 }
 
 static
-request_notify (name, variant, type)
-     mach_port_t name;
-     mach_msg_id_t variant;
-     int type;
+request_notify (mach_port_t name, mach_msg_id_t variant, int type)
 {
   kern_return_t ret;
   mach_port_t previous_port_dummy = MACH_PORT_NULL;
@@ -574,9 +556,7 @@
   notify_chain = port_chain_insert (notify_chain, name, type);
 }
 
-reverse_msg_bits (msgp, type)
-     mach_msg_header_t *msgp;
-     int type;
+reverse_msg_bits (mach_msg_header_t *msgp, int type)
 {
   int rbits, lbits;
   rbits = MACH_MSGH_BITS_REMOTE (msgp->msgh_bits);
@@ -612,7 +592,7 @@
 
 /* Called from inferior after FORK but before EXEC */
 static void
-m3_trace_me ()
+m3_trace_me (void)
 {
   kern_return_t ret;
 
@@ -643,8 +623,7 @@
  */
 
 void
-intercept_exec_calls (exec_counter)
-     int exec_counter;
+intercept_exec_calls (int exec_counter)
 {
   int terminal_initted = 0;
 
@@ -713,7 +692,7 @@
   CHK ("mach_port_extract_right (bsd server send)", ret);
 
   if (acquired != MACH_MSG_TYPE_PORT_SEND)
-    error ("Incorrect right extracted, send right to bsd server excpected");
+    error ("Incorrect right extracted, send right to bsd server expected");
 
   ret = mach_port_insert_right (inferior_task,
 				original_server_port_name,
@@ -740,7 +719,7 @@
   CHK ("mach_port_extract_right (exec_reply)", ret);
 
   if (acquired != MACH_MSG_TYPE_PORT_SEND_ONCE)
-    error ("Incorrect right extracted, send once excpected for exec reply");
+    error ("Incorrect right extracted, send once expected for exec reply");
 
   ret = mach_port_move_member (mach_task_self (),
 			       fake_server,
@@ -878,9 +857,7 @@
 }
 
 void
-consume_send_rights (thread_list, thread_count)
-     thread_array_t thread_list;
-     int thread_count;
+consume_send_rights (thread_array_t thread_list, int thread_count)
 {
   int index;
 
@@ -896,9 +873,7 @@
 }
 
 /* suspend/abort/resume a thread. */
-setup_thread (thread, what)
-     mach_port_t thread;
-     int what;
+setup_thread (mach_port_t thread, int what)
 {
   kern_return_t ret;
 
@@ -918,10 +893,7 @@
 }
 
 int
-map_slot_to_mid (slot, threads, thread_count)
-     int slot;
-     thread_array_t threads;
-     int thread_count;
+map_slot_to_mid (int slot, thread_array_t threads, int thread_count)
 {
   kern_return_t ret;
   int deallocate = 0;
@@ -962,10 +934,7 @@
 }
 
 static int
-parse_thread_id (arg, thread_count, slots)
-     char *arg;
-     int thread_count;
-     int slots;
+parse_thread_id (char *arg, int thread_count, int slots)
 {
   kern_return_t ret;
   int mid;
@@ -1025,10 +994,7 @@
  * 
  */
 kern_return_t
-select_thread (task, thread_id, flag)
-     mach_port_t task;
-     int thread_id;
-     int flag;
+select_thread (mach_port_t task, int thread_id, int flag)
 {
   thread_array_t thread_list;
   int thread_count;
@@ -1144,8 +1110,7 @@
  * Return it's MID
  */
 int
-switch_to_thread (new_thread)
-     thread_t new_thread;
+switch_to_thread (thread_t new_thread)
 {
   thread_t saved_thread = current_thread;
   int mid;
@@ -1168,8 +1133,7 @@
  * Note that the registers are not yet valid in the inferior task.
  */
 static int
-m3_trace_him (pid)
-     int pid;
+m3_trace_him (int pid)
 {
   kern_return_t ret;
 
@@ -1206,7 +1170,7 @@
   return pid;
 }
 
-setup_exception_port ()
+setup_exception_port (void)
 {
   kern_return_t ret;
 
@@ -1269,9 +1233,7 @@
    Returns the inferior_pid for rest of gdb.
    Side effects: Set *OURSTATUS.  */
 int
-mach_really_wait (pid, ourstatus)
-     int pid;
-     struct target_waitstatus *ourstatus;
+mach_really_wait (int pid, struct target_waitstatus *ourstatus)
 {
   kern_return_t ret;
   int w;
@@ -1391,7 +1353,7 @@
  * This is called just before calling error() to return to command level
  */
 void
-mach3_quit ()
+mach3_quit (void)
 {
   int mid;
   kern_return_t ret;
@@ -1435,7 +1397,7 @@
  * Called by REQUEST_QUIT() from utils.c(request_quit)
  */
 void
-mach3_request_quit ()
+mach3_request_quit (void)
 {
   if (mach_really_waiting)
     immediate_quit = 1;
@@ -1448,8 +1410,7 @@
  * gdb to return to the command level like ^C had been typed from terminal.
  */
 int
-gdb_message_server (InP)
-     mach_msg_header_t *InP;
+gdb_message_server (mach_msg_header_t *InP)
 {
   kern_return_t ret;
   int mid;
@@ -1496,7 +1457,7 @@
  * External program "stop-gdb" implements this also.
  */
 void
-stop_inferior_gdb ()
+stop_inferior_gdb (void)
 {
   kern_return_t ret;
 
@@ -1541,8 +1502,7 @@
  * it is selected and the last exception was a breakpoint.
  */
 int
-mach_thread_for_breakpoint (mid)
-     int mid;
+mach_thread_for_breakpoint (int mid)
 {
   int cmid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD);
 
@@ -1576,12 +1536,11 @@
  *    slot index. (Since 0 is reserved))
  */
 int
-mach_thread_parse_id (arg)
-     char *arg;
+mach_thread_parse_id (char *arg)
 {
   int mid;
   if (arg == 0)
-    error ("thread id excpected");
+    error ("thread id expected");
   mid = parse_thread_id (arg, 0, 1);
 
   return mid;
@@ -1590,8 +1549,7 @@
 
 #ifdef THREAD_OUTPUT_ID
 char *
-mach_thread_output_id (mid)
-     int mid;
+mach_thread_output_id (int mid)
 {
   static char foobar[20];
 
@@ -1615,8 +1573,7 @@
  *
  */
 
-mach3_prepare_to_proceed (select_it)
-     int select_it;
+mach3_prepare_to_proceed (int select_it)
 {
   if (stop_thread &&
       stop_thread != current_thread &&
@@ -1653,11 +1610,8 @@
  */
 
 kern_return_t
-catch_exception_raise (port, thread, task, exception, code, subcode)
-     mach_port_t port;
-     thread_t thread;
-     task_t task;
-     int exception, code, subcode;
+catch_exception_raise (mach_port_t port, thread_t thread, task_t task,
+		       int exception, int code, int subcode)
 {
   kern_return_t ret;
   boolean_t signal_thread;
@@ -1797,9 +1751,7 @@
 }
 
 int
-port_valid (port, mask)
-     mach_port_t port;
-     int mask;
+port_valid (mach_port_t port, int mask)
 {
   kern_return_t ret;
   mach_port_type_t type;
@@ -1822,10 +1774,7 @@
  * Return 0 on failure; number of bytes read otherwise.
  */
 int
-mach3_read_inferior (addr, myaddr, length)
-     CORE_ADDR addr;
-     char *myaddr;
-     int length;
+mach3_read_inferior (CORE_ADDR addr, char *myaddr, int length)
 {
   kern_return_t ret;
   vm_address_t low_address = (vm_address_t) trunc_page (addr);
@@ -1903,10 +1852,7 @@
  * in gdb's address space.
  */
 int
-mach3_write_inferior (addr, myaddr, length)
-     CORE_ADDR addr;
-     char *myaddr;
-     int length;
+mach3_write_inferior (CORE_ADDR addr, char *myaddr, int length)
 {
   kern_return_t ret;
   vm_address_t low_address = (vm_address_t) trunc_page (addr);
@@ -2064,14 +2010,11 @@
   return length;
 }
 
-/* Return 0 on failure, number of bytes handled otherwise.  */
+/* Return 0 on failure, number of bytes handled otherwise.  TARGET is
+   ignored. */
 static int
-m3_xfer_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* IGNORED */
+m3_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		struct target_ops *target)
 {
   int result;
 
@@ -2085,8 +2028,7 @@
 
 
 static char *
-translate_state (state)
-     int state;
+translate_state (int state)
 {
   switch (state)
     {
@@ -2106,8 +2048,7 @@
 }
 
 static char *
-translate_cstate (state)
-     int state;
+translate_cstate (int state)
 {
   switch (state)
     {
@@ -2129,9 +2070,7 @@
 /* type == MACH_MSG_TYPE_COPY_SEND || type == MACH_MSG_TYPE_MAKE_SEND */
 
 mach_port_t			/* no mach_port_name_t found in include files. */
-map_inferior_port_name (inferior_name, type)
-     mach_port_t inferior_name;
-     mach_msg_type_name_t type;
+map_inferior_port_name (mach_port_t inferior_name, mach_msg_type_name_t type)
 {
   kern_return_t ret;
   mach_msg_type_name_t acquired;
@@ -2169,9 +2108,7 @@
 static char buf[7];
 
 static char *
-get_thread_name (one_cproc, id)
-     gdb_thread_t one_cproc;
-     int id;
+get_thread_name (gdb_thread_t one_cproc, int id)
 {
   if (one_cproc)
     if (one_cproc->cthread == NULL)
@@ -2199,9 +2136,7 @@
 }
 
 int
-fetch_thread_info (task, mthreads_out)
-     mach_port_t task;
-     gdb_thread_t *mthreads_out;	/* out */
+fetch_thread_info (mach_port_t task, gdb_thread_t *mthreads_out)
 {
   kern_return_t ret;
   thread_array_t th_table;
@@ -2274,8 +2209,7 @@
  * emulator stack below struct emul_stack_top stuff.
  */
 CORE_ADDR
-fetch_usp_from_emulator_stack (sp)
-     CORE_ADDR sp;
+fetch_usp_from_emulator_stack (CORE_ADDR sp)
 {
   CORE_ADDR stack_pointer;
 
@@ -2303,8 +2237,7 @@
 /* Check if the emulator exists at task's address space.
  */
 boolean_t
-have_emulator_p (task)
-     task_t task;
+have_emulator_p (task_t task)
 {
   kern_return_t ret;
 #ifndef EMUL_VECTOR_COUNT
@@ -2352,10 +2285,8 @@
 /* Map cprocs to kernel threads and vice versa.  */
 
 void
-map_cprocs_to_kernel_threads (cprocs, mthreads, thread_count)
-     gdb_thread_t cprocs;
-     gdb_thread_t mthreads;
-     int thread_count;
+map_cprocs_to_kernel_threads (gdb_thread_t cprocs, gdb_thread_t mthreads,
+			      int thread_count)
 {
   int index;
   gdb_thread_t scan;
@@ -2471,9 +2402,7 @@
 #define TL_HEADER "\n@    MID  Name        KState CState   Where\n"
 
 void
-print_tl_address (stream, pc)
-     struct ui_file *stream;
-     CORE_ADDR pc;
+print_tl_address (struct ui_file *stream, CORE_ADDR pc)
 {
   if (!lookup_minimal_symbol_by_pc (pc))
     fprintf_filtered (stream, local_hex_format (), pc);
@@ -2494,8 +2423,7 @@
 
 /* Returns the address of variable NAME or 0 if not found */
 CORE_ADDR
-lookup_address_of_variable (name)
-     char *name;
+lookup_address_of_variable (char *name)
 {
   struct symbol *sym;
   CORE_ADDR symaddr = 0;
@@ -2522,16 +2450,17 @@
 }
 
 static gdb_thread_t
-get_cprocs ()
+get_cprocs (void)
 {
   gdb_thread_t cproc_head;
   gdb_thread_t cproc_copy;
   CORE_ADDR their_cprocs;
-  char *buf[TARGET_PTR_BIT / HOST_CHAR_BIT];
+  char *buf;
   char *name;
   cthread_t cthread;
   CORE_ADDR symaddr;
 
+  buf = alloca (TARGET_PTR_BIT / HOST_CHAR_BIT);
   symaddr = lookup_address_of_variable ("cproc_list");
 
   if (!symaddr)
@@ -2636,8 +2565,7 @@
 #define FETCH_CPROC_STATE(mth) mach3_cproc_state (mth)
 
 int
-mach3_cproc_state (mthread)
-     gdb_thread_t mthread;
+mach3_cproc_state (gdb_thread_t mthread)
 {
   int context;
 
@@ -2674,7 +2602,7 @@
 
 
 void
-thread_list_command ()
+thread_list_command (void)
 {
   thread_basic_info_data_t ths;
   int thread_count;
@@ -2893,9 +2821,7 @@
 }
 
 void
-thread_select_command (args, from_tty)
-     char *args;
-     int from_tty;
+thread_select_command (char *args, int from_tty)
 {
   int mid;
   thread_array_t thread_list;
@@ -2932,9 +2858,7 @@
 						   MACH_TYPE_THREAD) : mid);
 }
 
-thread_trace (thread, set)
-     mach_port_t thread;
-     boolean_t set;
+thread_trace (mach_port_t thread, boolean_t set)
 {
   int flavor = TRACE_FLAVOR;
   unsigned int stateCnt = TRACE_FLAVOR_SIZE;
@@ -2980,8 +2904,7 @@
    This definitely includes breakpoints, for instance, or else we
    end up looping in mysterious Bpt traps */
 
-flush_inferior_icache (pc, amount)
-     CORE_ADDR pc;
+flush_inferior_icache (CORE_ADDR pc, int amount)
 {
   vm_machine_attribute_val_t flush = MATTR_VAL_ICACHE_FLUSH;
   kern_return_t ret;
@@ -2999,8 +2922,7 @@
 
 
 static
-suspend_all_threads (from_tty)
-     int from_tty;
+suspend_all_threads (int from_tty)
 {
   kern_return_t ret;
   thread_array_t thread_list;
@@ -3052,9 +2974,7 @@
 }
 
 void
-thread_suspend_command (args, from_tty)
-     char *args;
-     int from_tty;
+thread_suspend_command (char *args, int from_tty)
 {
   kern_return_t ret;
   int mid;
@@ -3103,8 +3023,7 @@
   current_thread = saved_thread;
 }
 
-resume_all_threads (from_tty)
-     int from_tty;
+resume_all_threads (int from_tty)
 {
   kern_return_t ret;
   thread_array_t thread_list;
@@ -3157,9 +3076,7 @@
 }
 
 void
-thread_resume_command (args, from_tty)
-     char *args;
-     int from_tty;
+thread_resume_command (char *args, int from_tty)
 {
   int mid;
   mach_port_t saved_thread;
@@ -3218,9 +3135,7 @@
 }
 
 void
-thread_kill_command (args, from_tty)
-     char *args;
-     int from_tty;
+thread_kill_command (char *args, int from_tty)
 {
   int mid;
   kern_return_t ret;
@@ -3282,9 +3197,7 @@
 /* Task specific commands; add more if you like */
 
 void
-task_resume_command (args, from_tty)
-     char *args;
-     int from_tty;
+task_resume_command (char *args, int from_tty)
 {
   kern_return_t ret;
   task_basic_info_data_t ta_info;
@@ -3328,9 +3241,7 @@
 
 
 void
-task_suspend_command (args, from_tty)
-     char *args;
-     int from_tty;
+task_suspend_command (char *args, int from_tty)
 {
   kern_return_t ret;
   task_basic_info_data_t ta_info;
@@ -3359,8 +3270,7 @@
 }
 
 static char *
-get_size (bytes)
-     int bytes;
+get_size (int bytes)
 {
   static char size[30];
   int zz = bytes / 1024;
@@ -3375,9 +3285,7 @@
 
 /* Does this require the target task to be suspended?? I don't think so. */
 void
-task_info_command (args, from_tty)
-     char *args;
-     int from_tty;
+task_info_command (char *args, int from_tty)
 {
   int mid = -5;
   mach_port_t task;
@@ -3454,9 +3362,7 @@
  */
 
 static void
-exception_command (args, from_tty)
-     char *args;
-     int from_tty;
+exception_command (char *args, int from_tty)
 {
   char *scan = args;
   int exception;
@@ -3505,8 +3411,7 @@
 }
 
 static void
-print_exception_info (exception)
-     int exception;
+print_exception_info (int exception)
 {
   boolean_t forward = exception_map[exception].forward;
 
@@ -3524,9 +3429,7 @@
 }
 
 void
-exception_info (args, from_tty)
-     char *args;
-     int from_tty;
+exception_info (char *args, int from_tty)
 {
   int exception;
 
@@ -3546,10 +3449,7 @@
 
 /* Check for actions for mach exceptions.
  */
-mach3_exception_actions (w, force_print_only, who)
-     WAITTYPE *w;
-     boolean_t force_print_only;
-     char *who;
+mach3_exception_actions (WAITTYPE *w, boolean_t force_print_only, char *who)
 {
   boolean_t force_print = FALSE;
 
@@ -3603,8 +3503,7 @@
     }
 }
 
-setup_notify_port (create_new)
-     int create_new;
+setup_notify_port (int create_new)
 {
   kern_return_t ret;
 
@@ -3649,9 +3548,7 @@
 char registered_name[MAX_NAME_LEN];
 
 void
-message_port_info (args, from_tty)
-     char *args;
-     int from_tty;
+message_port_info (char *args, int from_tty)
 {
   if (registered_name[0])
     printf_filtered ("gdb's message port name: '%s'\n",
@@ -3661,9 +3558,7 @@
 }
 
 void
-gdb_register_port (name, port)
-     char *name;
-     mach_port_t port;
+gdb_register_port (char *name, mach_port_t port)
 {
   kern_return_t ret;
   static int already_signed = 0;
@@ -3715,9 +3610,7 @@
 
 /*ARGSUSED */
 static void
-thread_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+thread_command (char *arg, int from_tty)
 {
   printf_unfiltered ("\"thread\" must be followed by the name of a thread command.\n");
   help_list (cmd_thread_list, "thread ", -1, gdb_stdout);
@@ -3725,15 +3618,13 @@
 
 /*ARGSUSED */
 static void
-task_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+task_command (char *arg, int from_tty)
 {
   printf_unfiltered ("\"task\" must be followed by the name of a task command.\n");
   help_list (cmd_task_list, "task ", -1, gdb_stdout);
 }
 
-add_mach_specific_commands ()
+add_mach_specific_commands (void)
 {
   /* Thread handling commands */
 
@@ -3814,9 +3705,7 @@
 }
 
 kern_return_t
-do_mach_notify_dead_name (notify, name)
-     mach_port_t notify;
-     mach_port_t name;
+do_mach_notify_dead_name (mach_port_t notify, mach_port_t name)
 {
   kern_return_t kr = KERN_SUCCESS;
 
@@ -3875,9 +3764,7 @@
 }
 
 kern_return_t
-do_mach_notify_msg_accepted (notify, name)
-     mach_port_t notify;
-     mach_port_t name;
+do_mach_notify_msg_accepted (mach_port_t notify, mach_port_t name)
 {
   warning ("do_mach_notify_msg_accepted : notify %x, name %x",
 	   notify, name);
@@ -3885,9 +3772,7 @@
 }
 
 kern_return_t
-do_mach_notify_no_senders (notify, mscount)
-     mach_port_t notify;
-     mach_port_mscount_t mscount;
+do_mach_notify_no_senders (mach_port_t notify, mach_port_mscount_t mscount)
 {
   warning ("do_mach_notify_no_senders : notify %x, mscount %x",
 	   notify, mscount);
@@ -3895,9 +3780,7 @@
 }
 
 kern_return_t
-do_mach_notify_port_deleted (notify, name)
-     mach_port_t notify;
-     mach_port_t name;
+do_mach_notify_port_deleted (mach_port_t notify, mach_port_t name)
 {
   warning ("do_mach_notify_port_deleted : notify %x, name %x",
 	   notify, name);
@@ -3905,9 +3788,7 @@
 }
 
 kern_return_t
-do_mach_notify_port_destroyed (notify, rights)
-     mach_port_t notify;
-     mach_port_t rights;
+do_mach_notify_port_destroyed (mach_port_t notify, mach_port_t rights)
 {
   warning ("do_mach_notify_port_destroyed : notify %x, rights %x",
 	   notify, rights);
@@ -3915,8 +3796,7 @@
 }
 
 kern_return_t
-do_mach_notify_send_once (notify)
-     mach_port_t notify;
+do_mach_notify_send_once (mach_port_t notify)
 {
 #ifdef DUMP_SYSCALL
   /* MANY of these are generated. */
@@ -3928,7 +3808,7 @@
 
 /* Kills the inferior. It's gone when you call this */
 static void
-kill_inferior_fast ()
+kill_inferior_fast (void)
 {
   WAITTYPE w;
 
@@ -3953,7 +3833,7 @@
 }
 
 static void
-m3_kill_inferior ()
+m3_kill_inferior (void)
 {
   kill_inferior_fast ();
   target_mourn_inferior ();
@@ -3962,7 +3842,7 @@
 /* Clean up after the inferior dies.  */
 
 static void
-m3_mourn_inferior ()
+m3_mourn_inferior (void)
 {
   unpush_target (&m3_ops);
   generic_mourn_inferior ();
@@ -3972,10 +3852,7 @@
 /* Fork an inferior process, and start debugging it.  */
 
 static void
-m3_create_inferior (exec_file, allargs, env)
-     char *exec_file;
-     char *allargs;
-     char **env;
+m3_create_inferior (char *exec_file, char *allargs, char **env)
 {
   fork_inferior (exec_file, allargs, env, m3_trace_me, m3_trace_him, NULL, NULL);
   /* We are at the first instruction we care about.  */
@@ -3986,7 +3863,7 @@
 /* Mark our target-struct as eligible for stray "run" and "attach"
    commands.  */
 static int
-m3_can_run ()
+m3_can_run (void)
 {
   return 1;
 }
@@ -3994,8 +3871,7 @@
 /* Mach 3.0 does not need ptrace for anything
  * Make sure nobody uses it on mach.
  */
-ptrace (a, b, c, d)
-     int a, b, c, d;
+ptrace (int a, int b, int c, int d)
 {
   error ("Lose, Lose! Somebody called ptrace\n");
 }
@@ -4005,10 +3881,7 @@
    If SIGNAL is nonzero, give it that signal.  */
 
 void
-m3_resume (pid, step, signal)
-     int pid;
-     int step;
-     enum target_signal signal;
+m3_resume (int pid, int step, enum target_signal signal)
 {
   kern_return_t ret;
 
@@ -4066,8 +3939,7 @@
 
 /* Start debugging the process with the given task */
 void
-task_attach (tid)
-     task_t tid;
+task_attach (task_t tid)
 {
   kern_return_t ret;
   inferior_task = tid;
@@ -4097,14 +3969,13 @@
  * (Someone must have killed it))
  */
 void
-attach_to_thread ()
+attach_to_thread (void)
 {
   if (select_thread (inferior_task, 0, 1) != KERN_SUCCESS)
     error ("Could not select any threads to attach to");
 }
 
-mid_attach (mid)
-     int mid;
+mid_attach (int mid)
 {
   kern_return_t ret;
 
@@ -4125,8 +3996,7 @@
  * "atta pidself". Anyway, the latter is allowed by specifying a MID.
  */
 static int
-m3_do_attach (pid)
-     int pid;
+m3_do_attach (int pid)
 {
   kern_return_t ret;
 
@@ -4162,9 +4032,7 @@
    and wait for the trace-trap that results from attaching.  */
 
 static void
-m3_attach (args, from_tty)
-     char *args;
-     int from_tty;
+m3_attach (char *args, int from_tty)
 {
   char *exec_file;
   int pid;
@@ -4195,7 +4063,7 @@
 }
 
 void
-deallocate_inferior_ports ()
+deallocate_inferior_ports (void)
 {
   kern_return_t ret;
   thread_array_t thread_list;
@@ -4251,8 +4119,7 @@
    SIGNAL = 0 means just continue it.  */
 
 static void
-m3_do_detach (signal)
-     int signal;
+m3_do_detach (int signal)
 {
   kern_return_t ret;
 
@@ -4299,9 +4166,7 @@
    started via fork.  */
 
 static void
-m3_detach (args, from_tty)
-     char *args;
-     int from_tty;
+m3_detach (char *args, int from_tty)
 {
   int siggnal = 0;
 
@@ -4330,7 +4195,7 @@
    debugged.  */
 
 static void
-m3_prepare_to_store ()
+m3_prepare_to_store (void)
 {
 #ifdef CHILD_PREPARE_TO_STORE
   CHILD_PREPARE_TO_STORE ();
@@ -4340,8 +4205,7 @@
 /* Print status information about what we're accessing.  */
 
 static void
-m3_files_info (ignore)
-     struct target_ops *ignore;
+m3_files_info (struct target_ops *ignore)
 {
   /* FIXME: should print MID and all that crap.  */
   printf_unfiltered ("\tUsing the running image of %s %s.\n",
@@ -4349,9 +4213,7 @@
 }
 
 static void
-m3_open (arg, from_tty)
-     char *arg;
-     int from_tty;
+m3_open (char *arg, int from_tty)
 {
   error ("Use the \"run\" command to start a Unix child process.");
 }
@@ -4435,11 +4297,7 @@
 int bsd1_nnames = sizeof (bsd1_names) / sizeof (bsd1_names[0]);
 
 char *
-name_str (name, buf)
-
-     int name;
-     char *buf;
-
+name_str (int name, char *buf)
 {
   switch (name)
     {
@@ -4464,11 +4322,7 @@
 }
 
 char *
-id_str (id, buf)
-
-     int id;
-     char *buf;
-
+id_str (int id, char *buf)
 {
   char *p;
   if (id >= 101000 && id < 101000 + bsd1_nnames)
@@ -4484,8 +4338,7 @@
   return buf;
 }
 
-print_msg (mp)
-     mach_msg_header_t *mp;
+print_msg (mach_msg_header_t *mp)
 {
   char *fmt_x = "%20s : 0x%08x\n";
   char *fmt_d = "%20s : %10d\n";
@@ -4550,10 +4403,7 @@
     }
 }
 
-print_data (p, size, number)
-
-     char *p;
-
+print_data (char *p, int size, int number)
 {
   int *ip;
   short *sp;
@@ -4587,21 +4437,20 @@
 #endif /* DUMP_SYSCALL */
 
 static void
-m3_stop ()
+m3_stop (void)
 {
   error ("to_stop target function not implemented");
 }
 
 static char *
-m3_pid_to_exec_file (pid)
-     int pid;
+m3_pid_to_exec_file (int pid)
 {
   error ("to_pid_to_exec_file target function not implemented");
   return NULL;			/* To keep all compilers happy. */
 }
 
 static void
-init_m3_ops ()
+init_m3_ops (void)
 {
   m3_ops.to_shortname = "mach";
   m3_ops.to_longname = "Mach child process";
@@ -4639,7 +4488,7 @@
 }
 
 void
-_initialize_m3_nat ()
+_initialize_m3_nat (void)
 {
   kern_return_t ret;
 
diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c
index b975ace..b283279 100644
--- a/gdb/m32r-rom.c
+++ b/gdb/m32r-rom.c
@@ -62,11 +62,9 @@
  */
 
 static void
-m32r_load_section (abfd, s, data_count)
-     bfd *abfd;
-     asection *s;
-     unsigned int *data_count;
+m32r_load_section (bfd *abfd, asection *s, void *obj)
 {
+  unsigned int *data_count = obj;
   if (s->flags & SEC_LOAD)
     {
       bfd_size_type section_size = bfd_section_size (abfd, s);
@@ -95,8 +93,7 @@
 }
 
 static int
-m32r_load_1 (dummy)
-     void *dummy;
+m32r_load_1 (void *dummy)
 {
   int data_count = 0;
 
@@ -109,9 +106,7 @@
  */
 
 static void
-m32r_load (filename, from_tty)
-     char *filename;
-     int from_tty;
+m32r_load (char *filename, int from_tty)
 {
   extern int inferior_pid;
   bfd *abfd;
@@ -182,9 +177,7 @@
 }
 
 static void
-m32r_load_gen (filename, from_tty)
-     char *filename;
-     int from_tty;
+m32r_load_gen (char *filename, int from_tty)
 {
   generic_load (filename, from_tty);
 }
@@ -204,11 +197,7 @@
 };
 
 static void
-m32r_supply_register (regname, regnamelen, val, vallen)
-     char *regname;
-     int regnamelen;
-     char *val;
-     int vallen;
+m32r_supply_register (char *regname, int regnamelen, char *val, int vallen)
 {
   int regno;
   int num_regs = sizeof (m32r_regnames) / sizeof (m32r_regnames[0]);
@@ -337,9 +326,7 @@
 }				/* init_m32r_cmds */
 
 static void
-m32r_open (args, from_tty)
-     char *args;
-     int from_tty;
+m32r_open (char *args, int from_tty)
 {
   monitor_open (args, &m32r_cmds, from_tty);
 }
@@ -399,9 +386,7 @@
 }				/* init_mon2000_cmds */
 
 static void
-mon2000_open (args, from_tty)
-     char *args;
-     int from_tty;
+mon2000_open (char *args, int from_tty)
 {
   monitor_open (args, &mon2000_cmds, from_tty);
 }
@@ -412,9 +397,7 @@
    Tell the BootOne monitor what it's ethernet IP address is. */
 
 static void
-m32r_set_board_address (args, from_tty)
-     char *args;
-     int from_tty;
+m32r_set_board_address (char *args, int from_tty)
 {
   int resp_len;
   char buf[1024];
@@ -433,9 +416,7 @@
    Tell the BootOne monitor what gdb's ethernet IP address is. */
 
 static void
-m32r_set_server_address (args, from_tty)
-     char *args;
-     int from_tty;
+m32r_set_server_address (char *args, int from_tty)
 {
   int resp_len;
   char buf[1024];
@@ -454,9 +435,7 @@
    Tell the BootOne monitor the default path for downloadable SREC files. */
 
 static void
-m32r_set_download_path (args, from_tty)
-     char *args;
-     int from_tty;
+m32r_set_download_path (char *args, int from_tty)
 {
   int resp_len;
   char buf[1024];
@@ -472,9 +451,7 @@
 }
 
 static void
-m32r_upload_command (args, from_tty)
-     char *args;
-     int from_tty;
+m32r_upload_command (char *args, int from_tty)
 {
   bfd *abfd;
   asection *s;
@@ -601,7 +578,7 @@
 #endif /* ! _MSC_VER */
 
 void
-_initialize_m32r_rom ()
+_initialize_m32r_rom (void)
 {
   /* Initialize m32r RevC monitor target */
   init_m32r_cmds ();
diff --git a/gdb/m32r-stub.c b/gdb/m32r-stub.c
index 9fdf496..cb95626 100644
--- a/gdb/m32r-stub.c
+++ b/gdb/m32r-stub.c
@@ -535,10 +535,7 @@
 static unsigned long crc32_table[256] = {0, 0};
 
 static unsigned long
-crc32 (buf, len, crc)
-     unsigned char *buf;
-     int len;
-     unsigned long crc;
+crc32 (unsigned char *buf, int len, unsigned long crc)
 {
   if (! crc32_table[1])
     {
@@ -563,8 +560,7 @@
 }
 
 static int 
-hex(ch)
-     unsigned char ch;
+hex (unsigned char ch)
 {
   if ((ch >= 'a') && (ch <= 'f')) return (ch-'a'+10);
   if ((ch >= '0') && (ch <= '9')) return (ch-'0');
@@ -575,7 +571,7 @@
 /* scan for the sequence $<data>#<checksum>     */
 
 unsigned char *
-getpacket ()
+getpacket (void)
 {
   unsigned char *buffer = &remcomInBuffer[0];
   unsigned char checksum;
@@ -651,8 +647,7 @@
 /* send the packet in buffer.  */
 
 static void 
-putpacket(buffer)
-     unsigned char *buffer;
+putpacket (unsigned char *buffer)
 {
   unsigned char checksum;
   int  count;
@@ -680,7 +675,7 @@
 static void (*volatile mem_fault_routine)() = 0;
 
 static void
-set_mem_err ()
+set_mem_err (void)
 {
   mem_err = 1;
 }
@@ -691,8 +686,7 @@
    whether there's anything connected to the expansion bus. */
 
 static int
-mem_safe (addr)
-     unsigned char *addr;
+mem_safe (unsigned char *addr)
 {
 #define BAD_RANGE_ONE_START	((unsigned char *) 0x600000)
 #define BAD_RANGE_ONE_END	((unsigned char *) 0xa00000)
@@ -710,8 +704,7 @@
    to mem_fault, they won't get restored, so there better not be any
    saved).  */
 static int
-get_char (addr)
-     unsigned char *addr;
+get_char (unsigned char *addr)
 {
 #if 1
   if (mem_fault_routine && !mem_safe(addr))
@@ -724,9 +717,7 @@
 }
 
 static void
-set_char (addr, val)
-     unsigned char *addr;
-     unsigned char val;
+set_char (unsigned char *addr, unsigned char val)
 {
 #if 1
   if (mem_fault_routine && !mem_safe (addr))
@@ -744,11 +735,7 @@
    a fault; if zero treat a fault like any other fault in the stub.  */
 
 static unsigned char *
-mem2hex(mem, buf, count, may_fault)
-     unsigned char* mem;
-     unsigned char* buf;
-     int   count;
-     int   may_fault;
+mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault)
 {
   int i;
   unsigned char ch;
@@ -772,11 +759,7 @@
    Return a pointer to the character AFTER the last byte written. */
 
 static unsigned char* 
-hex2mem(buf, mem, count, may_fault)
-     unsigned char* buf;
-     unsigned char* mem;
-     int   count;
-     int   may_fault;
+hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
 {
   int i;
   unsigned char ch;
@@ -801,11 +784,7 @@
    COUNT is the total number of bytes to write into
    memory. */
 static unsigned char *
-bin2mem (buf, mem, count, may_fault)
-     unsigned char *buf;
-     unsigned char *mem;
-     int   count;
-     int   may_fault;
+bin2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
 {
   int i;
   unsigned char ch;
@@ -847,8 +826,7 @@
    translate this number into a unix compatible signal value */
 
 static int 
-computeSignal(exceptionVector)
-     int exceptionVector;
+computeSignal (int exceptionVector)
 {
   int sigval;
   switch (exceptionVector) {
@@ -880,9 +858,7 @@
 /* RETURN NUMBER OF CHARS PROCESSED           */
 /**********************************************/
 static int 
-hexToInt(ptr, intValue)
-     unsigned char **ptr;
-     int *intValue;
+hexToInt (unsigned char **ptr, int *intValue)
 {
   int numChars = 0;
   int hexValue;
@@ -928,8 +904,7 @@
   */
 
 static int 
-isShortBranch(instr)
-     unsigned char *instr;
+isShortBranch (unsigned char *instr)
 {
   unsigned char instr0 = instr[0] & 0x7F;		/* mask off high bit */
 
@@ -948,8 +923,7 @@
 }
 
 static int
-isLongBranch(instr)
-     unsigned char *instr;
+isLongBranch (unsigned char *instr)
 {
   if (instr[0] == 0xFC || instr[0] == 0xFD ||	/* BRA, BNC, BL, BC */
       instr[0] == 0xFE || instr[0] == 0xFF)	/* 24 bit relative */
@@ -975,8 +949,7 @@
     ((((int) addr & 2) || (((unsigned char *) addr)[0] & 0x80) == 0) ? 2 : 4)
 
 static int
-isBranch(instr)
-     unsigned char *instr;
+isBranch (unsigned char *instr)
 {
   if (INSTRUCTION_SIZE(instr) == 2)
     return isShortBranch(instr);
@@ -985,8 +958,7 @@
 }
 
 static int
-willBranch(instr, branchCode)
-     unsigned char *instr;
+willBranch (unsigned char *instr, int branchCode)
 {
   switch (branchCode) 
     {
@@ -1041,8 +1013,7 @@
 }
 
 static int 
-branchDestination(instr, branchCode) 
-     unsigned char *instr;
+branchDestination (unsigned char *instr, int branchCode)
 { 
   switch (branchCode) { 
   default: 
@@ -1073,9 +1044,7 @@
 }
 
 static void
-branchSideEffects(instr, branchCode)
-     unsigned char *instr;
-     int branchCode;
+branchSideEffects (unsigned char *instr, int branchCode)
 {
   switch (branchCode)
     {
@@ -1185,7 +1154,7 @@
 	    just "continue continuing".  */
 
 static int
-finish_from_step()
+finish_from_step (void)
 {
   if (stepping.stepping)	/* anything to do? */
     {
@@ -1276,7 +1245,7 @@
    but doing stash_registers in C isn't straightforward.  */
 
 static void
-cleanup_stash ()
+cleanup_stash (void)
 {
   psw = (struct PSWreg *) &registers[PSW];	/* fields of PSW register */
   psw->sm = psw->bsm;		/* fix up pre-trap values of psw fields */
@@ -1344,8 +1313,7 @@
    NUM is the trap/exception number.  */
 
 static void
-process_exception (num)
-     int num;
+process_exception (int num)
 {
   cleanup_stash ();
   asm volatile ("
@@ -1552,7 +1520,7 @@
 /* this function is used to set up exception handlers for tracing and
    breakpoints */
 void 
-set_debug_traps()
+set_debug_traps (void)
 {
   /*  extern void remcomHandler(); */
   int i;
@@ -1593,7 +1561,7 @@
 #define BREAKPOINT() asm volatile ("	trap #2");
 
 void 
-breakpoint()
+breakpoint (void)
 {
   if (initialized)
     BREAKPOINT();
@@ -1612,8 +1580,7 @@
    Returns: the char */
  
 static int
-gdb_putchar(ch)
-     int ch;
+gdb_putchar (int ch)
 {
   char buf[4];
  
@@ -1630,9 +1597,7 @@
    Returns: number of bytes written */
  
 static int
-gdb_write(data, len)
-     char *data;
-     int len;
+gdb_write (char *data, int len)
 {
   char *buf, *cpy;
   int i;
@@ -1660,8 +1625,7 @@
    Returns: the length of the string */
  
 static int
-gdb_puts(str)
-     char *str;
+gdb_puts (char *str)
 {
   return gdb_write(str, strlen(str));
 }
@@ -1672,9 +1636,7 @@
    will cause the optional second string to be inserted.  */
  
 static void
-gdb_error(format, parm)
-     char * format;
-     char * parm;
+gdb_error (char *format, char *parm)
 {
   char buf[400], *cpy;
   int len;
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index cb5d9c3..e868403 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -33,9 +33,7 @@
    Return nonzero if call_function should allocate stack space for a
    struct return? */
 int
-m32r_use_struct_convention (gcc_p, type)
-     int gcc_p;
-     struct type *type;
+m32r_use_struct_convention (int gcc_p, struct type *type)
 {
   return (TYPE_LENGTH (type) > 8);
 }
@@ -46,9 +44,8 @@
    an empty frame_saved_regs, so I guess that's better than total failure */
 
 void
-m32r_frame_find_saved_regs (fi, regaddr)
-     struct frame_info *fi;
-     struct frame_saved_regs *regaddr;
+m32r_frame_find_saved_regs (struct frame_info *fi,
+			    struct frame_saved_regs *regaddr)
 {
   memcpy (regaddr, &fi->fsr, sizeof (struct frame_saved_regs));
 }
@@ -109,15 +106,9 @@
  */
 
 static void
-decode_prologue (start_pc, scan_limit,
-		 pl_endptr, framelength,
-		 fi, fsr)
-     CORE_ADDR start_pc;
-     CORE_ADDR scan_limit;
-     CORE_ADDR *pl_endptr;	/* var parameter */
-     unsigned long *framelength;
-     struct frame_info *fi;
-     struct frame_saved_regs *fsr;
+decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit, CORE_ADDR *pl_endptr,	/* var parameter */
+		 unsigned long *framelength, struct frame_info *fi,
+		 struct frame_saved_regs *fsr)
 {
   unsigned long framesize;
   int insn;
@@ -309,8 +300,7 @@
    Find end of function prologue */
 
 CORE_ADDR
-m32r_skip_prologue (pc)
-     CORE_ADDR pc;
+m32r_skip_prologue (CORE_ADDR pc)
 {
   CORE_ADDR func_addr, func_end;
   struct symtab_and_line sal;
@@ -344,9 +334,7 @@
 }
 
 static unsigned long
-m32r_scan_prologue (fi, fsr)
-     struct frame_info *fi;
-     struct frame_saved_regs *fsr;
+m32r_scan_prologue (struct frame_info *fi, struct frame_saved_regs *fsr)
 {
   struct symtab_and_line sal;
   CORE_ADDR prologue_start, prologue_end, current_pc;
@@ -389,8 +377,7 @@
    examine the prologue.  */
 
 void
-m32r_init_extra_frame_info (fi)
-     struct frame_info *fi;
+m32r_init_extra_frame_info (struct frame_info *fi)
 {
   int reg;
 
@@ -436,10 +423,7 @@
    any frame pointer offsets.  */
 
 void
-m32r_virtual_frame_pointer (pc, reg, offset)
-     CORE_ADDR pc;
-     long *reg;
-     long *offset;
+m32r_virtual_frame_pointer (CORE_ADDR pc, long *reg, long *offset)
 {
   struct frame_info fi;
 
@@ -474,9 +458,7 @@
    caller-saves registers for an inner frame.  */
 
 CORE_ADDR
-m32r_find_callers_reg (fi, regnum)
-     struct frame_info *fi;
-     int regnum;
+m32r_find_callers_reg (struct frame_info *fi, int regnum)
 {
   for (; fi; fi = fi->next)
     if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
@@ -494,8 +476,7 @@
    For m32r, we save the frame size when we initialize the frame_info.  */
 
 CORE_ADDR
-m32r_frame_chain (fi)
-     struct frame_info *fi;
+m32r_frame_chain (struct frame_info *fi)
 {
   CORE_ADDR fn_start, callers_pc, fp;
 
@@ -529,9 +510,7 @@
    (ie. when using an empty CALL_DUMMY) */
 
 CORE_ADDR
-m32r_push_return_address (pc, sp)
-     CORE_ADDR pc;
-     CORE_ADDR sp;
+m32r_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
 {
   write_register (RP_REGNUM, CALL_DUMMY_ADDRESS ());
   return sp;
@@ -543,8 +522,7 @@
    restoring all saved registers.  */
 
 struct frame_info *
-m32r_pop_frame (frame)
-     struct frame_info *frame;
+m32r_pop_frame (struct frame_info *frame)
 {
   int regnum;
 
@@ -573,8 +551,7 @@
    in the stack anywhere, otherwise we get it from the registers. */
 
 CORE_ADDR
-m32r_frame_saved_pc (fi)
-     struct frame_info *fi;
+m32r_frame_saved_pc (struct frame_info *fi)
 {
   if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
     return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
@@ -614,12 +591,8 @@
    passed as an implicit first argument, always in R0. */
 
 CORE_ADDR
-m32r_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     unsigned char struct_return;
-     CORE_ADDR struct_addr;
+m32r_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+		     unsigned char struct_return, CORE_ADDR struct_addr)
 {
   int stack_offset, stack_alloc;
   int argreg;
@@ -700,14 +673,8 @@
    is the target of the target function call.  */
 
 void
-m32r_fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p)
-     char *dummy;
-     CORE_ADDR pc;
-     CORE_ADDR fun;
-     int nargs;
-     value_ptr *args;
-     struct type *type;
-     int gcc_p;
+m32r_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
+		     value_ptr *args, struct type *type, int gcc_p)
 {
   /* ld24 r8, <(imm24) fun> */
   *(unsigned long *) (dummy) = (fun & 0x00ffffff) | 0xe8000000;
@@ -719,8 +686,7 @@
    we must actually write one of those two as well, depending on PSW. */
 
 void
-m32r_write_sp (val)
-     CORE_ADDR val;
+m32r_write_sp (CORE_ADDR val)
 {
   unsigned long psw = read_register (PSW_REGNUM);
 
@@ -732,7 +698,7 @@
 }
 
 void
-_initialize_m32r_tdep ()
+_initialize_m32r_tdep (void)
 {
   tm_print_insn = print_insn_m32r;
 }
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
new file mode 100644
index 0000000..64f7810
--- /dev/null
+++ b/gdb/m68hc11-tdep.c
@@ -0,0 +1,1169 @@
+/* Target-dependent code for Motorola 68HC11 & 68HC12
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Contributed by Stephane Carrez, stcarrez@worldnet.fr
+
+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 "frame.h"
+#include "obstack.h"
+#include "symtab.h"
+#include "gdbtypes.h"
+#include "gdbcmd.h"
+#include "gdbcore.h"
+#include "gdb_string.h"
+#include "value.h"
+#include "inferior.h"
+#include "dis-asm.h"  
+#include "symfile.h"
+#include "objfiles.h"
+#include "arch-utils.h"
+
+#include "target.h"
+#include "opcode/m68hc11.h"
+
+/* Register numbers of various important registers.
+   Note that some of these values are "real" register numbers,
+   and correspond to the general registers of the machine,
+   and some are "phony" register numbers which are too large
+   to be actual register numbers as far as the user is concerned
+   but do serve to get the desired values when passed to read_register.  */
+
+#define HARD_X_REGNUM 	0
+#define HARD_D_REGNUM	1
+#define HARD_Y_REGNUM   2
+#define HARD_SP_REGNUM 	3
+#define HARD_PC_REGNUM 	4
+
+#define HARD_A_REGNUM   5
+#define HARD_B_REGNUM   6
+#define HARD_CCR_REGNUM 7
+#define M68HC11_LAST_HARD_REG (HARD_CCR_REGNUM)
+
+/* Z is replaced by X or Y by gcc during machine reorg.
+   ??? There is no way to get it and even know whether
+   it's in X or Y or in ZS.  */
+#define SOFT_Z_REGNUM        8
+
+/* Soft registers.  These registers are special.  There are treated
+   like normal hard registers by gcc and gdb (ie, within dwarf2 info).
+   They are physically located in memory.  */
+#define SOFT_FP_REGNUM       9
+#define SOFT_TMP_REGNUM     10
+#define SOFT_ZS_REGNUM      11
+#define SOFT_XY_REGNUM      12
+#define SOFT_UNUSED_REGNUM  13
+#define SOFT_D1_REGNUM      14
+#define SOFT_D32_REGNUM     (SOFT_D1_REGNUM+31)
+#define M68HC11_MAX_SOFT_REGS 32
+
+#define M68HC11_NUM_REGS        (8)
+#define M68HC11_NUM_PSEUDO_REGS (M68HC11_MAX_SOFT_REGS+5)
+#define M68HC11_ALL_REGS        (M68HC11_NUM_REGS+M68HC11_NUM_PSEUDO_REGS)
+
+#define M68HC11_REG_SIZE    (2)
+
+struct insn_sequence;
+struct gdbarch_tdep
+  {
+    /* Stack pointer correction value.  For 68hc11, the stack pointer points
+       to the next push location.  An offset of 1 must be applied to obtain
+       the address where the last value is saved.  For 68hc12, the stack
+       pointer points to the last value pushed.  No offset is necessary.  */
+    int stack_correction;
+
+    /* Description of instructions in the prologue.  */
+    struct insn_sequence *prologue;
+  };
+
+#define M6811_TDEP gdbarch_tdep (current_gdbarch)
+#define STACK_CORRECTION (M6811_TDEP->stack_correction)
+
+struct frame_extra_info
+{
+  int frame_reg;
+  CORE_ADDR return_pc;
+  CORE_ADDR dummy;
+  int frameless;
+  int size;
+};
+
+/* Table of registers for 68HC11.  This includes the hard registers
+   and the soft registers used by GCC.  */
+static char *
+m68hc11_register_names[] =
+{
+  "x",    "d",    "y",    "sp",   "pc",   "a",    "b",
+  "ccr",  "z",    "frame","tmp",  "zs",   "xy",   0,
+  "d1",   "d2",   "d3",   "d4",   "d5",   "d6",   "d7",
+  "d8",   "d9",   "d10",  "d11",  "d12",  "d13",  "d14",
+  "d15",  "d16",  "d17",  "d18",  "d19",  "d20",  "d21",
+  "d22",  "d23",  "d24",  "d25",  "d26",  "d27",  "d28",
+  "d29",  "d30",  "d31",  "d32"
+};
+
+struct m68hc11_soft_reg 
+{
+  const char *name;
+  CORE_ADDR   addr;
+};
+
+static struct m68hc11_soft_reg soft_regs[M68HC11_ALL_REGS];
+
+#define M68HC11_FP_ADDR soft_regs[SOFT_FP_REGNUM].addr
+
+static int soft_min_addr;
+static int soft_max_addr;
+static int soft_reg_initialized = 0;
+
+/* Look in the symbol table for the address of a pseudo register
+   in memory.  If we don't find it, pretend the register is not used
+   and not available.  */
+static void
+m68hc11_get_register_info (struct m68hc11_soft_reg *reg, const char *name)
+{
+  struct minimal_symbol *msymbol;
+
+  msymbol = lookup_minimal_symbol (name, NULL, NULL);
+  if (msymbol)
+    {
+      reg->addr = SYMBOL_VALUE_ADDRESS (msymbol);
+      reg->name = xstrdup (name);
+
+      /* Keep track of the address range for soft registers.  */
+      if (reg->addr < (CORE_ADDR) soft_min_addr)
+        soft_min_addr = reg->addr;
+      if (reg->addr > (CORE_ADDR) soft_max_addr)
+        soft_max_addr = reg->addr;
+    }
+  else
+    {
+      reg->name = 0;
+      reg->addr = 0;
+    }
+}
+
+/* Initialize the table of soft register addresses according
+   to the symbol table.  */
+  static void
+m68hc11_initialize_register_info (void)
+{
+  int i;
+
+  if (soft_reg_initialized)
+    return;
+  
+  soft_min_addr = INT_MAX;
+  soft_max_addr = 0;
+  for (i = 0; i < M68HC11_ALL_REGS; i++)
+    {
+      soft_regs[i].name = 0;
+    }
+  
+  m68hc11_get_register_info (&soft_regs[SOFT_FP_REGNUM], "_.frame");
+  m68hc11_get_register_info (&soft_regs[SOFT_TMP_REGNUM], "_.tmp");
+  m68hc11_get_register_info (&soft_regs[SOFT_ZS_REGNUM], "_.z");
+  soft_regs[SOFT_Z_REGNUM] = soft_regs[SOFT_ZS_REGNUM];
+  m68hc11_get_register_info (&soft_regs[SOFT_XY_REGNUM], "_.xy");
+
+  for (i = SOFT_D1_REGNUM; i < M68HC11_MAX_SOFT_REGS; i++)
+    {
+      char buf[10];
+
+      sprintf (buf, "_.d%d", i - SOFT_D1_REGNUM + 1);
+      m68hc11_get_register_info (&soft_regs[i], buf);
+    }
+
+  if (soft_regs[SOFT_FP_REGNUM].name == 0)
+    {
+      warning ("No frame soft register found in the symbol table.\n");
+      warning ("Stack backtrace will not work.\n");
+    }
+  soft_reg_initialized = 1;
+}
+
+/* Given an address in memory, return the soft register number if
+   that address corresponds to a soft register.  Returns -1 if not.  */
+static int
+m68hc11_which_soft_register (CORE_ADDR addr)
+{
+  int i;
+  
+  if (addr < soft_min_addr || addr > soft_max_addr)
+    return -1;
+  
+  for (i = SOFT_FP_REGNUM; i < M68HC11_ALL_REGS; i++)
+    {
+      if (soft_regs[i].name && soft_regs[i].addr == addr)
+        return i;
+    }
+  return -1;
+}
+
+/* Fetch a pseudo register.  The 68hc11 soft registers are treated like
+   pseudo registers.  They are located in memory.  Translate the register
+   fetch into a memory read.  */
+void
+m68hc11_fetch_pseudo_register (int regno)
+{
+  char buf[MAX_REGISTER_RAW_SIZE];
+
+  m68hc11_initialize_register_info ();
+  
+  /* Fetch a soft register: translate into a memory read.  */
+  if (soft_regs[regno].name)
+    {
+      target_read_memory (soft_regs[regno].addr, buf, 2);
+    }
+  else
+    {
+      memset (buf, 0, 2);
+    }
+  supply_register (regno, buf);
+}
+
+/* Store a pseudo register.  Translate the register store
+   into a memory write.  */
+static void
+m68hc11_store_pseudo_register (int regno)
+{
+  m68hc11_initialize_register_info ();
+
+  /* Store a soft register: translate into a memory write.  */
+  if (soft_regs[regno].name)
+    {
+      char buf[MAX_REGISTER_RAW_SIZE];
+
+      read_register_gen (regno, buf);
+      target_write_memory (soft_regs[regno].addr, buf, 2);
+    }
+}
+
+static char *
+m68hc11_register_name (int reg_nr)
+{
+  if (reg_nr < 0)
+    return NULL;
+  if (reg_nr >= M68HC11_ALL_REGS)
+    return NULL;
+
+  /* If we don't know the address of a soft register, pretend it
+     does not exist.  */
+  if (reg_nr > M68HC11_LAST_HARD_REG && soft_regs[reg_nr].name == 0)
+    return NULL;
+  return m68hc11_register_names[reg_nr];
+}
+
+static unsigned char *
+m68hc11_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
+{
+  static unsigned char breakpoint[] = {0x0};
+  
+  *lenptr = sizeof (breakpoint);
+  return breakpoint;
+}
+
+/* Immediately after a function call, return the saved pc before the frame
+   is setup.  */
+
+static CORE_ADDR
+m68hc11_saved_pc_after_call (struct frame_info *frame)
+{
+  CORE_ADDR addr;
+  
+  addr = read_register (HARD_SP_REGNUM) + STACK_CORRECTION;
+  addr &= 0x0ffff;
+  return read_memory_integer (addr, 2) & 0x0FFFF;
+}
+
+static CORE_ADDR
+m68hc11_frame_saved_pc (struct frame_info *frame)
+{
+  return frame->extra_info->return_pc;
+}
+
+static CORE_ADDR
+m68hc11_frame_args_address (struct frame_info *frame)
+{
+  return frame->frame + frame->extra_info->size + STACK_CORRECTION + 2;
+}
+
+static CORE_ADDR
+m68hc11_frame_locals_address (struct frame_info *frame)
+{
+  return frame->frame;
+}
+
+/* Discard from the stack the innermost frame, restoring all saved
+   registers.  */
+
+static void
+m68hc11_pop_frame (void)
+{
+  register struct frame_info *frame = get_current_frame ();
+  register CORE_ADDR fp, sp;
+  register int regnum;
+
+  if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+    generic_pop_dummy_frame ();
+  else
+    {
+      fp = FRAME_FP (frame);
+      FRAME_INIT_SAVED_REGS (frame);
+
+      /* Copy regs from where they were saved in the frame.  */
+      for (regnum = 0; regnum < M68HC11_ALL_REGS; regnum++)
+	if (frame->saved_regs[regnum])
+	  write_register (regnum,
+                          read_memory_integer (frame->saved_regs[regnum], 2));
+
+      write_register (HARD_PC_REGNUM, frame->extra_info->return_pc);
+      sp = fp + frame->extra_info->size;
+      write_register (HARD_SP_REGNUM, sp);
+    }
+  flush_cached_frames ();
+}
+
+
+/* 68HC11 & 68HC12 prologue analysis.
+
+ */
+#define MAX_CODES 12
+
+/* 68HC11 opcodes.  */
+#undef M6811_OP_PAGE2
+#define M6811_OP_PAGE2 (0x18)
+#define M6811_OP_LDX   (0xde)
+#define M6811_OP_PSHX  (0x3c)
+#define M6811_OP_STS   (0x9f)
+#define M6811_OP_TSX   (0x30)
+#define M6811_OP_XGDX  (0x8f)
+#define M6811_OP_ADDD  (0xc3)
+#define M6811_OP_TXS   (0x35)
+#define M6811_OP_DES   (0x34)
+
+/* 68HC12 opcodes.  */
+#define M6812_OP_PAGE2 (0x18)
+#define M6812_OP_MOVW  (0x01)
+#define M6812_PB_PSHW  (0xae)
+#define M6812_OP_STS   (0x7f)
+#define M6812_OP_LEAS  (0x1b)
+
+/* Operand extraction.  */
+#define OP_DIRECT      (0x100) /* 8-byte direct addressing.  */
+#define OP_IMM_LOW     (0x200) /* Low part of 16-bit constant/address.  */
+#define OP_IMM_HIGH    (0x300) /* High part of 16-bit constant/address.  */
+#define OP_PBYTE       (0x400) /* 68HC12 indexed operand.  */
+
+/* Identification of the sequence.  */
+enum m6811_seq_type
+{
+  P_LAST = 0,
+  P_SAVE_REG,  /* Save a register on the stack.  */
+  P_SET_FRAME, /* Setup the frame pointer.  */
+  P_LOCAL_1,   /* Allocate 1 byte for locals.  */
+  P_LOCAL_2,   /* Allocate 2 bytes for locals.  */
+  P_LOCAL_N    /* Allocate N bytes for locals.  */
+};
+
+struct insn_sequence {
+  enum m6811_seq_type type;
+  unsigned length;
+  unsigned short code[MAX_CODES];
+};
+
+/* Sequence of instructions in the 68HC11 function prologue.  */
+static struct insn_sequence m6811_prologue[] = {
+  /* Sequences to save a soft-register.  */
+  { P_SAVE_REG, 3, { M6811_OP_LDX, OP_DIRECT,
+                     M6811_OP_PSHX } },
+  { P_SAVE_REG, 5, { M6811_OP_PAGE2, M6811_OP_LDX, OP_DIRECT,
+                     M6811_OP_PAGE2, M6811_OP_PSHX } },
+
+  /* Sequences to allocate local variables.  */
+  { P_LOCAL_N,  7, { M6811_OP_TSX,
+                     M6811_OP_XGDX,
+                     M6811_OP_ADDD, OP_IMM_HIGH, OP_IMM_LOW,
+                     M6811_OP_XGDX,
+                     M6811_OP_TXS } },
+  { P_LOCAL_N, 11, { M6811_OP_PAGE2, M6811_OP_TSX,
+                     M6811_OP_PAGE2, M6811_OP_XGDX,
+                     M6811_OP_ADDD, OP_IMM_HIGH, OP_IMM_LOW,
+                     M6811_OP_PAGE2, M6811_OP_XGDX,
+                     M6811_OP_PAGE2, M6811_OP_TXS } },
+  { P_LOCAL_1,  1, { M6811_OP_DES } },
+  { P_LOCAL_2,  1, { M6811_OP_PSHX } },
+  { P_LOCAL_2,  2, { M6811_OP_PAGE2, M6811_OP_PSHX } },
+
+  /* Initialize the frame pointer.  */
+  { P_SET_FRAME, 2, { M6811_OP_STS, OP_DIRECT } },
+  { P_LAST, 0, { 0 } }
+};
+
+
+/* Sequence of instructions in the 68HC12 function prologue.  */
+static struct insn_sequence m6812_prologue[] = {  
+  { P_SAVE_REG,  5, { M6812_OP_PAGE2, M6812_OP_MOVW, M6812_PB_PSHW,
+                      OP_IMM_HIGH, OP_IMM_LOW } },
+  { P_SET_FRAME, 3, { M6812_OP_STS, OP_IMM_HIGH, OP_IMM_LOW } },
+  { P_LOCAL_N,   2, { M6812_OP_LEAS, OP_PBYTE } },
+  { P_LAST, 0 }
+};
+
+
+/* Analyze the sequence of instructions starting at the given address.
+   Returns a pointer to the sequence when it is recognized and
+   the optional value (constant/address) associated with it.
+   Advance the pc for the next sequence.  */
+static struct insn_sequence *
+m68hc11_analyze_instruction (struct insn_sequence *seq, CORE_ADDR *pc,
+                             CORE_ADDR *val)
+{
+  unsigned char buffer[MAX_CODES];
+  unsigned bufsize;
+  unsigned j;
+  CORE_ADDR cur_val;
+  short v = 0;
+
+  bufsize = 0;
+  for (; seq->type != P_LAST; seq++)
+    {
+      cur_val = 0;
+      for (j = 0; j < seq->length; j++)
+        {
+          if (bufsize < j + 1)
+            {
+              buffer[bufsize] = read_memory_unsigned_integer (*pc + bufsize,
+                                                              1);
+              bufsize++;
+            }
+          /* Continue while we match the opcode.  */
+          if (seq->code[j] == buffer[j])
+            continue;
+          
+          if ((seq->code[j] & 0xf00) == 0)
+            break;
+          
+          /* Extract a sequence parameter (address or constant).  */
+          switch (seq->code[j])
+            {
+            case OP_DIRECT:
+              cur_val = (CORE_ADDR) buffer[j];
+              break;
+
+            case OP_IMM_HIGH:
+              cur_val = cur_val & 0x0ff;
+              cur_val |= (buffer[j] << 8);
+              break;
+
+            case OP_IMM_LOW:
+              cur_val &= 0x0ff00;
+              cur_val |= buffer[j];
+              break;
+
+            case OP_PBYTE:
+              if ((buffer[j] & 0xE0) == 0x80)
+                {
+                  v = buffer[j] & 0x1f;
+                  if (v & 0x10)
+                    v |= 0xfff0;
+                }
+              else if ((buffer[j] & 0xfe) == 0xf0)
+                {
+                  v = read_memory_unsigned_integer (*pc + j + 1, 1);
+                  if (buffer[j] & 1)
+                    v |= 0xff00;
+                }
+              else if (buffer[j] == 0xf2)
+                {
+                  v = read_memory_unsigned_integer (*pc + j + 1, 2);
+                }
+              cur_val = v;
+              break;
+            }
+        }
+
+      /* We have a full match.  */
+      if (j == seq->length)
+        {
+          *val = cur_val;
+          *pc = *pc + j;
+          return seq;
+        }
+    }
+  return 0;
+}
+
+/* Analyze the function prologue to find some information
+   about the function:
+    - the PC of the first line (for m68hc11_skip_prologue)
+    - the offset of the previous frame saved address (from current frame)
+    - the soft registers which are pushed.  */
+static void
+m68hc11_guess_from_prologue (CORE_ADDR pc, CORE_ADDR fp,
+                             CORE_ADDR *first_line,
+                             int *frame_offset, CORE_ADDR *pushed_regs)
+{
+  CORE_ADDR save_addr;
+  CORE_ADDR func_end;
+  int size;
+  int found_frame_point;
+  int saved_reg;
+  CORE_ADDR first_pc;
+  int done = 0;
+  struct insn_sequence *seq_table;
+  
+  first_pc = get_pc_function_start (pc);
+  size = 0;
+
+  m68hc11_initialize_register_info ();
+  if (first_pc == 0)
+    {
+      *frame_offset = 0;
+      *first_line   = pc;
+      return;
+    }
+
+  seq_table = gdbarch_tdep (current_gdbarch)->prologue;
+  
+  /* The 68hc11 stack is as follows:
+
+
+     |           |
+     +-----------+
+     |           |
+     | args      |
+     |           |
+     +-----------+
+     | PC-return |
+     +-----------+
+     | Old frame |
+     +-----------+
+     |           |
+     | Locals    |
+     |           |
+     +-----------+ <--- current frame
+     |           |
+
+     With most processors (like 68K) the previous frame can be computed
+     easily because it is always at a fixed offset (see link/unlink).
+     That is, locals are accessed with negative offsets, arguments are
+     accessed with positive ones.  Since 68hc11 only supports offsets
+     in the range [0..255], the frame is defined at the bottom of
+     locals (see picture).
+
+     The purpose of the analysis made here is to find out the size
+     of locals in this function.  An alternative to this is to use
+     DWARF2 info.  This would be better but I don't know how to
+     access dwarf2 debug from this function.
+     
+     Walk from the function entry point to the point where we save
+     the frame.  While walking instructions, compute the size of bytes
+     which are pushed.  This gives us the index to access the previous
+     frame.
+
+     We limit the search to 128 bytes so that the algorithm is bounded
+     in case of random and wrong code.  We also stop and abort if
+     we find an instruction which is not supposed to appear in the
+     prologue (as generated by gcc 2.95, 2.96).
+  */
+  pc = first_pc;
+  func_end = pc + 128;
+  found_frame_point = 0;
+  *frame_offset = 0;
+  save_addr = fp;
+  while (!done && pc + 2 < func_end)
+    {
+      struct insn_sequence *seq;
+      CORE_ADDR val;
+      
+      seq = m68hc11_analyze_instruction (seq_table, &pc, &val);
+      if (seq == 0)
+        break;
+
+      if (seq->type == P_SAVE_REG)
+        {
+          if (found_frame_point)
+            {
+              saved_reg = m68hc11_which_soft_register (val);
+              if (saved_reg < 0)
+                break;
+
+              save_addr -= 2;
+              if (pushed_regs)
+                pushed_regs[saved_reg] = save_addr;
+            }
+          else
+            {
+              size += 2;
+            }
+        }
+      else if (seq->type == P_SET_FRAME)
+        {
+          found_frame_point = 1;
+          *frame_offset = size;
+        }
+      else if (seq->type == P_LOCAL_1)
+        {
+          size += 1;
+        }
+      else if (seq->type == P_LOCAL_2)
+        {
+          size += 2;
+        }
+      else if (seq->type == P_LOCAL_N)
+        {
+          /* Stack pointer is decremented for the allocation.  */
+          if (val & 0x8000)
+            size -= (int) (val) | 0xffff0000;
+          else
+            size -= val;
+        }
+    }
+  *first_line  = pc;
+}
+
+static CORE_ADDR
+m68hc11_skip_prologue (CORE_ADDR pc)
+{
+  CORE_ADDR func_addr, func_end;
+  struct symtab_and_line sal;
+  int frame_offset;
+
+  /* If we have line debugging information, then the end of the
+     prologue should be the first assembly instruction of the
+     first source line.  */
+  if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
+    {
+      sal = find_pc_line (func_addr, 0);
+      if (sal.end && sal.end < func_end)
+	return sal.end;
+    }
+
+  m68hc11_guess_from_prologue (pc, 0, &pc, &frame_offset, 0);
+  return pc;
+}
+
+/* Given a GDB frame, determine the address of the calling function's frame.
+   This will be used to create a new GDB frame struct, and then
+   INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
+*/
+
+static CORE_ADDR
+m68hc11_frame_chain (struct frame_info *frame)
+{
+  CORE_ADDR addr;
+
+  if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+    return frame->frame;	/* dummy frame same as caller's frame */
+
+  if (frame->extra_info->return_pc == 0
+      || inside_entry_file (frame->extra_info->return_pc))
+    return (CORE_ADDR) 0;
+
+  if (frame->frame == 0)
+    {
+      return (CORE_ADDR) 0;
+    }
+
+  addr = frame->frame + frame->extra_info->size + STACK_CORRECTION - 2;
+  addr = read_memory_unsigned_integer (addr, 2) & 0x0FFFF;
+  if (addr == 0)
+    {
+      return (CORE_ADDR) 0;
+    }
+    
+  return addr;
+}  
+
+/* Put here the code to store, into a struct frame_saved_regs, the
+   addresses of 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.  */
+static void
+m68hc11_frame_init_saved_regs (struct frame_info *fi)
+{
+  CORE_ADDR pc;
+  CORE_ADDR addr;
+  
+  if (fi->saved_regs == NULL)
+    frame_saved_regs_zalloc (fi);
+  else
+    memset (fi->saved_regs, 0, sizeof (fi->saved_regs));
+
+  pc = fi->pc;
+  m68hc11_guess_from_prologue (pc, fi->frame, &pc, &fi->extra_info->size,
+                               fi->saved_regs);
+
+  addr = fi->frame + fi->extra_info->size + STACK_CORRECTION;
+  if (soft_regs[SOFT_FP_REGNUM].name)
+    fi->saved_regs[SOFT_FP_REGNUM] = addr - 2;
+  fi->saved_regs[HARD_SP_REGNUM] = addr;
+  fi->saved_regs[HARD_PC_REGNUM] = fi->saved_regs[HARD_SP_REGNUM];
+}
+
+static void
+m68hc11_init_extra_frame_info (int fromleaf, struct frame_info *fi)
+{
+  CORE_ADDR addr;
+
+  fi->extra_info = (struct frame_extra_info *)
+    frame_obstack_alloc (sizeof (struct frame_extra_info));
+  
+  if (fi->next)
+    fi->pc = FRAME_SAVED_PC (fi->next);
+  
+  m68hc11_frame_init_saved_regs (fi);
+
+  if (fromleaf)
+    {
+      fi->extra_info->return_pc = m68hc11_saved_pc_after_call (fi);
+    }
+  else
+    {
+      addr = fi->frame + fi->extra_info->size + STACK_CORRECTION;
+      addr = read_memory_unsigned_integer (addr, 2) & 0x0ffff;
+      fi->extra_info->return_pc = addr;
+#if 0
+      printf ("Pc@0x%04x, FR 0x%04x, size %d, read ret @0x%04x -> 0x%04x\n",
+              fi->pc,
+              fi->frame, fi->size,
+              addr & 0x0ffff,
+              fi->return_pc);
+#endif
+    }
+}
+
+/* Same as 'info reg' but prints the registers in a different way.  */
+static void
+show_regs (char *args, int from_tty)
+{
+  int ccr = read_register (HARD_CCR_REGNUM);
+  int i;
+  int nr;
+  
+  printf_filtered ("PC=%04x SP=%04x FP=%04x CCR=%02x %c%c%c%c%c%c%c%c\n",
+		   (int) read_register (HARD_PC_REGNUM),
+		   (int) read_register (HARD_SP_REGNUM),
+		   (int) read_register (SOFT_FP_REGNUM),
+		   ccr,
+		   ccr & M6811_S_BIT ? 'S' : '-',
+		   ccr & M6811_X_BIT ? 'X' : '-',
+		   ccr & M6811_H_BIT ? 'H' : '-',
+		   ccr & M6811_I_BIT ? 'I' : '-',
+		   ccr & M6811_N_BIT ? 'N' : '-',
+		   ccr & M6811_Z_BIT ? 'Z' : '-',
+		   ccr & M6811_V_BIT ? 'V' : '-',
+		   ccr & M6811_C_BIT ? 'C' : '-');
+
+  printf_filtered ("D=%04x IX=%04x IY=%04x\n",
+		   (int) read_register (HARD_D_REGNUM),
+		   (int) read_register (HARD_X_REGNUM),
+		   (int) read_register (HARD_Y_REGNUM));
+
+  nr = 0;
+  for (i = SOFT_D1_REGNUM; i < M68HC11_ALL_REGS; i++)
+    {
+      /* Skip registers which are not defined in the symbol table.  */
+      if (soft_regs[i].name == 0)
+        continue;
+      
+      printf_filtered ("D%d=%04x",
+                       i - SOFT_D1_REGNUM + 1,
+                       (int) read_register (i));
+      nr++;
+      if ((nr % 8) == 7)
+        printf_filtered ("\n");
+      else
+        printf_filtered (" ");
+    }
+  if (nr && (nr % 8) != 7)
+    printf_filtered ("\n");
+}
+
+static CORE_ADDR
+m68hc11_stack_align (CORE_ADDR addr)
+{
+  return ((addr + 1) & -2);
+}
+
+static CORE_ADDR
+m68hc11_push_arguments (int nargs,
+                        value_ptr *args,
+                        CORE_ADDR sp,
+                        int struct_return,
+                        CORE_ADDR struct_addr)
+{
+  int stack_alloc;
+  int argnum;
+  int first_stack_argnum;
+  int stack_offset;
+  struct type *type;
+  char *val;
+  int len;
+  
+  stack_alloc = 0;
+  first_stack_argnum = 0;
+  if (struct_return)
+    {
+      /* The struct is allocated on the stack and gdb used the stack
+         pointer for the address of that struct.  We must apply the
+         stack offset on the address.  */
+      write_register (HARD_D_REGNUM, struct_addr + STACK_CORRECTION);
+    }
+  else if (nargs > 0)
+    {
+      type = VALUE_TYPE (args[0]);
+      len = TYPE_LENGTH (type);
+      
+      /* First argument is passed in D and X registers.  */
+      if (len <= 4)
+        {
+          LONGEST v = extract_unsigned_integer (VALUE_CONTENTS (args[0]), len);
+          first_stack_argnum = 1;
+          write_register (HARD_D_REGNUM, v);
+          if (len > 2)
+            {
+              v >>= 16;
+              write_register (HARD_X_REGNUM, v);
+            }
+        }
+    }
+  for (argnum = first_stack_argnum; argnum < nargs; argnum++)
+    {
+      type = VALUE_TYPE (args[argnum]);
+      stack_alloc += (TYPE_LENGTH (type) + 1) & -2;
+    }
+  sp -= stack_alloc;
+
+  stack_offset = STACK_CORRECTION;
+  for (argnum = first_stack_argnum; argnum < nargs; argnum++)
+    {
+      type = VALUE_TYPE (args[argnum]);
+      len = TYPE_LENGTH (type);
+
+      val = (char*) VALUE_CONTENTS (args[argnum]);
+      write_memory (sp + stack_offset, val, len);
+      stack_offset += len;
+      if (len & 1)
+        {
+          static char zero = 0;
+
+          write_memory (sp + stack_offset, &zero, 1);
+          stack_offset++;
+        }
+    }
+  return sp;
+}
+
+
+/* Return a location where we can set a breakpoint that will be hit
+   when an inferior function call returns.  */
+CORE_ADDR
+m68hc11_call_dummy_address (void)
+{
+  return entry_point_address ();
+}
+
+static struct type *
+m68hc11_register_virtual_type (int reg_nr)
+{
+  return builtin_type_uint16;
+}
+
+static void
+m68hc11_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
+{
+  /* The struct address computed by gdb is on the stack.
+     It uses the stack pointer so we must apply the stack
+     correction offset.  */
+  write_register (HARD_D_REGNUM, addr + STACK_CORRECTION);
+}
+
+static void
+m68hc11_store_return_value (struct type *type, char *valbuf)
+{
+  int len;
+
+  len = TYPE_LENGTH (type);
+
+  /* First argument is passed in D and X registers.  */
+  if (len <= 4)
+    {
+      LONGEST v = extract_unsigned_integer (valbuf, len);
+
+      write_register (HARD_D_REGNUM, v);
+      if (len > 2)
+        {
+          v >>= 16;
+          write_register (HARD_X_REGNUM, v);
+        }
+    }
+  else
+    error ("return of value > 4 is not supported.");
+}
+
+
+/* Given a return value in `regbuf' with a type `type', 
+   extract and copy its value into `valbuf'.  */
+
+static void
+m68hc11_extract_return_value (struct type *type,
+                              char *regbuf,
+                              char *valbuf)
+{
+  int len = TYPE_LENGTH (type);
+  
+  switch (len)
+    {
+    case 1:
+      memcpy (valbuf, &regbuf[HARD_D_REGNUM * 2 + 1], len);
+      break;
+  
+    case 2:
+      memcpy (valbuf, &regbuf[HARD_D_REGNUM * 2], len);
+      break;
+      
+    case 3:
+      memcpy (&valbuf[0], &regbuf[HARD_X_REGNUM * 2 + 1], 1);
+      memcpy (&valbuf[1], &regbuf[HARD_D_REGNUM * 2], 2);
+      break;
+      
+    case 4:
+      memcpy (&valbuf[0], &regbuf[HARD_X_REGNUM * 2], 2);
+      memcpy (&valbuf[2], &regbuf[HARD_D_REGNUM * 2], 2);
+      break;
+
+    default:
+      error ("bad size for return value");
+    }
+}
+
+/* Should call_function allocate stack space for a struct return?  */
+static int
+m68hc11_use_struct_convention (int gcc_p, struct type *type)
+{
+  return (TYPE_CODE (type) == TYPE_CODE_STRUCT
+          || TYPE_CODE (type) == TYPE_CODE_UNION
+          || TYPE_LENGTH (type) > 4);
+}
+
+static int
+m68hc11_return_value_on_stack (struct type *type)
+{
+  return TYPE_LENGTH (type) > 4;
+}
+
+/* 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
+m68hc11_extract_struct_value_address (char *regbuf)
+{
+  return extract_address (&regbuf[HARD_D_REGNUM * 2],
+                          REGISTER_RAW_SIZE (HARD_D_REGNUM));
+}
+
+/* Function: push_return_address (pc)
+   Set up the return address for the inferior function call.
+   Needed for targets where we don't actually execute a JSR/BSR instruction */
+
+static CORE_ADDR
+m68hc11_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
+{
+  char valbuf[2];
+  
+  pc = CALL_DUMMY_ADDRESS ();
+  sp -= 2;
+  store_unsigned_integer (valbuf, 2, pc);
+  write_memory (sp + STACK_CORRECTION, valbuf, 2);
+  return sp;
+}
+
+/* Index within `registers' of the first byte of the space for
+   register N.  */
+static int
+m68hc11_register_byte (int reg_nr)
+{
+  return (reg_nr * M68HC11_REG_SIZE);
+}
+
+static int
+m68hc11_register_raw_size (int reg_nr)
+{
+  return M68HC11_REG_SIZE;
+}
+
+static int
+gdb_print_insn_m68hc11 (bfd_vma memaddr, disassemble_info *info)
+{
+  if (TARGET_ARCHITECTURE->arch == bfd_arch_m68hc11)
+    return print_insn_m68hc11 (memaddr, info);
+  else
+    return print_insn_m68hc12 (memaddr, info);
+}
+
+static struct gdbarch *
+m68hc11_gdbarch_init (struct gdbarch_info info,
+                      struct gdbarch_list *arches)
+{
+  static LONGEST m68hc11_call_dummy_words[] =
+  {0};
+  struct gdbarch *gdbarch;
+  struct gdbarch_tdep *tdep;
+
+  soft_reg_initialized = 0;
+  
+  /* try to find a pre-existing architecture */
+  for (arches = gdbarch_list_lookup_by_info (arches, &info);
+       arches != NULL;
+       arches = gdbarch_list_lookup_by_info (arches->next, &info))
+    {
+      return arches->gdbarch;
+    }
+
+  /* Need a new architecture. Fill in a target specific vector.  */
+  tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
+  gdbarch = gdbarch_alloc (&info, tdep);
+
+  switch (info.bfd_arch_info->arch)
+    {
+    case bfd_arch_m68hc11:
+      tdep->stack_correction = 1;
+      tdep->prologue = m6811_prologue;
+      break;
+
+    case bfd_arch_m68hc12:
+      tdep->stack_correction = 0;
+      tdep->prologue = m6812_prologue;
+      break;
+
+    default:
+      break;
+    }
+  
+  /* Initially set everything according to the ABI.  */
+  set_gdbarch_short_bit (gdbarch, 16);
+  set_gdbarch_int_bit (gdbarch, 32);
+  set_gdbarch_float_bit (gdbarch, 32);
+  set_gdbarch_double_bit (gdbarch, 64);
+  set_gdbarch_long_double_bit (gdbarch, 64);
+  set_gdbarch_long_bit (gdbarch, 32);
+  set_gdbarch_ptr_bit (gdbarch, 16);
+  set_gdbarch_long_long_bit (gdbarch, 64);
+
+  /* Set register info.  */
+  set_gdbarch_fp0_regnum (gdbarch, -1);
+  set_gdbarch_max_register_raw_size (gdbarch, 2);
+  set_gdbarch_max_register_virtual_size (gdbarch, 2);
+  set_gdbarch_register_raw_size (gdbarch, m68hc11_register_raw_size);
+  set_gdbarch_register_virtual_size (gdbarch, m68hc11_register_raw_size);
+  set_gdbarch_register_byte (gdbarch, m68hc11_register_byte);
+  set_gdbarch_frame_init_saved_regs (gdbarch, m68hc11_frame_init_saved_regs);
+  set_gdbarch_frame_args_skip (gdbarch, 0);
+
+  set_gdbarch_read_pc (gdbarch, generic_target_read_pc);
+  set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
+  set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
+  set_gdbarch_write_fp (gdbarch, generic_target_write_fp);
+  set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
+  set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+
+  set_gdbarch_num_regs (gdbarch, M68HC11_NUM_REGS);
+  set_gdbarch_num_pseudo_regs (gdbarch, M68HC11_NUM_PSEUDO_REGS);
+  set_gdbarch_sp_regnum (gdbarch, HARD_SP_REGNUM);
+  set_gdbarch_fp_regnum (gdbarch, SOFT_FP_REGNUM);
+  set_gdbarch_pc_regnum (gdbarch, HARD_PC_REGNUM);
+  set_gdbarch_register_name (gdbarch, m68hc11_register_name);
+  set_gdbarch_register_size (gdbarch, 2);
+  set_gdbarch_register_bytes (gdbarch, M68HC11_ALL_REGS * 2);
+  set_gdbarch_register_virtual_type (gdbarch, m68hc11_register_virtual_type);
+  set_gdbarch_fetch_pseudo_register (gdbarch, m68hc11_fetch_pseudo_register);
+  set_gdbarch_store_pseudo_register (gdbarch, m68hc11_store_pseudo_register);
+
+  set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
+  set_gdbarch_call_dummy_length (gdbarch, 0);
+  set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
+  set_gdbarch_call_dummy_address (gdbarch, m68hc11_call_dummy_address);
+  set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); /*???*/
+  set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
+  set_gdbarch_call_dummy_start_offset (gdbarch, 0);
+  set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy);
+  set_gdbarch_call_dummy_words (gdbarch, m68hc11_call_dummy_words);
+  set_gdbarch_sizeof_call_dummy_words (gdbarch,
+                                       sizeof (m68hc11_call_dummy_words));
+  set_gdbarch_call_dummy_p (gdbarch, 1);
+  set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
+  set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
+  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
+  set_gdbarch_extract_return_value (gdbarch, m68hc11_extract_return_value);
+  set_gdbarch_push_arguments (gdbarch, m68hc11_push_arguments);
+  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
+  set_gdbarch_push_return_address (gdbarch, m68hc11_push_return_address);
+  set_gdbarch_return_value_on_stack (gdbarch, m68hc11_return_value_on_stack);
+
+  set_gdbarch_store_struct_return (gdbarch, m68hc11_store_struct_return);
+  set_gdbarch_store_return_value (gdbarch, m68hc11_store_return_value);
+  set_gdbarch_extract_struct_value_address (gdbarch,
+                                            m68hc11_extract_struct_value_address);
+  set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not);
+
+
+  set_gdbarch_frame_chain (gdbarch, m68hc11_frame_chain);
+  set_gdbarch_frame_chain_valid (gdbarch, generic_file_frame_chain_valid);
+  set_gdbarch_frame_saved_pc (gdbarch, m68hc11_frame_saved_pc);
+  set_gdbarch_frame_args_address (gdbarch, m68hc11_frame_args_address);
+  set_gdbarch_frame_locals_address (gdbarch, m68hc11_frame_locals_address);
+  set_gdbarch_saved_pc_after_call (gdbarch, m68hc11_saved_pc_after_call);
+  set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
+
+  set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
+  set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
+
+  set_gdbarch_store_struct_return (gdbarch, m68hc11_store_struct_return);
+  set_gdbarch_store_return_value (gdbarch, m68hc11_store_return_value);
+  set_gdbarch_extract_struct_value_address
+    (gdbarch, m68hc11_extract_struct_value_address);
+  set_gdbarch_use_struct_convention (gdbarch, m68hc11_use_struct_convention);
+  set_gdbarch_init_extra_frame_info (gdbarch, m68hc11_init_extra_frame_info);
+  set_gdbarch_pop_frame (gdbarch, m68hc11_pop_frame);
+  set_gdbarch_skip_prologue (gdbarch, m68hc11_skip_prologue);
+  set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
+  set_gdbarch_decr_pc_after_break (gdbarch, 0);
+  set_gdbarch_function_start_offset (gdbarch, 0);
+  set_gdbarch_breakpoint_from_pc (gdbarch, m68hc11_breakpoint_from_pc);
+  set_gdbarch_stack_align (gdbarch, m68hc11_stack_align);
+
+  set_gdbarch_believe_pcc_promotion (gdbarch, 1);
+  set_gdbarch_ieee_float (gdbarch, 1);
+
+  return gdbarch;
+}
+
+void
+_initialize_m68hc11_tdep (void)
+{
+  register_gdbarch_init (bfd_arch_m68hc11, m68hc11_gdbarch_init);
+  register_gdbarch_init (bfd_arch_m68hc12, m68hc11_gdbarch_init);
+  if (!tm_print_insn)		/* Someone may have already set it */
+    tm_print_insn = gdb_print_insn_m68hc11;
+
+  add_com ("regs", class_vars, show_regs, "Print all registers");
+} 
+
diff --git a/gdb/m68k-stub.c b/gdb/m68k-stub.c
index 84c61a1..72281da 100644
--- a/gdb/m68k-stub.c
+++ b/gdb/m68k-stub.c
@@ -528,7 +528,7 @@
 /* scan for the sequence $<data>#<checksum>     */
   
 unsigned char *
-getpacket ()
+getpacket (void)
 {
   unsigned char *buffer = &remcomInBuffer[0];
   unsigned char checksum;
@@ -966,7 +966,7 @@
 
 
 void
-initializeRemcomErrorFrame()
+initializeRemcomErrorFrame (void)
 {
     lastFrame = ((Frame *) &gdbFrameStack[FRAMESIZE-1]) - 1;
     lastFrame->previous = lastFrame;
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 0bdb3f6..5a77156 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -44,8 +44,7 @@
    was moved back here from tm-m68k.h.  FIXME? */
 
 extern CORE_ADDR
-altos_skip_prologue (pc)
-     CORE_ADDR pc;
+altos_skip_prologue (CORE_ADDR pc)
 {
   register int op = read_memory_integer (pc, 2);
   if (op == P_LINKW_FP)
@@ -67,8 +66,7 @@
    was moved back here from tm-m68k.h.  FIXME? */
 
 extern CORE_ADDR
-isi_skip_prologue (pc)
-     CORE_ADDR pc;
+isi_skip_prologue (CORE_ADDR pc)
 {
   register int op = read_memory_integer (pc, 2);
   if (op == P_LINKW_FP)
@@ -87,9 +85,7 @@
 }
 
 int
-delta68_in_sigtramp (pc, name)
-     CORE_ADDR pc;
-     char *name;
+delta68_in_sigtramp (CORE_ADDR pc, char *name)
 {
   if (name != NULL)
     return strcmp (name, "_sigcode") == 0;
@@ -98,8 +94,7 @@
 }
 
 CORE_ADDR
-delta68_frame_args_address (frame_info)
-     struct frame_info * frame_info;
+delta68_frame_args_address (struct frame_info *frame_info)
 {
   /* we assume here that the only frameless functions are the system calls
      or other functions who do not put anything on the stack. */
@@ -118,8 +113,7 @@
 }
 
 CORE_ADDR
-delta68_frame_saved_pc (frame_info)
-     struct frame_info * frame_info;
+delta68_frame_saved_pc (struct frame_info *frame_info)
 {
   return read_memory_integer (delta68_frame_args_address (frame_info) + 4, 4);
 }
@@ -128,8 +122,7 @@
    Can return -1, meaning no way to tell.  */
 
 int
-isi_frame_num_args (fi)
-     struct frame_info *fi;
+isi_frame_num_args (struct frame_info *fi)
 {
   int val;
   CORE_ADDR pc = FRAME_SAVED_PC (fi);
@@ -151,8 +144,7 @@
 }
 
 int
-delta68_frame_num_args (fi)
-     struct frame_info *fi;
+delta68_frame_num_args (struct frame_info *fi)
 {
   int val;
   CORE_ADDR pc = FRAME_SAVED_PC (fi);
@@ -174,8 +166,7 @@
 }
 
 int
-news_frame_num_args (fi)
-     struct frame_info *fi;
+news_frame_num_args (struct frame_info *fi)
 {
   int val;
   CORE_ADDR pc = FRAME_SAVED_PC (fi);
@@ -199,7 +190,7 @@
 /* Push an empty stack frame, to record the current PC, etc.  */
 
 void
-m68k_push_dummy_frame ()
+m68k_push_dummy_frame (void)
 {
   register CORE_ADDR sp = read_register (SP_REGNUM);
   register int regnum;
@@ -229,7 +220,7 @@
    restoring all saved registers.  */
 
 void
-m68k_pop_frame ()
+m68k_pop_frame (void)
 {
   register struct frame_info *frame = get_current_frame ();
   register CORE_ADDR fp;
@@ -298,8 +289,7 @@
  */
 
 CORE_ADDR
-m68k_skip_prologue (ip)
-     CORE_ADDR ip;
+m68k_skip_prologue (CORE_ADDR ip)
 {
   register CORE_ADDR limit;
   struct symtab_and_line sal;
@@ -335,9 +325,8 @@
 }
 
 void
-m68k_find_saved_regs (frame_info, saved_regs)
-     struct frame_info *frame_info;
-     struct frame_saved_regs *saved_regs;
+m68k_find_saved_regs (struct frame_info *frame_info,
+		      struct frame_saved_regs *saved_regs)
 {
   register int regnum;
   register int regmask;
@@ -551,8 +540,7 @@
    register values. */
 
 void
-supply_gregset (gregsetp)
-     gregset_t *gregsetp;
+supply_gregset (gregset_t *gregsetp)
 {
   register int regi;
   register greg_t *regp = (greg_t *) gregsetp;
@@ -566,9 +554,7 @@
 }
 
 void
-fill_gregset (gregsetp, regno)
-     gregset_t *gregsetp;
-     int regno;
+fill_gregset (gregset_t *gregsetp, int regno)
 {
   register int regi;
   register greg_t *regp = (greg_t *) gregsetp;
@@ -597,8 +583,7 @@
    idea of the current floating point register values. */
 
 void
-supply_fpregset (fpregsetp)
-     fpregset_t *fpregsetp;
+supply_fpregset (fpregset_t *fpregsetp)
 {
   register int regi;
   char *from;
@@ -619,9 +604,7 @@
    them all. */
 
 void
-fill_fpregset (fpregsetp, regno)
-     fpregset_t *fpregsetp;
-     int regno;
+fill_fpregset (fpregset_t *fpregsetp, int regno)
 {
   int regi;
   char *to;
@@ -654,19 +637,24 @@
 
 #endif /* USE_PROC_FS */
 
-#ifdef GET_LONGJMP_TARGET
 /* Figure out where the longjmp will land.  Slurp the args out of the stack.
    We expect the first arg to be a pointer to the jmp_buf structure from which
    we extract the pc (JB_PC) that we will land at.  The pc is copied into PC.
    This routine returns true on success. */
 
+/* NOTE: cagney/2000-11-08: For this function to be fully multi-arched
+   the macro's JB_PC and JB_ELEMENT_SIZE would need to be moved into
+   the ``struct gdbarch_tdep'' object and then set on a target ISA/ABI
+   dependant basis. */
+
 int
-get_longjmp_target (pc)
-     CORE_ADDR *pc;
+m68k_get_longjmp_target (CORE_ADDR *pc)
 {
-  char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
+#if defined (JB_PC) && defined (JB_ELEMENT_SIZE)
+  char *buf;
   CORE_ADDR sp, jb_addr;
 
+  buf = alloca (TARGET_PTR_BIT / TARGET_CHAR_BIT);
   sp = read_register (SP_REGNUM);
 
   if (target_read_memory (sp + SP_ARG0,		/* Offset of first arg on stack */
@@ -683,8 +671,11 @@
   *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
 
   return 1;
+#else
+  internal_error ("m68k_get_longjmp_target: not implemented");
+  return 0;
+#endif
 }
-#endif /* GET_LONGJMP_TARGET */
 
 /* Immediately after a function call, return the saved pc before the frame
    is setup.  For sun3's, we check for the common case of being inside of a
@@ -692,8 +683,7 @@
    prior to doing the trap. */
 
 CORE_ADDR
-m68k_saved_pc_after_call (frame)
-     struct frame_info *frame;
+m68k_saved_pc_after_call (struct frame_info *frame)
 {
 #ifdef SYSCALL_TRAP
   int op;
@@ -709,7 +699,7 @@
 
 
 void
-_initialize_m68k_tdep ()
+_initialize_m68k_tdep (void)
 {
   tm_print_insn = print_insn_m68k;
 }
diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c
index 111f2a9..b78b8a5 100644
--- a/gdb/m68klinux-nat.c
+++ b/gdb/m68klinux-nat.c
@@ -60,9 +60,7 @@
    is stored.  */
 
 int
-m68k_linux_register_u_addr (blockend, regnum)
-     int blockend;
-     int regnum;
+m68k_linux_register_u_addr (int blockend, int regnum)
 {
   return (blockend + 4 * regmap[regnum]);
 }
@@ -86,8 +84,7 @@
 #include "gregset.h"
 
 void
-supply_gregset (gregsetp)
-     gregset_t *gregsetp;
+supply_gregset (gregset_t *gregsetp)
 {
   int regi;
 
@@ -102,8 +99,7 @@
    idea of the current floating point register values. */
 
 void
-supply_fpregset (fpregsetp)
-     fpregset_t *fpregsetp;
+supply_fpregset (fpregset_t *fpregsetp)
 {
   int regi;
 
@@ -118,7 +114,7 @@
 
 
 int
-kernel_u_size ()
+kernel_u_size (void)
 {
   return (sizeof (struct user));
 }
@@ -126,8 +122,7 @@
 /* Return non-zero if PC points into the signal trampoline.  */
 
 int
-in_sigtramp (pc)
-     CORE_ADDR pc;
+in_sigtramp (CORE_ADDR pc)
 {
   CORE_ADDR sp;
   char buf[TARGET_SHORT_BIT / TARGET_CHAR_BIT];
diff --git a/gdb/m68knbsd-nat.c b/gdb/m68knbsd-nat.c
index b76dc79..9dc59c0 100644
--- a/gdb/m68knbsd-nat.c
+++ b/gdb/m68knbsd-nat.c
@@ -27,8 +27,7 @@
 #include "inferior.h"
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   struct reg inferior_registers;
   struct fpreg inferior_fp_registers;
@@ -47,8 +46,7 @@
 }
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   struct reg inferior_registers;
   struct fpreg inferior_fp_registers;
@@ -71,11 +69,8 @@
 };
 
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR ignore;
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+		      CORE_ADDR ignore)
 {
   struct md_core *core_reg = (struct md_core *) core_reg_sect;
 
@@ -100,7 +95,7 @@
 }; 
    
 void
-_initialize_m68knbsd_nat ()
+_initialize_m68knbsd_nat (void)
 {
   add_core_fns (&m68knbsd_core_fns);
 }
diff --git a/gdb/m88k-nat.c b/gdb/m88k-nat.c
index afaa4ea..0ce30e7 100644
--- a/gdb/m88k-nat.c
+++ b/gdb/m88k-nat.c
@@ -62,8 +62,7 @@
 extern int errno;
 
 void
-fetch_inferior_registers (regno)
-     int regno;			/* Original value discarded */
+fetch_inferior_registers (int regno)
 {
   register unsigned int regaddr;
   char buf[MAX_REGISTER_RAW_SIZE];
@@ -106,8 +105,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   register unsigned int regaddr;
   char buf[80];
@@ -174,7 +172,7 @@
 
 
 /* blockend is the address of the end of the user structure */
-m88k_register_u_addr (blockend, regnum)
+m88k_register_u_addr (int blockend, int regnum)
 {
   struct USER u;
   int ustart = blockend - sizeof (struct USER);
@@ -247,8 +245,7 @@
    register values. */
 
 void
-supply_gregset (gregsetp)
-     gregset_t *gregsetp;
+supply_gregset (gregset_t *gregsetp)
 {
   register int regi;
   register greg_t *regp = (greg_t *) gregsetp;
@@ -265,9 +262,7 @@
 }
 
 void
-fill_gregset (gregsetp, regno)
-     gregset_t *gregsetp;
-     int regno;
+fill_gregset (gregset_t *gregsetp, int regno)
 {
   int regi;
   register greg_t *regp = (greg_t *) gregsetp;
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index 4ca3d68..afe1ca2 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -45,8 +45,7 @@
    of an instruction.  Shrug.  */
 
 CORE_ADDR
-m88k_addr_bits_remove (addr)
-     CORE_ADDR addr;
+m88k_addr_bits_remove (CORE_ADDR addr)
 {
   return ((addr) & ~3);
 }
@@ -60,8 +59,7 @@
    the function prologue to determine the caller's sp value, and return it.  */
 
 CORE_ADDR
-frame_chain (thisframe)
-     struct frame_info *thisframe;
+frame_chain (struct frame_info *thisframe)
 {
 
   frame_find_saved_regs (thisframe, (struct frame_saved_regs *) 0);
@@ -75,8 +73,7 @@
 }
 
 int
-frameless_function_invocation (frame)
-     struct frame_info *frame;
+frameless_function_invocation (struct frame_info *frame)
 {
 
   frame_find_saved_regs (frame, (struct frame_saved_regs *) 0);
@@ -90,9 +87,7 @@
 }
 
 void
-init_extra_frame_info (fromleaf, frame)
-     int fromleaf;
-     struct frame_info *frame;
+init_extra_frame_info (int fromleaf, struct frame_info *frame)
 {
   frame->fsr = 0;		/* Not yet allocated */
   frame->args_pointer = 0;	/* Unknown */
@@ -212,9 +207,7 @@
    is stored at 'pword1'.  */
 
 CORE_ADDR
-next_insn (memaddr, pword1)
-     unsigned long *pword1;
-     CORE_ADDR memaddr;
+next_insn (CORE_ADDR memaddr, unsigned long *pword1)
 {
   *pword1 = read_memory_integer (memaddr, BYTES_PER_88K_INSN);
   return memaddr + BYTES_PER_88K_INSN;
@@ -223,9 +216,7 @@
 /* Read a register from frames called by us (or from the hardware regs).  */
 
 static int
-read_next_frame_reg (frame, regno)
-     struct frame_info *frame;
-     int regno;
+read_next_frame_reg (struct frame_info *frame, int regno)
 {
   for (; frame; frame = frame->next)
     {
@@ -247,12 +238,9 @@
    to reflect the offsets of the arg pointer and the locals pointer.  */
 
 static CORE_ADDR
-examine_prologue (ip, limit, frame_sp, fsr, fi)
-     register CORE_ADDR ip;
-     register CORE_ADDR limit;
-     CORE_ADDR frame_sp;
-     struct frame_saved_regs *fsr;
-     struct frame_info *fi;
+examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit,
+		  CORE_ADDR frame_sp, struct frame_saved_regs *fsr,
+		  struct frame_info *fi)
 {
   register CORE_ADDR next_ip;
   register int src;
@@ -413,8 +401,7 @@
    prologue.  */
 
 CORE_ADDR
-m88k_skip_prologue (ip)
-CORE_ADDR (ip);
+m88k_skip_prologue (CORE_ADDR ip)
 {
   struct frame_saved_regs saved_regs_dummy;
   struct symtab_and_line sal;
@@ -437,9 +424,7 @@
    fairly expensive.  */
 
 void
-frame_find_saved_regs (fi, fsr)
-     struct frame_info *fi;
-     struct frame_saved_regs *fsr;
+frame_find_saved_regs (struct frame_info *fi, struct frame_saved_regs *fsr)
 {
   register struct frame_saved_regs *cache_fsr;
   CORE_ADDR ip;
@@ -487,8 +472,7 @@
    argument pointer, so this is the same as frame_args_address().  */
 
 CORE_ADDR
-frame_locals_address (fi)
-     struct frame_info *fi;
+frame_locals_address (struct frame_info *fi)
 {
   struct frame_saved_regs fsr;
 
@@ -506,8 +490,7 @@
    described by FI.  Returns 0 if the address is unknown.  */
 
 CORE_ADDR
-frame_args_address (fi)
-     struct frame_info *fi;
+frame_args_address (struct frame_info *fi)
 {
   struct frame_saved_regs fsr;
 
@@ -527,8 +510,7 @@
    just use the register SRP_REGNUM itself.  */
 
 CORE_ADDR
-frame_saved_pc (frame)
-     struct frame_info *frame;
+frame_saved_pc (struct frame_info *frame)
 {
   return read_next_frame_reg (frame, SRP_REGNUM);
 }
@@ -537,9 +519,7 @@
 #define DUMMY_FRAME_SIZE 192
 
 static void
-write_word (sp, word)
-     CORE_ADDR sp;
-     ULONGEST word;
+write_word (CORE_ADDR sp, ULONGEST word)
 {
   register int len = REGISTER_SIZE;
   char buffer[MAX_REGISTER_RAW_SIZE];
@@ -549,7 +529,7 @@
 }
 
 void
-m88k_push_dummy_frame ()
+m88k_push_dummy_frame (void)
 {
   register CORE_ADDR sp = read_register (SP_REGNUM);
   register int rn;
@@ -583,7 +563,7 @@
 }
 
 void
-pop_frame ()
+pop_frame (void)
 {
   register struct frame_info *frame = get_current_frame ();
   register CORE_ADDR fp;
@@ -635,7 +615,7 @@
 }
 
 void
-_initialize_m88k_tdep ()
+_initialize_m88k_tdep (void)
 {
   tm_print_insn = print_insn_m88k;
 }
diff --git a/gdb/mac-nat.c b/gdb/mac-nat.c
index aa25417..864fcab 100644
--- a/gdb/mac-nat.c
+++ b/gdb/mac-nat.c
@@ -84,9 +84,7 @@
 /* Attach to process PID, then initialize for debugging it.  */
 
 static void
-child_attach (args, from_tty)
-     char *args;
-     int from_tty;
+child_attach (char *args, int from_tty)
 {
   ProcessSerialNumber psn;
   ProcessInfoRec inforec;
@@ -130,9 +128,7 @@
 }
 
 static void
-child_detach (args, from_tty)
-     char *args;
-     int from_tty;
+child_detach (char *args, int from_tty)
 {
   char *exec_file;
 
@@ -152,8 +148,7 @@
 /* Print status information about what we're accessing.  */
 
 static void
-child_files_info (ignore)
-     struct target_ops *ignore;
+child_files_info (struct target_ops *ignore)
 {
   printf_unfiltered ("\tUsing the running image of %s %s.\n",
       attach_flag ? "attached" : "child", target_pid_to_str (inferior_pid));
@@ -161,9 +156,7 @@
 
 /* ARGSUSED */
 static void
-child_open (arg, from_tty)
-     char *arg;
-     int from_tty;
+child_open (char *arg, int from_tty)
 {
   error ("Use the \"run\" command to start a Mac application.");
 }
@@ -174,10 +167,7 @@
    ENV is the environment vector to pass.  Errors reported with error().  */
 
 static void
-child_create_inferior (exec_file, allargs, env)
-     char *exec_file;
-     char *allargs;
-     char **env;
+child_create_inferior (char *exec_file, char *allargs, char **env)
 {
   LaunchParamBlockRec launchparms;
   FSSpec fsspec;
@@ -221,14 +211,14 @@
 }
 
 static void
-child_mourn_inferior ()
+child_mourn_inferior (void)
 {
   unpush_target (&child_ops);
   generic_mourn_inferior ();
 }
 
 static void
-child_stop ()
+child_stop (void)
 {
 }
 
@@ -263,26 +253,24 @@
 }
 
 static void
-child_prepare_to_store ()
+child_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
 static int
-child_can_run ()
+child_can_run (void)
 {
   return 1;
 }
 
 static void
-child_close ()
+child_close (void)
 {
 }
 
 static void
-info_proc (args, from_tty)
-     char *args;
-     int from_tty;
+info_proc (char *args, int from_tty)
 {
   ProcessSerialNumber psn;
   ProcessInfoRec inforec;
@@ -404,7 +392,7 @@
 };
 
 void
-_initialize_mac_nat ()
+_initialize_mac_nat (void)
 {
   init_child_ops ();
 
diff --git a/gdb/mac-xdep.c b/gdb/mac-xdep.c
index ae5c4fa..b2ed22b 100644
--- a/gdb/mac-xdep.c
+++ b/gdb/mac-xdep.c
@@ -120,12 +120,12 @@
 Rect console_text_rect;
 
 /* This will go away eventually. */
-gdb_has_a_terminal ()
+gdb_has_a_terminal (void)
 {
   return 1;
 }
 
-mac_init ()
+mac_init (void)
 {
   SysEnvRec se;
   int eventloopdone = 0;
@@ -203,7 +203,7 @@
   new_console_window ();
 }
 
-new_console_window ()
+new_console_window (void)
 {
   /* Create the main window we're going to play in. */
   if (has_color_qd)
@@ -234,7 +234,7 @@
   SelectWindow (console_window);
 }
 
-mac_command_loop ()
+mac_command_loop (void)
 {
   SysEnvRec se;
   int eventloopdone = 0;
@@ -294,8 +294,7 @@
 
 /* Collect the global coordinates of the mouse pointer.  */
 
-get_global_mouse (mouse)
-     Point *mouse;
+get_global_mouse (Point *mouse)
 {
   EventRecord evt;
 
@@ -306,16 +305,13 @@
 /* Change the cursor's appearance to be appropriate for the given mouse
    location.  */
 
-adjust_cursor (mouse, region)
-     Point mouse;
-     RgnHandle region;
+adjust_cursor (Point mouse, RgnHandle region)
 {
 }
 
 /* Decipher an event, maybe do something with it.  */
 
-do_event (evt)
-     EventRecord *evt;
+do_event (EventRecord *evt)
 {
   short part, err, rslt = 0;
   WindowPtr win;
@@ -430,14 +426,12 @@
 
 /* Do any idle-time activities. */
 
-do_idle ()
+do_idle (void)
 {
   TEIdle (console_text);
 }
 
-grow_window (win, where)
-     WindowPtr win;
-     Point where;
+grow_window (WindowPtr win, Point where)
 {
   long winsize;
   int h, v;
@@ -461,10 +455,7 @@
     }
 }
 
-zoom_window (win, where, part)
-     WindowPtr win;
-     Point where;
-     short part;
+zoom_window (WindowPtr win, Point where, short part)
 {
   ZoomWindow (win, part, (win == FrontWindow ()));
   if (win == console_window)
@@ -473,7 +464,7 @@
     }
 }
 
-resize_console_window ()
+resize_console_window (void)
 {
   adjust_console_sizes ();
   adjust_console_scrollbars ();
@@ -481,8 +472,7 @@
   InvalRect (&console_window->portRect);
 }
 
-close_window (win)
-     WindowPtr win;
+close_window (WindowPtr win)
 {
 }
 
@@ -565,14 +555,11 @@
     }
 }
 
-scroll_text (hlines, vlines)
-     int hlines, vlines;
+scroll_text (int hlines, int vlines)
 {
 }
 
-activate_window (win, activate)
-     WindowPtr win;
-     int activate;
+activate_window (WindowPtr win, int activate)
 {
   Rect grow_rect;
 
@@ -603,8 +590,7 @@
     }
 }
 
-update_window (win)
-     WindowPtr win;
+update_window (WindowPtr win)
 {
   int controls = 1, growbox = 0;
   GrafPtr oldport;
@@ -628,12 +614,11 @@
   SetPort (oldport);
 }
 
-adjust_menus ()
+adjust_menus (void)
 {
 }
 
-do_menu_command (which)
-     long which;
+do_menu_command (long which)
 {
   short menuid, menuitem;
   short itemHit;
@@ -736,8 +721,7 @@
 
 char commandbuf[1000];
 
-do_keyboard_command (key)
-     int key;
+do_keyboard_command (int key)
 {
   int startpos, endpos, i, len;
   char *last_newline;
@@ -798,7 +782,7 @@
 
 /* Draw all graphical stuff in the console window.  */
 
-draw_console ()
+draw_console (void)
 {
   SetPort (console_window);
   TEUpdate (&(console_window->portRect), console_text);
@@ -806,8 +790,7 @@
 
 /* Cause an update of a given window's entire contents.  */
 
-force_update (win)
-     WindowPtr win;
+force_update (WindowPtr win)
 {
   GrafPtr oldport;
 
@@ -820,7 +803,7 @@
   SetPort (oldport);
 }
 
-adjust_console_sizes ()
+adjust_console_sizes (void)
 {
   Rect tmprect;
 
@@ -841,7 +824,7 @@
   (*console_text)->viewRect = tmprect;
 }
 
-adjust_console_scrollbars ()
+adjust_console_scrollbars (void)
 {
   int lines, newmax, value;
 
@@ -862,7 +845,7 @@
 
 /* Scroll the TE record so that it is consistent with the scrollbar(s). */
 
-adjust_console_text ()
+adjust_console_text (void)
 {
   TEScroll (((*console_text)->viewRect.left
 	     - (*console_text)->destRect.left)
@@ -907,7 +890,7 @@
 }
 
 int
-unstifle_history ()
+unstifle_history (void)
 {
 }
 
diff --git a/gdb/main.c b/gdb/main.c
index c6b9516..bf98ffa 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -105,7 +105,7 @@
   /* FIXME: cagney/1999-11-05: A correct command_loop() implementaton
      would clean things up (restoring the cleanup chain) to the state
      they were just prior to the call.  Technically, this means that
-     the do_cleanups() below is redundant.  Unfortunatly, many FUNC's
+     the do_cleanups() below is redundant.  Unfortunately, many FUNCs
      are not that well behaved.  do_cleanups should either be replaced
      with a do_cleanups call (to cover the problem) or an assertion
      check to detect bad FUNCs code. */
@@ -583,7 +583,7 @@
 
   for (i = 0; i < ndir; i++)
     catch_command_errors (directory_command, dirarg[i], 0, RETURN_MASK_ALL);
-  free ((PTR) dirarg);
+  xfree (dirarg);
 
   if (execarg != NULL
       && symarg != NULL
@@ -665,7 +665,7 @@
 #endif
       catch_command_errors (source_command, cmdarg[i], !batch, RETURN_MASK_ALL);
     }
-  free ((PTR) cmdarg);
+  xfree (cmdarg);
 
   /* Read in the old history after all the command files have been read. */
   init_history ();
diff --git a/gdb/maint.c b/gdb/maint.c
index a4def30..aa62e94 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -82,9 +82,7 @@
  */
 
 static void
-maintenance_command (args, from_tty)
-     char *args;
-     int from_tty;
+maintenance_command (char *args, int from_tty)
 {
   printf_unfiltered ("\"maintenance\" must be followed by the name of a maintenance command.\n");
   help_list (maintenancelist, "maintenance ", -1, gdb_stdout);
@@ -93,9 +91,7 @@
 #ifndef _WIN32
 /* ARGSUSED */
 static void
-maintenance_dump_me (args, from_tty)
-     char *args;
-     int from_tty;
+maintenance_dump_me (char *args, int from_tty)
 {
   if (query ("Should GDB dump core? "))
     {
@@ -131,9 +127,7 @@
    demangle and print what it points to, etc.  (FIXME) */
 
 static void
-maintenance_demangle (args, from_tty)
-     char *args;
-     int from_tty;
+maintenance_demangle (char *args, int from_tty)
 {
   char *demangled;
 
@@ -147,7 +141,7 @@
       if (demangled != NULL)
 	{
 	  printf_unfiltered ("%s\n", demangled);
-	  free (demangled);
+	  xfree (demangled);
 	}
       else
 	{
@@ -157,9 +151,7 @@
 }
 
 static void
-maintenance_time_display (args, from_tty)
-     char *args;
-     int from_tty;
+maintenance_time_display (char *args, int from_tty)
 {
   extern int display_time;
 
@@ -170,9 +162,7 @@
 }
 
 static void
-maintenance_space_display (args, from_tty)
-     char *args;
-     int from_tty;
+maintenance_space_display (char *args, int from_tty)
 {
   extern int display_space;
 
@@ -188,19 +178,14 @@
 
 /* ARGSUSED */
 static void
-maintenance_info_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+maintenance_info_command (char *arg, int from_tty)
 {
   printf_unfiltered ("\"maintenance info\" must be followed by the name of an info command.\n");
   help_list (maintenanceinfolist, "maintenance info ", -1, gdb_stdout);
 }
 
 static void
-print_section_table (abfd, asect, ignore)
-     bfd *abfd;
-     asection *asect;
-     PTR ignore;
+print_section_table (bfd *abfd, asection *asect, PTR ignore)
 {
   flagword flags;
 
@@ -250,9 +235,7 @@
 
 /* ARGSUSED */
 static void
-maintenance_info_sections (arg, from_tty)
-     char *arg;
-     int from_tty;
+maintenance_info_sections (char *arg, int from_tty)
 {
   if (exec_bfd)
     {
@@ -275,23 +258,34 @@
 
 /* ARGSUSED */
 void
-maintenance_print_statistics (args, from_tty)
-     char *args;
-     int from_tty;
+maintenance_print_statistics (char *args, int from_tty)
 {
   print_objfile_statistics ();
   print_symbol_bcache_statistics ();
 }
 
+void
+maintenance_print_architecture (char *args, int from_tty)
+{
+  if (args == NULL)
+    gdbarch_dump (current_gdbarch, gdb_stdout);
+  else
+    {
+      struct ui_file *file = gdb_fopen (args, "w");
+      if (file == NULL)
+	perror_with_name ("maintenance print architecture");
+      gdbarch_dump (current_gdbarch, file);    
+      ui_file_delete (file);
+    }
+}
+
 /* The "maintenance print" command is defined as a prefix, with
    allow_unknown 0.  Therefore, its own definition is called only for
    "maintenance print" with no args.  */
 
 /* ARGSUSED */
 static void
-maintenance_print_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+maintenance_print_command (char *arg, int from_tty)
 {
   printf_unfiltered ("\"maintenance print\" must be followed by the name of a print command.\n");
   help_list (maintenanceprintlist, "maintenance print ", -1, gdb_stdout);
@@ -304,9 +298,7 @@
  */
 
 static void
-maintenance_translate_address (arg, from_tty)
-     char *arg;
-     int from_tty;
+maintenance_translate_address (char *arg, int from_tty)
 {
   CORE_ADDR address;
   asection *sect;
@@ -452,7 +444,7 @@
     {
 
       if (alias->flags & MALLOCED_REPLACEMENT)
-	free (alias->replacement);
+	xfree (alias->replacement);
 
       if (deprecate)
 	alias->flags |= (DEPRECATED_WARN_USER | CMD_DEPRECATED);
@@ -465,7 +457,7 @@
   else if (cmd)
     {
       if (cmd->flags & MALLOCED_REPLACEMENT)
-	free (cmd->replacement);
+	xfree (cmd->replacement);
 
       if (deprecate)
 	cmd->flags |= (DEPRECATED_WARN_USER | CMD_DEPRECATED);
@@ -479,7 +471,7 @@
 
 
 void
-_initialize_maint_cmds ()
+_initialize_maint_cmds (void)
 {
   add_prefix_cmd ("maintenance", class_maintenance, maintenance_command,
 		  "Commands for use by GDB maintainers.\n\
@@ -569,6 +561,11 @@
 	   "Print statistics about internal gdb state.",
 	   &maintenanceprintlist);
 
+  add_cmd ("architecture", class_maintenance, maintenance_print_architecture,
+	   "Print the internal architecture configuration.\
+Takes an optional file parameter.",
+	   &maintenanceprintlist);
+
   add_cmd ("check-symtabs", class_maintenance, maintenance_check_symtabs,
 	   "Check consistency of psymtabs and symtabs.",
 	   &maintenancelist);
diff --git a/gdb/mcore-rom.c b/gdb/mcore-rom.c
index e28fddc..7470cb8 100644
--- a/gdb/mcore-rom.c
+++ b/gdb/mcore-rom.c
@@ -83,7 +83,7 @@
 
 
 int
-picobug_dumpregs ()
+picobug_dumpregs (void)
 {
   char buf[1024];
   int resp_len;
@@ -189,7 +189,7 @@
 }
 
 void
-_initialize_picobug_rom ()
+_initialize_picobug_rom (void)
 {
   int i;
 
diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c
index 1fc6e90..c99a2de 100644
--- a/gdb/mcore-tdep.c
+++ b/gdb/mcore-tdep.c
@@ -118,7 +118,7 @@
 /* The base of the current frame is in a frame pointer register.
    This register is noted in frame_extra_info->fp_regnum.
 
-   Note that the existance of an FP might also indicate that the
+   Note that the existence of an FP might also indicate that the
    function has called alloca. */
 #define MY_FRAME_IN_FP 0x2
 
@@ -217,7 +217,7 @@
   return dummy;
 }
 
-/* Function prologues on the Motorol MCore processors consist of:
+/* Function prologues on the Motorola MCore processors consist of:
 
    - adjustments to the stack pointer (r1 used as scratch register)
    - store word/multiples that use r0 as the base address
@@ -336,7 +336,7 @@
       if (IS_SUBI0 (insn))
 	{
 	  int offset = 1 + ((insn >> 4) & 0x1f);
-	  mcore_insn_debug (("MCORE: got subi r0,%d; contnuing\n", offset));
+	  mcore_insn_debug (("MCORE: got subi r0,%d; continuing\n", offset));
 	  framesize += offset;
 	  continue;
 	}
@@ -615,7 +615,7 @@
   struct symtab_and_line sal;
 
   /* If we have line debugging information, then the end of the
-     prologue should the first assembly instruction of  the first
+     prologue should be the first assembly instruction of the first
      source line */
   if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
     {
@@ -978,7 +978,7 @@
 }
 
 void
-_initialize_mcore_tdep ()
+_initialize_mcore_tdep (void)
 {
   extern int print_insn_mcore (bfd_vma, disassemble_info *);
   tm_print_insn = print_insn_mcore;
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index e377435..7ed587f 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -93,11 +93,6 @@
 
 extern void _initialize_mdebugread (void);
 
-/* Provide a default mapping from a ecoff register number to a gdb REGNUM.  */
-#ifndef ECOFF_REG_TO_REGNUM
-#define ECOFF_REG_TO_REGNUM(num) (num)
-#endif
-
 /* Provide a way to test if we have both ECOFF and ELF symbol tables.  
    We use this define in order to know whether we should override a 
    symbol's ECOFF section with its ELF section.  This is necessary in 
@@ -410,8 +405,7 @@
 /* Allocate zeroed memory */
 
 static PTR
-xzalloc (size)
-     unsigned int size;
+xzalloc (unsigned int size)
 {
   PTR p = xmalloc (size);
 
@@ -425,8 +419,7 @@
    and reorders the symtab list at the end */
 
 static void
-mdebug_psymtab_to_symtab (pst)
-     struct partial_symtab *pst;
+mdebug_psymtab_to_symtab (struct partial_symtab *pst)
 {
 
   if (!pst)
@@ -455,8 +448,7 @@
 /* Find a file descriptor given its index RF relative to a file CF */
 
 static FDR *
-get_rfd (cf, rf)
-     int cf, rf;
+get_rfd (int cf, int rf)
 {
   FDR *fdrs;
   register FDR *f;
@@ -478,8 +470,7 @@
 /* Return a safer print NAME for a file descriptor */
 
 static char *
-fdr_name (f)
-     FDR *f;
+fdr_name (FDR *f)
 {
   if (f->rss == -1)
     return "<stripped file>";
@@ -493,10 +484,9 @@
    different sections are relocated via the SECTION_OFFSETS.  */
 
 void
-mdebug_build_psymtabs (objfile, swap, info)
-     struct objfile *objfile;
-     const struct ecoff_debug_swap *swap;
-     struct ecoff_debug_info *info;
+mdebug_build_psymtabs (struct objfile *objfile,
+		       const struct ecoff_debug_swap *swap,
+		       struct ecoff_debug_info *info)
 {
   cur_bfd = objfile->obfd;
   debug_swap = swap;
@@ -580,7 +570,7 @@
 /* Enter a new lexical context */
 
 static void
-push_parse_stack ()
+push_parse_stack (void)
 {
   struct parse_stack *new;
 
@@ -605,7 +595,7 @@
 /* Exit a lexical context */
 
 static void
-pop_parse_stack ()
+pop_parse_stack (void)
 {
   if (!top_stack)
     return;
@@ -639,9 +629,7 @@
 /* Check whether we already saw symbol SH in file FH */
 
 static struct mdebug_pending *
-is_pending_symbol (fh, sh)
-     FDR *fh;
-     char *sh;
+is_pending_symbol (FDR *fh, char *sh)
 {
   int f_idx = fh - debug_info->fdr;
   register struct mdebug_pending *p;
@@ -656,10 +644,7 @@
 /* Add a new symbol SH of type T */
 
 static void
-add_pending (fh, sh, t)
-     FDR *fh;
-     char *sh;
-     struct type *t;
+add_pending (FDR *fh, char *sh, struct type *t)
 {
   int f_idx = fh - debug_info->fdr;
   struct mdebug_pending *p = is_pending_symbol (fh, sh);
@@ -690,13 +675,8 @@
    SYMR's handled (normally one).  */
 
 static int
-parse_symbol (sh, ax, ext_sh, bigend, section_offsets, objfile)
-     SYMR *sh;
-     union aux_ext *ax;
-     char *ext_sh;
-     int bigend;
-     struct section_offsets *section_offsets;
-     struct objfile *objfile;
+parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
+	      struct section_offsets *section_offsets, struct objfile *objfile)
 {
   const bfd_size_type external_sym_size = debug_swap->external_sym_size;
   void (*const swap_sym_in) (bfd *, PTR, SYMR *) = debug_swap->swap_sym_in;
@@ -1437,13 +1417,8 @@
    they are big-endian or little-endian (from fh->fBigendian).  */
 
 static struct type *
-parse_type (fd, ax, aux_index, bs, bigend, sym_name)
-     int fd;
-     union aux_ext *ax;
-     unsigned int aux_index;
-     int *bs;
-     int bigend;
-     char *sym_name;
+parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
+	    int bigend, char *sym_name)
 {
   /* Null entries in this map are treated specially */
   static struct type **map_bt[] =
@@ -1778,13 +1753,8 @@
    Returns the number of aux symbols we parsed. */
 
 static int
-upgrade_type (fd, tpp, tq, ax, bigend, sym_name)
-     int fd;
-     struct type **tpp;
-     int tq;
-     union aux_ext *ax;
-     int bigend;
-     char *sym_name;
+upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
+	      char *sym_name)
 {
   int off;
   struct type *t;
@@ -1902,10 +1872,8 @@
 static void parse_procedure (PDR *, struct symtab *, struct partial_symtab *);
 
 static void
-parse_procedure (pr, search_symtab, pst)
-     PDR *pr;
-     struct symtab *search_symtab;
-     struct partial_symtab *pst;
+parse_procedure (PDR *pr, struct symtab *search_symtab,
+		 struct partial_symtab *pst)
 {
   struct symbol *s, *i;
   struct block *b;
@@ -2058,9 +2026,7 @@
 /* Relocate the extra function info pointed to by the symbol table.  */
 
 void
-ecoff_relocate_efi (sym, delta)
-     struct symbol *sym;
-     CORE_ADDR delta;
+ecoff_relocate_efi (struct symbol *sym, CORE_ADDR delta)
 {
   struct mips_extra_func_info *e;
 
@@ -2079,11 +2045,8 @@
 			    struct objfile *);
 
 static void
-parse_external (es, bigend, section_offsets, objfile)
-     EXTR *es;
-     int bigend;
-     struct section_offsets *section_offsets;
-     struct objfile *objfile;
+parse_external (EXTR *es, int bigend, struct section_offsets *section_offsets,
+		struct objfile *objfile)
 {
   union aux_ext *ax;
 
@@ -2175,13 +2138,8 @@
 			 struct partial_symtab *, CORE_ADDR);
 
 static void
-parse_lines (fh, pr, lt, maxlines, pst, lowest_pdr_addr)
-     FDR *fh;
-     PDR *pr;
-     struct linetable *lt;
-     int maxlines;
-     struct partial_symtab *pst;
-     CORE_ADDR lowest_pdr_addr;
+parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines,
+	     struct partial_symtab *pst, CORE_ADDR lowest_pdr_addr)
 {
   unsigned char *base;
   int j, k;
@@ -2247,8 +2205,7 @@
    into a partial_symtab.  */
 
 static void
-parse_partial_symbols (objfile)
-     struct objfile *objfile;
+parse_partial_symbols (struct objfile *objfile)
 {
   const bfd_size_type external_sym_size = debug_swap->external_sym_size;
   const bfd_size_type external_rfd_size = debug_swap->external_rfd_size;
@@ -2329,7 +2286,7 @@
      Minor hack: -O3 images might claim some global data belongs
      to FDR -1. We`ll go along with that */
   fdr_to_pst = (struct pst_map *) xzalloc ((hdr->ifdMax + 1) * sizeof *fdr_to_pst);
-  old_chain = make_cleanup (free, fdr_to_pst);
+  old_chain = make_cleanup (xfree, fdr_to_pst);
   fdr_to_pst++;
   {
     struct partial_symtab *pst = new_psymtab ("", objfile);
@@ -2347,7 +2304,7 @@
 
   /* Pass 0 over external syms: swap them in.  */
   ext_block = (EXTR *) xmalloc (hdr->iextMax * sizeof (EXTR));
-  make_cleanup (free, ext_block);
+  make_cleanup (xfree, ext_block);
 
   ext_out = (char *) debug_info->external_ext;
   ext_out_end = ext_out + hdr->iextMax * external_ext_size;
@@ -2747,7 +2704,7 @@
 
 		if (stabstring
 		    && stabstring != debug_info->ss + fh->issBase + sh.iss)
-		  free (stabstring);
+		  xfree (stabstring);
 	      }
 	      /* end - Handle continuation */
 	    }
@@ -3156,11 +3113,8 @@
    all the the enum constants to the partial symbol table.  */
 
 static void
-handle_psymbol_enumerators (objfile, fh, stype, svalue)
-     struct objfile *objfile;
-     FDR *fh;
-     int stype;
-     CORE_ADDR svalue;
+handle_psymbol_enumerators (struct objfile *objfile, FDR *fh, int stype,
+			    CORE_ADDR svalue)
 {
   const bfd_size_type external_sym_size = debug_swap->external_sym_size;
   void (*const swap_sym_in) (bfd *, PTR, SYMR *) = debug_swap->swap_sym_in;
@@ -3223,9 +3177,10 @@
     }
 }
 
+/* Get the next symbol.  OBJFILE is unused. */
+
 static char *
-mdebug_next_symbol_text (objfile)
-     struct objfile *objfile;	/* argument objfile is currently unused */
+mdebug_next_symbol_text (struct objfile *objfile)
 {
   SYMR sh;
 
@@ -3249,9 +3204,7 @@
    The flow of control and even the memory allocation differs.  FIXME.  */
 
 static void
-psymtab_to_symtab_1 (pst, filename)
-     struct partial_symtab *pst;
-     char *filename;
+psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename)
 {
   bfd_size_type external_sym_size;
   bfd_size_type external_pdr_size;
@@ -3441,7 +3394,7 @@
 	  PDR *pdr_in_end;
 
 	  pr_block = (PDR *) xmalloc (fh->cpd * sizeof (PDR));
-	  old_chain = make_cleanup (free, pr_block);
+	  old_chain = make_cleanup (xfree, pr_block);
 
 	  pdr_ptr = ((char *) debug_info->external_pdr
 		     + fh->ipdFirst * external_pdr_size);
@@ -3550,7 +3503,7 @@
 
 	      pr_block = (PDR *) xmalloc (fh->cpd * sizeof (PDR));
 
-	      old_chain = make_cleanup (free, pr_block);
+	      old_chain = make_cleanup (xfree, pr_block);
 
 	      pdr_ptr = ((char *) debug_info->external_pdr
 			 + fh->ipdFirst * external_pdr_size);
@@ -3636,9 +3589,7 @@
    to an opaque aggregate type, else 0.  */
 
 static int
-has_opaque_xref (fh, sh)
-     FDR *fh;
-     SYMR *sh;
+has_opaque_xref (FDR *fh, SYMR *sh)
 {
   TIR tir;
   union aux_ext *ax;
@@ -3670,14 +3621,8 @@
    Return value says how many aux symbols we ate. */
 
 static int
-cross_ref (fd, ax, tpp, type_code, pname, bigend, sym_name)
-     int fd;
-     union aux_ext *ax;
-     struct type **tpp;
-     enum type_code type_code;	/* Use to alloc new type if none is found. */
-     char **pname;
-     int bigend;
-     char *sym_name;
+cross_ref (int fd, union aux_ext *ax, struct type **tpp, enum type_code type_code,	/* Use to alloc new type if none is found. */
+	   char **pname, int bigend, char *sym_name)
 {
   RNDXR rn[1];
   unsigned int rf;
@@ -3874,11 +3819,8 @@
    keeping the symtab sorted */
 
 static struct symbol *
-mylookup_symbol (name, block, namespace, class)
-     char *name;
-     register struct block *block;
-     namespace_enum namespace;
-     enum address_class class;
+mylookup_symbol (char *name, register struct block *block,
+		 namespace_enum namespace, enum address_class class)
 {
   register int bot, top, inc;
   register struct symbol *sym;
@@ -3909,9 +3851,7 @@
    that's the only time we know how big the block is.  FIXME.  */
 
 static void
-add_symbol (s, b)
-     struct symbol *s;
-     struct block *b;
+add_symbol (struct symbol *s, struct block *b)
 {
   int nsyms = BLOCK_NSYMS (b)++;
   struct block *origb;
@@ -3944,9 +3884,7 @@
 /* Add a new block B to a symtab S */
 
 static void
-add_block (b, s)
-     struct block *b;
-     struct symtab *s;
+add_block (struct block *b, struct symtab *s)
 {
   struct blockvector *bv = BLOCKVECTOR (s);
 
@@ -3976,11 +3914,7 @@
    This is another reason why -ggdb debugging format is preferable.  */
 
 static int
-add_line (lt, lineno, adr, last)
-     struct linetable *lt;
-     int lineno;
-     CORE_ADDR adr;
-     int last;
+add_line (struct linetable *lt, int lineno, CORE_ADDR adr, int last)
 {
   /* DEC c89 sometimes produces zero linenos which confuse gdb.
      Change them to something sensible. */
@@ -4002,9 +3936,7 @@
 /* Blocks with a smaller low bound should come first */
 
 static int
-compare_blocks (arg1, arg2)
-     const PTR arg1;
-     const PTR arg2;
+compare_blocks (const PTR arg1, const PTR arg2)
 {
   register int addr_diff;
   struct block **b1 = (struct block **) arg1;
@@ -4021,8 +3953,7 @@
    as required by some MI search routines */
 
 static void
-sort_blocks (s)
-     struct symtab *s;
+sort_blocks (struct symtab *s)
 {
   struct blockvector *bv = BLOCKVECTOR (s);
 
@@ -4073,11 +4004,7 @@
    MAXSYMS and linenumbers MAXLINES we'll put in it */
 
 static struct symtab *
-new_symtab (name, maxsyms, maxlines, objfile)
-     char *name;
-     int maxsyms;
-     int maxlines;
-     struct objfile *objfile;
+new_symtab (char *name, int maxsyms, int maxlines, struct objfile *objfile)
 {
   struct symtab *s = allocate_symtab (name, objfile);
 
@@ -4099,9 +4026,7 @@
 /* Allocate a new partial_symtab NAME */
 
 static struct partial_symtab *
-new_psymtab (name, objfile)
-     char *name;
-     struct objfile *objfile;
+new_psymtab (char *name, struct objfile *objfile)
 {
   struct partial_symtab *psymtab;
 
@@ -4130,8 +4055,7 @@
    proper size to allocate.  */
 
 static struct linetable *
-new_linetable (size)
-     int size;
+new_linetable (int size)
 {
   struct linetable *l;
 
@@ -4148,8 +4072,7 @@
    calculating the proper size to allocate.  */
 
 static struct linetable *
-shrink_linetable (lt)
-     struct linetable *lt;
+shrink_linetable (struct linetable *lt)
 {
 
   return (struct linetable *) xrealloc ((PTR) lt,
@@ -4161,8 +4084,7 @@
 /* Allocate and zero a new blockvector of NBLOCKS blocks. */
 
 static struct blockvector *
-new_bvect (nblocks)
-     int nblocks;
+new_bvect (int nblocks)
 {
   struct blockvector *bv;
   int size;
@@ -4178,8 +4100,7 @@
 /* Allocate and zero a new block of MAXSYMS symbols */
 
 static struct block *
-new_block (maxsyms)
-     int maxsyms;
+new_block (int maxsyms)
 {
   int size = sizeof (struct block) + (maxsyms - 1) * sizeof (struct symbol *);
 
@@ -4190,9 +4111,7 @@
    Shrink_block can also be used by add_symbol to grow a block.  */
 
 static struct block *
-shrink_block (b, s)
-     struct block *b;
-     struct symtab *s;
+shrink_block (struct block *b, struct symtab *s)
 {
   struct block *new;
   struct blockvector *bv = BLOCKVECTOR (s);
@@ -4220,8 +4139,7 @@
 /* Create a new symbol with printname NAME */
 
 static struct symbol *
-new_symbol (name)
-     char *name;
+new_symbol (char *name)
 {
   struct symbol *s = ((struct symbol *)
 		      obstack_alloc (&current_objfile->symbol_obstack,
@@ -4238,8 +4156,7 @@
 /* Create a new type with printname NAME */
 
 static struct type *
-new_type (name)
-     char *name;
+new_type (char *name)
 {
   struct type *t;
 
@@ -4255,10 +4172,8 @@
    it as normal.  */
 
 void
-elfmdebug_build_psymtabs (objfile, swap, sec)
-     struct objfile *objfile;
-     const struct ecoff_debug_swap *swap;
-     asection *sec;
+elfmdebug_build_psymtabs (struct objfile *objfile,
+			  const struct ecoff_debug_swap *swap, asection *sec)
 {
   bfd *abfd = objfile->obfd;
   struct ecoff_debug_info *info;
@@ -4293,7 +4208,7 @@
 #ifdef TM_MIPS_H
 
 void
-fixup_sigtramp ()
+fixup_sigtramp (void)
 {
   struct symbol *s;
   struct symtab *st;
@@ -4395,7 +4310,7 @@
 #endif /* TM_MIPS_H */
 
 void
-_initialize_mdebugread ()
+_initialize_mdebugread (void)
 {
   mdebug_type_void =
     init_type (TYPE_CODE_VOID, 1,
diff --git a/gdb/mem-break.c b/gdb/mem-break.c
index 3f013c2..881ba2f 100644
--- a/gdb/mem-break.c
+++ b/gdb/mem-break.c
@@ -40,9 +40,7 @@
    for inserting the breakpoint.  */
 
 unsigned char *
-memory_breakpoint_from_pc (pcptr, lenptr)
-     CORE_ADDR *pcptr;
-     int *lenptr;
+memory_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
 {
   /* {BIG_,LITTLE_}BREAKPOINT is the sequence of bytes we insert for a
      breakpoint.  On some machines, breakpoints are handled by the
@@ -84,9 +82,7 @@
    is accomplished via BREAKPOINT_MAX).  */
 
 int
-default_memory_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+default_memory_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   int val;
   unsigned char *bp;
@@ -109,9 +105,7 @@
 
 
 int
-default_memory_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+default_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   unsigned char *bp;
   int bplen;
@@ -126,17 +120,13 @@
 
 
 int
-memory_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+memory_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   return MEMORY_INSERT_BREAKPOINT(addr, contents_cache);
 }
 
 int
-memory_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   return MEMORY_REMOVE_BREAKPOINT(addr, contents_cache);
 }
diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog
index 5edfce4..b455382 100644
--- a/gdb/mi/ChangeLog
+++ b/gdb/mi/ChangeLog
@@ -1,3 +1,31 @@
+2000-12-14  Kevin Buettner  <kevinb@redhat.com>
+
+	* mi-cmd-disas.c, mi-cmd-var.c, mi-console.c, mi-main.c,
+	mi-parse.c: Replace occurrences of free() with xfree().
+
+Fri Nov 17 16:07:23 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* mi-main.c: Replace asprintf with xasprintf.
+	* mi-cmd-var.c (mi_cmd_var_create): Ditto.
+
+2000-10-16  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* gdbmi.texinfo (GDB/MI Variable Objects): Dimensions of
+	multitable changed to "@columnfractions .4 .6".  Suggested by
+	Dmitry Sivachenko <dima@Chg.RU>.
+
+2000-08-23  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* gdbmi.texinfo: Change flathead -> @sc{gdb/mi}.
+	Fix typos and markup mistakes (from Dmitry S.
+	Sivachenko <dima@Chg.RU>).
+
+2000-07-24  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* gdbmi.texinfo: Change GDB -> @value{GDBN}, and
+	(gdb) -> (@value{GDBP}).  Fix a few typos and some markup.  From
+	Dmitry S. Sivachenko <dima@Chg.RU>.
+
 Tue May 16 14:13:41 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* mi-main.c (mi_cmd_execute): Use free_current_contents.
diff --git a/gdb/mi/gdbmi.texinfo b/gdb/mi/gdbmi.texinfo
index c2aad45..2e2ff8d 100644
--- a/gdb/mi/gdbmi.texinfo
+++ b/gdb/mi/gdbmi.texinfo
@@ -58,7 +58,7 @@
 @unnumberedsec Function and Purpose
 
 @cindex @sc{gdb/mi}, its purpose
-@sc{gdb/mi} is a line based machine oriented text interface to GDB.  It is
+@sc{gdb/mi} is a line based machine oriented text interface to @value{GDBN}.  It is
 specifically intended to support the development of systems which use
 the debugger as just one small component of a larger system.
 
@@ -151,14 +151,14 @@
 
 @item @var{cli-command} @expansion{}
 @code{[ @var{token} ] @var{cli-command} @var{nl}}, where
-@var{cli-command} is any existing GDB CLI command.
+@var{cli-command} is any existing @value{GDBN} CLI command.
 
 @item @var{mi-command} @expansion{}
 @code{[ @var{token} ] "-" @var{operation} ( " " @var{option} )*
 @code{[} " --" @code{]} ( " " @var{parameter} )* @var{nl}}
 
 @item @var{token} @expansion{}
-@code{"any sequence of digits"}
+"any sequence of digits"
 
 @item @var{option} @expansion{}
 @code{"-" @var{parameter} [ " " @var{parameter} ]}
@@ -167,7 +167,7 @@
 @code{@var{non-blank-sequence} | @var{c-string}}
 
 @item @var{operation} @expansion{}
-@emph{any of the operations described in this document}
+@emph{any of the operations described in this chapter}
 
 @item @var{non-blank-sequence} @expansion{}
 @emph{anything, provided it doesn't contain special characters such as
@@ -180,6 +180,7 @@
 @code{CR | CR-LF}
 @end table
 
+@noindent
 Notes:
 
 @itemize @bullet
@@ -193,7 +194,7 @@
 
 @item
 Some @sc{mi} commands accept optional arguments as part of the parameter
-list. Each option is identified by a leading @samp{-} (dash) and may be
+list.  Each option is identified by a leading @samp{-} (dash) and may be
 followed by an optional argument parameter.  Options occur first in the
 parameter list and can be delimited from normal parameters using
 @samp{--} (this is useful when some parameters begin with a dash).
@@ -217,7 +218,7 @@
 The output from @sc{gdb/mi} consists of zero or more out-of-band records
 followed, optionally, by a single result record.  This result record
 is for the most recent command.  The sequence of output records is
-terminated by @samp{(gdb)}.
+terminated by @samp{(@value{GDBP})}.
 
 If an input command was prefixed with a @code{@var{token}} then the
 corresponding output for that command will also be prefixed by that same
@@ -283,6 +284,7 @@
 @emph{any sequence of digits}.
 @end table
 
+@noindent
 In addition, the following are still being developed:
 
 @table @code
@@ -290,6 +292,7 @@
 This action is currently undefined.
 @end table
 
+@noindent
 Notes:
 
 @itemize @bullet
@@ -299,8 +302,8 @@
 @item
 The @code{@var{token}} is from the corresponding request.  If an execution
 command is interrupted by the @samp{-exec-interrupt} command, the
-@var{token} associated with the `*stopped' message is the one of the
-original execution command, not the one of the interrupt-command.
+@var{token} associated with the @samp{*stopped} message is the one of the
+original execution command, not the one of the interrupt command.
 
 @item
 @cindex status output in @sc{gdb/mi}
@@ -333,7 +336,7 @@
 
 @item
 @cindex log output in @sc{gdb/mi}
-@var{log-stream-output} is output text coming from GDB's internals, for
+@var{log-stream-output} is output text coming from @value{GDBN}'s internals, for
 instance messages that should be displayed as part of an error log.  All
 the log output is prefixed by @samp{&}.
 @end itemize
@@ -359,7 +362,7 @@
 
 @example
 -> -stop
-<- (gdb)
+<- (@value{GDBP})
 @end example
 
 @noindent
@@ -367,7 +370,7 @@
 
 @example
 <- *stop,reason="stop",address="0x123",source="a.c:123"
-<- (gdb)
+<- (@value{GDBP})
 @end example
 
 @subsubheading Simple CLI Command
@@ -378,7 +381,7 @@
 @example
 -> print 1+2
 <- ~3\n
-<- (gdb)
+<- (@value{GDBP})
 @end example
 
 @subsubheading Command With Side Effects
@@ -386,7 +389,7 @@
 @example
 -> -symbol-file xyz.exe
 <- *breakpoint,nr="3",address="0x123",source="a.c:123"
-<- (gdb)
+<- (@value{GDBP})
 @end example
 
 @subsubheading A Bad Command
@@ -396,7 +399,7 @@
 @example
 -> -rubbish
 <- error,"Rubbish not found"
-<- (gdb)
+<- (@value{GDBP})
 @end example
 
 @c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -405,9 +408,9 @@
 
 @cindex compatibility, @sc{gdb/mi} and CLI
 @cindex @sc{gdb/mi}, compatibility with CLI
-To help users familiar with GDB's existing CLI interface, @sc{gdb/mi}
+To help users familiar with @value{GDBN}'s existing CLI interface, @sc{gdb/mi}
 accepts existing CLI commands.  As specified by the syntax, such
-commands can be directly entered into the @sc{gdb/mi} interface and GDB will
+commands can be directly entered into the @sc{gdb/mi} interface and @value{GDBN} will
 respond.
 
 This mechanism is provided as an aid to developers of @sc{gdb/mi}
@@ -437,8 +440,8 @@
 @table @code
 @findex ^done
 @item "^done" [ "," @var{results} ]
-The synchronous operation was successful, @code{@var{results}} is the return
-value.
+The synchronous operation was successful, @code{@var{results}} are the return
+values.
 
 @item "^running"
 @findex ^running
@@ -447,7 +450,7 @@
 running.
 
 @item "^error" "," @var{c-string}
-@cindex ^error
+@findex ^error
 The operation failed.  The @code{@var{c-string}} contains the corresponding
 error message.
 @end table
@@ -457,13 +460,13 @@
 
 @cindex @sc{gdb/mi}, stream records
 @cindex stream records in @sc{gdb/mi}
-GDB internally maintains a number of output streams: the console, the
+@value{GDBN} internally maintains a number of output streams: the console, the
 target, and the log.  The output intended for each of these streams is
 funneled through the @sc{gdb/mi} interface using @dfn{stream records}.
 
 Each stream record begins with a unique @dfn{prefix character} which
 identifies its stream (@pxref{GDB/MI Output Syntax, , @sc{gdb/mi} Output
-Syntax}). In addition to the prefix, each stream record contains a
+Syntax}).  In addition to the prefix, each stream record contains a
 @code{@var{string-output}}.  This is either raw text (with an implicit new
 line) or a quoted C string (which does not contain an implicit newline).
 
@@ -477,7 +480,7 @@
 target.
 
 @item "&" @var{string-output}
-The LOG stream contains debugging messages being produced by GDB's
+The log stream contains debugging messages being produced by @value{GDBN}'s
 internals.
 @end table
 
@@ -503,16 +506,16 @@
 @section @sc{gdb/mi} Command Description Format
 
 The remaining sections describe blocks of commands.  Each block of
-commands is laid out in a fashion similar to this chapter.
+commands is laid out in a fashion similar to this section.
 
 Note the the line breaks shown in the examples are here only for
-readability. They don't appear in the real output.
+readability.  They don't appear in the real output.
 Also note that the commands with a non-available example (N.A.@:) are
 not yet implemented.
 
 @subheading Motivation
 
-The motivation for this collection of commands
+The motivation for this collection of commands.
 
 @subheading Introduction
 
@@ -525,12 +528,12 @@
 @subsubheading Synopsis
 
 @example
- -command @var{args}...
+ -command @var{args}@dots{}
 @end example
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB CLI command.
+The corresponding @value{GDBN} CLI command.
 
 @subsubheading Result
 
@@ -564,27 +567,27 @@
 the @samp{-break-list} command, see the description of the
 @samp{-break-list} command below.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{ignore}.
+The corresponding @value{GDBN} command is @samp{ignore}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -break-insert main
 ^done,bkpt=@{number="1",addr="0x000100d0",file="hello.c",line="5"@}
-(gdb)
+(@value{GDBP})
 -break-after 1 3
 ~
 ^done
-(gdb)
+(@value{GDBP})
 -break-list
 ^done,BreakpointTable=@{hdr=@{"Num","Type","Disp","Enb","Address","What"@},
 bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
 addr="0x000100d0",func="main",file="hello.c",line="5",times="0",
 ignore="3"@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @ignore
@@ -596,7 +599,7 @@
 @end ignore
 
 
-@subheading -break-condition
+@subheading The @code{-break-condition} Command
 @findex -break-condition
 
 @subsubheading Synopsis
@@ -610,23 +613,23 @@
 @samp{-break-list} output (see the description of the @samp{-break-list}
 command below).
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{condition}.
+The corresponding @value{GDBN} command is @samp{condition}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -break-condition 1 1
 ^done
-(gdb)
+(@value{GDBP})
 -break-list
 ^done,BreakpointTable=@{hdr=@{"Num","Type","Disp","Enb","Address","What"@},
 bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
 addr="0x000100d0",func="main",file="hello.c",line="5",cond="1",
 times="0",ignore="3"@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @subheading The @code{-break-delete} Command
@@ -639,22 +642,22 @@
 @end example
 
 Delete the breakpoint(s) whose number(s) are specified in the argument
-list. This is obviously reflected in the breakpoint list.
+list.  This is obviously reflected in the breakpoint list.
 
-@subsubheading GDB command
+@subsubheading @value{GDBN} command
 
-The corresponding GDB command is @samp{delete}.
+The corresponding @value{GDBN} command is @samp{delete}.
 
 @subsubheading Example
 
 @example
-(gdb)
+(@value{GDBP})
 -break-delete 1
 ^done
-(gdb)
+(@value{GDBP})
 -break-list
 ^done,BreakpointTable=@{@}
-(gdb)
+(@value{GDBP})
 @end example
 
 @subheading The @code{-break-disable} Command
@@ -669,22 +672,22 @@
 Disable the named @var{breakpoint}(s).  The field @samp{enabled} in the
 break list is now set to @samp{n} for the named @var{breakpoint}(s).
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{disable}.
+The corresponding @value{GDBN} command is @samp{disable}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -break-disable 2
 ^done
-(gdb)
+(@value{GDBP})
 -break-list
 ^done,BreakpointTable=@{hdr=@{"Num","Type","Disp","Enb","Address","What"@},
 bkpt=@{number="2",type="breakpoint",disp="keep",enabled="n",
 addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @subheading The @code{-break-enable} Command
@@ -698,22 +701,22 @@
 
 Enable (previously disabled) @var{breakpoint}(s).
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{enable}.
+The corresponding @value{GDBN} command is @samp{enable}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -break-enable 2
 ^done
-(gdb)
+(@value{GDBP})
 -break-list
 ^done,BreakpointTable=@{hdr=@{"Num","Type","Disp","Enb","Address","What"@},
 bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
 addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @subheading The @code{-break-info} Command
@@ -728,9 +731,9 @@
 @c REDUNDANT???
 Get information about a single breakpoint.
 
-@subsubheading GDB command
+@subsubheading @value{GDBN} command
 
-The corresponding GDB command is @samp{info break @var{breakpoint}}.
+The corresponding @value{GDBN} command is @samp{info break @var{breakpoint}}.
 
 @subsubheading Example
 N.A.
@@ -786,7 +789,7 @@
 @end example
 
 @noindent
-where @var{number} is the GDB number for this breakpoint, @var{funcname}
+where @var{number} is the @value{GDBN} number for this breakpoint, @var{funcname}
 is the name of the function where the breakpoint was inserted,
 @var{filename} is the name of the source file which contains this
 function, and @var{lineno} is the source line number within that file.
@@ -794,32 +797,32 @@
 Note: this format is open to change.
 @c An out-of-band breakpoint instead of part of the result?
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB commands are @samp{break}, @samp{tbreak},
+The corresponding @value{GDBN} commands are @samp{break}, @samp{tbreak},
 @samp{hbreak}, @samp{thbreak}, and @samp{rbreak}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -break-insert main
 ^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@}
-(gdb)
+(@value{GDBP})
 -break-insert -t foo
 ^done,bkpt=@{number="2",addr="0x00010774",file="recursive2.c",line="11"@}
-(gdb)
+(@value{GDBP})
 -break-list
 ^done,BreakpointTable=@{hdr=@{"Num","Type","Disp","Enb","Address","What"@},
 bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
 addr="0x0001072c", func="main",file="recursive2.c",line="4",times="0"@},
 bkpt=@{number="2",type="breakpoint",disp="del",enabled="y",
 addr="0x00010774",func="foo",file="recursive2.c",line="11",times="0"@}@}
-(gdb)
+(@value{GDBP})
 -break-insert -r foo.*
 ~int foo(int, int);
 ^done,bkpt=@{number="3",addr="0x00010774",file="recursive2.c",line="11"@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @subheading The @code{-break-list} Command
@@ -848,37 +851,37 @@
 @item What
 logical location of the breakpoint, expressed by function name, file
 name, line number
-@item times
+@item Times
 number of times the breakpoint has been hit
 @end table
 
-If there are no breakpoints or watchpoints, the BreakpointTable field is
-an empty list.
+If there are no breakpoints or watchpoints, the @code{BreakpointTable}
+field is an empty list.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{info break}.
+The corresponding @value{GDBN} command is @samp{info break}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -break-list
 ^done,BreakpointTable=@{hdr=@{"Num","Type","Disp","Enb","Address","What"@},
 bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
 addr="0x000100d0",func="main",file="hello.c",line="5",times="0"@},
 bkpt=@{number="2",type="breakpoint",disp="keep",enabled="y",
 addr="0x00010114",func="foo",file="hello.c",line="13",times="0"@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 Here's an example of the result when there are no breakpoints:
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -break-list
 ^done,BreakpointTable=@{@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @subheading The @code{-break-watch} Command
@@ -902,9 +905,9 @@
 Note that @samp{-break-list} will report a single list of watchpoints and
 breakpoints inserted.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB commands are @samp{watch}, @samp{awatch}, and
+The corresponding @value{GDBN} commands are @samp{watch}, @samp{awatch}, and
 @samp{rwatch}.
 
 @subsubheading Example
@@ -912,41 +915,41 @@
 Setting a watchpoint on a variable in the @code{main} function:
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -break-watch x
 ^done,wpt=@{number="2",exp="x"@}
-(gdb)
+(@value{GDBP})
 -exec-continue
 ^running
 ^done,reason="watchpoint-trigger",wpt=@{number="2",exp="x"@},
 value=@{old="-268439212",new="55"@},
 frame=@{func="main",args=@{@},file="recursive2.c",line="5"@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
-Setting a watchpoint on a variable local to a function.  GDB will stop
+Setting a watchpoint on a variable local to a function.  @value{GDBN} will stop
 the program execution twice: first for the variable changing value, then
 for the watchpoint going out of scope.
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -break-watch C
 ^done,wpt=@{number="5",exp="C"@}
-(gdb)
+(@value{GDBP})
 -exec-continue
 ^running
 ^done,reason="watchpoint-trigger",
 wpt=@{number="5",exp="C"@},value=@{old="-276895068",new="3"@},
 frame=@{func="callee4",args=@{@},
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
-(gdb)
+(@value{GDBP})
 -exec-continue
 ^running
 ^done,reason="watchpoint-scope",wpnum="5",
 frame=@{func="callee3",args=@{@{name="strarg",
 value="0x11940 \"A string argument.\""@}@},
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 Listing breakpoints and watchpoints, at different points in the program
@@ -954,10 +957,10 @@
 deleted.
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -break-watch C
 ^done,wpt=@{number="2",exp="C"@}
-(gdb)
+(@value{GDBP})
 -break-list
 ^done,BreakpointTable=@{hdr=@{"Num","Type","Disp","Enb","Address","What"@},
 bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
@@ -965,14 +968,14 @@
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
 bkpt=@{number="2",type="watchpoint",disp="keep",
 enabled="y",addr="",what="C",times="0"@}@}
-(gdb)
+(@value{GDBP})
 -exec-continue
 ^running
 ^done,reason="watchpoint-trigger",wpt=@{number="2",exp="C"@},
 value=@{old="-276895068",new="3"@},
 frame=@{func="callee4",args=@{@},
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
-(gdb)
+(@value{GDBP})
 -break-list
 ^done,BreakpointTable=@{hdr=@{"Num","Type","Disp","Enb","Address","What"@},
 bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
@@ -980,20 +983,20 @@
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@},
 bkpt=@{number="2",type="watchpoint",disp="keep",
 enabled="y",addr="",what="C",times="-5"@}@}
-(gdb)
+(@value{GDBP})
 -exec-continue
 ^running
 ^done,reason="watchpoint-scope",wpnum="2",
 frame=@{func="callee3",args=@{@{name="strarg",
 value="0x11940 \"A string argument.\""@}@},
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
-(gdb)
+(@value{GDBP})
 -break-list
 ^done,BreakpointTable=@{hdr=@{"Num","Type","Disp","Enb","Address","What"@},
 bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
 addr="0x00010734",func="callee4",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8",times="1"@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1048,12 +1051,12 @@
 are displayed.
 @item @var{mode}
 is either 0 (meaning only disassembly) or 1 (meaning mixed source and
-disassembly)
+disassembly).
 @end table
 
 @subsubheading Result
 
-The output for each instruction is composed of two fields:
+The output for each instruction is composed of four fields:
 
 @itemize @bullet
 @item Address
@@ -1063,9 +1066,9 @@
 @end itemize
 
 Note that whatever included in the instruction field, is not manipulated
-directely by flathead, i.e. it is not possible to adjust its format.
+directely by @sc{gdb/mi}, i.e. it is not possible to adjust its format.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
 There's no direct mapping from this command to the CLI.
 
@@ -1074,7 +1077,7 @@
 Disassemble from the current value of @code{$pc} to @code{$pc + 20}:
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -data-disassemble -s $pc -e "$pc + 20" -- 0
 ^done,
 asm_insns=@{
@@ -1088,7 +1091,7 @@
 inst="sethi  %hi(0x11800), %o2"@},
 @{address="0x000107d0",func-name="main",offset="20",
 inst="or  %o2, 0x168, %o4\t! 0x11968 <_lib_version+48>"@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 Disassemble the whole @code{main} function.  Line 32 is part of
@@ -1103,16 +1106,16 @@
 inst="mov   2, %o0"@},
 @{address="0x000107c4",func-name="main",offset="8",
 inst="sethi %hi(0x11800), %o2"@},
-[...]
+[@dots{}]
 @{address="0x0001081c",func-name="main",offset="96",inst="ret "@},
 @{address="0x00010820",func-name="main",offset="100",inst="restore "@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 Disassemble 3 instructions from the start of @code{main}:
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -data-disassemble -f basics.c -l 32 -n 3 -- 0
 ^done,asm_insns=@{
 @{address="0x000107bc",func-name="main",offset="0",
@@ -1121,13 +1124,13 @@
 inst="mov  2, %o0"@},
 @{address="0x000107c4",func-name="main",offset="8",
 inst="sethi  %hi(0x11800), %o2"@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 Disassemble 3 instructions from the start of @code{main} in mixed mode:
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -data-disassemble -f basics.c -l 32 -n 3 -- 1
 ^done,asm_insns=@{
 src_and_asm_line=@{line="31",
@@ -1143,7 +1146,7 @@
 inst="mov  2, %o0"@},
 @{address="0x000107c4",func-name="main",offset="8",
 inst="sethi  %hi(0x11800), %o2"@}@}@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -1160,32 +1163,32 @@
 inferior function call.  The function call will execute synchronously.
 If the expression contains spaces, it must be enclosed in double quotes.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB commands are @samp{print}, @samp{output}, and
+The corresponding @value{GDBN} commands are @samp{print}, @samp{output}, and
 @samp{call}.  In @code{gdbtk} only, there's a corresponding
 @samp{gdb_eval} command.
 
 @subsubheading Example
 
 In the following example, the numbers that precede the commands are the
-@dfn{tokens} described in @ref{GDB/MI Command Syntax, , @sc{gdb/mi}
+@dfn{tokens} described in @ref{GDB/MI Command Syntax, ,@sc{gdb/mi}
 Command Syntax}.  Notice how @sc{gdb/mi} returns the same tokens in its
 output.
 
 @smallexample
 211-data-evaluate-expression A
 211^done,value="1"
-(gdb)
+(@value{GDBP})
 311-data-evaluate-expression &A
 311^done,value="0xefffeb7c"
-(gdb)
+(@value{GDBP})
 411-data-evaluate-expression A+3
 411^done,value="4"
-(gdb)
+(@value{GDBP})
 511-data-evaluate-expression "A + 3"
 511^done,value="4"
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -1200,29 +1203,29 @@
 
 Display a list of the registers that have changed.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-GDB doesn't have a direct analog for this command; @code{gdbtk} has the
-corresponding command @samp{gdb_changed_register_list}.
+@value{GDBN} doesn't have a direct analog for this command; @code{gdbtk}
+has the corresponding command @samp{gdb_changed_register_list}.
 
 @subsubheading Example
 
 On a PPC MBX board:
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -exec-continue
 ^running
 
-(gdb)
+(@value{GDBP})
 *stopped,reason="breakpoint-hit",bkptno="1",frame=@{func="main",
 args=@{@},file="try.c",line="5"@}
-(gdb)
+(@value{GDBP})
 -data-list-changed-registers
 ^done,changed-registers=@{"0","1","2","4","5","6","7","8","9",
 "10","11","13","14","15","16","17","18","19","20","21","22","23",
 "24","25","26","27","28","30","31","64","65","66","67","69"@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -1240,9 +1243,9 @@
 integer numbers are given as arguments, it will print a list of the
 names of the registers corresponding to the arguments.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-GDB does not have a command which corresponds to
+@value{GDBN} does not have a command which corresponds to
 @samp{-data-list-register-names}.  In @code{gdbtk} there is a
 corresponding command @samp{gdb_regnames}.
 
@@ -1250,7 +1253,7 @@
 
 For the PPC MBX board:
 @smallexample
-(gdb)
+(@value{GDBP})
 -data-list-register-names
 ^done,register-names=@{"r0","r1","r2","r3","r4","r5","r6","r7",
 "r8","r9","r10","r11","r12","r13","r14","r15","r16","r17","r18",
@@ -1259,10 +1262,10 @@
 "f10","f11","f12","f13","f14","f15","f16","f17","f18","f19","f20",
 "f21","f22","f23","f24","f25","f26","f27","f28","f29","f30","f31",
 "pc","ps","cr","lr","ctr","xer"@}
-(gdb)
+(@value{GDBP})
 -data-list-register-names 1 2 3
 ^done,register-names=@{"r1","r2","r3"@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @subheading The @code{-data-list-register-values} Command
@@ -1296,10 +1299,10 @@
 Natural
 @end table
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB commands are @samp{info reg}, @samp{info all-reg},
-and (in @code{gdbtk}) @samp{gdb_fetch_registers}.
+The corresponding @value{GDBN} commands are @samp{info reg}, @samp{info
+all-reg}, and (in @code{gdbtk}) @samp{gdb_fetch_registers}.
 
 @subsubheading Example
 
@@ -1307,11 +1310,11 @@
 don't appear in the actual output):
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -data-list-register-values r 64 65
 ^done,register-values=@{@{number="64",value="0xfe00a300"@},
 @{number="65",value="0x00029002"@}@}
-(gdb)
+(@value{GDBP})
 -data-list-register-values x
 ^done,register-values=@{@{number="0",value="0xfe0043c8"@},
 @{number="1",value="0x3fff88"@},@{number="2",value="0xfffffffe"@},
@@ -1349,7 +1352,7 @@
 @{number="65",value="0x29002"@},@{number="66",value="0x202f04b5"@},
 @{number="67",value="0xfe0043b0"@},@{number="68",value="0xfe00b3e4"@},
 @{number="69",value="0x20002b03"@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -1375,8 +1378,8 @@
 
 @item @var{word-format}
 The format to be used to print the memory words.  The notation is the
-same as for GDB's @code{print} command (@pxref{Output Formats, , Output
-formats}).
+same as for @value{GDBN}'s @code{print} command (@pxref{Output Formats,
+,Output formats}).
 
 @item @var{word-size}
 The size of each memory word in bytes.
@@ -1406,23 +1409,23 @@
 in @samp{nr-bytes} and the starting address used to read memory in
 @samp{addr}.
 
-The address of the next/previous page or row is available in
+The address of the next/previous row or page is available in
 @samp{next-row} and @samp{prev-row}, @samp{next-page} and
 @samp{prev-page}.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{x}.  @code{gdbtk} has
-@samp{gdb_get_mem} memory read.
+The corresponding @value{GDBN} command is @samp{x}.  @code{gdbtk} has
+@samp{gdb_get_mem} memory read command.
 
 @subsubheading Example
 
 Read six bytes of memory starting at @code{bytes+6} but then offset by
-@code{-6} bytes.  Format as three rows of two columns. One byte per
+@code{-6} bytes.  Format as three rows of two columns.  One byte per
 word.  Display each word in hex.
 
 @smallexample
-(gdb)
+(@value{GDBP})
 9-data-read-memory -o -6 -- bytes+6 x 1 3 2
 9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
 next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
@@ -1430,28 +1433,28 @@
 @{addr="0x00001390",data=@{"0x00","0x01"@}@},
 @{addr="0x00001392",data=@{"0x02","0x03"@}@},
 @{addr="0x00001394",data=@{"0x04","0x05"@}@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 Read two bytes of memory starting at address @code{shorts + 64} and
 display as a single word formatted in decimal.
 
 @smallexample
-(gdb)
+(@value{GDBP})
 5-data-read-memory shorts+64 d 2 1 1
 5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
 next-row="0x00001512",prev-row="0x0000150e",
 next-page="0x00001512",prev-page="0x0000150e",memory=@{
 @{addr="0x00001510",data=@{"128"@}@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 Read thirty two bytes of memory starting at @code{bytes+16} and format
-as eight rows of four columns.  Include a string encoding with @code{x}
+as eight rows of four columns.  Include a string encoding with @samp{x}
 used as the non-printable character.
 
 @smallexample
-(gdb)
+(@value{GDBP})
 4-data-read-memory bytes+16 x 1 8 4 x
 4^done,addr="0x000013a0",nr-bytes="32",total-bytes="32",
 next-row="0x000013c0",prev-row="0x0000139c",
@@ -1464,7 +1467,7 @@
 @{addr="0x000013b4",data=@{"0x24","0x25","0x26","0x27"@},ascii="$%&'"@},
 @{addr="0x000013b8",data=@{"0x28","0x29","0x2a","0x2b"@},ascii="()*+"@},
 @{addr="0x000013bc",data=@{"0x2c","0x2d","0x2e","0x2f"@},ascii=",-./"@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @subheading The @code{-display-delete} Command
@@ -1478,9 +1481,9 @@
 
 Delete the display @var{number}.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{delete display}.
+The corresponding @value{GDBN} command is @samp{delete display}.
 
 @subsubheading Example
 N.A.
@@ -1497,9 +1500,9 @@
 
 Disable display @var{number}.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{disable display}.
+The corresponding @value{GDBN} command is @samp{disable display}.
 
 @subsubheading Example
 N.A.
@@ -1516,9 +1519,9 @@
 
 Enable display @var{number}.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{enable display}.
+The corresponding @value{GDBN} command is @samp{enable display}.
 
 @subsubheading Example
 N.A.
@@ -1535,9 +1538,9 @@
 
 Display @var{expression} every time the program stops.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{display}.
+The corresponding @value{GDBN} command is @samp{display}.
 
 @subsubheading Example
 N.A.
@@ -1554,9 +1557,9 @@
 
 List the displays.  Do not show the current values.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{info display}.
+The corresponding @value{GDBN} command is @samp{info display}.
 
 @subsubheading Example
 N.A.
@@ -1571,19 +1574,19 @@
  -environment-cd @var{pathdir}
 @end example
 
-Set GDB's working directory.
+Set @value{GDBN}'s working directory.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{cd}.
+The corresponding @value{GDBN} command is @samp{cd}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
 ^done
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -1598,17 +1601,17 @@
 
 Add directory @var{pathdir} to beginning of search path for source files.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{dir}.
+The corresponding @value{GDBN} command is @samp{dir}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
 ^done
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -1621,19 +1624,19 @@
  -environment-path ( @var{pathdir} )+
 @end example
 
-Add directories to beginning of search path for object files.
+Add directories @var{pathdir} to beginning of search path for object files.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{path}.
+The corresponding @value{GDBN} command is @samp{path}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb
 ^done
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -1648,18 +1651,18 @@
 
 Show the current working directory.
 
-@subsubheading GDB command
+@subsubheading @value{GDBN} command
 
-The corresponding GDB command is @samp{pwd}.
+The corresponding @value{GDBN} command is @samp{pwd}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -environment-pwd
 ~Working directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb.
 ^done
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1669,42 +1672,42 @@
 @subsubheading Program termination
 
 As a result of execution, the inferior program can run to completion, if
-it doesn't encouter any breakpoints.  In this case the ouput will
+it doesn't encounter any breakpoints.  In this case the output will
 include an exit code, if the program has exited exceptionally.
 
-@subsubheading Examples:
+@subsubheading Examples
 
 @noindent
 Program exited normally:
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -exec-run
 ^running
-(gdb)
+(@value{GDBP})
 x = 55
 *stopped,reason="exited-normally"
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @noindent
 Program exited exceptionally:
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -exec-run
 ^running
-(gdb)
+(@value{GDBP})
 x = 55
 *stopped,reason="exited",exit-code="01"
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 Another way the program can terminate is if it receives a signal such as
 @code{SIGINT}.  In this case, @sc{gdb/mi} displays this:
 
 @smallexample
-(gdb)
+(@value{GDBP})
 *stopped,reason="exited-signalled",signal-name="SIGINT",
 signal-meaning="Interrupt"
 @end smallexample
@@ -1721,9 +1724,9 @@
 
 Kill the inferior running program.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{kill}.
+The corresponding @value{GDBN} command is @samp{kill}.
 
 @subsubheading Example
 N.A.
@@ -1741,9 +1744,9 @@
 Set the inferior program arguments, to be used in the next
 @samp{-exec-run}.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{set args}.
+The corresponding @value{GDBN} command is @samp{set args}.
 
 @subsubheading Example
 
@@ -1763,20 +1766,20 @@
 Asynchronous command.  Resumes the execution of the inferior program
 until a breakpoint is encountered, or until the inferior exits.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB corresponding is @samp{continue}.
+The corresponding @value{GDBN} corresponding is @samp{continue}.
 
 @subsubheading Example
 
 @smallexample
 -exec-continue
 ^running
-(gdb)
+(@value{GDBP})
 @@Hello world
 *stopped,reason="breakpoint-hit",bkptno="2",frame=@{func="foo",args=@{@},
 file="hello.c",line="13"@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -1793,9 +1796,9 @@
 until the current function is exited.  Displays the results returned by
 the function.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{finish}.
+The corresponding @value{GDBN} command is @samp{finish}.
 
 @subsubheading Example
 
@@ -1804,25 +1807,26 @@
 @smallexample
 -exec-finish
 ^running
-(gdb)
+(@value{GDBP})
 @@hello from foo
 *stopped,reason="function-finished",frame=@{func="main",args=@{@},
 file="hello.c",line="7"@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
-Function returning other than @code{void}.  The name of the internal GDB
-variable storing the result is printed, together with the value itself.
+Function returning other than @code{void}.  The name of the internal
+@value{GDBN} variable storing the result is printed, together with the
+value itself.
 
 @smallexample
 -exec-finish
 ^running
-(gdb)
+(@value{GDBP})
 *stopped,reason="function-finished",frame=@{addr="0x000107b0",func="foo",
 args=@{@{name="a",value="1"@},@{name="b",value="9"@}@},
 file="recursive2.c",line="14"@},
 gdb-result-var="$1",return-value="0"
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -1835,35 +1839,35 @@
  -exec-interrupt
 @end example
 
-Asynchronous command. Interrupts the background execution of the target.
+Asynchronous command.  Interrupts the background execution of the target.
 Note how the token associated with the stop message is the one for the
 execution command that has been interrupted.  The token for the interrupt
-itself only appears in the '^done' output.  If the user is trying to
+itself only appears in the @samp{^done} output.  If the user is trying to
 interrupt a non-running program, an error message will be printed.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{interrupt}.
+The corresponding @value{GDBN} command is @samp{interrupt}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 111-exec-continue
 111^running
 
-(gdb)
+(@value{GDBP})
 222-exec-interrupt
 222^done
-(gdb)
+(@value{GDBP})
 111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
 frame=@{addr="0x00010140",func="foo",args=@{@},file="try.c",line="13"@}
-(gdb)
+(@value{GDBP})
 
-(gdb)
+(@value{GDBP})
 -exec-interrupt
 ^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -1879,18 +1883,18 @@
 Asynchronous command.  Resumes execution of the inferior program, stopping
 when the beginning of the next source line is reached.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{next}.
+The corresponding @value{GDBN} command is @samp{next}.
 
 @subsubheading Example
 
 @smallexample
 -exec-next
 ^running
-(gdb)
+(@value{GDBP})
 *stopped,reason="end-stepping-range",line="8",file="hello.c"
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -1908,21 +1912,21 @@
 the program stops at an instruction in the middle of a source line, the
 address will be printed as well.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{nexti}.
+The corresponding @value{GDBN} command is @samp{nexti}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -exec-next-instruction
 ^running
 
-(gdb)
+(@value{GDBP})
 *stopped,reason="end-stepping-range",
 addr="0x000100d4",line="5",file="hello.c"
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -1938,34 +1942,34 @@
 Makes current function return immediately.  Doesn't execute the inferior.
 Displays the new current frame.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{return}.
+The corresponding @value{GDBN} command is @samp{return}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 200-break-insert callee4
 200^done,bkpt=@{number="1",addr="0x00010734",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
-(gdb)
+(@value{GDBP})
 000-exec-run
 000^running
-(gdb)
+(@value{GDBP})
 000*stopped,reason="breakpoint-hit",bkptno="1",
 frame=@{func="callee4",args=@{@},
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
-(gdb)
+(@value{GDBP})
 205-break-delete
 205^done
-(gdb)
+(@value{GDBP})
 111-exec-return
 111^done,frame=@{level="0 ",func="callee3",
 args=@{@{name="strarg",
 value="0x11940 \"A string argument.\""@}@},
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -1982,23 +1986,23 @@
 beginning.  The inferior executes until either a breakpoint is
 encountered or the program exits.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{run}.
+The corresponding @value{GDBN} command is @samp{run}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -break-insert main
 ^done,bkpt=@{number="1",addr="0x0001072c",file="recursive2.c",line="4"@}
-(gdb)
+(@value{GDBP})
 -exec-run
 ^running
-(gdb)
+(@value{GDBP})
 *stopped,reason="breakpoint-hit",bkptno="1",
 frame=@{func="main",args=@{@},file="recursive2.c",line="4"@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -2013,9 +2017,9 @@
 
 Print the arguments of the program.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{show args}.
+The corresponding @value{GDBN} command is @samp{show args}.
 
 @subsubheading Example
 N.A.
@@ -2036,9 +2040,9 @@
 source line is not a function call.  If it is, stop at the first
 instruction of the called function.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{step}.
+The corresponding @value{GDBN} command is @samp{step}.
 
 @subsubheading Example
 
@@ -2047,11 +2051,11 @@
 @smallexample
 -exec-step
 ^running
-(gdb)
+(@value{GDBP})
 *stopped,reason="end-stepping-range",
 frame=@{func="foo",args=@{@{name="a",value="10"@},
 @{name="b",value="0"@}@},file="recursive2.c",line="11"@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 Regular stepping:
@@ -2059,9 +2063,9 @@
 @smallexample
 -exec-step
 ^running
-(gdb)
+(@value{GDBP})
 *stopped,reason="end-stepping-range",line="14",file="recursive2.c"
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -2075,33 +2079,33 @@
 @end example
 
 Asynchronous command.  Resumes the inferior which executes one machine
-instruction.  The output, once GDB has stopped, will vary depending on
+instruction.  The output, once @value{GDBN} has stopped, will vary depending on
 whether we have stopped in the middle of a source line or not.  In the
 former case, the address at which the program stopped will be printed as
 well.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{stepi}.
+The corresponding @value{GDBN} command is @samp{stepi}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -exec-step-instruction
 ^running
 
-(gdb)
+(@value{GDBP})
 *stopped,reason="end-stepping-range",
 frame=@{func="foo",args=@{@},file="try.c",line="10"@}
-(gdb)
+(@value{GDBP})
 -exec-step-instruction
 ^running
 
-(gdb)
+(@value{GDBP})
 *stopped,reason="end-stepping-range",
 frame=@{addr="0x000100f4",func="foo",args=@{@},file="try.c",line="10"@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -2117,23 +2121,23 @@
 Asynchronous command.  Executes the inferior until the @var{location}
 specified in the argument is reached.  If there is no argument, the inferior
 executes until a source line greater than the current one is reached.
-The reason for stopping in this case will be ``location-reached''.
+The reason for stopping in this case will be @samp{location-reached}.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{until}.
+The corresponding @value{GDBN} command is @samp{until}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -exec-until recursive2.c:6
 ^running
-(gdb)
+(@value{GDBP})
 x = 55
 *stopped,reason="location-reached",frame=@{func="main",args=@{@},
 file="recursive2.c",line="6"@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @ignore
@@ -2154,21 +2158,21 @@
 Specify the executable file to be debugged.  This file is the one from
 which the symbol table is also read.  If no file is specified, the
 command clears the executable and symbol information.  If breakpoints
-are set when using this command with no arguments, gdb will produce
+are set when using this command with no arguments, @value{GDBN} will produce
 error messages.  Otherwise, no output is produced, except a completion
 notification.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{file}.
+The corresponding @value{GDBN} command is @samp{file}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
 ^done
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -2183,21 +2187,21 @@
 
 Specify the executable file to be debugged.  Unlike
 @samp{-file-exec-and-symbols}, the symbol table is @emph{not} read
-from this file.  If used without argument, GDB clears the information
+from this file.  If used without argument, @value{GDBN} clears the information
 about the executable file.  No output is produced, except a completion
 notification.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{exec-file}.
+The corresponding @value{GDBN} command is @samp{exec-file}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
 ^done
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -2212,9 +2216,9 @@
 
 List the sections of the current executable file.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The GDB command @samp{info file} shows, among the rest, the same
+The @value{GDBN} command @samp{info file} shows, among the rest, the same
 information as this command.  @code{gdbtk} has a corresponding command
 @samp{gdb_load_info}.
 
@@ -2233,9 +2237,9 @@
 
 List the source files for the current executable.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-There's no GDB command which directly corresponds to this one.
+There's no @value{GDBN} command which directly corresponds to this one.
 @code{gdbtk} has an analogous command @samp{gdb_listfiles}.
 
 @subsubheading Example
@@ -2253,9 +2257,9 @@
 
 List the shared libraries in the program.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{info shared}.
+The corresponding @value{GDBN} command is @samp{info shared}.
 
 @subsubheading Example
 N.A.
@@ -2272,9 +2276,9 @@
 
 List symbol files.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{info file} (part of it).
+The corresponding @value{GDBN} command is @samp{info file} (part of it).
 
 @subsubheading Example
 N.A.
@@ -2290,25 +2294,25 @@
 @end example
 
 Read symbol table info from the specified @var{file} argument.  When
-used without arguments, clears GDB's symbol table info.  No output is
+used without arguments, clears @value{GDBN}'s symbol table info.  No output is
 produced, except for a completion notification.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{symbol-file}.
+The corresponding @value{GDBN} command is @samp{symbol-file}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
 ^done
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 @node GDB/MI Miscellaneous Commands
-@section Miscellaneous GDB commands in @sc{gdb/mi}
+@section Miscellaneous @value{GDBN} commands in @sc{gdb/mi}
 
 @c @subheading -gdb-complete
 
@@ -2321,16 +2325,16 @@
  -gdb-exit
 @end example
 
-Exit GDB immediately.
+Exit @value{GDBN} immediately.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
 Approximately corresponds to @samp{quit}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -gdb-exit
 @end smallexample
 
@@ -2343,20 +2347,20 @@
  -gdb-set
 @end example
 
-Set an internal GDB variable.
+Set an internal @value{GDBN} variable.
 @c IS THIS A DOLLAR VARIABLE? OR SOMETHING LIKE ANNOTATE ?????
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{set}.
+The corresponding @value{GDBN} command is @samp{set}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -gdb-set $foo=3
 ^done
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -2369,19 +2373,19 @@
  -gdb-show
 @end example
 
-Show the current value of a GDB variable.
+Show the current value of a @value{GDBN} variable.
 
-@subsubheading GDB command
+@subsubheading @value{GDBN} command
 
-The corresponding GDB command is @samp{show}.
+The corresponding @value{GDBN} command is @samp{show}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -gdb-show annotate
 ^done,value="0"
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @c @subheading -gdb-source
@@ -2396,11 +2400,11 @@
  -gdb-version
 @end example
 
-Show version information for GDB.  Used mostly in testing.
+Show version information for @value{GDBN}.  Used mostly in testing.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-There's no equivalent GDB command.  GDB by default shows this
+There's no equivalent @value{GDBN} command.  @value{GDBN} by default shows this
 information when you start an interactive session.
 
 @subsubheading Example
@@ -2408,7 +2412,7 @@
 @c This example modifies the actual output from GDB to avoid overfull
 @c box in TeX.
 @smallexample
-(gdb)
+(@value{GDBP})
 -gdb-version
 ~GNU gdb 5.2.1
 ~Copyright 2000 Free Software Foundation, Inc.
@@ -2421,7 +2425,7 @@
 ~This GDB was configured as 
  "--host=sparc-sun-solaris2.5.1 --target=ppc-eabi".
 ^done
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @ignore
@@ -2489,9 +2493,9 @@
 
 Get info on the current frame.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{info frame} or @samp{frame}
+The corresponding @value{GDBN} command is @samp{info frame} or @samp{frame}
 (without arguments).
 
 @subsubheading Example
@@ -2509,31 +2513,31 @@
 Return the depth of the stack.  If the integer argument @var{max-depth}
 is specified, do not count beyond @var{max-depth} frames.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-There's no equivalent GDB command.
+There's no equivalent @value{GDBN} command.
 
 @subsubheading Example
 
 For a stack with frame levels 0 through 11:
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -stack-info-depth
 ^done,depth="12"
-(gdb)
+(@value{GDBP})
 -stack-info-depth 4
 ^done,depth="4"
-(gdb)
+(@value{GDBP})
 -stack-info-depth 12
 ^done,depth="12"
-(gdb)
+(@value{GDBP})
 -stack-info-depth 11
 ^done,depth="11"
-(gdb)
+(@value{GDBP})
 -stack-info-depth 13
 ^done,depth="12"
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @subheading The @code{-stack-list-arguments} Command
@@ -2555,16 +2559,16 @@
 0 means that only the names of the arguments are listed, a value of 1
 means that both names and values of the arguments are printed.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-GDB does not have an equivalent command.  @code{gdbtk} has a
+@value{GDBN} does not have an equivalent command.  @code{gdbtk} has a
 @samp{gdb_get_args} command which partially overlaps with the
 functionality of @samp{-stack-list-arguments}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -stack-list-frames
 ^done,
 stack=@{
@@ -2578,7 +2582,7 @@
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="27"@},
 frame=@{level="4 ",addr="0x000107e0",func="main",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="32"@}@}
-(gdb)
+(@value{GDBP})
 -stack-list-arguments 0
 ^done,
 stack-args=@{
@@ -2587,7 +2591,7 @@
 frame=@{level="2",args=@{name="intarg",name="strarg"@}@},
 frame=@{level="3",args=@{name="intarg",name="strarg",name="fltarg"@}@},
 frame=@{level="4",args=@{@}@}@}
-(gdb)
+(@value{GDBP})
 -stack-list-arguments 1
 ^done,
 stack-args=@{
@@ -2602,15 +2606,15 @@
 @{name="strarg",value="0x11940 \"A string argument.\""@},
 @{name="fltarg",value="3.5"@}@}@},
 frame=@{level="4",args=@{@}@}@}
-(gdb)
+(@value{GDBP})
 -stack-list-arguments 0 2 2
 ^done,stack-args=@{frame=@{level="2",args=@{name="intarg",name="strarg"@}@}@}
-(gdb)
+(@value{GDBP})
 -stack-list-arguments 1 2 2
 ^done,stack-args=@{frame=@{level="2",
 args=@{@{name="intarg",value="2"@},
 @{name="strarg",value="0x11940 \"A string argument.\""@}@}@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @c @subheading -stack-list-exception-handlers
@@ -2646,16 +2650,16 @@
 levels are between the two arguments (inclusive).  If the two arguments
 are equal, it shows the single frame at the corresponding level.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB commands are @samp{backtrace} and @samp{where}.
+The corresponding @value{GDBN} commands are @samp{backtrace} and @samp{where}.
 
 @subsubheading Example
 
 Full stack backtrace:
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -stack-list-frames
 ^done,stack=
 @{frame=@{level="0 ",addr="0x0001076c",func="foo",
@@ -2682,13 +2686,13 @@
   file="recursive2.c",line="14"@},
 frame=@{level="11",addr="0x00010738",func="main",
   file="recursive2.c",line="4"@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
-Show frames between low_frame and high_frame:
+Show frames between @var{low_frame} and @var{high_frame}:
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -stack-list-frames 3 5
 ^done,stack=
 @{frame=@{level="3 ",addr="0x000107a4",func="foo",
@@ -2697,18 +2701,18 @@
   file="recursive2.c",line="14"@},
 frame=@{level="5 ",addr="0x000107a4",func="foo",
   file="recursive2.c",line="14"@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 Show a single frame:
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -stack-list-frames 3 3
 ^done,stack=
 @{frame=@{level="3 ",addr="0x000107a4",func="foo",
   file="recursive2.c",line="14"@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -2725,21 +2729,21 @@
 argument of 0 prints only the names of the variables, with argument of 1
 prints also their values.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-@samp{info locals} in GDB, @samp{gdb_get_locals} in @code{gdbtk}.
+@samp{info locals} in @value{GDBN}, @samp{gdb_get_locals} in @code{gdbtk}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -stack-list-locals 0
 ^done,locals=@{name="A",name="B",name="C"@}
-(gdb)
+(@value{GDBP})
 -stack-list-locals 1
 ^done,locals=@{@{name="A",value="1"@},@{name="B",value="2"@},
   @{name="C",value="3"@}@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -2755,18 +2759,18 @@
 Change the current frame.  Select a different frame @var{framenum} on
 the stack.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB commands are @samp{frame}, @samp{up}, @samp{down},
-@samp{select-frame}, @samp{up-silent}, and @samp{down-silent}.
+The corresponding @value{GDBN} commands are @samp{frame}, @samp{up},
+@samp{down}, @samp{select-frame}, @samp{up-silent}, and @samp{down-silent}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -stack-select-frame 2
 ^done
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -2785,9 +2789,9 @@
 
 Describe where @var{symbol} is stored.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{info address}.
+The corresponding @value{GDBN} command is @samp{info address}.
 
 @subsubheading Example
 N.A.
@@ -2804,10 +2808,10 @@
 
 Show the file for the symbol.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-There's no equivalent GDB command.  @code{gdbtk} has
-@samp{gdb_filnd_file}.
+There's no equivalent @value{GDBN} command.  @code{gdbtk} has
+@samp{gdb_find_file}.
 
 @subsubheading Example
 N.A.
@@ -2824,7 +2828,7 @@
 
 Show which function the symbol lives in.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
 @samp{gdb_get_function} in @code{gdbtk}.
 
@@ -2843,10 +2847,10 @@
 
 Show the core addresses of the code for a source line.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB comamnd is @samp{info line}.  @code{gdbtk} has the
-@samp{gdb_get_line} @samp{gdb_get_file} commands.
+The corresponding @value{GDBN} comamnd is @samp{info line}.
+@code{gdbtk} has the @samp{gdb_get_line} and @samp{gdb_get_file} commands.
 
 @subsubheading Example
 N.A.
@@ -2863,9 +2867,9 @@
 
 Describe what symbol is at location @var{addr}.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{info symbol}.
+The corresponding @value{GDBN} command is @samp{info symbol}.
 
 @subsubheading Example
 N.A.
@@ -2882,10 +2886,10 @@
 
 List the functions in the executable.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-@samp{info functions} in GDB, @samp{gdb_listfunc} @samp{gdb_search} in
-@code{gdbtk}.
+@samp{info functions} in @value{GDBN}, @samp{gdb_listfunc} and
+@samp{gdb_search} in @code{gdbtk}.
 
 @subsubheading Example
 N.A.
@@ -2902,9 +2906,9 @@
 
 List all the type names.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding commands are @samp{info types} in GDB,
+The corresponding commands are @samp{info types} in @value{GDBN},
 @samp{gdb_search} in @code{gdbtk}.
 
 @subsubheading Example
@@ -2922,9 +2926,9 @@
 
 List all the global and static variable names.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-@samp{info variables} in GDB, @samp{gdb_search} in @code{gdbtk}.
+@samp{info variables} in @value{GDBN}, @samp{gdb_search} in @code{gdbtk}.
 
 @subsubheading Example
 N.A.
@@ -2939,7 +2943,7 @@
  -symbol-locate
 @end example
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
 @samp{gdb_loc} in @code{gdbtk}.
 
@@ -2958,9 +2962,9 @@
 
 Show type of @var{variable}.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{ptype}, @code{gdbtk} has
+The corresponding @value{GDBN} command is @samp{ptype}, @code{gdbtk} has
 @samp{gdb_obj_variable}.
 
 @subsubheading Example
@@ -2981,11 +2985,11 @@
  -target-attach @var{pid} | @var{file}
 @end example
 
-Attach to a process @var{pid} or a file @var{file} outside of GDB.
+Attach to a process @var{pid} or a file @var{file} outside of @value{GDBN}.
 
-@subsubheading GDB command
+@subsubheading @value{GDBN} command
 
-The corresponding GDB command is @samp{attach}.
+The corresponding @value{GDBN} command is @samp{attach}.
 
 @subsubheading Example
 N.A.
@@ -3003,9 +3007,9 @@
 Compare data of section @var{section} on target to the exec file.
 Without the argument, all sections are compared.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The GDB equivalent is @samp{compare-sections}.
+The @value{GDBN} equivalent is @samp{compare-sections}.
 
 @subsubheading Example
 N.A.
@@ -3022,17 +3026,17 @@
 
 Disconnect from the remote target.  There's no output.
 
-@subsubheading GDB command
+@subsubheading @value{GDBN} command
 
-The corresponding GDB command is @samp{detach}.
+The corresponding @value{GDBN} command is @samp{detach}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -target-detach
 ^done
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -3078,11 +3082,11 @@
 @end table
 
 @noindent
-At the end,  a summary is printed.
+At the end, a summary is printed.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{load}.
+The corresponding @value{GDBN} command is @samp{load}.
 
 @subsubheading Example
 
@@ -3090,7 +3094,7 @@
 have been broken down so that they can fit onto a page.
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -target-download
 +download,@{section=".text",section-size="6668",total-size="9880"@}
 +download,@{section=".text",section-sent="512",section-size="6668",
@@ -3136,7 +3140,7 @@
 total-sent="9796",total-size="9880"@}
 ^done,address="0x10004",load-size="9880",transfer-rate="6586",
 write-rate="429"
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -3152,9 +3156,9 @@
 Provide information on the state of the target (whether it is running or
 not, for instance).
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-There's no equivalent GDB command.
+There's no equivalent @value{GDBN} command.
 
 @subsubheading Example
 N.A.
@@ -3171,9 +3175,9 @@
 
 List the possible targets to connect to.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{help target}.
+The corresponding @value{GDBN} command is @samp{help target}.
 
 @subsubheading Example
 N.A.
@@ -3190,7 +3194,7 @@
 
 Describe the current target.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
 The corresponding information is printed by @samp{info file} (among
 other things).
@@ -3210,7 +3214,7 @@
 
 @c ????
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
 No equivalent.
 
@@ -3224,10 +3228,10 @@
 @subsubheading Synopsis
 
 @example
- -target-select @var{type} @var{parameters ...}
+ -target-select @var{type} @var{parameters @dots{}}
 @end example
 
-Connect GDB to the remote target.  This command takes two args:
+Connect @value{GDBN} to the remote target.  This command takes two args:
 
 @table @samp
 @item @var{type}
@@ -3245,17 +3249,17 @@
   args=@{@var{arg list}@}
 @end smallexample
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{target}.
+The corresponding @value{GDBN} command is @samp{target}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -target-select async /dev/ttya
 ^connected,addr="0xfe00a300",func="??",args=@{@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -3272,7 +3276,7 @@
  -thread-info
 @end example
 
-@subsubheading GDB command
+@subsubheading @value{GDBN} command
 
 No equivalent.
 
@@ -3289,9 +3293,9 @@
  -thread-list-all-threads
 @end example
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The equivalent GDB command is @samp{info threads}.
+The equivalent @value{GDBN} command is @samp{info threads}.
 
 @subsubheading Example
 N.A.
@@ -3306,33 +3310,33 @@
  -thread-list-ids
 @end example
 
-Produces a list of the currently known gdb thread ids.  At the end of the
-list it also prints the total number of such threads.
+Produces a list of the currently known @value{GDBN} thread ids.  At the
+end of the list it also prints the total number of such threads.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
 Part of @samp{info threads} supplies the same information.
 
 @subsubheading Example
 
-No threads present, besides the main process.
+No threads present, besides the main process:
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -thread-list-ids
 ^done,thread-ids=@{@},number-of-threads="0"
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
-Several threads.
+Several threads:
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -thread-list-ids
 ^done,thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
 number-of-threads="3"
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 
@@ -3348,31 +3352,31 @@
 Make @var{threadnum} the current thread.  It prints the number of the new
 current thread, and the topmost frame for that thread.
 
-@subsubheading GDB Command
+@subsubheading @value{GDBN} Command
 
-The corresponding GDB command is @samp{thread}.
+The corresponding @value{GDBN} command is @samp{thread}.
 
 @subsubheading Example
 
 @smallexample
-(gdb)
+(@value{GDBP})
 -exec-next
 ^running
-(gdb)
+(@value{GDBP})
 *stopped,reason="end-stepping-range",thread-id="2",line="187",
 file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
-(gdb)
+(@value{GDBP})
 -thread-list-ids
 ^done,
 thread-ids=@{thread-id="3",thread-id="2",thread-id="1"@},
 number-of-threads="3"
-(gdb)
+(@value{GDBP})
 -thread-select 3
 ^done,new-thread-id="3",
 frame=@{level="0 ",func="vprintf",
 args=@{@{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""@},
 @{name="arg",value="0x2"@}@},file="vprintf.c",line="31"@}
-(gdb)
+(@value{GDBP})
 @end smallexample
 
 @c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -3435,8 +3439,8 @@
 @end enumerate
 
 The original interface was designed to be used by Tcl code, so it was
-slightly changed so it could be used through flathead.  This document
-describes the flathead operations that will be available and gives some
+slightly changed so it could be used through @sc{gdb/mi}.  This section
+describes the @sc{gdb/mi} operations that will be available and gives some
 hints about their use.
 
 @emph{Note}: In addition to the set of operations described here, we
@@ -3444,10 +3448,10 @@
 least, the following operations:
 
 @itemize @bullet
-@item -gdb-show output-radix
-@item -stack-list-arguments
-@item -stack-list-locals
-@item -stack-select-frame
+@item @code{-gdb-show} @code{output-radix}
+@item @code{-stack-list-arguments}
+@item @code{-stack-list-locals}
+@item @code{-stack-select-frame}
 @end itemize
 
 @subheading Introduction to Variable Objects in @sc{gdb/mi}
@@ -3471,36 +3475,36 @@
 chosen based on the variable type (like decimal for an @code{int}, hex
 for pointers, etc.).
 
-The following is the complete set of flathead operations defined to
+The following is the complete set of @sc{gdb/mi} operations defined to
 access this functionality:
 
-@multitable @columnfractions .3 .6
+@multitable @columnfractions .4 .6
 @item @strong{Operation}
 @tab @strong{Description}
 
-@item -var-create
+@item @code{-var-create}
 @tab create a variable object
-@item -var-delete
+@item @code{-var-delete}
 @tab delete the variable object and its children
-@item -var-set-format
+@item @code{-var-set-format}
 @tab set the display format of this variable
-@item -var-show-format
+@item @code{-var-show-format}
 @tab show the display format of this variable
-@item -var-info-num-children
+@item @code{-var-info-num-children}
 @tab tells how many children this object has
-@item -var-list-children
+@item @code{-var-list-children}
 @tab return a list of the object's children
-@item -var-info-type
+@item @code{-var-info-type}
 @tab show the type of this variable object
-@item -var-info-expression
+@item @code{-var-info-expression}
 @tab print what this variable object represents
-@item -var-show-attributes
+@item @code{-var-show-attributes}
 @tab is this variable editable? does it exist here?
-@item -var-evaluate-expression
+@item @code{-var-evaluate-expression}
 @tab get the value of this variable
-@item -var-assign
+@item @code{-var-assign}
 @tab set the value of this variable
-@item -var-update
+@item @code{-var-update}
 @tab update the variable and its children
 @end multitable
 
@@ -3525,7 +3529,7 @@
 
 The @var{name} parameter is the string by which the object can be
 referenced.  It must be unique.  If @samp{-} is specified, the varobj
-system will generate a string "varNNNNNN'' automatically.  It will be
+system will generate a string ``varNNNNNN'' automatically.  It will be
 unique provided that one does not specify @var{name} on that format.
 The command fails if a duplicate name is found.
 
@@ -3541,17 +3545,17 @@
 @samp{*@var{addr}}, where @var{addr} is the address of a memory cell
 
 @item
-@samp{*@var{addr}-@var{addr}} -- a memory address range (TBD)
+@samp{*@var{addr}-@var{addr}} --- a memory address range (TBD)
 
 @item
-@samp{$@var{regname}} -- a CPU register name
+@samp{$@var{regname}} --- a CPU register name
 @end itemize
 
 @subsubheading Result
 
 This operation returns the name, number of children and the type of the
 object created.  Type is returned as a string as the ones generated by
-the GDB CLI:
+the @value{GDBN} CLI:
 
 @example
  name="@var{name}",numchild="N",type="@var{type}"
@@ -3604,7 +3608,7 @@
 Returns the format used to display the value of the object @var{name}.
 
 @example
- format @expansion{}
+ @var{format} @expansion{}
  @var{format-spec}
 @end example
 
@@ -3638,7 +3642,7 @@
 
 @example
  numchild=@var{n},children=@{@{name=@var{name},
- numchild=@var{n},type=@var{type}@},(repeats N times)@}
+ numchild=@var{n},type=@var{type}@},@r{(repeats N times)}@}
 @end example
 
 
@@ -3652,7 +3656,8 @@
 @end example
 
 Returns the type of the specified variable @var{name}.  The type is
-returned as a string in the same format as it is output by the GDB CLI:
+returned as a string in the same format as it is output by the
+@value{GDBN} CLI:
 
 @example
  type=@var{typename}
@@ -3722,7 +3727,7 @@
 @end example
 
 Assigns the value of @var{expression} to the variable object specified
-by @var{name}.  The object must be ``editable''.
+by @var{name}.  The object must be @samp{editable}.
 
 @subheading The @code{-var-update} Command
 @findex -var-update
@@ -3766,16 +3771,16 @@
 The output from @sc{gdb/mi} consists of zero or more out-of-band records
 optionally followed by a single result record, the result record being
 for the most recent command input.  The sequence is terminated by
-``(gdb)''.
+@samp{(@value{GDBP})}.
 
 Asynchronous @sc{gdb/mi} output is similar.
 
 Each output record directly associated with an input command is prefixed
-by the input commands @code{@var{token}}.
+by the input command's @code{@var{token}}.
 
 @table @code
 @item @var{output} @expansion{}
-@{ @var{out-of-band-record} @} @code{[} @var{result-record} @code{]} "(gdb)" @var{nl}
+@{ @var{out-of-band-record} @} @code{[} @var{result-record} @code{]} "@code{(@value{GDBP})}" @var{nl}
 
 @item @var{result-record} @expansion{}
 @code{[} @var{token} @code{]} "^" @var{result-class} @{ "," @var{result} @} @var{nl}
@@ -3860,38 +3865,38 @@
 
 @item
 The @code{@var{token}} is from the corresponding request.  If an execution
-command is interrupted by the -exec-interrupt command, the token
+command is interrupted by the @code{-exec-interrupt} command, the token
 associated with the `*stopped' message is the one of the original
-execution command, not the one of the interrupt-command.
+execution command, not the one of the interrupt command.
 
 @item
-@var{status-async-output} contains on-going status information about the progress
-of a slow operation.  It can be discarded. All status output is prefixed by
-the prefix `+'.
+@var{status-async-output} contains on-going status information about the
+progress of a slow operation.  It can be discarded.  All status output is
+prefixed by the prefix @samp{+}.
 
 @item
 @var{exec-async-output} contains asynchronous state change on the target
-(stopped, started, disappeared). All async output is prefixed by
-the prefix `*'.
+(stopped, started, disappeared).  All async output is prefixed by
+the prefix @samp{*}.
 
 @item
-@var{notify-async-output} contains supplementary information that the client should
-handle (new breakpoint information). All notify output is prefixed by
-the prefix `='.
+@var{notify-async-output} contains supplementary information that the
+client should handle (new breakpoint information).  All notify output is
+prefixed by the prefix @samp{=}.
 
 @item
 @var{console-stream-output} is output that should be displayed as is, in the
-console.  It is the textual response to a CLI command. All the console
-output is prefixed by the prefix ``~''.
+console.  It is the textual response to a CLI command.  All the console
+output is prefixed by the prefix @samp{~}.
 
 @item
 @var{target-stream-output} is the output produced by the target program.
-All the target output is prefixed by the prefix ``@@''.
+All the target output is prefixed by the prefix @samp{@@}.
 
 @item
-@var{log-stream-output} is output text coming from GDB's internals, for
-instance messages that should be displayed as part of an error log.  All
-the log output is prefixed by the prefix ``&''.
+@var{log-stream-output} is output text coming from @value{GDBN}'s
+internals, for instance messages that should be displayed as part of an
+error log.  All the log output is prefixed by the prefix @samp{&}.
 
 @end itemize
 
diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c
index bbd1c00..accddd5 100644
--- a/gdb/mi/mi-cmd-disas.c
+++ b/gdb/mi/mi-cmd-disas.c
@@ -428,9 +428,9 @@
 		  ui_out_field_int (uiout, "offset", offset);
 		}
 	      if (filename != NULL)
-		free (filename);
+		xfree (filename);
 	      if (name != NULL)
-		free (name);
+		xfree (name);
 
 	      ui_file_rewind (stb->stream);
 	      pc += (*tm_print_insn) (pc, &di);
@@ -476,9 +476,9 @@
 	      ui_out_field_int (uiout, "offset", offset);
 	    }
 	  if (filename != NULL)
-	    free (filename);
+	    xfree (filename);
 	  if (name != NULL)
-	    free (name);
+	    xfree (name);
 
 	  ui_file_rewind (stb->stream);
 	  pc += (*tm_print_insn) (pc, &di);
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 771d8ef..c557a9c 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -52,7 +52,7 @@
 
   if (argc != 3)
     {
-      /*      asprintf (&mi_error_message,
+      /*      xasprintf (&mi_error_message,
          "mi_cmd_var_create: Usage: .");
          return MI_CMD_ERROR; */
       error ("mi_cmd_var_create: Usage: NAME FRAME EXPRESSION.");
@@ -64,13 +64,13 @@
   old_cleanups = make_cleanup (free_current_contents, &name);
 
   frame = xstrdup (argv[1]);
-  old_cleanups = make_cleanup (free, frame);
+  old_cleanups = make_cleanup (xfree, frame);
 
   expr = xstrdup (argv[2]);
 
   if (strcmp (name, "-") == 0)
     {
-      free (name);
+      xfree (name);
       name = varobj_gen_name ();
     }
   else if (!isalpha (*name))
@@ -104,7 +104,7 @@
   else
     {
       ui_out_field_string (uiout, "type", type);
-      free (type);
+      xfree (type);
     }
 
   do_cleanups (old_cleanups);
@@ -147,9 +147,9 @@
       if (strcmp (name, "-c") != 0)
 	error ("mi_cmd_var_delete: Invalid option.");
       children_only_p = 1;
-      free (name);
+      xfree (name);
       name = xstrdup (expr);
-      free (expr);
+      xfree (expr);
     }
 
   /* If we didn't error out, now NAME contains the name of the
@@ -289,7 +289,7 @@
       cc++;
     }
   ui_out_list_end (uiout);
-  free (childlist);
+  xfree (childlist);
   return MI_CMD_DONE;
 }
 
@@ -433,7 +433,7 @@
 	  varobj_update_one (*cr);
 	  cr++;
 	}
-      free (rootlist);
+      xfree (rootlist);
       ui_out_list_end (uiout);
     }
   else
@@ -494,7 +494,7 @@
 	  ui_out_field_string (uiout, "type_changed", "false");
 	  cc++;
 	}
-      free (changelist);
+      xfree (changelist);
       return 1;
     }
   return 1;
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index f03d5be..ff8b537 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -253,7 +253,7 @@
 }
 
 void
-_initialize_mi_cmds ()
+_initialize_mi_cmds (void)
 {
   build_table (mi_cmds);
   memset (&stats, 0, sizeof (stats));
diff --git a/gdb/mi/mi-console.c b/gdb/mi/mi-console.c
index 8df51ab..b27d14e 100644
--- a/gdb/mi/mi-console.c
+++ b/gdb/mi/mi-console.c
@@ -66,7 +66,7 @@
   struct mi_console_file *mi_console = ui_file_data (file);
   if (mi_console->magic != &mi_console_file_magic)
     internal_error ("mi_console_file_delete: bad magic number");
-  free (mi_console);
+  xfree (mi_console);
 }
 
 static void
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index b7b5ae3..1472039 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -196,17 +196,18 @@
 #ifdef UI_OUT
   if (!target_executing)
     {
-      asprintf (&mi_error_message, "mi_cmd_exec_interrupt: Inferior not executing.");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_exec_interrupt: Inferior not executing.");
       return MI_CMD_ERROR;
     }
   interrupt_target_command_wrapper (args, from_tty);
   if (last_async_command)
     fputs_unfiltered (last_async_command, raw_stdout);
   fputs_unfiltered ("^done", raw_stdout);
-  free (last_async_command);
+  xfree (last_async_command);
   if (previous_async_command)
     last_async_command = xstrdup (previous_async_command);
-  free (previous_async_command);
+  xfree (previous_async_command);
   previous_async_command = NULL;
   mi_out_put (uiout, raw_stdout);
   mi_out_rewind (uiout);
@@ -222,8 +223,8 @@
 
   if (argc != 1)
     {
-      asprintf (&mi_error_message,
-		"mi_cmd_thread_select: USAGE: threadnum.");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_thread_select: USAGE: threadnum.");
       return MI_CMD_ERROR;
     }
   else
@@ -242,8 +243,8 @@
 
   if (argc != 0)
     {
-      asprintf (&mi_error_message,
-		"mi_cmd_thread_list_ids: No arguments required.");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_thread_list_ids: No arguments required.");
       return MI_CMD_ERROR;
     }
   else
@@ -299,7 +300,7 @@
 	ui_out_field_string (uiout, NULL, REGISTER_NAME (regnum));
       else
 	{
-	  asprintf (&mi_error_message, "bad register number");
+	  xasprintf (&mi_error_message, "bad register number");
 	  return MI_CMD_ERROR;
 	}
     }
@@ -335,8 +336,8 @@
 	  changed = register_changed_p (regnum);
 	  if (changed < 0)
 	    {
-	      asprintf (&mi_error_message,
-			"mi_cmd_data_list_changed_registers: Unable to read register contents.");
+	      xasprintf (&mi_error_message,
+			 "mi_cmd_data_list_changed_registers: Unable to read register contents.");
 	      return MI_CMD_ERROR;
 	    }
 	  else if (changed)
@@ -357,8 +358,8 @@
 	  changed = register_changed_p (regnum);
 	  if (changed < 0)
 	    {
-	      asprintf (&mi_error_message,
-			"mi_cmd_data_list_register_change: Unable to read register contents.");
+	      xasprintf (&mi_error_message,
+			 "mi_cmd_data_list_register_change: Unable to read register contents.");
 	      return MI_CMD_ERROR;
 	    }
 	  else if (changed)
@@ -366,7 +367,7 @@
 	}
       else
 	{
-	  asprintf (&mi_error_message, "bad register number");
+	  xasprintf (&mi_error_message, "bad register number");
 	  return MI_CMD_ERROR;
 	}
     }
@@ -417,8 +418,8 @@
 
   if (argc == 0)
     {
-      asprintf (&mi_error_message,
-		"mi_cmd_data_list_register_values: Usage: -data-list-register-values <format> [<regnum1>...<regnumN>]");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_data_list_register_values: Usage: -data-list-register-values <format> [<regnum1>...<regnumN>]");
       return MI_CMD_ERROR;
     }
 
@@ -426,7 +427,8 @@
 
   if (!target_has_registers)
     {
-      asprintf (&mi_error_message, "mi_cmd_data_list_register_values: No registers.");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_data_list_register_values: No registers.");
       return MI_CMD_ERROR;
     }
 
@@ -469,7 +471,7 @@
 	}
       else
 	{
-	  asprintf (&mi_error_message, "bad register number");
+	  xasprintf (&mi_error_message, "bad register number");
 	  return MI_CMD_ERROR;
 	}
     }
@@ -499,7 +501,7 @@
 		      regnum, (enum lval_type *) NULL);
   if (optim)
     {
-      asprintf (&mi_error_message, "Optimized out");
+      xasprintf (&mi_error_message, "Optimized out");
       return -1;
     }
 
@@ -563,8 +565,8 @@
 
   if (argc == 0)
     {
-      asprintf (&mi_error_message,
-		"mi_cmd_data_write_register_values: Usage: -data-write-register-values <format> [<regnum1> <value1>...<regnumN> <valueN>]");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_data_write_register_values: Usage: -data-write-register-values <format> [<regnum1> <value1>...<regnumN> <valueN>]");
       return MI_CMD_ERROR;
     }
 
@@ -572,19 +574,22 @@
 
   if (!target_has_registers)
     {
-      asprintf (&mi_error_message, "mi_cmd_data_write_register_values: No registers.");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_data_write_register_values: No registers.");
       return MI_CMD_ERROR;
     }
 
   if (!(argc - 1))
     {
-      asprintf (&mi_error_message, "mi_cmd_data_write_register_values: No regs and values specified.");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_data_write_register_values: No regs and values specified.");
       return MI_CMD_ERROR;
     }
 
   if ((argc - 1) % 2)
     {
-      asprintf (&mi_error_message, "mi_cmd_data_write_register_values: Regs and vals are not in pairs.");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_data_write_register_values: Regs and vals are not in pairs.");
       return MI_CMD_ERROR;
     }
 
@@ -608,7 +613,7 @@
 	}
       else
 	{
-	  asprintf (&mi_error_message, "bad register number");
+	  xasprintf (&mi_error_message, "bad register number");
 	  return MI_CMD_ERROR;
 	}
     }
@@ -630,8 +635,8 @@
 
   if (argc != 1)
     {
-      asprintf (&mi_error_message,
-		"mi_cmd_data_assign: Usage: -data-assign expression");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_data_assign: Usage: -data-assign expression");
       return MI_CMD_ERROR;
     }
 
@@ -661,8 +666,8 @@
 
   if (argc != 1)
     {
-      asprintf (&mi_error_message,
-		"mi_cmd_data_evaluate_expression: Usage: -data-evaluate-expression expression");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_data_evaluate_expression: Usage: -data-evaluate-expression expression");
       return MI_CMD_ERROR;
     }
 
@@ -691,10 +696,8 @@
   char *run;
   struct cleanup *old_cleanups = NULL;
 
-  asprintf (&run, "load %s", args);
-  if (run == 0)
-    internal_error ("mi_cmd_target_download: no memory");
-  old_cleanups = make_cleanup (free, run);
+  xasprintf (&run, "load %s", args);
+  old_cleanups = make_cleanup (xfree, run);
   execute_command (run, from_tty);
 
   do_cleanups (old_cleanups);
@@ -708,10 +711,8 @@
   char *run;
   struct cleanup *old_cleanups = NULL;
 
-  asprintf (&run, "target %s", args);
-  if (run == 0)
-    internal_error ("mi_cmd_target_select: no memory");
-  old_cleanups = make_cleanup (free, run);
+  xasprintf (&run, "target %s", args);
+  old_cleanups = make_cleanup (xfree, run);
 
   /* target-select is always synchronous.  once the call has returned
      we know that we are connected. */
@@ -798,8 +799,8 @@
 
   if (argc < 5 || argc > 6)
     {
-      asprintf (&mi_error_message,
-		"mi_cmd_data_read_memory: Usage: ADDR WORD-FORMAT WORD-SIZE NR-ROWS NR-COLS [ASCHAR].");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_data_read_memory: Usage: ADDR WORD-FORMAT WORD-SIZE NR-ROWS NR-COLS [ASCHAR].");
       return MI_CMD_ERROR;
     }
 
@@ -838,16 +839,16 @@
   nr_rows = atol (argv[3]);
   if (nr_rows <= 0)
     {
-      asprintf (&mi_error_message,
-		"mi_cmd_data_read_memory: invalid number of rows.");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_data_read_memory: invalid number of rows.");
       return MI_CMD_ERROR;
     }
   /* number of bytes per row. */
   nr_cols = atol (argv[4]);
   if (nr_cols <= 0)
     {
-      asprintf (&mi_error_message,
-		"mi_cmd_data_read_memory: invalid number of columns.");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_data_read_memory: invalid number of columns.");
     }
   /* The un-printable character when printing ascii. */
   if (argc == 6)
@@ -858,11 +859,11 @@
   /* create a buffer and read it in. */
   total_bytes = word_size * nr_rows * nr_cols;
   mbuf = calloc (total_bytes, 1);
-  make_cleanup (free, mbuf);
+  make_cleanup (xfree, mbuf);
   if (mbuf == NULL)
     {
-      asprintf (&mi_error_message,
-		"mi_cmd_data_read_memory: out of memory.");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_data_read_memory: out of memory.");
       return MI_CMD_ERROR;
     }
   nr_bytes = 0;
@@ -1004,8 +1005,8 @@
 
   if (argc != 4)
     {
-      asprintf (&mi_error_message,
-		"mi_cmd_data_write_memory: Usage: [-o COLUMN_OFFSET] ADDR FORMAT WORD-SIZE VALUE.");
+      xasprintf (&mi_error_message,
+		 "mi_cmd_data_write_memory: Usage: [-o COLUMN_OFFSET] ADDR FORMAT WORD-SIZE VALUE.");
       return MI_CMD_ERROR;
     }
 
@@ -1074,7 +1075,7 @@
 		  fputs_unfiltered (context->token, raw_stdout);
 		  fputs_unfiltered ("^error,msg=\"", raw_stdout);
 		  fputstr_unfiltered (mi_error_message, '"', raw_stdout);
-		  free (mi_error_message);
+		  xfree (mi_error_message);
 		  fputs_unfiltered ("\"\n", raw_stdout);
 		}
 	      mi_out_rewind (uiout);
@@ -1144,7 +1145,7 @@
       if (rc == 0)
 	{
 	  char *msg = error_last_message ();
-	  struct cleanup *cleanup = make_cleanup (free, msg);
+	  struct cleanup *cleanup = make_cleanup (xfree, msg);
 	  /* The command execution failed and error() was called
 	     somewhere */
 	  fputs_unfiltered (command->token, raw_stdout);
@@ -1242,14 +1243,12 @@
     {
       struct cleanup *old_cleanups;
       char *run;
-      asprintf (&run, cli, args);
+      xasprintf (&run, cli, args);
       if (mi_debug_p)
 	/* FIXME: gdb_???? */
 	fprintf_unfiltered (gdb_stdout, "cli=%s run=%s\n",
 			    cli, run);
-      if (run == 0)
-	abort ();
-      old_cleanups = make_cleanup (free, run);
+      old_cleanups = make_cleanup (xfree, run);
       execute_command ( /*ui */ run, 0 /*from_tty */ );
       do_cleanups (old_cleanups);
       return;
@@ -1269,18 +1268,14 @@
       make_exec_cleanup (free, async_args);
       strcpy (async_args, args);
       strcat (async_args, "&");
-      asprintf (&run, "%s %s", mi, async_args);
-      if (run == 0)
-	internal_error ("mi_execute_async_cli_command: no memory");
+      xasprintf (&run, "%s %s", mi, async_args);
       make_exec_cleanup (free, run);
       add_continuation (mi_exec_async_cli_cmd_continuation, NULL);
     }
   else
     {
-      asprintf (&run, "%s %s", mi, args);
-      if (run == 0)
-	internal_error ("mi_execute_async_cli_command: no memory");
-      old_cleanups = make_cleanup (free, run);
+      xasprintf (&run, "%s %s", mi, args);
+      old_cleanups = make_cleanup (xfree, run);
     }
 
   if (!target_can_async_p ())
@@ -1374,7 +1369,7 @@
 		 strcmp (previous_sect_name, section_name) : 1);
   if (new_section)
     {
-      free (previous_sect_name);
+      xfree (previous_sect_name);
       previous_sect_name = xstrdup (section_name);
 
       if (last_async_command)
@@ -1412,7 +1407,7 @@
 }
 
 static void
-mi_command_loop ()
+mi_command_loop (void)
 {
   /* HACK: Force stdout/stderr to point at the console.  This avoids
      any potential side effects caused by legacy code that is still
@@ -1468,7 +1463,7 @@
 }
 
 static void
-setup_architecture_data ()
+setup_architecture_data (void)
 {
   /* don't trust REGISTER_BYTES to be zero. */
   old_regs = xmalloc (REGISTER_BYTES + 1);
@@ -1476,15 +1471,14 @@
 }
 
 static void
-mi_init_ui (arg0)
-     char *arg0;
+mi_init_ui (char *arg0)
 {
   /* Eventually this will contain code that takes control of the
      console. */
 }
 
 void
-_initialize_mi_main ()
+_initialize_mi_main (void)
 {
   /* If we're _the_ interpreter, take control. */
   if (interpreter_p
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c
index 8554a88..e70ba28 100644
--- a/gdb/mi/mi-out.c
+++ b/gdb/mi/mi-out.c
@@ -99,10 +99,7 @@
 /* Mark beginning of a table */
 
 void
-mi_table_begin (uiout, nbrofcols, tblid)
-     struct ui_out *uiout;
-     int nbrofcols;
-     char *tblid;
+mi_table_begin (struct ui_out *uiout, int nbrofcols, char *tblid)
 {
   struct ui_out_data *data = ui_out_data (uiout);
   field_separator (uiout);
@@ -116,8 +113,7 @@
 /* Mark beginning of a table body */
 
 void
-mi_table_body (uiout)
-     struct ui_out *uiout;
+mi_table_body (struct ui_out *uiout)
 {
   struct ui_out_data *data = ui_out_data (uiout);
   /* close the table header line if there were any headers */
@@ -128,8 +124,7 @@
 /* Mark end of a table */
 
 void
-mi_table_end (uiout)
-     struct ui_out *uiout;
+mi_table_end (struct ui_out *uiout)
 {
   struct ui_out_data *data = ui_out_data (uiout);
   list_close (uiout);
@@ -140,11 +135,7 @@
 /* Specify table header */
 
 void
-mi_table_header (uiout, width, alignment, colhdr)
-     struct ui_out *uiout;
-     int width;
-     int alignment;
-     char *colhdr;
+mi_table_header (struct ui_out *uiout, int width, int alignment, char *colhdr)
 {
   struct ui_out_data *data = ui_out_data (uiout);
   if (!data->first_header++)
@@ -158,10 +149,7 @@
 /* Mark beginning of a list */
 
 void
-mi_list_begin (uiout, list_flag, lstid)
-     struct ui_out *uiout;
-     int list_flag;
-     char *lstid;
+mi_list_begin (struct ui_out *uiout, int list_flag, char *lstid)
 {
   struct ui_out_data *data = ui_out_data (uiout);
   field_separator (uiout);
@@ -174,9 +162,7 @@
 /* Mark end of a list */
 
 void
-mi_list_end (uiout, list_flag)
-     struct ui_out *uiout;
-     int list_flag;
+mi_list_end (struct ui_out *uiout, int list_flag)
 {
   struct ui_out_data *data = ui_out_data (uiout);
   list_close (uiout);
@@ -187,13 +173,8 @@
 /* output an int field */
 
 void
-mi_field_int (uiout, fldno, width, alignment, fldname, value)
-     struct ui_out *uiout;
-     int fldno;
-     int width;
-     int alignment;
-     char *fldname;
-     int value;
+mi_field_int (struct ui_out *uiout, int fldno, int width, int alignment,
+	      char *fldname, int value)
 {
   char buffer[20];		/* FIXME: how many chars long a %d can become? */
 
@@ -204,12 +185,8 @@
 /* used to ommit a field */
 
 void
-mi_field_skip (uiout, fldno, width, alignment, fldname)
-     struct ui_out *uiout;
-     int fldno;
-     int width;
-     int alignment;
-     char *fldname;
+mi_field_skip (struct ui_out *uiout, int fldno, int width, int alignment,
+	       char *fldname)
 {
   mi_field_string (uiout, fldno, width, alignment, fldname, "");
 }
@@ -253,16 +230,12 @@
 }
 
 void
-mi_spaces (uiout, numspaces)
-     struct ui_out *uiout;
-     int numspaces;
+mi_spaces (struct ui_out *uiout, int numspaces)
 {
 }
 
 void
-mi_text (uiout, string)
-     struct ui_out *uiout;
-     char *string;
+mi_text (struct ui_out *uiout, char *string)
 {
 }
 
@@ -272,16 +245,13 @@
 }
 
 void
-mi_wrap_hint (uiout, identstring)
-     struct ui_out *uiout;
-     char *identstring;
+mi_wrap_hint (struct ui_out *uiout, char *identstring)
 {
   wrap_here (identstring);
 }
 
 void
-mi_flush (uiout)
-     struct ui_out *uiout;
+mi_flush (struct ui_out *uiout)
 {
   struct ui_out_data *data = ui_out_data (uiout);
   gdb_flush (data->buffer);
@@ -391,7 +361,7 @@
 
 /* standard gdb initialization hook */
 void
-_initialize_mi_out ()
+_initialize_mi_out (void)
 {
   /* nothing happens here */
 }
diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c
index 26c47a8..41e0351 100644
--- a/gdb/mi/mi-parse.c
+++ b/gdb/mi/mi-parse.c
@@ -136,14 +136,14 @@
   if (parse == NULL)
     return;
   if (parse->command != NULL)
-    free (parse->command);
+    xfree (parse->command);
   if (parse->token != NULL)
-    free (parse->token);
+    xfree (parse->token);
   if (parse->args != NULL)
-    free (parse->args);
+    xfree (parse->args);
   if (parse->argv != NULL)
     freeargv (parse->argv);
-  free (parse);
+  xfree (parse);
 }
 
 
@@ -234,6 +234,6 @@
 }
 
 void
-_initialize_mi_parse ()
+_initialize_mi_parse (void)
 {
 }
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index e6978e7..9070b6f 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -151,10 +151,8 @@
    names (the dynamic linker deals with the duplication). */
 
 struct minimal_symbol *
-lookup_minimal_symbol (name, sfile, objf)
-     register const char *name;
-     const char *sfile;
-     struct objfile *objf;
+lookup_minimal_symbol (register const char *name, const char *sfile,
+		       struct objfile *objf)
 {
   struct objfile *objfile;
   struct minimal_symbol *msymbol;
@@ -264,10 +262,8 @@
  */
 
 struct minimal_symbol *
-lookup_minimal_symbol_text (name, sfile, objf)
-     register const char *name;
-     const char *sfile;
-     struct objfile *objf;
+lookup_minimal_symbol_text (register const char *name, const char *sfile,
+			    struct objfile *objf)
 {
   struct objfile *objfile;
   struct minimal_symbol *msymbol;
@@ -341,10 +337,8 @@
  */
 
 struct minimal_symbol *
-lookup_minimal_symbol_solib_trampoline (name, sfile, objf)
-     register const char *name;
-     const char *sfile;
-     struct objfile *objf;
+lookup_minimal_symbol_solib_trampoline (register const char *name,
+					const char *sfile, struct objfile *objf)
 {
   struct objfile *objfile;
   struct minimal_symbol *msymbol;
@@ -392,9 +386,7 @@
    0x40000 and objfile B has .text at 0x234 and .data at 0x40048.  */
 
 struct minimal_symbol *
-lookup_minimal_symbol_by_pc_section (pc, section)
-     CORE_ADDR pc;
-     asection *section;
+lookup_minimal_symbol_by_pc_section (CORE_ADDR pc, asection *section)
 {
   int lo;
   int hi;
@@ -510,18 +502,15 @@
    for a matching PC (no section given) */
 
 struct minimal_symbol *
-lookup_minimal_symbol_by_pc (pc)
-     CORE_ADDR pc;
+lookup_minimal_symbol_by_pc (CORE_ADDR pc)
 {
   return lookup_minimal_symbol_by_pc_section (pc, find_pc_mapped_section (pc));
 }
 
 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
 CORE_ADDR
-find_stab_function_addr (namestring, filename, objfile)
-     char *namestring;
-     char *filename;
-     struct objfile *objfile;
+find_stab_function_addr (char *namestring, char *filename,
+			 struct objfile *objfile)
 {
   struct minimal_symbol *msym;
   char *p;
@@ -571,8 +560,7 @@
 static int get_symbol_leading_char (bfd *);
 
 static int
-get_symbol_leading_char (abfd)
-     bfd *abfd;
+get_symbol_leading_char (bfd *abfd)
 {
   if (abfd != NULL)
     return bfd_get_symbol_leading_char (abfd);
@@ -586,7 +574,7 @@
    symbol to allocate the memory for the first bunch. */
 
 void
-init_minimal_symbol_collection ()
+init_minimal_symbol_collection (void)
 {
   msym_count = 0;
   msym_bunch = NULL;
@@ -594,11 +582,9 @@
 }
 
 void
-prim_record_minimal_symbol (name, address, ms_type, objfile)
-     const char *name;
-     CORE_ADDR address;
-     enum minimal_symbol_type ms_type;
-     struct objfile *objfile;
+prim_record_minimal_symbol (const char *name, CORE_ADDR address,
+			    enum minimal_symbol_type ms_type,
+			    struct objfile *objfile)
 {
   int section;
 
@@ -629,15 +615,11 @@
    newly created.  */
 
 struct minimal_symbol *
-prim_record_minimal_symbol_and_info (name, address, ms_type, info, section,
-				     bfd_section, objfile)
-     const char *name;
-     CORE_ADDR address;
-     enum minimal_symbol_type ms_type;
-     char *info;
-     int section;
-     asection *bfd_section;
-     struct objfile *objfile;
+prim_record_minimal_symbol_and_info (const char *name, CORE_ADDR address,
+				     enum minimal_symbol_type ms_type,
+				     char *info, int section,
+				     asection *bfd_section,
+				     struct objfile *objfile)
 {
   register struct msym_bunch *new;
   register struct minimal_symbol *msymbol;
@@ -698,9 +680,7 @@
    Within groups with the same address, sort by name.  */
 
 static int
-compare_minimal_symbols (fn1p, fn2p)
-     const PTR fn1p;
-     const PTR fn2p;
+compare_minimal_symbols (const PTR fn1p, const PTR fn2p)
 {
   register const struct minimal_symbol *fn1;
   register const struct minimal_symbol *fn2;
@@ -749,7 +729,7 @@
   while (msym_bunch != NULL)
     {
       next = msym_bunch->next;
-      free ((PTR) msym_bunch);
+      xfree (msym_bunch);
       msym_bunch = next;
     }
 }
@@ -799,10 +779,8 @@
    overwrite its type with the type from the one we are compacting out.  */
 
 static int
-compact_minimal_symbols (msymbol, mcount, objfile)
-     struct minimal_symbol *msymbol;
-     int mcount;
-     struct objfile *objfile;
+compact_minimal_symbols (struct minimal_symbol *msymbol, int mcount,
+			 struct objfile *objfile)
 {
   struct minimal_symbol *copyfrom;
   struct minimal_symbol *copyto;
@@ -823,11 +801,7 @@
 	      copyfrom++;
 	    }
 	  else
-	    {
-	      *copyto++ = *copyfrom++;
-
-	      add_minsym_to_hash_table (copyto - 1, objfile->msymbol_hash);
-	    }
+	    *copyto++ = *copyfrom++;
 	}
       *copyto++ = *copyfrom++;
       mcount = copyto - msymbol;
@@ -835,6 +809,38 @@
   return (mcount);
 }
 
+/* Build (or rebuild) the minimal symbol hash tables.  This is necessary
+   after compacting or sorting the table since the entries move around
+   thus causing the internal minimal_symbol pointers to become jumbled. */
+  
+static void
+build_minimal_symbol_hash_tables (struct objfile *objfile)
+{
+  int i;
+  struct minimal_symbol *msym;
+
+  /* Clear the hash tables. */
+  for (i = 0; i < MINIMAL_SYMBOL_HASH_SIZE; i++)
+    {
+      objfile->msymbol_hash[i] = 0;
+      objfile->msymbol_demangled_hash[i] = 0;
+    }
+
+  /* Now, (re)insert the actual entries. */
+  for (i = objfile->minimal_symbol_count, msym = objfile->msymbols;
+       i > 0;
+       i--, msym++)
+    {
+      msym->hash_next = 0;
+      add_minsym_to_hash_table (msym, objfile->msymbol_hash);
+
+      msym->demangled_hash_next = 0;
+      if (SYMBOL_DEMANGLED_NAME (msym) != NULL)
+	add_minsym_to_demangled_hash_table (msym,
+                                            objfile->msymbol_demangled_hash);
+    }
+}
+
 /* Add the minimal symbols in the existing bunches to the objfile's official
    minimal symbol table.  In most cases there is no minimal symbol table yet
    for this objfile, and the existing bunches are used to create one.  Once
@@ -859,8 +865,7 @@
    attempts to demangle them if we later add more minimal symbols. */
 
 void
-install_minimal_symbols (objfile)
-     struct objfile *objfile;
+install_minimal_symbols (struct objfile *objfile)
 {
   register int bindex;
   register int mcount;
@@ -951,23 +956,24 @@
          ones and attempting to cache their C++ demangled names. */
 
       for (; mcount-- > 0; msymbols++)
-	{
-	  SYMBOL_INIT_DEMANGLED_NAME (msymbols, &objfile->symbol_obstack);
-	  if (SYMBOL_DEMANGLED_NAME (msymbols) != NULL)
-          add_minsym_to_demangled_hash_table (msymbols,
-                                              objfile->msymbol_demangled_hash);
-	}
+	SYMBOL_INIT_DEMANGLED_NAME (msymbols, &objfile->symbol_obstack);
+
+      /* Now build the hash tables; we can't do this incrementally
+         at an earlier point since we weren't finished with the obstack
+	 yet.  (And if the msymbol obstack gets moved, all the internal
+	 pointers to other msymbols need to be adjusted.) */
+      build_minimal_symbol_hash_tables (objfile);
     }
 }
 
 /* Sort all the minimal symbols in OBJFILE.  */
 
 void
-msymbols_sort (objfile)
-     struct objfile *objfile;
+msymbols_sort (struct objfile *objfile)
 {
   qsort (objfile->msymbols, objfile->minimal_symbol_count,
 	 sizeof (struct minimal_symbol), compare_minimal_symbols);
+  build_minimal_symbol_hash_tables (objfile);
 }
 
 /* Check if PC is in a shared library trampoline code stub.
@@ -975,8 +981,7 @@
    in a trampoline code stub.  */
 
 struct minimal_symbol *
-lookup_solib_trampoline_symbol_by_pc (pc)
-     CORE_ADDR pc;
+lookup_solib_trampoline_symbol_by_pc (CORE_ADDR pc)
 {
   struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc);
 
@@ -996,8 +1001,7 @@
    a duplicate function in case this matters someday.  */
 
 CORE_ADDR
-find_solib_trampoline_target (pc)
-     CORE_ADDR pc;
+find_solib_trampoline_target (CORE_ADDR pc)
 {
   struct objfile *objfile;
   struct minimal_symbol *msymbol;
diff --git a/gdb/mips-nat.c b/gdb/mips-nat.c
index 5064d05..cf8a31a 100644
--- a/gdb/mips-nat.c
+++ b/gdb/mips-nat.c
@@ -68,8 +68,7 @@
 /* Get all registers from the inferior */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   register unsigned int regaddr;
   char buf[MAX_REGISTER_RAW_SIZE];
@@ -99,8 +98,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   register unsigned int regaddr;
   char buf[80];
@@ -136,12 +134,12 @@
    This routine returns true on success. */
 
 int
-get_longjmp_target (pc)
-     CORE_ADDR *pc;
+get_longjmp_target (CORE_ADDR *pc)
 {
   CORE_ADDR jb_addr;
-  char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
+  char *buf;
 
+  buf = alloca (TARGET_PTR_BIT / TARGET_CHAR_BIT);
   jb_addr = read_register (A0_REGNUM);
 
   if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf,
@@ -167,11 +165,8 @@
  */
 
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR reg_addr;
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+		      CORE_ADDR reg_addr)
 {
   register int regno;
   register unsigned int addr;
@@ -217,9 +212,7 @@
    BLOCKEND is the address of the end of the user structure.  */
 
 CORE_ADDR
-register_addr (regno, blockend)
-     int regno;
-     CORE_ADDR blockend;
+register_addr (int regno, CORE_ADDR blockend)
 {
   CORE_ADDR addr;
 
@@ -245,7 +238,7 @@
 };
 
 void
-_initialize_core_mips ()
+_initialize_core_mips (void)
 {
   add_core_fns (&mips_core_fns);
 }
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 95dc72d..ffaf2ab 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -1,5 +1,8 @@
 /* Target-dependent code for the MIPS architecture, for GDB, the GNU Debugger.
-   Copyright 1988-1999, Free Software Foundation, Inc.
+
+   Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+   1997, 1998, 1999, 2000, Free Software Foundation, Inc.
+
    Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
    and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
 
@@ -38,7 +41,15 @@
 #include "opcode/mips.h"
 #include "elf/mips.h"
 #include "elf-bfd.h"
+#include "symcat.h"
 
+/* The sizes of floating point registers.  */
+
+enum
+{
+  MIPS_FPU_SINGLE_REGSIZE = 4,
+  MIPS_FPU_DOUBLE_REGSIZE = 8
+};
 
 /* All the possible MIPS ABIs. */
 
@@ -62,11 +73,11 @@
    overridden dynamically.  Establish an enum/array for managing
    them. */
 
-static char size_auto[] = "auto";
-static char size_32[] = "32";
-static char size_64[] = "64";
+static const char size_auto[] = "auto";
+static const char size_32[] = "32";
+static const char size_64[] = "64";
 
-static char *size_enums[] = {
+static const char *size_enums[] = {
   size_auto,
   size_32,
   size_64,
@@ -96,6 +107,7 @@
 #define FP_REGISTER_DOUBLE (REGISTER_VIRTUAL_SIZE(FP0_REGNUM) == 8)
 #endif
 
+static int mips_debug = 0;
 
 /* MIPS specific per-architecture information */
 struct gdbarch_tdep
@@ -104,6 +116,7 @@
     int elf_flags;
     /* mips options */
     enum mips_abi mips_abi;
+    const char *mips_abi_string;
     enum mips_fpu_type mips_fpu_type;
     int mips_last_arg_regnum;
     int mips_last_fp_arg_regnum;
@@ -111,6 +124,8 @@
     int mips_fp_register_double;
     int mips_regs_have_home_p;
     int mips_default_stack_argsize;
+    int gdb_target_is_mips64;
+    int default_mask_address_p;
   };
 
 #if GDB_MULTI_ARCH
@@ -143,12 +158,12 @@
 #define MIPS_DEFAULT_SAVED_REGSIZE MIPS_REGSIZE
 #endif
 
-static char *mips_saved_regsize_string = size_auto;
+static const char *mips_saved_regsize_string = size_auto;
 
 #define MIPS_SAVED_REGSIZE (mips_saved_regsize())
 
 static unsigned int
-mips_saved_regsize ()
+mips_saved_regsize (void)
 {
   if (mips_saved_regsize_string == size_auto)
     return MIPS_DEFAULT_SAVED_REGSIZE;
@@ -191,7 +206,7 @@
 
 #define MIPS_STACK_ARGSIZE (mips_stack_argsize ())
 
-static char *mips_stack_argsize_string = size_auto;
+static const char *mips_stack_argsize_string = size_auto;
 
 static unsigned int
 mips_stack_argsize (void)
@@ -204,14 +219,20 @@
     return 4;
 }
 
+#if GDB_MULTI_ARCH
+#undef GDB_TARGET_IS_MIPS64
+#define GDB_TARGET_IS_MIPS64 (gdbarch_tdep (current_gdbarch)->gdb_target_is_mips64 + 0)
+#endif
 
+#if GDB_MULTI_ARCH
+#undef MIPS_DEFAULT_MASK_ADDRESS_P
+#define MIPS_DEFAULT_MASK_ADDRESS_P (gdbarch_tdep (current_gdbarch)->default_mask_address_p)
+#elif !defined (MIPS_DEFAULT_MASK_ADDRESS_P)
+#define MIPS_DEFAULT_MASK_ADDRESS_P (0)
+#endif
 
 #define VM_MIN_ADDRESS (CORE_ADDR)0x400000
 
-#if 0
-static int mips_in_lenient_prologue (CORE_ADDR, CORE_ADDR);
-#endif
-
 int gdb_print_insn_mips (bfd_vma, disassemble_info *);
 
 static void mips_print_register (int, int);
@@ -242,19 +263,19 @@
 
 char *tmp_mips_processor_type;
 
+/* The list of available "set mips " and "show mips " commands */
+
+static struct cmd_list_element *setmipscmdlist = NULL;
+static struct cmd_list_element *showmipscmdlist = NULL;
+
 /* A set of original names, to be used when restoring back to generic
    registers from a specific set.  */
 
 char *mips_generic_reg_names[] = MIPS_REGISTER_NAMES;
 char **mips_processor_reg_names = mips_generic_reg_names;
 
-/* The list of available "set mips " and "show mips " commands */
-static struct cmd_list_element *setmipscmdlist = NULL;
-static struct cmd_list_element *showmipscmdlist = NULL;
-
 char *
-mips_register_name (i)
-     int i;
+mips_register_name (int i)
 {
   return mips_processor_reg_names[i];
 }
@@ -377,8 +398,7 @@
  *linked_proc_desc_table = NULL;
 
 void
-mips_print_extra_frame_info (fi)
-     struct frame_info *fi;
+mips_print_extra_frame_info (struct frame_info *fi)
 {
   if (fi
       && fi->extra_info
@@ -395,8 +415,7 @@
 static int mips64_transfers_32bit_regs_p = 0;
 
 int
-mips_register_raw_size (reg_nr)
-     int reg_nr;
+mips_register_raw_size (int reg_nr)
 {
   if (mips64_transfers_32bit_regs_p)
     return REGISTER_VIRTUAL_SIZE (reg_nr);
@@ -405,8 +424,7 @@
 }
 
 int
-mips_register_convertible (reg_nr)
-     int reg_nr;
+mips_register_convertible (int reg_nr)
 {
   if (mips64_transfers_32bit_regs_p)
     return 0;
@@ -415,11 +433,8 @@
 }
 
 void
-mips_register_convert_to_virtual (n, virtual_type, raw_buf, virt_buf)
-     int n;
-     struct type *virtual_type;
-     char *raw_buf;
-     char *virt_buf;
+mips_register_convert_to_virtual (int n, struct type *virtual_type,
+				  char *raw_buf, char *virt_buf)
 {
   if (TARGET_BYTE_ORDER == BIG_ENDIAN)
     memcpy (virt_buf,
@@ -432,11 +447,8 @@
 }
 
 void
-mips_register_convert_to_raw (virtual_type, n, virt_buf, raw_buf)
-     struct type *virtual_type;
-     int n;
-     char *virt_buf;
-     char *raw_buf;
+mips_register_convert_to_raw (struct type *virtual_type, int n,
+			      char *virt_buf, char *raw_buf)
 {
   memset (raw_buf, 0, REGISTER_RAW_SIZE (n));
   if (TARGET_BYTE_ORDER == BIG_ENDIAN)
@@ -450,13 +462,50 @@
 }
 
 /* Should the upper word of 64-bit addresses be zeroed? */
-static int mask_address_p = 1;
+enum cmd_auto_boolean mask_address_var = CMD_AUTO_BOOLEAN_AUTO;
+
+static int
+mips_mask_address_p (void)
+{
+  switch (mask_address_var)
+    {
+    case CMD_AUTO_BOOLEAN_TRUE:
+      return 1;
+    case CMD_AUTO_BOOLEAN_FALSE:
+      return 0;
+      break;
+    case CMD_AUTO_BOOLEAN_AUTO:
+      return MIPS_DEFAULT_MASK_ADDRESS_P;
+    default:
+      internal_error ("mips_mask_address_p: bad switch");
+      return -1;
+    }      
+}
+
+static void
+show_mask_address (char *cmd, int from_tty)
+{
+  switch (mask_address_var)
+    {
+    case CMD_AUTO_BOOLEAN_TRUE:
+      printf_filtered ("The 32 bit mips address mask is enabled\n");
+      break;
+    case CMD_AUTO_BOOLEAN_FALSE:
+      printf_filtered ("The 32 bit mips address mask is disabled\n");
+      break;
+    case CMD_AUTO_BOOLEAN_AUTO:
+      printf_filtered ("The 32 bit address mask is set automatically.  Currently %s\n",
+		       mips_mask_address_p () ? "enabled" : "disabled");
+      break;
+    default:
+      internal_error ("show_mask_address: bad switch");
+      break;
+    }      
+}
 
 /* Should call_function allocate stack space for a struct return?  */
 int
-mips_use_struct_convention (gcc_p, type)
-     int gcc_p;
-     struct type *type;
+mips_use_struct_convention (int gcc_p, struct type *type)
 {
   if (MIPS_EABI)
     return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
@@ -485,14 +534,21 @@
     return 0;
 }
 
+/* MIPS believes that the PC has a sign extended value.  Perhaphs the
+   all registers should be sign extended for simplicity? */
+
+static CORE_ADDR
+mips_read_pc (int pid)
+{
+  return read_signed_register_pid (PC_REGNUM, pid);
+}
 
 /* This returns the PC of the first inst after the prologue.  If we can't
    find the prologue, then return 0.  */
 
 static CORE_ADDR
-after_prologue (pc, proc_desc)
-     CORE_ADDR pc;
-     mips_extra_func_info_t proc_desc;
+after_prologue (CORE_ADDR pc,
+		mips_extra_func_info_t proc_desc)
 {
   struct symtab_and_line sal;
   CORE_ADDR func_addr, func_end;
@@ -529,10 +585,8 @@
    for mips_find_saved_regs.  */
 
 static void
-mips32_decode_reg_save (inst, gen_mask, float_mask)
-     t_inst inst;
-     unsigned long *gen_mask;
-     unsigned long *float_mask;
+mips32_decode_reg_save (t_inst inst, unsigned long *gen_mask,
+			unsigned long *float_mask)
 {
   int reg;
 
@@ -564,9 +618,7 @@
    for mips_find_saved_regs.  */
 
 static void
-mips16_decode_reg_save (inst, gen_mask)
-     t_inst inst;
-     unsigned long *gen_mask;
+mips16_decode_reg_save (t_inst inst, unsigned long *gen_mask)
 {
   if ((inst & 0xf800) == 0xd000)	/* sw reg,n($sp) */
     {
@@ -588,8 +640,7 @@
    is odd, assume it's a MIPS16 instruction; otherwise MIPS32.  */
 
 static t_inst
-mips_fetch_instruction (addr)
-     CORE_ADDR addr;
+mips_fetch_instruction (CORE_ADDR addr)
 {
   char buf[MIPS_INSTLEN];
   int instlen;
@@ -681,7 +732,8 @@
 	    {
 	    case 8:		/* JR */
 	    case 9:		/* JALR */
-	      pc = read_register (rtype_rs (inst));	/* Set PC to that address */
+	      /* Set PC to that address */
+	      pc = read_signed_register (rtype_rs (inst));
 	      break;
 	    default:
 	      pc += 4;
@@ -698,7 +750,7 @@
 	      case 16:		/* BLTZALL */
 	      case 18:		/* BLTZALL */
 	      less_branch:
-		if (read_register (itype_rs (inst)) < 0)
+		if (read_signed_register (itype_rs (inst)) < 0)
 		  pc += mips32_relative_offset (inst) + 4;
 		else
 		  pc += 8;	/* after the delay slot */
@@ -708,7 +760,7 @@
 	      case 17:		/* BGEZAL */
 	      case 19:		/* BGEZALL */
 	      greater_equal_branch:
-		if (read_register (itype_rs (inst)) >= 0)
+		if (read_signed_register (itype_rs (inst)) >= 0)
 		  pc += mips32_relative_offset (inst) + 4;
 		else
 		  pc += 8;	/* after the delay slot */
@@ -738,30 +790,30 @@
 	  break;		/* The new PC will be alternate mode */
 	case 4:		/* BEQ , BEQL */
 	equal_branch:
-	  if (read_register (itype_rs (inst)) ==
-	      read_register (itype_rt (inst)))
+	  if (read_signed_register (itype_rs (inst)) ==
+	      read_signed_register (itype_rt (inst)))
 	    pc += mips32_relative_offset (inst) + 4;
 	  else
 	    pc += 8;
 	  break;
 	case 5:		/* BNE , BNEL */
 	neq_branch:
-	  if (read_register (itype_rs (inst)) !=
-	      read_register (itype_rs (inst)))
+	  if (read_signed_register (itype_rs (inst)) !=
+	      read_signed_register (itype_rs (inst)))
 	    pc += mips32_relative_offset (inst) + 4;
 	  else
 	    pc += 8;
 	  break;
 	case 6:		/* BLEZ , BLEZL */
 	less_zero_branch:
-	  if (read_register (itype_rs (inst) <= 0))
+	  if (read_signed_register (itype_rs (inst) <= 0))
 	    pc += mips32_relative_offset (inst) + 4;
 	  else
 	    pc += 8;
 	  break;
 	case 7:
 	greater_branch:	/* BGTZ BGTZL */
-	  if (read_register (itype_rs (inst) > 0))
+	  if (read_signed_register (itype_rs (inst) > 0))
 	    pc += mips32_relative_offset (inst) + 4;
 	  else
 	    pc += 8;
@@ -774,7 +826,7 @@
 }				/* mips32_next_pc */
 
 /* Decoding the next place to set a breakpoint is irregular for the
-   mips 16 variant, but fortunatly, there fewer instructions. We have to cope
+   mips 16 variant, but fortunately, there fewer instructions. We have to cope
    ith extensions for 16 bit instructions and a pair of actual 32 bit instructions.
    We dont want to set a single step instruction on the extend instruction
    either.
@@ -809,34 +861,23 @@
   extRi64type,			/* 20  5,6,5,5,3,3,5 */
   extshift64type		/* 21  5,5,1,1,1,1,1,1,5,1,1,1,3,5 */
 };
-/* I am heaping all the fields of the formats into one structure and then,
-   only the fields which are involved in instruction extension */
+/* I am heaping all the fields of the formats into one structure and
+   then, only the fields which are involved in instruction extension */
 struct upk_mips16
   {
-    unsigned short inst;
-    enum mips16_inst_fmts fmt;
-    unsigned long offset;
+    CORE_ADDR offset;
     unsigned int regx;		/* Function in i8 type */
     unsigned int regy;
   };
 
 
+/* The EXT-I, EXT-ri nad EXT-I8 instructions all have the same format
+   for the bits which make up the immediatate extension.  */
 
-static void
-print_unpack (char *comment,
-	      struct upk_mips16 *u)
+static CORE_ADDR
+extended_offset (unsigned int extension)
 {
-  printf ("%s %04x ,f(%d) off(%s) (x(%x) y(%x)\n",
-	  comment, u->inst, u->fmt, paddr (u->offset), u->regx, u->regy);
-}
-
-/* The EXT-I, EXT-ri nad EXT-I8 instructions all have the same
-   format for the bits which make up the immediatate extension.
- */
-static unsigned long
-extended_offset (unsigned long extension)
-{
-  unsigned long value;
+  CORE_ADDR value;
   value = (extension >> 21) & 0x3f;	/* * extract 15:11 */
   value = value << 6;
   value |= (extension >> 16) & 0x1f;	/* extrace 10:5 */
@@ -854,7 +895,7 @@
    when the offset is to be used in relative addressing */
 
 
-static unsigned short
+static unsigned int
 fetch_mips_16 (CORE_ADDR pc)
 {
   char buf[8];
@@ -865,36 +906,33 @@
 
 static void
 unpack_mips16 (CORE_ADDR pc,
+	       unsigned int extension,
+	       unsigned int inst,
+	       enum mips16_inst_fmts insn_format,
 	       struct upk_mips16 *upk)
 {
-  CORE_ADDR extpc;
-  unsigned long extension;
-  int extended;
-  extpc = (pc - 4) & ~0x01;	/* Extensions are 32 bit instructions */
-  /* Decrement to previous address and loose the 16bit mode flag */
-  /* return if the instruction was extendable, but not actually extended */
-  extended = ((mips32_op (extension) == 30) ? 1 : 0);
-  if (extended)
-    {
-      extension = mips_fetch_instruction (extpc);
-    }
-  switch (upk->fmt)
+  CORE_ADDR offset;
+  int regx;
+  int regy;
+  switch (insn_format)
     {
     case itype:
       {
-	unsigned long value;
-	if (extended)
+	CORE_ADDR value;
+	if (extension)
 	  {
 	    value = extended_offset (extension);
 	    value = value << 11;	/* rom for the original value */
-	    value |= upk->inst & 0x7ff;		/* eleven bits from instruction */
+	    value |= inst & 0x7ff;		/* eleven bits from instruction */
 	  }
 	else
 	  {
-	    value = upk->inst & 0x7ff;
+	    value = inst & 0x7ff;
 	    /* FIXME : Consider sign extension */
 	  }
-	upk->offset = value;
+	offset = value;
+	regx = -1;
+	regy = -1;
       }
       break;
     case ritype:
@@ -902,13 +940,13 @@
       {				/* A register identifier and an offset */
 	/* Most of the fields are the same as I type but the
 	   immediate value is of a different length */
-	unsigned long value;
-	if (extended)
+	CORE_ADDR value;
+	if (extension)
 	  {
 	    value = extended_offset (extension);
 	    value = value << 8;	/* from the original instruction */
-	    value |= upk->inst & 0xff;	/* eleven bits from instruction */
-	    upk->regx = (extension >> 8) & 0x07;	/* or i8 funct */
+	    value |= inst & 0xff;	/* eleven bits from instruction */
+	    regx = (extension >> 8) & 0x07;	/* or i8 funct */
 	    if (value & 0x4000)	/* test the sign bit , bit 26 */
 	      {
 		value &= ~0x3fff;	/* remove the sign bit */
@@ -917,48 +955,41 @@
 	  }
 	else
 	  {
-	    value = upk->inst & 0xff;	/* 8 bits */
-	    upk->regx = (upk->inst >> 8) & 0x07;	/* or i8 funct */
+	    value = inst & 0xff;	/* 8 bits */
+	    regx = (inst >> 8) & 0x07;	/* or i8 funct */
 	    /* FIXME: Do sign extension , this format needs it */
 	    if (value & 0x80)	/* THIS CONFUSES ME */
 	      {
 		value &= 0xef;	/* remove the sign bit */
 		value = -value;
 	      }
-
 	  }
-	upk->offset = value;
+	offset = value;
+	regy = -1;
 	break;
       }
     case jalxtype:
       {
 	unsigned long value;
-	unsigned short nexthalf;
-	value = ((upk->inst & 0x1f) << 5) | ((upk->inst >> 5) & 0x1f);
+	unsigned int nexthalf;
+	value = ((inst & 0x1f) << 5) | ((inst >> 5) & 0x1f);
 	value = value << 16;
 	nexthalf = mips_fetch_instruction (pc + 2);	/* low bit still set */
 	value |= nexthalf;
-	upk->offset = value;
+	offset = value;
+	regx = -1;
+	regy = -1;
 	break;
       }
     default:
-      printf_filtered ("Decoding unimplemented instruction format type\n");
-      break;
+      internal_error ("%s:%d: bad switch", __FILE__, __LINE__);
     }
-  /* print_unpack("UPK",upk) ; */
+  upk->offset = offset;
+  upk->regx = regx;
+  upk->regy = regy;
 }
 
 
-#define mips16_op(x) (x >> 11)
-
-/* This is a map of the opcodes which ae known to perform branches */
-static unsigned char map16[32] =
-{0, 0, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0
-};
-
 static CORE_ADDR
 add_offset_16 (CORE_ADDR pc, int offset)
 {
@@ -966,144 +997,153 @@
 
 }
 
-
-
-static struct upk_mips16 upk;
+static CORE_ADDR
+extended_mips16_next_pc (CORE_ADDR pc,
+			 unsigned int extension,
+			 unsigned int insn)
+{
+  int op = (insn >> 11);
+  switch (op)
+    {
+    case 2:		/* Branch */
+      {
+	CORE_ADDR offset;
+	struct upk_mips16 upk;
+	unpack_mips16 (pc, extension, insn, itype, &upk);
+	offset = upk.offset;
+	if (offset & 0x800)
+	  {
+	    offset &= 0xeff;
+	    offset = -offset;
+	  }
+	pc += (offset << 1) + 2;
+	break;
+      }
+    case 3:		/* JAL , JALX - Watch out, these are 32 bit instruction */
+      {
+	struct upk_mips16 upk;
+	unpack_mips16 (pc, extension, insn, jalxtype, &upk);
+	pc = add_offset_16 (pc, upk.offset);
+	if ((insn >> 10) & 0x01)	/* Exchange mode */
+	  pc = pc & ~0x01;	/* Clear low bit, indicate 32 bit mode */
+	else
+	  pc |= 0x01;
+	break;
+      }
+    case 4:		/* beqz */
+      {
+	struct upk_mips16 upk;
+	int reg;
+	unpack_mips16 (pc, extension, insn, ritype, &upk);
+	reg = read_signed_register (upk.regx);
+	if (reg == 0)
+	  pc += (upk.offset << 1) + 2;
+	else
+	  pc += 2;
+	break;
+      }
+    case 5:		/* bnez */
+      {
+	struct upk_mips16 upk;
+	int reg;
+	unpack_mips16 (pc, extension, insn, ritype, &upk);
+	reg = read_signed_register (upk.regx);
+	if (reg != 0)
+	  pc += (upk.offset << 1) + 2;
+	else
+	  pc += 2;
+	break;
+      }
+    case 12:		/* I8 Formats btez btnez */
+      {
+	struct upk_mips16 upk;
+	int reg;
+	unpack_mips16 (pc, extension, insn, i8type, &upk);
+	/* upk.regx contains the opcode */
+	reg = read_signed_register (24);	/* Test register is 24 */
+	if (((upk.regx == 0) && (reg == 0))	/* BTEZ */
+	    || ((upk.regx == 1) && (reg != 0)))	/* BTNEZ */
+	  /* pc = add_offset_16(pc,upk.offset) ; */
+	  pc += (upk.offset << 1) + 2;
+	else
+	  pc += 2;
+	break;
+      }
+    case 29:		/* RR Formats JR, JALR, JALR-RA */
+      {
+	struct upk_mips16 upk;
+	/* upk.fmt = rrtype; */
+	op = insn & 0x1f;
+	if (op == 0)
+	  {
+	    int reg;
+	    upk.regx = (insn >> 8) & 0x07;
+	    upk.regy = (insn >> 5) & 0x07;
+	    switch (upk.regy)
+	      {
+	      case 0:
+		reg = upk.regx;
+		break;
+	      case 1:
+		reg = 31;
+		break;	/* Function return instruction */
+	      case 2:
+		reg = upk.regx;
+		break;
+	      default:
+		reg = 31;
+		break;	/* BOGUS Guess */
+	      }
+	    pc = read_signed_register (reg);
+	  }
+	else
+	  pc += 2;
+	break;
+      }
+    case 30:
+      /* This is an instruction extension.  Fetch the real instruction
+         (which follows the extension) and decode things based on
+         that. */
+      {
+	pc += 2;
+	pc = extended_mips16_next_pc (pc, insn, fetch_mips_16 (pc));
+	break;
+      }
+    default:
+      {
+	pc += 2;
+	break;
+      }
+    }
+  return pc;
+}
 
 CORE_ADDR
 mips16_next_pc (CORE_ADDR pc)
 {
-  int op;
-  t_inst inst;
-  /* inst = mips_fetch_instruction(pc) ; - This doesnt always work */
-  inst = fetch_mips_16 (pc);
-  upk.inst = inst;
-  op = mips16_op (upk.inst);
-  if (map16[op])
-    {
-      int reg;
-      switch (op)
-	{
-	case 2:		/* Branch */
-	  upk.fmt = itype;
-	  unpack_mips16 (pc, &upk);
-	  {
-	    long offset;
-	    offset = upk.offset;
-	    if (offset & 0x800)
-	      {
-		offset &= 0xeff;
-		offset = -offset;
-	      }
-	    pc += (offset << 1) + 2;
-	  }
-	  break;
-	case 3:		/* JAL , JALX - Watch out, these are 32 bit instruction */
-	  upk.fmt = jalxtype;
-	  unpack_mips16 (pc, &upk);
-	  pc = add_offset_16 (pc, upk.offset);
-	  if ((upk.inst >> 10) & 0x01)	/* Exchange mode */
-	    pc = pc & ~0x01;	/* Clear low bit, indicate 32 bit mode */
-	  else
-	    pc |= 0x01;
-	  break;
-	case 4:		/* beqz */
-	  upk.fmt = ritype;
-	  unpack_mips16 (pc, &upk);
-	  reg = read_register (upk.regx);
-	  if (reg == 0)
-	    pc += (upk.offset << 1) + 2;
-	  else
-	    pc += 2;
-	  break;
-	case 5:		/* bnez */
-	  upk.fmt = ritype;
-	  unpack_mips16 (pc, &upk);
-	  reg = read_register (upk.regx);
-	  if (reg != 0)
-	    pc += (upk.offset << 1) + 2;
-	  else
-	    pc += 2;
-	  break;
-	case 12:		/* I8 Formats btez btnez */
-	  upk.fmt = i8type;
-	  unpack_mips16 (pc, &upk);
-	  /* upk.regx contains the opcode */
-	  reg = read_register (24);	/* Test register is 24 */
-	  if (((upk.regx == 0) && (reg == 0))	/* BTEZ */
-	      || ((upk.regx == 1) && (reg != 0)))	/* BTNEZ */
-	    /* pc = add_offset_16(pc,upk.offset) ; */
-	    pc += (upk.offset << 1) + 2;
-	  else
-	    pc += 2;
-	  break;
-	case 29:		/* RR Formats JR, JALR, JALR-RA */
-	  upk.fmt = rrtype;
-	  op = upk.inst & 0x1f;
-	  if (op == 0)
-	    {
-	      upk.regx = (upk.inst >> 8) & 0x07;
-	      upk.regy = (upk.inst >> 5) & 0x07;
-	      switch (upk.regy)
-		{
-		case 0:
-		  reg = upk.regx;
-		  break;
-		case 1:
-		  reg = 31;
-		  break;	/* Function return instruction */
-		case 2:
-		  reg = upk.regx;
-		  break;
-		default:
-		  reg = 31;
-		  break;	/* BOGUS Guess */
-		}
-	      pc = read_register (reg);
-	    }
-	  else
-	    pc += 2;
-	  break;
-	case 30:		/* This is an extend instruction */
-	  pc += 4;		/* Dont be setting breakpints on the second half */
-	  break;
-	default:
-	  printf ("Filtered - next PC probably incorrrect due to jump inst\n");
-	  pc += 2;
-	  break;
-	}
-    }
-  else
-    pc += 2;			/* just a good old instruction */
-  /* See if we CAN actually break on the next instruction */
-  /* printf("NXTm16PC %08x\n",(unsigned long)pc) ; */
-  return pc;
-}				/* mips16_next_pc */
+  unsigned int insn = fetch_mips_16 (pc);
+  return extended_mips16_next_pc (pc, 0, insn);
+}
 
-/* The mips_next_pc function supports single_tep when the remote target monitor or
-   stub is not developed enough to so a single_step.
-   It works by decoding the current instruction and predicting where a branch
-   will go. This isnt hard because all the data is available.
-   The MIPS32 and MIPS16 variants are quite different
- */
+/* The mips_next_pc function supports single_step when the remote
+   target monitor or stub is not developed enough to do a single_step.
+   It works by decoding the current instruction and predicting where a
+   branch will go. This isnt hard because all the data is available.
+   The MIPS32 and MIPS16 variants are quite different */
 CORE_ADDR
 mips_next_pc (CORE_ADDR pc)
 {
-  t_inst inst;
-  /* inst = mips_fetch_instruction(pc) ; */
-  /* if (pc_is_mips16) <----- This is failing */
   if (pc & 0x01)
     return mips16_next_pc (pc);
   else
     return mips32_next_pc (pc);
-}				/* mips_next_pc */
+}
 
 /* Guaranteed to set fci->saved_regs to some values (it never leaves it
    NULL).  */
 
 void
-mips_find_saved_regs (fci)
-     struct frame_info *fci;
+mips_find_saved_regs (struct frame_info *fci)
 {
   int ireg;
   CORE_ADDR reg_position;
@@ -1270,9 +1310,7 @@
 }
 
 static CORE_ADDR
-read_next_frame_reg (fi, regno)
-     struct frame_info *fi;
-     int regno;
+read_next_frame_reg (struct frame_info *fi, int regno)
 {
   for (; fi; fi = fi->next)
     {
@@ -1288,47 +1326,52 @@
 	    return read_memory_integer (ADDR_BITS_REMOVE (fi->saved_regs[regno]), MIPS_SAVED_REGSIZE);
 	}
     }
-  return read_register (regno);
+  return read_signed_register (regno);
 }
 
 /* mips_addr_bits_remove - remove useless address bits  */
 
 CORE_ADDR
-mips_addr_bits_remove (addr)
-     CORE_ADDR addr;
+mips_addr_bits_remove (CORE_ADDR addr)
 {
-#if GDB_TARGET_IS_MIPS64
-  if (mask_address_p && (addr >> 32 == (CORE_ADDR) 0xffffffff))
+  if (GDB_TARGET_IS_MIPS64)
     {
-      /* This hack is a work-around for existing boards using PMON,
-         the simulator, and any other 64-bit targets that doesn't have
-         true 64-bit addressing.  On these targets, the upper 32 bits
-         of addresses are ignored by the hardware.  Thus, the PC or SP
-         are likely to have been sign extended to all 1s by instruction
-         sequences that load 32-bit addresses.  For example, a typical
-         piece of code that loads an address is this:
-         lui $r2, <upper 16 bits>
-         ori $r2, <lower 16 bits>
-         But the lui sign-extends the value such that the upper 32 bits
-         may be all 1s.  The workaround is simply to mask off these bits.
-         In the future, gcc may be changed to support true 64-bit
-         addressing, and this masking will have to be disabled.  */
+      if (mips_mask_address_p () && (addr >> 32 == (CORE_ADDR) 0xffffffff))
+	{
+	  /* This hack is a work-around for existing boards using
+	     PMON, the simulator, and any other 64-bit targets that
+	     doesn't have true 64-bit addressing.  On these targets,
+	     the upper 32 bits of addresses are ignored by the
+	     hardware.  Thus, the PC or SP are likely to have been
+	     sign extended to all 1s by instruction sequences that
+	     load 32-bit addresses.  For example, a typical piece of
+	     code that loads an address is this:
+	         lui $r2, <upper 16 bits>
+	         ori $r2, <lower 16 bits>
+	     But the lui sign-extends the value such that the upper 32
+	     bits may be all 1s.  The workaround is simply to mask off
+	     these bits.  In the future, gcc may be changed to support
+	     true 64-bit addressing, and this masking will have to be
+	     disabled.  */
+	  addr &= (CORE_ADDR) 0xffffffff;
+	}
+    }
+  else if (mips_mask_address_p ())
+    {
+      /* FIXME: This is wrong!  mips_addr_bits_remove() shouldn't be
+         masking off bits, instead, the actual target should be asking
+         for the address to be converted to a valid pointer. */
+      /* Even when GDB is configured for some 32-bit targets
+	 (e.g. mips-elf), BFD is configured to handle 64-bit targets,
+	 so CORE_ADDR is 64 bits.  So we still have to mask off
+	 useless bits from addresses.  */
       addr &= (CORE_ADDR) 0xffffffff;
     }
-#else
-  /* Even when GDB is configured for some 32-bit targets (e.g. mips-elf),
-     BFD is configured to handle 64-bit targets, so CORE_ADDR is 64 bits.
-     So we still have to mask off useless bits from addresses.  */
-  addr &= (CORE_ADDR) 0xffffffff;
-#endif
-
   return addr;
 }
 
 void
-mips_init_frame_pc_first (fromleaf, prev)
-     int fromleaf;
-     struct frame_info *prev;
+mips_init_frame_pc_first (int fromleaf, struct frame_info *prev)
 {
   CORE_ADDR pc, tmp;
 
@@ -1340,8 +1383,7 @@
 
 
 CORE_ADDR
-mips_frame_saved_pc (frame)
-     struct frame_info *frame;
+mips_frame_saved_pc (struct frame_info *frame)
 {
   CORE_ADDR saved_pc;
   mips_extra_func_info_t proc_desc = frame->extra_info->proc_desc;
@@ -1367,9 +1409,7 @@
    This is a helper function for mips{16,32}_heuristic_proc_desc.  */
 
 static void
-set_reg_offset (regno, offset)
-     int regno;
-     CORE_ADDR offset;
+set_reg_offset (int regno, CORE_ADDR offset)
 {
   if (temp_saved_regs[regno] == 0)
     temp_saved_regs[regno] = offset;
@@ -1380,8 +1420,7 @@
    end of a function. */
 
 static int
-mips_about_to_return (pc)
-     CORE_ADDR pc;
+mips_about_to_return (CORE_ADDR pc)
 {
   if (pc_is_mips16 (pc))
     /* This mips16 case isn't necessarily reliable.  Sometimes the compiler
@@ -1401,8 +1440,7 @@
    lines.  */
 
 static CORE_ADDR
-heuristic_proc_start (pc)
-     CORE_ADDR pc;
+heuristic_proc_start (CORE_ADDR pc)
 {
   CORE_ADDR start_pc;
   CORE_ADDR fence;
@@ -1490,11 +1528,6 @@
 	break;
       }
 
-#if 0
-  /* skip nops (usually 1) 0 - is this */
-  while (start_pc < pc && read_memory_integer (start_pc, MIPS_INSTLEN) == 0)
-    start_pc += MIPS_INSTLEN;
-#endif
   return start_pc;
 }
 
@@ -1504,12 +1537,11 @@
    for mips16_heuristic_proc_desc.  */
 
 static int
-mips16_get_imm (prev_inst, inst, nbits, scale, is_signed)
-     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? */
+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;
 
@@ -1538,10 +1570,8 @@
    stream from start_pc to limit_pc.  */
 
 static void
-mips16_heuristic_proc_desc (start_pc, limit_pc, next_frame, sp)
-     CORE_ADDR start_pc, limit_pc;
-     struct frame_info *next_frame;
-     CORE_ADDR sp;
+mips16_heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
+			    struct frame_info *next_frame, CORE_ADDR sp)
 {
   CORE_ADDR cur_pc;
   CORE_ADDR frame_addr = 0;	/* Value of $r17, used as frame pointer */
@@ -1677,10 +1707,8 @@
 }
 
 static void
-mips32_heuristic_proc_desc (start_pc, limit_pc, next_frame, sp)
-     CORE_ADDR start_pc, limit_pc;
-     struct frame_info *next_frame;
-     CORE_ADDR sp;
+mips32_heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
+			    struct frame_info *next_frame, CORE_ADDR sp)
 {
   CORE_ADDR cur_pc;
   CORE_ADDR frame_addr = 0;	/* Value of $r30. Used by gcc for frame-pointer */
@@ -1780,9 +1808,8 @@
 }
 
 static mips_extra_func_info_t
-heuristic_proc_desc (start_pc, limit_pc, next_frame)
-     CORE_ADDR start_pc, limit_pc;
-     struct frame_info *next_frame;
+heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
+		     struct frame_info *next_frame)
 {
   CORE_ADDR sp = read_next_frame_reg (next_frame, SP_REGNUM);
 
@@ -1804,9 +1831,7 @@
 }
 
 static mips_extra_func_info_t
-non_heuristic_proc_desc (pc, addrptr)
-     CORE_ADDR pc;
-     CORE_ADDR *addrptr;
+non_heuristic_proc_desc (CORE_ADDR pc, CORE_ADDR *addrptr)
 {
   CORE_ADDR startaddr;
   mips_extra_func_info_t proc_desc;
@@ -1845,9 +1870,7 @@
 
 
 static mips_extra_func_info_t
-find_proc_desc (pc, next_frame)
-     CORE_ADDR pc;
-     struct frame_info *next_frame;
+find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame)
 {
   mips_extra_func_info_t proc_desc;
   CORE_ADDR startaddr;
@@ -1909,9 +1932,8 @@
 }
 
 static CORE_ADDR
-get_frame_pointer (frame, proc_desc)
-     struct frame_info *frame;
-     mips_extra_func_info_t proc_desc;
+get_frame_pointer (struct frame_info *frame,
+		   mips_extra_func_info_t proc_desc)
 {
   return ADDR_BITS_REMOVE (
 		   read_next_frame_reg (frame, PROC_FRAME_REG (proc_desc)) +
@@ -1921,8 +1943,7 @@
 mips_extra_func_info_t cached_proc_desc;
 
 CORE_ADDR
-mips_frame_chain (frame)
-     struct frame_info *frame;
+mips_frame_chain (struct frame_info *frame)
 {
   mips_extra_func_info_t proc_desc;
   CORE_ADDR tmp;
@@ -1957,9 +1978,7 @@
 }
 
 void
-mips_init_extra_frame_info (fromleaf, fci)
-     int fromleaf;
-     struct frame_info *fci;
+mips_init_extra_frame_info (int fromleaf, struct frame_info *fci)
 {
   int regnum;
 
@@ -2033,9 +2052,7 @@
    arguments without difficulty.  */
 
 struct frame_info *
-setup_arbitrary_frame (argc, argv)
-     int argc;
-     CORE_ADDR *argv;
+setup_arbitrary_frame (int argc, CORE_ADDR *argv)
 {
   if (argc != 2)
     error ("MIPS frame specifications require two arguments: sp and pc");
@@ -2043,13 +2060,29 @@
   return create_new_frame (argv[0], argv[1]);
 }
 
+/* According to the current ABI, should the type be passed in a
+   floating-point register (assuming that there is space)?  When there
+   is no FPU, FP are not even considered as possibile candidates for
+   FP registers and, consequently this returns false - forces FP
+   arguments into integer registers. */
+
+static int
+fp_register_arg_p (enum type_code typecode, struct type *arg_type)
+{
+  return ((typecode == TYPE_CODE_FLT
+	   || (MIPS_EABI
+	       && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)
+	       && TYPE_NFIELDS (arg_type) == 1
+	       && TYPE_CODE (TYPE_FIELD_TYPE (arg_type, 0)) == TYPE_CODE_FLT))
+	   && MIPS_FPU_TYPE != MIPS_FPU_NONE);
+}
+
 CORE_ADDR
-mips_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     int struct_return;
-     CORE_ADDR struct_addr;
+mips_push_arguments (int nargs,
+		     value_ptr *args,
+		     CORE_ADDR sp,
+		     int struct_return,
+		     CORE_ADDR struct_addr)
 {
   int argreg;
   int float_argreg;
@@ -2068,22 +2101,34 @@
      On at least one MIPS variant, stack frames need to be 128-bit
      aligned, so we round to this widest known alignment. */
   sp = ROUND_DOWN (sp, 16);
-  struct_addr = ROUND_DOWN (struct_addr, MIPS_SAVED_REGSIZE);
+  struct_addr = ROUND_DOWN (struct_addr, 16);
 
   /* Now make space on the stack for the args. We allocate more
      than necessary for EABI, because the first few arguments are
      passed in registers, but that's OK. */
   for (argnum = 0; argnum < nargs; argnum++)
-    len += ROUND_UP (TYPE_LENGTH (VALUE_TYPE (args[argnum])), MIPS_SAVED_REGSIZE);
+    len += ROUND_UP (TYPE_LENGTH (VALUE_TYPE (args[argnum])), MIPS_STACK_ARGSIZE);
   sp -= ROUND_UP (len, 16);
 
+  if (mips_debug)
+    fprintf_unfiltered (gdb_stdlog, "mips_push_arguments: sp=0x%lx allocated %d\n",
+			(long) sp, ROUND_UP (len, 16));
+
   /* Initialize the integer and float register pointers.  */
   argreg = A0_REGNUM;
   float_argreg = FPA0_REGNUM;
 
   /* the struct_return pointer occupies the first parameter-passing reg */
   if (struct_return)
-    write_register (argreg++, struct_addr);
+    {
+      if (mips_debug)
+	fprintf_unfiltered (gdb_stdlog,
+			    "mips_push_arguments: struct_return reg=%d 0x%lx\n",
+			    argreg, (long) struct_addr);
+      write_register (argreg++, struct_addr);
+      if (MIPS_REGS_HAVE_HOME_P)
+	stack_offset += MIPS_STACK_ARGSIZE;
+    }
 
   /* Now load as many as possible of the first arguments into
      registers, and push the rest onto the stack.  Loop thru args
@@ -2097,24 +2142,38 @@
       int len = TYPE_LENGTH (arg_type);
       enum type_code typecode = TYPE_CODE (arg_type);
 
+      if (mips_debug)
+	fprintf_unfiltered (gdb_stdlog,
+			    "mips_push_arguments: %d len=%d type=%d",
+			    argnum + 1, len, (int) typecode);
+
       /* The EABI passes structures that do not fit in a register by
          reference. In all other cases, pass the structure by value.  */
-      if (MIPS_EABI && len > MIPS_SAVED_REGSIZE &&
-	  (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION))
+      if (MIPS_EABI
+	  && len > MIPS_SAVED_REGSIZE
+	  && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION))
 	{
 	  store_address (valbuf, MIPS_SAVED_REGSIZE, VALUE_ADDRESS (arg));
 	  typecode = TYPE_CODE_PTR;
 	  len = MIPS_SAVED_REGSIZE;
 	  val = valbuf;
+	  if (mips_debug)
+	    fprintf_unfiltered (gdb_stdlog, " push");
 	}
       else
 	val = (char *) VALUE_CONTENTS (arg);
 
       /* 32-bit ABIs always start floating point arguments in an
-         even-numbered floating point register.   */
-      if (!FP_REGISTER_DOUBLE && typecode == TYPE_CODE_FLT
-	  && (float_argreg & 1))
-	float_argreg++;
+         even-numbered floating point register.  Round the FP register
+         up before the check to see if there are any FP registers
+         left. Non MIPS_EABI targets also pass the FP in the integer
+         registers so also round up normal registers. */
+      if (!FP_REGISTER_DOUBLE
+	  && fp_register_arg_p (typecode, arg_type))
+	{
+	  if ((float_argreg & 1))
+	    float_argreg++;
+	}
 
       /* Floating point arguments passed in registers have to be
          treated specially.  On 32-bit architectures, doubles
@@ -2125,9 +2184,11 @@
          don't use float registers for arguments.  This duplication of
          arguments in general registers can't hurt non-MIPS16 functions
          because those registers are normally skipped.  */
-      if (typecode == TYPE_CODE_FLT
-	  && float_argreg <= MIPS_LAST_FP_ARG_REGNUM
-	  && MIPS_FPU_TYPE != MIPS_FPU_NONE)
+      /* MIPS_EABI squeeses a struct that contains a single floating
+         point value into an FP register instead of pusing it onto the
+         stack. */
+      if (fp_register_arg_p (typecode, arg_type)
+	  && float_argreg <= MIPS_LAST_FP_ARG_REGNUM)
 	{
 	  if (!FP_REGISTER_DOUBLE && len == 8)
 	    {
@@ -2136,17 +2197,30 @@
 
 	      /* Write the low word of the double to the even register(s).  */
 	      regval = extract_unsigned_integer (val + low_offset, 4);
-	      write_register (float_argreg++, regval);
-	      if (!MIPS_EABI)
-		write_register (argreg + 1, regval);
-
-	      /* Write the high word of the double to the odd register(s).  */
-	      regval = extract_unsigned_integer (val + 4 - low_offset, 4);
+	      if (mips_debug)
+		fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
+				    float_argreg, phex (regval, 4));
 	      write_register (float_argreg++, regval);
 	      if (!MIPS_EABI)
 		{
-		  write_register (argreg, regval);
-		  argreg += 2;
+		  if (mips_debug)
+		    fprintf_unfiltered (gdb_stdlog, " - reg=%d val=%s",
+					argreg, phex (regval, 4));
+		  write_register (argreg++, regval);
+		}
+
+	      /* Write the high word of the double to the odd register(s).  */
+	      regval = extract_unsigned_integer (val + 4 - low_offset, 4);
+	      if (mips_debug)
+		fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
+				    float_argreg, phex (regval, 4));
+	      write_register (float_argreg++, regval);
+	      if (!MIPS_EABI)
+		{
+		  if (mips_debug)
+		    fprintf_unfiltered (gdb_stdlog, " - reg=%d val=%s",
+					argreg, phex (regval, 4));
+		  write_register (argreg++, regval);
 		}
 
 	    }
@@ -2156,7 +2230,10 @@
 	         in a single register.  */
 	      /* On 32 bit ABI's the float_argreg is further adjusted
                  above to ensure that it is even register aligned. */
-	      CORE_ADDR regval = extract_address (val, len);
+	      LONGEST regval = extract_unsigned_integer (val, len);
+	      if (mips_debug)
+		fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
+				    float_argreg, phex (regval, len));
 	      write_register (float_argreg++, regval);
 	      if (!MIPS_EABI)
 		{
@@ -2164,10 +2241,16 @@
                      registers for each argument.  The below is (my
                      guess) to ensure that the corresponding integer
                      register has reserved the same space. */
+		  if (mips_debug)
+		    fprintf_unfiltered (gdb_stdlog, " - reg=%d val=%s",
+					argreg, phex (regval, len));
 		  write_register (argreg, regval);
 		  argreg += FP_REGISTER_DOUBLE ? 1 : 2;
 		}
 	    }
+	  /* Reserve space for the FP register. */
+	  if (MIPS_REGS_HAVE_HOME_P)
+	    stack_offset += ROUND_UP (len, MIPS_STACK_ARGSIZE);
 	}
       else
 	{
@@ -2178,20 +2261,30 @@
 	     are treated specially: Irix cc passes them in registers
 	     where gcc sometimes puts them on the stack.  For maximum
 	     compatibility, we will put them in both places.  */
-
 	  int odd_sized_struct = ((len > MIPS_SAVED_REGSIZE) &&
 				  (len % MIPS_SAVED_REGSIZE != 0));
+	  /* Note: Floating-point values that didn't fit into an FP
+             register are only written to memory. */
 	  while (len > 0)
 	    {
+	      /* Rememer if the argument was written to the stack. */
+	      int stack_used_p = 0;
 	      int partial_len = len < MIPS_SAVED_REGSIZE ? len : MIPS_SAVED_REGSIZE;
 
-	      if (argreg > MIPS_LAST_ARG_REGNUM || odd_sized_struct)
+	      if (mips_debug)
+		fprintf_unfiltered (gdb_stdlog, " -- partial=%d",
+				    partial_len);
+
+	      /* Write this portion of the argument to the stack.  */
+	      if (argreg > MIPS_LAST_ARG_REGNUM
+		  || odd_sized_struct
+		  || fp_register_arg_p (typecode, arg_type))
 		{
-		  /* Write this portion of the argument to the stack.  */
 		  /* Should shorter than int integer values be
 		     promoted to int before being stored? */
-
 		  int longword_offset = 0;
+		  CORE_ADDR addr;
+		  stack_used_p = 1;
 		  if (TARGET_BYTE_ORDER == BIG_ENDIAN)
 		    {
 		      if (MIPS_STACK_ARGSIZE == 8 &&
@@ -2205,15 +2298,37 @@
 			longword_offset = MIPS_STACK_ARGSIZE - len;
 		    }
 
-		  write_memory (sp + stack_offset + longword_offset,
-				val, partial_len);
+		  if (mips_debug)
+		    {
+		      fprintf_unfiltered (gdb_stdlog, " - stack_offset=0x%lx",
+					  (long) stack_offset);
+		      fprintf_unfiltered (gdb_stdlog, " longword_offset=0x%lx",
+					  (long) longword_offset);
+		    }
+		    
+		  addr = sp + stack_offset + longword_offset;
+
+		  if (mips_debug)
+		    {
+		      int i;
+		      fprintf_unfiltered (gdb_stdlog, " @0x%lx ", (long) addr);
+		      for (i = 0; i < partial_len; i++)
+			{
+			  fprintf_unfiltered (gdb_stdlog, "%02x", val[i] & 0xff);
+			}
+		    }
+		  write_memory (addr, val, partial_len);
 		}
 
-	      /* Note!!! This is NOT an else clause.
-	         Odd sized structs may go thru BOTH paths.  */
-	      if (argreg <= MIPS_LAST_ARG_REGNUM)
+	      /* Note!!! This is NOT an else clause.  Odd sized
+	         structs may go thru BOTH paths.  Floating point
+	         arguments will not. */
+	      /* Write this portion of the argument to a general
+                 purpose register. */
+	      if (argreg <= MIPS_LAST_ARG_REGNUM
+		  && !fp_register_arg_p (typecode, arg_type))
 		{
-		  CORE_ADDR regval = extract_address (val, partial_len);
+		  LONGEST regval = extract_unsigned_integer (val, partial_len);
 
 		  /* A non-floating-point argument being passed in a 
 		     general register.  If a struct or union, and if
@@ -2236,6 +2351,10 @@
 		    regval <<= ((MIPS_SAVED_REGSIZE - partial_len) *
 				TARGET_CHAR_BIT);
 
+		  if (mips_debug)
+		    fprintf_filtered (gdb_stdlog, " - reg=%d val=%s",
+				      argreg,
+				      phex (regval, MIPS_SAVED_REGSIZE));
 		  write_register (argreg, regval);
 		  argreg++;
 
@@ -2249,20 +2368,23 @@
 	      len -= partial_len;
 	      val += partial_len;
 
-	      /* The offset onto the stack at which we will start
-	         copying parameters (after the registers are used up) 
-	         begins at (4 * MIPS_REGSIZE) in the old ABI.  This 
-	         leaves room for the "home" area for register parameters.
+	      /* Compute the the offset into the stack at which we
+		 will copy the next parameter.
 
-	         In the new EABI (and the NABI32), the 8 register parameters 
-	         do not have "home" stack space reserved for them, so the
-	         stack offset does not get incremented until after
-	         we have used up the 8 parameter registers.  */
+		 In older ABIs, the caller reserved space for
+		 registers that contained arguments.  This was loosely
+		 refered to as their "home".  Consequently, space is
+		 always allocated.
 
-	      if (MIPS_REGS_HAVE_HOME_P || argnum >= 8)
+	         In the new EABI (and the NABI32), the stack_offset
+	         only needs to be adjusted when it has been used.. */
+
+	      if (MIPS_REGS_HAVE_HOME_P || stack_used_p)
 		stack_offset += ROUND_UP (partial_len, MIPS_STACK_ARGSIZE);
 	    }
 	}
+      if (mips_debug)
+	fprintf_unfiltered (gdb_stdlog, "\n");
     }
 
   /* Return adjusted stack pointer.  */
@@ -2270,9 +2392,7 @@
 }
 
 CORE_ADDR
-mips_push_return_address (pc, sp)
-     CORE_ADDR pc;
-     CORE_ADDR sp;
+mips_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
 {
   /* Set the return address register to point to the entry
      point of the program, where a breakpoint lies in wait.  */
@@ -2307,13 +2427,13 @@
 #define MASK(i,j) (((1 << ((j)+1))-1) ^ ((1 << (i))-1))
 
 void
-mips_push_dummy_frame ()
+mips_push_dummy_frame (void)
 {
   int ireg;
   struct linked_proc_info *link = (struct linked_proc_info *)
   xmalloc (sizeof (struct linked_proc_info));
   mips_extra_func_info_t proc_desc = &link->info;
-  CORE_ADDR sp = ADDR_BITS_REMOVE (read_register (SP_REGNUM));
+  CORE_ADDR sp = ADDR_BITS_REMOVE (read_signed_register (SP_REGNUM));
   CORE_ADDR old_sp = sp;
   link->next = linked_proc_desc_table;
   linked_proc_desc_table = link;
@@ -2386,7 +2506,7 @@
 }
 
 void
-mips_pop_frame ()
+mips_pop_frame (void)
 {
   register int regnum;
   struct frame_info *frame = get_current_frame ();
@@ -2428,7 +2548,7 @@
       else
 	linked_proc_desc_table = pi_ptr->next;
 
-      free (pi_ptr);
+      xfree (pi_ptr);
 
       write_register (HI_REGNUM,
 		      read_memory_integer (new_sp - 2 * MIPS_SAVED_REGSIZE,
@@ -2444,8 +2564,7 @@
 }
 
 static void
-mips_print_register (regnum, all)
-     int regnum, all;
+mips_print_register (int regnum, int all)
 {
   char raw_buffer[MAX_REGISTER_RAW_SIZE];
 
@@ -2519,8 +2638,7 @@
    Print regs in pretty columns.  */
 
 static int
-do_fp_register_row (regnum)
-     int regnum;
+do_fp_register_row (int regnum)
 {				/* do values for FP (float) regs */
   char *raw_buffer[2];
   char *dbl_buffer;
@@ -2582,8 +2700,7 @@
 /* Print a row's worth of GP (int) registers, with name labels above */
 
 static int
-do_gp_register_row (regnum)
-     int regnum;
+do_gp_register_row (int regnum)
 {
   /* do values for GP (int) regs */
   char raw_buffer[MAX_REGISTER_RAW_SIZE];
@@ -2645,9 +2762,7 @@
 /* MIPS_DO_REGISTERS_INFO(): called by "info register" command */
 
 void
-mips_do_registers_info (regnum, fpregs)
-     int regnum;
-     int fpregs;
+mips_do_registers_info (int regnum, int fpregs)
 {
   if (regnum != -1)		/* do one specified register */
     {
@@ -2678,16 +2793,8 @@
    Can return -1, meaning no way to tell.  */
 
 int
-mips_frame_num_args (frame)
-     struct frame_info *frame;
+mips_frame_num_args (struct frame_info *frame)
 {
-#if 0				/* FIXME Use or lose this! */
-  struct chain_info_t *p;
-
-  p = mips_find_cached_frame (FRAME_FP (frame));
-  if (p->valid)
-    return p->the_info.numargs;
-#endif
   return -1;
 }
 
@@ -2696,8 +2803,7 @@
 static int is_delayed (unsigned long);
 
 static int
-is_delayed (insn)
-     unsigned long insn;
+is_delayed (unsigned long insn)
 {
   int i;
   for (i = 0; i < NUMOPCODES; ++i)
@@ -2711,8 +2817,7 @@
 }
 
 int
-mips_step_skips_delay (pc)
-     CORE_ADDR pc;
+mips_step_skips_delay (CORE_ADDR pc)
 {
   char buf[MIPS_INSTLEN];
 
@@ -2731,9 +2836,7 @@
    This is a helper function for mips_skip_prologue.  */
 
 static CORE_ADDR
-mips32_skip_prologue (pc, lenient)
-     CORE_ADDR pc;		/* starting PC to search from */
-     int lenient;
+mips32_skip_prologue (CORE_ADDR pc)
 {
   t_inst inst;
   CORE_ADDR end_pc;
@@ -2750,11 +2853,6 @@
       inst = mips_fetch_instruction (pc);
       high_word = (inst >> 16) & 0xffff;
 
-#if 0
-      if (lenient && is_delayed (inst))
-	continue;
-#endif
-
       if (high_word == 0x27bd	/* addiu $sp,$sp,offset */
 	  || high_word == 0x67bd)	/* daddiu $sp,$sp,offset */
 	seen_sp_adjust = 1;
@@ -2827,9 +2925,7 @@
    This is a helper function for mips_skip_prologue.  */
 
 static CORE_ADDR
-mips16_skip_prologue (pc, lenient)
-     CORE_ADDR pc;		/* starting PC to search from */
-     int lenient;
+mips16_skip_prologue (CORE_ADDR pc)
 {
   CORE_ADDR end_pc;
   int extend_bytes = 0;
@@ -2941,9 +3037,7 @@
    delay slot of a non-prologue instruction).  */
 
 CORE_ADDR
-mips_skip_prologue (pc, lenient)
-     CORE_ADDR pc;
-     int lenient;
+mips_skip_prologue (CORE_ADDR pc)
 {
   /* See if we can determine the end of the prologue via the symbol table.
      If so, then return either PC, or the PC after the prologue, whichever
@@ -2958,29 +3052,11 @@
      instructions.  */
 
   if (pc_is_mips16 (pc))
-    return mips16_skip_prologue (pc, lenient);
+    return mips16_skip_prologue (pc);
   else
-    return mips32_skip_prologue (pc, lenient);
+    return mips32_skip_prologue (pc);
 }
 
-#if 0
-/* The lenient prologue stuff should be superseded by the code in
-   init_extra_frame_info which looks to see whether the stores mentioned
-   in the proc_desc have actually taken place.  */
-
-/* Is address PC in the prologue (loosely defined) for function at
-   STARTADDR?  */
-
-static int
-mips_in_lenient_prologue (startaddr, pc)
-     CORE_ADDR startaddr;
-     CORE_ADDR pc;
-{
-  CORE_ADDR end_prologue = mips_skip_prologue (startaddr, 1);
-  return pc >= startaddr && pc < end_prologue;
-}
-#endif
-
 /* Determine how a return value is stored within the MIPS register
    file, given the return type `valtype'. */
 
@@ -2992,14 +3068,10 @@
   int buf_offset;
 };
 
-static void return_value_location (struct type *, struct return_value_word *,
-				   struct return_value_word *);
-
 static void
-return_value_location (valtype, hi, lo)
-     struct type *valtype;
-     struct return_value_word *hi;
-     struct return_value_word *lo;
+return_value_location (struct type *valtype,
+		       struct return_value_word *hi,
+		       struct return_value_word *lo)
 {
   int len = TYPE_LENGTH (valtype);
 
@@ -3100,10 +3172,9 @@
    copy its value into `valbuf'. */
 
 void
-mips_extract_return_value (valtype, regbuf, valbuf)
-     struct type *valtype;
-     char regbuf[REGISTER_BYTES];
-     char *valbuf;
+mips_extract_return_value (struct type *valtype,
+			   char regbuf[REGISTER_BYTES],
+			   char *valbuf)
 {
   struct return_value_word lo;
   struct return_value_word hi;
@@ -3117,41 +3188,13 @@
     memcpy (valbuf + hi.buf_offset,
 	    regbuf + REGISTER_BYTE (hi.reg) + hi.reg_offset,
 	    hi.len);
-
-#if 0
-  int regnum;
-  int offset = 0;
-  int len = TYPE_LENGTH (valtype);
-
-  regnum = 2;
-  if (TYPE_CODE (valtype) == TYPE_CODE_FLT
-      && (MIPS_FPU_TYPE == MIPS_FPU_DOUBLE
-	  || (MIPS_FPU_TYPE == MIPS_FPU_SINGLE
-	      && len <= MIPS_FPU_SINGLE_REGSIZE)))
-    regnum = FP0_REGNUM;
-
-  if (TARGET_BYTE_ORDER == BIG_ENDIAN)
-    {				/* "un-left-justify" the value from the register */
-      if (len < REGISTER_RAW_SIZE (regnum))
-	offset = REGISTER_RAW_SIZE (regnum) - len;
-      if (len > REGISTER_RAW_SIZE (regnum) &&	/* odd-size structs */
-	  len < REGISTER_RAW_SIZE (regnum) * 2 &&
-	  (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
-	   TYPE_CODE (valtype) == TYPE_CODE_UNION))
-	offset = 2 * REGISTER_RAW_SIZE (regnum) - len;
-    }
-  memcpy (valbuf, regbuf + REGISTER_BYTE (regnum) + offset, len);
-  REGISTER_CONVERT_TO_TYPE (regnum, valtype, valbuf);
-#endif
 }
 
 /* Given a return value in `valbuf' with a type `valtype', write it's
    value into the appropriate register. */
 
 void
-mips_store_return_value (valtype, valbuf)
-     struct type *valtype;
-     char *valbuf;
+mips_store_return_value (struct type *valtype, char *valbuf)
 {
   char raw_buffer[MAX_REGISTER_RAW_SIZE];
   struct return_value_word lo;
@@ -3172,44 +3215,12 @@
 			    raw_buffer,
 			    REGISTER_RAW_SIZE (hi.reg));
     }
-
-#if 0
-  int regnum;
-  int offset = 0;
-  int len = TYPE_LENGTH (valtype);
-  char raw_buffer[MAX_REGISTER_RAW_SIZE];
-
-  regnum = 2;
-  if (TYPE_CODE (valtype) == TYPE_CODE_FLT
-      && (MIPS_FPU_TYPE == MIPS_FPU_DOUBLE
-	  || (MIPS_FPU_TYPE == MIPS_FPU_SINGLE
-	      && len <= MIPS_REGSIZE)))
-    regnum = FP0_REGNUM;
-
-  if (TARGET_BYTE_ORDER == BIG_ENDIAN)
-    {				/* "left-justify" the value in the register */
-      if (len < REGISTER_RAW_SIZE (regnum))
-	offset = REGISTER_RAW_SIZE (regnum) - len;
-      if (len > REGISTER_RAW_SIZE (regnum) &&	/* odd-size structs */
-	  len < REGISTER_RAW_SIZE (regnum) * 2 &&
-	  (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
-	   TYPE_CODE (valtype) == TYPE_CODE_UNION))
-	offset = 2 * REGISTER_RAW_SIZE (regnum) - len;
-    }
-  memcpy (raw_buffer + offset, valbuf, len);
-  REGISTER_CONVERT_FROM_TYPE (regnum, valtype, raw_buffer);
-  write_register_bytes (REGISTER_BYTE (regnum), raw_buffer,
-			len > REGISTER_RAW_SIZE (regnum) ?
-			len : REGISTER_RAW_SIZE (regnum));
-#endif
 }
 
 /* Exported procedure: Is PC in the signal trampoline code */
 
 int
-in_sigtramp (pc, ignore)
-     CORE_ADDR pc;
-     char *ignore;		/* function name */
+in_sigtramp (CORE_ADDR pc, char *ignore)
 {
   if (sigtramp_address == 0)
     fixup_sigtramp ();
@@ -3219,20 +3230,14 @@
 /* Root of all "set mips "/"show mips " commands. This will eventually be
    used for all MIPS-specific commands.  */
 
-static void show_mips_command (char *, int);
 static void
-show_mips_command (args, from_tty)
-     char *args;
-     int from_tty;
+show_mips_command (char *args, int from_tty)
 {
   help_list (showmipscmdlist, "show mips ", all_commands, gdb_stdout);
 }
 
-static void set_mips_command (char *, int);
 static void
-set_mips_command (args, from_tty)
-     char *args;
-     int from_tty;
+set_mips_command (char *args, int from_tty)
 {
   printf_unfiltered ("\"set mips\" must be followed by an appropriate subcommand.\n");
   help_list (setmipscmdlist, "set mips ", all_commands, gdb_stdout);
@@ -3240,11 +3245,8 @@
 
 /* Commands to show/set the MIPS FPU type.  */
 
-static void show_mipsfpu_command (char *, int);
 static void
-show_mipsfpu_command (args, from_tty)
-     char *args;
-     int from_tty;
+show_mipsfpu_command (char *args, int from_tty)
 {
   char *msg;
   char *fpu;
@@ -3269,21 +3271,15 @@
 }
 
 
-static void set_mipsfpu_command (char *, int);
 static void
-set_mipsfpu_command (args, from_tty)
-     char *args;
-     int from_tty;
+set_mipsfpu_command (char *args, int from_tty)
 {
   printf_unfiltered ("\"set mipsfpu\" must be followed by \"double\", \"single\",\"none\" or \"auto\".\n");
   show_mipsfpu_command (args, from_tty);
 }
 
-static void set_mipsfpu_single_command (char *, int);
 static void
-set_mipsfpu_single_command (args, from_tty)
-     char *args;
-     int from_tty;
+set_mipsfpu_single_command (char *args, int from_tty)
 {
   mips_fpu_type = MIPS_FPU_SINGLE;
   mips_fpu_type_auto = 0;
@@ -3293,11 +3289,8 @@
     }
 }
 
-static void set_mipsfpu_double_command (char *, int);
 static void
-set_mipsfpu_double_command (args, from_tty)
-     char *args;
-     int from_tty;
+set_mipsfpu_double_command (char *args, int from_tty)
 {
   mips_fpu_type = MIPS_FPU_DOUBLE;
   mips_fpu_type_auto = 0;
@@ -3307,11 +3300,8 @@
     }
 }
 
-static void set_mipsfpu_none_command (char *, int);
 static void
-set_mipsfpu_none_command (args, from_tty)
-     char *args;
-     int from_tty;
+set_mipsfpu_none_command (char *args, int from_tty)
 {
   mips_fpu_type = MIPS_FPU_NONE;
   mips_fpu_type_auto = 0;
@@ -3321,11 +3311,8 @@
     }
 }
 
-static void set_mipsfpu_auto_command (char *, int);
 static void
-set_mipsfpu_auto_command (args, from_tty)
-     char *args;
-     int from_tty;
+set_mipsfpu_auto_command (char *args, int from_tty)
 {
   mips_fpu_type_auto = 1;
 }
@@ -3333,9 +3320,7 @@
 /* Command to set the processor type.  */
 
 void
-mips_set_processor_type_command (args, from_tty)
-     char *args;
-     int from_tty;
+mips_set_processor_type_command (char *args, int from_tty)
 {
   int i;
 
@@ -3360,17 +3345,14 @@
 }
 
 static void
-mips_show_processor_type_command (args, from_tty)
-     char *args;
-     int from_tty;
+mips_show_processor_type_command (char *args, int from_tty)
 {
 }
 
 /* Modify the actual processor type. */
 
 int
-mips_set_processor_type (str)
-     char *str;
+mips_set_processor_type (char *str)
 {
   int i, j;
 
@@ -3395,7 +3377,7 @@
    processor id.  */
 
 char *
-mips_read_processor_type ()
+mips_read_processor_type (void)
 {
   CORE_ADDR prid;
 
@@ -3411,18 +3393,14 @@
    callable as an sfunc.  */
 
 static void
-reinit_frame_cache_sfunc (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+reinit_frame_cache_sfunc (char *args, int from_tty,
+			  struct cmd_list_element *c)
 {
   reinit_frame_cache ();
 }
 
 int
-gdb_print_insn_mips (memaddr, info)
-     bfd_vma memaddr;
-     disassemble_info *info;
+gdb_print_insn_mips (bfd_vma memaddr, disassemble_info *info)
 {
   mips_extra_func_info_t proc_desc;
 
@@ -3439,12 +3417,14 @@
      it's definitely a 16-bit function.  Otherwise, we have to just
      guess that if the address passed in is odd, it's 16-bits.  */
   if (proc_desc)
-    info->mach = pc_is_mips16 (PROC_LOW_ADDR (proc_desc)) ? 16 : TM_PRINT_INSN_MACH;
+    info->mach = pc_is_mips16 (PROC_LOW_ADDR (proc_desc)) ? 
+      bfd_mach_mips16 : TM_PRINT_INSN_MACH;
   else
-    info->mach = pc_is_mips16 (memaddr) ? 16 : TM_PRINT_INSN_MACH;
+    info->mach = pc_is_mips16 (memaddr) ? 
+      bfd_mach_mips16 : TM_PRINT_INSN_MACH;
 
   /* Round down the instruction address to the appropriate boundary.  */
-  memaddr &= (info->mach == 16 ? ~1 : ~3);
+  memaddr &= (info->mach == bfd_mach_mips16 ? ~1 : ~3);
 
   /* Call the appropriate disassembler based on the target endian-ness.  */
   if (TARGET_BYTE_ORDER == BIG_ENDIAN)
@@ -3474,9 +3454,7 @@
    breakpoint should be inserted.  */
 
 unsigned char *
-mips_breakpoint_from_pc (pcptr, lenptr)
-     CORE_ADDR *pcptr;
-     int *lenptr;
+mips_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr)
 {
   if (TARGET_BYTE_ORDER == BIG_ENDIAN)
     {
@@ -3554,8 +3532,7 @@
  */
 
 CORE_ADDR
-mips_skip_stub (pc)
-     CORE_ADDR pc;
+mips_skip_stub (CORE_ADDR pc)
 {
   char *name;
   CORE_ADDR start_addr;
@@ -3568,14 +3545,14 @@
      target PC is in $31 ($ra).  */
   if (strcmp (name, "__mips16_ret_sf") == 0
       || strcmp (name, "__mips16_ret_df") == 0)
-    return read_register (RA_REGNUM);
+    return read_signed_register (RA_REGNUM);
 
   if (strncmp (name, "__mips16_call_stub_", 19) == 0)
     {
       /* If the PC is in __mips16_call_stub_{1..10}, this is a call stub
          and the target PC is in $2.  */
       if (name[19] >= '0' && name[19] <= '9')
-	return read_register (2);
+	return read_signed_register (2);
 
       /* If the PC at the start of __mips16_call_stub_{s,d}f_{0..10}, i.e.
          before the jal instruction, this is effectively a call stub
@@ -3597,7 +3574,7 @@
 	         So scan down to the lui/addi and extract the target
 	         address from those two instructions.  */
 
-	      CORE_ADDR target_pc = read_register (2);
+	      CORE_ADDR target_pc = read_signed_register (2);
 	      t_inst inst;
 	      int i;
 
@@ -3627,7 +3604,7 @@
 	  else
 	    /* This is the 'return' part of a call stub.  The return
 	       address is in $r18.  */
-	    return read_register (18);
+	    return read_signed_register (18);
 	}
     }
   return 0;			/* not a stub */
@@ -3638,9 +3615,7 @@
    This implements the IN_SOLIB_CALL_TRAMPOLINE macro.  */
 
 int
-mips_in_call_stub (pc, name)
-     CORE_ADDR pc;
-     char *name;
+mips_in_call_stub (CORE_ADDR pc, char *name)
 {
   CORE_ADDR start_addr;
 
@@ -3668,9 +3643,7 @@
    This implements the IN_SOLIB_RETURN_TRAMPOLINE macro.  */
 
 int
-mips_in_return_stub (pc, name)
-     CORE_ADDR pc;
-     char *name;
+mips_in_return_stub (CORE_ADDR pc, char *name)
 {
   CORE_ADDR start_addr;
 
@@ -3698,8 +3671,7 @@
    be ignored.  This implements the IGNORE_HELPER_CALL macro.  */
 
 int
-mips_ignore_helper (pc)
-     CORE_ADDR pc;
+mips_ignore_helper (CORE_ADDR pc)
 {
   char *name;
 
@@ -3721,7 +3693,7 @@
    whose address is the location where the breakpoint should be placed.  */
 
 CORE_ADDR
-mips_call_dummy_address ()
+mips_call_dummy_address (void)
 {
   struct minimal_symbol *sym;
 
@@ -3761,13 +3733,12 @@
    macro - REGISTER_STACK_SIZE(). */
 
 static void
-mips_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
-     char *raw_buffer;
-     int *optimized;
-     CORE_ADDR *addrp;
-     struct frame_info *frame;
-     int regnum;
-     enum lval_type *lval;
+mips_get_saved_register (char *raw_buffer,
+			 int *optimized,
+			 CORE_ADDR *addrp,
+			 struct frame_info *frame,
+			 int regnum,
+			 enum lval_type *lval)
 {
   CORE_ADDR addr;
 
@@ -3818,20 +3789,50 @@
     *addrp = addr;
 }
 
-static gdbarch_init_ftype mips_gdbarch_init;
+/* Immediately after a function call, return the saved pc.
+   Can't always go through the frames for this because on some machines
+   the new frame is not set up until the new function executes
+   some instructions.  */
+
+static CORE_ADDR
+mips_saved_pc_after_call (struct frame_info *frame)
+{
+  return read_signed_register (RA_REGNUM);
+}
+
+
+/* Convert a dbx stab register number (from `r' declaration) to a gdb
+   REGNUM */
+
+static int
+mips_stab_reg_to_regnum (int num)
+{
+  if (num < 32)
+    return num;
+  else 
+    return num + FP0_REGNUM - 38;
+}
+
+/* Convert a ecoff register number to a gdb REGNUM */
+
+static int
+mips_ecoff_reg_to_regnum (int num)
+{
+  if (num < 32)
+    return num;
+  else
+    return num + FP0_REGNUM - 32;
+}
+
 static struct gdbarch *
-mips_gdbarch_init (info, arches)
-     struct gdbarch_info info;
-     struct gdbarch_list *arches;
+mips_gdbarch_init (struct gdbarch_info info,
+		   struct gdbarch_list *arches)
 {
   static LONGEST mips_call_dummy_words[] =
   {0};
   struct gdbarch *gdbarch;
   struct gdbarch_tdep *tdep;
   int elf_flags;
-  char *ef_mips_abi;
-  int ef_mips_bitptrs;
-  int ef_mips_arch;
   enum mips_abi mips_abi;
 
   /* Extract the elf_flags if available */
@@ -3854,17 +3855,47 @@
       mips_abi = MIPS_ABI_EABI32;
       break;
     case E_MIPS_ABI_EABI64:
-      mips_abi = MIPS_ABI_EABI32;
+      mips_abi = MIPS_ABI_EABI64;
       break;
     default:
-      mips_abi = MIPS_ABI_UNKNOWN;
+      if ((elf_flags & EF_MIPS_ABI2))
+	mips_abi = MIPS_ABI_N32;
+      else
+	mips_abi = MIPS_ABI_UNKNOWN;
       break;
     }
+
+  /* Try the architecture for any hint of the corect ABI */
+  if (mips_abi == MIPS_ABI_UNKNOWN
+      && info.bfd_arch_info != NULL
+      && info.bfd_arch_info->arch == bfd_arch_mips)
+    {
+      switch (info.bfd_arch_info->mach)
+	{
+	case bfd_mach_mips3900:
+	  mips_abi = MIPS_ABI_EABI32;
+	  break;
+	case bfd_mach_mips4100:
+	case bfd_mach_mips5000:
+	  mips_abi = MIPS_ABI_EABI64;
+	  break;
+	}
+    }
 #ifdef MIPS_DEFAULT_ABI
   if (mips_abi == MIPS_ABI_UNKNOWN)
     mips_abi = MIPS_DEFAULT_ABI;
 #endif
 
+  if (gdbarch_debug)
+    {
+      fprintf_unfiltered (gdb_stdlog,
+			  "mips_gdbarch_init: elf_flags = 0x%08x\n",
+			  elf_flags);
+      fprintf_unfiltered (gdb_stdlog,
+			  "mips_gdbarch_init: mips_abi = %d\n",
+			  mips_abi);
+    }
+
   /* try to find a pre-existing architecture */
   for (arches = gdbarch_list_lookup_by_info (arches, &info);
        arches != NULL;
@@ -3872,9 +3903,9 @@
     {
       /* MIPS needs to be pedantic about which ABI the object is
          using. */
-      if (gdbarch_tdep (current_gdbarch)->elf_flags != elf_flags)
+      if (gdbarch_tdep (arches->gdbarch)->elf_flags != elf_flags)
 	continue;
-      if (gdbarch_tdep (current_gdbarch)->mips_abi != mips_abi)
+      if (gdbarch_tdep (arches->gdbarch)->mips_abi != mips_abi)
 	continue;
       return arches->gdbarch;
     }
@@ -3894,73 +3925,85 @@
   switch (mips_abi)
     {
     case MIPS_ABI_O32:
-      ef_mips_abi = "o32";
+      tdep->mips_abi_string = "o32";
       tdep->mips_default_saved_regsize = 4;
       tdep->mips_default_stack_argsize = 4;
       tdep->mips_fp_register_double = 0;
-      tdep->mips_last_arg_regnum = ZERO_REGNUM + 7;
-      tdep->mips_last_fp_arg_regnum = FP0_REGNUM + 15;
+      tdep->mips_last_arg_regnum = A0_REGNUM + 4 - 1;
+      tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 4 - 1;
       tdep->mips_regs_have_home_p = 1;
+      tdep->gdb_target_is_mips64 = 0;
+      tdep->default_mask_address_p = 0;
       set_gdbarch_long_bit (gdbarch, 32);
       set_gdbarch_ptr_bit (gdbarch, 32);
       set_gdbarch_long_long_bit (gdbarch, 64);
       break;
     case MIPS_ABI_O64:
-      ef_mips_abi = "o64";
+      tdep->mips_abi_string = "o64";
       tdep->mips_default_saved_regsize = 8;
       tdep->mips_default_stack_argsize = 8;
       tdep->mips_fp_register_double = 1;
-      tdep->mips_last_arg_regnum = ZERO_REGNUM + 7;
-      tdep->mips_last_fp_arg_regnum = FP0_REGNUM + 15;
+      tdep->mips_last_arg_regnum = A0_REGNUM + 4 - 1;
+      tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 4 - 1;
       tdep->mips_regs_have_home_p = 1;
+      tdep->gdb_target_is_mips64 = 1;
+      tdep->default_mask_address_p = 0; 
       set_gdbarch_long_bit (gdbarch, 32);
       set_gdbarch_ptr_bit (gdbarch, 32);
       set_gdbarch_long_long_bit (gdbarch, 64);
       break;
     case MIPS_ABI_EABI32:
-      ef_mips_abi = "eabi32";
+      tdep->mips_abi_string = "eabi32";
       tdep->mips_default_saved_regsize = 4;
       tdep->mips_default_stack_argsize = 4;
       tdep->mips_fp_register_double = 0;
-      tdep->mips_last_arg_regnum = ZERO_REGNUM + 11;
-      tdep->mips_last_fp_arg_regnum = FP0_REGNUM + 19;
+      tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1;
+      tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 8 - 1;
       tdep->mips_regs_have_home_p = 0;
+      tdep->gdb_target_is_mips64 = 0;
+      tdep->default_mask_address_p = 0;
       set_gdbarch_long_bit (gdbarch, 32);
       set_gdbarch_ptr_bit (gdbarch, 32);
       set_gdbarch_long_long_bit (gdbarch, 64);
       break;
     case MIPS_ABI_EABI64:
-      ef_mips_abi = "eabi64";
+       tdep->mips_abi_string = "eabi64";
       tdep->mips_default_saved_regsize = 8;
       tdep->mips_default_stack_argsize = 8;
       tdep->mips_fp_register_double = 1;
-      tdep->mips_last_arg_regnum = ZERO_REGNUM + 11;
-      tdep->mips_last_fp_arg_regnum = FP0_REGNUM + 19;
+      tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1;
+      tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 8 - 1;
       tdep->mips_regs_have_home_p = 0;
+      tdep->gdb_target_is_mips64 = 1;
+      tdep->default_mask_address_p = 0;
       set_gdbarch_long_bit (gdbarch, 64);
       set_gdbarch_ptr_bit (gdbarch, 64);
       set_gdbarch_long_long_bit (gdbarch, 64);
       break;
     case MIPS_ABI_N32:
-      ef_mips_abi = "n32";
+      tdep->mips_abi_string = "n32";
       tdep->mips_default_saved_regsize = 4;
       tdep->mips_default_stack_argsize = 8;
       tdep->mips_fp_register_double = 1;
-      tdep->mips_last_arg_regnum = ZERO_REGNUM + 11;
-      tdep->mips_last_fp_arg_regnum = FP0_REGNUM + 19;
+      tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1;
+      tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 8 - 1;
       tdep->mips_regs_have_home_p = 0;
+      tdep->gdb_target_is_mips64 = 0;
+      tdep->default_mask_address_p = 0;
       set_gdbarch_long_bit (gdbarch, 32);
       set_gdbarch_ptr_bit (gdbarch, 32);
       set_gdbarch_long_long_bit (gdbarch, 64);
       break;
     default:
-      ef_mips_abi = "default";
+      tdep->mips_abi_string = "default";
       tdep->mips_default_saved_regsize = MIPS_REGSIZE;
       tdep->mips_default_stack_argsize = MIPS_REGSIZE;
       tdep->mips_fp_register_double = (REGISTER_VIRTUAL_SIZE (FP0_REGNUM) == 8);
-      tdep->mips_last_arg_regnum = ZERO_REGNUM + 11;
-      tdep->mips_last_fp_arg_regnum = FP0_REGNUM + 19;
+      tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1;
+      tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 8 - 1;
       tdep->mips_regs_have_home_p = 1;
+      tdep->gdb_target_is_mips64 = 0;
+      tdep->default_mask_address_p = 0;
       set_gdbarch_long_bit (gdbarch, 32);
       set_gdbarch_ptr_bit (gdbarch, 32);
       set_gdbarch_long_long_bit (gdbarch, 64);
@@ -3988,41 +4031,6 @@
      the current gcc - it would make GDB treat these 64-bit programs
      as 32-bit programs by default. */
 
-  /* determine the ISA */
-  switch (elf_flags & EF_MIPS_ARCH)
-    {
-    case E_MIPS_ARCH_1:
-      ef_mips_arch = 1;
-      break;
-    case E_MIPS_ARCH_2:
-      ef_mips_arch = 2;
-      break;
-    case E_MIPS_ARCH_3:
-      ef_mips_arch = 3;
-      break;
-    case E_MIPS_ARCH_4:
-      ef_mips_arch = 0;
-      break;
-    default:
-      break;
-    }
-
-#if 0
-  /* determine the size of a pointer */
-  if ((elf_flags & EF_MIPS_32BITPTRS))
-    {
-      ef_mips_bitptrs = 32;
-    }
-  else if ((elf_flags & EF_MIPS_64BITPTRS))
-    {
-      ef_mips_bitptrs = 64;
-    }
-  else
-    {
-      ef_mips_bitptrs = 0;
-    }
-#endif
-
   /* enable/disable the MIPS FPU */
   if (!mips_fpu_type_auto)
     tdep->mips_fpu_type = mips_fpu_type;
@@ -4030,10 +4038,14 @@
 	   && info.bfd_arch_info->arch == bfd_arch_mips)
     switch (info.bfd_arch_info->mach)
       {
+      case bfd_mach_mips3900:
       case bfd_mach_mips4100:
       case bfd_mach_mips4111:
 	tdep->mips_fpu_type = MIPS_FPU_NONE;
 	break;
+      case bfd_mach_mips4650:
+	tdep->mips_fpu_type = MIPS_FPU_SINGLE;
+	break;
       default:
 	tdep->mips_fpu_type = MIPS_FPU_DOUBLE;
 	break;
@@ -4046,13 +4058,17 @@
      #undef/#define REGISTER_NAMES and the new REGISTER_NAME(nr).
      Further work on it is required. */
   set_gdbarch_register_name (gdbarch, mips_register_name);
-  set_gdbarch_read_pc (gdbarch, generic_target_read_pc);
+  set_gdbarch_read_pc (gdbarch, mips_read_pc);
   set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
   set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
   set_gdbarch_write_fp (gdbarch, generic_target_write_fp);
   set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
   set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
 
+  /* Map debug register numbers onto internal register numbers. */
+  set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum);
+  set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_ecoff_reg_to_regnum);
+
   /* Initialize a frame */
   set_gdbarch_init_extra_frame_info (gdbarch, mips_init_extra_frame_info);
 
@@ -4078,67 +4094,442 @@
   set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
   set_gdbarch_get_saved_register (gdbarch, mips_get_saved_register);
 
-  if (gdbarch_debug)
-    {
-      fprintf_unfiltered (gdb_stdlog,
-			  "mips_gdbarch_init: (info)ef_mips_abi = %s\n",
-			  ef_mips_abi);
-      fprintf_unfiltered (gdb_stdlog,
-			  "mips_gdbarch_init: (info)ef_mips_arch = %d\n",
-			  ef_mips_arch);
-      fprintf_unfiltered (gdb_stdlog,
-			  "mips_gdbarch_init: (info)ef_mips_bitptrs = %d\n",
-			  ef_mips_bitptrs);
-      fprintf_unfiltered (gdb_stdlog,
-			  "mips_gdbarch_init: MIPS_REGSIZE = %d\n",
-			  MIPS_REGSIZE);
-      fprintf_unfiltered (gdb_stdlog,
-			  "mips_gdbarch_init: tdep->elf_flags = 0x%x\n",
-			  tdep->elf_flags);
-      fprintf_unfiltered (gdb_stdlog,
-			  "mips_gdbarch_init: tdep->mips_abi = %d\n",
-			  tdep->mips_abi);
-      fprintf_unfiltered (gdb_stdlog,
-			  "mips_gdbarch_init: tdep->mips_fpu_type = %d (%s)\n",
-			  tdep->mips_fpu_type,
-			  (tdep->mips_fpu_type == MIPS_FPU_NONE ? "none"
-			   : tdep->mips_fpu_type == MIPS_FPU_SINGLE ? "single"
-			   : tdep->mips_fpu_type == MIPS_FPU_DOUBLE ? "double"
-			   : "???"));
-      fprintf_unfiltered (gdb_stdlog,
-			  "mips_gdbarch_init: tdep->mips_last_arg_regnum = %d\n",
-			  tdep->mips_last_arg_regnum);
-      fprintf_unfiltered (gdb_stdlog,
-			  "mips_gdbarch_init: tdep->mips_last_fp_arg_regnum = %d (%d)\n",
-			  tdep->mips_last_fp_arg_regnum,
-			  tdep->mips_last_fp_arg_regnum - FP0_REGNUM);
-      fprintf_unfiltered (gdb_stdlog,
-			  "mips_gdbarch_init: tdep->mips_default_saved_regsize = %d\n",
-			  tdep->mips_default_saved_regsize);
-      fprintf_unfiltered (gdb_stdlog,
-			  "mips_gdbarch_init: tdep->mips_fp_register_double = %d (%s)\n",
-			  tdep->mips_fp_register_double,
-			  (tdep->mips_fp_register_double ? "true" : "false"));
-      fprintf_unfiltered (gdb_stdlog,
-			  "mips_gdbarch_init: tdep->mips_regs_have_home_p = %d\n",
-			  tdep->mips_regs_have_home_p);
-      fprintf_unfiltered (gdb_stdlog,
-			  "mips_gdbarch_init: tdep->mips_default_stack_argsize = %d\n",
-			  tdep->mips_default_stack_argsize);
-    }
+  set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
+  set_gdbarch_breakpoint_from_pc (gdbarch, mips_breakpoint_from_pc);
+  set_gdbarch_decr_pc_after_break (gdbarch, 0);
+  set_gdbarch_ieee_float (gdbarch, 1);
+
+  set_gdbarch_skip_prologue (gdbarch, mips_skip_prologue);
+  set_gdbarch_saved_pc_after_call (gdbarch, mips_saved_pc_after_call);
 
   return gdbarch;
 }
 
+static void
+mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  if (tdep != NULL)
+    {
+      int ef_mips_arch;
+      int ef_mips_32bitmode;
+      /* determine the ISA */
+      switch (tdep->elf_flags & EF_MIPS_ARCH)
+	{
+	case E_MIPS_ARCH_1:
+	  ef_mips_arch = 1;
+	  break;
+	case E_MIPS_ARCH_2:
+	  ef_mips_arch = 2;
+	  break;
+	case E_MIPS_ARCH_3:
+	  ef_mips_arch = 3;
+	  break;
+	case E_MIPS_ARCH_4:
+	  ef_mips_arch = 0;
+	  break;
+	default:
+	  break;
+	}
+      /* determine the size of a pointer */
+      ef_mips_32bitmode = (tdep->elf_flags & EF_MIPS_32BITMODE);
+      fprintf_unfiltered (file,
+			  "mips_dump_tdep: tdep->elf_flags = 0x%x\n",
+			  tdep->elf_flags);
+      fprintf_unfiltered (file,
+			  "mips_dump_tdep: ef_mips_32bitmode = %d\n",
+			  ef_mips_32bitmode);
+      fprintf_unfiltered (file,
+			  "mips_dump_tdep: ef_mips_arch = %d\n",
+			  ef_mips_arch);
+      fprintf_unfiltered (file,
+			  "mips_dump_tdep: tdep->mips_abi = %d (%s)\n",
+			  tdep->mips_abi,
+			  tdep->mips_abi_string);
+      fprintf_unfiltered (file,
+			  "mips_dump_tdep: mips_mask_address_p() %d (default %d)\n",
+			  mips_mask_address_p (),
+			  tdep->default_mask_address_p);
+    }
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: FP_REGISTER_DOUBLE = %d\n",
+		      FP_REGISTER_DOUBLE);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_DEFAULT_FPU_TYPE = %d (%s)\n",
+		      MIPS_DEFAULT_FPU_TYPE,
+		      (MIPS_DEFAULT_FPU_TYPE == MIPS_FPU_NONE ? "none"
+		       : MIPS_DEFAULT_FPU_TYPE == MIPS_FPU_SINGLE ? "single"
+		       : MIPS_DEFAULT_FPU_TYPE == MIPS_FPU_DOUBLE ? "double"
+		       : "???"));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_EABI = %d\n",
+		      MIPS_EABI);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_LAST_FP_ARG_REGNUM = %d (%d regs)\n",
+		      MIPS_LAST_FP_ARG_REGNUM,
+		      MIPS_LAST_FP_ARG_REGNUM - FPA0_REGNUM + 1);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_FPU_TYPE = %d (%s)\n",
+		      MIPS_FPU_TYPE,
+		      (MIPS_FPU_TYPE == MIPS_FPU_NONE ? "none"
+		       : MIPS_FPU_TYPE == MIPS_FPU_SINGLE ? "single"
+		       : MIPS_FPU_TYPE == MIPS_FPU_DOUBLE ? "double"
+		       : "???"));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_DEFAULT_SAVED_REGSIZE = %d\n",
+		      MIPS_DEFAULT_SAVED_REGSIZE);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: FP_REGISTER_DOUBLE = %d\n",
+		      FP_REGISTER_DOUBLE);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_REGS_HAVE_HOME_P = %d\n",
+		      MIPS_REGS_HAVE_HOME_P);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_DEFAULT_STACK_ARGSIZE = %d\n",
+		      MIPS_DEFAULT_STACK_ARGSIZE);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_STACK_ARGSIZE = %d\n",
+		      MIPS_STACK_ARGSIZE);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_REGSIZE = %d\n",
+		      MIPS_REGSIZE);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: A0_REGNUM = %d\n",
+		      A0_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: ADDR_BITS_REMOVE # %s\n",
+		      XSTRING (ADDR_BITS_REMOVE(ADDR)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: ATTACH_DETACH # %s\n",
+		      XSTRING (ATTACH_DETACH));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: BADVADDR_REGNUM = %d\n",
+		      BADVADDR_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: BIG_BREAKPOINT = delete?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: CAUSE_REGNUM = %d\n",
+		      CAUSE_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: CPLUS_MARKER = %c\n",
+		      CPLUS_MARKER);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: DEFAULT_MIPS_TYPE = %s\n",
+		      DEFAULT_MIPS_TYPE);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: DO_REGISTERS_INFO # %s\n",
+		      XSTRING (DO_REGISTERS_INFO));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: DWARF_REG_TO_REGNUM # %s\n",
+		      XSTRING (DWARF_REG_TO_REGNUM (REGNUM)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: ECOFF_REG_TO_REGNUM # %s\n",
+		      XSTRING (ECOFF_REG_TO_REGNUM (REGNUM)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: ELF_MAKE_MSYMBOL_SPECIAL # %s\n",
+		      XSTRING (ELF_MAKE_MSYMBOL_SPECIAL (SYM, MSYM)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: FCRCS_REGNUM = %d\n",
+		      FCRCS_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: FCRIR_REGNUM = %d\n",
+		      FCRIR_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: FIRST_EMBED_REGNUM = %d\n",
+		      FIRST_EMBED_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: FPA0_REGNUM = %d\n",
+		      FPA0_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: GDB_TARGET_IS_MIPS64 = %d\n",
+		      GDB_TARGET_IS_MIPS64);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: GDB_TARGET_MASK_DISAS_PC # %s\n",
+		      XSTRING (GDB_TARGET_MASK_DISAS_PC (PC)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: GDB_TARGET_UNMASK_DISAS_PC # %s\n",
+		      XSTRING (GDB_TARGET_UNMASK_DISAS_PC (PC)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: GEN_REG_SAVE_MASK = %d\n",
+		      GEN_REG_SAVE_MASK);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: HAVE_NONSTEPPABLE_WATCHPOINT # %s\n",
+		      XSTRING (HAVE_NONSTEPPABLE_WATCHPOINT));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep:  HI_REGNUM = %d\n",
+		      HI_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: IDT_BIG_BREAKPOINT = delete?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: IDT_LITTLE_BREAKPOINT = delete?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: IGNORE_HELPER_CALL # %s\n",
+		      XSTRING (IGNORE_HELPER_CALL (PC)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: INIT_FRAME_PC # %s\n",
+		      XSTRING (INIT_FRAME_PC (FROMLEAF, PREV)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: INIT_FRAME_PC_FIRST # %s\n",
+		      XSTRING (INIT_FRAME_PC_FIRST (FROMLEAF, PREV)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: IN_SIGTRAMP # %s\n",
+		      XSTRING (IN_SIGTRAMP (PC, NAME)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: IN_SOLIB_CALL_TRAMPOLINE # %s\n",
+		      XSTRING (IN_SOLIB_CALL_TRAMPOLINE (PC, NAME)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: IN_SOLIB_RETURN_TRAMPOLINE # %s\n",
+		      XSTRING (IN_SOLIB_RETURN_TRAMPOLINE (PC, NAME)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: IS_MIPS16_ADDR = FIXME!\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: LAST_EMBED_REGNUM = %d\n",
+		      LAST_EMBED_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: LITTLE_BREAKPOINT = delete?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: LO_REGNUM = %d\n",
+		      LO_REGNUM);
+#ifdef MACHINE_CPROC_FP_OFFSET
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MACHINE_CPROC_FP_OFFSET = %d\n",
+		      MACHINE_CPROC_FP_OFFSET);
+#endif
+#ifdef MACHINE_CPROC_PC_OFFSET
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MACHINE_CPROC_PC_OFFSET = %d\n",
+		      MACHINE_CPROC_PC_OFFSET);
+#endif
+#ifdef MACHINE_CPROC_SP_OFFSET
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MACHINE_CPROC_SP_OFFSET = %d\n",
+		      MACHINE_CPROC_SP_OFFSET);
+#endif
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MAKE_MIPS16_ADDR = FIXME!\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS16_BIG_BREAKPOINT = delete?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS16_INSTLEN = %d\n",
+		      MIPS16_INSTLEN);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS16_LITTLE_BREAKPOINT = delete?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_DEFAULT_ABI = FIXME!\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_EFI_SYMBOL_NAME = multi-arch!!\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_INSTLEN = %d\n",
+		      MIPS_INSTLEN);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_LAST_ARG_REGNUM = %d (%d regs)\n",
+		      MIPS_LAST_ARG_REGNUM,
+		      MIPS_LAST_ARG_REGNUM - A0_REGNUM + 1);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_NUMREGS = %d\n",
+		      MIPS_NUMREGS);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_REGISTER_NAMES = delete?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MIPS_SAVED_REGSIZE = %d\n",
+		      MIPS_SAVED_REGSIZE);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MSYMBOL_IS_SPECIAL = function?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: MSYMBOL_SIZE # %s\n",
+		      XSTRING (MSYMBOL_SIZE (MSYM)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: OP_LDFPR = used?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: OP_LDGPR = used?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PMON_BIG_BREAKPOINT = delete?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PMON_LITTLE_BREAKPOINT = delete?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PRID_REGNUM = %d\n",
+		      PRID_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PRINT_EXTRA_FRAME_INFO # %s\n",
+		      XSTRING (PRINT_EXTRA_FRAME_INFO (FRAME)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PROC_DESC_IS_DUMMY = function?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PROC_FRAME_ADJUST = function?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PROC_FRAME_OFFSET = function?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PROC_FRAME_REG = function?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PROC_FREG_MASK = function?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PROC_FREG_OFFSET = function?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PROC_HIGH_ADDR = function?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PROC_LOW_ADDR = function?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PROC_PC_REG = function?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PROC_REG_MASK = function?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PROC_REG_OFFSET = function?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PROC_SYMBOL = function?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PS_REGNUM = %d\n",
+		      PS_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: PUSH_FP_REGNUM = %d\n",
+		      PUSH_FP_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: RA_REGNUM = %d\n",
+		      RA_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: REGISTER_CONVERT_FROM_TYPE # %s\n",
+		      XSTRING (REGISTER_CONVERT_FROM_TYPE (REGNUM, VALTYPE, RAW_BUFFER)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: REGISTER_CONVERT_TO_TYPE # %s\n",
+		      XSTRING (REGISTER_CONVERT_TO_TYPE (REGNUM, VALTYPE, RAW_BUFFER)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: REGISTER_NAMES = delete?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: ROUND_DOWN = function?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: ROUND_UP = function?\n");
+#ifdef SAVED_BYTES
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: SAVED_BYTES = %d\n",
+		      SAVED_BYTES);
+#endif
+#ifdef SAVED_FP
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: SAVED_FP = %d\n",
+		      SAVED_FP);
+#endif
+#ifdef SAVED_PC
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: SAVED_PC = %d\n",
+		      SAVED_PC);
+#endif
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: SETUP_ARBITRARY_FRAME # %s\n",
+		      XSTRING (SETUP_ARBITRARY_FRAME (NUMARGS, ARGS)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: SET_PROC_DESC_IS_DUMMY = function?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: SIGFRAME_BASE = %d\n",
+		      SIGFRAME_BASE);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: SIGFRAME_FPREGSAVE_OFF = %d\n",
+		      SIGFRAME_FPREGSAVE_OFF);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: SIGFRAME_PC_OFF = %d\n",
+		      SIGFRAME_PC_OFF);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: SIGFRAME_REGSAVE_OFF = %d\n",
+		      SIGFRAME_REGSAVE_OFF);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: SIGFRAME_REG_SIZE = %d\n",
+		      SIGFRAME_REG_SIZE);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: SKIP_TRAMPOLINE_CODE # %s\n",
+		      XSTRING (SKIP_TRAMPOLINE_CODE (PC)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: SOFTWARE_SINGLE_STEP # %s\n",
+		      XSTRING (SOFTWARE_SINGLE_STEP (SIG, BP_P)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: SOFTWARE_SINGLE_STEP_P = %d\n",
+		      SOFTWARE_SINGLE_STEP_P);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: SOFTWARE_SINGLE_STEP_P = %d\n",
+		      SOFTWARE_SINGLE_STEP_P);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: STAB_REG_TO_REGNUM # %s\n",
+		      XSTRING (STAB_REG_TO_REGNUM (REGNUM)));
+#ifdef STACK_END_ADDR
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: STACK_END_ADDR = %d\n",
+		      STACK_END_ADDR);
+#endif
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: STEP_SKIPS_DELAY # %s\n",
+		      XSTRING (STEP_SKIPS_DELAY (PC)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: STEP_SKIPS_DELAY_P = %d\n",
+		      STEP_SKIPS_DELAY_P);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: STOPPED_BY_WATCHPOINT # %s\n",
+		      XSTRING (STOPPED_BY_WATCHPOINT (WS)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: T9_REGNUM = %d\n",
+		      T9_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: TABULAR_REGISTER_OUTPUT = used?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: TARGET_CAN_USE_HARDWARE_WATCHPOINT # %s\n",
+		      XSTRING (TARGET_CAN_USE_HARDWARE_WATCHPOINT (TYPE,CNT,OTHERTYPE)));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: TARGET_HAS_HARDWARE_WATCHPOINTS # %s\n",
+		      XSTRING (TARGET_HAS_HARDWARE_WATCHPOINTS));
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: TARGET_MIPS = used?\n");
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: TM_PRINT_INSN_MACH # %s\n",
+		      XSTRING (TM_PRINT_INSN_MACH));
+#ifdef TRACE_CLEAR
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: TRACE_CLEAR # %s\n",
+		      XSTRING (TRACE_CLEAR (THREAD, STATE)));
+#endif
+#ifdef TRACE_FLAVOR
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: TRACE_FLAVOR = %d\n",
+		      TRACE_FLAVOR);
+#endif
+#ifdef TRACE_FLAVOR_SIZE
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: TRACE_FLAVOR_SIZE = %d\n",
+		      TRACE_FLAVOR_SIZE);
+#endif
+#ifdef TRACE_SET
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: TRACE_SET # %s\n",
+		      XSTRING (TRACE_SET (X,STATE)));
+#endif
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: UNMAKE_MIPS16_ADDR = function?\n");
+#ifdef UNUSED_REGNUM
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: UNUSED_REGNUM = %d\n",
+		      UNUSED_REGNUM);
+#endif
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: V0_REGNUM = %d\n",
+		      V0_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: VM_MIN_ADDRESS = %ld\n",
+		      (long) VM_MIN_ADDRESS);
+#ifdef VX_NUM_REGS
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: VX_NUM_REGS = %d (used?)\n",
+		      VX_NUM_REGS);
+#endif
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: ZERO_REGNUM = %d\n",
+		      ZERO_REGNUM);
+  fprintf_unfiltered (file,
+		      "mips_dump_tdep: _PROC_MAGIC_ = %d\n",
+		      _PROC_MAGIC_);
+}
 
 void
-_initialize_mips_tdep ()
+_initialize_mips_tdep (void)
 {
   static struct cmd_list_element *mipsfpulist = NULL;
   struct cmd_list_element *c;
 
-  if (GDB_MULTI_ARCH)
-    register_gdbarch_init (bfd_arch_mips, mips_gdbarch_init);
+  gdbarch_register (bfd_arch_mips, mips_gdbarch_init, mips_dump_tdep);
   if (!tm_print_insn)		/* Someone may have already set it */
     tm_print_insn = gdb_print_insn_mips;
 
@@ -4190,7 +4581,7 @@
 	   "Select single-precision MIPS floating-point coprocessor.",
 	   &mipsfpulist);
   add_cmd ("double", class_support, set_mipsfpu_double_command,
-	   "Select double-precision MIPS floating-point coprocessor .",
+	   "Select double-precision MIPS floating-point coprocessor.",
 	   &mipsfpulist);
   add_alias_cmd ("on", "double", class_support, 1, &mipsfpulist);
   add_alias_cmd ("yes", "double", class_support, 1, &mipsfpulist);
@@ -4241,12 +4632,13 @@
 
   /* Allow the user to control whether the upper bits of 64-bit
      addresses should be zeroed.  */
-  add_show_from_set
-    (add_set_cmd ("mask-address", no_class, var_boolean, (char *) &mask_address_p,
-		  "Set zeroing of upper 32 bits of 64-bit addresses.\n\
-Use \"on\" to enable the masking, and \"off\" to disable it.\n\
-Without an argument, zeroing of upper address bits is enabled.", &setlist),
-     &showlist);
+  c = add_set_auto_boolean_cmd ("mask-address", no_class, &mask_address_var,
+				"Set zeroing of upper 32 bits of 64-bit addresses.\n\
+Use \"on\" to enable the masking, \"off\" to disable it and \"auto\" to allow GDB to determine\n\
+the correct value.\n",
+				&setmipscmdlist);
+  add_cmd ("mask-address", no_class, show_mask_address,
+	       "Show current mask-address value", &showmipscmdlist);
 
   /* Allow the user to control the size of 32 bit registers within the
      raw remote packet.  */
@@ -4260,4 +4652,11 @@
 64 bits for others.  Use \"off\" to disable compatibility mode",
 				  &setlist),
 		     &showlist);
+
+  /* Debug this files internals. */
+  add_show_from_set (add_set_cmd ("mips", class_maintenance, var_zinteger,
+				  &mips_debug, "Set mips debugging.\n\
+When non-zero, mips specific debugging is enabled.", &setdebuglist),
+		     &showdebuglist);
 }
+
diff --git a/gdb/mipsm3-nat.c b/gdb/mipsm3-nat.c
index 5f4d50b..ba43b8d9 100644
--- a/gdb/mipsm3-nat.c
+++ b/gdb/mipsm3-nat.c
@@ -141,8 +141,7 @@
 
 /* Fech thread's registers. if regno == -1, fetch all regs */
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   kern_return_t ret;
 
@@ -296,8 +295,7 @@
  */
 
 void
-store_inferior_registers (regno)
-     register int regno;
+store_inferior_registers (register int regno)
 {
   thread_state_data_t state;
   kern_return_t ret;
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
index 2c90b56..1a1c668 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -63,8 +63,7 @@
 extern CORE_ADDR sigtramp_address;
 
 static void
-mipscoff_new_init (ignore)
-     struct objfile *ignore;
+mipscoff_new_init (struct objfile *ignore)
 {
   sigtramp_address = 0;
   stabsread_new_init ();
@@ -74,17 +73,14 @@
 /* Initialize to read a symbol file (nothing to do).  */
 
 static void
-mipscoff_symfile_init (objfile)
-     struct objfile *objfile;
+mipscoff_symfile_init (struct objfile *objfile)
 {
 }
 
 /* Read a symbol file from a file.  */
 
 static void
-mipscoff_symfile_read (objfile, mainline)
-     struct objfile *objfile;
-     int mainline;
+mipscoff_symfile_read (struct objfile *objfile, int mainline)
 {
   bfd *abfd = objfile->obfd;
   struct cleanup *back_to;
@@ -136,8 +132,7 @@
    particular objfile.  */
 
 static void
-mipscoff_symfile_finish (objfile)
-     struct objfile *objfile;
+mipscoff_symfile_finish (struct objfile *objfile)
 {
 }
 
@@ -198,10 +193,7 @@
    if so, stash away some access information for the section.  */
 
 static void
-alphacoff_locate_sections (ignore_abfd, sectp, sip)
-     bfd *ignore_abfd;
-     asection *sectp;
-     PTR sip;
+alphacoff_locate_sections (bfd *ignore_abfd, asection *sectp, PTR sip)
 {
   register struct alphacoff_dynsecinfo *si;
 
@@ -229,9 +221,8 @@
    add them to the minimal symbol table.  */
 
 static void
-read_alphacoff_dynamic_symtab (section_offsets, objfile)
-     struct section_offsets *section_offsets;
-     struct objfile *objfile;
+read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets,
+			       struct objfile *objfile)
 {
   bfd *abfd = objfile->obfd;
   struct alphacoff_dynsecinfo si;
@@ -443,7 +434,7 @@
 };
 
 void
-_initialize_mipsread ()
+_initialize_mipsread (void)
 {
   add_symtab_fns (&ecoff_sym_fns);
 }
diff --git a/gdb/mipsv4-nat.c b/gdb/mipsv4-nat.c
index 01ac8c0..cca4006 100644
--- a/gdb/mipsv4-nat.c
+++ b/gdb/mipsv4-nat.c
@@ -42,8 +42,7 @@
  */
 
 void
-supply_gregset (gregsetp)
-     gregset_t *gregsetp;
+supply_gregset (gregset_t *gregsetp)
 {
   register int regi;
   register greg_t *regp = &(*gregsetp)[0];
@@ -68,9 +67,7 @@
 }
 
 void
-fill_gregset (gregsetp, regno)
-     gregset_t *gregsetp;
-     int regno;
+fill_gregset (gregset_t *gregsetp, int regno)
 {
   int regi;
   register greg_t *regp = &(*gregsetp)[0];
@@ -101,8 +98,7 @@
  */
 
 void
-supply_fpregset (fpregsetp)
-     fpregset_t *fpregsetp;
+supply_fpregset (fpregset_t *fpregsetp)
 {
   register int regi;
   static char zerobuf[MAX_REGISTER_RAW_SIZE] =
@@ -119,9 +115,7 @@
 }
 
 void
-fill_fpregset (fpregsetp, regno)
-     fpregset_t *fpregsetp;
-     int regno;
+fill_fpregset (fpregset_t *fpregsetp, int regno)
 {
   int regi;
   char *from, *to;
@@ -147,12 +141,12 @@
    This routine returns true on success. */
 
 int
-get_longjmp_target (pc)
-     CORE_ADDR *pc;
+get_longjmp_target (CORE_ADDR *pc)
 {
-  char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
+  char *buf;
   CORE_ADDR jb_addr;
 
+  buf = alloca (TARGET_PTR_BIT / TARGET_CHAR_BIT);
   jb_addr = read_register (A0_REGNUM);
 
   if (target_read_memory (jb_addr + _JB_PC * JB_ELEMENT_SIZE, buf,
diff --git a/gdb/mn10200-tdep.c b/gdb/mn10200-tdep.c
index f8637e8..59cf238 100644
--- a/gdb/mn10200-tdep.c
+++ b/gdb/mn10200-tdep.c
@@ -32,9 +32,7 @@
 
 /* Should call_function allocate stack space for a struct return?  */
 int
-mn10200_use_struct_convention (gcc_p, type)
-     int gcc_p;
-     struct type *type;
+mn10200_use_struct_convention (int gcc_p, struct type *type)
 {
   return (TYPE_NFIELDS (type) > 1 || TYPE_LENGTH (type) > 8);
 }
@@ -112,9 +110,7 @@
 #define NO_MORE_FRAMES 0x8
 
 static CORE_ADDR
-mn10200_analyze_prologue (fi, pc)
-     struct frame_info *fi;
-     CORE_ADDR pc;
+mn10200_analyze_prologue (struct frame_info *fi, CORE_ADDR pc)
 {
   CORE_ADDR func_addr, func_end, addr, stop;
   CORE_ADDR stack_size;
@@ -609,8 +605,7 @@
    stack pointer that was in use at the time the function call was made?  */
 
 CORE_ADDR
-mn10200_frame_chain (fi)
-     struct frame_info *fi;
+mn10200_frame_chain (struct frame_info *fi)
 {
   struct frame_info dummy_frame;
 
@@ -674,8 +669,7 @@
    Return the address of the first inst past the prologue of the function.  */
 
 CORE_ADDR
-mn10200_skip_prologue (pc)
-     CORE_ADDR pc;
+mn10200_skip_prologue (CORE_ADDR pc)
 {
   /* We used to check the debug symbols, but that can lose if
      we have a null prologue.  */
@@ -687,8 +681,7 @@
    command, or the call dummy breakpoint gets hit.  */
 
 void
-mn10200_pop_frame (frame)
-     struct frame_info *frame;
+mn10200_pop_frame (struct frame_info *frame)
 {
   int regnum;
 
@@ -724,12 +717,8 @@
    order on the stack.  */
 
 CORE_ADDR
-mn10200_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     unsigned char struct_return;
-     CORE_ADDR struct_addr;
+mn10200_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+			unsigned char struct_return, CORE_ADDR struct_addr)
 {
   int argnum = 0;
   int len = 0;
@@ -833,9 +822,7 @@
    Needed for targets where we don't actually execute a JSR/BSR instruction */
 
 CORE_ADDR
-mn10200_push_return_address (pc, sp)
-     CORE_ADDR pc;
-     CORE_ADDR sp;
+mn10200_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
 {
   unsigned char buf[4];
 
@@ -849,9 +836,7 @@
    call.  */
 
 CORE_ADDR
-mn10200_store_struct_return (addr, sp)
-     CORE_ADDR addr;
-     CORE_ADDR sp;
+mn10200_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
 {
   /* The structure return address is passed as the first argument.  */
   write_register (0, addr);
@@ -866,8 +851,7 @@
    will be found.  */
 
 CORE_ADDR
-mn10200_frame_saved_pc (fi)
-     struct frame_info *fi;
+mn10200_frame_saved_pc (struct frame_info *fi)
 {
   /* The saved PC will always be at the base of the current frame.  */
   return (read_memory_integer (fi->frame, REGISTER_SIZE) & 0xffffff);
@@ -888,8 +872,7 @@
    pointer just prior to calling the target function (see run_stack_dummy).  */
 
 void
-mn10200_init_extra_frame_info (fi)
-     struct frame_info *fi;
+mn10200_init_extra_frame_info (struct frame_info *fi)
 {
   if (fi->next)
     fi->pc = FRAME_SAVED_PC (fi->next);
@@ -902,7 +885,7 @@
 }
 
 void
-_initialize_mn10200_tdep ()
+_initialize_mn10200_tdep (void)
 {
   tm_print_insn = print_insn_mn10200;
 }
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index 8311a9e..ef43ff7 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1,5 +1,5 @@
 /* Target-dependent code for the Matsushita MN10300 for GDB, the GNU debugger.
-   Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -33,6 +33,13 @@
 static CORE_ADDR mn10300_analyze_prologue (struct frame_info *fi,
 					   CORE_ADDR pc);
 
+/* mn10300 private data */
+struct gdbarch_tdep
+{
+  int am33_mode;
+#define AM33_MODE (gdbarch_tdep (current_gdbarch)->am33_mode)
+};
+
 /* Additional info used by the frame */
 
 struct frame_extra_info
@@ -42,40 +49,48 @@
   };
 
 
-static char *mn10300_generic_register_names[] =
-{"d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
- "sp", "pc", "mdr", "psw", "lir", "lar", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "fp"};
-
-static char **mn10300_register_names = mn10300_generic_register_names;
-static char *am33_register_names[] =
+static char *
+register_name (int reg, char **regs, long sizeof_regs)
 {
-  "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
-  "sp", "pc", "mdr", "psw", "lir", "lar", "",
-  "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
-  "ssp", "msp", "usp", "mcrh", "mcrl", "mcvf", "", "", ""};
-static int am33_mode;
-
-char *
-mn10300_register_name (i)
-     int i;
-{
-  return mn10300_register_names[i];
+  if (reg < 0 || reg >= sizeof_regs / sizeof (regs[0]))
+    return NULL;
+  else
+    return regs[reg];
 }
 
+static char *
+mn10300_generic_register_name (int reg)
+{
+  static char *regs[] =
+  { "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
+    "sp", "pc", "mdr", "psw", "lir", "lar", "", "",
+    "", "", "", "", "", "", "", "",
+    "", "", "", "", "", "", "", "fp"
+  };
+  return register_name (reg, regs, sizeof regs);
+}
+
+
+static char *
+am33_register_name (int reg)
+{
+  static char *regs[] =
+  { "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
+    "sp", "pc", "mdr", "psw", "lir", "lar", "",
+    "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+    "ssp", "msp", "usp", "mcrh", "mcrl", "mcvf", "", "", ""
+  };
+  return register_name (reg, regs, sizeof regs);
+}
+  
 CORE_ADDR
-mn10300_saved_pc_after_call (fi)
-     struct frame_info *fi;
+mn10300_saved_pc_after_call (struct frame_info *fi)
 {
   return read_memory_integer (read_register (SP_REGNUM), 4);
 }
 
 void
-mn10300_extract_return_value (type, regbuf, valbuf)
-     struct type *type;
-     char *regbuf;
-     char *valbuf;
+mn10300_extract_return_value (struct type *type, char *regbuf, char *valbuf)
 {
   if (TYPE_CODE (type) == TYPE_CODE_PTR)
     memcpy (valbuf, regbuf + REGISTER_BYTE (4), TYPE_LENGTH (type));
@@ -84,17 +99,14 @@
 }
 
 CORE_ADDR
-mn10300_extract_struct_value_address (regbuf)
-     char *regbuf;
+mn10300_extract_struct_value_address (char *regbuf)
 {
   return extract_address (regbuf + REGISTER_BYTE (4),
 			  REGISTER_RAW_SIZE (4));
 }
 
 void
-mn10300_store_return_value (type, valbuf)
-     struct type *type;
-     char *valbuf;
+mn10300_store_return_value (struct type *type, char *valbuf)
 {
   if (TYPE_CODE (type) == TYPE_CODE_PTR)
     write_register_bytes (REGISTER_BYTE (4), valbuf, TYPE_LENGTH (type));
@@ -104,9 +116,7 @@
 
 static struct frame_info *analyze_dummy_frame (CORE_ADDR, CORE_ADDR);
 static struct frame_info *
-analyze_dummy_frame (pc, frame)
-     CORE_ADDR pc;
-     CORE_ADDR frame;
+analyze_dummy_frame (CORE_ADDR pc, CORE_ADDR frame)
 {
   static struct frame_info *dummy = NULL;
   if (dummy == NULL)
@@ -135,9 +145,7 @@
 
 /* Should call_function allocate stack space for a struct return?  */
 int
-mn10300_use_struct_convention (gcc_p, type)
-     int gcc_p;
-     struct type *type;
+mn10300_use_struct_convention (int gcc_p, struct type *type)
 {
   return (TYPE_NFIELDS (type) > 1 || TYPE_LENGTH (type) > 8);
 }
@@ -150,9 +158,7 @@
    one, so we defined it ourselves.  */
 
 unsigned char *
-mn10300_breakpoint_from_pc (bp_addr, bp_size)
-     CORE_ADDR *bp_addr;
-     int *bp_size;
+mn10300_breakpoint_from_pc (CORE_ADDR *bp_addr, int *bp_size)
 {
   static char breakpoint[] =
   {0xff};
@@ -165,9 +171,7 @@
    function for mn10300_analyze_prologue. */
 
 static void
-fix_frame_pointer (fi, stack_size)
-     struct frame_info *fi;
-     int stack_size;
+fix_frame_pointer (struct frame_info *fi, int stack_size)
 {
   if (fi && fi->next == NULL)
     {
@@ -183,9 +187,7 @@
    This is a helper function for mn10300_analyze_prologue.  */
 
 static void
-set_movm_offsets (fi, movm_args)
-     struct frame_info *fi;
-     int movm_args;
+set_movm_offsets (struct frame_info *fi, int movm_args)
 {
   int offset = 0;
 
@@ -212,7 +214,7 @@
       fi->saved_regs[D2_REGNUM] = fi->frame + offset;
       offset += 4;
     }
-  if (am33_mode && movm_args & 0x02)
+  if (AM33_MODE && movm_args & 0x02)
     {
       fi->saved_regs[E0_REGNUM + 5] = fi->frame + offset;
       fi->saved_regs[E0_REGNUM + 4] = fi->frame + offset + 4;
@@ -271,9 +273,7 @@
    frame chain to not bother trying to unwind past this frame.  */
 
 static CORE_ADDR
-mn10300_analyze_prologue (fi, pc)
-     struct frame_info *fi;
-     CORE_ADDR pc;
+mn10300_analyze_prologue (struct frame_info *fi, CORE_ADDR pc)
 {
   CORE_ADDR func_addr, func_end, addr, stop;
   CORE_ADDR stack_size;
@@ -515,8 +515,7 @@
    stack pointer that was in use at the time the function call was made?  */
 
 CORE_ADDR
-mn10300_frame_chain (fi)
-     struct frame_info *fi;
+mn10300_frame_chain (struct frame_info *fi)
 {
   struct frame_info *dummy;
   /* Walk through the prologue to determine the stack size,
@@ -564,7 +563,7 @@
       adjust += (fi->saved_regs[D3_REGNUM] ? 4 : 0);
       adjust += (fi->saved_regs[A2_REGNUM] ? 4 : 0);
       adjust += (fi->saved_regs[A3_REGNUM] ? 4 : 0);
-      if (am33_mode)
+      if (AM33_MODE)
 	{
 	  adjust += (fi->saved_regs[E0_REGNUM + 5] ? 4 : 0);
 	  adjust += (fi->saved_regs[E0_REGNUM + 4] ? 4 : 0);
@@ -583,8 +582,7 @@
    Return the address of the first inst past the prologue of the function.  */
 
 CORE_ADDR
-mn10300_skip_prologue (pc)
-     CORE_ADDR pc;
+mn10300_skip_prologue (CORE_ADDR pc)
 {
   /* We used to check the debug symbols, but that can lose if
      we have a null prologue.  */
@@ -597,8 +595,7 @@
    command, or the call dummy breakpoint gets hit.  */
 
 void
-mn10300_pop_frame (frame)
-     struct frame_info *frame;
+mn10300_pop_frame (struct frame_info *frame)
 {
   int regnum;
 
@@ -634,12 +631,8 @@
    order on the stack.  */
 
 CORE_ADDR
-mn10300_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     unsigned char struct_return;
-     CORE_ADDR struct_addr;
+mn10300_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
+			int struct_return, CORE_ADDR struct_addr)
 {
   int argnum = 0;
   int len = 0;
@@ -719,9 +712,7 @@
    Needed for targets where we don't actually execute a JSR/BSR instruction */
 
 CORE_ADDR
-mn10300_push_return_address (pc, sp)
-     CORE_ADDR pc;
-     CORE_ADDR sp;
+mn10300_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
 {
   unsigned char buf[4];
 
@@ -735,9 +726,7 @@
    call.  */
 
 CORE_ADDR
-mn10300_store_struct_return (addr, sp)
-     CORE_ADDR addr;
-     CORE_ADDR sp;
+mn10300_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
 {
   /* The structure return address is passed as the first argument.  */
   write_register (0, addr);
@@ -752,8 +741,7 @@
    will be found.  */
 
 CORE_ADDR
-mn10300_frame_saved_pc (fi)
-     struct frame_info *fi;
+mn10300_frame_saved_pc (struct frame_info *fi)
 {
   int adjust = 0;
 
@@ -761,7 +749,7 @@
   adjust += (fi->saved_regs[D3_REGNUM] ? 4 : 0);
   adjust += (fi->saved_regs[A2_REGNUM] ? 4 : 0);
   adjust += (fi->saved_regs[A3_REGNUM] ? 4 : 0);
-  if (am33_mode)
+  if (AM33_MODE)
     {
       adjust += (fi->saved_regs[E0_REGNUM + 5] ? 4 : 0);
       adjust += (fi->saved_regs[E0_REGNUM + 4] ? 4 : 0);
@@ -787,8 +775,7 @@
    pointer just prior to calling the target function (see run_stack_dummy).  */
 
 void
-mn10300_init_extra_frame_info (fi)
-     struct frame_info *fi;
+mn10300_init_extra_frame_info (struct frame_info *fi)
 {
   if (fi->next)
     fi->pc = FRAME_SAVED_PC (fi->next);
@@ -809,10 +796,7 @@
    any frame pointer offsets.  */
 
 void
-mn10300_virtual_frame_pointer (pc, reg, offset)
-     CORE_ADDR pc;
-     long *reg;
-     long *offset;
+mn10300_virtual_frame_pointer (CORE_ADDR pc, long *reg, long *offset)
 {
   struct frame_info *dummy = analyze_dummy_frame (pc, 0);
   /* Set up a dummy frame_info, Analyze the prolog and fill in the
@@ -830,34 +814,201 @@
     }
 }
 
-/* This can be made more generic later.  */
-static void
-set_machine_hook (filename)
-     char *filename;
+static int
+mn10300_reg_struct_has_addr (int gcc_p, struct type *type)
 {
-  int i;
+  return (TYPE_LENGTH (type) > 8);
+}
 
-  if (bfd_get_mach (exec_bfd) == bfd_mach_mn10300
-      || bfd_get_mach (exec_bfd) == 0)
+static struct type *
+mn10300_register_virtual_type (int reg)
+{
+  return builtin_type_int;
+}
+
+static int
+mn10300_register_byte (int reg)
+{
+  return (reg * 4);
+}
+
+static int
+mn10300_register_virtual_size (int reg)
+{
+  return 4;
+}
+
+static int
+mn10300_register_raw_size (int reg)
+{
+  return 4;
+}
+
+static void
+mn10300_print_register (const char *name, int regnum, int reg_width)
+{
+  char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
+
+  if (reg_width)
+    printf_filtered ("%*s: ", reg_width, name);
+  else
+    printf_filtered ("%s: ", name);
+
+  /* Get the data */
+  if (read_relative_register_raw_bytes (regnum, raw_buffer))
     {
-      mn10300_register_names = mn10300_generic_register_names;
+      printf_filtered ("[invalid]");
+      return;
     }
-
-  am33_mode = 0;
-  if (bfd_get_mach (exec_bfd) == bfd_mach_am33)
+  else
     {
-
-      mn10300_register_names = am33_register_names;
-      am33_mode = 1;
+      int byte;
+      if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+	{
+	  for (byte = REGISTER_RAW_SIZE (regnum) - REGISTER_VIRTUAL_SIZE (regnum);
+	       byte < REGISTER_RAW_SIZE (regnum);
+	       byte++)
+	    printf_filtered ("%02x", (unsigned char) raw_buffer[byte]);
+	}
+      else
+	{
+	  for (byte = REGISTER_VIRTUAL_SIZE (regnum) - 1;
+	       byte >= 0;
+	       byte--)
+	    printf_filtered ("%02x", (unsigned char) raw_buffer[byte]);
+	}
     }
 }
 
+static void
+mn10300_do_registers_info (int regnum, int fpregs)
+{
+  if (regnum >= 0)
+    {
+      const char *name = REGISTER_NAME (regnum);
+      if (name == NULL || name[0] == '\0')
+	error ("Not a valid register for the current processor type");
+      mn10300_print_register (name, regnum, 0);
+      printf_filtered ("\n");
+    }
+  else
+    {
+      /* print registers in an array 4x8 */
+      int r;
+      int reg;
+      const int nr_in_row = 4;
+      const int reg_width = 4;
+      for (r = 0; r < NUM_REGS; r += nr_in_row)
+	{
+	  int c;
+	  int printing = 0;
+	  int padding = 0;
+	  for (c = r; c < r + nr_in_row; c++)
+	    {
+	      const char *name = REGISTER_NAME (c);
+	      if (name != NULL && *name != '\0')
+		{
+		  printing = 1;
+		  while (padding > 0)
+		    {
+		      printf_filtered (" ");
+		      padding--;
+		    }
+		  mn10300_print_register (name, c, reg_width);
+		  printf_filtered (" ");
+		}
+	      else
+		{
+		  padding += (reg_width + 2 + 8 + 1);
+		}
+	    }
+	  if (printing)
+	    printf_filtered ("\n");
+	}
+    }
+}
+
+/* Dump out the mn10300 speciic architecture information. */
+
+static void
+mn10300_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  fprintf_unfiltered (file, "mn10300_dump_tdep: am33_mode = %d\n",
+		      tdep->am33_mode);
+}
+
+static struct gdbarch *
+mn10300_gdbarch_init (struct gdbarch_info info,
+		      struct gdbarch_list *arches)
+{
+  struct gdbarch *gdbarch;
+  struct gdbarch_tdep *tdep = NULL;
+  int am33_mode;
+  gdbarch_register_name_ftype *register_name;
+  int mach;
+  int num_regs;
+
+  arches = gdbarch_list_lookup_by_info (arches, &info);
+  if (arches != NULL)
+    return arches->gdbarch;
+  tdep = xmalloc (sizeof (struct gdbarch_tdep));
+  gdbarch = gdbarch_alloc (&info, tdep);
+
+  if (info.bfd_arch_info != NULL
+      && info.bfd_arch_info->arch == bfd_arch_mn10300)
+    mach = info.bfd_arch_info->mach;
+  else
+    mach = 0;
+  switch (mach)
+    {
+    case 0:
+    case bfd_mach_mn10300:
+      am33_mode = 0;
+      register_name = mn10300_generic_register_name;
+      num_regs = 32;
+      break;
+    case bfd_mach_am33:
+      am33_mode = 1;
+      register_name = am33_register_name;
+      num_regs = 32;
+      break;
+    default:
+      internal_error ("mn10300_gdbarch_init: Unknown mn10300 variant");
+      return NULL; /* keep GCC happy. */
+    }
+
+  set_gdbarch_register_size (gdbarch, 4);
+  set_gdbarch_max_register_raw_size (gdbarch, 4);
+  set_gdbarch_register_virtual_type (gdbarch, mn10300_register_virtual_type);
+  set_gdbarch_register_byte (gdbarch, mn10300_register_byte);
+  set_gdbarch_register_virtual_size (gdbarch, mn10300_register_virtual_size);
+  set_gdbarch_register_raw_size (gdbarch, mn10300_register_raw_size);
+  set_gdbarch_call_dummy_p (gdbarch, 1);
+  set_gdbarch_register_name (gdbarch, register_name);
+  set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
+  set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 0);
+  set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
+  set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
+  set_gdbarch_push_arguments (gdbarch, mn10300_push_arguments);
+  set_gdbarch_push_return_address (gdbarch, mn10300_push_return_address);
+  set_gdbarch_frame_chain_valid (gdbarch, generic_file_frame_chain_valid);
+  set_gdbarch_reg_struct_has_addr (gdbarch, mn10300_reg_struct_has_addr);
+  set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+  set_gdbarch_num_regs (gdbarch, num_regs);
+  set_gdbarch_do_registers_info (gdbarch, mn10300_do_registers_info);
+
+  tdep->am33_mode = am33_mode;
+
+  return gdbarch;
+}
+ 
 void
-_initialize_mn10300_tdep ()
+_initialize_mn10300_tdep (void)
 {
 /*  printf("_initialize_mn10300_tdep\n"); */
 
   tm_print_insn = print_insn_mn10300;
 
-  specify_exec_file_hook (set_machine_hook);
+  register_gdbarch_init (bfd_arch_mn10300, mn10300_gdbarch_init);
 }
diff --git a/gdb/mon960-rom.c b/gdb/mon960-rom.c
index 1912397..a761fc2 100644
--- a/gdb/mon960-rom.c
+++ b/gdb/mon960-rom.c
@@ -39,9 +39,7 @@
 #ifdef USE_GENERIC_LOAD
 
 static void
-mon960_load_gen (filename, from_tty)
-     char *filename;
-     int from_tty;
+mon960_load_gen (char *filename, int from_tty)
 {
   extern int inferior_pid;
 
@@ -56,10 +54,7 @@
 #else
 
 static void
-mon960_load (desc, file, hashmark)
-     serial_t desc;
-     char *file;
-     int hashmark;
+mon960_load (serial_t desc, char *file, int hashmark)
 {
   bfd *abfd;
   asection *s;
@@ -217,9 +212,7 @@
 };
 
 static void
-mon960_open (args, from_tty)
-     char *args;
-     int from_tty;
+mon960_open (char *args, int from_tty)
 {
   char buf[64];
 
@@ -242,7 +235,7 @@
 }
 
 void
-_initialize_mon960 ()
+_initialize_mon960 (void)
 {
   memcpy (mon960_regnames, full_regnames, sizeof (full_regnames));
 
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 0381754..ea7189b 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -23,7 +23,7 @@
 /* This file was derived from various remote-* modules. It is a collection
    of generic support functions so GDB can talk directly to a ROM based
    monitor. This saves use from having to hack an exception based handler
-   into existance, and makes for quick porting.
+   into existence, and makes for quick porting.
 
    This module talks to a debug monitor called 'MONITOR', which
    We communicate with MONITOR via either a direct serial line, or a TCP
@@ -51,7 +51,6 @@
 #include "gdbcmd.h"
 #include "inferior.h"
 #include "gdb_regex.h"
-#include "dcache.h"
 #include "srec.h"
 
 static char *dev_name;
@@ -130,7 +129,6 @@
 static int dump_reg_flag;	/* Non-zero means do a dump_registers cmd when
 				   monitor_wait wakes up.  */
 
-static DCACHE *remote_dcache;
 static int first_time = 0;	/* is this the first time we're executing after 
 				   gaving created the child proccess? */
 
@@ -243,8 +241,7 @@
 /* Convert hex digit A to a number.  */
 
 static int
-fromhex (a)
-     int a;
+fromhex (int a)
 {
   if (a >= '0' && a <= '9')
     return a - '0';
@@ -271,10 +268,7 @@
  */
 
 static void
-monitor_vsprintf (sndbuf, pattern, args)
-     char *sndbuf;
-     char *pattern;
-     va_list args;
+monitor_vsprintf (char *sndbuf, char *pattern, va_list args)
 {
   char format[10];
   char fmt;
@@ -391,9 +385,7 @@
 /* Write characters to the remote system.  */
 
 void
-monitor_write (buf, buflen)
-     char *buf;
-     int buflen;
+monitor_write (char *buf, int buflen)
 {
   if (SERIAL_WRITE (monitor_desc, buf, buflen))
     fprintf_unfiltered (gdb_stderr, "SERIAL_WRITE failed: %s\n",
@@ -406,7 +398,7 @@
    and without printing remote debug information.  */
 
 int
-monitor_readchar ()
+monitor_readchar (void)
 {
   int c;
   int looping;
@@ -435,8 +427,7 @@
    timeout stuff.  */
 
 static int
-readchar (timeout)
-     int timeout;
+readchar (int timeout)
 {
   int c;
   static enum
@@ -514,10 +505,7 @@
    will be at the end of BUF.  */
 
 int
-monitor_expect (string, buf, buflen)
-     char *string;
-     char *buf;
-     int buflen;
+monitor_expect (char *string, char *buf, int buflen)
 {
   char *p = string;
   int obuflen = buflen;
@@ -531,7 +519,7 @@
       fprintf_unfiltered (gdb_stdlog, "MON Expecting '%s'\n", safe_string);
     }
 
-  immediate_quit = 1;
+  immediate_quit++;
   while (1)
     {
       if (buf)
@@ -539,7 +527,7 @@
 	  if (buflen < 2)
 	    {
 	      *buf = '\000';
-	      immediate_quit = 0;
+	      immediate_quit--;
 	      return -1;
 	    }
 
@@ -559,7 +547,7 @@
 	  p++;
 	  if (*p == '\0')
 	    {
-	      immediate_quit = 0;
+	      immediate_quit--;
 
 	      if (buf)
 		{
@@ -622,10 +610,7 @@
 /* Search for a regexp.  */
 
 static int
-monitor_expect_regexp (pat, buf, buflen)
-     struct re_pattern_buffer *pat;
-     char *buf;
-     int buflen;
+monitor_expect_regexp (struct re_pattern_buffer *pat, char *buf, int buflen)
 {
   char *mybuf;
   char *p;
@@ -676,9 +661,7 @@
    getting into states from which we can't recover.  */
 
 int
-monitor_expect_prompt (buf, buflen)
-     char *buf;
-     int buflen;
+monitor_expect_prompt (char *buf, int buflen)
 {
   monitor_debug ("MON Expecting prompt\n");
   return monitor_expect (current_monitor->prompt, buf, buflen);
@@ -689,7 +672,7 @@
 
 #if 0
 static unsigned long
-get_hex_word ()
+get_hex_word (void)
 {
   unsigned long val;
   int i;
@@ -714,10 +697,8 @@
 #endif
 
 static void
-compile_pattern (pattern, compiled_pattern, fastmap)
-     char *pattern;
-     struct re_pattern_buffer *compiled_pattern;
-     char *fastmap;
+compile_pattern (char *pattern, struct re_pattern_buffer *compiled_pattern,
+		 char *fastmap)
 {
   int tmp;
   const char *val;
@@ -741,10 +722,7 @@
    for communication.  */
 
 void
-monitor_open (args, mon_ops, from_tty)
-     char *args;
-     struct monitor_ops *mon_ops;
-     int from_tty;
+monitor_open (char *args, struct monitor_ops *mon_ops, int from_tty)
 {
   char *name;
   char **p;
@@ -774,7 +752,7 @@
   unpush_target (targ_ops);
 
   if (dev_name)
-    free (dev_name);
+    xfree (dev_name);
   dev_name = strsave (args);
 
   monitor_desc = SERIAL_OPEN (dev_name);
@@ -858,10 +836,6 @@
 
   monitor_printf (current_monitor->line_term);
 
-  if (current_monitor->flags & MO_HAS_BLOCKWRITES)
-    remote_dcache = dcache_init (monitor_read_memory, monitor_write_memory_block);
-  else
-    remote_dcache = dcache_init (monitor_read_memory, monitor_write_memory);
   start_remote ();
 }
 
@@ -869,8 +843,7 @@
    control.  */
 
 void
-monitor_close (quitting)
-     int quitting;
+monitor_close (int quitting)
 {
   if (monitor_desc)
     SERIAL_CLOSE (monitor_desc);
@@ -878,7 +851,7 @@
   /* Free breakpoint memory */
   if (breakaddr != NULL)
     {
-      free (breakaddr);
+      xfree (breakaddr);
       breakaddr = NULL;
     }
 
@@ -889,9 +862,7 @@
    when you want to detach and do something else with your gdb.  */
 
 static void
-monitor_detach (args, from_tty)
-     char *args;
-     int from_tty;
+monitor_detach (char *args, int from_tty)
 {
   pop_target ();		/* calls monitor_close to do the real work */
   if (from_tty)
@@ -901,9 +872,7 @@
 /* Convert VALSTR into the target byte-ordered value of REGNO and store it.  */
 
 char *
-monitor_supply_register (regno, valstr)
-     int regno;
-     char *valstr;
+monitor_supply_register (int regno, char *valstr)
 {
   ULONGEST val;
   unsigned char regbuf[MAX_REGISTER_RAW_SIZE];
@@ -949,16 +918,8 @@
 
 /* Tell the remote machine to resume.  */
 
-void
-flush_monitor_dcache ()
-{
-  dcache_flush (remote_dcache);
-}
-
 static void
-monitor_resume (pid, step, sig)
-     int pid, step;
-     enum target_signal sig;
+monitor_resume (int pid, int step, enum target_signal sig)
 {
   /* Some monitors require a different command when starting a program */
   monitor_debug ("MON resume\n");
@@ -970,7 +931,6 @@
 	dump_reg_flag = 1;
       return;
     }
-  dcache_flush (remote_dcache);
   if (step)
     monitor_printf (current_monitor->step);
   else
@@ -990,9 +950,7 @@
    string which are passed down to monitor specific code.  */
 
 static void
-parse_register_dump (buf, len)
-     char *buf;
-     int len;
+parse_register_dump (char *buf, int len)
 {
   monitor_debug ("MON Parsing  register dump\n");
   while (1)
@@ -1025,8 +983,7 @@
    packet.  */
 
 static void
-monitor_interrupt (signo)
-     int signo;
+monitor_interrupt (int signo)
 {
   /* If this doesn't work, try more severe steps.  */
   signal (signo, monitor_interrupt_twice);
@@ -1040,8 +997,7 @@
 /* The user typed ^C twice.  */
 
 static void
-monitor_interrupt_twice (signo)
-     int signo;
+monitor_interrupt_twice (int signo)
 {
   signal (signo, ofunc);
 
@@ -1053,7 +1009,7 @@
 /* Ask the user what to do when an interrupt is received.  */
 
 static void
-monitor_interrupt_query ()
+monitor_interrupt_query (void)
 {
   target_terminal_ours ();
 
@@ -1068,8 +1024,7 @@
 }
 
 static void
-monitor_wait_cleanup (old_timeout)
-     void *old_timeout;
+monitor_wait_cleanup (void *old_timeout)
 {
   timeout = *(int *) old_timeout;
   signal (SIGINT, ofunc);
@@ -1115,9 +1070,7 @@
    status just as `wait' would.  */
 
 static int
-monitor_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+monitor_wait (int pid, struct target_waitstatus *status)
 {
   int old_timeout = timeout;
   char buf[TARGET_BUF_SIZE];
@@ -1200,8 +1153,7 @@
    errno value.  */
 
 static void
-monitor_fetch_register (regno)
-     int regno;
+monitor_fetch_register (int regno)
 {
   char *name;
   char *zerobuf;
@@ -1320,7 +1272,7 @@
 /* Call the specific function if it has been provided */
 
 static void
-monitor_dump_regs ()
+monitor_dump_regs (void)
 {
   char buf[TARGET_BUF_SIZE];
   int resp_len;
@@ -1337,8 +1289,7 @@
 }
 
 static void
-monitor_fetch_registers (regno)
-     int regno;
+monitor_fetch_registers (int regno)
 {
   monitor_debug ("MON fetchregs\n");
   if (current_monitor->getreg.cmd)
@@ -1361,8 +1312,7 @@
 /* Store register REGNO, or all if REGNO == 0.  Return errno value.  */
 
 static void
-monitor_store_register (regno)
-     int regno;
+monitor_store_register (int regno)
 {
   char *name;
   ULONGEST val;
@@ -1408,8 +1358,7 @@
 /* Store the remote registers.  */
 
 static void
-monitor_store_registers (regno)
-     int regno;
+monitor_store_registers (int regno)
 {
   if (regno >= 0)
     {
@@ -1428,23 +1377,19 @@
    debugged.  */
 
 static void
-monitor_prepare_to_store ()
+monitor_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
 static void
-monitor_files_info (ops)
-     struct target_ops *ops;
+monitor_files_info (struct target_ops *ops)
 {
   printf_unfiltered ("\tAttached to %s at %d baud.\n", dev_name, baud_rate);
 }
 
 static int
-monitor_write_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+monitor_write_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   unsigned int val, hostval;
   char *cmd;
@@ -1540,10 +1485,7 @@
 
 
 static int
-monitor_write_even_block (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+monitor_write_even_block (CORE_ADDR memaddr, char *myaddr, int len)
 {
   unsigned int val;
   int written = 0;;
@@ -1570,10 +1512,7 @@
 
 
 static int
-monitor_write_memory_bytes (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+monitor_write_memory_bytes (CORE_ADDR memaddr, char *myaddr, int len)
 {
   unsigned char val;
   int written = 0;
@@ -1665,10 +1604,7 @@
    Which possably entails endian conversions
  */
 static int
-monitor_write_memory_longlongs (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+monitor_write_memory_longlongs (CORE_ADDR memaddr, char *myaddr, int len)
 {
   static char hexstage[20];	/* At least 16 digits required, plus null */
   char *endstring;
@@ -1716,10 +1652,7 @@
  */
 
 static int
-monitor_write_memory_block (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+monitor_write_memory_block (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int written;
   written = 0;
@@ -1749,10 +1682,7 @@
    which can only read a single byte/word/etc. at a time.  */
 
 static int
-monitor_read_memory_single (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+monitor_read_memory_single (CORE_ADDR memaddr, char *myaddr, int len)
 {
   unsigned int val;
   char membuf[sizeof (int) * 2 + 1];
@@ -1879,10 +1809,7 @@
    than 16 bytes at a time.  */
 
 static int
-monitor_read_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+monitor_read_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   unsigned int val;
   char buf[512];
@@ -2055,19 +1982,33 @@
   return len;
 }
 
+/* Transfer LEN bytes between target address MEMADDR and GDB address
+   MYADDR.  Returns 0 for success, errno code for failure. TARGET is
+   unused. */
+
 static int
-monitor_xfer_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* ignored */
+monitor_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		     struct target_ops *target)
 {
-  return dcache_xfer_memory (remote_dcache, memaddr, myaddr, len, write);
+  int res;
+
+  if (write)
+    {
+      if (current_monitor->flags & MO_HAS_BLOCKWRITES)
+	res = monitor_write_memory_block(memaddr, myaddr, len);
+      else
+	res = monitor_write_memory(memaddr, myaddr, len);
+    }
+  else
+    {
+      res = monitor_read_memory(memaddr, myaddr, len);
+    }
+
+  return res;
 }
 
 static void
-monitor_kill ()
+monitor_kill (void)
 {
   return;			/* ignore attempts to kill target system */
 }
@@ -2076,10 +2017,7 @@
    the program at that point.  */
 
 static void
-monitor_create_inferior (exec_file, args, env)
-     char *exec_file;
-     char *args;
-     char **env;
+monitor_create_inferior (char *exec_file, char *args, char **env)
 {
   if (args && (*args != '\000'))
     error ("Args are not supported by the monitor.");
@@ -2095,7 +2033,7 @@
    instructions.  */
 
 static void
-monitor_mourn_inferior ()
+monitor_mourn_inferior (void)
 {
   unpush_target (targ_ops);
   generic_mourn_inferior ();	/* Do all the proper things now */
@@ -2104,9 +2042,7 @@
 /* Tell the monitor to add a breakpoint.  */
 
 static int
-monitor_insert_breakpoint (addr, shadow)
-     CORE_ADDR addr;
-     char *shadow;
+monitor_insert_breakpoint (CORE_ADDR addr, char *shadow)
 {
   int i;
   unsigned char *bp;
@@ -2140,9 +2076,7 @@
 /* Tell the monitor to remove a breakpoint.  */
 
 static int
-monitor_remove_breakpoint (addr, shadow)
-     CORE_ADDR addr;
-     char *shadow;
+monitor_remove_breakpoint (CORE_ADDR addr, char *shadow)
 {
   int i;
 
@@ -2179,7 +2113,7 @@
    an S-record.  Return non-zero if the ACK is received properly.  */
 
 static int
-monitor_wait_srec_ack ()
+monitor_wait_srec_ack (void)
 {
   int ch;
 
@@ -2205,11 +2139,8 @@
 /* monitor_load -- download a file. */
 
 static void
-monitor_load (file, from_tty)
-     char *file;
-     int from_tty;
+monitor_load (char *file, int from_tty)
 {
-  dcache_flush (remote_dcache);
   monitor_debug ("MON load\n");
 
   if (current_monitor->load_routine)
@@ -2256,7 +2187,7 @@
 }
 
 static void
-monitor_stop ()
+monitor_stop (void)
 {
   monitor_debug ("MON stop\n");
   if ((current_monitor->flags & MO_SEND_BREAK_ON_STOP) != 0)
@@ -2296,8 +2227,7 @@
 
 #if 0
 static int
-from_hex (a)
-     int a;
+from_hex (int a)
 {
   if (a >= '0' && a <= '9')
     return a - '0';
@@ -2311,7 +2241,7 @@
 #endif
 
 char *
-monitor_get_dev_name ()
+monitor_get_dev_name (void)
 {
   return dev_name;
 }
@@ -2390,8 +2320,7 @@
 /* Init the target_ops structure pointed at by OPS */
 
 void
-init_monitor_ops (ops)
-     struct target_ops *ops;
+init_monitor_ops (struct target_ops *ops)
 {
   if (monitor_ops.to_magic != OPS_MAGIC)
     init_base_monitor_ops ();
@@ -2402,7 +2331,7 @@
 /* Define additional commands that are usually only used by monitors.  */
 
 void
-_initialize_remote_monitors ()
+_initialize_remote_monitors (void)
 {
   init_base_monitor_ops ();
   add_show_from_set (add_set_cmd ("hash", no_class, var_boolean,
diff --git a/gdb/monitor.h b/gdb/monitor.h
index 23fad57..562c19e 100644
--- a/gdb/monitor.h
+++ b/gdb/monitor.h
@@ -96,10 +96,10 @@
     char *dump_registers;	/* Command to dump all regs at once */
     char *register_pattern;	/* Pattern that picks out register from reg dump */
     void (*supply_register) (char *name, int namelen, char *val, int vallen);
-    void (*load_routine) PARAMS ((serial_t desc, char *file,
-				  int hashmark));	/* Download routine */
-    int (*dumpregs) PARAMS ((void));	/* routine to dump all registers */
-    int (*continue_hook) PARAMS ((void));	/* Emit the continue command */
+    void (*load_routine) (serial_t desc, char *file,
+			  int hashmark);	/* Download routine */
+    int (*dumpregs) (void);	/* routine to dump all registers */
+    int (*continue_hook) (void);	/* Emit the continue command */
     int (*wait_filter) (char *buf,	/* Maybe contains registers */
 			int bufmax,
 			int *response_length,
@@ -246,4 +246,3 @@
 extern char *monitor_get_dev_name (void);
 extern void init_monitor_ops (struct target_ops *);
 extern int monitor_dump_reg_block (char *dump_cmd);
-extern void flush_monitor_dcache (void);
diff --git a/gdb/news-xdep.c b/gdb/news-xdep.c
index b3732fb..9f32b43 100644
--- a/gdb/news-xdep.c
+++ b/gdb/news-xdep.c
@@ -55,8 +55,7 @@
 
  */
 
-execle (name, args)
-     char *name, *args;
+execle (char *name, char *args)
 {
   register char **env = &args;
   while (*env++)
diff --git a/gdb/nindy-tdep.c b/gdb/nindy-tdep.c
index 4f4fd53..eb1d7bd 100644
--- a/gdb/nindy-tdep.c
+++ b/gdb/nindy-tdep.c
@@ -34,9 +34,7 @@
    they display this frame.  */
 
 int
-nindy_frame_chain_valid (chain, curframe)
-     CORE_ADDR chain;
-     struct frame_info *curframe;
+nindy_frame_chain_valid (CORE_ADDR chain, struct frame_info *curframe)
 {
   struct symbol *sym;
   struct minimal_symbol *msymbol;
diff --git a/gdb/nlm/gdbserve.c b/gdb/nlm/gdbserve.c
index 62adf3a..990a3f9 100644
--- a/gdb/nlm/gdbserve.c
+++ b/gdb/nlm/gdbserve.c
@@ -166,7 +166,7 @@
    that's OK because we will be the only thread running anyhow.  */
 
 static int
-getDebugChar ()
+getDebugChar (void)
 {
   int err;
   LONG got;
@@ -191,8 +191,7 @@
    non-zero on success.  */
 
 static int
-putDebugChar (c)
-     unsigned char c;
+putDebugChar (unsigned char c)
 {
   int err;
   LONG put;
@@ -210,8 +209,7 @@
 /* Turn a hex character into a number.  */
 
 static int
-hex (ch)
-     char ch;
+hex (char ch)
 {
   if ((ch >= 'a') && (ch <= 'f'))
     return (ch-'a'+10);
@@ -226,8 +224,7 @@
    non-zero on success.  */
 
 static int
-getpacket (buffer)
-     char * buffer;
+getpacket (char *buffer)
 {
   unsigned char checksum;
   unsigned char xmitcsum;
@@ -312,8 +309,7 @@
    success.  */
 
 static int
-putpacket (buffer)
-     char * buffer;
+putpacket (char *buffer)
 {
   unsigned char checksum;
   int count;
@@ -357,9 +353,7 @@
 static short error;
 
 static void
-debug_error (format, parm)
-     char *format;
-     char *parm;
+debug_error (char *format, char *parm)
 {
   if (remote_debug)
     {
@@ -382,16 +376,13 @@
    saved).  */
 
 int
-get_char (addr)
-     char *addr;
+get_char (char *addr)
 {
   return *addr;
 }
 
 void
-set_char (addr, val)
-     char *addr;
-     int val;
+set_char (char *addr, int val)
 {
   *addr = val;
 }
@@ -403,11 +394,7 @@
    a fault; if zero treat a fault like any other fault in the stub.  */
 
 char *
-mem2hex (mem, buf, count, may_fault)
-     void *mem;
-     char *buf;
-     int count;
-     int may_fault;
+mem2hex (void *mem, char *buf, int count, int may_fault)
 {
   int i;
   unsigned char ch;
@@ -431,11 +418,7 @@
 /* return a pointer to the character AFTER the last byte written */
 
 char *
-hex2mem (buf, mem, count, may_fault)
-     char *buf;
-     void *mem;
-     int count;
-     int may_fault;
+hex2mem (char *buf, void *mem, int count, int may_fault)
 {
   int i;
   unsigned char ch;
@@ -458,8 +441,7 @@
    translate this number into a unix compatible signal value.  */
 
 int
-computeSignal (exceptionVector)
-     int exceptionVector;
+computeSignal (int exceptionVector)
 {
   int sigval;
   switch (exceptionVector)
@@ -490,9 +472,7 @@
 /* RETURN NUMBER OF CHARS PROCESSED           */
 /**********************************************/
 static int
-hexToInt(ptr, intValue)
-     char **ptr;
-     int *intValue;
+hexToInt (char **ptr, int *intValue)
 {
   int numChars = 0;
   int hexValue;
@@ -521,8 +501,7 @@
    debugged.  */
 
 static LONG
-handle_exception (frame)
-     struct StackFrame *frame;
+handle_exception (struct StackFrame *frame)
 {
   int addr, length;
   char *ptr;
@@ -810,9 +789,7 @@
    to have to figure out how to do that.  */
 
 int
-main (argc, argv)
-     int argc;
-     char **argv;
+main (int argc, char **argv)
 {
   int hardware, board, port;
   BYTE bitRate;
diff --git a/gdb/nlm/i386.c b/gdb/nlm/i386.c
index 560198e..b8ab480 100644
--- a/gdb/nlm/i386.c
+++ b/gdb/nlm/i386.c
@@ -16,16 +16,14 @@
 extern int computeSignal (int exceptionVector);
 
 void
-flush_i_cache()
+flush_i_cache (void)
 {
 }
 
 /* Get the registers out of the frame information.  */
 
 void
-frame_to_registers (frame, regs)
-     struct StackFrame *frame;
-     char *regs;
+frame_to_registers (struct StackFrame *frame, char *regs)
 {
   /* Copy EAX -> EDI */
   mem2hex (&frame->ExceptionEAX, &regs[0 * 4 * 2], 4 * 8, 0);
@@ -46,9 +44,7 @@
 /* Put the registers back into the frame information.  */
 
 void
-registers_to_frame (regs, frame)
-     char *regs;
-     struct StackFrame *frame;
+registers_to_frame (char *regs, struct StackFrame *frame)
 {
   /* Copy EAX -> EDI */
   hex2mem (&regs[0 * 4 * 2], &frame->ExceptionEAX, 4 * 8, 0);
@@ -67,23 +63,19 @@
 }
 
 void
-set_step_traps (frame)
-     struct StackFrame *frame;
+set_step_traps (struct StackFrame *frame)
 {
   frame->ExceptionSystemFlags |= 0x100;
 }
 
 void
-clear_step_traps (frame)
-     struct StackFrame *frame;
+clear_step_traps (struct StackFrame *frame)
 {
   frame->ExceptionSystemFlags &= ~0x100;
 }
 
 void
-do_status (ptr, frame)
-     char *ptr;
-     struct StackFrame *frame;
+do_status (char *ptr, struct StackFrame *frame)
 {
   int sigval;
 
diff --git a/gdb/nlm/ppc.c b/gdb/nlm/ppc.c
index e68397b..c5850ab 100644
--- a/gdb/nlm/ppc.c
+++ b/gdb/nlm/ppc.c
@@ -24,9 +24,7 @@
 /* Get the registers out of the frame information.  */
 
 void
-frame_to_registers (frame, regs)
-     struct StackFrame *frame;
-     char *regs;
+frame_to_registers (struct StackFrame *frame, char *regs)
 {
   mem2hex (&frame->ExceptionState.CsavedRegs, &regs[GP0_REGNUM * 4 * 2], 4 * 32, 0);
 
@@ -44,9 +42,7 @@
 /* Put the registers back into the frame information.  */
 
 void
-registers_to_frame (regs, frame)
-     char *regs;
-     struct StackFrame *frame;
+registers_to_frame (char *regs, struct StackFrame *frame)
 {
   hex2mem (&regs[GP0_REGNUM * 4 * 2], &frame->ExceptionState.CsavedRegs, 4 * 32, 0);
 
@@ -68,8 +64,7 @@
 extern int ReadByteAltDebugger (char* addr, char *theByte);
 extern int WriteByteAltDebugger (char* addr, char theByte);
 int
-get_char (addr)
-     char *addr;
+get_char (char *addr)
 {
   char c;
 
@@ -80,9 +75,7 @@
 }
 
 void
-set_char (addr, val)
-     char *addr;
-     int val;
+set_char (char *addr, int val)
 {
   if (!WriteByteAltDebugger (addr, val))
     mem_err = 1;
@@ -90,9 +83,7 @@
 #endif
 
 int
-mem_write (dst, src, len)
-     char *dst, *src;
-     int len;
+mem_write (char *dst, char *src, int len)
 {
   while (len-- && !mem_err)
     set_char (dst++, *src++);
@@ -142,8 +133,7 @@
 static LONG *saved_target_inst_pc = 0;
 
 void
-set_step_traps (frame)
-     struct StackFrame *frame;
+set_step_traps (struct StackFrame *frame)
 {
   union inst inst;
   LONG *target;
@@ -203,8 +193,7 @@
    set.  */
 
 int
-clear_step_traps (frame)
-     struct StackFrame *frame;
+clear_step_traps (struct StackFrame *frame)
 {
   int retcode;
   LONG *pc = (LONG *)frame->ExceptionPC;
@@ -230,9 +219,7 @@
 }
 
 void
-do_status (ptr, frame)
-     char *ptr;
-     struct StackFrame *frame;
+do_status (char *ptr, struct StackFrame *frame)
 {
   int sigval;
 
diff --git a/gdb/nlmread.c b/gdb/nlmread.c
index c710b0a..f5073a6 100644
--- a/gdb/nlmread.c
+++ b/gdb/nlmread.c
@@ -49,8 +49,7 @@
    file at some point in the near future.  */
 
 static void
-nlm_new_init (ignore)
-     struct objfile *ignore;
+nlm_new_init (struct objfile *ignore)
 {
   stabsread_new_init ();
   buildsym_new_init ();
@@ -67,8 +66,7 @@
    just a stub. */
 
 static void
-nlm_symfile_init (ignore)
-     struct objfile *ignore;
+nlm_symfile_init (struct objfile *ignore)
 {
 }
 
@@ -92,10 +90,7 @@
  */
 
 static void
-nlm_symtab_read (abfd, addr, objfile)
-     bfd *abfd;
-     CORE_ADDR addr;
-     struct objfile *objfile;
+nlm_symtab_read (bfd *abfd, CORE_ADDR addr, struct objfile *objfile)
 {
   long storage_needed;
   asymbol *sym;
@@ -113,7 +108,7 @@
   if (storage_needed > 0)
     {
       symbol_table = (asymbol **) xmalloc (storage_needed);
-      back_to = make_cleanup (free, symbol_table);
+      back_to = make_cleanup (xfree, symbol_table);
       number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
       if (number_of_symbols < 0)
 	error ("Can't read symbols from %s: %s", bfd_get_filename (abfd),
@@ -177,9 +172,7 @@
    is not currently used. */
 
 static void
-nlm_symfile_read (objfile, mainline)
-     struct objfile *objfile;
-     int mainline;
+nlm_symfile_read (struct objfile *objfile, int mainline)
 {
   bfd *abfd = objfile->obfd;
   struct cleanup *back_to;
@@ -228,8 +221,7 @@
    objfile struct from the global list of known objfiles. */
 
 static void
-nlm_symfile_finish (objfile)
-     struct objfile *objfile;
+nlm_symfile_finish (struct objfile *objfile)
 {
   if (objfile->sym_private != NULL)
     {
@@ -251,7 +243,7 @@
 };
 
 void
-_initialize_nlmread ()
+_initialize_nlmread (void)
 {
   add_symtab_fns (&nlm_sym_fns);
 }
diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c
index fc166de..6f39c8c 100644
--- a/gdb/ns32k-tdep.c
+++ b/gdb/ns32k-tdep.c
@@ -22,7 +22,7 @@
 #include "defs.h"
 
 void
-_initialize_ns32k_tdep ()
+_initialize_ns32k_tdep (void)
 {
   tm_print_insn = print_insn_ns32k;
 }
@@ -31,8 +31,7 @@
    to reach some "real" code.  */
 
 CORE_ADDR
-merlin_skip_prologue (pc)
-     CORE_ADDR pc;
+merlin_skip_prologue (CORE_ADDR pc)
 {
   register int op = read_memory_integer (pc, 1);
   if (op == 0x82)
@@ -49,8 +48,7 @@
 }
 
 CORE_ADDR
-umax_skip_prologue (pc)
-     CORE_ADDR pc;
+umax_skip_prologue (CORE_ADDR pc)
 {
   register unsigned char op = read_memory_integer (pc, 1);
   if (op == 0x82)
@@ -70,8 +68,7 @@
    Can return -1, meaning no way to tell.  */
 
 int
-merlin_frame_num_args (fi)
-     struct frame_info *fi;
+merlin_frame_num_args (struct frame_info *fi)
 {
   int numargs;
   CORE_ADDR pc;
@@ -109,8 +106,7 @@
    so this will often not work properly.  If the arg names
    are known, it's likely most of them will be printed. */
 int
-umax_frame_num_args (fi)
-     struct frame_info *fi;
+umax_frame_num_args (struct frame_info *fi)
 {
   int numargs;
   CORE_ADDR pc;
@@ -148,7 +144,7 @@
 }
 
 
-sign_extend (value, bits)
+sign_extend (int value, int bits)
 {
   value = value & ((1 << bits) - 1);
   return (value & (1 << (bits - 1))
@@ -157,9 +153,7 @@
 }
 
 void
-flip_bytes (ptr, count)
-     char *ptr;
-     int count;
+flip_bytes (char *ptr, int count)
 {
   char tmp;
 
@@ -178,8 +172,7 @@
    FRAME_FIND_SAVED_REGS.  */
 
 int
-ns32k_localcount (enter_pc)
-     CORE_ADDR enter_pc;
+ns32k_localcount (CORE_ADDR enter_pc)
 {
   unsigned char localtype;
   int localcount;
@@ -202,8 +195,7 @@
 /* Nonzero if instruction at PC is a return instruction.  */
 
 static int
-ns32k_about_to_return (pc)
-     CORE_ADDR pc;
+ns32k_about_to_return (CORE_ADDR pc)
 {
   return (read_memory_integer (pc, 1) == 0x12);
 }
@@ -218,8 +210,7 @@
  */
 
 CORE_ADDR
-ns32k_get_enter_addr (pc)
-     CORE_ADDR pc;
+ns32k_get_enter_addr (CORE_ADDR pc)
 {
   CORE_ADDR enter_addr;
   unsigned char op;
diff --git a/gdb/ns32km3-nat.c b/gdb/ns32km3-nat.c
index bd4f70d..23d3a826 100644
--- a/gdb/ns32km3-nat.c
+++ b/gdb/ns32km3-nat.c
@@ -77,8 +77,7 @@
  */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   kern_return_t ret;
   thread_state_data_t state;
@@ -123,8 +122,7 @@
  * On mach3 all registers are always saved in one call.
  */
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   kern_return_t ret;
   thread_state_data_t state;
diff --git a/gdb/ns32knbsd-nat.c b/gdb/ns32knbsd-nat.c
index de2299c..460f78e 100644
--- a/gdb/ns32knbsd-nat.c
+++ b/gdb/ns32knbsd-nat.c
@@ -36,8 +36,7 @@
 	memcpy(&dst, &registers[REGISTER_BYTE(src)], sizeof(dst))
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   struct reg inferior_registers;
   struct fpreg inferior_fpregisters;
@@ -74,8 +73,7 @@
 }
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   struct reg inferior_registers;
   struct fpreg inferior_fpregisters;
@@ -118,13 +116,10 @@
   struct fpreg freg;
 };
 
-/* Get registers from a core file. */
+/* Get registers from a core file.  REG_ADDR is unused.  */
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     unsigned int reg_addr;	/* Unused in this version */
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+		      unsigned int reg_addr)
 {
   struct coreregs *core_reg;
 
@@ -183,7 +178,7 @@
 };
 
 void
-_initialize_ns32knbsd_nat ()
+_initialize_ns32knbsd_nat (void)
 {
   add_core_fns (&nat_core_fns);
 }
@@ -200,8 +195,7 @@
  * Called by kcore-nbsd.c:get_kcore_registers().
  */
 void
-fetch_kcore_registers (pcb)
-     struct pcb *pcb;
+fetch_kcore_registers (struct pcb *pcb)
 {
   struct switchframe sf;
   struct reg intreg;
@@ -246,7 +240,7 @@
 #endif /* FETCH_KCORE_REGISTERS */
 
 void
-clear_regs ()
+clear_regs (void)
 {
   double zero = 0.0;
   int null = 0;
@@ -283,8 +277,7 @@
    Can return -1, meaning no way to tell. */
 
 int
-frame_num_args (fi)
-     struct frame_info *fi;
+frame_num_args (struct frame_info *fi)
 {
   CORE_ADDR enter_addr;
   CORE_ADDR argp;
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index f1c70fa..3ad6d29 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -76,10 +76,7 @@
    the end of the table (objfile->sections_end). */
 
 static void
-add_to_objfile_sections (abfd, asect, objfile_p_char)
-     bfd *abfd;
-     sec_ptr asect;
-     PTR objfile_p_char;
+add_to_objfile_sections (bfd *abfd, sec_ptr asect, PTR objfile_p_char)
 {
   struct objfile *objfile = (struct objfile *) objfile_p_char;
   struct obj_section section;
@@ -119,8 +116,7 @@
    we are building the table, we're pretty much hosed. */
 
 int
-build_objfile_section_table (objfile)
-     struct objfile *objfile;
+build_objfile_section_table (struct objfile *objfile)
 {
   /* objfile->sections can be already set when reading a mapped symbol
      file.  I believe that we do need to rebuild the section table in
@@ -148,9 +144,7 @@
    member. */
 
 struct objfile *
-allocate_objfile (abfd, flags)
-     bfd *abfd;
-     int flags;
+allocate_objfile (bfd *abfd, int flags)
 {
   struct objfile *objfile = NULL;
   struct objfile *last_one = NULL;
@@ -268,13 +262,13 @@
       memset (objfile, 0, sizeof (struct objfile));
       objfile->md = NULL;
       obstack_specify_allocation (&objfile->psymbol_cache.cache, 0, 0,
-				  xmalloc, free);
+				  xmalloc, xfree);
       obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0, xmalloc,
-				  free);
+				  xfree);
       obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc,
-				  free);
+				  xfree);
       obstack_specify_allocation (&objfile->type_obstack, 0, 0, xmalloc,
-				  free);
+				  xfree);
       flags &= ~OBJF_MAPPED;
     }
 
@@ -331,8 +325,7 @@
 /* Put OBJFILE at the front of the list.  */
 
 void
-objfile_to_front (objfile)
-     struct objfile *objfile;
+objfile_to_front (struct objfile *objfile)
 {
   struct objfile **objp;
   for (objp = &object_files; *objp != NULL; objp = &((*objp)->next))
@@ -363,8 +356,7 @@
    between the OBJFILE and the list. */
 
 void
-unlink_objfile (objfile)
-     struct objfile *objfile;
+unlink_objfile (struct objfile *objfile)
 {
   struct objfile **objpp;
 
@@ -399,8 +391,7 @@
    we free objects in the reusable area. */
 
 void
-free_objfile (objfile)
-     struct objfile *objfile;
+free_objfile (struct objfile *objfile)
 {
   /* First do any symbol file specific actions required when we are
      finished with a particular symbol file.  Note that if the objfile
@@ -422,7 +413,7 @@
       if (!bfd_close (objfile->obfd))
 	warning ("cannot close \"%s\": %s",
 		 name, bfd_errmsg (bfd_get_error ()));
-      free (name);
+      xfree (name);
     }
 
   /* Remove it from the chain of all objfiles. */
@@ -505,7 +496,7 @@
 /* Free all the object files at once and clean up their users.  */
 
 void
-free_all_objfiles ()
+free_all_objfiles (void)
 {
   struct objfile *objfile, *temp;
 
@@ -519,9 +510,7 @@
 /* Relocate OBJFILE to NEW_OFFSETS.  There should be OBJFILE->NUM_SECTIONS
    entries in new_offsets.  */
 void
-objfile_relocate (objfile, new_offsets)
-     struct objfile *objfile;
-     struct section_offsets *new_offsets;
+objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
 {
   struct section_offsets *delta =
     (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
@@ -531,7 +520,7 @@
     int something_changed = 0;
     for (i = 0; i < objfile->num_sections; ++i)
       {
-	ANOFFSET (delta, i) =
+	delta->offsets[i] =
 	  ANOFFSET (new_offsets, i) - ANOFFSET (objfile->section_offsets, i);
 	if (ANOFFSET (delta, i) != 0)
 	  something_changed = 1;
@@ -575,6 +564,9 @@
 	  for (j = 0; j < BLOCK_NSYMS (b); ++j)
 	    {
 	      struct symbol *sym = BLOCK_SYM (b, j);
+
+	      fixup_symbol_section (sym, objfile);
+
 	      /* The RS6000 code from which this was taken skipped
 	         any symbols in STRUCT_NAMESPACE or UNDEF_NAMESPACE.
 	         But I'm leaving out that test, on the theory that
@@ -617,15 +609,21 @@
     for (psym = objfile->global_psymbols.list;
 	 psym < objfile->global_psymbols.next;
 	 psym++)
-      if (SYMBOL_SECTION (*psym) >= 0)
-	SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta,
-						  SYMBOL_SECTION (*psym));
+      {
+	fixup_psymbol_section (*psym, objfile);
+	if (SYMBOL_SECTION (*psym) >= 0)
+	  SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta,
+						    SYMBOL_SECTION (*psym));
+      }
     for (psym = objfile->static_psymbols.list;
 	 psym < objfile->static_psymbols.next;
 	 psym++)
-      if (SYMBOL_SECTION (*psym) >= 0)
-	SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta,
-						  SYMBOL_SECTION (*psym));
+      {
+	fixup_psymbol_section (*psym, objfile);
+	if (SYMBOL_SECTION (*psym) >= 0)
+	  SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta,
+						    SYMBOL_SECTION (*psym));
+      }
   }
 
   {
@@ -641,9 +639,21 @@
   {
     int i;
     for (i = 0; i < objfile->num_sections; ++i)
-      ANOFFSET (objfile->section_offsets, i) = ANOFFSET (new_offsets, i);
+      (objfile->section_offsets)->offsets[i] = ANOFFSET (new_offsets, i);
   }
 
+  if (objfile->ei.entry_point != ~(CORE_ADDR) 0)
+    {
+      /* Relocate ei.entry_point with its section offset, use SECT_OFF_TEXT
+	 only as a fallback.  */
+      struct obj_section *s;
+      s = find_pc_section (objfile->ei.entry_point);
+      if (s)
+        objfile->ei.entry_point += ANOFFSET (delta, s->the_bfd_section->index);
+      else
+        objfile->ei.entry_point += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
+    }
+
   {
     struct obj_section *s;
     bfd *abfd;
@@ -652,31 +662,13 @@
 
     ALL_OBJFILE_OSECTIONS (objfile, s)
       {
-	flagword flags;
-
-	flags = bfd_get_section_flags (abfd, s->the_bfd_section);
-
-	if (flags & SEC_CODE)
-	  {
-	    s->addr += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
-	    s->endaddr += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
-	  }
-	else if (flags & (SEC_DATA | SEC_LOAD))
-	  {
-	    s->addr += ANOFFSET (delta, SECT_OFF_DATA (objfile));
-	    s->endaddr += ANOFFSET (delta, SECT_OFF_DATA (objfile));
-	  }
-	else if (flags & SEC_ALLOC)
-	  {
-	    s->addr += ANOFFSET (delta, SECT_OFF_BSS (objfile));
-	    s->endaddr += ANOFFSET (delta, SECT_OFF_BSS (objfile));
-	  }
+      	int idx = s->the_bfd_section->index;
+	
+	s->addr += ANOFFSET (delta, idx);
+	s->endaddr += ANOFFSET (delta, idx);
       }
   }
 
-  if (objfile->ei.entry_point != ~(CORE_ADDR) 0)
-    objfile->ei.entry_point += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
-
   if (objfile->ei.entry_func_lowpc != INVALID_ENTRY_LOWPC)
     {
       objfile->ei.entry_func_lowpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
@@ -704,7 +696,7 @@
    available, nonzero otherwise. */
 
 int
-have_partial_symbols ()
+have_partial_symbols (void)
 {
   struct objfile *ofp;
 
@@ -723,7 +715,7 @@
    available, nonzero otherwise. */
 
 int
-have_full_symbols ()
+have_full_symbols (void)
 {
   struct objfile *ofp;
 
@@ -743,7 +735,7 @@
    command.
  */
 void
-objfile_purge_solibs ()
+objfile_purge_solibs (void)
 {
   struct objfile *objf;
   struct objfile *temp;
@@ -764,7 +756,7 @@
    available, nonzero otherwise. */
 
 int
-have_minimal_symbols ()
+have_minimal_symbols (void)
 {
   struct objfile *ofp;
 
@@ -800,10 +792,7 @@
    Otherwise, returns the open file descriptor.  */
 
 static int
-open_existing_mapped_file (symsfilename, mtime, flags)
-     char *symsfilename;
-     long mtime;
-     int flags;
+open_existing_mapped_file (char *symsfilename, long mtime, int flags)
 {
   int fd = -1;
   struct stat sbuf;
@@ -855,10 +844,7 @@
    /bin for example).  */
 
 static int
-open_mapped_file (filename, mtime, flags)
-     char *filename;
-     long mtime;
-     int flags;
+open_mapped_file (char *filename, long mtime, int flags)
 {
   int fd;
   char *symsfilename;
@@ -869,7 +855,7 @@
   symsfilename = concat ("./", basename (filename), ".syms", (char *) NULL);
   if ((fd = open_existing_mapped_file (symsfilename, mtime, flags)) < 0)
     {
-      free (symsfilename);
+      xfree (symsfilename);
       symsfilename = concat (filename, ".syms", (char *) NULL);
       fd = open_existing_mapped_file (symsfilename, mtime, flags);
     }
@@ -885,7 +871,7 @@
 
   if ((fd < 0) && (flags & OBJF_MAPPED))
     {
-      free (symsfilename);
+      xfree (symsfilename);
       symsfilename = concat ("./", basename (filename), ".syms",
 			     (char *) NULL);
       if ((fd = open (symsfilename, O_RDWR | O_CREAT | O_TRUNC, 0666)) < 0)
@@ -898,13 +884,12 @@
 	}
     }
 
-  free (symsfilename);
+  xfree (symsfilename);
   return (fd);
 }
 
 static PTR
-map_to_file (fd)
-     int fd;
+map_to_file (int fd)
 {
   PTR md;
   CORE_ADDR mapto;
@@ -954,9 +939,7 @@
    contains a pointer to the bfd struct sec section.  */
 
 struct obj_section *
-find_pc_sect_section (pc, section)
-     CORE_ADDR pc;
-     struct sec *section;
+find_pc_sect_section (CORE_ADDR pc, struct sec *section)
 {
   struct obj_section *s;
   struct objfile *objfile;
@@ -973,8 +956,7 @@
    Backward compatibility, no section.  */
 
 struct obj_section *
-find_pc_section (pc)
-     CORE_ADDR pc;
+find_pc_section (CORE_ADDR pc)
 {
   return find_pc_sect_section (pc, find_pc_mapped_section (pc));
 }
@@ -985,9 +967,7 @@
    a trampoline.  */
 
 int
-in_plt_section (pc, name)
-     CORE_ADDR pc;
-     char *name;
+in_plt_section (CORE_ADDR pc, char *name)
 {
   struct obj_section *s;
   int retval = 0;
@@ -1004,9 +984,7 @@
    return zero.  */
 
 int
-is_in_import_list (name, objfile)
-     char *name;
-     struct objfile *objfile;
+is_in_import_list (char *name, struct objfile *objfile)
 {
   register int i;
 
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 86b77a5..90a1740 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -597,8 +597,9 @@
      ((objfile->sect_index_text == -1) ? \
       (internal_error ("sect_index_text not initialized"), -1) : objfile->sect_index_text)
 
-#define SECT_OFF_BSS(objfile) \
-     ((objfile->sect_index_bss == -1) ? \
-      (internal_error ("sect_index_bss not initialized"), -1) : objfile->sect_index_bss)
+/* Sometimes the .bss section is missing from the objfile, so we don't
+   want to die here. Let the users of SECT_OFF_BSS deal with an
+   uninitialized section index. */
+#define SECT_OFF_BSS(objfile) (objfile)->sect_index_bss
 
 #endif /* !defined (OBJFILES_H) */
diff --git a/gdb/ocd.c b/gdb/ocd.c
index 1eeed77..eb83161 100644
--- a/gdb/ocd.c
+++ b/gdb/ocd.c
@@ -31,7 +31,6 @@
 #include "gdbcmd.h"
 #include "objfiles.h"
 #include "gdb-stabs.h"
-#include "dcache.h"
 #include <sys/types.h>
 #include <signal.h>
 #include "serial.h"
@@ -86,9 +85,7 @@
 static serial_t ocd_desc = NULL;
 
 void
-ocd_error (s, error_code)
-     char *s;
-     int error_code;
+ocd_error (char *s, int error_code)
 {
   char buf[100];
 
@@ -153,8 +150,7 @@
 /*  Return nonzero if the thread TH is still alive on the remote system.  */
 
 int
-ocd_thread_alive (th)
-     int th;
+ocd_thread_alive (int th)
 {
   return 1;
 }
@@ -163,8 +159,7 @@
 
 /* ARGSUSED */
 void
-ocd_close (quitting)
-     int quitting;
+ocd_close (int quitting)
 {
   if (ocd_desc)
     SERIAL_CLOSE (ocd_desc);
@@ -174,8 +169,7 @@
 /* Stub for catch_errors.  */
 
 static int
-ocd_start_remote (dummy)
-     PTR dummy;
+ocd_start_remote (PTR dummy)
 {
   unsigned char buf[10], *p;
   int pktlen;
@@ -186,7 +180,7 @@
 
   target_type = *(enum ocd_target_type *) dummy;
 
-  immediate_quit = 1;		/* Allow user to interrupt it */
+  immediate_quit++;		/* Allow user to interrupt it */
 
   SERIAL_SEND_BREAK (ocd_desc);	/* Wake up the wiggler */
 
@@ -248,7 +242,7 @@
     ocd_error ("OCD_SET_CTL_FLAGS:", error_code);
 #endif
 
-  immediate_quit = 0;
+  immediate_quit--;
 
 /* This is really the job of start_remote however, that makes an assumption
    that the target is about to print out a status message of some sort.  That
@@ -278,14 +272,9 @@
 /* Open a connection to a remote debugger.
    NAME is the filename used for communication.  */
 
-static DCACHE *ocd_dcache;
-
 void
-ocd_open (name, from_tty, target_type, ops)
-     char *name;
-     int from_tty;
-     enum ocd_target_type target_type;
-     struct target_ops *ops;
+ocd_open (char *name, int from_tty, enum ocd_target_type target_type,
+	  struct target_ops *ops)
 {
   unsigned char buf[10], *p;
   int pktlen;
@@ -300,8 +289,6 @@
 
   unpush_target (current_ops);
 
-  ocd_dcache = dcache_init (ocd_read_bytes, ocd_write_bytes);
-
   if (strncmp (name, "wiggler", 7) == 0)
     {
       ocd_desc = SERIAL_OPEN ("ocd");
@@ -375,9 +362,7 @@
    die when it hits one.  */
 
 void
-ocd_detach (args, from_tty)
-     char *args;
-     int from_tty;
+ocd_detach (char *args, int from_tty)
 {
   if (args)
     error ("Argument given to \"detach\" when remotely debugging.");
@@ -390,14 +375,10 @@
 /* Tell the remote machine to resume.  */
 
 void
-ocd_resume (pid, step, siggnal)
-     int pid, step;
-     enum target_signal siggnal;
+ocd_resume (int pid, int step, enum target_signal siggnal)
 {
   int pktlen;
 
-  dcache_flush (ocd_dcache);
-
   if (step)
     ocd_do_command (OCD_STEP, &last_run_status, &pktlen);
   else
@@ -405,7 +386,7 @@
 }
 
 void
-ocd_stop ()
+ocd_stop (void)
 {
   int status;
   int pktlen;
@@ -422,8 +403,7 @@
    packet.  */
 
 static void
-ocd_interrupt (signo)
-     int signo;
+ocd_interrupt (int signo)
 {
   /* If this doesn't work, try more severe steps.  */
   signal (signo, ocd_interrupt_twice);
@@ -445,8 +425,7 @@
 
 /* The user typed ^C twice.  */
 static void
-ocd_interrupt_twice (signo)
-     int signo;
+ocd_interrupt_twice (int signo)
 {
   signal (signo, ofunc);
 
@@ -458,7 +437,7 @@
 /* Ask the user what to do when an interrupt is received.  */
 
 static void
-interrupt_query ()
+interrupt_query (void)
 {
   target_terminal_ours ();
 
@@ -481,7 +460,7 @@
    means in the case of this target).  */
 
 int
-ocd_wait ()
+ocd_wait (void)
 {
   unsigned char *p;
   int error_code;
@@ -529,10 +508,7 @@
    Returns a pointer to a static array containing the register contents.  */
 
 unsigned char *
-ocd_read_bdm_registers (first_bdm_regno, last_bdm_regno, reglen)
-     int first_bdm_regno;
-     int last_bdm_regno;
-     int *reglen;
+ocd_read_bdm_registers (int first_bdm_regno, int last_bdm_regno, int *reglen)
 {
   unsigned char buf[10];
   int i;
@@ -574,8 +550,7 @@
 /* Read register BDM_REGNO and returns its value ala read_register() */
 
 CORE_ADDR
-ocd_read_bdm_register (bdm_regno)
-     int bdm_regno;
+ocd_read_bdm_register (int bdm_regno)
 {
   int reglen;
   unsigned char *p;
@@ -588,10 +563,7 @@
 }
 
 void
-ocd_write_bdm_registers (first_bdm_regno, regptr, reglen)
-     int first_bdm_regno;
-     unsigned char *regptr;
-     int reglen;
+ocd_write_bdm_registers (int first_bdm_regno, unsigned char *regptr, int reglen)
 {
   unsigned char *buf;
   unsigned char *p;
@@ -620,9 +592,7 @@
 }
 
 void
-ocd_write_bdm_register (bdm_regno, reg)
-     int bdm_regno;
-     CORE_ADDR reg;
+ocd_write_bdm_register (int bdm_regno, CORE_ADDR reg)
 {
   unsigned char buf[4];
 
@@ -632,7 +602,7 @@
 }
 
 void
-ocd_prepare_to_store ()
+ocd_prepare_to_store (void)
 {
 }
 
@@ -647,10 +617,7 @@
 static int write_mem_command = OCD_WRITE_MEM;
 
 int
-ocd_write_bytes (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+ocd_write_bytes (CORE_ADDR memaddr, char *myaddr, int len)
 {
   char buf[256 + 10];
   unsigned char *p;
@@ -722,10 +689,7 @@
    Returns number of bytes transferred, or 0 for error.  */
 
 static int
-ocd_read_bytes (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+ocd_read_bytes (CORE_ADDR memaddr, char *myaddr, int len)
 {
   char buf[256 + 10];
   unsigned char *p;
@@ -790,23 +754,26 @@
 
 /* Read or write LEN bytes from inferior memory at MEMADDR, transferring
    to or from debugger address MYADDR.  Write to inferior if SHOULD_WRITE is
-   nonzero.  Returns length of data written or read; 0 for error.  */
+   nonzero.  Returns length of data written or read; 0 for error.  TARGET
+   is ignored.  */
 
 /* ARGSUSED */
 int
-ocd_xfer_memory (memaddr, myaddr, len, should_write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int should_write;
-     struct target_ops *target;	/* ignored */
+ocd_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int should_write,
+		 struct target_ops *target)
 {
-  return dcache_xfer_memory (ocd_dcache, memaddr, myaddr, len, should_write);
+  int res;
+
+  if (should_write)
+    res = ocd_write_bytes (memaddr, myaddr, len);
+  else
+    res = ocd_read_bytes (memaddr, myaddr, len);
+
+  return res;
 }
 
 void
-ocd_files_info (ignore)
-     struct target_ops *ignore;
+ocd_files_info (struct target_ops *ignore)
 {
   puts_filtered ("Debugging a target over a serial line.\n");
 }
@@ -817,8 +784,7 @@
 /* Read a single character from the remote side, handling wierd errors. */
 
 static int
-readchar (timeout)
-     int timeout;
+readchar (int timeout)
 {
   int ch;
 
@@ -843,8 +809,7 @@
    mistaken for real data).  */
 
 static int
-get_quoted_char (timeout)
-     int timeout;
+get_quoted_char (int timeout)
 {
   int ch;
 
@@ -869,13 +834,13 @@
 static unsigned char pkt[256 * 2 + 10], *pktp;	/* Worst case */
 
 static void
-reset_packet ()
+reset_packet (void)
 {
   pktp = pkt;
 }
 
 static void
-output_packet ()
+output_packet (void)
 {
   if (SERIAL_WRITE (ocd_desc, pkt, pktp - pkt))
     perror_with_name ("output_packet: write failed");
@@ -887,8 +852,7 @@
    through untouched.  */
 
 static void
-put_quoted_char (c)
-     int c;
+put_quoted_char (int c)
 {
   switch (c)
     {
@@ -911,9 +875,7 @@
    byte count. */
 
 static void
-stu_put_packet (buf, len)
-     unsigned char *buf;
-     int len;
+stu_put_packet (unsigned char *buf, int len)
 {
   unsigned char checksum;
   unsigned char c;
@@ -956,9 +918,7 @@
    byte count.  */
 
 static void
-ocd_put_packet (buf, len)
-     unsigned char *buf;
-     int len;
+ocd_put_packet (unsigned char *buf, int len)
 {
   unsigned char checksum;
   unsigned char c;
@@ -993,9 +953,7 @@
  */
 
 static unsigned char *
-stu_get_packet (cmd, lenp, timeout)
-     unsigned char cmd;
-     int *lenp;
+stu_get_packet (unsigned char cmd, int *lenp, int timeout)
 {
   int ch;
   int len;
@@ -1058,9 +1016,7 @@
  */
 
 static unsigned char *
-ocd_get_packet (cmd, lenp, timeout)
-     int cmd;
-     int *lenp;
+ocd_get_packet (int cmd, int *lenp, int timeout)
 {
   int ch;
   int len;
@@ -1207,10 +1163,7 @@
    following the error code.  */
 
 static unsigned char *
-ocd_do_command (cmd, statusp, lenp)
-     int cmd;
-     int *statusp;
-     int *lenp;
+ocd_do_command (int cmd, int *statusp, int *lenp)
 {
   unsigned char buf[100], *p;
   int status, error_code;
@@ -1256,7 +1209,7 @@
 }
 
 void
-ocd_kill ()
+ocd_kill (void)
 {
   /* For some mysterious reason, wait_for_inferior calls kill instead of
      mourn after it gets TARGET_WAITKIND_SIGNALLED.  Work around it.  */
@@ -1273,7 +1226,7 @@
 }
 
 void
-ocd_mourn ()
+ocd_mourn (void)
 {
   unpush_target (current_ops);
   generic_mourn_inferior ();
@@ -1283,10 +1236,7 @@
    the program at that point.  */
 
 void
-ocd_create_inferior (exec_file, args, env)
-     char *exec_file;
-     char *args;
-     char **env;
+ocd_create_inferior (char *exec_file, char *args, char **env)
 {
   if (args && (*args != '\000'))
     error ("Args are not supported by BDM.");
@@ -1296,9 +1246,7 @@
 }
 
 void
-ocd_load (args, from_tty)
-     char *args;
-     int from_tty;
+ocd_load (char *args, int from_tty)
 {
   generic_load (args, from_tty);
 
@@ -1325,9 +1273,7 @@
 /* BDM (at least on CPU32) uses a different breakpoint */
 
 int
-ocd_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+ocd_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   static char break_insn[] = BDM_BREAKPOINT;
   int val;
@@ -1341,9 +1287,7 @@
 }
 
 int
-ocd_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+ocd_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   static char break_insn[] = BDM_BREAKPOINT;
   int val;
@@ -1354,17 +1298,13 @@
 }
 
 static void
-bdm_command (args, from_tty)
-     char *args;
-     int from_tty;
+bdm_command (char *args, int from_tty)
 {
   error ("bdm command must be followed by `reset'");
 }
 
 static void
-bdm_reset_command (args, from_tty)
-     char *args;
-     int from_tty;
+bdm_reset_command (char *args, int from_tty)
 {
   int status, pktlen;
 
@@ -1372,14 +1312,12 @@
     error ("Not connected to OCD device.");
 
   ocd_do_command (OCD_RESET, &status, &pktlen);
-  dcache_flush (ocd_dcache);
+  dcache_invalidate (target_dcache);
   registers_changed ();
 }
 
 static void
-bdm_restart_command (args, from_tty)
-     char *args;
-     int from_tty;
+bdm_restart_command (char *args, int from_tty)
 {
   int status, pktlen;
 
@@ -1397,15 +1335,12 @@
    generic_load from trying to set the PC.  */
 
 static void
-noop_store_registers (regno)
-     int regno;
+noop_store_registers (int regno)
 {
 }
 
 static void
-bdm_update_flash_command (args, from_tty)
-     char *args;
-     int from_tty;
+bdm_update_flash_command (char *args, int from_tty)
 {
   int status, pktlen;
   struct cleanup *old_chain; 
@@ -1438,9 +1373,7 @@
 }
 
 static void
-bdm_read_register_command (args, from_tty)
-     char *args;
-     int from_tty;
+bdm_read_register_command (char *args, int from_tty)
 {
   /* XXX repeat should go on to the next register */
 
@@ -1453,7 +1386,7 @@
 }
 
 void
-_initialize_remote_ocd ()
+_initialize_remote_ocd (void)
 {
   extern struct cmd_list_element *cmdlist;
   static struct cmd_list_element *ocd_cmd_list = NULL;
diff --git a/gdb/op50-rom.c b/gdb/op50-rom.c
index 92eccef..14eeeca 100644
--- a/gdb/op50-rom.c
+++ b/gdb/op50-rom.c
@@ -121,15 +121,13 @@
 };
 
 static void
-op50n_open (args, from_tty)
-     char *args;
-     int from_tty;
+op50n_open (char *args, int from_tty)
 {
   monitor_open (args, &op50n_cmds, from_tty);
 }
 
 void
-_initialize_op50n ()
+_initialize_op50n (void)
 {
   init_op50n_cmds ();
   init_monitor_ops (&op50n_ops);
diff --git a/gdb/os9kread.c b/gdb/os9kread.c
index d3e782f..00a5996 100644
--- a/gdb/os9kread.c
+++ b/gdb/os9kread.c
@@ -186,11 +186,8 @@
 #define N_ABS 6
 
 static void
-record_minimal_symbol (name, address, type, objfile)
-     char *name;
-     CORE_ADDR address;
-     int type;
-     struct objfile *objfile;
+record_minimal_symbol (char *name, CORE_ADDR address, int type,
+		       struct objfile *objfile)
 {
   enum minimal_symbol_type ms_type;
 
@@ -244,8 +241,7 @@
 #define STBSYMSIZE 10
 
 static void
-read_minimal_symbols (objfile)
-     struct objfile *objfile;
+read_minimal_symbols (struct objfile *objfile)
 {
   FILE *fp;
   bfd *abfd;
@@ -316,9 +312,7 @@
    table (as opposed to a shared lib or dynamically loaded file).  */
 
 static void
-os9k_symfile_read (objfile, mainline)
-     struct objfile *objfile;
-     int mainline;		/* FIXME comments above */
+os9k_symfile_read (struct objfile *objfile, int mainline)
 {
   bfd *sym_bfd;
   struct cleanup *back_to;
@@ -349,8 +343,7 @@
    file, e.g. a shared library).  */
 
 static void
-os9k_new_init (ignore)
-     struct objfile *ignore;
+os9k_new_init (struct objfile *ignore)
 {
   stabsread_new_init ();
   buildsym_new_init ();
@@ -371,8 +364,7 @@
    FIXME, there should be a cleaner peephole into the BFD environment here.  */
 
 static void
-os9k_symfile_init (objfile)
-     struct objfile *objfile;
+os9k_symfile_init (struct objfile *objfile)
 {
   bfd *sym_bfd = objfile->obfd;
   char *name = bfd_get_filename (sym_bfd);
@@ -420,8 +412,7 @@
    objfile struct from the global list of known objfiles. */
 
 static void
-os9k_symfile_finish (objfile)
-     struct objfile *objfile;
+os9k_symfile_finish (struct objfile *objfile)
 {
   if (objfile->sym_stab_info != NULL)
     {
@@ -476,9 +467,7 @@
 #define VER_ULTRAC	((short)5)
 
 static int
-fill_sym (dbg_file, abfd)
-     FILE *dbg_file;
-     bfd *abfd;
+fill_sym (FILE *dbg_file, bfd *abfd)
 {
   short si, nmask;
   long li;
@@ -552,10 +541,7 @@
    SYMFILE_NAME is the name of the file we are reading from. */
 
 static void
-read_os9k_psymtab (objfile, text_addr, text_size)
-     struct objfile *objfile;
-     CORE_ADDR text_addr;
-     int text_size;
+read_os9k_psymtab (struct objfile *objfile, CORE_ADDR text_addr, int text_size)
 {
   register struct internal_symstruct *bufp = 0;		/* =0 avoids gcc -Wall glitch */
   register char *namestring;
@@ -973,15 +959,10 @@
 
 
 static struct partial_symtab *
-os9k_start_psymtab (objfile,
-	    filename, textlow, ldsymoff, ldsymcnt, global_syms, static_syms)
-     struct objfile *objfile;
-     char *filename;
-     CORE_ADDR textlow;
-     int ldsymoff;
-     int ldsymcnt;
-     struct partial_symbol **global_syms;
-     struct partial_symbol **static_syms;
+os9k_start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow,
+		    int ldsymoff, int ldsymcnt,
+		    struct partial_symbol **global_syms,
+		    struct partial_symbol **static_syms)
 {
   struct partial_symtab *result =
   start_psymtab_common (objfile, objfile->section_offsets,
@@ -1004,16 +985,11 @@
    FIXME:  List variables and peculiarities of same.  */
 
 static struct partial_symtab *
-os9k_end_psymtab (pst, include_list, num_includes, capping_symbol_cnt,
-		  capping_text, dependency_list, number_dependencies)
-     struct partial_symtab *pst;
-     char **include_list;
-     int num_includes;
-     int capping_symbol_cnt;
-     CORE_ADDR capping_text;
-     struct partial_symtab **dependency_list;
-     int number_dependencies;
-     /* struct partial_symbol *capping_global, *capping_static; */
+os9k_end_psymtab (struct partial_symtab *pst, char **include_list,
+		  int num_includes, int capping_symbol_cnt,
+		  CORE_ADDR capping_text,
+		  struct partial_symtab **dependency_list,
+		  int number_dependencies)
 {
   int i;
   struct partial_symtab *p1;
@@ -1188,8 +1164,7 @@
 }
 
 static void
-os9k_psymtab_to_symtab_1 (pst)
-     struct partial_symtab *pst;
+os9k_psymtab_to_symtab_1 (struct partial_symtab *pst)
 {
   struct cleanup *old_chain;
   int i;
@@ -1242,8 +1217,7 @@
    Be verbose about it if the user wants that.  */
 
 static void
-os9k_psymtab_to_symtab (pst)
-     struct partial_symtab *pst;
+os9k_psymtab_to_symtab (struct partial_symtab *pst)
 {
   bfd *sym_bfd;
 
@@ -1282,8 +1256,7 @@
 
 /* Read in a defined section of a specific object file's symbols. */
 static void
-os9k_read_ofile_symtab (pst)
-     struct partial_symtab *pst;
+os9k_read_ofile_symtab (struct partial_symtab *pst)
 {
   register struct internal_symstruct *bufp;
   unsigned char type;
@@ -1433,12 +1406,9 @@
    It is used in end_symtab.  */
 
 static void
-os9k_process_one_symbol (type, desc, valu, name, section_offsets, objfile)
-     int type, desc;
-     CORE_ADDR valu;
-     char *name;
-     struct section_offsets *section_offsets;
-     struct objfile *objfile;
+os9k_process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
+			 struct section_offsets *section_offsets,
+			 struct objfile *objfile)
 {
   register struct context_stack *new;
   /* The stab type used for the definition of the last function.
@@ -1645,7 +1615,7 @@
 };
 
 void
-_initialize_os9kread ()
+_initialize_os9kread (void)
 {
   add_symtab_fns (&os9k_sym_fns);
 }
diff --git a/gdb/osfsolib.c b/gdb/osfsolib.c
index 34b809d..0ca8f84 100644
--- a/gdb/osfsolib.c
+++ b/gdb/osfsolib.c
@@ -116,11 +116,7 @@
 static int ldr_read_memory (CORE_ADDR, char *, int, int);
 
 static int
-ldr_read_memory (memaddr, myaddr, len, readstring)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int readstring;
+ldr_read_memory (CORE_ADDR memaddr, char *myaddr, int len, int readstring)
 {
   int result;
   char *buffer;
@@ -130,7 +126,7 @@
       target_read_string (memaddr, &buffer, len, &result);
       if (result == 0)
 	strcpy (myaddr, buffer);
-      free (buffer);
+      xfree (buffer);
     }
   else
     result = target_read_memory (memaddr, myaddr, len);
@@ -221,8 +217,7 @@
  */
 
 static int
-solib_map_sections (arg)
-     char *arg;
+solib_map_sections (char *arg)
 {
   struct so_list *so = (struct so_list *) arg;	/* catch_errors bogon */
   char *filename;
@@ -233,7 +228,7 @@
   bfd *abfd;
 
   filename = tilde_expand (so->so_name);
-  old_chain = make_cleanup (free, filename);
+  old_chain = make_cleanup (xfree, filename);
 
   scratch_chan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0,
 			&scratch_pathname);
@@ -308,7 +303,7 @@
  */
 
 static struct link_map *
-first_link_map_member ()
+first_link_map_member (void)
 {
   struct link_map *lm = NULL;
   static struct link_map first_lm;
@@ -351,8 +346,7 @@
 }
 
 static struct link_map *
-next_link_map_member (so_list_ptr)
-     struct so_list *so_list_ptr;
+next_link_map_member (struct so_list *so_list_ptr)
 {
   struct link_map *lm = NULL;
   static struct link_map next_lm;
@@ -393,9 +387,7 @@
 }
 
 static void
-xfer_link_map_member (so_list_ptr, lm)
-     struct so_list *so_list_ptr;
-     struct link_map *lm;
+xfer_link_map_member (struct so_list *so_list_ptr, struct link_map *lm)
 {
   int i;
   so_list_ptr->lm = *lm;
@@ -453,7 +445,7 @@
 	error ("xfer_link_map_member: Can't read pathname for load map: %s\n",
 	       safe_strerror (errcode));
       strncpy (so_list_ptr->so_name, buffer, MAX_PATH_SIZE - 1);
-      free (buffer);
+      xfree (buffer);
       so_list_ptr->so_name[MAX_PATH_SIZE - 1] = '\0';
 
       for (i = 0; i < lm->module_info.region_count; i++)
@@ -480,7 +472,7 @@
 		region_name = "??";
 	      warning ("cannot handle shared library relocation for %s (%s)",
 		       so_list_ptr->so_name, region_name);
-	      free (buffer);
+	      xfree (buffer);
 	    }
 	}
 #endif
@@ -515,8 +507,7 @@
  */
 
 static struct so_list *
-find_solib (so_list_ptr)
-     struct so_list *so_list_ptr;	/* Last lm or NULL for first one */
+find_solib (struct so_list *so_list_ptr)
 {
   struct so_list *so_list_next = NULL;
   struct link_map *lm = NULL;
@@ -564,8 +555,7 @@
 /* A small stub to get us past the arg-passing pinhole of catch_errors.  */
 
 static int
-symbol_add_stub (arg)
-     char *arg;
+symbol_add_stub (char *arg)
 {
   register struct so_list *so = (struct so_list *) arg;		/* catch_errs bogon */
   CORE_ADDR text_addr = 0;
@@ -612,10 +602,7 @@
  */
 
 void
-solib_add (arg_string, from_tty, target)
-     char *arg_string;
-     int from_tty;
-     struct target_ops *target;
+solib_add (char *arg_string, int from_tty, struct target_ops *target)
 {
   register struct so_list *so = NULL;	/* link map state variable */
 
@@ -715,9 +702,7 @@
  */
 
 static void
-info_sharedlibrary_command (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+info_sharedlibrary_command (char *ignore, int from_tty)
 {
   register struct so_list *so = NULL;	/* link map state variable */
   int header_done = 0;
@@ -782,8 +767,7 @@
  */
 
 char *
-solib_address (address)
-     CORE_ADDR address;
+solib_address (CORE_ADDR address)
 {
   register struct so_list *so = 0;	/* link map state variable */
 
@@ -802,7 +786,7 @@
 /* Called by free_all_symtabs */
 
 void
-clear_solib ()
+clear_solib (void)
 {
   struct so_list *next;
   char *bfd_filename;
@@ -813,7 +797,7 @@
     {
       if (so_list_head->sections)
 	{
-	  free ((PTR) so_list_head->sections);
+	  xfree (so_list_head->sections);
 	}
       if (so_list_head->abfd)
 	{
@@ -828,8 +812,8 @@
 
       next = so_list_head->next;
       if (bfd_filename)
-	free ((PTR) bfd_filename);
-      free ((PTR) so_list_head);
+	xfree (bfd_filename);
+      xfree (so_list_head);
       so_list_head = next;
     }
 }
@@ -871,7 +855,7 @@
  */
 
 void
-solib_create_inferior_hook ()
+solib_create_inferior_hook (void)
 {
 
   /* Nothing to do for statically bound executables.  */
@@ -923,16 +907,14 @@
  */
 
 static void
-sharedlibrary_command (args, from_tty)
-     char *args;
-     int from_tty;
+sharedlibrary_command (char *args, int from_tty)
 {
   dont_repeat ();
   solib_add (args, from_tty, (struct target_ops *) 0);
 }
 
 void
-_initialize_solib ()
+_initialize_solib (void)
 {
   add_com ("sharedlibrary", class_files, sharedlibrary_command,
 	   "Load shared object library symbols for files matching REGEXP.");
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
new file mode 100644
index 0000000..edf34ca
--- /dev/null
+++ b/gdb/p-exp.y
@@ -0,0 +1,1457 @@
+/* YACC parser for Pascal expressions, for GDB.
+   Copyright (C) 2000
+   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.  */
+
+/* This file is derived from c-exp.y */
+
+/* Parse a Pascal expression from text in a string,
+   and return the result as a  struct expression  pointer.
+   That structure contains arithmetic operations in reverse polish,
+   with constants represented by operations that are followed by special data.
+   See expression.h for the details of the format.
+   What is important here is that it can be built up sequentially
+   during the process of parsing; the lower levels of the tree always
+   come first in the result.
+
+   Note that malloc's and realloc's in this file are transformed to
+   xmalloc and xrealloc respectively by the same sed command in the
+   makefile that remaps any other malloc/realloc inserted by the parser
+   generator.  Doing this with #defines and trying to control the interaction
+   with include files (<malloc.h> and <stdlib.h> for example) just became
+   too messy, particularly when such includes can be inserted at random
+   times by the parser generator.  */
+
+/* FIXME: there are still 21 shift/reduce conflicts
+   Other known bugs or limitations:
+    - pascal string operations are not supported at all.
+    - there are some problems with boolean types.
+    - Pascal type hexadecimal constants are not supported
+      because they conflict with the internal variables format.
+   Probably also lots of other problems, less well defined PM */
+%{
+
+#include "defs.h"
+#include "gdb_string.h"
+#include <ctype.h>
+#include "expression.h"
+#include "value.h"
+#include "parser-defs.h"
+#include "language.h"
+#include "p-lang.h"
+#include "bfd.h" /* Required by objfiles.h.  */
+#include "symfile.h" /* Required by objfiles.h.  */
+#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
+
+/* MSVC uses strnicmp instead of strncasecmp */
+#ifdef _MSC_VER
+#define strncasecmp strnicmp
+#endif
+
+/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
+   as well as gratuitiously global symbol names, so we can have multiple
+   yacc generated parsers in gdb.  Note that these are only the variables
+   produced by yacc.  If other parser generators (bison, byacc, etc) produce
+   additional global names that conflict at link time, then those parser
+   generators need to be fixed instead of adding those names to this list. */
+
+#define	yymaxdepth pascal_maxdepth
+#define	yyparse	pascal_parse
+#define	yylex	pascal_lex
+#define	yyerror	pascal_error
+#define	yylval	pascal_lval
+#define	yychar	pascal_char
+#define	yydebug	pascal_debug
+#define	yypact	pascal_pact	
+#define	yyr1	pascal_r1			
+#define	yyr2	pascal_r2			
+#define	yydef	pascal_def		
+#define	yychk	pascal_chk		
+#define	yypgo	pascal_pgo		
+#define	yyact	pascal_act
+#define	yyexca	pascal_exca
+#define yyerrflag pascal_errflag
+#define yynerrs	pascal_nerrs
+#define	yyps	pascal_ps
+#define	yypv	pascal_pv
+#define	yys	pascal_s
+#define	yy_yys	pascal_yys
+#define	yystate	pascal_state
+#define	yytmp	pascal_tmp
+#define	yyv	pascal_v
+#define	yy_yyv	pascal_yyv
+#define	yyval	pascal_val
+#define	yylloc	pascal_lloc
+#define yyreds	pascal_reds		/* With YYDEBUG defined */
+#define yytoks	pascal_toks		/* With YYDEBUG defined */
+#define yylhs	pascal_yylhs
+#define yylen	pascal_yylen
+#define yydefred pascal_yydefred
+#define yydgoto	pascal_yydgoto
+#define yysindex pascal_yysindex
+#define yyrindex pascal_yyrindex
+#define yygindex pascal_yygindex
+#define yytable	 pascal_yytable
+#define yycheck	 pascal_yycheck
+
+#ifndef YYDEBUG
+#define	YYDEBUG	0		/* Default to no yydebug support */
+#endif
+
+int yyparse (void);
+
+static int yylex (void);
+
+void
+yyerror (char *);
+
+static char * uptok (char *, int);
+%}
+
+/* Although the yacc "value" of an expression is not used,
+   since the result is stored in the structure being created,
+   other node types do have values.  */
+
+%union
+  {
+    LONGEST lval;
+    struct {
+      LONGEST val;
+      struct type *type;
+    } typed_val_int;
+    struct {
+      DOUBLEST dval;
+      struct type *type;
+    } typed_val_float;
+    struct symbol *sym;
+    struct type *tval;
+    struct stoken sval;
+    struct ttype tsym;
+    struct symtoken ssym;
+    int voidval;
+    struct block *bval;
+    enum exp_opcode opcode;
+    struct internalvar *ivar;
+
+    struct type **tvec;
+    int *ivec;
+  }
+
+%{
+/* YYSTYPE gets defined by %union */
+static int
+parse_number (char *, int, int, YYSTYPE *);
+%}
+
+%type <voidval> exp exp1 type_exp start variable qualified_name
+%type <tval> type typebase
+/* %type <bval> block */
+
+/* Fancy type parsing.  */
+%type <tval> ptype
+
+%token <typed_val_int> INT
+%token <typed_val_float> FLOAT
+
+/* Both NAME and TYPENAME tokens represent symbols in the input,
+   and both convey their data as strings.
+   But a TYPENAME is a string that happens to be defined as a typedef
+   or builtin type name (such as int or char)
+   and a NAME is any other symbol.
+   Contexts where this distinction is not important can use the
+   nonterminal "name", which matches either NAME or TYPENAME.  */
+
+%token <sval> STRING
+%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */
+%token <tsym> TYPENAME
+%type <sval> name
+%type <ssym> name_not_typename
+
+/* A NAME_OR_INT is a symbol which is not known in the symbol table,
+   but which would parse as a valid number in the current input radix.
+   E.g. "c" when input_radix==16.  Depending on the parse, it will be
+   turned into a name or into a number.  */
+
+%token <ssym> NAME_OR_INT
+
+%token STRUCT CLASS SIZEOF COLONCOLON
+%token ERROR
+
+/* Special type cases, put in to allow the parser to distinguish different
+   legal basetypes.  */
+
+%token <voidval> VARIABLE
+
+
+/* Object pascal */
+%token THIS
+%token <lval> TRUE FALSE
+
+%left ','
+%left ABOVE_COMMA
+%right ASSIGN
+%left NOT
+%left OR
+%left XOR
+%left ANDAND
+%left '=' NOTEQUAL
+%left '<' '>' LEQ GEQ
+%left LSH RSH DIV MOD
+%left '@'
+%left '+' '-'
+%left '*' '/'
+%right UNARY INCREMENT DECREMENT
+%right ARROW '.' '[' '('
+%token <ssym> BLOCKNAME
+%type <bval> block
+%left COLONCOLON
+
+
+%%
+
+start   :	exp1
+	|	type_exp
+	;
+
+type_exp:	type
+			{ write_exp_elt_opcode(OP_TYPE);
+			  write_exp_elt_type($1);
+			  write_exp_elt_opcode(OP_TYPE);}
+	;
+
+/* Expressions, including the comma operator.  */
+exp1	:	exp
+	|	exp1 ',' exp
+			{ write_exp_elt_opcode (BINOP_COMMA); }
+	;
+
+/* Expressions, not including the comma operator.  */
+exp	:	exp '^'   %prec UNARY
+			{ write_exp_elt_opcode (UNOP_IND); }
+
+exp	:	'@' exp    %prec UNARY
+			{ write_exp_elt_opcode (UNOP_ADDR); }
+
+exp	:	'-' exp    %prec UNARY
+			{ write_exp_elt_opcode (UNOP_NEG); }
+	;
+
+exp	:	NOT exp    %prec UNARY
+			{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
+	;
+
+exp	:	INCREMENT '(' exp ')'   %prec UNARY
+			{ write_exp_elt_opcode (UNOP_PREINCREMENT); }
+	;
+
+exp	:	DECREMENT  '(' exp ')'   %prec UNARY
+			{ write_exp_elt_opcode (UNOP_PREDECREMENT); }
+	;
+
+exp	:	exp '.' name
+			{ write_exp_elt_opcode (STRUCTOP_STRUCT);
+			  write_exp_string ($3);
+			  write_exp_elt_opcode (STRUCTOP_STRUCT); }
+	;
+
+exp	:	exp '[' exp1 ']'
+			{ write_exp_elt_opcode (BINOP_SUBSCRIPT); }
+	;
+
+exp	:	exp '('
+			/* This is to save the value of arglist_len
+			   being accumulated by an outer function call.  */
+			{ start_arglist (); }
+		arglist ')'	%prec ARROW
+			{ write_exp_elt_opcode (OP_FUNCALL);
+			  write_exp_elt_longcst ((LONGEST) end_arglist ());
+			  write_exp_elt_opcode (OP_FUNCALL); }
+	;
+
+arglist	:
+         | exp
+			{ arglist_len = 1; }
+	 | arglist ',' exp   %prec ABOVE_COMMA
+			{ arglist_len++; }
+	;
+
+exp	:	type '(' exp ')' %prec UNARY
+			{ write_exp_elt_opcode (UNOP_CAST);
+			  write_exp_elt_type ($1);
+			  write_exp_elt_opcode (UNOP_CAST); }
+	;
+
+exp	:	'(' exp1 ')'
+			{ }
+	;
+
+/* Binary operators in order of decreasing precedence.  */
+
+exp	:	exp '*' exp
+			{ write_exp_elt_opcode (BINOP_MUL); }
+	;
+
+exp	:	exp '/' exp
+			{ write_exp_elt_opcode (BINOP_DIV); }
+	;
+
+exp	:	exp DIV exp
+			{ write_exp_elt_opcode (BINOP_INTDIV); }
+	;
+
+exp	:	exp MOD exp
+			{ write_exp_elt_opcode (BINOP_REM); }
+	;
+
+exp	:	exp '+' exp
+			{ write_exp_elt_opcode (BINOP_ADD); }
+	;
+
+exp	:	exp '-' exp
+			{ write_exp_elt_opcode (BINOP_SUB); }
+	;
+
+exp	:	exp LSH exp
+			{ write_exp_elt_opcode (BINOP_LSH); }
+	;
+
+exp	:	exp RSH exp
+			{ write_exp_elt_opcode (BINOP_RSH); }
+	;
+
+exp	:	exp '=' exp
+			{ write_exp_elt_opcode (BINOP_EQUAL); }
+	;
+
+exp	:	exp NOTEQUAL exp
+			{ write_exp_elt_opcode (BINOP_NOTEQUAL); }
+	;
+
+exp	:	exp LEQ exp
+			{ write_exp_elt_opcode (BINOP_LEQ); }
+	;
+
+exp	:	exp GEQ exp
+			{ write_exp_elt_opcode (BINOP_GEQ); }
+	;
+
+exp	:	exp '<' exp
+			{ write_exp_elt_opcode (BINOP_LESS); }
+	;
+
+exp	:	exp '>' exp
+			{ write_exp_elt_opcode (BINOP_GTR); }
+	;
+
+exp	:	exp ANDAND exp
+			{ write_exp_elt_opcode (BINOP_BITWISE_AND); }
+	;
+
+exp	:	exp XOR exp
+			{ write_exp_elt_opcode (BINOP_BITWISE_XOR); }
+	;
+
+exp	:	exp OR exp
+			{ write_exp_elt_opcode (BINOP_BITWISE_IOR); }
+	;
+
+exp	:	exp ASSIGN exp
+			{ write_exp_elt_opcode (BINOP_ASSIGN); }
+	;
+
+exp	:	TRUE
+			{ write_exp_elt_opcode (OP_BOOL);
+			  write_exp_elt_longcst ((LONGEST) $1);
+			  write_exp_elt_opcode (OP_BOOL); }
+	;
+
+exp	:	FALSE
+			{ write_exp_elt_opcode (OP_BOOL);
+			  write_exp_elt_longcst ((LONGEST) $1);
+			  write_exp_elt_opcode (OP_BOOL); }
+	;
+
+exp	:	INT
+			{ write_exp_elt_opcode (OP_LONG);
+			  write_exp_elt_type ($1.type);
+			  write_exp_elt_longcst ((LONGEST)($1.val));
+			  write_exp_elt_opcode (OP_LONG); }
+	;
+
+exp	:	NAME_OR_INT
+			{ YYSTYPE val;
+			  parse_number ($1.stoken.ptr, $1.stoken.length, 0, &val);
+			  write_exp_elt_opcode (OP_LONG);
+			  write_exp_elt_type (val.typed_val_int.type);
+			  write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
+			  write_exp_elt_opcode (OP_LONG);
+			}
+	;
+
+
+exp	:	FLOAT
+			{ write_exp_elt_opcode (OP_DOUBLE);
+			  write_exp_elt_type ($1.type);
+			  write_exp_elt_dblcst ($1.dval);
+			  write_exp_elt_opcode (OP_DOUBLE); }
+	;
+
+exp	:	variable
+	;
+
+exp	:	VARIABLE
+			/* Already written by write_dollar_variable. */
+	;
+
+exp	:	SIZEOF '(' type ')'	%prec UNARY
+			{ write_exp_elt_opcode (OP_LONG);
+			  write_exp_elt_type (builtin_type_int);
+			  CHECK_TYPEDEF ($3);
+			  write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
+			  write_exp_elt_opcode (OP_LONG); }
+	;
+
+exp	:	STRING
+			{ /* C strings are converted into array constants with
+			     an explicit null byte added at the end.  Thus
+			     the array upper bound is the string length.
+			     There is no such thing in C as a completely empty
+			     string. */
+			  char *sp = $1.ptr; int count = $1.length;
+			  while (count-- > 0)
+			    {
+			      write_exp_elt_opcode (OP_LONG);
+			      write_exp_elt_type (builtin_type_char);
+			      write_exp_elt_longcst ((LONGEST)(*sp++));
+			      write_exp_elt_opcode (OP_LONG);
+			    }
+			  write_exp_elt_opcode (OP_LONG);
+			  write_exp_elt_type (builtin_type_char);
+			  write_exp_elt_longcst ((LONGEST)'\0');
+			  write_exp_elt_opcode (OP_LONG);
+			  write_exp_elt_opcode (OP_ARRAY);
+			  write_exp_elt_longcst ((LONGEST) 0);
+			  write_exp_elt_longcst ((LONGEST) ($1.length));
+			  write_exp_elt_opcode (OP_ARRAY); }
+	;
+
+/* Object pascal  */
+exp	:	THIS
+			{ write_exp_elt_opcode (OP_THIS);
+			  write_exp_elt_opcode (OP_THIS); }
+	;
+
+/* end of object pascal.  */
+
+block	:	BLOCKNAME
+			{
+			  if ($1.sym != 0)
+			      $$ = SYMBOL_BLOCK_VALUE ($1.sym);
+			  else
+			    {
+			      struct symtab *tem =
+				  lookup_symtab (copy_name ($1.stoken));
+			      if (tem)
+				$$ = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK);
+			      else
+				error ("No file or function \"%s\".",
+				       copy_name ($1.stoken));
+			    }
+			}
+	;
+
+block	:	block COLONCOLON name
+			{ struct symbol *tem
+			    = lookup_symbol (copy_name ($3), $1,
+					     VAR_NAMESPACE, (int *) NULL,
+					     (struct symtab **) NULL);
+			  if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
+			    error ("No function \"%s\" in specified context.",
+				   copy_name ($3));
+			  $$ = SYMBOL_BLOCK_VALUE (tem); }
+	;
+
+variable:	block COLONCOLON name
+			{ struct symbol *sym;
+			  sym = lookup_symbol (copy_name ($3), $1,
+					       VAR_NAMESPACE, (int *) NULL,
+					       (struct symtab **) NULL);
+			  if (sym == 0)
+			    error ("No symbol \"%s\" in specified context.",
+				   copy_name ($3));
+
+			  write_exp_elt_opcode (OP_VAR_VALUE);
+			  /* block_found is set by lookup_symbol.  */
+			  write_exp_elt_block (block_found);
+			  write_exp_elt_sym (sym);
+			  write_exp_elt_opcode (OP_VAR_VALUE); }
+	;
+
+qualified_name:	typebase COLONCOLON name
+			{
+			  struct type *type = $1;
+			  if (TYPE_CODE (type) != TYPE_CODE_STRUCT
+			      && TYPE_CODE (type) != TYPE_CODE_UNION)
+			    error ("`%s' is not defined as an aggregate type.",
+				   TYPE_NAME (type));
+
+			  write_exp_elt_opcode (OP_SCOPE);
+			  write_exp_elt_type (type);
+			  write_exp_string ($3);
+			  write_exp_elt_opcode (OP_SCOPE);
+			}
+	;
+
+variable:	qualified_name
+	|	COLONCOLON name
+			{
+			  char *name = copy_name ($2);
+			  struct symbol *sym;
+			  struct minimal_symbol *msymbol;
+
+			  sym =
+			    lookup_symbol (name, (const struct block *) NULL,
+					   VAR_NAMESPACE, (int *) NULL,
+					   (struct symtab **) NULL);
+			  if (sym)
+			    {
+			      write_exp_elt_opcode (OP_VAR_VALUE);
+			      write_exp_elt_block (NULL);
+			      write_exp_elt_sym (sym);
+			      write_exp_elt_opcode (OP_VAR_VALUE);
+			      break;
+			    }
+
+			  msymbol = lookup_minimal_symbol (name, NULL, NULL);
+			  if (msymbol != NULL)
+			    {
+			      write_exp_msymbol (msymbol,
+						 lookup_function_type (builtin_type_int),
+						 builtin_type_int);
+			    }
+			  else
+			    if (!have_full_symbols () && !have_partial_symbols ())
+			      error ("No symbol table is loaded.  Use the \"file\" command.");
+			    else
+			      error ("No symbol \"%s\" in current context.", name);
+			}
+	;
+
+variable:	name_not_typename
+			{ struct symbol *sym = $1.sym;
+
+			  if (sym)
+			    {
+			      if (symbol_read_needs_frame (sym))
+				{
+				  if (innermost_block == 0 ||
+				      contained_in (block_found,
+						    innermost_block))
+				    innermost_block = block_found;
+				}
+
+			      write_exp_elt_opcode (OP_VAR_VALUE);
+			      /* We want to use the selected frame, not
+				 another more inner frame which happens to
+				 be in the same block.  */
+			      write_exp_elt_block (NULL);
+			      write_exp_elt_sym (sym);
+			      write_exp_elt_opcode (OP_VAR_VALUE);
+			    }
+			  else if ($1.is_a_field_of_this)
+			    {
+			      /* Object pascal: it hangs off of `this'.  Must
+			         not inadvertently convert from a method call
+				 to data ref.  */
+			      if (innermost_block == 0 ||
+				  contained_in (block_found, innermost_block))
+				innermost_block = block_found;
+			      write_exp_elt_opcode (OP_THIS);
+			      write_exp_elt_opcode (OP_THIS);
+			      write_exp_elt_opcode (STRUCTOP_PTR);
+			      write_exp_string ($1.stoken);
+			      write_exp_elt_opcode (STRUCTOP_PTR);
+			    }
+			  else
+			    {
+			      struct minimal_symbol *msymbol;
+			      register char *arg = copy_name ($1.stoken);
+
+			      msymbol =
+				lookup_minimal_symbol (arg, NULL, NULL);
+			      if (msymbol != NULL)
+				{
+				  write_exp_msymbol (msymbol,
+						     lookup_function_type (builtin_type_int),
+						     builtin_type_int);
+				}
+			      else if (!have_full_symbols () && !have_partial_symbols ())
+				error ("No symbol table is loaded.  Use the \"file\" command.");
+			      else
+				error ("No symbol \"%s\" in current context.",
+				       copy_name ($1.stoken));
+			    }
+			}
+	;
+
+
+ptype	:	typebase
+	;
+
+/* We used to try to recognize more pointer to member types here, but
+   that didn't work (shift/reduce conflicts meant that these rules never
+   got executed).  The problem is that
+     int (foo::bar::baz::bizzle)
+   is a function type but
+     int (foo::bar::baz::bizzle::*)
+   is a pointer to member type.  Stroustrup loses again!  */
+
+type	:	ptype
+	|	typebase COLONCOLON '*'
+			{ $$ = lookup_member_type (builtin_type_int, $1); }
+	;
+
+typebase  /* Implements (approximately): (type-qualifier)* type-specifier */
+	:	TYPENAME
+			{ $$ = $1.type; }
+	|	STRUCT name
+			{ $$ = lookup_struct (copy_name ($2),
+					      expression_context_block); }
+	|	CLASS name
+			{ $$ = lookup_struct (copy_name ($2),
+					      expression_context_block); }
+	/* "const" and "volatile" are curently ignored.  A type qualifier
+	   after the type is handled in the ptype rule.  I think these could
+	   be too.  */
+	;
+
+name	:	NAME { $$ = $1.stoken; }
+	|	BLOCKNAME { $$ = $1.stoken; }
+	|	TYPENAME { $$ = $1.stoken; }
+	|	NAME_OR_INT  { $$ = $1.stoken; }
+	;
+
+name_not_typename :	NAME
+	|	BLOCKNAME
+/* These would be useful if name_not_typename was useful, but it is just
+   a fake for "variable", so these cause reduce/reduce conflicts because
+   the parser can't tell whether NAME_OR_INT is a name_not_typename (=variable,
+   =exp) or just an exp.  If name_not_typename was ever used in an lvalue
+   context where only a name could occur, this might be useful.
+  	|	NAME_OR_INT
+ */
+	;
+
+%%
+
+/* Take care of parsing a number (anything that starts with a digit).
+   Set yylval and return the token type; update lexptr.
+   LEN is the number of characters in it.  */
+
+/*** Needs some error checking for the float case ***/
+
+static int
+parse_number (p, len, parsed_float, putithere)
+     register char *p;
+     register int len;
+     int parsed_float;
+     YYSTYPE *putithere;
+{
+  /* FIXME: Shouldn't these be unsigned?  We don't deal with negative values
+     here, and we do kind of silly things like cast to unsigned.  */
+  register LONGEST n = 0;
+  register LONGEST prevn = 0;
+  ULONGEST un;
+
+  register int i = 0;
+  register int c;
+  register int base = input_radix;
+  int unsigned_p = 0;
+
+  /* Number of "L" suffixes encountered.  */
+  int long_p = 0;
+
+  /* We have found a "L" or "U" suffix.  */
+  int found_suffix = 0;
+
+  ULONGEST high_bit;
+  struct type *signed_type;
+  struct type *unsigned_type;
+
+  if (parsed_float)
+    {
+      /* It's a float since it contains a point or an exponent.  */
+      char c;
+      int num = 0;	/* number of tokens scanned by scanf */
+      char saved_char = p[len];
+
+      p[len] = 0;	/* null-terminate the token */
+      if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
+	num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval,&c);
+      else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
+	num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval,&c);
+      else
+	{
+#ifdef SCANF_HAS_LONG_DOUBLE
+	  num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval,&c);
+#else
+	  /* Scan it into a double, then assign it to the long double.
+	     This at least wins with values representable in the range
+	     of doubles. */
+	  double temp;
+	  num = sscanf (p, "%lg%c", &temp,&c);
+	  putithere->typed_val_float.dval = temp;
+#endif
+	}
+      p[len] = saved_char;	/* restore the input stream */
+      if (num != 1) 		/* check scanf found ONLY a float ... */
+	return ERROR;
+      /* See if it has `f' or `l' suffix (float or long double).  */
+
+      c = tolower (p[len - 1]);
+
+      if (c == 'f')
+	putithere->typed_val_float.type = builtin_type_float;
+      else if (c == 'l')
+	putithere->typed_val_float.type = builtin_type_long_double;
+      else if (isdigit (c) || c == '.')
+	putithere->typed_val_float.type = builtin_type_double;
+      else
+	return ERROR;
+
+      return FLOAT;
+    }
+
+  /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
+  if (p[0] == '0')
+    switch (p[1])
+      {
+      case 'x':
+      case 'X':
+	if (len >= 3)
+	  {
+	    p += 2;
+	    base = 16;
+	    len -= 2;
+	  }
+	break;
+
+      case 't':
+      case 'T':
+      case 'd':
+      case 'D':
+	if (len >= 3)
+	  {
+	    p += 2;
+	    base = 10;
+	    len -= 2;
+	  }
+	break;
+
+      default:
+	base = 8;
+	break;
+      }
+
+  while (len-- > 0)
+    {
+      c = *p++;
+      if (c >= 'A' && c <= 'Z')
+	c += 'a' - 'A';
+      if (c != 'l' && c != 'u')
+	n *= base;
+      if (c >= '0' && c <= '9')
+	{
+	  if (found_suffix)
+	    return ERROR;
+	  n += i = c - '0';
+	}
+      else
+	{
+	  if (base > 10 && c >= 'a' && c <= 'f')
+	    {
+	      if (found_suffix)
+		return ERROR;
+	      n += i = c - 'a' + 10;
+	    }
+	  else if (c == 'l')
+	    {
+	      ++long_p;
+	      found_suffix = 1;
+	    }
+	  else if (c == 'u')
+	    {
+	      unsigned_p = 1;
+	      found_suffix = 1;
+	    }
+	  else
+	    return ERROR;	/* Char not a digit */
+	}
+      if (i >= base)
+	return ERROR;		/* Invalid digit in this base */
+
+      /* Portably test for overflow (only works for nonzero values, so make
+	 a second check for zero).  FIXME: Can't we just make n and prevn
+	 unsigned and avoid this?  */
+      if (c != 'l' && c != 'u' && (prevn >= n) && n != 0)
+	unsigned_p = 1;		/* Try something unsigned */
+
+      /* Portably test for unsigned overflow.
+	 FIXME: This check is wrong; for example it doesn't find overflow
+	 on 0x123456789 when LONGEST is 32 bits.  */
+      if (c != 'l' && c != 'u' && n != 0)
+	{	
+	  if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n))
+	    error ("Numeric constant too large.");
+	}
+      prevn = n;
+    }
+
+  /* An integer constant is an int, a long, or a long long.  An L
+     suffix forces it to be long; an LL suffix forces it to be long
+     long.  If not forced to a larger size, it gets the first type of
+     the above that it fits in.  To figure out whether it fits, we
+     shift it right and see whether anything remains.  Note that we
+     can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
+     operation, because many compilers will warn about such a shift
+     (which always produces a zero result).  Sometimes TARGET_INT_BIT
+     or TARGET_LONG_BIT will be that big, sometimes not.  To deal with
+     the case where it is we just always shift the value more than
+     once, with fewer bits each time.  */
+
+  un = (ULONGEST)n >> 2;
+  if (long_p == 0
+      && (un >> (TARGET_INT_BIT - 2)) == 0)
+    {
+      high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1);
+
+      /* A large decimal (not hex or octal) constant (between INT_MAX
+	 and UINT_MAX) is a long or unsigned long, according to ANSI,
+	 never an unsigned int, but this code treats it as unsigned
+	 int.  This probably should be fixed.  GCC gives a warning on
+	 such constants.  */
+
+      unsigned_type = builtin_type_unsigned_int;
+      signed_type = builtin_type_int;
+    }
+  else if (long_p <= 1
+	   && (un >> (TARGET_LONG_BIT - 2)) == 0)
+    {
+      high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1);
+      unsigned_type = builtin_type_unsigned_long;
+      signed_type = builtin_type_long;
+    }
+  else
+    {
+      high_bit = (((ULONGEST)1)
+		  << (TARGET_LONG_LONG_BIT - 32 - 1)
+		  << 16
+		  << 16);
+      if (high_bit == 0)
+	/* A long long does not fit in a LONGEST.  */
+	high_bit =
+	  (ULONGEST)1 << (sizeof (LONGEST) * HOST_CHAR_BIT - 1);
+      unsigned_type = builtin_type_unsigned_long_long;
+      signed_type = builtin_type_long_long;
+    }
+
+   putithere->typed_val_int.val = n;
+
+   /* If the high bit of the worked out type is set then this number
+      has to be unsigned. */
+
+   if (unsigned_p || (n & high_bit))
+     {
+       putithere->typed_val_int.type = unsigned_type;
+     }
+   else
+     {
+       putithere->typed_val_int.type = signed_type;
+     }
+
+   return INT;
+}
+
+struct token
+{
+  char *operator;
+  int token;
+  enum exp_opcode opcode;
+};
+
+static const struct token tokentab3[] =
+  {
+    {"shr", RSH, BINOP_END},
+    {"shl", LSH, BINOP_END},
+    {"and", ANDAND, BINOP_END},
+    {"div", DIV, BINOP_END},
+    {"not", NOT, BINOP_END},
+    {"mod", MOD, BINOP_END},
+    {"inc", INCREMENT, BINOP_END},
+    {"dec", DECREMENT, BINOP_END},
+    {"xor", XOR, BINOP_END}
+  };
+
+static const struct token tokentab2[] =
+  {
+    {"or", OR, BINOP_END},
+    {"<>", NOTEQUAL, BINOP_END},
+    {"<=", LEQ, BINOP_END},
+    {">=", GEQ, BINOP_END},
+    {":=", ASSIGN, BINOP_END}
+  };
+
+/* Allocate uppercased var */
+/* make an uppercased copy of tokstart */
+static char * uptok (tokstart, namelen)
+  char *tokstart;
+  int namelen;
+{
+  int i;
+  char *uptokstart = (char *)malloc(namelen+1);
+  for (i = 0;i <= namelen;i++)
+    {
+      if ((tokstart[i]>='a' && tokstart[i]<='z'))
+        uptokstart[i] = tokstart[i]-('a'-'A');
+      else
+        uptokstart[i] = tokstart[i];
+    }
+  uptokstart[namelen]='\0';
+  return uptokstart;
+}
+/* Read one token, getting characters through lexptr.  */
+
+
+static int
+yylex ()
+{
+  int c;
+  int namelen;
+  unsigned int i;
+  char *tokstart;
+  char *uptokstart;
+  char *tokptr;
+  char *p;
+  int explen, tempbufindex;
+  static char *tempbuf;
+  static int tempbufsize;
+
+ retry:
+
+  tokstart = lexptr;
+  explen = strlen (lexptr);
+  /* See if it is a special token of length 3.  */
+  if (explen > 2)
+    for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
+      if (strncasecmp (tokstart, tokentab3[i].operator, 3) == 0
+          && (!isalpha (tokentab3[i].operator[0]) || explen == 3
+              || (!isalpha (tokstart[3]) && !isdigit (tokstart[3]) && tokstart[3] != '_')))
+        {
+          lexptr += 3;
+          yylval.opcode = tokentab3[i].opcode;
+          return tokentab3[i].token;
+        }
+
+  /* See if it is a special token of length 2.  */
+  if (explen > 1)
+  for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
+      if (strncasecmp (tokstart, tokentab2[i].operator, 2) == 0
+          && (!isalpha (tokentab2[i].operator[0]) || explen == 2
+              || (!isalpha (tokstart[2]) && !isdigit (tokstart[2]) && tokstart[2] != '_')))
+        {
+          lexptr += 2;
+          yylval.opcode = tokentab2[i].opcode;
+          return tokentab2[i].token;
+        }
+
+  switch (c = *tokstart)
+    {
+    case 0:
+      return 0;
+
+    case ' ':
+    case '\t':
+    case '\n':
+      lexptr++;
+      goto retry;
+
+    case '\'':
+      /* We either have a character constant ('0' or '\177' for example)
+	 or we have a quoted symbol reference ('foo(int,int)' in object pascal
+	 for example). */
+      lexptr++;
+      c = *lexptr++;
+      if (c == '\\')
+	c = parse_escape (&lexptr);
+      else if (c == '\'')
+	error ("Empty character constant.");
+
+      yylval.typed_val_int.val = c;
+      yylval.typed_val_int.type = builtin_type_char;
+
+      c = *lexptr++;
+      if (c != '\'')
+	{
+	  namelen = skip_quoted (tokstart) - tokstart;
+	  if (namelen > 2)
+	    {
+	      lexptr = tokstart + namelen;
+	      if (lexptr[-1] != '\'')
+		error ("Unmatched single quote.");
+	      namelen -= 2;
+              tokstart++;
+              uptokstart = uptok(tokstart,namelen);
+	      goto tryname;
+	    }
+	  error ("Invalid character constant.");
+	}
+      return INT;
+
+    case '(':
+      paren_depth++;
+      lexptr++;
+      return c;
+
+    case ')':
+      if (paren_depth == 0)
+	return 0;
+      paren_depth--;
+      lexptr++;
+      return c;
+
+    case ',':
+      if (comma_terminates && paren_depth == 0)
+	return 0;
+      lexptr++;
+      return c;
+
+    case '.':
+      /* Might be a floating point number.  */
+      if (lexptr[1] < '0' || lexptr[1] > '9')
+	goto symbol;		/* Nope, must be a symbol. */
+      /* FALL THRU into number case.  */
+
+    case '0':
+    case '1':
+    case '2':
+    case '3':
+    case '4':
+    case '5':
+    case '6':
+    case '7':
+    case '8':
+    case '9':
+      {
+	/* It's a number.  */
+	int got_dot = 0, got_e = 0, toktype;
+	register char *p = tokstart;
+	int hex = input_radix > 10;
+
+	if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
+	  {
+	    p += 2;
+	    hex = 1;
+	  }
+	else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
+	  {
+	    p += 2;
+	    hex = 0;
+	  }
+
+	for (;; ++p)
+	  {
+	    /* This test includes !hex because 'e' is a valid hex digit
+	       and thus does not indicate a floating point number when
+	       the radix is hex.  */
+	    if (!hex && !got_e && (*p == 'e' || *p == 'E'))
+	      got_dot = got_e = 1;
+	    /* This test does not include !hex, because a '.' always indicates
+	       a decimal floating point number regardless of the radix.  */
+	    else if (!got_dot && *p == '.')
+	      got_dot = 1;
+	    else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
+		     && (*p == '-' || *p == '+'))
+	      /* This is the sign of the exponent, not the end of the
+		 number.  */
+	      continue;
+	    /* We will take any letters or digits.  parse_number will
+	       complain if past the radix, or if L or U are not final.  */
+	    else if ((*p < '0' || *p > '9')
+		     && ((*p < 'a' || *p > 'z')
+				  && (*p < 'A' || *p > 'Z')))
+	      break;
+	  }
+	toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
+        if (toktype == ERROR)
+	  {
+	    char *err_copy = (char *) alloca (p - tokstart + 1);
+
+	    memcpy (err_copy, tokstart, p - tokstart);
+	    err_copy[p - tokstart] = 0;
+	    error ("Invalid number \"%s\".", err_copy);
+	  }
+	lexptr = p;
+	return toktype;
+      }
+
+    case '+':
+    case '-':
+    case '*':
+    case '/':
+    case '|':
+    case '&':
+    case '^':
+    case '~':
+    case '!':
+    case '@':
+    case '<':
+    case '>':
+    case '[':
+    case ']':
+    case '?':
+    case ':':
+    case '=':
+    case '{':
+    case '}':
+    symbol:
+      lexptr++;
+      return c;
+
+    case '"':
+
+      /* Build the gdb internal form of the input string in tempbuf,
+	 translating any standard C escape forms seen.  Note that the
+	 buffer is null byte terminated *only* for the convenience of
+	 debugging gdb itself and printing the buffer contents when
+	 the buffer contains no embedded nulls.  Gdb does not depend
+	 upon the buffer being null byte terminated, it uses the length
+	 string instead.  This allows gdb to handle C strings (as well
+	 as strings in other languages) with embedded null bytes */
+
+      tokptr = ++tokstart;
+      tempbufindex = 0;
+
+      do {
+	/* Grow the static temp buffer if necessary, including allocating
+	   the first one on demand. */
+	if (tempbufindex + 1 >= tempbufsize)
+	  {
+	    tempbuf = (char *) realloc (tempbuf, tempbufsize += 64);
+	  }
+	switch (*tokptr)
+	  {
+	  case '\0':
+	  case '"':
+	    /* Do nothing, loop will terminate. */
+	    break;
+	  case '\\':
+	    tokptr++;
+	    c = parse_escape (&tokptr);
+	    if (c == -1)
+	      {
+		continue;
+	      }
+	    tempbuf[tempbufindex++] = c;
+	    break;
+	  default:
+	    tempbuf[tempbufindex++] = *tokptr++;
+	    break;
+	  }
+      } while ((*tokptr != '"') && (*tokptr != '\0'));
+      if (*tokptr++ != '"')
+	{
+	  error ("Unterminated string in expression.");
+	}
+      tempbuf[tempbufindex] = '\0';	/* See note above */
+      yylval.sval.ptr = tempbuf;
+      yylval.sval.length = tempbufindex;
+      lexptr = tokptr;
+      return (STRING);
+    }
+
+  if (!(c == '_' || c == '$'
+	|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
+    /* We must have come across a bad character (e.g. ';').  */
+    error ("Invalid character '%c' in expression.", c);
+
+  /* It's a name.  See how long it is.  */
+  namelen = 0;
+  for (c = tokstart[namelen];
+       (c == '_' || c == '$' || (c >= '0' && c <= '9')
+	|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
+    {
+      /* Template parameter lists are part of the name.
+	 FIXME: This mishandles `print $a<4&&$a>3'.  */
+      if (c == '<')
+	{
+	  int i = namelen;
+	  int nesting_level = 1;
+	  while (tokstart[++i])
+	    {
+	      if (tokstart[i] == '<')
+		nesting_level++;
+	      else if (tokstart[i] == '>')
+		{
+		  if (--nesting_level == 0)
+		    break;
+		}
+	    }
+	  if (tokstart[i] == '>')
+	    namelen = i;
+	  else
+	    break;
+	}
+
+      /* do NOT uppercase internals because of registers !!! */
+      c = tokstart[++namelen];
+    }
+
+  uptokstart = uptok(tokstart,namelen);
+
+  /* The token "if" terminates the expression and is NOT
+     removed from the input stream.  */
+  if (namelen == 2 && uptokstart[0] == 'I' && uptokstart[1] == 'F')
+    {
+      return 0;
+    }
+
+  lexptr += namelen;
+
+  tryname:
+
+  /* Catch specific keywords.  Should be done with a data structure.  */
+  switch (namelen)
+    {
+    case 6:
+      if (STREQ (uptokstart, "OBJECT"))
+	return CLASS;
+      if (STREQ (uptokstart, "RECORD"))
+	return STRUCT;
+      if (STREQ (uptokstart, "SIZEOF"))
+	return SIZEOF;
+      break;
+    case 5:
+      if (STREQ (uptokstart, "CLASS"))
+	return CLASS;
+      if (STREQ (uptokstart, "FALSE"))
+	{
+          yylval.lval = 0;
+          return FALSE;
+        }
+      break;
+    case 4:
+      if (STREQ (uptokstart, "TRUE"))
+	{
+          yylval.lval = 1;
+  	  return TRUE;
+        }
+      if (STREQ (uptokstart, "SELF"))
+        {
+          /* here we search for 'this' like
+             inserted in FPC stabs debug info */
+	  static const char this_name[] =
+				 { /* CPLUS_MARKER,*/ 't', 'h', 'i', 's', '\0' };
+
+	  if (lookup_symbol (this_name, expression_context_block,
+			     VAR_NAMESPACE, (int *) NULL,
+			     (struct symtab **) NULL))
+	    return THIS;
+	}
+      break;
+    default:
+      break;
+    }
+
+  yylval.sval.ptr = tokstart;
+  yylval.sval.length = namelen;
+
+  if (*tokstart == '$')
+    {
+      /* $ is the normal prefix for pascal hexadecimal values
+        but this conflicts with the GDB use for debugger variables
+        so in expression to enter hexadecimal values
+        we still need to use C syntax with 0xff  */
+      write_dollar_variable (yylval.sval);
+      return VARIABLE;
+    }
+
+  /* Use token-type BLOCKNAME for symbols that happen to be defined as
+     functions or symtabs.  If this is not so, then ...
+     Use token-type TYPENAME for symbols that happen to be defined
+     currently as names of types; NAME for other symbols.
+     The caller is not constrained to care about the distinction.  */
+  {
+    char *tmp = copy_name (yylval.sval);
+    struct symbol *sym;
+    int is_a_field_of_this = 0;
+    int hextype;
+
+    sym = lookup_symbol (tmp, expression_context_block,
+			 VAR_NAMESPACE,
+			 &is_a_field_of_this,
+			 (struct symtab **) NULL);
+    /* second chance uppercased ! */
+    if (!sym)
+      {
+       for (i = 0;i <= namelen;i++)
+         {
+           if ((tmp[i]>='a' && tmp[i]<='z'))
+             tmp[i] -= ('a'-'A');
+           /* I am not sure that copy_name gives excatly the same result ! */
+           if ((tokstart[i]>='a' && tokstart[i]<='z'))
+             tokstart[i] -= ('a'-'A');
+         }
+        sym = lookup_symbol (tmp, expression_context_block,
+			 VAR_NAMESPACE,
+			 &is_a_field_of_this,
+			 (struct symtab **) NULL);
+      }
+    /* Call lookup_symtab, not lookup_partial_symtab, in case there are
+       no psymtabs (coff, xcoff, or some future change to blow away the
+       psymtabs once once symbols are read).  */
+    if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ||
+        lookup_symtab (tmp))
+      {
+	yylval.ssym.sym = sym;
+	yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+	return BLOCKNAME;
+      }
+    if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
+        {
+#if 1
+	  /* Despite the following flaw, we need to keep this code enabled.
+	     Because we can get called from check_stub_method, if we don't
+	     handle nested types then it screws many operations in any
+	     program which uses nested types.  */
+	  /* In "A::x", if x is a member function of A and there happens
+	     to be a type (nested or not, since the stabs don't make that
+	     distinction) named x, then this code incorrectly thinks we
+	     are dealing with nested types rather than a member function.  */
+
+	  char *p;
+	  char *namestart;
+	  struct symbol *best_sym;
+
+	  /* Look ahead to detect nested types.  This probably should be
+	     done in the grammar, but trying seemed to introduce a lot
+	     of shift/reduce and reduce/reduce conflicts.  It's possible
+	     that it could be done, though.  Or perhaps a non-grammar, but
+	     less ad hoc, approach would work well.  */
+
+	  /* Since we do not currently have any way of distinguishing
+	     a nested type from a non-nested one (the stabs don't tell
+	     us whether a type is nested), we just ignore the
+	     containing type.  */
+
+	  p = lexptr;
+	  best_sym = sym;
+	  while (1)
+	    {
+	      /* Skip whitespace.  */
+	      while (*p == ' ' || *p == '\t' || *p == '\n')
+		++p;
+	      if (*p == ':' && p[1] == ':')
+		{
+		  /* Skip the `::'.  */
+		  p += 2;
+		  /* Skip whitespace.  */
+		  while (*p == ' ' || *p == '\t' || *p == '\n')
+		    ++p;
+		  namestart = p;
+		  while (*p == '_' || *p == '$' || (*p >= '0' && *p <= '9')
+			 || (*p >= 'a' && *p <= 'z')
+			 || (*p >= 'A' && *p <= 'Z'))
+		    ++p;
+		  if (p != namestart)
+		    {
+		      struct symbol *cur_sym;
+		      /* As big as the whole rest of the expression, which is
+			 at least big enough.  */
+		      char *ncopy = alloca (strlen (tmp)+strlen (namestart)+3);
+		      char *tmp1;
+
+		      tmp1 = ncopy;
+		      memcpy (tmp1, tmp, strlen (tmp));
+		      tmp1 += strlen (tmp);
+		      memcpy (tmp1, "::", 2);
+		      tmp1 += 2;
+		      memcpy (tmp1, namestart, p - namestart);
+		      tmp1[p - namestart] = '\0';
+		      cur_sym = lookup_symbol (ncopy, expression_context_block,
+					       VAR_NAMESPACE, (int *) NULL,
+					       (struct symtab **) NULL);
+		      if (cur_sym)
+			{
+			  if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)
+			    {
+			      best_sym = cur_sym;
+			      lexptr = p;
+			    }
+			  else
+			    break;
+			}
+		      else
+			break;
+		    }
+		  else
+		    break;
+		}
+	      else
+		break;
+	    }
+
+	  yylval.tsym.type = SYMBOL_TYPE (best_sym);
+#else /* not 0 */
+	  yylval.tsym.type = SYMBOL_TYPE (sym);
+#endif /* not 0 */
+	  return TYPENAME;
+        }
+    if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
+	return TYPENAME;
+
+    /* Input names that aren't symbols but ARE valid hex numbers,
+       when the input radix permits them, can be names or numbers
+       depending on the parse.  Note we support radixes > 16 here.  */
+    if (!sym &&
+        ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
+         (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
+      {
+ 	YYSTYPE newlval;	/* Its value is ignored.  */
+	hextype = parse_number (tokstart, namelen, 0, &newlval);
+	if (hextype == INT)
+	  {
+	    yylval.ssym.sym = sym;
+	    yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+	    return NAME_OR_INT;
+	  }
+      }
+
+    free(uptokstart);
+    /* Any other kind of symbol */
+    yylval.ssym.sym = sym;
+    yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+    return NAME;
+  }
+}
+
+void
+yyerror (msg)
+     char *msg;
+{
+  error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
+}
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
new file mode 100644
index 0000000..93dd254
--- /dev/null
+++ b/gdb/p-lang.c
@@ -0,0 +1,417 @@
+/* Pascal language support routines for GDB, the GNU debugger.
+   Copyright 2000 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.  */
+
+/* This file is derived from p-lang.c */
+
+#include "defs.h"
+#include "symtab.h"
+#include "gdbtypes.h"
+#include "expression.h"
+#include "parser-defs.h"
+#include "language.h"
+#include "p-lang.h"
+#include "valprint.h"
+
+extern void _initialize_pascal_language (void);
+static void pascal_one_char (int, struct ui_file *, int *);
+
+/* Print the character C on STREAM as part of the contents of a literal
+   string.
+   In_quotes is reset to 0 if a char is written with #4 notation */
+
+static void
+pascal_one_char (register int c, struct ui_file *stream, int *in_quotes)
+{
+
+  c &= 0xFF;			/* Avoid sign bit follies */
+
+  if ((c == '\'') || (PRINT_LITERAL_FORM (c)))
+    {
+      if (!(*in_quotes))
+	fputs_filtered ("'", stream);
+      *in_quotes = 1;
+      if (c == '\'')
+	{
+	  fputs_filtered ("''", stream);
+	}
+      else
+	fprintf_filtered (stream, "%c", c);
+    }
+  else
+    {
+      if (*in_quotes)
+	fputs_filtered ("'", stream);
+      *in_quotes = 0;
+      fprintf_filtered (stream, "#%d", (unsigned int) c);
+    }
+}
+
+static void pascal_emit_char (int c, struct ui_file *stream, int quoter);
+
+/* Print the character C on STREAM as part of the contents of a literal
+   string whose delimiter is QUOTER.  Note that that format for printing
+   characters and strings is language specific. */
+
+static void
+pascal_emit_char (register int c, struct ui_file *stream, int quoter)
+{
+  int in_quotes = 0;
+  pascal_one_char (c, stream, &in_quotes);
+  if (in_quotes)
+    fputs_filtered ("'", stream);
+}
+
+void
+pascal_printchar (int c, struct ui_file *stream)
+{
+  int in_quotes = 0;
+  pascal_one_char (c, stream, &in_quotes);
+  if (in_quotes)
+    fputs_filtered ("'", stream);
+}
+
+/* Print the character string STRING, printing at most LENGTH characters.
+   Printing stops early if the number hits print_max; repeat counts
+   are printed as appropriate.  Print ellipses at the end if we
+   had to stop before printing LENGTH characters, or if FORCE_ELLIPSES.  */
+
+void
+pascal_printstr (struct ui_file *stream, char *string, unsigned int length,
+		 int width, int force_ellipses)
+{
+  register unsigned int i;
+  unsigned int things_printed = 0;
+  int in_quotes = 0;
+  int need_comma = 0;
+  extern int inspect_it;
+
+  /* If the string was not truncated due to `set print elements', and
+     the last byte of it is a null, we don't print that, in traditional C
+     style.  */
+  if ((!force_ellipses) && length > 0 && string[length - 1] == '\0')
+    length--;
+
+  if (length == 0)
+    {
+      fputs_filtered ("''", stream);
+      return;
+    }
+
+  for (i = 0; i < length && things_printed < print_max; ++i)
+    {
+      /* Position of the character we are examining
+         to see whether it is repeated.  */
+      unsigned int rep1;
+      /* Number of repetitions we have detected so far.  */
+      unsigned int reps;
+
+      QUIT;
+
+      if (need_comma)
+	{
+	  fputs_filtered (", ", stream);
+	  need_comma = 0;
+	}
+
+      rep1 = i + 1;
+      reps = 1;
+      while (rep1 < length && string[rep1] == string[i])
+	{
+	  ++rep1;
+	  ++reps;
+	}
+
+      if (reps > repeat_count_threshold)
+	{
+	  if (in_quotes)
+	    {
+	      if (inspect_it)
+		fputs_filtered ("\\', ", stream);
+	      else
+		fputs_filtered ("', ", stream);
+	      in_quotes = 0;
+	    }
+	  pascal_printchar (string[i], stream);
+	  fprintf_filtered (stream, " <repeats %u times>", reps);
+	  i = rep1 - 1;
+	  things_printed += repeat_count_threshold;
+	  need_comma = 1;
+	}
+      else
+	{
+	  int c = string[i];
+	  if ((!in_quotes) && (PRINT_LITERAL_FORM (c)))
+	    {
+	      if (inspect_it)
+		fputs_filtered ("\\'", stream);
+	      else
+		fputs_filtered ("'", stream);
+	      in_quotes = 1;
+	    }
+	  pascal_one_char (c, stream, &in_quotes);
+	  ++things_printed;
+	}
+    }
+
+  /* Terminate the quotes if necessary.  */
+  if (in_quotes)
+    {
+      if (inspect_it)
+	fputs_filtered ("\\'", stream);
+      else
+	fputs_filtered ("'", stream);
+    }
+
+  if (force_ellipses || i < length)
+    fputs_filtered ("...", stream);
+}
+
+/* Create a fundamental Pascal type using default reasonable for the current
+   target machine.
+
+   Some object/debugging file formats (DWARF version 1, COFF, etc) do not
+   define fundamental types such as "int" or "double".  Others (stabs or
+   DWARF version 2, etc) do define fundamental types.  For the formats which
+   don't provide fundamental types, gdb can create such types using this
+   function.
+
+   FIXME:  Some compilers distinguish explicitly signed integral types
+   (signed short, signed int, signed long) from "regular" integral types
+   (short, int, long) in the debugging information.  There is some dis-
+   agreement as to how useful this feature is.  In particular, gcc does
+   not support this.  Also, only some debugging formats allow the
+   distinction to be passed on to a debugger.  For now, we always just
+   use "short", "int", or "long" as the type name, for both the implicit
+   and explicitly signed types.  This also makes life easier for the
+   gdb test suite since we don't have to account for the differences
+   in output depending upon what the compiler and debugging format
+   support.  We will probably have to re-examine the issue when gdb
+   starts taking it's fundamental type information directly from the
+   debugging information supplied by the compiler.  fnf@cygnus.com */
+
+/* Note there might be some discussion about the choosen correspondance
+   because it mainly reflects Free Pascal Compiler setup for now PM */
+
+
+struct type *
+pascal_create_fundamental_type (struct objfile *objfile, int typeid)
+{
+  register struct type *type = NULL;
+
+  switch (typeid)
+    {
+    default:
+      /* FIXME:  For now, if we are asked to produce a type not in this
+         language, create the equivalent of a C integer type with the
+         name "<?type?>".  When all the dust settles from the type
+         reconstruction work, this should probably become an error. */
+      type = init_type (TYPE_CODE_INT,
+			TARGET_INT_BIT / TARGET_CHAR_BIT,
+			0, "<?type?>", objfile);
+      warning ("internal error: no Pascal fundamental type %d", typeid);
+      break;
+    case FT_VOID:
+      type = init_type (TYPE_CODE_VOID,
+			TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+			0, "void", objfile);
+      break;
+    case FT_CHAR:
+      type = init_type (TYPE_CODE_INT,
+			TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+			0, "char", objfile);
+      break;
+    case FT_SIGNED_CHAR:
+      type = init_type (TYPE_CODE_INT,
+			TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+			0, "shortint", objfile);
+      break;
+    case FT_UNSIGNED_CHAR:
+      type = init_type (TYPE_CODE_INT,
+			TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+			TYPE_FLAG_UNSIGNED, "byte", objfile);
+      break;
+    case FT_SHORT:
+      type = init_type (TYPE_CODE_INT,
+			TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+			0, "integer", objfile);
+      break;
+    case FT_SIGNED_SHORT:
+      type = init_type (TYPE_CODE_INT,
+			TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+			0, "integer", objfile);		/* FIXME-fnf */
+      break;
+    case FT_UNSIGNED_SHORT:
+      type = init_type (TYPE_CODE_INT,
+			TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+			TYPE_FLAG_UNSIGNED, "word", objfile);
+      break;
+    case FT_INTEGER:
+      type = init_type (TYPE_CODE_INT,
+			TARGET_INT_BIT / TARGET_CHAR_BIT,
+			0, "longint", objfile);
+      break;
+    case FT_SIGNED_INTEGER:
+      type = init_type (TYPE_CODE_INT,
+			TARGET_INT_BIT / TARGET_CHAR_BIT,
+			0, "longint", objfile);		/* FIXME -fnf */
+      break;
+    case FT_UNSIGNED_INTEGER:
+      type = init_type (TYPE_CODE_INT,
+			TARGET_INT_BIT / TARGET_CHAR_BIT,
+			TYPE_FLAG_UNSIGNED, "cardinal", objfile);
+      break;
+    case FT_LONG:
+      type = init_type (TYPE_CODE_INT,
+			TARGET_LONG_BIT / TARGET_CHAR_BIT,
+			0, "long", objfile);
+      break;
+    case FT_SIGNED_LONG:
+      type = init_type (TYPE_CODE_INT,
+			TARGET_LONG_BIT / TARGET_CHAR_BIT,
+			0, "long", objfile);	/* FIXME -fnf */
+      break;
+    case FT_UNSIGNED_LONG:
+      type = init_type (TYPE_CODE_INT,
+			TARGET_LONG_BIT / TARGET_CHAR_BIT,
+			TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
+      break;
+    case FT_LONG_LONG:
+      type = init_type (TYPE_CODE_INT,
+			TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+			0, "long long", objfile);
+      break;
+    case FT_SIGNED_LONG_LONG:
+      type = init_type (TYPE_CODE_INT,
+			TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+			0, "signed long long", objfile);
+      break;
+    case FT_UNSIGNED_LONG_LONG:
+      type = init_type (TYPE_CODE_INT,
+			TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+			TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
+      break;
+    case FT_FLOAT:
+      type = init_type (TYPE_CODE_FLT,
+			TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+			0, "float", objfile);
+      break;
+    case FT_DBL_PREC_FLOAT:
+      type = init_type (TYPE_CODE_FLT,
+			TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+			0, "double", objfile);
+      break;
+    case FT_EXT_PREC_FLOAT:
+      type = init_type (TYPE_CODE_FLT,
+			TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+			0, "extended", objfile);
+      break;
+    }
+  return (type);
+}
+
+
+/* Table mapping opcodes into strings for printing operators
+   and precedences of the operators.  */
+
+const struct op_print pascal_op_print_tab[] =
+{
+  {",", BINOP_COMMA, PREC_COMMA, 0},
+  {":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
+  {"or", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
+  {"xor", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
+  {"and", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
+  {"=", BINOP_EQUAL, PREC_EQUAL, 0},
+  {"<>", BINOP_NOTEQUAL, PREC_EQUAL, 0},
+  {"<=", BINOP_LEQ, PREC_ORDER, 0},
+  {">=", BINOP_GEQ, PREC_ORDER, 0},
+  {">", BINOP_GTR, PREC_ORDER, 0},
+  {"<", BINOP_LESS, PREC_ORDER, 0},
+  {"shr", BINOP_RSH, PREC_SHIFT, 0},
+  {"shl", BINOP_LSH, PREC_SHIFT, 0},
+  {"+", BINOP_ADD, PREC_ADD, 0},
+  {"-", BINOP_SUB, PREC_ADD, 0},
+  {"*", BINOP_MUL, PREC_MUL, 0},
+  {"/", BINOP_DIV, PREC_MUL, 0},
+  {"div", BINOP_INTDIV, PREC_MUL, 0},
+  {"mod", BINOP_REM, PREC_MUL, 0},
+  {"@", BINOP_REPEAT, PREC_REPEAT, 0},
+  {"-", UNOP_NEG, PREC_PREFIX, 0},
+  {"not", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
+  {"^", UNOP_IND, PREC_SUFFIX, 1},
+  {"@", UNOP_ADDR, PREC_PREFIX, 0},
+  {"sizeof", UNOP_SIZEOF, PREC_PREFIX, 0},
+  {NULL, 0, 0, 0}
+};
+
+struct type **const /* CONST_PTR v 4.17 */ (pascal_builtin_types[]) =
+{
+  &builtin_type_int,
+    &builtin_type_long,
+    &builtin_type_short,
+    &builtin_type_char,
+    &builtin_type_float,
+    &builtin_type_double,
+    &builtin_type_void,
+    &builtin_type_long_long,
+    &builtin_type_signed_char,
+    &builtin_type_unsigned_char,
+    &builtin_type_unsigned_short,
+    &builtin_type_unsigned_int,
+    &builtin_type_unsigned_long,
+    &builtin_type_unsigned_long_long,
+    &builtin_type_long_double,
+    &builtin_type_complex,
+    &builtin_type_double_complex,
+    0
+};
+
+const struct language_defn pascal_language_defn =
+{
+  "pascal",			/* Language name */
+  language_pascal,
+  pascal_builtin_types,
+  range_check_on,
+  type_check_on,
+  case_sensitive_on,
+  pascal_parse,
+  pascal_error,
+  evaluate_subexp_standard,
+  pascal_printchar,		/* Print a character constant */
+  pascal_printstr,		/* Function to print string constant */
+  pascal_emit_char,		/* Print a single char */
+  pascal_create_fundamental_type,	/* Create fundamental type in this language */
+  pascal_print_type,		/* Print a type using appropriate syntax */
+  pascal_val_print,		/* Print a value using appropriate syntax */
+  pascal_value_print,		/* Print a top-level value */
+  {"", "%", "b", ""},		/* Binary format info */
+  {"0%lo", "0", "o", ""},	/* Octal format info */
+  {"%ld", "", "d", ""},		/* Decimal format info */
+  {"$%lx", "$", "x", ""},	/* Hex format info */
+  pascal_op_print_tab,		/* expression operators for printing */
+  1,				/* c-style arrays */
+  0,				/* String lower bound */
+  &builtin_type_char,		/* Type of string elements */
+  LANG_MAGIC
+};
+
+void
+_initialize_pascal_language (void)
+{
+  add_language (&pascal_language_defn);
+}
diff --git a/gdb/p-lang.h b/gdb/p-lang.h
new file mode 100644
index 0000000..c03e632
--- /dev/null
+++ b/gdb/p-lang.h
@@ -0,0 +1,75 @@
+/* Pascal language support definitions for GDB, the GNU debugger.
+   Copyright 2000 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.  */
+
+/* This file is derived from c-lang.h */
+
+#ifdef __STDC__			/* Forward decls for prototypes */
+struct value;
+#endif
+
+extern int pascal_parse (void);	/* Defined in p-exp.y */
+
+extern void pascal_error (char *);	/* Defined in p-exp.y */
+
+/* Defined in p-typeprint.c */
+extern void pascal_print_type (struct type *, char *, struct ui_file *, int, int);
+
+extern int pascal_val_print (struct type *, char *, int, CORE_ADDR, struct ui_file *, int, int,
+			     int, enum val_prettyprint);
+
+extern int pascal_value_print (struct value *, struct ui_file *, int, enum val_prettyprint);
+
+extern void pascal_type_print_method_args (char *, char *,
+					   struct ui_file *);
+
+/* These are in p-lang.c: */
+
+extern void pascal_printchar (int, struct ui_file *);
+
+extern void pascal_printstr (struct ui_file *, char *, unsigned int, int, int);
+
+extern struct type *pascal_create_fundamental_type (struct objfile *, int);
+
+extern struct type **const (pascal_builtin_types[]);
+
+/* These are in p-typeprint.c: */
+
+extern void
+  pascal_type_print_base (struct type *, struct ui_file *, int, int);
+
+extern void
+  pascal_type_print_varspec_prefix (struct type *, struct ui_file *, int, int);
+
+/* These are in cp-valprint.c */
+
+extern int vtblprint;		/* Controls printing of vtbl's */
+
+extern int static_field_print;
+
+extern void pascal_object_print_class_member (char *, struct type *, struct ui_file *, char *);
+
+extern void pascal_object_print_class_method (char *, struct type *, struct ui_file *);
+
+extern void pascal_object_print_value_fields (struct type *, char *, CORE_ADDR,
+			   struct ui_file *, int, int, enum val_prettyprint,
+					      struct type **, int);
+
+extern int pascal_object_is_vtbl_ptr_type (struct type *);
+
+extern int pascal_object_is_vtbl_member (struct type *);
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
new file mode 100644
index 0000000..df35531
--- /dev/null
+++ b/gdb/p-typeprint.c
@@ -0,0 +1,861 @@
+/* Support for printing Pascal types for GDB, the GNU debugger.
+   Copyright 2000
+   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.  */
+
+/* This file is derived from p-typeprint.c */
+
+#include "defs.h"
+#include "obstack.h"
+#include "bfd.h"		/* Binary File Description */
+#include "symtab.h"
+#include "gdbtypes.h"
+#include "expression.h"
+#include "value.h"
+#include "gdbcore.h"
+#include "target.h"
+#include "command.h"
+#include "gdbcmd.h"
+#include "language.h"
+#include "demangle.h"
+#include "p-lang.h"
+#include "typeprint.h"
+
+#include "gdb_string.h"
+#include <errno.h>
+#include <ctype.h>
+
+static void pascal_type_print_args (struct type *, struct ui_file *);
+
+static void pascal_type_print_varspec_suffix (struct type *, struct ui_file *, int, int, int);
+
+static void pascal_type_print_derivation_info (struct ui_file *, struct type *);
+
+void pascal_type_print_varspec_prefix (struct type *, struct ui_file *, int, int);
+
+
+/* LEVEL is the depth to indent lines by.  */
+
+void
+pascal_print_type (struct type *type, char *varstring, struct ui_file *stream,
+		   int show, int level)
+{
+  register enum type_code code;
+  int demangled_args;
+
+  code = TYPE_CODE (type);
+
+  if (show > 0)
+    CHECK_TYPEDEF (type);
+
+  if ((code == TYPE_CODE_FUNC ||
+       code == TYPE_CODE_METHOD))
+    {
+      pascal_type_print_varspec_prefix (type, stream, show, 0);
+    }
+  /* first the name */
+  fputs_filtered (varstring, stream);
+
+  if ((varstring != NULL && *varstring != '\0') &&
+      !(code == TYPE_CODE_FUNC ||
+	code == TYPE_CODE_METHOD))
+    {
+      fputs_filtered (" : ", stream);
+    }
+
+  if (!(code == TYPE_CODE_FUNC ||
+	code == TYPE_CODE_METHOD))
+    {
+      pascal_type_print_varspec_prefix (type, stream, show, 0);
+    }
+
+  pascal_type_print_base (type, stream, show, level);
+  /* For demangled function names, we have the arglist as part of the name,
+     so don't print an additional pair of ()'s */
+
+  demangled_args = varstring ? strchr (varstring, '(') != NULL : 0;
+  pascal_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
+
+}
+
+/* If TYPE is a derived type, then print out derivation information.
+   Print only the actual base classes of this type, not the base classes
+   of the base classes.  I.E.  for the derivation hierarchy:
+
+   class A { int a; };
+   class B : public A {int b; };
+   class C : public B {int c; };
+
+   Print the type of class C as:
+
+   class C : public B {
+   int c;
+   }
+
+   Not as the following (like gdb used to), which is not legal C++ syntax for
+   derived types and may be confused with the multiple inheritance form:
+
+   class C : public B : public A {
+   int c;
+   }
+
+   In general, gdb should try to print the types as closely as possible to
+   the form that they appear in the source code. */
+
+static void
+pascal_type_print_derivation_info (struct ui_file *stream, struct type *type)
+{
+  char *name;
+  int i;
+
+  for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
+    {
+      fputs_filtered (i == 0 ? ": " : ", ", stream);
+      fprintf_filtered (stream, "%s%s ",
+			BASETYPE_VIA_PUBLIC (type, i) ? "public" : "private",
+			BASETYPE_VIA_VIRTUAL (type, i) ? " virtual" : "");
+      name = type_name_no_tag (TYPE_BASECLASS (type, i));
+      fprintf_filtered (stream, "%s", name ? name : "(null)");
+    }
+  if (i > 0)
+    {
+      fputs_filtered (" ", stream);
+    }
+}
+
+/* Print the Pascal method arguments ARGS to the file STREAM.  */
+
+void
+pascal_type_print_method_args (char *physname, char *methodname,
+			       struct ui_file *stream)
+{
+  int is_constructor = STREQN (physname, "__ct__", 6);
+  int is_destructor = STREQN (physname, "__dt__", 6);
+
+  if (is_constructor || is_destructor)
+    {
+      physname += 6;
+    }
+
+  fputs_filtered (methodname, stream);
+
+  if (physname && (*physname != 0))
+    {
+      int i = 0;
+      int len = 0;
+      char storec;
+      char *argname;
+      fputs_filtered (" (", stream);
+      /* we must demangle this */
+      while (isdigit (physname[0]))
+	{
+	  while (isdigit (physname[len]))
+	    {
+	      len++;
+	    }
+	  i = strtol (physname, &argname, 0);
+	  physname += len;
+	  storec = physname[i];
+	  physname[i] = 0;
+	  fputs_filtered (physname, stream);
+	  physname[i] = storec;
+	  physname += i;
+	  if (physname[0] != 0)
+	    {
+	      fputs_filtered (", ", stream);
+	    }
+	}
+      fputs_filtered (")", stream);
+    }
+}
+
+/* Print any asterisks or open-parentheses needed before the
+   variable name (to describe its type).
+
+   On outermost call, pass 0 for PASSED_A_PTR.
+   On outermost call, SHOW > 0 means should ignore
+   any typename for TYPE and show its details.
+   SHOW is always zero on recursive calls.  */
+
+void
+pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
+				  int show, int passed_a_ptr)
+{
+  char *name;
+  if (type == 0)
+    return;
+
+  if (TYPE_NAME (type) && show <= 0)
+    return;
+
+  QUIT;
+
+  switch (TYPE_CODE (type))
+    {
+    case TYPE_CODE_PTR:
+      fprintf_filtered (stream, "^");
+      pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
+      break;			/* pointer should be handled normally in pascal */
+
+    case TYPE_CODE_MEMBER:
+      if (passed_a_ptr)
+	fprintf_filtered (stream, "(");
+      pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
+      fprintf_filtered (stream, " ");
+      name = type_name_no_tag (TYPE_DOMAIN_TYPE (type));
+      if (name)
+	fputs_filtered (name, stream);
+      else
+	pascal_type_print_base (TYPE_DOMAIN_TYPE (type), stream, 0, passed_a_ptr);
+      fprintf_filtered (stream, "::");
+      break;
+
+    case TYPE_CODE_METHOD:
+      if (passed_a_ptr)
+	fprintf_filtered (stream, "(");
+      if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
+	{
+	  fprintf_filtered (stream, "function  ");
+	}
+      else
+	{
+	  fprintf_filtered (stream, "procedure ");
+	}
+
+      if (passed_a_ptr)
+	{
+	  fprintf_filtered (stream, " ");
+	  pascal_type_print_base (TYPE_DOMAIN_TYPE (type), stream, 0, passed_a_ptr);
+	  fprintf_filtered (stream, "::");
+	}
+      break;
+
+    case TYPE_CODE_REF:
+      pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
+      fprintf_filtered (stream, "&");
+      break;
+
+    case TYPE_CODE_FUNC:
+      if (passed_a_ptr)
+	fprintf_filtered (stream, "(");
+
+      if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
+	{
+	  fprintf_filtered (stream, "function  ");
+	}
+      else
+	{
+	  fprintf_filtered (stream, "procedure ");
+	}
+
+      break;
+
+    case TYPE_CODE_ARRAY:
+      if (passed_a_ptr)
+	fprintf_filtered (stream, "(");
+      fprintf_filtered (stream, "array ");
+      if (TYPE_LENGTH (type) >= 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
+	&& TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
+	fprintf_filtered (stream, "[%d..%d] ",
+			  TYPE_ARRAY_LOWER_BOUND_VALUE (type),
+			  TYPE_ARRAY_UPPER_BOUND_VALUE (type)
+	  );
+      fprintf_filtered (stream, "of ");
+      break;
+
+    case TYPE_CODE_UNDEF:
+    case TYPE_CODE_STRUCT:
+    case TYPE_CODE_UNION:
+    case TYPE_CODE_ENUM:
+    case TYPE_CODE_INT:
+    case TYPE_CODE_FLT:
+    case TYPE_CODE_VOID:
+    case TYPE_CODE_ERROR:
+    case TYPE_CODE_CHAR:
+    case TYPE_CODE_BOOL:
+    case TYPE_CODE_SET:
+    case TYPE_CODE_RANGE:
+    case TYPE_CODE_STRING:
+    case TYPE_CODE_BITSTRING:
+    case TYPE_CODE_COMPLEX:
+    case TYPE_CODE_TYPEDEF:
+    case TYPE_CODE_TEMPLATE:
+      /* These types need no prefix.  They are listed here so that
+         gcc -Wall will reveal any types that haven't been handled.  */
+      break;
+    default:
+      error ("type not handled in pascal_type_print_varspec_prefix()");
+      break;
+    }
+}
+
+static void
+pascal_type_print_args (struct type *type, struct ui_file *stream)
+{
+  int i;
+  struct type **args;
+
+  /*  fprintf_filtered (stream, "(");
+     no () for procedures !! */
+  args = TYPE_ARG_TYPES (type);
+  if (args != NULL)
+    {
+      if ((args[1] != NULL && args[1]->code != TYPE_CODE_VOID) ||
+	  (args[2] != NULL))
+	{
+	  fprintf_filtered (stream, "(");
+	}
+      if (args[1] == NULL)
+	{
+	  fprintf_filtered (stream, "...");
+	}
+      else
+	{
+	  for (i = 1;
+	       args[i] != NULL && args[i]->code != TYPE_CODE_VOID;
+	       i++)
+	    {
+	      pascal_print_type (args[i], "", stream, -1, 0);
+	      if (args[i + 1] == NULL)
+		{
+		  fprintf_filtered (stream, "...");
+		}
+	      else if (args[i + 1]->code != TYPE_CODE_VOID)
+		{
+		  fprintf_filtered (stream, ",");
+		  wrap_here ("    ");
+		}
+	    }
+	}
+      if ((args[1] != NULL && args[1]->code != TYPE_CODE_VOID) ||
+	  (args[2] != NULL))
+	{
+	  fprintf_filtered (stream, ")");
+	}
+    }
+}
+
+static void
+pascal_print_func_args (struct type *type, struct ui_file *stream)
+{
+  int i, len = TYPE_NFIELDS (type);
+  if (len)
+    {
+      fprintf_filtered (stream, "(");
+    }
+  for (i = 0; i < len; i++)
+    {
+      if (i > 0)
+	{
+	  fputs_filtered (", ", stream);
+	  wrap_here ("    ");
+	}
+      /*  can we find if it is a var parameter ??
+         if ( TYPE_FIELD(type, i) == )
+         {
+         fprintf_filtered (stream, "var ");
+         } */
+      pascal_print_type (TYPE_FIELD_TYPE (type, i), ""	/* TYPE_FIELD_NAME seems invalid ! */
+			 ,stream, -1, 0);
+    }
+  if (len)
+    {
+      fprintf_filtered (stream, ")");
+    }
+}
+
+/* Print any array sizes, function arguments or close parentheses
+   needed after the variable name (to describe its type).
+   Args work like pascal_type_print_varspec_prefix.  */
+
+static void
+pascal_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
+				  int show, int passed_a_ptr,
+				  int demangled_args)
+{
+  if (type == 0)
+    return;
+
+  if (TYPE_NAME (type) && show <= 0)
+    return;
+
+  QUIT;
+
+  switch (TYPE_CODE (type))
+    {
+    case TYPE_CODE_ARRAY:
+      if (passed_a_ptr)
+	fprintf_filtered (stream, ")");
+      break;
+
+    case TYPE_CODE_MEMBER:
+      if (passed_a_ptr)
+	fprintf_filtered (stream, ")");
+      pascal_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
+      break;
+
+    case TYPE_CODE_METHOD:
+      if (passed_a_ptr)
+	fprintf_filtered (stream, ")");
+      pascal_type_print_method_args ("",
+				     "",
+				     stream);
+      /* pascal_type_print_args (type, stream); */
+      if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
+	{
+	  fprintf_filtered (stream, " : ");
+	  pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
+	  pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0);
+	  pascal_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
+					    passed_a_ptr, 0);
+	}
+      break;
+
+    case TYPE_CODE_PTR:
+    case TYPE_CODE_REF:
+      pascal_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0);
+      break;
+
+    case TYPE_CODE_FUNC:
+      if (passed_a_ptr)
+	fprintf_filtered (stream, ")");
+      if (!demangled_args)
+	pascal_print_func_args (type, stream);
+      if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
+	{
+	  fprintf_filtered (stream, " : ");
+	  pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
+	  pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0);
+	  pascal_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
+					    passed_a_ptr, 0);
+	}
+      break;
+
+    case TYPE_CODE_UNDEF:
+    case TYPE_CODE_STRUCT:
+    case TYPE_CODE_UNION:
+    case TYPE_CODE_ENUM:
+    case TYPE_CODE_INT:
+    case TYPE_CODE_FLT:
+    case TYPE_CODE_VOID:
+    case TYPE_CODE_ERROR:
+    case TYPE_CODE_CHAR:
+    case TYPE_CODE_BOOL:
+    case TYPE_CODE_SET:
+    case TYPE_CODE_RANGE:
+    case TYPE_CODE_STRING:
+    case TYPE_CODE_BITSTRING:
+    case TYPE_CODE_COMPLEX:
+    case TYPE_CODE_TYPEDEF:
+    case TYPE_CODE_TEMPLATE:
+      /* These types do not need a suffix.  They are listed so that
+         gcc -Wall will report types that may not have been considered.  */
+      break;
+    default:
+      error ("type not handled in pascal_type_print_varspec_suffix()");
+      break;
+    }
+}
+
+/* Print the name of the type (or the ultimate pointer target,
+   function value or array element), or the description of a
+   structure or union.
+
+   SHOW positive means print details about the type (e.g. enum values),
+   and print structure elements passing SHOW - 1 for show.
+   SHOW negative means just print the type name or struct tag if there is one.
+   If there is no name, print something sensible but concise like
+   "struct {...}".
+   SHOW zero means just print the type name or struct tag if there is one.
+   If there is no name, print something sensible but not as concise like
+   "struct {int x; int y;}".
+
+   LEVEL is the number of spaces to indent by.
+   We increase it for some recursive calls.  */
+
+void
+pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
+			int level)
+{
+  register int i;
+  register int len;
+  register int lastval;
+  enum
+    {
+      s_none, s_public, s_private, s_protected
+    }
+  section_type;
+  QUIT;
+
+  wrap_here ("    ");
+  if (type == NULL)
+    {
+      fputs_filtered ("<type unknown>", stream);
+      return;
+    }
+
+  /* void pointer */
+  if ((TYPE_CODE (type) == TYPE_CODE_PTR) && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID))
+    {
+      fprintf_filtered (stream,
+			TYPE_NAME (type) ? TYPE_NAME (type) : "pointer");
+      return;
+    }
+  /* When SHOW is zero or less, and there is a valid type name, then always
+     just print the type name directly from the type.  */
+
+  if (show <= 0
+      && TYPE_NAME (type) != NULL)
+    {
+      fputs_filtered (TYPE_NAME (type), stream);
+      return;
+    }
+
+  CHECK_TYPEDEF (type);
+
+  switch (TYPE_CODE (type))
+    {
+    case TYPE_CODE_TYPEDEF:
+    case TYPE_CODE_PTR:
+    case TYPE_CODE_MEMBER:
+    case TYPE_CODE_REF:
+      /* case TYPE_CODE_FUNC:
+         case TYPE_CODE_METHOD: */
+      pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+      break;
+
+    case TYPE_CODE_ARRAY:
+      /* pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
+         pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+         pascal_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0); */
+      pascal_print_type (TYPE_TARGET_TYPE (type), NULL, stream, 0, 0);
+      break;
+
+    case TYPE_CODE_FUNC:
+    case TYPE_CODE_METHOD:
+      /*
+         pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+         only after args !! */
+      break;
+    case TYPE_CODE_STRUCT:
+      if (TYPE_TAG_NAME (type) != NULL)
+	{
+	  fputs_filtered (TYPE_TAG_NAME (type), stream);
+	  fputs_filtered (" = ", stream);
+	}
+      if (HAVE_CPLUS_STRUCT (type))
+	{
+	  fprintf_filtered (stream, "class ");
+	}
+      else
+	{
+	  fprintf_filtered (stream, "record ");
+	}
+      goto struct_union;
+
+    case TYPE_CODE_UNION:
+      if (TYPE_TAG_NAME (type) != NULL)
+	{
+	  fputs_filtered (TYPE_TAG_NAME (type), stream);
+	  fputs_filtered (" = ", stream);
+	}
+      fprintf_filtered (stream, "case <?> of ");
+
+    struct_union:
+      wrap_here ("    ");
+      if (show < 0)
+	{
+	  /* If we just printed a tag name, no need to print anything else.  */
+	  if (TYPE_TAG_NAME (type) == NULL)
+	    fprintf_filtered (stream, "{...}");
+	}
+      else if (show > 0 || TYPE_TAG_NAME (type) == NULL)
+	{
+	  pascal_type_print_derivation_info (stream, type);
+
+	  fprintf_filtered (stream, "\n");
+	  if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
+	    {
+	      if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
+		fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
+	      else
+		fprintfi_filtered (level + 4, stream, "<no data fields>\n");
+	    }
+
+	  /* Start off with no specific section type, so we can print
+	     one for the first field we find, and use that section type
+	     thereafter until we find another type. */
+
+	  section_type = s_none;
+
+	  /* If there is a base class for this type,
+	     do not print the field that it occupies.  */
+
+	  len = TYPE_NFIELDS (type);
+	  for (i = TYPE_N_BASECLASSES (type); i < len; i++)
+	    {
+	      QUIT;
+	      /* Don't print out virtual function table.  */
+	      if (STREQN (TYPE_FIELD_NAME (type, i), "_vptr", 5)
+		  && is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5]))
+		continue;
+
+	      /* If this is a pascal object or class we can print the
+	         various section labels. */
+
+	      if (HAVE_CPLUS_STRUCT (type))
+		{
+		  if (TYPE_FIELD_PROTECTED (type, i))
+		    {
+		      if (section_type != s_protected)
+			{
+			  section_type = s_protected;
+			  fprintfi_filtered (level + 2, stream,
+					     "protected\n");
+			}
+		    }
+		  else if (TYPE_FIELD_PRIVATE (type, i))
+		    {
+		      if (section_type != s_private)
+			{
+			  section_type = s_private;
+			  fprintfi_filtered (level + 2, stream, "private\n");
+			}
+		    }
+		  else
+		    {
+		      if (section_type != s_public)
+			{
+			  section_type = s_public;
+			  fprintfi_filtered (level + 2, stream, "public\n");
+			}
+		    }
+		}
+
+	      print_spaces_filtered (level + 4, stream);
+	      if (TYPE_FIELD_STATIC (type, i))
+		{
+		  fprintf_filtered (stream, "static ");
+		}
+	      pascal_print_type (TYPE_FIELD_TYPE (type, i),
+				 TYPE_FIELD_NAME (type, i),
+				 stream, show - 1, level + 4);
+	      if (!TYPE_FIELD_STATIC (type, i)
+		  && TYPE_FIELD_PACKED (type, i))
+		{
+		  /* It is a bitfield.  This code does not attempt
+		     to look at the bitpos and reconstruct filler,
+		     unnamed fields.  This would lead to misleading
+		     results if the compiler does not put out fields
+		     for such things (I don't know what it does).  */
+		  fprintf_filtered (stream, " : %d",
+				    TYPE_FIELD_BITSIZE (type, i));
+		}
+	      fprintf_filtered (stream, ";\n");
+	    }
+
+	  /* If there are both fields and methods, put a space between. */
+	  len = TYPE_NFN_FIELDS (type);
+	  if (len && section_type != s_none)
+	    fprintf_filtered (stream, "\n");
+
+	  /* Pbject pascal: print out the methods */
+
+	  for (i = 0; i < len; i++)
+	    {
+	      struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
+	      int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
+	      char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
+	      char *name = type_name_no_tag (type);
+	      /* this is GNU C++ specific
+	         how can we know constructor/destructor?
+	         It might work for GNU pascal */
+	      for (j = 0; j < len2; j++)
+		{
+		  char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
+
+		  int is_constructor = STREQN (physname, "__ct__", 6);
+		  int is_destructor = STREQN (physname, "__dt__", 6);
+
+		  QUIT;
+		  if (TYPE_FN_FIELD_PROTECTED (f, j))
+		    {
+		      if (section_type != s_protected)
+			{
+			  section_type = s_protected;
+			  fprintfi_filtered (level + 2, stream,
+					     "protected\n");
+			}
+		    }
+		  else if (TYPE_FN_FIELD_PRIVATE (f, j))
+		    {
+		      if (section_type != s_private)
+			{
+			  section_type = s_private;
+			  fprintfi_filtered (level + 2, stream, "private\n");
+			}
+		    }
+		  else
+		    {
+		      if (section_type != s_public)
+			{
+			  section_type = s_public;
+			  fprintfi_filtered (level + 2, stream, "public\n");
+			}
+		    }
+
+		  print_spaces_filtered (level + 4, stream);
+		  if (TYPE_FN_FIELD_STATIC_P (f, j))
+		    fprintf_filtered (stream, "static ");
+		  if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0)
+		    {
+		      /* Keep GDB from crashing here.  */
+		      fprintf_filtered (stream, "<undefined type> %s;\n",
+					TYPE_FN_FIELD_PHYSNAME (f, j));
+		      break;
+		    }
+
+		  if (is_constructor)
+		    {
+		      fprintf_filtered (stream, "constructor ");
+		    }
+		  else if (is_destructor)
+		    {
+		      fprintf_filtered (stream, "destructor  ");
+		    }
+		  else if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) != 0 &&
+			   TYPE_CODE (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j))) != TYPE_CODE_VOID)
+		    {
+		      fprintf_filtered (stream, "function  ");
+		    }
+		  else
+		    {
+		      fprintf_filtered (stream, "procedure ");
+		    }
+		  /* this does not work, no idea why !! */
+
+		  pascal_type_print_method_args (physname,
+						 method_name,
+						 stream);
+
+		  if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) != 0 &&
+		      TYPE_CODE (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j))) != TYPE_CODE_VOID)
+		    {
+		      fputs_filtered (" : ", stream);
+		      type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)),
+				  "", stream, -1);
+		    }
+		  if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
+		    fprintf_filtered (stream, "; virtual");
+
+		  fprintf_filtered (stream, ";\n");
+		}
+	    }
+	  fprintfi_filtered (level, stream, "end");
+	}
+      break;
+
+    case TYPE_CODE_ENUM:
+      if (TYPE_TAG_NAME (type) != NULL)
+	{
+	  fputs_filtered (TYPE_TAG_NAME (type), stream);
+	  if (show > 0)
+	    fputs_filtered (" ", stream);
+	}
+      /* enum is just defined by
+         type enume_name = (enum_member1,enum_member2,...) */
+      fprintf_filtered (stream, " = ");
+      wrap_here ("    ");
+      if (show < 0)
+	{
+	  /* If we just printed a tag name, no need to print anything else.  */
+	  if (TYPE_TAG_NAME (type) == NULL)
+	    fprintf_filtered (stream, "(...)");
+	}
+      else if (show > 0 || TYPE_TAG_NAME (type) == NULL)
+	{
+	  fprintf_filtered (stream, "(");
+	  len = TYPE_NFIELDS (type);
+	  lastval = 0;
+	  for (i = 0; i < len; i++)
+	    {
+	      QUIT;
+	      if (i)
+		fprintf_filtered (stream, ", ");
+	      wrap_here ("    ");
+	      fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
+	      if (lastval != TYPE_FIELD_BITPOS (type, i))
+		{
+		  fprintf_filtered (stream, " := %d", TYPE_FIELD_BITPOS (type, i));
+		  lastval = TYPE_FIELD_BITPOS (type, i);
+		}
+	      lastval++;
+	    }
+	  fprintf_filtered (stream, ")");
+	}
+      break;
+
+    case TYPE_CODE_VOID:
+      fprintf_filtered (stream, "void");
+      break;
+
+    case TYPE_CODE_UNDEF:
+      fprintf_filtered (stream, "record <unknown>");
+      break;
+
+    case TYPE_CODE_ERROR:
+      fprintf_filtered (stream, "<unknown type>");
+      break;
+
+      /* this probably does not work for enums */
+    case TYPE_CODE_RANGE:
+      {
+	struct type *target = TYPE_TARGET_TYPE (type);
+	if (target == NULL)
+	  target = builtin_type_long;
+	print_type_scalar (target, TYPE_LOW_BOUND (type), stream);
+	fputs_filtered ("..", stream);
+	print_type_scalar (target, TYPE_HIGH_BOUND (type), stream);
+      }
+      break;
+
+    case TYPE_CODE_SET:
+      fputs_filtered ("set of ", stream);
+      pascal_print_type (TYPE_INDEX_TYPE (type), "", stream,
+			 show - 1, level);
+      break;
+
+    default:
+      /* Handle types not explicitly handled by the other cases,
+         such as fundamental types.  For these, just print whatever
+         the type name is, as recorded in the type itself.  If there
+         is no type name, then complain. */
+      if (TYPE_NAME (type) != NULL)
+	{
+	  fputs_filtered (TYPE_NAME (type), stream);
+	}
+      else
+	{
+	  /* At least for dump_symtab, it is important that this not be
+	     an error ().  */
+	  fprintf_filtered (stream, "<invalid unnamed pascal type code %d>",
+			    TYPE_CODE (type));
+	}
+      break;
+    }
+}
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
new file mode 100644
index 0000000..46774c6
--- /dev/null
+++ b/gdb/p-valprint.c
@@ -0,0 +1,1112 @@
+/* Support for printing Pascal values for GDB, the GNU debugger.
+   Copyright 2000
+   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.  */
+
+/* This file is derived from c-valprint.c */
+
+#include "defs.h"
+#include "obstack.h"
+#include "symtab.h"
+#include "gdbtypes.h"
+#include "expression.h"
+#include "value.h"
+#include "command.h"
+#include "gdbcmd.h"
+#include "gdbcore.h"
+#include "demangle.h"
+#include "valprint.h"
+#include "language.h"
+#include "target.h"
+#include "annotate.h"
+#include "p-lang.h"
+
+
+
+
+/* Print data of type TYPE located at VALADDR (within GDB), which came from
+   the inferior at address ADDRESS, onto stdio stream STREAM according to
+   FORMAT (a letter or 0 for natural format).  The data at VALADDR is in
+   target byte order.
+
+   If the data are a string pointer, returns the number of string characters
+   printed.
+
+   If DEREF_REF is nonzero, then dereference references, otherwise just print
+   them like pointers.
+
+   The PRETTY parameter controls prettyprinting.  */
+
+
+int
+pascal_val_print (struct type *type, char *valaddr, int embedded_offset,
+		  CORE_ADDR address, struct ui_file *stream, int format,
+		  int deref_ref, int recurse, enum val_prettyprint pretty)
+{
+  register unsigned int i = 0;	/* Number of characters printed */
+  unsigned len;
+  struct type *elttype;
+  unsigned eltlen;
+  LONGEST val;
+  CORE_ADDR addr;
+
+  CHECK_TYPEDEF (type);
+  switch (TYPE_CODE (type))
+    {
+    case TYPE_CODE_ARRAY:
+      if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
+	{
+	  elttype = check_typedef (TYPE_TARGET_TYPE (type));
+	  eltlen = TYPE_LENGTH (elttype);
+	  len = TYPE_LENGTH (type) / eltlen;
+	  if (prettyprint_arrays)
+	    {
+	      print_spaces_filtered (2 + 2 * recurse, stream);
+	    }
+	  /* For an array of chars, print with string syntax.  */
+	  if (eltlen == 1 &&
+	      ((TYPE_CODE (elttype) == TYPE_CODE_INT)
+	       || ((current_language->la_language == language_m2)
+		   && (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
+	      && (format == 0 || format == 's'))
+	    {
+	      /* If requested, look for the first null char and only print
+	         elements up to it.  */
+	      if (stop_print_at_null)
+		{
+		  unsigned int temp_len;
+
+		  /* Look for a NULL char. */
+		  for (temp_len = 0;
+		       (valaddr + embedded_offset)[temp_len]
+		       && temp_len < len && temp_len < print_max;
+		       temp_len++);
+		  len = temp_len;
+		}
+
+	      LA_PRINT_STRING (stream, valaddr + embedded_offset, len, 1, 0);
+	      i = len;
+	    }
+	  else
+	    {
+	      fprintf_filtered (stream, "{");
+	      /* If this is a virtual function table, print the 0th
+	         entry specially, and the rest of the members normally.  */
+	      if (pascal_object_is_vtbl_ptr_type (elttype))
+		{
+		  i = 1;
+		  fprintf_filtered (stream, "%d vtable entries", len - 1);
+		}
+	      else
+		{
+		  i = 0;
+		}
+	      val_print_array_elements (type, valaddr + embedded_offset, address, stream,
+				     format, deref_ref, recurse, pretty, i);
+	      fprintf_filtered (stream, "}");
+	    }
+	  break;
+	}
+      /* Array of unspecified length: treat like pointer to first elt.  */
+      addr = address;
+      goto print_unpacked_pointer;
+
+    case TYPE_CODE_PTR:
+      if (format && format != 's')
+	{
+	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  break;
+	}
+      if (vtblprint && pascal_object_is_vtbl_ptr_type (type))
+	{
+	  /* Print the unmangled name if desired.  */
+	  /* Print vtable entry - we only get here if we ARE using
+	     -fvtable_thunks.  (Otherwise, look under TYPE_CODE_STRUCT.) */
+	  print_address_demangle (extract_address (valaddr + embedded_offset, TYPE_LENGTH (type)),
+				  stream, demangle);
+	  break;
+	}
+      elttype = check_typedef (TYPE_TARGET_TYPE (type));
+      if (TYPE_CODE (elttype) == TYPE_CODE_METHOD)
+	{
+	  pascal_object_print_class_method (valaddr + embedded_offset, type, stream);
+	}
+      else if (TYPE_CODE (elttype) == TYPE_CODE_MEMBER)
+	{
+	  pascal_object_print_class_member (valaddr + embedded_offset,
+				 TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (type)),
+					    stream, "&");
+	}
+      else
+	{
+	  addr = unpack_pointer (type, valaddr + embedded_offset);
+	print_unpacked_pointer:
+	  elttype = check_typedef (TYPE_TARGET_TYPE (type));
+
+	  if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
+	    {
+	      /* Try to print what function it points to.  */
+	      print_address_demangle (addr, stream, demangle);
+	      /* Return value is irrelevant except for string pointers.  */
+	      return (0);
+	    }
+
+	  if (addressprint && format != 's')
+	    {
+	      print_address_numeric (addr, 1, stream);
+	    }
+
+	  /* For a pointer to char or unsigned char, also print the string
+	     pointed to, unless pointer is null.  */
+	  if (TYPE_LENGTH (elttype) == 1
+	      && TYPE_CODE (elttype) == TYPE_CODE_INT
+	      && (format == 0 || format == 's')
+	      && addr != 0)
+	    {
+	      /* no wide string yet */
+	      i = val_print_string (addr, -1, 1, stream);
+	    }
+	  /* also for pointers to pascal strings */
+	  /* Note: this is Free Pascal specific:
+	     as GDB does not recognize stabs pascal strings
+	     Pascal strings are mapped to records
+	     with lowercase names PM  */
+	  /* I don't know what GPC does :( PM */
+	  if (TYPE_CODE (elttype) == TYPE_CODE_STRUCT &&
+	      TYPE_NFIELDS (elttype) == 2 &&
+	      strcmp (TYPE_FIELDS (elttype)[0].name, "length") == 0 &&
+	      strcmp (TYPE_FIELDS (elttype)[1].name, "st") == 0 &&
+	      addr != 0)
+	    {
+	      char bytelength;
+	      read_memory (addr, &bytelength, 1);
+	      i = val_print_string (addr + 1, bytelength, 1, stream);
+	    }
+	  else if (pascal_object_is_vtbl_member (type))
+	    {
+	      /* print vtbl's nicely */
+	      CORE_ADDR vt_address = unpack_pointer (type, valaddr + embedded_offset);
+
+	      struct minimal_symbol *msymbol =
+	      lookup_minimal_symbol_by_pc (vt_address);
+	      if ((msymbol != NULL) &&
+		  (vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
+		{
+		  fputs_filtered (" <", stream);
+		  fputs_filtered (SYMBOL_SOURCE_NAME (msymbol), stream);
+		  fputs_filtered (">", stream);
+		}
+	      if (vt_address && vtblprint)
+		{
+		  value_ptr vt_val;
+		  struct symbol *wsym = (struct symbol *) NULL;
+		  struct type *wtype;
+		  struct symtab *s;
+		  struct block *block = (struct block *) NULL;
+		  int is_this_fld;
+
+		  if (msymbol != NULL)
+		    wsym = lookup_symbol (SYMBOL_NAME (msymbol), block,
+					  VAR_NAMESPACE, &is_this_fld, &s);
+
+		  if (wsym)
+		    {
+		      wtype = SYMBOL_TYPE (wsym);
+		    }
+		  else
+		    {
+		      wtype = TYPE_TARGET_TYPE (type);
+		    }
+		  vt_val = value_at (wtype, vt_address, NULL);
+		  val_print (VALUE_TYPE (vt_val), VALUE_CONTENTS (vt_val), 0,
+			     VALUE_ADDRESS (vt_val), stream, format,
+			     deref_ref, recurse + 1, pretty);
+		  if (pretty)
+		    {
+		      fprintf_filtered (stream, "\n");
+		      print_spaces_filtered (2 + 2 * recurse, stream);
+		    }
+		}
+	    }
+
+	  /* Return number of characters printed, including the terminating
+	     '\0' if we reached the end.  val_print_string takes care including
+	     the terminating '\0' if necessary.  */
+	  return i;
+	}
+      break;
+
+    case TYPE_CODE_MEMBER:
+      error ("not implemented: member type in pascal_val_print");
+      break;
+
+    case TYPE_CODE_REF:
+      elttype = check_typedef (TYPE_TARGET_TYPE (type));
+      if (TYPE_CODE (elttype) == TYPE_CODE_MEMBER)
+	{
+	  pascal_object_print_class_member (valaddr + embedded_offset,
+					    TYPE_DOMAIN_TYPE (elttype),
+					    stream, "");
+	  break;
+	}
+      if (addressprint)
+	{
+	  fprintf_filtered (stream, "@");
+	  print_address_numeric
+	    (extract_address (valaddr + embedded_offset,
+			      TARGET_PTR_BIT / HOST_CHAR_BIT), 1, stream);
+	  if (deref_ref)
+	    fputs_filtered (": ", stream);
+	}
+      /* De-reference the reference.  */
+      if (deref_ref)
+	{
+	  if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
+	    {
+	      value_ptr deref_val =
+	      value_at
+	      (TYPE_TARGET_TYPE (type),
+	       unpack_pointer (lookup_pointer_type (builtin_type_void),
+			       valaddr + embedded_offset),
+	       NULL);
+	      val_print (VALUE_TYPE (deref_val),
+			 VALUE_CONTENTS (deref_val), 0,
+			 VALUE_ADDRESS (deref_val), stream, format,
+			 deref_ref, recurse + 1, pretty);
+	    }
+	  else
+	    fputs_filtered ("???", stream);
+	}
+      break;
+
+    case TYPE_CODE_UNION:
+      if (recurse && !unionprint)
+	{
+	  fprintf_filtered (stream, "{...}");
+	  break;
+	}
+      /* Fall through.  */
+    case TYPE_CODE_STRUCT:
+      if (vtblprint && pascal_object_is_vtbl_ptr_type (type))
+	{
+	  /* Print the unmangled name if desired.  */
+	  /* Print vtable entry - we only get here if NOT using
+	     -fvtable_thunks.  (Otherwise, look under TYPE_CODE_PTR.) */
+	  print_address_demangle (extract_address (
+						    valaddr + embedded_offset + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
+		  TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET))),
+				  stream, demangle);
+	}
+      else
+	{
+	  if ((TYPE_NFIELDS (type) == 2) &&
+	      (strcmp (TYPE_FIELDS (type)[0].name, "length") == 0) &&
+	      (strcmp (TYPE_FIELDS (type)[1].name, "st") == 0))
+	    {
+	      len = (*(valaddr + embedded_offset)) & 0xff;
+	      LA_PRINT_STRING (stream, valaddr + embedded_offset + 1, len, /* width ?? */ 0, 0);
+	    }
+	  else
+	    pascal_object_print_value_fields (type, valaddr + embedded_offset, address, stream, format,
+					      recurse, pretty, NULL, 0);
+	}
+      break;
+
+    case TYPE_CODE_ENUM:
+      if (format)
+	{
+	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  break;
+	}
+      len = TYPE_NFIELDS (type);
+      val = unpack_long (type, valaddr + embedded_offset);
+      for (i = 0; i < len; i++)
+	{
+	  QUIT;
+	  if (val == TYPE_FIELD_BITPOS (type, i))
+	    {
+	      break;
+	    }
+	}
+      if (i < len)
+	{
+	  fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
+	}
+      else
+	{
+	  print_longest (stream, 'd', 0, val);
+	}
+      break;
+
+    case TYPE_CODE_FUNC:
+      if (format)
+	{
+	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  break;
+	}
+      /* FIXME, we should consider, at least for ANSI C language, eliminating
+         the distinction made between FUNCs and POINTERs to FUNCs.  */
+      fprintf_filtered (stream, "{");
+      type_print (type, "", stream, -1);
+      fprintf_filtered (stream, "} ");
+      /* Try to print what function it points to, and its address.  */
+      print_address_demangle (address, stream, demangle);
+      break;
+
+    case TYPE_CODE_BOOL:
+      format = format ? format : output_format;
+      if (format)
+	print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+      else
+	{
+	  val = unpack_long (type, valaddr + embedded_offset);
+	  if (val == 0)
+	    fputs_filtered ("false", stream);
+	  else if (val == 1)
+	    fputs_filtered ("true", stream);
+	  else
+	    {
+	      fputs_filtered ("true (", stream);
+	      fprintf_filtered (stream, "%ld)", (long int) val);
+	    }
+	}
+      break;
+
+    case TYPE_CODE_RANGE:
+      /* FIXME: create_range_type does not set the unsigned bit in a
+         range type (I think it probably should copy it from the target
+         type), so we won't print values which are too large to
+         fit in a signed integer correctly.  */
+      /* FIXME: Doesn't handle ranges of enums correctly.  (Can't just
+         print with the target type, though, because the size of our type
+         and the target type might differ).  */
+      /* FALLTHROUGH */
+
+    case TYPE_CODE_INT:
+      format = format ? format : output_format;
+      if (format)
+	{
+	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	}
+      else
+	{
+	  val_print_type_code_int (type, valaddr + embedded_offset, stream);
+	}
+      break;
+
+    case TYPE_CODE_CHAR:
+      format = format ? format : output_format;
+      if (format)
+	{
+	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	}
+      else
+	{
+	  val = unpack_long (type, valaddr + embedded_offset);
+	  if (TYPE_UNSIGNED (type))
+	    fprintf_filtered (stream, "%u", (unsigned int) val);
+	  else
+	    fprintf_filtered (stream, "%d", (int) val);
+	  fputs_filtered (" ", stream);
+	  LA_PRINT_CHAR ((unsigned char) val, stream);
+	}
+      break;
+
+    case TYPE_CODE_FLT:
+      if (format)
+	{
+	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	}
+      else
+	{
+	  print_floating (valaddr + embedded_offset, type, stream);
+	}
+      break;
+
+    case TYPE_CODE_BITSTRING:
+    case TYPE_CODE_SET:
+      elttype = TYPE_INDEX_TYPE (type);
+      CHECK_TYPEDEF (elttype);
+      if (TYPE_FLAGS (elttype) & TYPE_FLAG_STUB)
+	{
+	  fprintf_filtered (stream, "<incomplete type>");
+	  gdb_flush (stream);
+	  break;
+	}
+      else
+	{
+	  struct type *range = elttype;
+	  LONGEST low_bound, high_bound;
+	  int i;
+	  int is_bitstring = TYPE_CODE (type) == TYPE_CODE_BITSTRING;
+	  int need_comma = 0;
+
+	  if (is_bitstring)
+	    fputs_filtered ("B'", stream);
+	  else
+	    fputs_filtered ("[", stream);
+
+	  i = get_discrete_bounds (range, &low_bound, &high_bound);
+	maybe_bad_bstring:
+	  if (i < 0)
+	    {
+	      fputs_filtered ("<error value>", stream);
+	      goto done;
+	    }
+
+	  for (i = low_bound; i <= high_bound; i++)
+	    {
+	      int element = value_bit_index (type, valaddr + embedded_offset, i);
+	      if (element < 0)
+		{
+		  i = element;
+		  goto maybe_bad_bstring;
+		}
+	      if (is_bitstring)
+		fprintf_filtered (stream, "%d", element);
+	      else if (element)
+		{
+		  if (need_comma)
+		    fputs_filtered (", ", stream);
+		  print_type_scalar (range, i, stream);
+		  need_comma = 1;
+
+		  if (i + 1 <= high_bound && value_bit_index (type, valaddr + embedded_offset, ++i))
+		    {
+		      int j = i;
+		      fputs_filtered ("..", stream);
+		      while (i + 1 <= high_bound
+			     && value_bit_index (type, valaddr + embedded_offset, ++i))
+			j = i;
+		      print_type_scalar (range, j, stream);
+		    }
+		}
+	    }
+	done:
+	  if (is_bitstring)
+	    fputs_filtered ("'", stream);
+	  else
+	    fputs_filtered ("]", stream);
+	}
+      break;
+
+    case TYPE_CODE_VOID:
+      fprintf_filtered (stream, "void");
+      break;
+
+    case TYPE_CODE_ERROR:
+      fprintf_filtered (stream, "<error type>");
+      break;
+
+    case TYPE_CODE_UNDEF:
+      /* This happens (without TYPE_FLAG_STUB set) on systems which don't use
+         dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
+         and no complete type for struct foo in that file.  */
+      fprintf_filtered (stream, "<incomplete type>");
+      break;
+
+    default:
+      error ("Invalid pascal type code %d in symbol table.", TYPE_CODE (type));
+    }
+  gdb_flush (stream);
+  return (0);
+}
+
+int
+pascal_value_print (value_ptr val, struct ui_file *stream, int format,
+		    enum val_prettyprint pretty)
+{
+  struct type *type = VALUE_TYPE (val);
+
+  /* If it is a pointer, indicate what it points to.
+
+     Print type also if it is a reference.
+
+     Object pascal: if it is a member pointer, we will take care
+     of that when we print it.  */
+  if (TYPE_CODE (type) == TYPE_CODE_PTR ||
+      TYPE_CODE (type) == TYPE_CODE_REF)
+    {
+      /* Hack:  remove (char *) for char strings.  Their
+         type is indicated by the quoted string anyway. */
+      if (TYPE_CODE (type) == TYPE_CODE_PTR &&
+	  TYPE_NAME (type) == NULL &&
+	  TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL &&
+	  STREQ (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char"))
+	{
+	  /* Print nothing */
+	}
+      else
+	{
+	  fprintf_filtered (stream, "(");
+	  type_print (type, "", stream, -1);
+	  fprintf_filtered (stream, ") ");
+	}
+    }
+  return val_print (type, VALUE_CONTENTS (val), VALUE_EMBEDDED_OFFSET (val),
+		    VALUE_ADDRESS (val) + VALUE_OFFSET (val),
+		    stream, format, 1, 0, pretty);
+}
+
+
+/******************************************************************************
+                    Inserted from cp-valprint
+******************************************************************************/
+
+extern int vtblprint;		/* Controls printing of vtbl's */
+extern int objectprint;		/* Controls looking up an object's derived type
+				   using what we find in its vtables.  */
+static int pascal_static_field_print;	/* Controls printing of static fields. */
+
+static struct obstack dont_print_vb_obstack;
+static struct obstack dont_print_statmem_obstack;
+
+static void
+  pascal_object_print_static_field (struct type *, value_ptr, struct ui_file *, int, int,
+				    enum val_prettyprint);
+
+static void
+  pascal_object_print_value (struct type *, char *, CORE_ADDR, struct ui_file *,
+			     int, int, enum val_prettyprint, struct type **);
+
+void
+pascal_object_print_class_method (char *valaddr, struct type *type,
+				  struct ui_file *stream)
+{
+  struct type *domain;
+  struct fn_field *f = NULL;
+  int j = 0;
+  int len2;
+  int offset;
+  char *kind = "";
+  CORE_ADDR addr;
+  struct symbol *sym;
+  unsigned len;
+  unsigned int i;
+  struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type));
+
+  domain = TYPE_DOMAIN_TYPE (target_type);
+  if (domain == (struct type *) NULL)
+    {
+      fprintf_filtered (stream, "<unknown>");
+      return;
+    }
+  addr = unpack_pointer (lookup_pointer_type (builtin_type_void), valaddr);
+  if (METHOD_PTR_IS_VIRTUAL (addr))
+    {
+      offset = METHOD_PTR_TO_VOFFSET (addr);
+      len = TYPE_NFN_FIELDS (domain);
+      for (i = 0; i < len; i++)
+	{
+	  f = TYPE_FN_FIELDLIST1 (domain, i);
+	  len2 = TYPE_FN_FIELDLIST_LENGTH (domain, i);
+
+	  for (j = 0; j < len2; j++)
+	    {
+	      QUIT;
+	      if (TYPE_FN_FIELD_VOFFSET (f, j) == offset)
+		{
+		  if (TYPE_FN_FIELD_STUB (f, j))
+		    check_stub_method (domain, i, j);
+		  kind = "virtual ";
+		  goto common;
+		}
+	    }
+	}
+    }
+  else
+    {
+      sym = find_pc_function (addr);
+      if (sym == 0)
+	{
+	  error ("invalid pointer to member function");
+	}
+      len = TYPE_NFN_FIELDS (domain);
+      for (i = 0; i < len; i++)
+	{
+	  f = TYPE_FN_FIELDLIST1 (domain, i);
+	  len2 = TYPE_FN_FIELDLIST_LENGTH (domain, i);
+
+	  for (j = 0; j < len2; j++)
+	    {
+	      QUIT;
+	      if (TYPE_FN_FIELD_STUB (f, j))
+		check_stub_method (domain, i, j);
+	      if (STREQ (SYMBOL_NAME (sym), TYPE_FN_FIELD_PHYSNAME (f, j)))
+		{
+		  goto common;
+		}
+	    }
+	}
+    }
+common:
+  if (i < len)
+    {
+      char *demangled_name;
+
+      fprintf_filtered (stream, "&");
+      fprintf_filtered (stream, kind);
+      demangled_name = cplus_demangle (TYPE_FN_FIELD_PHYSNAME (f, j),
+				       DMGL_ANSI | DMGL_PARAMS);
+      if (demangled_name == NULL)
+	fprintf_filtered (stream, "<badly mangled name %s>",
+			  TYPE_FN_FIELD_PHYSNAME (f, j));
+      else
+	{
+	  fputs_filtered (demangled_name, stream);
+	  xfree (demangled_name);
+	}
+    }
+  else
+    {
+      fprintf_filtered (stream, "(");
+      type_print (type, "", stream, -1);
+      fprintf_filtered (stream, ") %d", (int) addr >> 3);
+    }
+}
+
+/* It was changed to this after 2.4.5.  */
+const char pascal_vtbl_ptr_name[] =
+{'_', '_', 'v', 't', 'b', 'l', '_', 'p', 't', 'r', '_', 't', 'y', 'p', 'e', 0};
+
+/* Return truth value for assertion that TYPE is of the type
+   "pointer to virtual function".  */
+
+int
+pascal_object_is_vtbl_ptr_type (struct type *type)
+{
+  char *typename = type_name_no_tag (type);
+
+  return (typename != NULL
+	  && (STREQ (typename, pascal_vtbl_ptr_name)));
+}
+
+/* Return truth value for the assertion that TYPE is of the type
+   "pointer to virtual function table".  */
+
+int
+pascal_object_is_vtbl_member (struct type *type)
+{
+  if (TYPE_CODE (type) == TYPE_CODE_PTR)
+    {
+      type = TYPE_TARGET_TYPE (type);
+      if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+	{
+	  type = TYPE_TARGET_TYPE (type);
+	  if (TYPE_CODE (type) == TYPE_CODE_STRUCT	/* if not using thunks */
+	      || TYPE_CODE (type) == TYPE_CODE_PTR)	/* if using thunks */
+	    {
+	      /* Virtual functions tables are full of pointers
+	         to virtual functions. */
+	      return pascal_object_is_vtbl_ptr_type (type);
+	    }
+	}
+    }
+  return 0;
+}
+
+/* Mutually recursive subroutines of pascal_object_print_value and c_val_print to
+   print out a structure's fields: pascal_object_print_value_fields and pascal_object_print_value.
+
+   TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and PRETTY have the
+   same meanings as in pascal_object_print_value and c_val_print.
+
+   DONT_PRINT is an array of baseclass types that we
+   should not print, or zero if called from top level.  */
+
+void
+pascal_object_print_value_fields (struct type *type, char *valaddr,
+				  CORE_ADDR address, struct ui_file *stream,
+				  int format, int recurse,
+				  enum val_prettyprint pretty,
+				  struct type **dont_print_vb,
+				  int dont_print_statmem)
+{
+  int i, len, n_baseclasses;
+  struct obstack tmp_obstack;
+  char *last_dont_print = obstack_next_free (&dont_print_statmem_obstack);
+
+  CHECK_TYPEDEF (type);
+
+  fprintf_filtered (stream, "{");
+  len = TYPE_NFIELDS (type);
+  n_baseclasses = TYPE_N_BASECLASSES (type);
+
+  /* Print out baseclasses such that we don't print
+     duplicates of virtual baseclasses.  */
+  if (n_baseclasses > 0)
+    pascal_object_print_value (type, valaddr, address, stream,
+			       format, recurse + 1, pretty, dont_print_vb);
+
+  if (!len && n_baseclasses == 1)
+    fprintf_filtered (stream, "<No data fields>");
+  else
+    {
+      extern int inspect_it;
+      int fields_seen = 0;
+
+      if (dont_print_statmem == 0)
+	{
+	  /* If we're at top level, carve out a completely fresh
+	     chunk of the obstack and use that until this particular
+	     invocation returns.  */
+	  tmp_obstack = dont_print_statmem_obstack;
+	  obstack_finish (&dont_print_statmem_obstack);
+	}
+
+      for (i = n_baseclasses; i < len; i++)
+	{
+	  /* If requested, skip printing of static fields.  */
+	  if (!pascal_static_field_print && TYPE_FIELD_STATIC (type, i))
+	    continue;
+	  if (fields_seen)
+	    fprintf_filtered (stream, ", ");
+	  else if (n_baseclasses > 0)
+	    {
+	      if (pretty)
+		{
+		  fprintf_filtered (stream, "\n");
+		  print_spaces_filtered (2 + 2 * recurse, stream);
+		  fputs_filtered ("members of ", stream);
+		  fputs_filtered (type_name_no_tag (type), stream);
+		  fputs_filtered (": ", stream);
+		}
+	    }
+	  fields_seen = 1;
+
+	  if (pretty)
+	    {
+	      fprintf_filtered (stream, "\n");
+	      print_spaces_filtered (2 + 2 * recurse, stream);
+	    }
+	  else
+	    {
+	      wrap_here (n_spaces (2 + 2 * recurse));
+	    }
+	  if (inspect_it)
+	    {
+	      if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
+		fputs_filtered ("\"( ptr \"", stream);
+	      else
+		fputs_filtered ("\"( nodef \"", stream);
+	      if (TYPE_FIELD_STATIC (type, i))
+		fputs_filtered ("static ", stream);
+	      fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
+				       language_cplus,
+				       DMGL_PARAMS | DMGL_ANSI);
+	      fputs_filtered ("\" \"", stream);
+	      fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
+				       language_cplus,
+				       DMGL_PARAMS | DMGL_ANSI);
+	      fputs_filtered ("\") \"", stream);
+	    }
+	  else
+	    {
+	      annotate_field_begin (TYPE_FIELD_TYPE (type, i));
+
+	      if (TYPE_FIELD_STATIC (type, i))
+		fputs_filtered ("static ", stream);
+	      fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
+				       language_cplus,
+				       DMGL_PARAMS | DMGL_ANSI);
+	      annotate_field_name_end ();
+	      fputs_filtered (" = ", stream);
+	      annotate_field_value ();
+	    }
+
+	  if (!TYPE_FIELD_STATIC (type, i) && TYPE_FIELD_PACKED (type, i))
+	    {
+	      value_ptr v;
+
+	      /* Bitfields require special handling, especially due to byte
+	         order problems.  */
+	      if (TYPE_FIELD_IGNORE (type, i))
+		{
+		  fputs_filtered ("<optimized out or zero length>", stream);
+		}
+	      else
+		{
+		  v = value_from_longest (TYPE_FIELD_TYPE (type, i),
+				   unpack_field_as_long (type, valaddr, i));
+
+		  val_print (TYPE_FIELD_TYPE (type, i), VALUE_CONTENTS (v), 0, 0,
+			     stream, format, 0, recurse + 1, pretty);
+		}
+	    }
+	  else
+	    {
+	      if (TYPE_FIELD_IGNORE (type, i))
+		{
+		  fputs_filtered ("<optimized out or zero length>", stream);
+		}
+	      else if (TYPE_FIELD_STATIC (type, i))
+		{
+		  /* value_ptr v = value_static_field (type, i); v4.17 specific */
+		  value_ptr v;
+		  v = value_from_longest (TYPE_FIELD_TYPE (type, i),
+				   unpack_field_as_long (type, valaddr, i));
+
+		  if (v == NULL)
+		    fputs_filtered ("<optimized out>", stream);
+		  else
+		    pascal_object_print_static_field (TYPE_FIELD_TYPE (type, i), v,
+						stream, format, recurse + 1,
+						      pretty);
+		}
+	      else
+		{
+		  /* val_print (TYPE_FIELD_TYPE (type, i),
+		     valaddr + TYPE_FIELD_BITPOS (type, i) / 8,
+		     address + TYPE_FIELD_BITPOS (type, i) / 8, 0,
+		     stream, format, 0, recurse + 1, pretty); */
+		  val_print (TYPE_FIELD_TYPE (type, i),
+			     valaddr, TYPE_FIELD_BITPOS (type, i) / 8,
+			     address + TYPE_FIELD_BITPOS (type, i) / 8,
+			     stream, format, 0, recurse + 1, pretty);
+		}
+	    }
+	  annotate_field_end ();
+	}
+
+      if (dont_print_statmem == 0)
+	{
+	  /* Free the space used to deal with the printing
+	     of the members from top level.  */
+	  obstack_free (&dont_print_statmem_obstack, last_dont_print);
+	  dont_print_statmem_obstack = tmp_obstack;
+	}
+
+      if (pretty)
+	{
+	  fprintf_filtered (stream, "\n");
+	  print_spaces_filtered (2 * recurse, stream);
+	}
+    }
+  fprintf_filtered (stream, "}");
+}
+
+/* Special val_print routine to avoid printing multiple copies of virtual
+   baseclasses.  */
+
+void
+pascal_object_print_value (struct type *type, char *valaddr, CORE_ADDR address,
+			   struct ui_file *stream, int format, int recurse,
+			   enum val_prettyprint pretty,
+			   struct type **dont_print_vb)
+{
+  struct obstack tmp_obstack;
+  struct type **last_dont_print
+  = (struct type **) obstack_next_free (&dont_print_vb_obstack);
+  int i, n_baseclasses = TYPE_N_BASECLASSES (type);
+
+  if (dont_print_vb == 0)
+    {
+      /* If we're at top level, carve out a completely fresh
+         chunk of the obstack and use that until this particular
+         invocation returns.  */
+      tmp_obstack = dont_print_vb_obstack;
+      /* Bump up the high-water mark.  Now alpha is omega.  */
+      obstack_finish (&dont_print_vb_obstack);
+    }
+
+  for (i = 0; i < n_baseclasses; i++)
+    {
+      int boffset;
+      struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
+      char *basename = TYPE_NAME (baseclass);
+      char *base_valaddr;
+
+      if (BASETYPE_VIA_VIRTUAL (type, i))
+	{
+	  struct type **first_dont_print
+	  = (struct type **) obstack_base (&dont_print_vb_obstack);
+
+	  int j = (struct type **) obstack_next_free (&dont_print_vb_obstack)
+	  - first_dont_print;
+
+	  while (--j >= 0)
+	    if (baseclass == first_dont_print[j])
+	      goto flush_it;
+
+	  obstack_ptr_grow (&dont_print_vb_obstack, baseclass);
+	}
+
+      boffset = baseclass_offset (type, i, valaddr, address);
+
+      if (pretty)
+	{
+	  fprintf_filtered (stream, "\n");
+	  print_spaces_filtered (2 * recurse, stream);
+	}
+      fputs_filtered ("<", stream);
+      /* Not sure what the best notation is in the case where there is no
+         baseclass name.  */
+
+      fputs_filtered (basename ? basename : "", stream);
+      fputs_filtered ("> = ", stream);
+
+      /* The virtual base class pointer might have been clobbered by the
+         user program. Make sure that it still points to a valid memory
+         location.  */
+
+      if (boffset != -1 && (boffset < 0 || boffset >= TYPE_LENGTH (type)))
+	{
+	  base_valaddr = (char *) alloca (TYPE_LENGTH (baseclass));
+	  if (target_read_memory (address + boffset, base_valaddr,
+				  TYPE_LENGTH (baseclass)) != 0)
+	    boffset = -1;
+	}
+      else
+	base_valaddr = valaddr + boffset;
+
+      if (boffset == -1)
+	fprintf_filtered (stream, "<invalid address>");
+      else
+	pascal_object_print_value_fields (baseclass, base_valaddr, address + boffset,
+					  stream, format, recurse, pretty,
+		     (struct type **) obstack_base (&dont_print_vb_obstack),
+					  0);
+      fputs_filtered (", ", stream);
+
+    flush_it:
+      ;
+    }
+
+  if (dont_print_vb == 0)
+    {
+      /* Free the space used to deal with the printing
+         of this type from top level.  */
+      obstack_free (&dont_print_vb_obstack, last_dont_print);
+      /* Reset watermark so that we can continue protecting
+         ourselves from whatever we were protecting ourselves.  */
+      dont_print_vb_obstack = tmp_obstack;
+    }
+}
+
+/* Print value of a static member.
+   To avoid infinite recursion when printing a class that contains
+   a static instance of the class, we keep the addresses of all printed
+   static member classes in an obstack and refuse to print them more
+   than once.
+
+   VAL contains the value to print, TYPE, STREAM, RECURSE, and PRETTY
+   have the same meanings as in c_val_print.  */
+
+static void
+pascal_object_print_static_field (struct type *type, value_ptr val,
+				  struct ui_file *stream, int format,
+				  int recurse, enum val_prettyprint pretty)
+{
+  if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+    {
+      CORE_ADDR *first_dont_print;
+      int i;
+
+      first_dont_print
+	= (CORE_ADDR *) obstack_base (&dont_print_statmem_obstack);
+      i = (CORE_ADDR *) obstack_next_free (&dont_print_statmem_obstack)
+	- first_dont_print;
+
+      while (--i >= 0)
+	{
+	  if (VALUE_ADDRESS (val) == first_dont_print[i])
+	    {
+	      fputs_filtered ("<same as static member of an already seen type>",
+			      stream);
+	      return;
+	    }
+	}
+
+      obstack_grow (&dont_print_statmem_obstack, (char *) &VALUE_ADDRESS (val),
+		    sizeof (CORE_ADDR));
+
+      CHECK_TYPEDEF (type);
+      pascal_object_print_value_fields (type, VALUE_CONTENTS (val), VALUE_ADDRESS (val),
+				  stream, format, recurse, pretty, NULL, 1);
+      return;
+    }
+  val_print (type, VALUE_CONTENTS (val), 0, VALUE_ADDRESS (val),
+	     stream, format, 0, recurse, pretty);
+}
+
+void
+pascal_object_print_class_member (char *valaddr, struct type *domain,
+				  struct ui_file *stream, char *prefix)
+{
+
+  /* VAL is a byte offset into the structure type DOMAIN.
+     Find the name of the field for that offset and
+     print it.  */
+  int extra = 0;
+  int bits = 0;
+  register unsigned int i;
+  unsigned len = TYPE_NFIELDS (domain);
+  /* @@ Make VAL into bit offset */
+  LONGEST val = unpack_long (builtin_type_int, valaddr) << 3;
+  for (i = TYPE_N_BASECLASSES (domain); i < len; i++)
+    {
+      int bitpos = TYPE_FIELD_BITPOS (domain, i);
+      QUIT;
+      if (val == bitpos)
+	break;
+      if (val < bitpos && i != 0)
+	{
+	  /* Somehow pointing into a field.  */
+	  i -= 1;
+	  extra = (val - TYPE_FIELD_BITPOS (domain, i));
+	  if (extra & 0x7)
+	    bits = 1;
+	  else
+	    extra >>= 3;
+	  break;
+	}
+    }
+  if (i < len)
+    {
+      char *name;
+      fprintf_filtered (stream, prefix);
+      name = type_name_no_tag (domain);
+      if (name)
+	fputs_filtered (name, stream);
+      else
+	pascal_type_print_base (domain, stream, 0, 0);
+      fprintf_filtered (stream, "::");
+      fputs_filtered (TYPE_FIELD_NAME (domain, i), stream);
+      if (extra)
+	fprintf_filtered (stream, " + %d bytes", extra);
+      if (bits)
+	fprintf_filtered (stream, " (offset in bits)");
+    }
+  else
+    fprintf_filtered (stream, "%ld", (long int) (val >> 3));
+}
+
+
+void
+_initialize_pascal_valprint (void)
+{
+  add_show_from_set
+    (add_set_cmd ("pascal_static-members", class_support, var_boolean,
+		  (char *) &pascal_static_field_print,
+		  "Set printing of pascal static members.",
+		  &setprintlist),
+     &showprintlist);
+  /* Turn on printing of static fields.  */
+  pascal_static_field_print = 1;
+
+}
diff --git a/gdb/pa64solib.c b/gdb/pa64solib.c
index 88ff67e..45a575b 100644
--- a/gdb/pa64solib.c
+++ b/gdb/pa64solib.c
@@ -145,8 +145,7 @@
 /* Return a ballbark figure for the amount of memory GDB will need to
    allocate to read in the debug symbols from FILENAME.  */
 static LONGEST
-pa64_solib_sizeof_symbol_table (filename)
-     char *filename;
+pa64_solib_sizeof_symbol_table (char *filename)
 {
   bfd *abfd;
   int i;
@@ -169,7 +168,7 @@
   if (!abfd)
     {
       close (desc);
-      make_cleanup (free, filename);
+      make_cleanup (xfree, filename);
       error ("\"%s\": can't open to read symbols: %s.", filename,
 	     bfd_errmsg (bfd_get_error ()));
     }
@@ -177,7 +176,7 @@
   if (!bfd_check_format (abfd, bfd_object))
     {
       bfd_close (abfd);
-      make_cleanup (free, filename);
+      make_cleanup (xfree, filename);
       error ("\"%s\": can't read symbols: %s.", filename,
 	     bfd_errmsg (bfd_get_error ()));
     }
@@ -193,7 +192,7 @@
     }
 
   bfd_close (abfd);
-  free (filename);
+  xfree (filename);
 
   /* Unfortunately, just summing the sizes of various debug info
      sections isn't a very accurate measurement of how much heap
@@ -216,11 +215,8 @@
 /* Add a shared library to the objfile list and load its symbols into
    GDB's symbol table.  */
 static void
-pa64_solib_add_solib_objfile (so, name, from_tty, text_addr)
-     struct so_list *so;
-     char *name;
-     int from_tty;
-     CORE_ADDR text_addr;
+pa64_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty,
+			      CORE_ADDR text_addr)
 {
   bfd *tmp_bfd;
   asection *sec;
@@ -298,12 +294,8 @@
    NULL if we are not attaching to a process or reading a core file.  */
 
 static void
-pa64_solib_load_symbols (so, name, from_tty, text_addr, target)
-     struct so_list *so;
-     char *name;
-     int from_tty;
-     CORE_ADDR text_addr;
-     struct target_ops *target;
+pa64_solib_load_symbols (struct so_list *so, char *name, int from_tty,
+			 CORE_ADDR text_addr, struct target_ops *target)
 {
   struct section_table *p;
   asection *sec;
@@ -327,9 +319,9 @@
       return;
     }
 
-  ANOFFSET (so->objfile->section_offsets, SECT_OFF_TEXT (so->objfile))
+  (so->objfile->section_offsets)->offsets[SECT_OFF_TEXT (so->objfile)]
     = so->pa64_solib_desc.text_base;
-  ANOFFSET (so->objfile->section_offsets, SECT_OFF_DATA (so->objfile))
+  (so->objfile->section_offsets)->offsets[SECT_OFF_DATA (so->objfile)]
     = so->pa64_solib_desc.data_base;
 
   /* Relocate all the sections based on where they got loaded.  */
@@ -379,10 +371,7 @@
    be exceeded.  */
 
 void
-pa64_solib_add (arg_string, from_tty, target)
-     char *arg_string;
-     int from_tty;
-     struct target_ops *target;
+pa64_solib_add (char *arg_string, int from_tty, struct target_ops *target)
 {
   struct minimal_symbol *msymbol;
   CORE_ADDR addr;
@@ -471,7 +460,7 @@
      call the breakpoint routine for significant events.  */
 
 void
-pa64_solib_create_inferior_hook ()
+pa64_solib_create_inferior_hook (void)
 {
   struct minimal_symbol *msymbol;
   unsigned int dld_flags, status;
@@ -584,7 +573,7 @@
       struct so_list *temp;
 
       temp = so_list_head;
-      free (so_list_head);
+      xfree (so_list_head);
       so_list_head = temp->next;
     }
   clear_symtab_users ();
@@ -601,8 +590,7 @@
    GDB may already have been notified of.  */
 
 void
-pa64_solib_remove_inferior_hook (pid)
-     int pid;
+pa64_solib_remove_inferior_hook (int pid)
 {
   /* Turn off the DT_HP_DEBUG_CALLBACK bit in the dynamic linker flags.  */
   dld_cache.dld_flags &= ~DT_HP_DEBUG_CALLBACK;
@@ -623,11 +611,8 @@
    pa64_solib_create_inferior_hook.  */
 
 void
-pa64_solib_create_catch_load_hook (pid, tempflag, filename, cond_string)
-     int pid;
-     int tempflag;
-     char *filename;
-     char *cond_string;
+pa64_solib_create_catch_load_hook (int pid, int tempflag, char *filename,
+				   char *cond_string)
 {
   create_solib_load_event_breakpoint ("", tempflag, filename, cond_string);
 }
@@ -644,11 +629,8 @@
    pa64_solib_create_inferior_hook.  */
 
 void
-pa64_solib_create_catch_unload_hook (pid, tempflag, filename, cond_string)
-     int pid;
-     int tempflag;
-     char *filename;
-     char *cond_string;
+pa64_solib_create_catch_unload_hook (int pid, int tempflag, char *filename,
+				     char *cond_string)
 {
   create_solib_unload_event_breakpoint ("", tempflag, filename, cond_string);
 }
@@ -657,8 +639,7 @@
    has been loaded.  */
 
 int
-pa64_solib_have_load_event (pid)
-     int pid;
+pa64_solib_have_load_event (int pid)
 {
   CORE_ADDR event_kind;
 
@@ -669,8 +650,7 @@
 /* Return nonzero if the dynamic linker has reproted that a library
    has been unloaded.  */
 int
-pa64_solib_have_unload_event (pid)
-     int pid;
+pa64_solib_have_unload_event (int pid)
 {
   CORE_ADDR event_kind;
 
@@ -685,8 +665,7 @@
    restarted.  */
 
 char *
-pa64_solib_loaded_library_pathname (pid)
-     int pid;
+pa64_solib_loaded_library_pathname (int pid)
 {
   static char dll_path[MAXPATHLEN];
   CORE_ADDR  dll_path_addr = read_register (ARG3_REGNUM);
@@ -701,8 +680,7 @@
    restarted.  */
 
 char *
-pa64_solib_unloaded_library_pathname (pid)
-     int pid;
+pa64_solib_unloaded_library_pathname (int pid)
 {
   static char dll_path[MAXPATHLEN];
   CORE_ADDR dll_path_addr = read_register (ARG3_REGNUM);
@@ -713,9 +691,7 @@
 /* Return nonzero if PC is an address inside the dynamic linker.  */
 
 int
-pa64_solib_in_dynamic_linker (pid, pc)
-     int pid;
-     CORE_ADDR pc;
+pa64_solib_in_dynamic_linker (int pid, CORE_ADDR pc)
 {
   asection *shlib_info;
 
@@ -735,8 +711,7 @@
    ADDR isn't in any known shared library, return zero.  */
 
 CORE_ADDR
-pa64_solib_get_got_by_pc (addr)
-     CORE_ADDR addr;
+pa64_solib_get_got_by_pc (CORE_ADDR addr)
 {
   struct so_list *so_list = so_list_head;
   CORE_ADDR got_value = 0;
@@ -762,8 +737,7 @@
    This function is used in hppa_fix_call_dummy in hppa-tdep.c.  */
 
 CORE_ADDR
-pa64_solib_get_solib_by_pc (addr)
-     CORE_ADDR addr;
+pa64_solib_get_solib_by_pc (CORE_ADDR addr)
 {
   struct so_list *so_list = so_list_head;
   CORE_ADDR retval = 0;
@@ -786,9 +760,7 @@
 /* Dump information about all the currently loaded shared libraries.  */
 
 static void
-pa64_sharedlibrary_info_command (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+pa64_sharedlibrary_info_command (char *ignore, int from_tty)
 {
   struct so_list *so_list = so_list_head;
 
@@ -842,9 +814,7 @@
 /* Load up one or more shared libraries as directed by the user.  */
 
 static void
-pa64_solib_sharedlibrary_command (args, from_tty)
-     char *args;
-     int from_tty;
+pa64_solib_sharedlibrary_command (char *args, int from_tty)
 {
   dont_repeat ();
   pa64_solib_add (args, from_tty, (struct target_ops *) 0);
@@ -854,8 +824,7 @@
    is not contained in any known shared library.  */
 
 char *
-pa64_solib_address (addr)
-     CORE_ADDR addr;
+pa64_solib_address (CORE_ADDR addr)
 {
   struct so_list *so = so_list_head;
 
@@ -879,7 +848,7 @@
 /* We are killing the inferior and restarting the program.  */
 
 void
-pa64_solib_restart ()
+pa64_solib_restart (void)
 {
   struct so_list *sl = so_list_head;
 
@@ -891,7 +860,7 @@
   while (sl)
     {
       struct so_list *next_sl = sl->next;
-      free (sl);
+      xfree (sl);
       sl = next_sl;
     }
   so_list_head = NULL;
@@ -910,7 +879,7 @@
 }
 
 void
-_initialize_pa64_solib ()
+_initialize_pa64_solib (void)
 {
   add_com ("sharedlibrary", class_files, pa64_solib_sharedlibrary_command,
 	   "Load shared object library symbols for files matching REGEXP.");
@@ -944,8 +913,7 @@
 
 /* Get some HPUX-specific data from a shared lib.  */
 CORE_ADDR
-so_lib_thread_start_addr (so)
-     struct so_list *so;
+so_lib_thread_start_addr (struct so_list *so)
 {
   return so->pa64_solib_desc.tls_start_addr;
 }
@@ -958,8 +926,7 @@
    return nonzero.  */
 
 static boolean
-read_dld_descriptor (target)
-     struct target_ops *target;
+read_dld_descriptor (struct target_ops *target)
 {
   char *dll_path;
   asection *dyninfo_sect;
@@ -1028,9 +995,7 @@
    was used as a model for this.  */
 
 static boolean
-read_dynamic_info (dyninfo_sect, dld_cache_p)
-     asection *dyninfo_sect;
-     dld_cache_t *dld_cache_p;
+read_dynamic_info (asection *dyninfo_sect, dld_cache_t *dld_cache_p)
 {
   char *buf;
   char *bufend;
@@ -1054,8 +1019,9 @@
       Elf64_Dyn *x_dynp = (Elf64_Dyn*)buf;
       Elf64_Sxword dyn_tag;
       CORE_ADDR	dyn_ptr;
-      char pbuf[TARGET_PTR_BIT / HOST_CHAR_BIT];
+      char *pbuf;
 
+      pbuf = alloca (TARGET_PTR_BIT / HOST_CHAR_BIT);
       dyn_tag = bfd_h_get_64 (symfile_objfile->obfd, 
 			      (bfd_byte*) &x_dynp->d_tag);
 
@@ -1111,11 +1077,7 @@
 /* Wrapper for target_read_memory to make dlgetmodinfo happy.  */
 
 static void *
-pa64_target_read_memory (buffer, ptr, bufsiz, ident)
-     void *buffer;
-     CORE_ADDR ptr;
-     size_t bufsiz;
-     int ident;
+pa64_target_read_memory (void *buffer, CORE_ADDR ptr, size_t bufsiz, int ident)
 {
   if (target_read_memory (ptr, buffer, bufsiz) != 0)
     return 0;
@@ -1130,13 +1092,9 @@
    be read from the inferior process at the address load_module_desc_addr.  */
 
 static void
-add_to_solist (from_tty, dll_path, load_module_desc_p,
-	       load_module_desc_addr, target)
-     boolean from_tty; 
-     char *dll_path; 
-     struct load_module_desc *load_module_desc_p;
-     CORE_ADDR load_module_desc_addr;
-     struct target_ops *target;
+add_to_solist (boolean from_tty, char *dll_path,
+	       struct load_module_desc *load_module_desc_p,
+	       CORE_ADDR load_module_desc_addr, struct target_ops *target)
 {
   struct so_list *new_so, *so_list_tail;
   int pa64_solib_st_size_threshhold_exceeded;
@@ -1213,7 +1171,8 @@
   pa64_solib_load_symbols (new_so, 
 			   dll_path,
 			   from_tty, 
-			   0);
+			   0,
+			   target);
   return;
 }
 
@@ -1239,9 +1198,7 @@
  */
 
 static CORE_ADDR
-bfd_lookup_symbol (abfd, symname)
-     bfd *abfd;
-     char *symname;
+bfd_lookup_symbol (bfd *abfd, char *symname)
 {
   unsigned int storage_needed;
   asymbol *sym;
@@ -1256,7 +1213,7 @@
   if (storage_needed > 0)
     {
       symbol_table = (asymbol **) xmalloc (storage_needed);
-      back_to = make_cleanup (free, (PTR) symbol_table);
+      back_to = make_cleanup (xfree, (PTR) symbol_table);
       number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
 
       for (i = 0; i < number_of_symbols; i++)
diff --git a/gdb/parse.c b/gdb/parse.c
index a39c21d..fae0096 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -41,8 +41,12 @@
 #include "command.h"
 #include "language.h"
 #include "parser-defs.h"
+#include "linespec.h"
 #include "gdbcmd.h"
 #include "symfile.h"		/* for overlay functions */
+#include "inferior.h"		/* for NUM_PSEUDO_REGS.  NOTE: replace 
+				   with "gdbarch.h" when appropriate.  */
+
 
 /* Symbols which architectures can redefine.  */
 
@@ -108,9 +112,7 @@
    REGISTER_NAME; std_regs; or a target specific alias hook. */
 
 int
-target_map_name_to_register (str, len)
-     char *str;
-     int len;
+target_map_name_to_register (char *str, int len)
 {
   int i;
 
@@ -131,7 +133,15 @@
 	return i;
       }
 
-  /* Try standard aliases */
+  /* Try pseudo-registers, if any. */
+  for (i = NUM_REGS; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
+    if (REGISTER_NAME (i) && len == strlen (REGISTER_NAME (i))
+	&& STREQN (str, REGISTER_NAME (i), len))
+      {
+	return i;
+      }
+
+  /* Try standard aliases. */
   for (i = 0; i < num_std_regs; i++)
     if (std_regs[i].name && len == strlen (std_regs[i].name)
 	&& STREQN (str, std_regs[i].name, len))
@@ -146,7 +156,7 @@
    saving the data about any containing call.  */
 
 void
-start_arglist ()
+start_arglist (void)
 {
   register struct funcall *new;
 
@@ -161,13 +171,13 @@
    and restore the data for the containing function call.  */
 
 int
-end_arglist ()
+end_arglist (void)
 {
   register int val = arglist_len;
   register struct funcall *call = funcall_chain;
   funcall_chain = call->next;
   arglist_len = call->arglist_len;
-  free ((PTR) call);
+  xfree (call);
   return val;
 }
 
@@ -182,7 +192,7 @@
   for (call = funcall_chain; call; call = next)
     {
       next = call->next;
-      free ((PTR) call);
+      xfree (call);
     }
 }
 
@@ -195,8 +205,7 @@
    a register through here */
 
 void
-write_exp_elt (expelt)
-     union exp_element expelt;
+write_exp_elt (union exp_element expelt)
 {
   if (expout_ptr >= expout_size)
     {
@@ -209,8 +218,7 @@
 }
 
 void
-write_exp_elt_opcode (expelt)
-     enum exp_opcode expelt;
+write_exp_elt_opcode (enum exp_opcode expelt)
 {
   union exp_element tmp;
 
@@ -220,8 +228,7 @@
 }
 
 void
-write_exp_elt_sym (expelt)
-     struct symbol *expelt;
+write_exp_elt_sym (struct symbol *expelt)
 {
   union exp_element tmp;
 
@@ -231,8 +238,7 @@
 }
 
 void
-write_exp_elt_block (b)
-     struct block *b;
+write_exp_elt_block (struct block *b)
 {
   union exp_element tmp;
   tmp.block = b;
@@ -240,8 +246,7 @@
 }
 
 void
-write_exp_elt_longcst (expelt)
-     LONGEST expelt;
+write_exp_elt_longcst (LONGEST expelt)
 {
   union exp_element tmp;
 
@@ -251,8 +256,7 @@
 }
 
 void
-write_exp_elt_dblcst (expelt)
-     DOUBLEST expelt;
+write_exp_elt_dblcst (DOUBLEST expelt)
 {
   union exp_element tmp;
 
@@ -262,8 +266,7 @@
 }
 
 void
-write_exp_elt_type (expelt)
-     struct type *expelt;
+write_exp_elt_type (struct type *expelt)
 {
   union exp_element tmp;
 
@@ -273,8 +276,7 @@
 }
 
 void
-write_exp_elt_intern (expelt)
-     struct internalvar *expelt;
+write_exp_elt_intern (struct internalvar *expelt)
 {
   union exp_element tmp;
 
@@ -305,8 +307,7 @@
 
 
 void
-write_exp_string (str)
-     struct stoken str;
+write_exp_string (struct stoken str)
 {
   register int len = str.length;
   register int lenelt;
@@ -355,8 +356,7 @@
    either end of the bitstring. */
 
 void
-write_exp_bitstring (str)
-     struct stoken str;
+write_exp_bitstring (struct stoken str)
 {
   register int bits = str.length;	/* length in bits */
   register int len = (bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
@@ -403,10 +403,8 @@
 static struct type *msym_unknown_symbol_type;
 
 void
-write_exp_msymbol (msymbol, text_symbol_type, data_symbol_type)
-     struct minimal_symbol *msymbol;
-     struct type *text_symbol_type;
-     struct type *data_symbol_type;
+write_exp_msymbol (struct minimal_symbol *msymbol,
+		   struct type *text_symbol_type, struct type *data_symbol_type)
 {
   CORE_ADDR addr;
 
@@ -467,8 +465,7 @@
  */
 
 void
-write_dollar_variable (str)
-     struct stoken str;
+write_dollar_variable (struct stoken str)
 {
   /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
      and $$digits (equivalent to $<-digits> if you could type that). */
@@ -584,12 +581,8 @@
 {':', ':'};
 
 struct symbol *
-parse_nested_classes_for_hpacc (name, len, token, class_prefix, argptr)
-     char *name;
-     int len;
-     char **token;
-     int *class_prefix;
-     char **argptr;
+parse_nested_classes_for_hpacc (char *name, int len, char **token,
+				int *class_prefix, char **argptr)
 {
   /* Comment below comes from decode_line_1 which has very similar
      code, which is called for "break" command parsing. */
@@ -743,8 +736,7 @@
 }
 
 char *
-find_template_name_end (p)
-     char *p;
+find_template_name_end (char *p)
 {
   int depth = 1;
   int just_seen_right = 0;
@@ -809,8 +801,7 @@
    of a string token.  */
 
 char *
-copy_name (token)
-     struct stoken token;
+copy_name (struct stoken token)
 {
   memcpy (namecopy, token.ptr, token.length);
   namecopy[token.length] = 0;
@@ -821,8 +812,7 @@
    to prefix form (in which we can conveniently print or execute it).  */
 
 static void
-prefixify_expression (expr)
-     register struct expression *expr;
+prefixify_expression (register struct expression *expr)
 {
   register int len =
   sizeof (struct expression) + EXP_ELEM_TO_BYTES (expr->nelts);
@@ -841,9 +831,7 @@
    whose last exp_element is at index ENDPOS - 1 in EXPR.  */
 
 int
-length_of_subexp (expr, endpos)
-     register struct expression *expr;
-     register int endpos;
+length_of_subexp (register struct expression *expr, register int endpos)
 {
   register int oplen = 1;
   register int args = 0;
@@ -977,11 +965,8 @@
    In the process, convert it from suffix to prefix form.  */
 
 static void
-prefixify_subexp (inexpr, outexpr, inend, outbeg)
-     register struct expression *inexpr;
-     struct expression *outexpr;
-     register int inend;
-     int outbeg;
+prefixify_subexp (register struct expression *inexpr,
+		  struct expression *outexpr, register int inend, int outbeg)
 {
   register int oplen = 1;
   register int args = 0;
@@ -1146,10 +1131,7 @@
    If COMMA is nonzero, stop if a comma is reached.  */
 
 struct expression *
-parse_exp_1 (stringptr, block, comma)
-     char **stringptr;
-     struct block *block;
-     int comma;
+parse_exp_1 (char **stringptr, struct block *block, int comma)
 {
   struct cleanup *old_chain;
 
@@ -1211,8 +1193,7 @@
    to use up all of the contents of STRING.  */
 
 struct expression *
-parse_expression (string)
-     char *string;
+parse_expression (char *string)
 {
   register struct expression *exp;
   exp = parse_exp_1 (&string, 0, 0);
@@ -1225,8 +1206,7 @@
    probably useful for any language which declares its types "backwards".  */
 
 void
-push_type (tp)
-     enum type_pieces tp;
+push_type (enum type_pieces tp)
 {
   if (type_stack_depth == type_stack_size)
     {
@@ -1238,8 +1218,7 @@
 }
 
 void
-push_type_int (n)
-     int n;
+push_type_int (int n)
 {
   if (type_stack_depth == type_stack_size)
     {
@@ -1251,7 +1230,7 @@
 }
 
 enum type_pieces
-pop_type ()
+pop_type (void)
 {
   if (type_stack_depth)
     return type_stack[--type_stack_depth].piece;
@@ -1259,7 +1238,7 @@
 }
 
 int
-pop_type_int ()
+pop_type_int (void)
 {
   if (type_stack_depth)
     return type_stack[--type_stack_depth].int_val;
@@ -1270,8 +1249,7 @@
 /* Pop the type stack and return the type which corresponds to FOLLOW_TYPE
    as modified by all the stuff on the stack.  */
 struct type *
-follow_types (follow_type)
-     struct type *follow_type;
+follow_types (struct type *follow_type)
 {
   int done = 0;
   int array_size;
@@ -1315,7 +1293,7 @@
 
 static void build_parse (void);
 static void
-build_parse ()
+build_parse (void)
 {
   int i;
 
@@ -1354,30 +1332,42 @@
   i = 0;
   /* fill it in */
 #ifdef PC_REGNUM
-  std_regs[i].name = "pc";
-  std_regs[i].regnum = PC_REGNUM;
-  i++;
+  if (PC_REGNUM >= 0)
+    {
+      std_regs[i].name = "pc";
+      std_regs[i].regnum = PC_REGNUM;
+      i++;
+    }
 #endif
 #ifdef FP_REGNUM
-  std_regs[i].name = "fp";
-  std_regs[i].regnum = FP_REGNUM;
-  i++;
+  if (FP_REGNUM >= 0)
+    {
+      std_regs[i].name = "fp";
+      std_regs[i].regnum = FP_REGNUM;
+      i++;
+    }
 #endif
 #ifdef SP_REGNUM
-  std_regs[i].name = "sp";
-  std_regs[i].regnum = SP_REGNUM;
-  i++;
+  if (SP_REGNUM >= 0)
+    {
+      std_regs[i].name = "sp";
+      std_regs[i].regnum = SP_REGNUM;
+      i++;
+    }
 #endif
 #ifdef PS_REGNUM
-  std_regs[i].name = "ps";
-  std_regs[i].regnum = PS_REGNUM;
-  i++;
+  if (PS_REGNUM >= 0)
+    {
+      std_regs[i].name = "ps";
+      std_regs[i].regnum = PS_REGNUM;
+      i++;
+    }
 #endif
   memset (&std_regs[i], 0, sizeof (std_regs[i]));
 }
 
 void
-_initialize_parse ()
+_initialize_parse (void)
 {
   type_stack_size = 80;
   type_stack_depth = 0;
diff --git a/gdb/partial-stab.h b/gdb/partial-stab.h
index b8c9de8..6691b75 100644
--- a/gdb/partial-stab.h
+++ b/gdb/partial-stab.h
@@ -647,7 +647,7 @@
 	   use the address of this function as the low bound for
 	   the partial symbol table.  */
 	if (textlow_not_set
-	    || (CUR_SYMBOL_VALUE < pst->textlow
+	    || (pst && CUR_SYMBOL_VALUE < pst->textlow
 		&& CUR_SYMBOL_VALUE
 		!= ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))))
 	  {
diff --git a/gdb/ppc-bdm.c b/gdb/ppc-bdm.c
index e10ebac..5b8877f 100644
--- a/gdb/ppc-bdm.c
+++ b/gdb/ppc-bdm.c
@@ -36,6 +36,7 @@
 #include <signal.h>
 #include "serial.h"
 #include "ocd.h"
+#include "ppc-tdep.h"
 
 static void bdm_ppc_open (char *name, int from_tty);
 
@@ -77,9 +78,7 @@
    NAME is the filename used for communication.  */
 
 static void
-bdm_ppc_open (name, from_tty)
-     char *name;
-     int from_tty;
+bdm_ppc_open (char *name, int from_tty)
 {
   CORE_ADDR watchdogaddr = 0xff000004;
 
@@ -99,9 +98,7 @@
    means in the case of this target).  */
 
 static int
-bdm_ppc_wait (pid, target_status)
-     int pid;
-     struct target_waitstatus *target_status;
+bdm_ppc_wait (int pid, struct target_waitstatus *target_status)
 {
   int stop_reason;
 
@@ -153,8 +150,7 @@
  */
 
 static void
-bdm_ppc_fetch_registers (regno)
-     int regno;
+bdm_ppc_fetch_registers (int regno)
 {
   int i;
   unsigned char *regs, *beginregs, *endregs, *almostregs;
@@ -203,7 +199,7 @@
 /*      printf("Asking for register %d\n", first_regno); */
 
       /* if asking for an invalid register */
-      if ((first_regno == MQ_REGNUM) ||
+      if ((first_regno == PPC_MQ_REGNUM) ||
 	  ((first_regno >= FP0_REGNUM) && (first_regno <= FPLAST_REGNUM)))
 	{
 /*          printf("invalid reg request!\n"); */
@@ -258,8 +254,7 @@
    of REGISTERS.  FIXME: ignores errors.  */
 
 static void
-bdm_ppc_store_registers (regno)
-     int regno;
+bdm_ppc_store_registers (int regno)
 {
   int i;
   int first_regno, last_regno;
@@ -293,14 +288,14 @@
 
       /* only attempt to write if it's a valid ppc 8xx register */
       /* (need to avoid FP regs and MQ reg) */
-      if ((i != MQ_REGNUM) && ((i < FP0_REGNUM) || (i > FPLAST_REGNUM)))
+      if ((i != PPC_MQ_REGNUM) && ((i < FP0_REGNUM) || (i > FPLAST_REGNUM)))
 	{
 /*          printf("write valid reg %d\n", bdm_regno); */
 	  ocd_write_bdm_registers (bdm_regno, registers + REGISTER_BYTE (i), 4);
 	}
 /*
-   else if (i == MQ_REGNUM)
-   printf("don't write invalid reg %d (MQ_REGNUM)\n", bdm_regno);
+   else if (i == PPC_MQ_REGNUM)
+   printf("don't write invalid reg %d (PPC_MQ_REGNUM)\n", bdm_regno);
    else
    printf("don't write invalid reg %d\n", bdm_regno);
  */
@@ -383,7 +378,7 @@
 }				/* init_bdm_ppc_ops */
 
 void
-_initialize_bdm_ppc ()
+_initialize_bdm_ppc (void)
 {
   init_bdm_ppc_ops ();
   add_target (&bdm_ppc_ops);
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 30e580a..d562eca 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -35,7 +35,7 @@
 #include "gregset.h"
 
 int
-kernel_u_size ()
+kernel_u_size (void)
 {
   return (sizeof (struct user));
 }
@@ -58,7 +58,7 @@
 }
 
 void
-supply_gregset (gregset_t * gregsetp)
+supply_gregset (gdb_gregset_t *gregsetp)
 {
   int regi;
   register greg_t *regp = (greg_t *) gregsetp;
@@ -71,7 +71,29 @@
 }
 
 void
-supply_fpregset (fpregset_t * fpregsetp)
+fill_gregset (gdb_gregset_t *gregsetp, int regno)
+{
+  int regi;
+  greg_t *regp = (greg_t *) gregsetp;
+
+#define COPY_REG(_idx_,_regi_) \
+  if ((regno == -1) || regno == _regi_) \
+    memcpy (regp + _idx_, &registers[REGISTER_BYTE (_regi_)], \
+	    REGISTER_RAW_SIZE (_regi_))
+
+  for (regi = 0; regi < 32; regi++)
+    {
+      COPY_REG (regmap[regi], regi);
+    }
+
+  for (regi = FIRST_UISA_SP_REGNUM; regi <= LAST_UISA_SP_REGNUM; regi++)
+    {
+      COPY_REG (regmap[regi], regi);
+    }
+}
+
+void
+supply_fpregset (gdb_fpregset_t * fpregsetp)
 {
   int regi;
   for (regi = 0; regi < 32; regi++)
@@ -79,3 +101,26 @@
       supply_register (FP0_REGNUM + regi, (char *) (*fpregsetp + regi));
     }
 }
+
+/*  Given a pointer to a floating point register set in /proc format
+   (fpregset_t *), update the register specified by REGNO from gdb's idea
+   of the current floating point register set.  If REGNO is -1, update
+   them all. */
+
+void
+fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
+{
+  int regi;
+  char *to;
+  char *from;
+  
+  for (regi = 0; regi < 32; regi++)
+    {
+      if ((regno == -1) || (regno == FP0_REGNUM + regi))
+        {
+	  from = (char *) &registers[REGISTER_BYTE (FP0_REGNUM + regi)];
+	  to = (char *) (*fpregsetp + regi);
+	  memcpy (to, from, REGISTER_RAW_SIZE (FP0_REGNUM + regi));
+        }
+    }
+}
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 50388fa..624d1d7 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -29,6 +29,8 @@
 #include "symfile.h"
 #include "objfiles.h"
 
+#include "ppc-tdep.h"
+
 /* The following two instructions are used in the signal trampoline
    code on linux/ppc */
 #define INSTR_LI_R0_0x7777	0x38007777
@@ -95,7 +97,7 @@
 #define PPC_LINUX_PT_FPR31 (PPC_LINUX_PT_FPR0 + 2*31)
 #define PPC_LINUX_PT_FPSCR (PPC_LINUX_PT_FPR0 + 2*32 + 1)
 
-int ppc_linux_at_sigtramp_return_path (CORE_ADDR pc);
+static int ppc_linux_at_sigtramp_return_path (CORE_ADDR pc);
 
 /* Determine if pc is in a signal trampoline...
 
@@ -150,7 +152,7 @@
   char buf[4];
   CORE_ADDR handler;
 
-  lr = read_register (LR_REGNUM);
+  lr = read_register (PPC_LR_REGNUM);
   if (!ppc_linux_at_sigtramp_return_path (lr))
     return 0;
 
@@ -177,7 +179,7 @@
  * instructions.  It'd be faster though if we could find a way to do this
  * via some simple address comparisons.
  */
-int
+static int
 ppc_linux_at_sigtramp_return_path (CORE_ADDR pc)
 {
   char buf[12];
@@ -308,7 +310,7 @@
 /* The rs6000 version of FRAME_SAVED_PC will almost work for us.  The
    signal handler details are different, so we'll handle those here
    and call the rs6000 version to do the rest. */
-unsigned long
+CORE_ADDR
 ppc_linux_frame_saved_pc (struct frame_info *fi)
 {
   if (fi->signal_handler_caller)
@@ -372,14 +374,14 @@
       regs_addr =
 	read_memory_integer (fi->frame + PPC_LINUX_REGS_PTR_OFFSET, 4);
       fi->saved_regs[PC_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_NIP;
-      fi->saved_regs[PS_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_MSR;
-      fi->saved_regs[CR_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_CCR;
-      fi->saved_regs[LR_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_LNK;
-      fi->saved_regs[CTR_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_CTR;
-      fi->saved_regs[XER_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_XER;
-      fi->saved_regs[MQ_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_MQ;
+      fi->saved_regs[PPC_PS_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_MSR;
+      fi->saved_regs[PPC_CR_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_CCR;
+      fi->saved_regs[PPC_LR_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_LNK;
+      fi->saved_regs[PPC_CTR_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_CTR;
+      fi->saved_regs[PPC_XER_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_XER;
+      fi->saved_regs[PPC_MQ_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_MQ;
       for (i = 0; i < 32; i++)
-	fi->saved_regs[GP0_REGNUM + i] = regs_addr + 4 * PPC_LINUX_PT_R0 + 4 * i;
+	fi->saved_regs[PPC_GP0_REGNUM + i] = regs_addr + 4 * PPC_LINUX_PT_R0 + 4 * i;
       for (i = 0; i < 32; i++)
 	fi->saved_regs[FP0_REGNUM + i] = regs_addr + 4 * PPC_LINUX_PT_FPR0 + 8 * i;
     }
@@ -419,12 +421,8 @@
    starting from r4. */
 
 CORE_ADDR
-ppc_sysv_abi_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     int struct_return;
-     CORE_ADDR struct_addr;
+ppc_sysv_abi_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+			     int struct_return, CORE_ADDR struct_addr)
 {
   int argno;
   int greg, freg;
diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h
new file mode 100644
index 0000000..c22ec13
--- /dev/null
+++ b/gdb/ppc-tdep.h
@@ -0,0 +1,49 @@
+/* Target-dependent code for GDB, the GNU debugger.
+   Copyright 2000
+   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.  */
+
+/* From ppc-linux-tdep.c... */
+CORE_ADDR ppc_linux_frame_saved_pc (struct frame_info *fi);
+void ppc_linux_init_extra_frame_info (int fromleaf, struct frame_info *);
+int ppc_linux_frameless_function_invocation (struct frame_info *);
+void ppc_linux_frame_init_saved_regs (struct frame_info *);
+CORE_ADDR ppc_linux_frame_chain (struct frame_info *);
+CORE_ADDR ppc_sysv_abi_push_arguments (int, value_ptr *, CORE_ADDR, int,
+				       CORE_ADDR);
+int ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache);
+
+
+/* From rs6000-tdep.c... */
+CORE_ADDR rs6000_frame_saved_pc (struct frame_info *fi);
+void rs6000_init_extra_frame_info (int fromleaf, struct frame_info *);
+int rs6000_frameless_function_invocation (struct frame_info *);
+void rs6000_frame_init_saved_regs (struct frame_info *);
+CORE_ADDR rs6000_frame_chain (struct frame_info *);
+
+/* Some important register numbers. */
+
+#define	PPC_GP0_REGNUM 0		/* GPR register 0 */
+#define	PPC_TOC_REGNUM 2		/* TOC register */
+#define PPC_PS_REGNUM 65		/* Processor (or machine) status (%msr) */
+#define	PPC_CR_REGNUM 66		/* Condition register */
+#define	PPC_LR_REGNUM 67		/* Link register */
+#define	PPC_CTR_REGNUM 68		/* Count register */
+#define	PPC_XER_REGNUM 69		/* Integer exception register */
+#define	PPC_MQ_REGNUM 70		/* Multiply/Divide extension register */
diff --git a/gdb/ppcbug-rom.c b/gdb/ppcbug-rom.c
index 123161a..16a7f9d 100644
--- a/gdb/ppcbug-rom.c
+++ b/gdb/ppcbug-rom.c
@@ -28,11 +28,7 @@
 #include "serial.h"
 
 static void
-ppcbug_supply_register (regname, regnamelen, val, vallen)
-     char *regname;
-     int regnamelen;
-     char *val;
-     int vallen;
+ppcbug_supply_register (char *regname, int regnamelen, char *val, int vallen)
 {
   int regno = 0;
 
@@ -104,7 +100,7 @@
  * registers either. So, typing "info reg sp" becomes an "A7".
  */
 
-static char *ppcbug_regnames[NUM_REGS] =
+static char *ppcbug_regnames[] =
 {
   "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
   "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
@@ -188,23 +184,19 @@
 static struct monitor_ops ppcbug_cmds1;
 
 static void
-ppcbug_open0 (args, from_tty)
-     char *args;
-     int from_tty;
+ppcbug_open0 (char *args, int from_tty)
 {
   monitor_open (args, &ppcbug_cmds0, from_tty);
 }
 
 static void
-ppcbug_open1 (args, from_tty)
-     char *args;
-     int from_tty;
+ppcbug_open1 (char *args, int from_tty)
 {
   monitor_open (args, &ppcbug_cmds1, from_tty);
 }
 
 void
-_initialize_ppcbug_rom ()
+_initialize_ppcbug_rom (void)
 {
   init_ppc_cmds ("lo 0\r", &ppcbug_cmds0, &ppcbug_ops0);
   init_ppc_cmds ("lo 1\r", &ppcbug_cmds1, &ppcbug_ops1);
diff --git a/gdb/ppcnbsd-nat.c b/gdb/ppcnbsd-nat.c
index b754fa7..044115b 100644
--- a/gdb/ppcnbsd-nat.c
+++ b/gdb/ppcnbsd-nat.c
@@ -26,6 +26,7 @@
 #include "defs.h"
 #include "inferior.h"
 #include "gdbcore.h"
+#include "ppc-tdep.h"
 
 #define RF(dst, src) \
         memcpy(&registers[REGISTER_BYTE(dst)], &src, sizeof(src))
@@ -34,68 +35,73 @@
         memcpy(&dst, &registers[REGISTER_BYTE(src)], sizeof(dst))
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   struct reg inferior_registers;
+#ifdef PT_GETFPREGS
   struct fpreg inferior_fp_registers;
+#endif
   int i;
 
   ptrace (PT_GETREGS, inferior_pid,
 	  (PTRACE_ARG3_TYPE) & inferior_registers, 0);
   for (i = 0; i < 32; i++)
     RF (i, inferior_registers.fixreg[i]);
-  RF (LR_REGNUM, inferior_registers.lr);
-  RF (CR_REGNUM, inferior_registers.cr);
-  RF (XER_REGNUM, inferior_registers.xer);
-  RF (CTR_REGNUM, inferior_registers.ctr);
+  RF (PPC_LR_REGNUM, inferior_registers.lr);
+  RF (PPC_CR_REGNUM, inferior_registers.cr);
+  RF (PPC_XER_REGNUM, inferior_registers.xer);
+  RF (PPC_CTR_REGNUM, inferior_registers.ctr);
   RF (PC_REGNUM, inferior_registers.pc);
 
+#ifdef PT_GETFPREGS
   ptrace (PT_GETFPREGS, inferior_pid,
-	  (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
+	  (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
   for (i = 0; i < 32; i++)
     RF (FP0_REGNUM + i, inferior_fp_registers.r_regs[i]);
+#endif
 
   registers_fetched ();
 }
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   struct reg inferior_registers;
+#ifdef PT_SETFPREGS
   struct fpreg inferior_fp_registers;
+#endif
   int i;
 
   for (i = 0; i < 32; i++)
     RS (i, inferior_registers.fixreg[i]);
-  RS (LR_REGNUM, inferior_registers.lr);
-  RS (CR_REGNUM, inferior_registers.cr);
-  RS (XER_REGNUM, inferior_registers.xer);
-  RS (CTR_REGNUM, inferior_registers.ctr);
+  RS (PPC_LR_REGNUM, inferior_registers.lr);
+  RS (PPC_CR_REGNUM, inferior_registers.cr);
+  RS (PPC_XER_REGNUM, inferior_registers.xer);
+  RS (PPC_CTR_REGNUM, inferior_registers.ctr);
   RS (PC_REGNUM, inferior_registers.pc);
 
   ptrace (PT_SETREGS, inferior_pid,
 	  (PTRACE_ARG3_TYPE) & inferior_registers, 0);
 
+#ifdef PT_SETFPREGS
   for (i = 0; i < 32; i++)
     RS (FP0_REGNUM + i, inferior_fp_registers.r_regs[i]);
   ptrace (PT_SETFPREGS, inferior_pid,
 	  (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
+#endif
 }
 
 struct md_core
 {
   struct reg intreg;
+#ifdef PT_GETFPREGS
   struct fpreg freg;
+#endif
 };
 
 void
-fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR ignore;
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
+		      CORE_ADDR ignore)
 {
   struct md_core *core_reg = (struct md_core *) core_reg_sect;
   int i;
@@ -103,15 +109,17 @@
   /* Integer registers */
   for (i = 0; i < 32; i++)
     RF (i, core_reg->intreg.fixreg[i]);
-  RF (LR_REGNUM, core_reg->intreg.lr);
-  RF (CR_REGNUM, core_reg->intreg.cr);
-  RF (XER_REGNUM, core_reg->intreg.xer);
-  RF (CTR_REGNUM, core_reg->intreg.ctr);
+  RF (PPC_LR_REGNUM, core_reg->intreg.lr);
+  RF (PPC_CR_REGNUM, core_reg->intreg.cr);
+  RF (PPC_XER_REGNUM, core_reg->intreg.xer);
+  RF (PPC_CTR_REGNUM, core_reg->intreg.ctr);
   RF (PC_REGNUM, core_reg->intreg.pc);
 
+#ifdef PT_FPGETREGS
   /* Floating point registers */
   for (i = 0; i < 32; i++)
     RF (FP0_REGNUM + i, core_reg->freg.r_regs[i]);
+#endif
 
   registers_fetched ();
 }
@@ -129,7 +137,7 @@
 };
 
 void
-_initialize_ppcnbsd_nat ()
+_initialize_ppcnbsd_nat (void)
 {
   add_core_fns (&ppcnbsd_core_fns);
 }
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index dcc3329..c57bf82 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1,5 +1,7 @@
 /* Print values for GNU debugger GDB.
-   Copyright 1986-1991, 1993-1995, 1998, 2000 Free Software Foundation, Inc.
+
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993, 1994, 1995,
+   1998, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -189,10 +191,7 @@
    past the specification and past all whitespace following it.  */
 
 static struct format_data
-decode_format (string_ptr, oformat, osize)
-     char **string_ptr;
-     int oformat;
-     int osize;
+decode_format (char **string_ptr, int oformat, int osize)
 {
   struct format_data val;
   register char *p = *string_ptr;
@@ -280,11 +279,8 @@
    This is used to pad hex numbers so they line up.  */
 
 static void
-print_formatted (val, format, size, stream)
-     register value_ptr val;
-     register int format;
-     int size;
-     struct ui_file *stream;
+print_formatted (register value_ptr val, register int format, int size,
+		 struct ui_file *stream)
 {
   struct type *type = check_typedef (VALUE_TYPE (val));
   int len = TYPE_LENGTH (type);
@@ -347,12 +343,8 @@
    with a format.  */
 
 void
-print_scalar_formatted (valaddr, type, format, size, stream)
-     char *valaddr;
-     struct type *type;
-     int format;
-     int size;
-     struct ui_file *stream;
+print_scalar_formatted (char *valaddr, struct type *type, int format, int size,
+			struct ui_file *stream)
 {
   LONGEST val_long;
   unsigned int len = TYPE_LENGTH (type);
@@ -445,14 +437,7 @@
 
     case 'a':
       {
-	/* Truncate address to the size of a target pointer, avoiding
-	   shifts larger or equal than the width of a CORE_ADDR.  The
-	   local variable PTR_BIT stops the compiler reporting a shift
-	   overflow when it won't occure. */
 	CORE_ADDR addr = unpack_pointer (type, valaddr);
-	int ptr_bit = TARGET_PTR_BIT;
-	if (ptr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
-	  addr &= ((CORE_ADDR) 1 << ptr_bit) - 1;
 	print_address (addr, stream);
       }
       break;
@@ -531,8 +516,7 @@
    `info lines' uses this.  */
 
 void
-set_next_address (addr)
-     CORE_ADDR addr;
+set_next_address (CORE_ADDR addr)
 {
   next_address = addr;
 
@@ -551,11 +535,8 @@
    settings of the demangle and asm_demangle variables.  */
 
 void
-print_address_symbolic (addr, stream, do_demangle, leadin)
-     CORE_ADDR addr;
-     struct ui_file *stream;
-     int do_demangle;
-     char *leadin;
+print_address_symbolic (CORE_ADDR addr, struct ui_file *stream, int do_demangle,
+			char *leadin)
 {
   char *name = NULL;
   char *filename = NULL;
@@ -735,13 +716,19 @@
 /* Print address ADDR on STREAM.  USE_LOCAL means the same thing as for
    print_longest.  */
 void
-print_address_numeric (addr, use_local, stream)
-     CORE_ADDR addr;
-     int use_local;
-     struct ui_file *stream;
+print_address_numeric (CORE_ADDR addr, int use_local, struct ui_file *stream)
 {
-  /* This assumes a CORE_ADDR can fit in a LONGEST.  Probably a safe
-     assumption.  */
+  /* Truncate address to the size of a target pointer, avoiding shifts
+     larger or equal than the width of a CORE_ADDR.  The local
+     variable PTR_BIT stops the compiler reporting a shift overflow
+     when it won't occure. */
+  /* NOTE: This assumes that the significant address information is
+     kept in the least significant bits of ADDR - the upper bits were
+     either zero or sign extended.  Should ADDRESS_TO_POINTER() or
+     some ADDRESS_TO_PRINTABLE() be used to do the conversion?  */
+  int addr_bit = TARGET_ADDR_BIT;
+  if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
+    addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
   print_longest (stream, 'x', use_local, (ULONGEST) addr);
 }
 
@@ -750,9 +737,7 @@
    <SYMBOL + OFFSET> after the number.  */
 
 void
-print_address (addr, stream)
-     CORE_ADDR addr;
-     struct ui_file *stream;
+print_address (CORE_ADDR addr, struct ui_file *stream)
 {
   print_address_numeric (addr, 1, stream);
   print_address_symbolic (addr, stream, asm_demangle, " ");
@@ -764,10 +749,7 @@
    or not.  */
 
 void
-print_address_demangle (addr, stream, do_demangle)
-     CORE_ADDR addr;
-     struct ui_file *stream;
-     int do_demangle;
+print_address_demangle (CORE_ADDR addr, struct ui_file *stream, int do_demangle)
 {
   if (addr == 0)
     {
@@ -799,10 +781,7 @@
    Fetch it from memory and print on gdb_stdout.  */
 
 static void
-do_examine (fmt, addr, sect)
-     struct format_data fmt;
-     CORE_ADDR addr;
-     asection *sect;
+do_examine (struct format_data fmt, CORE_ADDR addr, asection *sect)
 {
   register char format = 0;
   register char size;
@@ -883,9 +862,7 @@
 }
 
 static void
-validate_format (fmt, cmdname)
-     struct format_data fmt;
-     char *cmdname;
+validate_format (struct format_data fmt, char *cmdname)
 {
   if (fmt.size != 0)
     error ("Size letters are meaningless in \"%s\" command.", cmdname);
@@ -903,10 +880,7 @@
  */
 
 static void
-print_command_1 (exp, inspect, voidprint)
-     char *exp;
-     int inspect;
-     int voidprint;
+print_command_1 (char *exp, int inspect, int voidprint)
 {
   struct expression *expr;
   register struct cleanup *old_chain = 0;
@@ -999,9 +973,7 @@
 
 /* ARGSUSED */
 static void
-print_command (exp, from_tty)
-     char *exp;
-     int from_tty;
+print_command (char *exp, int from_tty)
 {
   print_command_1 (exp, 0, 1);
 }
@@ -1009,9 +981,7 @@
 /* Same as print, except in epoch, it gets its own window */
 /* ARGSUSED */
 static void
-inspect_command (exp, from_tty)
-     char *exp;
-     int from_tty;
+inspect_command (char *exp, int from_tty)
 {
   extern int epoch_interface;
 
@@ -1021,18 +991,14 @@
 /* Same as print, except it doesn't print void results. */
 /* ARGSUSED */
 static void
-call_command (exp, from_tty)
-     char *exp;
-     int from_tty;
+call_command (char *exp, int from_tty)
 {
   print_command_1 (exp, 0, 0);
 }
 
 /* ARGSUSED */
 void
-output_command (exp, from_tty)
-     char *exp;
-     int from_tty;
+output_command (char *exp, int from_tty)
 {
   struct expression *expr;
   register struct cleanup *old_chain;
@@ -1067,9 +1033,7 @@
 
 /* ARGSUSED */
 static void
-set_command (exp, from_tty)
-     char *exp;
-     int from_tty;
+set_command (char *exp, int from_tty)
 {
   struct expression *expr = parse_expression (exp);
   register struct cleanup *old_chain =
@@ -1080,9 +1044,7 @@
 
 /* ARGSUSED */
 static void
-sym_info (arg, from_tty)
-     char *arg;
-     int from_tty;
+sym_info (char *arg, int from_tty)
 {
   struct minimal_symbol *msymbol;
   struct objfile *objfile;
@@ -1127,9 +1089,7 @@
 
 /* ARGSUSED */
 static void
-address_info (exp, from_tty)
-     char *exp;
-     int from_tty;
+address_info (char *exp, int from_tty)
 {
   register struct symbol *sym;
   register struct minimal_symbol *msymbol;
@@ -1341,9 +1301,7 @@
 }
 
 void
-x_command (exp, from_tty)
-     char *exp;
-     int from_tty;
+x_command (char *exp, int from_tty)
 {
   struct expression *expr;
   struct format_data fmt;
@@ -1420,9 +1378,7 @@
    Specify the expression.  */
 
 static void
-display_command (exp, from_tty)
-     char *exp;
-     int from_tty;
+display_command (char *exp, int from_tty)
 {
   struct format_data fmt;
   register struct expression *expr;
@@ -1480,11 +1436,10 @@
 }
 
 static void
-free_display (d)
-     struct display *d;
+free_display (struct display *d)
 {
-  free ((PTR) d->exp);
-  free ((PTR) d);
+  xfree (d->exp);
+  xfree (d);
 }
 
 /* Clear out the display_chain.
@@ -1492,23 +1447,22 @@
    the types stored in many expressions.  */
 
 void
-clear_displays ()
+clear_displays (void)
 {
   register struct display *d;
 
   while ((d = display_chain) != NULL)
     {
-      free ((PTR) d->exp);
+      xfree (d->exp);
       display_chain = d->next;
-      free ((PTR) d);
+      xfree (d);
     }
 }
 
 /* Delete the auto-display number NUM.  */
 
 static void
-delete_display (num)
-     int num;
+delete_display (int num)
 {
   register struct display *d1, *d;
 
@@ -1540,9 +1494,7 @@
    Specify the element numbers.  */
 
 static void
-undisplay_command (args, from_tty)
-     char *args;
-     int from_tty;
+undisplay_command (char *args, int from_tty)
 {
   register char *p = args;
   register char *p1;
@@ -1580,8 +1532,7 @@
    or if the display is disabled. */
 
 static void
-do_one_display (d)
-     struct display *d;
+do_one_display (struct display *d)
 {
   int within_current_scope;
 
@@ -1666,7 +1617,7 @@
    evaluated in the current scope.  */
 
 void
-do_displays ()
+do_displays (void)
 {
   register struct display *d;
 
@@ -1678,8 +1629,7 @@
    This is done when there is an error or a signal.  */
 
 void
-disable_display (num)
-     int num;
+disable_display (int num)
 {
   register struct display *d;
 
@@ -1693,7 +1643,7 @@
 }
 
 void
-disable_current_display ()
+disable_current_display (void)
 {
   if (current_display_number >= 0)
     {
@@ -1705,9 +1655,7 @@
 }
 
 static void
-display_info (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+display_info (char *ignore, int from_tty)
 {
   register struct display *d;
 
@@ -1734,9 +1682,7 @@
 }
 
 static void
-enable_display (args, from_tty)
-     char *args;
-     int from_tty;
+enable_display (char *args, int from_tty)
 {
   register char *p = args;
   register char *p1;
@@ -1775,9 +1721,7 @@
 
 /* ARGSUSED */
 static void
-disable_display_command (args, from_tty)
-     char *args;
-     int from_tty;
+disable_display_command (char *args, int from_tty)
 {
   register char *p = args;
   register char *p1;
@@ -1810,10 +1754,8 @@
    specified by a struct symbol.  */
 
 void
-print_variable_value (var, frame, stream)
-     struct symbol *var;
-     struct frame_info *frame;
-     struct ui_file *stream;
+print_variable_value (struct symbol *var, struct frame_info *frame,
+		      struct ui_file *stream)
 {
   value_ptr val = read_var_value (var, frame);
 
@@ -1829,11 +1771,8 @@
    according to the stack frame".  At least for VAX, i386, isi.  */
 
 void
-print_frame_args (func, fi, num, stream)
-     struct symbol *func;
-     struct frame_info *fi;
-     int num;
-     struct ui_file *stream;
+print_frame_args (struct symbol *func, struct frame_info *fi, int num,
+		  struct ui_file *stream)
 {
   struct block *b = NULL;
   int nsyms = 0;
@@ -2051,12 +1990,8 @@
    the first nameless arg).  */
 
 static void
-print_frame_nameless_args (fi, start, num, first, stream)
-     struct frame_info *fi;
-     long start;
-     int num;
-     int first;
-     struct ui_file *stream;
+print_frame_nameless_args (struct frame_info *fi, long start, int num,
+			   int first, struct ui_file *stream)
 {
   int i;
   CORE_ADDR argsaddr;
@@ -2094,9 +2029,7 @@
 
 /* ARGSUSED */
 static void
-printf_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+printf_command (char *arg, int from_tty)
 {
   register char *f = NULL;
   register char *s = arg;
@@ -2327,7 +2260,8 @@
 
 	      /* Copy the string contents into a string inside GDB.  */
 	      str = (char *) alloca (j + 1);
-	      read_memory (tem, str, j);
+	      if (j != 0)
+		read_memory (tem, str, j);
 	      str[j] = 0;
 
 	      printf_filtered (current_substring, str);
@@ -2377,9 +2311,7 @@
 
 /* ARGSUSED */
 static void
-disassemble_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+disassemble_command (char *arg, int from_tty)
 {
   CORE_ADDR low, high;
   char *name;
@@ -2502,9 +2434,7 @@
    on STREAM.  Returns length of the instruction, in bytes.  */
 
 static int
-print_insn (memaddr, stream)
-     CORE_ADDR memaddr;
-     struct ui_file *stream;
+print_insn (CORE_ADDR memaddr, struct ui_file *stream)
 {
   if (TARGET_BYTE_ORDER == BIG_ENDIAN)
     TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_BIG;
@@ -2520,7 +2450,7 @@
 
 
 void
-_initialize_printcmd ()
+_initialize_printcmd (void)
 {
   current_display_number = -1;
 
diff --git a/gdb/proc-api.c b/gdb/proc-api.c
index cf12d42..8a28b00 100644
--- a/gdb/proc-api.c
+++ b/gdb/proc-api.c
@@ -69,10 +69,7 @@
 }
 
 static void
-set_procfs_trace_cmd (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+set_procfs_trace_cmd (char *args, int from_tty, struct cmd_list_element *c)
 {
 #if 0	/* not sure what I might actually need to do here, if anything */
   if (procfs_file)
@@ -81,10 +78,7 @@
 }
 
 static void
-set_procfs_file_cmd (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+set_procfs_file_cmd (char *args, int from_tty, struct cmd_list_element *c)
 {
   /* Just changed the filename for procfs tracing.
      If a file was already open, close it.  */
@@ -223,12 +217,7 @@
 };
 
 int
-ioctl_with_trace (fd, opcode, ptr, file, line)
-     int  fd;
-     long opcode;
-     void *ptr;
-     char *file;
-     int  line;
+ioctl_with_trace (int fd, long opcode, void *ptr, char *file, int line)
 {
   int i, ret, arg1;
 
@@ -453,12 +442,7 @@
 static off_t lseek_offset;
 
 int
-write_with_trace (fd, varg, len, file, line)
-     int  fd;
-     void *varg;
-     size_t len;
-     char *file;
-     int  line;
+write_with_trace (int fd, void *varg, size_t len, char *file, int line)
 {
   int  i;
   int ret;
@@ -614,12 +598,7 @@
 }
 
 off_t
-lseek_with_trace (fd, offset, whence, file, line)
-     int fd;
-     off_t offset;
-     int whence;
-     char *file;
-     int line;
+lseek_with_trace (int fd, off_t offset, int whence, char *file, int line)
 {
   off_t ret;
 
@@ -642,11 +621,7 @@
 #endif /* NEW_PROC_API */
 
 int
-open_with_trace (filename, mode, file, line)
-     char *filename;
-     int   mode;
-     char *file;
-     int   line;
+open_with_trace (char *filename, int mode, char *file, int line)
 {
   int ret;
 
@@ -687,10 +662,7 @@
 }
 
 int
-close_with_trace (fd, file, line)
-     int   fd;
-     char *file;
-     int   line;
+close_with_trace (int fd, char *file, int line)
 {
   int ret;
 
@@ -716,10 +688,7 @@
 }
 
 pid_t
-wait_with_trace (wstat, file, line)
-     int  *wstat;
-     char *file;
-     int   line;
+wait_with_trace (int *wstat, char *file, int line)
 {
   int ret, lstat = 0;
 
@@ -754,10 +723,7 @@
 }
 
 void
-procfs_note (msg, file, line)
-     char *msg;
-     char *file;
-     int   line;
+procfs_note (char *msg, char *file, int line)
 {
   prepare_to_trace ();
   if (procfs_trace)
@@ -772,11 +738,7 @@
 }
 
 void
-proc_prettyfprint_status (flags, why, what, thread)
-     long flags;
-     int  why;
-     int  what;
-     int  thread;
+proc_prettyfprint_status (long flags, int why, int what, int thread)
 {
   prepare_to_trace ();
   if (procfs_trace)
@@ -798,7 +760,7 @@
 
 
 void
-_initialize_proc_api ()
+_initialize_proc_api (void)
 {
   struct cmd_list_element *c;
 
diff --git a/gdb/proc-events.c b/gdb/proc-events.c
index 8af9671..c9b221d 100644
--- a/gdb/proc-events.c
+++ b/gdb/proc-events.c
@@ -1396,10 +1396,7 @@
  */
 
 void
-proc_prettyfprint_syscall (file, num, verbose)
-     FILE *file;
-     int  num;
-     int  verbose;
+proc_prettyfprint_syscall (FILE *file, int num, int verbose)
 {
   if (syscall_table[num])
     fprintf (file, "SYS_%s ", syscall_table[num]);
@@ -1408,9 +1405,7 @@
 }
 
 void
-proc_prettyprint_syscall (num, verbose)
-     int num;
-     int verbose;
+proc_prettyprint_syscall (int num, int verbose)
 {
   proc_prettyfprint_syscall (stdout, num, verbose);
 }
@@ -1420,10 +1415,7 @@
  */
 
 void
-proc_prettyfprint_syscalls (file, sysset, verbose)
-     FILE     *file;
-     sysset_t *sysset;
-     int      verbose;
+proc_prettyfprint_syscalls (FILE *file, sysset_t *sysset, int verbose)
 {
   int i;
 
@@ -1436,9 +1428,7 @@
 }
 
 void
-proc_prettyprint_syscalls (sysset, verbose)
-     sysset_t *sysset;
-     int      verbose;
+proc_prettyprint_syscalls (sysset_t *sysset, int verbose)
 {
   proc_prettyfprint_syscalls (stdout, sysset, verbose);
 }
@@ -1595,10 +1585,7 @@
  */
 
 void
-proc_prettyfprint_signal (file, signo, verbose)
-     FILE *file;
-     int  signo;
-     int verbose;
+proc_prettyfprint_signal (FILE *file, int signo, int verbose)
 {
   int i;
 
@@ -1616,9 +1603,7 @@
 }
 
 void
-proc_prettyprint_signal (signo, verbose)
-     int signo;
-     int verbose;
+proc_prettyprint_signal (int signo, int verbose)
 {
   proc_prettyfprint_signal (stdout, signo, verbose);
 }
@@ -1635,10 +1620,7 @@
  */
 
 void
-proc_prettyfprint_signalset (file, sigset, verbose)
-     FILE     *file;
-     sigset_t *sigset;
-     int      verbose;
+proc_prettyfprint_signalset (FILE *file, sigset_t *sigset, int verbose)
 {
   int i;
 
@@ -1651,9 +1633,7 @@
 }
 
 void
-proc_prettyprint_signalset (sigset, verbose)
-     sigset_t *sigset;
-     int      verbose;
+proc_prettyprint_signalset (sigset_t *sigset, int verbose)
 {
   proc_prettyfprint_signalset (stdout, sigset, verbose);
 }
@@ -1714,10 +1694,7 @@
  */
 
 static void
-prettyfprint_faulttable_entry (file, i, verbose)
-     FILE *file;
-     int   i;
-     int   verbose;
+prettyfprint_faulttable_entry (FILE *file, int i, int verbose)
 {
   fprintf (file, "%s", fault_table[i].name);
   if (verbose)
@@ -1731,10 +1708,7 @@
  */
 
 void
-proc_prettyfprint_fault (file, faultno, verbose)
-     FILE *file;
-     int  faultno;
-     int  verbose;
+proc_prettyfprint_fault (FILE *file, int faultno, int verbose)
 {
   int i;
 
@@ -1750,9 +1724,7 @@
 }
 
 void
-proc_prettyprint_fault (faultno, verbose)
-     int  faultno;
-     int  verbose;
+proc_prettyprint_fault (int faultno, int verbose)
 {
   proc_prettyfprint_fault (stdout, faultno, verbose);
 }
@@ -1767,10 +1739,7 @@
  */
 
 void
-proc_prettyfprint_faultset (file, fltset, verbose)
-     FILE     *file;
-     fltset_t *fltset;
-     int      verbose;
+proc_prettyfprint_faultset (FILE *file, fltset_t *fltset, int verbose)
 {
   int i;
 
@@ -1783,9 +1752,7 @@
 }
 
 void
-proc_prettyprint_faultset (fltset, verbose)
-     fltset_t *fltset;
-     int      verbose;
+proc_prettyprint_faultset (fltset_t *fltset, int verbose)
 {
   proc_prettyfprint_faultset (stdout, fltset, verbose);
 }
@@ -1800,7 +1767,7 @@
 }
 
 void
-_initialize_proc_events ()
+_initialize_proc_events (void)
 {
   init_syscall_table ();
 }
diff --git a/gdb/proc-flags.c b/gdb/proc-flags.c
index d2957be..aafd27e 100644
--- a/gdb/proc-flags.c
+++ b/gdb/proc-flags.c
@@ -269,10 +269,7 @@
 };
 
 void
-proc_prettyfprint_flags (file, flags, verbose)
-     FILE         *file;
-     unsigned long flags;
-     int           verbose;
+proc_prettyfprint_flags (FILE *file, unsigned long flags, int verbose)
 {
   int i;
 
@@ -288,9 +285,7 @@
 }
 
 void
-proc_prettyprint_flags (flags, verbose)
-     unsigned long flags;
-     int           verbose;
+proc_prettyprint_flags (unsigned long flags, int verbose)
 {
   proc_prettyfprint_flags (stdout, flags, verbose);
 }
diff --git a/gdb/proc-service.c b/gdb/proc-service.c
new file mode 100644
index 0000000..3cebc63
--- /dev/null
+++ b/gdb/proc-service.c
@@ -0,0 +1,333 @@
+/* <proc_service.h> implementation.
+   Copyright 1999, 2000 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_proc_service.h"
+#include <sys/procfs.h>
+
+#include "inferior.h"
+#include "symtab.h"
+#include "target.h"
+
+/* Prototypes for supply_gregset etc.  */
+#include "gregset.h"
+
+
+/* Fix-up some broken systems.  */
+
+/* The prototypes in <proc_service.h> are slightly different on older
+   systems.  Compensate for the discrepancies.  */
+
+#ifdef PROC_SERVICE_IS_OLD
+typedef const struct ps_prochandle *gdb_ps_prochandle_t;
+typedef char *gdb_ps_read_buf_t;
+typedef char *gdb_ps_write_buf_t;
+typedef int gdb_ps_size_t;
+#else
+typedef struct ps_prochandle *gdb_ps_prochandle_t;
+typedef void *gdb_ps_read_buf_t;
+typedef const void *gdb_ps_write_buf_t;
+typedef size_t gdb_ps_size_t;
+#endif
+
+
+/* Building process ids.  */
+
+#ifndef MERGEPID
+#define MERGEPID(PID, TID)	(((PID) & 0xffff) | ((TID) << 16))
+#endif
+
+#define BUILD_LWP(tid, pid)	MERGEPID (pid, tid)
+
+
+/* Helper functions.  */
+
+static void
+restore_inferior_pid (void *arg)
+{
+  int *saved_pid_ptr = arg;
+  inferior_pid = *saved_pid_ptr;
+  xfree (arg);
+}
+
+static struct cleanup *
+save_inferior_pid (void)
+{
+  int *saved_pid_ptr;
+
+  saved_pid_ptr = xmalloc (sizeof (int));
+  *saved_pid_ptr = inferior_pid;
+  return make_cleanup (restore_inferior_pid, saved_pid_ptr);
+}
+
+/* Transfer LEN bytes of memory between BUF and address ADDR in the
+   process specified by PH.  If WRITE, transfer them to the process,
+   else transfer them from the process.  Returns PS_OK for success,
+   PS_ERR on failure.
+
+   This is a helper function for ps_pdread, ps_pdwrite, ps_ptread and
+   ps_ptwrite.  */
+
+static ps_err_e
+ps_xfer_memory (const struct ps_prochandle *ph, paddr_t addr,
+		char *buf, size_t len, int write)
+{
+  struct cleanup *old_chain = save_inferior_pid ();
+  int ret;
+
+  inferior_pid = ph->pid;
+
+  if (write)
+    ret = target_write_memory (addr, buf, len);
+  else
+    ret = target_read_memory (addr, buf, len);
+
+  do_cleanups (old_chain);
+
+  return (ret == 0 ? PS_OK : PS_ERR);
+}
+
+
+/* Stop the target process PH.  */
+
+ps_err_e
+ps_pstop (gdb_ps_prochandle_t ph)
+{
+  /* The process is always stopped when under control of GDB.  */
+  return PS_OK;
+}
+
+/* Resume the target process PH.  */
+
+ps_err_e
+ps_pcontinue (gdb_ps_prochandle_t ph)
+{
+  /* Pretend we did successfully continue the process.  GDB will take
+     care of it later on.  */
+  return PS_OK;
+}
+
+/* Stop the lightweight process LWPID within the target process PH.  */
+
+ps_err_e
+ps_lstop (gdb_ps_prochandle_t ph, lwpid_t lwpid)
+{
+  /* All lightweight processes are stopped when under control of GDB.  */
+  return PS_OK;
+}
+
+/* Resume the lightweight process (LWP) LWPID within the target
+   process PH.  */
+
+ps_err_e
+ps_lcontinue (gdb_ps_prochandle_t ph, lwpid_t lwpid)
+{
+  /* Pretend we did successfully continue LWPID.  GDB will take care
+     of it later on.  */
+  return PS_OK;
+}
+
+/* Get the size of the architecture-dependent extra state registers
+   for LWP LWPID within the target process PH and return it in
+   *XREGSIZE.  */
+
+ps_err_e
+ps_lgetxregsize (gdb_ps_prochandle_t ph, lwpid_t lwpid, int *xregsize)
+{
+  /* FIXME: Not supported yet.  */
+  return PS_OK;
+}
+
+/* Get the extra state registers of LWP LWPID within the target
+   process PH and store them in XREGSET.  */
+
+ps_err_e
+ps_lgetxregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, caddr_t xregset)
+{
+  /* FIXME: Not supported yet.  */
+  return PS_OK;
+}
+
+/* Set the extra state registers of LWP LWPID within the target
+   process PH from XREGSET.  */
+
+ps_err_e
+ps_lsetxregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, caddr_t xregset)
+{
+  /* FIXME: Not supported yet.  */
+  return PS_OK;
+}
+
+/* Log (additional) diognostic information.  */
+
+void
+ps_plog (const char *fmt, ...)
+{
+  va_list args;
+
+  va_start (args, fmt);
+  vfprintf_filtered (gdb_stderr, fmt, args);
+}
+
+/* Search for the symbol named NAME within the object named OBJ within
+   the target process PH.  If the symbol is found the address of the
+   symbol is stored in SYM_ADDR.  */
+
+ps_err_e
+ps_pglobal_lookup (gdb_ps_prochandle_t ph, const char *obj,
+		   const char *name, paddr_t *sym_addr)
+{
+  struct minimal_symbol *ms;
+
+  /* FIXME: kettenis/2000-09-03: What should we do with OBJ?  */
+  ms = lookup_minimal_symbol (name, NULL, NULL);
+  if (ms == NULL)
+    return PS_NOSYM;
+
+  *sym_addr = SYMBOL_VALUE_ADDRESS (ms);
+  return PS_OK;
+}
+
+/* Read SIZE bytes from the target process PH at address ADDR and copy
+   them into BUF.  */
+
+ps_err_e
+ps_pdread (gdb_ps_prochandle_t ph, paddr_t addr,
+	   gdb_ps_read_buf_t buf, gdb_ps_size_t size)
+{
+  return ps_xfer_memory (ph, addr, buf, size, 0);
+}
+
+/* Write SIZE bytes from BUF into the target process PH at address ADDR.  */
+
+ps_err_e
+ps_pdwrite (gdb_ps_prochandle_t ph, paddr_t addr,
+	    gdb_ps_write_buf_t buf, gdb_ps_size_t size)
+{
+  return ps_xfer_memory (ph, addr, (char *) buf, size, 1);
+}
+
+/* Read SIZE bytes from the target process PH at address ADDR and copy
+   them into BUF.  */
+
+ps_err_e
+ps_ptread (gdb_ps_prochandle_t ph, paddr_t addr,
+	   gdb_ps_read_buf_t buf, gdb_ps_size_t size)
+{
+  return ps_xfer_memory (ph, addr, buf, size, 0);
+}
+
+/* Write SIZE bytes from BUF into the target process PH at address ADDR.  */
+
+ps_err_e
+ps_ptwrite (gdb_ps_prochandle_t ph, paddr_t addr,
+	    gdb_ps_write_buf_t buf, gdb_ps_size_t size)
+{
+  return ps_xfer_memory (ph, addr, (char *) buf, size, 1);
+}
+
+/* Get the general registers of LWP LWPID within the target process PH
+   and store them in GREGSET.  */
+
+ps_err_e
+ps_lgetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prgregset_t gregset)
+{
+  struct cleanup *old_chain = save_inferior_pid ();
+
+  inferior_pid = BUILD_LWP (lwpid, ph->pid);
+
+  target_fetch_registers (-1);
+  fill_gregset ((gdb_gregset_t *) gregset, -1);
+
+  do_cleanups (old_chain);
+  return PS_OK;
+}
+
+/* Set the general registers of LWP LWPID within the target process PH
+   from GREGSET.  */
+
+ps_err_e
+ps_lsetregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const prgregset_t gregset)
+{
+  struct cleanup *old_chain = save_inferior_pid ();
+
+  inferior_pid = BUILD_LWP (lwpid, ph->pid);
+
+  /* FIXME: We should really make supply_gregset const-correct.  */
+  supply_gregset ((gdb_gregset_t *) gregset);
+  target_store_registers (-1);
+
+  do_cleanups (old_chain);
+  return PS_OK;
+}
+
+/* Get the floating-point registers of LWP LWPID within the target
+   process PH and store them in FPREGSET.  */
+
+ps_err_e
+ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
+	       gdb_prfpregset_t *fpregset)
+{
+  struct cleanup *old_chain = save_inferior_pid ();
+
+  inferior_pid = BUILD_LWP (lwpid, ph->pid);
+
+  target_fetch_registers (-1);
+  fill_fpregset ((gdb_fpregset_t *) fpregset, -1);
+
+  do_cleanups (old_chain);
+  return PS_OK;
+}
+
+/* Set the floating-point registers of LWP LWPID within the target
+   process PH from FPREGSET.  */
+
+ps_err_e
+ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
+	       const gdb_prfpregset_t *fpregset)
+{
+  struct cleanup *old_chain = save_inferior_pid ();
+
+  inferior_pid = BUILD_LWP (lwpid, ph->pid);
+
+  /* FIXME: We should really make supply_fpregset const-correct.  */
+  supply_fpregset ((gdb_fpregset_t *) fpregset);
+  target_store_registers (-1);
+
+  do_cleanups (old_chain);
+  return PS_OK;
+}
+
+/* Return overall process id of the target PH.
+   Special for Linux -- not used on Solaris.  */
+
+pid_t
+ps_getpid (gdb_ps_prochandle_t ph)
+{
+  return ph->pid;
+}
+
+void
+_initialize_proc_service (void)
+{
+  /* This function solely exists to make sure this module is linked
+     into the final binary.  */
+}
diff --git a/gdb/proc-why.c b/gdb/proc-why.c
index 958eeb4..0c8eefd 100644
--- a/gdb/proc-why.c
+++ b/gdb/proc-why.c
@@ -105,11 +105,8 @@
 };
 
 void
-proc_prettyfprint_why (file, why, what, verbose)
-     FILE         *file;
-     unsigned long why; 
-     unsigned long what; 
-     int           verbose;
+proc_prettyfprint_why (FILE *file, unsigned long why, unsigned long what,
+		       int verbose)
 {
   int i;
 
@@ -172,10 +169,7 @@
 }
 
 void
-proc_prettyprint_why (why, what, verbose)
-     unsigned long why; 
-     unsigned long what; 
-     int           verbose;
+proc_prettyprint_why (unsigned long why, unsigned long what, int verbose)
 {
   proc_prettyfprint_why (stdout, why, what, verbose);
 }
diff --git a/gdb/procfs.c b/gdb/procfs.c
index b127c5f..10f2eb9 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -98,7 +98,7 @@
  * This module defines the GDB target vector and its methods.
  */
 
-static void procfs_open              PARAMS((char *, int));
+static void procfs_open (char *, int);
 static void procfs_attach (char *, int);
 static void procfs_detach (char *, int);
 static void procfs_resume (int, int, enum target_signal);
@@ -124,7 +124,7 @@
 struct target_ops procfs_ops;		/* the target vector */
 
 static void
-init_procfs_ops ()
+init_procfs_ops (void)
 {
   procfs_ops.to_shortname          = "procfs";
   procfs_ops.to_longname           = "Unix /proc child process";
@@ -328,9 +328,7 @@
  */
 
 static procinfo * 
-find_procinfo (pid, tid)
-     int pid;
-     int tid;
+find_procinfo (int pid, int tid)
 {
   procinfo *pi;
 
@@ -363,9 +361,7 @@
  */
 
 static procinfo *
-find_procinfo_or_die (pid, tid)
-     int pid;
-     int tid;
+find_procinfo_or_die (int pid, int tid)
 {
   procinfo *pi = find_procinfo (pid, tid);
 
@@ -396,9 +392,7 @@
 enum { FD_CTL, FD_STATUS, FD_AS };
 
 static int
-open_procinfo_files (pi, which)
-     procinfo *pi;
-     int       which;
+open_procinfo_files (procinfo *pi, int which)
 {
 #ifdef NEW_PROC_API
   char tmp[MAX_PROC_NAME_SIZE];
@@ -553,9 +547,7 @@
  */
 
 static procinfo *
-create_procinfo (pid, tid)
-     int pid;
-     int tid;
+create_procinfo (int pid, int tid)
 {
   procinfo *pi, *parent;
 
@@ -600,8 +592,7 @@
  */
 
 static void
-close_procinfo_files (pi)
-     procinfo *pi;
+close_procinfo_files (procinfo *pi)
 {
   if (pi->ctl_fd > 0)
     close (pi->ctl_fd);
@@ -621,9 +612,7 @@
  */
 
 static void
-destroy_one_procinfo (list, pi)
-     procinfo **list;
-     procinfo  *pi;
+destroy_one_procinfo (procinfo **list, procinfo *pi)
 {
   procinfo *ptr;
 
@@ -642,12 +631,11 @@
   close_procinfo_files (pi);
 
   /* Step three: free the memory. */
-  free (pi);
+  xfree (pi);
 }
 
 static void
-destroy_procinfo (pi)
-     procinfo *pi;
+destroy_procinfo (procinfo *pi)
 {
   procinfo *tmp;
 
@@ -683,10 +671,7 @@
  */
 
 static void
-dead_procinfo (pi, msg, kill_p)
-     procinfo *pi;
-     char     *msg;
-     int       kill_p;
+dead_procinfo (procinfo *pi, char *msg, int kill_p)
 {
   char procfile[80];
 
@@ -754,9 +739,8 @@
 
 int proc_update_threads (procinfo * pi);
 int proc_iterate_over_threads (procinfo * pi,
-			       int (*func) PARAMS ((procinfo *,
-						    procinfo *,
-						    void *)), void *ptr);
+			       int (*func) (procinfo *, procinfo *, void *),
+			       void *ptr);
 
 gdb_gregset_t *proc_get_gregs (procinfo * pi);
 gdb_fpregset_t *proc_get_fpregs (procinfo * pi);
@@ -773,20 +757,14 @@
 void proc_error (procinfo * pi, char *func, int line);
 
 void
-proc_warn (pi, func, line)
-     procinfo *pi;
-     char     *func;
-     int      line;
+proc_warn (procinfo *pi, char *func, int line)
 {
   sprintf (errmsg, "procfs: %s line %d, %s", func, line, pi->pathname);
   print_sys_errmsg (errmsg, errno);
 }
 
 void
-proc_error (pi, func, line)
-     procinfo *pi;
-     char     *func;
-     int      line;
+proc_error (procinfo *pi, char *func, int line)
 {
   sprintf (errmsg, "procfs: %s line %d, %s", func, line, pi->pathname);
   perror_with_name (errmsg);
@@ -805,8 +783,7 @@
  */
 
 int
-proc_get_status (pi)
-     procinfo *pi;
+proc_get_status (procinfo *pi)
 {
   /* Status file descriptor is opened "lazily" */
   if (pi->status_fd == 0 &&
@@ -904,8 +881,7 @@
  */ 
 
 long
-proc_flags (pi)
-     procinfo *pi;
+proc_flags (procinfo *pi)
 {
   if (!pi->status_valid)
     if (!proc_get_status (pi))
@@ -932,8 +908,7 @@
  */
 
 int
-proc_why (pi)
-     procinfo *pi;
+proc_why (procinfo *pi)
 {
   if (!pi->status_valid)
     if (!proc_get_status (pi))
@@ -953,8 +928,7 @@
  */
 
 int
-proc_what (pi)
-     procinfo *pi;
+proc_what (procinfo *pi)
 {
   if (!pi->status_valid)
     if (!proc_get_status (pi))
@@ -975,8 +949,7 @@
  */
 
 int
-proc_nsysarg (pi)
-     procinfo *pi;
+proc_nsysarg (procinfo *pi)
 {
   if (!pi->status_valid)
     if (!proc_get_status (pi))
@@ -996,8 +969,7 @@
  */
 
 long *
-proc_sysargs (pi)
-     procinfo *pi;
+proc_sysargs (procinfo *pi)
 {
   if (!pi->status_valid)
     if (!proc_get_status (pi))
@@ -1017,8 +989,7 @@
  */
 
 int
-proc_syscall (pi)
-     procinfo *pi;
+proc_syscall (procinfo *pi)
 {
   if (!pi->status_valid)
     if (!proc_get_status (pi))
@@ -1088,10 +1059,7 @@
 enum { FLAG_RESET, FLAG_SET };
 
 static int
-proc_modify_flag (pi, flag, mode)
-     procinfo *pi;
-     long flag;
-     long mode;
+proc_modify_flag (procinfo *pi, long flag, long mode)
 {
   long win = 0;		/* default to fail */
 
@@ -1200,8 +1168,7 @@
  */
 
 int
-proc_set_run_on_last_close (pi)
-     procinfo *pi;
+proc_set_run_on_last_close (procinfo *pi)
 {
   return proc_modify_flag (pi, PR_RLC, FLAG_SET);
 }
@@ -1217,8 +1184,7 @@
  */
 
 int
-proc_unset_run_on_last_close (pi)
-     procinfo *pi;
+proc_unset_run_on_last_close (procinfo *pi)
 {
   return proc_modify_flag (pi, PR_RLC, FLAG_RESET);
 }
@@ -1235,8 +1201,7 @@
  */
 
 int
-proc_set_kill_on_last_close (pi)
-     procinfo *pi;
+proc_set_kill_on_last_close (procinfo *pi)
 {
   return proc_modify_flag (pi, PR_KLC, FLAG_SET);
 }
@@ -1252,8 +1217,7 @@
  */
 
 int
-proc_unset_kill_on_last_close (pi)
-     procinfo *pi;
+proc_unset_kill_on_last_close (procinfo *pi)
 {
   return proc_modify_flag (pi, PR_KLC, FLAG_RESET);
 }
@@ -1270,8 +1234,7 @@
  */
 
 int
-proc_set_inherit_on_fork (pi)
-     procinfo *pi;
+proc_set_inherit_on_fork (procinfo *pi)
 {
   return proc_modify_flag (pi, PR_FORK, FLAG_SET);
 }
@@ -1287,8 +1250,7 @@
  */
 
 int
-proc_unset_inherit_on_fork (pi)
-     procinfo *pi;
+proc_unset_inherit_on_fork (procinfo *pi)
 {
   return proc_modify_flag (pi, PR_FORK, FLAG_RESET);
 }
@@ -1305,8 +1267,7 @@
  */
 
 int
-proc_set_async (pi)
-     procinfo *pi;
+proc_set_async (procinfo *pi)
 {
   return proc_modify_flag (pi, PR_ASYNC, FLAG_SET);
 }
@@ -1322,8 +1283,7 @@
  */
 
 int
-proc_unset_async (pi)
-     procinfo *pi;
+proc_unset_async (procinfo *pi)
 {
   return proc_modify_flag (pi, PR_ASYNC, FLAG_RESET);
 }
@@ -1337,8 +1297,7 @@
  */
 
 int
-proc_stop_process (pi)
-     procinfo *pi;
+proc_stop_process (procinfo *pi)
 {
   int win;
 
@@ -1380,8 +1339,7 @@
  */
 
 int
-proc_wait_for_stop (pi)
-     procinfo *pi;
+proc_wait_for_stop (procinfo *pi)
 {
   int win;
 
@@ -1445,10 +1403,7 @@
  */
 
 int
-proc_run_process (pi, step, signo)
-     procinfo *pi;
-     int step;
-     int signo;
+proc_run_process (procinfo *pi, int step, int signo)
 {
   int win;
   int runflags;
@@ -1501,9 +1456,7 @@
  */
 
 int
-proc_set_traced_signals (pi, sigset)
-     procinfo *pi;
-     sigset_t *sigset;
+proc_set_traced_signals (procinfo *pi, sigset_t *sigset)
 {
   int win;
 
@@ -1549,9 +1502,7 @@
  */
 
 int
-proc_set_traced_faults (pi, fltset)
-     procinfo *pi;
-     fltset_t *fltset;
+proc_set_traced_faults (procinfo *pi, fltset_t *fltset)
 {
   int win;
 
@@ -1595,9 +1546,7 @@
  */
 
 int
-proc_set_traced_sysentry (pi, sysset)
-     procinfo *pi;
-     sysset_t *sysset;
+proc_set_traced_sysentry (procinfo *pi, sysset_t *sysset)
 {
   int win;
 
@@ -1641,9 +1590,7 @@
  */
 
 int
-proc_set_traced_sysexit (pi, sysset)
-     procinfo *pi;
-     sysset_t *sysset;
+proc_set_traced_sysexit (procinfo *pi, sysset_t *sysset)
 {
   int win;
 
@@ -1687,9 +1634,7 @@
  */
 
 int
-proc_set_held_signals (pi, sighold)
-     procinfo *pi;
-     sigset_t *sighold;
+proc_set_held_signals (procinfo *pi, sigset_t *sighold)
 {
   int win;
 
@@ -1732,9 +1677,7 @@
  */
 
 sigset_t *
-proc_get_pending_signals (pi, save)
-     procinfo *pi;
-     sigset_t *save;
+proc_get_pending_signals (procinfo *pi, sigset_t *save)
 {
   sigset_t *ret = NULL;
 
@@ -1771,9 +1714,7 @@
  */
 
 struct sigaction *
-proc_get_signal_actions (pi, save)
-     procinfo         *pi;
-     struct sigaction *save;
+proc_get_signal_actions (procinfo *pi, struct sigaction *save)
 {
   struct sigaction *ret = NULL;
 
@@ -1810,9 +1751,7 @@
  */
 
 sigset_t *
-proc_get_held_signals (pi, save)
-     procinfo *pi;
-     sigset_t *save;
+proc_get_held_signals (procinfo *pi, sigset_t *save)
 {
   sigset_t *ret = NULL;
 
@@ -1858,9 +1797,7 @@
  */
 
 sigset_t *
-proc_get_traced_signals (pi, save)
-     procinfo *pi;
-     sigset_t *save;
+proc_get_traced_signals (procinfo *pi, sigset_t *save)
 {
   sigset_t *ret = NULL;
 
@@ -1902,9 +1839,7 @@
  */
 
 int
-proc_trace_signal (pi, signo)
-     procinfo *pi;
-     int signo;
+proc_trace_signal (procinfo *pi, int signo)
 {
   sigset_t temp;
 
@@ -1938,9 +1873,7 @@
  */
 
 int
-proc_ignore_signal (pi, signo)
-     procinfo *pi;
-     int signo;
+proc_ignore_signal (procinfo *pi, int signo)
 {
   sigset_t temp;
 
@@ -1974,9 +1907,7 @@
  */
 
 fltset_t *
-proc_get_traced_faults (pi, save)
-     procinfo *pi;
-     fltset_t *save;
+proc_get_traced_faults (procinfo *pi, fltset_t *save)
 {
   fltset_t *ret = NULL;
 
@@ -2018,9 +1949,7 @@
  */
 
 sysset_t *
-proc_get_traced_sysentry (pi, save)
-     procinfo *pi;
-     sysset_t *save;
+proc_get_traced_sysentry (procinfo *pi, sysset_t *save)
 {
   sysset_t *ret = NULL;
 
@@ -2062,9 +1991,7 @@
  */
 
 sysset_t *
-proc_get_traced_sysexit (pi, save)
-     procinfo *pi;
-     sysset_t *save;
+proc_get_traced_sysexit (procinfo *pi, sysset_t *save)
 {
   sysset_t * ret = NULL;
 
@@ -2107,8 +2034,7 @@
  */
 
 int
-proc_clear_current_fault (pi)
-     procinfo *pi;
+proc_clear_current_fault (procinfo *pi)
 {
   int win;
 
@@ -2148,9 +2074,7 @@
  */
 
 int
-proc_set_current_signal (pi, signo)
-     procinfo *pi;
-     int signo;
+proc_set_current_signal (procinfo *pi, int signo)
 {
   int win;
   struct {
@@ -2206,8 +2130,7 @@
  */
 
 int
-proc_clear_current_signal (pi)
-     procinfo *pi;
+proc_clear_current_signal (procinfo *pi)
 {
   int win;
 
@@ -2256,8 +2179,7 @@
  */
 
 gdb_gregset_t *
-proc_get_gregs (pi)
-     procinfo *pi;
+proc_get_gregs (procinfo *pi)
 {
   if (!pi->status_valid || !pi->gregs_valid)
     if (!proc_get_status (pi))
@@ -2288,8 +2210,7 @@
  */
 
 gdb_fpregset_t *
-proc_get_fpregs (pi)
-     procinfo *pi;
+proc_get_fpregs (procinfo *pi)
 {
 #ifdef NEW_PROC_API
   if (!pi->status_valid || !pi->fpregs_valid)
@@ -2366,8 +2287,7 @@
  */
 
 int
-proc_set_gregs (pi)
-     procinfo *pi;
+proc_set_gregs (procinfo *pi)
 {
   gdb_gregset_t *gregs;
   int win;
@@ -2410,8 +2330,7 @@
  */
 
 int
-proc_set_fpregs (pi)
-     procinfo *pi;
+proc_set_fpregs (procinfo *pi)
 {
   gdb_fpregset_t *fpregs;
   int win;
@@ -2473,9 +2392,7 @@
  */
 
 int
-proc_kill (pi, signo)
-     procinfo *pi;
-     int signo;
+proc_kill (procinfo *pi, int signo)
 {
   int win;
 
@@ -2515,8 +2432,7 @@
  */
 
 int
-proc_parent_pid (pi)
-     procinfo *pi;
+proc_parent_pid (procinfo *pi)
 {
   /*
    * We should never have to apply this operation to any procinfo
@@ -2542,11 +2458,7 @@
  */
 
 int
-proc_set_watchpoint (pi, addr, len, wflags)
-     procinfo  *pi;
-     CORE_ADDR addr;
-     int       len;
-     int       wflags;
+proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, int len, int wflags)
 {
 #if !defined (TARGET_HAS_HARDWARE_WATCHPOINTS)  
   return 0;
@@ -2597,8 +2509,7 @@
    It doesn't get called that often... and if I open it
    every time, I don't need to lseek it.  */
 int
-proc_iterate_over_mappings (func)
-     int (*func) (int, CORE_ADDR);
+proc_iterate_over_mappings (int (*func) (int, CORE_ADDR))
 {
   struct prmap *map;
   procinfo *pi;
@@ -2710,9 +2621,7 @@
  */
 
 struct ssd *
-proc_get_LDT_entry (pi, key)
-     procinfo *pi;
-     int       key;
+proc_get_LDT_entry (procinfo *pi, int key)
 {
   static struct ssd *ldt_entry = NULL;
 #ifdef NEW_PROC_API
@@ -2806,8 +2715,7 @@
  * OSF version
  */
 int 
-proc_get_nthreads (pi)
-     procinfo *pi;
+proc_get_nthreads (procinfo *pi)
 {
   int nthreads = 0;
 
@@ -2823,8 +2731,7 @@
  * Solaris and Unixware version
  */
 int
-proc_get_nthreads (pi)
-     procinfo *pi;
+proc_get_nthreads (procinfo *pi)
 {
   if (!pi->status_valid)
     if (!proc_get_status (pi))
@@ -2846,8 +2753,7 @@
  * Default version
  */
 int
-proc_get_nthreads (pi)
-     procinfo *pi;
+proc_get_nthreads (procinfo *pi)
 {
   return 0;
 }
@@ -2868,8 +2774,7 @@
  * Solaris and Unixware version
  */
 int
-proc_get_current_thread (pi)
-     procinfo *pi;
+proc_get_current_thread (procinfo *pi)
 {
   /*
    * Note: this should be applied to the root procinfo for the process,
@@ -2898,8 +2803,7 @@
  * OSF version
  */
 int 
-proc_get_current_thread (pi)
-     procinfo *pi;
+proc_get_current_thread (procinfo *pi)
 {
 #if 0	/* FIXME: not ready for prime time? */
   return pi->prstatus.pr_tid;
@@ -2913,8 +2817,7 @@
  * Default version
  */
 int 
-proc_get_current_thread (pi)
-     procinfo *pi;
+proc_get_current_thread (procinfo *pi)
 {
   return 0;
 }
@@ -2934,10 +2837,7 @@
  */
 
 int
-proc_delete_dead_threads (parent, thread, ignore)
-     procinfo *parent;
-     procinfo *thread;
-     void     *ignore;
+proc_delete_dead_threads (procinfo *parent, procinfo *thread, void *ignore)
 {
   if (thread && parent)	/* sanity */
     {
@@ -2953,8 +2853,7 @@
  * Solaris 2.5 (ioctl) version
  */
 int
-proc_update_threads (pi)
-     procinfo *pi;
+proc_update_threads (procinfo *pi)
 {
   gdb_prstatus_t *prstatus;
   struct cleanup *old_chain = NULL;
@@ -2980,7 +2879,7 @@
        malloc (sizeof (gdb_prstatus_t) * (nlwp + 1))) == 0)
     perror_with_name ("procfs: malloc failed in update_threads");
 
-  old_chain = make_cleanup (free, prstatus);
+  old_chain = make_cleanup (xfree, prstatus);
   if (ioctl (pi->ctl_fd, PIOCLSTATUS, prstatus) < 0)
     proc_error (pi, "update_threads (PIOCLSTATUS)", __LINE__);
 
@@ -3009,8 +2908,7 @@
 }
 
 int
-proc_update_threads (pi)
-     procinfo *pi;
+proc_update_threads (procinfo *pi)
 {
   char pathname[MAX_PROC_NAME_SIZE + 16];
   struct dirent *direntry;
@@ -3064,8 +2962,7 @@
  * OSF version
  */
 int 
-proc_update_threads (pi)
-     procinfo *pi;
+proc_update_threads (procinfo *pi)
 {
   int nthreads, i;
   tid_t *threads;
@@ -3106,8 +3003,7 @@
  * Default version
  */
 int
-proc_update_threads (pi)
-     procinfo *pi;
+proc_update_threads (procinfo *pi)
 {
   return 0;
 }
@@ -3139,10 +3035,9 @@
  */
 
 int
-proc_iterate_over_threads (pi, func, ptr)
-     procinfo *pi;
-     int (*func) (procinfo *, procinfo *, void *);
-     void     *ptr;
+proc_iterate_over_threads (procinfo *pi,
+			   int (*func) (procinfo *, procinfo *, void *),
+			   void *ptr)
 {
   procinfo *thread, *next;
   int retval = 0;
@@ -3193,8 +3088,7 @@
  */
 
 static int
-procfs_debug_inferior (pi)
-     procinfo *pi;
+procfs_debug_inferior (procinfo *pi)
 {
   fltset_t traced_faults;
   sigset_t traced_signals;
@@ -3285,9 +3179,7 @@
 }
 
 static void 
-procfs_attach (args, from_tty)
-     char *args;
-     int from_tty;
+procfs_attach (char *args, int from_tty)
 {
   char *exec_file;
   int   pid;
@@ -3316,9 +3208,7 @@
 }
 
 static void 
-procfs_detach (args, from_tty)
-     char *args;
-     int from_tty;
+procfs_detach (char *args, int from_tty)
 {
   char *exec_file;
   int   signo = 0;
@@ -3341,8 +3231,7 @@
 }
 
 static int
-do_attach (pid)
-     int pid;
+do_attach (int pid)
 {
   procinfo *pi;
   int fail;
@@ -3399,8 +3288,7 @@
 }
 
 static void
-do_detach (signo)
-     int signo;
+do_detach (int signo)
 {
   procinfo *pi;
 
@@ -3453,8 +3341,7 @@
  */
 
 static void
-procfs_fetch_registers (regno)
-     int regno;
+procfs_fetch_registers (int regno)
 {
   gdb_fpregset_t *fpregs;
   gdb_gregset_t  *gregs;
@@ -3507,7 +3394,7 @@
    from the program being debugged.  */
 
 static void
-procfs_prepare_to_store ()
+procfs_prepare_to_store (void)
 {
 #ifdef CHILD_PREPARE_TO_STORE
   CHILD_PREPARE_TO_STORE ();
@@ -3526,8 +3413,7 @@
  */
 
 static void
-procfs_store_registers (regno)
-     int regno;
+procfs_store_registers (int regno)
 {
   gdb_fpregset_t *fpregs;
   gdb_gregset_t  *gregs;
@@ -3590,9 +3476,7 @@
  */
 
 static int  
-procfs_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+procfs_wait (int pid, struct target_waitstatus *status)
 {
   /* First cut: loosely based on original version 2.1 */
   procinfo *pi;
@@ -4013,13 +3897,19 @@
   return retval;
 }
 
+/* Transfer LEN bytes between GDB address MYADDR and target address
+   MEMADDR.  If DOWRITE is non-zero, transfer them to the target,
+   otherwise transfer them from the target.  TARGET is unused.
+
+   The return value is 0 if an error occurred or no bytes were
+   transferred.  Otherwise, it will be a positive value which
+   indicates the number of bytes transferred between gdb and the
+   target.  (Note that the interface also makes provisions for
+   negative values, but this capability isn't implemented here.) */
+
 static int
-procfs_xfer_memory (memaddr, myaddr, len, dowrite, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int dowrite;
-     struct target_ops *target; /* ignored */
+procfs_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
+		    struct target_ops *target)
 {
   procinfo *pi;
   int nbytes = 0;
@@ -4079,10 +3969,7 @@
 
 
 static int
-invalidate_cache (parent, pi, ptr)
-     procinfo *parent;
-     procinfo *pi;
-     void     *ptr;
+invalidate_cache (procinfo *parent, procinfo *pi, void *ptr)
 {
   /*
    * About to run the child; invalidate caches and do any other cleanup.
@@ -4134,10 +4021,7 @@
  */
 
 static int
-make_signal_thread_runnable (process, pi, ptr)
-     procinfo *process;
-     procinfo *pi;
-     void     *ptr;
+make_signal_thread_runnable (procinfo *process, procinfo *pi, void *ptr)
 {
 #ifdef PR_ASLWP
   if (proc_flags (pi) & PR_ASLWP)
@@ -4169,10 +4053,7 @@
  */
 
 static void
-procfs_resume (pid, step, signo)
-     int pid;
-     int step;
-     enum target_signal signo;
+procfs_resume (int pid, int step, enum target_signal signo)
 {
   procinfo *pi, *thread;
   int native_signo;
@@ -4262,9 +4143,7 @@
  */
 
 static int
-register_gdb_signals (pi, signals)
-     procinfo *pi;
-     sigset_t *signals;
+register_gdb_signals (procinfo *pi, sigset_t *signals)
 {
   int signo;
 
@@ -4286,8 +4165,7 @@
  */
 
 static void
-procfs_notice_signals (pid)
-     int pid;
+procfs_notice_signals (int pid)
 {
   sigset_t signals;
   procinfo *pi = find_procinfo_or_die (PIDGET (pid), 0);
@@ -4306,8 +4184,7 @@
  */
 
 static void
-procfs_files_info (ignore)
-     struct target_ops *ignore;
+procfs_files_info (struct target_ops *ignore)
 {
   printf_filtered ("\tUsing the running image of %s %s via /proc.\n",
 		   attach_flag? "attached": "child", 
@@ -4321,9 +4198,7 @@
  */
 
 static void
-procfs_open (args, from_tty)
-     char *args;
-     int from_tty;
+procfs_open (char *args, int from_tty)
 {
   error ("Use the \"run\" command to start a Unix child process.");
 }
@@ -4342,7 +4217,7 @@
 
 
 static int
-procfs_can_run ()
+procfs_can_run (void)
 {
   /* This variable is controlled by modules that sit atop procfs that
      may layer their own process structure atop that provided here.
@@ -4364,7 +4239,7 @@
  */
 
 static void
-procfs_stop ()
+procfs_stop (void)
 {
   extern pid_t inferior_process_group;
 
@@ -4381,8 +4256,7 @@
  */
 
 static void
-unconditionally_kill_inferior (pi)
-     procinfo *pi;
+unconditionally_kill_inferior (procinfo *pi)
 {
   int parent_pid;
 
@@ -4444,7 +4318,7 @@
  */
 
 static void 
-procfs_kill_inferior ()
+procfs_kill_inferior (void)
 {
   if (inferior_pid != 0) /* ? */
     {
@@ -4464,7 +4338,7 @@
  */
 
 static void 
-procfs_mourn_inferior ()
+procfs_mourn_inferior (void)
 {
   procinfo *pi;
 
@@ -4489,8 +4363,7 @@
  */
 
 static void 
-procfs_init_inferior (pid)
-     int pid;
+procfs_init_inferior (int pid)
 {
   procinfo *pi;
   sigset_t signals;
@@ -4580,7 +4453,7 @@
  */
 
 static void
-procfs_set_exec_trap ()
+procfs_set_exec_trap (void)
 {
   /* This routine called on the child side (inferior side)
      after GDB forks the inferior.  It must use only local variables,
@@ -4682,10 +4555,7 @@
  */
 
 static void
-procfs_create_inferior (exec_file, allargs, env)
-     char *exec_file;
-     char *allargs;
-     char **env;
+procfs_create_inferior (char *exec_file, char *allargs, char **env)
 {
   char *shell_file = getenv ("SHELL");
   char *tryname;
@@ -4774,10 +4644,7 @@
  */
 
 static int
-procfs_notice_thread (pi, thread, ptr)
-     procinfo *pi;
-     procinfo *thread;
-     void *ptr;
+procfs_notice_thread (procinfo *pi, procinfo *thread, void *ptr)
 {
   int gdb_threadid = MERGEPID (pi->pid, thread->tid);
 
@@ -4795,7 +4662,7 @@
  */
 
 void
-procfs_find_new_threads ()
+procfs_find_new_threads (void)
 {
   procinfo *pi;
 
@@ -4815,8 +4682,7 @@
  */
 
 static int
-procfs_thread_alive (pid)
-     int pid;
+procfs_thread_alive (int pid)
 {
   int proc, thread;
   procinfo *pi;
@@ -4846,8 +4712,7 @@
  */
 
 char *
-procfs_pid_to_str (pid)
-     int pid;
+procfs_pid_to_str (int pid)
 {
   static char buf[80];
   int proc, thread;
@@ -4870,12 +4735,7 @@
  */
 
 int 
-procfs_set_watchpoint (pid, addr, len, rwflag, after)
-     int       pid;
-     CORE_ADDR addr;
-     int       len;
-     int       rwflag;
-     int       after;
+procfs_set_watchpoint (int pid, CORE_ADDR addr, int len, int rwflag, int after)
 {
 #ifndef UNIXWARE
   int       pflags = 0;
@@ -4929,8 +4789,7 @@
  */
 
 int
-procfs_stopped_by_watchpoint (pid)
-    int    pid;
+procfs_stopped_by_watchpoint (int pid)
 {
   procinfo *pi;
 
@@ -4965,8 +4824,7 @@
  */
 
 struct ssd *
-procfs_find_LDT_entry (pid)
-     int pid;
+procfs_find_LDT_entry (int pid)
 {
   gdb_gregset_t *gregs;
   int            key;
@@ -4997,9 +4855,7 @@
 
 
 static void
-info_proc_cmd (args, from_tty)
-     char *args;
-     int from_tty;
+info_proc_cmd (char *args, int from_tty)
 {
   struct cleanup *old_chain;
   procinfo *process = NULL;
@@ -5079,11 +4935,7 @@
 }
 
 static void
-proc_trace_syscalls (args, from_tty, entry_or_exit, mode)
-     char *args;
-     int   from_tty;
-     int   entry_or_exit;
-     int   mode;
+proc_trace_syscalls (char *args, int from_tty, int entry_or_exit, int mode)
 {
   procinfo *pi;
   sysset_t *sysset;
@@ -5126,40 +4978,32 @@
 }
 
 static void 
-proc_trace_sysentry_cmd (args, from_tty)
-     char *args;
-     int   from_tty;
+proc_trace_sysentry_cmd (char *args, int from_tty)
 {
   proc_trace_syscalls (args, from_tty, PR_SYSENTRY, FLAG_SET);
 }
 
 static void 
-proc_trace_sysexit_cmd (args, from_tty)
-     char *args;
-     int   from_tty;
+proc_trace_sysexit_cmd (char *args, int from_tty)
 {
   proc_trace_syscalls (args, from_tty, PR_SYSEXIT, FLAG_SET);
 }
 
 static void 
-proc_untrace_sysentry_cmd (args, from_tty)
-     char *args;
-     int   from_tty;
+proc_untrace_sysentry_cmd (char *args, int from_tty)
 {
   proc_trace_syscalls (args, from_tty, PR_SYSENTRY, FLAG_RESET);
 }
 
 static void 
-proc_untrace_sysexit_cmd (args, from_tty)
-     char *args;
-     int   from_tty;
+proc_untrace_sysexit_cmd (char *args, int from_tty)
 {
   proc_trace_syscalls (args, from_tty, PR_SYSEXIT, FLAG_RESET);
 }
 
 
 void
-_initialize_procfs ()
+_initialize_procfs (void)
 {
   init_procfs_ops ();
   add_target (&procfs_ops);
@@ -5191,7 +5035,7 @@
  */
 
 int
-procfs_first_available ()
+procfs_first_available (void)
 {
   if (procinfo_list)
     return procinfo_list->pid;
diff --git a/gdb/ptx4-nat.c b/gdb/ptx4-nat.c
index d1a5248..af313c0 100644
--- a/gdb/ptx4-nat.c
+++ b/gdb/ptx4-nat.c
@@ -34,8 +34,7 @@
    register values. */
 
 void
-supply_gregset (gregsetp)
-     gregset_t *gregsetp;
+supply_gregset (gregset_t *gregsetp)
 {
   supply_register (EAX_REGNUM, (char *) &(*gregsetp)[EAX]);
   supply_register (EDX_REGNUM, (char *) &(*gregsetp)[EDX]);
@@ -50,9 +49,7 @@
 }
 
 void
-fill_gregset (gregsetp, regno)
-     gregset_t *gregsetp;
-     int regno;
+fill_gregset (gregset_t *gregsetp, int regno)
 {
   int regi;
 
@@ -70,8 +67,7 @@
    idea of the current floating point register values. */
 
 void
-supply_fpregset (fpregsetp)
-     fpregset_t *fpregsetp;
+supply_fpregset (fpregset_t *fpregsetp)
 {
   supply_fpu_registers ((struct fpusave *) &fpregsetp->fp_reg_set);
   supply_fpa_registers ((struct fpasave *) &fpregsetp->f_wregs);
@@ -83,9 +79,7 @@
    them all. */
 
 void
-fill_fpregset (fpregsetp, regno)
-     fpregset_t *fpregsetp;
-     int regno;
+fill_fpregset (fpregset_t *fpregsetp, int regno)
 {
   int regi;
   char *to;
@@ -100,8 +94,7 @@
  */
 /* this could use elf_interpreter() from elfread.c */
 int
-proc_iterate_over_mappings (func)
-     int (*func) (int, CORE_ADDR);
+proc_iterate_over_mappings (int (*func) (int, CORE_ADDR))
 {
   vaddr_t curseg, memptr;
   pt_vseg_t pv;
diff --git a/gdb/pyr-xdep.c b/gdb/pyr-xdep.c
index 3222450..dd0ba1c 100644
--- a/gdb/pyr-xdep.c
+++ b/gdb/pyr-xdep.c
@@ -205,7 +205,7 @@
 /* OBSOLETE      and mark data and stack spaces as empty.  *x/ */
 /* OBSOLETE  */
 /* OBSOLETE   if (corefile) */
-/* OBSOLETE     free (corefile); */
+/* OBSOLETE     xfree (corefile); */
 /* OBSOLETE   corefile = 0; */
 /* OBSOLETE  */
 /* OBSOLETE   if (corechan >= 0) */
@@ -227,7 +227,7 @@
 /* OBSOLETE   if (filename) */
 /* OBSOLETE     { */
 /* OBSOLETE       filename = tilde_expand (filename); */
-/* OBSOLETE       make_cleanup (free, filename); */
+/* OBSOLETE       make_cleanup (xfree, filename); */
 /* OBSOLETE        */
 /* OBSOLETE       if (have_inferior_p ()) */
 /* OBSOLETE     error ("To look at a core file, you must kill the program with \"kill\"."); */
diff --git a/gdb/rdi-share/ardi.c b/gdb/rdi-share/ardi.c
index 43b8cf4..334a1fc 100644
--- a/gdb/rdi-share/ardi.c
+++ b/gdb/rdi-share/ardi.c
@@ -396,6 +396,7 @@
 
 static bool boot_interrupted = FALSE;
 static volatile bool interrupt_request = FALSE;
+static volatile bool stop_request = FALSE;
 
 static void ardi_sigint_handler(int sig) {
 #ifdef DEBUG
@@ -1343,10 +1344,16 @@
                                     Packet *packet );
 #endif
 
+void angel_RDI_stop_request(void)
+{
+  stop_request = 1;
+}
+
 /* Core functionality for execute and step */
 static int angel_RDI_ExecuteOrStep(PointHandle *handle, word type, 
                                    unsigned ninstr)
 {
+  extern int (*ui_loop_hook) (int);
   int err;
   adp_stopped_struct stopped_info;
   void* stateptr = (void *)&stopped_info;
@@ -1401,15 +1408,22 @@
   angel_DebugPrint("Waiting for program to finish...\n");
 #endif
 
+  interrupt_request = FALSE;
+  stop_request = FALSE;
+  
   signal(SIGINT, ardi_sigint_handler);
   while( executing )
   {
-      if (interrupt_request)
+    if (ui_loop_hook)
+      ui_loop_hook(0);
+    
+    if (interrupt_request || stop_request)
       {
         interrupt_target();
         interrupt_request = FALSE;
+        stop_request = FALSE;
       }
-      Adp_AsynchronousProcessing( async_block_on_nothing );
+    Adp_AsynchronousProcessing( async_block_on_nothing );
   }
   signal(SIGINT, SIG_IGN);
 
diff --git a/gdb/rdi-share/ardi.h b/gdb/rdi-share/ardi.h
index 66acd1a..3b23d88 100644
--- a/gdb/rdi-share/ardi.h
+++ b/gdb/rdi-share/ardi.h
@@ -60,6 +60,8 @@
 
 int angel_RDI_execute(PointHandle *handle);
 
+void angel_RDI_stop_request(void);
+
 int angel_RDI_step(unsigned ninstr, PointHandle *handle);
 
 int angel_RDI_info(unsigned type, ARMword *arg1, ARMword *arg2);
diff --git a/gdb/regcache.c b/gdb/regcache.c
new file mode 100644
index 0000000..104bff7
--- /dev/null
+++ b/gdb/regcache.c
@@ -0,0 +1,914 @@
+/* Cache and manage the values of registers for GDB, the GNU debugger.
+   Copyright 1986, 87, 89, 91, 94, 95, 96, 1998, 2000
+   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 "frame.h"
+#include "inferior.h"
+#include "target.h"
+#include "gdbarch.h"
+#include "gdbcmd.h"
+
+/*
+ * DATA STRUCTURE
+ *
+ * Here is the actual register cache.
+ */
+
+/* NOTE: this is a write-back cache.  There is no "dirty" bit for
+   recording if the register values have been changed (eg. by the
+   user).  Therefore all registers must be written back to the
+   target when appropriate.  */
+
+/* REGISTERS contains the cached register values (in target byte order). */
+
+char *registers;
+
+/* REGISTER_VALID is 0 if the register needs to be fetched,
+                     1 if it has been fetched, and
+		    -1 if the register value was not available.  
+   "Not available" means don't try to fetch it again.  */
+
+signed char *register_valid;
+
+/* The thread/process associated with the current set of registers.
+   For now, -1 is special, and means `no current process'.  */
+
+static int registers_pid = -1;
+
+/*
+ * FUNCTIONS:
+ */
+
+/* REGISTER_CACHED()
+
+   Returns 0 if the value is not in the cache (needs fetch).
+          >0 if the value is in the cache.
+	  <0 if the value is permanently unavailable (don't ask again).  */
+
+int
+register_cached (int regnum)
+{
+  return register_valid[regnum];
+}
+
+/* REGISTER_CHANGED
+
+   invalidate a single register REGNUM in the cache */
+void
+register_changed (int regnum)
+{
+  register_valid[regnum] = 0;
+}
+
+/* FIND_SAVED_REGISTER ()
+
+   Return the address in which frame FRAME's value of register REGNUM
+   has been saved in memory.  Or return zero if it has not been saved.
+   If REGNUM specifies the SP, the value we return is actually
+   the SP value, not an address where it was saved.  */
+
+CORE_ADDR
+find_saved_register (struct frame_info *frame, int regnum)
+{
+  register struct frame_info *frame1 = NULL;
+  register CORE_ADDR addr = 0;
+
+  if (frame == NULL)		/* No regs saved if want current frame */
+    return 0;
+
+#ifdef HAVE_REGISTER_WINDOWS
+  /* We assume that a register in a register window will only be saved
+     in one place (since the name changes and/or disappears as you go
+     towards inner frames), so we only call get_frame_saved_regs on
+     the current frame.  This is directly in contradiction to the
+     usage below, which assumes that registers used in a frame must be
+     saved in a lower (more interior) frame.  This change is a result
+     of working on a register window machine; get_frame_saved_regs
+     always returns the registers saved within a frame, within the
+     context (register namespace) of that frame. */
+
+  /* However, note that we don't want this to return anything if
+     nothing is saved (if there's a frame inside of this one).  Also,
+     callers to this routine asking for the stack pointer want the
+     stack pointer saved for *this* frame; this is returned from the
+     next frame.  */
+
+  if (REGISTER_IN_WINDOW_P (regnum))
+    {
+      frame1 = get_next_frame (frame);
+      if (!frame1)
+	return 0;		/* Registers of this frame are active.  */
+
+      /* Get the SP from the next frame in; it will be this
+         current frame.  */
+      if (regnum != SP_REGNUM)
+	frame1 = frame;
+
+      FRAME_INIT_SAVED_REGS (frame1);
+      return frame1->saved_regs[regnum];	/* ... which might be zero */
+    }
+#endif /* HAVE_REGISTER_WINDOWS */
+
+  /* Note that this next routine assumes that registers used in
+     frame x will be saved only in the frame that x calls and
+     frames interior to it.  This is not true on the sparc, but the
+     above macro takes care of it, so we should be all right. */
+  while (1)
+    {
+      QUIT;
+      frame1 = get_prev_frame (frame1);
+      if (frame1 == 0 || frame1 == frame)
+	break;
+      FRAME_INIT_SAVED_REGS (frame1);
+      if (frame1->saved_regs[regnum])
+	addr = frame1->saved_regs[regnum];
+    }
+
+  return addr;
+}
+
+/* DEFAULT_GET_SAVED_REGISTER ()
+
+   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).  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).  Set *ADDRP to the address, either in memory
+   on as a REGISTER_BYTE offset into the registers array.
+
+   Note that this implementation never sets *LVAL to not_lval.  But
+   it can be replaced by defining GET_SAVED_REGISTER and supplying
+   your own.
+
+   The argument RAW_BUFFER must point to aligned memory.  */
+
+static void
+default_get_saved_register (char *raw_buffer,
+			    int *optimized,
+			    CORE_ADDR *addrp,
+			    struct frame_info *frame,
+			    int regnum,
+			    enum lval_type *lval)
+{
+  CORE_ADDR addr;
+
+  if (!target_has_registers)
+    error ("No registers.");
+
+  /* Normal systems don't optimize out things with register numbers.  */
+  if (optimized != NULL)
+    *optimized = 0;
+  addr = find_saved_register (frame, regnum);
+  if (addr != 0)
+    {
+      if (lval != NULL)
+	*lval = lval_memory;
+      if (regnum == SP_REGNUM)
+	{
+	  if (raw_buffer != NULL)
+	    {
+	      /* Put it back in target format.  */
+	      store_address (raw_buffer, REGISTER_RAW_SIZE (regnum),
+			     (LONGEST) addr);
+	    }
+	  if (addrp != NULL)
+	    *addrp = 0;
+	  return;
+	}
+      if (raw_buffer != NULL)
+	target_read_memory (addr, raw_buffer, REGISTER_RAW_SIZE (regnum));
+    }
+  else
+    {
+      if (lval != NULL)
+	*lval = lval_register;
+      addr = REGISTER_BYTE (regnum);
+      if (raw_buffer != NULL)
+	read_register_gen (regnum, raw_buffer);
+    }
+  if (addrp != NULL)
+    *addrp = addr;
+}
+
+#if !defined (GET_SAVED_REGISTER)
+#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
+  default_get_saved_register(raw_buffer, optimized, addrp, frame, regnum, lval)
+#endif
+
+void
+get_saved_register (char *raw_buffer,
+		    int *optimized,
+		    CORE_ADDR *addrp,
+		    struct frame_info *frame,
+		    int regnum,
+		    enum lval_type *lval)
+{
+  GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame, regnum, lval);
+}
+
+/* READ_RELATIVE_REGISTER_RAW_BYTES_FOR_FRAME
+
+   Copy the bytes of register REGNUM, relative to the input stack frame,
+   into our memory at MYADDR, in target byte order.
+   The number of bytes copied is REGISTER_RAW_SIZE (REGNUM).
+
+   Returns 1 if could not be read, 0 if could.  */
+
+/* FIXME: This function increases the confusion between FP_REGNUM
+   and the virtual/pseudo-frame pointer.  */
+
+static int
+read_relative_register_raw_bytes_for_frame (int regnum,
+					    char *myaddr,
+					    struct frame_info *frame)
+{
+  int optim;
+  if (regnum == FP_REGNUM && frame)
+    {
+      /* Put it back in target format. */
+      store_address (myaddr, REGISTER_RAW_SIZE (FP_REGNUM),
+		     (LONGEST) FRAME_FP (frame));
+
+      return 0;
+    }
+
+  get_saved_register (myaddr, &optim, (CORE_ADDR *) NULL, frame,
+		      regnum, (enum lval_type *) NULL);
+
+  if (register_valid[regnum] < 0)
+    return 1;			/* register value not available */
+
+  return optim;
+}
+
+/* READ_RELATIVE_REGISTER_RAW_BYTES
+
+   Copy the bytes of register REGNUM, relative to the current stack
+   frame, into our memory at MYADDR, in target byte order.  
+   The number of bytes copied is REGISTER_RAW_SIZE (REGNUM).
+
+   Returns 1 if could not be read, 0 if could.  */
+
+int
+read_relative_register_raw_bytes (int regnum, char *myaddr)
+{
+  return read_relative_register_raw_bytes_for_frame (regnum, myaddr,
+						     selected_frame);
+}
+
+
+/* Low level examining and depositing of registers.
+
+   The caller is responsible for making sure that the inferior is
+   stopped before calling the fetching routines, or it will get
+   garbage.  (a change from GDB version 3, in which the caller got the
+   value from the last stop).  */
+
+/* REGISTERS_CHANGED ()
+
+   Indicate that registers may have changed, so invalidate the cache.  */
+
+void
+registers_changed (void)
+{
+  int i;
+
+  registers_pid = -1;
+
+  /* Force cleanup of any alloca areas if using C alloca instead of
+     a builtin alloca.  This particular call is used to clean up
+     areas allocated by low level target code which may build up
+     during lengthy interactions between gdb and the target before
+     gdb gives control to the user (ie watchpoints).  */
+  alloca (0);
+
+  for (i = 0; i < ARCH_NUM_REGS; i++)
+    register_valid[i] = 0;
+
+  /* Assume that if all the hardware regs have changed, 
+     then so have the pseudo-registers.  */
+  for (i = NUM_REGS; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
+    register_valid[i] = 0;
+
+  if (registers_changed_hook)
+    registers_changed_hook ();
+}
+
+/* REGISTERS_FETCHED ()
+
+   Indicate that all registers have been fetched, so mark them all valid.  */
+
+
+void
+registers_fetched (void)
+{
+  int i;
+
+  for (i = 0; i < ARCH_NUM_REGS; i++)
+    register_valid[i] = 1;
+  /* Do not assume that the pseudo-regs have also been fetched.
+     Fetching all real regs might not account for all pseudo-regs.  */
+}
+
+/* read_register_bytes and write_register_bytes are generally a *BAD*
+   idea.  They are inefficient because they need to check for partial
+   updates, which can only be done by scanning through all of the
+   registers and seeing if the bytes that are being read/written fall
+   inside of an invalid register.  [The main reason this is necessary
+   is that register sizes can vary, so a simple index won't suffice.]
+   It is far better to call read_register_gen and write_register_gen
+   if you want to get at the raw register contents, as it only takes a
+   regno as an argument, and therefore can't do a partial register
+   update.
+
+   Prior to the recent fixes to check for partial updates, both read
+   and write_register_bytes always checked to see if any registers
+   were stale, and then called target_fetch_registers (-1) to update
+   the whole set.  This caused really slowed things down for remote
+   targets.  */
+
+/* Copy INLEN bytes of consecutive data from registers
+   starting with the INREGBYTE'th byte of register data
+   into memory at MYADDR.  */
+
+void
+read_register_bytes (int inregbyte, char *myaddr, int inlen)
+{
+  int inregend = inregbyte + inlen;
+  int regno;
+
+  if (registers_pid != inferior_pid)
+    {
+      registers_changed ();
+      registers_pid = inferior_pid;
+    }
+
+  /* See if we are trying to read bytes from out-of-date registers.  If so,
+     update just those registers.  */
+
+  for (regno = 0; regno < NUM_REGS + NUM_PSEUDO_REGS; regno++)
+    {
+      int regstart, regend;
+
+      if (register_valid[regno])
+	continue;
+
+      if (REGISTER_NAME (regno) == NULL || *REGISTER_NAME (regno) == '\0')
+	continue;
+
+      regstart = REGISTER_BYTE (regno);
+      regend = regstart + REGISTER_RAW_SIZE (regno);
+
+      if (regend <= inregbyte || inregend <= regstart)
+	/* The range the user wants to read doesn't overlap with regno.  */
+	continue;
+
+      /* We've found an uncached register where at least one byte will be read.
+         Update it from the target.  */
+      if (regno < NUM_REGS)
+	target_fetch_registers (regno);
+      else if (regno < NUM_REGS + NUM_PSEUDO_REGS)
+	FETCH_PSEUDO_REGISTER (regno);
+
+      if (!register_valid[regno])
+	{
+	  /* Sometimes pseudoregs are never marked valid, so that they 
+	     will be fetched every time (it can be complicated to know
+	     if a pseudoreg is valid, while "fetching" them can be cheap). 
+	     */
+	  if (regno < NUM_REGS)
+	    error ("read_register_bytes:  Couldn't update register %d.", regno);
+	}
+    }
+
+  if (myaddr != NULL)
+    memcpy (myaddr, &registers[inregbyte], inlen);
+}
+
+/* Read register REGNO into memory at MYADDR, which must be large
+   enough for REGISTER_RAW_BYTES (REGNO).  Target byte-order.  If the
+   register is known to be the size of a CORE_ADDR or smaller,
+   read_register can be used instead.  */
+
+void
+read_register_gen (int regno, char *myaddr)
+{
+  if (registers_pid != inferior_pid)
+    {
+      registers_changed ();
+      registers_pid = inferior_pid;
+    }
+
+  if (!register_valid[regno])
+    {
+      if (regno < NUM_REGS)
+	target_fetch_registers (regno);
+      else if (regno < NUM_REGS + NUM_PSEUDO_REGS)
+	FETCH_PSEUDO_REGISTER (regno);
+    }
+  memcpy (myaddr, &registers[REGISTER_BYTE (regno)],
+	  REGISTER_RAW_SIZE (regno));
+}
+
+/* Write register REGNO at MYADDR to the target.  MYADDR points at
+   REGISTER_RAW_BYTES(REGNO), which must be in target byte-order.  */
+
+/* Registers we shouldn't try to store.  */
+#if !defined (CANNOT_STORE_REGISTER)
+#define CANNOT_STORE_REGISTER(regno) 0
+#endif
+
+void
+write_register_gen (int regno, char *myaddr)
+{
+  int size;
+
+  /* On the sparc, writing %g0 is a no-op, so we don't even want to
+     change the registers array if something writes to this register.  */
+  if (CANNOT_STORE_REGISTER (regno))
+    return;
+
+  if (registers_pid != inferior_pid)
+    {
+      registers_changed ();
+      registers_pid = inferior_pid;
+    }
+
+  size = REGISTER_RAW_SIZE (regno);
+
+  /* If we have a valid copy of the register, and new value == old value,
+     then don't bother doing the actual store. */
+
+  if (register_valid[regno]
+      && memcmp (&registers[REGISTER_BYTE (regno)], myaddr, size) == 0)
+    return;
+
+  if (regno < NUM_REGS)
+    target_prepare_to_store ();
+
+  memcpy (&registers[REGISTER_BYTE (regno)], myaddr, size);
+
+  register_valid[regno] = 1;
+
+  if (regno < NUM_REGS)
+    target_store_registers (regno);
+  else if (regno < NUM_REGS + NUM_PSEUDO_REGS)
+    STORE_PSEUDO_REGISTER (regno);
+}
+
+/* Copy INLEN bytes of consecutive data from memory at MYADDR
+   into registers starting with the MYREGSTART'th byte of register data.  */
+
+void
+write_register_bytes (int myregstart, char *myaddr, int inlen)
+{
+  int myregend = myregstart + inlen;
+  int regno;
+
+  target_prepare_to_store ();
+
+  /* Scan through the registers updating any that are covered by the
+     range myregstart<=>myregend using write_register_gen, which does
+     nice things like handling threads, and avoiding updates when the
+     new and old contents are the same.  */
+
+  for (regno = 0; regno < NUM_REGS + NUM_PSEUDO_REGS; regno++)
+    {
+      int regstart, regend;
+
+      regstart = REGISTER_BYTE (regno);
+      regend = regstart + REGISTER_RAW_SIZE (regno);
+
+      /* Is this register completely outside the range the user is writing?  */
+      if (myregend <= regstart || regend <= myregstart)
+	/* do nothing */ ;		
+
+      /* Is this register completely within the range the user is writing?  */
+      else if (myregstart <= regstart && regend <= myregend)
+	write_register_gen (regno, myaddr + (regstart - myregstart));
+
+      /* The register partially overlaps the range being written.  */
+      else
+	{
+	  char regbuf[MAX_REGISTER_RAW_SIZE];
+	  /* What's the overlap between this register's bytes and
+             those the caller wants to write?  */
+	  int overlapstart = max (regstart, myregstart);
+	  int overlapend   = min (regend,   myregend);
+
+	  /* We may be doing a partial update of an invalid register.
+	     Update it from the target before scribbling on it.  */
+	  read_register_gen (regno, regbuf);
+
+	  memcpy (registers + overlapstart,
+		  myaddr + (overlapstart - myregstart),
+		  overlapend - overlapstart);
+
+	  if (regno < NUM_REGS)
+	    target_store_registers (regno);
+	  else if (regno < NUM_REGS + NUM_PSEUDO_REGS)
+	    STORE_PSEUDO_REGISTER (regno);
+	}
+    }
+}
+
+
+/* Return the raw contents of register REGNO, regarding it as an
+   UNSIGNED integer. */
+
+ULONGEST
+read_register (int regno)
+{
+  if (registers_pid != inferior_pid)
+    {
+      registers_changed ();
+      registers_pid = inferior_pid;
+    }
+
+  if (!register_valid[regno])
+    {
+      if (regno < NUM_REGS)
+	target_fetch_registers (regno);
+      else if (regno < NUM_REGS + NUM_PSEUDO_REGS)
+	FETCH_PSEUDO_REGISTER (regno);
+    }
+
+  return (extract_unsigned_integer (&registers[REGISTER_BYTE (regno)],
+				    REGISTER_RAW_SIZE (regno)));
+}
+
+ULONGEST
+read_register_pid (int regno, int pid)
+{
+  int save_pid;
+  CORE_ADDR retval;
+
+  if (pid == inferior_pid)
+    return read_register (regno);
+
+  save_pid = inferior_pid;
+
+  inferior_pid = pid;
+
+  retval = read_register (regno);
+
+  inferior_pid = save_pid;
+
+  return retval;
+}
+
+/* Return the raw contents of register REGNO, regarding it a SIGNED
+   integer. */
+
+LONGEST
+read_signed_register (int regno)
+{
+  if (registers_pid != inferior_pid)
+    {
+      registers_changed ();
+      registers_pid = inferior_pid;
+    }
+
+  if (!register_valid[regno])
+    target_fetch_registers (regno);
+
+  return (extract_signed_integer (&registers[REGISTER_BYTE (regno)],
+				  REGISTER_RAW_SIZE (regno)));
+}
+
+LONGEST
+read_signed_register_pid (int regno, int pid)
+{
+  int save_pid;
+  LONGEST retval;
+
+  if (pid == inferior_pid)
+    return read_signed_register (regno);
+
+  save_pid = inferior_pid;
+
+  inferior_pid = pid;
+
+  retval = read_signed_register (regno);
+
+  inferior_pid = save_pid;
+
+  return retval;
+}
+
+/* Store VALUE, into the raw contents of register number REGNO.  */
+
+void
+write_register (int regno, LONGEST val)
+{
+  PTR buf;
+  int size;
+
+  /* On the sparc, writing %g0 is a no-op, so we don't even want to
+     change the registers array if something writes to this register.  */
+  if (CANNOT_STORE_REGISTER (regno))
+    return;
+
+  if (registers_pid != inferior_pid)
+    {
+      registers_changed ();
+      registers_pid = inferior_pid;
+    }
+
+  size = REGISTER_RAW_SIZE (regno);
+  buf = alloca (size);
+  store_signed_integer (buf, size, (LONGEST) val);
+
+  /* If we have a valid copy of the register, and new value == old value,
+     then don't bother doing the actual store. */
+
+  if (register_valid[regno]
+      && memcmp (&registers[REGISTER_BYTE (regno)], buf, size) == 0)
+    return;
+
+  if (regno < NUM_REGS)
+    target_prepare_to_store ();
+
+  memcpy (&registers[REGISTER_BYTE (regno)], buf, size);
+
+  register_valid[regno] = 1;
+
+  if (regno < NUM_REGS)
+    target_store_registers (regno);
+  else if (regno < NUM_REGS + NUM_PSEUDO_REGS)
+    STORE_PSEUDO_REGISTER (regno);
+}
+
+void
+write_register_pid (int regno, CORE_ADDR val, int pid)
+{
+  int save_pid;
+
+  if (pid == inferior_pid)
+    {
+      write_register (regno, val);
+      return;
+    }
+
+  save_pid = inferior_pid;
+
+  inferior_pid = pid;
+
+  write_register (regno, val);
+
+  inferior_pid = save_pid;
+}
+
+/* SUPPLY_REGISTER()
+
+   Record that register REGNO contains VAL.  This is used when the
+   value is obtained from the inferior or core dump, so there is no
+   need to store the value there.
+
+   If VAL is a NULL pointer, then it's probably an unsupported register.
+   We just set it's value to all zeros.  We might want to record this
+   fact, and report it to the users of read_register and friends.  */
+
+void
+supply_register (int regno, char *val)
+{
+#if 1
+  if (registers_pid != inferior_pid)
+    {
+      registers_changed ();
+      registers_pid = inferior_pid;
+    }
+#endif
+
+  register_valid[regno] = 1;
+  if (val)
+    memcpy (&registers[REGISTER_BYTE (regno)], val, 
+	    REGISTER_RAW_SIZE (regno));
+  else
+    memset (&registers[REGISTER_BYTE (regno)], '\000', 
+	    REGISTER_RAW_SIZE (regno));
+
+  /* On some architectures, e.g. HPPA, there are a few stray bits in
+     some registers, that the rest of the code would like to ignore.  */
+
+#ifdef CLEAN_UP_REGISTER_VALUE
+  CLEAN_UP_REGISTER_VALUE (regno, &registers[REGISTER_BYTE (regno)]);
+#endif
+}
+
+/* read_pc, write_pc, read_sp, write_sp, read_fp, write_fp, etc.
+   Special handling for registers PC, SP, and FP.  */
+
+/* This routine is getting awfully cluttered with #if's.  It's probably
+   time to turn this into READ_PC and define it in the tm.h file.
+   Ditto for write_pc.
+
+   1999-06-08: The following were re-written so that it assumes the
+   existence of a TARGET_READ_PC et.al. macro.  A default generic
+   version of that macro is made available where needed.
+
+   Since the ``TARGET_READ_PC'' et.al. macro is going to be controlled
+   by the multi-arch framework, it will eventually be possible to
+   eliminate the intermediate read_pc_pid().  The client would call
+   TARGET_READ_PC directly. (cagney). */
+
+CORE_ADDR
+generic_target_read_pc (int pid)
+{
+#ifdef PC_REGNUM
+  if (PC_REGNUM >= 0)
+    {
+      CORE_ADDR pc_val = ADDR_BITS_REMOVE ((CORE_ADDR) read_register_pid (PC_REGNUM, pid));
+      return pc_val;
+    }
+#endif
+  internal_error ("generic_target_read_pc");
+  return 0;
+}
+
+CORE_ADDR
+read_pc_pid (int pid)
+{
+  int saved_inferior_pid;
+  CORE_ADDR pc_val;
+
+  /* In case pid != inferior_pid. */
+  saved_inferior_pid = inferior_pid;
+  inferior_pid = pid;
+
+  pc_val = TARGET_READ_PC (pid);
+
+  inferior_pid = saved_inferior_pid;
+  return pc_val;
+}
+
+CORE_ADDR
+read_pc (void)
+{
+  return read_pc_pid (inferior_pid);
+}
+
+void
+generic_target_write_pc (CORE_ADDR pc, int pid)
+{
+#ifdef PC_REGNUM
+  if (PC_REGNUM >= 0)
+    write_register_pid (PC_REGNUM, pc, pid);
+  if (NPC_REGNUM >= 0)
+    write_register_pid (NPC_REGNUM, pc + 4, pid);
+  if (NNPC_REGNUM >= 0)
+    write_register_pid (NNPC_REGNUM, pc + 8, pid);
+#else
+  internal_error ("generic_target_write_pc");
+#endif
+}
+
+void
+write_pc_pid (CORE_ADDR pc, int pid)
+{
+  int saved_inferior_pid;
+
+  /* In case pid != inferior_pid. */
+  saved_inferior_pid = inferior_pid;
+  inferior_pid = pid;
+
+  TARGET_WRITE_PC (pc, pid);
+
+  inferior_pid = saved_inferior_pid;
+}
+
+void
+write_pc (CORE_ADDR pc)
+{
+  write_pc_pid (pc, inferior_pid);
+}
+
+/* Cope with strage ways of getting to the stack and frame pointers */
+
+CORE_ADDR
+generic_target_read_sp (void)
+{
+#ifdef SP_REGNUM
+  if (SP_REGNUM >= 0)
+    return read_register (SP_REGNUM);
+#endif
+  internal_error ("generic_target_read_sp");
+}
+
+CORE_ADDR
+read_sp (void)
+{
+  return TARGET_READ_SP ();
+}
+
+void
+generic_target_write_sp (CORE_ADDR val)
+{
+#ifdef SP_REGNUM
+  if (SP_REGNUM >= 0)
+    {
+      write_register (SP_REGNUM, val);
+      return;
+    }
+#endif
+  internal_error ("generic_target_write_sp");
+}
+
+void
+write_sp (CORE_ADDR val)
+{
+  TARGET_WRITE_SP (val);
+}
+
+CORE_ADDR
+generic_target_read_fp (void)
+{
+#ifdef FP_REGNUM
+  if (FP_REGNUM >= 0)
+    return read_register (FP_REGNUM);
+#endif
+  internal_error ("generic_target_read_fp");
+}
+
+CORE_ADDR
+read_fp (void)
+{
+  return TARGET_READ_FP ();
+}
+
+void
+generic_target_write_fp (CORE_ADDR val)
+{
+#ifdef FP_REGNUM
+  if (FP_REGNUM >= 0)
+    {
+      write_register (FP_REGNUM, val);
+      return;
+    }
+#endif
+  internal_error ("generic_target_write_fp");
+}
+
+void
+write_fp (CORE_ADDR val)
+{
+  TARGET_WRITE_FP (val);
+}
+
+/* ARGSUSED */
+static void
+reg_flush_command (char *command, int from_tty)
+{
+  /* Force-flush the register cache.  */
+  registers_changed ();
+  if (from_tty)
+    printf_filtered ("Register cache flushed.\n");
+}
+
+
+static void
+build_regcache (void)
+{
+  /* We allocate some extra slop since we do a lot of memcpy's around
+     `registers', and failing-soft is better than failing hard.  */
+  int sizeof_registers = REGISTER_BYTES + /* SLOP */ 256;
+  int sizeof_register_valid = 
+    (NUM_REGS + NUM_PSEUDO_REGS) * sizeof (*register_valid);
+  registers = xmalloc (sizeof_registers);
+  memset (registers, 0, sizeof_registers);
+  register_valid = xmalloc (sizeof_register_valid);
+  memset (register_valid, 0, sizeof_register_valid);
+}
+
+void
+_initialize_regcache (void)
+{
+  build_regcache ();
+
+  register_gdbarch_swap (&registers, sizeof (registers), NULL);
+  register_gdbarch_swap (&register_valid, sizeof (register_valid), NULL);
+  register_gdbarch_swap (NULL, 0, build_regcache);
+
+  add_com ("flushregs", class_maintenance, reg_flush_command,
+	   "Force gdb to flush its register cache (maintainer command)");
+}
diff --git a/gdb/remote-adapt.c b/gdb/remote-adapt.c
index b41f3c2..f370d38 100644
--- a/gdb/remote-adapt.c
+++ b/gdb/remote-adapt.c
@@ -118,9 +118,7 @@
 #define ON	1
 #define OFF	0
 static void
-rawmode (desc, turnon)
-     int desc;
-     int turnon;
+rawmode (int desc, int turnon)
 {
 
   TERMINAL sg;
@@ -150,7 +148,7 @@
 }
 
 /* Suck up all the input from the adapt */
-slurp_input ()
+slurp_input (void)
 {
   char buf[8];
 
@@ -167,7 +165,7 @@
 /* Read a character from the remote system, doing all the fancy
    timeout stuff.  */
 static int
-readchar ()
+readchar (void)
 {
   char buf;
 
@@ -198,13 +196,12 @@
 /* Keep discarding input from the remote system, until STRING is found. 
    Let the user break out immediately.  */
 static void
-expect (string)
-     char *string;
+expect (char *string)
 {
   char *p = string;
 
   fflush (adapt_stream);
-  immediate_quit = 1;
+  immediate_quit++;
   while (1)
     {
       if (readchar () == *p)
@@ -212,7 +209,7 @@
 	  p++;
 	  if (*p == '\0')
 	    {
-	      immediate_quit = 0;
+	      immediate_quit--;
 	      return;
 	    }
 	}
@@ -236,7 +233,7 @@
    necessary to prevent getting into states from which we can't
    recover.  */
 static void
-expect_prompt ()
+expect_prompt (void)
 {
 #if defined (LOG_FILE)
   /* This is a convenient place to do this.  The idea is to do it often
@@ -250,8 +247,7 @@
 /* Get a hex digit from the remote system & return its value.
    If ignore_space is nonzero, ignore spaces (not newline, tab, etc).  */
 static int
-get_hex_digit (ignore_space)
-     int ignore_space;
+get_hex_digit (int ignore_space)
 {
   int ch;
   while (1)
@@ -276,8 +272,7 @@
 /* Get a byte from adapt_desc and put it in *BYT.  Accept any number
    leading spaces.  */
 static void
-get_hex_byte (byt)
-     char *byt;
+get_hex_byte (char *byt)
 {
   int val;
 
@@ -288,7 +283,7 @@
 
 /* Read a 32-bit hex word from the adapt, preceded by a space  */
 static long
-get_hex_word ()
+get_hex_word (void)
 {
   long val;
   int j;
@@ -301,9 +296,7 @@
 /* Get N 32-bit hex words from remote, each preceded by a space 
    and put them in registers starting at REGNO.  */
 static void
-get_hex_regs (n, regno)
-     int n;
-     int regno;
+get_hex_regs (int n, int regno)
 {
   long val;
   while (n--)
@@ -324,7 +317,7 @@
 volatile int n_alarms;
 
 void
-adapt_timer ()
+adapt_timer (void)
 {
 #if 0
   if (kiodebug)
@@ -344,9 +337,7 @@
 static int need_artificial_trap = 0;
 
 void
-adapt_kill (arg, from_tty)
-     char *arg;
-     int from_tty;
+adapt_kill (char *arg, int from_tty)
 {
   fprintf (adapt_stream, "K");
   fprintf (adapt_stream, "\r");
@@ -357,9 +348,7 @@
  * FIXME: Assumes the file to download is a binary coff file.
  */
 static void
-adapt_load (args, fromtty)
-     char *args;
-     int fromtty;
+adapt_load (char *args, int fromtty)
 {
   FILE *fp;
   int n;
@@ -429,10 +418,7 @@
 /* This is called not only when we first attach, but also when the
    user types "run" after having attached.  */
 void
-adapt_create_inferior (execfile, args, env)
-     char *execfile;
-     char *args;
-     char **env;
+adapt_create_inferior (char *execfile, char *args, char **env)
 {
   int entry_pt;
 
@@ -569,8 +555,7 @@
 };
 
 static int
-damn_b (rate)
-     int rate;
+damn_b (int rate)
 {
   int i;
 
@@ -588,9 +573,7 @@
 
 static int baudrate = 9600;
 static void
-adapt_open (name, from_tty)
-     char *name;
-     int from_tty;
+adapt_open (char *name, int from_tty)
 {
   TERMINAL sg;
   unsigned int prl;
@@ -627,7 +610,7 @@
     /*EMPTY */ ;
 
   if (prog_name != NULL)
-    free (prog_name);
+    xfree (prog_name);
   prog_name = savestring (p, strlen (p));
 
   adapt_close (0);
@@ -701,8 +684,7 @@
 /* Close out all files and local state before this target loses control. */
 
 static void
-adapt_close (quitting)
-     int quitting;
+adapt_close (int quitting)
 {
 
   /* Clear any break points */
@@ -742,9 +724,7 @@
 
 /* Attach to the target that is already loaded and possibly running */
 static void
-adapt_attach (args, from_tty)
-     char *args;
-     int from_tty;
+adapt_attach (char *args, int from_tty)
 {
 
   if (from_tty)
@@ -761,9 +741,7 @@
    Use this when you want to detach and do something else
    with your gdb.  */
 void
-adapt_detach (args, from_tty)
-     char *args;
-     int from_tty;
+adapt_detach (char *args, int from_tty)
 {
 
   if (adapt_stream)
@@ -780,9 +758,7 @@
 /* Tell the remote machine to resume.  */
 
 void
-adapt_resume (pid, step, sig)
-     int pid, step;
-     enum target_signal sig;
+adapt_resume (int pid, int step, enum target_signal sig)
 {
   if (step)
     {
@@ -811,8 +787,7 @@
    storing status in STATUS just as `wait' would.  */
 
 int
-adapt_wait (status)
-     struct target_waitstatus *status;
+adapt_wait (struct target_waitstatus *status)
 {
   /* Strings to look for.  '?' means match any single character.  
      Note that with the algorithm we use, the initial character
@@ -909,8 +884,7 @@
 
    Returns a pointer to a static buffer containing the answer.  */
 static char *
-get_reg_name (regno)
-     int regno;
+get_reg_name (int regno)
 {
   static char buf[80];
   if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32)
@@ -945,7 +919,7 @@
 /* Read the remote registers.  */
 
 static void
-adapt_fetch_registers ()
+adapt_fetch_registers (void)
 {
   int reg_index;
   int regnum_index;
@@ -1062,8 +1036,7 @@
 /* Fetch register REGNO, or all registers if REGNO is -1.
  */
 static void
-adapt_fetch_register (regno)
-     int regno;
+adapt_fetch_register (int regno)
 {
   if (regno == -1)
     adapt_fetch_registers ();
@@ -1081,7 +1054,7 @@
 /* Store the remote registers from the contents of the block REGS.  */
 
 static void
-adapt_store_registers ()
+adapt_store_registers (void)
 {
   int i, j;
 
@@ -1137,8 +1110,7 @@
 /* Store register REGNO, or all if REGNO == -1.
    Return errno value.  */
 void
-adapt_store_register (regno)
-     int regno;
+adapt_store_register (int regno)
 {
   /* printf("adapt_store_register() called.\n"); fflush(stdout); /* */
   if (regno == -1)
@@ -1166,14 +1138,13 @@
    debugged.  */
 
 void
-adapt_prepare_to_store ()
+adapt_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
 static CORE_ADDR
-translate_addr (addr)
-     CORE_ADDR addr;
+translate_addr (CORE_ADDR addr)
 {
 #if defined(KERNEL_DEBUGGING)
   /* Check for a virtual address in the kernel */
@@ -1196,11 +1167,7 @@
 
 /* FIXME!  Merge these two.  */
 int
-adapt_xfer_inferior_memory (memaddr, myaddr, len, write)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
+adapt_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len, int write)
 {
 
   memaddr = translate_addr (memaddr);
@@ -1212,7 +1179,7 @@
 }
 
 void
-adapt_files_info ()
+adapt_files_info (void)
 {
   printf_filtered ("\tAttached to %s at %d baud and running program %s\n",
 		   dev_name, baudrate, prog_name);
@@ -1224,10 +1191,7 @@
    * sb/sh instructions don't work on unaligned addresses, when TU=1. 
  */
 int
-adapt_write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+adapt_write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int i;
   unsigned int cps;
@@ -1258,10 +1222,7 @@
 /* Read LEN bytes from inferior memory at MEMADDR.  Put the result
    at debugger address MYADDR.  Returns errno value.  */
 int
-adapt_read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+adapt_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int i;
 
@@ -1332,10 +1293,14 @@
 
 #define MAX_BREAKS	8
 static int num_brkpts = 0;
+
+/* Insert a breakpoint at ADDR.  SAVE is normally the address of the
+   pattern buffer where the instruction that the breakpoint overwrites
+   is saved.  It is unused here since the Adapt Monitor is responsible
+   for saving/restoring the original instruction. */
+
 static int
-adapt_insert_breakpoint (addr, save)
-     CORE_ADDR addr;
-     char *save;		/* Throw away, let adapt save instructions */
+adapt_insert_breakpoint (CORE_ADDR addr, char *save)
 {
   if (num_brkpts < MAX_BREAKS)
     {
@@ -1353,10 +1318,13 @@
     }
 
 }
+
+/* Remove a breakpoint at ADDR.  SAVE is normally the previously
+   saved pattern, but is unused here as the Adapt Monitor is
+   responsible for saving/restoring instructions. */
+
 static int
-adapt_remove_breakpoint (addr, save)
-     CORE_ADDR addr;
-     char *save;		/* Throw away, let adapt save instructions */
+adapt_remove_breakpoint (CORE_ADDR addr, char *save)
 {
   if (num_brkpts > 0)
     {
@@ -1371,7 +1339,7 @@
 
 /* Clear the adapts notion of what the break points are */
 static int
-adapt_clear_breakpoints ()
+adapt_clear_breakpoints (void)
 {
   if (adapt_stream)
     {
@@ -1383,7 +1351,7 @@
   num_brkpts = 0;
 }
 static void
-adapt_mourn ()
+adapt_mourn (void)
 {
   adapt_clear_breakpoints ();
   pop_target ();		/* Pop back to no-child state */
@@ -1394,8 +1362,7 @@
  * specified string
  */
 static int
-display_until (str)
-     char *str;
+display_until (char *str)
 {
   int i = 0, j, c;
 
@@ -1429,9 +1396,7 @@
    FIXME: Can't handle commands that take input.  */
 
 void
-adapt_com (args, fromtty)
-     char *args;
-     int fromtty;
+adapt_com (char *args, int fromtty)
 {
   if (!adapt_stream)
     {
@@ -1554,7 +1519,7 @@
 }				/* init_adapt_ops */
 
 void
-_initialize_remote_adapt ()
+_initialize_remote_adapt (void)
 {
   init_adapt_ops ();
   add_target (&adapt_ops);
diff --git a/gdb/remote-array.c b/gdb/remote-array.c
index fcbddc0..cd3cff3 100644
--- a/gdb/remote-array.c
+++ b/gdb/remote-array.c
@@ -216,9 +216,7 @@
  * write_monitor -- send raw data to monitor.
  */
 static void
-write_monitor (data, len)
-     char data[];
-     int len;
+write_monitor (char data[], int len)
 {
   if (SERIAL_WRITE (array_desc, data, len))
     fprintf (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno));
@@ -317,8 +315,7 @@
  *    timeout stuff.
  */
 static int
-readchar (timeout)
-     int timeout;
+readchar (int timeout)
 {
   int c;
 
@@ -356,9 +353,7 @@
  *      it out. Let the user break out immediately.
  */
 static void
-expect (string, discard)
-     char *string;
-     int discard;
+expect (char *string, int discard)
 {
   char *p = string;
   int c;
@@ -366,7 +361,7 @@
 
   debuglogs (1, "Expecting \"%s\".", string);
 
-  immediate_quit = 1;
+  immediate_quit++;
   while (1)
     {
       c = readchar (timeout);
@@ -376,7 +371,7 @@
 	{
 	  if (*p == '\0')
 	    {
-	      immediate_quit = 0;
+	      immediate_quit--;
 	      debuglogs (4, "Matched");
 	      return;
 	    }
@@ -407,8 +402,7 @@
    necessary to prevent getting into states from which we can't
    recover.  */
 static void
-expect_prompt (discard)
-     int discard;
+expect_prompt (int discard)
 {
   expect (ARRAY_PROMPT, discard);
 }
@@ -417,8 +411,7 @@
  * junk -- ignore junk characters. Returns a 1 if junk, 0 otherwise
  */
 static int
-junk (ch)
-     char ch;
+junk (char ch)
 {
   switch (ch)
     {
@@ -443,8 +436,7 @@
  *              If ignore is nonzero, ignore spaces, newline & tabs.
  */
 static int
-get_hex_digit (ignore)
-     int ignore;
+get_hex_digit (int ignore)
 {
   static int ch;
   while (1)
@@ -490,8 +482,7 @@
  *    Accept any number leading spaces.
  */
 static void
-get_hex_byte (byt)
-     char *byt;
+get_hex_byte (char *byt)
 {
   int val;
 
@@ -510,7 +501,7 @@
  *      and put them in registers starting at REGNO.
  */
 static int
-get_hex_word ()
+get_hex_word (void)
 {
   long val, newval;
   int i;
@@ -540,10 +531,7 @@
 /* This is called not only when we first attach, but also when the
    user types "run" after having attached.  */
 static void
-array_create_inferior (execfile, args, env)
-     char *execfile;
-     char *args;
-     char **env;
+array_create_inferior (char *execfile, char *args, char **env)
 {
   int entry_pt;
 
@@ -584,10 +572,7 @@
 static char dev_name[100];
 
 static void
-array_open (args, name, from_tty)
-     char *args;
-     char *name;
-     int from_tty;
+array_open (char *args, char *name, int from_tty)
 {
   char packet[PBUFSIZ];
 
@@ -659,8 +644,7 @@
  */
 
 static void
-array_close (quitting)
-     int quitting;
+array_close (int quitting)
 {
   SERIAL_CLOSE (array_desc);
   array_desc = NULL;
@@ -684,8 +668,7 @@
  *      else with your gdb.
  */
 static void
-array_detach (from_tty)
-     int from_tty;
+array_detach (int from_tty)
 {
 
   debuglogs (1, "array_detach ()");
@@ -699,9 +682,7 @@
  * array_attach -- attach GDB to the target.
  */
 static void
-array_attach (args, from_tty)
-     char *args;
-     int from_tty;
+array_attach (char *args, int from_tty)
 {
   if (from_tty)
     printf ("Starting remote %s debugging\n", target_shortname);
@@ -717,9 +698,7 @@
  * array_resume -- Tell the remote machine to resume.
  */
 static void
-array_resume (pid, step, sig)
-     int pid, step;
-     enum target_signal sig;
+array_resume (int pid, int step, enum target_signal sig)
 {
   debuglogs (1, "array_resume (step=%d, sig=%d)", step, sig);
 
@@ -740,9 +719,7 @@
  *          storing status in status just as `wait' would.
  */
 static int
-array_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+array_wait (int pid, struct target_waitstatus *status)
 {
   int old_timeout = timeout;
   int result, i;
@@ -816,8 +793,7 @@
  *      block regs.
  */
 static void
-array_fetch_registers (ignored)
-     int ignored;
+array_fetch_registers (int ignored)
 {
   int regno, i;
   char *p;
@@ -852,18 +828,16 @@
  * protocol based on GDB's remote protocol.
  */
 static void
-array_fetch_register (ignored)
-     int ignored;
+array_fetch_register (int ignored)
 {
-  array_fetch_registers ();
+  array_fetch_registers (0 /* ignored */);
 }
 
 /*
  * Get all the registers from the targets. They come back in a large array.
  */
 static void
-array_store_registers (ignored)
-     int ignored;
+array_store_registers (int ignored)
 {
   int regno;
   unsigned long i;
@@ -902,10 +876,9 @@
  * protocol based on GDB's remote protocol.
  */
 static void
-array_store_register (ignored)
-     int ignored;
+array_store_register (int ignored)
 {
-  array_store_registers ();
+  array_store_registers (0 /* ignored */);
 }
 
 /* Get ready to modify the registers array.  On machines which store
@@ -915,13 +888,13 @@
    debugged.  */
 
 static void
-array_prepare_to_store ()
+array_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
 static void
-array_files_info ()
+array_files_info (void)
 {
   printf ("\tAttached to %s at %d baud.\n",
 	  dev_name, baudrate);
@@ -932,10 +905,7 @@
  *      memory at MYADDR to inferior's memory at MEMADDR.  Returns length moved.
  */
 static int
-array_write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     unsigned char *myaddr;
-     int len;
+array_write_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 {
   unsigned long i;
   int j;
@@ -980,10 +950,7 @@
  *      length moved.
  */
 static int
-array_read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+array_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int j;
   char buf[20];
@@ -1051,14 +1018,15 @@
   return (count);
 }
 
-/* FIXME-someday!  merge these two.  */
+/* Transfer LEN bytes between GDB address MYADDR and target address
+   MEMADDR.  If WRITE is non-zero, transfer them to the target,
+   otherwise transfer them from the target.  TARGET is unused.
+
+   Returns the number of bytes transferred. */
+
 static int
-array_xfer_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* ignored */
+array_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		   struct target_ops *target)
 {
   if (write)
     return array_write_inferior_memory (memaddr, myaddr, len);
@@ -1067,9 +1035,7 @@
 }
 
 static void
-array_kill (args, from_tty)
-     char *args;
-     int from_tty;
+array_kill (char *args, int from_tty)
 {
   return;			/* ignore attempts to kill target system */
 }
@@ -1080,7 +1046,7 @@
    instructions.  */
 
 static void
-array_mourn_inferior ()
+array_mourn_inferior (void)
 {
   remove_breakpoints ();
   generic_mourn_inferior ();	/* Do all the proper things now */
@@ -1095,9 +1061,7 @@
  * array_insert_breakpoint -- add a breakpoint
  */
 static int
-array_insert_breakpoint (addr, shadow)
-     CORE_ADDR addr;
-     char *shadow;
+array_insert_breakpoint (CORE_ADDR addr, char *shadow)
 {
   int i;
   int bp_size = 0;
@@ -1128,9 +1092,7 @@
  * _remove_breakpoint -- Tell the monitor to remove a breakpoint
  */
 static int
-array_remove_breakpoint (addr, shadow)
-     CORE_ADDR addr;
-     char *shadow;
+array_remove_breakpoint (CORE_ADDR addr, char *shadow)
 {
   int i;
 
@@ -1153,7 +1115,7 @@
 }
 
 static void
-array_stop ()
+array_stop (void)
 {
   debuglogs (1, "array_stop()");
   printf_monitor ("\003");
@@ -1166,9 +1128,7 @@
  *      expect_prompt is seen. FIXME
  */
 static void
-monitor_command (args, fromtty)
-     char *args;
-     int fromtty;
+monitor_command (char *args, int fromtty)
 {
   debuglogs (1, "monitor_command (args=%s)", args);
 
@@ -1199,8 +1159,7 @@
  *
  */
 static void
-make_gdb_packet (buf, data)
-     char *buf, *data;
+make_gdb_packet (char *buf, char *data)
 {
   int i;
   unsigned char csum = 0;
@@ -1239,8 +1198,7 @@
  *              successful transmition, or a 0 for a failure.
  */
 static int
-array_send_packet (packet)
-     char *packet;
+array_send_packet (char *packet)
 {
   int c, retries, i;
   char junk[PBUFSIZ];
@@ -1338,8 +1296,7 @@
  *              packet, or a 0 it the packet wasn't transmitted correctly.
  */
 static int
-array_get_packet (packet)
-     char *packet;
+array_get_packet (char *packet)
 {
   int c;
   int retries;
@@ -1433,8 +1390,7 @@
  * ascii2hexword -- convert an ascii number represented by 8 digits to a hex value.
  */
 static unsigned long
-ascii2hexword (mem)
-     unsigned char *mem;
+ascii2hexword (unsigned char *mem)
 {
   unsigned long val;
   int i;
@@ -1462,9 +1418,7 @@
  *      digits.
  */
 static void
-hexword2ascii (mem, num)
-     unsigned char *mem;
-     unsigned long num;
+hexword2ascii (unsigned char *mem, unsigned long num)
 {
   int i;
   unsigned char ch;
@@ -1482,8 +1436,7 @@
 
 /* Convert hex digit A to a number.  */
 static int
-from_hex (a)
-     int a;
+from_hex (int a)
 {
   if (a == 0)
     return 0;
@@ -1503,8 +1456,7 @@
 
 /* Convert number NIB to a hex digit.  */
 static int
-tohex (nib)
-     int nib;
+tohex (int nib)
 {
   if (nib < 10)
     return '0' + nib;
@@ -1517,7 +1469,7 @@
  *              are usually only used by monitors.
  */
 void
-_initialize_remote_monitors ()
+_initialize_remote_monitors (void)
 {
   /* generic monitor command */
   add_com ("monitor", class_obscure, monitor_command,
@@ -1529,7 +1481,7 @@
  * _initialize_array -- do any special init stuff for the target.
  */
 void
-_initialize_array ()
+_initialize_array (void)
 {
   init_array_ops ();
   add_target (&array_ops);
diff --git a/gdb/remote-bug.c b/gdb/remote-bug.c
index 6c331a1..73d37b7 100644
--- a/gdb/remote-bug.c
+++ b/gdb/remote-bug.c
@@ -111,9 +111,7 @@
  */
 
 static void
-bug_load (args, fromtty)
-     char *args;
-     int fromtty;
+bug_load (char *args, int fromtty)
 {
   bfd *abfd;
   asection *s;
@@ -121,7 +119,6 @@
 
   sr_check_open ();
 
-  dcache_flush (gr_get_dcache ());
   inferior_pid = 0;
   abfd = bfd_openr (args, 0);
   if (!abfd)
@@ -159,7 +156,7 @@
 	      gdb_flush (gdb_stdout);
 	    }
 	  printf_filtered ("\n");
-	  free (buffer);
+	  xfree (buffer);
 	}
       s = s->next;
     }
@@ -170,8 +167,7 @@
 
 #if 0
 static char *
-get_word (p)
-     char **p;
+get_word (char **p)
 {
   char *s = *p;
   char *word;
@@ -201,12 +197,9 @@
 
 static struct gr_settings bug_settings =
 {
-  NULL,				/* dcache */
   "Bug>",			/* prompt */
   &bug_ops,			/* ops */
   bug_clear_breakpoints,	/* clear_all_breakpoints */
-  bug_read_memory,		/* readfunc */
-  bug_write_memory,		/* writefunc */
   gr_generic_checkin,		/* checkin */
 };
 
@@ -217,9 +210,7 @@
 };
 
 static void
-bug_open (args, from_tty)
-     char *args;
-     int from_tty;
+bug_open (char *args, int from_tty)
 {
   if (args == NULL)
     args = "";
@@ -245,12 +236,8 @@
 /* Tell the remote machine to resume.  */
 
 void
-bug_resume (pid, step, sig)
-     int pid, step;
-     enum target_signal sig;
+bug_resume (int pid, int step, enum target_signal sig)
 {
-  dcache_flush (gr_get_dcache ());
-
   if (step)
     {
       sr_write_cr ("t");
@@ -279,9 +266,7 @@
 };
 
 int
-bug_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+bug_wait (int pid, struct target_waitstatus *status)
 {
   int old_timeout = sr_get_timeout ();
   int old_immediate_quit = immediate_quit;
@@ -352,8 +337,7 @@
 
    Returns a pointer to a static buffer containing the answer.  */
 static char *
-get_reg_name (regno)
-     int regno;
+get_reg_name (int regno)
 {
   static char *rn[] =
   {
@@ -386,8 +370,7 @@
    success, -1 on failure.  */
 
 static int
-bug_scan (s)
-     char *s;
+bug_scan (char *s)
 {
   int c;
 
@@ -407,8 +390,7 @@
 #endif /* never */
 
 static int
-bug_srec_write_cr (s)
-     char *s;
+bug_srec_write_cr (char *s)
 {
   char *p = s;
 
@@ -434,8 +416,7 @@
 /* Store register REGNO, or all if REGNO == -1. */
 
 static void
-bug_fetch_register (regno)
-     int regno;
+bug_fetch_register (int regno)
 {
   sr_check_open ();
 
@@ -513,8 +494,7 @@
 /* Store register REGNO, or all if REGNO == -1. */
 
 static void
-bug_store_register (regno)
-     int regno;
+bug_store_register (int regno)
 {
   char buffer[1024];
   sr_check_open ();
@@ -567,87 +547,31 @@
   return;
 }
 
+/* Transfer LEN bytes between GDB address MYADDR and target address
+   MEMADDR.  If WRITE is non-zero, transfer them to the target,
+   otherwise transfer them from the target.  TARGET is unused.
+
+   Returns the number of bytes transferred. */
+
 int
-bug_xfer_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* ignored */
+bug_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		 struct target_ops *target)
 {
-  register int i;
+  int res;
 
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr;
-
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count;
-
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer;
-
-  addr = memaddr & -sizeof (int);
-  count = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-
-  buffer = (int *) alloca (count * sizeof (int));
+  if (len <= 0)
+    return 0;
 
   if (write)
-    {
-      /* Fill start and end extra bytes of buffer with existing memory data.  */
-
-      if (addr != memaddr || len < (int) sizeof (int))
-	{
-	  /* Need part of initial word -- fetch it.  */
-	  buffer[0] = gr_fetch_word (addr);
-	}
-
-      if (count > 1)		/* FIXME, avoid if even boundary */
-	{
-	  buffer[count - 1]
-	    = gr_fetch_word (addr + (count - 1) * sizeof (int));
-	}
-
-      /* Copy data to be written over corresponding part of buffer */
-
-      memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
-
-      /* Write the entire buffer.  */
-
-      for (i = 0; i < count; i++, addr += sizeof (int))
-	{
-	  errno = 0;
-	  gr_store_word (addr, buffer[i]);
-	  if (errno)
-	    {
-
-	      return 0;
-	    }
-
-	}
-    }
+    res = bug_write_memory (memaddr, myaddr, len);
   else
-    {
-      /* Read all the longwords */
-      for (i = 0; i < count; i++, addr += sizeof (int))
-	{
-	  errno = 0;
-	  buffer[i] = gr_fetch_word (addr);
-	  if (errno)
-	    {
-	      return 0;
-	    }
-	  QUIT;
-	}
+    res = bug_read_memory (memaddr, myaddr, len);
 
-      /* Copy appropriate bytes out of the buffer.  */
-      memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-    }
-
-  return len;
+  return res;
 }
 
 static void
-start_load ()
+start_load (void)
 {
   char *command;
 
@@ -681,10 +605,7 @@
 };
 
 static int
-bug_write_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     unsigned char *myaddr;
-     int len;
+bug_write_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 {
   int done;
   int checksum;
@@ -808,10 +729,7 @@
 /* Read LEN bytes from inferior memory at MEMADDR.  Put the result
    at debugger address MYADDR.  Returns errno value.  */
 static int
-bug_read_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     unsigned char *myaddr;
-     int len;
+bug_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 {
   char request[100];
   char *buffer;
@@ -908,10 +826,14 @@
 
 #define MAX_BREAKS	16
 static int num_brkpts = 0;
+
+/* Insert a breakpoint at ADDR.  SAVE is normally the address of the
+   pattern buffer where the instruction that the breakpoint overwrites
+   is saved.  It is unused here since the bug is responsible for
+   saving/restoring the original instruction. */
+
 static int
-bug_insert_breakpoint (addr, save)
-     CORE_ADDR addr;
-     char *save;		/* Throw away, let bug save instructions */
+bug_insert_breakpoint (CORE_ADDR addr, char *save)
 {
   sr_check_open ();
 
@@ -933,10 +855,13 @@
     }
 
 }
+
+/* Remove a breakpoint at ADDR.  SAVE is normally the previously
+   saved pattern, but is unused here since the bug is responsible
+   for saving/restoring instructions. */
+
 static int
-bug_remove_breakpoint (addr, save)
-     CORE_ADDR addr;
-     char *save;		/* Throw away, let bug save instructions */
+bug_remove_breakpoint (CORE_ADDR addr, char *save)
 {
   if (num_brkpts > 0)
     {
@@ -953,7 +878,7 @@
 
 /* Clear the bugs notion of what the break points are */
 static int
-bug_clear_breakpoints ()
+bug_clear_breakpoints (void)
 {
 
   if (sr_is_open ())
@@ -1038,7 +963,7 @@
 }				/* init_bug_ops */
 
 void
-_initialize_remote_bug ()
+_initialize_remote_bug (void)
 {
   init_bug_ops ();
   add_target (&bug_ops);
diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c
index 6de0315..fbe3602 100644
--- a/gdb/remote-e7000.c
+++ b/gdb/remote-e7000.c
@@ -1,5 +1,5 @@
 /* Remote debugging interface for Hitachi E7000 ICE, for GDB
-   Copyright 1993, 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1993, 1994, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
    Contributed by Cygnus Support. 
 
    Written by Steve Chamberlain for Cygnus Support.
@@ -61,6 +61,31 @@
 #define ACK  0x06
 #define CTRLZ 0x1a
 
+/* This file is used by 2 different targets, sh-elf and h8300. The
+   h8300 is not multiarched and doesn't use the registers defined in
+   tm-sh.h. To avoid using a macro GDB_TARGET_IS_SH, we do runtime check
+   of the target, which requires that these namse below are always
+   defined also in the h8300 case. */
+
+#if !defined (PR_REGNUM)
+#define PR_REGNUM 	-1
+#endif
+#if !defined (GBR_REGNUM)
+#define GBR_REGNUM 	-1
+#endif
+#if !defined (VBR_REGNUM)
+#define VBR_REGNUM 	-1
+#endif
+#if !defined (MACH_REGNUM)
+#define MACH_REGNUM 	-1
+#endif
+#if !defined (MACL_REGNUM)
+#define MACL_REGNUM 	-1
+#endif
+#if !defined (SR_REGNUM)
+#define SR_REGNUM 	-1
+#endif
+
 extern void notice_quit (void);
 
 extern void report_transfer_performance (unsigned long, time_t, time_t);
@@ -123,8 +148,7 @@
 /* Send data to e7000debug.  */
 
 static void
-puts_e7000debug (buf)
-     char *buf;
+puts_e7000debug (char *buf)
 {
   if (!e7000_desc)
     error ("Use \"target e7000 ...\" first.");
@@ -143,8 +167,7 @@
 }
 
 static void
-putchar_e7000 (x)
-     int x;
+putchar_e7000 (int x)
 {
   char b[1];
 
@@ -153,15 +176,13 @@
 }
 
 static void
-write_e7000 (s)
-     char *s;
+write_e7000 (char *s)
 {
   SERIAL_WRITE (e7000_desc, s, strlen (s));
 }
 
 static int
-normal (x)
-     int x;
+normal (int x)
 {
   if (x == '\n')
     return '\r';
@@ -173,8 +194,7 @@
    returns -1, else returns next char.  Discards chars > 127.  */
 
 static int
-readchar (timeout)
-     int timeout;
+readchar (int timeout)
 {
   int c;
 
@@ -205,7 +225,7 @@
 
 #if 0
 char *
-tl (x)
+tl (int x)
 {
   static char b[8][10];
   static int p;
@@ -231,8 +251,7 @@
    out.  Let the user break out immediately.  */
 
 static void
-expect (string)
-     char *string;
+expect (char *string)
 {
   char *p = string;
   int c;
@@ -302,20 +321,19 @@
    into states from which we can't recover.  */
 
 static void
-expect_prompt ()
+expect_prompt (void)
 {
   expect (":");
 }
 
 static void
-expect_full_prompt ()
+expect_full_prompt (void)
 {
   expect ("\r:");
 }
 
 static int
-convert_hex_digit (ch)
-     int ch;
+convert_hex_digit (int ch)
 {
   if (ch >= '0' && ch <= '9')
     return ch - '0';
@@ -327,8 +345,7 @@
 }
 
 static int
-get_hex (start)
-     int *start;
+get_hex (int *start)
 {
   int value = convert_hex_digit (*start);
   int try;
@@ -348,9 +365,7 @@
    them in registers starting at REGNO.  */
 
 static void
-get_hex_regs (n, regno)
-     int n;
-     int regno;
+get_hex_regs (int n, int regno)
 {
   long val;
   int i;
@@ -371,10 +386,7 @@
    user types "run" after having attached.  */
 
 static void
-e7000_create_inferior (execfile, args, env)
-     char *execfile;
-     char *args;
-     char **env;
+e7000_create_inferior (char *execfile, char *args, char **env)
 {
   int entry_pt;
 
@@ -423,8 +435,7 @@
 /* Grab the next token and buy some space for it */
 
 static char *
-next (ptr)
-     char **ptr;
+next (char **ptr)
 {
   char *p = *ptr;
   char *s;
@@ -447,9 +458,7 @@
 }
 
 static void
-e7000_login_command (args, from_tty)
-     char *args;
-     int from_tty;
+e7000_login_command (char *args, int from_tty)
 {
   if (args)
     {
@@ -471,9 +480,7 @@
 /* Start an ftp transfer from the E7000 to a host */
 
 static void
-e7000_ftp_command (args, from_tty)
-     char *args;
-     int from_tty;
+e7000_ftp_command (char *args, int from_tty)
 {
   /* FIXME: arbitrary limit on machine names and such.  */
   char buf[200];
@@ -503,10 +510,7 @@
 }
 
 static int
-e7000_parse_device (args, dev_name, baudrate)
-     char *args;
-     char *dev_name;
-     int baudrate;
+e7000_parse_device (char *args, char *dev_name, int baudrate)
 {
   char junk[128];
   int n = 0;
@@ -558,15 +562,14 @@
 /* Stub for catch_errors.  */
 
 static int
-e7000_start_remote (dummy)
-     char *dummy;
+e7000_start_remote (void *dummy)
 {
   int loop;
   int sync;
   int try;
   int quit_trying;
 
-  immediate_quit = 1;		/* Allow user to interrupt it */
+  immediate_quit++;		/* Allow user to interrupt it */
 
   /* Hello?  Are you there?  */
   sync = 0;
@@ -624,7 +627,7 @@
   if (!sync)
     {
       fprintf_unfiltered (gdb_stderr, "Giving up after %d tries...\n", try);
-      error ("Unable to syncronize with target.\n");
+      error ("Unable to synchronize with target.\n");
     }
 
   puts_e7000debug ("\r");
@@ -632,7 +635,7 @@
   puts_e7000debug ("b -\r");	/* Clear breakpoints */
   expect_prompt ();
 
-  immediate_quit = 0;
+  immediate_quit--;
 
 /* This is really the job of start_remote however, that makes an assumption
    that the target is about to print out a status message of some sort.  That
@@ -649,9 +652,7 @@
 }
 
 static void
-e7000_open (args, from_tty)
-     char *args;
-     int from_tty;
+e7000_open (char *args, int from_tty)
 {
   int n;
 
@@ -686,8 +687,7 @@
 /* Close out all files and local state before this target loses control. */
 
 static void
-e7000_close (quitting)
-     int quitting;
+e7000_close (int quitting)
 {
   if (e7000_desc)
     {
@@ -700,8 +700,7 @@
    when you want to detach and do something else with your gdb.  */
 
 static void
-e7000_detach (from_tty)
-     int from_tty;
+e7000_detach (char *arg, int from_tty)
 {
   pop_target ();		/* calls e7000_close to do the real work */
   if (from_tty)
@@ -711,8 +710,7 @@
 /* Tell the remote machine to resume.  */
 
 static void
-e7000_resume (pid, step, sig)
-     int pid, step, sig;
+e7000_resume (int pid, int step, enum target_signal sigal)
 {
   if (step)
     puts_e7000debug ("S\r");
@@ -732,8 +730,6 @@
    BREAK POINT
  */
 
-#ifdef GDB_TARGET_IS_H8300
-
 char *want_h8300h = "PC=%p CCR=%c\n\
  ER0 - ER3  %0 %1 %2 %3\n\
  ER4 - ER7  %4 %5 %6 %7\n";
@@ -751,17 +747,13 @@
  ER0 - ER3  %0 %1 %2 %3\n\
  ER4 - ER7  %4 %5 %6 %7";
 
-#endif
-
-#ifdef GDB_TARGET_IS_SH
-
-char *want = "PC=%16 SR=%22\n\
+char *want_sh = "PC=%16 SR=%22\n\
 PR=%17 GBR=%18 VBR=%19\n\
 MACH=%20 MACL=%21\n\
 R0-7  %0 %1 %2 %3 %4 %5 %6 %7\n\
 R8-15 %8 %9 %10 %11 %12 %13 %14 %15\n";
 
-char *want_nopc = "%16 SR=%22\n\
+char *want_nopc_sh = "%16 SR=%22\n\
  PR=%17 GBR=%18 VBR=%19\n\
  MACH=%20 MACL=%21\n\
  R0-7  %0 %1 %2 %3 %4 %5 %6 %7\n\
@@ -777,7 +769,7 @@
 R0_BANK1-R3_BANK1 %33 %34 %35 %36\n\
 R4_BANK1-R7_BANK1 %37 %38 %39 %40";
 
-char *want_sh3_nopc = "%16 SR=%22\n\
+char *want_nopc_sh3 = "%16 SR=%22\n\
  PR=%17 GBR=%18 VBR=%19\n\
  MACH=%20 MACL=%21 SSR=%22 SPC=%23\n\
  R0-7  %0 %1 %2 %3 %4 %5 %6 %7\n\
@@ -787,16 +779,14 @@
  R0_BANK1-R3_BANK1 %33 %34 %35 %36\n\
  R4_BANK1-R7_BANK1 %37 %38 %39 %40";
 
-#endif
-
 static int
-gch ()
+gch (void)
 {
   return readchar (timeout);
 }
 
 static unsigned int
-gbyte ()
+gbyte (void)
 {
   int high = convert_hex_digit (gch ());
   int low = convert_hex_digit (gch ());
@@ -805,9 +795,7 @@
 }
 
 void
-fetch_regs_from_dump (nextchar, want)
-     int (*nextchar) ();
-     char *want;
+fetch_regs_from_dump (int (*nextchar) (), char *want)
 {
   int regno;
   char buf[MAX_REGISTER_RAW_SIZE];
@@ -905,7 +893,7 @@
 	    }
 	  store_signed_integer (buf,
 				REGISTER_RAW_SIZE (regno),
-				(LONGEST) get_hex (&thischar, nextchar));
+				(LONGEST) get_hex (&thischar));
 	  supply_register (regno, buf);
 	  break;
 	}
@@ -913,29 +901,34 @@
 }
 
 static void
-e7000_fetch_registers ()
+e7000_fetch_registers (void)
 {
   int regno;
   char *wanted;
 
   puts_e7000debug ("R\r");
 
-#ifdef GDB_TARGET_IS_SH
-  wanted = want;
   if (TARGET_ARCHITECTURE->arch == bfd_arch_sh)
-    switch (TARGET_ARCHITECTURE->mach)
-      {
-      case bfd_mach_sh3:
-      case bfd_mach_sh3e:
-      case bfd_mach_sh4:
-	wanted = want_sh3;
-      }
-#else
-  if (h8300smode)
-    wanted = want_h8300s;
-  else
-    wanted = want_h8300h;
+    {
+      wanted = want_sh;
+      switch (TARGET_ARCHITECTURE->mach)
+	{
+	case bfd_mach_sh3:
+	case bfd_mach_sh3e:
+	case bfd_mach_sh4:
+	  wanted = want_sh3;
+	}
+    }
+#ifdef GDB_TARGET_IS_H8300
+  if (TARGET_ARCHITECTURE->arch == bfd_arch_h8300)
+    {
+      if (h8300smode)
+	wanted = want_h8300s;
+      else
+	wanted = want_h8300h;
+    }
 #endif
+
   fetch_regs_from_dump (gch, wanted);
 
   /* And supply the extra ones the simulator uses */
@@ -951,8 +944,7 @@
    errno value.  */
 
 static void
-e7000_fetch_register (regno)
-     int regno;
+e7000_fetch_register (int regno)
 {
   e7000_fetch_registers ();
 }
@@ -960,7 +952,7 @@
 /* Store the remote registers from the contents of the block REGS.  */
 
 static void
-e7000_store_registers ()
+e7000_store_registers (void)
 {
   int regno;
 
@@ -973,8 +965,7 @@
 /* Store register REGNO, or all if REGNO == 0.  Return errno value.  */
 
 static void
-e7000_store_register (regno)
-     int regno;
+e7000_store_register (int regno)
 {
   char buf[200];
 
@@ -984,69 +975,76 @@
       return;
     }
 
-#ifdef GDB_TARGET_IS_H8300
-  if (regno <= 7)
+  if (TARGET_ARCHITECTURE->arch == bfd_arch_h8300)
     {
-      sprintf (buf, ".ER%d %x\r", regno, read_register (regno));
-      puts_e7000debug (buf);
-    }
-  else if (regno == PC_REGNUM)
-    {
-      sprintf (buf, ".PC %x\r", read_register (regno));
-      puts_e7000debug (buf);
-    }
-  else if (regno == CCR_REGNUM)
-    {
-      sprintf (buf, ".CCR %x\r", read_register (regno));
-      puts_e7000debug (buf);
-    }
-#endif /* GDB_TARGET_IS_H8300 */
-
-#ifdef  GDB_TARGET_IS_SH
-  switch (regno)
-    {
-    default:
-      sprintf (buf, ".R%d %x\r", regno, read_register (regno));
-      puts_e7000debug (buf);
-      break;
-
-    case PC_REGNUM:
-      sprintf (buf, ".PC %x\r", read_register (regno));
-      puts_e7000debug (buf);
-      break;
-
-    case SR_REGNUM:
-      sprintf (buf, ".SR %x\r", read_register (regno));
-      puts_e7000debug (buf);
-      break;
-
-    case PR_REGNUM:
-      sprintf (buf, ".PR %x\r", read_register (regno));
-      puts_e7000debug (buf);
-      break;
-
-    case GBR_REGNUM:
-      sprintf (buf, ".GBR %x\r", read_register (regno));
-      puts_e7000debug (buf);
-      break;
-
-    case VBR_REGNUM:
-      sprintf (buf, ".VBR %x\r", read_register (regno));
-      puts_e7000debug (buf);
-      break;
-
-    case MACH_REGNUM:
-      sprintf (buf, ".MACH %x\r", read_register (regno));
-      puts_e7000debug (buf);
-      break;
-
-    case MACL_REGNUM:
-      sprintf (buf, ".MACL %x\r", read_register (regno));
-      puts_e7000debug (buf);
-      break;
+      if (regno <= 7)
+	{
+	  sprintf (buf, ".ER%d %lx\r", regno, read_register (regno));
+	  puts_e7000debug (buf);
+	}
+      else if (regno == PC_REGNUM)
+	{
+	  sprintf (buf, ".PC %lx\r", read_register (regno));
+	  puts_e7000debug (buf);
+	}
+#ifdef CCR_REGNUM
+      else if (regno == CCR_REGNUM)
+	{
+	  sprintf (buf, ".CCR %lx\r", read_register (regno));
+	  puts_e7000debug (buf);
+	}
+#endif
     }
 
-#endif /* GDB_TARGET_IS_SH */
+  else if (TARGET_ARCHITECTURE->arch == bfd_arch_sh)
+    {
+      if (regno == PC_REGNUM)
+	{
+	  sprintf (buf, ".PC %lx\r", read_register (regno));
+	  puts_e7000debug (buf);
+	}
+
+      else if (regno == SR_REGNUM)
+	{
+	  sprintf (buf, ".SR %lx\r", read_register (regno));
+	  puts_e7000debug (buf);
+	}
+
+      else if (regno ==  PR_REGNUM)
+	{
+	  sprintf (buf, ".PR %lx\r", read_register (regno));
+	  puts_e7000debug (buf);
+	}
+
+      else if (regno == GBR_REGNUM)
+	{
+	  sprintf (buf, ".GBR %lx\r", read_register (regno));
+	  puts_e7000debug (buf);
+	}
+
+      else if (regno == VBR_REGNUM)
+	{
+	  sprintf (buf, ".VBR %lx\r", read_register (regno));
+	  puts_e7000debug (buf);
+	}
+
+      else if (regno == MACH_REGNUM)
+	{
+	  sprintf (buf, ".MACH %lx\r", read_register (regno));
+	  puts_e7000debug (buf);
+	}
+
+      else if (regno == MACL_REGNUM)
+	{
+	  sprintf (buf, ".MACL %lx\r", read_register (regno));
+	  puts_e7000debug (buf);
+	}
+      else
+	{
+	  sprintf (buf, ".R%d %lx\r", regno, read_register (regno));
+	  puts_e7000debug (buf);
+	}
+    }
 
   expect_prompt ();
 }
@@ -1058,21 +1056,19 @@
    debugged.  */
 
 static void
-e7000_prepare_to_store ()
+e7000_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
 static void
-e7000_files_info ()
+e7000_files_info (struct target_ops *ops)
 {
   printf_unfiltered ("\tAttached to %s at %d baud.\n", dev_name, baudrate);
 }
 
 static int
-stickbyte (where, what)
-     char *where;
-     unsigned int what;
+stickbyte (char *where, unsigned int what)
 {
   static CONST char digs[] = "0123456789ABCDEF";
 
@@ -1085,10 +1081,7 @@
 /* Write a small ammount of memory. */
 
 static int
-write_small (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     unsigned char *myaddr;
-     int len;
+write_small (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 {
   int i;
   char buf[200];
@@ -1098,7 +1091,7 @@
       if (((memaddr + i) & 3) == 0 && (i + 3 < len))
 	{
 	  /* Can be done with a long word */
-	  sprintf (buf, "m %x %x%02x%02x%02x;l\r",
+	  sprintf (buf, "m %lx %x%02x%02x%02x;l\r",
 		   memaddr + i,
 		   myaddr[i], myaddr[i + 1], myaddr[i + 2], myaddr[i + 3]);
 	  puts_e7000debug (buf);
@@ -1106,7 +1099,7 @@
 	}
       else
 	{
-	  sprintf (buf, "m %x %x\r", memaddr + i, myaddr[i]);
+	  sprintf (buf, "m %lx %x\r", memaddr + i, myaddr[i]);
 	  puts_e7000debug (buf);
 	}
     }
@@ -1132,10 +1125,7 @@
  */
 
 static int
-write_large (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     unsigned char *myaddr;
-     int len;
+write_large (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 {
   int i;
 #define maxstride  128
@@ -1229,10 +1219,7 @@
    then.  */
 
 static int
-e7000_write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     unsigned char *myaddr;
-     int len;
+e7000_write_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 {
   if (len < 16 || using_tcp || using_pc)
     return write_small (memaddr, myaddr, len);
@@ -1250,10 +1237,7 @@
  */
 
 static int
-e7000_read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     unsigned char *myaddr;
-     int len;
+e7000_read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 {
   int count;
   int c;
@@ -1268,7 +1252,7 @@
       return 0;
     }
 
-  sprintf (buf, "m %x;l\r", memaddr);
+  sprintf (buf, "m %lx;l\r", memaddr);
   puts_e7000debug (buf);
 
   for (count = 0; count < len; count += 4)
@@ -1332,10 +1316,8 @@
  */
 
 static int
-e7000_read_inferior_memory_large (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     unsigned char *myaddr;
-     int len;
+e7000_read_inferior_memory_large (CORE_ADDR memaddr, unsigned char *myaddr,
+				  int len)
 {
   int count;
   int c;
@@ -1349,7 +1331,7 @@
       return 0;
     }
 
-  sprintf (buf, "d %x %x\r", memaddr, memaddr + len - 1);
+  sprintf (buf, "d %lx %lx\r", memaddr, memaddr + len - 1);
   puts_e7000debug (buf);
 
   count = 0;
@@ -1397,10 +1379,8 @@
 #if 0
 
 static int
-fast_but_for_the_pause_e7000_read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+fast_but_for_the_pause_e7000_read_inferior_memory (CORE_ADDR memaddr,
+						   char *myaddr, int len)
 {
   int loop;
   int c;
@@ -1486,13 +1466,15 @@
 
 #endif
 
+/* Transfer LEN bytes between GDB address MYADDR and target address
+   MEMADDR.  If WRITE is non-zero, transfer them to the target,
+   otherwise transfer them from the target.  TARGET is unused.
+
+   Returns the number of bytes transferred. */
+
 static int
-e7000_xfer_inferior_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     unsigned char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* ignored */
+e7000_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr,
+			    int len, int write, struct target_ops *target)
 {
   if (write)
     return e7000_write_inferior_memory (memaddr, myaddr, len);
@@ -1503,16 +1485,12 @@
 }
 
 static void
-e7000_kill (args, from_tty)
-     char *args;
-     int from_tty;
+e7000_kill (void)
 {
 }
 
 static void
-e7000_load (args, from_tty)
-     char *args;
-     int from_tty;
+e7000_load (char *args, int from_tty)
 {
   struct cleanup *old_chain;
   asection *section;
@@ -1603,7 +1581,7 @@
 	  section_size = bfd_get_section_size_before_reloc (section);
 
 	  if (!quiet)
-	    printf_filtered ("[Loading section %s at 0x%x (%d bytes)]\n",
+	    printf_filtered ("[Loading section %s at 0x%x (%ud bytes)]\n",
 			     bfd_get_section_name (pbfd, section),
 			     section_address,
 			     section_size);
@@ -1698,7 +1676,7 @@
    instructions.  */
 
 static void
-e7000_mourn_inferior ()
+e7000_mourn_inferior (void)
 {
   remove_breakpoints ();
   unpush_target (&e7000_ops);
@@ -1718,9 +1696,7 @@
 {0};
 
 static int
-e7000_insert_breakpoint (addr, shadow)
-     CORE_ADDR addr;
-     unsigned char *shadow;
+e7000_insert_breakpoint (CORE_ADDR addr, char *shadow)
 {
   int i;
   char buf[200];
@@ -1736,12 +1712,12 @@
 #ifdef HARD_BREAKPOINTS
 	if (BC_BREAKPOINTS)
 	  {
-	    sprintf (buf, "BC%d A=%x\r", i + 1, addr);
+	    sprintf (buf, "BC%d A=%lx\r", i + 1, addr);
 	    puts_e7000debug (buf);
 	  }
 	else
 	  {
-	    sprintf (buf, "B %x\r", addr);
+	    sprintf (buf, "B %lx\r", addr);
 	    puts_e7000debug (buf);
 	  }
 #else
@@ -1763,9 +1739,7 @@
 }
 
 static int
-e7000_remove_breakpoint (addr, shadow)
-     CORE_ADDR addr;
-     unsigned char *shadow;
+e7000_remove_breakpoint (CORE_ADDR addr, char *shadow)
 {
   int i;
   char buf[200];
@@ -1782,12 +1756,12 @@
 	  }
 	else
 	  {
-	    sprintf (buf, "B - %x\r", addr);
+	    sprintf (buf, "B - %lx\r", addr);
 	    puts_e7000debug (buf);
 	  }
 	expect_prompt ();
 #else
-	sprintf (buf, "B - %x\r", addr);
+	sprintf (buf, "B - %lx\r", addr);
 	puts_e7000debug (buf);
 	expect_prompt ();
 
@@ -1800,7 +1774,7 @@
 	return 0;
       }
 
-  warning ("Can't find breakpoint associated with 0x%x\n", addr);
+  warning ("Can't find breakpoint associated with 0x%lx\n", addr);
   return 1;
 }
 
@@ -1808,9 +1782,7 @@
    is placed on the users terminal until the prompt is seen. */
 
 static void
-e7000_command (args, fromtty)
-     char *args;
-     int fromtty;
+e7000_command (char *args, int fromtty)
 {
   /* FIXME: arbitrary limit on length of args.  */
   char buf[200];
@@ -1842,10 +1814,7 @@
 
 
 static void
-e7000_drain_command (args, fromtty)
-     char *args;
-     int fromtty;
-
+e7000_drain_command (char *args, int fromtty)
 {
   int c;
 
@@ -1869,7 +1838,7 @@
 #define NITEMS 7
 
 static int
-why_stop ()
+why_stop (void)
 {
   static char *strings[NITEMS] =
   {
@@ -1914,8 +1883,7 @@
    otherwise echo them.  */
 
 int
-expect_n (strings)
-     char **strings;
+expect_n (char **strings)
 {
   char *(ptr[10]);
   int n;
@@ -1999,7 +1967,7 @@
    pc, and the simulators never do. */
 
 static void
-sub2_from_pc ()
+sub2_from_pc (void)
 {
   char buf[4];
   char buf2[200];
@@ -2008,7 +1976,7 @@
 			REGISTER_RAW_SIZE (PC_REGNUM),
 			read_register (PC_REGNUM) - 2);
   supply_register (PC_REGNUM, buf);
-  sprintf (buf2, ".PC %x\r", read_register (PC_REGNUM));
+  sprintf (buf2, ".PC %lx\r", read_register (PC_REGNUM));
   puts_e7000debug (buf2);
 }
 
@@ -2030,9 +1998,7 @@
    STATUS just as `wait' would.  */
 
 static int
-e7000_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+e7000_wait (int pid, struct target_waitstatus *status)
 {
   int stop_reason;
   int regno;
@@ -2078,21 +2044,25 @@
   /* Skip till the PC= */
   expect ("=");
 
-#ifdef GDB_TARGET_IS_SH
-  wanted_nopc = want_nopc;
   if (TARGET_ARCHITECTURE->arch == bfd_arch_sh)
-    switch (TARGET_ARCHITECTURE->mach)
-      {
-      case bfd_mach_sh3:
-      case bfd_mach_sh3e:
-      case bfd_mach_sh4:
-	wanted_nopc = want_sh3_nopc;
-      }
-#else
-  if (h8300smode)
-    wanted_nopc = want_nopc_h8300s;
-  else
-    wanted_nopc = want_nopc_h8300h;
+    {
+      wanted_nopc = want_nopc_sh;
+      switch (TARGET_ARCHITECTURE->mach)
+	{
+	case bfd_mach_sh3:
+	case bfd_mach_sh3e:
+	case bfd_mach_sh4:
+	  wanted_nopc = want_nopc_sh3;
+	}
+    }
+#ifdef GDB_TARGET_IS_H8300
+  if (TARGET_ARCHITECTURE->arch == bfd_arch_h8300)
+    {
+      if (h8300smode)
+	wanted_nopc = want_nopc_h8300s;
+      else
+	wanted_nopc = want_nopc_h8300h;
+    }
 #endif
   fetch_regs_from_dump (gch, wanted_nopc);
 
@@ -2156,7 +2126,7 @@
 /* Stop the running program.  */
 
 static void
-e7000_stop ()
+e7000_stop (void)
 {
   /* Sending a ^C is supposed to stop the running program.  */
   putchar_e7000 (CTRLC);
@@ -2241,7 +2211,7 @@
 };
 
 void
-_initialize_remote_e7000 ()
+_initialize_remote_e7000 (void)
 {
   init_e7000_ops ();
   add_target (&e7000_ops);
diff --git a/gdb/remote-eb.c b/gdb/remote-eb.c
index 7a8d90d..9ccac6f 100644
--- a/gdb/remote-eb.c
+++ b/gdb/remote-eb.c
@@ -65,7 +65,7 @@
 /* Read a character from the remote system, doing all the fancy
    timeout stuff.  */
 static int
-readchar ()
+readchar (void)
 {
   char buf;
 
@@ -96,12 +96,11 @@
 /* Keep discarding input from the remote system, until STRING is found. 
    Let the user break out immediately.  */
 static void
-expect (string)
-     char *string;
+expect (char *string)
 {
   char *p = string;
 
-  immediate_quit = 1;
+  immediate_quit++;
   while (1)
     {
       if (readchar () == *p)
@@ -109,7 +108,7 @@
 	  p++;
 	  if (*p == '\0')
 	    {
-	      immediate_quit = 0;
+	      immediate_quit--;
 	      return;
 	    }
 	}
@@ -133,7 +132,7 @@
    necessary to prevent getting into states from which we can't
    recover.  */
 static void
-expect_prompt ()
+expect_prompt (void)
 {
 #if defined (LOG_FILE)
   /* This is a convenient place to do this.  The idea is to do it often
@@ -146,8 +145,7 @@
 /* Get a hex digit from the remote system & return its value.
    If ignore_space is nonzero, ignore spaces (not newline, tab, etc).  */
 static int
-get_hex_digit (ignore_space)
-     int ignore_space;
+get_hex_digit (int ignore_space)
 {
   int ch;
   while (1)
@@ -172,8 +170,7 @@
 /* Get a byte from eb_desc and put it in *BYT.  Accept any number
    leading spaces.  */
 static void
-get_hex_byte (byt)
-     char *byt;
+get_hex_byte (char *byt)
 {
   int val;
 
@@ -185,9 +182,7 @@
 /* Get N 32-bit words from remote, each preceded by a space,
    and put them in registers starting at REGNO.  */
 static void
-get_hex_regs (n, regno)
-     int n;
-     int regno;
+get_hex_regs (int n, int regno)
 {
   long val;
   int i;
@@ -213,7 +208,7 @@
 volatile int n_alarms;
 
 void
-eb_timer ()
+eb_timer (void)
 {
 #if 0
   if (kiodebug)
@@ -239,10 +234,7 @@
 /* This is called not only when we first attach, but also when the
    user types "run" after having attached.  */
 static void
-eb_create_inferior (execfile, args, env)
-     char *execfile;
-     char *args;
-     char **env;
+eb_create_inferior (char *execfile, char *args, char **env)
 {
   int entry_pt;
 
@@ -377,8 +369,7 @@
 };
 
 int
-damn_b (rate)
-     int rate;
+damn_b (int rate)
 {
   int i;
 
@@ -396,9 +387,7 @@
 static int baudrate = 9600;
 static char *dev_name;
 void
-eb_open (name, from_tty)
-     char *name;
-     int from_tty;
+eb_open (char *name, int from_tty)
 {
   TERMINAL sg;
 
@@ -437,7 +426,7 @@
     /*EMPTY */ ;
 
   if (prog_name != NULL)
-    free (prog_name);
+    xfree (prog_name);
   prog_name = savestring (p, strlen (p));
 
   eb_close (0);
@@ -494,8 +483,7 @@
 /* Close out all files and local state before this target loses control. */
 
 static void
-eb_close (quitting)
-     int quitting;
+eb_close (int quitting)
 {
 
   /* Due to a bug in Unix, fclose closes not only the stdio stream,
@@ -525,8 +513,7 @@
    Use this when you want to detach and do something else
    with your gdb.  */
 void
-eb_detach (from_tty)
-     int from_tty;
+eb_detach (int from_tty)
 {
   pop_target ();		/* calls eb_close to do the real work */
   if (from_tty)
@@ -536,9 +523,7 @@
 /* Tell the remote machine to resume.  */
 
 void
-eb_resume (pid, step, sig)
-     int pid, step;
-     enum target_signal sig;
+eb_resume (int pid, int step, enum target_signal sig)
 {
   if (step)
     {
@@ -578,8 +563,7 @@
    storing status in STATUS just as `wait' would.  */
 
 int
-eb_wait (status)
-     struct target_waitstatus *status;
+eb_wait (struct target_waitstatus *status)
 {
   /* Strings to look for.  '?' means match any single character.  
      Note that with the algorithm we use, the initial character
@@ -678,8 +662,7 @@
 
    Returns a pointer to a static buffer containing the answer.  */
 static char *
-get_reg_name (regno)
-     int regno;
+get_reg_name (int regno)
 {
   static char buf[80];
   if (regno >= GR96_REGNUM && regno < GR96_REGNUM + 32)
@@ -704,7 +687,7 @@
 /* Read the remote registers into the block REGS.  */
 
 static void
-eb_fetch_registers ()
+eb_fetch_registers (void)
 {
   int reg_index;
   int regnum_index;
@@ -798,8 +781,7 @@
 /* Fetch register REGNO, or all registers if REGNO is -1.
    Returns errno value.  */
 void
-eb_fetch_register (regno)
-     int regno;
+eb_fetch_register (int regno)
 {
   if (regno == -1)
     eb_fetch_registers ();
@@ -818,7 +800,7 @@
 /* Store the remote registers from the contents of the block REGS.  */
 
 static void
-eb_store_registers ()
+eb_store_registers (void)
 {
   int i, j;
   fprintf (eb_stream, "s gr1,%x\n", read_register (GR1_REGNUM));
@@ -857,8 +839,7 @@
 /* Store register REGNO, or all if REGNO == 0.
    Return errno value.  */
 void
-eb_store_register (regno)
-     int regno;
+eb_store_register (int regno)
 {
   if (regno == -1)
     eb_store_registers ();
@@ -885,20 +866,20 @@
    debugged.  */
 
 void
-eb_prepare_to_store ()
+eb_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
+/* Transfer LEN bytes between GDB address MYADDR and target address
+   MEMADDR.  If WRITE is non-zero, transfer them to the target,
+   otherwise transfer them from the target.  TARGET is unused.
 
-/* FIXME-someday!  Merge these two.  */
+   Returns the number of bytes transferred. */
+
 int
-eb_xfer_inferior_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* ignored */
+eb_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+			 struct target_ops *target)
 {
   if (write)
     return eb_write_inferior_memory (memaddr, myaddr, len);
@@ -907,7 +888,7 @@
 }
 
 void
-eb_files_info ()
+eb_files_info (void)
 {
   printf ("\tAttached to %s at %d baud and running program %s.\n",
 	  dev_name, baudrate, prog_name);
@@ -916,10 +897,7 @@
 /* Copy LEN bytes of data from debugger memory at MYADDR
    to inferior's memory at MEMADDR.  Returns length moved.  */
 int
-eb_write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+eb_write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int i;
 
@@ -941,10 +919,7 @@
 /* Read LEN bytes from inferior memory at MEMADDR.  Put the result
    at debugger address MYADDR.  Returns length moved.  */
 int
-eb_read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+eb_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int i;
 
@@ -1014,9 +989,7 @@
 }
 
 static void
-eb_kill (args, from_tty)
-     char *args;
-     int from_tty;
+eb_kill (char *args, int from_tty)
 {
   return;			/* Ignore attempts to kill target system */
 }
@@ -1028,7 +1001,7 @@
    instructions.  */
 
 void
-eb_mourn_inferior ()
+eb_mourn_inferior (void)
 {
   remove_breakpoints ();
   unpush_target (&eb_ops);
@@ -1111,7 +1084,7 @@
 };
 
 void
-_initialize_remote_eb ()
+_initialize_remote_eb (void)
 {
   init_eb_ops ();
   add_target (&eb_ops);
diff --git a/gdb/remote-es.c b/gdb/remote-es.c
index 6805a7d..b2cabce 100644
--- a/gdb/remote-es.c
+++ b/gdb/remote-es.c
@@ -249,7 +249,7 @@
    Rely on global variables: old_sigint(), interrupt */
 
 static void
-es1800_request_quit ()
+es1800_request_quit (void)
 {
   /* restore original signalhandler */
   signal (SIGINT, old_sigint);
@@ -262,8 +262,7 @@
    quit - return to '(esgdb)' prompt or continue        */
 
 static void
-es1800_reset (quit)
-     char *quit;
+es1800_reset (char *quit)
 {
   char buf[80];
 
@@ -290,9 +289,7 @@
    from_tty - says whether to be verbose or not */
 
 static void
-es1800_open (name, from_tty)
-     char *name;
-     int from_tty;
+es1800_open (char *name, int from_tty)
 {
   char buf[PBUFSIZ];
   char *p;
@@ -423,8 +420,7 @@
    quitting - are we quitting gdb now? */
 
 static void
-es1800_close (quitting)
-     int quitting;
+es1800_close (int quitting)
 {
   if (es1800_desc != NULL)
     {
@@ -437,7 +433,7 @@
     }
   if (savename != NULL)
     {
-      free (savename);
+      xfree (savename);
     }
   savename = NULL;
 
@@ -465,9 +461,7 @@
    from_tty - says whether to be verbose or not */
 
 static void
-es1800_attach (args, from_tty)
-     char *args;
-     int from_tty;
+es1800_attach (char *args, int from_tty)
 {
   error ("Cannot attach to pid %s, this feature is not implemented yet.",
 	 args);
@@ -485,9 +479,7 @@
    from_tty - says whether to be verbose or not */
 
 static void
-es1800_detach (args, from_tty)
-     char *args;
-     int from_tty;
+es1800_detach (char *args, int from_tty)
 {
   if (args)
     {
@@ -506,10 +498,7 @@
    siggnal - the signal value to be given to the target (0 = no signal) */
 
 static void
-es1800_resume (pid, step, siggnal)
-     int pid;
-     int step;
-     enum target_signal siggnal;
+es1800_resume (int pid, int step, enum target_signal siggnal)
 {
   char buf[PBUFSIZ];
 
@@ -533,9 +522,7 @@
    status -  */
 
 static int
-es1800_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+es1800_wait (int pid, struct target_waitstatus *status)
 {
   unsigned char buf[PBUFSIZ];
   int old_timeout = timeout;
@@ -608,8 +595,7 @@
    regno - the register to be fetched (fetch all registers if -1) */
 
 static void
-es1800_fetch_register (regno)
-     int regno;
+es1800_fetch_register (int regno)
 {
   char buf[PBUFSIZ];
   int k;
@@ -646,7 +632,7 @@
    Always fetches all registers. */
 
 static void
-es1800_fetch_registers ()
+es1800_fetch_registers (void)
 {
   char buf[PBUFSIZ];
   char SR_buf[PBUFSIZ];
@@ -818,8 +804,7 @@
    FIXME: Return errno value.  */
 
 static void
-es1800_store_register (regno)
-     int regno;
+es1800_store_register (int regno)
 {
 
   static char regtab[18][4] =
@@ -917,7 +902,7 @@
 /* Prepare to store registers.  */
 
 static void
-es1800_prepare_to_store ()
+es1800_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
@@ -925,8 +910,7 @@
 /* Convert hex digit A to a number.  */
 
 static int
-fromhex (a)
-     int a;
+fromhex (int a)
 {
   if (a >= '0' && a <= '9')
     {
@@ -951,8 +935,7 @@
 /* Convert number NIB to a hex digit.  */
 
 static int
-tohex (nib)
-     int nib;
+tohex (int nib)
 {
   if (nib < 10)
     {
@@ -971,15 +954,12 @@
    memaddr - the target's address
    myaddr  - gdb's address
    len     - number of bytes 
-   write   - write if != 0 otherwise read       */
+   write   - write if != 0 otherwise read
+   tops    - unused */
 
 static int
-es1800_xfer_inferior_memory (memaddr, myaddr, len, write, tops)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *tops;	/* Unused */
+es1800_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
+			     int write, struct target_ops *tops)
 {
   int origlen = len;
   int xfersize;
@@ -1014,10 +994,7 @@
    len     - number of bytes   */
 
 static void
-es1800_write_bytes (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+es1800_write_bytes (CORE_ADDR memaddr, char *myaddr, int len)
 {
   char buf[PBUFSIZ];
   int i;
@@ -1040,10 +1017,7 @@
    len     - number of bytes   */
 
 static void
-es1800_read_bytes (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+es1800_read_bytes (CORE_ADDR memaddr, char *myaddr, int len)
 {
   static int DB_tab[16] =
   {8, 11, 14, 17, 20, 23, 26, 29, 34, 37, 40, 43, 46, 49, 52, 55};
@@ -1088,11 +1062,10 @@
     }
 }
 
-/* Information about the current target  */
+/* Display information about the current target.  TOPS is unused.  */
 
 static void
-es1800_files_info (tops)
-     struct target_ops *tops;	/* Unused */
+es1800_files_info (struct target_ops *tops)
 {
   printf ("ES1800 Attached to %s at %d baud in %s mode\n", savename, 19200,
 	  MODE);
@@ -1111,9 +1084,7 @@
    the target_arch transfer vector, if we ever have one...  */
 
 static int
-es1800_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+es1800_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   int val;
 
@@ -1137,9 +1108,7 @@
    BREAKPOINT bytes.    */
 
 static int
-es1800_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+es1800_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
 
   return (target_write_memory (addr, contents_cache,
@@ -1150,9 +1119,7 @@
    Primitive datastructures containing the es1800 breakpoint instruction  */
 
 static void
-es1800_create_break_insn (ins, vec)
-     char *ins;
-     int vec;
+es1800_create_break_insn (char *ins, int vec)
 {
   if (vec == 15)
     {
@@ -1168,8 +1135,7 @@
    vec - trap vector used for breakpoints  */
 
 static int
-verify_break (vec)
-     int vec;
+verify_break (int vec)
 {
   CORE_ADDR memaddress;
   char buf[8];
@@ -1192,14 +1158,12 @@
 
 
 /* get_break_addr ()
-   find address of breakpint routine
+   find address of breakpoint routine
    vec - trap vector used for breakpoints
    addrp - store the address here       */
 
 static void
-get_break_addr (vec, addrp)
-     int vec;
-     CORE_ADDR *addrp;
+get_break_addr (int vec, CORE_ADDR *addrp)
 {
   CORE_ADDR memaddress = 0;
   int status;
@@ -1236,7 +1200,7 @@
 /* Kill an inferior process */
 
 static void
-es1800_kill ()
+es1800_kill (void)
 {
   if (inferior_pid != 0)
     {
@@ -1255,9 +1219,7 @@
    FIXME Uses emulator overlay memory for trap routine  */
 
 static void
-es1800_load (filename, from_tty)
-     char *filename;
-     int from_tty;
+es1800_load (char *filename, int from_tty)
 {
 
   FILE *instream;
@@ -1273,7 +1235,7 @@
     }
 
   filename = tilde_expand (filename);
-  make_cleanup (free, filename);
+  make_cleanup (xfree, filename);
 
   switch (es1800_load_format)
     {
@@ -1363,9 +1325,7 @@
 #define NUMCPYBYTES 20
 
 static void
-bfd_copy (from_bfd, to_bfd)
-     bfd *from_bfd;
-     bfd *to_bfd;
+bfd_copy (bfd *from_bfd, bfd *to_bfd)
 {
   asection *p, *new;
   int i;
@@ -1417,10 +1377,7 @@
    env      - the environment vector to pass    */
 
 static void
-es1800_create_inferior (execfile, args, env)
-     char *execfile;
-     char *args;
-     char **env;
+es1800_create_inferior (char *execfile, char *args, char **env)
 {
   int entry_pt;
   int pid;
@@ -1496,7 +1453,7 @@
 /* The process has died, clean up.  */
 
 static void
-es1800_mourn_inferior ()
+es1800_mourn_inferior (void)
 {
   remove_breakpoints ();
   unpush_target (&es1800_child_ops);
@@ -1512,9 +1469,7 @@
    read until string is found (== 0)   */
 
 static void
-expect (string, nowait)
-     char *string;
-     int nowait;
+expect (char *string, int nowait)
 {
   char c;
   char *p = string;
@@ -1552,7 +1507,7 @@
 /* Keep discarding input until we see the prompt.  */
 
 static void
-expect_prompt ()
+expect_prompt (void)
 {
   expect (">", 0);
 }
@@ -1565,7 +1520,7 @@
 /* read from stdin */
 
 static int
-readchar ()
+readchar (void)
 {
   char buf[1];
 
@@ -1586,7 +1541,7 @@
    timeout stuff.  */
 
 static int
-readchar ()
+readchar (void)
 {
   int ch;
 
@@ -1617,9 +1572,7 @@
    len    - size of buf  */
 
 static void
-send_with_reply (string, buf, len)
-     char *string, *buf;
-     int len;
+send_with_reply (char *string, char *buf, int len)
 {
   send (string);
   SERIAL_WRITE (es1800_desc, "\r", 1);
@@ -1638,8 +1591,7 @@
    string - the es1800 command  */
 
 static void
-send_command (string)
-     char *string;
+send_command (char *string)
 {
   send (string);
   SERIAL_WRITE (es1800_desc, "\r", 1);
@@ -1655,8 +1607,7 @@
    string - the es1800 command  */
 
 static void
-send (string)
-     char *string;
+send (char *string)
 {
   if (kiodebug)
     {
@@ -1671,9 +1622,7 @@
    len    - size of buf  */
 
 static void
-getmessage (buf, len)
-     char *buf;
-     int len;
+getmessage (char *buf, int len)
 {
   char *bp;
   int c;
@@ -1714,10 +1663,7 @@
 }
 
 static void
-download (instream, from_tty, format)
-     FILE *instream;
-     int from_tty;
-     int format;
+download (FILE *instream, int from_tty, int format)
 {
   char c;
   char buf[160];
@@ -1773,9 +1719,7 @@
 
 /*ARGSUSED */
 static void
-es1800_transparent (args, from_tty)
-     char *args;
-     int from_tty;
+es1800_transparent (char *args, int from_tty)
 {
   int console;
   struct sgttyb modebl;
@@ -1931,9 +1875,7 @@
 #endif /* PROVIDE_TRANSPARENT */
 
 static void
-es1800_init_break (args, from_tty)
-     char *args;
-     int from_tty;
+es1800_init_break (char *args, int from_tty)
 {
   CORE_ADDR memaddress = 0;
   char buf[PBUFSIZ];
@@ -1999,17 +1941,13 @@
 }
 
 static void
-es1800_child_open (arg, from_tty)
-     char *arg;
-     int from_tty;
+es1800_child_open (char *arg, int from_tty)
 {
   error ("Use the \"run\" command to start a child process.");
 }
 
 static void
-es1800_child_detach (args, from_tty)
-     char *args;
-     int from_tty;
+es1800_child_detach (char *args, int from_tty)
 {
   if (args)
     {
@@ -2171,7 +2109,7 @@
 }
 
 void
-_initialize_es1800 ()
+_initialize_es1800 (void)
 {
   init_es1800_ops ();
   init_es1800_child_ops ();
diff --git a/gdb/remote-est.c b/gdb/remote-est.c
index 97c24c4..23d5541 100644
--- a/gdb/remote-est.c
+++ b/gdb/remote-est.c
@@ -31,11 +31,7 @@
 static void est_open (char *args, int from_tty);
 
 static void
-est_supply_register (regname, regnamelen, val, vallen)
-     char *regname;
-     int regnamelen;
-     char *val;
-     int vallen;
+est_supply_register (char *regname, int regnamelen, char *val, int vallen)
 {
   int regno;
 
@@ -150,15 +146,13 @@
 }				/* init_est_cmds */
 
 static void
-est_open (args, from_tty)
-     char *args;
-     int from_tty;
+est_open (char *args, int from_tty)
 {
   monitor_open (args, &est_cmds, from_tty);
 }
 
 void
-_initialize_est ()
+_initialize_est (void)
 {
   init_est_cmds ();
   init_monitor_ops (&est_ops);
diff --git a/gdb/remote-hms.c b/gdb/remote-hms.c
index 1bf5920..834f596 100644
--- a/gdb/remote-hms.c
+++ b/gdb/remote-hms.c
@@ -28,11 +28,7 @@
 
 static void hms_open (char *args, int from_tty);
 static void
-hms_supply_register (regname, regnamelen, val, vallen)
-     char *regname;
-     int regnamelen;
-     char *val;
-     int vallen;
+hms_supply_register (char *regname, int regnamelen, char *val, int vallen)
 {
   int regno;
 
@@ -135,9 +131,7 @@
 }				/* init_hms-cmds */
 
 static void
-hms_open (args, from_tty)
-     char *args;
-     int from_tty;
+hms_open (char *args, int from_tty)
 {
   monitor_open (args, &hms_cmds, from_tty);
 }
@@ -145,7 +139,7 @@
 int write_dos_tick_delay;
 
 void
-_initialize_remote_hms ()
+_initialize_remote_hms (void)
 {
   init_hms_cmds ();
   init_monitor_ops (&hms_ops);
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 883ee9e..1905c61 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -1,5 +1,5 @@
 /* Remote debugging interface for MIPS remote debugging protocol.
-   Copyright 1993-1995, 2000 Free Software Foundation, Inc.
+   Copyright 1993, 1994, 1995, 2000 Free Software Foundation, Inc.
    Contributed by Cygnus Support.  Written by Ian Lance Taylor
    <ian@cygnus.com>.
 
@@ -36,6 +36,8 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#include <ctype.h>
+
 /* Microsoft C's stat.h doesn't define all the POSIX file modes.  */
 #ifndef S_IROTH
 #define S_IROTH S_IREAD
@@ -75,9 +77,8 @@
 
 static int mips_receive_packet (char *buff, int throw_error, int timeout);
 
-static CORE_ADDR mips_request (int cmd, CORE_ADDR addr,
-			       CORE_ADDR data, int *perr, int timeout,
-			       char *buff);
+static ULONGEST mips_request (int cmd, ULONGEST addr, ULONGEST data,
+			      int *perr, int timeout, char *buff);
 
 static void mips_initialize (void);
 
@@ -356,7 +357,7 @@
 
 /* The number of garbage characters to accept when looking for an
    SYN for the next packet.  */
-static int mips_syn_garbage = 1050;
+static int mips_syn_garbage = 10;
 
 /* The time to wait for a packet, in seconds.  */
 static int mips_receive_wait = 5;
@@ -456,7 +457,7 @@
 
 
 static void
-close_ports ()
+close_ports (void)
 {
   mips_is_open = 0;
   SERIAL_CLOSE (mips_desc);
@@ -506,9 +507,7 @@
    ^x notation or in hex.  */
 
 static void
-fputc_readable (ch, file)
-     int ch;
-     struct ui_file *file;
+fputc_readable (int ch, struct ui_file *file)
 {
   if (ch == '\n')
     fputc_unfiltered ('\n', file);
@@ -527,9 +526,7 @@
    ^x notation or in hex.  */
 
 static void
-fputs_readable (string, file)
-     char *string;
-     struct ui_file *file;
+fputs_readable (const char *string, struct ui_file *file)
 {
   int c;
 
@@ -543,11 +540,9 @@
  */
 
 int
-mips_expect_timeout (string, timeout)
-     char *string;
-     int timeout;
+mips_expect_timeout (const char *string, int timeout)
 {
-  char *p = string;
+  const char *p = string;
 
   if (remote_debug)
     {
@@ -556,7 +551,7 @@
       fprintf_unfiltered (gdb_stdlog, "\", got \"");
     }
 
-  immediate_quit = 1;
+  immediate_quit++;
   while (1)
     {
       int c;
@@ -580,7 +575,7 @@
 	{
 	  if (*p == '\0')
 	    {
-	      immediate_quit = 0;
+	      immediate_quit--;
 	      if (remote_debug)
 		fprintf_unfiltered (gdb_stdlog, "\": OK\n");
 	      return 1;
@@ -601,31 +596,29 @@
  */
 
 int
-mips_expect (string)
-     char *string;
+mips_expect (const char *string)
 {
-  return mips_expect_timeout (string, 2);
+  return mips_expect_timeout (string, remote_timeout);
 }
 
 /* Read the required number of characters into the given buffer (which
    is assumed to be large enough). The only failure is a timeout. */
 int
-mips_getstring (string, n)
-     char *string;
-     int n;
+mips_getstring (char *string, int n)
 {
   char *p = string;
   int c;
 
-  immediate_quit = 1;
+  immediate_quit++;
   while (n > 0)
     {
-      c = SERIAL_READCHAR (mips_desc, 2);
+      c = SERIAL_READCHAR (mips_desc, remote_timeout);
 
       if (c == SERIAL_TIMEOUT)
 	{
 	  fprintf_unfiltered (gdb_stderr,
 		 "Failed to read %d characters from target (TIMEOUT)\n", n);
+	  immediate_quit--;
 	  return 0;
 	}
 
@@ -633,6 +626,7 @@
       n--;
     }
 
+  immediate_quit--;
   return 1;
 }
 
@@ -651,8 +645,7 @@
    port.  */
 
 static int
-mips_readchar (timeout)
-     int timeout;
+mips_readchar (int timeout)
 {
   int ch;
   static int state = 0;
@@ -730,11 +723,7 @@
    or -1 for timeout.  */
 
 static int
-mips_receive_header (hdr, pgarbage, ch, timeout)
-     unsigned char *hdr;
-     int *pgarbage;
-     int ch;
-     int timeout;
+mips_receive_header (unsigned char *hdr, int *pgarbage, int ch, int timeout)
 {
   int i;
 
@@ -753,15 +742,26 @@
 	    {
 	      /* Printing the character here lets the user of gdb see
 	         what the program is outputting, if the debugging is
-	         being done on the console port.  Don't use _filtered;
-	         we can't deal with a QUIT out of target_wait.  */
-	      if (!mips_initializing || remote_debug > 0)
-		{
-		  fputc_readable (ch, gdb_stdlog);
-		  gdb_flush (gdb_stdlog);
-		}
+	         being done on the console port.  Don't use _filtered:
+	         we can't deal with a QUIT out of target_wait and
+	         buffered target output confuses the user. */
+ 	      if (!mips_initializing || remote_debug > 0)
+  		{
+		  if (isprint (ch) || isspace (ch))
+		    {
+		      fputc_unfiltered (ch, gdb_stdtarg);
+		    }
+		  else
+		    {
+		      fputc_readable (ch, gdb_stdtarg);
+		    }
+		  gdb_flush (gdb_stdtarg);
+  		}
+	      
+	      /* Only count unprintable characters. */
+	      if (! (isprint (ch) || isspace (ch)))
+		(*pgarbage) += 1;
 
-	      ++*pgarbage;
 	      if (mips_syn_garbage > 0
 		  && *pgarbage > mips_syn_garbage)
 		mips_error ("Debug protocol failure:  more than %d characters before a sync.",
@@ -795,11 +795,7 @@
    for success, -1 for timeout, -2 for error.  */
 
 static int
-mips_receive_trailer (trlr, pgarbage, pch, timeout)
-     unsigned char *trlr;
-     int *pgarbage;
-     int *pch;
-     int timeout;
+mips_receive_trailer (unsigned char *trlr, int *pgarbage, int *pch, int timeout)
 {
   int i;
   int ch;
@@ -821,10 +817,7 @@
    DATA points to the packet data.  LEN is the length of DATA.  */
 
 static int
-mips_cksum (hdr, data, len)
-     const unsigned char *hdr;
-     const unsigned char *data;
-     int len;
+mips_cksum (const unsigned char *hdr, const unsigned char *data, int len)
 {
   register const unsigned char *p;
   register int c;
@@ -849,9 +842,7 @@
 /* Send a packet containing the given ASCII string.  */
 
 static void
-mips_send_packet (s, get_ack)
-     const char *s;
-     int get_ack;
+mips_send_packet (const char *s, int get_ack)
 {
   /* unsigned */ int len;
   unsigned char *packet;
@@ -937,7 +928,7 @@
 		{
 		  int rch;
 
-		  rch = mips_readchar (2);
+		  rch = mips_readchar (remote_timeout);
 		  if (rch == SYN)
 		    {
 		      ch = SYN;
@@ -949,7 +940,8 @@
 		}
 
 	      if (i == len)
-		(void) mips_receive_trailer (trlr, &garbage, &ch, 2);
+		(void) mips_receive_trailer (trlr, &garbage, &ch,
+					     remote_timeout);
 
 	      /* We don't bother checking the checksum, or providing an
 	         ACK to the packet. */
@@ -1016,10 +1008,7 @@
    don't print an error message and return -1.  */
 
 static int
-mips_receive_packet (buff, throw_error, timeout)
-     char *buff;
-     int throw_error;
-     int timeout;
+mips_receive_packet (char *buff, int throw_error, int timeout)
 {
   int ch;
   int garbage;
@@ -1234,14 +1223,13 @@
    occurs, it sets *PERR to 1 and sets errno according to what the
    target board reports.  */
 
-static CORE_ADDR
-mips_request (cmd, addr, data, perr, timeout, buff)
-     int cmd;
-     CORE_ADDR addr;
-     CORE_ADDR data;
-     int *perr;
-     int timeout;
-     char *buff;
+static ULONGEST
+mips_request (int cmd,
+	      ULONGEST addr,
+	      ULONGEST data,
+	      int *perr,
+	      int timeout,
+	      char *buff)
 {
   char myBuff[DATA_MAXLEN + 1];
   int len;
@@ -1296,23 +1284,19 @@
 }
 
 static void
-mips_initialize_cleanups (arg)
-     PTR arg;
+mips_initialize_cleanups (PTR arg)
 {
   mips_initializing = 0;
 }
 
 static void
-mips_exit_cleanups (arg)
-     PTR arg;
+mips_exit_cleanups (PTR arg)
 {
   mips_exiting = 0;
 }
 
 static void
-mips_send_command (cmd, prompt)
-     const char *cmd;
-     int prompt;
+mips_send_command (const char *cmd, int prompt)
 {
   SERIAL_WRITE (mips_desc, cmd, strlen (cmd));
   mips_expect (cmd);
@@ -1323,7 +1307,7 @@
 
 /* Enter remote (dbx) debug mode: */
 static void
-mips_enter_debug ()
+mips_enter_debug (void)
 {
   /* Reset the sequence numbers, ready for the new debug sequence: */
   mips_send_seq = 0;
@@ -1353,7 +1337,7 @@
 
 /* Exit remote (dbx) debug mode, returning to the monitor prompt: */
 static int
-mips_exit_debug ()
+mips_exit_debug (void)
 {
   int err;
   struct cleanup *old_cleanups = make_cleanup (mips_exit_cleanups, NULL);
@@ -1364,15 +1348,13 @@
     {
       /* The DDB (NEC) and MiniRISC (LSI) versions of PMON exit immediately,
          so we do not get a reply to this command: */
-      mips_request ('x', (unsigned int) 0, (unsigned int) 0, NULL,
-		    mips_receive_wait, NULL);
+      mips_request ('x', 0, 0, NULL, mips_receive_wait, NULL);
       mips_need_reply = 0;
       if (!mips_expect (" break!"))
 	return -1;
     }
   else
-    mips_request ('x', (unsigned int) 0, (unsigned int) 0, &err,
-		  mips_receive_wait, NULL);
+    mips_request ('x', 0, 0, &err, mips_receive_wait, NULL);
 
   if (!mips_expect (mips_monitor_prompt))
     return -1;
@@ -1386,7 +1368,7 @@
    really connected.  */
 
 static void
-mips_initialize ()
+mips_initialize (void)
 {
   int err;
   struct cleanup *old_cleanups = make_cleanup (mips_initialize_cleanups, NULL);
@@ -1512,20 +1494,16 @@
   /* If this doesn't call error, we have connected; we don't care if
      the request itself succeeds or fails.  */
 
-  mips_request ('r', (unsigned int) 0, (unsigned int) 0, &err,
-		mips_receive_wait, NULL);
+  mips_request ('r', 0, 0, &err, mips_receive_wait, NULL);
   set_current_frame (create_new_frame (read_fp (), read_pc ()));
   select_frame (get_current_frame (), 0);
 }
 
 /* Open a connection to the remote board.  */
 static void
-common_open (ops, name, from_tty, new_monitor, new_monitor_prompt)
-     struct target_ops *ops;
-     char *name;
-     int from_tty;
-     enum mips_monitor_type new_monitor;
-     char *new_monitor_prompt;
+common_open (struct target_ops *ops, char *name, int from_tty,
+	     enum mips_monitor_type new_monitor,
+	     const char *new_monitor_prompt)
 {
   char *ptype;
   char *serial_port_name;
@@ -1598,9 +1576,9 @@
 	     the user didn't specify a local name, assume it's the same
 	     as the part of the remote name after the "host:".  */
 	  if (tftp_name)
-	    free (tftp_name);
+	    xfree (tftp_name);
 	  if (tftp_localname)
-	    free (tftp_localname);
+	    xfree (tftp_localname);
 	  if (local_name == NULL)
 	    if ((local_name = strchr (remote_name, ':')) != NULL)
 	      local_name++;	/* skip over the colon */
@@ -1646,37 +1624,46 @@
   set_current_frame (create_new_frame (read_fp (), stop_pc));
   select_frame (get_current_frame (), 0);
   print_stack_frame (selected_frame, -1, 1);
-  free (serial_port_name);
+  xfree (serial_port_name);
 }
 
 static void
-mips_open (name, from_tty)
-     char *name;
-     int from_tty;
+mips_open (char *name, int from_tty)
 {
-  common_open (&mips_ops, name, from_tty, MON_IDT, TARGET_MONITOR_PROMPT);
+  const char *monitor_prompt = NULL;
+  if (TARGET_ARCHITECTURE != NULL
+      && TARGET_ARCHITECTURE->arch == bfd_arch_mips)
+    {
+    switch (TARGET_ARCHITECTURE->mach)
+      {
+      case bfd_mach_mips4100:
+      case bfd_mach_mips4300:
+      case bfd_mach_mips4600:
+      case bfd_mach_mips4650:
+      case bfd_mach_mips5000:
+	monitor_prompt = "<RISQ> ";
+	break;
+      }
+    }
+  if (monitor_prompt == NULL)
+    monitor_prompt = "<IDT>";
+  common_open (&mips_ops, name, from_tty, MON_IDT, monitor_prompt);
 }
 
 static void
-pmon_open (name, from_tty)
-     char *name;
-     int from_tty;
+pmon_open (char *name, int from_tty)
 {
   common_open (&pmon_ops, name, from_tty, MON_PMON, "PMON> ");
 }
 
 static void
-ddb_open (name, from_tty)
-     char *name;
-     int from_tty;
+ddb_open (char *name, int from_tty)
 {
   common_open (&ddb_ops, name, from_tty, MON_DDB, "NEC010>");
 }
 
 static void
-lsi_open (name, from_tty)
-     char *name;
-     int from_tty;
+lsi_open (char *name, int from_tty)
 {
   int i;
 
@@ -1690,8 +1677,7 @@
 /* Close a connection to the remote board.  */
 
 static void
-mips_close (quitting)
-     int quitting;
+mips_close (int quitting)
 {
   if (mips_is_open)
     {
@@ -1705,9 +1691,7 @@
 /* Detach from the remote board.  */
 
 static void
-mips_detach (args, from_tty)
-     char *args;
-     int from_tty;
+mips_detach (char *args, int from_tty)
 {
   if (args)
     error ("Argument given to \"detach\" when remotely debugging.");
@@ -1725,17 +1709,13 @@
    where PMON does return a reply.  */
 
 static void
-mips_resume (pid, step, siggnal)
-     int pid, step;
-     enum target_signal siggnal;
+mips_resume (int pid, int step, enum target_signal siggnal)
 {
   int err;
 
   /* LSI PMON requires returns a reply packet "0x1 s 0x0 0x57f" after
      a single step, so we wait for that.  */
-  mips_request (step ? 's' : 'c',
-		(unsigned int) 1,
-		(unsigned int) siggnal,
+  mips_request (step ? 's' : 'c', 1, siggnal,
 		mips_monitor == MON_LSI && step ? &err : (int *) NULL,
 		mips_receive_wait, NULL);
 }
@@ -1743,8 +1723,7 @@
 /* Return the signal corresponding to SIG, where SIG is the number which
    the MIPS protocol uses for the signal.  */
 enum target_signal
-mips_signal_from_protocol (sig)
-     int sig;
+mips_signal_from_protocol (int sig)
 {
   /* We allow a few more signals than the IDT board actually returns, on
      the theory that there is at least *some* hope that perhaps the numbering
@@ -1763,9 +1742,7 @@
 /* Wait until the remote stops, and return a wait status.  */
 
 static int
-mips_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+mips_wait (int pid, struct target_waitstatus *status)
 {
   int rstatus;
   int err;
@@ -1790,8 +1767,7 @@
 
   /* No timeout; we sit here as long as the program continues to execute.  */
   mips_wait_flag = 1;
-  rstatus = mips_request ('\000', (unsigned int) 0, (unsigned int) 0, &err, -1,
-			  buff);
+  rstatus = mips_request ('\000', 0, 0, &err, -1, buff);
   mips_wait_flag = 0;
   if (err)
     mips_error ("Remote failure: %s", safe_strerror (errno));
@@ -1927,8 +1903,7 @@
 #define REGNO_OFFSET 96
 
 static int
-mips_map_regno (regno)
-     int regno;
+mips_map_regno (int regno)
 {
   if (regno < 32)
     return regno;
@@ -1957,8 +1932,7 @@
 /* Fetch the remote registers.  */
 
 static void
-mips_fetch_registers (regno)
-     int regno;
+mips_fetch_registers (int regno)
 {
   unsigned LONGEST val;
   int err;
@@ -1987,11 +1961,11 @@
 	     compiled without the 64bit register access commands. This
 	     means we cannot get hold of the full register width. */
 	  if (mips_monitor == MON_DDB)
-	    val = (unsigned) mips_request ('t', (unsigned int) pmon_reg,
-			   (unsigned int) 0, &err, mips_receive_wait, NULL);
+	    val = (unsigned) mips_request ('t', pmon_reg, 0,
+					   &err, mips_receive_wait, NULL);
 	  else
-	    val = mips_request ('r', (unsigned int) pmon_reg,
-			   (unsigned int) 0, &err, mips_receive_wait, NULL);
+	    val = mips_request ('r', pmon_reg, 0,
+				&err, mips_receive_wait, NULL);
 	  if (err)
 	    mips_error ("Can't read register %d: %s", regno,
 			safe_strerror (errno));
@@ -2012,15 +1986,14 @@
    registers, so this function doesn't have to do anything.  */
 
 static void
-mips_prepare_to_store ()
+mips_prepare_to_store (void)
 {
 }
 
 /* Store remote register(s).  */
 
 static void
-mips_store_registers (regno)
-     int regno;
+mips_store_registers (int regno)
 {
   int err;
 
@@ -2031,7 +2004,7 @@
       return;
     }
 
-  mips_request ('R', (unsigned int) mips_map_regno (regno),
+  mips_request ('R', mips_map_regno (regno),
 		read_register (regno),
 		&err, mips_receive_wait, NULL);
   if (err)
@@ -2041,20 +2014,16 @@
 /* Fetch a word from the target board.  */
 
 static unsigned int
-mips_fetch_word (addr)
-     CORE_ADDR addr;
+mips_fetch_word (CORE_ADDR addr)
 {
   unsigned int val;
   int err;
 
-  /* FIXME! addr was cast to uint! */
-  val = mips_request ('d', addr, (unsigned int) 0, &err,
-		      mips_receive_wait, NULL);
+  val = mips_request ('d', addr, 0, &err, mips_receive_wait, NULL);
   if (err)
     {
       /* Data space failed; try instruction space.  */
-      /* FIXME! addr was cast to uint! */
-      val = mips_request ('i', addr, (unsigned int) 0, &err,
+      val = mips_request ('i', addr, 0, &err,
 			  mips_receive_wait, NULL);
       if (err)
 	mips_error ("Can't read address 0x%s: %s",
@@ -2069,22 +2038,17 @@
 
 /* FIXME! make sure only 32-bit quantities get stored! */
 static int
-mips_store_word (addr, val, old_contents)
-     CORE_ADDR addr;
-     unsigned int val;
-     char *old_contents;
+mips_store_word (CORE_ADDR addr, unsigned int val, char *old_contents)
 {
   int err;
   unsigned int oldcontents;
 
-  oldcontents = mips_request ('D', addr, (unsigned int) val,
-			      &err,
+  oldcontents = mips_request ('D', addr, val, &err,
 			      mips_receive_wait, NULL);
   if (err)
     {
       /* Data space failed; try instruction space.  */
-      oldcontents = mips_request ('I', addr,
-				  (unsigned int) val, &err,
+      oldcontents = mips_request ('I', addr, val, &err,
 				  mips_receive_wait, NULL);
       if (err)
 	return errno;
@@ -2101,24 +2065,30 @@
    for a longword, since it transfers values in ASCII.  We want the
    byte values, so we have to swap the longword values.  */
 
-static int
-mips_xfer_memory (memaddr, myaddr, len, write, ignore)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *ignore;
-{
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & ~3;
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count = (((memaddr + len) - addr) + 3) / 4;
-  /* Allocate buffer of that many longwords.  */
-  register char *buffer = alloca (count * 4);
+static int mask_address_p = 1;
 
+static int
+mips_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		  struct target_ops *ignore)
+{
+  int i;
+  CORE_ADDR addr;
+  int count;
+  char *buffer;
   int status;
 
+  /* PMON targets do not cope well with 64 bit addresses.  Mask the
+     value down to 32 bits. */
+  if (mask_address_p)
+    memaddr &= (CORE_ADDR) 0xffffffff;
+
+  /* Round starting address down to longword boundary.  */
+  addr = memaddr & ~3;
+  /* Round ending address up; get number of longwords that makes.  */
+  count = (((memaddr + len) - addr) + 3) / 4;
+  /* Allocate buffer of that many longwords.  */
+  buffer = alloca (count * 4);
+
   if (write)
     {
       /* Fill start and end extra bytes of buffer with existing data.  */
@@ -2181,8 +2151,7 @@
 /* Print info on this target.  */
 
 static void
-mips_files_info (ignore)
-     struct target_ops *ignore;
+mips_files_info (struct target_ops *ignore)
 {
   printf_unfiltered ("Debugging a MIPS board over a serial line.\n");
 }
@@ -2193,7 +2162,7 @@
    right port, we could interrupt the process with a break signal.  */
 
 static void
-mips_kill ()
+mips_kill (void)
 {
   if (!mips_wait_flag)
     return;
@@ -2246,10 +2215,7 @@
 /* Start running on the target board.  */
 
 static void
-mips_create_inferior (execfile, args, env)
-     char *execfile;
-     char *args;
-     char **env;
+mips_create_inferior (char *execfile, char *args, char **env)
 {
   CORE_ADDR entry_pt;
 
@@ -2276,7 +2242,7 @@
 /* Clean up after a process.  Actually nothing to do.  */
 
 static void
-mips_mourn_inferior ()
+mips_mourn_inferior (void)
 {
   if (current_ops != NULL)
     unpush_target (current_ops);
@@ -2295,9 +2261,7 @@
    is accomplished via BREAKPOINT_MAX).  */
 
 static int
-mips_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+mips_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   if (monitor_supports_breakpoints)
     return set_breakpoint (addr, MIPS_INSTLEN, BREAK_FETCH);
@@ -2306,9 +2270,7 @@
 }
 
 static int
-mips_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+mips_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   if (monitor_supports_breakpoints)
     return clear_breakpoint (addr, MIPS_INSTLEN, BREAK_FETCH);
@@ -2328,9 +2290,7 @@
 /* NOTE: The code relies on this vector being zero-initialised by the system */
 
 static int
-pmon_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+pmon_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   int status;
 
@@ -2349,7 +2309,7 @@
 
       mips_expect ("Bpt ");
 
-      if (!mips_getstring (tbuff, 2))
+      if (!mips_getstring (tbuff, remote_timeout))
 	return 1;
       tbuff[2] = '\0';		/* terminate the string */
       if (sscanf (tbuff, "%d", &bpnum) != 1)
@@ -2403,9 +2363,7 @@
 }
 
 static int
-pmon_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+pmon_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   if (monitor_supports_breakpoints)
     {
@@ -2448,8 +2406,7 @@
    implements the TARGET_CAN_USE_HARDWARE_WATCHPOINT macro.  */
 
 int
-remote_mips_can_use_hardware_watchpoint (cnt)
-     int cnt;
+remote_mips_can_use_hardware_watchpoint (int cnt)
 {
   return cnt < MAX_LSI_BREAKPOINTS && strcmp (target_shortname, "lsi") == 0;
 }
@@ -2459,9 +2416,7 @@
    This is used for memory ref breakpoints.  */
 
 static unsigned long
-calculate_mask (addr, len)
-     CORE_ADDR addr;
-     int len;
+calculate_mask (CORE_ADDR addr, int len)
 {
   unsigned long mask;
   int i;
@@ -2484,9 +2439,7 @@
    implement ordinary breakpoints using hardware facilities.  */
 
 int
-remote_mips_insert_hw_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+remote_mips_insert_hw_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   if (strcmp (target_shortname, "lsi") == 0)
     return mips_insert_breakpoint (addr, contents_cache);
@@ -2499,9 +2452,7 @@
    implement ordinary breakpoints using hardware facilities.  */
 
 int
-remote_mips_remove_hw_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+remote_mips_remove_hw_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   if (strcmp (target_shortname, "lsi") == 0)
     return mips_remove_breakpoint (addr, contents_cache);
@@ -2514,10 +2465,7 @@
    watchpoint. */
 
 int
-remote_mips_set_watchpoint (addr, len, type)
-     CORE_ADDR addr;
-     int len;
-     int type;
+remote_mips_set_watchpoint (CORE_ADDR addr, int len, int type)
 {
   if (set_breakpoint (addr, len, type))
     return -1;
@@ -2526,10 +2474,7 @@
 }
 
 int
-remote_mips_remove_watchpoint (addr, len, type)
-     CORE_ADDR addr;
-     int len;
-     int type;
+remote_mips_remove_watchpoint (CORE_ADDR addr, int len, int type)
 {
   if (clear_breakpoint (addr, len, type))
     return -1;
@@ -2547,10 +2492,7 @@
 /* Insert a breakpoint.  */
 
 static int
-set_breakpoint (addr, len, type)
-     CORE_ADDR addr;
-     int len;
-     enum break_type type;
+set_breakpoint (CORE_ADDR addr, int len, enum break_type type)
 {
   return common_breakpoint (1, addr, len, type);
 }
@@ -2559,10 +2501,7 @@
 /* Clear a breakpoint.  */
 
 static int
-clear_breakpoint (addr, len, type)
-     CORE_ADDR addr;
-     int len;
-     enum break_type type;
+clear_breakpoint (CORE_ADDR addr, int len, enum break_type type)
 {
   return common_breakpoint (0, addr, len, type);
 }
@@ -2576,9 +2515,7 @@
    This is a helper function for common_breakpoint.  */
 
 static int
-check_lsi_error (addr, rerrflg)
-     CORE_ADDR addr;
-     int rerrflg;
+check_lsi_error (CORE_ADDR addr, int rerrflg)
 {
   struct lsi_error *err;
   char *saddr = paddr_nz (addr);	/* printable address string */
@@ -2646,11 +2583,7 @@
    Return 0 if successful; otherwise 1.  */
 
 static int
-common_breakpoint (set, addr, len, type)
-     int set;
-     CORE_ADDR addr;
-     int len;
-     enum break_type type;
+common_breakpoint (int set, CORE_ADDR addr, int len, enum break_type type)
 {
   char buf[DATA_MAXLEN + 1];
   char cmd, rcmd;
@@ -2836,10 +2769,7 @@
 }
 
 static void
-send_srec (srec, len, addr)
-     char *srec;
-     int len;
-     CORE_ADDR addr;
+send_srec (char *srec, int len, CORE_ADDR addr)
 {
   while (1)
     {
@@ -2847,7 +2777,7 @@
 
       SERIAL_WRITE (mips_desc, srec, len);
 
-      ch = mips_readchar (2);
+      ch = mips_readchar (remote_timeout);
 
       switch (ch)
 	{
@@ -2868,8 +2798,7 @@
 /*  Download a binary file by converting it to S records. */
 
 static void
-mips_load_srec (args)
-     char *args;
+mips_load_srec (char *args)
 {
   bfd *abfd;
   asection *s;
@@ -2987,12 +2916,8 @@
  */
 
 static int
-mips_make_srec (buf, type, memaddr, myaddr, len)
-     char *buf;
-     int type;
-     CORE_ADDR memaddr;
-     unsigned char *myaddr;
-     int len;
+mips_make_srec (char *buf, int type, CORE_ADDR memaddr, unsigned char *myaddr,
+		int len)
 {
   unsigned char checksum;
   int i;
@@ -3059,11 +2984,7 @@
    pointer non-NULL). The function returns the number of encoded
    characters written into the buffer. */
 static int
-pmon_makeb64 (v, p, n, chksum)
-     unsigned long v;
-     char *p;
-     int n;
-     int *chksum;
+pmon_makeb64 (unsigned long v, char *p, int n, int *chksum)
 {
   int count = (n / 6);
 
@@ -3107,11 +3028,7 @@
 /* Shorthand function (that could be in-lined) to output the zero-fill
    escape sequence into the data stream. */
 static int
-pmon_zeroset (recsize, buff, amount, chksum)
-     int recsize;
-     char **buff;
-     int *amount;
-     unsigned int *chksum;
+pmon_zeroset (int recsize, char **buff, int *amount, unsigned int *chksum)
 {
   int count;
 
@@ -3123,10 +3040,7 @@
 }
 
 static int
-pmon_checkset (recsize, buff, value)
-     int recsize;
-     char **buff;
-     int *value;
+pmon_checkset (int recsize, char **buff, int *value)
 {
   int count;
 
@@ -3156,14 +3070,9 @@
    is for PMON 5.x on the Cogent Vr4300 board. */
 
 static void
-pmon_make_fastrec (outbuf, inbuf, inptr, inamount, recsize, csum, zerofill)
-     char **outbuf;
-     unsigned char *inbuf;
-     int *inptr;
-     int inamount;
-     int *recsize;
-     unsigned int *csum;
-     unsigned int *zerofill;
+pmon_make_fastrec (char **outbuf, unsigned char *inbuf, int *inptr,
+		   int inamount, int *recsize, unsigned int *csum,
+		   unsigned int *zerofill)
 {
   int count = 0;
   char *p = *outbuf;
@@ -3218,15 +3127,15 @@
 }
 
 static int
-pmon_check_ack (mesg)
-     char *mesg;
+pmon_check_ack (char *mesg)
 {
 #if defined(DOETXACK)
   int c;
 
   if (!tftp_in_use)
     {
-      c = SERIAL_READCHAR (udp_in_use ? udp_desc : mips_desc, 2);
+      c = SERIAL_READCHAR (udp_in_use ? udp_desc : mips_desc,
+			   remote_timeout);
       if ((c == SERIAL_TIMEOUT) || (c != 0x06))
 	{
 	  fprintf_unfiltered (gdb_stderr,
@@ -3242,7 +3151,7 @@
    which is either a serial port or a UDP socket.  */
 
 static void
-pmon_start_download ()
+pmon_start_download (void)
 {
   if (tftp_in_use)
     {
@@ -3274,9 +3183,27 @@
 }
 
 static void
-pmon_end_download (final, bintotal)
-     int final;
-     int bintotal;
+pmon_check_entry_address (char *entry_address, int final)
+{
+  char hexnumber[9];		/* includes '\0' space */
+  mips_expect_timeout (entry_address, tftp_in_use ? 15 : remote_timeout);
+  sprintf (hexnumber, "%x", final);
+  mips_expect (hexnumber);
+  mips_expect ("\r\n");
+}
+
+static int
+pmon_check_total (int bintotal)
+{
+  char hexnumber[9];		/* includes '\0' space */
+  mips_expect ("\r\ntotal = 0x");
+  sprintf (hexnumber, "%x", bintotal);
+  mips_expect (hexnumber);
+  return mips_expect_download (" bytes\r\n");
+}
+
+static void
+pmon_end_download (int final, int bintotal)
 {
   char hexnumber[9];		/* includes '\0' space */
 
@@ -3303,7 +3230,7 @@
       strcat (cmd, tftp_name);
       strcat (cmd, "\r");
       mips_send_command (cmd, 0);
-      free (cmd);
+      xfree (cmd);
       if (!mips_expect_download ("Downloading from "))
 	return;
       if (!mips_expect_download (tftp_name))
@@ -3315,33 +3242,28 @@
   /* Wait for the stuff that PMON prints after the load has completed.
      The timeout value for use in the tftp case (15 seconds) was picked
      arbitrarily but might be too small for really large downloads. FIXME. */
-  if (mips_monitor == MON_LSI)
+  switch (mips_monitor)
     {
+    case MON_LSI:
       pmon_check_ack ("termination");
-      mips_expect_timeout ("Entry address is ", tftp_in_use ? 15 : 2);
+      pmon_check_entry_address ("Entry address is ", final);
+      if (!pmon_check_total (bintotal))
+	return;
+      break;
+    default:
+      pmon_check_entry_address ("Entry Address  = ", final);
+      pmon_check_ack ("termination");
+      if (!pmon_check_total (bintotal))
+	return;
+      break;
     }
-  else
-    mips_expect_timeout ("Entry Address  = ", tftp_in_use ? 15 : 2);
-
-  sprintf (hexnumber, "%x", final);
-  mips_expect (hexnumber);
-  mips_expect ("\r\n");
-  if (mips_monitor != MON_LSI)
-    pmon_check_ack ("termination");
-  mips_expect ("\r\ntotal = 0x");
-  sprintf (hexnumber, "%x", bintotal);
-  mips_expect (hexnumber);
-  if (!mips_expect_download (" bytes\r\n"))
-    return;
 
   if (tftp_in_use)
     remove (tftp_localname);	/* Remove temporary file */
 }
 
 static void
-pmon_download (buffer, length)
-     char *buffer;
-     int length;
+pmon_download (char *buffer, int length)
 {
   if (tftp_in_use)
     fwrite (buffer, 1, length, tftp_file);
@@ -3350,8 +3272,7 @@
 }
 
 static void
-pmon_load_fast (file)
-     char *file;
+pmon_load_fast (char *file)
 {
   bfd *abfd;
   asection *s;
@@ -3498,9 +3419,7 @@
 /* mips_load -- download a file. */
 
 static void
-mips_load (file, from_tty)
-     char *file;
-     int from_tty;
+mips_load (char *file, int from_tty)
 {
   /* Get the board out of remote debugging mode.  */
   if (mips_exit_debug ())
@@ -3539,9 +3458,7 @@
 /* Pass the command argument as a packet to PMON verbatim.  */
 
 static void
-pmon_command (args, from_tty)
-     char *args;
-     int from_tty;
+pmon_command (char *args, int from_tty)
 {
   char buf[DATA_MAXLEN + 1];
   int rlen;
@@ -3556,7 +3473,7 @@
 }
 
 void
-_initialize_remote_mips ()
+_initialize_remote_mips (void)
 {
   /* Initialize the fields in mips_ops that are common to all four targets.  */
   mips_ops.to_longname = "Remote MIPS debugging over serial line";
@@ -3667,4 +3584,11 @@
 
   add_com ("pmon <command>", class_obscure, pmon_command,
 	   "Send a packet to PMON (must be in debug mode).");
+
+  add_show_from_set (add_set_cmd ("mask-address", no_class,
+				  var_boolean, &mask_address_p,
+				  "Set zeroing of upper 32 bits of 64-bit addresses when talking to PMON targets.\n\
+Use \"on\" to enable the masking and \"off\" to disable it.\n",
+				  &setlist),
+		     &showlist);
 }
diff --git a/gdb/remote-mm.c b/gdb/remote-mm.c
index 39be798..f6b5408 100644
--- a/gdb/remote-mm.c
+++ b/gdb/remote-mm.c
@@ -126,7 +126,7 @@
 volatile int n_alarms;
 
 static void
-mm_timer ()
+mm_timer (void)
 {
 #if 0
   if (kiodebug)
@@ -148,10 +148,7 @@
 /* This is called not only when we first attach, but also when the
    user types "run" after having attached.  */
 static void
-mm_create_inferior (execfile, args, env)
-     char *execfile;
-     char *args;
-     char **env;
+mm_create_inferior (char *execfile, char *args, char **env)
 {
 #define MAX_TOKENS 25
 #define BUFFER_SIZE 256
@@ -188,7 +185,7 @@
 }
 /**************************************************** REMOTE_MOURN_INFERIOR */
 static void
-mm_mourn ()
+mm_mourn (void)
 {
   pop_target ();		/* Pop back to no-child state */
   generic_mourn_inferior ();
@@ -283,8 +280,7 @@
 };
 
 static int
-damn_b (rate)
-     int rate;
+damn_b (int rate)
 {
   int i;
 
@@ -305,9 +301,7 @@
 static char *dev_name;
 int baudrate = 9600;
 static void
-mm_open (name, from_tty)
-     char *name;
-     int from_tty;
+mm_open (char *name, int from_tty)
 {
   TERMINAL sg;
   unsigned int prl;
@@ -339,7 +333,7 @@
     /*EMPTY */ ;
 
   if (prog_name != NULL)
-    free (prog_name);
+    xfree (prog_name);
   prog_name = savestring (p, strlen (p));
 
 
@@ -457,8 +451,8 @@
    Use this when you want to detach and do something else
    with your gdb.  */
 static void
-mm_close (quitting)		/*FIXME: how is quitting used */
-     int quitting;
+mm_close (			/*FIXME: how is quitting used */
+	   int quitting)
 {
   if (mm_desc < 0)
     error ("Can't close remote connection: not debugging remotely.");
@@ -492,9 +486,7 @@
  * Upon exiting the process's execution is stopped.
  */
 static void
-mm_attach (args, from_tty)
-     char *args;
-     int from_tty;
+mm_attach (char *args, int from_tty)
 {
 
   if (!mm_stream)
@@ -522,9 +514,7 @@
    Use this when you want to detach and do something else
    with your gdb.  Leave remote process running (with no breakpoints set). */
 static void
-mm_detach (args, from_tty)
-     char *args;
-     int from_tty;
+mm_detach (char *args, int from_tty)
 {
   remove_breakpoints ();	/* Just in case there were any left in */
   out_msg_buf->go_msg.code = GO;
@@ -538,9 +528,7 @@
 ** Tell the remote machine to resume.  */
 
 static void
-mm_resume (pid, step, sig)
-     int pid, step;
-     enum target_signal sig;
+mm_resume (int pid, int step, enum target_signal sig)
 {
   if (sig != TARGET_SIGNAL_0)
     warning ("Can't send signals to a remote MiniMon system.");
@@ -565,8 +553,7 @@
    storing status in STATUS just as `wait' would.  */
 
 static int
-mm_wait (status)
-     struct target_waitstatus *status;
+mm_wait (struct target_waitstatus *status)
 {
   int i, result;
   int old_timeout = timeout;
@@ -718,8 +705,7 @@
  * If regno==-1 then read all the registers.
  */
 static void
-mm_fetch_registers (regno)
-     int regno;
+mm_fetch_registers (int regno)
 {
   INT32 *data_p;
 
@@ -833,8 +819,7 @@
  */
 
 static void
-mm_store_registers (regno)
-     int regno;
+mm_store_registers (int regno)
 {
   int result;
 
@@ -972,15 +957,14 @@
    debugged.  */
 
 static void
-mm_prepare_to_store ()
+mm_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
 /******************************************************* REMOTE_XFER_MEMORY */
 static CORE_ADDR
-translate_addr (addr)
-     CORE_ADDR addr;
+translate_addr (CORE_ADDR addr)
 {
 #if defined(KERNEL_DEBUGGING)
   /* Check for a virtual address in the kernel */
@@ -1003,7 +987,7 @@
 
 /******************************************************* REMOTE_FILES_INFO */
 static void
-mm_files_info ()
+mm_files_info (void)
 {
   printf ("\tAttached to %s at %d baud and running program %s.\n",
 	  dev_name, baudrate, prog_name);
@@ -1011,9 +995,7 @@
 
 /************************************************* REMOTE_INSERT_BREAKPOINT */
 static int
-mm_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+mm_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   out_msg_buf->bkpt_set_msg.code = BKPT_SET;
   out_msg_buf->bkpt_set_msg.length = 4 * 4;
@@ -1034,9 +1016,7 @@
 
 /************************************************* REMOTE_DELETE_BREAKPOINT */
 static int
-mm_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+mm_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   out_msg_buf->bkpt_rm_msg.code = BKPT_RM;
   out_msg_buf->bkpt_rm_msg.length = 4 * 3;
@@ -1056,9 +1036,7 @@
 
 /******************************************************* REMOTE_KILL */
 static void
-mm_kill (arg, from_tty)
-     char *arg;
-     int from_tty;
+mm_kill (char *arg, int from_tty)
 {
   char buf[4];
 
@@ -1097,9 +1075,7 @@
  * Load a program into the target.
  */
 static void
-mm_load (arg_string, from_tty)
-     char *arg_string;
-     int from_tty;
+mm_load (char *arg_string, int from_tty)
 {
   dont_repeat ();
 
@@ -1110,7 +1086,7 @@
     error ("The load command takes a file name");
 
   arg_string = tilde_expand (arg_string);
-  make_cleanup (free, arg_string);
+  make_cleanup (xfree, arg_string);
   QUIT;
   immediate_quit++;
   error ("File loading is not yet supported for MiniMon.");
@@ -1127,10 +1103,7 @@
 ** Copy LEN bytes of data from debugger memory at MYADDR
    to inferior's memory at MEMADDR.  Returns number of bytes written.  */
 static int
-mm_write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+mm_write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int i, nwritten;
 
@@ -1166,10 +1139,7 @@
 ** Read LEN bytes from inferior memory at MEMADDR.  Put the result
    at debugger address MYADDR.  Returns number of bytes read.  */
 static int
-mm_read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+mm_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int i, nread;
 
@@ -1203,11 +1173,7 @@
 
 /* FIXME!  Merge these two.  */
 static int
-mm_xfer_inferior_memory (memaddr, myaddr, len, write)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
+mm_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len, int write)
 {
 
   memaddr = translate_addr (memaddr);
@@ -1232,8 +1198,7 @@
 */
 
 int
-msg_send_serial (msg_ptr)
-     union msg_t *msg_ptr;
+msg_send_serial (union msg_t *msg_ptr)
 {
   INT32 message_size;
   int byte_count;
@@ -1269,8 +1234,7 @@
 */
 
 int
-msg_recv_serial (msg_ptr)
-     union msg_t *msg_ptr;
+msg_recv_serial (union msg_t *msg_ptr)
 {
   static INT32 length = 0;
   static INT32 byte_count = 0;
@@ -1339,7 +1303,7 @@
 TERMINAL kbd_tbuf;
 
 int
-kbd_raw ()
+kbd_raw (void)
 {
   int result;
   TERMINAL tbuf;
@@ -1398,7 +1362,7 @@
 */
 
 int
-kbd_restore ()
+kbd_restore (void)
 {
   int result;
 
@@ -1421,8 +1385,7 @@
  * Returns 0/-1 on success/failure.  
  */
 static int
-fetch_register (regno)
-     int regno;
+fetch_register (int regno)
 {
   int result;
   out_msg_buf->read_req_msg.code = READ_REQ;
@@ -1481,8 +1444,7 @@
  * Returns 0/-1 on success/failure.  
  */
 static int
-store_register (regno)
-     int regno;
+store_register (int regno)
 {
   int result;
 
@@ -1548,8 +1510,7 @@
  * Convert a gdb special register number to a 29000 special register number.
  */
 static int
-regnum_to_srnum (regno)
-     int regno;
+regnum_to_srnum (int regno)
 {
   switch (regno)
     {
@@ -1616,10 +1577,8 @@
  * Initialize the target debugger (minimon only).
  */
 static void
-init_target_mm (tstart, tend, dstart, dend, entry, ms_size, rs_size, arg_start)
-     ADDR32 tstart, tend, dstart, dend, entry;
-     INT32 ms_size, rs_size;
-     ADDR32 arg_start;
+init_target_mm (ADDR32 tstart, ADDR32 tend, ADDR32 dstart, ADDR32 dend,
+		ADDR32 entry, INT32 ms_size, INT32 rs_size, ADDR32 arg_start)
 {
   out_msg_buf->init_msg.code = INIT;
   out_msg_buf->init_msg.length = sizeof (struct init_msg_t) - 2 * sizeof (INT32);
@@ -1641,8 +1600,7 @@
  * to be called with.
  */
 static char *
-msg_str (code)
-     INT32 code;
+msg_str (INT32 code)
 {
   static char cbuf[32];
 
@@ -1680,8 +1638,7 @@
  * Selected (not all of them) error codes that we might get.
  */
 static char *
-error_msg_str (code)
-     INT32 code;
+error_msg_str (INT32 code)
 {
   static char cbuf[50];
 
@@ -1741,15 +1698,15 @@
   return (cbuf);
 }
 /****************************************************************************/
-/* 
- *  Receive a message and expect it to be of type msgcode.
- *  Returns 0/1 on failure/success.
- */
+
+/* Receive a message, placing it in MSG_BUF, and expect it to be of
+   type MSGCODE.  If an error occurs, a non-zero FROM_TTY indicates
+   that the message should be printed.
+   
+   Return 0 for failure, 1 for success.  */
+
 static int
-expect_msg (msgcode, msg_buf, from_tty)
-     INT32 msgcode;		/* Msg code we expect */
-     union msg_t *msg_buf;	/* Where to put  the message received */
-     int from_tty;		/* Print message on error if non-zero */
+expect_msg (INT32 msgcode, union msg_t *msg_buf, int from_tty)
 {
   int retries = 0;
   while (msg_recv_serial (msg_buf) && (retries++ < MAX_RETRIES));
@@ -1780,8 +1737,7 @@
  * FIXME: Doesn't know anything about I_CACHE/D_CACHE.
  */
 static int
-mm_memory_space (addr)
-     CORE_ADDR *addr;
+mm_memory_space (CORE_ADDR *addr)
 {
   ADDR32 tstart = target_config.I_mem_start;
   ADDR32 tend = tstart + target_config.I_mem_size;
@@ -1882,15 +1838,14 @@
 };
 
 void
-_initialize_remote_mm ()
+_initialize_remote_mm (void)
 {
   init_mm_ops ();
   add_target (&mm_ops);
 }
 
 #ifdef NO_HIF_SUPPORT
-service_HIF (msg)
-     union msg_t *msg;
+service_HIF (union msg_t *msg)
 {
   return (0);			/* Emulate a failure */
 }
diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c
index 8350547..691aa72 100644
--- a/gdb/remote-nindy.c
+++ b/gdb/remote-nindy.c
@@ -115,12 +115,8 @@
 #include "serial.h"
 #include "nindy-share/env.h"
 #include "nindy-share/stop.h"
-
-#include "dcache.h"
 #include "remote-utils.h"
 
-static DCACHE *nindy_dcache;
-
 extern int unlink ();
 extern char *getenv ();
 extern char *mktemp ();
@@ -158,15 +154,14 @@
 static char *savename;
 
 static void
-nindy_close (quitting)
-     int quitting;
+nindy_close (int quitting)
 {
   if (nindy_serial != NULL)
     SERIAL_CLOSE (nindy_serial);
   nindy_serial = NULL;
 
   if (savename)
-    free (savename);
+    xfree (savename);
   savename = 0;
 }
 
@@ -175,9 +170,8 @@
    now specified with gdb command-line options (old_protocol,
    and initial_brk).  */
 void
-nindy_open (name, from_tty)
-     char *name;		/* "/dev/ttyXX", "ttyXX", or "XX": tty to be opened */
-     int from_tty;
+nindy_open (char *name,		/* "/dev/ttyXX", "ttyXX", or "XX": tty to be opened */
+	    int from_tty)
 {
   char baudrate[1024];
 
@@ -189,7 +183,6 @@
   nindy_close (0);
 
   have_regs = regs_changed = 0;
-  nindy_dcache = dcache_init (ninMemGet, ninMemPut);
 
   /* Allow user to interrupt the following -- we could hang if there's
      no NINDY at the other end of the remote tty.  */
@@ -221,9 +214,7 @@
 /* User-initiated quit of nindy operations.  */
 
 static void
-nindy_detach (name, from_tty)
-     char *name;
-     int from_tty;
+nindy_detach (char *name, int from_tty)
 {
   if (name)
     error ("Too many arguments");
@@ -231,7 +222,7 @@
 }
 
 static void
-nindy_files_info ()
+nindy_files_info (void)
 {
   /* FIXME: this lies about the baud rate if we autobauded.  */
   printf_unfiltered ("\tAttached to %s at %d bits per second%s%s.\n", savename,
@@ -240,14 +231,13 @@
 		     nindy_initial_brk ? " with initial break" : "");
 }
 
-/* Return the number of characters in the buffer before
-   the first DLE character.  */
+/* Return the number of characters in the buffer BUF before
+   the first DLE character.  N is maximum number of characters to
+   consider.  */
 
 static
 int
-non_dle (buf, n)
-     char *buf;			/* Character buffer; NOT '\0'-terminated */
-     int n;			/* Number of characters in buffer */
+non_dle (char *buf, int n)
 {
   int i;
 
@@ -264,14 +254,11 @@
 /* Tell the remote machine to resume.  */
 
 void
-nindy_resume (pid, step, siggnal)
-     int pid, step;
-     enum target_signal siggnal;
+nindy_resume (int pid, int step, enum target_signal siggnal)
 {
   if (siggnal != TARGET_SIGNAL_0 && siggnal != stop_signal)
     warning ("Can't send signals to remote NINDY targets.");
 
-  dcache_flush (nindy_dcache);
   if (regs_changed)
     {
       nindy_store_registers (-1);
@@ -294,12 +281,11 @@
 static struct clean_up_tty_args tty_args;
 
 static void
-clean_up_tty (ptrarg)
-     PTR ptrarg;
+clean_up_tty (PTR ptrarg)
 {
   struct clean_up_tty_args *args = (struct clean_up_tty_args *) ptrarg;
   SERIAL_SET_TTY_STATE (args->serial, args->state);
-  free (args->state);
+  xfree (args->state);
   warning ("\n\nYou may need to reset the 80960 and/or reload your program.\n");
 }
 
@@ -310,10 +296,10 @@
 #endif
 
 static void
-clean_up_int ()
+clean_up_int (void)
 {
   SERIAL_SET_TTY_STATE (tty_args.serial, tty_args.state);
-  free (tty_args.state);
+  xfree (tty_args.state);
 
   signal (SIGINT, old_ctrlc);
 #ifdef SIGTSTP
@@ -330,9 +316,7 @@
  */
 
 static int
-nindy_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+nindy_wait (int pid, struct target_waitstatus *status)
 {
   fd_set fds;
   int c;
@@ -408,7 +392,7 @@
     }
 
   SERIAL_SET_TTY_STATE (tty_args.serial, tty_args.state);
-  free (tty_args.state);
+  xfree (tty_args.state);
   discard_cleanups (old_cleanups);
 
   if (stop_exit)
@@ -441,8 +425,7 @@
 };
 
 static void
-nindy_fetch_registers (regno)
-     int regno;
+nindy_fetch_registers (int regno)
 {
   struct nindy_regs nindy_regs;
   int regnum;
@@ -462,15 +445,14 @@
 }
 
 static void
-nindy_prepare_to_store ()
+nindy_prepare_to_store (void)
 {
   /* Fetch all regs if they aren't already here.  */
   read_register_bytes (0, NULL, REGISTER_BYTES);
 }
 
 static void
-nindy_store_registers (regno)
-     int regno;
+nindy_store_registers (int regno)
 {
   struct nindy_regs nindy_regs;
   int regnum;
@@ -487,105 +469,30 @@
   immediate_quit--;
 }
 
-/* Read a word from remote address ADDR and return it.
- * This goes through the data cache.
- */
-int
-nindy_fetch_word (addr)
-     CORE_ADDR addr;
-{
-  return dcache_fetch (nindy_dcache, addr);
-}
-
-/* Write a word WORD into remote address ADDR.
-   This goes through the data cache.  */
-
-void
-nindy_store_word (addr, word)
-     CORE_ADDR addr;
-     int word;
-{
-  dcache_poke (nindy_dcache, addr, word);
-}
-
 /* 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.  Returns the length copied.
-
-   This is stolen almost directly from infptrace.c's child_xfer_memory,
-   which also deals with a word-oriented memory interface.  Sometime,
-   FIXME, rewrite this to not use the word-oriented routines.  */
+   SHOULD_WRITE is nonzero.  Returns the length copied.  TARGET is
+   unused.  */
 
 int
-nindy_xfer_inferior_memory (memaddr, myaddr, len, should_write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int should_write;
-     struct target_ops *target;	/* ignored */
+nindy_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
+			    int should_write, struct target_ops *target)
 {
-  register int i;
-  /* Round starting address down to longword boundary.  */
-  register CORE_ADDR addr = memaddr & -sizeof (int);
-  /* Round ending address up; get number of longwords that makes.  */
-  register int count
-  = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int);
-  /* Allocate buffer of that many longwords.  */
-  register int *buffer = (int *) alloca (count * sizeof (int));
+  int res;
+
+  if (len <= 0)
+    return 0;
 
   if (should_write)
-    {
-      /* Fill start and end extra bytes of buffer with existing memory data.  */
-
-      if (addr != memaddr || len < (int) sizeof (int))
-	{
-	  /* Need part of initial word -- fetch it.  */
-	  buffer[0] = nindy_fetch_word (addr);
-	}
-
-      if (count > 1)		/* FIXME, avoid if even boundary */
-	{
-	  buffer[count - 1]
-	    = nindy_fetch_word (addr + (count - 1) * sizeof (int));
-	}
-
-      /* Copy data to be written over corresponding part of buffer */
-
-      memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
-
-      /* Write the entire buffer.  */
-
-      for (i = 0; i < count; i++, addr += sizeof (int))
-	{
-	  errno = 0;
-	  nindy_store_word (addr, buffer[i]);
-	  if (errno)
-	    return 0;
-	}
-    }
+    res = ninMemPut (memaddr, myaddr, len);
   else
-    {
-      /* Read all the longwords */
-      for (i = 0; i < count; i++, addr += sizeof (int))
-	{
-	  errno = 0;
-	  buffer[i] = nindy_fetch_word (addr);
-	  if (errno)
-	    return 0;
-	  QUIT;
-	}
+    res = ninMemGet (memaddr, myaddr, len);
 
-      /* Copy appropriate bytes out of the buffer.  */
-      memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
-    }
-  return len;
+  return res;
 }
 
 static void
-nindy_create_inferior (execfile, args, env)
-     char *execfile;
-     char *args;
-     char **env;
+nindy_create_inferior (char *execfile, char *args, char **env)
 {
   int entry_pt;
   int pid;
@@ -623,9 +530,7 @@
 }
 
 static void
-reset_command (args, from_tty)
-     char *args;
-     int from_tty;
+reset_command (char *args, int from_tty)
 {
   if (nindy_serial == NULL)
     {
@@ -639,9 +544,7 @@
 }
 
 void
-nindy_kill (args, from_tty)
-     char *args;
-     int from_tty;
+nindy_kill (char *args, int from_tty)
 {
   return;			/* Ignore attempts to kill target system */
 }
@@ -653,7 +556,7 @@
    instructions.  */
 
 void
-nindy_mourn_inferior ()
+nindy_mourn_inferior (void)
 {
   remove_breakpoints ();
   unpush_target (&nindy_ops);
@@ -662,17 +565,14 @@
 
 /* Pass the args the way catch_errors wants them.  */
 static int
-nindy_open_stub (arg)
-     char *arg;
+nindy_open_stub (char *arg)
 {
   nindy_open (arg, 1);
   return 1;
 }
 
 static void
-nindy_load (filename, from_tty)
-     char *filename;
-     int from_tty;
+nindy_load (char *filename, int from_tty)
 {
   asection *s;
   /* Can't do unix style forking on a VMS system, so we'll use bfd to do
@@ -703,15 +603,14 @@
 		  s->_raw_size,
 		  s->vma);
 	  ninMemPut (s->vma, buffer, s->_raw_size);
-	  free (buffer);
+	  xfree (buffer);
 	}
     }
   bfd_close (file);
 }
 
 static int
-load_stub (arg)
-     char *arg;
+load_stub (char *arg)
 {
   target_load (arg, 1);
   return 1;
@@ -726,7 +625,7 @@
    an i960 object file on the host system.  */
 
 void
-nindy_before_main_loop ()
+nindy_before_main_loop (void)
 {
   char ttyname[100];
   char *p, *p2;
@@ -850,7 +749,7 @@
 }
 
 void
-_initialize_nindy ()
+_initialize_nindy (void)
 {
   init_nindy_ops ();
   add_target (&nindy_ops);
diff --git a/gdb/remote-nrom.c b/gdb/remote-nrom.c
index 861b2d8..86a0718 100644
--- a/gdb/remote-nrom.c
+++ b/gdb/remote-nrom.c
@@ -61,13 +61,12 @@
    don't match.  */
 
 static int
-expect (string)
-     char *string;
+expect (char *string)
 {
   char *p = string;
   int c;
 
-  immediate_quit = 1;
+  immediate_quit++;
 
   while (1)
     {
@@ -77,8 +76,7 @@
 	{
 	  if (*p == '\0')
 	    {
-	      immediate_quit = 0;
-
+	      immediate_quit--;
 	      return 0;
 	    }
 	}
@@ -93,15 +91,13 @@
 }
 
 static void
-nrom_kill ()
+nrom_kill (void)
 {
   nrom_close (0);
 }
 
 static serial_t
-open_socket (name, port)
-     char *name;
-     int port;
+open_socket (char *name, int port)
 {
   char sockname[100];
   serial_t desc;
@@ -115,7 +111,7 @@
 }
 
 static void
-load_cleanup ()
+load_cleanup (void)
 {
   SERIAL_CLOSE (load_desc);
   load_desc = NULL;
@@ -124,9 +120,7 @@
 /* Download a file specified in ARGS to the netROM.  */
 
 static void
-nrom_load (args, fromtty)
-     char *args;
-     int fromtty;
+nrom_load (char *args, int fromtty)
 {
   int fd, rd_amt, fsize;
   bfd *pbfd;
@@ -210,9 +204,7 @@
 /* Open a connection to the remote NetROM devices.  */
 
 static void
-nrom_open (name, from_tty)
-     char *name;
-     int from_tty;
+nrom_open (char *name, int from_tty)
 {
   int errn;
 
@@ -238,8 +230,7 @@
 /* Close out all files and local state before this target loses control. */
 
 static void
-nrom_close (quitting)
-     int quitting;
+nrom_close (int quitting)
 {
   if (load_desc)
     SERIAL_CLOSE (load_desc);
@@ -250,9 +241,7 @@
 /* Pass arguments directly to the NetROM. */
 
 static void
-nrom_passthru (args, fromtty)
-     char *args;
-     int fromtty;
+nrom_passthru (char *args, int fromtty)
 {
   char buf[1024];
 
@@ -262,7 +251,7 @@
 }
 
 static void
-nrom_mourn ()
+nrom_mourn (void)
 {
   unpush_target (&nrom_ops);
   generic_mourn_inferior ();
@@ -341,7 +330,7 @@
 };
 
 void
-_initialize_remote_nrom ()
+_initialize_remote_nrom (void)
 {
   init_nrom_ops ();
   add_target (&nrom_ops);
diff --git a/gdb/remote-os9k.c b/gdb/remote-os9k.c
index fd758b5..08e1d85 100644
--- a/gdb/remote-os9k.c
+++ b/gdb/remote-os9k.c
@@ -105,8 +105,7 @@
 
 /* Read a character from the remote system, doing all the fancy timeout stuff */
 static int
-readchar (timeout)
-     int timeout;
+readchar (int timeout)
 {
   int c;
 
@@ -136,9 +135,7 @@
    non-zero, then discard non-matching input, else print it out.
    Let the user break out immediately.  */
 static void
-expect (string, discard)
-     char *string;
-     int discard;
+expect (char *string, int discard)
 {
   char *p = string;
   int c;
@@ -146,7 +143,7 @@
   if (sr_get_debug ())
     printf ("Expecting \"%s\"\n", string);
 
-  immediate_quit = 1;
+  immediate_quit++;
   while (1)
     {
       c = readchar (timeout);
@@ -156,7 +153,7 @@
 	{
 	  if (*p == '\0')
 	    {
-	      immediate_quit = 0;
+	      immediate_quit--;
 	      if (sr_get_debug ())
 		printf ("\nMatched\n");
 	      return;
@@ -190,8 +187,7 @@
    necessary to prevent getting into states from which we can't
    recover.  */
 static void
-expect_prompt (discard)
-     int discard;
+expect_prompt (int discard)
 {
   if (monitor_log)
     /* This is a convenient place to do this.  The idea is to do it often
@@ -211,8 +207,7 @@
 /* Get a hex digit from the remote system & return its value.
    If ignore_space is nonzero, ignore spaces (not newline, tab, etc).  */
 static int
-get_hex_digit (ignore_space)
-     int ignore_space;
+get_hex_digit (int ignore_space)
 {
   int ch;
   while (1)
@@ -237,8 +232,7 @@
 /* Get a byte from monitor and put it in *BYT.  Accept any number
    leading spaces.  */
 static void
-get_hex_byte (byt)
-     char *byt;
+get_hex_byte (char *byt)
 {
   int val;
 
@@ -250,9 +244,7 @@
 /* Get N 32-bit words from remote, each preceded by a space,
    and put them in registers starting at REGNO.  */
 static void
-get_hex_regs (n, regno)
-     int n;
-     int regno;
+get_hex_regs (int n, int regno)
 {
   long val;
   int i;
@@ -278,10 +270,7 @@
 /* This is called not only when we first attach, but also when the
    user types "run" after having attached.  */
 static void
-rombug_create_inferior (execfile, args, env)
-     char *execfile;
-     char *args;
-     char **env;
+rombug_create_inferior (char *execfile, char *args, char **env)
 {
   int entry_pt;
 
@@ -310,9 +299,7 @@
 static char dev_name[100];
 
 static void
-rombug_open (args, from_tty)
-     char *args;
-     int from_tty;
+rombug_open (char *args, int from_tty)
 {
   if (args == NULL)
     error ("Use `target RomBug DEVICE-NAME' to use a serial port, or \n\
@@ -380,8 +367,7 @@
  */
 
 static void
-rombug_close (quitting)
-     int quitting;
+rombug_close (int quitting)
 {
   if (rombug_is_open)
     {
@@ -401,9 +387,7 @@
 }
 
 int
-rombug_link (mod_name, text_reloc)
-     char *mod_name;
-     CORE_ADDR *text_reloc;
+rombug_link (char *mod_name, CORE_ADDR *text_reloc)
 {
   int i, j;
   unsigned long val;
@@ -431,8 +415,7 @@
    Use this when you want to detach and do something else
    with your gdb.  */
 static void
-rombug_detach (from_tty)
-     int from_tty;
+rombug_detach (int from_tty)
 {
   if (attach_flag)
     {
@@ -448,9 +431,7 @@
  * Tell the remote machine to resume.
  */
 static void
-rombug_resume (pid, step, sig)
-     int pid, step;
-     enum target_signal sig;
+rombug_resume (int pid, int step, enum target_signal sig)
 {
   if (monitor_log)
     fprintf (log_file, "\nIn Resume (step=%d, sig=%d)\n", step, sig);
@@ -480,9 +461,7 @@
  */
 
 static int
-rombug_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+rombug_wait (int pid, struct target_waitstatus *status)
 {
   int old_timeout = timeout;
   struct section_offsets *offs;
@@ -514,8 +493,8 @@
 	new_symfile_objfile (obj_sec->objfile, 1, 0);
       offs = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
       memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS);
-      ANOFFSET (offs, SECT_OFF_DATA (symfile_objfile)) = addr;
-      ANOFFSET (offs, SECT_OFF_BSS (symfile_objfile)) = addr;
+      offs->offsets[SECT_OFF_DATA (symfile_objfile)]  = addr;
+      offs->offsets[SECT_OFF_BSS (symfile_objfile)]  = addr;
 
       objfile_relocate (symfile_objfile, offs);
     }
@@ -528,8 +507,7 @@
    monitor wants.  Lets take advantage of that just as long as possible! */
 
 static char *
-get_reg_name (regno)
-     int regno;
+get_reg_name (int regno)
 {
   static char buf[50];
   char *p;
@@ -554,7 +532,7 @@
 /* read the remote registers into the block regs.  */
 
 static void
-rombug_fetch_registers ()
+rombug_fetch_registers (void)
 {
   int regno, j, i;
   long val;
@@ -615,8 +593,7 @@
 /* Fetch register REGNO, or all registers if REGNO is -1.
    Returns errno value.  */
 static void
-rombug_fetch_register (regno)
-     int regno;
+rombug_fetch_register (int regno)
 {
   int val, j;
   unsigned char b;
@@ -683,7 +660,7 @@
 /* Store the remote registers from the contents of the block REGS.  */
 
 static void
-rombug_store_registers ()
+rombug_store_registers (void)
 {
   int regno;
 
@@ -696,8 +673,7 @@
 /* Store register REGNO, or all if REGNO == 0.
    return errno value.  */
 static void
-rombug_store_register (regno)
-     int regno;
+rombug_store_register (int regno)
 {
   char *name;
 
@@ -728,13 +704,13 @@
    debugged.  */
 
 static void
-rombug_prepare_to_store ()
+rombug_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
 static void
-rombug_files_info ()
+rombug_files_info (void)
 {
   printf ("\tAttached to %s at %d baud.\n",
 	  dev_name, sr_get_baud_rate ());
@@ -743,10 +719,7 @@
 /* Copy LEN bytes of data from debugger memory at MYADDR
    to inferior's memory at MEMADDR.  Returns length moved.  */
 static int
-rombug_write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     unsigned char *myaddr;
-     int len;
+rombug_write_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 {
   int i;
   char buf[10];
@@ -776,10 +749,7 @@
 /* Read LEN bytes from inferior memory at MEMADDR.  Put the result
    at debugger address MYADDR.  Returns length moved.  */
 static int
-rombug_read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+rombug_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int i, j;
 
@@ -848,14 +818,15 @@
   return len;
 }
 
-/* FIXME-someday!  merge these two.  */
+/* Transfer LEN bytes between GDB address MYADDR and target address
+   MEMADDR.  If WRITE is non-zero, transfer them to the target,
+   otherwise transfer them from the target.  TARGET is unused.
+
+   Returns the number of bytes transferred. */
+
 static int
-rombug_xfer_inferior_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* ignored */
+rombug_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
+			     int write, struct target_ops *target)
 {
   if (write)
     return rombug_write_inferior_memory (memaddr, myaddr, len);
@@ -864,9 +835,7 @@
 }
 
 static void
-rombug_kill (args, from_tty)
-     char *args;
-     int from_tty;
+rombug_kill (char *args, int from_tty)
 {
   return;			/* ignore attempts to kill target system */
 }
@@ -877,7 +846,7 @@
    instructions.  */
 
 static void
-rombug_mourn_inferior ()
+rombug_mourn_inferior (void)
 {
   remove_breakpoints ();
   generic_mourn_inferior ();	/* Do all the proper things now */
@@ -889,9 +858,7 @@
 {0};
 
 static int
-rombug_insert_breakpoint (addr, shadow)
-     CORE_ADDR addr;
-     char *shadow;
+rombug_insert_breakpoint (CORE_ADDR addr, char *shadow)
 {
   int i;
   CORE_ADDR bp_addr = addr;
@@ -922,9 +889,7 @@
  * _remove_breakpoint -- Tell the monitor to remove a breakpoint
  */
 static int
-rombug_remove_breakpoint (addr, shadow)
-     CORE_ADDR addr;
-     char *shadow;
+rombug_remove_breakpoint (CORE_ADDR addr, char *shadow)
 {
   int i;
 
@@ -950,8 +915,7 @@
 
 #define DOWNLOAD_LINE_SIZE 100
 static void
-rombug_load (arg)
-     char *arg;
+rombug_load (char *arg)
 {
 /* this part comment out for os9* */
 #if 0
@@ -1013,9 +977,7 @@
    is seen. */
 
 static void
-rombug_command (args, fromtty)
-     char *args;
-     int fromtty;
+rombug_command (char *args, int fromtty)
 {
   if (monitor_desc == NULL)
     error ("monitor target not open.");
@@ -1037,16 +999,14 @@
 static struct ttystate ttystate;
 
 static void
-cleanup_tty ()
+cleanup_tty (void)
 {
   printf ("\r\n[Exiting connect mode]\r\n");
   /*SERIAL_RESTORE(0, &ttystate); */
 }
 
 static void
-connect_command (args, fromtty)
-     char *args;
-     int fromtty;
+connect_command (char *args, int fromtty)
 {
   fd_set readfds;
   int numfds;
@@ -1221,7 +1181,7 @@
 }
 
 void
-_initialize_remote_os9k ()
+_initialize_remote_os9k (void)
 {
   init_rombug_ops ();
   add_target (&rombug_ops);
diff --git a/gdb/remote-rdi.c b/gdb/remote-rdi.c
index f41f179..0115e4d 100644
--- a/gdb/remote-rdi.c
+++ b/gdb/remote-rdi.c
@@ -132,8 +132,7 @@
 /* Stub for catch_errors.  */
 
 static int
-arm_rdi_start_remote (dummy)
-     char *dummy;
+arm_rdi_start_remote (char *dummy)
 {
   return 1;
 }
@@ -142,34 +141,26 @@
    these to forward output from the target system and so forth.  */
 
 void
-voiddummy ()
+voiddummy (void *dummy)
 {
   fprintf_unfiltered (gdb_stdout, "void dummy\n");
 }
 
 static void
-myprint (arg, format, ap)
-     PTR arg;
-     const char *format;
-     va_list ap;
+myprint (PTR arg, const char *format, va_list ap)
 {
   vfprintf_unfiltered (gdb_stdout, format, ap);
 }
 
 static void
-mywritec (arg, c)
-     PTR arg;
-     int c;
+mywritec (PTR arg, int c)
 {
   if (isascii (c))
     fputc_unfiltered (c, gdb_stdout);
 }
 
 static int
-mywrite (arg, buffer, len)
-     PTR arg;
-     char const *buffer;
-     int len;
+mywrite (PTR arg, char const *buffer, int len)
 {
   int i;
   char *e;
@@ -188,8 +179,7 @@
 }
 
 static void
-mypause (arg)
-     PTR arg;
+mypause (PTR arg)
 {
 }
 
@@ -197,17 +187,13 @@
    being interrupted more carefully */
 
 static int
-myreadc (arg)
-     PTR arg;
+myreadc (PTR arg)
 {
   return fgetc (stdin);
 }
 
 static char *
-mygets (arg, buffer, len)
-     PTR arg;
-     char *buffer;
-     int len;
+mygets (PTR arg, char *buffer, int len)
 {
   return fgets (buffer, len, stdin);
 }
@@ -219,9 +205,7 @@
    for communication.  */
 
 static void
-arm_rdi_open (name, from_tty)
-     char *name;
-     int from_tty;
+arm_rdi_open (char *name, int from_tty)
 {
   int rslt, i;
   unsigned long arg1, arg2;
@@ -279,7 +263,7 @@
     {
       printf_filtered ("RDI_open: %s\n", rdi_error_message (rslt));
       Adp_CloseDevice ();
-      error ("RID_open failed\n");
+      error ("RDI_open failed\n");
     }
 
   rslt = angel_RDI_info (RDIInfo_Target, &arg1, &arg2);
@@ -347,7 +331,7 @@
     for (entry = local_bp_list; entry != NULL; entry = entry->next)
       {
 	if (preventry)
-	  free (preventry);
+	  xfree (preventry);
       }
   }
 
@@ -365,10 +349,7 @@
    user types "run" after having attached.  */
 
 static void
-arm_rdi_create_inferior (exec_file, args, env)
-     char *exec_file;
-     char *args;
-     char **env;
+arm_rdi_create_inferior (char *exec_file, char *args, char **env)
 {
   int len, rslt;
   unsigned long arg1, arg2;
@@ -435,9 +416,7 @@
    die when it hits one.  */
 
 static void
-arm_rdi_detach (args, from_tty)
-     char *args;
-     int from_tty;
+arm_rdi_detach (char *args, int from_tty)
 {
   pop_target ();
 }
@@ -445,8 +424,7 @@
 /* Clean up connection to a remote debugger.  */
 
 static void
-arm_rdi_close (quitting)
-     int quitting;
+arm_rdi_close (int quitting)
 {
   int rslt;
 
@@ -467,9 +445,7 @@
 /* Tell the remote machine to resume.  */
 
 static void
-arm_rdi_resume (pid, step, siggnal)
-     int pid, step;
-     enum target_signal siggnal;
+arm_rdi_resume (int pid, int step, enum target_signal siggnal)
 {
   int rslt;
   PointHandle point;
@@ -511,8 +487,7 @@
    packet.  */
 
 static void
-arm_rdi_interrupt (signo)
-     int signo;
+arm_rdi_interrupt (int signo)
 {
 }
 
@@ -520,15 +495,14 @@
 
 /* The user typed ^C twice.  */
 static void
-arm_rdi_interrupt_twice (signo)
-     int signo;
+arm_rdi_interrupt_twice (int signo)
 {
 }
 
 /* Ask the user what to do when an interrupt is received.  */
 
 static void
-interrupt_query ()
+interrupt_query (void)
 {
 }
 
@@ -537,9 +511,7 @@
    what, if anything, that means in the case of this target).  */
 
 static int
-arm_rdi_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+arm_rdi_wait (int pid, struct target_waitstatus *status)
 {
   status->kind = (execute_status == RDIError_NoError ?
 		  TARGET_WAITKIND_EXITED : TARGET_WAITKIND_STOPPED);
@@ -554,8 +526,7 @@
 
 /* ARGSUSED */
 static void
-arm_rdi_fetch_registers (regno)
-     int regno;
+arm_rdi_fetch_registers (int regno)
 {
   int rslt, rdi_regmask;
   unsigned long rawreg, rawregs[32];
@@ -604,7 +575,7 @@
 }
 
 static void
-arm_rdi_prepare_to_store ()
+arm_rdi_prepare_to_store (void)
 {
   /* Nothing to do.  */
 }
@@ -613,8 +584,7 @@
    of REGISTERS.  FIXME: ignores errors.  */
 
 static void
-arm_rdi_store_registers (regno)
-     int regno;
+arm_rdi_store_registers (int regno)
 {
   int rslt, rdi_regmask;
 
@@ -652,16 +622,12 @@
 /* Read or write LEN bytes from inferior memory at MEMADDR,
    transferring to or from debugger address MYADDR.  Write to inferior
    if SHOULD_WRITE is nonzero.  Returns length of data written or
-   read; 0 for error.  */
+   read; 0 for error.  TARGET is unused.  */
 
 /* ARGSUSED */
 static int
-arm_rdi_xfer_memory (memaddr, myaddr, len, should_write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int should_write;
-     struct target_ops *target;	/* ignored */
+arm_rdi_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
+		     int should_write, struct target_ops *target)
 {
   int rslt, i;
 
@@ -688,8 +654,7 @@
 /* Display random info collected from the target.  */
 
 static void
-arm_rdi_files_info (ignore)
-     struct target_ops *ignore;
+arm_rdi_files_info (struct target_ops *ignore)
 {
   char *file = "nothing";
   int rslt;
@@ -724,7 +689,7 @@
 }
 
 static void
-arm_rdi_kill ()
+arm_rdi_kill (void)
 {
   int rslt;
 
@@ -736,7 +701,7 @@
 }
 
 static void
-arm_rdi_mourn_inferior ()
+arm_rdi_mourn_inferior (void)
 {
   /* We remove the inserted breakpoints in case the user wants to
      issue another target and load commands to rerun his application;
@@ -754,9 +719,7 @@
    here.  */
 
 static int
-arm_rdi_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+arm_rdi_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   int rslt;
   PointHandle point;
@@ -780,9 +743,7 @@
 }
 
 static int
-arm_rdi_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+arm_rdi_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   int rslt;
   PointHandle point;
@@ -812,14 +773,13 @@
 	{
 	  preventry->next = entry->next;
 	}
-      free (entry);
+      xfree (entry);
     }
   return 0;
 }
 
 static char *
-rdi_error_message (err)
-     int err;
+rdi_error_message (int err)
 {
   switch (err)
     {
@@ -909,8 +869,7 @@
 /* Convert the ARM error messages to signals that GDB knows about.  */
 
 static enum target_signal
-rdi_error_signal (err)
-     int err;
+rdi_error_signal (int err)
 {
   switch (err)
     {
@@ -970,11 +929,18 @@
       return TARGET_SIGNAL_UNKNOWN;
     }
 }
+
+static void
+arm_rdi_stop(void)
+{
+  angel_RDI_stop_request();
+}
+
 
 /* Define the target operations structure.  */
 
 static void
-init_rdi_ops ()
+init_rdi_ops (void)
 {
   arm_rdi_ops.to_shortname = "rdi";
   arm_rdi_ops.to_longname = "ARM RDI";
@@ -985,6 +951,7 @@
   arm_rdi_ops.to_detach = arm_rdi_detach;
   arm_rdi_ops.to_resume = arm_rdi_resume;
   arm_rdi_ops.to_wait = arm_rdi_wait;
+  arm_rdi_ops.to_stop = arm_rdi_stop;
   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;
@@ -1015,7 +982,7 @@
     }
 
   if (log_filename)
-    free (log_filename);
+    xfree (log_filename);
 
   log_filename = xstrdup (arg);
 
@@ -1051,7 +1018,7 @@
 }
 
 void
-_initialize_remote_rdi ()
+_initialize_remote_rdi (void)
 {
   init_rdi_ops ();
   add_target (&arm_rdi_ops);
@@ -1102,7 +1069,7 @@
 /* A little dummy to make linking with the library succeed. */
 
 int
-Fail ()
+Fail (void)
 {
   return 0;
 }
diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c
index 09365ec..223e2ef 100644
--- a/gdb/remote-rdp.c
+++ b/gdb/remote-rdp.c
@@ -176,7 +176,7 @@
 /* Stuff for talking to the serial layer. */
 
 static unsigned char
-get_byte ()
+get_byte (void)
 {
   int c = SERIAL_READCHAR (io, timeout);
 
@@ -197,7 +197,7 @@
 /* Note that the target always speaks little-endian to us,
    even if it's a big endian machine. */
 static unsigned int
-get_word ()
+get_word (void)
 {
   unsigned int val = 0;
   unsigned int c;
@@ -211,8 +211,7 @@
 }
 
 static void
-put_byte (val)
-     char val;
+put_byte (char val)
 {
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "(%02x)\n", val);
@@ -220,8 +219,7 @@
 }
 
 static void
-put_word (val)
-     int val;
+put_word (int val)
 {
   /* We always send in little endian */
   unsigned char b[4];
@@ -249,9 +247,7 @@
 
  */
 static void
-rdp_init (cold, tty)
-     int cold;
-     int tty;
+rdp_init (int cold, int tty)
 {
   int sync = 0;
   int type = cold ? RDP_OPEN_TYPE_COLD : RDP_OPEN_TYPE_WARM;
@@ -487,10 +483,7 @@
 
 
 static int
-rdp_write (memaddr, buf, len)
-     CORE_ADDR memaddr;
-     char *buf;
-     int len;
+rdp_write (CORE_ADDR memaddr, char *buf, int len)
 {
   int res;
   int val;
@@ -506,10 +499,7 @@
 
 
 static int
-rdp_read (memaddr, buf, len)
-     CORE_ADDR memaddr;
-     char *buf;
-     int len;
+rdp_read (CORE_ADDR memaddr, char *buf, int len)
 {
   int res;
   int val;
@@ -525,9 +515,7 @@
 }
 
 static void
-rdp_fetch_one_register (mask, buf)
-     int mask;
-     char *buf;
+rdp_fetch_one_register (int mask, char *buf)
 {
   int val;
   send_rdp ("bbw-SWZ", RDP_CPU_READ, RDP_CPU_READWRITE_MODE_CURRENT, mask, &val);
@@ -535,9 +523,7 @@
 }
 
 static void
-rdp_fetch_one_fpu_register (mask, buf)
-     int mask;
-     char *buf;
+rdp_fetch_one_fpu_register (int mask, char *buf)
 {
 #if 0
   /* !!! Since the PIE board doesn't work as documented,
@@ -564,9 +550,7 @@
 
 
 static void
-rdp_store_one_register (mask, buf)
-     int mask;
-     char *buf;
+rdp_store_one_register (int mask, char *buf)
 {
   int val = extract_unsigned_integer (buf, 4);
 
@@ -576,9 +560,7 @@
 
 
 static void
-rdp_store_one_fpu_register (mask, buf)
-     int mask;
-     char *buf;
+rdp_store_one_fpu_register (int mask, char *buf)
 {
 #if 0
   /* See comment in fetch_one_fpu_register */
@@ -616,8 +598,7 @@
 /* Convert between GDB requests and the RDP layer. */
 
 static void
-remote_rdp_fetch_register (regno)
-     int regno;
+remote_rdp_fetch_register (int regno)
 {
   if (regno == -1)
     {
@@ -647,8 +628,7 @@
 
 
 static void
-remote_rdp_store_register (regno)
-     int regno;
+remote_rdp_store_register (int regno)
 {
   if (regno == -1)
     {
@@ -675,14 +655,14 @@
 }
 
 static void
-remote_rdp_kill ()
+remote_rdp_kill (void)
 {
   callback->shutdown (callback);
 }
 
 
 static void
-rdp_info ()
+rdp_info (void)
 {
   send_rdp ("bw-S-W-Z", RDP_INFO, RDP_INFO_ABOUT_STEP,
 	    &ds.step_info);
@@ -699,7 +679,7 @@
 
 
 static void
-rdp_execute_start ()
+rdp_execute_start (void)
 {
   /* Start it off, but don't wait for it */
   send_rdp ("bb-", RDP_EXEC, RDP_EXEC_TYPE_SYNC);
@@ -707,9 +687,7 @@
 
 
 static void
-rdp_set_command_line (command, args)
-     char *command;
-     char *args;
+rdp_set_command_line (char *command, char *args)
 {
   /*
      ** We could use RDP_INFO_SET_CMDLINE to send this, but EmbeddedICE systems
@@ -718,7 +696,7 @@
    */
 
   if (commandline != NULL)
-    free (commandline);
+    xfree (commandline);
 
   commandline = malloc (strlen (command) + strlen (args) + 2);
   if (commandline != NULL)
@@ -730,7 +708,7 @@
 }
 
 static void
-rdp_catch_vectors ()
+rdp_catch_vectors (void)
 {
   /*
      ** We want the target monitor to intercept the abort vectors
@@ -817,9 +795,7 @@
 };
 
 static int
-exec_swi (swi, args)
-     int swi;
-     argsin *args;
+exec_swi (int swi, argsin *args)
 {
   int i;
   char c;
@@ -942,7 +918,7 @@
 
 
 static void
-handle_swi ()
+handle_swi (void)
 {
   argsin args[3];
   char *buf;
@@ -994,7 +970,7 @@
 	  break;
 
 	default:
-	  error ("Unimplented SWI argument");
+	  error ("Unimplemented SWI argument");
 	}
 
       type = type >> 2;
@@ -1015,7 +991,7 @@
 }
 
 static void
-rdp_execute_finish ()
+rdp_execute_finish (void)
 {
   int running = 1;
 
@@ -1052,16 +1028,14 @@
 
 
 static void
-rdp_execute ()
+rdp_execute (void)
 {
   rdp_execute_start ();
   rdp_execute_finish ();
 }
 
 static int
-remote_rdp_insert_breakpoint (addr, save)
-     CORE_ADDR addr;
-     char *save;
+remote_rdp_insert_breakpoint (CORE_ADDR addr, char *save)
 {
   int res;
   if (ds.rdi_level > 0)
@@ -1085,9 +1059,7 @@
 }
 
 static int
-remote_rdp_remove_breakpoint (addr, save)
-     CORE_ADDR addr;
-     char *save;
+remote_rdp_remove_breakpoint (CORE_ADDR addr, char *save)
 {
   int res;
   if (ds.rdi_level > 0)
@@ -1108,7 +1080,7 @@
 }
 
 static void
-rdp_step ()
+rdp_step (void)
 {
   if (ds.can_step && 0)
     {
@@ -1124,16 +1096,14 @@
       char handle[4];
       CORE_ADDR pc = read_register (PC_REGNUM);
       pc = arm_get_next_pc (pc);
-      remote_rdp_insert_breakpoint (pc, &handle);
+      remote_rdp_insert_breakpoint (pc, handle);
       rdp_execute ();
-      remote_rdp_remove_breakpoint (pc, &handle);
+      remote_rdp_remove_breakpoint (pc, handle);
     }
 }
 
 static void
-remote_rdp_open (args, from_tty)
-     char *args;
-     int from_tty;
+remote_rdp_open (char *args, int from_tty)
 {
   int not_icebreaker;
 
@@ -1203,8 +1173,7 @@
 /* Close out all files and local state before this target loses control. */
 
 static void
-remote_rdp_close (quitting)
-     int quitting;
+remote_rdp_close (int quitting)
 {
   callback->shutdown (callback);
   if (io)
@@ -1218,9 +1187,7 @@
    to the target, or zero for no signal.  */
 
 static void
-remote_rdp_resume (pid, step, siggnal)
-     int pid, step;
-     enum target_signal siggnal;
+remote_rdp_resume (int pid, int step, enum target_signal siggnal)
 {
   if (step)
     rdp_step ();
@@ -1233,9 +1200,7 @@
    just as `wait' would.  */
 
 static int
-remote_rdp_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+remote_rdp_wait (int pid, struct target_waitstatus *status)
 {
   switch (ds.rdi_stopped_status)
     {
@@ -1271,18 +1236,20 @@
    debugged.  */
 
 static void
-remote_rdp_prepare_to_store ()
+remote_rdp_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
+/* Transfer LEN bytes between GDB address MYADDR and target address
+   MEMADDR.  If WRITE is non-zero, transfer them to the target,
+   otherwise transfer them from the target.  TARGET is unused.
+
+   Returns the number of bytes transferred. */
+
 static int
-remote_rdp_xfer_inferior_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* ignored */
+remote_rdp_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
+				 int write, struct target_ops *target)
 {
   /* I infer from D Taylor's code that there's a limit on the amount
      we can transfer in one chunk.. */
@@ -1347,9 +1314,7 @@
 
 
 static void
-dump_bits (t, info)
-     struct yn *t;
-     int info;
+dump_bits (struct yn *t, int info)
 {
   while (t->name)
     {
@@ -1359,8 +1324,7 @@
 }
 
 static void
-remote_rdp_files_info (target)
-     struct target_ops *target;
+remote_rdp_files_info (struct target_ops *target)
 {
   printf_filtered ("Target capabilities:\n");
   dump_bits (stepinfo, ds.step_info);
@@ -1370,10 +1334,7 @@
 
 
 static void
-remote_rdp_create_inferior (exec_file, allargs, env)
-     char *exec_file;
-     char *allargs;
-     char **env;
+remote_rdp_create_inferior (char *exec_file, char *allargs, char **env)
 {
   CORE_ADDR entry_point;
 
@@ -1403,16 +1364,14 @@
 
 /* Accept any stray run/attach commands */
 static int
-remote_rdp_can_run ()
+remote_rdp_can_run (void)
 {
   return 1;
 }
 
 /* Attach doesn't need to do anything */
 static void
-remote_rdp_attach (args, from_tty)
-     char *args;
-     int from_tty;
+remote_rdp_attach (char *args, int from_tty)
 {
   return;
 }
@@ -1490,7 +1449,7 @@
 }
 
 void
-_initialize_remote_rdp ()
+_initialize_remote_rdp (void)
 {
   init_remote_rdp_ops ();
   add_target (&remote_rdp_ops);
diff --git a/gdb/remote-sds.c b/gdb/remote-sds.c
index 0c1b107..96fa4a8 100644
--- a/gdb/remote-sds.c
+++ b/gdb/remote-sds.c
@@ -37,7 +37,6 @@
 #include "gdb-stabs.h"
 #include "gdbthread.h"
 #include "gdbcore.h"
-#include "dcache.h"
 
 #ifdef USG
 #include <sys/types.h>
@@ -148,8 +147,7 @@
 
 /* ARGSUSED */
 static void
-sds_close (quitting)
-     int quitting;
+sds_close (int quitting)
 {
   if (sds_desc)
     SERIAL_CLOSE (sds_desc);
@@ -159,13 +157,12 @@
 /* Stub for catch_errors.  */
 
 static int
-sds_start_remote (dummy)
-     PTR dummy;
+sds_start_remote (PTR dummy)
 {
   char c;
   unsigned char buf[200];
 
-  immediate_quit = 1;		/* Allow user to interrupt it */
+  immediate_quit++;		/* Allow user to interrupt it */
 
   /* Ack any packet which the remote side has already sent.  */
   SERIAL_WRITE (sds_desc, "{#*\r\n", 5);
@@ -183,7 +180,7 @@
   buf[0] = 0;
   sds_send (buf, 1);
 
-  immediate_quit = 0;
+  immediate_quit--;
 
   start_remote ();		/* Initialize gdb process mechanisms */
   return 1;
@@ -192,12 +189,8 @@
 /* Open a connection to a remote debugger.
    NAME is the filename used for communication.  */
 
-static DCACHE *sds_dcache;
-
 static void
-sds_open (name, from_tty)
-     char *name;
-     int from_tty;
+sds_open (char *name, int from_tty)
 {
   if (name == 0)
     error ("To open a remote debug connection, you need to specify what serial\n\
@@ -207,8 +200,6 @@
 
   unpush_target (&sds_ops);
 
-  sds_dcache = dcache_init (sds_read_bytes, sds_write_bytes);
-
   sds_desc = SERIAL_OPEN (name);
   if (!sds_desc)
     perror_with_name (name);
@@ -254,9 +245,7 @@
    die when it hits one.  */
 
 static void
-sds_detach (args, from_tty)
-     char *args;
-     int from_tty;
+sds_detach (char *args, int from_tty)
 {
   char buf[PBUFSIZ];
 
@@ -277,8 +266,7 @@
 /* Convert hex digit A to a number.  */
 
 static int
-fromhex (a)
-     int a;
+fromhex (int a)
 {
   if (a >= '0' && a <= '9')
     return a - '0';
@@ -291,8 +279,7 @@
 /* Convert number NIB to a hex digit.  */
 
 static int
-tohex (nib)
-     int nib;
+tohex (int nib)
 {
   if (nib < 10)
     return '0' + nib;
@@ -301,10 +288,7 @@
 }
 
 static int
-tob64 (inbuf, outbuf, len)
-     unsigned char *inbuf;
-     char *outbuf;
-     int len;
+tob64 (unsigned char *inbuf, char *outbuf, int len)
 {
   int i, sum;
   char *p;
@@ -330,9 +314,7 @@
 }
 
 static int
-fromb64 (inbuf, outbuf, len)
-     char *inbuf, *outbuf;
-     int len;
+fromb64 (char *inbuf, char *outbuf, int len)
 {
   int i, sum;
 
@@ -364,14 +346,10 @@
 int last_sent_step;
 
 static void
-sds_resume (pid, step, siggnal)
-     int pid, step;
-     enum target_signal siggnal;
+sds_resume (int pid, int step, enum target_signal siggnal)
 {
   unsigned char buf[PBUFSIZ];
 
-  dcache_flush (sds_dcache);
-
   last_sent_signal = siggnal;
   last_sent_step = step;
 
@@ -385,8 +363,7 @@
    us a message pending notice.  */
 
 static void
-sds_interrupt (signo)
-     int signo;
+sds_interrupt (int signo)
 {
   unsigned char buf[PBUFSIZ];
 
@@ -405,8 +382,7 @@
 /* The user typed ^C twice.  */
 
 static void
-sds_interrupt_twice (signo)
-     int signo;
+sds_interrupt_twice (int signo)
 {
   signal (signo, ofunc);
 
@@ -418,7 +394,7 @@
 /* Ask the user what to do when an interrupt is received.  */
 
 static void
-interrupt_query ()
+interrupt_query (void)
 {
   target_terminal_ours ();
 
@@ -440,9 +416,7 @@
    what, if anything, that means in the case of this target).  */
 
 static int
-sds_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+sds_wait (int pid, struct target_waitstatus *status)
 {
   unsigned char buf[PBUFSIZ];
   int retlen;
@@ -492,8 +466,7 @@
 
 /* ARGSUSED */
 static void
-sds_fetch_registers (regno)
-     int regno;
+sds_fetch_registers (int regno)
 {
   unsigned char buf[PBUFSIZ];
   int i, retlen;
@@ -530,7 +503,7 @@
    read out the ones we don't want to change first.  */
 
 static void
-sds_prepare_to_store ()
+sds_prepare_to_store (void)
 {
   /* Make sure the entire registers array is valid.  */
   read_register_bytes (0, (char *) NULL, REGISTER_BYTES);
@@ -540,8 +513,7 @@
    of REGISTERS.  FIXME: ignores errors.  */
 
 static void
-sds_store_registers (regno)
-     int regno;
+sds_store_registers (int regno)
 {
   unsigned char *p, buf[PBUFSIZ];
   int i;
@@ -582,10 +554,7 @@
    Returns number of bytes transferred, or 0 for error.  */
 
 static int
-sds_write_bytes (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+sds_write_bytes (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int max_buf_size;		/* Max size of packet output buffer */
   int origlen;
@@ -633,10 +602,7 @@
    Returns number of bytes transferred, or 0 for error.  */
 
 static int
-sds_read_bytes (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+sds_read_bytes (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int max_buf_size;		/* Max size of packet output buffer */
   int origlen, retlen;
@@ -686,24 +652,26 @@
 /* Read or write LEN bytes from inferior memory at MEMADDR,
    transferring to or from debugger address MYADDR.  Write to inferior
    if SHOULD_WRITE is nonzero.  Returns length of data written or
-   read; 0 for error.  */
+   read; 0 for error.  TARGET is unused.  */
 
 /* ARGSUSED */
 static int
-sds_xfer_memory (memaddr, myaddr, len, should_write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int should_write;
-     struct target_ops *target;	/* ignored */
+sds_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int should_write,
+		 struct target_ops *target)
 {
-  return dcache_xfer_memory (sds_dcache, memaddr, myaddr, len, should_write);
+  int res;
+
+  if (should_write)
+    res = sds_write_bytes (memaddr, myaddr, len);
+  else
+    res = sds_read_bytes (memaddr, myaddr, len);
+  
+  return res;
 }
 
 
 static void
-sds_files_info (ignore)
-     struct target_ops *ignore;
+sds_files_info (struct target_ops *ignore)
 {
   puts_filtered ("Debugging over a serial connection, using SDS protocol.\n");
 }
@@ -714,8 +682,7 @@
 /* Read a single character from the remote end, masking it down to 7 bits. */
 
 static int
-readchar (timeout)
-     int timeout;
+readchar (int timeout)
 {
   int ch;
 
@@ -741,9 +708,7 @@
    because 253, 254, and 255 are special flags in the protocol.)  */
 
 static int
-compute_checksum (csum, buf, len)
-     int csum, len;
-     char *buf;
+compute_checksum (int csum, char *buf, int len)
 {
   int i;
 
@@ -758,9 +723,7 @@
    into BUF also.  */
 
 static int
-sds_send (buf, len)
-     unsigned char *buf;
-     int len;
+sds_send (unsigned char *buf, int len)
 {
   putmessage (buf, len);
 
@@ -770,9 +733,7 @@
 /* Send a message to the remote machine.  */
 
 static int
-putmessage (buf, len)
-     unsigned char *buf;
-     int len;
+putmessage (unsigned char *buf, int len)
 {
   int i, enclen;
   unsigned char csum = 0;
@@ -847,8 +808,7 @@
    into BUF.  Returns 0 on any error, 1 on success.  */
 
 static int
-read_frame (buf)
-     char *buf;
+read_frame (char *buf)
 {
   char *bp;
   int c;
@@ -905,9 +865,7 @@
    while the target is executing user code.  */
 
 static int
-getmessage (buf, forever)
-     unsigned char *buf;
-     int forever;
+getmessage (unsigned char *buf, int forever)
 {
   int c, c2, c3;
   int tries;
@@ -1026,23 +984,20 @@
 }
 
 static void
-sds_kill ()
+sds_kill (void)
 {
   /* Don't try to do anything to the target.  */
 }
 
 static void
-sds_mourn ()
+sds_mourn (void)
 {
   unpush_target (&sds_ops);
   generic_mourn_inferior ();
 }
 
 static void
-sds_create_inferior (exec_file, args, env)
-     char *exec_file;
-     char *args;
-     char **env;
+sds_create_inferior (char *exec_file, char *args, char **env)
 {
   inferior_pid = 42000;
 
@@ -1054,9 +1009,7 @@
 }
 
 static void
-sds_load (filename, from_tty)
-     char *filename;
-     int from_tty;
+sds_load (char *filename, int from_tty)
 {
   generic_load (filename, from_tty);
 
@@ -1068,9 +1021,7 @@
    replaced instruction back to the debugger.  */
 
 static int
-sds_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+sds_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   int i, retlen;
   unsigned char *p, buf[PBUFSIZ];
@@ -1092,9 +1043,7 @@
 }
 
 static int
-sds_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+sds_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   int i, retlen;
   unsigned char *p, buf[PBUFSIZ];
@@ -1115,7 +1064,7 @@
 }
 
 static void
-init_sds_ops ()
+init_sds_ops (void)
 {
   sds_ops.to_shortname = "sds";
   sds_ops.to_longname = "Remote serial target with SDS protocol";
@@ -1150,9 +1099,7 @@
    reply message.  */
 
 static void
-sds_command (args, from_tty)
-     char *args;
-     int from_tty;
+sds_command (char *args, int from_tty)
 {
   char *p;
   int i, len, retlen;
@@ -1180,7 +1127,7 @@
 }
 
 void
-_initialize_remote_sds ()
+_initialize_remote_sds (void)
 {
   init_sds_ops ();
   add_target (&sds_ops);
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 3377fef..8b03b88 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -120,9 +120,7 @@
 static SIM_DESC gdbsim_desc = 0;
 
 static void
-dump_mem (buf, len)
-     char *buf;
-     int len;
+dump_mem (char *buf, int len)
 {
   if (len <= 8)
     {
@@ -150,7 +148,7 @@
 /* Initialize gdb_callback.  */
 
 static void
-init_callbacks ()
+init_callbacks (void)
 {
   if (!callbacks_initialized)
     {
@@ -173,7 +171,7 @@
 /* Release callbacks (free resources used by them).  */
 
 static void
-end_callbacks ()
+end_callbacks (void)
 {
   if (callbacks_initialized)
     {
@@ -185,10 +183,7 @@
 /* GDB version of os_write_stdout callback.  */
 
 static int
-gdb_os_write_stdout (p, buf, len)
-     host_callback *p;
-     const char *buf;
-     int len;
+gdb_os_write_stdout (host_callback *p, const char *buf, int len)
 {
   int i;
   char b[2];
@@ -200,8 +195,7 @@
 /* GDB version of os_flush_stdout callback.  */
 
 static void
-gdb_os_flush_stdout (p)
-     host_callback *p;
+gdb_os_flush_stdout (host_callback *p)
 {
   gdb_flush (gdb_stdtarg);
 }
@@ -209,10 +203,7 @@
 /* GDB version of os_write_stderr callback.  */
 
 static int
-gdb_os_write_stderr (p, buf, len)
-     host_callback *p;
-     const char *buf;
-     int len;
+gdb_os_write_stderr (host_callback *p, const char *buf, int len)
 {
   int i;
   char b[2];
@@ -229,8 +220,7 @@
 /* GDB version of os_flush_stderr callback.  */
 
 static void
-gdb_os_flush_stderr (p)
-     host_callback *p;
+gdb_os_flush_stderr (host_callback *p)
 {
   gdb_flush (gdb_stderr);
 }
@@ -280,13 +270,8 @@
     }
 }
 
-#ifndef REGISTER_SIM_REGNO
-#define REGISTER_SIM_REGNO(N) (N)
-#endif
-
 static void
-gdbsim_fetch_register (regno)
-     int regno;
+gdbsim_fetch_register (int regno)
 {
   static int warn_user = 1;
   if (regno == -1)
@@ -330,8 +315,7 @@
 
 
 static void
-gdbsim_store_register (regno)
-     int regno;
+gdbsim_store_register (int regno)
 {
   if (regno == -1)
     {
@@ -363,7 +347,7 @@
    and releasing other resources acquired by the simulated program.  */
 
 static void
-gdbsim_kill ()
+gdbsim_kill (void)
 {
   if (sr_get_debug ())
     printf_filtered ("gdbsim_kill\n");
@@ -378,9 +362,7 @@
    GDB's symbol tables to match.  */
 
 static void
-gdbsim_load (prog, fromtty)
-     char *prog;
-     int fromtty;
+gdbsim_load (char *prog, int fromtty)
 {
   if (sr_get_debug ())
     printf_filtered ("gdbsim_load: prog \"%s\"\n", prog);
@@ -409,10 +391,7 @@
    user types "run" after having attached.  */
 
 static void
-gdbsim_create_inferior (exec_file, args, env)
-     char *exec_file;
-     char *args;
-     char **env;
+gdbsim_create_inferior (char *exec_file, char *args, char **env)
 {
   int len;
   char *arg_buf, **argv;
@@ -461,9 +440,7 @@
 /* Called when selecting the simulator. EG: (gdb) target sim name.  */
 
 static void
-gdbsim_open (args, from_tty)
-     char *args;
-     int from_tty;
+gdbsim_open (char *args, int from_tty)
 {
   int len;
   char *arg_buf;
@@ -544,8 +521,7 @@
 /* Close out all files and local state before this target loses control. */
 
 static void
-gdbsim_close (quitting)
-     int quitting;
+gdbsim_close (int quitting)
 {
   if (sr_get_debug ())
     printf_filtered ("gdbsim_close: quitting %d\n", quitting);
@@ -572,9 +548,7 @@
    Use this when you want to detach and do something else with your gdb.  */
 
 static void
-gdbsim_detach (args, from_tty)
-     char *args;
-     int from_tty;
+gdbsim_detach (char *args, int from_tty)
 {
   if (sr_get_debug ())
     printf_filtered ("gdbsim_detach: args \"%s\"\n", args);
@@ -592,9 +566,7 @@
 static int resume_step;
 
 static void
-gdbsim_resume (pid, step, siggnal)
-     int pid, step;
-     enum target_signal siggnal;
+gdbsim_resume (int pid, int step, enum target_signal siggnal)
 {
   if (inferior_pid != 42)
     error ("The program is not being run.");
@@ -616,7 +588,7 @@
    For simulators that do not support this operation, just abort */
 
 static void
-gdbsim_stop ()
+gdbsim_stop (void)
 {
   if (!sim_stop (gdbsim_desc))
     {
@@ -628,8 +600,7 @@
    Taken from gdb/util.c - should be in a library */
 
 static int
-gdb_os_poll_quit (p)
-     host_callback *p;
+gdb_os_poll_quit (host_callback *p)
 {
   if (ui_loop_hook != NULL)
     ui_loop_hook (0);
@@ -652,16 +623,13 @@
    just as `wait' would. */
 
 static void
-gdbsim_cntrl_c (signo)
-     int signo;
+gdbsim_cntrl_c (int signo)
 {
   gdbsim_stop ();
 }
 
 static int
-gdbsim_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+gdbsim_wait (int pid, struct target_waitstatus *status)
 {
   static RETSIGTYPE (*prev_sigint) ();
   int sigrc = 0;
@@ -733,18 +701,20 @@
    debugged.  */
 
 static void
-gdbsim_prepare_to_store ()
+gdbsim_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
+/* Transfer LEN bytes between GDB address MYADDR and target address
+   MEMADDR.  If WRITE is non-zero, transfer them to the target,
+   otherwise transfer them from the target.  TARGET is unused.
+
+   Returns the number of bytes transferred. */
+
 static int
-gdbsim_xfer_inferior_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* ignored */
+gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
+			     int write, struct target_ops *target)
 {
   if (!program_loaded)
     error ("No program loaded.");
@@ -774,8 +744,7 @@
 }
 
 static void
-gdbsim_files_info (target)
-     struct target_ops *target;
+gdbsim_files_info (struct target_ops *target)
 {
   char *file = "nothing";
 
@@ -796,7 +765,7 @@
 /* Clear the simulator's notion of what the break points are.  */
 
 static void
-gdbsim_mourn_inferior ()
+gdbsim_mourn_inferior (void)
 {
   if (sr_get_debug ())
     printf_filtered ("gdbsim_mourn_inferior:\n");
@@ -806,9 +775,7 @@
 }
 
 static int
-gdbsim_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+gdbsim_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
 #ifdef SIM_HAS_BREAKPOINTS
   SIM_RC retcode;
@@ -830,9 +797,7 @@
 }
 
 static int
-gdbsim_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+gdbsim_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
 #ifdef SIM_HAS_BREAKPOINTS
   SIM_RC retcode;
@@ -858,9 +823,7 @@
    simulator must do any command interpretation work.  */
 
 void
-simulator_command (args, from_tty)
-     char *args;
-     int from_tty;
+simulator_command (char *args, int from_tty)
 {
   if (gdbsim_desc == NULL)
     {
@@ -962,7 +925,7 @@
 }
 
 void
-_initialize_remote_sim ()
+_initialize_remote_sim (void)
 {
   init_gdbsim_ops ();
   add_target (&gdbsim_ops);
diff --git a/gdb/remote-st.c b/gdb/remote-st.c
index e820b28..85077bb 100644
--- a/gdb/remote-st.c
+++ b/gdb/remote-st.c
@@ -84,8 +84,7 @@
    stuff.  */
 
 static int
-readchar (timeout)
-     int timeout;
+readchar (int timeout)
 {
   int c;
 
@@ -113,14 +112,12 @@
    non-zero, then discard non-matching input, else print it out.
    Let the user break out immediately.  */
 static void
-expect (string, discard)
-     char *string;
-     int discard;
+expect (char *string, int discard)
 {
   char *p = string;
   int c;
 
-  immediate_quit = 1;
+  immediate_quit++;
   while (1)
     {
       c = readchar (timeout);
@@ -128,7 +125,7 @@
 	{
 	  if (*p == '\0')
 	    {
-	      immediate_quit = 0;
+	      immediate_quit--;
 	      return;
 	    }
 	}
@@ -160,8 +157,7 @@
    necessary to prevent getting into states from which we can't
    recover.  */
 static void
-expect_prompt (discard)
-     int discard;
+expect_prompt (int discard)
 {
 #if defined (LOG_FILE)
   /* This is a convenient place to do this.  The idea is to do it often
@@ -174,8 +170,7 @@
 /* Get a hex digit from the remote system & return its value.
    If ignore_space is nonzero, ignore spaces (not newline, tab, etc).  */
 static int
-get_hex_digit (ignore_space)
-     int ignore_space;
+get_hex_digit (int ignore_space)
 {
   int ch;
   while (1)
@@ -200,8 +195,7 @@
 /* Get a byte from stdebug and put it in *BYT.  Accept any number
    leading spaces.  */
 static void
-get_hex_byte (byt)
-     char *byt;
+get_hex_byte (char *byt)
 {
   int val;
 
@@ -213,9 +207,7 @@
 /* Get N 32-bit words from remote, each preceded by a space,
    and put them in registers starting at REGNO.  */
 static void
-get_hex_regs (n, regno)
-     int n;
-     int regno;
+get_hex_regs (int n, int regno)
 {
   long val;
   int i;
@@ -234,10 +226,7 @@
 /* This is called not only when we first attach, but also when the
    user types "run" after having attached.  */
 static void
-st2000_create_inferior (execfile, args, env)
-     char *execfile;
-     char *args;
-     char **env;
+st2000_create_inferior (char *execfile, char *args, char **env)
 {
   int entry_pt;
 
@@ -276,9 +265,7 @@
 static char dev_name[100];
 
 static void
-st2000_open (args, from_tty)
-     char *args;
-     int from_tty;
+st2000_open (char *args, int from_tty)
 {
   int n;
   char junk[100];
@@ -323,8 +310,7 @@
 /* Close out all files and local state before this target loses control. */
 
 static void
-st2000_close (quitting)
-     int quitting;
+st2000_close (int quitting)
 {
   SERIAL_CLOSE (st2000_desc);
 
@@ -343,8 +329,7 @@
    Use this when you want to detach and do something else
    with your gdb.  */
 static void
-st2000_detach (from_tty)
-     int from_tty;
+st2000_detach (int from_tty)
 {
   pop_target ();		/* calls st2000_close to do the real work */
   if (from_tty)
@@ -354,9 +339,7 @@
 /* Tell the remote machine to resume.  */
 
 static void
-st2000_resume (pid, step, sig)
-     int pid, step;
-     enum target_signal sig;
+st2000_resume (int pid, int step, enum target_signal sig)
 {
   if (step)
     {
@@ -376,8 +359,7 @@
    storing status in STATUS just as `wait' would.  */
 
 static int
-st2000_wait (status)
-     struct target_waitstatus *status;
+st2000_wait (struct target_waitstatus *status)
 {
   int old_timeout = timeout;
 
@@ -401,8 +383,7 @@
    STDEBUG wants.  Lets take advantage of that just as long as possible! */
 
 static char *
-get_reg_name (regno)
-     int regno;
+get_reg_name (int regno)
 {
   static char buf[50];
   const char *p;
@@ -420,7 +401,7 @@
 /* Read the remote registers into the block REGS.  */
 
 static void
-st2000_fetch_registers ()
+st2000_fetch_registers (void)
 {
   int regno;
 
@@ -434,8 +415,7 @@
 /* Fetch register REGNO, or all registers if REGNO is -1.
    Returns errno value.  */
 static void
-st2000_fetch_register (regno)
-     int regno;
+st2000_fetch_register (int regno)
 {
   if (regno == -1)
     st2000_fetch_registers ();
@@ -454,7 +434,7 @@
 /* Store the remote registers from the contents of the block REGS.  */
 
 static void
-st2000_store_registers ()
+st2000_store_registers (void)
 {
   int regno;
 
@@ -467,8 +447,7 @@
 /* Store register REGNO, or all if REGNO == 0.
    Return errno value.  */
 static void
-st2000_store_register (regno)
-     int regno;
+st2000_store_register (int regno)
 {
   if (regno == -1)
     st2000_store_registers ();
@@ -488,13 +467,13 @@
    debugged.  */
 
 static void
-st2000_prepare_to_store ()
+st2000_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
 static void
-st2000_files_info ()
+st2000_files_info (void)
 {
   printf ("\tAttached to %s at %d baud.\n",
 	  dev_name, baudrate);
@@ -503,10 +482,7 @@
 /* Copy LEN bytes of data from debugger memory at MYADDR
    to inferior's memory at MEMADDR.  Returns length moved.  */
 static int
-st2000_write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     unsigned char *myaddr;
-     int len;
+st2000_write_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 {
   int i;
 
@@ -521,10 +497,7 @@
 /* Read LEN bytes from inferior memory at MEMADDR.  Put the result
    at debugger address MYADDR.  Returns length moved.  */
 static int
-st2000_read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+st2000_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int i;
 
@@ -575,14 +548,15 @@
   return len;
 }
 
-/* FIXME-someday!  Merge these two.  */
+/* Transfer LEN bytes between GDB address MYADDR and target address
+   MEMADDR.  If WRITE is non-zero, transfer them to the target,
+   otherwise transfer them from the target.  TARGET is unused.
+
+   Returns the number of bytes transferred. */
+
 static int
-st2000_xfer_inferior_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* ignored */
+st2000_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
+			     int write, struct target_ops *target)
 {
   if (write)
     return st2000_write_inferior_memory (memaddr, myaddr, len);
@@ -591,9 +565,7 @@
 }
 
 static void
-st2000_kill (args, from_tty)
-     char *args;
-     int from_tty;
+st2000_kill (char *args, int from_tty)
 {
   return;			/* Ignore attempts to kill target system */
 }
@@ -605,7 +577,7 @@
    instructions.  */
 
 static void
-st2000_mourn_inferior ()
+st2000_mourn_inferior (void)
 {
   remove_breakpoints ();
   unpush_target (&st2000_ops);
@@ -618,9 +590,7 @@
 {0};
 
 static int
-st2000_insert_breakpoint (addr, shadow)
-     CORE_ADDR addr;
-     char *shadow;
+st2000_insert_breakpoint (CORE_ADDR addr, char *shadow)
 {
   int i;
   CORE_ADDR bp_addr = addr;
@@ -644,9 +614,7 @@
 }
 
 static int
-st2000_remove_breakpoint (addr, shadow)
-     CORE_ADDR addr;
-     char *shadow;
+st2000_remove_breakpoint (CORE_ADDR addr, char *shadow)
 {
   int i;
 
@@ -669,9 +637,7 @@
    on the users terminal until the prompt is seen. */
 
 static void
-st2000_command (args, fromtty)
-     char *args;
-     int fromtty;
+st2000_command (char *args, int fromtty)
 {
   if (!st2000_desc)
     error ("st2000 target not open.");
@@ -689,7 +655,7 @@
 /*static struct ttystate ttystate; */
 
 static void
-cleanup_tty ()
+cleanup_tty (void)
 {
   printf ("\r\n[Exiting connect mode]\r\n");
 /*  SERIAL_RESTORE(0, &ttystate); */
@@ -699,9 +665,7 @@
 /* This all should now be in serial.c */
 
 static void
-connect_command (args, fromtty)
-     char *args;
-     int fromtty;
+connect_command (char *args, int fromtty)
 {
   fd_set readfds;
   int numfds;
@@ -855,7 +819,7 @@
 };
 
 void
-_initialize_remote_st2000 ()
+_initialize_remote_st2000 (void)
 {
   init_st2000_ops ();
   add_target (&st2000_ops);
diff --git a/gdb/remote-udi.c b/gdb/remote-udi.c
index e0e1f70..a09c70e 100644
--- a/gdb/remote-udi.c
+++ b/gdb/remote-udi.c
@@ -124,17 +124,14 @@
    user types "run" after having attached.  */
 
 static void
-udi_create_inferior (execfile, args, env)
-     char *execfile;
-     char *args;
-     char **env;
+udi_create_inferior (char *execfile, char *args, char **env)
 {
   char *args1;
 
   if (execfile)
     {
       if (prog_name != NULL)
-	free (prog_name);
+	xfree (prog_name);
       prog_name = savestring (execfile, strlen (execfile));
     }
   else if (entry.Offset)
@@ -187,7 +184,7 @@
 }
 
 static void
-udi_mourn ()
+udi_mourn (void)
 {
 #if 0
   /* Requiring "target udi" each time you run is a major pain.  I suspect
@@ -212,9 +209,7 @@
 /* XXX - need cleanups for udiconnect for various failures!!! */
 
 static void
-udi_open (name, from_tty)
-     char *name;
-     int from_tty;
+udi_open (char *name, int from_tty)
 {
   unsigned int prl;
   char *p;
@@ -234,7 +229,7 @@
     bkpt_table[cnt].Type = 0;
 
   if (udi_config_id)
-    free (udi_config_id);
+    xfree (udi_config_id);
 
   if (!name)
     error ("Usage: target udi config_id, where config_id appears in udi_soc file");
@@ -304,8 +299,8 @@
    Use this when you want to detach and do something else
    with your gdb.  */
 static void
-udi_close (quitting)		/*FIXME: how is quitting used */
-     int quitting;
+udi_close (			/*FIXME: how is quitting used */
+	    int quitting)
 {
   if (udi_session_id < 0)
     return;
@@ -333,9 +328,7 @@
  * Upon exiting the process's execution is stopped.
  */
 static void
-udi_attach (args, from_tty)
-     char *args;
-     int from_tty;
+udi_attach (char *args, int from_tty)
 {
   UDIResource From;
   UDIInt32 PC_adds;
@@ -366,9 +359,7 @@
    Use this when you want to detach and do something else
    with your gdb.  Leave remote process running (with no breakpoints set). */
 static void
-udi_detach (args, from_tty)
-     char *args;
-     int from_tty;
+udi_detach (char *args, int from_tty)
 {
 
   remove_breakpoints ();	/* Just in case there were any left in */
@@ -392,9 +383,7 @@
 ** Tell the remote machine to resume.  */
 
 static void
-udi_resume (pid, step, sig)
-     int pid, step;
-     enum target_signal sig;
+udi_resume (int pid, int step, enum target_signal sig)
 {
   UDIError tip_error;
   UDIUInt32 Steps = 1;
@@ -420,9 +409,7 @@
    storing status in STATUS just as `wait' would.  */
 
 static int
-udi_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+udi_wait (int pid, struct target_waitstatus *status)
 {
   UDIInt32 MaxTime;
   UDIPId PId;
@@ -602,7 +589,7 @@
 
 #if 0
 /* Handy for debugging */
-udi_pc ()
+udi_pc (void)
 {
   UDIResource From;
   UDIUInt32 *To;
@@ -654,8 +641,7 @@
  * If regno==-1 then read all the registers.
  */
 static void
-udi_fetch_registers (regno)
-     int regno;
+udi_fetch_registers (int regno)
 {
   UDIResource From;
   UDIUInt32 *To;
@@ -781,8 +767,7 @@
  */
 
 static void
-udi_store_registers (regno)
-     int regno;
+udi_store_registers (int regno)
 {
   UDIUInt32 *From;
   UDIResource To;
@@ -907,15 +892,14 @@
    debugged.  */
 
 static void
-udi_prepare_to_store ()
+udi_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
 /********************************************************** TRANSLATE_ADDR */
 static CORE_ADDR
-translate_addr (addr)
-     CORE_ADDR addr;
+translate_addr (CORE_ADDR addr)
 {
 #if defined(ULTRA3) && defined(KERNEL_DEBUGGING)
   /* Check for a virtual address in the kernel */
@@ -938,11 +922,8 @@
 /************************************************* UDI_XFER_INFERIOR_MEMORY */
 /* FIXME!  Merge these two.  */
 static int
-udi_xfer_inferior_memory (memaddr, myaddr, len, write)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
+udi_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+			  struct target_ops * target)
 {
 
   memaddr = translate_addr (memaddr);
@@ -955,7 +936,7 @@
 
 /********************************************************** UDI_FILES_INFO */
 static void
-udi_files_info ()
+udi_files_info (struct target_ops *target)
 {
   printf_unfiltered ("\tAttached to UDI socket to %s", udi_config_id);
   if (prog_name != NULL)
@@ -965,9 +946,7 @@
 
 /**************************************************** UDI_INSERT_BREAKPOINT */
 static int
-udi_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+udi_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   int cnt;
   UDIError err;
@@ -998,9 +977,7 @@
 
 /**************************************************** UDI_REMOVE_BREAKPOINT */
 static int
-udi_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+udi_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   int cnt;
   UDIError err;
@@ -1022,9 +999,7 @@
 }
 
 static void
-udi_kill (arg, from_tty)
-     char *arg;
-     int from_tty;
+udi_kill (void)
 {
 
 #if 0
@@ -1076,9 +1051,7 @@
  */
 
 static void
-download (load_arg_string, from_tty)
-     char *load_arg_string;
-     int from_tty;
+download (char *load_arg_string, int from_tty)
 {
 #define DEFAULT_MEM_STACK_SIZE 		0x6000
 #define DEFAULT_REG_STACK_SIZE 		0x2000
@@ -1108,7 +1081,7 @@
     error ("Must specify at least a file name with the load command");
 
   filename = tilde_expand (filename);
-  make_cleanup (free, filename);
+  make_cleanup (xfree, filename);
 
   while (token = strtok (NULL, " \t"))
     {
@@ -1307,9 +1280,7 @@
 /* Function to download an image into the remote target.  */
 
 static void
-udi_load (args, from_tty)
-     char *args;
-     int from_tty;
+udi_load (char *args, int from_tty)
 {
   download (args, from_tty);
 
@@ -1327,10 +1298,7 @@
 ** Copy LEN bytes of data from debugger memory at MYADDR
    to inferior's memory at MEMADDR.  Returns number of bytes written.  */
 static int
-udi_write_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+udi_write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int nwritten = 0;
   UDIUInt32 *From;
@@ -1367,10 +1335,7 @@
 ** Read LEN bytes from inferior memory at MEMADDR.  Put the result
    at debugger address MYADDR.  Returns number of bytes read.  */
 static int
-udi_read_inferior_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+udi_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   int nread = 0;
   UDIResource From;
@@ -1406,8 +1371,7 @@
 
 /********************************************************************* WARNING
 */
-udi_warning (num)
-     int num;
+udi_warning (int num)
 {
   error ("ERROR while loading program into remote TIP: $d\n", num);
 }
@@ -1418,8 +1382,7 @@
  * Returns 0/-1 on success/failure.  
  */
 static void
-fetch_register (regno)
-     int regno;
+fetch_register (int regno)
 {
   UDIResource From;
   UDIUInt32 To;
@@ -1483,8 +1446,7 @@
  * Returns 0/-1 on success/failure.  
  */
 static int
-store_register (regno)
-     int regno;
+store_register (int regno)
 {
   int result;
   UDIUInt32 From;
@@ -1566,8 +1528,7 @@
  * Convert a gdb special register number to a 29000 special register number.
  */
 static int
-regnum_to_srnum (regno)
-     int regno;
+regnum_to_srnum (int regno)
 {
   switch (regno)
     {
@@ -1636,8 +1597,7 @@
  * FIXME: Doesn't know anything about I_CACHE/D_CACHE.
  */
 static CPUSpace
-udi_memory_space (addr)
-     CORE_ADDR addr;
+udi_memory_space (CORE_ADDR addr)
 {
   UDIUInt32 tstart = IMemStart;
   UDIUInt32 tend = tstart + IMemSize;
@@ -1666,19 +1626,18 @@
 */
 
 void
-convert16 ()
+convert16 (void)
 {;
 }
 void
-convert32 ()
+convert32 (void)
 {;
 }
 struct ui_file *EchoFile = 0;	/* used for debugging */
 int QuietMode = 0;		/* used for debugging */
 
 #ifdef NO_HIF_SUPPORT
-service_HIF (msg)
-     union msg_t *msg;
+service_HIF (union msg_t *msg)
 {
   return (0);			/* Emulate a failure */
 }
@@ -1755,7 +1714,7 @@
 };
 
 void
-_initialize_remote_udi ()
+_initialize_remote_udi (void)
 {
   init_udi_ops ();
   add_target (&udi_ops);
diff --git a/gdb/remote-utils.c b/gdb/remote-utils.c
index 457d7b1..e723a56 100644
--- a/gdb/remote-utils.c
+++ b/gdb/remote-utils.c
@@ -78,9 +78,7 @@
 static void sr_com (char *, int);
 
 static void
-usage (proto, junk)
-     char *proto;
-     char *junk;
+usage (char *proto, char *junk)
 {
   if (junk != NULL)
     fprintf_unfiltered (gdb_stderr, "Unrecognized arguments: `%s'.\n", junk);
@@ -103,9 +101,7 @@
 }
 
 void
-sr_scan_args (proto, args)
-     char *proto;
-     char *args;
+sr_scan_args (char *proto, char *args)
 {
   int n;
   char *p, *q;
@@ -149,17 +145,14 @@
 }
 
 void
-gr_generic_checkin ()
+gr_generic_checkin (void)
 {
   sr_write_cr ("");
   gr_expect_prompt ();
 }
 
 void
-gr_open (args, from_tty, gr)
-     char *args;
-     int from_tty;
-     struct gr_settings *gr;
+gr_open (char *args, int from_tty, struct gr_settings *gr)
 {
   target_preopen (from_tty);
   sr_scan_args (gr->ops->to_shortname, args);
@@ -167,8 +160,6 @@
 
   gr_settings = gr;
 
-  gr_set_dcache (dcache_init (gr->readfunc, gr->writefunc));
-
   if (sr_get_desc () != NULL)
     gr_close (0);
 
@@ -225,7 +216,7 @@
    and doing all the fancy timeout stuff.  */
 
 int
-sr_readchar ()
+sr_readchar (void)
 {
   int buf;
 
@@ -241,7 +232,7 @@
 }
 
 int
-sr_pollchar ()
+sr_pollchar (void)
 {
   int buf;
 
@@ -262,12 +253,11 @@
 /* Keep discarding input from the remote system, until STRING is found.
    Let the user break out immediately.  */
 void
-sr_expect (string)
-     char *string;
+sr_expect (char *string)
 {
   char *p = string;
 
-  immediate_quit = 1;
+  immediate_quit++;
   while (1)
     {
       if (sr_readchar () == *p)
@@ -275,7 +265,7 @@
 	  p++;
 	  if (*p == '\0')
 	    {
-	      immediate_quit = 0;
+	      immediate_quit--;
 	      return;
 	    }
 	}
@@ -285,9 +275,7 @@
 }
 
 void
-sr_write (a, l)
-     char *a;
-     int l;
+sr_write (char *a, int l)
 {
   int i;
 
@@ -302,8 +290,7 @@
 }
 
 void
-sr_write_cr (s)
-     char *s;
+sr_write_cr (char *s)
 {
   sr_write (s, strlen (s));
   sr_write ("\r", 1);
@@ -311,9 +298,7 @@
 }
 
 int
-sr_timed_read (buf, n)
-     char *buf;
-     int n;
+sr_timed_read (char *buf, int n)
 {
   int i;
   char c;
@@ -336,8 +321,7 @@
    ignore_space is nonzero, ignore spaces (not newline, tab, etc).  */
 
 int
-sr_get_hex_digit (ignore_space)
-     int ignore_space;
+sr_get_hex_digit (int ignore_space)
 {
   int ch;
 
@@ -361,8 +345,7 @@
 /* Get a byte from the remote and put it in *BYT.  Accept any number
    leading spaces.  */
 void
-sr_get_hex_byte (byt)
-     char *byt;
+sr_get_hex_byte (char *byt)
 {
   int val;
 
@@ -373,7 +356,7 @@
 
 /* Read a 32-bit hex word from the remote, preceded by a space  */
 long
-sr_get_hex_word ()
+sr_get_hex_word (void)
 {
   long val;
   int j;
@@ -391,9 +374,7 @@
    FIXME: Can't handle commands that take input.  */
 
 static void
-sr_com (args, fromtty)
-     char *args;
-     int fromtty;
+sr_com (char *args, int fromtty)
 {
   sr_check_open ();
 
@@ -409,8 +390,7 @@
 }
 
 void
-gr_close (quitting)
-     int quitting;
+gr_close (int quitting)
 {
   gr_clear_all_breakpoints ();
 
@@ -432,9 +412,7 @@
    with your gdb.  */
 
 void
-gr_detach (args, from_tty)
-     char *args;
-     int from_tty;
+gr_detach (char *args, int from_tty)
 {
   if (args)
     error ("Argument given to \"detach\" when remotely debugging.");
@@ -450,8 +428,7 @@
 }
 
 void
-gr_files_info (ops)
-     struct target_ops *ops;
+gr_files_info (struct target_ops *ops)
 {
 #ifdef __GO32__
   printf_filtered ("\tAttached to DOS asynctsr\n");
@@ -471,7 +448,7 @@
 }
 
 void
-gr_mourn ()
+gr_mourn (void)
 {
   gr_clear_all_breakpoints ();
   unpush_target (gr_get_ops ());
@@ -479,7 +456,7 @@
 }
 
 void
-gr_kill ()
+gr_kill (void)
 {
   return;
 }
@@ -487,10 +464,7 @@
 /* This is called not only when we first attach, but also when the
    user types "run" after having attached.  */
 void
-gr_create_inferior (execfile, args, env)
-     char *execfile;
-     char *args;
-     char **env;
+gr_create_inferior (char *execfile, char *args, char **env)
 {
   int entry_pt;
 
@@ -521,9 +495,7 @@
    pass non-matching data on.  */
 
 int
-gr_multi_scan (list, passthrough)
-     char *list[];
-     int passthrough;
+gr_multi_scan (char *list[], int passthrough)
 {
   char *swallowed = NULL;	/* holding area */
   char *swallowed_p = swallowed;	/* Current position in swallowed.  */
@@ -613,34 +585,13 @@
    debugged.  */
 
 void
-gr_prepare_to_store ()
+gr_prepare_to_store (void)
 {
   /* Do nothing, since we assume we can store individual regs */
 }
 
-/* Read a word from remote address ADDR and return it.
- * This goes through the data cache.
- */
-int
-gr_fetch_word (addr)
-     CORE_ADDR addr;
-{
-  return dcache_fetch (gr_get_dcache (), addr);
-}
-
-/* Write a word WORD into remote address ADDR.
-   This goes through the data cache.  */
-
 void
-gr_store_word (addr, word)
-     CORE_ADDR addr;
-     int word;
-{
-  dcache_poke (gr_get_dcache (), addr, word);
-}
-
-void
-_initialize_sr_support ()
+_initialize_sr_support (void)
 {
 /* FIXME-now: if target is open... */
   add_show_from_set (add_set_cmd ("remotedevice", no_class,
diff --git a/gdb/remote-utils.h b/gdb/remote-utils.h
index d82ea8d..9f57068 100644
--- a/gdb/remote-utils.h
+++ b/gdb/remote-utils.h
@@ -24,7 +24,6 @@
 
 #include "serial.h"
 #include "target.h"
-#include "dcache.h"
 
 /* Stuff that should be shared (and handled consistently) among the various
    remote targets.  */
@@ -73,22 +72,14 @@
 
 struct gr_settings
   {
-    /* This is our data cache. */
-    DCACHE *dcache;
     char *prompt;
     struct target_ops *ops;
     int (*clear_all_breakpoints) (void);
-    memxferfunc readfunc;
-    memxferfunc writefunc;
     void (*checkin) (void);
   };
 
 extern struct gr_settings *gr_settings;
 
-/* get and set dcache. */
-#define gr_get_dcache()			(gr_settings->dcache)
-#define gr_set_dcache(newval)		(gr_settings->dcache = (newval))
-
 /* get and set prompt. */
 #define gr_get_prompt()			(gr_settings->prompt)
 #define gr_set_prompt(newval)		(gr_settings->prompt = (newval))
@@ -117,7 +108,6 @@
 
 #define gr_expect_prompt()	sr_expect(gr_get_prompt())
 
-int gr_fetch_word (CORE_ADDR addr);
 int gr_multi_scan (char *list[], int passthrough);
 int sr_get_hex_digit (int ignore_space);
 int sr_pollchar (void);
@@ -132,7 +122,6 @@
 void gr_kill (void);
 void gr_mourn (void);
 void gr_prepare_to_store (void);
-void gr_store_word (CORE_ADDR addr, int word);
 void sr_expect (char *string);
 void sr_get_hex_byte (char *byt);
 void sr_scan_args (char *proto, char *args);
diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c
index c471373..011e1ea 100644
--- a/gdb/remote-vx.c
+++ b/gdb/remote-vx.c
@@ -111,11 +111,8 @@
    Returns 0 for success, -1 for failure.  */
 
 static int
-net_load (filename, pTextAddr, pDataAddr, pBssAddr)
-     char *filename;
-     CORE_ADDR *pTextAddr;
-     CORE_ADDR *pDataAddr;
-     CORE_ADDR *pBssAddr;
+net_load (char *filename, CORE_ADDR *pTextAddr, CORE_ADDR *pDataAddr,
+	  CORE_ADDR *pBssAddr)
 {
   enum clnt_stat status;
   struct ldfile ldstruct;
@@ -154,9 +151,7 @@
 /* returns 0 if successful, errno if RPC failed or VxWorks complains. */
 
 static int
-net_break (addr, procnum)
-     int addr;
-     u_long procnum;
+net_break (int addr, u_long procnum)
 {
   enum clnt_stat status;
   int break_status;
@@ -183,8 +178,7 @@
 /* returns 0 if successful, errno otherwise */
 
 static int
-vx_insert_breakpoint (addr)
-     int addr;
+vx_insert_breakpoint (int addr)
 {
   return net_break (addr, VX_BREAK_ADD);
 }
@@ -192,8 +186,7 @@
 /* returns 0 if successful, errno otherwise */
 
 static int
-vx_remove_breakpoint (addr)
-     int addr;
+vx_remove_breakpoint (int addr)
 {
   return net_break (addr, VX_BREAK_DELETE);
 }
@@ -206,10 +199,7 @@
    On VxWorks, we ignore exec_file.  */
 
 static void
-vx_create_inferior (exec_file, args, env)
-     char *exec_file;
-     char *args;
-     char **env;
+vx_create_inferior (char *exec_file, char *args, char **env)
 {
   enum clnt_stat status;
   arg_array passArgs;
@@ -262,9 +252,7 @@
    argument string ARGSTRING.  */
 
 static void
-parse_args (arg_string, arg_struct)
-     register char *arg_string;
-     arg_array *arg_struct;
+parse_args (register char *arg_string, arg_array *arg_struct)
 {
   register int arg_count = 0;	/* number of arguments */
   register int arg_index = 0;
@@ -304,8 +292,7 @@
    to the first non-white character.  */
 
 static char *
-skip_white_space (p)
-     register char *p;
+skip_white_space (register char *p)
 {
   while (*p == ' ' || *p == '\t')
     p++;
@@ -317,8 +304,7 @@
    if no whitespace is found.  */
 
 static char *
-find_white_space (p)
-     register char *p;
+find_white_space (register char *p)
 {
   register int c;
 
@@ -344,8 +330,7 @@
    Returns -1 if remote wait failed, task status otherwise.  */
 
 static int
-net_wait (pEvent)
-     RDB_EVENT *pEvent;
+net_wait (RDB_EVENT *pEvent)
 {
   int pid;
   enum clnt_stat status;
@@ -369,7 +354,7 @@
    Returns -1 if suspend fails on target system, 0 otherwise.  */
 
 static int
-net_quit ()
+net_quit (void)
 {
   int pid;
   int quit_status;
@@ -391,10 +376,7 @@
 /* Read a register or registers from the remote system.  */
 
 void
-net_read_registers (reg_buf, len, procnum)
-     char *reg_buf;
-     int len;
-     u_long procnum;
+net_read_registers (char *reg_buf, int len, u_long procnum)
 {
   int status;
   Rptrace ptrace_in;
@@ -439,10 +421,7 @@
    a utility routine used by vx_write_register ().  */
 
 void
-net_write_registers (reg_buf, len, procnum)
-     char *reg_buf;
-     int len;
-     u_long procnum;
+net_write_registers (char *reg_buf, int len, u_long procnum)
 {
   int status;
   Rptrace ptrace_in;
@@ -481,7 +460,7 @@
    read out their current values now.  */
 
 static void
-vx_prepare_to_store ()
+vx_prepare_to_store (void)
 {
   /* Fetch all registers, if any of them are not yet fetched.  */
   read_register_bytes (0, NULL, REGISTER_BYTES);
@@ -489,19 +468,15 @@
 
 /* Copy LEN bytes to or from remote inferior's memory starting at MEMADDR
    to debugger memory starting at MYADDR.  WRITE is true if writing to the
-   inferior.
+   inferior.  TARGET is unused.
    Result is the number of bytes written or read (zero if error).  The
    protocol allows us to return a negative count, indicating that we can't
    handle the current address but can handle one N bytes further, but
    vxworks doesn't give us that information.  */
 
 static int
-vx_xfer_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* ignored */
+vx_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		struct target_ops *target)
 {
   int status;
   Rptrace ptrace_in;
@@ -576,7 +551,7 @@
 }
 
 static void
-vx_files_info ()
+vx_files_info (void)
 {
   printf_unfiltered ("\tAttached to host `%s'", vx_host);
   printf_unfiltered (", which has %sfloating point", target_has_fp ? "" : "no ");
@@ -584,7 +559,7 @@
 }
 
 static void
-vx_run_files_info ()
+vx_run_files_info (void)
 {
   printf_unfiltered ("\tRunning %s VxWorks process %s",
 		     vx_running ? "child" : "attached",
@@ -595,10 +570,7 @@
 }
 
 static void
-vx_resume (pid, step, siggnal)
-     int pid;
-     int step;
-     enum target_signal siggnal;
+vx_resume (int pid, int step, enum target_signal siggnal)
 {
   int status;
   Rptrace ptrace_in;
@@ -644,7 +616,7 @@
 }
 
 static void
-vx_mourn_inferior ()
+vx_mourn_inferior (void)
 {
   pop_target ();		/* Pop back to no-child state */
   generic_mourn_inferior ();
@@ -663,10 +635,7 @@
 static void find_sect (bfd *, asection *, void *);
 
 static void
-find_sect (abfd, sect, obj)
-     bfd *abfd;
-     asection *sect;
-     PTR obj;
+find_sect (bfd *abfd, asection *sect, PTR obj)
 {
   struct find_sect_args *args = (struct find_sect_args *) obj;
 
@@ -687,12 +656,8 @@
 }
 
 static void
-vx_add_symbols (name, from_tty, text_addr, data_addr, bss_addr)
-     char *name;
-     int from_tty;
-     CORE_ADDR text_addr;
-     CORE_ADDR data_addr;
-     CORE_ADDR bss_addr;
+vx_add_symbols (char *name, int from_tty, CORE_ADDR text_addr,
+		CORE_ADDR data_addr, CORE_ADDR bss_addr)
 {
   struct section_offsets *offs;
   struct objfile *objfile;
@@ -716,18 +681,16 @@
   bfd_map_over_sections (objfile->obfd, find_sect, &ss);
 
   /* Both COFF and b.out frontends use these SECT_OFF_* values.  */
-  ANOFFSET (offs, SECT_OFF_TEXT (so->objfile)) = text_addr - ss.text_start;
-  ANOFFSET (offs, SECT_OFF_DATA (so->objfile)) = data_addr - ss.data_start;
-  ANOFFSET (offs, SECT_OFF_BSS (so->objfile)) = bss_addr - ss.bss_start;
+  offs->offsets[SECT_OFF_TEXT (objfile)]  = text_addr - ss.text_start;
+  offs->offsets[SECT_OFF_DATA (objfile)] = data_addr - ss.data_start;
+  offs->offsets[SECT_OFF_BSS (objfile)] = bss_addr - ss.bss_start;
   objfile_relocate (objfile, offs);
 }
 
 /* This function allows the addition of incrementally linked object files.  */
 
 static void
-vx_load_command (arg_string, from_tty)
-     char *arg_string;
-     int from_tty;
+vx_load_command (char *arg_string, int from_tty)
 {
   CORE_ADDR text_addr;
   CORE_ADDR data_addr;
@@ -737,7 +700,7 @@
     error ("The load command takes a file name");
 
   arg_string = tilde_expand (arg_string);
-  make_cleanup (free, arg_string);
+  make_cleanup (xfree, arg_string);
 
   dont_repeat ();
 
@@ -750,7 +713,7 @@
 Kill the target task? "))
 	target_kill ();
       else
-	error ("Load cancelled.");
+	error ("Load canceled.");
     }
 
   QUIT;
@@ -771,7 +734,7 @@
    Returns -1 if remote single-step operation fails, else 0.  */
 
 static int
-net_step ()
+net_step (void)
 {
   enum clnt_stat status;
   int step_status;
@@ -803,10 +766,8 @@
    Returns nonzero (-1) if RPC status to VxWorks is bad, 0 otherwise.  */
 
 static int
-net_ptrace_clnt_call (request, pPtraceIn, pPtraceOut)
-     enum ptracereq request;
-     Rptrace *pPtraceIn;
-     Ptrace_return *pPtraceOut;
+net_ptrace_clnt_call (enum ptracereq request, Rptrace *pPtraceIn,
+		      Ptrace_return *pPtraceOut)
 {
   enum clnt_stat status;
 
@@ -826,8 +787,7 @@
    Returns -1 if rpc failed, 0 otherwise.  */
 
 static int
-net_get_boot_file (pBootFile)
-     char **pBootFile;
+net_get_boot_file (char **pBootFile)
 {
   enum clnt_stat status;
 
@@ -836,14 +796,14 @@
   return (status == RPC_SUCCESS) ? 0 : -1;
 }
 
-/* Fetch a list of loaded object modules from the VxWorks target.
+/* Fetch a list of loaded object modules from the VxWorks target
+   and store in PLOADTABLE.
    Returns -1 if rpc failed, 0 otherwise
    There's no way to check if the returned loadTable is correct.
    VxWorks doesn't check it.  */
 
 static int
-net_get_symbols (pLoadTable)
-     ldtabl *pLoadTable;	/* return pointer to ldtabl here */
+net_get_symbols (ldtabl *pLoadTable)
 {
   enum clnt_stat status;
 
@@ -861,9 +821,8 @@
 {"Lost contact with VxWorks target", 0, 0};
 
 static int
-vx_lookup_symbol (name, pAddr)
-     char *name;		/* symbol name */
-     CORE_ADDR *pAddr;
+vx_lookup_symbol (char *name,	/* symbol name */
+		  CORE_ADDR *pAddr)
 {
   enum clnt_stat status;
   SYMBOL_ADDR symbolAddr;
@@ -888,7 +847,7 @@
    Calls error() if rpc fails.  */
 
 static int
-net_check_for_fp ()
+net_check_for_fp (void)
 {
   enum clnt_stat status;
   bool_t fp = 0;		/* true if fp processor is present on target board */
@@ -904,8 +863,7 @@
    Calls error () if unable to establish connection.  */
 
 static void
-net_connect (host)
-     char *host;
+net_connect (char *host)
 {
   struct sockaddr_in destAddr;
   struct hostent *destHost;
@@ -955,8 +913,7 @@
  */
 
 static void
-sleep_ms (ms)
-     long ms;
+sleep_ms (long ms)
 {
   struct timeval select_timeout;
   int status;
@@ -972,9 +929,7 @@
 }
 
 static int
-vx_wait (pid_to_wait_for, status)
-     int pid_to_wait_for;
-     struct target_waitstatus *status;
+vx_wait (int pid_to_wait_for, struct target_waitstatus *status)
 {
   register int pid;
   RDB_EVENT rdbEvent;
@@ -1081,16 +1036,14 @@
 }
 
 static int
-symbol_stub (arg)
-     char *arg;
+symbol_stub (char *arg)
 {
   symbol_file_command (arg, 0);
   return 1;
 }
 
 static int
-add_symbol_stub (arg)
-     char *arg;
+add_symbol_stub (char *arg)
 {
   struct ldfile *pLoadFile = (struct ldfile *) arg;
 
@@ -1107,9 +1060,7 @@
    debugging.  */
 
 static void
-vx_open (args, from_tty)
-     char *args;
-     int from_tty;
+vx_open (char *args, int from_tty)
 {
   extern int close ();
   char *bootFile;
@@ -1220,9 +1171,7 @@
    This stops it cold in its tracks and allows us to start tracing it.  */
 
 static void
-vx_attach (args, from_tty)
-     char *args;
-     int from_tty;
+vx_attach (char *args, int from_tty)
 {
   unsigned long pid;
   char *cptr = 0;
@@ -1260,7 +1209,7 @@
   push_target (&vx_run_ops);
 
   if (vx_running)
-    free (vx_running);
+    xfree (vx_running);
   vx_running = 0;
 }
 
@@ -1274,9 +1223,7 @@
    started via the normal ptrace (PTRACE_TRACEME).  */
 
 static void
-vx_detach (args, from_tty)
-     char *args;
-     int from_tty;
+vx_detach (char *args, int from_tty)
 {
   Rptrace ptrace_in;
   Ptrace_return ptrace_out;
@@ -1313,7 +1260,7 @@
 /* vx_kill -- takes a running task and wipes it out.  */
 
 static void
-vx_kill ()
+vx_kill (void)
 {
   Rptrace ptrace_in;
   Ptrace_return ptrace_out;
@@ -1343,12 +1290,11 @@
 /* Clean up from the VxWorks process target as it goes away.  */
 
 static void
-vx_proc_close (quitting)
-     int quitting;
+vx_proc_close (int quitting)
 {
   inferior_pid = 0;		/* No longer have a process.  */
   if (vx_running)
-    free (vx_running);
+    xfree (vx_running);
   vx_running = 0;
 }
 
@@ -1356,12 +1302,8 @@
    Returns RPC status.  */
 
 static enum clnt_stat
-net_clnt_call (procNum, inProc, in, outProc, out)
-     enum ptracereq procNum;
-     xdrproc_t inProc;
-     char *in;
-     xdrproc_t outProc;
-     char *out;
+net_clnt_call (enum ptracereq procNum, xdrproc_t inProc, char *in,
+	       xdrproc_t outProc, char *out)
 {
   enum clnt_stat status;
 
@@ -1376,30 +1318,27 @@
 /* Clean up before losing control.  */
 
 static void
-vx_close (quitting)
-     int quitting;
+vx_close (int quitting)
 {
   if (pClient)
     clnt_destroy (pClient);	/* The net connection */
   pClient = 0;
 
   if (vx_host)
-    free (vx_host);		/* The hostname */
+    xfree (vx_host);		/* The hostname */
   vx_host = 0;
 }
 
 /* A vxprocess target should be started via "run" not "target".  */
 /*ARGSUSED */
 static void
-vx_proc_open (name, from_tty)
-     char *name;
-     int from_tty;
+vx_proc_open (char *name, int from_tty)
 {
   error ("Use the \"run\" command to start a VxWorks process.");
 }
 
 static void
-init_vx_ops ()
+init_vx_ops (void)
 {
   vx_ops.to_shortname = "vxworks";
   vx_ops.to_longname = "VxWorks target memory via RPC over TCP/IP";
@@ -1420,7 +1359,7 @@
 };
 
 static void
-init_vx_run_ops ()
+init_vx_run_ops (void)
 {
   vx_run_ops.to_shortname = "vxprocess";
   vx_run_ops.to_longname = "VxWorks process";
@@ -1450,7 +1389,7 @@
 }
 
 void
-_initialize_vx ()
+_initialize_vx (void)
 {
   init_vx_ops ();
   add_target (&vx_ops);
diff --git a/gdb/remote-vx29k.c b/gdb/remote-vx29k.c
index 39cd8be..f99ce40 100644
--- a/gdb/remote-vx29k.c
+++ b/gdb/remote-vx29k.c
@@ -72,8 +72,7 @@
    it is ignored.  FIXME look at regno to improve efficiency.  */
 
 void
-vx_read_register (regno)
-     int regno;
+vx_read_register (int regno)
 {
   char am29k_greg_packet[AM29K_GREG_PLEN];
   char am29k_fpreg_packet[AM29K_FPREG_PLEN];
@@ -136,8 +135,7 @@
    it is ignored.  FIXME look at regno to improve efficiency.  */
 
 void
-vx_write_register (regno)
-     int regno;
+vx_write_register (int regno)
 {
   char am29k_greg_packet[AM29K_GREG_PLEN];
   char am29k_fpreg_packet[AM29K_FPREG_PLEN];
@@ -174,12 +172,10 @@
    obtain the frame pointer (lr1) contents, we must add 4 bytes.
    Note : may be we should modify init_frame_info() to get the frame pointer
    and store it into the frame_info struct rather than reading its
-   contents when FRAME_CHAIN_VALID is invoked. */
+   contents when FRAME_CHAIN_VALID is invoked.  THISFRAME is unused.  */
 
 int
-vx29k_frame_chain_valid (chain, thisframe)
-     CORE_ADDR chain;
-     struct frame_info *thisframe;	/* not used here */
+vx29k_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
 {
   int fp_contents;
 
diff --git a/gdb/remote-vx68.c b/gdb/remote-vx68.c
index 59c6cdd..6a72e92 100644
--- a/gdb/remote-vx68.c
+++ b/gdb/remote-vx68.c
@@ -77,8 +77,7 @@
    it is ignored.  FIXME look at regno to improve efficiency.  */
 
 void
-vx_read_register (regno)
-     int regno;
+vx_read_register (int regno)
 {
   char mc68k_greg_packet[MC68K_GREG_PLEN];
   char mc68k_fpreg_packet[MC68K_FPREG_PLEN];
@@ -126,8 +125,7 @@
    it is ignored.  FIXME look at regno to improve efficiency.  */
 
 void
-vx_write_register (regno)
-     int regno;
+vx_write_register (int regno)
 {
   char mc68k_greg_packet[MC68K_GREG_PLEN];
   char mc68k_fpreg_packet[MC68K_FPREG_PLEN];
diff --git a/gdb/remote-vx960.c b/gdb/remote-vx960.c
index 70c216b..ff0b21f 100644
--- a/gdb/remote-vx960.c
+++ b/gdb/remote-vx960.c
@@ -76,8 +76,7 @@
    it is ignored.  FIXME look at regno to improve efficiency.  */
 
 void
-vx_read_register (regno)
-     int regno;
+vx_read_register (int regno)
 {
   char i960_greg_packet[I960_GREG_PLEN];
   char i960_fpreg_packet[I960_FPREG_PLEN];
@@ -126,8 +125,7 @@
    it is ignored.  FIXME look at regno to improve efficiency.  */
 
 void
-vx_write_register (regno)
-     int regno;
+vx_write_register (int regno)
 {
   char i960_greg_packet[I960_GREG_PLEN];
   char i960_fpreg_packet[I960_FPREG_PLEN];
diff --git a/gdb/remote-vxmips.c b/gdb/remote-vxmips.c
index a98ac13..b7da27a 100644
--- a/gdb/remote-vxmips.c
+++ b/gdb/remote-vxmips.c
@@ -67,8 +67,7 @@
    it is ignored.  FIXME look at regno to improve efficiency.  */
 
 void
-vx_read_register (regno)
-     int regno;
+vx_read_register (int regno)
 {
   char mips_greg_packet[MIPS_GREG_PLEN];
   char mips_fpreg_packet[MIPS_FPREG_PLEN];
@@ -157,8 +156,7 @@
    REGNO is the register to store, or -1 for all; currently,
    it is ignored.  FIXME look at regno to improve efficiency.  */
 
-vx_write_register (regno)
-     int regno;
+vx_write_register (int regno)
 {
   char mips_greg_packet[MIPS_GREG_PLEN];
   char mips_fpreg_packet[MIPS_FPREG_PLEN];
diff --git a/gdb/remote-vxsparc.c b/gdb/remote-vxsparc.c
index 756fd1f..aeb241c 100644
--- a/gdb/remote-vxsparc.c
+++ b/gdb/remote-vxsparc.c
@@ -76,8 +76,7 @@
    it is ignored.  FIXME look at regno to improve efficiency.  */
 
 void
-vx_read_register (regno)
-     int regno;
+vx_read_register (int regno)
 {
   char sparc_greg_packet[SPARC_GREG_PLEN];
   char sparc_fpreg_packet[SPARC_FPREG_PLEN];
@@ -138,8 +137,7 @@
    it is ignored.  FIXME look at regno to improve efficiency.  */
 
 void
-vx_write_register (regno)
-     int regno;
+vx_write_register (int regno)
 {
   char sparc_greg_packet[SPARC_GREG_PLEN];
   char sparc_fpreg_packet[SPARC_FPREG_PLEN];
diff --git a/gdb/remote.c b/gdb/remote.c
index fbe959a..902760d 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -37,8 +37,6 @@
 #include "gdbthread.h"
 #include "remote.h"
 
-#include "dcache.h"
-
 #include <ctype.h>
 #include <sys/time.h>
 #ifdef USG
@@ -194,36 +192,7 @@
 
 static void show_packet_config_cmd (struct packet_config *config);
 
-static void set_packet_config_cmd (struct packet_config *config,
-				   struct cmd_list_element *c);
-
-static void add_packet_config_cmd (struct packet_config *config,
-				   char *name,
-				   char *title,
-				   void (*set_func) (char *args, int from_tty,
-						     struct cmd_list_element *
-						     c),
-				   void (*show_func) (char *name,
-						      int from_tty),
-				   struct cmd_list_element **setlist,
-				   struct cmd_list_element **showlist);
-
-static void init_packet_config (struct packet_config *config);
-
-static void set_remote_protocol_P_packet_cmd (char *args,
-					      int from_tty,
-					      struct cmd_list_element *c);
-
-static void show_remote_protocol_P_packet_cmd (char *args, int from_tty);
-
-static void set_remote_protocol_Z_packet_cmd (char *args,
-					      int from_tty,
-					      struct cmd_list_element *c);
-
-static void show_remote_protocol_Z_packet_cmd (char *args, int from_tty);
-
-
-
+static void update_packet_config (struct packet_config *config);
 
 /* Define the target subroutine names */
 
@@ -518,59 +487,43 @@
     PACKET_DISABLE
   };
 
-enum packet_detect
-  {
-    PACKET_AUTO_DETECT = 0,
-    PACKET_MANUAL_DETECT
-  };
-
 struct packet_config
   {
-    char *state;
     char *name;
     char *title;
-    enum packet_detect detect;
+    enum cmd_auto_boolean detect;
     enum packet_support support;
   };
 
-static char packet_support_auto[] = "auto";
-static char packet_enable[] = "enable";
-static char packet_disable[] = "disable";
-static char *packet_support_enums[] =
+/* Analyze a packet's return value and update the packet config
+   accordingly. */
+
+enum packet_result
 {
-  packet_support_auto,
-  packet_enable,
-  packet_disable,
-  0,
+  PACKET_ERROR,
+  PACKET_OK,
+  PACKET_UNKNOWN
 };
 
 static void
-set_packet_config_cmd (config, c)
-     struct packet_config *config;
-     struct cmd_list_element *c;
+update_packet_config (struct packet_config *config)
 {
-  if (config->state == packet_enable)
+  switch (config->detect)
     {
-      config->detect = PACKET_MANUAL_DETECT;
+    case CMD_AUTO_BOOLEAN_TRUE:
       config->support = PACKET_ENABLE;
-    }
-  else if (config->state == packet_disable)
-    {
-      config->detect = PACKET_MANUAL_DETECT;
+      break;
+    case CMD_AUTO_BOOLEAN_FALSE:
       config->support = PACKET_DISABLE;
-    }
-  else if (config->state == packet_support_auto)
-    {
-      config->detect = PACKET_AUTO_DETECT;
+      break;
+    case CMD_AUTO_BOOLEAN_AUTO:
       config->support = PACKET_SUPPORT_UNKNOWN;
+      break;
     }
-  else
-    internal_error ("Bad enum value");
 }
 
 static void
-show_packet_config_cmd (config)
-     struct packet_config *config;
+show_packet_config_cmd (struct packet_config *config)
 {
   char *support = "internal-error";
   switch (config->support)
@@ -587,58 +540,124 @@
     }
   switch (config->detect)
     {
-    case PACKET_AUTO_DETECT:
+    case CMD_AUTO_BOOLEAN_AUTO:
       printf_filtered ("Support for remote protocol `%s' (%s) packet is auto-detected, currently %s.\n",
 		       config->name, config->title, support);
       break;
-    case PACKET_MANUAL_DETECT:
-      printf_filtered ("Support for remote protocol `%s' (%s) is currently %s.\n",
+    case CMD_AUTO_BOOLEAN_TRUE:
+    case CMD_AUTO_BOOLEAN_FALSE:
+      printf_filtered ("Support for remote protocol `%s' (%s) packet is currently %s.\n",
 		       config->name, config->title, support);
+      break;
     }
 }
 
 static void
-add_packet_config_cmd (config, name, title, set_func, show_func,
-		       setlist, showlist)
-     struct packet_config *config;
-     char *name;
-     char *title;
-     void (*set_func) (char *args, int from_tty, struct cmd_list_element * c);
-     void (*show_func) (char *name, int from_tty);
-     struct cmd_list_element **setlist;
-     struct cmd_list_element **showlist;
+add_packet_config_cmd (struct packet_config *config,
+		       char *name,
+		       char *title,
+		       void (*set_func) (char *args, int from_tty,
+					 struct cmd_list_element *
+					 c),
+		       void (*show_func) (char *name,
+					  int from_tty),
+		       struct cmd_list_element **set_remote_list,
+		       struct cmd_list_element **show_remote_list,
+		       int legacy)
 {
-  struct cmd_list_element *c;
+  struct cmd_list_element *set_cmd;
+  struct cmd_list_element *show_cmd;
   char *set_doc;
   char *show_doc;
-  char *full_name;
+  char *cmd_name;
   config->name = name;
   config->title = title;
-  asprintf (&set_doc, "Set use of remote protocol `%s' (%s) packet",
-	    name, title);
-  asprintf (&show_doc, "Show current use of remote protocol `%s' (%s) packet",
-	    name, title);
-  asprintf (&full_name, "%s-packet", name);
-  c = add_set_enum_cmd (full_name,
-			class_obscure, packet_support_enums,
-			&config->state,
-			set_doc, setlist);
-  c->function.sfunc = set_func;
-  add_cmd (full_name, class_obscure, show_func, show_doc, showlist);
+  config->detect = CMD_AUTO_BOOLEAN_AUTO;
+  config->support = PACKET_SUPPORT_UNKNOWN;
+  xasprintf (&set_doc, "Set use of remote protocol `%s' (%s) packet",
+	     name, title);
+  xasprintf (&show_doc, "Show current use of remote protocol `%s' (%s) packet",
+	     name, title);
+  /* set/show TITLE-packet {auto,on,off} */
+  xasprintf (&cmd_name, "%s-packet", title);
+  set_cmd = add_set_auto_boolean_cmd (cmd_name, class_obscure,
+				&config->detect, set_doc,
+				set_remote_list);
+  set_cmd->function.sfunc = set_func;
+  show_cmd = add_cmd (cmd_name, class_obscure, show_func, show_doc,
+		      show_remote_list);
+  /* set/show remote NAME-packet {auto,on,off} -- legacy */
+  if (legacy)
+    {
+      char *legacy_name;
+      xasprintf (&legacy_name, "%s-packet", name);
+      add_alias_cmd (legacy_name, cmd_name, class_obscure, 0,
+		     set_remote_list);
+      add_alias_cmd (legacy_name, cmd_name, class_obscure, 0,
+		     show_remote_list);
+    }
 }
 
-static void
-init_packet_config (config)
-     struct packet_config *config;
+static enum packet_result
+packet_ok (const char *buf, struct packet_config *config)
 {
-  switch (config->detect)
+  if (buf[0] != '\0')
     {
-    case PACKET_AUTO_DETECT:
-      config->support = PACKET_SUPPORT_UNKNOWN;
-      break;
-    case PACKET_MANUAL_DETECT:
-      /* let the user beware */
-      break;
+      /* The stub recognized the packet request.  Check that the
+	 operation succeeded. */
+      switch (config->support)
+	{
+	case PACKET_SUPPORT_UNKNOWN:
+	  if (remote_debug)
+	    fprintf_unfiltered (gdb_stdlog,
+				    "Packet %s (%s) is supported\n",
+				    config->name, config->title);
+	  config->support = PACKET_ENABLE;
+	  break;
+	case PACKET_DISABLE:
+	  internal_error ("packet_ok: attempt to use a disabled packet");
+	  break;
+	case PACKET_ENABLE:
+	  break;
+	}
+      if (buf[0] == 'O' && buf[1] == 'K' && buf[2] == '\0')
+	/* "OK" - definitly OK. */
+	return PACKET_OK;
+      if (buf[0] == 'E'
+	  && isxdigit (buf[1]) && isxdigit (buf[2])
+	  && buf[3] == '\0')
+	/* "Enn"  - definitly an error. */
+	return PACKET_ERROR;
+      /* The packet may or may not be OK.  Just assume it is */
+      return PACKET_OK;
+    }
+  else
+    {
+      /* The stub does not support the packet. */
+      switch (config->support)
+	{
+	case PACKET_ENABLE:
+	  if (config->detect == CMD_AUTO_BOOLEAN_AUTO)
+	    /* If the stub previously indicated that the packet was
+	       supported then there is a protocol error.. */
+	    error ("Protocol error: %s (%s) conflicting enabled responses.",
+		   config->name, config->title);
+	  else
+	    /* The user set it wrong. */
+	    error ("Enabled packet %s (%s) not recognized by stub",
+		   config->name, config->title);
+	  break;
+	case PACKET_SUPPORT_UNKNOWN:
+	  if (remote_debug)
+	    fprintf_unfiltered (gdb_stdlog,
+				"Packet %s (%s) is NOT supported\n",
+				config->name, config->title);
+	  config->support = PACKET_DISABLE;
+	  break;
+	case PACKET_DISABLE:
+	  break;
+	}
+      return PACKET_UNKNOWN;
     }
 }
 
@@ -647,41 +666,125 @@
 static struct packet_config remote_protocol_P;
 
 static void
-set_remote_protocol_P_packet_cmd (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+set_remote_protocol_P_packet_cmd (char *args, int from_tty,
+				  struct cmd_list_element *c)
 {
-  set_packet_config_cmd (&remote_protocol_P, c);
+  update_packet_config (&remote_protocol_P);
 }
 
 static void
-show_remote_protocol_P_packet_cmd (args, from_tty)
-     char *args;
-     int from_tty;
+show_remote_protocol_P_packet_cmd (char *args, int from_tty)
 {
   show_packet_config_cmd (&remote_protocol_P);
 }
 
-/* Should we try the 'Z' (set breakpoint) request?  */
+/* Should we try one of the 'Z' requests?  */
 
-static struct packet_config remote_protocol_Z;
+enum Z_packet_type
+{
+  Z_PACKET_SOFTWARE_BP,
+  Z_PACKET_HARDWARE_BP,
+  Z_PACKET_WRITE_WP,
+  Z_PACKET_READ_WP,
+  Z_PACKET_ACCESS_WP,
+  NR_Z_PACKET_TYPES
+};
+
+static struct packet_config remote_protocol_Z[NR_Z_PACKET_TYPES];
+
+/* FIXME: Instead of having all these boiler plate functions, the
+   command callback should include a context argument. */
 
 static void
-set_remote_protocol_Z_packet_cmd (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+set_remote_protocol_Z_software_bp_packet_cmd (char *args, int from_tty,
+					      struct cmd_list_element *c)
 {
-  set_packet_config_cmd (&remote_protocol_Z, c);
+  update_packet_config (&remote_protocol_Z[Z_PACKET_SOFTWARE_BP]);
 }
 
 static void
-show_remote_protocol_Z_packet_cmd (args, from_tty)
-     char *args;
-     int from_tty;
+show_remote_protocol_Z_software_bp_packet_cmd (char *args, int from_tty)
 {
-  show_packet_config_cmd (&remote_protocol_Z);
+  show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_SOFTWARE_BP]);
+}
+
+static void
+set_remote_protocol_Z_hardware_bp_packet_cmd (char *args, int from_tty,
+					      struct cmd_list_element *c)
+{
+  update_packet_config (&remote_protocol_Z[Z_PACKET_HARDWARE_BP]);
+}
+
+static void
+show_remote_protocol_Z_hardware_bp_packet_cmd (char *args, int from_tty)
+{
+  show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_HARDWARE_BP]);
+}
+
+static void
+set_remote_protocol_Z_write_wp_packet_cmd (char *args, int from_tty,
+					      struct cmd_list_element *c)
+{
+  update_packet_config (&remote_protocol_Z[Z_PACKET_WRITE_WP]);
+}
+
+static void
+show_remote_protocol_Z_write_wp_packet_cmd (char *args, int from_tty)
+{
+  show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_WRITE_WP]);
+}
+
+static void
+set_remote_protocol_Z_read_wp_packet_cmd (char *args, int from_tty,
+					      struct cmd_list_element *c)
+{
+  update_packet_config (&remote_protocol_Z[Z_PACKET_READ_WP]);
+}
+
+static void
+show_remote_protocol_Z_read_wp_packet_cmd (char *args, int from_tty)
+{
+  show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_READ_WP]);
+}
+
+static void
+set_remote_protocol_Z_access_wp_packet_cmd (char *args, int from_tty,
+					      struct cmd_list_element *c)
+{
+  update_packet_config (&remote_protocol_Z[Z_PACKET_ACCESS_WP]);
+}
+
+static void
+show_remote_protocol_Z_access_wp_packet_cmd (char *args, int from_tty)
+{
+  show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_ACCESS_WP]);
+}
+
+/* For compatibility with older distributions.  Provide a ``set remote
+   Z-packet ...'' command that updates all the Z packet types. */
+
+static enum cmd_auto_boolean remote_Z_packet_detect;
+
+static void
+set_remote_protocol_Z_packet_cmd (char *args, int from_tty,
+				  struct cmd_list_element *c)
+{
+  int i;
+  for (i = 0; i < NR_Z_PACKET_TYPES; i++)
+    {
+      remote_protocol_Z[i].detect = remote_Z_packet_detect;
+      update_packet_config (&remote_protocol_Z[i]);
+    }
+}
+
+static void
+show_remote_protocol_Z_packet_cmd (char *args, int from_tty)
+{
+  int i;
+  for (i = 0; i < NR_Z_PACKET_TYPES; i++)
+    {
+      show_packet_config_cmd (&remote_protocol_Z[i]);
+    }
 }
 
 /* Should we try the 'X' (remote binary download) packet?
@@ -712,7 +815,7 @@
 					 int from_tty,
 					 struct cmd_list_element *c)
 {
-  set_packet_config_cmd (&remote_protocol_binary_download, c);
+  update_packet_config (&remote_protocol_binary_download);
 }
 
 static void
@@ -747,8 +850,7 @@
  */
 
 static void
-record_currthread (currthread)
-     int currthread;
+record_currthread (int currthread)
 {
   general_thread = currthread;
 
@@ -770,9 +872,7 @@
 #define MAGIC_NULL_PID 42000
 
 static void
-set_thread (th, gen)
-     int th;
-     int gen;
+set_thread (int th, int gen)
 {
   char *buf = alloca (PBUFSIZ);
   int state = gen ? general_thread : continue_thread;
@@ -802,8 +902,7 @@
 /*  Return nonzero if the thread TH is still alive on the remote system.  */
 
 static int
-remote_thread_alive (tid)
-     int tid;
+remote_thread_alive (int tid)
 {
   char buf[16];
 
@@ -932,9 +1031,7 @@
 static const char hexchars[] = "0123456789abcdef";
 
 static int
-ishex (ch, val)
-     int ch;
-     int *val;
+ishex (int ch, int *val)
 {
   if ((ch >= 'a') && (ch <= 'f'))
     {
@@ -955,8 +1052,7 @@
 }
 
 static int
-stubhex (ch)
-     int ch;
+stubhex (int ch)
 {
   if (ch >= 'a' && ch <= 'f')
     return ch - 'a' + 10;
@@ -968,9 +1064,7 @@
 }
 
 static int
-stub_unpack_int (buff, fieldlength)
-     char *buff;
-     int fieldlength;
+stub_unpack_int (char *buff, int fieldlength)
 {
   int nibble;
   int retval = 0;
@@ -987,9 +1081,8 @@
 }
 
 char *
-unpack_varlen_hex (buff, result)
-     char *buff;		/* packet to parse */
-     int *result;
+unpack_varlen_hex (char *buff,	/* packet to parse */
+		   int *result)
 {
   int nibble;
   int retval = 0;
@@ -1005,27 +1098,21 @@
 }
 
 static char *
-unpack_nibble (buf, val)
-     char *buf;
-     int *val;
+unpack_nibble (char *buf, int *val)
 {
   ishex (*buf++, val);
   return buf;
 }
 
 static char *
-pack_nibble (buf, nibble)
-     char *buf;
-     int nibble;
+pack_nibble (char *buf, int nibble)
 {
   *buf++ = hexchars[(nibble & 0x0f)];
   return buf;
 }
 
 static char *
-pack_hex_byte (pkt, byte)
-     char *pkt;
-     int byte;
+pack_hex_byte (char *pkt, int byte)
 {
   *pkt++ = hexchars[(byte >> 4) & 0xf];
   *pkt++ = hexchars[(byte & 0xf)];
@@ -1033,18 +1120,14 @@
 }
 
 static char *
-unpack_byte (buf, value)
-     char *buf;
-     int *value;
+unpack_byte (char *buf, int *value)
 {
   *value = stub_unpack_int (buf, 2);
   return buf + 2;
 }
 
 static char *
-pack_int (buf, value)
-     char *buf;
-     int value;
+pack_int (char *buf, int value)
 {
   buf = pack_hex_byte (buf, (value >> 24) & 0xff);
   buf = pack_hex_byte (buf, (value >> 16) & 0xff);
@@ -1054,9 +1137,7 @@
 }
 
 static char *
-unpack_int (buf, value)
-     char *buf;
-     int *value;
+unpack_int (char *buf, int *value)
 {
   *value = stub_unpack_int (buf, 8);
   return buf + 8;
@@ -1066,9 +1147,7 @@
 static char *pack_string (char *pkt, char *string);
 
 static char *
-pack_string (pkt, string)
-     char *pkt;
-     char *string;
+pack_string (char *pkt, char *string)
 {
   char ch;
   int len;
@@ -1089,10 +1168,7 @@
 #endif /* 0 (unused) */
 
 static char *
-unpack_string (src, dest, length)
-     char *src;
-     char *dest;
-     int length;
+unpack_string (char *src, char *dest, int length)
 {
   while (length--)
     *dest++ = *src++;
@@ -1101,9 +1177,7 @@
 }
 
 static char *
-pack_threadid (pkt, id)
-     char *pkt;
-     threadref *id;
+pack_threadid (char *pkt, threadref *id)
 {
   char *limit;
   unsigned char *altid;
@@ -1117,9 +1191,7 @@
 
 
 static char *
-unpack_threadid (inbuf, id)
-     char *inbuf;
-     threadref *id;
+unpack_threadid (char *inbuf, threadref *id)
 {
   char *altref;
   char *limit = inbuf + BUF_THREAD_ID_SIZE;
@@ -1142,9 +1214,7 @@
    function.  */
 
 void
-int_to_threadref (id, value)
-     threadref *id;
-     int value;
+int_to_threadref (threadref *id, int value)
 {
   unsigned char *scan;
 
@@ -1161,8 +1231,7 @@
 }
 
 static int
-threadref_to_int (ref)
-     threadref *ref;
+threadref_to_int (threadref *ref)
 {
   int i, value = 0;
   unsigned char *scan;
@@ -1176,9 +1245,7 @@
 }
 
 static void
-copy_threadref (dest, src)
-     threadref *dest;
-     threadref *src;
+copy_threadref (threadref *dest, threadref *src)
 {
   int i;
   unsigned char *csrc, *cdest;
@@ -1191,9 +1258,7 @@
 }
 
 static int
-threadmatch (dest, src)
-     threadref *dest;
-     threadref *src;
+threadmatch (threadref *dest, threadref *src)
 {
   /* things are broken right now, so just assume we got a match */
 #if 0
@@ -1221,10 +1286,7 @@
 /* Encoding:  'Q':8,'P':8,mask:32,threadid:64 */
 
 static char *
-pack_threadinfo_request (pkt, mode, id)
-     char *pkt;
-     int mode;
-     threadref *id;
+pack_threadinfo_request (char *pkt, int mode, threadref *id)
 {
   *pkt++ = 'q';			/* Info Query */
   *pkt++ = 'P';			/* process or thread info */
@@ -1247,10 +1309,8 @@
 				   the process */
 
 static int
-remote_unpack_thread_info_response (pkt, expectedref, info)
-     char *pkt;
-     threadref *expectedref;
-     struct gdb_ext_thread_info *info;
+remote_unpack_thread_info_response (char *pkt, threadref *expectedref,
+				    struct gdb_ext_thread_info *info)
 {
   int mask, length;
   unsigned int tag;
@@ -1339,10 +1399,8 @@
 }
 
 static int
-remote_get_threadinfo (threadid, fieldset, info)
-     threadref *threadid;
-     int fieldset;		/* TAG mask */
-     struct gdb_ext_thread_info *info;
+remote_get_threadinfo (threadref *threadid, int fieldset,	/* TAG mask */
+		       struct gdb_ext_thread_info *info)
 {
   int result;
   char *threadinfo_pkt = alloca (PBUFSIZ);
@@ -1359,10 +1417,8 @@
    representation of a threadid.  */
 
 static int
-adapt_remote_get_threadinfo (ref, selection, info)
-     gdb_threadref *ref;
-     int selection;
-     struct gdb_ext_thread_info *info;
+adapt_remote_get_threadinfo (gdb_threadref *ref, int selection,
+			     struct gdb_ext_thread_info *info)
 {
   threadref lclref;
 
@@ -1373,11 +1429,8 @@
 /*    Format: i'Q':8,i"L":8,initflag:8,batchsize:16,lastthreadid:32   */
 
 static char *
-pack_threadlist_request (pkt, startflag, threadcount, nextthread)
-     char *pkt;
-     int startflag;
-     int threadcount;
-     threadref *nextthread;
+pack_threadlist_request (char *pkt, int startflag, int threadcount,
+			 threadref *nextthread)
 {
   *pkt++ = 'q';			/* info query packet */
   *pkt++ = 'L';			/* Process LIST or threadLIST request */
@@ -1391,13 +1444,9 @@
 /* Encoding:   'q':8,'M':8,count:16,done:8,argthreadid:64,(threadid:64)* */
 
 static int
-parse_threadlist_response (pkt, result_limit, original_echo, resultlist,
-			   doneflag)
-     char *pkt;
-     int result_limit;
-     threadref *original_echo;
-     threadref *resultlist;
-     int *doneflag;
+parse_threadlist_response (char *pkt, int result_limit,
+			   threadref *original_echo, threadref *resultlist,
+			   int *doneflag)
 {
   char *limit;
   int count, resultcount, done;
@@ -1421,15 +1470,8 @@
 }
 
 static int
-remote_get_threadlist (startflag, nextthread, result_limit,
-		       done, result_count, threadlist)
-     int startflag;
-     threadref *nextthread;
-     int result_limit;
-     int *done;
-     int *result_count;
-     threadref *threadlist;
-
+remote_get_threadlist (int startflag, threadref *nextthread, int result_limit,
+		       int *done, int *result_count, threadref *threadlist)
 {
   static threadref echo_nextthread;
   char *threadlist_packet = alloca (PBUFSIZ);
@@ -1494,10 +1536,8 @@
 #define MAXTHREADLISTRESULTS 32
 
 static int
-remote_threadlist_iterator (stepfunction, context, looplimit)
-     rmt_thread_action stepfunction;
-     void *context;
-     int looplimit;
+remote_threadlist_iterator (rmt_thread_action stepfunction, void *context,
+			    int looplimit)
 {
   int done, i, result_count;
   int startflag = 1;
@@ -1535,9 +1575,7 @@
 }
 
 static int
-remote_newthread_step (ref, context)
-     threadref *ref;
-     void *context;
+remote_newthread_step (threadref *ref, void *context)
 {
   int pid;
 
@@ -1550,8 +1588,7 @@
 #define CRAZY_MAX_THREADS 1000
 
 static int
-remote_current_thread (oldpid)
-     int oldpid;
+remote_current_thread (int oldpid)
 {
   char *buf = alloca (PBUFSIZ);
 
@@ -1568,7 +1605,7 @@
  */
 
 static void
-remote_find_new_threads ()
+remote_find_new_threads (void)
 {
   remote_threadlist_iterator (remote_newthread_step, 0,
 			      CRAZY_MAX_THREADS);
@@ -1700,7 +1737,7 @@
 /*  Restart the remote side; this is an extended protocol operation.  */
 
 static void
-extended_remote_restart ()
+extended_remote_restart (void)
 {
   char *buf = alloca (PBUFSIZ);
 
@@ -1720,8 +1757,7 @@
 
 /* ARGSUSED */
 static void
-remote_close (quitting)
-     int quitting;
+remote_close (int quitting)
 {
   if (remote_desc)
     SERIAL_CLOSE (remote_desc);
@@ -1731,7 +1767,7 @@
 /* Query the remote side for the text, data and bss offsets. */
 
 static void
-get_offsets ()
+get_offsets (void)
 {
   char *buf = alloca (PBUFSIZ);
   char *ptr;
@@ -1797,14 +1833,14 @@
   offs = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
   memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS);
 
-  ANOFFSET (offs, SECT_OFF_TEXT (symfile_objfile)) = text_addr;
+  offs->offsets[SECT_OFF_TEXT (symfile_objfile)] = text_addr;
 
   /* This is a temporary kludge to force data and bss to use the same offsets
      because that's what nlmconv does now.  The real solution requires changes
      to the stub and remote.c that I don't have time to do right now.  */
 
-  ANOFFSET (offs, SECT_OFF_DATA (symfile_objfile)) = data_addr;
-  ANOFFSET (offs, SECT_OFF_BSS (symfile_objfile)) = data_addr;
+  offs->offsets[SECT_OFF_DATA (symfile_objfile)] = data_addr;
+  offs->offsets[SECT_OFF_BSS (symfile_objfile)] = data_addr;
 
   objfile_relocate (symfile_objfile, offs);
 }
@@ -1896,10 +1932,8 @@
  */
 
 void
-remote_cisco_objfile_relocate (text_off, data_off, bss_off)
-     bfd_signed_vma text_off;
-     bfd_signed_vma data_off;
-     bfd_signed_vma bss_off;
+remote_cisco_objfile_relocate (bfd_signed_vma text_off, bfd_signed_vma data_off,
+			       bfd_signed_vma bss_off)
 {
   struct section_offsets *offs;
 
@@ -1912,9 +1946,9 @@
       offs = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
       memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS);
 
-      ANOFFSET (offs, SECT_OFF_TEXT (symfile_objfile)) = text_off;
-      ANOFFSET (offs, SECT_OFF_DATA (symfile_objfile)) = data_off;
-      ANOFFSET (offs, SECT_OFF_BSS (symfile_objfile)) = bss_off;
+      offs->offsets[SECT_OFF_TEXT (symfile_objfile)] = text_off;
+      offs->offsets[SECT_OFF_DATA (symfile_objfile)] = data_off;
+      offs->offsets[SECT_OFF_BSS (symfile_objfile)] = bss_off;
 
       /* First call the standard objfile_relocate.  */
       objfile_relocate (symfile_objfile, offs);
@@ -1937,10 +1971,9 @@
 }
 
 static int
-remote_start_remote (dummy)
-     PTR dummy;
+remote_start_remote (PTR dummy)
 {
-  immediate_quit = 1;		/* Allow user to interrupt it */
+  immediate_quit++;		/* Allow user to interrupt it */
 
   /* Ack any packet which the remote side has already sent.  */
   SERIAL_WRITE (remote_desc, "+", 1);
@@ -1953,7 +1986,7 @@
   get_offsets ();		/* Get text, data & bss offsets */
 
   putpkt ("?");			/* initiate a query from remote machine */
-  immediate_quit = 0;
+  immediate_quit--;
 
   return remote_start_remote_dummy (dummy);
 }
@@ -1962,18 +1995,14 @@
    NAME is the filename used for communication.  */
 
 static void
-remote_open (name, from_tty)
-     char *name;
-     int from_tty;
+remote_open (char *name, int from_tty)
 {
   remote_open_1 (name, from_tty, &remote_ops, 0);
 }
 
 /* Just like remote_open, but with asynchronous support. */
 static void
-remote_async_open (name, from_tty)
-     char *name;
-     int from_tty;
+remote_async_open (char *name, int from_tty)
 {
   remote_async_open_1 (name, from_tty, &remote_async_ops, 0);
 }
@@ -1982,32 +2011,35 @@
    remote gdb protocol.  NAME is the filename used for communication.  */
 
 static void
-extended_remote_open (name, from_tty)
-     char *name;
-     int from_tty;
+extended_remote_open (char *name, int from_tty)
 {
   remote_open_1 (name, from_tty, &extended_remote_ops, 1 /*extended_p */ );
 }
 
 /* Just like extended_remote_open, but with asynchronous support. */
 static void
-extended_remote_async_open (name, from_tty)
-     char *name;
-     int from_tty;
+extended_remote_async_open (char *name, int from_tty)
 {
   remote_async_open_1 (name, from_tty, &extended_async_remote_ops, 1 /*extended_p */ );
 }
 
 /* Generic code for opening a connection to a remote target.  */
 
-static DCACHE *remote_dcache;
+static void
+init_all_packet_configs (void)
+{
+  int i;
+  update_packet_config (&remote_protocol_P);
+  for (i = 0; i < NR_Z_PACKET_TYPES; i++)
+    update_packet_config (&remote_protocol_Z[i]);
+  /* Force remote_write_bytes to check whether target supports binary
+     downloading. */
+  update_packet_config (&remote_protocol_binary_download);
+}
 
 static void
-remote_open_1 (name, from_tty, target, extended_p)
-     char *name;
-     int from_tty;
-     struct target_ops *target;
-     int extended_p;
+remote_open_1 (char *name, int from_tty, struct target_ops *target,
+	       int extended_p)
 {
   if (name == 0)
     error ("To open a remote debug connection, you need to specify what\n\
@@ -2021,8 +2053,6 @@
 
   unpush_target (target);
 
-  remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes);
-
   remote_desc = SERIAL_OPEN (name);
   if (!remote_desc)
     perror_with_name (name);
@@ -2050,16 +2080,11 @@
     }
   push_target (target);		/* Switch to using remote target now */
 
-  init_packet_config (&remote_protocol_P);
-  init_packet_config (&remote_protocol_Z);
+  init_all_packet_configs ();
   
   general_thread = -2;
   continue_thread = -2;
 
-  /* Force remote_write_bytes to check whether target supports
-     binary downloading. */
-  init_packet_config (&remote_protocol_binary_download);
-
   /* Probe for ability to use "ThreadInfo" query, as required.  */
   use_threadinfo_query = 1;
   use_threadextra_query = 1;
@@ -2094,11 +2119,8 @@
 
 /* Just like remote_open but with asynchronous support. */
 static void
-remote_async_open_1 (name, from_tty, target, extended_p)
-     char *name;
-     int from_tty;
-     struct target_ops *target;
-     int extended_p;
+remote_async_open_1 (char *name, int from_tty, struct target_ops *target,
+		     int extended_p)
 {
   if (name == 0)
     error ("To open a remote debug connection, you need to specify what\n\
@@ -2109,8 +2131,6 @@
 
   unpush_target (target);
 
-  remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes);
-
   remote_desc = SERIAL_OPEN (name);
   if (!remote_desc)
     perror_with_name (name);
@@ -2139,16 +2159,11 @@
 
   push_target (target);		/* Switch to using remote target now */
 
-  init_packet_config (&remote_protocol_P);
-  init_packet_config (&remote_protocol_Z);
+  init_all_packet_configs ();
 
   general_thread = -2;
   continue_thread = -2;
 
-  /* Force remote_write_bytes to check whether target supports
-     binary downloading. */
-  init_packet_config (&remote_protocol_binary_download);
-
   /* Probe for ability to use "ThreadInfo" query, as required.  */
   use_threadinfo_query = 1;
   use_threadextra_query = 1;
@@ -2166,7 +2181,7 @@
 
   /* FIXME: cagney/1999-09-23: During the initial connection it is
      assumed that the target is already ready and able to respond to
-     requests. Unfortunatly remote_start_remote() eventually calls
+     requests. Unfortunately remote_start_remote() eventually calls
      wait_for_inferior() with no timeout.  wait_forever_enabled_p gets
      around this. Eventually a mechanism that allows
      wait_for_inferior() to expect/get timeouts will be
@@ -2202,9 +2217,7 @@
    die when it hits one.  */
 
 static void
-remote_detach (args, from_tty)
-     char *args;
-     int from_tty;
+remote_detach (char *args, int from_tty)
 {
   char *buf = alloca (PBUFSIZ);
 
@@ -2223,9 +2236,7 @@
 
 /* Same as remote_detach, but with async support. */
 static void
-remote_async_detach (args, from_tty)
-     char *args;
-     int from_tty;
+remote_async_detach (char *args, int from_tty)
 {
   char *buf = alloca (PBUFSIZ);
 
@@ -2248,8 +2259,7 @@
 /* Convert hex digit A to a number.  */
 
 int
-fromhex (a)
-     int a;
+fromhex (int a)
 {
   if (a >= '0' && a <= '9')
     return a - '0';
@@ -2264,8 +2274,7 @@
 /* Convert number NIB to a hex digit.  */
 
 static int
-tohex (nib)
-     int nib;
+tohex (int nib)
 {
   if (nib < 10)
     return '0' + nib;
@@ -2280,9 +2289,7 @@
 static int last_sent_step;
 
 static void
-remote_resume (pid, step, siggnal)
-     int pid, step;
-     enum target_signal siggnal;
+remote_resume (int pid, int step, enum target_signal siggnal)
 {
   char *buf = alloca (PBUFSIZ);
 
@@ -2291,8 +2298,6 @@
   else
     set_thread (pid, 0);	/* run this thread */
 
-  dcache_flush (remote_dcache);
-
   last_sent_signal = siggnal;
   last_sent_step = step;
 
@@ -2316,9 +2321,7 @@
 
 /* Same as remote_resume, but with async support. */
 static void
-remote_async_resume (pid, step, siggnal)
-     int pid, step;
-     enum target_signal siggnal;
+remote_async_resume (int pid, int step, enum target_signal siggnal)
 {
   char *buf = alloca (PBUFSIZ);
 
@@ -2327,8 +2330,6 @@
   else
     set_thread (pid, 0);	/* run this thread */
 
-  dcache_flush (remote_dcache);
-
   last_sent_signal = siggnal;
   last_sent_step = step;
 
@@ -2370,7 +2371,7 @@
 /* Set up the signal handler for SIGINT, while the target is
    executing, ovewriting the 'regular' SIGINT signal handler. */
 static void
-initialize_sigint_signal_handler ()
+initialize_sigint_signal_handler (void)
 {
   sigint_remote_token =
     create_async_signal_handler (async_remote_interrupt, NULL);
@@ -2379,8 +2380,7 @@
 
 /* Signal handler for SIGINT, while the target is executing. */
 static void
-handle_remote_sigint (sig)
-     int sig;
+handle_remote_sigint (int sig)
 {
   signal (sig, handle_remote_sigint_twice);
   sigint_remote_twice_token =
@@ -2392,8 +2392,7 @@
    sent once.  It will take effect the second time that the user sends
    a ^C. */
 static void
-handle_remote_sigint_twice (sig)
-     int sig;
+handle_remote_sigint_twice (int sig)
 {
   signal (sig, handle_sigint);
   sigint_remote_twice_token =
@@ -2404,8 +2403,7 @@
 /* Perform the real interruption of the target execution, in response
    to a ^C. */
 static void
-async_remote_interrupt (arg)
-     gdb_client_data arg;
+async_remote_interrupt (gdb_client_data arg)
 {
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "remote_interrupt called\n");
@@ -2416,8 +2414,7 @@
 /* Perform interrupt, if the first attempt did not succeed. Just give
    up on the target alltogether. */
 void
-async_remote_interrupt_twice (arg)
-     gdb_client_data arg;
+async_remote_interrupt_twice (gdb_client_data arg)
 {
   if (remote_debug)
     fprintf_unfiltered (gdb_stdlog, "remote_interrupt_twice called\n");
@@ -2452,8 +2449,7 @@
    response from the target (it didn't stop when the user requested it),
    we ask the user if he'd like to detach from the target. */
 static void
-remote_interrupt (signo)
-     int signo;
+remote_interrupt (int signo)
 {
   /* If this doesn't work, try more severe steps. */
   signal (signo, remote_interrupt_twice);
@@ -2467,8 +2463,7 @@
 /* The user typed ^C twice.  */
 
 static void
-remote_interrupt_twice (signo)
-     int signo;
+remote_interrupt_twice (int signo)
 {
   signal (signo, ofunc);
   interrupt_query ();
@@ -2479,7 +2474,7 @@
    interrupt is requested, either by the command line or the GUI, we
    will eventually end up here. */
 static void
-remote_stop ()
+remote_stop (void)
 {
   /* Send a break or a ^C, depending on user preference.  */
   if (remote_debug)
@@ -2494,7 +2489,7 @@
 /* Ask the user what to do when an interrupt is received.  */
 
 static void
-interrupt_query ()
+interrupt_query (void)
 {
   target_terminal_ours ();
 
@@ -2579,9 +2574,7 @@
    remote OS, is the thread-id.  */
 
 static int
-remote_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+remote_wait (int pid, struct target_waitstatus *status)
 {
   unsigned char *buf = alloca (PBUFSIZ);
   int thread_num = -1;
@@ -2796,9 +2789,7 @@
 
 /* Async version of remote_wait. */
 static int
-remote_async_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+remote_async_wait (int pid, struct target_waitstatus *status)
 {
   unsigned char *buf = alloca (PBUFSIZ);
   int thread_num = -1;
@@ -3029,8 +3020,7 @@
 
 /* ARGSUSED */
 static void
-remote_fetch_registers (regno)
-     int regno;
+remote_fetch_registers (int regno)
 {
   char *buf = alloca (PBUFSIZ);
   int i;
@@ -3090,10 +3080,9 @@
   if (i != register_bytes_found)
     {
       register_bytes_found = i;
-#ifdef REGISTER_BYTES_OK
-      if (!REGISTER_BYTES_OK (i))
+      if (REGISTER_BYTES_OK_P ()
+	  && !REGISTER_BYTES_OK (i))
 	warning ("Remote reply is too short: %s", buf);
-#endif
     }
 
 supply_them:
@@ -3110,7 +3099,7 @@
    first.  */
 
 static void
-remote_prepare_to_store ()
+remote_prepare_to_store (void)
 {
   /* Make sure the entire registers array is valid.  */
   switch (remote_protocol_P.support)
@@ -3155,8 +3144,7 @@
    of REGISTERS.  FIXME: ignores errors.  */
 
 static void
-remote_store_registers (regno)
-     int regno;
+remote_store_registers (int regno)
 {
   char *buf = alloca (PBUFSIZ);
   int i;
@@ -3209,48 +3197,12 @@
 
   remote_send (buf, PBUFSIZ);
 }
-
-/* Use of the data cache *used* to be disabled because it loses for looking
-   at and changing hardware I/O ports and the like.  Accepting `volatile'
-   would perhaps be one way to fix it.  Another idea would be to use the
-   executable file for the text segment (for all SEC_CODE sections?
-   For all SEC_READONLY sections?).  This has problems if you want to
-   actually see what the memory contains (e.g. self-modifying code,
-   clobbered memory, user downloaded the wrong thing).  
-
-   Because it speeds so much up, it's now enabled, if you're playing
-   with registers you turn it of (set remotecache 0).  */
-
-/* Read a word from remote address ADDR and return it.
-   This goes through the data cache.  */
-
-#if 0				/* unused? */
-static int
-remote_fetch_word (addr)
-     CORE_ADDR addr;
-{
-  return dcache_fetch (remote_dcache, addr);
-}
-
-/* Write a word WORD into remote address ADDR.
-   This goes through the data cache.  */
-
-static void
-remote_store_word (addr, word)
-     CORE_ADDR addr;
-     int word;
-{
-  dcache_poke (remote_dcache, addr, word);
-}
-#endif /* 0 (unused?) */
 
 
-
 /* Return the number of hex digits in num.  */
 
 static int
-hexnumlen (num)
-     ULONGEST num;
+hexnumlen (ULONGEST num)
 {
   int i;
 
@@ -3263,9 +3215,7 @@
 /* Set BUF to the minimum number of hex digits representing NUM.  */
 
 static int
-hexnumstr (buf, num)
-     char *buf;
-     ULONGEST num;
+hexnumstr (char *buf, ULONGEST num)
 {
   int len = hexnumlen (num);
   return hexnumnstr (buf, num, len);
@@ -3275,10 +3225,7 @@
 /* Set BUF to the hex digits representing NUM, padded to WIDTH characters.  */
 
 static int
-hexnumnstr (buf, num, width)
-     char *buf;
-     ULONGEST num;
-     int width;
+hexnumnstr (char *buf, ULONGEST num, int width)
 {
   int i;
 
@@ -3296,8 +3243,7 @@
 /* Mask all but the least significant REMOTE_ADDRESS_SIZE bits. */
 
 static CORE_ADDR
-remote_address_masked (addr)
-     CORE_ADDR addr;
+remote_address_masked (CORE_ADDR addr)
 {
   if (remote_address_size > 0
       && remote_address_size < (sizeof (ULONGEST) * 8))
@@ -3322,8 +3268,7 @@
    X-packet". */
 
 static void
-check_binary_download (addr)
-     CORE_ADDR addr;
+check_binary_download (CORE_ADDR addr)
 {
   switch (remote_protocol_binary_download.support)
     {
@@ -3417,7 +3362,10 @@
       todo = min (len, max_buf_size / 2);
       break;
     case PACKET_SUPPORT_UNKNOWN:
-      internal_error ("remote_write_bytes: bad switch");
+      internal_error ("%s:%d: remote_write_bytes: bad internal state",
+		      __FILE__, __LINE__);
+    default:
+      internal_error ("%s:%d: bad switch", __FILE__, __LINE__);
     }
   
   /* Append <memaddr> */
@@ -3481,7 +3429,10 @@
       *p = '\0';
       break;
     case PACKET_SUPPORT_UNKNOWN:
-      internal_error ("remote_write_bytes: bad switch");
+      internal_error ("%s:%d: remote_write_bytes: bad internal state",
+		      __FILE__, __LINE__);
+    default:
+      internal_error ("%s:%d: bad switch", __FILE__, __LINE__);
     }
   
   putpkt_binary (buf, (int) (p - buf));
@@ -3518,10 +3469,7 @@
    handling partial reads. */
 
 static int
-remote_read_bytes (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+remote_read_bytes (CORE_ADDR memaddr, char *myaddr, int len)
 {
   char *buf;
   int max_buf_size;		/* Max size of packet output buffer */
@@ -3588,25 +3536,27 @@
 /* Read or write LEN bytes from inferior memory at MEMADDR,
    transferring to or from debugger address BUFFER.  Write to inferior if
    SHOULD_WRITE is nonzero.  Returns length of data written or read; 0
-   for error.  */
+   for error.  TARGET is unused.  */
 
 /* ARGSUSED */
 static int
-remote_xfer_memory (mem_addr, buffer, mem_len, should_write, target)
-     CORE_ADDR mem_addr;
-     char *buffer;
-     int mem_len;
-     int should_write;
-     struct target_ops *target;	/* ignored */
+remote_xfer_memory (CORE_ADDR mem_addr, char *buffer, int mem_len,
+		    int should_write, struct target_ops *target)
 {
   CORE_ADDR targ_addr;
   int targ_len;
+  int res;
+
   REMOTE_TRANSLATE_XFER_ADDRESS (mem_addr, mem_len, &targ_addr, &targ_len);
   if (targ_len <= 0)
     return 0;
 
-  return dcache_xfer_memory (remote_dcache, targ_addr, buffer,
-			     targ_len, should_write);
+  if (should_write)
+    res = remote_write_bytes (targ_addr, buffer, targ_len);
+  else
+    res = remote_read_bytes (targ_addr, buffer, targ_len);
+
+  return res;
 }
 
 
@@ -3614,17 +3564,9 @@
 /* Enable after 4.12.  */
 
 void
-remote_search (len, data, mask, startaddr, increment, lorange, hirange
-	       addr_found, data_found)
-     int len;
-     char *data;
-     char *mask;
-     CORE_ADDR startaddr;
-     int increment;
-     CORE_ADDR lorange;
-     CORE_ADDR hirange;
-     CORE_ADDR *addr_found;
-     char *data_found;
+remote_search (int len, char *data, char *mask, CORE_ADDR startaddr,
+	       int increment, CORE_ADDR lorange, CORE_ADDR hirange,
+	       CORE_ADDR *addr_found, char *data_found)
 {
   if (increment == -4 && len == 4)
     {
@@ -3685,8 +3627,7 @@
 #endif /* 0 */
 
 static void
-remote_files_info (ignore)
-     struct target_ops *ignore;
+remote_files_info (struct target_ops *ignore)
 {
   puts_filtered ("Debugging a target over a serial line.\n");
 }
@@ -3697,8 +3638,7 @@
 /* Read a single character from the remote end, masking it down to 7 bits. */
 
 static int
-readchar (timeout)
-     int timeout;
+readchar (int timeout)
 {
   int ch;
 
@@ -3740,8 +3680,7 @@
    string notation.  */
 
 static void
-print_packet (buf)
-     char *buf;
+print_packet (char *buf)
 {
   puts_filtered ("\"");
   fputstr_filtered (buf, '"', gdb_stdout);
@@ -3749,8 +3688,7 @@
 }
 
 int
-putpkt (buf)
-     char *buf;
+putpkt (char *buf)
 {
   return putpkt_binary (buf, strlen (buf));
 }
@@ -3761,9 +3699,7 @@
    debugging (remote_debug) and want to print the sent packet as a string */
 
 static int
-putpkt_binary (buf, cnt)
-     char *buf;
-     int cnt;
+putpkt_binary (char *buf, int cnt)
 {
   int i;
   unsigned char csum = 0;
@@ -3844,9 +3780,11 @@
 	      break;		/* Retransmit buffer */
 	    case '$':
 	      {
+	        if (remote_debug)
+		  fprintf_unfiltered (gdb_stdlog, "Packet instead of Ack, ignoring it\n");
 		/* It's probably an old response, and we're out of sync.
 		   Just gobble up the packet and ignore it.  */
-		getpkt (junkbuf, sizeof_junkbuf, 0);
+		read_frame (junkbuf, sizeof_junkbuf);
 		continue;	/* Now, go look for + */
 	      }
 	    default:
@@ -3919,12 +3857,29 @@
 	case '#':
 	  {
 	    unsigned char pktcsum;
+	    int check_0 = 0;
+	    int check_1 = 0;
 
 	    buf[bc] = '\0';
 
-	    pktcsum = fromhex (readchar (remote_timeout)) << 4;
-	    pktcsum |= fromhex (readchar (remote_timeout));
+	    check_0 = readchar (remote_timeout);
+	    if (check_0 >= 0)
+	      check_1 = readchar (remote_timeout);
+	    
+	    if (check_0 == SERIAL_TIMEOUT || check_1 == SERIAL_TIMEOUT)
+	      {
+		if (remote_debug)
+		  fputs_filtered ("Timeout in checksum, retrying\n", gdb_stdlog);
+		return -1;
+	      }
+	    else if (check_0 < 0 || check_1 < 0)
+	      {
+		if (remote_debug)
+		  fputs_filtered ("Communication error in checksum\n", gdb_stdlog);
+		return -1;
+	      }
 
+	    pktcsum = (fromhex (check_0) << 4) | fromhex (check_1);
 	    if (csum == pktcsum)
               return bc;
 
@@ -4104,7 +4059,7 @@
 }
 
 static void
-remote_kill ()
+remote_kill (void)
 {
   /* For some mysterious reason, wait_for_inferior calls kill instead of
      mourn after it gets TARGET_WAITKIND_SIGNALLED.  Work around it.  */
@@ -4126,7 +4081,7 @@
 
 /* Async version of remote_kill. */
 static void
-remote_async_kill ()
+remote_async_kill (void)
 {
   /* Unregister the file descriptor from the event loop. */
   if (target_is_async_p ())
@@ -4151,19 +4106,19 @@
 }
 
 static void
-remote_mourn ()
+remote_mourn (void)
 {
   remote_mourn_1 (&remote_ops);
 }
 
 static void
-remote_async_mourn ()
+remote_async_mourn (void)
 {
   remote_mourn_1 (&remote_async_ops);
 }
 
 static void
-extended_remote_mourn ()
+extended_remote_mourn (void)
 {
   /* We do _not_ want to mourn the target like this; this will
      remove the extended remote target  from the target stack,
@@ -4177,8 +4132,7 @@
 
 /* Worker function for remote_mourn.  */
 static void
-remote_mourn_1 (target)
-     struct target_ops *target;
+remote_mourn_1 (struct target_ops *target)
 {
   unpush_target (target);
   generic_mourn_inferior ();
@@ -4192,10 +4146,7 @@
    we're debugging, arguments and an environment.  */
 
 static void
-extended_remote_create_inferior (exec_file, args, env)
-     char *exec_file;
-     char *args;
-     char **env;
+extended_remote_create_inferior (char *exec_file, char *args, char **env)
 {
   /* Rip out the breakpoints; we'll reinsert them after restarting
      the remote server.  */
@@ -4217,10 +4168,7 @@
 
 /* Async version of extended_remote_create_inferior. */
 static void
-extended_remote_async_create_inferior (exec_file, args, env)
-     char *exec_file;
-     char *args;
-     char **env;
+extended_remote_async_create_inferior (char *exec_file, char *args, char **env)
 {
   /* Rip out the breakpoints; we'll reinsert them after restarting
      the remote server.  */
@@ -4283,22 +4231,19 @@
    is accomplished via BREAKPOINT_MAX).  */
 
 static int
-remote_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+remote_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
 #ifdef REMOTE_BREAKPOINT
   int val;
 #endif  
   int bp_size;
 
-  /* Try the "Z" packet if it is not already disabled.
-     If it succeeds, then set the support to PACKET_ENABLE.
-     If it fails, and the user has explicitly requested the Z support 
-     then report an error, otherwise, mark it disabled and go on. */
+  /* Try the "Z" s/w breakpoint packet if it is not already disabled.
+     If it succeeds, then set the support to PACKET_ENABLE.  If it
+     fails, and the user has explicitly requested the Z support then
+     report an error, otherwise, mark it disabled and go on. */
   
-  if ((remote_protocol_Z.support == PACKET_ENABLE)
-      || (remote_protocol_Z.support == PACKET_SUPPORT_UNKNOWN)) 
+  if (remote_protocol_Z[Z_PACKET_SOFTWARE_BP].support != PACKET_DISABLE)
     {
       char *buf = alloca (PBUFSIZ);
       char *p = buf;
@@ -4314,24 +4259,14 @@
       putpkt (buf);
       getpkt (buf, PBUFSIZ, 0);
 
-      if (buf[0] != '\0')
+      switch (packet_ok (buf, &remote_protocol_Z[Z_PACKET_SOFTWARE_BP]))
 	{
-	  remote_protocol_Z.support = PACKET_ENABLE;
-	  return (buf[0] == 'E');
-	}
-      
-      /* The stub does not support the 'Z' request.  If the user has
-         explicitly requested the Z support, or if the stub previously
-	 said it supported the packet, this is an error,
-         otherwise, mark it disabled. */
-      
-      else if (remote_protocol_Z.support == PACKET_ENABLE)
-	{
-	  error ("Protocol error: Z packet not recognized by stub");
-	}
-      else
-	{
-	  remote_protocol_Z.support = PACKET_DISABLE;
+	case PACKET_ERROR:
+	  return -1;
+	case PACKET_OK:
+	  return 0;
+	case PACKET_UNKNOWN:
+	  break;
 	}
     }
 
@@ -4355,14 +4290,11 @@
 }
 
 static int
-remote_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+remote_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   int bp_size;
 
-  if ((remote_protocol_Z.support == PACKET_ENABLE)
-      || (remote_protocol_Z.support == PACKET_SUPPORT_UNKNOWN))
+  if (remote_protocol_Z[Z_PACKET_SOFTWARE_BP].support != PACKET_DISABLE)
     {
       char *buf = alloca (PBUFSIZ);
       char *p = buf;
@@ -4389,20 +4321,41 @@
 #endif /* REMOTE_BREAKPOINT */
 }
 
-#ifdef TARGET_HAS_HARDWARE_WATCHPOINTS
+static int
+watchpoint_to_Z_packet (int type)
+{
+  switch (type)
+    {
+    case hw_write:
+      return 2;
+      break;
+    case hw_read:
+      return 3;
+      break;
+    case hw_access:
+      return 4;
+      break;
+    default:
+      internal_error ("hw_bp_to_z: bad watchpoint type %d", type);
+    }
+}
+
+/* FIXME: This function should be static and a member of the remote
+   target vector. */
+
 int
-remote_insert_watchpoint (addr, len, type)
-     CORE_ADDR addr;
-     int len;
-     int type;
+remote_insert_watchpoint (CORE_ADDR addr, int len, int type)
 {
   char *buf = alloca (PBUFSIZ);
   char *p;
+  enum Z_packet_type packet = watchpoint_to_Z_packet (type);
 
-  if (remote_protocol_Z.support == PACKET_DISABLE)
-    error ("Can't set hardware watchpoints without the 'Z' packet\n");
+  if (remote_protocol_Z[packet].support == PACKET_DISABLE)
+    error ("Can't set hardware watchpoints without the '%s' (%s) packet\n",
+	   remote_protocol_Z[packet].name,
+	   remote_protocol_Z[packet].title);
   
-  sprintf (buf, "Z%x,", type + 2 );
+  sprintf (buf, "Z%x,", packet);
   p = strchr (buf, '\0');
   addr = remote_address_masked (addr);
   p += hexnumstr (p, (ULONGEST) addr);
@@ -4411,22 +4364,33 @@
   putpkt (buf);
   getpkt (buf, PBUFSIZ, 0);
 
-  if (buf[0] == '\0' || buf [0] == 'E')
-    return -1;
-
-  return 0;
+  switch (packet_ok (buf, &remote_protocol_Z[packet]))
+    {
+    case PACKET_ERROR:
+    case PACKET_UNKNOWN:
+      return -1;
+    case PACKET_OK:
+      return 0;
+    }
+  internal_error ("remote_insert_watchpoint: reached end of function");
 }
 
+/* FIXME: This function should be static and a member of the remote
+   target vector. */
+
 int
-remote_remove_watchpoint (addr, len, type)
-     CORE_ADDR addr;
-     int len;
-     int type;
+remote_remove_watchpoint (CORE_ADDR addr, int len, int type)
 {
   char *buf = alloca (PBUFSIZ);
   char *p;
+  enum Z_packet_type packet = watchpoint_to_Z_packet (type);
+
+  if (remote_protocol_Z[packet].support == PACKET_DISABLE)
+    error ("Can't clear hardware watchpoints without the '%s' (%s) packet\n",
+	   remote_protocol_Z[packet].name,
+	   remote_protocol_Z[packet].title);
   
-  sprintf (buf, "z%x,", type + 2 );
+  sprintf (buf, "z%x,", packet);
   p = strchr (buf, '\0');
   addr = remote_address_masked (addr);
   p += hexnumstr (p, (ULONGEST) addr);
@@ -4434,23 +4398,31 @@
   putpkt (buf);
   getpkt (buf, PBUFSIZ, 0);
 
-  if (buf[0] == '\0' || buf [0] == 'E')
-    return -1;
-
-  return 0;
+  switch (packet_ok (buf, &remote_protocol_Z[packet]))
+    {
+    case PACKET_ERROR:
+    case PACKET_UNKNOWN:
+      return -1;
+    case PACKET_OK:
+      return 0;
+    }
+  internal_error ("remote_remove_watchpoint: reached end of function");
 }
 
+/* FIXME: This function should be static and a member of the remote
+   target vector. */
+
 int
-remote_insert_hw_breakpoint (addr, len)
-     CORE_ADDR addr;
-     int len;
+remote_insert_hw_breakpoint (CORE_ADDR addr, int len)
 {
   char *buf = alloca (PBUFSIZ);
   char *p = buf;
       
-  if (remote_protocol_Z.support == PACKET_DISABLE)
-    error ("Can't set hardware breakpoints without the 'Z' packet\n");
-
+  if (remote_protocol_Z[Z_PACKET_HARDWARE_BP].support == PACKET_DISABLE)
+    error ("Can't set hardware breakpoint without the '%s' (%s) packet\n",
+	   remote_protocol_Z[Z_PACKET_HARDWARE_BP].name,
+	   remote_protocol_Z[Z_PACKET_HARDWARE_BP].title);
+  
   *(p++) = 'Z';
   *(p++) = '1';
   *(p++) = ',';
@@ -4462,20 +4434,31 @@
   putpkt (buf);
   getpkt (buf, PBUFSIZ, 0);
 
-  if (buf[0] == '\0' || buf [0] == 'E')
-    return -1;
-
-  return 0;
+  switch (packet_ok (buf, &remote_protocol_Z[Z_PACKET_HARDWARE_BP]))
+    {
+    case PACKET_ERROR:
+    case PACKET_UNKNOWN:
+      return -1;
+    case PACKET_OK:
+      return 0;
+    }
+  internal_error ("remote_remove_watchpoint: reached end of function");
 }
 
+/* FIXME: This function should be static and a member of the remote
+   target vector. */
+
 int 
-remote_remove_hw_breakpoint (addr, len)
-     CORE_ADDR addr;
-     int len;
+remote_remove_hw_breakpoint (CORE_ADDR addr, int len)
 {
   char *buf = alloca (PBUFSIZ);
   char *p = buf;
   
+  if (remote_protocol_Z[Z_PACKET_HARDWARE_BP].support == PACKET_DISABLE)
+    error ("Can't clear hardware breakpoint without the '%s' (%s) packet\n",
+	   remote_protocol_Z[Z_PACKET_HARDWARE_BP].name,
+	   remote_protocol_Z[Z_PACKET_HARDWARE_BP].title);
+  
   *(p++) = 'z';
   *(p++) = '1';
   *(p++) = ',';
@@ -4487,12 +4470,16 @@
   putpkt(buf);
   getpkt (buf, PBUFSIZ, 0);
   
-  if (buf[0] == '\0' || buf [0] == 'E')
-    return -1;
-
-  return 0;
+  switch (packet_ok (buf, &remote_protocol_Z[Z_PACKET_HARDWARE_BP]))
+    {
+    case PACKET_ERROR:
+    case PACKET_UNKNOWN:
+      return -1;
+    case PACKET_OK:
+      return 0;
+    }
+  internal_error ("remote_remove_watchpoint: reached end of function");
 }
-#endif
 
 /* Some targets are only capable of doing downloads, and afterwards
    they switch to the remote serial protocol.  This function provides
@@ -4505,9 +4492,7 @@
    already..." message.  Usually a call to pop_target() suffices.  */
 
 void
-push_remote_target (name, from_tty)
-     char *name;
-     int from_tty;
+push_remote_target (char *name, int from_tty)
 {
   printf_filtered ("Switching to remote protocol\n");
   remote_open (name, from_tty);
@@ -4517,11 +4502,8 @@
    certain remote_ops overridden. */
 
 void
-open_remote_target (name, from_tty, target, extended_p)
-     char *name;
-     int from_tty;
-     struct target_ops *target;
-     int extended_p;
+open_remote_target (char *name, int from_tty, struct target_ops *target,
+		    int extended_p)
 {
   printf_filtered ("Selecting the %sremote protocol\n",
 		   (extended_p ? "extended-" : ""));
@@ -4534,10 +4516,7 @@
 {0, 0};
 
 static unsigned long
-crc32 (buf, len, crc)
-     unsigned char *buf;
-     int len;
-     unsigned int crc;
+crc32 (unsigned char *buf, int len, unsigned int crc)
 {
   if (!crc32_table[1])
     {
@@ -4574,9 +4553,7 @@
    generic_load()) to make use of this target functionality. */
 
 static void
-compare_sections_command (args, from_tty)
-     char *args;
-     int from_tty;
+compare_sections_command (char *args, int from_tty)
 {
   asection *s;
   unsigned long host_crc, target_crc;
@@ -4618,7 +4595,7 @@
 
       /* be clever; compute the host_crc before waiting for target reply */
       sectdata = xmalloc (size);
-      old_chain = make_cleanup (free, sectdata);
+      old_chain = make_cleanup (xfree, sectdata);
       bfd_get_section_contents (exec_bfd, s, sectdata, 0, size);
       host_crc = crc32 ((unsigned char *) sectdata, size, 0xffffffff);
 
@@ -4652,11 +4629,7 @@
 }
 
 static int
-remote_query (query_type, buf, outbuf, bufsiz)
-     int query_type;
-     char *buf;
-     char *outbuf;
-     int *bufsiz;
+remote_query (int query_type, char *buf, char *outbuf, int *bufsiz)
 {
   int i;
   char *buf2 = alloca (PBUFSIZ);
@@ -4784,9 +4757,7 @@
 }
 
 static void
-packet_command (args, from_tty)
-     char *args;
-     int from_tty;
+packet_command (char *args, int from_tty)
 {
   char *buf = alloca (PBUFSIZ);
 
@@ -4831,9 +4802,7 @@
 #define SAMPLE_THREAD  0x05060708	/* Truncated 64 bit threadid */
 
 static void
-threadset_test_cmd (cmd, tty)
-     char *cmd;
-     int tty;
+threadset_test_cmd (char *cmd, int tty)
 {
   int sample_thread = SAMPLE_THREAD;
 
@@ -4843,9 +4812,7 @@
 
 
 static void
-threadalive_test (cmd, tty)
-     char *cmd;
-     int tty;
+threadalive_test (char *cmd, int tty)
 {
   int sample_thread = SAMPLE_THREAD;
 
@@ -4858,9 +4825,7 @@
 void output_threadid (char *title, threadref * ref);
 
 void
-output_threadid (title, ref)
-     char *title;
-     threadref *ref;
+output_threadid (char *title, threadref *ref)
 {
   char hexid[20];
 
@@ -4870,9 +4835,7 @@
 }
 
 static void
-threadlist_test_cmd (cmd, tty)
-     char *cmd;
-     int tty;
+threadlist_test_cmd (char *cmd, int tty)
 {
   int startflag = 1;
   threadref nextthread;
@@ -4894,8 +4857,7 @@
 }
 
 void
-display_thread_info (info)
-     struct gdb_ext_thread_info *info;
+display_thread_info (struct gdb_ext_thread_info *info)
 {
   output_threadid ("Threadid: ", &info->threadid);
   printf_filtered ("Name: %s\n ", info->shortname);
@@ -4904,8 +4866,7 @@
 }
 
 int
-get_and_display_threadinfo (ref)
-     threadref *ref;
+get_and_display_threadinfo (threadref *ref)
 {
   int result;
   int set;
@@ -4919,9 +4880,7 @@
 }
 
 static void
-threadinfo_test_cmd (cmd, tty)
-     char *cmd;
-     int tty;
+threadinfo_test_cmd (char *cmd, int tty)
 {
   int athread = SAMPLE_THREAD;
   threadref thread;
@@ -4934,18 +4893,14 @@
 }
 
 static int
-thread_display_step (ref, context)
-     threadref *ref;
-     void *context;
+thread_display_step (threadref *ref, void *context)
 {
   /* output_threadid(" threadstep ",ref); *//* simple test */
   return get_and_display_threadinfo (ref);
 }
 
 static void
-threadlist_update_test_cmd (cmd, tty)
-     char *cmd;
-     int tty;
+threadlist_update_test_cmd (char *cmd, int tty)
 {
   printf_filtered ("Remote Threadlist update test\n");
   remote_threadlist_iterator (thread_display_step, 0, CRAZY_MAX_THREADS);
@@ -4969,7 +4924,7 @@
 #endif /* 0 */
 
 static void
-init_remote_ops ()
+init_remote_ops (void)
 {
   remote_ops.to_shortname = "remote";
   remote_ops.to_longname = "Remote serial target in gdb-specific protocol";
@@ -5012,7 +4967,7 @@
    remote vector and adding to it.  */
 
 static void
-init_extended_remote_ops ()
+init_extended_remote_ops (void)
 {
   extended_remote_ops = remote_ops;
 
@@ -5085,8 +5040,6 @@
 
   unpush_target (&remote_cisco_ops);
 
-  remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes);
-
   remote_desc = SERIAL_OPEN (name);
   if (!remote_desc)
     perror_with_name (name);
@@ -5121,16 +5074,11 @@
 
   push_target (&remote_cisco_ops);	/* Switch to using cisco target now */
 
-  init_packet_config (&remote_protocol_P);
-  init_packet_config (&remote_protocol_Z);
+  init_all_packet_configs ();
 
   general_thread = -2;
   continue_thread = -2;
 
-  /* Force remote_write_bytes to check whether target supports
-     binary downloading. */
-  init_packet_config (&remote_protocol_binary_download);
-
   /* Probe for ability to use "ThreadInfo" query, as required.  */
   use_threadinfo_query = 1;
   use_threadextra_query = 1;
@@ -5162,8 +5110,7 @@
 }
 
 static void
-  remote_cisco_mourn
-PARAMS ((void))
+remote_cisco_mourn (void)
 {
   remote_mourn_1 (&remote_cisco_ops);
 }
@@ -5386,7 +5333,7 @@
 }
 
 static void
-init_remote_cisco_ops ()
+init_remote_cisco_ops (void)
 {
   remote_cisco_ops.to_shortname = "cisco";
   remote_cisco_ops.to_longname = "Remote serial target in cisco-specific protocol";
@@ -5542,9 +5489,16 @@
   
 }
 
+static void
+show_remote_cmd (char *args, int from_tty)
+{
+  show_remote_protocol_Z_packet_cmd (args, from_tty);
+  show_remote_protocol_P_packet_cmd (args, from_tty);
+  show_remote_protocol_binary_download_cmd (args, from_tty);
+}
 
 static void
-build_remote_gdbarch_data ()
+build_remote_gdbarch_data (void)
 {
   build_remote_packet_sizes ();
 
@@ -5554,7 +5508,7 @@
 }
 
 void
-_initialize_remote ()
+_initialize_remote (void)
 {
   static struct cmd_list_element *remote_set_cmdlist;
   static struct cmd_list_element *remote_show_cmdlist;
@@ -5587,13 +5541,15 @@
   init_remote_threadtests ();
 #endif
 
+  /* set/show remote ... */
+
   add_prefix_cmd ("remote", class_maintenance, set_remote_cmd, "\
 Remote protocol specific variables\n\
 Configure various remote-protocol specific variables such as\n\
 the packets being used",
 		  &remote_set_cmdlist, "set remote ",
 		  0/*allow-unknown*/, &setlist);
-  add_prefix_cmd ("remote", class_maintenance, set_remote_cmd, "\
+  add_prefix_cmd ("remote", class_maintenance, show_remote_cmd, "\
 Remote protocol specific variables\n\
 Configure various remote-protocol specific variables such as\n\
 the packets being used",
@@ -5626,7 +5582,7 @@
   add_cmd ("remotewritesize", no_class, set_memory_write_packet_size,
 	   "Set the maximum number of bytes per memory write packet (deprecated).\n",
 	   &setlist);
-  add_cmd ("remotewritesize", no_class, set_memory_write_packet_size,
+  add_cmd ("remotewritesize", no_class, show_memory_write_packet_size,
 	   "Show the maximum number of bytes per memory write packet (deprecated).\n",
 	   &showlist);
   add_cmd ("memory-write-packet-size", no_class,
@@ -5666,7 +5622,8 @@
 			 "X", "binary-download",
 			 set_remote_protocol_binary_download_cmd,
 			 show_remote_protocol_binary_download_cmd,
-			 &remote_set_cmdlist, &remote_show_cmdlist);
+			 &remote_set_cmdlist, &remote_show_cmdlist,
+			 1);
 #if 0
   /* XXXX - should ``set remotebinarydownload'' be retained for
      compatibility. */
@@ -5680,13 +5637,55 @@
   add_info ("remote-process", remote_info_process,
 	    "Query the remote system for process info.");
 
-  add_packet_config_cmd (&remote_protocol_P, "P", "set-register",
+  add_packet_config_cmd (&remote_protocol_P,
+			 "P", "set-register",
 			 set_remote_protocol_P_packet_cmd,
 			 show_remote_protocol_P_packet_cmd,
-			 &remote_set_cmdlist, &remote_show_cmdlist);
+			 &remote_set_cmdlist, &remote_show_cmdlist,
+			 1);
 
-  add_packet_config_cmd (&remote_protocol_Z, "Z", "breakpoint",
-			 set_remote_protocol_Z_packet_cmd,
-			 show_remote_protocol_Z_packet_cmd,
-			 &remote_set_cmdlist, &remote_show_cmdlist);
+  add_packet_config_cmd (&remote_protocol_Z[Z_PACKET_SOFTWARE_BP],
+			 "Z0", "software-breakpoint",
+			 set_remote_protocol_Z_software_bp_packet_cmd,
+			 show_remote_protocol_Z_software_bp_packet_cmd,
+			 &remote_set_cmdlist, &remote_show_cmdlist,
+			 0);
+
+  add_packet_config_cmd (&remote_protocol_Z[Z_PACKET_HARDWARE_BP],
+			 "Z1", "hardware-breakpoint",
+			 set_remote_protocol_Z_hardware_bp_packet_cmd,
+			 show_remote_protocol_Z_hardware_bp_packet_cmd,
+			 &remote_set_cmdlist, &remote_show_cmdlist,
+			 0);
+
+  add_packet_config_cmd (&remote_protocol_Z[Z_PACKET_WRITE_WP],
+			 "Z2", "write-watchpoint",
+			 set_remote_protocol_Z_write_wp_packet_cmd,
+			 show_remote_protocol_Z_write_wp_packet_cmd,
+			 &remote_set_cmdlist, &remote_show_cmdlist,
+			 0);
+
+  add_packet_config_cmd (&remote_protocol_Z[Z_PACKET_READ_WP],
+			 "Z3", "read-watchpoint",
+			 set_remote_protocol_Z_read_wp_packet_cmd,
+			 show_remote_protocol_Z_read_wp_packet_cmd,
+			 &remote_set_cmdlist, &remote_show_cmdlist,
+			 0);
+
+  add_packet_config_cmd (&remote_protocol_Z[Z_PACKET_ACCESS_WP],
+			 "Z4", "access-watchpoint",
+			 set_remote_protocol_Z_access_wp_packet_cmd,
+			 show_remote_protocol_Z_access_wp_packet_cmd,
+			 &remote_set_cmdlist, &remote_show_cmdlist,
+			 0);
+
+  /* Keep the old ``set remote Z-packet ...'' working. */
+  tmpcmd = add_set_auto_boolean_cmd ("Z-packet", class_obscure,
+				     &remote_Z_packet_detect,
+				     "\
+Set use of remote protocol `Z' packets", &remote_set_cmdlist);
+  tmpcmd->function.sfunc = set_remote_protocol_Z_packet_cmd;
+  add_cmd ("Z-packet", class_obscure, show_remote_protocol_Z_packet_cmd,
+	   "Show use of remote protocol `Z' packets ",
+	   &remote_show_cmdlist);
 }
diff --git a/gdb/rom68k-rom.c b/gdb/rom68k-rom.c
index 212bdf4..5bb3a18 100644
--- a/gdb/rom68k-rom.c
+++ b/gdb/rom68k-rom.c
@@ -27,11 +27,7 @@
 static void rom68k_open (char *args, int from_tty);
 
 static void
-rom68k_supply_register (regname, regnamelen, val, vallen)
-     char *regname;
-     int regnamelen;
-     char *val;
-     int vallen;
+rom68k_supply_register (char *regname, int regnamelen, char *val, int vallen)
 {
   int numregs;
   int regno;
@@ -149,15 +145,13 @@
 }				/* init_rom68k_cmds */
 
 static void
-rom68k_open (args, from_tty)
-     char *args;
-     int from_tty;
+rom68k_open (char *args, int from_tty)
 {
   monitor_open (args, &rom68k_cmds, from_tty);
 }
 
 void
-_initialize_rom68k ()
+_initialize_rom68k (void)
 {
   init_rom68k_cmds ();
   init_monitor_ops (&rom68k_ops);
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index f1ee422..e890484 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -39,14 +39,86 @@
 #include <signal.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
+#include <errno.h>
 
 #include <a.out.h>
 #include <sys/file.h>
 #include "gdb_stat.h"
 #include <sys/core.h>
+#define __LDINFO_PTRACE32__	/* for __ld_info32 */
+#define __LDINFO_PTRACE64__	/* for __ld_info64 */
 #include <sys/ldr.h>
+#include <sys/systemcfg.h>
 
-extern int errno;
+/* On AIX4.3+, sys/ldr.h provides different versions of struct ld_info for
+   debugging 32-bit and 64-bit processes.  Define a typedef and macros for
+   accessing fields in the appropriate structures. */
+
+/* In 32-bit compilation mode (which is the only mode from which ptrace()
+   works on 4.3), __ld_info32 is #defined as equivalent to ld_info. */
+
+#ifdef __ld_info32
+# define ARCH3264
+#endif
+
+/* Return whether the current architecture is 64-bit. */
+
+#ifndef ARCH3264
+# define ARCH64() 0
+#else
+# define ARCH64() (REGISTER_RAW_SIZE (0) == 8)
+#endif
+
+/* Union of 32-bit and 64-bit ".reg" core file sections. */
+
+typedef union {
+#ifdef ARCH3264
+  struct __context64 r64;
+#else
+  struct mstsave r64;
+#endif
+  struct mstsave r32;
+} CoreRegs;
+
+/* Union of 32-bit and 64-bit versions of ld_info. */
+
+typedef union {
+#ifndef ARCH3264
+  struct ld_info l32;
+  struct ld_info l64;
+#else
+  struct __ld_info32 l32;
+  struct __ld_info64 l64;
+#endif
+} LdInfo;
+
+/* If compiling with 32-bit and 64-bit debugging capability (e.g. AIX 4.x),
+   declare and initialize a variable named VAR suitable for use as the arch64
+   parameter to the various LDI_*() macros. */
+
+#ifndef ARCH3264
+# define ARCH64_DECL(var)
+#else
+# define ARCH64_DECL(var) int var = ARCH64 ()
+#endif
+
+/* Return LDI's FIELD for a 64-bit process if ARCH64 and for a 32-bit process
+   otherwise.  This technique only works for FIELDs with the same data type in
+   32-bit and 64-bit versions of ld_info. */
+
+#ifndef ARCH3264
+# define LDI_FIELD(ldi, arch64, field) (ldi)->l32.ldinfo_##field
+#else
+# define LDI_FIELD(ldi, arch64, field) \
+  (arch64 ? (ldi)->l64.ldinfo_##field : (ldi)->l32.ldinfo_##field)
+#endif
+
+/* Return various LDI fields for a 64-bit process if ARCH64 and for a 32-bit
+   process otherwise. */
+
+#define LDI_NEXT(ldi, arch64)		LDI_FIELD(ldi, arch64, next)
+#define LDI_FD(ldi, arch64)		LDI_FIELD(ldi, arch64, fd)
+#define LDI_FILENAME(ldi, arch64)	LDI_FIELD(ldi, arch64, filename)
 
 extern struct vmap *map_vmap (bfd * bf, bfd * arch);
 
@@ -54,11 +126,11 @@
 
 static void vmap_exec (void);
 
-static void vmap_ldinfo (struct ld_info *);
+static void vmap_ldinfo (LdInfo *);
 
-static struct vmap *add_vmap (struct ld_info *);
+static struct vmap *add_vmap (LdInfo *);
 
-static int objfile_symbol_add (char *);
+static int objfile_symbol_add (void *);
 
 static void vmap_symtab (struct vmap *);
 
@@ -69,7 +141,7 @@
 extern void
 fixup_breakpoints (CORE_ADDR low, CORE_ADDR high, CORE_ADDR delta);
 
-/* Conversion from gdb-to-system special purpose register numbers.. */
+/* Conversion from gdb-to-system special purpose register numbers. */
 
 static int special_regs[] =
 {
@@ -82,162 +154,153 @@
   MQ				/* MQ_REGNUM    */
 };
 
-void
-fetch_inferior_registers (regno)
-     int regno;
+/* Call ptrace(REQ, ID, ADDR, DATA, BUF). */
+
+static int
+ptrace32 (int req, int id, int *addr, int data, int *buf)
 {
-  int ii;
+  int ret = ptrace (req, id, (int *)addr, data, buf);
+#if 0
+  printf ("ptrace32 (%d, %d, 0x%x, %08x, 0x%x) = 0x%x\n",
+	  req, id, (unsigned int)addr, data, (unsigned int)buf, ret);
+#endif
+  return ret;
+}
 
-  if (regno < 0)
-    {				/* for all registers */
+/* Call ptracex(REQ, ID, ADDR, DATA, BUF). */
 
-      /* read 32 general purpose registers. */
+static int
+ptrace64 (int req, int id, long long addr, int data, int *buf)
+{
+#ifdef ARCH3264
+  int ret = ptracex (req, id, addr, data, buf);
+#else
+  int ret = 0;
+#endif
+#if 0
+  printf ("ptrace64 (%d, %d, 0x%llx, %08x, 0x%x) = 0x%x\n",
+	  req, id, addr, data, (unsigned int)buf, ret);
+#endif
+  return ret;
+}
 
-      for (ii = 0; ii < 32; ++ii)
-	*(int *) &registers[REGISTER_BYTE (ii)] =
-	  ptrace (PT_READ_GPR, inferior_pid, (PTRACE_ARG3_TYPE) ii, 0, 0);
+/* Fetch register REGNO from the inferior. */
 
-      /* read general purpose floating point registers. */
+static void
+fetch_register (int regno)
+{
+  int *addr = (int *) &registers[REGISTER_BYTE (regno)];
+  int nr;
 
-      for (ii = 0; ii < 32; ++ii)
-	ptrace (PT_READ_FPR, inferior_pid,
-	    (PTRACE_ARG3_TYPE) & registers[REGISTER_BYTE (FP0_REGNUM + ii)],
-		FPR0 + ii, 0);
+  /* Retrieved values may be -1, so infer errors from errno. */
+  errno = 0;
 
-      /* read special registers. */
-      for (ii = 0; ii <= LAST_UISA_SP_REGNUM - FIRST_UISA_SP_REGNUM; ++ii)
-	*(int *) &registers[REGISTER_BYTE (FIRST_UISA_SP_REGNUM + ii)] =
-	  ptrace (PT_READ_GPR, inferior_pid, (PTRACE_ARG3_TYPE) special_regs[ii],
-		  0, 0);
-
-      registers_fetched ();
-      return;
+  /* Floating-point registers. */
+  if (regno >= FP0_REGNUM && regno <= FPLAST_REGNUM)
+    {
+      nr = regno - FP0_REGNUM + FPR0;
+      ptrace32 (PT_READ_FPR, inferior_pid, addr, nr, 0);
     }
 
-  /* else an individual register is addressed. */
-
-  else if (regno < FP0_REGNUM)
-    {				/* a GPR */
-      *(int *) &registers[REGISTER_BYTE (regno)] =
-	ptrace (PT_READ_GPR, inferior_pid, (PTRACE_ARG3_TYPE) regno, 0, 0);
-    }
-  else if (regno <= FPLAST_REGNUM)
-    {				/* a FPR */
-      ptrace (PT_READ_FPR, inferior_pid,
-	      (PTRACE_ARG3_TYPE) & registers[REGISTER_BYTE (regno)],
-	      (regno - FP0_REGNUM + FPR0), 0);
-    }
-  else if (regno <= LAST_UISA_SP_REGNUM)
-    {				/* a special register */
-      *(int *) &registers[REGISTER_BYTE (regno)] =
-	ptrace (PT_READ_GPR, inferior_pid,
-	      (PTRACE_ARG3_TYPE) special_regs[regno - FIRST_UISA_SP_REGNUM],
-		0, 0);
-    }
-  else
+  /* Bogus register number. */
+  else if (regno > LAST_UISA_SP_REGNUM)
     fprintf_unfiltered (gdb_stderr,
 			"gdb error: register no %d not implemented.\n",
 			regno);
 
-  register_valid[regno] = 1;
+  /* Fixed-point registers. */
+  else
+    {
+      if (regno >= FIRST_UISA_SP_REGNUM)
+	nr = special_regs[regno - FIRST_UISA_SP_REGNUM];
+      else
+	nr = regno;
+
+      if (!ARCH64 ())
+	*addr = ptrace32 (PT_READ_GPR, inferior_pid, (int *)nr, 0, 0);
+      else
+	{
+	  /* PT_READ_GPR requires the buffer parameter to point to long long,
+	     even if the register is really only 32 bits. */
+	  long long buf;
+	  ptrace64 (PT_READ_GPR, inferior_pid, nr, 0, (int *)&buf);
+	  if (REGISTER_RAW_SIZE (regno) == 8)
+	    memcpy (addr, &buf, 8);
+	  else
+	    *addr = buf;
+	}
+    }
+
+  if (!errno)
+    register_valid[regno] = 1;
+  else
+    {
+#if 0
+      /* FIXME: this happens 3 times at the start of each 64-bit program. */
+      perror ("ptrace read");
+#endif
+      errno = 0;
+    }
 }
 
-/* Store our register values back into the inferior.
-   If REGNO is -1, do this for all registers.
-   Otherwise, REGNO specifies which register (so we can save time).  */
+/* Store register REGNO back into the inferior. */
 
-void
-store_inferior_registers (regno)
-     int regno;
+static void
+store_register (int regno)
 {
+  int *addr = (int *) &registers[REGISTER_BYTE (regno)];
+  int nr;
 
+  /* -1 can be a successful return value, so infer errors from errno. */
   errno = 0;
 
-  if (regno == -1)
-    {				/* for all registers..  */
-      int ii;
-
-      /* execute one dummy instruction (which is a breakpoint) in inferior
-         process. So give kernel a chance to do internal house keeping.
-         Otherwise the following ptrace(2) calls will mess up user stack
-         since kernel will get confused about the bottom of the stack (%sp) */
-
-      exec_one_dummy_insn ();
-
-      /* write general purpose registers first! */
-      for (ii = GPR0; ii <= GPR31; ++ii)
-	{
-	  ptrace (PT_WRITE_GPR, inferior_pid, (PTRACE_ARG3_TYPE) ii,
-		  *(int *) &registers[REGISTER_BYTE (ii)], 0);
-	  if (errno)
-	    {
-	      perror ("ptrace write_gpr");
-	      errno = 0;
-	    }
-	}
-
-      /* write floating point registers now. */
-      for (ii = 0; ii < 32; ++ii)
-	{
-	  ptrace (PT_WRITE_FPR, inferior_pid,
-	    (PTRACE_ARG3_TYPE) & registers[REGISTER_BYTE (FP0_REGNUM + ii)],
-		  FPR0 + ii, 0);
-	  if (errno)
-	    {
-	      perror ("ptrace write_fpr");
-	      errno = 0;
-	    }
-	}
-
-      /* write special registers. */
-      for (ii = 0; ii <= LAST_UISA_SP_REGNUM - FIRST_UISA_SP_REGNUM; ++ii)
-	{
-	  ptrace (PT_WRITE_GPR, inferior_pid,
-		  (PTRACE_ARG3_TYPE) special_regs[ii],
-	     *(int *) &registers[REGISTER_BYTE (FIRST_UISA_SP_REGNUM + ii)],
-		  0);
-	  if (errno)
-	    {
-	      perror ("ptrace write_gpr");
-	      errno = 0;
-	    }
-	}
+  /* Floating-point registers. */
+  if (regno >= FP0_REGNUM && regno <= FPLAST_REGNUM)
+    {
+      nr = regno - FP0_REGNUM + FPR0;
+      ptrace32 (PT_WRITE_FPR, inferior_pid, addr, nr, 0);
     }
 
-  /* else, a specific register number is given... */
+  /* Bogus register number. */
+  else if (regno > LAST_UISA_SP_REGNUM)
+    {
+      if (regno >= NUM_REGS)
+	fprintf_unfiltered (gdb_stderr,
+			    "gdb error: register no %d not implemented.\n",
+			    regno);
+    }
 
-  else if (regno < FP0_REGNUM)	/* a GPR */
+  /* Fixed-point registers. */
+  else
     {
       if (regno == SP_REGNUM)
+	/* Execute one dummy instruction (which is a breakpoint) in inferior
+	   process to give kernel a chance to do internal housekeeping.
+	   Otherwise the following ptrace(2) calls will mess up user stack
+	   since kernel will get confused about the bottom of the stack
+	   (%sp). */
 	exec_one_dummy_insn ();
-      ptrace (PT_WRITE_GPR, inferior_pid, (PTRACE_ARG3_TYPE) regno,
-	      *(int *) &registers[REGISTER_BYTE (regno)], 0);
-    }
 
-  else if (regno <= FPLAST_REGNUM)	/* a FPR */
-    {
-      ptrace (PT_WRITE_FPR, inferior_pid,
-	      (PTRACE_ARG3_TYPE) & registers[REGISTER_BYTE (regno)],
-	      regno - FP0_REGNUM + FPR0, 0);
-    }
+      if (regno >= FIRST_UISA_SP_REGNUM)
+	nr = special_regs[regno - FIRST_UISA_SP_REGNUM];
+      else
+	nr = regno;
 
-  else if (regno <= LAST_UISA_SP_REGNUM)	/* a special register */
-    {
-      ptrace (PT_WRITE_GPR, inferior_pid,
-	      (PTRACE_ARG3_TYPE) special_regs[regno - FIRST_UISA_SP_REGNUM],
-	      *(int *) &registers[REGISTER_BYTE (regno)], 0);
+      if (!ARCH64 ())
+	ptrace32 (PT_WRITE_GPR, inferior_pid, (int *)nr, *addr, 0);
+      else
+	{
+	  /* PT_WRITE_GPR requires the buffer parameter to point to an 8-byte
+	     area, even if the register is really only 32 bits. */
+	  long long buf;
+	  if (REGISTER_RAW_SIZE (regno) == 8)
+	    memcpy (&buf, addr, 8);
+	  else
+	    buf = *addr;
+	  ptrace64 (PT_WRITE_GPR, inferior_pid, nr, 0, (int *)&buf);
+	}
     }
 
-  else if (regno < NUM_REGS)
-    {
-      /* Ignore it.  */
-    }
-
-  else
-    fprintf_unfiltered (gdb_stderr,
-			"Gdb error: register no %d not implemented.\n",
-			regno);
-
   if (errno)
     {
       perror ("ptrace write");
@@ -245,17 +308,161 @@
     }
 }
 
+/* Read from the inferior all registers if REGNO == -1 and just register
+   REGNO otherwise. */
+
+void
+fetch_inferior_registers (int regno)
+{
+  if (regno != -1)
+    fetch_register (regno);
+
+  else
+    {
+      /* read 32 general purpose registers. */
+      for (regno = 0; regno < 32; regno++)
+	fetch_register (regno);
+
+      /* read general purpose floating point registers. */
+      for (regno = FP0_REGNUM; regno <= FPLAST_REGNUM; regno++)
+	fetch_register (regno);
+
+      /* read special registers. */
+      for (regno = FIRST_UISA_SP_REGNUM; regno <= LAST_UISA_SP_REGNUM; regno++)
+	fetch_register (regno);
+    }
+}
+
+/* Store our register values back into the inferior.
+   If REGNO is -1, do this for all registers.
+   Otherwise, REGNO specifies which register (so we can save time).  */
+
+void
+store_inferior_registers (int regno)
+{
+  if (regno != -1)
+    store_register (regno);
+
+  else
+    {
+      /* write general purpose registers first! */
+      for (regno = GPR0; regno <= GPR31; regno++)
+	store_register (regno);
+
+      /* write floating point registers now. */
+      for (regno = FP0_REGNUM; regno <= FPLAST_REGNUM; regno++)
+	store_register (regno);
+
+      /* write special registers. */
+
+      for (regno = FIRST_UISA_SP_REGNUM; regno <= LAST_UISA_SP_REGNUM; regno++)
+	store_register (regno);
+    }
+}
+
+/* Store in *TO the 32-bit word at 32-bit-aligned ADDR in the child
+   process, which is 64-bit if ARCH64 and 32-bit otherwise.  Return
+   success. */
+
+static int
+read_word (CORE_ADDR from, int *to, int arch64)
+{
+  /* Retrieved values may be -1, so infer errors from errno. */
+  errno = 0;
+
+  if (arch64)
+    *to = ptrace64 (PT_READ_I, inferior_pid, from, 0, NULL);
+  else
+    *to = ptrace32 (PT_READ_I, inferior_pid, (int *)(long) from, 0, NULL);
+
+  return !errno;
+}
+
+/* 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.
+
+   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, struct target_ops *target)
+{
+  /* Round starting address down to 32-bit word boundary. */
+  int mask = sizeof (int) - 1;
+  CORE_ADDR addr = memaddr & ~(CORE_ADDR)mask;
+
+  /* Round ending address up to 32-bit word boundary. */
+  int count = ((memaddr + len - addr + mask) & ~(CORE_ADDR)mask)
+    / sizeof (int);
+
+  /* Allocate word transfer buffer. */
+  int *buf = (int *) alloca (count * sizeof (int));
+
+  int arch64 = ARCH64 ();
+  int i;
+
+  if (!write)
+    {
+      /* Retrieve memory a word at a time. */
+      for (i = 0; i < count; i++, addr += sizeof (int))
+	{
+	  if (!read_word (addr, buf + i, arch64))
+	    return 0;
+	  QUIT;
+	}
+
+      /* Copy memory to supplied buffer. */
+      addr -= count * sizeof (int);
+      memcpy (myaddr, (char *)buf + (memaddr - addr), len);
+    }
+  else
+    {
+      /* Fetch leading memory needed for alignment. */
+      if (addr < memaddr)
+	if (!read_word (addr, buf, arch64))
+	  return 0;
+
+      /* Fetch trailing memory needed for alignment. */
+      if (addr + count * sizeof (int) > memaddr + len)
+	if (!read_word (addr, buf + count - 1, arch64))
+	  return 0;
+
+      /* Copy supplied data into memory buffer. */
+      memcpy ((char *)buf + (memaddr - addr), myaddr, len);
+
+      /* Store memory one word at a time. */
+      for (i = 0, errno = 0; i < count; i++, addr += sizeof (int))
+	{
+	  if (arch64)
+	    ptrace64 (PT_WRITE_D, inferior_pid, addr, buf[i], NULL);
+	  else
+	    ptrace32 (PT_WRITE_D, inferior_pid, (int *)(long) addr,
+		      buf[i], NULL);
+
+	  if (errno)
+	    return 0;
+	  QUIT;
+	}
+    }
+
+  return len;
+}
+
 /* Execute one dummy breakpoint instruction.  This way we give the kernel
    a chance to do some housekeeping and update inferior's internal data,
    including u_area. */
 
 static void
-exec_one_dummy_insn ()
+exec_one_dummy_insn (void)
 {
 #define	DUMMY_INSN_ADDR	(TEXT_SEGMENT_BASE)+0x200
 
   char shadow_contents[BREAKPOINT_MAX];		/* Stash old bkpt addr contents */
-  int status, pid;
+  int ret, status, pid;
   CORE_ADDR prev_pc;
 
   /* We plant one dummy breakpoint into DUMMY_INSN_ADDR address. We
@@ -264,8 +471,6 @@
 
   target_insert_breakpoint (DUMMY_INSN_ADDR, shadow_contents);
 
-  errno = 0;
-
   /* You might think this could be done with a single ptrace call, and
      you'd be correct for just about every platform I've ever worked
      on.  However, rs6000-ibm-aix4.1.3 seems to have screwed this up --
@@ -273,9 +478,12 @@
      powerpc-ibm-aix4.1.3 works correctly).  */
   prev_pc = read_pc ();
   write_pc (DUMMY_INSN_ADDR);
-  ptrace (PT_CONTINUE, inferior_pid, (PTRACE_ARG3_TYPE) 1, 0, 0);
+  if (ARCH64 ())
+    ret = ptrace64 (PT_CONTINUE, inferior_pid, 1, 0, NULL);
+  else
+    ret = ptrace32 (PT_CONTINUE, inferior_pid, (int *)1, 0, NULL);
 
-  if (errno)
+  if (ret != 0)
     perror ("pt_continue");
 
   do
@@ -288,45 +496,100 @@
   target_remove_breakpoint (DUMMY_INSN_ADDR, shadow_contents);
 }
 
-static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR reg_addr;	/* Unused in this version */
-{
-  /* fetch GPRs and special registers from the first register section
-     in core bfd. */
-  if (which == 0)
-    {
-      /* copy GPRs first. */
-      memcpy (registers, core_reg_sect, 32 * 4);
+/* Fetch registers from the register section in core bfd. */
 
-      /* gdb's internal register template and bfd's register section layout
-         should share a common include file. FIXMEmgo */
-      /* then comes special registes. They are supposed to be in the same
-         order in gdb template and bfd `.reg' section. */
-      core_reg_sect += (32 * 4);
-      memcpy (&registers[REGISTER_BYTE (FIRST_UISA_SP_REGNUM)],
-	      core_reg_sect,
-	      (LAST_UISA_SP_REGNUM - FIRST_UISA_SP_REGNUM + 1) * 4);
+static void
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
+		      int which, CORE_ADDR reg_addr)
+{
+  CoreRegs *regs;
+  double *fprs;
+  int arch64, i, size;
+  void *gprs, *sprs[7];
+
+  if (which != 0)
+    {
+      fprintf_unfiltered
+	(gdb_stderr,
+	 "Gdb error: unknown parameter to fetch_core_registers().\n");
+      return;
     }
 
-  /* fetch floating point registers from register section 2 in core bfd. */
-  else if (which == 2)
-    memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], core_reg_sect, 32 * 8);
+  arch64 = ARCH64 ();
+  regs = (CoreRegs *) core_reg_sect;
 
+  /* Retrieve register pointers. */
+
+  if (arch64)
+    {
+      gprs = regs->r64.gpr;
+      fprs = regs->r64.fpr;
+      sprs[0] = &regs->r64.iar;
+      sprs[1] = &regs->r64.msr;
+      sprs[2] = &regs->r64.cr;
+      sprs[3] = &regs->r64.lr;
+      sprs[4] = &regs->r64.ctr;
+      sprs[5] = &regs->r64.xer;
+    }
   else
-    fprintf_unfiltered
-      (gdb_stderr,
-       "Gdb error: unknown parameter to fetch_core_registers().\n");
+    {
+      gprs = regs->r32.gpr;
+      fprs = regs->r32.fpr;
+      sprs[0] = &regs->r32.iar;
+      sprs[1] = &regs->r32.msr;
+      sprs[2] = &regs->r32.cr;
+      sprs[3] = &regs->r32.lr;
+      sprs[4] = &regs->r32.ctr;
+      sprs[5] = &regs->r32.xer;
+      sprs[6] = &regs->r32.mq;
+    }
+
+  /* Copy from pointers to registers[]. */
+
+  memcpy (registers, gprs, 32 * (arch64 ? 8 : 4));
+  memcpy (registers + REGISTER_BYTE (FP0_REGNUM), fprs, 32 * 8);
+  for (i = FIRST_UISA_SP_REGNUM; i <= LAST_UISA_SP_REGNUM; i++)
+    {
+      size = REGISTER_RAW_SIZE (i);
+      if (size)
+	memcpy (registers + REGISTER_BYTE (i),
+		sprs[i - FIRST_UISA_SP_REGNUM], size);
+    }
 }
 
+
+/* Copy information about text and data sections from LDI to VP for a 64-bit
+   process if ARCH64 and for a 32-bit process otherwise. */
+
+static void
+vmap_secs (struct vmap *vp, LdInfo *ldi, int arch64)
+{
+  if (arch64)
+    {
+      vp->tstart = (CORE_ADDR) ldi->l64.ldinfo_textorg;
+      vp->tend = vp->tstart + ldi->l64.ldinfo_textsize;
+      vp->dstart = (CORE_ADDR) ldi->l64.ldinfo_dataorg;
+      vp->dend = vp->dstart + ldi->l64.ldinfo_datasize;
+    }
+  else
+    {
+      vp->tstart = (unsigned long) ldi->l32.ldinfo_textorg;
+      vp->tend = vp->tstart + ldi->l32.ldinfo_textsize;
+      vp->dstart = (unsigned long) ldi->l32.ldinfo_dataorg;
+      vp->dend = vp->dstart + ldi->l32.ldinfo_datasize;
+    }
+
+  /* The run time loader maps the file header in addition to the text
+     section and returns a pointer to the header in ldinfo_textorg.
+     Adjust the text start address to point to the real start address
+     of the text section.  */
+  vp->tstart += vp->toffs;
+}
+
 /* handle symbol translation on vmapping */
 
 static void
-vmap_symtab (vp)
-     register struct vmap *vp;
+vmap_symtab (struct vmap *vp)
 {
   register struct objfile *objfile;
   struct section_offsets *new_offsets;
@@ -342,17 +605,20 @@
 	return;
       objfile = symfile_objfile;
     }
+  else if (!vp->loaded)
+    /* If symbols are not yet loaded, offsets are not yet valid. */
+    return;
 
   new_offsets = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
 
   for (i = 0; i < objfile->num_sections; ++i)
-    ANOFFSET (new_offsets, i) = ANOFFSET (objfile->section_offsets, i);
+    new_offsets->offsets[i] = ANOFFSET (objfile->section_offsets, i);
 
   /* The symbols in the object file are linked to the VMA of the section,
      relocate them VMA relative.  */
-  ANOFFSET (new_offsets, SECT_OFF_TEXT (objfile)) = vp->tstart - vp->tvma;
-  ANOFFSET (new_offsets, SECT_OFF_DATA (objfile)) = vp->dstart - vp->dvma;
-  ANOFFSET (new_offsets, SECT_OFF_BSS (objfile)) = vp->dstart - vp->dvma;
+  new_offsets->offsets[SECT_OFF_TEXT (objfile)] = vp->tstart - vp->tvma;
+  new_offsets->offsets[SECT_OFF_DATA (objfile)] = vp->dstart - vp->dvma;
+  new_offsets->offsets[SECT_OFF_BSS (objfile)] = vp->dstart - vp->dvma;
 
   objfile_relocate (objfile, new_offsets);
 }
@@ -360,8 +626,7 @@
 /* Add symbols for an objfile.  */
 
 static int
-objfile_symbol_add (arg)
-     char *arg;
+objfile_symbol_add (void *arg)
 {
   struct objfile *obj = (struct objfile *) arg;
 
@@ -370,6 +635,23 @@
   return 1;
 }
 
+/* Add symbols for a vmap. Return zero upon error.  */
+
+int
+vmap_add_symbols (struct vmap *vp)
+{
+  if (catch_errors (objfile_symbol_add, vp->objfile,
+		    "Error while reading shared library symbols:\n",
+		    RETURN_MASK_ALL))
+    {
+      /* Note this is only done if symbol reading was successful.  */
+      vp->loaded = 1;
+      vmap_symtab (vp);
+      return 1;
+    }
+  return 0;
+}
+
 /* Add a new vmap entry based on ldinfo() information.
 
    If ldi->ldinfo_fd is not valid (e.g. this struct ld_info is from a
@@ -378,31 +660,37 @@
    Return the vmap new entry.  */
 
 static struct vmap *
-add_vmap (ldi)
-     register struct ld_info *ldi;
+add_vmap (LdInfo *ldi)
 {
   bfd *abfd, *last;
-  register char *mem, *objname;
+  register char *mem, *objname, *filename;
   struct objfile *obj;
   struct vmap *vp;
+  int fd;
+  ARCH64_DECL (arch64);
 
   /* This ldi structure was allocated using alloca() in 
      xcoff_relocate_symtab(). Now we need to have persistent object 
      and member names, so we should save them. */
 
-  mem = ldi->ldinfo_filename + strlen (ldi->ldinfo_filename) + 1;
+  filename = LDI_FILENAME (ldi, arch64);
+  mem = filename + strlen (filename) + 1;
   mem = savestring (mem, strlen (mem));
-  objname = savestring (ldi->ldinfo_filename, strlen (ldi->ldinfo_filename));
+  objname = savestring (filename, strlen (filename));
 
-  if (ldi->ldinfo_fd < 0)
+  fd = LDI_FD (ldi, arch64);
+  if (fd < 0)
     /* Note that this opens it once for every member; a possible
        enhancement would be to only open it once for every object.  */
     abfd = bfd_openr (objname, gnutarget);
   else
-    abfd = bfd_fdopenr (objname, gnutarget, ldi->ldinfo_fd);
+    abfd = bfd_fdopenr (objname, gnutarget, fd);
   if (!abfd)
-    error ("Could not open `%s' as an executable file: %s",
-	   objname, bfd_errmsg (bfd_get_error ()));
+    {
+      warning ("Could not open `%s' as an executable file: %s",
+	       objname, bfd_errmsg (bfd_get_error ()));
+      return NULL;
+    }
 
   /* make sure we have an object file */
 
@@ -419,41 +707,35 @@
 
       if (!last)
 	{
+	  warning ("\"%s\": member \"%s\" missing.", objname, mem);
 	  bfd_close (abfd);
-	  /* FIXME -- should be error */
-	  warning ("\"%s\": member \"%s\" missing.", abfd->filename, mem);
-	  return 0;
+	  return NULL;
 	}
 
       if (!bfd_check_format (last, bfd_object))
 	{
-	  bfd_close (last);	/* XXX???       */
-	  goto obj_err;
+	  warning ("\"%s\": member \"%s\" not in executable format: %s.",
+		   objname, mem, bfd_errmsg (bfd_get_error ()));
+	  bfd_close (last);
+	  bfd_close (abfd);
+	  return NULL;
 	}
 
       vp = map_vmap (last, abfd);
     }
   else
     {
-    obj_err:
+      warning ("\"%s\": not in executable format: %s.",
+	       objname, bfd_errmsg (bfd_get_error ()));
       bfd_close (abfd);
-      error ("\"%s\": not in executable format: %s.",
-	     objname, bfd_errmsg (bfd_get_error ()));
-      /*NOTREACHED */
+      return NULL;
     }
   obj = allocate_objfile (vp->bfd, 0);
   vp->objfile = obj;
 
-#ifndef SOLIB_SYMBOLS_MANUAL
-  if (catch_errors (objfile_symbol_add, (char *) obj,
-		    "Error while reading shared library symbols:\n",
-		    RETURN_MASK_ALL))
-    {
-      /* Note this is only done if symbol reading was successful.  */
-      vmap_symtab (vp);
-      vp->loaded = 1;
-    }
-#endif
+  /* Always add symbols for the main objfile.  */
+  if (vp == vmap || auto_solib_add)
+    vmap_add_symbols (vp);
   return vp;
 }
 
@@ -461,13 +743,14 @@
    Input is ptr to ldinfo() results.  */
 
 static void
-vmap_ldinfo (ldi)
-     register struct ld_info *ldi;
+vmap_ldinfo (LdInfo *ldi)
 {
   struct stat ii, vi;
   register struct vmap *vp;
   int got_one, retried;
   int got_exec_file = 0;
+  uint next;
+  int arch64 = ARCH64 ();
 
   /* For each *ldi, see if we have a corresponding *vp.
      If so, update the mapping, and symbol table.
@@ -475,18 +758,19 @@
 
   do
     {
-      char *name = ldi->ldinfo_filename;
+      char *name = LDI_FILENAME (ldi, arch64);
       char *memb = name + strlen (name) + 1;
+      int fd = LDI_FD (ldi, arch64);
 
       retried = 0;
 
-      if (fstat (ldi->ldinfo_fd, &ii) < 0)
+      if (fstat (fd, &ii) < 0)
 	{
 	  /* The kernel sets ld_info to -1, if the process is still using the
 	     object, and the object is removed. Keep the symbol info for the
 	     removed object and issue a warning.  */
 	  warning ("%s (fd=%d) has disappeared, keeping its symbols",
-		   name, ldi->ldinfo_fd);
+		   name, fd);
 	  continue;
 	}
     retry:
@@ -522,23 +806,13 @@
 	    continue;
 
 	  if (!retried)
-	    close (ldi->ldinfo_fd);
+	    close (fd);
 
 	  ++got_one;
 
 	  /* Found a corresponding VMAP.  Remap!  */
 
-	  /* We can assume pointer == CORE_ADDR, this code is native only.  */
-	  vp->tstart = (CORE_ADDR) ldi->ldinfo_textorg;
-	  vp->tend = vp->tstart + ldi->ldinfo_textsize;
-	  vp->dstart = (CORE_ADDR) ldi->ldinfo_dataorg;
-	  vp->dend = vp->dstart + ldi->ldinfo_datasize;
-
-	  /* The run time loader maps the file header in addition to the text
-	     section and returns a pointer to the header in ldinfo_textorg.
-	     Adjust the text start address to point to the real start address
-	     of the text section.  */
-	  vp->tstart += vp->toffs;
+	  vmap_secs (vp, ldi, arch64);
 
 	  /* The objfile is only NULL for the exec file.  */
 	  if (vp->objfile == NULL)
@@ -558,8 +832,8 @@
 	  goto retry;
 	}
     }
-  while (ldi->ldinfo_next
-	 && (ldi = (void *) (ldi->ldinfo_next + (char *) ldi)));
+  while ((next = LDI_NEXT (ldi, arch64))
+	 && (ldi = (void *) (next + (char *) ldi)));
 
   /* If we don't find the symfile_objfile anywhere in the ldinfo, it
      is unlikely that the symbol file is relocated to the proper
@@ -592,7 +866,7 @@
  */
 
 static void
-vmap_exec ()
+vmap_exec (void)
 {
   static bfd *execbfd;
   int i;
@@ -624,32 +898,71 @@
 	}
     }
 }
+
+/* Set the current architecture from the host running GDB.  Called when
+   starting a child process. */
+
+static void
+set_host_arch (int pid)
+{
+  enum bfd_architecture arch;
+  unsigned long mach;
+  bfd abfd;
+  struct gdbarch_info info;
+
+  if (__power_rs ())
+    {
+      arch = bfd_arch_rs6000;
+      mach = bfd_mach_rs6k;
+    }
+  else
+    {
+      arch = bfd_arch_powerpc;
+      mach = bfd_mach_ppc;
+    }
+  bfd_default_set_arch_mach (&abfd, arch, mach);
+
+  memset (&info, 0, sizeof info);
+  info.bfd_arch_info = bfd_get_arch_info (&abfd);
+
+  if (!gdbarch_update_p (info))
+    {
+      internal_error ("set_host_arch: failed to select architecture");
+    }
+}
+
 
 /* xcoff_relocate_symtab -      hook for symbol table relocation.
    also reads shared libraries.. */
 
 void
-xcoff_relocate_symtab (pid)
-     unsigned int pid;
+xcoff_relocate_symtab (unsigned int pid)
 {
   int load_segs = 64; /* number of load segments */
   int rc;
-  struct ld_info *ldi = NULL;
+  LdInfo *ldi = NULL;
+  int arch64 = ARCH64 ();
+  int ldisize = arch64 ? sizeof (ldi->l64) : sizeof (ldi->l32);
+  int size;
 
   do
     {
-      ldi = (void *) xrealloc (ldi, load_segs * sizeof (*ldi));
+      size = load_segs * ldisize;
+      ldi = (void *) xrealloc (ldi, size);
 
+#if 0
       /* According to my humble theory, AIX has some timing problems and
          when the user stack grows, kernel doesn't update stack info in time
          and ptrace calls step on user stack. That is why we sleep here a
          little, and give kernel to update its internals. */
-
       usleep (36000);
+#endif
 
-      errno = 0;
-      rc = ptrace (PT_LDINFO, pid, (PTRACE_ARG3_TYPE) ldi,
-                  load_segs * sizeof (*ldi), (int *) ldi);
+      if (arch64)
+	rc = ptrace64 (PT_LDINFO, pid, (unsigned long) ldi, size, NULL);
+      else
+	rc = ptrace32 (PT_LDINFO, pid, (int *) ldi, size, NULL);
+
       if (rc == -1)
         {
           if (errno == ENOMEM)
@@ -664,7 +977,7 @@
 	}
     } while (rc == -1);
   if (ldi)
-    free (ldi);
+    xfree (ldi);
 }
 
 /* Core file stuff.  */
@@ -673,33 +986,22 @@
    from the core file.  */
 
 void
-xcoff_relocate_core (target)
-     struct target_ops *target;
+xcoff_relocate_core (struct target_ops *target)
 {
-/* Offset of member MEMBER in a struct of type TYPE.  */
-#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
-#endif
-
-/* Size of a struct ld_info except for the variable-length filename.  */
-#define LDINFO_SIZE (offsetof (struct ld_info, ldinfo_filename))
-
   sec_ptr ldinfo_sec;
   int offset = 0;
-  struct ld_info *ldip;
+  LdInfo *ldi;
   struct vmap *vp;
+  int arch64 = ARCH64 ();
+
+  /* Size of a struct ld_info except for the variable-length filename. */
+  int nonfilesz = (int)LDI_FILENAME ((LdInfo *)0, arch64);
 
   /* Allocated size of buffer.  */
-  int buffer_size = LDINFO_SIZE;
+  int buffer_size = nonfilesz;
   char *buffer = xmalloc (buffer_size);
   struct cleanup *old = make_cleanup (free_current_contents, &buffer);
 
-  /* FIXME, this restriction should not exist.  For now, though I'll
-     avoid coredumps with error() pending a real fix.  */
-  if (vmap == NULL)
-    error
-      ("Can't debug a core file without an executable file (on the RS/6000)");
-
   ldinfo_sec = bfd_get_section_by_name (core_bfd, ".ldinfo");
   if (ldinfo_sec == NULL)
     {
@@ -716,11 +1018,11 @@
 
       /* Read in everything but the name.  */
       if (bfd_get_section_contents (core_bfd, ldinfo_sec, buffer,
-				    offset, LDINFO_SIZE) == 0)
+				    offset, nonfilesz) == 0)
 	goto bfd_err;
 
       /* Now the name.  */
-      i = LDINFO_SIZE;
+      i = nonfilesz;
       do
 	{
 	  if (i == buffer_size)
@@ -736,30 +1038,26 @@
 	}
       while (names_found < 2);
 
-      ldip = (struct ld_info *) buffer;
+      ldi = (LdInfo *) buffer;
 
       /* Can't use a file descriptor from the core file; need to open it.  */
-      ldip->ldinfo_fd = -1;
+      if (arch64)
+	ldi->l64.ldinfo_fd = -1;
+      else
+	ldi->l32.ldinfo_fd = -1;
 
       /* The first ldinfo is for the exec file, allocated elsewhere.  */
-      if (offset == 0)
+      if (offset == 0 && vmap != NULL)
 	vp = vmap;
       else
-	vp = add_vmap (ldip);
+	vp = add_vmap (ldi);
 
-      offset += ldip->ldinfo_next;
+      /* Process next shared library upon error. */
+      offset += LDI_NEXT (ldi, arch64);
+      if (vp == NULL)
+	continue;
 
-      /* We can assume pointer == CORE_ADDR, this code is native only.  */
-      vp->tstart = (CORE_ADDR) ldip->ldinfo_textorg;
-      vp->tend = vp->tstart + ldip->ldinfo_textsize;
-      vp->dstart = (CORE_ADDR) ldip->ldinfo_dataorg;
-      vp->dend = vp->dstart + ldip->ldinfo_datasize;
-
-      /* The run time loader maps the file header in addition to the text
-         section and returns a pointer to the header in ldinfo_textorg.
-         Adjust the text start address to point to the real start address
-         of the text section.  */
-      vp->tstart += vp->toffs;
+      vmap_secs (vp, ldi, arch64);
 
       /* Unless this is the exec file,
          add our sections to the section table for the core target.  */
@@ -784,14 +1082,14 @@
 
       vmap_symtab (vp);
     }
-  while (ldip->ldinfo_next != 0);
+  while (LDI_NEXT (ldi, arch64) != 0);
   vmap_exec ();
   breakpoint_re_set ();
   do_cleanups (old);
 }
 
 int
-kernel_u_size ()
+kernel_u_size (void)
 {
   return (sizeof (struct user));
 }
@@ -802,10 +1100,10 @@
    and add the current load address of the data segment from the vmap.  */
 
 static CORE_ADDR
-find_toc_address (pc)
-     CORE_ADDR pc;
+find_toc_address (CORE_ADDR pc)
 {
   struct vmap *vp;
+  extern CORE_ADDR get_toc_offset (struct objfile *);	/* xcoffread.c */
 
   for (vp = vmap; vp; vp = vp->nxt)
     {
@@ -824,7 +1122,7 @@
 
 static struct core_fns rs6000_core_fns =
 {
-  bfd_target_coff_flavour,		/* core_flavour */
+  bfd_target_xcoff_flavour,		/* core_flavour */
   default_check_format,			/* check_format */
   default_core_sniffer,			/* core_sniffer */
   fetch_core_registers,			/* core_read_registers */
@@ -832,15 +1130,15 @@
 };
 
 void
-_initialize_core_rs6000 ()
+_initialize_core_rs6000 (void)
 {
   /* Initialize hook in rs6000-tdep.c for determining the TOC address when
      calling functions in the inferior.  */
-  find_toc_address_hook = &find_toc_address;
+  rs6000_find_toc_address_hook = find_toc_address;
 
-  /* For native configurations, where this module is included, inform
-     the xcoffsolib module where it can find the function for symbol table
-     relocation at runtime. */
-  xcoff_relocate_symtab_hook = &xcoff_relocate_symtab;
+  /* Initialize hook in rs6000-tdep.c to set the current architecture when
+     starting a child process. */
+  rs6000_set_host_arch_hook = set_host_arch;
+
   add_core_fns (&rs6000_core_fns);
 }
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index eeadae5..efdff36 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -28,9 +28,68 @@
 #include "gdbcmd.h"
 #include "symfile.h"
 #include "objfiles.h"
-#include "xcoffsolib.h"
+#include "arch-utils.h"
 
-extern int errno;
+#include "bfd/libbfd.h"		/* for bfd_default_set_arch_mach */
+#include "coff/internal.h"	/* for libcoff.h */
+#include "bfd/libcoff.h"	/* for xcoff_data */
+
+#include "elf-bfd.h"
+
+#include "ppc-tdep.h"
+
+/* If the kernel has to deliver a signal, it pushes a sigcontext
+   structure on the stack and then calls the signal handler, passing
+   the address of the sigcontext in an argument register. Usually
+   the signal handler doesn't save this register, so we have to
+   access the sigcontext structure via an offset from the signal handler
+   frame.
+   The following constants were determined by experimentation on AIX 3.2.  */
+#define SIG_FRAME_PC_OFFSET 96
+#define SIG_FRAME_LR_OFFSET 108
+#define SIG_FRAME_FP_OFFSET 284
+
+/* To be used by skip_prologue. */
+
+struct rs6000_framedata
+  {
+    int offset;			/* total size of frame --- the distance
+				   by which we decrement sp to allocate
+				   the frame */
+    int saved_gpr;		/* smallest # of saved gpr */
+    int saved_fpr;		/* smallest # of saved fpr */
+    int alloca_reg;		/* alloca register number (frame ptr) */
+    char frameless;		/* true if frameless functions. */
+    char nosavedpc;		/* true if pc not saved. */
+    int gpr_offset;		/* offset of saved gprs from prev sp */
+    int fpr_offset;		/* offset of saved fprs from prev sp */
+    int lr_offset;		/* offset of saved lr */
+    int cr_offset;		/* offset of saved cr */
+  };
+
+/* Description of a single register. */
+
+struct reg
+  {
+    char *name;			/* name of register */
+    unsigned char sz32;		/* size on 32-bit arch, 0 if nonextant */
+    unsigned char sz64;		/* size on 64-bit arch, 0 if nonextant */
+    unsigned char fpr;		/* whether register is floating-point */
+  };
+
+/* Private data that this module attaches to struct gdbarch. */
+
+struct gdbarch_tdep
+  {
+    int wordsize;		/* size in bytes of fixed-point word */
+    int osabi;			/* OS / ABI from ELF header */
+    int *regoff;		/* byte offsets in register arrays */
+    const struct reg *regs;	/* from current variant */
+  };
+
+/* Return the current architecture's gdbarch_tdep structure. */
+
+#define TDEP	gdbarch_tdep (current_gdbarch)
 
 /* Breakpoint shadows for the single step instructions will be kept here. */
 
@@ -47,26 +106,36 @@
    inferior under AIX. The initialization code in rs6000-nat.c sets
    this hook to point to find_toc_address.  */
 
-CORE_ADDR (*find_toc_address_hook) (CORE_ADDR) = NULL;
+CORE_ADDR (*rs6000_find_toc_address_hook) (CORE_ADDR) = NULL;
+
+/* Hook to set the current architecture when starting a child process. 
+   rs6000-nat.c sets this. */
+
+void (*rs6000_set_host_arch_hook) (int) = NULL;
 
 /* Static function prototypes */
 
 static CORE_ADDR branch_dest (int opcode, int instr, CORE_ADDR pc,
 			      CORE_ADDR safety);
-
-static void frame_get_saved_regs (struct frame_info *fi,
-				  struct rs6000_framedata *fdatap);
-
-static void pop_dummy_frame (void);
-
+static CORE_ADDR skip_prologue (CORE_ADDR, CORE_ADDR,
+                                struct rs6000_framedata *);
+static void frame_get_saved_regs (struct frame_info * fi,
+				  struct rs6000_framedata * fdatap);
 static CORE_ADDR frame_initial_stack_address (struct frame_info *);
 
-CORE_ADDR
-rs6000_skip_prologue (pc)
-     CORE_ADDR pc;
+/* Read a LEN-byte address from debugged memory address MEMADDR. */
+
+static CORE_ADDR
+read_memory_addr (CORE_ADDR memaddr, int len)
+{
+  return read_memory_unsigned_integer (memaddr, len);
+}
+
+static CORE_ADDR
+rs6000_skip_prologue (CORE_ADDR pc)
 {
   struct rs6000_framedata frame;
-  pc = skip_prologue (pc, &frame);
+  pc = skip_prologue (pc, 0, &frame);
   return pc;
 }
 
@@ -84,9 +153,7 @@
 };
 
 void
-rs6000_init_extra_frame_info (fromleaf, fi)
-     int fromleaf;
-     struct frame_info *fi;
+rs6000_init_extra_frame_info (int fromleaf, struct frame_info *fi)
 {
   fi->extra_info = (struct frame_extra_info *)
     frame_obstack_alloc (sizeof (struct frame_extra_info));
@@ -100,17 +167,24 @@
     fi->signal_handler_caller = 1;
 }
 
+/* Put here the code to store, into a struct frame_saved_regs,
+   the addresses of 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.  */
+
+/* In this implementation for RS/6000, we do *not* save sp. I am
+   not sure if it will be needed. The following function takes care of gpr's
+   and fpr's only. */
 
 void
-rs6000_frame_init_saved_regs (fi)
-     struct frame_info *fi;
+rs6000_frame_init_saved_regs (struct frame_info *fi)
 {
   frame_get_saved_regs (fi, NULL);
 }
 
-CORE_ADDR
-rs6000_frame_args_address (fi)
-     struct frame_info *fi;
+static CORE_ADDR
+rs6000_frame_args_address (struct frame_info *fi)
 {
   if (fi->extra_info->initial_sp != 0)
     return fi->extra_info->initial_sp;
@@ -118,15 +192,21 @@
     return frame_initial_stack_address (fi);
 }
 
+/* Immediately after a function call, return the saved pc.
+   Can't go through the frames for this because on some machines
+   the new frame is not set up until the new function executes
+   some instructions.  */
+
+static CORE_ADDR
+rs6000_saved_pc_after_call (struct frame_info *fi)
+{
+  return read_register (PPC_LR_REGNUM);
+}
 
 /* Calculate the destination of a branch/jump.  Return -1 if not a branch.  */
 
 static CORE_ADDR
-branch_dest (opcode, instr, pc, safety)
-     int opcode;
-     int instr;
-     CORE_ADDR pc;
-     CORE_ADDR safety;
+branch_dest (int opcode, int instr, CORE_ADDR pc, CORE_ADDR safety)
 {
   CORE_ADDR dest;
   int immediate;
@@ -158,7 +238,7 @@
 
       if (ext_op == 16)		/* br conditional register */
 	{
-	  dest = read_register (LR_REGNUM) & ~3;
+	  dest = read_register (PPC_LR_REGNUM) & ~3;
 
 	  /* If we are about to return from a signal handler, dest is
 	     something like 0x3c90.  The current frame is a signal handler
@@ -170,20 +250,20 @@
 
 	      fi = get_current_frame ();
 	      if (fi != NULL)
-		dest = read_memory_integer (fi->frame + SIG_FRAME_PC_OFFSET,
-					    4);
+		dest = read_memory_addr (fi->frame + SIG_FRAME_PC_OFFSET,
+					 TDEP->wordsize);
 	    }
 	}
 
       else if (ext_op == 528)	/* br cond to count reg */
 	{
-	  dest = read_register (CTR_REGNUM) & ~3;
+	  dest = read_register (PPC_CTR_REGNUM) & ~3;
 
 	  /* If we are about to execute a system call, dest is something
 	     like 0x22fc or 0x3b00.  Upon completion the system call
 	     will return to the address in the link register.  */
 	  if (dest < TEXT_SEGMENT_BASE)
-	    dest = read_register (LR_REGNUM) & ~3;
+	    dest = read_register (PPC_LR_REGNUM) & ~3;
 	}
       else
 	return -1;
@@ -201,10 +281,8 @@
 #define BIG_BREAKPOINT { 0x7d, 0x82, 0x10, 0x08 }
 #define LITTLE_BREAKPOINT { 0x08, 0x10, 0x82, 0x7d }
 
-unsigned char *
-rs6000_breakpoint_from_pc (bp_addr, bp_size)
-     CORE_ADDR *bp_addr;
-     int *bp_size;
+static unsigned char *
+rs6000_breakpoint_from_pc (CORE_ADDR *bp_addr, int *bp_size)
 {
   static unsigned char big_breakpoint[] = BIG_BREAKPOINT;
   static unsigned char little_breakpoint[] = LITTLE_BREAKPOINT;
@@ -219,9 +297,7 @@
 /* AIX does not support PT_STEP. Simulate it. */
 
 void
-rs6000_software_single_step (signal, insert_breakpoints_p)
-     unsigned int signal;
-     int insert_breakpoints_p;
+rs6000_software_single_step (unsigned int signal, int insert_breakpoints_p)
 {
 #define	INSNLEN(OPCODE)	 4
 
@@ -304,11 +380,63 @@
 
 #define GET_SRC_REG(x) (((x) >> 21) & 0x1f)
 
-CORE_ADDR
-skip_prologue (CORE_ADDR pc, struct rs6000_framedata *fdata)
+/* Limit the number of skipped non-prologue instructions, as the examining
+   of the prologue is expensive.  */
+static int max_skip_non_prologue_insns = 10;
+
+/* Given PC representing the starting address of a function, and
+   LIM_PC which is the (sloppy) limit to which to scan when looking
+   for a prologue, attempt to further refine this limit by using
+   the line data in the symbol table.  If successful, a better guess
+   on where the prologue ends is returned, otherwise the previous
+   value of lim_pc is returned.  */
+static CORE_ADDR
+refine_prologue_limit (CORE_ADDR pc, CORE_ADDR lim_pc)
+{
+  struct symtab_and_line prologue_sal;
+
+  prologue_sal = find_pc_line (pc, 0);
+  if (prologue_sal.line != 0)
+    {
+      int i;
+      CORE_ADDR addr = prologue_sal.end;
+
+      /* Handle the case in which compiler's optimizer/scheduler
+         has moved instructions into the prologue.  We scan ahead
+	 in the function looking for address ranges whose corresponding
+	 line number is less than or equal to the first one that we
+	 found for the function.  (It can be less than when the
+	 scheduler puts a body instruction before the first prologue
+	 instruction.)  */
+      for (i = 2 * max_skip_non_prologue_insns; 
+           i > 0 && (lim_pc == 0 || addr < lim_pc);
+	   i--)
+        {
+	  struct symtab_and_line sal;
+
+	  sal = find_pc_line (addr, 0);
+	  if (sal.line == 0)
+	    break;
+	  if (sal.line <= prologue_sal.line 
+	      && sal.symtab == prologue_sal.symtab)
+	    {
+	      prologue_sal = sal;
+	    }
+	  addr = sal.end;
+	}
+
+      if (lim_pc == 0 || prologue_sal.end < lim_pc)
+	lim_pc = prologue_sal.end;
+    }
+  return lim_pc;
+}
+
+
+static CORE_ADDR
+skip_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct rs6000_framedata *fdata)
 {
   CORE_ADDR orig_pc = pc;
-  CORE_ADDR last_prologue_pc;
+  CORE_ADDR last_prologue_pc = pc;
   char buf[4];
   unsigned long op;
   long offset = 0;
@@ -318,6 +446,22 @@
   int framep = 0;
   int minimal_toc_loaded = 0;
   int prev_insn_was_prologue_insn = 1;
+  int num_skip_non_prologue_insns = 0;
+
+  /* Attempt to find the end of the prologue when no limit is specified.
+     Note that refine_prologue_limit() has been written so that it may
+     be used to "refine" the limits of non-zero PC values too, but this
+     is only safe if we 1) trust the line information provided by the
+     compiler and 2) iterate enough to actually find the end of the
+     prologue.  
+     
+     It may become a good idea at some point (for both performance and
+     accuracy) to unconditionally call refine_prologue_limit().  But,
+     until we can make a clear determination that this is beneficial,
+     we'll play it safe and only use it to obtain a limit when none
+     has been specified.  */
+  if (lim_pc == 0)
+    lim_pc = refine_prologue_limit (pc, lim_pc);
 
   memset (fdata, 0, sizeof (struct rs6000_framedata));
   fdata->saved_gpr = -1;
@@ -326,19 +470,22 @@
   fdata->frameless = 1;
   fdata->nosavedpc = 1;
 
-  pc -= 4;
-  for (;;)
+  for (;; pc += 4)
     {
-      pc += 4;
-
       /* Sometimes it isn't clear if an instruction is a prologue
          instruction or not.  When we encounter one of these ambiguous
 	 cases, we'll set prev_insn_was_prologue_insn to 0 (false).
 	 Otherwise, we'll assume that it really is a prologue instruction. */
       if (prev_insn_was_prologue_insn)
 	last_prologue_pc = pc;
+
+      /* Stop scanning if we've hit the limit.  */
+      if (lim_pc != 0 && pc >= lim_pc)
+	break;
+
       prev_insn_was_prologue_insn = 1;
 
+      /* Fetch the instruction and convert it to an integer.  */
       if (target_read_memory (pc, buf, 4))
 	break;
       op = extract_signed_integer (buf, 4);
@@ -367,15 +514,17 @@
 
 	}
       else if (((op & 0xfc1f0000) == 0xbc010000) ||	/* stm Rx, NUM(r1) */
-	       ((op & 0xfc1f0000) == 0x90010000 &&	/* st rx,NUM(r1), 
-							   rx >= r13 */
-		(op & 0x03e00000) >= 0x01a00000))
+	       (((op & 0xfc1f0000) == 0x90010000 ||	/* st rx,NUM(r1) */
+		 (op & 0xfc1f0003) == 0xf8010000) &&	/* std rx,NUM(r1) */
+		(op & 0x03e00000) >= 0x01a00000))	/* rx >= r13 */
 	{
 
 	  reg = GET_SRC_REG (op);
 	  if (fdata->saved_gpr == -1 || fdata->saved_gpr > reg)
 	    {
 	      fdata->saved_gpr = reg;
+	      if ((op & 0xfc1f0003) == 0xf8010000)
+		op = (op >> 1) << 1;
 	      fdata->gpr_offset = SIGNED_SHORT (op) + offset;
 	    }
 	  continue;
@@ -475,9 +624,12 @@
 
 	  /* update stack pointer */
 	}
-      else if ((op & 0xffff0000) == 0x94210000)
-	{			/* stu r1,NUM(r1) */
+      else if ((op & 0xffff0000) == 0x94210000 ||	/* stu r1,NUM(r1) */
+	       (op & 0xffff0003) == 0xf8210001)		/* stdu r1,NUM(r1) */
+	{
 	  fdata->frameless = 0;
+	  if ((op & 0xffff0003) == 0xf8210001)
+	    op = (op >> 1) << 1;
 	  fdata->offset = SIGNED_SHORT (op);
 	  offset = fdata->offset;
 	  continue;
@@ -510,9 +662,10 @@
 	  /* store parameters in stack */
 	}
       else if ((op & 0xfc1f0000) == 0x90010000 ||	/* st rx,NUM(r1) */
+	       (op & 0xfc1f0003) == 0xf8010000 ||	/* std rx,NUM(r1) */
 	       (op & 0xfc1f0000) == 0xd8010000 ||	/* stfd Rx,NUM(r1) */
-	       (op & 0xfc1f0000) == 0xfc010000)
-	{			/* frsp, fp?,NUM(r1) */
+	       (op & 0xfc1f0000) == 0xfc010000)		/* frsp, fp?,NUM(r1) */
+	{
 	  continue;
 
 	  /* store parameters in stack via frame pointer */
@@ -546,7 +699,31 @@
 	}
       else
 	{
-	  break;
+	  /* Not a recognized prologue instruction.
+	     Handle optimizer code motions into the prologue by continuing
+	     the search if we have no valid frame yet or if the return
+	     address is not yet saved in the frame.  */
+	  if (fdata->frameless == 0
+	      && (lr_reg == -1 || fdata->nosavedpc == 0))
+	    break;
+
+	  if (op == 0x4e800020		/* blr */
+	      || op == 0x4e800420)	/* bctr */
+	    /* Do not scan past epilogue in frameless functions or
+	       trampolines.  */
+	    break;
+	  if ((op & 0xf4000000) == 0x40000000) /* bxx */
+	    /* Never skip branches. */
+	    break;
+
+	  if (num_skip_non_prologue_insns++ > max_skip_non_prologue_insns)
+	    /* Do not scan too many insns, scanning insns is expensive with
+	       remote targets.  */
+	    break;
+
+	  /* Continue scanning.  */
+	  prev_insn_was_prologue_insn = 0;
+	  continue;
 	}
     }
 
@@ -589,209 +766,25 @@
   frames, etc. 
 *************************************************************************/
 
-/* The total size of dummy frame is 436, which is;
 
-   32 gpr's           - 128 bytes
-   32 fpr's           - 256 bytes
-   7  the rest        -  28 bytes
-   callee's link area -  24 bytes
-   padding            -  12 bytes
-
-   Note that the last 24 bytes for the link area might not be necessary,
-   since it will be taken care of by push_arguments(). */
-
-#define DUMMY_FRAME_SIZE 448
-
-#define	DUMMY_FRAME_ADDR_SIZE 10
-
-/* Make sure you initialize these in somewhere, in case gdb gives up what it
-   was debugging and starts debugging something else. FIXMEibm */
-
-static int dummy_frame_count = 0;
-static int dummy_frame_size = 0;
-static CORE_ADDR *dummy_frame_addr = 0;
-
-extern int stop_stack_dummy;
-
-/* push a dummy frame into stack, save all register. Currently we are saving
-   only gpr's and fpr's, which is not good enough! FIXMEmgo */
-
-void
-push_dummy_frame ()
-{
-  /* stack pointer.  */
-  CORE_ADDR sp;
-  /* Same thing, target byte order.  */
-  char sp_targ[4];
-
-  /* link register.  */
-  CORE_ADDR pc;
-  /* Same thing, target byte order.  */
-  char pc_targ[4];
-
-  /* Needed to figure out where to save the dummy link area.
-     FIXME: There should be an easier way to do this, no?  tiemann 9/9/95.  */
-  struct rs6000_framedata fdata;
-
-  int ii;
-
-  target_fetch_registers (-1);
-
-  if (dummy_frame_count >= dummy_frame_size)
-    {
-      dummy_frame_size += DUMMY_FRAME_ADDR_SIZE;
-      if (dummy_frame_addr)
-	dummy_frame_addr = (CORE_ADDR *) xrealloc
-	  (dummy_frame_addr, sizeof (CORE_ADDR) * (dummy_frame_size));
-      else
-	dummy_frame_addr = (CORE_ADDR *)
-	  xmalloc (sizeof (CORE_ADDR) * (dummy_frame_size));
-    }
-
-  sp = read_register (SP_REGNUM);
-  pc = read_register (PC_REGNUM);
-  store_address (pc_targ, 4, pc);
-
-  skip_prologue (get_pc_function_start (pc), &fdata);
-
-  dummy_frame_addr[dummy_frame_count++] = sp;
-
-  /* Be careful! If the stack pointer is not decremented first, then kernel 
-     thinks he is free to use the space underneath it. And kernel actually 
-     uses that area for IPC purposes when executing ptrace(2) calls. So 
-     before writing register values into the new frame, decrement and update
-     %sp first in order to secure your frame. */
-
-  /* FIXME: We don't check if the stack really has this much space.
-     This is a problem on the ppc simulator (which only grants one page
-     (4096 bytes) by default.  */
-
-  write_register (SP_REGNUM, sp - DUMMY_FRAME_SIZE);
-
-  /* gdb relies on the state of current_frame. We'd better update it,
-     otherwise things like do_registers_info() wouldn't work properly! */
-
-  flush_cached_frames ();
-
-  /* save program counter in link register's space. */
-  write_memory (sp + (fdata.lr_offset ? fdata.lr_offset : DEFAULT_LR_SAVE),
-		pc_targ, 4);
-
-  /* save all floating point and general purpose registers here. */
-
-  /* fpr's, f0..f31 */
-  for (ii = 0; ii < 32; ++ii)
-    write_memory (sp - 8 - (ii * 8), &registers[REGISTER_BYTE (31 - ii + FP0_REGNUM)], 8);
-
-  /* gpr's r0..r31 */
-  for (ii = 1; ii <= 32; ++ii)
-    write_memory (sp - 256 - (ii * 4), &registers[REGISTER_BYTE (32 - ii)], 4);
-
-  /* so far, 32*2 + 32 words = 384 bytes have been written. 
-     7 extra registers in our register set: pc, ps, cnd, lr, cnt, xer, mq */
-
-  for (ii = 1; ii <= (LAST_UISA_SP_REGNUM - FIRST_UISA_SP_REGNUM + 1); ++ii)
-    {
-      write_memory (sp - 384 - (ii * 4),
-		    &registers[REGISTER_BYTE (FPLAST_REGNUM + ii)], 4);
-    }
-
-  /* Save sp or so called back chain right here. */
-  store_address (sp_targ, 4, sp);
-  write_memory (sp - DUMMY_FRAME_SIZE, sp_targ, 4);
-  sp -= DUMMY_FRAME_SIZE;
-
-  /* And finally, this is the back chain. */
-  write_memory (sp + 8, pc_targ, 4);
-}
-
-
-/* Pop a dummy frame.
-
-   In rs6000 when we push a dummy frame, we save all of the registers. This
-   is usually done before user calls a function explicitly.
-
-   After a dummy frame is pushed, some instructions are copied into stack,
-   and stack pointer is decremented even more.  Since we don't have a frame
-   pointer to get back to the parent frame of the dummy, we start having
-   trouble poping it.  Therefore, we keep a dummy frame stack, keeping
-   addresses of dummy frames as such.  When poping happens and when we
-   detect that was a dummy frame, we pop it back to its parent by using
-   dummy frame stack (`dummy_frame_addr' array). 
-
-   FIXME:  This whole concept is broken.  You should be able to detect
-   a dummy stack frame *on the user's stack itself*.  When you do,
-   then you know the format of that stack frame -- including its
-   saved SP register!  There should *not* be a separate stack in the
-   GDB process that keeps track of these dummy frames!  -- gnu@cygnus.com Aug92
- */
+/* Pop the innermost frame, go back to the caller. */
 
 static void
-pop_dummy_frame ()
+rs6000_pop_frame (void)
 {
-  CORE_ADDR sp, pc;
-  int ii;
-  sp = dummy_frame_addr[--dummy_frame_count];
-
-  /* restore all fpr's. */
-  for (ii = 1; ii <= 32; ++ii)
-    read_memory (sp - (ii * 8), &registers[REGISTER_BYTE (32 - ii + FP0_REGNUM)], 8);
-
-  /* restore all gpr's */
-  for (ii = 1; ii <= 32; ++ii)
-    {
-      read_memory (sp - 256 - (ii * 4), &registers[REGISTER_BYTE (32 - ii)], 4);
-    }
-
-  /* restore the rest of the registers. */
-  for (ii = 1; ii <= (LAST_UISA_SP_REGNUM - FIRST_UISA_SP_REGNUM + 1); ++ii)
-    read_memory (sp - 384 - (ii * 4),
-		 &registers[REGISTER_BYTE (FPLAST_REGNUM + ii)], 4);
-
-  read_memory (sp - (DUMMY_FRAME_SIZE - 8),
-	       &registers[REGISTER_BYTE (PC_REGNUM)], 4);
-
-  /* when a dummy frame was being pushed, we had to decrement %sp first, in 
-     order to secure astack space. Thus, saved %sp (or %r1) value, is not the
-     one we should restore. Change it with the one we need. */
-
-  memcpy (&registers[REGISTER_BYTE (FP_REGNUM)], (char *) &sp, sizeof (int));
-
-  /* Now we can restore all registers. */
-
-  target_store_registers (-1);
-  pc = read_pc ();
-  flush_cached_frames ();
-}
-
-
-/* pop the innermost frame, go back to the caller. */
-
-void
-pop_frame ()
-{
-  CORE_ADDR pc, lr, sp, prev_sp;	/* %pc, %lr, %sp */
+  CORE_ADDR pc, lr, sp, prev_sp, addr;	/* %pc, %lr, %sp */
   struct rs6000_framedata fdata;
   struct frame_info *frame = get_current_frame ();
-  int addr, ii;
+  int ii, wordsize;
 
   pc = read_pc ();
   sp = FRAME_FP (frame);
 
-  if (stop_stack_dummy)
+  if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
     {
-      if (USE_GENERIC_DUMMY_FRAMES)
-	{
-	  generic_pop_dummy_frame ();
-	  flush_cached_frames ();
-	  return;
-	}
-      else
-	{
-	  if (dummy_frame_count)
-	    pop_dummy_frame ();
-	  return;
-	}
+      generic_pop_dummy_frame ();
+      flush_cached_frames ();
+      return;
     }
 
   /* Make sure that all registers are valid.  */
@@ -802,16 +795,17 @@
      saved %pc value in the previous frame. */
 
   addr = get_pc_function_start (frame->pc);
-  (void) skip_prologue (addr, &fdata);
+  (void) skip_prologue (addr, frame->pc, &fdata);
 
+  wordsize = TDEP->wordsize;
   if (fdata.frameless)
     prev_sp = sp;
   else
-    prev_sp = read_memory_integer (sp, 4);
+    prev_sp = read_memory_addr (sp, wordsize);
   if (fdata.lr_offset == 0)
-    lr = read_register (LR_REGNUM);
+    lr = read_register (PPC_LR_REGNUM);
   else
-    lr = read_memory_integer (prev_sp + fdata.lr_offset, 4);
+    lr = read_memory_addr (prev_sp + fdata.lr_offset, wordsize);
 
   /* reset %pc value. */
   write_register (PC_REGNUM, lr);
@@ -823,8 +817,8 @@
       addr = prev_sp + fdata.gpr_offset;
       for (ii = fdata.saved_gpr; ii <= 31; ++ii)
 	{
-	  read_memory (addr, &registers[REGISTER_BYTE (ii)], 4);
-	  addr += 4;
+	  read_memory (addr, &registers[REGISTER_BYTE (ii)], wordsize);
+	  addr += wordsize;
 	}
     }
 
@@ -843,18 +837,13 @@
   flush_cached_frames ();
 }
 
-/* fixup the call sequence of a dummy function, with the real function address.
-   its argumets will be passed by gdb. */
+/* Fixup the call sequence of a dummy function, with the real function
+   address.  Its arguments will be passed by gdb. */
 
-void
-rs6000_fix_call_dummy (dummyname, pc, fun, nargs, args, type, gcc_p)
-     char *dummyname;
-     CORE_ADDR pc;
-     CORE_ADDR fun;
-     int nargs;
-     value_ptr *args;
-     struct type *type;
-     int gcc_p;
+static void
+rs6000_fix_call_dummy (char *dummyname, CORE_ADDR pc, CORE_ADDR fun,
+		       int nargs, value_ptr *args, struct type *type,
+		       int gcc_p)
 {
 #define	TOC_ADDR_OFFSET		20
 #define	TARGET_ADDR_OFFSET	28
@@ -862,61 +851,32 @@
   int ii;
   CORE_ADDR target_addr;
 
-  if (USE_GENERIC_DUMMY_FRAMES)
+  if (rs6000_find_toc_address_hook != NULL)
     {
-      if (find_toc_address_hook != NULL)
-	{
-	  CORE_ADDR tocvalue = (*find_toc_address_hook) (fun);
-	  write_register (TOC_REGNUM, tocvalue);
-	}
-    }
-  else
-    {
-      if (find_toc_address_hook != NULL)
-	{
-	  CORE_ADDR tocvalue;
-
-	  tocvalue = (*find_toc_address_hook) (fun);
-	  ii = *(int *) ((char *) dummyname + TOC_ADDR_OFFSET);
-	  ii = (ii & 0xffff0000) | (tocvalue >> 16);
-	  *(int *) ((char *) dummyname + TOC_ADDR_OFFSET) = ii;
-
-	  ii = *(int *) ((char *) dummyname + TOC_ADDR_OFFSET + 4);
-	  ii = (ii & 0xffff0000) | (tocvalue & 0x0000ffff);
-	  *(int *) ((char *) dummyname + TOC_ADDR_OFFSET + 4) = ii;
-	}
-
-      target_addr = fun;
-      ii = *(int *) ((char *) dummyname + TARGET_ADDR_OFFSET);
-      ii = (ii & 0xffff0000) | (target_addr >> 16);
-      *(int *) ((char *) dummyname + TARGET_ADDR_OFFSET) = ii;
-
-      ii = *(int *) ((char *) dummyname + TARGET_ADDR_OFFSET + 4);
-      ii = (ii & 0xffff0000) | (target_addr & 0x0000ffff);
-      *(int *) ((char *) dummyname + TARGET_ADDR_OFFSET + 4) = ii;
+      CORE_ADDR tocvalue = (*rs6000_find_toc_address_hook) (fun);
+      write_register (PPC_TOC_REGNUM, tocvalue);
     }
 }
 
-/* Pass the arguments in either registers, or in the stack. In RS6000,
+/* Pass the arguments in either registers, or in the stack. In RS/6000,
    the first eight words of the argument list (that might be less than
    eight parameters if some parameters occupy more than one word) are
-   passed in r3..r11 registers.  float and double parameters are
+   passed in r3..r10 registers.  float and double parameters are
    passed in fpr's, in addition to that. Rest of the parameters if any
    are passed in user stack. There might be cases in which half of the
    parameter is copied into registers, the other half is pushed into
    stack.
 
+   Stack must be aligned on 64-bit boundaries when synthesizing
+   function calls.
+
    If the function is returning a structure, then the return address is passed
    in r3, then the first 7 words of the parameters can be passed in registers,
    starting from r4. */
 
-CORE_ADDR
-rs6000_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     int struct_return;
-     CORE_ADDR struct_addr;
+static CORE_ADDR
+rs6000_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+		       int struct_return, CORE_ADDR struct_addr)
 {
   int ii;
   int len = 0;
@@ -924,18 +884,13 @@
   int argbytes;			/* current argument byte */
   char tmp_buffer[50];
   int f_argno = 0;		/* current floating point argno */
+  int wordsize = TDEP->wordsize;
 
   value_ptr arg = 0;
   struct type *type;
 
   CORE_ADDR saved_sp;
 
-  if (!USE_GENERIC_DUMMY_FRAMES)
-    {
-      if (dummy_frame_count <= 0)
-	printf_unfiltered ("FATAL ERROR -push_arguments()! frame not found!!\n");
-    }
-
   /* The first eight words of ther arguments are passed in registers. Copy
      them appropriately.
 
@@ -1021,31 +976,17 @@
 
 ran_out_of_registers_for_arguments:
 
-  if (USE_GENERIC_DUMMY_FRAMES)
-    {
-      saved_sp = read_sp ();
+  saved_sp = read_sp ();
 #ifndef ELF_OBJECT_FORMAT
-      /* location for 8 parameters are always reserved. */
-      sp -= 4 * 8;
+  /* location for 8 parameters are always reserved. */
+  sp -= wordsize * 8;
 
-      /* another six words for back chain, TOC register, link register, etc. */
-      sp -= 24;
+  /* another six words for back chain, TOC register, link register, etc. */
+  sp -= wordsize * 6;
 
-      /* stack pointer must be quadword aligned */
-      sp &= -16;
+  /* stack pointer must be quadword aligned */
+  sp &= -16;
 #endif
-    }
-  else
-    {
-      /* location for 8 parameters are always reserved. */
-      sp -= 4 * 8;
-
-      /* another six words for back chain, TOC register, link register, etc. */
-      sp -= 24;
-
-      /* stack pointer must be quadword aligned */
-      sp &= -16;
-    }
 
   /* if there are more arguments, allocate space for them in 
      the stack, then push them starting from the ninth one. */
@@ -1122,16 +1063,6 @@
     /* Secure stack areas first, before doing anything else. */
     write_register (SP_REGNUM, sp);
 
-  if (!USE_GENERIC_DUMMY_FRAMES)
-    {
-      /* we want to copy 24 bytes of target's frame to dummy's frame,
-         then set back chain to point to new frame. */
-
-      saved_sp = dummy_frame_addr[dummy_frame_count - 1];
-      read_memory (saved_sp, tmp_buffer, 24);
-      write_memory (sp, tmp_buffer, 24);
-    }
-
   /* set back chain properly */
   store_address (tmp_buffer, 4, saved_sp);
   write_memory (sp, tmp_buffer, 4);
@@ -1139,30 +1070,22 @@
   target_store_registers (-1);
   return sp;
 }
-/* #ifdef ELF_OBJECT_FORMAT */
 
 /* Function: ppc_push_return_address (pc, sp)
    Set up the return address for the inferior function call. */
 
-CORE_ADDR
-ppc_push_return_address (pc, sp)
-     CORE_ADDR pc;
-     CORE_ADDR sp;
+static CORE_ADDR
+ppc_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
 {
-  write_register (LR_REGNUM, CALL_DUMMY_ADDRESS ());
+  write_register (PPC_LR_REGNUM, CALL_DUMMY_ADDRESS ());
   return sp;
 }
 
-/* #endif */
+/* Extract a function return value of type TYPE from raw register array
+   REGBUF, and copy that return value into VALBUF in virtual format. */
 
-/* a given return value in `regbuf' with a type `valtype', extract and copy its
-   value into `valbuf' */
-
-void
-extract_return_value (valtype, regbuf, valbuf)
-     struct type *valtype;
-     char regbuf[REGISTER_BYTES];
-     char *valbuf;
+static void
+rs6000_extract_return_value (struct type *valtype, char *regbuf, char *valbuf)
 {
   int offset = 0;
 
@@ -1199,14 +1122,12 @@
     }
 }
 
-
-/* keep structure return address in this variable.
+/* Keep structure return address in this variable.
    FIXME:  This is a horrid kludge which should not be allowed to continue
    living.  This only allows a single nested call to a structure-returning
    function.  Come on, guys!  -- gnu@cygnus.com, Aug 92  */
 
-CORE_ADDR rs6000_struct_return_address;
-
+static CORE_ADDR rs6000_struct_return_address;
 
 /* Indirect function calls use a piece of trampoline code to do context
    switching, i.e. to set the new TOC table. Skip such code if we are on
@@ -1217,8 +1138,7 @@
    trampoline code.  */
 
 CORE_ADDR
-skip_trampoline_code (pc)
-     CORE_ADDR pc;
+rs6000_skip_trampoline_code (CORE_ADDR pc)
 {
   register unsigned int ii, op;
   CORE_ADDR solib_target_pc;
@@ -1247,7 +1167,7 @@
 	return 0;
     }
   ii = read_register (11);	/* r11 holds destination addr   */
-  pc = read_memory_integer (ii, 4);	/* (r11) value                  */
+  pc = read_memory_addr (ii, TDEP->wordsize); /* (r11) value */
   return pc;
 }
 
@@ -1281,26 +1201,24 @@
 	return 0;
     }
 
-  (void) skip_prologue (func_start, &fdata);
+  (void) skip_prologue (func_start, fi->pc, &fdata);
   return fdata.frameless;
 }
 
 /* Return the PC saved in a frame */
 
-unsigned long
+CORE_ADDR
 rs6000_frame_saved_pc (struct frame_info *fi)
 {
   CORE_ADDR func_start;
   struct rs6000_framedata fdata;
+  int wordsize = TDEP->wordsize;
 
   if (fi->signal_handler_caller)
-    return read_memory_integer (fi->frame + SIG_FRAME_PC_OFFSET, 4);
+    return read_memory_addr (fi->frame + SIG_FRAME_PC_OFFSET, wordsize);
 
-  if (USE_GENERIC_DUMMY_FRAMES)
-    {
-      if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
-	return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
-    }
+  if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+    return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
 
   func_start = get_pc_function_start (fi->pc);
 
@@ -1309,20 +1227,22 @@
   if (!func_start)
     return 0;
 
-  (void) skip_prologue (func_start, &fdata);
+  (void) skip_prologue (func_start, fi->pc, &fdata);
 
   if (fdata.lr_offset == 0 && fi->next != NULL)
     {
       if (fi->next->signal_handler_caller)
-	return read_memory_integer (fi->next->frame + SIG_FRAME_LR_OFFSET, 4);
+	return read_memory_addr (fi->next->frame + SIG_FRAME_LR_OFFSET,
+				 wordsize);
       else
-	return read_memory_integer (FRAME_CHAIN (fi) + DEFAULT_LR_SAVE, 4);
+	return read_memory_addr (FRAME_CHAIN (fi) + DEFAULT_LR_SAVE,
+				 wordsize);
     }
 
   if (fdata.lr_offset == 0)
-    return read_register (LR_REGNUM);
+    return read_register (PPC_LR_REGNUM);
 
-  return read_memory_integer (FRAME_CHAIN (fi) + fdata.lr_offset, 4);
+  return read_memory_addr (FRAME_CHAIN (fi) + fdata.lr_offset, wordsize);
 }
 
 /* If saved registers of frame FI are not known yet, read and cache them.
@@ -1330,12 +1250,11 @@
    in which case the framedata are read.  */
 
 static void
-frame_get_saved_regs (fi, fdatap)
-     struct frame_info *fi;
-     struct rs6000_framedata *fdatap;
+frame_get_saved_regs (struct frame_info *fi, struct rs6000_framedata *fdatap)
 {
   CORE_ADDR frame_addr;
   struct rs6000_framedata work_fdata;
+  int wordsize = TDEP->wordsize;
 
   if (fi->saved_regs)
     return;
@@ -1343,7 +1262,7 @@
   if (fdatap == NULL)
     {
       fdatap = &work_fdata;
-      (void) skip_prologue (get_pc_function_start (fi->pc), fdatap);
+      (void) skip_prologue (get_pc_function_start (fi->pc), fi->pc, fdatap);
     }
 
   frame_saved_regs_zalloc (fi);
@@ -1359,7 +1278,7 @@
   else if (fi->prev && fi->prev->frame)
     frame_addr = fi->prev->frame;
   else
-    frame_addr = read_memory_integer (fi->frame, 4);
+    frame_addr = read_memory_addr (fi->frame, wordsize);
 
   /* if != -1, fdatap->saved_fpr is the smallest number of saved_fpr.
      All fpr's from saved_fpr to fp31 are saved.  */
@@ -1367,11 +1286,11 @@
   if (fdatap->saved_fpr >= 0)
     {
       int i;
-      int fpr_offset = frame_addr + fdatap->fpr_offset;
+      CORE_ADDR fpr_addr = frame_addr + fdatap->fpr_offset;
       for (i = fdatap->saved_fpr; i < 32; i++)
 	{
-	  fi->saved_regs[FP0_REGNUM + i] = fpr_offset;
-	  fpr_offset += 8;
+	  fi->saved_regs[FP0_REGNUM + i] = fpr_addr;
+	  fpr_addr += 8;
 	}
     }
 
@@ -1381,23 +1300,23 @@
   if (fdatap->saved_gpr >= 0)
     {
       int i;
-      int gpr_offset = frame_addr + fdatap->gpr_offset;
+      CORE_ADDR gpr_addr = frame_addr + fdatap->gpr_offset;
       for (i = fdatap->saved_gpr; i < 32; i++)
 	{
-	  fi->saved_regs[i] = gpr_offset;
-	  gpr_offset += 4;
+	  fi->saved_regs[i] = gpr_addr;
+	  gpr_addr += wordsize;
 	}
     }
 
   /* If != 0, fdatap->cr_offset is the offset from the frame that holds
      the CR.  */
   if (fdatap->cr_offset != 0)
-    fi->saved_regs[CR_REGNUM] = frame_addr + fdatap->cr_offset;
+    fi->saved_regs[PPC_CR_REGNUM] = frame_addr + fdatap->cr_offset;
 
   /* If != 0, fdatap->lr_offset is the offset from the frame that holds
      the LR.  */
   if (fdatap->lr_offset != 0)
-    fi->saved_regs[LR_REGNUM] = frame_addr + fdatap->lr_offset;
+    fi->saved_regs[PPC_LR_REGNUM] = frame_addr + fdatap->lr_offset;
 }
 
 /* Return the address of a frame. This is the inital %sp value when the frame
@@ -1405,8 +1324,7 @@
    an alloca register. */
 
 static CORE_ADDR
-frame_initial_stack_address (fi)
-     struct frame_info *fi;
+frame_initial_stack_address (struct frame_info *fi)
 {
   CORE_ADDR tmpaddr;
   struct rs6000_framedata fdata;
@@ -1420,7 +1338,7 @@
 
   /* find out if this function is using an alloca register.. */
 
-  (void) skip_prologue (get_pc_function_start (fi->pc), &fdata);
+  (void) skip_prologue (get_pc_function_start (fi->pc), fi->pc, &fdata);
 
   /* if saved registers of this frame are not known yet, read and cache them. */
 
@@ -1458,7 +1376,8 @@
       tmpaddr = callee_fi->saved_regs[fdata.alloca_reg];
       if (tmpaddr)
 	{
-	  fi->extra_info->initial_sp = read_memory_integer (tmpaddr, 4);
+	  fi->extra_info->initial_sp =
+	    read_memory_addr (tmpaddr, TDEP->wordsize);
 	  return fi->extra_info->initial_sp;
 	}
 
@@ -1473,24 +1392,31 @@
   return fi->extra_info->initial_sp;
 }
 
-CORE_ADDR
-rs6000_frame_chain (thisframe)
-     struct frame_info *thisframe;
-{
-  CORE_ADDR fp;
+/* Describe the pointer in each stack frame to the previous stack frame
+   (its caller).  */
 
-  if (USE_GENERIC_DUMMY_FRAMES)
-    {
-      if (PC_IN_CALL_DUMMY (thisframe->pc, thisframe->frame, thisframe->frame))
-	return thisframe->frame;	/* dummy frame same as caller's frame */
-    }
+/* FRAME_CHAIN takes a frame's nominal address
+   and produces the frame's chain-pointer. */
+
+/* In the case of the RS/6000, the frame's nominal address
+   is the address of a 4-byte word containing the calling frame's address.  */
+
+CORE_ADDR
+rs6000_frame_chain (struct frame_info *thisframe)
+{
+  CORE_ADDR fp, fpp, lr;
+  int wordsize = TDEP->wordsize;
+
+  if (PC_IN_CALL_DUMMY (thisframe->pc, thisframe->frame, thisframe->frame))
+    return thisframe->frame;	/* dummy frame same as caller's frame */
 
   if (inside_entry_file (thisframe->pc) ||
       thisframe->pc == entry_point_address ())
     return 0;
 
   if (thisframe->signal_handler_caller)
-    fp = read_memory_integer (thisframe->frame + SIG_FRAME_FP_OFFSET, 4);
+    fp = read_memory_addr (thisframe->frame + SIG_FRAME_FP_OFFSET,
+			      wordsize);
   else if (thisframe->next != NULL
 	   && thisframe->next->signal_handler_caller
 	   && FRAMELESS_FUNCTION_INVOCATION (thisframe))
@@ -1498,57 +1424,242 @@
        frame pointer.  */
     fp = FRAME_FP (thisframe);
   else
-    fp = read_memory_integer ((thisframe)->frame, 4);
+    fp = read_memory_addr ((thisframe)->frame, wordsize);
 
-  if (USE_GENERIC_DUMMY_FRAMES)
-    {
-      CORE_ADDR fpp, lr;
-
-      lr = read_register (LR_REGNUM);
-      if (lr == entry_point_address ())
-	if (fp != 0 && (fpp = read_memory_integer (fp, 4)) != 0)
-	  if (PC_IN_CALL_DUMMY (lr, fpp, fpp))
-	    return fpp;
-    }
+  lr = read_register (PPC_LR_REGNUM);
+  if (lr == entry_point_address ())
+    if (fp != 0 && (fpp = read_memory_addr (fp, wordsize)) != 0)
+      if (PC_IN_CALL_DUMMY (lr, fpp, fpp))
+	return fpp;
 
   return fp;
 }
-
-/* Return nonzero if ADDR (a function pointer) is in the data space and
-   is therefore a special function pointer.  */
 
-int
-is_magic_function_pointer (addr)
-     CORE_ADDR addr;
+/* Return the size of register REG when words are WORDSIZE bytes long.  If REG
+   isn't available with that word size, return 0. */
+
+static int
+regsize (const struct reg *reg, int wordsize)
+{
+  return wordsize == 8 ? reg->sz64 : reg->sz32;
+}
+
+/* Return the name of register number N, or null if no such register exists
+   in the current architecture. */
+
+static char *
+rs6000_register_name (int n)
+{
+  struct gdbarch_tdep *tdep = TDEP;
+  const struct reg *reg = tdep->regs + n;
+
+  if (!regsize (reg, tdep->wordsize))
+    return NULL;
+  return reg->name;
+}
+
+/* Index within `registers' of the first byte of the space for
+   register N.  */
+
+static int
+rs6000_register_byte (int n)
+{
+  return TDEP->regoff[n];
+}
+
+/* Return the number of bytes of storage in the actual machine representation
+   for register N if that register is available, else return 0. */
+
+static int
+rs6000_register_raw_size (int n)
+{
+  struct gdbarch_tdep *tdep = TDEP;
+  const struct reg *reg = tdep->regs + n;
+  return regsize (reg, tdep->wordsize);
+}
+
+/* Number of bytes of storage in the program's representation
+   for register N.  */
+
+static int
+rs6000_register_virtual_size (int n)
+{
+  return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (n));
+}
+
+/* Return the GDB type object for the "standard" data type
+   of data in register N.  */
+
+static struct type *
+rs6000_register_virtual_type (int n)
+{
+  struct gdbarch_tdep *tdep = TDEP;
+  const struct reg *reg = tdep->regs + n;
+
+  return reg->fpr ? builtin_type_double :
+    regsize (reg, tdep->wordsize) == 8 ? builtin_type_int64 :
+      builtin_type_int32;
+}
+
+/* For the PowerPC, it appears that the debug info marks float parameters as
+   floats regardless of whether the function is prototyped, but the actual
+   values are always passed in as doubles.  Tell gdb to always assume that
+   floats are passed as doubles and then converted in the callee. */
+
+static int
+rs6000_coerce_float_to_double (struct type *formal, struct type *actual)
+{
+  return 1;
+}
+
+/* Return whether register N requires conversion when moving from raw format
+   to virtual format.
+
+   The register format for RS/6000 floating point registers is always
+   double, we need a conversion if the memory format is float. */
+
+static int
+rs6000_register_convertible (int n)
+{
+  const struct reg *reg = TDEP->regs + n;
+  return reg->fpr;
+}
+
+/* Convert data from raw format for register N in buffer FROM
+   to virtual format with type TYPE in buffer TO. */
+
+static void
+rs6000_register_convert_to_virtual (int n, struct type *type,
+				    char *from, char *to)
+{
+  if (TYPE_LENGTH (type) != REGISTER_RAW_SIZE (n))
+    {
+      double val = extract_floating (from, REGISTER_RAW_SIZE (n));
+      store_floating (to, TYPE_LENGTH (type), val);
+    }
+  else
+    memcpy (to, from, REGISTER_RAW_SIZE (n));
+}
+
+/* Convert data from virtual format with type TYPE in buffer FROM
+   to raw format for register N in buffer TO. */
+
+static void
+rs6000_register_convert_to_raw (struct type *type, int n,
+				char *from, char *to)
+{
+  if (TYPE_LENGTH (type) != REGISTER_RAW_SIZE (n))
+    {
+      double val = extract_floating (from, TYPE_LENGTH (type));
+      store_floating (to, REGISTER_RAW_SIZE (n), val);
+    }
+  else
+    memcpy (to, from, REGISTER_RAW_SIZE (n));
+}
+
+/* Store the address of the place in which to copy the structure the
+   subroutine will return.  This is called from call_function.
+
+   In RS/6000, struct return addresses are passed as an extra parameter in r3.
+   In function return, callee is not responsible of returning this address
+   back.  Since gdb needs to find it, we will store in a designated variable
+   `rs6000_struct_return_address'. */
+
+static void
+rs6000_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
+{
+  write_register (3, addr);
+  rs6000_struct_return_address = addr;
+}
+
+/* Write into appropriate registers a function return value
+   of type TYPE, given in virtual format.  */
+
+static void
+rs6000_store_return_value (struct type *type, char *valbuf)
+{
+  if (TYPE_CODE (type) == TYPE_CODE_FLT)
+
+    /* Floating point values are returned starting from FPR1 and up.
+       Say a double_double_double type could be returned in
+       FPR1/FPR2/FPR3 triple. */
+
+    write_register_bytes (REGISTER_BYTE (FP0_REGNUM + 1), valbuf,
+			  TYPE_LENGTH (type));
+  else
+    /* Everything else is returned in GPR3 and up. */
+    write_register_bytes (REGISTER_BYTE (PPC_GP0_REGNUM + 3), valbuf,
+			  TYPE_LENGTH (type));
+}
+
+/* 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
+rs6000_extract_struct_value_address (char *regbuf)
+{
+  return rs6000_struct_return_address;
+}
+
+/* Return whether PC is in a dummy function call.
+
+   FIXME: This just checks for the end of the stack, which is broken
+   for things like stepping through gcc nested function stubs. */
+
+static int
+rs6000_pc_in_call_dummy (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR fp)
+{
+  return sp < pc && pc < fp;
+}
+
+/* Hook called when a new child process is started. */
+
+void
+rs6000_create_inferior (int pid)
+{
+  if (rs6000_set_host_arch_hook)
+    rs6000_set_host_arch_hook (pid);
+}
+
+/* Support for CONVERT_FROM_FUNC_PTR_ADDR(ADDR).
+
+   Usually a function pointer's representation is simply the address
+   of the function. On the RS/6000 however, a function pointer is
+   represented by a pointer to a TOC entry. This TOC entry contains
+   three words, the first word is the address of the function, the
+   second word is the TOC pointer (r2), and the third word is the
+   static chain value.  Throughout GDB it is currently assumed that a
+   function pointer contains the address of the function, which is not
+   easy to fix.  In addition, the conversion of a function address to
+   a function pointer would require allocation of a TOC entry in the
+   inferior's memory space, with all its drawbacks.  To be able to
+   call C++ virtual methods in the inferior (which are called via
+   function pointers), find_function_addr uses this function to get the
+   function address from a function pointer.  */
+
+/* Return real function address if ADDR (a function pointer) is in the data
+   space and is therefore a special function pointer.  */
+
+CORE_ADDR
+rs6000_convert_from_func_ptr_addr (CORE_ADDR addr)
 {
   struct obj_section *s;
 
   s = find_pc_section (addr);
   if (s && s->the_bfd_section->flags & SEC_CODE)
-    return 0;
-  else
-    return 1;
-}
+    return addr;
 
-#ifdef GDB_TARGET_POWERPC
-int
-gdb_print_insn_powerpc (memaddr, info)
-     bfd_vma memaddr;
-     disassemble_info *info;
-{
-  if (TARGET_BYTE_ORDER == BIG_ENDIAN)
-    return print_insn_big_powerpc (memaddr, info);
-  else
-    return print_insn_little_powerpc (memaddr, info);
+  /* ADDR is in the data space, so it's a special function pointer. */
+  return read_memory_addr (addr, TDEP->wordsize);
 }
-#endif
 
 
-/* Handling the various PowerPC/RS6000 variants.  */
+/* Handling the various POWER/PowerPC variants.  */
 
 
-/* The arrays here called register_names_MUMBLE hold names that 
-   the rs6000_register_name function returns.
+/* The arrays here called registers_MUMBLE hold information about available
+   registers.
 
    For each family of PPC variants, I've tried to isolate out the
    common registers and put them up front, so that as long as you get
@@ -1565,161 +1676,222 @@
 
    Most of these register groups aren't anything formal.  I arrived at
    them by looking at the registers that occurred in more than one
-   processor.  */
+   processor. */
 
-/* UISA register names common across all architectures, including POWER.  */
+/* Convenience macros for populating register arrays. */
 
-#define COMMON_UISA_REG_NAMES \
-  /*  0 */ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",  \
-  /*  8 */ "r8", "r9", "r10","r11","r12","r13","r14","r15", \
-  /* 16 */ "r16","r17","r18","r19","r20","r21","r22","r23", \
-  /* 24 */ "r24","r25","r26","r27","r28","r29","r30","r31", \
-  /* 32 */ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",  \
-  /* 40 */ "f8", "f9", "f10","f11","f12","f13","f14","f15", \
-  /* 48 */ "f16","f17","f18","f19","f20","f21","f22","f23", \
-  /* 56 */ "f24","f25","f26","f27","f28","f29","f30","f31", \
-  /* 64 */ "pc", "ps"
+/* Within another macro, convert S to a string. */
 
-/* UISA-level SPR names for PowerPC.  */
-#define PPC_UISA_SPR_NAMES \
-  /* 66 */ "cr",  "lr", "ctr", "xer", ""
+#define STR(s)	#s
 
-/* Segment register names, for PowerPC.  */
-#define PPC_SEGMENT_REG_NAMES \
-  /* 71 */ "sr0", "sr1", "sr2",  "sr3",  "sr4",  "sr5",  "sr6",  "sr7", \
-  /* 79 */ "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15"
+/* Return a struct reg defining register NAME that's 32 bits on 32-bit systems
+   and 64 bits on 64-bit systems. */
+#define R(name)		{ STR(name), 4, 8, 0 }
 
-/* OEA SPR names for 32-bit PowerPC implementations.
-   The blank space is for "asr", which is only present on 64-bit
-   implementations.  */
-#define PPC_32_OEA_SPR_NAMES \
-  /*  87 */ "pvr", \
-  /*  88 */ "ibat0u", "ibat0l", "ibat1u", "ibat1l", \
-  /*  92 */ "ibat2u", "ibat2l", "ibat3u", "ibat3l", \
-  /*  96 */ "dbat0u", "dbat0l", "dbat1u", "dbat1l", \
-  /* 100 */ "dbat2u", "dbat2l", "dbat3u", "dbat3l", \
-  /* 104 */ "sdr1", "", "dar", "dsisr", "sprg0", "sprg1", "sprg2", "sprg3",\
-  /* 112 */ "srr0", "srr1", "tbl", "tbu", "dec", "dabr", "ear"
+/* Return a struct reg defining register NAME that's 32 bits on all
+   systems. */
+#define R4(name)	{ STR(name), 4, 4, 0 }
 
-/* For the RS6000, we only cover user-level SPR's.  */
-char *register_names_rs6000[] =
+/* Return a struct reg defining register NAME that's 64 bits on all
+   systems. */
+#define R8(name)	{ STR(name), 8, 8, 0 }
+
+/* Return a struct reg defining floating-point register NAME. */
+#define F(name)		{ STR(name), 8, 8, 1 }
+
+/* Return a struct reg defining register NAME that's 32 bits on 32-bit
+   systems and that doesn't exist on 64-bit systems. */
+#define R32(name)	{ STR(name), 4, 0, 0 }
+
+/* Return a struct reg defining register NAME that's 64 bits on 64-bit
+   systems and that doesn't exist on 32-bit systems. */
+#define R64(name)	{ STR(name), 0, 8, 0 }
+
+/* Return a struct reg placeholder for a register that doesn't exist. */
+#define R0		{ 0, 0, 0, 0 }
+
+/* UISA registers common across all architectures, including POWER.  */
+
+#define COMMON_UISA_REGS \
+  /*  0 */ R(r0), R(r1), R(r2), R(r3), R(r4), R(r5), R(r6), R(r7),  \
+  /*  8 */ R(r8), R(r9), R(r10),R(r11),R(r12),R(r13),R(r14),R(r15), \
+  /* 16 */ R(r16),R(r17),R(r18),R(r19),R(r20),R(r21),R(r22),R(r23), \
+  /* 24 */ R(r24),R(r25),R(r26),R(r27),R(r28),R(r29),R(r30),R(r31), \
+  /* 32 */ F(f0), F(f1), F(f2), F(f3), F(f4), F(f5), F(f6), F(f7),  \
+  /* 40 */ F(f8), F(f9), F(f10),F(f11),F(f12),F(f13),F(f14),F(f15), \
+  /* 48 */ F(f16),F(f17),F(f18),F(f19),F(f20),F(f21),F(f22),F(f23), \
+  /* 56 */ F(f24),F(f25),F(f26),F(f27),F(f28),F(f29),F(f30),F(f31), \
+  /* 64 */ R(pc), R(ps)
+
+/* UISA-level SPRs for PowerPC.  */
+#define PPC_UISA_SPRS \
+  /* 66 */ R4(cr),  R(lr), R(ctr), R4(xer), R0
+
+/* Segment registers, for PowerPC.  */
+#define PPC_SEGMENT_REGS \
+  /* 71 */ R32(sr0),  R32(sr1),  R32(sr2),  R32(sr3),  \
+  /* 75 */ R32(sr4),  R32(sr5),  R32(sr6),  R32(sr7),  \
+  /* 79 */ R32(sr8),  R32(sr9),  R32(sr10), R32(sr11), \
+  /* 83 */ R32(sr12), R32(sr13), R32(sr14), R32(sr15)
+
+/* OEA SPRs for PowerPC.  */
+#define PPC_OEA_SPRS \
+  /*  87 */ R4(pvr), \
+  /*  88 */ R(ibat0u), R(ibat0l), R(ibat1u), R(ibat1l), \
+  /*  92 */ R(ibat2u), R(ibat2l), R(ibat3u), R(ibat3l), \
+  /*  96 */ R(dbat0u), R(dbat0l), R(dbat1u), R(dbat1l), \
+  /* 100 */ R(dbat2u), R(dbat2l), R(dbat3u), R(dbat3l), \
+  /* 104 */ R(sdr1),   R64(asr),  R(dar),    R4(dsisr), \
+  /* 108 */ R(sprg0),  R(sprg1),  R(sprg2),  R(sprg3),  \
+  /* 112 */ R(srr0),   R(srr1),   R(tbl),    R(tbu),    \
+  /* 116 */ R4(dec),   R(dabr),   R4(ear)
+
+/* IBM POWER (pre-PowerPC) architecture, user-level view.  We only cover
+   user-level SPR's. */
+static const struct reg registers_power[] =
 {
-  COMMON_UISA_REG_NAMES,
-  /* 66 */ "cnd", "lr", "cnt", "xer", "mq"
+  COMMON_UISA_REGS,
+  /* 66 */ R4(cnd), R(lr), R(cnt), R4(xer), R4(mq)
 };
 
-/* a UISA-only view of the PowerPC.  */
-char *register_names_uisa[] =
+/* PowerPC UISA - a PPC processor as viewed by user-level code.  A UISA-only
+   view of the PowerPC. */
+static const struct reg registers_powerpc[] =
 {
-  COMMON_UISA_REG_NAMES,
-  PPC_UISA_SPR_NAMES
+  COMMON_UISA_REGS,
+  PPC_UISA_SPRS
 };
 
-char *register_names_403[] =
+/* IBM PowerPC 403. */
+static const struct reg registers_403[] =
 {
-  COMMON_UISA_REG_NAMES,
-  PPC_UISA_SPR_NAMES,
-  PPC_SEGMENT_REG_NAMES,
-  PPC_32_OEA_SPR_NAMES,
-  /* 119 */ "icdbdr", "esr", "dear", "evpr", "cdbcr", "tsr", "tcr", "pit",
-  /* 127 */ "tbhi", "tblo", "srr2", "srr3", "dbsr", "dbcr", "iac1", "iac2",
-  /* 135 */ "dac1", "dac2", "dccr", "iccr", "pbl1", "pbu1", "pbl2", "pbu2"
+  COMMON_UISA_REGS,
+  PPC_UISA_SPRS,
+  PPC_SEGMENT_REGS,
+  PPC_OEA_SPRS,
+  /* 119 */ R(icdbdr), R(esr),  R(dear), R(evpr),
+  /* 123 */ R(cdbcr),  R(tsr),  R(tcr),  R(pit),
+  /* 127 */ R(tbhi),   R(tblo), R(srr2), R(srr3),
+  /* 131 */ R(dbsr),   R(dbcr), R(iac1), R(iac2),
+  /* 135 */ R(dac1),   R(dac2), R(dccr), R(iccr),
+  /* 139 */ R(pbl1),   R(pbu1), R(pbl2), R(pbu2)
 };
 
-char *register_names_403GC[] =
+/* IBM PowerPC 403GC. */
+static const struct reg registers_403GC[] =
 {
-  COMMON_UISA_REG_NAMES,
-  PPC_UISA_SPR_NAMES,
-  PPC_SEGMENT_REG_NAMES,
-  PPC_32_OEA_SPR_NAMES,
-  /* 119 */ "icdbdr", "esr", "dear", "evpr", "cdbcr", "tsr", "tcr", "pit",
-  /* 127 */ "tbhi", "tblo", "srr2", "srr3", "dbsr", "dbcr", "iac1", "iac2",
-  /* 135 */ "dac1", "dac2", "dccr", "iccr", "pbl1", "pbu1", "pbl2", "pbu2",
-  /* 143 */ "zpr", "pid", "sgr", "dcwr", "tbhu", "tblu"
+  COMMON_UISA_REGS,
+  PPC_UISA_SPRS,
+  PPC_SEGMENT_REGS,
+  PPC_OEA_SPRS,
+  /* 119 */ R(icdbdr), R(esr),  R(dear), R(evpr),
+  /* 123 */ R(cdbcr),  R(tsr),  R(tcr),  R(pit),
+  /* 127 */ R(tbhi),   R(tblo), R(srr2), R(srr3),
+  /* 131 */ R(dbsr),   R(dbcr), R(iac1), R(iac2),
+  /* 135 */ R(dac1),   R(dac2), R(dccr), R(iccr),
+  /* 139 */ R(pbl1),   R(pbu1), R(pbl2), R(pbu2),
+  /* 143 */ R(zpr),    R(pid),  R(sgr),  R(dcwr),
+  /* 147 */ R(tbhu),   R(tblu)
 };
 
-char *register_names_505[] =
+/* Motorola PowerPC 505. */
+static const struct reg registers_505[] =
 {
-  COMMON_UISA_REG_NAMES,
-  PPC_UISA_SPR_NAMES,
-  PPC_SEGMENT_REG_NAMES,
-  PPC_32_OEA_SPR_NAMES,
-  /* 119 */ "eie", "eid", "nri"
+  COMMON_UISA_REGS,
+  PPC_UISA_SPRS,
+  PPC_SEGMENT_REGS,
+  PPC_OEA_SPRS,
+  /* 119 */ R(eie), R(eid), R(nri)
 };
 
-char *register_names_860[] =
+/* Motorola PowerPC 860 or 850. */
+static const struct reg registers_860[] =
 {
-  COMMON_UISA_REG_NAMES,
-  PPC_UISA_SPR_NAMES,
-  PPC_SEGMENT_REG_NAMES,
-  PPC_32_OEA_SPR_NAMES,
-  /* 119 */ "eie", "eid", "nri", "cmpa", "cmpb", "cmpc", "cmpd", "icr",
-  /* 127 */ "der", "counta", "countb", "cmpe", "cmpf", "cmpg", "cmph",
-  /* 134 */ "lctrl1", "lctrl2", "ictrl", "bar", "ic_cst", "ic_adr", "ic_dat",
-  /* 141 */ "dc_cst", "dc_adr", "dc_dat", "dpdr", "dpir", "immr", "mi_ctr",
-  /* 148 */ "mi_ap", "mi_epn", "mi_twc", "mi_rpn", "md_ctr", "m_casid",
-  /* 154 */ "md_ap", "md_epn", "md_twb", "md_twc", "md_rpn", "m_tw",
-  /* 160 */ "mi_dbcam", "mi_dbram0", "mi_dbram1", "md_dbcam", "md_dbram0",
-  /* 165 */ "md_dbram1"
+  COMMON_UISA_REGS,
+  PPC_UISA_SPRS,
+  PPC_SEGMENT_REGS,
+  PPC_OEA_SPRS,
+  /* 119 */ R(eie), R(eid), R(nri), R(cmpa),
+  /* 123 */ R(cmpb), R(cmpc), R(cmpd), R(icr),
+  /* 127 */ R(der), R(counta), R(countb), R(cmpe),
+  /* 131 */ R(cmpf), R(cmpg), R(cmph), R(lctrl1),
+  /* 135 */ R(lctrl2), R(ictrl), R(bar), R(ic_cst),
+  /* 139 */ R(ic_adr), R(ic_dat), R(dc_cst), R(dc_adr),
+  /* 143 */ R(dc_dat), R(dpdr), R(dpir), R(immr),
+  /* 147 */ R(mi_ctr), R(mi_ap), R(mi_epn), R(mi_twc),
+  /* 151 */ R(mi_rpn), R(md_ctr), R(m_casid), R(md_ap),
+  /* 155 */ R(md_epn), R(md_twb), R(md_twc), R(md_rpn),
+  /* 159 */ R(m_tw), R(mi_dbcam), R(mi_dbram0), R(mi_dbram1),
+  /* 163 */ R(md_dbcam), R(md_dbram0), R(md_dbram1)
 };
 
-/* Note that the 601 has different register numbers for reading and
-   writing RTCU and RTCL.  However, how one reads and writes a
+/* Motorola PowerPC 601.  Note that the 601 has different register numbers
+   for reading and writing RTCU and RTCL.  However, how one reads and writes a
    register is the stub's problem.  */
-char *register_names_601[] =
+static const struct reg registers_601[] =
 {
-  COMMON_UISA_REG_NAMES,
-  PPC_UISA_SPR_NAMES,
-  PPC_SEGMENT_REG_NAMES,
-  PPC_32_OEA_SPR_NAMES,
-  /* 119 */ "hid0", "hid1", "iabr", "dabr", "pir", "mq", "rtcu",
-  /* 126 */ "rtcl"
+  COMMON_UISA_REGS,
+  PPC_UISA_SPRS,
+  PPC_SEGMENT_REGS,
+  PPC_OEA_SPRS,
+  /* 119 */ R(hid0), R(hid1), R(iabr), R(dabr),
+  /* 123 */ R(pir), R(mq), R(rtcu), R(rtcl)
 };
 
-char *register_names_602[] =
+/* Motorola PowerPC 602. */
+static const struct reg registers_602[] =
 {
-  COMMON_UISA_REG_NAMES,
-  PPC_UISA_SPR_NAMES,
-  PPC_SEGMENT_REG_NAMES,
-  PPC_32_OEA_SPR_NAMES,
-  /* 119 */ "hid0", "hid1", "iabr", "", "", "tcr", "ibr", "esassr", "sebr",
-  /* 128 */ "ser", "sp", "lt"
+  COMMON_UISA_REGS,
+  PPC_UISA_SPRS,
+  PPC_SEGMENT_REGS,
+  PPC_OEA_SPRS,
+  /* 119 */ R(hid0), R(hid1), R(iabr), R0,
+  /* 123 */ R0, R(tcr), R(ibr), R(esassr),
+  /* 127 */ R(sebr), R(ser), R(sp), R(lt)
 };
 
-char *register_names_603[] =
+/* Motorola/IBM PowerPC 603 or 603e. */
+static const struct reg registers_603[] =
 {
-  COMMON_UISA_REG_NAMES,
-  PPC_UISA_SPR_NAMES,
-  PPC_SEGMENT_REG_NAMES,
-  PPC_32_OEA_SPR_NAMES,
-  /* 119 */ "hid0", "hid1", "iabr", "", "", "dmiss", "dcmp", "hash1",
-  /* 127 */ "hash2", "imiss", "icmp", "rpa"
+  COMMON_UISA_REGS,
+  PPC_UISA_SPRS,
+  PPC_SEGMENT_REGS,
+  PPC_OEA_SPRS,
+  /* 119 */ R(hid0), R(hid1), R(iabr), R0,
+  /* 123 */ R0, R(dmiss), R(dcmp), R(hash1),
+  /* 127 */ R(hash2), R(imiss), R(icmp), R(rpa)
 };
 
-char *register_names_604[] =
+/* Motorola PowerPC 604 or 604e. */
+static const struct reg registers_604[] =
 {
-  COMMON_UISA_REG_NAMES,
-  PPC_UISA_SPR_NAMES,
-  PPC_SEGMENT_REG_NAMES,
-  PPC_32_OEA_SPR_NAMES,
-  /* 119 */ "hid0", "hid1", "iabr", "dabr", "pir", "mmcr0", "pmc1", "pmc2",
-  /* 127 */ "sia", "sda"
+  COMMON_UISA_REGS,
+  PPC_UISA_SPRS,
+  PPC_SEGMENT_REGS,
+  PPC_OEA_SPRS,
+  /* 119 */ R(hid0), R(hid1), R(iabr), R(dabr),
+  /* 123 */ R(pir), R(mmcr0), R(pmc1), R(pmc2),
+  /* 127 */ R(sia), R(sda)
 };
 
-char *register_names_750[] =
+/* Motorola/IBM PowerPC 750 or 740. */
+static const struct reg registers_750[] =
 {
-  COMMON_UISA_REG_NAMES,
-  PPC_UISA_SPR_NAMES,
-  PPC_SEGMENT_REG_NAMES,
-  PPC_32_OEA_SPR_NAMES,
-  /* 119 */ "hid0", "hid1", "iabr", "dabr", "", "ummcr0", "upmc1", "upmc2",
-  /* 127 */ "usia", "ummcr1", "upmc3", "upmc4", "mmcr0", "pmc1", "pmc2",
-  /* 134 */ "sia", "mmcr1", "pmc3", "pmc4", "l2cr", "ictc", "thrm1", "thrm2",
-  /* 142 */ "thrm3"
+  COMMON_UISA_REGS,
+  PPC_UISA_SPRS,
+  PPC_SEGMENT_REGS,
+  PPC_OEA_SPRS,
+  /* 119 */ R(hid0), R(hid1), R(iabr), R(dabr),
+  /* 123 */ R0, R(ummcr0), R(upmc1), R(upmc2),
+  /* 127 */ R(usia), R(ummcr1), R(upmc3), R(upmc4),
+  /* 131 */ R(mmcr0), R(pmc1), R(pmc2), R(sia),
+  /* 135 */ R(mmcr1), R(pmc3), R(pmc4), R(l2cr),
+  /* 139 */ R(ictc), R(thrm1), R(thrm2), R(thrm3)
 };
 
 
 /* Information about a particular processor variant.  */
+
 struct variant
   {
     /* Name of this variant.  */
@@ -1728,10 +1900,16 @@
     /* English description of the variant.  */
     char *description;
 
+    /* bfd_arch_info.arch corresponding to variant. */
+    enum bfd_architecture arch;
+
+    /* bfd_arch_info.mach corresponding to variant. */
+    unsigned long mach;
+
     /* Table of register names; registers[R] is the name of the register
        number R.  */
-    int num_registers;
-    char **registers;
+    int nregs;
+    const struct reg *regs;
   };
 
 #define num_registers(list) (sizeof (list) / sizeof((list)[0]))
@@ -1747,186 +1925,392 @@
    If you add entries to this table, please be sure to allow the new
    value as an argument to the --with-cpu flag, in configure.in.  */
 
-static struct variant
-  variants[] =
+static const struct variant variants[] =
 {
-  {"ppc-uisa", "PowerPC UISA - a PPC processor as viewed by user-level code",
-   num_registers (register_names_uisa), register_names_uisa},
-  {"rs6000", "IBM RS6000 (\"POWER\") architecture, user-level view",
-   num_registers (register_names_rs6000), register_names_rs6000},
-  {"403", "IBM PowerPC 403",
-   num_registers (register_names_403), register_names_403},
-  {"403GC", "IBM PowerPC 403GC",
-   num_registers (register_names_403GC), register_names_403GC},
-  {"505", "Motorola PowerPC 505",
-   num_registers (register_names_505), register_names_505},
-  {"860", "Motorola PowerPC 860 or 850",
-   num_registers (register_names_860), register_names_860},
-  {"601", "Motorola PowerPC 601",
-   num_registers (register_names_601), register_names_601},
-  {"602", "Motorola PowerPC 602",
-   num_registers (register_names_602), register_names_602},
-  {"603", "Motorola/IBM PowerPC 603 or 603e",
-   num_registers (register_names_603), register_names_603},
-  {"604", "Motorola PowerPC 604 or 604e",
-   num_registers (register_names_604), register_names_604},
-  {"750", "Motorola/IBM PowerPC 750 or 740",
-   num_registers (register_names_750), register_names_750},
+  {"powerpc", "PowerPC user-level", bfd_arch_powerpc,
+   bfd_mach_ppc, num_registers (registers_powerpc), registers_powerpc},
+  {"power", "POWER user-level", bfd_arch_rs6000,
+   bfd_mach_rs6k, num_registers (registers_power), registers_power},
+  {"403", "IBM PowerPC 403", bfd_arch_powerpc,
+   bfd_mach_ppc_403, num_registers (registers_403), registers_403},
+  {"601", "Motorola PowerPC 601", bfd_arch_powerpc,
+   bfd_mach_ppc_601, num_registers (registers_601), registers_601},
+  {"602", "Motorola PowerPC 602", bfd_arch_powerpc,
+   bfd_mach_ppc_602, num_registers (registers_602), registers_602},
+  {"603", "Motorola/IBM PowerPC 603 or 603e", bfd_arch_powerpc,
+   bfd_mach_ppc_603, num_registers (registers_603), registers_603},
+  {"604", "Motorola PowerPC 604 or 604e", bfd_arch_powerpc,
+   604, num_registers (registers_604), registers_604},
+  {"403GC", "IBM PowerPC 403GC", bfd_arch_powerpc,
+   bfd_mach_ppc_403gc, num_registers (registers_403GC), registers_403GC},
+  {"505", "Motorola PowerPC 505", bfd_arch_powerpc,
+   bfd_mach_ppc_505, num_registers (registers_505), registers_505},
+  {"860", "Motorola PowerPC 860 or 850", bfd_arch_powerpc,
+   bfd_mach_ppc_860, num_registers (registers_860), registers_860},
+  {"750", "Motorola/IBM PowerPC 750 or 740", bfd_arch_powerpc,
+   bfd_mach_ppc_750, num_registers (registers_750), registers_750},
+
+  /* FIXME: I haven't checked the register sets of the following. */
+  {"620", "Motorola PowerPC 620", bfd_arch_powerpc,
+   bfd_mach_ppc_620, num_registers (registers_powerpc), registers_powerpc},
+  {"a35", "PowerPC A35", bfd_arch_powerpc,
+   bfd_mach_ppc_a35, num_registers (registers_powerpc), registers_powerpc},
+  {"rs1", "IBM POWER RS1", bfd_arch_rs6000,
+   bfd_mach_rs6k_rs1, num_registers (registers_power), registers_power},
+  {"rsc", "IBM POWER RSC", bfd_arch_rs6000,
+   bfd_mach_rs6k_rsc, num_registers (registers_power), registers_power},
+  {"rs2", "IBM POWER RS2", bfd_arch_rs6000,
+   bfd_mach_rs6k_rs2, num_registers (registers_power), registers_power},
+
   {0, 0, 0, 0}
 };
 
-
-static struct variant *current_variant;
-
-char *
-rs6000_register_name (int i)
-{
-  if (i < 0 || i >= NUM_REGS)
-    error ("GDB bug: rs6000-tdep.c (rs6000_register_name): strange register number");
-
-  return ((i < current_variant->num_registers)
-	  ? current_variant->registers[i]
-	  : "");
-}
-
-
-static void
-install_variant (struct variant *v)
-{
-  current_variant = v;
-}
-
+#undef num_registers
 
 /* Look up the variant named NAME in the `variants' table.  Return a
    pointer to the struct variant, or null if we couldn't find it.  */
-static struct variant *
+
+static const struct variant *
 find_variant_by_name (char *name)
 {
-  int i;
+  const struct variant *v;
 
-  for (i = 0; variants[i].name; i++)
-    if (!strcmp (name, variants[i].name))
-      return &variants[i];
+  for (v = variants; v->name; v++)
+    if (!strcmp (name, v->name))
+      return v;
 
-  return 0;
+  return NULL;
 }
 
+/* Return the variant corresponding to architecture ARCH and machine number
+   MACH.  If no such variant exists, return null. */
 
-/* Install the PPC/RS6000 variant named NAME in the `variants' table.
-   Return zero if we installed it successfully, or a non-zero value if
-   we couldn't do it.
-
-   This might be useful to code outside this file, which doesn't want
-   to depend on the exact indices of the entries in the `variants'
-   table.  Just make it non-static if you want that.  */
-static int
-install_variant_by_name (char *name)
+static const struct variant *
+find_variant_by_arch (enum bfd_architecture arch, unsigned long mach)
 {
-  struct variant *v = find_variant_by_name (name);
+  const struct variant *v;
 
-  if (v)
-    {
-      install_variant (v);
-      return 0;
-    }
-  else
-    return 1;
+  for (v = variants; v->name; v++)
+    if (arch == v->arch && mach == v->mach)
+      return v;
+
+  return NULL;
 }
 
 
-static void
-list_variants ()
-{
-  int i;
-
-  printf_filtered ("GDB knows about the following PowerPC and RS6000 variants:\n");
-
-  for (i = 0; variants[i].name; i++)
-    printf_filtered ("  %-8s  %s\n",
-		     variants[i].name, variants[i].description);
-}
-
-
-static void
-show_current_variant ()
-{
-  printf_filtered ("PowerPC / RS6000 processor variant is set to `%s'.\n",
-		   current_variant->name);
-}
-
-
-static void
-set_processor (char *arg, int from_tty)
-{
-  if (!arg || arg[0] == '\0')
-    {
-      list_variants ();
-      return;
-    }
-
-  if (install_variant_by_name (arg))
-    {
-      error_begin ();
-      fprintf_filtered (gdb_stderr,
-	"`%s' is not a recognized PowerPC / RS6000 variant name.\n\n", arg);
-      list_variants ();
-      return_to_top_level (RETURN_ERROR);
-    }
-
-  show_current_variant ();
-}
-
-static void
-show_processor (char *arg, int from_tty)
-{
-  show_current_variant ();
-}
-
 
 
+static void
+process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
+{
+  int *os_ident_ptr = obj;
+  const char *name;
+  unsigned int sectsize;
+
+  name = bfd_get_section_name (abfd, sect);
+  sectsize = bfd_section_size (abfd, sect);
+  if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0)
+    {
+      unsigned int name_length, data_length, note_type;
+      char *note = alloca (sectsize);
+
+      bfd_get_section_contents (abfd, sect, note,
+                                (file_ptr) 0, (bfd_size_type) sectsize);
+
+      name_length = bfd_h_get_32 (abfd, note);
+      data_length = bfd_h_get_32 (abfd, note + 4);
+      note_type   = bfd_h_get_32 (abfd, note + 8);
+
+      if (name_length == 4 && data_length == 16 && note_type == 1
+          && strcmp (note + 12, "GNU") == 0)
+	{
+	  int os_number = bfd_h_get_32 (abfd, note + 16);
+
+	  /* The case numbers are from abi-tags in glibc */
+	  switch (os_number)
+	    {
+	    case 0 :
+	      *os_ident_ptr = ELFOSABI_LINUX;
+	      break;
+	    case 1 :
+	      *os_ident_ptr = ELFOSABI_HURD;
+	      break;
+	    case 2 :
+	      *os_ident_ptr = ELFOSABI_SOLARIS;
+	      break;
+	    default :
+	      internal_error (
+		"process_note_abi_sections: unknown OS number %d", os_number);
+	      break;
+	    }
+	}
+    }
+}
+
+/* Return one of the ELFOSABI_ constants for BFDs representing ELF
+   executables.  If it's not an ELF executable or if the OS/ABI couldn't
+   be determined, simply return -1. */
+
+static int
+get_elfosabi (bfd *abfd)
+{
+  int elfosabi = -1;
+
+  if (abfd != NULL && bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+    {
+      elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
+
+      /* When elfosabi is 0 (ELFOSABI_NONE), this is supposed to indicate
+         that we're on a SYSV system.  However, GNU/Linux uses a note section
+	 to record OS/ABI info, but leaves e_ident[EI_OSABI] zero.  So we
+	 have to check the note sections too. */
+      if (elfosabi == 0)
+	{
+	  bfd_map_over_sections (abfd,
+	                         process_note_abi_tag_sections,
+				 &elfosabi);
+	}
+    }
+
+  return elfosabi;
+}
+
+
+
+/* Initialize the current architecture based on INFO.  If possible, re-use an
+   architecture from ARCHES, which is a list of architectures already created
+   during this debugging session.
+
+   Called e.g. at program startup, when reading a core file, and when reading
+   a binary file. */
+
+static struct gdbarch *
+rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
+{
+  struct gdbarch *gdbarch;
+  struct gdbarch_tdep *tdep;
+  int wordsize, from_xcoff_exec, from_elf_exec, power, i, off;
+  struct reg *regs;
+  const struct variant *v;
+  enum bfd_architecture arch;
+  unsigned long mach;
+  bfd abfd;
+  int osabi, sysv_abi;
+
+  from_xcoff_exec = info.abfd && info.abfd->format == bfd_object &&
+    bfd_get_flavour (info.abfd) == bfd_target_xcoff_flavour;
+
+  from_elf_exec = info.abfd && info.abfd->format == bfd_object &&
+    bfd_get_flavour (info.abfd) == bfd_target_elf_flavour;
+
+  sysv_abi = info.abfd && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour;
+
+  osabi = get_elfosabi (info.abfd);
+
+  /* Check word size.  If INFO is from a binary file, infer it from that,
+     else use the previously-inferred size. */
+  if (from_xcoff_exec)
+    {
+      if (xcoff_data (info.abfd)->xcoff64)
+	wordsize = 8;
+      else
+	wordsize = 4;
+    }
+  else if (from_elf_exec)
+    {
+      if (elf_elfheader (info.abfd)->e_ident[EI_CLASS] == ELFCLASS64)
+	wordsize = 8;
+      else
+	wordsize = 4;
+    }
+  else
+    {
+      tdep = TDEP;
+      if (tdep)
+	wordsize = tdep->wordsize;
+      else
+	wordsize = 4;
+    }
+
+  /* Find a candidate among extant architectures. */
+  for (arches = gdbarch_list_lookup_by_info (arches, &info);
+       arches != NULL;
+       arches = gdbarch_list_lookup_by_info (arches->next, &info))
+    {
+      /* Word size in the various PowerPC bfd_arch_info structs isn't
+         meaningful, because 64-bit CPUs can run in 32-bit mode.  So, perform
+         separate word size check. */
+      tdep = gdbarch_tdep (arches->gdbarch);
+      if (tdep && tdep->wordsize == wordsize && tdep->osabi == osabi)
+	return arches->gdbarch;
+    }
+
+  /* None found, create a new architecture from INFO, whose bfd_arch_info
+     validity depends on the source:
+       - executable		useless
+       - rs6000_host_arch()	good
+       - core file		good
+       - "set arch"		trust blindly
+       - GDB startup		useless but harmless */
+
+  if (!from_xcoff_exec)
+    {
+      arch = info.bfd_architecture;
+      mach = info.bfd_arch_info->mach;
+    }
+  else
+    {
+      arch = bfd_arch_powerpc;
+      mach = 0;
+      bfd_default_set_arch_mach (&abfd, arch, mach);
+      info.bfd_arch_info = bfd_get_arch_info (&abfd);
+    }
+  tdep = xmalloc (sizeof (struct gdbarch_tdep));
+  tdep->wordsize = wordsize;
+  tdep->osabi = osabi;
+  gdbarch = gdbarch_alloc (&info, tdep);
+  power = arch == bfd_arch_rs6000;
+
+  /* Select instruction printer. */
+  tm_print_insn = arch == power ? print_insn_rs6000 :
+    info.byte_order == BIG_ENDIAN ? print_insn_big_powerpc :
+      print_insn_little_powerpc;
+
+  /* Choose variant. */
+  v = find_variant_by_arch (arch, mach);
+  if (!v)
+    v = find_variant_by_name (power ? "power" : "powerpc");
+  tdep->regs = v->regs;
+
+  /* Calculate byte offsets in raw register array. */
+  tdep->regoff = xmalloc (v->nregs * sizeof (int));
+  for (i = off = 0; i < v->nregs; i++)
+    {
+      tdep->regoff[i] = off;
+      off += regsize (v->regs + i, wordsize);
+    }
+
+  set_gdbarch_read_pc (gdbarch, generic_target_read_pc);
+  set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
+  set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
+  set_gdbarch_write_fp (gdbarch, generic_target_write_fp);
+  set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
+  set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+
+  set_gdbarch_num_regs (gdbarch, v->nregs);
+  set_gdbarch_sp_regnum (gdbarch, 1);
+  set_gdbarch_fp_regnum (gdbarch, 1);
+  set_gdbarch_pc_regnum (gdbarch, 64);
+  set_gdbarch_register_name (gdbarch, rs6000_register_name);
+  set_gdbarch_register_size (gdbarch, wordsize);
+  set_gdbarch_register_bytes (gdbarch, off);
+  set_gdbarch_register_byte (gdbarch, rs6000_register_byte);
+  set_gdbarch_register_raw_size (gdbarch, rs6000_register_raw_size);
+  set_gdbarch_max_register_raw_size (gdbarch, 8);
+  set_gdbarch_register_virtual_size (gdbarch, rs6000_register_virtual_size);
+  set_gdbarch_max_register_virtual_size (gdbarch, 8);
+  set_gdbarch_register_virtual_type (gdbarch, rs6000_register_virtual_type);
+
+  set_gdbarch_ptr_bit (gdbarch, wordsize * TARGET_CHAR_BIT);
+  set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
+  set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
+  set_gdbarch_long_bit (gdbarch, wordsize * 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_use_generic_dummy_frames (gdbarch, 1);
+  set_gdbarch_call_dummy_length (gdbarch, 0);
+  set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
+  set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
+  set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
+  set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
+  set_gdbarch_call_dummy_start_offset (gdbarch, 0);
+  set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy);
+  set_gdbarch_call_dummy_p (gdbarch, 1);
+  set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
+  set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
+  set_gdbarch_fix_call_dummy (gdbarch, rs6000_fix_call_dummy);
+  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
+  set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+  set_gdbarch_push_return_address (gdbarch, ppc_push_return_address);
+  set_gdbarch_believe_pcc_promotion (gdbarch, 1);
+  set_gdbarch_coerce_float_to_double (gdbarch, rs6000_coerce_float_to_double);
+
+  set_gdbarch_register_convertible (gdbarch, rs6000_register_convertible);
+  set_gdbarch_register_convert_to_virtual (gdbarch, rs6000_register_convert_to_virtual);
+  set_gdbarch_register_convert_to_raw (gdbarch, rs6000_register_convert_to_raw);
+
+  set_gdbarch_extract_return_value (gdbarch, rs6000_extract_return_value);
+  
+  if (sysv_abi)
+    set_gdbarch_push_arguments (gdbarch, ppc_sysv_abi_push_arguments);
+  else
+    set_gdbarch_push_arguments (gdbarch, rs6000_push_arguments);
+
+  set_gdbarch_store_struct_return (gdbarch, rs6000_store_struct_return);
+  set_gdbarch_store_return_value (gdbarch, rs6000_store_return_value);
+  set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address);
+  set_gdbarch_use_struct_convention (gdbarch, generic_use_struct_convention);
+
+  set_gdbarch_pop_frame (gdbarch, rs6000_pop_frame);
+
+  set_gdbarch_skip_prologue (gdbarch, rs6000_skip_prologue);
+  set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
+  set_gdbarch_decr_pc_after_break (gdbarch, 0);
+  set_gdbarch_function_start_offset (gdbarch, 0);
+  set_gdbarch_breakpoint_from_pc (gdbarch, rs6000_breakpoint_from_pc);
+
+  /* Not sure on this. FIXMEmgo */
+  set_gdbarch_frame_args_skip (gdbarch, 8);
+
+  set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid);
+  if (osabi == ELFOSABI_LINUX)
+    {
+      set_gdbarch_frameless_function_invocation (gdbarch,
+	ppc_linux_frameless_function_invocation);
+      set_gdbarch_frame_chain (gdbarch, ppc_linux_frame_chain);
+      set_gdbarch_frame_saved_pc (gdbarch, ppc_linux_frame_saved_pc);
+
+      set_gdbarch_frame_init_saved_regs (gdbarch,
+	                                 ppc_linux_frame_init_saved_regs);
+      set_gdbarch_init_extra_frame_info (gdbarch,
+	                                 ppc_linux_init_extra_frame_info);
+
+      set_gdbarch_memory_remove_breakpoint (gdbarch,
+	                                    ppc_linux_memory_remove_breakpoint);
+    }
+  else
+    {
+      set_gdbarch_frameless_function_invocation (gdbarch,
+	rs6000_frameless_function_invocation);
+      set_gdbarch_frame_chain (gdbarch, rs6000_frame_chain);
+      set_gdbarch_frame_saved_pc (gdbarch, rs6000_frame_saved_pc);
+
+      set_gdbarch_frame_init_saved_regs (gdbarch, rs6000_frame_init_saved_regs);
+      set_gdbarch_init_extra_frame_info (gdbarch, rs6000_init_extra_frame_info);
+
+      /* Handle RS/6000 function pointers.  */
+      set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+	rs6000_convert_from_func_ptr_addr);
+    }
+  set_gdbarch_frame_args_address (gdbarch, rs6000_frame_args_address);
+  set_gdbarch_frame_locals_address (gdbarch, rs6000_frame_args_address);
+  set_gdbarch_saved_pc_after_call (gdbarch, rs6000_saved_pc_after_call);
+
+  /* We can't tell how many args there are
+     now that the C compiler delays popping them.  */
+  set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
+
+  return gdbarch;
+}
 
 /* Initialization code.  */
 
 void
-_initialize_rs6000_tdep ()
+_initialize_rs6000_tdep (void)
 {
-  /* FIXME, this should not be decided via ifdef. */
-#ifdef GDB_TARGET_POWERPC
-  tm_print_insn = gdb_print_insn_powerpc;
-#else
-  tm_print_insn = print_insn_rs6000;
-#endif
-
-  /* I don't think we should use the set/show command arrangement
-     here, because the way that's implemented makes it hard to do the
-     error checking we want in a reasonable way.  So we just add them
-     as two separate commands.  */
-  add_cmd ("processor", class_support, set_processor,
-	   "`set processor NAME' sets the PowerPC/RS6000 variant to NAME.\n\
-If you set this, GDB will know about the special-purpose registers that are\n\
-available on the given variant.\n\
-Type `set processor' alone for a list of recognized variant names.",
-	   &setlist);
-  add_cmd ("processor", class_support, show_processor,
-	   "Show the variant of the PowerPC or RS6000 processor in use.\n\
-Use `set processor' to change this.",
-	   &showlist);
-
-  /* Set the current PPC processor variant.  */
-  {
-    int status = 1;
-
-#ifdef TARGET_CPU_DEFAULT
-    status = install_variant_by_name (TARGET_CPU_DEFAULT);
-#endif
-
-    if (status)
-      {
-#ifdef GDB_TARGET_POWERPC
-	install_variant_by_name ("ppc-uisa");
-#else
-	install_variant_by_name ("rs6000");
-#endif
-      }
-  }
+  register_gdbarch_init (bfd_arch_rs6000, rs6000_gdbarch_init);
+  register_gdbarch_init (bfd_arch_powerpc, rs6000_gdbarch_init);
 }
diff --git a/gdb/scm-exp.c b/gdb/scm-exp.c
index 43cb4d8..c2b8c35 100644
--- a/gdb/scm-exp.c
+++ b/gdb/scm-exp.c
@@ -39,10 +39,7 @@
 static void scm_lreadr (int);
 
 static LONGEST
-scm_istr2int (str, len, radix)
-     char *str;
-     int len;
-     int radix;
+scm_istr2int (char *str, int len, int radix)
 {
   int i = 0;
   LONGEST inum = 0;
@@ -107,10 +104,7 @@
 }
 
 static LONGEST
-scm_istring2number (str, len, radix)
-     char *str;
-     int len;
-     int radix;
+scm_istring2number (char *str, int len, int radix)
 {
   int i = 0;
   char ex = 0;
@@ -184,9 +178,7 @@
 }
 
 static void
-scm_read_token (c, weird)
-     int c;
-     int weird;
+scm_read_token (int c, int weird)
 {
   while (1)
     {
@@ -243,7 +235,7 @@
 }
 
 static int
-scm_skip_ws ()
+scm_skip_ws (void)
 {
   register int c;
   while (1)
@@ -275,8 +267,7 @@
 }
 
 static void
-scm_lreadparen (skipping)
-     int skipping;
+scm_lreadparen (int skipping)
 {
   for (;;)
     {
@@ -291,8 +282,7 @@
 }
 
 static void
-scm_lreadr (skipping)
-     int skipping;
+scm_lreadr (int skipping)
 {
   int c, j;
   struct stoken str;
@@ -487,7 +477,7 @@
 }
 
 int
-scm_parse ()
+scm_parse (void)
 {
   char *start;
   while (*lexptr == ' ')
diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c
index d38eb4e..39aaa06 100644
--- a/gdb/scm-lang.c
+++ b/gdb/scm-lang.c
@@ -45,27 +45,20 @@
 struct type *builtin_type_scm;
 
 void
-scm_printchar (c, stream)
-     int c;
-     struct ui_file *stream;
+scm_printchar (int c, struct ui_file *stream)
 {
   fprintf_filtered (stream, "#\\%c", c);
 }
 
 static void
-scm_printstr (stream, string, length, width, force_ellipses)
-     struct ui_file *stream;
-     char *string;
-     unsigned int length;
-     int width;
-     int force_ellipses;
+scm_printstr (struct ui_file *stream, char *string, unsigned int length,
+	      int width, int force_ellipses)
 {
   fprintf_filtered (stream, "\"%s\"", string);
 }
 
 int
-is_scmvalue_type (type)
-     struct type *type;
+is_scmvalue_type (struct type *type)
 {
   if (TYPE_CODE (type) == TYPE_CODE_INT
       && TYPE_NAME (type) && strcmp (TYPE_NAME (type), "SCM") == 0)
@@ -79,9 +72,7 @@
    of the 0'th one.  */
 
 LONGEST
-scm_get_field (svalue, index)
-     LONGEST svalue;
-     int index;
+scm_get_field (LONGEST svalue, int index)
 {
   char buffer[20];
   read_memory (SCM2PTR (svalue) + index * TYPE_LENGTH (builtin_type_scm),
@@ -94,10 +85,7 @@
    or Boolean (CONTEXT == TYPE_CODE_BOOL).  */
 
 LONGEST
-scm_unpack (type, valaddr, context)
-     struct type *type;
-     char *valaddr;
-     enum type_code context;
+scm_unpack (struct type *type, char *valaddr, enum type_code context)
 {
   if (is_scmvalue_type (type))
     {
@@ -142,7 +130,7 @@
 /* True if we're correctly in Guile's eval.c (the evaluator and apply). */
 
 static int
-in_eval_c ()
+in_eval_c (void)
 {
   if (current_source_symtab && current_source_symtab->filename)
     {
@@ -159,8 +147,7 @@
    function), then try lookup_symbol for compiled variables. */
 
 static value_ptr
-scm_lookup_name (str)
-     char *str;
+scm_lookup_name (char *str)
 {
   value_ptr args[3];
   int len = strlen (str);
@@ -195,9 +182,7 @@
 }
 
 value_ptr
-scm_evaluate_string (str, len)
-     char *str;
-     int len;
+scm_evaluate_string (char *str, int len)
 {
   value_ptr func;
   value_ptr addr = value_allocate_space_in_inferior (len + 1);
@@ -210,11 +195,8 @@
 }
 
 static value_ptr
-evaluate_subexp_scm (expect_type, exp, pos, noside)
-     struct type *expect_type;
-     register struct expression *exp;
-     register int *pos;
-     enum noside noside;
+evaluate_subexp_scm (struct type *expect_type, register struct expression *exp,
+		     register int *pos, enum noside noside)
 {
   enum exp_opcode op = exp->elts[*pos].opcode;
   int len, pc;
@@ -251,6 +233,7 @@
   c_builtin_types,
   range_check_off,
   type_check_off,
+  case_sensitive_off,
   scm_parse,
   c_error,
   evaluate_subexp_scm,
@@ -273,7 +256,7 @@
 };
 
 void
-_initialize_scheme_language ()
+_initialize_scheme_language (void)
 {
   add_language (&scm_language_defn);
   builtin_type_scm = init_type (TYPE_CODE_INT,
diff --git a/gdb/scm-valprint.c b/gdb/scm-valprint.c
index 802751f..1c9b835 100644
--- a/gdb/scm-valprint.c
+++ b/gdb/scm-valprint.c
@@ -45,13 +45,8 @@
    print VALUE. */
 
 static int
-scm_inferior_print (value, stream, format, deref_ref, recurse, pretty)
-     LONGEST value;
-     struct ui_file *stream;
-     int format;
-     int deref_ref;
-     int recurse;
-     enum val_prettyprint pretty;
+scm_inferior_print (LONGEST value, struct ui_file *stream, int format,
+		    int deref_ref, int recurse, enum val_prettyprint pretty)
 {
   return -1;
 }
@@ -96,13 +91,8 @@
 };
 
 static void
-scm_scmlist_print (svalue, stream, format, deref_ref, recurse, pretty)
-     LONGEST svalue;
-     struct ui_file *stream;
-     int format;
-     int deref_ref;
-     int recurse;
-     enum val_prettyprint pretty;
+scm_scmlist_print (LONGEST svalue, struct ui_file *stream, int format,
+		   int deref_ref, int recurse, enum val_prettyprint pretty)
 {
   unsigned int more = print_max;
   if (recurse > 6)
@@ -135,10 +125,7 @@
 }
 
 static void
-scm_ipruk (hdr, ptr, stream)
-     char *hdr;
-     LONGEST ptr;
-     struct ui_file *stream;
+scm_ipruk (char *hdr, LONGEST ptr, struct ui_file *stream)
 {
   fprintf_filtered (stream, "#<unknown-%s", hdr);
 #define SCM_SIZE TYPE_LENGTH (builtin_type_scm)
@@ -149,13 +136,8 @@
 }
 
 void
-scm_scmval_print (svalue, stream, format, deref_ref, recurse, pretty)
-     LONGEST svalue;
-     struct ui_file *stream;
-     int format;
-     int deref_ref;
-     int recurse;
-     enum val_prettyprint pretty;
+scm_scmval_print (LONGEST svalue, struct ui_file *stream, int format,
+		  int deref_ref, int recurse, enum val_prettyprint pretty)
 {
 taloop:
   switch (7 & (int) svalue)
@@ -376,17 +358,9 @@
 }
 
 int
-scm_val_print (type, valaddr, embedded_offset, address,
-	       stream, format, deref_ref, recurse, pretty)
-     struct type *type;
-     char *valaddr;
-     int embedded_offset;
-     CORE_ADDR address;
-     struct ui_file *stream;
-     int format;
-     int deref_ref;
-     int recurse;
-     enum val_prettyprint pretty;
+scm_val_print (struct type *type, char *valaddr, int embedded_offset,
+	       CORE_ADDR address, struct ui_file *stream, int format,
+	       int deref_ref, int recurse, enum val_prettyprint pretty)
 {
   if (is_scmvalue_type (type))
     {
@@ -412,11 +386,8 @@
 }
 
 int
-scm_value_print (val, stream, format, pretty)
-     value_ptr val;
-     struct ui_file *stream;
-     int format;
-     enum val_prettyprint pretty;
+scm_value_print (value_ptr val, struct ui_file *stream, int format,
+		 enum val_prettyprint pretty)
 {
   return (val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0,
 		     VALUE_ADDRESS (val), stream, format, 1, 0, pretty));
diff --git a/gdb/ser-e7kpc.c b/gdb/ser-e7kpc.c
index c7b23aa..9defa6e 100644
--- a/gdb/ser-e7kpc.c
+++ b/gdb/ser-e7kpc.c
@@ -160,7 +160,7 @@
 #endif /* _MSC_VER */
 
 static int
-e7000pc_init ()
+e7000pc_init (void)
 {
   int try;
   unsigned long dsbase;
@@ -255,12 +255,7 @@
    that TIMEOUT == 0 is a poll, and TIMEOUT == -1 means wait forever. */
 
 static int
-dosasync_read (fd, buf, len, timeout)
-     int fd;
-     char *buf;
-     int len;
-     int timeout;
-
+dosasync_read (int fd, char *buf, int len, int timeout)
 {
   long now;
   long then;
@@ -301,10 +296,7 @@
 
 
 static int
-dosasync_write (fd, buf, len)
-     int fd;
-     const char *buf;
-     int len;
+dosasync_write (int fd, const char *buf, int len)
 {
   int i;
   char dummy[1000];
@@ -332,9 +324,7 @@
 }
 
 static int
-e7000pc_open (scb, name)
-     serial_t scb;
-     const char *name;
+e7000pc_open (serial_t scb, const char *name)
 {
   if (strncasecmp (name, "pc", 2) != 0)
     {
@@ -351,23 +341,19 @@
 }
 
 static int
-e7000pc_noop (scb)
-     serial_t scb;
+e7000pc_noop (serial_t scb)
 {
   return 0;
 }
 
 static void
-e7000pc_raw (scb)
-     serial_t scb;
+e7000pc_raw (serial_t scb)
 {
   /* Always in raw mode */
 }
 
 static int
-e7000pc_readchar (scb, timeout)
-     serial_t scb;
-     int timeout;
+e7000pc_readchar (serial_t scb, int timeout)
 {
   char buf;
 
@@ -392,8 +378,7 @@
    vector.  Someday, they may do something real... */
 
 static serial_ttystate
-e7000pc_get_tty_state (scb)
-     serial_t scb;
+e7000pc_get_tty_state (serial_t scb)
 {
   struct e7000pc_ttystate *state;
 
@@ -403,18 +388,14 @@
 }
 
 static int
-e7000pc_set_tty_state (scb, ttystate)
-     serial_t scb;
-     serial_ttystate ttystate;
+e7000pc_set_tty_state (serial_t scb, serial_ttystate ttystate)
 {
   return 0;
 }
 
 static int
-e7000pc_noflush_set_tty_state (scb, new_ttystate, old_ttystate)
-     serial_t scb;
-     serial_ttystate new_ttystate;
-     serial_ttystate old_ttystate;
+e7000pc_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate,
+			       serial_ttystate old_ttystate)
 {
   return 0;
 }
@@ -429,18 +410,19 @@
 }
 
 static int
-e7000pc_setbaudrate (scb, rate)
-     serial_t scb;
-     int rate;
+e7000pc_setbaudrate (serial_t scb, int rate)
 {
   return 0;
 }
 
 static int
-e7000pc_write (scb, str, len)
-     serial_t scb;
-     const char *str;
-     int len;
+e7000pc_setstopbits (serial_t scb, int rate)
+{
+  return 0;
+}
+
+static int
+e7000pc_write (serial_t scb, const char *str, int len)
 {
   dosasync_write (scb->fd, str, len);
 
@@ -448,8 +430,7 @@
 }
 
 static void
-e7000pc_close (scb)
-     serial_t scb;
+e7000pc_close (serial_t scb)
 {
 }
 
@@ -470,18 +451,19 @@
   e7000pc_print_tty_state,
   e7000pc_noflush_set_tty_state,
   e7000pc_setbaudrate,
+  e7000pc_setstopbits,
   e7000pc_noop,			/* wait for output to drain */
 };
 
 void
-_initialize_ser_e7000pc ()
+_initialize_ser_e7000pc (void)
 {
   serial_add_interface (&e7000pc_ops);
 }
 #else
 
 void
-_initialize_ser_e7000pc ()
+_initialize_ser_e7000pc (void)
 {
 
 }
diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c
index a8f09e7..8a19dd4 100644
--- a/gdb/ser-go32.c
+++ b/gdb/ser-go32.c
@@ -247,8 +247,7 @@
 
 
 static int
-dos_getc (port)
-     volatile struct dos_ttystate *port;
+dos_getc (volatile struct dos_ttystate *port)
 {
   int c;
 
@@ -265,9 +264,7 @@
 
 
 static int
-dos_putc (c, port)
-     int c;
-     struct dos_ttystate *port;
+dos_putc (int c, struct dos_ttystate *port)
 {
   if (port->count >= CBSIZE - 1)
     return -1;
@@ -279,8 +276,7 @@
 
 
 static void
-dos_comisr (irq)
-     int irq;
+dos_comisr (int irq)
 {
   struct dos_ttystate *port;
   unsigned char iir, lsr, c;
@@ -436,8 +432,7 @@
 
 
 static void
-dos_unhookirq (intr)
-     struct intrupt *intr;
+dos_unhookirq (struct intrupt *intr)
 {
   unsigned int irq, vec;
   unsigned char mask;
@@ -464,9 +459,7 @@
 
 
 static int
-dos_open (scb, name)
-     serial_t scb;
-     const char *name;
+dos_open (serial_t scb, const char *name)
 {
   struct dos_ttystate *port;
   int fd, i;
@@ -570,8 +563,7 @@
 
 
 static void
-dos_close (scb)
-     serial_t scb;
+dos_close (serial_t scb)
 {
   struct dos_ttystate *port;
   struct intrupt *intrupt;
@@ -625,9 +617,7 @@
 }
 
 static int
-dos_readchar (scb, timeout)
-     serial_t scb;
-     int timeout;
+dos_readchar (serial_t scb, int timeout)
 {
   struct dos_ttystate *port = &ports[scb->fd];
   long then;
@@ -646,8 +636,7 @@
 
 
 static serial_ttystate
-dos_get_tty_state (scb)
-     serial_t scb;
+dos_get_tty_state (serial_t scb)
 {
   struct dos_ttystate *port = &ports[scb->fd];
   struct dos_ttystate *state;
@@ -671,9 +660,7 @@
 }
 
 static int
-dos_set_tty_state (scb, ttystate)
-     serial_t scb;
-     serial_ttystate ttystate;
+dos_set_tty_state (serial_t scb, serial_ttystate ttystate)
 {
   struct dos_ttystate *state;
 
@@ -694,8 +681,7 @@
 }
 
 static int
-dos_flush_input (scb)
-     serial_t scb;
+dos_flush_input (serial_t scb)
 {
   struct dos_ttystate *port = &ports[scb->fd];
   disable ();
@@ -716,8 +702,7 @@
 }
 
 static int
-dos_baudconv (rate)
-     int rate;
+dos_baudconv (int rate)
 {
   long x, err;
 
@@ -740,9 +725,7 @@
 
 
 static int
-dos_setbaudrate (scb, rate)
-     serial_t scb;
-     int rate;
+dos_setbaudrate (serial_t scb, int rate)
 {
   struct dos_ttystate *port = &ports[scb->fd];
 
@@ -774,9 +757,7 @@
 }
 
 static int
-dos_setstopbits (scb, num)
-     serial_t scb;
-     int num;
+dos_setstopbits (serial_t scb, int num)
 {
   struct dos_ttystate *port = &ports[scb->fd];
   unsigned char cfcr;
@@ -803,10 +784,7 @@
 }
 
 static int
-dos_write (scb, str, len)
-     serial_t scb;
-     const char *str;
-     int len;
+dos_write (serial_t scb, const char *str, int len)
 {
   volatile struct dos_ttystate *port = &ports[scb->fd];
   int fifosize = port->fifo ? 16 : 1;
@@ -840,8 +818,7 @@
 
 
 static int
-dos_sendbreak (scb)
-     serial_t scb;
+dos_sendbreak (serial_t scb)
 {
   volatile struct dos_ttystate *port = &ports[scb->fd];
   unsigned char cfcr;
@@ -914,7 +891,7 @@
 
 
 void
-_initialize_ser_dos ()
+_initialize_ser_dos (void)
 {
   serial_add_interface (&dos_ops);
 
diff --git a/gdb/ser-mac.c b/gdb/ser-mac.c
index e5d34b6..7e18e26 100644
--- a/gdb/ser-mac.c
+++ b/gdb/ser-mac.c
@@ -52,9 +52,7 @@
 char *mac_output_buffer;
 
 static int
-mac_open (scb, name)
-     serial_t scb;
-     const char *name;
+mac_open (serial_t scb, const char *name)
 {
   OSErr err;
 
@@ -131,15 +129,13 @@
 }
 
 static int
-mac_noop (scb)
-     serial_t scb;
+mac_noop (serial_t scb)
 {
   return 0;
 }
 
 static void
-mac_raw (scb)
-     serial_t scb;
+mac_raw (serial_t scb)
 {
   /* Always effectively in raw mode. */
 }
@@ -150,9 +146,7 @@
    dead, or -3 for any other error (see errno in that case). */
 
 static int
-mac_readchar (scb, timeout)
-     serial_t scb;
-     int timeout;
+mac_readchar (serial_t scb, int timeout)
 {
   int status, n;
   /* time_t */ unsigned long start_time, now;
@@ -204,8 +198,7 @@
    vector.  Someday, they may do something real... */
 
 static serial_ttystate
-mac_get_tty_state (scb)
-     serial_t scb;
+mac_get_tty_state (serial_t scb)
 {
   struct mac_ttystate *state;
 
@@ -215,18 +208,14 @@
 }
 
 static int
-mac_set_tty_state (scb, ttystate)
-     serial_t scb;
-     serial_ttystate ttystate;
+mac_set_tty_state (serial_t scb, serial_ttystate ttystate)
 {
   return 0;
 }
 
 static int
-mac_noflush_set_tty_state (scb, new_ttystate, old_ttystate)
-     serial_t scb;
-     serial_ttystate new_ttystate;
-     serial_ttystate old_ttystate;
+mac_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate,
+			   serial_ttystate old_ttystate)
 {
   return 0;
 }
@@ -305,9 +294,7 @@
 };
 
 static int
-mac_set_baud_rate (scb, rate)
-     serial_t scb;
-     int rate;
+mac_set_baud_rate (serial_t scb, int rate)
 {
   int i, bits;
 
@@ -324,9 +311,7 @@
 }
 
 static int
-mac_set_stop_bits (scb, num)
-     serial_t scb;
-     int num;
+mac_set_stop_bits (serial_t scb, int num)
 {
   return 0;
 }
@@ -334,10 +319,7 @@
 int first_mac_write = 0;
 
 static int
-mac_write (scb, str, len)
-     serial_t scb;
-     const char *str;
-     int len;
+mac_write (serial_t scb, const char *str, int len)
 {
   OSErr err;
   IOParam pb;
@@ -398,7 +380,7 @@
 };
 
 void
-_initialize_ser_mac ()
+_initialize_ser_mac (void)
 {
   serial_add_interface (&mac_ops);
 }
diff --git a/gdb/ser-ocd.c b/gdb/ser-ocd.c
index c5c7103..9ce7519 100644
--- a/gdb/ser-ocd.c
+++ b/gdb/ser-ocd.c
@@ -34,9 +34,7 @@
 #endif
 
 static int
-ocd_open (scb, name)
-     serial_t scb;
-     const char *name;
+ocd_open (serial_t scb, const char *name)
 {
 #ifdef _WIN32
   /* Find the wiggler DLL which talks to the board.  */
@@ -49,7 +47,7 @@
       if (handle == NULL)
 	error ("Can't load Wigglers.dll");
 
-      dll_do_command = ((int (*)PARAMS ((const char *, char *)))
+      dll_do_command = ((int (*) (const char *, char *))
 			GetProcAddress (handle, "do_command"));
       if (dll_do_command == NULL)
 	error ("Can't find do_command function in Wigglers.dll");
@@ -62,15 +60,13 @@
 }
 
 static int
-ocd_noop (scb)
-     serial_t scb;
+ocd_noop (serial_t scb)
 {
   return 0;
 }
 
 static void
-ocd_raw (scb)
-     serial_t scb;
+ocd_raw (serial_t scb)
 {
   /* Always in raw mode */
 }
@@ -81,9 +77,7 @@
 unsigned char *wiggler_buffer_ptr;	/* curr spot in buffer */
 
 static int
-ocd_readchar (scb, timeout)
-     serial_t scb;
-     int timeout;
+ocd_readchar (serial_t scb, int timeout)
 {
   /* Catch attempts at reading past the end of the buffer */
   if (wiggler_buffer_ptr >
@@ -102,8 +96,7 @@
    vector.  Someday, they may do something real... */
 
 static serial_ttystate
-ocd_get_tty_state (scb)
-     serial_t scb;
+ocd_get_tty_state (serial_t scb)
 {
   struct ocd_ttystate *state;
 
@@ -113,18 +106,14 @@
 }
 
 static int
-ocd_set_tty_state (scb, ttystate)
-     serial_t scb;
-     serial_ttystate ttystate;
+ocd_set_tty_state (serial_t scb, serial_ttystate ttystate)
 {
   return 0;
 }
 
 static int
-ocd_noflush_set_tty_state (scb, new_ttystate, old_ttystate)
-     serial_t scb;
-     serial_ttystate new_ttystate;
-     serial_ttystate old_ttystate;
+ocd_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate,
+			   serial_ttystate old_ttystate)
 {
   return 0;
 }
@@ -139,18 +128,13 @@
 }
 
 static int
-ocd_setbaudrate (scb, rate)
-     serial_t scb;
-     int rate;
+ocd_setbaudrate (serial_t scb, int rate)
 {
   return 0;
 }
 
 static int
-ocd_write (scb, str, len)
-     serial_t scb;
-     const char *str;
-     int len;
+ocd_write (serial_t scb, const char *str, int len)
 {
 #ifdef _WIN32
   /* send packet to Wigglers.dll and store response so we can give it to
@@ -163,8 +147,7 @@
 }
 
 static void
-ocd_close (scb)
-     serial_t scb;
+ocd_close (serial_t scb)
 {
 }
 
@@ -189,7 +172,7 @@
 };
 
 void
-_initialize_ser_ocd_bdm ()
+_initialize_ser_ocd_bdm (void)
 {
   serial_add_interface (&ocd_ops);
 }
diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c
index a510bff..9c915b0 100644
--- a/gdb/ser-pipe.c
+++ b/gdb/ser-pipe.c
@@ -64,7 +64,11 @@
   if (socketpair (AF_UNIX, SOCK_STREAM, 0, pdes) < 0)
     return -1;
 
+#ifdef HAVE_VFORK
   pid = vfork ();
+#else
+  pid = fork ();
+#endif
   
   /* Error. */
   if (pid == -1)
@@ -120,7 +124,7 @@
       int pid = state->pid;
       close (scb->fd);
       scb->fd = -1;
-      free (state);
+      xfree (state);
       scb->state = NULL;
       kill (pid, SIGTERM);
       /* Might be useful to check that the child does die. */
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index 47b6647..b75e338 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -435,37 +435,37 @@
 wait_for (serial_t scb, int timeout)
 {
 #ifdef HAVE_SGTTY
-  {
-    struct timeval tv;
-    fd_set readfds;
+  while (1)
+    {
+      struct timeval tv;
+      fd_set readfds;
+      int numfds;
 
-    FD_ZERO (&readfds);
+      /* NOTE: Some OS's can scramble the READFDS when the select()
+         call fails (ex the kernel with Red Hat 5.2).  Initialize all
+         arguments before each call. */
 
-    tv.tv_sec = timeout;
-    tv.tv_usec = 0;
+      tv.tv_sec = timeout;
+      tv.tv_usec = 0;
 
-    FD_SET (scb->fd, &readfds);
+      FD_ZERO (&readfds);
+      FD_SET (scb->fd, &readfds);
 
-    while (1)
-      {
-	int numfds;
+      if (timeout >= 0)
+	numfds = select (scb->fd + 1, &readfds, 0, 0, &tv);
+      else
+	numfds = select (scb->fd + 1, &readfds, 0, 0, 0);
 
-	if (timeout >= 0)
-	  numfds = select (scb->fd + 1, &readfds, 0, 0, &tv);
+      if (numfds <= 0)
+	if (numfds == 0)
+	  return SERIAL_TIMEOUT;
+	else if (errno == EINTR)
+	  continue;
 	else
-	  numfds = select (scb->fd + 1, &readfds, 0, 0, 0);
+	  return SERIAL_ERROR;	/* Got an error from select or poll */
 
-	if (numfds <= 0)
-	  if (numfds == 0)
-	    return SERIAL_TIMEOUT;
-	  else if (errno == EINTR)
-	    continue;
-	  else
-	    return SERIAL_ERROR;	/* Got an error from select or poll */
-
-	return 0;
-      }
-  }
+      return 0;
+    }
 #endif /* HAVE_SGTTY */
 
 #if defined HAVE_TERMIO || defined HAVE_TERMIOS
@@ -778,9 +778,7 @@
 }
 
 static int
-hardwire_setstopbits (scb, num)
-     serial_t scb;
-     int num;
+hardwire_setstopbits (serial_t scb, int num)
 {
   struct hardwire_ttystate state;
   int newbit;
@@ -860,21 +858,24 @@
 int
 ser_unix_wait_for (serial_t scb, int timeout)
 {
-  int numfds;
-  struct timeval tv;
-  fd_set readfds, exceptfds;
-
-  FD_ZERO (&readfds);
-  FD_ZERO (&exceptfds);
-
-  tv.tv_sec = timeout;
-  tv.tv_usec = 0;
-
-  FD_SET (scb->fd, &readfds);
-  FD_SET (scb->fd, &exceptfds);
-
   while (1)
     {
+      int numfds;
+      struct timeval tv;
+      fd_set readfds, exceptfds;
+
+      /* NOTE: Some OS's can scramble the READFDS when the select()
+         call fails (ex the kernel with Red Hat 5.2).  Initialize all
+         arguments before each call. */
+
+      tv.tv_sec = timeout;
+      tv.tv_usec = 0;
+
+      FD_ZERO (&readfds);
+      FD_ZERO (&exceptfds);
+      FD_SET (scb->fd, &readfds);
+      FD_SET (scb->fd, &exceptfds);
+
       if (timeout >= 0)
 	numfds = select (scb->fd + 1, &readfds, 0, &exceptfds, &tv);
       else
@@ -910,9 +911,9 @@
      each time through the loop.
 
      Also, timeout = 0 means to poll, so we just set the delta to 0, so we
-     will only go through the loop once. timeout < 0 means to wait forever. */
+     will only go through the loop once. */
 
-  delta = (timeout <= 0 ? 0 : 1);
+  delta = (timeout == 0 ? 0 : 1);
   while (1)
     {
 
@@ -928,38 +929,52 @@
 	    return SERIAL_TIMEOUT;
 	}
 
-      status = ser_unix_wait_for (scb, timeout < 0 ? timeout : delta);
-      timeout -= delta;
+      status = ser_unix_wait_for (scb, delta);
+      if (timeout > 0)
+        timeout -= delta;
 
-      /* If we got an error back from wait_for, then we can return */
+      /* If we got a character or an error back from wait_for, then we can 
+         break from the loop before the timeout is completed. */
 
-      if (status == SERIAL_ERROR)
-        return status;
-
-      status = read (scb->fd, scb->buf, BUFSIZ);
-
-      if (status <= 0)
-        {
-          if (status == 0)
-            {
-              if (timeout != 0)
-                continue;
-              else
-                return SERIAL_TIMEOUT;	/* 0 chars means timeout [may need to
-					   distinguish between EOF & timeouts
-					   someday] */
-            }
-	  else if (errno == EINTR)
-            continue;
-          else
-	    return SERIAL_ERROR;	/* Got an error from read */
+      if (status != SERIAL_TIMEOUT)
+	{
+	  break;
 	}
 
-      scb->bufcnt = status;
-      scb->bufcnt--;
-      scb->bufp = scb->buf;
-      return *scb->bufp++;
+      /* If we have exhausted the original timeout, then generate
+         a SERIAL_TIMEOUT, and pass it out of the loop. */
+
+      else if (timeout == 0)
+	{
+	  status = SERIAL_TIMEOUT;
+	  break;
+	}
     }
+
+  if (status < 0)
+    return status;
+
+  while (1)
+    {
+      status = read (scb->fd, scb->buf, BUFSIZ);
+      if (status != -1 || errno != EINTR)
+	break;
+    }
+
+  if (status <= 0)
+    {
+      if (status == 0)
+	return SERIAL_TIMEOUT;	/* 0 chars means timeout [may need to
+				   distinguish between EOF & timeouts
+				   someday] */
+      else
+	return SERIAL_ERROR;	/* Got an error from read */
+    }
+
+  scb->bufcnt = status;
+  scb->bufcnt--;
+  scb->bufp = scb->buf;
+  return *scb->bufp++;
 }
 
 /* Perform operations common to both old and new readchar. */
@@ -1265,7 +1280,7 @@
       if (SERIAL_DEBUG_P (scb))
 	fprintf_unfiltered (gdb_stdlog, "[fd%d->synchronous]\n",
 			    scb->fd);
-      /* De-schedule what ever tasks are currently scheduled. */
+      /* De-schedule whatever tasks are currently scheduled. */
       switch (scb->async_state)
 	{
 	case FD_SCHEDULED:
diff --git a/gdb/serial.c b/gdb/serial.c
index 0914e39..1d25adf 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -50,12 +50,12 @@
 
 static struct serial_ops *serial_interface_lookup (char *);
 static void serial_logchar (struct ui_file *stream, int ch_type, int ch, int timeout);
-static char logbase_hex[] = "hex";
-static char logbase_octal[] = "octal";
-static char logbase_ascii[] = "ascii";
-static char *logbase_enums[] =
+static const char logbase_hex[] = "hex";
+static const char logbase_octal[] = "octal";
+static const char logbase_ascii[] = "ascii";
+static const char *logbase_enums[] =
 {logbase_hex, logbase_octal, logbase_ascii, NULL};
-static char *serial_logbase = logbase_ascii;
+static const char *serial_logbase = logbase_ascii;
 
 
 
@@ -209,7 +209,7 @@
 
   if (scb->ops->open (scb, open_name))
     {
-      free (scb);
+      xfree (scb);
       return NULL;
     }
 
@@ -310,7 +310,7 @@
     scb->ops->close (scb);
 
   if (scb->name)
-    free (scb->name);
+    xfree (scb->name);
 
   if (scb_base == scb)
     scb_base = scb_base->next;
@@ -324,7 +324,7 @@
 	break;
       }
 
-  free (scb);
+  xfree (scb);
 }
 
 void
@@ -394,10 +394,10 @@
   char *buf;
   va_start (args, format);
 
-  vasprintf (&buf, format, args);
+  xvasprintf (&buf, format, args);
   SERIAL_WRITE (desc, buf, strlen (buf));
 
-  free (buf);
+  xfree (buf);
   va_end (args);
 }
 
@@ -551,7 +551,7 @@
 {
   printf_unfiltered ("\r\n[Exiting connect mode]\r\n");
   SERIAL_SET_TTY_STATE (tty_desc, ttystate);
-  free (ttystate);
+  xfree (ttystate);
   SERIAL_CLOSE (tty_desc);
 }
 
diff --git a/gdb/serial.h b/gdb/serial.h
index 4aff1b0..0fea8ea 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -62,7 +62,7 @@
 enum serial_rc {
   SERIAL_ERROR = -1,	/* General error. */
   SERIAL_TIMEOUT = -2,	/* Timeout or data-not-ready during read.
-			   Unfortunatly, through ui_loop_hook(), this
+			   Unfortunately, through ui_loop_hook(), this
 			   can also be a QUIT indication.  */
   SERIAL_EOF = -3	/* General end-of-file or remote target
 			   connection closed, indication.  Includes
diff --git a/gdb/sh-stub.c b/gdb/sh-stub.c
index ea897c4..b6be51f 100644
--- a/gdb/sh-stub.c
+++ b/gdb/sh-stub.c
@@ -383,7 +383,7 @@
 /* scan for the sequence $<data>#<checksum>     */
 
 char *
-getpacket ()
+getpacket (void)
 {
   unsigned char *buffer = &remcomInBuffer[0];
   unsigned char checksum;
@@ -802,7 +802,7 @@
 }
 
 void
-gdb_mode()
+gdb_mode (void)
 {
   ingdbmode = GDBCOOKIE;
   breakpoint();
@@ -1324,7 +1324,7 @@
 
 
 static  void
-exceptions()
+exceptions (void)
 {
   code_for_catch_exception (CPU_BUS_ERROR_VEC);
   code_for_catch_exception (DMA_BUS_ERROR_VEC);
@@ -1492,12 +1492,12 @@
 void handleError (char theSSR);
 
 void
-nop ()
+nop (void)
 {
 
 }
 void 
-init_serial()
+init_serial (void)
 {
   int i;
 
@@ -1556,7 +1556,7 @@
 }
 
 int 
-putDebugCharReady()
+putDebugCharReady (void)
 {
   return (SSR1 & SCI_TDRE);
 }
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 941e13f..f83ad7e 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1,5 +1,6 @@
 /* Target-dependent code for Hitachi Super-H, for GDB.
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 2000 Free Software
+   Foundation, Inc.
 
    This file is part of GDB.
 
@@ -35,185 +36,469 @@
 #include "dis-asm.h"
 #include "inferior.h"		/* for BEFORE_TEXT_END etc. */
 #include "gdb_string.h"
+#include "arch-utils.h"
+#include "floatformat.h"
 
-/* A set of original names, to be used when restoring back to generic
-   registers from a specific set.  */
-/* *INDENT-OFF* */
-static char *sh_generic_reg_names[] = {
-  "r0",   "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
-  "r8",   "r9",   "r10",  "r11",  "r12",  "r13",  "r14",  "r15",
-  "pc",   "pr",   "gbr",  "vbr",  "mach", "macl", "sr",
-  "fpul", "fpscr",
-  "fr0",  "fr1",  "fr2",  "fr3",  "fr4",  "fr5",  "fr6",  "fr7",
-  "fr8",  "fr9",  "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
-  "ssr",  "spc",
-  "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
-  "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
+#include "solib-svr4.h"
+
+#undef XMALLOC
+#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
+
+
+/* Frame interpretation related functions. */
+static gdbarch_breakpoint_from_pc_ftype sh_breakpoint_from_pc;
+static gdbarch_frame_chain_ftype sh_frame_chain;
+static gdbarch_frame_saved_pc_ftype sh_frame_saved_pc;
+static gdbarch_skip_prologue_ftype sh_skip_prologue;
+
+static gdbarch_frame_init_saved_regs_ftype sh_nofp_frame_init_saved_regs;
+static gdbarch_frame_init_saved_regs_ftype sh_fp_frame_init_saved_regs;
+static gdbarch_init_extra_frame_info_ftype sh_init_extra_frame_info;
+static gdbarch_pop_frame_ftype sh_pop_frame;
+static gdbarch_saved_pc_after_call_ftype sh_saved_pc_after_call;
+static gdbarch_frame_args_address_ftype sh_frame_args_address;
+static gdbarch_frame_locals_address_ftype sh_frame_locals_address;
+
+/* Function call related functions. */
+static gdbarch_extract_return_value_ftype sh_extract_return_value;
+static gdbarch_extract_struct_value_address_ftype sh_extract_struct_value_address;
+static gdbarch_use_struct_convention_ftype sh_use_struct_convention;
+static gdbarch_store_struct_return_ftype sh_store_struct_return;
+static gdbarch_push_arguments_ftype sh_push_arguments;
+static gdbarch_push_return_address_ftype sh_push_return_address;
+static gdbarch_coerce_float_to_double_ftype sh_coerce_float_to_double;
+static gdbarch_store_return_value_ftype	sh_default_store_return_value;
+static gdbarch_store_return_value_ftype	sh3e_sh4_store_return_value;
+
+static gdbarch_register_name_ftype sh_generic_register_name;
+static gdbarch_register_name_ftype sh_sh_register_name;
+static gdbarch_register_name_ftype sh_sh3_register_name;
+static gdbarch_register_name_ftype sh_sh3e_register_name;
+static gdbarch_register_name_ftype sh_sh_dsp_register_name;
+static gdbarch_register_name_ftype sh_sh3_dsp_register_name;
+
+/* Registers display related functions */
+static gdbarch_register_raw_size_ftype sh_default_register_raw_size;
+static gdbarch_register_raw_size_ftype sh_sh4_register_raw_size;
+
+static gdbarch_register_virtual_size_ftype sh_register_virtual_size;
+
+static gdbarch_register_byte_ftype sh_default_register_byte;
+static gdbarch_register_byte_ftype sh_sh4_register_byte;
+
+static gdbarch_register_virtual_type_ftype sh_sh3e_register_virtual_type;
+static gdbarch_register_virtual_type_ftype sh_sh4_register_virtual_type;
+static gdbarch_register_virtual_type_ftype sh_default_register_virtual_type;
+
+static void sh_generic_show_regs (void);
+static void sh3_show_regs (void);
+static void sh3e_show_regs (void);
+static void sh3_dsp_show_regs (void);
+static void sh_dsp_show_regs (void);
+static void sh4_show_regs (void);
+static void sh_show_regs_command (char *, int);
+
+static struct type *sh_sh4_build_float_register_type (int high);
+
+static gdbarch_fetch_pseudo_register_ftype sh_fetch_pseudo_register;
+static gdbarch_store_pseudo_register_ftype sh_store_pseudo_register;
+static int fv_reg_base_num (int);
+static int dr_reg_base_num (int);
+static gdbarch_do_registers_info_ftype sh_do_registers_info;
+static void do_fv_register_info (int fv_regnum);
+static void do_dr_register_info (int dr_regnum);
+static void sh_do_pseudo_register (int regnum);
+static void sh_do_fp_register (int regnum);
+static void sh_do_register (int regnum);
+static void sh_print_register (int regnum);
+
+void (*sh_show_regs) (void);
+int (*print_sh_insn) (bfd_vma, disassemble_info*);
+
+/* Define other aspects of the stack frame.
+   we keep a copy of the worked out return pc lying around, since it
+   is a useful bit of info */
+  
+struct frame_extra_info
+{
+  CORE_ADDR return_pc;
+  int leaf_function;
+  int f_offset;
 };
 
-static char *sh_reg_names[] = {
-  "r0",   "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
-  "r8",   "r9",   "r10",  "r11",  "r12",  "r13",  "r14",  "r15",
-  "pc",   "pr",   "gbr",  "vbr",  "mach", "macl", "sr",
-  "",     "",
-  "",     "",     "",     "",     "",     "",     "",     "",
-  "",     "",     "",     "",     "",     "",     "",     "",
-  "",     "",
-  "",     "",     "",     "",     "",     "",     "",     "",
-  "",     "",     "",     "",     "",     "",     "",     "",
-};
-
-static char *sh3_reg_names[] = {
-  "r0",   "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
-  "r8",   "r9",   "r10",  "r11",  "r12",  "r13",  "r14",  "r15",
-  "pc",   "pr",   "gbr",  "vbr",  "mach", "macl", "sr",
-  "",     "",
-  "",     "",     "",     "",     "",     "",     "",     "",
-  "",     "",     "",     "",     "",     "",     "",     "",
-  "ssr",  "spc",
-  "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
-  "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1"
-};
-
-static char *sh3e_reg_names[] = {
-  "r0",   "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
-  "r8",   "r9",   "r10",  "r11",  "r12",  "r13",  "r14",  "r15",
-  "pc",   "pr",   "gbr",  "vbr",  "mach", "macl", "sr",
-  "fpul", "fpscr",
-  "fr0",  "fr1",  "fr2",  "fr3",  "fr4",  "fr5",  "fr6",  "fr7",
-  "fr8",  "fr9",  "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
-  "ssr",  "spc",
-  "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
-  "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
-};
-
-static char *sh_dsp_reg_names[] = {
-  "r0",   "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
-  "r8",   "r9",   "r10",  "r11",  "r12",  "r13",  "r14",  "r15",
-  "pc",   "pr",   "gbr",  "vbr",  "mach", "macl", "sr",
-  "",     "dsr",
-  "a0g",  "a0",   "a1g",  "a1",   "m0",   "m1",   "x0",   "x1",
-  "y0",   "y1",   "",     "",     "",     "",     "",     "mod",
-  "",     "",
-  "rs",   "re",   "",     "",     "",     "",     "",     "",
-  "",     "",     "",     "",     "",     "",     "",     "",
-};
-
-static char *sh3_dsp_reg_names[] = {
-  "r0",   "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
-  "r8",   "r9",   "r10",  "r11",  "r12",  "r13",  "r14",  "r15",
-  "pc",   "pr",   "gbr",  "vbr",  "mach", "macl", "sr",
-  "",     "dsr",
-  "a0g",  "a0",   "a1g",  "a1",   "m0",   "m1",   "x0",   "x1",
-  "y0",   "y1",   "",     "",     "",     "",     "",     "mod",
-  "ssr",  "spc",
-  "rs",   "re",   "",     "",     "",     "",     "",     "",
-  "r0b",  "r1b",  "r2b",  "r3b",  "r4b",  "r5b",  "r6b",  "r7b",
-};
-/* *INDENT-ON* */
-
+#if 0
 #ifdef _WIN32_WCE
 char **sh_register_names = sh3_reg_names;
 #else
 char **sh_register_names = sh_generic_reg_names;
 #endif
+#endif
 
-struct
-  {
-    char **regnames;
-    int mach;
-  }
-sh_processor_type_table[] =
+static char *
+sh_generic_register_name (int reg_nr)
 {
+  static char *register_names[] =
   {
-    sh_reg_names, bfd_mach_sh
-  }
-  ,
+    "r0",   "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
+    "r8",   "r9",   "r10",  "r11",  "r12",  "r13",  "r14",  "r15",
+    "pc",   "pr",   "gbr",  "vbr",  "mach", "macl", "sr",
+    "fpul", "fpscr",
+    "fr0",  "fr1",  "fr2",  "fr3",  "fr4",  "fr5",  "fr6",  "fr7",
+    "fr8",  "fr9",  "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
+    "ssr",  "spc",
+    "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
+    "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
+  };
+  if (reg_nr < 0)
+    return NULL;
+  if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
+    return NULL;
+  return register_names[reg_nr];
+}
+
+static char *
+sh_sh_register_name (int reg_nr)
+{
+  static char *register_names[] =
   {
-    sh_reg_names, bfd_mach_sh2
-  }
-  ,
+    "r0",   "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
+    "r8",   "r9",   "r10",  "r11",  "r12",  "r13",  "r14",  "r15",
+    "pc",   "pr",   "gbr",  "vbr",  "mach", "macl", "sr",
+    "",     "",
+    "",     "",     "",     "",     "",     "",     "",     "",
+    "",     "",     "",     "",     "",     "",     "",     "",
+    "",     "",
+    "",     "",     "",     "",     "",     "",     "",     "",
+    "",     "",     "",     "",     "",     "",     "",     "",
+  };
+  if (reg_nr < 0)
+    return NULL;
+  if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
+    return NULL;
+  return register_names[reg_nr];
+}
+
+static char *
+sh_sh3_register_name (int reg_nr)
+{
+  static char *register_names[] =
   {
-    sh_dsp_reg_names, bfd_mach_sh_dsp
-  }
-  ,
+    "r0",   "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
+    "r8",   "r9",   "r10",  "r11",  "r12",  "r13",  "r14",  "r15",
+    "pc",   "pr",   "gbr",  "vbr",  "mach", "macl", "sr",
+    "",     "",
+    "",     "",     "",     "",     "",     "",     "",     "",
+    "",     "",     "",     "",     "",     "",     "",     "",
+    "ssr",  "spc",
+    "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
+    "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1"
+  };
+  if (reg_nr < 0)
+    return NULL;
+  if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
+    return NULL;
+  return register_names[reg_nr];
+}
+
+static char *
+sh_sh3e_register_name (int reg_nr)
+{
+  static char *register_names[] =
   {
-    sh3_reg_names, bfd_mach_sh3
-  }
-  ,
+    "r0",   "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
+    "r8",   "r9",   "r10",  "r11",  "r12",  "r13",  "r14",  "r15",
+    "pc",   "pr",   "gbr",  "vbr",  "mach", "macl", "sr",
+    "fpul", "fpscr",
+    "fr0",  "fr1",  "fr2",  "fr3",  "fr4",  "fr5",  "fr6",  "fr7",
+    "fr8",  "fr9",  "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
+    "ssr",  "spc",
+    "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
+    "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
+  };
+  if (reg_nr < 0)
+    return NULL;
+  if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
+    return NULL;
+  return register_names[reg_nr];
+}
+
+static char *
+sh_sh_dsp_register_name (int reg_nr)
+{
+  static char *register_names[] =
   {
-    sh3_dsp_reg_names, bfd_mach_sh3_dsp
-  }
-  ,
+    "r0",   "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
+    "r8",   "r9",   "r10",  "r11",  "r12",  "r13",  "r14",  "r15",
+    "pc",   "pr",   "gbr",  "vbr",  "mach", "macl", "sr",
+    "",     "dsr",
+    "a0g",  "a0",   "a1g",  "a1",   "m0",   "m1",   "x0",   "x1",
+    "y0",   "y1",   "",     "",     "",     "",     "",     "mod",
+    "",     "",
+    "rs",   "re",   "",     "",     "",     "",     "",     "",
+    "",     "",     "",     "",     "",     "",     "",     "",
+  };
+  if (reg_nr < 0)
+    return NULL;
+  if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
+    return NULL;
+  return register_names[reg_nr];
+}
+
+static char *
+sh_sh3_dsp_register_name (int reg_nr)
+{
+  static char *register_names[] =
   {
-    sh3e_reg_names, bfd_mach_sh3e
-  }
-  ,
+    "r0",   "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
+    "r8",   "r9",   "r10",  "r11",  "r12",  "r13",  "r14",  "r15",
+    "pc",   "pr",   "gbr",  "vbr",  "mach", "macl", "sr",
+    "",     "dsr",
+    "a0g",  "a0",   "a1g",  "a1",   "m0",   "m1",   "x0",   "x1",
+    "y0",   "y1",   "",     "",     "",     "",     "",     "mod",
+    "ssr",  "spc",
+    "rs",   "re",   "",     "",     "",     "",     "",     "",
+    "r0b",  "r1b",  "r2b",  "r3b",  "r4b",  "r5b",  "r6b",  "r7b"
+    "",     "",     "",     "",     "",     "",     "",     "",
+  };
+  if (reg_nr < 0)
+    return NULL;
+  if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
+    return NULL;
+  return register_names[reg_nr];
+}
+
+static char *
+sh_sh4_register_name (int reg_nr)
+{
+  static char *register_names[] =
   {
-    NULL, 0
-  }
-};
+    /* 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 */
+    "ssr",  "spc",
+    /* bank 0 43 - 50 */
+    "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
+    /* bank 1 51 - 58 */
+    "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
+    /* double precision (pseudo) 59 - 66 */
+    "dr0",  "dr2",  "dr4",  "dr6",  "dr8",  "dr10", "dr12", "dr14",
+    /* vectors (pseudo) 67 - 70 */
+    "fv0",  "fv4",  "fv8",  "fv12",
+    /* FIXME: missing XF 71 - 86 */
+    /* FIXME: missing XD 87 - 94 */
+  };
+  if (reg_nr < 0)
+    return NULL;
+  if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
+    return NULL;
+  return register_names[reg_nr];
+}
+
+static unsigned char *
+sh_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
+{
+  /* 0xc3c3 is trapa #c3, and it works in big and little endian modes */
+  static unsigned char breakpoint[] =  {0xc3, 0xc3};
+  
+  *lenptr = sizeof (breakpoint);
+  return breakpoint;
+}
 
 /* Prologue looks like
    [mov.l       <regs>,@-r15]...
    [sts.l       pr,@-r15]
    [mov.l       r14,@-r15]
    [mov         r15,r14]
+
+   Actually it can be more complicated than this.  For instance, with
+   newer gcc's:
+
+   mov.l   r14,@-r15
+   add     #-12,r15
+   mov     r15,r14
+   mov     r4,r1
+   mov     r5,r2
+   mov.l   r6,@(4,r14)
+   mov.l   r7,@(8,r14)
+   mov.b   r1,@r14
+   mov     r14,r1
+   mov     r14,r1
+   add     #2,r1
+   mov.w   r2,@r1
+
  */
 
+/* STS.L PR,@-r15  0100111100100010
+   r15-4-->r15, PR-->(r15) */
 #define IS_STS(x)  		((x) == 0x4f22)
+
+/* MOV.L Rm,@-r15  00101111mmmm0110
+   r15-4-->r15, Rm-->(R15) */
 #define IS_PUSH(x) 		(((x) & 0xff0f) == 0x2f06)
+
 #define GET_PUSHED_REG(x)  	(((x) >> 4) & 0xf)
+
+/* MOV r15,r14     0110111011110011
+   r15-->r14  */
 #define IS_MOV_SP_FP(x)  	((x) == 0x6ef3)
+
+/* ADD #imm,r15    01111111iiiiiiii
+   r15+imm-->r15 */
 #define IS_ADD_SP(x) 		(((x) & 0xff00) == 0x7f00)
+
 #define IS_MOV_R3(x) 		(((x) & 0xff00) == 0x1a00)
 #define IS_SHLL_R3(x)		((x) == 0x4300)
+
+/* ADD r3,r15      0011111100111100
+   r15+r3-->r15 */
 #define IS_ADD_R3SP(x)		((x) == 0x3f3c)
+
+/* FMOV.S FRm,@-Rn  Rn-4-->Rn, FRm-->(Rn)     1111nnnnmmmm1011
+   FMOV DRm,@-Rn    Rn-8-->Rn, DRm-->(Rn)     1111nnnnmmm01011
+   FMOV XDm,@-Rn    Rn-8-->Rn, XDm-->(Rn)     1111nnnnmmm11011 */
 #define IS_FMOV(x)		(((x) & 0xf00f) == 0xf00b)
+
+/* MOV Rm,Rn            Rm-->Rn          0110nnnnmmmm0011 
+   MOV.L Rm,@(disp,Rn)  Rm-->(dispx4+Rn) 0001nnnnmmmmdddd
+   MOV.L Rm,@Rn         Rm-->(Rn)        0010nnnnmmmm0010
+   where Rm is one of r4,r5,r6,r7 which are the argument registers. */
+#define IS_ARG_MOV(x) \
+(((((x) & 0xf00f) == 0x6003) && (((x) & 0x00f0) >= 0x0040 && ((x) & 0x00f0) <= 0x0070)) \
+ || ((((x) & 0xf000) == 0x1000) && (((x) & 0x00f0) >= 0x0040 && ((x) & 0x00f0) <= 0x0070)) \
+ || ((((x) & 0xf00f) == 0x2002) && (((x) & 0x00f0) >= 0x0040 && ((x) & 0x00f0) <= 0x0070)))
+
+/* MOV.L Rm,@(disp,r14)  00011110mmmmdddd
+   Rm-->(dispx4+r14) where Rm is one of r4,r5,r6,r7 */
+#define IS_MOV_R14(x) \
+     ((((x) & 0xff00) == 0x1e) && (((x) & 0x00f0) >= 0x0040 && ((x) & 0x00f0) <= 0x0070))
+                        
 #define FPSCR_SZ		(1 << 20)
 
-
-/* Should call_function allocate stack space for a struct return?  */
-int
-sh_use_struct_convention (gcc_p, type)
-     int gcc_p;
-     struct type *type;
-{
-  return (TYPE_LENGTH (type) > 1);
-}
-
-
 /* Skip any prologue before the guts of a function */
 
-CORE_ADDR
-sh_skip_prologue (start_pc)
-     CORE_ADDR start_pc;
+/* Skip the prologue using the debug information. If this fails we'll
+   fall back on the 'guess' method below. */
+static CORE_ADDR
+after_prologue (CORE_ADDR pc)
 {
-  int w;
+  struct symtab_and_line sal;
+  CORE_ADDR func_addr, func_end;
 
-  w = read_memory_integer (start_pc, 2);
-  while (IS_STS (w)
-	 || IS_FMOV (w)
-	 || IS_PUSH (w)
-	 || IS_MOV_SP_FP (w)
-	 || IS_MOV_R3 (w)
-	 || IS_ADD_R3SP (w)
-	 || IS_ADD_SP (w)
-	 || IS_SHLL_R3 (w))
+  /* If we can not find the symbol in the partial symbol table, then
+     there is no hope we can determine the function's start address
+     with this code.  */
+  if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end))
+    return 0;
+
+  /* Get the line associated with FUNC_ADDR.  */
+  sal = find_pc_line (func_addr, 0);
+
+  /* There are only two cases to consider.  First, the end of the source line
+     is within the function bounds.  In that case we return the end of the
+     source line.  Second is the end of the source line extends beyond the
+     bounds of the current function.  We need to use the slow code to
+     examine instructions in that case.  */
+  if (sal.end < func_end)
+    return sal.end;
+  else
+    return 0;
+}
+
+/* Here we look at each instruction in the function, and try to guess
+   where the prologue ends. Unfortunately this is not always 
+   accurate. */
+static CORE_ADDR
+skip_prologue_hard_way (CORE_ADDR start_pc)
+{
+  CORE_ADDR here, end;
+  int updated_fp = 0;
+
+  if (!start_pc)
+    return 0;
+
+  for (here = start_pc, end = start_pc + (2 * 28); here < end;)
     {
-      start_pc += 2;
-      w = read_memory_integer (start_pc, 2);
+      int w = read_memory_integer (here, 2);
+      here += 2;
+      if (IS_FMOV (w) || IS_PUSH (w) || IS_STS (w) || IS_MOV_R3 (w)
+	  || IS_ADD_R3SP (w) || IS_ADD_SP (w) || IS_SHLL_R3 (w) 
+	  || IS_ARG_MOV (w) || IS_MOV_R14 (w))
+	{
+	  start_pc = here;
+	}
+      else if (IS_MOV_SP_FP (w))
+	{
+	  start_pc = here;
+	  updated_fp = 1;
+	}
+      else
+	/* Don't bail out yet, if we are before the copy of sp. */
+	if (updated_fp)
+	  break;
     }
 
   return start_pc;
 }
 
-/* Disassemble an instruction.  */
+static CORE_ADDR
+sh_skip_prologue (CORE_ADDR pc)
+{
+  CORE_ADDR post_prologue_pc;
 
-int
-gdb_print_insn_sh (memaddr, info)
-     bfd_vma memaddr;
-     disassemble_info *info;
+  /* See if we can determine the end of the prologue via the symbol table.
+     If so, then return either PC, or the PC after the prologue, whichever
+     is greater.  */
+
+  post_prologue_pc = after_prologue (pc);
+
+  /* If after_prologue returned a useful address, then use it.  Else
+     fall back on the instruction skipping code. */
+  if (post_prologue_pc != 0)
+    return max (pc, post_prologue_pc);
+  else
+    return (skip_prologue_hard_way (pc));
+}
+
+/* Immediately after a function call, return the saved pc.
+   Can't always go through the frames for this because on some machines
+   the new frame is not set up until the new function executes
+   some instructions.
+
+   The return address is the value saved in the PR register + 4  */
+static CORE_ADDR
+sh_saved_pc_after_call (struct frame_info *frame)
+{
+  return (ADDR_BITS_REMOVE(read_register(PR_REGNUM)));
+}
+
+/* Should call_function allocate stack space for a struct return?  */
+static int
+sh_use_struct_convention (int gcc_p, struct type *type)
+{
+  return (TYPE_LENGTH (type) > 1);
+}
+
+/* Store the address of the place in which to copy the structure the
+   subroutine will return.  This is called from call_function.
+
+   We store structs through a pointer passed in R0 */
+static void
+sh_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
+{
+  write_register (STRUCT_RETURN_REGNUM, (addr));
+}
+
+/* Disassemble an instruction.  */
+static int
+gdb_print_insn_sh (bfd_vma memaddr, disassemble_info *info)
 {
   if (TARGET_BYTE_ORDER == BIG_ENDIAN)
     return print_insn_sh (memaddr, info);
@@ -227,15 +512,13 @@
 
    For us, the frame address is its stack pointer value, so we look up
    the function prologue to determine the caller's sp value, and return it.  */
-
-CORE_ADDR
-sh_frame_chain (frame)
-     struct frame_info *frame;
+static CORE_ADDR
+sh_frame_chain (struct frame_info *frame)
 {
   if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
     return frame->frame;	/* dummy frame same as caller's frame */
-  if (!inside_entry_file (frame->pc))
-    return read_memory_integer (FRAME_FP (frame) + frame->f_offset, 4);
+  if (frame->pc && !inside_entry_file (frame->pc))
+    return read_memory_integer (FRAME_FP (frame) + frame->extra_info->f_offset, 4);
   else
     return 0;
 }
@@ -246,13 +529,9 @@
    would provide a graceful failure mode when trying to get the value of
    caller-saves registers for an inner frame.  */
 
-CORE_ADDR
-sh_find_callers_reg (fi, regnum)
-     struct frame_info *fi;
-     int regnum;
+static CORE_ADDR
+sh_find_callers_reg (struct frame_info *fi, int regnum)
 {
-  struct frame_saved_regs fsr;
-
   for (; fi; fi = fi->next)
     if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
       /* When the caller requests PR from the dummy frame, we return PC because
@@ -260,9 +539,11 @@
       return generic_read_register_dummy (fi->pc, fi->frame, regnum);
     else
       {
-	FRAME_FIND_SAVED_REGS (fi, fsr);
-	if (fsr.regs[regnum] != 0)
-	  return read_memory_integer (fsr.regs[regnum],
+	FRAME_INIT_SAVED_REGS (fi);
+	if (!fi->pc)
+	  return 0;
+	if (fi->saved_regs[regnum] != 0)
+	  return read_memory_integer (fi->saved_regs[regnum],
 				      REGISTER_RAW_SIZE (regnum));
       }
   return read_register (regnum);
@@ -273,11 +554,8 @@
    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. */
-
-void
-sh_frame_find_saved_regs (fi, fsr)
-     struct frame_info *fi;
-     struct frame_saved_regs *fsr;
+static void
+sh_nofp_frame_init_saved_regs (struct frame_info *fi)
 {
   int where[NUM_REGS];
   int rn;
@@ -288,22 +566,23 @@
   int insn;
   int r3_val = 0;
   char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame);
-
+  
+  if (fi->saved_regs == NULL)
+    frame_saved_regs_zalloc (fi);
+  else
+    memset (fi->saved_regs, 0, SIZEOF_FRAME_SAVED_REGS);
+  
   if (dummy_regs)
     {
       /* DANGER!  This is ONLY going to work if the char buffer format of
          the saved registers is byte-for-byte identical to the 
          CORE_ADDR regs[NUM_REGS] format used by struct frame_saved_regs! */
-      memcpy (&fsr->regs, dummy_regs, sizeof (fsr));
+      memcpy (fi->saved_regs, dummy_regs, sizeof (fi->saved_regs));
       return;
     }
 
-  opc = pc = get_pc_function_start (fi->pc);
-
-  insn = read_memory_integer (pc, 2);
-
-  fi->leaf_function = 1;
-  fi->f_offset = 0;
+  fi->extra_info->leaf_function = 1;
+  fi->extra_info->f_offset = 0;
 
   for (rn = 0; rn < NUM_REGS; rn++)
     where[rn] = -1;
@@ -314,65 +593,54 @@
      that does not appear to be part of the prologue.  But give up
      after 20 of them, since we're getting silly then. */
 
-  while (pc < opc + 20 * 2)
+  pc = get_pc_function_start (fi->pc);
+  if (!pc)
     {
+      fi->pc = 0;
+      return;
+    }
+
+  for (opc = pc + (2 * 28); pc < opc; pc += 2)
+    {
+      insn = read_memory_integer (pc, 2);
       /* See where the registers will be saved to */
       if (IS_PUSH (insn))
 	{
-	  pc += 2;
 	  rn = GET_PUSHED_REG (insn);
 	  where[rn] = depth;
-	  insn = read_memory_integer (pc, 2);
 	  depth += 4;
 	}
       else if (IS_STS (insn))
 	{
-	  pc += 2;
 	  where[PR_REGNUM] = depth;
-	  insn = read_memory_integer (pc, 2);
 	  /* If we're storing the pr then this isn't a leaf */
-	  fi->leaf_function = 0;
+	  fi->extra_info->leaf_function = 0;
 	  depth += 4;
 	}
       else if (IS_MOV_R3 (insn))
 	{
 	  r3_val = ((insn & 0xff) ^ 0x80) - 0x80;
-	  pc += 2;
-	  insn = read_memory_integer (pc, 2);
 	}
       else if (IS_SHLL_R3 (insn))
 	{
 	  r3_val <<= 1;
-	  pc += 2;
-	  insn = read_memory_integer (pc, 2);
 	}
       else if (IS_ADD_R3SP (insn))
 	{
 	  depth += -r3_val;
-	  pc += 2;
-	  insn = read_memory_integer (pc, 2);
 	}
       else if (IS_ADD_SP (insn))
 	{
-	  pc += 2;
 	  depth -= ((insn & 0xff) ^ 0x80) - 0x80;
-	  insn = read_memory_integer (pc, 2);
 	}
-      else if (IS_FMOV (insn))
-	{
-	  pc += 2;
-	  insn = read_memory_integer (pc, 2);
-	  if (read_register (FPSCR_REGNUM) & FPSCR_SZ)
-	    {
-	      depth += 8;
-	    }
-	  else
-	    {
-	      depth += 4;
-	    }
-	}
+      else if (IS_MOV_SP_FP (insn))
+	break;
+#if 0 /* This used to just stop when it found an instruction that
+	 was not considered part of the prologue.  Now, we just
+	 keep going looking for likely instructions. */
       else
 	break;
+#endif
     }
 
   /* Now we know how deep things are, we can work out their addresses */
@@ -384,36 +652,166 @@
 	  if (rn == FP_REGNUM)
 	    have_fp = 1;
 
-	  fsr->regs[rn] = fi->frame - where[rn] + depth - 4;
+	  fi->saved_regs[rn] = fi->frame - where[rn] + depth - 4;
 	}
       else
 	{
-	  fsr->regs[rn] = 0;
+	  fi->saved_regs[rn] = 0;
 	}
     }
 
   if (have_fp)
     {
-      fsr->regs[SP_REGNUM] = read_memory_integer (fsr->regs[FP_REGNUM], 4);
+      fi->saved_regs[SP_REGNUM] = read_memory_integer (fi->saved_regs[FP_REGNUM], 4);
     }
   else
     {
-      fsr->regs[SP_REGNUM] = fi->frame - 4;
+      fi->saved_regs[SP_REGNUM] = fi->frame - 4;
     }
 
-  fi->f_offset = depth - where[FP_REGNUM] - 4;
+  fi->extra_info->f_offset = depth - where[FP_REGNUM] - 4;
   /* Work out the return pc - either from the saved pr or the pr
      value */
 }
 
-/* initialize the extra info saved in a FRAME */
-
-void
-sh_init_extra_frame_info (fromleaf, fi)
-     int fromleaf;
-     struct frame_info *fi;
+static void
+sh_fp_frame_init_saved_regs (struct frame_info *fi)
 {
-  struct frame_saved_regs fsr;
+  int where[NUM_REGS];
+  int rn;
+  int have_fp = 0;
+  int depth;
+  int pc;
+  int opc;
+  int insn;
+  int r3_val = 0;
+  char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame);
+  
+  if (fi->saved_regs == NULL)
+    frame_saved_regs_zalloc (fi);
+  else
+    memset (fi->saved_regs, 0, SIZEOF_FRAME_SAVED_REGS);
+  
+  if (dummy_regs)
+    {
+      /* DANGER!  This is ONLY going to work if the char buffer format of
+         the saved registers is byte-for-byte identical to the 
+         CORE_ADDR regs[NUM_REGS] format used by struct frame_saved_regs! */
+      memcpy (fi->saved_regs, dummy_regs, sizeof (fi->saved_regs));
+      return;
+    }
+
+  fi->extra_info->leaf_function = 1;
+  fi->extra_info->f_offset = 0;
+
+  for (rn = 0; rn < NUM_REGS; rn++)
+    where[rn] = -1;
+
+  depth = 0;
+
+  /* Loop around examining the prologue insns until we find something
+     that does not appear to be part of the prologue.  But give up
+     after 20 of them, since we're getting silly then. */
+
+  pc = get_pc_function_start (fi->pc);
+  if (!pc)
+    {
+      fi->pc = 0;
+      return;
+    }
+
+  for (opc = pc + (2 * 28); pc < opc; pc += 2)
+    {
+      insn = read_memory_integer (pc, 2);
+      /* See where the registers will be saved to */
+      if (IS_PUSH (insn))
+	{
+	  rn = GET_PUSHED_REG (insn);
+	  where[rn] = depth;
+	  depth += 4;
+	}
+      else if (IS_STS (insn))
+	{
+	  where[PR_REGNUM] = depth;
+	  /* If we're storing the pr then this isn't a leaf */
+	  fi->extra_info->leaf_function = 0;
+	  depth += 4;
+	}
+      else if (IS_MOV_R3 (insn))
+	{
+	  r3_val = ((insn & 0xff) ^ 0x80) - 0x80;
+	}
+      else if (IS_SHLL_R3 (insn))
+	{
+	  r3_val <<= 1;
+	}
+      else if (IS_ADD_R3SP (insn))
+	{
+	  depth += -r3_val;
+	}
+      else if (IS_ADD_SP (insn))
+	{
+	  depth -= ((insn & 0xff) ^ 0x80) - 0x80;
+	}
+      else if (IS_FMOV (insn))
+	{
+	  if (read_register (gdbarch_tdep (current_gdbarch)->FPSCR_REGNUM) & FPSCR_SZ)
+	    {
+	      depth += 8;
+	    }
+	  else
+	    {
+	      depth += 4;
+	    }
+	}
+      else if (IS_MOV_SP_FP (insn))
+	break;
+#if 0 /* This used to just stop when it found an instruction that
+	 was not considered part of the prologue.  Now, we just
+	 keep going looking for likely instructions. */
+      else
+	break;
+#endif
+    }
+
+  /* Now we know how deep things are, we can work out their addresses */
+
+  for (rn = 0; rn < NUM_REGS; rn++)
+    {
+      if (where[rn] >= 0)
+	{
+	  if (rn == FP_REGNUM)
+	    have_fp = 1;
+
+	  fi->saved_regs[rn] = fi->frame - where[rn] + depth - 4;
+	}
+      else
+	{
+	  fi->saved_regs[rn] = 0;
+	}
+    }
+
+  if (have_fp)
+    {
+      fi->saved_regs[SP_REGNUM] = read_memory_integer (fi->saved_regs[FP_REGNUM], 4);
+    }
+  else
+    {
+      fi->saved_regs[SP_REGNUM] = fi->frame - 4;
+    }
+
+  fi->extra_info->f_offset = depth - where[FP_REGNUM] - 4;
+  /* Work out the return pc - either from the saved pr or the pr
+     value */
+}
+
+/* Initialize the extra info saved in a FRAME */
+static void
+sh_init_extra_frame_info (int fromleaf, struct frame_info *fi)
+{
+
+  fi->extra_info = (struct frame_extra_info *)
+    frame_obstack_alloc (sizeof (struct frame_extra_info));
 
   if (fi->next)
     fi->pc = FRAME_SAVED_PC (fi->next);
@@ -424,43 +822,68 @@
          by assuming it's always FP.  */
       fi->frame = generic_read_register_dummy (fi->pc, fi->frame,
 					       SP_REGNUM);
-      fi->return_pc = generic_read_register_dummy (fi->pc, fi->frame,
-						   PC_REGNUM);
-      fi->f_offset = -(CALL_DUMMY_LENGTH + 4);
-      fi->leaf_function = 0;
+      fi->extra_info->return_pc = generic_read_register_dummy (fi->pc, fi->frame,
+							       PC_REGNUM);
+      fi->extra_info->f_offset = -(CALL_DUMMY_LENGTH + 4);
+      fi->extra_info->leaf_function = 0;
       return;
     }
   else
     {
-      FRAME_FIND_SAVED_REGS (fi, fsr);
-      fi->return_pc = sh_find_callers_reg (fi, PR_REGNUM);
+      FRAME_INIT_SAVED_REGS (fi);
+      fi->extra_info->return_pc = sh_find_callers_reg (fi, PR_REGNUM);
     }
 }
 
+/* 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
+sh_extract_struct_value_address (char *regbuf)
+{
+  return (extract_address ((regbuf), REGISTER_RAW_SIZE (0)));
+}
+
+static CORE_ADDR
+sh_frame_saved_pc (struct frame_info *frame)
+{
+  return ((frame)->extra_info->return_pc);
+}
+
+static CORE_ADDR
+sh_frame_args_address (struct frame_info *fi)
+{
+  return (fi)->frame;
+}
+
+static CORE_ADDR
+sh_frame_locals_address (struct frame_info *fi)
+{
+  return (fi)->frame;
+}
+
 /* Discard from the stack the innermost frame,
    restoring all saved registers.  */
-
-void
-sh_pop_frame ()
+static void
+sh_pop_frame (void)
 {
   register struct frame_info *frame = get_current_frame ();
   register CORE_ADDR fp;
   register int regnum;
-  struct frame_saved_regs fsr;
 
   if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
     generic_pop_dummy_frame ();
   else
     {
       fp = FRAME_FP (frame);
-      get_frame_saved_regs (frame, &fsr);
+      FRAME_INIT_SAVED_REGS (frame);
 
       /* Copy regs from where they were saved in the frame */
       for (regnum = 0; regnum < NUM_REGS; regnum++)
-	if (fsr.regs[regnum])
-	  write_register (regnum, read_memory_integer (fsr.regs[regnum], 4));
+	if (frame->saved_regs[regnum])
+	  write_register (regnum, read_memory_integer (frame->saved_regs[regnum], 4));
 
-      write_register (PC_REGNUM, frame->return_pc);
+      write_register (PC_REGNUM, frame->extra_info->return_pc);
       write_register (SP_REGNUM, fp + 4);
     }
   flush_cached_frames ();
@@ -500,7 +923,6 @@
    word (as opposed to arguments smaller than 4 bytes, which are 
    right-justified).
 
-
    If the function is to return an aggregate type such as a struct, it 
    is either returned in the normal return value register R0 (if its 
    size is no greater than one byte), or else the caller must allocate
@@ -510,13 +932,9 @@
    not displace any of the other arguments passed in via registers R4
    to R7.   */
 
-CORE_ADDR
-sh_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     unsigned char struct_return;
-     CORE_ADDR struct_addr;
+static CORE_ADDR
+sh_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
+		   int struct_return, CORE_ADDR struct_addr)
 {
   int stack_offset, stack_alloc;
   int argreg;
@@ -537,12 +955,10 @@
     write_register (STRUCT_RETURN_REGNUM, struct_addr);
 
   /* Now make sure there's space on the stack */
-  for (argnum = 0, stack_alloc = 0;
-       argnum < nargs; argnum++)
+  for (argnum = 0, stack_alloc = 0; argnum < nargs; argnum++)
     stack_alloc += ((TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 3) & ~3);
   sp -= stack_alloc;		/* make room on stack for args */
 
-
   /* Now load as many as possible of the first arguments into
      registers, and push the rest onto the stack.  There are 16 bytes
      in four registers available.  Loop thru args from first to last.  */
@@ -554,7 +970,8 @@
       len = TYPE_LENGTH (type);
       memset (valbuf, 0, sizeof (valbuf));
       if (len < 4)
-	{			/* value gets right-justified in the register or stack word */
+	{
+	  /* value gets right-justified in the register or stack word */
 	  memcpy (valbuf + (4 - len),
 		  (char *) VALUE_CONTENTS (args[argnum]), len);
 	  val = valbuf;
@@ -595,10 +1012,8 @@
    Set up the return address for the inferior function call.
    Needed for targets where we don't actually execute a JSR/BSR instruction */
 
-CORE_ADDR
-sh_push_return_address (pc, sp)
-     CORE_ADDR pc;
-     CORE_ADDR sp;
+static CORE_ADDR
+sh_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
 {
   write_register (PR_REGNUM, CALL_DUMMY_ADDRESS ());
   return sp;
@@ -620,59 +1035,69 @@
 
 #if 0
 void
-sh_fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p)
-     char *dummy;
-     CORE_ADDR pc;
-     CORE_ADDR fun;
-     int nargs;
-     value_ptr *args;
-     struct type *type;
-     int gcc_p;
+sh_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
+		   value_ptr *args, struct type *type, int gcc_p)
 {
   *(unsigned long *) (dummy + 8) = fun;
 }
 #endif
 
-
-/* Modify the actual processor type. */
-
-int
-sh_target_architecture_hook (ap)
-     const bfd_arch_info_type *ap;
+static int
+sh_coerce_float_to_double (struct type *formal, struct type *actual)
 {
-  int i, j;
-
-  if (ap->arch != bfd_arch_sh)
-    return 0;
-
-  for (i = 0; sh_processor_type_table[i].regnames != NULL; i++)
-    {
-      if (sh_processor_type_table[i].mach == ap->mach)
-	{
-	  sh_register_names = sh_processor_type_table[i].regnames;
-	  return 1;
-	}
-    }
-
-  internal_error ("Architecture `%s' unreconized", ap->printable_name);
+  return 1;
 }
 
+/* Find a function's return value in the appropriate registers (in
+   regbuf), and copy it into valbuf.  Extract from an array REGBUF
+   containing the (raw) register state a function return value of type
+   TYPE, and copy that, in virtual format, into VALBUF.  */
+static void
+sh_extract_return_value (struct type *type, char *regbuf, char *valbuf)
+{
+  int len = TYPE_LENGTH (type);
+
+  if (len <= 4)
+    memcpy (valbuf, ((char *) regbuf) + 4 - len, len);
+  else if (len <= 8)
+    memcpy (valbuf, ((char *) regbuf) + 8 - len, len);
+  else
+    error ("bad size for return value");
+}
+
+/* Write into appropriate registers a function return value
+   of type TYPE, given in virtual format.
+   If the architecture is sh4 or sh3e, store a function's return value
+   in the R0 general register or in the FP0 floating point register,
+   depending on the type of the return value. In all the other cases
+   the result is stored in r0. */
+static void
+sh_default_store_return_value (struct type *type, char *valbuf)
+{
+  write_register_bytes (REGISTER_BYTE (0), 
+			valbuf, TYPE_LENGTH (type));
+}
+
+static void
+sh3e_sh4_store_return_value (struct type *type, char *valbuf)
+{
+  if (TYPE_CODE (type) == TYPE_CODE_FLT) 
+    write_register_bytes (REGISTER_BYTE (FP0_REGNUM), 
+			  valbuf, TYPE_LENGTH (type));
+  else
+    write_register_bytes (REGISTER_BYTE (0), 
+			  valbuf, TYPE_LENGTH (type));
+}
+
+
 /* Print the registers in a form similar to the E7000 */
 
 static void
-sh_show_regs (args, from_tty)
-     char *args;
-     int from_tty;
+sh_generic_show_regs (void)
 {
-  int cpu;
-  if (TARGET_ARCHITECTURE->arch == bfd_arch_sh)
-    cpu = TARGET_ARCHITECTURE->mach;
-  else
-    cpu = 0;
-
   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 (gdbarch_tdep (current_gdbarch)->SR_REGNUM),
 		   (long) read_register (PR_REGNUM),
 		   (long) read_register (MACH_REGNUM),
 		   (long) read_register (MACL_REGNUM));
@@ -680,21 +1105,6 @@
   printf_filtered ("GBR=%08lx VBR=%08lx",
 		   (long) read_register (GBR_REGNUM),
 		   (long) read_register (VBR_REGNUM));
-  if (cpu == bfd_mach_sh3 || cpu == bfd_mach_sh3e || cpu == bfd_mach_sh3_dsp
-      || cpu == bfd_mach_sh4)
-    {
-      printf_filtered (" SSR=%08lx SPC=%08lx",
-		       (long) read_register (SSR_REGNUM),
-		       (long) read_register (SPC_REGNUM));
-      if (cpu == bfd_mach_sh3e || cpu == bfd_mach_sh4)
-	{
-	  printf_filtered (" FPUL=%08lx FPSCR=%08lx",
-			   (long) read_register (FPUL_REGNUM),
-			   (long) read_register (FPSCR_REGNUM));
-	}
-    }
-  if (cpu == bfd_mach_sh_dsp || cpu == bfd_mach_sh3_dsp)
-    printf_filtered (" DSR=%08lx", (long) read_register (DSR_REGNUM));
 
   printf_filtered ("\nR0-R7  %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
 		   (long) read_register (0),
@@ -714,82 +1124,1015 @@
 		   (long) read_register (13),
 		   (long) read_register (14),
 		   (long) read_register (15));
-  if (cpu == bfd_mach_sh3e || cpu == bfd_mach_sh4)
-    {
-      int pr = cpu == bfd_mach_sh4 && (read_register (FPSCR_REGNUM) & 0x80000);
-
-      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));
-    }
-  /* FIXME: sh4 has more registers */
-  if (cpu == bfd_mach_sh_dsp || cpu == bfd_mach_sh3_dsp)
-    {
-      printf_filtered ("A0G=%02lx A0=%08lx M0=%08lx X0=%08lx Y0=%08lx RS=%08lx MOD=%08lx\n",
-		       (long) read_register (A0G_REGNUM) & 0xff,
-		       (long) read_register (A0_REGNUM),
-		       (long) read_register (M0_REGNUM),
-		       (long) read_register (X0_REGNUM),
-		       (long) read_register (Y0_REGNUM),
-		       (long) read_register (RS_REGNUM),
-		       (long) read_register (MOD_REGNUM));
-      printf_filtered ("A1G=%02lx A1=%08lx M1=%08lx X1=%08lx Y1=%08lx RE=%08lx\n",
-		       (long) read_register (A1G_REGNUM) & 0xff,
-		       (long) read_register (A1_REGNUM),
-		       (long) read_register (M1_REGNUM),
-		       (long) read_register (X1_REGNUM),
-		       (long) read_register (Y1_REGNUM),
-		       (long) read_register (RE_REGNUM));
-    }
 }
 
-/* Function: extract_return_value
-   Find a function's return value in the appropriate registers (in regbuf),
-   and copy it into valbuf.  */
-
-void
-sh_extract_return_value (type, regbuf, valbuf)
-     struct type *type;
-     void *regbuf;
-     void *valbuf;
+static void
+sh3_show_regs (void)
 {
-  int len = TYPE_LENGTH (type);
+  printf_filtered ("PC=%s SR=%08lx PR=%08lx MACH=%08lx MACHL=%08lx\n",
+		   paddr (read_register (PC_REGNUM)),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->SR_REGNUM),
+		   (long) read_register (PR_REGNUM),
+		   (long) read_register (MACH_REGNUM),
+		   (long) read_register (MACL_REGNUM));
 
-  if (len <= 4)
-    memcpy (valbuf, ((char *) regbuf) + 4 - len, len);
-  else if (len <= 8)
-    memcpy (valbuf, ((char *) regbuf) + 8 - len, len);
+  printf_filtered ("GBR=%08lx VBR=%08lx",
+		   (long) read_register (GBR_REGNUM),
+		   (long) read_register (VBR_REGNUM));
+  printf_filtered (" SSR=%08lx SPC=%08lx",
+	           (long) read_register (gdbarch_tdep (current_gdbarch)->SSR_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->SPC_REGNUM));
+
+  printf_filtered ("\nR0-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));
+}
+
+
+static void
+sh3e_show_regs (void)
+{
+  printf_filtered ("PC=%s SR=%08lx PR=%08lx MACH=%08lx MACHL=%08lx\n",
+		   paddr (read_register (PC_REGNUM)),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->SR_REGNUM),
+		   (long) read_register (PR_REGNUM),
+		   (long) read_register (MACH_REGNUM),
+		   (long) read_register (MACL_REGNUM));
+
+  printf_filtered ("GBR=%08lx VBR=%08lx",
+		   (long) read_register (GBR_REGNUM),
+		   (long) read_register (VBR_REGNUM));
+  printf_filtered (" SSR=%08lx SPC=%08lx",
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->SSR_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->SPC_REGNUM));
+  printf_filtered (" FPUL=%08lx FPSCR=%08lx",
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->FPUL_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->FPSCR_REGNUM));
+
+  printf_filtered ("\nR0-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 (("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 (("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));
+}
+
+static void
+sh3_dsp_show_regs (void)
+{
+  printf_filtered ("PC=%s SR=%08lx PR=%08lx MACH=%08lx MACHL=%08lx\n",
+		   paddr (read_register (PC_REGNUM)),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->SR_REGNUM),
+		   (long) read_register (PR_REGNUM),
+		   (long) read_register (MACH_REGNUM),
+		   (long) read_register (MACL_REGNUM));
+
+  printf_filtered ("GBR=%08lx VBR=%08lx",
+		   (long) read_register (GBR_REGNUM),
+		   (long) read_register (VBR_REGNUM));
+
+  printf_filtered (" SSR=%08lx SPC=%08lx",
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->SSR_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->SPC_REGNUM));
+
+  printf_filtered (" DSR=%08lx", 
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->DSR_REGNUM));
+
+  printf_filtered ("\nR0-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 ("A0G=%02lx A0=%08lx M0=%08lx X0=%08lx Y0=%08lx RS=%08lx MOD=%08lx\n",
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->A0G_REGNUM) & 0xff,
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->A0_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->M0_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->X0_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->Y0_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->RS_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->MOD_REGNUM));
+  printf_filtered ("A1G=%02lx A1=%08lx M1=%08lx X1=%08lx Y1=%08lx RE=%08lx\n",
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->A1G_REGNUM) & 0xff,
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->A1_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->M1_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->X1_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->Y1_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->RE_REGNUM));
+}
+
+static void
+sh4_show_regs (void)
+{
+  int pr = read_register (gdbarch_tdep (current_gdbarch)->FPSCR_REGNUM) & 0x80000;
+  printf_filtered ("PC=%s SR=%08lx PR=%08lx MACH=%08lx MACHL=%08lx\n",
+		   paddr (read_register (PC_REGNUM)),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->SR_REGNUM),
+		   (long) read_register (PR_REGNUM),
+		   (long) read_register (MACH_REGNUM),
+		   (long) read_register (MACL_REGNUM));
+
+  printf_filtered ("GBR=%08lx VBR=%08lx",
+		   (long) read_register (GBR_REGNUM),
+		   (long) read_register (VBR_REGNUM));
+  printf_filtered (" SSR=%08lx SPC=%08lx",
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->SSR_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->SPC_REGNUM));
+  printf_filtered (" FPUL=%08lx FPSCR=%08lx",
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->FPUL_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->FPSCR_REGNUM));
+
+  printf_filtered ("\nR0-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));
+}
+
+static void
+sh_dsp_show_regs (void)
+{
+  printf_filtered ("PC=%s SR=%08lx PR=%08lx MACH=%08lx MACHL=%08lx\n",
+		   paddr (read_register (PC_REGNUM)),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->SR_REGNUM),
+		   (long) read_register (PR_REGNUM),
+		   (long) read_register (MACH_REGNUM),
+		   (long) read_register (MACL_REGNUM));
+
+  printf_filtered ("GBR=%08lx VBR=%08lx",
+		   (long) read_register (GBR_REGNUM),
+		   (long) read_register (VBR_REGNUM));
+
+  printf_filtered (" DSR=%08lx", 
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->DSR_REGNUM));
+
+  printf_filtered ("\nR0-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 ("A0G=%02lx A0=%08lx M0=%08lx X0=%08lx Y0=%08lx RS=%08lx MOD=%08lx\n",
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->A0G_REGNUM) & 0xff,
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->A0_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->M0_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->X0_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->Y0_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->RS_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->MOD_REGNUM));
+  printf_filtered ("A1G=%02lx A1=%08lx M1=%08lx X1=%08lx Y1=%08lx RE=%08lx\n",
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->A1G_REGNUM) & 0xff,
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->A1_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->M1_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->X1_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->Y1_REGNUM),
+		   (long) read_register (gdbarch_tdep (current_gdbarch)->RE_REGNUM));
+}
+
+void sh_show_regs_command (char *args, int from_tty)
+{
+  if (sh_show_regs)
+    (*sh_show_regs)();
+}
+
+/* Index within `registers' of the first byte of the space for
+   register N.  */
+static int
+sh_default_register_byte (int reg_nr)
+{
+  return (reg_nr * 4);
+}
+
+static int
+sh_sh4_register_byte (int reg_nr)
+{
+  if (reg_nr >= gdbarch_tdep (current_gdbarch)->DR0_REGNUM 
+      && reg_nr <= gdbarch_tdep (current_gdbarch)->DR_LAST_REGNUM)
+    return (dr_reg_base_num (reg_nr) * 4);
+  else if  (reg_nr >= gdbarch_tdep (current_gdbarch)->FV0_REGNUM 
+	    && reg_nr <= gdbarch_tdep (current_gdbarch)->FV_LAST_REGNUM)
+    return (fv_reg_base_num (reg_nr) * 4);
   else
-    error ("bad size for return value");
+    return (reg_nr * 4);
+}
+
+/* Number of bytes of storage in the actual machine representation for
+   register REG_NR.  */
+static int
+sh_default_register_raw_size (int reg_nr)
+{
+  return 4;
+}
+
+static int
+sh_sh4_register_raw_size (int reg_nr)
+{
+  if (reg_nr >= gdbarch_tdep (current_gdbarch)->DR0_REGNUM 
+      && reg_nr <= gdbarch_tdep (current_gdbarch)->DR_LAST_REGNUM)
+    return 8;
+  else if  (reg_nr >= gdbarch_tdep (current_gdbarch)->FV0_REGNUM 
+	    && reg_nr <= gdbarch_tdep (current_gdbarch)->FV_LAST_REGNUM)
+    return 16;
+  else
+    return 4;
+}
+
+/* Number of bytes of storage in the program's representation
+   for register N.  */
+static int
+sh_register_virtual_size (int reg_nr)
+{
+  return 4;
+}
+
+/* Return the GDB type object for the "standard" data type
+   of data in register N.  */
+
+static struct type *
+sh_sh3e_register_virtual_type (int reg_nr)
+{
+  if ((reg_nr >= FP0_REGNUM
+       && (reg_nr <= gdbarch_tdep (current_gdbarch)->FP_LAST_REGNUM)) 
+      || (reg_nr == gdbarch_tdep (current_gdbarch)->FPUL_REGNUM))
+    return builtin_type_float;
+  else
+    return builtin_type_int;
+}
+
+static struct type *
+sh_sh4_register_virtual_type (int reg_nr)
+{
+  if ((reg_nr >= FP0_REGNUM
+       && (reg_nr <= gdbarch_tdep (current_gdbarch)->FP_LAST_REGNUM)) 
+      || (reg_nr == gdbarch_tdep (current_gdbarch)->FPUL_REGNUM))
+    return builtin_type_float;
+  else if (reg_nr >= gdbarch_tdep (current_gdbarch)->DR0_REGNUM 
+	   && reg_nr <= gdbarch_tdep (current_gdbarch)->DR_LAST_REGNUM)
+    return builtin_type_double;
+  else if  (reg_nr >= gdbarch_tdep (current_gdbarch)->FV0_REGNUM 
+	   && reg_nr <= gdbarch_tdep (current_gdbarch)->FV_LAST_REGNUM)
+    return sh_sh4_build_float_register_type (3);
+  else
+    return builtin_type_int;
+}
+
+static struct type *
+sh_sh4_build_float_register_type (int high)
+{
+  struct type *temp;
+
+  temp = create_range_type (NULL, builtin_type_int, 0, high);
+  return create_array_type (NULL, builtin_type_float, temp);
+}
+
+static struct type *
+sh_default_register_virtual_type (int reg_nr)
+{
+  return builtin_type_int;
+}
+
+/* On the sh4, the DRi pseudo registers are problematic if the target
+   is little endian. When the user writes one of those registers, for
+   instance with 'ser var $dr0=1', we want the double to be stored
+   like this: 
+   fr0 = 0x00 0x00 0x00 0x00 0x00 0xf0 0x3f 
+   fr1 = 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
+
+   This corresponds to little endian byte order & big endian word
+   order.  However if we let gdb write the register w/o conversion, it
+   will write fr0 and fr1 this way:
+   fr0 = 0x00 0x00 0x00 0x00 0x00 0x00 0x00
+   fr1 = 0x00 0x00 0x00 0x00 0x00 0xf0 0x3f
+   because it will consider fr0 and fr1 as a single LE stretch of memory.
+   
+   To achieve what we want we must force gdb to store things in
+   floatformat_ieee_double_littlebyte_bigword (which is defined in
+   include/floatformat.h and libiberty/floatformat.c.
+
+   In case the target is big endian, there is no problem, the
+   raw bytes will look like:
+   fr0 = 0x3f 0xf0 0x00 0x00 0x00 0x00 0x00
+   fr1 = 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
+
+   The other pseudo registers (the FVs) also don't pose a problem
+   because they are stored as 4 individual FP elements. */
+
+int
+sh_sh4_register_convertible (int nr)
+{
+  if (TARGET_BYTE_ORDER == LITTLE_ENDIAN)
+    return (gdbarch_tdep (current_gdbarch)->DR0_REGNUM <= nr
+	    && nr <= gdbarch_tdep (current_gdbarch)->DR_LAST_REGNUM);
+  else 
+    return 0;
 }
 
 void
-_initialize_sh_tdep ()
+sh_sh4_register_convert_to_virtual (int regnum, struct type *type,
+                                  char *from, char *to)
+{
+  if (regnum >= gdbarch_tdep (current_gdbarch)->DR0_REGNUM 
+      && regnum <= gdbarch_tdep (current_gdbarch)->DR_LAST_REGNUM)
+    {
+      DOUBLEST val;
+      floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, from, &val);
+      store_floating(to, TYPE_LENGTH(type), val);
+    }
+  else
+    error("sh_register_convert_to_virtual called with non DR register number");
+}
+
+void
+sh_sh4_register_convert_to_raw (struct type *type, int regnum,
+                              char *from, char *to)
+{
+  if (regnum >= gdbarch_tdep (current_gdbarch)->DR0_REGNUM 
+      && regnum <= gdbarch_tdep (current_gdbarch)->DR_LAST_REGNUM)
+    {
+      DOUBLEST val = extract_floating (from, TYPE_LENGTH(type));
+      floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, &val, to);
+    }
+  else
+    error("sh_register_convert_to_raw called with non DR register number");
+}
+
+void
+sh_fetch_pseudo_register (int reg_nr)
+{
+  int base_regnum, portion;
+
+  if (!register_cached (reg_nr))
+    {
+      if (reg_nr >= gdbarch_tdep (current_gdbarch)->DR0_REGNUM 
+	  && reg_nr <= gdbarch_tdep (current_gdbarch)->DR_LAST_REGNUM)
+        {
+	  base_regnum = dr_reg_base_num (reg_nr);
+
+          /* Read the real regs for which this one is an alias.  */
+          for (portion = 0; portion < 2; portion++)
+            if (!register_cached (base_regnum + portion))
+              target_fetch_registers (base_regnum + portion);
+        }
+      else if (reg_nr >= gdbarch_tdep (current_gdbarch)->FV0_REGNUM 
+	       && reg_nr <= gdbarch_tdep (current_gdbarch)->FV_LAST_REGNUM)
+        {
+	  base_regnum = fv_reg_base_num (reg_nr);
+
+          /* Read the real regs for which this one is an alias.  */
+          for (portion = 0; portion < 4; portion++)
+            if (!register_cached (base_regnum + portion))
+              target_fetch_registers (base_regnum + portion);
+
+        }
+      register_valid [reg_nr] = 1;
+    }
+}
+
+void
+sh_store_pseudo_register (int reg_nr)
+{
+  int base_regnum, portion;
+
+  if (reg_nr >= gdbarch_tdep (current_gdbarch)->DR0_REGNUM
+      && reg_nr <= gdbarch_tdep (current_gdbarch)->DR_LAST_REGNUM)
+    {
+      base_regnum = dr_reg_base_num (reg_nr);
+
+      /* Write the real regs for which this one is an alias.  */
+      for (portion = 0; portion < 2; portion++)
+	{
+	  register_valid[base_regnum + portion] = 1;
+	  target_store_registers (base_regnum + portion);
+	}
+    }
+  else if (reg_nr >= gdbarch_tdep (current_gdbarch)->FV0_REGNUM
+	   && reg_nr <= gdbarch_tdep (current_gdbarch)->FV_LAST_REGNUM)
+    {
+      base_regnum = fv_reg_base_num (reg_nr);
+
+      /* Write the real regs for which this one is an alias.  */
+      for (portion = 0; portion < 4; portion++)
+	{
+	  register_valid[base_regnum + portion] = 1;
+	  target_store_registers (base_regnum + portion);
+	}
+    }
+}
+
+static int
+fv_reg_base_num (int fv_regnum)
+{
+  int fp_regnum;
+
+  fp_regnum = FP0_REGNUM + 
+    (fv_regnum - gdbarch_tdep (current_gdbarch)->FV0_REGNUM) * 4;
+  return fp_regnum;
+}
+
+static int
+dr_reg_base_num (int dr_regnum)
+{
+  int fp_regnum;
+
+  fp_regnum = FP0_REGNUM + 
+    (dr_regnum - gdbarch_tdep (current_gdbarch)->DR0_REGNUM) * 2;
+  return fp_regnum;
+}
+
+static void
+do_fv_register_info (int fv_regnum)
+{
+  int first_fp_reg_num = fv_reg_base_num (fv_regnum);
+  printf_filtered ("fv%d\t0x%08x\t0x%08x\t0x%08x\t0x%08x\n", 
+		     fv_regnum - gdbarch_tdep (current_gdbarch)->FV0_REGNUM, 
+		     (int) read_register (first_fp_reg_num),
+		     (int) read_register (first_fp_reg_num + 1),
+		     (int) read_register (first_fp_reg_num + 2),
+		     (int) read_register (first_fp_reg_num + 3));
+}
+
+static void
+do_dr_register_info (int dr_regnum)
+{
+  int first_fp_reg_num = dr_reg_base_num (dr_regnum);
+
+  printf_filtered ("dr%d\t0x%08x%08x\n", 
+		    dr_regnum - gdbarch_tdep (current_gdbarch)->DR0_REGNUM, 
+		    (int) read_register (first_fp_reg_num),
+		    (int) read_register (first_fp_reg_num + 1));
+}
+
+static void
+sh_do_pseudo_register (int regnum)
+{
+  if (regnum < NUM_REGS || regnum >= NUM_REGS + NUM_PSEUDO_REGS)
+    internal_error ("Invalid pseudo register number %d\n", regnum);
+  else if (regnum >= gdbarch_tdep (current_gdbarch)->DR0_REGNUM
+	   && regnum < gdbarch_tdep (current_gdbarch)->DR_LAST_REGNUM)
+    do_dr_register_info (regnum);
+  else if (regnum >= gdbarch_tdep (current_gdbarch)->FV0_REGNUM
+	   && regnum <= gdbarch_tdep (current_gdbarch)->FV_LAST_REGNUM)
+    do_fv_register_info (regnum);
+}
+
+
+static void
+sh_do_fp_register (int regnum)
+{				/* do values for FP (float) regs */
+  char *raw_buffer;
+  double flt;	/* double extracted from raw hex data */
+  int inv;
+  int j;
+
+  /* Allocate space for the float. */
+  raw_buffer = (char *) alloca (REGISTER_RAW_SIZE (FP0_REGNUM));
+
+  /* Get the data in raw format.  */
+  if (read_relative_register_raw_bytes (regnum, raw_buffer))
+    error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum));
+
+  /* Get the register as a number */ 
+  flt = unpack_double (builtin_type_float, raw_buffer, &inv);
+
+  /* Print the name and some spaces. */
+  fputs_filtered (REGISTER_NAME (regnum), gdb_stdout);
+  print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), gdb_stdout);
+
+  /* Print the value. */
+  printf_filtered (inv ? "<invalid float>" : "%-10.9g", flt);
+
+  /* Print the fp register as hex. */
+  printf_filtered ("\t(raw 0x");
+  for (j = 0; j < REGISTER_RAW_SIZE (regnum); j++)
+    {
+      register int idx = TARGET_BYTE_ORDER == BIG_ENDIAN ? j
+	: REGISTER_RAW_SIZE (regnum) - 1 - j;
+      printf_filtered ("%02x", (unsigned char) raw_buffer[idx]);
+    }
+  printf_filtered (")");
+  printf_filtered ("\n");
+}
+
+static void
+sh_do_register (int regnum)
+{
+  char raw_buffer[MAX_REGISTER_RAW_SIZE];
+
+  fputs_filtered (REGISTER_NAME (regnum), gdb_stdout);
+  print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), gdb_stdout);
+
+  /* Get the data in raw format.  */
+  if (read_relative_register_raw_bytes (regnum, raw_buffer))
+    printf_filtered ("*value not available*\n");
+      
+  val_print (REGISTER_VIRTUAL_TYPE (regnum), raw_buffer, 0, 0,
+	     gdb_stdout, 'x', 1, 0, Val_pretty_default);
+  printf_filtered ("\t");
+  val_print (REGISTER_VIRTUAL_TYPE (regnum), raw_buffer, 0, 0,
+	     gdb_stdout, 0, 1, 0, Val_pretty_default);
+  printf_filtered ("\n");
+}
+
+static void
+sh_print_register (int regnum)
+{
+  if (regnum < 0 || regnum >= NUM_REGS + NUM_PSEUDO_REGS)
+    internal_error ("Invalid register number %d\n", regnum);
+
+  else if (regnum >= 0 && regnum < NUM_REGS)
+    {
+      if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
+	sh_do_fp_register (regnum);	/* FP regs */
+      else
+	sh_do_register (regnum);	/* All other regs */
+    }
+
+  else if (regnum < NUM_REGS + NUM_PSEUDO_REGS)
+    sh_do_pseudo_register (regnum);
+}
+
+void
+sh_do_registers_info (int regnum, int fpregs)
+{
+  if (regnum != -1)		/* do one specified register */
+    {
+      if (*(REGISTER_NAME (regnum)) == '\0')
+	error ("Not a valid register for the current processor type");
+
+      sh_print_register (regnum);
+    }
+  else
+    /* do all (or most) registers */
+    {
+      regnum = 0;
+      while (regnum < NUM_REGS)
+	{
+	  /* If the register name is empty, it is undefined for this
+	     processor, so don't display anything.  */
+	  if (REGISTER_NAME (regnum) == NULL
+	      || *(REGISTER_NAME (regnum)) == '\0')
+	    { 
+	      regnum++;
+	      continue;
+	    }
+
+	  if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT)
+	    {
+	      if (fpregs)
+		{
+		  /* true for "INFO ALL-REGISTERS" command */
+		  sh_do_fp_register (regnum);	/* FP regs */
+		  regnum ++;
+		}
+	      else
+		regnum += (gdbarch_tdep (current_gdbarch)->FP_LAST_REGNUM - FP0_REGNUM);	/* skip FP regs */
+	    }
+	  else
+	    {
+	      sh_do_register (regnum);	/* All other regs */
+	      regnum++;
+	    }
+	}
+
+      if (fpregs)
+	while (regnum < NUM_REGS + NUM_PSEUDO_REGS)
+	  {
+	    sh_do_pseudo_register (regnum);
+	    regnum++;
+	  }
+    }
+}
+
+#ifdef SVR4_SHARED_LIBS
+
+/* Fetch (and possibly build) an appropriate link_map_offsets structure
+   for native i386 linux targets using the struct offsets defined in
+   link.h (but without actual reference to that file).
+
+   This makes it possible to access i386-linux shared libraries from
+   a gdb that was not built on an i386-linux host (for cross debugging).
+   */
+
+struct link_map_offsets *
+sh_linux_svr4_fetch_link_map_offsets (void)
+{
+  static struct link_map_offsets lmo;
+  static struct link_map_offsets *lmp = 0;
+
+  if (lmp == 0)
+    {
+      lmp = &lmo;
+
+      lmo.r_debug_size = 8;	/* 20 not actual size but all we need */
+
+      lmo.r_map_offset = 4;
+      lmo.r_map_size   = 4;
+
+      lmo.link_map_size = 20;	/* 552 not actual size but all we need */
+
+      lmo.l_addr_offset = 0;
+      lmo.l_addr_size   = 4;
+
+      lmo.l_name_offset = 4;
+      lmo.l_name_size   = 4;
+
+      lmo.l_next_offset = 12;
+      lmo.l_next_size   = 4;
+
+      lmo.l_prev_offset = 16;
+      lmo.l_prev_size   = 4;
+    }
+
+    return lmp;
+}
+#endif /* SVR4_SHARED_LIBS */
+
+static gdbarch_init_ftype sh_gdbarch_init;
+
+static struct gdbarch *
+sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
+{
+  static LONGEST sh_call_dummy_words[] = {0};
+  struct gdbarch *gdbarch;
+  struct gdbarch_tdep *tdep;
+  gdbarch_register_name_ftype *sh_register_name;
+  gdbarch_store_return_value_ftype *sh_store_return_value;
+  gdbarch_register_virtual_type_ftype *sh_register_virtual_type;
+
+  /* Find a candidate among the list of pre-declared architectures. */
+  arches = gdbarch_list_lookup_by_info (arches, &info);
+  if (arches != NULL)
+    return arches->gdbarch;
+
+  /* None found, create a new architecture from the information
+     provided. */
+  tdep = XMALLOC (struct gdbarch_tdep);
+  gdbarch = gdbarch_alloc (&info, tdep);
+
+  /* Initialize the register numbers that are not common to all the
+     variants to -1, if necessary thse will be overwritten in the case
+     statement below. */
+  tdep->FPUL_REGNUM = -1;
+  tdep->FPSCR_REGNUM = -1;
+  tdep->SR_REGNUM = 22;
+  tdep->DSR_REGNUM = -1;
+  tdep->FP_LAST_REGNUM = -1;
+  tdep->A0G_REGNUM = -1;
+  tdep->A0_REGNUM = -1;
+  tdep->A1G_REGNUM = -1;
+  tdep->A1_REGNUM = -1;
+  tdep->M0_REGNUM = -1;
+  tdep->M1_REGNUM = -1;
+  tdep->X0_REGNUM = -1;
+  tdep->X1_REGNUM = -1;
+  tdep->Y0_REGNUM = -1;
+  tdep->Y1_REGNUM = -1;
+  tdep->MOD_REGNUM = -1;
+  tdep->RS_REGNUM = -1;
+  tdep->RE_REGNUM = -1;
+  tdep->SSR_REGNUM = -1;
+  tdep->SPC_REGNUM = -1;
+  tdep->DR0_REGNUM = -1;
+  tdep->DR_LAST_REGNUM = -1;
+  tdep->FV0_REGNUM = -1;
+  tdep->FV_LAST_REGNUM = -1;
+
+  set_gdbarch_fp0_regnum (gdbarch, -1);
+  set_gdbarch_num_pseudo_regs (gdbarch, 0);
+  set_gdbarch_max_register_raw_size (gdbarch, 4);
+  set_gdbarch_max_register_virtual_size (gdbarch, 4);
+  set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
+  set_gdbarch_num_regs (gdbarch, 59);
+  set_gdbarch_sp_regnum (gdbarch, 15);
+  set_gdbarch_fp_regnum (gdbarch, 14);
+  set_gdbarch_pc_regnum (gdbarch, 16);
+  set_gdbarch_register_size (gdbarch, 4);
+  set_gdbarch_register_bytes (gdbarch, NUM_REGS * 4);
+  set_gdbarch_fetch_pseudo_register (gdbarch, sh_fetch_pseudo_register);
+  set_gdbarch_store_pseudo_register (gdbarch, sh_store_pseudo_register);
+  set_gdbarch_do_registers_info (gdbarch, sh_do_registers_info);
+  set_gdbarch_breakpoint_from_pc (gdbarch, sh_breakpoint_from_pc);
+  print_sh_insn = gdb_print_insn_sh;
+
+  switch (info.bfd_arch_info->mach)
+    {
+    case bfd_mach_sh:
+      sh_register_name = sh_sh_register_name;
+      sh_show_regs = sh_generic_show_regs;
+      sh_store_return_value = sh_default_store_return_value;
+      sh_register_virtual_type = sh_default_register_virtual_type;
+      set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+      set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
+      break;
+    case bfd_mach_sh2:
+      sh_register_name = sh_sh_register_name;
+      sh_show_regs = sh_generic_show_regs;
+      sh_store_return_value = sh_default_store_return_value;
+      sh_register_virtual_type = sh_default_register_virtual_type;
+      set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+      set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
+      break;      
+    case bfd_mach_sh_dsp:
+      sh_register_name = sh_sh_dsp_register_name;
+      sh_show_regs = sh_dsp_show_regs;
+      sh_store_return_value = sh_default_store_return_value;
+      sh_register_virtual_type = sh_default_register_virtual_type;
+      set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+      set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
+      tdep->DSR_REGNUM = 24;
+      tdep->A0G_REGNUM = 25;
+      tdep->A0_REGNUM = 26;
+      tdep->A1G_REGNUM = 27;
+      tdep->A1_REGNUM = 28;
+      tdep->M0_REGNUM = 29;
+      tdep->M1_REGNUM = 30;
+      tdep->X0_REGNUM = 31;
+      tdep->X1_REGNUM = 32;
+      tdep->Y0_REGNUM = 33;
+      tdep->Y1_REGNUM = 34;
+      tdep->MOD_REGNUM = 40;
+      tdep->RS_REGNUM = 43;
+      tdep->RE_REGNUM = 44;
+      break;
+    case bfd_mach_sh3:
+      sh_register_name = sh_sh3_register_name;
+      sh_show_regs = sh3_show_regs;
+      sh_store_return_value = sh_default_store_return_value;
+      sh_register_virtual_type = sh_default_register_virtual_type;
+      set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+      set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
+      tdep->SSR_REGNUM = 41;
+      tdep->SPC_REGNUM = 42;
+      break;
+    case bfd_mach_sh3e:
+      sh_register_name = sh_sh3e_register_name;
+      sh_show_regs = sh3e_show_regs;
+      sh_store_return_value = sh3e_sh4_store_return_value;
+      sh_register_virtual_type = sh_sh3e_register_virtual_type;
+      set_gdbarch_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs);
+      set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
+      set_gdbarch_fp0_regnum (gdbarch, 25);
+      tdep->FPUL_REGNUM = 23;
+      tdep->FPSCR_REGNUM = 24;
+      tdep->FP_LAST_REGNUM = 40;
+      tdep->SSR_REGNUM = 41;
+      tdep->SPC_REGNUM = 42;
+      break;
+    case bfd_mach_sh3_dsp:
+      sh_register_name = sh_sh3_dsp_register_name;
+      sh_show_regs = sh3_dsp_show_regs;
+      sh_store_return_value = sh_default_store_return_value;
+      sh_register_virtual_type = sh_default_register_virtual_type;
+      set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+      set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
+      tdep->DSR_REGNUM = 24;
+      tdep->A0G_REGNUM = 25;
+      tdep->A0_REGNUM = 26;
+      tdep->A1G_REGNUM = 27;
+      tdep->A1_REGNUM = 28;
+      tdep->M0_REGNUM = 29;
+      tdep->M1_REGNUM = 30;
+      tdep->X0_REGNUM = 31;
+      tdep->X1_REGNUM = 32;
+      tdep->Y0_REGNUM = 33;
+      tdep->Y1_REGNUM = 34;
+      tdep->MOD_REGNUM = 40;
+      tdep->RS_REGNUM = 43;
+      tdep->RE_REGNUM = 44;
+      tdep->SSR_REGNUM = 41;
+      tdep->SPC_REGNUM = 42;
+      break;
+    case bfd_mach_sh4:
+      sh_register_name = sh_sh4_register_name;
+      sh_show_regs = sh4_show_regs;
+      sh_store_return_value = sh3e_sh4_store_return_value;
+      sh_register_virtual_type = sh_sh4_register_virtual_type;
+      set_gdbarch_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs);
+      set_gdbarch_fp0_regnum (gdbarch, 25);
+      set_gdbarch_register_raw_size (gdbarch, sh_sh4_register_raw_size);
+      set_gdbarch_register_virtual_size (gdbarch, sh_sh4_register_raw_size);
+      set_gdbarch_register_byte (gdbarch, sh_sh4_register_byte);
+      set_gdbarch_num_pseudo_regs (gdbarch, 12);
+      set_gdbarch_max_register_raw_size (gdbarch, 4 * 4);
+      set_gdbarch_max_register_virtual_size (gdbarch, 4 * 4);
+      set_gdbarch_register_convert_to_raw (gdbarch, sh_sh4_register_convert_to_raw);
+      set_gdbarch_register_convert_to_virtual (gdbarch, sh_sh4_register_convert_to_virtual);
+      set_gdbarch_register_convertible (gdbarch, sh_sh4_register_convertible);
+      tdep->FPUL_REGNUM = 23;
+      tdep->FPSCR_REGNUM = 24;
+      tdep->FP_LAST_REGNUM = 40;
+      tdep->SSR_REGNUM = 41;
+      tdep->SPC_REGNUM = 42;
+      tdep->DR0_REGNUM = 59;
+      tdep->DR_LAST_REGNUM = 66;
+      tdep->FV0_REGNUM = 67;
+      tdep->FV_LAST_REGNUM = 70;
+      break;
+    default:
+      sh_register_name = sh_generic_register_name;
+      sh_show_regs = sh_generic_show_regs;
+      sh_store_return_value = sh_default_store_return_value;
+      sh_register_virtual_type = sh_default_register_virtual_type;
+      set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+      set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
+      break;
+    }
+
+  set_gdbarch_read_pc (gdbarch, generic_target_read_pc);
+  set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
+  set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
+  set_gdbarch_write_fp (gdbarch, generic_target_write_fp);
+  set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
+  set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+
+  set_gdbarch_register_name (gdbarch, sh_register_name);
+  set_gdbarch_register_virtual_type (gdbarch, sh_register_virtual_type);
+
+  set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
+  set_gdbarch_int_bit (gdbarch, 4 * 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, 16 * TARGET_CHAR_BIT);/*??should be 8?*/
+
+  set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
+  set_gdbarch_call_dummy_length (gdbarch, 0);
+  set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
+  set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
+  set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); /*???*/
+  set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
+  set_gdbarch_call_dummy_start_offset (gdbarch, 0);
+  set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy);
+  set_gdbarch_call_dummy_words (gdbarch, sh_call_dummy_words);
+  set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (sh_call_dummy_words));
+  set_gdbarch_call_dummy_p (gdbarch, 1);
+  set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
+  set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
+  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
+  set_gdbarch_coerce_float_to_double (gdbarch, 
+				      sh_coerce_float_to_double);
+
+  set_gdbarch_extract_return_value (gdbarch, sh_extract_return_value);
+  set_gdbarch_push_arguments (gdbarch, sh_push_arguments);
+  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
+  set_gdbarch_push_return_address (gdbarch, sh_push_return_address);
+
+  set_gdbarch_store_struct_return (gdbarch, sh_store_struct_return);
+  set_gdbarch_store_return_value (gdbarch, sh_store_return_value);
+  set_gdbarch_extract_struct_value_address (gdbarch, sh_extract_struct_value_address);
+  set_gdbarch_use_struct_convention (gdbarch, sh_use_struct_convention);
+  set_gdbarch_init_extra_frame_info (gdbarch, sh_init_extra_frame_info);
+  set_gdbarch_pop_frame (gdbarch, sh_pop_frame);
+  set_gdbarch_skip_prologue (gdbarch, sh_skip_prologue);
+  set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
+  set_gdbarch_decr_pc_after_break (gdbarch, 0);
+  set_gdbarch_function_start_offset (gdbarch, 0);
+
+  set_gdbarch_frame_args_skip (gdbarch, 0);
+  set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue);
+  set_gdbarch_frame_chain (gdbarch, sh_frame_chain);
+  set_gdbarch_frame_chain_valid (gdbarch, generic_file_frame_chain_valid);
+  set_gdbarch_frame_saved_pc (gdbarch, sh_frame_saved_pc);
+  set_gdbarch_frame_args_address (gdbarch, sh_frame_args_address);
+  set_gdbarch_frame_locals_address (gdbarch, sh_frame_locals_address);
+  set_gdbarch_saved_pc_after_call (gdbarch, sh_saved_pc_after_call);
+  set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
+  set_gdbarch_believe_pcc_promotion (gdbarch, 1);
+  set_gdbarch_ieee_float (gdbarch, 1);
+  tm_print_insn = print_sh_insn;
+
+  return gdbarch;
+}
+
+void
+_initialize_sh_tdep (void)
 {
   struct cmd_list_element *c;
+  
+  register_gdbarch_init (bfd_arch_sh, sh_gdbarch_init);
 
-  tm_print_insn = gdb_print_insn_sh;
-
-  target_architecture_hook = sh_target_architecture_hook;
-
-  add_com ("regs", class_vars, sh_show_regs, "Print all registers");
+  add_com ("regs", class_vars, sh_show_regs_command, "Print all registers");
 }
diff --git a/gdb/sh3-rom.c b/gdb/sh3-rom.c
index b76e8ca..47c147b 100644
--- a/gdb/sh3-rom.c
+++ b/gdb/sh3-rom.c
@@ -1,5 +1,5 @@
 /* Remote target glue for the Hitachi SH-3 ROM monitor.
-   Copyright 1995, 1996 Free Software Foundation, Inc.
+   Copyright 1995, 1996, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -24,6 +24,7 @@
 #include "monitor.h"
 #include "serial.h"
 #include "srec.h"
+#include "arch-utils.h"
 
 static serial_t parallel;
 static int parallel_in_use;
@@ -31,11 +32,7 @@
 static void sh3_open (char *args, int from_tty);
 
 static void
-sh3_supply_register (regname, regnamelen, val, vallen)
-     char *regname;
-     int regnamelen;
-     char *val;
-     int vallen;
+sh3_supply_register (char *regname, int regnamelen, char *val, int vallen)
 {
   int numregs;
   int regno;
@@ -75,9 +72,9 @@
 	  break;
 	case 'S':
 	  if (regname[1] == 'S' && regname[2] == 'R')
-	    regno = SSR_REGNUM;
+	    regno = gdbarch_tdep (current_gdbarch)->SSR_REGNUM;
 	  else if (regname[1] == 'P' && regname[2] == 'C')
-	    regno = SPC_REGNUM;
+	    regno = gdbarch_tdep (current_gdbarch)->SPC_REGNUM;
 	  break;
 	}
     }
@@ -121,10 +118,7 @@
 }
 
 static void
-sh3_load (desc, file, hashmark)
-     serial_t desc;
-     char *file;
-     int hashmark;
+sh3_load (serial_t desc, char *file, int hashmark)
 {
   if (parallel_in_use)
     {
@@ -152,7 +146,7 @@
    than does GDB, and don't necessarily support all the registers
    either. So, typing "info reg sp" becomes a "r30".  */
 
-static char *sh3_regnames[NUM_REGS] =
+static char *sh3_regnames[] =
 {
   "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7",
   "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15",
@@ -167,7 +161,7 @@
   "R4_BANK1", "R5_BANK1", "R6_BANK1", "R7_BANK1"
 };
 
-static char *sh3e_regnames[NUM_REGS] =
+static char *sh3e_regnames[] =
 {
   "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7",
   "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15",
@@ -248,9 +242,7 @@
 static struct monitor_ops sh3e_cmds;
 
 static void
-sh3_open (args, from_tty)
-     char *args;
-     int from_tty;
+sh3_open (char *args, int from_tty)
 {
   char *serial_port_name = args;
   char *parallel_port_name = 0;
@@ -290,9 +282,7 @@
 
 
 static void
-sh3e_open (args, from_tty)
-     char *args;
-     int from_tty;
+sh3e_open (char *args, int from_tty)
 {
   char *serial_port_name = args;
   char *parallel_port_name = 0;
@@ -338,8 +328,7 @@
 }
 
 static void
-sh3_close (quitting)
-     int quitting;
+sh3_close (int quitting)
 {
   monitor_close (quitting);
   if (parallel_in_use)
@@ -350,7 +339,7 @@
 }
 
 void
-_initialize_sh3_rom ()
+_initialize_sh3_rom (void)
 {
   init_sh3_cmds ();
   init_monitor_ops (&sh3_ops);
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 563dbd0..be51710 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -1,5 +1,5 @@
 /* Low level interface for debugging Solaris threads for GDB, the GNU debugger.
-   Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -57,6 +57,7 @@
 #include <sys/stat.h>
 #include <dlfcn.h>
 #include "gdbcmd.h"
+#include "gdbcore.h"
 
 extern struct target_ops sol_thread_ops;	/* Forward declaration */
 extern struct target_ops sol_core_ops;	/* Forward declaration */
@@ -192,8 +193,7 @@
  */
 
 static char *
-td_err_string (errcode)
-     td_err_e errcode;
+td_err_string (td_err_e errcode)
 {
   static struct string_map
     td_err_table[] =
@@ -217,7 +217,7 @@
     {TD_NOAPLIC, "Operation not applicable to"},
     {TD_NOTSD, "No thread specific data for this thread"},
     {TD_MALLOC, "Malloc failed"},
-    {TD_PARTIALREG, "Only part of register set was writen/read"},
+    {TD_PARTIALREG, "Only part of register set was written/read"},
     {TD_NOXREGS, "X register set not available for given thread"}
   };
   const int td_err_size = sizeof td_err_table / sizeof (struct string_map);
@@ -251,8 +251,7 @@
  */
 
 static char *
-td_state_string (statecode)
-     td_thr_state_e statecode;
+td_state_string (td_thr_state_e statecode)
 {
   static struct string_map
     td_thr_state_table[] =
@@ -302,9 +301,7 @@
  */
 
 static int
-thread_to_lwp (thread_id, default_lwp)
-     int thread_id;
-     int default_lwp;
+thread_to_lwp (int thread_id, int default_lwp)
 {
   td_thrinfo_t ti;
   td_thrhandle_t th;
@@ -360,8 +357,7 @@
  */
 
 static int
-lwp_to_thread (lwp)
-     int lwp;
+lwp_to_thread (int lwp)
 {
   td_thrinfo_t ti;
   td_thrhandle_t th;
@@ -426,14 +422,13 @@
 
 
 static struct cleanup *
-save_inferior_pid ()
+save_inferior_pid (void)
 {
   return make_cleanup (restore_inferior_pid, (void *) inferior_pid);
 }
 
 static void
-restore_inferior_pid (pid)
-     void *pid;
+restore_inferior_pid (void *pid)
 {
   inferior_pid = (int) pid;
 }
@@ -445,9 +440,7 @@
 
 /* ARGSUSED */
 static void
-sol_thread_open (arg, from_tty)
-     char *arg;
-     int from_tty;
+sol_thread_open (char *arg, int from_tty)
 {
   procfs_ops.to_open (arg, from_tty);
 }
@@ -456,13 +449,13 @@
    and wait for the trace-trap that results from attaching.  */
 
 static void
-sol_thread_attach (args, from_tty)
-     char *args;
-     int from_tty;
+sol_thread_attach (char *args, int from_tty)
 {
   procfs_ops.to_attach (args, from_tty);
+
   /* Must get symbols from solibs before libthread_db can run! */
   SOLIB_ADD ((char *) 0, from_tty, (struct target_ops *) 0);
+
   if (sol_thread_active)
     {
       printf_filtered ("sol-thread active.\n");
@@ -486,9 +479,7 @@
    started via the normal ptrace (PTRACE_TRACEME).  */
 
 static void
-sol_thread_detach (args, from_tty)
-     char *args;
-     int from_tty;
+sol_thread_detach (char *args, int from_tty)
 {
   inferior_pid = PIDGET (main_ph.pid);
   unpush_target (&sol_thread_ops);
@@ -501,10 +492,7 @@
    for procfs.  */
 
 static void
-sol_thread_resume (pid, step, signo)
-     int pid;
-     int step;
-     enum target_signal signo;
+sol_thread_resume (int pid, int step, enum target_signal signo)
 {
   struct cleanup *old_chain;
 
@@ -535,9 +523,7 @@
    to a LWP id, and vice versa on the way out.  */
 
 static int
-sol_thread_wait (pid, ourstatus)
-     int pid;
-     struct target_waitstatus *ourstatus;
+sol_thread_wait (int pid, struct target_waitstatus *ourstatus)
 {
   int rtnval;
   int save_pid;
@@ -591,8 +577,7 @@
 }
 
 static void
-sol_thread_fetch_registers (regno)
-     int regno;
+sol_thread_fetch_registers (int regno)
 {
   thread_t thread;
   td_thrhandle_t thandle;
@@ -670,8 +655,7 @@
 }
 
 static void
-sol_thread_store_registers (regno)
-     int regno;
+sol_thread_store_registers (int regno)
 {
   thread_t thread;
   td_thrhandle_t thandle;
@@ -765,18 +749,20 @@
    debugged.  */
 
 static void
-sol_thread_prepare_to_store ()
+sol_thread_prepare_to_store (void)
 {
   procfs_ops.to_prepare_to_store ();
 }
 
+/* Transfer LEN bytes between GDB address MYADDR and target address
+   MEMADDR.  If DOWRITE is non-zero, transfer them to the target,
+   otherwise transfer them from the target.  TARGET is unused.
+
+   Returns the number of bytes transferred. */
+
 static int
-sol_thread_xfer_memory (memaddr, myaddr, len, dowrite, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int dowrite;
-     struct target_ops *target;	/* ignored */
+sol_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
+			struct target_ops *target)
 {
   int retval;
   struct cleanup *old_chain;
@@ -802,21 +788,19 @@
 /* Print status information about what we're accessing.  */
 
 static void
-sol_thread_files_info (ignore)
-     struct target_ops *ignore;
+sol_thread_files_info (struct target_ops *ignore)
 {
   procfs_ops.to_files_info (ignore);
 }
 
 static void
-sol_thread_kill_inferior ()
+sol_thread_kill_inferior (void)
 {
   procfs_ops.to_kill ();
 }
 
 static void
-sol_thread_notice_signals (pid)
-     int pid;
+sol_thread_notice_signals (int pid)
 {
   procfs_ops.to_notice_signals (PIDGET (pid));
 }
@@ -824,10 +808,7 @@
 /* Fork an inferior process, and start debugging it with /proc.  */
 
 static void
-sol_thread_create_inferior (exec_file, allargs, env)
-     char *exec_file;
-     char *allargs;
-     char **env;
+sol_thread_create_inferior (char *exec_file, char *allargs, char **env)
 {
   procfs_ops.to_create_inferior (exec_file, allargs, env);
 
@@ -860,8 +841,7 @@
 static void (*target_new_objfile_chain) (struct objfile *);
 
 void
-sol_thread_new_objfile (objfile)
-     struct objfile *objfile;
+sol_thread_new_objfile (struct objfile *objfile)
 {
   td_err_e val;
 
@@ -905,7 +885,7 @@
 /* Clean up after the inferior dies.  */
 
 static void
-sol_thread_mourn_inferior ()
+sol_thread_mourn_inferior (void)
 {
   unpush_target (&sol_thread_ops);
   procfs_ops.to_mourn_inferior ();
@@ -914,7 +894,7 @@
 /* Mark our target-struct as eligible for stray "run" and "attach" commands.  */
 
 static int
-sol_thread_can_run ()
+sol_thread_can_run (void)
 {
   return procfs_suppress_run;
 }
@@ -936,8 +916,7 @@
  */
 
 static int
-sol_thread_alive (pid)
-     int pid;
+sol_thread_alive (int pid)
 {
   if (is_thread (pid))		/* non-kernel thread */
     {
@@ -962,7 +941,7 @@
 }
 
 static void
-sol_thread_stop ()
+sol_thread_stop (void)
 {
   procfs_ops.to_stop ();
 }
@@ -1070,6 +1049,13 @@
     inferior_pid = procfs_first_available ();	/* Find any live lwp.  */
   /* Note: don't need to call switch_to_thread; we're just reading memory.  */
 
+#if defined (__sparcv9)
+  /* For Sparc64 cross Sparc32, make sure the address has not been
+     accidentally sign-extended (or whatever) to beyond 32 bits.  */
+  if (bfd_get_arch_size (exec_bfd) == 32)
+    addr &= 0xffffffff;
+#endif
+
   while (size > 0)
     {
       int cc;
@@ -1327,6 +1313,26 @@
   return PS_OK;
 }
 
+#ifdef PR_MODEL_LP64
+/* Identify process as 32-bit or 64-bit.
+   At the moment I'm using bfd to do this.
+   There might be a more solaris-specific (eg. procfs) method,
+   but this ought to work.  */
+
+ps_err_e
+ps_pdmodel (gdb_ps_prochandle_t ph, int *data_model)
+{
+  if (exec_bfd == 0)
+    *data_model = PR_MODEL_UNKNOWN;
+  else if (bfd_get_arch_size (exec_bfd) == 32)
+    *data_model = PR_MODEL_ILP32;
+  else
+    *data_model = PR_MODEL_LP64;
+
+  return PS_OK;
+}
+#endif /* PR_MODEL_LP64 */
+
 #ifdef TM_I386SOL2_H
 
 /* Reads the local descriptor table of a LWP.  */
@@ -1359,8 +1365,7 @@
 /* Convert a pid to printable form. */
 
 char *
-solaris_pid_to_str (pid)
-     int pid;
+solaris_pid_to_str (int pid)
 {
   static char buf[100];
 
@@ -1395,9 +1400,7 @@
    kernel) thread. */
 
 static int
-sol_find_new_threads_callback (th, ignored)
-     const td_thrhandle_t *th;
-     void *ignored;
+sol_find_new_threads_callback (const td_thrhandle_t *th, void *ignored)
 {
   td_err_e retval;
   td_thrinfo_t ti;
@@ -1415,7 +1418,7 @@
 }
 
 static void
-sol_find_new_threads ()
+sol_find_new_threads (void)
 {
   /* don't do anything if init failed to resolve the libthread_db library */
   if (!procfs_suppress_run)
@@ -1433,32 +1436,26 @@
 }
 
 static void
-sol_core_open (filename, from_tty)
-     char *filename;
-     int from_tty;
+sol_core_open (char *filename, int from_tty)
 {
   orig_core_ops.to_open (filename, from_tty);
 }
 
 static void
-sol_core_close (quitting)
-     int quitting;
+sol_core_close (int quitting)
 {
   orig_core_ops.to_close (quitting);
 }
 
 static void
-sol_core_detach (args, from_tty)
-     char *args;
-     int from_tty;
+sol_core_detach (char *args, int from_tty)
 {
   unpush_target (&core_ops);
   orig_core_ops.to_detach (args, from_tty);
 }
 
 static void
-sol_core_files_info (t)
-     struct target_ops *t;
+sol_core_files_info (struct target_ops *t)
 {
   orig_core_ops.to_files_info (t);
 }
@@ -1468,9 +1465,7 @@
    inferior.  Print anything interesting that we can think of.  */
 
 static int
-info_cb (th, s)
-     const td_thrhandle_t *th;
-     void *s;
+info_cb (const td_thrhandle_t *th, void *s)
 {
   td_err_e ret;
   td_thrinfo_t ti;
@@ -1540,9 +1535,7 @@
 /* List some state about each Solaris user thread in the inferior.  */
 
 static void
-info_solthreads (args, from_tty)
-     char *args;
-     int from_tty;
+info_solthreads (char *args, int from_tty)
 {
   p_td_ta_thr_iter (main_ta, info_cb, args,
 		    TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
@@ -1550,16 +1543,14 @@
 }
 
 static int
-ignore (addr, contents)
-     CORE_ADDR addr;
-     char *contents;
+ignore (CORE_ADDR addr, char *contents)
 {
   return 0;
 }
 
 
 static void
-init_sol_thread_ops ()
+init_sol_thread_ops (void)
 {
   sol_thread_ops.to_shortname = "solaris-threads";
   sol_thread_ops.to_longname = "Solaris threads and pthread.";
@@ -1607,7 +1598,7 @@
 
 
 static void
-init_sol_core_ops ()
+init_sol_core_ops (void)
 {
   sol_core_ops.to_shortname = "solaris-core";
   sol_core_ops.to_longname = "Solaris core threads and pthread.";
@@ -1660,7 +1651,7 @@
 int coreops_suppress_target = 1;
 
 void
-_initialize_sol_thread ()
+_initialize_sol_thread (void)
 {
   void *dlhandle;
 
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
new file mode 100644
index 0000000..603c69c
--- /dev/null
+++ b/gdb/solib-svr4.c
@@ -0,0 +1,1699 @@
+/* Handle SunOS and SVR4 shared libraries for GDB, the GNU Debugger.
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 1999, 2000
+   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.  */
+
+#define _SYSCALL32	/* for Sparc64 cross Sparc32 */
+#include "defs.h"
+
+
+#include <sys/types.h>
+#include <signal.h>
+#include "gdb_string.h"
+#include <sys/param.h>
+#include <fcntl.h>
+
+#ifndef SVR4_SHARED_LIBS
+ /* SunOS shared libs need the nlist structure.  */
+#include <a.out.h>
+#else
+#include "elf/external.h"
+#endif
+
+#ifdef HAVE_LINK_H
+#include <link.h>
+#endif
+
+#include "symtab.h"
+#include "bfd.h"
+#include "symfile.h"
+#include "objfiles.h"
+#include "gdbcore.h"
+#include "command.h"
+#include "target.h"
+#include "frame.h"
+#include "gdb_regex.h"
+#include "inferior.h"
+#include "environ.h"
+#include "language.h"
+#include "gdbcmd.h"
+
+#include "solist.h"
+#include "solib-svr4.h"
+
+/* Link map info to include in an allocated so_list entry */
+
+struct lm_info
+  {
+    /* Pointer to copy of link map from inferior.  The type is char *
+       rather than void *, so that we may use byte offsets to find the
+       various fields without the need for a cast.  */
+    char *lm;
+  };
+
+/* On SVR4 systems, a list of symbols in the dynamic linker where
+   GDB can try to place a breakpoint to monitor shared library
+   events.
+
+   If none of these symbols are found, or other errors occur, then
+   SVR4 systems will fall back to using a symbol as the "startup
+   mapping complete" breakpoint address.  */
+
+#ifdef SVR4_SHARED_LIBS
+static char *solib_break_names[] =
+{
+  "r_debug_state",
+  "_r_debug_state",
+  "_dl_debug_state",
+  "rtld_db_dlactivity",
+  "_rtld_debug_state",
+  NULL
+};
+#endif
+
+#define BKPT_AT_SYMBOL 1
+
+#if defined (BKPT_AT_SYMBOL) && defined (SVR4_SHARED_LIBS)
+static char *bkpt_names[] =
+{
+#ifdef SOLIB_BKPT_NAME
+  SOLIB_BKPT_NAME,		/* Prefer configured name if it exists. */
+#endif
+  "_start",
+  "main",
+  NULL
+};
+#endif
+
+/* Symbols which are used to locate the base of the link map structures. */
+
+#ifndef SVR4_SHARED_LIBS
+static char *debug_base_symbols[] =
+{
+  "_DYNAMIC",
+  "_DYNAMIC__MGC",
+  NULL
+};
+#endif
+
+static char *main_name_list[] =
+{
+  "main_$main",
+  NULL
+};
+
+
+/* Fetch (and possibly build) an appropriate link_map_offsets structure
+   for native targets using struct definitions from link.h.  */
+
+struct link_map_offsets *
+default_svr4_fetch_link_map_offsets (void)
+{
+#ifdef HAVE_LINK_H
+  static struct link_map_offsets lmo;
+  static struct link_map_offsets *lmp = 0;
+#if defined (HAVE_STRUCT_LINK_MAP32)
+  static struct link_map_offsets lmo32;
+  static struct link_map_offsets *lmp32 = 0;
+#endif
+
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
+#endif
+#define fieldsize(TYPE, MEMBER) (sizeof (((TYPE *)0)->MEMBER))
+
+  if (lmp == 0)
+    {
+      lmp = &lmo;
+
+#ifdef SVR4_SHARED_LIBS
+      lmo.r_debug_size = sizeof (struct r_debug);
+
+      lmo.r_map_offset = offsetof (struct r_debug, r_map);
+      lmo.r_map_size = fieldsize (struct r_debug, r_map);
+
+      lmo.link_map_size = sizeof (struct link_map);
+
+      lmo.l_addr_offset = offsetof (struct link_map, l_addr);
+      lmo.l_addr_size = fieldsize (struct link_map, l_addr);
+
+      lmo.l_next_offset = offsetof (struct link_map, l_next);
+      lmo.l_next_size = fieldsize (struct link_map, l_next);
+
+      lmo.l_prev_offset = offsetof (struct link_map, l_prev);
+      lmo.l_prev_size = fieldsize (struct link_map, l_prev);
+
+      lmo.l_name_offset = offsetof (struct link_map, l_name);
+      lmo.l_name_size = fieldsize (struct link_map, l_name);
+#else /* !SVR4_SHARED_LIBS */
+      lmo.link_map_size = sizeof (struct link_map);
+
+      lmo.l_addr_offset = offsetof (struct link_map, lm_addr);
+      lmo.l_addr_size = fieldsize (struct link_map, lm_addr);
+
+      lmo.l_next_offset = offsetof (struct link_map, lm_next);
+      lmo.l_next_size = fieldsize (struct link_map, lm_next);
+
+      lmo.l_name_offset = offsetof (struct link_map, lm_name);
+      lmo.l_name_size = fieldsize (struct link_map, lm_name);
+#endif /* SVR4_SHARED_LIBS */
+    }
+
+#if defined (HAVE_STRUCT_LINK_MAP32)
+  if (lmp32 == 0)
+    {
+      lmp32 = &lmo32;
+
+      lmo32.r_debug_size = sizeof (struct r_debug32);
+
+      lmo32.r_map_offset = offsetof (struct r_debug32, r_map);
+      lmo32.r_map_size = fieldsize (struct r_debug32, r_map);
+
+      lmo32.link_map_size = sizeof (struct link_map32);
+
+      lmo32.l_addr_offset = offsetof (struct link_map32, l_addr);
+      lmo32.l_addr_size = fieldsize (struct link_map32, l_addr);
+
+      lmo32.l_next_offset = offsetof (struct link_map32, l_next);
+      lmo32.l_next_size = fieldsize (struct link_map32, l_next);
+
+      lmo32.l_prev_offset = offsetof (struct link_map32, l_prev);
+      lmo32.l_prev_size = fieldsize (struct link_map32, l_prev);
+
+      lmo32.l_name_offset = offsetof (struct link_map32, l_name);
+      lmo32.l_name_size = fieldsize (struct link_map32, l_name);
+    }
+#endif /* defined (HAVE_STRUCT_LINK_MAP32) */
+
+#if defined (HAVE_STRUCT_LINK_MAP32)
+  if (bfd_get_arch_size (exec_bfd) == 32)
+    return lmp32;
+  else
+#endif
+    return lmp;
+
+#else
+
+  internal_error ("default_svr4_fetch_link_map_offsets called without HAVE_LINK_H defined.");
+  return 0;
+
+#endif /* HAVE_LINK_H */
+}
+
+/* Macro to extract an address from a solib structure.
+   When GDB is configured for some 32-bit targets (e.g. Solaris 2.7
+   sparc), BFD is configured to handle 64-bit targets, so CORE_ADDR is
+   64 bits.  We have to extract only the significant bits of addresses
+   to get the right address when accessing the core file BFD.  */
+
+#define SOLIB_EXTRACT_ADDRESS(MEMBER) \
+	extract_address (&(MEMBER), sizeof (MEMBER))
+
+/* local data declarations */
+
+#ifndef SVR4_SHARED_LIBS
+
+/* NOTE: converted the macros LM_ADDR, LM_NEXT, LM_NAME and
+   IGNORE_FIRST_LINK_MAP_ENTRY into functions (see below).
+   MVS, June 2000  */
+
+static struct link_dynamic dynamic_copy;
+static struct link_dynamic_2 ld_2_copy;
+static struct ld_debug debug_copy;
+static CORE_ADDR debug_addr;
+static CORE_ADDR flag_addr;
+
+#endif /* !SVR4_SHARED_LIBS */
+
+/* link map access functions */
+
+static CORE_ADDR
+LM_ADDR (struct so_list *so)
+{
+  struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
+
+  return extract_address (so->lm_info->lm + lmo->l_addr_offset, lmo->l_addr_size);
+}
+
+static CORE_ADDR
+LM_NEXT (struct so_list *so)
+{
+  struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
+
+  return extract_address (so->lm_info->lm + lmo->l_next_offset, lmo->l_next_size);
+}
+
+static CORE_ADDR
+LM_NAME (struct so_list *so)
+{
+  struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
+
+  return extract_address (so->lm_info->lm + lmo->l_name_offset, lmo->l_name_size);
+}
+
+#ifndef SVR4_SHARED_LIBS
+
+static int 
+IGNORE_FIRST_LINK_MAP_ENTRY (struct so_list *so)
+{
+  return 0;
+}
+
+#else /* SVR4_SHARED_LIBS */
+
+static int
+IGNORE_FIRST_LINK_MAP_ENTRY (struct so_list *so)
+{
+  struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
+
+  return extract_address (so->lm_info->lm + lmo->l_prev_offset,
+                          lmo->l_prev_size) == 0;
+}
+
+#endif /* !SVR4_SHARED_LIBS */
+
+static CORE_ADDR debug_base;	/* Base of dynamic linker structures */
+static CORE_ADDR breakpoint_addr;	/* Address where end bkpt is set */
+
+/* Local function prototypes */
+
+static int match_main (char *);
+
+#ifndef SVR4_SHARED_LIBS
+
+/* Allocate the runtime common object file.  */
+
+static void
+allocate_rt_common_objfile (void)
+{
+  struct objfile *objfile;
+  struct objfile *last_one;
+
+  objfile = (struct objfile *) xmalloc (sizeof (struct objfile));
+  memset (objfile, 0, sizeof (struct objfile));
+  objfile->md = NULL;
+  obstack_specify_allocation (&objfile->psymbol_cache.cache, 0, 0,
+			      xmalloc, xfree);
+  obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0, xmalloc,
+			      xfree);
+  obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc,
+			      xfree);
+  obstack_specify_allocation (&objfile->type_obstack, 0, 0, xmalloc,
+			      xfree);
+  objfile->name = mstrsave (objfile->md, "rt_common");
+
+  /* Add this file onto the tail of the linked list of other such files. */
+
+  objfile->next = NULL;
+  if (object_files == NULL)
+    object_files = objfile;
+  else
+    {
+      for (last_one = object_files;
+	   last_one->next;
+	   last_one = last_one->next);
+      last_one->next = objfile;
+    }
+
+  rt_common_objfile = objfile;
+}
+
+/* Read all dynamically loaded common symbol definitions from the inferior
+   and put them into the minimal symbol table for the runtime common
+   objfile.  */
+
+static void
+solib_add_common_symbols (CORE_ADDR rtc_symp)
+{
+  struct rtc_symb inferior_rtc_symb;
+  struct nlist inferior_rtc_nlist;
+  int len;
+  char *name;
+
+  /* Remove any runtime common symbols from previous runs.  */
+
+  if (rt_common_objfile != NULL && rt_common_objfile->minimal_symbol_count)
+    {
+      obstack_free (&rt_common_objfile->symbol_obstack, 0);
+      obstack_specify_allocation (&rt_common_objfile->symbol_obstack, 0, 0,
+				  xmalloc, xfree);
+      rt_common_objfile->minimal_symbol_count = 0;
+      rt_common_objfile->msymbols = NULL;
+    }
+
+  init_minimal_symbol_collection ();
+  make_cleanup_discard_minimal_symbols ();
+
+  while (rtc_symp)
+    {
+      read_memory (rtc_symp,
+		   (char *) &inferior_rtc_symb,
+		   sizeof (inferior_rtc_symb));
+      read_memory (SOLIB_EXTRACT_ADDRESS (inferior_rtc_symb.rtc_sp),
+		   (char *) &inferior_rtc_nlist,
+		   sizeof (inferior_rtc_nlist));
+      if (inferior_rtc_nlist.n_type == N_COMM)
+	{
+	  /* FIXME: The length of the symbol name is not available, but in the
+	     current implementation the common symbol is allocated immediately
+	     behind the name of the symbol. */
+	  len = inferior_rtc_nlist.n_value - inferior_rtc_nlist.n_un.n_strx;
+
+	  name = xmalloc (len);
+	  read_memory (SOLIB_EXTRACT_ADDRESS (inferior_rtc_nlist.n_un.n_name),
+		       name, len);
+
+	  /* Allocate the runtime common objfile if necessary. */
+	  if (rt_common_objfile == NULL)
+	    allocate_rt_common_objfile ();
+
+	  prim_record_minimal_symbol (name, inferior_rtc_nlist.n_value,
+				      mst_bss, rt_common_objfile);
+	  xfree (name);
+	}
+      rtc_symp = SOLIB_EXTRACT_ADDRESS (inferior_rtc_symb.rtc_next);
+    }
+
+  /* Install any minimal symbols that have been collected as the current
+     minimal symbols for the runtime common objfile.  */
+
+  install_minimal_symbols (rt_common_objfile);
+}
+
+#endif /* SVR4_SHARED_LIBS */
+
+
+#ifdef SVR4_SHARED_LIBS
+
+static CORE_ADDR bfd_lookup_symbol (bfd *, char *);
+
+/*
+
+   LOCAL FUNCTION
+
+   bfd_lookup_symbol -- lookup the value for a specific symbol
+
+   SYNOPSIS
+
+   CORE_ADDR bfd_lookup_symbol (bfd *abfd, char *symname)
+
+   DESCRIPTION
+
+   An expensive way to lookup the value of a single symbol for
+   bfd's that are only temporary anyway.  This is used by the
+   shared library support to find the address of the debugger
+   interface structures in the shared library.
+
+   Note that 0 is specifically allowed as an error return (no
+   such symbol).
+ */
+
+static CORE_ADDR
+bfd_lookup_symbol (bfd *abfd, char *symname)
+{
+  unsigned int storage_needed;
+  asymbol *sym;
+  asymbol **symbol_table;
+  unsigned int number_of_symbols;
+  unsigned int i;
+  struct cleanup *back_to;
+  CORE_ADDR symaddr = 0;
+
+  storage_needed = bfd_get_symtab_upper_bound (abfd);
+
+  if (storage_needed > 0)
+    {
+      symbol_table = (asymbol **) xmalloc (storage_needed);
+      back_to = make_cleanup (xfree, (PTR) symbol_table);
+      number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
+
+      for (i = 0; i < number_of_symbols; i++)
+	{
+	  sym = *symbol_table++;
+	  if (STREQ (sym->name, symname))
+	    {
+	      /* Bfd symbols are section relative. */
+	      symaddr = sym->value + sym->section->vma;
+	      break;
+	    }
+	}
+      do_cleanups (back_to);
+    }
+
+  if (symaddr)
+    return symaddr;
+
+  /* On FreeBSD, the dynamic linker is stripped by default.  So we'll
+     have to check the dynamic string table too.  */
+
+  storage_needed = bfd_get_dynamic_symtab_upper_bound (abfd);
+
+  if (storage_needed > 0)
+    {
+      symbol_table = (asymbol **) xmalloc (storage_needed);
+      back_to = make_cleanup (xfree, (PTR) symbol_table);
+      number_of_symbols = bfd_canonicalize_dynamic_symtab (abfd, symbol_table);
+
+      for (i = 0; i < number_of_symbols; i++)
+	{
+	  sym = *symbol_table++;
+	  if (STREQ (sym->name, symname))
+	    {
+	      /* Bfd symbols are section relative. */
+	      symaddr = sym->value + sym->section->vma;
+	      break;
+	    }
+	}
+      do_cleanups (back_to);
+    }
+
+  return symaddr;
+}
+
+#ifdef HANDLE_SVR4_EXEC_EMULATORS
+
+/*
+   Solaris BCP (the part of Solaris which allows it to run SunOS4
+   a.out files) throws in another wrinkle. Solaris does not fill
+   in the usual a.out link map structures when running BCP programs,
+   the only way to get at them is via groping around in the dynamic
+   linker.
+   The dynamic linker and it's structures are located in the shared
+   C library, which gets run as the executable's "interpreter" by
+   the kernel.
+
+   Note that we can assume nothing about the process state at the time
+   we need to find these structures.  We may be stopped on the first
+   instruction of the interpreter (C shared library), the first
+   instruction of the executable itself, or somewhere else entirely
+   (if we attached to the process for example).
+ */
+
+static char *debug_base_symbols[] =
+{
+  "r_debug",			/* Solaris 2.3 */
+  "_r_debug",			/* Solaris 2.1, 2.2 */
+  NULL
+};
+
+static int look_for_base (int, CORE_ADDR);
+
+/*
+
+   LOCAL FUNCTION
+
+   look_for_base -- examine file for each mapped address segment
+
+   SYNOPSYS
+
+   static int look_for_base (int fd, CORE_ADDR baseaddr)
+
+   DESCRIPTION
+
+   This function is passed to proc_iterate_over_mappings, which
+   causes it to get called once for each mapped address space, with
+   an open file descriptor for the file mapped to that space, and the
+   base address of that mapped space.
+
+   Our job is to find the debug base symbol in the file that this
+   fd is open on, if it exists, and if so, initialize the dynamic
+   linker structure base address debug_base.
+
+   Note that this is a computationally expensive proposition, since
+   we basically have to open a bfd on every call, so we specifically
+   avoid opening the exec file.
+ */
+
+static int
+look_for_base (int fd, CORE_ADDR baseaddr)
+{
+  bfd *interp_bfd;
+  CORE_ADDR address = 0;
+  char **symbolp;
+
+  /* If the fd is -1, then there is no file that corresponds to this
+     mapped memory segment, so skip it.  Also, if the fd corresponds
+     to the exec file, skip it as well. */
+
+  if (fd == -1
+      || (exec_bfd != NULL
+	  && fdmatch (fileno ((FILE *) (exec_bfd->iostream)), fd)))
+    {
+      return (0);
+    }
+
+  /* Try to open whatever random file this fd corresponds to.  Note that
+     we have no way currently to find the filename.  Don't gripe about
+     any problems we might have, just fail. */
+
+  if ((interp_bfd = bfd_fdopenr ("unnamed", gnutarget, fd)) == NULL)
+    {
+      return (0);
+    }
+  if (!bfd_check_format (interp_bfd, bfd_object))
+    {
+      /* FIXME-leak: on failure, might not free all memory associated with
+         interp_bfd.  */
+      bfd_close (interp_bfd);
+      return (0);
+    }
+
+  /* Now try to find our debug base symbol in this file, which we at
+     least know to be a valid ELF executable or shared library. */
+
+  for (symbolp = debug_base_symbols; *symbolp != NULL; symbolp++)
+    {
+      address = bfd_lookup_symbol (interp_bfd, *symbolp);
+      if (address != 0)
+	{
+	  break;
+	}
+    }
+  if (address == 0)
+    {
+      /* FIXME-leak: on failure, might not free all memory associated with
+         interp_bfd.  */
+      bfd_close (interp_bfd);
+      return (0);
+    }
+
+  /* Eureka!  We found the symbol.  But now we may need to relocate it
+     by the base address.  If the symbol's value is less than the base
+     address of the shared library, then it hasn't yet been relocated
+     by the dynamic linker, and we have to do it ourself.  FIXME: Note
+     that we make the assumption that the first segment that corresponds
+     to the shared library has the base address to which the library
+     was relocated. */
+
+  if (address < baseaddr)
+    {
+      address += baseaddr;
+    }
+  debug_base = address;
+  /* FIXME-leak: on failure, might not free all memory associated with
+     interp_bfd.  */
+  bfd_close (interp_bfd);
+  return (1);
+}
+#endif /* HANDLE_SVR4_EXEC_EMULATORS */
+
+/*
+
+   LOCAL FUNCTION
+
+   elf_locate_base -- locate the base address of dynamic linker structs
+   for SVR4 elf targets.
+
+   SYNOPSIS
+
+   CORE_ADDR elf_locate_base (void)
+
+   DESCRIPTION
+
+   For SVR4 elf targets the address of the dynamic linker's runtime
+   structure is contained within the dynamic info section in the
+   executable file.  The dynamic section is also mapped into the
+   inferior address space.  Because the runtime loader fills in the
+   real address before starting the inferior, we have to read in the
+   dynamic info section from the inferior address space.
+   If there are any errors while trying to find the address, we
+   silently return 0, otherwise the found address is returned.
+
+ */
+
+static CORE_ADDR
+elf_locate_base (void)
+{
+  sec_ptr dyninfo_sect;
+  int dyninfo_sect_size;
+  CORE_ADDR dyninfo_addr;
+  char *buf;
+  char *bufend;
+  int arch_size;
+
+  /* Find the start address of the .dynamic section.  */
+  dyninfo_sect = bfd_get_section_by_name (exec_bfd, ".dynamic");
+  if (dyninfo_sect == NULL)
+    return 0;
+  dyninfo_addr = bfd_section_vma (exec_bfd, dyninfo_sect);
+
+  /* Read in .dynamic section, silently ignore errors.  */
+  dyninfo_sect_size = bfd_section_size (exec_bfd, dyninfo_sect);
+  buf = alloca (dyninfo_sect_size);
+  if (target_read_memory (dyninfo_addr, buf, dyninfo_sect_size))
+    return 0;
+
+  /* Find the DT_DEBUG entry in the the .dynamic section.
+     For mips elf we look for DT_MIPS_RLD_MAP, mips elf apparently has
+     no DT_DEBUG entries.  */
+
+  arch_size = bfd_get_arch_size (exec_bfd);
+  if (arch_size == -1)	/* failure */
+    return 0;
+
+  if (arch_size == 32)
+    { /* 32-bit elf */
+      for (bufend = buf + dyninfo_sect_size;
+	   buf < bufend;
+	   buf += sizeof (Elf32_External_Dyn))
+	{
+	  Elf32_External_Dyn *x_dynp = (Elf32_External_Dyn *) buf;
+	  long dyn_tag;
+	  CORE_ADDR dyn_ptr;
+
+	  dyn_tag = bfd_h_get_32 (exec_bfd, (bfd_byte *) x_dynp->d_tag);
+	  if (dyn_tag == DT_NULL)
+	    break;
+	  else if (dyn_tag == DT_DEBUG)
+	    {
+	      dyn_ptr = bfd_h_get_32 (exec_bfd, 
+				      (bfd_byte *) x_dynp->d_un.d_ptr);
+	      return dyn_ptr;
+	    }
+#ifdef DT_MIPS_RLD_MAP
+	  else if (dyn_tag == DT_MIPS_RLD_MAP)
+	    {
+	      char *pbuf;
+
+	      pbuf = alloca (TARGET_PTR_BIT / HOST_CHAR_BIT);
+	      /* DT_MIPS_RLD_MAP contains a pointer to the address
+		 of the dynamic link structure.  */
+	      dyn_ptr = bfd_h_get_32 (exec_bfd, 
+				      (bfd_byte *) x_dynp->d_un.d_ptr);
+	      if (target_read_memory (dyn_ptr, pbuf, sizeof (pbuf)))
+		return 0;
+	      return extract_unsigned_integer (pbuf, sizeof (pbuf));
+	    }
+#endif
+	}
+    }
+  else /* 64-bit elf */
+    {
+      for (bufend = buf + dyninfo_sect_size;
+	   buf < bufend;
+	   buf += sizeof (Elf64_External_Dyn))
+	{
+	  Elf64_External_Dyn *x_dynp = (Elf64_External_Dyn *) buf;
+	  long dyn_tag;
+	  CORE_ADDR dyn_ptr;
+
+	  dyn_tag = bfd_h_get_64 (exec_bfd, (bfd_byte *) x_dynp->d_tag);
+	  if (dyn_tag == DT_NULL)
+	    break;
+	  else if (dyn_tag == DT_DEBUG)
+	    {
+	      dyn_ptr = bfd_h_get_64 (exec_bfd, 
+				      (bfd_byte *) x_dynp->d_un.d_ptr);
+	      return dyn_ptr;
+	    }
+	}
+    }
+
+  /* DT_DEBUG entry not found.  */
+  return 0;
+}
+
+#endif /* SVR4_SHARED_LIBS */
+
+/*
+
+   LOCAL FUNCTION
+
+   locate_base -- locate the base address of dynamic linker structs
+
+   SYNOPSIS
+
+   CORE_ADDR locate_base (void)
+
+   DESCRIPTION
+
+   For both the SunOS and SVR4 shared library implementations, if the
+   inferior executable has been linked dynamically, there is a single
+   address somewhere in the inferior's data space which is the key to
+   locating all of the dynamic linker's runtime structures.  This
+   address is the value of the debug base symbol.  The job of this
+   function is to find and return that address, or to return 0 if there
+   is no such address (the executable is statically linked for example).
+
+   For SunOS, the job is almost trivial, since the dynamic linker and
+   all of it's structures are statically linked to the executable at
+   link time.  Thus the symbol for the address we are looking for has
+   already been added to the minimal symbol table for the executable's
+   objfile at the time the symbol file's symbols were read, and all we
+   have to do is look it up there.  Note that we explicitly do NOT want
+   to find the copies in the shared library.
+
+   The SVR4 version is a bit more complicated because the address
+   is contained somewhere in the dynamic info section.  We have to go
+   to a lot more work to discover the address of the debug base symbol.
+   Because of this complexity, we cache the value we find and return that
+   value on subsequent invocations.  Note there is no copy in the
+   executable symbol tables.
+
+ */
+
+static CORE_ADDR
+locate_base (void)
+{
+
+#ifndef SVR4_SHARED_LIBS
+
+  struct minimal_symbol *msymbol;
+  CORE_ADDR address = 0;
+  char **symbolp;
+
+  /* For SunOS, we want to limit the search for the debug base symbol to the
+     executable being debugged, since there is a duplicate named symbol in the
+     shared library.  We don't want the shared library versions. */
+
+  for (symbolp = debug_base_symbols; *symbolp != NULL; symbolp++)
+    {
+      msymbol = lookup_minimal_symbol (*symbolp, NULL, symfile_objfile);
+      if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
+	{
+	  address = SYMBOL_VALUE_ADDRESS (msymbol);
+	  return (address);
+	}
+    }
+  return (0);
+
+#else /* SVR4_SHARED_LIBS */
+
+  /* Check to see if we have a currently valid address, and if so, avoid
+     doing all this work again and just return the cached address.  If
+     we have no cached address, try to locate it in the dynamic info
+     section for ELF executables.  */
+
+  if (debug_base == 0)
+    {
+      if (exec_bfd != NULL
+	  && bfd_get_flavour (exec_bfd) == bfd_target_elf_flavour)
+	debug_base = elf_locate_base ();
+#ifdef HANDLE_SVR4_EXEC_EMULATORS
+      /* Try it the hard way for emulated executables.  */
+      else if (inferior_pid != 0 && target_has_execution)
+	proc_iterate_over_mappings (look_for_base);
+#endif
+    }
+  return (debug_base);
+
+#endif /* !SVR4_SHARED_LIBS */
+
+}
+
+/*
+
+   LOCAL FUNCTION
+
+   first_link_map_member -- locate first member in dynamic linker's map
+
+   SYNOPSIS
+
+   static CORE_ADDR first_link_map_member (void)
+
+   DESCRIPTION
+
+   Find the first element in the inferior's dynamic link map, and
+   return its address in the inferior.  This function doesn't copy the
+   link map entry itself into our address space; current_sos actually
+   does the reading.  */
+
+static CORE_ADDR
+first_link_map_member (void)
+{
+  CORE_ADDR lm = 0;
+
+#ifndef SVR4_SHARED_LIBS
+
+  read_memory (debug_base, (char *) &dynamic_copy, sizeof (dynamic_copy));
+  if (dynamic_copy.ld_version >= 2)
+    {
+      /* It is a version that we can deal with, so read in the secondary
+         structure and find the address of the link map list from it. */
+      read_memory (SOLIB_EXTRACT_ADDRESS (dynamic_copy.ld_un.ld_2),
+		   (char *) &ld_2_copy, sizeof (struct link_dynamic_2));
+      lm = SOLIB_EXTRACT_ADDRESS (ld_2_copy.ld_loaded);
+    }
+
+#else /* SVR4_SHARED_LIBS */
+  struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
+  char *r_map_buf = xmalloc (lmo->r_map_size);
+  struct cleanup *cleanups = make_cleanup (xfree, r_map_buf);
+
+  read_memory (debug_base + lmo->r_map_offset, r_map_buf, lmo->r_map_size);
+
+  lm = extract_address (r_map_buf, lmo->r_map_size);
+
+  /* FIXME:  Perhaps we should validate the info somehow, perhaps by
+     checking r_version for a known version number, or r_state for
+     RT_CONSISTENT. */
+
+  do_cleanups (cleanups);
+
+#endif /* !SVR4_SHARED_LIBS */
+
+  return (lm);
+}
+
+#ifdef SVR4_SHARED_LIBS
+/*
+
+  LOCAL FUNCTION
+
+  open_symbol_file_object
+
+  SYNOPSIS
+
+  void open_symbol_file_object (void *from_tty)
+
+  DESCRIPTION
+
+  If no open symbol file, attempt to locate and open the main symbol
+  file.  On SVR4 systems, this is the first link map entry.  If its
+  name is here, we can open it.  Useful when attaching to a process
+  without first loading its symbol file.
+
+  If FROM_TTYP dereferences to a non-zero integer, allow messages to
+  be printed.  This parameter is a pointer rather than an int because
+  open_symbol_file_object() is called via catch_errors() and
+  catch_errors() requires a pointer argument. */
+
+static int
+open_symbol_file_object (void *from_ttyp)
+{
+  CORE_ADDR lm, l_name;
+  char *filename;
+  int errcode;
+  int from_tty = *(int *)from_ttyp;
+  struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
+  char *l_name_buf = xmalloc (lmo->l_name_size);
+  struct cleanup *cleanups = make_cleanup (xfree, l_name_buf);
+
+  if (symfile_objfile)
+    if (!query ("Attempt to reload symbols from process? "))
+      return 0;
+
+  if ((debug_base = locate_base ()) == 0)
+    return 0;	/* failed somehow... */
+
+  /* First link map member should be the executable.  */
+  if ((lm = first_link_map_member ()) == 0)
+    return 0;	/* failed somehow... */
+
+  /* Read address of name from target memory to GDB.  */
+  read_memory (lm + lmo->l_name_offset, l_name_buf, lmo->l_name_size);
+
+  /* Convert the address to host format.  */
+  l_name = extract_address (l_name_buf, lmo->l_name_size);
+
+  /* Free l_name_buf.  */
+  do_cleanups (cleanups);
+
+  if (l_name == 0)
+    return 0;		/* No filename.  */
+
+  /* Now fetch the filename from target memory.  */
+  target_read_string (l_name, &filename, SO_NAME_MAX_PATH_SIZE - 1, &errcode);
+
+  if (errcode)
+    {
+      warning ("failed to read exec filename from attached file: %s",
+	       safe_strerror (errcode));
+      return 0;
+    }
+
+  make_cleanup (xfree, filename);
+  /* Have a pathname: read the symbol file.  */
+  symbol_file_command (filename, from_tty);
+
+  return 1;
+}
+#else
+
+static int
+open_symbol_file_object (int *from_ttyp)
+{
+  return 1;
+}
+
+#endif /* SVR4_SHARED_LIBS */
+
+
+/* LOCAL FUNCTION
+
+   current_sos -- build a list of currently loaded shared objects
+
+   SYNOPSIS
+
+   struct so_list *current_sos ()
+
+   DESCRIPTION
+
+   Build a list of `struct so_list' objects describing the shared
+   objects currently loaded in the inferior.  This list does not
+   include an entry for the main executable file.
+
+   Note that we only gather information directly available from the
+   inferior --- we don't examine any of the shared library files
+   themselves.  The declaration of `struct so_list' says which fields
+   we provide values for.  */
+
+static struct so_list *
+svr4_current_sos (void)
+{
+  CORE_ADDR lm;
+  struct so_list *head = 0;
+  struct so_list **link_ptr = &head;
+
+  /* Make sure we've looked up the inferior's dynamic linker's base
+     structure.  */
+  if (! debug_base)
+    {
+      debug_base = locate_base ();
+
+      /* If we can't find the dynamic linker's base structure, this
+	 must not be a dynamically linked executable.  Hmm.  */
+      if (! debug_base)
+	return 0;
+    }
+
+  /* Walk the inferior's link map list, and build our list of
+     `struct so_list' nodes.  */
+  lm = first_link_map_member ();  
+  while (lm)
+    {
+      struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
+      struct so_list *new
+	= (struct so_list *) xmalloc (sizeof (struct so_list));
+      struct cleanup *old_chain = make_cleanup (xfree, new);
+
+      memset (new, 0, sizeof (*new));
+
+      new->lm_info = xmalloc (sizeof (struct lm_info));
+      make_cleanup (xfree, new->lm_info);
+
+      new->lm_info->lm = xmalloc (lmo->link_map_size);
+      make_cleanup (xfree, new->lm_info->lm);
+      memset (new->lm_info->lm, 0, lmo->link_map_size);
+
+      read_memory (lm, new->lm_info->lm, lmo->link_map_size);
+
+      lm = LM_NEXT (new);
+
+      /* For SVR4 versions, the first entry in the link map is for the
+         inferior executable, so we must ignore it.  For some versions of
+         SVR4, it has no name.  For others (Solaris 2.3 for example), it
+         does have a name, so we can no longer use a missing name to
+         decide when to ignore it. */
+      if (IGNORE_FIRST_LINK_MAP_ENTRY (new))
+	free_so (new);
+      else
+	{
+	  int errcode;
+	  char *buffer;
+
+	  /* Extract this shared object's name.  */
+	  target_read_string (LM_NAME (new), &buffer,
+			      SO_NAME_MAX_PATH_SIZE - 1, &errcode);
+	  if (errcode != 0)
+	    {
+	      warning ("current_sos: Can't read pathname for load map: %s\n",
+		       safe_strerror (errcode));
+	    }
+	  else
+	    {
+	      strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
+	      new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+	      xfree (buffer);
+	      strcpy (new->so_original_name, new->so_name);
+	    }
+
+	  /* If this entry has no name, or its name matches the name
+	     for the main executable, don't include it in the list.  */
+	  if (! new->so_name[0]
+	      || match_main (new->so_name))
+	    free_so (new);
+	  else
+	    {
+	      new->next = 0;
+	      *link_ptr = new;
+	      link_ptr = &new->next;
+	    }
+	}
+
+      discard_cleanups (old_chain);
+    }
+
+  return head;
+}
+
+
+/* On some systems, the only way to recognize the link map entry for
+   the main executable file is by looking at its name.  Return
+   non-zero iff SONAME matches one of the known main executable names.  */
+
+static int
+match_main (char *soname)
+{
+  char **mainp;
+
+  for (mainp = main_name_list; *mainp != NULL; mainp++)
+    {
+      if (strcmp (soname, *mainp) == 0)
+	return (1);
+    }
+
+  return (0);
+}
+
+
+#ifdef SVR4_SHARED_LIBS
+
+/* Return 1 if PC lies in the dynamic symbol resolution code of the
+   SVR4 run time loader.  */
+
+static CORE_ADDR interp_text_sect_low;
+static CORE_ADDR interp_text_sect_high;
+static CORE_ADDR interp_plt_sect_low;
+static CORE_ADDR interp_plt_sect_high;
+
+int
+in_svr4_dynsym_resolve_code (CORE_ADDR pc)
+{
+  return ((pc >= interp_text_sect_low && pc < interp_text_sect_high)
+	  || (pc >= interp_plt_sect_low && pc < interp_plt_sect_high)
+	  || in_plt_section (pc, NULL));
+}
+#endif
+
+/*
+
+   LOCAL FUNCTION
+
+   disable_break -- remove the "mapping changed" breakpoint
+
+   SYNOPSIS
+
+   static int disable_break ()
+
+   DESCRIPTION
+
+   Removes the breakpoint that gets hit when the dynamic linker
+   completes a mapping change.
+
+ */
+
+#ifndef SVR4_SHARED_LIBS
+
+static int
+disable_break (void)
+{
+  int status = 1;
+
+  int in_debugger = 0;
+
+  /* Read the debugger structure from the inferior to retrieve the
+     address of the breakpoint and the original contents of the
+     breakpoint address.  Remove the breakpoint by writing the original
+     contents back. */
+
+  read_memory (debug_addr, (char *) &debug_copy, sizeof (debug_copy));
+
+  /* Set `in_debugger' to zero now. */
+
+  write_memory (flag_addr, (char *) &in_debugger, sizeof (in_debugger));
+
+  breakpoint_addr = SOLIB_EXTRACT_ADDRESS (debug_copy.ldd_bp_addr);
+  write_memory (breakpoint_addr, (char *) &debug_copy.ldd_bp_inst,
+		sizeof (debug_copy.ldd_bp_inst));
+
+  /* For the SVR4 version, we always know the breakpoint address.  For the
+     SunOS version we don't know it until the above code is executed.
+     Grumble if we are stopped anywhere besides the breakpoint address. */
+
+  if (stop_pc != breakpoint_addr)
+    {
+      warning ("stopped at unknown breakpoint while handling shared libraries");
+    }
+
+  return (status);
+}
+
+#endif /* #ifdef SVR4_SHARED_LIBS */
+
+/*
+
+   LOCAL FUNCTION
+
+   enable_break -- arrange for dynamic linker to hit breakpoint
+
+   SYNOPSIS
+
+   int enable_break (void)
+
+   DESCRIPTION
+
+   Both the SunOS and the SVR4 dynamic linkers have, as part of their
+   debugger interface, support for arranging for the inferior to hit
+   a breakpoint after mapping in the shared libraries.  This function
+   enables that breakpoint.
+
+   For SunOS, there is a special flag location (in_debugger) which we
+   set to 1.  When the dynamic linker sees this flag set, it will set
+   a breakpoint at a location known only to itself, after saving the
+   original contents of that place and the breakpoint address itself,
+   in it's own internal structures.  When we resume the inferior, it
+   will eventually take a SIGTRAP when it runs into the breakpoint.
+   We handle this (in a different place) by restoring the contents of
+   the breakpointed location (which is only known after it stops),
+   chasing around to locate the shared libraries that have been
+   loaded, then resuming.
+
+   For SVR4, the debugger interface structure contains a member (r_brk)
+   which is statically initialized at the time the shared library is
+   built, to the offset of a function (_r_debug_state) which is guaran-
+   teed to be called once before mapping in a library, and again when
+   the mapping is complete.  At the time we are examining this member,
+   it contains only the unrelocated offset of the function, so we have
+   to do our own relocation.  Later, when the dynamic linker actually
+   runs, it relocates r_brk to be the actual address of _r_debug_state().
+
+   The debugger interface structure also contains an enumeration which
+   is set to either RT_ADD or RT_DELETE prior to changing the mapping,
+   depending upon whether or not the library is being mapped or unmapped,
+   and then set to RT_CONSISTENT after the library is mapped/unmapped.
+ */
+
+static int
+enable_break (void)
+{
+  int success = 0;
+
+#ifndef SVR4_SHARED_LIBS
+
+  int j;
+  int in_debugger;
+
+  /* Get link_dynamic structure */
+
+  j = target_read_memory (debug_base, (char *) &dynamic_copy,
+			  sizeof (dynamic_copy));
+  if (j)
+    {
+      /* unreadable */
+      return (0);
+    }
+
+  /* Calc address of debugger interface structure */
+
+  debug_addr = SOLIB_EXTRACT_ADDRESS (dynamic_copy.ldd);
+
+  /* Calc address of `in_debugger' member of debugger interface structure */
+
+  flag_addr = debug_addr + (CORE_ADDR) ((char *) &debug_copy.ldd_in_debugger -
+					(char *) &debug_copy);
+
+  /* Write a value of 1 to this member.  */
+
+  in_debugger = 1;
+  write_memory (flag_addr, (char *) &in_debugger, sizeof (in_debugger));
+  success = 1;
+
+#else /* SVR4_SHARED_LIBS */
+
+#ifdef BKPT_AT_SYMBOL
+
+  struct minimal_symbol *msymbol;
+  char **bkpt_namep;
+  asection *interp_sect;
+
+  /* First, remove all the solib event breakpoints.  Their addresses
+     may have changed since the last time we ran the program.  */
+  remove_solib_event_breakpoints ();
+
+#ifdef SVR4_SHARED_LIBS
+  interp_text_sect_low = interp_text_sect_high = 0;
+  interp_plt_sect_low = interp_plt_sect_high = 0;
+
+  /* Find the .interp section; if not found, warn the user and drop
+     into the old breakpoint at symbol code.  */
+  interp_sect = bfd_get_section_by_name (exec_bfd, ".interp");
+  if (interp_sect)
+    {
+      unsigned int interp_sect_size;
+      char *buf;
+      CORE_ADDR load_addr;
+      bfd *tmp_bfd = NULL;
+      int tmp_fd = -1;
+      char *tmp_pathname = NULL;
+      CORE_ADDR sym_addr = 0;
+
+      /* Read the contents of the .interp section into a local buffer;
+         the contents specify the dynamic linker this program uses.  */
+      interp_sect_size = bfd_section_size (exec_bfd, interp_sect);
+      buf = alloca (interp_sect_size);
+      bfd_get_section_contents (exec_bfd, interp_sect,
+				buf, 0, interp_sect_size);
+
+      /* Now we need to figure out where the dynamic linker was
+         loaded so that we can load its symbols and place a breakpoint
+         in the dynamic linker itself.
+
+         This address is stored on the stack.  However, I've been unable
+         to find any magic formula to find it for Solaris (appears to
+         be trivial on GNU/Linux).  Therefore, we have to try an alternate
+         mechanism to find the dynamic linker's base address.  */
+
+      tmp_fd  = solib_open (buf, &tmp_pathname);
+      if (tmp_fd >= 0)
+	tmp_bfd = bfd_fdopenr (tmp_pathname, gnutarget, tmp_fd);
+
+      if (tmp_bfd == NULL)
+	goto bkpt_at_symbol;
+
+      /* Make sure the dynamic linker's really a useful object.  */
+      if (!bfd_check_format (tmp_bfd, bfd_object))
+	{
+	  warning ("Unable to grok dynamic linker %s as an object file", buf);
+	  bfd_close (tmp_bfd);
+	  goto bkpt_at_symbol;
+	}
+
+      /* We find the dynamic linker's base address by examining the
+         current pc (which point at the entry point for the dynamic
+         linker) and subtracting the offset of the entry point.  */
+      load_addr = read_pc () - tmp_bfd->start_address;
+
+      /* Record the relocated start and end address of the dynamic linker
+         text and plt section for in_svr4_dynsym_resolve_code.  */
+      interp_sect = bfd_get_section_by_name (tmp_bfd, ".text");
+      if (interp_sect)
+	{
+	  interp_text_sect_low =
+	    bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
+	  interp_text_sect_high =
+	    interp_text_sect_low + bfd_section_size (tmp_bfd, interp_sect);
+	}
+      interp_sect = bfd_get_section_by_name (tmp_bfd, ".plt");
+      if (interp_sect)
+	{
+	  interp_plt_sect_low =
+	    bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
+	  interp_plt_sect_high =
+	    interp_plt_sect_low + bfd_section_size (tmp_bfd, interp_sect);
+	}
+
+      /* Now try to set a breakpoint in the dynamic linker.  */
+      for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
+	{
+	  sym_addr = bfd_lookup_symbol (tmp_bfd, *bkpt_namep);
+	  if (sym_addr != 0)
+	    break;
+	}
+
+      /* We're done with the temporary bfd.  */
+      bfd_close (tmp_bfd);
+
+      if (sym_addr != 0)
+	{
+	  create_solib_event_breakpoint (load_addr + sym_addr);
+	  return 1;
+	}
+
+      /* For whatever reason we couldn't set a breakpoint in the dynamic
+         linker.  Warn and drop into the old code.  */
+    bkpt_at_symbol:
+      warning ("Unable to find dynamic linker breakpoint function.\nGDB will be unable to debug shared library initializers\nand track explicitly loaded dynamic code.");
+    }
+#endif
+
+  /* Scan through the list of symbols, trying to look up the symbol and
+     set a breakpoint there.  Terminate loop when we/if we succeed. */
+
+  breakpoint_addr = 0;
+  for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++)
+    {
+      msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile);
+      if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
+	{
+	  create_solib_event_breakpoint (SYMBOL_VALUE_ADDRESS (msymbol));
+	  return 1;
+	}
+    }
+
+  /* Nothing good happened.  */
+  success = 0;
+
+#endif /* BKPT_AT_SYMBOL */
+
+#endif /* !SVR4_SHARED_LIBS */
+
+  return (success);
+}
+
+/*
+
+   LOCAL FUNCTION
+
+   special_symbol_handling -- additional shared library symbol handling
+
+   SYNOPSIS
+
+   void special_symbol_handling ()
+
+   DESCRIPTION
+
+   Once the symbols from a shared object have been loaded in the usual
+   way, we are called to do any system specific symbol handling that 
+   is needed.
+
+   For SunOS4, this consists of grunging around in the dynamic
+   linkers structures to find symbol definitions for "common" symbols
+   and adding them to the minimal symbol table for the runtime common
+   objfile.
+
+ */
+
+static void
+svr4_special_symbol_handling (void)
+{
+#ifndef SVR4_SHARED_LIBS
+  int j;
+
+  if (debug_addr == 0)
+    {
+      /* Get link_dynamic structure */
+
+      j = target_read_memory (debug_base, (char *) &dynamic_copy,
+			      sizeof (dynamic_copy));
+      if (j)
+	{
+	  /* unreadable */
+	  return;
+	}
+
+      /* Calc address of debugger interface structure */
+      /* FIXME, this needs work for cross-debugging of core files
+         (byteorder, size, alignment, etc).  */
+
+      debug_addr = SOLIB_EXTRACT_ADDRESS (dynamic_copy.ldd);
+    }
+
+  /* Read the debugger structure from the inferior, just to make sure
+     we have a current copy. */
+
+  j = target_read_memory (debug_addr, (char *) &debug_copy,
+			  sizeof (debug_copy));
+  if (j)
+    return;			/* unreadable */
+
+  /* Get common symbol definitions for the loaded object. */
+
+  if (debug_copy.ldd_cp)
+    {
+      solib_add_common_symbols (SOLIB_EXTRACT_ADDRESS (debug_copy.ldd_cp));
+    }
+
+#endif /* !SVR4_SHARED_LIBS */
+}
+
+/* Relocate the main executable.  This function should be called upon
+   stopping the inferior process at the entry point to the program. 
+   The entry point from BFD is compared to the PC and if they are
+   different, the main executable is relocated by the proper amount. 
+   
+   As written it will only attempt to relocate executables which
+   lack interpreter sections.  It seems likely that only dynamic
+   linker executables will get relocated, though it should work
+   properly for a position-independent static executable as well.  */
+
+static void
+svr4_relocate_main_executable (void)
+{
+  asection *interp_sect;
+  CORE_ADDR pc = read_pc ();
+
+  /* Decide if the objfile needs to be relocated.  As indicated above,
+     we will only be here when execution is stopped at the beginning
+     of the program.  Relocation is necessary if the address at which
+     we are presently stopped differs from the start address stored in
+     the executable AND there's no interpreter section.  The condition
+     regarding the interpreter section is very important because if
+     there *is* an interpreter section, execution will begin there
+     instead.  When there is an interpreter section, the start address
+     is (presumably) used by the interpreter at some point to start
+     execution of the program.
+
+     If there is an interpreter, it is normal for it to be set to an
+     arbitrary address at the outset.  The job of finding it is
+     handled in enable_break().
+
+     So, to summarize, relocations are necessary when there is no
+     interpreter section and the start address obtained from the
+     executable is different from the address at which GDB is
+     currently stopped.
+     
+     [ The astute reader will note that we also test to make sure that
+       the executable in question has the DYNAMIC flag set.  It is my
+       opinion that this test is unnecessary (undesirable even).  It
+       was added to avoid inadvertent relocation of an executable
+       whose e_type member in the ELF header is not ET_DYN.  There may
+       be a time in the future when it is desirable to do relocations
+       on other types of files as well in which case this condition
+       should either be removed or modified to accomodate the new file
+       type.  (E.g, an ET_EXEC executable which has been built to be
+       position-independent could safely be relocated by the OS if
+       desired.  It is true that this violates the ABI, but the ABI
+       has been known to be bent from time to time.)  - Kevin, Nov 2000. ]
+     */
+
+  interp_sect = bfd_get_section_by_name (exec_bfd, ".interp");
+  if (interp_sect == NULL 
+      && (bfd_get_file_flags (exec_bfd) & DYNAMIC) != 0
+      && bfd_get_start_address (exec_bfd) != pc)
+    {
+      struct cleanup *old_chain;
+      struct section_offsets *new_offsets;
+      int i, changed;
+      CORE_ADDR displacement;
+      
+      /* It is necessary to relocate the objfile.  The amount to
+	 relocate by is simply the address at which we are stopped
+	 minus the starting address from the executable.
+
+	 We relocate all of the sections by the same amount.  This
+	 behavior is mandated by recent editions of the System V ABI. 
+	 According to the System V Application Binary Interface,
+	 Edition 4.1, page 5-5:
+
+	   ...  Though the system chooses virtual addresses for
+	   individual processes, it maintains the segments' relative
+	   positions.  Because position-independent code uses relative
+	   addressesing between segments, the difference between
+	   virtual addresses in memory must match the difference
+	   between virtual addresses in the file.  The difference
+	   between the virtual address of any segment in memory and
+	   the corresponding virtual address in the file is thus a
+	   single constant value for any one executable or shared
+	   object in a given process.  This difference is the base
+	   address.  One use of the base address is to relocate the
+	   memory image of the program during dynamic linking.
+
+	 The same language also appears in Edition 4.0 of the System V
+	 ABI and is left unspecified in some of the earlier editions.  */
+
+      displacement = pc - bfd_get_start_address (exec_bfd);
+      changed = 0;
+
+      new_offsets = xcalloc (sizeof (struct section_offsets),
+			     symfile_objfile->num_sections);
+      old_chain = make_cleanup (xfree, new_offsets);
+
+      for (i = 0; i < symfile_objfile->num_sections; i++)
+	{
+	  if (displacement != ANOFFSET (symfile_objfile->section_offsets, i))
+	    changed = 1;
+	  new_offsets->offsets[i] = displacement;
+	}
+
+      if (changed)
+	objfile_relocate (symfile_objfile, new_offsets);
+
+      do_cleanups (old_chain);
+    }
+}
+
+/*
+
+   GLOBAL FUNCTION
+
+   svr4_solib_create_inferior_hook -- shared library startup support
+
+   SYNOPSIS
+
+   void svr4_solib_create_inferior_hook()
+
+   DESCRIPTION
+
+   When gdb starts up the inferior, it nurses it along (through the
+   shell) until it is ready to execute it's first instruction.  At this
+   point, this function gets called via expansion of the macro
+   SOLIB_CREATE_INFERIOR_HOOK.
+
+   For SunOS executables, this first instruction is typically the
+   one at "_start", or a similar text label, regardless of whether
+   the executable is statically or dynamically linked.  The runtime
+   startup code takes care of dynamically linking in any shared
+   libraries, once gdb allows the inferior to continue.
+
+   For SVR4 executables, this first instruction is either the first
+   instruction in the dynamic linker (for dynamically linked
+   executables) or the instruction at "start" for statically linked
+   executables.  For dynamically linked executables, the system
+   first exec's /lib/libc.so.N, which contains the dynamic linker,
+   and starts it running.  The dynamic linker maps in any needed
+   shared libraries, maps in the actual user executable, and then
+   jumps to "start" in the user executable.
+
+   For both SunOS shared libraries, and SVR4 shared libraries, we
+   can arrange to cooperate with the dynamic linker to discover the
+   names of shared libraries that are dynamically linked, and the
+   base addresses to which they are linked.
+
+   This function is responsible for discovering those names and
+   addresses, and saving sufficient information about them to allow
+   their symbols to be read at a later time.
+
+   FIXME
+
+   Between enable_break() and disable_break(), this code does not
+   properly handle hitting breakpoints which the user might have
+   set in the startup code or in the dynamic linker itself.  Proper
+   handling will probably have to wait until the implementation is
+   changed to use the "breakpoint handler function" method.
+
+   Also, what if child has exit()ed?  Must exit loop somehow.
+ */
+
+static void
+svr4_solib_create_inferior_hook (void)
+{
+  /* Relocate the main executable if necessary.  */
+  svr4_relocate_main_executable ();
+
+  /* If we are using the BKPT_AT_SYMBOL code, then we don't need the base
+     yet.  In fact, in the case of a SunOS4 executable being run on
+     Solaris, we can't get it yet.  current_sos will get it when it needs
+     it.  */
+#if !(defined (SVR4_SHARED_LIBS) && defined (BKPT_AT_SYMBOL))
+  if ((debug_base = locate_base ()) == 0)
+    {
+      /* Can't find the symbol or the executable is statically linked. */
+      return;
+    }
+#endif
+
+  if (!enable_break ())
+    {
+      warning ("shared library handler failed to enable breakpoint");
+      return;
+    }
+
+#if !defined(SVR4_SHARED_LIBS) || defined(_SCO_DS)
+  /* SCO and SunOS need the loop below, other systems should be using the
+     special shared library breakpoints and the shared library breakpoint
+     service routine.
+
+     Now run the target.  It will eventually hit the breakpoint, at
+     which point all of the libraries will have been mapped in and we
+     can go groveling around in the dynamic linker structures to find
+     out what we need to know about them. */
+
+  clear_proceed_status ();
+  stop_soon_quietly = 1;
+  stop_signal = TARGET_SIGNAL_0;
+  do
+    {
+      target_resume (-1, 0, stop_signal);
+      wait_for_inferior ();
+    }
+  while (stop_signal != TARGET_SIGNAL_TRAP);
+  stop_soon_quietly = 0;
+
+#if !defined(_SCO_DS)
+  /* We are now either at the "mapping complete" breakpoint (or somewhere
+     else, a condition we aren't prepared to deal with anyway), so adjust
+     the PC as necessary after a breakpoint, disable the breakpoint, and
+     add any shared libraries that were mapped in. */
+
+  if (DECR_PC_AFTER_BREAK)
+    {
+      stop_pc -= DECR_PC_AFTER_BREAK;
+      write_register (PC_REGNUM, stop_pc);
+    }
+
+  if (!disable_break ())
+    {
+      warning ("shared library handler failed to disable breakpoint");
+    }
+
+  if (auto_solib_add)
+    solib_add ((char *) 0, 0, (struct target_ops *) 0);
+#endif /* ! _SCO_DS */
+#endif
+}
+
+static void
+svr4_clear_solib (void)
+{
+  debug_base = 0;
+}
+
+static void
+svr4_free_so (struct so_list *so)
+{
+  xfree (so->lm_info->lm);
+  xfree (so->lm_info);
+}
+
+static void
+svr4_relocate_section_addresses (struct so_list *so,
+                                 struct section_table *sec)
+{
+  sec->addr += LM_ADDR (so);
+  sec->endaddr += LM_ADDR (so);
+}
+
+static struct target_so_ops svr4_so_ops;
+
+void
+_initialize_svr4_solib (void)
+{
+  svr4_so_ops.relocate_section_addresses = svr4_relocate_section_addresses;
+  svr4_so_ops.free_so = svr4_free_so;
+  svr4_so_ops.clear_solib = svr4_clear_solib;
+  svr4_so_ops.solib_create_inferior_hook = svr4_solib_create_inferior_hook;
+  svr4_so_ops.special_symbol_handling = svr4_special_symbol_handling;
+  svr4_so_ops.current_sos = svr4_current_sos;
+  svr4_so_ops.open_symbol_file_object = open_symbol_file_object;
+
+  /* FIXME: Don't do this here.  *_gdbarch_init() should set so_ops. */
+  current_target_so_ops = &svr4_so_ops;
+}
+
diff --git a/gdb/solib-svr4.h b/gdb/solib-svr4.h
new file mode 100644
index 0000000..d0ce954
--- /dev/null
+++ b/gdb/solib-svr4.h
@@ -0,0 +1,70 @@
+/* Handle shared libraries for GDB, the GNU Debugger.
+   Copyright 2000
+   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.  */
+
+/* Critical offsets and sizes which describe struct r_debug and
+   struct link_map on SVR4-like targets.  All offsets and sizes are
+   in bytes unless otherwise specified.  */
+
+struct link_map_offsets
+  {
+    /* Size of struct r_debug (or equivalent), or at least enough of it to
+       be able to obtain the r_map field.  */
+    int r_debug_size;
+
+    /* Offset to the r_map field in struct r_debug.  */
+    int r_map_offset;
+
+    /* Size of the r_map field in struct r_debug.  */
+    int r_map_size;
+
+    /* Size of struct link_map (or equivalent), or at least enough of it
+       to be able to obtain the fields below.  */
+    int link_map_size;
+
+    /* Offset to l_addr field in struct link_map.  */
+    int l_addr_offset;
+
+    /* Size of l_addr field in struct link_map.  */
+    int l_addr_size;
+
+    /* Offset to l_next field in struct link_map.  */
+    int l_next_offset;
+
+    /* Size of l_next field in struct link_map.  */
+    int l_next_size;
+
+    /* Offset to l_prev field in struct link_map.  */
+    int l_prev_offset;
+
+    /* Size of l_prev field in struct link_map.  */
+    int l_prev_size;
+
+    /* Offset to l_name field in struct link_map.  */
+    int l_name_offset;
+
+    /* Size of l_name field in struct link_map.  */
+    int l_name_size;
+  };
+
+#ifndef SVR4_FETCH_LINK_MAP_OFFSETS
+extern struct link_map_offsets *default_svr4_fetch_link_map_offsets (void);
+#define SVR4_FETCH_LINK_MAP_OFFSETS() default_svr4_fetch_link_map_offsets ()
+#endif
diff --git a/gdb/solib.c b/gdb/solib.c
index 080962e..5f9743f 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1,5 +1,5 @@
-/* Handle SunOS and SVR4 shared libraries for GDB, the GNU Debugger.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 1999
+/* Handle shared libraries for GDB, the GNU Debugger.
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 1999, 2000
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -19,28 +19,11 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-
 #include "defs.h"
 
-/* This file is only compilable if link.h is available. */
-
-#ifdef HAVE_LINK_H
-
 #include <sys/types.h>
-#include <signal.h>
-#include "gdb_string.h"
-#include <sys/param.h>
 #include <fcntl.h>
-
-#ifndef SVR4_SHARED_LIBS
- /* SunOS shared libs need the nlist structure.  */
-#include <a.out.h>
-#else
-#include "elf/external.h"
-#endif
-
-#include <link.h>
-
+#include "gdb_string.h"
 #include "symtab.h"
 #include "bfd.h"
 #include "symfile.h"
@@ -55,179 +38,23 @@
 #include "language.h"
 #include "gdbcmd.h"
 
-#define MAX_PATH_SIZE 512	/* FIXME: Should be dynamic */
+#include "solist.h"
 
-/* On SVR4 systems, a list of symbols in the dynamic linker where
-   GDB can try to place a breakpoint to monitor shared library
-   events.
+/* external data declarations */
 
-   If none of these symbols are found, or other errors occur, then
-   SVR4 systems will fall back to using a symbol as the "startup
-   mapping complete" breakpoint address.  */
-
-#ifdef SVR4_SHARED_LIBS
-static char *solib_break_names[] =
-{
-  "r_debug_state",
-  "_r_debug_state",
-  "_dl_debug_state",
-  "rtld_db_dlactivity",
-  NULL
-};
-#endif
-
-#define BKPT_AT_SYMBOL 1
-
-#if defined (BKPT_AT_SYMBOL) && defined (SVR4_SHARED_LIBS)
-static char *bkpt_names[] =
-{
-#ifdef SOLIB_BKPT_NAME
-  SOLIB_BKPT_NAME,		/* Prefer configured name if it exists. */
-#endif
-  "_start",
-  "main",
-  NULL
-};
-#endif
-
-/* Symbols which are used to locate the base of the link map structures. */
-
-#ifndef SVR4_SHARED_LIBS
-static char *debug_base_symbols[] =
-{
-  "_DYNAMIC",
-  "_DYNAMIC__MGC",
-  NULL
-};
-#endif
-
-static char *main_name_list[] =
-{
-  "main_$main",
-  NULL
-};
+/* FIXME: gdbarch needs to control this variable */
+struct target_so_ops *current_target_so_ops;
 
 /* local data declarations */
 
-/* Macro to extract an address from a solib structure.
-   When GDB is configured for some 32-bit targets (e.g. Solaris 2.7
-   sparc), BFD is configured to handle 64-bit targets, so CORE_ADDR is
-   64 bits.  We have to extract only the significant bits of addresses
-   to get the right address when accessing the core file BFD.  */
-
-#define SOLIB_EXTRACT_ADDRESS(member) \
-  extract_address (&member, sizeof (member))
-
-#ifndef SVR4_SHARED_LIBS
-
-#define LM_ADDR(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.lm_addr))
-#define LM_NEXT(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.lm_next))
-#define LM_NAME(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.lm_name))
-/* Test for first link map entry; first entry is a shared library. */
-#define IGNORE_FIRST_LINK_MAP_ENTRY(so) (0)
-static struct link_dynamic dynamic_copy;
-static struct link_dynamic_2 ld_2_copy;
-static struct ld_debug debug_copy;
-static CORE_ADDR debug_addr;
-static CORE_ADDR flag_addr;
-
-#else /* SVR4_SHARED_LIBS */
-
-#define LM_ADDR(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.l_addr))
-#define LM_NEXT(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.l_next))
-#define LM_NAME(so) (SOLIB_EXTRACT_ADDRESS ((so) -> lm.l_name))
-/* Test for first link map entry; first entry is the exec-file. */
-#define IGNORE_FIRST_LINK_MAP_ENTRY(so) \
-  (SOLIB_EXTRACT_ADDRESS ((so) -> lm.l_prev) == 0)
-static struct r_debug debug_copy;
-char shadow_contents[BREAKPOINT_MAX];	/* Stash old bkpt addr contents */
-
-#endif /* !SVR4_SHARED_LIBS */
-
-struct so_list
-  {
-    /* The following fields of the structure come directly from the
-       dynamic linker's tables in the inferior, and are initialized by
-       current_sos.  */
-
-    struct so_list *next;	/* next structure in linked list */
-    struct link_map lm;		/* copy of link map from inferior */
-    CORE_ADDR lmaddr;		/* addr in inferior lm was read from */
-
-    /* Shared object file name, exactly as it appears in the
-       inferior's link map.  This may be a relative path, or something
-       which needs to be looked up in LD_LIBRARY_PATH, etc.  We use it
-       to tell which entries in the inferior's dynamic linker's link
-       map we've already loaded.  */
-    char so_original_name[MAX_PATH_SIZE];
-
-    /* shared object file name, expanded to something GDB can open */
-    char so_name[MAX_PATH_SIZE];
-
-    /* The following fields of the structure are built from
-       information gathered from the shared object file itself, and
-       are initialized when we actually add it to our symbol tables.  */
-
-    bfd *abfd;
-    CORE_ADDR lmend;		/* upper addr bound of mapped object */
-    char symbols_loaded;	/* flag: symbols read in yet? */
-    char from_tty;		/* flag: print msgs? */
-    struct objfile *objfile;	/* objfile for loaded lib */
-    struct section_table *sections;
-    struct section_table *sections_end;
-    struct section_table *textsection;
-  };
-
 static struct so_list *so_list_head;	/* List of known shared objects */
-static CORE_ADDR debug_base;	/* Base of dynamic linker structures */
-static CORE_ADDR breakpoint_addr;	/* Address where end bkpt is set */
 
 static int solib_cleanup_queued = 0;	/* make_run_cleanup called */
 
-extern int fdmatch (int, int);	/* In libiberty */
-
 /* Local function prototypes */
 
 static void do_clear_solib (PTR);
 
-static int match_main (char *);
-
-static void special_symbol_handling (void);
-
-static void sharedlibrary_command (char *, int);
-
-static int enable_break (void);
-
-static void info_sharedlibrary_command (char *, int);
-
-static int symbol_add_stub (PTR);
-
-static CORE_ADDR first_link_map_member (void);
-
-static CORE_ADDR locate_base (void);
-
-static int solib_map_sections (PTR);
-
-#ifdef SVR4_SHARED_LIBS
-
-static CORE_ADDR elf_locate_base (void);
-
-#else
-
-static struct so_list *current_sos (void);
-static void free_so (struct so_list *node);
-
-static int disable_break (void);
-
-static void allocate_rt_common_objfile (void);
-
-static void
-solib_add_common_symbols (CORE_ADDR);
-
-#endif
-
-void _initialize_solib (void);
-
 /* If non-zero, this is a prefix that will be added to the front of the name
    shared libraries with an absolute filename for loading.  */
 static char *solib_absolute_prefix = NULL;
@@ -239,6 +66,90 @@
 
 /*
 
+   GLOBAL FUNCTION
+
+   solib_open -- Find a shared library file and open it.
+
+   SYNOPSIS
+
+   int solib_open (char *in_patname, char **found_pathname);
+
+   DESCRIPTION
+
+   Global variable SOLIB_ABSOLUTE_PREFIX is used as a prefix directory
+   to search for shared libraries if they have an absolute path.
+
+   Global variable SOLIB_SEARCH_PATH is used as a prefix directory
+   (or set of directories, as in LD_LIBRARY_PATH) to search for all
+   shared libraries if not found in SOLIB_ABSOLUTE_PREFIX.
+
+   Search order:
+   * If path is absolute, look in SOLIB_ABSOLUTE_PREFIX.
+   * If path is absolute or relative, look for it literally (unmodified).
+   * Look in SOLIB_SEARCH_PATH.
+   * Look in inferior's $PATH.
+   * Look in inferior's $LD_LIBRARY_PATH.
+
+   RETURNS
+
+   file handle for opened solib, or -1 for failure.  */
+
+int
+solib_open (char *in_pathname, char **found_pathname)
+{
+  int found_file = -1;
+  char *temp_pathname = NULL;
+
+  if (strchr (in_pathname, SLASH_CHAR))
+    {
+      if (! ROOTED_P (in_pathname) || solib_absolute_prefix == NULL)
+        temp_pathname = in_pathname;
+      else
+	{
+	  int prefix_len = strlen (solib_absolute_prefix);
+
+	  /* Remove trailing slashes from absolute prefix.  */
+	  while (prefix_len > 0
+		 && SLASH_P (solib_absolute_prefix[prefix_len - 1]))
+	    prefix_len--;
+
+	  /* Cat the prefixed pathname together.  */
+	  temp_pathname = alloca (prefix_len + strlen (in_pathname) + 1);
+	  strncpy (temp_pathname, solib_absolute_prefix, prefix_len);
+	  temp_pathname[prefix_len] = '\0';
+	  strcat (temp_pathname, in_pathname);
+	}
+
+      /* Now see if we can open it.  */
+      found_file = open (temp_pathname, O_RDONLY, 0);
+    }
+
+  /* If not found, next search the solib_search_path (if any).  */
+  if (found_file < 0 && solib_search_path != NULL)
+    found_file = openp (solib_search_path,
+			1, in_pathname, O_RDONLY, 0, &temp_pathname);
+
+  /* If not found, next search the inferior's $PATH environment variable. */
+  if (found_file < 0 && solib_search_path != NULL)
+    found_file = openp (get_in_environ (inferior_environ, "PATH"),
+			1, in_pathname, O_RDONLY, 0, &temp_pathname);
+
+  /* If not found, next search the inferior's $LD_LIBRARY_PATH 
+     environment variable. */
+  if (found_file < 0 && solib_search_path != NULL)
+    found_file = openp (get_in_environ (inferior_environ, "LD_LIBRARY_PATH"),
+			1, in_pathname, O_RDONLY, 0, &temp_pathname);
+
+  /* Done.  If not found, tough luck.  Return found_file and 
+     (optionally) found_pathname.  */
+  if (found_pathname != NULL && temp_pathname != NULL)
+    *found_pathname = strsave (temp_pathname);
+  return found_file;
+}
+
+
+/*
+
    LOCAL FUNCTION
 
    solib_map_sections -- open bfd and build sections for shared lib
@@ -265,8 +176,7 @@
  */
 
 static int
-solib_map_sections (arg)
-     PTR arg;
+solib_map_sections (PTR arg)
 {
   struct so_list *so = (struct so_list *) arg;	/* catch_errors bogon */
   char *filename;
@@ -278,49 +188,15 @@
 
   filename = tilde_expand (so->so_name);
 
-  if (solib_absolute_prefix && ROOTED_P (filename))
-    /* Prefix shared libraries with absolute filenames with
-       SOLIB_ABSOLUTE_PREFIX.  */
-    {
-      char *pfxed_fn;
-      int pfx_len;
+  old_chain = make_cleanup (xfree, filename);
+  scratch_chan = solib_open (filename, &scratch_pathname);
 
-      pfx_len = strlen (solib_absolute_prefix);
-
-      /* Remove trailing slashes.  */
-      while (pfx_len > 0 && SLASH_P (solib_absolute_prefix[pfx_len - 1]))
-	pfx_len--;
-
-      pfxed_fn = xmalloc (pfx_len + strlen (filename) + 1);
-      strcpy (pfxed_fn, solib_absolute_prefix);
-      strcat (pfxed_fn, filename);
-      free (filename);
-
-      filename = pfxed_fn;
-    }
-
-  old_chain = make_cleanup (free, filename);
-
-  scratch_chan = -1;
-
-  if (solib_search_path)
-    scratch_chan = openp (solib_search_path,
-			  1, filename, O_RDONLY, 0, &scratch_pathname);
-  if (scratch_chan < 0)
-    scratch_chan = openp (get_in_environ (inferior_environ, "PATH"),
-			  1, filename, O_RDONLY, 0, &scratch_pathname);
-  if (scratch_chan < 0)
-    {
-      scratch_chan = openp (get_in_environ
-			    (inferior_environ, "LD_LIBRARY_PATH"),
-			    1, filename, O_RDONLY, 0, &scratch_pathname);
-    }
   if (scratch_chan < 0)
     {
       perror_with_name (filename);
     }
-  /* Leave scratch_pathname allocated.  abfd->name will point to it.  */
 
+  /* Leave scratch_pathname allocated.  abfd->name will point to it.  */
   abfd = bfd_fdopenr (scratch_pathname, gnutarget, scratch_chan);
   if (!abfd)
     {
@@ -328,14 +204,15 @@
       error ("Could not open `%s' as an executable file: %s",
 	     scratch_pathname, bfd_errmsg (bfd_get_error ()));
     }
+
   /* Leave bfd open, core_xfer_memory and "info files" need it.  */
   so->abfd = abfd;
   abfd->cacheable = true;
 
-  /* copy full path name into so_name, so that later symbol_file_add can find
-     it */
-  if (strlen (scratch_pathname) >= MAX_PATH_SIZE)
-    error ("Full path name length of shared library exceeds MAX_PATH_SIZE in so_list structure.");
+  /* copy full path name into so_name, so that later symbol_file_add
+     can find it */
+  if (strlen (scratch_pathname) >= SO_NAME_MAX_PATH_SIZE)
+    error ("Full path name length of shared library exceeds SO_NAME_MAX_PATH_SIZE in so_list structure.");
   strcpy (so->so_name, scratch_pathname);
 
   if (!bfd_check_format (abfd, bfd_object))
@@ -354,9 +231,7 @@
       /* Relocate the section binding addresses as recorded in the shared
          object's file by the base address to which the object was actually
          mapped. */
-      p->addr += LM_ADDR (so);
-      p->endaddr += LM_ADDR (so);
-      so->lmend = max (p->endaddr, so->lmend);
+      TARGET_SO_RELOCATE_SECTION_ADDRESSES (so, p);
       if (STREQ (p->the_bfd_section->name, ".text"))
 	{
 	  so->textsection = p;
@@ -369,616 +244,6 @@
   return (1);
 }
 
-#ifndef SVR4_SHARED_LIBS
-
-/* Allocate the runtime common object file.  */
-
-static void
-allocate_rt_common_objfile ()
-{
-  struct objfile *objfile;
-  struct objfile *last_one;
-
-  objfile = (struct objfile *) xmalloc (sizeof (struct objfile));
-  memset (objfile, 0, sizeof (struct objfile));
-  objfile->md = NULL;
-  obstack_specify_allocation (&objfile->psymbol_cache.cache, 0, 0,
-			      xmalloc, free);
-  obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0, xmalloc,
-			      free);
-  obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc,
-			      free);
-  obstack_specify_allocation (&objfile->type_obstack, 0, 0, xmalloc,
-			      free);
-  objfile->name = mstrsave (objfile->md, "rt_common");
-
-  /* Add this file onto the tail of the linked list of other such files. */
-
-  objfile->next = NULL;
-  if (object_files == NULL)
-    object_files = objfile;
-  else
-    {
-      for (last_one = object_files;
-	   last_one->next;
-	   last_one = last_one->next);
-      last_one->next = objfile;
-    }
-
-  rt_common_objfile = objfile;
-}
-
-/* Read all dynamically loaded common symbol definitions from the inferior
-   and put them into the minimal symbol table for the runtime common
-   objfile.  */
-
-static void
-solib_add_common_symbols (rtc_symp)
-     CORE_ADDR rtc_symp;
-{
-  struct rtc_symb inferior_rtc_symb;
-  struct nlist inferior_rtc_nlist;
-  int len;
-  char *name;
-
-  /* Remove any runtime common symbols from previous runs.  */
-
-  if (rt_common_objfile != NULL && rt_common_objfile->minimal_symbol_count)
-    {
-      obstack_free (&rt_common_objfile->symbol_obstack, 0);
-      obstack_specify_allocation (&rt_common_objfile->symbol_obstack, 0, 0,
-				  xmalloc, free);
-      rt_common_objfile->minimal_symbol_count = 0;
-      rt_common_objfile->msymbols = NULL;
-    }
-
-  init_minimal_symbol_collection ();
-  make_cleanup_discard_minimal_symbols ();
-
-  while (rtc_symp)
-    {
-      read_memory (rtc_symp,
-		   (char *) &inferior_rtc_symb,
-		   sizeof (inferior_rtc_symb));
-      read_memory (SOLIB_EXTRACT_ADDRESS (inferior_rtc_symb.rtc_sp),
-		   (char *) &inferior_rtc_nlist,
-		   sizeof (inferior_rtc_nlist));
-      if (inferior_rtc_nlist.n_type == N_COMM)
-	{
-	  /* FIXME: The length of the symbol name is not available, but in the
-	     current implementation the common symbol is allocated immediately
-	     behind the name of the symbol. */
-	  len = inferior_rtc_nlist.n_value - inferior_rtc_nlist.n_un.n_strx;
-
-	  name = xmalloc (len);
-	  read_memory (SOLIB_EXTRACT_ADDRESS (inferior_rtc_nlist.n_un.n_name),
-		       name, len);
-
-	  /* Allocate the runtime common objfile if necessary. */
-	  if (rt_common_objfile == NULL)
-	    allocate_rt_common_objfile ();
-
-	  prim_record_minimal_symbol (name, inferior_rtc_nlist.n_value,
-				      mst_bss, rt_common_objfile);
-	  free (name);
-	}
-      rtc_symp = SOLIB_EXTRACT_ADDRESS (inferior_rtc_symb.rtc_next);
-    }
-
-  /* Install any minimal symbols that have been collected as the current
-     minimal symbols for the runtime common objfile.  */
-
-  install_minimal_symbols (rt_common_objfile);
-}
-
-#endif /* SVR4_SHARED_LIBS */
-
-
-#ifdef SVR4_SHARED_LIBS
-
-static CORE_ADDR bfd_lookup_symbol (bfd *, char *);
-
-/*
-
-   LOCAL FUNCTION
-
-   bfd_lookup_symbol -- lookup the value for a specific symbol
-
-   SYNOPSIS
-
-   CORE_ADDR bfd_lookup_symbol (bfd *abfd, char *symname)
-
-   DESCRIPTION
-
-   An expensive way to lookup the value of a single symbol for
-   bfd's that are only temporary anyway.  This is used by the
-   shared library support to find the address of the debugger
-   interface structures in the shared library.
-
-   Note that 0 is specifically allowed as an error return (no
-   such symbol).
- */
-
-static CORE_ADDR
-bfd_lookup_symbol (abfd, symname)
-     bfd *abfd;
-     char *symname;
-{
-  unsigned int storage_needed;
-  asymbol *sym;
-  asymbol **symbol_table;
-  unsigned int number_of_symbols;
-  unsigned int i;
-  struct cleanup *back_to;
-  CORE_ADDR symaddr = 0;
-
-  storage_needed = bfd_get_symtab_upper_bound (abfd);
-
-  if (storage_needed > 0)
-    {
-      symbol_table = (asymbol **) xmalloc (storage_needed);
-      back_to = make_cleanup (free, (PTR) symbol_table);
-      number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
-
-      for (i = 0; i < number_of_symbols; i++)
-	{
-	  sym = *symbol_table++;
-	  if (STREQ (sym->name, symname))
-	    {
-	      /* Bfd symbols are section relative. */
-	      symaddr = sym->value + sym->section->vma;
-	      break;
-	    }
-	}
-      do_cleanups (back_to);
-    }
-  return (symaddr);
-}
-
-#ifdef HANDLE_SVR4_EXEC_EMULATORS
-
-/*
-   Solaris BCP (the part of Solaris which allows it to run SunOS4
-   a.out files) throws in another wrinkle. Solaris does not fill
-   in the usual a.out link map structures when running BCP programs,
-   the only way to get at them is via groping around in the dynamic
-   linker.
-   The dynamic linker and it's structures are located in the shared
-   C library, which gets run as the executable's "interpreter" by
-   the kernel.
-
-   Note that we can assume nothing about the process state at the time
-   we need to find these structures.  We may be stopped on the first
-   instruction of the interpreter (C shared library), the first
-   instruction of the executable itself, or somewhere else entirely
-   (if we attached to the process for example).
- */
-
-static char *debug_base_symbols[] =
-{
-  "r_debug",			/* Solaris 2.3 */
-  "_r_debug",			/* Solaris 2.1, 2.2 */
-  NULL
-};
-
-static int look_for_base (int, CORE_ADDR);
-
-/*
-
-   LOCAL FUNCTION
-
-   look_for_base -- examine file for each mapped address segment
-
-   SYNOPSYS
-
-   static int look_for_base (int fd, CORE_ADDR baseaddr)
-
-   DESCRIPTION
-
-   This function is passed to proc_iterate_over_mappings, which
-   causes it to get called once for each mapped address space, with
-   an open file descriptor for the file mapped to that space, and the
-   base address of that mapped space.
-
-   Our job is to find the debug base symbol in the file that this
-   fd is open on, if it exists, and if so, initialize the dynamic
-   linker structure base address debug_base.
-
-   Note that this is a computationally expensive proposition, since
-   we basically have to open a bfd on every call, so we specifically
-   avoid opening the exec file.
- */
-
-static int
-look_for_base (fd, baseaddr)
-     int fd;
-     CORE_ADDR baseaddr;
-{
-  bfd *interp_bfd;
-  CORE_ADDR address = 0;
-  char **symbolp;
-
-  /* If the fd is -1, then there is no file that corresponds to this
-     mapped memory segment, so skip it.  Also, if the fd corresponds
-     to the exec file, skip it as well. */
-
-  if (fd == -1
-      || (exec_bfd != NULL
-	  && fdmatch (fileno ((FILE *) (exec_bfd->iostream)), fd)))
-    {
-      return (0);
-    }
-
-  /* Try to open whatever random file this fd corresponds to.  Note that
-     we have no way currently to find the filename.  Don't gripe about
-     any problems we might have, just fail. */
-
-  if ((interp_bfd = bfd_fdopenr ("unnamed", gnutarget, fd)) == NULL)
-    {
-      return (0);
-    }
-  if (!bfd_check_format (interp_bfd, bfd_object))
-    {
-      /* FIXME-leak: on failure, might not free all memory associated with
-         interp_bfd.  */
-      bfd_close (interp_bfd);
-      return (0);
-    }
-
-  /* Now try to find our debug base symbol in this file, which we at
-     least know to be a valid ELF executable or shared library. */
-
-  for (symbolp = debug_base_symbols; *symbolp != NULL; symbolp++)
-    {
-      address = bfd_lookup_symbol (interp_bfd, *symbolp);
-      if (address != 0)
-	{
-	  break;
-	}
-    }
-  if (address == 0)
-    {
-      /* FIXME-leak: on failure, might not free all memory associated with
-         interp_bfd.  */
-      bfd_close (interp_bfd);
-      return (0);
-    }
-
-  /* Eureka!  We found the symbol.  But now we may need to relocate it
-     by the base address.  If the symbol's value is less than the base
-     address of the shared library, then it hasn't yet been relocated
-     by the dynamic linker, and we have to do it ourself.  FIXME: Note
-     that we make the assumption that the first segment that corresponds
-     to the shared library has the base address to which the library
-     was relocated. */
-
-  if (address < baseaddr)
-    {
-      address += baseaddr;
-    }
-  debug_base = address;
-  /* FIXME-leak: on failure, might not free all memory associated with
-     interp_bfd.  */
-  bfd_close (interp_bfd);
-  return (1);
-}
-#endif /* HANDLE_SVR4_EXEC_EMULATORS */
-
-/*
-
-   LOCAL FUNCTION
-
-   elf_locate_base -- locate the base address of dynamic linker structs
-   for SVR4 elf targets.
-
-   SYNOPSIS
-
-   CORE_ADDR elf_locate_base (void)
-
-   DESCRIPTION
-
-   For SVR4 elf targets the address of the dynamic linker's runtime
-   structure is contained within the dynamic info section in the
-   executable file.  The dynamic section is also mapped into the
-   inferior address space.  Because the runtime loader fills in the
-   real address before starting the inferior, we have to read in the
-   dynamic info section from the inferior address space.
-   If there are any errors while trying to find the address, we
-   silently return 0, otherwise the found address is returned.
-
- */
-
-static CORE_ADDR
-elf_locate_base ()
-{
-  sec_ptr dyninfo_sect;
-  int dyninfo_sect_size;
-  CORE_ADDR dyninfo_addr;
-  char *buf;
-  char *bufend;
-  int arch_size;
-
-  /* Find the start address of the .dynamic section.  */
-  dyninfo_sect = bfd_get_section_by_name (exec_bfd, ".dynamic");
-  if (dyninfo_sect == NULL)
-    return 0;
-  dyninfo_addr = bfd_section_vma (exec_bfd, dyninfo_sect);
-
-  /* Read in .dynamic section, silently ignore errors.  */
-  dyninfo_sect_size = bfd_section_size (exec_bfd, dyninfo_sect);
-  buf = alloca (dyninfo_sect_size);
-  if (target_read_memory (dyninfo_addr, buf, dyninfo_sect_size))
-    return 0;
-
-  /* Find the DT_DEBUG entry in the the .dynamic section.
-     For mips elf we look for DT_MIPS_RLD_MAP, mips elf apparently has
-     no DT_DEBUG entries.  */
-
-  arch_size = bfd_elf_get_arch_size (exec_bfd);
-  if (arch_size == -1)	/* failure */
-    return 0;
-
-  if (arch_size == 32)
-    { /* 32-bit elf */
-      for (bufend = buf + dyninfo_sect_size;
-	   buf < bufend;
-	   buf += sizeof (Elf32_External_Dyn))
-	{
-	  Elf32_External_Dyn *x_dynp = (Elf32_External_Dyn *) buf;
-	  long dyn_tag;
-	  CORE_ADDR dyn_ptr;
-
-	  dyn_tag = bfd_h_get_32 (exec_bfd, (bfd_byte *) x_dynp->d_tag);
-	  if (dyn_tag == DT_NULL)
-	    break;
-	  else if (dyn_tag == DT_DEBUG)
-	    {
-	      dyn_ptr = bfd_h_get_32 (exec_bfd, 
-				      (bfd_byte *) x_dynp->d_un.d_ptr);
-	      return dyn_ptr;
-	    }
-#ifdef DT_MIPS_RLD_MAP
-	  else if (dyn_tag == DT_MIPS_RLD_MAP)
-	    {
-	      char pbuf[TARGET_PTR_BIT / HOST_CHAR_BIT];
-
-	      /* DT_MIPS_RLD_MAP contains a pointer to the address
-		 of the dynamic link structure.  */
-	      dyn_ptr = bfd_h_get_32 (exec_bfd, 
-				      (bfd_byte *) x_dynp->d_un.d_ptr);
-	      if (target_read_memory (dyn_ptr, pbuf, sizeof (pbuf)))
-		return 0;
-	      return extract_unsigned_integer (pbuf, sizeof (pbuf));
-	    }
-#endif
-	}
-    }
-  else /* 64-bit elf */
-    {
-      for (bufend = buf + dyninfo_sect_size;
-	   buf < bufend;
-	   buf += sizeof (Elf64_External_Dyn))
-	{
-	  Elf64_External_Dyn *x_dynp = (Elf64_External_Dyn *) buf;
-	  long dyn_tag;
-	  CORE_ADDR dyn_ptr;
-
-	  dyn_tag = bfd_h_get_64 (exec_bfd, (bfd_byte *) x_dynp->d_tag);
-	  if (dyn_tag == DT_NULL)
-	    break;
-	  else if (dyn_tag == DT_DEBUG)
-	    {
-	      dyn_ptr = bfd_h_get_64 (exec_bfd, 
-				      (bfd_byte *) x_dynp->d_un.d_ptr);
-	      return dyn_ptr;
-	    }
-	}
-    }
-
-  /* DT_DEBUG entry not found.  */
-  return 0;
-}
-
-#endif /* SVR4_SHARED_LIBS */
-
-/*
-
-   LOCAL FUNCTION
-
-   locate_base -- locate the base address of dynamic linker structs
-
-   SYNOPSIS
-
-   CORE_ADDR locate_base (void)
-
-   DESCRIPTION
-
-   For both the SunOS and SVR4 shared library implementations, if the
-   inferior executable has been linked dynamically, there is a single
-   address somewhere in the inferior's data space which is the key to
-   locating all of the dynamic linker's runtime structures.  This
-   address is the value of the debug base symbol.  The job of this
-   function is to find and return that address, or to return 0 if there
-   is no such address (the executable is statically linked for example).
-
-   For SunOS, the job is almost trivial, since the dynamic linker and
-   all of it's structures are statically linked to the executable at
-   link time.  Thus the symbol for the address we are looking for has
-   already been added to the minimal symbol table for the executable's
-   objfile at the time the symbol file's symbols were read, and all we
-   have to do is look it up there.  Note that we explicitly do NOT want
-   to find the copies in the shared library.
-
-   The SVR4 version is a bit more complicated because the address
-   is contained somewhere in the dynamic info section.  We have to go
-   to a lot more work to discover the address of the debug base symbol.
-   Because of this complexity, we cache the value we find and return that
-   value on subsequent invocations.  Note there is no copy in the
-   executable symbol tables.
-
- */
-
-static CORE_ADDR
-locate_base ()
-{
-
-#ifndef SVR4_SHARED_LIBS
-
-  struct minimal_symbol *msymbol;
-  CORE_ADDR address = 0;
-  char **symbolp;
-
-  /* For SunOS, we want to limit the search for the debug base symbol to the
-     executable being debugged, since there is a duplicate named symbol in the
-     shared library.  We don't want the shared library versions. */
-
-  for (symbolp = debug_base_symbols; *symbolp != NULL; symbolp++)
-    {
-      msymbol = lookup_minimal_symbol (*symbolp, NULL, symfile_objfile);
-      if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
-	{
-	  address = SYMBOL_VALUE_ADDRESS (msymbol);
-	  return (address);
-	}
-    }
-  return (0);
-
-#else /* SVR4_SHARED_LIBS */
-
-  /* Check to see if we have a currently valid address, and if so, avoid
-     doing all this work again and just return the cached address.  If
-     we have no cached address, try to locate it in the dynamic info
-     section for ELF executables.  */
-
-  if (debug_base == 0)
-    {
-      if (exec_bfd != NULL
-	  && bfd_get_flavour (exec_bfd) == bfd_target_elf_flavour)
-	debug_base = elf_locate_base ();
-#ifdef HANDLE_SVR4_EXEC_EMULATORS
-      /* Try it the hard way for emulated executables.  */
-      else if (inferior_pid != 0 && target_has_execution)
-	proc_iterate_over_mappings (look_for_base);
-#endif
-    }
-  return (debug_base);
-
-#endif /* !SVR4_SHARED_LIBS */
-
-}
-
-/*
-
-   LOCAL FUNCTION
-
-   first_link_map_member -- locate first member in dynamic linker's map
-
-   SYNOPSIS
-
-   static CORE_ADDR first_link_map_member (void)
-
-   DESCRIPTION
-
-   Find the first element in the inferior's dynamic link map, and
-   return its address in the inferior.  This function doesn't copy the
-   link map entry itself into our address space; current_sos actually
-   does the reading.  */
-
-static CORE_ADDR
-first_link_map_member ()
-{
-  CORE_ADDR lm = 0;
-
-#ifndef SVR4_SHARED_LIBS
-
-  read_memory (debug_base, (char *) &dynamic_copy, sizeof (dynamic_copy));
-  if (dynamic_copy.ld_version >= 2)
-    {
-      /* It is a version that we can deal with, so read in the secondary
-         structure and find the address of the link map list from it. */
-      read_memory (SOLIB_EXTRACT_ADDRESS (dynamic_copy.ld_un.ld_2),
-		   (char *) &ld_2_copy, sizeof (struct link_dynamic_2));
-      lm = SOLIB_EXTRACT_ADDRESS (ld_2_copy.ld_loaded);
-    }
-
-#else /* SVR4_SHARED_LIBS */
-
-  read_memory (debug_base, (char *) &debug_copy, sizeof (struct r_debug));
-  /* FIXME:  Perhaps we should validate the info somehow, perhaps by
-     checking r_version for a known version number, or r_state for
-     RT_CONSISTENT. */
-  lm = SOLIB_EXTRACT_ADDRESS (debug_copy.r_map);
-
-#endif /* !SVR4_SHARED_LIBS */
-
-  return (lm);
-}
-
-#ifdef SVR4_SHARED_LIBS
-/*
-
-  LOCAL FUNCTION
-
-  open_symbol_file_object
-
-  SYNOPSIS
-
-  void open_symbol_file_object (int from_tty)
-
-  DESCRIPTION
-
-  If no open symbol file, attempt to locate and open the main symbol
-  file.  On SVR4 systems, this is the first link map entry.  If its
-  name is here, we can open it.  Useful when attaching to a process
-  without first loading its symbol file.
-
- */
-
-static int
-open_symbol_file_object (from_ttyp)
-     int *from_ttyp;	/* sneak past catch_errors */
-{
-  CORE_ADDR lm;
-  struct link_map lmcopy;
-  char *filename;
-  int errcode;
-
-  if (symfile_objfile)
-    if (!query ("Attempt to reload symbols from process? "))
-      return 0;
-
-  if ((debug_base = locate_base ()) == 0)
-    return 0;	/* failed somehow... */
-
-  /* First link map member should be the executable.  */
-  if ((lm = first_link_map_member ()) == 0)
-    return 0;	/* failed somehow... */
-
-  /* Read from target memory to GDB.  */
-  read_memory (lm, (void *) &lmcopy, sizeof (lmcopy));
-
-  if (lmcopy.l_name == 0)
-    return 0;	/* no filename.  */
-
-  /* Now fetch the filename from target memory.  */
-  target_read_string (SOLIB_EXTRACT_ADDRESS (lmcopy.l_name), &filename, 
-		      MAX_PATH_SIZE - 1, &errcode);
-  if (errcode)
-    {
-      warning ("failed to read exec filename from attached file: %s",
-	       safe_strerror (errcode));
-      return 0;
-    }
-
-  make_cleanup (free, filename);
-  /* Have a pathname: read the symbol file.  */
-  symbol_file_command (filename, *from_ttyp);
-
-  return 1;
-}
-#endif /* SVR4_SHARED_LIBS */
-
-
 /* LOCAL FUNCTION
 
    free_so --- free a `struct so_list' object
@@ -1000,13 +265,13 @@
    objfile associated with SO that needs to be removed, the caller is
    responsible for taking care of that.  */
 
-static void
+void
 free_so (struct so_list *so)
 {
   char *bfd_filename = 0;
 
   if (so->sections)
-    free (so->sections);
+    xfree (so->sections);
       
   if (so->abfd)
     {
@@ -1017,144 +282,21 @@
     }
 
   if (bfd_filename)
-    free (bfd_filename);
+    xfree (bfd_filename);
 
-  free (so);
-}
+  TARGET_SO_FREE_SO (so);
 
-
-/* On some systems, the only way to recognize the link map entry for
-   the main executable file is by looking at its name.  Return
-   non-zero iff SONAME matches one of the known main executable names.  */
-
-static int
-match_main (soname)
-     char *soname;
-{
-  char **mainp;
-
-  for (mainp = main_name_list; *mainp != NULL; mainp++)
-    {
-      if (strcmp (soname, *mainp) == 0)
-	return (1);
-    }
-
-  return (0);
-}
-
-
-/* LOCAL FUNCTION
-
-   current_sos -- build a list of currently loaded shared objects
-
-   SYNOPSIS
-
-   struct so_list *current_sos ()
-
-   DESCRIPTION
-
-   Build a list of `struct so_list' objects describing the shared
-   objects currently loaded in the inferior.  This list does not
-   include an entry for the main executable file.
-
-   Note that we only gather information directly available from the
-   inferior --- we don't examine any of the shared library files
-   themselves.  The declaration of `struct so_list' says which fields
-   we provide values for.  */
-
-static struct so_list *
-current_sos ()
-{
-  CORE_ADDR lm;
-  struct so_list *head = 0;
-  struct so_list **link_ptr = &head;
-
-  /* Make sure we've looked up the inferior's dynamic linker's base
-     structure.  */
-  if (! debug_base)
-    {
-      debug_base = locate_base ();
-
-      /* If we can't find the dynamic linker's base structure, this
-	 must not be a dynamically linked executable.  Hmm.  */
-      if (! debug_base)
-	return 0;
-    }
-
-  /* Walk the inferior's link map list, and build our list of
-     `struct so_list' nodes.  */
-  lm = first_link_map_member ();  
-  while (lm)
-    {
-      struct so_list *new
-	= (struct so_list *) xmalloc (sizeof (struct so_list));
-      struct cleanup *old_chain = make_cleanup (free, new);
-      memset (new, 0, sizeof (*new));
-
-      new->lmaddr = lm;
-      read_memory (lm, (char *) &(new->lm), sizeof (struct link_map));
-
-      lm = LM_NEXT (new);
-
-      /* For SVR4 versions, the first entry in the link map is for the
-         inferior executable, so we must ignore it.  For some versions of
-         SVR4, it has no name.  For others (Solaris 2.3 for example), it
-         does have a name, so we can no longer use a missing name to
-         decide when to ignore it. */
-      if (IGNORE_FIRST_LINK_MAP_ENTRY (new))
-	free_so (new);
-      else
-	{
-	  int errcode;
-	  char *buffer;
-
-	  /* Extract this shared object's name.  */
-	  target_read_string (LM_NAME (new), &buffer,
-			      MAX_PATH_SIZE - 1, &errcode);
-	  if (errcode != 0)
-	    {
-	      warning ("current_sos: Can't read pathname for load map: %s\n",
-		       safe_strerror (errcode));
-	    }
-	  else
-	    {
-	      strncpy (new->so_name, buffer, MAX_PATH_SIZE - 1);
-	      new->so_name[MAX_PATH_SIZE - 1] = '\0';
-	      free (buffer);
-	      strcpy (new->so_original_name, new->so_name);
-	    }
-
-	  /* If this entry has no name, or its name matches the name
-	     for the main executable, don't include it in the list.  */
-	  if (! new->so_name[0]
-	      || match_main (new->so_name))
-	    free_so (new);
-	  else
-	    {
-	      new->next = 0;
-	      *link_ptr = new;
-	      link_ptr = &new->next;
-	    }
-	}
-
-      discard_cleanups (old_chain);
-    }
-
-  return head;
+  xfree (so);
 }
 
 
 /* A small stub to get us past the arg-passing pinhole of catch_errors.  */
 
 static int
-symbol_add_stub (arg)
-     PTR arg;
+symbol_add_stub (PTR arg)
 {
   register struct so_list *so = (struct so_list *) arg;  /* catch_errs bogon */
   struct section_addr_info *sap;
-  CORE_ADDR lowest_addr = 0;
-  int lowest_index;
-  asection *lowest_sect = NULL;
 
   /* Have we already loaded this shared object?  */
   ALL_OBJFILES (so->objfile)
@@ -1163,35 +305,9 @@
 	return 1;
     }
 
-  /* Find the shared object's text segment.  */
-  if (so->textsection)
-    {
-      lowest_addr = so->textsection->addr;
-      lowest_sect = bfd_get_section_by_name (so->abfd, ".text");
-      lowest_index = lowest_sect->index;
-    }
-  else if (so->abfd != NULL)
-    {
-      /* If we didn't find a mapped non zero sized .text section, set
-         up lowest_addr so that the relocation in symbol_file_add does
-         no harm.  */
-      lowest_sect = bfd_get_section_by_name (so->abfd, ".text");
-      if (lowest_sect == NULL)
-	bfd_map_over_sections (so->abfd, find_lowest_section,
-			       (PTR) &lowest_sect);
-      if (lowest_sect)
-	{
-	  lowest_addr = bfd_section_vma (so->abfd, lowest_sect)
-	    + LM_ADDR (so);
-	  lowest_index = lowest_sect->index;
-	}
-    }
-
   sap = build_section_addr_info_from_section_table (so->sections,
                                                     so->sections_end);
 
-  sap->other[lowest_index].addr = lowest_addr;
-
   so->objfile = symbol_file_add (so->so_name, so->from_tty,
 				 sap, 0, OBJF_SHARED);
   free_section_addr_info (sap);
@@ -1232,21 +348,18 @@
 void
 update_solib_list (int from_tty, struct target_ops *target)
 {
-  struct so_list *inferior = current_sos ();
+  struct so_list *inferior = TARGET_SO_CURRENT_SOS ();
   struct so_list *gdb, **gdb_link;
 
-#ifdef SVR4_SHARED_LIBS
   /* If we are attaching to a running process for which we 
      have not opened a symbol file, we may be able to get its 
      symbols now!  */
   if (attach_flag &&
       symfile_objfile == NULL)
-    catch_errors (open_symbol_file_object, (PTR) &from_tty, 
+    catch_errors (TARGET_SO_OPEN_SYMBOL_FILE_OBJECT, (PTR) &from_tty, 
 		  "Error reading attached process's symbol file.\n",
 		  RETURN_MASK_ALL);
 
-#endif SVR4_SHARED_LIBS
-
   /* Since this function might actually add some elements to the
      so_list_head list, arrange for it to be cleaned up when
      appropriate.  */
@@ -1452,7 +565,7 @@
 	   frameless.  */
 	reinit_frame_cache ();
 
-	special_symbol_handling ();
+	TARGET_SO_SPECIAL_SYMBOL_HANDLING ();
       }
   }
 }
@@ -1475,9 +588,7 @@
  */
 
 static void
-info_sharedlibrary_command (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+info_sharedlibrary_command (char *ignore, int from_tty)
 {
   register struct so_list *so = NULL;	/* link map state variable */
   int header_done = 0;
@@ -1491,7 +602,7 @@
       return;
     }
 
-  arch_size = bfd_elf_get_arch_size (exec_bfd);
+  arch_size = bfd_get_arch_size (exec_bfd);
   /* Default to 32-bit in case of failure (non-elf). */
   if (arch_size == 32 || arch_size == -1)
     {
@@ -1503,6 +614,11 @@
       addr_width = 16 + 4;
       addr_fmt = "016l";
     }
+  else
+    {
+      internal_error ("%s:%d: bfd_get_arch_size() returned unknown size %d",
+		      __FILE__, __LINE__, arch_size);
+    }
 
   update_solib_list (from_tty, 0);
 
@@ -1519,11 +635,17 @@
 	    }
 
 	  printf_unfiltered ("%-*s", addr_width,
-		      local_hex_string_custom ((unsigned long) LM_ADDR (so),
-					       addr_fmt));
+			     so->textsection != NULL 
+			       ? local_hex_string_custom (
+			           (unsigned long) so->textsection->addr,
+	                           addr_fmt)
+			       : "");
 	  printf_unfiltered ("%-*s", addr_width,
-			 local_hex_string_custom ((unsigned long) so->lmend,
-						  addr_fmt));
+			     so->textsection != NULL 
+			       ? local_hex_string_custom (
+			           (unsigned long) so->textsection->endaddr,
+	                           addr_fmt)
+			       : "");
 	  printf_unfiltered ("%-12s", so->symbols_loaded ? "Yes" : "No");
 	  printf_unfiltered ("%s\n", so->so_name);
 	}
@@ -1548,10 +670,7 @@
 
    Provides a hook for other gdb routines to discover whether or
    not a particular address is within the mapped address space of
-   a shared library.  Any address between the base mapping address
-   and the first address beyond the end of the last mapping, is
-   considered to be within the shared library address space, for
-   our purposes.
+   a shared library.
 
    For example, this routine is called at one point to disable
    breakpoints which are in shared libraries that are not currently
@@ -1559,15 +678,19 @@
  */
 
 char *
-solib_address (address)
-     CORE_ADDR address;
+solib_address (CORE_ADDR address)
 {
   register struct so_list *so = 0;	/* link map state variable */
 
   for (so = so_list_head; so; so = so->next)
     {
-      if (LM_ADDR (so) <= address && address < so->lmend)
-	return (so->so_name);
+      struct section_table *p;
+
+      for (p = so->sections; p < so->sections_end; p++)
+	{
+	  if (p->addr <= address && address < p->endaddr)
+	    return (so->so_name);
+	}
     }
 
   return (0);
@@ -1576,7 +699,7 @@
 /* Called by free_all_symtabs */
 
 void
-clear_solib ()
+clear_solib (void)
 {
   /* This function is expected to handle ELF shared libraries.  It is
      also used on Solaris, which can run either ELF or a.out binaries
@@ -1609,313 +732,17 @@
       free_so (so);
     }
 
-  debug_base = 0;
+  TARGET_SO_CLEAR_SOLIB ();
 }
 
 static void
-do_clear_solib (dummy)
-     PTR dummy;
+do_clear_solib (PTR dummy)
 {
   solib_cleanup_queued = 0;
   clear_solib ();
 }
 
-#ifdef SVR4_SHARED_LIBS
-
-/* Return 1 if PC lies in the dynamic symbol resolution code of the
-   SVR4 run time loader.  */
-
-static CORE_ADDR interp_text_sect_low;
-static CORE_ADDR interp_text_sect_high;
-static CORE_ADDR interp_plt_sect_low;
-static CORE_ADDR interp_plt_sect_high;
-
-int
-in_svr4_dynsym_resolve_code (pc)
-     CORE_ADDR pc;
-{
-  return ((pc >= interp_text_sect_low && pc < interp_text_sect_high)
-	  || (pc >= interp_plt_sect_low && pc < interp_plt_sect_high)
-	  || in_plt_section (pc, NULL));
-}
-#endif
-
-/*
-
-   LOCAL FUNCTION
-
-   disable_break -- remove the "mapping changed" breakpoint
-
-   SYNOPSIS
-
-   static int disable_break ()
-
-   DESCRIPTION
-
-   Removes the breakpoint that gets hit when the dynamic linker
-   completes a mapping change.
-
- */
-
-#ifndef SVR4_SHARED_LIBS
-
-static int
-disable_break ()
-{
-  int status = 1;
-
-#ifndef SVR4_SHARED_LIBS
-
-  int in_debugger = 0;
-
-  /* Read the debugger structure from the inferior to retrieve the
-     address of the breakpoint and the original contents of the
-     breakpoint address.  Remove the breakpoint by writing the original
-     contents back. */
-
-  read_memory (debug_addr, (char *) &debug_copy, sizeof (debug_copy));
-
-  /* Set `in_debugger' to zero now. */
-
-  write_memory (flag_addr, (char *) &in_debugger, sizeof (in_debugger));
-
-  breakpoint_addr = SOLIB_EXTRACT_ADDRESS (debug_copy.ldd_bp_addr);
-  write_memory (breakpoint_addr, (char *) &debug_copy.ldd_bp_inst,
-		sizeof (debug_copy.ldd_bp_inst));
-
-#else /* SVR4_SHARED_LIBS */
-
-  /* Note that breakpoint address and original contents are in our address
-     space, so we just need to write the original contents back. */
-
-  if (memory_remove_breakpoint (breakpoint_addr, shadow_contents) != 0)
-    {
-      status = 0;
-    }
-
-#endif /* !SVR4_SHARED_LIBS */
-
-  /* For the SVR4 version, we always know the breakpoint address.  For the
-     SunOS version we don't know it until the above code is executed.
-     Grumble if we are stopped anywhere besides the breakpoint address. */
-
-  if (stop_pc != breakpoint_addr)
-    {
-      warning ("stopped at unknown breakpoint while handling shared libraries");
-    }
-
-  return (status);
-}
-
-#endif /* #ifdef SVR4_SHARED_LIBS */
-
-/*
-
-   LOCAL FUNCTION
-
-   enable_break -- arrange for dynamic linker to hit breakpoint
-
-   SYNOPSIS
-
-   int enable_break (void)
-
-   DESCRIPTION
-
-   Both the SunOS and the SVR4 dynamic linkers have, as part of their
-   debugger interface, support for arranging for the inferior to hit
-   a breakpoint after mapping in the shared libraries.  This function
-   enables that breakpoint.
-
-   For SunOS, there is a special flag location (in_debugger) which we
-   set to 1.  When the dynamic linker sees this flag set, it will set
-   a breakpoint at a location known only to itself, after saving the
-   original contents of that place and the breakpoint address itself,
-   in it's own internal structures.  When we resume the inferior, it
-   will eventually take a SIGTRAP when it runs into the breakpoint.
-   We handle this (in a different place) by restoring the contents of
-   the breakpointed location (which is only known after it stops),
-   chasing around to locate the shared libraries that have been
-   loaded, then resuming.
-
-   For SVR4, the debugger interface structure contains a member (r_brk)
-   which is statically initialized at the time the shared library is
-   built, to the offset of a function (_r_debug_state) which is guaran-
-   teed to be called once before mapping in a library, and again when
-   the mapping is complete.  At the time we are examining this member,
-   it contains only the unrelocated offset of the function, so we have
-   to do our own relocation.  Later, when the dynamic linker actually
-   runs, it relocates r_brk to be the actual address of _r_debug_state().
-
-   The debugger interface structure also contains an enumeration which
-   is set to either RT_ADD or RT_DELETE prior to changing the mapping,
-   depending upon whether or not the library is being mapped or unmapped,
-   and then set to RT_CONSISTENT after the library is mapped/unmapped.
- */
-
-static int
-enable_break ()
-{
-  int success = 0;
-
-#ifndef SVR4_SHARED_LIBS
-
-  int j;
-  int in_debugger;
-
-  /* Get link_dynamic structure */
-
-  j = target_read_memory (debug_base, (char *) &dynamic_copy,
-			  sizeof (dynamic_copy));
-  if (j)
-    {
-      /* unreadable */
-      return (0);
-    }
-
-  /* Calc address of debugger interface structure */
-
-  debug_addr = SOLIB_EXTRACT_ADDRESS (dynamic_copy.ldd);
-
-  /* Calc address of `in_debugger' member of debugger interface structure */
-
-  flag_addr = debug_addr + (CORE_ADDR) ((char *) &debug_copy.ldd_in_debugger -
-					(char *) &debug_copy);
-
-  /* Write a value of 1 to this member.  */
-
-  in_debugger = 1;
-  write_memory (flag_addr, (char *) &in_debugger, sizeof (in_debugger));
-  success = 1;
-
-#else /* SVR4_SHARED_LIBS */
-
-#ifdef BKPT_AT_SYMBOL
-
-  struct minimal_symbol *msymbol;
-  char **bkpt_namep;
-  asection *interp_sect;
-
-  /* First, remove all the solib event breakpoints.  Their addresses
-     may have changed since the last time we ran the program.  */
-  remove_solib_event_breakpoints ();
-
-#ifdef SVR4_SHARED_LIBS
-  interp_text_sect_low = interp_text_sect_high = 0;
-  interp_plt_sect_low = interp_plt_sect_high = 0;
-
-  /* Find the .interp section; if not found, warn the user and drop
-     into the old breakpoint at symbol code.  */
-  interp_sect = bfd_get_section_by_name (exec_bfd, ".interp");
-  if (interp_sect)
-    {
-      unsigned int interp_sect_size;
-      char *buf;
-      CORE_ADDR load_addr;
-      bfd *tmp_bfd;
-      CORE_ADDR sym_addr = 0;
-
-      /* Read the contents of the .interp section into a local buffer;
-         the contents specify the dynamic linker this program uses.  */
-      interp_sect_size = bfd_section_size (exec_bfd, interp_sect);
-      buf = alloca (interp_sect_size);
-      bfd_get_section_contents (exec_bfd, interp_sect,
-				buf, 0, interp_sect_size);
-
-      /* Now we need to figure out where the dynamic linker was
-         loaded so that we can load its symbols and place a breakpoint
-         in the dynamic linker itself.
-
-         This address is stored on the stack.  However, I've been unable
-         to find any magic formula to find it for Solaris (appears to
-         be trivial on GNU/Linux).  Therefore, we have to try an alternate
-         mechanism to find the dynamic linker's base address.  */
-      tmp_bfd = bfd_openr (buf, gnutarget);
-      if (tmp_bfd == NULL)
-	goto bkpt_at_symbol;
-
-      /* Make sure the dynamic linker's really a useful object.  */
-      if (!bfd_check_format (tmp_bfd, bfd_object))
-	{
-	  warning ("Unable to grok dynamic linker %s as an object file", buf);
-	  bfd_close (tmp_bfd);
-	  goto bkpt_at_symbol;
-	}
-
-      /* We find the dynamic linker's base address by examining the
-         current pc (which point at the entry point for the dynamic
-         linker) and subtracting the offset of the entry point.  */
-      load_addr = read_pc () - tmp_bfd->start_address;
-
-      /* Record the relocated start and end address of the dynamic linker
-         text and plt section for in_svr4_dynsym_resolve_code.  */
-      interp_sect = bfd_get_section_by_name (tmp_bfd, ".text");
-      if (interp_sect)
-	{
-	  interp_text_sect_low =
-	    bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
-	  interp_text_sect_high =
-	    interp_text_sect_low + bfd_section_size (tmp_bfd, interp_sect);
-	}
-      interp_sect = bfd_get_section_by_name (tmp_bfd, ".plt");
-      if (interp_sect)
-	{
-	  interp_plt_sect_low =
-	    bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
-	  interp_plt_sect_high =
-	    interp_plt_sect_low + bfd_section_size (tmp_bfd, interp_sect);
-	}
-
-      /* Now try to set a breakpoint in the dynamic linker.  */
-      for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
-	{
-	  sym_addr = bfd_lookup_symbol (tmp_bfd, *bkpt_namep);
-	  if (sym_addr != 0)
-	    break;
-	}
-
-      /* We're done with the temporary bfd.  */
-      bfd_close (tmp_bfd);
-
-      if (sym_addr != 0)
-	{
-	  create_solib_event_breakpoint (load_addr + sym_addr);
-	  return 1;
-	}
-
-      /* For whatever reason we couldn't set a breakpoint in the dynamic
-         linker.  Warn and drop into the old code.  */
-    bkpt_at_symbol:
-      warning ("Unable to find dynamic linker breakpoint function.\nGDB will be unable to debug shared library initializers\nand track explicitly loaded dynamic code.");
-    }
-#endif
-
-  /* Scan through the list of symbols, trying to look up the symbol and
-     set a breakpoint there.  Terminate loop when we/if we succeed. */
-
-  breakpoint_addr = 0;
-  for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++)
-    {
-      msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile);
-      if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
-	{
-	  create_solib_event_breakpoint (SYMBOL_VALUE_ADDRESS (msymbol));
-	  return 1;
-	}
-    }
-
-  /* Nothing good happened.  */
-  success = 0;
-
-#endif /* BKPT_AT_SYMBOL */
-
-#endif /* !SVR4_SHARED_LIBS */
-
-  return (success);
-}
-
-/*
-
-   GLOBAL FUNCTION
+/* GLOBAL FUNCTION
 
    solib_create_inferior_hook -- shared library startup support
 
@@ -1928,172 +755,12 @@
    When gdb starts up the inferior, it nurses it along (through the
    shell) until it is ready to execute it's first instruction.  At this
    point, this function gets called via expansion of the macro
-   SOLIB_CREATE_INFERIOR_HOOK.
-
-   For SunOS executables, this first instruction is typically the
-   one at "_start", or a similar text label, regardless of whether
-   the executable is statically or dynamically linked.  The runtime
-   startup code takes care of dynamically linking in any shared
-   libraries, once gdb allows the inferior to continue.
-
-   For SVR4 executables, this first instruction is either the first
-   instruction in the dynamic linker (for dynamically linked
-   executables) or the instruction at "start" for statically linked
-   executables.  For dynamically linked executables, the system
-   first exec's /lib/libc.so.N, which contains the dynamic linker,
-   and starts it running.  The dynamic linker maps in any needed
-   shared libraries, maps in the actual user executable, and then
-   jumps to "start" in the user executable.
-
-   For both SunOS shared libraries, and SVR4 shared libraries, we
-   can arrange to cooperate with the dynamic linker to discover the
-   names of shared libraries that are dynamically linked, and the
-   base addresses to which they are linked.
-
-   This function is responsible for discovering those names and
-   addresses, and saving sufficient information about them to allow
-   their symbols to be read at a later time.
-
-   FIXME
-
-   Between enable_break() and disable_break(), this code does not
-   properly handle hitting breakpoints which the user might have
-   set in the startup code or in the dynamic linker itself.  Proper
-   handling will probably have to wait until the implementation is
-   changed to use the "breakpoint handler function" method.
-
-   Also, what if child has exit()ed?  Must exit loop somehow.
- */
+   SOLIB_CREATE_INFERIOR_HOOK.  */
 
 void
-solib_create_inferior_hook ()
+solib_create_inferior_hook (void)
 {
-  /* If we are using the BKPT_AT_SYMBOL code, then we don't need the base
-     yet.  In fact, in the case of a SunOS4 executable being run on
-     Solaris, we can't get it yet.  current_sos will get it when it needs
-     it.  */
-#if !(defined (SVR4_SHARED_LIBS) && defined (BKPT_AT_SYMBOL))
-  if ((debug_base = locate_base ()) == 0)
-    {
-      /* Can't find the symbol or the executable is statically linked. */
-      return;
-    }
-#endif
-
-  if (!enable_break ())
-    {
-      warning ("shared library handler failed to enable breakpoint");
-      return;
-    }
-
-#if !defined(SVR4_SHARED_LIBS) || defined(_SCO_DS)
-  /* SCO and SunOS need the loop below, other systems should be using the
-     special shared library breakpoints and the shared library breakpoint
-     service routine.
-
-     Now run the target.  It will eventually hit the breakpoint, at
-     which point all of the libraries will have been mapped in and we
-     can go groveling around in the dynamic linker structures to find
-     out what we need to know about them. */
-
-  clear_proceed_status ();
-  stop_soon_quietly = 1;
-  stop_signal = TARGET_SIGNAL_0;
-  do
-    {
-      target_resume (-1, 0, stop_signal);
-      wait_for_inferior ();
-    }
-  while (stop_signal != TARGET_SIGNAL_TRAP);
-  stop_soon_quietly = 0;
-
-#if !defined(_SCO_DS)
-  /* We are now either at the "mapping complete" breakpoint (or somewhere
-     else, a condition we aren't prepared to deal with anyway), so adjust
-     the PC as necessary after a breakpoint, disable the breakpoint, and
-     add any shared libraries that were mapped in. */
-
-  if (DECR_PC_AFTER_BREAK)
-    {
-      stop_pc -= DECR_PC_AFTER_BREAK;
-      write_register (PC_REGNUM, stop_pc);
-    }
-
-  if (!disable_break ())
-    {
-      warning ("shared library handler failed to disable breakpoint");
-    }
-
-  if (auto_solib_add)
-    solib_add ((char *) 0, 0, (struct target_ops *) 0);
-#endif /* ! _SCO_DS */
-#endif
-}
-
-/*
-
-   LOCAL FUNCTION
-
-   special_symbol_handling -- additional shared library symbol handling
-
-   SYNOPSIS
-
-   void special_symbol_handling ()
-
-   DESCRIPTION
-
-   Once the symbols from a shared object have been loaded in the usual
-   way, we are called to do any system specific symbol handling that 
-   is needed.
-
-   For SunOS4, this consists of grunging around in the dynamic
-   linkers structures to find symbol definitions for "common" symbols
-   and adding them to the minimal symbol table for the runtime common
-   objfile.
-
- */
-
-static void
-special_symbol_handling ()
-{
-#ifndef SVR4_SHARED_LIBS
-  int j;
-
-  if (debug_addr == 0)
-    {
-      /* Get link_dynamic structure */
-
-      j = target_read_memory (debug_base, (char *) &dynamic_copy,
-			      sizeof (dynamic_copy));
-      if (j)
-	{
-	  /* unreadable */
-	  return;
-	}
-
-      /* Calc address of debugger interface structure */
-      /* FIXME, this needs work for cross-debugging of core files
-         (byteorder, size, alignment, etc).  */
-
-      debug_addr = SOLIB_EXTRACT_ADDRESS (dynamic_copy.ldd);
-    }
-
-  /* Read the debugger structure from the inferior, just to make sure
-     we have a current copy. */
-
-  j = target_read_memory (debug_addr, (char *) &debug_copy,
-			  sizeof (debug_copy));
-  if (j)
-    return;			/* unreadable */
-
-  /* Get common symbol definitions for the loaded object. */
-
-  if (debug_copy.ldd_cp)
-    {
-      solib_add_common_symbols (SOLIB_EXTRACT_ADDRESS (debug_copy.ldd_cp));
-    }
-
-#endif /* !SVR4_SHARED_LIBS */
+  TARGET_SO_SOLIB_CREATE_INFERIOR_HOOK ();
 }
 
 
@@ -2112,21 +779,16 @@
  */
 
 static void
-sharedlibrary_command (args, from_tty)
-     char *args;
-     int from_tty;
+sharedlibrary_command (char *args, int from_tty)
 {
   dont_repeat ();
   solib_add (args, from_tty, (struct target_ops *) 0);
 }
 
-#endif /* HAVE_LINK_H */
 
 void
-_initialize_solib ()
+_initialize_solib (void)
 {
-#ifdef HAVE_LINK_H
-
   add_com ("sharedlibrary", class_files, sharedlibrary_command,
 	   "Load shared object library symbols for files matching REGEXP.");
   add_info ("sharedlibrary", info_sharedlibrary_command,
@@ -2158,5 +820,4 @@
 		  &setlist),
      &showlist);
 
-#endif /* HAVE_LINK_H */
 }
diff --git a/gdb/solist.h b/gdb/solist.h
new file mode 100644
index 0000000..2925250
--- /dev/null
+++ b/gdb/solist.h
@@ -0,0 +1,112 @@
+/* Shared library declarations for GDB, the GNU Debugger.
+   Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 1999, 2000
+   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.  */
+
+#define SO_NAME_MAX_PATH_SIZE 512	/* FIXME: Should be dynamic */
+
+/* Forward declaration for target specific link map information.  This
+   struct is opaque to all but the target specific file.  */
+struct lm_info;
+
+struct so_list
+  {
+    /* The following fields of the structure come directly from the
+       dynamic linker's tables in the inferior, and are initialized by
+       current_sos.  */
+
+    struct so_list *next;	/* next structure in linked list */
+
+    /* A pointer to target specific link map information.  Often this
+       will be a copy of struct link_map from the user process, but
+       it need not be; it can be any collection of data needed to
+       traverse the dynamic linker's data structures. */
+    struct lm_info *lm_info;
+
+    /* Shared object file name, exactly as it appears in the
+       inferior's link map.  This may be a relative path, or something
+       which needs to be looked up in LD_LIBRARY_PATH, etc.  We use it
+       to tell which entries in the inferior's dynamic linker's link
+       map we've already loaded.  */
+    char so_original_name[SO_NAME_MAX_PATH_SIZE];
+
+    /* shared object file name, expanded to something GDB can open */
+    char so_name[SO_NAME_MAX_PATH_SIZE];
+
+    /* The following fields of the structure are built from
+       information gathered from the shared object file itself, and
+       are initialized when we actually add it to our symbol tables.  */
+
+    bfd *abfd;
+    char symbols_loaded;	/* flag: symbols read in yet? */
+    char from_tty;		/* flag: print msgs? */
+    struct objfile *objfile;	/* objfile for loaded lib */
+    struct section_table *sections;
+    struct section_table *sections_end;
+    struct section_table *textsection;
+  };
+
+struct target_so_ops
+  {
+    /* Adjust the section binding addresses by the base address at
+       which the object was actually mapped.  */
+    void (*relocate_section_addresses) (struct so_list *so,
+                                        struct section_table *);
+
+    /* Free the the link map info and any other private data
+       structures associated with a so_list entry.  */
+    void (*free_so) (struct so_list *so);
+
+    /* Reset or free private data structures not associated with
+       so_list entries.  */
+    void (*clear_solib) (void);
+
+    /* Target dependent code to run after child process fork.  */
+    void (*solib_create_inferior_hook) (void);
+
+    /* Do additional symbol handling, lookup, etc. after symbols
+       for a shared object have been loaded.  */
+    void (*special_symbol_handling) (void);
+
+    /* Construct a list of the currently loaded shared objects.  */
+    struct so_list *(*current_sos) (void);
+
+    /* Find, open, and read the symbols for the main executable.  */
+    int (*open_symbol_file_object) (void *from_ttyp);
+  };
+
+void free_so (struct so_list *so);
+
+/* Find solib binary file and open it.  */
+extern int solib_open (char *in_pathname, char **found_pathname);
+
+/* FIXME: gdbarch needs to control this variable */
+extern struct target_so_ops *current_target_so_ops;
+
+#define TARGET_SO_RELOCATE_SECTION_ADDRESSES \
+  (current_target_so_ops->relocate_section_addresses)
+#define TARGET_SO_FREE_SO (current_target_so_ops->free_so)
+#define TARGET_SO_CLEAR_SOLIB (current_target_so_ops->clear_solib)
+#define TARGET_SO_SOLIB_CREATE_INFERIOR_HOOK \
+  (current_target_so_ops->solib_create_inferior_hook)
+#define TARGET_SO_SPECIAL_SYMBOL_HANDLING \
+  (current_target_so_ops->special_symbol_handling)
+#define TARGET_SO_CURRENT_SOS (current_target_so_ops->current_sos)
+#define TARGET_SO_OPEN_SYMBOL_FILE_OBJECT \
+  (current_target_so_ops->open_symbol_file_object)
diff --git a/gdb/somread.c b/gdb/somread.c
index b2aecc0..43cd0fa 100644
--- a/gdb/somread.c
+++ b/gdb/somread.c
@@ -80,10 +80,8 @@
  */
 
 static void
-som_symtab_read (abfd, objfile, section_offsets)
-     bfd *abfd;
-     struct objfile *objfile;
-     struct section_offsets *section_offsets;
+som_symtab_read (bfd *abfd, struct objfile *objfile,
+		 struct section_offsets *section_offsets)
 {
   unsigned int number_of_symbols;
   int val, dynamic;
@@ -117,7 +115,7 @@
 
      There's nothing in the header which easily allows us to do
      this.  The only reliable way I know of is to check for the
-     existance of a $SHLIB_INFO$ section with a non-zero size.  */
+     existence of a $SHLIB_INFO$ section with a non-zero size.  */
   /* The code below is not a reliable way to check whether an
    * executable is dynamic, so I commented it out - RT
    * shlib_info = bfd_get_section_by_name (objfile->obfd, "$SHLIB_INFO$");
@@ -347,9 +345,7 @@
    capability even for files compiled without -g.  */
 
 static void
-som_symfile_read (objfile, mainline)
-     struct objfile *objfile;
-     int mainline;
+som_symfile_read (struct objfile *objfile, int mainline)
 {
   bfd *abfd = objfile->obfd;
   struct cleanup *back_to;
@@ -410,8 +406,7 @@
    We reinitialize buildsym, since we may be reading stabs from a SOM file.  */
 
 static void
-som_new_init (ignore)
-     struct objfile *ignore;
+som_new_init (struct objfile *ignore)
 {
   stabsread_new_init ();
   buildsym_new_init ();
@@ -423,8 +418,7 @@
    objfile struct from the global list of known objfiles. */
 
 static void
-som_symfile_finish (objfile)
-     struct objfile *objfile;
+som_symfile_finish (struct objfile *objfile)
 {
   if (objfile->sym_stab_info != NULL)
     {
@@ -436,8 +430,7 @@
 /* SOM specific initialization routine for reading symbols.  */
 
 static void
-som_symfile_init (objfile)
-     struct objfile *objfile;
+som_symfile_init (struct objfile *objfile)
 {
   /* SOM objects may be reordered, so set OBJF_REORDERED.  If we
      find this causes a significant slowdown in gdb then we could
@@ -451,9 +444,7 @@
    Plain and simple for now.  */
 
 static void
-som_symfile_offsets (objfile, addrs)
-     struct objfile *objfile;
-     struct section_addr_info *addrs;
+som_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs)
 {
   int i;
   CORE_ADDR text_addr;
@@ -486,7 +477,7 @@
       text_addr = addrs->other[i].addr;
 
       for (i = 0; i < SECT_OFF_MAX; i++)
-	ANOFFSET (objfile->section_offsets, i) = text_addr;
+	(objfile->section_offsets)->offsets[i] = text_addr;
     }
 }
 
@@ -497,8 +488,7 @@
    with as "loc_indirect" vars.)
    Return value = number of import symbols read in. */
 int
-init_import_symbols (objfile)
-     struct objfile *objfile;
+init_import_symbols (struct objfile *objfile)
 {
   unsigned int import_list;
   unsigned int import_list_size;
@@ -607,7 +597,7 @@
     }
 
   objfile->import_list_size = import_list_size;
-  free (string_buffer);
+  xfree (string_buffer);
   return import_list_size;
 }
 
@@ -618,8 +608,7 @@
    with as "loc_indirect" vars.)
    Return value = number of import symbols read in. */
 int
-init_export_symbols (objfile)
-     struct objfile *objfile;
+init_export_symbols (struct objfile *objfile)
 {
   unsigned int export_list;
   unsigned int export_list_size;
@@ -739,7 +728,7 @@
     }
 
   objfile->export_list_size = export_list_size;
-  free (string_buffer);
+  xfree (string_buffer);
   return export_list_size;
 }
 
@@ -759,7 +748,7 @@
 };
 
 void
-_initialize_somread ()
+_initialize_somread (void)
 {
   add_symtab_fns (&som_sym_fns);
 }
diff --git a/gdb/somsolib.c b/gdb/somsolib.c
index d5d5341..dc38145 100644
--- a/gdb/somsolib.c
+++ b/gdb/somsolib.c
@@ -208,8 +208,7 @@
 static void som_solib_sharedlibrary_command (char *, int);
 
 static LONGEST
-som_solib_sizeof_symbol_table (filename)
-     char *filename;
+som_solib_sizeof_symbol_table (char *filename)
 {
   bfd *abfd;
   int desc;
@@ -231,7 +230,7 @@
   if (!abfd)
     {
       close (desc);
-      make_cleanup (free, filename);
+      make_cleanup (xfree, filename);
       error ("\"%s\": can't open to read symbols: %s.", filename,
 	     bfd_errmsg (bfd_get_error ()));
     }
@@ -239,7 +238,7 @@
   if (!bfd_check_format (abfd, bfd_object))	/* Reads in section info */
     {
       bfd_close (abfd);		/* This also closes desc */
-      make_cleanup (free, filename);
+      make_cleanup (xfree, filename);
       error ("\"%s\": can't read symbols: %s.", filename,
 	     bfd_errmsg (bfd_get_error ()));
     }
@@ -257,7 +256,7 @@
     st_size += (LONGEST) bfd_section_size (abfd, sect);
 
   bfd_close (abfd);		/* This also closes desc */
-  free (filename);
+  xfree (filename);
 
   /* Unfortunately, just summing the sizes of various debug info
      sections isn't a very accurate measurement of how much heap
@@ -280,11 +279,8 @@
 
 
 static void
-som_solib_add_solib_objfile (so, name, from_tty, text_addr)
-     struct so_list *so;
-     char *name;
-     int from_tty;
-     CORE_ADDR text_addr;
+som_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty,
+			     CORE_ADDR text_addr)
 {
   obj_private_data_t *obj_private;
   struct section_addr_info section_addrs;
@@ -321,12 +317,8 @@
 
 
 static void
-som_solib_load_symbols (so, name, from_tty, text_addr, target)
-     struct so_list *so;
-     char *name;
-     int from_tty;
-     CORE_ADDR text_addr;
-     struct target_ops *target;
+som_solib_load_symbols (struct so_list *so, char *name, int from_tty,
+			CORE_ADDR text_addr, struct target_ops *target)
 {
   struct section_table *p;
   int status;
@@ -397,10 +389,7 @@
    be exceeded.  */
 
 void
-som_solib_add (arg_string, from_tty, target)
-     char *arg_string;
-     int from_tty;
-     struct target_ops *target;
+som_solib_add (char *arg_string, int from_tty, struct target_ops *target)
 {
   struct minimal_symbol *msymbol;
   struct so_list *so_list_tail;
@@ -834,7 +823,7 @@
    means running until the "_start" is called.  */
 
 void
-som_solib_create_inferior_hook ()
+som_solib_create_inferior_hook (void)
 {
   struct minimal_symbol *msymbol;
   unsigned int dld_flags, status, have_endo;
@@ -1018,7 +1007,7 @@
       struct so_list *temp;
 
       temp = so_list_head;
-      free (so_list_head);
+      xfree (so_list_head);
       so_list_head = temp->next;
     }
   clear_symtab_users ();
@@ -1026,8 +1015,7 @@
 
 
 static void
-reset_inferior_pid (saved_inferior_pid)
-     int saved_inferior_pid;
+reset_inferior_pid (int saved_inferior_pid)
 {
   inferior_pid = saved_inferior_pid;
 }
@@ -1044,8 +1032,7 @@
    GDB may already have been notified of.
  */
 void
-som_solib_remove_inferior_hook (pid)
-     int pid;
+som_solib_remove_inferior_hook (int pid)
 {
   CORE_ADDR addr;
   struct minimal_symbol *msymbol;
@@ -1095,11 +1082,8 @@
    som_solib_create_inferior_hook.
  */
 void
-som_solib_create_catch_load_hook (pid, tempflag, filename, cond_string)
-     int pid;
-     int tempflag;
-     char *filename;
-     char *cond_string;
+som_solib_create_catch_load_hook (int pid, int tempflag, char *filename,
+				  char *cond_string)
 {
   create_solib_load_event_breakpoint ("__d_trap", tempflag, filename, cond_string);
 }
@@ -1116,18 +1100,14 @@
    som_solib_create_inferior_hook.
  */
 void
-som_solib_create_catch_unload_hook (pid, tempflag, filename, cond_string)
-     int pid;
-     int tempflag;
-     char *filename;
-     char *cond_string;
+som_solib_create_catch_unload_hook (int pid, int tempflag, char *filename,
+				    char *cond_string)
 {
   create_solib_unload_event_breakpoint ("__d_trap", tempflag, filename, cond_string);
 }
 
 int
-som_solib_have_load_event (pid)
-     int pid;
+som_solib_have_load_event (int pid)
 {
   CORE_ADDR event_kind;
 
@@ -1136,8 +1116,7 @@
 }
 
 int
-som_solib_have_unload_event (pid)
-     int pid;
+som_solib_have_unload_event (int pid)
 {
   CORE_ADDR event_kind;
 
@@ -1146,8 +1125,7 @@
 }
 
 static char *
-som_solib_library_pathname (pid)
-     int pid;
+som_solib_library_pathname (int pid)
 {
   CORE_ADDR dll_handle_address;
   CORE_ADDR dll_pathname_address;
@@ -1177,8 +1155,7 @@
 }
 
 char *
-som_solib_loaded_library_pathname (pid)
-     int pid;
+som_solib_loaded_library_pathname (int pid)
 {
   if (!som_solib_have_load_event (pid))
     error ("Must have a load event to use this query");
@@ -1187,8 +1164,7 @@
 }
 
 char *
-som_solib_unloaded_library_pathname (pid)
-     int pid;
+som_solib_unloaded_library_pathname (int pid)
 {
   if (!som_solib_have_unload_event (pid))
     error ("Must have an unload event to use this query");
@@ -1197,7 +1173,7 @@
 }
 
 static void
-som_solib_desire_dynamic_linker_symbols ()
+som_solib_desire_dynamic_linker_symbols (void)
 {
   struct objfile *objfile;
   struct unwind_table_entry *u;
@@ -1295,9 +1271,7 @@
 }
 
 int
-som_solib_in_dynamic_linker (pid, pc)
-     int pid;
-     CORE_ADDR pc;
+som_solib_in_dynamic_linker (int pid, CORE_ADDR pc)
 {
   struct unwind_table_entry *u_pc;
 
@@ -1344,8 +1318,7 @@
    ADDR isn't in any known shared library, return zero.  */
 
 CORE_ADDR
-som_solib_get_got_by_pc (addr)
-     CORE_ADDR addr;
+som_solib_get_got_by_pc (CORE_ADDR addr)
 {
   struct so_list *so_list = so_list_head;
   CORE_ADDR got_value = 0;
@@ -1370,8 +1343,7 @@
 /* this function is used in hppa_fix_call_dummy in hppa-tdep.c */
 
 CORE_ADDR
-som_solib_get_solib_by_pc (addr)
-     CORE_ADDR addr;
+som_solib_get_solib_by_pc (CORE_ADDR addr)
 {
   struct so_list *so_list = so_list_head;
 
@@ -1392,9 +1364,8 @@
 
 
 int
-som_solib_section_offsets (objfile, offsets)
-     struct objfile *objfile;
-     struct section_offsets *offsets;
+som_solib_section_offsets (struct objfile *objfile,
+			   struct section_offsets *offsets)
 {
   struct so_list *so_list = so_list_head;
 
@@ -1407,10 +1378,10 @@
 	  asection *private_section;
 
 	  /* The text offset is easy.  */
-	  ANOFFSET (offsets, SECT_OFF_TEXT (objfile))
+	  offsets->offsets[SECT_OFF_TEXT (objfile)]
 	    = (so_list->som_solib.text_addr
 	       - so_list->som_solib.text_link_addr);
-	  ANOFFSET (offsets, SECT_OFF_RODATA (objfile))
+	  offsets->offsets[SECT_OFF_RODATA (objfile)]
 	    = ANOFFSET (offsets, SECT_OFF_TEXT (objfile));
 
 	  /* We should look at presumed_dp in the SOM header, but
@@ -1420,13 +1391,13 @@
 	  if (!private_section)
 	    {
 	      warning ("Unable to find $PRIVATE$ in shared library!");
-	      ANOFFSET (offsets, SECT_OFF_DATA (objfile)) = 0;
-	      ANOFFSET (offsets, SECT_OFF_BSS (objfile)) = 0;
+	      offsets->offsets[SECT_OFF_DATA (objfile)] = 0;
+	      offsets->offsets[SECT_OFF_BSS (objfile)] = 0;
 	      return 1;
 	    }
-	  ANOFFSET (offsets, SECT_OFF_DATA (objfile))
+	  offsets->offsets[SECT_OFF_DATA (objfile)]
 	    = (so_list->som_solib.data_start - private_section->vma);
-	  ANOFFSET (offsets, SECT_OFF_BSS (objfile))
+	  offsets->offsets[SECT_OFF_BSS (objfile)]
 	    = ANOFFSET (offsets, SECT_OFF_DATA (objfile));
 	  return 1;
 	}
@@ -1438,9 +1409,7 @@
 /* Dump information about all the currently loaded shared libraries.  */
 
 static void
-som_sharedlibrary_info_command (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+som_sharedlibrary_info_command (char *ignore, int from_tty)
 {
   struct so_list *so_list = so_list_head;
 
@@ -1486,9 +1455,7 @@
 }
 
 static void
-som_solib_sharedlibrary_command (args, from_tty)
-     char *args;
-     int from_tty;
+som_solib_sharedlibrary_command (char *args, int from_tty)
 {
   dont_repeat ();
   som_solib_add (args, from_tty, (struct target_ops *) 0);
@@ -1497,8 +1464,7 @@
 
 
 char *
-som_solib_address (addr)
-     CORE_ADDR addr;
+som_solib_address (CORE_ADDR addr)
 {
   struct so_list *so = so_list_head;
 
@@ -1520,7 +1486,7 @@
 
 
 void
-som_solib_restart ()
+som_solib_restart (void)
 {
   struct so_list *sl = so_list_head;
 
@@ -1534,7 +1500,7 @@
   while (sl)
     {
       struct so_list *next_sl = sl->next;
-      free (sl);
+      xfree (sl);
       sl = next_sl;
     }
   so_list_head = NULL;
@@ -1569,7 +1535,7 @@
 
 
 void
-_initialize_som_solib ()
+_initialize_som_solib (void)
 {
   add_com ("sharedlibrary", class_files, som_solib_sharedlibrary_command,
 	   "Load shared object library symbols for files matching REGEXP.");
@@ -1604,8 +1570,7 @@
 /* Get some HPUX-specific data from a shared lib.
  */
 CORE_ADDR
-so_lib_thread_start_addr (so)
-     struct so_list *so;
+so_lib_thread_start_addr (struct so_list *so)
 {
   return so->som_solib.tsd_start_addr;
 }
diff --git a/gdb/source.c b/gdb/source.c
index f15badf..3d639b9 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -38,6 +38,8 @@
 #include "objfiles.h"
 #include "annotate.h"
 #include "gdbtypes.h"
+#include "linespec.h"
+#include "completer.h"
 #ifdef UI_OUT
 #include "ui-out.h"
 #endif
@@ -130,8 +132,7 @@
    before we need to would make things slower than necessary.  */
 
 void
-select_source_symtab (s)
-     register struct symtab *s;
+select_source_symtab (register struct symtab *s)
 {
   struct symtabs_and_lines sals;
   struct symtab_and_line sal;
@@ -155,7 +156,7 @@
     {
       sals = decode_line_spec ("main", 1);
       sal = sals.sals[0];
-      free (sals.sals);
+      xfree (sals.sals);
       current_source_symtab = sal.symtab;
       current_source_line = max (sal.line - (lines_to_list - 1), 1);
       if (current_source_symtab)
@@ -213,9 +214,7 @@
 }
 
 static void
-show_directories (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+show_directories (char *ignore, int from_tty)
 {
   puts_filtered ("Source directories searched: ");
   puts_filtered (source_path);
@@ -227,7 +226,7 @@
    may be found in a different directory now.  */
 
 void
-forget_cached_source_info ()
+forget_cached_source_info (void)
 {
   register struct symtab *s;
   register struct objfile *objfile;
@@ -251,7 +250,7 @@
 }
 
 void
-init_source_path ()
+init_source_path (void)
 {
   char buf[20];
 
@@ -263,9 +262,7 @@
 /* Add zero or more directories to the front of the source path.  */
 
 void
-directory_command (dirname, from_tty)
-     char *dirname;
-     int from_tty;
+directory_command (char *dirname, int from_tty)
 {
   dont_repeat ();
   /* FIXME, this goes to "delete dir"... */
@@ -273,7 +270,7 @@
     {
       if (from_tty && query ("Reinitialize source path to empty? "))
 	{
-	  free (source_path);
+	  xfree (source_path);
 	  init_source_path ();
 	}
     }
@@ -290,9 +287,7 @@
 /* Add zero or more directories to the front of an arbitrary path.  */
 
 void
-mod_path (dirname, which_path)
-     char *dirname;
-     char **which_path;
+mod_path (char *dirname, char **which_path)
 {
   char *old = *which_path;
   int prefix = 0;
@@ -301,7 +296,7 @@
     return;
 
   dirname = strsave (dirname);
-  make_cleanup (free, dirname);
+  make_cleanup (xfree, dirname);
 
   do
     {
@@ -381,7 +376,7 @@
 	name = concat (current_directory, SLASH_STRING, name, NULL);
       else
 	name = savestring (name, p - name);
-      make_cleanup (free, name);
+      make_cleanup (xfree, name);
 
       /* Unless it's a variable, check existence.  */
       if (name[0] != '$')
@@ -454,14 +449,14 @@
 		old[prefix] = c;
 		*which_path = concat (temp, "", &old[prefix], NULL);
 		prefix = strlen (temp);
-		free (temp);
+		xfree (temp);
 	      }
 	    else
 	      {
 		*which_path = concat (name, (old[0] ? tinybuf : old), old, NULL);
 		prefix = strlen (name);
 	      }
-	    free (old);
+	    xfree (old);
 	    old = *which_path;
 	  }
       }
@@ -472,9 +467,7 @@
 
 
 static void
-source_info (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+source_info (char *ignore, int from_tty)
 {
   register struct symtab *s = current_source_symtab;
 
@@ -519,13 +512,8 @@
 /*  >>>> This should only allow files of certain types,
    >>>>  eg executable, non-directory */
 int
-openp (path, try_cwd_first, string, mode, prot, filename_opened)
-     char *path;
-     int try_cwd_first;
-     char *string;
-     int mode;
-     int prot;
-     char **filename_opened;
+openp (char *path, int try_cwd_first, char *string, int mode, int prot,
+       char **filename_opened)
 {
   register int fd;
   register char *filename;
@@ -653,9 +641,7 @@
    Else, this functions returns 0, and FULL_PATHNAME is set to NULL.
  */
 int
-source_full_path_of (filename, full_pathname)
-     char *filename;
-     char **full_pathname;
+source_full_path_of (char *filename, char **full_pathname)
 {
   int fd;
 
@@ -675,8 +661,7 @@
    negative number for error.  */
 
 int
-open_source_file (s)
-     struct symtab *s;
+open_source_file (struct symtab *s)
 {
   char *path = source_path;
   char *p;
@@ -744,7 +729,7 @@
     {
       fullname = s->fullname;
       s->fullname = mstrsave (s->objfile->md, s->fullname);
-      free (fullname);
+      xfree (fullname);
     }
   return result;
 }
@@ -753,8 +738,7 @@
    if no symtab.  */
 
 char *
-symtab_to_filename (s)
-     struct symtab *s;
+symtab_to_filename (struct symtab *s)
 {
   int fd;
 
@@ -785,9 +769,7 @@
    All set S->nlines to the number of such lines.  */
 
 void
-find_source_lines (s, desc)
-     struct symtab *s;
-     int desc;
+find_source_lines (struct symtab *s, int desc)
 {
   struct stat st;
   register char *data, *p, *end;
@@ -848,7 +830,7 @@
     /* Use malloc, not alloca, because this may be pretty large, and we may
        run into various kinds of limits on stack size.  */
     data = (char *) xmalloc (size);
-    old_cleanups = make_cleanup (free, data);
+    old_cleanups = make_cleanup (xfree, data);
 
     /* Reassign `size' to result of read for systems where \r\n -> \n.  */
     size = myread (desc, data, size);
@@ -890,9 +872,7 @@
 #if 0				/* Currently unused */
 
 int
-source_line_charpos (s, line)
-     struct symtab *s;
-     int line;
+source_line_charpos (struct symtab *s, int line)
 {
   if (!s)
     return 0;
@@ -906,9 +886,7 @@
 /* Return the line number of character position POS in symtab S.  */
 
 int
-source_charpos_line (s, chr)
-     register struct symtab *s;
-     register int chr;
+source_charpos_line (register struct symtab *s, register int chr)
 {
   register int line = 0;
   register int *lnp;
@@ -936,9 +914,7 @@
    or to 0 if the file is not found.  */
 
 static int
-get_filename_and_charpos (s, fullname)
-     struct symtab *s;
-     char **fullname;
+get_filename_and_charpos (struct symtab *s, char **fullname)
 {
   register int desc, linenums_changed = 0;
 
@@ -969,11 +945,8 @@
    Return 1 if successful, 0 if could not find the file.  */
 
 int
-identify_source_line (s, line, mid_statement, pc)
-     struct symtab *s;
-     int line;
-     int mid_statement;
-     CORE_ADDR pc;
+identify_source_line (struct symtab *s, int line, int mid_statement,
+		      CORE_ADDR pc)
 {
   if (s->line_charpos == 0)
     get_filename_and_charpos (s, (char **) NULL);
@@ -999,11 +972,7 @@
 static void print_source_lines_base (struct symtab *s, int line, int stopline,
 				     int noerror);
 static void
-print_source_lines_base (s, line, stopline, noerror)
-     struct symtab *s;
-     int line;
-     int stopline;
-     int noerror;
+print_source_lines_base (struct symtab *s, int line, int stopline, int noerror)
 {
   register int c;
   register int desc;
@@ -1157,9 +1126,7 @@
    window otherwise it is simply printed */
 
 void
-print_source_lines (s, line, stopline, noerror)
-     struct symtab *s;
-     int line, stopline, noerror;
+print_source_lines (struct symtab *s, int line, int stopline, int noerror)
 {
 #if defined(TUI)
   if (!tui_version ||
@@ -1196,8 +1163,7 @@
    SALS provides the filenames and line numbers.  */
 
 static void
-ambiguous_line_spec (sals)
-     struct symtabs_and_lines *sals;
+ambiguous_line_spec (struct symtabs_and_lines *sals)
 {
   int i;
 
@@ -1207,9 +1173,7 @@
 }
 
 static void
-list_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+list_command (char *arg, int from_tty)
 {
   struct symtabs_and_lines sals, sals_end;
   struct symtab_and_line sal, sal_end;
@@ -1269,12 +1233,12 @@
       if (sals.nelts > 1)
 	{
 	  ambiguous_line_spec (&sals);
-	  free (sals.sals);
+	  xfree (sals.sals);
 	  return;
 	}
 
       sal = sals.sals[0];
-      free (sals.sals);
+      xfree (sals.sals);
     }
 
   /* Record whether the BEG arg is all digits.  */
@@ -1303,11 +1267,11 @@
 	  if (sals_end.nelts > 1)
 	    {
 	      ambiguous_line_spec (&sals_end);
-	      free (sals_end.sals);
+	      xfree (sals_end.sals);
 	      return;
 	    }
 	  sal_end = sals_end.sals[0];
-	  free (sals_end.sals);
+	  xfree (sals_end.sals);
 	}
     }
 
@@ -1387,9 +1351,7 @@
 /* Print info on range of pc's in a specified line.  */
 
 static void
-line_info (arg, from_tty)
-     char *arg;
-     int from_tty;
+line_info (char *arg, int from_tty)
 {
   struct symtabs_and_lines sals;
   struct symtab_and_line sal;
@@ -1480,16 +1442,14 @@
 	printf_filtered ("Line number %d is out of range for \"%s\".\n",
 			 sal.line, sal.symtab->filename);
     }
-  free (sals.sals);
+  xfree (sals.sals);
 }
 
 /* Commands to search the source file for a regexp.  */
 
 /* ARGSUSED */
 static void
-forward_search_command (regex, from_tty)
-     char *regex;
-     int from_tty;
+forward_search_command (char *regex, int from_tty)
 {
   register int c;
   register int desc;
@@ -1609,9 +1569,7 @@
 
 /* ARGSUSED */
 static void
-reverse_search_command (regex, from_tty)
-     char *regex;
-     int from_tty;
+reverse_search_command (char *regex, int from_tty)
 {
   register int c;
   register int desc;
@@ -1724,7 +1682,7 @@
 }
 
 void
-_initialize_source ()
+_initialize_source (void)
 {
   struct cmd_list_element *c;
   current_source_symtab = 0;
diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
index a9b661f..017f31a 100644
--- a/gdb/sparc-nat.c
+++ b/gdb/sparc-nat.c
@@ -50,8 +50,7 @@
    marking them as valid so we won't fetch them again.  */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   struct regs inferior_registers;
   struct fp_status inferior_fp_registers;
@@ -144,8 +143,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   struct regs inferior_registers;
   struct fp_status inferior_fp_registers;
@@ -250,13 +248,21 @@
     }
 }
 
+/* Provide registers to GDB from a core file.
+
+   CORE_REG_SECT points to an array of bytes, which are the contents
+   of a `note' from a core file which BFD thinks might contain
+   register contents.  CORE_REG_SIZE is its size.
+
+   WHICH says which register set corelow suspects this is:
+     0 --- the general-purpose register set
+     2 --- the floating-point register set
+
+   IGNORE is unused.  */
 
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR ignore;		/* reg addr, unused in this version */
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
+		      int which, CORE_ADDR ignore)
 {
 
   if (which == 0)
@@ -313,7 +319,7 @@
 }
 
 int
-kernel_u_size ()
+kernel_u_size (void)
 {
   return (sizeof (struct user));
 }
@@ -332,7 +338,7 @@
 };
 
 void
-_initialize_core_sparc ()
+_initialize_core_sparc (void)
 {
   add_core_fns (&sparc_core_fns);
 }
diff --git a/gdb/sparc-stub.c b/gdb/sparc-stub.c
index ce2aadd..1e6298a 100644
--- a/gdb/sparc-stub.c
+++ b/gdb/sparc-stub.c
@@ -269,8 +269,7 @@
 /* Convert ch from a hex digit to an int */
 
 static int
-hex(ch)
-     unsigned char ch;
+hex (unsigned char ch)
 {
   if (ch >= 'a' && ch <= 'f')
     return ch-'a'+10;
@@ -287,7 +286,7 @@
 /* scan for the sequence $<data>#<checksum>     */
 
 unsigned char *
-getpacket ()
+getpacket (void)
 {
   unsigned char *buffer = &remcomInBuffer[0];
   unsigned char checksum;
@@ -353,8 +352,7 @@
 /* send the packet in buffer.  */
 
 static void
-putpacket(buffer)
-     unsigned char *buffer;
+putpacket (unsigned char *buffer)
 {
   unsigned char checksum;
   int count;
@@ -394,11 +392,7 @@
  */
 
 static unsigned char *
-mem2hex(mem, buf, count, may_fault)
-     unsigned char *mem;
-     unsigned char *buf;
-     int count;
-     int may_fault;
+mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault)
 {
   unsigned char ch;
 
@@ -424,11 +418,7 @@
  * return a pointer to the character AFTER the last byte written */
 
 static char *
-hex2mem(buf, mem, count, may_fault)
-     unsigned char *buf;
-     unsigned char *mem;
-     int count;
-     int may_fault;
+hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
 {
   int i;
   unsigned char ch;
@@ -473,7 +463,7 @@
 /* Set up exception handlers for tracing and breakpoints */
 
 void
-set_debug_traps()
+set_debug_traps (void)
 {
   struct hard_trap_info *ht;
 
@@ -500,8 +490,7 @@
 ");
 
 static void
-set_mem_fault_trap(enable)
-     int enable;
+set_mem_fault_trap (int enable)
 {
   extern void fltr_set_mem_err();
   mem_err = 0;
@@ -515,8 +504,7 @@
 /* Convert the SPARC hardware trap type code to a unix signal number. */
 
 static int
-computeSignal(tt)
-     int tt;
+computeSignal (int tt)
 {
   struct hard_trap_info *ht;
 
@@ -564,8 +552,7 @@
 extern void breakinst();
 
 static void
-handle_exception (registers)
-     unsigned long *registers;
+handle_exception (unsigned long *registers)
 {
   int tt;			/* Trap type */
   int sigval;
@@ -779,7 +766,7 @@
    the debugger. */
 
 void
-breakpoint()
+breakpoint (void)
 {
   if (!initialized)
     return;
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 0a901b1..31d7792 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -33,15 +33,14 @@
 
 #ifdef	USE_PROC_FS
 #include <sys/procfs.h>
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
 #endif
 
 #include "gdbcore.h"
 
 #include "symfile.h" 	/* for 'entry_point_address' */
 
-/* Prototypes for supply_gregset etc. */
-#include "gregset.h"
-
 /*
  * Some local macros that have multi-arch and non-multi-arch versions:
  */
@@ -142,8 +141,7 @@
    such as sparc86x, instructions are always big-endian.  */
 
 static unsigned long
-fetch_instruction (pc)
-     CORE_ADDR pc;
+fetch_instruction (CORE_ADDR pc)
 {
   unsigned long retval;
   int i;
@@ -210,9 +208,8 @@
    set up a simulated single-step, we undo our damage.  */
 
 void
-sparc_software_single_step (ignore, insert_breakpoints_p)
-     enum target_signal ignore;	/* pid, but we don't need it */
-     int insert_breakpoints_p;
+sparc_software_single_step (enum target_signal ignore,	/* pid, but we don't need it */
+			    int insert_breakpoints_p)
 {
   branch_type br;
   CORE_ADDR pc;
@@ -286,9 +283,7 @@
    been stashed, since their exact position within the frame may vary.  */
 
 void
-sparc_init_extra_frame_info (fromleaf, fi)
-     int fromleaf;
-     struct frame_info *fi;
+sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi)
 {
   char *name;
   CORE_ADDR prologue_start, prologue_end;
@@ -344,7 +339,7 @@
          negative number if a flat frame) to the sp.  FIXME: Does not
          handle large frames which will need more than one instruction
          to adjust the sp.  */
-      insn = fetch_instruction (prologue_start, 4);
+      insn = fetch_instruction (prologue_start);
       if (X_OP (insn) == 2 && X_RD (insn) == 14 && X_OP3 (insn) == 0
 	  && X_I (insn) && X_SIMM13 (insn) < 0)
 	{
@@ -427,8 +422,7 @@
 }
 
 CORE_ADDR
-sparc_frame_chain (frame)
-     struct frame_info *frame;
+sparc_frame_chain (struct frame_info *frame)
 {
   /* Value that will cause FRAME_CHAIN_VALID to not worry about the chain
      value.  If it realy is zero, we detect it later in
@@ -437,8 +431,7 @@
 }
 
 CORE_ADDR
-sparc_extract_struct_value_address (regbuf)
-     char *regbuf;
+sparc_extract_struct_value_address (char *regbuf)
 {
   return extract_address (regbuf + REGISTER_BYTE (O0_REGNUM),
 			  REGISTER_RAW_SIZE (O0_REGNUM));
@@ -447,8 +440,7 @@
 /* Find the pc saved in frame FRAME.  */
 
 CORE_ADDR
-sparc_frame_saved_pc (frame)
-     struct frame_info *frame;
+sparc_frame_saved_pc (struct frame_info *frame)
 {
   char *buf;
   CORE_ADDR addr;
@@ -524,9 +516,7 @@
    difficulty.  */
 
 struct frame_info *
-setup_arbitrary_frame (argc, argv)
-     int argc;
-     CORE_ADDR *argv;
+setup_arbitrary_frame (int argc, CORE_ADDR *argv)
 {
   struct frame_info *frame;
 
@@ -556,11 +546,8 @@
 				   CORE_ADDR *);
 
 static CORE_ADDR
-examine_prologue (start_pc, frameless_p, fi, saved_regs)
-     CORE_ADDR start_pc;
-     int frameless_p;
-     struct frame_info *fi;
-     CORE_ADDR *saved_regs;
+examine_prologue (CORE_ADDR start_pc, int frameless_p, struct frame_info *fi,
+		  CORE_ADDR *saved_regs)
 {
   int insn;
   int dest = -1;
@@ -695,9 +682,7 @@
 }
 
 CORE_ADDR
-sparc_skip_prologue (start_pc, frameless_p)
-     CORE_ADDR start_pc;
-     int frameless_p;
+sparc_skip_prologue (CORE_ADDR start_pc, int frameless_p)
 {
   return examine_prologue (start_pc, frameless_p, NULL, NULL);
 }
@@ -709,9 +694,7 @@
    This isn't static as it's used by remote-sa.sparc.c.  */
 
 static branch_type
-isbranch (instruction, addr, target)
-     long instruction;
-     CORE_ADDR addr, *target;
+isbranch (long instruction, CORE_ADDR addr, CORE_ADDR *target)
 {
   branch_type val = not_branch;
   long int offset = 0;		/* Must be signed for sign-extend.  */
@@ -780,13 +763,9 @@
    The argument RAW_BUFFER must point to aligned memory.  */
 
 void
-sparc_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
-     char *raw_buffer;
-     int *optimized;
-     CORE_ADDR *addrp;
-     struct frame_info *frame;
-     int regnum;
-     enum lval_type *lval;
+sparc_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
+			  struct frame_info *frame, int regnum,
+			  enum lval_type *lval)
 {
   struct frame_info *frame1;
   CORE_ADDR addr;
@@ -957,7 +936,7 @@
      (DUMMY_STACK_REG_BUF_SIZE + DUMMY_REG_SAVE_OFFSET)
 
 void
-sparc_push_dummy_frame ()
+sparc_push_dummy_frame (void)
 {
   CORE_ADDR sp, old_sp;
   char *register_temp;
@@ -1068,9 +1047,7 @@
 static void sparc_frame_find_saved_regs (struct frame_info *, CORE_ADDR *);
 
 static void
-sparc_frame_find_saved_regs (fi, saved_regs_addr)
-     struct frame_info *fi;
-     CORE_ADDR *saved_regs_addr;
+sparc_frame_find_saved_regs (struct frame_info *fi, CORE_ADDR *saved_regs_addr)
 {
   register int regnum;
   CORE_ADDR frame_addr = FRAME_FP (fi);
@@ -1183,7 +1160,7 @@
 /* Definitely see tm-sparc.h for more doc of the frame format here.  */
 
 void
-sparc_pop_frame ()
+sparc_pop_frame (void)
 {
   register struct frame_info *frame = get_current_frame ();
   register CORE_ADDR pc;
@@ -1338,8 +1315,7 @@
    a fake insn, step past it.  */
 
 CORE_ADDR
-sparc_pc_adjust (pc)
-     CORE_ADDR pc;
+sparc_pc_adjust (CORE_ADDR pc)
 {
   unsigned long insn;
   char buf[4];
@@ -1366,8 +1342,7 @@
    by hand.  */
 
 CORE_ADDR
-sunos4_skip_trampoline_code (pc)
-     CORE_ADDR pc;
+sunos4_skip_trampoline_code (CORE_ADDR pc)
 {
   unsigned long insn1;
   char buf[4];
@@ -1439,8 +1414,7 @@
    register values. */
 
 void
-supply_gregset (gregsetp)
-     gdb_gregset_t *gregsetp;
+supply_gregset (gdb_gregset_t *gregsetp)
 {
   prgreg_t *regp = (prgreg_t *) gregsetp;
   int regi, offset = 0;
@@ -1561,9 +1535,7 @@
 }
 
 void
-fill_gregset (gregsetp, regno)
-     gdb_gregset_t *gregsetp;
-     int regno;
+fill_gregset (gdb_gregset_t *gregsetp, int regno)
 {
   prgreg_t *regp = (prgreg_t *) gregsetp;
   int regi, offset = 0;
@@ -1643,8 +1615,7 @@
    idea of the current floating point register values. */
 
 void
-supply_fpregset (fpregsetp)
-     gdb_fpregset_t *fpregsetp;
+supply_fpregset (gdb_fpregset_t *fpregsetp)
 {
   register int regi;
   char *from;
@@ -1682,9 +1653,7 @@
 /* This will probably need some changes for sparc64.  */
 
 void
-fill_fpregset (fpregsetp, regno)
-     gdb_fpregset_t *fpregsetp;
-     int regno;
+fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
 {
   int regi;
   char *to;
@@ -1724,8 +1693,7 @@
    This routine returns true on success */
 
 int
-get_longjmp_target (pc)
-     CORE_ADDR *pc;
+get_longjmp_target (CORE_ADDR *pc)
 {
   CORE_ADDR jb_addr;
 #define LONGJMP_TARGET_SIZE 4
@@ -1748,8 +1716,7 @@
    related to C++ mangling, it is done for C too.  */
 
 char *
-sunpro_static_transform_name (name)
-     char *name;
+sunpro_static_transform_name (char *name)
 {
   char *p;
   if (name[0] == '$')
@@ -1776,9 +1743,7 @@
 static void dump_ccreg (char *, int);
 
 static void
-dump_ccreg (reg, val)
-     char *reg;
-     int val;
+dump_ccreg (char *reg, int val)
 {
   /* page 41 */
   printf_unfiltered ("%s:%s,%s,%s,%s", reg,
@@ -1789,8 +1754,7 @@
 }
 
 static char *
-decode_asi (val)
-     int val;
+decode_asi (int val)
 {
   /* page 72 */
   switch (val)
@@ -1833,8 +1797,7 @@
 /* FIXME: Would be nice if this did some fancy things for 32 bit sparc.  */
 
 void
-sparc_print_register_hook (regno)
-     int regno;
+sparc_print_register_hook (int regno)
 {
   ULONGEST val;
 
@@ -2005,9 +1968,7 @@
 }
 
 int
-gdb_print_insn_sparc (memaddr, info)
-     bfd_vma memaddr;
-     disassemble_info *info;
+gdb_print_insn_sparc (bfd_vma memaddr, disassemble_info *info)
 {
   /* It's necessary to override mach again because print_insn messes it up. */
   info->mach = TARGET_ARCHITECTURE->mach;
@@ -2019,12 +1980,8 @@
    args are also passed in registers o0 - o5.  */
 
 CORE_ADDR
-sparc32_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     int struct_return;
-     CORE_ADDR struct_addr;
+sparc32_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+			int struct_return, CORE_ADDR struct_addr)
 {
   int i, j, oregnum;
   int accumulate_size = 0;
@@ -2092,10 +2049,7 @@
    into VALBUF.  */
 
 void
-sparc32_extract_return_value (type, regbuf, valbuf)
-     struct type *type;
-     char *regbuf;
-     char *valbuf;
+sparc32_extract_return_value (struct type *type, char *regbuf, char *valbuf)
 {
   int typelen = TYPE_LENGTH (type);
   int regsize = REGISTER_RAW_SIZE (O0_REGNUM);
@@ -2118,9 +2072,7 @@
    values are returned in register %o0.  */
 
 void
-sparc_store_return_value (type, valbuf)
-     struct type *type;
-     char *valbuf;
+sparc_store_return_value (struct type *type, char *valbuf)
 {
   int regno;
   char *buffer;
@@ -2171,12 +2123,8 @@
    has already been customized for a different function).  */
 
 void
-sparc_fix_call_dummy (dummy, pc, fun, value_type, using_gcc)
-     char *dummy;
-     CORE_ADDR pc;
-     CORE_ADDR fun;
-     struct type *value_type;
-     int using_gcc;
+sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
+		      struct type *value_type, int using_gcc)
 {
   int i;
 
@@ -2187,13 +2135,27 @@
 			   | (((fun - (pc + CALL_DUMMY_CALL_OFFSET)) >> 2)
 			      & 0x3fffffff)));
 
-  /* Comply with strange Sun cc calling convention for struct-returning
-     functions.  */
-  if (!using_gcc
-      && (TYPE_CODE (value_type) == TYPE_CODE_STRUCT
-	  || TYPE_CODE (value_type) == TYPE_CODE_UNION))
-    store_unsigned_integer (dummy + CALL_DUMMY_CALL_OFFSET + 8, 4,
-			    TYPE_LENGTH (value_type) & 0x1fff);
+  /* If the called function returns an aggregate value, fill in the UNIMP
+     instruction containing the size of the returned aggregate return value,
+     which follows the call instruction.
+     For details see the SPARC Architecture Manual Version 8, Appendix D.3.
+
+     Adjust the call_dummy_breakpoint_offset for the bp_call_dummy breakpoint
+     to the proper address in the call dummy, so that `finish' after a stop
+     in a call dummy works.
+     Tweeking current_gdbarch is not an optimal solution, but the call to
+     sparc_fix_call_dummy is immediately followed by a call to run_stack_dummy,
+     which is the only function where dummy_breakpoint_offset is actually
+     used, if it is non-zero.  */
+  if (TYPE_CODE (value_type) == TYPE_CODE_STRUCT
+       || TYPE_CODE (value_type) == TYPE_CODE_UNION)
+    {
+      store_unsigned_integer (dummy + CALL_DUMMY_CALL_OFFSET + 8, 4,
+			      TYPE_LENGTH (value_type) & 0x1fff);
+      set_gdbarch_call_dummy_breakpoint_offset (current_gdbarch, 0x30);
+    }
+  else
+    set_gdbarch_call_dummy_breakpoint_offset (current_gdbarch, 0x2c);
 
   if (!(GDB_TARGET_IS_SPARC64))
     {
@@ -2229,8 +2191,7 @@
 /* Set target byte order based on machine type. */
 
 static int
-sparc_target_architecture_hook (ap)
-     const bfd_arch_info_type *ap;
+sparc_target_architecture_hook (const bfd_arch_info_type *ap)
 {
   int i, j;
 
@@ -2260,7 +2221,7 @@
 					    struct gdbarch_list *arches);
 
 void
-_initialize_sparc_tdep ()
+_initialize_sparc_tdep (void)
 {
   /* Hook us into the gdbarch mechanism.  */
   register_gdbarch_init (bfd_arch_sparc, sparc_gdbarch_init);
@@ -2294,8 +2255,7 @@
 }
 
 void
-sparc64_write_sp (val)
-     CORE_ADDR val;
+sparc64_write_sp (CORE_ADDR val)
 {
   CORE_ADDR oldsp = read_register (SP_REGNUM);
   if (oldsp & 1)
@@ -2305,8 +2265,7 @@
 }
 
 void
-sparc64_write_fp (val)
-     CORE_ADDR val;
+sparc64_write_fp (CORE_ADDR val)
 {
   CORE_ADDR oldfp = read_register (FP_REGNUM);
   if (oldfp & 1)
@@ -2330,12 +2289,8 @@
    int and float, we will waste every other register of both types.  */
 
 CORE_ADDR
-sparc64_push_arguments (nargs, args, sp, struct_return, struct_retaddr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     int struct_return;
-     CORE_ADDR struct_retaddr;
+sparc64_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+			int struct_return, CORE_ADDR struct_retaddr)
 {
   int i, j, register_counter = 0;
   CORE_ADDR tempsp;
@@ -2449,11 +2404,8 @@
    returned in f0-f3). */
 
 void
-sp64_extract_return_value (type, regbuf, valbuf, bitoffset)
-     struct type *type;
-     char *regbuf;
-     char *valbuf;
-     int bitoffset;
+sp64_extract_return_value (struct type *type, char *regbuf, char *valbuf,
+			   int bitoffset)
 {
   int typelen = TYPE_LENGTH (type);
   int regsize = REGISTER_RAW_SIZE (O0_REGNUM);
@@ -3022,11 +2974,6 @@
   set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
   set_gdbarch_max_register_raw_size (gdbarch, 8);
   set_gdbarch_max_register_virtual_size (gdbarch, 8);
-#ifdef DO_CALL_DUMMY_ON_STACK
-  set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack);
-#else
-  set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point);
-#endif
   set_gdbarch_pop_frame (gdbarch, sparc_pop_frame);
   set_gdbarch_push_return_address (gdbarch, sparc_push_return_address);
   set_gdbarch_push_dummy_frame (gdbarch, sparc_push_dummy_frame);
@@ -3060,12 +3007,14 @@
       /* 32-bit machine types: */
 
 #ifdef SPARC32_CALL_DUMMY_ON_STACK
+      set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack);
       set_gdbarch_call_dummy_address (gdbarch, sparc_call_dummy_address);
       set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0x30);
       set_gdbarch_call_dummy_length (gdbarch, 0x38);
       set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
       set_gdbarch_call_dummy_words (gdbarch, call_dummy_32);
 #else
+      set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point);
       set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
       set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
       set_gdbarch_call_dummy_length (gdbarch, 0);
@@ -3114,6 +3063,7 @@
     default:	/* Any new machine type is likely to be 64-bit.  */
 
 #ifdef SPARC64_CALL_DUMMY_ON_STACK
+      set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack);
       set_gdbarch_call_dummy_address (gdbarch, sparc_call_dummy_address);
       set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 8 * 4);
       set_gdbarch_call_dummy_length (gdbarch, 192);
@@ -3121,6 +3071,7 @@
       set_gdbarch_call_dummy_start_offset (gdbarch, 148);
       set_gdbarch_call_dummy_words (gdbarch, call_dummy_64);
 #else
+      set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point);
       set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
       set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
       set_gdbarch_call_dummy_length (gdbarch, 0);
diff --git a/gdb/sparcl-stub.c b/gdb/sparcl-stub.c
index 111dfe7..3fcdc0a 100644
--- a/gdb/sparcl-stub.c
+++ b/gdb/sparcl-stub.c
@@ -366,8 +366,7 @@
 /* Convert ch from a hex digit to an int */
 
 static int
-hex(ch)
-     unsigned char ch;
+hex (unsigned char ch)
 {
   if (ch >= 'a' && ch <= 'f')
     return ch-'a'+10;
@@ -384,7 +383,7 @@
 /* scan for the sequence $<data>#<checksum>     */
 
 unsigned char *
-getpacket ()
+getpacket (void)
 {
   unsigned char *buffer = &remcomInBuffer[0];
   unsigned char checksum;
@@ -450,8 +449,7 @@
 /* send the packet in buffer.  */
 
 static void
-putpacket(buffer)
-     unsigned char *buffer;
+putpacket (unsigned char *buffer)
 {
   unsigned char checksum;
   int count;
@@ -491,11 +489,7 @@
  */
 
 static unsigned char *
-mem2hex(mem, buf, count, may_fault)
-     unsigned char *mem;
-     unsigned char *buf;
-     int count;
-     int may_fault;
+mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault)
 {
   unsigned char ch;
 
@@ -521,11 +515,7 @@
  * return a pointer to the character AFTER the last byte written */
 
 static char *
-hex2mem(buf, mem, count, may_fault)
-     unsigned char *buf;
-     unsigned char *mem;
-     int count;
-     int may_fault;
+hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
 {
   int i;
   unsigned char ch;
@@ -576,7 +566,7 @@
 /* Set up exception handlers for tracing and breakpoints */
 
 void
-set_debug_traps()
+set_debug_traps (void)
 {
   struct hard_trap_info *ht;
 
@@ -608,8 +598,7 @@
 ");
 
 static void
-set_mem_fault_trap(enable)
-     int enable;
+set_mem_fault_trap (int enable)
 {
   extern void fltr_set_mem_err();
   mem_err = 0;
@@ -632,7 +621,7 @@
 ");
 
 static void
-get_in_break_mode()
+get_in_break_mode (void)
 {
   extern void dummy_hw_breakpoint();
 
@@ -646,8 +635,7 @@
 /* Convert the SPARC hardware trap type code to a unix signal number. */
 
 static int
-computeSignal(tt)
-     int tt;
+computeSignal (int tt)
 {
   struct hard_trap_info *ht;
 
@@ -693,8 +681,7 @@
  */
 
 static void
-handle_exception (registers)
-     unsigned long *registers;
+handle_exception (unsigned long *registers)
 {
   int tt;			/* Trap type */
   int sigval;
@@ -947,7 +934,7 @@
    the debugger. */
 
 void
-breakpoint()
+breakpoint (void)
 {
   if (!initialized)
     return;
diff --git a/gdb/sparcl-tdep.c b/gdb/sparcl-tdep.c
index 2e9e295..6df7e70 100644
--- a/gdb/sparcl-tdep.c
+++ b/gdb/sparcl-tdep.c
@@ -91,10 +91,7 @@
 #define DDV_MASK		0x1
 
 int
-sparclite_insert_watchpoint (addr, len, type)
-     CORE_ADDR addr;
-     int len;
-     int type;
+sparclite_insert_watchpoint (CORE_ADDR addr, int len, int type)
 {
   CORE_ADDR dcr;
 
@@ -157,10 +154,7 @@
 }
 
 int
-sparclite_remove_watchpoint (addr, len, type)
-     CORE_ADDR addr;
-     int len;
-     int type;
+sparclite_remove_watchpoint (CORE_ADDR addr, int len, int type)
 {
   CORE_ADDR dcr, dda1, dda2;
 
@@ -179,9 +173,7 @@
 }
 
 int
-sparclite_insert_hw_breakpoint (addr, len)
-     CORE_ADDR addr;
-     int len;
+sparclite_insert_hw_breakpoint (CORE_ADDR addr, int len)
 {
   CORE_ADDR dcr;
 
@@ -204,9 +196,7 @@
 }
 
 int
-sparclite_remove_hw_breakpoint (addr, shadow)
-     CORE_ADDR addr;
-     int shadow;
+sparclite_remove_hw_breakpoint (CORE_ADDR addr, int shadow)
 {
   CORE_ADDR dcr, dia1, dia2;
 
@@ -225,10 +215,7 @@
 }
 
 int
-sparclite_check_watch_resources (type, cnt, ot)
-     int type;
-     int cnt;
-     int ot;
+sparclite_check_watch_resources (int type, int cnt, int ot)
 {
   /* Watchpoints not supported on simulator.  */
   if (strcmp (target_shortname, "sim") == 0)
@@ -254,7 +241,7 @@
 }
 
 CORE_ADDR
-sparclite_stopped_data_address ()
+sparclite_stopped_data_address (void)
 {
   CORE_ADDR dsr, dda1, dda2;
 
@@ -271,8 +258,7 @@
 }
 
 static serial_t
-open_tty (name)
-     char *name;
+open_tty (char *name)
 {
   serial_t desc;
 
@@ -299,9 +285,7 @@
 /* Read a single character from the remote end, masking it down to 7 bits. */
 
 static int
-readchar (desc, timeout)
-     serial_t desc;
-     int timeout;
+readchar (serial_t desc, int timeout)
 {
   int ch;
   char s[10];
@@ -327,10 +311,7 @@
 }
 
 static void
-debug_serial_write (desc, buf, len)
-     serial_t desc;
-     char *buf;
-     int len;
+debug_serial_write (serial_t desc, char *buf, int len)
 {
   char s[10];
 
@@ -348,9 +329,7 @@
 
 
 static int
-send_resp (desc, c)
-     serial_t desc;
-     char c;
+send_resp (serial_t desc, char c)
 {
   debug_serial_write (desc, &c, 1);
   return readchar (desc, remote_timeout);
@@ -369,10 +348,7 @@
 
 #ifdef HAVE_SOCKETS
 static int
-recv_udp_buf (fd, buf, len, timeout)
-     int fd, len;
-     unsigned char *buf;
-     int timeout;
+recv_udp_buf (int fd, unsigned char *buf, int len, int timeout)
 {
   int cc;
   fd_set readfds;
@@ -404,9 +380,7 @@
 }
 
 static int
-send_udp_buf (fd, buf, len)
-     int fd, len;
-     unsigned char *buf;
+send_udp_buf (int fd, unsigned char *buf, int len)
 {
   int cc;
 
@@ -423,9 +397,7 @@
 #endif /* HAVE_SOCKETS */
 
 static void
-sparclite_open (name, from_tty)
-     char *name;
-     int from_tty;
+sparclite_open (char *name, int from_tty)
 {
   struct cleanup *old_chain;
   int c;
@@ -439,7 +411,7 @@
   unpush_target (&sparclite_ops);
 
   if (remote_target_name)
-    free (remote_target_name);
+    xfree (remote_target_name);
 
   remote_target_name = strsave (name);
 
@@ -542,8 +514,7 @@
 }
 
 static void
-sparclite_close (quitting)
-     int quitting;
+sparclite_close (int quitting)
 {
   if (serial_flag)
     close_tty (0);
@@ -556,13 +527,10 @@
 #define LOAD_ADDRESS 0x40000000
 
 static void
-download (target_name, args, from_tty, write_routine, start_routine)
-     char *target_name;
-     char *args;
-     int from_tty;
-     void (*write_routine) (bfd * from_bfd, asection * from_sec,
-			    file_ptr from_addr, bfd_vma to_addr, int len);
-     void (*start_routine) (bfd_vma entry);
+download (char *target_name, char *args, int from_tty,
+	  void (*write_routine) (bfd *from_bfd, asection *from_sec,
+				 file_ptr from_addr, bfd_vma to_addr, int len),
+	  void (*start_routine) (bfd_vma entry))
 {
   struct cleanup *old_chain;
   asection *section;
@@ -708,8 +676,7 @@
 }
 
 static void
-sparclite_serial_start (entry)
-     bfd_vma entry;
+sparclite_serial_start (bfd_vma entry)
 {
   char buffer[5];
   int i;
@@ -724,12 +691,8 @@
 }
 
 static void
-sparclite_serial_write (from_bfd, from_sec, from_addr, to_addr, len)
-     bfd *from_bfd;
-     asection *from_sec;
-     file_ptr from_addr;
-     bfd_vma to_addr;
-     int len;
+sparclite_serial_write (bfd *from_bfd, asection *from_sec, file_ptr from_addr,
+			bfd_vma to_addr, int len)
 {
   char buffer[4 + 4 + WRITESIZE];	/* addr + len + data */
   unsigned char checksum;
@@ -759,9 +722,7 @@
 #ifdef HAVE_SOCKETS
 
 static unsigned short
-calc_checksum (buffer, count)
-     unsigned char *buffer;
-     int count;
+calc_checksum (unsigned char *buffer, int count)
 {
   unsigned short checksum;
 
@@ -776,8 +737,7 @@
 }
 
 static void
-sparclite_udp_start (entry)
-     bfd_vma entry;
+sparclite_udp_start (bfd_vma entry)
 {
   unsigned char buffer[6];
   int i;
@@ -797,12 +757,8 @@
 }
 
 static void
-sparclite_udp_write (from_bfd, from_sec, from_addr, to_addr, len)
-     bfd *from_bfd;
-     asection *from_sec;
-     file_ptr from_addr;
-     bfd_vma to_addr;
-     int len;
+sparclite_udp_write (bfd *from_bfd, asection *from_sec, file_ptr from_addr,
+		     bfd_vma to_addr, int len)
 {
   unsigned char buffer[2000];
   unsigned short checksum;
@@ -873,9 +829,7 @@
 #endif /* HAVE_SOCKETS */
 
 static void
-sparclite_download (filename, from_tty)
-     char *filename;
-     int from_tty;
+sparclite_download (char *filename, int from_tty)
 {
   if (!serial_flag)
 #ifdef HAVE_SOCKETS
@@ -906,7 +860,7 @@
 }
 
 void
-_initialize_sparcl_tdep ()
+_initialize_sparcl_tdep (void)
 {
   init_sparclite_ops ();
   add_target (&sparclite_ops);
diff --git a/gdb/sparclet-rom.c b/gdb/sparclet-rom.c
index ebb249c..921c6a5 100644
--- a/gdb/sparclet-rom.c
+++ b/gdb/sparclet-rom.c
@@ -97,20 +97,13 @@
    actually do anything, GDB will request the registers individually.  */
 
 static void
-sparclet_supply_register (regname, regnamelen, val, vallen)
-     char *regname;
-     int regnamelen;
-     char *val;
-     int vallen;
+sparclet_supply_register (char *regname, int regnamelen, char *val, int vallen)
 {
   return;
 }
 
 static void
-sparclet_load (desc, file, hashmark)
-     serial_t desc;
-     char *file;
-     int hashmark;
+sparclet_load (serial_t desc, char *file, int hashmark)
 {
   bfd *abfd;
   asection *s;
@@ -286,15 +279,13 @@
 };
 
 static void
-sparclet_open (args, from_tty)
-     char *args;
-     int from_tty;
+sparclet_open (char *args, int from_tty)
 {
   monitor_open (args, &sparclet_cmds, from_tty);
 }
 
 void
-_initialize_sparclet ()
+_initialize_sparclet (void)
 {
   int i;
   init_sparclet_cmds ();
diff --git a/gdb/sparclet-stub.c b/gdb/sparclet-stub.c
index 281ce14..f593df7 100644
--- a/gdb/sparclet-stub.c
+++ b/gdb/sparclet-stub.c
@@ -435,8 +435,7 @@
 /* Convert ch from a hex digit to an int */
 
 static int
-hex(ch)
-     unsigned char ch;
+hex (unsigned char ch)
 {
   if (ch >= 'a' && ch <= 'f')
     return ch-'a'+10;
@@ -453,7 +452,7 @@
 /* scan for the sequence $<data>#<checksum>     */
 
 unsigned char *
-getpacket ()
+getpacket (void)
 {
   unsigned char *buffer = &remcomInBuffer[0];
   unsigned char checksum;
@@ -519,8 +518,7 @@
 /* send the packet in buffer.  */
 
 static void
-putpacket(buffer)
-     unsigned char *buffer;
+putpacket (unsigned char *buffer)
 {
   unsigned char checksum;
   int count;
@@ -560,11 +558,7 @@
  */
 
 static unsigned char *
-mem2hex(mem, buf, count, may_fault)
-     unsigned char *mem;
-     unsigned char *buf;
-     int count;
-     int may_fault;
+mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault)
 {
   unsigned char ch;
 
@@ -590,11 +584,7 @@
  * return a pointer to the character AFTER the last byte written */
 
 static char *
-hex2mem(buf, mem, count, may_fault)
-     unsigned char *buf;
-     unsigned char *mem;
-     int count;
-     int may_fault;
+hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
 {
   int i;
   unsigned char ch;
@@ -640,7 +630,7 @@
 /* Set up exception handlers for tracing and breakpoints */
 
 void
-set_debug_traps()
+set_debug_traps (void)
 {
   struct hard_trap_info *ht;
 
@@ -667,8 +657,7 @@
 ");
 
 static void
-set_mem_fault_trap(enable)
-     int enable;
+set_mem_fault_trap (int enable)
 {
   extern void fltr_set_mem_err();
   mem_err = 0;
@@ -691,8 +680,7 @@
 ");
 
 static void
-set_hw_breakpoint_trap(enable)
-     int enable;
+set_hw_breakpoint_trap (int enable)
 {
   extern void dummy_hw_breakpoint();
 
@@ -703,7 +691,7 @@
 }
 
 static void
-get_in_break_mode()
+get_in_break_mode (void)
 {
 #if 0
   int x;
@@ -727,8 +715,7 @@
 /* Convert the SPARC hardware trap type code to a unix signal number. */
 
 static int
-computeSignal(tt)
-     int tt;
+computeSignal (int tt)
 {
   struct hard_trap_info *ht;
 
@@ -774,8 +761,7 @@
  */
 
 static void
-handle_exception (registers)
-     unsigned long *registers;
+handle_exception (unsigned long *registers)
 {
   int tt;			/* Trap type */
   int sigval;
@@ -1049,7 +1035,7 @@
    the debugger. */
 
 void
-breakpoint()
+breakpoint (void)
 {
   if (!initialized)
     return;
@@ -1061,7 +1047,7 @@
 }
 
 static void
-hw_breakpoint()
+hw_breakpoint (void)
 {
   asm("
       ta 127
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 09f02ce..ae3802b 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -275,8 +275,7 @@
 static void os9k_init_type_vector (struct type **);
 
 static void
-os9k_init_type_vector (tv)
-     struct type **tv;
+os9k_init_type_vector (struct type **tv)
 {
   unsigned int i;
   for (i = 0; i < sizeof (os9k_type_vector) / sizeof (struct type **); i++)
@@ -291,8 +290,7 @@
    or for associating a new type with the pair.  */
 
 struct type **
-dbx_lookup_type (typenums)
-     int typenums[2];
+dbx_lookup_type (int typenums[2])
 {
   register int filenum = typenums[0];
   register int index = typenums[1];
@@ -399,9 +397,7 @@
    put into the type vector, and so may not be referred to by number. */
 
 static struct type *
-dbx_alloc_type (typenums, objfile)
-     int typenums[2];
-     struct objfile *objfile;
+dbx_alloc_type (int typenums[2], struct objfile *objfile)
 {
   register struct type **type_addr;
 
@@ -427,10 +423,8 @@
    and fix their symbols in given symbol vector. */
 
 static void
-patch_block_stabs (symbols, stabs, objfile)
-     struct pending *symbols;
-     struct pending_stabs *stabs;
-     struct objfile *objfile;
+patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
+		   struct objfile *objfile)
 {
   int ii;
   char *name;
@@ -517,9 +511,7 @@
    Returns 0 for success, -1 for error.  */
 
 static int
-read_type_number (pp, typenums)
-     register char **pp;
-     register int *typenums;
+read_type_number (register char **pp, register int *typenums)
 {
   int nbits;
   if (**pp == '(')
@@ -557,9 +549,7 @@
    suibstring. */
 
 static char *
-get_substring (p, c)
-     char **p;
-     int c;
+get_substring (char **p, int c)
 {
   char *str;
   str = *p;
@@ -580,8 +570,7 @@
    eg: for sname="a" and fname="foo__1aFPFs_i" return "FPFs_i" */
 
 static char *
-get_cfront_method_physname (fname)
-     char *fname;
+get_cfront_method_physname (char *fname)
 {
   int len = 0;
   /* FIXME would like to make this generic for g++ too, but 
@@ -617,11 +606,8 @@
  */
 
 static int
-read_cfront_baseclasses (fip, pp, type, objfile)
-     struct field_info *fip;
-     struct objfile *objfile;
-     char **pp;
-     struct type *type;
+read_cfront_baseclasses (struct field_info *fip, char **pp, struct type *type,
+			 struct objfile *objfile)
 {
   static struct complaint msg_unknown =
   {"\
@@ -668,7 +654,7 @@
   for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
     {
       new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (free, new);
+      make_cleanup (xfree, new);
       memset (new, 0, sizeof (struct nextfield));
       new->next = fip->list;
       fip->list = new;
@@ -770,11 +756,8 @@
  */
 
 static int
-read_cfront_member_functions (fip, pp, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_cfront_member_functions (struct field_info *fip, char **pp,
+			      struct type *type, struct objfile *objfile)
 {
   /* This code extracted from read_member_functions 
      so as to do the similar thing for our funcs */
@@ -831,7 +814,7 @@
 
       new_fnlist = (struct next_fnfieldlist *)
 	xmalloc (sizeof (struct next_fnfieldlist));
-      make_cleanup (free, new_fnlist);
+      make_cleanup (xfree, new_fnlist);
       memset (new_fnlist, 0, sizeof (struct next_fnfieldlist));
 
       /* The following is code to work around cfront generated stabs.
@@ -874,7 +857,7 @@
 
       new_sublist =
 	(struct next_fnfield *) xmalloc (sizeof (struct next_fnfield));
-      make_cleanup (free, new_sublist);
+      make_cleanup (xfree, new_sublist);
       memset (new_sublist, 0, sizeof (struct next_fnfield));
 
       /* eat 1; from :;2A.; */
@@ -978,10 +961,8 @@
    to add information such as methods to classes.
    Examples of "p": "sA;;__ct__1AFv foo__1AFv ;;;" */
 int
-resolve_cfront_continuation (objfile, sym, p)
-     struct objfile *objfile;
-     struct symbol *sym;
-     char *p;
+resolve_cfront_continuation (struct objfile *objfile, struct symbol *sym,
+			     char *p)
 {
   struct symbol *ref_sym = 0;
   char *sname;
@@ -1050,10 +1031,7 @@
    symbol definition.  Returns 0 on failure, non-zero on success.  */
 
 static int
-resolve_symbol_reference (objfile, sym, p)
-     struct objfile *objfile;
-     struct symbol *sym;
-     char *p;
+resolve_symbol_reference (struct objfile *objfile, struct symbol *sym, char *p)
 {
   int refnum;
   struct symbol *ref_sym = 0;
@@ -1178,7 +1156,7 @@
    table. If the symbol table changes, this cache must be cleared
    or we are left holding onto data in invalid obstacks. */
 void
-stabsread_clear_cache ()
+stabsread_clear_cache (void)
 {
   ref_count = 0;
   ref_chunk = 0;
@@ -1189,11 +1167,7 @@
    find them, using their reference numbers as our index. 
    These will be used later when we resolve references. */
 void
-ref_add (refnum, sym, stabs, value)
-     int refnum;
-     struct symbol *sym;
-     char *stabs;
-     CORE_ADDR value;
+ref_add (int refnum, struct symbol *sym, char *stabs, CORE_ADDR value)
 {
   if (ref_count == 0)
     ref_chunk = 0;
@@ -1215,8 +1189,7 @@
 
 /* Return defined sym for the reference REFNUM.  */
 struct symbol *
-ref_search (refnum)
-     int refnum;
+ref_search (int refnum)
 {
   if (refnum < 0 || refnum > ref_count)
     return 0;
@@ -1226,8 +1199,7 @@
 /* Return value for the reference REFNUM.  */
 
 static CORE_ADDR
-ref_search_value (refnum)
-     int refnum;
+ref_search_value (int refnum)
 {
   if (refnum < 0 || refnum > ref_count)
     return 0;
@@ -1238,8 +1210,7 @@
    reference number.  Move STRING beyond the reference id.  */
 
 static int
-process_reference (string)
-     char **string;
+process_reference (char **string)
 {
   char *p;
   int refnum = 0;
@@ -1264,8 +1235,7 @@
    definition for later use.  Return the reference number.  */
 
 int
-symbol_reference_defined (string)
-     char **string;
+symbol_reference_defined (char **string)
 {
   char *p = *string;
   int refnum = 0;
@@ -1290,12 +1260,8 @@
 
 /* ARGSUSED */
 struct symbol *
-define_symbol (valu, string, desc, type, objfile)
-     CORE_ADDR valu;
-     char *string;
-     int desc;
-     int type;
-     struct objfile *objfile;
+define_symbol (CORE_ADDR valu, char *string, int desc, int type,
+	       struct objfile *objfile)
 {
   register struct symbol *sym;
   char *p = (char *) strchr (string, ':');
@@ -1987,6 +1953,27 @@
 
 	         Fortunately, this check seems not to be necessary
 	         for anything except pointers or functions.  */
+              /* ezannoni: 2000-10-26. This seems to apply for
+		 versions of gcc older than 2.8. This was the original
+		 problem: with the following code gdb would tell that
+		 the type for name1 is caddr_t, and func is char()
+	         typedef char *caddr_t;
+		 char *name2;
+		 struct x
+		 {
+		 char *name1;
+		 } xx;
+		 char *func()
+		 {
+		 }
+		 main () {}
+		 */
+
+	      /* Pascal accepts names for pointer types. */
+	      if (current_subfile->language == language_pascal)
+		{
+		  TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_NAME (sym);
+          	}
 	    }
 	  else
 	    TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_NAME (sym);
@@ -2189,10 +2176,7 @@
    non-zero on success, zero otherwise.  */
 
 static int
-resolve_live_range (objfile, sym, p)
-     struct objfile *objfile;
-     struct symbol *sym;
-     char *p;
+resolve_live_range (struct objfile *objfile, struct symbol *sym, char *p)
 {
   int refnum;
   CORE_ADDR start, end;
@@ -2260,10 +2244,8 @@
    in objfile OBJFILE.  */
 
 static void
-add_live_range (objfile, sym, start, end)
-     struct objfile *objfile;
-     struct symbol *sym;
-     CORE_ADDR start, end;
+add_live_range (struct objfile *objfile, struct symbol *sym, CORE_ADDR start,
+		CORE_ADDR end)
 {
   struct range_list *r, *rs;
 
@@ -2324,9 +2306,7 @@
    debugger will be able to read the new symbol tables.  */
 
 static struct type *
-error_type (pp, objfile)
-     char **pp;
-     struct objfile *objfile;
+error_type (char **pp, struct objfile *objfile)
 {
   complain (&error_type_complaint);
   while (1)
@@ -2358,9 +2338,7 @@
    deciding whether to call read_type.  */
 
 struct type *
-read_type (pp, objfile)
-     register char **pp;
-     struct objfile *objfile;
+read_type (register char **pp, struct objfile *objfile)
 {
   register struct type *type = 0;
   struct type *type1;
@@ -2790,8 +2768,7 @@
    Return the proper type node for a given builtin type number. */
 
 static struct type *
-rs6000_builtin_type (typenum)
-     int typenum;
+rs6000_builtin_type (int typenum)
 {
   /* We recognize types numbered from -NUMBER_RECOGNIZED to -1.  */
 #define NUMBER_RECOGNIZED 34
@@ -2966,11 +2943,8 @@
    Returns 1 for success, 0 for failure.  */
 
 static int
-read_member_functions (fip, pp, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_member_functions (struct field_info *fip, char **pp, struct type *type,
+		       struct objfile *objfile)
 {
   int nfn_fields = 0;
   int length = 0;
@@ -3015,7 +2989,7 @@
 
       new_fnlist = (struct next_fnfieldlist *)
 	xmalloc (sizeof (struct next_fnfieldlist));
-      make_cleanup (free, new_fnlist);
+      make_cleanup (xfree, new_fnlist);
       memset (new_fnlist, 0, sizeof (struct next_fnfieldlist));
 
       if ((*pp)[0] == 'o' && (*pp)[1] == 'p' && is_cplus_marker ((*pp)[2]))
@@ -3058,7 +3032,7 @@
 	{
 	  new_sublist =
 	    (struct next_fnfield *) xmalloc (sizeof (struct next_fnfield));
-	  make_cleanup (free, new_sublist);
+	  make_cleanup (xfree, new_sublist);
 	  memset (new_sublist, 0, sizeof (struct next_fnfield));
 
 	  /* Check for and handle cretinous dbx symbol name continuation!  */
@@ -3260,11 +3234,8 @@
    keep parsing and it's time for error_type().  */
 
 static int
-read_cpp_abbrev (fip, pp, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type,
+		 struct objfile *objfile)
 {
   register char *p;
   char *name;
@@ -3349,12 +3320,8 @@
 }
 
 static void
-read_one_struct_field (fip, pp, p, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     char *p;
-     struct type *type;
-     struct objfile *objfile;
+read_one_struct_field (struct field_info *fip, char **pp, char *p,
+		       struct type *type, struct objfile *objfile)
 {
   /* The following is code to work around cfront generated stabs.
      The stabs contains full mangled name for each field.
@@ -3520,11 +3487,8 @@
    Returns 1 for success, 0 for failure.  */
 
 static int
-read_struct_fields (fip, pp, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_struct_fields (struct field_info *fip, char **pp, struct type *type,
+		    struct objfile *objfile)
 {
   register char *p;
   struct nextfield *new;
@@ -3544,7 +3508,7 @@
       STABS_CONTINUE (pp, objfile);
       /* Get space to record the next field's data.  */
       new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (free, new);
+      make_cleanup (xfree, new);
       memset (new, 0, sizeof (struct nextfield));
       new->next = fip->list;
       fip->list = new;
@@ -3620,11 +3584,8 @@
 
 
 static int
-read_baseclasses (fip, pp, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_baseclasses (struct field_info *fip, char **pp, struct type *type,
+		  struct objfile *objfile)
 {
   int i;
   struct nextfield *new;
@@ -3667,7 +3628,7 @@
   for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
     {
       new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (free, new);
+      make_cleanup (xfree, new);
       memset (new, 0, sizeof (struct nextfield));
       new->next = fip->list;
       fip->list = new;
@@ -3750,11 +3711,8 @@
    so we can look for the vptr base class info.  */
 
 static int
-read_tilde_fields (fip, pp, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_tilde_fields (struct field_info *fip, char **pp, struct type *type,
+		   struct objfile *objfile)
 {
   register char *p;
 
@@ -3832,9 +3790,7 @@
 }
 
 static int
-attach_fn_fields_to_type (fip, type)
-     struct field_info *fip;
-     register struct type *type;
+attach_fn_fields_to_type (struct field_info *fip, register struct type *type)
 {
   register int n;
 
@@ -3858,11 +3814,8 @@
  */
 
 static int
-read_cfront_static_fields (fip, pp, type, objfile)
-     struct field_info *fip;
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_cfront_static_fields (struct field_info *fip, char **pp, struct type *type,
+			   struct objfile *objfile)
 {
   struct nextfield *new;
   struct type *stype;
@@ -3895,7 +3848,7 @@
 
       /* allocate a new fip */
       new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (free, new);
+      make_cleanup (xfree, new);
       memset (new, 0, sizeof (struct nextfield));
       new->next = fip->list;
       fip->list = new;
@@ -3944,10 +3897,8 @@
    once we have collected all the class members. */
 
 static int
-copy_cfront_struct_fields (fip, type, objfile)
-     struct field_info *fip;
-     struct type *type;
-     struct objfile *objfile;
+copy_cfront_struct_fields (struct field_info *fip, struct type *type,
+			   struct objfile *objfile)
 {
   int nfields = TYPE_NFIELDS (type);
   int i;
@@ -3960,7 +3911,7 @@
     {
       /* allocate a new fip */
       new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
-      make_cleanup (free, new);
+      make_cleanup (xfree, new);
       memset (new, 0, sizeof (struct nextfield));
       new->next = fip->list;
       fip->list = new;
@@ -3991,10 +3942,8 @@
    for this class's virtual functions.  */
 
 static int
-attach_fields_to_type (fip, type, objfile)
-     struct field_info *fip;
-     register struct type *type;
-     struct objfile *objfile;
+attach_fields_to_type (struct field_info *fip, register struct type *type,
+		       struct objfile *objfile)
 {
   register int nfields = 0;
   register int non_public_fields = 0;
@@ -4094,10 +4043,7 @@
  */
 
 static struct type *
-read_struct_type (pp, type, objfile)
-     char **pp;
-     struct type *type;
-     struct objfile *objfile;
+read_struct_type (char **pp, struct type *type, struct objfile *objfile)
 {
   struct cleanup *back_to;
   struct field_info fi;
@@ -4144,10 +4090,8 @@
    array.  */
 
 static struct type *
-read_array_type (pp, type, objfile)
-     register char **pp;
-     register struct type *type;
-     struct objfile *objfile;
+read_array_type (register char **pp, register struct type *type,
+		 struct objfile *objfile)
 {
   struct type *index_type, *element_type, *range_type;
   int lower, upper;
@@ -4211,10 +4155,8 @@
    Also defines the symbols that represent the values of the type.  */
 
 static struct type *
-read_enum_type (pp, type, objfile)
-     register char **pp;
-     register struct type *type;
-     struct objfile *objfile;
+read_enum_type (register char **pp, register struct type *type,
+		struct objfile *objfile)
 {
   register char *p;
   char *name;
@@ -4346,10 +4288,7 @@
    FIXME.  */
 
 static struct type *
-read_sun_builtin_type (pp, typenums, objfile)
-     char **pp;
-     int typenums[2];
-     struct objfile *objfile;
+read_sun_builtin_type (char **pp, int typenums[2], struct objfile *objfile)
 {
   int type_bits;
   int nbits;
@@ -4421,10 +4360,7 @@
 }
 
 static struct type *
-read_sun_floating_type (pp, typenums, objfile)
-     char **pp;
-     int typenums[2];
-     struct objfile *objfile;
+read_sun_floating_type (char **pp, int typenums[2], struct objfile *objfile)
 {
   int nbits;
   int details;
@@ -4463,10 +4399,7 @@
    If encounter garbage, set *BITS to -1 and return 0.  */
 
 static long
-read_huge_number (pp, end, bits)
-     char **pp;
-     int end;
-     int *bits;
+read_huge_number (char **pp, int end, int *bits)
 {
   char *p = *pp;
   int sign = 1;
@@ -4568,10 +4501,7 @@
 }
 
 static struct type *
-read_range_type (pp, typenums, objfile)
-     char **pp;
-     int typenums[2];
-     struct objfile *objfile;
+read_range_type (char **pp, int typenums[2], struct objfile *objfile)
 {
   char *orig_pp = *pp;
   int rangenums[2];
@@ -4663,14 +4593,18 @@
 
   if (n3 == 0 && n2 > 0)
     {
+      struct type *float_type
+	= init_type (TYPE_CODE_FLT, n2, 0, NULL, objfile);
+
       if (self_subrange)
 	{
-	  return init_type (TYPE_CODE_COMPLEX, 2 * n2, 0, NULL, objfile);
+	  struct type *complex_type = 
+	    init_type (TYPE_CODE_COMPLEX, 2 * n2, 0, NULL, objfile);
+	  TYPE_TARGET_TYPE (complex_type) = float_type;
+	  return complex_type;
 	}
       else
-	{
-	  return init_type (TYPE_CODE_FLT, n2, 0, NULL, objfile);
-	}
+	return float_type;
     }
 
   /* If the upper bound is -1, it must really be an unsigned int.  */
@@ -4770,10 +4704,7 @@
    **)-1 if there is an error.  */
 
 static struct type **
-read_args (pp, end, objfile)
-     char **pp;
-     int end;
-     struct objfile *objfile;
+read_args (char **pp, int end, struct objfile *objfile)
 {
   /* FIXME!  Remove this arbitrary limit!  */
   struct type *types[1024], **rval;	/* allow for fns of 1023 parameters */
@@ -4827,9 +4758,7 @@
    to remain after this function returns.  */
 
 void
-common_block_start (name, objfile)
-     char *name;
-     struct objfile *objfile;
+common_block_start (char *name, struct objfile *objfile)
 {
   if (common_block_name != NULL)
     {
@@ -4848,8 +4777,7 @@
 /* Process a N_ECOMM symbol.  */
 
 void
-common_block_end (objfile)
-     struct objfile *objfile;
+common_block_end (struct objfile *objfile)
 {
   /* Symbols declared since the BCOMM are to have the common block
      start address added in when we know it.  common_block and
@@ -4912,9 +4840,7 @@
    the common block name).  */
 
 static void
-fix_common_block (sym, valu)
-     struct symbol *sym;
-     int valu;
+fix_common_block (struct symbol *sym, int valu)
 {
   struct pending *next = (struct pending *) SYMBOL_TYPE (sym);
   for (; next; next = next->next)
@@ -4933,8 +4859,7 @@
    once this file has been read in.  */
 
 void
-add_undefined_type (type)
-     struct type *type;
+add_undefined_type (struct type *type)
 {
   if (undef_types_length == undef_types_allocated)
     {
@@ -4956,7 +4881,7 @@
    yet defined at the time a pointer to it was made.
    Fix:  Do a full lookup on the struct/union tag.  */
 void
-cleanup_undefined_types ()
+cleanup_undefined_types (void)
 {
   struct type **type;
 
@@ -5027,8 +4952,7 @@
    to.  Get these symbols from the minimal symbol table.  */
 
 void
-scan_file_globals (objfile)
-     struct objfile *objfile;
+scan_file_globals (struct objfile *objfile)
 {
   int hash;
   struct minimal_symbol *msymbol;
@@ -5186,7 +5110,7 @@
    to a psymtab.  */
 
 void
-stabsread_init ()
+stabsread_init (void)
 {
 }
 
@@ -5195,7 +5119,7 @@
    file, e.g. a shared library).  */
 
 void
-stabsread_new_init ()
+stabsread_new_init (void)
 {
   /* Empty the hash table of global syms looking for values.  */
   memset (global_sym_chain, 0, sizeof (global_sym_chain));
@@ -5205,7 +5129,7 @@
    start_symtab() is called. */
 
 void
-start_stabs ()
+start_stabs (void)
 {
   global_stabs = NULL;		/* AIX COFF */
   /* Leave FILENUM of 0 free for builtin types and this file's types.  */
@@ -5222,11 +5146,11 @@
 /* Call after end_symtab() */
 
 void
-end_stabs ()
+end_stabs (void)
 {
   if (type_vector)
     {
-      free ((char *) type_vector);
+      xfree (type_vector);
     }
   type_vector = 0;
   type_vector_length = 0;
@@ -5234,13 +5158,12 @@
 }
 
 void
-finish_global_stabs (objfile)
-     struct objfile *objfile;
+finish_global_stabs (struct objfile *objfile)
 {
   if (global_stabs)
     {
       patch_block_stabs (global_symbols, global_stabs, objfile);
-      free ((PTR) global_stabs);
+      xfree (global_stabs);
       global_stabs = NULL;
     }
 }
@@ -5248,7 +5171,7 @@
 /* Initializer for this module */
 
 void
-_initialize_stabsread ()
+_initialize_stabsread (void)
 {
   undef_types_allocated = 20;
   undef_types_length = 0;
diff --git a/gdb/stabsread.h b/gdb/stabsread.h
index 6ae3d8b..8cbee75 100644
--- a/gdb/stabsread.h
+++ b/gdb/stabsread.h
@@ -30,12 +30,6 @@
 #define	EXTERN extern
 #endif
 
-/* Convert stab register number (from `r' declaration) to a gdb REGNUM.  */
-
-#ifndef STAB_REG_TO_REGNUM
-#define STAB_REG_TO_REGNUM(VALUE) (VALUE)
-#endif
-
 /* Hash table of global symbols whose values are not known yet.
    They are chained thru the SYMBOL_VALUE_CHAIN, since we don't
    have the correct data for that slot yet.
diff --git a/gdb/stack.c b/gdb/stack.c
index acd16b4..85f37d8 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -146,8 +146,7 @@
    Pass the args the way catch_errors wants them.  */
 static int show_and_print_stack_frame_stub (void *args);
 static int
-show_and_print_stack_frame_stub (args)
-     void *args;
+show_and_print_stack_frame_stub (void *args)
 {
   struct print_stack_frame_args *p = (struct print_stack_frame_args *) args;
 
@@ -165,8 +164,7 @@
    Pass the args the way catch_errors wants them.  */
 static int print_stack_frame_stub (void *args);
 static int
-print_stack_frame_stub (args)
-     void *args;
+print_stack_frame_stub (void *args)
 {
   struct print_stack_frame_args *p = (struct print_stack_frame_args *) args;
 
@@ -183,8 +181,7 @@
 
 /* Pass the args the way catch_errors wants them.  */
 static int
-print_stack_frame_base_stub (args)
-     char *args;
+print_stack_frame_base_stub (char *args)
 {
   struct print_stack_frame_args *p = (struct print_stack_frame_args *) args;
 
@@ -196,8 +193,7 @@
    Pass the args the way catch_errors wants them.  */
 static int print_only_stack_frame_stub (void *);
 static int
-print_only_stack_frame_stub (args)
-     void *args;
+print_only_stack_frame_stub (void *args)
 {
   struct print_stack_frame_args *p = (struct print_stack_frame_args *) args;
 
@@ -216,10 +212,7 @@
    If SOURCE is -1, print ONLY the source line.  */
 
 static void
-print_stack_frame_base (fi, level, source)
-     struct frame_info *fi;
-     int level;
-     int source;
+print_stack_frame_base (struct frame_info *fi, int level, int source)
 {
   struct print_stack_frame_args args;
 
@@ -242,10 +235,7 @@
    If SOURCE is -1, print ONLY the source line.  */
 
 void
-show_and_print_stack_frame (fi, level, source)
-     struct frame_info *fi;
-     int level;
-     int source;
+show_and_print_stack_frame (struct frame_info *fi, int level, int source)
 {
   struct print_stack_frame_args args;
 
@@ -269,10 +259,7 @@
    If SOURCE is -1, print ONLY the source line.  */
 
 void
-print_stack_frame (fi, level, source)
-     struct frame_info *fi;
-     int level;
-     int source;
+print_stack_frame (struct frame_info *fi, int level, int source)
 {
   struct print_stack_frame_args args;
 
@@ -295,10 +282,7 @@
    If SOURCE is -1, print ONLY the source line.  */
 
 void
-print_only_stack_frame (fi, level, source)
-     struct frame_info *fi;
-     int level;
-     int source;
+print_only_stack_frame (struct frame_info *fi, int level, int source)
 {
   struct print_stack_frame_args args;
 
@@ -322,8 +306,7 @@
 /* Pass the args the way catch_errors wants them.  */
 
 static int
-print_args_stub (args)
-     PTR args;
+print_args_stub (PTR args)
 {
   int numargs;
   struct print_args_args *p = (struct print_args_args *) args;
@@ -344,11 +327,7 @@
    LOC_AND_SRC: Print location and source line.  */
 
 static void
-print_frame_info_base (fi, level, source, args)
-     struct frame_info *fi;
-     int level;
-     int source;
-     int args;
+print_frame_info_base (struct frame_info *fi, int level, int source, int args)
 {
   struct symtab_and_line sal;
   int source_print;
@@ -693,7 +672,7 @@
 
 #if 0
 void
-stack_publish_stopped_with_no_frame ()
+stack_publish_stopped_with_no_frame (void)
 {
   TUIDO (((TuiOpaqueFuncPtr) tuiUpdateOnEnd));
 
@@ -704,11 +683,8 @@
 /* Show or print the frame info.  If this is the tui, it will be shown in 
    the source display */
 void
-print_frame_info (fi, level, source, args)
-     struct frame_info *fi;
-     register int level;
-     int source;
-     int args;
+print_frame_info (struct frame_info *fi, register int level, int source,
+		  int args)
 {
   if (!tui_version)
     print_frame_info_base (fi, level, source, args);
@@ -726,8 +702,7 @@
 /* Show the frame info.  If this is the tui, it will be shown in 
    the source display otherwise, nothing is done */
 void
-show_stack_frame (fi)
-     struct frame_info *fi;
+show_stack_frame (struct frame_info *fi)
 {
   TUIDO (((TuiOpaqueFuncPtr) tui_vShowFrameInfo, fi));
 }
@@ -738,8 +713,7 @@
    this function never returns NULL).  */
 
 struct frame_info *
-parse_frame_specification (frame_exp)
-     char *frame_exp;
+parse_frame_specification (char *frame_exp)
 {
   int numargs = 0;
 #define	MAXARGS	4
@@ -763,7 +737,7 @@
 	  addr_string = savestring (frame_exp, p - frame_exp);
 
 	  {
-	    tmp_cleanup = make_cleanup (free, addr_string);
+	    tmp_cleanup = make_cleanup (xfree, addr_string);
 	    args[numargs++] = parse_and_eval_address (addr_string);
 	    do_cleanups (tmp_cleanup);
 	  }
@@ -855,9 +829,7 @@
    This means absolutely all information in the frame is printed.  */
 
 static void
-frame_info (addr_exp, from_tty)
-     char *addr_exp;
-     int from_tty;
+frame_info (char *addr_exp, int from_tty)
 {
   struct frame_info *fi;
   struct symtab_and_line sal;
@@ -1064,11 +1036,9 @@
 static int backtrace_limit;
 
 static void
-set_backtrace_limit_command (count_exp, from_tty)
-     char *count_exp;
-     int from_tty;
+set_backtrace_limit_command (char *count_exp, int from_tty)
 {
-  int count = parse_and_eval_address (count_exp);
+  int count = parse_and_eval_long (count_exp);
 
   if (count < 0)
     error ("Negative argument not meaningful as backtrace limit.");
@@ -1077,9 +1047,7 @@
 }
 
 static void
-backtrace_limit_info (arg, from_tty)
-     char *arg;
-     int from_tty;
+backtrace_limit_info (char *arg, int from_tty)
 {
   if (arg)
     error ("\"Info backtrace-limit\" takes no arguments.");
@@ -1093,10 +1061,7 @@
 static void backtrace_command_1 (char *count_exp, int show_locals,
 				 int from_tty);
 static void
-backtrace_command_1 (count_exp, show_locals, from_tty)
-     char *count_exp;
-     int show_locals;
-     int from_tty;
+backtrace_command_1 (char *count_exp, int show_locals, int from_tty)
 {
   struct frame_info *fi;
   register int count;
@@ -1121,7 +1086,7 @@
   trailing_level = 0;
   if (count_exp)
     {
-      count = parse_and_eval_address (count_exp);
+      count = parse_and_eval_long (count_exp);
       if (count < 0)
 	{
 	  struct frame_info *current;
@@ -1193,9 +1158,7 @@
 }
 
 static void
-backtrace_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+backtrace_command (char *arg, int from_tty)
 {
   struct cleanup *old_chain = (struct cleanup *) NULL;
   char **argv = (char **) NULL;
@@ -1253,7 +1216,7 @@
   backtrace_command_1 (argPtr, (argIndicatingFullTrace >= 0), from_tty);
 
   if (argIndicatingFullTrace >= 0 && totArgLen > 0)
-    free (argPtr);
+    xfree (argPtr);
 
   if (old_chain)
     do_cleanups (old_chain);
@@ -1261,9 +1224,7 @@
 
 static void backtrace_full_command (char *arg, int from_tty);
 static void
-backtrace_full_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+backtrace_full_command (char *arg, int from_tty)
 {
   backtrace_command_1 (arg, 1, from_tty);
 }
@@ -1273,11 +1234,8 @@
    Return 1 if any variables were printed; 0 otherwise.  */
 
 static int
-print_block_frame_locals (b, fi, num_tabs, stream)
-     struct block *b;
-     register struct frame_info *fi;
-     int num_tabs;
-     register struct ui_file *stream;
+print_block_frame_locals (struct block *b, register struct frame_info *fi,
+			  int num_tabs, register struct ui_file *stream)
 {
   int nsyms;
   register int i, j;
@@ -1315,10 +1273,8 @@
 /* Same, but print labels.  */
 
 static int
-print_block_frame_labels (b, have_default, stream)
-     struct block *b;
-     int *have_default;
-     register struct ui_file *stream;
+print_block_frame_labels (struct block *b, int *have_default,
+			  register struct ui_file *stream)
 {
   int nsyms;
   register int i;
@@ -1363,10 +1319,8 @@
    on the function running in FRAME.  */
 
 static void
-print_frame_local_vars (fi, num_tabs, stream)
-     register struct frame_info *fi;
-     register int num_tabs;
-     register struct ui_file *stream;
+print_frame_local_vars (register struct frame_info *fi, register int num_tabs,
+			register struct ui_file *stream)
 {
   register struct block *block = get_frame_block (fi);
   register int values_printed = 0;
@@ -1398,10 +1352,8 @@
 /* Same, but print labels.  */
 
 static void
-print_frame_label_vars (fi, this_level_only, stream)
-     register struct frame_info *fi;
-     int this_level_only;
-     register struct ui_file *stream;
+print_frame_label_vars (register struct frame_info *fi, int this_level_only,
+			register struct ui_file *stream)
 {
   register struct blockvector *bl;
   register struct block *block = get_frame_block (fi);
@@ -1469,9 +1421,7 @@
 
 /* ARGSUSED */
 void
-locals_info (args, from_tty)
-     char *args;
-     int from_tty;
+locals_info (char *args, int from_tty)
 {
   if (!selected_frame)
     error ("No frame selected.");
@@ -1479,9 +1429,7 @@
 }
 
 static void
-catch_info (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+catch_info (char *ignore, int from_tty)
 {
   struct symtab_and_line *sal;
 
@@ -1509,9 +1457,8 @@
 }
 
 static void
-print_frame_arg_vars (fi, stream)
-     register struct frame_info *fi;
-     register struct ui_file *stream;
+print_frame_arg_vars (register struct frame_info *fi,
+		      register struct ui_file *stream)
 {
   struct symbol *func = get_frame_function (fi);
   register struct block *b;
@@ -1574,9 +1521,7 @@
 }
 
 void
-args_info (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+args_info (char *ignore, int from_tty)
 {
   if (!selected_frame)
     error ("No frame selected.");
@@ -1585,9 +1530,7 @@
 
 
 static void
-args_plus_locals_info (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+args_plus_locals_info (char *ignore, int from_tty)
 {
   args_info (ignore, from_tty);
   locals_info (ignore, from_tty);
@@ -1598,9 +1541,7 @@
    LEVEL may be -1 if an actual level number is not known.  */
 
 void
-select_frame (fi, level)
-     struct frame_info *fi;
-     int level;
+select_frame (struct frame_info *fi, int level)
 {
   register struct symtab *s;
 
@@ -1636,9 +1577,7 @@
 /* Select frame FI, noting that its stack level is LEVEL.  Also print
    the stack frame and show the source if this is the tui version.  */
 void
-select_and_print_frame (fi, level)
-     struct frame_info *fi;
-     int level;
+select_and_print_frame (struct frame_info *fi, int level)
 {
   select_frame (fi, level);
   if (fi)
@@ -1653,9 +1592,7 @@
    not the TUI */
 #if 0
 void
-select_and_maybe_print_frame (fi, level)
-     struct frame_info *fi;
-     int level;
+select_and_maybe_print_frame (struct frame_info *fi, int level)
 {
   if (!tui_version)
     select_frame (fi, level);
@@ -1669,9 +1606,7 @@
    If there is no selected frame, *FRAMEP is set to NULL.  */
 
 void
-record_selected_frame (frameaddrp, levelp)
-     CORE_ADDR *frameaddrp;
-     int *levelp;
+record_selected_frame (CORE_ADDR *frameaddrp, int *levelp)
 {
   *frameaddrp = selected_frame ? selected_frame->frame : 0;
   *levelp = selected_frame_level;
@@ -1681,7 +1616,7 @@
    Can return zero under various legitimate circumstances.  */
 
 struct block *
-get_selected_block ()
+get_selected_block (void)
 {
   if (!target_has_stack)
     return 0;
@@ -1701,9 +1636,8 @@
    how much farther the original request asked to go.  */
 
 struct frame_info *
-find_relative_frame (frame, level_offset_ptr)
-     register struct frame_info *frame;
-     register int *level_offset_ptr;
+find_relative_frame (register struct frame_info *frame,
+		     register int *level_offset_ptr)
 {
   register struct frame_info *prev;
   register struct frame_info *frame1;
@@ -1742,17 +1676,13 @@
 /* ARGSUSED */
 #ifdef UI_OUT
 void
-select_frame_command_wrapper (level_exp, from_tty)
-     char *level_exp;
-     int from_tty;
+select_frame_command_wrapper (char *level_exp, int from_tty)
 {
   select_frame_command (level_exp, from_tty);
 }
 #endif
 static void
-select_frame_command (level_exp, from_tty)
-     char *level_exp;
-     int from_tty;
+select_frame_command (char *level_exp, int from_tty)
 {
   register struct frame_info *frame, *frame1;
   unsigned int level = 0;
@@ -1784,9 +1714,7 @@
    frame.  */
 
 void
-frame_command (level_exp, from_tty)
-     char *level_exp;
-     int from_tty;
+frame_command (char *level_exp, int from_tty)
 {
   select_frame_command (level_exp, from_tty);
   show_and_print_stack_frame (selected_frame, selected_frame_level, 1);
@@ -1795,9 +1723,7 @@
 /* The XDB Compatibility command to print the current frame. */
 
 static void
-current_frame_command (level_exp, from_tty)
-     char *level_exp;
-     int from_tty;
+current_frame_command (char *level_exp, int from_tty)
 {
   if (target_has_stack == 0 || selected_frame == 0)
     error ("No stack.");
@@ -1809,13 +1735,12 @@
 
 /* ARGSUSED */
 static void
-up_silently_base (count_exp)
-     char *count_exp;
+up_silently_base (char *count_exp)
 {
   register struct frame_info *fi;
   int count = 1, count1;
   if (count_exp)
-    count = parse_and_eval_address (count_exp);
+    count = parse_and_eval_long (count_exp);
   count1 = count;
 
   if (target_has_stack == 0 || selected_frame == 0)
@@ -1828,9 +1753,7 @@
 }
 
 static void
-up_silently_command (count_exp, from_tty)
-     char *count_exp;
-     int from_tty;
+up_silently_command (char *count_exp, int from_tty)
 {
   up_silently_base (count_exp);
   if (tui_version)
@@ -1838,9 +1761,7 @@
 }
 
 static void
-up_command (count_exp, from_tty)
-     char *count_exp;
-     int from_tty;
+up_command (char *count_exp, int from_tty)
 {
   up_silently_base (count_exp);
   show_and_print_stack_frame (selected_frame, selected_frame_level, 1);
@@ -1851,13 +1772,12 @@
 
 /* ARGSUSED */
 static void
-down_silently_base (count_exp)
-     char *count_exp;
+down_silently_base (char *count_exp)
 {
   register struct frame_info *frame;
   int count = -1, count1;
   if (count_exp)
-    count = -parse_and_eval_address (count_exp);
+    count = -parse_and_eval_long (count_exp);
   count1 = count;
 
   if (target_has_stack == 0 || selected_frame == 0)
@@ -1880,9 +1800,7 @@
 
 /* ARGSUSED */
 static void
-down_silently_command (count_exp, from_tty)
-     char *count_exp;
-     int from_tty;
+down_silently_command (char *count_exp, int from_tty)
 {
   down_silently_base (count_exp);
   if (tui_version)
@@ -1890,9 +1808,7 @@
 }
 
 static void
-down_command (count_exp, from_tty)
-     char *count_exp;
-     int from_tty;
+down_command (char *count_exp, int from_tty)
 {
   down_silently_base (count_exp);
   show_and_print_stack_frame (selected_frame, selected_frame_level, 1);
@@ -1900,17 +1816,13 @@
 
 #ifdef UI_OUT
 void
-return_command_wrapper (retval_exp, from_tty)
-     char *retval_exp;
-     int from_tty;
+return_command_wrapper (char *retval_exp, int from_tty)
 {
   return_command (retval_exp, from_tty);
 }
 #endif
 static void
-return_command (retval_exp, from_tty)
-     char *retval_exp;
-     int from_tty;
+return_command (char *retval_exp, int from_tty)
 {
   struct symbol *thisfun;
   CORE_ADDR selected_frame_addr;
@@ -1980,6 +1892,12 @@
   if (retval_exp)
     set_return_value (return_value);
 
+  /* If we are at the end of a call dummy now, pop the dummy frame too.  */
+
+  if (CALL_DUMMY_HAS_COMPLETED (read_pc(), read_sp (),
+				FRAME_FP (get_current_frame ())))
+    POP_FRAME;
+
   /* If interactive, print the frame that is now current.  */
 
   if (from_tty)
@@ -1998,9 +1916,7 @@
 
 static void func_command (char *arg, int from_tty);
 static void
-func_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+func_command (char *arg, int from_tty)
 {
   struct frame_info *fp;
   int found = 0;
@@ -2043,7 +1959,7 @@
   while (!found && level == 0);
 
   if (func_bounds)
-    free (func_bounds);
+    xfree (func_bounds);
 
   if (!found)
     printf_filtered ("'%s' not within current stack frame.\n", arg);
@@ -2054,7 +1970,7 @@
 /* Gets the language of the current frame.  */
 
 enum language
-get_frame_language ()
+get_frame_language (void)
 {
   register struct symtab *s;
   enum language flang;		/* The language of the current frame */
@@ -2074,7 +1990,7 @@
 }
 
 void
-_initialize_stack ()
+_initialize_stack (void)
 {
 #if 0
   backtrace_limit = 30;
diff --git a/gdb/standalone.c b/gdb/standalone.c
index ebb14d9..1aa76d5 100644
--- a/gdb/standalone.c
+++ b/gdb/standalone.c
@@ -39,7 +39,7 @@
 
 /* Random system calls, mostly no-ops to prevent link problems  */
 
-ioctl (desc, code, arg)
+ioctl (int desc, int code, int arg)
 {
 }
 
@@ -47,27 +47,25 @@
 {
 }
 
-kill ()
+kill (void)
 {
 }
 
-getpid ()
+getpid (void)
 {
   return 0;
 }
 
-sigsetmask ()
+sigsetmask (void)
 {
 }
 
-chdir ()
+chdir (void)
 {
 }
 
 char *
-getcwd (buf, len)
-     char *buf;
-     unsigned int len;
+getcwd (char *buf, unsigned int len)
 {
   buf[0] = '/';
   buf[1] = 0;
@@ -76,12 +74,12 @@
 
 /* Used to check for existence of .gdbinit.  Say no.  */
 
-access ()
+access (void)
 {
   return -1;
 }
 
-exit ()
+exit (void)
 {
   error ("Fatal error; restarting.");
 }
@@ -129,9 +127,7 @@
 
 int sourcedesc;
 
-open (filename, modes)
-     char *filename;
-     int modes;
+open (char *filename, int modes)
 {
   register char *next;
 
@@ -162,8 +158,7 @@
   return 0;
 }
 
-close (desc)
-     int desc;
+close (int desc)
 {
   sourceptr = 0;
   sourcedesc++;
@@ -173,28 +168,23 @@
 }
 
 FILE *
-fopen (filename, modes)
-     char *filename;
-     char *modes;
+fopen (char *filename, char *modes)
 {
   return (FILE *) open (filename, *modes == 'w');
 }
 
 FILE *
-fdopen (desc)
-     int desc;
+fdopen (int desc)
 {
   return (FILE *) desc;
 }
 
-fclose (desc)
-     int desc;
+fclose (int desc)
 {
   close (desc);
 }
 
-fstat (desc, statbuf)
-     struct stat *statbuf;
+fstat (int desc, struct stat *statbuf)
 {
   if (desc != sourcedesc)
     {
@@ -204,11 +194,7 @@
   statbuf->st_size = sourcesize;
 }
 
-myread (desc, destptr, size, filename)
-     int desc;
-     char *destptr;
-     int size;
-     char *filename;
+myread (int desc, char *destptr, int size, char *filename)
 {
   int len = min (sourceleft, size);
 
@@ -224,7 +210,7 @@
 }
 
 int
-fread (bufp, numelts, eltsize, stream)
+fread (int bufp, int numelts, int eltsize, int stream)
 {
   register int elts = min (numelts, sourceleft / eltsize);
   register int len = elts * eltsize;
@@ -241,8 +227,7 @@
 }
 
 int
-fgetc (desc)
-     int desc;
+fgetc (int desc)
 {
 
   if (desc == (int) stdin)
@@ -259,9 +244,7 @@
   return *sourceptr++;
 }
 
-lseek (desc, pos)
-     int desc;
-     int pos;
+lseek (int desc, int pos)
 {
 
   if (desc != sourcedesc)
@@ -283,30 +266,29 @@
 /* Output in kdb can go only to the terminal, so the stream
    specified may be ignored.  */
 
-printf (a1, a2, a3, a4, a5, a6, a7, a8, a9)
+printf (int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9)
 {
   char buffer[1024];
   sprintf (buffer, a1, a2, a3, a4, a5, a6, a7, a8, a9);
   display_string (buffer);
 }
 
-fprintf (ign, a1, a2, a3, a4, a5, a6, a7, a8, a9)
+fprintf (int ign, int a1, int a2, int a3, int a4, int a5, int a6, int a7,
+	 int a8, int a9)
 {
   char buffer[1024];
   sprintf (buffer, a1, a2, a3, a4, a5, a6, a7, a8, a9);
   display_string (buffer);
 }
 
-fwrite (buf, numelts, size, stream)
-     register char *buf;
-     int numelts, size;
+fwrite (register char *buf, int numelts, int size, int stream)
 {
   register int i = numelts * size;
   while (i-- > 0)
     fputc (*buf++, stream);
 }
 
-fputc (c, ign)
+fputc (int c, int ign)
 {
   char buf[2];
   buf[0] = c;
@@ -318,28 +300,27 @@
    library would cause fflush to be loaded from it too.
    In fact there should be no need to call this (I hope).  */
 
-_flsbuf ()
+_flsbuf (void)
 {
   error ("_flsbuf was actually called.");
 }
 
-fflush (ign)
+fflush (int ign)
 {
 }
 
 /* Entries into core and inflow, needed only to make things link ok.  */
 
-exec_file_command ()
+exec_file_command (void)
 {
 }
 
-core_file_command ()
+core_file_command (void)
 {
 }
 
 char *
-get_exec_file (err)
-     int err;
+get_exec_file (int err)
 {
   /* Makes one printout look reasonable; value does not matter otherwise.  */
   return "run";
@@ -347,50 +328,44 @@
 
 /* Nonzero if there is a core file.  */
 
-have_core_file_p ()
+have_core_file_p (void)
 {
   return 0;
 }
 
-kill_command ()
+kill_command (void)
 {
   inferior_pid = 0;
 }
 
-terminal_inferior ()
+terminal_inferior (void)
 {
 }
 
-terminal_ours ()
+terminal_ours (void)
 {
 }
 
-terminal_init_inferior ()
+terminal_init_inferior (void)
 {
 }
 
-write_inferior_register ()
+write_inferior_register (void)
 {
 }
 
-read_inferior_register ()
+read_inferior_register (void)
 {
 }
 
-read_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+read_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   memcpy (myaddr, memaddr, len);
 }
 
 /* Always return 0 indicating success.  */
 
-write_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+write_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   memcpy (memaddr, myaddr, len);
   return 0;
@@ -399,8 +374,7 @@
 static REGISTER_TYPE saved_regs[NUM_REGS];
 
 REGISTER_TYPE
-read_register (regno)
-     int regno;
+read_register (int regno)
 {
   if (regno < 0 || regno >= NUM_REGS)
     error ("Register number %d out of range.", regno);
@@ -408,9 +382,7 @@
 }
 
 void
-write_register (regno, value)
-     int regno;
-     REGISTER_TYPE value;
+write_register (int regno, REGISTER_TYPE value)
 {
   if (regno < 0 || regno >= NUM_REGS)
     error ("Register number %d out of range.", regno);
@@ -419,7 +391,7 @@
 
 /* System calls needed in relation to running the "inferior".  */
 
-vfork ()
+vfork (void)
 {
   /* Just appear to "succeed".  Say the inferior's pid is 1.  */
   return 1;
@@ -429,26 +401,25 @@
    that has just been forked.  That code never runs, when standalone,
    and these definitions are so it will link without errors.  */
 
-ptrace ()
+ptrace (void)
 {
 }
 
-setpgrp ()
+setpgrp (void)
 {
 }
 
-execle ()
+execle (void)
 {
 }
 
-_exit ()
+_exit (void)
 {
 }
 
 /* Malloc calls these.  */
 
-malloc_warning (str)
-     char *str;
+malloc_warning (char *str)
 {
   printf ("\n%s.\n\n", str);
 }
@@ -457,8 +428,7 @@
 char *memory_limit;
 
 char *
-sbrk (amount)
-     int amount;
+sbrk (int amount)
 {
   if (next_free + amount > memory_limit)
     return (char *) -1;
@@ -469,19 +439,18 @@
 /* Various ways malloc might ask where end of memory is.  */
 
 char *
-ulimit ()
+ulimit (void)
 {
   return memory_limit;
 }
 
 int
-vlimit ()
+vlimit (void)
 {
   return memory_limit - next_free;
 }
 
-getrlimit (addr)
-     struct rlimit *addr;
+getrlimit (struct rlimit *addr)
 {
   addr->rlim_cur = memory_limit - next_free;
 }
@@ -496,7 +465,7 @@
 static int fault_code;
 static REGISTER_TYPE gdb_stack;
 
-resume ()
+resume (void)
 {
   REGISTER_TYPE restore[NUM_REGS];
 
@@ -508,8 +477,7 @@
   /* Control does not drop through here!  */
 }
 
-save_frame_pointer (val)
-     CORE_ADDR val;
+save_frame_pointer (CORE_ADDR val)
 {
   gdb_stack = val;
 }
@@ -520,7 +488,7 @@
    The exact format is machine-dependent and is known only
    in the definition of PUSH_REGISTERS.  */
 
-fault ()
+fault (void)
 {
   /* Transfer all registers and fault code to the stack
      in canonical order: registers in order of GDB register number,
@@ -534,7 +502,7 @@
   /* Control does not reach here */
 }
 
-restore_gdb ()
+restore_gdb (void)
 {
   CORE_ADDR new_fp = gdb_stack;
   /* Switch to GDB's stack  */
@@ -546,8 +514,7 @@
    arguments to this function, copy them into the standard place
    for the program's registers while GDB is running.  */
 
-save_registers (firstreg)
-     int firstreg;
+save_registers (int firstreg)
 {
   memcpy (saved_regs, &firstreg, sizeof saved_regs);
   fault_code = (&firstreg)[NUM_REGS];
@@ -560,8 +527,7 @@
 static int fault_table[] = FAULT_TABLE;
 
 int
-wait (w)
-     WAITTYPE *w;
+wait (WAITTYPE *w)
 {
   WSETSTOP (*w, fault_table[fault_code / FAULT_CODE_UNITS]);
   return inferior_pid;
@@ -591,7 +557,7 @@
 int kdb_stack_beg[STACK_SIZE / sizeof (int)];
 int kdb_stack_end;
 
-_initialize_standalone ()
+_initialize_standalone (void)
 {
   register char *next;
 
diff --git a/gdb/stop-gdb.c b/gdb/stop-gdb.c
index f4470a8..099137f 100644
--- a/gdb/stop-gdb.c
+++ b/gdb/stop-gdb.c
@@ -41,9 +41,7 @@
 #include <servers/netname_defs.h>
 
 void
-main (argc, argv)
-     int argc;
-     char **argv;
+main (int argc, char **argv)
 {
   kern_return_t kr;
   mach_msg_header_t msg;
diff --git a/gdb/stuff.c b/gdb/stuff.c
index babd29f..33b26f3 100644
--- a/gdb/stuff.c
+++ b/gdb/stuff.c
@@ -94,9 +94,7 @@
 /* Read symbol table from file and returns the offset into the file
  * where symbol sym_name is located.  If error, print message and
  * exit. */
-get_offset (file, sym_name)
-     char *file;
-     char *sym_name;
+get_offset (char *file, char *sym_name)
 {
   int f;
   struct exec file_hdr;
@@ -139,11 +137,8 @@
   return (N_TXTOFF (file_hdr) + core_addr - origin);
 }
 
-find_symbol (sym_name, symbol_table, length, strings)
-     char *sym_name;
-     struct nlist *symbol_table;
-     int length;
-     char *strings;
+find_symbol (char *sym_name, struct nlist *symbol_table, int length,
+	     char *strings)
 {
   register struct nlist *sym;
 
diff --git a/gdb/sun3-nat.c b/gdb/sun3-nat.c
index d608d5f..8e27e64 100644
--- a/gdb/sun3-nat.c
+++ b/gdb/sun3-nat.c
@@ -29,8 +29,7 @@
 static void fetch_core_registers (char *, unsigned, int, CORE_ADDR);
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   struct regs inferior_registers;
   struct fp_status inferior_fp_registers;
@@ -63,8 +62,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   struct regs inferior_registers;
   struct fp_status inferior_fp_registers;
@@ -92,14 +90,22 @@
 
 
 /* All of this stuff is only relevant if both host and target are sun3.  */
-/* Machine-dependent code for pulling registers out of a Sun-3 core file. */
+
+/* Provide registers to GDB from a core file.
+
+   CORE_REG_SECT points to an array of bytes, which were obtained from
+   a core file which BFD thinks might contain register contents. 
+   CORE_REG_SIZE is its size.
+
+   WHICH says which register set corelow suspects this is:
+     0 --- the general-purpose register set
+     2 --- the floating-point register set
+
+   REG_ADDR isn't used.  */
 
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;
-     unsigned core_reg_size;
-     int which;
-     CORE_ADDR reg_addr;	/* Unused in this version */
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
+		      int which, CORE_ADDR reg_addr)
 {
   struct regs *regs = (struct regs *) core_reg_sect;
 
@@ -151,7 +157,7 @@
 };
 
 void
-_initialize_core_sun3 ()
+_initialize_core_sun3 (void)
 {
   add_core_fns (&sun3_core_fns);
 }
diff --git a/gdb/sun386-nat.c b/gdb/sun386-nat.c
index c37f4c2..326084e 100644
--- a/gdb/sun386-nat.c
+++ b/gdb/sun386-nat.c
@@ -45,9 +45,7 @@
 
 
 void
-core_file_command (filename, from_tty)
-     char *filename;
-     int from_tty;
+core_file_command (char *filename, int from_tty)
 {
   int val;
 
@@ -55,7 +53,7 @@
      and mark data and stack spaces as empty.  */
 
   if (corefile)
-    free (corefile);
+    xfree (corefile);
   corefile = 0;
 
   if (corechan >= 0)
@@ -72,7 +70,7 @@
   if (filename)
     {
       filename = tilde_expand (filename);
-      make_cleanup (free, filename);
+      make_cleanup (xfree, filename);
 
       if (have_inferior_p ())
 	error ("To look at a core file, you must kill the program with \"kill\".");
@@ -137,9 +135,7 @@
     printf_unfiltered ("No core file now.\n");
 }
 
-i387_to_double (from, to)
-     char *from;
-     char *to;
+i387_to_double (char *from, char *to)
 {
   long *lp;
   /* push extended mode on 387 stack, then pop in double mode
@@ -167,9 +163,7 @@
   asm ("popl %eax");		/* flush saved copy */
 }
 
-double_to_i387 (from, to)
-     char *from;
-     char *to;
+double_to_i387 (char *from, char *to)
 {
   /* push double mode on 387 stack, then pop in extended mode
    * no errors are possible because every 64-bit pattern
@@ -184,8 +178,7 @@
 }
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   struct regs inferior_registers;
   struct fp_state inferior_fp_registers;
@@ -211,8 +204,7 @@
    Otherwise, REGNO specifies which register (so we can save time).  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   struct regs inferior_registers;
   struct fp_state inferior_fp_registers;
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 726bd24..983db22 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -36,6 +36,7 @@
 #include "inferior.h"		/* for write_pc */
 #include "gdb-stabs.h"
 #include "obstack.h"
+#include "completer.h"
 
 #include <assert.h>
 #include <sys/types.h>
@@ -206,16 +207,13 @@
    comparison function takes two "void *" pointers. */
 
 static int
-compare_symbols (s1p, s2p)
-     const PTR s1p;
-     const PTR s2p;
+compare_symbols (const PTR s1p, const PTR s2p)
 {
   register struct symbol **s1, **s2;
 
   s1 = (struct symbol **) s1p;
   s2 = (struct symbol **) s2p;
-
-  return (STRCMP (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2)));
+  return (STRCMP (SYMBOL_SOURCE_NAME (*s1), SYMBOL_SOURCE_NAME (*s2)));
 }
 
 /*
@@ -241,12 +239,16 @@
  */
 
 static int
-compare_psymbols (s1p, s2p)
-     const PTR s1p;
-     const PTR s2p;
+compare_psymbols (const PTR s1p, const PTR s2p)
 {
-  register char *st1 = SYMBOL_NAME (*(struct partial_symbol **) s1p);
-  register char *st2 = SYMBOL_NAME (*(struct partial_symbol **) s2p);
+  register struct partial_symbol **s1, **s2;
+  register char *st1, *st2;
+
+  s1 = (struct partial_symbol **) s1p;
+  s2 = (struct partial_symbol **) s2p;
+  st1 = SYMBOL_SOURCE_NAME (*s1);
+  st2 = SYMBOL_SOURCE_NAME (*s2);
+
 
   if ((st1[0] - st2[0]) || !st1[0])
     {
@@ -275,8 +277,7 @@
 }
 
 void
-sort_pst_symbols (pst)
-     struct partial_symtab *pst;
+sort_pst_symbols (struct partial_symtab *pst)
 {
   /* Sort the global list; don't sort the static list */
 
@@ -288,8 +289,7 @@
 /* Call sort_block_syms to sort alphabetically the symbols of one block.  */
 
 void
-sort_block_syms (b)
-     register struct block *b;
+sort_block_syms (register struct block *b)
 {
   qsort (&BLOCK_SYM (b, 0), BLOCK_NSYMS (b),
 	 sizeof (struct symbol *), compare_symbols);
@@ -299,8 +299,7 @@
    the symbols of each block of one symtab.  */
 
 void
-sort_symtab_syms (s)
-     register struct symtab *s;
+sort_symtab_syms (register struct symtab *s)
 {
   register struct blockvector *bv;
   int nbl;
@@ -325,10 +324,7 @@
    may be part of a larger string and we are only saving a substring. */
 
 char *
-obsavestring (ptr, size, obstackp)
-     char *ptr;
-     int size;
-     struct obstack *obstackp;
+obsavestring (char *ptr, int size, struct obstack *obstackp)
 {
   register char *p = (char *) obstack_alloc (obstackp, size + 1);
   /* Open-coded memcpy--saves function call time.  These strings are usually
@@ -349,9 +345,8 @@
    in the obstack pointed to by OBSTACKP.  */
 
 char *
-obconcat (obstackp, s1, s2, s3)
-     struct obstack *obstackp;
-     const char *s1, *s2, *s3;
+obconcat (struct obstack *obstackp, const char *s1, const char *s2,
+	  const char *s3)
 {
   register int len = strlen (s1) + strlen (s2) + strlen (s3) + 1;
   register char *val = (char *) obstack_alloc (obstackp, len);
@@ -366,8 +361,7 @@
 int currently_reading_symtab = 0;
 
 static void
-decrement_reading_symtab (dummy)
-     void *dummy;
+decrement_reading_symtab (void *dummy)
 {
   currently_reading_symtab--;
 }
@@ -378,8 +372,7 @@
    case inline.  */
 
 struct symtab *
-psymtab_to_symtab (pst)
-     register struct partial_symtab *pst;
+psymtab_to_symtab (register struct partial_symtab *pst)
 {
   /* If it's been looked up before, return it. */
   if (pst->symtab)
@@ -400,8 +393,7 @@
 /* Initialize entry point information for this objfile. */
 
 void
-init_entry_point_info (objfile)
-     struct objfile *objfile;
+init_entry_point_info (struct objfile *objfile)
 {
   /* Save startup file's range of PC addresses to help blockframe.c
      decide where the bottom of the stack is.  */
@@ -428,7 +420,7 @@
 /* Get current entry point address.  */
 
 CORE_ADDR
-entry_point_address ()
+entry_point_address (void)
 {
   return symfile_objfile ? symfile_objfile->ei.entry_point : 0;
 }
@@ -443,10 +435,7 @@
    lowest-addressed loadable section.  */
 
 void
-find_lowest_section (abfd, sect, obj)
-     bfd *abfd;
-     asection *sect;
-     PTR obj;
+find_lowest_section (bfd *abfd, asection *sect, PTR obj)
 {
   asection **lowest = (asection **) obj;
 
@@ -502,8 +491,8 @@
 
   for (idx = 0; idx < MAX_SECTIONS; idx++)
     if (sap->other[idx].name)
-      free (sap->other[idx].name);
-  free (sap);
+      xfree (sap->other[idx].name);
+  xfree (sap);
 }
 
 
@@ -514,9 +503,8 @@
    for the objectfile OBJFILE and stuffs ADDR into all of the offsets.  */
 
 void
-default_symfile_offsets (objfile, addrs)
-     struct objfile *objfile;
-     struct section_addr_info *addrs;
+default_symfile_offsets (struct objfile *objfile,
+			 struct section_addr_info *addrs)
 {
   int i;
   asection *sect = NULL;
@@ -539,7 +527,7 @@
       /* Record all sections in offsets */
       /* The section_offsets in the objfile are here filled in using
          the BFD index. */
-      ANOFFSET (objfile->section_offsets, osp->sectindex) = osp->addr;
+      (objfile->section_offsets)->offsets[osp->sectindex] = osp->addr;
     }
 
   /* Remember the bfd indexes for the .text, .data, .bss and
@@ -578,11 +566,8 @@
    the symbol reading (and complaints can be more terse about it).  */
 
 void
-syms_from_objfile (objfile, addrs, mainline, verbo)
-     struct objfile *objfile;
-     struct section_addr_info *addrs;
-     int mainline;
-     int verbo;
+syms_from_objfile (struct objfile *objfile, struct section_addr_info *addrs,
+		   int mainline, int verbo)
 {
   asection *lower_sect;
   asection *sect;
@@ -778,7 +763,7 @@
   discard_cleanups (old_chain);
 
   /* Call this after reading in a new symbol table to give target
-     dependant code a crack at the new symbols.  For instance, this
+     dependent code a crack at the new symbols.  For instance, this
      could be used to update the values of target-specific symbols GDB
      needs to keep track of (such as _sigtramp, or whatever).  */
 
@@ -790,10 +775,7 @@
    objfile. */
 
 void
-new_symfile_objfile (objfile, mainline, verbo)
-     struct objfile *objfile;
-     int mainline;
-     int verbo;
+new_symfile_objfile (struct objfile *objfile, int mainline, int verbo)
 {
 
   /* If this is the main symbol file we have to clean up all users of the
@@ -829,12 +811,8 @@
    Upon failure, jumps back to command level (never returns). */
 
 struct objfile *
-symbol_file_add (name, from_tty, addrs, mainline, flags)
-     char *name;
-     int from_tty;
-     struct section_addr_info *addrs;
-     int mainline;
-     int flags;
+symbol_file_add (char *name, int from_tty, struct section_addr_info *addrs,
+		 int mainline, int flags)
 {
   struct objfile *objfile;
   struct partial_symtab *psymtab;
@@ -946,9 +924,7 @@
    and pass that to symbol_file_add(). This is no longer supported. */
 
 void
-symbol_file_command (args, from_tty)
-     char *args;
-     int from_tty;
+symbol_file_command (char *args, int from_tty)
 {
   char **argv;
   char *name = NULL;
@@ -1034,7 +1010,7 @@
    FIXME.  */
 
 static void
-set_initial_language ()
+set_initial_language (void)
 {
   struct partial_symtab *pst;
   enum language lang = language_unknown;
@@ -1062,8 +1038,7 @@
    In case of trouble, error() is called.  */
 
 bfd *
-symfile_bfd_open (name)
-     char *name;
+symfile_bfd_open (char *name)
 {
   bfd *sym_bfd;
   int desc;
@@ -1086,10 +1061,10 @@
 #endif
   if (desc < 0)
     {
-      make_cleanup (free, name);
+      make_cleanup (xfree, name);
       perror_with_name (name);
     }
-  free (name);			/* Free 1st new malloc'd copy */
+  xfree (name);			/* Free 1st new malloc'd copy */
   name = absolute_name;		/* Keep 2nd malloc'd copy in bfd */
   /* It'll be freed in free_objfile(). */
 
@@ -1097,7 +1072,7 @@
   if (!sym_bfd)
     {
       close (desc);
-      make_cleanup (free, name);
+      make_cleanup (xfree, name);
       error ("\"%s\": can't open to read symbols: %s.", name,
 	     bfd_errmsg (bfd_get_error ()));
     }
@@ -1109,7 +1084,7 @@
          on error it does not free all the storage associated with the
          bfd).  */
       bfd_close (sym_bfd);	/* This also closes desc */
-      make_cleanup (free, name);
+      make_cleanup (xfree, name);
       error ("\"%s\": can't read symbols: %s.", name,
 	     bfd_errmsg (bfd_get_error ()));
     }
@@ -1122,8 +1097,7 @@
    to handle. */
 
 void
-add_symtab_fns (sf)
-     struct sym_fns *sf;
+add_symtab_fns (struct sym_fns *sf)
 {
   sf->next = symtab_fns;
   symtab_fns = sf;
@@ -1136,18 +1110,12 @@
    symbol file.  */
 
 static void
-find_sym_fns (objfile)
-     struct objfile *objfile;
+find_sym_fns (struct objfile *objfile)
 {
   struct sym_fns *sf;
   enum bfd_flavour our_flavour = bfd_get_flavour (objfile->obfd);
   char *our_target = bfd_get_target (objfile->obfd);
 
-  /* Special kludge for RS/6000 and PowerMac.  See xcoffread.c.  */
-  if (STREQ (our_target, "aixcoff-rs6000") ||
-      STREQ (our_target, "xcoff-powermac"))
-    our_flavour = (enum bfd_flavour) -1;
-
   /* Special kludge for apollo.  See dstread.c.  */
   if (STREQN (our_target, "apollo", 6))
     our_flavour = (enum bfd_flavour) -2;
@@ -1167,9 +1135,7 @@
 /* This function runs the load command of our current target.  */
 
 static void
-load_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+load_command (char *arg, int from_tty)
 {
   if (arg == NULL)
     arg = get_exec_file (1);
@@ -1206,7 +1172,7 @@
   /* Parse the input argument - the user can specify a load offset as
      a second argument. */
   filename = xmalloc (strlen (args) + 1);
-  old_cleanups = make_cleanup (free, filename);
+  old_cleanups = make_cleanup (xfree, filename);
   strcpy (filename, args);
   offptr = strchr (filename, ' ');
   if (offptr != NULL)
@@ -1266,7 +1232,7 @@
 		block_size = size;
 
 	      buffer = xmalloc (size);
-	      old_chain = make_cleanup (free, buffer);
+	      old_chain = make_cleanup (xfree, buffer);
 
 	      /* Is this really necessary?  I guess it gives the user something
 	         to look at during a long download.  */
@@ -1303,7 +1269,7 @@
                          that.  remote.c could implement that method
                          using the ``qCRC'' packet.  */
 		      char *check = xmalloc (len);
-		      struct cleanup *verify_cleanups = make_cleanup (free, check);
+		      struct cleanup *verify_cleanups = make_cleanup (xfree, check);
 		      if (target_read_memory (lma, check, len) != 0)
 			error ("Download verify read failed at 0x%s",
 			       paddr (lma));
@@ -1376,9 +1342,8 @@
    function signature). */
 
 void
-report_transfer_performance (data_count, start_time, end_time)
-     unsigned long data_count;
-     time_t start_time, end_time;
+report_transfer_performance (unsigned long data_count, time_t start_time,
+			     time_t end_time)
 {
   print_transfer_performance (gdb_stdout, data_count, end_time - start_time, 0);
 }
@@ -1432,9 +1397,7 @@
 
 /* ARGSUSED */
 static void
-add_symbol_file_command (args, from_tty)
-     char *args;
-     int from_tty;
+add_symbol_file_command (char *args, int from_tty)
 {
   char *filename = NULL;
   int flags = OBJF_USERLOADED;
@@ -1490,7 +1453,7 @@
 	{
 	  /* The first argument is the file name. */
 	  filename = tilde_expand (arg);
-	  my_cleanups = make_cleanup (free, filename);
+	  my_cleanups = make_cleanup (xfree, filename);
 	}
       else
 	if (argcnt == 1)
@@ -1590,9 +1553,7 @@
 }
 
 static void
-add_shared_symbol_files_command (args, from_tty)
-     char *args;
-     int from_tty;
+add_shared_symbol_files_command (char *args, int from_tty)
 {
 #ifdef ADD_SHARED_SYMBOL_FILES
   ADD_SHARED_SYMBOL_FILES (args, from_tty);
@@ -1603,7 +1564,7 @@
 
 /* Re-read symbols if a symbol-file has changed.  */
 void
-reread_symbols ()
+reread_symbols (void)
 {
   struct objfile *objfile;
   long new_modtime;
@@ -1724,13 +1685,13 @@
 	      /* obstack_specify_allocation also initializes the obstack so
 	         it is empty.  */
 	      obstack_specify_allocation (&objfile->psymbol_cache.cache, 0, 0,
-					  xmalloc, free);
+					  xmalloc, xfree);
 	      obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0,
-					  xmalloc, free);
+					  xmalloc, xfree);
 	      obstack_specify_allocation (&objfile->symbol_obstack, 0, 0,
-					  xmalloc, free);
+					  xmalloc, xfree);
 	      obstack_specify_allocation (&objfile->type_obstack, 0, 0,
-					  xmalloc, free);
+					  xmalloc, xfree);
 	      if (build_objfile_section_table (objfile))
 		{
 		  error ("Can't find the file sections in `%s': %s",
@@ -1787,7 +1748,7 @@
 	      reread_one = 1;
 
 	      /* Call this after reading in a new symbol table to give target
-	         dependant code a crack at the new symbols.  For instance, this
+	         dependent code a crack at the new symbols.  For instance, this
 	         could be used to update the values of target-specific symbols GDB
 	         needs to keep track of (such as _sigtramp, or whatever).  */
 
@@ -1813,9 +1774,7 @@
 static int fl_table_size, fl_table_next;
 
 static void
-add_filename_language (ext, lang)
-     char *ext;
-     enum language lang;
+add_filename_language (char *ext, enum language lang)
 {
   if (fl_table_next >= fl_table_size)
     {
@@ -1832,9 +1791,7 @@
 static char *ext_args;
 
 static void
-set_ext_lang_command (args, from_tty)
-     char *args;
-     int from_tty;
+set_ext_lang_command (char *args, int from_tty)
 {
   int i;
   char *cp = ext_args;
@@ -1884,16 +1841,14 @@
       /*   query ("Really make files of type %s '%s'?", */
       /*          ext_args, language_str (lang));           */
 
-      free (filename_language_table[i].ext);
+      xfree (filename_language_table[i].ext);
       filename_language_table[i].ext = strsave (ext_args);
       filename_language_table[i].lang = lang;
     }
 }
 
 static void
-info_ext_lang_command (args, from_tty)
-     char *args;
-     int from_tty;
+info_ext_lang_command (char *args, int from_tty)
 {
   int i;
 
@@ -1906,7 +1861,7 @@
 }
 
 static void
-init_filename_language_table ()
+init_filename_language_table (void)
 {
   if (fl_table_size == 0)	/* protect against repetition */
     {
@@ -1930,12 +1885,14 @@
       add_filename_language (".F", language_fortran);
       add_filename_language (".s", language_asm);
       add_filename_language (".S", language_asm);
+      add_filename_language (".pas", language_pascal);
+      add_filename_language (".p", language_pascal);
+      add_filename_language (".pp", language_pascal);
     }
 }
 
 enum language
-deduce_language_from_filename (filename)
-     char *filename;
+deduce_language_from_filename (char *filename)
 {
   int i;
   char *cp;
@@ -1964,9 +1921,7 @@
  */
 
 struct symtab *
-allocate_symtab (filename, objfile)
-     char *filename;
-     struct objfile *objfile;
+allocate_symtab (char *filename, struct objfile *objfile)
 {
   register struct symtab *symtab;
 
@@ -1998,9 +1953,7 @@
 }
 
 struct partial_symtab *
-allocate_psymtab (filename, objfile)
-     char *filename;
-     struct objfile *objfile;
+allocate_psymtab (char *filename, struct objfile *objfile)
 {
   struct partial_symtab *psymtab;
 
@@ -2042,8 +1995,7 @@
 }
 
 void
-discard_psymtab (pst)
-     struct partial_symtab *pst;
+discard_psymtab (struct partial_symtab *pst)
 {
   struct partial_symtab **prev_pst;
 
@@ -2072,7 +2024,7 @@
    table data.  */
 
 void
-clear_symtab_users ()
+clear_symtab_users (void)
 {
   /* Someday, we should do better than this, by only blowing away
      the things that really need to be blown.  */
@@ -2128,7 +2080,7 @@
 static int clear_symtab_users_done;
 
 static void
-clear_symtab_users_once ()
+clear_symtab_users_once (void)
 {
   /* Enforce once-per-`do_cleanups'-semantics */
   if (clear_symtab_users_queued <= clear_symtab_users_done)
@@ -2142,8 +2094,7 @@
 /* Delete the specified psymtab, and any others that reference it.  */
 
 static void
-cashier_psymtab (pst)
-     struct partial_symtab *pst;
+cashier_psymtab (struct partial_symtab *pst)
 {
   struct partial_symtab *ps, *pprev = NULL;
   int i;
@@ -2193,15 +2144,14 @@
    it is not called for subsidiary files such as .h files.
 
    Return value is 1 if we blew away the environment, 0 if not.
-   FIXME.  The return valu appears to never be used.
+   FIXME.  The return value appears to never be used.
 
    FIXME.  I think this is not the best way to do this.  We should
    work on being gentler to the environment while still cleaning up
    all stray pointers into the freed symtab.  */
 
 int
-free_named_symtabs (name)
-     char *name;
+free_named_symtabs (char *name)
 {
 #if 0
   /* FIXME:  With the new method of each objfile having it's own
@@ -2307,14 +2257,10 @@
    FILENAME is the name of the symbol-file we are reading from. */
 
 struct partial_symtab *
-start_psymtab_common (objfile, section_offsets,
-		      filename, textlow, global_syms, static_syms)
-     struct objfile *objfile;
-     struct section_offsets *section_offsets;
-     char *filename;
-     CORE_ADDR textlow;
-     struct partial_symbol **global_syms;
-     struct partial_symbol **static_syms;
+start_psymtab_common (struct objfile *objfile,
+		      struct section_offsets *section_offsets, char *filename,
+		      CORE_ADDR textlow, struct partial_symbol **global_syms,
+		      struct partial_symbol **static_syms)
 {
   struct partial_symtab *psymtab;
 
@@ -2331,17 +2277,11 @@
    Since one arg is a struct, we pass in a ptr and deref it (sigh).  */
 
 void
-add_psymbol_to_list (name, namelength, namespace, class, list, val, coreaddr,
-		     language, objfile)
-     char *name;
-     int namelength;
-     namespace_enum namespace;
-     enum address_class class;
-     struct psymbol_allocation_list *list;
-     long val;			/* Value as a long */
-     CORE_ADDR coreaddr;	/* Value as a CORE_ADDR */
-     enum language language;
-     struct objfile *objfile;
+add_psymbol_to_list (char *name, int namelength, namespace_enum namespace,
+		     enum address_class class,
+		     struct psymbol_allocation_list *list, long val,	/* Value as a long */
+		     CORE_ADDR coreaddr,	/* Value as a CORE_ADDR */
+		     enum language language, struct objfile *objfile)
 {
   register struct partial_symbol *psym;
   char *buf = alloca (namelength + 1);
@@ -2386,19 +2326,13 @@
  * name. */
 
 void
-add_psymbol_with_dem_name_to_list (name, namelength, dem_name, dem_namelength,
-		   namespace, class, list, val, coreaddr, language, objfile)
-     char *name;
-     int namelength;
-     char *dem_name;
-     int dem_namelength;
-     namespace_enum namespace;
-     enum address_class class;
-     struct psymbol_allocation_list *list;
-     long val;			/* Value as a long */
-     CORE_ADDR coreaddr;	/* Value as a CORE_ADDR */
-     enum language language;
-     struct objfile *objfile;
+add_psymbol_with_dem_name_to_list (char *name, int namelength, char *dem_name,
+				   int dem_namelength, namespace_enum namespace,
+				   enum address_class class,
+				   struct psymbol_allocation_list *list, long val,	/* Value as a long */
+				   CORE_ADDR coreaddr,	/* Value as a CORE_ADDR */
+				   enum language language,
+				   struct objfile *objfile)
 {
   register struct partial_symbol *psym;
   char *buf = alloca (namelength + 1);
@@ -2461,9 +2395,7 @@
 /* Initialize storage for partial symbols.  */
 
 void
-init_psymbol_list (objfile, total_symbols)
-     struct objfile *objfile;
-     int total_symbols;
+init_psymbol_list (struct objfile *objfile, int total_symbols)
 {
   /* Free any previously allocated psymbol lists.  */
 
@@ -2561,8 +2493,7 @@
    SECTION is loaded at an address different from where it will "run".  */
 
 int
-section_is_overlay (section)
-     asection *section;
+section_is_overlay (asection *section)
 {
   if (overlay_debugging)
     if (section && section->lma != 0 &&
@@ -2576,7 +2507,7 @@
    Invalidate the mapped state of all overlay sections (mark it as stale).  */
 
 static void
-overlay_invalidate_all ()
+overlay_invalidate_all (void)
 {
   struct objfile *objfile;
   struct obj_section *sect;
@@ -2597,8 +2528,7 @@
    section is stale, then call TARGET_OVERLAY_UPDATE to refresh it.  */
 
 static int
-overlay_is_mapped (osect)
-     struct obj_section *osect;
+overlay_is_mapped (struct obj_section *osect)
 {
   if (osect == 0 || !section_is_overlay (osect->the_bfd_section))
     return 0;
@@ -2631,8 +2561,7 @@
    Returns true if section is an overlay, and is currently mapped.  */
 
 int
-section_is_mapped (section)
-     asection *section;
+section_is_mapped (asection *section)
 {
   struct objfile *objfile;
   struct obj_section *osect;
@@ -2650,9 +2579,7 @@
    If PC falls into the lma range of SECTION, return true, else false.  */
 
 CORE_ADDR
-pc_in_unmapped_range (pc, section)
-     CORE_ADDR pc;
-     asection *section;
+pc_in_unmapped_range (CORE_ADDR pc, asection *section)
 {
   int size;
 
@@ -2670,9 +2597,7 @@
    If PC falls into the vma range of SECTION, return true, else false.  */
 
 CORE_ADDR
-pc_in_mapped_range (pc, section)
-     CORE_ADDR pc;
-     asection *section;
+pc_in_mapped_range (CORE_ADDR pc, asection *section)
 {
   int size;
 
@@ -2691,9 +2616,7 @@
    May be the same as PC.  */
 
 CORE_ADDR
-overlay_unmapped_address (pc, section)
-     CORE_ADDR pc;
-     asection *section;
+overlay_unmapped_address (CORE_ADDR pc, asection *section)
 {
   if (overlay_debugging)
     if (section && section_is_overlay (section) &&
@@ -2708,9 +2631,7 @@
    May be the same as PC.  */
 
 CORE_ADDR
-overlay_mapped_address (pc, section)
-     CORE_ADDR pc;
-     asection *section;
+overlay_mapped_address (CORE_ADDR pc, asection *section)
 {
   if (overlay_debugging)
     if (section && section_is_overlay (section) &&
@@ -2726,9 +2647,7 @@
    depending on whether the section is mapped or not.  */
 
 CORE_ADDR
-symbol_overlayed_address (address, section)
-     CORE_ADDR address;
-     asection *section;
+symbol_overlayed_address (CORE_ADDR address, asection *section)
 {
   if (overlay_debugging)
     {
@@ -2757,8 +2676,7 @@
    Else if PC matches an unmapped section's LMA, return that section.  */
 
 asection *
-find_pc_overlay (pc)
-     CORE_ADDR pc;
+find_pc_overlay (CORE_ADDR pc)
 {
   struct objfile *objfile;
   struct obj_section *osect, *best_match = NULL;
@@ -2785,8 +2703,7 @@
    currently marked as MAPPED, return that section.  Else return NULL.  */
 
 asection *
-find_pc_mapped_section (pc)
-     CORE_ADDR pc;
+find_pc_mapped_section (CORE_ADDR pc)
 {
   struct objfile *objfile;
   struct obj_section *osect;
@@ -2804,9 +2721,7 @@
    Print a list of mapped sections and their PC ranges */
 
 void
-list_overlays_command (args, from_tty)
-     char *args;
-     int from_tty;
+list_overlays_command (char *args, int from_tty)
 {
   int nmapped = 0;
   struct objfile *objfile;
@@ -2845,9 +2760,7 @@
    Mark the named section as mapped (ie. residing at its VMA address).  */
 
 void
-map_overlay_command (args, from_tty)
-     char *args;
-     int from_tty;
+map_overlay_command (char *args, int from_tty)
 {
   struct objfile *objfile, *objfile2;
   struct obj_section *sec, *sec2;
@@ -2898,9 +2811,7 @@
    (ie. resident in its LMA address range, rather than the VMA range).  */
 
 void
-unmap_overlay_command (args, from_tty)
-     char *args;
-     int from_tty;
+unmap_overlay_command (char *args, int from_tty)
 {
   struct objfile *objfile;
   struct obj_section *sec;
@@ -2930,9 +2841,7 @@
    Possibly this should be done via a set/show command. */
 
 static void
-overlay_auto_command (args, from_tty)
-     char *args;
-     int from_tty;
+overlay_auto_command (char *args, int from_tty)
 {
   overlay_debugging = -1;
   if (info_verbose)
@@ -2944,9 +2853,7 @@
    Possibly this should be done via a set/show command. */
 
 static void
-overlay_manual_command (args, from_tty)
-     char *args;
-     int from_tty;
+overlay_manual_command (char *args, int from_tty)
 {
   overlay_debugging = 1;
   if (info_verbose)
@@ -2958,9 +2865,7 @@
    Possibly this should be done via a set/show command. */
 
 static void
-overlay_off_command (args, from_tty)
-     char *args;
-     int from_tty;
+overlay_off_command (char *args, int from_tty)
 {
   overlay_debugging = 0;
   if (info_verbose)
@@ -2968,9 +2873,7 @@
 }
 
 static void
-overlay_load_command (args, from_tty)
-     char *args;
-     int from_tty;
+overlay_load_command (char *args, int from_tty)
 {
   if (target_overlay_update)
     (*target_overlay_update) (NULL);
@@ -2985,9 +2888,7 @@
 struct cmd_list_element *overlaylist;
 
 static void
-overlay_command (args, from_tty)
-     char *args;
-     int from_tty;
+overlay_command (char *args, int from_tty)
 {
   printf_unfiltered
     ("\"overlay\" must be followed by the name of an overlay command.\n");
@@ -3050,10 +2951,10 @@
 
 /* Throw away the cached copy of _ovly_table */
 static void
-simple_free_overlay_table ()
+simple_free_overlay_table (void)
 {
   if (cache_ovly_table)
-    free (cache_ovly_table);
+    xfree (cache_ovly_table);
   cache_novlys = 0;
   cache_ovly_table = NULL;
   cache_ovly_table_base = 0;
@@ -3062,10 +2963,10 @@
 #if 0
 /* Throw away the cached copy of _ovly_region_table */
 static void
-simple_free_overlay_region_table ()
+simple_free_overlay_region_table (void)
 {
   if (cache_ovly_region_table)
-    free (cache_ovly_region_table);
+    xfree (cache_ovly_region_table);
   cache_novly_regions = 0;
   cache_ovly_region_table = NULL;
   cache_ovly_region_table_base = 0;
@@ -3075,10 +2976,7 @@
 /* Read an array of ints from the target into a local buffer.
    Convert to host order.  int LEN is number of ints  */
 static void
-read_target_long_array (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     unsigned int *myaddr;
-     int len;
+read_target_long_array (CORE_ADDR memaddr, unsigned int *myaddr, int len)
 {
   char *buf = alloca (len * TARGET_LONG_BYTES);
   int i;
@@ -3092,7 +2990,7 @@
 /* Find and grab a copy of the target _ovly_table
    (and _novlys, which is needed for the table's size) */
 static int
-simple_read_overlay_table ()
+simple_read_overlay_table (void)
 {
   struct minimal_symbol *msym;
 
@@ -3125,7 +3023,7 @@
 /* Find and grab a copy of the target _ovly_region_table
    (and _novly_regions, which is needed for the table's size) */
 static int
-simple_read_overlay_region_table ()
+simple_read_overlay_region_table (void)
 {
   struct minimal_symbol *msym;
 
@@ -3164,8 +3062,7 @@
    success, 0 for failure.  */
 
 static int
-simple_overlay_update_1 (osect)
-     struct obj_section *osect;
+simple_overlay_update_1 (struct obj_section *osect)
 {
   int i, size;
 
@@ -3199,8 +3096,7 @@
    re-read the entire cache, and go ahead and update all sections.  */
 
 static void
-simple_overlay_update (osect)
-     struct obj_section *osect;
+simple_overlay_update (struct obj_section *osect)
 {
   struct objfile *objfile;
 
@@ -3245,7 +3141,7 @@
 
 
 void
-_initialize_symfile ()
+_initialize_symfile (void)
 {
   struct cmd_list_element *c;
 
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 56cf465..fb5fd17 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -1,5 +1,5 @@
 /* Definitions for reading symbol files into GDB.
-   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996
+   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 2000
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -61,10 +61,10 @@
    solib.c to communicate the section addresses in shared objects to
    symbol_file_add (). */
  
-#define MAX_SECTIONS 40
+#define MAX_SECTIONS 64
 struct section_addr_info 
 {
-  /* Sections whose names are file format dependant. */
+  /* Sections whose names are file format dependent. */
   struct other_sections
   {
     CORE_ADDR addr;
diff --git a/gdb/symm-nat.c b/gdb/symm-nat.c
index 1ec3a60..7fc706f 100644
--- a/gdb/symm-nat.c
+++ b/gdb/symm-nat.c
@@ -53,8 +53,7 @@
 #include "gdbcore.h"
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   struct pt_regset regs;
   int i;
@@ -93,8 +92,7 @@
 }
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   int i;
   struct pt_regset regs;
@@ -129,8 +127,7 @@
 
 /* FIXME:  This should be merged with i387-tdep.c as well. */
 static
-print_fpu_status (ep)
-     struct pt_regset ep;
+print_fpu_status (struct pt_regset ep)
 {
   int i;
   int bothstatus;
@@ -199,9 +196,7 @@
 }
 
 
-print_1167_control_word (pcr)
-     unsigned int pcr;
-
+print_1167_control_word (unsigned int pcr)
 {
   int pcr_tmp;
 
@@ -318,9 +313,7 @@
   printf_unfiltered ("\n");
 }
 
-print_1167_regs (regs)
-     long regs[FPA_NREGS];
-
+print_1167_regs (long regs[FPA_NREGS])
 {
   int i;
 
@@ -355,9 +348,7 @@
     }
 }
 
-print_fpa_status (ep)
-     struct pt_regset ep;
-
+print_fpa_status (struct pt_regset ep)
 {
 
   printf_unfiltered ("WTL 1167:");
@@ -374,7 +365,7 @@
 }
 
 #if 0				/* disabled because it doesn't go through the target vector.  */
-i386_float_info ()
+i386_float_info (void)
 {
   char ubuf[UPAGES * NBPG];
   struct pt_regset regset;
@@ -408,8 +399,7 @@
 /*ARGSUSED */
 /* This will eventually be more interesting. */
 void
-sigchld_handler (signo)
-     int signo;
+sigchld_handler (int signo)
 {
   got_sigchld++;
 }
@@ -432,9 +422,7 @@
  * Thanks to XPT_MPDEBUGGER, we have to mange child_wait().
  */
 int
-child_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+child_wait (int pid, struct target_waitstatus *status)
 {
   int save_errno, rv, xvaloff, saoff, sa_hand;
   struct pt_stop pt;
@@ -595,9 +583,7 @@
  * the MPDEBUGGER child_wait() works properly.  This will go away when
  * that is fixed.
  */
-child_wait (pid, ourstatus)
-     int pid;
-     struct target_waitstatus *ourstatus;
+child_wait (int pid, struct target_waitstatus *ourstatus)
 {
   int save_errno;
   int status;
@@ -630,19 +616,13 @@
    It exists so that all calls to ptrace are isolated in this 
    machine-dependent file. */
 int
-call_ptrace (request, pid, addr, data)
-     int request, pid;
-     PTRACE_ARG3_TYPE addr;
-     int data;
+call_ptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data)
 {
   return ptrace (request, pid, addr, data);
 }
 
 int
-call_mptrace (request, pid, addr, data)
-     int request, pid;
-     PTRACE_ARG3_TYPE addr;
-     int data;
+call_mptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data)
 {
   return mptrace (request, pid, addr, data);
 }
@@ -655,7 +635,7 @@
 #endif
 
 void
-kill_inferior ()
+kill_inferior (void)
 {
   if (inferior_pid == 0)
     return;
@@ -679,10 +659,7 @@
    If SIGNAL is nonzero, give it that signal.  */
 
 void
-child_resume (pid, step, signal)
-     int pid;
-     int step;
-     enum target_signal signal;
+child_resume (int pid, int step, enum target_signal signal)
 {
   errno = 0;
 
@@ -710,8 +687,7 @@
 #ifdef ATTACH_DETACH
 /* Start debugging the process whose number is PID.  */
 int
-attach (pid)
-     int pid;
+attach (int pid)
 {
   sigset_t set;
   int rv;
@@ -731,8 +707,7 @@
 }
 
 void
-detach (signo)
-     int signo;
+detach (int signo)
 {
   int rv;
 
@@ -760,7 +735,7 @@
 
 /* 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.
+   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 child_ops
@@ -768,12 +743,8 @@
    anyway.  */
 
 int
-child_xfer_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;	/* ignored */
+child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		   struct target_ops *target)
 {
   register int i;
   /* Round starting address down to longword boundary.  */
@@ -854,7 +825,7 @@
 
 
 void
-_initialize_symm_nat ()
+_initialize_symm_nat (void)
 {
 #ifdef ATTACH_DETACH
 /*
diff --git a/gdb/symm-tdep.c b/gdb/symm-tdep.c
index 667fd64..79d9431 100644
--- a/gdb/symm-tdep.c
+++ b/gdb/symm-tdep.c
@@ -35,10 +35,7 @@
 #include <fcntl.h>
 
 void
-symmetry_extract_return_value (type, regbuf, valbuf)
-     struct type *type;
-     char *regbuf;
-     char *valbuf;
+symmetry_extract_return_value (struct type *type, char *regbuf, char *valbuf)
 {
   union
     {
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 1f46bc7..5add35a 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -82,9 +82,7 @@
 /* Free a struct block <- B and all the symbols defined in that block.  */
 
 static void
-free_symtab_block (objfile, b)
-     struct objfile *objfile;
-     struct block *b;
+free_symtab_block (struct objfile *objfile, struct block *b)
 {
   register int i, n;
   n = BLOCK_NSYMS (b);
@@ -105,8 +103,7 @@
    It is s->free_code that says which alternative to use.  */
 
 void
-free_symtab (s)
-     register struct symtab *s;
+free_symtab (register struct symtab *s)
 {
   register int i, n;
   register struct blockvector *bv;
@@ -155,7 +152,7 @@
 }
 
 void
-print_symbol_bcache_statistics ()
+print_symbol_bcache_statistics (void)
 {
   struct objfile *objfile;
 
@@ -169,7 +166,7 @@
 }
 
 void
-print_objfile_statistics ()
+print_objfile_statistics (void)
 {
   struct objfile *objfile;
 
@@ -208,8 +205,7 @@
 }
 
 static void
-dump_objfile (objfile)
-     struct objfile *objfile;
+dump_objfile (struct objfile *objfile)
 {
   struct symtab *symtab;
   struct partial_symtab *psymtab;
@@ -265,9 +261,7 @@
 /* Print minimal symbols from this objfile.  */
 
 static void
-dump_msymbols (objfile, outfile)
-     struct objfile *objfile;
-     struct ui_file *outfile;
+dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
 {
   struct minimal_symbol *msymbol;
   int index;
@@ -341,10 +335,8 @@
 }
 
 static void
-dump_psymtab (objfile, psymtab, outfile)
-     struct objfile *objfile;
-     struct partial_symtab *psymtab;
-     struct ui_file *outfile;
+dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab,
+	      struct ui_file *outfile)
 {
   int i;
 
@@ -410,10 +402,8 @@
 }
 
 static void
-dump_symtab (objfile, symtab, outfile)
-     struct objfile *objfile;
-     struct symtab *symtab;
-     struct ui_file *outfile;
+dump_symtab (struct objfile *objfile, struct symtab *symtab,
+	     struct ui_file *outfile)
 {
   register int i, j;
   int len, blen;
@@ -500,9 +490,7 @@
 }
 
 void
-maintenance_print_symbols (args, from_tty)
-     char *args;
-     int from_tty;
+maintenance_print_symbols (char *args, int from_tty)
 {
   char **argv;
   struct ui_file *outfile;
@@ -536,7 +524,7 @@
     }
 
   filename = tilde_expand (filename);
-  make_cleanup (free, filename);
+  make_cleanup (xfree, filename);
 
   outfile = gdb_fopen (filename, FOPEN_WT);
   if (outfile == 0)
@@ -557,8 +545,7 @@
    1 for success.  */
 
 static int
-print_symbol (args)
-     PTR args;
+print_symbol (PTR args)
 {
   struct symbol *symbol = ((struct print_symbol_args *) args)->symbol;
   int depth = ((struct print_symbol_args *) args)->depth;
@@ -738,9 +725,7 @@
 }
 
 void
-maintenance_print_psymbols (args, from_tty)
-     char *args;
-     int from_tty;
+maintenance_print_psymbols (char *args, int from_tty)
 {
   char **argv;
   struct ui_file *outfile;
@@ -773,7 +758,7 @@
     }
 
   filename = tilde_expand (filename);
-  make_cleanup (free, filename);
+  make_cleanup (xfree, filename);
 
   outfile = gdb_fopen (filename, FOPEN_WT);
   if (outfile == 0)
@@ -789,11 +774,8 @@
 }
 
 static void
-print_partial_symbols (p, count, what, outfile)
-     struct partial_symbol **p;
-     int count;
-     char *what;
-     struct ui_file *outfile;
+print_partial_symbols (struct partial_symbol **p, int count, char *what,
+		       struct ui_file *outfile)
 {
   fprintf_filtered (outfile, "  %s partial symbols:\n", what);
   while (count-- > 0)
@@ -887,9 +869,7 @@
 }
 
 void
-maintenance_print_msymbols (args, from_tty)
-     char *args;
-     int from_tty;
+maintenance_print_msymbols (char *args, int from_tty)
 {
   char **argv;
   struct ui_file *outfile;
@@ -921,7 +901,7 @@
     }
 
   filename = tilde_expand (filename);
-  make_cleanup (free, filename);
+  make_cleanup (xfree, filename);
 
   outfile = gdb_fopen (filename, FOPEN_WT);
   if (outfile == 0)
@@ -938,9 +918,7 @@
 }
 
 void
-maintenance_print_objfiles (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+maintenance_print_objfiles (char *ignore, int from_tty)
 {
   struct objfile *objfile;
 
@@ -955,9 +933,7 @@
 /* Check consistency of psymtabs and symtabs.  */
 
 void
-maintenance_check_symtabs (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+maintenance_check_symtabs (char *ignore, int from_tty)
 {
   register struct symbol *sym;
   register struct partial_symbol **psym;
@@ -1042,8 +1018,7 @@
 /* Return the nexting depth of a block within other blocks in its symtab.  */
 
 static int
-block_depth (block)
-     struct block *block;
+block_depth (struct block *block)
 {
   register int i = 0;
   while ((block = BLOCK_SUPERBLOCK (block)) != NULL)
@@ -1059,9 +1034,8 @@
    be freed in free_objfile().  */
 
 void
-extend_psymbol_list (listp, objfile)
-     register struct psymbol_allocation_list *listp;
-     struct objfile *objfile;
+extend_psymbol_list (register struct psymbol_allocation_list *listp,
+		     struct objfile *objfile)
 {
   int new_size;
   if (listp->size == 0)
@@ -1086,7 +1060,7 @@
 
 /* Do early runtime initializations. */
 void
-_initialize_symmisc ()
+_initialize_symmisc (void)
 {
   std_in = stdin;
   std_out = stdout;
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 5f0e84a..5cb29e4 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -35,6 +35,7 @@
 #include "language.h"
 #include "demangle.h"
 #include "inferior.h"
+#include "linespec.h"
 
 #include "obstack.h"
 
@@ -51,16 +52,8 @@
 
 /* Prototypes for local functions */
 
-static int find_methods (struct type *, char *, struct symbol **);
-
 static void completion_list_add_name (char *, char *, int, char *, char *);
 
-static void build_canonical_line_spec (struct symtab_and_line *,
-				       char *, char ***);
-
-static struct symtabs_and_lines decode_line_2 (struct symbol *[],
-					       int, int, char ***);
-
 static void rbreak_command (char *, int);
 
 static void types_info (char *, int);
@@ -73,21 +66,24 @@
 
 static void output_source_filename (char *, int *);
 
-char *operator_chars (char *, char **);
-
 static int find_line_common (struct linetable *, int, int *);
 
-static struct partial_symbol *lookup_partial_symbol PARAMS
-  ((struct partial_symtab *, const char *,
-    int, namespace_enum));
+/* This one is used by linespec.c */
 
-static struct partial_symbol *fixup_psymbol_section (struct
-						     partial_symbol *,
-						     struct objfile *);
+char *operator_chars (char *p, char **end);
+
+static struct partial_symbol *lookup_partial_symbol (struct partial_symtab *,
+						     const char *, int,
+						     namespace_enum);
 
 static struct symtab *lookup_symtab_1 (char *);
 
-static void cplusplus_hint (char *);
+static struct symbol *lookup_symbol_aux (const char *name, const
+					 struct block *block, const
+					 namespace_enum namespace, int
+					 *is_a_field_of_this, struct
+					 symtab **symtab);
+
 
 static struct symbol *find_active_alias (struct symbol *sym, CORE_ADDR addr);
 
@@ -121,15 +117,12 @@
 
 const struct block *block_found;
 
-char no_symtab_msg[] = "No symbol table is loaded.  Use the \"file\" command.";
-
 /* While the C++ support is still in flux, issue a possibly helpful hint on
    using the new command completion feature on single quoted demangled C++
    symbols.  Remove when loose ends are cleaned up.   FIXME -fnf */
 
 static void
-cplusplus_hint (name)
-     char *name;
+cplusplus_hint (char *name)
 {
   while (*name == '\'')
     name++;
@@ -142,8 +135,7 @@
    in the symtab filename will also work.  */
 
 static struct symtab *
-lookup_symtab_1 (name)
-     char *name;
+lookup_symtab_1 (char *name)
 {
   register struct symtab *s;
   register struct partial_symtab *ps;
@@ -206,8 +198,7 @@
    of variations if the first lookup doesn't work.  */
 
 struct symtab *
-lookup_symtab (name)
-     char *name;
+lookup_symtab (char *name)
 {
   register struct symtab *s;
 #if 0
@@ -244,8 +235,7 @@
    in the psymtab filename will also work.  */
 
 struct partial_symtab *
-lookup_partial_symtab (name)
-     char *name;
+lookup_partial_symtab (char *name)
 {
   register struct partial_symtab *pst;
   register struct objfile *objfile;
@@ -282,9 +272,7 @@
    specified by SIGNATURE_ID.  Note that this function is g++ specific. */
 
 char *
-gdb_mangle_name (type, method_id, signature_id)
-     struct type *type;
-     int method_id, signature_id;
+gdb_mangle_name (struct type *type, int method_id, int signature_id)
 {
   int mangled_name_len;
   char *mangled_name;
@@ -306,6 +294,9 @@
   char buf[20];
   int len = (newname == NULL ? 0 : strlen (newname));
 
+  if (OPNAME_PREFIX_P (field_name))
+    return xstrdup (physname);
+
   is_full_physname_constructor =
     ((physname[0] == '_' && physname[1] == '_' &&
       (isdigit (physname[2]) || physname[2] == 'Q' || physname[2] == 't'))
@@ -341,25 +332,8 @@
       sprintf (buf, "__%s%s%d", const_prefix, volatile_prefix, len);
     }
   mangled_name_len = ((is_constructor ? 0 : strlen (field_name))
-		      + strlen (buf) + len
-		      + strlen (physname)
-		      + 1);
+		      + strlen (buf) + len + strlen (physname) + 1);
 
-  /* Only needed for GNU-mangled names.  ANSI-mangled names
-     work with the normal mechanisms.  */
-  if (OPNAME_PREFIX_P (field_name))
-    {
-      const char *opname = cplus_mangle_opname (field_name + 3, 0);
-      if (opname == NULL)
-	error ("No mangling for \"%s\"", field_name);
-      mangled_name_len += strlen (opname);
-      mangled_name = (char *) xmalloc (mangled_name_len);
-
-      strncpy (mangled_name, field_name, 3);
-      mangled_name[3] = '\0';
-      strcat (mangled_name, opname);
-    }
-  else
     {
       mangled_name = (char *) xmalloc (mangled_name_len);
       if (is_constructor)
@@ -383,9 +357,7 @@
 /* Find which partial symtab on contains PC and SECTION.  Return 0 if none.  */
 
 struct partial_symtab *
-find_pc_sect_psymtab (pc, section)
-     CORE_ADDR pc;
-     asection *section;
+find_pc_sect_psymtab (CORE_ADDR pc, asection *section)
 {
   register struct partial_symtab *pst;
   register struct objfile *objfile;
@@ -432,8 +404,7 @@
    Backward compatibility, no section */
 
 struct partial_symtab *
-find_pc_psymtab (pc)
-     CORE_ADDR pc;
+find_pc_psymtab (CORE_ADDR pc)
 {
   return find_pc_sect_psymtab (pc, find_pc_mapped_section (pc));
 }
@@ -442,10 +413,8 @@
    Return 0 if none.  Check all psymtabs if PSYMTAB is 0.  */
 
 struct partial_symbol *
-find_pc_sect_psymbol (psymtab, pc, section)
-     struct partial_symtab *psymtab;
-     CORE_ADDR pc;
-     asection *section;
+find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
+		      asection *section)
 {
   struct partial_symbol *best = NULL, *p, **pp;
   CORE_ADDR best_pc;
@@ -516,9 +485,7 @@
    Check all psymtabs if PSYMTAB is 0.  Backwards compatibility, no section. */
 
 struct partial_symbol *
-find_pc_psymbol (psymtab, pc)
-     struct partial_symtab *psymtab;
-     CORE_ADDR pc;
+find_pc_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc)
 {
   return find_pc_sect_psymbol (psymtab, pc, find_pc_mapped_section (pc));
 }
@@ -527,21 +494,20 @@
    out of the minimal symbols and stash that in the debug symbol.  */
 
 static void
-fixup_section (ginfo, objfile)
-     struct general_symbol_info *ginfo;
-     struct objfile *objfile;
+fixup_section (struct general_symbol_info *ginfo, struct objfile *objfile)
 {
   struct minimal_symbol *msym;
   msym = lookup_minimal_symbol (ginfo->name, NULL, objfile);
 
   if (msym)
-    ginfo->bfd_section = SYMBOL_BFD_SECTION (msym);
+    {
+      ginfo->bfd_section = SYMBOL_BFD_SECTION (msym);
+      ginfo->section = SYMBOL_SECTION (msym);
+    }
 }
 
 struct symbol *
-fixup_symbol_section (sym, objfile)
-     struct symbol *sym;
-     struct objfile *objfile;
+fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
 {
   if (!sym)
     return NULL;
@@ -554,10 +520,8 @@
   return sym;
 }
 
-static struct partial_symbol *
-fixup_psymbol_section (psym, objfile)
-     struct partial_symbol *psym;
-     struct objfile *objfile;
+struct partial_symbol *
+fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile)
 {
   if (!psym)
     return NULL;
@@ -592,21 +556,64 @@
    can probably assume it will never hit the C++ code).  */
 
 struct symbol *
-lookup_symbol (name, block, namespace, is_a_field_of_this, symtab)
-     const char *name;
-     register const struct block *block;
-     const namespace_enum namespace;
-     int *is_a_field_of_this;
-     struct symtab **symtab;
+lookup_symbol (const char *name, const struct block *block,
+	       const namespace_enum namespace, int *is_a_field_of_this,
+	       struct symtab **symtab)
+{
+  char *modified_name = NULL;
+  char *modified_name2 = NULL;
+  int needtofreename = 0;
+  struct symbol *returnval;
+
+  if (case_sensitivity == case_sensitive_off)
+    {
+      char *copy;
+      int len, i;
+
+      len = strlen (name);
+      copy = (char *) alloca (len + 1);
+      for (i= 0; i < len; i++)
+        copy[i] = tolower (name[i]);
+      copy[len] = 0;
+      modified_name = copy;
+    }
+  else 
+      modified_name = (char *) name;
+
+  /* If we are using C++ language, demangle the name before doing a lookup, so
+     we can always binary search. */
+  if (current_language->la_language == language_cplus)
+    {
+      modified_name2 = cplus_demangle (modified_name, DMGL_ANSI | DMGL_PARAMS);
+      if (modified_name2)
+	{
+	  modified_name = modified_name2;
+	  needtofreename = 1;
+	}
+    }
+
+  returnval = lookup_symbol_aux (modified_name, block, namespace,
+				 is_a_field_of_this, symtab);
+  if (needtofreename)
+    xfree (modified_name2);
+
+  return returnval;	 
+}
+
+static struct symbol *
+lookup_symbol_aux (const char *name, const struct block *block,
+	       const namespace_enum namespace, int *is_a_field_of_this,
+	       struct symtab **symtab)
 {
   register struct symbol *sym;
   register struct symtab *s = NULL;
   register struct partial_symtab *ps;
-  struct blockvector *bv;
+  register struct blockvector *bv;
   register struct objfile *objfile = NULL;
   register struct block *b;
   register struct minimal_symbol *msymbol;
 
+
   /* Search specified block and its superiors.  */
 
   while (block != 0)
@@ -959,11 +966,8 @@
    symbols if GLOBAL, the static symbols if not */
 
 static struct partial_symbol *
-lookup_partial_symbol (pst, name, global, namespace)
-     struct partial_symtab *pst;
-     const char *name;
-     int global;
-     namespace_enum namespace;
+lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
+		       namespace_enum namespace)
 {
   struct partial_symbol *temp;
   struct partial_symbol **start, **psym;
@@ -1000,7 +1004,7 @@
 	    {
 	      do_linear_search = 1;
 	    }
-	  if (STRCMP (SYMBOL_NAME (*center), name) >= 0)
+	  if (STRCMP (SYMBOL_SOURCE_NAME (*center), name) >= 0)
 	    {
 	      top = center;
 	    }
@@ -1054,8 +1058,7 @@
 
 
 struct type *
-lookup_transparent_type (name)
-     const char *name;
+lookup_transparent_type (const char *name)
 {
   register struct symbol *sym;
   register struct symtab *s = NULL;
@@ -1163,7 +1166,7 @@
    executables that have no main() ? */
 
 struct partial_symtab *
-find_main_psymtab ()
+find_main_psymtab (void)
 {
   register struct partial_symtab *pst;
   register struct objfile *objfile;
@@ -1190,10 +1193,8 @@
    tested for a match. */
 
 struct symbol *
-lookup_block_symbol (block, name, namespace)
-     register const struct block *block;
-     const char *name;
-     const namespace_enum namespace;
+lookup_block_symbol (register const struct block *block, const char *name,
+		     const namespace_enum namespace)
 {
   register int bot, top, inc;
   register struct symbol *sym;
@@ -1206,9 +1207,7 @@
     {
       /* Reset the linear search flag so if the binary search fails, we
          won't do the linear search once unless we find some reason to
-         do so, such as finding a C++ symbol during the binary search.
-         Note that for C++ modules, ALL the symbols in a block should
-         end up marked as C++ symbols. */
+         do so */
 
       do_linear_search = 0;
       top = BLOCK_NSYMS (block);
@@ -1226,22 +1225,19 @@
 	    }
 	  inc = (inc >> 1) + bot;
 	  sym = BLOCK_SYM (block, inc);
-	  if (!do_linear_search
-	      && (SYMBOL_LANGUAGE (sym) == language_cplus
-		  || SYMBOL_LANGUAGE (sym) == language_java
-	      ))
+	  if (!do_linear_search && (SYMBOL_LANGUAGE (sym) == language_java))
 	    {
 	      do_linear_search = 1;
 	    }
-	  if (SYMBOL_NAME (sym)[0] < name[0])
+	  if (SYMBOL_SOURCE_NAME (sym)[0] < name[0])
 	    {
 	      bot = inc;
 	    }
-	  else if (SYMBOL_NAME (sym)[0] > name[0])
+	  else if (SYMBOL_SOURCE_NAME (sym)[0] > name[0])
 	    {
 	      top = inc;
 	    }
-	  else if (STRCMP (SYMBOL_NAME (sym), name) < 0)
+	  else if (STRCMP (SYMBOL_SOURCE_NAME (sym), name) < 0)
 	    {
 	      bot = inc;
 	    }
@@ -1263,19 +1259,8 @@
       while (bot < top)
 	{
 	  sym = BLOCK_SYM (block, bot);
-	  inc = SYMBOL_NAME (sym)[0] - name[0];
-	  if (inc == 0)
-	    {
-	      inc = STRCMP (SYMBOL_NAME (sym), name);
-	    }
-	  if (inc == 0 && SYMBOL_NAMESPACE (sym) == namespace)
-	    {
-	      return (sym);
-	    }
-	  if (inc > 0)
-	    {
-	      break;
-	    }
+	  if (SYMBOL_MATCHES_NAME (sym, name))
+	    return sym;
 	  bot++;
 	}
     }
@@ -1350,9 +1335,7 @@
    If no alias is active, then return SYM.  */
 
 static struct symbol *
-find_active_alias (sym, addr)
-     struct symbol *sym;
-     CORE_ADDR addr;
+find_active_alias (struct symbol *sym, CORE_ADDR addr)
 {
   struct range_list *r;
   struct alias_list *aliases;
@@ -1381,8 +1364,7 @@
    lexical block, described by a struct block BL.  */
 
 struct symbol *
-block_function (bl)
-     struct block *bl;
+block_function (struct block *bl)
 {
   while (BLOCK_FUNCTION (bl) == 0 && BLOCK_SUPERBLOCK (bl) != 0)
     bl = BLOCK_SUPERBLOCK (bl);
@@ -1394,9 +1376,7 @@
    psymtabs and read in another symtab if necessary. */
 
 struct symtab *
-find_pc_sect_symtab (pc, section)
-     CORE_ADDR pc;
-     asection *section;
+find_pc_sect_symtab (CORE_ADDR pc, asection *section)
 {
   register struct block *b;
   struct blockvector *bv;
@@ -1472,10 +1452,9 @@
 	/* Might want to error() here (in case symtab is corrupt and
 	   will cause a core dump), but maybe we can successfully
 	   continue, so let's not.  */
-	/* FIXME-32x64: assumes pc fits in a long */
 	warning ("\
-(Internal error: pc 0x%lx in read in psymtab, but not in symtab.)\n",
-		 (unsigned long) pc);
+(Internal error: pc 0x%s in read in psymtab, but not in symtab.)\n",
+		 paddr_nz (pc));
       s = PSYMTAB_TO_SYMTAB (ps);
     }
   return (s);
@@ -1485,8 +1464,7 @@
    read in another symtab if necessary.  Backward compatibility, no section */
 
 struct symtab *
-find_pc_symtab (pc)
-     CORE_ADDR pc;
+find_pc_symtab (CORE_ADDR pc)
 {
   return find_pc_sect_symtab (pc, find_pc_mapped_section (pc));
 }
@@ -1502,10 +1480,7 @@
    line *0x2345" cause psymtabs to be converted to symtabs).  */
 
 struct symbol *
-find_addr_symbol (addr, symtabp, symaddrp)
-     CORE_ADDR addr;
-     struct symtab **symtabp;
-     CORE_ADDR *symaddrp;
+find_addr_symbol (CORE_ADDR addr, struct symtab **symtabp, CORE_ADDR *symaddrp)
 {
   struct symtab *symtab, *best_symtab;
   struct objfile *objfile;
@@ -1585,7 +1560,7 @@
 }
 #endif /* 0 */
 
-/* Find the source file and line number for a given PC value and section.
+/* Find the source file and line number for a given PC value and SECTION.
    Return a structure containing a symtab pointer, a line number,
    and a pc range for the entire source line.
    The value's .pc field is NOT the specified pc.
@@ -1603,10 +1578,7 @@
 /* If it's worth the effort, we could be using a binary search.  */
 
 struct symtab_and_line
-find_pc_sect_line (pc, section, notcurrent)
-     CORE_ADDR pc;
-     struct sec *section;
-     int notcurrent;
+find_pc_sect_line (CORE_ADDR pc, struct sec *section, int notcurrent)
 {
   struct symtab *s;
   register struct linetable *l;
@@ -1829,9 +1801,7 @@
 /* Backward compatibility (no section) */
 
 struct symtab_and_line
-find_pc_line (pc, notcurrent)
-     CORE_ADDR pc;
-     int notcurrent;
+find_pc_line (CORE_ADDR pc, int notcurrent)
 {
   asection *section;
 
@@ -1841,9 +1811,6 @@
   return find_pc_sect_line (pc, section, notcurrent);
 }
 
-
-static struct symtab *find_line_symtab (struct symtab *, int, int *, int *);
-
 /* Find line number LINE in any symtab whose name is the same as
    SYMTAB.
 
@@ -1854,12 +1821,8 @@
 
    If not found, return NULL.  */
 
-static struct symtab *
-find_line_symtab (symtab, line, index, exact_match)
-     struct symtab *symtab;
-     int line;
-     int *index;
-     int *exact_match;
+struct symtab *
+find_line_symtab (struct symtab *symtab, int line, int *index, int *exact_match)
 {
   int exact;
 
@@ -1941,10 +1904,7 @@
    The source file is specified with a struct symtab.  */
 
 int
-find_line_pc (symtab, line, pc)
-     struct symtab *symtab;
-     int line;
-     CORE_ADDR *pc;
+find_line_pc (struct symtab *symtab, int line, CORE_ADDR *pc)
 {
   struct linetable *l;
   int ind;
@@ -1971,9 +1931,8 @@
    Returns 0 if could not find the specified line.  */
 
 int
-find_line_pc_range (sal, startptr, endptr)
-     struct symtab_and_line sal;
-     CORE_ADDR *startptr, *endptr;
+find_line_pc_range (struct symtab_and_line sal, CORE_ADDR *startptr,
+		    CORE_ADDR *endptr)
 {
   CORE_ADDR startaddr;
   struct symtab_and_line found_sal;
@@ -2011,10 +1970,8 @@
    Set *EXACT_MATCH nonzero if the value returned is an exact match.  */
 
 static int
-find_line_common (l, lineno, exact_match)
-     register struct linetable *l;
-     register int lineno;
-     int *exact_match;
+find_line_common (register struct linetable *l, register int lineno,
+		  int *exact_match)
 {
   register int i;
   register int len;
@@ -2057,9 +2014,7 @@
 }
 
 int
-find_pc_line_pc_range (pc, startptr, endptr)
-     CORE_ADDR pc;
-     CORE_ADDR *startptr, *endptr;
+find_pc_line_pc_range (CORE_ADDR pc, CORE_ADDR *startptr, CORE_ADDR *endptr)
 {
   struct symtab_and_line sal;
   sal = find_pc_line (pc, 0);
@@ -2073,13 +2028,8 @@
    If the argument FUNFIRSTLINE is nonzero, we want the first line
    of real code inside the function.  */
 
-static struct symtab_and_line
-find_function_start_sal (struct symbol *sym, int);
-
-static struct symtab_and_line
-find_function_start_sal (sym, funfirstline)
-     struct symbol *sym;
-     int funfirstline;
+struct symtab_and_line
+find_function_start_sal (struct symbol *sym, int funfirstline)
 {
   CORE_ADDR pc;
   struct symtab_and_line sal;
@@ -2123,15 +2073,13 @@
 
   return sal;
 }
-
+
 /* If P is of the form "operator[ \t]+..." where `...' is
    some legitimate operator text, return a pointer to the
    beginning of the substring of the operator text.
    Otherwise, return "".  */
 char *
-operator_chars (p, end)
-     char *p;
-     char **end;
+operator_chars (char *p, char **end)
 {
   *end = "";
   if (strncmp (p, "operator", 8))
@@ -2208,1239 +2156,13 @@
   *end = "";
   return *end;
 }
-
-/* Return the number of methods described for TYPE, including the
-   methods from types it derives from. This can't be done in the symbol
-   reader because the type of the baseclass might still be stubbed
-   when the definition of the derived class is parsed.  */
-
-static int total_number_of_methods (struct type *type);
-
-static int
-total_number_of_methods (type)
-     struct type *type;
-{
-  int n;
-  int count;
-
-  CHECK_TYPEDEF (type);
-  if (TYPE_CPLUS_SPECIFIC (type) == NULL)
-    return 0;
-  count = TYPE_NFN_FIELDS_TOTAL (type);
-
-  for (n = 0; n < TYPE_N_BASECLASSES (type); n++)
-    count += total_number_of_methods (TYPE_BASECLASS (type, n));
-
-  return count;
-}
-
-/* Recursive helper function for decode_line_1.
-   Look for methods named NAME in type T.
-   Return number of matches.
-   Put matches in SYM_ARR, which should have been allocated with
-   a size of total_number_of_methods (T) * sizeof (struct symbol *).
-   Note that this function is g++ specific.  */
-
-static int
-find_methods (t, name, sym_arr)
-     struct type *t;
-     char *name;
-     struct symbol **sym_arr;
-{
-  int i1 = 0;
-  int ibase;
-  struct symbol *sym_class;
-  char *class_name = type_name_no_tag (t);
-
-  /* Ignore this class if it doesn't have a name.  This is ugly, but
-     unless we figure out how to get the physname without the name of
-     the class, then the loop can't do any good.  */
-  if (class_name
-      && (sym_class = lookup_symbol (class_name,
-				     (struct block *) NULL,
-				     STRUCT_NAMESPACE,
-				     (int *) NULL,
-				     (struct symtab **) NULL)))
-    {
-      int method_counter;
-
-      /* FIXME: Shouldn't this just be CHECK_TYPEDEF (t)?  */
-      t = SYMBOL_TYPE (sym_class);
-
-      /* Loop over each method name.  At this level, all overloads of a name
-         are counted as a single name.  There is an inner loop which loops over
-         each overload.  */
-
-      for (method_counter = TYPE_NFN_FIELDS (t) - 1;
-	   method_counter >= 0;
-	   --method_counter)
-	{
-	  int field_counter;
-	  char *method_name = TYPE_FN_FIELDLIST_NAME (t, method_counter);
-	  char dem_opname[64];
-
-	  if (strncmp (method_name, "__", 2) == 0 ||
-	      strncmp (method_name, "op", 2) == 0 ||
-	      strncmp (method_name, "type", 4) == 0)
-	    {
-	      if (cplus_demangle_opname (method_name, dem_opname, DMGL_ANSI))
-		method_name = dem_opname;
-	      else if (cplus_demangle_opname (method_name, dem_opname, 0))
-		method_name = dem_opname;
-	    }
-
-	  if (STREQ (name, method_name))
-	    /* Find all the overloaded methods with that name.  */
-	    for (field_counter = TYPE_FN_FIELDLIST_LENGTH (t, method_counter) - 1;
-		 field_counter >= 0;
-		 --field_counter)
-	      {
-		struct fn_field *f;
-		char *phys_name;
-
-		f = TYPE_FN_FIELDLIST1 (t, method_counter);
-
-		if (TYPE_FN_FIELD_STUB (f, field_counter))
-		  {
-		    char *tmp_name;
-
-		    tmp_name = gdb_mangle_name (t,
-						method_counter,
-						field_counter);
-		    phys_name = alloca (strlen (tmp_name) + 1);
-		    strcpy (phys_name, tmp_name);
-		    free (tmp_name);
-		  }
-		else
-		  phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
-
-		/* Destructor is handled by caller, dont add it to the list */
-		if (DESTRUCTOR_PREFIX_P (phys_name))
-		  continue;
-
-		sym_arr[i1] = lookup_symbol (phys_name,
-					     NULL, VAR_NAMESPACE,
-					     (int *) NULL,
-					     (struct symtab **) NULL);
-		if (sym_arr[i1])
-		  i1++;
-		else
-		  {
-		    /* This error message gets printed, but the method
-		       still seems to be found
-		       fputs_filtered("(Cannot find method ", gdb_stdout);
-		       fprintf_symbol_filtered (gdb_stdout, phys_name,
-		       language_cplus,
-		       DMGL_PARAMS | DMGL_ANSI);
-		       fputs_filtered(" - possibly inlined.)\n", gdb_stdout);
-		     */
-		  }
-	      }
-	}
-    }
-
-  /* Only search baseclasses if there is no match yet, since names in
-     derived classes override those in baseclasses.
-
-     FIXME: The above is not true; it is only true of member functions
-     if they have the same number of arguments (??? - section 13.1 of the
-     ARM says the function members are not in the same scope but doesn't
-     really spell out the rules in a way I understand.  In any case, if
-     the number of arguments differ this is a case in which we can overload
-     rather than hiding without any problem, and gcc 2.4.5 does overload
-     rather than hiding in this case).  */
-
-  if (i1 == 0)
-    for (ibase = 0; ibase < TYPE_N_BASECLASSES (t); ibase++)
-      i1 += find_methods (TYPE_BASECLASS (t, ibase), name, sym_arr + i1);
-
-  return i1;
-}
-
-/* Helper function for decode_line_1.
-   Build a canonical line spec in CANONICAL if it is non-NULL and if
-   the SAL has a symtab.
-   If SYMNAME is non-NULL the canonical line spec is `filename:symname'.
-   If SYMNAME is NULL the line number from SAL is used and the canonical
-   line spec is `filename:linenum'.  */
-
-static void
-build_canonical_line_spec (sal, symname, canonical)
-     struct symtab_and_line *sal;
-     char *symname;
-     char ***canonical;
-{
-  char **canonical_arr;
-  char *canonical_name;
-  char *filename;
-  struct symtab *s = sal->symtab;
-
-  if (s == (struct symtab *) NULL
-      || s->filename == (char *) NULL
-      || canonical == (char ***) NULL)
-    return;
-
-  canonical_arr = (char **) xmalloc (sizeof (char *));
-  *canonical = canonical_arr;
-
-  filename = s->filename;
-  if (symname != NULL)
-    {
-      canonical_name = xmalloc (strlen (filename) + strlen (symname) + 2);
-      sprintf (canonical_name, "%s:%s", filename, symname);
-    }
-  else
-    {
-      canonical_name = xmalloc (strlen (filename) + 30);
-      sprintf (canonical_name, "%s:%d", filename, sal->line);
-    }
-  canonical_arr[0] = canonical_name;
-}
-
-
-
-/* Find an instance of the character C in the string S that is outside
-   of all parenthesis pairs, single-quoted strings, and double-quoted
-   strings.  */
-static char *
-find_toplevel_char (char *s, char c)
-{
-  int quoted = 0;		/* zero if we're not in quotes;
-				   '"' if we're in a double-quoted string;
-				   '\'' if we're in a single-quoted string.  */
-  int depth = 0;		/* number of unclosed parens we've seen */
-  char *scan;
-
-  for (scan = s; *scan; scan++)
-    {
-      if (quoted)
-	{
-	  if (*scan == quoted)
-	    quoted = 0;
-	  else if (*scan == '\\' && *(scan + 1))
-	    scan++;
-	}
-      else if (*scan == c && ! quoted && depth == 0)
-	return scan;
-      else if (*scan == '"' || *scan == '\'')
-	quoted = *scan;
-      else if (*scan == '(')
-	depth++;
-      else if (*scan == ')' && depth > 0)
-	depth--;
-    }
-
-  return 0;
-}
-
-
-/* Parse a string that specifies a line number.
-   Pass the address of a char * variable; that variable will be
-   advanced over the characters actually parsed.
-
-   The string can be:
-
-   LINENUM -- that line number in current file.  PC returned is 0.
-   FILE:LINENUM -- that line in that file.  PC returned is 0.
-   FUNCTION -- line number of openbrace of that function.
-   PC returned is the start of the function.
-   VARIABLE -- line number of definition of that variable.
-   PC returned is 0.
-   FILE:FUNCTION -- likewise, but prefer functions in that file.
-   *EXPR -- line in which address EXPR appears.
-
-   This may all be followed by an "if EXPR", which we ignore.
-
-   FUNCTION may be an undebuggable function found in minimal symbol table.
-
-   If the argument FUNFIRSTLINE is nonzero, we want the first line
-   of real code inside a function when a function is specified, and it is
-   not OK to specify a variable or type to get its line number.
-
-   DEFAULT_SYMTAB specifies the file to use if none is specified.
-   It defaults to current_source_symtab.
-   DEFAULT_LINE specifies the line number to use for relative
-   line numbers (that start with signs).  Defaults to current_source_line.
-   If CANONICAL is non-NULL, store an array of strings containing the canonical
-   line specs there if necessary. Currently overloaded member functions and
-   line numbers 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 callers responsibility to free them.
-
-   Note that it is possible to return zero for the symtab
-   if no file is validly specified.  Callers must check that.
-   Also, the line number returned may be invalid.  */
-
-/* We allow single quotes in various places.  This is a hideous
-   kludge, which exists because the completer can't yet deal with the
-   lack of single quotes.  FIXME: write a linespec_completer which we
-   can use as appropriate instead of make_symbol_completion_list.  */
-
-struct symtabs_and_lines
-decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
-     char **argptr;
-     int funfirstline;
-     struct symtab *default_symtab;
-     int default_line;
-     char ***canonical;
-{
-  struct symtabs_and_lines values;
-#ifdef HPPA_COMPILER_BUG
-  /* FIXME: The native HP 9000/700 compiler has a bug which appears
-     when optimizing this file with target i960-vxworks.  I haven't
-     been able to construct a simple test case.  The problem is that
-     in the second call to SKIP_PROLOGUE below, the compiler somehow
-     does not realize that the statement val = find_pc_line (...) will
-     change the values of the fields of val.  It extracts the elements
-     into registers at the top of the block, and does not update the
-     registers after the call to find_pc_line.  You can check this by
-     inserting a printf at the end of find_pc_line to show what values
-     it is returning for val.pc and val.end and another printf after
-     the call to see what values the function actually got (remember,
-     this is compiling with cc -O, with this patch removed).  You can
-     also examine the assembly listing: search for the second call to
-     skip_prologue; the LDO statement before the next call to
-     find_pc_line loads the address of the structure which
-     find_pc_line will return; if there is a LDW just before the LDO,
-     which fetches an element of the structure, then the compiler
-     still has the bug.
-
-     Setting val to volatile avoids the problem.  We must undef
-     volatile, because the HPPA native compiler does not define
-     __STDC__, although it does understand volatile, and so volatile
-     will have been defined away in defs.h.  */
-#undef volatile
-  volatile struct symtab_and_line val;
-#define volatile		/*nothing */
-#else
-  struct symtab_and_line val;
-#endif
-  register char *p, *p1;
-  char *q, *pp, *ii, *p2;
-#if 0
-  char *q1;
-#endif
-  register struct symtab *s;
-
-  register struct symbol *sym;
-  /* The symtab that SYM was found in.  */
-  struct symtab *sym_symtab;
-
-  register CORE_ADDR pc;
-  register struct minimal_symbol *msymbol;
-  char *copy;
-  struct symbol *sym_class;
-  int i1;
-  int is_quoted;
-  int is_quote_enclosed;
-  int has_parens;
-  int has_if = 0;
-  int has_comma = 0;
-  struct symbol **sym_arr;
-  struct type *t;
-  char *saved_arg = *argptr;
-  extern char *gdb_completer_quote_characters;
-
-  INIT_SAL (&val);		/* initialize to zeroes */
-
-  /* Defaults have defaults.  */
-
-  if (default_symtab == 0)
-    {
-      default_symtab = current_source_symtab;
-      default_line = current_source_line;
-    }
-
-  /* See if arg is *PC */
-
-  if (**argptr == '*')
-    {
-      (*argptr)++;
-      pc = parse_and_eval_address_1 (argptr);
-
-      values.sals = (struct symtab_and_line *)
-	xmalloc (sizeof (struct symtab_and_line));
-
-      values.nelts = 1;
-      values.sals[0] = find_pc_line (pc, 0);
-      values.sals[0].pc = pc;
-      values.sals[0].section = find_pc_overlay (pc);
-
-      return values;
-    }
-
-  /* 'has_if' is for the syntax:
-   *     (gdb) break foo if (a==b)
-   */
-  if ((ii = strstr (*argptr, " if ")) != NULL ||
-      (ii = strstr (*argptr, "\tif ")) != NULL ||
-      (ii = strstr (*argptr, " if\t")) != NULL ||
-      (ii = strstr (*argptr, "\tif\t")) != NULL ||
-      (ii = strstr (*argptr, " if(")) != NULL ||
-      (ii = strstr (*argptr, "\tif( ")) != NULL)
-    has_if = 1;
-  /* Temporarily zap out "if (condition)" to not
-   * confuse the parenthesis-checking code below.
-   * This is undone below. Do not change ii!!
-   */
-  if (has_if)
-    {
-      *ii = '\0';
-    }
-
-  /* Set various flags.
-   * 'has_parens' is important for overload checking, where
-   * we allow things like: 
-   *     (gdb) break c::f(int)
-   */
-
-  /* Maybe arg is FILE : LINENUM or FILE : FUNCTION */
-
-  is_quoted = (**argptr
-	       && strchr (gdb_completer_quote_characters, **argptr) != NULL);
-
-  has_parens = ((pp = strchr (*argptr, '(')) != NULL
-		&& (pp = strrchr (pp, ')')) != NULL);
-
-  /* Now that we're safely past the has_parens check,
-   * put back " if (condition)" so outer layers can see it 
-   */
-  if (has_if)
-    *ii = ' ';
-
-  /* Maybe we were called with a line range FILENAME:LINENUM,FILENAME:LINENUM
-     and we must isolate the first half.  Outer layers will call again later
-     for the second half.
-
-     Don't count commas that appear in argument lists of overloaded
-     functions, or in quoted strings.  It's stupid to go to this much
-     trouble when the rest of the function is such an obvious roach hotel.  */
-  ii = find_toplevel_char (*argptr, ',');
-  has_comma = (ii != 0);
-
-  /* Temporarily zap out second half to not
-   * confuse the code below.
-   * This is undone below. Do not change ii!!
-   */
-  if (has_comma)
-    {
-      *ii = '\0';
-    }
-
-  /* Maybe arg is FILE : LINENUM or FILE : FUNCTION */
-  /* May also be CLASS::MEMBER, or NAMESPACE::NAME */
-  /* Look for ':', but ignore inside of <> */
-
-  s = NULL;
-  p = *argptr;
-  if (p[0] == '"')
-    {
-      is_quote_enclosed = 1;
-      p++;
-    }
-  else
-    is_quote_enclosed = 0;
-  for (; *p; p++)
-    {
-      if (p[0] == '<')
-	{
-	  char *temp_end = find_template_name_end (p);
-	  if (!temp_end)
-	    error ("malformed template specification in command");
-	  p = temp_end;
-	}
-      /* Check for the end of the first half of the linespec.  End of line,
-         a tab, a double colon or the last single colon, or a space.  But
-         if enclosed in double quotes we do not break on enclosed spaces */
-      if (!*p
-	  || p[0] == '\t'
-	  || ((p[0] == ':')
-	      && ((p[1] == ':') || (strchr (p + 1, ':') == NULL)))
-	  || ((p[0] == ' ') && !is_quote_enclosed))
-	break;
-      if (p[0] == '.' && strchr (p, ':') == NULL)	/* Java qualified method. */
-	{
-	  /* Find the *last* '.', since the others are package qualifiers. */
-	  for (p1 = p; *p1; p1++)
-	    {
-	      if (*p1 == '.')
-		p = p1;
-	    }
-	  break;
-	}
-    }
-  while (p[0] == ' ' || p[0] == '\t')
-    p++;
-
-  /* if the closing double quote was left at the end, remove it */
-  if (is_quote_enclosed)
-    {
-      char *closing_quote = strchr (p, '"');
-      if (closing_quote && closing_quote[1] == '\0')
-	*closing_quote = '\0';
-    }
-
-  /* Now that we've safely parsed the first half,
-   * put back ',' so outer layers can see it 
-   */
-  if (has_comma)
-    *ii = ',';
-
-  if ((p[0] == ':' || p[0] == '.') && !has_parens)
-    {
-      /*  C++ */
-      /*  ... or Java */
-      if (is_quoted)
-	*argptr = *argptr + 1;
-      if (p[0] == '.' || p[1] == ':')
-	{
-	  char *saved_arg2 = *argptr;
-	  char *temp_end;
-	  /* First check for "global" namespace specification,
-	     of the form "::foo". If found, skip over the colons
-	     and jump to normal symbol processing */
-	  if ((*argptr == p) || (p[-1] == ' ') || (p[-1] == '\t'))
-	    saved_arg2 += 2;
-
-	  /* We have what looks like a class or namespace
-	     scope specification (A::B), possibly with many
-	     levels of namespaces or classes (A::B::C::D).
-
-	     Some versions of the HP ANSI C++ compiler (as also possibly
-	     other compilers) generate class/function/member names with
-	     embedded double-colons if they are inside namespaces. To
-	     handle this, we loop a few times, considering larger and
-	     larger prefixes of the string as though they were single
-	     symbols.  So, if the initially supplied string is
-	     A::B::C::D::foo, we have to look up "A", then "A::B",
-	     then "A::B::C", then "A::B::C::D", and finally
-	     "A::B::C::D::foo" as single, monolithic symbols, because
-	     A, B, C or D may be namespaces.
-
-	     Note that namespaces can nest only inside other
-	     namespaces, and not inside classes.  So we need only
-	     consider *prefixes* of the string; there is no need to look up
-	     "B::C" separately as a symbol in the previous example. */
-
-	  p2 = p;		/* save for restart */
-	  while (1)
-	    {
-	      /* Extract the class name.  */
-	      p1 = p;
-	      while (p != *argptr && p[-1] == ' ')
-		--p;
-	      copy = (char *) alloca (p - *argptr + 1);
-	      memcpy (copy, *argptr, p - *argptr);
-	      copy[p - *argptr] = 0;
-
-	      /* Discard the class name from the arg.  */
-	      p = p1 + (p1[0] == ':' ? 2 : 1);
-	      while (*p == ' ' || *p == '\t')
-		p++;
-	      *argptr = p;
-
-	      sym_class = lookup_symbol (copy, 0, STRUCT_NAMESPACE, 0,
-					 (struct symtab **) NULL);
-
-	      if (sym_class &&
-		  (t = check_typedef (SYMBOL_TYPE (sym_class)),
-		   (TYPE_CODE (t) == TYPE_CODE_STRUCT
-		    || TYPE_CODE (t) == TYPE_CODE_UNION)))
-		{
-		  /* Arg token is not digits => try it as a function name
-		     Find the next token(everything up to end or next blank). */
-		  if (**argptr
-		      && strchr (gdb_completer_quote_characters, **argptr) != NULL)
-		    {
-		      p = skip_quoted (*argptr);
-		      *argptr = *argptr + 1;
-		    }
-		  else
-		    {
-		      p = *argptr;
-		      while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p != ':')
-			p++;
-		    }
-/*
-   q = operator_chars (*argptr, &q1);
-   if (q1 - q)
-   {
-   char *opname;
-   char *tmp = alloca (q1 - q + 1);
-   memcpy (tmp, q, q1 - q);
-   tmp[q1 - q] = '\0';
-   opname = cplus_mangle_opname (tmp, DMGL_ANSI);
-   if (opname == NULL)
-   {
-   error_begin ();
-   printf_filtered ("no mangling for \"%s\"\n", tmp);
-   cplusplus_hint (saved_arg);
-   return_to_top_level (RETURN_ERROR);
-   }
-   copy = (char*) alloca (3 + strlen(opname));
-   sprintf (copy, "__%s", opname);
-   p = q1;
-   }
-   else
- */
-		  {
-		    copy = (char *) alloca (p - *argptr + 1);
-		    memcpy (copy, *argptr, p - *argptr);
-		    copy[p - *argptr] = '\0';
-		    if (p != *argptr
-			&& copy[p - *argptr - 1]
-			&& strchr (gdb_completer_quote_characters,
-				   copy[p - *argptr - 1]) != NULL)
-		      copy[p - *argptr - 1] = '\0';
-		  }
-
-		  /* no line number may be specified */
-		  while (*p == ' ' || *p == '\t')
-		    p++;
-		  *argptr = p;
-
-		  sym = 0;
-		  i1 = 0;	/*  counter for the symbol array */
-		  sym_arr = (struct symbol **) alloca (total_number_of_methods (t)
-						* sizeof (struct symbol *));
-
-		  if (destructor_name_p (copy, t))
-		    {
-		      /* Destructors are a special case.  */
-		      int m_index, f_index;
-
-		      if (get_destructor_fn_field (t, &m_index, &f_index))
-			{
-			  struct fn_field *f = TYPE_FN_FIELDLIST1 (t, m_index);
-
-			  sym_arr[i1] =
-			    lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, f_index),
-					   NULL, VAR_NAMESPACE, (int *) NULL,
-					   (struct symtab **) NULL);
-			  if (sym_arr[i1])
-			    i1++;
-			}
-		    }
-		  else
-		    i1 = find_methods (t, copy, sym_arr);
-		  if (i1 == 1)
-		    {
-		      /* There is exactly one field with that name.  */
-		      sym = sym_arr[0];
-
-		      if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
-			{
-			  values.sals = (struct symtab_and_line *)
-			    xmalloc (sizeof (struct symtab_and_line));
-			  values.nelts = 1;
-			  values.sals[0] = find_function_start_sal (sym,
-							      funfirstline);
-			}
-		      else
-			{
-			  values.nelts = 0;
-			}
-		      return values;
-		    }
-		  if (i1 > 0)
-		    {
-		      /* There is more than one field with that name
-		         (overloaded).  Ask the user which one to use.  */
-		      return decode_line_2 (sym_arr, i1, funfirstline, canonical);
-		    }
-		  else
-		    {
-		      char *tmp;
-
-		      if (OPNAME_PREFIX_P (copy))
-			{
-			  tmp = (char *) alloca (strlen (copy + 3) + 9);
-			  strcpy (tmp, "operator ");
-			  strcat (tmp, copy + 3);
-			}
-		      else
-			tmp = copy;
-		      error_begin ();
-		      if (tmp[0] == '~')
-			printf_filtered
-			  ("the class `%s' does not have destructor defined\n",
-			   SYMBOL_SOURCE_NAME (sym_class));
-		      else
-			printf_filtered
-			  ("the class %s does not have any method named %s\n",
-			   SYMBOL_SOURCE_NAME (sym_class), tmp);
-		      cplusplus_hint (saved_arg);
-		      return_to_top_level (RETURN_ERROR);
-		    }
-		}
-
-	      /* Move pointer up to next possible class/namespace token */
-	      p = p2 + 1;	/* restart with old value +1 */
-	      /* Move pointer ahead to next double-colon */
-	      while (*p && (p[0] != ' ') && (p[0] != '\t') && (p[0] != '\''))
-		{
-		  if (p[0] == '<')
-		    {
-		      temp_end = find_template_name_end (p);
-		      if (!temp_end)
-			error ("malformed template specification in command");
-		      p = temp_end;
-		    }
-		  else if ((p[0] == ':') && (p[1] == ':'))
-		    break;	/* found double-colon */
-		  else
-		    p++;
-		}
-
-	      if (*p != ':')
-		break;		/* out of the while (1) */
-
-	      p2 = p;		/* save restart for next time around */
-	      *argptr = saved_arg2;	/* restore argptr */
-	    }			/* while (1) */
-
-	  /* Last chance attempt -- check entire name as a symbol */
-	  /* Use "copy" in preparation for jumping out of this block,
-	     to be consistent with usage following the jump target */
-	  copy = (char *) alloca (p - saved_arg2 + 1);
-	  memcpy (copy, saved_arg2, p - saved_arg2);
-	  /* Note: if is_quoted should be true, we snuff out quote here anyway */
-	  copy[p - saved_arg2] = '\000';
-	  /* Set argptr to skip over the name */
-	  *argptr = (*p == '\'') ? p + 1 : p;
-	  /* Look up entire name */
-	  sym = lookup_symbol (copy, 0, VAR_NAMESPACE, 0, &sym_symtab);
-	  s = (struct symtab *) 0;
-	  /* Prepare to jump: restore the " if (condition)" so outer layers see it */
-	  /* Symbol was found --> jump to normal symbol processing.
-	     Code following "symbol_found" expects "copy" to have the
-	     symbol name, "sym" to have the symbol pointer, "s" to be
-	     a specified file's symtab, and sym_symtab to be the symbol's
-	     symtab. */
-	  /* By jumping there we avoid falling through the FILE:LINE and
-	     FILE:FUNC processing stuff below */
-	  if (sym)
-	    goto symbol_found;
-
-	  /* Couldn't find any interpretation as classes/namespaces, so give up */
-	  error_begin ();
-	  /* The quotes are important if copy is empty.  */
-	  printf_filtered
-	    ("Can't find member of namespace, class, struct, or union named \"%s\"\n", copy);
-	  cplusplus_hint (saved_arg);
-	  return_to_top_level (RETURN_ERROR);
-	}
-      /*  end of C++  */
-
-
-      /* Extract the file name.  */
-      p1 = p;
-      while (p != *argptr && p[-1] == ' ')
-	--p;
-      if ((*p == '"') && is_quote_enclosed)
-	--p;
-      copy = (char *) alloca (p - *argptr + 1);
-      if ((**argptr == '"') && is_quote_enclosed)
-	{
-	  memcpy (copy, *argptr + 1, p - *argptr - 1);
-	  /* It may have the ending quote right after the file name */
-	  if (copy[p - *argptr - 2] == '"')
-	    copy[p - *argptr - 2] = 0;
-	  else
-	    copy[p - *argptr - 1] = 0;
-	}
-      else
-	{
-	  memcpy (copy, *argptr, p - *argptr);
-	  copy[p - *argptr] = 0;
-	}
-
-      /* Find that file's data.  */
-      s = lookup_symtab (copy);
-      if (s == 0)
-	{
-	  if (!have_full_symbols () && !have_partial_symbols ())
-	    error (no_symtab_msg);
-	  error ("No source file named %s.", copy);
-	}
-
-      /* Discard the file name from the arg.  */
-      p = p1 + 1;
-      while (*p == ' ' || *p == '\t')
-	p++;
-      *argptr = p;
-    }
-#if 0
-  /* No one really seems to know why this was added. It certainly
-     breaks the command line, though, whenever the passed
-     name is of the form ClassName::Method. This bit of code
-     singles out the class name, and if funfirstline is set (for
-     example, you are setting a breakpoint at this function),
-     you get an error. This did not occur with earlier
-     verions, so I am ifdef'ing this out. 3/29/99 */
-  else
-    {
-      /* Check if what we have till now is a symbol name */
-
-      /* We may be looking at a template instantiation such
-         as "foo<int>".  Check here whether we know about it,
-         instead of falling through to the code below which
-         handles ordinary function names, because that code
-         doesn't like seeing '<' and '>' in a name -- the
-         skip_quoted call doesn't go past them.  So see if we
-         can figure it out right now. */
-
-      copy = (char *) alloca (p - *argptr + 1);
-      memcpy (copy, *argptr, p - *argptr);
-      copy[p - *argptr] = '\000';
-      sym = lookup_symbol (copy, 0, VAR_NAMESPACE, 0, &sym_symtab);
-      if (sym)
-	{
-	  /* Yes, we have a symbol; jump to symbol processing */
-	  /* Code after symbol_found expects S, SYM_SYMTAB, SYM, 
-	     and COPY to be set correctly */
-	  *argptr = (*p == '\'') ? p + 1 : p;
-	  s = (struct symtab *) 0;
-	  goto symbol_found;
-	}
-      /* Otherwise fall out from here and go to file/line spec
-         processing, etc. */
-    }
-#endif
-
-  /* S is specified file's symtab, or 0 if no file specified.
-     arg no longer contains the file name.  */
-
-  /* Check whether arg is all digits (and sign) */
-
-  q = *argptr;
-  if (*q == '-' || *q == '+')
-    q++;
-  while (*q >= '0' && *q <= '9')
-    q++;
-
-  if (q != *argptr && (*q == 0 || *q == ' ' || *q == '\t' || *q == ','))
-    {
-      /* We found a token consisting of all digits -- at least one digit.  */
-      enum sign
-	{
-	  none, plus, minus
-	}
-      sign = none;
-
-      /* We might need a canonical line spec if no file was specified.  */
-      int need_canonical = (s == 0) ? 1 : 0;
-
-      /* This is where we need to make sure that we have good defaults.
-         We must guarantee that this section of code is never executed
-         when we are called with just a function name, since
-         select_source_symtab calls us with such an argument  */
-
-      if (s == 0 && default_symtab == 0)
-	{
-	  select_source_symtab (0);
-	  default_symtab = current_source_symtab;
-	  default_line = current_source_line;
-	}
-
-      if (**argptr == '+')
-	sign = plus, (*argptr)++;
-      else if (**argptr == '-')
-	sign = minus, (*argptr)++;
-      val.line = atoi (*argptr);
-      switch (sign)
-	{
-	case plus:
-	  if (q == *argptr)
-	    val.line = 5;
-	  if (s == 0)
-	    val.line = default_line + val.line;
-	  break;
-	case minus:
-	  if (q == *argptr)
-	    val.line = 15;
-	  if (s == 0)
-	    val.line = default_line - val.line;
-	  else
-	    val.line = 1;
-	  break;
-	case none:
-	  break;		/* No need to adjust val.line.  */
-	}
-
-      while (*q == ' ' || *q == '\t')
-	q++;
-      *argptr = q;
-      if (s == 0)
-	s = default_symtab;
-
-      /* It is possible that this source file has more than one symtab, 
-         and that the new line number specification has moved us from the
-         default (in s) to a new one.  */
-      val.symtab = find_line_symtab (s, val.line, NULL, NULL);
-      if (val.symtab == 0)
-	val.symtab = s;
-
-      val.pc = 0;
-      values.sals = (struct symtab_and_line *)
-	xmalloc (sizeof (struct symtab_and_line));
-      values.sals[0] = val;
-      values.nelts = 1;
-      if (need_canonical)
-	build_canonical_line_spec (values.sals, NULL, canonical);
-      return values;
-    }
-
-  /* Arg token is not digits => try it as a variable name
-     Find the next token (everything up to end or next whitespace).  */
-
-  if (**argptr == '$')		/* May be a convenience variable */
-    p = skip_quoted (*argptr + (((*argptr)[1] == '$') ? 2 : 1));	/* One or two $ chars possible */
-  else if (is_quoted)
-    {
-      p = skip_quoted (*argptr);
-      if (p[-1] != '\'')
-	error ("Unmatched single quote.");
-    }
-  else if (has_parens)
-    {
-      p = pp + 1;
-    }
-  else
-    {
-      p = skip_quoted (*argptr);
-    }
-
-  if (is_quote_enclosed && **argptr == '"')
-    (*argptr)++;
-
-  copy = (char *) alloca (p - *argptr + 1);
-  memcpy (copy, *argptr, p - *argptr);
-  copy[p - *argptr] = '\0';
-  if (p != *argptr
-      && copy[0]
-      && copy[0] == copy[p - *argptr - 1]
-      && strchr (gdb_completer_quote_characters, copy[0]) != NULL)
-    {
-      copy[p - *argptr - 1] = '\0';
-      copy++;
-    }
-  while (*p == ' ' || *p == '\t')
-    p++;
-  *argptr = p;
-
-  /* If it starts with $: may be a legitimate variable or routine name
-     (e.g. HP-UX millicode routines such as $$dyncall), or it may
-     be history value, or it may be a convenience variable */
-
-  if (*copy == '$')
-    {
-      value_ptr valx;
-      int index = 0;
-      int need_canonical = 0;
-
-      p = (copy[1] == '$') ? copy + 2 : copy + 1;
-      while (*p >= '0' && *p <= '9')
-	p++;
-      if (!*p)			/* reached end of token without hitting non-digit */
-	{
-	  /* We have a value history reference */
-	  sscanf ((copy[1] == '$') ? copy + 2 : copy + 1, "%d", &index);
-	  valx = access_value_history ((copy[1] == '$') ? -index : index);
-	  if (TYPE_CODE (VALUE_TYPE (valx)) != TYPE_CODE_INT)
-	    error ("History values used in line specs must have integer values.");
-	}
-      else
-	{
-	  /* Not all digits -- may be user variable/function or a
-	     convenience variable */
-
-	  /* Look up entire name as a symbol first */
-	  sym = lookup_symbol (copy, 0, VAR_NAMESPACE, 0, &sym_symtab);
-	  s = (struct symtab *) 0;
-	  need_canonical = 1;
-	  /* Symbol was found --> jump to normal symbol processing.
-	     Code following "symbol_found" expects "copy" to have the
-	     symbol name, "sym" to have the symbol pointer, "s" to be
-	     a specified file's symtab, and sym_symtab to be the symbol's
-	     symtab. */
-	  if (sym)
-	    goto symbol_found;
-
-	  /* If symbol was not found, look in minimal symbol tables */
-	  msymbol = lookup_minimal_symbol (copy, 0, 0);
-	  /* Min symbol was found --> jump to minsym processing. */
-	  if (msymbol)
-	    goto minimal_symbol_found;
-
-	  /* Not a user variable or function -- must be convenience variable */
-	  need_canonical = (s == 0) ? 1 : 0;
-	  valx = value_of_internalvar (lookup_internalvar (copy + 1));
-	  if (TYPE_CODE (VALUE_TYPE (valx)) != TYPE_CODE_INT)
-	    error ("Convenience variables used in line specs must have integer values.");
-	}
-
-      /* Either history value or convenience value from above, in valx */
-      val.symtab = s ? s : default_symtab;
-      val.line = value_as_long (valx);
-      val.pc = 0;
-
-      values.sals = (struct symtab_and_line *) xmalloc (sizeof val);
-      values.sals[0] = val;
-      values.nelts = 1;
-
-      if (need_canonical)
-	build_canonical_line_spec (values.sals, NULL, canonical);
-
-      return values;
-    }
-
-
-  /* Look up that token as a variable.
-     If file specified, use that file's per-file block to start with.  */
-
-  sym = lookup_symbol (copy,
-		       (s ? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK)
-			: get_selected_block ()),
-		       VAR_NAMESPACE, 0, &sym_symtab);
-
-symbol_found:			/* We also jump here from inside the C++ class/namespace 
-				   code on finding a symbol of the form "A::B::C" */
-
-  if (sym != NULL)
-    {
-      if (SYMBOL_CLASS (sym) == LOC_BLOCK)
-	{
-	  /* Arg is the name of a function */
-	  values.sals = (struct symtab_and_line *)
-	    xmalloc (sizeof (struct symtab_and_line));
-	  values.sals[0] = find_function_start_sal (sym, funfirstline);
-	  values.nelts = 1;
-
-	  /* Don't use the SYMBOL_LINE; if used at all it points to
-	     the line containing the parameters or thereabouts, not
-	     the first line of code.  */
-
-	  /* We might need a canonical line spec if it is a static
-	     function.  */
-	  if (s == 0)
-	    {
-	      struct blockvector *bv = BLOCKVECTOR (sym_symtab);
-	      struct block *b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-	      if (lookup_block_symbol (b, copy, VAR_NAMESPACE) != NULL)
-		build_canonical_line_spec (values.sals, copy, canonical);
-	    }
-	  return values;
-	}
-      else
-	{
-	  if (funfirstline)
-	    error ("\"%s\" is not a function", copy);
-	  else if (SYMBOL_LINE (sym) != 0)
-	    {
-	      /* We know its line number.  */
-	      values.sals = (struct symtab_and_line *)
-		xmalloc (sizeof (struct symtab_and_line));
-	      values.nelts = 1;
-	      memset (&values.sals[0], 0, sizeof (values.sals[0]));
-	      values.sals[0].symtab = sym_symtab;
-	      values.sals[0].line = SYMBOL_LINE (sym);
-	      return values;
-	    }
-	  else
-	    /* This can happen if it is compiled with a compiler which doesn't
-	       put out line numbers for variables.  */
-	    /* FIXME: Shouldn't we just set .line and .symtab to zero
-	       and return?  For example, "info line foo" could print
-	       the address.  */
-	    error ("Line number not known for symbol \"%s\"", copy);
-	}
-    }
-
-  msymbol = lookup_minimal_symbol (copy, NULL, NULL);
-
-minimal_symbol_found:		/* We also jump here from the case for variables
-				   that begin with '$' */
-
-  if (msymbol != NULL)
-    {
-      values.sals = (struct symtab_and_line *)
-	xmalloc (sizeof (struct symtab_and_line));
-      values.sals[0] = find_pc_sect_line (SYMBOL_VALUE_ADDRESS (msymbol),
-					  (struct sec *) 0, 0);
-      values.sals[0].section = SYMBOL_BFD_SECTION (msymbol);
-      if (funfirstline)
-	{
-	  values.sals[0].pc += FUNCTION_START_OFFSET;
-	  values.sals[0].pc = SKIP_PROLOGUE (values.sals[0].pc);
-	}
-      values.nelts = 1;
-      return values;
-    }
-
-  if (!have_full_symbols () &&
-      !have_partial_symbols () && !have_minimal_symbols ())
-    error (no_symtab_msg);
-
-  error ("Function \"%s\" not defined.", copy);
-  return values;		/* for lint */
-}
-
-struct symtabs_and_lines
-decode_line_spec (string, funfirstline)
-     char *string;
-     int funfirstline;
-{
-  struct symtabs_and_lines sals;
-  if (string == 0)
-    error ("Empty line specification.");
-  sals = decode_line_1 (&string, funfirstline,
-			current_source_symtab, current_source_line,
-			(char ***) NULL);
-  if (*string)
-    error ("Junk at end of line specification: %s", string);
-  return sals;
-}
-
-/* Given a list of NELTS symbols in SYM_ARR, return a list of lines to
-   operate on (ask user if necessary).
-   If CANONICAL is non-NULL return a corresponding array of mangled names
-   as canonical line specs there.  */
-
-static struct symtabs_and_lines
-decode_line_2 (sym_arr, nelts, funfirstline, canonical)
-     struct symbol *sym_arr[];
-     int nelts;
-     int funfirstline;
-     char ***canonical;
-{
-  struct symtabs_and_lines values, return_values;
-  char *args, *arg1;
-  int i;
-  char *prompt;
-  char *symname;
-  struct cleanup *old_chain;
-  char **canonical_arr = (char **) NULL;
-
-  values.sals = (struct symtab_and_line *)
-    alloca (nelts * sizeof (struct symtab_and_line));
-  return_values.sals = (struct symtab_and_line *)
-    xmalloc (nelts * sizeof (struct symtab_and_line));
-  old_chain = make_cleanup (free, return_values.sals);
-
-  if (canonical)
-    {
-      canonical_arr = (char **) xmalloc (nelts * sizeof (char *));
-      make_cleanup (free, canonical_arr);
-      memset (canonical_arr, 0, nelts * sizeof (char *));
-      *canonical = canonical_arr;
-    }
-
-  i = 0;
-  printf_unfiltered ("[0] cancel\n[1] all\n");
-  while (i < nelts)
-    {
-      INIT_SAL (&return_values.sals[i]);	/* initialize to zeroes */
-      INIT_SAL (&values.sals[i]);
-      if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK)
-	{
-	  values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline);
-	  printf_unfiltered ("[%d] %s at %s:%d\n",
-			     (i + 2),
-			     SYMBOL_SOURCE_NAME (sym_arr[i]),
-			     values.sals[i].symtab->filename,
-			     values.sals[i].line);
-	}
-      else
-	printf_unfiltered ("?HERE\n");
-      i++;
-    }
-
-  if ((prompt = getenv ("PS2")) == NULL)
-    {
-      prompt = "> ";
-    }
-  args = command_line_input (prompt, 0, "overload-choice");
-
-  if (args == 0 || *args == 0)
-    error_no_arg ("one or more choice numbers");
-
-  i = 0;
-  while (*args)
-    {
-      int num;
-
-      arg1 = args;
-      while (*arg1 >= '0' && *arg1 <= '9')
-	arg1++;
-      if (*arg1 && *arg1 != ' ' && *arg1 != '\t')
-	error ("Arguments must be choice numbers.");
-
-      num = atoi (args);
-
-      if (num == 0)
-	error ("cancelled");
-      else if (num == 1)
-	{
-	  if (canonical_arr)
-	    {
-	      for (i = 0; i < nelts; i++)
-		{
-		  if (canonical_arr[i] == NULL)
-		    {
-		      symname = SYMBOL_NAME (sym_arr[i]);
-		      canonical_arr[i] = savestring (symname, strlen (symname));
-		    }
-		}
-	    }
-	  memcpy (return_values.sals, values.sals,
-		  (nelts * sizeof (struct symtab_and_line)));
-	  return_values.nelts = nelts;
-	  discard_cleanups (old_chain);
-	  return return_values;
-	}
-
-      if (num >= nelts + 2)
-	{
-	  printf_unfiltered ("No choice number %d.\n", num);
-	}
-      else
-	{
-	  num -= 2;
-	  if (values.sals[num].pc)
-	    {
-	      if (canonical_arr)
-		{
-		  symname = SYMBOL_NAME (sym_arr[num]);
-		  make_cleanup (free, symname);
-		  canonical_arr[i] = savestring (symname, strlen (symname));
-		}
-	      return_values.sals[i++] = values.sals[num];
-	      values.sals[num].pc = 0;
-	    }
-	  else
-	    {
-	      printf_unfiltered ("duplicate request for %d ignored.\n", num);
-	    }
-	}
-
-      args = arg1;
-      while (*args == ' ' || *args == '\t')
-	args++;
-    }
-  return_values.nelts = i;
-  discard_cleanups (old_chain);
-  return return_values;
-}
 
 
 /* Slave routine for sources_info.  Force line breaks at ,'s.
    NAME is the name to print and *FIRST is nonzero if this is the first
    name printed.  Set *FIRST to zero.  */
 static void
-output_source_filename (name, first)
-     char *name;
-     int *first;
+output_source_filename (char *name, int *first)
 {
   /* Table of files printed so far.  Since a single source file can
      result in several partial symbol tables, we need to avoid printing
@@ -3494,9 +2216,7 @@
 }
 
 static void
-sources_info (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+sources_info (char *ignore, int from_tty)
 {
   register struct symtab *s;
   register struct partial_symtab *ps;
@@ -3505,7 +2225,7 @@
 
   if (!have_full_symbols () && !have_partial_symbols ())
     {
-      error (no_symtab_msg);
+      error ("No symbol table is loaded.  Use the \"file\" command.");
     }
 
   printf_filtered ("Source files for which symbols have been read in:\n\n");
@@ -3531,10 +2251,7 @@
 }
 
 static int
-file_matches (file, files, nfiles)
-     char *file;
-     char *files[];
-     int nfiles;
+file_matches (char *file, char *files[], int nfiles)
 {
   int i;
 
@@ -3553,8 +2270,7 @@
 
 /* Free any memory associated with a search. */
 void
-free_search_symbols (symbols)
-     struct symbol_search *symbols;
+free_search_symbols (struct symbol_search *symbols)
 {
   struct symbol_search *p;
   struct symbol_search *next;
@@ -3562,7 +2278,7 @@
   for (p = symbols; p != NULL; p = next)
     {
       next = p->next;
-      free (p);
+      xfree (p);
     }
 }
 
@@ -3592,13 +2308,8 @@
    free_search_symbols should be called when *MATCHES is no longer needed.
  */
 void
-search_symbols (regexp, kind, nfiles, files, matches)
-     char *regexp;
-     namespace_enum kind;
-     int nfiles;
-     char *files[];
-     struct symbol_search **matches;
-
+search_symbols (char *regexp, namespace_enum kind, int nfiles, char *files[],
+		struct symbol_search **matches)
 {
   register struct symtab *s;
   register struct partial_symtab *ps;
@@ -3637,10 +2348,10 @@
   if (kind < LABEL_NAMESPACE)
     error ("must search on specific namespace");
 
-  ourtype = types[(int) (kind - LABEL_NAMESPACE)];
-  ourtype2 = types2[(int) (kind - LABEL_NAMESPACE)];
-  ourtype3 = types3[(int) (kind - LABEL_NAMESPACE)];
-  ourtype4 = types4[(int) (kind - LABEL_NAMESPACE)];
+  ourtype = types[(int) (kind - VARIABLES_NAMESPACE)];
+  ourtype2 = types2[(int) (kind - VARIABLES_NAMESPACE)];
+  ourtype3 = types3[(int) (kind - VARIABLES_NAMESPACE)];
+  ourtype4 = types4[(int) (kind - VARIABLES_NAMESPACE)];
 
   sr = *matches = NULL;
   tail = NULL;
@@ -3877,12 +2588,8 @@
    regarding the match to gdb_stdout.
  */
 static void
-print_symbol_info (kind, s, sym, block, last)
-     namespace_enum kind;
-     struct symtab *s;
-     struct symbol *sym;
-     int block;
-     char *last;
+print_symbol_info (namespace_enum kind, struct symtab *s, struct symbol *sym,
+		   int block, char *last)
 {
   if (last == NULL || strcmp (last, s->filename) != 0)
     {
@@ -3897,7 +2604,7 @@
   /* Typedef that is not a C++ class */
   if (kind == TYPES_NAMESPACE
       && SYMBOL_NAMESPACE (sym) != STRUCT_NAMESPACE)
-    c_typedef_print (SYMBOL_TYPE (sym), sym, gdb_stdout);
+    typedef_print (SYMBOL_TYPE (sym), sym, gdb_stdout);
   /* variable, func, or typedef-that-is-c++-class */
   else if (kind < TYPES_NAMESPACE ||
 	   (kind == TYPES_NAMESPACE &&
@@ -3930,7 +2637,7 @@
       else
 	{
 	  fputs_filtered (demangled_name, stream);
-	  free (demangled_name);
+	  xfree (demangled_name);
 	}
 #endif
     }
@@ -3940,8 +2647,7 @@
    for non-debugging symbols to gdb_stdout.
  */
 static void
-print_msymbol_info (msymbol)
-     struct minimal_symbol *msymbol;
+print_msymbol_info (struct minimal_symbol *msymbol)
 {
   printf_filtered ("	%08lx  %s\n",
 		   (unsigned long) SYMBOL_VALUE_ADDRESS (msymbol),
@@ -3954,10 +2660,7 @@
    matches.
  */
 static void
-symtab_symbol_info (regexp, kind, from_tty)
-     char *regexp;
-     namespace_enum kind;
-     int from_tty;
+symtab_symbol_info (char *regexp, namespace_enum kind, int from_tty)
 {
   static char *classnames[]
   =
@@ -3975,7 +2678,7 @@
   printf_filtered (regexp
 		   ? "All %ss matching regular expression \"%s\":\n"
 		   : "All defined %ss:\n",
-		   classnames[(int) (kind - LABEL_NAMESPACE - 1)], regexp);
+		   classnames[(int) (kind - VARIABLES_NAMESPACE)], regexp);
 
   for (p = symbols; p != NULL; p = p->next)
     {
@@ -4005,26 +2708,20 @@
 }
 
 static void
-variables_info (regexp, from_tty)
-     char *regexp;
-     int from_tty;
+variables_info (char *regexp, int from_tty)
 {
   symtab_symbol_info (regexp, VARIABLES_NAMESPACE, from_tty);
 }
 
 static void
-functions_info (regexp, from_tty)
-     char *regexp;
-     int from_tty;
+functions_info (char *regexp, int from_tty)
 {
   symtab_symbol_info (regexp, FUNCTIONS_NAMESPACE, from_tty);
 }
 
 
 static void
-types_info (regexp, from_tty)
-     char *regexp;
-     int from_tty;
+types_info (char *regexp, int from_tty)
 {
   symtab_symbol_info (regexp, TYPES_NAMESPACE, from_tty);
 }
@@ -4032,8 +2729,7 @@
 #if 0
 /* Tiemann says: "info methods was never implemented."  */
 static void
-methods_info (regexp)
-     char *regexp;
+methods_info (char *regexp)
 {
   symtab_symbol_info (regexp, METHODS_NAMESPACE, 0, from_tty);
 }
@@ -4042,17 +2738,13 @@
 /* Breakpoint all functions matching regular expression. */
 #ifdef UI_OUT
 void
-rbreak_command_wrapper (regexp, from_tty)
-     char *regexp;
-     int from_tty;
+rbreak_command_wrapper (char *regexp, int from_tty)
 {
   rbreak_command (regexp, from_tty);
 }
 #endif
 static void
-rbreak_command (regexp, from_tty)
-     char *regexp;
-     int from_tty;
+rbreak_command (char *regexp, int from_tty)
 {
   struct symbol_search *ss;
   struct symbol_search *p;
@@ -4095,8 +2787,7 @@
    or if a and b have the same pc range.
    Return zero otherwise. */
 int
-contained_in (a, b)
-     struct block *a, *b;
+contained_in (struct block *a, struct block *b)
 {
   if (!a || !b)
     return 0;
@@ -4129,12 +2820,8 @@
    characters.  If so, add it to the current completion list. */
 
 static void
-completion_list_add_name (symname, sym_text, sym_text_len, text, word)
-     char *symname;
-     char *sym_text;
-     int sym_text_len;
-     char *text;
-     char *word;
+completion_list_add_name (char *symname, char *sym_text, int sym_text_len,
+			  char *text, char *word)
 {
   int newsize;
   int i;
@@ -4189,7 +2876,7 @@
 	  {
 	    if (STREQ (new, return_val[i]))
 	      {
-		free (new);
+		xfree (new);
 		return;
 	      }
 	  }
@@ -4213,9 +2900,7 @@
    I'm not going to worry about this; hopefully there won't be that many.  */
 
 char **
-make_symbol_completion_list (text, word)
-     char *text;
-     char *word;
+make_symbol_completion_list (char *text, char *word)
 {
   register struct symbol *sym;
   register struct symtab *s;
@@ -4404,9 +3089,7 @@
  */
 
 int
-in_prologue (pc, func_start)
-     CORE_ADDR pc;
-     CORE_ADDR func_start;
+in_prologue (CORE_ADDR pc, CORE_ADDR func_start)
 {
   struct symtab_and_line sal;
   CORE_ADDR func_addr, func_end;
@@ -4484,9 +3167,7 @@
    characters.  If so, add it to the current completion list. */
 
 static void
-overload_list_add_symbol (sym, oload_name)
-     struct symbol *sym;
-     char *oload_name;
+overload_list_add_symbol (struct symbol *sym, char *oload_name)
 {
   int newsize;
   int i;
@@ -4502,7 +3183,7 @@
   /* skip symbols that cannot match */
   if (strcmp (sym_name, oload_name) != 0)
     {
-      free (sym_name);
+      xfree (sym_name);
       return;
     }
 
@@ -4525,7 +3206,7 @@
   sym_return_val[sym_return_val_index++] = sym;
   sym_return_val[sym_return_val_index] = NULL;
 
-  free (sym_name);
+  xfree (sym_name);
 }
 
 /* Return a null-terminated list of pointers to function symbols that
@@ -4535,8 +3216,7 @@
 
 
 struct symbol **
-make_symbol_overload_list (fsym)
-     struct symbol *fsym;
+make_symbol_overload_list (struct symbol *fsym)
 {
   register struct symbol *sym;
   register struct symtab *s;
@@ -4647,16 +3327,29 @@
       }
   }
 
-  free (oload_name);
+  xfree (oload_name);
 
   return (sym_return_val);
 }
 
 /* End of overload resolution functions */
 
+struct symtabs_and_lines
+decode_line_spec (char *string, int funfirstline)
+{
+  struct symtabs_and_lines sals;
+  if (string == 0)
+    error ("Empty line specification.");
+  sals = decode_line_1 (&string, funfirstline,
+			current_source_symtab, current_source_line,
+			(char ***) NULL);
+  if (*string)
+    error ("Junk at end of line specification: %s", string);
+  return sals;
+}
 
 void
-_initialize_symtab ()
+_initialize_symtab (void)
 {
   add_info ("variables", variables_info,
 	 "All global and static variable names, or those matching REGEXP.");
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 7fb78db..09f08ab 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -170,6 +170,8 @@
 #define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack)			\
   do {									\
     char *demangled = NULL;						\
+    if (SYMBOL_LANGUAGE (symbol) == language_unknown)                 \
+          SYMBOL_LANGUAGE (symbol) = language_auto;                    \
     if (SYMBOL_LANGUAGE (symbol) == language_cplus			\
 	|| SYMBOL_LANGUAGE (symbol) == language_auto)			\
       {									\
@@ -222,10 +224,6 @@
 	    SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL;		\
 	  }								\
       }									\
-    if (SYMBOL_LANGUAGE (symbol) == language_auto)			\
-      {									\
-	SYMBOL_LANGUAGE (symbol) = language_unknown;			\
-      }									\
   } while (0)
 
 /* Macro that returns the demangled name for a symbol based on the language
@@ -763,7 +761,7 @@
 
 
 /* Source-file information.  This describes the relation between source files,
-   ine numbers and addresses in the program text.  */
+   line numbers and addresses in the program text.  */
 
 struct sourcevector
   {
@@ -829,7 +827,9 @@
     CORE_ADDR offsets[1];	/* As many as needed. */
   };
 
-#define	ANOFFSET(secoff, whichone)	(secoff->offsets[whichone])
+#define	ANOFFSET(secoff, whichone) \
+   ((whichone == -1) ? \
+    (internal_error ("Section index is uninitialized"), -1) : secoff->offsets[whichone])
 
 /* The maximum possible size of a section_offsets table.  */
 
@@ -1045,13 +1045,9 @@
 #define VTBL_FNADDR_OFFSET 2
 
 /* Macro that yields non-zero value iff NAME is the prefix for C++ operator
-   names.  If you leave out the parenthesis here you will lose!
-   Currently 'o' 'p' CPLUS_MARKER is used for both the symbol in the
-   symbol-file and the names in gdb's symbol table.
-   Note that this macro is g++ specific (FIXME). */
-
+   names.  If you leave out the parenthesis here you will lose!  */
 #define OPNAME_PREFIX_P(NAME) \
-  ((NAME)[0] == 'o' && (NAME)[1] == 'p' && is_cplus_marker ((NAME)[2]))
+  (!strncmp (NAME, "operator", 8))
 
 /* Macro that yields non-zero value iff NAME is the prefix for C++ vtbl
    names.  Note that this macro is g++ specific (FIXME).
@@ -1349,8 +1345,10 @@
 
 extern struct symtabs_and_lines decode_line_spec_1 (char *, int);
 
-extern struct symtabs_and_lines
-decode_line_1 (char **, int, struct symtab *, int, char ***);
+/* From linespec.c */
+
+extern struct symtabs_and_lines decode_line_1 (char **,
+                                          int, struct symtab *, int, char ***);
 
 /* Symmisc.c */
 
@@ -1394,6 +1392,10 @@
 
 extern struct partial_symtab *find_main_psymtab (void);
 
+extern struct symtab *find_line_symtab (struct symtab *, int, int *, int *);
+
+extern struct symtab_and_line find_function_start_sal (struct symbol *sym, int);
+
 /* blockframe.c */
 
 extern struct blockvector *blockvector_for_pc (CORE_ADDR, int *);
@@ -1414,10 +1416,14 @@
 extern struct symbol *fixup_symbol_section (struct symbol *,
 					    struct objfile *);
 
+extern struct partial_symbol *fixup_psymbol_section (struct partial_symbol
+						     *psym,
+						     struct objfile *objfile);
+
 /* Symbol searching */
 
 /* When using search_symbols, a list of the following structs is returned.
-   Callers must free the search list using free_symbol_search! */
+   Callers must free the search list using free_search_symbols! */
 struct symbol_search
   {
     /* The block in which the match was found. Could be, for example,
diff --git a/gdb/target.c b/gdb/target.c
index b99055d..ec4d01e 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -31,6 +31,7 @@
 #include "symfile.h"
 #include "objfiles.h"
 #include "gdb_wait.h"
+#include "dcache.h"
 #include <signal.h>
 
 extern int errno;
@@ -177,13 +178,13 @@
 
 static void setup_target_debug (void);
 
+DCACHE *target_dcache;
+
 /* The user just typed 'target' without the name of a target.  */
 
 /* ARGSUSED */
 static void
-target_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+target_command (char *arg, int from_tty)
 {
   fputs_filtered ("Argument required (target name).  Try `help target'\n",
 		  gdb_stdout);
@@ -192,8 +193,7 @@
 /* Add a possible target architecture to the list.  */
 
 void
-add_target (t)
-     struct target_ops *t;
+add_target (struct target_ops *t)
 {
   if (!target_structs)
     {
@@ -225,54 +225,49 @@
 /* Stub functions */
 
 void
-target_ignore ()
+target_ignore (void)
 {
 }
 
 void
 target_load (char *arg, int from_tty)
 {
+  dcache_invalidate (target_dcache);
   (*current_target.to_load) (arg, from_tty);
 }
 
 /* ARGSUSED */
 static int
-nomemory (memaddr, myaddr, len, write, t)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *t;
+nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+	  struct target_ops *t)
 {
   errno = EIO;			/* Can't read/write this location */
   return 0;			/* No bytes handled */
 }
 
 static void
-tcomplain ()
+tcomplain (void)
 {
   error ("You can't do that when your target is `%s'",
 	 current_target.to_shortname);
 }
 
 void
-noprocess ()
+noprocess (void)
 {
   error ("You can't do that without a process to debug.");
 }
 
 /* ARGSUSED */
 static int
-nosymbol (name, addrp)
-     char *name;
-     CORE_ADDR *addrp;
+nosymbol (char *name, CORE_ADDR *addrp)
 {
   return 1;			/* Symbol does not exist in target env */
 }
 
 /* ARGSUSED */
 static void
-nosupport_runtime ()
+nosupport_runtime (void)
 {
   if (!inferior_pid)
     noprocess ();
@@ -283,9 +278,7 @@
 
 /* ARGSUSED */
 static void
-default_terminal_info (args, from_tty)
-     char *args;
-     int from_tty;
+default_terminal_info (char *args, int from_tty)
 {
   printf_unfiltered ("No saved terminal information.\n");
 }
@@ -296,8 +289,7 @@
    the target, and the operation should be attempted.  */
 
 static void
-kill_or_be_killed (from_tty)
-     int from_tty;
+kill_or_be_killed (int from_tty)
 {
   if (target_has_execution)
     {
@@ -319,28 +311,21 @@
 }
 
 static void
-maybe_kill_then_attach (args, from_tty)
-     char *args;
-     int from_tty;
+maybe_kill_then_attach (char *args, int from_tty)
 {
   kill_or_be_killed (from_tty);
   target_attach (args, from_tty);
 }
 
 static void
-maybe_kill_then_create_inferior (exec, args, env)
-     char *exec;
-     char *args;
-     char **env;
+maybe_kill_then_create_inferior (char *exec, char *args, char **env)
 {
   kill_or_be_killed (0);
   target_create_inferior (exec, args, env);
 }
 
 static void
-default_clone_and_follow_inferior (child_pid, followed_child)
-     int child_pid;
-     int *followed_child;
+default_clone_and_follow_inferior (int child_pid, int *followed_child)
 {
   target_clone_and_follow_inferior (child_pid, followed_child);
 }
@@ -349,8 +334,7 @@
    We default entries, at least to stubs that print error messages.  */
 
 static void
-cleanup_target (t)
-     struct target_ops *t;
+cleanup_target (struct target_ops *t)
 {
 
 #define de_fault(field, value) \
@@ -537,7 +521,7 @@
    pushed target vectors.  */
 
 static void
-update_current_target ()
+update_current_target (void)
 {
   struct target_stack_item *item;
   struct target_ops *t;
@@ -645,8 +629,7 @@
    checking them.  */
 
 int
-push_target (t)
-     struct target_ops *t;
+push_target (struct target_ops *t)
 {
   struct target_stack_item *cur, *prev, *tmp;
 
@@ -681,7 +664,7 @@
 	else
 	  target_stack = cur->next;	/* Unchain first on list */
 	tmp = cur->next;
-	free (cur);
+	xfree (cur);
 	cur = tmp;
       }
 
@@ -711,8 +694,7 @@
    Return how many times it was removed (0 or 1).  */
 
 int
-unpush_target (t)
-     struct target_ops *t;
+unpush_target (struct target_ops *t)
 {
   struct target_stack_item *cur, *prev;
 
@@ -736,7 +718,7 @@
   else
     prev->next = cur->next;
 
-  free (cur);			/* Release the target_stack_item */
+  xfree (cur);			/* Release the target_stack_item */
 
   update_current_target ();
   cleanup_target (&current_target);
@@ -745,7 +727,7 @@
 }
 
 void
-pop_target ()
+pop_target (void)
 {
   (current_target.to_close) (0);	/* Let it clean up */
   if (unpush_target (target_stack->target_ops) == 1)
@@ -767,11 +749,7 @@
    read.  */
 
 int
-target_read_string (memaddr, string, len, errnop)
-     CORE_ADDR memaddr;
-     char **string;
-     int len;
-     int *errnop;
+target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
 {
   int tlen, origlen, offset, i;
   char buf[4];
@@ -848,42 +826,27 @@
    deal with partial reads should call target_read_memory_partial. */
 
 int
-target_read_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+target_read_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   return target_xfer_memory (memaddr, myaddr, len, 0);
 }
 
 int
-target_write_memory (memaddr, myaddr, len)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
+target_write_memory (CORE_ADDR memaddr, char *myaddr, int len)
 {
   return target_xfer_memory (memaddr, myaddr, len, 1);
 }
 
-/* Move memory to or from the targets.  Iterate until all of it has
-   been moved, if necessary.  The top target gets priority; anything
-   it doesn't want, is offered to the next one down, etc.  Note the
-   business with curlen:  if an early target says "no, but I have a
-   boundary overlapping this xfer" then we shorten what we offer to
-   the subsequent targets so the early guy will get a chance at the
-   tail before the subsequent ones do. 
+/* Move memory to or from the targets.  The top target gets priority;
+   if it cannot handle it, it is offered to the next one down, etc.
 
-   Result is 0 or errno value.  */
+   Result is -1 on error, or the number of bytes transfered.  */
 
-static int
-target_xfer_memory (memaddr, myaddr, len, write)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
+int
+do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write)
 {
-  int curlen;
   int res;
+  int done = 0;
   struct target_ops *t;
   struct target_stack_item *item;
 
@@ -895,26 +858,20 @@
      0.  */
   errno = 0;
 
-  /* The quick case is that the top target does it all.  */
+  /* The quick case is that the top target can handle the transfer.  */
   res = current_target.to_xfer_memory
     (memaddr, myaddr, len, write, &current_target);
-  if (res == len)
-    return 0;
 
-  if (res > 0)
-    goto bump;
-  /* If res <= 0 then we call it again in the loop.  Ah well.  */
-
-  for (; len > 0;)
+  /* If res <= 0 then we call it again in the loop.  Ah well. */
+  if (res <= 0)
     {
-      curlen = len;		/* Want to do it all */
       for (item = target_stack; item; item = item->next)
 	{
 	  t = item->target_ops;
 	  if (!t->to_has_memory)
 	    continue;
 
-	  res = t->to_xfer_memory (memaddr, myaddr, curlen, write, t);
+	  res = t->to_xfer_memory (memaddr, myaddr, len, write, t);
 	  if (res > 0)
 	    break;		/* Handled all or part of xfer */
 	  if (t->to_has_all_memory)
@@ -922,6 +879,33 @@
 	}
 
       if (res <= 0)
+	return -1;
+    }
+
+  return res;
+}
+
+
+/* Perform a memory transfer.  Iterate until the entire region has
+   been transfered.
+
+   Result is 0 or errno value.  */
+
+static int
+target_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write)
+{
+  int res;
+
+  /* Zero length requests are ok and require no work.  */
+  if (len == 0)
+    {
+      return 0;
+    }
+
+  while (len > 0)
+    {
+      res = dcache_xfer_memory(target_dcache, memaddr, myaddr, len, write);
+      if (res <= 0)
 	{
 	  /* If this address is for nonexistent memory,
 	     read zeros if reading, or do nothing if writing.  Return error. */
@@ -932,26 +916,25 @@
 	  else
 	    return errno;
 	}
-    bump:
+
       memaddr += res;
-      myaddr += res;
-      len -= res;
+      myaddr  += res;
+      len     -= res;
     }
+  
   return 0;			/* We managed to cover it all somehow. */
 }
 
 
-/* Perform a partial memory transfer.  */
+/* Perform a partial memory transfer.
+
+   Result is -1 on error, or the number of bytes transfered.  */
 
 static int
-target_xfer_memory_partial (CORE_ADDR memaddr, char *buf, int len,
+target_xfer_memory_partial (CORE_ADDR memaddr, char *myaddr, int len,
 			    int write_p, int *err)
 {
   int res;
-  int err_res;
-  int len_res;
-  struct target_ops *t;
-  struct target_stack_item *item;
 
   /* Zero length requests are ok and require no work.  */
   if (len == 0)
@@ -960,42 +943,19 @@
       return 0;
     }
 
-  /* The quick case is that the top target does it all.  */
-  res = current_target.to_xfer_memory (memaddr, buf, len, write_p, &current_target);
-  if (res > 0)
+  res = dcache_xfer_memory (target_dcache, memaddr, myaddr, len, write_p);
+  if (res <= 0)
     {
-      *err = 0;
-      return res;
+      if (errno != 0)
+	*err = errno;
+      else
+	*err = EIO;
+
+        return -1;
     }
 
-  /* xfer memory doesn't always reliably set errno. */
-  errno = 0;
-
-  /* Try all levels of the target stack to see one can handle it. */
-  for (item = target_stack; item; item = item->next)
-    {
-      t = item->target_ops;
-      if (!t->to_has_memory)
-	continue;
-      res = t->to_xfer_memory (memaddr, buf, len, write_p, t);
-      if (res > 0)
-	{
-	  /* Handled all or part of xfer */
-	  *err = 0;
-	  return res;
-	}
-      if (t->to_has_all_memory)
-	break;
-    }
-
-  /* Total failure.  Return error. */
-  if (errno != 0)
-    {
-      *err = errno;
-      return -1;
-    }
-  *err = EIO;
-  return -1;
+  *err = 0;
+  return res;
 }
 
 int
@@ -1012,9 +972,7 @@
 
 /* ARGSUSED */
 static void
-target_info (args, from_tty)
-     char *args;
-     int from_tty;
+target_info (char *args, int from_tty)
 {
   struct target_ops *t;
   struct target_stack_item *item;
@@ -1049,8 +1007,7 @@
    anything.  */
 
 void
-target_preopen (from_tty)
-     int from_tty;
+target_preopen (int from_tty)
 {
   dont_repeat ();
 
@@ -1073,9 +1030,7 @@
 /* Detach a target after doing deferred register stores.  */
 
 void
-target_detach (args, from_tty)
-     char *args;
-     int from_tty;
+target_detach (char *args, int from_tty)
 {
   /* Handle any optimized stores to the inferior.  */
 #ifdef DO_DEFERRED_STORES
@@ -1085,9 +1040,7 @@
 }
 
 void
-target_link (modname, t_reloc)
-     char *modname;
-     CORE_ADDR *t_reloc;
+target_link (char *modname, CORE_ADDR *t_reloc)
 {
   if (STREQ (current_target.to_shortname, "rombug"))
     {
@@ -1114,8 +1067,7 @@
    Result is always valid (error() is called for errors).  */
 
 static struct target_ops *
-find_default_run_target (do_mesg)
-     char *do_mesg;
+find_default_run_target (char *do_mesg)
 {
   struct target_ops **t;
   struct target_ops *runable = NULL;
@@ -1140,9 +1092,7 @@
 }
 
 void
-find_default_attach (args, from_tty)
-     char *args;
-     int from_tty;
+find_default_attach (char *args, int from_tty)
 {
   struct target_ops *t;
 
@@ -1152,9 +1102,7 @@
 }
 
 void
-find_default_require_attach (args, from_tty)
-     char *args;
-     int from_tty;
+find_default_require_attach (char *args, int from_tty)
 {
   struct target_ops *t;
 
@@ -1164,10 +1112,7 @@
 }
 
 void
-find_default_require_detach (pid, args, from_tty)
-     int pid;
-     char *args;
-     int from_tty;
+find_default_require_detach (int pid, char *args, int from_tty)
 {
   struct target_ops *t;
 
@@ -1177,10 +1122,7 @@
 }
 
 void
-find_default_create_inferior (exec_file, allargs, env)
-     char *exec_file;
-     char *allargs;
-     char **env;
+find_default_create_inferior (char *exec_file, char *allargs, char **env)
 {
   struct target_ops *t;
 
@@ -1190,9 +1132,7 @@
 }
 
 void
-find_default_clone_and_follow_inferior (child_pid, followed_child)
-     int child_pid;
-     int *followed_child;
+find_default_clone_and_follow_inferior (int child_pid, int *followed_child)
 {
   struct target_ops *t;
 
@@ -1202,13 +1142,13 @@
 }
 
 static int
-return_zero ()
+return_zero (void)
 {
   return 0;
 }
 
 static int
-return_one ()
+return_one (void)
 {
   return 1;
 }
@@ -1300,7 +1240,7 @@
    some reason there is more than one, return NULL.  */
 
 struct target_ops *
-find_run_target ()
+find_run_target (void)
 {
   struct target_ops **t;
   struct target_ops *runable = NULL;
@@ -1324,7 +1264,7 @@
    If for some reason there is more than one, return NULL.  */
 
 struct target_ops *
-find_core_target ()
+find_core_target (void)
 {
   struct target_ops **t;
   struct target_ops *runable = NULL;
@@ -1350,8 +1290,7 @@
  */
 
 struct target_ops *
-find_target_beneath (t)
-     struct target_ops *t;
+find_target_beneath (struct target_ops *t)
 {
   struct target_stack_item *cur;
 
@@ -1369,7 +1308,7 @@
 /* The inferior process has died.  Long live the inferior!  */
 
 void
-generic_mourn_inferior ()
+generic_mourn_inferior (void)
 {
   extern int show_breakpoint_hit_counts;
 
@@ -1392,6 +1331,9 @@
      using hit counts.  So don't clear them if we're counting hits.  */
   if (!show_breakpoint_hit_counts)
     breakpoint_clear_ignore_counts ();
+
+  if (detach_hook)
+    detach_hook ();
 }
 
 /* This table must match in order and size the signals in enum target_signal
@@ -1480,6 +1422,7 @@
   {"SIG63", "Real-time event 63"},
   {"SIGCANCEL", "LWP internal signal"},
   {"SIG32", "Real-time event 32"},
+  {"SIG64", "Real-time event 64"},
 
 #if defined(MACH) || defined(__MACH__)
   /* Mach exceptions */
@@ -1504,8 +1447,7 @@
 
 /* Return the string for a signal.  */
 char *
-target_signal_to_string (sig)
-     enum target_signal sig;
+target_signal_to_string (enum target_signal sig)
 {
   if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST))
     return signals[sig].string;
@@ -1515,8 +1457,7 @@
 
 /* Return the name for a signal.  */
 char *
-target_signal_to_name (sig)
-     enum target_signal sig;
+target_signal_to_name (enum target_signal sig)
 {
   if (sig == TARGET_SIGNAL_UNKNOWN)
     /* I think the code which prints this will always print it along with
@@ -1527,8 +1468,7 @@
 
 /* Given a name, return its signal.  */
 enum target_signal
-target_signal_from_name (name)
-     char *name;
+target_signal_from_name (char *name)
 {
   enum target_signal sig;
 
@@ -1552,8 +1492,7 @@
 
 /* Convert host signal to our signals.  */
 enum target_signal
-target_signal_from_host (hostsig)
-     int hostsig;
+target_signal_from_host (int hostsig)
 {
   /* A switch statement would make sense but would require special kludges
      to deal with the cases where more than one signal has the same number.  */
@@ -1790,6 +1729,20 @@
 	error ("GDB bug: target.c (target_signal_from_host): unrecognized real-time signal");
     }
 #endif
+
+#if defined (SIGRTMIN)
+  if (hostsig >= SIGRTMIN && hostsig <= SIGRTMAX)
+    {
+      /* This block of TARGET_SIGNAL_REALTIME value is in order.  */
+      if (33 <= hostsig && hostsig <= 63)
+	return (enum target_signal)
+	  (hostsig - 33 + (int) TARGET_SIGNAL_REALTIME_33);
+      else if (hostsig == 64)
+	return TARGET_SIGNAL_REALTIME_64;
+      else
+	error ("GDB bug: target.c (target_signal_from_host): unrecognized real-time signal");
+    }
+#endif
   return TARGET_SIGNAL_UNKNOWN;
 }
 
@@ -2045,6 +1998,21 @@
 	}
 #endif
 #endif
+
+#if defined (SIGRTMIN)
+      if (oursig >= TARGET_SIGNAL_REALTIME_33
+	  && oursig <= TARGET_SIGNAL_REALTIME_63)
+	{
+	  /* This block of signals is continuous, and
+             TARGET_SIGNAL_REALTIME_33 is 33 by definition.  */
+	  int retsig =
+	    (int) oursig - (int) TARGET_SIGNAL_REALTIME_33 + 33;
+	  if (retsig >= SIGRTMIN && retsig <= SIGRTMAX)
+	    return retsig;
+	}
+      else if (oursig == TARGET_SIGNAL_REALTIME_64)
+	return 64;
+#endif
       *oursig_ok = 0;
       return 0;
     }
@@ -2079,9 +2047,7 @@
    HOSTSTATUS is the waitstatus from wait() or the equivalent; store our
    translation of that in OURSTATUS.  */
 void
-store_waitstatus (ourstatus, hoststatus)
-     struct target_waitstatus *ourstatus;
-     int hoststatus;
+store_waitstatus (struct target_waitstatus *ourstatus, int hoststatus)
 {
 #ifdef CHILD_SPECIAL_WAITSTATUS
   /* CHILD_SPECIAL_WAITSTATUS should return nonzero and set *OURSTATUS
@@ -2111,13 +2077,12 @@
    signal.  The idea is to keep these circumstances limited so that
    users (and scripts) develop portable habits.  For comparison,
    POSIX.2 `kill' requires that 1,2,3,6,9,14, and 15 work (and using a
-   numeric signal at all is obscelescent.  We are slightly more
+   numeric signal at all is obsolescent.  We are slightly more
    lenient and allow 1-15 which should match host signal numbers on
    most systems.  Use of symbolic signal names is strongly encouraged.  */
 
 enum target_signal
-target_signal_from_command (num)
-     int num;
+target_signal_from_command (int num)
 {
   if (num >= 1 && num <= 15)
     return (enum target_signal) num;
@@ -2133,8 +2098,7 @@
    buffer.  */
 
 char *
-normal_pid_to_str (pid)
-     int pid;
+normal_pid_to_str (int pid)
 {
   static char buf[30];
 
@@ -2159,8 +2123,7 @@
    target_acknowledge_forked_child.
  */
 static void
-normal_target_post_startup_inferior (pid)
-     int pid;
+normal_target_post_startup_inferior (int pid)
 {
   /* This space intentionally left blank. */
 }
@@ -2169,7 +2132,7 @@
    vector.  */
 
 static void
-init_dummy_target ()
+init_dummy_target (void)
 {
   dummy_target.to_shortname = "None";
   dummy_target.to_longname = "None";
@@ -2188,9 +2151,7 @@
 static struct target_ops debug_target;
 
 static void
-debug_to_open (args, from_tty)
-     char *args;
-     int from_tty;
+debug_to_open (char *args, int from_tty)
 {
   debug_target.to_open (args, from_tty);
 
@@ -2198,8 +2159,7 @@
 }
 
 static void
-debug_to_close (quitting)
-     int quitting;
+debug_to_close (int quitting)
 {
   debug_target.to_close (quitting);
 
@@ -2207,9 +2167,7 @@
 }
 
 static void
-debug_to_attach (args, from_tty)
-     char *args;
-     int from_tty;
+debug_to_attach (char *args, int from_tty)
 {
   debug_target.to_attach (args, from_tty);
 
@@ -2218,8 +2176,7 @@
 
 
 static void
-debug_to_post_attach (pid)
-     int pid;
+debug_to_post_attach (int pid)
 {
   debug_target.to_post_attach (pid);
 
@@ -2227,9 +2184,7 @@
 }
 
 static void
-debug_to_require_attach (args, from_tty)
-     char *args;
-     int from_tty;
+debug_to_require_attach (char *args, int from_tty)
 {
   debug_target.to_require_attach (args, from_tty);
 
@@ -2238,9 +2193,7 @@
 }
 
 static void
-debug_to_detach (args, from_tty)
-     char *args;
-     int from_tty;
+debug_to_detach (char *args, int from_tty)
 {
   debug_target.to_detach (args, from_tty);
 
@@ -2248,10 +2201,7 @@
 }
 
 static void
-debug_to_require_detach (pid, args, from_tty)
-     int pid;
-     char *args;
-     int from_tty;
+debug_to_require_detach (int pid, char *args, int from_tty)
 {
   debug_target.to_require_detach (pid, args, from_tty);
 
@@ -2260,10 +2210,7 @@
 }
 
 static void
-debug_to_resume (pid, step, siggnal)
-     int pid;
-     int step;
-     enum target_signal siggnal;
+debug_to_resume (int pid, int step, enum target_signal siggnal)
 {
   debug_target.to_resume (pid, step, siggnal);
 
@@ -2273,9 +2220,7 @@
 }
 
 static int
-debug_to_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+debug_to_wait (int pid, struct target_waitstatus *status)
 {
   int retval;
 
@@ -2322,9 +2267,7 @@
 }
 
 static void
-debug_to_post_wait (pid, status)
-     int pid;
-     int status;
+debug_to_post_wait (int pid, int status)
 {
   debug_target.to_post_wait (pid, status);
 
@@ -2333,8 +2276,7 @@
 }
 
 static void
-debug_to_fetch_registers (regno)
-     int regno;
+debug_to_fetch_registers (int regno)
 {
   debug_target.to_fetch_registers (regno);
 
@@ -2348,8 +2290,7 @@
 }
 
 static void
-debug_to_store_registers (regno)
-     int regno;
+debug_to_store_registers (int regno)
 {
   debug_target.to_store_registers (regno);
 
@@ -2363,7 +2304,7 @@
 }
 
 static void
-debug_to_prepare_to_store ()
+debug_to_prepare_to_store (void)
 {
   debug_target.to_prepare_to_store ();
 
@@ -2371,12 +2312,8 @@
 }
 
 static int
-debug_to_xfer_memory (memaddr, myaddr, len, write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int write;
-     struct target_ops *target;
+debug_to_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		      struct target_ops *target)
 {
   int retval;
 
@@ -2408,8 +2345,7 @@
 }
 
 static void
-debug_to_files_info (target)
-     struct target_ops *target;
+debug_to_files_info (struct target_ops *target)
 {
   debug_target.to_files_info (target);
 
@@ -2417,9 +2353,7 @@
 }
 
 static int
-debug_to_insert_breakpoint (addr, save)
-     CORE_ADDR addr;
-     char *save;
+debug_to_insert_breakpoint (CORE_ADDR addr, char *save)
 {
   int retval;
 
@@ -2433,9 +2367,7 @@
 }
 
 static int
-debug_to_remove_breakpoint (addr, save)
-     CORE_ADDR addr;
-     char *save;
+debug_to_remove_breakpoint (CORE_ADDR addr, char *save)
 {
   int retval;
 
@@ -2449,7 +2381,7 @@
 }
 
 static void
-debug_to_terminal_init ()
+debug_to_terminal_init (void)
 {
   debug_target.to_terminal_init ();
 
@@ -2457,7 +2389,7 @@
 }
 
 static void
-debug_to_terminal_inferior ()
+debug_to_terminal_inferior (void)
 {
   debug_target.to_terminal_inferior ();
 
@@ -2465,7 +2397,7 @@
 }
 
 static void
-debug_to_terminal_ours_for_output ()
+debug_to_terminal_ours_for_output (void)
 {
   debug_target.to_terminal_ours_for_output ();
 
@@ -2473,7 +2405,7 @@
 }
 
 static void
-debug_to_terminal_ours ()
+debug_to_terminal_ours (void)
 {
   debug_target.to_terminal_ours ();
 
@@ -2481,9 +2413,7 @@
 }
 
 static void
-debug_to_terminal_info (arg, from_tty)
-     char *arg;
-     int from_tty;
+debug_to_terminal_info (char *arg, int from_tty)
 {
   debug_target.to_terminal_info (arg, from_tty);
 
@@ -2492,7 +2422,7 @@
 }
 
 static void
-debug_to_kill ()
+debug_to_kill (void)
 {
   debug_target.to_kill ();
 
@@ -2500,9 +2430,7 @@
 }
 
 static void
-debug_to_load (args, from_tty)
-     char *args;
-     int from_tty;
+debug_to_load (char *args, int from_tty)
 {
   debug_target.to_load (args, from_tty);
 
@@ -2510,9 +2438,7 @@
 }
 
 static int
-debug_to_lookup_symbol (name, addrp)
-     char *name;
-     CORE_ADDR *addrp;
+debug_to_lookup_symbol (char *name, CORE_ADDR *addrp)
 {
   int retval;
 
@@ -2524,10 +2450,7 @@
 }
 
 static void
-debug_to_create_inferior (exec_file, args, env)
-     char *exec_file;
-     char *args;
-     char **env;
+debug_to_create_inferior (char *exec_file, char *args, char **env)
 {
   debug_target.to_create_inferior (exec_file, args, env);
 
@@ -2536,8 +2459,7 @@
 }
 
 static void
-debug_to_post_startup_inferior (pid)
-     int pid;
+debug_to_post_startup_inferior (int pid)
 {
   debug_target.to_post_startup_inferior (pid);
 
@@ -2546,8 +2468,7 @@
 }
 
 static void
-debug_to_acknowledge_created_inferior (pid)
-     int pid;
+debug_to_acknowledge_created_inferior (int pid)
 {
   debug_target.to_acknowledge_created_inferior (pid);
 
@@ -2556,9 +2477,7 @@
 }
 
 static void
-debug_to_clone_and_follow_inferior (child_pid, followed_child)
-     int child_pid;
-     int *followed_child;
+debug_to_clone_and_follow_inferior (int child_pid, int *followed_child)
 {
   debug_target.to_clone_and_follow_inferior (child_pid, followed_child);
 
@@ -2568,7 +2487,7 @@
 }
 
 static void
-debug_to_post_follow_inferior_by_clone ()
+debug_to_post_follow_inferior_by_clone (void)
 {
   debug_target.to_post_follow_inferior_by_clone ();
 
@@ -2576,8 +2495,7 @@
 }
 
 static int
-debug_to_insert_fork_catchpoint (pid)
-     int pid;
+debug_to_insert_fork_catchpoint (int pid)
 {
   int retval;
 
@@ -2590,8 +2508,7 @@
 }
 
 static int
-debug_to_remove_fork_catchpoint (pid)
-     int pid;
+debug_to_remove_fork_catchpoint (int pid)
 {
   int retval;
 
@@ -2604,8 +2521,7 @@
 }
 
 static int
-debug_to_insert_vfork_catchpoint (pid)
-     int pid;
+debug_to_insert_vfork_catchpoint (int pid)
 {
   int retval;
 
@@ -2618,8 +2534,7 @@
 }
 
 static int
-debug_to_remove_vfork_catchpoint (pid)
-     int pid;
+debug_to_remove_vfork_catchpoint (int pid)
 {
   int retval;
 
@@ -2632,9 +2547,7 @@
 }
 
 static int
-debug_to_has_forked (pid, child_pid)
-     int pid;
-     int *child_pid;
+debug_to_has_forked (int pid, int *child_pid)
 {
   int has_forked;
 
@@ -2647,9 +2560,7 @@
 }
 
 static int
-debug_to_has_vforked (pid, child_pid)
-     int pid;
-     int *child_pid;
+debug_to_has_vforked (int pid, int *child_pid)
 {
   int has_vforked;
 
@@ -2662,7 +2573,7 @@
 }
 
 static int
-debug_to_can_follow_vfork_prior_to_exec ()
+debug_to_can_follow_vfork_prior_to_exec (void)
 {
   int can_immediately_follow_vfork;
 
@@ -2675,11 +2586,8 @@
 }
 
 static void
-debug_to_post_follow_vfork (parent_pid, followed_parent, child_pid, followed_child)
-     int parent_pid;
-     int followed_parent;
-     int child_pid;
-     int followed_child;
+debug_to_post_follow_vfork (int parent_pid, int followed_parent, int child_pid,
+			    int followed_child)
 {
   debug_target.to_post_follow_vfork (parent_pid, followed_parent, child_pid, followed_child);
 
@@ -2689,8 +2597,7 @@
 }
 
 static int
-debug_to_insert_exec_catchpoint (pid)
-     int pid;
+debug_to_insert_exec_catchpoint (int pid)
 {
   int retval;
 
@@ -2703,8 +2610,7 @@
 }
 
 static int
-debug_to_remove_exec_catchpoint (pid)
-     int pid;
+debug_to_remove_exec_catchpoint (int pid)
 {
   int retval;
 
@@ -2717,9 +2623,7 @@
 }
 
 static int
-debug_to_has_execd (pid, execd_pathname)
-     int pid;
-     char **execd_pathname;
+debug_to_has_execd (int pid, char **execd_pathname)
 {
   int has_execd;
 
@@ -2733,7 +2637,7 @@
 }
 
 static int
-debug_to_reported_exec_events_per_exec_call ()
+debug_to_reported_exec_events_per_exec_call (void)
 {
   int reported_exec_events;
 
@@ -2747,10 +2651,8 @@
 }
 
 static int
-debug_to_has_syscall_event (pid, kind, syscall_id)
-     int pid;
-     enum target_waitkind *kind;
-     int *syscall_id;
+debug_to_has_syscall_event (int pid, enum target_waitkind *kind,
+			    int *syscall_id)
 {
   int has_syscall_event;
   char *kind_spelling = "??";
@@ -2779,10 +2681,7 @@
 }
 
 static int
-debug_to_has_exited (pid, wait_status, exit_status)
-     int pid;
-     int wait_status;
-     int *exit_status;
+debug_to_has_exited (int pid, int wait_status, int *exit_status)
 {
   int has_exited;
 
@@ -2795,7 +2694,7 @@
 }
 
 static void
-debug_to_mourn_inferior ()
+debug_to_mourn_inferior (void)
 {
   debug_target.to_mourn_inferior ();
 
@@ -2803,7 +2702,7 @@
 }
 
 static int
-debug_to_can_run ()
+debug_to_can_run (void)
 {
   int retval;
 
@@ -2815,8 +2714,7 @@
 }
 
 static void
-debug_to_notice_signals (pid)
-     int pid;
+debug_to_notice_signals (int pid)
 {
   debug_target.to_notice_signals (pid);
 
@@ -2824,8 +2722,7 @@
 }
 
 static int
-debug_to_thread_alive (pid)
-     int pid;
+debug_to_thread_alive (int pid)
 {
   int retval;
 
@@ -2838,7 +2735,7 @@
 }
 
 static void
-debug_to_find_new_threads ()
+debug_to_find_new_threads (void)
 {
   debug_target.to_find_new_threads ();
 
@@ -2846,7 +2743,7 @@
 }
 
 static void
-debug_to_stop ()
+debug_to_stop (void)
 {
   debug_target.to_stop ();
 
@@ -2854,11 +2751,7 @@
 }
 
 static int
-debug_to_query (type, req, resp, siz)
-     int type;
-     char *req;
-     char *resp;
-     int *siz;
+debug_to_query (int type, char *req, char *resp, int *siz)
 {
   int retval;
 
@@ -2878,9 +2771,7 @@
 }
 
 static struct symtab_and_line *
-debug_to_enable_exception_callback (kind, enable)
-     enum exception_event_kind kind;
-     int enable;
+debug_to_enable_exception_callback (enum exception_event_kind kind, int enable)
 {
   struct symtab_and_line *result;
   result = debug_target.to_enable_exception_callback (kind, enable);
@@ -2891,7 +2782,7 @@
 }
 
 static struct exception_event_record *
-debug_to_get_current_exception_event ()
+debug_to_get_current_exception_event (void)
 {
   struct exception_event_record *result;
   result = debug_target.to_get_current_exception_event ();
@@ -2900,8 +2791,7 @@
 }
 
 static char *
-debug_to_pid_to_exec_file (pid)
-     int pid;
+debug_to_pid_to_exec_file (int pid)
 {
   char *exec_file;
 
@@ -2914,8 +2804,7 @@
 }
 
 static char *
-debug_to_core_file_to_sym_file (core)
-     char *core;
+debug_to_core_file_to_sym_file (char *core)
 {
   char *sym_file;
 
@@ -2928,7 +2817,7 @@
 }
 
 static void
-setup_target_debug ()
+setup_target_debug (void)
 {
   memcpy (&debug_target, &current_target, sizeof debug_target);
 
@@ -3013,7 +2902,7 @@
 }
 
 void
-initialize_targets ()
+initialize_targets (void)
 {
   init_dummy_target ();
   push_target (&dummy_target);
@@ -3032,6 +2921,8 @@
   add_com ("monitor", class_obscure, do_monitor_command,
 	   "Send a command to the remote monitor (remote targets only).");
 
+  target_dcache = dcache_init();
+
   if (!STREQ (signals[TARGET_SIGNAL_LAST].string, "TARGET_SIGNAL_MAGIC"))
     abort ();
 }
diff --git a/gdb/target.h b/gdb/target.h
index 5c65149..5b0afb7 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -43,6 +43,7 @@
 
 #include "bfd.h"
 #include "symtab.h"
+#include "dcache.h"
 
 enum strata
   {
@@ -239,6 +240,8 @@
        of the protocol.  Note that in some GDB's TARGET_SIGNAL_REALTIME_32
        is number 76.  */
     TARGET_SIGNAL_REALTIME_32,
+    /* Yet another pain, IRIX 6 has SIG64.  */
+    TARGET_SIGNAL_REALTIME_64,
 
 #if defined(MACH) || defined(__MACH__)
     /* Mach exceptions */
@@ -487,8 +490,11 @@
    and (if successful) pushes a new target onto the stack.
    Targets should supply this routine, if only to provide an error message.  */
 
-#define	target_open(name, from_tty)	\
-     (*current_target.to_open) (name, from_tty)
+#define	target_open(name, from_tty)					\
+  do {									\
+    dcache_invalidate (target_dcache);					\
+    (*current_target.to_open) (name, from_tty);				\
+  } while (0)
 
 /* Does whatever cleanup is required for a target that we are no longer
    going to be calling.  Argument says whether we are quitting gdb and
@@ -560,8 +566,11 @@
    the target, or TARGET_SIGNAL_0 for no signal.  The caller may not
    pass TARGET_SIGNAL_DEFAULT.  */
 
-#define	target_resume(pid, step, siggnal)	\
-     (*current_target.to_resume) (pid, step, siggnal)
+#define	target_resume(pid, step, siggnal)				\
+  do {									\
+    dcache_invalidate(target_dcache);					\
+    (*current_target.to_resume) (pid, step, siggnal);			\
+  } while (0)
 
 /* Wait for process pid to do something.  Pid = -1 to wait for any pid
    to do something.  Return pid of child, or -1 in case of error;
@@ -608,11 +617,15 @@
 #define	target_prepare_to_store()	\
      (*current_target.to_prepare_to_store) ()
 
+extern DCACHE *target_dcache;
+
+extern int do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write);
+
 extern int target_read_string (CORE_ADDR, char **, int, int *);
 
 extern int target_read_memory (CORE_ADDR memaddr, char *myaddr, int len);
 
-extern int target_write_memory (CORE_ADDR, char *, int);
+extern int target_write_memory (CORE_ADDR memaddr, char *myaddr, int len);
 
 extern int xfer_memory (CORE_ADDR, char *, int, int, struct target_ops *);
 
@@ -1124,13 +1137,13 @@
 #define target_pid_to_exec_file(pid) \
      (current_target.to_pid_to_exec_file) (pid)
 
-/* Hook to call target-dependant code after reading in a new symbol table.  */
+/* Hook to call target-dependent code after reading in a new symbol table.  */
 
 #ifndef TARGET_SYMFILE_POSTREAD
 #define TARGET_SYMFILE_POSTREAD(OBJFILE)
 #endif
 
-/* Hook to call target dependant code just after inferior target process has
+/* Hook to call target dependent code just after inferior target process has
    started.  */
 
 #ifndef TARGET_CREATE_INFERIOR_HOOK
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index cfe54ce..c598a07 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,250 @@
+2000-12-21  Michael Snyder  <msnyder@mvstp600e.cygnus.com>
+
+	* gdb.base/finish.exp: Accept '1' instead of \001 from char_func.
+	Add a RE to accept a non-ascii char if one is ever presented.
+
+2000-12-20  Fernando Nasser  <fnasser@redhat.com>
+
+	* lib/mi-support.exp (mi_gdb_start): Test for MI_OUT, not UI_OUT.
+
+2000-12-18  Michael Snyder  <msnyder@mvstp600e.cygnus.com>
+
+	* gdb.base/setvar.exp: Use double '\\' to quote curly braces 
+	in regexp.  One '\' does not suffice on Linux.
+
+2000-12-09  Michael Chastain  <chastain@redhat.com>
+
+	* gdb.base/break.exp (test_clear_command): Use a marker function
+	rather than 'main' for the test function.  Also move this
+	test to an execution point where the marker function names are
+	guaranteed to be bound to functions.  (Executing tests after a
+	'finish' from main runs into name conflicts with local names
+	in __libc_start_main).
+
+2000-12-07  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* gdb.base/finish.exp: New test for gdb's "finish" command.
+	* gdb.base/return2.exp: New test for gdb's "return" command.
+	* gdb.base/return2.c: New source file for above.
+
+2000-12-05  Michael Snyder  <msnyder@mvstp600e.cygnus.com>
+
+	* gdb.base/constvars.exp: Add a "pass" message if "up" succeeds.
+	* gdb.base/miscexprs.exp: Ditto.
+	* gdb.base/pointers.exp:  Ditto.
+	* gdb.c++/derivation.exp: Ditto.
+	* gdb.c++/local.exp:      Ditto.
+	* gdb.c++/namespace.exp:  Ditto.
+	* gdb.c++/overload.exp:   Ditto.
+	* gdb.c++/ref-types.exp:  Ditto.
+
+2000-12-05  Michael Snyder  <msnyder@mvstp600e.cygnus.com>
+
+	* gdb.base/constvars.exp: Test result of "up" command.
+	* gdb.base/miscexprs.exp: Ditto.
+	* gdb.base/pointers.exp:  Ditto.
+	* gdb.base/scope.exp:     Ditto.
+	* gdb.c++/derivation.exp: Ditto.
+	* gdb.c++/local.exp:      Ditto.
+	* gdb.c++/namespace.exp:  Ditto.
+	* gdb.c++/overload.exp:   Ditto.
+	* gdb.c++/ref-types.exp:  Ditto.
+
+2000-11-22  Michael Chastain  <chastain@redhat.com>
+
+	* mips_pro.exp: Accept either "middle -> top -> main" or
+	"middle -> main" in the backtrace, because gcc can optimize
+	tail calls to jumps.  Remove setup_xfail for the hppa case.
+	Add a comment with the original warning messages from PR 3016,
+	which was filed in 1993, to preserve them for posterity.
+
+2000-11-17  Nick Duffek  <nsd@redhat.com>
+
+	* lib/gdb.exp (gdb_test): Override timeout with board info.
+
+2000-11-17  Nick Duffek  <nsd@redhat.com>
+
+	* gdb.base/display.exp: Don't kill running stub.  Add "again" to
+	the second kill and detach messages.
+
+2000-11-17  Nick Duffek  <nsd@redhat.com>
+
+	* configure.in: Add AC_EXEEXT.
+	* configure: Regenerate.
+	* Makefile.in (just-check): Export EXEEXT.
+	* lib/gdb.exp ($EXEEXT): Import from environment.
+	* gdb.base/maint.exp: Expect $EXEEXT in executable name.  Don't
+	expect "maint dump-me" on Cygwin.
+	* gdb.base/reread.exp ($binfile, $binfile1, $binfile2): Append
+	$EXEEXT.
+
+2000-11-17  Nick Duffek  <nsd@redhat.com>
+
+	* gdb.base/break.exp: Test backtrace and finish from called
+	function on all platforms, not just HP-UX.
+
+2000-11-03  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* config/monitor.exp (gdb_target_cmd): Abstracts some of the
+	code from gdb_target_monitor, so it can be used independantly
+	for gdbserver.  Also comment out an unnecessary PUTS.
+	
+2000-11-03  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* gdb.base/a2-run.exp: Use gdb_skip_stdio_test.
+	* gdb.base/corefile.exp: Expect the message "Program is being
+	debugged already" when we send the "corefile" command, since
+	the preceeding gdb_load may have connected gdb to a remote target.
+	* gdb.base/display.exp: Disable hardware watchpoints if new
+	board info variable "no_hardware_watchpoints" is true.
+	Replace single-letter commands with more readable ones.
+	* gdb.base/recurse.exp (recurse_tests): Disable hardware watchpoints
+	if new board info variable "no_hardware_watchpoints" is true.
+	* gdb.base/restore.exp (restore_tests): Call gdb_skip_stdio_tests
+	to see if stdio (printf) testing is possible.
+	* gdb.base/watchpoint.exp: Disable hardware watchpoints if new
+	board info variable "no_hardware_watchpoints" is true.  Use new
+	proc "gdb_skip_stdio_tests" to see if printf tests are possible.
+
+2000-11-13  Fernando Nasser  <fnasser@redhat.com>
+
+	From Orjan Friberg  <orjanf@axis.com>:
+	* gdb.base/printcmds.exp: Escape curly braces followed by a number
+	in array print pattern match.
+
+2000-11-09  Fernando Nasser  <fnasser@redhat.com>
+
+	* gdb.c++/templates.exp (test_template_breakpoints): Change Britsh
+	spelling "cancelled" to U.S. spelling "canceled" to match changes
+	made to gdb.
+	* gdb.c++/ovldbreak.exp: Ditto.
+
+2000-11-06  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
+
+	* gdb.base/callfuncs.c (main):  Moved to end of file, call
+	t_double_values to initialize the FPU before inferior calls are made.
+	* gdb.base/callfuncs.exp:  Test for register preservation after calling
+	inferior functions.  Add tests for continuining, finishing and
+	returning from a stop in a call dummy.
+
+2000-10-24  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* gdb.base/commands.exp: Break up long lines, and re-indent.
+
+2000-10-19  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* config/gdbserver.exp:  Rewritten from the ground up, to make it
+	compatible with the current dejagnu tree, and to make it work with
+	the new "gdbserver" in libremote.
+
+2000-10-16  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* gdb.base/sizeof.exp (check_sizeof): Skip if no printf support.
+	* gdb.base/varargs.exp: Skip entire test if no printf support.
+	* gdb.base/ending-run.exp (Step to return): Skip if no printf supt.
+	* gdb.base/shlib-call.exp: Skip several tests if no printf support.
+
+2000-10-13  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+	* lib/gdb.exp (gdb_skip_float_test): New proc.  Skip test if
+	no floating point support.
+	(gdb_skip_stdio_test): New proc.  Skip test if no stdio support.
+	* gdb.base/call-ar-st.exp: Use above procs to skip tests.
+	* gdb.base/call-rt-st.exp: Ditto.
+	* gdb.base/call-strs.exp: Ditto.
+
+2000-08-02  Jimmy Guo  <guo@hpcleara.cup.hp.com>
+
+	* gdb.base/sizeof.c: include <stdio.h>.
+
+	* gdb.c++/classes.exp: Use gdb_test instead of send_gdb to
+        'finish', otherwise uncaptured gdb_prompt would potentially
+        throw remaining test points out of sync.
+
+2000-07-26  Scott Bambrough <scottb@netwinder.org>
+
+	* gdb.base/recurse.exp: Run tests for all targets.
+	* gdb.base/so-impl-ld.exp: Added wildcard to handle the
+	gnu-oldld case on ARM.
+	* gdb.base/watchpoint.exp (test_stepping): Clear xfail
+	for ARM targets.
+ 
+Mon Jul 24 07:46:02 CDT 2000  Clinton Popetz  <cpopetz@cygnus.com>
+
+	* gdb.java/configure.in (AC_INIT): Use jmisc.exp.
+	* gdb.java/configure: Rebuild.
+
+Sun Jul 23 21:42:34 2000  Anthony Green  <green@redhat.com>
+
+	* gdb.java/jv-exp.exp: New file.
+
+Sun Jul 23 21:02:42 2000  Anthony Green  <green@redhat.com>
+
+	* configure: Rebuilt.
+	* configure.in (configdirs): Add gdb.java.
+	* gdb.java/jmisc.java: New file.
+	* gdb.java/jmisc.exp: New file.
+	* gdb.java/Makefile.in: New file.
+	* gdb.java/configure: Rebuilt.
+	* gdb.java/configure.in: New file.
+	* lib/java.exp: New file.
+
+Wed Jul 12 18:14:29 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdb.base/exprs.exp: Test casts to a pointer including over and
+ 	underflow.
+
+Thu Jul 13 11:52:53 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdb.base/sizeof.exp, gdb.base/sizeof.c: New files.  Compare GDB
+ 	and the compilers sizes.
+
+2000-07-09  Nick Duffek  <nsd@redhat.com>
+
+	* gdb.c++/misc.cc (class ClassParam, class_param): Define.
+	(use_methods): New function.
+	(main): Call use_methods().
+	* gdb.c++/classes.exp (test_method_param_class): New procedure.
+	(do_tests): Call test_method_param_class.
+
+2000-07-09  Nick Duffek  <nsd@redhat.com>
+
+	* gdb.c++/classes.exp (test_nonexistant_members): Fix name
+	spelling.
+	(test_enums): New procedure.  Move enum tests from end of script
+	to here.  Set breakpoint on function name instead of line number.
+	* gdb.c++/misc.cc (ClassWithEnum): Move past Foo definitions.
+	(enums2): New marker function.
+	(enums1): New function.
+	(main): Call enums1().  Move enum tests to enums1().
+
+Tue Jul  4 03:43:49 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdb.asm/asm-source.exp: Use raw AS/LD instead of CC to
+ 	compile/link program.  Update line numbers.
+	* gdb.asm/d10v.inc: Define ``startup''.
+	* gdb.asm/asmsrc1.s: Add definition of _start.
+	
+Fri Jun 23 17:45:52 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdb.base/call-ar-st.exp: More rewrites of multi-line patterns.
+
+2000-06-18  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+	* gdb.base/maint.exp: Add 'maint print architecture' item to output
+ 	of 'help maint print' command.
+
+Fri Jun 16 18:22:05 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdb.base/call-ar-st.exp: Rewrite all multi-line patterns so that
+ 	they use gdb_expect_list.
+
+Wed Jun  7 13:02:40 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* gdb.base/commands.exp: Use ``set remote
+ 	memory-read-packet-size'' instead of ``set endian big'' to test
+ 	long commands.
+
 2000-06-03  Daniel Berlin  <dan@cgsoftware.com>
 
 	* gdb.c++/templates.exp (do_tests): Make all of these work under
@@ -6,8 +253,19 @@
 	* gdb.c++/namespace.exp: Move from gdb.hp/gdb.aCC to here, make it
 	work under g++.
 
-	* gdb.c++/misc.cc: Fix ambiguous initialization with correct initialization.
-	
+	* gdb.c++/misc.cc: Fix ambiguous initialization with correct 
+	initialization.
+
+2000-06-02  Michael Snyder  <msnyder@seadog.cygnus.com>
+
+	* gdb.base/annota1.exp (run until main breakpoint): Loosen up
+	the regular expression: accept an (almost) arbitrary sequence of
+	"frames-invalid" and "breakpoints-invalid" messages both before
+	and after the "starting" message.
+
+2000-06-02  Michael Snyder  <msnyder@seadog.cygnus.com>
+
+	* gdb.c++/local.exp: This test has never been known to work with g++.
 
 2000-05-18  Michael Snyder  <msnyder@seadog.cygnus.com>
 
diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
index c3b94f7..fe7891c 100644
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -31,6 +31,7 @@
 target_cpu = @gdb_target_cpu@
 
 SHELL = @SHELL@
+EXEEXT = @EXEEXT@
 SUBDIRS = @subdirs@
 RPATH_ENVVAR = @RPATH_ENVVAR@
 
@@ -125,6 +126,7 @@
 	rootme=`pwd`; export rootme; \
 	srcdir=${srcdir} ; export srcdir ; \
 	EXPECT=${EXPECT} ; export EXPECT ; \
+	EXEEXT=${EXEEXT} ; export EXEEXT ; \
         $(RPATH_ENVVAR)=$$rootme/../../expect:$$rootme/../../libstdc++:$$rootme/../../tk/unix:$$rootme/../../tcl/unix:$$rootme/../../bfd:$$rootme/../../opcodes:$$$(RPATH_ENVVAR); \
 	export $(RPATH_ENVVAR); \
 	if [ -f $${rootme}/../../expect/expect ] ; then  \
diff --git a/gdb/testsuite/config/gdbserver.exp b/gdb/testsuite/config/gdbserver.exp
index bb6f724..770be2c 100644
--- a/gdb/testsuite/config/gdbserver.exp
+++ b/gdb/testsuite/config/gdbserver.exp
@@ -1,6 +1,9 @@
-# Test Framework Driver for GDB using the extended gdb remote protocol
-#   Copyright 1995, 1997 Free Software Foundation, Inc.
-#
+# Test framework for GDB (remote protocol) using a "gdbserver",
+# ie. a debug agent running as a native process on the same or
+# a different host.
+
+#   Copyright (C) 2000, 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
@@ -14,91 +17,158 @@
 # 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.  
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file was written by Michael Snyder. (msnyder@redhat.com)
+
 #
-# For this to function correctly, you need to set a number of variables
-# in your gdb/site.exp file
-#
-#	set noargs 1		-- we can't pass arguments (yet)
-#	set noinferiorio 1	-- we can't get io to/from the inferior
-#	set targethost <host>	-- name of the remote system (runs gdbserver)
-#	set debughost <host>	-- name of the system running gdb
-#	set port <number>	-- starting port number for communication
-#	set gdbserver <path>	-- path (on the remote side) to find
-#				   gdbserver
-#       set rsh <path>		-- path (on debughost side) to rsh
-#	set rcp <path>		-- path (on debughost side) to rcp
-#	
-# You will need to be able to spawn processes from gdbhost to run on
-# targethost via rsh (this is how we start gdbserver); similarly
-# you need to be able to rcp files from gdbhost to targethost.
-#
-# We don't do much error checking, if something goes wrong, you'll probably
-# just get a tcl error and everything will die.  FIXME
+# This module to be used for testing gdb with a "gdbserver" 
+# built either from libremote or from gdb/gdbserver.  
 #
 
-# Load the basic gdb testing library
-load_lib gdb.exp
-load_lib monitor.exp
+# Load the basic testing library, and the remote stuff.
+load_lib ../config/monitor.exp
+
+#
+# To be addressed or set in your baseboard config file:
+#
+#   set_board_info gdb_protocol "remote"
+#	Unles you have a gdbserver that uses a different protocol...
+#
+#   set_board_info use_gdb_stub 1
+#	This tells the rest of the test suite not to do things
+#	like "run" which don't work well on remote targets.
+#
+#   set_board_info gdb,do_reload_on_run 1
+#	Unles you have a gdbserver that can handle multiple sessions.
+#
+#   set_board_info noargs 1
+#	At present there is no provision in the remote protocol
+#	for passing arguments.  This test framework does not
+#	address the issue, so it's best to set this variable
+#	in your baseboard configuration file.  
+#	FIXME: there's no reason why the test harness couldn't
+#	pass commandline args when it spawns gdbserver.
+#
+#   set_board_info gdb,noinferiorio 1
+#	Neither the traditional gdbserver nor the one in libremote
+#	can presently capture stdout and relay it to GDB via the
+#	'O' packet.  This means that tests involving printf will
+#	fail unles you set this varibale in your baseboard
+#	configuration file.
+#   
+#   set_board_info gdb,no_hardware_watchpoints 1
+#	Unles you have a gdbserver that supports hardware watchpoints.
+#	FIXME: gdb should detect if the target doesn't support them,
+#	and fall back to using software watchpoints.
+#
+#   set_board_info gdb_server_prog
+#	This will be the path to the gdbserver program you want to test.
+#	Defaults to "gdbserver".
+#
+#   set_board_info sockethost
+#	The name of the host computer whose socket is being used.
+#	Defaults to "localhost".  Note: old gdbserver requires 
+#	that you define this, but libremote/gdbserver does not.
+#
+#   set_board_info socketport
+#	Port id to use for socket connection.  If not set explicitly,
+#	it will start at "2345" and increment for each use.
+#
+
+
 
 #
 # gdb_load -- load a file into the debugger.
 #             return a -1 if anything goes wrong.
 #
-# Loading a file in the gdbsrever framework is a little strange in that
-# we also create the inferior (which is stopped at the first instruction
-# in the program when we get control).
-#
-proc gdb_load { arg } {
-    global verbose
-    global loadpath
-    global loadfile
-    global GDB
-    global gdb_prompt
-    global debughost
-    global port
 
-    # bump the port number to avoid conflicts with hung ports
-    set targethost [target_info gdb_server_host];
-    set debughost [target_info gdb_debug_host];
+global server_exec;
+global portnum;
+set portnum "2345";
+
+proc gdb_load { args } {
+    global server_exec;
+    global portnum;
+
+    # Port id -- either specified in baseboard file, or managed here.
+    if [target_info exists gdb,socketport] {
+	set portnum [target_info gdb,socketport];
+    } else {
+	# Bump the port number to avoid conflicts with hung ports.
+	incr portnum;
+    }
+
+    # Extract the local and remote host ids from the target board struct.
+
+    if [target_info exists sockethost] {
+	set debughost  [target_info sockethost];
+    } else {
+	set debughost "localhost:";
+    }
+    # Extract the protocol
+    if [target_info exists gdb_protocol] {
+	set protocol [target_info gdb_protocol];
+    } else {
+	set protocol "remote";
+    }
+
+    # Extract the name of the gdbserver, if known (default 'gdbserver').
     if [target_info exists gdb_server_prog] {
 	set gdbserver [target_info gdb_server_prog];
     } else {
 	set gdbserver "gdbserver";
     }
-    incr port
-    set serialport $targethost:$port
-     
-    # Copy the file down to the remote host.
-    set file [remote_download host $arg];
+    # Extract the socket hostname
+    if [target_info exists sockethost] {
+	set sockethost [target_info sockethost];
+    } else {
+	set sockethost ""
+    }
 
-    # now start gdbserver on the remote side
-    remote_spawn host "$gdbserver $debughost:$port $file >& /dev/null < /dev/null"
- 
-    # give it plenty of time to get going (lynx)
-    sleep 30
+    # Export the host:port pair.
+    set gdbport $debughost$portnum;
 
-    # tell gdb we are remote debugging
-    if [gdb_target_monitor $arg] {
+    if { $args == "" || $args == "{}" } {
+	if [info exists server_exec] {
+	    set args $server_exec;
+	} else {
+	    send_gdb "info files\n";
+	    gdb_expect 30 {
+		-re "Symbols from \"(\[^\"\]+)\"" {
+		    set args $expect_out(1,string);
+		    exp_continue;
+		}
+		-re "Local exec file:\[\r\n\]+\[ \t\]*`(\[^'\]+)'," {
+		    set args $expect_out(1,string);
+		    exp_continue;
+		}
+		-re "$gdb_prompt $" { }
+	    }
+	}
+    }
+
+    # remember new exec file 
+    set server_exec $args;
+
+    # Fire off the debug agent
+    remote_spawn host \
+	    "$gdbserver $sockethost$portnum $args >& /dev/null < /dev/null &" \
+	    writeonly 
+    
+    # Give it a little time to establish
+    sleep 2
+
+    # tell gdb what file we are debugging
+    if [gdb_file_cmd $args] {
 	return -1;
     }
 
-    return 1
+    # attach to the "serial port"
+    gdb_target_cmd $protocol $gdbport;
+
+    return 0;
 }
 
-#
-# gdb_start -- start GDB running.
-#
-proc gdb_start { } {
-    global gdb_prompt
-
-    # do the usual stuff
-    catch default_gdb_start
-
-    # FIXME: This shouldn't be necessary, but lots of PA tests fail
-    # without it.
-    send "set remotecache 0\n"
-    expect {
-	-re "set remotecache 0\[\r\n\]+.*$gdb_prompt $" {}
-	default { fail "gdb_start"}
-    }
-}
diff --git a/gdb/testsuite/config/monitor.exp b/gdb/testsuite/config/monitor.exp
index b482480..0b94ad3 100644
--- a/gdb/testsuite/config/monitor.exp
+++ b/gdb/testsuite/config/monitor.exp
@@ -16,7 +16,60 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
 
 load_lib gdb.exp
-puts "***** DID USE MONITOR ******"
+# puts "***** DID USE MONITOR ******"
+
+#
+# gdb_target_cmd
+# Send gdb the "target" command
+#
+proc gdb_target_cmd { targetname serialport } {
+    global gdb_prompt
+
+    for {set i 1} {$i <= 3} {incr i} {
+	send_gdb "target $targetname $serialport\n"
+	gdb_expect 60 {
+	    -re "A program is being debugged already.*ill it.*y or n. $" {
+		send_gdb "y\n";
+		exp_continue;
+	    }
+	    -re "Couldn't establish connection to remote.*$gdb_prompt" {
+		verbose "Connection failed";
+	    }
+	    -re "Remote MIPS debugging.*$gdb_prompt" {
+		verbose "Set target to $targetname";
+		return 0;
+	    }
+	    -re "Remote debugging using .*$serialport.*$gdb_prompt" {
+		verbose "Set target to $targetname";
+		return 0;
+	    }
+	    -re "Remote target $targetname connected to.*$gdb_prompt" {
+		verbose "Set target to $targetname";
+		return 0;
+	    }
+	    -re "Connected to.*$gdb_prompt" { 
+		verbose "Set target to $targetname";
+		return 0;
+	    }
+	    -re "Ending remote.*$gdb_prompt" { }
+	    -re "Connection refused.*$gdb_prompt" {
+		verbose "Connection refused by remote target.  Pausing, and trying again."
+		sleep 30
+		continue
+	    }
+	    -re "Timeout reading from remote system.*$gdb_prompt" {
+		verbose "Got timeout error from gdb.";
+	    }
+	    timeout {
+		send_gdb "";
+		break
+	    }
+	}
+    }
+}
+
+
+
 #
 # gdb_target_monitor
 # Set gdb to target the monitor
@@ -55,47 +108,7 @@
     for {set j 1} {$j <= 2} {incr j} {
 	if [gdb_file_cmd $exec_file] { return -1; }
 
-	for {set i 1} {$i <= 3} {incr i} {
-    	    send_gdb "target $targetname $serialport\n"
-	    gdb_expect 60 {
-		-re "A program is being debugged already.*ill it.*y or n. $" {
-		    send_gdb "y\n";
-		    exp_continue;
-		}
-		-re "Couldn't establish connection to remote.*$gdb_prompt" {
-		    verbose "Connection failed";
-		}
-		-re "Remote MIPS debugging.*$gdb_prompt" {
-		    verbose "Set target to $targetname";
-		    return 0;
-		}
-		-re "Remote debugging using .*$serialport.*$gdb_prompt" {
-		    verbose "Set target to $targetname";
-		    return 0;
-		}
-		-re "Remote target $targetname connected to.*$gdb_prompt" {
-		    verbose "Set target to $targetname";
-		    return 0;
-		}
-		-re "Connected to.*$gdb_prompt" { 
-		    verbose "Set target to $targetname";
-		    return 0;
-		}
-		-re "Ending remote.*$gdb_prompt" { }
-		-re "Connection refused.*$gdb_prompt" {
-		    verbose "Connection refused by remote target.  Pausing, and trying again."
-		    sleep 30
-		    continue
-		}
-		-re "Timeout reading from remote system.*$gdb_prompt" {
-		    verbose "Got timeout error from gdb.";
-		}
-		timeout {
-		    send_gdb "";
-		    break
-		}
-	    }
-	}
+	gdb_target_cmd $targetname $serialport;
 
 	gdb_target_exec;
 
diff --git a/gdb/testsuite/configure b/gdb/testsuite/configure
index 1922f2f..ba66f40 100755
--- a/gdb/testsuite/configure
+++ b/gdb/testsuite/configure
@@ -652,6 +652,7 @@
 configdirs="gdb.asm \
             gdb.base \
             gdb.c++ \
+            gdb.java \
             gdb.disasm \
             gdb.chill \
             gdb.mi \
@@ -747,6 +748,102 @@
 fi
 # End stuff to support --enable-shared
 
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:753: 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 758 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:769: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_cygwin=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:786: 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 791 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:798: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_mingw32=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:817: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  ac_cv_exeext=.exe
+else
+  rm -f conftest*
+  echo 'int main () { return 0; }' > conftest.$ac_ext
+  ac_cv_exeext=
+  if { (eval echo configure:827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+    for file in conftest.*; do
+      case $file in
+      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+      esac
+    done
+  else
+    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+  fi
+  rm -f conftest*
+  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+
 # configure the subdirectories too
 subdirs="$configdirs"
 
@@ -912,6 +1009,7 @@
 s%@build_vendor@%$build_vendor%g
 s%@build_os@%$build_os%g
 s%@RPATH_ENVVAR@%$RPATH_ENVVAR%g
+s%@EXEEXT@%$EXEEXT%g
 s%@subdirs@%$subdirs%g
 
 CEOF
diff --git a/gdb/testsuite/configure.in b/gdb/testsuite/configure.in
index 049a3b4..446c8d1 100644
--- a/gdb/testsuite/configure.in
+++ b/gdb/testsuite/configure.in
@@ -16,6 +16,7 @@
 configdirs="gdb.asm \
             gdb.base \
             gdb.c++ \
+            gdb.java \
             gdb.disasm \
             gdb.chill \
             gdb.mi \
@@ -105,6 +106,9 @@
 fi
 # End stuff to support --enable-shared
 
+dnl Check for exe extension set on certain hosts (e.g. Win32)
+AC_EXEEXT
+
 # configure the subdirectories too
 AC_CONFIG_SUBDIRS($configdirs)
 
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index 6c2cab9..b517827 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -31,9 +31,13 @@
 set prms_id 0
 set bug_id 0
 
+set asm-arch ""
+set asm-flags ""
+
 if [istarget "d10v-*-*"] then {
     set asm-arch d10v
-} else {
+}
+if { "${asm-arch}" == "" } {
     verbose "Skipping assembly source test -- not implemented for this target."
     return 
 }
@@ -43,16 +47,19 @@
 set src1 ${srcdir}/${subdir}/asmsrc1.s
 set src2 ${srcdir}/${subdir}/asmsrc2.s
 
-set asm-flags "-Wa,-gstabs,-I${srcdir}/${subdir},-I${objdir}/${subdir}"
+if { "${asm-flags}" == "" } {
+    #set asm-flags "-Wa,-gstabs,-I${srcdir}/${subdir},-I${objdir}/${subdir}"
+    set asm-flags "-gstabs -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+}
 
-if {[gdb_compile ${src1} asmsrc1.o object "additional_flags=${asm-flags}"] != ""} then {
+if {[target_assemble ${src1} asmsrc1.o "${asm-flags}"] != ""} then {
      gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
 }
-if {[gdb_compile ${src2} asmsrc2.o object "additional_flags=${asm-flags}"] != ""} then {
+if {[target_assemble ${src2} asmsrc2.o "${asm-flags}"] != ""} then {
      gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
 }
 
-if  { [gdb_compile "asmsrc1.o asmsrc2.o" ${binfile} executable "ldflags=-nodefaultlibs"] != "" } {
+if  { [target_link "asmsrc1.o asmsrc2.o" ${binfile} ""] != "" } {
      gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
 }
 
@@ -72,10 +79,10 @@
 }
 
 # Execute the `f' command and see if the result includes source info.
-gdb_test "f" "asmsrc1\[.\]s:18.*several_nops" "f at main"
+gdb_test "f" "asmsrc1\[.\]s:29.*several_nops" "f at main"
 
 # See if we properly `next' over a macro with several insns.
-gdb_test "n" "22\[ 	\]*.*foo2" "next over macro"
+gdb_test "n" "33\[ 	\]*.*foo2" "next over macro"
 
 # See if we can properly `step' into a subroutine call.
 gdb_test "s" "8\[ 	\]*.*" "step into foo2"
@@ -86,8 +93,11 @@
 # `next' one insn (or macro) to set up our stackframe (for the following bt).
 gdb_test "n" "12\[ 	\]*.*foo3" "n in foo2"
 
-# See if `bt' prints the right source files.
-gdb_test "bt" "\#0.*foo2.*asmsrc2\[.\]s:12.*\#1.*main.*asmsrc1\[.\]s:22" "bt in foo2"
+# See if a simple `bt' prints the right source files and doesn't fall off the stack.
+gdb_test "bt 10" "\#0.*foo2.*asmsrc2\[.\]s:12.*\#1.*main.*asmsrc1\[.\]s:33" "bt ALL in foo2"
+
+# See if a capped `bt' prints the right source files.
+gdb_test "bt 2" "\#0.*foo2.*asmsrc2\[.\]s:12.*\#1.*main.*asmsrc1\[.\]s:33.*" "bt 2 in foo2"
 
 # Step into another subroutine which lives back in the first source file.
 gdb_test "s" "" "s 2"
@@ -95,5 +105,5 @@
 # Next over insns to set up the stack frame.
 gdb_test "n" "" "n 2"
 
-# Now see if `bt' is correct.
-gdb_test "bt" "\#0.*foo3.*asmsrc1\[.\]s:33.*\#1.*foo2.*asmsrc2\[.\]s:12.*\#2.*main.*asmsrc1\[.\]s:22" "bt in foo3"
+# Now see if a capped `bt' is correct.
+gdb_test "bt 3" "\#0.*foo3.*asmsrc1\[.\]s:44.*\#1.*foo2.*asmsrc2\[.\]s:12.*\#2.*main.*asmsrc1\[.\]s:33.*" "bt 3 in foo3"
diff --git a/gdb/testsuite/gdb.asm/asmsrc1.s b/gdb/testsuite/gdb.asm/asmsrc1.s
index be10280..0e133d2 100644
--- a/gdb/testsuite/gdb.asm/asmsrc1.s
+++ b/gdb/testsuite/gdb.asm/asmsrc1.s
@@ -1,13 +1,24 @@
 	.include "common.inc"
 	.include "arch.inc"
 
+comment "WARNING: asm-source.exp checks for line numbers printed by gdb."
+comment "Be careful about changing this file without also changing"
+comment "asm-source.exp."
+
+	
+comment	"This file is not linked with crt0."
+comment	"Provide very simplistic equivalent."
+	
+	.global _start
+_start:
+	startup
+	call main
+	exit0
+
+
 comment "main routine for assembly source debugging test"
 comment "This particular testcase uses macros in <arch>.inc to achieve"
-comment "machine independence.  This file must be compiled with -Darch=foo."
-
-comment "WARNING: asm-source.exp checks for line numbers printed by gdb,"
-comment "therefore be careful about changing this file without also changing"
-comment "asm-source.exp."
+comment "machine independence."
 
 	.global main
 main:
diff --git a/gdb/testsuite/gdb.asm/d10v.inc b/gdb/testsuite/gdb.asm/d10v.inc
index e39a498..cea1104 100644
--- a/gdb/testsuite/gdb.asm/d10v.inc
+++ b/gdb/testsuite/gdb.asm/d10v.inc
@@ -26,3 +26,7 @@
 	ldi r0, 0
 	trap 15
 	.endm
+
+	comment "crt0 startup"
+	.macro startup
+	.endm
diff --git a/gdb/testsuite/gdb.base/a2-run.exp b/gdb/testsuite/gdb.base/a2-run.exp
index 4341d27..c00442e 100644
--- a/gdb/testsuite/gdb.base/a2-run.exp
+++ b/gdb/testsuite/gdb.base/a2-run.exp
@@ -26,8 +26,8 @@
     return
 }
 
-if [target_info exists gdb,noinferiorio] {
-    verbose "Skipping a2-run.exp because of noinferiorio."
+# Can't do this test without stdio support.
+if [gdb_skip_stdio_test "a2run.exp"] {
     return
 }
 
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
index d38858d..6c1eded 100644
--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -142,11 +142,16 @@
 #
 #exp_internal 1
 send_gdb "run\n"
-  gdb_expect {
-    -re "\r\n\032\032post-prompt\r\nStarting program: $binfile \(\r\n\r\n\032\032frames-invalid\)+\(\r\n\r\n\032\032breakpoints-invalid\)*.*\(\r\n\r\n\032\032frames-invalid\)*\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n.*$gdb_prompt$" \
-	                    { pass "run until main breakpoint" }
-    -re ".*$gdb_prompt$"       { fail "run until main breakpoint" }
-    timeout	            { fail "run until main breakpoint (timeout)" }
+gdb_expect {
+    -re "\r\n\032\032post-prompt\r\nStarting program: $binfile \(\r\n\r\n\032\032frames-invalid\)+\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped.*$gdb_prompt$" {
+	pass "run until main breakpoint" 
+    }
+    -re ".*$gdb_prompt$" { 
+	fail "run until main breakpoint" 
+    }
+    timeout { 
+	fail "run until main breakpoint (timeout)" 
+    }
   }
 #exp_internal 0
 #exit 0
diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp
index aa9fba5..9473324 100644
--- a/gdb/testsuite/gdb.base/break.exp
+++ b/gdb/testsuite/gdb.base/break.exp
@@ -520,6 +520,15 @@
   timeout {fail "(timeout) clear current line has no breakpoint disallowed"}
 }
 
+# Verify that we can set and clear multiple breakpoints.
+#
+# We don't test that it deletes the correct breakpoints.  We do at
+# least test that it deletes more than one breakpoint.
+#
+gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #1"
+gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #2"
+gdb_test "clear marker3" {Deleted breakpoints [0-9]+ [0-9]+.*}
+
 # Verify that a breakpoint can be set via a convenience variable.
 #
 send_gdb "set \$foo=81\n"
@@ -577,31 +586,35 @@
 # As long as we're stopped (breakpointed) in a called function,
 # verify that we can successfully backtrace & such from here.
 #
-
-if [istarget "hppa*-*-hpux*"] then {
-  send_gdb "bt\n"
-  gdb_expect {
-      -re "#0\[ \t\]*$hex in marker2.*:4\[49\]\r\n#1.*_sr4export.*$gdb_prompt $"\
+# In this and the following test, the _sr4export check apparently is needed
+# for hppa*-*-hpux.
+#
+send_gdb "bt\n"
+gdb_expect {
+    -re "#0\[ \t\]*$hex in marker2.*:4\[49\]\r\n#1.*_sr4export.*$gdb_prompt $"\
             {pass "backtrace while in called function"}
-      -re "#0\[ \t\]*$hex in marker2.*:4\[49\]\r\n#1.*function called from gdb.*$gdb_prompt $"\
-
-            {pass "backtrace while in called function"}
+    -re "#0\[ \t\]*($hex in )?marker2.*:4\[49\]\r\n#1.*function called from gdb.*$gdb_prompt $"\
+	    {pass "backtrace while in called function"}
     -re "$gdb_prompt $"\
             {fail "backtrace while in called function"}
     timeout {fail "(timeout) backtrace while in called function"}
-  }
-  send_gdb "finish\n"
-  gdb_expect {
-      -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.* in _sr4export.*$gdb_prompt $"\
+}
+
+# Return from the called function.  For remote targets, it's important to do
+# this before runto_main, which otherwise may silently stop on the dummy
+# breakpoint inserted by GDB at the program's entry point.
+#
+send_gdb "finish\n"
+gdb_expect {
+    -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.* in _sr4export.*$gdb_prompt $"\
             {pass "finish from called function"}
-      -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.*function called from gdb.*$gdb_prompt $"\
+    -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.*function called from gdb.*$gdb_prompt $"\
             {pass "finish from called function"}
-      -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.*Value returned.*$gdb_prompt $"\
+    -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.*Value returned.*$gdb_prompt $"\
             {pass "finish from called function"}
     -re "$gdb_prompt $"\
             {fail "finish from called function"}
     timeout {fail "(timeout) finish from called function"}
-  }
 }
 
 # Verify that GDB responds gracefully to a "finish" command with
@@ -702,15 +715,6 @@
 #********
 
 
-proc test_clear_command {} {
-    gdb_test "break main" "Breakpoint.*at.*" "break main #1"
-    gdb_test "break main" "Breakpoint.*at.*" "break main #2"
-
-    # We don't test that it deletes the correct breakpoints.  We do at
-    # least test that it deletes more than one breakpoint.
-    gdb_test "clear main" {Deleted breakpoints [0-9]+ [0-9]+.*}
-}
-
 #
 # Test "next" over recursive function call.
 #
@@ -798,7 +802,6 @@
    gdb_stop_suppressing_tests;
 }
 
-test_clear_command
 test_next_with_recursion
 
 
diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp
index 3744528..dbf992f 100644
--- a/gdb/testsuite/gdb.base/call-ar-st.exp
+++ b/gdb/testsuite/gdb.base/call-ar-st.exp
@@ -85,10 +85,8 @@
     }
 }
 
-
 source ${binfile}.ci
 
-
 # Start with a fresh gdb.
 
 gdb_exit
@@ -116,7 +114,8 @@
 
 
 #call print_double_array(double_array)
-if {![target_info exists gdb,skip_float_tests]} {
+if {![gdb_skip_float_test "print print_double_array(double_array)"] && \
+    ![gdb_skip_stdio_test "print print_double_array(double_array)"] } {
   send_gdb "print print_double_array(double_array)\n"
   gdb_expect_list "print print_double_array(double_array)" ".*$gdb_prompt $" {
 	"\[ \t\r\n\]+array_d :"
@@ -140,14 +139,18 @@
 
 #call print_char_array(char_array)
 
-send_gdb "print print_char_array(char_array)\n"
-gdb_expect {
-    -re "array_c :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+Z\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa\[ \t\r\n\]+\[ \t\r\n\]+.*\[ \t\r\n\]+.*$gdb_prompt $" {
-        pass "print print_char_array(char_array)"
-      }
-    -re ".*$gdb_prompt $" { fail "print print_char_array(char_array)" }
-    timeout           { fail "(timeout) print print_char_array(char_array)" }
-  }
+if ![gdb_skip_stdio_test "print_char_array(char_array)"] {
+    send_gdb "print print_char_array(char_array)\n"
+    gdb_expect_list "print print_char_array(char_array)" ".*$gdb_prompt $" {
+	"\[ \t\r\n\]+array_c :"
+	"\[ \t\r\n\]+========="
+	"\[ \t\r\n\]+\[ \t\r\n\]+Z"
+	"\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ"
+	"\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ"
+	"\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa\[ \t\r\n\]+\[ \t\r\n\]+"
+    }
+}
+
 
 
 
@@ -156,13 +159,20 @@
 "Breakpoint.*file.*$srcfile, line 1216.*" \
 "tbreakpoint line 1216"
 
-send_gdb "continue\n"
-gdb_expect {
-    -re "array_c :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+Z\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa\[ \t\r\n\]+\[ \t\r\n\]+\[ \t\r\n\]+main.*at.*$srcfile:1216\[ \t\r\n\]+.*print_double_array\\(double_array\\).*$gdb_prompt $" {
-        pass "continue to 1216"
-      }
-    -re ".*$gdb_prompt $" { fail "continue to 1216" }
-    timeout           { fail "(timeout) continue to 1216" }
+if ![gdb_skip_stdio_test "continue to 1216"] {
+    send_gdb "continue\n"
+    gdb_expect_list "continue to 1216" ".*$gdb_prompt $" {
+	"\[ \t\r\n\]+array_c :"
+	"\[ \t\r\n\]+========="
+	"\[ \t\r\n\]+\[ \t\r\n\]+Z"
+	"\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ"
+	"\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ"
+	"\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa"
+	"\[ \t\r\n\]+main.*at.*:1216"
+	"\[ \t\r\n\]+1216.*print_double_array\\(double_array\\)"
+    }
+} else {
+    gdb_test "continue" "" ""
 }
 
 # I am disabling this test, because it takes too long. I verified by
@@ -180,74 +190,87 @@
 #set timeout $oldtimeout
 #go -until 1220
 gdb_test "tbreak 1220" \
-    "Breakpoint.* file .*$srcfile, line 1220.*" \
-    "tbreakpoint line 1220"
+	"Breakpoint.* file .*$srcfile, line 1220.*" \
+	"tbreakpoint line 1220"
 
-send_gdb "continue\n"
-gdb_expect_list "continuing to breakpoint 1220" ".*$gdb_prompt $" {
-    "Continuing\\."
-    "\[ \t\r\n\]+array_d :"
-    "\[ \t\r\n\]+========="
-    "\[ \t\r\n\]+0.000000"
-    "\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600"
-    "\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200"
-    "\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800"
-    "\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400"
-    "\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000"
-    "\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600"
-    "\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200"
-    "\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800"
-    "\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400"
-    "\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000"
-    "\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600"
-    "\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200"
-    "\[ \t\r\n\]+2275.299900  2298.756600  2322.213300\[ \t\r\n\]+\[ \t\r\n\]+"
-    ".*array_f :"
-    ".*student id :\[\t \]+.*YELLOW"
-    ".*array_i :"
-    ".*main \\(\\) at .*call-ar-st.c:1220\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)."
+if ![gdb_skip_stdio_test "continuing to breakpoint 1220"] {
+    send_gdb "continue\n"
+    gdb_expect_list "continuing to breakpoint 1220" ".*$gdb_prompt $" {
+	"Continuing\\."
+	"\[ \t\r\n\]+array_d :"
+	"\[ \t\r\n\]+========="
+	"\[ \t\r\n\]+0.000000"
+	"\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600"
+	"\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200"
+	"\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800"
+	"\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400"
+	"\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000"
+	"\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600"
+	"\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200"
+	"\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800"
+	"\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400"
+	"\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000"
+	"\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600"
+	"\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200"
+	"\[ \t\r\n\]+2275.299900  2298.756600  2322.213300\[ \t\r\n\]+\[ \t\r\n\]+"
+	".*array_f :"
+	".*student id :\[\t \]+.*YELLOW"
+	".*array_i :"
+	".*main \\(\\) at .*call-ar-st.c:1220\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)."
+    }
+} else {
+    gdb_test "continue" "" ""
 }
 
 #step
-    send_gdb "step\n"
-    gdb_expect {
-        -re "print_all_arrays \\(array_i=, array_c=.ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*call-ar-st.c:306\[ \t\r\n\]+306.*print_int_array\\(array_i\\);.*$gdb_prompt $" {pass "step inside print_all_arrays"}
-        -re ".*$gdb_prompt $" { fail "step inside print_all_arrays" }
-        timeout { fail "step inside print_all_arrays (timeout)" }
-    }
+send_gdb "step\n"
+gdb_expect {
+    -re "print_all_arrays \\(array_i=, array_c=.ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*call-ar-st.c:306\[ \t\r\n\]+306.*print_int_array\\(array_i\\);.*$gdb_prompt $" {pass "step inside print_all_arrays"}
+    -re ".*$gdb_prompt $" { fail "step inside print_all_arrays" }
+    timeout { fail "step inside print_all_arrays (timeout)" }
+}
 
 
 #step -over
+if ![gdb_skip_stdio_test "next over print_int_array in print_all_arrays"] {
     send_gdb "next\n"
     gdb_expect {
-        -re "array_i :.*307.*print_char_array\\(array_c\\);.*$gdb_prompt $" {pass "next over print_int_array in print-all_arrays"}
-        -re ".*$gdb_prompt $" { fail "next over print_int_array in print-all_arrays" }
-        timeout { fail "next over print_int_array in print-all_arrays (timeout)" }
+	-re "array_i :.*307.*print_char_array.*$gdb_prompt $" {
+	    pass "next over print_int_array in print-all_arrays"
+	}
+	-re ".*$gdb_prompt $" { 
+	    fail "next over print_int_array in print-all_arrays" 
+	}
+	timeout { 
+	    fail "next over print_int_array in print-all_arrays (timeout)"
+	}
     }
-
-
+} else {
+    gdb_test "next" "" ""
+}
 
 #call print_double_array(array_d)
-if {![target_info exists gdb,skip_float_tests]} {
-  send_gdb "print print_double_array(array_d)\n"
-  gdb_expect_list "print print_double_array(array_d)" ".*$gdb_prompt $" {
-      "array_d :"
-      "\[ \t\r\n\]+========="
-      "\[ \t\r\n\]+\[ \t\r\n\]+0.000000"
-      "\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600"
-      "\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200"
-      "\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800"
-      "\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400"
-      "\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000"
-      "\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600"
-      "\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200"
-      "\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800"
-      "\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400"
-      "\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000"
-      "\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600"
-      "\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200"
-      "\[ \t\r\n\]+2275.299900  2298.756600  2322.213300\[ \t\r\n\]+\[ \t\r\n\]+"
-  }
+if {![gdb_skip_float_test "print print_double_array(array_d)"] && \
+    ![gdb_skip_stdio_test "print print_double_array(array_d)"] } {
+    send_gdb "print print_double_array(array_d)\n"
+    gdb_expect_list "print print_double_array(array_d)" ".*$gdb_prompt $" {
+	"array_d :"
+	"\[ \t\r\n\]+========="
+	"\[ \t\r\n\]+\[ \t\r\n\]+0.000000"
+	"\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600"
+	"\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200"
+	"\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800"
+	"\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400"
+	"\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000"
+	"\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600"
+	"\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200"
+	"\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800"
+	"\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400"
+	"\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000"
+	"\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600"
+	"\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200"
+	"\[ \t\r\n\]+2275.299900  2298.756600  2322.213300\[ \t\r\n\]+\[ \t\r\n\]+"
+    }
 }
 
 #go -until 1236
@@ -255,58 +278,74 @@
 "Breakpoint.* file .*$srcfile, line 1236.*" \
 "tbreakpoint line 1236"
 
-send_gdb "continue\n"
-gdb_expect_list "continuing to 1236"  ".*$gdb_prompt $" {
-    "Continuing\\..*array_c"
-    ".*array_f"
-    "\[ \t\r\n\]+array_d :"
-    "\[ \t\r\n\]+========="
-    "\[ \t\r\n\]+0.000000"
-    "\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600"
-    "\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200"
-    "\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800"
-    "\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400"
-    "\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000"
-    "\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600"
-    "\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200"
-    "\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800"
-    "\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400"
-    "\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000"
-    "\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600"
-    "\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200"
-    "\[ \t\r\n\]+2275.299900  2298.756600  2322.213300.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1236.*printf\\(.BYE BYE FOR NOW.n.\\)."
+if ![gdb_skip_stdio_test "continuing to 1236"] {
+    send_gdb "continue\n"
+    gdb_expect_list "continuing to 1236"  ".*$gdb_prompt $" {
+	"Continuing\\..*array_c"
+	".*array_f"
+	"\[ \t\r\n\]+array_d :"
+	"\[ \t\r\n\]+========="
+	"\[ \t\r\n\]+0.000000"
+	"\[ \t\r\n\]+23.456700  46.913400  70.370100  93.826800  117.283500  140.740200  164.196900  187.653600"
+	"\[ \t\r\n\]+211.110300  234.567000  258.023700  281.480400  304.937100  328.393800  351.850500  375.307200"
+	"\[ \t\r\n\]+398.763900  422.220600  445.677300  469.134000  492.590700  516.047400  539.504100  562.960800"
+	"\[ \t\r\n\]+586.417500  609.874200  633.330900  656.787600  680.244300  703.701000  727.157700  750.614400"
+	"\[ \t\r\n\]+774.071100  797.527800  820.984500  844.441200  867.897900  891.354600  914.811300  938.268000"
+	"\[ \t\r\n\]+961.724700  985.181400  1008.638100  1032.094800  1055.551500  1079.008200  1102.464900  1125.921600"
+	"\[ \t\r\n\]+1149.378300  1172.835000  1196.291700  1219.748400  1243.205100  1266.661800  1290.118500  1313.575200"
+	"\[ \t\r\n\]+1337.031900  1360.488600  1383.945300  1407.402000  1430.858700  1454.315400  1477.772100  1501.228800"
+	"\[ \t\r\n\]+1524.685500  1548.142200  1571.598900  1595.055600  1618.512300  1641.969000  1665.425700  1688.882400"
+	"\[ \t\r\n\]+1712.339100  1735.795800  1759.252500  1782.709200  1806.165900  1829.622600  1853.079300  1876.536000"
+	"\[ \t\r\n\]+1899.992700  1923.449400  1946.906100  1970.362800  1993.819500  2017.276200  2040.732900  2064.189600"
+	"\[ \t\r\n\]+2087.646300  2111.103000  2134.559700  2158.016400  2181.473100  2204.929800  2228.386500  2251.843200"
+	"\[ \t\r\n\]+2275.299900  2298.756600  2322.213300.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1236.*printf\\(.BYE BYE FOR NOW.n.\\)."
+    }
+} else {
+    gdb_test "continue" "" ""
 }
 
 
 #call sum_array_print(10, *list1, *list2, *list3, *list4)
 
-send_gdb "print sum_array_print(10, *list1, *list2, *list3, *list4)\n"
-gdb_expect {
-    -re ".*Sum of 4 arrays, by element \\(add in seed as well\\):\[ \t\r\n\]+Seed: 10\[ \t\r\n\]+Element Index . Sum\[ \t\r\n\]+-------------------------\[ \t\r\n\]+.*\[ \t\]+0\[ \t\]+52\[ \t\r\n\]+1\[ \t\]+60\[ \t\r\n\]+2\[ \t\]+68\[ \t\r\n\]+3\[ \t\]+76\[ \t\r\n\]+4\[ \t\]+84\[ \t\r\n\]+5\[ \t\]+92\[ \t\r\n\]+6\[ \t\]+100\[ \t\r\n\]+7\[ \t\]+108\[ \t\r\n\]+8\[ \t\]+116\[ \t\r\n\]+9\[ \t\]+124\[ \t\r\n\]+.*$gdb_prompt $" {
-        pass "print sum_array_print(10, *list1, *list2, *list3, *list4)"
-      }
-    -re ".*$gdb_prompt $" { fail "print sum_array_print(10, *list1, *list2, *list3, *list4)" }
-    timeout           { fail "(timeout) print sum_array_print(10, *list1, *list2, *list3, *list4)" }
-  }
+if ![gdb_skip_stdio_test "print sum_array_print(...)"] {
+    send_gdb "print sum_array_print(10, *list1, *list2, *list3, *list4)\n"
+    gdb_expect {
+	-re ".*Sum of 4 arrays, by element \\(add in seed as well\\):\[ \t\r\n\]+Seed: 10\[ \t\r\n\]+Element Index . Sum\[ \t\r\n\]+-------------------------\[ \t\r\n\]+.*\[ \t\]+0\[ \t\]+52\[ \t\r\n\]+1\[ \t\]+60\[ \t\r\n\]+2\[ \t\]+68\[ \t\r\n\]+3\[ \t\]+76\[ \t\r\n\]+4\[ \t\]+84\[ \t\r\n\]+5\[ \t\]+92\[ \t\r\n\]+6\[ \t\]+100\[ \t\r\n\]+7\[ \t\]+108\[ \t\r\n\]+8\[ \t\]+116\[ \t\r\n\]+9\[ \t\]+124\[ \t\r\n\]+.*$gdb_prompt $" {
+	    pass "print sum_array_print(10, *list1, *list2, *list3, *list4)"
+	}
+	-re ".*$gdb_prompt $" { fail "print sum_array_print(10, *list1, *list2, *list3, *list4)" }
+	timeout           { fail "(timeout) print sum_array_print(10, *list1, *list2, *list3, *list4)" }
+    }
+}
 
 #step over
-send_gdb "n\n"
-gdb_expect {
-    -re ".*BYE BYE FOR NOW.*1237.*printf\\(.VERY GREEN GRASS.n.\\);.*$gdb_prompt $" { pass "next to 1237"}
-    -re ".*$gdb_prompt $" { fail "next to 1237" }
-    timeout { fail "next to 1237(timeout)" }
+if ![gdb_skip_stdio_test "next to 1237"] {
+    send_gdb "next\n"
+    gdb_expect {
+	-re ".*BYE BYE FOR NOW.*1237.*printf\\(.VERY GREEN GRASS.n.\\);.*$gdb_prompt $" { pass "next to 1237"}
+	-re ".*$gdb_prompt $" { fail "next to 1237" }
+	timeout { fail "next to 1237(timeout)" }
+    }
+} else {
+    gdb_test "next" "" ""
 }
 
 #call print_array_rep(\*list1, \*list2, \*list3)
 
-send_gdb "print print_array_rep(\*list1, \*list2, \*list3)\n"
-gdb_expect {
-    -re ".*$gdb_prompt $" {
-        pass "print print_array_rep(*list1, *list2, *list3)"
-      }
-    -re ".*$gdb_prompt $" { fail "print print_array_rep(*list1, *list2, *list3)" }
-    timeout           { fail "(timeout) print print_array_rep(*list1, *list2, *list3)" }
-  }
+if ![gdb_skip_stdio_test "print print_array_rep(...)"] {
+    send_gdb "print print_array_rep(\*list1, \*list2, \*list3)\n"
+    gdb_expect {
+	-re ".*$gdb_prompt $" {
+	    pass "print print_array_rep(*list1, *list2, *list3)"
+	}
+	-re ".*$gdb_prompt $" { 
+	    fail "print print_array_rep(*list1, *list2, *list3)" 
+	}
+	timeout               {
+	    fail "(timeout) print print_array_rep(*list1, *list2, *list3)" 
+	}
+    }
+}
 
 #go -until 1241
 gdb_test "tbreak 1241" \
@@ -357,25 +396,61 @@
     "Breakpoint.* file .*call-ar-st.c, line 1281.*" \
     "tbreakpoint line 1281"
 
-send_gdb "continue\n"
-gdb_expect {
- -re  "Continuing\\..*Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t.*main \\(\\) at .*call-ar-st.c:1281.*c = 0.*$gdb_prompt $" {
-                 pass "continue to 1281"}
-      -re ".*$gdb_prompt $" { fail "continue to 1281"}           
-      timeout           { fail "(timeout) continue to 1281"}
+if ![gdb_skip_stdio_test "continuing to 1281"] {
+    send_gdb "continue\n"
+    gdb_expect {
+	-re  "Continuing\\..*Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t.*main \\(\\) at .*call-ar-st.c:1281.*c = 0.*$gdb_prompt $" {
+	    pass "continue to 1281"
+	}
+	-re ".*$gdb_prompt $" { fail "continue to 1281"}           
+	timeout           { fail "(timeout) continue to 1281"}
+    }
+} else {
+    gdb_test "continue" "" ""
 }
 
-#call print_small_structs(*struct1, *struct2, *struct3, *struct4,*flags, *flags_combo,
-#*three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)
-if {![target_info exists gdb,skip_float_tests]} {
-  send_gdb "print print_small_structs(*struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n"
-  gdb_expect {
-    -re ".*alpha\[\t\r\n \]+gamma\[\t\r\n \]+epsilon\[\t\r\n \]+alpha\[\t\r\n \]+gamma\[\t\r\n \]+epsilon\[\t\r\n \]+ch1: y.*ch2: n\[\t\r\n \]+Contents of three_char_t:\[\t\r\n \]+a.*b.*c\[\t\r\n \]+Contents of five_char_t:\[\t\r\n \]+l.*m.*n.*o.*p\[\t\r\n \]+Contents of int_char_combo_t:\[\t\r\n \]+123.*z\[\t\r\n \]+Sum of the 4 struct values and seed :\[\t\r\n \]+52\[\t\r\n \]+Contents of struct1:\[\t\r\n \]+6.*0\[\t\r\n \]+Contents of struct2:\[\t\r\n \]+10.*0\[\t\r\n \]+Contents of struct3:\[\t\r\n \]+12.*0\[\t\r\n \]+Contents of one_double_t:\[\t\r\n \]+10.500000\[\t\r\n \]+Contents of one_double_t:.*-3.375000\[\t\r\n \]+Contents of one_double_t:.*675.093750\[\t\r\n \]+Contents of two_floats_t:.*45.234001.*43.599998\[\t\r\n \]+Contents of two_floats_t:.*78.010002.*122.099998\[\t\r\n \]+Contents of two_floats_t:.*-1232.344971.*-199.210007\[\t\r\n \]+.*$gdb_prompt $" {
-      pass "print print_small_structs"
+#call print_small_structs(*struct1, *struct2, *struct3, *struct4, 
+#                         *flags, *flags_combo, *three_char, *five_char, 
+#                         *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)
+
+if {![gdb_skip_float_test "print print_small_structs(...)"] && \
+    ![gdb_skip_stdio_test "print print_small_structs(...)"] } {
+    send_gdb "print print_small_structs(*struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n"
+    gdb_expect_list "print print_small_structs" ".*$gdb_prompt $" {
+	"\[\t\r\n \]+alpha"
+	"\[\t\r\n \]+gamma"
+	"\[\t\r\n \]+epsilon"
+	"\[\t\r\n \]+alpha"
+	"\[\t\r\n \]+gamma"
+	"\[\t\r\n \]+epsilon"
+	"\[\t\r\n \]+ch1: y[ \t]*ch2: n"
+	"\[\t\r\n \]+Contents of three_char_t:"
+	"\[\t\r\n \]+a[ \t]*b[ \t]*c"
+	"\[\t\r\n \]+Contents of five_char_t:"
+	"\[\t\r\n \]+l[ \t]*m[ \t]*n[ \t]*o[ \t]*p"
+	"\[\t\r\n \]+Contents of int_char_combo_t:"
+	"\[\t\r\n \]+123[ \t]*z"
+	"\[\t\r\n \]+Sum of the 4 struct values and seed :"
+	"\[\t\r\n \]+52"
+	"\[\t\r\n \]+Contents of struct1:"
+	"\[\t\r\n \]+6[ \t]*0"
+	"\[\t\r\n \]+Contents of struct2:"
+	"\[\t\r\n \]+10[ \t]*0"
+	"\[\t\r\n \]+Contents of struct3:"
+	"\[\t\r\n \]+12[ \t]*0"
+	"\[\t\r\n \]+Contents of one_double_t:"
+	"\[\t\r\n \]+10.500000"
+	"\[\t\r\n \]+Contents of one_double_t:"
+	"\[\t\r\n \]+-3.375000"
+	"\[\t\r\n \]+Contents of one_double_t:"
+	"\[\t\r\n \]+675.093750"
+	"\[\t\r\n \]+Contents of two_floats_t:"
+	"\[\t\r\n \]+45.234001[ \t]*43.599998"
+	"\[\t\r\n \]+Contents of two_floats_t:"
+	"\[\t\r\n \]+78.010002[ \t]*122.099998"
+	"\[\t\r\n \]+Contents of two_floats_t:"
+	"\[\t\r\n \]+-1232.344971[ \t]*-199.210007"
     }
-    -re ".*$gdb_prompt $" { fail "print print_small_structs" }
-    timeout           { fail "(timeout) print_small_structs" }
-  }
 }
 
 #call compute_with_small_structs(20)
@@ -389,16 +464,19 @@
   }
 
 
-#call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)
-if {![target_info exists gdb,skip_float_tests]} {
-  send_gdb "print print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)\n"
-  gdb_expect {
-    -re ".*Two Doubles : 123.456000.*123.456000\[\t\r\n \]+Two Doubles : -0.120000.*-1.230000\[\t\r\n \]+Two Doubles : 343434.800000.*89.098000\[\t\r\n \]+Two Doubles : 3.140000.*-5678.123450\[\t\r\n \]+Two Doubles : -0.111111.*216.970650\[\t\r\n \]+.*$gdb_prompt $" {
-      pass "print print_ten_doubles"
+#call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 
+#                       3.14, -5678.12345, -0.11111111, 216.97065)
+
+if {![gdb_skip_float_test "print print_ten_doubles(...)"] && \
+    ![gdb_skip_stdio_test "print print_ten_doubles(...)"]} {
+    send_gdb "print print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)\n"
+    gdb_expect_list "print print_ten_doubles" ".*$gdb_prompt $" {
+	"\[\t\r\n \]+Two Doubles : 123.456000.*123.456000"
+	"\[\t\r\n \]+Two Doubles : -0.120000.*-1.230000"
+	"\[\t\r\n \]+Two Doubles : 343434.800000.*89.098000"
+	"\[\t\r\n \]+Two Doubles : 3.140000.*-5678.123450"
+	"\[\t\r\n \]+Two Doubles : -0.111111.*216.970650"
     }
-    -re ".*$gdb_prompt $" { fail "print print_ten_doubles" }
-    timeout           { fail "(timeout) print_ten_doubles" }
-  }
 }
 
 #go -until 1286
@@ -437,7 +515,7 @@
     # overflows or something, and expect can't deal with the full
     # line.  Perhaps a more elegant solution exists... -sts 1999-08-17
     send_gdb "continue\n"
-    if {![target_info exists gdb,skip_float_tests]} {
+    if {![gdb_skip_float_test "step into print_long_arg_list"]} {
 	gdb_expect {
 	    -re ".*print_long_arg_list \\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.375\}, d3=\{double1 = 675.09375\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" { pass "step into print_long_arg_list" }
 	    -re ".*print_long_arg_list.*\\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}.*\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list (short match)"}
@@ -456,20 +534,52 @@
 
 set ws "\[\n\r\t \]+"
 
-#call print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3)
-if {![target_info exists gdb,skip_float_tests]} {
+#call print_small_structs(struct1, struct2, struct3, struct4, flags, 
+#                         flags_combo, three_char, five_char, int_char_combo, 
+#                         d1, d2, d3, f1, f2, f3)
+
+if {![gdb_skip_float_test "print_small_structs from print_long_arg_list"] && \
+    ![gdb_skip_stdio_test "print_small_structs from print_long_arg_list"] } {
     # On Solaris, some of the args are passed by ref, others by value,
     # and GDB gets confused and says "Invalid cast" because it thinks
     # it has to cast the structure into a pointer to structure.  A real
     # GDB bug, probably for all Sparc configs, but obscure. -sts 1999-08-17.
     setup_xfail "sparc*-*-solaris*"
     send_gdb "print print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3)\n"
-    gdb_expect {
-	-re ".*alpha${ws}gamma${ws}epsilon${ws}alpha${ws}gamma${ws}epsilon${ws}ch1: y.*ch2: n${ws}Contents of three_char_t:${ws}a.*b.*c${ws}Contents of five_char_t:${ws}l.*m.*n.*o.*p${ws}Contents of int_char_combo_t:${ws}123.*z${ws}Sum of the 4 struct values and seed :${ws}52${ws}Contents of struct1:${ws}6.*0${ws}Contents of struct2:${ws}10.*0${ws}Contents of struct3:${ws}12.*0${ws}Contents of one_double_t:${ws}10.500000${ws}Contents of one_double_t:${ws}-3.375000${ws}Contents of one_double_t:${ws}675.093750${ws}Contents of two_floats_t:${ws}45.234001.*43.599998${ws}Contents of two_floats_t:${ws}78.010002.*122.099998${ws}Contents of two_floats_t:${ws}-1232.344971.*-199.210007${ws}.*$gdb_prompt $" {
-	    pass "print print_small_structs from print_long_arg_list"
-	}
-	-re ".*$gdb_prompt $" { fail "print print_small_structs from print_long_arg_list" }
-	timeout { fail "(timeout) print_small_structs from print_long_arg_list" }
+    gdb_expect_list "print print_small_structs from print_long_arg_list" ".*$gdb_prompt $" {
+	"\[\t\r\n \]+alpha"
+	"\[\t\r\n \]+gamma"
+	"\[\t\r\n \]+epsilon"
+	"\[\t\r\n \]+alpha"
+	"\[\t\r\n \]+gamma"
+	"\[\t\r\n \]+epsilon"
+	"\[\t\r\n \]+ch1: y[ \t]*ch2: n"
+	"\[\t\r\n \]+Contents of three_char_t:"
+	"\[\t\r\n \]+a\[ \t\]*b\[ \t\]*c"
+	"\[\t\r\n \]+Contents of five_char_t:"
+	"\[\t\r\n \]+l\[ \t\]*m\[ \t\]*n\[ \t\]*o\[ \t\]*p"
+	"\[\t\r\n \]+Contents of int_char_combo_t:"
+	"\[\t\r\n \]+123\[ \t\]*z"
+	"\[\t\r\n \]+Sum of the 4 struct values and seed :"
+	"\[\t\r\n \]+52"
+	"\[\t\r\n \]+Contents of struct1:"
+	"\[\t\r\n \]+6\[ \t\]*0"
+	"\[\t\r\n \]+Contents of struct2:"
+	"\[\t\r\n \]+10\[ \t\]*0"
+	"\[\t\r\n \]+Contents of struct3:"
+	"\[\t\r\n \]+12\[ \t\]*0"
+	"\[\t\r\n \]+Contents of one_double_t:"
+	"\[\t\r\n \]+10.500000"
+	"\[\t\r\n \]+Contents of one_double_t:"
+	"\[\t\r\n \]+-3.375000"
+	"\[\t\r\n \]+Contents of one_double_t:"
+	"\[\t\r\n \]+675.093750"
+	"\[\t\r\n \]+Contents of two_floats_t:"
+	"\[\t\r\n \]+45.234001\[ \t\]*43.599998"
+	"\[\t\r\n \]+Contents of two_floats_t:"
+	"\[\t\r\n \]+78.010002\[ \t\]*122.099998"
+	"\[\t\r\n \]+Contents of two_floats_t:"
+	"\[\t\r\n \]+-1232.344971\[ \t\]*-199.210007"
     }
 }
 
@@ -479,8 +589,12 @@
     "Breakpoint.* file .*call-ar-st.c, line 1300.*" \
     "tbreakpoint line 1300"
 
-gdb_test continue "Continuing\\..*Contents of two_floats_t:.*main \\(\\) at.*call-ar-st.c:1300.*1300.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \
-  "continue to 1300"
+if ![gdb_skip_stdio_test "continuing to 1300"] {
+    gdb_test "continue" "Continuing\\..*Contents of two_floats_t:.*main \\(\\) at.*call-ar-st.c:1300.*1300.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \
+	    "continue to 1300"
+} else {
+    gdb_test "continue" "" ""
+}
 
 #step
     send_gdb "step\n"
@@ -493,14 +607,20 @@
     }
 
 #call print_bit_flags_combo(*bit_flags_combo)
-send_gdb "print print_bit_flags_combo(*bit_flags_combo)\n"
-gdb_expect {
-    -re ".*alpha.*gamma.*epsilon.*ch1: y.*ch2: n.*$gdb_prompt $" {
-        pass "print print_bit_flags_combo from init_bit_flags_combo"
-      }
-    -re ".*$gdb_prompt $" { fail "print print_bit_flags_combo from init_bit_flags_combo" }
-    timeout           { fail "(timeout) print_bit_flags_combo from init_bit_flags_combo" }
-  }
+if ![gdb_skip_stdio_test "continuing to 1300"] {
+    send_gdb "print print_bit_flags_combo(*bit_flags_combo)\n"
+    gdb_expect {
+	-re ".*alpha.*gamma.*epsilon.*ch1: y.*ch2: n.*$gdb_prompt $" {
+	    pass "print print_bit_flags_combo from init_bit_flags_combo"
+	}
+	-re ".*$gdb_prompt $" {
+	    fail "print print_bit_flags_combo from init_bit_flags_combo" 
+	}
+	timeout           {
+	    fail "(timeout) print_bit_flags_combo from init_bit_flags_combo" 
+	}
+    }
+}
 
 
 #go -until 1305
@@ -519,15 +639,47 @@
 
 if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*" CLLbs16994}
 
-if {![target_info exists gdb,skip_float_tests]} {
-  send_gdb "print print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n"
-  gdb_expect {
-    -re ".*double : 22.250000.*double : 33.375000.*int : 0.*int : -25.*int : 100.*int : 2345.*alpha.*gamma.*epsilon.*ch1: y.*ch2: n.*Contents of three_char_t:.*x.*y.*z.*Contents of five_char_t:.*h.*e.*l.*l.*o.*Contents of int_char_combo_t:.*123.*z.*Sum of the 4 struct values and seed :.*52.*Contents of struct1:.*6\[ \]+0.*Contents of struct2:.*10\[ \]+0.*Contents of struct3:.*12.*0.*Contents of one_double_t:\[ \n\r\t\]+1.111110\[ \n\r\t\]+Contents of one_double_t:\[ \n\r\t\]+-345.340000\[ \n\r\t\]+Contents of one_double_t:\[ \n\r\t\]+546464.200000\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+0.234000.*453.100006\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+78.345001.*23.090000\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+-2.345000.*1.000000.*$gdb_prompt $" {
-      pass "print print_long_arg_list"
+if {![gdb_skip_float_test "print print_long_arg_list"] && \
+    ![gdb_skip_stdio_test "print print_long_arg_list"] } {
+    send_gdb "print print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n"
+    gdb_expect_list "print print_long_arg_list" ".*$gdb_prompt $" {
+	"\[ \n\r\t\]+double : 22.250000"
+	"\[ \n\r\t\]+double : 33.375000"
+	"\[ \n\r\t\]+int : 0"
+	"\[ \n\r\t\]+int : -25"
+	"\[ \n\r\t\]+int : 100"
+	"\[ \n\r\t\]+int : 2345"
+	"\[ \n\r\t\]+alpha"
+	"\[ \n\r\t\]+gamma"
+	"\[ \n\r\t\]+epsilon"
+	"\[ \n\r\t\]+ch1: y\[ \t\]+ch2: n"
+	"\[ \n\r\t\]+Contents of three_char_t:"
+	"\[ \n\r\t\]+x\[ \t\]+y\[ \t\]+z"
+	"\[ \n\r\t\]+Contents of five_char_t:"
+	"\[ \n\r\t\]+h\[ \t\]+e\[ \t\]+l\[ \t\]+l\[ \t\]+o"
+	"\[ \n\r\t\]+Contents of int_char_combo_t:"
+	"\[ \n\r\t\]+123\[ \t\]+z"
+	"\[ \n\r\t\]+Sum of the 4 struct values and seed :"
+	"\[ \n\r\t\]+52"
+	"\[ \n\r\t\]+Contents of struct1:"
+	"\[ \n\r\t\]+6\[ \t\]+0"
+	"\[ \n\r\t\]+Contents of struct2:"
+	"\[ \n\r\t\]+10\[ \t\]+0"
+	"\[ \n\r\t\]+Contents of struct3:"
+	"\[ \n\r\t\]+12\[ \t\]+0"
+	"\[ \n\r\t\]+Contents of one_double_t:"
+	"\[ \n\r\t\]+1.111110"
+	"\[ \n\r\t\]+Contents of one_double_t:"
+	"\[ \n\r\t\]+-345.340000"
+	"\[ \n\r\t\]+Contents of one_double_t:"
+	"\[ \n\r\t\]+546464.200000"
+	"\[ \n\r\t\]+Contents of two_floats_t:"
+	"\[ \n\r\t\]+0.234000\[ \t\]+453.100006"
+	"\[ \n\r\t\]+Contents of two_floats_t:"
+	"\[ \n\r\t\]+78.345001\[ \t\]+23.090000"
+	"\[ \n\r\t\]+Contents of two_floats_t:"
+	"\[ \n\r\t\]+-2.345000\[ \t\]+1.000000"
     }
-    -re ".*$gdb_prompt $" { fail "print print_long_arg_list" }
-    timeout           { fail "(timeout) print_long_arg_list" }
-  }
 }
 
 
@@ -541,35 +693,50 @@
 
 
 #call sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)
-send_gdb "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)\n"
-gdb_expect {
-    -re ".*Sum of the 4 struct values and seed :\[ \t\n\r\]+218.*$gdb_prompt $" {
-        pass "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)"
-      }
-    -re ".*$gdb_prompt $" { fail "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)" }
-    timeout           { fail "(timeout) sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)" }
-  }
+if ![gdb_skip_stdio_test "print sum_struct_print(...)"] {
+    send_gdb "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)\n"
+    gdb_expect {
+	-re ".*Sum of the 4 struct values and seed :\[ \t\n\r\]+218.*$gdb_prompt $" {
+	    pass "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)"
+	}
+	-re ".*$gdb_prompt $" { 
+	    fail "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)" 
+	}
+	timeout           { 
+	    fail "(timeout) sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)" 
+	}
+    }
+}
 
 
 #call print_struct_rep(*struct1, *struct2, *struct3)
-send_gdb "print print_struct_rep(*struct1, *struct2, *struct3)\n"
-gdb_expect {
-    -re ".*Contents of struct1:\[ \t\n\r\]+        22         0\[ \t\n\r\]+Contents of struct2:\[ \t\n\r\]+        42         0\[ \t\n\r\]+Contents of struct3:\[ \t\n\r\]+        62         0\[ \t\n\r\]+.*$gdb_prompt $" {
-        pass "print print_struct_rep(*struct1, *struct2, *struct3)"
-      }
-    -re ".*$gdb_prompt $" { fail "print print_struct_rep(*struct1, *struct2, *struct3)" }
-    timeout           { fail "(timeout) print_struct_rep(*struct1, *struct2, *struct3)" }
-  }
+if ![gdb_skip_stdio_test "print print_struct_rep(...)"] {
+    send_gdb "print print_struct_rep(*struct1, *struct2, *struct3)\n"
+    gdb_expect_list "print print_struct_rep(*struct1, *struct2, *struct3)" \
+	    ".*$gdb_prompt $" {
+	"\[ \t\n\r\]+Contents of struct1:"
+	"\[ \t\n\r\]+        22         0"
+	"\[ \t\n\r\]+Contents of struct2:"
+	"\[ \t\n\r\]+        42         0"
+	"\[ \t\n\r\]+Contents of struct3:"
+	"\[ \t\n\r\]+        62         0"
+    }
+}
 
-send_gdb "print print_one_large_struct(*list1)\n"
-gdb_expect {
-    -re ".*         4         1.*$gdb_prompt $" {
-        pass "print print_one_large_struct(*list1)"
-      }
-    -re ".*$gdb_prompt $" { fail "print print_one_large_struct(*list1)" }
-    timeout           { fail "(timeout) print_one_large_struct(*list1)" }
-  }
+if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] {
+    send_gdb "print print_one_large_struct(*list1)\n"
+    gdb_expect {
+	-re ".*         4         1.*$gdb_prompt $" {
+	    pass "print print_one_large_struct(*list1)"
+	}
+	-re ".*$gdb_prompt $" {
+	    fail "print print_one_large_struct(*list1)"
+	}
+	timeout           {
+	    fail "(timeout) print_one_large_struct(*list1)"
+	}
+    }
+}
 
 return
 
-
diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp
index 3838269..70b3377 100644
--- a/gdb/testsuite/gdb.base/call-rt-st.exp
+++ b/gdb/testsuite/gdb.base/call-rt-st.exp
@@ -135,103 +135,117 @@
       timeout           { fail "(timeout)finish out from loop_count"}
 }
 
-
-send_gdb "print print_struct_rep(*struct1)\n"
-gdb_expect {
-    -re ".*Contents of struct1:\[ \t\n\r\]+22\[ \t\]+0\[ \t\n\r\]+.\[0-9\]+ = \{value = 5, head = 0\}.*$gdb_prompt $" {
-        pass "print print_struct_rep(*struct1, *struct2, *struct3)"
-      }
-    -re ".*$gdb_prompt $" { fail "print print_struct_rep(*struct1, *struct2, *struct3)" }
-    timeout           { fail "(timeout) print_struct_rep(*struct1, *struct2, *struct3)" }
-  }
-
-send_gdb "print print_one_large_struct(*list1)\n"
-gdb_expect {
-    -re ".*\[ \t\]+4\[ \t\]+1\[ \r\n\]+.\[0-9\]+ = \{next_index = \{1, 2, 3, 4, 5, 6, 7, 8, 9, 10\}, values = \{4, 6, 8, 10, 12, 14, 16, 18, 20, 22\}, head = 0\}.*$gdb_prompt $" {
-        pass "print print_one_large_struct(*list1)"
-      }
-    -re ".*$gdb_prompt $" { fail "print print_one_large_struct(*list1)" }
-    timeout           { fail "(timeout) print_one_large_struct(*list1)" }
-  }
-
-if {![target_info exists gdb,skip_float_tests]} {
-  send_gdb "print print_one_double(*d1)\n"
-  gdb_expect {
-    -re ".*Contents of one_double_t:\[ \r\n\]+1\\.111110\[ \r\n\]+.\[0-9\]+ = \{double1 = 1\\.11111\}.*$gdb_prompt $" {
-      pass "print print_one_double(*d1)"
+if ![gdb_skip_stdio_test "print print_struct_rep(*struct1)"] {
+    send_gdb "print print_struct_rep(*struct1)\n"
+    gdb_expect {
+	-re ".*Contents of struct1:\[ \t\n\r\]+22\[ \t\]+0\[ \t\n\r\]+.\[0-9\]+ = \{value = 5, head = 0\}.*$gdb_prompt $" {
+	    pass "print print_struct_rep(*struct1, *struct2, *struct3)"
+	}
+	-re ".*$gdb_prompt $" { 
+	    fail "print print_struct_rep(*struct1, *struct2, *struct3)" 
+	}
+	timeout           { 
+	    fail "(timeout) print_struct_rep(*struct1, *struct2, *struct3)" 
+	}
     }
-    -re ".*$gdb_prompt $" { fail "print print_one_double(*d1)" }
-    timeout           { fail "(timeout) print_one_double(*d1)" }
-  }
-
-  send_gdb "print print_two_floats(*f3)\n"
-  gdb_expect {
-    -re ".*Contents of two_floats_t:\[ \r\n\]+-2\\.345000\[ \t]+1\\.000000\[ \r\n\]+.\[0-9\]+ = \{float1 = -2\\.34500003, float2 = 1\}.*$gdb_prompt $" {
-      pass "print print_two_floats(*f3)"
-    }
-    -re ".*$gdb_prompt $" { fail "print print_two_floats(*f3)" }
-    timeout           { fail "(timeout) print_two_floats(*f3)" }
-  }
 }
 
-send_gdb "print print_bit_flags(*flags)\n"
-gdb_expect {
-    -re ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}\[ \r\n\]+$gdb_prompt $" {
-        pass "print print_bit_flags(*flags)"
-      }
-    -re ".*$gdb_prompt $" { fail "print print_bit_flags(*flags)" }
-    timeout           { fail "(timeout) print_bit_flags(*flags)" }
-  }
+if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] {
+    send_gdb "print print_one_large_struct(*list1)\n"
+    gdb_expect {
+	-re ".*\[ \t\]+4\[ \t\]+1\[ \r\n\]+.\[0-9\]+ = \{next_index = \{1, 2, 3, 4, 5, 6, 7, 8, 9, 10\}, values = \{4, 6, 8, 10, 12, 14, 16, 18, 20, 22\}, head = 0\}.*$gdb_prompt $" {
+	    pass "print print_one_large_struct(*list1)"
+	}
+	-re ".*$gdb_prompt $" { fail "print print_one_large_struct(*list1)" }
+	timeout           { fail "(timeout) print_one_large_struct(*list1)" }
+    }
+}
 
-send_gdb "print print_bit_flags_combo(*flags_combo)\n"
-gdb_expect {
-    -re ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+ch1: y\[ \t\]+ch2: n\[ \r\n\]+.\[0-9\]+ = \{alpha = 1, beta = 0, ch1 = 121 'y', gamma = 1, delta = 0, ch2 = 110 'n', epsilon = 1, omega = 0\}\[ \r\n\]+$gdb_prompt $" {
-        pass "print print_bit_flags_combo(*flags_combo)"
-      }
-    -re ".*$gdb_prompt $" { fail "print print_bit_flags_combo(*flags_combo)" }
-    timeout           { fail "(timeout) print_bit_flags_combo(*flags_combo)" }
-  }
+if {![gdb_skip_float_test "print print_one_double(*d1)"] && \
+    ![gdb_skip_stdio_test "print print_one_double(*d1)"] } {
+    send_gdb "print print_one_double(*d1)\n";
+    gdb_expect {
+	-re ".*Contents of one_double_t:\[ \r\n\]+1\\.111110\[ \r\n\]+.\[0-9\]+ = \{double1 = 1\\.11111\}.*$gdb_prompt $" {
+	    pass "print print_one_double(*d1)"
+	}
+	-re ".*$gdb_prompt $" { fail "print print_one_double(*d1)" }
+	timeout           { fail "(timeout) print_one_double(*d1)" }
+    }
+}
 
-send_gdb "print print_three_chars(*three_char)\n"
-gdb_expect {
-    -re ".*Contents of three_char_t:\[ \r\n\]+x\[ \t\]+y\[ \t\]+z\[ \r\n\]+.\[0-9\]+ = \{ch1 = 120 'x', ch2 = 121 'y', ch3 = 122 'z'\}\[ \r\n\]+$gdb_prompt $" {
-        pass "print print_three_chars(*three_char)"
-      }
-    -re ".*$gdb_prompt $" { fail "print print_three_chars(*three_char)" }
-    timeout           { fail "(timeout) print_three_chars(*three_char)" }
-  }
+if ![gdb_skip_stdio_test "print print_two_floats(*f3)"] {
+    send_gdb "print print_two_floats(*f3)\n"
+    gdb_expect {
+	-re ".*Contents of two_floats_t:\[ \r\n\]+-2\\.345000\[ \t]+1\\.000000\[ \r\n\]+.\[0-9\]+ = \{float1 = -2\\.34500003, float2 = 1\}.*$gdb_prompt $" {
+	    pass "print print_two_floats(*f3)"
+	}
+	-re ".*$gdb_prompt $" { fail "print print_two_floats(*f3)" }
+	timeout           { fail "(timeout) print_two_floats(*f3)" }
+    }
+}
 
-send_gdb "print print_five_chars(*five_char)\n"
-gdb_expect {
-    -re ".*Contents of five_char_t:\[ \r\n\]+h\[ \t\]+e\[ \t\]+l\[ \t\]+l\[ \t\]+o\[ \r\n\]+.\[0-9\]+ = \{ch1 = 104 'h', ch2 = 101 'e', ch3 = 108 'l', ch4 = 108 'l', ch5 = 111 'o'\}\[ \r\n\]+$gdb_prompt $" {
-        pass "print print_five_chars(*five_char)"
-      }
-    -re ".*$gdb_prompt $" { fail "print print_five_chars(*five_char)" }
-    timeout           { fail "(timeout) print_five_chars(*five_char)" }
-  }
+if ![gdb_skip_stdio_test "print print_bit_flags(*flags)"] {
+    send_gdb "print print_bit_flags(*flags)\n"
+    gdb_expect {
+	-re ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}\[ \r\n\]+$gdb_prompt $" {
+	    pass "print print_bit_flags(*flags)"
+	}
+	-re ".*$gdb_prompt $" { fail "print print_bit_flags(*flags)" }
+	timeout           { fail "(timeout) print_bit_flags(*flags)" }
+    }
+}
 
-send_gdb "print print_int_char_combo(*int_char_combo)\n"
-gdb_expect {
-    -re ".*Contents of int_char_combo_t:\[ \r\n\]+13\[ \t\]+!\[ \r\n\]+.\[0-9\]+ = \{int1 = 13, ch1 = 33 '!'\}\[ \r\n\]+$gdb_prompt $" {
-        pass "print print_int_char_combo(*int_char_combo)"
-      }
-    -re ".*$gdb_prompt $" { fail "print print_int_char_combo(*int_char_combo)" }
-    timeout           { fail "(timeout) print_int_char_combo(*int_char_combo)" }
-  }
+if ![gdb_skip_stdio_test "print print_bit_flags_combo(*flags_combo)"] {
+    send_gdb "print print_bit_flags_combo(*flags_combo)\n"
+    gdb_expect {
+	-re ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+ch1: y\[ \t\]+ch2: n\[ \r\n\]+.\[0-9\]+ = \{alpha = 1, beta = 0, ch1 = 121 'y', gamma = 1, delta = 0, ch2 = 110 'n', epsilon = 1, omega = 0\}\[ \r\n\]+$gdb_prompt $" {
+	    pass "print print_bit_flags_combo(*flags_combo)"
+	}
+	-re ".*$gdb_prompt $" { 
+	    fail "print print_bit_flags_combo(*flags_combo)" 
+	}
+	timeout           { 
+	    fail "(timeout) print_bit_flags_combo(*flags_combo)" 
+	}
+    }
+}
+
+if ![gdb_skip_stdio_test "print print_three_chars(*three_chars)"] {
+    send_gdb "print print_three_chars(*three_char)\n"
+    gdb_expect {
+	-re ".*Contents of three_char_t:\[ \r\n\]+x\[ \t\]+y\[ \t\]+z\[ \r\n\]+.\[0-9\]+ = \{ch1 = 120 'x', ch2 = 121 'y', ch3 = 122 'z'\}\[ \r\n\]+$gdb_prompt $" {
+	    pass "print print_three_chars(*three_char)"
+	}
+	-re ".*$gdb_prompt $" { fail "print print_three_chars(*three_char)" }
+	timeout           { fail "(timeout) print_three_chars(*three_char)" }
+    }
+}
+
+if ![gdb_skip_stdio_test "print print_five_chars(*five_chars)"] {
+    send_gdb "print print_five_chars(*five_char)\n"
+    gdb_expect {
+	-re ".*Contents of five_char_t:\[ \r\n\]+h\[ \t\]+e\[ \t\]+l\[ \t\]+l\[ \t\]+o\[ \r\n\]+.\[0-9\]+ = \{ch1 = 104 'h', ch2 = 101 'e', ch3 = 108 'l', ch4 = 108 'l', ch5 = 111 'o'\}\[ \r\n\]+$gdb_prompt $" {
+	    pass "print print_five_chars(*five_char)"
+	}
+	-re ".*$gdb_prompt $" { fail "print print_five_chars(*five_char)" }
+	timeout           { fail "(timeout) print_five_chars(*five_char)" }
+    }
+}
+
+if ![gdb_skip_stdio_test "print print_int_char_combo(*int_char_combo)"] {
+    send_gdb "print print_int_char_combo(*int_char_combo)\n"
+    gdb_expect {
+	-re ".*Contents of int_char_combo_t:\[ \r\n\]+13\[ \t\]+!\[ \r\n\]+.\[0-9\]+ = \{int1 = 13, ch1 = 33 '!'\}\[ \r\n\]+$gdb_prompt $" {
+	    pass "print print_int_char_combo(*int_char_combo)"
+	}
+	-re ".*$gdb_prompt $" { 
+	    fail "print print_int_char_combo(*int_char_combo)" 
+	}
+	timeout           { 
+	    fail "(timeout) print_int_char_combo(*int_char_combo)" 
+	}
+    }
+}
 
 return
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/gdb/testsuite/gdb.base/call-strs.exp b/gdb/testsuite/gdb.base/call-strs.exp
index 5e6cbff..f14c370 100644
--- a/gdb/testsuite/gdb.base/call-strs.exp
+++ b/gdb/testsuite/gdb.base/call-strs.exp
@@ -143,105 +143,125 @@
 
 
 #print str_func1(s)
-send_gdb "print  str_func1(s)\n"
-gdb_expect {
-    -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-        pass "print str_func1(s)"
-      }
-    -re ".*$gdb_prompt $" { fail "print str_func1(s)" }
-    timeout           { fail "(timeout) print str_func1(s)" }
-  }
+if ![gdb_skip_stdio_test "print str_func1(s)"] {
+    send_gdb "print  str_func1(s)\n"
+    gdb_expect {
+	-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
+	    pass "print str_func1(s)"
+	}
+	-re ".*$gdb_prompt $" { fail "print str_func1(s)" }
+	timeout               { fail "(timeout) print str_func1(s)" }
+    }
+}
 
 
 #print str_func1("test string")
-send_gdb "print  str_func1(\"test string\")\n"
-gdb_expect {
-    -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-        pass "print str_func1(\"test string\")"
-      }
-    -re ".*$gdb_prompt $" { fail "print str_func1(\"test string\")" }
-    timeout           { fail "(timeout) print str_func1(\"test string\")" }
-  }
+if ![gdb_skip_stdio_test "print str_func1(teststring)"] {
+    send_gdb "print  str_func1(\"test string\")\n"
+    gdb_expect {
+	-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
+	    pass "print str_func1(\"test string\")"
+	}
+	-re ".*$gdb_prompt $" { fail "print str_func1(\"test string\")" }
+	timeout     { fail "(timeout) print str_func1(\"test string\")" }
+    }
+}
 
 #call str_func1(s)
-send_gdb "call  str_func1(s)\n"
-gdb_expect {
-    -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-        pass "call str_func1(s)"
-      }
-    -re ".*$gdb_prompt $" { fail "call str_func1(s)" }
-    timeout           { fail "(timeout) call str_func1(s)" }
-  }
+if ![gdb_skip_stdio_test "call str_func1(s)"] {
+    send_gdb "call  str_func1(s)\n"
+    gdb_expect {
+	-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
+	    pass "call str_func1(s)"
+	}
+	-re ".*$gdb_prompt $" { fail "call str_func1(s)" }
+	timeout               { fail "(timeout) call str_func1(s)" }
+    }
+}
 
 #call str_func1("test string")
-send_gdb "call  str_func1(\"test string\")\n"
-gdb_expect {
-    -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-        pass "call str_func1(\"test string\")"
-      }
-    -re ".*$gdb_prompt $" { fail "call str_func1(\"test string\")" }
-    timeout           { fail "(timeout) call str_func1(\"test string\")" }
-  }
+if ![gdb_skip_stdio_test "call str_func1 (...)"] {
+    send_gdb "call  str_func1(\"test string\")\n"
+    gdb_expect {
+	-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
+	    pass "call str_func1(\"test string\")"
+	}
+	-re ".*$gdb_prompt $" { fail "call str_func1(\"test string\")" }
+	timeout     { fail "(timeout) call str_func1(\"test string\")" }
+    }
+}
 
 #print str_func1(buf)
-send_gdb "print  str_func1(buf)\n"
-gdb_expect {
-    -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-        pass "print str_func1(buf)"
-      }
-    -re ".*$gdb_prompt $" { fail "print str_func1(buf)" }
-    timeout           { fail "(timeout) print str_func1(buf)" }
-  }
+if ![gdb_skip_stdio_test "print str_func1(buf)"] {
+    send_gdb "print  str_func1(buf)\n"
+    gdb_expect {
+	-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
+	    pass "print str_func1(buf)"
+	}
+	-re ".*$gdb_prompt $" { fail "print str_func1(buf)" }
+	timeout               { fail "(timeout) print str_func1(buf)" }
+    }
+}
 
 #call str_func1(buf)
-send_gdb "call str_func1(buf)\n"
-gdb_expect {
-    -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-        pass "call str_func1(buf)"
-      }
-    -re ".*$gdb_prompt $" { fail "call str_func1(buf)" }
-    timeout           { fail "(timeout) call str_func1(buf)" }
-  }
+if ![gdb_skip_stdio_test "call str_func1(buf)"] {
+    send_gdb "call str_func1(buf)\n"
+    gdb_expect {
+	-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
+	    pass "call str_func1(buf)"
+	}
+	-re ".*$gdb_prompt $" { fail "call str_func1(buf)" }
+	timeout               { fail "(timeout) call str_func1(buf)" }
+    }
+}
 
 #print str_func("a","b","c","d","e","f","g")
-send_gdb "print  str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")\n"
-gdb_expect {
-    -re "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+.*= \"abcdefg\".*$gdb_prompt $" {
-        pass "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")"
-      }
-    -re ".*$gdb_prompt $" { fail "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
-    timeout           { fail "(timeout) print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
-  }
+if ![gdb_skip_stdio_test "print str_func(a,b,c,d,e,f,g)"] {
+    send_gdb "print  str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")\n"
+    gdb_expect {
+	-re "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+.*= \"abcdefg\".*$gdb_prompt $" {
+	    pass "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")"
+	}
+	-re ".*$gdb_prompt $" { fail "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
+	timeout           { fail "(timeout) print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
+    }
+}
 
 #call str_func("a","b","c","d","e","f","g")
-send_gdb "call  str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")\n"
-gdb_expect {
-    -re "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+.*= \"abcdefg\".*$gdb_prompt $" {
-        pass "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")"
-      }
-    -re ".*$gdb_prompt $" { fail "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
-    timeout           { fail "(timeout) call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
-  }
+if ![gdb_skip_stdio_test "call str_func(a,b,c,d,e,f,g)"] {
+    send_gdb "call  str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")\n"
+    gdb_expect {
+	-re "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+.*= \"abcdefg\".*$gdb_prompt $" {
+	    pass "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")"
+	}
+	-re ".*$gdb_prompt $" { fail "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
+	timeout           { fail "(timeout) call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
+    }
+}
 
 #print str_func(s,s,s,s,s,s,s)
-send_gdb "print  str_func(s,s,s,s,s,s,s)\n"
-gdb_expect {
-    -re "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*$gdb_prompt $" {
-        pass "print str_func(s,s,s,s,s,s,s)"
-      }
-    -re ".*$gdb_prompt $" { fail "print str_func(s,s,s,s,s,s,s)" }
-    timeout           { fail "(timeout) print str_func(s,s,s,s,s,s,s)" }
-  }
+if ![gdb_skip_stdio_test "print str_func(s,s,s,s,s,s,s,s)"] {
+    send_gdb "print  str_func(s,s,s,s,s,s,s)\n"
+    gdb_expect {
+	-re "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*$gdb_prompt $" {
+	    pass "print str_func(s,s,s,s,s,s,s)"
+	}
+	-re ".*$gdb_prompt $" { fail "print str_func(s,s,s,s,s,s,s)" }
+	timeout     { fail "(timeout) print str_func(s,s,s,s,s,s,s)" }
+    }
+}
 
 #call str_func(s,s,s,s,s,s,s)
-send_gdb "call  str_func(s,s,s,s,s,s,s)\n"
-gdb_expect {
-    -re "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*$gdb_prompt $" {
-        pass "call str_func(s,s,s,s,s,s,s)"
-      }
-    -re ".*$gdb_prompt $" { fail "call str_func(s,s,s,s,s,s,s)" }
-    timeout           { fail "(timeout) call str_func(s,s,s,s,s,s,s)" }
-  }
+if ![gdb_skip_stdio_test "call str_func(s,s,s,s,s,s,s,s)"] {
+    send_gdb "call  str_func(s,s,s,s,s,s,s)\n"
+    gdb_expect {
+	-re "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*$gdb_prompt $" {
+	    pass "call str_func(s,s,s,s,s,s,s)"
+	}
+	-re ".*$gdb_prompt $" { fail "call str_func(s,s,s,s,s,s,s)" }
+	timeout               { fail "(timeout) call str_func(s,s,s,s,s,s,s)" }
+    }
+}
 
 gdb_exit
 return 0
diff --git a/gdb/testsuite/gdb.base/callfuncs.c b/gdb/testsuite/gdb.base/callfuncs.c
index ecf9026..f53bd31 100644
--- a/gdb/testsuite/gdb.base/callfuncs.c
+++ b/gdb/testsuite/gdb.base/callfuncs.c
@@ -172,21 +172,6 @@
     (i5 == 5) && (i6 == 6) && (i7 == 7) && (i8 == 8) && (i9 == 9);
 }
 
-
-/* Gotta have a main to be able to generate a linked, runnable
-   executable, and also provide a useful place to set a breakpoint. */
-extern void * malloc() ;
-int main ()
-{
-#ifdef usestubs
-  set_debug_traps();
-  breakpoint();
-#endif
-  malloc(1);
-  t_structs_c(struct_val1);
-  return 0 ;
-}
-
 /* Functions that expect specific values to be passed and return 
    either 0 or 1, depending upon whether the values were
    passed incorrectly or correctly, respectively. */
@@ -357,3 +342,19 @@
 {
   return ((*func_arg1)(a, b));
 }
+
+
+/* Gotta have a main to be able to generate a linked, runnable
+   executable, and also provide a useful place to set a breakpoint. */
+extern void * malloc() ;
+int main ()
+{
+#ifdef usestubs
+  set_debug_traps();
+  breakpoint();
+#endif
+  malloc(1);
+  t_double_values(double_val1, double_val2);
+  t_structs_c(struct_val1);
+  return 0 ;
+}
diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp
index 8d43ec6..eab99dd 100644
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -237,6 +237,24 @@
     	"call inferior func with struct - returns char *"
 }
 
+# Procedure to get current content of all registers.
+global all_registers_content
+set all_registers_content ""
+proc do_get_all_registers { } {
+    global gdb_prompt
+    global expect_out
+    global all_registers_content
+
+    set all_registers_content ""
+    send_gdb "info all-registers\n"
+    gdb_expect {
+	-re "info all-registers\r\n(.*)$gdb_prompt $" {
+	    set all_registers_content $expect_out(1,string)
+	}
+	default {}
+    }
+}
+
 # Start with a fresh gdb.
 
 gdb_exit
@@ -271,7 +289,80 @@
     }
 }
 
+# Make sure that malloc gets called and that the floating point unit
+# is initialized via a call to t_double_values.
+gdb_test "next" "t_double_values\\(double_val1, double_val2\\);.*"
 gdb_test "next" "t_structs_c\\(struct_val1\\);.*"
+
+# Save all register contents.
+do_get_all_registers
+set old_reg_content $all_registers_content
+
+# Perform function calls.
 do_function_calls
 
+# Check if all registers still have the same value.
+do_get_all_registers
+set new_reg_content $all_registers_content
+if ![string compare $old_reg_content $new_reg_content] then {
+    pass "gdb function calls preserve register contents"
+} else {
+    set old_reg_content $all_registers_content
+    fail "gdb function calls preserve register contents"
+}
+
+# Set breakpoint at a function we will call from gdb.
+gdb_breakpoint add
+
+# Call function (causing a breakpoint hit in the call dummy) and do a continue,
+# make sure we are back at main and still have the same register contents.
+gdb_test "print add(4,5)" "The program being debugged stopped while.*" ""
+gdb_test "continue" "Continuing.*" "continue from call dummy breakpoint"
+if ![gdb_test "bt 2" \
+	      "#0  main.*" \
+	      "bt after continuing from call dummy breakpoint"] then {
+    do_get_all_registers
+    set new_reg_content $all_registers_content
+    if ![string compare $old_reg_content $new_reg_content] then {
+	pass "continue after stop in call dummy preserves register contents"
+    } else {
+	fail "continue after stop in call dummy preserves register contents"
+    }
+}
+
+# Call function (causing a breakpoint hit in the call dummy) and do a finish,
+# make sure we are back at main and still have the same register contents.
+gdb_test "print add(4,5)" "The program being debugged stopped while.*" ""
+gdb_test "finish" \
+	 "Value returned is.* = 9" \
+	 "finish from call dummy breakpoint returns correct value"
+if ![gdb_test "bt 2" \
+	      "#0  main.*" \
+	      "bt after finishing from call dummy breakpoint"] then {
+    do_get_all_registers
+    set new_reg_content $all_registers_content
+    if ![string compare $old_reg_content $new_reg_content] then {
+	pass "finish after stop in call dummy preserves register contents"
+    } else {
+	fail "finish after stop in call dummy preserves register contents"
+    }
+}
+
+# Call function (causing a breakpoint hit in the call dummy) and do a return
+# with a value, make sure we are back at main with the same register contents.
+gdb_test "print add(4,5)" "The program being debugged stopped while.*" ""
+if ![gdb_test "return 7" \
+	      "#0  main.*" \
+	      "back at main after return from call dummy breakpoint" \
+	      "Make add return now. .y or n.*" \
+	      "y"] then {
+    do_get_all_registers
+    set new_reg_content $all_registers_content
+    if ![string compare $old_reg_content $new_reg_content] then {
+	pass "return after stop in call dummy preserves register contents"
+    } else {
+	fail "return after stop in call dummy preserves register contents"
+    }
+}
+
 return 0
diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
index f25f32f..09802bd 100644
--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -45,9 +45,11 @@
 
     gdb_test "set \$foo = 0" "" "set foo in gdbvar_simple_if_test"
     # All this test should do is print 0xdeadbeef once.
-    gdb_test "if \$foo == 1\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" "\\\$\[0-9\]* = 0xdeadbeef" "gdbvar_simple_if_test #1"
+    gdb_test "if \$foo == 1\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \
+	    "\\\$\[0-9\]* = 0xdeadbeef" "gdbvar_simple_if_test #1"
     # All this test should do is print 0xfeedface once.
-    gdb_test "if \$foo == 0\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" "\\\$\[0-9\]* = 0xfeedface" "gdbvar_simple_if_test #2"
+    gdb_test "if \$foo == 0\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \
+	    "\\\$\[0-9\]* = 0xfeedface" "gdbvar_simple_if_test #2"
 }
 
 proc gdbvar_simple_while_test {} {
@@ -55,7 +57,9 @@
 
     gdb_test "set \$foo = 5" "" "set foo in gdbvar_simple_while_test"
     # This test should print 0xfeedface five times.
-    gdb_test "while \$foo > 0\np/x 0xfeedface\nset \$foo -= 1\nend" "\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" "gdbvar_simple_while_test #1"
+    gdb_test "while \$foo > 0\np/x 0xfeedface\nset \$foo -= 1\nend" \
+	    "\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \
+	    "gdbvar_simple_while_test #1"
 }
 
 proc gdbvar_complex_if_while_test {} {
@@ -63,7 +67,9 @@
 
     gdb_test "set \$foo = 4" "" "set foo in gdbvar complex_if_while_test"
     # This test should alternate between 0xdeadbeef and 0xfeedface two times.
-    gdb_test "while \$foo > 0\nset \$foo -= 1\nif \(\$foo % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend" "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" "gdbvar_complex_if_while_test #1"
+    gdb_test "while \$foo > 0\nset \$foo -= 1\nif \(\$foo % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend" \
+	    "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \
+	    "gdbvar_complex_if_while_test #1"
 }
 
 proc progvar_simple_if_test {} {
@@ -75,13 +81,17 @@
     }
 
     if { ![runto factorial] } then { gdb_suppress_tests; }
-    # Don't depend upon argument passing, since most simulators don't currently
-    # support it.  Bash value variable to be what we want.
+    # Don't depend upon argument passing, since most simulators don't
+    # currently support it.  Bash value variable to be what we want.
     gdb_test "p value=5" "" "set value to 5 in progvar_simple_if_test #1"
     # All this test should do is print 0xdeadbeef once.
-    gdb_test "if value == 1\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" "\\\$\[0-9\]* = 0xdeadbeef" "progvar_simple_if_test #1"
+    gdb_test "if value == 1\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \
+	    "\\\$\[0-9\]* = 0xdeadbeef" \
+	    "progvar_simple_if_test #1"
     # All this test should do is print 0xfeedface once.
-    gdb_test "if value == 5\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" "\\\$\[0-9\]* = 0xfeedface" "progvar_simple_if_test #2"
+    gdb_test "if value == 5\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \
+	    "\\\$\[0-9\]* = 0xfeedface" \
+	    "progvar_simple_if_test #2"
     gdb_stop_suppressing_tests;
 }
 
@@ -95,11 +105,13 @@
 
     gdb_test "set args 5" "" "set args in progvar_simple_while_test"
     if { ![runto factorial] } then { gdb_suppress_tests }
-    # Don't depend upon argument passing, since most simulators don't currently
-    # support it.  Bash value variable to be what we want.
+    # Don't depend upon argument passing, since most simulators don't
+    # currently support it.  Bash value variable to be what we want.
     gdb_test "p value=5" "" "set value to 5 in progvar_simple_if_test #2"
     # This test should print 0xfeedface five times.
-    gdb_test "while value > 0\np/x 0xfeedface\nset value -= 1\nend" "\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" "progvar_simple_while_test #1"
+    gdb_test "while value > 0\np/x 0xfeedface\nset value -= 1\nend" \
+	    "\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \
+	    "progvar_simple_while_test #1"
     gdb_stop_suppressing_tests;
 }
 
@@ -113,11 +125,13 @@
 
     gdb_test "set args 4" "" "set args in progvar_complex_if_while_test"
     if { ![runto factorial] } then { gdb_suppress_tests }
-    # Don't depend upon argument passing, since most simulators don't currently
-    # support it.  Bash value variable to be what we want.
+    # Don't depend upon argument passing, since most simulators don't
+    # currently support it.  Bash value variable to be what we want.
     gdb_test "p value=4" "" "set value to 4 in progvar_simple_if_test"
     # This test should alternate between 0xdeadbeef and 0xfeedface two times.
-    gdb_test "while value > 0\nset value -= 1\nif \(value % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend" "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" "progvar_complex_if_while_test #1"
+    gdb_test "while value > 0\nset value -= 1\nif \(value % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend" \
+	    "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \
+	    "progvar_complex_if_while_test #1"
     gdb_stop_suppressing_tests;
 }
 
@@ -129,8 +143,8 @@
 
     gdb_test "set args 5" "" "set args in if_while_breakpoint_command_test"
     if { ![runto factorial] } then { gdb_suppress_tests }
-    # Don't depend upon argument passing, since most simulators don't currently
-    # support it.  Bash value variable to be what we want.
+    # Don't depend upon argument passing, since most simulators don't
+    # currently support it.  Bash value variable to be what we want.
     gdb_test "p value=5" "" "set value to 5 in progvar_simple_if_test"
     delete_breakpoints
     gdb_test "break factorial" "Breakpoint.*at.*" "break factorial #1"
@@ -145,9 +159,15 @@
 	}
     }
     # This test should alternate between 0xdeadbeef and 0xfeedface two times.
-    gdb_test "while value > 0\nset value -= 1\nif \(value % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend\nend" "" "commands part 2 in if_while_breakpoint_command_test"
-    gdb_test "continue" "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" "if_while_breakpoint_command_test #1"
-   gdb_test "info break" "while.*set.*if.*p/x.*else.*p/x.*end.*" "info break in if_while_breakpoint_command_test"
+    gdb_test "while value > 0\nset value -= 1\nif \(value % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend\nend" \
+	    "" \
+	    "commands part 2 in if_while_breakpoint_command_test"
+    gdb_test "continue" \
+	    "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \
+	    "if_while_breakpoint_command_test #1"
+   gdb_test "info break" \
+	   "while.*set.*if.*p/x.*else.*p/x.*end.*" \
+	   "info break in if_while_breakpoint_command_test"
     gdb_stop_suppressing_tests;
 }
 
@@ -160,8 +180,8 @@
 
     gdb_test "set args 6" "" "set args in progvar_simple_while_test"
     if { ![runto factorial] } then { gdb_suppress_tests }
-    # Don't depend upon argument passing, since most simulators don't currently
-    # support it.  Bash value variable to be what we want.
+    # Don't depend upon argument passing, since most simulators don't
+    # currently support it.  Bash value variable to be what we want.
     gdb_test "p value=6" "" "set value to 6 in progvar_simple_if_test #1"
     delete_breakpoints
     gdb_test "break factorial if value == 5" "Breakpoint.*at.*"
@@ -184,11 +204,11 @@
 
     if { [istarget "hppa*-hp-hpux*"] } {
 	gdb_test "continue" \
-	    "Continuing.*.*.*Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.*\[0-9\]*\[      \]*if \\(value > 1\\) \{.*\[0-9\]*\[      \]*value \\*= factorial \\(value - 1\\);.*" \
-	    "continue in infrun_breakpoint_command_test"
+		"Continuing.*.*.*Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.*\[0-9\]*\[      \]*if \\(value > 1\\) \{.*\[0-9\]*\[      \]*value \\*= factorial \\(value - 1\\);.*" \
+		"continue in infrun_breakpoint_command_test"
     } else {
 	gdb_test "continue" \
-	    "Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.*
+		"Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.*
 \[0-9\]*\[ 	\]*if \\(value > 1\\) \{.*
 \[0-9\]*\[ 	\]*value \\*= factorial \\(value - 1\\);.*
 factorial \\(value=4\\) at.*\[0-9\]*\[ 	\]*if \\(value > 1\\) \{.*
@@ -200,7 +220,7 @@
 #2  \[0-9a-fx\]* in factorial \\(value=5\\).*
 #3  \[0-9a-fx\]* in factorial \\(value=6\\).*
 #4  \[0-9a-fx\]* in main \\(.*\\).*" \
-	    "continue in infrun_breakpoint_command_test";
+		"continue in infrun_breakpoint_command_test";
     }
 
     gdb_stop_suppressing_tests;
@@ -214,14 +234,15 @@
 
     gdb_test "set args 6" "" "set args in breakpoint_command_test"
     if { ![runto factorial] } then { gdb_suppress_tests; }
-    # Don't depend upon argument passing, since most simulators don't currently
-    # support it.  Bash value variable to be what we want.
+    # Don't depend upon argument passing, since most simulators don't
+    # currently support it.  Bash value variable to be what we want.
     gdb_test "p value=6" "" "set value to 6 in progvar_simple_if_test #2"
     delete_breakpoints
     gdb_test "break factorial" "Breakpoint.*at.*" "break factorial #2"
     gdb_test "commands\nprintf \"Now the value is %d\\n\", value\nend" \
 	"End with.*" "commands in breakpoint_command_test"
-    gdb_test "continue" "Breakpoint \[0-9\]*, factorial.*Now the value is 5" \
+    gdb_test "continue" \
+	    "Breakpoint \[0-9\]*, factorial.*Now the value is 5" \
 	"continue in breakpoint_command_test"
     gdb_test "print value" " = 5" "print value in breakpoint_command_test"
     gdb_stop_suppressing_tests;
@@ -243,10 +264,16 @@
 	}
     }
     # This test should alternate between 0xdeadbeef and 0xfeedface two times.
-    gdb_test "while \$arg0 > 0\nset \$arg0 -= 1\nif \(\$arg0 % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend\nend" "" "enter commands in user_defined_command_test"
+    gdb_test "while \$arg0 > 0\nset \$arg0 -= 1\nif \(\$arg0 % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend\nend" \
+	    "" \
+	    "enter commands in user_defined_command_test"
 
-    gdb_test "mycommand \$foo" "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" "execute user defined command in user_defined_command_test"
-   gdb_test "show user mycommand" "while.*set.*if.*p/x.*else.*p/x.*end.*" "display user command in user_defined_command_test"
+    gdb_test "mycommand \$foo" \
+	    "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \
+	    "execute user defined command in user_defined_command_test"
+   gdb_test "show user mycommand" \
+	   "while.*set.*if.*p/x.*else.*p/x.*end.*" \
+	   "display user command in user_defined_command_test"
 }
 
 proc watchpoint_command_test {} {
@@ -290,41 +317,36 @@
 
     send_gdb "commands $wp_id\n"
     gdb_expect {
-      -re "Type commands for when breakpoint $wp_id is hit, one per line.*>"\
-              {pass "begin commands on watch"}
-      -re "$gdb_prompt $"\
-              {fail "begin commands on watch"}
-      timeout {fail "(timeout) begin commands on watch"}
+      -re "Type commands for when breakpoint $wp_id is hit, one per line.*>" {
+	  pass "begin commands on watch"
+      }
+      -re "$gdb_prompt $" {fail "begin commands on watch"}
+      timeout             {fail "(timeout) begin commands on watch"}
     }
     send_gdb "print value\n"
     gdb_expect {
-      -re ">"\
-              {pass "add print command to watch"}
-      -re "$gdb_prompt $"\
-              {fail "add print command to watch"}
-      timeout {fail "(timeout) add print command to watch"}
+	-re ">"               {pass "add print command to watch"}
+	-re "$gdb_prompt $"   {fail "add print command to watch"}
+	timeout               {fail "(timeout) add print command to watch"}
     }
     send_gdb "continue\n"
     gdb_expect {
-      -re ">"\
-              {pass "add continue command to watch"}
-      -re "$gdb_prompt $"\
-              {fail "add continue command to watch"}
-      timeout {fail "(timeout) add continue command to watch"}
+	-re ">"               {pass "add continue command to watch"}
+	-re "$gdb_prompt $"   {fail "add continue command to watch"}
+	timeout               {fail "(timeout) add continue command to watch"}
     }
     send_gdb "end\n"
     gdb_expect {
-      -re "$gdb_prompt $"\
-              {pass "begin commands on watch"}
-      timeout {fail "(timeout) begin commands on watch"}
+	-re "$gdb_prompt $"   {pass "begin commands on watch"}
+	timeout               {fail "(timeout) begin commands on watch"}
     }
     send_gdb "continue\n"
     gdb_expect {
-      -re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*run.c:57.*$gdb_prompt $"\
-              {pass "continue with watch"}
-      -re "$gdb_prompt $"\
-              {fail "continue with watch"}
-      timeout {fail "(timeout) continue with watch"}
+	-re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*run.c:57.*$gdb_prompt $" {
+	    pass "continue with watch"
+	}
+	-re "$gdb_prompt $"   {fail "continue with watch"}
+	timeout               {fail "(timeout) continue with watch"}
     }
 }
 
@@ -337,39 +359,56 @@
     }
 
     if { ![runto factorial] } then { gdb_suppress_tests; }
-    # Don't depend upon argument passing, since most simulators don't currently
-    # support it.  Bash value variable to be what we want.
+    # Don't depend upon argument passing, since most simulators don't
+    # currently support it.  Bash value variable to be what we want.
     delete_breakpoints
     gdb_test "break factorial" "Breakpoint.*at.*" "break factorial #2"
     gdb_test "p value=5" "" "set value to 5 in test_command_prompt_position"
     # All this test should do is print 0xdeadbeef once.
-    gdb_test "if value == 1\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" "\\\$\[0-9\]* = 0xdeadbeef" "if test in test_command_prompt_position"
-
-# Now let's test for the correct position of the '>' in gdb's prompt for commands.
-# It should be at the beginning of the line, and not after one space.
+    gdb_test "if value == 1\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \
+	    "\\\$\[0-9\]* = 0xdeadbeef" \
+	    "if test in test_command_prompt_position"
+    
+    # Now let's test for the correct position of the '>' in gdb's
+    # prompt for commands.  It should be at the beginning of the line,
+    # and not after one space.
 
     send_gdb "commands\n"
     gdb_expect {
-	    -re "Type commands.*End with.*\[\r\n\]>$" \
-                { send_gdb "printf \"Now the value is %d\\n\", value\n"
-	          gdb_expect {
-                          -re "^printf.*value\r\n>$" \
-			       { send_gdb "end\n"
-                                 gdb_expect {
-			               -re "^end\r\n$gdb_prompt $" { pass "> OK in test_command_prompt_position" }
-				       -re ".*$gdb_prompt $" { fail "some other message in test_command_prompt_position" }
-				       timeout  { fail "(timeout) 1 in test_command_prompt_position" }
-				 }
-			       }
-			   -re "^ >$" { fail "> not OK in test_command_prompt_position" }
-			   -re ".*$gdb_prompt $"   { fail "wrong message in test_command_prompt_position" }
-			   timeout    { fail "(timeout) 2 in test_command_prompt_position " }
-		       }
-		 }
-		 -re "Type commands.*End with.*\[\r\n\] >$" { fail "prompt not OK in test_command_prompt_position" }
-	   -re ".*$gdb_prompt $" { fail "commands in test_command_prompt_position" }
-	   timeout { fail "(timeout) 3 commands in test_command_prompt_position" }
+	-re "Type commands.*End with.*\[\r\n\]>$" { 
+	    send_gdb "printf \"Now the value is %d\\n\", value\n"
+	    gdb_expect {
+		-re "^printf.*value\r\n>$" {
+		    send_gdb "end\n"
+		    gdb_expect {
+			-re "^end\r\n$gdb_prompt $" { 
+			    pass "> OK in test_command_prompt_position" 
+			}
+			-re ".*$gdb_prompt $" { 
+			    fail "some other message in test_command_prompt_position" 
+			}
+			timeout  { 
+			    fail "(timeout) 1 in test_command_prompt_position"
+			}
+		    }
+		}
+		-re "^ >$" { fail "> not OK in test_command_prompt_position" }
+		-re ".*$gdb_prompt $"   { 
+		    fail "wrong message in test_command_prompt_position" 
+		}
+		timeout    { 
+		    fail "(timeout) 2 in test_command_prompt_position " 
+		}
+	    }
 	}
+	-re "Type commands.*End with.*\[\r\n\] >$" { 
+	    fail "prompt not OK in test_command_prompt_position" 
+	}
+	-re ".*$gdb_prompt $" { 
+	    fail "commands in test_command_prompt_position" 
+	}
+	timeout { fail "(timeout) 3 commands in test_command_prompt_position" }
+    }
 
     gdb_stop_suppressing_tests;
 }
@@ -377,27 +416,39 @@
 
 
 proc deprecated_command_test {} {
-    
-    
     gdb_test "maintenance deprecate blah" "Can't find command.*" \
           "tried to deprecate non-existsing command"
 
     gdb_test "maintenance deprecate p \"new_p\"" ""
-    gdb_test "p 5" "Warning: 'p', an alias for the command 'print' is deprecated.*Use 'new_p'.*" "p deprecated warning, with replacement"
+    gdb_test "p 5" \
+	    "Warning: 'p', an alias for the command 'print' is deprecated.*Use 'new_p'.*" \
+	    "p deprecated warning, with replacement"
     gdb_test "p 5" ".\[0-9\]* = 5.*" "Deprecated warning goes away"
 
     gdb_test "maintenance deprecate p \"new_p\"" ""
     gdb_test "maintenance deprecate print \"new_print\"" ""
-    gdb_test "p 5" "Warning: command 'print' \\(p\\) is deprecated.*Use 'new_print'.*" "both alias and command are deprecated"
+    gdb_test "p 5" \
+	    "Warning: command 'print' \\(p\\) is deprecated.*Use 'new_print'.*" \
+	    "both alias and command are deprecated"
     gdb_test "p 5" ".\[0-9\]* = 5.*" "Deprecated warning goes away"
 
-    gdb_test "maintenance deprecate set endian big \"seb\" " "" "deprecate long comamnd"
-    gdb_test "set endian big" "Warning: command 'set endian big' is deprecated.*Use 'seb'.*" "long command deprecated"
+    gdb_test "maintenance deprecate set remote memory-read-packet-size \"srm\" " \
+	    "" \
+	    "deprecate long comamnd"
+    gdb_test "set remote memory-read-packet-size" \
+	    "Warning: command 'set remote memory-read-packet-size' is deprecated.*Use 'srm'.*" \
+	    "long command deprecated"
 
-    gdb_test "maintenance deprecate set endian big" "" "deprecate long comamnd"
-    gdb_test "set endian big" "Warning: command 'set endian big' is deprecated.*No alternative known.*" "long command deprecated with no alternative."
+    gdb_test "maintenance deprecate set remote memory-read-packet-size" \
+	    "" \
+	    "deprecate long comamnd"
+    gdb_test "set remote memory-read-packet-size" \
+	    "Warning: command 'set remote memory-read-packet-size' is deprecated.*No alternative known.*" \
+	    "long command deprecated with no alternative."
 
-    gdb_test "maintenance deprecate" "\"maintenance deprecate\".*" "deprecate with no arguments"
+    gdb_test "maintenance deprecate" \
+	    "\"maintenance deprecate\".*" \
+	    "deprecate with no arguments"
 }
 
 
diff --git a/gdb/testsuite/gdb.base/constvars.exp b/gdb/testsuite/gdb.base/constvars.exp
index 312b524..f9d1b24 100644
--- a/gdb/testsuite/gdb.base/constvars.exp
+++ b/gdb/testsuite/gdb.base/constvars.exp
@@ -79,16 +79,26 @@
         -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
             send_gdb "up\n"
             gdb_expect {
-                -re ".*$gdb_prompt $" {}
-                timeout { fail "up from marker1" }
+		-re ".*main.*$gdb_prompt $" {
+		    pass "up from marker1"
+		}
+                -re ".*$gdb_prompt $" {
+		    fail "up from marker1"
+		}
+                timeout { fail "up from marker1 (timeout)" }
             }
         }
         -re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
 	    fail "continue to marker1 (demangling)"
             send_gdb "up\n"
             gdb_expect {
-                -re ".*$gdb_prompt $" {}
-                timeout { fail "up from marker1" }
+		-re ".*main.*$gdb_prompt $" {
+		    pass "up from marker1"
+		}
+                -re ".*$gdb_prompt $" {
+		    fail "up from marker1"
+		}
+                timeout { fail "up from marker1 (timeout)" }
             }
         }
         -re "$gdb_prompt $" { fail "continue to marker1"  }
diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
index f998f88..44c9427 100644
--- a/gdb/testsuite/gdb.base/corefile.exp
+++ b/gdb/testsuite/gdb.base/corefile.exp
@@ -164,6 +164,11 @@
 
 send_gdb "core-file $objdir/$subdir/corefile\n"
 gdb_expect {
+    -re ".* program is being debugged already.*y or n. $" {
+	# gdb_load may connect us to a gdbserver.
+	send_gdb "y\n"
+	exp_continue;
+    }
     -re "Core was generated by .*coremaker.*\r\n\#0  .*\(\).*\r\n$gdb_prompt $" {
 	pass "core-file command"
     }
diff --git a/gdb/testsuite/gdb.base/display.exp b/gdb/testsuite/gdb.base/display.exp
index b9e4218..e7f131b 100644
--- a/gdb/testsuite/gdb.base/display.exp
+++ b/gdb/testsuite/gdb.base/display.exp
@@ -49,34 +49,40 @@
 
 # Some coverage stuff
 #
-gdb_test "kill" ".*The program is not being run.*"
-gdb_test "detach" ".*"
-gdb_test "run" ".*"
+if ![target_info exists use_gdb_stub] {
+    gdb_test "kill" ".*The program is not being run.*"
+    gdb_test "detach" ".*"
+    gdb_test "run" ".*"
 
-gdb_load ${binfile}
-gdb_test "kill" ".*"
-gdb_test "detach" ".*"
+    gdb_load ${binfile}
+    gdb_test "kill" ".*" "kill again"
+    gdb_test "detach" ".*" "detach again"
+
+    gdb_exit
+    gdb_start
+    gdb_reinitialize_dir $srcdir/$subdir
+    gdb_load ${binfile}
+}
 
 # Ok, on to real life
 #
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 if ![runto_main] then {
     fail "Could not run to main - other tests will fail."
     continue
 }
 
-gdb_test "b 14" ".*Breakpoint 2.*" "break do_loops"
-gdb_test "c"          ".*Breakpoint 2, do_loops.*" "get to do_loops"
+# Disable hardware watchpoints if necessary.
+if [target_info exists gdb,no_hardware_watchpoints] {
+    gdb_test "set can-use-hw-watchpoints 0" "" ""
+}
+
+gdb_test "break 14" ".*Breakpoint 2.*"           "break  do_loops"
+gdb_test "cont"     ".*Breakpoint 2, do_loops.*" "get to do_loops"
 
 # Create stopping points.
 #
-gdb_test "wat sum"    ".*\[Ww\]atchpoint 3: sum.*" "set watch"
-gdb_test "b 19"       ".*Breakpoint 4.*" "break 19"
+gdb_test "watch sum"    ".*\[Ww\]atchpoint 3: sum.*" "set watch"
+gdb_test "break 19"     ".*Breakpoint 4.*" "break 19"
 
 # Create displays for those points
 #
@@ -89,8 +95,8 @@
 
 # Hit the displays
 #
-gdb_test "c" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f sum = 1.40129846e.45\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0\r\n\[1-9\]*: i = 0.*" "first disp"
-gdb_test "c" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f sum = 2.80259693e.45\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0.*\[1-9\]*: i = 0.*" "second disp"
+gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f sum = 1.40129846e.45\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0\r\n\[1-9\]*: i = 0.*" "first disp"
+gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f sum = 2.80259693e.45\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0.*\[1-9\]*: i = 0.*" "second disp"
 
 gdb_test "enab  disp 6" ".*No display number 6..*" "catch err"
 gdb_test "disab disp 1" ".*" "disab disp 1"
@@ -98,9 +104,9 @@
 gdb_test "enab disp 1"  ".*" "re-enab"
 gdb_test "enab disp 1"  ".*" "re-enab of enab"
 gdb_test "undisp 5"     ".*" "undisp"
-gdb_test "i disp"       ".*Auto-display expressions now in effect.*y  /f sum.*y  /1bi &k.*n  /x j.*y  i.*" "info disp"
+gdb_test "info disp"    ".*Auto-display expressions now in effect.*y  /f sum.*y  /1bi &k.*n  /x j.*y  i.*" "info disp"
 
-gdb_test "c" ".*\[Ww\]atch.*4.20389539e-45.*.*i = 0.*" "next hit"
+gdb_test "cont" ".*\[Ww\]atch.*4.20389539e-45.*.*i = 0.*" "next hit"
 
 send_gdb "undisp\n"
 gdb_expect {
@@ -126,7 +132,7 @@
 }
 
 gdb_test "disab 3" ".*.*" "disab 3"
-gdb_test "c" ".*Breakpoint 4.*" "watch off"
+gdb_test "cont" ".*Breakpoint 4.*" "watch off"
 
 # Now the printf tests
 #
@@ -153,9 +159,9 @@
     }
 }
 
-gdb_test "s" ".*do_vars.*.*27.*"
-gdb_test "tb 37" ".*Breakpoint 5 a.*"
-gdb_test "c" ".*do_vars.*37.*37.*"
+gdb_test "step"      ".*do_vars.*.*27.*"
+gdb_test "tbreak 37" ".*Breakpoint 5 a.*"
+gdb_test "cont"      ".*do_vars.*37.*37.*"
 
 # Beat on printf a bit
 #
@@ -168,10 +174,10 @@
 gdb_test "printf \"\\w\"" ".*Unrecognized escape character.*"
 gdb_test "printf \"%d\" j" ".*Invalid argument syntax.*"
 
-# play with "p", too
+# play with "print", too
 #
-gdb_test "p/r j" ".*Undefined output format.*"
-gdb_test "p j" ".*" "debug test output"
+gdb_test "print/r j" ".*Undefined output format.*"
+gdb_test "print j"   ".*" "debug test output"
 
 # x/0 j doesn't produce any output and terminates PA64 process when testing
 if [istarget "hppa2.0w-hp-hpux11*"] {
@@ -183,15 +189,15 @@
     # on HP-UX you could access the first page without getting an error
     gdb_test "x/rx j" ".*(Cannot access|Error accessing) memory.*|.*0xa:\[ \t\]*\[0-9\]+.*"
 }
-gdb_test "p/0 j" ".*Item count other than 1 is meaningless.*" "p/0 j"
-gdb_test "p/s sum" ".*Format letter.*is meaningless.*" " no s"
-gdb_test "p/i sum" ".*Format letter.*is meaningless.*.*" "no i"
-gdb_test "p/a &sum" ".*= $hex.*<sum>.*"
+gdb_test "print/0 j" ".*Item count other than 1 is meaningless.*" "print/0 j"
+gdb_test "print/s sum" ".*Format letter.*is meaningless.*" " no s"
+gdb_test "print/i sum" ".*Format letter.*is meaningless.*.*" "no i"
+gdb_test "print/a &sum" ".*= $hex.*<sum>.*"
 # If the constant below is larger than the length of main, then
 # this test will (incorrectly) fail.  So use a small number.
-gdb_test "p/a main+4" ".*= $hex.*<.*>.*"
-gdb_test "p/a \$pc" ".*= $hex.*<do_vars+.*>.*"
-gdb_test "p/a &&j" ".*A .* error in expression.*"
+gdb_test "print/a main+4" ".*= $hex.*<.*>.*"
+gdb_test "print/a \$pc" ".*= $hex.*<do_vars+.*>.*"
+gdb_test "print/a &&j" ".*A .* error in expression.*"
 
 # Done!
 #
diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp
index 089a8a5..0a9e92c 100644
--- a/gdb/testsuite/gdb.base/ending-run.exp
+++ b/gdb/testsuite/gdb.base/ending-run.exp
@@ -129,7 +129,13 @@
 # is output from the program.
 #
 gdb_test "cont" ".*Breakpoint.*31.*"
-gdb_test "next" ".*1 2 7 14 23 34 47 62 79  Goodbye!.*32.*" "Step to return"
+
+if ![gdb_skip_stdio_test "Step to return"] {
+    gdb_test "next" ".*1 2 7 14 23 34 47 62 79  Goodbye!.*32.*" \
+	    "Step to return"
+} else {
+    gdb_test "next" "" ""
+}
 
 set old_timeout $timeout
 set timeout 50
diff --git a/gdb/testsuite/gdb.base/exprs.exp b/gdb/testsuite/gdb.base/exprs.exp
index f31407c..925a902 100644
--- a/gdb/testsuite/gdb.base/exprs.exp
+++ b/gdb/testsuite/gdb.base/exprs.exp
@@ -1,4 +1,5 @@
-#   Copyright (C) 1988, 1990, 1991, 1992, 1994, 1997 Free Software Foundation, Inc.
+#   Copyright (C) 1988, 1990, 1991, 1992, 1994, 1997, 2000 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
@@ -215,3 +216,44 @@
 test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long != 0" "\\$\[0-9\]* = $true"  "print v_unsigned_long != (unsigned long)~0" "\\$\[0-9\]* = $false"  "print unsigned long != (~0)"
 test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long < 0" "\\$\[0-9\]* = $false"  "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = $false"  "print unsigned long < (~0)"
 test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long > 0" "\\$\[0-9\]* = $true"  "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = $true"  "print unsigned long > (~0)"
+#
+# Test expressions with casts to a pointer.
+# NB: Some architectures convert a ``NULL'' pointer into
+#     something else. Don't simply test for 0.
+#
+test_expr "set variable v_signed_char = 0" "print (void*)v_signed_char" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_char"
+test_expr "set variable v_signed_short = 0" "print (void*)v_signed_short" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_short"
+test_expr "set variable v_signed_int = 0" "print (void*)v_signed_int" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_int"
+test_expr "set variable v_signed_long = 0" "print (void*)v_signed_long" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_long"
+test_expr "set variable v_unsigned_char = 0" "print (void*)v_unsigned_char" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_unsigned_char"
+test_expr "set variable v_unsigned_short = 0" "print (void*)v_unsigned_short" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_unsigned_short"
+test_expr "set variable v_unsigned_int = 0" "print (void*)v_unsigned_int" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_unsigned_int"
+test_expr "set variable v_unsigned_long = 0" "print (void*)v_unsigned_long" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_unsigned_long"
+#
+# Test expressions with pointers out of range
+#
+# NB: For some architectures, all of sizeof(long),
+#     sizeof(long long) and sizeof(void*) are
+#     the same size so this test can not work.
+#
+send_gdb "print sizeof (long long) > sizeof (long)\n"
+gdb_expect {
+    -re "\\$\[0-9\]* = $true" {
+	set ok 1
+	pass "sizeof (long long) > sizeof (long) (true)"
+    }
+    -re "\\$\[0-9\]* = $false" {
+	set ok 0
+	pass "sizeof (long long) > sizeof (long) (false)"
+    }
+    timeout {
+	set ok 0
+	fail "sizeof (long long) > sizeof (long) (timeout)"
+    }
+}
+if [expr ! $ok] { setup_xfail "*-*-*" }
+gdb_test "print (void*) ((long long) (unsigned long) -1 + 1)" \
+	"warning: value truncated.*" "truncate (void*) 0x00000000ffffffff + 1"
+if [expr ! $ok] { setup_xfail "*-*-*" }
+gdb_test "print (void*) (~((long long)(unsigned long) -1) - 1)" \
+	"warning: value truncated.*" "truncate (void*) 0xffffffff00000000 - 1"
diff --git a/gdb/testsuite/gdb.base/finish.exp b/gdb/testsuite/gdb.base/finish.exp
new file mode 100644
index 0000000..3e8c5ca
--- /dev/null
+++ b/gdb/testsuite/gdb.base/finish.exp
@@ -0,0 +1,118 @@
+# Copyright (C) 2000 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.  
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file was written by Michael Snyder (msnyder@redhat.com)
+
+if $tracelevel then {
+	strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# re-use the program from the "return2" test.
+set testfile "return2"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+proc finish_1 { type } {
+    global gdb_prompt
+
+    gdb_test "break ${type}_func" "Breakpoint \[0123456789\].*" \
+	    "set break on ${type}_func"
+    gdb_test "continue" "Breakpoint.* ${type}_func.*" \
+	    "continue to ${type}_func"
+    send_gdb "finish\n"
+    gdb_expect {
+	-re ".*Value returned is .* = 49 '1'\r\n$gdb_prompt $" {
+	    if { $type == "char" } {
+		pass "finish from char_func"
+	    } else {
+		fail "finish from ${type}_func"
+	    }
+	}
+	-re ".*Value returned is .* = \[0123456789\]* '1'\r\n$gdb_prompt $" {
+	    if { $type == "char" } {
+		pass "finish from char_func (non-ASCII char set?)"
+	    } else {
+		fail "finish from ${type}_func"
+	    }
+	}
+	-re ".*Value returned is .* = 1\r\n$gdb_prompt $" {
+	    pass "finish from ${type}_func"
+	}
+	-re ".*$gdb_prompt $" {
+	    fail "finish from ${type}_func"
+	}
+	timeout {
+	    fail "finish from ${type}_func (timeout)"
+	}
+    }
+}
+
+proc finish_void { } {
+    global gdb_prompt
+
+    gdb_test "break void_func" "Breakpoint \[0123456789\].*" \
+	    "set break on void_func"
+    gdb_test "continue" "Breakpoint.* void_func.*" \
+	    "continue to void_func"
+    send_gdb "finish\n"
+    gdb_expect {
+	-re ".*void_checkpoint.*$gdb_prompt $" {
+	    pass "finish from void_func"
+	}
+	-re ".*$gdb_prompt $" {
+	    fail "finish from void_func"
+	}
+	timeout {
+	    fail "finish from void_func (timeout)"
+	}
+    }
+}
+
+proc finish_tests { } {
+    global gdb_prompt
+
+    if { ! [ runto main ] } then {
+	gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail."
+    }
+
+    finish_void
+    finish_1 "char"
+    finish_1 "short"
+    finish_1 "int"
+    finish_1 "long"
+    finish_1 "long_long"
+    finish_1 "float"
+    finish_1 "double"
+}
+
+# Start with a fresh gdb.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set timeout 30
+finish_tests
diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index 4c64b97..2940882 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -198,7 +198,7 @@
 while {$keep_looking} {
     gdb_expect  {
 
-	-re ".*Object file.*break:  Objfile at $hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 }
+	-re ".*Object file.*break$EXEEXT:  Objfile at $hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 }
 	-re ".*Psymtabs:\[\r\t \]+\n" { set psymtabs 1 }
 	-re ".*Symtabs:\[\r\t \]+\n" { set symtabs 1 }
 
@@ -377,7 +377,7 @@
 #
 send_gdb "maint info sections\n"
 gdb_expect  {
-        -re "Exec file:\r\n.*break., file type.*$gdb_prompt $"\
+        -re "Exec file:\r\n.*break$EXEEXT., file type.*$gdb_prompt $"\
                         { pass "maint info sections" }
         -re ".*$gdb_prompt $"       { fail "maint info sections" }
         timeout         { fail "(timeout) maint info sections" }
@@ -443,7 +443,7 @@
 
 send_gdb "help maint\n"
 gdb_expect  {
-        -re "Commands for use by GDB maintainers\\..*Includes commands to dump specific internal GDB structures in.*a human readable form, to cause GDB to deliberately dump core,.*to test internal functions such as the C.. demangler, etc\\..*List of maintenance subcommands:.*maintenance check-symtabs.*maintenance demangle.*maintenance dump-me.*maintenance info.*maintenance internal-error.*maintenance print.*maintenance space.*maintenance time.*Type.*help maintenance.*followed by maintenance subcommand name for full documentation\\..*Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
+        -re "Commands for use by GDB maintainers\\..*Includes commands to dump specific internal GDB structures in.*a human readable form, to cause GDB to deliberately dump core,.*to test internal functions such as the C.. demangler, etc\\..*List of maintenance subcommands:.*maintenance check-symtabs.*maintenance demangle.*(maintenance dump-me.*)?maintenance info.*maintenance internal-error.*maintenance print.*maintenance space.*maintenance time.*Type.*help maintenance.*followed by maintenance subcommand name for full documentation\\..*Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
  { pass "help maint" }
         -re ".*$gdb_prompt $"       { fail "help maint" }
         timeout         { fail "(timeout) help maint" }
@@ -482,6 +482,10 @@
         timeout         { fail "(timeout) help maint demangle" }
         }
 
+# dump-me is disabled ifdef _WIN32.
+if [ishost *cygwin*] {
+    setup_xfail "*-*-*"
+}
 send_gdb "help maint dump-me\n"
 gdb_expect  {
         -re "Get fatal error; make debugger dump its core\\.\r\nGDB sets it's handling of SIGQUIT back to SIG_DFL and then sends\r\nitself a SIGQUIT signal\\..*$gdb_prompt $"\
@@ -591,7 +595,7 @@
 
 send_gdb "help maint print\n"
 gdb_expect  {
-        -re "Maintenance command for printing GDB internal state\\.\[\r\n\]+List of maintenance print subcommands:\[\r\n\]+maintenance print msymbols -- Print dump of current minimal symbol definitions.*maintenance print objfiles -- Print dump of current object file definitions.*maintenance print psymbols -- Print dump of current partial symbol definitions.*maintenance print statistics -- Print statistics about internal gdb state.*maintenance print symbols -- Print dump of current symbol definitions.*maintenance print type -- Print a type chain for a given symbol.*Type .help maintenance print. followed by maintenance print subcommand name for full documentation\\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
+        -re "Maintenance command for printing GDB internal state\\.\[\r\n\]+List of maintenance print subcommands:\[\r\n\]+maintenance print architecture -- Print the internal architecture configuration.*maintenance print msymbols -- Print dump of current minimal symbol definitions.*maintenance print objfiles -- Print dump of current object file definitions.*maintenance print psymbols -- Print dump of current partial symbol definitions.*maintenance print statistics -- Print statistics about internal gdb state.*maintenance print symbols -- Print dump of current symbol definitions.*maintenance print type -- Print a type chain for a given symbol.*Type .help maintenance print. followed by maintenance print subcommand name for full documentation\\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
                         { pass "help maint print" }
         -re ".*$gdb_prompt $"       { fail "help maint print" }
         timeout         { fail "(timeout) help maint print" }
@@ -608,6 +612,9 @@
 #set oldtimeout $timeout
 #set timeout [expr $timeout + 300]
 
+if [ishost *cygwin*] {
+    setup_xfail "*-*-*"
+}
 send_gdb "maint dump-me\n"
 gdb_expect  {
         -re "Should GDB dump core.*\\(y or n\\) $"\
diff --git a/gdb/testsuite/gdb.base/mips_pro.exp b/gdb/testsuite/gdb.base/mips_pro.exp
index ea2461e..fca2cb9 100644
--- a/gdb/testsuite/gdb.base/mips_pro.exp
+++ b/gdb/testsuite/gdb.base/mips_pro.exp
@@ -54,9 +54,14 @@
 
 if [runto middle] then {
     # PR 3016
+    #   warning: Hit heuristic-fence-post without finding
+    #   warning: enclosing function for pc 0x1006ead0
     if {$gcc_compiled} then { 
-	setup_xfail "hppa*-*-*" "mips*-sgi-irix4*" "mips64*-*-elf"
+	setup_xfail "mips*-sgi-irix4*" "mips64*-*-elf"
     }
-    gdb_test "backtrace" "#0.*middle.*#1.*top.*#2.*main.*"
+    # The call chain is main -> top -> middle.  But gcc can optimize a tail
+    # call to a jump, so the stack may contain either main -> top -> middle
+    # or main -> middle.
+    gdb_test "backtrace" "#0.*middle.*#\[12\].*main.*"
 }
 return 0
diff --git a/gdb/testsuite/gdb.base/miscexprs.exp b/gdb/testsuite/gdb.base/miscexprs.exp
index f7a5fd2..85e25a2 100644
--- a/gdb/testsuite/gdb.base/miscexprs.exp
+++ b/gdb/testsuite/gdb.base/miscexprs.exp
@@ -69,8 +69,13 @@
         -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
             send_gdb "up\n"
             gdb_expect {
-                -re ".*$gdb_prompt $" {}
-                timeout { fail "up from marker1" }
+		-re ".*main.*$gdb_prompt $" {
+		    pass "up from marker1"
+		}
+                -re ".*$gdb_prompt $" {
+		    fail "up from marker1"
+		}
+                timeout { fail "up from marker1 (timeout)" }
             }
         }
         -re "$gdb_prompt $" { fail "continue to marker1"  }
diff --git a/gdb/testsuite/gdb.base/pointers.exp b/gdb/testsuite/gdb.base/pointers.exp
index 539f875..1c58408 100644
--- a/gdb/testsuite/gdb.base/pointers.exp
+++ b/gdb/testsuite/gdb.base/pointers.exp
@@ -371,8 +371,13 @@
         -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
             send_gdb "up\n"
             gdb_expect {
-                -re ".*$gdb_prompt $" {}
-                timeout { fail "up from marker1" }
+                -re ".*more_code.*$gdb_prompt $" {
+		    pass "up from marker1"
+		}
+                -re ".*$gdb_prompt $" {
+		    fail "up from marker1"
+		}
+                timeout { fail "up from marker1 (timeout)" }
             }
         }
         -re "$gdb_prompt $" { fail "continue to marker1"  }
diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp
index 3ea3b90..9a2dc84 100644
--- a/gdb/testsuite/gdb.base/printcmds.exp
+++ b/gdb/testsuite/gdb.base/printcmds.exp
@@ -542,13 +542,13 @@
 
     gdb_test "set print elements 24" ""
 
-    gdb_test "p int1dim" \
+    gdb_test_escape_braces "p int1dim" \
 	" = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}"
-    gdb_test "p int2dim" \
+    gdb_test_escape_braces "p int2dim" \
 	" = {{0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11}}"
-    gdb_test "p int3dim" \
+    gdb_test_escape_braces "p int3dim" \
 	" = {{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}"
-    gdb_test "p int4dim" \
+    gdb_test_escape_braces "p int4dim" \
 	" = {{{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}}"
 }
 
@@ -557,7 +557,7 @@
 
     gdb_test "set print elements 24" ""
 
-    gdb_test "p a1" \
+    gdb_test_escape_braces "p a1" \
 	" = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}"
     gdb_test "p a1\[0\]" " = 2"
     gdb_test "p a1\[9\]" " = 20"
@@ -570,11 +570,11 @@
 
 proc test_artificial_arrays {} {
     # Send \026@ instead of just @ in case the kill character is @.
-    gdb_test "p int1dim\[0\]\026@2" " = {0, 1}" {p int1dim[0]@2}
-    gdb_test "p int1dim\[0\]\026@2\026@3" \
+    gdb_test_escape_braces "p int1dim\[0\]\026@2" " = {0, 1}" {p int1dim[0]@2}
+    gdb_test_escape_braces "p int1dim\[0\]\026@2\026@3" \
 	"({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \
 	{p int1dim[0]@2@3}
-    gdb_test {p/x (short [])0x12345678} \
+    gdb_test_escape_braces {p/x (short [])0x12345678} \
 	" = ({0x1234, 0x5678}|{0x5678, 0x1234})"
 }
 
@@ -655,11 +655,11 @@
     setup_xfail "a29k-*-udi" 2416
     gdb_test "print {'a','b','c'}"	" = \"abc\""
     setup_xfail "a29k-*-udi" 2416
-    gdb_test "print {0,1,2}"		" = {0, 1, 2}"
+    gdb_test_escape_braces "print {0,1,2}"    " = {0, 1, 2}"
     setup_xfail "a29k-*-udi" 2416
-    gdb_test "print {(long)0,(long)1,(long)2}"	" = {0, 1, 2}"
+    gdb_test_escape_braces "print {(long)0,(long)1,(long)2}"  " = {0, 1, 2}"
     setup_xfail "a29k-*-udi" 2416
-    gdb_test "print {{0,1,2},{3,4,5}}"  " = {{0, 1, 2}, {3, 4, 5}}"
+    gdb_test_escape_braces "print {{0,1,2},{3,4,5}}"  " = {{0, 1, 2}, {3, 4, 5}}"
     setup_xfail "a29k-*-udi" 2416
     gdb_test "print {4,5,6}\[2\]"	" = 6"
     setup_xfail "a29k-*-udi" 2416
@@ -680,6 +680,15 @@
 0xfeedface, 0xdeadbeef, 5.0" "bad -99.54\[0-9\]+, z feedface, deadbeef, 5.0+"
 }
 
+# Escape a left curly brace to prevent it from being interpreted as 
+# the beginning of a bound
+proc gdb_test_escape_braces { args } {
+
+    set pattern [lindex $args 1]
+    regsub -all {\{[0-9]} $pattern {\\&} esc_pattern
+    gdb_test [lindex $args 0] $esc_pattern [lindex $args 2]
+}
+
 # Start with a fresh gdb.
 
 gdb_exit
diff --git a/gdb/testsuite/gdb.base/recurse.exp b/gdb/testsuite/gdb.base/recurse.exp
index 88e1b30..c222233 100644
--- a/gdb/testsuite/gdb.base/recurse.exp
+++ b/gdb/testsuite/gdb.base/recurse.exp
@@ -42,6 +42,11 @@
 
 proc recurse_tests {} {
 
+    # Disable hardware watchpoints if necessary.
+    if [target_info exists gdb,no_hardware_watchpoints] {
+	gdb_test "set can-use-hw-watchpoints 0" "" ""
+    }
+
     if [runto recurse] then {
 	# First we need to step over the assignment of b, so it has a known
 	# value.
@@ -127,19 +132,15 @@
     gdb_stop_suppressing_tests;
 }
 
-# Only enabled for some targets merely because it has not been tested 
-# elsewhere.
-if {[istarget "sparc*-*-sunos4*"] || [istarget "hppa*-*-bsd*"] || [istarget "hppa*-*-hpux*"] || [istarget "sparclet-*-*"] || [istarget "m32r-*-elf"] || [istarget "mn10200-*-*"] || [istarget "mn10300-*-*"]} then {
+# Preserve the old timeout, and set a new one that should be
+# sufficient to avoid timing out during this test.
+set oldtimeout $timeout
+set timeout [expr "$timeout + 60"]
+verbose "Timeout is now $timeout seconds" 2
 
-    # Preserve the old timeout, and set a new one that should be
-    # sufficient to avoid timing out during this test.
-    set oldtimeout $timeout
-    set timeout [expr "$timeout + 60"]
-    verbose "Timeout is now $timeout seconds" 2
+recurse_tests
 
-    recurse_tests
+# Restore the preserved old timeout value.
+set timeout $oldtimeout
+verbose "Timeout is now $timeout seconds" 2
 
-    # Restore the preserved old timeout value.
-    set timeout $oldtimeout
-    verbose "Timeout is now $timeout seconds" 2
-}
diff --git a/gdb/testsuite/gdb.base/reread.exp b/gdb/testsuite/gdb.base/reread.exp
index ccdabd5..b76fc5a 100644
--- a/gdb/testsuite/gdb.base/reread.exp
+++ b/gdb/testsuite/gdb.base/reread.exp
@@ -30,7 +30,8 @@
 
 set testfile1 "reread1"
 set srcfile1 ${testfile1}.c
-set binfile1 ${objdir}/${subdir}/${testfile1}
+# Cygwin needs $EXEEXT.
+set binfile1 ${objdir}/${subdir}/${testfile1}$EXEEXT
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile1}" executable {debug additional_flags=-w}] != "" } {
     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
@@ -40,7 +41,7 @@
 
 set testfile2 "reread2"
 set srcfile2 ${testfile2}.c
-set binfile2 ${objdir}/${subdir}/${testfile2}
+set binfile2 ${objdir}/${subdir}/${testfile2}$EXEEXT
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug additional_flags=-w}] != "" } {
     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
@@ -49,7 +50,7 @@
 # Start with a fresh gdb.
 
 set testfile "reread"
-set binfile ${objdir}/${subdir}/${testfile}
+set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
 
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
diff --git a/gdb/testsuite/gdb.base/restore.exp b/gdb/testsuite/gdb.base/restore.exp
index 8cf5035..ff563ef 100644
--- a/gdb/testsuite/gdb.base/restore.exp
+++ b/gdb/testsuite/gdb.base/restore.exp
@@ -87,19 +87,24 @@
         }
     }
 
-    send_gdb "continue\n"
+    if ![gdb_skip_stdio_test "run to completion"] {
+	send_gdb "continue\n"
 
-    gdb_expect {
-        -re "exiting" {
-             pass "run to completion"
-        }
-        timeout { 
-             fail "(timeout) run to completion"
-        }
+	gdb_expect {
+	    -re "exiting" {
+		pass "run to completion"
+	    }
+	    timeout { 
+		fail "(timeout) run to completion"
+	    }
+	}
+    } else {
+	gdb_test "continue" "" ""
     }
 }
 
 
+
 # Start with a fresh gdb.
 
 gdb_exit
diff --git a/gdb/testsuite/gdb.base/return2.c b/gdb/testsuite/gdb.base/return2.c
new file mode 100644
index 0000000..cddbb97
--- /dev/null
+++ b/gdb/testsuite/gdb.base/return2.c
@@ -0,0 +1,91 @@
+/* Test gdb's "return" command.  */
+
+int void_test = 0;
+int main_test = 0;
+
+char      char_returnval      = '1';
+short     short_returnval     = 1;
+int       int_returnval       = 1;
+long      long_returnval      = 1;
+long long long_long_returnval = 1;
+float     float_returnval     = 1;
+double    double_returnval    = 1;
+
+union {
+  char      char_testval;
+  short     short_testval;
+  int       int_testval;
+  long      long_testval;
+  long long long_long_testval;
+  float     float_testval;
+  double    double_testval;
+  char      ffff[80];
+} testval;
+
+void void_func ()
+{
+  void_test = 1;
+}
+
+char char_func ()
+{
+  return char_returnval;
+}
+
+short short_func ()
+{
+  return short_returnval;
+}
+
+int int_func ()
+{
+  return int_returnval;
+}
+
+long long_func ()
+{
+  return long_returnval;
+}
+
+long long long_long_func ()
+{
+  return long_long_returnval;
+}
+
+float float_func ()
+{
+  return float_returnval;
+}
+
+double double_func ()
+{
+  return double_returnval;
+}
+
+int main (int argc, char **argv)
+{
+  char char_resultval;
+  short short_resultval;
+  int int_resultval;
+  long long_resultval;
+  long long long_long_resultval;
+  float float_resultval;
+  double double_resultval;
+  int i;
+
+  /* A "test load" that will insure that the function really returns 
+     a ${type} (as opposed to just a truncated or part of a ${type}).  */
+  for (i = 0; i < sizeof (testval.ffff); i++)
+    testval.ffff[i] = 0xff;
+
+  void_func (); 				/* call to void_func */
+  char_resultval      = char_func ();		/* void_checkpoint */
+  short_resultval     = short_func ();		/* char_checkpoint */
+  int_resultval       = int_func ();		/* short_checkpoint */
+  long_resultval      = long_func ();		/* int_checkpoint */
+  long_long_resultval = long_long_func ();	/* long_checkpoint */
+  float_resultval     = float_func ();		/* long_long_checkpoint */
+  double_resultval    = double_func ();		/* float_checkpoint */
+  main_test = 1;				/* double_checkpoint */
+  return 0;
+}
diff --git a/gdb/testsuite/gdb.base/return2.exp b/gdb/testsuite/gdb.base/return2.exp
new file mode 100644
index 0000000..6298ccb
--- /dev/null
+++ b/gdb/testsuite/gdb.base/return2.exp
@@ -0,0 +1,125 @@
+# Copyright (C) 2000 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.  
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file was written by Michael Snyder (msnyder@redhat.com)
+
+if $tracelevel then {
+	strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "return2"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+proc return_1 { type } {
+    global gdb_prompt
+
+    gdb_test "break ${type}_func" "Breakpoint \[0123456789\].*" \
+	    "set break on ${type}_func"
+    gdb_test "continue" "Breakpoint.* ${type}_func.*" \
+	    "continue to ${type}_func"
+    send_gdb "return testval.${type}_testval\n"
+    gdb_expect {
+	-re "Make ${type}_func return now.*y or n. $" {
+	    send_gdb "y\n"
+	    exp_continue
+	}
+	-re ".*${type}_resultval *= ${type}_func.*$gdb_prompt $" {
+	    send_gdb "step\n"
+	    exp_continue
+	}
+	-re ".*${type}_checkpoint.*$gdb_prompt $" {
+	    pass "return from ${type}_func"
+	}
+	-re ".*$gdb_prompt $" {
+	    fail "return from ${type}_func"
+	}
+	timeout {
+	    fail "return from ${type}_func (timeout)"
+	}
+    }
+    gdb_test "print ${type}_resultval == testval.${type}_testval" ".* = 1" \
+	    "${type} value returned successfully"
+    gdb_test "print ${type}_resultval != ${type}_returnval" ".* = 1" \
+	    "validate result value not equal to program return value"
+}
+
+proc return_void { } {
+    global gdb_prompt
+
+    gdb_test "break void_func" "Breakpoint \[0123456789\].*" \
+	    "set break on void_func"
+    gdb_test "continue" "Breakpoint.* void_func.*" \
+	    "continue to void_func"
+    send_gdb "return \n"
+    gdb_expect {
+	-re "Make void_func return now.*y or n. $" {
+	    send_gdb "y\n"
+	    exp_continue
+	}
+	-re ".*void_func.*call to void_func.*$gdb_prompt $" {
+	    send_gdb "step\n"
+	    exp_continue
+	}
+	-re ".*void_checkpoint.*$gdb_prompt $" {
+	    pass "return from void_func"
+	}
+	-re ".*$gdb_prompt $" {
+	    fail "return from void_func"
+	}
+	timeout {
+	    fail "return from void_func (timeout)"
+	}
+    }
+    gdb_test "print void_test == 0" ".* = 1" \
+	    "void function returned successfully"
+}
+
+proc return2_tests { } {
+    global gdb_prompt
+
+    if { ! [ runto main ] } then {
+	gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail."
+    }
+
+    return_void
+    return_1 "char"
+    return_1 "short"
+    return_1 "int"
+    return_1 "long"
+    return_1 "long_long"
+    return_1 "float"
+    return_1 "double"
+}
+
+# Start with a fresh gdb.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set timeout 30
+return2_tests
diff --git a/gdb/testsuite/gdb.base/scope.exp b/gdb/testsuite/gdb.base/scope.exp
index 6c3f9f2..b4f9936 100644
--- a/gdb/testsuite/gdb.base/scope.exp
+++ b/gdb/testsuite/gdb.base/scope.exp
@@ -452,7 +452,7 @@
 	gdb_suppress_tests;
     }
 
-    if [gdb_test "up" ".*" "" ] { 
+    if [gdb_test "up" ".*autovars.*" "up from marker1 in scope.exp" ] { 
 	gdb_suppress_tests ; 
     }
 
@@ -484,7 +484,7 @@
     if [gdb_test "cont" "Break.* marker2 \\(\\) at .*:$decimal.*" "continue to marker2"] {
 	gdb_suppress_tests;
     }
-    if [gdb_test "up" ".*" "" ] { 
+    if [gdb_test "up" ".*localscopes.*" "up from marker2 in scopes.exp" ] { 
 	gdb_suppress_tests ; 
     }
 
@@ -499,7 +499,9 @@
 
     if [gdb_test "cont" "Break.* marker3 \\(\\) at .*:$decimal.*" \
 	"continue to marker3 in scope.exp"] then { gdb_suppress_tests }
-    if [gdb_test "up" "" "up from marker3 in scope.exp"] then { gdb_suppress_tests }
+    if [gdb_test "up" ".*localscopes.*" "up from marker3 in scope.exp"] { 
+	gdb_suppress_tests 
+    }
 
     # Should be at next (first nested) scope.  Check values.
 
@@ -515,7 +517,9 @@
     setup_xfail "a29k-*-udi" 2423
     if [gdb_test "cont" "Break.* marker4.*at .*:$decimal.*" \
 	"continue to marker4 in scope.exp"] then { gdb_suppress_tests }
-    if [gdb_test "up" "" "up from marker4 in scope.exp"] then { gdb_suppress_tests }
+    if [gdb_test "up" ".*localscopes.*" "up from marker4 in scope.exp"] {
+	gdb_suppress_tests 
+    }
 
     gdb_test "print localval" " = 30" "print localval, innermost scope"
     gdb_test "print localval1" " = 11" "print localval1, innermost scope"
diff --git a/gdb/testsuite/gdb.base/setvar.exp b/gdb/testsuite/gdb.base/setvar.exp
index f321c9f..900e868 100644
--- a/gdb/testsuite/gdb.base/setvar.exp
+++ b/gdb/testsuite/gdb.base/setvar.exp
@@ -257,47 +257,47 @@
 #
 # test "set variable" for "short array[2]"
 #
-test_set "set variable v_short_array\[0\]=123" "set variable v_short_array\[1\]=-456" "print v_short_array" ".*.\[0-9\]* =.*\{123,.*-456\}"        "set variable short array" 
+test_set "set variable v_short_array\[0\]=123" "set variable v_short_array\[1\]=-456" "print v_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}"        "set variable short array" 
 #
 # test "set variable" for "signed short array[2]"
 #
-test_set "set variable v_signed_short_array\[0\]=123" "set variable v_signed_short_array\[1\]=-456" "print v_signed_short_array" ".*.\[0-9\]* =.*\{123,.*-456\}"        "set variable signed short array" 
+test_set "set variable v_signed_short_array\[0\]=123" "set variable v_signed_short_array\[1\]=-456" "print v_signed_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}"        "set variable signed short array" 
 #
 # test "set variable" for "unsigned short array[2]"
 #
-test_set "set variable v_unsigned_short_array\[0\]=123" "set variable v_unsigned_short_array\[1\]=-456" "print v_unsigned_short_array" ".*.\[0-9\]* =.*\{123,.*65080\}"        "set variable unsigned short array" 
+test_set "set variable v_unsigned_short_array\[0\]=123" "set variable v_unsigned_short_array\[1\]=-456" "print v_unsigned_short_array" ".*.\[0-9\]* =.*\\{123,.*65080\\}"        "set variable unsigned short array" 
 #
 # test "set variable" for "int array[2]"
 #
-test_set "set variable v_int_array\[0\]=123" "set variable v_int_array\[1\]=-456" "print v_int_array" ".*.\[0-9\]* =.*\{123,.*-456\}"        "set variable int array" 
+test_set "set variable v_int_array\[0\]=123" "set variable v_int_array\[1\]=-456" "print v_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}"        "set variable int array" 
 #
 # test "set variable" for "signed int array[2]"
 #
-test_set "set variable v_signed_int_array\[0\]=123" "set variable v_signed_int_array\[1\]=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\{123,.*-456\}"        "set variable signed int array" 
+test_set "set variable v_signed_int_array\[0\]=123" "set variable v_signed_int_array\[1\]=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}"        "set variable signed int array" 
 #
 # test "set variable" for "unsigned int array[2]"
 #
-test_set "set variable v_unsigned_int_array\[0\]=123" "set variable v_unsigned_int_array\[1\]=-456" "print v_unsigned_int_array" ".*.\[0-9\]* =.*\{123,.*(4294966840|65080)\}"        "set variable unsigned int array" 
+test_set "set variable v_unsigned_int_array\[0\]=123" "set variable v_unsigned_int_array\[1\]=-456" "print v_unsigned_int_array" ".*.\[0-9\]* =.*\\{123,.*(4294966840|65080)\\}"        "set variable unsigned int array" 
 #
 # test "set variable" for "long array[2]"
 #
-test_set "set variable v_long_array\[0\]=123" "set variable v_long_array\[1\]=-456" "print v_long_array" ".*.\[0-9\]* =.*\{123,.*-456\}"        "set variable long array" 
+test_set "set variable v_long_array\[0\]=123" "set variable v_long_array\[1\]=-456" "print v_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}"        "set variable long array" 
 #
 # test "set variable" for "signed long array[2]"
 #
-test_set "set variable v_signed_long_array\[0\]=123" "set variable v_signed_long_array\[1\]=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\{123,.*-456\}"        "set variable signed long array" 
+test_set "set variable v_signed_long_array\[0\]=123" "set variable v_signed_long_array\[1\]=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}"        "set variable signed long array" 
 #
 # test "set variable" for "unsigned long array[2]"
 #
-test_set "set variable v_unsigned_long_array\[0\]=123" "set variable v_unsigned_long_array\[1\]=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}"        "set variable unsigned long array" 
+test_set "set variable v_unsigned_long_array\[0\]=123" "set variable v_unsigned_long_array\[1\]=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\\{123,.*$ulong_minus_456\\}"        "set variable unsigned long array" 
 #
 # test "set variable" for "float array[2]"
 #
-test_set "set variable v_float_array\[0\]=123.0" "set variable v_float_array\[1\]=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\{123,.*-456\}"        "set variable float array" 
+test_set "set variable v_float_array\[0\]=123.0" "set variable v_float_array\[1\]=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}"        "set variable float array" 
 #
 # test "set variable" for "double array[2]"
 #
-test_set "set variable v_double_array\[0\]=123.0" "set variable v_double_array\[1\]=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\{123,.*-456\}"        "set variable double array" 
+test_set "set variable v_double_array\[0\]=123.0" "set variable v_double_array\[1\]=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}"        "set variable double array" 
 #
 # test "set variable" for type "char *"
 #
@@ -313,7 +313,7 @@
 #
 # test "set variable" for type "short *"
 #
-test_set "set v_short_pointer=v_short_array" "set variable *(v_short_pointer)=123" "set variable *(v_short_pointer+1)=-456" "print v_short_array" ".*.\[0-9\]* =.*\{123,.*-456\}"  "print *(v_short_pointer+1)" ".*.\[0-9\]* = -456"     "set variable short pointer" 
+test_set "set v_short_pointer=v_short_array" "set variable *(v_short_pointer)=123" "set variable *(v_short_pointer+1)=-456" "print v_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}"  "print *(v_short_pointer+1)" ".*.\[0-9\]* = -456"     "set variable short pointer" 
 #
 # test "set variable" for type "signed short *"
 #
@@ -339,36 +339,36 @@
 #
 # test "set variable" for type "int *"
 #
-test_set "set v_int_pointer=v_int_array" "set variable *(v_int_pointer)=123" "set variable *(v_int_pointer+1)=-456" "print v_int_array" ".*.\[0-9\]* =.*\{123,.*-456\}"  "print *(v_int_pointer+1)" ".*.\[0-9\]* = -456"     "set variable int pointer" 
+test_set "set v_int_pointer=v_int_array" "set variable *(v_int_pointer)=123" "set variable *(v_int_pointer+1)=-456" "print v_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}"  "print *(v_int_pointer+1)" ".*.\[0-9\]* = -456"     "set variable int pointer" 
 #
 # test "set variable" for type "signed int *"
 #
-test_set "set v_signed_int_pointer=v_signed_int_array" "set variable *(v_signed_int_pointer)=123" "set variable *(v_signed_int_pointer+1)=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\{123,.*-456\}"  "print *(v_signed_int_pointer+1)" ".*.\[0-9\]* = -456"     "set variable signed int pointer" 
+test_set "set v_signed_int_pointer=v_signed_int_array" "set variable *(v_signed_int_pointer)=123" "set variable *(v_signed_int_pointer+1)=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}"  "print *(v_signed_int_pointer+1)" ".*.\[0-9\]* = -456"     "set variable signed int pointer" 
 #
 # test "set variable" for type "unsigned int *"
 #
-test_set "set v_unsigned_int_pointer=v_unsigned_int_array" "set variable *(v_unsigned_int_pointer)=123" "set variable *(v_unsigned_int_pointer+1)=-456" "print v_unsigned_int_array" ".*.\[0-9\]* =.*\{123,.*(4294966840|65080)\}" "set variable unsigned int pointer"
+test_set "set v_unsigned_int_pointer=v_unsigned_int_array" "set variable *(v_unsigned_int_pointer)=123" "set variable *(v_unsigned_int_pointer+1)=-456" "print v_unsigned_int_array" ".*.\[0-9\]* =.*\\{123,.*(4294966840|65080)\\}" "set variable unsigned int pointer"
 test_set "" "print *(v_unsigned_int_pointer+1)" ".*.\[0-9\]* = (4294966840|65080)"     "print variable unsigned int pointer+1"
 #
 # test "set variable" for type "long *"
 #
-test_set "set v_long_pointer=v_long_array" "set variable *(v_long_pointer)=123" "set variable *(v_long_pointer+1)=-456" "print v_long_array" ".*.\[0-9\]* =.*\{123,.*-456\}"  "print *(v_long_pointer+1)" ".*.\[0-9\]* = -456"     "set variable long pointer" 
+test_set "set v_long_pointer=v_long_array" "set variable *(v_long_pointer)=123" "set variable *(v_long_pointer+1)=-456" "print v_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}"  "print *(v_long_pointer+1)" ".*.\[0-9\]* = -456"     "set variable long pointer" 
 #
 # test "set variable" for type "signed long *"
 #
-test_set "set v_signed_long_pointer=v_signed_long_array" "set variable *(v_signed_long_pointer)=123" "set variable *(v_signed_long_pointer+1)=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\{123,.*-456\}"  "print *(v_signed_long_pointer+1)" ".*.\[0-9\]* = -456"     "set variable signed long pointer" 
+test_set "set v_signed_long_pointer=v_signed_long_array" "set variable *(v_signed_long_pointer)=123" "set variable *(v_signed_long_pointer+1)=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}"  "print *(v_signed_long_pointer+1)" ".*.\[0-9\]* = -456"     "set variable signed long pointer" 
 #
 # test "set variable" for type "unsigned long *"
 #
-test_set "set v_unsigned_long_pointer=v_unsigned_long_array" "set variable *(v_unsigned_long_pointer)=123" "set variable *(v_unsigned_long_pointer+1)=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}"  "print *(v_unsigned_long_pointer+1)" ".*.\[0-9\]* = $ulong_minus_456"     "set variable unsigned long pointer" 
+test_set "set v_unsigned_long_pointer=v_unsigned_long_array" "set variable *(v_unsigned_long_pointer)=123" "set variable *(v_unsigned_long_pointer+1)=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\\{123,.*$ulong_minus_456\\}"  "print *(v_unsigned_long_pointer+1)" ".*.\[0-9\]* = $ulong_minus_456"     "set variable unsigned long pointer" 
 #
 # test "set variable" for type "float *"
 #
-test_set "set v_float_pointer=v_float_array" "set variable *(v_float_pointer)=123.0" "set variable *(v_float_pointer+1)=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\{123,.*-456\}"  "print *(v_float_pointer+1)" ".*.\[0-9\]* = -456"     "set variable float pointer" 
+test_set "set v_float_pointer=v_float_array" "set variable *(v_float_pointer)=123.0" "set variable *(v_float_pointer+1)=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}"  "print *(v_float_pointer+1)" ".*.\[0-9\]* = -456"     "set variable float pointer" 
 #
 # test "set variable" for type "double *"
 #
-test_set "set v_double_pointer=v_double_array" "set variable *(v_double_pointer)=123.0" "set variable *(v_double_pointer+1)=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\{123,.*-456\}"  "print *(v_double_pointer+1)" ".*.\[0-9\]* = -456"     "set variable double pointer" 
+test_set "set v_double_pointer=v_double_array" "set variable *(v_double_pointer)=123.0" "set variable *(v_double_pointer+1)=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}"  "print *(v_double_pointer+1)" ".*.\[0-9\]* = -456"     "set variable double pointer" 
 #
 # test "set variable" for struct members
 #
@@ -400,17 +400,17 @@
 # Change the values
 test_set "set variable v_struct1 = {32, 33, 34, 35, 36, 37}" \
   "print v_struct1" \
-  ".*.\[0-9\]* = \{.*v_char_member = 32 \' \',.*v_short_member = 33,\
+  ".*.\[0-9\]* = \\{.*v_char_member = 32 \' \',.*v_short_member = 33,\
 .*v_int_member = 34,.*\
-v_long_member = 35,.*v_float_member = 36,.*v_double_member = 37.*\}" \
+v_long_member = 35,.*v_float_member = 36,.*v_double_member = 37.*\\}" \
   "set print structure #2"
 
 # Change them back
 test_set "set variable v_struct1 = {'h', 1, 2, 3, 4.0, 5.0}" \
   "print v_struct1" \
-  ".*.\[0-9\]* = \{.*v_char_member = 104 \'h\',.*v_short_member = 1,\
+  ".*.\[0-9\]* = \\{.*v_char_member = 104 \'h\',.*v_short_member = 1,\
 .*v_int_member = 2,.*\
-v_long_member = 3,.*v_float_member = 4,.*v_double_member = 5.*\}" \
+v_long_member = 3,.*v_float_member = 4,.*v_double_member = 5.*\\}" \
   "set print structure #3"
 
 # Test printing of enumeration bitfields.
diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp
index 0381657..09073e6 100644
--- a/gdb/testsuite/gdb.base/shlib-call.exp
+++ b/gdb/testsuite/gdb.base/shlib-call.exp
@@ -139,13 +139,19 @@
 
 
 #step -over
-    send_gdb "next\n"
-    gdb_expect {
-        -re ".*address of sgs is $hex.*g = shr2\\(g\\).*$gdb_prompt $" {
-             pass "next over shr1" }
-        -re ".*$gdb_prompt $" { fail "next over shr1" }
-        timeout { fail "next over shr1 (timeout)" }
-    }
+  if ![gdb_skip_stdio_test "next over shr1"] {
+      send_gdb "next\n"
+      gdb_expect {
+	  -re ".*address of sgs is $hex.*g = shr2\\(g\\).*$gdb_prompt $" {
+	      pass "next over shr1" 
+	  }
+	  -re ".*$gdb_prompt $" { fail "next over shr1" }
+	  timeout { fail "next over shr1 (timeout)" }
+      }
+  } else {
+      gdb_test "next" "" ""
+  }
+
 
 #print g
 send_gdb "print g\n"
@@ -157,21 +163,27 @@
   }
 
 #print shr1(1)
-send_gdb "print shr1(1)\n"
-gdb_expect {
-    -re ".*address of sgs is $hex.*\[0-9\]* = 2.*$gdb_prompt $" {
-        pass "print shr1(1)" }
-    -re ".*$gdb_prompt $" { fail "print  shr1(1)" }
-    timeout           { fail "(timeout) print shr1(1)" }
+  if ![gdb_skip_stdio_test "print shr1(1)"] {
+      send_gdb "print shr1(1)\n"
+      gdb_expect {
+	  -re ".*address of sgs is $hex.*\[0-9\]* = 2.*$gdb_prompt $" {
+	      pass "print shr1(1)" 
+	  }
+	  -re ".*$gdb_prompt $" { fail "print shr1(1)" }
+	  timeout               { fail "(timeout) print shr1(1)" }
+      }
   }
 
 #print shr1(g)
-send_gdb "print shr1(g)\n"
-gdb_expect {
-    -re ".*address of sgs is $hex.*\[0-9\]* = 4.*$gdb_prompt $" {
-        pass "print shr1(g)" }
-    -re ".*$gdb_prompt $" { fail "print  shr1(g)" }
-    timeout           { fail "(timeout) print shr1(g)" }
+  if ![gdb_skip_stdio_test "print shr1(g)"] {
+      send_gdb "print shr1(g)\n"
+      gdb_expect {
+	  -re ".*address of sgs is $hex.*\[0-9\]* = 4.*$gdb_prompt $" {
+	      pass "print shr1(g)" 
+	  }
+	  -re ".*$gdb_prompt $" { fail "print shr1(g)" }
+	  timeout               { fail "(timeout) print shr1(g)" }
+      }
   }
 
 #break shr2
@@ -180,19 +192,22 @@
     "Breakpoint.*file.*shr2.c, line.*" \
     "breakpoint function shr2"
 
-gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, shr2 \\(.*\\) at.*shr2\\.c:7.*7.*return 2.x;" \
-"run until breakpoint set at a function"
+gdb_test "continue" \
+	"Continuing\\..*Breakpoint \[0-9\]+, shr2 \\(.*\\) at.*shr2\\.c:7.*7.*return 2.x;" \
+	"run until breakpoint set at a function"
 
 
 #print shr1(1)
-send_gdb "print shr1(1)\n"
-gdb_expect {
-    -re ".*address of sgs is $hex.*\[0-9\]* = 2.*$gdb_prompt $" {
-        pass "print shr1(1)"
-      }
-    -re ".*$gdb_prompt $" { fail "print  shr1(1)" }
-    timeout           { fail "(timeout) print shr1(1)" }
-  }
+if ![gdb_skip_stdio_test "print shr1(1) 2nd time"] {
+    send_gdb "print shr1(1)\n"
+    gdb_expect {
+	-re ".*address of sgs is $hex.*\[0-9\]* = 2.*$gdb_prompt $" {
+	    pass "print shr1(1) 2nd time"
+	}
+	-re ".*$gdb_prompt $" { fail "print shr1(1) 2nd time" }
+	timeout               { fail "(timeout) print shr1(1) 2nd time" }
+    }
+}
 
 #print mainshr1(1)
 send_gdb "print mainshr1(1)\n"
@@ -250,9 +265,17 @@
 # PR's 16495, 18213
 # test that we can re-set breakpoints in shared libraries
 gdb_test "break shr1" "Breakpoint 1.*" "set bp in shared library"
-gdb_test "run" "Starting program:.*Breakpoint 1,.*" "run to bp in shared library"
+
+# FIXME: should not send "run" explicitly.  Non-portable.
+
+gdb_test "run" "Starting program:.*Breakpoint 1,.*" \
+	"run to bp in shared library"
+
 gdb_test "cont" ".*Program exited normally..*"
-gdb_test "run" "Starting program:.*Breakpoint 1,.*" "re-run to bp in shared library (PR's 16495, 18213)"
+
+gdb_test "run" "Starting program:.*Breakpoint 1,.*" \
+	"re-run to bp in shared library (PR's 16495, 18213)"
+
 gdb_test "cont" ".*Program exited normally..*"
 
 return 0
diff --git a/gdb/testsuite/gdb.base/sizeof.c b/gdb/testsuite/gdb.base/sizeof.c
new file mode 100644
index 0000000..51f8c2f
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sizeof.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+int
+main ()
+{
+  printf ("sizeof (char) == %d\n", sizeof (char));
+  printf ("sizeof (short) == %d\n", sizeof (short));
+  printf ("sizeof (int) == %d\n", sizeof (int));
+  printf ("sizeof (long) == %d\n", sizeof (long));
+  printf ("sizeof (long long) == %d\n", sizeof (long long));
+
+  printf ("sizeof (void *) == %d\n", sizeof (void*));
+  printf ("sizeof (void (*)(void)) == %d\n", sizeof (void (*)(void)));
+
+  printf ("sizeof (float) == %d\n", sizeof (float));
+  printf ("sizeof (double) == %d\n", sizeof (double));
+  printf ("sizeof (long double) == %d\n", sizeof (long double));
+  return 0;
+}
diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp
new file mode 100644
index 0000000..b9642fe
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sizeof.exp
@@ -0,0 +1,150 @@
+# Copyright (C) 2000 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.  
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+if $tracelevel {
+    strace $tracelevel
+}
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "sizeof"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if [get_compiler_info ${binfile}] {
+    return -1;
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+#
+# set it up at a breakpoint so we can play with the variable values
+#
+
+if ![runto_main] then {
+    perror "couldn't run to breakpoint"
+    continue
+}
+
+#
+# Query GDB for the size of various types
+#
+
+proc get_sizeof { type default } {
+    global gdb_prompt
+    send_gdb "print/d sizeof (${type})\n"
+    gdb_expect {
+	-re "\\$\[0-9\]* = (\[0-9\]*).*$gdb_prompt $" {
+	    set size $expect_out(1,string)
+	    pass "get sizeof ${type} ($size)"
+	}
+	timeout {
+	    set size ${default}
+	    fail "get sizeof ${type} (timeout)"
+	}
+    }
+    return ${size}
+}
+
+set sizeof_char [get_sizeof "char" 1]
+set sizeof_short [get_sizeof "short" 2]
+set sizeof_int [get_sizeof "int" 4]
+set sizeof_long [get_sizeof "long" 4]
+set sizeof_long_long [get_sizeof "long long" 8]
+
+set sizeof_data_ptr [get_sizeof "void *" 4]
+set sizeof_func_ptr [get_sizeof "void (*)(void)" 4]
+
+set sizeof_float [get_sizeof "float" 4]
+set sizeof_double [get_sizeof "double" 8]
+set sizeof_long_double [get_sizeof "long double" 8]
+
+
+#
+# Compare GDB's idea of types with the running program
+#
+
+proc check_sizeof { type size } {
+    global gdb_prompt
+
+    if [gdb_skip_stdio_test "check sizeof $type == $size"] {
+	return;
+    }
+
+    set pat [string_to_regexp ${type}]
+    send_gdb "next\n"
+    gdb_expect {
+	-re "sizeof \\(${pat}\\) == ${size}\[\r\n\].*$gdb_prompt $" {
+	    pass "check sizeof ${type} == ${size}"
+	}
+	-re ".*$gdb_prompt $" {
+	    fail "check sizeof ${type} == ${size}"
+	}
+	timeout {
+	    fail "check sizeof ${type} == ${size} (timeout)"
+	}
+    }
+}
+
+check_sizeof "char" ${sizeof_char}
+check_sizeof "short" ${sizeof_short}
+check_sizeof "int" ${sizeof_int}
+check_sizeof "long" ${sizeof_long}
+check_sizeof "long long" ${sizeof_long_long}
+
+check_sizeof "void *" ${sizeof_data_ptr}
+check_sizeof "void (*)(void)" ${sizeof_func_ptr}
+
+check_sizeof "float" ${sizeof_float}
+check_sizeof "double" ${sizeof_double}
+check_sizeof "long double" ${sizeof_long_double}
+
+
+#
+# For reference, dump out the entire architecture
+#
+# The output is very long so use a while loop to consume it
+send_gdb "maint print arch\n"
+set ok 1
+while { $ok } {
+    gdb_expect {
+	-re ".*dump" {
+	    #pass "maint print arch $ok"
+	    #set ok [expr $ok + 1]
+	}
+	-re "$gdb_prompt $" {
+	    pass "maint print arch"
+	    set ok 0
+	}
+	timeout {
+	    fail "maint print arch (timeout)"
+	    set ok 0
+	}
+    }
+}
diff --git a/gdb/testsuite/gdb.base/so-impl-ld.exp b/gdb/testsuite/gdb.base/so-impl-ld.exp
index e55cff9..f147337 100644
--- a/gdb/testsuite/gdb.base/so-impl-ld.exp
+++ b/gdb/testsuite/gdb.base/so-impl-ld.exp
@@ -36,7 +36,7 @@
  
 if {! ([istarget "hppa*-*-*hpux*"]
        || [istarget "sparc-sun-solaris*"]
-       || [istarget " *-*-linux-gnu"]) } {
+       || [istarget " *-*-linux-gnu*"]) } {
 	 return
 }
 
diff --git a/gdb/testsuite/gdb.base/varargs.exp b/gdb/testsuite/gdb.base/varargs.exp
index 2fb8f3b..f440f47 100644
--- a/gdb/testsuite/gdb.base/varargs.exp
+++ b/gdb/testsuite/gdb.base/varargs.exp
@@ -69,6 +69,10 @@
 send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
 send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
 
+if [gdb_skip_stdio_test "varargs.exp"] {
+    # Nothing in this module is testable without printf.
+    return;
+}
 
 if ![runto_main] then {
     perror "couldn't run to breakpoint"
diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index 3bd3314..c096306 100644
--- a/gdb/testsuite/gdb.base/watchpoint.exp
+++ b/gdb/testsuite/gdb.base/watchpoint.exp
@@ -63,6 +63,11 @@
     global srcfile
     global wp_set
 
+    # Disable hardware watchpoints if necessary.
+    if [target_info exists gdb,no_hardware_watchpoints] {
+	gdb_test "set can-use-hw-watchpoints 0" "" ""
+    }
+
     if [gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker1" ] { 
       return 0; 
     }
@@ -376,6 +381,7 @@
 	# This doesn't occur if the call dummy starts with a call,
 	# because we are out of the dummy by the first time the inferior
 	# stops.
+	clear_xfail "arm*-*-*"
 	clear_xfail "d10v*-*-*"
 	clear_xfail "m68*-*-*"
 	clear_xfail "i*86*-*-*"
@@ -459,9 +465,9 @@
 proc test_watchpoint_triggered_in_syscall {} {
     global gdb_prompt
 
-    if [target_info exists gdb,noinferiorio] {
-	verbose "Skipping test_watchpoint_triggered_in_syscall due to noinferiorio"
-	return
+    # These tests won't work without printf support.
+    if [gdb_skip_stdio_test "watchpoints triggered in syscall"] {
+	return;
     }
     # Run until we get to the first marker function.
     set x 0
diff --git a/gdb/testsuite/gdb.c++/Makefile.in b/gdb/testsuite/gdb.c++/Makefile.in
index ee8e263..8267259 100644
--- a/gdb/testsuite/gdb.c++/Makefile.in
+++ b/gdb/testsuite/gdb.c++/Makefile.in
@@ -3,7 +3,7 @@
 
 EXECUTABLES = ambiguous annota2 anon-union cplusfuncs cttiadd \
 	derivation inherit local member-ptr method misc \
-        overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace
+        overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace ref-types
 
 all: 
 	@echo "Nothing to be done for all..."
diff --git a/gdb/testsuite/gdb.c++/classes.exp b/gdb/testsuite/gdb.c++/classes.exp
index 3189e5c..9c53976 100644
--- a/gdb/testsuite/gdb.c++/classes.exp
+++ b/gdb/testsuite/gdb.c++/classes.exp
@@ -557,7 +557,7 @@
 # Should give errors.
 #
 
-proc test_nonexistant_members {} {
+proc test_nonexistent_members {} {
     global gdb_prompt
 
     gdb_test "print g_A.y" "There is no member( or method|) named y." "print g_A.y should be error"
@@ -570,6 +570,100 @@
 }
 
 #
+# Call a method that expects a base class parameter with base, inherited,
+# and unrelated class arguments.
+#
+
+proc test_method_param_class {} {
+    gdb_test "call class_param.Aptr_a (&g_A)" ".* = 1" "base class param->a"
+    gdb_test "call class_param.Aptr_x (&g_A)" ".* = 2" "base class param->x"
+    gdb_test "call class_param.Aptr_a (&g_B)" ".* = 3" "inherited class param->a"
+    gdb_test "call class_param.Aptr_x (&g_B)" ".* = 4" "inherited class param->x"
+    gdb_test "call class_param.Aref_a (g_A)" ".* = 1" "base class (&param)->a"
+    gdb_test "call class_param.Aref_x (g_A)" ".* = 2" "base class (&param)->x"
+    gdb_test "call class_param.Aref_a (g_B)" ".* = 3" "inherited class (&param)->a"
+    gdb_test "call class_param.Aref_x (g_B)" ".* = 4" "inherited class (&param)->x"
+    gdb_test "call class_param.Aval_a (g_A)" ".* = 1" "base class param.a"
+    gdb_test "call class_param.Aval_x (g_A)" ".* = 2" "base class param.x"
+    gdb_test "call class_param.Aval_a (g_B)" ".* = 3" "inherited class param.a"
+    gdb_test "call class_param.Aval_x (g_B)" ".* = 4" "inherited class param.x"
+
+    gdb_test "call class_param.Aptr_a (&foo)" "Cannot resolve .*" "unrelated class *param"
+    gdb_test "call class_param.Aref_a (foo)" "Cannot resolve .*" "unrelated class &param"
+    gdb_test "call class_param.Aval_a (foo)" "Cannot resolve .*" "unrelated class param"
+}
+
+#
+# Examine a class with an enum field.
+#
+
+proc test_enums {} {
+    global gdb_prompt
+    global hp_aCC_compiler
+
+    # print the object
+    send_gdb "print obj_with_enum\n"
+    gdb_expect {
+	-re "\\$\[0-9\]* = \\{priv_enum = red, x = 0\\}.*$gdb_prompt $" { pass "print obj_with_enum (1)" }
+	-re "$gdb_prompt $"                     { fail "print obj_with_enum (1)" }
+	timeout                             { fail "(timeout) print obj_with_enum (1)" }
+    }
+
+    send_gdb "next\n"
+    gdb_expect {
+	-re "$gdb_prompt $"                     { pass "next" }
+	timeout                             { fail "(timeout) next" }
+    }
+
+    # print the object again
+    send_gdb "print obj_with_enum\n"
+    gdb_expect {
+	-re "\\$\[0-9\]* = \\{priv_enum = green, x = 0\\}.*$gdb_prompt $" { pass "print obj_with_enum (2)" }
+	-re "$gdb_prompt $"                     { fail "print obj_with_enum (2)" }
+	timeout                             { fail "(timeout) print obj_with_enum (2)" }
+    }
+
+    # print out the enum member
+    send_gdb "print obj_with_enum.priv_enum\n"
+    gdb_expect {
+	-re "\\$\[0-9\]* = green.*$gdb_prompt $" { pass "print obj_with_enum.priv_enum" }
+	-re "$gdb_prompt $"                     { fail "print obj_with_enum.priv_enum" }
+	timeout                             { fail "(timeout) print obj_with_enum.priv_enum" }
+    }
+
+    # ptype on the enum member
+    # The third success case is a little dubious, but it's not clear what
+    # ought to be required of a ptype on a private enum... -sts 19990324
+    send_gdb "ptype obj_with_enum.priv_enum\n"
+    gdb_expect {
+	-re "type = enum ClassWithEnum::PrivEnum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" }
+	-re "type = enum PrivEnum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" }
+	-re "type = enum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" }
+	-re "$gdb_prompt $"                     { fail "ptype obj_with_enum.priv_enum" }
+	timeout                             { fail "(timeout) ptype obj_with_enum.priv_enum" }
+    }
+
+    # ptype on the object
+    # g++ is putting out the wrong debug info.  This works with aCC
+    if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
+    send_gdb "ptype obj_with_enum\n"
+    gdb_expect {
+	-re "type = class ClassWithEnum \\{\r\n\[ \t\]*public:\r\n\[ \t\]*(enum |)ClassWithEnum::PrivEnum priv_enum;\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { pass "ptype obj_with_enum" }
+	-re "$gdb_prompt $"                     { fail "ptype obj_with_enum" }
+	timeout                             { fail "(timeout) ptype obj_with_enum" }
+    }
+
+    # g++ is putting out the wrong debug info.  This works with aCC
+    if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
+    send_gdb "print (ClassWithEnum::PrivEnum) 42\n"
+    gdb_expect {
+	-re "\\$\[0-9\]* = yellow.*$gdb_prompt $" { pass "print (ClassWithEnum::PrivEnum) 42" }
+	-re "$gdb_prompt $"                     { fail "print (ClassWithEnum::PrivEnum) 42" }
+	timeout                             { fail "(timeout) print (ClassWithEnum::PrivEnum) 42" }
+    }
+}
+
+#
 # Pointers to class members
 #
 
@@ -735,7 +829,14 @@
     if [ runto 'inheritance2(void)' ] then {
 	test_non_inherited_member_access
 	test_wrong_class_members
-	test_nonexistant_members
+	test_nonexistent_members
+	test_method_param_class
+    }
+
+    gdb_breakpoint enums2
+    if [ gdb_continue enums2 ]==0 then {
+	gdb_test "finish" "" ""
+	test_enums
     }
 
     if [istarget "mips-idt-*"] then {
@@ -758,7 +859,7 @@
 	gdb_reinitialize_dir $srcdir/$subdir
 	gdb_load $binfile
     }
- 
+
     if [ runto marker_reg1 ] then {
 
 	gdb_test "finish" "Run till exit from.*" "finish from marker_reg1"
@@ -782,90 +883,9 @@
 
 do_tests
 
-
-# Some additional tests for enums inside classes
-
-
-# set a breakpoint and go there
-send_gdb "break 516\n"   
-gdb_expect {   
-   -re "Breakpoint \[0-9\] at.*$gdb_prompt $" { pass "set break 516" }
-   -re "$gdb_prompt $"                     { fail "set break 516" }
-   timeout                             { fail "(timeout) set break 516" }
-}
-send_gdb "continue\n"   
-gdb_expect {   
-   -re "Continuing\\.\r\n\r\nBreakpoint \[0-9\]*, main....at.*misc\\.cc:516\r\n516.*\r\n$gdb_prompt $" { pass "continue" }
-   -re "$gdb_prompt $"                     { fail "continue" }
-   timeout                             { fail "(timeout) continue" }
-}
-
-# print the object
-send_gdb "print obj_with_enum\n"   
-gdb_expect {   
-   -re "\\$\[0-9\]* = \\{priv_enum = red, x = 0\\}.*$gdb_prompt $" { pass "print obj_with_enum (1)" }
-   -re "$gdb_prompt $"                     { fail "print obj_with_enum (1)" }
-   timeout                             { fail "(timeout) print obj_with_enum (1)" }
-}
-
-send_gdb "next\n"   
-gdb_expect {   
-   -re "$gdb_prompt $"                     { pass "next" }
-   timeout                             { fail "(timeout) next" }
-}
-
-# print the object again
-send_gdb "print obj_with_enum\n"   
-gdb_expect {   
-   -re "\\$\[0-9\]* = \\{priv_enum = green, x = 0\\}.*$gdb_prompt $" { pass "print obj_with_enum (2)" }
-   -re "$gdb_prompt $"                     { fail "print obj_with_enum (2)" }
-   timeout                             { fail "(timeout) print obj_with_enum (2)" }
-}
-
-# print out the enum member
-send_gdb "print obj_with_enum.priv_enum\n"   
-gdb_expect {   
-   -re "\\$\[0-9\]* = green.*$gdb_prompt $" { pass "print obj_with_enum.priv_enum" }
-   -re "$gdb_prompt $"                     { fail "print obj_with_enum.priv_enum" }
-   timeout                             { fail "(timeout) print obj_with_enum.priv_enum" }
-}
-
-# ptype on the enum member
-# The third success case is a little dubious, but it's not clear what
-# ought to be required of a ptype on a private enum... -sts 19990324
-send_gdb "ptype obj_with_enum.priv_enum\n"   
-gdb_expect {   
-   -re "type = enum ClassWithEnum::PrivEnum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" }
-   -re "type = enum PrivEnum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" }
-   -re "type = enum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" }
-   -re "$gdb_prompt $"                     { fail "ptype obj_with_enum.priv_enum" }
-   timeout                             { fail "(timeout) ptype obj_with_enum.priv_enum" }
-}
-
-# ptype on the object
-# g++ is putting out the wrong debug info.  This works with aCC
-if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
-send_gdb "ptype obj_with_enum\n"   
-gdb_expect {   
-   -re "type = class ClassWithEnum \\{\r\n\[ \t\]*public:\r\n\[ \t\]*(enum |)ClassWithEnum::PrivEnum priv_enum;\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { pass "ptype obj_with_enum" }
-   -re "$gdb_prompt $"                     { fail "ptype obj_with_enum" }
-   timeout                             { fail "(timeout) ptype obj_with_enum" }
-}
-
-# g++ is putting out the wrong debug info.  This works with aCC
-if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
-send_gdb "print (ClassWithEnum::PrivEnum) 42\n"   
-gdb_expect {   
-   -re "\\$\[0-9\]* = yellow.*$gdb_prompt $" { pass "print (ClassWithEnum::PrivEnum) 42" }
-   -re "$gdb_prompt $"                     { fail "print (ClassWithEnum::PrivEnum) 42" }
-   timeout                             { fail "(timeout) print (ClassWithEnum::PrivEnum) 42" }
-}
-
-
 send_gdb "maint demangle inheritance1__Fv\n"
 gdb_expect {
    -re "inheritance1\\(void\\).*$gdb_prompt $" { pass "demangle" }
    -re ".*$gdb_prompt $"   { fail "demangle" }
    timeout           { fail "(timeout) demangle" }
 }
-
diff --git a/gdb/testsuite/gdb.c++/ctti.exp b/gdb/testsuite/gdb.c++/ctti.exp
index fb16b22..b8c7cc9 100644
--- a/gdb/testsuite/gdb.c++/ctti.exp
+++ b/gdb/testsuite/gdb.c++/ctti.exp
@@ -1,4 +1,4 @@
-`# Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -29,7 +29,10 @@
         strace $tracelevel
 }
 
-if { [skip_cplus_tests] } { continue }
+
+# Check to see if we have an executable to test.  If not, then either we
+# haven't tried to compile one, or the compilation failed for some reason.
+# In either case, just notify the user and skip the tests in this file.
 
 set testfile "cttiadd"
 set srcfile  ${testfile}.cc
@@ -42,14 +45,15 @@
     return -1;
 }
 
+if { $gcc_compiled } then { continue }
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3}" "${binfile}" executable {debug c++}] != "" } {
-     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
-}
+#if  { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3}" "${binfile}" executable {debug c++}] != "" } {
+#     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+#}
 
-#set cmdline "$CXX_FOR_TARGET ${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3} -g -o ${binfile}"
+set cmdline "$CXX_FOR_TARGET ${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3} -g -o ${binfile}"
 
-#remote_exec build $cmdline
+remote_exec build $cmdline
 
 gdb_exit
 gdb_start
diff --git a/gdb/testsuite/gdb.c++/derivation.exp b/gdb/testsuite/gdb.c++/derivation.exp
index 0185ce6..454f236 100644
--- a/gdb/testsuite/gdb.c++/derivation.exp
+++ b/gdb/testsuite/gdb.c++/derivation.exp
@@ -76,8 +76,13 @@
         -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
             send_gdb "up\n"
             gdb_expect {
-                -re ".*$gdb_prompt $" {}
-                timeout { fail "up from marker1" }
+                -re ".*main.*$gdb_prompt $" {
+		    pass "up from marker1"
+		}
+                -re ".*$gdb_prompt $" {
+		    fail "up from marker1"
+		}
+                timeout { fail "up from marker1 (timeout)" }
             }
         }
         -re "$gdb_prompt $" { fail "continue to marker1"  }
diff --git a/gdb/testsuite/gdb.c++/local.exp b/gdb/testsuite/gdb.c++/local.exp
index 3730ae9..22b277b 100644
--- a/gdb/testsuite/gdb.c++/local.exp
+++ b/gdb/testsuite/gdb.c++/local.exp
@@ -68,8 +68,13 @@
         -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
             send_gdb "up\n"
             gdb_expect {
-                -re ".*$gdb_prompt $" {}
-                timeout { fail "up from marker1" }
+                -re ".*main.*$gdb_prompt $" {
+		    pass "up from marker1"
+		}
+                -re ".*$gdb_prompt $" {
+		    fail "up from marker1"
+		}
+                timeout { fail "up from marker1 (timeout)" }
             }
         }
         -re "$gdb_prompt $" { fail "continue to marker1"  }
@@ -130,6 +135,15 @@
     timeout             { fail "(timeout) ptype NestedInnerLocal" }
 }     
 
+# srikanth, These tests have always been run only with aCC. Now in
+# the new scheme of things, we run it twice, once with aCC, and once
+# with g++. Flag these tests as expected failures when run with g++.
+# as these are failing now and were never known to pass with g++.
+global gcc_compiled
+if {$gcc_compiled} then  {
+setup_xfail "*-*-*"
+}
+
 # gdb incorrectly interprets the NestedInnerLocal in
 # InnerLocal::NestedInnerLocal as field name instead of a type name;
 # See CLLbs14784.
diff --git a/gdb/testsuite/gdb.c++/misc.cc b/gdb/testsuite/gdb.c++/misc.cc
index 3090800..caa5451 100644
--- a/gdb/testsuite/gdb.c++/misc.cc
+++ b/gdb/testsuite/gdb.c++/misc.cc
@@ -393,13 +393,6 @@
   Bar (int i, int j, int k) : Base1 (10*k), Foo (i, j) { z = k; }
 };
 
-class ClassWithEnum {
-public:
-  enum PrivEnum { red, green, blue, yellow = 42 };
-  PrivEnum priv_enum;
-  int x;
-};
-
 int Foo::operator! () { return !x; }
 
 int Foo::times (int y) { return x * y; }
@@ -411,6 +404,41 @@
 Foo foo(10, 11);
 Bar bar(20, 21, 22);
 
+class ClassWithEnum {
+public:
+  enum PrivEnum { red, green, blue, yellow = 42 };
+  PrivEnum priv_enum;
+  int x;
+};
+
+void enums2 (void)
+{
+}
+
+/* classes.exp relies on statement order in this function for testing
+   enumeration fields.  */
+
+void enums1 ()
+{
+  ClassWithEnum obj_with_enum;
+  obj_with_enum.priv_enum = ClassWithEnum::red;
+  obj_with_enum.x = 0;
+  enums2 ();
+  obj_with_enum.priv_enum = ClassWithEnum::green;
+}
+
+class ClassParam {
+public:
+  int Aptr_a (A *a) { return a->a; }
+  int Aptr_x (A *a) { return a->x; }
+  int Aref_a (A &a) { return a.a; }
+  int Aref_x (A &a) { return a.x; }
+  int Aval_a (A a) { return a.a; }
+  int Aval_x (A a) { return a.x; }
+};
+
+ClassParam class_param;
+
 class Contains_static_instance
 {
  public:
@@ -498,6 +526,18 @@
   v_bool_array[1] = v_bool;
 }
 
+void use_methods ()
+{
+  /* Refer to methods so that they don't get optimized away. */
+  int i;
+  i = class_param.Aptr_a (&g_A);
+  i = class_param.Aptr_x (&g_A);
+  i = class_param.Aref_a (g_A);
+  i = class_param.Aref_x (g_A);
+  i = class_param.Aval_a (g_A);
+  i = class_param.Aval_x (g_A);
+}
+
 
 int
 main()
@@ -509,6 +549,7 @@
   dummy();
   inheritance1 ();
   inheritance3 ();
+  enums1 ();
   register_class ();
 
   /* FIXME: pmi gets optimized out.  Need to do some more computation with
@@ -519,11 +560,7 @@
   /* Make sure the AIX linker doesn't remove the variable.  */
   v_tagless.one = 5;
 
-  /* Class with enumeration inside it */ 
-  ClassWithEnum obj_with_enum;
-  obj_with_enum.priv_enum = ClassWithEnum::red;
-  obj_with_enum.x = 0;
-  obj_with_enum.priv_enum = ClassWithEnum::green;
+  use_methods ();
 
   return foo.*pmi;
 }
diff --git a/gdb/testsuite/gdb.hp/gdb.aCC/namespace.cc b/gdb/testsuite/gdb.c++/namespace.cc
similarity index 100%
rename from gdb/testsuite/gdb.hp/gdb.aCC/namespace.cc
rename to gdb/testsuite/gdb.c++/namespace.cc
diff --git a/gdb/testsuite/gdb.c++/namespace.exp b/gdb/testsuite/gdb.c++/namespace.exp
index 9298c90..acdffa1 100644
--- a/gdb/testsuite/gdb.c++/namespace.exp
+++ b/gdb/testsuite/gdb.c++/namespace.exp
@@ -73,8 +73,9 @@
         -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
             send_gdb "up\n"
             gdb_expect {
-                -re ".*$gdb_prompt $" { pass "up from marker1" }
-                timeout { fail "up from marker1" }
+                -re ".*main.*$gdb_prompt $" { pass "up from marker1" }
+                -re ".*$gdb_prompt $"       { fail "up from marker1" }
+                timeout { fail "up from marker1 (timeout)" }
             }
         }
         -re "$gdb_prompt $" { fail "continue to marker1"  }
diff --git a/gdb/testsuite/gdb.c++/overload.exp b/gdb/testsuite/gdb.c++/overload.exp
index e889273..1f35402 100644
--- a/gdb/testsuite/gdb.c++/overload.exp
+++ b/gdb/testsuite/gdb.c++/overload.exp
@@ -68,8 +68,13 @@
         -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
             send_gdb "up\n"
             gdb_expect {
-                -re ".*$gdb_prompt $" {}
-                timeout { fail "up from marker1" }
+                -re ".*main.*$gdb_prompt $" {
+		    pass "up from marker1"
+		}
+                -re ".*$gdb_prompt $" {
+		    fail "up from marker1"
+		}
+                timeout { fail "up from marker1 (timeout)" }
             }
         }
         -re "$gdb_prompt $" { fail "continue to marker1"  }
diff --git a/gdb/testsuite/gdb.c++/ovldbreak.exp b/gdb/testsuite/gdb.c++/ovldbreak.exp
index 2513b5f..97271d3 100644
--- a/gdb/testsuite/gdb.c++/ovldbreak.exp
+++ b/gdb/testsuite/gdb.c++/ovldbreak.exp
@@ -456,16 +456,16 @@
 -re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
             send_gdb "0\n"
             gdb_expect {
-               -re "cancelled\r\n$gdb_prompt $" {
-                       pass "set bp cancelled" }
+               -re "canceled\r\n$gdb_prompt $" {
+                       pass "set bp canceled" }
                -re ".*$gdb_prompt $" {
-                       fail "set bp cancelled  wrong bp reply" }
+                       fail "set bp canceled  wrong bp reply" }
                timeout           {
-                       fail "(timeout)set bp cancelled wrong bp reply" }
+                       fail "(timeout)set bp canceled wrong bp reply" }
              }
          }
-    -re ".*$gdb_prompt $" { fail "set bp cancelled(wrong menu)" }
-    timeout           { fail "(timeout)set bp cancelled(wrong menu)" }
+    -re ".*$gdb_prompt $" { fail "set bp canceled(wrong menu)" }
+    timeout           { fail "(timeout)set bp canceled(wrong menu)" }
   }
 
 
diff --git a/gdb/testsuite/gdb.c++/ref-types.exp b/gdb/testsuite/gdb.c++/ref-types.exp
index a528fd64..e1d654e 100644
--- a/gdb/testsuite/gdb.c++/ref-types.exp
+++ b/gdb/testsuite/gdb.c++/ref-types.exp
@@ -61,8 +61,13 @@
         -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
             send_gdb "up\n"
             gdb_expect {
-                -re ".*$gdb_prompt $" {}
-                timeout { fail "up from marker1" }
+                -re ".*main.*$gdb_prompt $" {
+		    pass "up from marker1"
+		}
+                -re ".*$gdb_prompt $" {
+		    fail "up from marker1"
+		}
+                timeout { fail "up from marker1 (timeout)" }
             }
         }
         -re "$gdb_prompt $" { fail "continue to marker1"  }
@@ -98,8 +103,13 @@
         -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
             send_gdb "up\n"
             gdb_expect {
-                -re ".*$gdb_prompt $" {}
-                timeout { fail "up from marker1" }
+                -re ".*main.*$gdb_prompt $" {
+		    pass "up from marker1"
+		}
+                -re ".*$gdb_prompt $" {
+		    fail "up from marker1"
+		}
+                timeout { fail "up from marker1 (timeout)" }
             }
         }
         -re "$gdb_prompt $" { fail "continue to marker1"  }
@@ -287,8 +297,13 @@
         -re "Break.* f \\(\\) at .*:$decimal.*$gdb_prompt $" {
             send_gdb "up\n"
             gdb_expect {
-                -re ".*$gdb_prompt $" {}
-                timeout { fail "up from f" }
+                -re ".*main2.*$gdb_prompt $" {
+		    pass "up from f" 
+		}
+                -re ".*$gdb_prompt $" {
+		    fail "up from f" 
+		}
+                timeout { fail "up from f (timeout)" }
             }
         }
         -re "$gdb_prompt $" { fail "continue to f"  }
diff --git a/gdb/testsuite/gdb.c++/templates.exp b/gdb/testsuite/gdb.c++/templates.exp
index 91acc82..d0ee96d 100644
--- a/gdb/testsuite/gdb.c++/templates.exp
+++ b/gdb/testsuite/gdb.c++/templates.exp
@@ -105,12 +105,12 @@
     gdb_expect {
 	-re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. T5<int>::T5\\(int\\) at .*\[\r\n\]*.3. T5<int>::T5\\(T5<int> const &\\) at .*\[\r\n\]*> $" {
 	    gdb_test "0" \
-		"cancelled" \
+		"canceled" \
 		"constructor breakpoint (obsolete format!)"
 	}
 	-re ".0. cancel\[\r\n\]*.1. all\[\r\n\]*.2. T5<int>::T5\\(T5<int> const &\\) at .*templates.cc:.*\[\r\n\]*.3. T5<int>::T5\\(int\\) at .*templates.cc:.*\[\r\n\]*> $" {
 	    gdb_test "0" \
-		"cancelled" \
+		"canceled" \
 		"constructor breakpoint"
 	}
 	-re ".*$gdb_prompt $" { fail "constructor breakpoint" }
diff --git a/gdb/testsuite/gdb.hp/gdb.aCC/namespace.exp b/gdb/testsuite/gdb.hp/gdb.aCC/namespace.exp
deleted file mode 100644
index 8fc1925..0000000
--- a/gdb/testsuite/gdb.hp/gdb.aCC/namespace.exp
+++ /dev/null
@@ -1,193 +0,0 @@
-# Copyright (C) 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 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.  
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
-# tests for namespaces
-# Written by Satish Pai <pai@apollo.hp.com> 1997-07-23
-
-# This file is part of the gdb testsuite
-
-# Note: These tests are geared to the HP aCC compiler,
-# which has an idiosyncratic way of emitting debug info
-# for namespaces.
-
-
-if $tracelevel then {
-        strace $tracelevel
-        }
-
-set prms_id 0
-set bug_id 0
-
-if { [skip_hp_tests] } then { continue }
-
-set testfile "namespace"
-set srcfile ${testfile}.cc
-set binfile ${objdir}/${subdir}/${testfile}
-
-if [get_compiler_info ${binfile}] {
-    return -1;
-}
-
-if { $gcc_compiled } then { continue }
-if {[skip_hp_tests]} then { continue }
-
-
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
-     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will a
-utomatically fail."
-}
-
-
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
-
-#
-# set it up at a breakpoint so we can play with the variable values
-#
-if ![runto_main] then {
-    perror "couldn't run to breakpoint"
-    continue
-}
-
-send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
-    send_gdb "cont\n"
-    gdb_expect {
-        -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
-            send_gdb "up\n"
-            gdb_expect {
-                -re ".*$gdb_prompt $" { pass "up from marker1" }
-                timeout { fail "up from marker1" }
-            }
-        }
-        -re "$gdb_prompt $" { fail "continue to marker1"  }
-        timeout { fail "(timeout) continue to marker1"  }
-    }
-
-# Access a data item inside a namespace using colons and
-# single quotes :-(
-
-send_gdb "print 'AAA::c'\n"
-gdb_expect {
-   -re "\\$\[0-9\]* = 0 '\\\\000'\r\n$gdb_prompt $" { pass "print 'AAA::c'" }
-   -re ".*$gdb_prompt $" { fail "print 'AAA::c'" }
-   timeout { fail "(timeout) print 'AAA::c'" }
-}
-
-# An object declared using "using".
-
-send_gdb "print ina\n"
-gdb_expect {
-   -re "\\$\[0-9\]+ = {xx = 33}.*$gdb_prompt $" {
-      pass "print ina"
-   }
-   -re ".*$gdb_prompt $" { fail "print ina" }
-   timeout { fail "(timeout) print ina" }
-}
-
-send_gdb "ptype ina\n"
-gdb_expect {
-   -re "type = class AAA::inA \{\r\n\[ \]*public:\r\n\[ \]*int xx;\r\n\[ \]*\r\n\[ \]*int fum\\(int\\);\r\n\}\r\n$gdb_prompt $" {
-       pass "ptype ina"
-   }
-   -re ".*$gdb_prompt $" { fail "ptype ina" }
-   timeout { fail "(timeout) ptype ina" }
-}
-
-# Check all functions are known to GDB
-
-setup_xfail hppa*-*-*11* CLLbs14869
-send_gdb "info func xyzq\n"
-gdb_expect {
-   -re "All functions.*File.*namespace.cc:\r\nint AAA::A_xyzq\\(int\\);\r\nint BBB::B_xyzq\\(int\\);\r\nchar AAA::xyzq\\(char\\);\r\nchar BBB::xyzq\\(char\\);\r\nchar BBB::CCC::xyzq\\(char\\);\r\nchar BBB::Class::xyzq\\(char\\);\r\n$gdb_prompt $" {
-       pass "info func xyzq"
-   }    
-   -re ".*$gdb_prompt $" { fail "info func xyzq" }
-   timeout { fail "(timeout) info func xyzq" }
-}
-
-# Call a function in a namespace
-
-send_gdb "print 'AAA::xyzq'('x')\n"
-gdb_expect {
-   -re "\\$\[0-9\]* = 97 'a'\r\n$gdb_prompt $" {
-       pass "print 'AAA::xyzq'('x')"
-   }
-   -re ".*$gdb_prompt $" { fail "print 'AAA::xyzq'('x')" }
-   timeout { fail "(timeout) print 'AAA::xyzq'('x')" }
-}
-       
-# Break on a function in a namespace
-
-send_gdb "break AAA::xyzq\n"
-gdb_expect {
-    -re "Breakpoint.*at $hex: file.*namespace.cc, line 42\\.\r\n$gdb_prompt $" {
-         pass "break AAA::xyzq"
-    }    
-   -re ".*$gdb_prompt $" { fail "break AAA::xyzq" }
-   timeout { fail "(timeout) break AAA::xyzq" }
-}
-
-# Call a function in a nested namespace
-
-send_gdb "print 'BBB::CCC::xyzq'('x')\n"
-gdb_expect {
-   -re "\\$\[0-9\]* = 122 'z'\r\n$gdb_prompt $" {
-       pass "print 'BBB::CCC::xyzq'('x')"
-   }
-   -re ".*$gdb_prompt $" { fail "print 'BBB::CCC::xyzq'('x')" }
-   timeout { fail "(timeout) print 'BBB::CCC::xyzq'('x')" }
-}
-       
-# Break on a function in a nested namespace
-
-send_gdb "break BBB::CCC::xyzq\n"
-gdb_expect {
-    -re "Breakpoint.*at $hex: file.*namespace.cc, line 58\\.\r\n$gdb_prompt $" {
-         pass "break BBB::CCC::xyzq"
-    }    
-   -re ".*$gdb_prompt $" { fail "break BBB::CCC::xyzq" }
-   timeout { fail "(timeout) break BBB::CCC::xyzq" }
-}
-
-# Print address of a function in a class in a namespace
-
-send_gdb "print 'BBB::Class'::xyzq\n"
-gdb_expect {
-   -re "\\$\[0-9\]* = \{char \\(BBB::Class \\*, char\\)\} $hex <BBB::Class::xyzq\\(char\\)>\r\n$gdb_prompt $" {
-       pass "print 'BBB::Class'::xyzq"
-   }
-   -re ".*$gdb_prompt $" { fail "print 'BBB::Class'::xyzq" }
-   timeout { fail "(timeout) print 'BBB::Class'::xyzq" }
-}
-
-# Break on a function in a class in a namespace
-
-send_gdb "break BBB::Class::xyzq\n"
-gdb_expect {
-    -re "Breakpoint.*at $hex: file.*namespace.cc, line 63\\.\r\n$gdb_prompt $" {
-         pass "break BBB::Class::xyzq"
-    }    
-   -re ".*$gdb_prompt $" { fail "break BBB::Class::xyzq" }
-   timeout { fail "(timeout) break BBB::Class::xyzq" }
-}
-
diff --git a/gdb/testsuite/gdb.java/Makefile.in b/gdb/testsuite/gdb.java/Makefile.in
new file mode 100644
index 0000000..0954369
--- /dev/null
+++ b/gdb/testsuite/gdb.java/Makefile.in
@@ -0,0 +1,26 @@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+all: 
+	@echo "Nothing to be done for all..."
+
+#### host, target, and site specific Makefile frags come in here.
+
+.SUFFIXES: .java .class .o .exe .exp .check
+
+# Do 'make javamisc.check' to run just the javamisc.exp test.
+
+.exp.check:
+	rootme=`pwd`/; export rootme; \
+	cd .. ; \
+	$(MAKE) just-check RUNTESTFLAGS="${RUNTESTFLAGS} $*.exp" \
+	  EXPECT=${EXPECT}
+
+clean mostlyclean:
+	-rm -f *.o ${OBJS}  *.class *.exe *~ core
+
+distclean maintainer-clean realclean: clean
+	-rm -f Makefile config.status config.log
+
+Makefile: $(srcdir)/Makefile.in $(srcdir)/configure.in
+	$(SHELL) ./config.status --recheck
diff --git a/gdb/testsuite/gdb.java/configure b/gdb/testsuite/gdb.java/configure
new file mode 100755
index 0000000..6a41791
--- /dev/null
+++ b/gdb/testsuite/gdb.java/configure
@@ -0,0 +1,913 @@
+#! /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=jmisc.exp
+
+# 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
+
+
+
+CC=${CC-cc}
+
+ac_aux_dir=
+for ac_dir in `cd $srcdir;pwd`/../../.. $srcdir/`cd $srcdir;pwd`/../../..; 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 `cd $srcdir;pwd`/../../.. $srcdir/`cd $srcdir;pwd`/../../.." 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.
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+#    configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+#    same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+#    as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# 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:586: 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 target system type""... $ac_c" 1>&6
+echo "configure:607: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+  case $nonopt in
+  NONE) target_alias=$host_alias ;;
+  *) target_alias=$nonopt ;;
+  esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:625: 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
+
+test "$host_alias" != "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+
+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
+
+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%@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%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_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
+
+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
+
+
+  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
+" $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/gdb/testsuite/gdb.java/configure.in b/gdb/testsuite/gdb.java/configure.in
new file mode 100644
index 0000000..12fd4c7
--- /dev/null
+++ b/gdb/testsuite/gdb.java/configure.in
@@ -0,0 +1,11 @@
+dnl Process this file file with autoconf to produce a configure script.
+
+AC_PREREQ(2.5)
+AC_INIT(jmisc.exp)
+
+CC=${CC-cc}
+AC_SUBST(CC)
+AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../../..)
+AC_CANONICAL_SYSTEM
+
+AC_OUTPUT(Makefile)
diff --git a/gdb/testsuite/gdb.java/jmisc.exp b/gdb/testsuite/gdb.java/jmisc.exp
new file mode 100644
index 0000000..f603fcf
--- /dev/null
+++ b/gdb/testsuite/gdb.java/jmisc.exp
@@ -0,0 +1,91 @@
+# Copyright (C) 2000 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.  
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file was written by Anthony Green. (green@redhat.com)
+#
+
+if $tracelevel then {
+	strace $tracelevel
+}
+
+load_lib "java.exp"
+
+set testfile "jmisc"
+set srcfile ${srcdir}/$subdir/${testfile}.java
+set binfile ${objdir}/${subdir}/${testfile}
+if  { [compile_java_from_source ${srcfile} ${binfile} "-g"] != "" } {
+    untested "Couldn't compile ${srcfile}"
+    return -1
+}
+
+# Set the current language to java.  This counts as a test.  If it
+# fails, then we skip the other tests.
+
+proc set_lang_java {} {
+    global gdb_prompt
+    global binfile objdir subdir
+
+    verbose "loading file '$binfile'"
+    gdb_load $binfile
+
+    send_gdb "set language java\n"
+    gdb_expect {
+	-re ".*$gdb_prompt $" {}
+	timeout { fail "set language java (timeout)" ; return 0 }
+    }
+
+    return [gdb_test "show language" ".* source language is \"java\".*" \
+	"set language to \"java\""]
+}
+
+set prms_id 0
+set bug_id 0
+
+# Start with a fresh gdb.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+gdb_test "set print sevenbit-strings" ".*"
+
+if ![set_lang_java] then {
+    runto ${testfile}.main
+
+    send_gdb "ptype jmisc\n"   
+    gdb_expect {   
+	-re "type = class jmisc  extends java.lang.Object \{\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+void <init>\\(void\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $"               { pass "ptype jmisc" }
+	-re ".*$gdb_prompt $"             { fail "ptype jmisc" }
+	timeout { fail "ptype jmisc (timeout)" ; return }
+    }
+
+    send_gdb "p args\n"
+    gdb_expect {   
+	-re "\\\$1 = java\.lang\.String\\\[]@\[a-f0-9]+\[\r\n\ \t]+$gdb_prompt $"                                        { pass "p args" }
+	-re ".*$gdb_prompt $"             { fail "p args" }
+	timeout { fail "p args (timeout)" ; return }
+    }
+
+    send_gdb "p *args\n"
+    gdb_expect {   
+	-re "\\\$2 = \{length: 0\}\[\r\n\ \t]+$gdb_prompt $"                                                             { pass "p *args" }
+	-re ".*$gdb_prompt $"             { fail "p *args" }
+	timeout { fail "p *args (timeout)" ; return }
+    }
+}
diff --git a/gdb/testsuite/gdb.java/jmisc.java b/gdb/testsuite/gdb.java/jmisc.java
new file mode 100644
index 0000000..a11ba54
--- /dev/null
+++ b/gdb/testsuite/gdb.java/jmisc.java
@@ -0,0 +1,7 @@
+public class jmisc
+{
+  public static void main (String[] args)
+  {
+    return;
+  }
+}
diff --git a/gdb/testsuite/gdb.java/jv-exp.exp b/gdb/testsuite/gdb.java/jv-exp.exp
new file mode 100644
index 0000000..3a54e50
--- /dev/null
+++ b/gdb/testsuite/gdb.java/jv-exp.exp
@@ -0,0 +1,66 @@
+# Copyright (C) 2000 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.  
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# Set the current language to Java.  This counts as a test.  If it
+# fails, then we skip the other tests.
+
+proc set_lang_java {} {
+    global gdb_prompt
+
+    if [gdb_test "set language java" "" "set language java"] {
+	return 0
+    }
+
+    if [gdb_test "show language" ".* source language is \"java\".*"] {
+	return 0
+    }
+    return 1;
+}
+
+proc test_comparisons {} {
+    global gdb_prompt
+
+    # Test various comparisons.
+
+    gdb_test "p 1 > 2" " = false"
+    gdb_test "p 1 < 2" " = true"
+}
+
+# Start with a fresh gdb.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+gdb_test "set print sevenbit-strings" ""
+gdb_test "set print address off" "" ""
+gdb_test "set width 0" ""
+
+if [set_lang_java] then {
+    test_comparisons
+} else {
+    fail "Java expression tests suppressed"
+}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 191bf18..12c631a 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -63,6 +63,16 @@
     set gdb_prompt "\[(\]gdb\[)\]"
 }
 
+# Needed for some tests under Cygwin.
+global EXEEXT
+global env
+
+if ![info exists env(EXEEXT)] {
+    set EXEEXT ""
+} else {
+    set EXEEXT $env(EXEEXT)
+}
+
 ### Only procedures should come after this point.
 
 #
@@ -447,14 +457,18 @@
 	}
     }
 
-    if [info exists timeout] {
-	set tmt $timeout;
+    if [target_info exists gdb,timeout] {
+	set tmt [target_info gdb,timeout];
     } else {
-	global timeout;
 	if [info exists timeout] {
 	    set tmt $timeout;
 	} else {
-	    set tmt 60;
+	    global timeout;
+	    if [info exists timeout] {
+		set tmt $timeout;
+	    } else {
+		set tmt 60;
+	    }
 	}
     }
     gdb_expect $tmt {
@@ -1687,3 +1701,30 @@
     }
   }
 }
+
+# Print a message and return true if a test should be skipped
+# due to lack of floating point suport.
+
+proc gdb_skip_float_test { msg } {
+    if [target_info exists gdb,skip_float_tests] {
+	verbose "Skipping test '$msg': no float tests.";
+	return 1;
+    }
+    return 0;
+}
+
+# Print a message and return true if a test should be skipped
+# due to lack of stdio support.
+
+proc gdb_skip_stdio_test { msg } {
+    if [target_info exists gdb,noinferiorio] {
+	verbose "Skipping test '$msg': no inferior i/o.";
+	return 1;
+    }
+    return 0;
+}
+
+proc gdb_skip_bogus_test { msg } {
+    return 0;
+}
+
diff --git a/gdb/testsuite/lib/java.exp b/gdb/testsuite/lib/java.exp
new file mode 100644
index 0000000..bcfd27c
--- /dev/null
+++ b/gdb/testsuite/lib/java.exp
@@ -0,0 +1,105 @@
+# Copyright (C) 1998, 1999 Red Hat, Inc.
+
+load_lib "libgloss.exp"
+
+# GCJ_UNDER_TEST is the compiler under test.
+
+global tmpdir
+
+if ![info exists tmpdir] {
+    set tmpdir "/tmp"
+}
+
+set java_initialized 0
+
+#
+# Build the status wrapper library as needed.
+#
+proc java_init { args } {
+    global wrapper_file;
+    global wrap_compile_flags;
+    global java_initialized
+    global GCJ_UNDER_TEST
+    global TOOL_EXECUTABLE
+    global env
+
+    if { $java_initialized == 1 } { return; }
+
+    if ![info exists GCJ_UNDER_TEST] {
+	if [info exists TOOL_EXECUTABLE] {
+	    set GCJ_UNDER_TEST $TOOL_EXECUTABLE;
+	} else {
+	    if [info exists env(GCJ)] {
+		set GCJ_UNDER_TEST $env(GCJ)
+	    } else {
+		global tool_root_dir
+		
+		if ![is_remote host] {
+		    set file [lookfor_file $tool_root_dir gcj];
+		    if { $file == "" } {
+			set file [lookfor_file $tool_root_dir gcc/gcj];
+		    }
+		    if { $file != "" } {
+			set CC "$file -B[file dirname $file]/ --specs=$tool_root_dir/$target_alias/libjava/libgcj-test.spec";
+		    } else {
+			set CC [transform gcj];
+		    }
+		} else {
+		    set CC [transform gcj]
+		}
+		set GCJ_UNDER_TEST $CC
+	    }
+	}
+    }
+
+    set wrapper_file "";
+    set wrap_compile_flags "";
+    if [target_info exists needs_status_wrapper] {
+	set result [build_wrapper "testglue.o"];
+	if { $result != "" } {
+	    set wrapper_file [lindex $result 0];
+	    set wrap_compile_flags [lindex $result 1];
+	} else {
+	    warning "Status wrapper failed to build."
+	}
+    }
+
+    set java_initialized 1
+}
+
+#
+# Run the test specified by srcfile and resultfile. compile_args and
+# exec_args are options telling this proc how to work.
+#
+proc compile_java_from_source { srcfile binfile compile_args } {
+    global GCJ_UNDER_TEST
+    global runtests
+    global java_initialized
+
+    if { $java_initialized != 1 } { java_init }
+
+    set errname [file rootname [file tail $srcfile]]
+    if {! [runtest_file_p $runtests $errname]} {
+        return
+    }
+
+    set args "compiler=$GCJ_UNDER_TEST"
+    lappend args "additional_flags=--main=[file rootname [file tail $srcfile]]"
+    if { $compile_args != "" } {
+	lappend args "additional_flags=$compile_args"
+    }
+
+    if { $compile_args != "" } {
+	set errname "$errname $compile_args"
+    }
+
+    set x [target_compile $srcfile ${binfile} ${binfile} $args]
+    if { $x != "" } {
+	verbose "target_compile failed: $x" 2
+	return "$errname compilation from source";
+    }
+}
+
+# Local Variables:
+# tcl-indent-level:4
+# End:
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 1cad1b1..6b3e3e7 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -117,7 +117,7 @@
 	return 1;
     }
     gdb_expect {
-	-re ".*UI_OUT.*$mi_gdb_prompt$" {
+	-re ".*MI_OUT.*$mi_gdb_prompt$" {
 	    verbose "GDB initialized."
 	}
 	-re ".*$mi_gdb_prompt$" {
diff --git a/gdb/thread-db.c b/gdb/thread-db.c
new file mode 100644
index 0000000..0296149
--- /dev/null
+++ b/gdb/thread-db.c
@@ -0,0 +1,992 @@
+/* libthread_db assisted debugging support, generic parts.
+   Copyright 1999, 2000 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 <dlfcn.h>
+#include "gdb_proc_service.h"
+#include "gdb_thread_db.h"
+
+#include "gdbthread.h"
+#include "inferior.h"
+#include "target.h"
+
+#ifndef LIBTHREAD_DB_SO
+#define LIBTHREAD_DB_SO "libthread_db.so.1"
+#endif
+
+/* If we're running on Linux, we must explicitly attach to any new threads.  */
+
+/* FIXME: There is certainly some room for improvements:
+   - Cache LWP ids.
+   - Bypass libthread_db when fetching or storing registers for
+   threads bound to a LWP.  */
+
+/* This module's target vector.  */
+static struct target_ops thread_db_ops;
+
+/* The target vector that we call for things this module can't handle.  */
+static struct target_ops *target_beneath;
+
+/* Pointer to the next function on the objfile event chain.  */
+static void (*target_new_objfile_chain) (struct objfile *objfile);
+
+/* Non-zero if we're using this module's target vector.  */
+static int using_thread_db;
+
+/* Non-zero if we have determined the signals used by the threads
+   library.  */
+static int thread_signals;
+static sigset_t thread_stop_set;
+static sigset_t thread_print_set;
+
+/* Structure that identifies the child process for the
+   <proc_service.h> interface.  */
+static struct ps_prochandle proc_handle;
+
+/* Connection to the libthread_db library.  */
+static td_thragent_t *thread_agent;
+
+/* Pointers to the libthread_db functions.  */
+
+static td_err_e (*td_init_p) (void);
+
+static td_err_e (*td_ta_new_p) (struct ps_prochandle *ps, td_thragent_t **ta);
+static td_err_e (*td_ta_map_id2thr_p) (const td_thragent_t *ta, thread_t pt,
+				       td_thrhandle_t *__th);
+static td_err_e (*td_ta_map_lwp2thr_p) (const td_thragent_t *ta, lwpid_t lwpid,
+					td_thrhandle_t *th);
+static td_err_e (*td_ta_thr_iter_p) (const td_thragent_t *ta,
+				     td_thr_iter_f *callback,
+				     void *cbdata_p, td_thr_state_e state,
+				     int ti_pri, sigset_t *ti_sigmask_p,
+				     unsigned int ti_user_flags);
+static td_err_e (*td_ta_event_addr_p) (const td_thragent_t *ta,
+				       td_event_e event, td_notify_t *ptr);
+static td_err_e (*td_ta_set_event_p) (const td_thragent_t *ta,
+				      td_thr_events_t *event);
+static td_err_e (*td_ta_event_getmsg_p) (const td_thragent_t *ta,
+					 td_event_msg_t *msg);
+
+static td_err_e (*td_thr_validate_p) (const td_thrhandle_t *th);
+static td_err_e (*td_thr_get_info_p) (const td_thrhandle_t *th,
+				      td_thrinfo_t *infop);
+static td_err_e (*td_thr_getfpregs_p) (const td_thrhandle_t *th,
+				       gdb_prfpregset_t *regset);
+static td_err_e (*td_thr_getgregs_p) (const td_thrhandle_t *th,
+				      prgregset_t gregs);
+static td_err_e (*td_thr_setfpregs_p) (const td_thrhandle_t *th,
+				       const gdb_prfpregset_t *fpregs);
+static td_err_e (*td_thr_setgregs_p) (const td_thrhandle_t *th,
+				      prgregset_t gregs);
+static td_err_e (*td_thr_event_enable_p) (const td_thrhandle_t *th, int event);
+
+/* Location of the thread creation event breakpoint.  The code at this
+   location in the child process will be called by the pthread library
+   whenever a new thread is created.  By setting a special breakpoint
+   at this location, GDB can detect when a new thread is created.  We
+   obtain this location via the td_ta_event_addr call.  */
+static CORE_ADDR td_create_bp_addr;
+
+/* Location of the thread death event breakpoint.  */
+static CORE_ADDR td_death_bp_addr;
+
+/* Prototypes for local functions.  */
+static int find_new_threads_callback (const td_thrhandle_t *th_p, void *data);
+
+
+/* Building process ids.  */
+
+#ifndef TIDGET
+#define TIDGET(PID)		(((PID) & 0x7fffffff) >> 16)
+#define PIDGET(PID)		(((PID) & 0xffff))
+#define MERGEPID(PID, TID)	(((PID) & 0xffff) | ((TID) << 16))
+#endif
+
+#define THREAD_FLAG		0x80000000
+
+#define is_lwp(pid)		(((pid) & THREAD_FLAG) == 0 && TIDGET (pid))
+#define is_thread(pid)		((pid) & THREAD_FLAG)
+
+#define GET_PID(pid)		PIDGET (pid)
+#define GET_LWP(pid)		TIDGET (pid)
+#define GET_THREAD(pid)		TIDGET (pid)
+
+#define BUILD_LWP(tid, pid)	MERGEPID (pid, tid)
+#define BUILD_THREAD(tid, pid)	(MERGEPID (pid, tid) | THREAD_FLAG)
+
+
+struct private_thread_info
+{
+  /* Cached LWP id.  Must come first, see lin-lwp.c.  */
+  lwpid_t lwpid;
+};
+
+
+/* Helper functions.  */
+
+static void
+restore_inferior_pid (void *arg)
+{
+  int *saved_pid_ptr = arg;
+  inferior_pid = *saved_pid_ptr;
+  xfree (arg);
+}
+
+static struct cleanup *
+save_inferior_pid (void)
+{
+  int *saved_pid_ptr;
+
+  saved_pid_ptr = xmalloc (sizeof (int));
+  *saved_pid_ptr = inferior_pid;
+  return make_cleanup (restore_inferior_pid, saved_pid_ptr);
+}
+
+
+static char *
+thread_db_err_str (td_err_e err)
+{
+  static char buf[64];
+
+  switch (err)
+    {
+    case TD_OK:
+      return "generic 'call succeeded'";
+    case TD_ERR:
+      return "generic error";
+    case TD_NOTHR:
+      return "no thread to satisfy query";
+    case TD_NOSV:
+      return "no sync handle to satisfy query";
+    case TD_NOLWP:
+      return "no LWP to satisfy query";
+    case TD_BADPH:
+      return "invalid process handle";
+    case TD_BADTH:
+      return "invalid thread handle";
+    case TD_BADSH:
+      return "invalid synchronization handle";
+    case TD_BADTA:
+      return "invalid thread agent";
+    case TD_BADKEY:
+      return "invalid key";
+    case TD_NOMSG:
+      return "no event message for getmsg";
+    case TD_NOFPREGS:
+      return "FPU register set not available";
+    case TD_NOLIBTHREAD:
+      return "application not linked with libthread";
+    case TD_NOEVENT:
+      return "requested event is not supported";
+    case TD_NOCAPAB:
+      return "capability not available";
+    case TD_DBERR:
+      return "debugger service failed";
+    case TD_NOAPLIC:
+      return "operation not applicable to";
+    case TD_NOTSD:
+      return "no thread-specific data for this thread";
+    case TD_MALLOC:
+      return "malloc failed";
+    case TD_PARTIALREG:
+      return "only part of register set was written/read";
+    case TD_NOXREGS:
+      return "X register set not available for this thread";
+    default:
+      snprintf (buf, sizeof (buf), "unknown thread_db error '%d'", err);
+      return buf;
+    }
+}
+
+static char *
+thread_db_state_str (td_thr_state_e state)
+{
+  static char buf[64];
+
+  switch (state)
+    {
+    case TD_THR_STOPPED:
+      return "stopped by debugger";
+    case TD_THR_RUN:
+      return "runnable";
+    case TD_THR_ACTIVE:
+      return "active";
+    case TD_THR_ZOMBIE:
+      return "zombie";
+    case TD_THR_SLEEP:
+      return "sleeping";
+    case TD_THR_STOPPED_ASLEEP:
+      return "stopped by debugger AND blocked";
+    default:
+      snprintf (buf, sizeof (buf), "unknown thread_db state %d", state);
+      return buf;
+    }
+}
+
+
+/* Convert between user-level thread ids and LWP ids.  */
+
+static int
+thread_from_lwp (int pid)
+{
+  td_thrinfo_t ti;
+  td_thrhandle_t th;
+  td_err_e err;
+
+  if (GET_LWP (pid) == 0)
+    pid = BUILD_LWP (pid, pid);
+
+  gdb_assert (is_lwp (pid));
+
+  err = td_ta_map_lwp2thr_p (thread_agent, GET_LWP (pid), &th);
+  if (err != TD_OK)
+    error ("Cannot find user-level thread for LWP %d: %s",
+	   GET_LWP (pid), thread_db_err_str (err));
+
+  err = td_thr_get_info_p (&th, &ti);
+  if (err != TD_OK)
+    error ("Cannot get thread info: %s", thread_db_err_str (err));
+
+  return BUILD_THREAD (ti.ti_tid, GET_PID (pid));
+}
+
+static int
+lwp_from_thread (int pid)
+{
+  td_thrinfo_t ti;
+  td_thrhandle_t th;
+  td_err_e err;
+
+  if (! is_thread (pid))
+    return pid;
+
+  err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (pid), &th);
+  if (err != TD_OK)
+    error ("Cannot find thread %ld: %s",
+	   (long) GET_THREAD (pid), thread_db_err_str (err));
+
+  err = td_thr_get_info_p (&th, &ti);
+  if (err != TD_OK)
+    error ("Cannot get thread info: %s", thread_db_err_str (err));
+
+  return BUILD_LWP (ti.ti_lid, GET_PID (pid));
+}
+
+
+void
+thread_db_init (struct target_ops *target)
+{
+  target_beneath = target;
+}
+
+static int
+thread_db_load (void)
+{
+  void *handle;
+  td_err_e err;
+
+  handle = dlopen (LIBTHREAD_DB_SO, RTLD_NOW);
+  if (handle == NULL)
+    return 0;
+
+  /* Initialize pointers to the dynamic library functions we will use.
+     Essential functions first.  */
+
+  td_init_p = dlsym (handle, "td_init");
+  if (td_init_p == NULL)
+    return 0;
+
+  td_ta_new_p = dlsym (handle, "td_ta_new");
+  if (td_ta_new_p == NULL)
+    return 0;
+
+  td_ta_map_id2thr_p = dlsym (handle, "td_ta_map_id2thr");
+  if (td_ta_map_id2thr_p == NULL)
+    return 0;
+
+  td_ta_map_lwp2thr_p = dlsym (handle, "td_ta_map_lwp2thr");
+  if (td_ta_map_lwp2thr_p == NULL)
+    return 0;
+
+  td_ta_thr_iter_p = dlsym (handle, "td_ta_thr_iter");
+  if (td_ta_thr_iter_p == NULL)
+    return 0;
+
+  td_thr_validate_p = dlsym (handle, "td_thr_validate");
+  if (td_thr_validate_p == NULL)
+    return 0;
+
+  td_thr_get_info_p = dlsym (handle, "td_thr_get_info");
+  if (td_thr_get_info_p == NULL)
+    return 0;
+
+  td_thr_getfpregs_p = dlsym (handle, "td_thr_getfpregs");
+  if (td_thr_getfpregs_p == NULL)
+    return 0;
+
+  td_thr_getgregs_p = dlsym (handle, "td_thr_getgregs");
+  if (td_thr_getgregs_p == NULL)
+    return 0;
+
+  td_thr_setfpregs_p = dlsym (handle, "td_thr_setfpregs");
+  if (td_thr_setfpregs_p == NULL)
+    return 0;
+
+  td_thr_setgregs_p = dlsym (handle, "td_thr_setgregs");
+  if (td_thr_setgregs_p == NULL)
+    return 0;
+
+  /* Initialize the library.  */
+  err = td_init_p ();
+  if (err != TD_OK)
+    {
+      warning ("Cannot initialize libthread_db: %s", thread_db_err_str (err));
+      return 0;
+    }
+
+  /* These are not essential.  */
+  td_ta_event_addr_p = dlsym (handle, "td_ta_event_addr");
+  td_ta_set_event_p = dlsym (handle, "td_ta_set_event");
+  td_ta_event_getmsg_p = dlsym (handle, "td_ta_event_getmsg");
+  td_thr_event_enable_p = dlsym (handle, "td_thr_event_enable");
+
+  return 1;
+}
+
+static void
+enable_thread_event_reporting (void)
+{
+  td_thr_events_t events;
+  td_notify_t notify;
+  td_err_e err;
+
+  /* We cannot use the thread event reporting facility if these
+     functions aren't available.  */
+  if (td_ta_event_addr_p == NULL || td_ta_set_event_p == NULL
+      || td_ta_event_getmsg_p == NULL || td_thr_event_enable_p == NULL)
+    return;
+
+  /* Set the process wide mask saying which events we're interested in.  */
+  td_event_emptyset (&events);
+  td_event_addset (&events, TD_CREATE);
+#if 0
+  /* FIXME: kettenis/2000-04-23: The event reporting facility is
+     broken for TD_DEATH events in glibc 2.1.3, so don't enable it for
+     now.  */
+  td_event_addset (&events, TD_DEATH);
+#endif
+
+  err = td_ta_set_event_p (thread_agent, &events);
+  if (err != TD_OK)
+    {
+      warning ("Unable to set global thread event mask: %s",
+	       thread_db_err_str (err));
+      return;
+    }
+
+  /* Delete previous thread event breakpoints, if any.  */
+  remove_thread_event_breakpoints ();
+
+  /* Get address for thread creation breakpoint.  */
+  err = td_ta_event_addr_p (thread_agent, TD_CREATE, &notify);
+  if (err != TD_OK)
+    {
+      warning ("Unable to get location for thread creation breakpoint: %s",
+	       thread_db_err_str (err));
+      return;
+    }
+
+  /* Set up the breakpoint.  */
+  td_create_bp_addr = (CORE_ADDR) notify.u.bptaddr;
+  create_thread_event_breakpoint (td_create_bp_addr);
+
+  /* Get address for thread death breakpoint.  */
+  err = td_ta_event_addr_p (thread_agent, TD_DEATH, &notify);
+  if (err != TD_OK)
+    {
+      warning ("Unable to get location for thread creation breakpoint: %s",
+	       thread_db_err_str (err));
+      return;
+    }
+
+  /* Set up the breakpoint.  */
+  td_death_bp_addr = (CORE_ADDR) notify.u.bptaddr;
+  create_thread_event_breakpoint (td_death_bp_addr);
+}
+
+static void
+disable_thread_event_reporting (void)
+{
+  td_thr_events_t events;
+
+  /* Set the process wide mask saying we aren't interested in any
+     events anymore.  */
+  td_event_emptyset (&events);
+  td_ta_set_event_p (thread_agent, &events);
+
+  /* Delete thread event breakpoints, if any.  */
+  remove_thread_event_breakpoints ();
+  td_create_bp_addr = 0;
+  td_death_bp_addr = 0;
+}
+
+static void
+check_thread_signals (void)
+{
+#ifdef GET_THREAD_SIGNALS
+  if (! thread_signals)
+    {
+      sigset_t mask;
+      int i;
+
+      GET_THREAD_SIGNALS (&mask);
+      sigemptyset (&thread_stop_set);
+      sigemptyset (&thread_print_set);
+
+      for (i = 0; i < NSIG; i++)
+	{
+	  if (sigismember (&mask, i))
+	    {
+	      if (signal_stop_update (target_signal_from_host (i), 0))
+		sigaddset (&thread_stop_set, i);
+	      if (signal_print_update (target_signal_from_host (i), 0))
+		sigaddset (&thread_print_set, i);
+	      thread_signals = 1;
+	    }
+	}
+    }
+#endif
+}
+
+static void
+disable_thread_signals (void)
+{
+#ifdef GET_THREAD_SIGNALS
+  if (thread_signals)
+    {
+      int i;
+
+      for (i = 0; i < NSIG; i++)
+	{
+	  if (sigismember (&thread_stop_set, i))
+	    signal_stop_update (target_signal_from_host (i), 1);
+	  if (sigismember (&thread_print_set, i))
+	    signal_print_update (target_signal_from_host (i), 1);
+	}
+
+      thread_signals = 0;
+    }
+#endif
+}
+
+static void
+thread_db_push_target (void)
+{
+  using_thread_db = 1;
+
+  /* Push this target vector.  */
+  push_target (&thread_db_ops);
+
+  enable_thread_event_reporting ();
+}
+
+static void
+thread_db_unpush_target (void)
+{
+  /* Unpush this target vector.  */
+  unpush_target (&thread_db_ops);
+
+  using_thread_db = 0;
+}
+
+static void
+thread_db_new_objfile (struct objfile *objfile)
+{
+  td_err_e err;
+
+  if (using_thread_db)
+    /* Nothing to do.  The thread library was already detected and the
+       target vector was already activated.  */
+    goto quit;
+
+  if (objfile == NULL)
+    /* Un-interesting object file.  */
+    goto quit;
+
+  /* Initialize the structure that identifies the child process.  */
+  proc_handle.pid = GET_PID (inferior_pid);
+
+  /* Now attempt to open a connection to the thread library running in
+     the child process.  */
+  err = td_ta_new_p (&proc_handle, &thread_agent);
+  switch (err)
+    {
+    case TD_NOLIBTHREAD:
+      /* No thread library found in the child process, probably
+         because the child process isn't running yet.  */
+      break;
+
+    case TD_OK:
+      /* The thread library was detected in the child; we go live now!  */
+      thread_db_push_target ();
+
+      /* Find all user-space threads.  */
+      err = td_ta_thr_iter_p (thread_agent, find_new_threads_callback,
+			      &inferior_pid, TD_THR_ANY_STATE,
+			      TD_THR_LOWEST_PRIORITY, TD_SIGNO_MASK,
+			      TD_THR_ANY_USER_FLAGS);
+      if (err != TD_OK)
+	error ("Finding new threads failed: %s", thread_db_err_str (err));
+      break;
+
+    default:
+      warning ("Cannot initialize thread debugging library: %s",
+	       thread_db_err_str (err));
+      break;
+    }
+
+ quit:
+  if (target_new_objfile_chain)
+    target_new_objfile_chain (objfile);
+}
+
+static void
+attach_thread (int pid, const td_thrhandle_t *th_p,
+	       const td_thrinfo_t *ti_p, int verbose)
+{
+  struct thread_info *tp;
+  td_err_e err;
+
+  check_thread_signals ();
+
+  if (verbose)
+    printf_unfiltered ("[New %s]\n", target_pid_to_str (pid));
+
+  /* Add the thread to GDB's thread list.  */
+  tp = add_thread (pid);
+  tp->private = xmalloc (sizeof (struct private_thread_info));
+  tp->private->lwpid = ti_p->ti_lid;
+
+  /* Under Linux, we have to attach to each and every thread.  */
+#ifdef ATTACH_LWP
+  if (ti_p->ti_lid != GET_PID (pid))
+    ATTACH_LWP (BUILD_LWP (ti_p->ti_lid, GET_PID (pid)), 0);
+#endif
+
+  /* Enable thread event reporting for this thread.  */
+  err = td_thr_event_enable_p (th_p, 1);
+  if (err != TD_OK)
+    error ("Cannot enable thread event reporting for %s: %s",
+	   target_pid_to_str (pid), thread_db_err_str (err));
+}
+
+static void
+detach_thread (int pid, int verbose)
+{
+  if (verbose)
+    printf_unfiltered ("[%s exited]\n", target_pid_to_str (pid));
+}
+
+static void
+thread_db_detach (char *args, int from_tty)
+{
+  disable_thread_event_reporting ();
+  thread_db_unpush_target ();
+
+  target_beneath->to_detach (args, from_tty);
+}
+
+static void
+thread_db_resume (int pid, int step, enum target_signal signo)
+{
+  struct cleanup *old_chain = save_inferior_pid ();
+
+  if (pid == -1)
+    inferior_pid = lwp_from_thread (inferior_pid);
+  else if (is_thread (pid))
+    pid = lwp_from_thread (pid);
+
+  target_beneath->to_resume (pid, step, signo);
+
+  do_cleanups (old_chain);
+}
+
+/* Check if PID is currently stopped at the location of a thread event
+   breakpoint location.  If it is, read the event message and act upon
+   the event.  */
+
+static void
+check_event (int pid)
+{
+  td_event_msg_t msg;
+  td_thrinfo_t ti;
+  td_err_e err;
+  CORE_ADDR stop_pc;
+
+  /* Bail out early if we're not at a thread event breakpoint.  */
+  stop_pc = read_pc_pid (pid) - DECR_PC_AFTER_BREAK;
+  if (stop_pc != td_create_bp_addr && stop_pc != td_death_bp_addr)
+    return;
+
+  err = td_ta_event_getmsg_p (thread_agent, &msg);
+  if (err != TD_OK)
+    {
+      if (err == TD_NOMSG)
+	return;
+
+      error ("Cannot get thread event message: %s", thread_db_err_str (err));
+    }
+
+  err = td_thr_get_info_p (msg.th_p, &ti);
+  if (err != TD_OK)
+    error ("Cannot get thread info: %s", thread_db_err_str (err));
+
+  pid = BUILD_THREAD (ti.ti_tid, GET_PID (pid));
+
+  switch (msg.event)
+    {
+    case TD_CREATE:
+#if 0
+      /* FIXME: kettenis/2000-08-26: Since we use td_ta_event_getmsg,
+         there is no guarantee that the breakpoint will match the
+         event.  Should we use td_thr_event_getmsg instead?  */
+
+      if (stop_pc != td_create_bp_addr)
+	error ("Thread creation event doesn't match breakpoint.");
+#endif
+
+      if (in_thread_list (pid))
+	error ("Spurious thread creation event.");
+
+      attach_thread (pid, msg.th_p, &ti, 1);
+      return;
+
+    case TD_DEATH:
+#if 0
+      /* FIXME: See TD_CREATE.  */
+
+      if (stop_pc != td_death_bp_addr)
+	error ("Thread death event doesn't match breakpoint.");
+#endif
+
+      if (! in_thread_list (pid))
+	error ("Spurious thread death event.");
+
+      detach_thread (pid, 1);
+      return;
+
+    default:
+      error ("Spurious thread event.");
+    }
+}
+
+static int
+thread_db_wait (int pid, struct target_waitstatus *ourstatus)
+{
+  extern int trap_pid;
+
+  if (pid != -1 && is_thread (pid))
+    pid = lwp_from_thread (pid);
+
+  pid = target_beneath->to_wait (pid, ourstatus);
+
+  if (ourstatus->kind == TARGET_WAITKIND_EXITED)
+    return -1;
+
+  if (ourstatus->kind == TARGET_WAITKIND_STOPPED
+      && ourstatus->value.sig == TARGET_SIGNAL_TRAP)
+    /* Check for a thread event.  */
+    check_event (pid);
+
+  if (trap_pid)
+    trap_pid = thread_from_lwp (trap_pid);
+
+  return thread_from_lwp (pid);
+}
+
+static int
+thread_db_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+		       struct target_ops *target)
+{
+  struct cleanup *old_chain = save_inferior_pid ();
+  int xfer;
+
+  if (is_thread (inferior_pid))
+    {
+      /* FIXME: This seems to be necessary to make sure breakpoints
+         are removed.  */
+      if (! target_thread_alive (inferior_pid))
+	inferior_pid = GET_PID (inferior_pid);
+      else
+	inferior_pid = lwp_from_thread (inferior_pid);
+    }
+
+  xfer = target_beneath->to_xfer_memory (memaddr, myaddr, len, write, target);
+
+  do_cleanups (old_chain);
+  return xfer;
+}
+
+static void
+thread_db_fetch_registers (int regno)
+{
+  td_thrhandle_t th;
+  prgregset_t gregset;
+  gdb_prfpregset_t fpregset;
+  td_err_e err;
+
+  if (! is_thread (inferior_pid))
+    {
+      /* Pass the request to the target beneath us.  */
+      target_beneath->to_fetch_registers (regno);
+      return;
+    }
+
+  err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (inferior_pid), &th);
+  if (err != TD_OK)
+    error ("Cannot find thread %ld: %s",
+	   (long) GET_THREAD (inferior_pid), thread_db_err_str (err));
+
+  err = td_thr_getgregs_p (&th, gregset);
+  if (err != TD_OK)
+    error ("Cannot fetch general-purpose registers for thread %ld: %s",
+	   (long) GET_THREAD (inferior_pid), thread_db_err_str (err));
+
+  err = td_thr_getfpregs_p (&th, &fpregset);
+  if (err != TD_OK)
+    error ("Cannot get floating-point registers for thread %ld: %s",
+	   (long) GET_THREAD (inferior_pid), thread_db_err_str (err));
+
+  /* Note that we must call supply_gregset after calling the thread_db
+     routines because the thread_db routines call ps_lgetgregs and
+     friends which clobber GDB's register cache.  */
+  supply_gregset ((gdb_gregset_t *) gregset);
+  supply_fpregset (&fpregset);
+}
+
+static void
+thread_db_store_registers (int regno)
+{
+  td_thrhandle_t th;
+  prgregset_t gregset;
+  gdb_prfpregset_t fpregset;
+  td_err_e err;
+
+  if (! is_thread (inferior_pid))
+    {
+      /* Pass the request to the target beneath us.  */
+      target_beneath->to_store_registers (regno);
+      return;
+    }
+
+  err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (inferior_pid), &th);
+  if (err != TD_OK)
+    error ("Cannot find thread %ld: %s",
+	   (long) GET_THREAD (inferior_pid), thread_db_err_str (err));
+
+  if (regno != -1)
+    {
+      char raw[MAX_REGISTER_RAW_SIZE];
+
+      read_register_gen (regno, raw);
+      thread_db_fetch_registers (-1);
+      supply_register (regno, raw);
+    }
+
+  fill_gregset ((gdb_gregset_t *) gregset, -1);
+  fill_fpregset (&fpregset, -1);
+
+  err = td_thr_setgregs_p (&th, gregset);
+  if (err != TD_OK)
+    error ("Cannot store general-purpose registers for thread %ld: %s",
+	   (long) GET_THREAD (inferior_pid), thread_db_err_str (err));
+  err = td_thr_setfpregs_p (&th, &fpregset);
+  if (err != TD_OK)
+    error ("Cannot store floating-point registers  for thread %ld: %s",
+	   (long) GET_THREAD (inferior_pid), thread_db_err_str (err));
+}
+
+static void
+thread_db_kill (void)
+{
+  target_beneath->to_kill ();
+}
+
+static void
+thread_db_create_inferior (char *exec_file, char *allargs, char **env)
+{
+  /* We never want to actually create the inferior!  If this is ever
+     called, it means we were on the target stack when the user said
+     "run".  But we don't want to be on the new inferior's target
+     stack until the libthread_db connection is ready to be made.  So
+     we unpush ourselves from the stack, and then invoke
+     find_default_create_inferior, which will invoke the appropriate
+     process_stratum target to do the create.  */
+
+  thread_db_unpush_target ();
+
+  find_default_create_inferior (exec_file, allargs, env);
+}
+
+static void
+thread_db_mourn_inferior (void)
+{
+  remove_thread_event_breakpoints ();
+  thread_db_unpush_target ();
+
+  target_beneath->to_mourn_inferior ();
+}
+
+static int
+thread_db_thread_alive (int pid)
+{
+  if (is_thread (pid))
+    {
+      td_thrhandle_t th;
+      td_err_e err;
+
+      err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (pid), &th);
+      if (err != TD_OK)
+	return 0;
+
+      err = td_thr_validate_p (&th);
+      if (err != TD_OK)
+	return 0;
+
+      return 1;
+    }
+
+  if (target_beneath->to_thread_alive)
+    return target_beneath->to_thread_alive (pid);
+
+  return 0;
+}
+
+static int
+find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
+{
+  td_thrinfo_t ti;
+  td_err_e err;
+  int pid;
+
+  err = td_thr_get_info_p (th_p, &ti);
+  if (err != TD_OK)
+    error ("Cannot get thread info: %s", thread_db_err_str (err));
+
+  pid = BUILD_THREAD (ti.ti_tid, GET_PID (inferior_pid));
+
+  if (! in_thread_list (pid))
+    attach_thread (pid, th_p, &ti, 1);
+
+  return 0;
+}
+
+static void
+thread_db_find_new_threads (void)
+{
+  td_err_e err;
+
+  /* Iterate over all user-space threads to discover new threads.  */
+  err = td_ta_thr_iter_p (thread_agent, find_new_threads_callback, NULL,
+			  TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
+			  TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
+  if (err != TD_OK)
+    error ("Cannot find new threads: %s", thread_db_err_str (err));
+}
+
+static char *
+thread_db_pid_to_str (int pid)
+{
+  if (is_thread (pid))
+    {
+      static char buf[64];
+      td_thrhandle_t th;
+      td_thrinfo_t ti;
+      td_err_e err;
+
+      err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (pid), &th);
+      if (err != TD_OK)
+	error ("Cannot find thread %ld: %s",
+	       (long) GET_THREAD (pid), thread_db_err_str (err));
+
+      err = td_thr_get_info_p (&th, &ti);
+      if (err != TD_OK)
+	error ("Cannot get thread info for thread %ld: %s",
+	       (long) GET_THREAD (pid), thread_db_err_str (err));
+
+      if (ti.ti_state == TD_THR_ACTIVE && ti.ti_lid != 0)
+	{
+	  snprintf (buf, sizeof (buf), "Thread %ld (LWP %d)",
+		    (long) ti.ti_tid, ti.ti_lid);
+	}
+      else
+	{
+	  snprintf (buf, sizeof (buf), "Thread %ld (%s)",
+		    (long) ti.ti_tid, thread_db_state_str (ti.ti_state));
+	}
+
+      return buf;
+    }
+
+  if (target_beneath->to_pid_to_str (pid))
+    return target_beneath->to_pid_to_str (pid);
+
+  return normal_pid_to_str (pid);
+}
+
+static void
+init_thread_db_ops (void)
+{
+  thread_db_ops.to_shortname = "multi-thread";
+  thread_db_ops.to_longname = "multi-threaded child process.";
+  thread_db_ops.to_doc = "Threads and pthreads support.";
+  thread_db_ops.to_detach = thread_db_detach;
+  thread_db_ops.to_resume = thread_db_resume;
+  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.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_mourn_inferior = thread_db_mourn_inferior;
+  thread_db_ops.to_thread_alive = thread_db_thread_alive;
+  thread_db_ops.to_find_new_threads = thread_db_find_new_threads;
+  thread_db_ops.to_pid_to_str = thread_db_pid_to_str;
+  thread_db_ops.to_stratum = thread_stratum;
+  thread_db_ops.to_has_thread_control = tc_schedlock;
+  thread_db_ops.to_magic = OPS_MAGIC;
+}
+
+void
+_initialize_thread_db (void)
+{
+  /* Only initialize the module if we can load libthread_db.  */
+  if (thread_db_load ())
+    {
+      init_thread_db_ops ();
+      add_target (&thread_db_ops);
+
+      /* Add ourselves to objfile event chain.  */
+      target_new_objfile_chain = target_new_objfile_hook;
+      target_new_objfile_hook = thread_db_new_objfile;
+    }
+}
diff --git a/gdb/thread.c b/gdb/thread.c
index 2c87470..647976c 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -63,30 +63,45 @@
 static void switch_to_thread (int pid);
 static void prune_threads (void);
 
+static void
+free_thread (struct thread_info *tp)
+{
+  /* NOTE: this will take care of any left-over step_resume breakpoints,
+     but not any user-specified thread-specific breakpoints. */
+  if (tp->step_resume_breakpoint)
+    delete_breakpoint (tp->step_resume_breakpoint);
+
+  /* FIXME: do I ever need to call the back-end to give it a
+     chance at this private data before deleting the thread?  */
+  if (tp->private)
+    xfree (tp->private);
+
+  xfree (tp);
+}
+
 void
-init_thread_list ()
+init_thread_list (void)
 {
   struct thread_info *tp, *tpnext;
 
+  highest_thread_num = 0;
   if (!thread_list)
     return;
 
   for (tp = thread_list; tp; tp = tpnext)
     {
       tpnext = tp->next;
-      free (tp);
+      free_thread (tp);
     }
 
   thread_list = NULL;
-  highest_thread_num = 0;
 }
 
 /* add_thread now returns a pointer to the new thread_info, 
    so that back_ends can initialize their private data.  */
 
 struct thread_info *
-add_thread (pid)
-     int pid;
+add_thread (int pid)
 {
   struct thread_info *tp;
 
@@ -115,8 +130,7 @@
 }
 
 void
-delete_thread (pid)
-     int pid;
+delete_thread (int pid)
 {
   struct thread_info *tp, *tpprev;
 
@@ -134,24 +148,11 @@
   else
     thread_list = tp->next;
 
-  /* NOTE: this will take care of any left-over step_resume breakpoints,
-     but not any user-specified thread-specific breakpoints. */
-  if (tp->step_resume_breakpoint)
-    delete_breakpoint (tp->step_resume_breakpoint);
-
-  /* FIXME: do I ever need to call the back-end to give it a
-     chance at this private data before deleting the thread?  */
-  if (tp->private)
-    free (tp->private);
-
-  free (tp);
-
-  return;
+  free_thread (tp);
 }
 
 static struct thread_info *
-find_thread_id (num)
-     int num;
+find_thread_id (int num)
 {
   struct thread_info *tp;
 
@@ -164,8 +165,7 @@
 
 /* Find a thread_info by matching 'pid'.  */
 struct thread_info *
-find_thread_pid (pid)
-     int pid;
+find_thread_pid (int pid)
 {
   struct thread_info *tp;
 
@@ -191,9 +191,8 @@
  */
 
 struct thread_info *
-iterate_over_threads (callback, data)
-     int (*callback) ();
-     void *data;
+iterate_over_threads (int (*callback) (struct thread_info *, void *),
+		      void *data)
 {
   struct thread_info *tp;
 
@@ -205,8 +204,7 @@
 }
 
 int
-valid_thread_id (num)
-     int num;
+valid_thread_id (int num)
 {
   struct thread_info *tp;
 
@@ -218,8 +216,7 @@
 }
 
 int
-pid_to_thread_id (pid)
-     int pid;
+pid_to_thread_id (int pid)
 {
   struct thread_info *tp;
 
@@ -231,8 +228,7 @@
 }
 
 int
-thread_id_to_pid (num)
-     int num;
+thread_id_to_pid (int num)
 {
   struct thread_info *thread = find_thread_id (num);
   if (thread)
@@ -242,8 +238,7 @@
 }
 
 int
-in_thread_list (pid)
-     int pid;
+in_thread_list (int pid)
 {
   struct thread_info *tp;
 
@@ -288,29 +283,15 @@
 /* Load infrun state for the thread PID.  */
 
 void
-load_infrun_state (pid, prev_pc, prev_func_start, prev_func_name,
-		   trap_expected, step_resume_breakpoint,
-		   through_sigtramp_breakpoint, step_range_start,
-		   step_range_end, step_frame_address,
-		   handling_longjmp, another_trap,
-		   stepping_through_solib_after_catch,
-		   stepping_through_solib_catchpoints,
-		   stepping_through_sigtramp)
-     int pid;
-     CORE_ADDR *prev_pc;
-     CORE_ADDR *prev_func_start;
-     char **prev_func_name;
-     int *trap_expected;
-     struct breakpoint **step_resume_breakpoint;
-     struct breakpoint **through_sigtramp_breakpoint;
-     CORE_ADDR *step_range_start;
-     CORE_ADDR *step_range_end;
-     CORE_ADDR *step_frame_address;
-     int *handling_longjmp;
-     int *another_trap;
-     int *stepping_through_solib_after_catch;
-     bpstat *stepping_through_solib_catchpoints;
-     int *stepping_through_sigtramp;
+load_infrun_state (int pid, CORE_ADDR *prev_pc, CORE_ADDR *prev_func_start,
+		   char **prev_func_name, int *trap_expected,
+		   struct breakpoint **step_resume_breakpoint,
+		   struct breakpoint **through_sigtramp_breakpoint,
+		   CORE_ADDR *step_range_start, CORE_ADDR *step_range_end,
+		   CORE_ADDR *step_frame_address, int *handling_longjmp,
+		   int *another_trap, int *stepping_through_solib_after_catch,
+		   bpstat *stepping_through_solib_catchpoints,
+		   int *stepping_through_sigtramp)
 {
   struct thread_info *tp;
 
@@ -339,29 +320,15 @@
 /* Save infrun state for the thread PID.  */
 
 void
-save_infrun_state (pid, prev_pc, prev_func_start, prev_func_name,
-		   trap_expected, step_resume_breakpoint,
-		   through_sigtramp_breakpoint, step_range_start,
-		   step_range_end, step_frame_address,
-		   handling_longjmp, another_trap,
-		   stepping_through_solib_after_catch,
-		   stepping_through_solib_catchpoints,
-		   stepping_through_sigtramp)
-     int pid;
-     CORE_ADDR prev_pc;
-     CORE_ADDR prev_func_start;
-     char *prev_func_name;
-     int trap_expected;
-     struct breakpoint *step_resume_breakpoint;
-     struct breakpoint *through_sigtramp_breakpoint;
-     CORE_ADDR step_range_start;
-     CORE_ADDR step_range_end;
-     CORE_ADDR step_frame_address;
-     int handling_longjmp;
-     int another_trap;
-     int stepping_through_solib_after_catch;
-     bpstat stepping_through_solib_catchpoints;
-     int stepping_through_sigtramp;
+save_infrun_state (int pid, CORE_ADDR prev_pc, CORE_ADDR prev_func_start,
+		   char *prev_func_name, int trap_expected,
+		   struct breakpoint *step_resume_breakpoint,
+		   struct breakpoint *through_sigtramp_breakpoint,
+		   CORE_ADDR step_range_start, CORE_ADDR step_range_end,
+		   CORE_ADDR step_frame_address, int handling_longjmp,
+		   int another_trap, int stepping_through_solib_after_catch,
+		   bpstat stepping_through_solib_catchpoints,
+		   int stepping_through_sigtramp)
 {
   struct thread_info *tp;
 
@@ -389,8 +356,7 @@
 
 /* Return true if TP is an active thread. */
 static int
-thread_alive (tp)
-     struct thread_info *tp;
+thread_alive (struct thread_info *tp)
 {
   if (tp->pid == -1)
     return 0;
@@ -403,7 +369,7 @@
 }
 
 static void
-prune_threads ()
+prune_threads (void)
 {
   struct thread_info *tp, *next;
 
@@ -423,9 +389,7 @@
  */
 
 static void
-info_threads_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+info_threads_command (char *arg, int from_tty)
 {
   struct thread_info *tp;
   int current_pid;
@@ -495,8 +459,7 @@
 /* Switch from one thread to another. */
 
 static void
-switch_to_thread (pid)
-     int pid;
+switch_to_thread (int pid)
 {
   if (pid == inferior_pid)
     return;
@@ -509,8 +472,7 @@
 }
 
 static void
-restore_current_thread (pid)
-     int pid;
+restore_current_thread (int pid)
 {
   if (pid != inferior_pid)
     {
@@ -519,6 +481,28 @@
     }
 }
 
+struct current_thread_cleanup
+{
+  int inferior_pid;
+};
+
+static void
+do_restore_current_thread_cleanup (void *arg)
+{
+  struct current_thread_cleanup *old = arg;
+  restore_current_thread (old->inferior_pid);
+  xfree (old);
+}
+
+static struct cleanup *
+make_cleanup_restore_current_thread (int inferior_pid)
+{
+  struct current_thread_cleanup *old
+    = xmalloc (sizeof (struct current_thread_cleanup));
+  old->inferior_pid = inferior_pid;
+  return make_cleanup (do_restore_current_thread_cleanup, old);
+}
+
 /* Apply a GDB command to a list of threads.  List syntax is a whitespace
    seperated list of numbers, or ranges, or the keyword `all'.  Ranges consist
    of two numbers seperated by a hyphen.  Examples:
@@ -529,19 +513,26 @@
  */
 
 static void
-thread_apply_all_command (cmd, from_tty)
-     char *cmd;
-     int from_tty;
+thread_apply_all_command (char *cmd, int from_tty)
 {
   struct thread_info *tp;
   struct cleanup *old_chain;
+  struct cleanup *saved_cmd_cleanup_chain;
+  char *saved_cmd;
 
   if (cmd == NULL || *cmd == '\000')
     error ("Please specify a command following the thread ID list");
 
-  old_chain = make_cleanup ((make_cleanup_func) restore_current_thread,
-			    (void *) inferior_pid);
+  old_chain = make_cleanup_restore_current_thread (inferior_pid);
 
+  /* It is safe to update the thread list now, before
+     traversing it for "thread apply all".  MVS */
+  target_find_new_threads ();
+
+  /* Save a copy of the command in case it is clobbered by
+     execute_command */
+  saved_cmd = strdup (cmd);
+  saved_cmd_cleanup_chain = make_cleanup (xfree, (void *) saved_cmd);
   for (tp = thread_list; tp; tp = tp->next)
     if (thread_alive (tp))
       {
@@ -555,17 +546,21 @@
 			 target_pid_to_str (inferior_pid));
 #endif
 	execute_command (cmd, from_tty);
+	strcpy (cmd, saved_cmd); /* Restore exact command used previously */
       }
+
+  do_cleanups (saved_cmd_cleanup_chain);
+  do_cleanups (old_chain);
 }
 
 static void
-thread_apply_command (tidlist, from_tty)
-     char *tidlist;
-     int from_tty;
+thread_apply_command (char *tidlist, int from_tty)
 {
   char *cmd;
   char *p;
   struct cleanup *old_chain;
+  struct cleanup *saved_cmd_cleanup_chain;
+  char *saved_cmd;
 
   if (tidlist == NULL || *tidlist == '\000')
     error ("Please specify a thread ID list");
@@ -575,9 +570,12 @@
   if (*cmd == '\000')
     error ("Please specify a command following the thread ID list");
 
-  old_chain = make_cleanup ((make_cleanup_func) restore_current_thread,
-			    (void *) inferior_pid);
+  old_chain = make_cleanup_restore_current_thread (inferior_pid);
 
+  /* Save a copy of the command in case it is clobbered by
+     execute_command */
+  saved_cmd = strdup (cmd);
+  saved_cmd_cleanup_chain = make_cleanup (xfree, (void *) saved_cmd);
   while (tidlist < cmd)
     {
       struct thread_info *tp;
@@ -624,18 +622,20 @@
 			       target_pid_to_str (inferior_pid));
 #endif
 	      execute_command (cmd, from_tty);
+	      strcpy (cmd, saved_cmd);	/* Restore exact command used previously */
 	    }
 	}
     }
+
+  do_cleanups (saved_cmd_cleanup_chain);
+  do_cleanups (old_chain);
 }
 
 /* Switch to the specified thread.  Will dispatch off to thread_apply_command
    if prefix of arg is `apply'.  */
 
 static void
-thread_command (tidstr, from_tty)
-     char *tidstr;
-     int from_tty;
+thread_command (char *tidstr, int from_tty)
 {
   if (!tidstr)
     {
@@ -717,7 +717,7 @@
 struct cmd_list_element *thread_cmd_list = NULL;
 
 void
-_initialize_thread ()
+_initialize_thread (void)
 {
   static struct cmd_list_element *thread_apply_list = NULL;
 
diff --git a/gdb/tic80-tdep.c b/gdb/tic80-tdep.c
index 2fddc6d..2ea2d44 100644
--- a/gdb/tic80-tdep.c
+++ b/gdb/tic80-tdep.c
@@ -35,9 +35,8 @@
    an empty frame_saved_regs, so I guess that's better than total failure */
 
 void
-tic80_frame_find_saved_regs (fi, regaddr)
-     struct frame_info *fi;
-     struct frame_saved_regs *regaddr;
+tic80_frame_find_saved_regs (struct frame_info *fi,
+			     struct frame_saved_regs *regaddr)
 {
   memcpy (regaddr, &fi->fsr, sizeof (struct frame_saved_regs));
 }
@@ -46,8 +45,7 @@
    Find end of function prologue.  */
 
 CORE_ADDR
-tic80_skip_prologue (pc)
-     CORE_ADDR pc;
+tic80_skip_prologue (CORE_ADDR pc)
 {
   CORE_ADDR func_addr, func_end;
   struct symtab_and_line sal;
@@ -80,8 +78,7 @@
    This information is stored in the "extra" fields of the frame_info.  */
 
 static void
-tic80_scan_prologue (fi)
-     struct frame_info *fi;
+tic80_scan_prologue (struct frame_info *fi)
 {
   struct symtab_and_line sal;
   CORE_ADDR prologue_start, prologue_end, current_pc;
@@ -169,8 +166,7 @@
    examine the prologue.  */
 
 void
-tic80_init_extra_frame_info (fi)
-     struct frame_info *fi;
+tic80_init_extra_frame_info (struct frame_info *fi)
 {
   int reg;
 
@@ -221,9 +217,7 @@
    caller-saves registers for an inner frame.  */
 
 CORE_ADDR
-tic80_find_callers_reg (fi, regnum)
-     struct frame_info *fi;
-     int regnum;
+tic80_find_callers_reg (struct frame_info *fi, int regnum)
 {
   for (; fi; fi = fi->next)
     if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
@@ -241,8 +235,7 @@
    For c80, we save the frame size when we initialize the frame_info.  */
 
 CORE_ADDR
-tic80_frame_chain (fi)
-     struct frame_info *fi;
+tic80_frame_chain (struct frame_info *fi)
 {
   CORE_ADDR fn_start, callers_pc, fp;
 
@@ -271,8 +264,7 @@
    restoring all saved registers.  */
 
 struct frame_info *
-tic80_pop_frame (frame)
-     struct frame_info *frame;
+tic80_pop_frame (struct frame_info *frame)
 {
   int regnum;
 
@@ -303,8 +295,7 @@
    in the stack anywhere, otherwise we get it from the registers. */
 
 CORE_ADDR
-tic80_frame_saved_pc (fi)
-     struct frame_info *fi;
+tic80_frame_saved_pc (struct frame_info *fi)
 {
   if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
     return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
@@ -318,9 +309,7 @@
    (ie. when using an empty CALL_DUMMY) */
 
 CORE_ADDR
-tic80_push_return_address (pc, sp)
-     CORE_ADDR pc;
-     CORE_ADDR sp;
+tic80_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
 {
   write_register (LR_REGNUM, CALL_DUMMY_ADDRESS ());
   return sp;
@@ -365,12 +354,8 @@
    passed as an implicit first argument, always in R0. */
 
 CORE_ADDR
-tic80_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     unsigned char struct_return;
-     CORE_ADDR struct_addr;
+tic80_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+		      unsigned char struct_return, CORE_ADDR struct_addr)
 {
   int stack_offset, stack_alloc;
   int argreg;
@@ -462,8 +447,7 @@
    we must actually write one of those two as well, depending on PSW. */
 
 void
-tic80_write_sp (val)
-     CORE_ADDR val;
+tic80_write_sp (CORE_ADDR val)
 {
 #if 0
   unsigned long psw = read_register (PSW_REGNUM);
@@ -477,7 +461,7 @@
 }
 
 void
-_initialize_tic80_tdep ()
+_initialize_tic80_tdep (void)
 {
   tm_print_insn = print_insn_tic80;
 }
diff --git a/gdb/top.c b/gdb/top.c
index 3bc55f9..5973f7c 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -32,6 +32,7 @@
 #include "language.h"
 #include "terminal.h"		/* For job_control.  */
 #include "annotate.h"
+#include "completer.h"
 #include "top.h"
 #include "version.h"
 
@@ -55,98 +56,56 @@
 #include "cli-out.h"
 #endif
 
+/* From completer.c */
+
+extern int is_complete_command (void (*func) (char *args, int from_tty));
+
+/* From cli/cli-cmds.c */
+
+extern void init_cmd_lists (void);
+
+extern void init_cli_cmds (void);
+
+extern void execute_user_command (struct cmd_list_element *c, char *args);
+
+/* From cli/cli-setshow.c */
+
+extern void do_setshow_command (char *, int, struct cmd_list_element *);
+
+/* Exported to CLI cli/cli-cmds.c. */
+
+void set_verbose (char *, int, struct cmd_list_element *);
+
+void show_history (char *, int);
+
+void set_history (char *, int);
+
+void show_commands (char *, int);
+
+void do_restore_instream_cleanup (void *stream);
+
 /* Prototypes for local functions */
 
 static void dont_repeat_command (char *, int);
 
-static void source_cleanup_lines (PTR);
-
-static void user_defined_command (char *, int);
-
 static void init_signals (void);
 
 #ifdef STOP_SIGNAL
 static void stop_sig (int);
 #endif
 
-static char *line_completion_function (char *, int, char *, int);
-
 static char *readline_line_completion_function (char *, int);
 
-/* NOTE 1999-04-29: this function will be static again, after we make the
-   event loop be the default command loop for gdb, and we merge
-   event-top.c into this file, top.c */
-/* static */ void command_loop_marker (void *);
-
-static void while_command (char *, int);
-
-static void if_command (char *, int);
-
-static struct command_line *build_command_line (enum command_control_type,
-						char *);
-
-static struct command_line *get_command_line (enum command_control_type,
-					      char *);
-
-static void realloc_body_list (struct command_line *, int);
-
-static enum misc_command_type read_next_line (struct command_line **);
-
-static enum command_control_type
-recurse_read_control_structure (struct command_line *);
-
-static struct cleanup *setup_user_args (char *);
-
-static char *locate_arg (char *);
-
-static char *insert_args (char *);
-
-static void arg_cleanup (void *);
-
 static void init_main (void);
 
-static void init_cmd_lists (void);
-
 static void float_handler (int);
 
 static void init_signals (void);
 
-static void set_verbose (char *, int, struct cmd_list_element *);
-
-static void show_history (char *, int);
-
-static void set_history (char *, int);
-
 static void set_history_size_command (char *, int, struct cmd_list_element *);
 
-static void show_commands (char *, int);
-
-static void echo_command (char *, int);
-
-static void pwd_command (char *, int);
-
-static void show_version (char *, int);
-
-static void document_command (char *, int);
-
-static void define_command (char *, int);
-
-static void validate_comname (char *);
-
-static void help_command (char *, int);
-
-static void show_command (char *, int);
-
-static void info_command (char *, int);
-
-static void complete_command (char *, int);
-
 static void do_nothing (int);
 
-static void show_debug (char *, int);
-
-static void set_debug (char *, int);
-
 #ifdef SIGHUP
 /* NOTE 1999-04-29: This function will be static again, once we modify
    gdb to use the event loop as the default command loop and we merge
@@ -156,10 +115,6 @@
 static void disconnect (int);
 #endif
 
-static void do_restore_instream_cleanup (void *stream);
-
-static struct cleanup *make_cleanup_free_command_lines (struct command_line **);
-
 /* Default command line prompt.  This is overriden in some configs. */
 
 #ifndef DEFAULT_PROMPT
@@ -186,88 +141,6 @@
 
 int caution = 1;		/* Default is yes, sigh. */
 
-/* Define all cmd_list_elements.  */
-
-/* Chain containing all defined commands.  */
-
-struct cmd_list_element *cmdlist;
-
-/* Chain containing all defined info subcommands.  */
-
-struct cmd_list_element *infolist;
-
-/* Chain containing all defined enable subcommands. */
-
-struct cmd_list_element *enablelist;
-
-/* Chain containing all defined disable subcommands. */
-
-struct cmd_list_element *disablelist;
-
-/* Chain containing all defined toggle subcommands. */
-
-struct cmd_list_element *togglelist;
-
-/* Chain containing all defined stop subcommands. */
-
-struct cmd_list_element *stoplist;
-
-/* Chain containing all defined delete subcommands. */
-
-struct cmd_list_element *deletelist;
-
-/* Chain containing all defined "enable breakpoint" subcommands. */
-
-struct cmd_list_element *enablebreaklist;
-
-/* Chain containing all defined set subcommands */
-
-struct cmd_list_element *setlist;
-
-/* Chain containing all defined unset subcommands */
-
-struct cmd_list_element *unsetlist;
-
-/* Chain containing all defined show subcommands.  */
-
-struct cmd_list_element *showlist;
-
-/* Chain containing all defined \"set history\".  */
-
-struct cmd_list_element *sethistlist;
-
-/* Chain containing all defined \"show history\".  */
-
-struct cmd_list_element *showhistlist;
-
-/* Chain containing all defined \"unset history\".  */
-
-struct cmd_list_element *unsethistlist;
-
-/* Chain containing all defined maintenance subcommands. */
-
-struct cmd_list_element *maintenancelist;
-
-/* Chain containing all defined "maintenance info" subcommands. */
-
-struct cmd_list_element *maintenanceinfolist;
-
-/* Chain containing all defined "maintenance print" subcommands. */
-
-struct cmd_list_element *maintenanceprintlist;
-
-struct cmd_list_element *setprintlist;
-
-struct cmd_list_element *showprintlist;
-
-struct cmd_list_element *setdebuglist;
-
-struct cmd_list_element *showdebuglist;
-
-struct cmd_list_element *setchecklist;
-
-struct cmd_list_element *showchecklist;
-
 /* stdio stream that command input is being read from.  Set to stdin normally.
    Set by source_command to the file we are sourcing.  Set to NULL if we are
    executing a user-defined command or interacting via a GUI.  */
@@ -508,8 +381,7 @@
 /* Return for reason REASON to the nearest containing catch_errors().  */
 
 NORETURN void
-return_to_top_level (reason)
-     enum return_reason reason;
+return_to_top_level (enum return_reason reason)
 {
   quit_flag = 0;
   immediate_quit = 0;
@@ -570,16 +442,13 @@
    code also randomly used a SET_TOP_LEVEL macro that directly
    initialize the longjmp buffers. */
 
-/* MAYBE: cagney/1999-11-05: Should the catch_erros and cleanups code
+/* MAYBE: cagney/1999-11-05: Should the catch_errors and cleanups code
    be consolidated into a single file instead of being distributed
    between utils.c and top.c? */
 
 int
-catch_errors (func, args, errstring, mask)
-     catch_errors_ftype *func;
-     PTR args;
-     char *errstring;
-     return_mask mask;
+catch_errors (catch_errors_ftype *func, PTR args, char *errstring,
+	      return_mask mask)
 {
   SIGJMP_BUF *saved_catch;
   SIGJMP_BUF catch;
@@ -614,11 +483,13 @@
   caught = SIGSETJMP (catch);
   if (!caught)
     val = (*func) (args);
+  else
+    val = 0;
   catch_return = saved_catch;
 
-  /* FIXME: cagney/1999-11-05: A correct FUNC implementaton will
+  /* FIXME: cagney/1999-11-05: A correct FUNC implementation will
      clean things up (restoring the cleanup chain) to the state they
-     were just prior to the call.  Unfortunatly, many FUNC's are not
+     were just prior to the call.  Unfortunately, many FUNC's are not
      that well behaved.  This could be fixed by adding either a
      do_cleanups call (to cover the problem) or an assertion check to
      detect bad FUNCs code. */
@@ -681,7 +552,7 @@
   /* FIXME: cagney/1999-11-07: Technically this do_cleanups() call
      isn't needed.  Instead an assertion check could be made that
      simply confirmed that the called function correctly cleaned up
-     after its self.  Unfortunatly, old code (prior to 1999-11-04) in
+     after itself.  Unfortunately, old code (prior to 1999-11-04) in
      main.c was calling SET_TOP_LEVEL(), calling the command function,
      and then *always* calling do_cleanups().  For the moment we
      remain ``bug compatible'' with that old code..  */
@@ -705,8 +576,7 @@
 
 #ifdef SIGHUP
 static void
-disconnect (signo)
-     int signo;
+disconnect (int signo)
 {
   catch_errors (quit_cover, NULL,
 	      "Could not kill the program being debugged", RETURN_MASK_ALL);
@@ -720,8 +590,7 @@
    gdb to use the event loop as the default command loop and we merge
    event-top.c into this file, top.c */
 /* static */ int
-quit_cover (s)
-     PTR s;
+quit_cover (PTR s)
 {
   caution = 0;			/* Throw caution to the wind -- we're exiting.
 				   This prevents asking the user dumb questions.  */
@@ -760,7 +629,7 @@
 /* Clean up on error during a "source" command (or execution of a
    user-defined command).  */
 
-static void
+void
 do_restore_instream_cleanup (void *stream)
 {
   /* Restore the previous input stream.  */
@@ -769,8 +638,7 @@
 
 /* Read commands from STREAM.  */
 void
-read_command_file (stream)
-     FILE *stream;
+read_command_file (FILE *stream)
 {
   struct cleanup *cleanups;
 
@@ -789,13 +657,12 @@
 do_chdir_cleanup (void *old_dir)
 {
   chdir (old_dir);
-  free (old_dir);
+  xfree (old_dir);
 }
 #endif
 
 void
-gdb_init (argv0)
-     char *argv0;
+gdb_init (char *argv0)
 {
   if (pre_init_ui_hook)
     pre_init_ui_hook ();
@@ -816,6 +683,7 @@
   initialize_utils ();		/* Make errors and warnings possible */
   initialize_all_files ();
   initialize_current_architecture ();
+  init_cli_cmds();
   init_main ();			/* But that omits this file!  Do it now */
 
   /* The signal handling mechanism is different depending whether or
@@ -853,636 +721,11 @@
     init_ui_hook (argv0);
 }
 
-/* Allocate, initialize a new command line structure for one of the
-   control commands (if/while).  */
-
-static struct command_line *
-build_command_line (type, args)
-     enum command_control_type type;
-     char *args;
-{
-  struct command_line *cmd;
-
-  if (args == NULL)
-    error ("if/while commands require arguments.\n");
-
-  cmd = (struct command_line *) xmalloc (sizeof (struct command_line));
-  cmd->next = NULL;
-  cmd->control_type = type;
-
-  cmd->body_count = 1;
-  cmd->body_list
-    = (struct command_line **) xmalloc (sizeof (struct command_line *)
-					* cmd->body_count);
-  memset (cmd->body_list, 0, sizeof (struct command_line *) * cmd->body_count);
-  cmd->line = savestring (args, strlen (args));
-  return cmd;
-}
-
-/* Build and return a new command structure for the control commands
-   such as "if" and "while".  */
-
-static struct command_line *
-get_command_line (type, arg)
-     enum command_control_type type;
-     char *arg;
-{
-  struct command_line *cmd;
-  struct cleanup *old_chain = NULL;
-
-  /* Allocate and build a new command line structure.  */
-  cmd = build_command_line (type, arg);
-
-  old_chain = make_cleanup_free_command_lines (&cmd);
-
-  /* Read in the body of this command.  */
-  if (recurse_read_control_structure (cmd) == invalid_control)
-    {
-      warning ("error reading in control structure\n");
-      do_cleanups (old_chain);
-      return NULL;
-    }
-
-  discard_cleanups (old_chain);
-  return cmd;
-}
-
-/* Recursively print a command (including full control structures).  */
-#ifdef UI_OUT
-void
-print_command_lines (uiout, cmd, depth)
-     struct ui_out *uiout;
-     struct command_line *cmd;
-     unsigned int depth;
-{
-  struct command_line *list;
-
-  list = cmd;
-  while (list)
-    {
-
-      if (depth)
-	ui_out_spaces (uiout, 2 * depth);
-
-      /* A simple command, print it and continue.  */
-      if (list->control_type == simple_control)
-	{
-	  ui_out_field_string (uiout, NULL, list->line);
-	  ui_out_text (uiout, "\n");
-	  list = list->next;
-	  continue;
-	}
-
-      /* loop_continue to jump to the start of a while loop, print it
-         and continue. */
-      if (list->control_type == continue_control)
-	{
-	  ui_out_field_string (uiout, NULL, "loop_continue");
-	  ui_out_text (uiout, "\n");
-	  list = list->next;
-	  continue;
-	}
-
-      /* loop_break to break out of a while loop, print it and continue.  */
-      if (list->control_type == break_control)
-	{
-	  ui_out_field_string (uiout, NULL, "loop_break");
-	  ui_out_text (uiout, "\n");
-	  list = list->next;
-	  continue;
-	}
-
-      /* A while command.  Recursively print its subcommands and continue.  */
-      if (list->control_type == while_control)
-	{
-	  ui_out_text (uiout, "while ");
-	  ui_out_field_fmt (uiout, NULL, "while %s", list->line);
-	  ui_out_text (uiout, "\n");
-	  print_command_lines (uiout, *list->body_list, depth + 1);
-	  ui_out_field_string (uiout, NULL, "end");
-	  if (depth)
-	    ui_out_spaces (uiout, 2 * depth);
-	  ui_out_text (uiout, "end\n");
-	  list = list->next;
-	  continue;
-	}
-
-      /* An if command.  Recursively print both arms before continueing.  */
-      if (list->control_type == if_control)
-	{
-	  ui_out_text (uiout, "if ");
-	  ui_out_field_fmt (uiout, NULL, "if %s", list->line);
-	  ui_out_text (uiout, "\n");
-	  /* The true arm. */
-	  print_command_lines (uiout, list->body_list[0], depth + 1);
-
-	  /* Show the false arm if it exists.  */
-	  if (list->body_count == 2)
-	    {
-	      if (depth)
-		ui_out_spaces (uiout, 2 * depth);
-	      ui_out_field_string (uiout, NULL, "else");
-	      ui_out_text (uiout, "else\n");
-	      print_command_lines (uiout, list->body_list[1], depth + 1);
-	    }
-
-	  ui_out_field_string (uiout, NULL, "end");
-	  if (depth)
-	    ui_out_spaces (uiout, 2 * depth);
-	  ui_out_text (uiout, "end\n");
-	  list = list->next;
-	  continue;
-	}
-
-      /* ignore illegal command type and try next */
-      list = list->next;
-    }				/* while (list) */
-}
-#else
-void
-print_command_line (cmd, depth, stream)
-     struct command_line *cmd;
-     unsigned int depth;
-     struct ui_file *stream;
-{
-  unsigned int i;
-
-  if (depth)
-    {
-      for (i = 0; i < depth; i++)
-	fputs_filtered ("  ", stream);
-    }
-
-  /* A simple command, print it and return.  */
-  if (cmd->control_type == simple_control)
-    {
-      fputs_filtered (cmd->line, stream);
-      fputs_filtered ("\n", stream);
-      return;
-    }
-
-  /* loop_continue to jump to the start of a while loop, print it
-     and return. */
-  if (cmd->control_type == continue_control)
-    {
-      fputs_filtered ("loop_continue\n", stream);
-      return;
-    }
-
-  /* loop_break to break out of a while loop, print it and return.  */
-  if (cmd->control_type == break_control)
-    {
-      fputs_filtered ("loop_break\n", stream);
-      return;
-    }
-
-  /* A while command.  Recursively print its subcommands before returning.  */
-  if (cmd->control_type == while_control)
-    {
-      struct command_line *list;
-      fputs_filtered ("while ", stream);
-      fputs_filtered (cmd->line, stream);
-      fputs_filtered ("\n", stream);
-      list = *cmd->body_list;
-      while (list)
-	{
-	  print_command_line (list, depth + 1, stream);
-	  list = list->next;
-	}
-    }
-
-  /* An if command.  Recursively print both arms before returning.  */
-  if (cmd->control_type == if_control)
-    {
-      fputs_filtered ("if ", stream);
-      fputs_filtered (cmd->line, stream);
-      fputs_filtered ("\n", stream);
-      /* The true arm. */
-      print_command_line (cmd->body_list[0], depth + 1, stream);
-
-      /* Show the false arm if it exists.  */
-      if (cmd->body_count == 2)
-	{
-	  if (depth)
-	    {
-	      for (i = 0; i < depth; i++)
-		fputs_filtered ("  ", stream);
-	    }
-	  fputs_filtered ("else\n", stream);
-	  print_command_line (cmd->body_list[1], depth + 1, stream);
-	}
-      if (depth)
-	{
-	  for (i = 0; i < depth; i++)
-	    fputs_filtered ("  ", stream);
-	}
-      fputs_filtered ("end\n", stream);
-    }
-}
-#endif
-
-/* Execute the command in CMD.  */
-
-enum command_control_type
-execute_control_command (cmd)
-     struct command_line *cmd;
-{
-  struct expression *expr;
-  struct command_line *current;
-  struct cleanup *old_chain = 0;
-  value_ptr val;
-  value_ptr val_mark;
-  int loop;
-  enum command_control_type ret;
-  char *new_line;
-
-  switch (cmd->control_type)
-    {
-    case simple_control:
-      /* A simple command, execute it and return.  */
-      new_line = insert_args (cmd->line);
-      if (!new_line)
-	return invalid_control;
-      old_chain = make_cleanup (free_current_contents, &new_line);
-      execute_command (new_line, 0);
-      ret = cmd->control_type;
-      break;
-
-    case continue_control:
-    case break_control:
-      /* Return for "continue", and "break" so we can either
-         continue the loop at the top, or break out.  */
-      ret = cmd->control_type;
-      break;
-
-    case while_control:
-      {
-	/* Parse the loop control expression for the while statement.  */
-	new_line = insert_args (cmd->line);
-	if (!new_line)
-	  return invalid_control;
-	old_chain = make_cleanup (free_current_contents, &new_line);
-	expr = parse_expression (new_line);
-	make_cleanup (free_current_contents, &expr);
-
-	ret = simple_control;
-	loop = 1;
-
-	/* Keep iterating so long as the expression is true.  */
-	while (loop == 1)
-	  {
-	    int cond_result;
-
-	    QUIT;
-
-	    /* Evaluate the expression.  */
-	    val_mark = value_mark ();
-	    val = evaluate_expression (expr);
-	    cond_result = value_true (val);
-	    value_free_to_mark (val_mark);
-
-	    /* If the value is false, then break out of the loop.  */
-	    if (!cond_result)
-	      break;
-
-	    /* Execute the body of the while statement.  */
-	    current = *cmd->body_list;
-	    while (current)
-	      {
-		ret = execute_control_command (current);
-
-		/* If we got an error, or a "break" command, then stop
-		   looping.  */
-		if (ret == invalid_control || ret == break_control)
-		  {
-		    loop = 0;
-		    break;
-		  }
-
-		/* If we got a "continue" command, then restart the loop
-		   at this point.  */
-		if (ret == continue_control)
-		  break;
-
-		/* Get the next statement.  */
-		current = current->next;
-	      }
-	  }
-
-	/* Reset RET so that we don't recurse the break all the way down.  */
-	if (ret == break_control)
-	  ret = simple_control;
-
-	break;
-      }
-
-    case if_control:
-      {
-	new_line = insert_args (cmd->line);
-	if (!new_line)
-	  return invalid_control;
-	old_chain = make_cleanup (free_current_contents, &new_line);
-	/* Parse the conditional for the if statement.  */
-	expr = parse_expression (new_line);
-	make_cleanup (free_current_contents, &expr);
-
-	current = NULL;
-	ret = simple_control;
-
-	/* Evaluate the conditional.  */
-	val_mark = value_mark ();
-	val = evaluate_expression (expr);
-
-	/* Choose which arm to take commands from based on the value of the
-	   conditional expression.  */
-	if (value_true (val))
-	  current = *cmd->body_list;
-	else if (cmd->body_count == 2)
-	  current = *(cmd->body_list + 1);
-	value_free_to_mark (val_mark);
-
-	/* Execute commands in the given arm.  */
-	while (current)
-	  {
-	    ret = execute_control_command (current);
-
-	    /* If we got an error, get out.  */
-	    if (ret != simple_control)
-	      break;
-
-	    /* Get the next statement in the body.  */
-	    current = current->next;
-	  }
-
-	break;
-      }
-
-    default:
-      warning ("Invalid control type in command structure.");
-      return invalid_control;
-    }
-
-  if (old_chain)
-    do_cleanups (old_chain);
-
-  return ret;
-}
-
-/* "while" command support.  Executes a body of statements while the
-   loop condition is nonzero.  */
-
-static void
-while_command (arg, from_tty)
-     char *arg;
-     int from_tty;
-{
-  struct command_line *command = NULL;
-
-  control_level = 1;
-  command = get_command_line (while_control, arg);
-
-  if (command == NULL)
-    return;
-
-  execute_control_command (command);
-  free_command_lines (&command);
-}
-
-/* "if" command support.  Execute either the true or false arm depending
-   on the value of the if conditional.  */
-
-static void
-if_command (arg, from_tty)
-     char *arg;
-     int from_tty;
-{
-  struct command_line *command = NULL;
-
-  control_level = 1;
-  command = get_command_line (if_control, arg);
-
-  if (command == NULL)
-    return;
-
-  execute_control_command (command);
-  free_command_lines (&command);
-}
-
-/* Cleanup */
-static void
-arg_cleanup (void *ignore)
-{
-  struct user_args *oargs = user_args;
-  if (!user_args)
-    internal_error ("Internal error, arg_cleanup called with no user args.\n");
-
-  user_args = user_args->next;
-  free (oargs);
-}
-
-/* Bind the incomming arguments for a user defined command to
-   $arg0, $arg1 ... $argMAXUSERARGS.  */
-
-static struct cleanup *
-setup_user_args (p)
-     char *p;
-{
-  struct user_args *args;
-  struct cleanup *old_chain;
-  unsigned int arg_count = 0;
-
-  args = (struct user_args *) xmalloc (sizeof (struct user_args));
-  memset (args, 0, sizeof (struct user_args));
-
-  args->next = user_args;
-  user_args = args;
-
-  old_chain = make_cleanup (arg_cleanup, 0/*ignored*/);
-
-  if (p == NULL)
-    return old_chain;
-
-  while (*p)
-    {
-      char *start_arg;
-      int squote = 0;
-      int dquote = 0;
-      int bsquote = 0;
-
-      if (arg_count >= MAXUSERARGS)
-	{
-	  error ("user defined function may only have %d arguments.\n",
-		 MAXUSERARGS);
-	  return old_chain;
-	}
-
-      /* Strip whitespace.  */
-      while (*p == ' ' || *p == '\t')
-	p++;
-
-      /* P now points to an argument.  */
-      start_arg = p;
-      user_args->a[arg_count].arg = p;
-
-      /* Get to the end of this argument.  */
-      while (*p)
-	{
-	  if (((*p == ' ' || *p == '\t')) && !squote && !dquote && !bsquote)
-	    break;
-	  else
-	    {
-	      if (bsquote)
-		bsquote = 0;
-	      else if (*p == '\\')
-		bsquote = 1;
-	      else if (squote)
-		{
-		  if (*p == '\'')
-		    squote = 0;
-		}
-	      else if (dquote)
-		{
-		  if (*p == '"')
-		    dquote = 0;
-		}
-	      else
-		{
-		  if (*p == '\'')
-		    squote = 1;
-		  else if (*p == '"')
-		    dquote = 1;
-		}
-	      p++;
-	    }
-	}
-
-      user_args->a[arg_count].len = p - start_arg;
-      arg_count++;
-      user_args->count++;
-    }
-  return old_chain;
-}
-
-/* Given character string P, return a point to the first argument ($arg),
-   or NULL if P contains no arguments.  */
-
-static char *
-locate_arg (p)
-     char *p;
-{
-  while ((p = strchr (p, '$')))
-    {
-      if (strncmp (p, "$arg", 4) == 0 && isdigit (p[4]))
-	return p;
-      p++;
-    }
-  return NULL;
-}
-
-/* Insert the user defined arguments stored in user_arg into the $arg
-   arguments found in line, with the updated copy being placed into nline.  */
-
-static char *
-insert_args (line)
-     char *line;
-{
-  char *p, *save_line, *new_line;
-  unsigned len, i;
-
-  /* First we need to know how much memory to allocate for the new line.  */
-  save_line = line;
-  len = 0;
-  while ((p = locate_arg (line)))
-    {
-      len += p - line;
-      i = p[4] - '0';
-
-      if (i >= user_args->count)
-	{
-	  error ("Missing argument %d in user function.\n", i);
-	  return NULL;
-	}
-      len += user_args->a[i].len;
-      line = p + 5;
-    }
-
-  /* Don't forget the tail.  */
-  len += strlen (line);
-
-  /* Allocate space for the new line and fill it in.  */
-  new_line = (char *) xmalloc (len + 1);
-  if (new_line == NULL)
-    return NULL;
-
-  /* Restore pointer to beginning of old line.  */
-  line = save_line;
-
-  /* Save pointer to beginning of new line.  */
-  save_line = new_line;
-
-  while ((p = locate_arg (line)))
-    {
-      int i, len;
-
-      memcpy (new_line, line, p - line);
-      new_line += p - line;
-      i = p[4] - '0';
-
-      len = user_args->a[i].len;
-      if (len)
-	{
-	  memcpy (new_line, user_args->a[i].arg, len);
-	  new_line += len;
-	}
-      line = p + 5;
-    }
-  /* Don't forget the tail.  */
-  strcpy (new_line, line);
-
-  /* Return a pointer to the beginning of the new line.  */
-  return save_line;
-}
-
-void
-execute_user_command (c, args)
-     struct cmd_list_element *c;
-     char *args;
-{
-  register struct command_line *cmdlines;
-  struct cleanup *old_chain;
-  enum command_control_type ret;
-
-  old_chain = setup_user_args (args);
-
-  cmdlines = c->user_commands;
-  if (cmdlines == 0)
-    /* Null command */
-    return;
-
-  /* Set the instream to 0, indicating execution of a
-     user-defined function.  */
-  old_chain = make_cleanup (do_restore_instream_cleanup, instream);
-  instream = (FILE *) 0;
-  while (cmdlines)
-    {
-      ret = execute_control_command (cmdlines);
-      if (ret != simple_control && ret != break_control)
-	{
-	  warning ("Error in control structure.\n");
-	  break;
-	}
-      cmdlines = cmdlines->next;
-    }
-  do_cleanups (old_chain);
-}
-
 /* Execute the line P as a command.
    Pass FROM_TTY as second argument to the defining function.  */
 
 void
-execute_command (p, from_tty)
-     char *p;
-     int from_tty;
+execute_command (char *p, int from_tty)
 {
   register struct cmd_list_element *c;
   register enum language flang;
@@ -1525,7 +768,9 @@
       arg = *p ? p : 0;
 
       /* Clear off trailing whitespace, except for set and complete command.  */
-      if (arg && c->type != set_cmd && c->function.cfunc != complete_command)
+      if (arg
+	  && c->type != set_cmd
+	  && !is_complete_command (c->function.cfunc))
 	{
 	  p = arg + strlen (arg) - 1;
 	  while (p >= arg && (*p == ' ' || *p == '\t'))
@@ -1533,9 +778,13 @@
 	  *(p + 1) = '\0';
 	}
 
-      /* If this command has been hooked, run the hook first. */
-      if (c->hook)
-	execute_user_command (c->hook, (char *) 0);
+      /* If this command has been pre-hooked, run the hook first. */
+      if ((c->hook_pre) && (!c->hook_in))
+      {
+        c->hook_in = 1; /* Prevent recursive hooking */
+        execute_user_command (c->hook_pre, (char *) 0);
+        c->hook_in = 0; /* Allow hook to work again once it is complete */
+      }
 
       if (c->flags & DEPRECATED_WARN_USER)
 	deprecated_cmd_warning (&line);
@@ -1550,6 +799,15 @@
 	call_command_hook (c, arg, from_tty & caution);
       else
 	(*c->function.cfunc) (arg, from_tty & caution);
+       
+      /* If this command has been post-hooked, run the hook last. */
+      if ((c->hook_post) && (!c->hook_in))
+      {
+        c->hook_in = 1; /* Prevent recursive hooking */
+        execute_user_command (c->hook_post, (char *) 0);
+        c->hook_in = 0; /* allow hook to work again once it is complete */
+      }
+
     }
 
   /* Tell the user if the language has changed (except first time).  */
@@ -1581,20 +839,11 @@
     }
 }
 
-/* ARGSUSED */
-/* NOTE 1999-04-29: This function will be static again, once we modify
-   gdb to use the event loop as the default command loop and we merge
-   event-top.c into this file, top.c */
-/* static */ void
-command_loop_marker (void *foo)
-{
-}
-
 /* Read commands from `instream' and execute them
    until end of file or error reading instream.  */
 
 void
-command_loop ()
+command_loop (void)
 {
   struct cleanup *old_chain;
   char *command;
@@ -1617,7 +866,7 @@
       quit_flag = 0;
       if (instream == stdin && stdin_is_tty)
 	reinitialize_more_filter ();
-      old_chain = make_cleanup (command_loop_marker, 0);
+      old_chain = make_cleanup (null_cleanup, 0);
 
 #if defined(TUI)
       /* A bit of paranoia: I want to make sure the "insert_mode" global
@@ -1685,9 +934,8 @@
    such things as displaying time and space usage. If the user asks
    for those, they won't work. */
 void
-simplified_command_loop (read_input_func, execute_command_func)
-     char *(*read_input_func) (char *);
-     void (*execute_command_func) (char *, int);
+simplified_command_loop (char *(*read_input_func) (char *),
+			 void (*execute_command_func) (char *, int))
 {
   struct cleanup *old_chain;
   char *command;
@@ -1698,7 +946,7 @@
       quit_flag = 0;
       if (instream == stdin && stdin_is_tty)
 	reinitialize_more_filter ();
-      old_chain = make_cleanup (command_loop_marker, 0);
+      old_chain = make_cleanup (null_cleanup, 0);
 
       /* Get a command-line. */
       command = (*read_input_func) (instream == stdin ?
@@ -1719,7 +967,7 @@
 /* Commands call this if they do not want to be repeated by null lines.  */
 
 void
-dont_repeat ()
+dont_repeat (void)
 {
   if (server_command)
     return;
@@ -1739,8 +987,7 @@
 
    A NULL return means end of file.  */
 char *
-gdb_readline (prompt_arg)
-     char *prompt_arg;
+gdb_readline (char *prompt_arg)
 {
   int c;
   char *result;
@@ -1776,7 +1023,7 @@
 	       if we are called again fgetc will still return EOF and
 	       we'll return NULL then.  */
 	    break;
-	  free (result);
+	  xfree (result);
 	  return NULL;
 	}
 
@@ -1815,460 +1062,28 @@
 static int history_size;
 static char *history_filename;
 
-/* readline uses the word breaks for two things:
-   (1) In figuring out where to point the TEXT parameter to the
-   rl_completion_entry_function.  Since we don't use TEXT for much,
-   it doesn't matter a lot what the word breaks are for this purpose, but
-   it does affect how much stuff M-? lists.
-   (2) If one of the matches contains a word break character, readline
-   will quote it.  That's why we switch between
-   gdb_completer_word_break_characters and
-   gdb_completer_command_word_break_characters.  I'm not sure when
-   we need this behavior (perhaps for funky characters in C++ symbols?).  */
-
-/* Variables which are necessary for fancy command line editing.  */
-char *gdb_completer_word_break_characters =
-" \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,-";
-
-/* When completing on command names, we remove '-' from the list of
-   word break characters, since we use it in command names.  If the
-   readline library sees one in any of the current completion strings,
-   it thinks that the string needs to be quoted and automatically supplies
-   a leading quote. */
-char *gdb_completer_command_word_break_characters =
-" \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,";
-
-/* When completing on file names, we remove from the list of word
-   break characters any characters that are commonly used in file
-   names, such as '-', '+', '~', etc.  Otherwise, readline displays
-   incorrect completion candidates.  */
-char *gdb_completer_file_name_break_characters = " \t\n*|\"';:?/><";
-
-/* Characters that can be used to quote completion strings.  Note that we
-   can't include '"' because the gdb C parser treats such quoted sequences
-   as strings. */
-char *gdb_completer_quote_characters =
-"'";
-
 /* Functions that are used as part of the fancy command line editing.  */
 
 /* This can be used for functions which don't want to complete on symbols
    but don't want to complete on anything else either.  */
 /* ARGSUSED */
 char **
-noop_completer (text, prefix)
-     char *text;
-     char *prefix;
+noop_completer (char *text, char *prefix)
 {
   return NULL;
 }
 
-/* Complete on filenames.  */
-char **
-filename_completer (text, word)
-     char *text;
-     char *word;
-{
-  /* From readline.  */
-extern char *filename_completion_function (char *, int);
-  int subsequent_name;
-  char **return_val;
-  int return_val_used;
-  int return_val_alloced;
-
-  return_val_used = 0;
-  /* Small for testing.  */
-  return_val_alloced = 1;
-  return_val = (char **) xmalloc (return_val_alloced * sizeof (char *));
-
-  subsequent_name = 0;
-  while (1)
-    {
-      char *p;
-      p = filename_completion_function (text, subsequent_name);
-      if (return_val_used >= return_val_alloced)
-	{
-	  return_val_alloced *= 2;
-	  return_val =
-	    (char **) xrealloc (return_val,
-				return_val_alloced * sizeof (char *));
-	}
-      if (p == NULL)
-	{
-	  return_val[return_val_used++] = p;
-	  break;
-	}
-      /* We need to set subsequent_name to a non-zero value before the
-	 continue line below, because otherwise, if the first file seen
-	 by GDB is a backup file whose name ends in a `~', we will loop
-	 indefinitely.  */
-      subsequent_name = 1;
-      /* Like emacs, don't complete on old versions.  Especially useful
-         in the "source" command.  */
-      if (p[strlen (p) - 1] == '~')
-	continue;
-
-      {
-	char *q;
-	if (word == text)
-	  /* Return exactly p.  */
-	  return_val[return_val_used++] = p;
-	else if (word > text)
-	  {
-	    /* Return some portion of p.  */
-	    q = xmalloc (strlen (p) + 5);
-	    strcpy (q, p + (word - text));
-	    return_val[return_val_used++] = q;
-	    free (p);
-	  }
-	else
-	  {
-	    /* Return some of TEXT plus p.  */
-	    q = xmalloc (strlen (p) + (text - word) + 5);
-	    strncpy (q, word, text - word);
-	    q[text - word] = '\0';
-	    strcat (q, p);
-	    return_val[return_val_used++] = q;
-	    free (p);
-	  }
-      }
-    }
-#if 0
-  /* There is no way to do this just long enough to affect quote inserting
-     without also affecting the next completion.  This should be fixed in
-     readline.  FIXME.  */
-  /* Insure that readline does the right thing
-     with respect to inserting quotes.  */
-  rl_completer_word_break_characters = "";
-#endif
-  return return_val;
-}
-
-/* Here are some useful test cases for completion.  FIXME: These should
-   be put in the test suite.  They should be tested with both M-? and TAB.
-
-   "show output-" "radix"
-   "show output" "-radix"
-   "p" ambiguous (commands starting with p--path, print, printf, etc.)
-   "p "  ambiguous (all symbols)
-   "info t foo" no completions
-   "info t " no completions
-   "info t" ambiguous ("info target", "info terminal", etc.)
-   "info ajksdlfk" no completions
-   "info ajksdlfk " no completions
-   "info" " "
-   "info " ambiguous (all info commands)
-   "p \"a" no completions (string constant)
-   "p 'a" ambiguous (all symbols starting with a)
-   "p b-a" ambiguous (all symbols starting with a)
-   "p b-" ambiguous (all symbols)
-   "file Make" "file" (word break hard to screw up here)
-   "file ../gdb.stabs/we" "ird" (needs to not break word at slash)
- */
-
-/* Generate completions one by one for the completer.  Each time we are
-   called return another potential completion to the caller.
-   line_completion just completes on commands or passes the buck to the
-   command's completer function, the stuff specific to symbol completion
-   is in make_symbol_completion_list.
-
-   TEXT is the caller's idea of the "word" we are looking at.
-
-   MATCHES is the number of matches that have currently been collected from
-   calling this completion function.  When zero, then we need to initialize,
-   otherwise the initialization has already taken place and we can just
-   return the next potential completion string.
-
-   LINE_BUFFER is available to be looked at; it contains the entire text
-   of the line.  POINT is the offset in that line of the cursor.  You
-   should pretend that the line ends at POINT.
-
-   Returns NULL if there are no more completions, else a pointer to a string
-   which is a possible completion, it is the caller's responsibility to
-   free the string.  */
-
-static char *
-line_completion_function (text, matches, line_buffer, point)
-     char *text;
-     int matches;
-     char *line_buffer;
-     int point;
-{
-  static char **list = (char **) NULL;	/* Cache of completions */
-  static int index;		/* Next cached completion */
-  char *output = NULL;
-  char *tmp_command, *p;
-  /* Pointer within tmp_command which corresponds to text.  */
-  char *word;
-  struct cmd_list_element *c, *result_list;
-
-  if (matches == 0)
-    {
-      /* The caller is beginning to accumulate a new set of completions, so
-         we need to find all of them now, and cache them for returning one at
-         a time on future calls. */
-
-      if (list)
-	{
-	  /* Free the storage used by LIST, but not by the strings inside.
-	     This is because rl_complete_internal () frees the strings. */
-	  free ((PTR) list);
-	}
-      list = 0;
-      index = 0;
-
-      /* Choose the default set of word break characters to break completions.
-         If we later find out that we are doing completions on command strings
-         (as opposed to strings supplied by the individual command completer
-         functions, which can be any string) then we will switch to the
-         special word break set for command strings, which leaves out the
-         '-' character used in some commands.  */
-
-      rl_completer_word_break_characters =
-	gdb_completer_word_break_characters;
-
-      /* Decide whether to complete on a list of gdb commands or on symbols. */
-      tmp_command = (char *) alloca (point + 1);
-      p = tmp_command;
-
-      strncpy (tmp_command, line_buffer, point);
-      tmp_command[point] = '\0';
-      /* Since text always contains some number of characters leading up
-         to point, we can find the equivalent position in tmp_command
-         by subtracting that many characters from the end of tmp_command.  */
-      word = tmp_command + point - strlen (text);
-
-      if (point == 0)
-	{
-	  /* An empty line we want to consider ambiguous; that is, it
-	     could be any command.  */
-	  c = (struct cmd_list_element *) -1;
-	  result_list = 0;
-	}
-      else
-	{
-	  c = lookup_cmd_1 (&p, cmdlist, &result_list, 1);
-	}
-
-      /* Move p up to the next interesting thing.  */
-      while (*p == ' ' || *p == '\t')
-	{
-	  p++;
-	}
-
-      if (!c)
-	{
-	  /* It is an unrecognized command.  So there are no
-	     possible completions.  */
-	  list = NULL;
-	}
-      else if (c == (struct cmd_list_element *) -1)
-	{
-	  char *q;
-
-	  /* lookup_cmd_1 advances p up to the first ambiguous thing, but
-	     doesn't advance over that thing itself.  Do so now.  */
-	  q = p;
-	  while (*q && (isalnum (*q) || *q == '-' || *q == '_'))
-	    ++q;
-	  if (q != tmp_command + point)
-	    {
-	      /* There is something beyond the ambiguous
-	         command, so there are no possible completions.  For
-	         example, "info t " or "info t foo" does not complete
-	         to anything, because "info t" can be "info target" or
-	         "info terminal".  */
-	      list = NULL;
-	    }
-	  else
-	    {
-	      /* We're trying to complete on the command which was ambiguous.
-	         This we can deal with.  */
-	      if (result_list)
-		{
-		  list = complete_on_cmdlist (*result_list->prefixlist, p,
-					      word);
-		}
-	      else
-		{
-		  list = complete_on_cmdlist (cmdlist, p, word);
-		}
-	      /* Insure that readline does the right thing with respect to
-	         inserting quotes.  */
-	      rl_completer_word_break_characters =
-		gdb_completer_command_word_break_characters;
-	    }
-	}
-      else
-	{
-	  /* We've recognized a full command.  */
-
-	  if (p == tmp_command + point)
-	    {
-	      /* There is no non-whitespace in the line beyond the command.  */
-
-	      if (p[-1] == ' ' || p[-1] == '\t')
-		{
-		  /* The command is followed by whitespace; we need to complete
-		     on whatever comes after command.  */
-		  if (c->prefixlist)
-		    {
-		      /* It is a prefix command; what comes after it is
-		         a subcommand (e.g. "info ").  */
-		      list = complete_on_cmdlist (*c->prefixlist, p, word);
-
-		      /* Insure that readline does the right thing
-		         with respect to inserting quotes.  */
-		      rl_completer_word_break_characters =
-			gdb_completer_command_word_break_characters;
-		    }
-		  else if (c->enums)
-		    {
-		      list = complete_on_enum (c->enums, p, word);
-		      rl_completer_word_break_characters =
-			gdb_completer_command_word_break_characters;
-		    }
-		  else
-		    {
-		      /* It is a normal command; what comes after it is
-		         completed by the command's completer function.  */
-		      list = (*c->completer) (p, word);
-		      if (c->completer == filename_completer)
-			rl_completer_word_break_characters =
-			  gdb_completer_file_name_break_characters;
-		    }
-		}
-	      else
-		{
-		  /* The command is not followed by whitespace; we need to
-		     complete on the command itself.  e.g. "p" which is a
-		     command itself but also can complete to "print", "ptype"
-		     etc.  */
-		  char *q;
-
-		  /* Find the command we are completing on.  */
-		  q = p;
-		  while (q > tmp_command)
-		    {
-		      if (isalnum (q[-1]) || q[-1] == '-' || q[-1] == '_')
-			--q;
-		      else
-			break;
-		    }
-
-		  list = complete_on_cmdlist (result_list, q, word);
-
-		  /* Insure that readline does the right thing
-		     with respect to inserting quotes.  */
-		  rl_completer_word_break_characters =
-		    gdb_completer_command_word_break_characters;
-		}
-	    }
-	  else
-	    {
-	      /* There is non-whitespace beyond the command.  */
-
-	      if (c->prefixlist && !c->allow_unknown)
-		{
-		  /* It is an unrecognized subcommand of a prefix command,
-		     e.g. "info adsfkdj".  */
-		  list = NULL;
-		}
-	      else if (c->enums)
-		{
-		  list = complete_on_enum (c->enums, p, word);
-		}
-	      else
-		{
-		  /* It is a normal command.  */
-		  list = (*c->completer) (p, word);
-		  if (c->completer == filename_completer)
-		    rl_completer_word_break_characters =
-		      gdb_completer_file_name_break_characters;
-		}
-	    }
-	}
-    }
-
-  /* If we found a list of potential completions during initialization then
-     dole them out one at a time.  The vector of completions is NULL
-     terminated, so after returning the last one, return NULL (and continue
-     to do so) each time we are called after that, until a new list is
-     available. */
-
-  if (list)
-    {
-      output = list[index];
-      if (output)
-	{
-	  index++;
-	}
-    }
-
-#if 0
-  /* Can't do this because readline hasn't yet checked the word breaks
-     for figuring out whether to insert a quote.  */
-  if (output == NULL)
-    /* Make sure the word break characters are set back to normal for the
-       next time that readline tries to complete something.  */
-    rl_completer_word_break_characters =
-      gdb_completer_word_break_characters;
-#endif
-
-  return (output);
-}
-
 /* Line completion interface function for readline.  */
 
 static char *
-readline_line_completion_function (text, matches)
-     char *text;
-     int matches;
+readline_line_completion_function (char *text, int matches)
 {
   return line_completion_function (text, matches, rl_line_buffer, rl_point);
 }
-
-/* Skip over a possibly quoted word (as defined by the quote characters
-   and word break characters the completer uses).  Returns pointer to the
-   location after the "word". */
-
-char *
-skip_quoted (str)
-     char *str;
-{
-  char quote_char = '\0';
-  char *scan;
-
-  for (scan = str; *scan != '\0'; scan++)
-    {
-      if (quote_char != '\0')
-	{
-	  /* Ignore everything until the matching close quote char */
-	  if (*scan == quote_char)
-	    {
-	      /* Found matching close quote. */
-	      scan++;
-	      break;
-	    }
-	}
-      else if (strchr (gdb_completer_quote_characters, *scan))
-	{
-	  /* Found start of a quoted string. */
-	  quote_char = *scan;
-	}
-      else if (strchr (gdb_completer_word_break_characters, *scan))
-	{
-	  break;
-	}
-    }
-  return (scan);
-}
 
-
 #ifdef STOP_SIGNAL
 static void
-stop_sig (signo)
-     int signo;
+stop_sig (int signo)
 {
 #if STOP_SIGNAL == SIGTSTP
   signal (SIGTSTP, SIG_DFL);
@@ -2288,8 +1103,7 @@
 
 /* Initialize signal handlers. */
 static void
-do_nothing (signo)
-     int signo;
+do_nothing (int signo)
 {
   /* Under System V the default disposition of a signal is reinstated after
      the signal is caught and delivered to an application process.  On such
@@ -2301,7 +1115,7 @@
 }
 
 static void
-init_signals ()
+init_signals (void)
 {
   signal (SIGINT, request_quit);
 
@@ -2347,10 +1161,7 @@
    simple input as the user has requested.  */
 
 char *
-command_line_input (prompt_arg, repeat, annotation_suffix)
-     char *prompt_arg;
-     int repeat;
-     char *annotation_suffix;
+command_line_input (char *prompt_arg, int repeat, char *annotation_suffix)
 {
   static char *linebuffer = 0;
   static unsigned linelength = 0;
@@ -2464,7 +1275,7 @@
       while (*p1)
 	*p++ = *p1++;
 
-      free (rl);		/* Allocated in readline.  */
+      xfree (rl);		/* Allocated in readline.  */
 
       if (p == linebuffer || *(p - 1) != '\\')
 	break;
@@ -2512,7 +1323,7 @@
 	  /* If there was an error, call this function again.  */
 	  if (expanded < 0)
 	    {
-	      free (history_value);
+	      xfree (history_value);
 	      return command_line_input (prompt_arg, repeat, annotation_suffix);
 	    }
 	  if (strlen (history_value) > linelength)
@@ -2522,7 +1333,7 @@
 	    }
 	  strcpy (linebuffer, history_value);
 	  p = linebuffer + strlen (linebuffer);
-	  free (history_value);
+	  xfree (history_value);
 	}
     }
 
@@ -2566,646 +1377,17 @@
   return linebuffer;
 }
 
-
-/* Expand the body_list of COMMAND so that it can hold NEW_LENGTH
-   code bodies.  This is typically used when we encounter an "else"
-   clause for an "if" command.  */
-
-static void
-realloc_body_list (command, new_length)
-     struct command_line *command;
-     int new_length;
-{
-  int n;
-  struct command_line **body_list;
-
-  n = command->body_count;
-
-  /* Nothing to do?  */
-  if (new_length <= n)
-    return;
-
-  body_list = (struct command_line **)
-    xmalloc (sizeof (struct command_line *) * new_length);
-
-  memcpy (body_list, command->body_list, sizeof (struct command_line *) * n);
-
-  free (command->body_list);
-  command->body_list = body_list;
-  command->body_count = new_length;
-}
-
-/* Read one line from the input stream.  If the command is an "else" or
-   "end", return such an indication to the caller.  */
-
-static enum misc_command_type
-read_next_line (command)
-     struct command_line **command;
-{
-  char *p, *p1, *prompt_ptr, control_prompt[256];
-  int i = 0;
-
-  if (control_level >= 254)
-    error ("Control nesting too deep!\n");
-
-  /* Set a prompt based on the nesting of the control commands.  */
-  if (instream == stdin || (instream == 0 && readline_hook != NULL))
-    {
-      for (i = 0; i < control_level; i++)
-	control_prompt[i] = ' ';
-      control_prompt[i] = '>';
-      control_prompt[i + 1] = '\0';
-      prompt_ptr = (char *) &control_prompt[0];
-    }
-  else
-    prompt_ptr = NULL;
-
-  p = command_line_input (prompt_ptr, instream == stdin, "commands");
-
-  /* Not sure what to do here.  */
-  if (p == NULL)
-    return end_command;
-
-  /* Strip leading and trailing whitespace.  */
-  while (*p == ' ' || *p == '\t')
-    p++;
-
-  p1 = p + strlen (p);
-  while (p1 != p && (p1[-1] == ' ' || p1[-1] == '\t'))
-    p1--;
-
-  /* Blanks and comments don't really do anything, but we need to
-     distinguish them from else, end and other commands which can be
-     executed.  */
-  if (p1 == p || p[0] == '#')
-    return nop_command;
-
-  /* Is this the end of a simple, while, or if control structure?  */
-  if (p1 - p == 3 && !strncmp (p, "end", 3))
-    return end_command;
-
-  /* Is the else clause of an if control structure?  */
-  if (p1 - p == 4 && !strncmp (p, "else", 4))
-    return else_command;
-
-  /* Check for while, if, break, continue, etc and build a new command
-     line structure for them.  */
-  if (p1 - p > 5 && !strncmp (p, "while", 5))
-    *command = build_command_line (while_control, p + 6);
-  else if (p1 - p > 2 && !strncmp (p, "if", 2))
-    *command = build_command_line (if_control, p + 3);
-  else if (p1 - p == 10 && !strncmp (p, "loop_break", 10))
-    {
-      *command = (struct command_line *)
-	xmalloc (sizeof (struct command_line));
-      (*command)->next = NULL;
-      (*command)->line = NULL;
-      (*command)->control_type = break_control;
-      (*command)->body_count = 0;
-      (*command)->body_list = NULL;
-    }
-  else if (p1 - p == 13 && !strncmp (p, "loop_continue", 13))
-    {
-      *command = (struct command_line *)
-	xmalloc (sizeof (struct command_line));
-      (*command)->next = NULL;
-      (*command)->line = NULL;
-      (*command)->control_type = continue_control;
-      (*command)->body_count = 0;
-      (*command)->body_list = NULL;
-    }
-  else
-    {
-      /* A normal command.  */
-      *command = (struct command_line *)
-	xmalloc (sizeof (struct command_line));
-      (*command)->next = NULL;
-      (*command)->line = savestring (p, p1 - p);
-      (*command)->control_type = simple_control;
-      (*command)->body_count = 0;
-      (*command)->body_list = NULL;
-    }
-
-  /* Nothing special.  */
-  return ok_command;
-}
-
-/* Recursively read in the control structures and create a command_line 
-   structure from them.
-
-   The parent_control parameter is the control structure in which the
-   following commands are nested.  */
-
-static enum command_control_type
-recurse_read_control_structure (current_cmd)
-     struct command_line *current_cmd;
-{
-  int current_body, i;
-  enum misc_command_type val;
-  enum command_control_type ret;
-  struct command_line **body_ptr, *child_tail, *next;
-
-  child_tail = NULL;
-  current_body = 1;
-
-  /* Sanity checks.  */
-  if (current_cmd->control_type == simple_control)
-    {
-      error ("Recursed on a simple control type\n");
-      return invalid_control;
-    }
-
-  if (current_body > current_cmd->body_count)
-    {
-      error ("Allocated body is smaller than this command type needs\n");
-      return invalid_control;
-    }
-
-  /* Read lines from the input stream and build control structures.  */
-  while (1)
-    {
-      dont_repeat ();
-
-      next = NULL;
-      val = read_next_line (&next);
-
-      /* Just skip blanks and comments.  */
-      if (val == nop_command)
-	continue;
-
-      if (val == end_command)
-	{
-	  if (current_cmd->control_type == while_control
-	      || current_cmd->control_type == if_control)
-	    {
-	      /* Success reading an entire control structure.  */
-	      ret = simple_control;
-	      break;
-	    }
-	  else
-	    {
-	      ret = invalid_control;
-	      break;
-	    }
-	}
-
-      /* Not the end of a control structure.  */
-      if (val == else_command)
-	{
-	  if (current_cmd->control_type == if_control
-	      && current_body == 1)
-	    {
-	      realloc_body_list (current_cmd, 2);
-	      current_body = 2;
-	      child_tail = NULL;
-	      continue;
-	    }
-	  else
-	    {
-	      ret = invalid_control;
-	      break;
-	    }
-	}
-
-      if (child_tail)
-	{
-	  child_tail->next = next;
-	}
-      else
-	{
-	  body_ptr = current_cmd->body_list;
-	  for (i = 1; i < current_body; i++)
-	    body_ptr++;
-
-	  *body_ptr = next;
-
-	}
-
-      child_tail = next;
-
-      /* If the latest line is another control structure, then recurse
-         on it.  */
-      if (next->control_type == while_control
-	  || next->control_type == if_control)
-	{
-	  control_level++;
-	  ret = recurse_read_control_structure (next);
-	  control_level--;
-
-	  if (ret != simple_control)
-	    break;
-	}
-    }
-
-  dont_repeat ();
-
-  return ret;
-}
-
-/* Read lines from the input stream and accumulate them in a chain of
-   struct command_line's, which is then returned.  For input from a
-   terminal, the special command "end" is used to mark the end of the
-   input, and is not included in the returned chain of commands. */
-
-#define END_MESSAGE "End with a line saying just \"end\"."
-
-struct command_line *
-read_command_lines (prompt_arg, from_tty)
-     char *prompt_arg;
-     int from_tty;
-{
-  struct command_line *head, *tail, *next;
-  struct cleanup *old_chain;
-  enum command_control_type ret;
-  enum misc_command_type val;
-
-  control_level = 0;
-  if (readline_begin_hook)
-    {
-      /* Note - intentional to merge messages with no newline */
-      (*readline_begin_hook) ("%s  %s\n", prompt_arg, END_MESSAGE);
-    }
-  else if (from_tty && input_from_terminal_p ())
-    {
-      printf_unfiltered ("%s\n%s\n", prompt_arg, END_MESSAGE);
-      gdb_flush (gdb_stdout);
-    }
-
-  head = tail = NULL;
-  old_chain = NULL;
-
-  while (1)
-    {
-      val = read_next_line (&next);
-
-      /* Ignore blank lines or comments.  */
-      if (val == nop_command)
-	continue;
-
-      if (val == end_command)
-	{
-	  ret = simple_control;
-	  break;
-	}
-
-      if (val != ok_command)
-	{
-	  ret = invalid_control;
-	  break;
-	}
-
-      if (next->control_type == while_control
-	  || next->control_type == if_control)
-	{
-	  control_level++;
-	  ret = recurse_read_control_structure (next);
-	  control_level--;
-
-	  if (ret == invalid_control)
-	    break;
-	}
-
-      if (tail)
-	{
-	  tail->next = next;
-	}
-      else
-	{
-	  head = next;
-	  old_chain = make_cleanup_free_command_lines (&head);
-	}
-      tail = next;
-    }
-
-  dont_repeat ();
-
-  if (head)
-    {
-      if (ret != invalid_control)
-	{
-	  discard_cleanups (old_chain);
-	}
-      else
-	do_cleanups (old_chain);
-    }
-
-  if (readline_end_hook)
-    {
-      (*readline_end_hook) ();
-    }
-  return (head);
-}
-
-/* Free a chain of struct command_line's.  */
-
-void
-free_command_lines (lptr)
-     struct command_line **lptr;
-{
-  register struct command_line *l = *lptr;
-  register struct command_line *next;
-  struct command_line **blist;
-  int i;
-
-  while (l)
-    {
-      if (l->body_count > 0)
-	{
-	  blist = l->body_list;
-	  for (i = 0; i < l->body_count; i++, blist++)
-	    free_command_lines (blist);
-	}
-      next = l->next;
-      free (l->line);
-      free ((PTR) l);
-      l = next;
-    }
-}
-
-static void
-do_free_command_lines_cleanup (void *arg)
-{
-  free_command_lines (arg);
-}
-
-static struct cleanup *
-make_cleanup_free_command_lines (struct command_line **arg)
-{
-  return make_cleanup (do_free_command_lines_cleanup, arg);
-}
-
-/* Add an element to the list of info subcommands.  */
-
-struct cmd_list_element *
-add_info (name, fun, doc)
-     char *name;
-     void (*fun) (char *, int);
-     char *doc;
-{
-  return add_cmd (name, no_class, fun, doc, &infolist);
-}
-
-/* Add an alias to the list of info subcommands.  */
-
-struct cmd_list_element *
-add_info_alias (name, oldname, abbrev_flag)
-     char *name;
-     char *oldname;
-     int abbrev_flag;
-{
-  return add_alias_cmd (name, oldname, 0, abbrev_flag, &infolist);
-}
-
-/* The "info" command is defined as a prefix, with allow_unknown = 0.
-   Therefore, its own definition is called only for "info" with no args.  */
-
-/* ARGSUSED */
-static void
-info_command (arg, from_tty)
-     char *arg;
-     int from_tty;
-{
-  printf_unfiltered ("\"info\" must be followed by the name of an info command.\n");
-  help_list (infolist, "info ", -1, gdb_stdout);
-}
-
-/* The "complete" command is used by Emacs to implement completion.  */
-
-/* ARGSUSED */
-static void
-complete_command (arg, from_tty)
-     char *arg;
-     int from_tty;
-{
-  int i;
-  int argpoint;
-  char *completion;
-
-  dont_repeat ();
-
-  if (arg == NULL)
-    arg = "";
-  argpoint = strlen (arg);
-
-  for (completion = line_completion_function (arg, i = 0, arg, argpoint);
-       completion;
-       completion = line_completion_function (arg, ++i, arg, argpoint))
-    {
-      printf_unfiltered ("%s\n", completion);
-      free (completion);
-    }
-}
-
-/* The "show" command with no arguments shows all the settings.  */
-
-/* ARGSUSED */
-static void
-show_command (arg, from_tty)
-     char *arg;
-     int from_tty;
-{
-  cmd_show_list (showlist, from_tty, "");
-}
-
-/* Add an element to the list of commands.  */
-
-struct cmd_list_element *
-add_com (name, class, fun, doc)
-     char *name;
-     enum command_class class;
-     void (*fun) (char *, int);
-     char *doc;
-{
-  return add_cmd (name, class, fun, doc, &cmdlist);
-}
-
-/* Add an alias or abbreviation command to the list of commands.  */
-
-struct cmd_list_element *
-add_com_alias (name, oldname, class, abbrev_flag)
-     char *name;
-     char *oldname;
-     enum command_class class;
-     int abbrev_flag;
-{
-  return add_alias_cmd (name, oldname, class, abbrev_flag, &cmdlist);
-}
-
-void
-error_no_arg (why)
-     char *why;
-{
-  error ("Argument required (%s).", why);
-}
-
-/* ARGSUSED */
-static void
-help_command (command, from_tty)
-     char *command;
-     int from_tty;		/* Ignored */
-{
-  help_cmd (command, gdb_stdout);
-}
-
-static void
-validate_comname (comname)
-     char *comname;
-{
-  register char *p;
-
-  if (comname == 0)
-    error_no_arg ("name of command to define");
-
-  p = comname;
-  while (*p)
-    {
-      if (!isalnum (*p) && *p != '-' && *p != '_')
-	error ("Junk in argument list: \"%s\"", p);
-      p++;
-    }
-}
-
-/* This is just a placeholder in the command data structures.  */
-static void
-user_defined_command (ignore, from_tty)
-     char *ignore;
-     int from_tty;
-{
-}
-
-static void
-define_command (comname, from_tty)
-     char *comname;
-     int from_tty;
-{
-  register struct command_line *cmds;
-  register struct cmd_list_element *c, *newc, *hookc = 0;
-  char *tem = comname;
-  char tmpbuf[128];
-#define	HOOK_STRING	"hook-"
-#define	HOOK_LEN 5
-
-  validate_comname (comname);
-
-  /* Look it up, and verify that we got an exact match.  */
-  c = lookup_cmd (&tem, cmdlist, "", -1, 1);
-  if (c && !STREQ (comname, c->name))
-    c = 0;
-
-  if (c)
-    {
-      if (c->class == class_user || c->class == class_alias)
-	tem = "Redefine command \"%s\"? ";
-      else
-	tem = "Really redefine built-in command \"%s\"? ";
-      if (!query (tem, c->name))
-	error ("Command \"%s\" not redefined.", c->name);
-    }
-
-  /* If this new command is a hook, then mark the command which it
-     is hooking.  Note that we allow hooking `help' commands, so that
-     we can hook the `stop' pseudo-command.  */
-
-  if (!strncmp (comname, HOOK_STRING, HOOK_LEN))
-    {
-      /* Look up cmd it hooks, and verify that we got an exact match.  */
-      tem = comname + HOOK_LEN;
-      hookc = lookup_cmd (&tem, cmdlist, "", -1, 0);
-      if (hookc && !STREQ (comname + HOOK_LEN, hookc->name))
-	hookc = 0;
-      if (!hookc)
-	{
-	  warning ("Your new `%s' command does not hook any existing command.",
-		   comname);
-	  if (!query ("Proceed? "))
-	    error ("Not confirmed.");
-	}
-    }
-
-  comname = savestring (comname, strlen (comname));
-
-  /* If the rest of the commands will be case insensitive, this one
-     should behave in the same manner. */
-  for (tem = comname; *tem; tem++)
-    if (isupper (*tem))
-      *tem = tolower (*tem);
-
-  sprintf (tmpbuf, "Type commands for definition of \"%s\".", comname);
-  cmds = read_command_lines (tmpbuf, from_tty);
-
-  if (c && c->class == class_user)
-    free_command_lines (&c->user_commands);
-
-  newc = add_cmd (comname, class_user, user_defined_command,
-		  (c && c->class == class_user)
-		  ? c->doc : savestring ("User-defined.", 13), &cmdlist);
-  newc->user_commands = cmds;
-
-  /* If this new command is a hook, then mark both commands as being
-     tied.  */
-  if (hookc)
-    {
-      hookc->hook = newc;	/* Target gets hooked.  */
-      newc->hookee = hookc;	/* We are marked as hooking target cmd.  */
-    }
-}
-
-static void
-document_command (comname, from_tty)
-     char *comname;
-     int from_tty;
-{
-  struct command_line *doclines;
-  register struct cmd_list_element *c;
-  char *tem = comname;
-  char tmpbuf[128];
-
-  validate_comname (comname);
-
-  c = lookup_cmd (&tem, cmdlist, "", 0, 1);
-
-  if (c->class != class_user)
-    error ("Command \"%s\" is built-in.", comname);
-
-  sprintf (tmpbuf, "Type documentation for \"%s\".", comname);
-  doclines = read_command_lines (tmpbuf, from_tty);
-
-  if (c->doc)
-    free (c->doc);
-
-  {
-    register struct command_line *cl1;
-    register int len = 0;
-
-    for (cl1 = doclines; cl1; cl1 = cl1->next)
-      len += strlen (cl1->line) + 1;
-
-    c->doc = (char *) xmalloc (len + 1);
-    *c->doc = 0;
-
-    for (cl1 = doclines; cl1; cl1 = cl1->next)
-      {
-	strcat (c->doc, cl1->line);
-	if (cl1->next)
-	  strcat (c->doc, "\n");
-      }
-  }
-
-  free_command_lines (&doclines);
-}
-
 /* Print the GDB banner. */
 void
-print_gdb_version (stream)
-     struct ui_file *stream;
+print_gdb_version (struct ui_file *stream)
 {
   /* From GNU coding standards, first line is meant to be easy for a
      program to parse, and is just canonical program name and version
      number, which starts after last space. */
 
-#ifdef UI_OUT
+#ifdef MI_OUT
   /* Print it console style until a format is defined */
-  fprintf_filtered (stream, "GNU gdb %s (UI_OUT)\n", version);
+  fprintf_filtered (stream, "GNU gdb %s (MI_OUT)\n", version);
 #else
   fprintf_filtered (stream, "GNU gdb %s\n", version);
 #endif
@@ -3238,18 +1420,6 @@
     }
   fprintf_filtered (stream, "\".");
 }
-
-/* ARGSUSED */
-static void
-show_version (args, from_tty)
-     char *args;
-     int from_tty;
-{
-  immediate_quit++;
-  print_gdb_version (gdb_stdout);
-  printf_filtered ("\n");
-  immediate_quit--;
-}
 
 /* get_prompt: access method for the GDB prompt string.  */
 
@@ -3268,9 +1438,9 @@
 static int gdb_prompt_escape;
 
 static int
-get_prompt_1 (formatted_prompt)
-     char *formatted_prompt;
+get_prompt_1 (void *data)
 {
+  char *formatted_prompt = data;
   char *local_prompt;
 
   if (event_loop_p)
@@ -3404,7 +1574,7 @@
 		         from bad user-supplied format string? */
 		      sprintf (outp, fmt[0] == 0 ? default_fmt : fmt,
 			       tmp);
-		      free (tmp);
+		      xfree (tmp);
 		    }
 		  else
 		    {
@@ -3497,7 +1667,7 @@
 }
 
 char *
-get_prompt ()
+get_prompt (void)
 {
   static char buf[MAX_PROMPT_SIZE];
 
@@ -3517,13 +1687,12 @@
 }
 
 void
-set_prompt (s)
-     char *s;
+set_prompt (char *s)
 {
 /* ??rehrauer: I don't know why this fails, since it looks as though
    assignments to prompt are wrapped in calls to savestring...
    if (prompt != NULL)
-   free (prompt);
+   xfree (prompt);
  */
   if (event_loop_p)
     PROMPT (0) = savestring (s, strlen (s));
@@ -3536,7 +1705,7 @@
    non-zero if we should quit, zero if we shouldn't.  */
 
 int
-quit_confirm ()
+quit_confirm (void)
 {
   if (inferior_pid != 0 && target_has_execution)
     {
@@ -3562,9 +1731,7 @@
 /* Quit without asking for confirmation.  */
 
 void
-quit_force (args, from_tty)
-     char *args;
-     int from_tty;
+quit_force (char *args, int from_tty)
 {
   int exit_code = 0;
 
@@ -3607,270 +1774,18 @@
   exit (exit_code);
 }
 
-/* Handle the quit command.  */
-
-void
-quit_command (args, from_tty)
-     char *args;
-     int from_tty;
-{
-  if (!quit_confirm ())
-    error ("Not confirmed.");
-  quit_force (args, from_tty);
-}
-
 /* Returns whether GDB is running on a terminal and whether the user
    desires that questions be asked of them on that terminal.  */
 
 int
-input_from_terminal_p ()
+input_from_terminal_p (void)
 {
   return gdb_has_a_terminal () && (instream == stdin) & caution;
 }
 
 /* ARGSUSED */
 static void
-pwd_command (args, from_tty)
-     char *args;
-     int from_tty;
-{
-  if (args)
-    error ("The \"pwd\" command does not take an argument: %s", args);
-  getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
-
-  if (!STREQ (gdb_dirbuf, current_directory))
-    printf_unfiltered ("Working directory %s\n (canonically %s).\n",
-		       current_directory, gdb_dirbuf);
-  else
-    printf_unfiltered ("Working directory %s.\n", current_directory);
-}
-
-void
-cd_command (dir, from_tty)
-     char *dir;
-     int from_tty;
-{
-  int len;
-  /* Found something other than leading repetitions of "/..".  */
-  int found_real_path;
-  char *p;
-
-  /* If the new directory is absolute, repeat is a no-op; if relative,
-     repeat might be useful but is more likely to be a mistake.  */
-  dont_repeat ();
-
-  if (dir == 0)
-    error_no_arg ("new working directory");
-
-  dir = tilde_expand (dir);
-  make_cleanup (free, dir);
-
-  if (chdir (dir) < 0)
-    perror_with_name (dir);
-
-#if defined(_WIN32) || defined(__MSDOS__)
-  /* There's too much mess with DOSish names like "d:", "d:.",
-     "d:./foo" etc.  Instead of having lots of special #ifdef'ed code,
-     simply get the canonicalized name of the current directory.  */
-  dir = getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
-#endif
-
-  len = strlen (dir);
-  if (SLASH_P (dir[len - 1]))
-    {
-      /* Remove the trailing slash unless this is a root directory
-         (including a drive letter on non-Unix systems).  */
-      if (!(len == 1)		/* "/" */
-#if defined(_WIN32) || defined(__MSDOS__)
-	  && !(!SLASH_P (*dir) && ROOTED_P (dir) && len <= 3)	/* "d:/" */
-#endif
-	  )
-	len--;
-    }
-
-  dir = savestring (dir, len);
-  if (ROOTED_P (dir))
-    current_directory = dir;
-  else
-    {
-      if (SLASH_P (current_directory[strlen (current_directory) - 1]))
-	current_directory = concat (current_directory, dir, NULL);
-      else
-	current_directory = concat (current_directory, SLASH_STRING, dir, NULL);
-      free (dir);
-    }
-
-  /* Now simplify any occurrences of `.' and `..' in the pathname.  */
-
-  found_real_path = 0;
-  for (p = current_directory; *p;)
-    {
-      if (SLASH_P (p[0]) && p[1] == '.' && (p[2] == 0 || SLASH_P (p[2])))
-	strcpy (p, p + 2);
-      else if (SLASH_P (p[0]) && p[1] == '.' && p[2] == '.'
-	       && (p[3] == 0 || SLASH_P (p[3])))
-	{
-	  if (found_real_path)
-	    {
-	      /* Search backwards for the directory just before the "/.."
-	         and obliterate it and the "/..".  */
-	      char *q = p;
-	      while (q != current_directory && !SLASH_P (q[-1]))
-		--q;
-
-	      if (q == current_directory)
-		/* current_directory is
-		   a relative pathname ("can't happen"--leave it alone).  */
-		++p;
-	      else
-		{
-		  strcpy (q - 1, p + 3);
-		  p = q - 1;
-		}
-	    }
-	  else
-	    /* We are dealing with leading repetitions of "/..", for example
-	       "/../..", which is the Mach super-root.  */
-	    p += 3;
-	}
-      else
-	{
-	  found_real_path = 1;
-	  ++p;
-	}
-    }
-
-  forget_cached_source_info ();
-
-  if (from_tty)
-    pwd_command ((char *) 0, 1);
-}
-
-struct source_cleanup_lines_args
-{
-  int old_line;
-  char *old_file;
-  char *old_pre_error;
-  char *old_error_pre_print;
-};
-
-static void
-source_cleanup_lines (args)
-     PTR args;
-{
-  struct source_cleanup_lines_args *p =
-  (struct source_cleanup_lines_args *) args;
-  source_line_number = p->old_line;
-  source_file_name = p->old_file;
-  source_pre_error = p->old_pre_error;
-  error_pre_print = p->old_error_pre_print;
-}
-
-/* ARGSUSED */
-static void
-do_fclose_cleanup (void *stream)
-{
-  fclose (stream);
-}
-
-void
-source_command (args, from_tty)
-     char *args;
-     int from_tty;
-{
-  FILE *stream;
-  struct cleanup *old_cleanups;
-  char *file = args;
-  struct source_cleanup_lines_args old_lines;
-  int needed_length;
-
-  if (file == NULL)
-    {
-      error ("source command requires pathname of file to source.");
-    }
-
-  file = tilde_expand (file);
-  old_cleanups = make_cleanup (free, file);
-
-  stream = fopen (file, FOPEN_RT);
-  if (!stream)
-    {
-      if (from_tty)
-	perror_with_name (file);
-      else
-	return;
-    }
-
-  make_cleanup (do_fclose_cleanup, stream);
-
-  old_lines.old_line = source_line_number;
-  old_lines.old_file = source_file_name;
-  old_lines.old_pre_error = source_pre_error;
-  old_lines.old_error_pre_print = error_pre_print;
-  make_cleanup (source_cleanup_lines, &old_lines);
-  source_line_number = 0;
-  source_file_name = file;
-  source_pre_error = error_pre_print == NULL ? "" : error_pre_print;
-  source_pre_error = savestring (source_pre_error, strlen (source_pre_error));
-  make_cleanup (free, source_pre_error);
-  /* This will get set every time we read a line.  So it won't stay "" for
-     long.  */
-  error_pre_print = "";
-
-  needed_length = strlen (source_file_name) + strlen (source_pre_error) + 80;
-  if (source_error_allocated < needed_length)
-    {
-      source_error_allocated *= 2;
-      if (source_error_allocated < needed_length)
-	source_error_allocated = needed_length;
-      if (source_error == NULL)
-	source_error = xmalloc (source_error_allocated);
-      else
-	source_error = xrealloc (source_error, source_error_allocated);
-    }
-
-  read_command_file (stream);
-
-  do_cleanups (old_cleanups);
-}
-
-/* ARGSUSED */
-static void
-echo_command (text, from_tty)
-     char *text;
-     int from_tty;
-{
-  char *p = text;
-  register int c;
-
-  if (text)
-    while ((c = *p++) != '\0')
-      {
-	if (c == '\\')
-	  {
-	    /* \ at end of argument is used after spaces
-	       so they won't be lost.  */
-	    if (*p == 0)
-	      return;
-
-	    c = parse_escape (&p);
-	    if (c >= 0)
-	      printf_filtered ("%c", c);
-	  }
-	else
-	  printf_filtered ("%c", c);
-      }
-
-  /* Force this output to appear now.  */
-  wrap_here ("");
-  gdb_flush (gdb_stdout);
-}
-
-/* ARGSUSED */
-static void
-dont_repeat_command (ignored, from_tty)
-     char *ignored;
-     int from_tty;
+dont_repeat_command (char *ignored, int from_tty)
 {
   *line = 0;			/* Can't call dont_repeat here because we're not
 				   necessarily reading from stdin.  */
@@ -3880,10 +1795,8 @@
 
 /* Number of commands to print in each call to show_commands.  */
 #define Hist_print 10
-static void
-show_commands (args, from_tty)
-     char *args;
-     int from_tty;
+void
+show_commands (char *args, int from_tty)
 {
   /* Index for history commands.  Relative to history_base.  */
   int offset;
@@ -3917,7 +1830,7 @@
 	;
       else
 	/* "info editing <exp>" should print around command number <exp>.  */
-	num = (parse_and_eval_address (args) - history_base) - Hist_print / 2;
+	num = (parse_and_eval_long (args) - history_base) - Hist_print / 2;
     }
   /* "show commands" means print the last Hist_print commands.  */
   else
@@ -3960,10 +1873,7 @@
 /* Called by do_setshow_command.  */
 /* ARGSUSED */
 static void
-set_history_size_command (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+set_history_size_command (char *args, int from_tty, struct cmd_list_element *c)
 {
   if (history_size == INT_MAX)
     unstifle_history ();
@@ -3977,20 +1887,16 @@
 }
 
 /* ARGSUSED */
-static void
-set_history (args, from_tty)
-     char *args;
-     int from_tty;
+void
+set_history (char *args, int from_tty)
 {
   printf_unfiltered ("\"set history\" must be followed by the name of a history subcommand.\n");
   help_list (sethistlist, "set history ", -1, gdb_stdout);
 }
 
 /* ARGSUSED */
-static void
-show_history (args, from_tty)
-     char *args;
-     int from_tty;
+void
+show_history (char *args, int from_tty)
 {
   cmd_show_list (showhistlist, from_tty, "");
 }
@@ -3999,11 +1905,8 @@
 
 /* Called by do_setshow_command.  An elaborate joke.  */
 /* ARGSUSED */
-static void
-set_verbose (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+void
+set_verbose (char *args, int from_tty, struct cmd_list_element *c)
 {
   char *cmdname = "verbose";
   struct cmd_list_element *showcmd;
@@ -4023,8 +1926,7 @@
 }
 
 static void
-float_handler (signo)
-     int signo;
+float_handler (int signo)
 {
   /* This message is based on ANSI C, section 4.7.  Note that integer
      divide by zero causes this, so "float" is a misnomer.  */
@@ -4032,49 +1934,6 @@
   error ("Erroneous arithmetic operation.");
 }
 
-static void
-set_debug (arg, from_tty)
-     char *arg;
-     int from_tty;
-{
-  printf_unfiltered ("\"set debug\" must be followed by the name of a print subcommand.\n");
-  help_list (setdebuglist, "set debug ", -1, gdb_stdout);
-}
-
-static void
-show_debug (args, from_tty)
-     char *args;
-     int from_tty;
-{
-  cmd_show_list (showdebuglist, from_tty, "");
-}
-
-static void
-init_cmd_lists ()
-{
-  cmdlist = NULL;
-  infolist = NULL;
-  enablelist = NULL;
-  disablelist = NULL;
-  togglelist = NULL;
-  stoplist = NULL;
-  deletelist = NULL;
-  enablebreaklist = NULL;
-  setlist = NULL;
-  unsetlist = NULL;
-  showlist = NULL;
-  sethistlist = NULL;
-  showhistlist = NULL;
-  unsethistlist = NULL;
-  maintenancelist = NULL;
-  maintenanceinfolist = NULL;
-  maintenanceprintlist = NULL;
-  setprintlist = NULL;
-  showprintlist = NULL;
-  setchecklist = NULL;
-  showchecklist = NULL;
-}
-
 /* Init the history buffer.  Note that we are called after the init file(s)
  * have been read so that the user can change the history file via his
  * .gdbinit file (for instance).  The GDBHISTFILE environment variable
@@ -4082,7 +1941,7 @@
  */
 
 void
-init_history ()
+init_history (void)
 {
   char *tmpenv;
 
@@ -4113,7 +1972,7 @@
 }
 
 static void
-init_main ()
+init_main (void)
 {
   struct cmd_list_element *c;
 
@@ -4146,48 +2005,11 @@
 
   /* Setup important stuff for command line editing.  */
   rl_completion_entry_function = (int (*)()) readline_line_completion_function;
-  rl_completer_word_break_characters = gdb_completer_word_break_characters;
-  rl_completer_quote_characters = gdb_completer_quote_characters;
+  rl_completer_word_break_characters =
+				 get_gdb_completer_word_break_characters ();
+  rl_completer_quote_characters = get_gdb_completer_quote_characters ();
   rl_readline_name = "gdb";
 
-  /* Define the classes of commands.
-     They will appear in the help list in the reverse of this order.  */
-
-  add_cmd ("internals", class_maintenance, NO_FUNCTION,
-	   "Maintenance commands.\n\
-Some gdb commands are provided just for use by gdb maintainers.\n\
-These commands are subject to frequent change, and may not be as\n\
-well documented as user commands.",
-	   &cmdlist);
-  add_cmd ("obscure", class_obscure, NO_FUNCTION, "Obscure features.", &cmdlist);
-  add_cmd ("aliases", class_alias, NO_FUNCTION, "Aliases of other commands.", &cmdlist);
-  add_cmd ("user-defined", class_user, NO_FUNCTION, "User-defined commands.\n\
-The commands in this class are those defined by the user.\n\
-Use the \"define\" command to define a command.", &cmdlist);
-  add_cmd ("support", class_support, NO_FUNCTION, "Support facilities.", &cmdlist);
-  if (!dbx_commands)
-    add_cmd ("status", class_info, NO_FUNCTION, "Status inquiries.", &cmdlist);
-  add_cmd ("files", class_files, NO_FUNCTION, "Specifying and examining files.", &cmdlist);
-  add_cmd ("breakpoints", class_breakpoint, NO_FUNCTION, "Making program stop at certain points.", &cmdlist);
-  add_cmd ("data", class_vars, NO_FUNCTION, "Examining data.", &cmdlist);
-  add_cmd ("stack", class_stack, NO_FUNCTION, "Examining the stack.\n\
-The stack is made up of stack frames.  Gdb assigns numbers to stack frames\n\
-counting from zero for the innermost (currently executing) frame.\n\n\
-At any time gdb identifies one frame as the \"selected\" frame.\n\
-Variable lookups are done with respect to the selected frame.\n\
-When the program being debugged stops, gdb selects the innermost frame.\n\
-The commands below can be used to select other frames by number or address.",
-	   &cmdlist);
-  add_cmd ("running", class_run, NO_FUNCTION, "Running the program.", &cmdlist);
-
-  add_com ("pwd", class_files, pwd_command,
-	"Print working directory.  This is used for your program as well.");
-  c = add_cmd ("cd", class_files, cd_command,
-	       "Set working directory to DIR for debugger and program being debugged.\n\
-The change does not take effect for the program being debugged\n\
-until the next time it is started.", &cmdlist);
-  c->completer = filename_completer;
-
   /* The set prompt command is different depending whether or not the
      async version is run. NOTE: this difference is going to
      disappear as we make the event loop be the default engine of
@@ -4216,55 +2038,10 @@
 		  &setlist),
      &showlist);
 
-  add_com ("echo", class_support, echo_command,
-	   "Print a constant string.  Give string as argument.\n\
-C escape sequences may be used in the argument.\n\
-No newline is added at the end of the argument;\n\
-use \"\\n\" if you want a newline to be printed.\n\
-Since leading and trailing whitespace are ignored in command arguments,\n\
-if you want to print some you must use \"\\\" before leading whitespace\n\
-to be printed or after trailing whitespace.");
-  add_com ("document", class_support, document_command,
-	   "Document a user-defined command.\n\
-Give command name as argument.  Give documentation on following lines.\n\
-End with a line of just \"end\".");
-  add_com ("define", class_support, define_command,
-	   "Define a new command name.  Command name is argument.\n\
-Definition appears on following lines, one command per line.\n\
-End with a line of just \"end\".\n\
-Use the \"document\" command to give documentation for the new command.\n\
-Commands defined in this way may have up to ten arguments.");
-
-#ifdef __STDC__
-  c = add_cmd ("source", class_support, source_command,
-	       "Read commands from a file named FILE.\n\
-Note that the file \"" GDBINIT_FILENAME "\" is read automatically in this way\n\
-when gdb is started.", &cmdlist);
-#else
-  /* Punt file name, we can't help it easily.  */
-  c = add_cmd ("source", class_support, source_command,
-	       "Read commands from a file named FILE.\n\
-Note that the file \".gdbinit\" is read automatically in this way\n\
-when gdb is started.", &cmdlist);
-#endif
-  c->completer = filename_completer;
-
-  add_com ("quit", class_support, quit_command, "Exit gdb.");
-  add_com ("help", class_support, help_command, "Print list of commands.");
-  add_com_alias ("q", "quit", class_support, 1);
-  add_com_alias ("h", "help", class_support, 1);
-
   add_com ("dont-repeat", class_support, dont_repeat_command, "Don't repeat this command.\n\
 Primarily used inside of user-defined commands that should not be repeated when\n\
 hitting return.");
 
-  c = add_set_cmd ("verbose", class_support, var_boolean, (char *) &info_verbose,
-		   "Set ",
-		   &setlist),
-    add_show_from_set (c, &showlist);
-  c->function.sfunc = set_verbose;
-  set_verbose (NULL, 0, c);
-
   /* The set editing command is different depending whether or not the
      async version is run. NOTE: this difference is going to disappear
      as we make the event loop be the default engine of gdb. */
@@ -4290,19 +2067,6 @@
       c->function.sfunc = set_async_editing_command;
     }
 
-  add_prefix_cmd ("history", class_support, set_history,
-		  "Generic command for setting command history parameters.",
-		  &sethistlist, "set history ", 0, &setlist);
-  add_prefix_cmd ("history", class_support, show_history,
-		  "Generic command for showing command history parameters.",
-		  &showhistlist, "show history ", 0, &showlist);
-
-  add_show_from_set
-    (add_set_cmd ("expansion", no_class, var_boolean, (char *) &history_expansion_p,
-		  "Set history expansion on command input.\n\
-Without an argument, history expansion is enabled.", &sethistlist),
-     &showhistlist);
-
   add_show_from_set
     (add_set_cmd ("save", no_class, var_boolean, (char *) &write_history_p,
 		  "Set saving of the history record on exit.\n\
@@ -4329,73 +2093,6 @@
 		  &setlist),
      &showlist);
 
-  add_prefix_cmd ("info", class_info, info_command,
-     "Generic command for showing things about the program being debugged.",
-		  &infolist, "info ", 0, &cmdlist);
-  add_com_alias ("i", "info", class_info, 1);
-
-  add_com ("complete", class_obscure, complete_command,
-	   "List the completions for the rest of the line as a command.");
-
-  add_prefix_cmd ("show", class_info, show_command,
-		  "Generic command for showing things about the debugger.",
-		  &showlist, "show ", 0, &cmdlist);
-  /* Another way to get at the same thing.  */
-  add_info ("set", show_command, "Show all GDB settings.");
-
-  add_cmd ("commands", no_class, show_commands,
-	   "Show the history of commands you typed.\n\
-You can supply a command number to start with, or a `+' to start after\n\
-the previous command number shown.",
-	   &showlist);
-
-  add_cmd ("version", no_class, show_version,
-	   "Show what version of GDB this is.", &showlist);
-
-  add_com ("while", class_support, while_command,
-	   "Execute nested commands WHILE the conditional expression is non zero.\n\
-The conditional expression must follow the word `while' and must in turn be\n\
-followed by a new line.  The nested commands must be entered one per line,\n\
-and should be terminated by the word `end'.");
-
-  add_com ("if", class_support, if_command,
-	   "Execute nested commands once IF the conditional expression is non zero.\n\
-The conditional expression must follow the word `if' and must in turn be\n\
-followed by a new line.  The nested commands must be entered one per line,\n\
-and should be terminated by the word 'else' or `end'.  If an else clause\n\
-is used, the same rules apply to its nested commands as to the first ones.");
-
-  /* If target is open when baud changes, it doesn't take effect until the
-     next open (I think, not sure).  */
-  add_show_from_set (add_set_cmd ("remotebaud", no_class,
-				  var_zinteger, (char *) &baud_rate,
-				  "Set baud rate for remote serial I/O.\n\
-This value is used to set the speed of the serial port when debugging\n\
-using remote targets.", &setlist),
-		     &showlist);
-
-  c = add_set_cmd ("remotedebug", no_class, var_zinteger,
-		   (char *) &remote_debug,
-		   "Set debugging of remote protocol.\n\
-When enabled, each packet sent or received with the remote target\n\
-is displayed.", &setlist);
-  deprecate_cmd (c, "set debug remote");
-  deprecate_cmd (add_show_from_set (c, &showlist), "show debug remote");
-
-  add_show_from_set (add_set_cmd ("remote", no_class, var_zinteger,
-				  (char *) &remote_debug,
-				  "Set debugging of remote protocol.\n\
-When enabled, each packet sent or received with the remote target\n\
-is displayed.", &setdebuglist),
-		     &showdebuglist);
-
-  add_show_from_set (
-		      add_set_cmd ("remotetimeout", no_class, var_integer, (char *) &remote_timeout,
-				   "Set timeout limit to wait for target to respond.\n\
-This value is used to set the time limit for gdb to wait for a response\n\
-from the target.", &setlist),
-		      &showlist);
-
   /* The set annotate command is different depending whether or not
      the async version is run. NOTE: this difference is going to
      disappear as we make the event loop be the default engine of
@@ -4427,11 +2124,4 @@
 Use \"on\" to enable the notification, and \"off\" to disable it.", &setlist),
 	 &showlist);
     }
-  add_prefix_cmd ("debug", no_class, set_debug,
-		  "Generic command for setting gdb debugging flags",
-		  &setdebuglist, "set debug ", 0, &setlist);
-
-  add_prefix_cmd ("debug", no_class, show_debug,
-		  "Generic command for showing gdb debugging flags",
-		  &showdebuglist, "show debug ", 0, &showlist);
 }
diff --git a/gdb/top.h b/gdb/top.h
index d5c6011..eee63d1 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -40,7 +40,6 @@
 extern int quit_confirm (void);
 extern void quit_force (char *, int);
 extern void quit_command (char *, int);
-extern void command_loop_marker (void *);
 extern int quit_cover (PTR);
 extern void execute_command (char *, int);
 
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index a7a3888..f275458 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -31,6 +31,7 @@
 #include "inferior.h"
 #include "tracepoint.h"
 #include "remote.h"
+#include "linespec.h"
 
 #include "ax.h"
 #include "ax-gdb.h"
@@ -164,7 +165,7 @@
 
 /* Utility: returns true if "target remote" */
 static int
-target_is_remote ()
+target_is_remote (void)
 {
   if (current_target.to_shortname &&
       strcmp (current_target.to_shortname, "remote") == 0)
@@ -175,8 +176,7 @@
 
 /* Utility: generate error from an incoming stub packet.  */
 static void
-trace_error (buf)
-     char *buf;
+trace_error (char *buf)
 {
   if (*buf++ != 'E')
     return;			/* not an error msg */
@@ -219,8 +219,7 @@
 
 /* Set tracepoint count to NUM.  */
 static void
-set_tracepoint_count (num)
-     int num;
+set_tracepoint_count (int num)
 {
   tracepoint_count = num;
   set_internalvar (lookup_internalvar ("tpnum"),
@@ -229,8 +228,7 @@
 
 /* Set traceframe number to NUM.  */
 static void
-set_traceframe_num (num)
-     int num;
+set_traceframe_num (int num)
 {
   traceframe_number = num;
   set_internalvar (lookup_internalvar ("trace_frame"),
@@ -239,8 +237,7 @@
 
 /* Set tracepoint number to NUM.  */
 static void
-set_tracepoint_num (num)
-     int num;
+set_tracepoint_num (int num)
 {
   tracepoint_number = num;
   set_internalvar (lookup_internalvar ("tracepoint"),
@@ -251,8 +248,7 @@
    the traceframe context (line, function, file) */
 
 static void
-set_traceframe_context (trace_pc)
-     CORE_ADDR trace_pc;
+set_traceframe_context (CORE_ADDR trace_pc)
 {
   static struct type *func_string, *file_string;
   static struct type *func_range, *file_range;
@@ -339,14 +335,13 @@
    your arguments BEFORE calling this routine!  */
 
 static struct tracepoint *
-set_raw_tracepoint (sal)
-     struct symtab_and_line sal;
+set_raw_tracepoint (struct symtab_and_line sal)
 {
   register struct tracepoint *t, *tc;
   struct cleanup *old_chain;
 
   t = (struct tracepoint *) xmalloc (sizeof (struct tracepoint));
-  old_chain = make_cleanup (free, t);
+  old_chain = make_cleanup (xfree, t);
   memset (t, 0, sizeof (*t));
   t->address = sal.pc;
   if (sal.symtab == NULL)
@@ -384,9 +379,7 @@
 
 /* Set a tracepoint according to ARG (function, linenum or *address) */
 static void
-trace_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+trace_command (char *arg, int from_tty)
 {
   char **canonical = (char **) NULL;
   struct symtabs_and_lines sals;
@@ -444,8 +437,7 @@
 /* Tell the user we have just set a tracepoint TP. */
 
 static void
-trace_mention (tp)
-     struct tracepoint *tp;
+trace_mention (struct tracepoint *tp)
 {
   printf_filtered ("Tracepoint %d", tp->number);
 
@@ -464,9 +456,7 @@
 /* Print information on tracepoint number TPNUM_EXP, or all if omitted.  */
 
 static void
-tracepoints_info (tpnum_exp, from_tty)
-     char *tpnum_exp;
-     int from_tty;
+tracepoints_info (char *tpnum_exp, int from_tty)
 {
   struct tracepoint *t;
   struct action_line *action;
@@ -476,7 +466,7 @@
   int tpnum = -1;
 
   if (tpnum_exp)
-    tpnum = parse_and_eval_address (tpnum_exp);
+    tpnum = parse_and_eval_long (tpnum_exp);
 
   ALL_TRACEPOINTS (t)
     if (tpnum == -1 || tpnum == t->number)
@@ -550,10 +540,8 @@
 
 /* This function implements enable, disable and delete commands. */
 static void
-tracepoint_operation (t, from_tty, opcode)
-     struct tracepoint *t;
-     int from_tty;
-     enum tracepoint_opcode opcode;
+tracepoint_operation (struct tracepoint *t, int from_tty,
+		      enum tracepoint_opcode opcode)
 {
   struct tracepoint *t2;
 
@@ -588,13 +576,13 @@
 	delete_tracepoint_hook (t);
 
       if (t->addr_string)
-	free (t->addr_string);
+	xfree (t->addr_string);
       if (t->source_file)
-	free (t->source_file);
+	xfree (t->source_file);
       if (t->actions)
 	free_actions (t);
 
-      free (t);
+      xfree (t);
       break;
     }
 }
@@ -604,9 +592,7 @@
    if OPTIONAL_P is true, then if the argument is missing, the most
    recent tracepoint (tracepoint_count) is returned.  */
 struct tracepoint *
-get_tracepoint_by_number (arg, multi_p, optional_p)
-     char **arg;
-     int multi_p, optional_p;
+get_tracepoint_by_number (char **arg, int multi_p, int optional_p)
 {
   struct tracepoint *t;
   int tpnum;
@@ -646,10 +632,8 @@
 
 /* Utility: parse a list of tracepoint numbers, and call a func for each. */
 static void
-map_args_over_tracepoints (args, from_tty, opcode)
-     char *args;
-     int from_tty;
-     enum tracepoint_opcode opcode;
+map_args_over_tracepoints (char *args, int from_tty,
+			   enum tracepoint_opcode opcode)
 {
   struct tracepoint *t, *tmp;
 
@@ -669,9 +653,7 @@
 
 /* The 'enable trace' command enables tracepoints.  Not supported by all targets.  */
 static void
-enable_trace_command (args, from_tty)
-     char *args;
-     int from_tty;
+enable_trace_command (char *args, int from_tty)
 {
   dont_repeat ();
   map_args_over_tracepoints (args, from_tty, enable_op);
@@ -679,9 +661,7 @@
 
 /* The 'disable trace' command enables tracepoints.  Not supported by all targets.  */
 static void
-disable_trace_command (args, from_tty)
-     char *args;
-     int from_tty;
+disable_trace_command (char *args, int from_tty)
 {
   dont_repeat ();
   map_args_over_tracepoints (args, from_tty, disable_op);
@@ -689,9 +669,7 @@
 
 /* Remove a tracepoint (or all if no argument) */
 static void
-delete_trace_command (args, from_tty)
-     char *args;
-     int from_tty;
+delete_trace_command (char *args, int from_tty)
 {
   dont_repeat ();
   if (!args || !*args)		/* No args implies all tracepoints; */
@@ -710,9 +688,7 @@
    Also accepts special argument "all".  */
 
 static void
-trace_pass_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_pass_command (char *args, int from_tty)
 {
   struct tracepoint *t1 = (struct tracepoint *) -1, *t2;
   unsigned int count;
@@ -772,34 +748,26 @@
    which is always an error.  */
 
 static void
-end_actions_pseudocommand (args, from_tty)
-     char *args;
-     int from_tty;
+end_actions_pseudocommand (char *args, int from_tty)
 {
   error ("This command cannot be used at the top level.");
 }
 
 static void
-while_stepping_pseudocommand (args, from_tty)
-     char *args;
-     int from_tty;
+while_stepping_pseudocommand (char *args, int from_tty)
 {
   error ("This command can only be used in a tracepoint actions list.");
 }
 
 static void
-collect_pseudocommand (args, from_tty)
-     char *args;
-     int from_tty;
+collect_pseudocommand (char *args, int from_tty)
 {
   error ("This command can only be used in a tracepoint actions list.");
 }
 
 /* Enter a list of actions for a tracepoint.  */
 static void
-trace_actions_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_actions_command (char *args, int from_tty)
 {
   struct tracepoint *t;
   char tmpbuf[128];
@@ -832,8 +800,7 @@
 
 /* worker function */
 static void
-read_actions (t)
-     struct tracepoint *t;
+read_actions (struct tracepoint *t)
 {
   char *line;
   char *prompt1 = "> ", *prompt2 = "  > ";
@@ -923,15 +890,13 @@
   if (job_control)
     signal (STOP_SIGNAL, SIG_DFL);
 #endif
-  immediate_quit = 0;
+  immediate_quit--;
   discard_cleanups (old_chain);
 }
 
 /* worker function */
 enum actionline_type
-validate_actionline (line, t)
-     char **line;
-     struct tracepoint *t;
+validate_actionline (char **line, struct tracepoint *t)
 {
   struct cmd_list_element *c;
   struct expression *exp = NULL;
@@ -1006,7 +971,7 @@
 	    error ("expression too complicated, try simplifying");
 
 	  ax_reqs (aexpr, &areqs);
-	  (void) make_cleanup (free, areqs.reg_mask);
+	  (void) make_cleanup (xfree, areqs.reg_mask);
 
 	  if (areqs.flaw != agent_flaw_none)
 	    error ("malformed expression");
@@ -1049,8 +1014,7 @@
 
 /* worker function */
 void
-free_actions (t)
-     struct tracepoint *t;
+free_actions (struct tracepoint *t)
 {
   struct action_line *line, *next;
 
@@ -1058,8 +1022,8 @@
     {
       next = line->next;
       if (line->action)
-	free (line->action);
-      free (line);
+	xfree (line->action);
+      xfree (line);
     }
   t->actions = NULL;
 }
@@ -1102,9 +1066,7 @@
 
 /* compare memranges for qsort */
 static int
-memrange_cmp (va, vb)
-     const void *va;
-     const void *vb;
+memrange_cmp (const void *va, const void *vb)
 {
   const struct memrange *a = va, *b = vb;
 
@@ -1131,8 +1093,7 @@
 
 /* Sort the memrange list using qsort, and merge adjacent memranges */
 static void
-memrange_sortmerge (memranges)
-     struct collection_list *memranges;
+memrange_sortmerge (struct collection_list *memranges)
 {
   int a, b;
 
@@ -1162,9 +1123,7 @@
 
 /* Add a register to a collection list */
 static void
-add_register (collection, regno)
-     struct collection_list *collection;
-     unsigned int regno;
+add_register (struct collection_list *collection, unsigned int regno)
 {
   if (info_verbose)
     printf_filtered ("collect register %d\n", regno);
@@ -1176,11 +1135,8 @@
 
 /* Add a memrange to a collection list */
 static void
-add_memrange (memranges, type, base, len)
-     struct collection_list *memranges;
-     int type;
-     bfd_signed_vma base;
-     unsigned long len;
+add_memrange (struct collection_list *memranges, int type, bfd_signed_vma base,
+	      unsigned long len)
 {
   if (info_verbose)
     {
@@ -1209,11 +1165,8 @@
 
 /* Add a symbol to a collection list */
 static void
-collect_symbol (collect, sym, frame_regno, frame_offset)
-     struct collection_list *collect;
-     struct symbol *sym;
-     long frame_regno;
-     long frame_offset;
+collect_symbol (struct collection_list *collect, struct symbol *sym,
+		long frame_regno, long frame_offset)
 {
   unsigned long len;
   unsigned int reg;
@@ -1313,7 +1266,7 @@
       printf_filtered ("Don't know LOC_UNRESOLVED %s\n", SYMBOL_NAME (sym));
       break;
     case LOC_OPTIMIZED_OUT:
-      printf_filtered ("%s has been optimized out of existance.\n",
+      printf_filtered ("%s has been optimized out of existence.\n",
 		       SYMBOL_NAME (sym));
       break;
     }
@@ -1321,12 +1274,8 @@
 
 /* Add all locals (or args) symbols to collection list */
 static void
-add_local_symbols (collect, pc, frame_regno, frame_offset, type)
-     struct collection_list *collect;
-     CORE_ADDR pc;
-     long frame_regno;
-     long frame_offset;
-     int type;
+add_local_symbols (struct collection_list *collect, CORE_ADDR pc,
+		   long frame_regno, long frame_offset, int type)
 {
   struct symbol *sym;
   struct block *block;
@@ -1379,8 +1328,7 @@
 
 /* worker function */
 static void
-clear_collection_list (list)
-     struct collection_list *list;
+clear_collection_list (struct collection_list *list)
 {
   int ndx;
 
@@ -1396,9 +1344,7 @@
 
 /* reduce a collection list to string form (for gdb protocol) */
 static char **
-stringify_collection_list (list, string)
-     struct collection_list *list;
-     char *string;
+stringify_collection_list (struct collection_list *list, char *string)
 {
   char temp_buf[2048];
   char tmp2[40];
@@ -1497,15 +1443,13 @@
 }
 
 static void
-free_actions_list_cleanup_wrapper (al)
-     void *al;
+free_actions_list_cleanup_wrapper (void *al)
 {
   free_actions_list (al);
 }
 
 static void
-free_actions_list (actions_list)
-     char **actions_list;
+free_actions_list (char **actions_list)
 {
   int ndx;
 
@@ -1513,17 +1457,15 @@
     return;
 
   for (ndx = 0; actions_list[ndx]; ndx++)
-    free (actions_list[ndx]);
+    xfree (actions_list[ndx]);
 
-  free (actions_list);
+  xfree (actions_list);
 }
 
 /* render all actions into gdb protocol */
 static void
-encode_actions (t, tdp_actions, stepping_actions)
-     struct tracepoint *t;
-     char ***tdp_actions;
-     char ***stepping_actions;
+encode_actions (struct tracepoint *t, char ***tdp_actions,
+		char ***stepping_actions)
 {
   static char tdp_buff[2048], step_buff[2048];
   char *action_exp;
@@ -1684,14 +1626,12 @@
   memrange_sortmerge (&tracepoint_list);
   memrange_sortmerge (&stepping_list);
 
-  *tdp_actions = stringify_collection_list (&tracepoint_list, &tdp_buff);
-  *stepping_actions = stringify_collection_list (&stepping_list, &step_buff);
+  *tdp_actions = stringify_collection_list (&tracepoint_list, tdp_buff);
+  *stepping_actions = stringify_collection_list (&stepping_list, step_buff);
 }
 
 static void
-add_aexpr (collect, aexpr)
-     struct collection_list *collect;
-     struct agent_expr *aexpr;
+add_aexpr (struct collection_list *collect, struct agent_expr *aexpr)
 {
   if (collect->next_aexpr_elt >= collect->aexpr_listsize)
     {
@@ -1758,9 +1698,7 @@
    Tell target to start a new trace experiment.  */
 
 static void
-trace_start_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_start_command (char *args, int from_tty)
 {				/* STUB_COMM MOSTLY_IMPLEMENTED */
   struct tracepoint *t;
   char buf[2048];
@@ -1860,9 +1798,7 @@
 
 /* tstop command */
 static void
-trace_stop_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_stop_command (char *args, int from_tty)
 {				/* STUB_COMM IS_IMPLEMENTED */
   if (target_is_remote ())
     {
@@ -1882,9 +1818,7 @@
 
 /* tstatus command */
 static void
-trace_status_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_status_command (char *args, int from_tty)
 {				/* STUB_COMM IS_IMPLEMENTED */
   if (target_is_remote ())
     {
@@ -2026,9 +1960,7 @@
 
 /* tfind command */
 static void
-trace_find_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_find_command (char *args, int from_tty)
 {				/* STUB_COMM PART_IMPLEMENTED */
   /* this should only be called with a numeric argument */
   int frameno = -1;
@@ -2055,7 +1987,7 @@
 	  frameno = traceframe_number - 1;
 	}
       else
-	frameno = parse_and_eval_address (args);
+	frameno = parse_and_eval_long (args);
 
       if (frameno < -1)
 	error ("invalid input (%d is less than zero)", frameno);
@@ -2069,36 +2001,28 @@
 
 /* tfind end */
 static void
-trace_find_end_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_find_end_command (char *args, int from_tty)
 {
   trace_find_command ("-1", from_tty);
 }
 
 /* tfind none */
 static void
-trace_find_none_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_find_none_command (char *args, int from_tty)
 {
   trace_find_command ("-1", from_tty);
 }
 
 /* tfind start */
 static void
-trace_find_start_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_find_start_command (char *args, int from_tty)
 {
   trace_find_command ("0", from_tty);
 }
 
 /* tfind pc command */
 static void
-trace_find_pc_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_find_pc_command (char *args, int from_tty)
 {				/* STUB_COMM PART_IMPLEMENTED */
   CORE_ADDR pc;
   char tmp[40];
@@ -2120,9 +2044,7 @@
 
 /* tfind tracepoint command */
 static void
-trace_find_tracepoint_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_find_tracepoint_command (char *args, int from_tty)
 {				/* STUB_COMM PART_IMPLEMENTED */
   int tdp;
 
@@ -2134,7 +2056,7 @@
 	else
 	  tdp = tracepoint_number;	/* default is current TDP */
       else
-	tdp = parse_and_eval_address (args);
+	tdp = parse_and_eval_long (args);
 
       sprintf (target_buf, "QTFrame:tdp:%x", tdp);
       finish_tfind_command (target_buf, sizeof (target_buf), from_tty);
@@ -2152,9 +2074,7 @@
    corresponding to a source line OTHER THAN THE CURRENT ONE.  */
 
 static void
-trace_find_line_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_find_line_command (char *args, int from_tty)
 {				/* STUB_COMM PART_IMPLEMENTED */
   static CORE_ADDR start_pc, end_pc;
   struct symtabs_and_lines sals;
@@ -2178,7 +2098,7 @@
 	  sal = sals.sals[0];
 	}
 
-      old_chain = make_cleanup (free, sals.sals);
+      old_chain = make_cleanup (xfree, sals.sals);
       if (sal.symtab == 0)
 	{
 	  printf_filtered ("TFIND: No line number information available");
@@ -2242,9 +2162,7 @@
 
 /* tfind range command */
 static void
-trace_find_range_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_find_range_command (char *args, int from_tty)
 {
   static CORE_ADDR start, stop;
   char start_str[40], stop_str[40];
@@ -2283,9 +2201,7 @@
 
 /* tfind outside command */
 static void
-trace_find_outside_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_find_outside_command (char *args, int from_tty)
 {
   CORE_ADDR start, stop;
   char start_str[40], stop_str[40];
@@ -2324,9 +2240,7 @@
 
 /* save-tracepoints command */
 static void
-tracepoint_save_command (args, from_tty)
-     char *args;
-     int from_tty;
+tracepoint_save_command (char *args, int from_tty)
 {
   struct tracepoint *tp;
   struct action_line *line;
@@ -2395,9 +2309,7 @@
 
 /* info scope command: list the locals for a scope.  */
 static void
-scope_info (args, from_tty)
-     char *args;
-     int from_tty;
+scope_info (char *args, int from_tty)
 {
   struct symtabs_and_lines sals;
   struct symbol *sym;
@@ -2534,17 +2446,15 @@
 
 /* worker function (cleanup) */
 static void
-replace_comma (comma)
-     char *comma;
+replace_comma (void *data)
 {
+  char *comma = data;
   *comma = ',';
 }
 
 /* tdump command */
 static void
-trace_dump_command (args, from_tty)
-     char *args;
-     int from_tty;
+trace_dump_command (char *args, int from_tty)
 {
   struct tracepoint *t;
   struct action_line *action;
@@ -2662,10 +2572,7 @@
 static const char hexchars[] = "0123456789abcdef";
 
 static unsigned char *
-mem2hex (mem, buf, count)
-     unsigned char *mem;
-     unsigned char *buf;
-     int count;
+mem2hex (unsigned char *mem, unsigned char *buf, int count)
 {
   unsigned char ch;
 
@@ -2683,7 +2590,7 @@
 }
 
 int
-get_traceframe_number ()
+get_traceframe_number (void)
 {
   return traceframe_number;
 }
@@ -2691,7 +2598,7 @@
 
 /* module initialization */
 void
-_initialize_tracepoint ()
+_initialize_tracepoint (void)
 {
   tracepoint_chain = 0;
   tracepoint_count = 0;
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
index 6f50f19..9faa53f 100644
--- a/gdb/tracepoint.h
+++ b/gdb/tracepoint.h
@@ -107,7 +107,7 @@
   };
 
 
-/* The tracepont chain of all tracepoints */
+/* The tracepoint chain of all tracepoints */
 
 extern struct tracepoint *tracepoint_chain;
 
diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog
index d492a9d..90264be7 100644
--- a/gdb/tui/ChangeLog
+++ b/gdb/tui/ChangeLog
@@ -1,3 +1,20 @@
+2000-12-14  Kevin Buettner  <kevinb@redhat.com>
+
+	* tui-file.c, tui.c, tuiData.c, tuiLayout.c: Replace occurrences
+	of free() with xfree().
+
+2000-06-22  Kevin Buettner  <kevinb@redhat.com>
+
+	* tuiSourceWin.h: Eliminate use of PARAMS from this file.
+
+2000-06-20  Kevin Buettner  <kevinb@redhat.com>
+
+	* tuiLayout.c: Eliminate use of PARAMS from this file.
+
+2000-06-17  Kevin Buettner  <kevinb@redhat.com>
+
+	* tuiIO.c: Eliminate use of PARAMS from this file.
+
 Thu May 25 14:46:20 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* tui-file.c: Include "tui.h", "tuiData.h", "tuiIO.h" and
diff --git a/gdb/tui/tui-file.c b/gdb/tui/tui-file.c
index 1702db3..bf3574b 100644
--- a/gdb/tui/tui-file.c
+++ b/gdb/tui/tui-file.c
@@ -66,7 +66,7 @@
 static int tui_file_magic;
 
 static struct ui_file *
-tui_file_new ()
+tui_file_new (void)
 {
   struct tui_stream *tui = xmalloc (sizeof (struct tui_stream));
   struct ui_file *file = ui_file_new ();
@@ -81,8 +81,7 @@
 }
 
 static void
-tui_file_delete (file)
-     struct ui_file *file;
+tui_file_delete (struct ui_file *file)
 {
   struct tui_stream *tmpstream = ui_file_data (file);
   if (tmpstream->ts_magic != &tui_file_magic)
@@ -90,14 +89,13 @@
   if ((tmpstream->ts_streamtype == astring) &&
       (tmpstream->ts_strbuf != NULL))
     {
-      free (tmpstream->ts_strbuf);
+      xfree (tmpstream->ts_strbuf);
     }
-  free (tmpstream);
+  xfree (tmpstream);
 }
 
 struct ui_file *
-tui_fileopen (stream)
-     FILE *stream;
+tui_fileopen (FILE *stream)
 {
   struct ui_file *file = tui_file_new ();
   struct tui_stream *tmpstream = ui_file_data (file);
@@ -109,8 +107,7 @@
 }
 
 struct ui_file *
-tui_sfileopen (n)
-     int n;
+tui_sfileopen (int n)
 {
   struct ui_file *file = tui_file_new ();
   struct tui_stream *tmpstream = ui_file_data (file);
@@ -130,8 +127,7 @@
 }
 
 static int
-tui_file_isatty (file)
-     struct ui_file *file;
+tui_file_isatty (struct ui_file *file)
 {
   struct tui_stream *stream = ui_file_data (file);
   if (stream->ts_magic != &tui_file_magic)
@@ -143,8 +139,7 @@
 }
 
 static void
-tui_file_rewind (file)
-     struct ui_file *file;
+tui_file_rewind (struct ui_file *file)
 {
   struct tui_stream *stream = ui_file_data (file);
   if (stream->ts_magic != &tui_file_magic)
@@ -174,9 +169,7 @@
 /* FIXME: Should be broken up and moved to a TUI specific file. */
 
 void
-tui_file_fputs (linebuffer, file)
-     const char *linebuffer;
-     struct ui_file *file;
+tui_file_fputs (const char *linebuffer, struct ui_file *file)
 {
   struct tui_stream *stream = ui_file_data (file);
 #if defined(TUI)
@@ -281,8 +274,7 @@
 }
 
 static void
-tui_file_flush (file)
-     struct ui_file *file;
+tui_file_flush (struct ui_file *file)
 {
   struct tui_stream *stream = ui_file_data (file);
   if (stream->ts_magic != &tui_file_magic)
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 67c3114..b38f67d 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -241,7 +241,7 @@
 {
   if (ptr != (char *) NULL)
     {
-      free (ptr);
+      xfree (ptr);
     }
 
   return;
@@ -441,7 +441,7 @@
    **      Function to initialize gdb commands, for tui window manipulation.
  */
 void
-_initialize_tui ()
+_initialize_tui (void)
 {
 #if 0
   if (tui_version)
@@ -626,7 +626,7 @@
   format = va_arg (args, char *);
 #endif
   vasprintf (&linebuffer, format, args);
-  old_cleanups = make_cleanup (free, linebuffer);
+  old_cleanups = make_cleanup (xfree, linebuffer);
   strcat_to_buf (buf, bufLen, linebuffer);
   do_cleanups (old_cleanups);
   va_end (args);
diff --git a/gdb/tui/tuiData.c b/gdb/tui/tuiData.c
index 50fa4a7..d9b7b99 100644
--- a/gdb/tui/tuiData.c
+++ b/gdb/tui/tuiData.c
@@ -1378,7 +1378,7 @@
       winInfo->generic.handle = (WINDOW *) NULL;
       freeWinContent (&winInfo->generic);
     }
-  free (winInfo);
+  xfree (winInfo);
 
   return;
 }				/* freeWindow */
diff --git a/gdb/tui/tuiIO.c b/gdb/tui/tuiIO.c
index c8427c0..0bb249b 100644
--- a/gdb/tui/tuiIO.c
+++ b/gdb/tui/tuiIO.c
@@ -602,7 +602,7 @@
     {
 
       /* Un-do the effect of the memory lock in terminal_inferior() */
-      tputs (term_memory_unlock, 1, (int (*)PARAMS ((int))) putchar);
+      tputs (term_memory_unlock, 1, (int (*) (int)) putchar);
       fflush (stdout);
 
     }
@@ -618,7 +618,7 @@
 
       /* Set scroll region to be 0..end */
       buffer = (char *) tgoto (term_scroll_region, end, 0);
-      tputs (buffer, 1, (int (*)PARAMS ((int))) putchar);
+      tputs (buffer, 1, (int (*) (int)) putchar);
 
     }				/* else we're out of luck */
 
@@ -708,8 +708,8 @@
        * So first position the cursor, then call memory lock.
        */
       buffer = tgoto (term_cursor_move, 0, start);
-      tputs (buffer, 1, (int (*)PARAMS ((int))) putchar);
-      tputs (term_memory_lock, 1, (int (*)PARAMS ((int))) putchar);
+      tputs (buffer, 1, (int (*) (int)) putchar);
+      tputs (term_memory_lock, 1, (int (*) (int)) putchar);
 
     }
   else if (term_scroll_region)
@@ -717,17 +717,17 @@
 
       /* Set the scroll region to the command window */
       buffer = tgoto (term_scroll_region, end, start);
-      tputs (buffer, 1, (int (*)PARAMS ((int))) putchar);
+      tputs (buffer, 1, (int (*) (int)) putchar);
 
     }				/* else we can't do anything about target I/O */
 
   /* Also turn off standout mode, in case it is on */
   if (term_se != NULL)
-    tputs (term_se, 1, (int (*)PARAMS ((int))) putchar);
+    tputs (term_se, 1, (int (*) (int)) putchar);
 
   /* Now go to the appropriate spot on the end line */
   buffer = tgoto (term_cursor_move, to_column, end);
-  tputs (buffer, 1, (int (*)PARAMS ((int))) putchar);
+  tputs (buffer, 1, (int (*) (int)) putchar);
   fflush (stdout);
 
   tui_owns_terminal = 0;
diff --git a/gdb/tui/tuiLayout.c b/gdb/tui/tuiLayout.c
index 337665e..8a6648a 100644
--- a/gdb/tui/tuiLayout.c
+++ b/gdb/tui/tuiLayout.c
@@ -20,18 +20,13 @@
 ** Static Local Decls
 ********************************/
 
-static void _initGenWinInfo PARAMS
-  ((TuiGenWinInfoPtr, TuiWinType, int, int, int, int));
-static void _initAndMakeWin PARAMS
-  ((Opaque *, TuiWinType, int, int, int, int, int));
-static void _showSourceOrDisassemAndCommand PARAMS
-  ((TuiLayoutType));
-static void _makeSourceOrDisassemWindow PARAMS
-  ((TuiWinInfoPtr *, TuiWinType, int, int));
+static void _initGenWinInfo (TuiGenWinInfoPtr, TuiWinType, int, int, int, int);
+static void _initAndMakeWin (Opaque *, TuiWinType, int, int, int, int, int);
+static void _showSourceOrDisassemAndCommand (TuiLayoutType);
+static void _makeSourceOrDisassemWindow (TuiWinInfoPtr *, TuiWinType, int, int);
 static void _makeCommandWindow (TuiWinInfoPtr *, int, int);
 static void _makeSourceWindow (TuiWinInfoPtr *, int, int);
-static void _makeDisassemWindow PARAMS
-  ((TuiWinInfoPtr *, int, int));
+static void _makeDisassemWindow (TuiWinInfoPtr *, int, int);
 static void _makeDataWindow (TuiWinInfoPtr *, int, int);
 static void _showSourceCommand (void);
 static void _showDisassemCommand (void);
@@ -470,7 +465,7 @@
    **        manipulation.
  */
 void
-_initialize_tuiLayout ()
+_initialize_tuiLayout (void)
 {
   if (tui_version)
     {
@@ -608,7 +603,7 @@
 	    newLayout = _prevLayout ();
 	  else
 	    status = TUI_FAILURE;
-	  free (bufPtr);
+	  xfree (bufPtr);
 
 	  tuiSetLayout (newLayout, dpyType);
 	}
diff --git a/gdb/tui/tuiRegs.c b/gdb/tui/tuiRegs.c
index 1efadd0..b0f55ef 100644
--- a/gdb/tui/tuiRegs.c
+++ b/gdb/tui/tuiRegs.c
@@ -586,7 +586,7 @@
 
 
 void
-_initialize_tuiRegs ()
+_initialize_tuiRegs (void)
 {
   if (tui_version && xdb_commands)
     {
diff --git a/gdb/tui/tuiSourceWin.h b/gdb/tui/tuiSourceWin.h
index fb6cd81..30b580f 100644
--- a/gdb/tui/tuiSourceWin.h
+++ b/gdb/tui/tuiSourceWin.h
@@ -6,10 +6,10 @@
 
 
 extern void tuiDisplayMainFunction (void);
-extern void tuiUpdateSourceWindow PARAMS
-  ((TuiWinInfoPtr, struct symtab *, Opaque, int));
-extern void tuiUpdateSourceWindowAsIs PARAMS
-  ((TuiWinInfoPtr, struct symtab *, Opaque, int));
+extern void tuiUpdateSourceWindow (TuiWinInfoPtr, struct symtab *, Opaque,
+				   int);
+extern void tuiUpdateSourceWindowAsIs (TuiWinInfoPtr, struct symtab *, Opaque,
+				       int);
 extern void tuiUpdateSourceWindowsWithAddr (Opaque);
 extern void tui_vUpdateSourceWindowsWithAddr (va_list);
 extern void tuiUpdateSourceWindowsWithLine (struct symtab *, int);
diff --git a/gdb/tui/tuiStack.c b/gdb/tui/tuiStack.c
index c0f51ef..a8f4ca8 100644
--- a/gdb/tui/tuiStack.c
+++ b/gdb/tui/tuiStack.c
@@ -475,7 +475,7 @@
    **      Function to initialize gdb commands, for tui window stack manipulation.
  */
 void
-_initialize_tuiStack ()
+_initialize_tuiStack (void)
 {
   if (tui_version)
     {
diff --git a/gdb/tui/tuiWin.c b/gdb/tui/tuiWin.c
index 669576e..fab6d3f 100644
--- a/gdb/tui/tuiWin.c
+++ b/gdb/tui/tuiWin.c
@@ -62,7 +62,7 @@
    **        Function to initialize gdb commands, for tui window manipulation.
  */
 void
-_initialize_tuiWin ()
+_initialize_tuiWin (void)
 {
   if (tui_version)
     {
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 249f213..b46f03f 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -49,6 +49,61 @@
 
 static void whatis_exp (char *, int);
 
+/* Print a description of a type in the format of a 
+   typedef for the current language.
+   NEW is the new name for a type TYPE. */
+
+void
+typedef_print (struct type *type, struct symbol *new, struct ui_file *stream)
+{
+  CHECK_TYPEDEF (type);
+  switch (current_language->la_language)
+    {
+#ifdef _LANG_c
+    case language_c:
+    case language_cplus:
+      fprintf_filtered (stream, "typedef ");
+      type_print (type, "", stream, 0);
+      if (TYPE_NAME ((SYMBOL_TYPE (new))) == 0
+	  || !STREQ (TYPE_NAME ((SYMBOL_TYPE (new))), SYMBOL_NAME (new)))
+	fprintf_filtered (stream, " %s", SYMBOL_SOURCE_NAME (new));
+      break;
+#endif
+#ifdef _LANG_m2
+    case language_m2:
+      fprintf_filtered (stream, "TYPE ");
+      if (!TYPE_NAME (SYMBOL_TYPE (new)) ||
+	  !STREQ (TYPE_NAME (SYMBOL_TYPE (new)), SYMBOL_NAME (new)))
+	fprintf_filtered (stream, "%s = ", SYMBOL_SOURCE_NAME (new));
+      else
+	fprintf_filtered (stream, "<builtin> = ");
+      type_print (type, "", stream, 0);
+      break;
+#endif
+#ifdef _LANG_pascal
+    case language_pascal:
+      fprintf_filtered (stream, "type ");
+      fprintf_filtered (stream, "%s = ", SYMBOL_SOURCE_NAME (new));
+      type_print (type, "", stream, 0);
+      break;
+#endif
+#ifdef _LANG_chill
+    case language_chill:
+      fprintf_filtered (stream, "SYNMODE ");
+      if (!TYPE_NAME (SYMBOL_TYPE (new)) ||
+	  !STREQ (TYPE_NAME (SYMBOL_TYPE (new)), SYMBOL_NAME (new)))
+	fprintf_filtered (stream, "%s = ", SYMBOL_SOURCE_NAME (new));
+      else
+	fprintf_filtered (stream, "<builtin> = ");
+      type_print (type, "", stream, 0);
+      break;
+#endif
+    default:
+      error ("Language not supported.");
+    }
+  fprintf_filtered (stream, ";\n");
+}
+
 /* Print a description of a type TYPE in the form of a declaration of a
    variable named VARSTRING.  (VARSTRING is demangled if necessary.)
    Output goes to STREAM (via stdio).
@@ -57,11 +112,8 @@
    If SHOW is negative, we never show the details of elements' types.  */
 
 void
-type_print (type, varstring, stream, show)
-     struct type *type;
-     char *varstring;
-     struct ui_file *stream;
-     int show;
+type_print (struct type *type, char *varstring, struct ui_file *stream,
+	    int show)
 {
   LA_PRINT_TYPE (type, varstring, stream, show, 0);
 }
@@ -70,9 +122,7 @@
    show is passed to type_print.  */
 
 static void
-whatis_exp (exp, show)
-     char *exp;
-     int show;
+whatis_exp (char *exp, int show)
 {
   struct expression *expr;
   register value_ptr val;
@@ -134,9 +184,7 @@
 
 /* ARGSUSED */
 static void
-whatis_command (exp, from_tty)
-     char *exp;
-     int from_tty;
+whatis_command (char *exp, int from_tty)
 {
   /* Most of the time users do not want to see all the fields
      in a structure.  If they do they can use the "ptype" command.
@@ -147,8 +195,7 @@
 /* Simple subroutine for ptype_command.  */
 
 static struct type *
-ptype_eval (exp)
-     struct expression *exp;
+ptype_eval (struct expression *exp)
 {
   if (exp->elts[0].opcode == OP_TYPE)
     {
@@ -164,9 +211,7 @@
 
 /* ARGSUSED */
 static void
-ptype_command (typename, from_tty)
-     char *typename;
-     int from_tty;
+ptype_command (char *typename, int from_tty)
 {
   register struct type *type;
   struct expression *expr;
@@ -212,10 +257,7 @@
    that come from the inferior in target byte order and target size. */
 
 void
-print_type_scalar (type, val, stream)
-     struct type *type;
-     LONGEST val;
-     struct ui_file *stream;
+print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
 {
   unsigned int i;
   unsigned len;
@@ -288,9 +330,7 @@
    and whatis_command(). */
 
 void
-maintenance_print_type (typename, from_tty)
-     char *typename;
-     int from_tty;
+maintenance_print_type (char *typename, int from_tty)
 {
   register value_ptr val;
   register struct type *type;
@@ -323,7 +363,7 @@
 
 
 void
-_initialize_typeprint ()
+_initialize_typeprint (void)
 {
 
   add_com ("ptype", class_vars, ptype_command,
diff --git a/gdb/ui-file.c b/gdb/ui-file.c
index 2861e03..616cc54 100644
--- a/gdb/ui-file.c
+++ b/gdb/ui-file.c
@@ -50,7 +50,7 @@
 int ui_file_magic;
 
 struct ui_file *
-ui_file_new ()
+ui_file_new (void)
 {
   struct ui_file *file = xmalloc (sizeof (struct ui_file));
   file->magic = &ui_file_magic;
@@ -65,23 +65,20 @@
 }
 
 void
-ui_file_delete (file)
-     struct ui_file *file;
+ui_file_delete (struct ui_file *file)
 {
   file->to_delete (file);
-  free (file);
+  xfree (file);
 }
 
 static int
-null_file_isatty (file)
-     struct ui_file *file;
+null_file_isatty (struct ui_file *file)
 {
   return 0;
 }
 
 static void
-null_file_rewind (file)
-     struct ui_file *file;
+null_file_rewind (struct ui_file *file)
 {
   return;
 }
@@ -95,8 +92,7 @@
 }
 
 static void
-null_file_flush (file)
-     struct ui_file *file;
+null_file_flush (struct ui_file *file)
 {
   return;
 }
@@ -130,9 +126,7 @@
 }
 
 static void
-null_file_fputs (buf, file)
-     const char *buf;
-     struct ui_file *file;
+null_file_fputs (const char *buf, struct ui_file *file)
 {
   if (file->to_write == null_file_write)
     /* Both the write and fputs methods are null. Discard the
@@ -146,15 +140,13 @@
 }
 
 static void
-null_file_delete (file)
-     struct ui_file *file;
+null_file_delete (struct ui_file *file)
 {
   return;
 }
 
 void *
-ui_file_data (file)
-     struct ui_file *file;
+ui_file_data (struct ui_file *file)
 {
   if (file->magic != &ui_file_magic)
     internal_error ("ui_file_data: bad magic number");
@@ -162,22 +154,19 @@
 }
 
 void
-gdb_flush (file)
-     struct ui_file *file;
+gdb_flush (struct ui_file *file)
 {
   file->to_flush (file);
 }
 
 int
-ui_file_isatty (file)
-     struct ui_file *file;
+ui_file_isatty (struct ui_file *file)
 {
   return file->to_isatty (file);
 }
 
 void
-ui_file_rewind (file)
-     struct ui_file *file;
+ui_file_rewind (struct ui_file *file)
 {
   file->to_rewind (file);
 }
@@ -199,41 +188,31 @@
 }
 
 void
-fputs_unfiltered (buf, file)
-     const char *buf;
-     struct ui_file *file;
+fputs_unfiltered (const char *buf, struct ui_file *file)
 {
   file->to_fputs (buf, file);
 }
 
 void
-set_ui_file_flush (file, flush)
-     struct ui_file *file;
-     ui_file_flush_ftype *flush;
+set_ui_file_flush (struct ui_file *file, ui_file_flush_ftype *flush)
 {
   file->to_flush = flush;
 }
 
 void
-set_ui_file_isatty (file, isatty)
-     struct ui_file *file;
-     ui_file_isatty_ftype *isatty;
+set_ui_file_isatty (struct ui_file *file, ui_file_isatty_ftype *isatty)
 {
   file->to_isatty = isatty;
 }
 
 void
-set_ui_file_rewind (file, rewind)
-     struct ui_file *file;
-     ui_file_rewind_ftype *rewind;
+set_ui_file_rewind (struct ui_file *file, ui_file_rewind_ftype *rewind)
 {
   file->to_rewind = rewind;
 }
 
 void
-set_ui_file_put (file, put)
-     struct ui_file *file;
-     ui_file_put_ftype *put;
+set_ui_file_put (struct ui_file *file, ui_file_put_ftype *put)
 {
   file->to_put = put;
 }
@@ -246,18 +225,14 @@
 }
 
 void
-set_ui_file_fputs (file, fputs)
-     struct ui_file *file;
-     ui_file_fputs_ftype *fputs;
+set_ui_file_fputs (struct ui_file *file, ui_file_fputs_ftype *fputs)
 {
   file->to_fputs = fputs;
 }
 
 void
-set_ui_file_data (file, data, delete)
-     struct ui_file *file;
-     void *data;
-     ui_file_delete_ftype *delete;
+set_ui_file_data (struct ui_file *file, void *data,
+		  ui_file_delete_ftype *delete)
 {
   file->to_data = data;
   file->to_delete = delete;
@@ -341,8 +316,8 @@
   if (stream->magic != &mem_file_magic)
     internal_error ("mem_file_delete: bad magic number");
   if (stream->buffer != NULL)
-    free (stream->buffer);
-  free (stream);
+    xfree (stream->buffer);
+  xfree (stream);
 }
 
 struct ui_file *
@@ -420,9 +395,7 @@
   };
 
 static struct ui_file *
-stdio_file_new (file, close_p)
-     FILE *file;
-     int close_p;
+stdio_file_new (FILE *file, int close_p)
 {
   struct ui_file *ui_file = ui_file_new ();
   struct stdio_file *stdio = xmalloc (sizeof (struct stdio_file));
@@ -438,8 +411,7 @@
 }
 
 static void
-stdio_file_delete (file)
-     struct ui_file *file;
+stdio_file_delete (struct ui_file *file)
 {
   struct stdio_file *stdio = ui_file_data (file);
   if (stdio->magic != &stdio_file_magic)
@@ -448,12 +420,11 @@
     {
       fclose (stdio->file);
     }
-  free (stdio);
+  xfree (stdio);
 }
 
 static void
-stdio_file_flush (file)
-     struct ui_file *file;
+stdio_file_flush (struct ui_file *file)
 {
   struct stdio_file *stdio = ui_file_data (file);
   if (stdio->magic != &stdio_file_magic)
@@ -471,9 +442,7 @@
 }
 
 static void
-stdio_file_fputs (linebuffer, file)
-     const char *linebuffer;
-     struct ui_file *file;
+stdio_file_fputs (const char *linebuffer, struct ui_file *file)
 {
   struct stdio_file *stdio = ui_file_data (file);
   if (stdio->magic != &stdio_file_magic)
@@ -482,8 +451,7 @@
 }
 
 static int
-stdio_file_isatty (file)
-     struct ui_file *file;
+stdio_file_isatty (struct ui_file *file)
 {
   struct stdio_file *stdio = ui_file_data (file);
   if (stdio->magic != &stdio_file_magic)
@@ -494,16 +462,13 @@
 /* Like fdopen().  Create a ui_file from a previously opened FILE. */
 
 struct ui_file *
-stdio_fileopen (file)
-     FILE *file;
+stdio_fileopen (FILE *file)
 {
   return stdio_file_new (file, 0);
 }
 
 struct ui_file *
-gdb_fopen (name, mode)
-     char *name;
-     char *mode;
+gdb_fopen (char *name, char *mode)
 {
   FILE *f = fopen (name, mode);
   if (f == NULL)
diff --git a/gdb/ui-out.c b/gdb/ui-out.c
index f94cd60..7953326 100644
--- a/gdb/ui-out.c
+++ b/gdb/ui-out.c
@@ -187,10 +187,7 @@
 /* Mark beginning of a table */
 
 void
-ui_out_table_begin (uiout, nbrofcols, tblid)
-     struct ui_out *uiout;
-     int nbrofcols;
-     char *tblid;
+ui_out_table_begin (struct ui_out *uiout, int nbrofcols, char *tblid)
 {
   if (uiout->table_flag)
     internal_error ("gdb/ui_out.c: tables cannot be nested; table_begin found before \
@@ -208,8 +205,7 @@
 }
 
 void
-ui_out_table_body (uiout)
-     struct ui_out *uiout;
+ui_out_table_body (struct ui_out *uiout)
 {
   if (!uiout->table_flag)
     internal_error ("gdb/ui_out.c: table_body outside a table is not valid; it must be \
@@ -228,8 +224,7 @@
 }
 
 void
-ui_out_table_end (uiout)
-     struct ui_out *uiout;
+ui_out_table_end (struct ui_out *uiout)
 {
   if (!uiout->table_flag)
     internal_error ("gdb/ui_out.c: misplaced table_end or missing table_begin.");
@@ -240,16 +235,13 @@
   uo_table_end (uiout);
 
   if (uiout->table_id)
-    free (uiout->table_id);
+    xfree (uiout->table_id);
   clear_header_list (uiout);
 }
 
 void
-ui_out_table_header (uiout, width, alignment, colhdr)
-     struct ui_out *uiout;
-     int width;
-     enum ui_align alignment;
-     char *colhdr;
+ui_out_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
+		     char *colhdr)
 {
   if (!uiout->table_flag || uiout->body_flag)
     internal_error ("ui_out: table header must be specified after table_begin \
@@ -261,9 +253,7 @@
 }
 
 void
-ui_out_list_begin (uiout, lstid)
-     struct ui_out *uiout;
-     char *lstid;
+ui_out_list_begin (struct ui_out *uiout, char *lstid)
 {
   if (uiout->table_flag && !uiout->body_flag)
     internal_error ("ui_out: table header or table_body expected; lists must be \
@@ -281,8 +271,7 @@
 }
 
 void
-ui_out_list_end (uiout)
-     struct ui_out *uiout;
+ui_out_list_end (struct ui_out *uiout)
 {
   if (!uiout->list_flag)
     internal_error ("ui_out: misplaced list_end; there is no list to be closed.");
@@ -293,10 +282,7 @@
 }
 
 void
-ui_out_field_int (uiout, fldname, value)
-     struct ui_out *uiout;
-     char *fldname;
-     int value;
+ui_out_field_int (struct ui_out *uiout, char *fldname, int value)
 {
   int fldno;
   int width;
@@ -313,10 +299,7 @@
 }
 
 void
-ui_out_field_core_addr (uiout, fldname, address)
-     struct ui_out *uiout;
-     char *fldname;
-     CORE_ADDR address;
+ui_out_field_core_addr (struct ui_out *uiout, char *fldname, CORE_ADDR address)
 {
   char addstr[20];
 
@@ -328,14 +311,11 @@
 }
 
 void
-ui_out_field_stream (uiout, fldname, buf)
-     struct ui_out *uiout;
-     char *fldname;
-     struct ui_stream *buf;
+ui_out_field_stream (struct ui_out *uiout, char *fldname, struct ui_stream *buf)
 {
   long length;
   char *buffer = ui_file_xstrdup (buf->stream, &length);
-  struct cleanup *old_cleanup = make_cleanup (free, buffer);
+  struct cleanup *old_cleanup = make_cleanup (xfree, buffer);
   if (length > 0)
     ui_out_field_string (uiout, fldname, buffer);
   else
@@ -347,9 +327,7 @@
 /* used to ommit a field */
 
 void
-ui_out_field_skip (uiout, fldname)
-     struct ui_out *uiout;
-     char *fldname;
+ui_out_field_skip (struct ui_out *uiout, char *fldname)
 {
   int fldno;
   int width;
@@ -409,17 +387,13 @@
 }
 
 void
-ui_out_spaces (uiout, numspaces)
-     struct ui_out *uiout;
-     int numspaces;
+ui_out_spaces (struct ui_out *uiout, int numspaces)
 {
   uo_spaces (uiout, numspaces);
 }
 
 void
-ui_out_text (uiout, string)
-     struct ui_out *uiout;
-     char *string;
+ui_out_text (struct ui_out *uiout, char *string)
 {
   uo_text (uiout, string);
 }
@@ -437,8 +411,7 @@
 }
 
 struct ui_stream *
-ui_out_stream_new (uiout)
-     struct ui_out *uiout;
+ui_out_stream_new (struct ui_out *uiout)
 {
   struct ui_stream *tempbuf;
 
@@ -449,11 +422,10 @@
 }
 
 void
-ui_out_stream_delete (buf)
-     struct ui_stream *buf;
+ui_out_stream_delete (struct ui_stream *buf)
 {
   ui_file_delete (buf->stream);
-  free (buf);
+  xfree (buf);
 }
 
 static void
@@ -470,25 +442,20 @@
 
 
 void
-ui_out_wrap_hint (uiout, identstring)
-     struct ui_out *uiout;
-     char *identstring;
+ui_out_wrap_hint (struct ui_out *uiout, char *identstring)
 {
   uo_wrap_hint (uiout, identstring);
 }
 
 void
-ui_out_flush (uiout)
-     struct ui_out *uiout;
+ui_out_flush (struct ui_out *uiout)
 {
   uo_flush (uiout);
 }
 
 /* set the flags specified by the mask given */
 int
-ui_out_set_flags (uiout, mask)
-     struct ui_out *uiout;
-     int mask;
+ui_out_set_flags (struct ui_out *uiout, int mask)
 {
   int oldflags = uiout->flags;
 
@@ -499,9 +466,7 @@
 
 /* clear the flags specified by the mask given */
 int
-ui_out_clear_flags (uiout, mask)
-     struct ui_out *uiout;
-     int mask;
+ui_out_clear_flags (struct ui_out *uiout, int mask)
 {
   int oldflags = uiout->flags;
 
@@ -512,9 +477,7 @@
 
 /* test the flags against the mask given */
 int
-ui_out_test_flags (uiout, mask)
-     struct ui_out *uiout;
-     int mask;
+ui_out_test_flags (struct ui_out *uiout, int mask)
 {
   return (uiout->flags & mask);
 }
@@ -523,8 +486,7 @@
    'set verbositylevel' command */
 
 int
-ui_out_get_verblvl (uiout)
-     struct ui_out *uiout;
+ui_out_get_verblvl (struct ui_out *uiout)
 {
   /* FIXME: not implemented yet */
   return 0;
@@ -532,54 +494,42 @@
 
 #if 0
 void
-ui_out_result_begin (uiout, class)
-     struct ui_out *uiout;
-     char *class;
+ui_out_result_begin (struct ui_out *uiout, char *class)
 {
 }
 
 void
-ui_out_result_end (uiout)
-     struct ui_out *uiout;
+ui_out_result_end (struct ui_out *uiout)
 {
 }
 
 void
-ui_out_info_begin (uiout, class)
-     struct ui_out *uiout;
-     char *class;
+ui_out_info_begin (struct ui_out *uiout, char *class)
 {
 }
 
 void
-ui_out_info_end (uiout)
-     struct ui_out *uiout;
+ui_out_info_end (struct ui_out *uiout)
 {
 }
 
 void
-ui_out_notify_begin (uiout, class)
-     struct ui_out *uiout;
-     char *class;
+ui_out_notify_begin (struct ui_out *uiout, char *class)
 {
 }
 
 void
-ui_out_notify_end (uiout)
-     struct ui_out *uiout;
+ui_out_notify_end (struct ui_out *uiout)
 {
 }
 
 void
-ui_out_error_begin (uiout, class)
-     struct ui_out *uiout;
-     char *class;
+ui_out_error_begin (struct ui_out *uiout, char *class)
 {
 }
 
 void
-ui_out_error_end (uiout)
-     struct ui_out *uiout;
+ui_out_error_end (struct ui_out *uiout)
 {
 }
 #endif
@@ -592,10 +542,7 @@
 }
 
 void
-gdb_query (uiout, qflags, qprompt)
-     struct ui_out *uiout;
-     int flags;
-     char *qprompt;
+gdb_query (struct ui_out *uiout, int qflags, char *qprompt)
 {
 }
 #endif
@@ -603,67 +550,45 @@
 /* default gdb-out hook functions */
 
 static void
-default_table_begin (uiout, nbrofcols, tblid)
-     struct ui_out *uiout;
-     int nbrofcols;
-     char *tblid;
+default_table_begin (struct ui_out *uiout, int nbrofcols, char *tblid)
 {
 }
 
 static void
-default_table_body (uiout)
-     struct ui_out *uiout;
+default_table_body (struct ui_out *uiout)
 {
 }
 
 static void
-default_table_end (uiout)
-     struct ui_out *uiout;
+default_table_end (struct ui_out *uiout)
 {
 }
 
 static void
-default_table_header (uiout, width, alignment, colhdr)
-     struct ui_out *uiout;
-     int width;
-     enum ui_align alignment;
-     char *colhdr;
+default_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
+		      char *colhdr)
 {
 }
 
 static void
-default_list_begin (uiout, list_flag, lstid)
-     struct ui_out *uiout;
-     int list_flag;
-     char *lstid;
+default_list_begin (struct ui_out *uiout, int list_flag, char *lstid)
 {
 }
 
 static void
-default_list_end (uiout, list_flag)
-     struct ui_out *uiout;
-     int list_flag;
+default_list_end (struct ui_out *uiout, int list_flag)
 {
 }
 
 static void
-default_field_int (uiout, fldno, width, align, fldname, value)
-     struct ui_out *uiout;
-     int fldno;
-     int width;
-     enum ui_align align;
-     char *fldname;
-     int value;
+default_field_int (struct ui_out *uiout, int fldno, int width,
+		   enum ui_align align, char *fldname, int value)
 {
 }
 
 static void
-default_field_skip (uiout, fldno, width, align, fldname)
-     struct ui_out *uiout;
-     int fldno;
-     int width;
-     enum ui_align align;
-     char *fldname;
+default_field_skip (struct ui_out *uiout, int fldno, int width,
+		    enum ui_align align, char *fldname)
 {
 }
 
@@ -678,50 +603,35 @@
 }
 
 static void
-default_field_fmt (uiout, fldno, width, align, fldname, format, args)
-     struct ui_out *uiout;
-     int fldno;
-     int width;
-     enum ui_align align;
-     char *fldname;
-     char *format;
-     va_list args;
+default_field_fmt (struct ui_out *uiout, int fldno, int width,
+		   enum ui_align align, char *fldname, char *format,
+		   va_list args)
 {
 }
 
 static void
-default_spaces (uiout, numspaces)
-     struct ui_out *uiout;
-     int numspaces;
+default_spaces (struct ui_out *uiout, int numspaces)
 {
 }
 
 static void
-default_text (uiout, string)
-     struct ui_out *uiout;
-     char *string;
+default_text (struct ui_out *uiout, char *string)
 {
 }
 
 static void
-default_message (uiout, verbosity, format, args)
-     struct ui_out *uiout;
-     int verbosity;
-     char *format;
-     va_list args;
+default_message (struct ui_out *uiout, int verbosity, char *format,
+		 va_list args)
 {
 }
 
 static void
-default_wrap_hint (uiout, identstring)
-     struct ui_out *uiout;
-     char *identstring;
+default_wrap_hint (struct ui_out *uiout, char *identstring)
 {
 }
 
 static void
-default_flush (uiout)
-     struct ui_out *uiout;
+default_flush (struct ui_out *uiout)
 {
 }
 
@@ -853,16 +763,15 @@
 /* list of column headers manipulation routines */
 
 static void
-clear_header_list (uiout)
-     struct ui_out *uiout;
+clear_header_list (struct ui_out *uiout)
 {
   while (uiout->headerfirst != NULL)
     {
       uiout->headercurr = uiout->headerfirst;
       uiout->headerfirst = uiout->headerfirst->next;
       if (uiout->headercurr->colhdr != NULL)
-	free (uiout->headercurr->colhdr);
-      free (uiout->headercurr);
+	xfree (uiout->headercurr->colhdr);
+      xfree (uiout->headercurr);
     }
   uiout->headerlast = NULL;
   uiout->headercurr = NULL;
@@ -964,8 +873,7 @@
 /* access to ui_out format private members */
 
 void
-ui_out_get_field_separator (uiout)
-     struct ui_out *uiout;
+ui_out_get_field_separator (struct ui_out *uiout)
 {
 }
 
@@ -1001,7 +909,7 @@
 /* standard gdb initialization hook */
 
 void
-_initialize_ui_out ()
+_initialize_ui_out (void)
 {
   /* nothing needs to be done */
 }
diff --git a/gdb/ultra3-nat.c b/gdb/ultra3-nat.c
index f70e26a..02ff8ec 100644
--- a/gdb/ultra3-nat.c
+++ b/gdb/ultra3-nat.c
@@ -64,8 +64,7 @@
  */
 
 void
-fetch_inferior_registers (regno)
-     int regno;
+fetch_inferior_registers (int regno)
 {
   register int i, j, ret_val = 0;
   char buf[128];
@@ -142,8 +141,7 @@
  */
 
 void
-store_inferior_registers (regno)
-     int regno;
+store_inferior_registers (int regno)
 {
   register unsigned int regaddr;
   char buf[80];
@@ -225,8 +223,7 @@
  * NOTE: Assumes AMD's Binary Compatibility Standard for ptrace().
  */
 static void
-fetch_register (regno)
-     int regno;
+fetch_register (int regno)
 {
   char buf[128];
   int val;
@@ -257,14 +254,13 @@
 /* 
  * Read AMD's Binary Compatibilty Standard conforming core file.
  * struct ptrace_user is the first thing in the core file
+ *
+ * CORE_REG_SECT, CORE_REG_SIZE, WHICH, and REG_ADDR are all ignored.
  */
 
 static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
-     char *core_reg_sect;	/* Unused in this version */
-     unsigned core_reg_size;	/* Unused in this version */
-     int which;			/* Unused in this version */
-     CORE_ADDR reg_addr;	/* Unused in this version */
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
+		      int which, CORE_ADDR reg_addr)
 {
   register int regno;
   int val;
@@ -301,9 +297,7 @@
  * will cause ptrace() to fail is returned.
  */
 CORE_ADDR
-register_addr (regno, blockend)
-     int regno;
-     CORE_ADDR blockend;
+register_addr (int regno, CORE_ADDR blockend)
 {
   if ((regno >= LR0_REGNUM) && (regno < LR0_REGNUM + 128))
     {
@@ -361,7 +355,7 @@
 };
 
 void
-_initialize_core_ultra3 ()
+_initialize_core_ultra3 (void)
 {
   add_core_fns (&ultra3_core_fns);
 }
diff --git a/gdb/ultra3-xdep.c b/gdb/ultra3-xdep.c
index 83aa770..c1b91c4 100644
--- a/gdb/ultra3-xdep.c
+++ b/gdb/ultra3-xdep.c
@@ -43,14 +43,13 @@
 
 /* FIXME: Kludge this for now. It really should be system call. */
 int
-getpagesize ()
+getpagesize (void)
 {
   return (8192);
 }
 
 /* FIXME: Fake out the fcntl() call, which we don't have.  */
-fcntl (fd, cmd, arg)
-     int fd, cmd, arg;
+fcntl (int fd, int cmd, int arg)
 {
 
   switch (cmd)
@@ -71,21 +70,19 @@
 static int _SigMask;
 #define sigbit(s)       (1L << ((s)-1))
 
-init_SigMask ()
+init_SigMask (void)
 {
   /* Taken from the sym1 kernel in machdep.c:startup() */
   _SigMask = sigbit (SIGTSTP) | sigbit (SIGTTOU) | sigbit (SIGTTIN) |
     sigbit (SIGCHLD) | sigbit (SIGTINT);
 }
 
-sigmask (signo)
-     int signo;
+sigmask (int signo)
 {
   return (1 << (signo - 1));
 }
 
-sigsetmask (sigmask)
-     unsigned int sigmask;
+sigsetmask (unsigned int sigmask)
 {
   int i, mask = 1;
   int lastmask = _SigMask;
@@ -110,8 +107,7 @@
   return (lastmask);
 }
 
-sigblock (sigmask)
-     unsigned int sigmask;
+sigblock (unsigned int sigmask)
 {
   int i, mask = 1;
   int lastmask = _SigMask;
@@ -133,7 +129,7 @@
 /* Initialization code for this module.  */
 
 void
-_initialize_ultra3 ()
+_initialize_ultra3 (void)
 {
 #ifdef SYM1
   init_SigMask ();
diff --git a/gdb/umax-xdep.c b/gdb/umax-xdep.c
index 75e088c..84431fe 100644
--- a/gdb/umax-xdep.c
+++ b/gdb/umax-xdep.c
@@ -40,9 +40,7 @@
    This code would be in corefile.c if it weren't machine-dependent. */
 
 void
-core_file_command (filename, from_tty)
-     char *filename;
-     int from_tty;
+core_file_command (char *filename, int from_tty)
 {
   int val;
 
@@ -50,7 +48,7 @@
      and mark data and stack spaces as empty.  */
 
   if (corefile)
-    free (corefile);
+    xfree (corefile);
   corefile = 0;
 
   if (corechan >= 0)
@@ -67,7 +65,7 @@
   if (filename)
     {
       filename = tilde_expand (filename);
-      make_cleanup (free, filename);
+      make_cleanup (xfree, filename);
 
       if (have_inferior_p ())
 	error ("To look at a core file, you must kill the program with \"kill\".");
diff --git a/gdb/utils.c b/gdb/utils.c
index b3a3ad9..2ebe169 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -189,15 +189,13 @@
 }
 
 static void
-do_freeargv (arg)
-     void *arg;
+do_freeargv (void *arg)
 {
   freeargv ((char **) arg);
 }
 
 struct cleanup *
-make_cleanup_freeargv (arg)
-     char **arg;
+make_cleanup_freeargv (char **arg)
 {
   return make_my_cleanup (&cleanup_chain, do_freeargv, arg);
 }
@@ -259,51 +257,45 @@
    until we get back to the point OLD_CHAIN in the cleanup_chain.  */
 
 void
-do_cleanups (old_chain)
-     register struct cleanup *old_chain;
+do_cleanups (register struct cleanup *old_chain)
 {
   do_my_cleanups (&cleanup_chain, old_chain);
 }
 
 void
-do_final_cleanups (old_chain)
-     register struct cleanup *old_chain;
+do_final_cleanups (register struct cleanup *old_chain)
 {
   do_my_cleanups (&final_cleanup_chain, old_chain);
 }
 
 void
-do_run_cleanups (old_chain)
-     register struct cleanup *old_chain;
+do_run_cleanups (register struct cleanup *old_chain)
 {
   do_my_cleanups (&run_cleanup_chain, old_chain);
 }
 
 void
-do_exec_cleanups (old_chain)
-     register struct cleanup *old_chain;
+do_exec_cleanups (register struct cleanup *old_chain)
 {
   do_my_cleanups (&exec_cleanup_chain, old_chain);
 }
 
 void
-do_exec_error_cleanups (old_chain)
-     register struct cleanup *old_chain;
+do_exec_error_cleanups (register struct cleanup *old_chain)
 {
   do_my_cleanups (&exec_error_cleanup_chain, old_chain);
 }
 
 void
-do_my_cleanups (pmy_chain, old_chain)
-     register struct cleanup **pmy_chain;
-     register struct cleanup *old_chain;
+do_my_cleanups (register struct cleanup **pmy_chain,
+		register struct cleanup *old_chain)
 {
   register struct cleanup *ptr;
   while ((ptr = *pmy_chain) != old_chain)
     {
       *pmy_chain = ptr->next;	/* Do this first incase recursion */
       (*ptr->function) (ptr->arg);
-      free (ptr);
+      xfree (ptr);
     }
 }
 
@@ -311,55 +303,50 @@
    until we get back to the point OLD_CHAIN in the cleanup_chain.  */
 
 void
-discard_cleanups (old_chain)
-     register struct cleanup *old_chain;
+discard_cleanups (register struct cleanup *old_chain)
 {
   discard_my_cleanups (&cleanup_chain, old_chain);
 }
 
 void
-discard_final_cleanups (old_chain)
-     register struct cleanup *old_chain;
+discard_final_cleanups (register struct cleanup *old_chain)
 {
   discard_my_cleanups (&final_cleanup_chain, old_chain);
 }
 
 void
-discard_exec_error_cleanups (old_chain)
-     register struct cleanup *old_chain;
+discard_exec_error_cleanups (register struct cleanup *old_chain)
 {
   discard_my_cleanups (&exec_error_cleanup_chain, old_chain);
 }
 
 void
-discard_my_cleanups (pmy_chain, old_chain)
-     register struct cleanup **pmy_chain;
-     register struct cleanup *old_chain;
+discard_my_cleanups (register struct cleanup **pmy_chain,
+		     register struct cleanup *old_chain)
 {
   register struct cleanup *ptr;
   while ((ptr = *pmy_chain) != old_chain)
     {
       *pmy_chain = ptr->next;
-      free (ptr);
+      xfree (ptr);
     }
 }
 
 /* Set the cleanup_chain to 0, and return the old cleanup chain.  */
 struct cleanup *
-save_cleanups ()
+save_cleanups (void)
 {
   return save_my_cleanups (&cleanup_chain);
 }
 
 struct cleanup *
-save_final_cleanups ()
+save_final_cleanups (void)
 {
   return save_my_cleanups (&final_cleanup_chain);
 }
 
 struct cleanup *
-save_my_cleanups (pmy_chain)
-     struct cleanup **pmy_chain;
+save_my_cleanups (struct cleanup **pmy_chain)
 {
   struct cleanup *old_chain = *pmy_chain;
 
@@ -369,23 +356,19 @@
 
 /* Restore the cleanup chain from a previously saved chain.  */
 void
-restore_cleanups (chain)
-     struct cleanup *chain;
+restore_cleanups (struct cleanup *chain)
 {
   restore_my_cleanups (&cleanup_chain, chain);
 }
 
 void
-restore_final_cleanups (chain)
-     struct cleanup *chain;
+restore_final_cleanups (struct cleanup *chain)
 {
   restore_my_cleanups (&final_cleanup_chain, chain);
 }
 
 void
-restore_my_cleanups (pmy_chain, chain)
-     struct cleanup **pmy_chain;
-     struct cleanup *chain;
+restore_my_cleanups (struct cleanup **pmy_chain, struct cleanup *chain)
 {
   *pmy_chain = chain;
 }
@@ -406,7 +389,7 @@
     internal_error ("free_current_contents: NULL pointer");
   if (*location != NULL)
     {
-      free (*location);
+      xfree (*location);
       *location = NULL;
     }
 }
@@ -424,12 +407,11 @@
 {
 }
 
-/* Add a continuation to the continuation list, the gloabl list
+/* Add a continuation to the continuation list, the global list
    cmd_continuation. The new continuation will be added at the front.*/
 void
-add_continuation (continuation_hook, arg_list)
-     void (*continuation_hook) (struct continuation_arg *);
-     struct continuation_arg *arg_list;
+add_continuation (void (*continuation_hook) (struct continuation_arg *),
+		  struct continuation_arg *arg_list)
 {
   struct continuation *continuation_ptr;
 
@@ -449,7 +431,7 @@
    and do the continuations from there on, instead of using the
    global beginning of list as our iteration pointer.*/
 void
-do_all_continuations ()
+do_all_continuations (void)
 {
   struct continuation *continuation_ptr;
   struct continuation *saved_continuation;
@@ -467,14 +449,14 @@
        (continuation_ptr->continuation_hook) (continuation_ptr->arg_list);
        saved_continuation = continuation_ptr;
        continuation_ptr = continuation_ptr->next;
-       free (saved_continuation);
+       xfree (saved_continuation);
      }
 }
 
 /* Walk down the cmd_continuation list, and get rid of all the
    continuations. */
 void
-discard_all_continuations ()
+discard_all_continuations (void)
 {
   struct continuation *continuation_ptr;
 
@@ -482,16 +464,16 @@
     {
       continuation_ptr = cmd_continuation;
       cmd_continuation = continuation_ptr->next;
-      free (continuation_ptr);
+      xfree (continuation_ptr);
     }
 }
 
 /* Add a continuation to the continuation list, the global list
    intermediate_continuation. The new continuation will be added at the front.*/
 void
-add_intermediate_continuation (continuation_hook, arg_list)
-     void (*continuation_hook) (struct continuation_arg *);
-     struct continuation_arg *arg_list;
+add_intermediate_continuation (void (*continuation_hook)
+			       (struct continuation_arg *),
+			       struct continuation_arg *arg_list)
 {
   struct continuation *continuation_ptr;
 
@@ -511,7 +493,7 @@
    and do the continuations from there on, instead of using the
    global beginning of list as our iteration pointer.*/
 void
-do_all_intermediate_continuations ()
+do_all_intermediate_continuations (void)
 {
   struct continuation *continuation_ptr;
   struct continuation *saved_continuation;
@@ -529,14 +511,14 @@
        (continuation_ptr->continuation_hook) (continuation_ptr->arg_list);
        saved_continuation = continuation_ptr;
        continuation_ptr = continuation_ptr->next;
-       free (saved_continuation);
+       xfree (saved_continuation);
      }
 }
 
 /* Walk down the cmd_continuation list, and get rid of all the
    continuations. */
 void
-discard_all_intermediate_continuations ()
+discard_all_intermediate_continuations (void)
 {
   struct continuation *continuation_ptr;
 
@@ -544,7 +526,7 @@
     {
       continuation_ptr = intermediate_continuation;
       intermediate_continuation = continuation_ptr->next;
-      free (continuation_ptr);
+      xfree (continuation_ptr);
     }
 }
 
@@ -560,7 +542,7 @@
    Is this anything other than a historical accident?  */
 
 void
-warning_begin ()
+warning_begin (void)
 {
   target_terminal_ours ();
   wrap_here ("");		/* Force out any buffered output */
@@ -599,7 +581,7 @@
    that the error message can be formatted with a single printf call,
    but this is more general.  */
 void
-error_begin ()
+error_begin (void)
 {
   if (error_begin_hook)
     error_begin_hook ();
@@ -624,7 +606,7 @@
   char *err_string;
   struct cleanup *err_string_cleanup;
   /* FIXME: cagney/1999-11-10: All error calls should come here.
-     Unfortunatly some code uses the sequence: error_begin(); print
+     Unfortunately some code uses the sequence: error_begin(); print
      error message; return_to_top_level.  That code should be
      flushed. */
   error_begin ();
@@ -639,7 +621,7 @@
   vfprintf_filtered (gdb_lasterr, string, args);
   /* Retrieve the last error and print it to gdb_stderr */
   err_string = error_last_message ();
-  err_string_cleanup = make_cleanup (free, err_string);
+  err_string_cleanup = make_cleanup (xfree, err_string);
   fputs_filtered (err_string, gdb_stderr);
   fprintf_filtered (gdb_stderr, "\n");
   do_cleanups (err_string_cleanup);
@@ -660,7 +642,7 @@
 {
   long size;
   char *msg = ui_file_xstrdup (stream, &size);
-  make_cleanup (free, msg);
+  make_cleanup (xfree, msg);
   error ("%s", msg);
 }
 
@@ -717,7 +699,7 @@
   /* Default (no case) is to quit GDB.  When in batch mode this
      lessens the likelhood of GDB going into an infinate loop. */
   continue_p = query ("\
-An internal GDB error was detected.  This may make make further\n\
+An internal GDB error was detected.  This may make further\n\
 debugging unreliable.  Continue this debugging session? ");
 
   /* Default (no case) is to not dump core.  Lessen the chance of GDB
@@ -760,8 +742,7 @@
    printable string. */
 
 char *
-safe_strerror (errnum)
-     int errnum;
+safe_strerror (int errnum)
 {
   char *msg;
   static char buf[32];
@@ -779,8 +760,7 @@
    Then return to command level.  */
 
 NORETURN void
-perror_with_name (string)
-     char *string;
+perror_with_name (char *string)
 {
   char *err;
   char *combined;
@@ -804,9 +784,7 @@
    as the file name for which the error was encountered.  */
 
 void
-print_sys_errmsg (string, errcode)
-     char *string;
-     int errcode;
+print_sys_errmsg (char *string, int errcode)
 {
   char *err;
   char *combined;
@@ -826,7 +804,7 @@
 /* Control C eventually causes this to be called, at a convenient time.  */
 
 void
-quit ()
+quit (void)
 {
   serial_t gdb_stdout_serial = serial_fdopen (1);
 
@@ -881,7 +859,7 @@
  */
 
 void
-notice_quit ()
+notice_quit (void)
 {
   int k = win32pollquit ();
   if (k == 1)
@@ -893,7 +871,7 @@
 #else /* !defined(_MSC_VER) */
 
 void
-notice_quit ()
+notice_quit (void)
 {
   /* Done by signals */
 }
@@ -902,8 +880,7 @@
 
 /* Control C comes here */
 void
-request_quit (signo)
-     int signo;
+request_quit (int signo)
 {
   quit_flag = 1;
   /* Restore the signal handler.  Harmless with BSD-style signals, needed
@@ -938,18 +915,13 @@
 }
 
 PTR
-mmalloc (md, size)
-     PTR md;
-     size_t size;
+mmalloc (PTR md, size_t size)
 {
   return malloc (size);
 }
 
 PTR
-mrealloc (md, ptr, size)
-     PTR md;
-     PTR ptr;
-     size_t size;
+mrealloc (PTR md, PTR ptr, size_t size)
 {
   if (ptr == 0)			/* Guard against old realloc's */
     return malloc (size);
@@ -958,11 +930,9 @@
 }
 
 void
-mfree (md, ptr)
-     PTR md;
-     PTR ptr;
+mfree (PTR md, PTR ptr)
 {
-  free (ptr);
+  xfree (ptr);
 }
 
 #endif /* USE_MMALLOC */
@@ -977,7 +947,7 @@
 #else /* Have mmalloc and want corruption checking */
 
 static void
-malloc_botch ()
+malloc_botch (void)
 {
   fprintf_unfiltered (gdb_stderr, "Memory corruption\n");
   abort ();
@@ -1025,8 +995,7 @@
    memory requested in SIZE. */
 
 NORETURN void
-nomem (size)
-     long size;
+nomem (long size)
 {
   if (size > 0)
     {
@@ -1044,9 +1013,7 @@
    byte of zero'd storage, is a religious issue. */
 
 PTR
-xmmalloc (md, size)
-     PTR md;
-     long size;
+xmmalloc (PTR md, long size)
 {
   register PTR val;
 
@@ -1064,10 +1031,7 @@
 /* Like mrealloc but get error if no storage available.  */
 
 PTR
-xmrealloc (md, ptr, size)
-     PTR md;
-     PTR ptr;
-     long size;
+xmrealloc (PTR md, PTR ptr, long size)
 {
   register PTR val;
 
@@ -1090,8 +1054,7 @@
    the caller wanting to allocate zero bytes.  */
 
 PTR
-xmalloc (size)
-     size_t size;
+xmalloc (size_t size)
 {
   return (xmmalloc ((PTR) NULL, size));
 }
@@ -1110,22 +1073,56 @@
 /* Like mrealloc but get error if no storage available.  */
 
 PTR
-xrealloc (ptr, size)
-     PTR ptr;
-     size_t size;
+xrealloc (PTR ptr, size_t size)
 {
   return (xmrealloc ((PTR) NULL, ptr, size));
 }
+
+/* Free up space allocated by one of xmalloc(), xcalloc(), or
+   xrealloc().  */
+
+void
+xfree (void *ptr)
+{
+  if (ptr != NULL)
+    free (ptr);
+}
 
 
+/* Like asprintf/vasprintf but get an internal_error if the call
+   fails. */
+
+void
+xasprintf (char **ret, const char *format, ...)
+{
+  va_list args;
+  va_start (args, format);
+  xvasprintf (ret, format, args);
+  va_end (args);
+}
+
+void
+xvasprintf (char **ret, const char *format, va_list ap)
+{
+  int status = vasprintf (ret, format, ap);
+  /* NULL could be returned due to a memory allocation problem; a
+     badly format string; or something else. */
+  if ((*ret) == NULL)
+    internal_error ("%s:%d: vasprintf returned NULL buffer (errno %d)",
+		    __FILE__, __LINE__, errno);
+  /* A negative status with a non-NULL buffer shouldn't never
+     happen. But to be sure. */
+  if (status < 0)
+    internal_error ("%s:%d: vasprintf call failed (errno %d)",
+		    __FILE__, __LINE__, errno);
+}
+
+
 /* My replacement for the read system call.
    Used like `read' but keeps going if `read' returns too soon.  */
 
 int
-myread (desc, addr, len)
-     int desc;
-     char *addr;
-     int len;
+myread (int desc, char *addr, int len)
 {
   register int val;
   int orglen = len;
@@ -1148,9 +1145,7 @@
    Uses malloc to get the space.  Returns the address of the copy.  */
 
 char *
-savestring (ptr, size)
-     const char *ptr;
-     int size;
+savestring (const char *ptr, int size)
 {
   register char *p = (char *) xmalloc (size + 1);
   memcpy (p, ptr, size);
@@ -1171,8 +1166,7 @@
    in <string.h>.  FIXME: This should be named "xstrsave", shouldn't it?
    Doesn't real strsave return NULL if out of memory?  */
 char *
-strsave (ptr)
-     const char *ptr;
+strsave (const char *ptr)
 {
   return savestring (ptr, strlen (ptr));
 }
@@ -1184,9 +1178,7 @@
 }
 
 void
-print_spaces (n, file)
-     register int n;
-     register struct ui_file *file;
+print_spaces (register int n, register struct ui_file *file)
 {
   fputs_unfiltered (n_spaces (n), file);
 }
@@ -1327,8 +1319,7 @@
    after the zeros.  A value of 0 does not mean end of string.  */
 
 int
-parse_escape (string_ptr)
-     char **string_ptr;
+parse_escape (char **string_ptr)
 {
   register int c = *(*string_ptr)++;
   switch (c)
@@ -1398,15 +1389,10 @@
    be call for printing things which are independent of the language
    of the program being debugged. */
 
-static void printchar (int c, void (*do_fputs) (const char *, struct ui_file*), void (*do_fprintf) (struct ui_file*, const char *, ...), struct ui_file *stream, int quoter);
-
 static void
-printchar (c, do_fputs, do_fprintf, stream, quoter)
-     int c;
-     void (*do_fputs) (const char *, struct ui_file *);
-     void (*do_fprintf) (struct ui_file *, const char *, ...);
-     struct ui_file *stream;
-     int quoter;
+printchar (int c, void (*do_fputs) (const char *, struct ui_file *),
+	   void (*do_fprintf) (struct ui_file *, const char *, ...),
+	   struct ui_file *stream, int quoter)
 {
 
   c &= 0xFF;			/* Avoid sign bit follies */
@@ -1457,31 +1443,21 @@
    the language of the program being debugged. */
 
 void
-fputstr_filtered (str, quoter, stream)
-     const char *str;
-     int quoter;
-     struct ui_file *stream;
+fputstr_filtered (const char *str, int quoter, struct ui_file *stream)
 {
   while (*str)
     printchar (*str++, fputs_filtered, fprintf_filtered, stream, quoter);
 }
 
 void
-fputstr_unfiltered (str, quoter, stream)
-     const char *str;
-     int quoter;
-     struct ui_file *stream;
+fputstr_unfiltered (const char *str, int quoter, struct ui_file *stream)
 {
   while (*str)
     printchar (*str++, fputs_unfiltered, fprintf_unfiltered, stream, quoter);
 }
 
 void
-fputstrn_unfiltered (str, n, quoter, stream)
-     const char *str;
-     int n;
-     int quoter;
-     struct ui_file *stream;
+fputstrn_unfiltered (const char *str, int n, int quoter, struct ui_file *stream)
 {
   int i;
   for (i = 0; i < n; i++)
@@ -1492,7 +1468,7 @@
 
 /* Number of lines per page or UINT_MAX if paging is disabled.  */
 static unsigned int lines_per_page;
-/* Number of chars per line or UNIT_MAX if line folding is disabled.  */
+/* Number of chars per line or UINT_MAX if line folding is disabled.  */
 static unsigned int chars_per_line;
 /* Current count of lines printed on this page, chars on this line.  */
 static unsigned int lines_printed, chars_printed;
@@ -1524,7 +1500,7 @@
 
 /* Inialize the lines and chars per page */
 void
-init_page_info ()
+init_page_info (void)
 {
 #if defined(TUI)
   if (tui_version && m_winPtrNotNull (cmdWin))
@@ -1598,7 +1574,7 @@
 }
 
 static void
-set_width ()
+set_width (void)
 {
   if (chars_per_line == 0)
     init_page_info ();
@@ -1615,10 +1591,7 @@
 
 /* ARGSUSED */
 static void
-set_width_command (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+set_width_command (char *args, int from_tty, struct cmd_list_element *c)
 {
   set_width ();
 }
@@ -1627,7 +1600,7 @@
    to continue by pressing RETURN.  */
 
 static void
-prompt_for_continue ()
+prompt_for_continue (void)
 {
   char *ignore;
   char cont_prompt[120];
@@ -1673,7 +1646,7 @@
 	  else
 	    async_request_quit (0);
 	}
-      free (ignore);
+      xfree (ignore);
     }
   immediate_quit--;
 
@@ -1687,7 +1660,7 @@
 /* Reinitialize filter; ie. tell it to reset to original values.  */
 
 void
-reinitialize_more_filter ()
+reinitialize_more_filter (void)
 {
   lines_printed = 0;
   chars_printed = 0;
@@ -1715,8 +1688,7 @@
    used to force out output from the wrap_buffer.  */
 
 void
-wrap_here (indent)
-     char *indent;
+wrap_here (char *indent)
 {
   /* This should have been allocated, but be paranoid anyway. */
   if (!wrap_buffer)
@@ -1756,7 +1728,7 @@
    line.  Otherwise do nothing. */
 
 void
-begin_line ()
+begin_line (void)
 {
   if (chars_printed > 0)
     {
@@ -1779,10 +1751,8 @@
    routine should not be called when cleanups are not in place.  */
 
 static void
-fputs_maybe_filtered (linebuffer, stream, filter)
-     const char *linebuffer;
-     struct ui_file *stream;
-     int filter;
+fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
+		      int filter)
 {
   const char *lineptr;
 
@@ -1883,16 +1853,13 @@
 }
 
 void
-fputs_filtered (linebuffer, stream)
-     const char *linebuffer;
-     struct ui_file *stream;
+fputs_filtered (const char *linebuffer, struct ui_file *stream)
 {
   fputs_maybe_filtered (linebuffer, stream, 1);
 }
 
 int
-putchar_unfiltered (c)
-     int c;
+putchar_unfiltered (int c)
 {
   char buf = c;
   ui_file_write (gdb_stdout, &buf, 1);
@@ -1900,9 +1867,7 @@
 }
 
 int
-fputc_unfiltered (c, stream)
-     int c;
-     struct ui_file *stream;
+fputc_unfiltered (int c, struct ui_file *stream)
 {
   char buf = c;
   ui_file_write (stream, &buf, 1);
@@ -1910,9 +1875,7 @@
 }
 
 int
-fputc_filtered (c, stream)
-     int c;
-     struct ui_file *stream;
+fputc_filtered (int c, struct ui_file *stream)
 {
   char buf[2];
 
@@ -1926,10 +1889,7 @@
    characters in printable fashion.  */
 
 void
-puts_debug (prefix, string, suffix)
-     char *prefix;
-     char *string;
-     char *suffix;
+puts_debug (char *prefix, char *string, char *suffix)
 {
   int ch;
 
@@ -2025,68 +1985,45 @@
    called when cleanups are not in place.  */
 
 static void
-vfprintf_maybe_filtered (stream, format, args, filter)
-     struct ui_file *stream;
-     const char *format;
-     va_list args;
-     int filter;
+vfprintf_maybe_filtered (struct ui_file *stream, const char *format,
+			 va_list args, int filter)
 {
   char *linebuffer;
   struct cleanup *old_cleanups;
 
-  vasprintf (&linebuffer, format, args);
-  if (linebuffer == NULL)
-    {
-      fputs_unfiltered ("\ngdb: virtual memory exhausted.\n", gdb_stderr);
-      exit (1);
-    }
-  old_cleanups = make_cleanup (free, linebuffer);
+  xvasprintf (&linebuffer, format, args);
+  old_cleanups = make_cleanup (xfree, linebuffer);
   fputs_maybe_filtered (linebuffer, stream, filter);
   do_cleanups (old_cleanups);
 }
 
 
 void
-vfprintf_filtered (stream, format, args)
-     struct ui_file *stream;
-     const char *format;
-     va_list args;
+vfprintf_filtered (struct ui_file *stream, const char *format, va_list args)
 {
   vfprintf_maybe_filtered (stream, format, args, 1);
 }
 
 void
-vfprintf_unfiltered (stream, format, args)
-     struct ui_file *stream;
-     const char *format;
-     va_list args;
+vfprintf_unfiltered (struct ui_file *stream, const char *format, va_list args)
 {
   char *linebuffer;
   struct cleanup *old_cleanups;
 
-  vasprintf (&linebuffer, format, args);
-  if (linebuffer == NULL)
-    {
-      fputs_unfiltered ("\ngdb: virtual memory exhausted.\n", gdb_stderr);
-      exit (1);
-    }
-  old_cleanups = make_cleanup (free, linebuffer);
+  xvasprintf (&linebuffer, format, args);
+  old_cleanups = make_cleanup (xfree, linebuffer);
   fputs_unfiltered (linebuffer, stream);
   do_cleanups (old_cleanups);
 }
 
 void
-vprintf_filtered (format, args)
-     const char *format;
-     va_list args;
+vprintf_filtered (const char *format, va_list args)
 {
   vfprintf_maybe_filtered (gdb_stdout, format, args, 1);
 }
 
 void
-vprintf_unfiltered (format, args)
-     const char *format;
-     va_list args;
+vprintf_unfiltered (const char *format, va_list args)
 {
   vfprintf_unfiltered (gdb_stdout, format, args);
 }
@@ -2162,15 +2099,13 @@
    This one doesn't, and had better not!  */
 
 void
-puts_filtered (string)
-     const char *string;
+puts_filtered (const char *string)
 {
   fputs_filtered (string, gdb_stdout);
 }
 
 void
-puts_unfiltered (string)
-     const char *string;
+puts_unfiltered (const char *string)
 {
   fputs_unfiltered (string, gdb_stdout);
 }
@@ -2178,8 +2113,7 @@
 /* Return a pointer to N spaces and a null.  The pointer is good
    until the next call to here.  */
 char *
-n_spaces (n)
-     int n;
+n_spaces (int n)
 {
   char *t;
   static char *spaces = 0;
@@ -2188,7 +2122,7 @@
   if (n > max_spaces)
     {
       if (spaces)
-	free (spaces);
+	xfree (spaces);
       spaces = (char *) xmalloc (n + 1);
       for (t = spaces + n; t != spaces;)
 	*--t = ' ';
@@ -2201,9 +2135,7 @@
 
 /* Print N spaces.  */
 void
-print_spaces_filtered (n, stream)
-     int n;
-     struct ui_file *stream;
+print_spaces_filtered (int n, struct ui_file *stream)
 {
   fputs_filtered (n_spaces (n), stream);
 }
@@ -2216,11 +2148,8 @@
    demangling is off, the name is printed in its "raw" form. */
 
 void
-fprintf_symbol_filtered (stream, name, lang, arg_mode)
-     struct ui_file *stream;
-     char *name;
-     enum language lang;
-     int arg_mode;
+fprintf_symbol_filtered (struct ui_file *stream, char *name, enum language lang,
+			 int arg_mode)
 {
   char *demangled;
 
@@ -2251,7 +2180,7 @@
 	  fputs_filtered (demangled ? demangled : name, stream);
 	  if (demangled != NULL)
 	    {
-	      free (demangled);
+	      xfree (demangled);
 	    }
 	}
     }
@@ -2267,9 +2196,7 @@
    function). */
 
 int
-strcmp_iw (string1, string2)
-     const char *string1;
-     const char *string2;
+strcmp_iw (const char *string1, const char *string2)
 {
   while ((*string1 != '\0') && (*string2 != '\0'))
     {
@@ -2302,9 +2229,7 @@
    **    at index 0.
  */
 int
-subset_compare (string_to_compare, template_string)
-     char *string_to_compare;
-     char *template_string;
+subset_compare (char *string_to_compare, char *template_string)
 {
   int match;
   if (template_string != (char *) NULL && string_to_compare != (char *) NULL &&
@@ -2320,25 +2245,21 @@
 
 static void pagination_on_command (char *arg, int from_tty);
 static void
-pagination_on_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+pagination_on_command (char *arg, int from_tty)
 {
   pagination_enabled = 1;
 }
 
 static void pagination_on_command (char *arg, int from_tty);
 static void
-pagination_off_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+pagination_off_command (char *arg, int from_tty)
 {
   pagination_enabled = 0;
 }
 
 
 void
-initialize_utils ()
+initialize_utils (void)
 {
   struct cmd_list_element *c;
 
@@ -2426,12 +2347,8 @@
 /* Extract a field which starts at START and is LEN bytes long.  DATA and
    TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER.  */
 static unsigned long
-get_field (data, order, total_len, start, len)
-     unsigned char *data;
-     enum floatformat_byteorders order;
-     unsigned int total_len;
-     unsigned int start;
-     unsigned int len;
+get_field (unsigned char *data, enum floatformat_byteorders order,
+	   unsigned int total_len, unsigned int start, unsigned int len)
 {
   unsigned long result;
   unsigned int cur_byte;
@@ -2490,10 +2407,8 @@
    Store the DOUBLEST in *TO.  */
 
 void
-floatformat_to_doublest (fmt, from, to)
-     const struct floatformat *fmt;
-     char *from;
-     DOUBLEST *to;
+floatformat_to_doublest (const struct floatformat *fmt, char *from,
+			 DOUBLEST *to)
 {
   unsigned char *ufrom = (unsigned char *) from;
   DOUBLEST dto;
@@ -2604,13 +2519,9 @@
 /* Set a field which starts at START and is LEN bytes long.  DATA and
    TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER.  */
 static void
-put_field (data, order, total_len, start, len, stuff_to_put)
-     unsigned char *data;
-     enum floatformat_byteorders order;
-     unsigned int total_len;
-     unsigned int start;
-     unsigned int len;
-     unsigned long stuff_to_put;
+put_field (unsigned char *data, enum floatformat_byteorders order,
+	   unsigned int total_len, unsigned int start, unsigned int len,
+	   unsigned long stuff_to_put)
 {
   unsigned int cur_byte;
   int cur_bitshift;
@@ -2673,9 +2584,7 @@
 static long double ldfrexp (long double value, int *eptr);
 
 static long double
-ldfrexp (value, eptr)
-     long double value;
-     int *eptr;
+ldfrexp (long double value, int *eptr)
 {
   long double tmp;
   int exp;
@@ -2718,10 +2627,8 @@
    restrictions.  */
 
 void
-floatformat_from_doublest (fmt, from, to)
-     CONST struct floatformat *fmt;
-     DOUBLEST *from;
-     char *to;
+floatformat_from_doublest (CONST struct floatformat *fmt, DOUBLEST *from,
+			   char *to)
 {
   DOUBLEST dfrom;
   int exponent;
@@ -2830,7 +2737,7 @@
 #define NUMCELLS 16
 #define CELLSIZE 32
 static char *
-get_cell ()
+get_cell (void)
 {
   static char buf[NUMCELLS][CELLSIZE];
   static int cell = 0;
@@ -2842,19 +2749,19 @@
 int
 strlen_paddr (void)
 {
-  return (TARGET_PTR_BIT / 8 * 2);
+  return (TARGET_ADDR_BIT / 8 * 2);
 }
 
 char *
 paddr (CORE_ADDR addr)
 {
-  return phex (addr, TARGET_PTR_BIT / 8);
+  return phex (addr, TARGET_ADDR_BIT / 8);
 }
 
 char *
 paddr_nz (CORE_ADDR addr)
 {
-  return phex_nz (addr, TARGET_PTR_BIT / 8);
+  return phex_nz (addr, TARGET_ADDR_BIT / 8);
 }
 
 static void
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 0501760..81b27e5 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1,5 +1,5 @@
 /* Target-dependent code for the NEC V850 for GDB, the GNU debugger.
-   Copyright 1996, Free Software Foundation, Inc.
+   Copyright 1996, 2000 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -28,6 +28,7 @@
 #include "gdb_string.h"
 #include "gdbcore.h"
 #include "symfile.h"
+#include "arch-utils.h"
 
 
 static char *v850_generic_reg_names[] = REGISTER_NAMES;
@@ -94,9 +95,7 @@
 
 /* Should call_function allocate stack space for a struct return?  */
 int
-v850_use_struct_convention (gcc_p, type)
-     int gcc_p;
-     struct type *type;
+v850_use_struct_convention (int gcc_p, struct type *type)
 {
   return (TYPE_NFIELDS (type) > 1 || TYPE_LENGTH (type) > 4);
 }
@@ -115,7 +114,6 @@
 static void
 handle_prepare (int insn, int insn2, CORE_ADDR * current_pc_ptr,
 		struct prologue_info *pi, struct pifsr **pifsr_ptr)
-
 {
   CORE_ADDR current_pc = *current_pc_ptr;
   struct pifsr *pifsr = *pifsr_ptr;
@@ -192,7 +190,6 @@
 static void
 handle_pushm (int insn, int insn2, struct prologue_info *pi,
 	      struct pifsr **pifsr_ptr)
-
 {
   struct pifsr *pifsr = *pifsr_ptr;
   long list12 = ((insn & 0x0f) << 16) + (insn2 & 0xfff0);
@@ -295,9 +292,7 @@
    be determined till after we have scanned the prologue.  */
 
 static CORE_ADDR
-v850_scan_prologue (pc, pi)
-     CORE_ADDR pc;
-     struct prologue_info *pi;
+v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi)
 {
   CORE_ADDR func_addr, prologue_end, current_pc;
   struct pifsr *pifsr, *pifsr_tmp;
@@ -553,8 +548,7 @@
    pointer just prior to calling the target function (see run_stack_dummy).  */
 
 void
-v850_init_extra_frame_info (fi)
-     struct frame_info *fi;
+v850_init_extra_frame_info (struct frame_info *fi)
 {
   struct prologue_info pi;
   struct pifsr pifsrs[NUM_REGS + 1], *pifsr;
@@ -593,8 +587,7 @@
    function call was made.  */
 
 CORE_ADDR
-v850_frame_chain (fi)
-     struct frame_info *fi;
+v850_frame_chain (struct frame_info *fi)
 {
   struct prologue_info pi;
   CORE_ADDR callers_pc, fp;
@@ -630,9 +623,7 @@
    frame.  */
 
 CORE_ADDR
-v850_find_callers_reg (fi, regnum)
-     struct frame_info *fi;
-     int regnum;
+v850_find_callers_reg (struct frame_info *fi, int regnum)
 {
   for (; fi; fi = fi->next)
     if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
@@ -648,8 +639,7 @@
    Return the address of the first code past the prologue of the function.  */
 
 CORE_ADDR
-v850_skip_prologue (pc)
-     CORE_ADDR pc;
+v850_skip_prologue (CORE_ADDR pc)
 {
   CORE_ADDR func_addr, func_end;
 
@@ -679,8 +669,7 @@
    command, or the call dummy breakpoint gets hit.  */
 
 void
-v850_pop_frame (frame)
-     struct frame_info *frame;
+v850_pop_frame (struct frame_info *frame)
 {
   int regnum;
 
@@ -714,12 +703,8 @@
  */
 
 CORE_ADDR
-v850_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     unsigned char struct_return;
-     CORE_ADDR struct_addr;
+v850_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+		     unsigned char struct_return, CORE_ADDR struct_addr)
 {
   int argreg;
   int argnum;
@@ -798,9 +783,7 @@
    Needed for targets where we don't actually execute a JSR/BSR instruction */
 
 CORE_ADDR
-v850_push_return_address (pc, sp)
-     CORE_ADDR pc;
-     CORE_ADDR sp;
+v850_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
 {
   write_register (RP_REGNUM, CALL_DUMMY_ADDRESS ());
   return sp;
@@ -814,8 +797,7 @@
    will be found.  */
 
 CORE_ADDR
-v850_frame_saved_pc (fi)
-     struct frame_info *fi;
+v850_frame_saved_pc (struct frame_info *fi)
 {
   if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
     return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
@@ -832,14 +814,8 @@
  */
 
 int
-v850_fix_call_dummy (dummy, sp, fun, nargs, args, type, gcc_p)
-     char *dummy;
-     CORE_ADDR sp;
-     CORE_ADDR fun;
-     int nargs;
-     value_ptr *args;
-     struct type *type;
-     int gcc_p;
+v850_fix_call_dummy (char *dummy, CORE_ADDR sp, CORE_ADDR fun, int nargs,
+		     value_ptr *args, struct type *type, int gcc_p)
 {
   long offset24;
 
@@ -855,8 +831,7 @@
 /* Change the register names based on the current machine type. */
 
 static int
-v850_target_architecture_hook (ap)
-     const bfd_arch_info_type *ap;
+v850_target_architecture_hook (const bfd_arch_info_type *ap)
 {
   int i, j;
 
@@ -873,11 +848,11 @@
 	}
     }
 
-  internal_error ("Architecture `%s' unreconized", ap->printable_name);
+  internal_error ("Architecture `%s' unrecognized", ap->printable_name);
 }
 
 void
-_initialize_v850_tdep ()
+_initialize_v850_tdep (void)
 {
   tm_print_insn = print_insn_v850;
   target_architecture_hook = v850_target_architecture_hook;
diff --git a/gdb/v850ice.c b/gdb/v850ice.c
index 2364d2a..6ce875a 100644
--- a/gdb/v850ice.c
+++ b/gdb/v850ice.c
@@ -121,17 +121,17 @@
 
 static void view_source (CORE_ADDR);
 
-static void do_gdb (char *, char *, void (*func) PARAMS ((char *, int)), int);
+static void do_gdb (char *, char *, void (*func) (char *, int), int);
 
 
 /* Globals */
 static HWND hidden_hwnd;	/* HWND for messages */
 
-long (__stdcall * ExeAppReq) PARAMS ((char *, long, char *, struct MessageIO *));
+long (__stdcall * ExeAppReq) (char *, long, char *, struct MessageIO *);
 
-long (__stdcall * RegisterClient) PARAMS ((HWND));
+long (__stdcall * RegisterClient) (HWND);
 
-long (__stdcall * UnregisterClient) PARAMS ((void));
+long (__stdcall * UnregisterClient) (void);
 
 extern Tcl_Interp *gdbtk_interp;
 
@@ -192,7 +192,7 @@
 
 /* This function creates a hidden window */
 static int
-init_hidden_window ()
+init_hidden_window (void)
 {
   WNDCLASS class;
 
@@ -242,11 +242,7 @@
    WM_STATE_CHANGE - tells us that a state change has occured in the ICE
  */
 static LRESULT CALLBACK
-v850ice_wndproc (hwnd, message, wParam, lParam)
-     HWND hwnd;
-     UINT message;
-     WPARAM wParam;
-     LPARAM lParam;
+v850ice_wndproc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
   LRESULT result = FALSE;
 
@@ -318,9 +314,7 @@
 /* Code for opening a connection to the ICE.  */
 
 static void
-v850ice_open (name, from_tty)
-     char *name;
-     int from_tty;
+v850ice_open (char *name, int from_tty)
 {
   HINSTANCE handle;
 
@@ -346,11 +340,11 @@
       if (handle == NULL)
 	error ("Cannot load necmsg.dll");
 
-      ExeAppReq = (long (*)PARAMS ((char *, long, char *, struct MessageIO *)))
+      ExeAppReq = (long (*) (char *, long, char *, struct MessageIO *))
 	GetProcAddress (handle, "ExeAppReq");
-      RegisterClient = (long (*)PARAMS ((HWND)))
+      RegisterClient = (long (*) (HWND))
 	GetProcAddress (handle, "RegisterClient");
-      UnregisterClient = (long (*)PARAMS ((void)))
+      UnregisterClient = (long (*) (void))
 	GetProcAddress (handle, "UnregisterClient");
 
       if (ExeAppReq == NULL || RegisterClient == NULL || UnregisterClient == NULL)
@@ -381,8 +375,7 @@
 
 /* ARGSUSED */
 static void
-v850ice_close (quitting)
-     int quitting;
+v850ice_close (int quitting)
 {
   if (ice_open)
     {
@@ -394,16 +387,14 @@
 
 /* Stop the process on the ice. */
 static void
-v850ice_stop ()
+v850ice_stop (void)
 {
   /* This is silly, but it works... */
   v850ice_command ("stop", 0);
 }
 
 static void
-v850ice_detach (args, from_tty)
-     char *args;
-     int from_tty;
+v850ice_detach (char *args, int from_tty)
 {
   if (args)
     error ("Argument given to \"detach\" when remotely debugging.");
@@ -416,9 +407,7 @@
 /* Tell the remote machine to resume.  */
 
 static void
-v850ice_resume (pid, step, siggnal)
-     int pid, step;
-     enum target_signal siggnal;
+v850ice_resume (int pid, int step, enum target_signal siggnal)
 {
   long retval;
   char buf[256];
@@ -442,9 +431,7 @@
    means in the case of this target).  */
 
 static int
-v850ice_wait (pid, status)
-     int pid;
-     struct target_waitstatus *status;
+v850ice_wait (int pid, struct target_waitstatus *status)
 {
   long v850_status;
   char buf[256];
@@ -500,9 +487,7 @@
 }
 
 static int
-convert_register (regno, buf)
-     int regno;
-     char *buf;
+convert_register (int regno, char *buf)
 {
   if (regno <= 31)
     sprintf (buf, "r%d", regno);
@@ -521,8 +506,7 @@
    convert it to target byte-order if necessary.  */
 
 static void
-v850ice_fetch_registers (regno)
-     int regno;
+v850ice_fetch_registers (int regno)
 {
   long retval;
   char cmd[100];
@@ -561,8 +545,7 @@
    of REGISTERS.  */
 
 static void
-v850ice_store_registers (regno)
-     int regno;
+v850ice_store_registers (int regno)
 {
   long retval;
   char cmd[100];
@@ -595,24 +578,21 @@
    register at a time.  */
 
 static void
-v850ice_prepare_to_store ()
+v850ice_prepare_to_store (void)
 {
 }
 
 /* Read or write LEN bytes from inferior memory at MEMADDR, transferring
    to or from debugger address MYADDR.  Write to inferior if SHOULD_WRITE is
-   nonzero.  Returns length of data written or read; 0 for error.
+   nonzero.  TARGET is unused.  Returns length of data written or read;
+   0 for error.
 
    We can only read/write MAX_BLOCK_SIZE bytes at a time, though, or the DLL
-   dies */
+   dies.  */
 /* ARGSUSED */
 static int
-v850ice_xfer_memory (memaddr, myaddr, len, should_write, target)
-     CORE_ADDR memaddr;
-     char *myaddr;
-     int len;
-     int should_write;
-     struct target_ops *target;	/* ignored */
+v850ice_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
+		     int should_write, struct target_ops *target)
 {
   long retval;
   char cmd[100];
@@ -722,16 +702,13 @@
 }
 
 static void
-v850ice_files_info (ignore)
-     struct target_ops *ignore;
+v850ice_files_info (struct target_ops *ignore)
 {
   puts_filtered ("Debugging a target via the NEC V850 ICE.\n");
 }
 
 static int
-v850ice_insert_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+v850ice_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   long retval;
   char cmd[100];
@@ -750,9 +727,7 @@
 }
 
 static int
-v850ice_remove_breakpoint (addr, contents_cache)
-     CORE_ADDR addr;
-     char *contents_cache;
+v850ice_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   long retval;
   char cmd[100];
@@ -772,21 +747,19 @@
 }
 
 static void
-v850ice_kill ()
+v850ice_kill (void)
 {
   target_mourn_inferior ();
   inferior_pid = 0;
 }
 
 static void
-v850ice_mourn ()
+v850ice_mourn (void)
 {
 }
 
 static void
-v850ice_load (filename, from_tty)
-     char *filename;
-     int from_tty;
+v850ice_load (char *filename, int from_tty)
 {
   struct MessageIO iob;
   char buf[256];
@@ -798,8 +771,7 @@
 }
 
 static int
-ice_file (arg)
-     char *arg;
+ice_file (char *arg)
 {
   char *s;
 
@@ -835,8 +807,7 @@
 }
 
 static int
-ice_cont (c)
-     char *c;
+ice_cont (char *c)
 {
   printf_filtered ("continue (ice)\n");
   ReplyMessage ((LRESULT) 1);
@@ -852,11 +823,7 @@
 }
 
 static void
-do_gdb (cmd, str, func, count)
-     char *cmd;
-     char *str;
-     void (*func) (char *, int);
-     int count;
+do_gdb (char *cmd, char *str, void (*func) (char *, int), int count)
 {
   ReplyMessage ((LRESULT) 1);
 
@@ -875,8 +842,7 @@
 
 
 static int
-ice_stepi (c)
-     char *c;
+ice_stepi (char *c)
 {
   int count = (int) c;
 
@@ -885,8 +851,7 @@
 }
 
 static int
-ice_nexti (c)
-     char *c;
+ice_nexti (char *c)
 {
   int count = (int) c;
 
@@ -895,9 +860,7 @@
 }
 
 static void
-v850ice_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+v850ice_command (char *arg, int from_tty)
 {
   struct MessageIO iob;
   char buf[256];
@@ -915,8 +878,7 @@
 }
 
 static void
-view_source (addr)
-     CORE_ADDR addr;
+view_source (CORE_ADDR addr)
 {
   char c[256];
 
@@ -981,7 +943,7 @@
 }
 
 void
-_initialize_v850ice ()
+_initialize_v850ice (void)
 {
   init_850ice_ops ();
   add_target (&v850ice_ops);
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 2db71fd..321cd3e 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -43,8 +43,7 @@
 
 
 value_ptr
-value_add (arg1, arg2)
-     value_ptr arg1, arg2;
+value_add (value_ptr arg1, value_ptr arg2)
 {
   register value_ptr valint, valptr;
   register int len;
@@ -90,8 +89,7 @@
 }
 
 value_ptr
-value_sub (arg1, arg2)
-     value_ptr arg1, arg2;
+value_sub (value_ptr arg1, value_ptr arg2)
 {
   struct type *type1, *type2;
   COERCE_NUMBER (arg1);
@@ -110,8 +108,8 @@
 				      - (sz * value_as_long (arg2))));
 	}
       else if (TYPE_CODE (type2) == TYPE_CODE_PTR
-	       && TYPE_LENGTH (TYPE_TARGET_TYPE (type1))
-	       == TYPE_LENGTH (TYPE_TARGET_TYPE (type2)))
+	       && TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type1)))
+	       == TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type2))))
 	{
 	  /* pointer to <type x> - pointer to <type x>.  */
 	  LONGEST sz = TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type1)));
@@ -137,8 +135,7 @@
    verbosity is set, warn about invalid indices (but still use them). */
 
 value_ptr
-value_subscript (array, idx)
-     value_ptr array, idx;
+value_subscript (value_ptr array, value_ptr idx)
 {
   value_ptr bound;
   int c_style = current_language->c_style_arrays;
@@ -214,9 +211,7 @@
    to doubles, but no longer does.  */
 
 static value_ptr
-value_subscripted_rvalue (array, idx, lowerbound)
-     value_ptr array, idx;
-     int lowerbound;
+value_subscripted_rvalue (value_ptr array, value_ptr idx, int lowerbound)
 {
   struct type *array_type = check_typedef (VALUE_TYPE (array));
   struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type));
@@ -250,9 +245,7 @@
    For now, we do not overload the `=' operator.  */
 
 int
-binop_user_defined_p (op, arg1, arg2)
-     enum exp_opcode op;
-     value_ptr arg1, arg2;
+binop_user_defined_p (enum exp_opcode op, value_ptr arg1, value_ptr arg2)
 {
   struct type *type1, *type2;
   if (op == BINOP_ASSIGN || op == BINOP_CONCAT)
@@ -274,9 +267,7 @@
    For now, we do not overload the `&' operator.  */
 
 int
-unop_user_defined_p (op, arg1)
-     enum exp_opcode op;
-     value_ptr arg1;
+unop_user_defined_p (enum exp_opcode op, value_ptr arg1)
 {
   struct type *type1;
   if (op == UNOP_ADDR)
@@ -303,10 +294,8 @@
    unused.  */
 
 value_ptr
-value_x_binop (arg1, arg2, op, otherop, noside)
-     value_ptr arg1, arg2;
-     enum exp_opcode op, otherop;
-     enum noside noside;
+value_x_binop (value_ptr arg1, value_ptr arg2, enum exp_opcode op,
+	       enum exp_opcode otherop, enum noside noside)
 {
   value_ptr *argvec;
   char *ptr;
@@ -468,10 +457,7 @@
    is legal for GNU C++).  */
 
 value_ptr
-value_x_unop (arg1, op, noside)
-     value_ptr arg1;
-     enum exp_opcode op;
-     enum noside noside;
+value_x_unop (value_ptr arg1, enum exp_opcode op, enum noside noside)
 {
   value_ptr *argvec;
   char *ptr, *mangle_ptr;
@@ -571,8 +557,7 @@
  */
 
 value_ptr
-value_concat (arg1, arg2)
-     value_ptr arg1, arg2;
+value_concat (value_ptr arg1, value_ptr arg2)
 {
   register value_ptr inval1, inval2, outval = NULL;
   int inval1len, inval2len;
@@ -705,9 +690,7 @@
    use value_add or value_sub if you want to handle those possibilities.  */
 
 value_ptr
-value_binop (arg1, arg2, op)
-     value_ptr arg1, arg2;
-     enum exp_opcode op;
+value_binop (value_ptr arg1, value_ptr arg2, enum exp_opcode op)
 {
   register value_ptr val;
   struct type *type1, *type2;
@@ -1131,8 +1114,7 @@
 /* Simulate the C operator ! -- return 1 if ARG1 contains zero.  */
 
 int
-value_logical_not (arg1)
-     value_ptr arg1;
+value_logical_not (value_ptr arg1)
 {
   register int len;
   register char *p;
@@ -1160,8 +1142,7 @@
    necessarily null terminated) based on their length */
 
 static int
-value_strcmp (arg1, arg2)
-     register value_ptr arg1, arg2;
+value_strcmp (register value_ptr arg1, register value_ptr arg2)
 {
   int len1 = TYPE_LENGTH (VALUE_TYPE (arg1));
   int len2 = TYPE_LENGTH (VALUE_TYPE (arg2));
@@ -1191,9 +1172,7 @@
    iff ARG1 and ARG2 have equal contents.  */
 
 int
-value_equal (arg1, arg2)
-     register value_ptr arg1, arg2;
-
+value_equal (register value_ptr arg1, register value_ptr arg2)
 {
   register int len;
   register char *p1, *p2;
@@ -1252,8 +1231,7 @@
    iff ARG1's contents are less than ARG2's.  */
 
 int
-value_less (arg1, arg2)
-     register value_ptr arg1, arg2;
+value_less (register value_ptr arg1, register value_ptr arg2)
 {
   register enum type_code code1;
   register enum type_code code2;
@@ -1295,8 +1273,7 @@
 /* The unary operators - and ~.  Both free the argument ARG1.  */
 
 value_ptr
-value_neg (arg1)
-     register value_ptr arg1;
+value_neg (register value_ptr arg1)
 {
   register struct type *type;
   register struct type *result_type = VALUE_TYPE (arg1);
@@ -1325,8 +1302,7 @@
 }
 
 value_ptr
-value_complement (arg1)
-     register value_ptr arg1;
+value_complement (register value_ptr arg1)
 {
   register struct type *type;
   register struct type *result_type = VALUE_TYPE (arg1);
@@ -1354,10 +1330,7 @@
    Return -1 if out of range, -2 other error. */
 
 int
-value_bit_index (type, valaddr, index)
-     struct type *type;
-     char *valaddr;
-     int index;
+value_bit_index (struct type *type, char *valaddr, int index)
 {
   LONGEST low_bound, high_bound;
   LONGEST word;
@@ -1377,8 +1350,7 @@
 }
 
 value_ptr
-value_in (element, set)
-     value_ptr element, set;
+value_in (value_ptr element, value_ptr set)
 {
   int member;
   struct type *settype = check_typedef (VALUE_TYPE (set));
@@ -1400,6 +1372,6 @@
 }
 
 void
-_initialize_valarith ()
+_initialize_valarith (void)
 {
 }
diff --git a/gdb/valops.c b/gdb/valops.c
index c84e7a7..835349c 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -92,8 +92,7 @@
 /* Find the address of function name NAME in the inferior.  */
 
 value_ptr
-find_function_in_inferior (name)
-     char *name;
+find_function_in_inferior (char *name)
 {
   register struct symbol *sym;
   sym = lookup_symbol (name, 0, VAR_NAMESPACE, 0, NULL);
@@ -133,8 +132,7 @@
    and return a value that is a pointer to the allocated space. */
 
 value_ptr
-value_allocate_space_in_inferior (len)
-     int len;
+value_allocate_space_in_inferior (int len)
 {
   value_ptr blocklen;
   register value_ptr val = find_function_in_inferior ("malloc");
@@ -152,8 +150,7 @@
 }
 
 static CORE_ADDR
-allocate_space_in_inferior (len)
-     int len;
+allocate_space_in_inferior (int len)
 {
   return value_as_long (value_allocate_space_in_inferior (len));
 }
@@ -164,9 +161,7 @@
 /* In C++, casts may change pointer or object representations.  */
 
 value_ptr
-value_cast (type, arg2)
-     struct type *type;
-     register value_ptr arg2;
+value_cast (struct type *type, register value_ptr arg2)
 {
   register enum type_code code1;
   register enum type_code code2;
@@ -273,7 +268,8 @@
 	      /* With HP aCC, pointers to data members have a bias */
 	    case TYPE_CODE_MEMBER:
 	      retvalp = value_from_longest (type, value_as_long (arg2));
-	      ptr = (unsigned int *) VALUE_CONTENTS (retvalp);	/* force evaluation */
+	      /* force evaluation */
+	      ptr = (unsigned int *) VALUE_CONTENTS (retvalp);
 	      *ptr &= ~0x20000000;	/* zap 29th bit to remove bias */
 	      return retvalp;
 
@@ -286,7 +282,22 @@
 	    }
 	}
       longest = value_as_long (arg2);
-      return value_from_longest (type, convert_to_boolean ? (LONGEST) (longest ? 1 : 0) : longest);
+      return value_from_longest (type, convert_to_boolean ?
+				 (LONGEST) (longest ? 1 : 0) : longest);
+    }
+  else if (code1 == TYPE_CODE_PTR && (code2 == TYPE_CODE_INT  ||
+				      code2 == TYPE_CODE_ENUM ||
+				      code2 == TYPE_CODE_RANGE))
+    {
+      int ptr_bit = HOST_CHAR_BIT * TYPE_LENGTH (type);
+      LONGEST longest = value_as_long (arg2);
+      if (ptr_bit < sizeof (LONGEST) * HOST_CHAR_BIT)
+	{
+	  if (longest >= ((LONGEST) 1 << ptr_bit)
+	      || longest <= -((LONGEST) 1 << ptr_bit))
+	    warning ("value truncated");
+	}
+      return value_from_longest (type, longest);
     }
   else if (TYPE_LENGTH (type) == TYPE_LENGTH (type2))
     {
@@ -409,9 +420,7 @@
 /* Create a value of type TYPE that is zero, and return it.  */
 
 value_ptr
-value_zero (type, lv)
-     struct type *type;
-     enum lval_type lv;
+value_zero (struct type *type, enum lval_type lv)
 {
   register value_ptr val = allocate_value (type);
 
@@ -434,10 +443,7 @@
    adjustments before or after calling it. */
 
 value_ptr
-value_at (type, addr, sect)
-     struct type *type;
-     CORE_ADDR addr;
-     asection *sect;
+value_at (struct type *type, CORE_ADDR addr, asection *sect)
 {
   register value_ptr val;
 
@@ -481,10 +487,7 @@
 /* Return a lazy value with type TYPE located at ADDR (cf. value_at).  */
 
 value_ptr
-value_at_lazy (type, addr, sect)
-     struct type *type;
-     CORE_ADDR addr;
-     asection *sect;
+value_at_lazy (struct type *type, CORE_ADDR addr, asection *sect)
 {
   register value_ptr val;
 
@@ -514,8 +517,7 @@
    value is ignored.  */
 
 int
-value_fetch_lazy (val)
-     register value_ptr val;
+value_fetch_lazy (register value_ptr val)
 {
   CORE_ADDR addr = VALUE_ADDRESS (val) + VALUE_OFFSET (val);
   int length = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (val));
@@ -545,7 +547,7 @@
     }
   else if (length)
     read_memory (addr, VALUE_CONTENTS_ALL_RAW (val), length);
-  
+
   VALUE_LAZY (val) = 0;
   return 0;
 }
@@ -555,8 +557,7 @@
    Return a new value with the location of TOVAL and contents of FROMVAL.  */
 
 value_ptr
-value_assign (toval, fromval)
-     register value_ptr toval, fromval;
+value_assign (register value_ptr toval, register value_ptr fromval)
 {
   register struct type *type;
   register value_ptr val;
@@ -660,7 +661,8 @@
       if (VALUE_BITSIZE (toval))
 	{
 	  char buffer[sizeof (LONGEST)];
-	  int len = REGISTER_RAW_SIZE (VALUE_REGNO (toval));
+	  int len =
+		REGISTER_RAW_SIZE (VALUE_REGNO (toval)) - VALUE_OFFSET (toval);
 
 	  if (len > (int) sizeof (LONGEST))
 	    error ("Can't handle bitfields in registers larger than %d bits.",
@@ -820,9 +822,7 @@
 /* Extend a value VAL to COUNT repetitions of its type.  */
 
 value_ptr
-value_repeat (arg1, count)
-     value_ptr arg1;
-     int count;
+value_repeat (value_ptr arg1, int count)
 {
   register value_ptr val;
 
@@ -843,9 +843,7 @@
 }
 
 value_ptr
-value_of_variable (var, b)
-     struct symbol *var;
-     struct block *b;
+value_of_variable (struct symbol *var, struct block *b)
 {
   value_ptr val;
   struct frame_info *frame = NULL;
@@ -897,8 +895,7 @@
  */
 
 value_ptr
-value_coerce_array (arg1)
-     value_ptr arg1;
+value_coerce_array (value_ptr arg1)
 {
   register struct type *type = check_typedef (VALUE_TYPE (arg1));
 
@@ -913,8 +910,7 @@
    to it.  */
 
 value_ptr
-value_coerce_function (arg1)
-     value_ptr arg1;
+value_coerce_function (value_ptr arg1)
 {
   value_ptr retval;
 
@@ -930,8 +926,7 @@
 /* Return a pointer value for the object for which ARG1 is the contents.  */
 
 value_ptr
-value_addr (arg1)
-     value_ptr arg1;
+value_addr (value_ptr arg1)
 {
   value_ptr arg2;
 
@@ -969,8 +964,7 @@
 /* Given a value of a pointer type, apply the C unary * operator to it.  */
 
 value_ptr
-value_ind (arg1)
-     value_ptr arg1;
+value_ind (value_ptr arg1)
 {
   struct type *base_type;
   value_ptr arg2;
@@ -1021,9 +1015,7 @@
 /* Push one word (the size of object that a register holds).  */
 
 CORE_ADDR
-push_word (sp, word)
-     CORE_ADDR sp;
-     ULONGEST word;
+push_word (CORE_ADDR sp, ULONGEST word)
 {
   register int len = REGISTER_SIZE;
   char buffer[MAX_REGISTER_RAW_SIZE];
@@ -1048,10 +1040,7 @@
 /* Push LEN bytes with data at BUFFER.  */
 
 CORE_ADDR
-push_bytes (sp, buffer, len)
-     CORE_ADDR sp;
-     char *buffer;
-     int len;
+push_bytes (CORE_ADDR sp, char *buffer, int len)
 {
   if (INNER_THAN (1, 2))
     {
@@ -1077,9 +1066,7 @@
    it to be an argument to a function.  */
 
 static CORE_ADDR
-value_push (sp, arg)
-     register CORE_ADDR sp;
-     value_ptr arg;
+value_push (register CORE_ADDR sp, value_ptr arg)
 {
   register int len = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg));
   register int container_len = len;
@@ -1117,12 +1104,8 @@
 #endif
 
 CORE_ADDR
-default_push_arguments (nargs, args, sp, struct_return, struct_addr)
-     int nargs;
-     value_ptr *args;
-     CORE_ADDR sp;
-     int struct_return;
-     CORE_ADDR struct_addr;
+default_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+			int struct_return, CORE_ADDR struct_addr)
 {
   /* ASSERT ( !struct_return); */
   int i;
@@ -1167,10 +1150,7 @@
    IS_PROTOTYPED is non-zero if the function declaration is prototyped.  */
 
 static value_ptr
-value_arg_coerce (arg, param_type, is_prototyped)
-     value_ptr arg;
-     struct type *param_type;
-     int is_prototyped;
+value_arg_coerce (value_ptr arg, struct type *param_type, int is_prototyped)
 {
   register struct type *arg_type = check_typedef (VALUE_TYPE (arg));
   register struct type *type
@@ -1246,9 +1226,7 @@
    Calls error() if the function is not valid for calling.  */
 
 static CORE_ADDR
-find_function_addr (function, retval_type)
-     value_ptr function;
-     struct type **retval_type;
+find_function_addr (value_ptr function, struct type **retval_type)
 {
   register struct type *ftype = check_typedef (VALUE_TYPE (function));
   register enum type_code code = TYPE_CODE (ftype);
@@ -1271,12 +1249,7 @@
       if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
 	  || TYPE_CODE (ftype) == TYPE_CODE_METHOD)
 	{
-#ifdef CONVERT_FROM_FUNC_PTR_ADDR
-	  /* FIXME: This is a workaround for the unusual function
-	     pointer representation on the RS/6000, see comment
-	     in config/rs6000/tm-rs6000.h  */
 	  funaddr = CONVERT_FROM_FUNC_PTR_ADDR (funaddr);
-#endif
 	  value_type = TYPE_TARGET_TYPE (ftype);
 	}
       else
@@ -1322,10 +1295,7 @@
 static value_ptr hand_function_call (value_ptr function, int nargs,
 				     value_ptr * args);
 static value_ptr
-hand_function_call (function, nargs, args)
-     value_ptr function;
-     int nargs;
-     value_ptr *args;
+hand_function_call (value_ptr function, int nargs, value_ptr *args)
 {
   register CORE_ADDR sp;
   register int i;
@@ -1606,27 +1576,27 @@
 	}
     }
 
-/* elz: on HPPA no need for this extra alignment, maybe it is needed
-   on other architectures. This is because all the alignment is taken care
-   of in the above code (ifdef REG_STRUCT_HAS_ADDR) and in
-   hppa_push_arguments */
-#ifndef NO_EXTRA_ALIGNMENT_NEEDED
-
-  /* MVS 11/22/96: I think at least some of this stack_align code is
-     really broken.  Better to let PUSH_ARGUMENTS adjust the stack in
-     a target-defined manner.  */
-  if (STACK_ALIGN_P () && INNER_THAN (1, 2))
+  /* elz: on HPPA no need for this extra alignment, maybe it is needed
+     on other architectures. This is because all the alignment is
+     taken care of in the above code (ifdef REG_STRUCT_HAS_ADDR) and
+     in hppa_push_arguments */
+  if (EXTRA_STACK_ALIGNMENT_NEEDED)
     {
-      /* If stack grows down, we must leave a hole at the top. */
-      int len = 0;
+      /* MVS 11/22/96: I think at least some of this stack_align code
+	 is really broken.  Better to let PUSH_ARGUMENTS adjust the
+	 stack in a target-defined manner.  */
+      if (STACK_ALIGN_P () && INNER_THAN (1, 2))
+	{
+	  /* If stack grows down, we must leave a hole at the top. */
+	  int len = 0;
 
-      for (i = nargs - 1; i >= 0; i--)
-	len += TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i]));
-      if (CALL_DUMMY_STACK_ADJUST_P)
-	len += CALL_DUMMY_STACK_ADJUST;
-      sp -= STACK_ALIGN (len) - len;
+	  for (i = nargs - 1; i >= 0; i--)
+	    len += TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i]));
+	  if (CALL_DUMMY_STACK_ADJUST_P)
+	    len += CALL_DUMMY_STACK_ADJUST;
+	  sp -= STACK_ALIGN (len) - len;
+	}
     }
-#endif /* NO_EXTRA_ALIGNMENT_NEEDED */
 
   sp = PUSH_ARGUMENTS (nargs, args, sp, struct_return, struct_addr);
 
@@ -1812,10 +1782,7 @@
 }
 
 value_ptr
-call_function_by_hand (function, nargs, args)
-     value_ptr function;
-     int nargs;
-     value_ptr *args;
+call_function_by_hand (value_ptr function, int nargs, value_ptr *args)
 {
   if (CALL_DUMMY_P)
     {
@@ -1840,10 +1807,7 @@
    don't currently enforce any restriction on their types). */
 
 value_ptr
-value_array (lowbound, highbound, elemvec)
-     int lowbound;
-     int highbound;
-     value_ptr *elemvec;
+value_array (int lowbound, int highbound, value_ptr *elemvec)
 {
   int nelem;
   int idx;
@@ -1915,9 +1879,7 @@
    embedded null bytes. */
 
 value_ptr
-value_string (ptr, len)
-     char *ptr;
-     int len;
+value_string (char *ptr, int len)
 {
   value_ptr val;
   int lowbound = current_language->string_lower_bound;
@@ -1947,9 +1909,7 @@
 }
 
 value_ptr
-value_bitstring (ptr, len)
-     char *ptr;
-     int len;
+value_bitstring (char *ptr, int len)
 {
   value_ptr val;
   struct type *domain_type = create_range_type (NULL, builtin_type_int,
@@ -1977,10 +1937,7 @@
    requested operation is type secure, shouldn't we?  FIXME.  */
 
 static int
-typecmp (staticp, t1, t2)
-     int staticp;
-     struct type *t1[];
-     value_ptr t2[];
+typecmp (int staticp, struct type *t1[], value_ptr t2[])
 {
   int i;
 
@@ -2012,12 +1969,22 @@
 	  continue;
 	}
 
-      while (TYPE_CODE (tt1) == TYPE_CODE_PTR
-	     && (TYPE_CODE (tt2) == TYPE_CODE_ARRAY
-		 || TYPE_CODE (tt2) == TYPE_CODE_PTR))
+      /* djb - 20000715 - Until the new type structure is in the
+	 place, and we can attempt things like implicit conversions,
+	 we need to do this so you can take something like a map<const
+	 char *>, and properly access map["hello"], because the
+	 argument to [] will be a reference to a pointer to a char,
+	 and the argument will be a pointer to a char. */
+      while ( TYPE_CODE(tt1) == TYPE_CODE_REF ||
+	      TYPE_CODE (tt1) == TYPE_CODE_PTR)
 	{
-	  tt1 = check_typedef (TYPE_TARGET_TYPE (tt1));
-	  tt2 = check_typedef (TYPE_TARGET_TYPE (tt2));
+	  tt1 = check_typedef( TYPE_TARGET_TYPE(tt1) );
+	}
+      while ( TYPE_CODE(tt2) == TYPE_CODE_ARRAY ||
+	      TYPE_CODE(tt2) == TYPE_CODE_PTR ||
+	      TYPE_CODE(tt2) == TYPE_CODE_REF)
+	{
+	  tt2 = check_typedef( TYPE_TARGET_TYPE(tt2) );
 	}
       if (TYPE_CODE (tt1) == TYPE_CODE (tt2))
 	continue;
@@ -2043,12 +2010,8 @@
    look for a baseclass named NAME.  */
 
 static value_ptr
-search_struct_field (name, arg1, offset, type, looking_for_baseclass)
-     char *name;
-     register value_ptr arg1;
-     int offset;
-     register struct type *type;
-     int looking_for_baseclass;
+search_struct_field (char *name, register value_ptr arg1, int offset,
+		     register struct type *type, int looking_for_baseclass)
 {
   int i;
   int nbases = TYPE_N_BASECLASSES (type);
@@ -2200,13 +2163,8 @@
  * conventions.  */
 
 void
-find_rt_vbase_offset (type, basetype, valaddr, offset, boffset_p, skip_p)
-     struct type *type;
-     struct type *basetype;
-     char *valaddr;
-     int offset;
-     int *boffset_p;
-     int *skip_p;
+find_rt_vbase_offset (struct type *type, struct type *basetype, char *valaddr,
+		      int offset, int *boffset_p, int *skip_p)
 {
   int boffset;			/* offset of virtual base */
   int index;			/* displacement to use in virtual table */
@@ -2281,11 +2239,9 @@
    else return NULL. */
 
 static value_ptr
-search_struct_method (name, arg1p, args, offset, static_memfuncp, type)
-     char *name;
-     register value_ptr *arg1p, *args;
-     int offset, *static_memfuncp;
-     register struct type *type;
+search_struct_method (char *name, register value_ptr *arg1p,
+		      register value_ptr *args, int offset,
+		      int *static_memfuncp, register struct type *type)
 {
   int i;
   value_ptr v;
@@ -2327,7 +2283,7 @@
 		    *static_memfuncp = 1;
 		  v = value_fn_field (arg1p, f, j, type, offset);
 		  if (v != NULL)
-		    return v;
+		    return v;       
 		}
 	      j--;
 	    }
@@ -2419,11 +2375,8 @@
    ERR is an error message to be printed in case the field is not found.  */
 
 value_ptr
-value_struct_elt (argp, args, name, static_memfuncp, err)
-     register value_ptr *argp, *args;
-     char *name;
-     int *static_memfuncp;
-     char *err;
+value_struct_elt (register value_ptr *argp, register value_ptr *args,
+		  char *name, int *static_memfuncp, char *err)
 {
   register struct type *t;
   value_ptr v;
@@ -2509,10 +2462,10 @@
     }
   else
     v = search_struct_method (name, argp, args, 0, static_memfuncp, t);
-
+  
   if (v == (value_ptr) - 1)
     {
-      error ("Argument list of %s mismatch with component in the structure.", name);
+      error ("One of the arguments you tried to pass to %s could not be converted to what the function wants.", name);
     }
   else if (v == 0)
     {
@@ -2541,15 +2494,9 @@
  * BOFFSET is the offset of the base subobject where the method is found */
 
 static struct fn_field *
-find_method_list (argp, method, offset, static_memfuncp, type, num_fns, basetype, boffset)
-     value_ptr *argp;
-     char *method;
-     int offset;
-     int *static_memfuncp;
-     struct type *type;
-     int *num_fns;
-     struct type **basetype;
-     int *boffset;
+find_method_list (value_ptr *argp, char *method, int offset,
+		  int *static_memfuncp, struct type *type, int *num_fns,
+		  struct type **basetype, int *boffset)
 {
   int i;
   struct fn_field *f;
@@ -2624,14 +2571,9 @@
  * BOFFSET is the offset of the base subobject which defines the method */
 
 struct fn_field *
-value_find_oload_method_list (argp, method, offset, static_memfuncp, num_fns, basetype, boffset)
-     value_ptr *argp;
-     char *method;
-     int offset;
-     int *static_memfuncp;
-     int *num_fns;
-     struct type **basetype;
-     int *boffset;
+value_find_oload_method_list (value_ptr *argp, char *method, int offset,
+			      int *static_memfuncp, int *num_fns,
+			      struct type **basetype, int *boffset)
 {
   struct type *t;
 
@@ -2691,17 +2633,9 @@
  */
 
 int
-find_overload_match (arg_types, nargs, name, method, lax, obj, fsym, valp, symp, staticp)
-     struct type **arg_types;
-     int nargs;
-     char *name;
-     int method;
-     int lax;
-     value_ptr obj;
-     struct symbol *fsym;
-     value_ptr *valp;
-     struct symbol **symp;
-     int *staticp;
+find_overload_match (struct type **arg_types, int nargs, char *name, int method,
+		     int lax, value_ptr obj, struct symbol *fsym,
+		     value_ptr *valp, struct symbol **symp, int *staticp)
 {
   int nparms;
   struct type **parm_types;
@@ -2854,17 +2788,17 @@
 	  default:
 	    break;
 	  }
-      free (parm_types);
-if (overload_debug)
-{
-      if (method)
-	fprintf_filtered (gdb_stderr,"Overloaded method instance %s, # of parms %d\n", fns_ptr[ix].physname, nparms);
-      else
-	fprintf_filtered (gdb_stderr,"Overloaded function instance %s # of parms %d\n", SYMBOL_DEMANGLED_NAME (oload_syms[ix]), nparms);
-      for (jj = 0; jj < nargs; jj++)
-	fprintf_filtered (gdb_stderr,"...Badness @ %d : %d\n", jj, bv->rank[jj]);
-      fprintf_filtered (gdb_stderr,"Overload resolution champion is %d, ambiguous? %d\n", oload_champ, oload_ambiguous);
-}
+      xfree (parm_types);
+      if (overload_debug)
+	{
+	  if (method)
+	    fprintf_filtered (gdb_stderr,"Overloaded method instance %s, # of parms %d\n", fns_ptr[ix].physname, nparms);
+	  else
+	    fprintf_filtered (gdb_stderr,"Overloaded function instance %s # of parms %d\n", SYMBOL_DEMANGLED_NAME (oload_syms[ix]), nparms);
+	  for (jj = 0; jj < nargs; jj++)
+	    fprintf_filtered (gdb_stderr,"...Badness @ %d : %d\n", jj, bv->rank[jj]);
+	  fprintf_filtered (gdb_stderr,"Overload resolution champion is %d, ambiguous? %d\n", oload_champ, oload_ambiguous);
+	}
     }				/* end loop over all candidates */
   /* NOTE: dan/2000-03-10: Seems to be a better idea to just pick one
      if they have the exact same goodness. This is because there is no
@@ -2887,15 +2821,11 @@
   /* Check how bad the best match is */
   for (ix = 1; ix <= nargs; ix++)
     {
-      switch (oload_champ_bv->rank[ix])
-	{
-	case 10:
-	  oload_non_standard = 1;	/* non-standard type conversions needed */
-	  break;
-	case 100:
-	  oload_incompatible = 1;	/* truly mismatched types */
-	  break;
-	}
+      if (oload_champ_bv->rank[ix] >= 100)
+	oload_incompatible = 1;	/* truly mismatched types */
+
+      else if (oload_champ_bv->rank[ix] >= 10)
+	oload_non_standard = 1;	/* non-standard type conversions needed */
     }
   if (oload_incompatible)
     {
@@ -2930,7 +2860,7 @@
   else
     {
       *symp = oload_syms[oload_champ];
-      free (func_name);
+      xfree (func_name);
     }
 
   return oload_incompatible ? 100 : (oload_non_standard ? 10 : 0);
@@ -2940,9 +2870,7 @@
    of type TYPE.  If TYPE does not have a destructor, or
    if NAME is inappropriate for TYPE, an error is signaled.  */
 int
-destructor_name_p (name, type)
-     const char *name;
-     const struct type *type;
+destructor_name_p (const char *name, const struct type *type)
 {
   /* destructors are a special case.  */
 
@@ -2970,9 +2898,7 @@
    target structure/union is defined, otherwise, return 0. */
 
 static int
-check_field_in (type, name)
-     register struct type *type;
-     const char *name;
+check_field_in (register struct type *type, const char *name)
 {
   register int i;
 
@@ -3013,9 +2939,7 @@
    target structure/union is defined, otherwise, return 0.  */
 
 int
-check_field (arg1, name)
-     register value_ptr arg1;
-     const char *name;
+check_field (register value_ptr arg1, const char *name)
 {
   register struct type *t;
 
@@ -3051,10 +2975,9 @@
    to resolve user expressions of the form "DOMAIN::NAME".  */
 
 value_ptr
-value_struct_elt_for_reference (domain, offset, curtype, name, intype)
-     struct type *domain, *curtype, *intype;
-     int offset;
-     char *name;
+value_struct_elt_for_reference (struct type *domain, int offset,
+				struct type *curtype, char *name,
+				struct type *intype)
 {
   register struct type *t = curtype;
   register int i;
@@ -3201,11 +3124,7 @@
  */
 
 struct type *
-value_rtti_type (v, full, top, using_enc)
-     value_ptr v;
-     int *full;
-     int *top;
-     int *using_enc;
+value_rtti_type (value_ptr v, int *full, int *top, int *using_enc)
 {
   struct type *known_type;
   struct type *rtti_type;
@@ -3311,7 +3230,7 @@
     /*
       Right now this is G++ RTTI. Plan on this changing in the
       future as i get around to setting the vtables properly for G++
-      compiled stuff. Also, i'll be using the type info functions, 
+      compiled stuff. Also, i'll be using the type info functions,
       which are always right. Deal with it until then.
     */
     {
@@ -3340,7 +3259,7 @@
 	    *using_enc=1;
 	}
       /*
-	We can't use value_ind here, because it would want to use RTTI, and 
+	We can't use value_ind here, because it would want to use RTTI, and
 	we'd waste a bunch of time figuring out we already know the type.
         Besides, we don't care about the type, just the actual pointer
       */
@@ -3415,11 +3334,7 @@
    and refer to the values computed for the object pointed to. */
 
 struct type *
-value_rtti_target_type (v, full, top, using_enc)
-     value_ptr v;
-     int *full;
-     int *top;
-     int *using_enc;
+value_rtti_target_type (value_ptr v, int *full, int *top, int *using_enc)
 {
   value_ptr target;
 
@@ -3439,13 +3354,8 @@
    (Pass RTYPE == NULL if they're not available */
 
 value_ptr
-value_full_object (argp, rtype, xfull, xtop, xusing_enc)
-     value_ptr argp;
-     struct type *rtype;
-     int xfull;
-     int xtop;
-     int xusing_enc;
-
+value_full_object (value_ptr argp, struct type *rtype, int xfull, int xtop,
+		   int xusing_enc)
 {
   struct type *real_type;
   int full = 0;
@@ -3503,8 +3413,7 @@
    inappropriate context.  */
 
 value_ptr
-value_of_this (complain)
-     int complain;
+value_of_this (int complain)
 {
   struct symbol *func, *sym;
   struct block *b;
@@ -3561,9 +3470,7 @@
    the original ARRAY.  */
 
 value_ptr
-value_slice (array, lowbound, length)
-     value_ptr array;
-     int lowbound, length;
+value_slice (value_ptr array, int lowbound, int length)
 {
   struct type *slice_range_type, *slice_type, *range_type;
   LONGEST lowerbound, upperbound, offset;
@@ -3642,8 +3549,7 @@
    value as a fixed-length array. */
 
 value_ptr
-varying_to_slice (varray)
-     value_ptr varray;
+varying_to_slice (value_ptr varray)
 {
   struct type *vtype = check_typedef (VALUE_TYPE (varray));
   LONGEST length = unpack_long (TYPE_FIELD_TYPE (vtype, 0),
@@ -3659,10 +3565,7 @@
    doubles. FIXME: fmb */
 
 value_ptr
-value_literal_complex (arg1, arg2, type)
-     value_ptr arg1;
-     value_ptr arg2;
-     struct type *type;
+value_literal_complex (value_ptr arg1, value_ptr arg2, struct type *type)
 {
   register value_ptr val;
   struct type *real_type = TYPE_TARGET_TYPE (type);
@@ -3681,9 +3584,7 @@
 /* Cast a value into the appropriate complex data type. */
 
 static value_ptr
-cast_into_complex (type, val)
-     struct type *type;
-     register value_ptr val;
+cast_into_complex (struct type *type, register value_ptr val)
 {
   struct type *real_type = TYPE_TARGET_TYPE (type);
   if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_COMPLEX)
@@ -3708,7 +3609,7 @@
 }
 
 void
-_initialize_valops ()
+_initialize_valops (void)
 {
 #if 0
   add_show_from_set
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 7e6308c..84103c6 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -124,17 +124,9 @@
 
 
 int
-val_print (type, valaddr, embedded_offset, address,
-	   stream, format, deref_ref, recurse, pretty)
-     struct type *type;
-     char *valaddr;
-     int embedded_offset;
-     CORE_ADDR address;
-     struct ui_file *stream;
-     int format;
-     int deref_ref;
-     int recurse;
-     enum val_prettyprint pretty;
+val_print (struct type *type, char *valaddr, int embedded_offset,
+	   CORE_ADDR address, struct ui_file *stream, int format, int deref_ref,
+	   int recurse, enum val_prettyprint pretty)
 {
   struct type *real_type = check_typedef (type);
   if (pretty == Val_pretty_default)
@@ -165,11 +157,8 @@
    the number of string bytes printed.  */
 
 int
-value_print (val, stream, format, pretty)
-     value_ptr val;
-     struct ui_file *stream;
-     int format;
-     enum val_prettyprint pretty;
+value_print (value_ptr val, struct ui_file *stream, int format,
+	     enum val_prettyprint pretty)
 {
   if (val == 0)
     {
@@ -189,10 +178,8 @@
    value.  STREAM is where to print the value.  */
 
 void
-val_print_type_code_int (type, valaddr, stream)
-     struct type *type;
-     char *valaddr;
-     struct ui_file *stream;
+val_print_type_code_int (struct type *type, char *valaddr,
+			 struct ui_file *stream)
 {
   if (TYPE_LENGTH (type) > sizeof (LONGEST))
     {
@@ -243,11 +230,8 @@
 static void print_decimal (struct ui_file * stream, char *sign,
 			   int use_local, ULONGEST val_ulong);
 static void
-print_decimal (stream, sign, use_local, val_ulong)
-     struct ui_file *stream;
-     char *sign;
-     int use_local;
-     ULONGEST val_ulong;
+print_decimal (struct ui_file *stream, char *sign, int use_local,
+	       ULONGEST val_ulong)
 {
   unsigned long temp[3];
   int i = 0;
@@ -280,11 +264,8 @@
 #endif
 
 void
-print_longest (stream, format, use_local, val_long)
-     struct ui_file *stream;
-     int format;
-     int use_local;
-     LONGEST val_long;
+print_longest (struct ui_file *stream, int format, int use_local,
+	       LONGEST val_long)
 {
 #if defined (CC_HAS_LONG_LONG) && !defined (PRINTF_HAS_LONG_LONG)
   if (sizeof (long) < sizeof (LONGEST))
@@ -433,13 +414,10 @@
 
 #if 0
 void
-strcat_longest (format, use_local, val_long, buf, buflen)
-     int format;
-     int use_local;
-     LONGEST val_long;
-     char *buf;
-     int buflen;		/* ignored, for now */
+strcat_longest (int format, int use_local, LONGEST val_long, char *buf,
+		int buflen)
 {
+/* FIXME: Use buflen to avoid buffer overflow.  */
 #if defined (CC_HAS_LONG_LONG) && !defined (PRINTF_HAS_LONG_LONG)
   long vtop, vbot;
 
@@ -544,8 +522,7 @@
    where the value must not be larger than can fit in an int.  */
 
 int
-longest_to_int (arg)
-     LONGEST arg;
+longest_to_int (LONGEST arg)
 {
   /* Let the compiler do the work */
   int rtnval = (int) arg;
@@ -566,10 +543,7 @@
    on STREAM.  */
 
 void
-print_floating (valaddr, type, stream)
-     char *valaddr;
-     struct type *type;
-     struct ui_file *stream;
+print_floating (char *valaddr, struct type *type, struct ui_file *stream)
 {
   DOUBLEST doub;
   int inv;
@@ -673,10 +647,8 @@
 }
 
 void
-print_binary_chars (stream, valaddr, len)
-     struct ui_file *stream;
-     unsigned char *valaddr;
-     unsigned len;
+print_binary_chars (struct ui_file *stream, unsigned char *valaddr,
+		    unsigned len)
 {
 
 #define BITS_IN_BYTES 8
@@ -737,10 +709,7 @@
  * Print it in octal on stream or format it in buf.
  */
 void
-print_octal_chars (stream, valaddr, len)
-     struct ui_file *stream;
-     unsigned char *valaddr;
-     unsigned len;
+print_octal_chars (struct ui_file *stream, unsigned char *valaddr, unsigned len)
 {
   unsigned char *p;
   unsigned char octa1, octa2, octa3, carry;
@@ -888,10 +857,8 @@
  * Print it in decimal on stream or format it in buf.
  */
 void
-print_decimal_chars (stream, valaddr, len)
-     struct ui_file *stream;
-     unsigned char *valaddr;
-     unsigned len;
+print_decimal_chars (struct ui_file *stream, unsigned char *valaddr,
+		     unsigned len)
 {
 #define TEN             10
 #define TWO_TO_FOURTH   16
@@ -1023,7 +990,7 @@
     {
       fprintf_filtered (stream, "%1d", digits[i]);
     }
-  free (digits);
+  xfree (digits);
 
   fprintf_filtered (stream, local_decimal_format_suffix ());
 }
@@ -1031,10 +998,7 @@
 /* VALADDR points to an integer of LEN bytes.  Print it in hex on stream.  */
 
 static void
-print_hex_chars (stream, valaddr, len)
-     struct ui_file *stream;
-     unsigned char *valaddr;
-     unsigned len;
+print_hex_chars (struct ui_file *stream, unsigned char *valaddr, unsigned len)
 {
   unsigned char *p;
 
@@ -1072,17 +1036,10 @@
  */
 
 void
-val_print_array_elements (type, valaddr, address, stream, format, deref_ref,
-			  recurse, pretty, i)
-     struct type *type;
-     char *valaddr;
-     CORE_ADDR address;
-     struct ui_file *stream;
-     int format;
-     int deref_ref;
-     int recurse;
-     enum val_prettyprint pretty;
-     unsigned int i;
+val_print_array_elements (struct type *type, char *valaddr, CORE_ADDR address,
+			  struct ui_file *stream, int format, int deref_ref,
+			  int recurse, enum val_prettyprint pretty,
+			  unsigned int i)
 {
   unsigned int things_printed = 0;
   unsigned len;
@@ -1201,11 +1158,7 @@
 /* FIXME: Use target_read_string.  */
 
 int
-val_print_string (addr, len, width, stream)
-     CORE_ADDR addr;
-     int len;
-     int width;
-     struct ui_file *stream;
+val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream)
 {
   int force_ellipsis = 0;	/* Force ellipsis to be printed if nonzero. */
   int errcode;			/* Errno returned from bad reads. */
@@ -1249,7 +1202,7 @@
     {
       buffer = (char *) xmalloc (len * width);
       bufptr = buffer;
-      old_chain = make_cleanup (free, buffer);
+      old_chain = make_cleanup (xfree, buffer);
 
       nfetch = partial_memory_read (addr, bufptr, len * width, &errcode)
 	/ width;
@@ -1272,7 +1225,7 @@
 	      buffer = (char *) xrealloc (buffer, (nfetch + bufsize) * width);
 	    }
 
-	  old_chain = make_cleanup (free, buffer);
+	  old_chain = make_cleanup (xfree, buffer);
 	  bufptr = buffer + bufsize * width;
 	  bufsize += nfetch;
 
@@ -1383,19 +1336,14 @@
 
 /* ARGSUSED */
 static void
-set_input_radix (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+set_input_radix (char *args, int from_tty, struct cmd_list_element *c)
 {
   set_input_radix_1 (from_tty, *(unsigned *) c->var);
 }
 
 /* ARGSUSED */
 static void
-set_input_radix_1 (from_tty, radix)
-     int from_tty;
-     unsigned radix;
+set_input_radix_1 (int from_tty, unsigned radix)
 {
   /* We don't currently disallow any input radix except 0 or 1, which don't
      make any mathematical sense.  In theory, we can deal with any input
@@ -1419,18 +1367,13 @@
 
 /* ARGSUSED */
 static void
-set_output_radix (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+set_output_radix (char *args, int from_tty, struct cmd_list_element *c)
 {
   set_output_radix_1 (from_tty, *(unsigned *) c->var);
 }
 
 static void
-set_output_radix_1 (from_tty, radix)
-     int from_tty;
-     unsigned radix;
+set_output_radix_1 (int from_tty, unsigned radix)
 {
   /* Validate the radix and disallow ones that we aren't prepared to
      handle correctly, leaving the radix unchanged. */
@@ -1466,13 +1409,11 @@
    the 'set input-radix' command. */
 
 static void
-set_radix (arg, from_tty)
-     char *arg;
-     int from_tty;
+set_radix (char *arg, int from_tty)
 {
   unsigned radix;
 
-  radix = (arg == NULL) ? 10 : parse_and_eval_address (arg);
+  radix = (arg == NULL) ? 10 : parse_and_eval_long (arg);
   set_output_radix_1 (0, radix);
   set_input_radix_1 (0, radix);
   if (from_tty)
@@ -1486,9 +1427,7 @@
 
 /*ARGSUSED */
 static void
-show_radix (arg, from_tty)
-     char *arg;
-     int from_tty;
+show_radix (char *arg, int from_tty)
 {
   if (from_tty)
     {
@@ -1510,9 +1449,7 @@
 
 /*ARGSUSED */
 static void
-set_print (arg, from_tty)
-     char *arg;
-     int from_tty;
+set_print (char *arg, int from_tty)
 {
   printf_unfiltered (
      "\"set print\" must be followed by the name of a print subcommand.\n");
@@ -1521,15 +1458,13 @@
 
 /*ARGSUSED */
 static void
-show_print (args, from_tty)
-     char *args;
-     int from_tty;
+show_print (char *args, int from_tty)
 {
   cmd_show_list (showprintlist, from_tty, "");
 }
 
 void
-_initialize_valprint ()
+_initialize_valprint (void)
 {
   struct cmd_list_element *c;
 
diff --git a/gdb/value.h b/gdb/value.h
index 7ec96c3..5b9188f 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -97,7 +97,18 @@
     /* If zero, contents of this value are in the contents field.
        If nonzero, contents are in inferior memory at address
        in the location.address field plus the offset field
-       (and the lval field should be lval_memory).  */
+       (and the lval field should be lval_memory).
+
+       WARNING: This field is used by the code which handles
+       watchpoints (see breakpoint.c) to decide whether a particular
+       value can be watched by hardware watchpoints.  If the lazy flag
+       is set for some member of a value chain, it is assumed that
+       this member of the chain doesn't need to be watched as part of
+       watching the value itself.  This is how GDB avoids watching the
+       entire struct or array when the user wants to watch a single
+       struct member or array element.  If you ever change the way
+       lazy flag is set and reset, be sure to consider this use as
+       well!  */
     char lazy;
     /* If nonzero, this is the value of a variable which does not
        actually exist in the program.  */
@@ -399,6 +410,8 @@
 
 extern CORE_ADDR parse_and_eval_address_1 (char **expptr);
 
+extern LONGEST parse_and_eval_long (char *exp);
+
 extern value_ptr access_value_history (int num);
 
 extern value_ptr value_of_internalvar (struct internalvar *var);
@@ -461,9 +474,15 @@
 
 extern void write_register_gen (int regno, char *myaddr);
 
-extern CORE_ADDR read_register (int regno);
+/* Rename to read_unsigned_register()? */
+extern ULONGEST read_register (int regno);
 
-extern CORE_ADDR read_register_pid (int regno, int pid);
+extern LONGEST read_signed_register (int regno);
+
+/* Rename to read_unsigned_register_pid()? */
+extern ULONGEST read_register_pid (int regno, int pid);
+
+extern LONGEST read_signed_register_pid (int regno, int pid);
 
 extern void write_register (int regno, LONGEST val);
 
@@ -471,6 +490,10 @@
 
 extern void supply_register (int regno, char *val);
 
+extern int register_cached (int regno);
+
+extern void register_changed (int regnum);
+
 extern void get_saved_register (char *raw_buffer, int *optimized,
 				CORE_ADDR * addrp,
 				struct frame_info *frame,
@@ -515,7 +538,7 @@
 
 extern int check_field (value_ptr, const char *);
 
-extern void c_typedef_print (struct type * type, struct symbol * news,
+extern void typedef_print (struct type * type, struct symbol * news,
 			     struct ui_file * stream);
 
 extern char *internalvar_name (struct internalvar *var);
diff --git a/gdb/values.c b/gdb/values.c
index b77f405..f17373d 100644
--- a/gdb/values.c
+++ b/gdb/values.c
@@ -76,8 +76,7 @@
 /* Allocate a  value  that has the correct length for type TYPE.  */
 
 value_ptr
-allocate_value (type)
-     struct type *type;
+allocate_value (struct type *type)
 {
   register value_ptr val;
   struct type *atype = check_typedef (type);
@@ -107,9 +106,7 @@
    for COUNT repetitions type TYPE.  */
 
 value_ptr
-allocate_repeat_value (type, count)
-     struct type *type;
-     int count;
+allocate_repeat_value (struct type *type, int count)
 {
   int low_bound = current_language->string_lower_bound;		/* ??? */
   /* FIXME-type-allocation: need a way to free this type when we are
@@ -127,7 +124,7 @@
    mark is obtained (except for those released) are subject to being freed
    if a subsequent value_free_to_mark is passed the mark.  */
 value_ptr
-value_mark ()
+value_mark (void)
 {
   return all_values;
 }
@@ -135,8 +132,7 @@
 /* Free all values allocated since MARK was obtained by value_mark
    (except for those released).  */
 void
-value_free_to_mark (mark)
-     value_ptr mark;
+value_free_to_mark (value_ptr mark)
 {
   value_ptr val, next;
 
@@ -152,7 +148,7 @@
    Called after each command, successful or not.  */
 
 void
-free_all_values ()
+free_all_values (void)
 {
   register value_ptr val, next;
 
@@ -169,8 +165,7 @@
    so it will not be freed automatically.  */
 
 void
-release_value (val)
-     register value_ptr val;
+release_value (register value_ptr val)
 {
   register value_ptr v;
 
@@ -192,8 +187,7 @@
 
 /* Release all values up to mark  */
 value_ptr
-value_release_to_mark (mark)
-     value_ptr mark;
+value_release_to_mark (value_ptr mark)
 {
   value_ptr val, next;
 
@@ -213,8 +207,7 @@
    but it's a different block of storage.  */
 
 value_ptr
-value_copy (arg)
-     value_ptr arg;
+value_copy (value_ptr arg)
 {
   register struct type *encl_type = VALUE_ENCLOSING_TYPE (arg);
   register value_ptr val = allocate_value (encl_type);
@@ -249,8 +242,7 @@
    value history index of this new item.  */
 
 int
-record_latest_value (val)
-     value_ptr val;
+record_latest_value (value_ptr val)
 {
   int i;
 
@@ -291,8 +283,7 @@
 /* Return a copy of the value in the history with sequence number NUM.  */
 
 value_ptr
-access_value_history (num)
-     int num;
+access_value_history (int num)
 {
   register struct value_history_chunk *chunk;
   register int i;
@@ -330,7 +321,7 @@
    because the type pointers become invalid.  */
 
 void
-clear_value_history ()
+clear_value_history (void)
 {
   register struct value_history_chunk *next;
   register int i;
@@ -340,18 +331,16 @@
     {
       for (i = 0; i < VALUE_HISTORY_CHUNK; i++)
 	if ((val = value_history_chain->values[i]) != NULL)
-	  free ((PTR) val);
+	  xfree (val);
       next = value_history_chain->next;
-      free ((PTR) value_history_chain);
+      xfree (value_history_chain);
       value_history_chain = next;
     }
   value_history_count = 0;
 }
 
 static void
-show_values (num_exp, from_tty)
-     char *num_exp;
-     int from_tty;
+show_values (char *num_exp, int from_tty)
 {
   register int i;
   register value_ptr val;
@@ -362,7 +351,7 @@
       /* "info history +" should print from the stored position.
          "info history <exp>" should print around value number <exp>.  */
       if (num_exp[0] != '+' || num_exp[1] != '\0')
-	num = parse_and_eval_address (num_exp) - 5;
+	num = parse_and_eval_long (num_exp) - 5;
     }
   else
     {
@@ -408,8 +397,7 @@
    one is created, with a void value.  */
 
 struct internalvar *
-lookup_internalvar (name)
-     char *name;
+lookup_internalvar (char *name)
 {
   register struct internalvar *var;
 
@@ -427,8 +415,7 @@
 }
 
 value_ptr
-value_of_internalvar (var)
-     struct internalvar *var;
+value_of_internalvar (struct internalvar *var)
 {
   register value_ptr val;
 
@@ -446,10 +433,8 @@
 }
 
 void
-set_internalvar_component (var, offset, bitpos, bitsize, newval)
-     struct internalvar *var;
-     int offset, bitpos, bitsize;
-     value_ptr newval;
+set_internalvar_component (struct internalvar *var, int offset, int bitpos,
+			   int bitsize, value_ptr newval)
 {
   register char *addr = VALUE_CONTENTS (var->value) + offset;
 
@@ -466,9 +451,7 @@
 }
 
 void
-set_internalvar (var, val)
-     struct internalvar *var;
-     value_ptr val;
+set_internalvar (struct internalvar *var, value_ptr val)
 {
   value_ptr newval;
 
@@ -492,15 +475,14 @@
      something in the value chain (i.e., before release_value is
      called), because after the error free_all_values will get called before
      long.  */
-  free ((PTR) var->value);
+  xfree (var->value);
   var->value = newval;
   release_value (newval);
   /* End code which must not call error().  */
 }
 
 char *
-internalvar_name (var)
-     struct internalvar *var;
+internalvar_name (struct internalvar *var)
 {
   return var->name;
 }
@@ -509,7 +491,7 @@
    because that makes the values invalid.  */
 
 void
-clear_internalvars ()
+clear_internalvars (void)
 {
   register struct internalvar *var;
 
@@ -517,16 +499,14 @@
     {
       var = internalvars;
       internalvars = var->next;
-      free ((PTR) var->name);
-      free ((PTR) var->value);
-      free ((PTR) var);
+      xfree (var->name);
+      xfree (var->value);
+      xfree (var);
     }
 }
 
 static void
-show_convenience (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+show_convenience (char *ignore, int from_tty)
 {
   register struct internalvar *var;
   int varseen = 0;
@@ -557,8 +537,7 @@
    Does not deallocate the value.  */
 
 LONGEST
-value_as_long (val)
-     register value_ptr val;
+value_as_long (register value_ptr val)
 {
   /* This coerces arrays and functions, which is necessary (e.g.
      in disassemble_command).  It also dereferences references, which
@@ -568,8 +547,7 @@
 }
 
 DOUBLEST
-value_as_double (val)
-     register value_ptr val;
+value_as_double (register value_ptr val)
 {
   DOUBLEST foo;
   int inv;
@@ -583,8 +561,7 @@
    Note that val's type may not actually be a pointer; value_as_long
    handles all the cases.  */
 CORE_ADDR
-value_as_pointer (val)
-     value_ptr val;
+value_as_pointer (value_ptr val)
 {
   /* Assume a CORE_ADDR can fit in a LONGEST (for now).  Not sure
      whether we want this to be true eventually.  */
@@ -594,7 +571,36 @@
      for pointers to char, in which the low bits *are* significant.  */
   return ADDR_BITS_REMOVE (value_as_long (val));
 #else
-  return value_as_long (val);
+  COERCE_ARRAY (val);
+  /* In converting VAL to an address (CORE_ADDR), any small integers
+     are first cast to a generic pointer.  The function unpack_long
+     will then correctly convert that pointer into a canonical address
+     (using POINTER_TO_ADDRESS).
+
+     Without the cast, the MIPS gets: 0xa0000000 -> (unsigned int)
+     0xa0000000 -> (LONGEST) 0x00000000a0000000
+
+     With the cast, the MIPS gets: 0xa0000000 -> (unsigned int)
+     0xa0000000 -> (void*) 0xa0000000 -> (LONGEST) 0xffffffffa0000000.
+
+     If the user specifies an integer that is larger than the target
+     pointer type, it is assumed that it was intentional and the value
+     is converted directly into an ADDRESS.  This ensures that no
+     information is discarded.
+
+     NOTE: The cast operation may eventualy be converted into a TARGET
+     method (see POINTER_TO_ADDRESS() and ADDRESS_TO_POINTER()) so
+     that the TARGET ISA/ABI can apply an arbitrary conversion.
+
+     NOTE: In pure harvard architectures function and data pointers
+     can be different and may require different integer to pointer
+     conversions. */
+  if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_INT
+      && TYPE_LENGTH (VALUE_TYPE (val)) <= TYPE_LENGTH (builtin_type_ptr))
+    {
+      val = value_cast (builtin_type_ptr, val);
+    }
+  return unpack_long (VALUE_TYPE (val), VALUE_CONTENTS (val));
 #endif
 }
 
@@ -613,9 +619,7 @@
    to an INT (or some size).  After all, it is only an offset.  */
 
 LONGEST
-unpack_long (type, valaddr)
-     struct type *type;
-     char *valaddr;
+unpack_long (struct type *type, char *valaddr)
 {
   register enum type_code code = TYPE_CODE (type);
   register int len = TYPE_LENGTH (type);
@@ -667,10 +671,7 @@
    format, result is in host format.  */
 
 DOUBLEST
-unpack_double (type, valaddr, invp)
-     struct type *type;
-     char *valaddr;
-     int *invp;
+unpack_double (struct type *type, char *valaddr, int *invp)
 {
   enum type_code code;
   int len;
@@ -723,9 +724,7 @@
    to an INT (or some size).  After all, it is only an offset.  */
 
 CORE_ADDR
-unpack_pointer (type, valaddr)
-     struct type *type;
-     char *valaddr;
+unpack_pointer (struct type *type, char *valaddr)
 {
   /* Assume a CORE_ADDR can fit in a LONGEST (for now).  Not sure
      whether we want this to be true eventually.  */
@@ -736,9 +735,7 @@
 /* Get the value of the FIELDN'th field (which must be static) of TYPE. */
 
 value_ptr
-value_static_field (type, fieldno)
-     struct type *type;
-     int fieldno;
+value_static_field (struct type *type, int fieldno)
 {
   CORE_ADDR addr;
   asection *sect;
@@ -780,11 +777,8 @@
    FIELDNO says which field. */
 
 value_ptr
-value_primitive_field (arg1, offset, fieldno, arg_type)
-     register value_ptr arg1;
-     int offset;
-     register int fieldno;
-     register struct type *arg_type;
+value_primitive_field (register value_ptr arg1, int offset,
+		       register int fieldno, register struct type *arg_type)
 {
   register value_ptr v;
   register struct type *type;
@@ -841,6 +835,7 @@
   if (VALUE_LVAL (arg1) == lval_internalvar)
     VALUE_LVAL (v) = lval_internalvar_component;
   VALUE_ADDRESS (v) = VALUE_ADDRESS (arg1);
+  VALUE_REGNO (v) = VALUE_REGNO (arg1);
 /*  VALUE_OFFSET (v) = VALUE_OFFSET (arg1) + offset
    + TYPE_FIELD_BITPOS (arg_type, fieldno) / 8; */
   return v;
@@ -851,9 +846,7 @@
    FIELDNO says which field. */
 
 value_ptr
-value_field (arg1, fieldno)
-     register value_ptr arg1;
-     register int fieldno;
+value_field (register value_ptr arg1, register int fieldno)
 {
   return value_primitive_field (arg1, 0, fieldno, VALUE_TYPE (arg1));
 }
@@ -863,12 +856,8 @@
    J is an index into F which provides the desired method. */
 
 value_ptr
-value_fn_field (arg1p, f, j, type, offset)
-     value_ptr *arg1p;
-     struct fn_field *f;
-     int j;
-     struct type *type;
-     int offset;
+value_fn_field (value_ptr *arg1p, struct fn_field *f, int j, struct type *type,
+		int offset)
 {
   register value_ptr v;
   register struct type *ftype = TYPE_FN_FIELD_TYPE (f, j);
@@ -910,12 +899,8 @@
 
    TYPE is the type in which F is located.  */
 value_ptr
-value_virtual_fn_field (arg1p, f, j, type, offset)
-     value_ptr *arg1p;
-     struct fn_field *f;
-     int j;
-     struct type *type;
-     int offset;
+value_virtual_fn_field (value_ptr *arg1p, struct fn_field *f, int j,
+			struct type *type, int offset)
 {
   value_ptr arg1 = *arg1p;
   struct type *type1 = check_typedef (VALUE_TYPE (arg1));
@@ -1111,9 +1096,7 @@
    Consider it gone for 5.1. */
 
 static value_ptr
-value_headof (in_arg, btype, dtype)
-     value_ptr in_arg;
-     struct type *btype, *dtype;
+value_headof (value_ptr in_arg, struct type *btype, struct type *dtype)
 {
   /* First collect the vtables we must look at for this object.  */
   value_ptr arg, vtbl;
@@ -1174,9 +1157,7 @@
    could actually be a pointer to.  */
 
 value_ptr
-value_from_vtable_info (arg, type)
-     value_ptr arg;
-     struct type *type;
+value_from_vtable_info (value_ptr arg, struct type *type)
 {
   /* Take care of preliminaries.  */
   if (TYPE_VPTR_FIELDNO (type) < 0)
@@ -1191,10 +1172,7 @@
    pointer which is for the base class whose type is BASECLASS.  */
 
 static int
-vb_match (type, index, basetype)
-     struct type *type;
-     int index;
-     struct type *basetype;
+vb_match (struct type *type, int index, struct type *basetype)
 {
   struct type *fieldtype;
   char *name = TYPE_FIELD_NAME (type, index);
@@ -1245,11 +1223,8 @@
    -1 is returned on error. */
 
 int
-baseclass_offset (type, index, valaddr, address)
-     struct type *type;
-     int index;
-     char *valaddr;
-     CORE_ADDR address;
+baseclass_offset (struct type *type, int index, char *valaddr,
+		  CORE_ADDR address)
 {
   struct type *basetype = TYPE_BASECLASS (type, index);
 
@@ -1303,10 +1278,7 @@
    If the field is signed, we also do sign extension. */
 
 LONGEST
-unpack_field_as_long (type, valaddr, fieldno)
-     struct type *type;
-     char *valaddr;
-     int fieldno;
+unpack_field_as_long (struct type *type, char *valaddr, int fieldno)
 {
   ULONGEST val;
   ULONGEST valmask;
@@ -1351,10 +1323,7 @@
    indicate which bits (in target bit order) comprise the bitfield.  */
 
 void
-modify_field (addr, fieldval, bitpos, bitsize)
-     char *addr;
-     LONGEST fieldval;
-     int bitpos, bitsize;
+modify_field (char *addr, LONGEST fieldval, int bitpos, int bitsize)
 {
   LONGEST oword;
 
@@ -1395,9 +1364,7 @@
 /* Convert C numbers into newly allocated values */
 
 value_ptr
-value_from_longest (type, num)
-     struct type *type;
-     register LONGEST num;
+value_from_longest (struct type *type, register LONGEST num)
 {
   register value_ptr val = allocate_value (type);
   register enum type_code code;
@@ -1448,8 +1415,7 @@
    use inferior memory.  String shall NOT contain embedded nulls.  */
 
 value_ptr
-value_from_string (ptr)
-     char *ptr;
+value_from_string (char *ptr)
 {
   value_ptr val;
   int len = strlen (ptr);
@@ -1469,9 +1435,7 @@
 }
 
 value_ptr
-value_from_double (type, num)
-     struct type *type;
-     DOUBLEST num;
+value_from_double (struct type *type, DOUBLEST num)
 {
   register value_ptr val = allocate_value (type);
   struct type *base_type = check_typedef (type);
@@ -1502,12 +1466,9 @@
    0 when it is using the value returning conventions (this often
    means returning pointer to where structure is vs. returning value). */
 
+/* ARGSUSED */
 value_ptr
-value_being_returned (valtype, retbuf, struct_return)
-     register struct type *valtype;
-     char *retbuf;
-     int struct_return;
-     /*ARGSUSED */
+value_being_returned (struct type *valtype, char *retbuf, int struct_return)
 {
   register value_ptr val;
   CORE_ADDR addr;
@@ -1545,9 +1506,7 @@
    handled wrong.  */
 
 int
-generic_use_struct_convention (gcc_p, value_type)
-     int gcc_p;
-     struct type *value_type;
+generic_use_struct_convention (int gcc_p, struct type *value_type)
 {
   return !((gcc_p == 1)
 	   && (TYPE_LENGTH (value_type) == 1
@@ -1568,13 +1527,10 @@
    is the type returned by the function.  GCC_P is nonzero if compiled
    with GCC.  */
 
+/* ARGSUSED */
 int
-using_struct_return (function, funcaddr, value_type, gcc_p)
-     value_ptr function;
-     CORE_ADDR funcaddr;
-     struct type *value_type;
-     int gcc_p;
-     /*ARGSUSED */
+using_struct_return (value_ptr function, CORE_ADDR funcaddr,
+		     struct type *value_type, int gcc_p)
 {
   register enum type_code code = TYPE_CODE (value_type);
 
@@ -1595,8 +1551,7 @@
    function wants to return.  */
 
 void
-set_return_value (val)
-     value_ptr val;
+set_return_value (value_ptr val)
 {
   struct type *type = check_typedef (VALUE_TYPE (val));
   register enum type_code code = TYPE_CODE (type);
@@ -1612,7 +1567,7 @@
 }
 
 void
-_initialize_values ()
+_initialize_values (void)
 {
   add_cmd ("convenience", no_class, show_convenience,
 	   "Debugger convenience (\"$foo\") variables.\n\
diff --git a/gdb/varobj.c b/gdb/varobj.c
index faae5f8..4adfd68 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -411,7 +411,8 @@
 	       enum varobj_type type)
 {
   struct varobj *var;
-  struct frame_info *fi, *old_fi;
+  struct frame_info *fi;
+  struct frame_info *old_fi = NULL;
   struct block *block;
   struct cleanup *old_chain;
 
@@ -781,8 +782,9 @@
       value_ptr temp;
 
       input_radix = 10;		/* ALWAYS reset to decimal temporarily */
-      /* FIXME: Callee may longjump */
-      exp = parse_exp_1 (&s, 0, 0);
+      if (!gdb_parse_exp_1 (&s, 0, 0, &exp))
+	/* We cannot proceed without a well-formed expression. */
+	return 0;
       if (!gdb_evaluate_expression (exp, &value))
 	{
 	  /* We cannot proceed without a valid expression. */
@@ -817,7 +819,8 @@
 	}
 
       VALUE_ADDRESS (temp) += offset;
-      val = value_assign (temp, value);
+      if (!gdb_value_assign (temp, value, &val))
+	return 0;
       VALUE_ADDRESS (val) -= offset;
       value_free (var->value);
       release_value (val);
@@ -881,7 +884,7 @@
   int error2;
   struct varobj *v;
   struct varobj **cv;
-  struct varobj **templist;
+  struct varobj **templist = NULL;
   value_ptr new;
   struct vstack *stack = NULL;
   struct vstack *result = NULL;
@@ -916,21 +919,24 @@
   /* Initialize a stack for temporary results */
   vpush (&result, NULL);
 
-  if (type_changed || !my_value_equal (var->value, new, &error2))
+  /* If this is a "use_selected_frame" varobj, and its type has changed,
+     them note that it's changed. */
+  if (type_changed)
     {
-      /* Note that it's changed   There a couple of exceptions here,
-         though. We don't want some types to be reported as 
-	 "changed". The exception to this is if this is a 
-	 "use_selected_frame" varobj, and its type has changed. */
-      if (type_changed || type_changeable (var))
-	{
-	  vpush (&result, var);
-	  changed++;
-	}
+      vpush (&result, var);
+      changed++;
     }
-  /* error2 replaces var->error since this new value
-     WILL replace the old one. */
-  var->error = error2;
+  /* If values are not equal, note that it's changed.
+     There a couple of exceptions here, though.
+     We don't want some types to be reported as "changed". */
+  else if (type_changeable (var) && !my_value_equal (var->value, new, &error2))
+    {
+      vpush (&result, var);
+      changed++;
+      /* error2 replaces var->error since this new value
+         WILL replace the old one. */
+      var->error = error2;
+    }
 
   /* We must always keep around the new value for this root
      variable expression, or we lose the updated children! */
@@ -1030,10 +1036,8 @@
  */
 
 static int
-delete_variable (resultp, var, only_children_p)
-     struct cpstack **resultp;
-     struct varobj *var;
-     int only_children_p;
+delete_variable (struct cpstack **resultp, struct varobj *var,
+		 int only_children_p)
 {
   int delcount = 0;
 
@@ -1048,13 +1052,8 @@
    and the parent is not removed we dump core.  It must be always
    initially called with remove_from_parent_p set */
 static void
-delete_variable_1 (resultp, delcountp, var,
-		   only_children_p, remove_from_parent_p)
-     struct cpstack **resultp;
-     int *delcountp;
-     struct varobj *var;
-     int only_children_p;
-     int remove_from_parent_p;
+delete_variable_1 (struct cpstack **resultp, int *delcountp, struct varobj *var,
+		   int only_children_p, int remove_from_parent_p)
 {
   struct varobj_child *vc;
   struct varobj_child *next;
@@ -1066,7 +1065,7 @@
 	vc->child->parent = NULL;
       delete_variable_1 (resultp, delcountp, vc->child, 0, only_children_p);
       next = vc->next;
-      free (vc);
+      xfree (vc);
     }
 
   /* if we were called to delete only the children we are done here */
@@ -1102,8 +1101,7 @@
 
 /* Install the given variable VAR with the object name VAR->OBJ_NAME. */
 static int
-install_variable (var)
-     struct varobj *var;
+install_variable (struct varobj *var)
 {
   struct vlist *cv;
   struct vlist *newvl;
@@ -1146,8 +1144,7 @@
 
 /* Unistall the object VAR. */
 static void
-uninstall_variable (var)
-     struct varobj *var;
+uninstall_variable (struct varobj *var)
 {
   struct vlist *cv;
   struct vlist *prev;
@@ -1185,7 +1182,7 @@
   else
     prev->next = cv->next;
 
-  free (cv);
+  xfree (cv);
 
   /* If root, remove varobj from root list */
   if (var->root->rootvar == var)
@@ -1220,9 +1217,7 @@
 /* Does a child with the name NAME exist in VAR? If so, return its data.
    If not, return NULL. */
 static struct varobj *
-child_exists (var, name)
-     struct varobj *var;	/* Parent */
-     char *name;		/* name of child */
+child_exists (struct varobj *var, char *name)
 {
   struct varobj_child *vc;
 
@@ -1237,10 +1232,7 @@
 
 /* Create and install a child of the parent of the given name */
 static struct varobj *
-create_child (parent, index, name)
-     struct varobj *parent;
-     int index;
-     char *name;
+create_child (struct varobj *parent, int index, char *name)
 {
   struct varobj *child;
   char *childs_name;
@@ -1273,9 +1265,7 @@
 /* FIXME: This should be a generic add to list */
 /* Save CHILD in the PARENT's data. */
 static void
-save_child_in_parent (parent, child)
-     struct varobj *parent;
-     struct varobj *child;
+save_child_in_parent (struct varobj *parent, struct varobj *child)
 {
   struct varobj_child *vc;
 
@@ -1291,9 +1281,7 @@
 /* FIXME: This should be a generic remove from list */
 /* Remove the CHILD from the PARENT's list of children. */
 static void
-remove_child_from_parent (parent, child)
-     struct varobj *parent;
-     struct varobj *child;
+remove_child_from_parent (struct varobj *parent, struct varobj *child)
 {
   struct varobj_child *vc, *prev;
 
@@ -1359,8 +1347,7 @@
 
 /* Free any allocated memory associated with VAR. */
 static void
-free_variable (var)
-     struct varobj *var;
+free_variable (struct varobj *var)
 {
   /* Free the expression if this is a root variable. */
   if (var->root->rootvar == var)
@@ -1390,8 +1377,7 @@
    and returns the real type of the variable. It also dereferences
    pointers and references. */
 static struct type *
-get_type (var)
-     struct varobj *var;
+get_type (struct varobj *var)
 {
   struct type *type;
   type = var->type;
@@ -1404,8 +1390,7 @@
 
 /* This returns the type of the variable, dereferencing pointers, too. */
 static struct type *
-get_type_deref (var)
-     struct varobj *var;
+get_type_deref (struct varobj *var)
 {
   struct type *type;
 
@@ -1421,8 +1406,7 @@
 /* This returns the target type (or NULL) of TYPE, also skipping
    past typedefs, just like get_type (). */
 static struct type *
-get_target_type (type)
-     struct type *type;
+get_target_type (struct type *type)
 {
   if (type != NULL)
     {
@@ -1437,8 +1421,7 @@
 /* What is the default display for this variable? We assume that
    everything is "natural". Any exceptions? */
 static enum varobj_display_formats
-variable_default_display (var)
-     struct varobj *var;
+variable_default_display (struct varobj *var)
 {
   return FORMAT_NATURAL;
 }
@@ -1447,10 +1430,7 @@
    one is "safe" -- it NEVER longjmps. It determines if the VAR's
    value is the same as VAL2. */
 static int
-my_value_equal (val1, val2, error2)
-     value_ptr val1;
-     value_ptr val2;
-     int *error2;
+my_value_equal (value_ptr val1, value_ptr val2, int *error2)
 {
   int r, err1, err2;
 
@@ -1504,9 +1484,7 @@
 
 /* FIXME: The following should be generic for any pointer */
 static void
-vpush (pstack, var)
-     struct vstack **pstack;
-     struct varobj *var;
+vpush (struct vstack **pstack, struct varobj *var)
 {
   struct vstack *s;
 
@@ -1518,8 +1496,7 @@
 
 /* FIXME: The following should be generic for any pointer */
 static struct varobj *
-vpop (pstack)
-     struct vstack **pstack;
+vpop (struct vstack **pstack)
 {
   struct vstack *s;
   struct varobj *v;
@@ -1530,16 +1507,14 @@
   s = *pstack;
   v = s->var;
   *pstack = (*pstack)->next;
-  free (s);
+  xfree (s);
 
   return v;
 }
 
 /* FIXME: The following should be generic for any pointer */
 static void
-cppush (pstack, name)
-     struct cpstack **pstack;
-     char *name;
+cppush (struct cpstack **pstack, char *name)
 {
   struct cpstack *s;
 
@@ -1551,8 +1526,7 @@
 
 /* FIXME: The following should be generic for any pointer */
 static char *
-cppop (pstack)
-     struct cpstack **pstack;
+cppop (struct cpstack **pstack)
 {
   struct cpstack *s;
   char *v;
@@ -1563,7 +1537,7 @@
   s = *pstack;
   v = s->name;
   *pstack = (*pstack)->next;
-  free (s);
+  xfree (s);
 
   return v;
 }
@@ -1576,8 +1550,7 @@
 
 /* Get the language of variable VAR. */
 static enum varobj_languages
-variable_language (var)
-     struct varobj *var;
+variable_language (struct varobj *var)
 {
   enum varobj_languages lang;
 
@@ -1604,25 +1577,21 @@
    is the number of children that the user will see in the variable
    display. */
 static int
-number_of_children (var)
-     struct varobj *var;
+number_of_children (struct varobj *var)
 {
   return (*var->root->lang->number_of_children) (var);;
 }
 
 /* What is the expression for the root varobj VAR? Returns a malloc'd string. */
 static char *
-name_of_variable (var)
-     struct varobj *var;
+name_of_variable (struct varobj *var)
 {
   return (*var->root->lang->name_of_variable) (var);
 }
 
 /* What is the name of the INDEX'th child of VAR? Returns a malloc'd string. */
 static char *
-name_of_child (var, index)
-     struct varobj *var;
-     int index;
+name_of_child (struct varobj *var, int index)
 {
   return (*var->root->lang->name_of_child) (var, index);
 }
@@ -1638,9 +1607,7 @@
    On return, TYPE_CHANGED will be 1 if the type has changed, and 
    0 otherwise. */
 static value_ptr
-value_of_root (var_handle, type_changed)
-     struct varobj ** var_handle;
-     int *type_changed;
+value_of_root (struct varobj **var_handle, int *type_changed)
 {
   struct varobj *var;
 
@@ -1699,9 +1666,7 @@
 
 /* What is the value_ptr for the INDEX'th child of PARENT? */
 static value_ptr
-value_of_child (parent, index)
-     struct varobj *parent;
-     int index;
+value_of_child (struct varobj *parent, int index)
 {
   value_ptr value;
 
@@ -1716,8 +1681,7 @@
 
 /* What is the type of VAR? */
 static struct type *
-type_of_child (var)
-     struct varobj *var;
+type_of_child (struct varobj *var)
 {
 
   /* If the child had no evaluation errors, var->value
@@ -1732,16 +1696,14 @@
 /* Is this variable editable? Use the variable's type to make
    this determination. */
 static int
-variable_editable (var)
-     struct varobj *var;
+variable_editable (struct varobj *var)
 {
   return (*var->root->lang->variable_editable) (var);
 }
 
 /* GDB already has a command called "value_of_variable". Sigh. */
 static char *
-my_value_of_variable (var)
-     struct varobj *var;
+my_value_of_variable (struct varobj *var)
 {
   return (*var->root->lang->value_of_variable) (var);
 }
@@ -1750,8 +1712,7 @@
    some variable's values never change. For example,
    struct and unions never change values. */
 static int
-type_changeable (var)
-     struct varobj *var;
+type_changeable (struct varobj *var)
 {
   int r;
   struct type *type;
@@ -1765,6 +1726,7 @@
     {
       case TYPE_CODE_STRUCT:
       case TYPE_CODE_UNION:
+      case TYPE_CODE_ARRAY:
 	r = 0;
 	break;
 
@@ -1777,8 +1739,7 @@
 
 /* C */
 static int
-c_number_of_children (var)
-     struct varobj *var;
+c_number_of_children (struct varobj *var)
 {
   struct type *type;
   struct type *target;
@@ -1838,16 +1799,13 @@
 }
 
 static char *
-c_name_of_variable (parent)
-     struct varobj *parent;
+c_name_of_variable (struct varobj *parent)
 {
   return savestring (parent->name, strlen (parent->name));
 }
 
 static char *
-c_name_of_child (parent, index)
-     struct varobj *parent;
-     int index;
+c_name_of_child (struct varobj *parent, int index)
 {
   struct type *type;
   struct type *target;
@@ -1901,8 +1859,7 @@
 }
 
 static value_ptr
-c_value_of_root (var_handle)
-     struct varobj **var_handle;
+c_value_of_root (struct varobj **var_handle)
 {
   value_ptr new_val;
   struct varobj *var = *var_handle;
@@ -1963,9 +1920,7 @@
 }
 
 static value_ptr
-c_value_of_child (parent, index)
-     struct varobj *parent;
-     int index;
+c_value_of_child (struct varobj *parent, int index)
 {
   value_ptr value, temp, indval;
   struct type *type, *target;
@@ -2024,9 +1979,7 @@
 }
 
 static struct type *
-c_type_of_child (parent, index)
-     struct varobj *parent;
-     int index;
+c_type_of_child (struct varobj *parent, int index)
 {
   struct type *type;
   char *name = name_of_child (parent, index);
@@ -2068,8 +2021,7 @@
 }
 
 static int
-c_variable_editable (var)
-     struct varobj *var;
+c_variable_editable (struct varobj *var)
 {
   switch (TYPE_CODE (get_type (var)))
     {
@@ -2089,8 +2041,7 @@
 }
 
 static char *
-c_value_of_variable (var)
-     struct varobj *var;
+c_value_of_variable (struct varobj *var)
 {
   struct type *type;
   value_ptr val;
@@ -2146,8 +2097,7 @@
 /* C++ */
 
 static int
-cplus_number_of_children (var)
-     struct varobj *var;
+cplus_number_of_children (struct varobj *var)
 {
   struct type *type;
   int children, dont_know;
@@ -2205,9 +2155,7 @@
    That means we need to descend into all baseclasses and find out
    how many are there, too. */
 static void
-cplus_class_num_children (type, children)
-     struct type *type;
-     int children[3];
+cplus_class_num_children (struct type *type, int children[3])
 {
   int i;
 
@@ -2232,16 +2180,13 @@
 }
 
 static char *
-cplus_name_of_variable (parent)
-     struct varobj *parent;
+cplus_name_of_variable (struct varobj *parent)
 {
   return c_name_of_variable (parent);
 }
 
 static char *
-cplus_name_of_child (parent, index)
-     struct varobj *parent;
-     int index;
+cplus_name_of_child (struct varobj *parent, int index)
 {
   char *name;
   struct type *type;
@@ -2324,16 +2269,13 @@
 }
 
 static value_ptr
-cplus_value_of_root (var_handle)
-     struct varobj **var_handle;
+cplus_value_of_root (struct varobj **var_handle)
 {
   return c_value_of_root (var_handle);
 }
 
 static value_ptr
-cplus_value_of_child (parent, index)
-     struct varobj *parent;
-     int index;
+cplus_value_of_child (struct varobj *parent, int index)
 {
   struct type *type;
   value_ptr value;
@@ -2388,9 +2330,7 @@
 }
 
 static struct type *
-cplus_type_of_child (parent, index)
-     struct varobj *parent;
-     int index;
+cplus_type_of_child (struct varobj *parent, int index)
 {
   struct type *type, *t;
 
@@ -2423,8 +2363,7 @@
 }
 
 static int
-cplus_variable_editable (var)
-     struct varobj *var;
+cplus_variable_editable (struct varobj *var)
 {
   if (CPLUS_FAKE_CHILD (var))
     return 0;
@@ -2433,8 +2372,7 @@
 }
 
 static char *
-cplus_value_of_variable (var)
-     struct varobj *var;
+cplus_value_of_variable (struct varobj *var)
 {
 
   /* If we have one of our special types, don't print out
@@ -2448,15 +2386,13 @@
 /* Java */
 
 static int
-java_number_of_children (var)
-     struct varobj *var;
+java_number_of_children (struct varobj *var)
 {
   return cplus_number_of_children (var);
 }
 
 static char *
-java_name_of_variable (parent)
-     struct varobj *parent;
+java_name_of_variable (struct varobj *parent)
 {
   char *p, *name;
 
@@ -2476,9 +2412,7 @@
 }
 
 static char *
-java_name_of_child (parent, index)
-     struct varobj *parent;
-     int index;
+java_name_of_child (struct varobj *parent, int index)
 {
   char *name, *p;
 
@@ -2497,38 +2431,31 @@
 }
 
 static value_ptr
-java_value_of_root (var_handle)
-     struct varobj **var_handle;
+java_value_of_root (struct varobj **var_handle)
 {
   return cplus_value_of_root (var_handle);
 }
 
 static value_ptr
-java_value_of_child (parent, index)
-     struct varobj *parent;
-     int index;
+java_value_of_child (struct varobj *parent, int index)
 {
   return cplus_value_of_child (parent, index);
 }
 
 static struct type *
-java_type_of_child (parent, index)
-     struct varobj *parent;
-     int index;
+java_type_of_child (struct varobj *parent, int index)
 {
   return cplus_type_of_child (parent, index);
 }
 
 static int
-java_variable_editable (var)
-     struct varobj *var;
+java_variable_editable (struct varobj *var)
 {
   return cplus_variable_editable (var);
 }
 
 static char *
-java_value_of_variable (var)
-     struct varobj *var;
+java_value_of_variable (struct varobj *var)
 {
   return cplus_value_of_variable (var);
 }
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index c344b43..ca54efe 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -21,6 +21,9 @@
 #include "defs.h"
 #include "symtab.h"
 #include "opcode/vax.h"
+#include "gdbcore.h"
+#include "frame.h"
+#include "value.h"
 
 /* Vax instructions are never longer than this.  */
 #define MAXLEN 62
@@ -34,8 +37,7 @@
    to reach some "real" code.  */
 
 CORE_ADDR
-vax_skip_prologue (pc)
-     CORE_ADDR pc;
+vax_skip_prologue (CORE_ADDR pc)
 {
   register int op = (unsigned char) read_memory_integer (pc, 1);
   if (op == 0x11)
@@ -64,8 +66,7 @@
    Can return -1, meaning no way to tell.  */
 
 int
-vax_frame_num_args (fi)
-     struct frame_info *fi;
+vax_frame_num_args (struct frame_info *fi)
 {
   return (0xff & read_memory_integer (FRAME_ARGS_ADDRESS (fi), 1));
 }
@@ -77,14 +78,12 @@
    Returns length of the instruction, in bytes.  */
 
 static int
-vax_print_insn (memaddr, info)
-     CORE_ADDR memaddr;
-     disassemble_info *info;
+vax_print_insn (CORE_ADDR memaddr, disassemble_info *info)
 {
   unsigned char buffer[MAXLEN];
   register int i;
   register unsigned char *p;
-  register char *d;
+  const char *d;
 
   int status = (*info->read_memory_func) (memaddr, buffer, MAXLEN, info);
   if (status != 0)
@@ -126,11 +125,8 @@
 }
 
 static unsigned char *
-print_insn_arg (d, p, addr, info)
-     char *d;
-     register char *p;
-     CORE_ADDR addr;
-     disassemble_info *info;
+print_insn_arg (char *d, register char *p, CORE_ADDR addr,
+		disassemble_info *info)
 {
   register int regnum = *p & 0xf;
   float floatlitbuf;
@@ -300,7 +296,7 @@
 }
 
 void
-_initialize_vax_tdep ()
+_initialize_vax_tdep (void)
 {
   tm_print_insn = vax_print_insn;
 }
diff --git a/gdb/w65-tdep.c b/gdb/w65-tdep.c
index e575ff7..4e6fd2d 100644
--- a/gdb/w65-tdep.c
+++ b/gdb/w65-tdep.c
@@ -36,32 +36,29 @@
 
 
 CORE_ADDR
-w65_frame_saved_pc (frame)
-     struct frame_info *frame;
+w65_frame_saved_pc (struct frame_info *frame)
 {
   return (read_memory_integer (frame->frame + 2, 4) & 0xffffff);
 }
 
 CORE_ADDR
-w65_addr_bits_remove (addr)
-     CORE_ADDR addr;
+w65_addr_bits_remove (CORE_ADDR addr)
 {
   return ((addr) & 0xffffff);
 }
 
-read_memory_pointer (x)
-     CORE_ADDR x;
+read_memory_pointer (CORE_ADDR x)
 {
   return read_memory_integer (ADDR_BITS_REMOVE (x), 4);
 }
 
-init_frame_pc ()
+init_frame_pc (void)
 {
   abort ();
 }
 
 void
-w65_push_dummy_frame ()
+w65_push_dummy_frame (void)
 {
   abort ();
 }
@@ -76,9 +73,7 @@
    it is fairly expensive.  */
 
 void
-frame_find_saved_regs (fip, fsrp)
-     struct frame_info *fip;
-     struct frame_saved_regs *fsrp;
+frame_find_saved_regs (struct frame_info *fip, struct frame_saved_regs *fsrp)
 {
   int locals;
   CORE_ADDR pc;
@@ -89,7 +84,7 @@
 }
 
 int
-saved_pc_after_call ()
+saved_pc_after_call (void)
 {
   int sp = read_register (SP_REGNUM);
   int val = read_memory_integer (sp + 1, 4);
@@ -97,10 +92,7 @@
 }
 
 
-extract_return_value (type, regbuf, valbuf)
-     struct type *type;
-     char *regbuf;
-     char *valbuf;
+extract_return_value (struct type *type, char *regbuf, char *valbuf)
 {
   int b;
   int len = TYPE_LENGTH (type);
@@ -115,9 +107,7 @@
 }
 
 void
-write_return_value (type, valbuf)
-     struct type *type;
-     char *valbuf;
+write_return_value (struct type *type, char *valbuf)
 {
   int reg;
   int len;
@@ -128,41 +118,37 @@
 }
 
 void
-store_struct_return (addr, sp)
-     CORE_ADDR addr;
-     CORE_ADDR sp;
+store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
 {
   write_register (2, addr);
 }
 
 void
-w65_pop_frame ()
+w65_pop_frame (void)
 {
 }
 
-init_extra_frame_info ()
+init_extra_frame_info (void)
 {
 }
 
-pop_frame ()
+pop_frame (void)
 {
 }
 
-w65_frame_chain (thisframe)
-     struct frame_info *thisframe;
+w65_frame_chain (struct frame_info *thisframe)
 {
   return 0xffff & read_memory_integer ((thisframe)->frame, 2);
 }
 
 static int
-gb (x)
+gb (int x)
 {
   return read_memory_integer (x, 1) & 0xff;
 }
 
 extern CORE_ADDR
-w65_skip_prologue (pc)
-     CORE_ADDR pc;
+w65_skip_prologue (CORE_ADDR pc)
 {
   CORE_ADDR too_far = pc + 20;
 
@@ -229,14 +215,14 @@
 }
 
 
-register_raw_size (n)
+register_raw_size (int n)
 {
   return sim_reg_size (n);
 }
 
 
 void
-print_register_hook (regno)
+print_register_hook (int regno)
 {
   if (regno == P_REGNUM)
     {
@@ -290,7 +276,7 @@
 }
 
 void
-_initialize_w65_tdep ()
+_initialize_w65_tdep (void)
 {
   tm_print_insn = print_insn_w65;
 }
diff --git a/gdb/w89k-rom.c b/gdb/w89k-rom.c
index 9a73362..e33a3c5 100644
--- a/gdb/w89k-rom.c
+++ b/gdb/w89k-rom.c
@@ -50,11 +50,7 @@
 };
 
 static void
-w89k_supply_register (regname, regnamelen, val, vallen)
-     char *regname;
-     int regnamelen;
-     char *val;
-     int vallen;
+w89k_supply_register (char *regname, int regnamelen, char *val, int vallen)
 {
   int numregs;
   int regno;
@@ -163,10 +159,7 @@
 extern struct monitor_ops w89k_cmds;	/* fwd decl */
 
 static void
-w89k_load (desc, file, hashmark)
-     serial_t desc;
-     char *file;
-     int hashmark;
+w89k_load (serial_t desc, char *file, int hashmark)
 {
   bfd *abfd;
   asection *s;
@@ -296,15 +289,13 @@
 }				/* init_w89k_cmds */
 
 static void
-w89k_open (args, from_tty)
-     char *args;
-     int from_tty;
+w89k_open (char *args, int from_tty)
 {
   monitor_open (args, &w89k_cmds, from_tty);
 }
 
 void
-_initialize_w89k ()
+_initialize_w89k (void)
 {
   init_w89k_cmds ();
   init_monitor_ops (&w89k_ops);
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index 298fd51..10d6bd8 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -54,9 +54,14 @@
    following which never should have been in the generic Win32 API
    headers in the first place since they were our own invention... */
 #ifndef _GNU_H_WINDOWS_H
-#define FLAG_TRACE_BIT 0x100
-#define CONTEXT_DEBUGGER (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
+enum
+  {
+    FLAG_TRACE_BIT = 0x100,
+    CONTEXT_DEBUGGER = (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
+  };
 #endif
+#include <sys/procfs.h>
+#include <psapi.h>
 
 /* The string sent by cygwin when it processes a signal.
    FIXME: This should be in a cygwin include file. */
@@ -88,7 +93,8 @@
     int suspend_count;
     CONTEXT context;
     STACKFRAME sf;
-  } thread_info;
+  }
+thread_info;
 
 static thread_info thread_head;
 
@@ -232,7 +238,7 @@
 /* Clear out any old thread list and reintialize it to a
    pristine state. */
 static void
-child_init_thread_list ()
+child_init_thread_list (void)
 {
   thread_info *th = &thread_head;
 
@@ -243,7 +249,7 @@
       thread_info *here = th->next;
       th->next = here->next;
       (void) CloseHandle (here->h);
-      free (here);
+      xfree (here);
     }
 }
 
@@ -267,7 +273,7 @@
       thread_info *here = th->next;
       th->next = here->next;
       CloseHandle (here->h);
-      free (here);
+      xfree (here);
     }
 }
 
@@ -285,12 +291,12 @@
   long l;
   if (r == FCS_REGNUM)
     {
-      l = *((long *)context_offset) & 0xffff;
+      l = *((long *) context_offset) & 0xffff;
       supply_register (r, (char *) &l);
     }
   else if (r == FOP_REGNUM)
     {
-      l = (*((long *)context_offset) >> 16) & ((1 << 11) - 1);
+      l = (*((long *) context_offset) >> 16) & ((1 << 11) - 1);
       supply_register (r, (char *) &l);
     }
   else if (r >= 0)
@@ -329,78 +335,79 @@
   do_child_store_inferior_registers (r);
 }
 
-#include <psapi.h>
 static int psapi_loaded = 0;
 static HMODULE psapi_module_handle = NULL;
-static BOOL  WINAPI (*psapi_EnumProcessModules)(HANDLE, HMODULE*, DWORD, LPDWORD)= NULL;
-static BOOL  WINAPI (*psapi_GetModuleInformation) (HANDLE, HMODULE, LPMODULEINFO, DWORD)= NULL;
-static DWORD WINAPI (*psapi_GetModuleFileNameExA) (HANDLE, HMODULE, LPSTR, DWORD)= NULL;
+static BOOL WINAPI (*psapi_EnumProcessModules) (HANDLE, HMODULE *, DWORD, LPDWORD) = NULL;
+static BOOL WINAPI (*psapi_GetModuleInformation) (HANDLE, HMODULE, LPMODULEINFO, DWORD) = NULL;
+static DWORD WINAPI (*psapi_GetModuleFileNameExA) (HANDLE, HMODULE, LPSTR, DWORD) = NULL;
 
-int psapi_get_dll_name (DWORD BaseAddress, char *dll_name_ret)
+int 
+psapi_get_dll_name (DWORD BaseAddress, char *dll_name_ret)
 {
   DWORD len;
   MODULEINFO mi;
   int i;
-  HMODULE dh_buf [ 1 ];
-  HMODULE* DllHandle = dh_buf;
+  HMODULE dh_buf[1];
+  HMODULE *DllHandle = dh_buf;
   DWORD cbNeeded;
   BOOL ok;
 
   if (!psapi_loaded ||
-       psapi_EnumProcessModules   == NULL ||
-       psapi_GetModuleInformation == NULL ||
-       psapi_GetModuleFileNameExA == NULL)
+      psapi_EnumProcessModules == NULL ||
+      psapi_GetModuleInformation == NULL ||
+      psapi_GetModuleFileNameExA == NULL)
     {
-      if (psapi_loaded)goto failed;
+      if (psapi_loaded)
+	goto failed;
       psapi_loaded = 1;
       psapi_module_handle = LoadLibrary ("psapi.dll");
       if (!psapi_module_handle)
-        {
-          /* printf_unfiltered ("error loading psapi.dll: %u", GetLastError ());*/
-          goto failed;
-        }
-      psapi_EnumProcessModules   = GetProcAddress (psapi_module_handle, "EnumProcessModules" );
+	{
+	  /* printf_unfiltered ("error loading psapi.dll: %u", GetLastError ()); */
+	  goto failed;
+	}
+      psapi_EnumProcessModules = GetProcAddress (psapi_module_handle, "EnumProcessModules");
       psapi_GetModuleInformation = GetProcAddress (psapi_module_handle, "GetModuleInformation");
       psapi_GetModuleFileNameExA = (void *) GetProcAddress (psapi_module_handle,
-							    "GetModuleFileNameExA");
-      if (psapi_EnumProcessModules   == NULL ||
-           psapi_GetModuleInformation == NULL ||
-           psapi_GetModuleFileNameExA == NULL)
+						    "GetModuleFileNameExA");
+      if (psapi_EnumProcessModules == NULL ||
+	  psapi_GetModuleInformation == NULL ||
+	  psapi_GetModuleFileNameExA == NULL)
 	goto failed;
     }
 
   cbNeeded = 0;
   ok = (*psapi_EnumProcessModules) (current_process_handle,
-				     DllHandle,
-				     sizeof (HMODULE),
-				     &cbNeeded);
+				    DllHandle,
+				    sizeof (HMODULE),
+				    &cbNeeded);
 
   if (!ok || !cbNeeded)
     goto failed;
 
-  DllHandle = (HMODULE*) alloca (cbNeeded);
+  DllHandle = (HMODULE *) alloca (cbNeeded);
   if (!DllHandle)
     goto failed;
 
   ok = (*psapi_EnumProcessModules) (current_process_handle,
-				     DllHandle,
-				     cbNeeded,
-				     &cbNeeded);
+				    DllHandle,
+				    cbNeeded,
+				    &cbNeeded);
   if (!ok)
     goto failed;
 
   for (i = 0; i < (int) (cbNeeded / sizeof (HMODULE)); i++)
     {
       if (!(*psapi_GetModuleInformation) (current_process_handle,
-					     DllHandle [i],
-					     &mi,
-					     sizeof (mi)))
+					  DllHandle[i],
+					  &mi,
+					  sizeof (mi)))
 	error ("Can't get module info");
 
       len = (*psapi_GetModuleFileNameExA) (current_process_handle,
-					    DllHandle [i],
-					    dll_name_ret,
-					    MAX_PATH);
+					   DllHandle[i],
+					   dll_name_ret,
+					   MAX_PATH);
       if (len == 0)
 	error ("Error getting dll name: %u\n", GetLastError ());
 
@@ -422,6 +429,7 @@
   struct section_addr_info *addrs;
   int mainline;
   int flags;
+  struct ui_file *err, *out;
   struct objfile *ret;
 };
 
@@ -438,11 +446,16 @@
 
 /* Restore gdb's stderr after calling symbol_file_add */
 static void
-safe_symbol_file_add_cleanup (void *gdb_stderrv)
+safe_symbol_file_add_cleanup (void *p)
 {
+#define sp ((struct safe_symbol_file_add_args *)p)
   gdb_flush (gdb_stderr);
+  gdb_flush (gdb_stdout);
   ui_file_delete (gdb_stderr);
-  gdb_stderr = (struct ui_file *)gdb_stderrv;
+  ui_file_delete (gdb_stdout);
+  gdb_stderr = sp->err;
+  gdb_stdout = sp->out;
+#undef sp
 }
 
 /* symbol_file_add wrapper that prevents errors from being displayed. */
@@ -450,15 +463,18 @@
 safe_symbol_file_add (char *name, int from_tty,
 		      struct section_addr_info *addrs,
 		      int mainline, int flags)
-
 {
   struct safe_symbol_file_add_args p;
   struct cleanup *cleanup;
 
-  cleanup = make_cleanup (safe_symbol_file_add_cleanup, gdb_stderr);
+  cleanup = make_cleanup (safe_symbol_file_add_cleanup, &p);
 
+  p.err = gdb_stderr;
+  p.out = gdb_stdout;
   gdb_flush (gdb_stderr);
+  gdb_flush (gdb_stdout);
   gdb_stderr = ui_file_new ();
+  gdb_stdout = ui_file_new ();
   p.name = name;
   p.from_tty = from_tty;
   p.addrs = addrs;
@@ -476,11 +492,25 @@
   struct so_stuff *next, **last;
   DWORD load_addr;
   char name[0];
-} solib_start, *solib_end;
+}
+solib_start, *solib_end;
 
 /* Remember the maximum DLL length for printing in info dll command. */
 int max_dll_name_len;
 
+static void
+register_loaded_dll (const char *name, DWORD load_addr)
+{
+  struct so_stuff *so;
+  so = (struct so_stuff *) xmalloc (sizeof (struct so_stuff) + strlen (name) + 8 + 2);
+  so->load_addr = load_addr;
+  strcpy (so->name, name);
+
+  solib_end->next = so;
+  solib_end = so;
+  so->next = NULL;
+}
+
 /* Wait for child to do something.  Return pid of child, or -1 in case
    of error; store status through argument pointer OURSTATUS.  */
 static int
@@ -490,16 +520,14 @@
   DWORD dll_name_ptr;
   DWORD done;
   char dll_buf[MAX_PATH + 1];
-  struct so_stuff *so, *solast;
   char *dll_name = NULL;
-  DWORD dll_base = 0;
   int len;
   char *p;
 
   dll_buf[0] = dll_buf[sizeof (dll_buf) - 1] = '\0';
 
   if (!psapi_get_dll_name ((DWORD) (event->lpBaseOfDll), dll_buf))
-    dll_buf[0] = dll_buf[sizeof(dll_buf) - 1] = '\0';
+    dll_buf[0] = dll_buf[sizeof (dll_buf) - 1] = '\0';
 
   dll_name = dll_buf;
 
@@ -567,14 +595,7 @@
   while ((p = strchr (dll_name, '\\')))
     *p = '/';
 
-  so = (struct so_stuff *) xmalloc (sizeof (struct so_stuff) +  strlen (dll_name) + 8 + 2);
-  so->load_addr = (DWORD) event->lpBaseOfDll + 0x1000;
-  strcpy (so->name, dll_name);
-
-  solib_end->next = so;
-  solib_end = so;
-  so->next = NULL;
-
+  register_loaded_dll (dll_name, (DWORD) event->lpBaseOfDll + 0x1000);
   len = strlen (dll_name);
   if (len > max_dll_name_len)
     max_dll_name_len = len;
@@ -584,9 +605,9 @@
 
 /* Return name of last loaded DLL. */
 char *
-child_solib_loaded_library_pathname (int pid)
+child_solib_loaded_library_pathname (int pid ATTRIBUTE_UNUSED)
 {
-  return !solib_end || !solib_end->name[0]? NULL : solib_end->name;
+  return !solib_end || !solib_end->name[0] ? NULL : solib_end->name;
 }
 
 /* Clear list of loaded DLLs. */
@@ -598,7 +619,7 @@
   while ((so = so1) != NULL)
     {
       so1 = so->next;
-      free (so);
+      xfree (so);
     }
 
   solib_start.next = NULL;
@@ -608,7 +629,7 @@
 
 /* Add DLL symbol information. */
 void
-child_solib_add (char *filename, int from_tty, struct target_ops *t)
+solib_symbols_add (char *name, CORE_ADDR load_addr)
 {
   struct section_addr_info section_addrs;
 
@@ -616,34 +637,42 @@
      the offset from 0 of the first byte in an image - because
      of the file header and the section alignment. */
 
-  if (!solib_end || !solib_end->name[0])
+  if (!name || !name[0])
     return;
 
   memset (&section_addrs, 0, sizeof (section_addrs));
   section_addrs.other[0].name = ".text";
-  section_addrs.other[0].addr = solib_end->load_addr;
-  safe_symbol_file_add (solib_end->name, 0, &section_addrs, 0, OBJF_SHARED);
+  section_addrs.other[0].addr = load_addr;
+  safe_symbol_file_add (name, 0, &section_addrs, 0, OBJF_SHARED);
 
   return;
 }
 
 /* Load DLL symbol info. */
 void
-dll_symbol_command (char *args, int from_tty)
+dll_symbol_command (char *args, int from_tty ATTRIBUTE_UNUSED)
 {
-  struct section_addr_info section_addrs;
-
+  int n;
   dont_repeat ();
-  
+
   if (args == NULL)
     error ("dll-symbols requires a file name");
 
-  safe_symbol_file_add (args, 0, NULL, 0, OBJF_SHARED);
-} 
+  n = strlen (args);
+  if (n > 4 && strcasecmp (args + n - 4, ".dll") != 0)
+    {
+      char *newargs = (char *) alloca (n + 4 + 1);
+      strcpy (newargs, args);
+      strcat (newargs, ".dll");
+      args = newargs;
+    }
+
+  safe_symbol_file_add (args, 0, NULL, 0, OBJF_SHARED | OBJF_USERLOADED);
+}
 
 /* List currently loaded DLLs. */
 void
-info_dll_command (char *ignore, int from_tty)
+info_dll_command (char *ignore ATTRIBUTE_UNUSED, int from_tty ATTRIBUTE_UNUSED)
 {
   struct so_stuff *so = &solib_start;
 
@@ -652,7 +681,7 @@
 
   printf ("%*s  Load Address\n", -max_dll_name_len, "DLL Name");
   while ((so = so->next) != NULL)
-    printf_unfiltered ("%*s  %08lx\n", -max_dll_name_len, so->name, so->load_addr);
+    printf_filtered ("%*s  %08lx\n", -max_dll_name_len, so->name, so->load_addr);
 
   return;
 }
@@ -686,7 +715,7 @@
 	ourstatus->kind = TARGET_WAITKIND_STOPPED;
     }
 
-  free (s);
+  xfree (s);
   return gotasig;
 }
 
@@ -701,13 +730,11 @@
   /* Record the context of the current thread */
   th = thread_rec (current_event.dwThreadId, -1);
 
-  last_sig = 0;
-
   switch (code)
     {
     case EXCEPTION_ACCESS_VIOLATION:
       DEBUG_EXCEPT (("gdb: Target exception ACCESS_VIOLATION at 0x%08lx\n",
-	       (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
+       (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
       ourstatus->value.sig = TARGET_SIGNAL_SEGV;
       last_sig = SIGSEGV;
       break;
@@ -716,41 +743,41 @@
     case STATUS_FLOAT_OVERFLOW:
     case STATUS_INTEGER_DIVIDE_BY_ZERO:
       DEBUG_EXCEPT (("gdb: Target exception STACK_OVERFLOW at 0x%08lx\n",
-	       (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
+       (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
       ourstatus->value.sig = TARGET_SIGNAL_FPE;
       last_sig = SIGFPE;
       break;
     case STATUS_STACK_OVERFLOW:
       DEBUG_EXCEPT (("gdb: Target exception STACK_OVERFLOW at 0x%08lx\n",
-	       (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
+       (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
       ourstatus->value.sig = TARGET_SIGNAL_SEGV;
       break;
     case EXCEPTION_BREAKPOINT:
       DEBUG_EXCEPT (("gdb: Target exception BREAKPOINT at 0x%08lx\n",
-	       (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
+       (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
       ourstatus->value.sig = TARGET_SIGNAL_TRAP;
       break;
     case DBG_CONTROL_C:
       DEBUG_EXCEPT (("gdb: Target exception CONTROL_C at 0x%08lx\n",
-	       (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
+       (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
       ourstatus->value.sig = TARGET_SIGNAL_INT;
       last_sig = SIGINT;	/* FIXME - should check pass state */
       break;
     case EXCEPTION_SINGLE_STEP:
       DEBUG_EXCEPT (("gdb: Target exception SINGLE_STEP at 0x%08lx\n",
-	       (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
+       (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
       ourstatus->value.sig = TARGET_SIGNAL_TRAP;
       break;
     case EXCEPTION_ILLEGAL_INSTRUCTION:
       DEBUG_EXCEPT (("gdb: Target exception SINGLE_ILL at 0x%08lx\n",
-	       (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
+       (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
       ourstatus->value.sig = TARGET_SIGNAL_ILL;
       last_sig = SIGILL;
       break;
     default:
       printf_unfiltered ("gdb: unknown target exception 0x%08lx at 0x%08lx\n",
 		    current_event.u.Exception.ExceptionRecord.ExceptionCode,
-		(DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress);
+	(DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress);
       ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
       break;
     }
@@ -791,13 +818,14 @@
 static int
 get_child_debug_event (int pid ATTRIBUTE_UNUSED, struct target_waitstatus *ourstatus)
 {
-  int breakout = 0;
   BOOL debug_event;
   DWORD continue_status, event_code;
   thread_info *th = NULL;
   static thread_info dummy_thread_info;
   int retval = 0;
 
+  last_sig = 0;
+
   if (!(debug_event = WaitForDebugEvent (&current_event, 1000)))
     goto out;
 
@@ -839,13 +867,15 @@
 		     "CREATE_PROCESS_DEBUG_EVENT"));
       current_process_handle = current_event.u.CreateProcessInfo.hProcess;
 
-      main_thread_id = inferior_pid = current_event.dwThreadId;
+      main_thread_id = current_event.dwThreadId;
       /* Add the main thread */
+#if 0
       th = child_add_thread (current_event.dwProcessId,
 			     current_event.u.CreateProcessInfo.hProcess);
-      th = child_add_thread (inferior_pid,
+#endif
+      th = child_add_thread (main_thread_id,
 			     current_event.u.CreateProcessInfo.hThread);
-      retval = ourstatus->value.related_pid = current_event.dwProcessId;
+      retval = ourstatus->value.related_pid = current_event.dwThreadId;
       break;
 
     case EXIT_PROCESS_DEBUG_EVENT:
@@ -856,7 +886,7 @@
       ourstatus->kind = TARGET_WAITKIND_EXITED;
       ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode;
       CloseHandle (current_process_handle);
-      retval = current_event.dwProcessId;
+      retval = main_thread_id;
       break;
 
     case LOAD_DLL_DEBUG_EVENT:
@@ -868,7 +898,7 @@
       registers_changed ();	/* mark all regs invalid */
       ourstatus->kind = TARGET_WAITKIND_LOADED;
       ourstatus->value.integer = 0;
-      retval = current_event.dwProcessId;
+      retval = main_thread_id;
       break;
 
     case UNLOAD_DLL_DEBUG_EVENT:
@@ -892,9 +922,10 @@
 		     (unsigned) current_event.dwProcessId,
 		     (unsigned) current_event.dwThreadId,
 		     "OUTPUT_DEBUG_STRING_EVENT"));
-      if (handle_output_debug_string ( ourstatus))
-	retval = current_event.dwProcessId;
+      if (handle_output_debug_string (ourstatus))
+	retval = main_thread_id;
       break;
+
     default:
       printf_unfiltered ("gdb: kernel event for pid=%ld tid=%ld\n",
 			 (DWORD) current_event.dwProcessId,
@@ -907,7 +938,10 @@
   if (!retval)
     CHECK (child_continue (continue_status, -1));
   else
-    current_thread = th ?: thread_rec (current_event.dwThreadId, TRUE);
+    {
+      current_thread = th ? : thread_rec (current_event.dwThreadId, TRUE);
+      inferior_pid = retval;
+    }
 
 out:
   return retval;
@@ -941,46 +975,70 @@
     }
 }
 
+static void
+do_initial_child_stuff (DWORD pid)
+{
+  extern int stop_after_trap;
+
+  last_sig = 0;
+  event_count = 0;
+  exception_count = 0;
+  current_event.dwProcessId = pid;
+  memset (&current_event, 0, sizeof (current_event));
+  push_target (&child_ops);
+  child_init_thread_list ();
+  child_clear_solibs ();
+  clear_proceed_status ();
+  init_wait_for_inferior ();
+
+  target_terminal_init ();
+  target_terminal_inferior ();
+
+  while (1)
+    {
+      stop_after_trap = 1;
+      wait_for_inferior ();
+      if (stop_signal != TARGET_SIGNAL_TRAP)
+	resume (0, stop_signal);
+      else
+	break;
+    }
+  stop_after_trap = 0;
+  return;
+}
+
 /* Attach to process PID, then initialize for debugging it.  */
 
 static void
-child_attach (args, from_tty)
-     char *args;
-     int from_tty;
+child_attach (char *args, int from_tty)
 {
   BOOL ok;
+  DWORD pid = strtoul (args, 0, 0);
 
   if (!args)
     error_no_arg ("process-id to attach");
 
-  current_event.dwProcessId = strtoul (args, 0, 0);
-
-  ok = DebugActiveProcess (current_event.dwProcessId);
+  ok = DebugActiveProcess (pid);
 
   if (!ok)
     error ("Can't attach to process.");
 
-  exception_count = 0;
-  event_count = 0;
-
-  child_init_thread_list ();
-  child_clear_solibs ();
-
   if (from_tty)
     {
       char *exec_file = (char *) get_exec_file (0);
 
       if (exec_file)
 	printf_unfiltered ("Attaching to program `%s', %s\n", exec_file,
-			   target_pid_to_str (current_event.dwProcessId));
+			   target_pid_to_str (pid));
       else
 	printf_unfiltered ("Attaching to %s\n",
-			   target_pid_to_str (current_event.dwProcessId));
+			   target_pid_to_str (pid));
 
       gdb_flush (gdb_stdout);
     }
 
-  push_target (&child_ops);
+  do_initial_child_stuff (pid);
+  target_terminal_ours ();
 }
 
 static void
@@ -1021,10 +1079,7 @@
    ENV is the environment vector to pass.  Errors reported with error().  */
 
 static void
-child_create_inferior (exec_file, allargs, env)
-     char *exec_file;
-     char *allargs;
-     char **env;
+child_create_inferior (char *exec_file, char *allargs, char **env)
 {
   char real_path[MAXPATHLEN];
   char *winenv;
@@ -1033,11 +1088,9 @@
   int i;
   STARTUPINFO si;
   PROCESS_INFORMATION pi;
-  struct target_waitstatus dummy;
   BOOL ret;
   DWORD flags;
   char *args;
-  extern int stop_after_trap;
 
   if (!exec_file)
     error ("No executable specified, use `target exec'.\n");
@@ -1148,39 +1201,14 @@
   if (!ret)
     error ("Error creating process %s, (error %d)\n", exec_file, GetLastError ());
 
-  exception_count = 0;
-  event_count = 0;
+  do_initial_child_stuff (pi.dwProcessId);
 
-  current_process_handle = pi.hProcess;
-  current_event.dwProcessId = pi.dwProcessId;
-  memset (&current_event, 0, sizeof (current_event));
-  inferior_pid = current_event.dwThreadId = pi.dwThreadId;
-  push_target (&child_ops);
-  child_init_thread_list ();
-  child_clear_solibs ();
-  clear_proceed_status ();
-  init_wait_for_inferior ();
-  target_terminal_init ();
-  target_terminal_inferior ();
-  last_sig = 0;
-
-  while (1)
-    {
-      stop_after_trap = 1;
-      wait_for_inferior ();
-      if (stop_signal != TARGET_SIGNAL_TRAP)
-	resume (0, stop_signal);
-      else
-	break;
-    }
-  stop_after_trap = 0;
-
-  /* child_continue (DBG_CONTINUE, -1);*/
+  /* child_continue (DBG_CONTINUE, -1); */
   proceed ((CORE_ADDR) - 1, TARGET_SIGNAL_0, 0);
 }
 
 static void
-child_mourn_inferior ()
+child_mourn_inferior (void)
 {
   (void) child_continue (DBG_CONTINUE, -1);
   unpush_target (&child_ops);
@@ -1191,7 +1219,7 @@
    ^C on the controlling terminal. */
 
 static void
-child_stop ()
+child_stop (void)
 {
   DEBUG_EVENTS (("gdb: GenerateConsoleCtrlEvent (CTRLC_EVENT, 0)\n"));
   CHECK (GenerateConsoleCtrlEvent (CTRL_C_EVENT, current_event.dwProcessId));
@@ -1248,7 +1276,7 @@
 {
   thread_info *th;
   DWORD continue_status = last_sig > 0 && last_sig < NSIG ?
-			  DBG_EXCEPTION_NOT_HANDLED : DBG_CONTINUE;
+  DBG_EXCEPTION_NOT_HANDLED : DBG_CONTINUE;
 
   last_sig = 0;
 
@@ -1280,19 +1308,19 @@
 }
 
 static void
-child_prepare_to_store ()
+child_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
 static int
-child_can_run ()
+child_can_run (void)
 {
   return 1;
 }
 
 static void
-child_close ()
+child_close (int x ATTRIBUTE_UNUSED)
 {
   DEBUG_EVENTS (("gdb: child_close, inferior_pid=%d\n", inferior_pid));
 }
@@ -1346,50 +1374,51 @@
 }
 
 void
-_initialize_inftarg ()
+_initialize_inftarg (void)
 {
   init_child_ops ();
 
   add_com ("dll-symbols", class_files, dll_symbol_command,
-           "Load dll library symbols from FILE.");
+	   "Load dll library symbols from FILE.");
 
+  auto_solib_add = 1;
   add_com_alias ("sharedlibrary", "dll-symbols", class_alias, 1);
 
   add_show_from_set (add_set_cmd ("new-console", class_support, var_boolean,
-		  (char *) &new_console,
-		  "Set creation of new console when creating child process.",
-		  &setlist),
-     &showlist);
+				  (char *) &new_console,
+		 "Set creation of new console when creating child process.",
+				  &setlist),
+		     &showlist);
 
   add_show_from_set (add_set_cmd ("new-group", class_support, var_boolean,
-		  (char *) &new_group,
-		  "Set creation of new group when creating child process.",
-		  &setlist),
-     &showlist);
+				  (char *) &new_group,
+		   "Set creation of new group when creating child process.",
+				  &setlist),
+		     &showlist);
 
   add_show_from_set (add_set_cmd ("debugexec", class_support, var_boolean,
-		  (char *) &debug_exec,
-		  "Set whether to display execution in child process.",
-		  &setlist),
-     &showlist);
+				  (char *) &debug_exec,
+		       "Set whether to display execution in child process.",
+				  &setlist),
+		     &showlist);
 
   add_show_from_set (add_set_cmd ("debugevents", class_support, var_boolean,
-		  (char *) &debug_events,
-		  "Set whether to display kernel events in child process.",
-		  &setlist),
-     &showlist);
+				  (char *) &debug_events,
+		   "Set whether to display kernel events in child process.",
+				  &setlist),
+		     &showlist);
 
   add_show_from_set (add_set_cmd ("debugmemory", class_support, var_boolean,
-		  (char *) &debug_memory,
-		  "Set whether to display memory accesses in child process.",
-		  &setlist),
-     &showlist);
+				  (char *) &debug_memory,
+		 "Set whether to display memory accesses in child process.",
+				  &setlist),
+		     &showlist);
 
   add_show_from_set (add_set_cmd ("debugexceptions", class_support, var_boolean,
-		  (char *) &debug_exceptions,
-		  "Set whether to display kernel exceptions in child process.",
-		  &setlist),
-     &showlist);
+				  (char *) &debug_exceptions,
+	       "Set whether to display kernel exceptions in child process.",
+				  &setlist),
+		     &showlist);
 
   add_info ("dll", info_dll_command, "Status of loaded DLLs.");
   add_info_alias ("sharedlibrary", "dll", 1);
@@ -1418,3 +1447,217 @@
     sprintf (buf, "thread %ld.0x%x", current_event.dwProcessId, pid);
   return buf;
 }
+
+static int
+core_dll_symbols_add (char *dll_name, DWORD base_addr)
+{
+  struct objfile *objfile;
+  char *objfile_basename;
+  const char *dll_basename;
+
+  if (!(dll_basename = strrchr (dll_name, '/')))
+    dll_basename = dll_name;
+  else
+    dll_basename++;
+
+  ALL_OBJFILES (objfile)
+  {
+    objfile_basename = strrchr (objfile->name, '/');
+
+    if (objfile_basename &&
+	strcmp (dll_basename, objfile_basename + 1) == 0)
+      {
+	printf_unfiltered ("%08lx:%s (symbols previously loaded)\n",
+			   base_addr, dll_name);
+	goto out;
+      }
+  }
+
+  register_loaded_dll (dll_name, base_addr + 0x1000);
+  solib_symbols_add (dll_name, (CORE_ADDR) base_addr + 0x1000);
+
+out:
+  return 1;
+}
+
+typedef struct
+{
+  struct target_ops *target;
+  bfd_vma addr;
+}
+map_code_section_args;
+
+static void
+map_single_dll_code_section (bfd * abfd, asection * sect, PTR obj)
+{
+  int old;
+  int update_coreops;
+  struct section_table *new_target_sect_ptr;
+
+  map_code_section_args *args = (map_code_section_args *) obj;
+  struct target_ops *target = args->target;
+  if (sect->flags & SEC_CODE)
+    {
+      update_coreops = core_ops.to_sections == target->to_sections;
+
+      if (target->to_sections)
+	{
+	  old = target->to_sections_end - target->to_sections;
+	  target->to_sections = (struct section_table *)
+	    xrealloc ((char *) target->to_sections,
+		      (sizeof (struct section_table)) * (1 + old));
+	}
+      else
+	{
+	  old = 0;
+	  target->to_sections = (struct section_table *)
+	    xmalloc ((sizeof (struct section_table)));
+	}
+      target->to_sections_end = target->to_sections + (1 + old);
+
+      /* Update the to_sections field in the core_ops structure
+         if needed.  */
+      if (update_coreops)
+	{
+	  core_ops.to_sections = target->to_sections;
+	  core_ops.to_sections_end = target->to_sections_end;
+	}
+      new_target_sect_ptr = target->to_sections + old;
+      new_target_sect_ptr->addr = args->addr + bfd_section_vma (abfd, sect);
+      new_target_sect_ptr->endaddr = args->addr + bfd_section_vma (abfd, sect) +
+	bfd_section_size (abfd, sect);;
+      new_target_sect_ptr->the_bfd_section = sect;
+      new_target_sect_ptr->bfd = abfd;
+    }
+}
+
+static int
+dll_code_sections_add (const char *dll_name, int base_addr, struct target_ops *target)
+{
+  bfd *dll_bfd;
+  map_code_section_args map_args;
+  asection *lowest_sect;
+  char *name;
+  if (dll_name == NULL || target == NULL)
+    return 0;
+  name = xstrdup (dll_name);
+  dll_bfd = bfd_openr (name, "pei-i386");
+  if (dll_bfd == NULL)
+    return 0;
+
+  if (bfd_check_format (dll_bfd, bfd_object))
+    {
+      lowest_sect = bfd_get_section_by_name (dll_bfd, ".text");
+      if (lowest_sect == NULL)
+	return 0;
+      map_args.target = target;
+      map_args.addr = base_addr - bfd_section_vma (dll_bfd, lowest_sect);
+
+      bfd_map_over_sections (dll_bfd, &map_single_dll_code_section, (PTR) (&map_args));
+    }
+
+  return 1;
+}
+
+static void
+core_section_load_dll_symbols (bfd * abfd, asection * sect, PTR obj)
+{
+  struct target_ops *target = (struct target_ops *) obj;
+
+  DWORD base_addr;
+
+  int dll_name_size;
+  char *dll_name = NULL;
+  char *buf = NULL;
+  struct win32_pstatus *pstatus;
+  char *p;
+
+  if (strncmp (sect->name, ".module", 7))
+    return;
+
+  buf = (char *) xmalloc (sect->_raw_size + 1);
+  if (!buf)
+    {
+      printf_unfiltered ("memory allocation failed for %s\n", sect->name);
+      goto out;
+    }
+  if (!bfd_get_section_contents (abfd, sect, buf, 0, sect->_raw_size))
+    goto out;
+
+  pstatus = (struct win32_pstatus *) buf;
+
+  memmove (&base_addr, &(pstatus->data.module_info.base_address), sizeof (base_addr));
+  dll_name_size = pstatus->data.module_info.module_name_size;
+  if (offsetof (struct win32_pstatus, data.module_info.module_name) + dll_name_size > sect->_raw_size)
+      goto out;
+
+  dll_name = (char *) xmalloc (dll_name_size + 1);
+  if (!dll_name)
+    {
+      printf_unfiltered ("memory allocation failed for %s\n", sect->name);
+      goto out;
+    }
+  strncpy (dll_name, pstatus->data.module_info.module_name, dll_name_size);
+
+  while ((p = strchr (dll_name, '\\')))
+    *p = '/';
+
+  if (!core_dll_symbols_add (dll_name, (DWORD) base_addr))
+    printf_unfiltered ("%s: Failed to load dll symbols.\n", dll_name);
+
+  if (!dll_code_sections_add (dll_name, (DWORD) base_addr + 0x1000, target))
+    printf_unfiltered ("%s: Failed to map dll code sections.\n", dll_name);
+
+out:
+  if (buf)
+    xfree (buf);
+  if (dll_name)
+    xfree (dll_name);
+  return;
+}
+
+void
+child_solib_add (char *filename ATTRIBUTE_UNUSED, int from_tty ATTRIBUTE_UNUSED, struct target_ops *target)
+{
+  if (core_bfd)
+    {
+      child_clear_solibs ();
+      bfd_map_over_sections (core_bfd, &core_section_load_dll_symbols, target);
+    }
+  else
+    {
+      if (solib_end && solib_end->name)
+	solib_symbols_add (solib_end->name, solib_end->load_addr);
+    }
+}
+
+static void
+fetch_elf_core_registers (char *core_reg_sect,
+			  unsigned core_reg_size,
+			  int which,
+			  CORE_ADDR reg_addr)
+{
+  int r;
+  if (core_reg_size < sizeof (CONTEXT))
+    {
+      error ("Core file register section too small (%u bytes).", core_reg_size);
+      return;
+    }
+  for (r = 0; r < NUM_REGS; r++)
+    supply_register (r, core_reg_sect + mappings[r]);
+}
+
+static struct core_fns win32_elf_core_fns =
+{
+  bfd_target_elf_flavour,
+  default_check_format,
+  default_core_sniffer,
+  fetch_elf_core_registers,
+  NULL
+};
+
+void
+_initialize_core_win32 ()
+{
+  add_core_fns (&win32_elf_core_fns);
+}
diff --git a/gdb/wince.c b/gdb/wince.c
index 91ac5cf..7ee0b60 100644
--- a/gdb/wince.c
+++ b/gdb/wince.c
@@ -54,7 +54,6 @@
 #include "gdbcmd.h"
 #include <sys/param.h>
 #include "wince-stub.h"
-#include "dcache.h"
 #include <time.h>
 
 /* The ui's event loop. */
@@ -89,8 +88,6 @@
 
 static int connection_initialized = 0;	/* True if we've initialized a RAPI session. */
 
-static DCACHE *remote_dcache;
-
 /* The directory where the stub and executable files are uploaded. */
 static const char *remote_directory = "\\gdb";
 
@@ -786,7 +783,7 @@
    to terminate.
  */
 static void
-stop_stub ()
+stop_stub (void)
 {
   if (s < 0)
     return;
@@ -1067,7 +1064,7 @@
 /* Clear out any old thread list and reintialize it to a
    pristine state. */
 static void
-child_init_thread_list ()
+child_init_thread_list (void)
 {
   thread_info *th = &thread_head;
 
@@ -1078,7 +1075,7 @@
       thread_info *here = th->next;
       th->next = here->next;
       (void) close_handle (here->h);
-      free (here);
+      xfree (here);
     }
 }
 
@@ -1102,7 +1099,7 @@
       thread_info *here = th->next;
       th->next = here->next;
       close_handle (here->h);
-      free (here);
+      xfree (here);
     }
 }
 
@@ -1515,8 +1512,7 @@
 /* Print status information about what we're accessing.  */
 
 static void
-child_files_info (ignore)
-     struct target_ops *ignore;
+child_files_info (struct target_ops *ignore)
 {
   printf_unfiltered ("\tUsing the running image of child %s.\n",
 		     target_pid_to_str (inferior_pid));
@@ -1524,9 +1520,7 @@
 
 /* ARGSUSED */
 static void
-child_open (arg, from_tty)
-     char *arg;
-     int from_tty;
+child_open (char *arg, int from_tty)
 {
   error ("Use the \"run\" command to start a child process.");
 }
@@ -1645,7 +1639,7 @@
 
 /* Initialize the connection to the remote device. */
 static void
-wince_initialize ()
+wince_initialize (void)
 {
   int tmp;
   char args[256];
@@ -1732,10 +1726,6 @@
   flags = DEBUG_PROCESS;
 
   wince_initialize ();		/* Make sure we've got a connection. */
-  if (!remote_dcache)
-    remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes);
-  else
-    dcache_flush (remote_dcache);
 
   exec_file = upload_to_device (exec_file, exec_file);
 
@@ -1784,7 +1774,7 @@
 
 /* Chile has gone bye-bye. */
 static void
-child_mourn_inferior ()
+child_mourn_inferior (void)
 {
   (void) child_continue (DBG_CONTINUE, -1);
   unpush_target (&child_ops);
@@ -1801,7 +1791,13 @@
 {
   if (len <= 0)
     return 0;
-  return dcache_xfer_memory (remote_dcache, memaddr, our, len, write);
+
+  if (write)
+    res = remote_write_bytes (memaddr, our, len);
+  else
+    res = remote_read_bytes (memaddr, our, len);
+
+  return res;
 }
 
 /* Terminate the process and wait for child to tell us it has completed. */
@@ -1845,8 +1841,6 @@
       th->context.ContextFlags = 0;
     }
 
-  dcache_flush (remote_dcache);
-
   /* Allow continuing with the same signal that interrupted us.
      Otherwise complain. */
   if (sig && sig != last_sig)
@@ -1857,19 +1851,19 @@
 }
 
 static void
-child_prepare_to_store ()
+child_prepare_to_store (void)
 {
   /* Do nothing, since we can store individual regs */
 }
 
 static int
-child_can_run ()
+child_can_run (void)
 {
   return 1;
 }
 
 static void
-child_close ()
+child_close (void)
 {
   DEBUG_EVENTS (("gdb: child_close, inferior_pid=%d\n", inferior_pid));
 }
@@ -1961,7 +1955,7 @@
 }
 
 void
-_initialize_inftarg ()
+_initialize_inftarg (void)
 {
   struct cmd_list_element *set;
   init_child_ops ();
diff --git a/gdb/wrapper.c b/gdb/wrapper.c
index 4ee8fa2..336488f 100644
--- a/gdb/wrapper.c
+++ b/gdb/wrapper.c
@@ -50,6 +50,8 @@
 
 static int wrap_value_equal (char *);
 
+static int wrap_value_assign (char *);
+
 static int wrap_value_subscript (char *);
 
 static int wrap_value_ind (char *opaque_arg);
@@ -57,11 +59,8 @@
 static int wrap_parse_and_eval_type (char *);
 
 int
-gdb_parse_exp_1 (stringptr, block, comma, expression)
-     char **stringptr;
-     struct block *block;
-     int comma;
-     struct expression **expression;
+gdb_parse_exp_1 (char **stringptr, struct block *block, int comma,
+		 struct expression **expression)
 {
   struct gdb_wrapper_arguments args;
   args.args[0].pointer = stringptr;
@@ -81,8 +80,7 @@
 }
 
 static int
-wrap_parse_exp_1 (argptr)
-     char *argptr;
+wrap_parse_exp_1 (char *argptr)
 {
   struct gdb_wrapper_arguments *args 
     = (struct gdb_wrapper_arguments *) argptr;
@@ -93,9 +91,7 @@
 }
 
 int
-gdb_evaluate_expression (exp, value)
-     struct expression *exp;
-     value_ptr *value;
+gdb_evaluate_expression (struct expression *exp, value_ptr *value)
 {
   struct gdb_wrapper_arguments args;
   args.args[0].pointer = exp;
@@ -112,8 +108,7 @@
 }
 
 static int
-wrap_evaluate_expression (a)
-     char *a;
+wrap_evaluate_expression (char *a)
 {
   struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a;
 
@@ -123,8 +118,7 @@
 }
 
 int
-gdb_value_fetch_lazy (value)
-     value_ptr value;
+gdb_value_fetch_lazy (value_ptr value)
 {
   struct gdb_wrapper_arguments args;
 
@@ -134,8 +128,7 @@
 }
 
 static int
-wrap_value_fetch_lazy (a)
-     char *a;
+wrap_value_fetch_lazy (char *a)
 {
   struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a;
 
@@ -144,10 +137,7 @@
 }
 
 int
-gdb_value_equal (val1, val2, result)
-     value_ptr val1;
-     value_ptr val2;
-     int *result;
+gdb_value_equal (value_ptr val1, value_ptr val2, int *result)
 {
   struct gdb_wrapper_arguments args;
 
@@ -166,8 +156,7 @@
 }
 
 static int
-wrap_value_equal (a)
-     char *a;
+wrap_value_equal (char *a)
 {
   struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a;
   value_ptr val1, val2;
@@ -180,10 +169,39 @@
 }
 
 int
-gdb_value_subscript (val1, val2, rval)
-     value_ptr val1;
-     value_ptr val2;
-     value_ptr * rval;
+gdb_value_assign (value_ptr val1, value_ptr val2, value_ptr *result)
+{
+  struct gdb_wrapper_arguments args;
+
+  args.args[0].pointer = val1;
+  args.args[1].pointer = val2;
+
+  if (!catch_errors ((catch_errors_ftype *) wrap_value_assign, &args,
+		     "", RETURN_MASK_ERROR))
+    {
+      /* An error occurred */
+      return 0;
+    }
+
+  *result = (value_ptr) args.result.pointer;
+  return 1;
+}
+
+static int
+wrap_value_assign (char *a)
+{
+  struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a;
+  value_ptr val1, val2;
+
+  val1 = (value_ptr) (args)->args[0].pointer;
+  val2 = (value_ptr) (args)->args[1].pointer;
+
+  (args)->result.pointer = value_assign (val1, val2);
+  return 1;
+}
+
+int
+gdb_value_subscript (value_ptr val1, value_ptr val2, value_ptr *rval)
 {
   struct gdb_wrapper_arguments args;
 
@@ -202,8 +220,7 @@
 }
 
 static int
-wrap_value_subscript (a)
-     char *a;
+wrap_value_subscript (char *a)
 {
   struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a;
   value_ptr val1, val2;
@@ -216,9 +233,7 @@
 }
 
 int
-gdb_value_ind (val, rval)
-     value_ptr val;
-     value_ptr *rval;
+gdb_value_ind (value_ptr val, value_ptr *rval)
 {
   struct gdb_wrapper_arguments args;
 
@@ -236,8 +251,7 @@
 }
 
 static int
-wrap_value_ind (opaque_arg)
-     char *opaque_arg;
+wrap_value_ind (char *opaque_arg)
 {
   struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) opaque_arg;
   value_ptr val;
diff --git a/gdb/wrapper.h b/gdb/wrapper.h
index 28261ac..85fc0b3 100644
--- a/gdb/wrapper.h
+++ b/gdb/wrapper.h
@@ -31,6 +31,8 @@
 
 extern int gdb_value_equal (value_ptr, value_ptr, int *);
 
+extern int gdb_value_assign (value_ptr, value_ptr, value_ptr *);
+
 extern int gdb_value_subscript (value_ptr, value_ptr, value_ptr *);
 
 extern int gdb_value_ind (value_ptr val, value_ptr * rval);
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 65e319a..6bcae9a 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -226,7 +226,7 @@
 
 static int read_symbol_lineno (int);
 
-static int read_symbol_nvalue (int);
+static CORE_ADDR read_symbol_nvalue (int);
 
 static struct symbol *process_xcoff_symbol (struct coff_symbol *,
 					    struct objfile *);
@@ -262,10 +262,7 @@
 static void find_targ_sec (bfd *, asection *, void *);
 
 static void
-find_targ_sec (abfd, sect, obj)
-     bfd *abfd;
-     asection *sect;
-     PTR obj;
+find_targ_sec (bfd *abfd, asection *sect, PTR obj)
 {
   struct find_targ_sec_arg *args = (struct find_targ_sec_arg *) obj;
   struct objfile *objfile = args->objfile;
@@ -277,16 +274,14 @@
       else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
 	*args->resultp = SECT_OFF_DATA (objfile);
       else
-	*args->resultp = SECT_OFF_BSS (objfile);
+	*args->resultp = sect->index;
       *args->bfd_sect = sect;
     }
 }
 
 /* Return the section number (SECT_OFF_*) that CS points to.  */
 static int
-secnum_to_section (secnum, objfile)
-     int secnum;
-     struct objfile *objfile;
+secnum_to_section (int secnum, struct objfile *objfile)
 {
   int off = SECT_OFF_TEXT (objfile);
   asection *sect = NULL;
@@ -301,9 +296,7 @@
 
 /* Return the BFD section that CS points to.  */
 static asection *
-secnum_to_bfd_section (secnum, objfile)
-     int secnum;
-     struct objfile *objfile;
+secnum_to_bfd_section (int secnum, struct objfile *objfile)
 {
   int off = SECT_OFF_TEXT (objfile);
   asection *sect = NULL;
@@ -311,6 +304,7 @@
   args.targ_index = secnum;
   args.resultp = &off;
   args.bfd_sect = &sect;
+  args.objfile = objfile;
   bfd_map_over_sections (objfile->obfd, find_targ_sec, &args);
   return sect;
 }
@@ -320,9 +314,7 @@
 #if 0
 
 static void
-add_stab_to_list (stabname, stabvector)
-     char *stabname;
-     struct pending_stabs **stabvector;
+add_stab_to_list (char *stabname, struct pending_stabs **stabvector)
 {
   if (*stabvector == NULL)
     {
@@ -402,9 +394,7 @@
 /* compare line table entry addresses. */
 
 static int
-compare_lte (lte1p, lte2p)
-     const void *lte1p;
-     const void *lte2p;
+compare_lte (const void *lte1p, const void *lte2p)
 {
   struct linetable_entry *lte1 = (struct linetable_entry *) lte1p;
   struct linetable_entry *lte2 = (struct linetable_entry *) lte2p;
@@ -418,8 +408,7 @@
    sort_linevec = 1 to end_symtab.  */
 
 static struct linetable *
-arrange_linetable (oldLineTb)
-     struct linetable *oldLineTb;	/* old linetable */
+arrange_linetable (struct linetable *oldLineTb)
 {
   int ii, jj, newline,		/* new line count */
     function_count;		/* # of functions */
@@ -454,7 +443,7 @@
 
   if (function_count == 0)
     {
-      free (fentry);
+      xfree (fentry);
       return oldLineTb;
     }
   else if (function_count > 1)
@@ -484,7 +473,7 @@
 	   ++jj, ++newline)
 	newLineTb->item[newline] = oldLineTb->item[jj];
     }
-  free (fentry);
+  xfree (fentry);
   newLineTb->nitems = oldLineTb->nitems - function_count;
   return newLineTb;
 }
@@ -517,8 +506,7 @@
 static void allocate_include_entry (void);
 
 static void
-record_include_begin (cs)
-     struct coff_symbol *cs;
+record_include_begin (struct coff_symbol *cs)
 {
   if (inclDepth)
     {
@@ -541,8 +529,7 @@
 }
 
 static void
-record_include_end (cs)
-     struct coff_symbol *cs;
+record_include_end (struct coff_symbol *cs)
 {
   InclTable *pTbl;
 
@@ -563,7 +550,7 @@
 }
 
 static void
-allocate_include_entry ()
+allocate_include_entry (void)
 {
   if (inclTable == NULL)
     {
@@ -592,8 +579,7 @@
    at times) process its lines and create appropriate line vectors. */
 
 static void
-process_linenos (start, end)
-     CORE_ADDR start, end;
+process_linenos (CORE_ADDR start, CORE_ADDR end)
 {
   int offset, ii;
   file_ptr max_offset =
@@ -628,7 +614,11 @@
   else
     {
       /* There was source with line numbers in include files.  */
+
+      int linesz =
+	coff_data (this_symtab_psymtab->objfile->obfd)->local_linesz;
       main_source_baseline = 0;
+
       for (ii = 0; ii < inclIndx; ++ii)
 	{
 	  struct subfile *tmpSubfile;
@@ -637,7 +627,7 @@
 	  if (offset < inclTable[ii].begin)
 	    {
 	      enter_line_range
-		(&main_subfile, offset, inclTable[ii].begin - LINESZ,
+		(&main_subfile, offset, inclTable[ii].begin - linesz,
 		 start, 0, &main_source_baseline);
 	    }
 
@@ -654,12 +644,12 @@
 			    inclTable[ii].end, start, 0, firstLine);
 
 	  if (offset <= inclTable[ii].end)
-	    offset = inclTable[ii].end + LINESZ;
+	    offset = inclTable[ii].end + linesz;
 	}
 
       /* All the include files' line have been processed at this point.  Now,
          enter remaining lines of the main file, if any left.  */
-      if (offset < max_offset + 1 - LINESZ)
+      if (offset < max_offset + 1 - linesz)
 	{
 	  enter_line_range (&main_subfile, offset, 0, start, end,
 			    &main_source_baseline);
@@ -685,7 +675,7 @@
 	}
       else
 	{
-	  free (lv);
+	  xfree (lv);
 	  current_subfile->line_vector = lineTb;
 	}
 
@@ -735,7 +725,7 @@
 	    if (fakename == NULL)
 	      fakename = " ?";
 	    start_subfile (fakename, (char *) 0);
-	    free (current_subfile->name);
+	    xfree (current_subfile->name);
 	  }
 	  current_subfile->name = xstrdup (inclTable[ii].name);
 #endif
@@ -750,7 +740,7 @@
 	    }
 	  else
 	    {
-	      free (lv);
+	      xfree (lv);
 	      current_subfile->line_vector = lineTb;
 	    }
 
@@ -770,7 +760,7 @@
 }
 
 void
-aix_process_linenos ()
+aix_process_linenos (void)
 {
   /* process line numbers and enter them into line vector */
   process_linenos (last_source_start_addr, cur_src_end_addr);
@@ -786,19 +776,17 @@
    attention to.  */
 
 static void
-enter_line_range (subfile, beginoffset, endoffset, startaddr, endaddr,
-		  firstLine)
-     struct subfile *subfile;
-     unsigned beginoffset, endoffset;	/* offsets to line table */
-     CORE_ADDR startaddr, endaddr;
-     unsigned *firstLine;
+enter_line_range (struct subfile *subfile, unsigned beginoffset, unsigned endoffset,	/* offsets to line table */
+		  CORE_ADDR startaddr,	/* offsets to line table */
+		  CORE_ADDR endaddr, unsigned *firstLine)
 {
   unsigned int curoffset;
   CORE_ADDR addr;
-  struct external_lineno ext_lnno;
+  void *ext_lnno;
   struct internal_lineno int_lnno;
   unsigned int limit_offset;
   bfd *abfd;
+  int linesz;
 
   if (endoffset == 0 && startaddr == 0 && endaddr == 0)
     return;
@@ -820,13 +808,16 @@
     }
   else
     limit_offset -= 1;
+
   abfd = this_symtab_psymtab->objfile->obfd;
+  linesz = coff_data (abfd)->local_linesz;
+  ext_lnno = alloca (linesz);
 
   while (curoffset <= limit_offset)
     {
       bfd_seek (abfd, curoffset, SEEK_SET);
-      bfd_read (&ext_lnno, sizeof (struct external_lineno), 1, abfd);
-      bfd_coff_swap_lineno_in (abfd, &ext_lnno, &int_lnno);
+      bfd_read (ext_lnno, linesz, 1, abfd);
+      bfd_coff_swap_lineno_in (abfd, ext_lnno, &int_lnno);
 
       /* Find the address this line represents.  */
       addr = (int_lnno.l_lnno
@@ -846,7 +837,7 @@
 	}
       else
 	record_line (subfile, *firstLine + int_lnno.l_lnno, addr);
-      curoffset += LINESZ;
+      curoffset += linesz;
     }
 }
 
@@ -903,8 +894,7 @@
    continuations.  */
 
 static char *
-xcoff_next_symbol_text (objfile)
-     struct objfile *objfile;
+xcoff_next_symbol_text (struct objfile *objfile)
 {
   struct internal_syment symbol;
   static struct complaint msg =
@@ -945,8 +935,7 @@
 /* Read symbols for a given partial symbol table.  */
 
 static void
-read_xcoff_symtab (pst)
-     struct partial_symtab *pst;
+read_xcoff_symtab (struct partial_symtab *pst)
 {
   struct objfile *objfile = pst->objfile;
   bfd *abfd = objfile->obfd;
@@ -954,6 +943,7 @@
   char *strtbl = ((struct coff_symfile_info *) objfile->sym_private)->strtbl;
   char *debugsec =
   ((struct coff_symfile_info *) objfile->sym_private)->debugsec;
+  char *debugfmt = xcoff_data (abfd)->xcoff64 ? "XCOFF64" : "XCOFF";
 
   struct internal_syment symbol[1];
   union internal_auxent main_aux;
@@ -991,7 +981,7 @@
 
   start_stabs ();
   start_symtab (filestring, (char *) NULL, file_start_addr);
-  record_debugformat ("XCOFF");
+  record_debugformat (debugfmt);
   symnum = ((struct symloc *) pst->read_symtab_private)->first_symnum;
   max_symnum =
     symnum + ((struct symloc *) pst->read_symtab_private)->numsyms;
@@ -1055,7 +1045,7 @@
 	cs->c_secnum = symbol->n_scnum;
 	cs->c_type = (unsigned) symbol->n_type;
 
-	raw_symbol += coff_data (abfd)->local_symesz;
+	raw_symbol += local_symesz;
 	++symnum;
 
 	/* Save addr of first aux entry.  */
@@ -1085,7 +1075,7 @@
 
 	  start_stabs ();
 	  start_symtab ("_globals_", (char *) NULL, (CORE_ADDR) 0);
-	  record_debugformat ("XCOFF");
+	  record_debugformat (debugfmt);
 	  cur_src_end_addr = first_object_file_end;
 	  /* done with all files, everything from here on is globals */
 	}
@@ -1150,7 +1140,7 @@
 			  /* Give all csects for this source file the same
 			     name.  */
 			  start_symtab (filestring, NULL, (CORE_ADDR) 0);
-			  record_debugformat ("XCOFF");
+			  record_debugformat (debugfmt);
 			}
 
 		      /* If this is the very first csect seen,
@@ -1279,7 +1269,7 @@
 
 	  start_stabs ();
 	  start_symtab (filestring, (char *) NULL, (CORE_ADDR) 0);
-	  record_debugformat ("XCOFF");
+	  record_debugformat (debugfmt);
 	  last_csect_name = 0;
 
 	  /* reset file start and end addresses. A compilation unit with no text
@@ -1478,9 +1468,7 @@
 /* process one xcoff symbol. */
 
 static struct symbol *
-process_xcoff_symbol (cs, objfile)
-     register struct coff_symbol *cs;
-     struct objfile *objfile;
+process_xcoff_symbol (register struct coff_symbol *cs, struct objfile *objfile)
 {
   struct symbol onesymbol;
   register struct symbol *sym = &onesymbol;
@@ -1510,7 +1498,7 @@
   memset (sym, '\0', sizeof (struct symbol));
 
   /* default assumptions */
-  SYMBOL_VALUE (sym) = cs->c_value + off;
+  SYMBOL_VALUE_ADDRESS (sym) = cs->c_value + off;
   SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
   SYMBOL_SECTION (sym) = secnum_to_section (cs->c_secnum, objfile);
 
@@ -1603,7 +1591,7 @@
 			       cs->c_name, 0, 0, objfile);
 	  if (sym != NULL)
 	    {
-	      SYMBOL_VALUE (sym) += static_block_base;
+	      SYMBOL_VALUE_ADDRESS (sym) += static_block_base;
 	      SYMBOL_SECTION (sym) = static_block_section;
 	    }
 	  return sym;
@@ -1617,9 +1605,7 @@
    Result is in static storage and is only good for temporary use.  */
 
 static char *
-coff_getfilename (aux_entry, objfile)
-     union internal_auxent *aux_entry;
-     struct objfile *objfile;
+coff_getfilename (union internal_auxent *aux_entry, struct objfile *objfile)
 {
   static char buffer[BUFSIZ];
 
@@ -1637,9 +1623,7 @@
 
 /* Set *SYMBOL to symbol number symno in symtbl.  */
 static void
-read_symbol (symbol, symno)
-     struct internal_syment *symbol;
-     int symno;
+read_symbol (struct internal_syment *symbol, int symno)
 {
   int nsyms =
   ((struct coff_symfile_info *) this_symtab_psymtab->objfile->sym_private)
@@ -1663,9 +1647,8 @@
 
 /* Get value corresponding to symbol number symno in symtbl.  */
 
-static int
-read_symbol_nvalue (symno)
-     int symno;
+static CORE_ADDR
+read_symbol_nvalue (int symno)
 {
   struct internal_syment symbol[1];
 
@@ -1678,15 +1661,17 @@
    symno is the symbol pointed to by the linetable.  */
 
 static int
-read_symbol_lineno (symno)
-     int symno;
+read_symbol_lineno (int symno)
 {
-  int nsyms =
-  ((struct coff_symfile_info *) this_symtab_psymtab->objfile->sym_private)
-  ->symtbl_num_syms;
-  char *stbl =
-  ((struct coff_symfile_info *) this_symtab_psymtab->objfile->sym_private)
-  ->symtbl;
+  struct objfile *objfile = this_symtab_psymtab->objfile;
+  boolean xcoff64 = xcoff_data (objfile->obfd)->xcoff64;
+
+  struct coff_symfile_info *info =
+    (struct coff_symfile_info *)objfile->sym_private;
+  int nsyms = info->symtbl_num_syms;
+  char *stbl = info->symtbl;
+  char *strtbl = info->strtbl;
+
   struct internal_syment symbol[1];
   union internal_auxent main_aux[1];
 
@@ -1716,8 +1701,12 @@
     {
       bfd_coff_swap_sym_in (symfile_bfd,
 			    stbl + (symno * local_symesz), symbol);
-      if (symbol->n_sclass == C_FCN && STREQ (symbol->n_name, ".bf"))
-	goto gotit;
+      if (symbol->n_sclass == C_FCN)
+	{
+	  char *name = xcoff64 ? strtbl + symbol->n_offset : symbol->n_name;
+	  if (STREQ (name, ".bf"))
+	    goto gotit;
+	}
       symno += symbol->n_numaux + 1;
     }
 
@@ -1727,8 +1716,7 @@
 gotit:
   /* take aux entry and return its lineno */
   symno++;
-  bfd_coff_swap_aux_in (this_symtab_psymtab->objfile->obfd,
-			stbl + symno * local_symesz,
+  bfd_coff_swap_aux_in (objfile->obfd, stbl + symno * local_symesz,
 			symbol->n_type, symbol->n_sclass,
 			0, symbol->n_numaux, main_aux);
 
@@ -1742,10 +1730,7 @@
  * mainline code can read the whole thing for efficiency.
  */
 static void
-find_linenos (abfd, asect, vpinfo)
-     bfd *abfd;
-     sec_ptr asect;
-     PTR vpinfo;
+find_linenos (bfd *abfd, sec_ptr asect, PTR vpinfo)
 {
   struct coff_symfile_info *info;
   int size, count;
@@ -1771,8 +1756,7 @@
 static void xcoff_psymtab_to_symtab_1 (struct partial_symtab *);
 
 static void
-xcoff_psymtab_to_symtab_1 (pst)
-     struct partial_symtab *pst;
+xcoff_psymtab_to_symtab_1 (struct partial_symtab *pst)
 {
   struct cleanup *old_chain;
   int i;
@@ -1828,8 +1812,7 @@
    Be verbose about it if the user wants that.  */
 
 static void
-xcoff_psymtab_to_symtab (pst)
-     struct partial_symtab *pst;
+xcoff_psymtab_to_symtab (struct partial_symtab *pst)
 {
   bfd *sym_bfd;
 
@@ -1872,8 +1855,7 @@
 }
 
 static void
-xcoff_new_init (objfile)
-     struct objfile *objfile;
+xcoff_new_init (struct objfile *objfile)
 {
   stabsread_new_init ();
   buildsym_new_init ();
@@ -1886,8 +1868,7 @@
    uses BFD's determination to vector to us.  */
 
 static void
-xcoff_symfile_init (objfile)
-     struct objfile *objfile;
+xcoff_symfile_init (struct objfile *objfile)
 {
   /* Allocate struct to keep track of the symfile */
   objfile->sym_private = xmmalloc (objfile->md,
@@ -1907,8 +1888,7 @@
    objfile struct from the global list of known objfiles. */
 
 static void
-xcoff_symfile_finish (objfile)
-     struct objfile *objfile;
+xcoff_symfile_finish (struct objfile *objfile)
 {
   if (objfile->sym_private != NULL)
     {
@@ -1918,7 +1898,7 @@
   /* Start with a fresh include table for the next objfile.  */
   if (inclTable)
     {
-      free (inclTable);
+      xfree (inclTable);
       inclTable = NULL;
     }
   inclIndx = inclLength = inclDepth = 0;
@@ -1926,10 +1906,7 @@
 
 
 static void
-init_stringtab (abfd, offset, objfile)
-     bfd *abfd;
-     file_ptr offset;
-     struct objfile *objfile;
+init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile)
 {
   long length;
   int val;
@@ -1992,13 +1969,9 @@
    (normal). */
 
 static struct partial_symtab *
-xcoff_start_psymtab (objfile, filename, first_symnum, global_syms,
-		     static_syms)
-     struct objfile *objfile;
-     char *filename;
-     int first_symnum;
-     struct partial_symbol **global_syms;
-     struct partial_symbol **static_syms;
+xcoff_start_psymtab (struct objfile *objfile, char *filename, int first_symnum,
+		     struct partial_symbol **global_syms,
+		     struct partial_symbol **static_syms)
 {
   struct partial_symtab *result =
   start_psymtab_common (objfile, objfile->section_offsets,
@@ -2031,15 +2004,10 @@
    are the information for includes and dependencies.  */
 
 static struct partial_symtab *
-xcoff_end_psymtab (pst, include_list, num_includes, capping_symbol_number,
-		   dependency_list, number_dependencies, textlow_not_set)
-     struct partial_symtab *pst;
-     char **include_list;
-     int num_includes;
-     int capping_symbol_number;
-     struct partial_symtab **dependency_list;
-     int number_dependencies;
-     int textlow_not_set;
+xcoff_end_psymtab (struct partial_symtab *pst, char **include_list,
+		   int num_includes, int capping_symbol_number,
+		   struct partial_symtab **dependency_list,
+		   int number_dependencies, int textlow_not_set)
 {
   int i;
   struct objfile *objfile = pst->objfile;
@@ -2134,13 +2102,9 @@
    the symbol and its auxents.  */
 
 static void
-swap_sym (symbol, aux, name, raw, symnump, objfile)
-     struct internal_syment *symbol;
-     union internal_auxent *aux;
-     char **name;
-     char **raw;
-     unsigned int *symnump;
-     struct objfile *objfile;
+swap_sym (struct internal_syment *symbol, union internal_auxent *aux,
+	  char **name, char **raw, unsigned int *symnump,
+	  struct objfile *objfile)
 {
   bfd_coff_swap_sym_in (objfile->obfd, *raw, symbol);
   if (symbol->n_zeroes)
@@ -2185,8 +2149,7 @@
 }
 
 static void
-scan_xcoff_symtab (objfile)
-     struct objfile *objfile;
+scan_xcoff_symtab (struct objfile *objfile)
 {
   CORE_ADDR toc_offset = 0;	/* toc offset value in data section. */
   char *filestring = NULL;
@@ -2242,7 +2205,7 @@
   ssymnum = 0;
   while (ssymnum < nsyms)
     {
-      int sclass = ((struct external_syment *) sraw_symbol)->e_sclass[0] & 0xff;
+      int sclass;
       /* This is the type we pass to partial-stab.h.  A less kludgy solution
          would be to break out partial-stab.h into its various parts--shuffle
          off the DBXREAD_ONLY stuff to dbxread.c, and make separate
@@ -2251,6 +2214,9 @@
 
       QUIT;
 
+      bfd_coff_swap_sym_in (abfd, sraw_symbol, &symbol);
+      sclass = symbol.n_sclass;
+
       switch (sclass)
 	{
 	case C_EXT:
@@ -2558,10 +2524,9 @@
 	  {
 	    /* We probably could save a few instructions by assuming that
 	       C_LSYM, C_PSYM, etc., never have auxents.  */
-	    int naux1 =
-	    ((struct external_syment *) sraw_symbol)->e_numaux[0] + 1;
+	    int naux1 = symbol.n_numaux + 1;
 	    ssymnum += naux1;
-	    sraw_symbol += sizeof (struct external_syment) * naux1;
+	    sraw_symbol += bfd_coff_symesz (abfd) * naux1;
 	  }
 	  break;
 
@@ -2580,7 +2545,7 @@
 	case C_DECL:
 	case C_STSYM:
 	  stype = N_LSYM;
-	pstab:;
+	pstab:
 	  swap_sym (&symbol, &main_aux[0], &namestring, &sraw_symbol,
 		    &ssymnum, objfile);
 #define CUR_SYMBOL_TYPE stype
@@ -2616,8 +2581,7 @@
 /* Return the toc offset value for a given objfile.  */
 
 CORE_ADDR
-get_toc_offset (objfile)
-     struct objfile *objfile;
+get_toc_offset (struct objfile *objfile)
 {
   if (objfile)
     return ((struct coff_symfile_info *) objfile->sym_private)->toc_offset;
@@ -2635,9 +2599,7 @@
    table (as opposed to a shared lib or dynamically loaded file).  */
 
 static void
-xcoff_initial_scan (objfile, mainline)
-     struct objfile *objfile;
-     int mainline;		/* FIXME comments above */
+xcoff_initial_scan (struct objfile *objfile, int mainline)
 {
   bfd *abfd;
   int val;
@@ -2742,9 +2704,7 @@
 }
 
 static void
-xcoff_symfile_offsets (objfile, addrs)
-     struct objfile *objfile;
-     struct section_addr_info *addrs;
+xcoff_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs)
 {
   asection *sect = NULL;
   int i;
@@ -2781,7 +2741,7 @@
 	 sensibly), so just ignore the addr parameter and use 0.
 	 rs6000-nat.c will set the correct section offsets via
 	 objfile_relocate.  */
-	ANOFFSET (objfile->section_offsets, i) = 0;
+	(objfile->section_offsets)->offsets[i] = 0;
     }
 }
 
@@ -2790,8 +2750,7 @@
 static struct sym_fns xcoff_sym_fns =
 {
 
-  /* Because the bfd uses coff_flavour, we need to specially kludge
-     the flavour.  It is possible that coff and xcoff should be merged as
+  /* It is possible that coff and xcoff should be merged as
      they do have fundamental similarities (for example, the extra storage
      classes used for stabs could presumably be recognized in any COFF file).
      However, in addition to obvious things like all the csect hair, there are
@@ -2800,7 +2759,7 @@
      xcoffread.c reads all the symbols and does in fact randomly access them
      (in C_BSTAT and line number processing).  */
 
-  (enum bfd_flavour) -1,
+  bfd_target_xcoff_flavour,
 
   xcoff_new_init,		/* sym_new_init: init anything gbl to entire symtab */
   xcoff_symfile_init,		/* sym_init: read initial info, setup for sym_read() */
@@ -2811,7 +2770,7 @@
 };
 
 void
-_initialize_xcoffread ()
+_initialize_xcoffread (void)
 {
   add_symtab_fns (&xcoff_sym_fns);
 
diff --git a/gdb/xcoffsolib.c b/gdb/xcoffsolib.c
index 3332268..3876a42 100644
--- a/gdb/xcoffsolib.c
+++ b/gdb/xcoffsolib.c
@@ -19,132 +19,21 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#if 0
-#include <sys/types.h>
-#include <sys/ldr.h>
-#endif
-
 #include "defs.h"
 #include "bfd.h"
 #include "xcoffsolib.h"
 #include "inferior.h"
-#include "command.h"
+#include "gdbcmd.h"
+#include "symfile.h"
+#include "frame.h"
+#include "gdb_regex.h"
 
-/* Hook to relocate symbols at runtime.  If gdb is build natively, this
-   hook is initialized in by rs6000-nat.c.  If not, it is currently left
-   NULL and never called. */
-
-void (*xcoff_relocate_symtab_hook) (unsigned int) = NULL;
-
-#ifdef SOLIB_SYMBOLS_MANUAL
-
-extern struct symtab *current_source_symtab;
-extern int current_source_line;
-
-/* The real work of adding a shared library file to the symtab and
-   the section list.  */
-
-void
-solib_add (arg_string, from_tty, target)
-     char *arg_string;
-     int from_tty;
-     struct target_ops *target;
-{
-  char *val;
-  struct vmap *vp = vmap;
-  struct objfile *obj;
-  struct symtab *saved_symtab;
-  int saved_line;
-
-  int loaded = 0;		/* true if any shared obj loaded */
-  int matched = 0;		/* true if any shared obj matched */
-
-  if (arg_string == 0)
-    re_comp (".");
-  else if (val = (char *) re_comp (arg_string))
-    {
-      error ("Invalid regexp: %s", val);
-    }
-  if (!vp || !vp->nxt)
-    return;
-
-  /* save current symbol table and line number, in case they get changed
-     in symbol loading process. */
-
-  saved_symtab = current_source_symtab;
-  saved_line = current_source_line;
-
-  /* skip over the first vmap, it is the main program, always loaded. */
-  vp = vp->nxt;
-
-  for (; vp; vp = vp->nxt)
-    {
-
-      if (re_exec (vp->name) || (*vp->member && re_exec (vp->member)))
-	{
-
-	  matched = 1;
-
-	  /* if already loaded, continue with the next one. */
-	  if (vp->loaded)
-	    {
-
-	      printf_unfiltered ("%s%s%s%s: already loaded.\n",
-				 *vp->member ? "(" : "",
-				 vp->member,
-				 *vp->member ? ") " : "",
-				 vp->name);
-	      continue;
-	    }
-
-	  printf_unfiltered ("Loading  %s%s%s%s...",
-			     *vp->member ? "(" : "",
-			     vp->member,
-			     *vp->member ? ") " : "",
-			     vp->name);
-	  gdb_flush (gdb_stdout);
-
-	  /* This is gross and doesn't work.  If this code is re-enabled,
-	     just stick a objfile member into the struct vmap; that's the
-	     way solib.c (for SunOS/SVR4) does it.  */
-	  obj = lookup_objfile_bfd (vp->bfd);
-	  if (!obj)
-	    {
-	      warning ("\nObj structure for the shared object not found. Loading failed.");
-	      continue;
-	    }
-
-	  syms_from_objfile (obj, NULL, 0, 0);
-	  new_symfile_objfile (obj, 0, 0);
-	  vmap_symtab (vp);
-	  printf_unfiltered ("Done.\n");
-	  loaded = vp->loaded = 1;
-	}
-    }
-  /* if any shared object is loaded, then misc_func_vector needs sorting. */
-  if (loaded)
-    {
-#if 0
-      sort_misc_function_vector ();
-#endif
-      current_source_symtab = saved_symtab;
-      current_source_line = saved_line;
-
-      /* Getting new symbols might change our opinion about what is frameless.
-         Is this correct?? FIXME. */
-/*    reinit_frame_cache(); */
-    }
-  else if (!matched)
-    printf_unfiltered ("No matching shared object found.\n");
-}
-#endif /* SOLIB_SYMBOLS_MANUAL */
 
 /* Return the module name of a given text address. Note that returned buffer
    is not persistent. */
 
 char *
-pc_load_segment_name (addr)
-     CORE_ADDR addr;
+pc_load_segment_name (CORE_ADDR addr)
 {
   static char buffer[BUFSIZ];
   struct vmap *vp = vmap;
@@ -166,17 +55,16 @@
 }
 
 static void solib_info (char *, int);
+static void sharedlibrary_command (char *pattern, int from_tty);
 
 static void
-solib_info (args, from_tty)
-     char *args;
-     int from_tty;
+solib_info (char *args, int from_tty)
 {
   struct vmap *vp = vmap;
 
   /* Check for new shared libraries loaded with load ().  */
-  if (xcoff_relocate_symtab_hook != NULL)
-    (*xcoff_relocate_symtab_hook) (inferior_pid);
+  if (inferior_pid)
+    xcoff_relocate_symtab (inferior_pid);
 
   if (vp == NULL || vp->nxt == NULL)
     {
@@ -203,27 +91,84 @@
     }
 }
 
-void
-sharedlibrary_command (args, from_tty)
-     char *args;
-     int from_tty;
+static void
+sharedlibrary_command (char *pattern, int from_tty)
 {
   dont_repeat ();
 
   /* Check for new shared libraries loaded with load ().  */
-  if (xcoff_relocate_symtab_hook != NULL)
-    (*xcoff_relocate_symtab_hook) (inferior_pid);
+  if (inferior_pid)
+    xcoff_relocate_symtab (inferior_pid);
 
-#ifdef SOLIB_SYMBOLS_MANUAL
-  solib_add (args, from_tty, (struct target_ops *) 0);
-#endif /* SOLIB_SYMBOLS_MANUAL */
+  if (pattern)
+    {
+      char *re_err = re_comp (pattern);
+
+      if (re_err)
+	error ("Invalid regexp: %s", re_err);
+    }
+
+  /* Walk the list of currently loaded shared libraries, and read
+     symbols for any that match the pattern --- or any whose symbols
+     aren't already loaded, if no pattern was given.  */
+  {
+    int any_matches = 0;
+    int loaded_any_symbols = 0;
+    struct vmap *vp = vmap;
+
+    if (!vp)
+      return;
+
+    /* skip over the first vmap, it is the main program, always loaded. */
+    for (vp = vp->nxt; vp; vp = vp->nxt)
+      if (! pattern
+	    || re_exec (vp->name)
+	    || (*vp->member && re_exec (vp->member)))
+	{
+	  any_matches = 1;
+
+	  if (vp->loaded)
+	    {
+	      if (from_tty)
+		printf_unfiltered ("Symbols already loaded for %s\n",
+				   vp->name);
+	    }
+	  else
+	    {
+	      if (vmap_add_symbols (vp))
+		loaded_any_symbols = 1;
+	    }
+	}
+
+    if (from_tty && pattern && ! any_matches)
+      printf_unfiltered
+	("No loaded shared libraries match the pattern `%s'.\n", pattern);
+
+    if (loaded_any_symbols)
+      {
+	/* Getting new symbols may change our opinion about what is
+	   frameless.  */
+	reinit_frame_cache ();
+      }
+  }
 }
 
 void
-_initialize_solib ()
+_initialize_solib (void)
 {
   add_com ("sharedlibrary", class_files, sharedlibrary_command,
 	   "Load shared object library symbols for files matching REGEXP.");
   add_info ("sharedlibrary", solib_info,
 	    "Status of loaded shared object libraries");
+
+  add_show_from_set
+    (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
+		  (char *) &auto_solib_add,
+		  "Set autoloading of shared library symbols.\n\
+If nonzero, symbols from all shared object libraries will be loaded\n\
+automatically when the inferior begins execution or when the dynamic linker\n\
+informs gdb that a new library has been loaded.  Otherwise, symbols\n\
+must be loaded manually, using `sharedlibrary'.",
+		  &setlist),
+     &showlist);
 }
diff --git a/gdb/xcoffsolib.h b/gdb/xcoffsolib.h
index fbd3d5b..b8af8d4 100644
--- a/gdb/xcoffsolib.h
+++ b/gdb/xcoffsolib.h
@@ -56,6 +56,5 @@
 
 extern struct vmap *vmap;
 
-/* Hook for symbol table relocation at runtime. */
-
-extern void (*xcoff_relocate_symtab_hook) (unsigned int);
+/* Add symbols for a vmap.  */
+extern int vmap_add_symbols (struct vmap *vp);
diff --git a/gdb/xmodem.c b/gdb/xmodem.c
index 8257ea8..ad694a5 100644
--- a/gdb/xmodem.c
+++ b/gdb/xmodem.c
@@ -36,9 +36,7 @@
 static int crcflag;		/* Sez we are using CRC's instead of cksums */
 
 static int
-readchar (desc, timeout)
-     serial_t desc;
-     int timeout;
+readchar (serial_t desc, int timeout)
 {
   int c;
 
@@ -63,7 +61,7 @@
 /* Call this to init the fast CRC-16 calculation table.  */
 
 static void
-crcinit ()
+crcinit (void)
 {
   static int crctab_inited = 0;
   int val;
@@ -97,9 +95,7 @@
 /* Calculate a CRC-16 for the LEN byte message pointed at by P.  */
 
 static unsigned short
-docrc (p, len)
-     unsigned char *p;
-     int len;
+docrc (unsigned char *p, int len)
 {
   unsigned short crc = 0;
 
@@ -113,8 +109,7 @@
    send NAK or CRC request.  */
 
 int
-xmodem_init_xfer (desc)
-     serial_t desc;
+xmodem_init_xfer (serial_t desc)
 {
   int c;
   int i;
@@ -165,11 +160,7 @@
  */
 
 void
-xmodem_send_packet (desc, packet, len, hashmark)
-     serial_t desc;
-     unsigned char *packet;
-     int len;
-     int hashmark;
+xmodem_send_packet (serial_t desc, unsigned char *packet, int len, int hashmark)
 {
   int i;
   int retries;
@@ -255,8 +246,7 @@
 /* Finish off the transfer.  Send out the EOT, and wait for an ACK.  */
 
 void
-xmodem_finish_xfer (desc)
-     serial_t desc;
+xmodem_finish_xfer (serial_t desc)
 {
   int retries;
 
diff --git a/gdb/z8k-tdep.c b/gdb/z8k-tdep.c
index 67982c0..d70c34d 100644
--- a/gdb/z8k-tdep.c
+++ b/gdb/z8k-tdep.c
@@ -43,8 +43,7 @@
    just use the register SRP_REGNUM itself.  */
 
 CORE_ADDR
-z8k_frame_saved_pc (frame)
-     struct frame_info *frame;
+z8k_frame_saved_pc (struct frame_info *frame)
 {
   return read_memory_pointer (frame->frame + (BIG ? 4 : 2));
 }
@@ -62,9 +61,7 @@
    return the pc pointing to the first push */
 
 static CORE_ADDR
-skip_adjust (pc, size)
-     CORE_ADDR pc;
-     int *size;
+skip_adjust (CORE_ADDR pc, int *size)
 {
   *size = 0;
 
@@ -87,10 +84,7 @@
 
 static CORE_ADDR examine_frame (CORE_ADDR, CORE_ADDR * regs, CORE_ADDR);
 static CORE_ADDR
-examine_frame (pc, regs, sp)
-     CORE_ADDR pc;
-     CORE_ADDR *regs;
-     CORE_ADDR sp;
+examine_frame (CORE_ADDR pc, CORE_ADDR *regs, CORE_ADDR sp)
 {
   int w = read_memory_short (pc);
   int offset = 0;
@@ -141,8 +135,7 @@
 }
 
 CORE_ADDR
-z8k_skip_prologue (start_pc)
-     CORE_ADDR start_pc;
+z8k_skip_prologue (CORE_ADDR start_pc)
 {
   CORE_ADDR dummy[NUM_REGS];
 
@@ -150,8 +143,7 @@
 }
 
 CORE_ADDR
-z8k_addr_bits_remove (addr)
-     CORE_ADDR addr;
+z8k_addr_bits_remove (CORE_ADDR addr)
 {
   return (addr & PTR_MASK);
 }
@@ -163,8 +155,7 @@
 }
 
 CORE_ADDR
-z8k_frame_chain (thisframe)
-     struct frame_info *thisframe;
+z8k_frame_chain (struct frame_info *thisframe)
 {
   if (thisframe->prev == 0)
     {
@@ -178,7 +169,7 @@
 }
 
 void
-init_frame_pc ()
+init_frame_pc (void)
 {
   abort ();
 }
@@ -190,8 +181,7 @@
    the address we return for it IS the sp for the next frame.  */
 
 void
-z8k_frame_init_saved_regs (frame_info)
-     struct frame_info *frame_info;
+z8k_frame_init_saved_regs (struct frame_info *frame_info)
 {
   CORE_ADDR pc;
   int w;
@@ -205,15 +195,13 @@
 }
 
 void
-z8k_push_dummy_frame ()
+z8k_push_dummy_frame (void)
 {
   abort ();
 }
 
 int
-gdb_print_insn_z8k (memaddr, info)
-     bfd_vma memaddr;
-     disassemble_info *info;
+gdb_print_insn_z8k (bfd_vma memaddr, disassemble_info *info)
 {
   if (BIG)
     return print_insn_z8001 (memaddr, info);
@@ -227,10 +215,7 @@
    of the instruction. */
 
 CORE_ADDR
-NEXT_PROLOGUE_INSN (addr, lim, pword1)
-     CORE_ADDR addr;
-     CORE_ADDR lim;
-     short *pword1;
+NEXT_PROLOGUE_INSN (CORE_ADDR addr, CORE_ADDR lim, short *pword1)
 {
   char buf[2];
   if (addr < lim + 8)
@@ -254,9 +239,7 @@
    it is fairly expensive.  */
 
 void
-frame_find_saved_regs (fip, fsrp)
-     struct frame_info *fip;
-     struct frame_saved_regs *fsrp;
+frame_find_saved_regs (struct frame_info *fip, struct frame_saved_regs *fsrp)
 {
   int locals;
   CORE_ADDR pc;
@@ -306,10 +289,7 @@
 
 
 void
-extract_return_value (type, regbuf, valbuf)
-     struct type *type;
-     char *regbuf;
-     char *valbuf;
+extract_return_value (struct type *type, char *regbuf, char *valbuf)
 {
   int b;
   int len = TYPE_LENGTH (type);
@@ -325,9 +305,7 @@
 }
 
 void
-write_return_value (type, valbuf)
-     struct type *type;
-     char *valbuf;
+write_return_value (struct type *type, char *valbuf)
 {
   int reg;
   int len;
@@ -337,17 +315,14 @@
 }
 
 void
-store_struct_return (addr, sp)
-     CORE_ADDR addr;
-     CORE_ADDR sp;
+store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
 {
   write_register (2, addr);
 }
 
 
 void
-z8k_print_register_hook (regno)
-     int regno;
+z8k_print_register_hook (int regno)
 {
   if ((regno & 1) == 0 && regno < 16)
     {
@@ -389,15 +364,14 @@
 }
 
 void
-z8k_pop_frame ()
+z8k_pop_frame (void)
 {
 }
 
 struct cmd_list_element *setmemorylist;
 
 void
-z8k_set_pointer_size (newsize)
-     int newsize;
+z8k_set_pointer_size (int newsize)
 {
   static int oldsize = 0;
 
@@ -423,32 +397,26 @@
 }
 
 static void
-segmented_command (args, from_tty)
-     char *args;
-     int from_tty;
+segmented_command (char *args, int from_tty)
 {
   z8k_set_pointer_size (32);
 }
 
 static void
-unsegmented_command (args, from_tty)
-     char *args;
-     int from_tty;
+unsegmented_command (char *args, int from_tty)
 {
   z8k_set_pointer_size (16);
 }
 
 static void
-set_memory (args, from_tty)
-     char *args;
-     int from_tty;
+set_memory (char *args, int from_tty)
 {
   printf_unfiltered ("\"set memory\" must be followed by the name of a memory subcommand.\n");
   help_list (setmemorylist, "set memory ", -1, gdb_stdout);
 }
 
 void
-_initialize_z8ktdep ()
+_initialize_z8ktdep (void)
 {
   tm_print_insn = gdb_print_insn_z8k;
 
diff --git a/gettext.m4 b/gettext.m4
new file mode 100644
index 0000000..012bb81
--- /dev/null
+++ b/gettext.m4
@@ -0,0 +1,344 @@
+# 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, 1, [Define to 1 if NLS is requested])
+      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, 1,
+			[Define as 1 if you have gettext and don't want to use GNU 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, 1, [Define if you have the stpcpy function])
+   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, 1,
+		[Define if your locale.h file contains LC_MESSAGES.])
+    fi
+  fi])
diff --git a/include/COPYING b/include/COPYING
index 60549be..d60c31a 100644
--- a/include/COPYING
+++ b/include/COPYING
@@ -2,7 +2,7 @@
 		       Version 2, June 1991
 
  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
@@ -291,7 +291,7 @@
 the "copyright" line and a pointer to where the full notice is found.
 
     <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) 19yy  <name of author>
+    Copyright (C) <year>  <name of author>
 
     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
@@ -313,7 +313,7 @@
 If the program is interactive, make it output a short notice like this
 when it starts in an interactive mode:
 
-    Gnomovision version 69, Copyright (C) 19yy name of author
+    Gnomovision version 69, Copyright (C) year  name of author
     Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
     This is free software, and you are welcome to redistribute it
     under certain conditions; type `show c' for details.
diff --git a/include/ChangeLog b/include/ChangeLog
index c304f8b..b60607c 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,187 @@
+2000-12-18  Joseph S. Myers  <jsm28@cam.ac.uk>
+
+	* COPYING: Update to current
+	ftp://ftp.gnu.org/pub/gnu/Licenses/COPYING-2.0 (fixes references
+	to 19yy as example year in copyright notice).
+
+2000-12-19  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* dis-asm.h (struct disassemble_info): New member "section".
+	(INIT_DISASSEMBLE_INFO_NO_ARCH): Initialize private_data member.
+	Initialize section member.
+
+2000-12-16  Herman A.J. ten Brugge  <Haj.Ten.Brugge@net.HCC.nl>
+
+	* safe-ctype.h: Make code work on all targets and not just on
+	targets where a char is 8 bits.
+
+2000-12-10  Fred Fish  <fnf@be.com>
+
+	* bfdlink.h (struct bfd_link_info): Add new allow_shlib_undefined
+	member to struct for systems where it is normal to have undefined
+	symbols in shared libraries at runtime and the runtime linker
+	takes care of redirecting them.
+
+2000-12-07  Zack Weinberg  <zack@wolery.stanford.edu>
+
+	* safe-ctype.h: New file.
+
+2000-12-06  Rodney Brown  <RodneyBrown@mynd.com>
+
+	* getopt.h obstack.h: Standarize copyright statement.
+	
+2000-12-05  Richard Henderson  <rth@redhat.com>
+
+	* demangle.h: Change "new_abi" to "v3" everywhere.
+
+2000-11-29  Zack Weinberg  <zack@wolery.stanford.edu>
+
+	* libiberty.h: Move #includes to top.  Prototype xmalloc_failed.
+	
+2000-11-15  Kenneth Block  <kenneth.block@compaq.com>
+
+	* demangle.h: Add gnat and java demangle styles.
+
+2000-11-04  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* hashtab.h (struct htab): Add member return_allocation_failure.
+	(htab_try_create): New prototype.  Mention which functions may
+	return NULL when this is used.
+
+2000-11-03  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* hashtab.h: Change void * to PTR where necessary.
+
+2000-10-11  Mark Mitchell  <mark@codesourcery.com>
+
+	* splay-tree.h (splay_tree_predecessor): Declare.
+
+2000-09-29  Hans-Peter Nilsson  <hp@axis.com>
+
+	* dis-asm.h: Declare cris_get_disassembler, not print_insn_cris.
+	Fix typo in comment.
+
+2000-09-28  John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+	* alloca-conf.h: New file (copied from libiberty).
+
+2000-09-05  John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+	* md5.h (md5_uint32): Choose via INT_MAX instead of UINT_MAX.
+
+2000-09-04  Alex Samuel  <samuel@codesourcery.com>
+
+	* dyn-string.h: Adjust formatting. 
+	(dyn_string_insert_char): New macro.  New declaration.
+
+2000-08-28  Jason Merrill  <jason@redhat.com>
+
+	* md5.h: New file.
+
+2000-08-24  Greg McGary  <greg@mcgary.org>
+
+	* libiberty.h (ARRAY_SIZE): New macro.
+
+2000-08-08  Jason Eckhardt  <jle@cygnus.com>
+
+	* opcode/i860.h: Small formatting adjustments.
+
+2000-07-29  Nick Clifton  <nickc@cygnus.com>
+
+	* os9k.h: Add copyright notice.
+	Fix formatting.
+
+2000-07-22  Jason Eckhardt  <jle@cygnus.com>
+
+	* opcode/i860.h (btne, bte, bla): Changed these opcodes
+	to use sbroff ('r') instead of split16 ('s').
+	(J, K, L, M): New operand types for 16-bit aligned fields.
+	(ld.x, {p}fld.x, fst.x, pst.d): Changed these opcodes to
+	use I, J, K, L, M instead of just I.
+	(T, U): New operand types for split 16-bit aligned fields.
+	(st.x): Changed these opcodes to use S, T, U instead of just S.
+	(andh, andnoth, orh, xorh): Deleted 3-register forms as they do not
+	exist on the i860.
+	(pfgt.sd, pfle.sd): Deleted these as they do not exist on the i860.
+	(pfeq.ss, pfeq.dd): New opcodes.
+	(st.s): Fixed incorrect mask bits.
+	(fmlow): Fixed incorrect mask bits.
+	(fzchkl, pfzchkl): Fixed incorrect mask bits.
+	(faddz, pfaddz): Fixed incorrect mask bits.
+	(form, pform): Fixed incorrect mask bits.
+	(pfld.l): Fixed incorrect mask bits.
+	(fst.q): Fixed incorrect mask bits.
+	(all floating point opcodes): Fixed incorrect mask bits for
+	handling of dual bit.
+
+	* elf/i860.h: New file.
+	(elf_i860_reloc_type): Defined ELF32 i860 relocations.
+
+	* dis-asm.h (print_insn_i860): Add prototype.
+
+2000-07-20  H.J. Lu  <hjl@gnu.org>
+
+	* bfdlink.h (bfd_link_info): Add new_dtags.
+
+2000-07-20  Hans-Peter Nilsson  <hp@axis.com>
+
+	* dis-asm.h (print_insn_cris): Declare.
+
+2000-07-19  H.J. Lu  (hjl@gnu.org)
+
+	* bfdlink.h (bfd_link_info): Add flags and flags_1.
+
+2000-06-05  DJ Delorie  <dj@redhat.com>
+
+	* MAINTAINERS: new
+
+2000-06-30  DJ Delorie  <dj@cygnus.com>
+
+	* coff/pe.h: clarify a comment
+
+2000-06-21  Alex Samuel  <samuel@codesourcery.com>
+
+	* dyn-string.h (dyn_string_init, dyn_string_new,
+	dyn_string_delete, dyn_string_release, dyn_string_resize,
+	dyn_string_clear, dyn_string_copy, dyn_string_copy_cstr,
+	dyn_string_prepend, dyn_string_prepend_cstr, dyn_string_insert,
+	dyn_string_insert_cstr, dyn_string_append, dyn_string_append_cstr,
+	dyn_string_append_char, dyn_string_substring_dyn_string_eq):
+	Define as same name with __cxa_ prepended, if IN_LIBGCC2.
+	(dyn_string_init, dyn_string_copy, dyn_string_copy_cstr,
+	dyn_string_prepend, dyn_string_prepend_cstr, dyn_string_insert,
+	dyn_string_insert_cstr, dyn_string_append, dyn_string_append_cstr,
+	dyn_string_append_char, dyn_string_substring): Change return type
+	to int.
+	
+2000-06-18  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* dis-asm.h (print_insn_m68hc12): Define.
+	(print_insn_m68hc11): Likewise.
+
+2000-06-18  Nick Clifton  <nickc@redhat.com>
+
+	* os9k.h: Change values of MODSYNC and CRCCON due to bug report
+	from Russ Magee <rmagee@home.com>.
+
+2000-06-07  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* demangle.h (demangling_styles): Remove trailing comma in enum.
+
+	* dyn-string.h (dyn_string_append_char): Change parameter from
+	char to int.
+
+2000-06-04  Alex Samuel  <samuel@codesourcery.com>
+
+	* dyn-string.h: Move here from gcc/dyn-string.h.  Add new functions.
+
+	* demangle.h (DMGL_GNU_NEW_ABI): New macro.
+	(DMGL_STYLE_MASK): Or in DMGL_GNU_NEW_ABI. 
+	(current_demangling_style): Add gnu_new_abi_demangling.
+	(GNU_NEW_ABI_DEMANGLING_STYLE_STRING): New macro.
+	(GNU_NEW_ABI_DEMANGLING): Likewise.
+	(cplus_demangle_new_abi): New declaration.
+	
 Tue May 30 16:53:34 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* floatformat.h (struct floatformat): Add field name.
@@ -8,6 +192,12 @@
 	(HAVE_DOS_BASED_FILE_SYSTEM, IS_DIR_SEPARATOR)
 	(IS_ABSOLUTE_PATH, FILENAME_CMP): New macros.
 
+2000-05-23  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* getopt.h (getopt): Also check HAVE_DECL_* when prototyping.
+
+	* libiberty.h (basename): Likewise.
+
 2000-05-17  S. Bharadwaj Yadavalli  <sby@scrugs.lkg.dec.com>
 	    Rick Gorton	            <gorton@scrugs.lkg.dec.com>
 	    
@@ -17,19 +207,63 @@
 
 	* dis-asm.h (print_insn_tic54x): Declare.
 
+2000-05-06  Zack Weinberg  <zack@wolery.cumb.org>
+
+ 	* ansidecl.h: #define __extension__ to nothing if
+ 	GCC_VERSION < 2008.
+
 Fri May  5 16:51:03 2000  Clinton Popetz  <cpopetz@cygnus.com>
 
 	* coff/rs6k64.h (U802TOC64MAGIC): Change to U803XTOCMAGIC.
 
+2000-05-04  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* demangle.h (demangler_engine): Constify.
+
+Thu May  4 17:15:26 2000  Philippe De Muyter  <phdm@macqel.be>
+
+	* sort.h (sys/types.h): File included unconditionnaly.
+	(stddef.h): File include only #ifdef __STDC__.
+
+2000-05-03  Zack Weinberg  <zack@wolery.cumb.org>
+
+	* symcat.h: Remove #endif label.
+
+2000-04-28  Kenneth Block  <block@zk3.dec.com>
+	    Jason Merrill  <jason@casey.cygnus.com>
+
+        * demangle.h (libiberty_demanglers): new table for different styles.
+        (cplus_demangle_set_style): New function for setting style.
+        (cplus_demangle_name_to_style): New function to translate name.
+
 Mon Apr 24 15:20:51 2000  Clinton Popetz  <cpopetz@cygnus.com>
 
 	* include/coff/rs6k64.h: New file.
 
+2000-04-24  Mark Mitchell  <mark@codesourcery.com>
+
+	* hashtab.h (hash_pointer): Declare.
+	(eq_pointer): Likewise.
+
+2000-04-23  Mark Mitchell  <mark@codesourcery.com>
+
+	* sort.h: New file.
+
 Fri Apr 21 13:20:53 2000  Richard Henderson  <rth@cygnus.com>
 			  David Mosberger  <davidm@hpl.hp.com>
 
 	* dis-asm.h (print_insn_ia64): Declare.
 
+Tue Apr 18 16:22:30 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+	* hashtab.h (enum insert_option): New type.
+	(htab_find_slot, htab_find_slot_with_hash): Use it.
+
+2000-04-17  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* symcat.h: Honor autoconf macro HAVE_STRINGIZE.  Add
+	comments/caveats with regard to traditional C behavior.
+
 2000-04-05  Richard Henderson  <rth@cygnus.com>
 
 	* splay-tree.h (splay_tree_remove): Declare.
@@ -42,6 +276,12 @@
 
 	* bin-bugs.h: New file.
 
+2000-03-30  Mark Mitchell  <mark@codesourcery.com>
+
+	* hashtab.h (hashval_t): New type.
+	(htab_find_with_hash): Use it as an argument.
+	(htab_find_slot_with_hash): Likewise.
+
 2000-03-27  Denis Chertykov  <denisc@overta.ru>
 
 	* dis-asm.h (print_insn_avr): Declare.
diff --git a/include/MAINTAINERS b/include/MAINTAINERS
new file mode 100644
index 0000000..d59a3bd
--- /dev/null
+++ b/include/MAINTAINERS
@@ -0,0 +1 @@
+See ../binutils/MAINTAINERS
diff --git a/include/alloca-conf.h b/include/alloca-conf.h
new file mode 100644
index 0000000..9c3eea3
--- /dev/null
+++ b/include/alloca-conf.h
@@ -0,0 +1,24 @@
+#include "config.h"
+
+#if defined(__GNUC__) && !defined(C_ALLOCA)
+# ifndef alloca
+#  define alloca __builtin_alloca
+# endif
+#else /* ! defined (__GNUC__) */
+#  ifdef _AIX
+ #pragma alloca
+#  else
+#  if defined(HAVE_ALLOCA_H) && !defined(C_ALLOCA)
+#   include <alloca.h>
+#  else /* ! defined (HAVE_ALLOCA_H) */
+#   ifdef __STDC__
+extern PTR alloca (size_t);
+#   else /* ! defined (__STDC__) */
+extern PTR alloca ();
+#   endif /* ! defined (__STDC__) */
+#  endif /* ! defined (HAVE_ALLOCA_H) */
+#  ifdef _WIN32
+#   include <malloc.h>
+#  endif
+# endif /* ! defined (_AIX) */
+#endif /* ! defined (__GNUC__) */
diff --git a/include/ansidecl.h b/include/ansidecl.h
index 1030867..e7852c6 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -160,6 +160,7 @@
 
 #endif	/* ANSI C.  */
 
+
 /* Using MACRO(x,y) in cpp #if conditionals does not work with some
    older preprocessors.  Thus we can't define something like this:
 
@@ -221,4 +222,11 @@
 #define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
 #endif /* ATTRIBUTE_PRINTF */
 
+/* We use __extension__ in some places to suppress -pedantic warnings
+   about GCC extensions.  This feature didn't work properly before
+   gcc 2.8.  */
+#if GCC_VERSION < 2008
+#define __extension__
+#endif
+
 #endif	/* ansidecl.h	*/
diff --git a/include/bfdlink.h b/include/bfdlink.h
index 2285775..ae96323 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -201,6 +201,19 @@
   /* true if BFD should generate errors for undefined symbols
      even if generating a shared object.  */
   boolean no_undefined;
+  /* true if BFD should allow undefined symbols in shared objects even
+     when no_undefined is set to disallow undefined symbols.  The net
+     result will be that undefined symbols in regular objects will
+     still trigger an error, but undefined symbols in shared objects
+     will be ignored.  The implementation of no_undefined makes the
+     assumption that the runtime linker will choke on undefined
+     symbols.  However there is at least one system (BeOS) where
+     undefined symbols in shared libraries is normal since the kernel
+     patches them at load time to select which function is most
+     appropriate for the current architecture.  I.E. dynamically
+     select an appropriate memset function.  Apparently it is also
+     normal for HPPA shared libraries to have undefined symbols.  */
+  boolean allow_shlib_undefined;
   /* Which symbols to strip.  */
   enum bfd_link_strip strip;
   /* Which local symbols to discard.  */
@@ -246,6 +259,15 @@
   /* The function to call when the executable or shared object is
      unloaded.  */
   const char *fini_function;
+
+  /* true if the new ELF dynamic tags are enabled. */ 
+  boolean new_dtags;
+
+  /* May be used to set DT_FLAGS for ELF. */
+  bfd_vma flags;
+
+  /* May be used to set DT_FLAGS_1 for ELF. */
+  bfd_vma flags_1;
 };
 
 /* This structures holds a set of callback functions.  These are
diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog
index dd6ca19..d73c51a 100644
--- a/include/coff/ChangeLog
+++ b/include/coff/ChangeLog
@@ -1,3 +1,15 @@
+2000-12-11  Alan Modra  <alan@linuxcare.com.au>
+
+	* ti.h (OCTETS_PER_BYTE_POWER): Change #warning to #error.
+
+2000-12-08  Alan Modra  <alan@linuxcare.com.au>
+
+	* ti.h (OCTETS_PER_BYTE_POWER): Change #warn to #warning.
+
+2000-06-30  DJ Delorie  <dj@cygnus.com>
+
+	* pe.h: Clarify a comment.
+
 2000-04-17  Timothy Wall  <twall@cygnus.com>
 	
 	* ti.h: Load page cleanup.
diff --git a/include/coff/pe.h b/include/coff/pe.h
index e65562e..f2c022e 100644
--- a/include/coff/pe.h
+++ b/include/coff/pe.h
@@ -1,5 +1,22 @@
-/* PE COFF header information */
+/* pe.h  -  PE COFF header information 
 
+   Copyright (C) 2000 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 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 _PE_H
 #define _PE_H
 
@@ -99,49 +116,52 @@
 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER	11
 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER	12
   
-/* Magic values that are true for all dos/nt implementations */
+/* Magic values that are true for all dos/nt implementations.  */
 #define DOSMAGIC       0x5a4d  
 #define NT_SIGNATURE   0x00004550
 
-/* NT allows long filenames, we want to accommodate this.  This may break
-   some of the bfd functions */
+/* NT allows long filenames, we want to accommodate this.
+   This may break some of the bfd functions.  */
 #undef  FILNMLEN
-#define FILNMLEN	18	/* # characters in a file name		*/
+#define FILNMLEN	18	/* # characters in a file name.  */
 
 struct external_PEI_filehdr
 {
-  /* DOS header fields */
-  char e_magic[2];		/* Magic number, 0x5a4d */
-  char e_cblp[2];		/* Bytes on last page of file, 0x90 */
-  char e_cp[2];			/* Pages in file, 0x3 */
-  char e_crlc[2];		/* Relocations, 0x0 */
-  char e_cparhdr[2];		/* Size of header in paragraphs, 0x4 */
-  char e_minalloc[2];		/* Minimum extra paragraphs needed, 0x0 */
-  char e_maxalloc[2];		/* Maximum extra paragraphs needed, 0xFFFF */
-  char e_ss[2];			/* Initial (relative) SS value, 0x0 */
-  char e_sp[2];			/* Initial SP value, 0xb8 */
-  char e_csum[2];		/* Checksum, 0x0 */
-  char e_ip[2];			/* Initial IP value, 0x0 */
-  char e_cs[2];			/* Initial (relative) CS value, 0x0 */
-  char e_lfarlc[2];		/* File address of relocation table, 0x40 */
-  char e_ovno[2];		/* Overlay number, 0x0 */
-  char e_res[4][2];		/* Reserved words, all 0x0 */
-  char e_oemid[2];		/* OEM identifier (for e_oeminfo), 0x0 */
-  char e_oeminfo[2];		/* OEM information; e_oemid specific, 0x0 */
-  char e_res2[10][2];		/* Reserved words, all 0x0 */
-  char e_lfanew[4];		/* File address of new exe header, 0x80 */
-  char dos_message[16][4];	/* other stuff, always follow DOS header */
-  char nt_signature[4];		/* required NT signature, 0x4550 */ 
+  /* DOS header fields - always at offset zero in the EXE file.  */
+  char e_magic[2];		/* Magic number, 0x5a4d.  */
+  char e_cblp[2];		/* Bytes on last page of file, 0x90.  */
+  char e_cp[2];			/* Pages in file, 0x3.  */
+  char e_crlc[2];		/* Relocations, 0x0.  */
+  char e_cparhdr[2];		/* Size of header in paragraphs, 0x4.  */
+  char e_minalloc[2];		/* Minimum extra paragraphs needed, 0x0.  */
+  char e_maxalloc[2];		/* Maximum extra paragraphs needed, 0xFFFF.  */
+  char e_ss[2];			/* Initial (relative) SS value, 0x0.  */
+  char e_sp[2];			/* Initial SP value, 0xb8.  */
+  char e_csum[2];		/* Checksum, 0x0.  */
+  char e_ip[2];			/* Initial IP value, 0x0.  */
+  char e_cs[2];			/* Initial (relative) CS value, 0x0.  */
+  char e_lfarlc[2];		/* File address of relocation table, 0x40.  */
+  char e_ovno[2];		/* Overlay number, 0x0.  */
+  char e_res[4][2];		/* Reserved words, all 0x0.  */
+  char e_oemid[2];		/* OEM identifier (for e_oeminfo), 0x0.  */
+  char e_oeminfo[2];		/* OEM information; e_oemid specific, 0x0.  */
+  char e_res2[10][2];		/* Reserved words, all 0x0.  */
+  char e_lfanew[4];		/* File address of new exe header, usually 0x80.  */
+  char dos_message[16][4];	/* Other stuff, always follow DOS header.  */
 
-  /* From standard header */  
+  /* Note: additional bytes may be inserted before the signature.  Use
+   the e_lfanew field to find the actual location of the NT signature.  */
 
-  char f_magic[2];		/* magic number			*/
-  char f_nscns[2];		/* number of sections		*/
-  char f_timdat[4];		/* time & date stamp		*/
-  char f_symptr[4];		/* file pointer to symtab	*/
-  char f_nsyms[4];		/* number of symtab entries	*/
-  char f_opthdr[2];		/* sizeof(optional hdr)		*/
-  char f_flags[2];		/* flags			*/
+  char nt_signature[4];		/* required NT signature, 0x4550.  */
+
+  /* From standard header.  */
+  char f_magic[2];		/* Magic number.		*/
+  char f_nscns[2];		/* Number of sections.		*/
+  char f_timdat[4];		/* Time & date stamp.		*/
+  char f_symptr[4];		/* File pointer to symtab.	*/
+  char f_nsyms[4];		/* Number of symtab entries.	*/
+  char f_opthdr[2];		/* Sizeof(optional hdr).	*/
+  char f_flags[2];		/* Flags.			*/
 };
 
 #ifdef COFF_IMAGE_WITH_PE
@@ -161,7 +181,7 @@
 {
   AOUTHDR standard;
 
-  /* NT extra fields; see internal.h for descriptions */
+  /* NT extra fields; see internal.h for descriptions.  */
   char  ImageBase[4];
   char  SectionAlignment[4];
   char  FileAlignment[4];
@@ -183,8 +203,8 @@
   char  SizeOfHeapCommit[4];
   char  LoaderFlags[4];
   char  NumberOfRvaAndSizes[4];
-  /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */
-  char  DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */
+  /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];  */
+  char  DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars.  */
 } PEAOUTHDR;
 #undef AOUTSZ
 #define AOUTSZ (AOUTHDRSZ + 196)
@@ -196,7 +216,7 @@
 {
   AOUTHDR standard;
 
-  /* NT extra fields; see internal.h for descriptions */
+  /* NT extra fields; see internal.h for descriptions.  */
   char  ImageBase[8];
   char  SectionAlignment[4];
   char  FileAlignment[4];
@@ -218,13 +238,13 @@
   char  SizeOfHeapCommit[8];
   char  LoaderFlags[4];
   char  NumberOfRvaAndSizes[4];
-  /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */
-  char  DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */
+  /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];  */
+  char  DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars.  */
 } PEP64AOUTHDR;
 #define PEP64AOUTSZ	240
   
 #undef  E_FILNMLEN
-#define E_FILNMLEN	18	/* # characters in a file name		*/
+#define E_FILNMLEN	18	/* # characters in a file name.  */
 
 /* Import Tyoes fot ILF format object files..  */
 #define IMPORT_CODE	0
diff --git a/include/coff/ti.h b/include/coff/ti.h
index 9d521b5..445707c 100644
--- a/include/coff/ti.h
+++ b/include/coff/ti.h
@@ -45,7 +45,7 @@
 
 /* This value is made available in the rare case where a bfd is unavailable */
 #ifndef OCTETS_PER_BYTE_POWER
-#warn OCTETS_PER_BYTE_POWER not defined for this CPU, it will default to 0
+#error "OCTETS_PER_BYTE_POWER not defined for this CPU"
 #else
 #define OCTETS_PER_BYTE (1<<OCTETS_PER_BYTE_POWER)
 #endif
diff --git a/include/demangle.h b/include/demangle.h
index 63fe5e2..7fb6259 100644
--- a/include/demangle.h
+++ b/include/demangle.h
@@ -24,21 +24,24 @@
 
 /* Options passed to cplus_demangle (in 2nd parameter). */
 
-#define DMGL_NO_OPTS	0		/* For readability... */
-#define DMGL_PARAMS	(1 << 0)	/* Include function args */
-#define DMGL_ANSI	(1 << 1)	/* Include const, volatile, etc */
-#define DMGL_JAVA	(1 << 2)	/* Demangle as Java rather than C++. */
+#define DMGL_NO_OPTS	 0		/* For readability... */
+#define DMGL_PARAMS	 (1 << 0)	/* Include function args */
+#define DMGL_ANSI	 (1 << 1)	/* Include const, volatile, etc */
+#define DMGL_JAVA	 (1 << 2)	/* Demangle as Java rather than C++. */
 
-#define DMGL_AUTO	(1 << 8)
-#define DMGL_GNU	(1 << 9)
-#define DMGL_LUCID	(1 << 10)
-#define DMGL_ARM	(1 << 11)
-#define DMGL_HP 	(1 << 12)       /* For the HP aCC compiler; same as ARM
-                                           except for template arguments, etc. */
-#define DMGL_EDG	(1 << 13)
+#define DMGL_AUTO	 (1 << 8)
+#define DMGL_GNU	 (1 << 9)
+#define DMGL_LUCID	 (1 << 10)
+#define DMGL_ARM	 (1 << 11)
+#define DMGL_HP 	 (1 << 12)       /* For the HP aCC compiler;
+                                            same as ARM except for
+                                            template arguments, etc. */
+#define DMGL_EDG	 (1 << 13)
+#define DMGL_GNU_V3	 (1 << 14)
+#define DMGL_GNAT	 (1 << 15)
 
 /* If none of these are set, use 'current_demangling_style' as the default. */
-#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG)
+#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT)
 
 /* Enumeration of possible demangling styles.
 
@@ -56,17 +59,23 @@
   lucid_demangling = DMGL_LUCID,
   arm_demangling = DMGL_ARM,
   hp_demangling = DMGL_HP,
-  edg_demangling = DMGL_EDG
+  edg_demangling = DMGL_EDG,
+  gnu_v3_demangling = DMGL_GNU_V3,
+  java_demangling = DMGL_JAVA,
+  gnat_demangling = DMGL_GNAT
 } current_demangling_style;
 
 /* Define string names for the various demangling styles. */
 
-#define AUTO_DEMANGLING_STYLE_STRING	"auto"
-#define GNU_DEMANGLING_STYLE_STRING	"gnu"
-#define LUCID_DEMANGLING_STYLE_STRING	"lucid"
-#define ARM_DEMANGLING_STYLE_STRING	"arm"
-#define HP_DEMANGLING_STYLE_STRING	"hp"
-#define EDG_DEMANGLING_STYLE_STRING	"edg"
+#define AUTO_DEMANGLING_STYLE_STRING	      "auto"
+#define GNU_DEMANGLING_STYLE_STRING    	      "gnu"
+#define LUCID_DEMANGLING_STYLE_STRING	      "lucid"
+#define ARM_DEMANGLING_STYLE_STRING	      "arm"
+#define HP_DEMANGLING_STYLE_STRING	      "hp"
+#define EDG_DEMANGLING_STYLE_STRING	      "edg"
+#define GNU_V3_DEMANGLING_STYLE_STRING        "gnu-v3"
+#define JAVA_DEMANGLING_STYLE_STRING          "java"
+#define GNAT_DEMANGLING_STYLE_STRING          "gnat"
 
 /* Some macros to test what demangling style is active. */
 
@@ -77,6 +86,19 @@
 #define ARM_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_ARM)
 #define HP_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_HP)
 #define EDG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_EDG)
+#define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3)
+#define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA)
+#define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT)
+
+/* Provide information about the available demangle styles. This code is
+   pulled from gdb into libiberty because it is useful to binutils also.  */
+
+extern struct demangler_engine
+{
+  const char *demangling_style_name;
+  enum demangling_styles demangling_style;
+  const char *demangling_style_doc;
+} libiberty_demanglers[];
 
 extern char *
 cplus_demangle PARAMS ((const char *mangled, int options));
@@ -92,4 +114,14 @@
 extern void
 set_cplus_marker_for_demangling PARAMS ((int ch));
 
+extern enum demangling_styles 
+cplus_demangle_set_style PARAMS ((enum demangling_styles style));
+
+extern enum demangling_styles 
+cplus_demangle_name_to_style PARAMS ((const char *name));
+
+/* V3 ABI demangling entry point, defined in cp-demangle.c.  */
+extern char*
+cplus_demangle_v3 PARAMS ((const char* mangled));
+
 #endif	/* DEMANGLE_H */
diff --git a/include/dis-asm.h b/include/dis-asm.h
index 7efd4e0..67432e2 100644
--- a/include/dis-asm.h
+++ b/include/dis-asm.h
@@ -56,6 +56,11 @@
   /* Endianness (for bi-endian cpus).  Mono-endian cpus can ignore this.  */
   enum bfd_endian endian;
 
+  /* Some targets need information about the current section to accurately
+     display insns.  If this is NULL, the target disassembler function
+     will have to make its best guess.  */
+  asection *section;
+
   /* An array of pointers to symbols either at the location being disassembled
      or at the start of the function being disassembled.  The array is sorted
      so that the first symbol is intended to be the one used.  The others are
@@ -159,6 +164,8 @@
 extern int print_insn_i386_intel	PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_ia64		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_i370		PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_m68hc11		PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_m68hc12		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_m68k		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_z8001		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_z8002		PARAMS ((bfd_vma, disassemble_info*));
@@ -173,6 +180,7 @@
 extern int print_insn_sparc		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_big_a29k		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_little_a29k	PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_i860		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_i960		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_sh		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_shl		PARAMS ((bfd_vma, disassemble_info*));
@@ -188,6 +196,7 @@
 extern int print_insn_little_powerpc	PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_rs6000		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_w65		PARAMS ((bfd_vma, disassemble_info*));
+extern disassembler_ftype cris_get_disassembler PARAMS ((bfd *));
 extern int print_insn_d10v		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_d30v		PARAMS ((bfd_vma, disassemble_info*));
 extern int print_insn_v850		PARAMS ((bfd_vma, disassemble_info*));
@@ -247,13 +256,15 @@
 /* Call this macro to initialize only the internal variables for the
    disassembler.  Architecture dependent things such as byte order, or machine
    variant are not touched by this macro.  This makes things much easier for
-   GDB which must initialize these things seperatly.  */
+   GDB which must initialize these things separately.  */
 
 #define INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) \
   (INFO).fprintf_func = (fprintf_ftype)(FPRINTF_FUNC), \
   (INFO).stream = (PTR)(STREAM), \
+  (INFO).section = NULL, \
   (INFO).symbols = NULL, \
   (INFO).num_symbols = 0, \
+  (INFO).private_data = NULL, \
   (INFO).buffer = NULL, \
   (INFO).buffer_vma = 0, \
   (INFO).buffer_length = 0, \
diff --git a/include/dyn-string.h b/include/dyn-string.h
new file mode 100644
index 0000000..67f7ab7
--- /dev/null
+++ b/include/dyn-string.h
@@ -0,0 +1,92 @@
+/* An abstract string datatype.
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+   Contributed by Mark Mitchell (mark@markmitchell.com).
+
+This file is part of GNU CC.
+   
+GNU CC 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.
+
+GNU CC 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 GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+
+typedef struct dyn_string
+{
+  int allocated;	/* The amount of space allocated for the string.  */
+  int length;		/* The actual length of the string.  */
+  char *s;		/* The string itself, NUL-terminated.  */
+}* dyn_string_t;
+
+/* The length STR, in bytes, not including the terminating NUL.  */
+#define dyn_string_length(STR)                                          \
+  ((STR)->length)
+
+/* The NTBS in which the contents of STR are stored.  */
+#define dyn_string_buf(STR)                                             \
+  ((STR)->s)
+
+/* Compare DS1 to DS2 with strcmp.  */
+#define dyn_string_compare(DS1, DS2)                                    \
+  (strcmp ((DS1)->s, (DS2)->s))
+
+
+/* dyn_string functions are used in the demangling implementation
+   included in the G++ runtime library.  To prevent collisions with
+   names in user programs, the functions that are used in the
+   demangler are given implementation-reserved names.  */
+
+#ifdef IN_LIBGCC2
+
+#define dyn_string_init                 __cxa_dyn_string_init
+#define dyn_string_new                  __cxa_dyn_string_new
+#define dyn_string_delete               __cxa_dyn_string_delete
+#define dyn_string_release              __cxa_dyn_string_release
+#define dyn_string_resize               __cxa_dyn_string_resize
+#define dyn_string_clear                __cxa_dyn_string_clear
+#define dyn_string_copy                 __cxa_dyn_string_copy
+#define dyn_string_copy_cstr            __cxa_dyn_string_copy_cstr
+#define dyn_string_prepend              __cxa_dyn_string_prepend
+#define dyn_string_prepend_cstr         __cxa_dyn_string_prepend_cstr
+#define dyn_string_insert               __cxa_dyn_string_insert
+#define dyn_string_insert_cstr          __cxa_dyn_string_insert_cstr
+#define dyn_string_insert_char          __cxa_dyn_string_insert_char
+#define dyn_string_append               __cxa_dyn_string_append
+#define dyn_string_append_cstr          __cxa_dyn_string_append_cstr
+#define dyn_string_append_char          __cxa_dyn_string_append_char
+#define dyn_string_substring            __cxa_dyn_string_substring
+#define dyn_string_eq                   __cxa_dyn_string_eq
+
+#endif /* IN_LIBGCC2 */
+
+
+extern int dyn_string_init              PARAMS ((struct dyn_string *, int));
+extern dyn_string_t dyn_string_new      PARAMS ((int));
+extern void dyn_string_delete           PARAMS ((dyn_string_t));
+extern char *dyn_string_release         PARAMS ((dyn_string_t));
+extern dyn_string_t dyn_string_resize   PARAMS ((dyn_string_t, int));
+extern void dyn_string_clear            PARAMS ((dyn_string_t));
+extern int dyn_string_copy              PARAMS ((dyn_string_t, dyn_string_t));
+extern int dyn_string_copy_cstr         PARAMS ((dyn_string_t, const char *));
+extern int dyn_string_prepend           PARAMS ((dyn_string_t, dyn_string_t));
+extern int dyn_string_prepend_cstr      PARAMS ((dyn_string_t, const char *));
+extern int dyn_string_insert            PARAMS ((dyn_string_t, int,
+						 dyn_string_t));
+extern int dyn_string_insert_cstr       PARAMS ((dyn_string_t, int,
+						 const char *));
+extern int dyn_string_insert_char       PARAMS ((dyn_string_t, int, int));
+extern int dyn_string_append            PARAMS ((dyn_string_t, dyn_string_t));
+extern int dyn_string_append_cstr       PARAMS ((dyn_string_t, const char *));
+extern int dyn_string_append_char       PARAMS ((dyn_string_t, int));
+extern int dyn_string_substring         PARAMS ((dyn_string_t, 
+						 dyn_string_t, int, int));
+extern int dyn_string_eq                PARAMS ((dyn_string_t, dyn_string_t));
diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog
index ecbae34..31ffd7c 100644
--- a/include/elf/ChangeLog
+++ b/include/elf/ChangeLog
@@ -1,3 +1,191 @@
+2000-12-12  Nick Clifton  <nickc@redhat.com>
+
+	* mips.h: Fix formatting.
+
+Mon Dec 11 10:56:58 2000  Jeffrey A Law  (law@cygnus.com)
+
+	* hppa.h (DT_HP_*): Define relative to OLD_DT_LOOS for hpux
+	compatibility.
+
+2000-10-16  Chris Demetriou  <cgd@sibyte.com>
+
+        * mips.h (E_MIPS_ARCH_32): New constant.
+        (E_MIPS_MACH_MIPS32, E_MIPS_MACH_MIPS32_4K): Replace the
+        former with the latter. 
+
+        * mips.h (E_MIPS_ARCH_5, E_MIPS_ARCH_64): New definitions.
+
+        * mips.h (E_MIPS_MACH_SB1): New constant.
+
+2000-11-30  Jan Hubicka  <jh@suse.cz>
+	
+        * common.h (EM_X86_64): New macro.
+        * x86-64.h: New file.
+
+2000-11-27  Hans-Peter Nilsson  <hp@axis.com>
+
+	* common.h (e_machine numbers): Clarify comments to describe how
+	EM_* constants are assigned.  Move EM_PJ from official section to
+	ad-hoc section.
+	(EM_CRIS): Correct comment to match official description.
+	(EM_MMIX): Ditto.
+
+2000-11-22  Nick Clifton  <nickc@redhat.com>
+
+	* common.h (EM_JAVELIN): New machine number.
+	(EM_FIREPATH): New machine number.
+	(EM_ZSP): New machine number.
+	(EM_MMIX): New machine number.
+	(EM_HUANY): New machine number.
+	(EM_PRISM): New machine number.
+	(SHT_GROUP): New section type.
+	(SHT_SYMTAB_SHNDX): New section type.
+	(SHF_GROUP): New section flag.
+	(SHN_XINDEX): New section index.
+	(GRP_COMDAT): New section group flag.
+
+2000-11-20  H.J. Lu  <hjl@gnu.org>
+
+	* common.h (ELFOSABI_MONTEREY): Renamed to ...
+	(ELFOSABI_AIX): This.
+
+2000-11-16  Richard Henderson  <rth@redhat.com>
+
+	Update relocations per August psABI docs.
+	* ia64.h (R_IA64_SEGBASE): Remove.
+	(R_IA64_LTV*): Renumber to 0x74 to 0x77.
+	(R_IA64_EPLTMSB, R_IA64_EPLTLSB): Remove.
+	(R_IA64_TPREL14, R_IA64_TPREL64I): New.
+	(R_IA64_DTPMOD*): New.
+	(R_IA64_DTPREL*): New.
+
+2000-09-29  Hans-Peter Nilsson  <hp@axis.com>
+
+	* cris.h (EF_CRIS_UNDERSCORE): New.
+
+2000-09-27  Alan Modra  <alan@linuxcare.com.au>
+
+	* hppa.h (R_PARISC_DIR14F): Add.
+
+2000-09-14  Alexandre Oliva  <aoliva@redhat.com>
+
+	* sh.h (R_SH_GOT32, R_SH_PLT32, R_SH_COPY, R_SH_GLOB_DAT,
+	R_SH_JMP_SLOT, R_SH_RELATIVE, R_SH_GOTOFF, R_SH_GOTPC): Change
+	numbers to the range from 160 to 167.
+	(R_SH_FIRST_INVALID_RELOC): Adjust.
+	(R_SH_FIRST_INVALID_RELOC_2, R_SH_LAST_INVALID_RELOC_2):
+	New relocs to fill in the gap.
+
+2000-09-13  Anders Norlander  <anorland@acc.umu.se>
+
+ 	* mips.h (E_MIPS_MACH_4K): New define.
+
+2000-09-05  Alan Modra  <alan@linuxcare.com.au>
+
+	* hppa.h: Fix a comment.
+	(R_PARISC_PCREL12F): Define.
+	(R_PARISC_GNU_VTENTRY): Define.
+	(R_PARISC_GNU_VTINHERIT): Define.
+
+2000-09-01  Alexandre Oliva  <aoliva@redhat.com>
+
+	* sh.h (R_SH_GOT32, R_SH_PLT32, R_SH_COPY, R_SH_GLOB_DAT,
+	R_SH_JMP_SLOT, R_SH_RELATIVE, R_SH_GOTOFF, R_SH_GOTPC): New relocs.
+	(R_SH_FIRST_INVALID_RELOC): Adjust.
+
+2000-08-14  Jim Wilson  <wilson@cygnus.com>
+
+	* elf/ia64.h (EF_IA_64_REDUCEDFP, EF_IA_64_CONS_GP,
+	EF_IA_64_NOFUNCDESC_CONS_GP, EF_IA_64_ABSOLUTE): Define.
+
+2000-08-07  Nick Clifton  <nickc@cygnus.com>
+
+	* ppc.h: Remove spurious CYGNUS LOCAL comments.
+	* v850.h: Likewise.
+
+2000-07-20  Hans-Peter Nilsson  <hp@axis.com>
+
+	common.h (EM_CRIS): New machine number.
+	cris.h: New file.
+
+2000-07-19  H.J. Lu  <hjl@gnu.org>
+
+	* common.h (DF_1_NODEFLIB): Renamed from DF_1_NODEPLIB.
+
+2000-07-19  H.J. Lu  <hjl@gnu.org>
+
+	* common.h (DT_CHECKSUM): Set to 0x6ffffdf8.
+	(DTF_1_CONFEXP): It is 0x00000002 as suspected.
+
+2000-07-19  H.J. Lu  <hjl@gnu.org>
+
+	* common.h (DT_FEATURE): Renamed from DT_FEATURE_1.
+	(DT_CONFIG): New. From Solaris 8.
+	(DT_DEPAUDIT): Likewise.
+	(DT_AUDIT): Likewise.
+	(DT_PLTPAD): Likewise.
+	(DT_MOVETAB): Likewise.
+	(DF_1_NODEPLIB): Likewise.
+	(DF_1_NODUMP): Likewise.
+	(DF_1_CONLFAT): Likewise.
+	(DT_CHECKSUM): Likewise. FIXME. Check the value on Solaris 8.
+	(DTF_1_CONFEXP): Likewise.
+
+2000-07-18  H.J. Lu  <hjl@gnu.org>
+
+	* common.h (DT_FLAGS_1): Renamed from DT_1_FLAGS.
+
+2000-07-12  Alan Modra  <alan@linuxcare.com.au>
+
+	* internal.h (struct elf_internal_sym): Update comment for st_other.
+
+2000-07-10  Alan Modra  <alan@linuxcare.com.au>
+
+	* hppa.h: Add comments to all the relocs. 
+
+2000-06-26  Marek Michalkiewicz  <marekm@linux.org.pl>
+
+	* avr.h (E_AVR_MACH_AVR5): Define.
+
+2000-06-18  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* m68hc11.h: New file, definitions for the Motorola 68hc11.
+
+2000-06-06  Alan Modra  <alan@linuxcare.com.au>
+
+	* reloc-macros.h (START_RELOC_NUMBERS): Don't define initial dummy
+	-1 valued enum.
+	(RELOC_NUMBER, FAKE_RELOC, EMPTY_RELOC): Append rather than
+	prepend comma.
+	(END_RELOC_NUMBERS): Give macro an arg to define as last enum.
+
+	* alpha.h (R_ALPHA_max): Define via END_RELOC_NUMBERS rather than
+	with EMPTY_RELOC.
+	* arc.h (R_ARC_max): Likewise.
+	* avr.h (R_AVR_max): Likewise.
+	* fr30.h (R_FR30_max): Likewise.
+	* hppa.h (R_PARISC_UNIMPLEMENTED): Likewise.
+	* i960.h (R_960_max): Likewise.
+	* m32r.h (R_M32R_max): Likewise.
+	* m68k.h (R_68K_max): Likewise.
+	* mcore.h (R_MCORE_max): Likewise.
+	* mn10300.h (R_MN10300_MAX): Likewise.
+	* pj.h (R_PJ_max): Likewise.
+	* ppc.h (R_PPC_max): Likewise.
+	* sh.h (R_SH_max): Likewise.
+	* sparc.h (R_SPARC_max): Likewise.
+	* v850.h (R_V850_max): Likewise.
+
+	* arm.h (R_ARM_max): Define via END_RELOC_NUMBERS.
+	* d10v.h (R_D10V_max): Likewise.
+	* d30v.h (R_D30V_max): Likewise.
+	* ia64.h (R_IA64_max): Likewise.
+	* mips.h (R_MIPS_maxext): Likewise.
+	* mn10200.h (R_MN10200_max): Likewise.
+
+	* i386.h (R_386_max): Remove old RELOC_NUMBER definition, and
+	define via END_RELOC_NUMBERS.
+
 2000-06-03  Alan Modra  <alan@linuxcare.com.au>
 
 	* reloc-macros.h (START_RELOC_NUMBERS): Fix name clash for
@@ -49,7 +237,7 @@
 	(EF_ARM_EABI_VER1): Define.
 	(PF_ARM_PI): Define.
 	(PF_ARM_ABS): Define.
-	
+
 Wed Apr  5 22:08:59 2000  J"orn Rennecke <amylaar@cygnus.co.uk>
 
 	* sh.h (R_SH_LOOP_START, R_SH_LOOP_END): New RELOC_NUMBERs.
@@ -62,8 +250,8 @@
 2000-03-10  Geoffrey Keating  <geoffk@cygnus.com>
 
 	* mips.h: Add R_MIPS_GNU_REL_HI16, R_MIPS_GNU_REL_LO16,
- 	R_MIPS_GNU_REL16_S2, R_MIPS_PC64 and R_MIPS_PC32 relocation
- 	numbers.
+	R_MIPS_GNU_REL16_S2, R_MIPS_PC64 and R_MIPS_PC32 relocation
+	numbers.
 
 2000-02-23  Linas Vepstas <linas@linas.org>
 
@@ -92,7 +280,7 @@
 
 2000-01-27  Thomas de Lellis  <tdel@windriver.com>
 
-        * arm.h (STT_ARM_TFUNC): Define in terms of STT_LOPROC.
+	* arm.h (STT_ARM_TFUNC): Define in terms of STT_LOPROC.
 	(STT_ARM_16BIT): New flag.  Denotes a label that was defined in
 	Thumb block but was does not identify a function.
 
@@ -119,12 +307,12 @@
 
 2000-01-10  Egor Duda  <deo@logos-m.ru>
 
-	* common.h (NT_WIN32PSTATUS): Define.  (cygwin elf core dumps). 
+	* common.h (NT_WIN32PSTATUS): Define.  (cygwin elf core dumps).
 
 1999-12-28  Nick Clifton  <nickc@cygnus.com>
 
 	* mips.h (STO_*): Redefine in terms of STV_* values now in
-	common.h. 
+	common.h.
 
 1999-12-27  Nick Clifton  <nickc@cygnus.com>
 
@@ -182,7 +370,7 @@
 	* i960.h (reloc-macros.h):  Include using relative dir elf/.
 	* i386.h (reloc-macros.h):  Include using relative dir elf/.
 	* hppa.h (reloc-macros.h):  Include using relative dir elf/.
-	
+
 1999-12-07  Jim Blandy  <jimb@cygnus.com>
 
 	* common.h (NT_PRXFPREG): New definition.
@@ -291,9 +479,9 @@
 
 	* mcore.h (R_MCORE_RELATIVE): Define.
 
-999-05-05  Catherine Moore  <clm@cygnus.com>
+1999-05-05  Catherine Moore  <clm@cygnus.com>
 
-        * m68k.h (EF_CPU32): Define.
+	* m68k.h (EF_CPU32): Define.
 
 1999-04-21  Nick Clifton  <nickc@cygnus.com>
 
@@ -351,10 +539,10 @@
 
 Mon Feb  1 11:33:56 1999  Catherine Moore  <clm@cygnus.com>
 
-        * arm.h:  Renumber relocs to conform to standard.
-        (EF_NEW_ABI):  Define.
-        (EF_OLD_ABI):  Define.
-        * arm-oabi.h:  New file.
+	* arm.h:  Renumber relocs to conform to standard.
+	(EF_NEW_ABI):  Define.
+	(EF_OLD_ABI):  Define.
+	* arm-oabi.h:  New file.
 
 1999-01-28  Nick Clifton  <nickc@cygnus.com>
 
@@ -391,7 +579,7 @@
 
 Tue Nov 10 15:17:28 1998  Catherine Moore  <clm@cygnus.com>
 
-        * d10v.h:  Add vtable relocs.
+	* d10v.h:  Add vtable relocs.
 
 Wed Nov  4 15:56:50 1998  Nick Clifton  <nickc@cygnus.com>
 
@@ -401,9 +589,9 @@
 
 Fri Oct 30 11:54:15 1998  Catherine Moore  <clm@cygnus.com>
 
-        From Philip Blundell <pb@nexus.co.uk>:
-        * arm.h (R_ARM_COPY, et al.): New relocs, used by Linux for PIC.
-        (EF_ALIGN8): New flag.
+	From Philip Blundell <pb@nexus.co.uk>:
+	* arm.h (R_ARM_COPY, et al.): New relocs, used by Linux for PIC.
+	(EF_ALIGN8): New flag.
 
 Tue Oct 20 11:19:50 1998  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -411,25 +599,25 @@
 
 Mon Oct 19 20:24:11 1998  Catherine Moore  <clm@cygnus.com>
 
-        * sh.h:  Add vtable relocs.
+	* sh.h:  Add vtable relocs.
 
 Mon Oct 19 01:44:42 1998  Felix Lee  <flee@cygnus.com>
 
 	* common.h (NT_PSTATUS, NT_FPREGS, NT_PSINFO,
- 	NT_LWPSTATUS,NT_LWPSINFO): added.
+	NT_LWPSTATUS,NT_LWPSINFO): added.
 	* internal.h (Elf_Internal_Note): new structure members.
 
 Fri Oct 16 14:11:25 1998  Catherine Moore  <clm@cygnus.com>
 
-        * m32r.h:  Add vtable relocs.
+	* m32r.h:  Add vtable relocs.
 
 Tue Oct  6 09:22:22 1998  Catherine Moore  <clm@cygnus.com>
 
-        * sparc.h:  Add vtable relocs.
+	* sparc.h:  Add vtable relocs.
 
 Mon Oct  5 09:39:22 1998  Catherine Moore  <clm@cygnus.com>
 
-        * v850.h:  Add vtable relocs.
+	* v850.h:  Add vtable relocs.
 
 Sun Oct  4 21:17:51 1998  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -437,7 +625,7 @@
 
 Mon Sep 21 12:24:44 1998  Catherine Moore  <clm@cygnus.com>
 
-        * i386.h:  Change vtable reloc numbers.
+	* i386.h:  Change vtable reloc numbers.
 
 Sun Sep 20 00:54:22 1998  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
 
@@ -445,12 +633,12 @@
 
 Tue Sep 15 09:56:49 CDT 1998  Catherine Moore  <clm@cygnus.com>
 
-       * arm.h:  Add vtable relocs.
+	* arm.h:  Add vtable relocs.
 
 Mon Aug 31 11:25:27 1998  Catherine Moore  <clm@cygnus.com>
 
-        * arm.h:  Define STT_ARM_TFUNC.  Remove ST_THUMB_xxxx
-        definitions.
+	* arm.h:  Define STT_ARM_TFUNC.  Remove ST_THUMB_xxxx
+	definitions.
 
 Sat Aug 29 22:25:51 1998  Richard Henderson  <rth@cygnus.com>
 
@@ -467,7 +655,7 @@
 
 Sun Aug  9 20:26:49 CDT 1998  Catherine Moore  <clm@cygnus.com>
 
-       * arm.h:  Add ST_THUMB definitions.
+	* arm.h:  Add ST_THUMB definitions.
 
 Wed Aug  5 15:52:35 1998  Nick Clifton  <nickc@cygnus.com>
 
@@ -483,7 +671,7 @@
 
 Fri Jul 31 10:01:40 1998 Catherine Moore  <clm@cygnus.com>
 
-        * arm.h: Add R_ARM_THM_PC9 relocation.
+	* arm.h: Add R_ARM_THM_PC9 relocation.
 
 1998-07-30 16:25  Ulrich Drepper  <drepper@cygnus.com>
 
@@ -503,7 +691,7 @@
 
 Wed Jul 22 19:29:00 Catherine Moore  <clm@cygnus.com>
 
-        * arm.h: Rename relocations.
+	* arm.h: Rename relocations.
 
 1998-07-22  Ulrich Drepper  <drepper@cygnus.com>
 
diff --git a/include/elf/alpha.h b/include/elf/alpha.h
index 1ae9d5e..d353434 100644
--- a/include/elf/alpha.h
+++ b/include/elf/alpha.h
@@ -1,5 +1,5 @@
 /* ALPHA ELF support for BFD.
-   Copyright (C) 1996, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 98, 2000 Free Software Foundation, Inc.
 
    By Eric Youngdale, <eric@aib.com>.  No processor supplement available
    for this platform.
@@ -102,7 +102,6 @@
   RELOC_NUMBER (R_ALPHA_JMP_SLOT, 26)	/* Create PLT entry */
   RELOC_NUMBER (R_ALPHA_RELATIVE, 27)	/* Adjust by program base */
 
-  EMPTY_RELOC  (R_ALPHA_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_ALPHA_max)
 
 #endif /* _ELF_ALPHA_H */
diff --git a/include/elf/arc.h b/include/elf/arc.h
index 334b55f..84483fb 100644
--- a/include/elf/arc.h
+++ b/include/elf/arc.h
@@ -1,5 +1,5 @@
 /* ARC ELF support for BFD.
-   Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 97, 98, 2000 Free Software Foundation, Inc.
    Contributed by Doug Evans, (dje@cygnus.com)
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -31,8 +31,7 @@
   RELOC_NUMBER (R_ARC_32, 1)
   RELOC_NUMBER (R_ARC_B26, 2)
   RELOC_NUMBER (R_ARC_B22_PCREL, 3)
-  EMPTY_RELOC  (R_ARC_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_ARC_max)
 
 /* Processor specific flags for the ELF header e_flags field.  */
 
diff --git a/include/elf/arm.h b/include/elf/arm.h
index 04c46de..0499251 100644
--- a/include/elf/arm.h
+++ b/include/elf/arm.h
@@ -124,6 +124,6 @@
   RELOC_NUMBER (R_ARM_RABS32,         253)
   RELOC_NUMBER (R_ARM_RPC24,          254)
   RELOC_NUMBER (R_ARM_RBASE,          255)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_ARM_max)
 
 #endif /* _ELF_ARM_H */
diff --git a/include/elf/avr.h b/include/elf/avr.h
index 1527455..09cdf7b 100644
--- a/include/elf/avr.h
+++ b/include/elf/avr.h
@@ -30,6 +30,7 @@
 #define E_AVR_MACH_AVR2 2
 #define E_AVR_MACH_AVR3 3
 #define E_AVR_MACH_AVR4 4
+#define E_AVR_MACH_AVR5 5
 
 /* Relocations.  */
 START_RELOC_NUMBERS (elf_avr_reloc_type)
@@ -52,7 +53,6 @@
      RELOC_NUMBER (R_AVR_HI8_LDI_PM_NEG,       16)
      RELOC_NUMBER (R_AVR_HH8_LDI_PM_NEG,       17)
      RELOC_NUMBER (R_AVR_CALL,		       18)
-     EMPTY_RELOC  (R_AVR_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_AVR_max)
 
 #endif /* _ELF_AVR_H */
diff --git a/include/elf/common.h b/include/elf/common.h
index 09b9669..fc91da2 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -64,21 +64,21 @@
 #define ELFOSABI_LINUX  3       /* GNU/Linux */
 #define ELFOSABI_HURD   4       /* GNU/Hurd */
 #define ELFOSABI_SOLARIS 6      /* Solaris */
-#define ELFOSABI_MONTEREY 7     /* Monterey */
+#define ELFOSABI_AIX    7       /* AIX */
 #define ELFOSABI_IRIX   8       /* IRIX */
 #define ELFOSABI_FREEBSD 9      /* FreeBSD */
 #define ELFOSABI_TRU64  10      /* TRU64 UNIX */
 #define ELFOSABI_MODESTO 11     /* Novell Modesto */
 #define ELFOSABI_OPENBSD 12     /* OpenBSD */
 #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
-#define ELFOSABI_ARM   97		/* ARM */
+#define ELFOSABI_ARM   97	/* ARM */
 
 #define EI_ABIVERSION   8       /* ABI version */
 
 #define EI_PAD		9	/* Start of padding bytes */
 
 
-/* Values for e_type, which identifies the object file type */
+/* Values for e_type, which identifies the object file type.  */
 
 #define ET_NONE		0	/* No file type */
 #define ET_REL		1	/* Relocatable file */
@@ -90,7 +90,9 @@
 #define ET_LOPROC	0xFF00	/* Processor-specific */
 #define ET_HIPROC	0xFFFF	/* Processor-specific */
 
-/* Values for e_machine, which identifies the architecture */
+/* Values for e_machine, which identifies the architecture.  These numbers
+   are officially assigned by registry@sco.com.  See below for a list of
+   ad-hoc numbers used during initial development.  */
 
 #define EM_NONE		0	/* No machine */
 #define EM_M32		1	/* AT&T WE 32100 */
@@ -98,7 +100,7 @@
 #define EM_386		3	/* Intel 80386 */
 #define EM_68K		4	/* Motorola m68k family */
 #define EM_88K		5	/* Motorola m88k family */
-#define EM_486		6	/* Intel 80486 */
+#define EM_486		6	/* Intel 80486 *//* Reserved for future use */
 #define EM_860		7	/* Intel 80860 */
 #define EM_MIPS		8	/* MIPS R3000 (officially, big-endian only) */
 #define EM_S370		9	/* IBM System/370 */
@@ -140,6 +142,7 @@
 #define EM_ME16	       59	/* Toyota ME16 processor */
 #define EM_ST100       60	/* STMicroelectronics ST100 processor */
 #define EM_TINYJ       61	/* Advanced Logic Corp. TinyJ embedded processor */
+#define EM_X86_64      62       /* Advanced Micro Devices X86-64 processor */
 
 #define EM_FX66	       66	/* Siemens FX66 microcontroller */
 #define EM_ST9PLUS     67	/* STMicroelectronics ST9+ 8/16 bit microcontroller */
@@ -149,10 +152,15 @@
 #define EM_68HC08      71	/* Motorola MC68HC08 Microcontroller */
 #define EM_68HC05      72	/* Motorola MC68HC05 Microcontroller */
 #define EM_SVX         73	/* Silicon Graphics SVx */
-#define EM_ST19        74	/* STMicroelectronics ST19 8-bit microcontroller */
+#define EM_ST19        74	/* STMicroelectronics ST19 8-bit cpu */
 #define EM_VAX         75	/* Digital VAX */
-
-#define EM_PJ          99       /* picoJava */
+#define EM_CRIS	       76	/* Axis Communications 32-bit embedded processor */
+#define EM_JAVELIN     77	/* Infineon Technologies 32-bit embedded cpu */
+#define EM_FIREPATH    78	/* Element 14 64-bit DSP processor */
+#define EM_ZSP         79	/* LSI Logic's 16-bit DSP processor */
+#define EM_MMIX	       80	/* Donald Knuth's educational 64-bit processor */
+#define EM_HUANY       81	/* Harvard's machine-independent format */
+#define EM_PRISM       82	/* SiTera Prism */
 
 /* If it is necessary to assign new unofficial EM_* values, please pick large
    random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
@@ -160,7 +168,13 @@
 
    NOTE: Do not just increment the most recent number by one.
    Somebody else somewhere will do exactly the same thing, and you
-   will have a collision.  Instead, pick a random number.  */
+   will have a collision.  Instead, pick a random number.
+
+   Normally, each entity or maintainer responsible for a machine with an
+   unofficial e_machine number should eventually ask registry@sco.com for
+   an officially blessed number to be added to the list above.  */
+
+#define EM_PJ          99       /* picoJava */
 
 /* Cygnus PowerPC ELF backend.  Written in the absence of an ABI.  */
 #define EM_CYGNUS_POWERPC 0x9025
@@ -204,12 +218,12 @@
 
 /* See the above comment before you add a new EM_* value here.  */
 
-/* Values for e_version */
+/* Values for e_version.  */
 
 #define EV_NONE		0		/* Invalid ELF version */
 #define EV_CURRENT	1		/* Current version */
 
-/* Values for program header, p_type field */
+/* Values for program header, p_type field.  */
 
 #define	PT_NULL		0		/* Program header table entry unused */
 #define PT_LOAD		1		/* Loadable program segment */
@@ -223,7 +237,7 @@
 #define PT_LOPROC	0x70000000	/* Processor-specific */
 #define PT_HIPROC	0x7FFFFFFF	/* Processor-specific */
 
-/* Program segment permissions, in program header p_flags field */
+/* Program segment permissions, in program header p_flags field.  */
 
 #define PF_X		(1 << 0)	/* Segment is executable */
 #define PF_W		(1 << 1)	/* Segment is writable */
@@ -232,7 +246,7 @@
 #define PF_MASKOS	0x0FF00000	/* New value, Oct 4, 1999 Draft */
 #define PF_MASKPROC	0xF0000000	/* Processor-specific reserved bits */
 
-/* Values for section header, sh_type field */
+/* Values for section header, sh_type field.  */
 
 #define SHT_NULL	0		/* Section header table entry unused */
 #define SHT_PROGBITS	1		/* Program specific (private) data */
@@ -247,12 +261,14 @@
 #define SHT_SHLIB	10		/* Reserved, unspecified semantics */
 #define SHT_DYNSYM	11		/* Dynamic linking symbol table */
 
-#define SHT_INIT_ARRAY  14		/* Array of pointers to init functions */
-#define SHT_FINI_ARRAY  15		/* Array of pointers to finish functions */
-#define SHT_PREINIT_ARRAY 16		/* Array of pointers to pre-init functions */
+#define SHT_INIT_ARRAY    14		/* Array of ptrs to init functions */
+#define SHT_FINI_ARRAY    15		/* Array of ptrs to finish functions */
+#define SHT_PREINIT_ARRAY 16		/* Array of ptrs to pre-init funcs */
+#define SHT_GROUP         17		/* Section contains a section group */
+#define SHT_SYMTAB_SHNDX  18		/* Indicies for SHN_XINDEX entries */
 
-#define SHT_LOOS        0x60000000      /* Operating system specific semantics, lo */
-#define SHT_HIOS        0x6fffffff      /* Operating system specific semantics, hi */
+#define SHT_LOOS        0x60000000      /* First of OS specific semantics */
+#define SHT_HIOS        0x6fffffff      /* Last of OS specific semantics */
 
 /* The next three section types are defined by Solaris, and are named
    SHT_SUNW*.  We use them in GNU code, so we also define SHT_GNU*
@@ -271,7 +287,7 @@
 /* #define SHT_HIUSER	0x8FFFFFFF    *//* Application-specific semantics */
 #define SHT_HIUSER	0xFFFFFFFF	/* New value, defined in Oct 4, 1999 Draft */
 
-/* Values for section header, sh_flags field */
+/* Values for section header, sh_flags field.  */
 
 #define SHF_WRITE	(1 << 0)	/* Writable data during execution */
 #define SHF_ALLOC	(1 << 1)	/* Occupies memory during execution */
@@ -280,13 +296,14 @@
 #define SHF_STRINGS	(1 << 5)	/* Contains null terminated character strings */
 #define SHF_INFO_LINK	(1 << 6)	/* sh_info holds section header table index */
 #define SHF_LINK_ORDER  (1 << 7)	/* Preserve section ordering when linking */
-#define SHF_OS_NONCONFORMING (1 << 8)	/* OS specifci processing required */
+#define SHF_OS_NONCONFORMING (1 << 8)	/* OS specific processing required */
+#define SHF_GROUP	(1 << 9)	/* Member of a section group */
 
 /* #define SHF_MASKOS	0x0F000000    *//* OS-specific semantics */
 #define SHF_MASKOS	0x0FF00000	/* New value, Oct 4, 1999 Draft */
 #define SHF_MASKPROC	0xF0000000	/* Processor-specific semantics */
 
-/* Values of note segment descriptor types for core files. */
+/* Values of note segment descriptor types for core files.  */
 
 #define NT_PRSTATUS	1		/* Contains copy of prstatus struct */
 #define NT_FPREGSET	2		/* Contains copy of fpregset struct */
@@ -295,7 +312,7 @@
 #define NT_PRXFPREG     0x46e62b7f	/* Contains a user_xfpregs_struct; */
 					/*   note name must be "LINUX".  */
 
-/* Note segments for core files on dir-style procfs systems. */
+/* Note segments for core files on dir-style procfs systems.  */
 
 #define NT_PSTATUS	10		/* Has a struct pstatus */
 #define NT_FPREGS	12		/* Has a struct fpregset */
@@ -311,7 +328,7 @@
 
 /* These three macros disassemble and assemble a symbol table st_info field,
    which contains the symbol binding and symbol type.  The STB_ and STT_
-   defines identify the binding and type. */
+   defines identify the binding and type.  */
 
 #define ELF_ST_BIND(val)		(((unsigned int)(val)) >> 4)
 #define ELF_ST_TYPE(val)		((val) & 0xF)
@@ -337,7 +354,7 @@
 #define ELF64_ST_VISIBILITY  ELF_ST_VISIBILITY
 
 
-#define STN_UNDEF	0		/* undefined symbol index */
+#define STN_UNDEF	0		/* Undefined symbol index */
 
 #define STB_LOCAL	0		/* Symbol not visible outside obj */
 #define STB_GLOBAL	1		/* Symbol visible outside obj */
@@ -359,7 +376,7 @@
 #define STT_HIPROC	15		/* Application-specific semantics */
 
 /* Special section indices, which may show up in st_shndx fields, among
-   other places. */
+   other places.  */
 
 #define SHN_UNDEF	0		/* Undefined section reference */
 #define SHN_LORESERVE	0xFF00		/* Begin range of reserved indices */
@@ -367,9 +384,10 @@
 #define SHN_HIPROC	0xFF1F		/* End range of appl-specific */
 #define SHN_LOOS        0xFF20		/* OS specific semantics, lo */
 #define SHN_HIOS        0xFF3F		/* OS specific semantics, hi */
-#define SHN_ABS		0xFFF1		/* Associated symbol is absolute */
-#define SHN_COMMON	0xFFF2		/* Associated symbol is in common */
-#define SHN_HIRESERVE	0xFFFF		/* End range of reserved indices */
+#define SHN_ABS	        0xFFF1		/* Associated symbol is absolute */
+#define SHN_COMMON      0xFFF2		/* Associated symbol is in common */
+#define SHN_XINDEX      0xFFFF		/* Section index it held elsewhere */
+#define SHN_HIRESERVE   0xFFFF		/* End range of reserved indices */
 
 /* The following constants control how a symbol may be accessed once it has
    become part of an executable or shared library.  */
@@ -378,9 +396,8 @@
 #define STV_INTERNAL	1		/* OS specific version of STV_HIDDEN */
 #define STV_HIDDEN	2		/* Can only be seen inside currect component */
 #define STV_PROTECTED	3		/* Treat as STB_LOCAL inside current component */
-					   
 
-/* relocation info handling macros */
+/* Relocation info handling macros.  */
 
 #define ELF32_R_SYM(i)		((i) >> 8)
 #define ELF32_R_TYPE(i)		((i) & 0xff)
@@ -390,7 +407,7 @@
 #define ELF64_R_TYPE(i)		((i) & 0xffffffff)
 #define ELF64_R_INFO(s,t)	(((bfd_vma) (s) << 32) + (bfd_vma) (t))
 
-/* Dynamic section tags */
+/* Dynamic section tags.  */
 
 #define DT_NULL		0
 #define DT_NEEDED	1
@@ -444,16 +461,22 @@
    OS specific values.  This is a deliberate special case and we
    maintain it for backwards compatability.  */
 #define DT_VALRNGLO	0x6ffffd00
+#define DT_CHECKSUM	0x6ffffdf8
 #define DT_PLTPADSZ	0x6ffffdf9
 #define DT_MOVEENT	0x6ffffdfa
 #define DT_MOVESZ	0x6ffffdfb
-#define DT_FEATURE_1	0x6ffffdfc
+#define DT_FEATURE	0x6ffffdfc
 #define DT_POSFLAG_1	0x6ffffdfd
 #define DT_SYMINSZ	0x6ffffdfe
 #define DT_SYMINENT	0x6ffffdff
 #define DT_VALRNGHI	0x6ffffdff
 
 #define DT_ADDRRNGLO	0x6ffffe00
+#define DT_CONFIG	0x6ffffefa
+#define DT_DEPAUDIT	0x6ffffefb
+#define DT_AUDIT	0x6ffffefc
+#define DT_PLTPAD	0x6ffffefd
+#define DT_MOVETAB	0x6ffffefe
 #define DT_SYMINFO	0x6ffffeff
 #define DT_ADDRRNGHI	0x6ffffeff
 
@@ -478,14 +501,22 @@
 #define DT_USED		0x7ffffffe
 #define DT_FILTER	0x7fffffff
 
-/* Values used in DT_FEATURE_1 .dynamic entry.  */
+
+/* Values used in DT_FEATURE .dynamic entry.  */
 #define DTF_1_PARINIT	0x00000001
+/* From
+
+   http://docs.sun.com:80/ab2/coll.45.13/LLM/@Ab2PageView/21165?Ab2Lang=C&Ab2Enc=iso-8859-1
+
+   DTF_1_CONFEXP is the same as DTF_1_PARINIT. It is a typo. The value
+   defined here is the same as the one in <sys/link.h> on Solaris 8.  */
+#define DTF_1_CONFEXP	0x00000002
 
 /* Flag values used in the DT_POSFLAG_1 .dynamic entry.  */
 #define DF_P1_LAZYLOAD	0x00000001
 #define DF_P1_GROUPPERM	0x00000002
 
-/* Flag value in in the DT_1_FLAGS .dynamic entry.  */
+/* Flag value in in the DT_FLAGS_1 .dynamic entry.  */
 #define DF_1_NOW	0x00000001
 #define DF_1_GLOBAL	0x00000002
 #define DF_1_GROUP	0x00000004
@@ -497,6 +528,9 @@
 #define DF_1_DIRECT	0x00000100
 #define DF_1_TRANS	0x00000200
 #define DF_1_INTERPOSE	0x00000400
+#define DF_1_NODEFLIB	0x00000800
+#define DF_1_NODUMP	0x00001000
+#define DF_1_CONLFAT	0x00002000
 
 /* Flag values for the DT_FLAGS entry.  */
 #define DF_ORIGIN	(1 << 0)
@@ -546,19 +580,26 @@
 #define ELF_VER_CHR	'@'
 
 /* Possible values for si_boundto.  */
+
 #define SYMINFO_BT_SELF		0xffff	/* Symbol bound to self */
 #define SYMINFO_BT_PARENT	0xfffe	/* Symbol bound to parent */
 #define SYMINFO_BT_LOWRESERVE	0xff00	/* Beginning of reserved entries */
 
 /* Possible bitmasks for si_flags.  */
+
 #define SYMINFO_FLG_DIRECT	0x0001	/* Direct bound symbol */
 #define SYMINFO_FLG_PASSTHRU	0x0002	/* Pass-thru symbol for translator */
 #define SYMINFO_FLG_COPY	0x0004	/* Symbol is a copy-reloc */
-#define SYMINFO_FLG_LAZYLOAD	0x0008	/* Symbol bound to object to be lazy
-					   loaded */
+#define SYMINFO_FLG_LAZYLOAD	0x0008	/* Symbol bound to object to be lazy loaded */
+
 /* Syminfo version values.  */
+
 #define SYMINFO_NONE		0
 #define SYMINFO_CURRENT		1
 #define SYMINFO_NUM		2
 
+/* Section Group Flags.  */
+
+#define GRP_COMDAT		0x1	/* A COMDAT group */
+
 #endif /* _ELF_COMMON_H */
diff --git a/include/elf/cris.h b/include/elf/cris.h
new file mode 100644
index 0000000..957f194
--- /dev/null
+++ b/include/elf/cris.h
@@ -0,0 +1,47 @@
+/* CRIS ELF support for BFD.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Contributed by Axis Communications AB, Lund, Sweden.
+   Written by Hans-Peter Nilsson.
+
+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 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 _ELF_CRIS_H
+#define _ELF_CRIS_H
+
+#include "elf/reloc-macros.h"
+
+/* Relocations.  */
+START_RELOC_NUMBERS (elf_cris_reloc_type)
+  RELOC_NUMBER (R_CRIS_NONE,		0)
+  RELOC_NUMBER (R_CRIS_8,		1)
+  RELOC_NUMBER (R_CRIS_16,		2)
+  RELOC_NUMBER (R_CRIS_32,		3)
+  RELOC_NUMBER (R_CRIS_8_PCREL,		4)
+  RELOC_NUMBER (R_CRIS_16_PCREL,	5)
+  RELOC_NUMBER (R_CRIS_32_PCREL,	6)
+
+  RELOC_NUMBER (R_CRIS_GNU_VTINHERIT,	7)
+  RELOC_NUMBER (R_CRIS_GNU_VTENTRY,	8)
+
+  /* No other relocs must be visible outside the assembler.  */
+
+END_RELOC_NUMBERS (R_CRIS_max)
+
+/* User symbols in this file have a leading underscore.  */
+#define EF_CRIS_UNDERSCORE		0x00000001
+
+#endif /* _ELF_CRIS_H */
diff --git a/include/elf/d10v.h b/include/elf/d10v.h
index 63b79c8..96bfaf2 100644
--- a/include/elf/d10v.h
+++ b/include/elf/d10v.h
@@ -1,5 +1,5 @@
 /* d10v ELF support for BFD.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -33,6 +33,6 @@
   RELOC_NUMBER (R_D10V_32, 6)
   RELOC_NUMBER (R_D10V_GNU_VTINHERIT, 7)
   RELOC_NUMBER (R_D10V_GNU_VTENTRY, 8)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_D10V_max)
 
 #endif
diff --git a/include/elf/d30v.h b/include/elf/d30v.h
index adbad19..369aa4b 100644
--- a/include/elf/d30v.h
+++ b/include/elf/d30v.h
@@ -1,5 +1,5 @@
 /* d30v ELF support for BFD.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -37,6 +37,6 @@
   RELOC_NUMBER (R_D30V_32, 10)
   RELOC_NUMBER (R_D30V_32_PCREL, 11)
   RELOC_NUMBER (R_D30V_32_NORMAL, 12)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_D30V_max)
 
 #endif
diff --git a/include/elf/fr30.h b/include/elf/fr30.h
index 223b052..54c1ae6 100644
--- a/include/elf/fr30.h
+++ b/include/elf/fr30.h
@@ -1,5 +1,5 @@
 /* FR30 ELF support for BFD.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 99, 2000 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -37,7 +37,6 @@
   RELOC_NUMBER (R_FR30_12_PCREL, 10)
   RELOC_NUMBER (R_FR30_GNU_VTINHERIT, 11)
   RELOC_NUMBER (R_FR30_GNU_VTENTRY, 12)
-  EMPTY_RELOC  (R_FR30_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_FR30_max)
 
 #endif /* _ELF_FR30_H */
diff --git a/include/elf/hppa.h b/include/elf/hppa.h
index 0e45d74..e9ec03a 100644
--- a/include/elf/hppa.h
+++ b/include/elf/hppa.h
@@ -1,5 +1,5 @@
 /* HPPA ELF support for BFD.
-   Copyright (C) 1993, 1994, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 99, 2000 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -102,173 +102,385 @@
 #include "elf/reloc-macros.h"
 
 START_RELOC_NUMBERS (elf_hppa_reloc_type)
-     RELOC_NUMBER (R_PARISC_NONE,      0)	/* No reloc */
+RELOC_NUMBER (R_PARISC_NONE,	         0) /* No reloc */
 
-     /* These relocation types do simple base + offset relocations.  */
+/*		Data / Inst. Format	   Relocation Expression	  */
 
-     RELOC_NUMBER (R_PARISC_DIR32,  1)
-     RELOC_NUMBER (R_PARISC_DIR21L, 2)
-     RELOC_NUMBER (R_PARISC_DIR17R, 3)
-     RELOC_NUMBER (R_PARISC_DIR17F, 4)
-     RELOC_NUMBER (R_PARISC_DIR14R, 6)
+RELOC_NUMBER (R_PARISC_DIR32,	   	 1)
+/*		32-bit word            	   symbol + addend    		  */
 
-    /* PC-relative relocation types
-       Typically used for calls.
-       Note PCREL17C and PCREL17F differ only in overflow handling.
-       PCREL17C never reports a relocation error.
+RELOC_NUMBER (R_PARISC_DIR21L,	   	 2)
+/*		long immediate (7)	   LR(symbol, addend) 		  */
 
-       When supporting argument relocations, function calls must be
-       accompanied by parameter relocation information.  This information is
-       carried in the ten high-order bits of the addend field.  The remaining
-       22 bits of of the addend field are sign-extended to form the Addend.
+RELOC_NUMBER (R_PARISC_DIR17R,	   	 3)
+/*		branch external (19)	   RR(symbol, addend) 		  */
 
-       Note the code to build argument relocations depends on the
-       addend being zero.  A consequence of this limitation is GAS
-       can not perform relocation reductions for function symbols.  */
+RELOC_NUMBER (R_PARISC_DIR17F,	   	 4)
+/*		branch external (19)	   symbol + addend    		  */
 
-    RELOC_NUMBER (R_PARISC_PCREL32, 9)
-    RELOC_NUMBER (R_PARISC_PCREL21L, 10)
-    RELOC_NUMBER (R_PARISC_PCREL17R, 11)
-    RELOC_NUMBER (R_PARISC_PCREL17F, 12)
-    RELOC_NUMBER (R_PARISC_PCREL17C, 13)
-    RELOC_NUMBER (R_PARISC_PCREL14R, 14)
-    RELOC_NUMBER (R_PARISC_PCREL14F, 15)
+RELOC_NUMBER (R_PARISC_DIR14R,	   	 6)
+/*		load/store (1)		   RR(symbol, addend) 		  */
 
-    /* DP-relative relocation types.  */
-    RELOC_NUMBER (R_PARISC_DPREL21L, 18)
-    RELOC_NUMBER (R_PARISC_DPREL14WR, 19)
-    RELOC_NUMBER (R_PARISC_DPREL14DR, 20)
-    RELOC_NUMBER (R_PARISC_DPREL14R, 22)
-    RELOC_NUMBER (R_PARISC_DPREL14F, 23)
+RELOC_NUMBER (R_PARISC_DIR14F,	   	 7)
+/*		load/store (1)		   symbol, addend 		  */
 
-    /* Data linkage table (DLT) relocation types
+/* PC-relative relocation types
+   Typically used for calls.
+   Note PCREL17C and PCREL17F differ only in overflow handling.
+   PCREL17C never reports a relocation error.
 
-       SOM DLT_REL fixup requests are used to for static data references
-       from position-independent code within shared libraries.  They are
-       similar to the GOT relocation types in some SVR4 implementations.  */
+   When supporting argument relocations, function calls must be
+   accompanied by parameter relocation information.  This information is
+   carried in the ten high-order bits of the addend field.  The remaining
+   22 bits of of the addend field are sign-extended to form the Addend.
 
-    RELOC_NUMBER (R_PARISC_DLTREL21L, 26)
-    RELOC_NUMBER (R_PARISC_DLTREL14R, 30)
-    RELOC_NUMBER (R_PARISC_DLTREL14F, 31)
+   Note the code to build argument relocations depends on the
+   addend being zero.  A consequence of this limitation is GAS
+   can not perform relocation reductions for function symbols.  */
 
-    /* DLT indirect relocation types  */
-    RELOC_NUMBER (R_PARISC_DLTIND21L, 34)
-    RELOC_NUMBER (R_PARISC_DLTIND14R, 38)
-    RELOC_NUMBER (R_PARISC_DLTIND14F, 39)
+RELOC_NUMBER (R_PARISC_PCREL12F,  	 8)
+/*		op & branch (17)	   symbol - PC - 8 + addend    	  */
 
-    /* Base relative relocation types.  Ugh.  These imply lots of state */
-    RELOC_NUMBER (R_PARISC_SETBASE, 40)
-    RELOC_NUMBER (R_PARISC_SECREL32, 41)
-    RELOC_NUMBER (R_PARISC_BASEREL21L, 42)
-    RELOC_NUMBER (R_PARISC_BASEREL17R, 43)
-    RELOC_NUMBER (R_PARISC_BASEREL17F, 44)
-    RELOC_NUMBER (R_PARISC_BASEREL14R, 46)
-    RELOC_NUMBER (R_PARISC_BASEREL14F, 47)
+RELOC_NUMBER (R_PARISC_PCREL32,   	 9)
+/*		32-bit word		   symbol - PC - 8 + addend    	  */
 
-    /* Segment relative relocation types.  */
-    RELOC_NUMBER (R_PARISC_SEGBASE, 48)
-    RELOC_NUMBER (R_PARISC_SEGREL32, 49)
+RELOC_NUMBER (R_PARISC_PCREL21L,  	10)
+/*		long immediate (7)	   L(symbol - PC - 8 + addend) 	  */
 
-    /* Offsets from the PLT.  */
-    RELOC_NUMBER (R_PARISC_PLTOFF21L, 50)
-    RELOC_NUMBER (R_PARISC_PLTOFF14R, 54)
-    RELOC_NUMBER (R_PARISC_PLTOFF14F, 55)
+RELOC_NUMBER (R_PARISC_PCREL17R,  	11)
+/*		branch external (19)	   R(symbol - PC - 8 + addend) 	  */
 
-    RELOC_NUMBER (R_PARISC_LTOFF_FPTR32, 57)
-    RELOC_NUMBER (R_PARISC_LTOFF_FPTR21L, 58)
-    RELOC_NUMBER (R_PARISC_LTOFF_FPTR14R, 62)
+RELOC_NUMBER (R_PARISC_PCREL17F,  	12)
+/*		branch (20)		   symbol - PC - 8 + addend    	  */
 
-    RELOC_NUMBER (R_PARISC_FPTR64, 64)
+RELOC_NUMBER (R_PARISC_PCREL17C,  	13)
+/*		branch (20)		   symbol - PC - 8 + addend    	  */
 
-    /* Plabel relocation types.  */
-    RELOC_NUMBER (R_PARISC_PLABEL32, 65)
-    RELOC_NUMBER (R_PARISC_PLABEL21L, 66)
-    RELOC_NUMBER (R_PARISC_PLABEL14R, 70)
+RELOC_NUMBER (R_PARISC_PCREL14R,  	14)
+/*		load/store (1)		   R(symbol - PC - 8 + addend) 	  */
 
-    /* PCREL relocations.  */
-    RELOC_NUMBER (R_PARISC_PCREL64, 72)
-    RELOC_NUMBER (R_PARISC_PCREL22C, 73)
-    RELOC_NUMBER (R_PARISC_PCREL22F, 74)
-    RELOC_NUMBER (R_PARISC_PCREL14WR, 75)
-    RELOC_NUMBER (R_PARISC_PCREL14DR, 76)
-    RELOC_NUMBER (R_PARISC_PCREL16F, 77)
-    RELOC_NUMBER (R_PARISC_PCREL16WF, 78)
-    RELOC_NUMBER (R_PARISC_PCREL16DF, 79)
+RELOC_NUMBER (R_PARISC_PCREL14F,  	15)
+/*		load/store (1)             symbol - PC - 8 + addend    	  */
 
 
-    RELOC_NUMBER (R_PARISC_DIR64, 80)
-    RELOC_NUMBER (R_PARISC_DIR64WR, 81)
-    RELOC_NUMBER (R_PARISC_DIR64DR, 82)
-    RELOC_NUMBER (R_PARISC_DIR14WR, 83)
-    RELOC_NUMBER (R_PARISC_DIR14DR, 84)
-    RELOC_NUMBER (R_PARISC_DIR16F, 85)
-    RELOC_NUMBER (R_PARISC_DIR16WF, 86)
-    RELOC_NUMBER (R_PARISC_DIR16DF, 87)
+/* DP-relative relocation types.  */
+RELOC_NUMBER (R_PARISC_DPREL21L,  	18)
+/*		long immediate (7)         LR(symbol - GP, addend)  	  */
 
-    RELOC_NUMBER (R_PARISC_GPREL64, 88)
+RELOC_NUMBER (R_PARISC_DPREL14WR, 	19)
+/*		load/store mod. comp. (2)  RR(symbol - GP, addend)  	  */
 
-    RELOC_NUMBER (R_PARISC_DLTREL14WR, 91)
-    RELOC_NUMBER (R_PARISC_DLTREL14DR, 92)
-    RELOC_NUMBER (R_PARISC_GPREL16F, 93)
-    RELOC_NUMBER (R_PARISC_GPREL16WF, 94)
-    RELOC_NUMBER (R_PARISC_GPREL16DF, 95)
+RELOC_NUMBER (R_PARISC_DPREL14DR, 	20)
+/*		load/store doubleword (3)  RR(symbol - GP, addend)  	  */
+
+RELOC_NUMBER (R_PARISC_DPREL14R,  	22)
+/*		load/store (1)             RR(symbol - GP, addend)  	  */
+
+RELOC_NUMBER (R_PARISC_DPREL14F,  	23)
+/*		load/store (1)             symbol - GP + addend     	  */
 
 
-    RELOC_NUMBER (R_PARISC_LTOFF64, 96)
-    RELOC_NUMBER (R_PARISC_DLTIND14WR, 99)
-    RELOC_NUMBER (R_PARISC_DLTIND14DR, 100)
-    RELOC_NUMBER (R_PARISC_LTOFF16F, 101)
-    RELOC_NUMBER (R_PARISC_LTOFF16WF, 102)
-    RELOC_NUMBER (R_PARISC_LTOFF16DF, 103)
+/* Data linkage table (DLT) relocation types
 
-    RELOC_NUMBER (R_PARISC_SECREL64, 104)
+   SOM DLT_REL fixup requests are used to for static data references
+   from position-independent code within shared libraries.  They are
+   similar to the GOT relocation types in some SVR4 implementations.  */
 
-    RELOC_NUMBER (R_PARISC_BASEREL14WR, 107)
-    RELOC_NUMBER (R_PARISC_BASEREL14DR, 108)
+RELOC_NUMBER (R_PARISC_DLTREL21L,     	26)
+/*		long immediate (7)         LR(symbol - GP, addend) 	  */
 
-    RELOC_NUMBER (R_PARISC_SEGREL64, 112)
+RELOC_NUMBER (R_PARISC_DLTREL14R,     	30)
+/*		load/store (1)             RR(symbol - GP, addend) 	  */
 
-    RELOC_NUMBER (R_PARISC_PLTOFF14WR, 115)
-    RELOC_NUMBER (R_PARISC_PLTOFF14DR, 116)
-    RELOC_NUMBER (R_PARISC_PLTOFF16F, 117)
-    RELOC_NUMBER (R_PARISC_PLTOFF16WF, 118)
-    RELOC_NUMBER (R_PARISC_PLTOFF16DF, 119)
-
-    RELOC_NUMBER (R_PARISC_LTOFF_FPTR64, 120)
-    RELOC_NUMBER (R_PARISC_LTOFF_FPTR14WR, 123)
-    RELOC_NUMBER (R_PARISC_LTOFF_FPTR14DR, 124)
-    RELOC_NUMBER (R_PARISC_LTOFF_FPTR16F, 125)
-    RELOC_NUMBER (R_PARISC_LTOFF_FPTR16WF, 126)
-    RELOC_NUMBER (R_PARISC_LTOFF_FPTR16DF, 127)
+RELOC_NUMBER (R_PARISC_DLTREL14F,     	31)
+/*		load/store (1)             symbol - GP + addend    	  */
 
 
-    RELOC_NUMBER (R_PARISC_COPY, 128)
-    RELOC_NUMBER (R_PARISC_IPLT, 129)
-    RELOC_NUMBER (R_PARISC_EPLT, 130)
+/* DLT indirect relocation types  */
+RELOC_NUMBER (R_PARISC_DLTIND21L,     	34)
+/*		long immediate (7)         L(ltoff(symbol + addend)) 	  */
 
-    RELOC_NUMBER (R_PARISC_TPREL32, 153)
-    RELOC_NUMBER (R_PARISC_TPREL21L, 154)
-    RELOC_NUMBER (R_PARISC_TPREL14R, 158)
+RELOC_NUMBER (R_PARISC_DLTIND14R,     	38)
+/*		load/store (1)             R(ltoff(symbol + addend)) 	  */
 
-    RELOC_NUMBER (R_PARISC_LTOFF_TP21L, 162)
-    RELOC_NUMBER (R_PARISC_LTOFF_TP14R, 166)
-    RELOC_NUMBER (R_PARISC_LTOFF_TP14F, 167)
+RELOC_NUMBER (R_PARISC_DLTIND14F,     	39)
+/*		load/store (1)             ltoff(symbol + addend)    	  */
 
-    RELOC_NUMBER (R_PARISC_TPREL64, 216)
-    RELOC_NUMBER (R_PARISC_TPREL14WR, 219)
-    RELOC_NUMBER (R_PARISC_TPREL14DR, 220)
-    RELOC_NUMBER (R_PARISC_TPREL16F, 221)
-    RELOC_NUMBER (R_PARISC_TPREL16WF, 222)
-    RELOC_NUMBER (R_PARISC_TPREL16DF, 223)
 
-    RELOC_NUMBER (R_PARISC_LTOFF_TP64, 224)
-    RELOC_NUMBER (R_PARISC_LTOFF_TP14WR, 227)
-    RELOC_NUMBER (R_PARISC_LTOFF_TP14DR, 228)
-    RELOC_NUMBER (R_PARISC_LTOFF_TP16F, 229)
-    RELOC_NUMBER (R_PARISC_LTOFF_TP16WF, 230)
-    RELOC_NUMBER (R_PARISC_LTOFF_TP16DF, 231)
-    EMPTY_RELOC (R_PARISC_UNIMPLEMENTED)
-END_RELOC_NUMBERS
+/* Base relative relocation types.  Ugh.  These imply lots of state */
+RELOC_NUMBER (R_PARISC_SETBASE,       	40)
+/*		none                       no reloc; base := sym     	  */
+
+RELOC_NUMBER (R_PARISC_SECREL32,      	41)
+/*		32-bit word                symbol - SECT + addend    	  */
+
+RELOC_NUMBER (R_PARISC_BASEREL21L,    	42)
+/*		long immediate (7)         LR(symbol - base, addend) 	  */
+
+RELOC_NUMBER (R_PARISC_BASEREL17R,    	43)
+/*		branch external (19)       RR(symbol - base, addend) 	  */
+
+RELOC_NUMBER (R_PARISC_BASEREL17F,    	44)
+/*		branch external (19)       symbol - base + addend    	  */
+
+RELOC_NUMBER (R_PARISC_BASEREL14R,    	46)
+/*		load/store (1)             RR(symbol - base, addend) 	  */
+
+RELOC_NUMBER (R_PARISC_BASEREL14F,    	47)
+/*		load/store (1)             symbol - base, addend     	  */
+
+
+/* Segment relative relocation types.  */
+RELOC_NUMBER (R_PARISC_SEGBASE,       	48)
+/*		none                       no relocation; SB := sym  	  */
+
+RELOC_NUMBER (R_PARISC_SEGREL32,      	49)
+/*		32-bit word                symbol - SB + addend 	  */
+  
+
+/* Offsets from the PLT.  */  
+RELOC_NUMBER (R_PARISC_PLTOFF21L,     	50)
+/*		long immediate (7)         LR(pltoff(symbol), addend) 	  */
+
+RELOC_NUMBER (R_PARISC_PLTOFF14R,     	54)
+/*		load/store (1)             RR(pltoff(symbol), addend) 	  */
+
+RELOC_NUMBER (R_PARISC_PLTOFF14F,     	55)
+/*		load/store (1)             pltoff(symbol) + addend    	  */
+
+
+RELOC_NUMBER (R_PARISC_LTOFF_FPTR32,  	57)
+/*		32-bit word                ltoff(fptr(symbol+addend))     */
+
+RELOC_NUMBER (R_PARISC_LTOFF_FPTR21L, 	58)
+/*		long immediate (7)         L(ltoff(fptr(symbol+addend)))  */
+
+RELOC_NUMBER (R_PARISC_LTOFF_FPTR14R, 	62)
+/*		load/store (1)             R(ltoff(fptr(symbol+addend)))  */
+
+
+RELOC_NUMBER (R_PARISC_FPTR64,        	64)
+/*		64-bit doubleword          fptr(symbol+addend) 		  */
+
+
+/* Plabel relocation types.  */	 
+RELOC_NUMBER (R_PARISC_PLABEL32,      	65)
+/*		32-bit word	  	   fptr(symbol) 		  */
+
+RELOC_NUMBER (R_PARISC_PLABEL21L,     	66)
+/*		long immediate (7)         L(fptr(symbol))		  */
+
+RELOC_NUMBER (R_PARISC_PLABEL14R,     	70)
+/*		load/store (1)             R(fptr(symbol))		  */
+
+  
+/* PCREL relocations.  */  
+RELOC_NUMBER (R_PARISC_PCREL64,       	72)
+/*		64-bit doubleword          symbol - PC - 8 + addend       */
+
+RELOC_NUMBER (R_PARISC_PCREL22C,      	73)
+/*		branch & link (21)         symbol - PC - 8 + addend       */
+
+RELOC_NUMBER (R_PARISC_PCREL22F,      	74)
+/*		branch & link (21)         symbol - PC - 8 + addend       */
+
+RELOC_NUMBER (R_PARISC_PCREL14WR,     	75)
+/*		load/store mod. comp. (2)  R(symbol - PC - 8 + addend)    */
+
+RELOC_NUMBER (R_PARISC_PCREL14DR,     	76)
+/*		load/store doubleword (3)  R(symbol - PC - 8 + addend)    */
+
+RELOC_NUMBER (R_PARISC_PCREL16F,      	77)
+/*		load/store (1)             symbol - PC - 8 + addend       */
+
+RELOC_NUMBER (R_PARISC_PCREL16WF,     	78)
+/*		load/store mod. comp. (2)  symbol - PC - 8 + addend       */
+
+RELOC_NUMBER (R_PARISC_PCREL16DF,     	79)
+/*		load/store doubleword (3)  symbol - PC - 8 + addend       */
+
+
+RELOC_NUMBER (R_PARISC_DIR64,         	80)
+/*		64-bit doubleword          symbol + addend    		  */
+
+RELOC_NUMBER (R_PARISC_DIR64WR,       	81)
+/*		64-bit doubleword          RR(symbol, addend) 		  */
+
+RELOC_NUMBER (R_PARISC_DIR64DR,       	82)
+/*		64-bit doubleword          RR(symbol, addend) 		  */
+
+RELOC_NUMBER (R_PARISC_DIR14WR,       	83)
+/*		load/store mod. comp. (2)  RR(symbol, addend) 		  */
+
+RELOC_NUMBER (R_PARISC_DIR14DR,       	84)
+/*		load/store doubleword (3)  RR(symbol, addend) 		  */
+
+RELOC_NUMBER (R_PARISC_DIR16F,        	85)
+/*		load/store (1)             symbol + addend    		  */
+
+RELOC_NUMBER (R_PARISC_DIR16WF,       	86)
+/*		load/store mod. comp. (2)  symbol + addend    		  */
+
+RELOC_NUMBER (R_PARISC_DIR16DF,       	87)
+/*		load/store doubleword (3)  symbol + addend    		  */
+  
+RELOC_NUMBER (R_PARISC_GPREL64,       	88)
+/*		64-bit doubleword          symbol - GP + addend 	  */
+  
+RELOC_NUMBER (R_PARISC_DLTREL14WR,    	91)
+/*		load/store mod. comp. (2)  RR(symbol - GP, addend) 	  */
+
+RELOC_NUMBER (R_PARISC_DLTREL14DR,    	92)
+/*		load/store doubleword (3)  RR(symbol - GP, addend) 	  */
+
+RELOC_NUMBER (R_PARISC_GPREL16F,      	93)
+/*		load/store (1)             symbol - GP + addend    	  */
+
+RELOC_NUMBER (R_PARISC_GPREL16WF,     	94)
+/*		load/store mod. comp. (2)  symbol - GP + addend    	  */
+
+RELOC_NUMBER (R_PARISC_GPREL16DF,     	95)
+/*		load/store doubleword (3)  symbol - GP + addend    	  */
+
+
+RELOC_NUMBER (R_PARISC_LTOFF64,      	96)
+/*		64-bit doubleword          ltoff(symbol + addend)    	  */
+
+RELOC_NUMBER (R_PARISC_DLTIND14WR,   	99)
+/*		load/store mod. comp. (2)  R(ltoff(symbol + addend)) 	  */
+
+RELOC_NUMBER (R_PARISC_DLTIND14DR,     100)
+/*		load/store doubleword (3)  R(ltoff(symbol + addend)) 	  */
+
+RELOC_NUMBER (R_PARISC_LTOFF16F,       101)
+/*		load/store (1)             ltoff(symbol + addend)    	  */
+
+RELOC_NUMBER (R_PARISC_LTOFF16WF,      102)
+/*		load/store mod. comp. (2)  ltoff(symbol + addend)    	  */
+
+RELOC_NUMBER (R_PARISC_LTOFF16DF,      103)
+/*		load/store doubleword (3)  ltoff(symbol + addend)    	  */
+
+
+RELOC_NUMBER (R_PARISC_SECREL64,       104)
+/*		64-bit doubleword          symbol - SECT + addend 	  */
+
+RELOC_NUMBER (R_PARISC_BASEREL14WR,    107)
+/*		load/store mod. comp. (2)  RR(symbol - base, addend) 	  */
+
+RELOC_NUMBER (R_PARISC_BASEREL14DR,    108)
+/*		load/store doubleword (3)  RR(symbol - base, addend) 	  */
+
+
+RELOC_NUMBER (R_PARISC_SEGREL64,       112)
+/*		64-bit doubleword          symbol - SB + addend 	  */
+  
+RELOC_NUMBER (R_PARISC_PLTOFF14WR,     115)
+/*		load/store mod. comp. (2)  RR(pltoff(symbol), addend) 	  */
+
+RELOC_NUMBER (R_PARISC_PLTOFF14DR,     116)    
+/*		load/store doubleword (3)  RR(pltoff(symbol), addend) 	  */
+
+RELOC_NUMBER (R_PARISC_PLTOFF16F,      117)    
+/*		load/store (1)             pltoff(symbol) + addend    	  */
+
+RELOC_NUMBER (R_PARISC_PLTOFF16WF,     118)    
+/*		load/store mod. comp. (2)  pltoff(symbol) + addend    	  */
+
+RELOC_NUMBER (R_PARISC_PLTOFF16DF,     119)    
+/*		load/store doubleword (3)  pltoff(symbol) + addend    	  */
+
+
+RELOC_NUMBER (R_PARISC_LTOFF_FPTR64,   120)
+/*		64-bit doubleword          ltoff(fptr(symbol+addend))     */
+
+RELOC_NUMBER (R_PARISC_LTOFF_FPTR14WR, 123)
+/*		load/store mod. comp. (2)  R(ltoff(fptr(symbol+addend)))  */
+
+RELOC_NUMBER (R_PARISC_LTOFF_FPTR14DR, 124)
+/*		load/store doubleword (3)  R(ltoff(fptr(symbol+addend)))  */
+
+RELOC_NUMBER (R_PARISC_LTOFF_FPTR16F,  125)
+/*		load/store (1)             ltoff(fptr(symbol+addend))     */
+
+RELOC_NUMBER (R_PARISC_LTOFF_FPTR16WF, 126)
+/*		load/store mod. comp. (2)  ltoff(fptr(symbol+addend))     */
+
+RELOC_NUMBER (R_PARISC_LTOFF_FPTR16DF, 127)
+/*		load/store doubleword (3)  ltoff(fptr(symbol+addend))     */
+
+
+RELOC_NUMBER (R_PARISC_COPY, 	       128)
+/*		data                       Dynamic relocations only 	  */
+
+RELOC_NUMBER (R_PARISC_IPLT, 	       129)
+/*		plt                                                 	  */
+
+RELOC_NUMBER (R_PARISC_EPLT, 	       130)
+/*		plt                                                 	  */
+
+
+RELOC_NUMBER (R_PARISC_TPREL32,        153)
+/*		32-bit word                symbol - TP + addend    	  */
+
+RELOC_NUMBER (R_PARISC_TPREL21L,       154)
+/*		long immediate (7)         LR(symbol - TP, addend) 	  */
+
+RELOC_NUMBER (R_PARISC_TPREL14R,       158)
+/*		load/store (1)             RR(symbol - TP, addend) 	  */
+
+
+RELOC_NUMBER (R_PARISC_LTOFF_TP21L,    162)
+/*		long immediate (7)         L(ltoff(symbol - TP + addend)) */
+
+RELOC_NUMBER (R_PARISC_LTOFF_TP14R,    166)
+/*		load/store (1)             R(ltoff(symbol - TP + addend)) */
+
+RELOC_NUMBER (R_PARISC_LTOFF_TP14F,    167)
+/*		load/store (1)             ltoff(symbol - TP + addend)    */
+
+
+RELOC_NUMBER (R_PARISC_TPREL64,        216)
+/*		64-bit word                symbol - TP + addend        	  */
+
+RELOC_NUMBER (R_PARISC_TPREL14WR,      219)    	  
+/*		load/store mod. comp. (2)  RR(symbol - TP, addend)     	  */
+
+RELOC_NUMBER (R_PARISC_TPREL14DR,      220)    	  
+/*		load/store doubleword (3)  RR(symbol - TP, addend)     	  */
+
+RELOC_NUMBER (R_PARISC_TPREL16F,       221)    	  
+/*		load/store (1)             symbol - TP + addend        	  */
+
+RELOC_NUMBER (R_PARISC_TPREL16WF,      222)    	  
+/*		load/store mod. comp. (2)  symbol - TP + addend        	  */
+
+RELOC_NUMBER (R_PARISC_TPREL16DF,      223)    	  
+/*		load/store doubleword (3)  symbol - TP + addend        	  */
+
+
+RELOC_NUMBER (R_PARISC_LTOFF_TP64,     224)
+/*		64-bit doubleword          ltoff(symbol - TP + addend)    */
+
+RELOC_NUMBER (R_PARISC_LTOFF_TP14WR,   227)
+/*		load/store mod. comp. (2)  R(ltoff(symbol - TP + addend)) */
+
+RELOC_NUMBER (R_PARISC_LTOFF_TP14DR,   228)
+/*		load/store doubleword (3)  R(ltoff(symbol - TP + addend)) */
+
+RELOC_NUMBER (R_PARISC_LTOFF_TP16F,    229)
+/*		load/store (1)             ltoff(symbol - TP + addend)    */
+
+RELOC_NUMBER (R_PARISC_LTOFF_TP16WF,   230)
+/*		load/store mod. comp. (2)  ltoff(symbol - TP + addend)    */
+
+RELOC_NUMBER (R_PARISC_LTOFF_TP16DF,   231)
+/*		load/store doubleword (3)  ltoff(symbol - TP + addend)    */
+
+RELOC_NUMBER (R_PARISC_GNU_VTENTRY,    232)
+RELOC_NUMBER (R_PARISC_GNU_VTINHERIT,  233)
+
+END_RELOC_NUMBERS (R_PARISC_UNIMPLEMENTED)
 
 #ifndef RELOC_MACROS_GEN_FUNC
 typedef enum elf_hppa_reloc_type elf_hppa_reloc_type;
@@ -288,19 +500,22 @@
 
 /* Processor specific dynamic array tags.  */
 
-#define DT_HP_LOAD_MAP		(DT_LOOS + 0x0)
-#define DT_HP_DLD_FLAGS		(DT_LOOS + 0x1)
-#define DT_HP_DLD_HOOK		(DT_LOOS + 0x2)
-#define DT_HP_UX10_INIT		(DT_LOOS + 0x3)
-#define DT_HP_UX10_INITSZ	(DT_LOOS + 0x4)
-#define DT_HP_PREINIT		(DT_LOOS + 0x5)
-#define DT_HP_PREINITSZ		(DT_LOOS + 0x6)
-#define DT_HP_NEEDED		(DT_LOOS + 0x7)
-#define DT_HP_TIME_STAMP	(DT_LOOS + 0x8)
-#define DT_HP_CHECKSUM		(DT_LOOS + 0x9)
-#define DT_HP_GST_SIZE		(DT_LOOS + 0xa)
-#define DT_HP_GST_VERSION	(DT_LOOS + 0xb)
-#define DT_HP_GST_HASHVAL	(DT_LOOS + 0xc)
+/* Arggh.  HP's tools define these symbols based on the
+   old value of DT_LOOS.  So we must do the same to be
+   compatible.  */
+#define DT_HP_LOAD_MAP		(OLD_DT_LOOS + 0x0)
+#define DT_HP_DLD_FLAGS		(OLD_DT_LOOS + 0x1)
+#define DT_HP_DLD_HOOK		(OLD_DT_LOOS + 0x2)
+#define DT_HP_UX10_INIT		(OLD_DT_LOOS + 0x3)
+#define DT_HP_UX10_INITSZ	(OLD_DT_LOOS + 0x4)
+#define DT_HP_PREINIT		(OLD_DT_LOOS + 0x5)
+#define DT_HP_PREINITSZ		(OLD_DT_LOOS + 0x6)
+#define DT_HP_NEEDED		(OLD_DT_LOOS + 0x7)
+#define DT_HP_TIME_STAMP	(OLD_DT_LOOS + 0x8)
+#define DT_HP_CHECKSUM		(OLD_DT_LOOS + 0x9)
+#define DT_HP_GST_SIZE		(OLD_DT_LOOS + 0xa)
+#define DT_HP_GST_VERSION	(OLD_DT_LOOS + 0xb)
+#define DT_HP_GST_HASHVAL	(OLD_DT_LOOS + 0xc)
 
 /* Values for DT_HP_DLD_FLAGS.  */
 #define DT_HP_DEBUG_PRIVATE		0x0001 /* Map text private */
diff --git a/include/elf/i370.h b/include/elf/i370.h
index 9c021f0..b4e21aa 100644
--- a/include/elf/i370.h
+++ b/include/elf/i370.h
@@ -1,5 +1,5 @@
 /* i370 ELF support for BFD.
-   Copyright (C) 1995, 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
diff --git a/include/elf/i386.h b/include/elf/i386.h
index 0586661..c91f4be 100644
--- a/include/elf/i386.h
+++ b/include/elf/i386.h
@@ -1,5 +1,5 @@
 /* ix86 ELF support for BFD.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 99, 2000 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -40,10 +40,9 @@
      RELOC_NUMBER (R_386_PC16,     21)
      RELOC_NUMBER (R_386_8,	   22)
      RELOC_NUMBER (R_386_PC8,      23)
-     RELOC_NUMBER (R_386_max,	   24)
      /* These are GNU extensions to enable C++ vtable garbage collection.  */
      RELOC_NUMBER (R_386_GNU_VTINHERIT, 250)
      RELOC_NUMBER (R_386_GNU_VTENTRY, 251)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_386_max)
 
 #endif
diff --git a/include/elf/i860.h b/include/elf/i860.h
new file mode 100644
index 0000000..08b2ff5
--- /dev/null
+++ b/include/elf/i860.h
@@ -0,0 +1,66 @@
+/* i860 ELF support for BFD.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+
+   Contributed by Jason Eckhardt <jle@cygnus.com>.
+
+   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 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 _ELF_I860_H
+#define _ELF_I860_H
+
+/* Note: i860 ELF is defined to use only RELA relocations.  */
+
+#include "elf/reloc-macros.h"
+
+START_RELOC_NUMBERS (elf_i860_reloc_type)
+     RELOC_NUMBER (R_860_NONE,      0x00)	/* No reloc */
+     RELOC_NUMBER (R_860_32,        0x01)	/* S+A  */
+     RELOC_NUMBER (R_860_COPY,	    0x02)	/* No calculation */
+     RELOC_NUMBER (R_860_GLOB_DAT,  0x03)	/* S, Create GOT entry */
+     RELOC_NUMBER (R_860_JUMP_SLOT, 0x04)	/* S+A, Create PLT entry */
+     RELOC_NUMBER (R_860_RELATIVE,  0x05)	/* B+A, Adj by program base */
+     RELOC_NUMBER (R_860_PC26,      0x30)	/* (S+A-P) >> 2 */ 
+     RELOC_NUMBER (R_860_PLT26,	    0x31)	/* (L+A-P) >> 2 */
+     RELOC_NUMBER (R_860_PC16,      0x32)	/* (S+A-P) >> 2 */
+     RELOC_NUMBER (R_860_LOW0,      0x40)	/* S+A */
+     RELOC_NUMBER (R_860_SPLIT0,    0x42)	/* S+A */       
+     RELOC_NUMBER (R_860_LOW1,      0x44)	/* S+A */
+     RELOC_NUMBER (R_860_SPLIT1,    0x46)	/* S+A */
+     RELOC_NUMBER (R_860_LOW2,      0x48)	/* S+A */
+     RELOC_NUMBER (R_860_SPLIT2,    0x4A)	/* S+A */
+     RELOC_NUMBER (R_860_LOW3,      0x4C)	/* S+A */
+     RELOC_NUMBER (R_860_LOGOT0,    0x50)	/* G */
+     RELOC_NUMBER (R_860_SPGOT0,    0x52)	/* G */
+     RELOC_NUMBER (R_860_LOGOT1,    0x54)	/* G */
+     RELOC_NUMBER (R_860_SPGOT1,    0x56)	/* G */
+     RELOC_NUMBER (R_860_LOGOTOFF0, 0x60)	/* O */
+     RELOC_NUMBER (R_860_SPGOTOFF0, 0x62)	/* O */
+     RELOC_NUMBER (R_860_LOGOTOFF1, 0x64)	/* O */
+     RELOC_NUMBER (R_860_SPGOTOFF1, 0x66)	/* O */
+     RELOC_NUMBER (R_860_LOGOTOFF2, 0x68)	/* O */
+     RELOC_NUMBER (R_860_LOGOTOFF3, 0x6C)	/* O */
+     RELOC_NUMBER (R_860_LOPC,      0x70)	/* (S+A-P) >> 2 */
+     RELOC_NUMBER (R_860_HIGHADJ,   0x80)	/* hiadj(S+A) */
+     RELOC_NUMBER (R_860_HAGOT,     0x90)	/* hiadj(G) */
+     RELOC_NUMBER (R_860_HAGOTOFF,  0xA0)	/* hiadj(O) */
+     RELOC_NUMBER (R_860_HAPC,      0xB0)	/* hiadj((S+A-P) >> 2) */
+     RELOC_NUMBER (R_860_HIGH,      0xC0)	/* (S+A) >> 16 */
+     RELOC_NUMBER (R_860_HIGOT,     0xD0)	/* G >> 16 */
+     RELOC_NUMBER (R_860_HIGOTOFF,  0xE0)	/* O */
+END_RELOC_NUMBERS (R_860_max)
+
+#endif
diff --git a/include/elf/i960.h b/include/elf/i960.h
index 3e60289..cbf67d7 100644
--- a/include/elf/i960.h
+++ b/include/elf/i960.h
@@ -1,5 +1,5 @@
 /* Intel 960 ELF support for BFD.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -32,7 +32,6 @@
      RELOC_NUMBER (R_960_OPTCALL,   5)
      RELOC_NUMBER (R_960_OPTCALLX,  6)
      RELOC_NUMBER (R_960_OPTCALLXA, 7)
-     EMPTY_RELOC (R_960_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_960_max)
 
 #endif /* _ELF_I960_H */
diff --git a/include/elf/ia64.h b/include/elf/ia64.h
index 9d50030..3b18288 100644
--- a/include/elf/ia64.h
+++ b/include/elf/ia64.h
@@ -25,7 +25,6 @@
 /* Bits in the e_flags field of the Elf64_Ehdr:  */
 
 #define EF_IA_64_MASKOS	 0x0000000f	/* os-specific flags */
-#define EF_IA_64_ABI64	 (1 << 4)	/* 64-bit ABI */
 #define EF_IA_64_ARCH	 0xff000000	/* arch. version mask */
 
 /* ??? These four definitions are not part of the SVR4 ABI.
@@ -36,6 +35,14 @@
 #define EF_IA_64_BE	 (1 << 3)	/* PSR BE bit set (big-endian) */
 #define EFA_IA_64_EAS2_3 0x23000000	/* ia64 EAS 2.3 */
 
+#define EF_IA_64_ABI64		    (1 << 4) /* 64-bit ABI */
+/* Not used yet.  */
+#define EF_IA_64_REDUCEDFP	    (1 << 5) /* Only FP6-FP11 used.  */
+#define EF_IA_64_CONS_GP	    (1 << 6) /* gp as program wide constant. */
+#define EF_IA_64_NOFUNCDESC_CONS_GP (1 << 7) /* And no function descriptors. */
+/* Not used yet.  */
+#define EF_IA_64_ABSOLUTE	    (1 << 8) /* Load at absolute addresses.  */
+
 #define ELF_STRING_ia64_archext		".IA_64.archext"
 #define ELF_STRING_ia64_pltoff		".IA_64.pltoff"
 #define ELF_STRING_ia64_unwind		".IA_64.unwind"
@@ -73,11 +80,7 @@
    bundle (16 byte aligned).
 
    The top 5 bits of the reloc code specifies the expression type, the
-   low 3 bits the format of the data word being relocated.
-
-   ??? Relocations below marked ## are not part of the SVR4 processor
-   suppliment.  They were present in David's initial code drop, so it
-   is possible that they are used by HP/UX.  */
+   low 3 bits the format of the data word being relocated.  */
 
 #include "elf/reloc-macros.h"
 
@@ -92,81 +95,96 @@
   RELOC_NUMBER (R_IA64_DIR64MSB, 0x26)	/* symbol + addend, data8 MSB */
   RELOC_NUMBER (R_IA64_DIR64LSB, 0x27)	/* symbol + addend, data8 LSB */
 
-  RELOC_NUMBER (R_IA64_GPREL22, 0x2a)	/* @gprel(sym + add), add imm22 */
-  RELOC_NUMBER (R_IA64_GPREL64I, 0x2b)	/* @gprel(sym + add), mov imm64 */
-  RELOC_NUMBER (R_IA64_GPREL32MSB, 0x2c) /* @gprel(sym + add), data4 MSB ## */
-  RELOC_NUMBER (R_IA64_GPREL32LSB, 0x2d) /* @gprel(sym + add), data4 LSB ## */
-  RELOC_NUMBER (R_IA64_GPREL64MSB, 0x2e) /* @gprel(sym + add), data8 MSB */
-  RELOC_NUMBER (R_IA64_GPREL64LSB, 0x2f) /* @gprel(sym + add), data8 LSB */
+  RELOC_NUMBER (R_IA64_GPREL22, 0x2a)	/* @gprel(sym+add), add imm22 */
+  RELOC_NUMBER (R_IA64_GPREL64I, 0x2b)	/* @gprel(sym+add), mov imm64 */
+  RELOC_NUMBER (R_IA64_GPREL32MSB, 0x2c) /* @gprel(sym+add), data4 MSB */
+  RELOC_NUMBER (R_IA64_GPREL32LSB, 0x2d) /* @gprel(sym+add), data4 LSB */
+  RELOC_NUMBER (R_IA64_GPREL64MSB, 0x2e) /* @gprel(sym+add), data8 MSB */
+  RELOC_NUMBER (R_IA64_GPREL64LSB, 0x2f) /* @gprel(sym+add), data8 LSB */
 
-  RELOC_NUMBER (R_IA64_LTOFF22, 0x32)	/* @ltoff(sym + add), add imm22 */
-  RELOC_NUMBER (R_IA64_LTOFF64I, 0x33)	/* @ltoff(sym + add), mov imm64 */
+  RELOC_NUMBER (R_IA64_LTOFF22, 0x32)	/* @ltoff(sym+add), add imm22 */
+  RELOC_NUMBER (R_IA64_LTOFF64I, 0x33)	/* @ltoff(sym+add), mov imm64 */
 
-  RELOC_NUMBER (R_IA64_PLTOFF22, 0x3a)	/* @pltoff(sym + add), add imm22 */
-  RELOC_NUMBER (R_IA64_PLTOFF64I, 0x3b)	/* @pltoff(sym + add), mov imm64 */
-  RELOC_NUMBER (R_IA64_PLTOFF64MSB, 0x3e) /* @pltoff(sym + add), data8 MSB */
-  RELOC_NUMBER (R_IA64_PLTOFF64LSB, 0x3f) /* @pltoff(sym + add), data8 LSB */
+  RELOC_NUMBER (R_IA64_PLTOFF22, 0x3a)	/* @pltoff(sym+add), add imm22 */
+  RELOC_NUMBER (R_IA64_PLTOFF64I, 0x3b)	/* @pltoff(sym+add), mov imm64 */
+  RELOC_NUMBER (R_IA64_PLTOFF64MSB, 0x3e) /* @pltoff(sym+add), data8 MSB */
+  RELOC_NUMBER (R_IA64_PLTOFF64LSB, 0x3f) /* @pltoff(sym+add), data8 LSB */
 
-  RELOC_NUMBER (R_IA64_FPTR64I, 0x43)	/* @fptr(sym + add), mov imm64 */
-  RELOC_NUMBER (R_IA64_FPTR32MSB, 0x44)	/* @fptr(sym + add), data4 MSB */
-  RELOC_NUMBER (R_IA64_FPTR32LSB, 0x45)	/* @fptr(sym + add), data4 LSB */
-  RELOC_NUMBER (R_IA64_FPTR64MSB, 0x46)	/* @fptr(sym + add), data8 MSB */
-  RELOC_NUMBER (R_IA64_FPTR64LSB, 0x47)	/* @fptr(sym + add), data8 LSB */
+  RELOC_NUMBER (R_IA64_FPTR64I, 0x43)	/* @fptr(sym+add), mov imm64 */
+  RELOC_NUMBER (R_IA64_FPTR32MSB, 0x44)	/* @fptr(sym+add), data4 MSB */
+  RELOC_NUMBER (R_IA64_FPTR32LSB, 0x45)	/* @fptr(sym+add), data4 LSB */
+  RELOC_NUMBER (R_IA64_FPTR64MSB, 0x46)	/* @fptr(sym+add), data8 MSB */
+  RELOC_NUMBER (R_IA64_FPTR64LSB, 0x47)	/* @fptr(sym+add), data8 LSB */
 
-  RELOC_NUMBER (R_IA64_PCREL60B, 0x48)	/* @pcrel(sym + add), brl */
-  RELOC_NUMBER (R_IA64_PCREL21B, 0x49)	/* @pcrel(sym + add), ptb, call */
-  RELOC_NUMBER (R_IA64_PCREL21M, 0x4a)	/* @pcrel(sym + add), chk.s */
-  RELOC_NUMBER (R_IA64_PCREL21F, 0x4b)	/* @pcrel(sym + add), fchkf */
-  RELOC_NUMBER (R_IA64_PCREL32MSB, 0x4c) /* @pcrel(sym + add), data4 MSB */
-  RELOC_NUMBER (R_IA64_PCREL32LSB, 0x4d) /* @pcrel(sym + add), data4 LSB */
-  RELOC_NUMBER (R_IA64_PCREL64MSB, 0x4e) /* @pcrel(sym + add), data8 MSB */
-  RELOC_NUMBER (R_IA64_PCREL64LSB, 0x4f) /* @pcrel(sym + add), data8 LSB */
+  RELOC_NUMBER (R_IA64_PCREL60B, 0x48)	/* @pcrel(sym+add), brl */
+  RELOC_NUMBER (R_IA64_PCREL21B, 0x49)	/* @pcrel(sym+add), ptb, call */
+  RELOC_NUMBER (R_IA64_PCREL21M, 0x4a)	/* @pcrel(sym+add), chk.s */
+  RELOC_NUMBER (R_IA64_PCREL21F, 0x4b)	/* @pcrel(sym+add), fchkf */
+  RELOC_NUMBER (R_IA64_PCREL32MSB, 0x4c) /* @pcrel(sym+add), data4 MSB */
+  RELOC_NUMBER (R_IA64_PCREL32LSB, 0x4d) /* @pcrel(sym+add), data4 LSB */
+  RELOC_NUMBER (R_IA64_PCREL64MSB, 0x4e) /* @pcrel(sym+add), data8 MSB */
+  RELOC_NUMBER (R_IA64_PCREL64LSB, 0x4f) /* @pcrel(sym+add), data8 LSB */
 
   RELOC_NUMBER (R_IA64_LTOFF_FPTR22, 0x52) /* @ltoff(@fptr(s+a)), imm22 */
   RELOC_NUMBER (R_IA64_LTOFF_FPTR64I, 0x53) /* @ltoff(@fptr(s+a)), imm64 */
-  RELOC_NUMBER (R_IA64_LTOFF_FPTR64MSB, 0x56) /* @ltoff(@fptr(s+a)), 8 MSB ##*/
-  RELOC_NUMBER (R_IA64_LTOFF_FPTR64LSB, 0x57) /* @ltoff(@fptr(s+a)), 8 LSB ##*/
+  RELOC_NUMBER (R_IA64_LTOFF_FPTR32MSB, 0x54) /* @ltoff(@fptr(s+a)), 4 MSB */
+  RELOC_NUMBER (R_IA64_LTOFF_FPTR32LSB, 0x55) /* @ltoff(@fptr(s+a)), 4 LSB */
+  RELOC_NUMBER (R_IA64_LTOFF_FPTR64MSB, 0x56) /* @ltoff(@fptr(s+a)), 8 MSB */
+  RELOC_NUMBER (R_IA64_LTOFF_FPTR64LSB, 0x57) /* @ltoff(@fptr(s+a)), 8 LSB */
 
-  RELOC_NUMBER (R_IA64_SEGBASE, 0x58)	/* set segment base for @segrel ## */
-  RELOC_NUMBER (R_IA64_SEGREL32MSB, 0x5c) /* @segrel(sym + add), data4 MSB */
-  RELOC_NUMBER (R_IA64_SEGREL32LSB, 0x5d) /* @segrel(sym + add), data4 LSB */
-  RELOC_NUMBER (R_IA64_SEGREL64MSB, 0x5e) /* @segrel(sym + add), data8 MSB */
-  RELOC_NUMBER (R_IA64_SEGREL64LSB, 0x5f) /* @segrel(sym + add), data8 LSB */
+  RELOC_NUMBER (R_IA64_SEGREL32MSB, 0x5c) /* @segrel(sym+add), data4 MSB */
+  RELOC_NUMBER (R_IA64_SEGREL32LSB, 0x5d) /* @segrel(sym+add), data4 LSB */
+  RELOC_NUMBER (R_IA64_SEGREL64MSB, 0x5e) /* @segrel(sym+add), data8 MSB */
+  RELOC_NUMBER (R_IA64_SEGREL64LSB, 0x5f) /* @segrel(sym+add), data8 LSB */
 
-  RELOC_NUMBER (R_IA64_SECREL32MSB, 0x64) /* @secrel(sym + add), data4 MSB */
-  RELOC_NUMBER (R_IA64_SECREL32LSB, 0x65) /* @secrel(sym + add), data4 LSB */
-  RELOC_NUMBER (R_IA64_SECREL64MSB, 0x66) /* @secrel(sym + add), data8 MSB */
-  RELOC_NUMBER (R_IA64_SECREL64LSB, 0x67) /* @secrel(sym + add), data8 LSB */
+  RELOC_NUMBER (R_IA64_SECREL32MSB, 0x64) /* @secrel(sym+add), data4 MSB */
+  RELOC_NUMBER (R_IA64_SECREL32LSB, 0x65) /* @secrel(sym+add), data4 LSB */
+  RELOC_NUMBER (R_IA64_SECREL64MSB, 0x66) /* @secrel(sym+add), data8 MSB */
+  RELOC_NUMBER (R_IA64_SECREL64LSB, 0x67) /* @secrel(sym+add), data8 LSB */
 
   RELOC_NUMBER (R_IA64_REL32MSB, 0x6c)	/* data 4 + REL */
   RELOC_NUMBER (R_IA64_REL32LSB, 0x6d)	/* data 4 + REL */
   RELOC_NUMBER (R_IA64_REL64MSB, 0x6e)	/* data 8 + REL */
   RELOC_NUMBER (R_IA64_REL64LSB, 0x6f)	/* data 8 + REL */
 
-  RELOC_NUMBER (R_IA64_LTV32MSB, 0x70)	/* symbol + addend, data4 MSB */
-  RELOC_NUMBER (R_IA64_LTV32LSB, 0x71)	/* symbol + addend, data4 LSB */
-  RELOC_NUMBER (R_IA64_LTV64MSB, 0x72)	/* symbol + addend, data8 MSB */
-  RELOC_NUMBER (R_IA64_LTV64LSB, 0x73)	/* symbol + addend, data8 LSB */
+  RELOC_NUMBER (R_IA64_LTV32MSB, 0x74)	/* symbol + addend, data4 MSB */
+  RELOC_NUMBER (R_IA64_LTV32LSB, 0x75)	/* symbol + addend, data4 LSB */
+  RELOC_NUMBER (R_IA64_LTV64MSB, 0x76)	/* symbol + addend, data8 MSB */
+  RELOC_NUMBER (R_IA64_LTV64LSB, 0x77)	/* symbol + addend, data8 LSB */
 
-  RELOC_NUMBER (R_IA64_PCREL21BI, 0x79)	/* @pcrel(sym + add), ptb, call */
-  RELOC_NUMBER (R_IA64_PCREL22, 0x7a)	/* @pcrel(sym + add), imm22 */
-  RELOC_NUMBER (R_IA64_PCREL64I, 0x7b)	/* @pcrel(sym + add), imm64 */
+  RELOC_NUMBER (R_IA64_PCREL21BI, 0x79)	/* @pcrel(sym+add), ptb, call */
+  RELOC_NUMBER (R_IA64_PCREL22, 0x7a)	/* @pcrel(sym+add), imm22 */
+  RELOC_NUMBER (R_IA64_PCREL64I, 0x7b)	/* @pcrel(sym+add), imm64 */
 
   RELOC_NUMBER (R_IA64_IPLTMSB, 0x80)	/* dynamic reloc, imported PLT, MSB */
   RELOC_NUMBER (R_IA64_IPLTLSB, 0x81)	/* dynamic reloc, imported PLT, LSB */
-  RELOC_NUMBER (R_IA64_EPLTMSB, 0x82)	/* dynamic reloc, exported PLT, ## */
-  RELOC_NUMBER (R_IA64_EPLTLSB, 0x83)	/* dynamic reloc, exported PLT, ## */
-  RELOC_NUMBER (R_IA64_COPY, 0x84)	/* dynamic reloc, data copy ## */
+  RELOC_NUMBER (R_IA64_COPY, 0x84)	/* dynamic reloc, data copy */
   RELOC_NUMBER (R_IA64_LTOFF22X, 0x86)  /* LTOFF22, relaxable.  */
   RELOC_NUMBER (R_IA64_LDXMOV, 0x87)	/* Use of LTOFF22X.  */
 
-  RELOC_NUMBER (R_IA64_TPREL22, 0x92)	 /* sym-TP+add, add imm22 ## */
-  RELOC_NUMBER (R_IA64_TPREL64MSB, 0x96) /* sym-TP+add, data8 MSB ## */
-  RELOC_NUMBER (R_IA64_TPREL64LSB, 0x97) /* sym-TP+add, data8 LSB ## */
+  RELOC_NUMBER (R_IA64_TPREL14, 0x91)	 /* @tprel(sym+add), add imm14 */
+  RELOC_NUMBER (R_IA64_TPREL22, 0x92)	 /* @tprel(sym+add), add imm22 */
+  RELOC_NUMBER (R_IA64_TPREL64I, 0x93)	 /* @tprel(sym+add), add imm64 */
+  RELOC_NUMBER (R_IA64_TPREL64MSB, 0x96) /* @tprel(sym+add), data8 MSB */
+  RELOC_NUMBER (R_IA64_TPREL64LSB, 0x97) /* @tprel(sym+add), data8 LSB */
 
-  RELOC_NUMBER (R_IA64_LTOFF_TP22, 0x9a) /* @ltoff(sym-TP+add), add imm22 ## */
+  RELOC_NUMBER (R_IA64_LTOFF_TP22, 0x9a) /* @ltoff(@tprel(s+a)), add imm22 */
 
-  FAKE_RELOC (R_IA64_MAX_RELOC_CODE, 0x9a)
-END_RELOC_NUMBERS
+  RELOC_NUMBER (R_IA64_DTPMOD64MSB, 0xa6) /* @dtpmod(sym+add), data8 MSB */
+  RELOC_NUMBER (R_IA64_DTPMOD64LSB, 0xa7) /* @dtpmod(sym+add), data8 LSB */
+  RELOC_NUMBER (R_IA64_LTOFF_DTPMOD22, 0xaa) /* @ltoff(@dtpmod(s+a)), imm22 */
+
+  RELOC_NUMBER (R_IA64_DTPREL14, 0xb1)    /* @dtprel(sym+add), imm14 */
+  RELOC_NUMBER (R_IA64_DTPREL22, 0xb2)    /* @dtprel(sym+add), imm22 */
+  RELOC_NUMBER (R_IA64_DTPREL64I, 0xb3)   /* @dtprel(sym+add), imm64 */
+  RELOC_NUMBER (R_IA64_DTPREL32MSB, 0xb4) /* @dtprel(sym+add), data4 MSB */
+  RELOC_NUMBER (R_IA64_DTPREL32LSB, 0xb5) /* @dtprel(sym+add), data4 LSB */
+  RELOC_NUMBER (R_IA64_DTPREL64MSB, 0xb6) /* @dtprel(sym+add), data8 MSB */
+  RELOC_NUMBER (R_IA64_DTPREL64LSB, 0xb7) /* @dtprel(sym+add), data8 LSB */
+
+  RELOC_NUMBER (R_IA64_LTOFF_DTPREL22, 0xba) /* @ltoff(@dtprel(s+a)), imm22 */
+
+  FAKE_RELOC (R_IA64_MAX_RELOC_CODE, 0xba)
+END_RELOC_NUMBERS (R_IA64_max)
 
 #endif /* _ELF_IA64_H */
diff --git a/include/elf/internal.h b/include/elf/internal.h
index a9b81a0..6ca316b 100644
--- a/include/elf/internal.h
+++ b/include/elf/internal.h
@@ -1,5 +1,6 @@
 /* ELF support for BFD.
-   Copyright (C) 1991, 92, 93, 94, 95, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1991, 92, 93, 94, 95, 97, 98, 2000
+   Free Software Foundation, Inc.
 
    Written by Fred Fish @ Cygnus Support, from information published
    in "UNIX System V Release 4, Programmers Guide: ANSI C and
@@ -112,7 +113,7 @@
   bfd_vma	st_size;		/* Associated symbol size */
   unsigned long	st_name;		/* Symbol name, index in string tbl */
   unsigned char	st_info;		/* Type and binding attributes */
-  unsigned char	st_other;		/* No defined meaning, 0 */
+  unsigned char	st_other;		/* Visibilty, and target specific */
   unsigned short st_shndx;		/* Associated section index */
 };
 
diff --git a/include/elf/m32r.h b/include/elf/m32r.h
index a12ae16..9b6c4e9 100644
--- a/include/elf/m32r.h
+++ b/include/elf/m32r.h
@@ -1,5 +1,5 @@
 /* M32R ELF support for BFD.
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 97, 98, 99, 2000 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -37,8 +37,7 @@
   RELOC_NUMBER (R_M32R_SDA16, 10)
   RELOC_NUMBER (R_M32R_GNU_VTINHERIT, 11)
   RELOC_NUMBER (R_M32R_GNU_VTENTRY, 12)
-  EMPTY_RELOC  (R_M32R_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_M32R_max)
 
 /* Processor specific section indices.  These sections do not actually
    exist.  Symbols with a st_shndx field corresponding to one of these
diff --git a/include/elf/m68hc11.h b/include/elf/m68hc11.h
new file mode 100644
index 0000000..30e0556
--- /dev/null
+++ b/include/elf/m68hc11.h
@@ -0,0 +1,42 @@
+/* m68hc11 & m68hc12 ELF support for BFD.
+   Copyright (C) 1999, 2000 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 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 _ELF_M68HC11_H
+#define _ELF_M68HC11_H
+
+#include "elf/reloc-macros.h"
+
+/* Relocation types.  */
+START_RELOC_NUMBERS (elf_m68hc11_reloc_type)
+  RELOC_NUMBER (R_M68HC11_NONE, 0)
+  RELOC_NUMBER (R_M68HC11_8, 1)
+  RELOC_NUMBER (R_M68HC11_HI8, 2)
+  RELOC_NUMBER (R_M68HC11_LO8, 3)
+  RELOC_NUMBER (R_M68HC11_PCREL_8, 4)
+  RELOC_NUMBER (R_M68HC11_16, 5)
+  RELOC_NUMBER (R_M68HC11_32, 6)
+  RELOC_NUMBER (R_M68HC11_3B, 7)
+  RELOC_NUMBER (R_M68HC11_PCREL_16, 8)
+
+     /* These are GNU extensions to enable C++ vtable garbage collection.  */
+  RELOC_NUMBER (R_M68HC11_GNU_VTINHERIT, 9)
+  RELOC_NUMBER (R_M68HC11_GNU_VTENTRY, 10)
+END_RELOC_NUMBERS (R_M68HC11_max)
+
+#endif
diff --git a/include/elf/m68k.h b/include/elf/m68k.h
index e2d51ef..a6aab10 100644
--- a/include/elf/m68k.h
+++ b/include/elf/m68k.h
@@ -1,5 +1,5 @@
 /* MC68k ELF support for BFD.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 99, 2000 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -50,8 +50,7 @@
   /* These are GNU extensions to enable C++ vtable garbage collection.  */
   RELOC_NUMBER (R_68K_GNU_VTINHERIT, 23)
   RELOC_NUMBER (R_68K_GNU_VTENTRY, 24)
-  EMPTY_RELOC  (R_68K_max)   
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_68K_max)
 
 #define EF_CPU32    0x00810000
 
diff --git a/include/elf/mcore.h b/include/elf/mcore.h
index 62a88c9..f97a682 100644
--- a/include/elf/mcore.h
+++ b/include/elf/mcore.h
@@ -1,5 +1,5 @@
 /* Motorola MCore support for BFD.
-   Copyright (C) 1995, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1995, 99, 2000 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -38,8 +38,7 @@
   RELOC_NUMBER (R_MCORE_COPY, 10)
   RELOC_NUMBER (R_MCORE_GLOB_DAT, 11)
   RELOC_NUMBER (R_MCORE_JUMP_SLOT, 12)
-  EMPTY_RELOC  (R_MCORE_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_MCORE_max)
 
 /* Section Attributes.  */
 #define SHF_MCORE_NOREAD	0x80000000
diff --git a/include/elf/mips.h b/include/elf/mips.h
index e5e3739..4446512 100644
--- a/include/elf/mips.h
+++ b/include/elf/mips.h
@@ -1,5 +1,6 @@
 /* MIPS ELF support for BFD.
-   Copyright (C) 1993, 1994, 1995, 1996, 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 96, 97, 98, 99, 2000
+   Free Software Foundation, Inc.
 
    By Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>, from
    information in the System V Application Binary Interface, MIPS
@@ -84,7 +85,7 @@
   /* These are GNU extensions to enable C++ vtable garbage collection.  */
   RELOC_NUMBER (R_MIPS_GNU_VTINHERIT, 253)
   RELOC_NUMBER (R_MIPS_GNU_VTENTRY, 254)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_MIPS_maxext)
 
 /* Processor specific flags for the ELF header e_flags field.  */
 
@@ -120,6 +121,15 @@
 /* -mips4 code.  */
 #define E_MIPS_ARCH_4		0x30000000
 
+/* -mips5 code.  */
+#define E_MIPS_ARCH_5           0x40000000
+
+/* -mips32 code.  */
+#define E_MIPS_ARCH_32          0x50000000
+
+/* -mips64 code.  */
+#define E_MIPS_ARCH_64          0x60000000
+
 /* The ABI of the file.  Also see EF_MIPS_ABI2 above. */
 #define EF_MIPS_ABI		0x0000F000
 
@@ -152,7 +162,8 @@
 #define E_MIPS_MACH_4100	0x00830000
 #define E_MIPS_MACH_4650	0x00850000
 #define E_MIPS_MACH_4111	0x00880000
-
+#define E_MIPS_MACH_MIPS32_4K	0x00890000
+#define E_MIPS_MACH_SB1         0x008a0000
 
 /* Processor specific section indices.  These sections do not actually
    exist.  Symbols with a st_shndx field corresponding to one of these
diff --git a/include/elf/mn10200.h b/include/elf/mn10200.h
index 5e29e0a..1a14ee7 100644
--- a/include/elf/mn10200.h
+++ b/include/elf/mn10200.h
@@ -1,5 +1,5 @@
 /* MN10200 ELF support for BFD.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -34,6 +34,6 @@
   RELOC_NUMBER (R_MN10200_PCREL8, 5)
   RELOC_NUMBER (R_MN10200_PCREL16, 6)
   RELOC_NUMBER (R_MN10200_PCREL24, 7)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_MN10200_max)
 
 #endif /* _ELF_MN10200_H */
diff --git a/include/elf/mn10300.h b/include/elf/mn10300.h
index 4e7fce5..74f2da8 100644
--- a/include/elf/mn10300.h
+++ b/include/elf/mn10300.h
@@ -1,5 +1,5 @@
 /* MN10300 ELF support for BFD.
-   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 99, 2000 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -36,8 +36,7 @@
   RELOC_NUMBER (R_MN10300_GNU_VTINHERIT, 7)
   RELOC_NUMBER (R_MN10300_GNU_VTENTRY, 8)
   RELOC_NUMBER (R_MN10300_24, 9)
-  EMPTY_RELOC  (R_MN10300_MAX)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_MN10300_MAX)
 
 /* Machine variant if we know it.  This field was invented at Cygnus,
    but it is hoped that other vendors will adopt it.  If some standard
diff --git a/include/elf/pj.h b/include/elf/pj.h
index 6bb8306..7690ea6 100644
--- a/include/elf/pj.h
+++ b/include/elf/pj.h
@@ -1,5 +1,5 @@
 /* picoJava ELF support for BFD.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -35,8 +35,7 @@
   RELOC_NUMBER (R_PJ_CODE_HI16, 14)
   RELOC_NUMBER (R_PJ_GNU_VTINHERIT, 15)
   RELOC_NUMBER (R_PJ_GNU_VTENTRY, 16)
-  EMPTY_RELOC (R_PJ_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_PJ_max)
 
 #define EF_PICOJAVA_ARCH     0x0000000f
 #define EF_PICOJAVA_NEWCALLS 0x00000010
diff --git a/include/elf/ppc.h b/include/elf/ppc.h
index b3116d8..f53bacd 100644
--- a/include/elf/ppc.h
+++ b/include/elf/ppc.h
@@ -1,5 +1,5 @@
 /* PPC ELF support for BFD.
-   Copyright (C) 1995, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 96, 98, 2000 Free Software Foundation, Inc.
 
    By Michael Meissner, Cygnus Support, <meissner@cygnus.com>, from information
    in the System V Application Binary Interface, PowerPC Processor Supplement
@@ -96,19 +96,17 @@
    that may still be in object files.  */
   RELOC_NUMBER (R_PPC_TOC16, 255)
 
-  EMPTY_RELOC (R_PPC_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_PPC_max)
 
 
 /* Processor specific flags for the ELF header e_flags field.  */
 
-#define	EF_PPC_EMB		0x80000000	/* PowerPC embedded flag  */
+#define	EF_PPC_EMB		0x80000000	/* PowerPC embedded flag.  */
 
-						/* CYGNUS local bits below */
-#define	EF_PPC_RELOCATABLE	0x00010000	/* PowerPC -mrelocatable flag */
-#define	EF_PPC_RELOCATABLE_LIB	0x00008000	/* PowerPC -mrelocatable-lib flag */
+#define	EF_PPC_RELOCATABLE	0x00010000	/* PowerPC -mrelocatable flag.  */
+#define	EF_PPC_RELOCATABLE_LIB	0x00008000	/* PowerPC -mrelocatable-lib flag.  */
 
-/* Processor specific section headers, sh_type field */
+/* Processor specific section headers, sh_type field.  */
 
 #define SHT_ORDERED		SHT_HIPROC	/* Link editor is to sort the \
 						   entries in this section \
@@ -116,7 +114,7 @@
 						   specified in the associated \
 						   symbol table entry.  */
 
-/* Processor specific section flags, sh_flags field */
+/* Processor specific section flags, sh_flags field.  */
 
 #define SHF_EXCLUDE		0x80000000	/* Link editor is to exclude \
 						   this section from executable \
diff --git a/include/elf/reloc-macros.h b/include/elf/reloc-macros.h
index 9c27e89..df5e0e3 100644
--- a/include/elf/reloc-macros.h
+++ b/include/elf/reloc-macros.h
@@ -1,5 +1,5 @@
 /* Generic relocation support for BFD.
-   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 99, 2000 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -27,20 +27,20 @@
    	START_RELOC_NUMBERS (foo)
    	    RELOC_NUMBER (R_foo_NONE,    0)
    	    RELOC_NUMBER (R_foo_32,      1)
-   	    FAKE_RELOC   (R_foo_illegal, 2)
-   	    EMPTY_RELOC  (R_foo_max)
-   	END_RELOC_NUMBERS
+   	    EMPTY_RELOC  (R_foo_good)
+   	    FAKE_RELOC   (R_foo_illegal, 9)
+   	END_RELOC_NUMBERS (R_foo_count)
 
    Then the following will be produced by default (ie if
    RELOC_MACROS_GEN_FUNC is *not* defined).
 
    	enum foo
 	{
-	  foo = -1,
    	  R_foo_NONE = 0,
    	  R_foo_32 = 1,
-   	  R_foo_illegal = 2,
-   	  R_foo_max
+	  R_foo_good,
+   	  R_foo_illegal = 9,
+   	  R_foo_count
    	};
 
    If RELOC_MACROS_GEN_FUNC *is* defined, then instead the
@@ -87,7 +87,7 @@
 #define FAKE_RELOC(name, number)
 #define EMPTY_RELOC(name)
 
-#define END_RELOC_NUMBERS	\
+#define END_RELOC_NUMBERS(name)	\
     default: return NULL;	\
   }				\
 }
@@ -95,21 +95,11 @@
 
 #else /* Default to generating enum.  */
 
-/* Some compilers cannot cope with an enum that ends with a trailing
-   comma, so START_RELOC_NUMBERS creates a fake reloc entry, (initialised
-   to -1 so that the first real entry will still default to 0).  Further
-   entries then prepend a comma to their definitions, creating a list
-   of enumerator entries that will satisfy these compilers.  */
-#if defined (__STDC__) || defined (ALMOST_STDC)
-#define START_RELOC_NUMBERS(name)   enum name { _##name = -1
-#else
-#define START_RELOC_NUMBERS(name)   enum name { _/**/name = -1
-#endif
-
-#define RELOC_NUMBER(name, number)  , name = number
-#define FAKE_RELOC(name, number)    , name = number
-#define EMPTY_RELOC(name)           , name
-#define END_RELOC_NUMBERS           };
+#define START_RELOC_NUMBERS(name)   enum name {
+#define RELOC_NUMBER(name, number)  name = number,
+#define FAKE_RELOC(name, number)    name = number,
+#define EMPTY_RELOC(name)           name,
+#define END_RELOC_NUMBERS(name)     name };
 
 #endif
 
diff --git a/include/elf/sh.h b/include/elf/sh.h
index 2b132c1..6a1e561 100644
--- a/include/elf/sh.h
+++ b/include/elf/sh.h
@@ -78,7 +78,16 @@
   RELOC_NUMBER (R_SH_GNU_VTENTRY, 35)
   RELOC_NUMBER (R_SH_LOOP_START, 36)
   RELOC_NUMBER (R_SH_LOOP_END, 37)
-  EMPTY_RELOC (R_SH_max)
-END_RELOC_NUMBERS
+  FAKE_RELOC (R_SH_FIRST_INVALID_RELOC_2, 38)
+  FAKE_RELOC (R_SH_LAST_INVALID_RELOC_2, 159)
+  RELOC_NUMBER (R_SH_GOT32, 160)
+  RELOC_NUMBER (R_SH_PLT32, 161)
+  RELOC_NUMBER (R_SH_COPY, 162)
+  RELOC_NUMBER (R_SH_GLOB_DAT, 163)
+  RELOC_NUMBER (R_SH_JMP_SLOT, 164)
+  RELOC_NUMBER (R_SH_RELATIVE, 165)
+  RELOC_NUMBER (R_SH_GOTOFF, 166)
+  RELOC_NUMBER (R_SH_GOTPC, 167)
+END_RELOC_NUMBERS (R_SH_max)
 
 #endif
diff --git a/include/elf/sparc.h b/include/elf/sparc.h
index 390e4a8..f4a199e 100644
--- a/include/elf/sparc.h
+++ b/include/elf/sparc.h
@@ -1,5 +1,5 @@
 /* SPARC ELF support for BFD.
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 97, 98, 99, 2000 Free Software Foundation, Inc.
    By Doug Evans, Cygnus Support, <dje@cygnus.com>.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -134,8 +134,7 @@
   RELOC_NUMBER (R_SPARC_GNU_VTINHERIT, 250)
   RELOC_NUMBER (R_SPARC_GNU_VTENTRY, 251)
 
-  EMPTY_RELOC  (R_SPARC_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_SPARC_max)
 
 /* Relocation macros.  */
 
diff --git a/include/elf/v850.h b/include/elf/v850.h
index d443b7f..7b22340 100644
--- a/include/elf/v850.h
+++ b/include/elf/v850.h
@@ -1,5 +1,5 @@
 /* V850 ELF support for BFD.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 98, 2000 Free Software Foundation, Inc.
    Created by Michael Meissner, Cygnus Support <meissner@cygnus.com>
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -67,19 +67,15 @@
      RELOC_NUMBER( R_V850_TDA_7_8_OFFSET, 14)		/* For sst.h, sld.h */
      RELOC_NUMBER( R_V850_TDA_7_7_OFFSET, 15)		/* For sst.b, sld.b */
      RELOC_NUMBER( R_V850_TDA_16_16_OFFSET, 16)		/* For set1, clr1, not1, tst1, movea, movhi */
-/* CYGNUS LOCAL v850e */
      RELOC_NUMBER( R_V850_TDA_4_5_OFFSET, 17)		/* For sld.hu */
      RELOC_NUMBER( R_V850_TDA_4_4_OFFSET, 18)		/* For sld.bu */
      RELOC_NUMBER( R_V850_SDA_16_16_SPLIT_OFFSET, 19)	/* For ld.bu */
      RELOC_NUMBER( R_V850_ZDA_16_16_SPLIT_OFFSET, 20)	/* For ld.bu */
      RELOC_NUMBER( R_V850_CALLT_6_7_OFFSET, 21)		/* For callt */
      RELOC_NUMBER( R_V850_CALLT_16_16_OFFSET, 22)	/* For callt */
-/* END CYGNUS LOCAL */
      RELOC_NUMBER (R_V850_GNU_VTINHERIT, 23)
      RELOC_NUMBER (R_V850_GNU_VTENTRY, 24)
-
-     EMPTY_RELOC (R_V850_max)
-END_RELOC_NUMBERS
+END_RELOC_NUMBERS (R_V850_max)
 
 
 /* Processor specific section indices.  These sections do not actually
diff --git a/include/elf/x86-64.h b/include/elf/x86-64.h
new file mode 100644
index 0000000..a4da0a3
--- /dev/null
+++ b/include/elf/x86-64.h
@@ -0,0 +1,46 @@
+/* x86_64 ELF support for BFD.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Contributed by Jan Hubicka <jh@suse.cz>
+
+   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 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 _ELF_X86_64_H
+#define _ELF_X86_64_H
+
+#include "elf/reloc-macros.h"
+
+START_RELOC_NUMBERS (elf_x86_64_reloc_type)
+     RELOC_NUMBER (R_X86_64_NONE,     0)      /* No reloc */
+     RELOC_NUMBER (R_X86_64_64,               1)      /* Direct 64 bit  */
+     RELOC_NUMBER (R_X86_64_PC32,     2)      /* PC relative 32 bit signed */
+     RELOC_NUMBER (R_X86_64_GOT32,    3)      /* 32 bit GOT entry */
+     RELOC_NUMBER (R_X86_64_PLT32,    4)      /* 32 bit PLT address */
+     RELOC_NUMBER (R_X86_64_COPY,     5)      /* Copy symbol at runtime */
+     RELOC_NUMBER (R_X86_64_GLOB_DAT, 6)      /* Create GOT entry */
+     RELOC_NUMBER (R_X86_64_JUMP_SLOT,        7)      /* Create PLT entry */
+     RELOC_NUMBER (R_X86_64_RELATIVE, 8)      /* Adjust by program base */
+     RELOC_NUMBER (R_X86_64_GOTPCREL, 9)      /* 32 bit signed pc relative
+                                                 offset to GOT */
+     RELOC_NUMBER (R_X86_64_32,               10)     /* Direct 32 bit zero extended */
+     RELOC_NUMBER (R_X86_64_32S,              11)     /* Direct 32 bit sign extended */
+     RELOC_NUMBER (R_X86_64_16,               12)     /* Direct 16 bit zero extended */
+     RELOC_NUMBER (R_X86_64_PC16,     13)     /* 16 bit sign extended pc relative*/
+     RELOC_NUMBER (R_X86_64_8,                14)     /* Direct 8 bit sign extended */
+     RELOC_NUMBER (R_X86_64_PC8,              15)     /* 8 bit sign extended pc relative*/
+END_RELOC_NUMBERS (R_X86_64_max)
+
+#endif
diff --git a/include/getopt.h b/include/getopt.h
index fb30719..bf65c6e 100644
--- a/include/getopt.h
+++ b/include/getopt.h
@@ -1,5 +1,6 @@
 /* Declarations for getopt.
-   Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997
+   Free Software Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C Library.
    Bugs can be reported to bug-glibc@gnu.org.
@@ -99,13 +100,20 @@
 #define optional_argument	2
 
 #if defined (__STDC__) && __STDC__
-#ifdef __GNU_LIBRARY__
+/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1.  If it is
+   undefined, we haven't run the autoconf check so provide the
+   declaration without arguments.  If it is 0, we checked and failed
+   to find the declaration so provide a fully prototyped one.  If it
+   is 1, we found it so don't provide any declaration at all.  */
+#if defined (__GNU_LIBRARY__) || (defined (HAVE_DECL_GETOPT) && !HAVE_DECL_GETOPT)
 /* Many other libraries have conflicting prototypes for getopt, with
    differences in the consts, in stdlib.h.  To avoid compilation
    errors, only prototype getopt for the GNU C library.  */
 extern int getopt (int argc, char *const *argv, const char *shortopts);
 #else /* not __GNU_LIBRARY__ */
+# if !defined (HAVE_DECL_GETOPT)
 extern int getopt ();
+# endif
 #endif /* __GNU_LIBRARY__ */
 extern int getopt_long (int argc, char *const *argv, const char *shortopts,
 		        const struct option *longopts, int *longind);
diff --git a/include/hashtab.h b/include/hashtab.h
index 5fe2393..a577c5e 100644
--- a/include/hashtab.h
+++ b/include/hashtab.h
@@ -1,5 +1,5 @@
 /* An expandable hash tables datatype.  
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    Contributed by Vladimir Makarov (vmakarov@cygnus.com).
 
 This program is free software; you can redistribute it and/or modify
@@ -38,10 +38,13 @@
 
 #include <ansidecl.h>
 
+/* The type for a hash code.  */
+typedef unsigned int hashval_t;
+
 /* Callback function pointer types.  */
 
 /* Calculate hash of a table entry.  */
-typedef unsigned int (*htab_hash) PARAMS ((const void *));
+typedef hashval_t (*htab_hash) PARAMS ((const void *));
 
 /* Compare a table entry with a possible entry.  The entry already in
    the table always comes first, so the second element can be of a
@@ -77,7 +80,7 @@
   htab_del del_f;
 
   /* Table itself.  */
-  void **entries;
+  PTR *entries;
 
   /* Current size (in entries) of the hash table */
   size_t size;
@@ -95,23 +98,38 @@
   /* The following member is used for debugging.  Its value is number
      of collisions fixed for time of work with the hash table. */
   unsigned int collisions;
+
+  /* This is non-zero if we are allowed to return NULL for function calls
+     that allocate memory.  */
+  int return_allocation_failure;
 };
 
 typedef struct htab *htab_t;
 
+/* An enum saying whether we insert into the hash table or not.  */
+enum insert_option {NO_INSERT, INSERT};
+
 /* The prototypes of the package functions. */
 
 extern htab_t	htab_create	PARAMS ((size_t, htab_hash,
 					 htab_eq, htab_del));
+
+/* This function is like htab_create, but may return NULL if memory
+   allocation fails, and also signals that htab_find_slot_with_hash and
+   htab_find_slot are allowed to return NULL when inserting.  */
+extern htab_t	htab_try_create	PARAMS ((size_t, htab_hash,
+					 htab_eq, htab_del));
 extern void	htab_delete	PARAMS ((htab_t));
 extern void	htab_empty	PARAMS ((htab_t));
 
-extern void    *htab_find	PARAMS ((htab_t, const void *));
-extern void   **htab_find_slot	PARAMS ((htab_t, const void *, int));
-extern void    *htab_find_with_hash		PARAMS ((htab_t, const void *,
-							 unsigned int));
-extern void   **htab_find_slot_with_hash	PARAMS ((htab_t, const void *,
-							 unsigned int, int));
+extern PTR	htab_find	PARAMS ((htab_t, const void *));
+extern PTR     *htab_find_slot	PARAMS ((htab_t, const void *,
+					 enum insert_option));
+extern PTR	htab_find_with_hash	  PARAMS ((htab_t, const void *,
+						   hashval_t));
+extern PTR     *htab_find_slot_with_hash  PARAMS ((htab_t, const void *,
+						   hashval_t,
+						   enum insert_option));
 extern void	htab_clear_slot	PARAMS ((htab_t, void **));
 extern void	htab_remove_elt	PARAMS ((htab_t, void *));
 
@@ -121,6 +139,12 @@
 extern size_t	htab_elements	PARAMS ((htab_t));
 extern double	htab_collisions	PARAMS ((htab_t));
 
+/* A hash function for pointers.  */
+extern htab_hash htab_hash_pointer;
+
+/* An equality function for pointers.  */
+extern htab_eq htab_eq_pointer;
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/include/libiberty.h b/include/libiberty.h
index 9a536a4..64d072b 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -16,6 +16,13 @@
 
 #include "ansidecl.h"
 
+#ifdef ANSI_PROTOTYPES
+/* Get a definition for size_t.  */
+#include <stddef.h>
+/* Get a definition for va_list.  */
+#include <stdarg.h>
+#endif
+
 /* Build an argument vector from a string.  Allocates memory using
    malloc.  Use freeargv to free the vector.  */
 
@@ -36,10 +43,17 @@
    across different systems, sometimes as "char *" and sometimes as
    "const char *" */
 
-#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__)
+/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1.  If it is
+   undefined, we haven't run the autoconf check so provide the
+   declaration without arguments.  If it is 0, we checked and failed
+   to find the declaration so provide a fully prototyped one.  If it
+   is 1, we found it so don't provide any declaration at all.  */
+#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || (defined (HAVE_DECL_BASENAME) && !HAVE_DECL_BASENAME)
 extern char *basename PARAMS ((const char *));
 #else
+# if !defined (HAVE_DECL_BASENAME)
 extern char *basename ();
+# endif
 #endif
 
 /* Concatenate an arbitrary number of strings, up to (char *) NULL.
@@ -123,16 +137,13 @@
 
 extern void xmalloc_set_program_name PARAMS ((const char *));
 
+/* Report an allocation failure.  */
+extern void xmalloc_failed PARAMS ((size_t)) ATTRIBUTE_NORETURN;
+
 /* Allocate memory without fail.  If malloc fails, this will print a
    message to stderr (using the name set by xmalloc_set_program_name,
    if any) and then call xexit.  */
 
-#ifdef ANSI_PROTOTYPES
-/* Get a definition for size_t.  */
-#include <stddef.h>
-/* Get a definition for va_list.  */
-#include <stdarg.h>
-#endif
 extern PTR xmalloc PARAMS ((size_t)) ATTRIBUTE_MALLOC;
 
 /* Reallocate memory without fail.  This works like xmalloc.  Note,
@@ -193,6 +204,8 @@
 extern int vasprintf PARAMS ((char **, const char *, va_list))
   ATTRIBUTE_PRINTF(2,0);
 
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/md5.h b/include/md5.h
new file mode 100644
index 0000000..0840b31
--- /dev/null
+++ b/include/md5.h
@@ -0,0 +1,142 @@
+/* md5.h - Declaration of functions and data types used for MD5 sum
+   computing library functions.
+   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   NOTE: The canonical source of this file is maintained with the GNU C
+   Library.  Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+
+   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 _MD5_H
+#define _MD5_H 1
+
+#include <stdio.h>
+
+#if defined HAVE_LIMITS_H || _LIBC
+# include <limits.h>
+#endif
+
+/* 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.  */
+
+#ifdef _LIBC
+# include <sys/types.h>
+typedef u_int32_t md5_uint32;
+#else
+#  define INT_MAX_32_BITS 2147483647
+
+/* 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 INT_MAX
+#  define INT_MAX INT_MAX_32_BITS
+# endif
+
+# if INT_MAX == INT_MAX_32_BITS
+   typedef unsigned int md5_uint32;
+# else
+#  if SHRT_MAX == INT_MAX_32_BITS
+    typedef unsigned short md5_uint32;
+#  else
+#   if LONG_MAX == INT_MAX_32_BITS
+     typedef unsigned long md5_uint32;
+#   else
+     /* The following line is intended to evoke an error.
+        Using #error is not portable enough.  */
+     "Cannot determine unsigned 32-bit data type."
+#   endif
+#  endif
+# endif
+#endif
+
+#undef __P
+#if defined (__STDC__) && __STDC__
+#define	__P(x) x
+#else
+#define	__P(x) ()
+#endif
+
+/* Structure to save state of computation between the single steps.  */
+struct md5_ctx
+{
+  md5_uint32 A;
+  md5_uint32 B;
+  md5_uint32 C;
+  md5_uint32 D;
+
+  md5_uint32 total[2];
+  md5_uint32 buflen;
+  char buffer[128];
+};
+
+/*
+ * The following three functions are build up the low level used in
+ * the functions `md5_stream' and `md5_buffer'.
+ */
+
+/* Initialize structure containing state of computation.
+   (RFC 1321, 3.3: Step 3)  */
+extern void md5_init_ctx __P ((struct md5_ctx *ctx));
+
+/* Starting with the result of former calls of this function (or the
+   initialization function update the context for the next LEN bytes
+   starting at BUFFER.
+   It is necessary that LEN is a multiple of 64!!! */
+extern void md5_process_block __P ((const void *buffer, size_t len,
+				    struct md5_ctx *ctx));
+
+/* Starting with the result of former calls of this function (or the
+   initialization function update the context for the next LEN bytes
+   starting at BUFFER.
+   It is NOT required that LEN is a multiple of 64.  */
+extern void md5_process_bytes __P ((const void *buffer, size_t len,
+				    struct md5_ctx *ctx));
+
+/* Process the remaining bytes in the buffer and put result from CTX
+   in first 16 bytes following RESBUF.  The result is always in little
+   endian byte order, so that a byte-wise output yields to the wanted
+   ASCII representation of the message digest.
+
+   IMPORTANT: On some systems it is required that RESBUF is correctly
+   aligned for a 32 bits value.  */
+extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));
+
+
+/* Put result from CTX in first 16 bytes following RESBUF.  The result is
+   always in little endian byte order, so that a byte-wise output yields
+   to the wanted ASCII representation of the message digest.
+
+   IMPORTANT: On some systems it is required that RESBUF is correctly
+   aligned for a 32 bits value.  */
+extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));
+
+
+/* Compute MD5 message digest for bytes read from STREAM.  The
+   resulting message digest number will be written into the 16 bytes
+   beginning at RESBLOCK.  */
+extern int md5_stream __P ((FILE *stream, void *resblock));
+
+/* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The
+   result is always in little endian byte order, so that a byte-wise
+   output yields to the wanted ASCII representation of the message
+   digest.  */
+extern void *md5_buffer __P ((const char *buffer, size_t len, void *resblock));
+
+#endif
diff --git a/include/obstack.h b/include/obstack.h
index a20ab55..314a27a 100644
--- a/include/obstack.h
+++ b/include/obstack.h
@@ -1,5 +1,6 @@
 /* obstack.h - object stack macros
-   Copyright (C) 1988,89,90,91,92,93,94,96,97,98 Free Software Foundation, Inc.
+   Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998
+   Free Software Foundation, Inc.
 
 
    NOTE: The canonical source of this file is maintained with the GNU C Library.
diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog
index de2e3c6..e02fe5b 100644
--- a/include/opcode/ChangeLog
+++ b/include/opcode/ChangeLog
@@ -1,3 +1,118 @@
+Wed Dec 20 14:22:03 MET 2000  Jan Hubicka  <jh@suse.cz>
+
+	* i386.h (i386_optab): Replace "Imm" with "EncImm".
+	(i386_regtab): Add flags field.
+	
+2000-12-12  Nick Clifton  <nickc@redhat.com>
+
+	* mips.h: Fix formatting.
+
+2000-12-01  Chris Demetriou  <cgd@sibyte.com>
+
+        mips.h (OP_MASK_SYSCALL, OP_SH_SYSCALL): Delete.
+        (OP_MASK_CODE20, OP_SH_CODE20): Define, with values of old
+        OP_*_SYSCALL definitions.
+        (OP_SH_CODE19, OP_MASK_CODE19): Define, for use as
+        19 bit wait codes.
+        (MIPS operand specifier comments): Remove 'm', add 'U' and
+        'J', and update the meaning of 'B' so that it's more general.
+
+        * mips.h (INSN_ISA1, INSN_ISA2, INSN_ISA3, INSN_ISA4,
+        INSN_ISA5): Renumber, redefine to mean the ISA at which the
+        instruction was added.
+        (INSN_ISA32): New constant.
+        (INSN_4650, INSN_4010, INSN_4100, INSN_3900, INSN_GP32):
+        Renumber to avoid new and/or renumbered INSN_* constants.
+        (INSN_MIPS32): Delete.
+        (ISA_UNKNOWN): New constant to indicate unknown ISA.
+        (ISA_MIPS1, ISA_MIPS2, ISA_MIPS3, ISA_MIPS4, ISA_MIPS5,
+        ISA_MIPS32): New constants, defined to be the mask of INSN_*
+        constants available at that ISA level. 
+        (CPU_UNKNOWN): New constant to indicate unknown CPU.
+        (CPU_4K, CPU_MIPS32_4K): Rename the former to the latter,
+        define it with a unique value.
+        (OPCODE_IS_MEMBER): Update for new ISA membership-related
+        constant meanings.
+
+        * mips.h (INSN_ISA64, ISA_MIPS5, ISA_MIPS64): New
+        definitions. 
+
+        * mips.h (CPU_SB1): New constant.
+
+2000-10-20  Jakub Jelinek  <jakub@redhat.com>
+
+	* sparc.h (enum sparc_opcode_arch_val): Add SPARC_OPCODE_ARCH_V9B.
+	Note that '3' is used for siam operand.
+
+2000-09-22  Jim Wilson  <wilson@cygnus.com>
+
+	* ia64.h (enum ia64_dependency_semantics): Add IA64_DVS_STOP.
+
+2000-09-13  Anders Norlander  <anorland@acc.umu.se>
+	
+	* mips.h: Use defines instead of hard-coded processor numbers.
+	(CPU_R2000, CPU_R3000, CPU_R3900, CPU_R4000, CPU_R4010,
+	CPU_VR4100, CPU_R4111, CPU_R4300, CPU_R4400, CPU_R4600, CPU_R4650, 
+	CPU_R5000, CPU_R6000, CPU_R8000, CPU_R10000, CPU_MIPS32, CPU_4K,
+	CPU_4KC, CPU_4KM, CPU_4KP): Define..
+	(OPCODE_IS_MEMBER): Use new defines.
+ 	(OP_MASK_SEL, OP_SH_SEL): Define.
+	(OP_MASK_CODE20, OP_SH_CODE20): Define.
+ 	Add 'P' to used characters.
+ 	Use 'H' for coprocessor select field.
+	Use 'm' for 20 bit breakpoint code.
+ 	Document new arg characters and add to used characters.
+ 	(INSN_MIPS32): New define for MIPS32 extensions.
+ 	(OPCODE_IS_MEMBER): Recognize MIPS32 instructions.
+
+2000-09-05  Alan Modra  <alan@linuxcare.com.au>
+
+	* hppa.h: Mention cz completer.
+
+2000-08-16  Jim Wilson  <wilson@cygnus.com>
+
+	* ia64.h (IA64_OPCODE_POSTINC): New.
+
+2000-08-15  H.J. Lu  <hjl@gnu.org>
+
+	* i386.h: Swap the Intel syntax "movsx"/"movzx" due to the
+	IgnoreSize change.
+
+2000-07-29  Marek Michalkiewicz  <marekm@linux.org.pl>
+
+	* avr.h (AVR_UNDEF_P, AVR_SKIP_P, AVR_DISP0_P): New macros.
+	Move related opcodes closer to each other.
+	Minor changes in comments, list undefined opcodes.
+
+2000-07-26  Dave Brolley  <brolley@redhat.com>
+
+	* cgen.h (cgen_hw_lookup_by_num): Second parameter is unsigned.
+
+2000-07-20  Hans-Peter Nilsson  <hp@axis.com>
+
+	cris.h: New file.
+
+2000-06-26  Marek Michalkiewicz  <marekm@linux.org.pl>
+
+	* avr.h (AVR_ISA_WRAP): Remove, now assumed if not AVR_ISA_MEGA.
+	(AVR_ISA_ESPM): Remove, because ESPM removed in databook update.
+	(AVR_ISA_85xx): Remove, all uses changed back to AVR_ISA_2xxx.
+	(AVR_ISA_M83): Define for ATmega83, ATmega85.
+	(espm): Remove, because ESPM removed in databook update.
+	(eicall, eijmp): Move to the end of opcode table.
+
+2000-06-18  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* m68hc11.h: New file for support of Motorola 68hc11.
+
+Fri Jun  9 21:51:50 2000  Denis Chertykov  <denisc@overta.ru>
+
+	* avr.h: clr,lsl,rol, ... moved after add,adc, ...
+
+Wed Jun  7 21:39:54 2000  Denis Chertykov  <denisc@overta.ru>
+
+	* avr.h: New file with AVR opcodes.
+
 Wed Apr 12 17:11:20 2000  Donald Lindsay  <dlindsay@hound.cygnus.com>
 
 	* d10v.h: added ALONE attribute for d10v_opcode.exec_type.
diff --git a/include/opcode/avr.h b/include/opcode/avr.h
new file mode 100644
index 0000000..393ca22
--- /dev/null
+++ b/include/opcode/avr.h
@@ -0,0 +1,256 @@
+/* Opcode table for the Atmel AVR micro controllers.
+
+   Copyright 2000 Free Software Foundation, Inc.
+   Contributed by Denis Chertykov <denisc@overta.ru>
+   
+   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.  */
+
+#define AVR_ISA_1200  0x0001 /* in the beginning there was ... */
+#define AVR_ISA_LPM   0x0002 /* device has LPM */
+#define AVR_ISA_LPMX  0x0004 /* device has LPM Rd,Z[+] */
+#define AVR_ISA_SRAM  0x0008 /* device has SRAM (LD, ST, PUSH, POP, ...) */
+#define AVR_ISA_MEGA  0x0020 /* device has >8K program memory (JMP and CALL
+				supported, no 8K wrap on RJMP and RCALL) */
+#define AVR_ISA_MUL   0x0040 /* device has new core (MUL, MOVW, ...) */
+#define AVR_ISA_ELPM  0x0080 /* device has >64K program memory (ELPM) */
+#define AVR_ISA_ELPMX 0x0100 /* device has ELPM Rd,Z[+] (none yet) */
+#define AVR_ISA_SPM   0x0200 /* device can program itself */
+#define AVR_ISA_EIND  0x0800 /* device has >128K program memory (none yet) */
+
+#define AVR_ISA_TINY1 (AVR_ISA_1200 | AVR_ISA_LPM)
+#define AVR_ISA_2xxx (AVR_ISA_TINY1 | AVR_ISA_SRAM)
+#define AVR_ISA_M83  (AVR_ISA_2xxx | AVR_ISA_MUL | AVR_ISA_LPMX | AVR_ISA_SPM)
+#define AVR_ISA_M603 (AVR_ISA_2xxx | AVR_ISA_MEGA)
+#define AVR_ISA_M103 (AVR_ISA_M603 | AVR_ISA_ELPM)
+#define AVR_ISA_M161 (AVR_ISA_M603 | AVR_ISA_MUL | AVR_ISA_LPMX | AVR_ISA_SPM)
+#define AVR_ISA_94K  (AVR_ISA_M603 | AVR_ISA_MUL | AVR_ISA_LPMX)
+
+#define AVR_ISA_ALL   0xFFFF
+
+#define REGISTER_P(x) ((x) == 'r'		\
+		       || (x) == 'd'		\
+		       || (x) == 'w'		\
+		       || (x) == 'a'		\
+		       || (x) == 'v')
+
+/* Undefined combination of operands - does the register
+   operand overlap with pre-decremented or post-incremented
+   pointer register (like ld r31,Z+)?  */
+#define AVR_UNDEF_P(x) (((x) & 0xFFED) == 0x91E5 ||		\
+  ((x) & 0xFDEF) == 0x91AD || ((x) & 0xFDEF) == 0x91AE ||	\
+  ((x) & 0xFDEF) == 0x91C9 || ((x) & 0xFDEF) == 0x91CA ||	\
+  ((x) & 0xFDEF) == 0x91E1 || ((x) & 0xFDEF) == 0x91E2)
+
+/* Is this a skip instruction {cpse,sbic,sbis,sbrc,sbrs}?  */
+#define AVR_SKIP_P(x) (((x) & 0xFC00) == 0x1000 ||		\
+  ((x) & 0xFD00) == 0x9900 || ((x) & 0xFC08) == 0xFC00)
+
+/* Is this `ldd r,b+0' or `std b+0,r' (b={Y,Z}, disassembled as
+   `ld r,b' or `st b,r' respectively - next opcode entry)?  */
+#define AVR_DISP0_P(x) (((x) & 0xFC07) == 0x8000)
+
+/* constraint letters
+   r - any register
+   d - `ldi' register (r16-r31)
+   v - `movw' even register (r0, r2, ..., r28, r30)
+   a - `fmul' register (r16-r23)
+   w - `adiw' register (r24,r26,r28,r30)
+   e - pointer registers (X,Y,Z)
+   b - base pointer register and displacement ([YZ]+disp)
+   z - Z pointer register (for [e]lpm Rd,Z[+])
+   M - immediate value from 0 to 255
+   n - immediate value from 0 to 255 ( n = ~M ). Relocation impossible
+   s - immediate value from 0 to 7
+   P - Port address value from 0 to 63. (in, out)
+   p - Port address value from 0 to 31. (cbi, sbi, sbic, sbis)
+   K - immediate value from 0 to 63 (used in `adiw', `sbiw')
+   i - immediate value
+   l - signed pc relative offset from -64 to 63
+   L - signed pc relative offset from -2048 to 2047
+   h - absolute code address (call, jmp)
+   S - immediate value from 0 to 7 (S = s << 4)
+   ? - use this opcode entry if no parameters, else use next opcode entry
+
+   Order is important - some binary opcodes have more than one name,
+   the disassembler will only see the first match.
+
+   Remaining undefined opcodes (1700 total - some of them might work
+   as normal instructions if not all of the bits are decoded):
+
+    0x0001...0x00ff    (255) (known to be decoded as `nop' by the old core)
+   "100100xxxxxxx011"  (128) 0x9[0-3][0-9a-f][3b]
+   "100100xxxxxx1000"   (64) 0x9[0-3][0-9a-f]8
+   "1001001xxxxx01xx"  (128) 0x9[23][0-9a-f][4-7]
+   "1001010xxxxx0100"   (32) 0x9[45][0-9a-f]4
+   "1001010x001x1001"    (4) 0x9[45][23]9
+   "1001010x01xx1001"    (8) 0x9[45][4-7]9
+   "1001010x1xxx1001"   (16) 0x9[45][8-9a-f]9
+   "1001010xxxxx1011"   (32) 0x9[45][0-9a-f]b
+   "10010101001x1000"    (2) 0x95[23]8
+   "1001010101xx1000"    (4) 0x95[4-7]8
+   "1001010110x11000"    (2) 0x95[9b]8
+   "1001010111111000"    (1) 0x95f8 (`espm' removed in databook update)
+   "11111xxxxxxx1xxx" (1024) 0xf[8-9a-f][0-9a-f][8-9a-f]
+ */
+
+AVR_INSN (clc,  "",    "1001010010001000", 1, AVR_ISA_1200, 0x9488)
+AVR_INSN (clh,  "",    "1001010011011000", 1, AVR_ISA_1200, 0x94d8)
+AVR_INSN (cli,  "",    "1001010011111000", 1, AVR_ISA_1200, 0x94f8)
+AVR_INSN (cln,  "",    "1001010010101000", 1, AVR_ISA_1200, 0x94a8)
+AVR_INSN (cls,  "",    "1001010011001000", 1, AVR_ISA_1200, 0x94c8)
+AVR_INSN (clt,  "",    "1001010011101000", 1, AVR_ISA_1200, 0x94e8)
+AVR_INSN (clv,  "",    "1001010010111000", 1, AVR_ISA_1200, 0x94b8)
+AVR_INSN (clz,  "",    "1001010010011000", 1, AVR_ISA_1200, 0x9498)
+
+AVR_INSN (sec,  "",    "1001010000001000", 1, AVR_ISA_1200, 0x9408)
+AVR_INSN (seh,  "",    "1001010001011000", 1, AVR_ISA_1200, 0x9458)
+AVR_INSN (sei,  "",    "1001010001111000", 1, AVR_ISA_1200, 0x9478)
+AVR_INSN (sen,  "",    "1001010000101000", 1, AVR_ISA_1200, 0x9428)
+AVR_INSN (ses,  "",    "1001010001001000", 1, AVR_ISA_1200, 0x9448)
+AVR_INSN (set,  "",    "1001010001101000", 1, AVR_ISA_1200, 0x9468)
+AVR_INSN (sev,  "",    "1001010000111000", 1, AVR_ISA_1200, 0x9438)
+AVR_INSN (sez,  "",    "1001010000011000", 1, AVR_ISA_1200, 0x9418)
+
+   /* Same as {cl,se}[chinstvz] above.  */
+AVR_INSN (bclr, "S",   "100101001SSS1000", 1, AVR_ISA_1200, 0x9488)
+AVR_INSN (bset, "S",   "100101000SSS1000", 1, AVR_ISA_1200, 0x9408)
+
+AVR_INSN (icall,"",    "1001010100001001", 1, AVR_ISA_2xxx, 0x9509)
+AVR_INSN (ijmp, "",    "1001010000001001", 1, AVR_ISA_2xxx, 0x9409)
+
+AVR_INSN (lpm,  "?",   "1001010111001000", 1, AVR_ISA_TINY1,0x95c8)
+AVR_INSN (lpm,  "r,z", "1001000ddddd010+", 1, AVR_ISA_LPMX, 0x9004)
+AVR_INSN (elpm, "?",   "1001010111011000", 1, AVR_ISA_ELPM, 0x95d8)
+AVR_INSN (elpm, "r,z", "1001000ddddd011+", 1, AVR_ISA_ELPMX,0x9006)
+
+AVR_INSN (nop,  "",    "0000000000000000", 1, AVR_ISA_1200, 0x0000)
+AVR_INSN (ret,  "",    "1001010100001000", 1, AVR_ISA_1200, 0x9508)
+AVR_INSN (reti, "",    "1001010100011000", 1, AVR_ISA_1200, 0x9518)
+AVR_INSN (sleep,"",    "1001010110001000", 1, AVR_ISA_1200, 0x9588)
+AVR_INSN (wdr,  "",    "1001010110101000", 1, AVR_ISA_1200, 0x95a8)
+AVR_INSN (spm,  "",    "1001010111101000", 1, AVR_ISA_SPM,  0x95e8)
+
+AVR_INSN (adc,  "r,r", "000111rdddddrrrr", 1, AVR_ISA_1200, 0x1c00)
+AVR_INSN (add,  "r,r", "000011rdddddrrrr", 1, AVR_ISA_1200, 0x0c00)
+AVR_INSN (and,  "r,r", "001000rdddddrrrr", 1, AVR_ISA_1200, 0x2000)
+AVR_INSN (cp,   "r,r", "000101rdddddrrrr", 1, AVR_ISA_1200, 0x1400)
+AVR_INSN (cpc,  "r,r", "000001rdddddrrrr", 1, AVR_ISA_1200, 0x0400)
+AVR_INSN (cpse, "r,r", "000100rdddddrrrr", 1, AVR_ISA_1200, 0x1000)
+AVR_INSN (eor,  "r,r", "001001rdddddrrrr", 1, AVR_ISA_1200, 0x2400)
+AVR_INSN (mov,  "r,r", "001011rdddddrrrr", 1, AVR_ISA_1200, 0x2c00)
+AVR_INSN (mul,  "r,r", "100111rdddddrrrr", 1, AVR_ISA_MUL,  0x9c00)
+AVR_INSN (or,   "r,r", "001010rdddddrrrr", 1, AVR_ISA_1200, 0x2800)
+AVR_INSN (sbc,  "r,r", "000010rdddddrrrr", 1, AVR_ISA_1200, 0x0800)
+AVR_INSN (sub,  "r,r", "000110rdddddrrrr", 1, AVR_ISA_1200, 0x1800)
+
+   /* Shorthand for {eor,add,adc,and} r,r above.  */
+AVR_INSN (clr,  "r=r", "001001rdddddrrrr", 1, AVR_ISA_1200, 0x2400)
+AVR_INSN (lsl,  "r=r", "000011rdddddrrrr", 1, AVR_ISA_1200, 0x0c00)
+AVR_INSN (rol,  "r=r", "000111rdddddrrrr", 1, AVR_ISA_1200, 0x1c00)
+AVR_INSN (tst,  "r=r", "001000rdddddrrrr", 1, AVR_ISA_1200, 0x2000)
+
+AVR_INSN (andi, "d,M", "0111KKKKddddKKKK", 1, AVR_ISA_1200, 0x7000)
+  /*XXX special case*/
+AVR_INSN (cbr,  "d,n", "0111KKKKddddKKKK", 1, AVR_ISA_1200, 0x7000)
+
+AVR_INSN (ldi,  "d,M", "1110KKKKddddKKKK", 1, AVR_ISA_1200, 0xe000)
+AVR_INSN (ser,  "d",   "11101111dddd1111", 1, AVR_ISA_1200, 0xef0f)
+
+AVR_INSN (ori,  "d,M", "0110KKKKddddKKKK", 1, AVR_ISA_1200, 0x6000)
+AVR_INSN (sbr,  "d,M", "0110KKKKddddKKKK", 1, AVR_ISA_1200, 0x6000)
+
+AVR_INSN (cpi,  "d,M", "0011KKKKddddKKKK", 1, AVR_ISA_1200, 0x3000)
+AVR_INSN (sbci, "d,M", "0100KKKKddddKKKK", 1, AVR_ISA_1200, 0x4000)
+AVR_INSN (subi, "d,M", "0101KKKKddddKKKK", 1, AVR_ISA_1200, 0x5000)
+
+AVR_INSN (sbrc, "r,s", "1111110rrrrr0sss", 1, AVR_ISA_1200, 0xfc00)
+AVR_INSN (sbrs, "r,s", "1111111rrrrr0sss", 1, AVR_ISA_1200, 0xfe00)
+AVR_INSN (bld,  "r,s", "1111100ddddd0sss", 1, AVR_ISA_1200, 0xf800)
+AVR_INSN (bst,  "r,s", "1111101ddddd0sss", 1, AVR_ISA_1200, 0xfa00)
+
+AVR_INSN (in,   "r,P", "10110PPdddddPPPP", 1, AVR_ISA_1200, 0xb000)
+AVR_INSN (out,  "P,r", "10111PPrrrrrPPPP", 1, AVR_ISA_1200, 0xb800)
+
+AVR_INSN (adiw, "w,K", "10010110KKddKKKK", 1, AVR_ISA_2xxx, 0x9600)
+AVR_INSN (sbiw, "w,K", "10010111KKddKKKK", 1, AVR_ISA_2xxx, 0x9700)
+
+AVR_INSN (cbi,  "p,s", "10011000pppppsss", 1, AVR_ISA_1200, 0x9800)
+AVR_INSN (sbi,  "p,s", "10011010pppppsss", 1, AVR_ISA_1200, 0x9a00)
+AVR_INSN (sbic, "p,s", "10011001pppppsss", 1, AVR_ISA_1200, 0x9900)
+AVR_INSN (sbis, "p,s", "10011011pppppsss", 1, AVR_ISA_1200, 0x9b00)
+
+AVR_INSN (brcc, "l",   "111101lllllll000", 1, AVR_ISA_1200, 0xf400)
+AVR_INSN (brcs, "l",   "111100lllllll000", 1, AVR_ISA_1200, 0xf000)
+AVR_INSN (breq, "l",   "111100lllllll001", 1, AVR_ISA_1200, 0xf001)
+AVR_INSN (brge, "l",   "111101lllllll100", 1, AVR_ISA_1200, 0xf404)
+AVR_INSN (brhc, "l",   "111101lllllll101", 1, AVR_ISA_1200, 0xf405)
+AVR_INSN (brhs, "l",   "111100lllllll101", 1, AVR_ISA_1200, 0xf005)
+AVR_INSN (brid, "l",   "111101lllllll111", 1, AVR_ISA_1200, 0xf407)
+AVR_INSN (brie, "l",   "111100lllllll111", 1, AVR_ISA_1200, 0xf007)
+AVR_INSN (brlo, "l",   "111100lllllll000", 1, AVR_ISA_1200, 0xf000)
+AVR_INSN (brlt, "l",   "111100lllllll100", 1, AVR_ISA_1200, 0xf004)
+AVR_INSN (brmi, "l",   "111100lllllll010", 1, AVR_ISA_1200, 0xf002)
+AVR_INSN (brne, "l",   "111101lllllll001", 1, AVR_ISA_1200, 0xf401)
+AVR_INSN (brpl, "l",   "111101lllllll010", 1, AVR_ISA_1200, 0xf402)
+AVR_INSN (brsh, "l",   "111101lllllll000", 1, AVR_ISA_1200, 0xf400)
+AVR_INSN (brtc, "l",   "111101lllllll110", 1, AVR_ISA_1200, 0xf406)
+AVR_INSN (brts, "l",   "111100lllllll110", 1, AVR_ISA_1200, 0xf006)
+AVR_INSN (brvc, "l",   "111101lllllll011", 1, AVR_ISA_1200, 0xf403)
+AVR_INSN (brvs, "l",   "111100lllllll011", 1, AVR_ISA_1200, 0xf003)
+
+   /* Same as br?? above.  */
+AVR_INSN (brbc, "s,l", "111101lllllllsss", 1, AVR_ISA_1200, 0xf400)
+AVR_INSN (brbs, "s,l", "111100lllllllsss", 1, AVR_ISA_1200, 0xf000)
+
+AVR_INSN (rcall, "L",  "1101LLLLLLLLLLLL", 1, AVR_ISA_1200, 0xd000)
+AVR_INSN (rjmp,  "L",  "1100LLLLLLLLLLLL", 1, AVR_ISA_1200, 0xc000)
+
+AVR_INSN (call, "h",   "1001010hhhhh111h", 2, AVR_ISA_MEGA, 0x940e)
+AVR_INSN (jmp,  "h",   "1001010hhhhh110h", 2, AVR_ISA_MEGA, 0x940c)
+
+AVR_INSN (asr,  "r",   "1001010rrrrr0101", 1, AVR_ISA_1200, 0x9405)
+AVR_INSN (com,  "r",   "1001010rrrrr0000", 1, AVR_ISA_1200, 0x9400)
+AVR_INSN (dec,  "r",   "1001010rrrrr1010", 1, AVR_ISA_1200, 0x940a)
+AVR_INSN (inc,  "r",   "1001010rrrrr0011", 1, AVR_ISA_1200, 0x9403)
+AVR_INSN (lsr,  "r",   "1001010rrrrr0110", 1, AVR_ISA_1200, 0x9406)
+AVR_INSN (neg,  "r",   "1001010rrrrr0001", 1, AVR_ISA_1200, 0x9401)
+AVR_INSN (pop,  "r",   "1001000rrrrr1111", 1, AVR_ISA_2xxx, 0x900f)
+AVR_INSN (push, "r",   "1001001rrrrr1111", 1, AVR_ISA_2xxx, 0x920f)
+AVR_INSN (ror,  "r",   "1001010rrrrr0111", 1, AVR_ISA_1200, 0x9407)
+AVR_INSN (swap, "r",   "1001010rrrrr0010", 1, AVR_ISA_1200, 0x9402)
+
+   /* Known to be decoded as `nop' by the old core.  */
+AVR_INSN (movw, "v,v", "00000001ddddrrrr", 1, AVR_ISA_MUL,  0x0100)
+AVR_INSN (muls, "d,d", "00000010ddddrrrr", 1, AVR_ISA_MUL,  0x0200)
+AVR_INSN (mulsu,"a,a", "000000110ddd0rrr", 1, AVR_ISA_MUL,  0x0300)
+AVR_INSN (fmul, "a,a", "000000110ddd1rrr", 1, AVR_ISA_MUL,  0x0308)
+AVR_INSN (fmuls,"a,a", "000000111ddd0rrr", 1, AVR_ISA_MUL,  0x0380)
+AVR_INSN (fmulsu,"a,a","000000111ddd1rrr", 1, AVR_ISA_MUL,  0x0388)
+
+AVR_INSN (sts,  "i,r", "1001001ddddd0000", 2, AVR_ISA_2xxx, 0x9200)
+AVR_INSN (lds,  "r,i", "1001000ddddd0000", 2, AVR_ISA_2xxx, 0x9000)
+
+   /* Special case for b+0, `e' must be next entry after `b',
+      b={Y=1,Z=0}, ee={X=11,Y=10,Z=00}, !=1 if -e or e+ or X.  */
+AVR_INSN (ldd,  "r,b", "10o0oo0dddddbooo", 1, AVR_ISA_2xxx, 0x8000)
+AVR_INSN (ld,   "r,e", "100!000dddddee-+", 1, AVR_ISA_1200, 0x8000)
+AVR_INSN (std,  "b,r", "10o0oo1rrrrrbooo", 1, AVR_ISA_2xxx, 0x8200)
+AVR_INSN (st,   "e,r", "100!001rrrrree-+", 1, AVR_ISA_1200, 0x8200)
+
+   /* These are for devices that don't exist yet
+      (>128K program memory, PC = EIND:Z).  */
+AVR_INSN (eicall, "",  "1001010100011001", 1, AVR_ISA_EIND, 0x9519)
+AVR_INSN (eijmp, "",   "1001010000011001", 1, AVR_ISA_EIND, 0x9419)
+
diff --git a/include/opcode/cgen.h b/include/opcode/cgen.h
index 1db272b..632545d 100644
--- a/include/opcode/cgen.h
+++ b/include/opcode/cgen.h
@@ -452,7 +452,7 @@
 extern const CGEN_HW_ENTRY * cgen_hw_lookup_by_name
      PARAMS ((CGEN_CPU_DESC, const char *));
 extern const CGEN_HW_ENTRY * cgen_hw_lookup_by_num
-     PARAMS ((CGEN_CPU_DESC, int));
+     PARAMS ((CGEN_CPU_DESC, unsigned int));
 
 /* This struct is used to describe things like register names, etc.  */
 
@@ -736,7 +736,7 @@
    the data is recorded in the parse/insert/extract/print switch statements. */
 
 /* This should be at least as large as necessary for any target. */
-#define CGEN_MAX_SYNTAX_BYTES 32
+#define CGEN_MAX_SYNTAX_BYTES 40
 
 /* A target may know its own precise maximum.  Assert that it falls below
    the above limit. */
diff --git a/include/opcode/cris.h b/include/opcode/cris.h
new file mode 100644
index 0000000..be02d4a
--- /dev/null
+++ b/include/opcode/cris.h
@@ -0,0 +1,298 @@
+/* cris.h -- Header file for CRIS opcode and register tables.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Contributed by Axis Communications AB, Lund, Sweden.
+   Originally written for GAS 1.38.1 by Mikael Asker.
+   Updated, BFDized and GNUified by Hans-Peter Nilsson.
+
+This file is part of GAS, GDB and the GNU binutils.
+
+GAS, GDB, and GNU binutils 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.
+
+GAS, GDB, and GNU binutils are distributed in the hope that they 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 __CRIS_H_INCLUDED_
+#define __CRIS_H_INCLUDED_
+
+#if !defined(__STDC__) && !defined(const)
+#define const
+#endif
+
+
+/* Registers.  */
+#define MAX_REG (15)
+#define REG_SP (14)
+#define REG_PC (15)
+
+/* CPU version control of disassembly and assembly of instructions.
+   May affect how the instruction is assembled, at least the size of
+   immediate operands.  */
+enum cris_insn_version_usage
+{
+  /* Any version. */
+  cris_ver_version_all=0,
+
+  /* Indeterminate (intended for disassembly only, or obsolete).  */
+  cris_ver_warning,
+
+  /* Simulator only (reserved).  */
+  cris_ver_sim,
+
+  /* Only for v0..3 (Etrax 1..4).  */
+  cris_ver_v0_3,
+
+  /* Only for v3 or higher (ETRAX 1..4 and beyond).  */
+  cris_ver_v3p,
+
+  /* Only for v8 (Etrax 100).  */
+  cris_ver_v8,
+
+  /* Only for v8 or higher (ETRAX 100, ETRAX 100 LX).  */
+  cris_ver_v8p,
+
+  /* Only for v10 or higher (ETRAX 100 LX).
+     Of course some or all these of may change to cris_ver_v10p if/when
+     there's a new revision. */
+  cris_ver_v10p
+};
+
+
+/* Special registers.  */
+struct cris_spec_reg
+{
+  const char *const name;
+  unsigned int number;
+
+  /* The size of the register.  */
+  unsigned int reg_size;
+
+  /* What CPU version the special register of that name is implemented
+     in.  If cris_ver_warning, emit an unimplemented-warning.  */
+  enum cris_insn_version_usage applicable_version;
+
+  /* There might be a specific warning for using a special register
+     here.  */
+  const char *const warning;
+};
+extern const struct cris_spec_reg cris_spec_regs[];
+
+/* Opcode-dependent constants.  */
+#define AUTOINCR_BIT (0x04)
+
+/* Prefixes.  */
+#define BDAP_QUICK_OPCODE (0x0100)
+#define BDAP_QUICK_Z_BITS (0x0e00)
+
+#define BIAP_OPCODE	  (0x0540)
+#define BIAP_Z_BITS	  (0x0a80)
+
+#define DIP_OPCODE	  (0x0970)
+#define DIP_Z_BITS	  (0xf280)
+
+#define BDAP_INDIR_LOW	  (0x40)
+#define BDAP_INDIR_LOW_Z  (0x80)
+#define BDAP_INDIR_HIGH	  (0x09)
+#define BDAP_INDIR_HIGH_Z (0x02)
+
+#define BDAP_INDIR_OPCODE (BDAP_INDIR_HIGH * 0x0100 + BDAP_INDIR_LOW)
+#define BDAP_INDIR_Z_BITS (BDAP_INDIR_HIGH_Z * 0x100 + BDAP_INDIR_LOW_Z)
+#define BDAP_PC_LOW	  (BDAP_INDIR_LOW + REG_PC)
+#define BDAP_INCR_HIGH	  (BDAP_INDIR_HIGH + AUTOINCR_BIT)
+
+/* No prefix must have this code for its "match" bits in the
+   opcode-table.  "BCC .+2" will do nicely.  */
+#define NO_CRIS_PREFIX 0
+
+/* Definitions for condition codes.  */
+#define CC_CC  0x0
+#define CC_HS  0x0
+#define CC_CS  0x1
+#define CC_LO  0x1
+#define CC_NE  0x2
+#define CC_EQ  0x3
+#define CC_VC  0x4
+#define CC_VS  0x5
+#define CC_PL  0x6
+#define CC_MI  0x7
+#define CC_LS  0x8
+#define CC_HI  0x9
+#define CC_GE  0xA
+#define CC_LT  0xB
+#define CC_GT  0xC
+#define CC_LE  0xD
+#define CC_A   0xE
+#define CC_EXT 0xF
+
+/* A table of strings "cc", "cs"... indexed with condition code
+   values as above.  */
+extern const char *const cris_cc_strings[];
+
+/* Bcc quick.  */
+#define BRANCH_QUICK_LOW  (0)
+#define BRANCH_QUICK_HIGH (0)
+#define BRANCH_QUICK_OPCODE (BRANCH_QUICK_HIGH * 0x0100 + BRANCH_QUICK_LOW)
+#define BRANCH_QUICK_Z_BITS (0x0F00)
+
+/* BA quick.  */
+#define BA_QUICK_HIGH (BRANCH_QUICK_HIGH + CC_A * 0x10)
+#define BA_QUICK_OPCODE (BA_QUICK_HIGH * 0x100 + BRANCH_QUICK_LOW)
+
+/* Bcc [PC+].  */
+#define BRANCH_PC_LOW	 (0xFF)
+#define BRANCH_INCR_HIGH (0x0D)
+#define BA_PC_INCR_OPCODE \
+ ((BRANCH_INCR_HIGH + CC_A * 0x10) * 0x0100 + BRANCH_PC_LOW)
+
+/* Jump.  */
+/* Note that old versions generated special register 8 (in high bits)
+   and not-that-old versions recognized it as a jump-instruction.
+   That opcode now belongs to JUMPU.  */
+#define JUMP_INDIR_OPCODE (0x0930)
+#define JUMP_INDIR_Z_BITS (0xf2c0)
+#define JUMP_PC_INCR_OPCODE \
+ (JUMP_INDIR_OPCODE + AUTOINCR_BIT * 0x0100 + REG_PC)
+
+/* Nop.  */
+#define NOP_OPCODE (0x050F)
+#define NOP_Z_BITS (0xFAF0)
+
+/* Structure of an opcode table entry.  */
+enum cris_imm_oprnd_size_type
+{
+  /* No size is applicable.  */
+  SIZE_NONE,
+
+  /* Always 32 bits.  */
+  SIZE_FIX_32,
+
+  /* Indicated by size of special register.  */
+  SIZE_SPEC_REG,
+
+  /* Indicated by size field.  */
+  SIZE_FIELD
+};
+
+/* For GDB.  FIXME: Is this the best way to handle opcode
+   interpretation?  */
+enum cris_op_type
+{
+  cris_not_implemented_op = 0,
+  cris_abs_op,
+  cris_addi_op,
+  cris_asr_op,
+  cris_asrq_op,
+  cris_ax_ei_setf_op,
+  cris_bdap_prefix,
+  cris_biap_prefix,
+  cris_break_op,
+  cris_btst_nop_op,
+  cris_clearf_di_op,
+  cris_dip_prefix,
+  cris_dstep_logshift_mstep_neg_not_op,
+  cris_eight_bit_offset_branch_op,
+  cris_move_mem_to_reg_movem_op,
+  cris_move_reg_to_mem_movem_op,
+  cris_move_to_preg_op,
+  cris_muls_op,
+  cris_mulu_op,
+  cris_none_reg_mode_add_sub_cmp_and_or_move_op,
+  cris_none_reg_mode_clear_test_op,
+  cris_none_reg_mode_jump_op,
+  cris_none_reg_mode_move_from_preg_op,
+  cris_quick_mode_add_sub_op,
+  cris_quick_mode_and_cmp_move_or_op,
+  cris_quick_mode_bdap_prefix,
+  cris_reg_mode_add_sub_cmp_and_or_move_op,
+  cris_reg_mode_clear_op,
+  cris_reg_mode_jump_op,
+  cris_reg_mode_move_from_preg_op,
+  cris_reg_mode_test_op,
+  cris_scc_op,
+  cris_sixteen_bit_offset_branch_op,
+  cris_three_operand_add_sub_cmp_and_or_op,
+  cris_three_operand_bound_op,
+  cris_two_operand_bound_op,
+  cris_xor_op
+};
+
+struct cris_opcode
+{
+  /* The name of the insn.  */
+  const char *name;
+
+  /* Bits that must be 1 for a match.  */
+  unsigned int match;
+
+  /* Bits that must be 0 for a match.  */
+  unsigned int lose;
+
+  /* See the table in "opcodes/cris-opc.c".  */
+  const char *args;
+
+  /* Nonzero if this is a delayed branch instruction.  */
+  char delayed;
+
+  /* Size of immediate operands.  */
+  enum cris_imm_oprnd_size_type imm_oprnd_size;
+
+  /* Indicates which version this insn was first implemented in.  */
+  enum cris_insn_version_usage applicable_version;
+
+  /* What kind of operation this is.  */
+  enum cris_op_type op;
+};
+extern const struct cris_opcode cris_opcodes[];
+
+
+/* These macros are for the target-specific flags in disassemble_info
+   used at disassembly.  */
+
+/* This insn accesses memory.  This flag is more trustworthy than
+   checking insn_type for "dis_dref" which does not work for
+   e.g. "JSR [foo]".  */
+#define CRIS_DIS_FLAG_MEMREF (1 << 0)
+
+/* The "target" field holds a register number.  */
+#define CRIS_DIS_FLAG_MEM_TARGET_IS_REG (1 << 1)
+
+/* The "target2" field holds a register number; add it to "target".  */
+#define CRIS_DIS_FLAG_MEM_TARGET2_IS_REG (1 << 2)
+
+/* Yet another add-on: the register in "target2" must be multiplied
+   by 2 before adding to "target".  */
+#define CRIS_DIS_FLAG_MEM_TARGET2_MULT2 (1 << 3)
+
+/* Yet another add-on: the register in "target2" must be multiplied
+   by 4 (mutually exclusive with .._MULT2).  */ 
+#define CRIS_DIS_FLAG_MEM_TARGET2_MULT4 (1 << 4)
+
+/* The register in "target2" is an indirect memory reference (of the
+   register there), add to "target".  Assumed size is dword (mutually
+   exclusive with .._MULT[24]).  */
+#define CRIS_DIS_FLAG_MEM_TARGET2_MEM (1 << 5)
+
+/* Add-on to CRIS_DIS_FLAG_MEM_TARGET2_MEM; the memory access is "byte";
+   sign-extended before adding to "target".  */
+#define CRIS_DIS_FLAG_MEM_TARGET2_MEM_BYTE (1 << 6)
+
+/* Add-on to CRIS_DIS_FLAG_MEM_TARGET2_MEM; the memory access is "word";
+   sign-extended before adding to "target".  */
+#define CRIS_DIS_FLAG_MEM_TARGET2_MEM_WORD (1 << 7)
+
+#endif /* __CRIS_H_INCLUDED_ */
+
+/*
+ * Local variables:
+ * eval: (c-set-style "gnu")
+ * indent-tabs-mode: t
+ * End:
+ */
diff --git a/include/opcode/hppa.h b/include/opcode/hppa.h
index 9ce59c3..f04403d 100644
--- a/include/opcode/hppa.h
+++ b/include/opcode/hppa.h
@@ -1,5 +1,6 @@
 /* Table of opcodes for the PA-RISC.
-   Copyright (C) 1990, 1991, 1993, 1995, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1991, 1993, 1995, 1999, 2000
+   Free Software Foundation, Inc.
 
    Contributed by the Center for Software Science at the
    University of Utah (pa-gdb-bugs@cs.utah.edu).
@@ -200,6 +201,7 @@
    ch	left/right half completer
    cH	signed/unsigned saturation completer
    cS	signed/unsigned completer at 21
+   cz	zero/sign extension completer.
    c*	permutation completer
 
 Condition operands all have '?' as the prefix:
diff --git a/include/opcode/i386.h b/include/opcode/i386.h
index d9c151e..6b2913f 100644
--- a/include/opcode/i386.h
+++ b/include/opcode/i386.h
@@ -50,28 +50,20 @@
 static const template i386_optab[] = {
 
 #define X None
-#define NoSuf (No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_dSuf|No_xSuf)
-#define b_Suf (No_wSuf|No_lSuf|No_sSuf|No_dSuf|No_xSuf)
-#define w_Suf (No_bSuf|No_lSuf|No_sSuf|No_dSuf|No_xSuf)
-#define l_Suf (No_bSuf|No_wSuf|No_sSuf|No_dSuf|No_xSuf)
-#define d_Suf (No_bSuf|No_wSuf|No_sSuf|No_lSuf|No_xSuf)
-#define x_Suf (No_bSuf|No_wSuf|No_sSuf|No_lSuf|No_dSuf)
-#define bw_Suf (No_lSuf|No_sSuf|No_dSuf|No_xSuf)
-#define bl_Suf (No_wSuf|No_sSuf|No_dSuf|No_xSuf)
-#define wl_Suf (No_bSuf|No_sSuf|No_dSuf|No_xSuf)
-#define wld_Suf (No_bSuf|No_sSuf|No_xSuf)
-#define sl_Suf (No_bSuf|No_wSuf|No_dSuf|No_xSuf)
-#define sld_Suf (No_bSuf|No_wSuf|No_xSuf)
-#define sldx_Suf (No_bSuf|No_wSuf)
-#define bwl_Suf (No_sSuf|No_dSuf|No_xSuf)
-#define bwld_Suf (No_sSuf|No_xSuf)
+#define NoSuf (No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_xSuf)
+#define b_Suf (No_wSuf|No_lSuf|No_sSuf|No_xSuf)
+#define w_Suf (No_bSuf|No_lSuf|No_sSuf|No_xSuf)
+#define l_Suf (No_bSuf|No_wSuf|No_sSuf|No_xSuf)
+#define x_Suf (No_bSuf|No_wSuf|No_sSuf|No_lSuf)
+#define bw_Suf (No_lSuf|No_sSuf|No_xSuf)
+#define bl_Suf (No_wSuf|No_sSuf|No_xSuf)
+#define wl_Suf (No_bSuf|No_sSuf|No_xSuf)
+#define sl_Suf (No_bSuf|No_wSuf|No_xSuf)
+#define bwl_Suf (No_sSuf|No_xSuf)
 #define FP (NoSuf|IgnoreSize)
 #define l_FP (l_Suf|IgnoreSize)
-#define d_FP (d_Suf|IgnoreSize)
 #define x_FP (x_Suf|IgnoreSize)
 #define sl_FP (sl_Suf|IgnoreSize)
-#define sld_FP (sld_Suf|IgnoreSize)
-#define sldx_FP (sldx_Suf|IgnoreSize)
 #if SYSV386_COMPAT
 /* Someone forgot that the FloatR bit reverses the operation when not
    equal to the FloatD bit.  ie. Changing only FloatD results in the
@@ -85,8 +77,8 @@
 #define MOV_AX_DISP32 0xa0
 { "mov",   2,	0xa0, X, 0,	 bwl_Suf|D|W,			{ Disp16|Disp32, Acc, 0 } },
 { "mov",   2,	0x88, X, 0,	 bwl_Suf|D|W|Modrm,		{ Reg, Reg|AnyMem, 0 } },
-{ "mov",   2,	0xb0, X, 0,	 bwl_Suf|W|ShortForm,		{ Imm, Reg, 0 } },
-{ "mov",   2,	0xc6, X, 0,	 bwl_Suf|W|Modrm,		{ Imm, Reg|AnyMem, 0 } },
+{ "mov",   2,	0xb0, X, 0,	 bwl_Suf|W|ShortForm,		{ EncImm, Reg, 0 } },
+{ "mov",   2,	0xc6, X, 0,	 bwl_Suf|W|Modrm,		{ EncImm, Reg|AnyMem, 0 } },
 /* The segment register moves accept WordReg so that a segment register
    can be copied to a 32 bit register, and vice versa, without using a
    size prefix.  When moving to a 32 bit register, the upper 16 bits
@@ -108,15 +100,15 @@
 {"movsbw", 2, 0x0fbe, X, Cpu386, NoSuf|Modrm,			{ Reg8|ByteMem, Reg16, 0} },
 {"movswl", 2, 0x0fbf, X, Cpu386, NoSuf|Modrm,			{ Reg16|ShortMem, Reg32, 0} },
 /* Intel Syntax next 2 insns */
-{"movsx",  2, 0x0fbf, X, Cpu386, w_Suf|Modrm|IgnoreSize,	{ Reg16|ShortMem, Reg32, 0} },
 {"movsx",  2, 0x0fbe, X, Cpu386, b_Suf|Modrm,			{ Reg8|ByteMem, WordReg, 0} },
+{"movsx",  2, 0x0fbf, X, Cpu386, w_Suf|Modrm|IgnoreSize,	{ Reg16|ShortMem, Reg32, 0} },
 
 /* Move with zero extend.  */
 {"movzb",  2, 0x0fb6, X, Cpu386, wl_Suf|Modrm,			{ Reg8|ByteMem, WordReg, 0} },
 {"movzwl", 2, 0x0fb7, X, Cpu386, NoSuf|Modrm,			{ Reg16|ShortMem, Reg32, 0} },
 /* Intel Syntax next 2 insns */
-{"movzx",  2, 0x0fb7, X, Cpu386, w_Suf|Modrm|IgnoreSize,	{ Reg16|ShortMem, Reg32, 0} },
 {"movzx",  2, 0x0fb6, X, Cpu386, b_Suf|Modrm,			{ Reg8|ByteMem, WordReg, 0} },
+{"movzx",  2, 0x0fb7, X, Cpu386, w_Suf|Modrm|IgnoreSize,	{ Reg16|ShortMem, Reg32, 0} },
 
 /* Push instructions.  */
 {"push",   1,	0x50, X, 0,	 wl_Suf|ShortForm|DefaultSize,	{ WordReg, 0, 0 } },
@@ -125,7 +117,7 @@
 {"push",   1,	0x68, X, Cpu186, wl_Suf|DefaultSize,		{ Imm16|Imm32, 0, 0} },
 {"push",   1,	0x06, X, 0,	 wl_Suf|Seg2ShortForm|DefaultSize, { SReg2, 0, 0 } },
 {"push",   1, 0x0fa0, X, Cpu386, wl_Suf|Seg3ShortForm|DefaultSize, { SReg3, 0, 0 } },
-{"pusha",  0,	0x60, X, Cpu186, wld_Suf|DefaultSize,		{ 0, 0, 0 } },
+{"pusha",  0,	0x60, X, Cpu186, wl_Suf|DefaultSize,		{ 0, 0, 0 } },
 
 /* Pop instructions.  */
 {"pop",	   1,	0x58, X, 0,	 wl_Suf|ShortForm|DefaultSize,	{ WordReg, 0, 0 } },
@@ -133,7 +125,7 @@
 #define POP_SEG_SHORT 0x07
 {"pop",	   1,	0x07, X, 0,	 wl_Suf|Seg2ShortForm|DefaultSize, { SReg2, 0, 0 } },
 {"pop",	   1, 0x0fa1, X, Cpu386, wl_Suf|Seg3ShortForm|DefaultSize, { SReg3, 0, 0 } },
-{"popa",   0,	0x61, X, Cpu186, wld_Suf|DefaultSize,		{ 0, 0, 0 } },
+{"popa",   0,	0x61, X, Cpu186, wl_Suf|DefaultSize,		{ 0, 0, 0 } },
 
 /* Exchange instructions.
    xchg commutes:  we allow both operand orders.  */
@@ -170,8 +162,8 @@
 {"cmc",	   0,	0xf5, X, 0,	 NoSuf,			{ 0, 0, 0} },
 {"lahf",   0,	0x9f, X, 0,	 NoSuf,			{ 0, 0, 0} },
 {"sahf",   0,	0x9e, X, 0,	 NoSuf,			{ 0, 0, 0} },
-{"pushf",  0,	0x9c, X, 0,	 wld_Suf|DefaultSize,	{ 0, 0, 0} },
-{"popf",   0,	0x9d, X, 0,	 wld_Suf|DefaultSize,	{ 0, 0, 0} },
+{"pushf",  0,	0x9c, X, 0,	 wl_Suf|DefaultSize,	{ 0, 0, 0} },
+{"popf",   0,	0x9d, X, 0,	 wl_Suf|DefaultSize,	{ 0, 0, 0} },
 {"stc",	   0,	0xf9, X, 0,	 NoSuf,			{ 0, 0, 0} },
 {"std",	   0,	0xfd, X, 0,	 NoSuf,			{ 0, 0, 0} },
 {"sti",	   0,	0xfb, X, 0,	 NoSuf,			{ 0, 0, 0} },
@@ -179,57 +171,57 @@
 /* Arithmetic.  */
 {"add",	   2,	0x00, X, 0,	 bwl_Suf|D|W|Modrm,	{ Reg, Reg|AnyMem, 0} },
 {"add",	   2,	0x83, 0, 0,	 wl_Suf|Modrm,		{ Imm8S, WordReg|WordMem, 0} },
-{"add",	   2,	0x04, X, 0,	 bwl_Suf|W,		{ Imm, Acc, 0} },
-{"add",	   2,	0x80, 0, 0,	 bwl_Suf|W|Modrm,	{ Imm, Reg|AnyMem, 0} },
+{"add",	   2,	0x04, X, 0,	 bwl_Suf|W,		{ EncImm, Acc, 0} },
+{"add",	   2,	0x80, 0, 0,	 bwl_Suf|W|Modrm,	{ EncImm, Reg|AnyMem, 0} },
 
 {"inc",	   1,	0x40, X, 0,	 wl_Suf|ShortForm,	{ WordReg, 0, 0} },
 {"inc",	   1,	0xfe, 0, 0,	 bwl_Suf|W|Modrm,	{ Reg|AnyMem, 0, 0} },
 
 {"sub",	   2,	0x28, X, 0,	 bwl_Suf|D|W|Modrm,	{ Reg, Reg|AnyMem, 0} },
 {"sub",	   2,	0x83, 5, 0,	 wl_Suf|Modrm,		{ Imm8S, WordReg|WordMem, 0} },
-{"sub",	   2,	0x2c, X, 0,	 bwl_Suf|W,		{ Imm, Acc, 0} },
-{"sub",	   2,	0x80, 5, 0,	 bwl_Suf|W|Modrm,	{ Imm, Reg|AnyMem, 0} },
+{"sub",	   2,	0x2c, X, 0,	 bwl_Suf|W,		{ EncImm, Acc, 0} },
+{"sub",	   2,	0x80, 5, 0,	 bwl_Suf|W|Modrm,	{ EncImm, Reg|AnyMem, 0} },
 
 {"dec",	   1,	0x48, X, 0,	 wl_Suf|ShortForm,	{ WordReg, 0, 0} },
 {"dec",	   1,	0xfe, 1, 0,	 bwl_Suf|W|Modrm,	{ Reg|AnyMem, 0, 0} },
 
 {"sbb",	   2,	0x18, X, 0,	 bwl_Suf|D|W|Modrm,	{ Reg, Reg|AnyMem, 0} },
 {"sbb",	   2,	0x83, 3, 0,	 wl_Suf|Modrm,		{ Imm8S, WordReg|WordMem, 0} },
-{"sbb",	   2,	0x1c, X, 0,	 bwl_Suf|W,		{ Imm, Acc, 0} },
-{"sbb",	   2,	0x80, 3, 0,	 bwl_Suf|W|Modrm,	{ Imm, Reg|AnyMem, 0} },
+{"sbb",	   2,	0x1c, X, 0,	 bwl_Suf|W,		{ EncImm, Acc, 0} },
+{"sbb",	   2,	0x80, 3, 0,	 bwl_Suf|W|Modrm,	{ EncImm, Reg|AnyMem, 0} },
 
 {"cmp",	   2,	0x38, X, 0,	 bwl_Suf|D|W|Modrm,	{ Reg, Reg|AnyMem, 0} },
 {"cmp",	   2,	0x83, 7, 0,	 wl_Suf|Modrm,		{ Imm8S, WordReg|WordMem, 0} },
-{"cmp",	   2,	0x3c, X, 0,	 bwl_Suf|W,		{ Imm, Acc, 0} },
-{"cmp",	   2,	0x80, 7, 0,	 bwl_Suf|W|Modrm,	{ Imm, Reg|AnyMem, 0} },
+{"cmp",	   2,	0x3c, X, 0,	 bwl_Suf|W,		{ EncImm, Acc, 0} },
+{"cmp",	   2,	0x80, 7, 0,	 bwl_Suf|W|Modrm,	{ EncImm, Reg|AnyMem, 0} },
 
 {"test",   2,	0x84, X, 0,	 bwl_Suf|W|Modrm,	{ Reg|AnyMem, Reg, 0} },
 {"test",   2,	0x84, X, 0,	 bwl_Suf|W|Modrm,	{ Reg, Reg|AnyMem, 0} },
-{"test",   2,	0xa8, X, 0,	 bwl_Suf|W,		{ Imm, Acc, 0} },
-{"test",   2,	0xf6, 0, 0,	 bwl_Suf|W|Modrm,	{ Imm, Reg|AnyMem, 0} },
+{"test",   2,	0xa8, X, 0,	 bwl_Suf|W,		{ EncImm, Acc, 0} },
+{"test",   2,	0xf6, 0, 0,	 bwl_Suf|W|Modrm,	{ EncImm, Reg|AnyMem, 0} },
 
 {"and",	   2,	0x20, X, 0,	 bwl_Suf|D|W|Modrm,	{ Reg, Reg|AnyMem, 0} },
 {"and",	   2,	0x83, 4, 0,	 wl_Suf|Modrm,		{ Imm8S, WordReg|WordMem, 0} },
-{"and",	   2,	0x24, X, 0,	 bwl_Suf|W,		{ Imm, Acc, 0} },
-{"and",	   2,	0x80, 4, 0,	 bwl_Suf|W|Modrm,	{ Imm, Reg|AnyMem, 0} },
+{"and",	   2,	0x24, X, 0,	 bwl_Suf|W,		{ EncImm, Acc, 0} },
+{"and",	   2,	0x80, 4, 0,	 bwl_Suf|W|Modrm,	{ EncImm, Reg|AnyMem, 0} },
 
 {"or",	   2,	0x08, X, 0,	 bwl_Suf|D|W|Modrm,	{ Reg, Reg|AnyMem, 0} },
 {"or",	   2,	0x83, 1, 0,	 wl_Suf|Modrm,		{ Imm8S, WordReg|WordMem, 0} },
-{"or",	   2,	0x0c, X, 0,	 bwl_Suf|W,		{ Imm, Acc, 0} },
-{"or",	   2,	0x80, 1, 0,	 bwl_Suf|W|Modrm,	{ Imm, Reg|AnyMem, 0} },
+{"or",	   2,	0x0c, X, 0,	 bwl_Suf|W,		{ EncImm, Acc, 0} },
+{"or",	   2,	0x80, 1, 0,	 bwl_Suf|W|Modrm,	{ EncImm, Reg|AnyMem, 0} },
 
 {"xor",	   2,	0x30, X, 0,	 bwl_Suf|D|W|Modrm,	{ Reg, Reg|AnyMem, 0} },
 {"xor",	   2,	0x83, 6, 0,	 wl_Suf|Modrm,		{ Imm8S, WordReg|WordMem, 0} },
-{"xor",	   2,	0x34, X, 0,	 bwl_Suf|W,		{ Imm, Acc, 0} },
-{"xor",	   2,	0x80, 6, 0,	 bwl_Suf|W|Modrm,	{ Imm, Reg|AnyMem, 0} },
+{"xor",	   2,	0x34, X, 0,	 bwl_Suf|W,		{ EncImm, Acc, 0} },
+{"xor",	   2,	0x80, 6, 0,	 bwl_Suf|W|Modrm,	{ EncImm, Reg|AnyMem, 0} },
 
 /* clr with 1 operand is really xor with 2 operands.  */
 {"clr",	   1,	0x30, X, 0,	 bwl_Suf|W|Modrm|regKludge,	{ Reg, 0, 0 } },
 
 {"adc",	   2,	0x10, X, 0,	 bwl_Suf|D|W|Modrm,	{ Reg, Reg|AnyMem, 0} },
 {"adc",	   2,	0x83, 2, 0,	 wl_Suf|Modrm,		{ Imm8S, WordReg|WordMem, 0} },
-{"adc",	   2,	0x14, X, 0,	 bwl_Suf|W,		{ Imm, Acc, 0} },
-{"adc",	   2,	0x80, 2, 0,	 bwl_Suf|W|Modrm,	{ Imm, Reg|AnyMem, 0} },
+{"adc",	   2,	0x14, X, 0,	 bwl_Suf|W,		{ EncImm, Acc, 0} },
+{"adc",	   2,	0x80, 2, 0,	 bwl_Suf|W|Modrm,	{ EncImm, Reg|AnyMem, 0} },
 
 {"neg",	   1,	0xf6, 3, 0,	 bwl_Suf|W|Modrm,	{ Reg|AnyMem, 0, 0} },
 {"not",	   1,	0xf6, 2, 0,	 bwl_Suf|W|Modrm,	{ Reg|AnyMem, 0, 0} },
@@ -429,36 +421,36 @@
 {"setg",   1, 0x0f9f, 0, Cpu386, b_Suf|Modrm,		{ Reg8|ByteMem, 0, 0} },
 
 /* String manipulation.  */
-{"cmps",   0,	0xa6, X, 0,	 bwld_Suf|W|IsString,	{ 0, 0, 0} },
-{"cmps",   2,	0xa6, X, 0,	 bwld_Suf|W|IsString,	{ AnyMem|EsSeg, AnyMem, 0} },
-{"scmp",   0,	0xa6, X, 0,	 bwld_Suf|W|IsString,	{ 0, 0, 0} },
-{"scmp",   2,	0xa6, X, 0,	 bwld_Suf|W|IsString,	{ AnyMem|EsSeg, AnyMem, 0} },
-{"ins",	   0,	0x6c, X, Cpu186, bwld_Suf|W|IsString,	{ 0, 0, 0} },
-{"ins",	   2,	0x6c, X, Cpu186, bwld_Suf|W|IsString,	{ InOutPortReg, AnyMem|EsSeg, 0} },
-{"outs",   0,	0x6e, X, Cpu186, bwld_Suf|W|IsString,	{ 0, 0, 0} },
-{"outs",   2,	0x6e, X, Cpu186, bwld_Suf|W|IsString,	{ AnyMem, InOutPortReg, 0} },
-{"lods",   0,	0xac, X, 0,	 bwld_Suf|W|IsString,	{ 0, 0, 0} },
-{"lods",   1,	0xac, X, 0,	 bwld_Suf|W|IsString,	{ AnyMem, 0, 0} },
-{"lods",   2,	0xac, X, 0,	 bwld_Suf|W|IsString,	{ AnyMem, Acc, 0} },
-{"slod",   0,	0xac, X, 0,	 bwld_Suf|W|IsString,	{ 0, 0, 0} },
-{"slod",   1,	0xac, X, 0,	 bwld_Suf|W|IsString,	{ AnyMem, 0, 0} },
-{"slod",   2,	0xac, X, 0,	 bwld_Suf|W|IsString,	{ AnyMem, Acc, 0} },
-{"movs",   0,	0xa4, X, 0,	 bwld_Suf|W|IsString,	{ 0, 0, 0} },
-{"movs",   2,	0xa4, X, 0,	 bwld_Suf|W|IsString,	{ AnyMem, AnyMem|EsSeg, 0} },
-{"smov",   0,	0xa4, X, 0,	 bwld_Suf|W|IsString,	{ 0, 0, 0} },
-{"smov",   2,	0xa4, X, 0,	 bwld_Suf|W|IsString,	{ AnyMem, AnyMem|EsSeg, 0} },
-{"scas",   0,	0xae, X, 0,	 bwld_Suf|W|IsString,	{ 0, 0, 0} },
-{"scas",   1,	0xae, X, 0,	 bwld_Suf|W|IsString,	{ AnyMem|EsSeg, 0, 0} },
-{"scas",   2,	0xae, X, 0,	 bwld_Suf|W|IsString,	{ AnyMem|EsSeg, Acc, 0} },
-{"ssca",   0,	0xae, X, 0,	 bwld_Suf|W|IsString,	{ 0, 0, 0} },
-{"ssca",   1,	0xae, X, 0,	 bwld_Suf|W|IsString,	{ AnyMem|EsSeg, 0, 0} },
-{"ssca",   2,	0xae, X, 0,	 bwld_Suf|W|IsString,	{ AnyMem|EsSeg, Acc, 0} },
-{"stos",   0,	0xaa, X, 0,	 bwld_Suf|W|IsString,	{ 0, 0, 0} },
-{"stos",   1,	0xaa, X, 0,	 bwld_Suf|W|IsString,	{ AnyMem|EsSeg, 0, 0} },
-{"stos",   2,	0xaa, X, 0,	 bwld_Suf|W|IsString,	{ Acc, AnyMem|EsSeg, 0} },
-{"ssto",   0,	0xaa, X, 0,	 bwld_Suf|W|IsString,	{ 0, 0, 0} },
-{"ssto",   1,	0xaa, X, 0,	 bwld_Suf|W|IsString,	{ AnyMem|EsSeg, 0, 0} },
-{"ssto",   2,	0xaa, X, 0,	 bwld_Suf|W|IsString,	{ Acc, AnyMem|EsSeg, 0} },
+{"cmps",   0,	0xa6, X, 0,	 bwl_Suf|W|IsString,	{ 0, 0, 0} },
+{"cmps",   2,	0xa6, X, 0,	 bwl_Suf|W|IsString,	{ AnyMem|EsSeg, AnyMem, 0} },
+{"scmp",   0,	0xa6, X, 0,	 bwl_Suf|W|IsString,	{ 0, 0, 0} },
+{"scmp",   2,	0xa6, X, 0,	 bwl_Suf|W|IsString,	{ AnyMem|EsSeg, AnyMem, 0} },
+{"ins",	   0,	0x6c, X, Cpu186, bwl_Suf|W|IsString,	{ 0, 0, 0} },
+{"ins",	   2,	0x6c, X, Cpu186, bwl_Suf|W|IsString,	{ InOutPortReg, AnyMem|EsSeg, 0} },
+{"outs",   0,	0x6e, X, Cpu186, bwl_Suf|W|IsString,	{ 0, 0, 0} },
+{"outs",   2,	0x6e, X, Cpu186, bwl_Suf|W|IsString,	{ AnyMem, InOutPortReg, 0} },
+{"lods",   0,	0xac, X, 0,	 bwl_Suf|W|IsString,	{ 0, 0, 0} },
+{"lods",   1,	0xac, X, 0,	 bwl_Suf|W|IsString,	{ AnyMem, 0, 0} },
+{"lods",   2,	0xac, X, 0,	 bwl_Suf|W|IsString,	{ AnyMem, Acc, 0} },
+{"slod",   0,	0xac, X, 0,	 bwl_Suf|W|IsString,	{ 0, 0, 0} },
+{"slod",   1,	0xac, X, 0,	 bwl_Suf|W|IsString,	{ AnyMem, 0, 0} },
+{"slod",   2,	0xac, X, 0,	 bwl_Suf|W|IsString,	{ AnyMem, Acc, 0} },
+{"movs",   0,	0xa4, X, 0,	 bwl_Suf|W|IsString,	{ 0, 0, 0} },
+{"movs",   2,	0xa4, X, 0,	 bwl_Suf|W|IsString,	{ AnyMem, AnyMem|EsSeg, 0} },
+{"smov",   0,	0xa4, X, 0,	 bwl_Suf|W|IsString,	{ 0, 0, 0} },
+{"smov",   2,	0xa4, X, 0,	 bwl_Suf|W|IsString,	{ AnyMem, AnyMem|EsSeg, 0} },
+{"scas",   0,	0xae, X, 0,	 bwl_Suf|W|IsString,	{ 0, 0, 0} },
+{"scas",   1,	0xae, X, 0,	 bwl_Suf|W|IsString,	{ AnyMem|EsSeg, 0, 0} },
+{"scas",   2,	0xae, X, 0,	 bwl_Suf|W|IsString,	{ AnyMem|EsSeg, Acc, 0} },
+{"ssca",   0,	0xae, X, 0,	 bwl_Suf|W|IsString,	{ 0, 0, 0} },
+{"ssca",   1,	0xae, X, 0,	 bwl_Suf|W|IsString,	{ AnyMem|EsSeg, 0, 0} },
+{"ssca",   2,	0xae, X, 0,	 bwl_Suf|W|IsString,	{ AnyMem|EsSeg, Acc, 0} },
+{"stos",   0,	0xaa, X, 0,	 bwl_Suf|W|IsString,	{ 0, 0, 0} },
+{"stos",   1,	0xaa, X, 0,	 bwl_Suf|W|IsString,	{ AnyMem|EsSeg, 0, 0} },
+{"stos",   2,	0xaa, X, 0,	 bwl_Suf|W|IsString,	{ Acc, AnyMem|EsSeg, 0} },
+{"ssto",   0,	0xaa, X, 0,	 bwl_Suf|W|IsString,	{ 0, 0, 0} },
+{"ssto",   1,	0xaa, X, 0,	 bwl_Suf|W|IsString,	{ AnyMem|EsSeg, 0, 0} },
+{"ssto",   2,	0xaa, X, 0,	 bwl_Suf|W|IsString,	{ Acc, AnyMem|EsSeg, 0} },
 {"xlat",   0,	0xd7, X, 0,	 b_Suf|IsString,	{ 0, 0, 0} },
 {"xlat",   1,	0xd7, X, 0,	 b_Suf|IsString,	{ AnyMem, 0, 0} },
 
@@ -482,7 +474,7 @@
 {"int",	   1,	0xcd, X, 0,	 NoSuf,			{ Imm8, 0, 0} },
 {"int3",   0,	0xcc, X, 0,	 NoSuf,			{ 0, 0, 0} },
 {"into",   0,	0xce, X, 0,	 NoSuf,			{ 0, 0, 0} },
-{"iret",   0,	0xcf, X, 0,	 wld_Suf|DefaultSize,	{ 0, 0, 0} },
+{"iret",   0,	0xcf, X, 0,	 wl_Suf|DefaultSize,	{ 0, 0, 0} },
 /* i386sl, i486sl, later 486, and Pentium.  */
 {"rsm",	   0, 0x0faa, X, Cpu386, NoSuf,			{ 0, 0, 0} },
 
@@ -515,7 +507,7 @@
 
 /* load */
 {"fld",	   1, 0xd9c0, X, 0,	 FP|ShortForm,		{ FloatReg, 0, 0} },
-{"fld",	   1,	0xd9, 0, 0,	 sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
+{"fld",	   1,	0xd9, 0, 0,	 sl_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
 {"fld",	   1, 0xd9c0, X, 0,	 l_FP|ShortForm|Ugh,	{ FloatReg, 0, 0} },
 /* Intel Syntax */
 {"fld",    1,	0xdb, 5, 0,	 x_FP|Modrm,		{ LLongMem, 0, 0} },
@@ -529,13 +521,13 @@
 
 /* store (no pop) */
 {"fst",	   1, 0xddd0, X, 0,	 FP|ShortForm,		{ FloatReg, 0, 0} },
-{"fst",	   1,	0xd9, 2, 0,	 sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
+{"fst",	   1,	0xd9, 2, 0,	 sl_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
 {"fst",	   1, 0xddd0, X, 0,	 l_FP|ShortForm|Ugh,	{ FloatReg, 0, 0} },
-{"fist",   1,	0xdf, 2, 0,	 sld_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
+{"fist",   1,	0xdf, 2, 0,	 sl_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
 
 /* store (with pop) */
 {"fstp",   1, 0xddd8, X, 0,	 FP|ShortForm,		{ FloatReg, 0, 0} },
-{"fstp",   1,	0xd9, 3, 0,	 sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
+{"fstp",   1,	0xd9, 3, 0,	 sl_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
 {"fstp",   1, 0xddd8, X, 0,	 l_FP|ShortForm|Ugh,	{ FloatReg, 0, 0} },
 /* Intel Syntax */
 {"fstp",   1,	0xdb, 7, 0,	 x_FP|Modrm,		{ LLongMem, 0, 0} },
@@ -556,7 +548,7 @@
 {"fcom",   1, 0xd8d0, X, 0,	 FP|ShortForm,		{ FloatReg, 0, 0} },
 /* alias for fcom %st(1) */
 {"fcom",   0, 0xd8d1, X, 0,	 FP,			{ 0, 0, 0} },
-{"fcom",   1,	0xd8, 2, 0,	 sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
+{"fcom",   1,	0xd8, 2, 0,	 sl_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
 {"fcom",   1, 0xd8d0, X, 0,	 l_FP|ShortForm|Ugh,	{ FloatReg, 0, 0} },
 {"ficom",  1,	0xde, 2, 0,	 sl_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
 
@@ -564,7 +556,7 @@
 {"fcomp",  1, 0xd8d8, X, 0,	 FP|ShortForm,		{ FloatReg, 0, 0} },
 /* alias for fcomp %st(1) */
 {"fcomp",  0, 0xd8d9, X, 0,	 FP,			{ 0, 0, 0} },
-{"fcomp",  1,	0xd8, 3, 0,	 sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
+{"fcomp",  1,	0xd8, 3, 0,	 sl_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
 {"fcomp",  1, 0xd8d8, X, 0,	 l_FP|ShortForm|Ugh,	{ FloatReg, 0, 0} },
 {"ficomp", 1,	0xde, 3, 0,	 sl_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
 {"fcompp", 0, 0xded9, X, 0,	 FP,			{ 0, 0, 0} },
@@ -600,8 +592,8 @@
 /* alias for faddp */
 {"fadd",   0, 0xdec1, X, 0,	 FP|Ugh,		{ 0, 0, 0} },
 #endif
-{"fadd",   1,	0xd8, 0, 0,	 sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
-{"fiadd",  1,	0xde, 0, 0,	 sld_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
+{"fadd",   1,	0xd8, 0, 0,	 sl_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
+{"fiadd",  1,	0xde, 0, 0,	 sl_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
 
 {"faddp",  2, 0xdec0, X, 0,	 FP|ShortForm,		{ FloatAcc, FloatReg, 0} },
 {"faddp",  1, 0xdec0, X, 0,	 FP|ShortForm,		{ FloatReg, 0, 0} },
@@ -616,7 +608,7 @@
 /* alias for fsubp */
 {"fsub",   0, 0xdee1, X, 0,	 FP|Ugh,		{ 0, 0, 0} },
 #endif
-{"fsub",   1,	0xd8, 4, 0,	 sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
+{"fsub",   1,	0xd8, 4, 0,	 sl_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
 {"fisub",  1,	0xde, 4, 0,	 sl_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
 
 #if SYSV386_COMPAT
@@ -639,7 +631,7 @@
 /* alias for fsubrp */
 {"fsubr",  0, 0xdee9, X, 0,	 FP|Ugh,		{ 0, 0, 0} },
 #endif
-{"fsubr",  1,	0xd8, 5, 0,	 sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
+{"fsubr",  1,	0xd8, 5, 0,	 sl_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
 {"fisubr", 1,	0xde, 5, 0,	 sl_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
 
 #if SYSV386_COMPAT
@@ -662,8 +654,8 @@
 /* alias for fmulp */
 {"fmul",   0, 0xdec9, X, 0,	 FP|Ugh,		{ 0, 0, 0} },
 #endif
-{"fmul",   1,	0xd8, 1, 0,	 sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
-{"fimul",  1,	0xde, 1, 0,	 sld_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
+{"fmul",   1,	0xd8, 1, 0,	 sl_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
+{"fimul",  1,	0xde, 1, 0,	 sl_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
 
 {"fmulp",  2, 0xdec8, X, 0,	 FP|ShortForm,		{ FloatAcc, FloatReg, 0} },
 {"fmulp",  1, 0xdec8, X, 0,	 FP|ShortForm,		{ FloatReg, 0, 0} },
@@ -677,8 +669,8 @@
 /* alias for fdivp */
 {"fdiv",   0, 0xdef1, X, 0,	 FP|Ugh,		{ 0, 0, 0} },
 #endif
-{"fdiv",   1,	0xd8, 6, 0,	 sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
-{"fidiv",  1,	0xde, 6, 0,	 sld_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
+{"fdiv",   1,	0xd8, 6, 0,	 sl_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
+{"fidiv",  1,	0xde, 6, 0,	 sl_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
 
 #if SYSV386_COMPAT
 {"fdivp",  2, 0xdef0, X, 0,	 FP|ShortForm,		{ FloatAcc, FloatReg, 0} },
@@ -700,7 +692,7 @@
 /* alias for fdivrp */
 {"fdivr",  0, 0xdef9, X, 0,	 FP|Ugh,		{ 0, 0, 0} },
 #endif
-{"fdivr",  1,	0xd8, 7, 0,	 sld_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
+{"fdivr",  1,	0xd8, 7, 0,	 sl_FP|FloatMF|Modrm,	{ LongMem|LLongMem, 0, 0} },
 {"fidivr", 1,	0xde, 7, 0,	 sl_FP|FloatMF|Modrm,	{ ShortMem|LongMem, 0, 0} },
 
 #if SYSV386_COMPAT
@@ -1075,24 +1067,16 @@
 #undef b_Suf
 #undef w_Suf
 #undef l_Suf
-#undef d_Suf
 #undef x_Suf
 #undef bw_Suf
 #undef bl_Suf
 #undef wl_Suf
-#undef wld_Suf
 #undef sl_Suf
-#undef sld_Suf
-#undef sldx_Suf
 #undef bwl_Suf
-#undef bwld_Suf
 #undef FP
 #undef l_FP
-#undef d_FP
 #undef x_FP
 #undef sl_FP
-#undef sld_FP
-#undef sldx_FP
 
 #define MAX_MNEM_SIZE 16	/* for parsing insn mnemonics from input */
 
@@ -1101,104 +1085,104 @@
 
 static const reg_entry i386_regtab[] = {
   /* make %st first as we test for it */
-  {"st", FloatReg|FloatAcc, 0},
+  {"st", FloatReg|FloatAcc, 0, 0},
   /* 8 bit regs */
-  {"al", Reg8|Acc, 0},
-  {"cl", Reg8|ShiftCount, 1},
-  {"dl", Reg8, 2},
-  {"bl", Reg8, 3},
-  {"ah", Reg8, 4},
-  {"ch", Reg8, 5},
-  {"dh", Reg8, 6},
-  {"bh", Reg8, 7},
+  {"al", Reg8|Acc, 0, 0},
+  {"cl", Reg8|ShiftCount, 0, 1},
+  {"dl", Reg8, 0, 2},
+  {"bl", Reg8, 0, 3},
+  {"ah", Reg8, 0, 4},
+  {"ch", Reg8, 0, 5},
+  {"dh", Reg8, 0, 6},
+  {"bh", Reg8, 0, 7},
   /* 16 bit regs */
-  {"ax", Reg16|Acc, 0},
-  {"cx", Reg16, 1},
-  {"dx", Reg16|InOutPortReg, 2},
-  {"bx", Reg16|BaseIndex, 3},
-  {"sp", Reg16, 4},
-  {"bp", Reg16|BaseIndex, 5},
-  {"si", Reg16|BaseIndex, 6},
-  {"di", Reg16|BaseIndex, 7},
+  {"ax", Reg16|Acc, 0, 0},
+  {"cx", Reg16, 0, 1},
+  {"dx", Reg16|InOutPortReg, 0, 2},
+  {"bx", Reg16|BaseIndex, 0, 3},
+  {"sp", Reg16, 0, 4},
+  {"bp", Reg16|BaseIndex, 0, 5},
+  {"si", Reg16|BaseIndex, 0, 6},
+  {"di", Reg16|BaseIndex, 0, 7},
   /* 32 bit regs */
-  {"eax", Reg32|BaseIndex|Acc, 0},
-  {"ecx", Reg32|BaseIndex, 1},
-  {"edx", Reg32|BaseIndex, 2},
-  {"ebx", Reg32|BaseIndex, 3},
-  {"esp", Reg32, 4},
-  {"ebp", Reg32|BaseIndex, 5},
-  {"esi", Reg32|BaseIndex, 6},
-  {"edi", Reg32|BaseIndex, 7},
+  {"eax", Reg32|BaseIndex|Acc, 0, 0},
+  {"ecx", Reg32|BaseIndex, 0, 1},
+  {"edx", Reg32|BaseIndex, 0, 2},
+  {"ebx", Reg32|BaseIndex, 0, 3},
+  {"esp", Reg32, 0, 4},
+  {"ebp", Reg32|BaseIndex, 0, 5},
+  {"esi", Reg32|BaseIndex, 0, 6},
+  {"edi", Reg32|BaseIndex, 0, 7},
   /* segment registers */
-  {"es", SReg2, 0},
-  {"cs", SReg2, 1},
-  {"ss", SReg2, 2},
-  {"ds", SReg2, 3},
-  {"fs", SReg3, 4},
-  {"gs", SReg3, 5},
+  {"es", SReg2, 0, 0},
+  {"cs", SReg2, 0, 1},
+  {"ss", SReg2, 0, 2},
+  {"ds", SReg2, 0, 3},
+  {"fs", SReg3, 0, 4},
+  {"gs", SReg3, 0, 5},
   /* control registers */
-  {"cr0", Control, 0},
-  {"cr1", Control, 1},
-  {"cr2", Control, 2},
-  {"cr3", Control, 3},
-  {"cr4", Control, 4},
-  {"cr5", Control, 5},
-  {"cr6", Control, 6},
-  {"cr7", Control, 7},
+  {"cr0", Control, 0, 0},
+  {"cr1", Control, 0, 1},
+  {"cr2", Control, 0, 2},
+  {"cr3", Control, 0, 3},
+  {"cr4", Control, 0, 4},
+  {"cr5", Control, 0, 5},
+  {"cr6", Control, 0, 6},
+  {"cr7", Control, 0, 7},
   /* debug registers */
-  {"db0", Debug, 0},
-  {"db1", Debug, 1},
-  {"db2", Debug, 2},
-  {"db3", Debug, 3},
-  {"db4", Debug, 4},
-  {"db5", Debug, 5},
-  {"db6", Debug, 6},
-  {"db7", Debug, 7},
-  {"dr0", Debug, 0},
-  {"dr1", Debug, 1},
-  {"dr2", Debug, 2},
-  {"dr3", Debug, 3},
-  {"dr4", Debug, 4},
-  {"dr5", Debug, 5},
-  {"dr6", Debug, 6},
-  {"dr7", Debug, 7},
+  {"db0", Debug, 0, 0},
+  {"db1", Debug, 0, 1},
+  {"db2", Debug, 0, 2},
+  {"db3", Debug, 0, 3},
+  {"db4", Debug, 0, 4},
+  {"db5", Debug, 0, 5},
+  {"db6", Debug, 0, 6},
+  {"db7", Debug, 0, 7},
+  {"dr0", Debug, 0, 0},
+  {"dr1", Debug, 0, 1},
+  {"dr2", Debug, 0, 2},
+  {"dr3", Debug, 0, 3},
+  {"dr4", Debug, 0, 4},
+  {"dr5", Debug, 0, 5},
+  {"dr6", Debug, 0, 6},
+  {"dr7", Debug, 0, 7},
   /* test registers */
-  {"tr0", Test, 0},
-  {"tr1", Test, 1},
-  {"tr2", Test, 2},
-  {"tr3", Test, 3},
-  {"tr4", Test, 4},
-  {"tr5", Test, 5},
-  {"tr6", Test, 6},
-  {"tr7", Test, 7},
+  {"tr0", Test, 0, 0},
+  {"tr1", Test, 0, 1},
+  {"tr2", Test, 0, 2},
+  {"tr3", Test, 0, 3},
+  {"tr4", Test, 0, 4},
+  {"tr5", Test, 0, 5},
+  {"tr6", Test, 0, 6},
+  {"tr7", Test, 0, 7},
   /* mmx and simd registers */
-  {"mm0", RegMMX, 0},
-  {"mm1", RegMMX, 1},
-  {"mm2", RegMMX, 2},
-  {"mm3", RegMMX, 3},
-  {"mm4", RegMMX, 4},
-  {"mm5", RegMMX, 5},
-  {"mm6", RegMMX, 6},
-  {"mm7", RegMMX, 7},
-  {"xmm0", RegXMM, 0},
-  {"xmm1", RegXMM, 1},
-  {"xmm2", RegXMM, 2},
-  {"xmm3", RegXMM, 3},
-  {"xmm4", RegXMM, 4},
-  {"xmm5", RegXMM, 5},
-  {"xmm6", RegXMM, 6},
-  {"xmm7", RegXMM, 7}
+  {"mm0", RegMMX, 0, 0},
+  {"mm1", RegMMX, 0, 1},
+  {"mm2", RegMMX, 0, 2},
+  {"mm3", RegMMX, 0, 3},
+  {"mm4", RegMMX, 0, 4},
+  {"mm5", RegMMX, 0, 5},
+  {"mm6", RegMMX, 0, 6},
+  {"mm7", RegMMX, 0, 7},
+  {"xmm0", RegXMM, 0, 0},
+  {"xmm1", RegXMM, 0, 1},
+  {"xmm2", RegXMM, 0, 2},
+  {"xmm3", RegXMM, 0, 3},
+  {"xmm4", RegXMM, 0, 4},
+  {"xmm5", RegXMM, 0, 5},
+  {"xmm6", RegXMM, 0, 6},
+  {"xmm7", RegXMM, 0, 7}
 };
 
 static const reg_entry i386_float_regtab[] = {
-  {"st(0)", FloatReg|FloatAcc, 0},
-  {"st(1)", FloatReg, 1},
-  {"st(2)", FloatReg, 2},
-  {"st(3)", FloatReg, 3},
-  {"st(4)", FloatReg, 4},
-  {"st(5)", FloatReg, 5},
-  {"st(6)", FloatReg, 6},
-  {"st(7)", FloatReg, 7}
+  {"st(0)", FloatReg|FloatAcc, 0, 0},
+  {"st(1)", FloatReg, 0, 1},
+  {"st(2)", FloatReg, 0, 2},
+  {"st(3)", FloatReg, 0, 3},
+  {"st(4)", FloatReg, 0, 4},
+  {"st(5)", FloatReg, 0, 5},
+  {"st(6)", FloatReg, 0, 6},
+  {"st(7)", FloatReg, 0, 7}
 };
 
 #define MAX_REG_NAME_SIZE 8	/* for parsing register names from input */
diff --git a/include/opcode/i860.h b/include/opcode/i860.h
index b6ebd25..7b24d2f 100644
--- a/include/opcode/i860.h
+++ b/include/opcode/i860.h
@@ -1,5 +1,5 @@
 /* Table of opcodes for the i860.
-   Copyright (C) 1989 Free Software Foundation, Inc.
+   Copyright (C) 1989, 2000 Free Software Foundation, Inc.
 
 This file is part of GAS, the GNU Assembler, and GDB, the GNU disassembler.
 
@@ -15,32 +15,36 @@
 
 You should have received a copy of the GNU General Public License
 along with GAS or GDB; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
 
-#if !defined(__STDC__) && !defined(const)
-#define const
-#endif
 
-/*
- * Structure of an opcode table entry.
- */
+/* Structure of an opcode table entry.  */
 struct i860_opcode
 {
+    /* The opcode name.  */
     const char *name;
-    unsigned long match;	/* Bits that must be set.  */
-    unsigned long lose;	/* Bits that must not be set.  */
+
+    /* Bits that must be set.  */
+    unsigned long match;
+
+    /* Bits that must not be set.  */
+    unsigned long lose;
+
     const char *args;
+
     /* Nonzero if this is a possible expand-instruction.  */
     char expand;
 };
 
+
 enum expand_type
 {
     E_MOV = 1, E_ADDR, E_U32, E_AND, E_S32, E_DELAY
 };
 
-/*
-   All i860 opcodes are 32 bits, except for the pseudoinstructions
+
+/* All i860 opcodes are 32 bits, except for the pseudo-instructions
    and the operations utilizing a 32-bit address expression, an
    unsigned 32-bit constant, or a signed 32-bit constant.
    These opcodes are expanded into a two-instruction sequence for
@@ -69,77 +73,84 @@
    d    dest register.
    c	ctrlreg control register.
    i    16 bit immediate.
-   I    16 bit immediate, aligned.
+   I    16 bit immediate, aligned 2^0. (ld.b)
+   J    16 bit immediate, aligned 2^1. (ld.s)
+   K    16 bit immediate, aligned 2^2. (ld.l, {p}fld.l, fst.l)
+   L    16 bit immediate, aligned 2^3. ({p}fld.d, fst.d)
+   M    16 bit immediate, aligned 2^4. ({p}fld.q, fst.q)
    5    5 bit immediate.
    l    lbroff 26 bit PC relative immediate.
    r    sbroff 16 bit PC relative immediate.
    s	split 16 bit immediate.
-   S	split 16 bit immediate, aligned.
+   S	split 16 bit immediate, aligned 2^0. (st.b)
+   T	split 16 bit immediate, aligned 2^1. (st.s)
+   U	split 16 bit immediate, aligned 2^2. (st.l)
    e    src1 floating point register.
    f    src2 floating point register.
-   g    dest floating point register.
+   g    dest floating point register.  */
 
-*/
 
-/* The order of the opcodes in this table is significant:
-   
-   * The assembler requires that all instances of the same mnemonic must be
-   consecutive.  If they aren't, the assembler will bomb at runtime.
-
-   * The disassembler should not care about the order of the opcodes.  */
+/* The order of the opcodes in this table is significant. The assembler
+   requires that all instances of the same mnemonic must be consecutive.
+   If they aren't, the assembler will not function properly.
+ 
+   The order of opcodes does not affect the disassembler.  */
 
 static struct i860_opcode i860_opcodes[] =
 {
-
-/* REG-Format Instructions */
+/* REG-Format Instructions.  */
 { "ld.c",	0x30000000, 0xcc000000, "c,d", 0 },	/* ld.c csrc2,idest */
 { "ld.b",	0x00000000, 0xfc000000, "1(2),d", 0 },	/* ld.b isrc1(isrc2),idest */
 { "ld.b",	0x04000000, 0xf8000000, "I(2),d", E_ADDR },	/* ld.b #const(isrc2),idest */
 { "ld.s",	0x10000000, 0xec000001, "1(2),d", 0 },	/* ld.s isrc1(isrc2),idest */
-{ "ld.s",	0x14000001, 0xe8000000, "I(2),d", E_ADDR },	/* ld.s #const(isrc2),idest */
+{ "ld.s",	0x14000000, 0xe8000001, "J(2),d", E_ADDR },	/* ld.s #const(isrc2),idest */
 { "ld.l",	0x10000001, 0xec000000, "1(2),d", 0 },	/* ld.l isrc1(isrc2),idest */
-{ "ld.l",	0x14000001, 0xe8000000, "I(2),d", E_ADDR },	/* ld.l #const(isrc2),idest */
+{ "ld.l",	0x14000001, 0xe8000000, "K(2),d", E_ADDR },	/* ld.l #const(isrc2),idest */
 
 { "st.c",	0x38000000, 0xc4000000, "1,c", 0 },	/* st.c isrc1ni,csrc2 */
 { "st.b",	0x0c000000, 0xf0000000, "1,S(2)", E_ADDR },	/* st.b isrc1ni,#const(isrc2) */
-{ "st.s",	0x1c000000, 0xe0000000, "1,S(2)", E_ADDR },	/* st.s isrc1ni,#const(isrc2) */
-{ "st.l",	0x1c000001, 0xe0000000, "1,S(2)", E_ADDR },	/* st.l isrc1ni,#const(isrc2) */
+{ "st.s",	0x1c000000, 0xe0000001, "1,T(2)", E_ADDR },	/* st.s isrc1ni,#const(isrc2) */
+{ "st.l",	0x1c000001, 0xe0000000, "1,U(2)", E_ADDR },	/* st.l isrc1ni,#const(isrc2) */
 
 { "ixfr",	0x08000000, 0xf4000000, "1,g", 0 },	/* ixfr isrc1ni,fdest */
 
 { "fld.l",	0x20000002, 0xdc000001, "1(2),g", 0 },	/* fld.l isrc1(isrc2),fdest */
-{ "fld.l",	0x24000002, 0xd8000001, "i(2),g", E_ADDR },	/* fld.l #const(isrc2),fdest */
+{ "fld.l",	0x24000002, 0xd8000001, "K(2),g", E_ADDR },	/* fld.l #const(isrc2),fdest */
 { "fld.l",	0x20000003, 0xdc000000, "1(2)++,g", 0 },	/* fld.l isrc1(isrc2)++,fdest */
-{ "fld.l",	0x24000003, 0xd8000000, "i(2)++,g", E_ADDR },	/* fld.l #const(isrc2)++,fdest */
+{ "fld.l",	0x24000003, 0xd8000000, "K(2)++,g", E_ADDR },	/* fld.l #const(isrc2)++,fdest */
 { "fld.d",	0x20000000, 0xdc000007, "1(2),g", 0 },	/* fld.d isrc1(isrc2),fdest */
-{ "fld.d",	0x24000000, 0xd8000007, "i(2),g", E_ADDR },	/* fld.d #const(isrc2),fdest */
+{ "fld.d",	0x24000000, 0xd8000007, "L(2),g", E_ADDR },	/* fld.d #const(isrc2),fdest */
 { "fld.d",	0x20000001, 0xdc000006, "1(2)++,g", 0 },	/* fld.d isrc1(isrc2)++,fdest */
-{ "fld.d",	0x24000001, 0xd8000006, "i(2)++,g", E_ADDR },	/* fld.d #const(isrc2)++,fdest */
+{ "fld.d",	0x24000001, 0xd8000006, "L(2)++,g", E_ADDR },	/* fld.d #const(isrc2)++,fdest */
 { "fld.q",	0x20000004, 0xdc000003, "1(2),g", 0 },	/* fld.q isrc1(isrc2),fdest */
-{ "fld.q",	0x24000004, 0xd8000003, "i(2),g", E_ADDR },	/* fld.q #const(isrc2),fdest */
+{ "fld.q",	0x24000004, 0xd8000003, "M(2),g", E_ADDR },	/* fld.q #const(isrc2),fdest */
 { "fld.q",	0x20000005, 0xdc000002, "1(2)++,g", 0 },	/* fld.q isrc1(isrc2)++,fdest */
-{ "fld.q",	0x24000005, 0xd8000002, "i(2)++,g", E_ADDR },	/* fld.q #const(isrc2)++,fdest */
+{ "fld.q",	0x24000005, 0xd8000002, "M(2)++,g", E_ADDR },	/* fld.q #const(isrc2)++,fdest */
 
-{ "pfld.l",	0x60000000, 0x9c000003, "1(2),g", 0 },	/* pfld.l isrc1(isrc2),fdest */
-{ "pfld.l",	0x64000000, 0x98000003, "i(2),g", E_ADDR },	/* pfld.l #const(isrc2),fdest */
-{ "pfld.l",	0x60000001, 0x9c000002, "1(2)++,g", 0 },	/* pfld.l isrc1(isrc2)++,fdest */
-{ "pfld.l",	0x64000001, 0x98000002, "i(2)++,g", E_ADDR },	/* pfld.l #const(isrc2)++,fdest */
+{ "pfld.l",	0x60000002, 0x9c000001, "1(2),g", 0 },	/* pfld.l isrc1(isrc2),fdest */
+{ "pfld.l",	0x64000002, 0x98000001, "K(2),g", E_ADDR },	/* pfld.l #const(isrc2),fdest */
+{ "pfld.l",	0x60000003, 0x9c000000, "1(2)++,g", 0 },	/* pfld.l isrc1(isrc2)++,fdest */
+{ "pfld.l",	0x64000003, 0x98000000, "K(2)++,g", E_ADDR },	/* pfld.l #const(isrc2)++,fdest */
 { "pfld.d",	0x60000000, 0x9c000007, "1(2),g", 0 },	/* pfld.d isrc1(isrc2),fdest */
-{ "pfld.d",	0x64000000, 0x98000007, "i(2),g", E_ADDR },	/* pfld.d #const(isrc2),fdest */
+{ "pfld.d",	0x64000000, 0x98000007, "L(2),g", E_ADDR },	/* pfld.d #const(isrc2),fdest */
 { "pfld.d",	0x60000001, 0x9c000006, "1(2)++,g", 0 },	/* pfld.d isrc1(isrc2)++,fdest */
-{ "pfld.d",	0x64000001, 0x98000006, "i(2)++,g", E_ADDR },	/* pfld.d #const(isrc2)++,fdest */
+{ "pfld.d",	0x64000001, 0x98000006, "L(2)++,g", E_ADDR },	/* pfld.d #const(isrc2)++,fdest */
 
 { "fst.l",	0x28000002, 0xd4000001, "g,1(2)", 0 },	/* fst.l fdest,isrc1(isrc2) */
-{ "fst.l",	0x2c000002, 0xd0000001, "g,i(2)", E_ADDR },	/* fst.l fdest,#const(isrc2) */
+{ "fst.l",	0x2c000002, 0xd0000001, "g,K(2)", E_ADDR },	/* fst.l fdest,#const(isrc2) */
 { "fst.l",	0x28000003, 0xd4000000, "g,1(2)++", 0 },	/* fst.l fdest,isrc1(isrc2)++ */
-{ "fst.l",	0x2c000003, 0xd0000000, "g,i(2)++", E_ADDR },	/* fst.l fdest,#const(isrc2)++ */
+{ "fst.l",	0x2c000003, 0xd0000000, "g,K(2)++", E_ADDR },	/* fst.l fdest,#const(isrc2)++ */
 { "fst.d",	0x28000000, 0xd4000007, "g,1(2)", 0 },	/* fst.d fdest,isrc1(isrc2) */
-{ "fst.d",	0x2c000000, 0xd0000007, "g,i(2)", E_ADDR },	/* fst.d fdest,#const(isrc2) */
+{ "fst.d",	0x2c000000, 0xd0000007, "g,L(2)", E_ADDR },	/* fst.d fdest,#const(isrc2) */
 { "fst.d",	0x28000001, 0xd4000006, "g,1(2)++", 0 },	/* fst.d fdest,isrc1(isrc2)++ */
-{ "fst.d",	0x2c000001, 0xd0000006, "g,i(2)++", E_ADDR },	/* fst.d fdest,#const(isrc2)++ */
+{ "fst.d",	0x2c000001, 0xd0000006, "g,L(2)++", E_ADDR },	/* fst.d fdest,#const(isrc2)++ */
+{ "fst.q",	0x28000004, 0xd4000003, "g,1(2)", 0 },	/* fst.d fdest,isrc1(isrc2) */
+{ "fst.q",	0x2c000004, 0xd0000003, "g,M(2)", E_ADDR },	/* fst.d fdest,#const(isrc2) */
+{ "fst.q",	0x28000005, 0xd4000002, "g,1(2)++", 0 },	/* fst.d fdest,isrc1(isrc2)++ */
+{ "fst.q",	0x2c000005, 0xd0000002, "g,M(2)++", E_ADDR },	/* fst.d fdest,#const(isrc2)++ */
 
-{ "pst.d",	0x3c000000, 0xc0000007, "g,i(2)", E_ADDR },	/* pst.d fdest,#const(isrc2) */
-{ "pst.d",	0x3c000001, 0xc0000006, "g,i(2)++", E_ADDR },	/* pst.d fdest,#const(isrc2)++ */
+{ "pst.d",	0x3c000000, 0xc0000007, "g,L(2)", E_ADDR },	/* pst.d fdest,#const(isrc2) */
+{ "pst.d",	0x3c000001, 0xc0000006, "g,L(2)++", E_ADDR },	/* pst.d fdest,#const(isrc2)++ */
 
 { "addu",	0x80000000, 0x7c000000, "1,2,d", 0 },	/* addu isrc1,isrc2,idest */
 { "addu",	0x84000000, 0x78000000, "i,2,d", E_S32 },	/* addu #const,isrc2,idest */
@@ -170,26 +181,22 @@
 
 { "and",	0xc0000000, 0x3c000000, "1,2,d", 0 },	/* and isrc1,isrc2,idest */
 { "and",	0xc4000000, 0x38000000, "i,2,d", E_AND },	/* and #const,isrc2,idest */
-{ "andh",	0xc8000000, 0x34000000, "1,2,d", 0 },	/* andh isrc1,isrc2,idest */
 { "andh",	0xcc000000, 0x30000000, "i,2,d", 0 },	/* andh #const,isrc2,idest */
 { "andnot",	0xd0000000, 0x2c000000, "1,2,d", 0 },	/* andnot isrc1,isrc2,idest */
 { "andnot",	0xd4000000, 0x28000000, "i,2,d", E_U32 },	/* andnot #const,isrc2,idest */
-{ "andnoth",	0xd8000000, 0x24000000, "1,2,d", 0 },	/* andnoth isrc1,isrc2,idest */
 { "andnoth",	0xdc000000, 0x20000000, "i,2,d", 0 },	/* andnoth #const,isrc2,idest */
 { "or",		0xe0000000, 0x1c000000, "1,2,d", 0 },	/* or isrc1,isrc2,idest */
 { "or",		0xe4000000, 0x18000000, "i,2,d", E_U32 },	/* or #const,isrc2,idest */
-{ "orh",	0xe8000000, 0x14000000, "1,2,d", 0 },	/* orh isrc1,isrc2,idest */
 { "orh",	0xec000000, 0x10000000, "i,2,d", 0 },	/* orh #const,isrc2,idest */
 { "xor",	0xf0000000, 0x0c000000, "1,2,d", 0 },	/* xor isrc1,isrc2,idest */
 { "xor",	0xf4000000, 0x08000000, "i,2,d", E_U32 },	/* xor #const,isrc2,idest */
-{ "xorh",	0xf8000000, 0x04000000, "1,2,d", 0 },	/* xorh isrc1,isrc2,idest */
 { "xorh",	0xfc000000, 0x00000000, "i,2,d", 0 },	/* xorh #const,isrc2,idest */
 
-{ "bte",	0x58000000, 0xa4000000, "1,2,s", 0 },	/* bte isrc1s,isrc2,sbroff */
-{ "bte",	0x5c000000, 0xa0000000, "5,2,s", 0 },	/* bte #const5,isrc2,sbroff */
-{ "btne",	0x50000000, 0xac000000, "1,2,s", 0 },	/* btne isrc1s,isrc2,sbroff */
-{ "btne",	0x54000000, 0xa8000000, "5,2,s", 0 },	/* btne #const5,isrc2,sbroff */
-{ "bla",	0xb4000000, 0x48000000, "1,2,s", E_DELAY },	/* bla isrc1s,isrc2,sbroff */
+{ "bte",	0x58000000, 0xa4000000, "1,2,r", 0 },	/* bte isrc1s,isrc2,sbroff */
+{ "bte",	0x5c000000, 0xa0000000, "5,2,r", 0 },	/* bte #const5,isrc2,sbroff */
+{ "btne",	0x50000000, 0xac000000, "1,2,r", 0 },	/* btne isrc1s,isrc2,sbroff */
+{ "btne",	0x54000000, 0xa8000000, "5,2,r", 0 },	/* btne #const5,isrc2,sbroff */
+{ "bla",	0xb4000000, 0x48000000, "1,2,r", E_DELAY },	/* bla isrc1s,isrc2,sbroff */
 { "bri",	0x40000000, 0xbc000000, "1", E_DELAY },	/* bri isrc1ni */
 
 /* Core Escape Instruction Format */
@@ -206,283 +213,282 @@
 { "bnc",	0x78000000, 0x84000000, "l", 0 },	/* bnc lbroff */
 { "bnc.t",	0x7c000000, 0x80000000, "l", E_DELAY },	/* bnc.t lbroff */
 
-/* Floating Point Escape Instruction Format - pfam.p fsrc1,fsrc2,fdest */
-{ "r2p1.ss",	0x48000400, 0xb40003ff, "e,f,g", 0 },
-{ "r2p1.sd",	0x48000480, 0xb400037f, "e,f,g", 0 },
-{ "r2p1.dd",	0x48000580, 0xb400027f, "e,f,g", 0 },
-{ "r2pt.ss",	0x48000401, 0xb40003fe, "e,f,g", 0 },
-{ "r2pt.sd",	0x48000481, 0xb400037e, "e,f,g", 0 },
-{ "r2pt.dd",	0x48000581, 0xb400027e, "e,f,g", 0 },
-{ "r2ap1.ss",	0x48000402, 0xb40003fd, "e,f,g", 0 },
-{ "r2ap1.sd",	0x48000482, 0xb400037d, "e,f,g", 0 },
-{ "r2ap1.dd",	0x48000582, 0xb400027d, "e,f,g", 0 },
-{ "r2apt.ss",	0x48000403, 0xb40003fc, "e,f,g", 0 },
-{ "r2apt.sd",	0x48000483, 0xb400037c, "e,f,g", 0 },
-{ "r2apt.dd",	0x48000583, 0xb400027c, "e,f,g", 0 },
-{ "i2p1.ss",	0x48000404, 0xb40003fb, "e,f,g", 0 },
-{ "i2p1.sd",	0x48000484, 0xb400037b, "e,f,g", 0 },
-{ "i2p1.dd",	0x48000584, 0xb400027b, "e,f,g", 0 },
-{ "i2pt.ss",	0x48000405, 0xb40003fa, "e,f,g", 0 },
-{ "i2pt.sd",	0x48000485, 0xb400037a, "e,f,g", 0 },
-{ "i2pt.dd",	0x48000585, 0xb400027a, "e,f,g", 0 },
-{ "i2ap1.ss",	0x48000406, 0xb40003f9, "e,f,g", 0 },
-{ "i2ap1.sd",	0x48000486, 0xb4000379, "e,f,g", 0 },
-{ "i2ap1.dd",	0x48000586, 0xb4000279, "e,f,g", 0 },
-{ "i2apt.ss",	0x48000407, 0xb40003f8, "e,f,g", 0 },
-{ "i2apt.sd",	0x48000487, 0xb4000378, "e,f,g", 0 },
-{ "i2apt.dd",	0x48000587, 0xb4000278, "e,f,g", 0 },
-{ "rat1p2.ss",	0x48000408, 0xb40003f7, "e,f,g", 0 },
-{ "rat1p2.sd",	0x48000488, 0xb4000377, "e,f,g", 0 },
-{ "rat1p2.dd",	0x48000588, 0xb4000277, "e,f,g", 0 },
-{ "m12apm.ss",	0x48000409, 0xb40003f6, "e,f,g", 0 },
-{ "m12apm.sd",	0x48000489, 0xb4000376, "e,f,g", 0 },
-{ "m12apm.dd",	0x48000589, 0xb4000276, "e,f,g", 0 },
-{ "ra1p2.ss",	0x4800040a, 0xb40003f5, "e,f,g", 0 },
-{ "ra1p2.sd",	0x4800048a, 0xb4000375, "e,f,g", 0 },
-{ "ra1p2.dd",	0x4800058a, 0xb4000275, "e,f,g", 0 },
-{ "m12ttpa.ss",	0x4800040b, 0xb40003f4, "e,f,g", 0 },
-{ "m12ttpa.sd",	0x4800048b, 0xb4000374, "e,f,g", 0 },
-{ "m12ttpa.dd",	0x4800058b, 0xb4000274, "e,f,g", 0 },
-{ "iat1p2.ss",	0x4800040c, 0xb40003f3, "e,f,g", 0 },
-{ "iat1p2.sd",	0x4800048c, 0xb4000373, "e,f,g", 0 },
-{ "iat1p2.dd",	0x4800058c, 0xb4000273, "e,f,g", 0 },
-{ "m12tpm.ss",	0x4800040d, 0xb40003f2, "e,f,g", 0 },
-{ "m12tpm.sd",	0x4800048d, 0xb4000372, "e,f,g", 0 },
-{ "m12tpm.dd",	0x4800058d, 0xb4000272, "e,f,g", 0 },
-{ "ia1p2.ss",	0x4800040e, 0xb40003f1, "e,f,g", 0 },
-{ "ia1p2.sd",	0x4800048e, 0xb4000371, "e,f,g", 0 },
-{ "ia1p2.dd",	0x4800058e, 0xb4000271, "e,f,g", 0 },
-{ "m12tpa.ss",	0x4800040f, 0xb40003f0, "e,f,g", 0 },
-{ "m12tpa.sd",	0x4800048f, 0xb4000370, "e,f,g", 0 },
-{ "m12tpa.dd",	0x4800058f, 0xb4000270, "e,f,g", 0 },
+/* Floating Point Escape Instruction Format - pfam.p fsrc1,fsrc2,fdest.  */
+{ "r2p1.ss",	0x48000400, 0xb40001ff, "e,f,g", 0 },
+{ "r2p1.sd",	0x48000480, 0xb400017f, "e,f,g", 0 },
+{ "r2p1.dd",	0x48000580, 0xb400007f, "e,f,g", 0 },
+{ "r2pt.ss",	0x48000401, 0xb40001fe, "e,f,g", 0 },
+{ "r2pt.sd",	0x48000481, 0xb400017e, "e,f,g", 0 },
+{ "r2pt.dd",	0x48000581, 0xb400007e, "e,f,g", 0 },
+{ "r2ap1.ss",	0x48000402, 0xb40001fd, "e,f,g", 0 },
+{ "r2ap1.sd",	0x48000482, 0xb400017d, "e,f,g", 0 },
+{ "r2ap1.dd",	0x48000582, 0xb400007d, "e,f,g", 0 },
+{ "r2apt.ss",	0x48000403, 0xb40001fc, "e,f,g", 0 },
+{ "r2apt.sd",	0x48000483, 0xb400017c, "e,f,g", 0 },
+{ "r2apt.dd",	0x48000583, 0xb400007c, "e,f,g", 0 },
+{ "i2p1.ss",	0x48000404, 0xb40001fb, "e,f,g", 0 },
+{ "i2p1.sd",	0x48000484, 0xb400017b, "e,f,g", 0 },
+{ "i2p1.dd",	0x48000584, 0xb400007b, "e,f,g", 0 },
+{ "i2pt.ss",	0x48000405, 0xb40001fa, "e,f,g", 0 },
+{ "i2pt.sd",	0x48000485, 0xb400017a, "e,f,g", 0 },
+{ "i2pt.dd",	0x48000585, 0xb400007a, "e,f,g", 0 },
+{ "i2ap1.ss",	0x48000406, 0xb40001f9, "e,f,g", 0 },
+{ "i2ap1.sd",	0x48000486, 0xb4000179, "e,f,g", 0 },
+{ "i2ap1.dd",	0x48000586, 0xb4000079, "e,f,g", 0 },
+{ "i2apt.ss",	0x48000407, 0xb40001f8, "e,f,g", 0 },
+{ "i2apt.sd",	0x48000487, 0xb4000178, "e,f,g", 0 },
+{ "i2apt.dd",	0x48000587, 0xb4000078, "e,f,g", 0 },
+{ "rat1p2.ss",	0x48000408, 0xb40001f7, "e,f,g", 0 },
+{ "rat1p2.sd",	0x48000488, 0xb4000177, "e,f,g", 0 },
+{ "rat1p2.dd",	0x48000588, 0xb4000077, "e,f,g", 0 },
+{ "m12apm.ss",	0x48000409, 0xb40001f6, "e,f,g", 0 },
+{ "m12apm.sd",	0x48000489, 0xb4000176, "e,f,g", 0 },
+{ "m12apm.dd",	0x48000589, 0xb4000076, "e,f,g", 0 },
+{ "ra1p2.ss",	0x4800040a, 0xb40001f5, "e,f,g", 0 },
+{ "ra1p2.sd",	0x4800048a, 0xb4000175, "e,f,g", 0 },
+{ "ra1p2.dd",	0x4800058a, 0xb4000075, "e,f,g", 0 },
+{ "m12ttpa.ss",	0x4800040b, 0xb40001f4, "e,f,g", 0 },
+{ "m12ttpa.sd",	0x4800048b, 0xb4000174, "e,f,g", 0 },
+{ "m12ttpa.dd",	0x4800058b, 0xb4000074, "e,f,g", 0 },
+{ "iat1p2.ss",	0x4800040c, 0xb40001f3, "e,f,g", 0 },
+{ "iat1p2.sd",	0x4800048c, 0xb4000173, "e,f,g", 0 },
+{ "iat1p2.dd",	0x4800058c, 0xb4000073, "e,f,g", 0 },
+{ "m12tpm.ss",	0x4800040d, 0xb40001f2, "e,f,g", 0 },
+{ "m12tpm.sd",	0x4800048d, 0xb4000172, "e,f,g", 0 },
+{ "m12tpm.dd",	0x4800058d, 0xb4000072, "e,f,g", 0 },
+{ "ia1p2.ss",	0x4800040e, 0xb40001f1, "e,f,g", 0 },
+{ "ia1p2.sd",	0x4800048e, 0xb4000171, "e,f,g", 0 },
+{ "ia1p2.dd",	0x4800058e, 0xb4000071, "e,f,g", 0 },
+{ "m12tpa.ss",	0x4800040f, 0xb40001f0, "e,f,g", 0 },
+{ "m12tpa.sd",	0x4800048f, 0xb4000170, "e,f,g", 0 },
+{ "m12tpa.dd",	0x4800058f, 0xb4000070, "e,f,g", 0 },
 
-/* Floating Point Escape Instruction Format - pfsm.p fsrc1,fsrc2,fdest */
-{ "r2s1.ss",	0x48000410, 0xb40003ef, "e,f,g", 0 },
-{ "r2s1.sd",	0x48000490, 0xb400036f, "e,f,g", 0 },
-{ "r2s1.dd",	0x48000590, 0xb400026f, "e,f,g", 0 },
-{ "r2st.ss",	0x48000411, 0xb40003ee, "e,f,g", 0 },
-{ "r2st.sd",	0x48000491, 0xb400036e, "e,f,g", 0 },
-{ "r2st.dd",	0x48000591, 0xb400026e, "e,f,g", 0 },
-{ "r2as1.ss",	0x48000412, 0xb40003ed, "e,f,g", 0 },
-{ "r2as1.sd",	0x48000492, 0xb400036d, "e,f,g", 0 },
-{ "r2as1.dd",	0x48000592, 0xb400026d, "e,f,g", 0 },
-{ "r2ast.ss",	0x48000413, 0xb40003ec, "e,f,g", 0 },
-{ "r2ast.sd",	0x48000493, 0xb400036c, "e,f,g", 0 },
-{ "r2ast.dd",	0x48000593, 0xb400026c, "e,f,g", 0 },
-{ "i2s1.ss",	0x48000414, 0xb40003eb, "e,f,g", 0 },
-{ "i2s1.sd",	0x48000494, 0xb400036b, "e,f,g", 0 },
-{ "i2s1.dd",	0x48000594, 0xb400026b, "e,f,g", 0 },
-{ "i2st.ss",	0x48000415, 0xb40003ea, "e,f,g", 0 },
-{ "i2st.sd",	0x48000495, 0xb400036a, "e,f,g", 0 },
-{ "i2st.dd",	0x48000595, 0xb400026a, "e,f,g", 0 },
-{ "i2as1.ss",	0x48000416, 0xb40003e9, "e,f,g", 0 },
-{ "i2as1.sd",	0x48000496, 0xb4000369, "e,f,g", 0 },
-{ "i2as1.dd",	0x48000596, 0xb4000269, "e,f,g", 0 },
-{ "i2ast.ss",	0x48000417, 0xb40003e8, "e,f,g", 0 },
-{ "i2ast.sd",	0x48000497, 0xb4000368, "e,f,g", 0 },
-{ "i2ast.dd",	0x48000597, 0xb4000268, "e,f,g", 0 },
-{ "rat1s2.ss",	0x48000418, 0xb40003e7, "e,f,g", 0 },
-{ "rat1s2.sd",	0x48000498, 0xb4000367, "e,f,g", 0 },
-{ "rat1s2.dd",	0x48000598, 0xb4000267, "e,f,g", 0 },
-{ "m12asm.ss",	0x48000419, 0xb40003e6, "e,f,g", 0 },
-{ "m12asm.sd",	0x48000499, 0xb4000366, "e,f,g", 0 },
-{ "m12asm.dd",	0x48000599, 0xb4000266, "e,f,g", 0 },
-{ "ra1s2.ss",	0x4800041a, 0xb40003e5, "e,f,g", 0 },
-{ "ra1s2.sd",	0x4800049a, 0xb4000365, "e,f,g", 0 },
-{ "ra1s2.dd",	0x4800059a, 0xb4000265, "e,f,g", 0 },
-{ "m12ttsa.ss",	0x4800041b, 0xb40003e4, "e,f,g", 0 },
-{ "m12ttsa.sd",	0x4800049b, 0xb4000364, "e,f,g", 0 },
-{ "m12ttsa.dd",	0x4800059b, 0xb4000264, "e,f,g", 0 },
-{ "iat1s2.ss",	0x4800041c, 0xb40003e3, "e,f,g", 0 },
-{ "iat1s2.sd",	0x4800049c, 0xb4000363, "e,f,g", 0 },
-{ "iat1s2.dd",	0x4800059c, 0xb4000263, "e,f,g", 0 },
-{ "m12tsm.ss",	0x4800041d, 0xb40003e2, "e,f,g", 0 },
-{ "m12tsm.sd",	0x4800049d, 0xb4000362, "e,f,g", 0 },
-{ "m12tsm.dd",	0x4800059d, 0xb4000262, "e,f,g", 0 },
-{ "ia1s2.ss",	0x4800041e, 0xb40003e1, "e,f,g", 0 },
-{ "ia1s2.sd",	0x4800049e, 0xb4000361, "e,f,g", 0 },
-{ "ia1s2.dd",	0x4800059e, 0xb4000261, "e,f,g", 0 },
-{ "m12tsa.ss",	0x4800041f, 0xb40003e0, "e,f,g", 0 },
-{ "m12tsa.sd",	0x4800049f, 0xb4000360, "e,f,g", 0 },
-{ "m12tsa.dd",	0x4800059f, 0xb4000260, "e,f,g", 0 },
+/* Floating Point Escape Instruction Format - pfsm.p fsrc1,fsrc2,fdest.  */
+{ "r2s1.ss",	0x48000410, 0xb40001ef, "e,f,g", 0 },
+{ "r2s1.sd",	0x48000490, 0xb400016f, "e,f,g", 0 },
+{ "r2s1.dd",	0x48000590, 0xb400006f, "e,f,g", 0 },
+{ "r2st.ss",	0x48000411, 0xb40001ee, "e,f,g", 0 },
+{ "r2st.sd",	0x48000491, 0xb400016e, "e,f,g", 0 },
+{ "r2st.dd",	0x48000591, 0xb400006e, "e,f,g", 0 },
+{ "r2as1.ss",	0x48000412, 0xb40001ed, "e,f,g", 0 },
+{ "r2as1.sd",	0x48000492, 0xb400016d, "e,f,g", 0 },
+{ "r2as1.dd",	0x48000592, 0xb400006d, "e,f,g", 0 },
+{ "r2ast.ss",	0x48000413, 0xb40001ec, "e,f,g", 0 },
+{ "r2ast.sd",	0x48000493, 0xb400016c, "e,f,g", 0 },
+{ "r2ast.dd",	0x48000593, 0xb400006c, "e,f,g", 0 },
+{ "i2s1.ss",	0x48000414, 0xb40001eb, "e,f,g", 0 },
+{ "i2s1.sd",	0x48000494, 0xb400016b, "e,f,g", 0 },
+{ "i2s1.dd",	0x48000594, 0xb400006b, "e,f,g", 0 },
+{ "i2st.ss",	0x48000415, 0xb40001ea, "e,f,g", 0 },
+{ "i2st.sd",	0x48000495, 0xb400016a, "e,f,g", 0 },
+{ "i2st.dd",	0x48000595, 0xb400006a, "e,f,g", 0 },
+{ "i2as1.ss",	0x48000416, 0xb40001e9, "e,f,g", 0 },
+{ "i2as1.sd",	0x48000496, 0xb4000169, "e,f,g", 0 },
+{ "i2as1.dd",	0x48000596, 0xb4000069, "e,f,g", 0 },
+{ "i2ast.ss",	0x48000417, 0xb40001e8, "e,f,g", 0 },
+{ "i2ast.sd",	0x48000497, 0xb4000168, "e,f,g", 0 },
+{ "i2ast.dd",	0x48000597, 0xb4000068, "e,f,g", 0 },
+{ "rat1s2.ss",	0x48000418, 0xb40001e7, "e,f,g", 0 },
+{ "rat1s2.sd",	0x48000498, 0xb4000167, "e,f,g", 0 },
+{ "rat1s2.dd",	0x48000598, 0xb4000067, "e,f,g", 0 },
+{ "m12asm.ss",	0x48000419, 0xb40001e6, "e,f,g", 0 },
+{ "m12asm.sd",	0x48000499, 0xb4000166, "e,f,g", 0 },
+{ "m12asm.dd",	0x48000599, 0xb4000066, "e,f,g", 0 },
+{ "ra1s2.ss",	0x4800041a, 0xb40001e5, "e,f,g", 0 },
+{ "ra1s2.sd",	0x4800049a, 0xb4000165, "e,f,g", 0 },
+{ "ra1s2.dd",	0x4800059a, 0xb4000065, "e,f,g", 0 },
+{ "m12ttsa.ss",	0x4800041b, 0xb40001e4, "e,f,g", 0 },
+{ "m12ttsa.sd",	0x4800049b, 0xb4000164, "e,f,g", 0 },
+{ "m12ttsa.dd",	0x4800059b, 0xb4000064, "e,f,g", 0 },
+{ "iat1s2.ss",	0x4800041c, 0xb40001e3, "e,f,g", 0 },
+{ "iat1s2.sd",	0x4800049c, 0xb4000163, "e,f,g", 0 },
+{ "iat1s2.dd",	0x4800059c, 0xb4000063, "e,f,g", 0 },
+{ "m12tsm.ss",	0x4800041d, 0xb40001e2, "e,f,g", 0 },
+{ "m12tsm.sd",	0x4800049d, 0xb4000162, "e,f,g", 0 },
+{ "m12tsm.dd",	0x4800059d, 0xb4000062, "e,f,g", 0 },
+{ "ia1s2.ss",	0x4800041e, 0xb40001e1, "e,f,g", 0 },
+{ "ia1s2.sd",	0x4800049e, 0xb4000161, "e,f,g", 0 },
+{ "ia1s2.dd",	0x4800059e, 0xb4000061, "e,f,g", 0 },
+{ "m12tsa.ss",	0x4800041f, 0xb40001e0, "e,f,g", 0 },
+{ "m12tsa.sd",	0x4800049f, 0xb4000160, "e,f,g", 0 },
+{ "m12tsa.dd",	0x4800059f, 0xb4000060, "e,f,g", 0 },
 
-/* Floating Point Escape Instruction Format - pfmam.p fsrc1,fsrc2,fdest */
-{ "mr2p1.ss",	0x48000000, 0xb40007ff, "e,f,g", 0 },
-{ "mr2p1.sd",	0x48000080, 0xb400077f, "e,f,g", 0 },
-{ "mr2p1.dd",	0x48000180, 0xb400067f, "e,f,g", 0 },
-{ "mr2pt.ss",	0x48000001, 0xb40007fe, "e,f,g", 0 },
-{ "mr2pt.sd",	0x48000081, 0xb400077e, "e,f,g", 0 },
-{ "mr2pt.dd",	0x48000181, 0xb400067e, "e,f,g", 0 },
-{ "mr2mp1.ss",	0x48000002, 0xb40007fd, "e,f,g", 0 },
-{ "mr2mp1.sd",	0x48000082, 0xb400077d, "e,f,g", 0 },
-{ "mr2mp1.dd",	0x48000182, 0xb400067d, "e,f,g", 0 },
-{ "mr2mpt.ss",	0x48000003, 0xb40007fc, "e,f,g", 0 },
-{ "mr2mpt.sd",	0x48000083, 0xb400077c, "e,f,g", 0 },
-{ "mr2mpt.dd",	0x48000183, 0xb400067c, "e,f,g", 0 },
-{ "mi2p1.ss",	0x48000004, 0xb40007fb, "e,f,g", 0 },
-{ "mi2p1.sd",	0x48000084, 0xb400077b, "e,f,g", 0 },
-{ "mi2p1.dd",	0x48000184, 0xb400067b, "e,f,g", 0 },
-{ "mi2pt.ss",	0x48000005, 0xb40007fa, "e,f,g", 0 },
-{ "mi2pt.sd",	0x48000085, 0xb400077a, "e,f,g", 0 },
-{ "mi2pt.dd",	0x48000185, 0xb400067a, "e,f,g", 0 },
-{ "mi2mp1.ss",	0x48000006, 0xb40007f9, "e,f,g", 0 },
-{ "mi2mp1.sd",	0x48000086, 0xb4000779, "e,f,g", 0 },
-{ "mi2mp1.dd",	0x48000186, 0xb4000679, "e,f,g", 0 },
-{ "mi2mpt.ss",	0x48000007, 0xb40007f8, "e,f,g", 0 },
-{ "mi2mpt.sd",	0x48000087, 0xb4000778, "e,f,g", 0 },
-{ "mi2mpt.dd",	0x48000187, 0xb4000678, "e,f,g", 0 },
-{ "mrmt1p2.ss",	0x48000008, 0xb40007f7, "e,f,g", 0 },
-{ "mrmt1p2.sd",	0x48000088, 0xb4000777, "e,f,g", 0 },
-{ "mrmt1p2.dd",	0x48000188, 0xb4000677, "e,f,g", 0 },
-{ "mm12mpm.ss",	0x48000009, 0xb40007f6, "e,f,g", 0 },
-{ "mm12mpm.sd",	0x48000089, 0xb4000776, "e,f,g", 0 },
-{ "mm12mpm.dd",	0x48000189, 0xb4000676, "e,f,g", 0 },
-{ "mrm1p2.ss",	0x4800000a, 0xb40007f5, "e,f,g", 0 },
-{ "mrm1p2.sd",	0x4800008a, 0xb4000775, "e,f,g", 0 },
-{ "mrm1p2.dd",	0x4800018a, 0xb4000675, "e,f,g", 0 },
-{ "mm12ttpm.ss",0x4800000b, 0xb40007f4, "e,f,g", 0 },
-{ "mm12ttpm.sd",0x4800008b, 0xb4000774, "e,f,g", 0 },
-{ "mm12ttpm.dd",0x4800018b, 0xb4000674, "e,f,g", 0 },
-{ "mimt1p2.ss",	0x4800000c, 0xb40007f3, "e,f,g", 0 },
-{ "mimt1p2.sd",	0x4800008c, 0xb4000773, "e,f,g", 0 },
-{ "mimt1p2.dd",	0x4800018c, 0xb4000673, "e,f,g", 0 },
-{ "mm12tpm.ss",	0x4800000d, 0xb40007f2, "e,f,g", 0 },
-{ "mm12tpm.sd",	0x4800008d, 0xb4000772, "e,f,g", 0 },
-{ "mm12tpm.dd",	0x4800018d, 0xb4000672, "e,f,g", 0 },
-{ "mim1p2.ss",	0x4800000e, 0xb40007f1, "e,f,g", 0 },
-{ "mim1p2.sd",	0x4800008e, 0xb4000771, "e,f,g", 0 },
-{ "mim1p2.dd",	0x4800018e, 0xb4000671, "e,f,g", 0 },
+/* Floating Point Escape Instruction Format - pfmam.p fsrc1,fsrc2,fdest.  */
+{ "mr2p1.ss",	0x48000000, 0xb40005ff, "e,f,g", 0 },
+{ "mr2p1.sd",	0x48000080, 0xb400057f, "e,f,g", 0 },
+{ "mr2p1.dd",	0x48000180, 0xb400047f, "e,f,g", 0 },
+{ "mr2pt.ss",	0x48000001, 0xb40005fe, "e,f,g", 0 },
+{ "mr2pt.sd",	0x48000081, 0xb400057e, "e,f,g", 0 },
+{ "mr2pt.dd",	0x48000181, 0xb400047e, "e,f,g", 0 },
+{ "mr2mp1.ss",	0x48000002, 0xb40005fd, "e,f,g", 0 },
+{ "mr2mp1.sd",	0x48000082, 0xb400057d, "e,f,g", 0 },
+{ "mr2mp1.dd",	0x48000182, 0xb400047d, "e,f,g", 0 },
+{ "mr2mpt.ss",	0x48000003, 0xb40005fc, "e,f,g", 0 },
+{ "mr2mpt.sd",	0x48000083, 0xb400057c, "e,f,g", 0 },
+{ "mr2mpt.dd",	0x48000183, 0xb400047c, "e,f,g", 0 },
+{ "mi2p1.ss",	0x48000004, 0xb40005fb, "e,f,g", 0 },
+{ "mi2p1.sd",	0x48000084, 0xb400057b, "e,f,g", 0 },
+{ "mi2p1.dd",	0x48000184, 0xb400047b, "e,f,g", 0 },
+{ "mi2pt.ss",	0x48000005, 0xb40005fa, "e,f,g", 0 },
+{ "mi2pt.sd",	0x48000085, 0xb400057a, "e,f,g", 0 },
+{ "mi2pt.dd",	0x48000185, 0xb400047a, "e,f,g", 0 },
+{ "mi2mp1.ss",	0x48000006, 0xb40005f9, "e,f,g", 0 },
+{ "mi2mp1.sd",	0x48000086, 0xb4000579, "e,f,g", 0 },
+{ "mi2mp1.dd",	0x48000186, 0xb4000479, "e,f,g", 0 },
+{ "mi2mpt.ss",	0x48000007, 0xb40005f8, "e,f,g", 0 },
+{ "mi2mpt.sd",	0x48000087, 0xb4000578, "e,f,g", 0 },
+{ "mi2mpt.dd",	0x48000187, 0xb4000478, "e,f,g", 0 },
+{ "mrmt1p2.ss",	0x48000008, 0xb40005f7, "e,f,g", 0 },
+{ "mrmt1p2.sd",	0x48000088, 0xb4000577, "e,f,g", 0 },
+{ "mrmt1p2.dd",	0x48000188, 0xb4000477, "e,f,g", 0 },
+{ "mm12mpm.ss",	0x48000009, 0xb40005f6, "e,f,g", 0 },
+{ "mm12mpm.sd",	0x48000089, 0xb4000576, "e,f,g", 0 },
+{ "mm12mpm.dd",	0x48000189, 0xb4000476, "e,f,g", 0 },
+{ "mrm1p2.ss",	0x4800000a, 0xb40005f5, "e,f,g", 0 },
+{ "mrm1p2.sd",	0x4800008a, 0xb4000575, "e,f,g", 0 },
+{ "mrm1p2.dd",	0x4800018a, 0xb4000475, "e,f,g", 0 },
+{ "mm12ttpm.ss",0x4800000b, 0xb40005f4, "e,f,g", 0 },
+{ "mm12ttpm.sd",0x4800008b, 0xb4000574, "e,f,g", 0 },
+{ "mm12ttpm.dd",0x4800018b, 0xb4000474, "e,f,g", 0 },
+{ "mimt1p2.ss",	0x4800000c, 0xb40005f3, "e,f,g", 0 },
+{ "mimt1p2.sd",	0x4800008c, 0xb4000573, "e,f,g", 0 },
+{ "mimt1p2.dd",	0x4800018c, 0xb4000473, "e,f,g", 0 },
+{ "mm12tpm.ss",	0x4800000d, 0xb40005f2, "e,f,g", 0 },
+{ "mm12tpm.sd",	0x4800008d, 0xb4000572, "e,f,g", 0 },
+{ "mm12tpm.dd",	0x4800018d, 0xb4000472, "e,f,g", 0 },
+{ "mim1p2.ss",	0x4800000e, 0xb40005f1, "e,f,g", 0 },
+{ "mim1p2.sd",	0x4800008e, 0xb4000571, "e,f,g", 0 },
+{ "mim1p2.dd",	0x4800018e, 0xb4000471, "e,f,g", 0 },
 
-/* Floating Point Escape Instruction Format - pfmsm.p fsrc1,fsrc2,fdest */
-{ "mr2s1.ss",	0x48000010, 0xb40007ef, "e,f,g", 0 },
-{ "mr2s1.sd",	0x48000090, 0xb400076f, "e,f,g", 0 },
-{ "mr2s1.dd",	0x48000190, 0xb400066f, "e,f,g", 0 },
-{ "mr2st.ss",	0x48000011, 0xb40007ee, "e,f,g", 0 },
-{ "mr2st.sd",	0x48000091, 0xb400076e, "e,f,g", 0 },
-{ "mr2st.dd",	0x48000191, 0xb400066e, "e,f,g", 0 },
-{ "mr2ms1.ss",	0x48000012, 0xb40007ed, "e,f,g", 0 },
-{ "mr2ms1.sd",	0x48000092, 0xb400076d, "e,f,g", 0 },
-{ "mr2ms1.dd",	0x48000192, 0xb400066d, "e,f,g", 0 },
-{ "mr2mst.ss",	0x48000013, 0xb40007ec, "e,f,g", 0 },
-{ "mr2mst.sd",	0x48000093, 0xb400076c, "e,f,g", 0 },
-{ "mr2mst.dd",	0x48000193, 0xb400066c, "e,f,g", 0 },
-{ "mi2s1.ss",	0x48000014, 0xb40007eb, "e,f,g", 0 },
-{ "mi2s1.sd",	0x48000094, 0xb400076b, "e,f,g", 0 },
-{ "mi2s1.dd",	0x48000194, 0xb400066b, "e,f,g", 0 },
-{ "mi2st.ss",	0x48000015, 0xb40007ea, "e,f,g", 0 },
-{ "mi2st.sd",	0x48000095, 0xb400076a, "e,f,g", 0 },
-{ "mi2st.dd",	0x48000195, 0xb400066a, "e,f,g", 0 },
-{ "mi2ms1.ss",	0x48000016, 0xb40007e9, "e,f,g", 0 },
-{ "mi2ms1.sd",	0x48000096, 0xb4000769, "e,f,g", 0 },
-{ "mi2ms1.dd",	0x48000196, 0xb4000669, "e,f,g", 0 },
-{ "mi2mst.ss",	0x48000017, 0xb40007e8, "e,f,g", 0 },
-{ "mi2mst.sd",	0x48000097, 0xb4000768, "e,f,g", 0 },
-{ "mi2mst.dd",	0x48000197, 0xb4000668, "e,f,g", 0 },
-{ "mrmt1s2.ss",	0x48000018, 0xb40007e7, "e,f,g", 0 },
-{ "mrmt1s2.sd",	0x48000098, 0xb4000767, "e,f,g", 0 },
-{ "mrmt1s2.dd",	0x48000198, 0xb4000667, "e,f,g", 0 },
-{ "mm12msm.ss",	0x48000019, 0xb40007e6, "e,f,g", 0 },
-{ "mm12msm.sd",	0x48000099, 0xb4000766, "e,f,g", 0 },
-{ "mm12msm.dd",	0x48000199, 0xb4000666, "e,f,g", 0 },
-{ "mrm1s2.ss",	0x4800001a, 0xb40007e5, "e,f,g", 0 },
-{ "mrm1s2.sd",	0x4800009a, 0xb4000765, "e,f,g", 0 },
-{ "mrm1s2.dd",	0x4800019a, 0xb4000665, "e,f,g", 0 },
-{ "mm12ttsm.ss",0x4800001b, 0xb40007e4, "e,f,g", 0 },
-{ "mm12ttsm.sd",0x4800009b, 0xb4000764, "e,f,g", 0 },
-{ "mm12ttsm.dd",0x4800019b, 0xb4000664, "e,f,g", 0 },
-{ "mimt1s2.ss",	0x4800001c, 0xb40007e3, "e,f,g", 0 },
-{ "mimt1s2.sd",	0x4800009c, 0xb4000763, "e,f,g", 0 },
-{ "mimt1s2.dd",	0x4800019c, 0xb4000663, "e,f,g", 0 },
-{ "mm12tsm.ss",	0x4800001d, 0xb40007e2, "e,f,g", 0 },
-{ "mm12tsm.sd",	0x4800009d, 0xb4000762, "e,f,g", 0 },
-{ "mm12tsm.dd",	0x4800019d, 0xb4000662, "e,f,g", 0 },
-{ "mim1s2.ss",	0x4800001e, 0xb40007e1, "e,f,g", 0 },
-{ "mim1s2.sd",	0x4800009e, 0xb4000761, "e,f,g", 0 },
-{ "mim1s2.dd",	0x4800019e, 0xb4000661, "e,f,g", 0 },
+/* Floating Point Escape Instruction Format - pfmsm.p fsrc1,fsrc2,fdest.  */
+{ "mr2s1.ss",	0x48000010, 0xb40005ef, "e,f,g", 0 },
+{ "mr2s1.sd",	0x48000090, 0xb400056f, "e,f,g", 0 },
+{ "mr2s1.dd",	0x48000190, 0xb400046f, "e,f,g", 0 },
+{ "mr2st.ss",	0x48000011, 0xb40005ee, "e,f,g", 0 },
+{ "mr2st.sd",	0x48000091, 0xb400056e, "e,f,g", 0 },
+{ "mr2st.dd",	0x48000191, 0xb400046e, "e,f,g", 0 },
+{ "mr2ms1.ss",	0x48000012, 0xb40005ed, "e,f,g", 0 },
+{ "mr2ms1.sd",	0x48000092, 0xb400056d, "e,f,g", 0 },
+{ "mr2ms1.dd",	0x48000192, 0xb400046d, "e,f,g", 0 },
+{ "mr2mst.ss",	0x48000013, 0xb40005ec, "e,f,g", 0 },
+{ "mr2mst.sd",	0x48000093, 0xb400056c, "e,f,g", 0 },
+{ "mr2mst.dd",	0x48000193, 0xb400046c, "e,f,g", 0 },
+{ "mi2s1.ss",	0x48000014, 0xb40005eb, "e,f,g", 0 },
+{ "mi2s1.sd",	0x48000094, 0xb400056b, "e,f,g", 0 },
+{ "mi2s1.dd",	0x48000194, 0xb400046b, "e,f,g", 0 },
+{ "mi2st.ss",	0x48000015, 0xb40005ea, "e,f,g", 0 },
+{ "mi2st.sd",	0x48000095, 0xb400056a, "e,f,g", 0 },
+{ "mi2st.dd",	0x48000195, 0xb400046a, "e,f,g", 0 },
+{ "mi2ms1.ss",	0x48000016, 0xb40005e9, "e,f,g", 0 },
+{ "mi2ms1.sd",	0x48000096, 0xb4000569, "e,f,g", 0 },
+{ "mi2ms1.dd",	0x48000196, 0xb4000469, "e,f,g", 0 },
+{ "mi2mst.ss",	0x48000017, 0xb40005e8, "e,f,g", 0 },
+{ "mi2mst.sd",	0x48000097, 0xb4000568, "e,f,g", 0 },
+{ "mi2mst.dd",	0x48000197, 0xb4000468, "e,f,g", 0 },
+{ "mrmt1s2.ss",	0x48000018, 0xb40005e7, "e,f,g", 0 },
+{ "mrmt1s2.sd",	0x48000098, 0xb4000567, "e,f,g", 0 },
+{ "mrmt1s2.dd",	0x48000198, 0xb4000467, "e,f,g", 0 },
+{ "mm12msm.ss",	0x48000019, 0xb40005e6, "e,f,g", 0 },
+{ "mm12msm.sd",	0x48000099, 0xb4000566, "e,f,g", 0 },
+{ "mm12msm.dd",	0x48000199, 0xb4000466, "e,f,g", 0 },
+{ "mrm1s2.ss",	0x4800001a, 0xb40005e5, "e,f,g", 0 },
+{ "mrm1s2.sd",	0x4800009a, 0xb4000565, "e,f,g", 0 },
+{ "mrm1s2.dd",	0x4800019a, 0xb4000465, "e,f,g", 0 },
+{ "mm12ttsm.ss",0x4800001b, 0xb40005e4, "e,f,g", 0 },
+{ "mm12ttsm.sd",0x4800009b, 0xb4000564, "e,f,g", 0 },
+{ "mm12ttsm.dd",0x4800019b, 0xb4000464, "e,f,g", 0 },
+{ "mimt1s2.ss",	0x4800001c, 0xb40005e3, "e,f,g", 0 },
+{ "mimt1s2.sd",	0x4800009c, 0xb4000563, "e,f,g", 0 },
+{ "mimt1s2.dd",	0x4800019c, 0xb4000463, "e,f,g", 0 },
+{ "mm12tsm.ss",	0x4800001d, 0xb40005e2, "e,f,g", 0 },
+{ "mm12tsm.sd",	0x4800009d, 0xb4000562, "e,f,g", 0 },
+{ "mm12tsm.dd",	0x4800019d, 0xb4000462, "e,f,g", 0 },
+{ "mim1s2.ss",	0x4800001e, 0xb40005e1, "e,f,g", 0 },
+{ "mim1s2.sd",	0x4800009e, 0xb4000561, "e,f,g", 0 },
+{ "mim1s2.dd",	0x4800019e, 0xb4000461, "e,f,g", 0 },
 
+{ "fmul.ss",	0x48000020, 0xb40005df, "e,f,g", 0 },	/* fmul.p fsrc1,fsrc2,fdest */
+{ "fmul.sd",	0x480000a0, 0xb400055f, "e,f,g", 0 },	/* fmul.p fsrc1,fsrc2,fdest */
+{ "fmul.dd",	0x480001a0, 0xb400045f, "e,f,g", 0 },	/* fmul.p fsrc1,fsrc2,fdest */
+{ "pfmul.ss",	0x48000420, 0xb40001df, "e,f,g", 0 },	/* pfmul.p fsrc1,fsrc2,fdest */
+{ "pfmul.sd",	0x480004a0, 0xb400015f, "e,f,g", 0 },	/* pfmul.p fsrc1,fsrc2,fdest */
+{ "pfmul.dd",	0x480005a0, 0xb400005f, "e,f,g", 0 },	/* pfmul.p fsrc1,fsrc2,fdest */
+{ "pfmul3.dd",	0x480005a4, 0xb400005b, "e,f,g", 0 },	/* pfmul3.p fsrc1,fsrc2,fdest */
+{ "fmlow.dd",	0x480001a1, 0xb400045e, "e,f,g", 0 },	/* fmlow.dd fsrc1,fsrc2,fdest */
+{ "frcp.ss",	0x48000022, 0xb40005dd, "f,g", 0 },	/* frcp.p fsrc2,fdest */
+{ "frcp.sd",	0x480000a2, 0xb400055d, "f,g", 0 },	/* frcp.p fsrc2,fdest */
+{ "frcp.dd",	0x480001a2, 0xb400045d, "f,g", 0 },	/* frcp.p fsrc2,fdest */
+{ "frsqr.ss",	0x48000023, 0xb40005dc, "f,g", 0 },	/* frsqr.p fsrc2,fdest */
+{ "frsqr.sd",	0x480000a3, 0xb400055c, "f,g", 0 },	/* frsqr.p fsrc2,fdest */
+{ "frsqr.dd",	0x480001a3, 0xb400045c, "f,g", 0 },	/* frsqr.p fsrc2,fdest */
+{ "fadd.ss",	0x48000030, 0xb40005cf, "e,f,g", 0 },	/* fadd.p fsrc1,fsrc2,fdest */
+{ "fadd.sd",	0x480000b0, 0xb400054f, "e,f,g", 0 },	/* fadd.p fsrc1,fsrc2,fdest */
+{ "fadd.dd",	0x480001b0, 0xb400044f, "e,f,g", 0 },	/* fadd.p fsrc1,fsrc2,fdest */
+{ "pfadd.ss",	0x48000430, 0xb40001cf, "e,f,g", 0 },	/* pfadd.p fsrc1,fsrc2,fdest */
+{ "pfadd.sd",	0x480004b0, 0xb400014f, "e,f,g", 0 },	/* pfadd.p fsrc1,fsrc2,fdest */
+{ "pfadd.dd",	0x480005b0, 0xb400004f, "e,f,g", 0 },	/* pfadd.p fsrc1,fsrc2,fdest */
+{ "fsub.ss",	0x48000031, 0xb40005ce, "e,f,g", 0 },	/* fsub.p fsrc1,fsrc2,fdest */
+{ "fsub.sd",	0x480000b1, 0xb400054e, "e,f,g", 0 },	/* fsub.p fsrc1,fsrc2,fdest */
+{ "fsub.dd",	0x480001b1, 0xb400044e, "e,f,g", 0 },	/* fsub.p fsrc1,fsrc2,fdest */
+{ "pfsub.ss",	0x48000431, 0xb40001ce, "e,f,g", 0 },	/* pfsub.p fsrc1,fsrc2,fdest */
+{ "pfsub.sd",	0x480004b1, 0xb400014e, "e,f,g", 0 },	/* pfsub.p fsrc1,fsrc2,fdest */
+{ "pfsub.dd",	0x480005b1, 0xb400004e, "e,f,g", 0 },	/* pfsub.p fsrc1,fsrc2,fdest */
+{ "fix.ss",	0x48000032, 0xb40005cd, "e,g", 0 },	/* fix.p fsrc1,fdest */
+{ "fix.sd",	0x480000b2, 0xb400054d, "e,g", 0 },	/* fix.p fsrc1,fdest */
+{ "fix.dd",	0x480001b2, 0xb400044d, "e,g", 0 },	/* fix.p fsrc1,fdest */
+{ "pfix.ss",	0x48000432, 0xb40001cd, "e,g", 0 },	/* pfix.p fsrc1,fdest */
+{ "pfix.sd",	0x480004b2, 0xb400014d, "e,g", 0 },	/* pfix.p fsrc1,fdest */
+{ "pfix.dd",	0x480005b2, 0xb400004d, "e,g", 0 },	/* pfix.p fsrc1,fdest */
+{ "famov.ss",	0x48000033, 0xb40005cc, "e,g", 0 },	/* famov.p fsrc1,fdest */
+{ "famov.ds",	0x48000133, 0xb40004cc, "e,g", 0 },	/* famov.p fsrc1,fdest */
+{ "famov.sd",	0x480000b3, 0xb400054c, "e,g", 0 },	/* famov.p fsrc1,fdest */
+{ "famov.dd",	0x480001b3, 0xb400044c, "e,g", 0 },	/* famov.p fsrc1,fdest */
+{ "pfamov.ss",	0x48000433, 0xb40001cc, "e,g", 0 },	/* pfamov.p fsrc1,fdest */
+{ "pfamov.ds",	0x48000533, 0xb40000cc, "e,g", 0 },	/* pfamov.p fsrc1,fdest */
+{ "pfamov.sd",	0x480004b3, 0xb400014c, "e,g", 0 },	/* pfamov.p fsrc1,fdest */
+{ "pfamov.dd",	0x480005b3, 0xb400004c, "e,g", 0 },	/* pfamov.p fsrc1,fdest */
+/* Opcode pfgt has R bit cleared; pfle has R bit set.  */
+{ "pfgt.ss",	0x48000434, 0xb40001cb, "e,f,g", 0 },	/* pfgt.p fsrc1,fsrc2,fdest */
+{ "pfgt.dd",	0x48000534, 0xb40000cb, "e,f,g", 0 },	/* pfgt.p fsrc1,fsrc2,fdest */
+/* Opcode pfgt has R bit cleared; pfle has R bit set.  */
+{ "pfle.ss",	0x480004b4, 0xb400014b, "e,f,g", 0 },	/* pfle.p fsrc1,fsrc2,fdest */
+{ "pfle.dd",	0x480005b4, 0xb400004b, "e,f,g", 0 },	/* pfle.p fsrc1,fsrc2,fdest */
+{ "pfeq.ss",	0x48000435, 0xb40001ca, "e,f,g", 0 },	/* pfeq.p fsrc1,fsrc2,fdest */
+{ "pfeq.dd",	0x48000535, 0xb40000ca, "e,f,g", 0 },	/* pfeq.p fsrc1,fsrc2,fdest */
+{ "ftrunc.ss",	0x4800003a, 0xb40005c5, "e,g", 0 },	/* ftrunc.p fsrc1,fdest */
+{ "ftrunc.sd",	0x480000ba, 0xb4000545, "e,g", 0 },	/* ftrunc.p fsrc1,fdest */
+{ "ftrunc.dd",	0x480001ba, 0xb4000445, "e,g", 0 },	/* ftrunc.p fsrc1,fdest */
+{ "pftrunc.ss",	0x4800043a, 0xb40001c5, "e,g", 0 },	/* pftrunc.p fsrc1,fdest */
+{ "pftrunc.sd",	0x480004ba, 0xb4000145, "e,g", 0 },	/* pftrunc.p fsrc1,fdest */
+{ "pftrunc.dd",	0x480005ba, 0xb4000045, "e,g", 0 },	/* pftrunc.p fsrc1,fdest */
+{ "fxfr",	0x48000040, 0xb40005bf, "e,d", 0 },	/* fxfr fsrc1,idest */
+{ "fiadd.ss",	0x48000049, 0xb40005b6, "e,f,g", 0 },	/* fiadd.w fsrc1,fsrc2,fdest */
+{ "fiadd.dd",	0x480001c9, 0xb4000436, "e,f,g", 0 },	/* fiadd.w fsrc1,fsrc2,fdest */
+{ "pfiadd.ss",	0x48000449, 0xb40001b6, "e,f,g", 0 },	/* pfiadd.w fsrc1,fsrc2,fdest */
+{ "pfiadd.dd",	0x480005c9, 0xb4000036, "e,f,g", 0 },	/* pfiadd.w fsrc1,fsrc2,fdest */
+{ "fisub.ss",	0x4800004d, 0xb40005b2, "e,f,g", 0 },	/* fisub.w fsrc1,fsrc2,fdest */
+{ "fisub.dd",	0x480001cd, 0xb4000432, "e,f,g", 0 },	/* fisub.w fsrc1,fsrc2,fdest */
+{ "pfisub.ss",	0x4800044d, 0xb40001b2, "e,f,g", 0 },	/* pfisub.w fsrc1,fsrc2,fdest */
+{ "pfisub.dd",	0x480005cd, 0xb4000032, "e,f,g", 0 },	/* pfisub.w fsrc1,fsrc2,fdest */
+{ "fzchkl",	0x480001d7, 0xb4000428, "e,f,g", 0 },	/* fzchkl fsrc1,fsrc2,fdest */
+{ "pfzchkl",	0x480005d7, 0xb4000028, "e,f,g", 0 },	/* pfzchkl fsrc1,fsrc2,fdest */
+{ "fzchks",	0x4800015f, 0xb4000420, "e,f,g", 0 },	/* fzchks fsrc1,fsrc2,fdest */
+{ "pfzchks",	0x4800055f, 0xb4000020, "e,f,g", 0 },	/* pfzchks fsrc1,fsrc2,fdest */
+{ "faddp",	0x48000050, 0xb40005af, "e,f,g", 0 },	/* faddp fsrc1,fsrc2,fdest */
+{ "pfaddp",	0x48000450, 0xb40001af, "e,f,g", 0 },	/* pfaddp fsrc1,fsrc2,fdest */
+{ "faddz",	0x480001d1, 0xb400042e, "e,f,g", 0 },	/* faddz fsrc1,fsrc2,fdest */
+{ "pfaddz",	0x480005d1, 0xb400002e, "e,f,g", 0 },	/* pfaddz fsrc1,fsrc2,fdest */
+{ "form",	0x480001da, 0xb4000425, "e,g", 0 },	/* form fsrc1,fdest */
+{ "pform",	0x480005da, 0xb4000025, "e,g", 0 },	/* pform fsrc1,fdest */
 
-{ "fmul.ss",	0x48000020, 0xb40007df, "e,f,g", 0 },	/* fmul.p fsrc1,fsrc2,fdest */
-{ "fmul.sd",	0x480000a0, 0xb400075f, "e,f,g", 0 },	/* fmul.p fsrc1,fsrc2,fdest */
-{ "fmul.dd",	0x480001a0, 0xb400065f, "e,f,g", 0 },	/* fmul.p fsrc1,fsrc2,fdest */
-{ "pfmul.ss",	0x48000420, 0xb40003df, "e,f,g", 0 },	/* pfmul.p fsrc1,fsrc2,fdest */
-{ "pfmul.sd",	0x480004a0, 0xb400035f, "e,f,g", 0 },	/* pfmul.p fsrc1,fsrc2,fdest */
-{ "pfmul.dd",	0x480005a0, 0xb400025f, "e,f,g", 0 },	/* pfmul.p fsrc1,fsrc2,fdest */
-{ "pfmul3.dd",	0x480005a4, 0xb400025b, "e,f,g", 0 },	/* pfmul3.p fsrc1,fsrc2,fdest */
-{ "fmlow.dd",	0x480001a1, 0xb400065e, "e,f,g", 0 },	/* fmlow.dd fsrc1,fsrc2,fdest */
-{ "frcp.ss",	0x48000022, 0xb40007dd, "f,g", 0 },	/* frcp.p fsrc2,fdest */
-{ "frcp.sd",	0x480000a2, 0xb400075d, "f,g", 0 },	/* frcp.p fsrc2,fdest */
-{ "frcp.dd",	0x480001a2, 0xb400065d, "f,g", 0 },	/* frcp.p fsrc2,fdest */
-{ "frsqr.ss",	0x48000023, 0xb40007dc, "f,g", 0 },	/* frsqr.p fsrc2,fdest */
-{ "frsqr.sd",	0x480000a3, 0xb400075c, "f,g", 0 },	/* frsqr.p fsrc2,fdest */
-{ "frsqr.dd",	0x480001a3, 0xb400065c, "f,g", 0 },	/* frsqr.p fsrc2,fdest */
-{ "fadd.ss",	0x48000030, 0xb40007cf, "e,f,g", 0 },	/* fadd.p fsrc1,fsrc2,fdest */
-{ "fadd.sd",	0x480000b0, 0xb400074f, "e,f,g", 0 },	/* fadd.p fsrc1,fsrc2,fdest */
-{ "fadd.dd",	0x480001b0, 0xb400064f, "e,f,g", 0 },	/* fadd.p fsrc1,fsrc2,fdest */
-{ "pfadd.ss",	0x48000430, 0xb40003cf, "e,f,g", 0 },	/* pfadd.p fsrc1,fsrc2,fdest */
-{ "pfadd.sd",	0x480004b0, 0xb400034f, "e,f,g", 0 },	/* pfadd.p fsrc1,fsrc2,fdest */
-{ "pfadd.dd",	0x480005b0, 0xb400024f, "e,f,g", 0 },	/* pfadd.p fsrc1,fsrc2,fdest */
-{ "fsub.ss",	0x48000031, 0xb40007ce, "e,f,g", 0 },	/* fsub.p fsrc1,fsrc2,fdest */
-{ "fsub.sd",	0x480000b1, 0xb400074e, "e,f,g", 0 },	/* fsub.p fsrc1,fsrc2,fdest */
-{ "fsub.dd",	0x480001b1, 0xb400064e, "e,f,g", 0 },	/* fsub.p fsrc1,fsrc2,fdest */
-{ "pfsub.ss",	0x48000431, 0xb40003ce, "e,f,g", 0 },	/* pfsub.p fsrc1,fsrc2,fdest */
-{ "pfsub.sd",	0x480004b1, 0xb400034e, "e,f,g", 0 },	/* pfsub.p fsrc1,fsrc2,fdest */
-{ "pfsub.dd",	0x480005b1, 0xb400024e, "e,f,g", 0 },	/* pfsub.p fsrc1,fsrc2,fdest */
-{ "fix.ss",	0x48000032, 0xb40007cd, "e,g", 0 },	/* fix.p fsrc1,fdest */
-{ "fix.sd",	0x480000b2, 0xb400074d, "e,g", 0 },	/* fix.p fsrc1,fdest */
-{ "fix.dd",	0x480001b2, 0xb400064d, "e,g", 0 },	/* fix.p fsrc1,fdest */
-{ "pfix.ss",	0x48000432, 0xb40003cd, "e,g", 0 },	/* pfix.p fsrc1,fdest */
-{ "pfix.sd",	0x480004b2, 0xb400034d, "e,g", 0 },	/* pfix.p fsrc1,fdest */
-{ "pfix.dd",	0x480005b2, 0xb400024d, "e,g", 0 },	/* pfix.p fsrc1,fdest */
-{ "famov.ss",	0x48000033, 0xb40007cc, "e,g", 0 },	/* famov.p fsrc1,fdest */
-{ "famov.ds",	0x48000133, 0xb40006cc, "e,g", 0 },	/* famov.p fsrc1,fdest */
-{ "famov.sd",	0x480000b3, 0xb400074c, "e,g", 0 },	/* famov.p fsrc1,fdest */
-{ "famov.dd",	0x480001b3, 0xb400064c, "e,g", 0 },	/* famov.p fsrc1,fdest */
-{ "pfamov.ss",	0x48000433, 0xb40003cc, "e,g", 0 },	/* pfamov.p fsrc1,fdest */
-{ "pfamov.ds",	0x48000533, 0xb40002cc, "e,g", 0 },	/* pfamov.p fsrc1,fdest */
-{ "pfamov.sd",	0x480004b3, 0xb400034c, "e,g", 0 },	/* pfamov.p fsrc1,fdest */
-{ "pfamov.dd",	0x480005b3, 0xb400024c, "e,g", 0 },	/* pfamov.p fsrc1,fdest */
-/* pfgt has R bit cleared; pfle has R bit set */
-{ "pfgt.ss",	0x48000434, 0xb40003cb, "e,f,g", 0 },	/* pfgt.p fsrc1,fsrc2,fdest */
-{ "pfgt.sd",	0x48000434, 0xb40003cb, "e,f,g", 0 },	/* pfgt.p fsrc1,fsrc2,fdest */
-{ "pfgt.dd",	0x48000534, 0xb40002cb, "e,f,g", 0 },	/* pfgt.p fsrc1,fsrc2,fdest */
-/* pfgt has R bit cleared; pfle has R bit set */
-{ "pfle.ss",	0x480004b4, 0xb400034b, "e,f,g", 0 },	/* pfle.p fsrc1,fsrc2,fdest */
-{ "pfle.sd",	0x480004b4, 0xb400034b, "e,f,g", 0 },	/* pfle.p fsrc1,fsrc2,fdest */
-{ "pfle.dd",	0x480005b4, 0xb400024b, "e,f,g", 0 },	/* pfle.p fsrc1,fsrc2,fdest */
-{ "ftrunc.ss",	0x4800003a, 0xb40007c5, "e,g", 0 },	/* ftrunc.p fsrc1,fdest */
-{ "ftrunc.sd",	0x480000ba, 0xb4000745, "e,g", 0 },	/* ftrunc.p fsrc1,fdest */
-{ "ftrunc.dd",	0x480001ba, 0xb4000645, "e,g", 0 },	/* ftrunc.p fsrc1,fdest */
-{ "pftrunc.ss",	0x4800043a, 0xb40003c5, "e,g", 0 },	/* pftrunc.p fsrc1,fdest */
-{ "pftrunc.sd",	0x480004ba, 0xb4000345, "e,g", 0 },	/* pftrunc.p fsrc1,fdest */
-{ "pftrunc.dd",	0x480005ba, 0xb4000245, "e,g", 0 },	/* pftrunc.p fsrc1,fdest */
-{ "fxfr",	0x48000040, 0xb40007bf, "e,d", 0 },	/* fxfr fsrc1,idest */
-{ "fiadd.ss",	0x48000049, 0xb40007b6, "e,f,g", 0 },	/* fiadd.w fsrc1,fsrc2,fdest */
-{ "fiadd.dd",	0x480001c9, 0xb4000636, "e,f,g", 0 },	/* fiadd.w fsrc1,fsrc2,fdest */
-{ "pfiadd.ss",	0x48000449, 0xb40003b6, "e,f,g", 0 },	/* pfiadd.w fsrc1,fsrc2,fdest */
-{ "pfiadd.dd",	0x480005c9, 0xb4000236, "e,f,g", 0 },	/* pfiadd.w fsrc1,fsrc2,fdest */
-{ "fisub.ss",	0x4800004d, 0xb40007b2, "e,f,g", 0 },	/* fisub.w fsrc1,fsrc2,fdest */
-{ "fisub.dd",	0x480001cd, 0xb4000632, "e,f,g", 0 },	/* fisub.w fsrc1,fsrc2,fdest */
-{ "pfisub.ss",	0x4800044d, 0xb40003b2, "e,f,g", 0 },	/* pfisub.w fsrc1,fsrc2,fdest */
-{ "pfisub.dd",	0x480005cd, 0xb4000232, "e,f,g", 0 },	/* pfisub.w fsrc1,fsrc2,fdest */
-{ "fzchkl",	0x48000057, 0xb40007a8, "e,f,g", 0 },	/* fzchkl fsrc1,fsrc2,fdest */
-{ "pfzchkl",	0x48000457, 0xb40003a8, "e,f,g", 0 },	/* pfzchkl fsrc1,fsrc2,fdest */
-{ "fzchks",	0x4800005f, 0xb40007a0, "e,f,g", 0 },	/* fzchks fsrc1,fsrc2,fdest */
-{ "pfzchks",	0x4800045f, 0xb40003a0, "e,f,g", 0 },	/* pfzchks fsrc1,fsrc2,fdest */
-{ "faddp",	0x48000050, 0xb40007af, "e,f,g", 0 },	/* faddp fsrc1,fsrc2,fdest */
-{ "pfaddp",	0x48000450, 0xb40003af, "e,f,g", 0 },	/* pfaddp fsrc1,fsrc2,fdest */
-{ "faddz",	0x48000051, 0xb40007ae, "e,f,g", 0 },	/* faddz fsrc1,fsrc2,fdest */
-{ "pfaddz",	0x48000451, 0xb40003ae, "e,f,g", 0 },	/* pfaddz fsrc1,fsrc2,fdest */
-{ "form",	0x4800005a, 0xb40007a5, "e,g", 0 },	/* form fsrc1,fdest */
-{ "pform",	0x4800045a, 0xb40003a5, "e,g", 0 },	/* pform fsrc1,fdest */
-
-/* Floating point pseudo-instructions */
-{ "fmov.ss",	0x48000049, 0xb7e007b6, "e,g", 0 },	/* fiadd.ss fsrc1,f0,fdest */
-{ "fmov.dd",	0x480001c9, 0xb7e00636, "e,g", 0 },	/* fiadd.dd fsrc1,f0,fdest */
-{ "fmov.sd",	0x480000b0, 0xb7e0074f, "e,g", 0 },	/* fadd.sd fsrc1,f0,fdest */
-{ "fmov.ds",	0x48000130, 0xb7e006cf, "e,g", 0 },	/* fadd.ds fsrc1,f0,fdest */
-{ "pfmov.ds",	0x48000530, 0xb73002cf, "e,g", 0 },	/* pfadd.ds fsrc1,f0,fdest */
-{ "pfmov.dd",	0x480005c9, 0xb7e00236, "e,g", 0 },	/* pfiadd.dd fsrc1,f0,fdest */
-
+/* Floating point pseudo-instructions.  */
+{ "fmov.ss",	0x48000049, 0xb7e005b6, "e,g", 0 },	/* fiadd.ss fsrc1,f0,fdest */
+{ "fmov.dd",	0x480001c9, 0xb7e00436, "e,g", 0 },	/* fiadd.dd fsrc1,f0,fdest */
+{ "fmov.sd",	0x480000b0, 0xb7e0054f, "e,g", 0 },	/* fadd.sd fsrc1,f0,fdest */
+{ "fmov.ds",	0x48000130, 0xb7e004cf, "e,g", 0 },	/* fadd.ds fsrc1,f0,fdest */
+{ "pfmov.ds",	0x48000530, 0xb73000cf, "e,g", 0 },	/* pfadd.ds fsrc1,f0,fdest */
+{ "pfmov.dd",	0x480005c9, 0xb7e00036, "e,g", 0 },	/* pfiadd.dd fsrc1,f0,fdest */
+{ 0, 0, 0, 0, 0 },
 
 };
 
diff --git a/include/opcode/ia64.h b/include/opcode/ia64.h
index dd6bccd..642330c 100644
--- a/include/opcode/ia64.h
+++ b/include/opcode/ia64.h
@@ -152,6 +152,7 @@
   IA64_DVS_DATA,
   IA64_DVS_INSTR,
   IA64_DVS_SPECIFIC,
+  IA64_DVS_STOP,
   IA64_DVS_OTHER,
 };
 
@@ -179,7 +180,8 @@
   IA64_RS_PKR,
   IA64_RS_PMC,
   IA64_RS_PMD,
-  IA64_RS_PR,
+  IA64_RS_PR,  /* non-rotating, 1-15 */
+  IA64_RS_PRr, /* rotating, 16-62 */
   IA64_RS_PR63,
   IA64_RS_RR,
 
@@ -300,7 +302,8 @@
 #define IA64_OPCODE_PSEUDO	(1<<6)	/* insn is a pseudo-op */
 #define IA64_OPCODE_F2_EQ_F3	(1<<7)	/* constraint: F2 == F3 */
 #define IA64_OPCODE_LEN_EQ_64MCNT	(1<<8)	/* constraint: LEN == 64-CNT */
-#define IA64_OPCODE_MOD_RRBS    (1<<9) /* modifies all rrbs in CFM */
+#define IA64_OPCODE_MOD_RRBS    (1<<9)	/* modifies all rrbs in CFM */
+#define IA64_OPCODE_POSTINC	(1<<10)	/* postincrement MR3 operand */
 
 /* A macro to extract the major opcode from an instruction.  */
 #define IA64_OP(i)	(((i) >> 37) & 0xf)
diff --git a/include/opcode/m68hc11.h b/include/opcode/m68hc11.h
new file mode 100644
index 0000000..52a2461
--- /dev/null
+++ b/include/opcode/m68hc11.h
@@ -0,0 +1,418 @@
+/* m68hc11.h -- Header file for Motorola 68HC11 & 68HC12 opcode table
+   Copyright 1999, 2000 Free Software Foundation, Inc.
+   Written by Stephane Carrez (stcarrez@worldnet.fr)
+
+This file is part of GDB, GAS, and the GNU binutils.
+
+GDB, GAS, and the GNU binutils are free software; you can redistribute
+them and/or modify them under the terms of the GNU General Public
+License as published by the Free Software Foundation; either version
+1, or (at your option) any later version.
+
+GDB, GAS, and the GNU binutils are distributed in the hope that they
+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 file; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef _OPCODE_M68HC11_H
+#define _OPCODE_M68HC11_H
+
+/* Flags for the definition of the 68HC11 & 68HC12 CCR.  */
+#define M6811_S_BIT     0x80	/* Stop disable */
+#define M6811_X_BIT     0x40	/* X-interrupt mask */
+#define M6811_H_BIT     0x20	/* Half carry flag */
+#define M6811_I_BIT     0x10	/* I-interrupt mask */
+#define M6811_N_BIT     0x08	/* Negative */
+#define M6811_Z_BIT     0x04	/* Zero */
+#define M6811_V_BIT     0x02	/* Overflow */
+#define M6811_C_BIT     0x01	/* Carry */
+
+/* 68HC11 register address offsets (range 0..0x3F or 0..64).
+   The absolute address of the I/O register depends on the setting
+   of the M6811_INIT register.  At init time, the I/O registers are
+   mapped at 0x1000.  Address of registers is then:
+
+   0x1000 + M6811_xxx
+*/
+#define M6811_PORTA     0x00	/* Port A register */
+#define M6811__RES1	0x01	/* Unused/Reserved */
+#define M6811_PIOC	0x02	/* Parallel I/O Control register */
+#define M6811_PORTC	0x03	/* Port C register */
+#define M6811_PORTB	0x04	/* Port B register */
+#define M6811_PORTCL	0x05	/* Alternate latched port C */
+#define M6811__RES6	0x06	/* Unused/Reserved */
+#define M6811_DDRC	0x07	/* Data direction register for port C */
+#define M6811_PORTD	0x08	/* Port D register */
+#define M6811_DDRD	0x09	/* Data direction register for port D */
+#define M6811_PORTE	0x0A	/* Port E input register */
+#define M6811_CFORC	0x0B	/* Compare Force Register */
+#define M6811_OC1M	0x0C	/* OC1 Action Mask register */
+#define M6811_OC1D	0x0D	/* OC1 Action Data register */
+#define M6811_TCTN	0x0E	/* Timer Counter Register */
+#define M6811_TCTN_H	0x0E	/* "	 "	 " High part */
+#define M6811_TCTN_L	0x0F	/* "	 "	 " Low part */
+#define M6811_TIC1	0x10	/* Input capture 1 register */
+#define M6811_TIC1_H	0x10	/* "	 "	 " High part */
+#define M6811_TIC1_L	0x11	/* "	 "	 " Low part */
+#define M6811_TIC2	0x12	/* Input capture 2 register */
+#define M6811_TIC2_H	0x12	/* "	 "	 " High part */
+#define M6811_TIC2_L	0x13	/* "	 "	 " Low part */
+#define M6811_TIC3	0x14	/* Input capture 3 register */
+#define M6811_TIC3_H	0x14	/* "	 "	 " High part */
+#define M6811_TIC3_L	0x15	/* "	 "	 " Low part */
+#define M6811_TOC1	0x16	/* Output Compare 1 register */
+#define M6811_TOC1_H	0x16	/* "	 "	 " High part */
+#define M6811_TOC1_L	0x17	/* "	 "	 " Low part */
+#define M6811_TOC2	0x18	/* Output Compare 2 register */
+#define M6811_TOC2_H	0x18	/* "	 "	 " High part */
+#define M6811_TOC2_L	0x19	/* "	 "	 " Low part */
+#define M6811_TOC3	0x1A	/* Output Compare 3 register */
+#define M6811_TOC3_H	0x1A	/* "	 "	 " High part */
+#define M6811_TOC3_L	0x1B	/* "	 "	 " Low part */
+#define M6811_TOC4	0x1C	/* Output Compare 4 register */
+#define M6811_TOC4_H	0x1C	/* "	 "	 " High part */
+#define M6811_TOC4_L	0x1D	/* "	 "	 " Low part */
+#define M6811_TOC5	0x1E	/* Output Compare 5 register */
+#define M6811_TOC5_H	0x1E	/* "	 "	 " High part */
+#define M6811_TOC5_L	0x1F	/* "	 "	 " Low part */
+#define M6811_TCTL1	0x20	/* Timer Control register 1 */
+#define M6811_TCTL2	0x21	/* Timer Control register 2 */
+#define M6811_TMSK1	0x22	/* Timer Interrupt Mask Register 1 */
+#define M6811_TFLG1	0x23	/* Timer Interrupt Flag Register 1 */
+#define M6811_TMSK2	0x24	/* Timer Interrupt Mask Register 2 */
+#define M6811_TFLG2	0x25	/* Timer Interrupt Flag Register 2 */
+#define M6811_PACTL	0x26	/* Pulse Accumulator Control Register */
+#define M6811_PACNT	0x27	/* Pulse Accumulator Count Register */
+#define M6811_SPCR	0x28	/* SPI Control register */
+#define M6811_SPSR	0x29	/* SPI Status register */
+#define M6811_SPDR	0x2A	/* SPI Data register */
+#define M6811_BAUD	0x2B	/* SCI Baud register */
+#define M6811_SCCR1	0x2C	/* SCI Control register 1 */
+#define M6811_SCCR2	0x2D	/* SCI Control register 2 */
+#define M6811_SCSR	0x2E	/* SCI Status register */
+#define M6811_SCDR	0x2F	/* SCI Data (Read => RDR, Write => TDR) */
+#define M6811_ADCTL	0x30	/* A/D Control register */
+#define M6811_ADR1	0x31	/* A/D, Analog Result register 1 */
+#define M6811_ADR2	0x32	/* A/D, Analog Result register 2 */
+#define M6811_ADR3	0x33	/* A/D, Analog Result register 3 */
+#define M6811_ADR4	0x34	/* A/D, Analog Result register 4 */
+#define M6811__RES35	0x35
+#define M6811__RES36	0x36
+#define M6811__RES37	0x37
+#define M6811__RES38	0x38
+#define M6811_OPTION	0x39	/* System Configuration Options */
+#define M6811_COPRST	0x3A	/* Arm/Reset COP Timer Circuitry */
+#define M6811_PPROG	0x3B	/* EEPROM Programming Control Register */
+#define M6811_HPRIO	0x3C	/* Highest priority I-Bit int and misc */
+#define M6811_INIT	0x3D	/* Ram and I/O mapping register */
+#define M6811_TEST1	0x3E	/* Factory test control register */
+#define M6811_CONFIG	0x3F	/* COP, ROM and EEPROM enables */
+
+
+/* Flags of the CONFIG register (in EEPROM).  */
+#define M6811_NOSEC     0x08    /* Security mode disable */
+#define M6811_NOCOP     0x04    /* COP system disable */
+#define M6811_ROMON     0x02    /* Enable on-chip rom */
+#define M6811_EEON      0x01    /* Enable on-chip eeprom */
+
+/* Flags of the PPROG register.  */
+#define M6811_BYTE	0x10	/* Byte mode */
+#define M6811_ROW       0x08	/* Row mode */
+#define M6811_ERASE	0x04	/* Erase mode select (1 = erase, 0 = read) */
+#define M6811_EELAT     0x02	/* EEPROM Latch Control */
+#define M6811_EEPGM     0x01	/* EEPROM Programming Voltage Enable */
+
+/* Flags of the PIOC register.  */
+#define M6811_STAF	0x80	/* Strobe A Interrupt Status Flag */
+#define M6811_STAI	0x40	/* Strobe A Interrupt Enable Mask */
+#define M6811_CWOM	0x20	/* Port C Wire OR mode */
+#define M6811_HNDS	0x10	/* Handshake mode */
+#define M6811_OIN	0x08	/* Output or Input handshaking */
+#define M6811_PLS	0x04	/* Pulse/Interlocked Handshake Operation */
+#define M6811_EGA	0x02	/* Active Edge for Strobe A */
+#define M6811_INVB	0x01	/* Invert Strobe B */
+
+/* Flags of the SCCR1 register.  */
+#define M6811_R8	0x80	/* Receive Data bit 8 */
+#define M6811_T8	0x40	/* Transmit data bit 8 */
+#define M6811__SCCR1_5  0x20	/* Unused */
+#define M6811_M		0x10	/* SCI Character length */
+#define M6811_WAKE	0x08	/* Wake up method select (0=idle, 1=addr mark) */
+
+/* Flags of the SCCR2 register.  */
+#define M6811_TIE	0x80	/* Transmit Interrupt enable */
+#define M6811_TCIE	0x40	/* Transmit Complete Interrupt Enable */
+#define M6811_RIE	0x20	/* Receive Interrupt Enable */
+#define M6811_ILIE	0x10	/* Idle Line Interrupt Enable */
+#define M6811_TE	0x08	/* Transmit Enable */
+#define M6811_RE	0x04	/* Receive Enable */
+#define M6811_RWU	0x02	/* Receiver Wake Up */
+#define M6811_SBK	0x01	/* Send Break */
+
+/* Flags of the SCSR register.  */
+#define M6811_TDRE	0x80	/* Transmit Data Register Empty */
+#define M6811_TC	0x40	/* Transmit Complete */
+#define M6811_RDRF	0x20	/* Receive Data Register Full */
+#define M6811_IDLE	0x10	/* Idle Line Detect */
+#define M6811_OR	0x08	/* Overrun Error */
+#define M6811_NF	0x04	/* Noise Flag */
+#define M6811_FE	0x02	/* Framing Error */
+#define M6811__SCSR_0	0x01	/* Unused */
+
+/* Flags of the BAUD register.  */
+#define M6811_TCLR	0x80	/* Clear Baud Rate (TEST mode) */
+#define M6811__BAUD_6	0x40	/* Not used */
+#define M6811_SCP1	0x20	/* SCI Baud rate prescaler select */
+#define M6811_SCP0	0x10
+#define M6811_RCKB	0x08	/* Baud Rate Clock Check (TEST mode) */
+#define M6811_SCR2	0x04	/* SCI Baud rate select */
+#define M6811_SCR1	0x02
+#define M6811_SCR0	0x01
+
+#define M6811_BAUD_DIV_1	(0)
+#define M6811_BAUD_DIV_3	(M6811_SCP0)
+#define M6811_BAUD_DIV_4	(M6811_SCP1)
+#define M6811_BAUD_DIV_13	(M6811_SCP1|M6811_SCP0)
+
+/* Flags of the SPCR register.  */
+#define M6811_SPIE	0x80	/* Serial Peripheral Interrupt Enable */
+#define M6811_SPE	0x40	/* Serial Peripheral System Enable */
+#define M6811_DWOM	0x20	/* Port D Wire-OR mode option */
+#define M6811_MSTR	0x10	/* Master Mode Select */
+#define M6811_CPOL	0x08	/* Clock Polarity */
+#define M6811_CPHA	0x04	/* Clock Phase */
+#define M6811_SPR1	0x02	/* SPI Clock Rate Select */
+#define M6811_SPR0	0x01
+
+/* Flags of the SPSR register.  */
+#define M6811_SPIF	0x80	/* SPI Transfer Complete flag */
+#define M6811_WCOL	0x40	/* Write Collision */
+#define M6811_MODF	0x20	/* Mode Fault */
+
+/* Flags of the ADCTL register.  */
+#define M6811_CCF	0x80	/* Conversions Complete Flag */
+#define M6811_SCAN	0x20	/* Continuous Scan Control */
+#define M6811_MULT	0x10	/* Multiple Channel/Single Channel Control */
+#define M6811_CD	0x08	/* Channel Select D */
+#define M6811_CC	0x04	/*                C */
+#define M6811_CB	0x02	/*                B */
+#define M6811_CA	0x01	/*                A */
+
+/* Flags of the CFORC register.  */
+#define M6811_FOC1	0x80	/* Force Output Compare 1 */
+#define M6811_FOC2	0x40	/*			2 */
+#define M6811_FOC3	0x20	/*			3 */
+#define M6811_FOC4	0x10	/*			4 */
+#define M6811_FOC5	0x08	/*			5 */
+
+/* Flags of the OC1M register.  */
+#define M6811_OC1M7	0x80	/* Output Compare 7 */
+#define M6811_OC1M6	0x40	/*                6 */
+#define M6811_OC1M5	0x40	/*                5 */
+#define M6811_OC1M4	0x40	/*                4 */
+#define M6811_OC1M3	0x08	/*                3 */
+
+/* Flags of the OC1D register.  */
+#define M6811_OC1D7	0x80
+#define M6811_OC1D6	0x40
+#define M6811_OC1D5	0x20
+#define M6811_OC1D4	0x10
+#define M6811_OC1D3	0x08
+
+/* Flags of the TCTL1 register.  */
+#define M6811_OM2	0x80	/* Output Mode 2 */
+#define M6811_OL2	0x40	/* Output Level 2 */
+#define M6811_OM3	0x20
+#define M6811_OL3	0x10
+#define M6811_OM4	0x08
+#define M6811_OL4	0x04
+#define M6811_OM5	0x02
+#define M6811_OL5	0x01
+
+/* Flags of the TCTL2 register.  */
+#define M6811_EDG1B	0x20	/* Input Edge Capture Control 1 */
+#define M6811_EDG1A	0x10
+#define M6811_EDG2B	0x08	/* Input 2 */
+#define M6811_EDG2A	0x04
+#define M6811_EDG3B	0x02	/* Input 3 */
+#define M6811_EDG3A	0x01
+
+/* Flags of the TMSK1 register.  */
+#define M6811_OC1I	0x80	/* Output Compare 1 Interrupt */
+#define M6811_OC2I	0x40	/*		  2	      */
+#define M6811_OC3I	0x20	/*		  3	      */
+#define M6811_OC4I	0x10	/*		  4	      */
+#define M6811_OC5I	0x08	/*		  5	      */
+#define M6811_IC1I	0x04	/* Input Capture  1 Interrupt */
+#define M6811_IC2I	0x02	/*		  2	      */
+#define M6811_IC3I	0x01	/*		  3	      */
+
+/* Flags of the TFLG1 register.  */
+#define M6811_OC1F	0x80	/* Output Compare 1 Flag */
+#define M6811_OC2F	0x40	/*		  2	 */
+#define M6811_OC3F	0x20	/*		  3	 */
+#define M6811_OC4F	0x10	/*		  4	 */
+#define M6811_OC5F	0x08	/*		  5	 */
+#define M6811_IC1F	0x04	/* Input Capture  1 Flag */
+#define M6811_IC2F	0x02	/*		  2	 */
+#define M6811_IC3F	0x01	/*		  3	 */
+
+/* Flags of Timer Interrupt Mask Register 2 (TMSK2).  */
+#define M6811_TOI       0x80    /* Timer Overflow Interrupt Enable */
+#define M6811_RTII      0x40    /* RTI Interrupt Enable */
+#define M6811_PAOVI     0x20    /* Pulse Accumulator Overflow Interrupt En. */
+#define M6811_PAII      0x10    /* Pulse Accumulator Interrupt Enable */
+#define M6811_PR1       0x02    /* Timer prescaler */
+#define M6811_PR0       0x01    /* Timer prescaler */
+#define M6811_TPR_1     0x00    /* " " prescale div 1 */
+#define M6811_TPR_4     0x01    /* " " prescale div 4 */
+#define M6811_TPR_8     0x02    /* " " prescale div 8 */
+#define M6811_TPR_16    0x03    /* " " prescale div 16 */
+
+/* Flags of Timer Interrupt Flag Register 2 (M6811_TFLG2).  */
+#define M6811_TOF       0x80    /* Timer overflow bit */
+#define M6811_RTIF      0x40    /* Read time interrupt flag */
+#define M6811_PAOVF     0x20    /* Pulse accumulator overflow Interrupt flag */
+#define M6811_PAIF      0x10    /* Pulse accumulator Input Edge " " " */
+
+/* Flags of Pulse Accumulator Control Register (PACTL).  */
+#define M6811_DDRA7     0x80    /* Data direction for port A bit 7 */
+#define M6811_PAEN      0x40    /* Pulse accumulator system enable */
+#define M6811_PAMOD     0x20    /* Pulse accumulator mode */
+#define M6811_PEDGE     0x10    /* Pulse accumulator edge control */
+#define M6811_RTR1      0x02    /* RTI Interrupt rates select */
+#define M6811_RTR0      0x01    /* " " " " */
+
+/* Flags of the Options register.  */
+#define M6811_ADPU      0x80    /* A/D Powerup */
+#define M6811_CSEL      0x40    /* A/D/EE Charge pump clock source select */
+#define M6811_IRQE      0x20    /* IRQ Edge/Level sensitive */
+#define M6811_DLY       0x10    /* Stop exit turn on delay */
+#define M6811_CME       0x08    /* Clock Monitor enable */
+#define M6811_CR1       0x02    /* COP timer rate select */
+#define M6811_CR0       0x01    /* COP timer rate select */
+
+/* Flags of the HPRIO register.  */
+#define M6811_RBOOT	0x80	/* Read Bootstrap ROM */
+#define M6811_SMOD	0x40	/* Special Mode */
+#define M6811_MDA	0x20	/* Mode Select A */
+#define M6811_IRV	0x10	/* Internal Read Visibility */
+#define M6811_PSEL3	0x08	/* Priority Select */
+#define M6811_PSEL2	0x04
+#define M6811_PSEL1	0x02
+#define M6811_PSEL0	0x01
+
+/* Some insns used by gas to turn relative branches into absolute ones.  */
+#define M6811_BRA	0x20
+#define M6811_JMP	0x7e
+#define M6811_BSR	0x8d
+#define M6811_JSR	0xbd
+#define M6812_JMP       0x06
+#define M6812_BSR       0x07
+#define M6812_JSR       0x16
+
+/* Instruction code pages. Code page 1 is the default.  */
+/*#define	M6811_OPCODE_PAGE1	0x00*/
+#define	M6811_OPCODE_PAGE2	0x18
+#define	M6811_OPCODE_PAGE3	0x1A
+#define	M6811_OPCODE_PAGE4	0xCD
+
+
+/* 68HC11 operands formats as stored in the m6811_opcode table.  These
+   flags do not correspond to anything in the 68HC11 or 68HC12.
+   They are only used by GAS to recognize operands.  */
+#define M6811_OP_NONE         0        /* No operand */
+#define M6811_OP_DIRECT       0x0001   /* Page 0 addressing:   *<val-8bits>  */
+#define M6811_OP_IMM8         0x0002   /*  8 bits immediat:    #<val-8bits>  */
+#define M6811_OP_IMM16        0x0004   /* 16 bits immediat:    #<val-16bits> */
+#define M6811_OP_IND16        0x0008   /* Indirect abs:        <val-16>      */
+#define M6812_OP_IND16_P2     0x0010   /* Second parameter indirect abs.     */
+#define M6812_OP_REG          0x0020   /* Register operand 1                 */
+#define M6812_OP_REG_2        0x0040   /* Register operand 2                 */
+
+#define M6811_OP_IX           0x0080   /* Indirect IX:         <val-8>,x     */
+#define M6811_OP_IY           0x0100   /* Indirect IY:         <val-8>,y     */
+#define M6812_OP_IDX          0x0200   /* Indirect: N,r N,[+-]r[+-] N:5-bits */
+#define M6812_OP_IDX_1        0x0400   /* N,r N:9-bits  */
+#define M6812_OP_IDX_2        0x0800   /* N,r N:16-bits */
+#define M6812_OP_D_IDX        0x1000   /* Indirect indexed: [D,r] */
+#define M6812_OP_D_IDX_2      0x2000   /* [N,r] N:16-bits */
+#define M6811_OP_MASK         0x0FFFF
+#define M6811_OP_BITMASK      0x00010000 /* Bitmask:             #<val-8>    */
+#define M6811_OP_JUMP_REL     0x00020000 /* Pc-Relative:         <val-8>     */
+#define M6812_OP_JUMP_REL16   0x00040000 /* Pc-relative:         <val-16>    */
+#define M6811_OP_PAGE1        0x0000
+#define M6811_OP_PAGE2        0x00080000 /* Need a page2 opcode before       */
+#define M6811_OP_PAGE3        0x00100000 /* Need a page3 opcode before       */
+#define M6811_OP_PAGE4        0x00200000 /* Need a page4 opcode before       */
+#define M6811_MAX_OPERANDS    3     /* Max operands: brset <dst> <mask> <b> */
+
+#define M6812_ACC_OFFSET      0x00400000 /* A,r B,r D,r			    */
+#define M6812_ACC_IND         0x00800000 /* [D,r]			    */
+#define M6812_PRE_INC         0x01000000 /* n,+r   n = -8..8		    */
+#define M6812_PRE_DEC         0x02000000 /* n,-r			    */
+#define M6812_POST_INC        0x04000000 /* n,r+			    */
+#define M6812_POST_DEC        0x08000000 /* n,r-			    */
+#define M6812_INDEXED_IND     0x10000000 /* [n,r]  n = 16-bits		    */
+#define M6812_INDEXED         0x20000000 /* n,r    n = 5, 9 or 16-bits	    */
+#define M6812_OP_IDX_P2       0x40000000
+
+/* Markers to identify some instructions.  */
+#define M6812_OP_EXG_MARKER   0x01000000 /* exg r1,r2 */
+#define M6812_OP_TFR_MARKER   0x02000000 /* tfr r1,r2 */
+#define M6812_OP_SEX_MARKER   0x04000000 /* sex r1,r2 */
+
+#define M6812_OP_EQ_MARKER    0x80000000 /* dbeq/ibeq/tbeq */
+#define M6812_OP_DBCC_MARKER  0x04000000 /* dbeq/dbne */
+#define M6812_OP_IBCC_MARKER  0x02000000 /* ibeq/ibne */
+#define M6812_OP_TBCC_MARKER  0x01000000
+
+#define M6812_OP_TRAP_ID      0x80000000 /* trap #N */
+
+#define M6811_OP_HIGH_ADDR    0x01000000 /* Used internally by gas.  */
+#define M6811_OP_LOW_ADDR     0x02000000
+
+/* CPU identification.  */
+#define cpu6811 0x01
+#define cpu6812 0x02
+
+/* The opcode table is an array of struct m68hc11_opcode.  */
+struct m68hc11_opcode {
+  const char*    name;     /* Op-code name */
+  long           format;
+  unsigned char  size;
+  unsigned char  opcode;
+  unsigned char  cycles_low;
+  unsigned char  cycles_high;
+  unsigned char  set_flags_mask;
+  unsigned char  clr_flags_mask;
+  unsigned char  chg_flags_mask;
+  unsigned char  arch;
+};
+
+/* Alias definition for 68HC12.  */
+struct m68hc12_opcode_alias 
+{
+  const char*   name;
+  const char*   translation;
+  unsigned char size;
+  unsigned char code1;
+  unsigned char code2;
+};
+
+/* The opcode table.  The table contains all the opcodes (all pages).
+   You can't rely on the order.  */
+extern const struct m68hc11_opcode m68hc11_opcodes[];
+extern const int m68hc11_num_opcodes;
+
+/* Alias table for 68HC12.  It translates some 68HC11 insn which are not
+   implemented in 68HC12 but have equivalent translations.  */
+extern const struct m68hc12_opcode_alias m68hc12_alias[];
+extern const int m68hc12_num_alias;
+
+#endif /* _OPCODE_M68HC11_H */
+
diff --git a/include/opcode/mips.h b/include/opcode/mips.h
index 68fe57a..c493d08 100644
--- a/include/opcode/mips.h
+++ b/include/opcode/mips.h
@@ -48,9 +48,11 @@
    breakpoint instruction are not defined; Kane says the breakpoint
    code field in BREAK is 20 bits; yet MIPS assemblers and debuggers
    only use ten bits).  An optional two-operand form of break/sdbbp
-   allows the lower ten bits to be set too.
+   allows the lower ten bits to be set too, and MIPS32 and later
+   architectures allow 20 bits to be set with a signal operand
+   (using CODE20).
 
-   The syscall instruction uses SYSCALL.
+   The syscall instruction uses CODE20.
 
    The general coprocessor instructions use COPZ.  */
 
@@ -82,8 +84,8 @@
 #define OP_SH_PREFX		11
 #define OP_MASK_CCC		0x7
 #define OP_SH_CCC		8
-#define OP_MASK_SYSCALL		0xfffff
-#define OP_SH_SYSCALL		6
+#define OP_MASK_CODE20		0xfffff /* 20 bit syscall/breakpoint code.  */
+#define OP_SH_CODE20		6
 #define OP_MASK_SHAMT		0x1f
 #define OP_SH_SHAMT		6
 #define OP_MASK_FD		0x1f
@@ -100,17 +102,17 @@
 #define OP_SH_FUNCT		0
 #define OP_MASK_SPEC		0x3f
 #define OP_SH_SPEC		0
-#define OP_SH_LOCC              8       /* FP condition code */
-#define OP_SH_HICC              18      /* FP condition code */
+#define OP_SH_LOCC              8       /* FP condition code.  */
+#define OP_SH_HICC              18      /* FP condition code.  */
 #define OP_MASK_CC              0x7
-#define OP_SH_COP1NORM          25      /* Normal COP1 encoding */
-#define OP_MASK_COP1NORM        0x1     /* a single bit */
-#define OP_SH_COP1SPEC          21      /* COP1 encodings */
+#define OP_SH_COP1NORM          25      /* Normal COP1 encoding.  */
+#define OP_MASK_COP1NORM        0x1     /* a single bit.  */
+#define OP_SH_COP1SPEC          21      /* COP1 encodings.  */
 #define OP_MASK_COP1SPEC        0xf
 #define OP_MASK_COP1SCLR        0x4
 #define OP_MASK_COP1CMP         0x3
 #define OP_SH_COP1CMP           4
-#define OP_SH_FORMAT            21      /* FP short format field */
+#define OP_SH_FORMAT            21      /* FP short format field.  */
 #define OP_MASK_FORMAT          0x7
 #define OP_SH_TRUE              16
 #define OP_MASK_TRUE            0x1
@@ -120,12 +122,16 @@
 #define OP_MASK_UNSIGNED        0x1
 #define OP_SH_HINT              16
 #define OP_MASK_HINT            0x1f
-#define OP_SH_MMI               0       /* Multimedia (parallel) op */
+#define OP_SH_MMI               0       /* Multimedia (parallel) op.  */
 #define OP_MASK_MMI             0x3f 
 #define OP_SH_MMISUB            6
 #define OP_MASK_MMISUB          0x1f
-#define OP_MASK_PERFREG		0x1f	/* Performance monitoring */
+#define OP_MASK_PERFREG		0x1f	/* Performance monitoring.  */
 #define OP_SH_PERFREG		1
+#define OP_SH_SEL		0	/* Coprocessor select field.  */
+#define OP_MASK_SEL		0x7	/* The sel field of mfcZ and mtcZ.  */
+#define OP_SH_CODE19		6       /* 19 bit wait code.  */
+#define OP_MASK_CODE19		0x7ffff
 
 /* This structure holds information for a particular instruction.  */
 
@@ -181,8 +187,11 @@
    "u" 16 bit upper 16 bits of address (OP_*_IMMEDIATE)
    "v" 5 bit same register used as both source and destination (OP_*_RS)
    "w" 5 bit same register used as both target and destination (OP_*_RT)
+   "U" 5 bit same destination register in both OP_*_RD and OP_*_RT
+       (used by clo and clz)
    "C" 25 bit coprocessor function code (OP_*_COPZ)
-   "B" 20 bit syscall function code (OP_*_SYSCALL)
+   "B" 20 bit syscall/breakpoint function code (OP_*_CODE20)
+   "J" 19 bit wait function code (OP_*_CODE19)
    "x" accept and ignore register name
    "z" must be zero register
 
@@ -200,6 +209,7 @@
    "E" 5 bit target register (OP_*_RT)
    "G" 5 bit destination register (OP_*_RD)
    "P" 5 bit performance-monitor register (OP_*_PERFREG)
+   "H" 3 bit sel field (OP_*_SEL)
 
    Macro instructions:
    "A" General 32 bit expression
@@ -215,7 +225,7 @@
 
    Characters used so far, for quick reference when adding more:
    "<>(),"
-   "ABCDEFGILMNSTRVW"
+   "ABCDEFGHIJLMNPRSTUVW"
    "abcdfhijklopqrstuvwxz"
 */
 
@@ -291,37 +301,67 @@
    disassembler, and requires special treatment by the assembler.  */
 #define INSN_MACRO                  0xffffffff
 
+/* Masks used to mark instructions to indicate which MIPS ISA level
+   they were introduced in.  ISAs, as defined below, are logical
+   ORs of these bits, indicatingthat they support the instructions
+   defined at the given level.  */
 
-
-
-
-/* MIPS ISA field--CPU level at which insn is supported.  */
-#define INSN_ISA		    0x0000000F
-/* An instruction which is not part of any basic MIPS ISA.
-   (ie it is a chip specific instruction)  */
-#define INSN_NO_ISA		    0x00000000
-/* MIPS ISA 1 instruction.  */
-#define INSN_ISA1		    0x00000001
-/* MIPS ISA 2 instruction (R6000 or R4000).  */
-#define INSN_ISA2		    0x00000002
-/* MIPS ISA 3 instruction (R4000).  */
-#define INSN_ISA3		    0x00000003
-/* MIPS ISA 4 instruction (R8000).  */
-#define INSN_ISA4		    0x00000004
-#define INSN_ISA5		    0x00000005
+#define INSN_ISA1                 0x00000010
+#define INSN_ISA2                 0x00000020
+#define INSN_ISA3                 0x00000040
+#define INSN_ISA4                 0x00000080
+#define INSN_ISA5                 0x00000100
+#define INSN_ISA32                0x00000200
+#define INSN_ISA64                0x00000400
 
 /* Chip specific instructions.  These are bitmasks.  */
-/* MIPS R4650 instruction.  */
-#define INSN_4650		    0x00000010
-/* LSI R4010 instruction.  */
-#define INSN_4010		    0x00000020
-/* NEC VR4100 instruction. */
-#define INSN_4100                   0x00000040
-/* Toshiba R3900 instruction.  */
-#define INSN_3900                   0x00000080
 
-/* 32-bit code running on a ISA3+ CPU. */
-#define INSN_GP32                   0x00001000
+/* MIPS R4650 instruction.  */
+#define INSN_4650                 0x00010000
+/* LSI R4010 instruction.  */
+#define INSN_4010                 0x00020000
+/* NEC VR4100 instruction.  */
+#define INSN_4100                 0x00040000
+/* Toshiba R3900 instruction.  */
+#define INSN_3900                 0x00080000
+/* 32-bit code running on a ISA3+ CPU.  */
+#define INSN_GP32                 0x00100000
+
+/* MIPS ISA defines, use instead of hardcoding ISA level.  */
+
+#define       ISA_UNKNOWN     0               /* Gas internal use.  */
+#define       ISA_MIPS1       (INSN_ISA1)
+#define       ISA_MIPS2       (ISA_MIPS1 | INSN_ISA2)
+#define       ISA_MIPS3       (ISA_MIPS2 | INSN_ISA3)
+#define       ISA_MIPS4       (ISA_MIPS3 | INSN_ISA4)
+#define       ISA_MIPS5       (ISA_MIPS4 | INSN_ISA5)
+#define       ISA_MIPS32      (ISA_MIPS2 | INSN_ISA32)
+#define       ISA_MIPS64      (ISA_MIPS5 | INSN_ISA32 | INSN_ISA64)
+
+/* CPU defines, use instead of hardcoding processor number. Keep this
+   in sync with bfd/archures.c in order for machine selection to work.  */
+#define CPU_UNKNOWN	0               /* Gas internal use.  */
+#define CPU_R2000	2000
+#define CPU_R3000	3000
+#define CPU_R3900	3900
+#define CPU_R4000	4000
+#define CPU_R4010	4010
+#define CPU_VR4100	4100
+#define CPU_R4111	4111
+#define CPU_R4300	4300
+#define CPU_R4400	4400
+#define CPU_R4600	4600
+#define CPU_R4650	4650
+#define CPU_R5000	5000
+#define CPU_R6000	6000
+#define CPU_R8000	8000
+#define CPU_R10000	10000
+#define CPU_MIPS16	16
+#define CPU_MIPS32	32
+#define CPU_MIPS32_4K	3204113         /* 32, 04, octal 'K'.  */
+#define CPU_MIPS5       5
+#define CPU_MIPS64      64
+#define CPU_SB1         12310201        /* octal 'SB', 01.  */
 
 /* Test for membership in an ISA including chip specific ISAs.
    INSN is pointer to an element of the opcode table; ISA is the
@@ -329,243 +369,238 @@
    to test, or zero if no CPU specific ISA test is desired.  
    The gp32 arg is set when you need to force 32-bit register usage on
    a machine with 64-bit registers; see the documentation under -mgp32
-   in the MIPS gas docs. */
+   in the MIPS gas docs.  */
 
-#define OPCODE_IS_MEMBER(insn,isa,cpu,gp32) 	       		\
-    ((((insn)->membership & INSN_ISA) != 0			\
-      && ((insn)->membership & INSN_ISA) <= isa			\
-      && ((insn)->membership & INSN_GP32 ? gp32 : 1))		\
-     || (cpu == 4650						\
-	 && ((insn)->membership & INSN_4650) != 0)		\
-     || (cpu == 4010						\
-	 && ((insn)->membership & INSN_4010) != 0)		\
-     || ((cpu == 4100						\
-	  || cpu == 4111					\
-	  )							\
-	 && ((insn)->membership & INSN_4100) != 0)		\
-     || (cpu == 3900						\
-	 && ((insn)->membership & INSN_3900) != 0))
+#define OPCODE_IS_MEMBER(insn, isa, cpu, gp32)				\
+    ((((insn)->membership & isa) != 0                           	\
+      && ((insn)->membership & INSN_GP32 ? gp32 : 1))			\
+     || (cpu == CPU_R4650 && ((insn)->membership & INSN_4650) != 0)	\
+     || (cpu == CPU_R4010 && ((insn)->membership & INSN_4010) != 0)	\
+     || ((cpu == CPU_VR4100 || cpu == CPU_R4111)			\
+	 && ((insn)->membership & INSN_4100) != 0)			\
+     || (cpu == CPU_R3900  && ((insn)->membership & INSN_3900) != 0))
 
 /* This is a list of macro expanded instructions.
- *
- * _I appended means immediate
- * _A appended means address
- * _AB appended means address with base register
- * _D appended means 64 bit floating point constant
- * _S appended means 32 bit floating point constant
- */
-enum {
-    M_ABS,
-    M_ADD_I,
-    M_ADDU_I,
-    M_AND_I,
-    M_BEQ,
-    M_BEQ_I,
-    M_BEQL_I,
-    M_BGE,
-    M_BGEL,
-    M_BGE_I,
-    M_BGEL_I,
-    M_BGEU,
-    M_BGEUL,
-    M_BGEU_I,
-    M_BGEUL_I,
-    M_BGT,
-    M_BGTL,
-    M_BGT_I,
-    M_BGTL_I,
-    M_BGTU,
-    M_BGTUL,
-    M_BGTU_I,
-    M_BGTUL_I,
-    M_BLE,
-    M_BLEL,
-    M_BLE_I,
-    M_BLEL_I,
-    M_BLEU,
-    M_BLEUL,
-    M_BLEU_I,
-    M_BLEUL_I,
-    M_BLT,
-    M_BLTL,
-    M_BLT_I,
-    M_BLTL_I,
-    M_BLTU,
-    M_BLTUL,
-    M_BLTU_I,
-    M_BLTUL_I,
-    M_BNE,
-    M_BNE_I,
-    M_BNEL_I,
-    M_DABS,
-    M_DADD_I,
-    M_DADDU_I,
-    M_DDIV_3,
-    M_DDIV_3I,
-    M_DDIVU_3,
-    M_DDIVU_3I,
-    M_DIV_3,
-    M_DIV_3I,
-    M_DIVU_3,
-    M_DIVU_3I,
-    M_DLA_AB,
-    M_DLI,
-    M_DMUL,
-    M_DMUL_I, 
-    M_DMULO,
-    M_DMULO_I, 
-    M_DMULOU,
-    M_DMULOU_I, 
-    M_DREM_3,
-    M_DREM_3I,
-    M_DREMU_3,
-    M_DREMU_3I,
-    M_DSUB_I,
-    M_DSUBU_I,
-    M_DSUBU_I_2,
-    M_J_A,
-    M_JAL_1,
-    M_JAL_2,
-    M_JAL_A,
-    M_L_DOB,
-    M_L_DAB,
-    M_LA_AB,
-    M_LB_A,
-    M_LB_AB,
-    M_LBU_A,
-    M_LBU_AB,
-    M_LD_A,
-    M_LD_OB,
-    M_LD_AB,
-    M_LDC1_AB,
-    M_LDC2_AB,
-    M_LDC3_AB,
-    M_LDL_AB,
-    M_LDR_AB,
-    M_LH_A,
-    M_LH_AB,
-    M_LHU_A,
-    M_LHU_AB,
-    M_LI,
-    M_LI_D,
-    M_LI_DD,
-    M_LI_S,
-    M_LI_SS,
-    M_LL_AB,
-    M_LLD_AB,
-    M_LS_A,
-    M_LW_A,
-    M_LW_AB,
-    M_LWC0_A,
-    M_LWC0_AB,
-    M_LWC1_A,
-    M_LWC1_AB,
-    M_LWC2_A,
-    M_LWC2_AB,
-    M_LWC3_A,
-    M_LWC3_AB,
-    M_LWL_A,
-    M_LWL_AB,
-    M_LWR_A,
-    M_LWR_AB,
-    M_LWU_AB,
-    M_MUL,
-    M_MUL_I, 
-    M_MULO,
-    M_MULO_I, 
-    M_MULOU,
-    M_MULOU_I, 
-    M_NOR_I,
-    M_OR_I,
-    M_REM_3,
-    M_REM_3I,
-    M_REMU_3,
-    M_REMU_3I,
-    M_ROL,
-    M_ROL_I,
-    M_ROR,
-    M_ROR_I,
-    M_S_DA,
-    M_S_DOB,
-    M_S_DAB,
-    M_S_S,
-    M_SC_AB,
-    M_SCD_AB,
-    M_SD_A,
-    M_SD_OB,
-    M_SD_AB,
-    M_SDC1_AB,
-    M_SDC2_AB,
-    M_SDC3_AB,
-    M_SDL_AB,
-    M_SDR_AB,
-    M_SEQ,
-    M_SEQ_I,
-    M_SGE,
-    M_SGE_I,
-    M_SGEU,
-    M_SGEU_I,
-    M_SGT,
-    M_SGT_I,
-    M_SGTU,
-    M_SGTU_I,
-    M_SLE,
-    M_SLE_I,
-    M_SLEU,
-    M_SLEU_I,
-    M_SLT_I,
-    M_SLTU_I,
-    M_SNE,
-    M_SNE_I,
-    M_SB_A,
-    M_SB_AB,
-    M_SH_A,
-    M_SH_AB,
-    M_SW_A,
-    M_SW_AB,
-    M_SWC0_A,
-    M_SWC0_AB,
-    M_SWC1_A,
-    M_SWC1_AB,
-    M_SWC2_A,
-    M_SWC2_AB,
-    M_SWC3_A,
-    M_SWC3_AB,
-    M_SWL_A,
-    M_SWL_AB,
-    M_SWR_A,
-    M_SWR_AB,
-    M_SUB_I,
-    M_SUBU_I,
-    M_SUBU_I_2,
-    M_TEQ_I,
-    M_TGE_I,
-    M_TGEU_I,
-    M_TLT_I,
-    M_TLTU_I,
-    M_TNE_I,
-    M_TRUNCWD,
-    M_TRUNCWS,
-    M_ULD,
-    M_ULD_A,
-    M_ULH,
-    M_ULH_A,
-    M_ULHU,
-    M_ULHU_A,
-    M_ULW,
-    M_ULW_A,
-    M_USH,
-    M_USH_A,
-    M_USW,
-    M_USW_A,
-    M_USD,
-    M_USD_A,
-    M_XOR_I,
-    M_COP0,
-    M_COP1,
-    M_COP2,
-    M_COP3,
-    M_NUM_MACROS
+  
+   _I appended means immediate
+   _A appended means address
+   _AB appended means address with base register
+   _D appended means 64 bit floating point constant
+   _S appended means 32 bit floating point constant.  */
+
+enum
+{
+  M_ABS,
+  M_ADD_I,
+  M_ADDU_I,
+  M_AND_I,
+  M_BEQ,
+  M_BEQ_I,
+  M_BEQL_I,
+  M_BGE,
+  M_BGEL,
+  M_BGE_I,
+  M_BGEL_I,
+  M_BGEU,
+  M_BGEUL,
+  M_BGEU_I,
+  M_BGEUL_I,
+  M_BGT,
+  M_BGTL,
+  M_BGT_I,
+  M_BGTL_I,
+  M_BGTU,
+  M_BGTUL,
+  M_BGTU_I,
+  M_BGTUL_I,
+  M_BLE,
+  M_BLEL,
+  M_BLE_I,
+  M_BLEL_I,
+  M_BLEU,
+  M_BLEUL,
+  M_BLEU_I,
+  M_BLEUL_I,
+  M_BLT,
+  M_BLTL,
+  M_BLT_I,
+  M_BLTL_I,
+  M_BLTU,
+  M_BLTUL,
+  M_BLTU_I,
+  M_BLTUL_I,
+  M_BNE,
+  M_BNE_I,
+  M_BNEL_I,
+  M_DABS,
+  M_DADD_I,
+  M_DADDU_I,
+  M_DDIV_3,
+  M_DDIV_3I,
+  M_DDIVU_3,
+  M_DDIVU_3I,
+  M_DIV_3,
+  M_DIV_3I,
+  M_DIVU_3,
+  M_DIVU_3I,
+  M_DLA_AB,
+  M_DLI,
+  M_DMUL,
+  M_DMUL_I, 
+  M_DMULO,
+  M_DMULO_I, 
+  M_DMULOU,
+  M_DMULOU_I, 
+  M_DREM_3,
+  M_DREM_3I,
+  M_DREMU_3,
+  M_DREMU_3I,
+  M_DSUB_I,
+  M_DSUBU_I,
+  M_DSUBU_I_2,
+  M_J_A,
+  M_JAL_1,
+  M_JAL_2,
+  M_JAL_A,
+  M_L_DOB,
+  M_L_DAB,
+  M_LA_AB,
+  M_LB_A,
+  M_LB_AB,
+  M_LBU_A,
+  M_LBU_AB,
+  M_LD_A,
+  M_LD_OB,
+  M_LD_AB,
+  M_LDC1_AB,
+  M_LDC2_AB,
+  M_LDC3_AB,
+  M_LDL_AB,
+  M_LDR_AB,
+  M_LH_A,
+  M_LH_AB,
+  M_LHU_A,
+  M_LHU_AB,
+  M_LI,
+  M_LI_D,
+  M_LI_DD,
+  M_LI_S,
+  M_LI_SS,
+  M_LL_AB,
+  M_LLD_AB,
+  M_LS_A,
+  M_LW_A,
+  M_LW_AB,
+  M_LWC0_A,
+  M_LWC0_AB,
+  M_LWC1_A,
+  M_LWC1_AB,
+  M_LWC2_A,
+  M_LWC2_AB,
+  M_LWC3_A,
+  M_LWC3_AB,
+  M_LWL_A,
+  M_LWL_AB,
+  M_LWR_A,
+  M_LWR_AB,
+  M_LWU_AB,
+  M_MUL,
+  M_MUL_I, 
+  M_MULO,
+  M_MULO_I, 
+  M_MULOU,
+  M_MULOU_I, 
+  M_NOR_I,
+  M_OR_I,
+  M_REM_3,
+  M_REM_3I,
+  M_REMU_3,
+  M_REMU_3I,
+  M_ROL,
+  M_ROL_I,
+  M_ROR,
+  M_ROR_I,
+  M_S_DA,
+  M_S_DOB,
+  M_S_DAB,
+  M_S_S,
+  M_SC_AB,
+  M_SCD_AB,
+  M_SD_A,
+  M_SD_OB,
+  M_SD_AB,
+  M_SDC1_AB,
+  M_SDC2_AB,
+  M_SDC3_AB,
+  M_SDL_AB,
+  M_SDR_AB,
+  M_SEQ,
+  M_SEQ_I,
+  M_SGE,
+  M_SGE_I,
+  M_SGEU,
+  M_SGEU_I,
+  M_SGT,
+  M_SGT_I,
+  M_SGTU,
+  M_SGTU_I,
+  M_SLE,
+  M_SLE_I,
+  M_SLEU,
+  M_SLEU_I,
+  M_SLT_I,
+  M_SLTU_I,
+  M_SNE,
+  M_SNE_I,
+  M_SB_A,
+  M_SB_AB,
+  M_SH_A,
+  M_SH_AB,
+  M_SW_A,
+  M_SW_AB,
+  M_SWC0_A,
+  M_SWC0_AB,
+  M_SWC1_A,
+  M_SWC1_AB,
+  M_SWC2_A,
+  M_SWC2_AB,
+  M_SWC3_A,
+  M_SWC3_AB,
+  M_SWL_A,
+  M_SWL_AB,
+  M_SWR_A,
+  M_SWR_AB,
+  M_SUB_I,
+  M_SUBU_I,
+  M_SUBU_I_2,
+  M_TEQ_I,
+  M_TGE_I,
+  M_TGEU_I,
+  M_TLT_I,
+  M_TLTU_I,
+  M_TNE_I,
+  M_TRUNCWD,
+  M_TRUNCWS,
+  M_ULD,
+  M_ULD_A,
+  M_ULH,
+  M_ULH_A,
+  M_ULHU,
+  M_ULHU_A,
+  M_ULW,
+  M_ULW_A,
+  M_USH,
+  M_USH_A,
+  M_USW,
+  M_USW_A,
+  M_USD,
+  M_USD_A,
+  M_XOR_I,
+  M_COP0,
+  M_COP1,
+  M_COP2,
+  M_COP3,
+  M_NUM_MACROS
 };
 
 
diff --git a/include/opcode/sparc.h b/include/opcode/sparc.h
index 4f159bd..423cea7 100644
--- a/include/opcode/sparc.h
+++ b/include/opcode/sparc.h
@@ -1,5 +1,5 @@
 /* Definitions for opcode table for the sparc.
-   Copyright (C) 1989, 91, 92, 93, 94, 95, 96, 1997
+   Copyright (C) 1989, 91, 92, 93, 94, 95, 96, 97, 2000
    Free Software Foundation, Inc.
 
 This file is part of GAS, the GNU Assembler, GDB, the GNU debugger, and
@@ -46,6 +46,7 @@
   /* v9 variants must appear last */
   SPARC_OPCODE_ARCH_V9,
   SPARC_OPCODE_ARCH_V9A, /* v9 with ultrasparc additions */
+  SPARC_OPCODE_ARCH_V9B, /* v9 with ultrasparc and cheetah additions */
   SPARC_OPCODE_ARCH_BAD /* error return from sparc_opcode_lookup_arch */
 };
 
@@ -141,6 +142,7 @@
 	h	22 high bits.
 	X	5 bit unsigned immediate
 	Y	6 bit unsigned immediate
+	3	SIAM mode (3 bits). (v9b)
 	K	MEMBAR mask (7 bits). (v9)
 	j	10 bit Immediate. (v9)
 	I	11 bit Immediate. (v9)
@@ -187,7 +189,7 @@
 	/	Ancillary state register in rs1 (v9a)
 
 The following chars are unused: (note: ,[] are used as punctuation)
-[345]
+[45]
 
 */
 
diff --git a/include/os9k.h b/include/os9k.h
index 0f2eed2..df81886 100644
--- a/include/os9k.h
+++ b/include/os9k.h
@@ -1,26 +1,45 @@
+/* os9k.h  -  OS-9000 i386 module header definitions
+   Copyright (C) 2000 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+   
+GNU CC 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.
+
+GNU CC 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 GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
 #if !defined(_MODULE_H)
 #define _MODULE_H
 
-/* OS-9000 i386 module header definitions */
 #define _MPF386
 
-/* sizeof common header less parity field */
+/* Size of common header less parity field.  */
 #define N_M_PARITY  (sizeof(mh_com)-sizeof(unisgned short))
 #define OLD_M_PARITY 46
 #define M_PARITY N_M_PARITY
 
 #ifdef _MPF68K
-#define MODSYNC 0x4afd      /* module header sync code for 680x0 processors */
+#define MODSYNC 0x4afc		/* Module header sync code for 680x0 processors.  */
 #endif
 
 #ifdef _MPF386
-#define MODSYNC 0x4afc      /* module header sync code for 80386 processors */
+#define MODSYNC 0x4afc		/* Module header sync code for 80386 processors.  */
 #endif
 
-#define MODREV	1			/* module format revision 1 */
-#define CRCCON	0x800fe3	/* crc polynomial constant */
+#define MODREV	1		/* Module format revision 1.  */
+#define CRCCON	0x800063	/* CRC polynomial constant.  */
 
-/* Module access permission values */
+/* Module access permission values.  */
 #define MP_OWNER_READ	0x0001
 #define MP_OWNER_WRITE	0x0002
 #define MP_OWNER_EXEC	0x0004
@@ -36,7 +55,7 @@
 #define MP_WORLD_MASK	0x0f00
 #define MP_SYSTM_MASK	0xf000
 
-/* Module Type/Language values */
+/* Module Type/Language values.  */
 #define MT_ANY		0
 #define MT_PROGRAM	0x0001
 #define MT_SUBROUT	0x0002
@@ -58,22 +77,22 @@
 #define ML_FRTNCODE	6
 #define ML_MASK		0x00ff
 
-#define mktypelang(type,lang)	(((type)<<8)|(lang))
+#define mktypelang(type, lang)	(((type) << 8) | (lang))
 
-/* Module Attribute values */
+/* Module Attribute values.  */
 #define MA_REENT	0x80
 #define MA_GHOST	0x40
 #define MA_SUPER	0x20
 #define MA_MASK		0xff00
 #define MR_MASK		0x00ff
 
-#define mkattrevs(attr, revs)	(((attr)<<8)|(revs))
+#define mkattrevs(attr, revs)	(((attr) << 8) | (revs))
 
-#define m_user m_owner.grp_usr.usr
-#define m_group m_owner.grp_usr.grp
-#define m_group_user m_owner.group_user
+#define m_user 		m_owner.grp_usr.usr
+#define m_group 	m_owner.grp_usr.grp
+#define m_group_user	m_owner.group_user
 
-/* macro definitions for accessing module header fields */
+/* Macro definitions for accessing module header fields.  */
 #define MODNAME(mod) ((u_char*)((u_char*)mod + ((Mh_com)mod)->m_name))
 #if 0
 /* Appears not to be used, and the u_int32 typedef is gone (because it
@@ -83,87 +102,80 @@
 #define MHCOM_BYTES_SIZE 80
 #define N_BADMAG(a) (((a).a_info) != MODSYNC)
 
-typedef struct mh_com {
-  /* sync bytes ($4afc).  */
+typedef struct mh_com
+{
+  /* Sync bytes ($4afc).  */
   unsigned char m_sync[2];
-  unsigned char m_sysrev[2];		/* system revision check value */
-  unsigned char
-    m_size[4];			/* module size */
-  unsigned char
-    m_owner[4];		/* group/user id */
-  unsigned char
-    m_name[4];			/* offset to module name */
-  unsigned char
-    m_access[2],		/* access permissions */
-    m_tylan[2],		/* type/lang */
-    m_attrev[2],		/* rev/attr */
-    m_edit[2];			/* edition */
-  unsigned char
-    m_needs[4],		/* module hardware requirements flags. (reserved) */
-    m_usage[4],		/* comment string offset */
-    m_symbol[4],		/* symbol table offset */
-    m_exec[4],			/* offset to execution entry point */
-    m_excpt[4],		/* offset to exception entry point */
-    m_data[4],			/* data storage requirement */
-    m_stack[4],		/* stack size */
-    m_idata[4],		/* offset to initialized data */
-    m_idref[4],		/* offset to data reference lists */
-    m_init[4],			/* initialization routine offset */
-    m_term[4];			/* termination routine offset */
-  unsigned char
-    m_ident[2];		/* ident code for ident program */
-  char
-    m_spare[8];	/* reserved bytes */
-  unsigned char
-    m_parity[2]; 		/* header parity */
+  unsigned char m_sysrev[2];	/* System revision check value.  */
+  unsigned char m_size[4];	/* Module size.  */
+  unsigned char m_owner[4];	/* Group/user id.  */
+  unsigned char m_name[4];	/* Offset to module name.  */
+  unsigned char m_access[2];	/* Access permissions.  */
+  unsigned char m_tylan[2];	/* Type/lang.  */
+  unsigned char m_attrev[2];	/* Rev/attr.  */
+  unsigned char m_edit[2];	/* Edition.  */
+  unsigned char m_needs[4];	/* Module hardware requirements flags. (reserved).  */
+  unsigned char m_usage[4];	/* Comment string offset.  */
+  unsigned char m_symbol[4];	/* Symbol table offset.  */
+  unsigned char m_exec[4];	/* Offset to execution entry point.  */
+  unsigned char m_excpt[4];	/* Offset to exception entry point.  */
+  unsigned char m_data[4];	/* Data storage requirement.  */
+  unsigned char m_stack[4];	/* Stack size.  */
+  unsigned char m_idata[4];	/* Offset to initialized data.  */
+  unsigned char m_idref[4];	/* Offset to data reference lists.  */
+  unsigned char m_init[4];	/* Initialization routine offset.  */
+  unsigned char m_term[4];	/* Termination routine offset.  */
+  unsigned char m_ident[2];	/* Ident code for ident program.  */
+  char          m_spare[8];	/* Reserved bytes.  */
+  unsigned char m_parity[2]; 	/* Header parity.  */
 } mh_com,*Mh_com;
 
-/* Executable memory module */
+/* Executable memory module.  */
 typedef mh_com *Mh_exec,mh_exec;
 
-/* Data memory module */
+/* Data memory module.  */
 typedef mh_com *Mh_data,mh_data;
 
-/* File manager memory module */
+/* File manager memory module.  */
 typedef mh_com *Mh_fman,mh_fman;
 
-/* device driver module */
+/* Device driver module.  */
 typedef mh_com *Mh_drvr,mh_drvr;
 
-/* trap handler module */
+/* Trap handler module.  */
 typedef	mh_com mh_trap, *Mh_trap;
 
-/* Device descriptor module */
+/* Device descriptor module.  */
 typedef	mh_com *Mh_dev,mh_dev;
 
-/* Configuration module */
+/* Configuration module.  */
 typedef mh_com *Mh_config, mh_config;
 
 #if 0 
 
 #if !defined(_MODDIR_H)
-/* go get _os_fmod (and others) */
+/* Go get _os_fmod (and others).  */
 #include <moddir.h>
 #endif
 
-error_code _os_crc(void *, u_int32, int *);
-error_code _os_datmod(char *, u_int32, u_int16 *, u_int16 *, u_int32, void **, mh_data **);
-error_code _os_get_moddir(void *, u_int32 *);
-error_code _os_initdata(mh_com *, void *);
-error_code _os_link(char **, mh_com **, void **, u_int16 *, u_int16 *);
-error_code _os_linkm(mh_com *, void **, u_int16 *, u_int16 *);
-error_code _os_load(char *, mh_com **, void **, u_int32, u_int16 *, u_int16 *, u_int32);
-error_code _os_mkmodule(char *, u_int32, u_int16 *, u_int16 *, u_int32, void **, mh_com **, u_int32);
-error_code _os_modaddr(void *, mh_com **);
-error_code _os_setcrc(mh_com *);
-error_code _os_slink(u_int32, char *, void **, void **, mh_com **);
-error_code _os_slinkm(u_int32, mh_com *, void **, void **);
-error_code _os_unlink(mh_com *);
-error_code _os_unload(char *, u_int32);
-error_code _os_tlink(u_int32, char *, void **, mh_trap **, void *, u_int32);
-error_code _os_tlinkm(u_int32, mh_com *, void **, void *, u_int32);
-error_code _os_iodel(mh_com *);
-error_code _os_vmodul(mh_com *, mh_com *, u_int32);
+error_code _os_crc (void *, u_int32, int *);
+error_code _os_datmod (char *, u_int32, u_int16 *, u_int16 *, u_int32, void **, mh_data **);
+error_code _os_get_moddir (void *, u_int32 *);
+error_code _os_initdata (mh_com *, void *);
+error_code _os_link (char **, mh_com **, void **, u_int16 *, u_int16 *);
+error_code _os_linkm (mh_com *, void **, u_int16 *, u_int16 *);
+error_code _os_load (char *, mh_com **, void **, u_int32, u_int16 *, u_int16 *, u_int32);
+error_code _os_mkmodule (char *, u_int32, u_int16 *, u_int16 *, u_int32, void **, mh_com **, u_int32);
+error_code _os_modaddr (void *, mh_com **);
+error_code _os_setcrc (mh_com *);
+error_code _os_slink (u_int32, char *, void **, void **, mh_com **);
+error_code _os_slinkm (u_int32, mh_com *, void **, void **);
+error_code _os_unlink (mh_com *);
+error_code _os_unload (char *, u_int32);
+error_code _os_tlink (u_int32, char *, void **, mh_trap **, void *, u_int32);
+error_code _os_tlinkm (u_int32, mh_com *, void **, void *, u_int32);
+error_code _os_iodel (mh_com *);
+error_code _os_vmodul (mh_com *, mh_com *, u_int32);
 #endif /* 0 */
 
 #endif
diff --git a/include/safe-ctype.h b/include/safe-ctype.h
new file mode 100644
index 0000000..d5fc649
--- /dev/null
+++ b/include/safe-ctype.h
@@ -0,0 +1,100 @@
+/* <ctype.h> replacement macros.
+
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Contributed by Zack Weinberg <zackw@stanford.edu>.
+
+This file is part of the libiberty library.
+Libiberty 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.
+
+Libiberty 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 libiberty; 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 is a compatible replacement of the standard C library's <ctype.h>
+   with the following properties:
+
+   - Implements all isxxx() macros required by C99.
+   - Also implements some character classes useful when
+     parsing C-like languages.
+   - Does not change behavior depending on the current locale.
+   - Behaves properly for all values in the range of a signed or
+     unsigned char.
+
+   To avoid conflicts, this header defines the isxxx functions in upper
+   case, e.g. ISALPHA not isalpha.  */
+
+#ifndef SAFE_CTYPE_H
+#define SAFE_CTYPE_H
+
+#ifdef isalpha
+ #error "safe-ctype.h and ctype.h may not be used simultaneously"
+#else
+
+/* Categories.  */
+
+enum {
+  /* In C99 */
+  _sch_isblank  = 0x0001,	/* space \t */
+  _sch_iscntrl  = 0x0002,	/* nonprinting characters */
+  _sch_isdigit  = 0x0004,	/* 0-9 */
+  _sch_islower  = 0x0008,	/* a-z */
+  _sch_isprint  = 0x0010,	/* any printing character including ' ' */
+  _sch_ispunct  = 0x0020,	/* all punctuation */
+  _sch_isspace  = 0x0040,	/* space \t \n \r \f \v */
+  _sch_isupper  = 0x0080,	/* A-Z */
+  _sch_isxdigit = 0x0100,	/* 0-9A-Fa-f */
+
+  /* Extra categories useful to cpplib.  */
+  _sch_isidst	= 0x0200,	/* A-Za-z_ */
+  _sch_isvsp    = 0x0400,	/* \n \r */
+  _sch_isnvsp   = 0x0800,	/* space \t \f \v \0 */
+
+  /* Combinations of the above.  */
+  _sch_isalpha  = _sch_isupper|_sch_islower,	/* A-Za-z */
+  _sch_isalnum  = _sch_isalpha|_sch_isdigit,	/* A-Za-z0-9 */
+  _sch_isidnum  = _sch_isidst|_sch_isdigit,	/* A-Za-z0-9_ */
+  _sch_isgraph  = _sch_isalnum|_sch_ispunct,	/* isprint and not space */
+  _sch_iscppsp  = _sch_isvsp|_sch_isnvsp	/* isspace + \0 */
+};
+
+/* Character classification.  */
+extern const unsigned short _sch_istable[256];
+
+#define _sch_test(c, bit) (_sch_istable[(c) & 0xff] & (bit))
+
+#define ISALPHA(c)  _sch_test(c, _sch_isalpha)
+#define ISALNUM(c)  _sch_test(c, _sch_isalnum)
+#define ISBLANK(c)  _sch_test(c, _sch_isblank)
+#define ISCNTRL(c)  _sch_test(c, _sch_iscntrl)
+#define ISDIGIT(c)  _sch_test(c, _sch_isdigit)
+#define ISGRAPH(c)  _sch_test(c, _sch_isgraph)
+#define ISLOWER(c)  _sch_test(c, _sch_islower)
+#define ISPRINT(c)  _sch_test(c, _sch_isprint)
+#define ISPUNCT(c)  _sch_test(c, _sch_ispunct)
+#define ISSPACE(c)  _sch_test(c, _sch_isspace)
+#define ISUPPER(c)  _sch_test(c, _sch_isupper)
+#define ISXDIGIT(c) _sch_test(c, _sch_isxdigit)
+
+#define ISIDNUM(c)	_sch_test(c, _sch_isidnum)
+#define ISIDST(c)	_sch_test(c, _sch_isidst)
+#define IS_VSPACE(c)	_sch_test(c, _sch_isvsp)
+#define IS_NVSPACE(c)	_sch_test(c, _sch_isnvsp)
+#define IS_SPACE_OR_NUL(c)	_sch_test(c, _sch_iscppsp)
+
+/* Character transformation.  */
+extern const unsigned char  _sch_toupper[256];
+extern const unsigned char  _sch_tolower[256];
+#define TOUPPER(c) _sch_toupper[(c) & 0xff]
+#define TOLOWER(c) _sch_tolower[(c) & 0xff]
+
+#endif /* no ctype.h */
+#endif /* SAFE_CTYPE_H */
diff --git a/include/sort.h b/include/sort.h
new file mode 100644
index 0000000..c8e1d55
--- /dev/null
+++ b/include/sort.h
@@ -0,0 +1,48 @@
+/* Sorting algorithms.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Contributed by Mark Mitchell <mark@codesourcery.com>.
+
+This file is part of GNU CC.
+   
+GNU CC 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.
+
+GNU CC 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 GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#ifndef SORT_H
+#define SORT_H
+
+#include <sys/types.h> /* For size_t */
+#ifdef __STDC__
+#include <stddef.h>
+#endif	/* __STDC__ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <ansidecl.h>
+
+/* Sort an array of pointers.  */
+
+extern void sort_pointers PARAMS ((size_t, void **, void **));
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* SORT_H */
+
+
+   
+   
diff --git a/include/splay-tree.h b/include/splay-tree.h
index 39882a4..f53f855 100644
--- a/include/splay-tree.h
+++ b/include/splay-tree.h
@@ -1,5 +1,5 @@
 /* A splay-tree datatype.  
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
    Contributed by Mark Mitchell (mark@markmitchell.com).
 
 This file is part of GNU CC.
@@ -104,6 +104,12 @@
 extern splay_tree_node splay_tree_lookup   
                                         PARAMS((splay_tree,
 					        splay_tree_key));
+extern splay_tree_node splay_tree_predecessor
+                                        PARAMS((splay_tree,
+						splay_tree_key));
+extern splay_tree_node splay_tree_successor
+                                        PARAMS((splay_tree,
+						splay_tree_key));
 extern int splay_tree_foreach           PARAMS((splay_tree,
 					        splay_tree_foreach_fn,
 					        void*));
diff --git a/include/symcat.h b/include/symcat.h
index 3e27162..61ce1e9 100644
--- a/include/symcat.h
+++ b/include/symcat.h
@@ -19,12 +19,16 @@
 #ifndef SYM_CAT_H
 #define SYM_CAT_H
 
-#if defined (__STDC__) || defined (ALMOST_STDC)
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
 #define CONCAT2(a,b)	 a##b
 #define CONCAT3(a,b,c)	 a##b##c
 #define CONCAT4(a,b,c,d) a##b##c##d
 #define STRINGX(s) #s
 #else
+/* Note one should never pass extra whitespace to the CONCATn macros,
+   e.g. CONCAT2(foo, bar) because traditonal C will keep the space between
+   the two labels instead of concatenating them.  Instead, make sure to
+   write CONCAT2(foo,bar).  */
 #define CONCAT2(a,b)	 a/**/b
 #define CONCAT3(a,b,c)	 a/**/b/**/c
 #define CONCAT4(a,b,c,d) a/**/b/**/c/**/d
@@ -35,6 +39,11 @@
 #define XCONCAT3(a,b,c)   CONCAT3(a,b,c)
 #define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d)
 
+/* Note the layer of indirection here is typically used to allow
+   stringification of the expansion of macros.  I.e. "#define foo
+   bar", "XSTRING(foo)", to yield "bar".  Be aware that this only
+   works for __STDC__, not for traditional C which will still resolve
+   to "foo".  */
 #define XSTRING(s) STRINGX(s) 
 
-#endif SYM_CAT_H
+#endif /* SYM_CAT_H */
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index bc85c40..e3142bf 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,592 @@
+2000-12-26  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
+
+	* bsearch.c: New file.
+	* configure.in (funcs): Add bsearch.
+	(AC_CHECK_FUNCS): Likewise.
+	* configure, config.in: Regenerate.
+
+2000-12-13  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
+
+	* safe-ctype.c: #include "ansidecl.h".
+	* strtod.c: Likewise.
+
+2000-12-13  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
+
+	* strtoul.c: Include safe-ctype.h, not ctype.h.
+
+2000-12-07  Zack Weinberg  <zack@wolery.stanford.edu>
+
+	* safe-ctype.c: New file.
+	* Makefile.in (CFILES): Add safe-ctype.c.
+	(REQUIRED_OFILES): Add safe-ctype.o.
+
+	* argv.c: Define ISBLANK and use it, not isspace.
+	* basename.c, cplus-dem.c, fnmatch.c, pexecute.c, strtod.c,
+	strtol.c, strtoul.c: Include safe-ctype.h, not ctype.h.  Use
+	uppercase ctype macros.  Don't test ISUPPER(c)/ISLOWER(c)
+	before calling TOLOWER(c)/TOUPPER(c).
+
+2000-12-07  Mike Stump  <mrs@wrs.com>
+
+	* Makefile.in (distclean): When cleaning, remove testsuite.
+
+2000-12-05  Jason Merrill  <jason@redhat.com>
+
+	* cp-demangle.c (cplus_demangle_v3): Check that it's a v3 mangled
+	name before allocating the dyn_string.
+
+2000-12-04  Jason Merrill  <jason@redhat.com>
+
+	* cp-demangle.c: s/new_abi/v3/.
+	* cplus-dem.c: Likewise.
+	(current_demangling_style): Now auto_demangling.
+	(cplus_demangle): Try v3 demangling if AUTO_DEMANGLING.
+	(main): Use standard symbol chars for auto_demangling.
+
+2000-11-26  Mark Mitchell  <mark@codesourcery.com>
+
+	* hashtab.c (higher_prime_number): Use a table, rather than a
+	seive, to find the next prime.
+
+2000-11-22  H.J. Lu  <hjl@gnu.org>
+
+	* cplus-dem.c (main): Handle gnat_demangling.
+
+2000-11-22  Zack Weinberg  <zack@wolery.stanford.edu>
+
+	* aclocal.m4 (LIB_AC_PROG_CC): Moved here from configure.in.
+	(AC_DEFINE_NOAUTOHEADER): New - work around bug in autoheader.
+	* configure.in: Call AC_C_INLINE and AC_C_CONST.  Use three
+	argument form of AC_DEFINE in dummy definitions block.  Use
+	AC_DEFINE_NOAUTOHEADER for real definitions of things defined
+	in dummy block.  Preload cache variables instead of bypassing
+	tests, where possible.
+	* acconfig.h: Removed.
+
+	* xmalloc.c (xmalloc_failed): New function, does error
+	reporting on failed allocation.
+	(xmalloc, xcalloc, xrealloc): Use it.
+
+2000-11-21  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* cplus-dem.c (cplus_demangle): Fix formatting.
+	(grow_vect): Ditto.
+	(ada_demangle): Ditto.
+	(internal_cplus_demangle): Ditto.
+	(mop_up): Ditto.
+
+2000-11-21  H.J. Lu  <hjl@gnu.org>
+
+	* cplus-dem.c (main): Handle java_demangling.
+
+2000-11-19  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* cplus-dem.c (grow_vect): Prototype.
+	(ada_demangle): Cast the arg of ctype macros to unsigned char.
+
+2000-11-15  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* cplus-dem.c (ada_demangle): Add back ATTRIBUTE_UNUSED for
+	parameter `option'.
+
+2000-11-15  Kenneth Block  <kenneth.block@compaq.com>
+
+	* cplus-dem.c: Eliminate use of DEFUN, it is obsolete and cannot
+	be used in GCC.
+
+2000-11-15  Kenneth Block  <kenneth.block@compaq.com>
+
+	* cplus-dem.c: Add gnat demangler.  Add java to demangle style
+	list.
+
+2000-11-04  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* hashtab.c (htab_expand): Change to return int.  Use calloc or
+ 	xcalloc depending on htab->return_allocation_failure.  Return zero
+ 	if calloc fails.
+	(htab_create): Update comment to cover memory allocation.
+	(htab_try_create): New.
+	(htab_find_slot_with_hash): Return NULL if htab_expand fails.
+  	Update comment to cover this.
+
+2000-11-03  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* hashtab.c: Change void * to PTR where necessary.
+	(htab_create, htab_expand): Correct formatting of comment before
+	function.
+
+2000-10-22  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c (string_list_def): Add caret_position and comments.
+	(result_caret_pos): New macro.
+	(result_append_string): Rename to...
+	(result_add_string): ... this, and insert at caret position.
+	Rename throughout.
+	(result_append): Rename to...
+	(result_add): ... this, and insert at caret position.  Rename
+	throughout.
+	(result_append_char): Rename to...
+	(result_add_char): ... this, and insert at caret position.  Rename
+	throughout.
+	(result_append_space): Remove.
+	(string_list_new): Initialize caret position.
+	(result_add_separated_char): Use caret position.
+	(result_get_caret): New funtion.
+	(result_set_caret): Likewise.
+	(result_shift_caret): Likewise.
+	(result_previous_char_is_space): Likewise.
+	(substitution_start): Use caret position.
+	(substitution_add): Likewise.
+	(demangling_new): Initialize caret position.
+	(demangle_encoding): Use caret position.
+	(demanglin_nested_name): Put CV qualifiers after name.
+	(demangle_type_ptr): Use switch statement.  Handle pointers to
+	arrays.  Don't use result_append_space.  Use caret position.
+	(demangle_type): Emit CV qualifiers after underlying type.  Adjust
+	call to demangle_array_type.
+	(demangle_array_type): Add parameter to handle pointers to arrays.
+
+2000-10-01  Mark Mitchell  <mark@codesourcery.com>
+
+	* splay-tree.c (splay_tree_insert): Fix formatting.
+
+2000-09-16  Mark Mitchell  <mark@codesourcery.com>
+
+	* splay-tree.c (splay_tree_predecessor): Fix typo in comment.
+
+2000-09-14  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
+
+	* splay-tree.c: #include <stdio.h>.
+
+2000-09-14  Hans-Peter Nilsson  <hp@axis.com>
+
+	* testsuite/demangle-expected: Add two tests for anonymous
+	namespaces.
+	* cplus-dem.c (gnu_special): Handle anonymous namespaces.
+
+2000-09-10  Mark Mitchell  <mark@codesourcery.com>
+
+	* splay-tree.c (splay_tree_predecessor): New function.
+	(splay_tree_successor): Likewise.
+
+2000-09-10  Hans-Peter Nilsson  <hp@axis.com>
+
+	* testsuite/demangle-expected: Add four tests for type_info
+	mangling.
+	* cplus-dem.c (gnu_special): Use do_type, not demangle_fund_type,
+	for a non-template non-qualified type_info function or node.
+
+2000-09-08  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c: Fix copyright banner.
+
+2000-09-07  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
+
+	* md5.c: #include "ansidecl.h".
+
+2000-09-06  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c (status_allocation_failed): Rearrange whitespace.
+	(demangle_type): Handle substitution candidates correctly in the
+	face of special substitutions.
+
+2000-09-05  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c (demangle_encoding): Rename variable.
+	(demangle_name): Rename parameter.  Handle return type
+	suppression.
+	(demangle_nested_name): Rename parameter.
+	(demangle_prefix): Likewise.  Change return type suppression.
+	(demangle_unqualified_name): Add parameter.  Flag constructors and
+	conversion operators.
+	(demangle_special_name): Fix comment.
+	(demangle_type): Rename variable.
+	(demangle_bare_function_type): Check for missing return type and
+	parameter.
+	(demangle_class_enum_type): Rename parameter.
+	(demangle_discriminator): Fix misspelling in comment.
+
+2000-08-31  DJ Delorie  <dj@redhat.com>
+
+	* configure.in (Cygwin): special case cygwin only when we're
+	building cygwin, not when we're hosting cygwin.
+
+2000-09-04  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c (demangle_template_arg): Eat an `E' after an
+	<expression>.
+
+2000-09-04  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c (demangle_type_ptr): Increment position past
+	pointer and reference characters.
+
+2000-09-04  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c (demangle_nv_offset): New function.
+	(demangle_v_offset): Likewise.
+	(demangle_call_offset): Likewise.
+	(demangle_special_name): Update thunk demangling to comply with
+	ABI changes.
+
+2000-09-03  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c (ANONYMOUS_NAMESPACE_PREFIX): New macro.
+	(substitution_def): Remove template_parm_number.
+	(NOT_TEMPLATE_PARM): Remove.
+	(result_insert_string): New macro.
+	(result_insert): Likewise.
+	(result_insert_char): Likewise.
+	(substitution_add): Remove last parameter.  Don't store template
+	parm number.
+	(BFT_NO_RETURN_TYPE): Define as NULL.
+	(demangle_encoding): Adjust call to demangle_bare_function_type.
+	(demangle_name): Adjust substitution.  Adjust call to
+	substitution_add.
+	(demangle_prefix): Adjust call to substitution_add.
+	(demangle_identifier): Handle anonymous namespaces.
+	(demangle_operator_name): Change demangling of vendor-extended
+	operator to match ABI changes.
+	(demangle_type_ptr): Change parameters.  Make recursive.  Handle
+	substitutions here.
+	(demangle_type): Adjust calls to demangle_template_param,
+	substitution_add, and demangle_type_ptr.  Fix substitution of
+	templated types.
+	(demangle_function_type): Change parameter to a pointer.
+	(demangle_bare_function_type): Likewise.  Adjust insertion point.
+	(demangle_template_param): Remove last parameter.
+	(demangle_expr_primary): Remove unused variable.  Adjust call to
+	demangle_template_param.
+	(is_mangled_char): Accept `$' and `.'.
+	* cplus-dem.c (gnu_new_abi_symbol_characters): Add '$' and '.'.
+	* dyn-string.c (dyn_string_insert_char): New function.
+
+2000-08-31  Hans-Peter Nilsson  <hp@axis.com>
+
+	* testsuite/demangle-expected: Add nine tests for
+	underscore-after-number followed by five tests for name-signature
+	delimiter.
+
+2000-08-28  Richard Henderson  <rth@cygnus.com>
+
+	* Makefile.in (md5.o): Depend on config.h.
+
+2000-08-28  Jason Merrill  <jason@redhat.com>
+
+	* Makefile.in (REQUIRED_OFILES): Add md5.o.
+	(CFILES): Add md5.c.
+	* md5.c: New file.
+
+2000-08-27  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c (demangle_name): Initialize template_p in local
+	name case.  Don't re-add substitutions as candidates.
+	(demangle_nested_name): Use <unqualified-name>.
+	(demangle_prefix): Likewise.  Don't add template names as
+	substitution candidates twice, or re-add a substitution or the
+	last prefix component.
+	(demangle_local_name): Adjust output format.
+
+2000-08-25  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c (result_add_separated_char): Change parameter to
+	int.
+	(substitution_add): Don't check for duplicates.  Check if
+	previously allocated size is zero.
+	(demangle_name): Remove duplicate check for std substitution.
+	Clear template flag appropriately.
+	(demangle_prefix): Remove argument to demangle_substitution.
+	Don't check that template flag is already set.
+	(demangle_operator_name): Add pt operator.
+	(demangle_type): Don't treat r as built-in type.  Remove argument
+	to demangle_substitution.  Fix substitution candidate mechanics.
+	Handle <template-template-parm>s.  Improve comments.
+	(demangle_template_param): Don't handle template arg lists here.
+	(demangle_substitution): Remove parameter.
+	(print_usage): Remove extra fprintf option.
+
+2000-08-24  Greg McGary  <greg@mcgary.org>
+
+	* libiberty/random.c (end_ptr): Revert previous change.
+
+2000-08-24  Greg McGary  <greg@mcgary.org>
+
+	* libiberty/cplus-dem.c (cplus_demangle_opname, cplus_mangle_opname,
+	demangle_expression, demangle_function_name): Use ARRAY_SIZE.
+	* libiberty/random.c (end_ptr): Likewise.
+
+2000-08-23  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c (result_close_template_list): Remove function.
+	(result_add_separated_char): New function.
+	(result_open_template_list): New macro.
+	(result_close_template_list): Likewise.
+	(demangle_prefix): Don't set template_p if the
+	prefix ends with a ctor name.
+	(demangle_type_ptr): Remove duplicate RETURN_IF_ERROR.
+	(demangle_type): Check for template args after substitution.
+	(demangle_template_args): Use result_open_template_list.
+
+2000-08-02  Zack Weinberg  <zack@wolery.cumb.org>
+
+	* pexecute.c:  Don't use vfork.  Initialize 'pid' before retry loop.
+
+2000-07-26  Dave Pitts  <dpitts@cozx.com>
+
+	* config/mh-openedition.h: Added -DLE370 definition.
+
+2000-07-26 Mark Elbrecht <snowball3@bigfoot.com>
+
+	* pexecute.c (pexecute) [__MSDOS__]: Change __GO32__ to
+	__DJGPP__. Use P_WAIT instead of constant in the spawnv* call.
+	Cast program to 'char *' in errmsg_arg assignment.
+	(PWAIT_ERROR): Define.
+	(pwait): Use PWAIT_ERROR.  Adjust DJGPP's status code to conform
+	to DJGPP's WIF* macros.
+
+2000-07-27  RodneyBrown  <RodneyBrown@pmsc.com>
+	    Jeff Law <law@cygnus.com>
+
+	* getcwd.c: Include string.h, stdlib.h for prototypes
+
+	* Makefile.in (rename.o, waitpid.o): Depend on config.h
+	* rename.c: Include config.h, unistd.h
+	* waitpid.c: Include config.h, sys/wait.h
+
+2000-07-24  Hans-Peter Nilsson  <hp@axis.com>
+
+	* cplus-dem.c (work_stuff_copy_to_from): New.
+	(delete_non_B_K_work_stuff): New.
+	(delete_work_stuff): New.
+	(mop_up): Break out work_stuff partly destruction to
+	delete_non_B_K_work_stuff.
+	(iterate_demangle_function): New.
+	(demangle_prefix): Call iterate_demangle_function instead of
+	demangle_function_name.  Leave handling of name-signature
+	__-delimiters to iterate_demangle_function.
+	(demangle_integral_value): Strip an optional
+	following underscore cautiously.  Handle negative numbers.
+
+2000-07-24  Daniel Berlin <dberlin@redhat.com>
+
+	* cplus-dem.c (demangle_signature): Change if (GNU_DEMANGLING) to
+	if (AUTO_DEMANGLING || GNU_DEMANGLING)
+
+2000-07-21  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c (demangle_ctor_dtor_name): Remove not-in-charge
+	allocating ctor mangling.
+	(demangle_array_type): Handle empty and non-constant array length.
+
+2000-07-23  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
+	    Jeff Law <law@cygnus.com>
+
+	* configure.in (AC_CHECK_HEADERS): Add time.h.
+	(AC_HEADER_TIME): Add check.
+	* configure, config.in: Regenerate.
+	* getruntime.c: Portably #include <sys/time.h> and/or <time.h>.
+
+	* configure.in (AC_CHECK_HEADERS): Add limits.h.
+	* configure, config.in: Regenerate.
+	* sort.c: Portably #include <limits.h> and/or <sys/param.h>.
+	* strtol.c, strtoul.c: #include "config.h". Portably #include
+	<limits.h> and/or <sys/param.h>.
+	* Makefile.in (strtol.o, strtoul.o): Update dependencies.
+
+	* aclocal.m4 (libiberty_AC_DECLARE_ERRNO): New macro.
+	* configure.in (libiberty_AC_DECLARE_ERRNO): Add check.
+	* configure, config.in: Regenerate.
+	* pexecute.c, strtol.c, strtoul.c: Declare errno if necessary.
+
+	* cp-demangle.c, mkstemps.c: #include <sys/types.h>.
+
+2000-07-21  Mike Stump  <mrs@wrs.com>
+
+	* Makefile.in (xexit.o): Add dependency for config.h in xexit.c.
+	* (vasprintf.o): Add dependency for config.h in vasprintf.c.
+
+2000-07-21  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* cp-demangle.c (cp_demangle_type): Wrap in IN_LIBGCC2.
+
+	* setenv.c (setenv): Initialize variable `ep'.
+
+	* sigsetmask.c (abort): Prototype.
+
+	* vasprintf.c: Include config.h.  Check ANSI_PROTOTYPES, not
+	__STDC__ for stdarg.h include.
+	(int_vasprintf): Prototype.
+	(checkit): Prototype.  Use VPARAMS/ANSI_PROTOTYPES/VA_START in
+	definition.  Cast `global_total_width' in comparison.
+	(main): Prototype.  Return a value.
+
+	* vfork.c (fork): Prototype.
+
+	* xexit.c: Include config.h.
+
+2000-07-20  Joseph S. Myers  <jsm28@cam.ac.uk>
+
+	* cplus-dem.c (demangle_fund_type): Make 'dec' an unsigned int,
+	and print it with %u.
+
+2000-07-17  Hans-Peter Nilsson  <hp@axis.com>
+
+	* testsuite/regress-demangle (failed test): Show result and
+	expected output.
+
+2000-07-07  Andrew Haley  <aph@cygnus.com>
+
+	* cplus-dem.c (main): fflush() after emitting last char before
+	waiting for input.
+
+2000-06-28  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c (demangle_encoding): Accept no substitutions.
+	(demangle_name): Handle <substitution> followed by
+	<unqualified-template-name>.
+	(demangle_type): Follow special substitutions with
+	<class-enum-type>
+	(demangle_subtitution): Set template_p for special substitutions.
+	(main): Fix typos.
+
+2000-06-27  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c (demangle_special_name): Swap base and derived
+	class when demangling construction vtables.
+
+2000-06-21  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c: Don't include ctype.h.
+	(IS_DIGIT): New macro.
+	(IS_ALPHA): Likewise.  Use IS_DIGIT and IS_ALPHA throughout
+	instead of isdigit and isalpanum.
+	(demangling_def): Make name and next const pointers.
+	(STATUS_ALLOCATION_FAILED): New status code.
+	(dyn_string_append_space): Handle failure in
+	dyn_string_append_char.
+	(int_to_dyn_string): Likewise.  Change return value to status_t.
+	(string_list_new): Handle failure of dyn_string_init.
+	(result_close_template_list): Change return type to status_t.
+	Handle failure in dyn_string_append.
+	(result_push): Change return value to status_t.  Handle failure in
+	string_list_new.  Handle failure of result_push throughout.
+	(substitution_add): Change return value to status_t.  Handle
+	dyn_string failures.  Handle failure of substitution_add
+	throughout.
+	(template_arg_list_new): Return NULL on allocation failure.
+	(result_append_string): Return STATUS_ALLOCATION_FAILED on error.
+	Handle error result throughout.
+	(result_append): Likewise.
+	(result_append_char): Likewise.
+	(result_append_space): Likewise.
+	(demangling_new): Make argument a const pointer.  Handle
+	allocation failures.
+	(demangle_template_args): Handle failure in template_arg_list_new
+	and result_close_template_list.
+	(demangle_discriminator): Return if int_to_dyn_string fails.
+	(cp_demangle): Likewise.
+	(cp_demangle_type): New function.
+	(cplus_demangle_new_abi): Don't call dyn_string_delete.  Abort on
+	memory allocation failure.
+	(main): Likewise.
+	* dyn-string.c (RETURN_ON_ALLOCATION_FAILURE): Define if
+	IN_LIBGCC2.
+	(dyn_string_init): Change return value to int.  Handle
+	RETURN_ON_ALLOCATION_FAILURE case.
+	(dyn_string_new): Handle RETURN_ON_ALLOCATION_FAILURE case.
+	(dyn_string_release): Delete the dyn_string.
+	(dyn_string_resize): Handle RETURN_ON_ALLOCATION_FAILURE case.
+	(dyn_string_copy): Change return type to int.
+	(dyn_string_copy_cstr): Likewise.
+	(dyn_string_prepend): Likewise.
+	(dyn_string_prepend_cstr): Likewise.
+	(dyn_string_insert): Likewise.
+	(dyn_string_insert_cstr): Likewise.
+	(dyn_string_append): Likewise.
+	(dyn_string_append_cstr): Likewise.
+	(dyn_string_append_char): Likewise.
+	(dyn_string_substring): Likewise.
+
+2000-06-09  Zack Weinberg  <zack@wolery.cumb.org>
+
+	* cp-demangle.c (demangle_operator_name): Add spaces before
+	names beginning with a letter: delete, delete[], new, new[],
+	sizeof.
+	(demangle_special_name): Handle TF <type> and TJ <type>.
+
+Thu Jun  8 18:52:24 2000  Philippe De Muyter  <phdm@macqel.be>
+
+	* cp-demangle.c (template_arg_list_new): Revert previous PARAMS patch.
+
+Thu Jun  8 09:25:54 2000  Philippe De Muyter  <phdm@macqel.be>
+
+	* cp-demangle.c (stdio.h): File included unconditionaly.
+	(template_arg_list_new): Parameter list is PARAMS ((void)), not ().
+	* dyn-string.c (stdio.h): File included.
+	* partition.c (partition_print): No `&' needed to take the address of
+	a function.
+
+2000-06-07  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* configure.in (ac_libiberty_warn_cflags): Add -pedantic.
+
+	* choose-temp.c (try, choose_temp_base, make_temp_file): Constify.
+
+	* cp-demangle.c (demangle_char): Change parameter from char to int.
+	(demangle_expression, demangle_expr_primary): Remove extra
+	semi-colon in prototype.
+
+	* dyn-string.c (dyn_string_append_char): Change parameter from
+	char to int.
+
+	* memcmp.c (memcmp): Constify.
+
+	* mkstemps.c (gcc_uint64_t): Mark GNUC `long long' case with
+	__extension__.
+
+	* partition.c (elem_compare): Prototype.  Don't cast away
+	const-ness.
+
+	* setenv.c (setenv): Use braces to avoid ambiguous `else'.
+
+2000-06-07  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* Makefile.in (cp-demangle.o): Depend on $(INCDIR)/demangle.h.
+
+	* cp-demangle.c: Include demangle.h.
+	(template_arg_list_new): DeANSIfy.
+	(cp_demangle): Make static and add prototype.
+	(operator_code, operators): Constify.
+	(demangle_operator_name): Likewise for variables `p1', `p2' and `p'.
+
+2000-06-05  Alex Samuel  <samuel@codesourcery.com>
+
+	* cp-demangle.c (demangle_prefix): Cast argument to isdigit to
+	unsigned char.
+	(demangle_unqualified_name): Likewise.
+	(demangle_number_literally): Likewise.
+	(demangle_type): Likewise.
+	(demangle_substitution): Likewise.
+	(is_mangled_char): Likewise, for isalnum.
+
+2000-06-04  Alex Samuel  <samuel@codesourcery.com>
+
+	* Makefile.in (CFILES): Add cp-demangle.c and dyn-string.c.
+	(REQUIRED_OFILES): Add cp-demangle.o and dyn-string.o.
+	(cp-demangle.o): New dependency.
+	(dyn-string.o): Likewise.
+
+	* dyn-string.c: Move here from gcc/dyn-string.c.  Add new functions.
+
+	* cplus-dem.c (libiberty_demanglers): Add initializer for new-ABI
+	demangler.
+	(cplus_demangle): Call cplus_demangle_new_abi if in new-ABI
+	demangling mode.
+	(gnu_new_abi_symbol_characters): New function.
+	(main): Use gnu_new_abi_symbol_characters.  * cp-demangle.c: New
+	file.
+	* cp-demangle.c: New file.
+
 Tue May 30 16:45:25 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* floatformat.c: Add name to each floatformat field.
@@ -8,7 +597,7 @@
 
 2000-05-29  Zack Weinberg  <zack@wolery.cumb.org>
 
-	* hashtab.c, partition.c, xmemdup.c: Include string.h
+	* hashtab.c, partition.c, sort.c, xmemdup.c: Include string.h
 	if HAVE_STRING_H.
 	* pexecute.c, xexit.c: Include stdlib.h if HAVE_STDLIB_H.
 	* objalloc.c: Include config.h.  Include stdlib.h and don't
@@ -18,22 +607,125 @@
 	HAVE_STRING_H, else declare memset without prototype.  Don't
 	include stddef.h.
 
-	* sort.c: Bring over from GCC.
+2000-05-23  Mike Stump  <mrs@wrs.com>
 
-2000-05-26  Alexandre Oliva  <aoliva@cygnus.com>
+	* Makefile.in (xmalloc.o): Add dependency for config.h, fixes make
+ 	-j3.
+
+2000-05-18  J. David Anglin  <dave@hiauly1.hia.nrc.ca>
+
+	* xmalloc.c: Include config.h for HAVE_SBRK definition.
+
+2000-05-16  Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
+
+	* hashtab.c (hash_pointer): Delete low-order bits which are
+	probably zero, also eliminate a warning on alpha.
+
+2000-05-15  David Edelsohn  <edelsohn@gnu.org>
+
+	* Makefile.in: Change "pic" to depend on $(PICFLAG), not
+	on $(enable_shared).
+
+2000-05-10  Jakub Jelinek  <jakub@redhat.com>
+
+	* config.table: Use mh-sparcpic for sparc*-*-*.
+
+2000-05-08  Nick Clifton  <nickc@cygnus.com>
+
+	* Makefile.in (CFILES): Add strncmp.c.
+	(NEEDED): Add strncmp.
+
+2000-05-04  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* cplus-dem.c (cplus_demangle_opname, demangle_function_name):
+	Cast the arguments to `islower' to `unsigned char'.
+	(print_demangler_list): Prototype.
+
+Thu May  4 17:14:41 2000  Philippe De Muyter  <phdm@macqel.be>
+
+	* sort.c (UCHAR_MAX): Provide fallback definition.
+
+2000-04-29  Alexandre Oliva  <aoliva@cygnus.com>
 
 	* Makefile.in (maintainer-clean-subdir): Fix handling of empty
 	SUBDIRS.
 
+2000-04-28  Kenneth Block  <block@zk3.dec.com>
+	    Jason Merrill  <jason@casey.cygnus.com>
+
+	* cplus-dem.c (libiberty_demanglers): New table for demangle styles.
+	(cplus_demangle_set_style): New function for setting style.
+	(cplus_demangle_name_to_style): New function to translate name.
+
+2000-04-27  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* aclocal.m4: New file with new test libiberty_AC_FUNC_STRNCMP.
+
+	* configure.in (AC_CHECK_HEADERS): Add sys/mman.h fcntl.h.
+	(libiberty_AC_FUNC_STRNCMP): Invoke.
+
+	* strncmp.c: New file.
+
+Thu Apr 27 16:58:43 MET DST 2000  Jan Hubicka  <jh@suse.cz>
+
+	* hashtab.c (htab_expand): Add prototype.
+	(find_empty_slot_for_expand): Likewise.
+
+2000-04-24  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* hashtab.c (hash_pointer, eq_pointer): Make definition static to
+	match prototype.
+	(htab_expand): Cast the return value of xcalloc.
+
+2000-04-24  Mark Mitchell  <mark@codesourcery.com>
+
+	* hashtab.c (hash_pointer): New function.
+	(eq_pointer): Likewise.
+	(htab_hash_pointer): New variable.
+	(htab_eq_pointer): Likewise.
+
+2000-04-23  Mark Mitchell  <mark@codesourcery.com>
+
+	* sort.c (sort_pointers): Fix endianness bugs.
+
+	* sort.c: New file.
+	* Makefile.in (CFILES): Add sort.c
+	(REQUIRED_OFILES): Add sort.o.
+	(sort.o): New target.
+
 2000-04-21  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
 
 	* Makefile.in (*-subdir): Revamp slightly to avoid losing on
 	4.3BSD systems.
 
+Tue Apr 18 16:23:31 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+	* hashtab.c: Various minor cleanups.
+	(htab_find_slot_with_hash): INSERT is now enum insert_option.
+	(htab_find_slot): Likewise.
+
+2000-04-16  Dave Pitts  <dpitts@cozx.com>
+
+	* cplus-dem.c (cplus_demangle_opname): Changed to use islower.
+
 2000-04-05  Richard Henderson  <rth@cygnus.com>
 
 	* splay-tree.c (splay_tree_remove): New.
 
+2000-03-30  Mark Mitchell  <mark@codesourcery.com>
+
+	* hashtab.c (find_empty_slot_for_expand): Use hashval_t for hash
+	codes.
+	(htab_find_with_hash): Likewise.
+	(htab_find_slot_with_hash): Likewise.
+
+2000-03-29  Zack Weinberg  <zack@wolery.cumb.org>
+
+	* hashtab.c (htab_find_with_hash): Avoid calculating hash2
+	unless it will be used.  Rearrange loop for better
+	optimization.
+	(higher_prime_number): Add static prototype.
+
 Thu Mar 16 01:33:58 2000  Jeffrey A Law  (law@cygnus.com)
 
 	* Makefile.in (partition.o): Depend on config.h
@@ -55,7 +747,7 @@
 	(REQUIRED_OFILES): Add partition.o.
 	(partition.o): New rule.
 	* partition.c: New file.
-	
+
 2000-03-09  Zack Weinberg  <zack@wolery.cumb.org>
 
 	* hashtab.c (htab_create): Set del_f.
@@ -3039,7 +3731,7 @@
 	* cplus-dem.c (string_prepends):  Used now, remove #if 0.
 	* cplus-dem.c (demangle_signature):  Call demangle_qualified
 	with prepending.
-	* cplus_dem.c (gnu_special):  Recognize static data members that
+	* cplus-dem.c (gnu_special):  Recognize static data members that
 	use qualified names.
 	* cplus-dem.c (demangle_qualified):  Accumulate qualifiers in a
 	temporary buffer and the prepend or append them to the result,
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index d7052ad..0eab5a6 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -1,6 +1,6 @@
 #
 # Makefile
-#   Copyright (C) 1990, 91 - 99, 2000
+#   Copyright (C) 1990, 91-99, 2000
 #   Free Software Foundation
 #
 # This file is part of the libiberty library.
@@ -108,8 +108,9 @@
 
 COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@
 .c.o:
-	test x"$(enable_shared)" != xyes || \
-	  $(COMPILE.c) $(PICFLAG) $< -o pic/$@
+	if [ x"$(PICFLAG)" != x ]; then \
+	  $(COMPILE.c) $(PICFLAG) $< -o pic/$@; \
+	else true; fi
 	$(COMPILE.c) $<
 
 info: info-subdir
@@ -124,26 +125,28 @@
 # (alphabetical), and add them to REQUIRED_OFILES or funcs in
 # configure.in.
 CFILES = asprintf.c alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c	      \
-	bzero.c calloc.c choose-temp.c clock.c concat.c cplus-dem.c fdmatch.c \
-	fnmatch.c getcwd.c getpwd.c getopt.c getopt1.c getpagesize.c	      \
-	getruntime.c floatformat.c hashtab.c hex.c index.c insque.c memchr.c  \
+	bzero.c calloc.c choose-temp.c clock.c concat.c cplus-dem.c	      \
+        cp-demangle.c dyn-string.c fdmatch.c fnmatch.c getcwd.c		      \
+	getpwd.c getopt.c getopt1.c getpagesize.c getruntime.c		      \
+	floatformat.c hashtab.c hex.c index.c insque.c md5.c memchr.c         \
 	memcmp.c memcpy.c memmove.c memset.c mkstemps.c objalloc.c obstack.c  \
-	partition.c pexecute.c putenv.c random.c rename.c rindex.c	      \
-	setenv.c sigsetmask.c spaces.c splay-tree.c strcasecmp.c	      \
-	strncasecmp.c strchr.c strdup.c strerror.c strrchr.c		      \
-	strsignal.c strstr.c strtod.c strtol.c strtoul.c tmpnam.c	      \
-	vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c waitpid.c	      \
-	xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c
+	partition.c pexecute.c putenv.c random.c rename.c rindex.c setenv.c   \
+	sigsetmask.c safe-ctype.c sort.c spaces.c splay-tree.c strcasecmp.c   \
+	strncasecmp.c strchr.c strdup.c strerror.c strncmp.c strrchr.c        \
+	strsignal.c strstr.c strtod.c strtol.c strtoul.c tmpnam.c vasprintf.c \
+	vfork.c vfprintf.c vprintf.c vsprintf.c waitpid.c xatexit.c xexit.c   \
+	xmalloc.c xmemdup.c xstrdup.c xstrerror.c
 
 # These are always included in the library.
-REQUIRED_OFILES = argv.o choose-temp.o concat.o cplus-dem.o \
-  fdmatch.o fnmatch.o getopt.o getopt1.o getpwd.o getruntime.o hashtab.o \
-  hex.o floatformat.o objalloc.o obstack.o partition.o pexecute.o spaces.o \
-  splay-tree.o strerror.o strsignal.o xatexit.o xexit.o xmalloc.o \
-  xmemdup.o xstrdup.o xstrerror.o
+REQUIRED_OFILES = argv.o choose-temp.o concat.o cplus-dem.o cp-demangle.o     \
+	dyn-string.o fdmatch.o fnmatch.o getopt.o getopt1.o getpwd.o          \
+	getruntime.o hashtab.o hex.o floatformat.o md5.o objalloc.o obstack.o \
+	partition.o pexecute.o safe-ctype.o sort.o spaces.o splay-tree.o      \
+	strerror.o strsignal.o xatexit.o xexit.o xmalloc.o xmemdup.o          \
+	xstrdup.o xstrerror.o
 
 $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA)
-	rm -f $(TARGETLIB)
+	-rm -f $(TARGETLIB)
 	$(AR) $(AR_FLAGS) $(TARGETLIB) \
 	  $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA)
 	$(RANLIB) $(TARGETLIB)
@@ -167,7 +170,7 @@
 # to include there.  Do not add anything LGPL to this list; libstdc++
 # can't use anything encumbering.
 NEEDED = atexit calloc memchr memcmp memcpy memmove memset rename strchr \
-	 strerror strrchr strstr strtol strtoul tmpnam vfprintf vprintf \
+	 strerror strncmp strrchr strstr strtol strtoul tmpnam vfprintf vprintf \
 	 vfork waitpid bcmp bcopy bzero
 needed-list: Makefile
 	rm -f needed-list; touch needed-list; \
@@ -185,7 +188,7 @@
 	echo $(REQUIRED_OFILES) > required-list
 
 stamp-picdir:
-	if [ x"$(enable_shared)" = xyes ] && [ ! -d pic ]; then \
+	if [ x"$(PICFLAG)" != x ] && [ ! -d pic ]; then \
 	  mkdir pic; \
 	else true; fi
 	touch stamp-picdir
@@ -211,19 +214,20 @@
 # Cleaning has to be done carefully to ensure that we don't clean our SUBDIRS
 # multiple times, hence our explicit recursion with an empty SUBDIRS.
 mostlyclean: mostlyclean-subdir
-	rm -rf *.o pic core errs \#* *.E a.out
-	rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-*
-	rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
+	-rm -rf *.o pic core errs \#* *.E a.out
+	-rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-*
+	-rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
 	@$(MULTICLEAN) multi-clean DO=mostlyclean
 clean: clean-subdir
 	$(MAKE) SUBDIRS="" mostlyclean
-	rm -f *.a required-list tmpmulti.out
+	-rm -f *.a required-list tmpmulti.out
 	@$(MULTICLEAN) multi-clean DO=clean
 distclean: distclean-subdir
 	$(MAKE) SUBDIRS="" clean
 	@$(MULTICLEAN) multi-clean DO=distclean
-	rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out
-	rm -f config.log
+	-rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out
+	-rm -f config.log
+	-rmdir testsuite 2>/dev/null
 maintainer-clean realclean: maintainer-clean-subdir
 	$(MAKE) SUBDIRS="" distclean
 
@@ -260,6 +264,8 @@
 clock.o: config.h
 concat.o: $(INCDIR)/libiberty.h
 cplus-dem.o: config.h $(INCDIR)/demangle.h
+cp-demangle.o: config.h $(INCDIR)/dyn-string.h $(INCDIR)/demangle.h
+dyn-string.o: config.h $(INCDIR)/dyn-string.h
 fdmatch.o: $(INCDIR)/libiberty.h
 fnmatch.o: config.h $(INCDIR)/fnmatch.h
 getcwd.o: config.h
@@ -271,19 +277,26 @@
 hex.o: $(INCDIR)/libiberty.h
 floatformat.o: $(INCDIR)/floatformat.h
 mkstemps.o: config.h
+md5.o: config.h
 objalloc.o: config.h $(INCDIR)/objalloc.h
 obstack.o: config.h $(INCDIR)/obstack.h
 partition.o: config.h $(INCDIR)/partition.h
 pexecute.o: config.h $(INCDIR)/libiberty.h
+rename.o: config.h
 setenv.o: config.h
+sort.o: config.h $(INCDIR)/sort.h $(INCDIR)/ansidecl.h
 spaces.o: $(INCDIR)/libiberty.h
 splay-tree.o: config.h $(INCDIR)/libiberty.h $(INCDIR)/splay-tree.h $(INCDIR)/ansidecl.h
 strerror.o: config.h $(INCDIR)/libiberty.h
 strsignal.o: config.h $(INCDIR)/libiberty.h
+strtol.o: config.h
+strtoul.o: config.h
+vasprintf.o: config.h
 xatexit.o: $(INCDIR)/libiberty.h
-xexit.o: $(INCDIR)/libiberty.h
-xmalloc.o: $(INCDIR)/libiberty.h
+xexit.o: config.h $(INCDIR)/libiberty.h
+xmalloc.o: config.h $(INCDIR)/libiberty.h
 xmemdup.o: config.h $(INCDIR)/libiberty.h
 xstrdup.o: config.h $(INCDIR)/libiberty.h
 xstrerror.o: config.h $(INCDIR)/libiberty.h
+waitpid.o: config.h
 hashtab.o: config.h $(INCDIR)/libiberty.h $(INCDIR)/hashtab.h $(INCDIR)/ansidecl.h
diff --git a/libiberty/acconfig.h b/libiberty/acconfig.h
deleted file mode 100644
index f7c599d..0000000
--- a/libiberty/acconfig.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Define if you have the sys_errlist variable.  */
-#undef HAVE_SYS_ERRLIST
-
-/* Define if you have the sys_nerr variable.  */
-#undef HAVE_SYS_NERR
-
-/* Define if you have the sys_siglist variable.  */
-#undef HAVE_SYS_SIGLIST
-
-/* Define if you have the strerror function.  */
-#undef HAVE_STRERROR
diff --git a/libiberty/aclocal.m4 b/libiberty/aclocal.m4
new file mode 100644
index 0000000..c562835
--- /dev/null
+++ b/libiberty/aclocal.m4
@@ -0,0 +1,136 @@
+dnl See whether strncmp reads past the end of its string parameters.
+dnl On some versions of SunOS4 at least, strncmp reads a word at a time
+dnl but erroneously reads past the end of strings.  This can cause
+dnl a SEGV in some cases.
+AC_DEFUN(libiberty_AC_FUNC_STRNCMP,
+[AC_REQUIRE([AC_FUNC_MMAP])
+AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works,
+[AC_TRY_RUN([
+/* Test by Jim Wilson and Kaveh Ghazi.
+   Check whether strncmp reads past the end of its string parameters. */
+#include <sys/types.h>
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
+#ifndef MAP_ANON
+#ifdef MAP_ANONYMOUS
+#define MAP_ANON MAP_ANONYMOUS
+#else
+#define MAP_ANON MAP_FILE
+#endif
+#endif
+
+#ifndef MAP_FILE
+#define MAP_FILE 0
+#endif
+#ifndef O_RDONLY
+#define O_RDONLY 0
+#endif
+
+#define MAP_LEN 0x10000
+
+main ()
+{
+#if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
+  char *p;
+  int dev_zero;
+
+  dev_zero = open ("/dev/zero", O_RDONLY);
+  if (dev_zero < 0)
+    exit (1);
+  
+  p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
+		     MAP_ANON|MAP_PRIVATE, dev_zero, 0);
+  if (p == (char *)-1)
+    exit (2);
+  else
+    {
+      char *string = "__si_type_info";
+      char *q = (char *) p + MAP_LEN - strlen (string) - 2;
+      char *r = (char *) p + 0xe;
+
+      strcpy (q, string);
+      strcpy (r, string);
+      strncmp (r, q, 14);
+    }
+#endif /* HAVE_MMAP || HAVE_MMAP_ANYWHERE */
+  exit (0);
+}
+], ac_cv_func_strncmp_works=yes, ac_cv_func_strncmp_works=no,
+  ac_cv_func_strncmp_works=no)
+rm -f core core.* *.core])
+if test $ac_cv_func_strncmp_works = no ; then
+  LIBOBJS="$LIBOBJS strncmp.o"
+fi
+])
+
+dnl See if errno must be declared even when <errno.h> is included.
+AC_DEFUN(libiberty_AC_DECLARE_ERRNO,
+[AC_CACHE_CHECK(whether errno must be declared, libiberty_cv_declare_errno,
+[AC_TRY_COMPILE(
+[#include <errno.h>],
+[int x = errno;],
+libiberty_cv_declare_errno=no,
+libiberty_cv_declare_errno=yes)])
+if test $libiberty_cv_declare_errno = yes
+then AC_DEFINE(NEED_DECLARATION_ERRNO, 1,
+  [Define if errno must be declared even when <errno.h> is included.])
+fi
+])
+
+# FIXME: We temporarily define our own version of AC_PROG_CC.  This is
+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
+# are probably using a cross compiler, which will not be able to fully
+# link an executable.  This should really be fixed in autoconf
+# itself.
+
+AC_DEFUN(LIB_AC_PROG_CC,
+[AC_BEFORE([$0], [AC_PROG_CPP])dnl
+AC_PROVIDE([AC_PROG_CC])
+AC_CHECK_PROG(CC, gcc, gcc)
+if test -z "$CC"; then
+  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
+  test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
+fi
+
+AC_PROG_CC_GNU
+
+if test $ac_cv_prog_gcc = yes; then
+  GCC=yes
+  ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic'
+dnl Check whether -g works, even if CFLAGS is set, in case the package
+dnl plays around with CFLAGS (such as to build both debugging and
+dnl normal versions of a library), tasteless as that idea is.
+  ac_test_CFLAGS="${CFLAGS+set}"
+  ac_save_CFLAGS="$CFLAGS"
+  CFLAGS=
+  AC_PROG_CC_G
+  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=
+  ac_libiberty_warn_cflags=
+  test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+AC_SUBST(ac_libiberty_warn_cflags)
+])
+
+# Work around a bug in autoheader.  This can go away when we switch to
+# autoconf >2.50.  The use of define instead of AC_DEFUN is
+# deliberate.
+define(AC_DEFINE_NOAUTOHEADER,
+[cat >> confdefs.h <<\EOF
+[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
+EOF
+])
diff --git a/libiberty/argv.c b/libiberty/argv.c
index f596ffd..7aec9c0 100644
--- a/libiberty/argv.c
+++ b/libiberty/argv.c
@@ -25,10 +25,7 @@
 #include "ansidecl.h"
 #include "libiberty.h"
 
-#ifdef isspace
-#undef isspace
-#endif
-#define isspace(ch) ((ch) == ' ' || (ch) == '\t')
+#define ISBLANK(ch) ((ch) == ' ' || (ch) == '\t')
 
 /*  Routines imported from standard C runtime libraries. */
 
@@ -227,7 +224,7 @@
       do
 	{
 	  /* Pick off argv[argc] */
-	  while (isspace (*input))
+	  while (ISBLANK (*input))
 	    {
 	      input++;
 	    }
@@ -260,7 +257,7 @@
 	  arg = copybuf;
 	  while (*input != EOS)
 	    {
-	      if (isspace (*input) && !squote && !dquote && !bsquote)
+	      if (ISBLANK (*input) && !squote && !dquote && !bsquote)
 		{
 		  break;
 		}
@@ -326,7 +323,7 @@
 	  argc++;
 	  argv[argc] = NULL;
 
-	  while (isspace (*input))
+	  while (ISBLANK (*input))
 	    {
 	      input++;
 	    }
diff --git a/libiberty/basename.c b/libiberty/basename.c
index 7698f06..ca089eb 100644
--- a/libiberty/basename.c
+++ b/libiberty/basename.c
@@ -20,7 +20,7 @@
 
 #include "ansidecl.h"
 #include "libiberty.h"
-#include <ctype.h>
+#include "safe-ctype.h"
 
 #ifndef DIR_SEPARATOR
 #define DIR_SEPARATOR '/'
@@ -50,7 +50,7 @@
 
 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
   /* Skip over the disk name in MSDOS pathnames. */
-  if (isalpha (name[0]) && name[1] == ':') 
+  if (ISALPHA (name[0]) && name[1] == ':') 
     name += 2;
 #endif
 
diff --git a/libiberty/bsearch.c b/libiberty/bsearch.c
new file mode 100644
index 0000000..6a8ee33
--- /dev/null
+++ b/libiberty/bsearch.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 1990 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. [rescinded 22 July 1999]
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ansidecl.h"
+#include <sys/types.h>		/* size_t */
+#include <stdio.h>
+
+/*
+ * Perform a binary search.
+ *
+ * The code below is a bit sneaky.  After a comparison fails, we
+ * divide the work in half by moving either left or right. If lim
+ * is odd, moving left simply involves halving lim: e.g., when lim
+ * is 5 we look at item 2, so we change lim to 2 so that we will
+ * look at items 0 & 1.  If lim is even, the same applies.  If lim
+ * is odd, moving right again involes halving lim, this time moving
+ * the base up one item past p: e.g., when lim is 5 we change base
+ * to item 3 and make lim 2 so that we will look at items 3 and 4.
+ * If lim is even, however, we have to shrink it by one before
+ * halving: e.g., when lim is 4, we still looked at item 2, so we
+ * have to make lim 3, then halve, obtaining 1, so that we will only
+ * look at item 3.
+ */
+void *
+bsearch(key, base0, nmemb, size, compar)
+	register void *key;
+	void *base0;
+	size_t nmemb;
+	register size_t size;
+	register int (*compar)();
+{
+	register char *base = base0;
+	register int lim, cmp;
+	register void *p;
+
+	for (lim = nmemb; lim != 0; lim >>= 1) {
+		p = base + (lim >> 1) * size;
+		cmp = (*compar)(key, p);
+		if (cmp == 0)
+			return (p);
+		if (cmp > 0) {	/* key > p: move right */
+			base = (char *)p + size;
+			lim--;
+		} /* else move left */
+	}
+	return (NULL);
+}
diff --git a/libiberty/choose-temp.c b/libiberty/choose-temp.c
index 826d818..1a475dd 100644
--- a/libiberty/choose-temp.c
+++ b/libiberty/choose-temp.c
@@ -79,9 +79,11 @@
    If success, DIR is returned.
    Otherwise NULL is returned.  */
 
-static char *
+static const char *try PARAMS ((const char *, const char *));
+
+static const char *
 try (dir, base)
-     char *dir, *base;
+     const char *dir, *base;
 {
   if (base != 0)
     return base;
@@ -102,7 +104,7 @@
 char *
 choose_temp_base ()
 {
-  char *base = 0;
+  const char *base = 0;
   char *temp_filename;
   int len;
   static char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
@@ -147,7 +149,7 @@
 make_temp_file (suffix)
      const char *suffix;
 {
-  char *base = 0;
+  const char *base = 0;
   char *temp_filename;
   int base_len, suffix_len;
   int fd;
diff --git a/libiberty/config.in b/libiberty/config.in
index 6e64208..1fb946a 100644
--- a/libiberty/config.in
+++ b/libiberty/config.in
@@ -3,6 +3,9 @@
 /* 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
@@ -13,12 +16,18 @@
 /* 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 if you have <sys/wait.h> that is POSIX.1 compatible.  */
 #undef HAVE_SYS_WAIT_H
 
 /* Define if you have <vfork.h>.  */
 #undef HAVE_VFORK_H
 
+/* Define as __inline if that's what the C compiler calls it.  */
+#undef inline
+
 /* Define to `int' if <sys/types.h> doesn't define.  */
 #undef pid_t
 
@@ -37,21 +46,12 @@
 /* Define if you have the ANSI C header files.  */
 #undef STDC_HEADERS
 
+/* Define if you can safely include both <sys/time.h> and <time.h>.  */
+#undef TIME_WITH_SYS_TIME
+
 /* Define vfork as fork if vfork does not work.  */
 #undef vfork
 
-/* Define if you have the sys_errlist variable.  */
-#undef HAVE_SYS_ERRLIST
-
-/* Define if you have the sys_nerr variable.  */
-#undef HAVE_SYS_NERR
-
-/* Define if you have the sys_siglist variable.  */
-#undef HAVE_SYS_SIGLIST
-
-/* Define if you have the strerror function.  */
-#undef HAVE_STRERROR
-
 /* Define if you have the asprintf function.  */
 #undef HAVE_ASPRINTF
 
@@ -67,6 +67,9 @@
 /* Define if you have the bcopy function.  */
 #undef HAVE_BCOPY
 
+/* Define if you have the bsearch function.  */
+#undef HAVE_BSEARCH
+
 /* Define if you have the bzero function.  */
 #undef HAVE_BZERO
 
@@ -196,6 +199,12 @@
 /* Define if you have the waitpid function.  */
 #undef HAVE_WAITPID
 
+/* Define if you have the <fcntl.h> header file.  */
+#undef HAVE_FCNTL_H
+
+/* Define if you have the <limits.h> header file.  */
+#undef HAVE_LIMITS_H
+
 /* Define if you have the <stdlib.h> header file.  */
 #undef HAVE_STDLIB_H
 
@@ -208,6 +217,9 @@
 /* Define if you have the <sys/file.h> header file.  */
 #undef HAVE_SYS_FILE_H
 
+/* Define if you have the <sys/mman.h> header file.  */
+#undef HAVE_SYS_MMAN_H
+
 /* Define if you have the <sys/param.h> header file.  */
 #undef HAVE_SYS_PARAM_H
 
@@ -220,5 +232,21 @@
 /* Define if you have the <sys/time.h> header file.  */
 #undef HAVE_SYS_TIME_H
 
+/* Define if you have the <time.h> header file.  */
+#undef HAVE_TIME_H
+
 /* Define if you have the <unistd.h> header file.  */
 #undef HAVE_UNISTD_H
+
+/* Define if errno must be declared even when <errno.h> is included. */
+#undef NEED_DECLARATION_ERRNO
+
+/* Define if you have the sys_errlist variable. */
+#undef HAVE_SYS_ERRLIST
+
+/* Define if you have the sys_nerr variable. */
+#undef HAVE_SYS_NERR
+
+/* Define if you have the sys_siglist variable. */
+#undef HAVE_SYS_SIGLIST
+
diff --git a/libiberty/config.table b/libiberty/config.table
index 4e33746..ea3312b 100644
--- a/libiberty/config.table
+++ b/libiberty/config.table
@@ -27,6 +27,7 @@
     i[3456]86-*-*)	frags="${frags} ../../config/mh-x86pic" ;;
     powerpc*-*-aix*)	;;
     powerpc*-*-*)	frags="${frags} ../../config/mh-ppcpic" ;;
+    sparc*-*-*)		frags="${frags} ../../config/mh-sparcpic" ;;
     *-*-*)		frags="${frags} ../../config/mh-${host_cpu}pic" ;;
   esac
 fi
diff --git a/libiberty/config/mh-openedition b/libiberty/config/mh-openedition
index 6e8e354..8de8ed1 100644
--- a/libiberty/config/mh-openedition
+++ b/libiberty/config/mh-openedition
@@ -1,3 +1,3 @@
-HDEFINES = -D_ALL_SOURCE
+HDEFINES = -D_ALL_SOURCE -DLE370
 CC=c89
 
diff --git a/libiberty/configure b/libiberty/configure
index 02c826d..ca24ef9 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -733,20 +733,11 @@
 fi
 
 
-# FIXME: We temporarily define our own version of AC_PROG_CC.  This is
-# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
-# are probably using a cross compiler, which will not be able to fully
-# link an executable.  This should really be fixed in autoconf
-# itself.
-
-
-
-
 
 # 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:750: checking for $ac_word" >&5
+echo "configure:741: 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
@@ -776,7 +767,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:780: checking for $ac_word" >&5
+echo "configure:771: 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
@@ -825,7 +816,7 @@
 fi
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:829: checking whether we are using GNU C" >&5
+echo "configure:820: 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
@@ -834,7 +825,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:838: \"$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:829: \"$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
@@ -845,12 +836,12 @@
 
 if test $ac_cv_prog_gcc = yes; then
   GCC=yes
-  ac_libiberty_warn_cflags='-W -Wall -Wtraditional'
+  ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic'
   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:854: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:845: 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
@@ -879,8 +870,9 @@
 fi
 
 
+
 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:884: checking for POSIXized ISC" >&5
+echo "configure:876: 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
@@ -900,6 +892,121 @@
   ISC=
 fi
 
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:897: 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 902 "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:951: \"$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:972: 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 979 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:986: \"$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
+
 
 
 
@@ -918,7 +1025,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:922: checking for a BSD compatible install" >&5
+echo "configure:1029: 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
@@ -979,7 +1086,7 @@
 # able to link anything, it had better be able to at least compile
 # something.
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:983: checking how to run the C preprocessor" >&5
+echo "configure:1090: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -994,13 +1101,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 998 "configure"
+#line 1105 "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:1004: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1111: \"$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
   :
@@ -1011,13 +1118,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1015 "configure"
+#line 1122 "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:1021: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1128: \"$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
   :
@@ -1028,13 +1135,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 1032 "configure"
+#line 1139 "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:1038: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1145: \"$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
   :
@@ -1058,21 +1165,21 @@
 fi
 echo "$ac_t""$CPP" 1>&6
 
-for ac_hdr in sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h sys/resource.h sys/stat.h
+for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1066: checking for $ac_hdr" >&5
+echo "configure:1173: 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 1071 "configure"
+#line 1178 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1076: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1183: \"$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*
@@ -1099,12 +1206,12 @@
 done
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:1103: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:1210: checking for sys/wait.h that is POSIX.1 compatible" >&5
 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1108 "configure"
+#line 1215 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -1120,7 +1227,7 @@
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:1124: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1231: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -1140,6 +1247,75 @@
 
 fi
 
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:1252: checking whether time.h and sys/time.h may both be included" >&5
+if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1257 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+int main() {
+struct tm *tp;
+; return 0; }
+EOF
+if { (eval echo configure:1266: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_header_time=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_time=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_time" 1>&6
+if test $ac_cv_header_time = yes; then
+  cat >> confdefs.h <<\EOF
+#define TIME_WITH_SYS_TIME 1
+EOF
+
+fi
+
+
+echo $ac_n "checking whether errno must be declared""... $ac_c" 1>&6
+echo "configure:1288: checking whether errno must be declared" >&5
+if eval "test \"`echo '$''{'libiberty_cv_declare_errno'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1293 "configure"
+#include "confdefs.h"
+#include <errno.h>
+int main() {
+int x = errno;
+; return 0; }
+EOF
+if { (eval echo configure:1300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  libiberty_cv_declare_errno=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  libiberty_cv_declare_errno=yes
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$libiberty_cv_declare_errno" 1>&6
+if test $libiberty_cv_declare_errno = yes
+then cat >> confdefs.h <<\EOF
+#define NEED_DECLARATION_ERRNO 1
+EOF
+
+fi
+
 
 # This is the list of functions which libiberty will provide if they
 # are not available on the host.
@@ -1149,6 +1325,7 @@
 funcs="$funcs basename"
 funcs="$funcs bcmp"
 funcs="$funcs bcopy"
+funcs="$funcs bsearch"
 funcs="$funcs bzero"
 funcs="$funcs calloc"
 funcs="$funcs clock"
@@ -1193,15 +1370,15 @@
 # These are neither executed nor required, but they help keep
 # autoheader happy without adding a bunch of text to acconfig.h.
 if test "x" = "y"; then
-  for ac_func in asprintf atexit basename bcmp bcopy bzero calloc clock getcwd
+  for ac_func in asprintf atexit basename bcmp bcopy bsearch bzero calloc clock
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1200: checking for $ac_func" >&5
+echo "configure:1377: 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 1205 "configure"
+#line 1382 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1224,7 +1401,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1405: \"$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
@@ -1248,15 +1425,15 @@
 fi
 done
 
-  for ac_func in getpagesize index insque mkstemps memchr memcmp memcpy memmove
+  for ac_func in getcwd getpagesize index insque mkstemps memchr memcmp memcpy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1255: checking for $ac_func" >&5
+echo "configure:1432: 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 1260 "configure"
+#line 1437 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1279,7 +1456,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1460: \"$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
@@ -1303,184 +1480,7 @@
 fi
 done
 
-  for ac_func in memset putenv random rename rindex sigsetmask strcasecmp
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1310: 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 1315 "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:1338: \"$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 setenv strchr strdup strncasecmp strrchr strstr strtod strtol
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1365: 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 1370 "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:1393: \"$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 strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1420: 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 1425 "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:1448: \"$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
-
-  cat >> confdefs.h <<\EOF
-#define HAVE_SYS_ERRLIST 1
-EOF
-
-  cat >> confdefs.h <<\EOF
-#define HAVE_SYS_NERR 1
-EOF
-
-  cat >> confdefs.h <<\EOF
-#define HAVE_SYS_SIGLIST 1
-EOF
-
-  for ac_func in getrusage on_exit psignal strerror strsignal sysconf times
+  for ac_func in memmove memset putenv random rename rindex sigsetmask
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
 echo "configure:1487: checking for $ac_func" >&5
@@ -1535,7 +1535,7 @@
 fi
 done
 
-  for ac_func in sbrk gettimeofday
+  for ac_func in strcasecmp setenv strchr strdup strncasecmp strrchr strstr
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
 echo "configure:1542: checking for $ac_func" >&5
@@ -1590,6 +1590,183 @@
 fi
 done
 
+  for ac_func in strtod strtol strtoul tmpnam vasprintf vfprintf vprintf
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1597: 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 1602 "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:1625: \"$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 vsprintf waitpid getrusage on_exit psignal strerror strsignal
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1652: 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 1657 "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:1680: \"$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 sysconf times sbrk gettimeofday
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1707: 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 1712 "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:1735: \"$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
+
+  cat >> confdefs.h <<\EOF
+#define HAVE_SYS_ERRLIST 1
+EOF
+
+  cat >> confdefs.h <<\EOF
+#define HAVE_SYS_NERR 1
+EOF
+
+  cat >> confdefs.h <<\EOF
+#define HAVE_SYS_SIGLIST 1
+EOF
+
 fi
 
 # For each of these functions, if the host does not provide the
@@ -1705,24 +1882,22 @@
     # provides from our shell variables, so that they appear to be
     # missing.
 
-    funcs="`echo $funcs | sed -e 's/random//'`"
-    LIBOBJS="$LIBOBJS random.o"
-    vars="`echo $vars | sed -e 's/sys_siglist//'`"
-    checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
+    # DJ - only if we're *building* cygwin, not just building *with* cygwin
+  
+    if test -n "${with_target_subdir}"
+    then
+      funcs="`echo $funcs | sed -e 's/random//'`"
+      LIBOBJS="$LIBOBJS random.o"
+      vars="`echo $vars | sed -e 's/sys_siglist//'`"
+      checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
+    fi
     ;;
 
   *-*-mingw32*)
     # Under mingw32, sys_nerr and sys_errlist exist, but they are
     # macros, so the test below won't find them.
-    vars="`echo $vars | sed -e 's/sys_nerr//' -e 's/sys_errlist//'`"
-    cat >> confdefs.h <<\EOF
-#define HAVE_SYS_NERR 1
-EOF
-
-    cat >> confdefs.h <<\EOF
-#define HAVE_SYS_ERRLIST 1
-EOF
-
+    libiberty_cv_var_sys_nerr=yes
+    libiberty_cv_var_sys_errlist=yes
     ;;
 
   *-*-uwin*)
@@ -1733,14 +1908,8 @@
     # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are
     # macros (actually, these are imported from a DLL, but the end effect 
     # is the same), so the test below won't find them.
-    cat >> confdefs.h <<\EOF
-#define HAVE_SYS_NERR 1
-EOF
-
-    cat >> confdefs.h <<\EOF
-#define HAVE_SYS_ERRLIST 1
-EOF
-
+    libiberty_cv_var_sys_nerr=yes
+    libiberty_cv_var_sys_errlist=yes
     ;;
 
   esac
@@ -1748,7 +1917,7 @@
   # We haven't set the list of objects yet.  Use the standard autoconf
   # tests.  This will only work if the compiler works.
   echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1752: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1921: 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.
@@ -1759,12 +1928,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 1763 "configure"
+#line 1932 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1937: \"$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
@@ -1790,19 +1959,19 @@
   { 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:1794: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1963: 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
 
   for ac_func in $funcs
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1801: checking for $ac_func" >&5
+echo "configure:1970: 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 1806 "configure"
+#line 1975 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1825,7 +1994,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1998: \"$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
@@ -1872,19 +2041,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:1876: checking for working alloca.h" >&5
+echo "configure:2045: 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 1881 "configure"
+#line 2050 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:1888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2057: \"$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
@@ -1905,12 +2074,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:1909: checking for alloca" >&5
+echo "configure:2078: 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 1914 "configure"
+#line 2083 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -1938,7 +2107,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:1942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2111: \"$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
@@ -1970,12 +2139,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:1974: checking whether alloca needs Cray hooks" >&5
+echo "configure:2143: 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 1979 "configure"
+#line 2148 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -2000,12 +2169,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:2004: checking for $ac_func" >&5
+echo "configure:2173: 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 2009 "configure"
+#line 2178 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2028,7 +2197,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2201: \"$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
@@ -2055,7 +2224,7 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2059: checking stack direction for C alloca" >&5
+echo "configure:2228: 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
@@ -2063,7 +2232,7 @@
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 2067 "configure"
+#line 2236 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -2082,7 +2251,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:2086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2255: \"$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
@@ -2107,12 +2276,12 @@
   esac
 
   echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2111: checking for ANSI C header files" >&5
+echo "configure:2280: 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 2116 "configure"
+#line 2285 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2120,7 +2289,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2124: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2293: \"$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*
@@ -2137,7 +2306,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 2141 "configure"
+#line 2310 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2155,7 +2324,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 2159 "configure"
+#line 2328 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -2176,7 +2345,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 2180 "configure"
+#line 2349 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2187,7 +2356,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:2191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2211,12 +2380,12 @@
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:2215: checking for pid_t" >&5
+echo "configure:2384: 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 2220 "configure"
+#line 2389 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2245,17 +2414,17 @@
 
 ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:2249: checking for vfork.h" >&5
+echo "configure:2418: 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 2254 "configure"
+#line 2423 "configure"
 #include "confdefs.h"
 #include <vfork.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2259: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2428: \"$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*
@@ -2280,18 +2449,18 @@
 fi
 
 echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:2284: checking for working vfork" >&5
+echo "configure:2453: 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:2290: checking for vfork" >&5
+echo "configure:2459: 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 2295 "configure"
+#line 2464 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vfork(); below.  */
@@ -2314,7 +2483,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2487: \"$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
@@ -2336,7 +2505,7 @@
 ac_cv_func_vfork_works=$ac_cv_func_vfork
 else
   cat > conftest.$ac_ext <<EOF
-#line 2340 "configure"
+#line 2509 "configure"
 #include "confdefs.h"
 /* Thanks to Paul Eggert for this test.  */
 #include <stdio.h>
@@ -2431,7 +2600,7 @@
   }
 }
 EOF
-if { (eval echo configure:2435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2604: \"$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
@@ -2458,19 +2627,19 @@
   fi
   for v in $vars; do
     echo $ac_n "checking for $v""... $ac_c" 1>&6
-echo "configure:2462: checking for $v" >&5
+echo "configure:2631: checking for $v" >&5
     if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2467 "configure"
+#line 2636 "configure"
 #include "confdefs.h"
 int *p;
 int main() {
 extern int $v; p = &$v;
 ; return 0; }
 EOF
-if { (eval echo configure:2474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "libiberty_cv_var_$v=yes"
 else
@@ -2496,12 +2665,12 @@
   for ac_func in $checkfuncs
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2500: checking for $ac_func" >&5
+echo "configure:2669: 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 2505 "configure"
+#line 2674 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2524,7 +2693,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2697: \"$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
@@ -2550,6 +2719,364 @@
 
 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:2727: 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 2732 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2737: \"$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:2766: 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 2771 "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:2794: \"$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:2819: 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 2827 "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:2967: \"$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
+
+
+echo $ac_n "checking for working strncmp""... $ac_c" 1>&6
+echo "configure:2991: checking for working strncmp" >&5
+if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_strncmp_works=no
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2999 "configure"
+#include "confdefs.h"
+
+/* Test by Jim Wilson and Kaveh Ghazi.
+   Check whether strncmp reads past the end of its string parameters. */
+#include <sys/types.h>
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
+#ifndef MAP_ANON
+#ifdef MAP_ANONYMOUS
+#define MAP_ANON MAP_ANONYMOUS
+#else
+#define MAP_ANON MAP_FILE
+#endif
+#endif
+
+#ifndef MAP_FILE
+#define MAP_FILE 0
+#endif
+#ifndef O_RDONLY
+#define O_RDONLY 0
+#endif
+
+#define MAP_LEN 0x10000
+
+main ()
+{
+#if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
+  char *p;
+  int dev_zero;
+
+  dev_zero = open ("/dev/zero", O_RDONLY);
+  if (dev_zero < 0)
+    exit (1);
+  
+  p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE,
+		     MAP_ANON|MAP_PRIVATE, dev_zero, 0);
+  if (p == (char *)-1)
+    exit (2);
+  else
+    {
+      char *string = "__si_type_info";
+      char *q = (char *) p + MAP_LEN - strlen (string) - 2;
+      char *r = (char *) p + 0xe;
+
+      strcpy (q, string);
+      strcpy (r, string);
+      strncmp (r, q, 14);
+    }
+#endif /* HAVE_MMAP || HAVE_MMAP_ANYWHERE */
+  exit (0);
+}
+
+EOF
+if { (eval echo configure:3060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_func_strncmp_works=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_func_strncmp_works=no
+fi
+rm -fr conftest*
+fi
+
+rm -f core core.* *.core
+fi
+
+echo "$ac_t""$ac_cv_func_strncmp_works" 1>&6
+if test $ac_cv_func_strncmp_works = no ; then
+  LIBOBJS="$LIBOBJS strncmp.o"
+fi
+
+
 # Install a library built with a cross compiler in $(tooldir) rather
 # than $(libdir).
 if test -z "${with_cross_host}"; then
@@ -2705,8 +3232,8 @@
 s%@build_os@%$build_os%g
 s%@AR@%$AR%g
 s%@RANLIB@%$RANLIB%g
-s%@ac_libiberty_warn_cflags@%$ac_libiberty_warn_cflags%g
 s%@CC@%$CC%g
+s%@ac_libiberty_warn_cflags@%$ac_libiberty_warn_cflags%g
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
 s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
diff --git a/libiberty/configure.in b/libiberty/configure.in
index cc1b2c2..af80e0d 100644
--- a/libiberty/configure.in
+++ b/libiberty/configure.in
@@ -36,51 +36,11 @@
 AC_CHECK_TOOL(AR, ar)
 AC_CHECK_TOOL(RANLIB, ranlib, :)
 
-# FIXME: We temporarily define our own version of AC_PROG_CC.  This is
-# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
-# are probably using a cross compiler, which will not be able to fully
-# link an executable.  This should really be fixed in autoconf
-# itself.
-
-AC_DEFUN(LIB_AC_PROG_CC,
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_PROVIDE([AC_PROG_CC])
-AC_CHECK_PROG(CC, gcc, gcc)
-if test -z "$CC"; then
-  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
-  test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-AC_PROG_CC_GNU
-
-if test $ac_cv_prog_gcc = yes; then
-  GCC=yes
-  ac_libiberty_warn_cflags='-W -Wall -Wtraditional'
-dnl Check whether -g works, even if CFLAGS is set, in case the package
-dnl plays around with CFLAGS (such as to build both debugging and
-dnl normal versions of a library), tasteless as that idea is.
-  ac_test_CFLAGS="${CFLAGS+set}"
-  ac_save_CFLAGS="$CFLAGS"
-  CFLAGS=
-  AC_PROG_CC_G
-  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=
-  ac_libiberty_warn_cflags=
-  test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-])
-AC_SUBST(ac_libiberty_warn_cflags)
-
 LIB_AC_PROG_CC
 
 AC_ISC_POSIX
+AC_C_CONST
+AC_C_INLINE
 
 dnl When we start using libtool:
 dnl Default to a non shared library.  This may be overridden by the
@@ -109,8 +69,11 @@
 # It's OK to check for header files.  Although the compiler may not be
 # able to link anything, it had better be able to at least compile
 # something.
-AC_CHECK_HEADERS(sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h sys/resource.h sys/stat.h)
+AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h)
 AC_HEADER_SYS_WAIT
+AC_HEADER_TIME
+
+libiberty_AC_DECLARE_ERRNO
 
 # This is the list of functions which libiberty will provide if they
 # are not available on the host.
@@ -120,6 +83,7 @@
 funcs="$funcs basename"
 funcs="$funcs bcmp"
 funcs="$funcs bcopy"
+funcs="$funcs bsearch"
 funcs="$funcs bzero"
 funcs="$funcs calloc"
 funcs="$funcs clock"
@@ -164,16 +128,16 @@
 # These are neither executed nor required, but they help keep
 # autoheader happy without adding a bunch of text to acconfig.h.
 if test "x" = "y"; then
-  AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bzero calloc clock getcwd)
-  AC_CHECK_FUNCS(getpagesize index insque mkstemps memchr memcmp memcpy memmove)
-  AC_CHECK_FUNCS(memset putenv random rename rindex sigsetmask strcasecmp)
-  AC_CHECK_FUNCS(setenv strchr strdup strncasecmp strrchr strstr strtod strtol)
-  AC_CHECK_FUNCS(strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid)
-  AC_DEFINE(HAVE_SYS_ERRLIST)
-  AC_DEFINE(HAVE_SYS_NERR)
-  AC_DEFINE(HAVE_SYS_SIGLIST)
-  AC_CHECK_FUNCS(getrusage on_exit psignal strerror strsignal sysconf times)
-  AC_CHECK_FUNCS(sbrk gettimeofday)
+  AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc clock)
+  AC_CHECK_FUNCS(getcwd getpagesize index insque mkstemps memchr memcmp memcpy)
+  AC_CHECK_FUNCS(memmove memset putenv random rename rindex sigsetmask)
+  AC_CHECK_FUNCS(strcasecmp setenv strchr strdup strncasecmp strrchr strstr)
+  AC_CHECK_FUNCS(strtod strtol strtoul tmpnam vasprintf vfprintf vprintf)
+  AC_CHECK_FUNCS(vsprintf waitpid getrusage on_exit psignal strerror strsignal)
+  AC_CHECK_FUNCS(sysconf times sbrk gettimeofday)
+  AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
+  AC_DEFINE(HAVE_SYS_NERR,    1, [Define if you have the sys_nerr variable.])
+  AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
 fi
 
 # For each of these functions, if the host does not provide the
@@ -212,7 +176,7 @@
     # dont have to check them here.
 
     # Of the functions in $checkfuncs, newlib only has strerror.
-    AC_DEFINE(HAVE_STRERROR)
+    AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
 
     setobjs=yes
 
@@ -253,7 +217,7 @@
     # don't have to check them here.
 
     # Of the functions in $checkfuncs, VxWorks only has strerror.
-    AC_DEFINE(HAVE_STRERROR)
+    AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
 
     setobjs=yes
     ;;
@@ -277,18 +241,22 @@
     # provides from our shell variables, so that they appear to be
     # missing.
 
-    funcs="`echo $funcs | sed -e 's/random//'`"
-    LIBOBJS="$LIBOBJS random.o"
-    vars="`echo $vars | sed -e 's/sys_siglist//'`"
-    checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
+    # DJ - only if we're *building* cygwin, not just building *with* cygwin
+  
+    if test -n "${with_target_subdir}"
+    then
+      funcs="`echo $funcs | sed -e 's/random//'`"
+      LIBOBJS="$LIBOBJS random.o"
+      vars="`echo $vars | sed -e 's/sys_siglist//'`"
+      checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
+    fi
     ;;
 
   *-*-mingw32*)
     # Under mingw32, sys_nerr and sys_errlist exist, but they are
     # macros, so the test below won't find them.
-    vars="`echo $vars | sed -e 's/sys_nerr//' -e 's/sys_errlist//'`"
-    AC_DEFINE(HAVE_SYS_NERR)
-    AC_DEFINE(HAVE_SYS_ERRLIST)
+    libiberty_cv_var_sys_nerr=yes
+    libiberty_cv_var_sys_errlist=yes
     ;;
 
   *-*-uwin*)
@@ -299,8 +267,8 @@
     # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are
     # macros (actually, these are imported from a DLL, but the end effect 
     # is the same), so the test below won't find them.
-    AC_DEFINE(HAVE_SYS_NERR)
-    AC_DEFINE(HAVE_SYS_ERRLIST)
+    libiberty_cv_var_sys_nerr=yes
+    libiberty_cv_var_sys_errlist=yes
     ;;
 
   esac
@@ -352,6 +320,8 @@
   AC_CHECK_FUNCS($checkfuncs)
 fi
 
+libiberty_AC_FUNC_STRNCMP
+
 # Install a library built with a cross compiler in $(tooldir) rather
 # than $(libdir).
 if test -z "${with_cross_host}"; then
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
new file mode 100644
index 0000000..1cc4847
--- /dev/null
+++ b/libiberty/cp-demangle.c
@@ -0,0 +1,3834 @@
+/* Demangler for IA64 / g++ V3 ABI.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Written by Alex Samuel <samuel@codesourcery.com>. 
+
+   This file is part of GNU CC.
+
+   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 implements demangling of C++ names mangled according to
+   the IA64 / g++ V3 ABI.  Use the cp_demangle function to
+   demangle a mangled name, or compile with the preprocessor macro
+   STANDALONE_DEMANGLER defined to create a demangling filter
+   executable (functionally similar to c++filt, but includes this
+   demangler only).  */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/types.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "ansidecl.h"
+#include "libiberty.h"
+#include "dyn-string.h"
+#include "demangle.h"
+
+/* If CP_DEMANGLE_DEBUG is defined, a trace of the grammar evaluation,
+   and other debugging output, will be generated. */
+#ifdef CP_DEMANGLE_DEBUG
+#define DEMANGLE_TRACE(PRODUCTION, DM)                                  \
+  fprintf (stderr, " -> %-24s at position %3d\n",                       \
+           (PRODUCTION), current_position (DM));
+#else
+#define DEMANGLE_TRACE(PRODUCTION, DM)
+#endif
+
+/* Don't include <ctype.h>, to prevent additional unresolved symbols
+   from being dragged into the C++ runtime library.  */
+#define IS_DIGIT(CHAR) ((CHAR) >= '0' && (CHAR) <= '9')
+#define IS_ALPHA(CHAR)                                                  \
+  (((CHAR) >= 'a' && (CHAR) <= 'z')                                     \
+   || ((CHAR) >= 'A' && (CHAR) <= 'Z'))
+
+/* The prefix prepended by GCC to an identifier represnting the
+   anonymous namespace.  */
+#define ANONYMOUS_NAMESPACE_PREFIX "_GLOBAL_"
+
+/* If flag_verbose is zero, some simplifications will be made to the
+   output to make it easier to read and supress details that are
+   generally not of interest to the average C++ programmer.
+   Otherwise, the demangled representation will attempt to convey as
+   much information as the mangled form.  */
+static int flag_verbose;
+
+/* If flag_strict is non-zero, demangle strictly according to the
+   specification -- don't demangle special g++ manglings.  */
+static int flag_strict;
+
+/* String_list_t is an extended form of dyn_string_t which provides a
+   link field and a caret position for additions to the string.  A
+   string_list_t may safely be cast to and used as a dyn_string_t.  */
+
+struct string_list_def
+{
+  /* The dyn_string; must be first.  */
+  struct dyn_string string;
+
+  /* The position at which additional text is added to this string
+     (using the result_add* macros).  This value is an offset from the
+     end of the string, not the beginning (and should be
+     non-positive).  */
+  int caret_position;
+
+  /* The next string in the list.  */
+  struct string_list_def *next;
+};
+
+typedef struct string_list_def *string_list_t;
+
+/* Data structure representing a potential substitution.  */
+
+struct substitution_def
+{
+  /* The demangled text of the substitution.  */
+  dyn_string_t text;
+
+  /* Whether this substitution represents a template item.  */
+  int template_p : 1;
+};
+
+/* Data structure representing a template argument list.  */
+
+struct template_arg_list_def
+{
+  /* The next (lower) template argument list in the stack of currently
+     active template arguments.  */
+  struct template_arg_list_def *next;
+
+  /* The first element in the list of template arguments in
+     left-to-right order.  */
+  string_list_t first_argument;
+
+  /* The last element in the arguments lists.  */
+  string_list_t last_argument;
+};
+
+typedef struct template_arg_list_def *template_arg_list_t;
+
+/* Data structure to maintain the state of the current demangling.  */
+
+struct demangling_def
+{
+  /* The full mangled name being mangled.  */
+  const char *name;
+
+  /* Pointer into name at the current position.  */
+  const char *next;
+
+  /* Stack for strings containing demangled result generated so far.
+     Text is emitted to the topmost (first) string.  */
+  string_list_t result;
+
+  /* The number of presently available substitutions.  */
+  int num_substitutions;
+
+  /* The allocated size of the substitutions array.  */
+  int substitutions_allocated;
+
+  /* An array of available substitutions.  The number of elements in
+     the array is given by num_substitions, and the allocated array
+     size in substitutions_size.  
+
+     The most recent substition is at the end, so
+
+       - `S_'  corresponds to substititutions[num_substitutions - 1] 
+       - `S0_' corresponds to substititutions[num_substitutions - 2]
+
+     etc. */
+  struct substitution_def *substitutions;
+
+  /* The stack of template argument lists.  */
+  template_arg_list_t template_arg_lists;
+
+  /* The most recently demangled source-name.  */
+  dyn_string_t last_source_name;
+};
+
+typedef struct demangling_def *demangling_t;
+
+/* This type is the standard return code from most functions.  Values
+   other than STATUS_OK contain descriptive messages.  */
+typedef const char *status_t;
+
+/* Special values that can be used as a status_t.  */
+#define STATUS_OK                       NULL
+#define STATUS_ERROR                    "Error."
+#define STATUS_UNIMPLEMENTED            "Unimplemented."
+#define STATUS_INTERNAL_ERROR           "Internal error."
+
+/* This status code indicates a failure in malloc or realloc.  */
+static const char *const status_allocation_failed = "Allocation failed.";
+#define STATUS_ALLOCATION_FAILED        status_allocation_failed
+
+/* Non-zero if STATUS indicates that no error has occurred.  */
+#define STATUS_NO_ERROR(STATUS)         ((STATUS) == STATUS_OK)
+
+/* Evaluate EXPR, which must produce a status_t.  If the status code
+   indicates an error, return from the current function with that
+   status code.  */
+#define RETURN_IF_ERROR(EXPR)                                           \
+  do                                                                    \
+    {                                                                   \
+      status_t s = EXPR;                                                \
+      if (!STATUS_NO_ERROR (s))                                         \
+	return s;                                                       \
+    }                                                                   \
+  while (0)
+
+static status_t int_to_dyn_string 
+  PARAMS ((int, dyn_string_t));
+static string_list_t string_list_new
+  PARAMS ((int));
+static void string_list_delete
+  PARAMS ((string_list_t));
+static status_t result_add_separated_char
+  PARAMS ((demangling_t, int));
+static status_t result_push
+  PARAMS ((demangling_t));
+static string_list_t result_pop
+  PARAMS ((demangling_t));
+static int substitution_start
+  PARAMS ((demangling_t));
+static status_t substitution_add
+  PARAMS ((demangling_t, int, int));
+static dyn_string_t substitution_get
+  PARAMS ((demangling_t, int, int *));
+#ifdef CP_DEMANGLE_DEBUG
+static void substitutions_print 
+  PARAMS ((demangling_t, FILE *));
+#endif
+static template_arg_list_t template_arg_list_new
+  PARAMS ((void));
+static void template_arg_list_delete
+  PARAMS ((template_arg_list_t));
+static void template_arg_list_add_arg 
+  PARAMS ((template_arg_list_t, string_list_t));
+static string_list_t template_arg_list_get_arg
+  PARAMS ((template_arg_list_t, int));
+static void push_template_arg_list
+  PARAMS ((demangling_t, template_arg_list_t));
+static void pop_to_template_arg_list
+  PARAMS ((demangling_t, template_arg_list_t));
+#ifdef CP_DEMANGLE_DEBUG
+static void template_arg_list_print
+  PARAMS ((template_arg_list_t, FILE *));
+#endif
+static template_arg_list_t current_template_arg_list
+  PARAMS ((demangling_t));
+static demangling_t demangling_new
+  PARAMS ((const char *));
+static void demangling_delete 
+  PARAMS ((demangling_t));
+
+/* The last character of DS.  Warning: DS is evaluated twice.  */
+#define dyn_string_last_char(DS)                                        \
+  (dyn_string_buf (DS)[dyn_string_length (DS) - 1])
+
+/* Append a space character (` ') to DS if it does not already end
+   with one.  Evaluates to 1 on success, or 0 on allocation failure.  */
+#define dyn_string_append_space(DS)                                     \
+      ((dyn_string_length (DS) > 0                                      \
+        && dyn_string_last_char (DS) != ' ')                            \
+       ? dyn_string_append_char ((DS), ' ')                             \
+       : 1)
+
+/* Returns the index of the current position in the mangled name.  */
+#define current_position(DM)    ((DM)->next - (DM)->name)
+
+/* Returns the character at the current position of the mangled name.  */
+#define peek_char(DM)           (*((DM)->next))
+
+/* Returns the character one past the current position of the mangled
+   name.  */
+#define peek_char_next(DM)                                              \
+  (peek_char (DM) == '\0' ? '\0' : (*((DM)->next + 1)))
+
+/* Returns the character at the current position, and advances the
+   current position to the next character.  */
+#define next_char(DM)           (*((DM)->next)++)
+
+/* Returns non-zero if the current position is the end of the mangled
+   name, i.e. one past the last character.  */
+#define end_of_name_p(DM)       (peek_char (DM) == '\0')
+
+/* Advances the current position by one character.  */
+#define advance_char(DM)        (++(DM)->next)
+
+/* Returns the string containing the current demangled result.  */
+#define result_string(DM)       (&(DM)->result->string)
+
+/* Returns the position at which new text is inserted into the
+   demangled result.  */
+#define result_caret_pos(DM)                                            \
+  (result_length (DM) +                                                 \
+   ((string_list_t) result_string (DM))->caret_position)
+
+/* Adds a dyn_string_t to the demangled result.  */
+#define result_add_string(DM, STRING)                                   \
+  (dyn_string_insert (&(DM)->result->string,                            \
+		      result_caret_pos (DM), (STRING))                  \
+   ? STATUS_OK : STATUS_ALLOCATION_FAILED)
+
+/* Adds NUL-terminated string CSTR to the demangled result.    */
+#define result_add(DM, CSTR)                                            \
+  (dyn_string_insert_cstr (&(DM)->result->string,                       \
+			   result_caret_pos (DM), (CSTR))               \
+   ? STATUS_OK : STATUS_ALLOCATION_FAILED)
+
+/* Adds character CHAR to the demangled result.  */
+#define result_add_char(DM, CHAR)                                       \
+  (dyn_string_insert_char (&(DM)->result->string,                       \
+			   result_caret_pos (DM), (CHAR))               \
+   ? STATUS_OK : STATUS_ALLOCATION_FAILED)
+
+/* Inserts a dyn_string_t to the demangled result at position POS.  */
+#define result_insert_string(DM, POS, STRING)                           \
+  (dyn_string_insert (&(DM)->result->string, (POS), (STRING))           \
+   ? STATUS_OK : STATUS_ALLOCATION_FAILED)
+
+/* Inserts NUL-terminated string CSTR to the demangled result at
+   position POS.  */
+#define result_insert(DM, POS, CSTR)                                    \
+  (dyn_string_insert_cstr (&(DM)->result->string, (POS), (CSTR))        \
+   ? STATUS_OK : STATUS_ALLOCATION_FAILED)
+
+/* Inserts character CHAR to the demangled result at position POS.  */
+#define result_insert_char(DM, POS, CHAR)                               \
+  (dyn_string_insert_char (&(DM)->result->string, (POS), (CHAR))        \
+   ? STATUS_OK : STATUS_ALLOCATION_FAILED)
+
+/* The length of the current demangled result.  */
+#define result_length(DM)                                               \
+  dyn_string_length (&(DM)->result->string)
+
+/* Appends a (less-than, greater-than) character to the result in DM
+   to (open, close) a template argument or parameter list.  Appends a
+   space first if necessary to prevent spurious elision of angle
+   brackets with the previous character.  */
+#define result_open_template_list(DM) result_add_separated_char(DM, '<')
+#define result_close_template_list(DM) result_add_separated_char(DM, '>')
+
+/* Appends a base 10 representation of VALUE to DS.  STATUS_OK on
+   success.  On failure, deletes DS and returns an error code.  */
+
+static status_t
+int_to_dyn_string (value, ds)
+     int value;
+     dyn_string_t ds;
+{
+  int i;
+  int mask = 1;
+
+  /* Handle zero up front.  */
+  if (value == 0)
+    {
+      if (!dyn_string_append_char (ds, '0'))
+	return STATUS_ALLOCATION_FAILED;
+      return STATUS_OK;
+    }
+
+  /* For negative numbers, emit a minus sign.  */
+  if (value < 0)
+    {
+      if (!dyn_string_append_char (ds, '-'))
+	return STATUS_ALLOCATION_FAILED;
+      value = -value;
+    }
+  
+  /* Find the power of 10 of the first digit.  */
+  i = value;
+  while (i > 9)
+    {
+      mask *= 10;
+      i /= 10;
+    }
+
+  /* Write the digits.  */
+  while (mask > 0)
+    {
+      int digit = value / mask;
+
+      if (!dyn_string_append_char (ds, '0' + digit))
+	return STATUS_ALLOCATION_FAILED;
+
+      value -= digit * mask;
+      mask /= 10;
+    }
+
+  return STATUS_OK;
+}
+
+/* Creates a new string list node.  The contents of the string are
+   empty, but the initial buffer allocation is LENGTH.  The string
+   list node should be deleted with string_list_delete.  Returns NULL
+   if allocation fails.  */
+
+static string_list_t 
+string_list_new (length)
+     int length;
+{
+  string_list_t s = (string_list_t) malloc (sizeof (struct string_list_def));
+  s->caret_position = 0;
+  if (s == NULL)
+    return NULL;
+  if (!dyn_string_init ((dyn_string_t) s, length))
+    return NULL;
+  return s;
+}  
+
+/* Deletes the entire string list starting at NODE.  */
+
+static void
+string_list_delete (node)
+     string_list_t node;
+{
+  while (node != NULL)
+    {
+      string_list_t next = node->next;
+      free (node);
+      node = next;
+    }
+}
+
+/* Appends CHARACTER to the demangled result.  If the current trailing
+   character of the result is CHARACTER, a space is inserted first.  */
+
+static status_t
+result_add_separated_char (dm, character)
+     demangling_t dm;
+     int character;
+{
+  char *result = dyn_string_buf (result_string (dm));
+  int caret_pos = result_caret_pos (dm);
+
+  /* Add a space if the last character is already the character we
+     want to add.  */
+  if (caret_pos > 0 && result[caret_pos - 1] == character)
+    RETURN_IF_ERROR (result_add_char (dm, ' '));
+  /* Add the character.  */
+  RETURN_IF_ERROR (result_add_char (dm, character));
+
+  return STATUS_OK;
+}
+
+/* Allocates and pushes a new string onto the demangled results stack
+   for DM.  Subsequent demangling with DM will emit to the new string.
+   Returns STATUS_OK on success, STATUS_ALLOCATION_FAILED on
+   allocation failure.  */
+
+static status_t
+result_push (dm)
+     demangling_t dm;
+{
+  string_list_t new_string = string_list_new (0);
+  if (new_string == NULL)
+    /* Allocation failed.  */
+    return STATUS_ALLOCATION_FAILED;
+
+  /* Link the new string to the front of the list of result strings.  */
+  new_string->next = (string_list_t) dm->result;
+  dm->result = new_string;
+  return STATUS_OK;
+}
+
+/* Removes and returns the topmost element on the demangled results
+   stack for DM.  The caller assumes ownership for the returned
+   string.  */
+
+static string_list_t
+result_pop (dm)
+     demangling_t dm;
+{
+  string_list_t top = dm->result;
+  dm->result = top->next;
+  return top;
+}
+
+/* Returns the current value of the caret for the result string.  The
+   value is an offet from the end of the result string.  */
+
+static int
+result_get_caret (dm)
+     demangling_t dm;
+{
+  return ((string_list_t) result_string (dm))->caret_position;
+}
+
+/* Sets the value of the caret for the result string, counted as an
+   offet from the end of the result string.  */
+
+static void
+result_set_caret (dm, position)
+     demangling_t dm;
+     int position;
+{
+  ((string_list_t) result_string (dm))->caret_position = position;
+}
+
+/* Shifts the position of the next addition to the result by
+   POSITION_OFFSET.  A negative value shifts the caret to the left.  */
+
+static void
+result_shift_caret (dm, position_offset)
+     demangling_t dm;
+     int position_offset;
+{
+  ((string_list_t) result_string (dm))->caret_position += position_offset;
+}
+
+/* Returns non-zero if the character that comes right before the place
+   where text will be added to the result is a space.  In this case,
+   the caller should supress adding another space.  */
+
+static int
+result_previous_char_is_space (dm)
+     demangling_t dm;
+{
+  char *result = dyn_string_buf (result_string (dm));
+  int pos = result_caret_pos (dm);
+  return pos > 0 && result[pos - 1] == ' ';
+}
+
+/* Returns the start position of a fragment of the demangled result
+   that will be a substitution candidate.  Should be called at the
+   start of productions that can add substitutions.  */
+
+static int
+substitution_start (dm)
+     demangling_t dm;
+{
+  return result_caret_pos (dm);
+}
+
+/* Adds the suffix of the current demangled result of DM starting at
+   START_POSITION as a potential substitution.  If TEMPLATE_P is
+   non-zero, this potential substitution is a template-id.  */
+
+static status_t
+substitution_add (dm, start_position, template_p)
+     demangling_t dm;
+     int start_position;
+     int template_p;
+{
+  dyn_string_t result = result_string (dm);
+  dyn_string_t substitution = dyn_string_new (0);
+  int i;
+
+  if (substitution == NULL)
+    return STATUS_ALLOCATION_FAILED;
+
+  /* Extract the substring of the current demangling result that
+     represents the subsitution candidate.  */
+  if (!dyn_string_substring (substitution, 
+			     result, start_position, result_caret_pos (dm)))
+    {
+      dyn_string_delete (substitution);
+      return STATUS_ALLOCATION_FAILED;
+    }
+
+  /* If there's no room for the new entry, grow the array.  */
+  if (dm->substitutions_allocated == dm->num_substitutions)
+    {
+      size_t new_array_size;
+      if (dm->substitutions_allocated > 0)
+	dm->substitutions_allocated *= 2;
+      else
+	dm->substitutions_allocated = 2;
+      new_array_size = 
+	sizeof (struct substitution_def) * dm->substitutions_allocated;
+
+      dm->substitutions = (struct substitution_def *)
+	realloc (dm->substitutions, new_array_size);
+      if (dm->substitutions == NULL)
+	/* Realloc failed.  */
+	{
+	  dyn_string_delete (substitution);
+	  return STATUS_ALLOCATION_FAILED;
+	}
+    }
+
+  /* Add the substitution to the array.  */
+  i = dm->num_substitutions++;
+  dm->substitutions[i].text = substitution;
+  dm->substitutions[i].template_p = template_p;
+
+#ifdef CP_DEMANGLE_DEBUG
+  substitutions_print (dm, stderr);
+#endif
+
+  return STATUS_OK;
+}
+
+/* Returns the Nth-most-recent substitution.  Sets *TEMPLATE_P to
+   non-zero if the substitution is a template-id, zero otherwise.  
+   N is numbered from zero.  DM retains ownership of the returned
+   string.  If N is negative, or equal to or greater than the current
+   number of substitution candidates, returns NULL.  */
+
+static dyn_string_t
+substitution_get (dm, n, template_p)
+     demangling_t dm;
+     int n;
+     int *template_p;
+{
+  struct substitution_def *sub;
+
+  /* Make sure N is in the valid range.  */
+  if (n < 0 || n >= dm->num_substitutions)
+    return NULL;
+
+  sub = &(dm->substitutions[n]);
+  *template_p = sub->template_p;
+  return sub->text;
+}
+
+#ifdef CP_DEMANGLE_DEBUG
+/* Debugging routine to print the current substitutions to FP.  */
+
+static void
+substitutions_print (dm, fp)
+     demangling_t dm;
+     FILE *fp;
+{
+  int seq_id;
+  int num = dm->num_substitutions;
+
+  fprintf (fp, "SUBSTITUTIONS:\n");
+  for (seq_id = -1; seq_id < num - 1; ++seq_id)
+    {
+      int template_p;
+      dyn_string_t text = substitution_get (dm, seq_id + 1, &template_p);
+
+      if (seq_id == -1)
+	fprintf (fp, " S_ ");
+      else
+	fprintf (fp, " S%d_", seq_id);
+      fprintf (fp, " %c: %s\n", template_p ? '*' : ' ', dyn_string_buf (text));
+    }
+}
+
+#endif /* CP_DEMANGLE_DEBUG */
+
+/* Creates a new template argument list.  Returns NULL if allocation
+   fails.  */
+
+static template_arg_list_t
+template_arg_list_new ()
+{
+  template_arg_list_t new_list =
+    (template_arg_list_t) malloc (sizeof (struct template_arg_list_def));
+  if (new_list == NULL)
+    return NULL;
+  /* Initialize the new list to have no arguments.  */
+  new_list->first_argument = NULL;
+  new_list->last_argument = NULL;
+  /* Return the new list.  */
+  return new_list;
+}
+
+/* Deletes a template argument list and the template arguments it
+   contains.  */
+
+static void
+template_arg_list_delete (list)
+     template_arg_list_t list;
+{
+  /* If there are any arguments on LIST, delete them.  */
+  if (list->first_argument != NULL)
+    string_list_delete (list->first_argument);
+  /* Delete LIST.  */
+  free (list);
+}
+
+/* Adds ARG to the template argument list ARG_LIST.  */
+
+static void 
+template_arg_list_add_arg (arg_list, arg)
+     template_arg_list_t arg_list;
+     string_list_t arg;
+{
+  if (arg_list->first_argument == NULL)
+    /* If there were no arguments before, ARG is the first one.  */
+    arg_list->first_argument = arg;
+  else
+    /* Make ARG the last argument on the list.  */
+    arg_list->last_argument->next = arg;
+  /* Make ARG the last on the list.  */
+  arg_list->last_argument = arg;
+  arg->next = NULL;
+}
+
+/* Returns the template arugment at position INDEX in template
+   argument list ARG_LIST.  */
+
+static string_list_t
+template_arg_list_get_arg (arg_list, index)
+     template_arg_list_t arg_list;
+     int index;
+{
+  string_list_t arg = arg_list->first_argument;
+  /* Scan down the list of arguments to find the one at position
+     INDEX.  */
+  while (index--)
+    {
+      arg = arg->next;
+      if (arg == NULL)
+	/* Ran out of arguments before INDEX hit zero.  That's an
+	   error.  */
+	return NULL;
+    }
+  /* Return the argument at position INDEX.  */
+  return arg;
+}
+
+/* Pushes ARG_LIST onto the top of the template argument list stack.  */
+
+static void
+push_template_arg_list (dm, arg_list)
+     demangling_t dm;
+     template_arg_list_t arg_list;
+{
+  arg_list->next = dm->template_arg_lists;
+  dm->template_arg_lists = arg_list;
+#ifdef CP_DEMANGLE_DEBUG
+  fprintf (stderr, " ** pushing template arg list\n");
+  template_arg_list_print (arg_list, stderr);
+#endif 
+}
+
+/* Pops and deletes elements on the template argument list stack until
+   arg_list is the topmost element.  If arg_list is NULL, all elements
+   are popped and deleted.  */
+
+static void
+pop_to_template_arg_list (dm, arg_list)
+     demangling_t dm;
+     template_arg_list_t arg_list;
+{
+  while (dm->template_arg_lists != arg_list)
+    {
+      template_arg_list_t top = dm->template_arg_lists;
+      /* Disconnect the topmost element from the list.  */
+      dm->template_arg_lists = top->next;
+      /* Delete the popped element.  */
+      template_arg_list_delete (top);
+#ifdef CP_DEMANGLE_DEBUG
+      fprintf (stderr, " ** removing template arg list\n");
+#endif
+    }
+}
+
+#ifdef CP_DEMANGLE_DEBUG
+
+/* Prints the contents of ARG_LIST to FP.  */
+
+static void
+template_arg_list_print (arg_list, fp)
+  template_arg_list_t arg_list;
+  FILE *fp;
+{
+  string_list_t arg;
+  int index = -1;
+
+  fprintf (fp, "TEMPLATE ARGUMENT LIST:\n");
+  for (arg = arg_list->first_argument; arg != NULL; arg = arg->next)
+    {
+      if (index == -1)
+	fprintf (fp, " T_  : ");
+      else
+	fprintf (fp, " T%d_ : ", index);
+      ++index;
+      fprintf (fp, "%s\n", dyn_string_buf ((dyn_string_t) arg));
+    }
+}
+
+#endif /* CP_DEMANGLE_DEBUG */
+
+/* Returns the topmost element on the stack of template argument
+   lists.  If there is no list of template arguments, returns NULL.  */
+
+static template_arg_list_t
+current_template_arg_list (dm)
+     demangling_t dm;
+{
+  return dm->template_arg_lists;
+}
+
+/* Allocates a demangling_t object for demangling mangled NAME.  A new
+   result must be pushed before the returned object can be used.
+   Returns NULL if allocation fails.  */
+
+static demangling_t
+demangling_new (name)
+     const char *name;
+{
+  demangling_t dm;
+  dm = (demangling_t) malloc (sizeof (struct demangling_def));
+  if (dm == NULL)
+    return NULL;
+
+  dm->name = name;
+  dm->next = name;
+  dm->result = NULL;
+  dm->num_substitutions = 0;
+  dm->substitutions_allocated = 10;
+  dm->template_arg_lists = NULL;
+  dm->last_source_name = dyn_string_new (0);
+  if (dm->last_source_name == NULL)
+    return NULL;
+  dm->substitutions = (struct substitution_def *)
+    malloc (dm->substitutions_allocated * sizeof (struct substitution_def));
+  if (dm->substitutions == NULL)
+    {
+      dyn_string_delete (dm->last_source_name);
+      return NULL;
+    }
+
+  return dm;
+}
+
+/* Deallocates a demangling_t object and all memory associated with
+   it.  */
+
+static void
+demangling_delete (dm)
+     demangling_t dm;
+{
+  int i;
+  template_arg_list_t arg_list = dm->template_arg_lists;
+
+  /* Delete the stack of template argument lists.  */
+  while (arg_list != NULL)
+    {
+      template_arg_list_t next = arg_list->next;
+      template_arg_list_delete (arg_list);
+      arg_list = next;
+    }
+  /* Delete the list of substitutions.  */
+  for (i = dm->num_substitutions; --i >= 0; )
+    dyn_string_delete (dm->substitutions[i].text);
+  free (dm->substitutions);
+  /* Delete the demangled result.  */
+  string_list_delete (dm->result);
+  /* Delete the stored identifier name.  */
+  dyn_string_delete (dm->last_source_name);
+  /* Delete the context object itself.  */
+  free (dm);
+}
+
+/* These functions demangle an alternative of the corresponding
+   production in the mangling spec.  The first argument of each is a
+   demangling context structure for the current demangling
+   operation.  Most emit demangled text directly to the topmost result
+   string on the result string stack in the demangling context
+   structure.  */
+
+static status_t demangle_char
+  PARAMS ((demangling_t, int));
+static status_t demangle_mangled_name 
+  PARAMS ((demangling_t));
+static status_t demangle_encoding
+  PARAMS ((demangling_t));
+static status_t demangle_name
+  PARAMS ((demangling_t, int *));
+static status_t demangle_nested_name
+  PARAMS ((demangling_t, int *));
+static status_t demangle_prefix
+  PARAMS ((demangling_t, int *));
+static status_t demangle_unqualified_name
+  PARAMS ((demangling_t, int *));
+static status_t demangle_source_name
+  PARAMS ((demangling_t));
+static status_t demangle_number
+  PARAMS ((demangling_t, int *, int, int));
+static status_t demangle_number_literally
+  PARAMS ((demangling_t, dyn_string_t, int, int));
+static status_t demangle_identifier
+  PARAMS ((demangling_t, int, dyn_string_t));
+static status_t demangle_operator_name
+  PARAMS ((demangling_t, int, int *));
+static status_t demangle_nv_offset
+  PARAMS ((demangling_t));
+static status_t demangle_v_offset
+  PARAMS ((demangling_t));
+static status_t demangle_call_offset
+  PARAMS ((demangling_t));
+static status_t demangle_special_name
+  PARAMS ((demangling_t));
+static status_t demangle_ctor_dtor_name
+  PARAMS ((demangling_t));
+static status_t demangle_type_ptr
+  PARAMS ((demangling_t, int *, int));
+static status_t demangle_type
+  PARAMS ((demangling_t));
+static status_t demangle_CV_qualifiers
+  PARAMS ((demangling_t, dyn_string_t));
+static status_t demangle_builtin_type
+  PARAMS ((demangling_t));
+static status_t demangle_function_type
+  PARAMS ((demangling_t, int *));
+static status_t demangle_bare_function_type
+  PARAMS ((demangling_t, int *));
+static status_t demangle_class_enum_type
+  PARAMS ((demangling_t, int *));
+static status_t demangle_array_type
+  PARAMS ((demangling_t, int *));
+static status_t demangle_template_param
+  PARAMS ((demangling_t));
+static status_t demangle_template_args
+  PARAMS ((demangling_t));
+static status_t demangle_literal
+  PARAMS ((demangling_t));
+static status_t demangle_template_arg
+  PARAMS ((demangling_t));
+static status_t demangle_expression
+  PARAMS ((demangling_t));
+static status_t demangle_scope_expression
+  PARAMS ((demangling_t));
+static status_t demangle_expr_primary
+  PARAMS ((demangling_t));
+static status_t demangle_substitution
+  PARAMS ((demangling_t, int *));
+static status_t demangle_local_name
+  PARAMS ((demangling_t));
+static status_t demangle_discriminator 
+  PARAMS ((demangling_t, int));
+static status_t cp_demangle
+  PARAMS ((const char *, dyn_string_t));
+#ifdef IN_LIBGCC2
+static status_t cp_demangle_type
+  PARAMS ((const char*, dyn_string_t));
+#endif
+
+/* When passed to demangle_bare_function_type, indicates that the
+   function's return type is not encoded before its parameter types.  */
+#define BFT_NO_RETURN_TYPE    NULL
+
+/* Check that the next character is C.  If so, consume it.  If not,
+   return an error.  */
+
+static status_t
+demangle_char (dm, c)
+     demangling_t dm;
+     int c;
+{
+  static char *error_message = NULL;
+
+  if (peek_char (dm) == c)
+    {
+      advance_char (dm);
+      return STATUS_OK;
+    }
+  else
+    {
+      if (error_message == NULL)
+	error_message = strdup ("Expected ?");
+      error_message[9] = c;
+      return error_message;
+    }
+}
+
+/* Demangles and emits a <mangled-name>.  
+
+    <mangled-name>      ::= _Z <encoding>  */
+
+static status_t
+demangle_mangled_name (dm)
+     demangling_t dm;
+{
+  DEMANGLE_TRACE ("mangled-name", dm);
+  RETURN_IF_ERROR (demangle_char (dm, '_'));
+  RETURN_IF_ERROR (demangle_char (dm, 'Z'));
+  RETURN_IF_ERROR (demangle_encoding (dm));
+  return STATUS_OK;
+}
+
+/* Demangles and emits an <encoding>.  
+
+    <encoding>		::= <function name> <bare-function-type>
+			::= <data name>
+			::= <special-name>  */
+
+static status_t
+demangle_encoding (dm)
+     demangling_t dm;
+{
+  int encode_return_type;
+  int start_position;
+  template_arg_list_t old_arg_list = current_template_arg_list (dm);
+  char peek = peek_char (dm);
+
+  DEMANGLE_TRACE ("encoding", dm);
+  
+  /* Remember where the name starts.  If it turns out to be a template
+     function, we'll have to insert the return type here.  */
+  start_position = result_caret_pos (dm);
+
+  if (peek == 'G' || peek == 'T')
+    RETURN_IF_ERROR (demangle_special_name (dm));
+  else
+    {
+      /* Now demangle the name.  */
+      RETURN_IF_ERROR (demangle_name (dm, &encode_return_type));
+
+      /* If there's anything left, the name was a function name, with
+	 maybe its return type, and its parameter types, following.  */
+      if (!end_of_name_p (dm) 
+	  && peek_char (dm) != 'E')
+	{
+	  if (encode_return_type)
+	    /* Template functions have their return type encoded.  The
+	       return type should be inserted at start_position.  */
+	    RETURN_IF_ERROR 
+	      (demangle_bare_function_type (dm, &start_position));
+	  else
+	    /* Non-template functions don't have their return type
+	       encoded.  */
+	    RETURN_IF_ERROR 
+	      (demangle_bare_function_type (dm, BFT_NO_RETURN_TYPE)); 
+	}
+    }
+
+  /* Pop off template argument lists that were built during the
+     mangling of this name, to restore the old template context.  */
+  pop_to_template_arg_list (dm, old_arg_list);
+
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <name>.
+
+    <name>              ::= <unscoped-name>
+                        ::= <unscoped-template-name> <template-args>
+			::= <nested-name>
+                        ::= <local-name>
+
+    <unscoped-name>     ::= <unqualified-name>
+			::= St <unqualified-name>   # ::std::
+
+    <unscoped-template-name>    
+                        ::= <unscoped-name>
+                        ::= <substitution>  */
+
+static status_t
+demangle_name (dm, encode_return_type)
+     demangling_t dm;
+     int *encode_return_type;
+{
+  int start = substitution_start (dm);
+  char peek = peek_char (dm);
+  int is_std_substitution = 0;
+
+  /* Generally, the return type is encoded if the function is a
+     template-id, and suppressed otherwise.  There are a few cases,
+     though, in which the return type is not encoded even for a
+     templated function.  In these cases, this flag is set.  */
+  int suppress_return_type = 0;
+
+  DEMANGLE_TRACE ("name", dm);
+
+  switch (peek)
+    {
+    case 'N':
+      /* This is a <nested-name>.  */
+      RETURN_IF_ERROR (demangle_nested_name (dm, encode_return_type));
+      break;
+
+    case 'Z':
+      RETURN_IF_ERROR (demangle_local_name (dm));
+      *encode_return_type = 0;
+      break;
+
+    case 'S':
+      /* The `St' substitution allows a name nested in std:: to appear
+	 without being enclosed in a nested name.  */
+      if (peek_char_next (dm) == 't') 
+	{
+	  (void) next_char (dm);
+	  (void) next_char (dm);
+	  RETURN_IF_ERROR (result_add (dm, "std::"));
+	  RETURN_IF_ERROR 
+	    (demangle_unqualified_name (dm, &suppress_return_type));
+	  is_std_substitution = 1;
+	}
+      else
+	RETURN_IF_ERROR (demangle_substitution (dm, encode_return_type));
+      /* Check if a template argument list immediately follows.
+	 If so, then we just demangled an <unqualified-template-name>.  */
+      if (peek_char (dm) == 'I') 
+	{
+	  /* A template name of the form std::<unqualified-name> is a
+             substitution candidate.  */
+	  if (is_std_substitution)
+	    RETURN_IF_ERROR (substitution_add (dm, start, 0));
+	  /* Demangle the <template-args> here.  */
+	  RETURN_IF_ERROR (demangle_template_args (dm));
+	  *encode_return_type = !suppress_return_type;
+	}
+      else
+	*encode_return_type = 0;
+
+      break;
+
+    default:
+      /* This is an <unscoped-name> or <unscoped-template-name>.  */
+      RETURN_IF_ERROR (demangle_unqualified_name (dm, &suppress_return_type));
+
+      /* If the <unqualified-name> is followed by template args, this
+	 is an <unscoped-template-name>.  */
+      if (peek_char (dm) == 'I')
+	{
+	  /* Add a substitution for the unqualified template name.  */
+	  RETURN_IF_ERROR (substitution_add (dm, start, 0));
+
+	  RETURN_IF_ERROR (demangle_template_args (dm));
+	  *encode_return_type = !suppress_return_type;
+	}
+      else
+	*encode_return_type = 0;
+
+      break;
+    }
+
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <nested-name>. 
+
+    <nested-name>     ::= N [<CV-qualifiers>] <prefix> <unqulified-name> E  */
+
+static status_t
+demangle_nested_name (dm, encode_return_type)
+     demangling_t dm;
+     int *encode_return_type;
+{
+  char peek;
+
+  DEMANGLE_TRACE ("nested-name", dm);
+
+  RETURN_IF_ERROR (demangle_char (dm, 'N'));
+
+  peek = peek_char (dm);
+  if (peek == 'r' || peek == 'V' || peek == 'K')
+    {
+      dyn_string_t cv_qualifiers;
+      status_t status;
+
+      /* Snarf up CV qualifiers.  */
+      cv_qualifiers = dyn_string_new (24);
+      if (cv_qualifiers == NULL)
+	return STATUS_ALLOCATION_FAILED;
+      demangle_CV_qualifiers (dm, cv_qualifiers);
+
+      /* Emit them, preceded by a space.  */
+      status = result_add_char (dm, ' ');
+      if (STATUS_NO_ERROR (status)) 
+	status = result_add_string (dm, cv_qualifiers);
+      /* The CV qualifiers that occur in a <nested-name> will be
+	 qualifiers for member functions.  These are placed at the end
+	 of the function.  Therefore, shift the caret to the left by
+	 the length of the qualifiers, so other text is inserted
+	 before them and they stay at the end.  */
+      result_shift_caret (dm, -dyn_string_length (cv_qualifiers) - 1);
+      /* Clean up.  */
+      dyn_string_delete (cv_qualifiers);
+      RETURN_IF_ERROR (status);
+    }
+
+  RETURN_IF_ERROR (demangle_prefix (dm, encode_return_type));
+  /* No need to demangle the final <unqualified-name>; demangle_prefix
+     will handle it.  */
+  RETURN_IF_ERROR (demangle_char (dm, 'E'));
+
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <prefix>.
+
+    <prefix>            ::= <prefix> <unqualified-name>
+                        ::= <template-prefix> <template-args>
+			::= # empty
+			::= <substitution>
+
+    <template-prefix>   ::= <prefix>
+                        ::= <substitution>  */
+
+static status_t
+demangle_prefix (dm, encode_return_type)
+     demangling_t dm;
+     int *encode_return_type;
+{
+  int start = substitution_start (dm);
+  int nested = 0;
+
+  /* ENCODE_RETURN_TYPE is updated as we decend the nesting chain.
+     After <template-args>, it is set to non-zero; after everything
+     else it is set to zero.  */
+
+  /* Generally, the return type is encoded if the function is a
+     template-id, and suppressed otherwise.  There are a few cases,
+     though, in which the return type is not encoded even for a
+     templated function.  In these cases, this flag is set.  */
+  int suppress_return_type = 0;
+
+  DEMANGLE_TRACE ("prefix", dm);
+
+  while (1)
+    {
+      char peek;
+
+      if (end_of_name_p (dm))
+	return "Unexpected end of name in <compound-name>.";
+
+      peek = peek_char (dm);
+      
+      /* We'll initialize suppress_return_type to false, and set it to true
+	 if we end up demangling a constructor name.  However, make
+	 sure we're not actually about to demangle template arguments
+	 -- if so, this is the <template-args> following a
+	 <template-prefix>, so we'll want the previous flag value
+	 around.  */
+      if (peek != 'I')
+	suppress_return_type = 0;
+
+      if (IS_DIGIT ((unsigned char) peek)
+	  || (peek >= 'a' && peek <= 'z')
+	  || peek == 'C' || peek == 'D'
+	  || peek == 'S')
+	{
+	  /* We have another level of scope qualification.  */
+	  if (nested)
+	    RETURN_IF_ERROR (result_add (dm, "::"));
+	  else
+	    nested = 1;
+
+	  if (peek == 'S')
+	    /* The substitution determines whether this is a
+	       template-id.  */
+	    RETURN_IF_ERROR (demangle_substitution (dm, encode_return_type));
+	  else
+	    {
+	      /* It's just a name.  */
+	      RETURN_IF_ERROR 
+		(demangle_unqualified_name (dm, &suppress_return_type));
+	      *encode_return_type = 0;
+	    }
+	}
+      else if (peek == 'Z')
+	RETURN_IF_ERROR (demangle_local_name (dm));
+      else if (peek == 'I')
+	{
+	  RETURN_IF_ERROR (demangle_template_args (dm));
+
+	  /* Now we want to indicate to the caller that we've
+	     demangled template arguments, thus the prefix was a
+	     <template-prefix>.  That's so that the caller knows to
+	     demangle the function's return type, if this turns out to
+	     be a function name.  But, if it's a member template
+	     constructor or a templated conversion operator, report it
+	     as untemplated.  Those never get encoded return types.  */
+	  *encode_return_type = !suppress_return_type;
+	}
+      else if (peek == 'E')
+	/* All done.  */
+	return STATUS_OK;
+      else
+	return "Unexpected character in <compound-name>.";
+
+      if (peek != 'S'
+	  && peek_char (dm) != 'E')
+	/* Add a new substitution for the prefix thus far.  */
+	RETURN_IF_ERROR (substitution_add (dm, start, *encode_return_type));
+    }
+}
+
+/* Demangles and emits an <unqualified-name>.  If this
+   <unqualified-name> is for a special function type that should never
+   have its return type encoded (particularly, a constructor or
+   conversion operator), *SUPPRESS_RETURN_TYPE is set to 1; otherwise,
+   it is set to zero.
+
+    <unqualified-name>  ::= <operator-name>
+			::= <special-name>  
+			::= <source-name>  */
+
+static status_t
+demangle_unqualified_name (dm, suppress_return_type)
+     demangling_t dm;
+     int *suppress_return_type;
+{
+  char peek = peek_char (dm);
+
+  DEMANGLE_TRACE ("unqualified-name", dm);
+
+  /* By default, don't force suppression of the return type (though
+     non-template functions still don't get a return type encoded).  */ 
+  *suppress_return_type = 0;
+
+  if (IS_DIGIT ((unsigned char) peek))
+    RETURN_IF_ERROR (demangle_source_name (dm));
+  else if (peek >= 'a' && peek <= 'z')
+    {
+      int num_args;
+
+      /* Conversion operators never have a return type encoded.  */
+      if (peek == 'c' && peek_char_next (dm) == 'v')
+	*suppress_return_type = 1;
+
+      RETURN_IF_ERROR (demangle_operator_name (dm, 0, &num_args));
+    }
+  else if (peek == 'C' || peek == 'D')
+    {
+      /* Constructors never have a return type encoded.  */
+      if (peek == 'C')
+	*suppress_return_type = 1;
+
+      RETURN_IF_ERROR (demangle_ctor_dtor_name (dm));
+    }
+  else
+    return "Unexpected character in <unqualified-name>.";
+
+  return STATUS_OK;
+}
+
+/* Demangles and emits <source-name>.  
+
+    <source-name> ::= <length number> <identifier>  */
+
+static status_t
+demangle_source_name (dm)
+     demangling_t dm;
+{
+  int length;
+
+  DEMANGLE_TRACE ("source-name", dm);
+
+  /* Decode the length of the identifier.  */
+  RETURN_IF_ERROR (demangle_number (dm, &length, 10, 0));
+  if (length == 0)
+    return "Zero length in <source-name>.";
+
+  /* Now the identifier itself.  It's placed into last_source_name,
+     where it can be used to build a constructor or destructor name.  */
+  RETURN_IF_ERROR (demangle_identifier (dm, length, 
+					dm->last_source_name));
+
+  /* Emit it.  */
+  RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name));
+
+  return STATUS_OK;
+}
+
+/* Demangles a number, either a <number> or a <positive-number> at the
+   current position, consuming all consecutive digit characters.  Sets
+   *VALUE to the resulting numberand returns STATUS_OK.  The number is
+   interpreted as BASE, which must be either 10 or 36.  If IS_SIGNED
+   is non-zero, negative numbers -- prefixed with `n' -- are accepted.
+
+    <number> ::= [n] <positive-number>
+
+    <positive-number> ::= <decimal integer>  */
+
+static status_t
+demangle_number (dm, value, base, is_signed)
+     demangling_t dm;
+     int *value;
+     int base;
+     int is_signed;
+{
+  dyn_string_t number = dyn_string_new (10);
+
+  DEMANGLE_TRACE ("number", dm);
+
+  if (number == NULL)
+    return STATUS_ALLOCATION_FAILED;
+
+  demangle_number_literally (dm, number, base, is_signed);
+  *value = strtol (dyn_string_buf (number), NULL, base);
+  dyn_string_delete (number);
+
+  return STATUS_OK;
+}
+
+/* Demangles a number at the current position.  The digits (and minus
+   sign, if present) that make up the number are appended to STR.
+   Only base-BASE digits are accepted; BASE must be either 10 or 36.
+   If IS_SIGNED, negative numbers -- prefixed with `n' -- are
+   accepted.  Does not consume a trailing underscore or other
+   terminating character.  */
+
+static status_t
+demangle_number_literally (dm, str, base, is_signed)
+     demangling_t dm;
+     dyn_string_t str;
+     int base;
+     int is_signed;
+{
+  DEMANGLE_TRACE ("number*", dm);
+
+  if (base != 10 && base != 36)
+    return STATUS_INTERNAL_ERROR;
+
+  /* An `n' denotes a negative number.  */
+  if (is_signed && peek_char (dm) == 'n')
+    {
+      /* Skip past the n.  */
+      advance_char (dm);
+      /* The normal way to write a negative number is with a minus
+	 sign.  */
+      if (!dyn_string_append_char (str, '-'))
+	return STATUS_ALLOCATION_FAILED;
+    }
+
+  /* Loop until we hit a non-digit.  */
+  while (1)
+    {
+      char peek = peek_char (dm);
+      if (IS_DIGIT ((unsigned char) peek)
+	  || (base == 36 && peek >= 'A' && peek <= 'Z'))
+	{
+	  /* Accumulate digits.  */
+	  if (!dyn_string_append_char (str, next_char (dm)))
+	    return STATUS_ALLOCATION_FAILED;
+	}
+      else
+	/* Not a digit?  All done.  */
+	break;
+    }
+
+  return STATUS_OK;
+}
+
+/* Demangles an identifier at the current position of LENGTH
+   characters and places it in IDENTIFIER.  */
+
+static status_t
+demangle_identifier (dm, length, identifier)
+     demangling_t dm;
+     int length;
+     dyn_string_t identifier;
+{
+  DEMANGLE_TRACE ("identifier", dm);
+
+  dyn_string_clear (identifier);
+  if (!dyn_string_resize (identifier, length))
+    return STATUS_ALLOCATION_FAILED;
+
+  while (length-- > 0)
+    {
+      if (end_of_name_p (dm))
+	return "Unexpected end of name in <identifier>.";
+      if (!dyn_string_append_char (identifier, next_char (dm)))
+	return STATUS_ALLOCATION_FAILED;
+    }
+
+  /* GCC encodes anonymous namespaces using a `_GLOBAL_[_.$]N.'
+     followed by the source file name and some random characters.
+     Unless we're in strict mode, decipher these names appropriately.  */
+  if (!flag_strict)
+    {
+      char *name = dyn_string_buf (identifier);
+      int prefix_length = strlen (ANONYMOUS_NAMESPACE_PREFIX);
+
+      /* Compare the first, fixed part.  */
+      if (strncmp (name, ANONYMOUS_NAMESPACE_PREFIX, prefix_length) == 0)
+        {
+	  name += prefix_length;
+	  /* The next character might be a period, an underscore, or
+	     dollar sign, depending on the target architecture's
+	     assembler's capabilities.  After that comes an `N'.  */
+	  if ((*name == '.' || *name == '_' || *name == '$')
+	      && *(name + 1) == 'N')
+	    /* This looks like the anonymous namespace identifier.
+	       Replace it with something comprehensible.  */
+	    dyn_string_copy_cstr (identifier, "(anonymous namespace)");
+	}
+    }
+
+  return STATUS_OK;
+}
+
+/* Demangles and emits an <operator-name>.  If SHORT_NAME is non-zero,
+   the short form is emitted; otherwise the full source form
+   (`operator +' etc.) is emitted.  *NUM_ARGS is set to the number of
+   operands that the operator takes.  
+
+    <operator-name>
+                  ::= nw        # new           
+                  ::= na        # new[]
+                  ::= dl        # delete        
+                  ::= da        # delete[]      
+		  ::= ps        # + (unary)
+                  ::= ng        # - (unary)     
+                  ::= ad        # & (unary)     
+                  ::= de        # * (unary)     
+                  ::= co        # ~             
+                  ::= pl        # +             
+                  ::= mi        # -             
+                  ::= ml        # *             
+                  ::= dv        # /             
+                  ::= rm        # %             
+                  ::= an        # &             
+                  ::= or        # |             
+                  ::= eo        # ^             
+                  ::= aS        # =             
+                  ::= pL        # +=            
+                  ::= mI        # -=            
+                  ::= mL        # *=            
+                  ::= dV        # /=            
+                  ::= rM        # %=            
+                  ::= aN        # &=            
+                  ::= oR        # |=            
+                  ::= eO        # ^=            
+                  ::= ls        # <<            
+                  ::= rs        # >>            
+                  ::= lS        # <<=           
+                  ::= rS        # >>=           
+                  ::= eq        # ==            
+                  ::= ne        # !=            
+                  ::= lt        # <             
+                  ::= gt        # >             
+                  ::= le        # <=            
+                  ::= ge        # >=            
+                  ::= nt        # !             
+                  ::= aa        # &&            
+                  ::= oo        # ||            
+                  ::= pp        # ++            
+                  ::= mm        # --            
+                  ::= cm        # ,             
+                  ::= pm        # ->*           
+                  ::= pt        # ->            
+                  ::= cl        # ()            
+                  ::= ix        # []            
+                  ::= qu        # ?
+                  ::= sz        # sizeof 
+                  ::= cv <type> # cast        
+		  ::= v [0-9] <source-name>  # vendor extended operator  */
+
+static status_t
+demangle_operator_name (dm, short_name, num_args)
+     demangling_t dm;
+     int short_name;
+     int *num_args;
+{
+  struct operator_code
+  {
+    /* The mangled code for this operator.  */
+    const char *code;
+    /* The source name of this operator.  */
+    const char *name;
+    /* The number of arguments this operator takes.  */
+    int num_args;
+  };
+
+  static const struct operator_code operators[] = 
+  {
+    { "aN", "&="       , 2 },
+    { "aS", "="        , 2 },
+    { "aa", "&&"       , 2 },
+    { "ad", "&"        , 1 },
+    { "an", "&"        , 2 },
+    { "cl", "()"       , 0 },
+    { "cm", ","        , 2 },
+    { "co", "~"        , 1 },
+    { "dV", "/="       , 2 },
+    { "da", " delete[]", 1 },
+    { "de", "*"        , 1 },
+    { "dl", " delete"  , 1 },
+    { "dv", "/"        , 2 },
+    { "eO", "^="       , 2 },
+    { "eo", "^"        , 2 },
+    { "eq", "=="       , 2 },
+    { "ge", ">="       , 2 },
+    { "gt", ">"        , 2 },
+    { "ix", "[]"       , 2 },
+    { "lS", "<<="      , 2 },
+    { "le", "<="       , 2 },
+    { "ls", "<<"       , 2 },
+    { "lt", "<"        , 2 },
+    { "mI", "-="       , 2 },
+    { "mL", "*="       , 2 },
+    { "mi", "-"        , 2 },
+    { "ml", "*"        , 2 },
+    { "mm", "--"       , 1 },
+    { "na", " new[]"   , 1 },
+    { "ne", "!="       , 2 },
+    { "ng", "-"        , 1 },
+    { "nt", "!"        , 1 },
+    { "nw", " new"     , 1 },
+    { "oR", "|="       , 2 },
+    { "oo", "||"       , 2 },
+    { "or", "|"        , 2 },
+    { "pL", "+="       , 2 },
+    { "pl", "+"        , 2 },
+    { "pm", "->*"      , 2 },
+    { "pp", "++"       , 1 },
+    { "ps", "+"        , 1 },
+    { "pt", "->"       , 2 },
+    { "qu", "?"        , 3 },
+    { "rM", "%="       , 2 },
+    { "rS", ">>="      , 2 },
+    { "rm", "%"        , 2 },
+    { "rs", ">>"       , 2 },
+    { "sz", " sizeof"  , 1 }
+  };
+
+  const int num_operators = 
+    sizeof (operators) / sizeof (struct operator_code);
+
+  int c0 = next_char (dm);
+  int c1 = next_char (dm);
+  const struct operator_code* p1 = operators;
+  const struct operator_code* p2 = operators + num_operators;
+
+  DEMANGLE_TRACE ("operator-name", dm);
+
+  /* Is this a vendor-extended operator?  */
+  if (c0 == 'v' && IS_DIGIT (c1))
+    {
+      RETURN_IF_ERROR (result_add (dm, "operator "));
+      RETURN_IF_ERROR (demangle_source_name (dm));
+      *num_args = 0;
+      return STATUS_OK;
+    }
+
+  /* Is this a conversion operator?  */
+  if (c0 == 'c' && c1 == 'v')
+    {
+      RETURN_IF_ERROR (result_add (dm, "operator "));
+      /* Demangle the converted-to type.  */
+      RETURN_IF_ERROR (demangle_type (dm));
+      *num_args = 0;
+      return STATUS_OK;
+    }
+
+  /* Perform a binary search for the operator code.  */
+  while (1)
+    {
+      const struct operator_code* p = p1 + (p2 - p1) / 2;
+      char match0 = p->code[0];
+      char match1 = p->code[1];
+
+      if (c0 == match0 && c1 == match1)
+	/* Found it.  */
+	{
+	  if (!short_name)
+	    RETURN_IF_ERROR (result_add (dm, "operator"));
+	  RETURN_IF_ERROR (result_add (dm, p->name));
+	  *num_args = p->num_args;
+
+	  return STATUS_OK;
+	}
+
+      if (p == p1)
+	/* Couldn't find it.  */
+	return "Unknown code in <operator-name>.";
+
+      /* Try again.  */
+      if (c0 < match0 || (c0 == match0 && c1 < match1))
+	p2 = p;
+      else
+	p1 = p;
+    }
+}
+
+/* Demangles and omits an <nv-offset>.
+
+    <nv-offset> ::= <offset number>   # non-virtual base override  */
+
+static status_t
+demangle_nv_offset (dm)
+     demangling_t dm;
+{
+  dyn_string_t number;
+  status_t status = STATUS_OK;
+
+  DEMANGLE_TRACE ("h-offset", dm);
+
+  /* Demangle the offset.  */
+  number = dyn_string_new (4);
+  if (number == NULL)
+    return STATUS_ALLOCATION_FAILED;
+  demangle_number_literally (dm, number, 10, 1);
+
+  /* Don't display the offset unless in verbose mode.  */
+  if (flag_verbose)
+    {
+      status = result_add (dm, " [nv:");
+      if (STATUS_NO_ERROR (status))
+	status = result_add_string (dm, number);
+      if (STATUS_NO_ERROR (status))
+	status = result_add_char (dm, ']');
+    }
+
+  /* Clean up.  */
+  dyn_string_delete (number);
+  RETURN_IF_ERROR (status);
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <v-offset>. 
+
+    <v-offset>  ::= <offset number> _ <virtual offset number>
+			# virtual base override, with vcall offset  */
+
+static status_t
+demangle_v_offset (dm)
+     demangling_t dm;
+{
+  dyn_string_t number;
+  status_t status = STATUS_OK;
+
+  DEMANGLE_TRACE ("v-offset", dm);
+
+  /* Demangle the offset.  */
+  number = dyn_string_new (4);
+  if (number == NULL)
+    return STATUS_ALLOCATION_FAILED;
+  demangle_number_literally (dm, number, 10, 1);
+
+  /* Don't display the offset unless in verbose mode.  */
+  if (flag_verbose)
+    {
+      status = result_add (dm, " [v:");
+      if (STATUS_NO_ERROR (status))
+	status = result_add_string (dm, number);
+      if (STATUS_NO_ERROR (status))
+	result_add_char (dm, ',');
+    }
+  dyn_string_delete (number);
+  RETURN_IF_ERROR (status);
+
+  /* Demangle the separator.  */
+  RETURN_IF_ERROR (demangle_char (dm, '_'));
+
+  /* Demangle the vcall offset.  */
+  number = dyn_string_new (4);
+  if (number == NULL)
+    return STATUS_ALLOCATION_FAILED;
+  demangle_number_literally (dm, number, 10, 1);
+
+  /* Don't display the vcall offset unless in verbose mode.  */
+  if (flag_verbose)
+    {
+      status = result_add_string (dm, number);
+      if (STATUS_NO_ERROR (status))
+	status = result_add_char (dm, ']');
+    }
+  dyn_string_delete (number);
+  RETURN_IF_ERROR (status);
+
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <call-offset>.
+
+    <call-offset> ::= h <nv-offset> _
+		  ::= v <v-offset> _  */
+
+static status_t
+demangle_call_offset (dm)
+     demangling_t dm;
+{
+  DEMANGLE_TRACE ("call-offset", dm);
+
+  switch (peek_char (dm))
+    {
+    case 'h':
+      advance_char (dm);
+      /* Demangle the offset.  */
+      RETURN_IF_ERROR (demangle_nv_offset (dm));
+      /* Demangle the separator.  */
+      RETURN_IF_ERROR (demangle_char (dm, '_'));
+      break;
+
+    case 'v':
+      advance_char (dm);
+      /* Demangle the offset.  */
+      RETURN_IF_ERROR (demangle_v_offset (dm));
+      /* Demangle the separator.  */
+      RETURN_IF_ERROR (demangle_char (dm, '_'));
+      break;
+
+    default:
+      return "Unrecognized <call-offset>.";
+    }
+
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <special-name>.  
+
+    <special-name> ::= GV <object name>   # Guard variable
+                   ::= TV <type>          # virtual table
+                   ::= TT <type>          # VTT
+                   ::= TI <type>          # typeinfo structure
+		   ::= TS <type>          # typeinfo name  
+
+   Other relevant productions include thunks:
+
+    <special-name> ::= T <call-offset> <base encoding>
+ 			 # base is the nominal target function of thunk
+
+    <special-name> ::= Tc <call-offset> <call-offset> <base encoding>
+			 # base is the nominal target function of thunk
+			 # first call-offset is 'this' adjustment
+			 # second call-offset is result adjustment
+
+   where
+
+    <call-offset>  ::= h <nv-offset> _
+		   ::= v <v-offset> _
+
+   Also demangles the special g++ manglings,
+
+    <special-name> ::= TC <type> <offset number> _ <base type>
+                                          # construction vtable
+		   ::= TF <type>	  # typeinfo function (old ABI only)
+		   ::= TJ <type>	  # java Class structure  */
+
+static status_t
+demangle_special_name (dm)
+     demangling_t dm;
+{
+  dyn_string_t number;
+  int unused;
+  char peek = peek_char (dm);
+
+  DEMANGLE_TRACE ("special-name", dm);
+
+  if (peek == 'G')
+    {
+      /* A guard variable name.  Consume the G.  */
+      advance_char (dm);
+      RETURN_IF_ERROR (demangle_char (dm, 'V'));
+      RETURN_IF_ERROR (result_add (dm, "guard variable for "));
+      RETURN_IF_ERROR (demangle_name (dm, &unused));
+    }
+  else if (peek == 'T')
+    {
+      status_t status = STATUS_OK;
+
+      /* Other C++ implementation miscellania.  Consume the T.  */
+      advance_char (dm);
+
+      switch (peek_char (dm))
+	{
+	case 'V':
+	  /* Virtual table.  */
+	  advance_char (dm);
+	  RETURN_IF_ERROR (result_add (dm, "vtable for "));
+	  RETURN_IF_ERROR (demangle_type (dm));
+	  break;
+
+	case 'T':
+	  /* VTT structure.  */
+	  advance_char (dm);
+	  RETURN_IF_ERROR (result_add (dm, "VTT for "));
+	  RETURN_IF_ERROR (demangle_type (dm));
+	  break;
+
+	case 'I':
+	  /* Typeinfo structure.  */
+	  advance_char (dm);
+	  RETURN_IF_ERROR (result_add (dm, "typeinfo for "));
+	  RETURN_IF_ERROR (demangle_type (dm));
+	  break;
+
+	case 'F':
+	  /* Typeinfo function.  Used only in old ABI with new mangling.  */
+	  advance_char (dm);
+	  RETURN_IF_ERROR (result_add (dm, "typeinfo fn for "));
+	  RETURN_IF_ERROR (demangle_type (dm));
+	  break;
+
+	case 'S':
+	  /* Character string containing type name, used in typeinfo. */
+	  advance_char (dm);
+	  RETURN_IF_ERROR (result_add (dm, "typeinfo name for "));
+	  RETURN_IF_ERROR (demangle_type (dm));
+	  break;
+
+	case 'J':
+	  /* The java Class variable corresponding to a C++ class.  */
+	  advance_char (dm);
+	  RETURN_IF_ERROR (result_add (dm, "java Class for "));
+	  RETURN_IF_ERROR (demangle_type (dm));
+	  break;
+
+	case 'h':
+	  /* Non-virtual thunk.  */
+	  advance_char (dm);
+	  RETURN_IF_ERROR (result_add (dm, "non-virtual thunk"));
+	  RETURN_IF_ERROR (demangle_nv_offset (dm));
+	  /* Demangle the separator.  */
+	  RETURN_IF_ERROR (demangle_char (dm, '_'));
+	  /* Demangle and emit the target name and function type.  */
+	  RETURN_IF_ERROR (result_add (dm, " to "));
+	  RETURN_IF_ERROR (demangle_encoding (dm));
+	  break;
+
+	case 'v':
+	  /* Virtual thunk.  */
+	  advance_char (dm);
+	  RETURN_IF_ERROR (result_add (dm, "virtual thunk"));
+	  RETURN_IF_ERROR (demangle_v_offset (dm));
+	  /* Demangle the separator.  */
+	  RETURN_IF_ERROR (demangle_char (dm, '_'));
+	  /* Demangle and emit the target function.  */
+	  RETURN_IF_ERROR (result_add (dm, " to "));
+	  RETURN_IF_ERROR (demangle_encoding (dm));
+	  break;
+
+	case 'c':
+	  /* Covariant return thunk.  */
+	  advance_char (dm);
+	  RETURN_IF_ERROR (result_add (dm, "covariant return thunk"));
+	  RETURN_IF_ERROR (demangle_call_offset (dm));
+	  RETURN_IF_ERROR (demangle_call_offset (dm));
+	  /* Demangle and emit the target function.  */
+	  RETURN_IF_ERROR (result_add (dm, " to "));
+	  RETURN_IF_ERROR (demangle_encoding (dm));
+	  break;
+
+	case 'C':
+	  /* TC is a special g++ mangling for a construction vtable. */
+	  if (!flag_strict)
+	    {
+	      dyn_string_t derived_type;
+
+	      advance_char (dm);
+	      RETURN_IF_ERROR (result_add (dm, "construction vtable for "));
+
+	      /* Demangle the derived type off to the side.  */
+	      RETURN_IF_ERROR (result_push (dm));
+	      RETURN_IF_ERROR (demangle_type (dm));
+	      derived_type = (dyn_string_t) result_pop (dm);
+
+	      /* Demangle the offset.  */
+	      number = dyn_string_new (4);
+	      if (number == NULL)
+		{
+		  dyn_string_delete (derived_type);
+		  return STATUS_ALLOCATION_FAILED;
+		}
+	      demangle_number_literally (dm, number, 10, 1);
+	      /* Demangle the underscore separator.  */
+	      status = demangle_char (dm, '_');
+
+	      /* Demangle the base type.  */
+	      if (STATUS_NO_ERROR (status))
+		status = demangle_type (dm);
+
+	      /* Emit the derived type.  */
+	      if (STATUS_NO_ERROR (status))
+		status = result_add (dm, "-in-");
+	      if (STATUS_NO_ERROR (status))
+		status = result_add_string (dm, derived_type);
+	      dyn_string_delete (derived_type);
+
+	      /* Don't display the offset unless in verbose mode.  */
+	      if (flag_verbose)
+		{
+		  status = result_add_char (dm, ' ');
+		  if (STATUS_NO_ERROR (status))
+		    result_add_string (dm, number);
+		}
+	      dyn_string_delete (number);
+	      RETURN_IF_ERROR (status);
+	      break;
+	    }
+	  /* If flag_strict, fall through.  */
+
+	default:
+	  return "Unrecognized <special-name>.";
+	}
+    }
+  else
+    return STATUS_ERROR;
+
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <ctor-dtor-name>.  
+   
+    <ctor-dtor-name>
+                   ::= C1  # complete object (in-charge) ctor
+                   ::= C2  # base object (not-in-charge) ctor
+                   ::= C3  # complete object (in-charge) allocating ctor
+                   ::= D0  # deleting (in-charge) dtor
+                   ::= D1  # complete object (in-charge) dtor
+                   ::= D2  # base object (not-in-charge) dtor  */
+
+static status_t
+demangle_ctor_dtor_name (dm)
+     demangling_t dm;
+{
+  static const char *const ctor_flavors[] = 
+  {
+    "in-charge",
+    "not-in-charge",
+    "allocating"
+  };
+  static const char *const dtor_flavors[] = 
+  {
+    "in-charge deleting",
+    "in-charge",
+    "not-in-charge"
+  };
+
+  int flavor;
+  char peek = peek_char (dm);
+
+  DEMANGLE_TRACE ("ctor-dtor-name", dm);
+  
+  if (peek == 'C')
+    {
+      /* A constructor name.  Consume the C.  */
+      advance_char (dm);
+      if (peek_char (dm) < '1' || peek_char (dm) > '3')
+	return "Unrecognized constructor.";
+      RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name));
+      /* Print the flavor of the constructor if in verbose mode.  */
+      flavor = next_char (dm) - '1';
+      if (flag_verbose)
+	{
+	  RETURN_IF_ERROR (result_add (dm, "["));
+	  RETURN_IF_ERROR (result_add (dm, ctor_flavors[flavor]));
+	  RETURN_IF_ERROR (result_add_char (dm, ']'));
+	}
+    }
+  else if (peek == 'D')
+    {
+      /* A destructor name.  Consume the D.  */
+      advance_char (dm);
+      if (peek_char (dm) < '0' || peek_char (dm) > '2')
+	return "Unrecognized destructor.";
+      RETURN_IF_ERROR (result_add_char (dm, '~'));
+      RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name));
+      /* Print the flavor of the destructor if in verbose mode.  */
+      flavor = next_char (dm) - '0';
+      if (flag_verbose)
+	{
+	  RETURN_IF_ERROR (result_add (dm, " ["));
+	  RETURN_IF_ERROR (result_add (dm, dtor_flavors[flavor]));
+	  RETURN_IF_ERROR (result_add_char (dm, ']'));
+	}
+    }
+  else
+    return STATUS_ERROR;
+
+  return STATUS_OK;
+}
+
+/* Handle pointer, reference, and pointer-to-member cases for
+   demangle_type.  All consecutive `P's, `R's, and 'M's are joined to
+   build a pointer/reference type.  We snarf all these, plus the
+   following <type>, all at once since we need to know whether we have
+   a pointer to data or pointer to function to construct the right
+   output syntax.  C++'s pointer syntax is hairy.  
+
+   This function adds substitution candidates for every nested
+   pointer/reference type it processes, including the outermost, final
+   type, assuming the substitution starts at SUBSTITUTION_START in the
+   demangling result.  For example, if this function demangles
+   `PP3Foo', it will add a substitution for `Foo', `Foo*', and
+   `Foo**', in that order.
+
+   *INSERT_POS is a quantity used internally, when this function calls
+   itself recursively, to figure out where to insert pointer
+   punctuation on the way up.  On entry to this function, INSERT_POS
+   should point to a temporary value, but that value need not be
+   initialized.
+
+     <type> ::= P <type>
+            ::= R <type>
+            ::= <pointer-to-member-type>
+
+     <pointer-to-member-type> ::= M </class/ type> </member/ type>  */
+
+static status_t
+demangle_type_ptr (dm, insert_pos, substitution_start)
+     demangling_t dm;
+     int *insert_pos;
+     int substitution_start;
+{
+  status_t status;
+  int is_substitution_candidate = 1;
+
+  DEMANGLE_TRACE ("type*", dm);
+
+  /* Scan forward, collecting pointers and references into symbols,
+     until we hit something else.  Then emit the type.  */
+  switch (peek_char (dm))
+    {
+    case 'P':
+      /* A pointer.  Snarf the `P'.  */
+      advance_char (dm);
+      /* Demangle the underlying type.  */
+      RETURN_IF_ERROR (demangle_type_ptr (dm, insert_pos, 
+					  substitution_start));
+      /* Insert an asterisk where we're told to; it doesn't
+	 necessarily go at the end.  */
+      RETURN_IF_ERROR (result_insert_char (dm, *insert_pos, '*'));
+      /* The next (outermost) pointer or reference character should go
+	 after this one.  */
+      ++(*insert_pos);
+      break;
+
+    case 'R':
+      /* A reference.  Snarf the `R'.  */
+      advance_char (dm);
+      /* Demangle the underlying type.  */
+      RETURN_IF_ERROR (demangle_type_ptr (dm, insert_pos, 
+					  substitution_start));
+      /* Insert an ampersand where we're told to; it doesn't
+	 necessarily go at the end.  */
+      RETURN_IF_ERROR (result_insert_char (dm, *insert_pos, '&'));
+      /* The next (outermost) pointer or reference character should go
+	 after this one.  */
+      ++(*insert_pos);
+      break;
+
+    case 'M':
+    {
+      /* A pointer-to-member.  */
+      dyn_string_t class_type;
+      
+      /* Eat the 'M'.  */
+      advance_char (dm);
+      
+      /* Capture the type of which this is a pointer-to-member.  */
+      RETURN_IF_ERROR (result_push (dm));
+      RETURN_IF_ERROR (demangle_type (dm));
+      class_type = (dyn_string_t) result_pop (dm);
+      
+      if (peek_char (dm) == 'F')
+	/* A pointer-to-member function.  We want output along the
+	   lines of `void (C::*) (int, int)'.  Demangle the function
+	   type, which would in this case give `void () (int, int)'
+	   and set *insert_pos to the spot between the first
+	   parentheses.  */
+	status = demangle_type_ptr (dm, insert_pos, substitution_start);
+      else if (peek_char (dm) == 'A')
+	/* A pointer-to-member array variable.  We want output that
+	   looks like `int (Klass::*) [10]'.  Demangle the array type
+	   as `int () [10]', and set *insert_pos to the spot between
+	   the parentheses.  */
+	status = demangle_array_type (dm, insert_pos);
+      else
+        {
+	  /* A pointer-to-member variable.  Demangle the type of the
+             pointed-to member.  */
+	  status = demangle_type (dm);
+	  /* Make it pretty.  */
+	  if (STATUS_NO_ERROR (status)
+	      && !result_previous_char_is_space (dm))
+	    status = result_add_char (dm, ' ');
+	  /* The pointer-to-member notation (e.g. `C::*') follows the
+             member's type.  */
+	  *insert_pos = result_caret_pos (dm);
+	}
+
+      /* Build the pointer-to-member notation.  */
+      if (STATUS_NO_ERROR (status))
+	status = result_insert (dm, *insert_pos, "::*");
+      if (STATUS_NO_ERROR (status))
+	status = result_insert_string (dm, *insert_pos, class_type);
+      /* There may be additional levels of (pointer or reference)
+	 indirection in this type.  If so, the `*' and `&' should be
+	 added after the pointer-to-member notation (e.g. `C::*&' for
+	 a reference to a pointer-to-member of class C).  */
+      *insert_pos += dyn_string_length (class_type) + 3;
+
+      /* Clean up. */
+      dyn_string_delete (class_type);
+
+      RETURN_IF_ERROR (status);
+    }
+    break;
+
+    case 'F':
+      /* Ooh, tricky, a pointer-to-function.  When we demangle the
+	 function type, the return type should go at the very
+	 beginning.  */
+      *insert_pos = result_caret_pos (dm);
+      /* The parentheses indicate this is a function pointer or
+	 reference type.  */
+      RETURN_IF_ERROR (result_add (dm, "()"));
+      /* Now demangle the function type.  The return type will be
+	 inserted before the `()', and the argument list will go after
+	 it.  */
+      RETURN_IF_ERROR (demangle_function_type (dm, insert_pos));
+      /* We should now have something along the lines of 
+	 `void () (int, int)'.  The pointer or reference characters
+	 have to inside the first set of parentheses.  *insert_pos has
+	 already been updated to point past the end of the return
+	 type.  Move it one character over so it points inside the
+	 `()'.  */
+      ++(*insert_pos);
+      break;
+
+    case 'A':
+      /* An array pointer or reference.  demangle_array_type will figure
+	 out where the asterisks and ampersands go.  */
+      RETURN_IF_ERROR (demangle_array_type (dm, insert_pos));
+      break;
+
+    default:
+      /* No more pointer or reference tokens; this is therefore a
+	 pointer to data.  Finish up by demangling the underlying
+	 type.  */
+      RETURN_IF_ERROR (demangle_type (dm));
+      /* The pointer or reference characters follow the underlying
+	 type, as in `int*&'.  */
+      *insert_pos = result_caret_pos (dm);
+      /* Because of the production <type> ::= <substitution>,
+	 demangle_type will already have added the underlying type as
+	 a substitution candidate.  Don't do it again.  */
+      is_substitution_candidate = 0;
+      break;
+    }
+  
+  if (is_substitution_candidate)
+    RETURN_IF_ERROR (substitution_add (dm, substitution_start, 0));
+  
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <type>.  
+
+    <type> ::= <builtin-type>
+	   ::= <function-type>
+	   ::= <class-enum-type>
+	   ::= <array-type>
+	   ::= <pointer-to-member-type>
+	   ::= <template-param>
+	   ::= <template-template-param> <template-args>
+           ::= <CV-qualifiers> <type>
+	   ::= P <type>   # pointer-to
+	   ::= R <type>   # reference-to
+	   ::= C <type>   # complex pair (C 2000)
+	   ::= G <type>   # imaginary (C 2000)
+	   ::= U <source-name> <type>     # vendor extended type qualifier
+	   ::= <substitution>  */
+
+static status_t
+demangle_type (dm)
+     demangling_t dm;
+{
+  int start = substitution_start (dm);
+  char peek = peek_char (dm);
+  char peek_next;
+  int encode_return_type = 0;
+  template_arg_list_t old_arg_list = current_template_arg_list (dm);
+  int insert_pos;
+
+  /* A <type> can be a <substitution>; therefore, this <type> is a
+     substitution candidate unless a special condition holds (see
+     below).  */
+  int is_substitution_candidate = 1;
+
+  DEMANGLE_TRACE ("type", dm);
+
+  /* A <class-enum-type> can start with a digit (a <source-name>), an
+     N (a <nested-name>), or a Z (a <local-name>).  */
+  if (IS_DIGIT ((unsigned char) peek) || peek == 'N' || peek == 'Z')
+    RETURN_IF_ERROR (demangle_class_enum_type (dm, &encode_return_type));
+  /* Lower-case letters begin <builtin-type>s, except for `r', which
+     denotes restrict.  */
+  else if (peek >= 'a' && peek <= 'z' && peek != 'r')
+    {
+      RETURN_IF_ERROR (demangle_builtin_type (dm));
+      /* Built-in types are not substitution candidates.  */
+      is_substitution_candidate = 0;
+    }
+  else
+    switch (peek)
+      {
+      case 'r':
+      case 'V':
+      case 'K':
+	/* CV-qualifiers (including restrict).  We have to demangle
+	   them off to the side, since C++ syntax puts them in a funny
+	   place for qualified pointer and reference types.  */
+	{
+	  status_t status;
+	  dyn_string_t cv_qualifiers = dyn_string_new (24);
+	  int old_caret_position = result_get_caret (dm);
+
+	  if (cv_qualifiers == NULL)
+	    return STATUS_ALLOCATION_FAILED;
+
+	  /* Decode all adjacent CV qualifiers.  */
+	  demangle_CV_qualifiers (dm, cv_qualifiers);
+	  /* Emit them, and shift the caret left so that the
+	     underlying type will be emitted before the qualifiers.  */
+	  status = result_add_string (dm, cv_qualifiers);
+	  result_shift_caret (dm, -dyn_string_length (cv_qualifiers));
+	  /* Clean up.  */
+	  dyn_string_delete (cv_qualifiers);
+	  RETURN_IF_ERROR (status);
+	  /* Also prepend a blank, if needed.  */
+	  RETURN_IF_ERROR (result_add_char (dm, ' '));
+	  result_shift_caret (dm, -1);
+
+	  /* Demangle the underlying type.  It will be emitted before
+	     the CV qualifiers, since we moved the caret.  */
+	  RETURN_IF_ERROR (demangle_type (dm));
+
+	  /* Put the caret back where it was previously.  */
+	  result_set_caret (dm, old_caret_position);
+	}
+	break;
+
+      case 'F':
+	return "Non-pointer or -reference function type.";
+
+      case 'A':
+	RETURN_IF_ERROR (demangle_array_type (dm, NULL));
+	break;
+
+      case 'T':
+	/* It's either a <template-param> or a
+	   <template-template-param>.  In either case, demangle the
+	   `T' token first.  */
+	RETURN_IF_ERROR (demangle_template_param (dm));
+
+	/* Check for a template argument list; if one is found, it's a
+	     <template-template-param> ::= <template-param>
+                                       ::= <substitution>  */
+	if (peek_char (dm) == 'I')
+	  {
+	    /* Add a substitution candidate.  The template parameter
+	       `T' token is a substitution candidate by itself,
+	       without the template argument list.  */
+	    RETURN_IF_ERROR (substitution_add (dm, start, encode_return_type));
+
+	    /* Now demangle the template argument list.  */
+	    RETURN_IF_ERROR (demangle_template_args (dm));
+	    /* The entire type, including the template template
+	       parameter and its argument list, will be added as a
+	       substitution candidate below.  */
+	  }
+
+	break;
+
+      case 'S':
+	/* First check if this is a special substitution.  If it is,
+	   this is a <class-enum-type>.  Special substitutions have a
+	   letter following the `S'; other substitutions have a digit
+	   or underscore.  */
+	peek_next = peek_char_next (dm);
+	if (IS_DIGIT (peek_next) || peek_next == '_')
+	  {
+	    RETURN_IF_ERROR (demangle_substitution (dm, &encode_return_type));
+	    
+	    /* The substituted name may have been a template name.
+	       Check if template arguments follow, and if so, demangle
+	       them.  */
+	    if (peek_char (dm) == 'I')
+	      RETURN_IF_ERROR (demangle_template_args (dm));
+	    else
+	      /* A substitution token is not itself a substitution
+		 candidate.  (However, if the substituted template is
+		 instantiated, the resulting type is.)  */
+	      is_substitution_candidate = 0;
+	  }
+	else
+	  {
+	    /* Now some trickiness.  We have a special substitution
+	       here.  Often, the special substitution provides the
+	       name of a template that's subsequently instantiated,
+	       for instance `SaIcE' => std::allocator<char>.  In these
+	       cases we need to add a substitution candidate for the
+	       entire <class-enum-type> and thus don't want to clear
+	       the is_substitution_candidate flag.
+
+	       However, it's possible that what we have here is a
+	       substitution token representing an entire type, such as
+	       `Ss' => std::string.  In this case, we mustn't add a
+	       new substitution candidate for this substitution token.
+	       To detect this case, remember where the start of the
+	       substitution token is.  */
+ 	    const char *next = dm->next;
+	    /* Now demangle the <class-enum-type>.  */
+	    RETURN_IF_ERROR 
+	      (demangle_class_enum_type (dm, &encode_return_type));
+	    /* If all that was just demangled is the two-character
+	       special substitution token, supress the addition of a
+	       new candidate for it.  */
+	    if (dm->next == next + 2)
+	      is_substitution_candidate = 0;
+	  }
+
+	break;
+
+      case 'P':
+      case 'R':
+      case 'M':
+	RETURN_IF_ERROR (demangle_type_ptr (dm, &insert_pos, start));
+	/* demangle_type_ptr adds all applicable substitution
+	   candidates.  */
+	is_substitution_candidate = 0;
+	break;
+
+      case 'C':
+	/* A C99 complex type.  */
+	RETURN_IF_ERROR (result_add (dm, "complex "));
+	advance_char (dm);
+	RETURN_IF_ERROR (demangle_type (dm));
+	break;
+
+      case 'G':
+	/* A C99 imaginary type.  */
+	RETURN_IF_ERROR (result_add (dm, "imaginary "));
+	advance_char (dm);
+	RETURN_IF_ERROR (demangle_type (dm));
+	break;
+
+      case 'U':
+	/* Vendor-extended type qualifier.  */
+	advance_char (dm);
+	RETURN_IF_ERROR (demangle_source_name (dm));
+	RETURN_IF_ERROR (result_add_char (dm, ' '));
+	RETURN_IF_ERROR (demangle_type (dm));
+	break;
+
+      default:
+	return "Unexpected character in <type>.";
+      }
+
+  if (is_substitution_candidate)
+    /* Add a new substitution for the type. If this type was a
+       <template-param>, pass its index since from the point of
+       substitutions; a <template-param> token is a substitution
+       candidate distinct from the type that is substituted for it.  */
+    RETURN_IF_ERROR (substitution_add (dm, start, encode_return_type));
+
+  /* Pop off template argument lists added during mangling of this
+     type.  */
+  pop_to_template_arg_list (dm, old_arg_list);
+
+  return STATUS_OK;
+}
+
+/* C++ source names of builtin types, indexed by the mangled code
+   letter's position in the alphabet ('a' -> 0, 'b' -> 1, etc).  */
+static const char *const builtin_type_names[26] = 
+{
+  "signed char",              /* a */
+  "bool",                     /* b */
+  "char",                     /* c */
+  "double",                   /* d */
+  "long double",              /* e */
+  "float",                    /* f */
+  "__float128",               /* g */
+  "unsigned char",            /* h */
+  "int",                      /* i */
+  "unsigned",                 /* j */
+  NULL,                       /* k */
+  "long",                     /* l */
+  "unsigned long",            /* m */
+  "__int128",                 /* n */
+  "unsigned __int128",        /* o */
+  NULL,                       /* p */
+  NULL,                       /* q */
+  NULL,                       /* r */
+  "short",                    /* s */
+  "unsigned short",           /* t */
+  NULL,                       /* u */
+  "void",                     /* v */
+  "wchar_t",                  /* w */
+  "long long",                /* x */
+  "unsigned long long",       /* y */
+  "..."                       /* z */
+};
+
+/* Demangles and emits a <builtin-type>.  
+
+    <builtin-type> ::= v  # void
+		   ::= w  # wchar_t
+		   ::= b  # bool
+		   ::= c  # char
+		   ::= a  # signed char
+		   ::= h  # unsigned char
+		   ::= s  # short
+		   ::= t  # unsigned short
+		   ::= i  # int
+		   ::= j  # unsigned int
+		   ::= l  # long
+		   ::= m  # unsigned long
+		   ::= x  # long long, __int64
+		   ::= y  # unsigned long long, __int64
+		   ::= n  # __int128
+		   ::= o  # unsigned __int128
+		   ::= f  # float
+		   ::= d  # double
+		   ::= e  # long double, __float80
+		   ::= g  # __float128
+		   ::= z  # ellipsis
+		   ::= u <source-name>    # vendor extended type  */
+
+static status_t
+demangle_builtin_type (dm)
+     demangling_t dm;
+{
+
+  char code = peek_char (dm);
+
+  DEMANGLE_TRACE ("builtin-type", dm);
+
+  if (code == 'u')
+    {
+      advance_char (dm);
+      RETURN_IF_ERROR (demangle_source_name (dm));
+      return STATUS_OK;
+    }
+  else if (code >= 'a' && code <= 'z')
+    {
+      const char *type_name = builtin_type_names[code - 'a'];
+      if (type_name == NULL)
+	return "Unrecognized <builtin-type> code.";
+
+      RETURN_IF_ERROR (result_add (dm, type_name));
+      advance_char (dm);
+      return STATUS_OK;
+    }
+  else
+    return "Non-alphabetic <builtin-type> code.";
+}
+
+/* Demangles all consecutive CV-qualifiers (const, volatile, and
+   restrict) at the current position.  The qualifiers are appended to
+   QUALIFIERS.  Returns STATUS_OK.  */
+
+static status_t
+demangle_CV_qualifiers (dm, qualifiers)
+     demangling_t dm;
+     dyn_string_t qualifiers;
+{
+  DEMANGLE_TRACE ("CV-qualifiers", dm);
+
+  while (1)
+    {
+      switch (peek_char (dm))
+	{
+	case 'r':
+	  if (!dyn_string_append_space (qualifiers))
+	    return STATUS_ALLOCATION_FAILED;
+	  if (!dyn_string_append_cstr (qualifiers, "restrict"))
+	    return STATUS_ALLOCATION_FAILED;
+	  break;
+
+	case 'V':
+	  if (!dyn_string_append_space (qualifiers))
+	    return STATUS_ALLOCATION_FAILED;
+	  if (!dyn_string_append_cstr (qualifiers, "volatile"))
+	    return STATUS_ALLOCATION_FAILED;
+	  break;
+
+	case 'K':
+	  if (!dyn_string_append_space (qualifiers))
+	    return STATUS_ALLOCATION_FAILED;
+	  if (!dyn_string_append_cstr (qualifiers, "const"))
+	    return STATUS_ALLOCATION_FAILED;
+	  break;
+
+	default:
+	  return STATUS_OK;
+	}
+
+      advance_char (dm);
+    }
+}
+
+/* Demangles and emits a <function-type>.  *FUNCTION_NAME_POS is the
+   position in the result string of the start of the function
+   identifier, at which the function's return type will be inserted;
+   *FUNCTION_NAME_POS is updated to position past the end of the
+   function's return type.
+
+    <function-type> ::= F [Y] <bare-function-type> E  */
+
+static status_t
+demangle_function_type (dm, function_name_pos)
+     demangling_t dm;
+     int *function_name_pos;
+{
+  DEMANGLE_TRACE ("function-type", dm);
+  RETURN_IF_ERROR (demangle_char (dm, 'F'));  
+  if (peek_char (dm) == 'Y')
+    {
+      /* Indicate this function has C linkage if in verbose mode.  */
+      if (flag_verbose)
+	RETURN_IF_ERROR (result_add (dm, " [extern \"C\"] "));
+      advance_char (dm);
+    }
+  RETURN_IF_ERROR (demangle_bare_function_type (dm, function_name_pos));
+  RETURN_IF_ERROR (demangle_char (dm, 'E'));
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <bare-function-type>.  RETURN_TYPE_POS is the
+   position in the result string at which the function return type
+   should be inserted.  If RETURN_TYPE_POS is BFT_NO_RETURN_TYPE, the
+   function's return type is assumed not to be encoded.  
+
+    <bare-function-type> ::= <signature type>+  */
+
+static status_t
+demangle_bare_function_type (dm, return_type_pos)
+     demangling_t dm;
+     int *return_type_pos;
+{
+  /* Sequence is the index of the current function parameter, counting
+     from zero.  The value -1 denotes the return type.  */
+  int sequence = 
+    (return_type_pos == BFT_NO_RETURN_TYPE ? 0 : -1);
+
+  DEMANGLE_TRACE ("bare-function-type", dm);
+
+  RETURN_IF_ERROR (result_add_char (dm, '('));
+  while (!end_of_name_p (dm) && peek_char (dm) != 'E')
+    {
+      if (sequence == -1)
+	/* We're decoding the function's return type.  */
+	{
+	  dyn_string_t return_type;
+	  status_t status = STATUS_OK;
+
+	  /* Decode the return type off to the side.  */
+	  RETURN_IF_ERROR (result_push (dm));
+	  RETURN_IF_ERROR (demangle_type (dm));
+	  return_type = (dyn_string_t) result_pop (dm);
+
+	  /* Add a space to the end of the type.  Insert the return
+             type where we've been asked to. */
+	  if (!dyn_string_append_space (return_type))
+	    status = STATUS_ALLOCATION_FAILED;
+	  if (STATUS_NO_ERROR (status))
+	    {
+	      if (!dyn_string_insert (result_string (dm), *return_type_pos, 
+				      return_type))
+		status = STATUS_ALLOCATION_FAILED;
+	      else
+		*return_type_pos += dyn_string_length (return_type);
+	    }
+
+	  dyn_string_delete (return_type);
+	  RETURN_IF_ERROR (status);
+	}
+      else 
+	{
+	  /* Skip `void' parameter types.  One should only occur as
+	     the only type in a parameter list; in that case, we want
+	     to print `foo ()' instead of `foo (void)'.  */
+	  if (peek_char (dm) == 'v')
+	    /* Consume the v.  */
+	    advance_char (dm);
+	  else
+	    {
+	      /* Separate parameter types by commas.  */
+	      if (sequence > 0)
+		RETURN_IF_ERROR (result_add (dm, ", "));
+	      /* Demangle the type.  */
+	      RETURN_IF_ERROR (demangle_type (dm));
+	    }
+	}
+
+      ++sequence;
+    }
+  RETURN_IF_ERROR (result_add_char (dm, ')'));
+
+  /* We should have demangled at least one parameter type (which would
+     be void, for a function that takes no parameters), plus the
+     return type, if we were supposed to demangle that.  */
+  if (sequence == -1)
+    return "Missing function return type.";
+  else if (sequence == 0)
+    return "Missing function parameter.";
+
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <class-enum-type>.  *ENCODE_RETURN_TYPE is set to
+   non-zero if the type is a template-id, zero otherwise.  
+
+    <class-enum-type> ::= <name>  */
+
+static status_t
+demangle_class_enum_type (dm, encode_return_type)
+     demangling_t dm;
+     int *encode_return_type;
+{
+  DEMANGLE_TRACE ("class-enum-type", dm);
+
+  RETURN_IF_ERROR (demangle_name (dm, encode_return_type));
+  return STATUS_OK;
+}
+
+/* Demangles and emits an <array-type>.  
+
+   If PTR_INSERT_POS is not NULL, the array type is formatted as a
+   pointer or reference to an array, except that asterisk and
+   ampersand punctuation is omitted (since it's not know at this
+   point).  *PTR_INSERT_POS is set to the position in the demangled
+   name at which this punctuation should be inserted.  For example,
+   `A10_i' is demangled to `int () [10]' and *PTR_INSERT_POS points
+   between the parentheses.
+
+   If PTR_INSERT_POS is NULL, the array type is assumed not to be
+   pointer- or reference-qualified.  Then, for example, `A10_i' is
+   demangled simply as `int[10]'.  
+
+    <array-type> ::= A [<dimension number>] _ <element type>  
+                 ::= A <dimension expression> _ <element type>  */
+
+static status_t
+demangle_array_type (dm, ptr_insert_pos)
+     demangling_t dm;
+     int *ptr_insert_pos;
+{
+  status_t status = STATUS_OK;
+  dyn_string_t array_size = NULL;
+  char peek;
+
+  DEMANGLE_TRACE ("array-type", dm);
+
+  RETURN_IF_ERROR (demangle_char (dm, 'A'));
+
+  /* Demangle the array size into array_size.  */
+  peek = peek_char (dm);
+  if (peek == '_')
+    /* Array bound is omitted.  This is a C99-style VLA.  */
+    ;
+  else if (IS_DIGIT (peek_char (dm))) 
+    {
+      /* It looks like a constant array bound.  */
+      array_size = dyn_string_new (10);
+      if (array_size == NULL)
+	return STATUS_ALLOCATION_FAILED;
+      status = demangle_number_literally (dm, array_size, 10, 0);
+    }
+  else
+    {
+      /* Anything is must be an expression for a nont-constant array
+	 bound.  This happens if the array type occurs in a template
+	 and the array bound references a template parameter.  */
+      RETURN_IF_ERROR (result_push (dm));
+      RETURN_IF_ERROR (demangle_expression (dm));
+      array_size = (dyn_string_t) result_pop (dm);
+    }
+  /* array_size may have been allocated by now, so we can't use
+     RETURN_IF_ERROR until it's been deallocated.  */
+
+  /* Demangle the base type of the array.  */
+  if (STATUS_NO_ERROR (status))
+    status = demangle_char (dm, '_');
+  if (STATUS_NO_ERROR (status))
+    status = demangle_type (dm);
+
+  if (ptr_insert_pos != NULL)
+    {
+      /* This array is actually part of an pointer- or
+	 reference-to-array type.  Format appropriately, except we
+	 don't know which and how much punctuation to use.  */
+      if (STATUS_NO_ERROR (status))
+	status = result_add (dm, " () ");
+      /* Let the caller know where to insert the punctuation.  */
+      *ptr_insert_pos = result_caret_pos (dm) - 2;
+    }
+
+  /* Emit the array dimension syntax.  */
+  if (STATUS_NO_ERROR (status))
+    status = result_add_char (dm, '[');
+  if (STATUS_NO_ERROR (status) && array_size != NULL)
+    status = result_add_string (dm, array_size);
+  if (STATUS_NO_ERROR (status))
+    status = result_add_char (dm, ']');
+  if (array_size != NULL)
+    dyn_string_delete (array_size);
+  
+  RETURN_IF_ERROR (status);
+
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <template-param>.  
+
+    <template-param> ::= T_       # first template parameter
+                     ::= T <parameter-2 number> _  */
+
+static status_t
+demangle_template_param (dm)
+     demangling_t dm;
+{
+  int parm_number;
+  template_arg_list_t current_arg_list = current_template_arg_list (dm);
+  string_list_t arg;
+
+  DEMANGLE_TRACE ("template-param", dm);
+
+  /* Make sure there is a template argmust list in which to look up
+     this parameter reference.  */
+  if (current_arg_list == NULL)
+    return "Template parameter outside of template.";
+
+  RETURN_IF_ERROR (demangle_char (dm, 'T'));
+  if (peek_char (dm) == '_')
+    parm_number = 0;
+  else
+    {
+      RETURN_IF_ERROR (demangle_number (dm, &parm_number, 10, 0));
+      ++parm_number;
+    }
+  RETURN_IF_ERROR (demangle_char (dm, '_'));
+
+  arg = template_arg_list_get_arg (current_arg_list, parm_number);
+  if (arg == NULL)
+    /* parm_number exceeded the number of arguments in the current
+       template argument list.  */
+    return "Template parameter number out of bounds.";
+  RETURN_IF_ERROR (result_add_string (dm, (dyn_string_t) arg));
+
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <template-args>.  
+
+    <template-args> ::= I <template-arg>+ E  */
+
+static status_t
+demangle_template_args (dm)
+     demangling_t dm;
+{
+  int first = 1;
+  dyn_string_t old_last_source_name;
+  template_arg_list_t arg_list = template_arg_list_new ();
+
+  if (arg_list == NULL)
+    return STATUS_ALLOCATION_FAILED;
+
+  /* Preserve the most recently demangled source name.  */
+  old_last_source_name = dm->last_source_name;
+  dm->last_source_name = dyn_string_new (0);
+
+  DEMANGLE_TRACE ("template-args", dm);
+
+  if (dm->last_source_name == NULL)
+    return STATUS_ALLOCATION_FAILED;
+
+  RETURN_IF_ERROR (demangle_char (dm, 'I'));
+  RETURN_IF_ERROR (result_open_template_list (dm));
+  do
+    {
+      string_list_t arg;
+
+      if (first)
+	first = 0;
+      else
+	RETURN_IF_ERROR (result_add (dm, ", "));
+
+      /* Capture the template arg.  */
+      RETURN_IF_ERROR (result_push (dm));
+      RETURN_IF_ERROR (demangle_template_arg (dm));
+      arg = result_pop (dm);
+
+      /* Emit it in the demangled name.  */
+      RETURN_IF_ERROR (result_add_string (dm, (dyn_string_t) arg));
+
+      /* Save it for use in expanding <template-param>s.  */
+      template_arg_list_add_arg (arg_list, arg);
+    }
+  while (peek_char (dm) != 'E');
+  /* Append the '>'.  */
+  RETURN_IF_ERROR (result_close_template_list (dm));
+
+  /* Consume the 'E'.  */
+  advance_char (dm);
+
+  /* Restore the most recent demangled source name.  */
+  dyn_string_delete (dm->last_source_name);
+  dm->last_source_name = old_last_source_name;
+
+  /* Push the list onto the top of the stack of template argument
+     lists, so that arguments from it are used from now on when
+     expanding <template-param>s.  */
+  push_template_arg_list (dm, arg_list);
+
+  return STATUS_OK;
+}
+
+/* This function, which does not correspond to a production in the
+   mangling spec, handles the `literal' production for both
+   <template-arg> and <expr-primary>.  It does not expect or consume
+   the initial `L' or final `E'.  The demangling is given by:
+
+     <literal> ::= <type> </value/ number>
+
+   and the emitted output is `(type)number'.  */
+
+static status_t
+demangle_literal (dm)
+     demangling_t dm;
+{
+  char peek = peek_char (dm);
+  dyn_string_t value_string;
+  status_t status;
+
+  DEMANGLE_TRACE ("literal", dm);
+
+  if (!flag_verbose && peek >= 'a' && peek <= 'z')
+    {
+      /* If not in verbose mode and this is a builtin type, see if we
+	 can produce simpler numerical output.  In particular, for
+	 integer types shorter than `long', just write the number
+	 without type information; for bools, write `true' or `false'.
+	 Other refinements could be made here too.  */
+
+      /* This constant string is used to map from <builtin-type> codes
+	 (26 letters of the alphabet) to codes that determine how the 
+	 value will be displayed.  The codes are:
+	   b: display as bool
+	   i: display as int
+           l: display as long
+	 A space means the value will be represented using cast
+	 notation. */
+      static const char *const code_map = "ibi    iii ll     ii  i  ";
+
+      char code = code_map[peek - 'a'];
+      /* FIXME: Implement demangling of floats and doubles.  */
+      if (code == 'u')
+	return STATUS_UNIMPLEMENTED;
+      if (code == 'b')
+	{
+	  /* It's a boolean.  */
+	  char value;
+
+	  /* Consume the b.  */
+	  advance_char (dm);
+	  /* Look at the next character.  It should be 0 or 1,
+	     corresponding to false or true, respectively.  */
+	  value = peek_char (dm);
+	  if (value == '0')
+	    RETURN_IF_ERROR (result_add (dm, "false"));
+	  else if (value == '1')
+	    RETURN_IF_ERROR (result_add (dm, "true"));
+	  else
+	    return "Unrecognized bool constant.";
+	  /* Consume the 0 or 1.  */
+	  advance_char (dm);
+	  return STATUS_OK;
+	}
+      else if (code == 'i' || code == 'l')
+	{
+	  /* It's an integer or long.  */
+
+	  /* Consume the type character.  */
+	  advance_char (dm);
+
+	  /* Demangle the number and write it out.  */
+	  value_string = dyn_string_new (0);
+	  status = demangle_number_literally (dm, value_string, 10, 1);
+	  if (STATUS_NO_ERROR (status))
+	    status = result_add_string (dm, value_string);
+	  /* For long integers, append an l.  */
+	  if (code == 'l' && STATUS_NO_ERROR (status))
+	    status = result_add_char (dm, code);
+	  dyn_string_delete (value_string);
+
+	  RETURN_IF_ERROR (status);
+	  return STATUS_OK;
+	}
+      /* ...else code == ' ', so fall through to represent this
+	 literal's type explicitly using cast syntax.  */
+    }
+
+  RETURN_IF_ERROR (result_add_char (dm, '('));
+  RETURN_IF_ERROR (demangle_type (dm));
+  RETURN_IF_ERROR (result_add_char (dm, ')'));
+
+  value_string = dyn_string_new (0);
+  if (value_string == NULL)
+    return STATUS_ALLOCATION_FAILED;
+
+  status = demangle_number_literally (dm, value_string, 10, 1);
+  if (STATUS_NO_ERROR (status))
+    status = result_add_string (dm, value_string);
+  dyn_string_delete (value_string);
+  RETURN_IF_ERROR (status);
+
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <template-arg>.  
+
+    <template-arg> ::= <type>                     # type
+                   ::= L <type> <value number> E  # literal
+                   ::= LZ <encoding> E            # external name
+                   ::= X <expression> E           # expression  */
+
+static status_t
+demangle_template_arg (dm)
+     demangling_t dm;
+{
+  DEMANGLE_TRACE ("template-arg", dm);
+
+  switch (peek_char (dm))
+    {
+    case 'L':
+      advance_char (dm);
+
+      if (peek_char (dm) == 'Z')
+	{
+	  /* External name.  */
+	  advance_char (dm);
+	  /* FIXME: Standard is contradictory here.  */
+	  RETURN_IF_ERROR (demangle_encoding (dm));
+	}
+      else
+	RETURN_IF_ERROR (demangle_literal (dm));
+      RETURN_IF_ERROR (demangle_char (dm, 'E'));
+      break;
+
+    case 'X':
+      /* Expression.  */
+      advance_char (dm);
+      RETURN_IF_ERROR (demangle_expression (dm));
+      RETURN_IF_ERROR (demangle_char (dm, 'E'));
+      break;
+
+    default:
+      RETURN_IF_ERROR (demangle_type (dm));
+      break;
+    }
+
+  return STATUS_OK;
+}
+
+/* Demangles and emits an <expression>.
+
+    <expression> ::= <unary operator-name> <expression>
+		 ::= <binary operator-name> <expression> <expression>
+		 ::= <expr-primary>  
+                 ::= <scope-expression>  */
+
+static status_t
+demangle_expression (dm)
+     demangling_t dm;
+{
+  char peek = peek_char (dm);
+
+  DEMANGLE_TRACE ("expression", dm);
+
+  if (peek == 'L' || peek == 'T')
+    RETURN_IF_ERROR (demangle_expr_primary (dm));
+  else if (peek == 's' && peek_char_next (dm) == 'r')
+    RETURN_IF_ERROR (demangle_scope_expression (dm));
+  else
+    /* An operator expression.  */
+    {
+      int num_args;
+      status_t status = STATUS_OK;
+      dyn_string_t operator_name;
+
+      /* We have an operator name.  Since we want to output binary
+	 operations in infix notation, capture the operator name
+	 first.  */
+      RETURN_IF_ERROR (result_push (dm));
+      RETURN_IF_ERROR (demangle_operator_name (dm, 1, &num_args));
+      operator_name = (dyn_string_t) result_pop (dm);
+
+      /* If it's binary, do an operand first.  */
+      if (num_args > 1)
+	{
+	  status = result_add_char (dm, '(');
+	  if (STATUS_NO_ERROR (status))
+	    status = demangle_expression (dm);
+	  if (STATUS_NO_ERROR (status))
+	    status = result_add_char (dm, ')');
+	}
+
+      /* Emit the operator.  */  
+      if (STATUS_NO_ERROR (status))
+	status = result_add_string (dm, operator_name);
+      dyn_string_delete (operator_name);
+      RETURN_IF_ERROR (status);
+      
+      /* Emit its second (if binary) or only (if unary) operand.  */
+      RETURN_IF_ERROR (result_add_char (dm, '('));
+      RETURN_IF_ERROR (demangle_expression (dm));
+      RETURN_IF_ERROR (result_add_char (dm, ')'));
+
+      /* The ternary operator takes a third operand.  */
+      if (num_args == 3)
+	{
+	  RETURN_IF_ERROR (result_add (dm, ":("));
+	  RETURN_IF_ERROR (demangle_expression (dm));
+	  RETURN_IF_ERROR (result_add_char (dm, ')'));
+	}
+    }
+
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <scope-expression>.  
+
+    <scope-expression> ::= sr <qualifying type> <source-name>
+                       ::= sr <qualifying type> <encoding>  */
+
+static status_t
+demangle_scope_expression (dm)
+     demangling_t dm;
+{
+  RETURN_IF_ERROR (demangle_char (dm, 's'));
+  RETURN_IF_ERROR (demangle_char (dm, 'r'));
+  RETURN_IF_ERROR (demangle_type (dm));
+  RETURN_IF_ERROR (result_add (dm, "::"));
+  RETURN_IF_ERROR (demangle_encoding (dm));
+  return STATUS_OK;
+}
+
+/* Demangles and emits an <expr-primary>.  
+
+    <expr-primary> ::= <template-param>
+		   ::= L <type> <value number> E  # literal
+		   ::= L <mangled-name> E         # external name  */
+
+static status_t
+demangle_expr_primary (dm)
+     demangling_t dm;
+{
+  char peek = peek_char (dm);
+
+  DEMANGLE_TRACE ("expr-primary", dm);
+
+  if (peek == 'T')
+    RETURN_IF_ERROR (demangle_template_param (dm));
+  else if (peek == 'L')
+    {
+      /* Consume the `L'.  */
+      advance_char (dm);
+      peek = peek_char (dm);
+
+      if (peek == '_')
+	RETURN_IF_ERROR (demangle_mangled_name (dm));
+      else
+	RETURN_IF_ERROR (demangle_literal (dm));
+
+      RETURN_IF_ERROR (demangle_char (dm, 'E'));
+    }
+  else
+    return STATUS_ERROR;
+
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <substitution>.  Sets *TEMPLATE_P to non-zero
+   if the substitution is the name of a template, zero otherwise. 
+
+     <substitution> ::= S <seq-id> _
+                    ::= S_
+
+                    ::= St   # ::std::
+                    ::= Sa   # ::std::allocator
+                    ::= Sb   # ::std::basic_string
+                    ::= Ss   # ::std::basic_string<char,
+				    		   ::std::char_traits<char>,
+						   ::std::allocator<char> >
+                    ::= Si   # ::std::basic_istream<char,  
+                                                    std::char_traits<char> >
+                    ::= So   # ::std::basic_ostream<char,  
+                                                    std::char_traits<char> >
+                    ::= Sd   # ::std::basic_iostream<char, 
+                                                    std::char_traits<char> >
+*/
+
+static status_t
+demangle_substitution (dm, template_p)
+     demangling_t dm;
+     int *template_p;
+{
+  int seq_id;
+  int peek;
+  dyn_string_t text;
+
+  DEMANGLE_TRACE ("substitution", dm);
+
+  RETURN_IF_ERROR (demangle_char (dm, 'S'));
+
+  /* Scan the substitution sequence index.  A missing number denotes
+     the first index.  */
+  peek = peek_char (dm);
+  if (peek == '_')
+    seq_id = -1;
+  /* If the following character is 0-9 or a capital letter, interpret
+     the sequence up to the next underscore as a base-36 substitution
+     index.  */
+  else if (IS_DIGIT ((unsigned char) peek) 
+	   || (peek >= 'A' && peek <= 'Z'))
+    RETURN_IF_ERROR (demangle_number (dm, &seq_id, 36, 0));
+  else 
+    {
+      const char *new_last_source_name = NULL;
+
+      switch (peek)
+	{
+	case 't':
+	  RETURN_IF_ERROR (result_add (dm, "std"));
+	  break;
+
+	case 'a':
+	  RETURN_IF_ERROR (result_add (dm, "std::allocator"));
+	  new_last_source_name = "allocator";
+	  *template_p = 1;
+	  break;
+
+	case 'b':
+	  RETURN_IF_ERROR (result_add (dm, "std::basic_string"));
+	  new_last_source_name = "basic_string";
+	  *template_p = 1;
+	  break;
+	  
+	case 's':
+	  if (!flag_verbose)
+	    {
+	      RETURN_IF_ERROR (result_add (dm, "std::string"));
+	      new_last_source_name = "string";
+	    }
+	  else
+	    {
+	      RETURN_IF_ERROR (result_add (dm, "std::basic_string<char, std::char_traits<char>, std::allocator<char> >"));
+	      new_last_source_name = "basic_string";
+	    }
+	  *template_p = 0;
+	  break;
+
+	case 'i':
+	  if (!flag_verbose)
+	    {
+	      RETURN_IF_ERROR (result_add (dm, "std::istream"));
+	      new_last_source_name = "istream";
+	    }
+	  else
+	    {
+	      RETURN_IF_ERROR (result_add (dm, "std::basic_istream<char, std::char_traints<char> >"));
+	      new_last_source_name = "basic_istream";
+	    }
+	  *template_p = 0;
+	  break;
+
+	case 'o':
+	  if (!flag_verbose)
+	    {
+	      RETURN_IF_ERROR (result_add (dm, "std::ostream"));
+	      new_last_source_name = "ostream";
+	    }
+	  else
+	    {
+	      RETURN_IF_ERROR (result_add (dm, "std::basic_ostream<char, std::char_traits<char> >"));
+	      new_last_source_name = "basic_ostream";
+	    }
+	  *template_p = 0;
+	  break;
+
+	case 'd':
+	  if (!flag_verbose) 
+	    {
+	      RETURN_IF_ERROR (result_add (dm, "std::iostream"));
+	      new_last_source_name = "iostream";
+	    }
+	  else
+	    {
+	      RETURN_IF_ERROR (result_add (dm, "std::basic_iostream<char, std::char_traits<char> >"));
+	      new_last_source_name = "basic_iostream";
+	    }
+	  *template_p = 0;
+	  break;
+
+	default:
+	  return "Unrecognized <substitution>.";
+	}
+      
+      /* Consume the character we just processed.  */
+      advance_char (dm);
+
+      if (new_last_source_name != NULL)
+	{
+	  if (!dyn_string_copy_cstr (dm->last_source_name, 
+				     new_last_source_name))
+	    return STATUS_ALLOCATION_FAILED;
+	}
+
+      return STATUS_OK;
+    }
+
+  /* Look up the substitution text.  Since `S_' is the most recent
+     substitution, `S0_' is the second-most-recent, etc., shift the
+     numbering by one.  */
+  text = substitution_get (dm, seq_id + 1, template_p);
+  if (text == NULL) 
+    return "Substitution number out of range.";
+
+  /* Emit the substitution text.  */
+  RETURN_IF_ERROR (result_add_string (dm, text));
+
+  RETURN_IF_ERROR (demangle_char (dm, '_'));
+  return STATUS_OK;
+}
+
+/* Demangles and emits a <local-name>.  
+
+    <local-name> := Z <function encoding> E <entity name> [<discriminator>]
+                 := Z <function encoding> E s [<discriminator>]  */
+
+static status_t
+demangle_local_name (dm)
+     demangling_t dm;
+{
+  DEMANGLE_TRACE ("local-name", dm);
+
+  RETURN_IF_ERROR (demangle_char (dm, 'Z'));
+  RETURN_IF_ERROR (demangle_encoding (dm));
+  RETURN_IF_ERROR (demangle_char (dm, 'E'));
+  RETURN_IF_ERROR (result_add (dm, "::"));
+
+  if (peek_char (dm) == 's')
+    {
+      /* Local character string literal.  */
+      RETURN_IF_ERROR (result_add (dm, "string literal"));
+      /* Consume the s.  */
+      advance_char (dm);
+      RETURN_IF_ERROR (demangle_discriminator (dm, 0));
+    }
+  else
+    {
+      int unused;
+      /* Local name for some other entity.  Demangle its name.  */
+      RETURN_IF_ERROR (demangle_name (dm, &unused));
+      RETURN_IF_ERROR (demangle_discriminator (dm, 1));
+     }
+
+   return STATUS_OK;
+ }
+
+ /* Optimonally demangles and emits a <discriminator>.  If there is no
+    <discriminator> at the current position in the mangled string, the
+    descriminator is assumed to be zero.  Emit the discriminator number
+    in parentheses, unless SUPPRESS_FIRST is non-zero and the
+    discriminator is zero.  
+
+     <discriminator> ::= _ <number>  */
+
+static status_t
+demangle_discriminator (dm, suppress_first)
+     demangling_t dm;
+     int suppress_first;
+{
+  /* Output for <discriminator>s to the demangled name is completely
+     suppressed if not in verbose mode.  */
+
+  if (peek_char (dm) == '_')
+    {
+      /* Consume the underscore.  */
+      advance_char (dm);
+      if (flag_verbose)
+	RETURN_IF_ERROR (result_add (dm, " [#"));
+      /* Check if there's a number following the underscore.  */
+      if (IS_DIGIT ((unsigned char) peek_char (dm)))
+	{
+	  int discriminator;
+	  /* Demangle the number.  */
+	  RETURN_IF_ERROR (demangle_number (dm, &discriminator, 10, 0));
+	  if (flag_verbose)
+	    /* Write the discriminator.  The mangled number is two
+	       less than the discriminator ordinal, counting from
+	       zero.  */
+	    RETURN_IF_ERROR (int_to_dyn_string (discriminator + 2, 
+						(dyn_string_t) dm->result));
+	}
+      else
+	{
+	  if (flag_verbose)
+	    /* A missing digit correspond to one.  */
+	    RETURN_IF_ERROR (result_add_char (dm, '1'));
+	}
+      if (flag_verbose)
+	RETURN_IF_ERROR (result_add_char (dm, ']'));
+    }
+  else if (!suppress_first)
+    {
+      if (flag_verbose)
+	RETURN_IF_ERROR (result_add (dm, " [#0]"));
+    }
+
+  return STATUS_OK;
+}
+
+/* Demangle NAME into RESULT, which must be an initialized
+   dyn_string_t.  On success, returns STATUS_OK.  On failure, returns
+   an error message, and the contents of RESULT are unchanged.  */
+
+static status_t
+cp_demangle (name, result)
+     const char *name;
+     dyn_string_t result;
+{
+  status_t status;
+  int length = strlen (name);
+
+  if (length > 2 && name[0] == '_' && name[1] == 'Z')
+    {
+      demangling_t dm = demangling_new (name);
+      if (dm == NULL)
+	return STATUS_ALLOCATION_FAILED;
+
+      status = result_push (dm);
+      if (status != STATUS_OK)
+	{
+	  demangling_delete (dm);
+	  return status;
+	}
+
+      status = demangle_mangled_name (dm);
+      if (STATUS_NO_ERROR (status))
+	{
+	  dyn_string_t demangled = (dyn_string_t) result_pop (dm);
+	  if (!dyn_string_copy (result, demangled))
+	    return STATUS_ALLOCATION_FAILED;
+	  dyn_string_delete (demangled);
+	}
+      
+      demangling_delete (dm);
+    }
+  else
+    {
+      /* It's evidently not a mangled C++ name.  It could be the name
+	 of something with C linkage, though, so just copy NAME into
+	 RESULT.  */
+      if (!dyn_string_copy_cstr (result, name))
+	return STATUS_ALLOCATION_FAILED;
+      status = STATUS_OK;
+    }
+
+  return status; 
+}
+
+/* Demangle TYPE_NAME into RESULT, which must be an initialized
+   dyn_string_t.  On success, returns STATUS_OK.  On failiure, returns
+   an error message, and the contents of RESULT are unchanged.  */
+
+#ifdef IN_LIBGCC2
+static status_t
+cp_demangle_type (type_name, result)
+     const char* type_name;
+     dyn_string_t result;
+{
+  status_t status;
+  demangling_t dm = demangling_new (type_name);
+  
+  if (dm == NULL)
+    return STATUS_ALLOCATION_FAILED;
+
+  /* Demangle the type name.  The demangled name is stored in dm.  */
+  status = result_push (dm);
+  if (status != STATUS_OK)
+    {
+      demangling_delete (dm);
+      return status;
+    }
+
+  status = demangle_type (dm);
+
+  if (STATUS_NO_ERROR (status))
+    {
+      /* The demangling succeeded.  Pop the result out of dm and copy
+	 it into RESULT.  */
+      dyn_string_t demangled = (dyn_string_t) result_pop (dm);
+      if (!dyn_string_copy (result, demangled))
+	return STATUS_ALLOCATION_FAILED;
+      dyn_string_delete (demangled);
+    }
+
+  /* Clean up.  */
+  demangling_delete (dm);
+
+  return status;
+}
+
+extern char *__cxa_demangle PARAMS ((const char *, char *, size_t *, int *));
+
+/* ia64 ABI-mandated entry point in the C++ runtime library for performing
+   demangling.  MANGLED_NAME is a NUL-terminated character string
+   containing the name to be demangled.  
+
+   OUTPUT_BUFFER is a region of memory, allocated with malloc, of
+   *LENGTH bytes, into which the demangled name is stored.  If
+   OUTPUT_BUFFER is not long enough, it is expanded using realloc.
+   OUTPUT_BUFFER may instead be NULL; in that case, the demangled name
+   is placed in a region of memory allocated with malloc.  
+
+   If LENGTH is non-NULL, the length of the buffer conaining the
+   demangled name, is placed in *LENGTH.  
+
+   The return value is a pointer to the start of the NUL-terminated
+   demangled name, or NULL if the demangling fails.  The caller is
+   responsible for deallocating this memory using free.  
+
+   *STATUS is set to one of the following values:
+      0: The demangling operation succeeded.
+     -1: A memory allocation failiure occurred.
+     -2: MANGLED_NAME is not a valid name under the C++ ABI mangling rules.
+     -3: One of the arguments is invalid.
+
+   The demagling is performed using the C++ ABI mangling rules, with
+   GNU extensions.  */
+
+char *
+__cxa_demangle (mangled_name, output_buffer, length, status)
+     const char *mangled_name;
+     char *output_buffer;
+     size_t *length;
+     int *status;
+{
+  struct dyn_string demangled_name;
+  status_t result;
+
+  if (status == NULL)
+    return NULL;
+
+  if (mangled_name == NULL) {
+    *status = -3;
+    return NULL;
+  }
+
+  /* Did the caller provide a buffer for the demangled name?  */
+  if (output_buffer == NULL) {
+    /* No; dyn_string will malloc a buffer for us.  */
+    if (!dyn_string_init (&demangled_name, 0)) 
+      {
+	*status = -1;
+	return NULL;
+      }
+  }
+  else {
+    /* Yes.  Check that the length was provided.  */
+    if (length == NULL) {
+      *status = -3;
+      return NULL;
+    }
+    /* Install the buffer into a dyn_string.  */
+    demangled_name.allocated = *length;
+    demangled_name.length = 0;
+    demangled_name.s = output_buffer;
+  }
+
+  if (mangled_name[0] == '_' && mangled_name[1] == 'Z')
+    /* MANGLED_NAME apprears to be a function or variable name.
+       Demangle it accordingly.  */
+    result = cp_demangle (mangled_name, &demangled_name);
+  else
+    /* Try to demangled MANGLED_NAME as the name of a type.  */
+    result = cp_demangle_type (mangled_name, &demangled_name);
+
+  if (result == STATUS_OK) 
+    /* The demangling succeeded.  */
+    {
+      /* If LENGTH isn't NULL, store the allocated buffer length
+	 there; the buffer may have been realloced by dyn_string
+	 functions.  */
+      if (length != NULL)
+	*length = demangled_name.allocated;
+      /* The operation was a success.  */
+      *status = 0;
+      return dyn_string_buf (&demangled_name);
+    }
+  else if (result == STATUS_ALLOCATION_FAILED)
+    /* A call to malloc or realloc failed during the demangling
+       operation.  */
+    {
+      *status = -1;
+      return NULL;
+    }
+  else
+    /* The demangling failed for another reason, most probably because
+       MANGLED_NAME isn't a valid mangled name.  */
+    {
+      /* If the buffer containing the demangled name wasn't provided
+	 by the caller, free it.  */
+      if (output_buffer == NULL)
+	free (dyn_string_buf (&demangled_name));
+      *status = -2;
+      return NULL;
+    }
+}
+
+#else /* !IN_LIBGCC2 */
+
+/* Variant entry point for integration with the existing cplus-dem
+   demangler.  Attempts to demangle MANGLED.  If the demangling
+   succeeds, returns a buffer, allocated with malloc, containing the
+   demangled name.  The caller must deallocate the buffer using free.
+   If the demangling failes, returns NULL.  */
+
+char *
+cplus_demangle_v3 (mangled)
+     const char* mangled;
+{
+  dyn_string_t demangled;
+  status_t status;
+
+  /* If this isn't a mangled name, don't pretend to demangle it.  */
+  if (strncmp (mangled, "_Z", 2) != 0)
+    return NULL;
+
+  /* Create a dyn_string to hold the demangled name.  */
+  demangled = dyn_string_new (0);
+  /* Attempt the demangling.  */
+  status = cp_demangle ((char *) mangled, demangled);
+
+  if (STATUS_NO_ERROR (status))
+    /* Demangling succeeded.  */
+    {
+      /* Grab the demangled result from the dyn_string.  It was
+	 allocated with malloc, so we can return it directly.  */
+      char *return_value = dyn_string_release (demangled);
+      /* Hand back the demangled name.  */
+      return return_value;
+    }
+  else if (status == STATUS_ALLOCATION_FAILED)
+    {
+      fprintf (stderr, "Memory allocation failed.\n");
+      abort ();
+    }
+  else
+    /* Demangling failed.  */
+    {
+      dyn_string_delete (demangled);
+      return NULL;
+    }
+}
+
+#endif /* IN_LIBGCC2 */
+
+#ifdef STANDALONE_DEMANGLER
+
+#include "getopt.h"
+
+static void print_usage
+  PARAMS ((FILE* fp, int exit_value));
+
+/* Non-zero if CHAR is a character than can occur in a mangled name.  */
+#define is_mangled_char(CHAR)                                           \
+  (IS_ALPHA (CHAR) || IS_DIGIT (CHAR)                                   \
+   || (CHAR) == '_' || (CHAR) == '.' || (CHAR) == '$')
+
+/* The name of this program, as invoked.  */
+const char* program_name;
+
+/* Prints usage summary to FP and then exits with EXIT_VALUE.  */
+
+static void
+print_usage (fp, exit_value)
+     FILE* fp;
+     int exit_value;
+{
+  fprintf (fp, "Usage: %s [options] [names ...]\n", program_name);
+  fprintf (fp, "Options:\n");
+  fprintf (fp, "  -h,--help       Display this message.\n");
+  fprintf (fp, "  -s,--strict     Demangle standard names only.\n");
+  fprintf (fp, "  -v,--verbose    Produce verbose demanglings.\n");
+  fprintf (fp, "If names are provided, they are demangled.  Otherwise filters standard input.\n");
+
+  exit (exit_value);
+}
+
+/* Option specification for getopt_long.  */
+static struct option long_options[] = 
+{
+  { "help",    no_argument, NULL, 'h' },
+  { "strict",  no_argument, NULL, 's' },
+  { "verbose", no_argument, NULL, 'v' },
+  { NULL,      no_argument, NULL, 0   },
+};
+
+/* Main entry for a demangling filter executable.  It will demangle
+   its command line arguments, if any.  If none are provided, it will
+   filter stdin to stdout, replacing any recognized mangled C++ names
+   with their demangled equivalents.  */
+
+int
+main (argc, argv)
+     int argc;
+     char *argv[];
+{
+  status_t status;
+  int i;
+  int opt_char;
+
+  /* Use the program name of this program, as invoked.  */
+  program_name = argv[0];
+
+  /* Parse options.  */
+  do 
+    {
+      opt_char = getopt_long (argc, argv, "hsv", long_options, NULL);
+      switch (opt_char)
+	{
+	case '?':  /* Unrecognized option.  */
+	  print_usage (stderr, 1);
+	  break;
+
+	case 'h':
+	  print_usage (stdout, 0);
+	  break;
+
+	case 's':
+	  flag_strict = 1;
+	  break;
+
+	case 'v':
+	  flag_verbose = 1;
+	  break;
+	}
+    }
+  while (opt_char != -1);
+
+  if (optind == argc) 
+    /* No command line arguments were provided.  Filter stdin.  */
+    {
+      dyn_string_t mangled = dyn_string_new (3);
+      dyn_string_t demangled = dyn_string_new (0);
+      status_t status;
+
+      /* Read all of input.  */
+      while (!feof (stdin))
+	{
+	  char c = getchar ();
+
+	  /* The first character of a mangled name is an underscore.  */
+	  if (feof (stdin))
+	    break;
+	  if (c != '_')
+	    {
+	      /* It's not a mangled name.  Print the character and go
+		 on.  */
+	      putchar (c);
+	      continue;
+	    }
+	  c = getchar ();
+	  
+	  /* The second character of a mangled name is a capital `Z'.  */
+	  if (feof (stdin))
+	    break;
+	  if (c != 'Z')
+	    {
+	      /* It's not a mangled name.  Print the previous
+		 underscore, the `Z', and go on.  */
+	      putchar ('_');
+	      putchar (c);
+	      continue;
+	    }
+
+	  /* Start keeping track of the candidate mangled name.  */
+	  dyn_string_append_char (mangled, '_');
+	  dyn_string_append_char (mangled, 'Z');
+
+	  /* Pile characters into mangled until we hit one that can't
+	     occur in a mangled name.  */
+	  c = getchar ();
+	  while (!feof (stdin) && is_mangled_char (c))
+	    {
+	      dyn_string_append_char (mangled, c);
+	      if (feof (stdin))
+		break;
+	      c = getchar ();
+	    }
+
+	  /* Attempt to demangle the name.  */
+	  status = cp_demangle (dyn_string_buf (mangled), demangled);
+
+	  /* If the demangling succeeded, great!  Print out the
+	     demangled version.  */
+	  if (STATUS_NO_ERROR (status))
+	    fputs (dyn_string_buf (demangled), stdout);
+	  /* Abort on allocation failures.  */
+	  else if (status == STATUS_ALLOCATION_FAILED)
+	    {
+	      fprintf (stderr, "Memory allocation failed.\n");
+	      abort ();
+	    }
+	  /* Otherwise, it might not have been a mangled name.  Just
+	     print out the original text.  */
+	  else
+	    fputs (dyn_string_buf (mangled), stdout);
+
+	  /* If we haven't hit EOF yet, we've read one character that
+	     can't occur in a mangled name, so print it out.  */
+	  if (!feof (stdin))
+	    putchar (c);
+
+	  /* Clear the candidate mangled name, to start afresh next
+	     time we hit a `_Z'.  */
+	  dyn_string_clear (mangled);
+	}
+
+      dyn_string_delete (mangled);
+      dyn_string_delete (demangled);
+    }
+  else
+    /* Demangle command line arguments.  */
+    {
+      dyn_string_t result = dyn_string_new (0);
+
+      /* Loop over command line arguments.  */
+      for (i = optind; i < argc; ++i)
+	{
+	  /* Attempt to demangle.  */
+	  status = cp_demangle (argv[i], result);
+
+	  /* If it worked, print the demangled name.  */
+	  if (STATUS_NO_ERROR (status))
+	    printf ("%s\n", dyn_string_buf (result));
+	  /* Abort on allocaiton failures.  */
+	  else if (status == STATUS_ALLOCATION_FAILED)
+	    {
+	      fprintf (stderr, "Memory allocaiton failed.\n");
+	      abort ();
+	    }
+	  /* If not, print the error message to stderr instead.  */
+	  else 
+	    fprintf (stderr, "%s\n", status);
+	}
+      dyn_string_delete (result);
+    }
+
+  return 0;
+}
+
+#endif /* STANDALONE_DEMANGLER */
diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c
index 52249d2..a42f45e 100644
--- a/libiberty/cplus-dem.c
+++ b/libiberty/cplus-dem.c
@@ -1,5 +1,6 @@
 /* Demangler for GNU C++
-   Copyright 1989, 91, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+   Copyright 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999,
+   2000 Free Software Foundation, Inc.
    Written by James Clark (jjc@jclark.uucp)
    Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling
    Modified by Satish Pai (pai@apollo.hp.com) for HP demangling
@@ -33,7 +34,8 @@
 #include "config.h"
 #endif
 
-#include <ctype.h>
+#include "safe-ctype.h"
+
 #include <sys/types.h>
 #include <string.h>
 #include <stdio.h>
@@ -51,6 +53,8 @@
 
 #include "libiberty.h"
 
+static char *ada_demangle  PARAMS ((const char *, int));
+
 #define min(X,Y) (((X) < (Y)) ? (X) : (Y))
 
 /* A value at least one greater than the maximum number of characters
@@ -98,7 +102,7 @@
 #define CPLUS_MARKER '$'
 #endif
 
-enum demangling_styles current_demangling_style = gnu_demangling;
+enum demangling_styles current_demangling_style = auto_demangling;
 
 static char cplus_markers[] = { CPLUS_MARKER, '.', '$', '\0' };
 
@@ -252,6 +256,67 @@
   tk_real
 } type_kind_t;
 
+struct demangler_engine libiberty_demanglers[] =
+{
+  {
+    AUTO_DEMANGLING_STYLE_STRING,
+      auto_demangling,
+      "Automatic selection based on executable"
+  }
+  ,
+  {
+    GNU_DEMANGLING_STYLE_STRING,
+      gnu_demangling,
+      "GNU (g++) style demangling"
+  }
+  ,
+  {
+    LUCID_DEMANGLING_STYLE_STRING,
+      lucid_demangling,
+      "Lucid (lcc) style demangling"
+  }
+  ,
+  {
+    ARM_DEMANGLING_STYLE_STRING,
+      arm_demangling,
+      "ARM style demangling"
+  }
+  ,
+  {
+    HP_DEMANGLING_STYLE_STRING,
+      hp_demangling,
+      "HP (aCC) style demangling"
+  }
+  ,
+  {
+    EDG_DEMANGLING_STYLE_STRING,
+      edg_demangling,
+      "EDG style demangling"
+  }
+  ,
+  {
+    GNU_V3_DEMANGLING_STYLE_STRING,
+    gnu_v3_demangling,
+    "GNU (g++) V3 ABI-style demangling"
+  }
+  ,
+  {
+    JAVA_DEMANGLING_STYLE_STRING,
+    java_demangling,
+    "Java style demangling"
+  }
+  ,
+  {
+    GNAT_DEMANGLING_STYLE_STRING,
+    gnat_demangling,
+    "GNAT style demangling"
+  }
+  ,
+  {
+    NULL, unknown_demangling, NULL
+  }
+};
+
 #define STRING_EMPTY(str)	((str) -> b == (str) -> p)
 #define PREPEND_BLANK(str)	{if (!STRING_EMPTY(str)) \
     string_prepend(str, " ");}
@@ -268,12 +333,21 @@
 
 /* Prototypes for local functions */
 
+static void
+delete_work_stuff PARAMS ((struct work_stuff *));
+
+static void
+delete_non_B_K_work_stuff PARAMS ((struct work_stuff *));
+
 static char *
 mop_up PARAMS ((struct work_stuff *, string *, int));
 
 static void
 squangle_mop_up PARAMS ((struct work_stuff *));
 
+static void
+work_stuff_copy_to_from PARAMS ((struct work_stuff *, struct work_stuff *));
+
 #if 0
 static int
 demangle_method_args PARAMS ((struct work_stuff *, const char **, string *));
@@ -379,6 +453,10 @@
 demangle_function_name PARAMS ((struct work_stuff *, const char **, string *,
 				const char *));
 
+static int
+iterate_demangle_function PARAMS ((struct work_stuff *,
+				   const char **, string *, const char *));
+
 static void
 remember_type PARAMS ((struct work_stuff *, const char *, int));
 
@@ -450,6 +528,9 @@
 recursively_demangle PARAMS ((struct work_stuff *, const char **, string *,
 			      int));
 
+static void
+grow_vect PARAMS ((void **, size_t *, size_t, int));
+
 /* Translate count to integer, consuming tokens in the process.
    Conversion terminates on the first non-digit character.
 
@@ -464,10 +545,10 @@
 {
   int count = 0;
 
-  if (! isdigit ((unsigned char)**type))
+  if (! ISDIGIT ((unsigned char)**type))
     return -1;
 
-  while (isdigit ((unsigned char)**type))
+  while (ISDIGIT ((unsigned char)**type))
     {
       count *= 10;
 
@@ -478,7 +559,7 @@
 	 ten.  */
       if ((count % 10) != 0)
 	{
-	  while (isdigit ((unsigned char) **type))
+	  while (ISDIGIT ((unsigned char) **type))
 	    (*type)++;
 	  return -1;
 	}
@@ -504,7 +585,7 @@
   if (**mangled == '_')
     {
       (*mangled)++;
-      if (!isdigit ((unsigned char)**mangled))
+      if (!ISDIGIT ((unsigned char)**mangled))
 	return -1;
 
       idx = consume_count (mangled);
@@ -636,14 +717,14 @@
 	}
     }
   else if (opname[0] == '_' && opname[1] == '_'
-	   && opname[2] >= 'a' && opname[2] <= 'z'
-	   && opname[3] >= 'a' && opname[3] <= 'z')
+	   && ISLOWER((unsigned char)opname[2])
+	   && ISLOWER((unsigned char)opname[3]))
     {
       if (opname[4] == '\0')
 	{
 	  /* Operator.  */
 	  size_t i;
-	  for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
+	  for (i = 0; i < ARRAY_SIZE (optable); i++)
 	    {
 	      if (strlen (optable[i].in) == 2
 		  && memcmp (optable[i].in, opname + 2, 2) == 0)
@@ -661,7 +742,7 @@
 	    {
 	      /* Assignment.  */
 	      size_t i;
-	      for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
+	      for (i = 0; i < ARRAY_SIZE (optable); i++)
 		{
 		  if (strlen (optable[i].in) == 3
 		      && memcmp (optable[i].in, opname + 2, 3) == 0)
@@ -685,7 +766,7 @@
 	  && memcmp (opname + 3, "assign_", 7) == 0)
 	{
 	  size_t i;
-	  for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
+	  for (i = 0; i < ARRAY_SIZE (optable); i++)
 	    {
 	      len1 = len - 10;
 	      if ((int) strlen (optable[i].in) == len1
@@ -702,7 +783,7 @@
       else
 	{
 	  size_t i;
-	  for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
+	  for (i = 0; i < ARRAY_SIZE (optable); i++)
 	    {
 	      len1 = len - 3;
 	      if ((int) strlen (optable[i].in) == len1
@@ -733,6 +814,7 @@
   return ret;
 
 }
+
 /* Takes operator name as e.g. "++" and returns mangled
    operator name (e.g. "postincrement_expr"), or NULL if not found.
 
@@ -748,7 +830,7 @@
   int len;
 
   len = strlen (opname);
-  for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
+  for (i = 0; i < ARRAY_SIZE (optable); i++)
     {
       if ((int) strlen (optable[i].out) == len
 	  && (options & DMGL_ANSI) == (optable[i].flags & DMGL_ANSI)
@@ -758,6 +840,40 @@
   return (0);
 }
 
+/* Add a routine to set the demangling style to be sure it is valid and
+   allow for any demangler initialization that maybe necessary. */
+
+enum demangling_styles
+cplus_demangle_set_style (style)
+     enum demangling_styles style;
+{
+  struct demangler_engine *demangler = libiberty_demanglers; 
+
+  for (; demangler->demangling_style != unknown_demangling; ++demangler)
+    if (style == demangler->demangling_style)
+      {
+	current_demangling_style = style;
+	return current_demangling_style;
+      }
+
+  return unknown_demangling;
+}
+
+/* Do string name to style translation */
+
+enum demangling_styles
+cplus_demangle_name_to_style (name)
+     const char *name;
+{
+  struct demangler_engine *demangler = libiberty_demanglers; 
+
+  for (; demangler->demangling_style != unknown_demangling; ++demangler)
+    if (strcmp (name, demangler->demangling_style_name) == 0)
+      return demangler->demangling_style;
+
+  return unknown_demangling;
+}
+
 /* char *cplus_demangle (const char *mangled, int options)
 
    If MANGLED is a mangled function name produced by GNU C++, then
@@ -794,9 +910,20 @@
   char *ret;
   struct work_stuff work[1];
   memset ((char *) work, 0, sizeof (work));
-  work -> options = options;
-  if ((work -> options & DMGL_STYLE_MASK) == 0)
-    work -> options |= (int) current_demangling_style & DMGL_STYLE_MASK;
+  work->options = options;
+  if ((work->options & DMGL_STYLE_MASK) == 0)
+    work->options |= (int) current_demangling_style & DMGL_STYLE_MASK;
+
+  /* The V3 ABI demangling is implemented elsewhere.  */
+  if (GNU_V3_DEMANGLING || AUTO_DEMANGLING)
+    {
+      ret = cplus_demangle_v3 (mangled);
+      if (ret || GNU_V3_DEMANGLING)
+	return ret;
+    }
+
+  if (GNAT_DEMANGLING)
+    return ada_demangle(mangled,options);
 
   ret = internal_cplus_demangle (work, mangled);
   squangle_mop_up (work);
@@ -804,6 +931,139 @@
 }
 
 
+/* 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.  */
+
+static void
+grow_vect (old_vect, size, min_size, element_size)
+     void **old_vect;
+     size_t *size;
+     size_t min_size;
+     int element_size;
+{
+  if (*size < min_size)
+    {
+      *size *= 2;
+      if (*size < min_size)
+	*size = min_size;
+      *old_vect = xrealloc (*old_vect, *size * element_size);
+    }
+}
+
+/* Demangle ada names:
+   1. Discard final __{DIGIT}+ or ${DIGIT}+
+   2. Convert other instances of embedded "__" to `.'.
+   3. Discard leading _ada_.
+   4. Remove everything after first ___ if it is followed by 'X'.
+   5. Put symbols that should be suppressed in <...> brackets.
+   The resulting string is valid until the next call of ada_demangle.  */
+
+static char *
+ada_demangle (mangled, option)
+     const char *mangled;
+     int option ATTRIBUTE_UNUSED;
+{
+  int i, j;
+  int len0;
+  const char* p;
+  char *demangled = NULL;
+  int at_start_name;
+  int changed;
+  char *demangling_buffer = NULL;
+  size_t demangling_buffer_size = 0;
+  
+  changed = 0;
+
+  if (strncmp (mangled, "_ada_", 5) == 0)
+    {
+      mangled += 5;
+      changed = 1;
+    }
+  
+  if (mangled[0] == '_' || mangled[0] == '<')
+    goto Suppress;
+  
+  p = strstr (mangled, "___");
+  if (p == NULL)
+    len0 = strlen (mangled);
+  else
+    {
+      if (p[3] == 'X')
+	{
+	  len0 = p - mangled;
+	  changed = 1;
+	}
+      else
+	goto Suppress;
+    }
+  
+  /* Make demangled big enough for possible expansion by operator name.  */
+  grow_vect ((void **) &(demangling_buffer),
+	     &demangling_buffer_size,  2 * len0 + 1,
+	     sizeof (char));
+  demangled = demangling_buffer;
+  
+  if (ISDIGIT ((unsigned char) mangled[len0 - 1])) {
+    for (i = len0 - 2; i >= 0 && ISDIGIT ((unsigned char) mangled[i]); i -= 1)
+      ;
+    if (i > 1 && mangled[i] == '_' && mangled[i - 1] == '_')
+      {
+	len0 = i - 1;
+	changed = 1;
+      }
+    else if (mangled[i] == '$')
+      {
+	len0 = i;
+	changed = 1;
+      }
+  }
+  
+  for (i = 0, j = 0; i < len0 && ! ISALPHA ((unsigned char)mangled[i]);
+       i += 1, j += 1)
+    demangled[j] = mangled[i];
+  
+  at_start_name = 1;
+  while (i < len0)
+    {
+      at_start_name = 0;
+      
+      if (i < len0 - 2 && mangled[i] == '_' && mangled[i + 1] == '_')
+	{
+	  demangled[j] = '.';
+	  changed = at_start_name = 1;
+	  i += 2; j += 1;
+	}
+      else
+	{
+	  demangled[j] = mangled[i];
+	  i += 1;  j += 1;
+	}
+    }
+  demangled[j] = '\000';
+  
+  for (i = 0; demangled[i] != '\0'; i += 1)
+    if (ISUPPER ((unsigned char)demangled[i]) || demangled[i] == ' ')
+      goto Suppress;
+
+  if (! changed)
+    return NULL;
+  else
+    return demangled;
+  
+ Suppress:
+  grow_vect ((void **) &(demangling_buffer),
+	     &demangling_buffer_size,  strlen (mangled) + 3,
+	     sizeof (char));
+  demangled = demangling_buffer;
+  if (mangled[0] == '<')
+     strcpy (demangled, mangled);
+  else
+    sprintf (demangled, "<%s>", mangled);
+
+  return demangled;
+}
+
 /* This function performs most of what cplus_demangle use to do, but
    to be able to demangle a name with a B, K or n code, we need to
    have a longer term memory of what types have been seen. The original
@@ -819,7 +1079,7 @@
   string decl;
   int success = 0;
   char *demangled = NULL;
-  int s1,s2,s3,s4;
+  int s1, s2, s3, s4;
   s1 = work->constructor;
   s2 = work->destructor;
   s3 = work->static_type;
@@ -872,7 +1132,7 @@
   work->destructor = s2;
   work->static_type = s3;
   work->type_quals = s4;
-  return (demangled);
+  return demangled;
 }
 
 
@@ -893,16 +1153,85 @@
     }
 }
 
-/* Clear out any mangled storage */
 
-static char *
-mop_up (work, declp, success)
-     struct work_stuff *work;
-     string *declp;
-     int success;
+/* Copy the work state and storage.  */
+
+static void
+work_stuff_copy_to_from (to, from)
+     struct work_stuff *to;
+     struct work_stuff *from;
 {
-  char *demangled = NULL;
+  int i;
 
+  delete_work_stuff (to);
+
+  /* Shallow-copy scalars.  */
+  memcpy (to, from, sizeof (*to));
+
+  /* Deep-copy dynamic storage.  */
+  if (from->typevec_size)
+    to->typevec
+      = (char **) xmalloc (from->typevec_size * sizeof (to->typevec[0]));
+
+  for (i = 0; i < from->ntypes; i++)
+    {
+      int len = strlen (from->typevec[i]) + 1;
+
+      to->typevec[i] = xmalloc (len);
+      memcpy (to->typevec[i], from->typevec[i], len);
+    }
+
+  if (from->ksize)
+    to->ktypevec
+      = (char **) xmalloc (from->ksize * sizeof (to->ktypevec[0]));
+
+  for (i = 0; i < from->numk; i++)
+    {
+      int len = strlen (from->ktypevec[i]) + 1;
+
+      to->ktypevec[i] = xmalloc (len);
+      memcpy (to->ktypevec[i], from->ktypevec[i], len);
+    }
+
+  if (from->bsize)
+    to->btypevec
+      = (char **) xmalloc (from->bsize * sizeof (to->btypevec[0]));
+
+  for (i = 0; i < from->numb; i++)
+    {
+      int len = strlen (from->btypevec[i]) + 1;
+
+      to->btypevec[i] = xmalloc (len);
+      memcpy (to->btypevec[i], from->btypevec[i], len);
+    }
+
+  if (from->ntmpl_args)
+    to->tmpl_argvec
+      = xmalloc (from->ntmpl_args * sizeof (to->tmpl_argvec[0]));
+
+  for (i = 0; i < from->ntmpl_args; i++)
+    {
+      int len = strlen (from->tmpl_argvec[i]) + 1;
+
+      to->tmpl_argvec[i] = xmalloc (len);
+      memcpy (to->tmpl_argvec[i], from->tmpl_argvec[i], len);
+    }
+
+  if (from->previous_argument)
+    {
+      to->previous_argument = (string*) xmalloc (sizeof (string));
+      string_init (to->previous_argument);
+      string_appends (to->previous_argument, from->previous_argument);
+    }
+}
+
+
+/* Delete dynamic stuff in work_stuff that is not to be re-used.  */
+
+static void
+delete_non_B_K_work_stuff (work)
+     struct work_stuff *work;
+{
   /* Discard the remembered types, if any.  */
 
   forget_types (work);
@@ -929,6 +1258,30 @@
       free ((char*) work->previous_argument);
       work->previous_argument = NULL;
     }
+}
+
+
+/* Delete all dynamic storage in work_stuff.  */
+static void
+delete_work_stuff (work)
+     struct work_stuff *work;
+{
+  delete_non_B_K_work_stuff (work);
+  squangle_mop_up (work);
+}
+
+
+/* Clear out any mangled storage */
+
+static char *
+mop_up (work, declp, success)
+     struct work_stuff *work;
+     string *declp;
+     int success;
+{
+  char *demangled = NULL;
+
+  delete_non_B_K_work_stuff (work);
 
   /* If demangling was successful, ensure that the demangled string is null
      terminated and return it.  Otherwise, free the demangling decl.  */
@@ -940,7 +1293,7 @@
   else
     {
       string_appendn (declp, "", 1);
-      demangled = declp -> b;
+      demangled = declp->b;
     }
   return (demangled);
 }
@@ -1154,7 +1507,7 @@
 	  break;
 
 	case '_':
-	  if (GNU_DEMANGLING && expect_return_type)
+	  if ((AUTO_DEMANGLING || GNU_DEMANGLING) && expect_return_type)
 	    {
 	      /* Read the return type. */
 	      string return_type;
@@ -1180,7 +1533,7 @@
             if (HP_DEMANGLING)
               {
                 (*mangled)++;
-                while (**mangled && isdigit ((unsigned char)**mangled))
+                while (**mangled && ISDIGIT ((unsigned char)**mangled))
                   (*mangled)++;
               }
             else
@@ -1188,7 +1541,7 @@
 	  break;
 
 	case 'H':
-	  if (GNU_DEMANGLING)
+	  if (AUTO_DEMANGLING || GNU_DEMANGLING)
 	    {
 	      /* A G++ template function.  Read the template arguments. */
 	      success = demangle_template (work, mangled, declp, 0, 0,
@@ -1379,9 +1732,7 @@
 
 	  len = strlen (*mangled);
 
-	  for (i = 0;
-	       i < sizeof (optable) / sizeof (optable [0]);
-	       ++i)
+	  for (i = 0; i < ARRAY_SIZE (optable); ++i)
 	    {
 	      size_t l = strlen (optable[i].in);
 
@@ -1433,6 +1784,11 @@
     {
       int value;
 
+      /* By default, we let the number decide whether we shall consume an
+	 underscore.  */
+      int consume_following_underscore = 0;
+      int leave_following_underscore = 0;
+
       success = 0;
 
       /* Negative numbers are indicated with a leading `m'.  */
@@ -1441,17 +1797,49 @@
 	  string_appendn (s, "-", 1);
 	  (*mangled)++;
 	}
+      else if (mangled[0][0] == '_' && mangled[0][1] == 'm')
+	{
+	  /* Since consume_count_with_underscores does not handle the
+	     `m'-prefix we must do it here, using consume_count and
+	     adjusting underscores: we have to consume the underscore
+	     matching the prepended one.  */
+	  consume_following_underscore = 1;
+	  string_appendn (s, "-", 1);
+	  (*mangled) += 2;
+	}
+      else if (**mangled == '_')
+	{
+	  /* Do not consume a following underscore;
+	     consume_following_underscore will consume what should be
+	     consumed.  */
+	  leave_following_underscore = 1;
+	}
 
-      /* Read the rest of the number.  */
-      value = consume_count_with_underscores (mangled);
+      /* We must call consume_count if we expect to remove a trailing
+	 underscore, since consume_count_with_underscores expects
+	 the leading underscore (that we consumed) if it is to handle
+	 multi-digit numbers.  */
+      if (consume_following_underscore)
+	value = consume_count (mangled);
+      else
+	value = consume_count_with_underscores (mangled);
+
       if (value != -1)
 	{
 	  char buf[INTBUF_SIZE];
 	  sprintf (buf, "%d", value);
 	  string_append (s, buf);
 
-	  /* If the next character is an underscore, skip it.  */
-	  if (**mangled == '_')
+	  /* Numbers not otherwise delimited, might have an underscore
+	     appended as a delimeter, which we should skip.
+
+	     ??? This used to always remove a following underscore, which
+	     is wrong.  If other (arbitrary) cases are followed by an
+	     underscore, we need to do something more radical.  */
+
+	  if ((value > 9 || consume_following_underscore)
+	      && ! leave_following_underscore
+	      && **mangled == '_')
 	    (*mangled)++;
 
 	  /* All is well.  */
@@ -1478,7 +1866,7 @@
       string_appendn (s, "-", 1);
       (*mangled)++;
     }
-  while (isdigit ((unsigned char)**mangled))
+  while (ISDIGIT ((unsigned char)**mangled))
     {
       string_appendn (s, *mangled, 1);
       (*mangled)++;
@@ -1487,7 +1875,7 @@
     {
       string_appendn (s, ".", 1);
       (*mangled)++;
-      while (isdigit ((unsigned char)**mangled))
+      while (ISDIGIT ((unsigned char)**mangled))
 	{
 	  string_appendn (s, *mangled, 1);
 	  (*mangled)++;
@@ -1497,7 +1885,7 @@
     {
       string_appendn (s, "e", 1);
       (*mangled)++;
-      while (isdigit ((unsigned char)**mangled))
+      while (ISDIGIT ((unsigned char)**mangled))
 	{
 	  string_appendn (s, *mangled, 1);
 	  (*mangled)++;
@@ -1616,7 +2004,7 @@
    template parameters (e.g. S) is placed in TRAWNAME if TRAWNAME is
    non-NULL.  If IS_TYPE is nonzero, this template is a type template,
    not a function template.  If both IS_TYPE and REMEMBER are nonzero,
-   the tmeplate is remembered in the list of back-referenceable
+   the template is remembered in the list of back-referenceable
    types.  */
 
 static int
@@ -2148,6 +2536,86 @@
   return (success);
 }
 
+
+/* Called when there's a "__" in the mangled name, with `scan' pointing to
+   the rightmost guess.
+
+   Find the correct "__"-sequence where the function name ends and the
+   signature starts, which is ambiguous with GNU mangling.
+   Call demangle_signature here, so we can make sure we found the right
+   one; *mangled will be consumed so caller will not make further calls to
+   demangle_signature.  */
+
+static int
+iterate_demangle_function (work, mangled, declp, scan)
+     struct work_stuff *work;
+     const char **mangled;
+     string *declp;
+     const char *scan;
+{
+  const char *mangle_init = *mangled;
+  int success = 0;
+  string decl_init;
+  struct work_stuff work_init;
+
+  if (*(scan + 2) == '\0')
+    return 0;
+
+  /* Do not iterate for some demangling modes, or if there's only one
+     "__"-sequence.  This is the normal case.  */
+  if (ARM_DEMANGLING || LUCID_DEMANGLING || HP_DEMANGLING || EDG_DEMANGLING
+      || mystrstr (scan + 2, "__") == NULL)
+    {
+      demangle_function_name (work, mangled, declp, scan);
+      return 1;
+    }
+
+  /* Save state so we can restart if the guess at the correct "__" was
+     wrong.  */
+  string_init (&decl_init);
+  string_appends (&decl_init, declp);
+  memset (&work_init, 0, sizeof work_init);
+  work_stuff_copy_to_from (&work_init, work);
+
+  /* Iterate over occurrences of __, allowing names and types to have a
+     "__" sequence in them.  We must start with the first (not the last)
+     occurrence, since "__" most often occur between independent mangled
+     parts, hence starting at the last occurence inside a signature
+     might get us a "successful" demangling of the signature.  */
+
+  while (scan[2])
+    {
+      demangle_function_name (work, mangled, declp, scan);
+      success = demangle_signature (work, mangled, declp);
+      if (success)
+	break;
+
+      /* Reset demangle state for the next round.  */
+      *mangled = mangle_init;
+      string_clear (declp);
+      string_appends (declp, &decl_init);
+      work_stuff_copy_to_from (work, &work_init);
+
+      /* Leave this underscore-sequence.  */
+      scan += 2;
+
+      /* Scan for the next "__" sequence.  */
+      while (*scan && (scan[0] != '_' || scan[1] != '_'))
+	scan++;
+
+      /* Move to last "__" in this sequence.  */
+      while (*scan && *scan == '_')
+	scan++;
+      scan -= 2;
+    }
+
+  /* Delete saved state.  */
+  delete_work_stuff (&work_init);
+  string_delete (&decl_init);
+
+  return success;
+}
+
 /*
 
 LOCAL FUNCTION
@@ -2163,6 +2631,8 @@
 DESCRIPTION
 
 	Consume and demangle the prefix of the mangled name.
+	While processing the function name root, arrange to call
+	demangle_signature if the root is ambiguous.
 
 	DECLP points to the string buffer into which demangled output is
 	placed.  On entry, the buffer is empty.  On exit it contains
@@ -2266,20 +2736,20 @@
     }
   else if (work -> static_type)
     {
-      if (!isdigit ((unsigned char)scan[0]) && (scan[0] != 't'))
+      if (!ISDIGIT ((unsigned char)scan[0]) && (scan[0] != 't'))
 	{
 	  success = 0;
 	}
     }
   else if ((scan == *mangled)
-	   && (isdigit ((unsigned char)scan[2]) || (scan[2] == 'Q')
+	   && (ISDIGIT ((unsigned char)scan[2]) || (scan[2] == 'Q')
 	       || (scan[2] == 't') || (scan[2] == 'K') || (scan[2] == 'H')))
     {
       /* The ARM says nothing about the mangling of local variables.
 	 But cfront mangles local variables by prepending __<nesting_level>
 	 to them. As an extension to ARM demangling we handle this case.  */
       if ((LUCID_DEMANGLING || ARM_DEMANGLING || HP_DEMANGLING)
-	  && isdigit ((unsigned char)scan[2]))
+	  && ISDIGIT ((unsigned char)scan[2]))
 	{
 	  *mangled = scan + 2;
 	  consume_count (mangled);
@@ -2316,7 +2786,7 @@
       /* EDG template? */
       demangle_arm_hp_template (work, mangled, strlen (*mangled), declp);
     }
-  else if ((scan == *mangled) && !isdigit ((unsigned char)scan[2])
+  else if ((scan == *mangled) && !ISDIGIT ((unsigned char)scan[2])
 	   && (scan[2] != 't'))
     {
       /* Mangled name starts with "__".  Skip over any leading '_' characters,
@@ -2336,29 +2806,16 @@
 	      success = 0;
 	    }
 	  else
-	    {
-	      const char *tmp;
-
-              /* Look for the LAST occurrence of __, allowing names to
-                 have the '__' sequence embedded in them. */
-	      if (!(ARM_DEMANGLING || HP_DEMANGLING))
-		{
-		  while ((tmp = mystrstr (scan + 2, "__")) != NULL)
-		    scan = tmp;
-		}
-	      if (*(scan + 2) == '\0')
-		success = 0;
-              else
-                demangle_function_name (work, mangled, declp, scan);
-	    }
+	    return iterate_demangle_function (work, mangled, declp, scan);
 	}
     }
   else if (*(scan + 2) != '\0')
     {
       /* Mangled name does not start with "__" but does have one somewhere
 	 in there with non empty stuff after it.  Looks like a global
-	 function name.  */
-      demangle_function_name (work, mangled, declp, scan);
+	 function name.  Iterate over all "__":s until the right
+	 one is found.  */
+      return iterate_demangle_function (work, mangled, declp, scan);
     }
   else
     {
@@ -2451,7 +2908,7 @@
 					   1);
 	      break;
 	    default:
-	      if (isdigit((unsigned char)*mangled[0]))
+	      if (ISDIGIT((unsigned char)*mangled[0]))
 		{
 		  n = consume_count(mangled);
 		  /* We may be seeing a too-large size, or else a
@@ -2512,6 +2969,25 @@
 	      success = 0;
 	      break;
 	    }
+
+	  if (n > 10 && strncmp (*mangled, "_GLOBAL_", 8) == 0
+	      && (*mangled)[9] == 'N'
+	      && (*mangled)[8] == (*mangled)[10]
+	      && strchr (cplus_markers, (*mangled)[8]))
+	    {
+	      /* A member of the anonymous namespace.  There's information
+		 about what identifier or filename it was keyed to, but
+		 it's just there to make the mangled name unique; we just
+		 step over it.  */
+	      string_append (declp, "{anonymous}");
+	      (*mangled) += n;
+
+	      /* Now p points to the marker before the N, so we need to
+		 update it to the first marker after what we consumed.  */
+	      p = strpbrk (*mangled, cplus_markers);
+	      break;
+	    }
+
 	  string_appendn (declp, *mangled, n);
 	  (*mangled) += n;
 	}
@@ -2573,7 +3049,7 @@
 	  success = demangle_template (work, mangled, declp, 0, 1, 1);
 	  break;
 	default:
-	  success = demangle_fund_type (work, mangled, declp);
+	  success = do_type (work, mangled, declp);
 	  break;
 	}
       if (success && **mangled != '\0')
@@ -2959,13 +3435,13 @@
   const char *p;
   int n;
 
-  if (!isdigit ((unsigned char)**type))
+  if (!ISDIGIT ((unsigned char)**type))
     return (0);
   else
     {
       *count = **type - '0';
       (*type)++;
-      if (isdigit ((unsigned char)**type))
+      if (ISDIGIT ((unsigned char)**type))
 	{
 	  p = *type;
 	  n = *count;
@@ -2975,7 +3451,7 @@
 	      n += *p - '0';
 	      p++;
 	    }
-	  while (isdigit ((unsigned char)*p));
+	  while (ISDIGIT ((unsigned char)*p));
 	  if (*p == '_')
 	    {
 	      *type = p + 1;
@@ -3105,7 +3581,7 @@
 	    if (**mangled != 'Q')
 	      string_prepend (&decl, SCOPE_STRING (work));
 
-	    if (isdigit ((unsigned char)**mangled))
+	    if (ISDIGIT ((unsigned char)**mangled))
 	      {
 		n = consume_count (mangled);
 		if (n == -1
@@ -3311,7 +3787,7 @@
   int done = 0;
   int success = 1;
   char buf[10];
-  int dec = 0;
+  unsigned int dec = 0;
   string btype;
   type_kind_t tk = tk_integral;
 
@@ -3425,7 +3901,7 @@
       break;
     case 'G':
       (*mangled)++;
-      if (!isdigit ((unsigned char)**mangled))
+      if (!ISDIGIT ((unsigned char)**mangled))
 	{
 	  success = 0;
 	  break;
@@ -3455,7 +3931,7 @@
 	  *mangled += min (strlen (*mangled), 2);
 	}
       sscanf (buf, "%x", &dec);
-      sprintf (buf, "int%i_t", dec);
+      sprintf (buf, "int%u_t", dec);
       APPEND_BLANK (result);
       string_append (result, buf);
       break;
@@ -3537,12 +4013,12 @@
     }
 
   /* We have to be looking at an integer now */
-  if (!(isdigit ((unsigned char)**mangled)))
+  if (!(ISDIGIT ((unsigned char)**mangled)))
     return 0;
 
   /* We only deal with integral values for template
      parameters -- so it's OK to look only for digits */
-  while (isdigit ((unsigned char)**mangled))
+  while (ISDIGIT ((unsigned char)**mangled))
     {
       char_str[0] = **mangled;
       string_append (result, char_str);
@@ -3621,10 +4097,10 @@
   else if (**args == '+')
     (*args)++;
 
-  if (!isdigit ((unsigned char)**args))
+  if (!ISDIGIT ((unsigned char)**args))
     return 0;
 
-  while (isdigit ((unsigned char)**args))
+  while (ISDIGIT ((unsigned char)**args))
     {
       char_str[0] = **args;
       string_append (arg, char_str);
@@ -4130,7 +4606,7 @@
       if (declp->p - declp->b >= 10 /* op$assign_ */
 	  && memcmp (declp->b + 3, "assign_", 7) == 0)
 	{
-	  for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
+	  for (i = 0; i < ARRAY_SIZE (optable); i++)
 	    {
 	      int len = declp->p - declp->b - 10;
 	      if ((int) strlen (optable[i].in) == len
@@ -4146,7 +4622,7 @@
 	}
       else
 	{
-	  for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
+	  for (i = 0; i < ARRAY_SIZE (optable); i++)
 	    {
 	      int len = declp->p - declp->b - 3;
 	      if ((int) strlen (optable[i].in) == len
@@ -4188,13 +4664,13 @@
 	}
     }
   else if (declp->b[0] == '_' && declp->b[1] == '_'
-	   && declp->b[2] >= 'a' && declp->b[2] <= 'z'
-	   && declp->b[3] >= 'a' && declp->b[3] <= 'z')
+	   && ISLOWER((unsigned char)declp->b[2])
+	   && ISLOWER((unsigned char)declp->b[3]))
     {
       if (declp->b[4] == '\0')
 	{
 	  /* Operator.  */
-	  for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
+	  for (i = 0; i < ARRAY_SIZE (optable); i++)
 	    {
 	      if (strlen (optable[i].in) == 2
 		  && memcmp (optable[i].in, declp->b + 2, 2) == 0)
@@ -4211,7 +4687,7 @@
 	  if (declp->b[2] == 'a' && declp->b[5] == '\0')
 	    {
 	      /* Assignment.  */
-	      for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
+	      for (i = 0; i < ARRAY_SIZE (optable); i++)
 		{
 		  if (strlen (optable[i].in) == 3
 		      && memcmp (optable[i].in, declp->b + 2, 3) == 0)
@@ -4402,6 +4878,7 @@
 static void demangle_it PARAMS ((char *));
 static void usage PARAMS ((FILE *, int)) ATTRIBUTE_NORETURN;
 static void fatal PARAMS ((const char *)) ATTRIBUTE_NORETURN;
+static void print_demangler_list PARAMS ((FILE *));
 
 static void
 demangle_it (mangled_name)
@@ -4421,16 +4898,43 @@
     }
 }
 
+static void 
+print_demangler_list (stream)
+     FILE *stream;
+{
+  struct demangler_engine *demangler; 
+
+  fprintf (stream, "{%s", libiberty_demanglers->demangling_style_name);
+  
+  for (demangler = libiberty_demanglers + 1;
+       demangler->demangling_style != unknown_demangling;
+       ++demangler)
+    fprintf (stream, ",%s", demangler->demangling_style_name);
+
+  fprintf (stream, "}");
+}
+
 static void
 usage (stream, status)
      FILE *stream;
      int status;
 {
   fprintf (stream, "\
-Usage: %s [-_] [-n] [-s {gnu,lucid,arm,hp,edg}] [--strip-underscores]\n\
-       [--no-strip-underscores] [--format={gnu,lucid,arm,hp,edg}]\n\
-      [--help] [--version] [arg...]\n",
+Usage: %s [-_] [-n] [--strip-underscores] [--no-strip-underscores] \n",
 	   program_name);
+
+  fprintf (stream, "\
+       [-s ");
+  print_demangler_list (stream);
+  fprintf (stream, "]\n");
+
+  fprintf (stream, "\
+       [--format ");
+  print_demangler_list (stream);
+  fprintf (stream, "]\n");
+
+  fprintf (stream, "\
+       [--help] [--version] [arg...]\n");
   exit (status);
 }
 
@@ -4468,6 +4972,9 @@
 static const char *
 hp_symbol_characters PARAMS ((void));
 
+static const char *
+gnu_v3_symbol_characters PARAMS ((void));
+
 /* Return the string of non-alnum characters that may occur 
    as a valid symbol component, in the standard assembler symbol
    syntax.  */
@@ -4516,6 +5023,17 @@
 }
 
 
+/* Return the string of non-alnum characters that may occur 
+   as a valid symbol component in the GNU C++ V3 ABI mangling
+   scheme.  */
+
+static const char *
+gnu_v3_symbol_characters ()
+{
+  return "_$.";
+}
+
+
 extern int main PARAMS ((int, char **));
 
 int
@@ -4553,32 +5071,19 @@
 	  flags |= DMGL_JAVA;
 	  break;
 	case 's':
-	  if (strcmp (optarg, "gnu") == 0)
-	    {
-	      current_demangling_style = gnu_demangling;
-	    }
-	  else if (strcmp (optarg, "lucid") == 0)
-	    {
-	      current_demangling_style = lucid_demangling;
-	    }
-	  else if (strcmp (optarg, "arm") == 0)
-	    {
-	      current_demangling_style = arm_demangling;
-	    }
-	  else if (strcmp (optarg, "hp") == 0)
-	    {
-	      current_demangling_style = hp_demangling;
-	    }
-          else if (strcmp (optarg, "edg") == 0)
-            {
-              current_demangling_style = edg_demangling;
-            }
-	  else
-	    {
-	      fprintf (stderr, "%s: unknown demangling style `%s'\n",
-		       program_name, optarg);
-	      return (1);
-	    }
+	  {
+	    enum demangling_styles style;
+
+	    style = cplus_demangle_name_to_style (optarg);
+	    if (style == unknown_demangling)
+	      {
+		fprintf (stderr, "%s: unknown demangling style `%s'\n",
+			 program_name, optarg);
+		return (1);
+	      }
+	    else
+	      cplus_demangle_set_style (style);
+	  }
 	  break;
 	}
     }
@@ -4597,12 +5102,18 @@
 	case gnu_demangling:
 	case lucid_demangling:
 	case arm_demangling:
+	case java_demangling:
 	case edg_demangling:
+	case gnat_demangling:
+	case auto_demangling:
 	  valid_symbols = standard_symbol_characters ();
 	  break;
 	case hp_demangling:
 	  valid_symbols = hp_symbol_characters ();
 	  break;
+	case gnu_v3_demangling:
+	  valid_symbols = gnu_v3_symbol_characters ();
+	  break;
 	default:
 	  /* Folks should explicitly indicate the appropriate alphabet for
 	     each demangling.  Providing a default would allow the
@@ -4615,7 +5126,7 @@
 	  int i = 0;
 	  c = getchar ();
 	  /* Try to read a label.  */
-	  while (c != EOF && (isalnum (c) || strchr (valid_symbols, c)))
+	  while (c != EOF && (ISALNUM (c) || strchr (valid_symbols, c)))
 	    {
 	      if (i >= MBUF_SIZE-1)
 		break;
@@ -4652,6 +5163,7 @@
 	  if (c == EOF)
 	    break;
 	  putchar (c);
+	  fflush (stdout);
 	}
     }
 
diff --git a/libiberty/dyn-string.c b/libiberty/dyn-string.c
new file mode 100644
index 0000000..34f88ad
--- /dev/null
+++ b/libiberty/dyn-string.c
@@ -0,0 +1,433 @@
+/* An abstract string datatype.
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+   Contributed by Mark Mitchell (mark@markmitchell.com).
+
+This file is part of GNU CC.
+   
+GNU CC 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.
+
+GNU CC 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 GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include "libiberty.h"
+#include "dyn-string.h"
+
+/* If this file is being compiled for inclusion in the C++ runtime
+   library, as part of the demangler implementation, we don't want to
+   abort if an allocation fails.  Instead, percolate an error code up
+   through the call chain.  */
+
+#ifdef IN_LIBGCC2
+#define RETURN_ON_ALLOCATION_FAILURE
+#endif
+
+/* Performs in-place initialization of a dyn_string struct.  This
+   function can be used with a dyn_string struct on the stack or
+   embedded in another object.  The contents of of the string itself
+   are still dynamically allocated.  The string initially is capable
+   of holding at least SPACE characeters, including the terminating
+   NUL.  If SPACE is 0, it will silently be increated to 1.  
+
+   If RETURN_ON_ALLOCATION_FAILURE is defined and memory allocation
+   fails, returns 0.  Otherwise returns 1.  */
+
+int
+dyn_string_init (ds_struct_ptr, space)
+     struct dyn_string *ds_struct_ptr;
+     int space;
+{
+  /* We need at least one byte in which to store the terminating NUL.  */
+  if (space == 0)
+    space = 1;
+
+#ifdef RETURN_ON_ALLOCATION_FAILURE
+  ds_struct_ptr->s = (char *) malloc (space);
+  if (ds_struct_ptr->s == NULL)
+    return 0;
+#else
+  ds_struct_ptr->s = (char *) xmalloc (space);
+#endif
+  ds_struct_ptr->allocated = space;
+  ds_struct_ptr->length = 0;
+  ds_struct_ptr->s[0] = '\0';
+
+  return 1;
+}
+
+/* Create a new dynamic string capable of holding at least SPACE
+   characters, including the terminating NUL.  If SPACE is 0, it will
+   be silently increased to 1.  If RETURN_ON_ALLOCATION_FAILURE is
+   defined and memory allocation fails, returns NULL.  Otherwise
+   returns the newly allocated string.  */
+
+dyn_string_t 
+dyn_string_new (space)
+     int space;
+{
+  dyn_string_t result;
+#ifdef RETURN_ON_ALLOCATION_FAILURE
+  result = (dyn_string_t) malloc (sizeof (struct dyn_string));
+  if (result == NULL)
+    return NULL;
+  if (!dyn_string_init (result, space))
+    {
+      free (result);
+      return NULL;
+    }
+#else
+  result = (dyn_string_t) xmalloc (sizeof (struct dyn_string));
+  dyn_string_init (result, space);
+#endif
+  return result;
+}
+
+/* Free the memory used by DS.  */
+
+void 
+dyn_string_delete (ds)
+     dyn_string_t ds;
+{
+  free (ds->s);
+  free (ds);
+}
+
+/* Returns the contents of DS in a buffer allocated with malloc.  It
+   is the caller's responsibility to deallocate the buffer using free.
+   DS is then set to the empty string.  Deletes DS itself.  */
+
+char*
+dyn_string_release (ds)
+     dyn_string_t ds;
+{
+  /* Store the old buffer.  */
+  char* result = ds->s;
+  /* The buffer is no longer owned by DS.  */
+  ds->s = NULL;
+  /* Delete DS.  */
+  free (ds);
+  /* Return the old buffer.  */
+  return result;
+}
+
+/* Increase the capacity of DS so it can hold at least SPACE
+   characters, plus the terminating NUL.  This function will not (at
+   present) reduce the capacity of DS.  Returns DS on success. 
+
+   If RETURN_ON_ALLOCATION_FAILURE is defined and a memory allocation
+   operation fails, deletes DS and returns NULL.  */
+
+dyn_string_t 
+dyn_string_resize (ds, space)
+     dyn_string_t ds;
+     int space;
+{
+  int new_allocated = ds->allocated;
+
+  /* Increase SPACE to hold the NUL termination.  */
+  ++space;
+
+  /* Increase allocation by factors of two.  */
+  while (space > new_allocated)
+    new_allocated *= 2;
+    
+  if (new_allocated != ds->allocated)
+    {
+      ds->allocated = new_allocated;
+      /* We actually need more space.  */
+#ifdef RETURN_ON_ALLOCATION_FAILURE
+      ds->s = (char *) realloc (ds->s, ds->allocated);
+      if (ds->s == NULL)
+	{
+	  free (ds);
+	  return NULL;
+	}
+#else
+      ds->s = (char *) xrealloc (ds->s, ds->allocated);
+#endif
+    }
+
+  return ds;
+}
+
+/* Sets the contents of DS to the empty string.  */
+
+void
+dyn_string_clear (ds)
+     dyn_string_t ds;
+{
+  /* A dyn_string always has room for at least the NUL terminator.  */
+  ds->s[0] = '\0';
+  ds->length = 0;
+}
+
+/* Makes the contents of DEST the same as the contents of SRC.  DEST
+   and SRC must be distinct.  Returns 1 on success.  On failure, if
+   RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0.  */
+
+int
+dyn_string_copy (dest, src)
+     dyn_string_t dest;
+     dyn_string_t src;
+{
+  if (dest == src)
+    abort ();
+
+  /* Make room in DEST.  */
+  if (dyn_string_resize (dest, src->length) == NULL)
+    return 0;
+  /* Copy DEST into SRC.  */
+  strcpy (dest->s, src->s);
+  /* Update the size of DEST.  */
+  dest->length = src->length;
+  return 1;
+}
+
+/* Copies SRC, a NUL-terminated string, into DEST.  Returns 1 on
+   success.  On failure, if RETURN_ON_ALLOCATION_FAILURE, deletes DEST
+   and returns 0.  */
+
+int
+dyn_string_copy_cstr (dest, src)
+     dyn_string_t dest;
+     const char *src;
+{
+  int length = strlen (src);
+  /* Make room in DEST.  */
+  if (dyn_string_resize (dest, length) == NULL)
+    return 0;
+  /* Copy DEST into SRC.  */
+  strcpy (dest->s, src);
+  /* Update the size of DEST.  */
+  dest->length = length;
+  return 1;
+}
+
+/* Inserts SRC at the beginning of DEST.  DEST is expanded as
+   necessary.  SRC and DEST must be distinct.  Returns 1 on success.
+   On failure, if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and
+   returns 0.  */
+
+int
+dyn_string_prepend (dest, src)
+     dyn_string_t dest;
+     dyn_string_t src;
+{
+  return dyn_string_insert (dest, 0, src);
+}
+
+/* Inserts SRC, a NUL-terminated string, at the beginning of DEST.
+   DEST is expanded as necessary.  Returns 1 on success.  On failure,
+   if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
+
+int
+dyn_string_prepend_cstr (dest, src)
+     dyn_string_t dest;
+     const char *src;
+{
+  return dyn_string_insert_cstr (dest, 0, src);
+}
+
+/* Inserts SRC into DEST starting at position POS.  DEST is expanded
+   as necessary.  SRC and DEST must be distinct.  Returns 1 on
+   success.  On failure, if RETURN_ON_ALLOCATION_FAILURE, deletes DEST
+   and returns 0.  */
+
+int
+dyn_string_insert (dest, pos, src)
+     dyn_string_t dest;
+     int pos;
+     dyn_string_t src;
+{
+  int i;
+
+  if (src == dest)
+    abort ();
+
+  if (dyn_string_resize (dest, dest->length + src->length) == NULL)
+    return 0;
+  /* Make room for the insertion.  Be sure to copy the NUL.  */
+  for (i = dest->length; i >= pos; --i)
+    dest->s[i + src->length] = dest->s[i];
+  /* Splice in the new stuff.  */
+  strncpy (dest->s + pos, src->s, src->length);
+  /* Compute the new length.  */
+  dest->length += src->length;
+  return 1;
+}
+
+/* Inserts SRC, a NUL-terminated string, into DEST starting at
+   position POS.  DEST is expanded as necessary.  Returns 1 on
+   success.  On failure, RETURN_ON_ALLOCATION_FAILURE, deletes DEST
+   and returns 0.  */
+
+int
+dyn_string_insert_cstr (dest, pos, src)
+     dyn_string_t dest;
+     int pos;
+     const char *src;
+{
+  int i;
+  int length = strlen (src);
+
+  if (dyn_string_resize (dest, dest->length + length) == NULL)
+    return 0;
+  /* Make room for the insertion.  Be sure to copy the NUL.  */
+  for (i = dest->length; i >= pos; --i)
+    dest->s[i + length] = dest->s[i];
+  /* Splice in the new stuff.  */
+  strncpy (dest->s + pos, src, length);
+  /* Compute the new length.  */
+  dest->length += length;
+  return 1;
+}
+
+/* Inserts character C into DEST starting at position POS.  DEST is
+   expanded as necessary.  Returns 1 on success.  On failure,
+   RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0.  */
+
+int
+dyn_string_insert_char (dest, pos, c)
+     dyn_string_t dest;
+     int pos;
+     int c;
+{
+  int i;
+
+  if (dyn_string_resize (dest, dest->length + 1) == NULL)
+    return 0;
+  /* Make room for the insertion.  Be sure to copy the NUL.  */
+  for (i = dest->length; i >= pos; --i)
+    dest->s[i + 1] = dest->s[i];
+  /* Add the new character.  */
+  dest->s[pos] = c;
+  /* Compute the new length.  */
+  ++dest->length;
+  return 1;
+}
+     
+/* Append S to DS, resizing DS if necessary.  Returns 1 on success.
+   On failure, if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and
+   returns 0.  */
+
+int
+dyn_string_append (dest, s)
+     dyn_string_t dest;
+     dyn_string_t s;
+{
+  if (dyn_string_resize (dest, dest->length + s->length) == 0)
+    return 0;
+  strcpy (dest->s + dest->length, s->s);
+  dest->length += s->length;
+  return 1;
+}
+
+/* Append the NUL-terminated string S to DS, resizing DS if necessary.
+   Returns 1 on success.  On failure, if RETURN_ON_ALLOCATION_FAILURE,
+   deletes DEST and returns 0.  */
+
+int
+dyn_string_append_cstr (dest, s)
+     dyn_string_t dest;
+     const char *s;
+{
+  int len = strlen (s);
+
+  /* The new length is the old length plus the size of our string, plus
+     one for the null at the end.  */
+  if (dyn_string_resize (dest, dest->length + len) == NULL)
+    return 0;
+  strcpy (dest->s + dest->length, s);
+  dest->length += len;
+  return 1;
+}
+
+/* Appends C to the end of DEST.  Returns 1 on success.  On failiure,
+   if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0.  */
+
+int
+dyn_string_append_char (dest, c)
+     dyn_string_t dest;
+     int c;
+{
+  /* Make room for the extra character.  */
+  if (dyn_string_resize (dest, dest->length + 1) == NULL)
+    return 0;
+  /* Append the character; it will overwrite the old NUL.  */
+  dest->s[dest->length] = c;
+  /* Add a new NUL at the end.  */
+  dest->s[dest->length + 1] = '\0';
+  /* Update the length.  */
+  ++(dest->length);
+  return 1;
+}
+
+/* Sets the contents of DEST to the substring of SRC starting at START
+   and ending before END.  START must be less than or equal to END,
+   and both must be between zero and the length of SRC, inclusive.
+   Returns 1 on success.  On failure, if RETURN_ON_ALLOCATION_FAILURE,
+   deletes DEST and returns 0.  */
+
+int
+dyn_string_substring (dest, src, start, end)
+     dyn_string_t dest;
+     dyn_string_t src;
+     int start;
+     int end;
+{
+  int i;
+  int length = end - start;
+
+  if (start > end || start > src->length || end > src->length)
+    abort ();
+
+  /* Make room for the substring.  */
+  if (dyn_string_resize (dest, length) == NULL)
+    return 0;
+  /* Copy the characters in the substring,  */
+  for (i = length; --i >= 0; )
+    dest->s[i] = src->s[start + i];
+  /* NUL-terimate the result.  */
+  dest->s[length] = '\0';
+  /* Record the length of the substring.  */
+  dest->length = length;
+
+  return 1;
+}
+
+/* Returns non-zero if DS1 and DS2 have the same contents.  */
+
+int
+dyn_string_eq (ds1, ds2)
+     dyn_string_t ds1;
+     dyn_string_t ds2;
+{
+  /* If DS1 and DS2 have different lengths, they must not be the same.  */
+  if (ds1->length != ds2->length)
+    return 0;
+  else
+    return !strcmp (ds1->s, ds2->s);
+}
diff --git a/libiberty/fnmatch.c b/libiberty/fnmatch.c
index 0a9bfe6..68f3e26 100644
--- a/libiberty/fnmatch.c
+++ b/libiberty/fnmatch.c
@@ -45,8 +45,7 @@
 
 #include <errno.h>
 #include <fnmatch.h>
-#include <ctype.h>
-
+#include <safe-ctype.h>
 
 /* Comment out all this code if we are using the GNU C Library, and are not
    actually compiling the library itself.  This code is part of the GNU C
@@ -74,8 +73,7 @@
   register const char *p = pattern, *n = string;
   register unsigned char c;
 
-/* Note that this evalutes C many times.  */
-#define FOLD(c)	((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c))
+#define FOLD(c)	((flags & FNM_CASEFOLD) ? TOLOWER (c) : (c))
 
   while ((c = *p++) != '\0')
     {
diff --git a/libiberty/getcwd.c b/libiberty/getcwd.c
index 47b1c1e..3445563 100644
--- a/libiberty/getcwd.c
+++ b/libiberty/getcwd.c
@@ -29,6 +29,12 @@
 #include <sys/param.h>
 #endif
 #include <errno.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 
 extern char *getwd ();
 extern int errno;
diff --git a/libiberty/getruntime.c b/libiberty/getruntime.c
index b855ea6..4abfa83 100644
--- a/libiberty/getruntime.c
+++ b/libiberty/getruntime.c
@@ -26,10 +26,20 @@
    single way is available for all host systems, nor are there reliable
    ways to find out which way is correct for a given host. */
 
-#include <time.h>
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  ifdef HAVE_TIME_H
+#   include <time.h>
+#  endif
+# endif
+#endif
 
 #if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
-#include <sys/time.h>
 #include <sys/resource.h>
 #endif
 
diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c
index 6ae34aa..122ed43 100644
--- a/libiberty/hashtab.c
+++ b/libiberty/hashtab.c
@@ -1,5 +1,5 @@
 /* An expandable hash tables datatype.  
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    Contributed by Vladimir Makarov (vmakarov@cygnus.com).
 
 This file is part of the libiberty library.
@@ -52,44 +52,113 @@
 
 /* This macro defines reserved value for empty table entry. */
 
-#define EMPTY_ENTRY    ((void *) 0)
+#define EMPTY_ENTRY    ((PTR) 0)
 
 /* This macro defines reserved value for table entry which contained
    a deleted element. */
 
-#define DELETED_ENTRY  ((void *) 1)
+#define DELETED_ENTRY  ((PTR) 1)
 
-/* The following function returns the nearest prime number which is
-   greater than given source number. */
+static unsigned long higher_prime_number PARAMS ((unsigned long));
+static hashval_t hash_pointer PARAMS ((const void *));
+static int eq_pointer PARAMS ((const void *, const void *));
+static int htab_expand PARAMS ((htab_t));
+static PTR *find_empty_slot_for_expand  PARAMS ((htab_t, hashval_t));
+
+/* At some point, we could make these be NULL, and modify the
+   hash-table routines to handle NULL specially; that would avoid
+   function-call overhead for the common case of hashing pointers.  */
+htab_hash htab_hash_pointer = hash_pointer;
+htab_eq htab_eq_pointer = eq_pointer;
+
+/* The following function returns a nearest prime number which is
+   greater than N, and near a power of two. */
 
 static unsigned long
 higher_prime_number (n)
      unsigned long n;
 {
-  unsigned long i;
+  /* These are primes that are near, but slightly smaller than, a
+     power of two.  */
+  static unsigned long primes[] = {
+    2,
+    7,
+    13,
+    31,
+    61,
+    127,
+    251,
+    509,
+    1021,
+    2039,
+    4093,
+    8191,
+    16381,
+    32749,
+    65521,
+    131071,
+    262139,
+    524287,
+    1048573,
+    2097143,
+    4194301,
+    8388593,
+    16777213,
+    33554393,
+    67108859,
+    134217689,
+    268435399,
+    536870909,
+    1073741789,
+    2147483647,
+    4294967291
+  };
 
-  n |= 0x01;  /* Force N to be odd.  */
-  if (n < 9)
-    return n; /* All odd numbers < 9 are prime.  */
+  unsigned long* low = &primes[0];
+  unsigned long* high = &primes[sizeof(primes) / sizeof(primes[0])];
 
- next:
-  n += 2;
-  i = 3;
-  do
+  while (low != high)
     {
-      if (n % i == 0)
-	goto next;
-      i += 2;
+      unsigned long* mid = low + (high - low) / 2;
+      if (n > *mid)
+	low = mid + 1;
+      else
+	high = mid;
     }
-  while ((i * i) <= n);
 
-  return n;
+  /* If we've run out of primes, abort.  */
+  if (n > *low)
+    {
+      fprintf (stderr, "Cannot find prime bigger than %lu\n", n);
+      abort ();
+    }
+
+  return *low;
+}
+
+/* Returns a hash code for P.  */
+
+static hashval_t
+hash_pointer (p)
+     const PTR p;
+{
+  return (hashval_t) ((long)p >> 3);
+}
+
+/* Returns non-zero if P1 and P2 are equal.  */
+
+static int
+eq_pointer (p1, p2)
+     const PTR p1;
+     const PTR p2;
+{
+  return p1 == p2;
 }
 
 /* This function creates table with length slightly longer than given
    source length.  Created hash table is initiated as empty (all the
    hash table entries are EMPTY_ENTRY).  The function returns the
-   created hash table. */
+   created hash table.  Memory allocation must not fail.  */
 
 htab_t
 htab_create (size, hash_f, eq_f, del_f)
@@ -102,11 +171,46 @@
 
   size = higher_prime_number (size);
   result = (htab_t) xcalloc (1, sizeof (struct htab));
-  result->entries = (void **) xcalloc (size, sizeof (void *));
+  result->entries = (PTR *) xcalloc (size, sizeof (PTR));
   result->size = size;
   result->hash_f = hash_f;
   result->eq_f = eq_f;
   result->del_f = del_f;
+  result->return_allocation_failure = 0;
+  return result;
+}
+
+/* This function creates table with length slightly longer than given
+   source length.  The created hash table is initiated as empty (all the
+   hash table entries are EMPTY_ENTRY).  The function returns the created
+   hash table.  Memory allocation may fail; it may return NULL.  */
+
+htab_t
+htab_try_create (size, hash_f, eq_f, del_f)
+     size_t size;
+     htab_hash hash_f;
+     htab_eq eq_f;
+     htab_del del_f;
+{
+  htab_t result;
+
+  size = higher_prime_number (size);
+  result = (htab_t) calloc (1, sizeof (struct htab));
+  if (result == NULL)
+    return NULL;
+
+  result->entries = (PTR *) calloc (size, sizeof (PTR));
+  if (result->entries == NULL)
+    {
+      free (result);
+      return NULL;
+    }
+
+  result->size = size;
+  result->hash_f = hash_f;
+  result->eq_f = eq_f;
+  result->del_f = del_f;
+  result->return_allocation_failure = 1;
   return result;
 }
 
@@ -118,13 +222,12 @@
      htab_t htab;
 {
   int i;
+
   if (htab->del_f)
     for (i = htab->size - 1; i >= 0; i--)
-      {
-	if (htab->entries[i] != EMPTY_ENTRY
-	    && htab->entries[i] != DELETED_ENTRY)
-	  (*htab->del_f) (htab->entries[i]);
-      }
+      if (htab->entries[i] != EMPTY_ENTRY
+	  && htab->entries[i] != DELETED_ENTRY)
+	(*htab->del_f) (htab->entries[i]);
 
   free (htab->entries);
   free (htab);
@@ -137,15 +240,14 @@
      htab_t htab;
 {
   int i;
+
   if (htab->del_f)
     for (i = htab->size - 1; i >= 0; i--)
-      {
-	if (htab->entries[i] != EMPTY_ENTRY
-	    && htab->entries[i] != DELETED_ENTRY)
-	  (*htab->del_f) (htab->entries[i]);
-      }
+      if (htab->entries[i] != EMPTY_ENTRY
+	  && htab->entries[i] != DELETED_ENTRY)
+	(*htab->del_f) (htab->entries[i]);
 
-  memset (htab->entries, 0, htab->size * sizeof (void *));
+  memset (htab->entries, 0, htab->size * sizeof (PTR));
 }
 
 /* Similar to htab_find_slot, but without several unwanted side effects:
@@ -154,22 +256,23 @@
       hash table.
    This function also assumes there are no deleted entries in the table.
    HASH is the hash value for the element to be inserted.  */
-static void **
+
+static PTR *
 find_empty_slot_for_expand (htab, hash)
      htab_t htab;
-     unsigned int hash;
+     hashval_t hash;
 {
   size_t size = htab->size;
-  unsigned int hash2 = 1 + hash % (size - 2);
+  hashval_t hash2 = 1 + hash % (size - 2);
   unsigned int index = hash % size;
 
   for (;;)
     {
-      void **slot = htab->entries + index;
+      PTR *slot = htab->entries + index;
+
       if (*slot == EMPTY_ENTRY)
 	return slot;
-
-      if (*slot == DELETED_ENTRY)
+      else if (*slot == DELETED_ENTRY)
 	abort ();
 
       index += hash2;
@@ -182,21 +285,32 @@
    entries and repeatedly inserts the table elements.  The occupancy
    of the table after the call will be about 50%.  Naturally the hash
    table must already exist.  Remember also that the place of the
-   table entries is changed. */
+   table entries is changed.  If memory allocation failures are allowed,
+   this function will return zero, indicating that the table could not be
+   expanded.  If all goes well, it will return a non-zero value.  */
 
-static void
+static int
 htab_expand (htab)
      htab_t htab;
 {
-  void **oentries;
-  void **olimit;
-  void **p;
+  PTR *oentries;
+  PTR *olimit;
+  PTR *p;
 
   oentries = htab->entries;
   olimit = oentries + htab->size;
 
   htab->size = higher_prime_number (htab->size * 2);
-  htab->entries = xcalloc (htab->size, sizeof (void **));
+
+  if (htab->return_allocation_failure)
+    {
+      PTR *nentries = (PTR *) calloc (htab->size, sizeof (PTR *));
+      if (nentries == NULL)
+	return 0;
+      htab->entries = nentries;
+    }
+  else
+    htab->entries = (PTR *) xcalloc (htab->size, sizeof (PTR *));
 
   htab->n_elements -= htab->n_deleted;
   htab->n_deleted = 0;
@@ -204,56 +318,69 @@
   p = oentries;
   do
     {
-      void *x = *p;
+      PTR x = *p;
+
       if (x != EMPTY_ENTRY && x != DELETED_ENTRY)
 	{
-	  void **q = find_empty_slot_for_expand (htab, (*htab->hash_f) (x));
+	  PTR *q = find_empty_slot_for_expand (htab, (*htab->hash_f) (x));
+
 	  *q = x;
 	}
+
       p++;
     }
   while (p < olimit);
+
   free (oentries);
+  return 1;
 }
 
 /* This function searches for a hash table entry equal to the given
    element.  It cannot be used to insert or delete an element.  */
 
-void *
+PTR
 htab_find_with_hash (htab, element, hash)
      htab_t htab;
-     const void *element;
-     unsigned int hash;
+     const PTR element;
+     hashval_t hash;
 {
-  unsigned int index, hash2;
+  unsigned int index;
+  hashval_t hash2;
   size_t size;
+  PTR entry;
 
   htab->searches++;
   size = htab->size;
-  hash2 = 1 + hash % (size - 2);
   index = hash % size;
 
+  entry = htab->entries[index];
+  if (entry == EMPTY_ENTRY
+      || (entry != DELETED_ENTRY && (*htab->eq_f) (entry, element)))
+    return entry;
+
+  hash2 = 1 + hash % (size - 2);
+
   for (;;)
     {
-      void *entry = htab->entries[index];
-      if (entry == EMPTY_ENTRY)
-	return NULL;
-      else if (entry != DELETED_ENTRY && (*htab->eq_f) (entry, element))
-	return entry;
-
       htab->collisions++;
       index += hash2;
       if (index >= size)
 	index -= size;
+
+      entry = htab->entries[index];
+      if (entry == EMPTY_ENTRY
+	  || (entry != DELETED_ENTRY && (*htab->eq_f) (entry, element)))
+	return entry;
     }
 }
 
 /* Like htab_find_slot_with_hash, but compute the hash value from the
    element.  */
-void *
+
+PTR
 htab_find (htab, element)
      htab_t htab;
-     const void *element;
+     const PTR element;
 {
   return htab_find_with_hash (htab, element, (*htab->hash_f) (element));
 }
@@ -262,21 +389,25 @@
    equal to the given element.  To delete an entry, call this with
    INSERT = 0, then call htab_clear_slot on the slot returned (possibly
    after doing some checks).  To insert an entry, call this with
-   INSERT = 1, then write the value you want into the returned slot.  */
+   INSERT = 1, then write the value you want into the returned slot.
+   When inserting an entry, NULL may be returned if memory allocation
+   fails.  */
 
-void **
+PTR *
 htab_find_slot_with_hash (htab, element, hash, insert)
      htab_t htab;
-     const void *element;
-     unsigned int hash;
-     int insert;
+     const PTR element;
+     hashval_t hash;
+     enum insert_option insert;
 {
-  void **first_deleted_slot;
-  unsigned int index, hash2;
+  PTR *first_deleted_slot;
+  unsigned int index;
+  hashval_t hash2;
   size_t size;
 
-  if (insert && htab->size * 3 <= htab->n_elements * 4)
-    htab_expand (htab);
+  if (insert == INSERT && htab->size * 3 <= htab->n_elements * 4
+      && htab_expand (htab) == 0)
+    return NULL;
 
   size = htab->size;
   hash2 = 1 + hash % (size - 2);
@@ -287,10 +418,10 @@
 
   for (;;)
     {
-      void *entry = htab->entries[index];
+      PTR entry = htab->entries[index];
       if (entry == EMPTY_ENTRY)
 	{
-	  if (!insert)
+	  if (insert == NO_INSERT)
 	    return NULL;
 
 	  htab->n_elements++;
@@ -309,11 +440,8 @@
 	  if (!first_deleted_slot)
 	    first_deleted_slot = &htab->entries[index];
 	}
-      else
-	{
-	  if ((*htab->eq_f) (entry, element))
-	    return &htab->entries[index];
-	}
+      else  if ((*htab->eq_f) (entry, element))
+	return &htab->entries[index];
       
       htab->collisions++;
       index += hash2;
@@ -324,11 +452,12 @@
 
 /* Like htab_find_slot_with_hash, but compute the hash value from the
    element.  */
-void **
+
+PTR *
 htab_find_slot (htab, element, insert)
      htab_t htab;
-     const void *element;
-     int insert;
+     const PTR element;
+     enum insert_option insert;
 {
   return htab_find_slot_with_hash (htab, element, (*htab->hash_f) (element),
 				   insert);
@@ -341,11 +470,11 @@
 void
 htab_remove_elt (htab, element)
      htab_t htab;
-     void *element;
+     PTR element;
 {
-  void **slot;
+  PTR *slot;
 
-  slot = htab_find_slot (htab, element, 0);
+  slot = htab_find_slot (htab, element, NO_INSERT);
   if (*slot == EMPTY_ENTRY)
     return;
 
@@ -363,13 +492,15 @@
 void
 htab_clear_slot (htab, slot)
      htab_t htab;
-     void **slot;
+     PTR *slot;
 {
   if (slot < htab->entries || slot >= htab->entries + htab->size
       || *slot == EMPTY_ENTRY || *slot == DELETED_ENTRY)
     abort ();
+
   if (htab->del_f)
     (*htab->del_f) (*slot);
+
   *slot = DELETED_ENTRY;
   htab->n_deleted++;
 }
@@ -383,14 +514,15 @@
 htab_traverse (htab, callback, info)
      htab_t htab;
      htab_trav callback;
-     void *info;
+     PTR info;
 {
-  void **slot, **limit;
-  slot = htab->entries;
-  limit = slot + htab->size;
+  PTR *slot = htab->entries;
+  PTR *limit = slot + htab->size;
+
   do
     {
-      void *x = *slot;
+      PTR x = *slot;
+
       if (x != EMPTY_ENTRY && x != DELETED_ENTRY)
 	if (!(*callback) (slot, info))
 	  break;
@@ -398,7 +530,7 @@
   while (++slot < limit);
 }
 
-/* The following function returns current size of given hash table. */
+/* Return the current size of given hash table. */
 
 size_t
 htab_size (htab)
@@ -407,8 +539,7 @@
   return htab->size;
 }
 
-/* The following function returns current number of elements in given
-   hash table. */
+/* Return the current number of elements in given hash table. */
 
 size_t
 htab_elements (htab)
@@ -417,17 +548,15 @@
   return htab->n_elements - htab->n_deleted;
 }
 
-/* The following function returns number of percents of fixed
-   collisions during all work with given hash table. */
+/* Return the fraction of fixed collisions during all work with given
+   hash table. */
 
 double
 htab_collisions (htab)
      htab_t htab;
 {
-  int searches;
-
-  searches = htab->searches;
-  if (searches == 0)
+  if (htab->searches == 0)
     return 0.0;
-  return (double)htab->collisions / (double)searches;
+
+  return (double) htab->collisions / (double) htab->searches;
 }
diff --git a/libiberty/md5.c b/libiberty/md5.c
new file mode 100644
index 0000000..0c0507d
--- /dev/null
+++ b/libiberty/md5.c
@@ -0,0 +1,420 @@
+/* md5.c - Functions to compute MD5 message digest of files or memory blocks
+   according to the definition of MD5 in RFC 1321 from April 1992.
+   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   NOTE: The canonical source of this file is maintained with the GNU C
+   Library.  Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+
+   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.  */
+
+/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <sys/types.h>
+
+#if STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+# include <string.h>
+#else
+# ifndef HAVE_MEMCPY
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#include "ansidecl.h"
+#include "md5.h"
+
+#ifdef _LIBC
+# include <endian.h>
+# if __BYTE_ORDER == __BIG_ENDIAN
+#  define WORDS_BIGENDIAN 1
+# endif
+#endif
+
+#ifdef WORDS_BIGENDIAN
+# define SWAP(n)							\
+    (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
+#else
+# define SWAP(n) (n)
+#endif
+
+
+/* This array contains the bytes used to pad the buffer to the next
+   64-byte boundary.  (RFC 1321, 3.1: Step 1)  */
+static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ...  */ };
+
+
+/* Initialize structure containing state of computation.
+   (RFC 1321, 3.3: Step 3)  */
+void
+md5_init_ctx (ctx)
+     struct md5_ctx *ctx;
+{
+  ctx->A = 0x67452301;
+  ctx->B = 0xefcdab89;
+  ctx->C = 0x98badcfe;
+  ctx->D = 0x10325476;
+
+  ctx->total[0] = ctx->total[1] = 0;
+  ctx->buflen = 0;
+}
+
+/* Put result from CTX in first 16 bytes following RESBUF.  The result
+   must be in little endian byte order.
+
+   IMPORTANT: On some systems it is required that RESBUF is correctly
+   aligned for a 32 bits value.  */
+void *
+md5_read_ctx (ctx, resbuf)
+     const struct md5_ctx *ctx;
+     void *resbuf;
+{
+  ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
+  ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
+  ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C);
+  ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D);
+
+  return resbuf;
+}
+
+/* Process the remaining bytes in the internal buffer and the usual
+   prolog according to the standard and write the result to RESBUF.
+
+   IMPORTANT: On some systems it is required that RESBUF is correctly
+   aligned for a 32 bits value.  */
+void *
+md5_finish_ctx (ctx, resbuf)
+     struct md5_ctx *ctx;
+     void *resbuf;
+{
+  /* Take yet unprocessed bytes into account.  */
+  md5_uint32 bytes = ctx->buflen;
+  size_t pad;
+
+  /* Now count remaining bytes.  */
+  ctx->total[0] += bytes;
+  if (ctx->total[0] < bytes)
+    ++ctx->total[1];
+
+  pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
+  memcpy (&ctx->buffer[bytes], fillbuf, pad);
+
+  /* Put the 64-bit file length in *bits* at the end of the buffer.  */
+  *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
+  *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
+							(ctx->total[0] >> 29));
+
+  /* Process last bytes.  */
+  md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
+
+  return md5_read_ctx (ctx, resbuf);
+}
+
+/* Compute MD5 message digest for bytes read from STREAM.  The
+   resulting message digest number will be written into the 16 bytes
+   beginning at RESBLOCK.  */
+int
+md5_stream (stream, resblock)
+     FILE *stream;
+     void *resblock;
+{
+  /* Important: BLOCKSIZE must be a multiple of 64.  */
+#define BLOCKSIZE 4096
+  struct md5_ctx ctx;
+  char buffer[BLOCKSIZE + 72];
+  size_t sum;
+
+  /* Initialize the computation context.  */
+  md5_init_ctx (&ctx);
+
+  /* Iterate over full file contents.  */
+  while (1)
+    {
+      /* We read the file in blocks of BLOCKSIZE bytes.  One call of the
+	 computation function processes the whole buffer so that with the
+	 next round of the loop another block can be read.  */
+      size_t n;
+      sum = 0;
+
+      /* Read block.  Take care for partial reads.  */
+      do
+	{
+	  n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
+
+	  sum += n;
+	}
+      while (sum < BLOCKSIZE && n != 0);
+      if (n == 0 && ferror (stream))
+        return 1;
+
+      /* If end of file is reached, end the loop.  */
+      if (n == 0)
+	break;
+
+      /* Process buffer with BLOCKSIZE bytes.  Note that
+			BLOCKSIZE % 64 == 0
+       */
+      md5_process_block (buffer, BLOCKSIZE, &ctx);
+    }
+
+  /* Add the last bytes if necessary.  */
+  if (sum > 0)
+    md5_process_bytes (buffer, sum, &ctx);
+
+  /* Construct result in desired memory.  */
+  md5_finish_ctx (&ctx, resblock);
+  return 0;
+}
+
+/* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The
+   result is always in little endian byte order, so that a byte-wise
+   output yields to the wanted ASCII representation of the message
+   digest.  */
+void *
+md5_buffer (buffer, len, resblock)
+     const char *buffer;
+     size_t len;
+     void *resblock;
+{
+  struct md5_ctx ctx;
+
+  /* Initialize the computation context.  */
+  md5_init_ctx (&ctx);
+
+  /* Process whole buffer but last len % 64 bytes.  */
+  md5_process_bytes (buffer, len, &ctx);
+
+  /* Put result in desired memory area.  */
+  return md5_finish_ctx (&ctx, resblock);
+}
+
+
+void
+md5_process_bytes (buffer, len, ctx)
+     const void *buffer;
+     size_t len;
+     struct md5_ctx *ctx;
+{
+  /* When we already have some bits in our internal buffer concatenate
+     both inputs first.  */
+  if (ctx->buflen != 0)
+    {
+      size_t left_over = ctx->buflen;
+      size_t add = 128 - left_over > len ? len : 128 - left_over;
+
+      memcpy (&ctx->buffer[left_over], buffer, add);
+      ctx->buflen += add;
+
+      if (left_over + add > 64)
+	{
+	  md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx);
+	  /* The regions in the following copy operation cannot overlap.  */
+	  memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
+		  (left_over + add) & 63);
+	  ctx->buflen = (left_over + add) & 63;
+	}
+
+      buffer = (const char *) buffer + add;
+      len -= add;
+    }
+
+  /* Process available complete blocks.  */
+  if (len > 64)
+    {
+      md5_process_block (buffer, len & ~63, ctx);
+      buffer = (const char *) buffer + (len & ~63);
+      len &= 63;
+    }
+
+  /* Move remaining bytes in internal buffer.  */
+  if (len > 0)
+    {
+      memcpy (ctx->buffer, buffer, len);
+      ctx->buflen = len;
+    }
+}
+
+
+/* These are the four functions used in the four steps of the MD5 algorithm
+   and defined in the RFC 1321.  The first function is a little bit optimized
+   (as found in Colin Plumbs public domain implementation).  */
+/* #define FF(b, c, d) ((b & c) | (~b & d)) */
+#define FF(b, c, d) (d ^ (b & (c ^ d)))
+#define FG(b, c, d) FF (d, b, c)
+#define FH(b, c, d) (b ^ c ^ d)
+#define FI(b, c, d) (c ^ (b | ~d))
+
+/* Process LEN bytes of BUFFER, accumulating context into CTX.
+   It is assumed that LEN % 64 == 0.  */
+
+void
+md5_process_block (buffer, len, ctx)
+     const void *buffer;
+     size_t len;
+     struct md5_ctx *ctx;
+{
+  md5_uint32 correct_words[16];
+  const md5_uint32 *words = buffer;
+  size_t nwords = len / sizeof (md5_uint32);
+  const md5_uint32 *endp = words + nwords;
+  md5_uint32 A = ctx->A;
+  md5_uint32 B = ctx->B;
+  md5_uint32 C = ctx->C;
+  md5_uint32 D = ctx->D;
+
+  /* First increment the byte count.  RFC 1321 specifies the possible
+     length of the file up to 2^64 bits.  Here we only compute the
+     number of bytes.  Do a double word increment.  */
+  ctx->total[0] += len;
+  if (ctx->total[0] < len)
+    ++ctx->total[1];
+
+  /* Process all bytes in the buffer with 64 bytes in each round of
+     the loop.  */
+  while (words < endp)
+    {
+      md5_uint32 *cwp = correct_words;
+      md5_uint32 A_save = A;
+      md5_uint32 B_save = B;
+      md5_uint32 C_save = C;
+      md5_uint32 D_save = D;
+
+      /* First round: using the given function, the context and a constant
+	 the next context is computed.  Because the algorithms processing
+	 unit is a 32-bit word and it is determined to work on words in
+	 little endian byte order we perhaps have to change the byte order
+	 before the computation.  To reduce the work for the next steps
+	 we store the swapped words in the array CORRECT_WORDS.  */
+
+#define OP(a, b, c, d, s, T)						\
+      do								\
+        {								\
+	  a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T;		\
+	  ++words;							\
+	  CYCLIC (a, s);						\
+	  a += b;							\
+        }								\
+      while (0)
+
+      /* It is unfortunate that C does not provide an operator for
+	 cyclic rotation.  Hope the C compiler is smart enough.  */
+#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
+
+      /* Before we start, one word to the strange constants.
+	 They are defined in RFC 1321 as
+
+	 T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
+       */
+
+      /* Round 1.  */
+      OP (A, B, C, D,  7, 0xd76aa478);
+      OP (D, A, B, C, 12, 0xe8c7b756);
+      OP (C, D, A, B, 17, 0x242070db);
+      OP (B, C, D, A, 22, 0xc1bdceee);
+      OP (A, B, C, D,  7, 0xf57c0faf);
+      OP (D, A, B, C, 12, 0x4787c62a);
+      OP (C, D, A, B, 17, 0xa8304613);
+      OP (B, C, D, A, 22, 0xfd469501);
+      OP (A, B, C, D,  7, 0x698098d8);
+      OP (D, A, B, C, 12, 0x8b44f7af);
+      OP (C, D, A, B, 17, 0xffff5bb1);
+      OP (B, C, D, A, 22, 0x895cd7be);
+      OP (A, B, C, D,  7, 0x6b901122);
+      OP (D, A, B, C, 12, 0xfd987193);
+      OP (C, D, A, B, 17, 0xa679438e);
+      OP (B, C, D, A, 22, 0x49b40821);
+
+      /* For the second to fourth round we have the possibly swapped words
+	 in CORRECT_WORDS.  Redefine the macro to take an additional first
+	 argument specifying the function to use.  */
+#undef OP
+#define OP(f, a, b, c, d, k, s, T)					\
+      do 								\
+	{								\
+	  a += f (b, c, d) + correct_words[k] + T;			\
+	  CYCLIC (a, s);						\
+	  a += b;							\
+	}								\
+      while (0)
+
+      /* Round 2.  */
+      OP (FG, A, B, C, D,  1,  5, 0xf61e2562);
+      OP (FG, D, A, B, C,  6,  9, 0xc040b340);
+      OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
+      OP (FG, B, C, D, A,  0, 20, 0xe9b6c7aa);
+      OP (FG, A, B, C, D,  5,  5, 0xd62f105d);
+      OP (FG, D, A, B, C, 10,  9, 0x02441453);
+      OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
+      OP (FG, B, C, D, A,  4, 20, 0xe7d3fbc8);
+      OP (FG, A, B, C, D,  9,  5, 0x21e1cde6);
+      OP (FG, D, A, B, C, 14,  9, 0xc33707d6);
+      OP (FG, C, D, A, B,  3, 14, 0xf4d50d87);
+      OP (FG, B, C, D, A,  8, 20, 0x455a14ed);
+      OP (FG, A, B, C, D, 13,  5, 0xa9e3e905);
+      OP (FG, D, A, B, C,  2,  9, 0xfcefa3f8);
+      OP (FG, C, D, A, B,  7, 14, 0x676f02d9);
+      OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
+
+      /* Round 3.  */
+      OP (FH, A, B, C, D,  5,  4, 0xfffa3942);
+      OP (FH, D, A, B, C,  8, 11, 0x8771f681);
+      OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
+      OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
+      OP (FH, A, B, C, D,  1,  4, 0xa4beea44);
+      OP (FH, D, A, B, C,  4, 11, 0x4bdecfa9);
+      OP (FH, C, D, A, B,  7, 16, 0xf6bb4b60);
+      OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
+      OP (FH, A, B, C, D, 13,  4, 0x289b7ec6);
+      OP (FH, D, A, B, C,  0, 11, 0xeaa127fa);
+      OP (FH, C, D, A, B,  3, 16, 0xd4ef3085);
+      OP (FH, B, C, D, A,  6, 23, 0x04881d05);
+      OP (FH, A, B, C, D,  9,  4, 0xd9d4d039);
+      OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
+      OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
+      OP (FH, B, C, D, A,  2, 23, 0xc4ac5665);
+
+      /* Round 4.  */
+      OP (FI, A, B, C, D,  0,  6, 0xf4292244);
+      OP (FI, D, A, B, C,  7, 10, 0x432aff97);
+      OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
+      OP (FI, B, C, D, A,  5, 21, 0xfc93a039);
+      OP (FI, A, B, C, D, 12,  6, 0x655b59c3);
+      OP (FI, D, A, B, C,  3, 10, 0x8f0ccc92);
+      OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
+      OP (FI, B, C, D, A,  1, 21, 0x85845dd1);
+      OP (FI, A, B, C, D,  8,  6, 0x6fa87e4f);
+      OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
+      OP (FI, C, D, A, B,  6, 15, 0xa3014314);
+      OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
+      OP (FI, A, B, C, D,  4,  6, 0xf7537e82);
+      OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
+      OP (FI, C, D, A, B,  2, 15, 0x2ad7d2bb);
+      OP (FI, B, C, D, A,  9, 21, 0xeb86d391);
+
+      /* Add the starting values of the context.  */
+      A += A_save;
+      B += B_save;
+      C += C_save;
+      D += D_save;
+    }
+
+  /* Put checksum in context given as argument.  */
+  ctx->A = A;
+  ctx->B = B;
+  ctx->C = C;
+  ctx->D = D;
+}
diff --git a/libiberty/memcmp.c b/libiberty/memcmp.c
index 127ae0c..0fd21ca 100644
--- a/libiberty/memcmp.c
+++ b/libiberty/memcmp.c
@@ -25,8 +25,8 @@
 DEFUN(memcmp, (str1, str2, count),
       const PTR str1 AND const PTR str2 AND size_t count)
 {
-  register unsigned char *s1 = (unsigned char*)str1;
-  register unsigned char *s2 = (unsigned char*)str2;
+  register const unsigned char *s1 = (const unsigned char*)str1;
+  register const unsigned char *s2 = (const unsigned char*)str2;
 
   while (count-- > 0)
     {
diff --git a/libiberty/mkstemps.c b/libiberty/mkstemps.c
index 16c16a2..4b89162 100644
--- a/libiberty/mkstemps.c
+++ b/libiberty/mkstemps.c
@@ -20,6 +20,7 @@
 #include "config.h"
 #endif
 
+#include <sys/types.h>
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
@@ -39,7 +40,7 @@
 
 /* We need to provide a type for gcc_uint64_t.  */
 #ifdef __GNUC__
-typedef unsigned long long gcc_uint64_t;
+__extension__ typedef unsigned long long gcc_uint64_t;
 #else
 typedef unsigned long gcc_uint64_t;
 #endif
diff --git a/libiberty/partition.c b/libiberty/partition.c
index 52fb128..a5a7349 100644
--- a/libiberty/partition.c
+++ b/libiberty/partition.c
@@ -34,6 +34,8 @@
 #include "libiberty.h"
 #include "partition.h"
 
+static int elem_compare PARAMS ((const void *, const void *));
+
 /* Creates a partition of NUM_ELEMENTS elements.  Initially each
    element is in a class by itself.  */
 
@@ -128,8 +130,8 @@
      const void *elem1;
      const void *elem2;
 {
-  int e1 = * (int *) elem1;
-  int e2 = * (int *) elem2;
+  int e1 = * (const int *) elem1;
+  int e2 = * (const int *) elem2;
   if (e1 < e2)
     return -1;
   else if (e1 > e2)
@@ -175,7 +177,7 @@
 	  c = elements[c].next - elements;
 	}
 	/* Sort them.  */
-	qsort ((void *) class_elements, count, sizeof (int), &elem_compare);
+	qsort ((void *) class_elements, count, sizeof (int), elem_compare);
 	/* Print them.  */
 	fputc ('(', fp);
 	for (i = 0; i < count; ++i) 
diff --git a/libiberty/pexecute.c b/libiberty/pexecute.c
index f1aea9d..32943af 100644
--- a/libiberty/pexecute.c
+++ b/libiberty/pexecute.c
@@ -29,6 +29,9 @@
 
 #include <stdio.h>
 #include <errno.h>
+#ifdef NEED_DECLARATION_ERRNO
+extern int errno;
+#endif
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
@@ -38,25 +41,12 @@
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
-#define ISSPACE (x) isspace(x)
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif
 
-#ifdef vfork /* Autoconf may define this to fork for us. */
-# define VFORK_STRING "fork"
-#else
-# define VFORK_STRING "vfork"
-#endif
-#ifdef HAVE_VFORK_H
-#include <vfork.h>
-#endif
-#ifdef VMS
-#define vfork() (decc$$alloc_vfork_blocks() >= 0 ? \
-               lib$get_current_invo_context(decc$$get_vfork_jmpbuf()) : -1)
-#endif /* VMS */
-
 #include "libiberty.h"
+#include "safe-ctype.h"
 
 /* stdin file number.  */
 #define STDIN_FILE_NO 0
@@ -154,9 +144,9 @@
   if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
     abort ();
 
-#ifdef __GO32__
+#ifdef __DJGPP__
   /* ??? What are the possible return values from spawnv?  */
-  rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (1, program, argv);
+  rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (P_WAIT, program, argv);
 #else
   char *scmd, *rf;
   FILE *argfile;
@@ -205,7 +195,7 @@
   if (rc == -1)
     {
       *errmsg_fmt = install_error_msg;
-      *errmsg_arg = program;
+      *errmsg_arg = (char *)program;
       return -1;
     }
 
@@ -214,6 +204,13 @@
   return last_pid;
 }
 
+/* Use ECHILD if available, otherwise use EINVAL.  */
+#ifdef ECHILD
+#define PWAIT_ERROR ECHILD
+#else
+#define PWAIT_ERROR EINVAL
+#endif
+
 int
 pwait (pid, status, flags)
      int pid;
@@ -225,13 +222,16 @@
       /* Called twice for the same child?  */
       || pid == last_reaped)
     {
-      /* ??? ECHILD would be a better choice.  Can we use it here?  */
-      errno = EINVAL;
+      errno = PWAIT_ERROR;
       return -1;
     }
   /* ??? Here's an opportunity to canonicalize the values in STATUS.
      Needed?  */
+#ifdef __DJGPP__
+  *status = (last_status >> 8);
+#else
   *status = last_status;
+#endif
   last_reaped = last_pid;
   return last_pid;
 }
@@ -701,9 +701,10 @@
 
   /* Fork a subprocess; wait and retry if it fails.  */
   sleep_interval = 1;
+  pid = -1;
   for (retries = 0; retries < 4; retries++)
     {
-      pid = vfork ();
+      pid = fork ();
       if (pid >= 0)
 	break;
       sleep (sleep_interval);
@@ -713,11 +714,9 @@
   switch (pid)
     {
     case -1:
-      {
-	*errmsg_fmt = VFORK_STRING;
-	*errmsg_arg = NULL;
-	return -1;
-      }
+      *errmsg_fmt = "fork";
+      *errmsg_arg = NULL;
+      return -1;
 
     case 0: /* child */
       /* Move the input and output pipes into place, if necessary.  */
@@ -741,7 +740,6 @@
       /* Exec the program.  */
       (*func) (program, argv);
 
-      /* Note: Calling fprintf and exit here doesn't seem right for vfork.  */
       fprintf (stderr, "%s: ", this_pname);
       fprintf (stderr, install_error_msg, program);
       fprintf (stderr, ": %s\n", xstrerror (errno));
diff --git a/libiberty/rename.c b/libiberty/rename.c
index ae26e2d..2e9dec1 100644
--- a/libiberty/rename.c
+++ b/libiberty/rename.c
@@ -3,7 +3,13 @@
 
 /* Rename a file.  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include <errno.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 int
 rename (zfrom, zto)
diff --git a/libiberty/safe-ctype.c b/libiberty/safe-ctype.c
new file mode 100644
index 0000000..0c2be3e
--- /dev/null
+++ b/libiberty/safe-ctype.c
@@ -0,0 +1,163 @@
+/* <ctype.h> replacement macros.
+
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Contributed by Zack Weinberg <zackw@stanford.edu>.
+
+This file is part of the libiberty library.
+Libiberty 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.
+
+Libiberty 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 libiberty; 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 is a compatible replacement of the standard C library's <ctype.h>
+   with the following properties:
+
+   - Implements all isxxx() macros required by C99.
+   - Also implements some character classes useful when
+     parsing C-like languages.
+   - Does not change behavior depending on the current locale.
+   - Behaves properly for all values in the range of a signed or
+     unsigned char.  */
+
+#include "ansidecl.h"
+#include <safe-ctype.h>
+#include <stdio.h>  /* for EOF */
+
+/* Shorthand */
+#define bl _sch_isblank
+#define cn _sch_iscntrl
+#define di _sch_isdigit
+#define is _sch_isidst
+#define lo _sch_islower
+#define nv _sch_isnvsp
+#define pn _sch_ispunct
+#define pr _sch_isprint
+#define sp _sch_isspace
+#define up _sch_isupper
+#define vs _sch_isvsp
+#define xd _sch_isxdigit
+
+/* Masks.  */
+#define L  lo|is   |pr	/* lower case letter */
+#define XL lo|is|xd|pr	/* lowercase hex digit */
+#define U  up|is   |pr	/* upper case letter */
+#define XU up|is|xd|pr	/* uppercase hex digit */
+#define D  di   |xd|pr	/* decimal digit */
+#define P  pn      |pr	/* punctuation */
+#define _  pn|is   |pr	/* underscore */
+
+#define C           cn	/* control character */
+#define Z  nv      |cn	/* NUL */
+#define M  nv|sp   |cn	/* cursor movement: \f \v */
+#define V  vs|sp   |cn	/* vertical space: \r \n */
+#define T  nv|sp|bl|cn	/* tab */
+#define S  nv|sp|bl|pr	/* space */
+
+/* Are we ASCII? */
+#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
+  && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \
+  && EOF == -1
+
+const unsigned short _sch_istable[256] =
+{
+  Z,  C,  C,  C,   C,  C,  C,  C,   /* NUL SOH STX ETX  EOT ENQ ACK BEL */
+  C,  T,  V,  M,   M,  V,  C,  C,   /* BS  HT  LF  VT   FF  CR  SO  SI  */
+  C,  C,  C,  C,   C,  C,  C,  C,   /* DLE DC1 DC2 DC3  DC4 NAK SYN ETB */
+  C,  C,  C,  C,   C,  C,  C,  C,   /* CAN EM  SUB ESC  FS  GS  RS  US  */
+  S,  P,  P,  P,   P,  P,  P,  P,   /* SP  !   "   #    $   %   &   '   */
+  P,  P,  P,  P,   P,  P,  P,  P,   /* (   )   *   +    ,   -   .   /   */
+  D,  D,  D,  D,   D,  D,  D,  D,   /* 0   1   2   3    4   5   6   7   */
+  D,  D,  P,  P,   P,  P,  P,  P,   /* 8   9   :   ;    <   =   >   ?   */
+  P, XU, XU, XU,  XU, XU, XU,  U,   /* @   A   B   C    D   E   F   G   */
+  U,  U,  U,  U,   U,  U,  U,  U,   /* H   I   J   K    L   M   N   O   */
+  U,  U,  U,  U,   U,  U,  U,  U,   /* P   Q   R   S    T   U   V   W   */
+  U,  U,  U,  P,   P,  P,  P,  _,   /* X   Y   Z   [    \   ]   ^   _   */
+  P, XL, XL, XL,  XL, XL, XL,  L,   /* `   a   b   c    d   e   f   g   */
+  L,  L,  L,  L,   L,  L,  L,  L,   /* h   i   j   k    l   m   n   o   */
+  L,  L,  L,  L,   L,  L,  L,  L,   /* p   q   r   s    t   u   v   w   */
+  L,  L,  L,  P,   P,  P,  P,  C,   /* x   y   z   {    |   }   ~   DEL */
+
+  /* high half of unsigned char is locale-specific, so all tests are
+     false in "C" locale */
+  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,
+  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,
+  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,
+  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,
+
+  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,
+  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,
+  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,
+  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,
+};
+
+const unsigned char _sch_tolower[256] =
+{
+   0,  1,  2,  3,   4,  5,  6,  7,   8,  9, 10, 11,  12, 13, 14, 15,
+  16, 17, 18, 19,  20, 21, 22, 23,  24, 25, 26, 27,  28, 29, 30, 31,
+  32, 33, 34, 35,  36, 37, 38, 39,  40, 41, 42, 43,  44, 45, 46, 47,
+  48, 49, 50, 51,  52, 53, 54, 55,  56, 57, 58, 59,  60, 61, 62, 63,
+  64,
+
+  'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+  'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+
+  91, 92, 93, 94, 95, 96,
+
+  'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+  'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+
+ 123,124,125,126,127,
+
+ 128,129,130,131, 132,133,134,135, 136,137,138,139, 140,141,142,143,
+ 144,145,146,147, 148,149,150,151, 152,153,154,155, 156,157,158,159,
+ 160,161,162,163, 164,165,166,167, 168,169,170,171, 172,173,174,175,
+ 176,177,178,179, 180,181,182,183, 184,185,186,187, 188,189,190,191,
+
+ 192,193,194,195, 196,197,198,199, 200,201,202,203, 204,205,206,207,
+ 208,209,210,211, 212,213,214,215, 216,217,218,219, 220,221,222,223,
+ 224,225,226,227, 228,229,230,231, 232,233,234,235, 236,237,238,239,
+ 240,241,242,243, 244,245,246,247, 248,249,250,251, 252,253,254,255,
+};
+
+const unsigned char _sch_toupper[256] =
+{
+   0,  1,  2,  3,   4,  5,  6,  7,   8,  9, 10, 11,  12, 13, 14, 15,
+  16, 17, 18, 19,  20, 21, 22, 23,  24, 25, 26, 27,  28, 29, 30, 31,
+  32, 33, 34, 35,  36, 37, 38, 39,  40, 41, 42, 43,  44, 45, 46, 47,
+  48, 49, 50, 51,  52, 53, 54, 55,  56, 57, 58, 59,  60, 61, 62, 63,
+  64,
+
+  'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+  'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+
+  91, 92, 93, 94, 95, 96,
+
+  'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+  'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+
+ 123,124,125,126,127,
+
+ 128,129,130,131, 132,133,134,135, 136,137,138,139, 140,141,142,143,
+ 144,145,146,147, 148,149,150,151, 152,153,154,155, 156,157,158,159,
+ 160,161,162,163, 164,165,166,167, 168,169,170,171, 172,173,174,175,
+ 176,177,178,179, 180,181,182,183, 184,185,186,187, 188,189,190,191,
+
+ 192,193,194,195, 196,197,198,199, 200,201,202,203, 204,205,206,207,
+ 208,209,210,211, 212,213,214,215, 216,217,218,219, 220,221,222,223,
+ 224,225,226,227, 228,229,230,231, 232,233,234,235, 236,237,238,239,
+ 240,241,242,243, 244,245,246,247, 248,249,250,251, 252,253,254,255,
+};
+
+#else
+ #error "Unsupported host character set"
+#endif /* not ASCII */
diff --git a/libiberty/setenv.c b/libiberty/setenv.c
index eec1300..f025716 100644
--- a/libiberty/setenv.c
+++ b/libiberty/setenv.c
@@ -63,7 +63,7 @@
      const char *value;
      int replace;
 {
-  register char **ep;
+  register char **ep = 0;
   register size_t size;
   const size_t namelen = strlen (name);
   const size_t vallen = strlen (value) + 1;
@@ -72,11 +72,13 @@
 
   size = 0;
   if (__environ != NULL)
-    for (ep = __environ; *ep != NULL; ++ep)
-      if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
-	break;
-      else
-	++size;
+    {
+      for (ep = __environ; *ep != NULL; ++ep)
+	if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
+	  break;
+	else
+	  ++size;
+    }
 
   if (__environ == NULL || *ep == NULL)
     {
diff --git a/libiberty/sigsetmask.c b/libiberty/sigsetmask.c
index 2a09e6a..db6408d 100644
--- a/libiberty/sigsetmask.c
+++ b/libiberty/sigsetmask.c
@@ -12,6 +12,8 @@
 #include <sys/types.h>
 #include <signal.h>
 
+extern void abort PARAMS ((void)) ATTRIBUTE_NORETURN;
+
 #ifdef SIG_SETMASK
 int
 DEFUN(sigsetmask,(set),
diff --git a/libiberty/sort.c b/libiberty/sort.c
index da2d660..90c97e0 100644
--- a/libiberty/sort.c
+++ b/libiberty/sort.c
@@ -24,7 +24,12 @@
 #endif
 #include "libiberty.h"
 #include "sort.h"
+#ifdef HAVE_LIMITS_H
 #include <limits.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
diff --git a/libiberty/splay-tree.c b/libiberty/splay-tree.c
index de66d11..52b57c0 100644
--- a/libiberty/splay-tree.c
+++ b/libiberty/splay-tree.c
@@ -1,5 +1,5 @@
 /* A splay-tree datatype.  
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    Contributed by Mark Mitchell (mark@markmitchell.com).
 
 This file is part of GNU CC.
@@ -32,6 +32,8 @@
 #include <stdlib.h>
 #endif
 
+#include <stdio.h>
+
 #include "libiberty.h"
 #include "splay-tree.h"
 
@@ -303,8 +305,8 @@
 	  node->right->left = 0;
 	}
 
-    sp->root = node;
-  }
+      sp->root = node;
+    }
 
   return sp->root;
 }
@@ -366,6 +368,72 @@
     return 0;
 }
 
+/* Return the immediate predecessor KEY, or NULL if there is no
+   predecessor.  KEY need not be present in the tree.  */
+
+splay_tree_node
+splay_tree_predecessor (sp, key)
+     splay_tree sp;
+     splay_tree_key key;
+{
+  int comparison;
+  splay_tree_node node;
+
+  /* If the tree is empty, there is certainly no predecessor.  */
+  if (!sp->root)
+    return NULL;
+
+  /* Splay the tree around KEY.  That will leave either the KEY
+     itself, its predecessor, or its successor at the root.  */
+  splay_tree_splay (sp, key);
+  comparison = (*sp->comp)(sp->root->key, key);
+
+  /* If the predecessor is at the root, just return it.  */
+  if (comparison < 0)
+    return sp->root;
+
+  /* Otherwise, find the leftmost element of the right subtree.  */
+  node = sp->root->left;
+  if (node)
+    while (node->right)
+      node = node->right;
+
+  return node;
+}
+
+/* Return the immediate successor KEY, or NULL if there is no
+   predecessor.  KEY need not be present in the tree.  */
+
+splay_tree_node
+splay_tree_successor (sp, key)
+     splay_tree sp;
+     splay_tree_key key;
+{
+  int comparison;
+  splay_tree_node node;
+
+  /* If the tree is empty, there is certainly no predecessor.  */
+  if (!sp->root)
+    return NULL;
+
+  /* Splay the tree around KEY.  That will leave either the KEY
+     itself, its predecessor, or its successor at the root.  */
+  splay_tree_splay (sp, key);
+  comparison = (*sp->comp)(sp->root->key, key);
+
+  /* If the successor is at the root, just return it.  */
+  if (comparison > 0)
+    return sp->root;
+
+  /* Otherwise, find the rightmost element of the left subtree.  */
+  node = sp->root->right;
+  if (node)
+    while (node->left)
+      node = node->left;
+
+  return node;
+}
+
 /* Call FN, passing it the DATA, for every node in SP, following an
    in-order traversal.  If FN every returns a non-zero value, the
    iteration ceases immediately, and the value is returned.
diff --git a/libiberty/strncmp.c b/libiberty/strncmp.c
new file mode 100644
index 0000000..b3b9de1
--- /dev/null
+++ b/libiberty/strncmp.c
@@ -0,0 +1,28 @@
+/* strncmp -- compare two strings, stop after n bytes.
+   This function is in the public domain.  */
+
+#include <ansidecl.h>
+#ifdef __STDC__
+#include <stddef.h>
+#else
+#define size_t unsigned long
+#endif
+
+int
+strncmp(s1, s2, n)
+     const char *s1, *s2;
+     register size_t n;
+{
+  register unsigned char u1, u2;
+
+  while (n-- > 0)
+    {
+      u1 = (unsigned char) *s1++;
+      u2 = (unsigned char) *s2++;
+      if (u1 != u2)
+	return u1 - u2;
+      if (u1 == '\0')
+	return 0;
+    }
+  return 0;
+}
diff --git a/libiberty/strtod.c b/libiberty/strtod.c
index c86c73d..90292c2 100644
--- a/libiberty/strtod.c
+++ b/libiberty/strtod.c
@@ -22,7 +22,8 @@
 This exception does not however invalidate any other reasons why
 the executable file might be covered by the GNU General Public License. */
 
-#include <ctype.h>
+#include "ansidecl.h"
+#include "safe-ctype.h"
 
 extern double atof ();
 
@@ -42,7 +43,7 @@
   
   p = str;
   
-  while (isspace (*p))
+  while (ISSPACE (*p))
     ++p;
   
   if (*p == '+' || *p == '-')
@@ -88,10 +89,10 @@
     }
 
   /* digits, with 0 or 1 periods in it.  */
-  if (isdigit (*p) || *p == '.')
+  if (ISDIGIT (*p) || *p == '.')
     {
       int got_dot = 0;
-      while (isdigit (*p) || (!got_dot && *p == '.'))
+      while (ISDIGIT (*p) || (!got_dot && *p == '.'))
 	{
 	  if (*p == '.')
 	    got_dot = 1;
@@ -105,9 +106,9 @@
 	  i = 1;
 	  if (p[i] == '+' || p[i] == '-')
 	    ++i;
-	  if (isdigit (p[i]))
+	  if (ISDIGIT (p[i]))
 	    {
-	      while (isdigit (p[i]))
+	      while (ISDIGIT (p[i]))
 		++i;
 	      *ptr = p + i;
 	      return atof (str);
diff --git a/libiberty/strtol.c b/libiberty/strtol.c
index 5467cc3..7095c72 100644
--- a/libiberty/strtol.c
+++ b/libiberty/strtol.c
@@ -28,13 +28,20 @@
  * SUCH DAMAGE.
  */
 
-#include <limits.h>
-#include <ctype.h>
-#include <errno.h>
-#if 0
-#include <stdlib.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
 #endif
-#include "ansidecl.h"
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <errno.h>
+#ifdef NEED_DECLARATION_ERRNO
+extern int errno;
+#endif
+#include "safe-ctype.h"
 
 /* FIXME: It'd be nice to configure around these, but the include files are too
    painful.  These macros should at least be more portable than hardwired hex
@@ -77,7 +84,7 @@
 	 */
 	do {
 		c = *s++;
-	} while (isspace(c));
+	} while (ISSPACE(c));
 	if (c == '-') {
 		neg = 1;
 		c = *s++;
@@ -113,10 +120,10 @@
 	cutlim = cutoff % (unsigned long)base;
 	cutoff /= (unsigned long)base;
 	for (acc = 0, any = 0;; c = *s++) {
-		if (isdigit(c))
+		if (ISDIGIT(c))
 			c -= '0';
-		else if (isalpha(c))
-			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+		else if (ISALPHA(c))
+			c -= ISUPPER(c) ? 'A' - 10 : 'a' - 10;
 		else
 			break;
 		if (c >= base)
diff --git a/libiberty/strtoul.c b/libiberty/strtoul.c
index 2ec3204..66420f2 100644
--- a/libiberty/strtoul.c
+++ b/libiberty/strtoul.c
@@ -28,13 +28,24 @@
  * SUCH DAMAGE.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#ifdef HAVE_LIMITS_H
 #include <limits.h>
-#include <ctype.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
 #include <errno.h>
+#ifdef NEED_DECLARATION_ERRNO
+extern int errno;
+#endif
 #if 0
 #include <stdlib.h>
 #endif
 #include "ansidecl.h"
+#include "safe-ctype.h"
 
 #ifndef ULONG_MAX
 #define	ULONG_MAX	((unsigned long)(~0L))		/* 0xFFFFFFFF */
@@ -63,7 +74,7 @@
 	 */
 	do {
 		c = *s++;
-	} while (isspace(c));
+	} while (ISSPACE(c));
 	if (c == '-') {
 		neg = 1;
 		c = *s++;
@@ -80,10 +91,10 @@
 	cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
 	cutlim = (unsigned long)ULONG_MAX % (unsigned long)base;
 	for (acc = 0, any = 0;; c = *s++) {
-		if (isdigit(c))
+		if (ISDIGIT(c))
 			c -= '0';
-		else if (isalpha(c))
-			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+		else if (ISALPHA(c))
+			c -= ISUPPER(c) ? 'A' - 10 : 'a' - 10;
 		else
 			break;
 		if (c >= base)
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index d3a1fe4..a5d72fa 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -2486,3 +2486,83 @@
 --format=gnu
 f__FGt3Bar1i24XY_t
 f(Bar<2>, XY_t)
+#
+--format=gnu
+foo__H1Zt2TA2ZRCiZt2NA1Ui9_X01_i
+int foo<TA<int const &, NA<9> > >(TA<int const &, NA<9> >)
+#
+--format=gnu
+foo__H1Zt2TA2ZcZt2NA1Ui_20__X01_i
+int foo<TA<char, NA<20> > >(TA<char, NA<20> >)
+#
+--format=gnu
+foo__H1Zt2TA2ZiZt8N___A___1Ui_99__X01_i
+int foo<TA<int, N___A___<99> > >(TA<int, N___A___<99> >)
+#
+--format=gnu
+foo__H1Zt2TA2ZRCiZt2NA1im1_X01_i
+int foo<TA<int const &, NA<-1> > >(TA<int const &, NA<-1> >)
+#
+--format=gnu
+foo__H1Zt2TA2ZRCiZt2NA1im9_X01_i
+int foo<TA<int const &, NA<-9> > >(TA<int const &, NA<-9> >)
+#
+--format=gnu
+foo__H1Zt2TA2ZcZt2NA1i_m20__X01_i
+int foo<TA<char, NA<-20> > >(TA<char, NA<-20> >)
+#
+--format=gnu
+foo__H1Zt2TA2ZcZt2NA1im1_X01_i
+int foo<TA<char, NA<-1> > >(TA<char, NA<-1> >)
+#
+--format=gnu
+foo__H1Zt2TA2ZiZt4N__A1im9_X01_i
+int foo<TA<int, N__A<-9> > >(TA<int, N__A<-9> >)
+#
+--format=gnu
+foo__H1Zt2TA2ZiZt4N__A1i_m99__X01_i
+int foo<TA<int, N__A<-99> > >(TA<int, N__A<-99> >)
+#
+--format=gnu
+__opi__t2TA2ZiZt4N__A1i9
+TA<int, N__A<9> >::operator int(void)
+#
+--format=gnu
+__opi__t2TA2ZiZt8N___A___1i_m99_
+TA<int, N___A___<-99> >::operator int(void)
+#
+--format=gnu
+foo___bar__baz_____H1Zt2TA2ZiZt8N___A___1i_99__X01_i
+int foo___bar__baz___<TA<int, N___A___<99> > >(TA<int, N___A___<99> >)
+#
+--format=gnu
+foo__bar___foobar_____t2TA2ZiZt8N___A___1i_m99_
+TA<int, N___A___<-99> >::foo__bar___foobar___(void)
+#
+--format=gnu
+foo__bar___foobar_____t2TA2ZiZt4N__A1i9
+TA<int, N__A<9> >::foo__bar___foobar___(void)
+#
+--format=gnu
+__tfP8sockaddr
+sockaddr * type_info function
+#
+--format=gnu
+__tfPQ25libcwt16option_event_tct1Z12burst_app_ct
+libcw::option_event_tct<burst_app_ct> * type_info function
+#
+--format=gnu
+__tiP8sockaddr
+sockaddr * type_info node
+#
+--format=gnu
+__tiPQ25libcwt16option_event_tct1Z12burst_app_ct
+libcw::option_event_tct<burst_app_ct> * type_info node
+#
+--format=gnu
+_27_GLOBAL_.N.__12burst_app_ct.app_instance
+{anonymous}::app_instance
+#
+--format=gnu
+_26_GLOBAL_\$N\$_tmp_n.iilg4Gya\$app_instance
+{anonymous}::app_instance
diff --git a/libiberty/testsuite/regress-demangle b/libiberty/testsuite/regress-demangle
index bd48ce9..1086762 100755
--- a/libiberty/testsuite/regress-demangle
+++ b/libiberty/testsuite/regress-demangle
@@ -15,6 +15,8 @@
      if test "x$x" != "x$demangled"; then
 	failures=`expr $failures + 1`
 	echo "FAIL: $type $mangled"
+	echo "   result: $x"
+	echo " expected: $demangled"
      fi
   done
 
diff --git a/libiberty/vasprintf.c b/libiberty/vasprintf.c
index b959f5f..c34585d 100644
--- a/libiberty/vasprintf.c
+++ b/libiberty/vasprintf.c
@@ -18,21 +18,31 @@
 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-#ifdef __STDC__
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <ansidecl.h>
+#ifdef ANSI_PROTOTYPES
 #include <stdarg.h>
 #else
 #include <varargs.h>
 #endif
 #include <stdio.h>
 #include <string.h>
-#include <ansidecl.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#else
+extern unsigned long strtoul ();
+extern PTR malloc ();
+#endif
+#include "libiberty.h"
 
 #ifdef TEST
 int global_total_width;
 #endif
 
-unsigned long strtoul ();
-char *malloc ();
+
+static int int_vasprintf PARAMS ((char **, const char *, va_list *));
 
 static int
 int_vasprintf (result, format, args)
@@ -60,7 +70,7 @@
 	      total_width += abs (va_arg (ap, int));
 	    }
 	  else
-	    total_width += strtoul (p, &p, 10);
+	    total_width += strtoul (p, (char **) &p, 10);
 	  if (*p == '.')
 	    {
 	      ++p;
@@ -70,7 +80,7 @@
 		  total_width += abs (va_arg (ap, int));
 		}
 	      else
-	      total_width += strtoul (p, &p, 10);
+	      total_width += strtoul (p, (char **) &p, 10);
 	    }
 	  while (strchr ("hlL", *p))
 	    ++p;
@@ -132,33 +142,33 @@
 }
 
 #ifdef TEST
-void
-checkit
-#ifdef __STDC__
-     (const char* format, ...)
-#else
-     (va_alist)
-     va_dcl
-#endif
+static void checkit PARAMS ((const char *, ...));
+
+static void
+checkit VPARAMS ((const char* format, ...))
 {
   va_list args;
   char *result;
-
-#ifdef __STDC__
-  va_start (args, format);
-#else
-  char *format;
-  va_start (args);
-  format = va_arg (args, char *);
+#ifndef ANSI_PROTOTYPES
+  const char *format;
 #endif
+
+  VA_START (args, format);
+
+#ifndef ANSI_PROTOTYPES
+  format = va_arg (args, const char *);
+#endif
+
   vasprintf (&result, format, args);
-  if (strlen (result) < global_total_width)
+  if (strlen (result) < (size_t) global_total_width)
     printf ("PASS: ");
   else
     printf ("FAIL: ");
   printf ("%d %s\n", global_total_width, result);
 }
 
+extern int main PARAMS ((void));
+
 int
 main ()
 {
@@ -169,5 +179,7 @@
   checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
 777777777777777777333333333333366666666666622222222222777777777777733333");
   checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx");
+
+  return 0;
 }
 #endif /* TEST */
diff --git a/libiberty/vfork.c b/libiberty/vfork.c
index 86c4591..5e87721 100644
--- a/libiberty/vfork.c
+++ b/libiberty/vfork.c
@@ -1,6 +1,10 @@
 /* Emulate vfork using just plain fork, for systems without a real vfork.
    This function is in the public domain. */
 
+#include "ansidecl.h"
+
+extern int fork PARAMS ((void));
+
 int
 vfork ()
 {
diff --git a/libiberty/waitpid.c b/libiberty/waitpid.c
index 23db0b9..2848309 100644
--- a/libiberty/waitpid.c
+++ b/libiberty/waitpid.c
@@ -1,3 +1,10 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
 int
 waitpid (pid, stat_loc, options)
 	int pid, *stat_loc, options;
diff --git a/libiberty/xexit.c b/libiberty/xexit.c
index 7aa52ac..e8b1ed1 100644
--- a/libiberty/xexit.c
+++ b/libiberty/xexit.c
@@ -17,13 +17,15 @@
 to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-#include "ansidecl.h"
-#include "libiberty.h"
-
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include <stdio.h>
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
+#include "libiberty.h"
+
 
 /* This variable is set by xatexit if it is called.  This way, xmalloc
    doesn't drag xatexit into the link.  */
diff --git a/libiberty/xmalloc.c b/libiberty/xmalloc.c
index 621c6d2..3ea2d4a 100644
--- a/libiberty/xmalloc.c
+++ b/libiberty/xmalloc.c
@@ -17,6 +17,9 @@
 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 "ansidecl.h"
 #include "libiberty.h"
 
@@ -61,6 +64,31 @@
 #endif /* HAVE_SBRK */
 }
 
+void
+xmalloc_failed (size)
+     size_t size;
+{
+#ifdef HAVE_SBRK
+  extern char **environ;
+  size_t allocated;
+
+  if (first_break != NULL)
+    allocated = (char *) sbrk (0) - first_break;
+  else
+    allocated = (char *) sbrk (0) - (char *) &environ;
+  fprintf (stderr,
+	   "\n%s%sCannot allocate %lu bytes after allocating %lu bytes\n",
+	   name, *name ? ": " : "",
+	   (unsigned long) size, (unsigned long) allocated);
+#else /* HAVE_SBRK */
+  fprintf (stderr,
+	   "\n%s%sCannot allocate %lu bytes\n",
+	   name, *name ? ": " : "",
+	   (unsigned long) size);
+#endif /* HAVE_SBRK */
+  xexit (1);
+}  
+
 PTR
 xmalloc (size)
     size_t size;
@@ -71,27 +99,8 @@
     size = 1;
   newmem = malloc (size);
   if (!newmem)
-    {
-#ifdef HAVE_SBRK
-      extern char **environ;
-      size_t allocated;
+    xmalloc_failed (size);
 
-      if (first_break != NULL)
-	allocated = (char *) sbrk (0) - first_break;
-      else
-	allocated = (char *) sbrk (0) - (char *) &environ;
-      fprintf (stderr,
-	       "\n%s%sCannot allocate %lu bytes after allocating %lu bytes\n",
-	       name, *name ? ": " : "",
-	       (unsigned long) size, (unsigned long) allocated);
-#else /* HAVE_SBRK */
-      fprintf (stderr,
-              "\n%s%sCannot allocate %lu bytes\n",
-              name, *name ? ": " : "",
-              (unsigned long) size);
-#endif /* HAVE_SBRK */
-      xexit (1);
-    }
   return (newmem);
 }
 
@@ -106,27 +115,8 @@
 
   newmem = calloc (nelem, elsize);
   if (!newmem)
-    {
-#ifdef HAVE_SBRK
-      extern char **environ;
-      size_t allocated;
+    xmalloc_failed (nelem * elsize);
 
-      if (first_break != NULL)
-	allocated = (char *) sbrk (0) - first_break;
-      else
-	allocated = (char *) sbrk (0) - (char *) &environ;
-      fprintf (stderr,
-	       "\n%s%sCannot allocate %lu bytes after allocating %lu bytes\n",
-	       name, *name ? ": " : "",
-	       (unsigned long) (nelem * elsize), (unsigned long) allocated);
-#else /* HAVE_SBRK */
-      fprintf (stderr,
-              "\n%s%sCannot allocate %lu bytes\n",
-              name, *name ? ": " : "",
-              (unsigned long) (nelem * elsize));
-#endif /* HAVE_SBRK */
-      xexit (1);
-    }
   return (newmem);
 }
 
@@ -144,26 +134,7 @@
   else
     newmem = realloc (oldmem, size);
   if (!newmem)
-    {
-#ifdef HAVE_SBRK
-      extern char **environ;
-      size_t allocated;
+    xmalloc_failed (size);
 
-      if (first_break != NULL)
-	allocated = (char *) sbrk (0) - first_break;
-      else
-	allocated = (char *) sbrk (0) - (char *) &environ;
-      fprintf (stderr,
-	       "\n%s%sCannot reallocate %lu bytes after allocating %lu bytes\n",
-	       name, *name ? ": " : "",
-	       (unsigned long) size, (unsigned long) allocated);
-#else /* HAVE_SBRK */
-      fprintf (stderr,
-              "\n%s%sCannot reallocate %lu bytes\n",
-              name, *name ? ": " : "",
-              (unsigned long) size);
-#endif /* HAVE_SBRK */
-      xexit (1);
-    }
   return (newmem);
 }
diff --git a/libtool.m4 b/libtool.m4
new file mode 100644
index 0000000..d732789
--- /dev/null
+++ b/libtool.m4
@@ -0,0 +1,839 @@
+## libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
+## Copyright (C) 1996-1999,2000 Free Software Foundation, Inc.
+## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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 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.
+##
+## As a special exception to the GNU General Public License, if you
+## distribute this file as part of a program that contains a
+## configuration script generated by Autoconf, you may include it under
+## the same distribution terms that you use for the rest of that program.
+
+# serial 45 AC_PROG_LIBTOOL
+AC_DEFUN(AC_PROG_LIBTOOL,[AC_REQUIRE([_AC_PROG_LIBTOOL])
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+  AC_PROVIDE_IFELSE([AC_PROG_CXX],
+    [AC_LIBTOOL_CXX],
+    [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+  AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+    [AC_LIBTOOL_GCJ],
+    [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+        [AC_LIBTOOL_GCJ],
+	[AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+	  [AC_LIBTOOL_GCJ],
+	[ifdef([AC_PROG_GCJ],
+	       [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ
+])])
+	 ifdef([A][M_PROG_GCJ],
+	       [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ
+])])
+	 ifdef([LT_AC_PROG_GCJ],
+	       [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ
+])])])])])])
+
+AC_DEFUN(_AC_PROG_LIBTOOL,
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# Save cache, so that ltconfig can load it
+AC_CACHE_SAVE
+
+# Actually configure libtool.  ac_aux_dir is where install-sh is found.
+AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
+$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
+|| AC_MSG_ERROR([libtool configure failed])
+
+# Reload cache, that may have been modified by ltconfig
+AC_CACHE_LOAD
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+AC_DEFUN(AC_LIBTOOL_SETUP,
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+# Only perform the check for file, if the check method requires it
+case "$deplibs_check_method" in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    AC_PATH_MAGIC
+  fi
+  ;;
+esac
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+# Check for any special flags to pass to ltconfig.
+libtool_flags="--cache-file=$cache_file"
+test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
+test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
+test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
+test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
+[libtool_flags="$libtool_flags --enable-dlopen"])
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[libtool_flags="$libtool_flags --enable-win32-dll"])
+AC_ARG_ENABLE(libtool-lock,
+  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
+test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
+
+AC_ARG_WITH(pic,
+  [  --with-pic              try to use only PIC/non-PIC objects [default=use both]],
+     pic_mode="$withval", pic_mode=default)
+test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
+test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case "$host" in
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case "`/usr/bin/file conftest.o`" in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_SAVE
+     AC_LANG_C
+     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_RESTORE])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+
+  # recent cygwin and mingw systems supply a stub DllMain which the user
+  # can override, but on older systems we have to supply one
+  AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
+    [AC_TRY_LINK([],
+      [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
+      DllMain (0, 0, 0);],
+      [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
+
+  case "$host/$CC" in
+  *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
+    # old mingw systems require "-dll" to link a DLL, while more recent ones
+    # require "-mdll"
+    SAVE_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -mdll"
+    AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
+      [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
+    CFLAGS="$SAVE_CFLAGS" ;;
+  *-*-cygwin* | *-*-pw32*)
+    # cygwin systems need to pass --dll to the linker, and not link
+    # crt.o which will require a WinMain@16 definition.
+    lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
+  esac
+  ;;
+  ])
+esac
+])
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
+
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_ENABLE_SHARED[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN(AC_ENABLE_SHARED, [dnl
+define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+  enable_shared=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_shared=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)])
+
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_ENABLE_STATIC[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN(AC_ENABLE_STATIC, [dnl
+define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+  enable_static=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_static=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
+
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
+#   `yes'.
+AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
+define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+  enable_fast_install=no
+  # Look at the argument we got.  We use all the common list separators.
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+  for pkg in $enableval; do
+    if test "X$pkg" = "X$p"; then
+      enable_fast_install=yes
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_LIBTOOL_PICMODE - implement the --with-pic flag
+# Usage: AC_LIBTOOL_PICMODE[(MODE)]
+#   Where MODE is either `yes' or `no'.  If omitted, it defaults to
+#   `both'.
+AC_DEFUN(AC_LIBTOOL_PICMODE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)])
+
+
+# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
+AC_DEFUN(AC_PATH_TOOL_PREFIX,
+[AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case "$MAGIC_CMD" in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="ifelse([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case "$deplibs_check_method" in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+])
+
+
+# AC_PATH_MAGIC - find a file program which can recognise a shared library
+AC_DEFUN(AC_PATH_MAGIC,
+[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
+AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])
+
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN(AC_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
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$ac_cv_prog_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.
+changequote(,)dnl
+    [\\/]* | [A-Za-z]:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+changequote([,])dnl
+      # 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(ac_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
+      ac_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 "$ac_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
+  ac_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$ac_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_PROG_LD_GNU
+])
+
+AC_DEFUN(AC_PROG_LD_GNU,
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_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
+  ac_cv_prog_gnu_ld=yes
+else
+  ac_cv_prog_gnu_ld=no
+fi])
+with_gnu_ld=$ac_cv_prog_gnu_ld
+])
+
+# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN(AC_PROG_LD_RELOAD_FLAG,
+[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
+[lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+])
+
+# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN(AC_DEPLIBS_CHECK_METHOD,
+[AC_CACHE_CHECK([how to recognise dependant libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case "$host_os" in
+aix4*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi4*)
+  changequote(,)dnl
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  changequote([, ])dnl
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin* | mingw* |pw32*)
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+freebsd* )
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case "$host_cpu" in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      changequote(,)dnl
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+      changequote([, ])dnl
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20*)
+  # TODO:  Does this work for hpux-11 too?
+  lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libc.sl
+  ;;
+
+irix5* | irix6*)
+  case "$host_os" in
+  irix5*)
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+    ;;
+  *)
+    case "$LD" in
+    *-32|*"-32 ") libmagic=32-bit;;
+    *-n32|*"-n32 ") libmagic=N32;;
+    *-64|*"-64 ") libmagic=64-bit;;
+    *) libmagic=never-match;;
+    esac
+    # this will be overridden with pass_all, but let us keep it just in case
+    changequote(,)dnl
+    lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
+    changequote([, ])dnl
+    ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  case "$host_cpu" in
+  alpha* | i*86 | powerpc* | sparc* | ia64* )
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+    changequote(,)dnl
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
+    changequote([, ])dnl
+  esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then :
+  else
+    changequote(,)dnl
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+    changequote([, ])dnl
+    lt_cv_file_magic_cmd='/usr/bin/file -L'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  # this will be overridden with pass_all, but let us keep it just in case
+  lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  lt_cv_file_magic_test_file=/lib/libc.so
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case "$host_vendor" in
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  motorola)
+    changequote(,)dnl
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    changequote([, ])dnl
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  esac
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+])
+
+
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN(AC_PROG_NM,
+[AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(ac_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  ac_cv_path_NM="$NM"
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+    test -z "$ac_dir" && ac_dir=.
+    tmp_nm=$ac_dir/${ac_tool_prefix}nm
+    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+      # Check to see if the nm accepts a BSD-compat flag.
+      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+      #   nm: unknown option "B" ignored
+      # Tru64's nm complains that /dev/null is an invalid object file
+      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+	ac_cv_path_NM="$tmp_nm -B"
+	break
+      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+	ac_cv_path_NM="$tmp_nm -p"
+	break
+      else
+	ac_cv_path_NM=${ac_cv_path_NM="$tmp_nm"} # keep the first match, but
+	continue # so that we can try to find one that supports BSD flags
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+fi])
+NM="$ac_cv_path_NM"
+AC_MSG_RESULT([$NM])
+])
+
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN(AC_CHECK_LIBM,
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case "$host" in
+*-*-beos* | *-*-cygwin* | *-*-pw32*)
+  # These system don't have libm
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, main, LIBM="-lm")
+  ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-convenience to the
+# configure arguments.  Note that LIBLTDL and INCLTDL are not
+# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
+# provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
+# with '${top_builddir}/' and INCLTDL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!).  If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  case "$enable_ltdl_convenience" in
+  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+  "") enable_ltdl_convenience=yes
+      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+  esac
+  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+  INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-install to the configure
+# arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
+# AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
+# libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
+# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
+# with '${top_srcdir}/' (note the single quotes!).  If your package is
+# not flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  AC_CHECK_LIB(ltdl, main,
+  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+  [if test x"$enable_ltdl_install" = xno; then
+     AC_MSG_WARN([libltdl not installed, but installation disabled])
+   else
+     enable_ltdl_install=yes
+   fi
+  ])
+  if test x"$enable_ltdl_install" = x"yes"; then
+    ac_configure_args="$ac_configure_args --enable-ltdl-install"
+    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+    INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  else
+    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+    LIBLTDL="-lltdl"
+    INCLTDL=
+  fi
+])
+
+# If this macro is not defined by Autoconf, define it here.
+ifdef([AC_PROVIDE_IFELSE],
+      [],
+      [define([AC_PROVIDE_IFELSE],
+              [ifdef([AC_PROVIDE_$1],
+                     [$2], [$3])])])
+
+# AC_LIBTOOL_CXX - enable support for C++ libraries
+AC_DEFUN(AC_LIBTOOL_CXX,[AC_REQUIRE([_AC_LIBTOOL_CXX])])
+AC_DEFUN(_AC_LIBTOOL_CXX,
+[AC_REQUIRE([AC_PROG_LIBTOOL])
+AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([AC_PROG_CXXCPP])
+LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh"
+lt_save_CC="$CC"
+lt_save_CFLAGS="$CFLAGS"
+dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
+dnl is set to the C++ compiler.
+AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" \
+file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
+--build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \
+|| AC_MSG_ERROR([libtool tag configuration failed])
+CC="$lt_save_CC"
+CFLAGS="$lt_save_CFLAGS"
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+# AC_LIBTOOL_GCJ - enable support for GCJ libraries
+AC_DEFUN(AC_LIBTOOL_GCJ,[AC_REQUIRE([_AC_LIBTOOL_GCJ])])
+AC_DEFUN(_AC_LIBTOOL_GCJ,
+[AC_REQUIRE([AC_PROG_LIBTOOL])
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+    [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+      [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+         [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+           [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh"
+lt_save_CC="$CC"
+lt_save_CFLAGS="$CFLAGS"
+dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
+dnl is set to the C++ compiler.
+AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="" \
+MAGIC_CMD="$MAGIC_CMD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" \
+file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
+--build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \
+|| AC_MSG_ERROR([libtool tag configuration failed])
+CC="$lt_save_CC"
+CFLAGS="$lt_save_CFLAGS"
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+])
+
+dnl old names
+AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
+AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
+AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
+AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
+AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
+
+dnl This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])dnl
+
+AC_DEFUN([LT_AC_PROG_GCJ],[
+  AC_CHECK_TOOL(GCJ, gcj, no)
+  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+  AC_SUBST(GCJFLAGS)
+])
diff --git a/ltcf-c.sh b/ltcf-c.sh
new file mode 100644
index 0000000..e57abb1
--- /dev/null
+++ b/ltcf-c.sh
@@ -0,0 +1,689 @@
+#### This script is meant to be sourced by ltconfig.
+
+# ltcf-c.sh - Create a C compiler specific configuration
+#
+# Copyright (C) 1996-2000 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# 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
+# 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='main(){return(0);}'
+
+## Linker Characteristics
+case "$host_os" in
+cygwin* | mingw*)
+  # FIXME: the MSVC++ port hasn't been tested in a loooong time
+  # When not using gcc, we currently assume that we are using
+  # Microsoft Visual C++.
+  if test "$with_gcc" != yes; then
+    with_gnu_ld=no
+  fi
+  ;;
+
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # If archive_cmds runs LD, not CC, wlarc should be empty
+  wlarc='${wl}'
+
+  # See if GNU ld supports shared libraries.
+  case "$host_os" in
+  aix3* | aix4*)
+    # On AIX, the GNU linker is very broken
+    ld_shlibs=no
+    cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+
+    # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+    # that the semantics of dynamic libraries on AmigaOS, at least up
+    # to version 4, is to share data among multiple programs linked
+    # with the same dynamic library.  Since this doesn't match the
+    # behavior of shared libraries on other platforms, we can use
+    # them.
+    ld_shlibs=no
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  cygwin* | mingw*)
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec='-L$libdir'
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+
+    extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
+      sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~
+      test -f $output_objdir/impgen.exe || (cd $output_objdir && \
+      if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
+      else $CC -o impgen impgen.c ; fi)~
+      $output_objdir/impgen $dir/$soname > $output_objdir/$soname-def'
+
+    old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
+
+    # cygwin and mingw dlls have different entry points and sets of symbols
+    # to exclude.
+    # FIXME: what about values for MSVC?
+    dll_entry=__cygwin_dll_entry@12
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
+    case "$host_os" in
+    mingw*)
+      # mingw values
+      dll_entry=_DllMainCRTStartup@12
+      dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
+      ;;
+    esac
+
+    # mingw and cygwin differ, and it's simplest to just exclude the union
+    # of the two symbol sets.
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
+
+    # recent cygwin and mingw systems supply a stub DllMain which the user
+    # can override, but on older systems we have to supply one (in ltdll.c)
+    if test "x$lt_cv_need_dllmain" = "xyes"; then
+      ltdll_obj='$output_objdir/$soname-ltdll.'"$objext "
+      ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/$soname-ltdll.c~
+	test -f $output_objdir/$soname-ltdll.$objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
+    else
+      ltdll_obj=
+      ltdll_cmds=
+    fi
+
+    # Extract the symbol export list from an `--export-all' def file,
+    # then regenerate the def file from the symbol export list, so that
+    # the compiled dll only exports the symbol export list.
+    # Be careful not to strip the DATA tag left be newer dlltools.
+    export_symbols_cmds="$ltdll_cmds"'
+      $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
+      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
+
+    # If DATA tags from a recent dlltool are present, honour them!
+    archive_expsym_cmds='echo EXPORTS > $output_objdir/$soname-def~
+      _lt_hint=1;
+      cat $export_symbols | while read symbol; do
+	set dummy \$symbol;
+	case \$# in
+	  2) echo "	\$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+	  *) echo "     \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;;
+	esac;
+	_lt_hint=`expr 1 + \$_lt_hint`;
+      done~
+      '"$ltdll_cmds"'
+      $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+      $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+      $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags'
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+      wlarc=
+    else
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    fi
+    ;;
+
+  solaris* | sysv5*)
+    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+      ld_shlibs=no
+      cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+    elif $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'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  sunos4*)
+    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    wlarc=
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    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'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+  esac
+
+  if test "$ld_shlibs" = yes; then
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    case $host_os in
+    cygwin* | mingw*)
+      # dlltool doesn't understand --whole-archive et. al.
+      whole_archive_flag_spec=
+      ;;
+    *)
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+	whole_archive_flag_spec=
+      fi
+      ;;
+    esac
+  fi
+else
+  # PORTME fill in a description of your system's linker (not GNU ld)
+  case "$host_os" in
+  aix3*)
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+    archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+    # Note: this linker hardcodes the directories in LIBPATH if there
+    # are no directories specified by -L.
+    hardcode_minus_L=yes
+    if test "$with_gcc" = yes && test -z "$link_static_flag"; then
+      # Neither direct hardcoding nor static linking is supported with a
+      # broken collect2.
+      hardcode_direct=unsupported
+    fi
+    ;;
+
+  aix4*)
+    hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib'
+    hardcode_libdir_separator=':'
+    if test "$with_gcc" = yes; then
+      collect2name=`${CC} -print-prog-name=collect2`
+      if test -f "$collect2name" && \
+	 strings "$collect2name" | grep resolve_lib_name >/dev/null
+      then
+	# We have reworked collect2
+	hardcode_direct=yes
+      else
+	# We have old collect2
+	hardcode_direct=unsupported
+	# It fails to find uninstalled libraries when the uninstalled
+	# path is not listed in the libpath.  Setting hardcode_minus_L
+	# to unsupported forces relinking
+	hardcode_minus_L=yes
+	hardcode_libdir_flag_spec='-L$libdir'
+	hardcode_libdir_separator=
+      fi
+      shared_flag='-shared'
+    else
+      shared_flag='${wl}-bM:SRE'
+      hardcode_direct=yes
+    fi
+    allow_undefined_flag=' ${wl}-berok'
+    archive_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
+    archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}'
+    case "$host_os" in aix4.[01]|aix4.[01].*)
+      # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
+      always_export_symbols=yes ;;
+    esac
+   ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    # see comment about different semantics on the GNU ld section
+    ld_shlibs=no
+    ;;
+
+  cygwin* | mingw*)
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec=' '
+    allow_undefined_flag=unsupported
+    # Tell ltmain to make .lib files, not .a files.
+    libext=lib
+    # FIXME: Setting linknames here is a bad hack.
+    archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+    # The linker will automatically build a .lib file if we build a DLL.
+    old_archive_from_new_cmds='true'
+    # FIXME: Should let the user specify the lib program.
+    old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+    fix_srcfile_path='`cygpath -w $srcfile`'
+    ;;
+
+  freebsd1*)
+    ld_shlibs=no
+    ;;
+
+  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+  # support.  Future versions do this automatically, but an explicit c++rt0.o
+  # does not break anything, and helps significantly (at the cost of a little
+  # extra space).
+  freebsd2.2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+  freebsd2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+  freebsd*)
+    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  hpux9* | hpux10* | hpux11*)
+    case "$host_os" in
+    hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
+    esac
+    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_direct=yes
+    hardcode_minus_L=yes # Not in the search PATH, but as the default
+			 # location of the library.
+    export_dynamic_flag_spec='${wl}-E'
+    ;;
+
+  irix5* | irix6*)
+    if test "$with_gcc" = yes; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+    else
+      archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    link_all_deplibs=yes
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+    else
+      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+    fi
+    hardcode_libdir_flag_spec='${wl}-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  openbsd*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  os2*)
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    allow_undefined_flag=unsupported
+    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+    old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+    ;;
+
+  osf3*)
+    if test "$with_gcc" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+
+  osf4* | osf5*)	# as osf3* with the addition of -msym flag
+    if test "$with_gcc" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+
+  sco3.2v5*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    runpath_var=LD_RUN_PATH
+    hardcode_runpath_var=yes
+    ;;
+
+  solaris*)
+    no_undefined_flag=' -z text'
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_shlibpath_var=no
+    case "$host_os" in
+    solaris2.[0-5] | solaris2.[0-5].*) ;;
+    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+    esac
+    link_all_deplibs=yes
+    ;;
+
+  sunos4*)
+    archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+    ;;
+
+  sysv4.3*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    export_dynamic_flag_spec='-Bexport'
+    ;;
+
+  sysv5*)
+    no_undefined_flag=' -z text'
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec=
+    hardcode_shlibpath_var=no
+    runpath_var='LD_RUN_PATH'
+    ;;
+
+  uts4*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  dgux*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4*MP*)
+    if test -d /usr/nec; then
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ld_shlibs=yes
+    fi
+    ;;
+
+  sysv4.2uw2*)
+    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=no
+    hardcode_shlibpath_var=no
+    hardcode_runpath_var=yes
+    runpath_var=LD_RUN_PATH
+    ;;
+
+  unixware7*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    ld_shlibs=no
+    ;;
+  esac
+fi
+
+## Compiler Characteristics: PIC flags, static flags, etc
+if test "X${ac_cv_prog_cc_pic+set}" = Xset; then
+  :
+else
+  ac_cv_prog_cc_pic=
+  ac_cv_prog_cc_shlib=
+  ac_cv_prog_cc_wl=
+  ac_cv_prog_cc_static=
+  ac_cv_prog_cc_no_builtin=
+  ac_cv_prog_cc_can_build_shared=$can_build_shared
+
+  if test "$with_gcc" = yes; then
+    ac_cv_prog_cc_wl='-Wl,'
+    ac_cv_prog_cc_static='-static'
+
+    case "$host_os" in
+    beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    aix*)
+      # Below there is a dirty hack to force normal static linking with -ldl
+      # The problem is because libdl dynamically linked with both libc and
+      # libC (AIX C++ library), which obviously doesn't included in libraries
+      # list by gcc. This cause undefined symbols with -static flags.
+      # This hack allows C programs to be linked with "-static -ldl", but
+      # we not sure about C++ programs.
+      ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
+      ;;
+    cygwin* | mingw* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      ac_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	 ac_cv_prog_cc_pic=-Kconform_pic
+      fi
+      ;;
+    *)
+      ac_cv_prog_cc_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for PIC flags for the system compiler.
+    case "$host_os" in
+    aix3* | aix4*)
+     # All AIX code is PIC.
+      ac_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      # Is there a better ac_cv_prog_cc_static that works with the bundled CC?
+      ac_cv_prog_cc_wl='-Wl,'
+      ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+      ac_cv_prog_cc_pic='+Z'
+      ;;
+
+    irix5* | irix6*)
+      ac_cv_prog_cc_wl='-Wl,'
+      ac_cv_prog_cc_static='-non_shared'
+      # PIC (with -KPIC) is the default.
+      ;;
+
+    cygwin* | mingw* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      ac_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      # All OSF/1 code is PIC.
+      ac_cv_prog_cc_wl='-Wl,'
+      ac_cv_prog_cc_static='-non_shared'
+      ;;
+
+    sco3.2v5*)
+      ac_cv_prog_cc_pic='-Kpic'
+      ac_cv_prog_cc_static='-dn'
+      ac_cv_prog_cc_shlib='-belf'
+      ;;
+
+    solaris*)
+      ac_cv_prog_cc_pic='-KPIC'
+      ac_cv_prog_cc_static='-Bstatic'
+      ac_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    sunos4*)
+      ac_cv_prog_cc_pic='-PIC'
+      ac_cv_prog_cc_static='-Bstatic'
+      ac_cv_prog_cc_wl='-Qoption ld '
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      ac_cv_prog_cc_pic='-KPIC'
+      ac_cv_prog_cc_static='-Bstatic'
+      ac_cv_prog_cc_wl='-Wl,'
+      ;;
+
+    uts4*)
+      ac_cv_prog_cc_pic='-pic'
+      ac_cv_prog_cc_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	ac_cv_prog_cc_pic='-Kconform_pic'
+	ac_cv_prog_cc_static='-Bstatic'
+      fi
+      ;;
+
+    *)
+      ac_cv_prog_cc_can_build_shared=no
+      ;;
+    esac
+  fi
+  ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
+fi
+
+need_lc=yes
+if test "$enable_shared" = yes && test "$with_gcc" = yes; then
+  case "$archive_cmds" in
+  *'~'*)
+    # FIXME: we may have to deal with multi-command sequences.
+    ;;
+  '$CC '*)
+    # Test whether the compiler implicitly links with -lc since on some
+    # systems, -lgcc has to come before -lc. If gcc already passes -lc
+    # to ld, don't add -lc before -lgcc.
+    echo $ac_n "checking whether -lc should be explicitly linked in... $ac_c" 1>&6
+    if eval "test \"`echo '$''{'ac_cv_archive_cmds_needs_lc'+set}'`\" = set"; then
+      echo $ac_n "(cached) $ac_c" 1>&6
+      need_lc=$ac_cv_archive_cmds_needs_lc
+    else
+      $rm conftest*
+      echo "static int dummy;" > conftest.$ac_ext
+      if { (eval echo ltcf-c.sh:need_lc: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
+	# Append any warnings to the config.log.
+	cat conftest.err 1>&5
+	soname=conftest
+	lib=conftest
+	libobjs=conftest.o
+	deplibs=
+	wl=$ac_cv_prog_cc_wl
+	compiler_flags=-v
+	linker_flags=-v
+	verstring=
+	output_objdir=.
+	libname=conftest
+	save_allow_undefined_flag=$allow_undefined_flag
+	allow_undefined_flag=
+	if { (eval echo ltcf-c.sh:need_lc: \"$archive_cmds\") 1>&5; (eval $archive_cmds) 2>&1 | grep " -lc " 1>&5 ; }; then
+	  need_lc=no
+	fi
+	allow_undefined_flag=$save_allow_undefined_flag
+      else
+	cat conftest.err 1>&5
+      fi
+    fi
+    $rm conftest*
+    echo "$ac_t$need_lc" 1>&6
+    ;;
+  esac
+fi
+ac_cv_archive_cmds_needs_lc=$need_lc
diff --git a/ltcf-cxx.sh b/ltcf-cxx.sh
new file mode 100644
index 0000000..cefa008
--- /dev/null
+++ b/ltcf-cxx.sh
@@ -0,0 +1,887 @@
+#### This script is meant to be sourced by ltconfig.
+
+# ltcf-cxx.sh - Create a C++ compiler specific configuration
+#
+# Copyright (C) 1996-1999,2000 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# Original C++ support by:Gary V. Vaughan <gvv@techie.com>
+#    Alexandre Oliva <oliva@lsd.ic.unicamp.br>
+#    Ossama Othman <ossama@debian.org>
+#    Thomas Thanner <tanner@gmx.de>
+#
+# 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
+# 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Source file extension for C++ test sources.
+ac_ext=cc
+
+# Object file extension for compiled C++ test sources.
+objext=o
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[]) { return (0); }'
+
+# C++ compiler
+CXX=${CXX-c++}
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+CC=${CC-"$CXX"}
+CFLAGS=${CFLAGS-"$CXXFLAGS"}
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler=$2
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+
+# Check if we are using GNU gcc  (taken/adapted from configure script)
+# We need to check here since "--with-gcc" is set at configure time,
+# not ltconfig time!
+cat > conftest.$ac_ext <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if { ac_try='${CC-c++} -E conftest.$ac_ext'; { (eval echo \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  with_gcc=yes
+
+  # Set up default GNU C++ configuration
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if eval "`$CC -print-prog-name=ld` --version 2>&1" | \
+      egrep 'GNU ld' > /dev/null; then
+    with_gnu_ld=yes
+
+    archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    archive_expsym_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+        egrep 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
+
+else
+  with_gcc=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# In general, the C++ compiler should always link C++ objects.
+case $target in
+*aix3* | *aix4*)
+  # AIX just has to be different, doesn't it? :-\
+  LD=makeC++SharedLib_r
+  LDFLAGS="$LDFLAGS -p 0"
+  ;;
+*)
+  LD="$CC"
+  LDFLAGS="$LDFLAGS"
+  ;;
+esac
+
+
+# PORTME: fill in a description of your system's C++ link characteristics
+case "$host_os" in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs=no
+    ;;
+  aix4*)
+    archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+    # -bexpall does not export symbols beginning with underscore (_)
+    always_export_symbols=yes
+    # Exported symbols can be pulled into shared objects from archives
+    whole_archive_flag_spec=' '
+    build_libtool_need_lc=yes
+    ;;
+  chorus*)
+    case "$cc_basename" in
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+    esac 
+    ;;
+  dgux*)
+    case "$cc_basename" in
+      ec++)
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+      ghcx)
+        # Green Hills C++ Compiler
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+    esac
+    ;;
+  freebsd*)
+    # FreeBSD uses GNU C++ and GNU ld
+    # FIXME: insert proper C++ library support
+    ld_shlibs=no
+    ;;
+  hpux*)
+    case "$cc_basename" in
+      CC)
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+      aCC)
+	case "$host_os" in
+	hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+	*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;;
+	esac
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator=:
+	hardcode_direct=yes
+	hardcode_minus_L=yes # Not in the search PATH, but as the default
+			     # location of the library.
+	export_dynamic_flag_spec='${wl}-E'
+
+        # Commands to make compiler produce verbose output that lists
+        # what "hidden" libraries, object files and flags are used when
+        # linking a shared library.
+        #
+        # There doesn't appear to be a way to prevent this compiler from
+        # explicitly linking system object files so we need to strip them
+        # from the output so that they don't get included in the library
+        # dependencies.
+        output_verbose_link_cmds='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+        ;;
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+    esac
+    ;;
+  irix5* | irix6*)
+    case "$cc_basename" in
+      CC)
+        # SGI C++
+        archive_cmds='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+
+	# Archives containing C++ object files must be created using
+	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	# necessary to make sure instantiated templates are included
+	# in the archive.
+	old_archive_cmds='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	;;
+      *)
+        if test "$with_gcc" = yes; then
+          if test "$with_gnu_ld" = no; then
+            archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+          else
+            archive_cmds='$LD -shared $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
+          fi
+        fi
+        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+        hardcode_libdir_separator=:
+        link_all_deplibs=yes
+        ;;
+    esac
+    ;;
+  linux*)
+    case "$cc_basename" in
+      KCC)
+        # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+        # KCC will only create a shared library if the output file
+        # ends with ".so" (or ".sl" for HP-UX), so rename the library
+        # to its proper name (with version) after linking.
+        archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+        archive_expsym_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+
+        # Commands to make compiler produce verbose output that lists
+        # what "hidden" libraries, object files and flags are used when
+        # linking a shared library.
+        #
+        # There doesn't appear to be a way to prevent this compiler from
+        # explicitly linking system object files so we need to strip them
+        # from the output so that they don't get included in the library
+        # dependencies.
+        output_verbose_link_cmds='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest.so 2>&1 | egrep "ld"`; rm -f libconftest.so; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+        hardcode_libdir_flag_spec='${wl}--rpath,$libdir'
+        export_dynamic_flag_spec='${wl}--export-dynamic'
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+        old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
+        ;;
+      cxx)
+        # Compaq C++
+        archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        archive_expsym_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+        runpath_var=LD_RUN_PATH
+        hardcode_libdir_flag_spec='-rpath $libdir'
+        hardcode_libdir_separator=:
+
+        # Commands to make compiler produce verbose output that lists
+        # what "hidden" libraries, object files and flags are used when
+        # linking a shared library.
+        #
+        # There doesn't appear to be a way to prevent this compiler from
+        # explicitly linking system object files so we need to strip them
+        # from the output so that they don't get included in the library
+        # dependencies.
+        output_verbose_link_cmds='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+        ;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs=no
+    ;;
+  mvs*)
+    case "$cc_basename" in
+      cxx)
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+    esac   
+    ;;
+  netbsd*)
+    # NetBSD uses g++ - do we need to do anything?
+    ;;
+  osf3*)
+    if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
+    fi
+
+    case "$cc_basename" in
+      KCC)
+        # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+        # KCC will only create a shared library if the output file
+        # ends with ".so" (or ".sl" for HP-UX), so rename the library
+        # to its proper name (with version) after linking.
+        archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+        hardcode_libdir_separator=:
+
+	# Archives containing C++ object files must be created using
+	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
+        old_archive_cmds='$CC -Bstatic -o $oldlib $oldobjs'
+
+        ;;
+      RCC)
+        # Rational C++ 2.4.1
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+      cxx)
+        allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+        archive_cmds='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+
+        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+        hardcode_libdir_separator=:
+
+        # Commands to make compiler produce verbose output that lists
+        # what "hidden" libraries, object files and flags are used when
+        # linking a shared library.
+        #
+        # There doesn't appear to be a way to prevent this compiler from
+        # explicitly linking system object files so we need to strip them
+        # from the output so that they don't get included in the library
+        # dependencies.
+        output_verbose_link_cmds='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+        ;;
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+    esac
+    ;;
+  osf4* | osf5*)
+    if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmds='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
+    fi
+
+    case "$cc_basename" in
+      KCC)
+        # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+        # KCC will only create a shared library if the output file
+        # ends with ".so" (or ".sl" for HP-UX), so rename the library
+        # to its proper name (with version) after linking.
+        archive_cmds='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+        hardcode_libdir_separator=:
+
+	# Archives containing C++ object files must be created using
+	# the KAI C++ compiler.
+        old_archive_cmds='$CC -o $oldlib $oldobjs'
+        ;;
+      RCC)
+        # Rational C++ 2.4.1
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+      cxx)
+        allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+        archive_cmds='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+        
+        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+        hardcode_libdir_separator=:
+
+        # Commands to make compiler produce verbose output that lists
+        # what "hidden" libraries, object files and flags are used when
+        # linking a shared library.
+        #
+        # There doesn't appear to be a way to prevent this compiler from
+        # explicitly linking system object files so we need to strip them
+        # from the output so that they don't get included in the library
+        # dependencies.
+        output_verbose_link_cmds='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+        ;;
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs=no
+    ;;
+  sco*)
+    case "$cc_basename" in
+      CC)
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+    esac
+    ;;
+  sunos4*)
+    case "$cc_basename" in
+      CC)
+        # Sun C++ 4.x
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+      lcc)
+        # Lucid
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+    esac
+    ;;
+  solaris*)
+    case "$cc_basename" in
+      CC)
+	# Sun C++ 4.2, 5.x and Centerline C++
+        no_undefined_flag=' -ztext'
+        archive_cmds='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+        archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+        $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+        hardcode_libdir_flag_spec='-R$libdir'
+        hardcode_shlibpath_var=no
+        case "$host_os" in
+          solaris2.[0-5] | solaris2.[0-5].*) ;;
+          *)
+            # The C++ compiler is used as linker so we must use $wl
+            # flag to pass the commands to the underlying system
+            # linker.
+            # Supported since Solaris 2.6 (maybe 2.5.1?)
+            whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+            ;;
+        esac
+        link_all_deplibs=yes
+
+        # Commands to make compiler produce verbose output that lists
+        # what "hidden" libraries, object files and flags are used when
+        # linking a shared library.
+        #
+        # There doesn't appear to be a way to prevent this compiler from
+        # explicitly linking system object files so we need to strip them
+        # from the output so that they don't get included in the library
+        # dependencies.
+        output_verbose_link_cmds='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep "\-R|\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+	# Archives containing C++ object files must be created using
+	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
+        # necessary to make sure instantiated templates are included
+        # in the archive.
+        old_archive_cmds='$CC -xar -o $oldlib $oldobjs'
+        ;;
+      gcx)
+        # Green Hills C++ Compiler
+        archive_cmds='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+        # The C++ compiler must be used to create the archive.
+        old_archive_cmds='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+        ;;
+      *)
+        # GNU C++ compiler with Solaris linker
+        if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
+          if $CC --version | egrep -v '^2\.7' > /dev/null; then
+            archive_cmds='$LD -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
+            archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
+
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            output_verbose_link_cmds="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
+          else
+            # g++ 2.7 appears to require `-G' NOT `-shared' on this
+            # platform.
+            archive_cmds='$LD -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
+            archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
+
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            output_verbose_link_cmds="$CC -G $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
+          fi
+
+          hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
+        fi
+        ;;
+    esac   
+    ;;
+  tandem*)
+    case "$cc_basename" in
+      NCC)
+        # NonStop-UX NCC 3.20
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs=no
+        ;;
+    esac   
+    ;;
+  unixware*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs=no
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    ld_shlibs=no
+    ;;
+esac
+
+
+## Compiler Characteristics: PIC flags, static flags, etc
+
+# We don't use cached values here since only the C compiler
+# characteristics should be cached.
+ac_cv_prog_cc_pic=
+ac_cv_prog_cc_shlib=
+ac_cv_prog_cc_wl=
+ac_cv_prog_cc_static=
+ac_cv_prog_cc_no_builtin=
+ac_cv_prog_cc_can_build_shared=$can_build_shared
+
+# It is not enough to reset these cached values, they must be unset.
+unset ac_cv_prog_cc_pic_works
+unset ac_cv_prog_cc_static_works
+
+if test "$with_gcc" = yes; then
+  ac_cv_prog_cc_wl='-Wl,'
+  ac_cv_prog_cc_static='-static'
+
+  case "$host_os" in
+  beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
+    # PIC is the default for these OSes.
+    ;;
+  aix*)
+    # Below there is a dirty hack to force normal static linking with -ldl
+    # The problem is because libdl dynamically linked with both libc and
+    # libC (AIX C++ library), which obviously doesn't included in libraries
+    # list by gcc. This cause undefined symbols with -static flags.
+    # This hack allows C programs to be linked with "-static -ldl", but
+    # we not sure about C++ programs.
+    ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
+    ;;
+  cygwin* | mingw* | os2*)
+    # This hack is so that the source file can tell whether it is being
+    # built for inclusion in a dll (and should export symbols for example).
+    ac_cv_prog_cc_pic='-DDLL_EXPORT'
+    ;;
+  amigaos*)
+    # FIXME: we need at least 68020 code to build shared libraries, but
+    # adding the `-m68020' flag to GCC prevents building anything better,
+    # like `-m68040'.
+    ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
+    ;;
+  sysv4*MP*)
+    if test -d /usr/nec; then
+      ac_cv_prog_cc_pic=-Kconform_pic
+    fi
+    ;;
+  *)
+    ac_cv_prog_cc_pic='-fPIC'
+    ;;
+  esac
+else
+  case "$host_os" in
+    aix4*)
+      # All AIX code is PIC.
+      ;;
+    chorus*)
+      case "$cc_basename" in
+      cxch68)
+        # Green Hills C++ Compiler
+        # ac_cv_prog_cc_static="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+        ;;
+      esac 
+      ;;
+    dgux*)
+      case "$cc_basename" in
+        ec++)
+          ac_cv_prog_cc_pic='-KPIC'
+          ;;
+        ghcx)
+          # Green Hills C++ Compiler
+          ac_cv_prog_cc_pic='-pic'
+          ;;
+        *)
+          ;;
+      esac
+      ;;
+    freebsd*)
+      # FreeBSD uses GNU C++
+      ;;
+    hpux9* | hpux10* | hpux11*)
+      case "$cc_basename" in
+        CC)
+          ac_cv_prog_cc_wl='-Wl,'
+          ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+          ac_cv_prog_cc_pic='+Z'
+          ;;
+        aCC)
+          ac_cv_prog_cc_wl='-Wl,'
+          ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
+          ac_cv_prog_cc_pic='+Z'
+          ;;
+        *)
+          ;;
+      esac
+      ;;
+    irix5* | irix6*)
+      case "$cc_basename" in
+        CC)
+          ac_cv_prog_cc_wl='-Wl,'
+          ac_cv_prog_cc_static='-non_shared'
+          ac_cv_prog_cc_pic='-KPIC'
+          ;;
+        *)
+          ;;
+      esac
+      ;;
+    linux*)
+      case "$cc_basename" in
+        KCC)
+          # KAI C++ Compiler
+          ac_cv_prog_cc_wl='--backend -Wl,'
+          ac_cv_prog_cc_pic='-fPIC'
+          ;;
+        cxx)
+          # Compaq C++
+          # Make sure the PIC flag is empty.  It appears that all Alpha
+          # Linux and Compaq Tru64 Unix objects are PIC.
+          ac_cv_prog_cc_pic=
+          ac_cv_prog_cc_static='-non_shared'
+          ;;
+        *)
+          ;;
+      esac
+      ;;
+    lynxos*)
+      ;;
+    m88k*)
+      ;;
+    mvs*)
+      case "$cc_basename" in
+        cxx)
+          ac_cv_prog_cc_pic='-W c,exportall'
+          ;;
+        *)
+          ;;
+      esac   
+      ;;
+    netbsd*)
+      ;;
+    osf3* | osf4* | osf5*)
+      case "$cc_basename" in
+        KCC)
+          ac_cv_prog_cc_wl='--backend -Wl,'
+          ;;
+        RCC)
+          # Rational C++ 2.4.1
+          ac_cv_prog_cc_pic='-pic'
+          ;;
+        cxx)
+          # Digital/Compaq C++
+          ac_cv_prog_cc_wl='-Wl,'
+          # Make sure the PIC flag is empty.  It appears that all Alpha
+          # Linux and Compaq Tru64 Unix objects are PIC.
+          ac_cv_prog_cc_pic=
+          ac_cv_prog_cc_static='-non_shared'
+          ;;
+        *)
+          ;;
+      esac
+      ;;
+    psos*)
+      ;;
+    sco*)
+      case "$cc_basename" in
+        CC)
+          ac_cv_prog_cc_pic='-fPIC'
+          ;;
+        *)
+          ;;
+      esac
+      ;;
+    solaris*)
+      case "$cc_basename" in
+        CC)
+          # Sun C++ 4.2, 5.x and Centerline C++
+          ac_cv_prog_cc_pic='-KPIC'
+          ac_cv_prog_cc_static='-Bstatic'
+          ac_cv_prog_cc_wl='-Qoption ld '
+          ;;
+        gcx)
+          # Green Hills C++ Compiler
+          ac_cv_prog_cc_pic='-PIC'
+          ;;
+        *)
+          ;;
+      esac   
+      ;;
+    sunos4*)
+      case "$cc_basename" in
+        CC)
+          # Sun C++ 4.x
+          ac_cv_prog_cc_pic='-pic'
+          ac_cv_prog_cc_static='-Bstatic'
+          ;;
+        lcc)
+          # Lucid
+          ac_cv_prog_cc_pic='-pic'
+          ;;
+        *)
+          ;;
+      esac
+      ;;
+    tandem*)
+      case "$cc_basename" in
+        NCC)
+          # NonStop-UX NCC 3.20
+          ac_cv_prog_cc_pic='-KPIC'
+          ;;
+        *)
+          ;;
+      esac   
+      ;;
+    unixware*)
+      ;;
+    vxworks*)
+      ;;
+    *)
+      ac_cv_prog_cc_can_build_shared=no
+      ;;
+  esac
+fi
+ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
+
+
+# Figure out "hidden" C++ library dependencies from verbose
+# compiler output whening linking a shared library.
+cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+EOF
+
+
+if eval $ac_compile 2>&5; then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval $output_verbose_link_cmds`; do
+
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" \
+          || test $p = "-R"; then
+         prev=$p
+         continue
+       else
+         prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+         case $p in
+	 -L* | -R*)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+           if test -z "$compiler_lib_search_path"; then
+             compiler_lib_search_path="${prev}${p}"
+           else
+             compiler_lib_search_path="${compiler_lib_search_path} ${prev}${p}"
+           fi
+           ;;
+         # The "-l" case would never come before the object being
+         # linked, so don't bother handling this case.
+         esac
+       else
+         if test -z "$postdeps"; then
+           postdeps="${prev}${p}"
+         else
+           postdeps="${postdeps} ${prev}${p}"
+         fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+         pre_test_object_deps_done=yes
+         continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+         if test -z "$predep_objects"; then
+           predep_objects="$p"
+         else
+           predep_objects="$predep_objects $p"
+         fi
+       else
+         if test -z "$postdep_objects"; then
+           postdep_objects="$p"
+         else
+           postdep_objects="$postdep_objects $p"
+         fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out
+else
+  echo "ltcf-cxx.sh: error: problem compiling test program"
+fi
+
+$rm -f confest.$objext
+
+case " $postdeps " in
+*" -lc "*) need_lc=no ;;
+*) need_lc=yes ;;
+esac
diff --git a/ltcf-gcj.sh b/ltcf-gcj.sh
new file mode 100644
index 0000000..acb30c0
--- /dev/null
+++ b/ltcf-gcj.sh
@@ -0,0 +1,571 @@
+#### This script is meant to be sourced by ltconfig.
+
+# ltcf-gcj.sh - Create a GCJ compiler specific configuration
+#
+# Copyright (C) 1996-1999,2000 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# Original GCJ support by:
+#    Alexandre Oliva <oliva@lsd.ic.unicamp.br>
+#
+# 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
+# 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {} (0); }'
+
+## Linker Characteristics
+case "$host_os" in
+cygwin* | mingw*)
+  # FIXME: the MSVC++ port hasn't been tested in a loooong time
+  # When not using gcc, we currently assume that we are using
+  # Microsoft Visual C++.
+  if test "$with_gcc" != yes; then
+    with_gnu_ld=no
+  fi
+  ;;
+
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # If archive_cmds runs LD, not CC, wlarc should be empty
+  wlarc='${wl}'
+
+  # See if GNU ld supports shared libraries.
+  case "$host_os" in
+  aix3* | aix4*)
+    # On AIX, the GNU linker is very broken
+    ld_shlibs=no
+    cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+    ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+
+    # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+    # that the semantics of dynamic libraries on AmigaOS, at least up
+    # to version 4, is to share data among multiple programs linked
+    # with the same dynamic library.  Since this doesn't match the
+    # behavior of shared libraries on other platforms, we can use
+    # them.
+    ld_shlibs=no
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  cygwin* | mingw*)
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec='-L$libdir'
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+
+    extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
+      sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~
+      test -f $output_objdir/impgen.exe || (cd $output_objdir && \
+      if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
+      else $CC -o impgen impgen.c ; fi)~
+      $output_objdir/impgen $dir/$soname > $output_objdir/$soname-def'
+
+    old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
+
+    # cygwin and mingw dlls have different entry points and sets of symbols
+    # to exclude.
+    # FIXME: what about values for MSVC?
+    dll_entry=__cygwin_dll_entry@12
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
+    case "$host_os" in
+    mingw*)
+      # mingw values
+      dll_entry=_DllMainCRTStartup@12
+      dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
+      ;;
+    esac
+
+    # mingw and cygwin differ, and it's simplest to just exclude the union
+    # of the two symbol sets.
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
+
+    # recent cygwin and mingw systems supply a stub DllMain which the user
+    # can override, but on older systems we have to supply one (in ltdll.c)
+    if test "x$lt_cv_need_dllmain" = "xyes"; then
+      ltdll_obj='$output_objdir/$soname-ltdll.'"$objext "
+      ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/$soname-ltdll.c~
+	test -f $output_objdir/$soname-ltdll.$objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
+    else
+      ltdll_obj=
+      ltdll_cmds=
+    fi
+
+    # Extract the symbol export list from an `--export-all' def file,
+    # then regenerate the def file from the symbol export list, so that
+    # the compiled dll only exports the symbol export list.
+    # Be careful not to strip the DATA tag left be newer dlltools.
+    export_symbols_cmds="$ltdll_cmds"'
+      $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
+      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
+
+    # If DATA tags from a recent dlltool are present, honour them!
+    archive_expsym_cmds='echo EXPORTS > $output_objdir/$soname-def~
+      _lt_hint=1;
+      cat $export_symbols | while read symbol; do
+	set dummy \$symbol;
+	case \$# in
+	  2) echo "	\$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+	  *) echo "     \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;;
+	esac;
+	_lt_hint=`expr 1 + \$_lt_hint`;
+      done~
+      '"$ltdll_cmds"'
+      $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_gcj_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+      $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_gcj_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+      $CC $output_objdir/$soname-exp '$lt_cv_gcj_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags'
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+      wlarc=
+    else
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    fi
+    ;;
+
+  solaris* | sysv5*)
+    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+      ld_shlibs=no
+      cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+    elif $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'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
+  sunos4*)
+    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    wlarc=
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    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'
+      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+    else
+      ld_shlibs=no
+    fi
+    ;;
+  esac
+
+  if test "$ld_shlibs" = yes; then
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    case $host_os in
+    cygwin* | mingw*)
+      # dlltool doesn't understand --whole-archive et. al.
+      whole_archive_flag_spec=
+      ;;
+    *)
+      # ancient GNU ld didn't support --whole-archive et. al.
+      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+	whole_archive_flag_spec=
+      fi
+      ;;
+    esac
+  fi
+else
+  # PORTME fill in a description of your system's linker (not GNU ld)
+  case "$host_os" in
+  aix3*)
+    allow_undefined_flag=unsupported
+    always_export_symbols=yes
+    archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+    # Note: this linker hardcodes the directories in LIBPATH if there
+    # are no directories specified by -L.
+    hardcode_minus_L=yes
+    if test "$with_gcc" = yes && test -z "$link_static_flag"; then
+      # Neither direct hardcoding nor static linking is supported with a
+      # broken collect2.
+      hardcode_direct=unsupported
+    fi
+    ;;
+
+  aix4*)
+    hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib'
+    hardcode_libdir_separator=':'
+    if test "$with_gcc" = yes; then
+      collect2name=`${CC} -print-prog-name=collect2`
+      if test -f "$collect2name" && \
+	 strings "$collect2name" | grep resolve_lib_name >/dev/null
+      then
+	# We have reworked collect2
+	hardcode_direct=yes
+      else
+	# We have old collect2
+	hardcode_direct=unsupported
+	# It fails to find uninstalled libraries when the uninstalled
+	# path is not listed in the libpath.  Setting hardcode_minus_L
+	# to unsupported forces relinking
+	hardcode_minus_L=yes
+	hardcode_libdir_flag_spec='-L$libdir'
+	hardcode_libdir_separator=
+      fi
+      shared_flag='-shared'
+    else
+      shared_flag='${wl}-bM:SRE'
+      hardcode_direct=yes
+    fi
+    allow_undefined_flag=' ${wl}-berok'
+    archive_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
+    archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}'
+    case "$host_os" in aix4.[01]|aix4.[01].*)
+      # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
+      always_export_symbols=yes ;;
+    esac
+   ;;
+
+  amigaos*)
+    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    # see comment about different semantics on the GNU ld section
+    ld_shlibs=no
+    ;;
+
+  cygwin* | mingw*)
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    # hardcode_libdir_flag_spec is actually meaningless, as there is
+    # no search path for DLLs.
+    hardcode_libdir_flag_spec=' '
+    allow_undefined_flag=unsupported
+    # Tell ltmain to make .lib files, not .a files.
+    libext=lib
+    # FIXME: Setting linknames here is a bad hack.
+    archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+    # The linker will automatically build a .lib file if we build a DLL.
+    old_archive_from_new_cmds='true'
+    # FIXME: Should let the user specify the lib program.
+    old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+    fix_srcfile_path='`cygpath -w $srcfile`'
+    ;;
+
+  freebsd1*)
+    ld_shlibs=no
+    ;;
+
+  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+  # support.  Future versions do this automatically, but an explicit c++rt0.o
+  # does not break anything, and helps significantly (at the cost of a little
+  # extra space).
+  freebsd2.2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+  freebsd2*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+  freebsd*)
+    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  hpux9* | hpux10* | hpux11*)
+    case "$host_os" in
+    hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
+    esac
+    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator=:
+    hardcode_direct=yes
+    hardcode_minus_L=yes # Not in the search PATH, but as the default
+			 # location of the library.
+    export_dynamic_flag_spec='${wl}-E'
+    ;;
+
+  irix5* | irix6*)
+    if test "$with_gcc" = yes; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+    else
+      archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    link_all_deplibs=yes
+    ;;
+
+  netbsd*)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+    else
+      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+    fi
+    hardcode_libdir_flag_spec='${wl}-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  openbsd*)
+    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_direct=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  os2*)
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_minus_L=yes
+    allow_undefined_flag=unsupported
+    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+    old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+    ;;
+
+  osf3*)
+    if test "$with_gcc" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+
+  osf4* | osf5*)	# as osf3* with the addition of -msym flag
+    if test "$with_gcc" = yes; then
+      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+    else
+      allow_undefined_flag=' -expect_unresolved \*'
+      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+    fi
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator=:
+    ;;
+
+  sco3.2v5*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    runpath_var=LD_RUN_PATH
+    hardcode_runpath_var=yes
+    ;;
+
+  solaris*)
+    no_undefined_flag=' -z text'
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec='-R$libdir'
+    hardcode_shlibpath_var=no
+    case "$host_os" in
+    solaris2.[0-5] | solaris2.[0-5].*) ;;
+    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+    esac
+    link_all_deplibs=yes
+    ;;
+
+  sunos4*)
+    archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_direct=yes
+    hardcode_minus_L=yes
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+    ;;
+
+  sysv4.3*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_shlibpath_var=no
+    export_dynamic_flag_spec='-Bexport'
+    ;;
+
+  sysv5*)
+    no_undefined_flag=' -z text'
+    # $CC -shared without GNU ld will not create a library from C++
+    # object files and a static libstdc++, better avoid it by now
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+    hardcode_libdir_flag_spec=
+    hardcode_shlibpath_var=no
+    runpath_var='LD_RUN_PATH'
+    ;;
+
+  uts4*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  dgux*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_libdir_flag_spec='-L$libdir'
+    hardcode_shlibpath_var=no
+    ;;
+
+  sysv4*MP*)
+    if test -d /usr/nec; then
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      runpath_var=LD_RUN_PATH
+      hardcode_runpath_var=yes
+      ld_shlibs=yes
+    fi
+    ;;
+
+  sysv4.2uw2*)
+    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+    hardcode_direct=yes
+    hardcode_minus_L=no
+    hardcode_shlibpath_var=no
+    hardcode_runpath_var=yes
+    runpath_var=LD_RUN_PATH
+    ;;
+
+  unixware7*)
+    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+    runpath_var='LD_RUN_PATH'
+    hardcode_shlibpath_var=no
+    ;;
+
+  *)
+    ld_shlibs=no
+    ;;
+  esac
+fi
+
+## Compiler Characteristics: PIC flags, static flags, etc
+
+# We don't use cached values here since only the C compiler
+# characteristics should be cached.
+  ac_cv_prog_cc_pic=
+  ac_cv_prog_cc_shlib=
+  ac_cv_prog_cc_wl=
+  ac_cv_prog_cc_static=
+  ac_cv_prog_cc_no_builtin=
+  ac_cv_prog_cc_can_build_shared=$can_build_shared
+
+    ac_cv_prog_cc_wl='-Wl,'
+    ac_cv_prog_cc_static='-static'
+
+    case "$host_os" in
+    beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    aix*)
+      # Below there is a dirty hack to force normal static linking with -ldl
+      # The problem is because libdl dynamically linked with both libc and
+      # libC (AIX C++ library), which obviously doesn't included in libraries
+      # list by gcc. This cause undefined symbols with -static flags.
+      # This hack allows C programs to be linked with "-static -ldl", but
+      # we not sure about C++ programs.
+      ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
+      ;;
+    cygwin* | mingw* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      ac_cv_prog_cc_pic='-DDLL_EXPORT'
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	 ac_cv_prog_cc_pic=-Kconform_pic
+      fi
+      ;;
+    *)
+      ac_cv_prog_cc_pic='-fPIC'
+      ;;
+    esac
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+need_lc=no
diff --git a/ltconfig b/ltconfig
index a01334f..fb0bf8b 100755
--- a/ltconfig
+++ b/ltconfig
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # ltconfig - Create a system-specific libtool.
-# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Copyright (C) 1996-2000 Free Software Foundation, Inc.
 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 #
 # This file is free software; you can redistribute it and/or modify it
@@ -77,8 +77,11 @@
   done
 fi
 
-if test "X`($echo '\t') 2>/dev/null`" != 'X\t' ||
-   test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
   # The Solaris, AIX, and Digital Unix default echo programs unquote
   # backslashes.  This makes it impossible to quote backslashes using
   #   echo "$something" | sed 's/\\/\\\\/g'
@@ -89,7 +92,8 @@
   for dir in $PATH /usr/ucb; do
     if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
        test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
-       test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
       echo="$dir/echo"
       break
     fi
@@ -99,7 +103,8 @@
   if test "X$echo" = Xecho; then
     # We didn't find a better echo, so look for alternatives.
     if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
-       test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
       # This shell has a builtin print -r that does the trick.
       echo='print -r'
     elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
@@ -112,20 +117,25 @@
       exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"}
     else
       # Try using printf.
-      echo='printf "%s\n"'
+      echo='printf %s\n'
       if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
-	 test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+	 test "X$echo_testing_string" = "X$echo_test_string"; then
 	# Cool, printf works
 	:
-      elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
-	   test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+      elif echo_testing_string=`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
 	CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL"
 	export CONFIG_SHELL
 	SHELL="$CONFIG_SHELL"
 	export SHELL
 	echo="$CONFIG_SHELL $0 --fallback-echo"
-      elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
-	   test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
+      elif echo_testing_string=`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null` &&
+	   test "X$echo_testing_string" = 'X\t' &&
+	   echo_testing_string=`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
 	echo="$CONFIG_SHELL $0 --fallback-echo"
       else
 	# maybe with a smaller string...
@@ -140,8 +150,9 @@
 
 	if test "$prev" != 'sed 50q "$0"'; then
 	  echo_test_string=`eval $prev`
+	  
 	  export echo_test_string
-	  exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"}
+	  exec "${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}}" "$0" ${1+"$@"}
 	else
 	  # Oops.  We lost completely, so just stick with echo.
 	  echo=echo
@@ -169,8 +180,8 @@
 # Constants:
 PROGRAM=ltconfig
 PACKAGE=libtool
-VERSION=1.3.4
-TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
+VERSION=1.4a
+TIMESTAMP=" (1.641.2.122 2000/09/30 05:27:52)"
 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'
 rm="rm -f"
@@ -187,37 +198,96 @@
 enable_fast_install=yes
 enable_dlopen=unknown
 enable_win32_dll=no
+pic_mode=default
 ltmain=
 silent=
 srcdir=
 ac_config_guess=
 ac_config_sub=
 host=
-nonopt=
+build=NONE
+nonopt=NONE
 ofile="$default_ofile"
 verify_host=yes
+tagname=
 with_gcc=no
 with_gnu_ld=no
 need_locks=yes
 ac_ext=c
-objext=o
 libext=a
-exeext=
 cache_file=
 
+## Dependencies to place before and after the object being linked:
+predep_objects=
+postdep_objects=
+predeps=
+postdeps=
+compiler_lib_search_path=
+
+## Link characteristics:
+allow_undefined_flag=
+no_undefined_flag=
+need_lib_prefix=unknown
+need_version=unknown
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+archive_cmds=
+archive_expsym_cmds=
+old_archive_from_new_cmds=
+old_archive_from_expsyms_cmds=
+striplib=
+old_striplib=
+export_dynamic_flag_spec=
+whole_archive_flag_spec=
+thread_safe_flag_spec=
+hardcode_into_libs=no
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+link_all_deplibs=unknown
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by ` (' and `)$', so one must not match beginning or
+# end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+# platforms (ab)use it in PIC code, but their linkers get confused if
+# the symbol is explicitly referenced.  Since portable code cannot
+# rely on this symbol name, it's probably fine to never include it in
+# preloaded symbol tables.
+extract_expsyms_cmds=
+
+## Tools:
 old_AR="$AR"
+old_AR_FLAGS="$AR_FLAGS"
 old_CC="$CC"
 old_CFLAGS="$CFLAGS"
 old_CPPFLAGS="$CPPFLAGS"
 old_LDFLAGS="$LDFLAGS"
+old_LIBS="$LIBS"
+old_MAGIC_CMD="$MAGIC_CMD"
 old_LD="$LD"
 old_LN_S="$LN_S"
-old_LIBS="$LIBS"
+old_LTCC="$LTCC"
 old_NM="$NM"
 old_RANLIB="$RANLIB"
+old_STRIP="$STRIP"
+old_AS="$AS"
 old_DLLTOOL="$DLLTOOL"
 old_OBJDUMP="$OBJDUMP"
-old_AS="$AS"
+old_OBJEXT="$OBJEXT"
+old_EXEEXT="$EXEEXT"
+old_reload_flag="$reload_flag"
+old_deplibs_check_method="$deplibs_check_method"
+old_file_magic_cmd="$file_magic_cmd"
 
 # Parse the command line options.
 args=
@@ -238,10 +308,11 @@
 
   case "$option" in
   --help) cat <<EOM
-Usage: $progname [OPTION]... [HOST [LTMAIN]]
+Usage: $progname [OPTION]... LTMAIN [HOST]
 
 Generate a system-specific libtool script.
 
+    --build                configure for building on BUILD [BUILD=HOST]
     --debug                enable verbose shell tracing
     --disable-shared       do not build shared libraries
     --disable-static       do not build static libraries
@@ -255,8 +326,11 @@
     --silent               do not print informational messages
     --srcdir=DIR           find \`config.guess' in DIR
     --version              output version information and exit
+    --add-tag=TAG          append an alternate configuration
     --with-gcc             assume that the GNU C compiler will be used
     --with-gnu-ld          assume that the C compiler uses the GNU linker
+    --prefer-pic           try to use only PIC objects
+    --prefer-non-pic       try to use only non-PIC objects
     --disable-lock         disable file locking
     --cache-file=FILE      configure cache file
 
@@ -268,6 +342,9 @@
   exit 0
   ;;
 
+  --build) prev=build ;;
+  --build=*) build="$optarg" ;;
+
   --debug)
     echo "$progname: enabling shell trace mode"
     set -x
@@ -295,9 +372,15 @@
 
   --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"; exit 0 ;;
 
+  --add-tag) prev=tagname ;;
+  --add-tag=*) tagname="$optarg" ;;
+
   --with-gcc) with_gcc=yes ;;
   --with-gnu-ld) with_gnu_ld=yes ;;
 
+  --prefer-pic) pic_mode=yes ;;
+  --prefer-non-pic) pic_mode=no ;;
+
   --disable-lock) need_locks=no ;;
 
   --cache-file=*) cache_file="$optarg" ;;
@@ -337,6 +420,34 @@
   exit 1
 fi
 
+if test -n "$tagname"; then
+  # Check whether tagname contains only valid characters
+  case "$tagname" in
+  *[!-_A-Za-z0-9,/]*)
+    echo "$progname: invalid tag name: $tagname" 1>&2
+    exit 1
+    ;;
+  esac
+
+  if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$ofile" > /dev/null; then
+    echo "$progname: tag name $tagname already exists" 1>&2
+    exit 1
+  fi
+
+  if test ! -f "$ofile"; then
+    echo "$progname: warning: output file \`$ofile' does not exist" 1>&2
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL $ofile --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      echo "$progname: warning: output file \`$ofile' does not look like a libtool script" 1>&2
+    else
+      echo "$progname: warning: using \`LTCC=$LTCC', extracted from \`$ofile'" 1>&2
+    fi
+  fi
+fi
+
 # Quote any args containing shell metacharacters.
 ltconfig_args=
 for arg
@@ -372,7 +483,7 @@
 if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi
 if test "X${LANG+set}"   = Xset; then LANG=C;   export LANG;   fi
 
-if test -n "$cache_file" && test -r "$cache_file"; then
+if test -n "$cache_file" && test -r "$cache_file" && test -f "$cache_file"; then
   echo "loading cache $cache_file within ltconfig"
   . $cache_file
 fi
@@ -426,12 +537,21 @@
   host_alias=$host
   case "$host_alias" in
   "")
+    # Force config.guess to use the C compiler.
+    # CC_FOR_BUILD overrides the CC variable in config.guess but I had
+    # problems with it so do it this way for now.
+    CC="$LTCC"
+
     if host_alias=`$SHELL $ac_config_guess`; then :
     else
       echo "$progname: cannot guess host type; you must specify one" 1>&2
       echo "$help" 1>&2
       exit 1
-    fi ;;
+    fi
+
+    # Restore the C compiler.
+    CC="$old_CC"
+    ;;
   esac
   host=`$SHELL $ac_config_sub $host_alias`
   echo "$ac_t$host" 1>&6
@@ -439,24 +559,50 @@
   # Make sure the host verified.
   test -z "$host" && exit 1
 
+  # Check for the build system type
+  echo $ac_n "checking build system type... $ac_c" 1>&6
+
+  build_alias=$build
+  case "$build_alias" in
+  NONE)
+    case $nonopt in
+    NONE) build_alias=$host_alias ;;
+    *) build_alias=$nonopt ;;
+    esac ;;
+  esac
+
+  build=`$SHELL $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
+
 elif test -z "$host"; then
   echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
   echo "$help" 1>&2
   exit 1
 else
   host_alias=$host
+  build_alias=$host_alias
+  build=$host
 fi
 
+if test x"$host" != x"$build"; then
+  ac_tool_prefix=${host_alias}-
+else
+  ac_tool_prefix=
+fi
+
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
 case "$host_os" in
 linux-gnu*) ;;
 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
 esac
 
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
 case "$host_os" in
 aix3*)
   # AIX sometimes has problems with the GCC collect2 program.  For some
@@ -470,353 +616,170 @@
 esac
 
 # Determine commands to create old-style static archives.
-old_archive_cmds='$AR cru $oldlib$oldobjs'
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
 old_postinstall_cmds='chmod 644 $oldlib'
 old_postuninstall_cmds=
 
-# Set a sane default for `AR'.
-test -z "$AR" && AR=ar
-
-# Set a sane default for `OBJDUMP'.
-test -z "$OBJDUMP" && OBJDUMP=objdump
-
-# If RANLIB is not set, then run the test.
-if test "${RANLIB+set}" != "set"; then
-  result=no
-
-  echo $ac_n "checking for ranlib... $ac_c" 1>&6
-  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
-  for dir in $PATH; do
-    test -z "$dir" && dir=.
-    if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then
-      RANLIB="ranlib"
-      result="ranlib"
-      break
-    fi
-  done
-  IFS="$save_ifs"
-
-  echo "$ac_t$result" 1>&6
-fi
-
 if test -n "$RANLIB"; then
   old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
   old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
 fi
 
-# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin.
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-test -z "$OBJDUMP" && OBJDUMP=objdump
-test -z "$AS" && AS=as
-
-# Check to see if we are using GCC.
-if test "$with_gcc" != yes || test -z "$CC"; then
-  # If CC is not set, then try to find GCC or a usable CC.
-  if test -z "$CC"; then
-    echo $ac_n "checking for gcc... $ac_c" 1>&6
-    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
-    for dir in $PATH; do
-      test -z "$dir" && dir=.
-      if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then
-	CC="gcc"
-	break
-      fi
-    done
-    IFS="$save_ifs"
-
-    if test -n "$CC"; then
-      echo "$ac_t$CC" 1>&6
-    else
-      echo "$ac_t"no 1>&6
-    fi
-  fi
-
-  # Not "gcc", so try "cc", rejecting "/usr/ucb/cc".
-  if test -z "$CC"; then
-    echo $ac_n "checking for cc... $ac_c" 1>&6
-    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
-    cc_rejected=no
-    for dir in $PATH; do
-      test -z "$dir" && dir=.
-      if test -f $dir/cc || test -f $dir/cc$ac_exeext; then
-	if test "$dir/cc" = "/usr/ucb/cc"; then
-	  cc_rejected=yes
-	  continue
-	fi
-	CC="cc"
-	break
-      fi
-    done
-    IFS="$save_ifs"
-    if test $cc_rejected = yes; then
-      # We found a bogon in the path, so make sure we never use it.
-      set dummy $CC
-      shift
-      if test $# -gt 0; then
-	# We chose a different compiler from the bogus one.
-	# However, it has the same name, so the bogon will be chosen
-	# first if we set CC to just the name; use the full file name.
-	shift
-	set dummy "$dir/cc" "$@"
-	shift
-	CC="$@"
-      fi
-    fi
-
-    if test -n "$CC"; then
-      echo "$ac_t$CC" 1>&6
-    else
-      echo "$ac_t"no 1>&6
-    fi
-
-    if test -z "$CC"; then
-      echo "$progname: error: no acceptable cc found in \$PATH" 1>&2
-      exit 1
-    fi
-  fi
-
-  # Now see if the compiler is really GCC.
-  with_gcc=no
-  echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6
-  echo "$progname:581: checking whether we are using GNU C" >&5
-
-  $rm conftest.c
-  cat > conftest.c <<EOF
-#ifdef __GNUC__
-  yes;
-#endif
-EOF
-  if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
-    with_gcc=yes
-  fi
-  $rm conftest.c
-  echo "$ac_t$with_gcc" 1>&6
+# Source the script associated with the $tagname tag configuration.
+if test -n "$tagname"; then
+  . $ltmain
+else
+  # FIXME:  We should use a variable here
+  # Configure for a C compiler
+  . $srcdir/ltcf-c.sh
 fi
 
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$NM" && NM=nm
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$objext" && objext=o
+
+echo $ac_n "checking for objdir... $ac_c" 1>&6
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+echo "$ac_t$objdir" 1>&6
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
 # Allow CC to be a program name with arguments.
 set dummy $CC
 compiler="$2"
 
-echo $ac_n "checking for object suffix... $ac_c" 1>&6
-$rm conftest*
-echo 'int i = 1;' > conftest.c
-echo "$progname:603: checking for object suffix" >& 5
-if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
-  # Append any warnings to the config.log.
-  cat conftest.err 1>&5
-
-  for ac_file in conftest.*; do
-    case $ac_file in
-    *.c) ;;
-    *) objext=`echo $ac_file | sed -e s/conftest.//` ;;
-    esac
-  done
-else
-  cat conftest.err 1>&5
-  echo "$progname: failed program was:" >&5
-  cat conftest.c >&5
-fi
-$rm conftest*
-echo "$ac_t$objext" 1>&6
-
-echo $ac_n "checking for executable suffix... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_cv_exeext="no"
-  $rm conftest*
-  echo 'main () { return 0; }' > conftest.c
-  echo "$progname:629: checking for executable suffix" >& 5
-  if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then
-    # Append any warnings to the config.log.
-    cat conftest.err 1>&5
-
-    for ac_file in conftest.*; do
-      case $ac_file in
-      *.c | *.err | *.$objext ) ;;
-      *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;;
-      esac
-    done
-  else
-    cat conftest.err 1>&5
-    echo "$progname: failed program was:" >&5
-    cat conftest.c >&5
-  fi
-  $rm conftest*
-fi
-if test "X$ac_cv_exeext" = Xno; then
-  exeext=""
-else
-  exeext="$ac_cv_exeext"
-fi
-echo "$ac_t$ac_cv_exeext" 1>&6
-
+# We assume here that the value for ac_cv_prog_cc_pic will not be cached
+# in isolation, and that seeing it set (from the cache) indicates that
+# the associated values are set (in the cache) correctly too.
 echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
-pic_flag=
-special_shlib_compile_flags=
-wl=
-link_static_flag=
-no_builtin_flag=
+echo "$progname:675:checking for $compiler option to produce PIC" 1>&5
 
-if test "$with_gcc" = yes; then
-  wl='-Wl,'
-  link_static_flag='-static'
-
-  case "$host_os" in
-  beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
-    # PIC is the default for these OSes.
-    ;;
-  aix*)
-    # Below there is a dirty hack to force normal static linking with -ldl
-    # The problem is because libdl dynamically linked with both libc and
-    # libC (AIX C++ library), which obviously doesn't included in libraries
-    # list by gcc. This cause undefined symbols with -static flags.
-    # This hack allows C programs to be linked with "-static -ldl", but
-    # we not sure about C++ programs.
-    link_static_flag="$link_static_flag ${wl}-lC"
-    ;;
-  cygwin* | mingw* | os2*)
-    # We can build DLLs from non-PIC.
-    ;;
-  amigaos*)
-    # FIXME: we need at least 68020 code to build shared libraries, but
-    # adding the `-m68020' flag to GCC prevents building anything better,
-    # like `-m68040'.
-    pic_flag='-m68020 -resident32 -malways-restore-a4'
-    ;;
-  sysv4*MP*)
-    if test -d /usr/nec; then
-       pic_flag=-Kconform_pic
-    fi
-    ;;
-  *)
-    pic_flag='-fPIC'
-    ;;
-  esac
+if test -z "$ac_cv_prog_cc_pic"; then
+  echo "$ac_t"none 1>&6
 else
-  # PORTME Check for PIC flags for the system compiler.
-  case "$host_os" in
-  aix3* | aix4*)
-    # All AIX code is PIC.
-    link_static_flag='-bnso -bI:/lib/syscalls.exp'
-    ;;
-
-  hpux9* | hpux10* | hpux11*)
-    # Is there a better link_static_flag that works with the bundled CC?
-    wl='-Wl,'
-    link_static_flag="${wl}-a ${wl}archive"
-    pic_flag='+Z'
-    ;;
-
-  irix5* | irix6*)
-    wl='-Wl,'
-    link_static_flag='-non_shared'
-    # PIC (with -KPIC) is the default.
-    ;;
-
-  cygwin* | mingw* | os2*)
-    # We can build DLLs from non-PIC.
-    ;;
-
-  osf3* | osf4* | osf5*)
-    # All OSF/1 code is PIC.
-    wl='-Wl,'
-    link_static_flag='-non_shared'
-    ;;
-
-  sco3.2v5*)
-    pic_flag='-Kpic'
-    link_static_flag='-dn'
-    special_shlib_compile_flags='-belf'
-    ;;
-
-  solaris*)
-    pic_flag='-KPIC'
-    link_static_flag='-Bstatic'
-    wl='-Wl,'
-    ;;
-
-  sunos4*)
-    pic_flag='-PIC'
-    link_static_flag='-Bstatic'
-    wl='-Qoption ld '
-    ;;
-
-  sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-    pic_flag='-KPIC'
-    link_static_flag='-Bstatic'
-    wl='-Wl,'
-    ;;
-
-  uts4*)
-    pic_flag='-pic'
-    link_static_flag='-Bstatic'
-    ;;
-  sysv4*MP*)
-    if test -d /usr/nec ;then
-      pic_flag='-Kconform_pic'
-      link_static_flag='-Bstatic'
-    fi
-    ;;
-  *)
-    can_build_shared=no
-    ;;
-  esac
-fi
-
-if test -n "$pic_flag"; then
-  echo "$ac_t$pic_flag" 1>&6
+  echo "$ac_t""$ac_cv_prog_cc_pic" 1>&6
 
   # Check to make sure the pic_flag actually works.
-  echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6
-  $rm conftest*
-  echo "int some_variable = 0;" > conftest.c
-  save_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS $pic_flag -DPIC"
-  echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5
-  if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
-    # Append any warnings to the config.log.
-    cat conftest.err 1>&5
-    
-    case "$host_os" in
-    hpux9* | hpux10* | hpux11*)
-      # On HP-UX, both CC and GCC only warn that PIC is supported... then they
-      # create non-PIC objects.  So, if there were any warnings, we assume that
-      # PIC is not supported.
-      if test -s conftest.err; then
-	echo "$ac_t"no 1>&6
-	can_build_shared=no
-	pic_flag=
-      else
-	echo "$ac_t"yes 1>&6
-	pic_flag=" $pic_flag"
-      fi
-      ;;
-    *)
-      echo "$ac_t"yes 1>&6
-      pic_flag=" $pic_flag"
-      ;;
-    esac
+  echo $ac_n "checking if $compiler PIC flag $ac_cv_prog_cc_pic works... $ac_c" 1>&6
+  echo "$progname:684:checking that $compiler PIC flag $ac_cv_prog_cc_pic works." 1>&5
+  if test "X${ac_cv_prog_cc_pic_works+set}" = Xset && \
+     test "X${ac_cv_prog_cc_pic_works}" != X; then
+    echo $ac_n "(cached) $ac_c" 1>&6
   else
-    # Append any errors to the config.log.
-    cat conftest.err 1>&5
-    can_build_shared=no
-    pic_flag=
-    echo "$ac_t"no 1>&6
+    ac_cv_prog_cc_pic_works=yes
+    $rm conftest*
+    echo $lt_simple_compile_test_code > conftest.$ac_ext
+    save_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $ac_cv_prog_cc_pic -DPIC"
+    if { (eval echo $progname:694: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
+      # Append any warnings to the config.log.
+      cat conftest.err 1>&5
+
+      case "$host_os" in
+      hpux9* | hpux10* | hpux11*)
+	# On HP-UX, both CC and GCC only warn that PIC is supported... then
+	# they create non-PIC objects.  So, if there were any warnings, we
+	# assume that PIC is not supported.
+	if test -s conftest.err; then
+	  ac_cv_prog_cc_pic_works=no
+	  ac_cv_prog_cc_can_build_shared=no
+	  ac_cv_prog_cc_pic=
+	else
+	  ac_cv_prog_cc_pic_works=yes
+	  ac_cv_prog_cc_pic=" $ac_cv_prog_cc_pic"
+	fi
+	;;
+      *)
+	ac_cv_prog_cc_pic_works=yes
+	ac_cv_prog_cc_pic=" $ac_cv_prog_cc_pic"
+	;;
+      esac
+    else
+      # Append any errors to the config.log.
+      cat conftest.err 1>&5
+      ac_cv_prog_cc_pic_works=no
+      ac_cv_prog_cc_can_build_shared=no
+      ac_cv_prog_cc_pic=
+    fi
+    CFLAGS="$save_CFLAGS"
+    $rm conftest*
   fi
-  CFLAGS="$save_CFLAGS"
-  $rm conftest*
-else
-  echo "$ac_t"none 1>&6
+  # Belt *and* braces to stop my trousers falling down:
+  if test "X$ac_cv_prog_cc_pic_works" = Xno; then
+    ac_cv_prog_cc_pic=
+    ac_cv_prog_cc_can_build_shared=no
+  fi
+  echo "$ac_t""$ac_cv_prog_cc_pic_works" 1>&6
 fi
 
+# Check for any special shared library compilation flags.
+if test -n "$ac_cv_prog_cc_shlib"; then
+  echo "$progname: warning: \`$CC' requires \`$ac_cv_prog_cc_shlib' to build shared libraries" 1>&2
+  if echo "$old_CC $old_CFLAGS " | egrep -e "[ 	]$ac_cv_prog_cc_shlib[ 	]" >/dev/null; then :
+  else
+    echo "$progname: add \`$ac_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" 1>&2
+    ac_cv_prog_cc_can_build_shared=no
+  fi
+fi
+
+echo $ac_n "checking if $compiler static flag $ac_cv_prog_cc_static works... $ac_c" 1>&6
+echo "$progname:746: checking if $compiler static flag $ac_cv_prog_cc_static works" >&5
+if test "X${ac_cv_prog_cc_static_works+set}" = Xset && \
+   test "X${ac_cv_prog_cc_static_works}" != X; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  $rm conftest*
+  echo $lt_simple_link_test_code > conftest.$ac_ext
+  save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $ac_cv_prog_cc_static"
+  if { (eval echo $progname:755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+    ac_cv_prog_cc_static_works=yes
+  else
+    ac_cv_prog_cc_static_works=no
+    ac_cv_prog_cc_static=
+  fi
+  LDFLAGS="$save_LDFLAGS"
+  $rm conftest*
+fi
+# Belt *and* braces to stop my trousers falling down:
+if test "X$ac_cv_prog_cc_static_works" = Xno; then
+  ac_cv_prog_cc_static=
+fi
+echo "$ac_t""$ac_cv_prog_cc_static_works" 1>&6
+pic_flag="$ac_cv_prog_cc_pic"
+special_shlib_compile_flags="$ac_cv_prog_cc_shlib"
+wl="$ac_cv_prog_cc_wl"
+link_static_flag="$ac_cv_prog_cc_static"
+no_builtin_flag="$ac_cv_prog_cc_no_builtin"
+can_build_shared="$ac_cv_prog_cc_can_build_shared"
+
 # Check to see if options -o and -c are simultaneously supported by compiler
-echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6
+echo $ac_n "checking if $compiler supports -c -o file.$objext... $ac_c" 1>&6
 $rm -r conftest 2>/dev/null
 mkdir conftest
 cd conftest
 $rm conftest*
-echo "int some_variable = 0;" > conftest.c
+echo $lt_simple_compile_test_code > conftest.$ac_ext
 mkdir out
 # According to Tom Tromey, Ian Lance Taylor reported there are C compilers
 # that will create temporary files in the current directory regardless of
@@ -825,9 +788,9 @@
 # builds.
 chmod -w .
 save_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -o out/conftest2.o"
-echo "$progname:829: checking if $compiler supports -c -o file.o" >&5
-if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then
+CFLAGS="$CFLAGS -o out/conftest2.$objext"
+echo "$progname:792: checking if $compiler supports -c -o file.$objext" >&5
+if { (eval echo $progname:793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$objext; then
 
   # The compiler can only warn and ignore the option if not recognized
   # So say no if there are warnings
@@ -852,37 +815,6 @@
 rmdir conftest
 $rm -r conftest 2>/dev/null
 
-if test x"$compiler_c_o" = x"yes"; then
-  # Check to see if we can write to a .lo
-  echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6
-  $rm conftest*
-  echo "int some_variable = 0;" > conftest.c
-  save_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -c -o conftest.lo"
-  echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5
-if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then
-
-    # The compiler can only warn and ignore the option if not recognized
-    # So say no if there are warnings
-      if test -s conftest.err; then
-	echo "$ac_t"no 1>&6
-	compiler_o_lo=no
-      else
-	echo "$ac_t"yes 1>&6
-	compiler_o_lo=yes
-      fi
-  else
-    # Append any errors to the config.log.
-    cat conftest.err 1>&5
-    compiler_o_lo=no
-    echo "$ac_t"no 1>&6
-  fi
-  CFLAGS="$save_CFLAGS"
-  $rm conftest*
-else
-  compiler_o_lo=no
-fi
-
 # Check to see if we can do hard links to lock some files if needed
 hard_links="nottested"
 if test "$compiler_c_o" = no && test "$need_locks" != no; then
@@ -908,11 +840,11 @@
   # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
   echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6
   $rm conftest*
-  echo "int some_variable = 0;" > conftest.c
+  echo $lt_simple_compile_test_code > conftest.$ac_ext
   save_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c"
-  echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-  if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
+  CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
+  echo "$progname:846: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+  if { (eval echo $progname:847: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
 
     # The compiler can only warn and ignore the option if not recognized
     # So say no if there are warnings
@@ -940,793 +872,12 @@
   
 fi
 
-# Check for any special shared library compilation flags.
-if test -n "$special_shlib_compile_flags"; then
-  echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
-  if echo "$old_CC $old_CFLAGS " | egrep -e "[ 	]$special_shlib_compile_flags[ 	]" >/dev/null; then :
-  else
-    echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2
-    can_build_shared=no
-  fi
-fi
-
-echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6
-$rm conftest*
-echo 'main(){return(0);}' > conftest.c
-save_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS $link_static_flag"
-echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5
-if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-  echo "$ac_t$link_static_flag" 1>&6
-else
-  echo "$ac_t"none 1>&6
-  link_static_flag=
-fi
-LDFLAGS="$save_LDFLAGS"
-$rm conftest*
-
-if test -z "$LN_S"; then
-  # Check to see if we can use ln -s, or we need hard links.
-  echo $ac_n "checking whether ln -s works... $ac_c" 1>&6
-  $rm conftest.dat
-  if ln -s X conftest.dat 2>/dev/null; then
-    $rm conftest.dat
-    LN_S="ln -s"
-  else
-    LN_S=ln
-  fi
-  if test "$LN_S" = "ln -s"; then
-    echo "$ac_t"yes 1>&6
-  else
-    echo "$ac_t"no 1>&6
-  fi
-fi
-
-# Make sure LD is an absolute path.
-if test -z "$LD"; then
-  ac_prog=ld
-  if test "$with_gcc" = yes; then
-    # Check if gcc -print-prog-name=ld gives a path.
-    echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6
-    echo "$progname:991: checking for ld used by GCC" >&5
-    ac_prog=`($CC -print-prog-name=ld) 2>&5`
-    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 are not 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
-    echo $ac_n "checking for GNU ld... $ac_c" 1>&6
-    echo "$progname:1015: checking for GNU ld" >&5
-  else
-    echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-    echo "$progname:1018: checking for non-GNU ld" >&5
-  fi
-
-  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
-	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 "$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"
-  fi
-
-  if test -n "$LD"; then
-    echo "$ac_t$LD" 1>&6
-  else
-    echo "$ac_t"no 1>&6
-  fi
-
-  if test -z "$LD"; then
-    echo "$progname: error: no acceptable ld found in \$PATH" 1>&2
-    exit 1
-  fi
-fi
-
-# Check to see if it really is or is not GNU ld.
-echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6
-# 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
-  with_gnu_ld=yes
-else
-  with_gnu_ld=no
-fi
-echo "$ac_t$with_gnu_ld" 1>&6
-
 # See if the linker supports building shared libraries.
 echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
 
-allow_undefined_flag=
-no_undefined_flag=
-need_lib_prefix=unknown
-need_version=unknown
-# when you set need_version to no, make sure it does not cause -set_version
-# flags to be left without arguments
-archive_cmds=
-archive_expsym_cmds=
-old_archive_from_new_cmds=
-export_dynamic_flag_spec=
-whole_archive_flag_spec=
-thread_safe_flag_spec=
-hardcode_libdir_flag_spec=
-hardcode_libdir_separator=
-hardcode_direct=no
-hardcode_minus_L=no
-hardcode_shlibpath_var=unsupported
-runpath_var=
-always_export_symbols=no
-export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
-# include_expsyms should be a list of space-separated symbols to be *always*
-# included in the symbol list
-include_expsyms=
-# exclude_expsyms can be an egrep regular expression of symbols to exclude
-# it will be wrapped by ` (' and `)$', so one must not match beginning or
-# end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-# as well as any symbol that contains `d'.
-exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
-# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
-# platforms (ab)use it in PIC code, but their linkers get confused if
-# the symbol is explicitly referenced.  Since portable code cannot
-# rely on this symbol name, it's probably fine to never include it in
-# preloaded symbol tables.
-
-case "$host_os" in
-cygwin* | mingw*)
-  # FIXME: the MSVC++ port hasn't been tested in a loooong time
-  # When not using gcc, we currently assume that we are using
-  # Microsoft Visual C++.
-  if test "$with_gcc" != yes; then
-    with_gnu_ld=no
-  fi
-  ;;
-
-esac
-
-ld_shlibs=yes
-if test "$with_gnu_ld" = yes; then
-  # If archive_cmds runs LD, not CC, wlarc should be empty
-  wlarc='${wl}'
-
-  # See if GNU ld supports shared libraries.
-  case "$host_os" in
-  aix3* | aix4*)
-    # On AIX, the GNU linker is very broken
-    ld_shlibs=no
-    cat <<EOF 1>&2
-
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
-
-EOF
-    ;;
-
-  amigaos*)
-    archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
-    hardcode_libdir_flag_spec='-L$libdir'
-    hardcode_minus_L=yes
-
-    # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
-    # that the semantics of dynamic libraries on AmigaOS, at least up
-    # to version 4, is to share data among multiple programs linked
-    # with the same dynamic library.  Since this doesn't match the
-    # behavior of shared libraries on other platforms, we can use
-    # them.
-    ld_shlibs=no
-    ;;
-
-  beos*)
-    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
-      allow_undefined_flag=unsupported
-      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
-      # support --undefined.  This deserves some investigation.  FIXME
-      archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
-    else
-      ld_shlibs=no
-    fi
-    ;;
-
-  cygwin* | mingw*)
-    # hardcode_libdir_flag_spec is actually meaningless, as there is
-    # no search path for DLLs.
-    hardcode_libdir_flag_spec='-L$libdir'
-    allow_undefined_flag=unsupported
-    always_export_symbols=yes
-
-    # Extract the symbol export list from an `--export-all' def file,
-    # then regenerate the def file from the symbol export list, so that
-    # the compiled dll only exports the symbol export list.
-    export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
-      test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
-      $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def  $objdir/$soname-ltdll.$objext $libobjs $convenience~
-      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]* ; *//" < $objdir/$soname-def > $export_symbols'
-
-    archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~
-      _lt_hint=1;
-      for symbol in `cat $export_symbols`; do
-	echo "	\$symbol @ \$_lt_hint ; " >> $objdir/$soname-def;
-	_lt_hint=`expr 1 + \$_lt_hint`;
-      done~
-      test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
-      test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
-      $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
-      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
-      $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
-      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
-      $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts'
-
-      old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' 
-    ;;
-
-  netbsd*)
-    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-      archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
-      archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-    else
-      archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib'
-      # can we support soname and/or expsyms with a.out? -oliva
-    fi
-    ;;
-
-  solaris* | sysv5*)
-    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
-      ld_shlibs=no
-      cat <<EOF 1>&2
-
-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
-*** create shared libraries on Solaris systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.9.1 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-EOF
-    elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
-      archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
-      archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-    else
-      ld_shlibs=no
-    fi
-    ;;      
-
-  sunos4*)
-    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts'
-    wlarc=
-    hardcode_direct=yes
-    hardcode_shlibpath_var=no
-    ;;
-
-  *)
-    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
-      archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
-      archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-    else
-      ld_shlibs=no
-    fi
-    ;;
-  esac
-
-  if test "$ld_shlibs" = yes; then
-    runpath_var=LD_RUN_PATH
-    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
-    export_dynamic_flag_spec='${wl}--export-dynamic'
-    case $host_os in
-    cygwin* | mingw*)
-      # dlltool doesn't understand --whole-archive et. al.
-      whole_archive_flag_spec=
-      ;;
-    *)
-      # ancient GNU ld didn't support --whole-archive et. al.
-      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
-        whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-      else
-        whole_archive_flag_spec=
-      fi
-      ;;
-    esac
-  fi
-else
-  # PORTME fill in a description of your system's linker (not GNU ld)
-  case "$host_os" in
-  aix3*)
-    allow_undefined_flag=unsupported
-    always_export_symbols=yes
-    archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname'
-    # Note: this linker hardcodes the directories in LIBPATH if there
-    # are no directories specified by -L.
-    hardcode_minus_L=yes
-    if test "$with_gcc" = yes && test -z "$link_static_flag"; then
-      # Neither direct hardcoding nor static linking is supported with a
-      # broken collect2.
-      hardcode_direct=unsupported
-    fi
-    ;;
-
-  aix4*)
-    hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib'
-    hardcode_libdir_separator=':'
-    if test "$with_gcc" = yes; then
-      collect2name=`${CC} -print-prog-name=collect2`
-      if test -f "$collect2name" && \
-	 strings "$collect2name" | grep resolve_lib_name >/dev/null
-      then
-	# We have reworked collect2
-	hardcode_direct=yes
-      else
-	# We have old collect2
-	hardcode_direct=unsupported
-	# It fails to find uninstalled libraries when the uninstalled
-	# path is not listed in the libpath.  Setting hardcode_minus_L
-	# to unsupported forces relinking
-	hardcode_minus_L=yes
-	hardcode_libdir_flag_spec='-L$libdir'
-	hardcode_libdir_separator=
-      fi
-      shared_flag='-shared'
-    else
-      shared_flag='${wl}-bM:SRE'
-      hardcode_direct=yes
-    fi
-    allow_undefined_flag=' ${wl}-berok'
-    archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
-    archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}'
-    case "$host_os" in aix4.[01]|aix4.[01].*)
-      # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
-      always_export_symbols=yes ;;
-    esac
-   ;;
-
-  amigaos*)
-    archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
-    hardcode_libdir_flag_spec='-L$libdir'
-    hardcode_minus_L=yes
-    # see comment about different semantics on the GNU ld section
-    ld_shlibs=no
-    ;;
-
-  cygwin* | mingw*)
-    # When not using gcc, we currently assume that we are using
-    # Microsoft Visual C++.
-    # hardcode_libdir_flag_spec is actually meaningless, as there is
-    # no search path for DLLs.
-    hardcode_libdir_flag_spec=' '
-    allow_undefined_flag=unsupported
-    # Tell ltmain to make .lib files, not .a files.
-    libext=lib
-    # FIXME: Setting linknames here is a bad hack.
-    archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-    # The linker will automatically build a .lib file if we build a DLL.
-    old_archive_from_new_cmds='true'
-    # FIXME: Should let the user specify the lib program.
-    old_archive_cmds='lib /OUT:$oldlib$oldobjs'
-    fix_srcfile_path='`cygpath -w $srcfile`'
-    ;;
-
-  freebsd1*)
-    ld_shlibs=no
-    ;;
-
-  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
-  # support.  Future versions do this automatically, but an explicit c++rt0.o
-  # does not break anything, and helps significantly (at the cost of a little
-  # extra space).
-  freebsd2.2*)
-    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o'
-    hardcode_libdir_flag_spec='-R$libdir'
-    hardcode_direct=yes
-    hardcode_shlibpath_var=no
-    ;;
-
-  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-  freebsd2*)
-    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
-    hardcode_direct=yes
-    hardcode_minus_L=yes
-    hardcode_shlibpath_var=no
-    ;;
-
-  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-  freebsd*)
-    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts'
-    hardcode_libdir_flag_spec='-R$libdir'
-    hardcode_direct=yes
-    hardcode_shlibpath_var=no
-    ;;
-
-  hpux9* | hpux10* | hpux11*)
-    case "$host_os" in
-    hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;;
-    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;;
-    esac
-    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-    hardcode_libdir_separator=:
-    hardcode_direct=yes
-    hardcode_minus_L=yes # Not in the search PATH, but as the default
-			 # location of the library.
-    export_dynamic_flag_spec='${wl}-E'
-    ;;
-
-  irix5* | irix6*)
-    if test "$with_gcc" = yes; then
-      archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
-    else
-      archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
-    fi
-    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-    hardcode_libdir_separator=:
-    ;;
-
-  netbsd*)
-    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'  # a.out
-    else
-      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts'      # ELF
-    fi
-    hardcode_libdir_flag_spec='${wl}-R$libdir'
-    hardcode_direct=yes
-    hardcode_shlibpath_var=no
-    ;;
-
-  openbsd*)
-    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
-    hardcode_libdir_flag_spec='-R$libdir'
-    hardcode_direct=yes
-    hardcode_shlibpath_var=no
-    ;;
-
-  os2*)
-    hardcode_libdir_flag_spec='-L$libdir'
-    hardcode_minus_L=yes
-    allow_undefined_flag=unsupported
-    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def'
-    old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
-    ;;
-
-  osf3*)
-    if test "$with_gcc" = yes; then
-      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
-    else
-      allow_undefined_flag=' -expect_unresolved \*'
-      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
-    fi
-    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-    hardcode_libdir_separator=:
-    ;;
-
-  osf4* | osf5*)  # As osf3* with the addition of the -msym flag
-    if test "$with_gcc" = yes; then
-      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
-    else
-      allow_undefined_flag=' -expect_unresolved \*'
-      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
-    fi
-    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-    hardcode_libdir_separator=:
-    ;;
-
-  sco3.2v5*)
-    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
-    hardcode_shlibpath_var=no
-    runpath_var=LD_RUN_PATH
-    hardcode_runpath_var=yes
-    ;;
-
-  solaris*)
-    no_undefined_flag=' -z text'
-    # $CC -shared without GNU ld will not create a library from C++
-    # object files and a static libstdc++, better avoid it by now
-    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
-    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
-    hardcode_libdir_flag_spec='-R$libdir'
-    hardcode_shlibpath_var=no
-    case "$host_os" in
-    solaris2.[0-5] | solaris2.[0-5].*) ;;
-    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
-      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
-    esac
-    ;;
-
-  sunos4*)
-    archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts'
-    hardcode_libdir_flag_spec='-L$libdir'
-    hardcode_direct=yes
-    hardcode_minus_L=yes
-    hardcode_shlibpath_var=no
-    ;;
-
-  sysv4)
-    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
-    runpath_var='LD_RUN_PATH'
-    hardcode_shlibpath_var=no
-    hardcode_direct=no #Motorola manual says yes, but my tests say they lie 
-    ;;  
-
-  sysv4.3*)
-    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
-    hardcode_shlibpath_var=no
-    export_dynamic_flag_spec='-Bexport'
-    ;;
-
-  sysv5*)
-    no_undefined_flag=' -z text'
-    # $CC -shared without GNU ld will not create a library from C++
-    # object files and a static libstdc++, better avoid it by now
-    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
-    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
-    hardcode_libdir_flag_spec=
-    hardcode_shlibpath_var=no
-    runpath_var='LD_RUN_PATH'
-    ;;
-
-  uts4*)
-    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
-    hardcode_libdir_flag_spec='-L$libdir'
-    hardcode_shlibpath_var=no
-    ;;
-
-  dgux*)
-    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
-    hardcode_libdir_flag_spec='-L$libdir'
-    hardcode_shlibpath_var=no
-    ;;
-
-  sysv4*MP*)
-    if test -d /usr/nec; then
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
-      hardcode_shlibpath_var=no
-      runpath_var=LD_RUN_PATH
-      hardcode_runpath_var=yes
-      ld_shlibs=yes
-    fi
-    ;;
-
-  sysv4.2uw2*)
-    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts'
-    hardcode_direct=yes
-    hardcode_minus_L=no
-    hardcode_shlibpath_var=no
-    hardcode_runpath_var=yes
-    runpath_var=LD_RUN_PATH
-    ;;
-
-  unixware7*)
-    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
-    runpath_var='LD_RUN_PATH'
-    hardcode_shlibpath_var=no
-    ;;
-
-  *)
-    ld_shlibs=no
-    ;;
-  esac
-fi
 echo "$ac_t$ld_shlibs" 1>&6
 test "$ld_shlibs" = no && can_build_shared=no
 
-if test -z "$NM"; then
-  echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
-  case "$NM" in
-  [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path.
-  *)
-    IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
-    for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do
-      test -z "$ac_dir" && ac_dir=.
-      if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then
-	# Check to see if the nm accepts a BSD-compat flag.
-	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
-	#   nm: unknown option "B" ignored
-	if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
-	  NM="$ac_dir/nm -B"
-	  break
-	elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
-	  NM="$ac_dir/nm -p"
-	  break
-	else
-	  NM=${NM="$ac_dir/nm"} # keep the first match, but
-	  continue # so that we can try to find one that supports BSD flags
-	fi
-      fi
-    done
-    IFS="$ac_save_ifs"
-    test -z "$NM" && NM=nm
-    ;;
-  esac
-  echo "$ac_t$NM" 1>&6
-fi
-
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
-
-# These are sane defaults that work on at least a few old systems.
-# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
-
-# Character class describing NM global symbol codes.
-symcode='[BCDEGRST]'
-
-# Regexp to match symbols that can be accessed directly from C.
-sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
-
-# Transform the above into a raw symbol and a C symbol.
-symxfrm='\1 \2\3 \3'
-
-# Transform an extracted symbol line into a proper C declaration
-global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
-
-# Define system-specific variables.
-case "$host_os" in
-aix*)
-  symcode='[BCDT]'
-  ;;
-cygwin* | mingw*)
-  symcode='[ABCDGISTW]'
-  ;;
-hpux*) # Its linker distinguishes data from code symbols
-  global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
-  ;;
-irix*)
-  symcode='[BCDEGRST]'
-  ;;
-solaris*)
-  symcode='[BDT]'
-  ;;
-sysv4)
-  symcode='[DFNSTU]'
-  ;;
-esac
-
-# If we're using GNU nm, then use its standard symbol codes.
-if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
-  symcode='[ABCDGISTW]'
-fi
-
-# Try without a prefix undercore, then with it.
-for ac_symprfx in "" "_"; do
-
-  # Write the raw and C identifiers.
-  global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode\)[ 	][ 	]*\($ac_symprfx\)$sympat$/$symxfrm/p'"
-
-  # Check to see that the pipe works correctly.
-  pipe_works=no
-  $rm conftest*
-  cat > conftest.c <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-main(){nm_test_var='a';nm_test_func();return(0);}
-EOF
-
-  echo "$progname:1635: checking if global_symbol_pipe works" >&5
-  if { (eval echo $progname:1636: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then
-    # Now try to grab the symbols.
-    nlist=conftest.nm
-    if { echo "$progname:1639: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
-
-      # Try sorting and uniquifying the output.
-      if sort "$nlist" | uniq > "$nlist"T; then
-	mv -f "$nlist"T "$nlist"
-      else
-	rm -f "$nlist"T
-      fi
-
-      # Make sure that we snagged all the symbols we need.
-      if egrep ' nm_test_var$' "$nlist" >/dev/null; then
-	if egrep ' nm_test_func$' "$nlist" >/dev/null; then
-	  cat <<EOF > conftest.c
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
-	  # Now generate the symbol file.
-	  eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c'
-
-	  cat <<EOF >> conftest.c
-#if defined (__STDC__) && __STDC__
-# define lt_ptr_t void *
-#else
-# define lt_ptr_t char *
-# define const
-#endif
-
-/* The mapping between symbol names and symbols. */
-const struct {
-  const char *name;
-  lt_ptr_t address;
-}
-lt_preloaded_symbols[] =
-{
-EOF
-	  sed 's/^. \(.*\) \(.*\)$/  {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c
-	  cat <<\EOF >> conftest.c
-  {0, (lt_ptr_t) 0}
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
-	  # Now try linking the two files.
-	  mv conftest.$objext conftstm.$objext
-	  save_LIBS="$LIBS"
-	  save_CFLAGS="$CFLAGS"
-	  LIBS="conftstm.$objext"
-	  CFLAGS="$CFLAGS$no_builtin_flag"
-	  if { (eval echo $progname:1691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-	    pipe_works=yes
-	  else
-	    echo "$progname: failed program was:" >&5
-	    cat conftest.c >&5
-	  fi
-	  LIBS="$save_LIBS"
-	else
-	  echo "cannot find nm_test_func in $nlist" >&5
-	fi
-      else
-	echo "cannot find nm_test_var in $nlist" >&5
-      fi
-    else
-      echo "cannot run $global_symbol_pipe" >&5
-    fi
-  else
-    echo "$progname: failed program was:" >&5
-    cat conftest.c >&5
-  fi
-  $rm conftest* conftst*
-
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$pipe_works" = yes; then
-    break
-  else
-    global_symbol_pipe=
-  fi
-done
-if test "$pipe_works" = yes; then
-  echo "${ac_t}ok" 1>&6
-else
-  echo "${ac_t}failed" 1>&6
-fi
-
-if test -z "$global_symbol_pipe"; then
-  global_symbol_to_cdecl=
-fi
-
 # Check hardcoding attributes.
 echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
 hardcode_action=
@@ -1753,14 +904,17 @@
 fi
 echo "$ac_t$hardcode_action" 1>&6
 
+echo $ac_n "checking whether stripping libraries is possible... $ac_c" 1>&6
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  echo "${ac_t}yes" 1>&6
+else
+  echo "${ac_t}no" 1>&6
+fi
 
-reload_flag=
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
-echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6
-# PORTME Some linkers may need a different reload flag.
-reload_flag='-r'
-echo "$ac_t$reload_flag" 1>&6
-test -n "$reload_flag" && reload_flag=" $reload_flag"
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
 
 # PORTME Fill in your ld.so characteristics
 library_names_spec=
@@ -1776,19 +930,7 @@
 dynamic_linker="$host_os ld.so"
 sys_lib_dlsearch_path_spec="/lib /usr/lib"
 sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-file_magic_cmd=
-file_magic_test_file=
-deplibs_check_method='unknown'
-# Need to set the preceding variable on all platforms that support
-# interlibrary dependencies.
-# 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
-# 'pass_all' -- all dependencies passed with no checks.
-# 'test_compile' -- check by making test program.
-# 'file_magic [regex]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given egrep regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
+
 echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
 case "$host_os" in
 aix3*)
@@ -1809,7 +951,6 @@
   # and later linker supports .so
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a'
   shlibpath_var=LIBPATH
-  deplibs_check_method=pass_all
   ;;
 
 amigaos*)
@@ -1822,7 +963,6 @@
   library_names_spec='${libname}.so'
   dynamic_linker="$host_os ld.so"
   shlibpath_var=LIBRARY_PATH
-  deplibs_check_method=pass_all
   lt_cv_dlopen="load_add_on"
   lt_cv_dlopen_libs=
   lt_cv_dlopen_self=yes
@@ -1835,9 +975,6 @@
   soname_spec='${libname}${release}.so$major'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
   shlibpath_var=LD_LIBRARY_PATH
-  deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
-  file_magic_cmd=/usr/bin/file
-  file_magic_test_file=/shlib/libc.so
   sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
   sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
   export_dynamic_flag_spec=-rdynamic
@@ -1846,18 +983,16 @@
   # libtool to hard-code these into programs
   ;;
 
-cygwin* | mingw*)
+cygwin* | mingw* | pw32*)
   version_type=windows
   need_version=no
   need_lib_prefix=no
   if test "$with_gcc" = yes; then
-    library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a'
+    library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
   else
     library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
   fi
   dynamic_linker='Win32 ld.exe'
-  deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
-  file_magic_cmd='${OBJDUMP} -f'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   lt_cv_dlopen="LoadLibrary"
@@ -1867,32 +1002,29 @@
 freebsd1*)
   dynamic_linker=no
   ;;
-  
+
 freebsd*)
   objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
   version_type=freebsd-$objformat
   case "$version_type" in
     freebsd-elf*)
-      deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
-      file_magic_cmd=/usr/bin/file
-      file_magic_test_file=`echo /usr/lib/libc.so*`
       library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
       need_version=no
       need_lib_prefix=no
       ;;
     freebsd-*)
-      deplibs_check_method=unknown
       library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
       need_version=yes
       ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case "$host_os" in
-  freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*)
+  freebsd2*)
     shlibpath_overrides_runpath=yes
     ;;
-  *) # from 3.2 on
+  *)
     shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
     ;;
   esac
   ;;
@@ -1904,6 +1036,7 @@
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
   soname_spec='${libname}${release}.so$major'
   shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
   ;;
 
 hpux9* | hpux10* | hpux11*)
@@ -1925,13 +1058,11 @@
   version_type=irix
   need_lib_prefix=no
   need_version=no
-  soname_spec='${libname}${release}.so.$major'
-  library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so'
+  soname_spec='${libname}${release}.so$major'
+  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
   case "$host_os" in
   irix5*)
     libsuff= shlibsuff=
-    # this will be overridden with pass_all, but let us keep it just in case
-    deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
     ;;
   *)
     case "$LD" in # libtool.m4 will add one of these switches to LD
@@ -1946,9 +1077,6 @@
   shlibpath_overrides_runpath=no
   sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
   sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-  file_magic_cmd=/usr/bin/file
-  file_magic_test_file=`echo /lib${libsuff}/libc.so*`
-  deplibs_check_method='pass_all'
   ;;
 
 # No shared lib support for Linux oldld, aout, or coff.
@@ -1966,19 +1094,18 @@
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
-  deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
-  file_magic_cmd=/usr/bin/file
-  file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
 
-  if test -f /lib/ld.so.1; then
-    dynamic_linker='GNU ld.so'
-  else
-    # Only the GNU ld.so supports shared libraries on MkLinux.
-    case "$host_cpu" in
-    powerpc*) dynamic_linker=no ;;
-    *) dynamic_linker='Linux ld.so' ;;
-    esac
-  fi
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
   ;;
 
 netbsd*)
@@ -1993,6 +1120,8 @@
     dynamic_linker='NetBSD ld.elf_so'
   fi
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
   ;;
 
 openbsd*)
@@ -2020,11 +1149,6 @@
   soname_spec='${libname}${release}.so'
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
   shlibpath_var=LD_LIBRARY_PATH
-  # this will be overridden with pass_all, but let us keep it just in case
-  deplibs_check_method='file_magic COFF format alpha shared library'
-  file_magic_cmd=/usr/bin/file
-  file_magic_test_file=/shlib/libc.so
-  deplibs_check_method='pass_all'
   sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
   sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
   ;;
@@ -2044,11 +1168,9 @@
   soname_spec='${libname}${release}.so$major'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
   # ldd complains unless libraries are executable
   postinstall_cmds='chmod +x $lib'
-  deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib"
-  file_magic_cmd=/usr/bin/file
-  file_magic_test_file=/lib/libc.so
   ;;
 
 sunos4*)
@@ -2069,17 +1191,11 @@
   soname_spec='${libname}${release}.so$major'
   shlibpath_var=LD_LIBRARY_PATH
   case "$host_vendor" in
-    ncr)
-      deplibs_check_method='pass_all'
-      ;;
     motorola)
       need_lib_prefix=no
       need_version=no
       shlibpath_overrides_runpath=no
       sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
-      deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
-      file_magic_cmd=/usr/bin/file
-      file_magic_test_file=`echo /usr/lib/libc.so*`
       ;;
   esac
   ;;
@@ -2116,13 +1232,182 @@
 echo "$ac_t$dynamic_linker" 1>&6
 test "$dynamic_linker" = no && can_build_shared=no
 
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+
+# Define system-specific variables.
+case "$host_os" in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
+  ;;
+irix*)
+  symcode='[BCDEGRST]'
+  ;;
+solaris* | sysv5*)
+  symcode='[BDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# Handle CRLF in mingw too chain
+opt_cr=
+case "$host_os" in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+  symcode='[ABCDGISTW]'
+fi
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Write the raw and C identifiers.
+global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode\)[ 	][ 	]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+  $rm conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  echo "$progname:1309: checking if global_symbol_pipe works" >&5
+  if { (eval echo $progname:1310: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { echo "$progname:1313: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
+
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+	if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+	  # Now generate the symbol file.
+	  eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
+
+	  cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+	  sed 's/^. \(.*\) \(.*\)$/  {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.$ac_ext
+	  cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+	  # Now try linking the two files.
+	  mv conftest.$objext conftstm.$objext
+	  save_LIBS="$LIBS"
+	  save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$objext"
+	  CFLAGS="$CFLAGS$no_builtin_flag"
+	  if { (eval echo $progname:1365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+	    pipe_works=yes
+	  else
+	    echo "$progname: failed program was:" >&5
+	    cat conftest.$ac_ext >&5
+	  fi
+	  LIBS="$save_LIBS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  $rm conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    global_symbol_pipe=
+  fi
+done
+if test "$pipe_works" = yes; then
+  echo "${ac_t}ok" 1>&6
+else
+  echo "${ac_t}failed" 1>&6
+fi
+
+if test -z "$global_symbol_pipe"; then
+  global_symbol_to_cdecl=
+fi
+
 # Report the final consequences.
 echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
 
 # Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in
 # configure.in, otherwise build static only libraries.
 case "$host_os" in
-cygwin* | mingw* | os2*)
+cygwin* | mingw* | pw32* | os2*)
   if test x$can_build_shared = xyes; then
     test x$enable_win32_dll = xno && can_build_shared=no
     echo "checking if package supports dlls... $can_build_shared" 1>&6
@@ -2130,30 +1415,6 @@
 ;;
 esac
 
-if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then
-  case "$deplibs_check_method" in
-  "file_magic "*)
-    file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
-    if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
-       egrep "$file_magic_regex" > /dev/null; then
-      :
-    else
-      cat <<EOF 1>&2
-
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such.  This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem.  Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool@gnu.org
-
-EOF
-    fi ;;
-  esac
-fi
-
 echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
 test "$can_build_shared" = "no" && enable_shared=no
 
@@ -2189,35 +1450,30 @@
   enable_fast_install=needless
 fi
 
-echo $ac_n "checking for objdir... $ac_c" 1>&6
-rm -f .libs 2>/dev/null
-mkdir .libs 2>/dev/null
-if test -d .libs; then
-  objdir=.libs
-else
-  # MS-DOS does not allow filenames that begin with a dot.
-  objdir=_libs
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$with_gcc" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
-rmdir .libs 2>/dev/null
-echo "$ac_t$objdir" 1>&6
+
+# Check whether we must set pic_mode to default
+test -z "$pic_flag" && pic_mode=default
 
 if test "x$enable_dlopen" != xyes; then
   enable_dlopen=unknown
   enable_dlopen_self=unknown
   enable_dlopen_self_static=unknown
 else
-if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then
+if test "X${lt_cv_dlopen+set}" != Xset; then
   lt_cv_dlopen=no lt_cv_dlopen_libs=
 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "$progname:2212: 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 "$progname:1469: checking for dlopen in -ldl" >&5
+if test "X${ac_cv_lib_dl_dlopen+set}" = Xset; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2220 "ltconfig"
+#line 1476 "ltconfig"
 /* 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.  */
@@ -2230,31 +1486,31 @@
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo $progname:2233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo $progname:1489: \"$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"
+  ac_cv_lib_dl_dlopen=yes
 else
   echo "$progname: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  ac_cv_lib_dl_dlopen=no
 fi
 rm -f conftest*
 LIBS="$ac_save_LIBS"
 
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+if test "X$ac_cv_lib_dl_dlopen" = Xyes; then
   echo "$ac_t""yes" 1>&6
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "$progname:2252: checking for dlopen" >&5
-if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
+echo "$progname:1508: checking for dlopen" >&5
+if test "X${ac_cv_func_dlopen+set}" = Xset; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2257 "ltconfig"
+#line 1513 "ltconfig"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dlopen(); below.  */
 #include <assert.h>
@@ -2279,32 +1535,70 @@
 
 ; return 0; }
 EOF
-if { (eval echo $progname:2282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo $progname:1538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_dlopen=yes"
+  ac_cv_func_dlopen=yes
 else
   echo "$progname: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_dlopen=no"
+  ac_cv_func_dlopen=no
 fi
 rm -f conftest*
 fi
-if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
+if test "X$ac_cv_func_dlopen" = Xyes; then
   echo "$ac_t""yes" 1>&6
   lt_cv_dlopen="dlopen"
 else
   echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6
+echo "$progname:1555: checking for dlopen in -lsvld" >&5
+if test "X${ac_cv_lib_svld_dlopen+set}" = Xset; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsvld  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1562 "ltconfig"
+/* 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.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo $progname:1575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_lib_svld_dlopen=yes
+else
+  echo "$progname: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_lib_svld_dlopen=no
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if test "X$ac_cv_lib_svld_dlopen" = Xyes; then
+  echo "$ac_t""yes" 1>&6
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  echo "$ac_t""no" 1>&6
 echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
-echo "$progname:2299: checking for dld_link in -ldld" >&5
-ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+echo "$progname:1594: checking for dld_link in -ldld" >&5
+if test "X${ac_cv_lib_dld_dld_link+set}" = Xset; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-ldld  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2307 "ltconfig"
+#line 1601 "ltconfig"
 /* 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.  */
@@ -2317,31 +1611,31 @@
 dld_link()
 ; return 0; }
 EOF
-if { (eval echo $progname:2320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo $progname:1614: \"$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"
+  ac_cv_lib_dld_dld_link=yes
 else
   echo "$progname: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  ac_cv_lib_dld_dld_link=no
 fi
 rm -f conftest*
 LIBS="$ac_save_LIBS"
 
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+if test "X$ac_cv_lib_dld_dld_link" = Xyes; then
   echo "$ac_t""yes" 1>&6
   lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for shl_load""... $ac_c" 1>&6
-echo "$progname:2339: checking for shl_load" >&5
-if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
+echo "$progname:1633: checking for shl_load" >&5
+if test "X${ac_cv_func_shl_load+set}" = Xset; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2344 "ltconfig"
+#line 1638 "ltconfig"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shl_load(); below.  */
 #include <assert.h>
@@ -2366,33 +1660,32 @@
 
 ; return 0; }
 EOF
-if { (eval echo $progname:2369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo $progname:1663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_shl_load=yes"
+  ac_cv_func_shl_load=yes
 else
   echo "$progname: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_shl_load=no"
+  ac_cv_func_shl_load=no
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then
+if test "X$ac_cv_func_shl_load" = Xyes; then
   echo "$ac_t""yes" 1>&6
   lt_cv_dlopen="shl_load"
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "$progname:2387: checking for shl_load in -ldld" >&5
-ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+echo "$progname:1681: checking for shl_load in -ldld" >&5
+if test "X${ac_cv_lib_dld_shl_load+set}" = Xset; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-ldld  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2395 "ltconfig"
+#line 1688 "ltconfig"
 #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
@@ -2406,20 +1699,20 @@
 shl_load()
 ; return 0; }
 EOF
-if { (eval echo $progname:2409: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo $progname:1702: \"$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"
+  ac_cv_lib_dld_shl_load=yes
 else
   echo "$progname: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  ac_cv_lib_dld_shl_load=no
 fi
 rm -f conftest*
 LIBS="$ac_save_LIBS"
 
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+if test "X$ac_cv_lib_dld_shl_load" = Xyes; then
   echo "$ac_t""yes" 1>&6
   lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
 else
@@ -2429,10 +1722,10 @@
 
 fi
 
-    
+
 fi
 
-  
+
 fi
 
 
@@ -2440,8 +1733,12 @@
 
 fi
 
+fi
+
   if test "x$lt_cv_dlopen" != xno; then
     enable_dlopen=yes
+  else
+    enable_dlopen=no
   fi
 
   case "$lt_cv_dlopen" in
@@ -2449,17 +1746,18 @@
 for ac_hdr in dlfcn.h; do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "$progname:2452: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "$progname:1749: checking for $ac_hdr" >&5
+if eval "test \"`echo 'X$''{'ac_cv_header_$ac_safe'+set}'`\" = Xset"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2457 "ltconfig"
+#line 1754 "ltconfig"
 #include <$ac_hdr>
 int fnord = 0;
+int main () { return(0); }
 EOF
 ac_try="$ac_compile >/dev/null 2>conftest.out"
-{ (eval echo $progname:2462: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo $progname:1760: \"$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*
@@ -2487,15 +1785,15 @@
     LIBS="$lt_cv_dlopen_libs $LIBS"
 
   echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
-echo "$progname:2490: checking whether a program can dlopen itself" >&5
-if test "${lt_cv_dlopen_self+set}" = set; then
+echo "$progname:1788: checking whether a program can dlopen itself" >&5
+if test "X${lt_cv_dlopen_self+set}" = Xset; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
     lt_cv_dlopen_self=cross
   else
-    cat > conftest.c <<EOF
-#line 2498 "ltconfig"
+    cat > conftest.$ac_ext <<EOF
+#line 1796 "ltconfig"
 
 #if HAVE_DLFCN_H
 #include <dlfcn.h>
@@ -2538,10 +1836,10 @@
 fnord() { int i=42;}
 main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
     if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
-	       if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } 
+               if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
 
 EOF
-if { (eval echo $progname:2544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo $progname:1842: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   lt_cv_dlopen_self=yes
 else
@@ -2560,15 +1858,15 @@
   if test "$lt_cv_dlopen_self" = yes; then
     LDFLAGS="$LDFLAGS $link_static_flag"
   echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
-echo "$progname:2563: checking whether a statically linked program can dlopen itself" >&5
-if test "${lt_cv_dlopen_self_static+set}" = set; then
+echo "$progname:1861: checking whether a statically linked program can dlopen itself" >&5
+if test "X${lt_cv_dlopen_self_static+set}" = Xset; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
     lt_cv_dlopen_self_static=cross
   else
-    cat > conftest.c <<EOF
-#line 2571 "ltconfig"
+    cat > conftest.$ac_ext <<EOF
+#line 1869 "ltconfig"
 
 #if HAVE_DLFCN_H
 #include <dlfcn.h>
@@ -2611,10 +1909,10 @@
 fnord() { int i=42;}
 main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
     if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
-    if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } 
+    if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
 
 EOF
-if { (eval echo $progname:2617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo $progname:1915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   lt_cv_dlopen_self_static=yes
 else
@@ -2658,33 +1956,40 @@
 case "$ltmain" in
 *.sh)
   # Now quote all the things that may contain metacharacters.
-  for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \
-    old_LD old_LDFLAGS old_LIBS \
-    old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \
-    AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \
+  for var in ltecho old_AR old_AR_FLAGS old_CC old_LTCC old_CFLAGS old_CPPFLAGS \
+    old_MAGIC_CMD old_LD old_LDFLAGS old_LIBS \
+    old_LN_S old_NM old_RANLIB old_STRIP \
+    old_AS old_DLLTOOL old_OBJDUMP \
+    old_OBJEXT old_EXEEXT old_reload_flag \
+    old_deplibs_check_method old_file_magic_cmd \
+    AR AR_FLAGS CC LTCC LD LN_S NM LTSHELL LTCONFIG_VERSION \
     reload_flag reload_cmds wl \
     pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
     thread_safe_flag_spec whole_archive_flag_spec libname_spec \
     library_names_spec soname_spec \
     RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
-    old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \
-    file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \
+    old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
+    postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \
+    predep_objects postdep_objects predeps postdeps compiler_lib_search_path \
+    old_striplib striplib file_magic_cmd export_symbols_cmds \
+    deplibs_check_method allow_undefined_flag no_undefined_flag \
     finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
     hardcode_libdir_flag_spec hardcode_libdir_separator  \
     sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
-    compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+    compiler_c_o need_locks exclude_expsyms include_expsyms; do
 
     case "$var" in
     reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
     old_postinstall_cmds | old_postuninstall_cmds | \
     export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
+    extract_expsyms_cmds | old_archive_from_expsyms_cmds | \
     postinstall_cmds | postuninstall_cmds | \
     finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
       # Double-quote double-evaled strings.
-      eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ### testsuite: skip nested quoting test
       ;;
     *)
-      eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ### testsuite: skip nested quoting test
       ;;
     esac
   done
@@ -2695,17 +2000,18 @@
     ;;
   esac
 
-  trap "$rm \"$ofile\"; exit 1" 1 2 15
-  echo "creating $ofile"
-  $rm "$ofile"
-  cat <<EOF > "$ofile"
+  if test -z "$tagname"; then
+    trap "$rm \"$ofile\"; exit 1" 1 2 15
+    echo "creating $ofile"
+    $rm "$ofile"
+    cat <<EOF > "$ofile"
 #! $SHELL
 
 # `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
 # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
 # NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
 #
-# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Copyright (C) 1996-2000 Free Software Foundation, Inc.
 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 #
 # This program is free software; you can redistribute it and/or modify
@@ -2734,38 +2040,59 @@
 # if CDPATH is set.
 if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
 
+# The names of the tagged configurations supported by this script.
+available_tags=
+
 ### BEGIN LIBTOOL CONFIG
 EOF
+  else
+    echo "appending configuration tag \"$tagname\" to $ofile"
+    echo "### BEGIN LIBTOOL TAG CONFIG: $tagname" >> "$ofile"
+  fi
   cfgfile="$ofile"
   ;;
 
 *)
   # Double-quote the variables that need it (for aesthetics).
-  for var in old_CC old_CFLAGS old_CPPFLAGS \
-    old_LD old_LDFLAGS old_LIBS \
-    old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do
+  for var in old_AR old_AR_FLAGS old_CC old_LTCC old_CFLAGS old_CPPFLAGS \
+    old_MAGIC_CMD old_LD old_LDFLAGS old_LIBS \
+    old_LN_S old_NM old_RANLIB old_STRIP \
+    old_AS old_DLLTOOL old_OBJDUMP \
+    old_OBJEXT old_EXEEXT old_reload_flag \
+    old_deplibs_check_method old_file_magic_cmd; do
     eval "$var=\\\"\$var\\\""
   done
 
   # Just create a config file.
   cfgfile="$ofile.cfg"
-  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
-  echo "creating $cfgfile"
-  $rm "$cfgfile"
-  cat <<EOF > "$cfgfile"
+  if test -z "$tagname"; then
+    trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+    echo "creating $cfgfile"
+    $rm "$cfgfile"
+    cat <<EOF > "$cfgfile"
 # `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file.
 # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+
+### BEGIN LIBTOOL CONFIG
 EOF
+  else
+    echo "appending to $cfgfile"
+    echo "### BEGIN LIBTOOL TAG CONFIG: $tagname" >> "$ofile"
+  fi
   ;;
 esac
 
 cat <<EOF >> "$cfgfile"
 # Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
 #
-# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\
-# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\
-# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\
-# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\
+# AR=$old_AR AR_FLAGS=$old_AR_FLAGS LTCC=$old_LTCC CC=$old_CC \\
+# CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\
+# MAGIC_CMD=$old_MAGIC_CMD LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\
+# LN_S=$old_LN_S NM=$old_NM RANLIB=$old_RANLIB STRIP=$old_STRIP \\
+# AS=$old_AS DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP \\
+# objext=$old_OBJEXT exeext=$old_EXEEXT reload_flag=$old_reload_flag \\
+# deplibs_check_method=$old_deplibs_check_method \\
+# file_magic_cmd=$old_file_magic_cmd \\
 #   $0$ltconfig_args
 #
 # Compiler and other test output produced by $progname, useful for
@@ -2780,6 +2107,9 @@
 # Whether or not to build shared libraries.
 build_libtool_libs=$enable_shared
 
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$need_lc
+
 # Whether or not to build static libraries.
 build_old_libs=$enable_static
 
@@ -2795,10 +2125,17 @@
 
 # The archiver.
 AR=$AR
+AR_FLAGS=$AR_FLAGS
 
-# The default C compiler.
+# A C compiler.
+LTCC=$LTCC
+
+# A language-specific compiler.
 CC=$CC
 
+# Is the compiler the GNU C compiler?
+with_gcc=$with_gcc
+
 # The linker used to build libraries.
 LD=$LD
 
@@ -2808,6 +2145,12 @@
 # A BSD-compatible nm program.
 NM=$NM
 
+# A symbol stripping program
+STRIP=$STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
 # Used on cygwin: DLL creation program.
 DLLTOOL="$DLLTOOL"
 
@@ -2838,13 +2181,11 @@
 
 # Additional compiler flags for building library objects.
 pic_flag=$pic_flag
+pic_mode=$pic_mode
 
 # Does compiler simultaneously support -c and -o options?
 compiler_c_o=$compiler_c_o
 
-# Can we write directly to a .lo ?
-compiler_o_lo=$compiler_o_lo
-
 # Must we lock files when doing compilation ?
 need_locks=$need_locks
 
@@ -2855,7 +2196,7 @@
 need_version=$need_version
 
 # Whether dlopen is supported.
-dlopen=$enable_dlopen
+dlopen_support=$enable_dlopen
 
 # Whether dlopen of programs is supported.
 dlopen_self=$enable_dlopen_self
@@ -2900,12 +2241,39 @@
 # Create an old-style archive from a shared archive.
 old_archive_from_new_cmds=$old_archive_from_new_cmds
 
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$old_archive_from_expsyms_cmds
+
 # Commands used to build and install a shared archive.
 archive_cmds=$archive_cmds
 archive_expsym_cmds=$archive_expsym_cmds
 postinstall_cmds=$postinstall_cmds
 postuninstall_cmds=$postuninstall_cmds
 
+# Commands to strip libraries.
+old_striplib=$old_striplib
+striplib=$striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$predep_objects
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$postdep_objects
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$predeps
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$compiler_lib_search_path
+
 # Method to check whether dependent libraries are shared objects.
 deplibs_check_method=$deplibs_check_method
 
@@ -2942,6 +2310,9 @@
 # How to hardcode a shared library path into an executable.
 hardcode_action=$hardcode_action
 
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
 # Flag to hardcode \$libdir into a binary during linking.
 # This must work even if \$libdir does not exist.
 hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec
@@ -2961,6 +2332,13 @@
 # the resulting binary.
 hardcode_shlibpath_var=$hardcode_shlibpath_var
 
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
 # Compile-time system search path for libraries
 sys_lib_search_path_spec=$sys_lib_search_path_spec
 
@@ -2976,6 +2354,9 @@
 # The commands to list exported symbols.
 export_symbols_cmds=$export_symbols_cmds
 
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$extract_expsyms_cmds
+
 # Symbols that should not be listed in the preloaded symbols.
 exclude_expsyms=$exclude_expsyms
 
@@ -2984,13 +2365,19 @@
 
 EOF
 
+if test -z "$tagname"; then
+  echo '### END LIBTOOL CONFIG' >> "$ofile"
+else
+  echo "### END LIBTOOL TAG CONFIG: $tagname" >> "$ofile"
+fi
+
 case "$ltmain" in
 *.sh)
-  echo '### END LIBTOOL CONFIG' >> "$ofile"
   echo >> "$ofile"
-  case "$host_os" in
-  aix3*)
-    cat <<\EOF >> "$ofile"
+  if test -z "$tagname"; then
+    case "$host_os" in
+    aix3*)
+      cat <<\EOF >> "$ofile"
 
 # AIX sometimes has problems with the GCC collect2 program.  For some
 # reason, if we set the COLLECT_NAMES environment variable, the problems
@@ -3000,17 +2387,198 @@
   export COLLECT_NAMES
 fi
 EOF
+      ;;
+    esac
+    case "$host" in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+      cat <<'EOF' >> "$ofile"
+      # This is a source program that is used to create dlls on Windows
+      # Don't remove nor modify the starting and closing comments
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+      # This is a source program that is used to create import libraries
+      # on Windows for dlls which lack them. Don't remove nor modify the
+      # starting and closing comments
+# /* impgen.c starts here */
+# /*   Copyright (C) 1999-2000 Free Software Foundation, Inc.
+#
+#  This file is part of GNU libtool.
+#
+#  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 <stdio.h>		/* for printf() */
+#  #include <unistd.h>		/* for open(), lseek(), read() */
+#  #include <fcntl.h>		/* for O_RDONLY, O_BINARY */
+#  #include <string.h>		/* for strdup() */
+#
+#  /* O_BINARY isn't required (or even defined sometimes) under Unix */
+#  #ifndef O_BINARY
+#  #define O_BINARY 0
+#  #endif
+#
+#  static unsigned int
+#  pe_get16 (fd, offset)
+#       int fd;
+#       int offset;
+#  {
+#    unsigned char b[2];
+#    lseek (fd, offset, SEEK_SET);
+#    read (fd, b, 2);
+#    return b[0] + (b[1]<<8);
+#  }
+#
+#  static unsigned int
+#  pe_get32 (fd, offset)
+#      int fd;
+#      int offset;
+#  {
+#    unsigned char b[4];
+#    lseek (fd, offset, SEEK_SET);
+#    read (fd, b, 4);
+#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+#  }
+#
+#  static unsigned int
+#  pe_as32 (ptr)
+#       void *ptr;
+#  {
+#    unsigned char *b = ptr;
+#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+#  }
+#
+#  int
+#  main (argc, argv)
+#      int argc;
+#      char *argv[];
+#  {
+#      int dll;
+#      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+#      unsigned long export_rva, export_size, nsections, secptr, expptr;
+#      unsigned long name_rvas, nexp;
+#      unsigned char *expdata, *erva;
+#      char *filename, *dll_name;
+#
+#      filename = argv[1];
+#
+#      dll = open(filename, O_RDONLY|O_BINARY);
+#      if (!dll)
+#  	return 1;
+#
+#      dll_name = filename;
+#
+#      for (i=0; filename[i]; i++)
+#  	if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
+#  	    dll_name = filename + i +1;
+#
+#      pe_header_offset = pe_get32 (dll, 0x3c);
+#      opthdr_ofs = pe_header_offset + 4 + 20;
+#      num_entries = pe_get32 (dll, opthdr_ofs + 92);
+#
+#      if (num_entries < 1) /* no exports */
+#  	return 1;
+#
+#      export_rva = pe_get32 (dll, opthdr_ofs + 96);
+#      export_size = pe_get32 (dll, opthdr_ofs + 100);
+#      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
+#      secptr = (pe_header_offset + 4 + 20 +
+#  	      pe_get16 (dll, pe_header_offset + 4 + 16));
+#
+#      expptr = 0;
+#      for (i = 0; i < nsections; i++)
+#      {
+#  	char sname[8];
+#  	unsigned long secptr1 = secptr + 40 * i;
+#  	unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+#  	unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+#  	unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+#  	lseek(dll, secptr1, SEEK_SET);
+#  	read(dll, sname, 8);
+#  	if (vaddr <= export_rva && vaddr+vsize > export_rva)
+#  	{
+#  	    expptr = fptr + (export_rva - vaddr);
+#  	    if (export_rva + export_size > vaddr + vsize)
+#  		export_size = vsize - (export_rva - vaddr);
+#  	    break;
+#  	}
+#      }
+#
+#      expdata = (unsigned char*)malloc(export_size);
+#      lseek (dll, expptr, SEEK_SET);
+#      read (dll, expdata, export_size);
+#      erva = expdata - export_rva;
+#
+#      nexp = pe_as32 (expdata+24);
+#      name_rvas = pe_as32 (expdata+32);
+#
+#      printf ("EXPORTS\n");
+#      for (i = 0; i<nexp; i++)
+#      {
+#  	unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+#  	printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
+#      }
+#
+#      return 0;
+#  }
+# /* impgen.c ends here */
+
+EOF
     ;;
   esac
 
-  # Append the ltmain.sh script.
-  sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1)
-  # We use sed instead of cat because bash on DJGPP gets confused if
-  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
-  # text mode, it properly converts lines to CR/LF.  This bash problem
-  # is reportedly fixed, but why not run on old versions too?
 
-  chmod +x "$ofile"
+    # Append the ltmain.sh script.
+    sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1)
+    # We use sed instead of cat because bash on DJGPP gets confused if
+    # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+    # text mode, it properly converts lines to CR/LF.  This bash problem
+    # is reportedly fixed, but why not run on old versions too?
+
+    chmod +x "$ofile"
+  fi
   ;;
 
 *)
@@ -3019,7 +2587,29 @@
   ;;
 esac
 
-test -n "$cache_file" || exit 0
+# Update the list of available tags.
+if test -n "$tagname"; then
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" $ofile | sed -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  # Append the new tag name to the list of available tags.
+  available_tags="$available_tags $tagname"
+
+  # Now substitute the updated of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' ${ofile} > ${ofile}.new"; then
+    mv ${ofile}.new ${ofile}
+    chmod +x "$ofile"
+  else
+    rm -f ${ofile}.new
+    echo "$progname: unable to update list of available tagged configurations."
+    exit 1
+  fi
+fi
+
+# Don't cache tagged configuration!
+test -n "$cache_file" && test -z "$tagname" || exit 0
 
 # AC_CACHE_SAVE
 trap '' 1 2 15
diff --git a/ltmain.sh b/ltmain.sh
index a171502..554c82a 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -1,7 +1,7 @@
 # ltmain.sh - Provide generalized library-building support services.
 # NOTE: Changing this file will not affect anything until you rerun ltconfig.
 #
-# Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc.
+# Copyright (C) 1996-2000 Free Software Foundation, Inc.
 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 #
 # This program is free software; you can redistribute it and/or modify
@@ -54,8 +54,8 @@
 # Constants.
 PROGRAM=ltmain.sh
 PACKAGE=libtool
-VERSION=1.3.4
-TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
+VERSION=1.4a
+TIMESTAMP=" (1.641.2.122 2000/09/30 05:27:52)"
 
 default_mode=
 help="Try \`$progname --help' for more information."
@@ -124,6 +124,25 @@
     execute_dlfiles)
       eval "$prev=\"\$$prev \$arg\""
       ;;
+    tag)
+      tagname="$arg"
+
+      # Check whether tagname contains only valid characters
+      case "$tagname" in
+      *[!-_A-Za-z0-9,/]*)
+	echo "$progname: invalid tag name: $tagname" 1>&2
+	exit 1
+        ;;
+      esac
+
+      if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
+        taglist="$taglist $tagname"
+	# Evaluate the configuration.
+	eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
+      else
+	echo "$progname: ignoring unknown tag $tagname" 1>&2
+      fi
+      ;;
     *)
       eval "$prev=\$arg"
       ;;
@@ -146,7 +165,11 @@
     ;;
 
   --config)
-    sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
+    sed -n -e '/^### BEGIN LIBTOOL CONFIG/,/^### END LIBTOOL CONFIG/p' < "$0"
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      sed -n -e "/^### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
+    done
     exit 0
     ;;
 
@@ -183,6 +206,13 @@
     show=:
     ;;
 
+  --tag) prevopt="--tag" prev=tag ;;
+  --tag=*)
+    set tag "$optarg" ${1+"$@"}
+    shift
+    prev=tag
+    ;;
+
   -dlopen)
     prevopt="-dlopen"
     prev=execute_dlfiles
@@ -267,6 +297,7 @@
     modename="$modename: compile"
     # Get the compilation command and the source file.
     base_compile=
+    prev=
     lastarg=
     srcfile="$nonopt"
     suppress_output=
@@ -274,6 +305,32 @@
     user_target=no
     for arg
     do
+      case "$prev" in
+      "") ;;
+      xcompiler)
+	# Aesthetically quote the previous argument.
+	prev=
+	lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+
+	case "$arg" in
+	# Double-quote args containing other shell metacharacters.
+	# Many Bourne shells cannot handle close brackets correctly
+	# in scan sets, so we specify it separately.
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	  arg="\"$arg\""
+	  ;;
+	esac
+
+	# Add the previous argument to base_compile.
+	if test -z "$base_compile"; then
+	  base_compile="$lastarg"
+	else
+	  base_compile="$base_compile $lastarg"
+	fi
+	continue
+	;;
+      esac
+
       # Accept any command-line options.
       case "$arg" in
       -o)
@@ -288,6 +345,50 @@
 	build_old_libs=yes
 	continue
 	;;
+
+      -prefer-pic)
+	pic_mode=yes
+	continue
+	;;
+
+      -prefer-non-pic)
+	pic_mode=no
+	continue
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Wc,*)
+	args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+	lastarg=
+	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=','
+	for arg in $args; do
+	  IFS="$save_ifs"
+
+	  # Double-quote args containing other shell metacharacters.
+	  # Many Bourne shells cannot handle close brackets correctly
+	  # in scan sets, so we specify it separately.
+	  case "$arg" in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    arg="\"$arg\""
+	    ;;
+	  esac
+	  lastarg="$lastarg $arg"
+	done
+	IFS="$save_ifs"
+	lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+	# Add the arguments to base_compile.
+	if test -z "$base_compile"; then
+	  base_compile="$lastarg"
+	else
+	  base_compile="$base_compile $lastarg"
+	fi
+	continue
+	;;
       esac
 
       case "$user_target" in
@@ -316,10 +417,10 @@
       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
 
       # Double-quote args containing other shell metacharacters.
-      # Many Bourne shells cannot handle close brackets correctly in scan
-      # sets, so we specify it separately.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
       case "$lastarg" in
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
 	lastarg="\"$lastarg\""
 	;;
       esac
@@ -355,10 +456,12 @@
     *.asm) xform=asm ;;
     *.c++) xform=c++ ;;
     *.cc) xform=cc ;;
+    *.class) xform=class ;;
     *.cpp) xform=cpp ;;
     *.cxx) xform=cxx ;;
     *.f90) xform=f90 ;;
     *.for) xform=for ;;
+    *.java) xform=java ;;
     esac
 
     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
@@ -371,6 +474,59 @@
       ;;
     esac
 
+    # Infer tagged configuration to use if any are available and
+    # if one wasn't chosen via the "--tag" command line option.
+    # Only attempt this if the compiler in the base compile
+    # command doesn't match the default compiler.
+    if test -n "$available_tags" && test -z "$tagname"; then
+      case $base_compile in
+      "$CC "*) ;;
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when ltconfig was run.
+      "`$echo $CC` "*) ;;
+      *)
+        for z in $available_tags; do
+          if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
+            case $base_compile in
+	    "$CC "*)
+              # The compiler in the base compile command matches
+              # the one in the tagged configuration.
+              # Assume this is the tagged configuration we want.
+              tagname=$z
+              break
+              ;;
+	    "`$echo $CC` "*)
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+          fi
+        done
+        # If $tagname still isn't set, then no tagged configuration
+        # was found and let the user know that the "--tag" command
+        # line option must be used.
+        if test -z "$tagname"; then
+          echo "$modename: unable to infer tagged configuration"
+          echo "$modename: specify a tag with \`--tag'" 1>&2
+	  exit 1
+#        else
+#          echo "$modename: using $tagname tagged configuration"
+        fi
+	;;
+      esac
+    fi
+
+    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$xdir" = "X$obj"; then
+      xdir=
+    else
+      xdir=$xdir/
+    fi
+    lobj=${xdir}$objdir/$objname
+
     if test -z "$base_compile"; then
       $echo "$modename: you must specify a compilation command" 1>&2
       $echo "$help" 1>&2
@@ -379,22 +535,34 @@
 
     # Delete any leftover library objects.
     if test "$build_old_libs" = yes; then
-      removelist="$obj $libobj"
+      removelist="$obj $lobj $libobj ${libobj}T"
     else
-      removelist="$libobj"
+      removelist="$lobj $libobj ${libobj}T"
     fi
 
     $run $rm $removelist
     trap "$run $rm $removelist; exit 1" 1 2 15
 
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case "$host_os" in
+    cygwin* | mingw* | pw32* | os2*)
+      pic_mode=default
+      ;;
+    esac
+    if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
     # Calculate the filename of the output object if compiler does
     # not support -o with -c
     if test "$compiler_c_o" = no; then
-      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
+      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
       lockfile="$output_obj.lock"
       removelist="$removelist $output_obj $lockfile"
       trap "$run $rm $removelist; exit 1" 1 2 15
     else
+      output_obj=
       need_locks=no
       lockfile=
     fi
@@ -402,7 +570,7 @@
     # Lock this critical section if it is needed
     # We use this script file to make the link, it avoids creating a new file
     if test "$need_locks" = yes; then
-      until ln "$0" "$lockfile" 2>/dev/null; do
+      until $run ln "$0" "$lockfile" 2>/dev/null; do
 	$show "Waiting for $lockfile to be removed"
 	sleep 2
       done
@@ -429,50 +597,48 @@
       eval srcfile=\"$fix_srcfile_path\"
     fi
 
+    $run $rm "$libobj" "${libobj}T"
+
+    # Create a libtool object file (analogous to a ".la" file),
+    # but don't create it if we're doing a dry run.
+    test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
     # Only build a PIC object if we are building libtool libraries.
     if test "$build_libtool_libs" = yes; then
       # Without this assignment, base_compile gets emptied.
       fbsd_hideous_sh_bug=$base_compile
 
-      # All platforms use -DPIC, to notify preprocessed assembler code.
-      # However, make sure we only set it for non-Java code.
-      case "$srcfile" in
-	*.java|*.class)
-	  command="$base_compile $pic_flag $srcfile";;
-	*)
-	  command="$base_compile $srcfile $pic_flag -DPIC";;
-      esac
-      if test "$build_old_libs" = yes; then
-	lo_libobj="$libobj"
-	dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
-	if test "X$dir" = "X$libobj"; then
-	  dir="$objdir"
-	else
-	  dir="$dir/$objdir"
-	fi
-	libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
-
-	if test -d "$dir"; then
-	  $show "$rm $libobj"
-	  $run $rm $libobj
-	else
-	  $show "$mkdir $dir"
-	  $run $mkdir $dir
-	  status=$?
-	  if test $status -ne 0 && test ! -d $dir; then
-	    exit $status
-	  fi
-	fi
-      fi
-      if test "$compiler_o_lo" = yes; then
-	output_obj="$libobj"
-	command="$command -o $output_obj"
-      elif test "$compiler_c_o" = yes; then
-	output_obj="$obj"
-	command="$command -o $output_obj"
+      if test "$pic_mode" != no; then
+	command="$base_compile $srcfile $pic_flag"
+      else
+	# Don't build PIC code
+	command="$base_compile $srcfile"
       fi
 
-      $run $rm "$output_obj"
+      if test ! -d ${xdir}$objdir; then
+	$show "$mkdir ${xdir}$objdir"
+	$run $mkdir ${xdir}$objdir
+	status=$?
+	if test $status -ne 0 && test ! -d ${xdir}$objdir; then
+	  exit $status
+        fi
+      fi 
+
+      if test -z "$output_obj"; then
+        # Place PIC objects in $objdir
+        command="$command -o $lobj"
+      fi
+
+      $run $rm "$lobj" "$output_obj"
+
       $show "$command"
       if $run eval "$command"; then :
       else
@@ -501,9 +667,9 @@
       fi
 
       # Just move the object if needed, then go on to compile the next one
-      if test x"$output_obj" != x"$libobj"; then
-	$show "$mv $output_obj $libobj"
-	if $run $mv $output_obj $libobj; then :
+      if test -n "$output_obj" && test "x$output_obj" != "x$lobj"; then
+	$show "$mv $output_obj $lobj"
+	if $run $mv $output_obj $lobj; then :
 	else
 	  error=$?
 	  $run $rm $removelist
@@ -511,56 +677,38 @@
 	fi
       fi
 
-      # If we have no pic_flag, then copy the object into place and finish.
-      if test -z "$pic_flag" && test "$build_old_libs" = yes; then
-	# Rename the .lo from within objdir to obj
-	if test -f $obj; then
-	  $show $rm $obj
-	  $run $rm $obj
-	fi
+      # Append the name of the PIC object to the libtool object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
 
-	$show "$mv $libobj $obj"
-	if $run $mv $libobj $obj; then :
-	else
-	  error=$?
-	  $run $rm $removelist
-	  exit $error
-	fi
-
-	xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
-	if test "X$xdir" = "X$obj"; then
-	  xdir="."
-	else
-	  xdir="$xdir"
-	fi
-	baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
-	libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
-	# Now arrange that obj and lo_libobj become the same file
-	$show "(cd $xdir && $LN_S $baseobj $libobj)"
-	if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
-	  exit 0
-	else
-	  error=$?
-	  $run $rm $removelist
-	  exit $error
-	fi
-      fi
+EOF
 
       # Allow error messages only from the first compilation.
       suppress_output=' >/dev/null 2>&1'
+    else
+      # No PIC object so indicate it doesn't exist in the libtool
+      # object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
     fi
 
     # Only build a position-dependent object if we build old libraries.
     if test "$build_old_libs" = yes; then
-      command="$base_compile $srcfile"
+      if test "$pic_mode" != yes; then
+	# Don't build PIC code
+	command="$base_compile $srcfile"
+      else
+	command="$base_compile $srcfile $pic_flag"
+      fi
       if test "$compiler_c_o" = yes; then
 	command="$command -o $obj"
-	output_obj="$obj"
       fi
 
       # Suppress compiler output if we already did a PIC compilation.
       command="$command$suppress_output"
-      $run $rm "$output_obj"
+      $run $rm "$obj" "$output_obj"
       $show "$command"
       if $run eval "$command"; then :
       else
@@ -589,7 +737,7 @@
       fi
 
       # Just move the object if needed
-      if test x"$output_obj" != x"$obj"; then
+      if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then
 	$show "$mv $output_obj $obj"
 	if $run $mv $output_obj $obj; then :
 	else
@@ -599,50 +747,38 @@
 	fi
       fi
 
-      # Create an invalid libtool object if no PIC, so that we do not
-      # accidentally link it into a program.
-      if test "$build_libtool_libs" != yes; then
-	$show "echo timestamp > $libobj"
-	$run eval "echo timestamp > \$libobj" || exit $?
-      else
-	# Move the .lo from within objdir
-	$show "$mv $libobj $lo_libobj"
-	if $run $mv $libobj $lo_libobj; then :
-	else
-	  error=$?
-	  $run $rm $removelist
-	  exit $error
-	fi
-      fi
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+    else
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
     fi
 
+    $run $mv "${libobj}T" "${libobj}"
+
     # Unlock the critical section if it was locked
     if test "$need_locks" != no; then
-      $rm "$lockfile"
+      $run $rm "$lockfile"
     fi
 
     exit 0
     ;;
 
   # libtool link mode
-  link)
+  link | relink)
     modename="$modename: link"
-    C_compiler="$CC" # save it, to compile generated C sources
-    # Always respect the CC configured in by ltconfig.
-    CC="$nonopt"
-    # CYGNUS LOCAL: tromey/java
-    # Add -B options to link line.
-    for arg
-    do
-       case "$arg" in
-	-B*)
-	   CC="$CC $arg"
-	   ;;
-       esac
-    done
-    # END CYGNUS LOCAL
     case "$host" in
-    *-*-cygwin* | *-*-mingw* | *-*-os2*)
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
       # It is impossible to link a dll without this setting, and
       # we shouldn't force the makefile maintainer to figure out
       # which system we are compiling for in order to pass an extra
@@ -655,179 +791,13 @@
       # -no-undefined on the libtool link line when we can be certain
       # that all symbols are satisfied, otherwise we get a static library.
       allow_undefined=yes
-
-      # This is a source program that is used to create dlls on Windows
-      # Don't remove nor modify the starting and closing comments
-# /* ltdll.c starts here */
-# #define WIN32_LEAN_AND_MEAN
-# #include <windows.h>
-# #undef WIN32_LEAN_AND_MEAN
-# #include <stdio.h>
-#
-# #ifndef __CYGWIN__
-# #  ifdef __CYGWIN32__
-# #    define __CYGWIN__ __CYGWIN32__
-# #  endif
-# #endif
-#
-# #ifdef __cplusplus
-# extern "C" {
-# #endif
-# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
-# #ifdef __cplusplus
-# }
-# #endif
-#
-# #ifdef __CYGWIN__
-# #include <cygwin/cygwin_dll.h>
-# DECLARE_CYGWIN_DLL( DllMain );
-# #endif
-# HINSTANCE __hDllInstance_base;
-#
-# BOOL APIENTRY
-# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
-# {
-#   __hDllInstance_base = hInst;
-#   return TRUE;
-# }
-# /* ltdll.c ends here */
-      # This is a source program that is used to create import libraries
-      # on Windows for dlls which lack them. Don't remove nor modify the
-      # starting and closing comments
-# /* impgen.c starts here */
-# /*   Copyright (C) 1999 Free Software Foundation, Inc.
-# 
-#  This file is part of GNU libtool.
-# 
-#  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 <stdio.h>		/* for printf() */
-#  #include <unistd.h>		/* for open(), lseek(), read() */
-#  #include <fcntl.h>		/* for O_RDONLY, O_BINARY */
-#  #include <string.h>		/* for strdup() */
-# 
-#  static unsigned int
-#  pe_get16 (fd, offset)
-#       int fd;
-#       int offset;
-#  {
-#    unsigned char b[2];
-#    lseek (fd, offset, SEEK_SET);
-#    read (fd, b, 2);
-#    return b[0] + (b[1]<<8);
-#  }
-# 
-#  static unsigned int
-#  pe_get32 (fd, offset)
-#      int fd;
-#      int offset;
-#  {
-#    unsigned char b[4];
-#    lseek (fd, offset, SEEK_SET);
-#    read (fd, b, 4);
-#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
-#  }
-# 
-#  static unsigned int
-#  pe_as32 (ptr)
-#       void *ptr;
-#  {
-#    unsigned char *b = ptr;
-#    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
-#  }
-# 
-#  int
-#  main (argc, argv)
-#      int argc;
-#      char *argv[];
-#  {
-#      int dll;
-#      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
-#      unsigned long export_rva, export_size, nsections, secptr, expptr;
-#      unsigned long name_rvas, nexp;
-#      unsigned char *expdata, *erva;
-#      char *filename, *dll_name;
-# 
-#      filename = argv[1];
-# 
-#      dll = open(filename, O_RDONLY|O_BINARY);
-#      if (!dll)
-#  	return 1;
-# 
-#      dll_name = filename;
-#    
-#      for (i=0; filename[i]; i++)
-#  	if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
-#  	    dll_name = filename + i +1;
-# 
-#      pe_header_offset = pe_get32 (dll, 0x3c);
-#      opthdr_ofs = pe_header_offset + 4 + 20;
-#      num_entries = pe_get32 (dll, opthdr_ofs + 92);
-# 
-#      if (num_entries < 1) /* no exports */
-#  	return 1;
-# 
-#      export_rva = pe_get32 (dll, opthdr_ofs + 96);
-#      export_size = pe_get32 (dll, opthdr_ofs + 100);
-#      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
-#      secptr = (pe_header_offset + 4 + 20 +
-#  	      pe_get16 (dll, pe_header_offset + 4 + 16));
-# 
-#      expptr = 0;
-#      for (i = 0; i < nsections; i++)
-#      {
-#  	char sname[8];
-#  	unsigned long secptr1 = secptr + 40 * i;
-#  	unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
-#  	unsigned long vsize = pe_get32 (dll, secptr1 + 16);
-#  	unsigned long fptr = pe_get32 (dll, secptr1 + 20);
-#  	lseek(dll, secptr1, SEEK_SET);
-#  	read(dll, sname, 8);
-#  	if (vaddr <= export_rva && vaddr+vsize > export_rva)
-#  	{
-#  	    expptr = fptr + (export_rva - vaddr);
-#  	    if (export_rva + export_size > vaddr + vsize)
-#  		export_size = vsize - (export_rva - vaddr);
-#  	    break;
-#  	}
-#      }
-# 
-#      expdata = (unsigned char*)malloc(export_size);
-#      lseek (dll, expptr, SEEK_SET);
-#      read (dll, expdata, export_size);
-#      erva = expdata - export_rva;
-# 
-#      nexp = pe_as32 (expdata+24);
-#      name_rvas = pe_as32 (expdata+32);
-# 
-#      printf ("EXPORTS\n");
-#      for (i = 0; i<nexp; i++)
-#      {
-#  	unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
-#  	printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
-#      }
-# 
-#      return 0;
-#  }
-# /* impgen.c ends here */
       ;;
     *)
       allow_undefined=yes
       ;;
     esac
+    libtool_args="$nonopt"
+    base_compile="$nonopt"
     compile_command="$nonopt"
     finalize_command="$nonopt"
 
@@ -838,18 +808,12 @@
     convenience=
     old_convenience=
     deplibs=
-    linkopts=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
 
-    if test -n "$shlibpath_var"; then
-      # get the directories listed in $shlibpath_var
-      eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
-    else
-      lib_search_path=
-    fi
-    # now prepend the system-specific ones
-    eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
-    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
-    
     avoid_version=no
     dlfiles=
     dlprefiles=
@@ -859,10 +823,11 @@
     export_symbols_regex=
     generated=
     libobjs=
-    link_against_libtool_libs=
     ltlibs=
     module=no
+    no_install=no
     objs=
+    non_pic_objects=
     prefer_static_libs=no
     preload=no
     prev=
@@ -906,7 +871,15 @@
     # Go through the arguments, transforming them on the way.
     while test $# -gt 0; do
       arg="$1"
+      base_compile="$base_compile $arg"
       shift
+      case "$arg" in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+	;;
+      *) qarg=$arg ;;
+      esac
+      libtool_args="$libtool_args $qarg"
 
       # If the previous option needs an argument, assign it.
       if test -n "$prev"; then
@@ -954,6 +927,7 @@
 	      dlprefiles="$dlprefiles $arg"
 	    fi
 	    prev=
+	    continue
 	    ;;
 	  esac
 	  ;;
@@ -999,6 +973,21 @@
 	  prev=
 	  continue
 	  ;;
+	xcompiler)
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  compile_command="$compile_command $qarg"
+	  finalize_command="$finalize_command $qarg"
+	  continue
+	  ;;
+	xlinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $wl$qarg"
+	  prev=
+	  compile_command="$compile_command $wl$qarg"
+	  finalize_command="$finalize_command $wl$qarg"
+	  continue
+	  ;;
 	*)
 	  eval "$prev=\"\$arg\""
 	  prev=
@@ -1057,6 +1046,18 @@
 	continue
 	;;
 
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+	case $with_gcc/$host in
+	no/*-*-irix*)
+	  compile_command="$compile_command $arg"
+	  finalize_command="$finalize_command $arg"
+	  ;;
+	esac
+	continue
+	;;
+       
       -L*)
 	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
 	# We need an absolute path.
@@ -1065,50 +1066,48 @@
 	*)
 	  absdir=`cd "$dir" && pwd`
 	  if test -z "$absdir"; then
-	    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
-	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
-	    absdir="$dir"
+	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+	    exit 1
 	  fi
 	  dir="$absdir"
 	  ;;
 	esac
-	case " $deplibs " in
-	*" $arg "*) ;;
-	*) deplibs="$deplibs $arg";;
-	esac
-	case " $lib_search_path " in
-	*" $dir "*) ;;
-	*) lib_search_path="$lib_search_path $dir";;
+	case "$deplibs " in
+	*" -L$dir "*) ;;
+	*)
+	  deplibs="$deplibs -L$dir"
+	  lib_search_path="$lib_search_path $dir"
+	  ;;
 	esac
 	case "$host" in
-	*-*-cygwin* | *-*-mingw* | *-*-os2*)
-	  dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 	  case ":$dllsearchpath:" in
-	  ::) dllsearchpath="$dllsearchdir";;
-	  *":$dllsearchdir:"*) ;;
-	  *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
+	  *":$dir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$dir";;
 	  esac
 	  ;;
 	esac
+	continue
 	;;
 
       -l*)
 	if test "$arg" = "-lc"; then
 	  case "$host" in
-	  *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
 	    # These systems don't actually have c library (as such)
 	    continue
 	    ;;
 	  esac
 	elif test "$arg" = "-lm"; then
 	  case "$host" in
-	  *-*-cygwin* | *-*-beos*)
+	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
 	    # These systems don't actually have math library (as such)
 	    continue
 	    ;;
 	  esac
 	fi
 	deplibs="$deplibs $arg"
+	continue
 	;;
 
       -module)
@@ -1116,6 +1115,31 @@
 	continue
 	;;
 
+      -no-fast-install)
+	fast_install=no
+	continue
+	;;
+
+      -no-install)
+	case "$host" in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  # The PATH hackery in wrapper scripts is required on Windows
+	  # in order for the loader to find any dlls it needs.
+	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+	  fast_install=no
+	  ;;
+	*-*-rhapsody*)
+	  # rhapsody is a little odd...
+	  deplibs="$deplibs -framework System"
+	  ;;
+	*)
+	  no_install=yes
+	  ;;
+	esac
+	continue
+	;;
+
       -no-undefined)
 	allow_undefined=no
 	continue
@@ -1156,11 +1180,11 @@
 	;;
 
       -static)
-	# If we have no pic_flag, then this is the same as -all-static.
-	if test -z "$pic_flag" && test -n "$link_static_flag"; then
-	  compile_command="$compile_command $link_static_flag"
-	  finalize_command="$finalize_command $link_static_flag"
-	fi
+        # The effects of -static are defined in a previous loop.
+	# We used to do the same as -all-static on platforms that
+	# didn't have a PIC flag, but the assumption that the effects
+	# would be equivalent was wrong.  It would break on at least
+	# Digital Unix and AIX.
 	continue
 	;;
 
@@ -1174,334 +1198,184 @@
 	continue
 	;;
 
+      -Wc,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+	arg=
+	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case "$flag" in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Wl,*)
+	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+	arg=
+	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+	  case "$flag" in
+	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+	    flag="\"$flag\""
+	    ;;
+	  esac
+	  arg="$arg $wl$flag"
+	  compiler_flags="$compiler_flags $wl$flag"
+	  linker_flags="$linker_flags $flag"
+	done
+	IFS="$save_ifs"
+	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Xlinker)
+	prev=xlinker
+	continue
+	;;
+
       # Some other compiler flag.
       -* | +*)
 	# Unknown arguments in both finalize_command and compile_command need
 	# to be aesthetically quoted because they are evaled later.
 	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 	case "$arg" in
-	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
 	  arg="\"$arg\""
 	  ;;
 	esac
 	;;
 
-      *.o | *.obj | *.a | *.lib)
+      *.$objext)
 	# A standard object.
 	objs="$objs $arg"
 	;;
 
       *.lo)
-	# A library object.
-	if test "$prev" = dlfiles; then
-	  dlfiles="$dlfiles $arg"
-	  if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
-	    prev=
-	    continue
-	  else
-	    # If libtool objects are unsupported, then we need to preload.
-	    prev=dlprefiles
-	  fi
-	fi
+	# A libtool-controlled object.
 
-	if test "$prev" = dlprefiles; then
-	  # Preload the old-style object.
-	  dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
-	  prev=
+	# Check to see that this really is a libtool object.
+	if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+          pic_object=
+          non_pic_object=
+
+          # Read the .lo file
+          # If there is no directory component, then add one.
+          case "$arg" in
+          */* | *\\*) . $arg ;;
+          *) . ./$arg ;;
+          esac
+
+          if test -z "$pic_object" || \
+             test -z "$non_pic_object" ||
+             test "$pic_object" = none && \
+             test "$non_pic_object" = none; then
+            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+            exit 1
+          fi
+
+	  # Extract subdirectory from the argument.
+	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+	  if test "X$xdir" = "X$arg"; then
+	    xdir=
+	  else
+	    xdir="$xdir/"
+	  fi
+
+          if test "$pic_object" != none; then
+            # Prepend the subdirectory the object is found in.
+	    pic_object="$xdir$pic_object"
+
+	    if test "$prev" = dlfiles; then
+	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+	        dlfiles="$dlfiles $pic_object"
+	        prev=
+	        continue
+	      else
+	        # If libtool objects are unsupported, then we need to preload.
+	        prev=dlprefiles
+	      fi
+	    fi
+
+	    # CHECK ME:  I think I busted this.  -Ossama
+            if test "$prev" = dlprefiles; then
+	      # Preload the old-style object.
+	      dlprefiles="$dlprefiles $pic_object"
+	      prev=
+            fi
+
+            # A PIC object.
+	    libobjs="$libobjs $pic_object"
+	    arg="$pic_object"
+          fi
+
+          # Non-PIC object.
+          if test "$non_pic_object" != none; then
+            # Prepend the subdirectory the object is found in.
+	    non_pic_object="$xdir$non_pic_object"
+
+            # A standard non-PIC object
+            non_pic_objects="$non_pic_objects $non_pic_object"
+            if test -z "$pic_object" || test "$pic_object" = none ; then
+              arg="$non_pic_object"
+            fi
+          fi
+        else
+          # Only an error if not doing a dry-run.
+          if test -z "$run"; then
+            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+            exit 1
+          else
+            # Dry-run case.
+
+	    # Extract subdirectory from the argument.
+	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+	    if test "X$xdir" = "X$arg"; then
+	      xdir=
+	    else
+	      xdir="$xdir/"
+	    fi
+
+            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+	    libobjs="$libobjs $pic_object"
+            non_pic_objects="$non_pic_objects $non_pic_object"
+          fi
 	fi
-	libobjs="$libobjs $arg"
+	;;
+
+      *.$libext)
+	# An archive.
+	deplibs="$deplibs $arg"
+	old_deplibs="$old_deplibs $arg"
+	continue
 	;;
 
       *.la)
 	# A libtool-controlled library.
 
-	dlname=
-	libdir=
-	library_names=
-	old_library=
-
-	# Check to see that this really is a libtool archive.
-	if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
-	else
-	  $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
-	  exit 1
-	fi
-
-	# If the library was installed with an old release of libtool,
-	# it will not redefine variable installed.
-	installed=yes
-
-	# Read the .la file
-	# If there is no directory component, then add one.
-	case "$arg" in
-	*/* | *\\*) . $arg ;;
-	*) . ./$arg ;;
-	esac
-
-	# Get the name of the library we link against.
-	linklib=
-	for l in $old_library $library_names; do
-	  linklib="$l"
-	done
-
-	if test -z "$linklib"; then
-	  $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
-	  exit 1
-	fi
-
-	# Find the relevant object directory and library name.
-	name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
-
-	if test "X$installed" = Xyes; then
-	  dir="$libdir"
-	else
-	  dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
-	  if test "X$dir" = "X$arg"; then
-	    dir="$objdir"
-	  else
-	    dir="$dir/$objdir"
-	  fi
-	fi
-
-	if test -n "$dependency_libs"; then
-	  # Extract -R and -L from dependency_libs
-	  temp_deplibs=
-	  for deplib in $dependency_libs; do
-	    case "$deplib" in
-	    -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
-		 case " $rpath $xrpath " in
-		 *" $temp_xrpath "*) ;;
-		 *) xrpath="$xrpath $temp_xrpath";;
-		 esac;;
-	    -L*) case "$compile_command $temp_deplibs " in
-		 *" $deplib "*) ;;
-		 *) temp_deplibs="$temp_deplibs $deplib";;
-		 esac
-		 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
-		 case " $lib_search_path " in
-		 *" $temp_dir "*) ;;
-		 *) lib_search_path="$lib_search_path $temp_dir";;
-		 esac
-		 ;;
-	    *) temp_deplibs="$temp_deplibs $deplib";;
-	    esac
-	  done
-	  dependency_libs="$temp_deplibs"
-	fi
-
-	if test -z "$libdir"; then
-	  # It is a libtool convenience library, so add in its objects.
-	  convenience="$convenience $dir/$old_library"
-	  old_convenience="$old_convenience $dir/$old_library"
-	  deplibs="$deplibs$dependency_libs"
-	  compile_command="$compile_command $dir/$old_library$dependency_libs"
-	  finalize_command="$finalize_command $dir/$old_library$dependency_libs"
-	  continue
-	fi
-
-	# This library was specified with -dlopen.
 	if test "$prev" = dlfiles; then
+	  # This library was specified with -dlopen.
 	  dlfiles="$dlfiles $arg"
-	  if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
-	    # If there is no dlname, no dlopen support or we're linking statically,
-	    # we need to preload.
-	    prev=dlprefiles
-	  else
-	    # We should not create a dependency on this library, but we
-	    # may need any libraries it requires.
-	    compile_command="$compile_command$dependency_libs"
-	    finalize_command="$finalize_command$dependency_libs"
-	    prev=
-	    continue
-	  fi
-	fi
-
-	# The library was specified with -dlpreopen.
-	if test "$prev" = dlprefiles; then
-	  # Prefer using a static library (so that no silly _DYNAMIC symbols
-	  # are required to link).
-	  if test -n "$old_library"; then
-	    dlprefiles="$dlprefiles $dir/$old_library"
-	  else
-	    dlprefiles="$dlprefiles $dir/$linklib"
-	  fi
 	  prev=
-	fi
-
-	if test -n "$library_names" &&
-	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
-	  link_against_libtool_libs="$link_against_libtool_libs $arg"
-	  if test -n "$shlibpath_var"; then
-	    # Make sure the rpath contains only unique directories.
-	    case "$temp_rpath " in
-	    *" $dir "*) ;;
-	    *) temp_rpath="$temp_rpath $dir" ;;
-	    esac
-	  fi
-
-	  # We need an absolute path.
-	  case "$dir" in
-	  [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
-	  *)
-	    absdir=`cd "$dir" && pwd`
-	    if test -z "$absdir"; then
-	      $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
-	      $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
-	      absdir="$dir"
-	    fi
-	    ;;
-	  esac
-	  
-	  # This is the magic to use -rpath.
-	  # Skip directories that are in the system default run-time
-	  # search path, unless they have been requested with -R.
-	  case " $sys_lib_dlsearch_path " in
-	  *" $absdir "*) ;;
-	  *)
-	    case "$compile_rpath " in
-	    *" $absdir "*) ;;
-	    *) compile_rpath="$compile_rpath $absdir" 
-	    esac
-	    ;;
-	  esac
-
-	  case " $sys_lib_dlsearch_path " in
-	  *" $libdir "*) ;;
-	  *)
-	    case "$finalize_rpath " in
-	    *" $libdir "*) ;;
-	    *) finalize_rpath="$finalize_rpath $libdir"
-	    esac
-	    ;;
-	  esac
-
-	  lib_linked=yes
-	  case "$hardcode_action" in
-	  immediate | unsupported)
-	    if test "$hardcode_direct" = no; then
-	      compile_command="$compile_command $dir/$linklib"
-	      deplibs="$deplibs $dir/$linklib"
-	      case "$host" in
-	      *-*-cygwin* | *-*-mingw* | *-*-os2*)
-		dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
-		if test -n "$dllsearchpath"; then
-		  dllsearchpath="$dllsearchpath:$dllsearchdir"
-		else
-		  dllsearchpath="$dllsearchdir"
-		fi
-		;;
-	      esac
-	    elif test "$hardcode_minus_L" = no; then
-	      case "$host" in
-	      *-*-sunos*)
-		compile_shlibpath="$compile_shlibpath$dir:"
-		;;
-	      esac
-	      case "$compile_command " in
-	      *" -L$dir "*) ;;
-	      *) compile_command="$compile_command -L$dir";;
-	      esac
-	      compile_command="$compile_command -l$name"
-	      deplibs="$deplibs -L$dir -l$name"
-	    elif test "$hardcode_shlibpath_var" = no; then
-	      case ":$compile_shlibpath:" in
-	      *":$dir:"*) ;;
-	      *) compile_shlibpath="$compile_shlibpath$dir:";;
-	      esac
-	      compile_command="$compile_command -l$name"
-	      deplibs="$deplibs -l$name"
-	    else
-	      lib_linked=no
-	    fi
-	    ;;
-
-	  relink)
-	    if test "$hardcode_direct" = yes; then
-	      compile_command="$compile_command $absdir/$linklib"
-	      deplibs="$deplibs $absdir/$linklib"
-	    elif test "$hardcode_minus_L" = yes; then
-	      case "$compile_command " in
-	      *" -L$absdir "*) ;;
-	      *) compile_command="$compile_command -L$absdir";;
-	      esac
-	      compile_command="$compile_command -l$name"
-	      deplibs="$deplibs -L$absdir -l$name"
-	    elif test "$hardcode_shlibpath_var" = yes; then
-	      case ":$compile_shlibpath:" in
-	      *":$absdir:"*) ;;
-	      *) compile_shlibpath="$compile_shlibpath$absdir:";;
-	      esac
-	      compile_command="$compile_command -l$name"
-	      deplibs="$deplibs -l$name"
-	    else
-	      lib_linked=no
-	    fi
-	    ;;
-
-	  *)
-	    lib_linked=no
-	    ;;
-	  esac
-
-	  if test "$lib_linked" != yes; then
-	    $echo "$modename: configuration error: unsupported hardcode properties"
-	    exit 1
-	  fi
-
-	  # Finalize command for both is simple: just hardcode it.
-	  if test "$hardcode_direct" = yes; then
-	    finalize_command="$finalize_command $libdir/$linklib"
-	  elif test "$hardcode_minus_L" = yes; then
-	    case "$finalize_command " in
-	    *" -L$libdir "*) ;;
-	    *) finalize_command="$finalize_command -L$libdir";;
-	    esac
-	    finalize_command="$finalize_command -l$name"
-	  elif test "$hardcode_shlibpath_var" = yes; then
-	    case ":$finalize_shlibpath:" in
-	    *":$libdir:"*) ;;
-	    *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
-	    esac
-	    finalize_command="$finalize_command -l$name"
-	  else
-	    # We cannot seem to hardcode it, guess we'll fake it.
-	    case "$finalize_command " in
-	    *" -L$dir "*) ;;
-	    *) finalize_command="$finalize_command -L$libdir";;
-	    esac
-	    finalize_command="$finalize_command -l$name"
-	  fi
+	elif test "$prev" = dlprefiles; then
+	  # The library was specified with -dlpreopen.
+	  dlprefiles="$dlprefiles $arg"
+	  prev=
 	else
-	  # Transform directly to old archives if we don't build new libraries.
-	  if test -n "$pic_flag" && test -z "$old_library"; then
-	    $echo "$modename: cannot find static library for \`$arg'" 1>&2
-	    exit 1
-	  fi
-
-	  # Here we assume that one of hardcode_direct or hardcode_minus_L
-	  # is not unsupported.  This is valid on all known static and
-	  # shared platforms.
-	  if test "$hardcode_direct" != unsupported; then
-	    test -n "$old_library" && linklib="$old_library"
-	    compile_command="$compile_command $dir/$linklib"
-	    finalize_command="$finalize_command $dir/$linklib"
-	  else
-	    case "$compile_command " in
-	    *" -L$dir "*) ;;
-	    *) compile_command="$compile_command -L$dir";;
-	    esac
-	    compile_command="$compile_command -l$name"
-	    case "$finalize_command " in
-	    *" -L$dir "*) ;;
-	    *) finalize_command="$finalize_command -L$dir";;
-	    esac
-	    finalize_command="$finalize_command -l$name"
-	  fi
+	  deplibs="$deplibs $arg"
 	fi
-
-	# Add in any libraries that this one depends upon.
-	compile_command="$compile_command$dependency_libs"
-	finalize_command="$finalize_command$dependency_libs"
 	continue
 	;;
 
@@ -1511,7 +1385,7 @@
 	# to be aesthetically quoted because they are evaled later.
 	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
 	case "$arg" in
-	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
+	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
 	  arg="\"$arg\""
 	  ;;
 	esac
@@ -1531,6 +1405,50 @@
       exit 1
     fi
 
+    # Infer tagged configuration to use if any are available and
+    # if one wasn't chosen via the "--tag" command line option.
+    # Only attempt this if the compiler in the base link
+    # command doesn't match the default compiler.
+    if test -n "$available_tags" && test -z "$tagname"; then
+      case $base_compile in
+      "$CC "*) ;;
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when ltconfig was run.
+      "`$echo $CC` "*) ;;
+      *)
+        for z in $available_tags; do
+          if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
+            case $base_compile in
+	    "$CC "*)
+              # The compiler in $compile_command matches
+              # the one in the tagged configuration.
+              # Assume this is the tagged configuration we want.
+              tagname=$z
+              break
+	      ;;
+	    "`$echo $CC` "*)
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+          fi
+        done
+        # If $tagname still isn't set, then no tagged configuration
+        # was found and let the user know that the "--tag" command
+        # line option must be used.
+        if test -z "$tagname"; then
+          echo "$modename: unable to infer tagged configuration"
+          echo "$modename: specify a tag with \`--tag'" 1>&2
+	  exit 1
+#       else
+#         echo "$modename: using $tagname tagged configuration"
+        fi
+	;;
+      esac
+    fi
+
     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
       eval arg=\"$export_dynamic_flag_spec\"
       compile_command="$compile_command $arg"
@@ -1542,19 +1460,816 @@
     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
     libobjs_save="$libobjs"
 
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$output_objdir" = "X$output"; then
+      output_objdir="$objdir"
+    else
+      output_objdir="$output_objdir/$objdir"
+    fi
+    # Create the object directory.
+    if test ! -d $output_objdir; then
+      $show "$mkdir $output_objdir"
+      $run $mkdir $output_objdir
+      status=$?
+      if test $status -ne 0 && test ! -d $output_objdir; then
+	exit $status
+      fi
+    fi
+
+    # Determine the type of output
     case "$output" in
     "")
       $echo "$modename: you must specify an output file" 1>&2
       $echo "$help" 1>&2
       exit 1
       ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
 
-    *.a | *.lib)
-      if test -n "$link_against_libtool_libs"; then
-	$echo "$modename: error: cannot link libtool libraries into archives" 1>&2
-	exit 1
+    specialdeplibs=
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      case "$libs " in
+      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+      esac
+      libs="$libs $deplib"
+    done
+
+    if test $linkmode = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    uninst_deplibs= # uninstalled libtool libraries
+    uninst_path= # paths that contain uninstalled libtool libraries
+    case $linkmode in
+    lib)
+	passes="conv link"
+	for file in $dlfiles $dlprefiles; do
+	  case "$file" in
+	  *.la) ;;
+	  *)
+	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+	    exit 1
+	    ;;
+	  esac
+	done
+	;;
+    prog)
+	compile_deplibs=
+	finalize_deplibs=
+	alldeplibs=no
+	newdlfiles=
+	newdlprefiles=
+	passes="conv scan dlopen dlpreopen link"
+	;;
+    *)	passes="conv"
+	;;
+    esac
+    for pass in $passes; do
+      if test "$linkmode,$pass" = "lib,link" ||
+	 test "$linkmode,$pass" = "prog,scan"; then
+	libs="$deplibs"
+	deplibs=
       fi
+      if test $linkmode = prog; then
+	case $pass in
+	dlopen) libs="$dlfiles" ;;
+	dlpreopen) libs="$dlprefiles" ;;
+	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+	esac
+      fi
+      if test $pass = dlopen; then
+	# Collect dlpreopened libraries
+	save_deplibs="$deplibs"
+	deplibs=
+      fi
+      for deplib in $libs; do
+	lib=
+	found=no
+	case "$deplib" in
+	-l*)
+	  if test $linkmode != lib && test $linkmode != prog; then
+	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+	    continue
+	  fi
+	  if test $pass = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+	    # Search the libtool library
+	    lib="$searchdir/lib${name}.la"
+	    if test -f "$lib"; then
+	      found=yes
+	      break
+	    fi
+	  done
+	  if test "$found" != yes; then
+	    if test "$linkmode,$pass" = "prog,link"; then
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      deplibs="$deplib $deplibs"
+	      test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    continue
+	  fi
+	  ;;
+	-L*)
+	  case $linkmode in
+	  lib)
+	    deplibs="$deplib $deplibs"
+	    test $pass = conv && continue
+	    newdependency_libs="$deplib $newdependency_libs"
+	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    ;;
+	  prog)
+	    if test $pass = conv; then
+	      deplibs="$deplib $deplibs"
+	      continue
+	    fi
+	    if test $pass = scan; then
+	      deplibs="$deplib $deplibs"
+	      newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    ;;
+	  *)
+	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
+	    ;;
+	  esac
+	  continue
+	  ;;
+	-R*)
+	  if test $pass = link; then
+	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+	    # Make sure the xrpath contains only unique directories.
+	    case "$xrpath " in
+	    *" $dir "*) ;;
+	    *) xrpath="$xrpath $dir" ;;
+	    esac
+	  fi
+	  deplibs="$deplib $deplibs"
+	  continue
+	  ;;
+	*.la) lib="$deplib" ;;
+	*.$libext)
+	  if test $pass = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  case $linkmode in
+	  lib)
+	    if test "$deplibs_check_method" != pass_all; then
+	      echo
+	      echo "*** Warning: This library needs some functionality provided by $deplib."
+	      echo "*** I have the capability to make that library automatically link in when"
+	      echo "*** you link to this library.  But I can only do this if you have a"
+	      echo "*** shared version of the library, which you do not appear to have."
+	    else
+	      echo
+	      echo "*** Warning: Linking the shared library $output against the"
+	      echo "*** static library $deplib is not portable!"
+	      deplibs="$deplib $deplibs"
+	    fi
+	    continue
+	    ;;
+	  prog)
+	    if test $pass != link; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    continue
+	    ;;
+	  esac
+	  ;;
+	*.lo | *.$objext)
+	  if test $pass = conv; then
+	    deplibs="$deplib $deplibs"
+	  elif test $linkmode = prog; then
+	    if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	      # If there is no dlopen support or we're linking statically,
+	      # we need to preload.
+	      newdlprefiles="$newdlprefiles $deplib"
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      newdlfiles="$newdlfiles $deplib"
+	    fi
+	  fi
+	  continue
+	  ;;
+	%DEPLIBS%)
+	  alldeplibs=yes
+	  continue
+	  ;;
+	esac
+	if test $found = yes || test -f "$lib"; then :
+	else
+	  $echo "$modename: cannot find the library \`$lib'" 1>&2
+	  exit 1
+	fi
 
+	# Check to see that this really is a libtool archive.
+	if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+	else
+	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+	  exit 1
+	fi
+
+	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+	test "X$ladir" = "X$lib" && ladir="."
+
+	dlname=
+	dlopen=
+	dlpreopen=
+	libdir=
+	library_names=
+	old_library=
+	# If the library was installed with an old release of libtool,
+	# it will not redefine variable installed.
+	installed=yes
+
+	# Read the .la file
+	case "$lib" in
+	*/* | *\\*) . $lib ;;
+	*) . ./$lib ;;
+	esac
+
+	if test "$linkmode,$pass" = "lib,link" ||
+	   test "$linkmode,$pass" = "prog,scan" ||
+	   { test $linkmode != prog && test $linkmode != lib; }; then
+	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+	fi
+
+	if test $pass = conv; then
+	  # only check for convenience libraries
+	  deplibs="$lib $deplibs"
+	  if test -z "$libdir"; then
+	    if test -z "$old_library"; then
+	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	      exit 1
+	    fi
+	    # It is a libtool convenience library, so add in its objects.
+	    convenience="$convenience $ladir/$objdir/$old_library"
+	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
+	    tmp_libs=
+	    for deplib in $dependency_libs; do
+	      deplibs="$deplib $deplibs"
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	      tmp_libs="$tmp_libs $deplib"
+	    done
+	  elif test $linkmode != prog && test $linkmode != lib; then
+	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
+	    exit 1
+	  fi
+	  continue
+	fi
+
+	# Get the name of the library we link against.
+	linklib=
+	for l in $old_library $library_names; do
+	  linklib="$l"
+	done
+	if test -z "$linklib"; then
+	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+	  exit 1
+	fi
+
+	# This library was specified with -dlopen.
+	if test $pass = dlopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+	    exit 1
+	  fi
+	  if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	    # If there is no dlname, no dlopen support or we're linking statically,
+	    # we need to preload.
+	    dlprefiles="$dlprefiles $lib"
+	  else
+	    newdlfiles="$newdlfiles $lib"
+	  fi
+	  continue
+	fi
+
+	# We need an absolute path.
+	case "$ladir" in
+	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+	*)
+	  abs_ladir=`cd "$ladir" && pwd`
+	  if test -z "$abs_ladir"; then
+	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+	    abs_ladir="$ladir"
+	  fi
+	  ;;
+	esac
+	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+	# Find the relevant object directory and library name.
+	if test "X$installed" = Xyes; then
+	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    libdir="$abs_ladir"
+	  else
+	    dir="$libdir"
+	    absdir="$libdir"
+	  fi
+	else
+	  dir="$ladir/$objdir"
+	  absdir="$abs_ladir/$objdir"
+	  # Remove this search path later
+	  uninst_path="$uninst_path $abs_ladir"
+	fi
+	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+	# This library was specified with -dlpreopen.
+	if test $pass = dlpreopen; then
+	  if test -z "$libdir"; then
+	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+	    exit 1
+	  fi
+	  # Prefer using a static library (so that no silly _DYNAMIC symbols
+	  # are required to link).
+	  if test -n "$old_library"; then
+	    newdlprefiles="$newdlprefiles $dir/$old_library"
+	  # Otherwise, use the dlname, so that lt_dlopen finds it.
+	  elif test -n "$dlname"; then
+	    newdlprefiles="$newdlprefiles $dir/$dlname"
+	  else
+	    newdlprefiles="$newdlprefiles $dir/$linklib"
+	  fi
+	fi
+
+	if test -z "$libdir"; then
+	  # link the convenience library
+	  if test $linkmode = lib; then
+	    deplibs="$dir/$old_library $deplibs"
+	  elif test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$dir/$old_library $compile_deplibs"
+	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
+	  else
+	    deplibs="$lib $deplibs" # used for prog,scan pass
+	  fi
+	  continue
+	fi
+
+	if test $linkmode = prog && test $pass != link; then
+	  newlib_search_path="$newlib_search_path $ladir"
+	  deplibs="$lib $deplibs"
+
+	  linkalldeplibs=no
+	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
+	     test "$build_libtool_libs" = no; then
+	    linkalldeplibs=yes
+	  fi
+
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    case "$deplib" in
+	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+	    esac
+	    # Need to link against all dependency_libs?
+	    if test $linkalldeplibs = yes; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      # Need to hardcode shared library paths
+	      # or/and link against static libraries
+	      newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    case "$tmp_libs " in
+	    *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	    esac
+	    tmp_libs="$tmp_libs $deplib"
+	  done
+	  continue
+	fi
+
+	if test "$linkmode,$pass" = "prog,link"; then
+	  if test -n "$library_names" &&
+	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+	    # We need to hardcode the library path
+	    if test -n "$shlibpath_var"; then
+	      # Make sure the rpath contains only unique directories.
+	      case "$temp_rpath " in
+	      *" $dir "*) ;;
+	      *" $absdir "*) ;;
+	      *) temp_rpath="$temp_rpath $dir" ;;
+	      esac
+	    fi
+
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi
+
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+	fi
+
+	link_static=no # Whether the deplib will be linked statically
+	if test -n "$library_names" &&
+	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+	  if test "$installed" = no; then
+	    uninst_deplibs="$uninst_deplibs $lib"
+	    need_relink=yes
+	  fi
+	  # This is a shared library
+	  if test $linkmode = lib &&
+	     test $hardcode_into_libs = yes; then
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi
+
+	  if test -n "$old_archive_from_expsyms_cmds"; then
+	    # figure out the soname
+	    set dummy $library_names
+	    realname="$2"
+	    shift; shift
+	    libname=`eval \\$echo \"$libname_spec\"`
+	    if test -n "$soname_spec"; then
+	      eval soname=\"$soname_spec\"
+	    else
+	      soname="$realname"
+	    fi
+
+	    # Make a new name for the extract_expsyms_cmds to use
+	    newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
+
+	    # If the library has no export list, then create one now
+	    if test -f "$output_objdir/$soname-def"; then :
+	    else
+	      $show "extracting exported symbol list from \`$soname'"
+	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
+	      eval cmds=\"$extract_expsyms_cmds\"
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+
+	    # Create $newlib
+	    if test -f "$output_objdir/$newlib"; then :; else
+	      $show "generating import library for \`$soname'"
+	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
+	      eval cmds=\"$old_archive_from_expsyms_cmds\"
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		$show "$cmd"
+		$run eval "$cmd" || exit $?
+	      done
+	      IFS="$save_ifs"
+	    fi
+	    # make sure the library variables are pointing to the new library
+	    dir=$output_objdir
+	    linklib=$newlib
+	  fi
+
+	  if test $linkmode = prog || test "$mode" != relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    lib_linked=yes
+	    case "$hardcode_action" in
+	    immediate | unsupported)
+	      if test "$hardcode_direct" = no; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = no; then
+		case "$host" in
+		*-*-sunos*) add_shlibpath="$dir" ;;
+		esac
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = no; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    relink)
+	      if test "$hardcode_direct" = yes; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = yes; then
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = yes; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    *) lib_linked=no ;;
+	    esac
+
+	    if test "$lib_linked" != yes; then
+	      $echo "$modename: configuration error: unsupported hardcode properties"
+	      exit 1
+	    fi
+
+	    if test -n "$add_shlibpath"; then
+	      case ":$compile_shlibpath:" in
+	      *":$add_shlibpath:"*) ;;
+	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+	      esac
+	    fi
+	    if test $linkmode = prog; then
+	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	      if test "$hardcode_direct" != yes && \
+		 test "$hardcode_minus_L" != yes && \
+		 test "$hardcode_shlibpath_var" = yes; then
+		case ":$finalize_shlibpath:" in
+		*":$libdir:"*) ;;
+		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+		esac
+	      fi
+	    fi
+	  fi
+
+	  if test $linkmode = prog || test "$mode" = relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    # Finalize command for both is simple: just hardcode it.
+	    if test "$hardcode_direct" = yes; then
+	      add="$libdir/$linklib"
+	    elif test "$hardcode_minus_L" = yes; then
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    elif test "$hardcode_shlibpath_var" = yes; then
+	      case ":$finalize_shlibpath:" in
+	      *":$libdir:"*) ;;
+	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+	      esac
+	      add="-l$name"
+	    else
+	      # We cannot seem to hardcode it, guess we'll fake it.
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    fi
+
+	    if test $linkmode = prog; then
+	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	    fi
+	  fi
+	elif test $linkmode = prog; then
+	  # Here we assume that one of hardcode_direct or hardcode_minus_L
+	  # is not unsupported.  This is valid on all known static and
+	  # shared platforms.
+	  if test "$hardcode_direct" != unsupported; then
+	    test -n "$old_library" && linklib="$old_library"
+	    compile_deplibs="$dir/$linklib $compile_deplibs"
+	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
+	  else
+	    compile_deplibs="-l$name -L$dir $compile_deplibs"
+	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+	  fi
+	elif test "$build_libtool_libs" = yes; then
+	  # Not a shared library
+	  if test "$deplibs_check_method" != pass_all; then
+	    # We're trying link a shared library against a static one
+	    # but the system doesn't support it.
+	    # Just print a warning and add the library to dependency_libs so
+	    # that the program can be linked against the static library.
+	    echo
+	    echo "*** Warning: This library needs some functionality provided by $lib."
+	    echo "*** I have the capability to make that library automatically link in when"
+	    echo "*** you link to this library.  But I can only do this if you have a"
+	    echo "*** shared version of the library, which you do not appear to have."
+	  else
+	    convenience="$convenience $dir/$old_library"
+	    old_convenience="$old_convenience $dir/$old_library"
+	    deplibs="$dir/$old_library $deplibs"
+	    link_static=yes
+	  fi
+	fi
+
+	if test $linkmode = lib; then
+	  if test -n "$dependency_libs" &&
+	     { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
+	       test $link_static = yes; }; then
+	    # Extract -R from dependency_libs
+	    temp_deplibs=
+	    for libdir in $dependency_libs; do
+	      case "$libdir" in
+	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+		   case " $xrpath " in
+		   *" $temp_xrpath "*) ;;
+		   *) xrpath="$xrpath $temp_xrpath";;
+		   esac;;
+	      *) temp_deplibs="$temp_deplibs $libdir";;
+	      esac
+	    done
+	    dependency_libs="$temp_deplibs"
+	  fi
+
+	  newlib_search_path="$newlib_search_path $absdir"
+	  # Link against this library
+	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+	  # ... and its dependency_libs
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    newdependency_libs="$deplib $newdependency_libs"
+	    case "$tmp_libs " in
+	    *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	    esac
+	    tmp_libs="$tmp_libs $deplib"
+	  done
+
+	  if test $link_all_deplibs != no; then
+	    # Add the search paths of all dependency libraries
+	    for deplib in $dependency_libs; do
+	      case "$deplib" in
+	      -L*) path="$deplib" ;;
+	      *.la)
+		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+		test "X$dir" = "X$deplib" && dir="."
+		# We need an absolute path.
+		case "$dir" in
+		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+		*)
+		  absdir=`cd "$dir" && pwd`
+		  if test -z "$absdir"; then
+		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+		    absdir="$dir"
+		  fi
+		  ;;
+		esac
+		if grep "^installed=no" $deplib > /dev/null; then
+		  path="-L$absdir/$objdir"
+		else
+		  eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  if test -z "$libdir"; then
+		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		    exit 1
+		  fi
+		  if test "$absdir" != "$libdir"; then
+		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+		  fi
+		  path="-L$absdir"
+		fi
+		;;
+	      *) continue ;;
+	      esac
+	      case " $deplibs " in
+	      *" $path "*) ;;
+	      *) deplibs="$path $deplibs" ;;
+	      esac
+	    done
+	  fi
+	fi
+      done
+      dependency_libs="$newdependency_libs"
+      if test $pass = dlpreopen; then
+	# Link the dlpreopened libraries before other libraries
+	for deplib in $save_deplibs; do
+	  deplibs="$deplib $deplibs"
+	done
+      fi
+      if test $pass != dlopen; then
+	if test $pass != conv; then
+	  # Make sure lib_search_path contains only unique directories.
+	  lib_search_path=
+	  for dir in $newlib_search_path; do
+	    case "$lib_search_path " in
+	    *" $dir "*) ;;
+	    *) lib_search_path="$lib_search_path $dir" ;;
+	    esac
+	  done
+	  newlib_search_path=
+	fi
+
+	if test "$linkmode,$pass" != "prog,link"; then
+	  vars="deplibs"
+	else
+	  vars="compile_deplibs finalize_deplibs"
+	fi
+	for var in $vars dependency_libs; do
+	  # Make sure that $var contains only unique libraries
+	  # and add them in reverse order
+	  eval tmp_libs=\"\$$var\"
+	  new_libs=
+	  for deplib in $tmp_libs; do
+	    case "$deplib" in
+	    -L*) new_libs="$deplib $new_libs" ;;
+	    *)
+	      case " $specialdeplibs " in
+	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
+	      *)
+		case " $new_libs " in
+		*" $deplib "*) ;;
+		*) new_libs="$deplib $new_libs" ;;
+		esac
+		;;
+	      esac
+	      ;;
+	    esac
+	  done
+	  tmp_libs=
+	  for deplib in $new_libs; do
+	    case "$deplib" in
+	    -L*)
+	      case " $tmp_libs " in
+	      *" $deplib "*) ;;
+	      *) tmp_libs="$tmp_libs $deplib" ;;
+	      esac
+	      ;;
+	    *) tmp_libs="$tmp_libs $deplib" ;;
+	    esac
+	  done
+	  eval $var=\"$tmp_libs\"
+	done
+      fi
+    done
+    if test $linkmode = prog; then
+      dlfiles="$newdlfiles"
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
       if test -n "$deplibs"; then
 	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
       fi
@@ -1586,9 +2301,10 @@
       # Now set the variables for building old libraries.
       build_libtool_libs=no
       oldlibs="$output"
+      objs="$objs$old_deplibs"
       ;;
 
-    *.la)
+    lib)
       # Make sure we only generate libraries of the form `libNAME.la'.
       case "$outputname" in
       lib*)
@@ -1611,26 +2327,20 @@
 	;;
       esac
 
-      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
-      if test "X$output_objdir" = "X$output"; then
-	output_objdir="$objdir"
-      else
-	output_objdir="$output_objdir/$objdir"
-      fi
-
       if test -n "$objs"; then
-	$echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
-	exit 1
+	if test "$deplibs_check_method" != pass_all; then
+	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+	  exit 1
+	else
+	  echo
+	  echo "*** Warning: Linking the shared library $output against the non-libtool"
+	  echo "*** objects $objs is not portable!"
+	  libobjs="$libobjs $objs"
+	fi
       fi
 
-      # How the heck are we supposed to write a wrapper for a shared library?
-      if test -n "$link_against_libtool_libs"; then
-	 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
-	 exit 1
-      fi
-
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-	$echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
+      if test "$dlself" != no; then
+	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
       fi
 
       set dummy $rpath
@@ -1643,12 +2353,13 @@
       if test -z "$rpath"; then
 	if test "$build_libtool_libs" = yes; then
 	  # Building a libtool convenience library.
-	  libext=al
+	  # Some compilers have problems with a `.al' extension so
+          # convenience libraries should have the same extension an
+          # archive normally would.
 	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
 	  build_libtool_libs=convenience
 	  build_old_libs=yes
 	fi
-	dependency_libs="$deplibs"
 
 	if test -n "$vinfo"; then
 	  $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
@@ -1717,7 +2428,6 @@
 
 	irix)
 	  major=`expr $current - $age + 1`
-	  versuffix="$major.$revision"
 	  verstring="sgi$major.$revision"
 
 	  # Add in all the interfaces that we are compatible with.
@@ -1727,6 +2437,10 @@
 	    loop=`expr $loop - 1`
 	    verstring="sgi$major.$iface:$verstring"
 	  done
+
+	  # Before this point, $major must not contain `.'.
+	  major=.$major
+	  versuffix="$major.$revision"
 	  ;;
 
 	linux)
@@ -1767,10 +2481,10 @@
 	  ;;
 
 	windows)
-	  # Like Linux, but with '-' rather than '.', since we only
-	  # want one extension on Windows 95.
+	  # Use '-' rather than '.', since we only want one
+	  # extension on DOS 8.3 filesystems.
 	  major=`expr $current - $age`
-	  versuffix="-$major-$age-$revision"
+	  versuffix="-$major"
 	  ;;
 
 	*)
@@ -1797,7 +2511,7 @@
 	  versuffix=
 	  verstring=""
 	fi
-	
+
 	# Check to see if the archive will have undefined symbols.
 	if test "$allow_undefined" = yes; then
 	  if test "$allow_undefined_flag" = unsupported; then
@@ -1809,30 +2523,27 @@
 	  # Don't allow undefined symbols.
 	  allow_undefined_flag="$no_undefined_flag"
 	fi
-
-	dependency_libs="$deplibs"
-	case "$host" in
-	*-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
-	  # these systems don't actually have a c library (as such)!
-	  ;;
-	*)
-	  # Add libc to deplibs on all other systems.
-	  deplibs="$deplibs -lc"
-	  ;;
-	esac
       fi
 
-      # Create the output directory, or remove our outputs if we need to.
-      if test -d $output_objdir; then
-	$show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
-	$run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
-      else
-	$show "$mkdir $output_objdir"
-	$run $mkdir $output_objdir
-	status=$?
-	if test $status -ne 0 && test ! -d $output_objdir; then
-	  exit $status
-	fi
+      if test "$mode" != relink; then
+	# Remove our outputs, but don't remove object files since they
+        # may have been created when compiling PIC objects.
+        removelist=
+        tempremovelist=`echo "$output_objdir/*"`
+	for p in $tempremovelist; do
+          case "$p" in
+            *.$objext)
+               ;;
+            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+               removelist="$removelist $p"
+               ;;
+            *) ;;
+          esac
+        done
+        if test -n "$removelist"; then
+	  $show "${rm}r $removelist"
+	  $run ${rm}r $removelist
+        fi
       fi
 
       # Now set the variables for building old libraries.
@@ -1843,7 +2554,63 @@
 	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
       fi
 
+      # Eliminate all temporary directories.
+      for path in $uninst_path; do
+	lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
+	deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
+	dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
+      done
+
+      if test -n "$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	temp_xrpath=
+	for libdir in $xrpath; do
+	  temp_xrpath="$temp_xrpath -R$libdir"
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+	if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
+	  dependency_libs="$temp_xrpath $dependency_libs"
+	fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+	case " $dlprefiles $dlfiles " in
+	*" $lib "*) ;;
+	*) dlfiles="$dlfiles $lib" ;;
+	esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+	case "$dlprefiles " in
+	*" $lib "*) ;;
+	*) dlprefiles="$dlprefiles $lib" ;;
+	esac
+      done
+
       if test "$build_libtool_libs" = yes; then
+	if test -n "$rpath"; then
+	  case "$host" in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+	    # these systems don't actually have a c library (as such)!
+	    ;;
+	  *)
+ 	    # Add libc to deplibs on all other systems if necessary.
+ 	    if test $build_libtool_need_lc = "yes"; then
+ 	      deplibs="$deplibs -lc"
+ 	    fi
+	    ;;
+	  esac
+	fi
+
 	# Transform deplibs into only deplibs that can be linked in shared.
 	name_save=$name
 	libname_save=$libname
@@ -1877,7 +2644,7 @@
 	  int main() { return 0; }
 EOF
 	  $rm conftest
-	  $CC -o conftest conftest.c $deplibs
+	  $LTCC -o conftest conftest.c $deplibs
 	  if test $? -eq 0 ; then
 	    ldd_output=`ldd conftest`
 	    for i in $deplibs; do
@@ -1910,7 +2677,7 @@
 	     # If $name is empty we are operating on a -L argument.
 	      if test "$name" != "" ; then
 		$rm conftest
-		$CC -o conftest conftest.c $i
+		$LTCC -o conftest conftest.c $i
 		# Did it work?
 		if test $? -eq 0 ; then
 		  ldd_output=`ldd conftest`
@@ -1944,19 +2711,19 @@
 	  ;;
 	file_magic*)
 	  set dummy $deplibs_check_method
-	  file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
+	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
 	  for a_deplib in $deplibs; do
 	    name="`expr $a_deplib : '-l\(.*\)'`"
 	    # If $name is empty we are operating on a -L argument.
 	    if test "$name" != "" ; then
 	      libname=`eval \\$echo \"$libname_spec\"`
-	      for i in $lib_search_path; do
+	      for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 		    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 		    for potent_lib in $potential_libs; do
 		      # Follow soft links.
 		      if ls -lLd "$potent_lib" 2>/dev/null \
 			 | grep " -> " >/dev/null; then
-			continue 
+			continue
 		      fi
 		      # The statement above tries to avoid entering an
 		      # endless loop below, in case of cyclic links.
@@ -2051,9 +2818,64 @@
       library_names=
       old_library=
       dlname=
-      
+
       # Test again, we may have decided not to build it any more
       if test "$build_libtool_libs" = yes; then
+	if test $hardcode_into_libs = yes; then
+	  # Hardcode the library paths
+	  hardcode_libdirs=
+	  dep_rpath=
+	  rpath="$finalize_rpath"
+	  test "$mode" != relink && rpath="$compile_rpath$rpath"
+	  for libdir in $rpath; do
+	    if test -n "$hardcode_libdir_flag_spec"; then
+	      if test -n "$hardcode_libdir_separator"; then
+		if test -z "$hardcode_libdirs"; then
+		  hardcode_libdirs="$libdir"
+		else
+		  # Just accumulate the unique libdirs.
+		  case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
+		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		    ;;
+		  *)
+		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		    ;;
+		  esac
+		fi
+	      else
+		eval flag=\"$hardcode_libdir_flag_spec\"
+		dep_rpath="$dep_rpath $flag"
+	      fi
+	    elif test -n "$runpath_var"; then
+	      case "$perm_rpath " in
+	      *" $libdir "*) ;;
+	      *) perm_rpath="$perm_rpath $libdir" ;;
+	      esac
+	    fi
+	  done
+	  # Substitute the hardcoded libdirs into the rpath.
+	  if test -n "$hardcode_libdir_separator" &&
+	     test -n "$hardcode_libdirs"; then
+	    libdir="$hardcode_libdirs"
+	    eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+	  fi
+	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
+	    # We should set the runpath_var.
+	    rpath=
+	    for dir in $perm_rpath; do
+	      rpath="$rpath$dir:"
+	    done
+	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+	  fi
+	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+	fi
+
+	shlibpath="$finalize_shlibpath"
+	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	if test -n "$shlibpath"; then
+	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+	fi
+
 	# Get the real and link names of the library.
 	eval library_names=\"$library_names_spec\"
 	set dummy $library_names
@@ -2072,22 +2894,22 @@
 	  linknames="$linknames $link"
 	done
 
-	# Ensure that we have .o objects for linkers which dislike .lo
-	# (e.g. aix) in case we are running --disable-static
-	for obj in $libobjs; do
-	  xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
-	  if test "X$xdir" = "X$obj"; then
-	    xdir="."
-	  else
-	    xdir="$xdir"
-	  fi
-	  baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
-	  oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
-	  if test ! -f $xdir/$oldobj; then
-	    $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
-	    $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
-	  fi
-	done
+#	# Ensure that we have .o objects for linkers which dislike .lo
+#	# (e.g. aix) in case we are running --disable-static
+#	for obj in $libobjs; do
+#	  xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+#	  if test "X$xdir" = "X$obj"; then
+#	    xdir="."
+#	  else
+#	    xdir="$xdir"
+#	  fi
+#	  baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+#	  oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+#	  if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then
+#	    $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
+#	    $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
+#	  fi
+#	done
 
 	# Use standard objects if they are pic
 	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
@@ -2126,8 +2948,8 @@
 	    gentop="$output_objdir/${outputname}x"
 	    $show "${rm}r $gentop"
 	    $run ${rm}r "$gentop"
-	    $show "mkdir $gentop"
-	    $run mkdir "$gentop"
+	    $show "$mkdir $gentop"
+	    $run $mkdir "$gentop"
 	    status=$?
 	    if test $status -ne 0 && test ! -d "$gentop"; then
 	      exit $status
@@ -2145,8 +2967,8 @@
 
 	      $show "${rm}r $xdir"
 	      $run ${rm}r "$xdir"
-	      $show "mkdir $xdir"
-	      $run mkdir "$xdir"
+	      $show "$mkdir $xdir"
+	      $run $mkdir "$xdir"
 	      status=$?
 	      if test $status -ne 0 && test ! -d "$xdir"; then
 		exit $status
@@ -2154,14 +2976,19 @@
 	      $show "(cd $xdir && $AR x $xabs)"
 	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
-	      libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+	      libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 	    done
 	  fi
 	fi
 
 	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
 	  eval flag=\"$thread_safe_flag_spec\"
-	  linkopts="$linkopts $flag"
+	  linker_flags="$linker_flags $flag"
+	fi
+
+	# Make a backup of the uninstalled library when relinking
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
 	fi
 
 	# Do each of the archive commands.
@@ -2178,6 +3005,12 @@
 	done
 	IFS="$save_ifs"
 
+	# Restore the uninstalled library and exit
+	if test "$mode" = relink; then
+	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+	  exit 0
+	fi
+
 	# Create links to the real library.
 	for linkname in $linknames; do
 	  if test "$realname" != "$linkname"; then
@@ -2194,12 +3027,7 @@
       fi
       ;;
 
-    *.lo | *.o | *.obj)
-      if test -n "$link_against_libtool_libs"; then
-	$echo "$modename: error: cannot link libtool libraries into objects" 1>&2
-	exit 1
-      fi
-
+    obj)
       if test -n "$deplibs"; then
 	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
       fi
@@ -2226,7 +3054,7 @@
 
       case "$output" in
       *.lo)
-	if test -n "$objs"; then
+	if test -n "$objs$old_deplibs"; then
 	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
 	  exit 1
 	fi
@@ -2250,7 +3078,7 @@
       gentop=
       # reload_cmds runs $LD directly, so let us get rid of
       # -Wl from whole_archive_flag_spec
-      wl= 
+      wl=
 
       if test -n "$convenience"; then
 	if test -n "$whole_archive_flag_spec"; then
@@ -2259,8 +3087,8 @@
 	  gentop="$output_objdir/${obj}x"
 	  $show "${rm}r $gentop"
 	  $run ${rm}r "$gentop"
-	  $show "mkdir $gentop"
-	  $run mkdir "$gentop"
+	  $show "$mkdir $gentop"
+	  $run $mkdir "$gentop"
 	  status=$?
 	  if test $status -ne 0 && test ! -d "$gentop"; then
 	    exit $status
@@ -2278,8 +3106,8 @@
 
 	    $show "${rm}r $xdir"
 	    $run ${rm}r "$xdir"
-	    $show "mkdir $xdir"
-	    $run mkdir "$xdir"
+	    $show "$mkdir $xdir"
+	    $run $mkdir "$xdir"
 	    status=$?
 	    if test $status -ne 0 && test ! -d "$xdir"; then
 	      exit $status
@@ -2287,13 +3115,13 @@
 	    $show "(cd $xdir && $AR x $xabs)"
 	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
-	    reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+	    reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
 	  done
 	fi
       fi
 
       # Create the old-style object.
-      reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
+      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
 
       output="$obj"
       eval cmds=\"$reload_cmds\"
@@ -2323,12 +3151,12 @@
 
 	# Create an invalid libtool object if no PIC, so that we don't
 	# accidentally link it into a program.
-	$show "echo timestamp > $libobj"
-	$run eval "echo timestamp > $libobj" || exit $?
+	# $show "echo timestamp > $libobj"
+	# $run eval "echo timestamp > $libobj" || exit $?
 	exit 0
       fi
 
-      if test -n "$pic_flag"; then
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
 	# Only do commands if we really have different PIC objects.
 	reload_objs="$libobjs $reload_conv_objs"
 	output="$libobj"
@@ -2340,20 +3168,20 @@
 	  $run eval "$cmd" || exit $?
 	done
 	IFS="$save_ifs"
-      else
-	# Just create a symlink.
-	$show $rm $libobj
-	$run $rm $libobj
-	xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
-	if test "X$xdir" = "X$libobj"; then
-	  xdir="."
-	else
-	  xdir="$xdir"
-	fi
-	baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
-	oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
-	$show "(cd $xdir && $LN_S $oldobj $baseobj)"
-	$run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
+#     else
+#	# Just create a symlink.
+#	$show $rm $libobj
+#	$run $rm $libobj
+#	xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+#	if test "X$xdir" = "X$libobj"; then
+#	  xdir="."
+#	else
+#	  xdir="$xdir"
+#	fi
+#	baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+#	oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+#	$show "(cd $xdir && $LN_S $oldobj $baseobj)"
+#	$run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
       fi
 
       if test -n "$gentop"; then
@@ -2364,8 +3192,7 @@
       exit 0
       ;;
 
-    # Anything else should be a program.
-    *)
+    prog)
       if test -n "$vinfo"; then
 	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
       fi
@@ -2375,20 +3202,19 @@
       fi
 
       if test "$preload" = yes; then
-	if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
+	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
 	   test "$dlopen_self_static" = unknown; then
 	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
-	fi 
+	fi
       fi
-    
+
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
       if test -n "$rpath$xrpath"; then
 	# If the user specified any rpath flags, then add them.
 	for libdir in $rpath $xrpath; do
 	  # This is the magic to use -rpath.
-	  case "$compile_rpath " in
-	  *" $libdir "*) ;;
-	  *) compile_rpath="$compile_rpath $libdir" ;;
-	  esac
 	  case "$finalize_rpath " in
 	  *" $libdir "*) ;;
 	  *) finalize_rpath="$finalize_rpath $libdir" ;;
@@ -2424,6 +3250,14 @@
 	  *) perm_rpath="$perm_rpath $libdir" ;;
 	  esac
 	fi
+	case "$host" in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+	  case ":$dllsearchpath:" in
+	  *":$libdir:"*) ;;
+	  *) dllsearchpath="$dllsearchpath:$libdir";;
+	  esac
+	  ;;
+	esac
       done
       # Substitute the hardcoded libdirs into the rpath.
       if test -n "$hardcode_libdir_separator" &&
@@ -2469,29 +3303,6 @@
       fi
       finalize_rpath="$rpath"
 
-      output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
-      if test "X$output_objdir" = "X$output"; then
-	output_objdir="$objdir"
-      else
-	output_objdir="$output_objdir/$objdir"
-      fi
-
-      # Create the binary in the object directory, then wrap it.
-      if test ! -d $output_objdir; then
-	$show "$mkdir $output_objdir"
-	$run $mkdir $output_objdir
-	status=$?
-	if test $status -ne 0 && test ! -d $output_objdir; then
-	  exit $status
-	fi
-      fi
-
-      if test -n "$libobjs" && test "$build_old_libs" = yes; then
-	# Transform all the library objects into standard objects.
-	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-      fi
-
       dlsyms=
       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
 	if test -n "$NM" && test -n "$global_symbol_pipe"; then
@@ -2534,7 +3345,7 @@
 	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
 
 	    # Add our own program objects to the symbol list.
-	    progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	    progfiles="$objs$old_deplibs"
 	    for arg in $progfiles; do
 	      $show "extracting global C symbols from \`$arg'"
 	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
@@ -2544,7 +3355,7 @@
 	      $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
 	      $run eval '$mv "$nlist"T "$nlist"'
 	    fi
-	    
+
 	    if test -n "$export_symbols_regex"; then
 	      $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
 	      $run eval '$mv "$nlist"T "$nlist"'
@@ -2639,21 +3450,21 @@
 	  # linked before any other PIC object.  But we must not use
 	  # pic_flag when linking with -static.  The problem exists in
 	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
-	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)

+	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
 	    case "$compile_command " in
 	    *" -static "*) ;;
-	    *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
+	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
 	    esac;;
 	  *-*-hpux*)
 	    case "$compile_command " in
 	    *" -static "*) ;;
-	    *) pic_flag_for_symtable=" $pic_flag -DPIC";;
+	    *) pic_flag_for_symtable=" $pic_flag";;
 	    esac
 	  esac
 
 	  # Now compile the dynamic symbol file.
-	  $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
-	  $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+	  $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+	  $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
 	  # Clean up the generated files.
 	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
@@ -2678,7 +3489,7 @@
 	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
       fi
 
-      if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
+      if test $need_relink = no || test "$build_libtool_libs" != yes; then
 	# Replace the output file specification.
 	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
 	link_command="$compile_command$compile_rpath"
@@ -2687,7 +3498,7 @@
 	$show "$link_command"
 	$run eval "$link_command"
 	status=$?
-	
+
 	# Delete the generated files.
 	if test -n "$dlsyms"; then
 	  $show "$rm $output_objdir/${outputname}S.${objext}"
@@ -2743,11 +3554,24 @@
 	fi
       fi
 
+      if test "$no_install" = yes; then
+	# We don't need to create a wrapper script.
+	link_command="$compile_var$compile_command$compile_rpath"
+	# Replace the output file specification.
+	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	# Delete the old output file.
+	$run $rm $output
+	# Link the executable and exit
+	$show "$link_command"
+	$run eval "$link_command" || exit $?
+	exit 0
+      fi
+
       if test "$hardcode_action" = relink; then
 	# Fast installation is not supported
 	link_command="$compile_var$compile_command$compile_rpath"
 	relink_command="$finalize_var$finalize_command$finalize_rpath"
-	
+
 	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
 	$echo "$modename: \`$output' will be relinked during installation" 1>&2
       else
@@ -2767,7 +3591,7 @@
 
       # Replace the output file specification.
       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
-      
+
       # Delete the old output files.
       $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
 
@@ -2779,11 +3603,18 @@
 
       # Quote the relink command for shipping.
       if test -n "$relink_command"; then
-        # Preserve any variables that may affect compiler behavior
-	variables_saved_for_relink="GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+	# Preserve any variables that may affect compiler behavior
 	for var in $variables_saved_for_relink; do
-	  relink_command="$var=\""`eval \$echo \"X'$'$var\" | $Xsed -e "$sed_quote_subst"`"\"; export $var; $relink_command"
+	  if eval test -z \"\${$var+set}\"; then
+	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	  elif eval var_value=\$$var; test -z "$var_value"; then
+	    relink_command="$var=; export $var; $relink_command"
+	  else
+	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	  fi
 	done
+	relink_command="cd `pwd`; $relink_command"
 	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
       fi
 
@@ -2834,7 +3665,7 @@
 # This environment variable determines our operation mode.
 if test \"\$libtool_install_magic\" = \"$magic\"; then
   # install mode needs the following variable:
-  link_against_libtool_libs='$link_against_libtool_libs'
+  uninst_deplibs='$uninst_deplibs'
 else
   # When we are sourced in execute mode, \$file and \$echo are already set.
   if test \"\$libtool_execute_magic\" != \"$magic\"; then
@@ -2867,7 +3698,7 @@
     # If there was a directory component, then change thisdir.
     if test \"x\$destdir\" != \"x\$file\"; then
       case \"\$destdir\" in
-      [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
       *) thisdir=\"\$thisdir/\$destdir\" ;;
       esac
     fi
@@ -2885,7 +3716,7 @@
 	  echo >> $output "\
   program=lt-'$outputname'
   progdir=\"\$thisdir/$objdir\"
-  
+
   if test ! -f \"\$progdir/\$program\" || \\
      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
@@ -2902,7 +3733,7 @@
 
     # relink executable if necessary
     if test -n \"\$relink_command\"; then
-      if (cd \"\$thisdir\" && eval \$relink_command); then :
+      if (eval \$relink_command); then :
       else
 	$rm \"\$progdir/\$file\"
 	exit 1
@@ -2952,13 +3783,21 @@
       # Run the actual program with our arguments.
 "
 	case $host in
-	*-*-cygwin* | *-*-mingw | *-*-os2*)
-	  # win32 systems need to use the prog path for dll
-	  # lookup to work
+	# win32 systems need to use the prog path for dll
+	# lookup to work
+	*-*-cygwin* | *-*-pw32*)
+	  $echo >> $output "\
+      exec \$progdir/\$program \${1+\"\$@\"}
+"
+	  ;;
+
+	# Backslashes separate directories on plain windows
+	*-*-mingw | *-*-os2*)
 	  $echo >> $output "\
       exec \$progdir\\\\\$program \${1+\"\$@\"}
 "
 	  ;;
+
 	*)
 	  $echo >> $output "\
       # Export the path to the program.
@@ -3000,7 +3839,7 @@
 	  oldobjs="$libobjs_save"
 	  build_libtool_libs=no
 	else
-	  oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
+	  oldobjs="$objs$old_deplibs $non_pic_objects"
 	fi
 	addlibs="$old_convenience"
       fi
@@ -3009,14 +3848,14 @@
 	gentop="$output_objdir/${outputname}x"
 	$show "${rm}r $gentop"
 	$run ${rm}r "$gentop"
-	$show "mkdir $gentop"
-	$run mkdir "$gentop"
+	$show "$mkdir $gentop"
+	$run $mkdir "$gentop"
 	status=$?
 	if test $status -ne 0 && test ! -d "$gentop"; then
 	  exit $status
 	fi
 	generated="$generated $gentop"
-	  
+
 	# Add in members from convenience archives.
 	for xlib in $addlibs; do
 	  # Extract the objects.
@@ -3029,8 +3868,8 @@
 
 	  $show "${rm}r $xdir"
 	  $run ${rm}r "$xdir"
-	  $show "mkdir $xdir"
-	  $run mkdir "$xdir"
+	  $show "$mkdir $xdir"
+	  $run $mkdir "$xdir"
 	  status=$?
 	  if test $status -ne 0 && test ! -d "$xdir"; then
 	    exit $status
@@ -3038,7 +3877,7 @@
 	  $show "(cd $xdir && $AR x $xabs)"
 	  $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
 
-	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
+	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP`
 	done
       fi
 
@@ -3046,23 +3885,23 @@
       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
 	eval cmds=\"$old_archive_from_new_cmds\"
       else
-	# Ensure that we have .o objects in place in case we decided
-	# not to build a shared library, and have fallen back to building
-	# static libs even though --disable-static was passed!
-	for oldobj in $oldobjs; do
-	  if test ! -f $oldobj; then
-	    xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
-	    if test "X$xdir" = "X$oldobj"; then
-	      xdir="."
-	    else
-	      xdir="$xdir"
-	    fi
-	    baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
-	    obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
-	    $show "(cd $xdir && ${LN_S} $obj $baseobj)"
-	    $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
-	  fi
-	done
+#	# Ensure that we have .o objects in place in case we decided
+#	# not to build a shared library, and have fallen back to building
+#	# static libs even though --disable-static was passed!
+#	for oldobj in $oldobjs; do
+#	  if test ! -f $oldobj; then
+#	    xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
+#	    if test "X$xdir" = "X$oldobj"; then
+#	      xdir="."
+#	    else
+#	      xdir="$xdir"
+#	    fi
+#	    baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
+#	    obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+#	    $show "(cd $xdir && ${LN_S} $obj $baseobj)"
+#	    $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
+#	  fi
+#	done
 
 	eval cmds=\"$old_archive_cmds\"
       fi
@@ -3087,13 +3926,20 @@
       test "$build_old_libs" = yes && old_library="$libname.$libext"
       $show "creating $output"
 
-      if test -n "$xrpath"; then
-	temp_xrpath=
-	for libdir in $xrpath; do
-	  temp_xrpath="$temp_xrpath -R$libdir"
-	done
-	dependency_libs="$temp_xrpath $dependency_libs"
-      fi
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+	if eval test -z \"\${$var+set}\"; then
+	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+	elif eval var_value=\$$var; test -z "$var_value"; then
+	  relink_command="$var=; export $var; $relink_command"
+	else
+	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
+	fi
+      done
+      # Quote the link command for shipping.
+      relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
+      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
       # Only create the output if not a dry run.
       if test -z "$run"; then
@@ -3103,6 +3949,45 @@
 	      break
 	    fi
 	    output="$output_objdir/$outputname"i
+	    # Replace all uninstalled libtool libraries with the installed ones
+	    newdependency_libs=
+	    for deplib in $dependency_libs; do
+	      case "$deplib" in
+	      *.la)
+		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+		eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		if test -z "$libdir"; then
+		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+		  exit 1
+		fi
+		newdependency_libs="$newdependency_libs $libdir/$name"
+		;;
+	      *) newdependency_libs="$newdependency_libs $deplib" ;;
+	      esac
+	    done
+	    dependency_libs="$newdependency_libs"
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit 1
+	      fi
+	      newdlfiles="$newdlfiles $libdir/$name"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+	      eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+	      if test -z "$libdir"; then
+		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+		exit 1
+	      fi
+	      newdlprefiles="$newdlprefiles $libdir/$name"
+	    done
+	    dlprefiles="$newdlprefiles"
 	  fi
 	  $rm $output
 	  $echo > $output "\
@@ -3132,16 +4017,23 @@
 # Is this an already installed library?
 installed=$installed
 
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
 # Directory that this library needs to be installed in:
-libdir='$install_libdir'\
-"
+libdir='$install_libdir'"
+	  if test "$installed" = no && test $need_relink = yes; then
+	    $echo >> $output "\
+relink_command=\"$relink_command\""
+	  fi
 	done
       fi
 
       # Do a symbolic link so that the libtool archive can be found in
       # LD_LIBRARY_PATH before the program is installed.
       $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
-      $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
+      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
       ;;
     esac
     exit 0
@@ -3153,7 +4045,9 @@
 
     # There may be an optional sh(1) argument at the beginning of
     # install_prog (especially on Windows NT).
-    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
       # Aesthetically quote it.
       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
       case "$arg" in
@@ -3298,7 +4192,7 @@
 
       # Do each installation.
       case "$file" in
-      *.a | *.lib)
+      *.$libext)
 	# Do the static libraries later.
 	staticlibs="$staticlibs $file"
 	;;
@@ -3314,6 +4208,7 @@
 
 	library_names=
 	old_library=
+	relink_command=
 	# If there is no directory component, then add one.
 	case "$file" in
 	*/* | *\\*) . $file ;;
@@ -3334,10 +4229,20 @@
 	  esac
 	fi
 
-	dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
+	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
 	test "X$dir" = "X$file/" && dir=
 	dir="$dir$objdir"
 
+	if test -n "$relink_command"; then
+	  $echo "$modename: warning: relinking \`$file'" 1>&2
+	  $show "$relink_command"
+	  if $run eval "$relink_command"; then :
+	  else
+	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+	    continue
+	  fi
+	fi
+
 	# See the names of the shared library.
 	set dummy $library_names
 	if test -n "$2"; then
@@ -3345,9 +4250,16 @@
 	  shift
 	  shift
 
+	  srcname="$realname"
+	  test -n "$relink_command" && srcname="$realname"T
+
 	  # Install the shared library and build the symlinks.
-	  $show "$install_prog $dir/$realname $destdir/$realname"
-	  $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
+	  $show "$install_prog $dir/$srcname $destdir/$realname"
+	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+	  if test -n "$stripme" && test -n "$striplib"; then
+	    $show "$striplib $destdir/$realname"
+	    $run eval "$striplib $destdir/$realname" || exit $?
+	  fi
 
 	  if test $# -gt 0; then
 	    # Delete the old symlinks, and create new ones.
@@ -3398,7 +4310,7 @@
 	*.lo)
 	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
 	  ;;
-	*.o | *.obj)
+	*.$objext)
 	  staticdest="$destfile"
 	  destfile=
 	  ;;
@@ -3437,7 +4349,7 @@
 
 	# Do a test to see if this is really a libtool program.
 	if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-	  link_against_libtool_libs=
+	  uninst_deplibs=
 	  relink_command=
 
 	  # If there is no directory component, then add one.
@@ -3447,13 +4359,13 @@
 	  esac
 
 	  # Check the variables that should have been set.
-	  if test -z "$link_against_libtool_libs"; then
+	  if test -z "$uninst_deplibs"; then
 	    $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
 	    exit 1
 	  fi
 
 	  finalize=yes
-	  for lib in $link_against_libtool_libs; do
+	  for lib in $uninst_deplibs; do
 	    # Check to see that each library is installed.
 	    libdir=
 	    if test -f "$lib"; then
@@ -3463,13 +4375,20 @@
 	      *) . ./$lib ;;
 	      esac
 	    fi
-	    libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
+	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
 	    if test -n "$libdir" && test ! -f "$libfile"; then
 	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
 	      finalize=no
 	    fi
 	  done
 
+	  relink_command=
+	  # If there is no directory component, then add one.
+	  case "$file" in
+	  */* | *\\*) . $file ;;
+	  *) . ./$file ;;
+	  esac
+
 	  outputname=
 	  if test "$fast_install" = no && test -n "$relink_command"; then
 	    if test "$finalize" = yes && test -z "$run"; then
@@ -3481,6 +4400,7 @@
 		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
 		continue
 	      fi
+	      file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
 	      outputname="$tmpdir/$file"
 	      # Replace the output file specification.
 	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
@@ -3518,6 +4438,11 @@
       $show "$install_prog $file $oldlib"
       $run eval "$install_prog \$file \$oldlib" || exit $?
 
+      if test -n "$stripme" && test -n "$striplib"; then
+	$show "$old_striplib $oldlib"
+	$run eval "$old_striplib $oldlib" || exit $?
+      fi
+
       # Do each command in the postinstall commands.
       eval cmds=\"$old_postinstall_cmds\"
       IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
@@ -3731,8 +4656,8 @@
 
     if test -z "$run"; then
       if test -n "$shlibpath_var"; then
-        # Export the shlibpath_var.
-        eval "export $shlibpath_var"
+	# Export the shlibpath_var.
+	eval "export $shlibpath_var"
       fi
 
       # Restore saved enviroment variables
@@ -3751,20 +4676,24 @@
     else
       # Display what would be done.
       if test -n "$shlibpath_var"; then
-        eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
-        $echo "export $shlibpath_var"
+	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+	$echo "export $shlibpath_var"
       fi
       $echo "$cmd$args"
       exit 0
     fi
     ;;
 
-  # libtool uninstall mode
-  uninstall)
-    modename="$modename: uninstall"
+  # libtool clean and uninstall mode
+  clean | uninstall)
+    modename="$modename: $mode"
     rm="$nonopt"
     files=
 
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
     for arg
     do
       case "$arg" in
@@ -3781,8 +4710,14 @@
 
     for file in $files; do
       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
-      test "X$dir" = "X$file" && dir=.
+      if test "X$dir" = "X$file"; then
+	dir=.
+	objdir="$objdir"
+      else
+	objdir="$dir/$objdir"
+      fi
       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+      test $mode = uninstall && objdir="$dir"
 
       rmfiles="$file"
 
@@ -3794,55 +4729,77 @@
 
 	  # Delete the libtool libraries and symlinks.
 	  for n in $library_names; do
-	    rmfiles="$rmfiles $dir/$n"
+	    rmfiles="$rmfiles $objdir/$n"
 	  done
-	  test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
+	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+	  test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
-	  $show "$rm $rmfiles"
-	  $run $rm $rmfiles
-
-	  if test -n "$library_names"; then
-	    # Do each command in the postuninstall commands.
-	    eval cmds=\"$postuninstall_cmds\"
-	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
-	    for cmd in $cmds; do
+	  if test $mode = uninstall; then
+	    if test -n "$library_names"; then
+	      # Do each command in the postuninstall commands.
+	      eval cmds=\"$postuninstall_cmds\"
+	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		$show "$cmd"
+		$run eval "$cmd"
+	      done
 	      IFS="$save_ifs"
-	      $show "$cmd"
-	      $run eval "$cmd"
-	    done
-	    IFS="$save_ifs"
-	  fi
+	    fi
 
-	  if test -n "$old_library"; then
-	    # Do each command in the old_postuninstall commands.
-	    eval cmds=\"$old_postuninstall_cmds\"
-	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
-	    for cmd in $cmds; do
+	    if test -n "$old_library"; then
+	      # Do each command in the old_postuninstall commands.
+	      eval cmds=\"$old_postuninstall_cmds\"
+	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
+	      for cmd in $cmds; do
+		IFS="$save_ifs"
+		$show "$cmd"
+		$run eval "$cmd"
+	      done
 	      IFS="$save_ifs"
-	      $show "$cmd"
-	      $run eval "$cmd"
-	    done
-	    IFS="$save_ifs"
+	    fi
+	    # FIXME: should reinstall the best remaining shared library.
 	  fi
-
-	  # FIXME: should reinstall the best remaining shared library.
 	fi
 	;;
 
       *.lo)
-	if test "$build_old_libs" = yes; then
-	  oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
-	  rmfiles="$rmfiles $dir/$oldobj"
+	# Possibly a libtool object, so verify it.
+	if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+
+          # Read the .lo file
+          . ./$file
+
+	  # Add PIC object to the list of files to remove.
+          if test -n "$pic_object" \
+             && test "$pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$pic_object"
+          fi
+
+	  # Add non-PIC object to the list of files to remove.
+          if test -n "$non_pic_object" \
+             && test "$non_pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$non_pic_object"
+          fi
 	fi
-	$show "$rm $rmfiles"
-	$run $rm $rmfiles
 	;;
 
       *)
-	$show "$rm $rmfiles"
-	$run $rm $rmfiles
+	# Do a test to see if this is a libtool program.
+	if test $mode = clean &&
+	   (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+	  relink_command=
+	  . $dir/$file
+
+	  rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+	  if test "$fast_install" = yes && test -n "$relink_command"; then
+	    rmfiles="$rmfiles $objdir/lt-$name"
+	  fi
+	fi
 	;;
       esac
+      $show "$rm $rmfiles"
+      $run $rm $rmfiles
     done
     exit 0
     ;;
@@ -3875,10 +4832,12 @@
     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
     --quiet           same as \`--silent'
     --silent          don't print informational messages
+    --tag=TAG         use configuration variables from tag TAG
     --version         print version information
 
 MODE must be one of the following:
 
+      clean           remove files from the build directory
       compile         compile a source file into a libtool object
       execute         automatically set library path, then run a program
       finish          complete the installation of libtool libraries
@@ -3891,6 +4850,20 @@
   exit 0
   ;;
 
+clean)
+  $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+  ;;
+
 compile)
   $echo \
 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
@@ -3979,6 +4952,8 @@
   -LLIBDIR          search LIBDIR for required installed libraries
   -lNAME            OUTPUT-FILE requires the installed library libNAME
   -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
   -no-undefined     declare that a library does not refer to external symbols
   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
   -release RELEASE  specify package release information
@@ -4031,6 +5006,14 @@
 
 exit 0
 
+### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+### END LIBTOOL TAG CONFIG: disable-shared
+
+### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=no
+### END LIBTOOL TAG CONFIG: disable-static
+
 # Local Variables:
 # mode:shell-script
 # sh-indentation:2
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 201f3d2..cd9239c 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,11 +1,505 @@
-2000-06-02  Kazu Hirata  <kazu@hxi.com>=0A=
+2000-12-21  Santeri Paavolainen <santtu@ssh.com>
+
+	* cgen-opc.c: Include alloca.h if HAVE_ALLOCA_H is defined.
+
+2000-12-16  Nick Clifton  <nickc@redhat.com>
+
+	* Makefile.in: Regenerate.
+	* aclocal.m4: Regenerate.
+	* config.in: Regenerate.
+	* configure.in: Add spacing.
+	* configure: Regenerate.
+	* ia64-asmtab.c: Regenerate.
+	* po/opcodes.pot: Regenerate.
+
+2000-12-12  Frank Ch. Eigler  <fche@redhat.com>
+
+	* cgen-asm.in (@arch@_cgen_assemble_insn): Prefer printing insert-time
+	error messages over later parse-time ones.
+
+2000-12-12  Jim Wilson  <wilson@redhat.com>
+
+	* ia64-dis.c (print_insn_ia64): Cast away const on ia64_free_opcode
+	argument.
+	* ia64_gen.c (insert_deplist): Cast sizeof result to int.
+	(print_dependency_table): Print NULL if semantics field not set.
+	(insert_opcode_dependencies): Mark cmp parameter as unused.
+	(print_main_table): Use fprintf_vma to print long long fields.
+	(main): Mark argv paramter as unused.  Convert to old style definition.
+	* ia64-opc.c (ia64_find_dependency): Cast sizeof result to int.
+	* ia64-asmtab.c: Regnerate.
+
+2000-12-09  Nick Clifton  <nickc@redhat.com>
+
+	* m32r-dis.c (print_insn): Prevent re-read of instruction from
+	wrong address.
+
+	* fr30-dis.c: Regenerate.
+
+2000-12-08  Peter Targett  <peter.targett@arccores.com>
+
+	* configure.in: Add arc-ext.lo for bfd_arc_arch selection.
+	* Makefile.am (C_FILES): Add arc-ext.c.
+	(ALL_MACHINES) Add arc-ext.lo.
+	(INCLUDES) Add opcode directory to list.
+	New dependency entry for arc-ext.lo.
+	* disassemble.c (disassembler): Correct call to
+	arc_get_disassembler.
+	* arc-opc.c: New update for ARC, including full base
+	instructions for ARC variants.
+	* arc-dis.h, arc-dis.c: New update for ARC, including
+	extensibility functionality.
+	* arc-ext.h, arc-ext.c: New files for handling extensibility.
+
+2000-12-03  Chris Demetriou   cgd@sibyte.com
+
+        * mips-opc.c (mips_builtin_opcodes): Use the WR_HILO, RD_HILO,
+        MOD_HILO, and MOD_LO macros.
+
+        * mips-opc.c (M1, M2): Delete.
+        (mips_builtin_opcodes): Remove all uses of M1.
+
+        * mips-opc.c (mips_builtin_opcodes): Make the dmfc2 and dmtc2
+        instructions take "G" format second operands and use the
+        correct flags.
+        There are mfc3 and mtc3 opcodes, so add dmfc3 and dmtc3 opcodes to
+	match.
+        Delete "sel" code operands from mfc1 and mtc1.
+        Add MIPS64 opcode changes (dclo, dclz), and "sel" code variants
+	for dm[ft]c[023].
+	
+2000-12-03  Ed Satterthwaite  ehs@sibyte.com  and
+            Chris Demetriou   cgd@sibyte.com
+
+        * mips-opc.c (mips_builtin_opcodes): Finish additions
+        for MIPS32 support, and clean up existing entries for
+        aesthetics, consistency with the MIPS32 ISA, and
+        with consistency the rest of the table.
+
+2000-12-01  Nick Clifton  <nickc@redhat.com>
+
+	* mips16-opc.c (mips16_opcodes): Add initialiser for membership
+	field.
+
+2000-12-01  Chris Demetriou <cgd@sibyte.com>
+
+        mips-dis.c (print_insn_arg): Handle new 'U' and 'J' argument
+        specifiers.  Update 'B' for new constant names, and remove
+        'm'.
+        mips-opc.c (mips_builtin_opcodes): Place "pref" and "ssnop"
+        near the top of the array, so they are disassembled properly.
+        Enable "ssnop" for MIPS32.  Add "break" variant with 20 bit
+        code for MIPS32.  Update "clo" and "clz" to use 'U' operand
+        specifier.  Add 'H' format specifier variants for "mfc1,"
+        "mfc2," "mfc3," "mtc1," "mtc2," and "mtc3" for MIPS32.  Update
+        MIPS32 "sdbbp" to use 'B' operand specifier.  Add MIPS32
+        "wait" variant which uses 'J' operand specifier.
+        
+        * mips-dis.c (set_mips_isa_type): Update to use
+        CPU_UNKNOWN and ISA_* constants.  Add bfd_mach_mips32 case.
+        Replace bfd_mach_mips4K with bfd_mach_mips32_4k case.
+        * mips-opc.c (I32): New constant for instructions added in
+        MIPS32.
+        (P4): Delete.
+        (mips_builtin_opcodes) Replace all uses of P4 with I32.
+
+        * mips-dis.c (set_mips_isa_type): Add cases for
+        bfd_mach_mips5 and bfd_mach_mips64.
+        * mips-opc.c (I64): New definitions.
+
+        * mips-dis.c (set_mips_isa_type): Add case for
+        bfd_mach_mips_sb1.
+
+2000-11-28  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* sh-dis.c (print_insn_ddt): Make insn_x, insn_y unsigned.
+	(print_insn_ppi): Make nib1, nib2, nib3 unsigned.
+	Initialize variable dc to NULL.
+	(print_insn_shx): Remove unused label d_reg_n.
+
+2000-11-24  Nick Clifton  <nickc@redhat.com>
+
+	* arm-opc.h: Add new opcode formatting parameter 'B'.
+	(arm_opcodes): Add XScale, v5, and v5te	instructions.
+	(thumb_opcodes): Add v5t instructions.
+
+	* arm-dis.c (print_insn_arm): Handle new 'B' format
+	parameter.
+	(print_insn_thumb): Decode BLX(1) instruction.
+
+2000-11-21  Chris Demetriou  <cgd@sibyte.com>
+
+	* mips-opc.c: Fix file header comment.
+
+2000-11-14  Hans-Peter Nilsson  <hp@axis.com>
+
+	* cris-dis.c (cris_get_disassembler): If abfd is NULL, return
+	print_insn_cris_with_register_prefix.
+
+2000-11-11  Alexandre Oliva  <aoliva@redhat.com>
+
+	* sh-opc.h: The operand of `mov.w r0, (<disp>,GBR)' is IMM1, not 0.
+
+2000-11-07  Matthew Green  <mrg@redhat.com>
+
+	* cgen-dis.in (print_insn): All insns which can fit into insn_value
+	must be loaded there in their entirety.
+
+2000-10-20  Jakub Jelinek  <jakub@redhat.com>
+
+	* sparc-dis.c (v9a_asr_reg_names): Add v9b ASRs.
+	(compute_arch_mask): Add v8plusb and v9b machines.
+	(print_insn_sparc): siam mode decoding, accept ASRs up to 25.
+	* opcodes/sparc-opc.c: Support for Cheetah instruction set.
+	(prefetch_table): Add #invalidate.
+
+2000-10-16  Nick Clifton  <nickc@redhat.com>
+
+	* mcore-dis.c (imsk): Change mask for OC to 0xFE00.
+
+2000-10-06  Dave Brolley  <brolley@redhat.com>
+
+	* fr30-desc.h: Regenerate.
+	* m32r-desc.h: Regenerate.
+	* m32r-ibld.c: Regenerate.
+
+2000-10-05  Jim Wilson  <wilson@cygnus.com>
+
+	* ia64-ic.tbl: Update from Intel.
+	* ia64-asmtab.c: Regenerate.
+	
+2000-10-04  Kazu Hirata  <kazu@hxi.com>
+
+	* ia64-gen.c: Convert C++-style comments to C-style comments.
+	* tic54x-dis.c: Likewise.
+
+2000-09-29  Hans-Peter Nilsson  <hp@axis.com>
+
+	Changes to add dollar prefix to registers for files where user symbols
+	don't have a leading underscore.  Fix formatting.
+	* cris-dis.c (REGISTER_PREFIX_CHAR): New.
+	(format_reg): Add parameter with_reg_prefix.  All callers changed.
+	(print_with_operands): Ditto.
+	(print_insn_cris_generic): Renamed from print_insn_cris, add
+	parameter with_reg_prefix.
+	(print_insn_cris_with_register_prefix,
+	print_insn_cris_without_register_prefix, cris_get_disassembler):
+	New.
+	* disassemble.c (disassembler) [ARCH_cris]: Call cris_get_disassembler.
+
+2000-09-22  Jim Wilson  <wilson@cygnus.com>
+
+	* ia64-opc-f.c (ia64_opcodes_f): Add fpcmp pseudo-ops for
+	gt, ge, ngt, and nge.
+	* ia64-asmtab.c: Regenerate.
+
+	* ia64-dis.c (print_insn_ia64): Revert Aug 7 byte skip count change.
+	* ia64-gen.c (parse_semantics): Handle IA64_DVS_STOP.
+	(lookup_specifier): Handle "PR%, 1 to 15" and "PR%, 16 to 62".
+	* ia64-ic.tbl, ia64-raw.tbl, ia64-war.tbl, ia64-waw.tbl: Update.
+	* ia64-asmtab.c: Regnerate.
+
+2000-09-13  Anders Norlander  <anorland@acc.umu.se>
+	
+ 	* mips-opc.c (mips_builtin_opcodes): Support cache instruction on 4K cores.
+ 	Add mfc0 and mtc0 with sub-selection values.
+	Add clo and clz opcodes.
+ 	Add msub and msubu instructions for MIPS32.
+ 	Add madd/maddu aliases for mad/madu for MIPS32.
+ 	Support wait, deret, eret, movn, pref for MIPS32.
+	Support tlbp, tlbr, tlbwi, tlbwr.
+ 	(P4): New define.
+ 
+ 	* mips-dis.c (print_insn_arg): Print sdbbp 'm' args.
+ 	(print_insn_arg): Handle 'H' args.
+ 	(set_mips_isa_type): Recognize 4K.
+	Use CPU_* defines instead of hardcoded numbers.
+
+2000-09-11  Catherine Moore <clm@redhat.com>
+
+	* d30v-opc.c (d30v_operand_t): New operand type Rb2.
+	(d30v_format_tab): Use Rb2 for modinc and moddec.
+ 
+2000-09-07  Catherine Moore  <clm@redhat.com>
+ 
+        * d30v-opc.c (d30v_format_tab): Use format Ra for
+        modinc and moddec.
+
+2000-09-06  Alexandre Oliva  <aoliva@redhat.com>
+
+	* configure: Rebuilt with new libtool.m4.
+
+2000-09-05  Nick Clifton  <nickc@redhat.com>
+
+	* configure: Regenerate.
+	* po/opcodes.pot: Regenerate.
+	
+2000-08-31  Alexandre Oliva  <aoliva@redhat.com>
+
+	* acinclude.m4: Include libtool and gettext macros from the
+	top level.
+	* aclocal.m4, configure: Rebuilt.
+
+2000-08-30  Kazu Hirata  <kazu@hxi.com>
+
+	* tic80-dis.c: Fix formatting.
+
+2000-08-29  Kazu Hirata  <kazu@hxi.com>
+
+	* w65-dis.c: Fix formatting.
+
+2000-08-28  Mark Hatle  <mhatle@mvista.com>
+
+	* ppc-opc.c: Add XTLB macro for a few PPC 4xx extended mnemonics.
+	(powerpc_opcodes): Add table entries for PPC 405 instructions.
+	Changed rfci, icbt, mfdcr, dccci, mtdcr, iccci from PPC to PPC403
+	instructions.  Added extended mnemonic mftbl as defined in the
+	405GP manual for all PPCs.
+
+2000-08-28  Jim Wilson  <wilson@cygnus.com>
+
+	* ia64-dis.c (print_insn_ia64): Add failed label after ia64_free_opcode
+	call.  Change last goto to use failed instead of done.
+
+2000-08-28  Dave Brolley  <brolley@redhat.com>
+
+	* cgen-ibld.in (cgen_put_insn_int_value): New function.
+	(insert_normal): Allow for non-zero word_offset with CGEN_INT_INSN_P.
+	(insert_insn_normal): Use cgen_put_insn_int_value with CGEN_INT_INSN_P.
+	(extract_normal): Allow for non-zero word_offset with CGEN_INT_INSN_P.
+	* cgen-dis.in (read_insn): New static function.
+	(print_insn): Use read_insn to read the insn into the buffer and set
+	up for disassembly.
+	(print_insn): in CGEN_INT_INSN_P, make sure that the entire insn is
+	in the buffer.
+	* fr30-asm.c: Regenerated.
+	* fr30-desc.c: Regenerated.
+	* fr30-desc.h Regenerated.
+	* fr30-dis.c: Regenerated.
+	* fr30-ibld.c: Regenerated.
+	* fr30-opc.c: Regenerated.
+	* fr30-opc.h Regenerated.
+	* m32r-asm.c: Regenerated.
+	* m32r-desc.c: Regenerated.
+	* m32r-desc.h Regenerated.
+	* m32r-dis.c: Regenerated.
+	* m32r-ibld.c: Regenerated.
+	* m32r-opc.c: Regenerated.
+
+2000-08-28  Kazu Hirata  <kazu@hxi.com>
+
+	* tic30-dis.c: Fix formatting.
+
+2000-08-27  Kazu Hirata  <kazu@hxi.com>
+
+	* sh-dis.c: Fix formatting.
+
+2000-08-24  David Edelsohn  <dje@watson.ibm.com>
+
+	* ppc-opc.c (powerpc_opcodes): Add rfid, mtsrd, mtsrdin, mtmsrd.
+
+2000-08-24  Kazu Hirata  <kazu@hxi.com>
+
+	* z8k-dis.c: Fix formatting.
+
+2000-08-16  Jim Wilson  <wilson@cygnus.com>
+
+	* ia64-ic.tbl (pr-readers-nobr-nomovpr): Add addl, adds.  Delete
+	break, mov-immediate, nop.
+	* ia64-opc-f.c: Delete fpsub instructions.
+	* ia64-opc-m.c: Add POSTINC to all instructions with postincrement
+	address operand.  Rewrite using macros to avoid long lines.
+	* ia64-opc.h (POSTINC): Define.
+	* ia64-asmtab.c: Regenerate.
+
+2000-08-15  Jim Wilson  <wilson@cygnus.com>
+
+	* ia64-ic.tbl: Add missing entries.
+
+2000-08-08  Jason Eckhardt  <jle@cygnus.com>
+
+	* i860-dis.c (print_br_address): Change third argument from int
+	to long.
+
+2000-08-07  Richard Henderson  <rth@cygnus.com>
+
+	* ia64-dis.c (print_insn_ia64): Get byte skip count correct
+	for MLI templates.  Handle IA64_OPND_TGT64.
+
+2000-08-04  Ben Elliston  <bje@redhat.com>
+
+	* cgen-dis.in, cgen-asm.in, cgen-ibld.in: New files.
+	* cgen.sh: Likewise.
+
+2000-08-02  Jim Wilson  <wilson@cygnus.com>
+	
+	* ia64-dis.c (print_insn_ia64): Call ia64_free_opcode at end.
+
+2000-07-29  Marek Michalkiewicz  <marekm@linux.org.pl>
+
+	* avr-dis.c (avr_operand): Use PARAMS macro in declaration.
+	Change return type from void to int.  Check the combination
+	of operands, return 1 if valid.  Fix to avoid BUF overflow.
+	Report undefined combinations of operands in COMMENT.
+	Report internal errors to stderr.  Output the adiw/sbiw
+	constant operand in both decimal and hex.
+	(print_insn_avr): Disassemble ldd/std with displacement of 0
+	as ld/st.  Check avr_operand () return value, handle invalid
+	combinations of operands like unknown opcodes.
+
+2000-07-28  Ben Elliston  <bje@redhat.com>
+
+	* Makefile.am (CGEN, CGENDEPS, CGENDIR, CGENFLAGS): New.
+	(run-cgen, stamp-m32r, stamp-fr30): New targets.
+	* Makefile.in: Regenerate.
+	* configure.in: Add --enable-cgen-maint option.
+	* configure: Regenerate.
+
+2000-07-26  Dave Brolley  <brolley@redhat.com>
+
+	* cgen-opc.c (cgen_hw_lookup_by_name): 'i' is now unsigned.
+	(cgen_hw_lookup_by_num): Ditto.
+	(cgen_operand_lookup_by_name): Ditto.
+	(print_address): Ditto.
+	(print_keyword): Ditto.
+	* cgen-dis.c (hash_insn_array): Mark unused parameters with
+	ATTRIBUTE_UNUSED.
+	* cgen-asm.c (hash_insn_array): Mark unused parameters with
+	ATTRIBUTE_UNUSED.
+	(cgen_parse_keyword): Ditto.
+
+2000-07-22  Jason Eckhardt  <jle@cygnus.com>
+
+	* i860-dis.c: New file.
+	(print_insn_i860): New function.
+	(print_br_address): New function.
+	(sign_extend): New function.
+	(BITWISE_OP): New macro.
+	(I860_REG_PREFIX): New macro.
+	(grnames, frnames, crnames): New structures.
+
+	* disassemble.c (ARCH_i860): Define.
+	(disassembler): Add check for bfd_arch_i860 to set disassemble
+	function to print_insn_i860.
+
+	* Makefile.in (CFILES): Added i860-dis.c.
+	(ALL_MACHINES): Added i860-dis.lo.
+	(i860-dis.lo): New dependences.
+
+	* configure.in: New bits for bfd_i860_arch.
+
+	* configure: Regenerated.
+
+2000-07-20  Hans-Peter Nilsson  <hp@axis.com>
+
+	* Makefile.am (CFILES): Add cris-dis.c and cris-opc.c.
+	(ALL_MACHINES): Add cris-dis.lo and cris-opc.lo.
+	(cris-dis.lo, cris-opc.lo): New rules.
+	* Makefile.in: Rebuild.
+	* configure.in (bfd_cris_arch): New target.
+	* configure: Rebuild.
+	* disassemble.c (ARCH_cris): Define.
+	(disassembler): Support ARCH_cris.
+	* cris-dis.c, cris-opc.c: New files.
+	* po/POTFILES.in, po/opcodes.pot: Regenerate.
+
+2000-07-11  Jakub Jelinek  <jakub@redhat.com>
+
+	* sparc-opc.c (sparc_opcodes): popc has 0 in rs1, not rs2.
+	Reported by Bill Clarke <llib@computer.org>.
+
+2000-07-09  Geoffrey Keating  <geoffk@cygnus.com>
+
+	* ppc-opc.c (powerpc_opcodes): Correct suffix for vslw.
+	Patch by Randall J Fisher <rfisher@ecn.purdue.edu>.
+
+2000-07-09  Alan Modra  <alan@linuxcare.com.au>
+
+	* hppa-dis.c (fput_reg, fput_fp_reg, fput_fp_reg_r, fput_creg,
+	fput_const, extract_3, extract_5_load, extract_5_store,
+	extract_5r_store, extract_5R_store, extract_10U_store,
+	extract_5Q_store, extract_11, extract_14, extract_16, extract_21,
+	extract_12, extract_17, extract_22): Prototype.
+	(print_insn_hppa): Rename inner block opcode -> opc to avoid
+	shadowing outer block.
+	(GET_BIT): Define.
+
+2000-07-05  DJ Delorie  <dj@redhat.com>
+
+	* MAINTAINERS: new
+
+2000-07-04  Alexandre Oliva  <aoliva@redhat.com>
+
+	* arm-dis.c (print_insn_arm): Output combinations of PSR flags.
+
+2000-07-03  Marek Michalkiewicz  <marekm@linux.org.pl>
+
+	* avr-dis.c (avr_operand): Change _ () to _() around all strings
+	marked for translation (exception from the usual coding style).
+	(print_insn_avr): Initialize insn2 to avoid warnings.
+
+2000-07-03  Kazu Hirata  <kazu@hxi.com>
+
+	* h8300-dis.c (bfd_h8_disassemble): Improve readability.
+	* h8500-dis.c: Fix formatting.
+
+2000-07-01  Alan Modra  <alan@linuxcare.com.au>
+
+	* Makefile.am (DEP): Fix 2000-06-22.  grep after running dep.sed
+	(CLEANFILES): Add DEPA.
+	* Makefile.in: Regenerate.
+
+2000-06-26  Scott Bambrough  <scottb@netwinder.org>
+
+	* arm-dis.c (regnames): Add an additional register set to match
+	the set used by GCC.  Make it the default.
+
+2000-06-22  Alan Modra  <alan@linuxcare.com.au>
+
+	* Makefile.am (DEP): grep for leading `/' in DEP1, and fail if we
+	find one.
+	* Makefile.in: Regenerate.
+
+2000-06-20  H.J. Lu  <hjl@gnu.org>
+
+	* Makefile.am: Rebuild dependency.
+	* Makefile.in: Rebuild.
+
+2000-06-18  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* Makefile.in, configure: regenerate
+	* disassemble.c (disassembler): Recognize ARCH_m68hc12, 
+	ARCH_m68hc11.
+	* m68hc11-dis.c (read_memory, print_insn, print_insn_m68hc12): 
+	New functions.
+	* configure.in: Recognize m68hc12 and m68hc11.
+	* m68hc11-dis.c, m68hc11-opc.c: New files for support of m68hc1x
+	* Makefile.am (CFILES, ALL_MACHINES): New files for disassembly 
+	and opcode generation for m68hc11 and m68hc12.
+
+2000-06-16  Nick Duffek  <nsd@redhat.com>
+
+	* disassemble.c (disassembler): Refer to the PowerPC 620 using
+	bfd_mach_ppc_620 instead of 620.
+
+2000-06-12  Kazu Hirata  <kazu@hxi.com>
+
+	* h8300-dis.c: Fix formatting.
+	(bfd_h8_disassemble): Distinguish adds/subs, inc/dec.[wl]
+	correctly.
+
+Fri Jun  9 21:49:02 2000  Denis Chertykov  <denisc@overta.ru>
+
+	* avr-dis.c (avr_operand): Bugfix for jmp/call address.
+
+Wed Jun  7 21:36:45 2000  Denis Chertykov  <denisc@overta.ru>
+
+	* avr-dis.c: completely rewritten.
+
+2000-06-02  Kazu Hirata  <kazu@hxi.com>
 
 	* h8300-dis.c: Follow the GNU coding style.
 	(bfd_h8_disassemble) Fix a typo.
-	
-2000-06-02  Nick Clifton  <nickc@cygnus.com>
-
-	* h8300-dis.c (bfd_h8_disassemble): 
 
 2000-06-01  Kazu Hirata  <kazu@hxi.com>
 
@@ -70,9 +564,9 @@
 
 2000-05-11  Thomas de Lellis  <tdel@windriver.com>
 
-        * arm-opc.c: Disassembly of thumb ldsb/ldsh
-        instructions changed to ldrsb/ldrsh.
-	
+	* arm-opc.c: Disassembly of thumb ldsb/ldsh
+	instructions changed to ldrsb/ldrsh.
+
 2000-05-11  Ulf Carlsson  <ulfc@engr.sgi.com>
 
 	* mips-dis.c (print_insn_arg): Don't mask top 32 bits of 64-bit
@@ -96,12 +590,12 @@
 	* configure.in: Added tic54x target.
 	* configure: Ditto.
 	* Makefile.am: Add tic54x dependencies.
-	* Makefile.in: Ditto. 
+	* Makefile.in: Ditto.
 
 2000-05-03  J.T. Conklin  <jtc@redback.com>
 
 	* ppc-opc.c (VA, VB, VC, VD, VS, SIMM, UIMM, SHB): New macros, for
- 	vector unit operands.
+	vector unit operands.
 	(VX, VX_MASK, VXA, VXA_MASK, VXR, VXR_MASK): New macros, for vector
 	unit instruction formats.
 	(PPCVEC): New macro, mask for vector instructions.
@@ -112,6 +606,17 @@
 	(print_insn_little_powerpc): Likewise.
 	(print_insn_powerpc): Prepend 'v' when printing vector registers.
 
+Mon Apr 24 15:21:35 2000  Clinton Popetz  <cpopetz@cygnus.com>
+
+	* configure.in: Add bfd_powerpc_64_arch.
+	* disassemble.c (disassembler): Use print_insn_big_powerpc for
+	64 bit code.
+
+2000-04-24  Nick Clifton  <nickc@cygnus.com>
+
+	* fr30-desc.c (fr30_cgen_cpu_open): Initialise signed_overflow
+	field.
+
 Sun Apr 23 17:54:14 2000  Denis Chertykov  <denisc@overta.ru>
 
 	* avr-dis.c (reg_fmul_d): New. Extract destination register from
@@ -124,17 +629,6 @@
 	(print_insn_avr): Handle MOVW, MULS, MULSU, FMUL, FMULS, FMULSU,
 	EICALL, EIJMP, LPM r,Z, ELPM r,Z, SPM, ESPM instructions.
 
-Mon Apr 24 15:21:35 2000  Clinton Popetz  <cpopetz@cygnus.com>
-
-	* configure.in: Add bfd_powerpc_64_arch.
-	* disassemble.c (disassembler): Use print_insn_big_powerpc for
-	64 bit code.
-
-2000-04-24  Nick Clifton  <nickc@cygnus.com>
-
-	* fr30-desc.c (fr30_cgen_cpu_open): Initialise signed_overflow
-	field. 
-
 2000-04-22  Timothy Wall  <twall@cygnus.com>
 
 	* ia64-gen.c (general): Add an ordered table of primary
@@ -151,7 +645,7 @@
 	the highest priority.
 	* ia64-opc-b.c: Use more abbreviations.
 	* ia64-asmtab.c: Regenerate.
-	
+
 Fri Apr 21 16:03:39 2000  Jason Eckhardt  <jle@cygnus.com>
 
 	* hppa-dis.c (extract_16): New function.
@@ -180,7 +674,7 @@
 	ia64-opc-a.c, ia64-opc-b.c, ia64-opc-d.c ia64-opc-f.c, ia64-opc-i.c,
 	ia64-opc-m.c, ia64-opc-x.c, ia64-opc.c, ia64-opc.h, ia64-raw.tbl,
 	ia64-war.tbl, ia64-waw.tbl): New files.
-	
+
 2000-04-20  Alexandre Oliva  <aoliva@cygnus.com>
 
 	* m10300-dis.c (HAVE_AM30, HAVE_AM33): Define.
@@ -206,9 +700,9 @@
 	ansidecl.h as sysdep.h includes it.
 
 Fri Apr  7 15:56:57 2000  Andrew Cagney  <cagney@b1.cygnus.com>
- 
+
 	* configure.in (WARN_CFLAGS): Set to -W -Wall by default.  Add
- 	--enable-build-warnings option.
+	--enable-build-warnings option.
 	* Makefile.am (AM_CFLAGS, WARN_CFLAGS): Add definitions.
 	* Makefile.in, configure: Re-generate.
 
@@ -294,24 +788,24 @@
 
 2000-03-02  J"orn Rennecke <amylaar@cygnus.co.uk>
 
-        * d30v-dis.c (print_insn): Remove d*i hacks.  Use per-operand
-        flag to determine if operand is pc-relative.
-        * d30v-opc.c:
-        (d30v_format_table):
-        (REL6S3): Renamed from IMM6S3.
-        Added flag OPERAND_PCREL.
-        (REL12S3, REL18S3, REL32): Split from IMM12S3, IMM18S3, REL32, with
-        added flag OPERAND_PCREL.
-        (IMM12S3U): Replaced with REL12S3.
-        (SHORT_D2, LONG_D): Delay target is pc-relative.
-        (SHORT_B2r, SHORT_B3r, SHORT_B3br, SHORT_D2r, LONG_Ur, LONG_2r):
-        Split from SHORT_B2, SHORT_D2, SHORT_B3b, SHORT_D2, LONG_U, LONG_2r,
-        using the REL* operands.
-        (LONG_2br, LONG_Dr): Likewise, from LONG_2b, LONG_D.
-        (SHORT_D1r, SHORT_D2Br, LONG_Dbr): Renamed from SHORT_D1, SHORT_D2B,
-        LONG_Db, using REL* operands.
-        (SHORT_U, SHORT_A5S): Removed stray alternatives.
-        (d30v_opcode_table): Use new *r formats.
+	* d30v-dis.c (print_insn): Remove d*i hacks.  Use per-operand
+	flag to determine if operand is pc-relative.
+	* d30v-opc.c:
+	(d30v_format_table):
+	(REL6S3): Renamed from IMM6S3.
+	Added flag OPERAND_PCREL.
+	(REL12S3, REL18S3, REL32): Split from IMM12S3, IMM18S3, REL32, with
+	added flag OPERAND_PCREL.
+	(IMM12S3U): Replaced with REL12S3.
+	(SHORT_D2, LONG_D): Delay target is pc-relative.
+	(SHORT_B2r, SHORT_B3r, SHORT_B3br, SHORT_D2r, LONG_Ur, LONG_2r):
+	Split from SHORT_B2, SHORT_D2, SHORT_B3b, SHORT_D2, LONG_U, LONG_2r,
+	using the REL* operands.
+	(LONG_2br, LONG_Dr): Likewise, from LONG_2b, LONG_D.
+	(SHORT_D1r, SHORT_D2Br, LONG_Dbr): Renamed from SHORT_D1, SHORT_D2B,
+	LONG_Db, using REL* operands.
+	(SHORT_U, SHORT_A5S): Removed stray alternatives.
+	(d30v_opcode_table): Use new *r formats.
 
 2000-02-28  Nick Clifton  <nickc@cygnus.com>
 
@@ -332,7 +826,7 @@
 
 2000-02-23  Andrew Haley  <aph@cygnus.com>
 
-        * m32r-asm.c, m32r-desc.c, m32r-desc.h, m32r-dis.c,
+	* m32r-asm.c, m32r-desc.c, m32r-desc.h, m32r-dis.c,
 	m32r-ibld.c,m32r-opc.h: Rebuild.
 
 2000-02-23  Linas Vepstas <linas@linas.org>
@@ -414,12 +908,12 @@
 	* arm-dis.c (parse_arm_diassembler_option): Rename again.
 	Previous delat did not take.
 
-2000-02-03  Timothy Wall  <twall@redhat.com>	
-	
+2000-02-03  Timothy Wall  <twall@redhat.com>
+
 	* dis-buf.c (buffer_read_memory):  Use octets_per_byte field
 	to adjust target address bounds checking and calculate the
 	appropriate octet offset into data.
-	
+
 2000-01-27  Nick Clifton  <nickc@redhat.com>
 
 	* arm-dis.c: (parse_disassembler_option): Rename to
@@ -428,7 +922,7 @@
 	* disassemble.c (disassembler_usage): New function: Print out any
 	target specific disassembler options.
 	Call arm_disassembler_options() if the ARM architecture is being
-	supported.  
+	supported.
 
 	* arm-dis.c (NUM_ELEM): Define this macro if not already
 	defined.
@@ -441,18 +935,18 @@
 	(print_insn_little_arm): Call print_insn.
 	(print_arm_disassembler_options): Display list of supported,
 	ARM specific disassembler options.
-	  
+
 2000-01-27  Thomas de Lellis  <tdel@windriver.com>
 
-        * arm-dis.c (printf_insn_big_arm): Treat ELF symbols with the
+	* arm-dis.c (printf_insn_big_arm): Treat ELF symbols with the
 	ARM_STT_16BIT flag as Thumb code symbols.
-        
-        * arm-dis.c (printf_insn_little_arm): Ditto.
+
+	* arm-dis.c (printf_insn_little_arm): Ditto.
 
 2000-01-25  Thomas de Lellis  <tdel@windriver.com>
 
 	* arm-dis.c (printf_insn_thumb): Prevent double dumping
-        of raw thumb instructions.
+	of raw thumb instructions.
 
 2000-01-20  Nick Clifton  <nickc@cygnus.com>
 
@@ -520,7 +1014,7 @@
 
 1999-10-28  Nick Clifton  <nickc@cygnus.com>
 
-	* mcore-dis.c: Remove spurious code introduced in previous delta. 
+	* mcore-dis.c: Remove spurious code introduced in previous delta.
 
 1999-10-27  Scott Bambrough  <scottb@netwinder.org>
 
@@ -565,7 +1059,7 @@
 1999-09-29  Nick Clifton  <nickc@cygnus.com>
 
 	* sh-opc.h: Fix bit patterns for several load and store
-	instructions.  
+	instructions.
 
 Thu Sep 23 08:27:20 1999  Jerry Quinn <jerry.quinn.adv91@alum.dartmouth.org
 
@@ -656,7 +1150,7 @@
 
 Sat Aug 28 00:27:24 1999  Jerry Quinn <jquinn@nortelnetworks.com>
 
-        * hppa-dis.c (print_insn_hppa): Replace 'f' by 'v'.  Prefix float
+	* hppa-dis.c (print_insn_hppa): Replace 'f' by 'v'.  Prefix float
 	register args by 'f'.
 
 	* hppa-dis.c (print_insn_hppa): Add args q, %, !, and |.
@@ -669,7 +1163,7 @@
 	saturation_names):  New.
 	(print_insn_hppa): Add completer codes 'a', 'ch', 'cH', 'cS', and 'c*'.
 
-	* hppa-dis.c (print_insn_hppa): Place completers behind prefix 'c'. 
+	* hppa-dis.c (print_insn_hppa): Place completers behind prefix 'c'.
 
 	* hppa-dis.c (print_insn_hppa): Add cases for '.', '~'. '$'. and '!'
 
@@ -730,7 +1224,7 @@
 1999-07-05  Nick Clifton  <nickc@cygnus.com>
 
 	* arm-dis.c (print_insn_arm): Display hex equivalent of rotated
-	constant. 
+	constant.
 
 1999-06-23  Alan Modra  <alan@spri.levels.unisa.edu.au>
 
@@ -748,14 +1242,14 @@
 1999-06-16  Nick Clifton  <nickc@cygnus.com>
 
 	* arm-dis.c (print_insn_arm): Add detection of IMB and IMBRange
-	SWIs. 
+	SWIs.
 
 1999-06-14  Nick Clifton  <nickc@cygnus.com> & Drew Mosley <dmoseley@cygnus.com>
 
 	* arm-dis.c (arm_regnames): Turn into a pointer to a register
 	name set.
 	(arm_regnames_standard): New variable: Array of ARM register
-	names according to ARM instruction set nomenclature. 
+	names according to ARM instruction set nomenclature.
 	(arm_regnames_apcs): New variable: Array of ARM register names
 	according to ARM Procedure Call Standard.
 	(arm_regnames_raw): New variable: Array of ARM register names
@@ -1039,30 +1533,28 @@
 
 Mon Feb  1 20:54:36 1999  Catherine Moore  <clm@cygnus.com>
 
-        * disassemble.c (disassembler):  Handle bfd_mach_i386_i386_intel_syntax.
-        * i386-dis.c (x_mode):  Define.
-        (dis386):  Remove.
-        (dis386_att):  New.
-        (dis386_intel):  New.
-        (dis386_twobyte):  Remove.
-        (dis386_twobyte_att):  New.
-        (dis386_twobyte_intel):  New.
-        (print_insn_x86):  Use new arrays.
-        (float_mem):  Remove.
-        (float_mem_intel):  New.
-        (float_mem_att):  New.
-        (dofloat):  Use new float_mem arrays.
-        (print_insn_i386_att):  New.
-        (print_insn_i386_intel):  New.
-        (print_insn_i386):  Handle bfd_mach_i386_i386_intel_syntax.
-        (putop):  Handle intel syntax.
-        (OP_indirE):  Handle intel syntax.
-        (OP_E):  Handle intel syntax.
-        (OP_I):  Handle intel syntax.
-        (OP_sI):  Handle intel syntax.
-        (OP_OFF):  Handle intel syntax.
-
-
+	* disassemble.c (disassembler): Handle bfd_mach_i386_i386_intel_syntax.
+	* i386-dis.c (x_mode):  Define.
+	(dis386):  Remove.
+	(dis386_att):  New.
+	(dis386_intel):  New.
+	(dis386_twobyte):  Remove.
+	(dis386_twobyte_att):  New.
+	(dis386_twobyte_intel):  New.
+	(print_insn_x86):  Use new arrays.
+	(float_mem):  Remove.
+	(float_mem_intel):  New.
+	(float_mem_att):  New.
+	(dofloat):  Use new float_mem arrays.
+	(print_insn_i386_att):  New.
+	(print_insn_i386_intel):  New.
+	(print_insn_i386):  Handle bfd_mach_i386_i386_intel_syntax.
+	(putop):  Handle intel syntax.
+	(OP_indirE):  Handle intel syntax.
+	(OP_E):  Handle intel syntax.
+	(OP_I):  Handle intel syntax.
+	(OP_sI):  Handle intel syntax.
+	(OP_OFF):  Handle intel syntax.
 
 1999-01-27  Doug Evans  <devans@casey.cygnus.com>
 
@@ -1074,7 +1566,7 @@
 
 	* hppa-dis.c: revert HP merge changes until HP gives us
 	an updated file.
-	
+
 1999-01-19  Nick Clifton  <nickc@cygnus.com>
 
 	* arm-dis.c (print_insn_arm): Display ARM syntax for PC relative
@@ -1154,12 +1646,12 @@
 	* dis-buf.c (generic_strcat_address): new function.
 
 	* hppa-dis.c: Changes to improve hppa disassembly.
-	  Changed formatting in : reg_names, fp_reg_names,control_reg, 
+	  Changed formatting in : reg_names, fp_reg_names,control_reg,
 	  New variables : sign_extension_names, deposit_names, conversion_names
 	    float_test_names, compare_cond_names_double, add_cond_names_double,
-	    logical_cond_names_double, unit_cond_names_double, 
+	    logical_cond_names_double, unit_cond_names_double,
 	    branch_push_pop_names, saturation_names, shift_names, mix_names,
-	  New Macros :   GET_COMPL_O, GET_PUSH_POP,MERGED_REG 
+	  New Macros :   GET_COMPL_O, GET_PUSH_POP,MERGED_REG
 	  Move some definitions to libhppa.h: GET_FIELD, GET_BIT
 	  (fput_const): renamed as fput_hex_const
 	  (print_insn_hppa):
@@ -1169,11 +1661,11 @@
 	   - Some new code ifdefed for LOCAL_ONLY, all related to figuring out
 	     architecture version number of current machine. HP folks are
 	     trying to handle situation where the target program was compiled
-	     for PA 1.x (32-bit), but is running on a PA 2.0 machine and 
+	     for PA 1.x (32-bit), but is running on a PA 2.0 machine and
 	     visa versa.
 	   - added new cases : 'g', 'B', 'm'
 	   - added cases specifically for PA 2.0
-	   - changed the following cases : '"', 'n', 'N', 'p', 'Z', 
+	   - changed the following cases : '"', 'n', 'N', 'p', 'Z',
 	   - calls to fput_const become calls to fput_hex_const
 
 1998-12-07  James E Wilson  <wilson@wilson-pc.cygnus.com>
@@ -1186,7 +1678,7 @@
 	i960-dis.c to ta.
 	* i960-dis.c (print_insn_i960): Rename to print_insn_i960_orig.
 	* i960c-asm.c, i960c-dis.c, i960c-opc.c, i960c-opc.h: New files.
-	
+
 Mon Dec  7 14:33:44 1998  Dave Brolley  <brolley@cygnus.com>
 
 	* fr30-asm.c,fr30-dis.c,fr30-opc.c,fr30-opc.h: Regenerated.
@@ -1267,7 +1759,7 @@
 	* fr30-opc.c: Regenerated.
 
 Mon Nov 16 19:21:48 1998  Dave Brolley  <brolley@cygnus.com>
-	
+
 	* fr30-opc.c: Regenerated.
 	* fr30-opc.h: Regenerated.
 	* fr30-dis.c: Regenerated.
@@ -1284,7 +1776,7 @@
 Tue Nov 10 15:26:27 1998  Nick Clifton  <nickc@cygnus.com>
 
 	* disassemble.c (disassembler): Add support for FR30 target.
-	
+
 Tue Nov 10 11:00:04 1998  Doug Evans  <devans@canuck.cygnus.com>
 
 	* m32r-dis.c,m32r-opc.c,m32r-opc.h: Rebuild.
@@ -1317,8 +1809,8 @@
 
 Mon Nov  2 15:05:33 1998  Geoffrey Noer  <noer@cygnus.com>
 
-        * configure.in: detect cygwin* instead of cygwin32*
-        * configure: regenerate
+	* configure.in: detect cygwin* instead of cygwin32*
+	* configure: regenerate
 
 Tue Oct 27 08:58:37 1998  Gavin Romig-Koch  <gavin@cygnus.com>
 
@@ -1359,12 +1851,12 @@
 Thu Sep 24 09:20:03 1998  Nick Clifton  <nickc@cygnus.com>
 
 	* d30v-opc.c: Add FLAG_JSR attribute to DBT, REIT, RTD, and TRAP
-	insns. 
+	insns.
 
 Tue Sep 22 17:55:14 1998  Nick Clifton  <nickc@cygnus.com>
 
 	* d30v-opc.c: Add use of EITHER_BUT_PREFER_MU execution unit
-	class. 
+	class.
 
 Tue Sep 15 15:14:45 1998  Doug Evans  <devans@canuck.cygnus.com>
 
@@ -1380,7 +1872,7 @@
 	* arm-dis.c (print_insn_big_arm): Detect Thumb symbols in elf
 	object files.
 	(print_insn_little_arm): Detect Thumb symbols in elf object
-	files. 
+	files.
 
 Sat Aug 29 22:24:09 1998  Richard Henderson  <rth@cygnus.com>
 
@@ -1423,14 +1915,14 @@
 
 Mon Aug 10 12:51:12 1998  Catherine Moore  <clm@cygnus.com>
 
-        * arm-dis.c (print_insn_big_arm):  Fix indentation.
-        (print_insn_little_arm): Likewise.
+	* arm-dis.c (print_insn_big_arm):  Fix indentation.
+	(print_insn_little_arm): Likewise.
 
 Sun Aug  9 20:17:28 1998  Catherine Moore  <clm@cygnus.com>
 
-        * arm-dis.c (print_insn_big_arm):  Check for thumb symbol
-        attributes.
-        (print_insn_little_arm): Likewise.
+	* arm-dis.c (print_insn_big_arm):  Check for thumb symbol
+	attributes.
+	(print_insn_little_arm): Likewise.
 
 Mon Aug  3 12:43:16 1998  Doug Evans  <devans@seba.cygnus.com>
 
@@ -1491,7 +1983,7 @@
 
 	* configure.in: For bfd_vax_arch, build vax-dis.lo.
 	* Makefile.am: Rebuild dependencies.
- 	(CFILES): Add vax-dis.c.
+	(CFILES): Add vax-dis.c.
 	(ALL_MACHINES): Add vax-dis.lo.
 	* aclocal.m4: Rebuild with current libtool.
 	* configure, Makefile.in: Rebuild.
@@ -1531,13 +2023,13 @@
 Thu Jun 18 10:22:24 1998  John Metzler  <jmetzler@cygnus.com>
 
 	* mips-dis.c (print_insn_little_mips): Previously, instruction
- 	printing references the symbol table to determine whether the
- 	instruction resides in a block regular instructions or mips16
- 	instructions. However, when the disassembler gets used in other
- 	environments where the symbol table is not present, we no longer
- 	rely in the symbol table, rather, use the low bit of the
- 	instructions address to guess. There should be no change for usage
- 	of the disassembler in host based programs, gdb, objdump.
+	printing references the symbol table to determine whether the
+	instruction resides in a block regular instructions or mips16
+	instructions. However, when the disassembler gets used in other
+	environments where the symbol table is not present, we no longer
+	rely in the symbol table, rather, use the low bit of the
+	instructions address to guess. There should be no change for usage
+	of the disassembler in host based programs, gdb, objdump.
 	(print_insn_big_mips): ditto.
 	(print_insn_mips): ditto
 
@@ -1586,7 +2078,7 @@
 	(print_insn_x86): Cast to bfd_vma when passing a value to
 	print_address_func.
 	* ns32k-dis.c (CORE_ADDR): Don't define.
- 	(print_insn_ns32k): Change type of addr to bfd_vma.  Use
+	(print_insn_ns32k): Change type of addr to bfd_vma.  Use
 	bfd_scan_vma to read back address.
 	(print_insn_arg): Change type of addr to bfd_vma.  Use sprintf_vma
 	to format it.
@@ -1708,7 +2200,7 @@
 Thu May  7 12:49:46 1998  Frank Ch. Eigler  <fche@cygnus.com>
 
 	* mips-opc.c (teq,tge,tgeu,tlt,tltu,tne): Added three-operand
- 	variety of ISA2 instructions to set bottom ten bits of trap code.
+	variety of ISA2 instructions to set bottom ten bits of trap code.
 
 Thu May  7 11:54:25 1998  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -1848,10 +2340,10 @@
 
 Wed Apr  1 16:20:27 1998  Ian Dall  <Ian.Dall@dsto.defence.gov.au>
 
-        * ns32k-dis.c (bit_extract_simple): New function to extract bits
-        from an arbitrary valid buffer instead of fetching them on demand
-        using fetch_data().
-        (invalid_float): use bit_extract_simple() instead of bit_extract().
+	* ns32k-dis.c (bit_extract_simple): New function to extract bits
+	from an arbitrary valid buffer instead of fetching them on demand
+	using fetch_data().
+	(invalid_float): use bit_extract_simple() instead of bit_extract().
 
 Tue Mar 31 11:09:08 1998  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -2113,13 +2605,13 @@
 
 	* d10v-dis.c (PC_MASK): Correct value.
 	(print_operand): If there's a reloc, don't calculate the
- 	address because they could be in different sections.
+	address because they could be in different sections.
 
 Fri Jan 16 15:29:11 1998  Jim Blandy  <jimb@zwingli.cygnus.com>
 
 	* mips-opc.c (mips_builtin_opcodes): Move 4010's "addciu"
- 	instruction after the 4650's "mul" instruction; nobody's using the
- 	4010 these days.  If object files someday indicate which processor
+	instruction after the 4650's "mul" instruction; nobody's using the
+	4010 these days.  If object files someday indicate which processor
 	variant they're intended for, we can do a better job at this.
 
 Mon Jan 12 14:43:54 1998  Doug Evans  <devans@seba.cygnus.com>
@@ -2165,7 +2657,7 @@
 
 	* tic80-opc.c (OFF_SL_PC, OFF_SL_BR): Minor formatting change.
 	(tic80_opcodes): Reorder table entries to put the 32 bit PC relative
- 	offset forms before the 15 bit forms, to default to the long forms.
+	offset forms before the 15 bit forms, to default to the long forms.
 
 Fri Dec 12 01:32:30 1997  Richard Henderson  <rth@cygnus.com>
 
@@ -2313,7 +2805,7 @@
 Fri Oct  3 17:26:54 1997  Ian Lance Taylor  <ian@cygnus.com>
 
 	* i386-dis.c (OP_E): Explicitly sign extend 8 bit values, rather
- 	than assuming that char is signed.  Explicitly sign extend 16 bit
+	than assuming that char is signed.  Explicitly sign extend 16 bit
 	values, rather than assuming that short is 16 bits.
 	(OP_sI, OP_J, OP_DIR): Likewise.
 
@@ -2419,7 +2911,7 @@
 	if an opcode has a short and a long form.  Used for deciding
 	to append a ".s" or ".l".
 	(print_insn): Append a ".s" to an instruction if it is
- 	the short form and ".l" if it is a long form. Do not append
+	the short form and ".l" if it is a long form. Do not append
 	anything if the instruction has only one possible size.
 
 	* d30v-opc.c: Change mulx2h to require an even register.
@@ -2455,8 +2947,8 @@
 
 Tue Sep  2 18:39:08 1997  Jeffrey A Law  (law@cygnus.com)
 
-        * mn10200-dis.c (disassemble): PC relative instructions are
-        relative to the next instruction, not the current instruction.
+	* mn10200-dis.c (disassemble): PC relative instructions are
+	relative to the next instruction, not the current instruction.
 
 Tue Sep  2 15:41:55 1997  Nick Clifton  <nickc@cygnus.com>
 
@@ -2598,9 +3090,9 @@
 Wed Jun 25 15:25:57 1997  Felix Lee  <flee@cirdan.cygnus.com>
 
 	* ppc-opc.c (extract_nsi): make unsigned expression signed before
- 	negating it.
+	negating it.
 	(UNUSED): remove one level of parens, so MSVC doesn't choke on
- 	nesting depth when all the macros are expanded.
+	nesting depth when all the macros are expanded.
 
 Tue Jun 17 17:02:17 1997  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -2834,7 +3326,7 @@
 Mon Mar 17 08:48:03 1997  J.T. Conklin  <jtc@beauty.cygnus.com>
 
 	* m68k-opc.c (m68k_opcodes): Provide correct entries for mulsl and
- 	mulul insns on the coldfire.
+	mulul insns on the coldfire.
 
 Sat Mar 15 17:13:05 1997  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -2882,7 +3374,7 @@
 Mon Mar  3 07:45:20 1997  J.T. Conklin  <jtc@cygnus.com>
 
 	* m68k-opc.c (m68k_opcodes): Added entries for the tst insns on
- 	the mc68000.
+	the mc68000.
 
 Thu Feb 27 14:04:32 1997  Philippe De Muyter  <phdm@info.ucl.ac.be>
 
@@ -3042,7 +3534,7 @@
 	(tic80_symbol_to_value): New function.
 	(tic80_value_to_symbol): New function.
 	* tic80-dis.c (print_operand_control_register,
- 	print_operand_condition_code, print_operand_bitnum):
+	print_operand_condition_code, print_operand_bitnum):
 	Remove private tables and use tic80_value_to_symbol function.
 
 Thu Jan 30 11:30:45 1997  Martin M. Hunt  <hunt@pizza.cygnus.com>
@@ -3061,13 +3553,13 @@
 	(print_mips16_insn_arg): Likewise.
 
 	* mips-dis.c (print_insn_mips16): Better handling of an extend
- 	opcode followed by an instruction which can not be extended.
+	opcode followed by an instruction which can not be extended.
 
 Fri Jan 24 12:08:21 1997  J.T. Conklin  <jtc@cygnus.com>
 
 	* m68k-opc.c (m68k_opcodes): Changed operand specifier for the
- 	coldfire moveb instruction to not allow an address register as
- 	destination.  Although the documentation does not indicate that
+	coldfire moveb instruction to not allow an address register as
+	destination.  Although the documentation does not indicate that
 	this is invalid, experiments uncovered unexpected behavior.
 	Added a comment explaining the situation.  Thanks to Andreas
 	Schwab for pointing this out to me.
@@ -3075,7 +3567,7 @@
 Wed Jan 22 20:13:51 1997  Fred Fish  <fnf@cygnus.com>
 
 	* tic80-opc.c (tic80_opcodes): Expand comment to note that the
- 	entries are presorted so that entries with the same mnemonic are
+	entries are presorted so that entries with the same mnemonic are
 	adjacent to each other in the table.  Sort the entries for each
 	instruction so that this is true.
 
@@ -3127,9 +3619,9 @@
 	* tic80-opc.c (tic80_operands): Reorder some table entries to make
 	the order more logical.  Move the shift alias instructions ("rotl",
 	"shl", "ins", "rotr", "extu", "exts", "srl", and "sra" to be
- 	interspersed with the regular sr.x and sl.x instructions.  Add
+	interspersed with the regular sr.x and sl.x instructions.  Add
 	and test new instruction opcodes for "sl", "sli", "sr", "sri", "st",
- 	"sub", "subu", "swcr", and "trap".
+	"sub", "subu", "swcr", and "trap".
 
 Tue Jan 14 19:42:50 1997  Fred Fish  <fnf@cygnus.com>
 
@@ -3143,9 +3635,9 @@
 	"ld", "ld.u", "lmo", "or", "rdcr", "rmo", "rotl", and "rotr"
 	instructions.
 	* tic80-dis.c (print_insn_tic80): Print opcode name with fixed width
- 	10 char field, padded with spaces on rhs, rather than a string
- 	followed by a tab.  Use renamed TIC80_OPERAND_PCREL flag bit rather
- 	than old TIC80_OPERAND_RELATIVE.  Add support for new
+	10 char field, padded with spaces on rhs, rather than a string
+	followed by a tab.  Use renamed TIC80_OPERAND_PCREL flag bit rather
+	than old TIC80_OPERAND_RELATIVE.  Add support for new
 	TIC80_OPERAND_BASEREL flag bit.
 
 Mon Jan 13 15:58:56 1997  Fred Fish  <fnf@cygnus.com>
@@ -3186,9 +3678,9 @@
 Sun Jan  5 12:18:14 1997  Fred Fish  <fnf@cygnus.com>
 
 	* tic80-dis.c (M_SI, M_LI): Add macros to test for ":m" modifier bit
- 	in an instruction.
+	in an instruction.
 	* tic80-dis.c (print_insn_tic80): Change comma and paren handling.
-  	Use M_SI and M_LI macros to check for ":m" modifier for GPR operands.
+	Use M_SI and M_LI macros to check for ":m" modifier for GPR operands.
 	* tic80-opc.c (tic80_operands): Add REGM_SI and REGM_LI operands.
 	(F, M_REG, M_LI, M_SI, SZ_REG, SZ_LI, SZ_SI, D, S): New	bit-twiddlers.
 	(MASK_LI_M, MASK_SI_M, MASK_REG_M): Remove and replace in opcode
@@ -3256,7 +3748,7 @@
 	* Makefile.in (ALL_MACHINES): Add tic80-dis.o and tic80-opc.o.
 	* disassemble.c (ARCH_tic80): Define if ARCH_all is defined.
 	(disassembler): Add bfd_arch_tic80 support to set disassemble
- 	to print_insn_tic80.
+	to print_insn_tic80.
 	* tic80-dis.c (print_insn_tic80): Add stub.
 
 Fri Dec 27 22:30:57 1996  Fred Fish  <fnf@cygnus.com>
@@ -3332,7 +3824,7 @@
 Fri Dec  6 14:48:09 1996  Jeffrey A Law  (law@cygnus.com)
 
 	* mn10300-opc.c: Add some comments explaining the various
- 	operands and such.
+	operands and such.
 
 	* mn10300-dis.c (disassemble): Fix minor gcc -Wall warnings.
 
@@ -3383,19 +3875,19 @@
 Mon Nov 25 16:15:17 1996  J.T. Conklin  <jtc@cygnus.com>
 
 	* m68k-opc.c (m68k_opcodes): Simplify table by using < and >
- 	operand specifiers in *save, *restore and movem* instructions.
+	operand specifiers in *save, *restore and movem* instructions.
 
 	* m68k-opc.c (m68k_opcodes): Fix move and movem instructions for
- 	the coldfire.
+	the coldfire.
 
 	* m68k-opc.c (m68k_opcodes): The coldfire (mcf5200) can only use
- 	register operands for immediate arithmetic, not, neg, negx, and
+	register operands for immediate arithmetic, not, neg, negx, and
 	set according to condition instructions.
 
 	* m68k-opc.c (m68k_opcodes): Consistantly Use "s" as the storage
- 	specifier of the effective-address operand in immediate forms of
- 	arithmetic instructions.  The specifier for the immediate operand
- 	notes how and where the constant will be stored.
+	specifier of the effective-address operand in immediate forms of
+	arithmetic instructions.  The specifier for the immediate operand
+	notes how and where the constant will be stored.
 
 Mon Nov 25 11:17:01 1996  Jeffrey A Law  (law@cygnus.com)
 
@@ -3478,7 +3970,7 @@
 Tue Nov  5 10:30:51 1996  Martin M. Hunt  <hunt@pizza.cygnus.com>
 
 	* d10v-opc.c (d10v_opcodes): Declare the trap instruction
- 	sequential so the assembler never parallelizes it with
+	sequential so the assembler never parallelizes it with
 	other instructions.
 
 Mon Nov  4 12:50:40 1996  Jeffrey A Law  (law@cygnus.com)
@@ -3638,8 +4130,8 @@
 Mon Sep 23 12:32:26 1996  Ian Lance Taylor  <ian@cygnus.com>
 
 	* m68k-opc.c: Move the fmovemx data register cases before the
- 	other cases, so that they get recognized before the data register
- 	does gets treated as a degenerate register list.
+	other cases, so that they get recognized before the data register
+	does gets treated as a degenerate register list.
 
 Tue Sep 17 12:06:51 1996  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -3654,7 +4146,7 @@
 Mon Sep  9 14:26:26 1996  Ian Lance Taylor  <ian@cygnus.com>
 
 	* mips-dis.c (print_insn_arg): Print condition code registers as
- 	$fccN.
+	$fccN.
 
 Tue Sep  3 12:09:46 1996  Doug Evans  <dje@canuck.cygnus.com>
 
@@ -3802,7 +4294,7 @@
 Thu Aug 22 16:57:27 1996  J.T. Conklin  <jtc@rtl.cygnus.com>
 
 	* v850-opc.c (v850_operands): Added insert and extract fields,
- 	pointers to functions that handle unusual operand encodings.
+	pointers to functions that handle unusual operand encodings.
 
 Thu Aug 22 01:05:24 1996  Jeffrey A Law  (law@cygnus.com)
 
@@ -3824,7 +4316,7 @@
 Wed Aug 21 17:31:26 1996  J.T. Conklin  <jtc@hippo.cygnus.com>
 
 	* v850-opc.c (v850_operands): Add flags field.
- 	(v850_opcodes): add move opcodes.
+	(v850_opcodes): add move opcodes.
 
 Tue Aug 20 14:41:03 1996  J.T. Conklin  <jtc@hippo.cygnus.com>
 
@@ -3871,7 +4363,7 @@
 Wed Aug  7 11:55:10 1996  Ian Lance Taylor  <ian@cygnus.com>
 
 	* i386-dis.c (print_insn_i386): Actually return the correct value.
- 	(ONE, OP_ONE): #ifdef out; not used.
+	(ONE, OP_ONE): #ifdef out; not used.
 
 Fri Aug  2 17:47:03 1996  Martin M. Hunt  <hunt@pizza.cygnus.com>
 
@@ -3886,14 +4378,14 @@
 Wed Jul 31 14:39:27 1996  James G. Smith  <jsmith@cygnus.co.uk>
 
 	* arm-opc.h: (arm_opcodes): Added halfword and sign-extension
- 	memory transfer instructions. Add new format string entries %h and %s.
+	memory transfer instructions. Add new format string entries %h and %s.
 	* arm-dis.c: (print_insn_arm): Provide decoding of the new
 	formats %h and %s.
 
 Fri Jul 26 11:45:04 1996  Martin M. Hunt  <hunt@pizza.cygnus.com>
 
 	* d10v-opc.c (d10v_operands): Added UNUM4S; a 4-bit accumulator shift.
- 	(d10v_opcodes): Modified accumulator shift instructions to use UNUM4S.
+	(d10v_opcodes): Modified accumulator shift instructions to use UNUM4S.
 
 Fri Jul 26 14:01:43 1996  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -3921,13 +4413,13 @@
 Mon Jul 22 15:38:53 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
 
 	* m68k-opc.c (m68k_opcodes): Make opcode masks for the ColdFire
- 	move ccr/sr insns more strict so that the disassembler only
- 	selects them when the addressing mode is data register.
+	move ccr/sr insns more strict so that the disassembler only
+	selects them when the addressing mode is data register.
 
 Mon Jul 22 11:25:24 1996  Martin M. Hunt  <hunt@pizza.cygnus.com>
-        * d10v-opc.c (pre_defined_registers):  Declare.
-        * d10v-dis.c (print_operand): Now uses pre_defined_registers
-        to pick a better name for the registers.
+	* d10v-opc.c (pre_defined_registers):  Declare.
+	* d10v-dis.c (print_operand): Now uses pre_defined_registers
+	to pick a better name for the registers.
 
 Mon Jul 22 13:47:23 1996  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -3962,7 +4454,7 @@
 Wed Jul 17 10:12:05 1996  J.T. Conklin  <jtc@rtl.cygnus.com>
 
 	* m68k-opc.c (m68k_opcodes): Fix bugs in coldfire insns relating
- 	to bcc, trapfl, subxl, and wddata discovered by Andreas Schwab.
+	to bcc, trapfl, subxl, and wddata discovered by Andreas Schwab.
 
 Mon Jul 15 16:59:55 1996  Stu Grossman  (grossman@critters.cygnus.com)
 
@@ -4115,7 +4607,7 @@
 
 	* ppc-opc.c (PPC860): Macro for 860/821 specific instructions and
 	registers.
- 	(powerpc_opcodes): Add 860/821 specific SPRs.
+	(powerpc_opcodes): Add 860/821 specific SPRs.
 
 Mon Apr  8 14:00:44 1996  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -4340,14 +4832,14 @@
 Fri Jan 12 14:35:58 1996  David Mosberger-Tang  <davidm@AZStarNet.com>
 
 	* alpha-opc.h (alpha_insn_set): VAX floating point opcode was
- 	incorrectly defined as 0x16 when it should be 0x15.
+	incorrectly defined as 0x16 when it should be 0x15.
 	(FLOAT_FORMAT_MASK): function code is 11 bits, not just 7 bits!
 	(alpha_insn_set): added cvtst and cvttq float ops.  Also added
- 	excb (exception barrier) which is defined in the Alpha
- 	Architecture Handbook version 2.
+	excb (exception barrier) which is defined in the Alpha
+	Architecture Handbook version 2.
 	* alpha-dis.c (print_insn_alpha): Fixed special-case decoding for
- 	OPERATE_FORMAT_CODE type instructions.  The bug caused mulq to be
- 	disassembled as or, for example.
+	OPERATE_FORMAT_CODE type instructions.  The bug caused mulq to be
+	disassembled as or, for example.
 
 Wed Jan 10 12:37:22 1996  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -4373,7 +4865,7 @@
 	* sh-opc.h (sh_nibble_type): Added REG_B.
 	(sh_arg_type): Added A_REG_B.
 	(sh_table): Added pref and bank reg versions of ldc, ldc.l, stc
- 	and stc.l opcodes.
+	and stc.l opcodes.
 	* sh-dis.c (print_insn_shx): Added cases for REG_B and A_REG_B.
 
 Fri Dec 15 16:44:31 1995  Ian Lance Taylor  <ian@cygnus.com>
@@ -4389,7 +4881,7 @@
 
 	From David Mosberger-Tang  <davidm@azstarnet.com>:
 	* alpha-dis.c (print_insn_alpha): fixed decoding of cpys
- 	instruction.
+	instruction.
 
 Mon Dec  4 12:29:05 1995  J.T. Conklin  <jtc@rtl.cygnus.com>
 
@@ -4460,7 +4952,7 @@
 Mon Oct 23 11:11:34 1995  James G. Smith  <jsmith@pasanda.cygnus.co.uk>
 
 	* mips-opc.c: Added shorthand (V1) for INSN_4100 manifest. Added
- 	the VR4100 specific instructions to the mips_opcodes structure.
+	the VR4100 specific instructions to the mips_opcodes structure.
 
 Thu Oct 19 11:05:23 1995  Stan Shebs  <shebs@andros.cygnus.com>
 
@@ -4482,7 +4974,7 @@
 
 	* m68k-dis.c (print_insn_m68k): Recognize all two-word
 	instructions that take no args by looking at the match mask.
-  	(print_insn_arg): Always print "%" before register names.
+	(print_insn_arg): Always print "%" before register names.
 	[case 'c']: Use "nc" for the no-cache case, as recognized by gas.
 	[case '_']: Don't print "@#" before address.
 	[case 'J']: Use "%s" as format string, not register name.
@@ -4498,12 +4990,12 @@
 	From David Mosberger-Tang  <davidm@azstarnet.com>
 
 	* alpha-opc.h (MEMORY_FUNCTION_FORMAT_MASK): added.
-  	(alpha_insn_set): added definitions for VAX floating point
- 	instructions (Unix compilers don't generate these, but handcoded
- 	assembly might still use them).
+	(alpha_insn_set): added definitions for VAX floating point
+	instructions (Unix compilers don't generate these, but handcoded
+	assembly might still use them).
 
 	* alpha-dis.c (print_insn_alpha): added support for disassembling
- 	the miscellaneous instructions in the Alpha instruction set.
+	the miscellaneous instructions in the Alpha instruction set.
 
 Tue Sep 26 18:47:20 1995  Stan Shebs  <shebs@andros.cygnus.com>
 
@@ -4919,7 +5411,7 @@
 Wed Feb 15 15:45:20 1995  Ian Lance Taylor  <ian@cygnus.com>
 
 	* mips-opc.c: Add uld and usd macros for unaligned double load and
-        store.
+	store.
 
 Tue Feb 14 13:17:37 1995  Michael Meissner  <meissner@tiktok.cygnus.com>
 
@@ -4929,12 +5421,12 @@
 Thu Feb  9 12:28:13 1995  Stan Shebs  <shebs@andros.cygnus.com>
 
 	* i960-dis.c (struct tabent, struct sparse_tabent): Change the
-        signed char fields to shorts, more portable.
+	signed char fields to shorts, more portable.
 
 Wed Feb  8 17:29:29 1995  Stan Shebs  <shebs@andros.cygnus.com>
 
 	* i960-dis.c (struct tabent, struct sparse_tabent): Declare the
-        char fields as signed chars, since they may have negative values.
+	char fields as signed chars, since they may have negative values.
 
 Mon Feb  6 10:52:06 1995  J.T. Conklin  <jtc@rtl.cygnus.com>
 
@@ -5832,7 +6324,7 @@
 
 Thu Jan  7 07:36:33 1993  Steve Chamberlain  (sac@thepub.cygnus.com)
 
-    	* z8k-dis.c (print_insn_z8001, print_insn_z8002): new routines
+	* z8k-dis.c (print_insn_z8001, print_insn_z8002): new routines
 	* z8kgen.c, z8k-opc.h: fix sizes of some shifts.
 
 Tue Dec 22 15:42:44 1992  Per Bothner  (bothner@rtl.cygnus.com)
diff --git a/opcodes/MAINTAINERS b/opcodes/MAINTAINERS
new file mode 100644
index 0000000..d59a3bd
--- /dev/null
+++ b/opcodes/MAINTAINERS
@@ -0,0 +1 @@
+See ../binutils/MAINTAINERS
diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
index 9b2385c..9cf5b1a 100644
--- a/opcodes/Makefile.am
+++ b/opcodes/Makefile.am
@@ -45,6 +45,8 @@
 	cgen-asm.c \
 	cgen-dis.c \
 	cgen-opc.c \
+	cris-dis.c \
+	cris-opc.c \
 	d10v-dis.c \
 	d10v-opc.c \
 	d30v-dis.c \
@@ -62,6 +64,7 @@
 	i370-dis.c \
 	i370-opc.c \
 	i386-dis.c \
+	i860-dis.c \
 	i960-dis.c \
 	ia64-dis.c \
 	ia64-opc-a.c \
@@ -79,6 +82,8 @@
 	m32r-ibld.c \
 	m32r-opc.c \
 	m32r-opinst.c \
+	m68hc11-dis.c \
+	m68hc11-opc.c \
 	m68k-dis.c \
 	m68k-opc.c \
 	m88k-dis.c \
@@ -121,6 +126,8 @@
 	cgen-asm.lo \
 	cgen-dis.lo \
 	cgen-opc.lo \
+	cris-dis.lo \
+	cris-opc.lo \
 	d10v-dis.lo \
 	d10v-opc.lo \
 	d30v-dis.lo \
@@ -136,6 +143,7 @@
 	i386-dis.lo \
 	i370-dis.lo \
 	i370-opc.lo \
+	i860-dis.lo \
 	i960-dis.lo \
 	ia64-dis.lo \
 	ia64-opc.lo \
@@ -145,6 +153,8 @@
 	m32r-ibld.lo \
 	m32r-opc.lo \
 	m32r-opinst.lo \
+	m68hc11-dis.lo \
+	m68hc11-opc.lo \
 	m68k-dis.lo \
 	m68k-opc.lo \
 	m88k-dis.lo \
@@ -215,12 +225,46 @@
 	$(SHELL) ./config.status --recheck
 
 CLEANFILES = \
-	libopcodes.a stamp-lib dep.sed DEP DEP1 DEP2
+	stamp-m32r stamp-fr30 \
+	libopcodes.a stamp-lib dep.sed DEP DEPA DEP1 DEP2
 
 
+CGENDIR = @cgendir@
+CGEN = `if test -f ../guile/libguile/guile ; then echo ../guile/libguile/guile; else echo guile ; fi`
+CGENFLAGS = -v
 
-# The start marker is written this way to pass through automake unscathed.
+CGENDEPS = ../cgen/stamp-cgen \
+	$(CGENDIR)/desc.scm $(CGENDIR)/desc-cpu.scm \
+	$(CGENDIR)/opcodes.scm $(CGENDIR)/opc-asmdis.scm \
+	$(CGENDIR)/opc-ibld.scm $(CGENDIR)/opc-itab.scm \
+	$(CGENDIR)/opc-opinst.scm \
+	cgen-asm.in cgen-dis.in cgen-ibld.in
 
+if CGEN_MAINT
+M32R_DEPS = stamp-m32r
+FR30_DEPS = stamp-fr30
+else
+M32R_DEPS =
+FR30_DEPS =
+endif
+
+run-cgen:
+	$(SHELL) $(srcdir)/cgen.sh opcodes $(srcdir) $(CGEN) \
+	  $(CGENDIR) "$(CGENFLAGS)" $(arch) $(prefix) \
+	  "$(options)" $(extrafiles)
+	touch stamp-${prefix}
+.PHONY: run-cgen
+
+# For now, require developers to configure with --enable-cgen-maint.
+$(srcdir)/m32r-desc.h $(srcdir)/m32r-desc.c $(srcdir)/m32r-opc.h $(srcdir)/m32r-opc.c $(srcdir)/m32r-ibld.c $(srcdir)/m32r-opinst.c $(srcdir)/m32r-asm.c $(srcdir)/m32r-dis.c: $(M32R_DEPS)
+	@true
+stamp-m32r: $(CGENDEPS) $(CGENDIR)/m32r.cpu $(CGENDIR)/m32r.opc
+	$(MAKE) run-cgen arch=m32r prefix=m32r options=opinst extrafiles=opinst
+
+$(srcdir)/fr30-desc.h $(srcdir)/fr30-desc.c $(srcdir)/fr30-opc.h $(srcdir)/fr30-opc.c $(srcdir)/fr30-ibld.c $(srcdir)/fr30-asm.c $(srcdir)/fr30-dis.c: $(FR30_DEPS)
+	@true
+stamp-fr30: $(CGENDEPS) $(CGENDIR)/fr30.cpu $(CGENDIR)/fr30.opc
+	$(MAKE) run-cgen arch=fr30 prefix=fr30 options= extrafiles=
 
 
 ia64-ic.tbl: $(srcdir)/ia64-ic.tbl
@@ -246,8 +290,13 @@
 DEP: dep.sed $(CFILES) $(HFILES) config.h
 	rm -f DEP1
 	$(MAKE) MKDEP="$(MKDEP)" DEP1
-	sed -f dep.sed < DEP1 > $@
-	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> $@
+	sed -f dep.sed < DEP1 > DEPA
+	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEPA
+	if grep ' /' DEPA > /dev/null 2> /dev/null; then \
+	  echo 'make DEP failed!'; exit 1; \
+	else \
+	  mv -f DEPA $@; \
+	fi
 
 DEP1: $(CFILES)
 	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
@@ -302,7 +351,7 @@
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h
 avr-dis.lo: avr-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
-  $(INCDIR)/dis-asm.h $(BFD_H) opintl.h
+  $(INCDIR)/dis-asm.h $(BFD_H) opintl.h $(INCDIR)/opcode/avr.h
 cgen-asm.lo: cgen-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/libiberty.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h \
   opintl.h
@@ -310,6 +359,10 @@
   $(INCDIR)/libiberty.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h
 cgen-opc.lo: cgen-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/libiberty.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h
+cris-dis.lo: cris-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
+  $(INCDIR)/ansidecl.h sysdep.h config.h $(INCDIR)/opcode/cris.h \
+  $(INCDIR)/libiberty.h
+cris-opc.lo: cris-opc.c $(INCDIR)/opcode/cris.h
 d10v-dis.lo: d10v-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/opcode/d10v.h $(INCDIR)/dis-asm.h $(BFD_H)
 d10v-opc.lo: d10v-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
@@ -351,6 +404,8 @@
   $(INCDIR)/opcode/i370.h
 i386-dis.lo: i386-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
   $(INCDIR)/ansidecl.h sysdep.h config.h opintl.h
+i860-dis.lo: i860-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
+  $(INCDIR)/ansidecl.h $(INCDIR)/opcode/i860.h
 i960-dis.lo: i960-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/dis-asm.h $(BFD_H)
 ia64-dis.lo: ia64-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
@@ -387,6 +442,10 @@
 m32r-opinst.lo: m32r-opinst.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(BFD_H) $(INCDIR)/symcat.h m32r-desc.h $(INCDIR)/opcode/cgen.h \
   m32r-opc.h
+m68hc11-dis.lo: m68hc11-dis.c $(INCDIR)/ansidecl.h \
+  $(INCDIR)/opcode/m68hc11.h $(INCDIR)/dis-asm.h $(BFD_H)
+m68hc11-opc.lo: m68hc11-opc.c $(INCDIR)/ansidecl.h \
+  $(INCDIR)/opcode/m68hc11.h
 m68k-dis.lo: m68k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/floatformat.h \
   opintl.h $(INCDIR)/opcode/m68k.h
@@ -436,10 +495,11 @@
   $(INCDIR)/opcode/sparc.h
 tic30-dis.lo: tic30-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/tic30.h
-tic54x-dis.lo: tic54x-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
-  $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic54x.h $(INCDIR)/coff/tic54x.h \
-  $(INCDIR)/coff/ti.h
-tic54x-opc.lo: tic54x-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic54x.h
+tic54x-dis.lo: tic54x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
+  $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/tic54x.h \
+  $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h
+tic54x-opc.lo: tic54x-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
+  $(INCDIR)/opcode/tic54x.h
 tic80-dis.lo: tic80-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/opcode/tic80.h $(INCDIR)/dis-asm.h $(BFD_H)
 tic80-opc.lo: tic80-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in
index c5c1d01..f7a0feb 100644
--- a/opcodes/Makefile.in
+++ b/opcodes/Makefile.in
@@ -70,10 +70,14 @@
 CATOBJEXT = @CATOBJEXT@
 CC = @CC@
 CC_FOR_BUILD = @CC_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
 DATADIRNAME = @DATADIRNAME@
 DLLTOOL = @DLLTOOL@
 EXEEXT = @EXEEXT@
 EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+GCJ = @GCJ@
+GCJFLAGS = @GCJFLAGS@
 GMOFILES = @GMOFILES@
 GMSGFMT = @GMSGFMT@
 GT_NO = @GT_NO@
@@ -91,16 +95,19 @@
 MKINSTALLDIRS = @MKINSTALLDIRS@
 MSGFMT = @MSGFMT@
 OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 POFILES = @POFILES@
 POSUB = @POSUB@
 RANLIB = @RANLIB@
+STRIP = @STRIP@
 USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
 USE_NLS = @USE_NLS@
 VERSION = @VERSION@
 WIN32LDFLAGS = @WIN32LDFLAGS@
 WIN32LIBADD = @WIN32LIBADD@
 archdefs = @archdefs@
+cgendir = @cgendir@
 l = @l@
 
 AUTOMAKE_OPTIONS = cygnus
@@ -149,6 +156,8 @@
 	cgen-asm.c \
 	cgen-dis.c \
 	cgen-opc.c \
+	cris-dis.c \
+	cris-opc.c \
 	d10v-dis.c \
 	d10v-opc.c \
 	d30v-dis.c \
@@ -166,6 +175,7 @@
 	i370-dis.c \
 	i370-opc.c \
 	i386-dis.c \
+	i860-dis.c \
 	i960-dis.c \
 	ia64-dis.c \
 	ia64-opc-a.c \
@@ -183,6 +193,8 @@
 	m32r-ibld.c \
 	m32r-opc.c \
 	m32r-opinst.c \
+	m68hc11-dis.c \
+	m68hc11-opc.c \
 	m68k-dis.c \
 	m68k-opc.c \
 	m88k-dis.c \
@@ -226,6 +238,8 @@
 	cgen-asm.lo \
 	cgen-dis.lo \
 	cgen-opc.lo \
+	cris-dis.lo \
+	cris-opc.lo \
 	d10v-dis.lo \
 	d10v-opc.lo \
 	d30v-dis.lo \
@@ -241,6 +255,7 @@
 	i386-dis.lo \
 	i370-dis.lo \
 	i370-opc.lo \
+	i860-dis.lo \
 	i960-dis.lo \
 	ia64-dis.lo \
 	ia64-opc.lo \
@@ -250,6 +265,8 @@
 	m32r-ibld.lo \
 	m32r-opc.lo \
 	m32r-opinst.lo \
+	m68hc11-dis.lo \
+	m68hc11-opc.lo \
 	m68k-dis.lo \
 	m68k-opc.lo \
 	m88k-dis.lo \
@@ -300,8 +317,25 @@
 POTFILES = $(HFILES) $(CFILES)
 
 CLEANFILES = \
-	libopcodes.a stamp-lib dep.sed DEP DEP1 DEP2
+	stamp-m32r stamp-fr30 \
+	libopcodes.a stamp-lib dep.sed DEP DEPA DEP1 DEP2
 
+
+CGENDIR = @cgendir@
+CGEN = `if test -f ../guile/libguile/guile ; then echo ../guile/libguile/guile; else echo guile ; fi`
+CGENFLAGS = -v
+
+CGENDEPS = ../cgen/stamp-cgen \
+	$(CGENDIR)/desc.scm $(CGENDIR)/desc-cpu.scm \
+	$(CGENDIR)/opcodes.scm $(CGENDIR)/opc-asmdis.scm \
+	$(CGENDIR)/opc-ibld.scm $(CGENDIR)/opc-itab.scm \
+	$(CGENDIR)/opc-opinst.scm \
+	cgen-asm.in cgen-dis.in cgen-ibld.in
+
+@CGEN_MAINT_TRUE@M32R_DEPS = @CGEN_MAINT_TRUE@stamp-m32r
+@CGEN_MAINT_FALSE@M32R_DEPS = 
+@CGEN_MAINT_TRUE@FR30_DEPS = @CGEN_MAINT_TRUE@stamp-fr30
+@CGEN_MAINT_FALSE@FR30_DEPS = 
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
 CONFIG_HEADER = config.h
@@ -315,7 +349,7 @@
 LIBS = @LIBS@
 libopcodes_a_LIBADD = 
 libopcodes_a_SOURCES = libopcodes.a.c
-libopcodes_a_OBJECTS =  libopcodes.a.o
+libopcodes_a_OBJECTS =  libopcodes.a.$(OBJEXT)
 LTLIBRARIES =  $(lib_LTLIBRARIES)
 
 libopcodes_la_OBJECTS =  dis-buf.lo disassemble.lo
@@ -330,14 +364,14 @@
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
+TAR = gtar
 GZIP_ENV = --best
 SOURCES = libopcodes.a.c $(libopcodes_la_SOURCES)
-OBJECTS = libopcodes.a.o $(libopcodes_la_OBJECTS)
+OBJECTS = libopcodes.a.$(OBJEXT) $(libopcodes_la_OBJECTS)
 
 all: all-redirect
 .SUFFIXES:
-.SUFFIXES: .S .c .lo .o .s
+.SUFFIXES: .S .c .lo .o .obj .s
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
 	cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile
 
@@ -390,6 +424,11 @@
 .c.o:
 	$(COMPILE) -c $<
 
+# FIXME: We should only use cygpath when building on Windows,
+# and only if it is available.
+.c.obj:
+	$(COMPILE) -c `cygpath -w $<`
+
 .s.o:
 	$(COMPILE) -c $<
 
@@ -398,6 +437,7 @@
 
 mostlyclean-compile:
 	-rm -f *.o core *.core
+	-rm -f *.$(OBJEXT)
 
 clean-compile:
 
@@ -719,7 +759,23 @@
 config.status: $(srcdir)/configure $(srcdir)/../bfd/configure.in
 	$(SHELL) ./config.status --recheck
 
-# The start marker is written this way to pass through automake unscathed.
+run-cgen:
+	$(SHELL) $(srcdir)/cgen.sh opcodes $(srcdir) $(CGEN) \
+	  $(CGENDIR) "$(CGENFLAGS)" $(arch) $(prefix) \
+	  "$(options)" $(extrafiles)
+	touch stamp-${prefix}
+.PHONY: run-cgen
+
+# For now, require developers to configure with --enable-cgen-maint.
+$(srcdir)/m32r-desc.h $(srcdir)/m32r-desc.c $(srcdir)/m32r-opc.h $(srcdir)/m32r-opc.c $(srcdir)/m32r-ibld.c $(srcdir)/m32r-opinst.c $(srcdir)/m32r-asm.c $(srcdir)/m32r-dis.c: $(M32R_DEPS)
+	@true
+stamp-m32r: $(CGENDEPS) $(CGENDIR)/m32r.cpu $(CGENDIR)/m32r.opc
+	$(MAKE) run-cgen arch=m32r prefix=m32r options=opinst extrafiles=opinst
+
+$(srcdir)/fr30-desc.h $(srcdir)/fr30-desc.c $(srcdir)/fr30-opc.h $(srcdir)/fr30-opc.c $(srcdir)/fr30-ibld.c $(srcdir)/fr30-asm.c $(srcdir)/fr30-dis.c: $(FR30_DEPS)
+	@true
+stamp-fr30: $(CGENDEPS) $(CGENDIR)/fr30.cpu $(CGENDIR)/fr30.opc
+	$(MAKE) run-cgen arch=fr30 prefix=fr30 options= extrafiles=
 
 ia64-ic.tbl: $(srcdir)/ia64-ic.tbl
 	$(LN_S) -f $(srcdir)/ia64-ic.tbl
@@ -744,8 +800,13 @@
 DEP: dep.sed $(CFILES) $(HFILES) config.h
 	rm -f DEP1
 	$(MAKE) MKDEP="$(MKDEP)" DEP1
-	sed -f dep.sed < DEP1 > $@
-	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> $@
+	sed -f dep.sed < DEP1 > DEPA
+	echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> DEPA
+	if grep ' /' DEPA > /dev/null 2> /dev/null; then \
+	  echo 'make DEP failed!'; exit 1; \
+	else \
+	  mv -f DEPA $@; \
+	fi
 
 DEP1: $(CFILES)
 	echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
@@ -800,7 +861,7 @@
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h
 avr-dis.lo: avr-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
-  $(INCDIR)/dis-asm.h $(BFD_H) opintl.h
+  $(INCDIR)/dis-asm.h $(BFD_H) opintl.h $(INCDIR)/opcode/avr.h
 cgen-asm.lo: cgen-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/libiberty.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h \
   opintl.h
@@ -808,6 +869,10 @@
   $(INCDIR)/libiberty.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h
 cgen-opc.lo: cgen-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/libiberty.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/cgen.h
+cris-dis.lo: cris-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
+  $(INCDIR)/ansidecl.h sysdep.h config.h $(INCDIR)/opcode/cris.h \
+  $(INCDIR)/libiberty.h
+cris-opc.lo: cris-opc.c $(INCDIR)/opcode/cris.h
 d10v-dis.lo: d10v-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/opcode/d10v.h $(INCDIR)/dis-asm.h $(BFD_H)
 d10v-opc.lo: d10v-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
@@ -849,6 +914,8 @@
   $(INCDIR)/opcode/i370.h
 i386-dis.lo: i386-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
   $(INCDIR)/ansidecl.h sysdep.h config.h opintl.h
+i860-dis.lo: i860-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
+  $(INCDIR)/ansidecl.h $(INCDIR)/opcode/i860.h
 i960-dis.lo: i960-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/dis-asm.h $(BFD_H)
 ia64-dis.lo: ia64-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
@@ -885,6 +952,10 @@
 m32r-opinst.lo: m32r-opinst.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(BFD_H) $(INCDIR)/symcat.h m32r-desc.h $(INCDIR)/opcode/cgen.h \
   m32r-opc.h
+m68hc11-dis.lo: m68hc11-dis.c $(INCDIR)/ansidecl.h \
+  $(INCDIR)/opcode/m68hc11.h $(INCDIR)/dis-asm.h $(BFD_H)
+m68hc11-opc.lo: m68hc11-opc.c $(INCDIR)/ansidecl.h \
+  $(INCDIR)/opcode/m68hc11.h
 m68k-dis.lo: m68k-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/floatformat.h \
   opintl.h $(INCDIR)/opcode/m68k.h
@@ -934,10 +1005,11 @@
   $(INCDIR)/opcode/sparc.h
 tic30-dis.lo: tic30-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/tic30.h
-tic54x-dis.lo: tic54x-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
-  $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic54x.h $(INCDIR)/coff/tic54x.h \
-  $(INCDIR)/coff/ti.h
-tic54x-opc.lo: tic54x-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic54x.h
+tic54x-dis.lo: tic54x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
+  $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/tic54x.h \
+  $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h
+tic54x-opc.lo: tic54x-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
+  $(INCDIR)/opcode/tic54x.h
 tic80-dis.lo: tic80-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/opcode/tic80.h $(INCDIR)/dis-asm.h $(BFD_H)
 tic80-opc.lo: tic80-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
diff --git a/opcodes/acinclude.m4 b/opcodes/acinclude.m4
index 71b09b9..bb689a5 100644
--- a/opcodes/acinclude.m4
+++ b/opcodes/acinclude.m4
@@ -1 +1,17 @@
 sinclude(../bfd/acinclude.m4)
+
+dnl sinclude(../libtool.m4) already included in bfd/acinclude.m4
+dnl The lines below arrange for aclocal not to bring libtool.m4
+dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
+dnl to add a definition of LIBTOOL to Makefile.in.
+ifelse(yes,no,[
+AC_DEFUN([AM_PROG_LIBTOOL],)
+AC_DEFUN([AM_DISABLE_SHARED],)
+AC_SUBST(LIBTOOL)
+])
+
+dnl sinclude(../gettext.m4) already included in bfd/acinclude.m4
+ifelse(yes,no,[
+AC_DEFUN([CY_WITH_NLS],)
+AC_SUBST(INTLLIBS)
+])
diff --git a/opcodes/aclocal.m4 b/opcodes/aclocal.m4
index 7ba1f4e..2a4c03d 100644
--- a/opcodes/aclocal.m4
+++ b/opcodes/aclocal.m4
@@ -12,6 +12,40 @@
 
 sinclude(../bfd/acinclude.m4)
 
+dnl sinclude(../libtool.m4) already included in bfd/acinclude.m4
+dnl The lines below arrange for aclocal not to bring libtool.m4
+dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
+dnl to add a definition of LIBTOOL to Makefile.in.
+ifelse(yes,no,[
+AC_DEFUN([AM_PROG_LIBTOOL],)
+AC_DEFUN([AM_DISABLE_SHARED],)
+AC_SUBST(LIBTOOL)
+])
+
+dnl sinclude(../gettext.m4) already included in bfd/acinclude.m4
+ifelse(yes,no,[
+AC_DEFUN([CY_WITH_NLS],)
+AC_SUBST(INTLLIBS)
+])
+
+#serial 1
+# This test replaces the one in autoconf.
+# Currently this macro should have the same name as the autoconf macro
+# because gettext's gettext.m4 (distributed in the automake package)
+# still uses it.  Otherwise, the use in gettext.m4 makes autoheader
+# give these diagnostics:
+#   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
+#   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
+
+undefine([AC_ISC_POSIX])
+
+AC_DEFUN(AC_ISC_POSIX,
+  [
+    dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
+    AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
+  ]
+)
+
 # Do all the work for Automake.  This macro actually does too much --
 # some checks are only needed if your package does certain things.
 # But this isn't really a big deal.
@@ -104,415 +138,6 @@
 fi
 AC_SUBST($1)])
 
-
-# serial 40 AC_PROG_LIBTOOL
-AC_DEFUN(AC_PROG_LIBTOOL,
-[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
-
-# Save cache, so that ltconfig can load it
-AC_CACHE_SAVE
-
-# Actually configure libtool.  ac_aux_dir is where install-sh is found.
-CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
-LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
-DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
-${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
-$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
-|| AC_MSG_ERROR([libtool configure failed])
-
-# Reload cache, that may have been modified by ltconfig
-AC_CACHE_LOAD
-
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
-
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-AC_SUBST(LIBTOOL)dnl
-
-# Redirect the config.log output again, so that the ltconfig log is not
-# clobbered by the next message.
-exec 5>>./config.log
-])
-
-AC_DEFUN(AC_LIBTOOL_SETUP,
-[AC_PREREQ(2.13)dnl
-AC_REQUIRE([AC_ENABLE_SHARED])dnl
-AC_REQUIRE([AC_ENABLE_STATIC])dnl
-AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_REQUIRE([AC_PROG_RANLIB])dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_LD])dnl
-AC_REQUIRE([AC_PROG_NM])dnl
-AC_REQUIRE([AC_PROG_LN_S])dnl
-dnl
-
-case "$target" in
-NONE) lt_target="$host" ;;
-*) lt_target="$target" ;;
-esac
-
-# Check for any special flags to pass to ltconfig.
-libtool_flags="--cache-file=$cache_file"
-test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
-test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
-test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
-test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
-test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
-ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
-[libtool_flags="$libtool_flags --enable-dlopen"])
-ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
-[libtool_flags="$libtool_flags --enable-win32-dll"])
-AC_ARG_ENABLE(libtool-lock,
-  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
-test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
-test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
-
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case "$lt_target" in
-*-*-irix6*)
-  # Find out which ABI we are using.
-  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case "`/usr/bin/file conftest.o`" in
-    *32-bit*)
-      LD="${LD-ld} -32"
-      ;;
-    *N32*)
-      LD="${LD-ld} -n32"
-      ;;
-    *64-bit*)
-      LD="${LD-ld} -64"
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-
-*-*-sco3.2v5*)
-  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
-  SAVE_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -belf"
-  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
-    [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
-    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
-    CFLAGS="$SAVE_CFLAGS"
-  fi
-  ;;
-
-ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
-[*-*-cygwin* | *-*-mingw*)
-  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-  AC_CHECK_TOOL(AS, as, false)
-  AC_CHECK_TOOL(OBJDUMP, objdump, false)
-  ;;
-])
-esac
-])
-
-# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
-AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
-
-# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
-AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
-
-# AC_ENABLE_SHARED - implement the --enable-shared flag
-# Usage: AC_ENABLE_SHARED[(DEFAULT)]
-#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
-#   `yes'.
-AC_DEFUN(AC_ENABLE_SHARED, [dnl
-define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE(shared,
-changequote(<<, >>)dnl
-<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
-changequote([, ])dnl
-[p=${PACKAGE-default}
-case "$enableval" in
-yes) enable_shared=yes ;;
-no) enable_shared=no ;;
-*)
-  enable_shared=no
-  # Look at the argument we got.  We use all the common list separators.
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
-  for pkg in $enableval; do
-    if test "X$pkg" = "X$p"; then
-      enable_shared=yes
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac],
-enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
-])
-
-# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
-AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_SHARED(no)])
-
-# AC_ENABLE_STATIC - implement the --enable-static flag
-# Usage: AC_ENABLE_STATIC[(DEFAULT)]
-#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
-#   `yes'.
-AC_DEFUN(AC_ENABLE_STATIC, [dnl
-define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE(static,
-changequote(<<, >>)dnl
-<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
-changequote([, ])dnl
-[p=${PACKAGE-default}
-case "$enableval" in
-yes) enable_static=yes ;;
-no) enable_static=no ;;
-*)
-  enable_static=no
-  # Look at the argument we got.  We use all the common list separators.
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
-  for pkg in $enableval; do
-    if test "X$pkg" = "X$p"; then
-      enable_static=yes
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac],
-enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
-])
-
-# AC_DISABLE_STATIC - set the default static flag to --disable-static
-AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_STATIC(no)])
-
-
-# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
-# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
-#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
-#   `yes'.
-AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
-define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE(fast-install,
-changequote(<<, >>)dnl
-<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
-changequote([, ])dnl
-[p=${PACKAGE-default}
-case "$enableval" in
-yes) enable_fast_install=yes ;;
-no) enable_fast_install=no ;;
-*)
-  enable_fast_install=no
-  # Look at the argument we got.  We use all the common list separators.
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
-  for pkg in $enableval; do
-    if test "X$pkg" = "X$p"; then
-      enable_fast_install=yes
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac],
-enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
-])
-
-# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
-AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_FAST_INSTALL(no)])
-
-# AC_PROG_LD - find the path to the GNU or non-GNU linker
-AC_DEFUN(AC_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
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-ac_prog=ld
-if test "$ac_cv_prog_gcc" = yes; then
-  # Check if gcc -print-prog-name=ld gives a path.
-  AC_MSG_CHECKING([for ld used by GCC])
-  ac_prog=`($CC -print-prog-name=ld) 2>&5`
-  case "$ac_prog" in
-    # Accept absolute paths.
-changequote(,)dnl
-    [\\/]* | [A-Za-z]:[\\/]*)
-      re_direlt='/[^/][^/]*/\.\./'
-changequote([,])dnl
-      # 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(ac_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
-      ac_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 "$ac_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
-  ac_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$ac_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_PROG_LD_GNU
-])
-
-AC_DEFUN(AC_PROG_LD_GNU,
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_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
-  ac_cv_prog_gnu_ld=yes
-else
-  ac_cv_prog_gnu_ld=no
-fi])
-])
-
-# AC_PROG_NM - find the path to a BSD-compatible name lister
-AC_DEFUN(AC_PROG_NM,
-[AC_MSG_CHECKING([for BSD-compatible nm])
-AC_CACHE_VAL(ac_cv_path_NM,
-[if test -n "$NM"; then
-  # Let the user override the test.
-  ac_cv_path_NM="$NM"
-else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
-  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
-      # Check to see if the nm accepts a BSD-compat flag.
-      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
-      #   nm: unknown option "B" ignored
-      if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
-	ac_cv_path_NM="$ac_dir/nm -B"
-	break
-      elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
-	ac_cv_path_NM="$ac_dir/nm -p"
-	break
-      else
-	ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
-	continue # so that we can try to find one that supports BSD flags
-      fi
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
-fi])
-NM="$ac_cv_path_NM"
-AC_MSG_RESULT([$NM])
-])
-
-# AC_CHECK_LIBM - check for math library
-AC_DEFUN(AC_CHECK_LIBM,
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-LIBM=
-case "$lt_target" in
-*-*-beos* | *-*-cygwin*)
-  # These system don't have libm
-  ;;
-*-ncr-sysv4.3*)
-  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
-  AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
-  ;;
-*)
-  AC_CHECK_LIB(m, main, LIBM="-lm")
-  ;;
-esac
-])
-
-# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
-# the libltdl convenience library, adds --enable-ltdl-convenience to
-# the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
-# is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
-# to be `${top_builddir}/libltdl'.  Make sure you start DIR with
-# '${top_builddir}/' (note the single quotes!) if your package is not
-# flat, and, if you're not using automake, define top_builddir as
-# appropriate in the Makefiles.
-AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-  case "$enable_ltdl_convenience" in
-  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
-  "") enable_ltdl_convenience=yes
-      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
-  esac
-  LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
-  INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
-])
-
-# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
-# the libltdl installable library, and adds --enable-ltdl-install to
-# the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
-# is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
-# to be `${top_builddir}/libltdl'.  Make sure you start DIR with
-# '${top_builddir}/' (note the single quotes!) if your package is not
-# flat, and, if you're not using automake, define top_builddir as
-# appropriate in the Makefiles.
-# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
-AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-  AC_CHECK_LIB(ltdl, main,
-  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
-  [if test x"$enable_ltdl_install" = xno; then
-     AC_MSG_WARN([libltdl not installed, but installation disabled])
-   else
-     enable_ltdl_install=yes
-   fi
-  ])
-  if test x"$enable_ltdl_install" = x"yes"; then
-    ac_configure_args="$ac_configure_args --enable-ltdl-install"
-    LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
-    INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
-  else
-    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
-    LIBLTDL="-lltdl"
-    INCLTDL=
-  fi
-])
-
-dnl old names
-AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
-AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
-AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
-AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
-AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
-AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
-AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
-
-dnl This is just to silence aclocal about the macro not being used
-ifelse([AC_DISABLE_FAST_INSTALL])dnl
-
 # Like AC_CONFIG_HEADER, but automatically create stamp file.
 
 AC_DEFUN(AM_CONFIG_HEADER,
@@ -569,348 +194,3 @@
   $1_FALSE=
 fi])
 
-# 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, 1, [Define to 1 if NLS is requested])
-      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, 1,
-			[Define as 1 if you have gettext and don't want to use GNU 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, 1, [Define if you have the stpcpy function])
-   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, 1,
-		[Define if your locale.h file contains LC_MESSAGES.])
-    fi
-  fi])
-
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index a3e7112..262406b 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -60,6 +60,8 @@
 {
   { "raw" , "Select raw register names",
     { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"}},
+  { "gcc",  "Select register names used by GCC",
+    { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "sl",  "fp",  "ip",  "sp",  "lr",  "pc" }},
   { "std",  "Select register names used in ARM's ISA documentation",
     { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "sp",  "lr",  "pc" }},
   { "apcs", "Select register names used in the APCS",
@@ -70,7 +72,7 @@
     { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "WR", "v5", "SB", "SL",  "FP",  "IP",  "SP",  "LR",  "PC" }}
 };
 
-/* Default to standard register name set.  */
+/* Default to GCC register name set.  */
 static unsigned int regname_selected = 1;
 
 #define NUM_ARM_REGNAMES  NUM_ELEM (regnames)
@@ -419,28 +421,39 @@
 			}
 		      break;
 
+		    case 'B':
+		      /* Print ARM V5 BLX(1) address: pc+25 bits.  */
+		      {
+			bfd_vma address;
+			bfd_vma offset = 0;
+			
+			if (given & 0x00800000)
+			  /* Is signed, hi bits should be ones.  */
+			  offset = (-1) ^ 0x00ffffff;
+
+			/* Offset is (SignExtend(offset field)<<2).  */
+			offset += given & 0x00ffffff;
+			offset <<= 2;
+			address = offset + pc + 8;
+			
+			if (given & 0x01000000)
+			  /* H bit allows addressing to 2-byte boundaries.  */
+			  address += 2;
+
+		        info->print_address_func (address, info);
+		      }
+		      break;
+
 		    case 'C':
-		      switch (given & 0x000f0000)
-			{
-			default:
-			  func (stream, "_???");
-			  break;
-			case 0x90000:
-			  func (stream, "_all");
-			  break;
-			case 0x10000:
-			  func (stream, "_c");
-			  break;
-			case 0x20000:
-			  func (stream, "_x");
-			  break;
-			case 0x40000:
-			  func (stream, "_s");
-			  break;
-			case 0x80000:
-			  func (stream, "_f");
-			  break;
-			}
+		      func (stream, "_");
+		      if (given & 0x80000)
+			func (stream, "f");
+		      if (given & 0x40000)
+			func (stream, "s");
+		      if (given & 0x20000)
+			func (stream, "x");
+		      if (given & 0x10000)
+			func (stream, "c");
 		      break;
 
 		    case 'F':
@@ -658,6 +671,9 @@
 	      info->bytes_per_chunk = 4;
 	      info->bytes_per_line  = 4;
 	      
+	      if ((given & 0x10000000) == 0)
+                 func (stream, "blx\t");
+	      else
                 func (stream, "bl\t");
 		
               info->print_address_func (BDISP23 (given) * 2 + pc + 4, info);
diff --git a/opcodes/arm-opc.h b/opcodes/arm-opc.h
index 5ecde4b..42ab954 100644
--- a/opcodes/arm-opc.h
+++ b/opcodes/arm-opc.h
@@ -51,6 +51,7 @@
    %a			print address for ldr/str instruction
    %s                   print address for ldr/str halfword/signextend instruction
    %b			print branch destination
+   %B			print arm BLX(1) destination
    %A			print address for ldc/stc/ldf/stf instruction
    %m			print register mask for ldm/stm instruction
    %C			print the PSR sub type.
@@ -75,7 +76,7 @@
 
 static struct arm_opcode arm_opcodes[] =
 {
-    /* ARM instructions */
+    /* ARM instructions.  */
     {0xe1a00000, 0xffffffff, "nop\t\t\t(mov r0,r0)"},
     {0x012FFF10, 0x0ffffff0, "bx%c\t%0-3r"},
     {0x00000090, 0x0fe000f0, "mul%c%20's\t%16-19r, %0-3r, %8-11r"},
@@ -83,6 +84,59 @@
     {0x01000090, 0x0fb00ff0, "swp%c%22'b\t%12-15r, %0-3r, [%16-19r]"},
     {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"},
+
+    /* XScale instructions.  */
+    {0x0e200010, 0x0fff0ff0, "mia%c\tacc0, %0-3r, %12-15r"},
+    {0x0e280010, 0x0fff0ff0, "miaph%c\tacc0, %0-3r, %12-15r"},
+    {0x0e2c0010, 0x0ffc0ff0, "mia%17'T%17`B%16'T%16`B%c\tacc0, %0-3r, %12-15r"},
+    {0x0c400000, 0x0ff00fff, "mar%c\tacc0, %12-15r, %16-19r"},
+    {0x0c500000, 0x0ff00fff, "mra%c\t%12-15r, %16-19r, acc0"},
+    {0xf450f000, 0xfc70f000, "pld\t%a"},
+    
+    /* V5 Instructions.  */
+    {0xe1200070, 0xfff000f0, "bkpt\t0x%16-19X%12-15X%8-11X%0-3X"},
+    {0xfa000000, 0xfe000000, "blx\t%B"},
+    {0x012fff30, 0x0ffffff0, "blx%c\t%0-3r"},
+    {0x016f0f10, 0x0fff0ff0, "clz%c\t%12-15r, %0-3r"},
+    {0xfc100000, 0xfe100000, "ldc2%22'l\t%8-11d, cr%12-15d, %A"},
+    {0xfc000000, 0xfe100000, "stc2%22'l\t%8-11d, cr%12-15d, %A"},
+    {0xfe000000, 0xff000010, "cdp2\t%8-11d, %20-23d, cr%12-15d, cr%16-19d, cr%0-3d, {%5-7d}"},
+    {0xfe000010, 0xff100010, "mcr2\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"},
+    {0xfe100010, 0xff100010, "mrc2\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"},
+
+    /* V5E "El Segundo" Instructions.  */    
+    {0x000000d0, 0x0e1000f0, "ldr%cd\t%12-15r, %s"},
+    {0x000000f0, 0x0e1000f0, "str%cd\t%12-15r, %s"},
+    {0x01000080, 0x0ff000f0, "smlabb%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
+    {0x010000a0, 0x0ff000f0, "smlatb%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
+    {0x010000c0, 0x0ff000f0, "smlabt%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
+    {0x010000e0, 0x0ff000f0, "smlatt%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
+
+    {0x01200080, 0x0ff000f0, "smlawb%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
+    {0x012000c0, 0x0ff000f0, "smlawt%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
+
+    {0x01400080, 0x0ff000f0, "smlalbb%c\t%12-15r, %16-19r, %0-3r, %8-11r"},
+    {0x014000a0, 0x0ff000f0, "smlaltb%c\t%12-15r, %16-19r, %0-3r, %8-11r"},
+    {0x014000c0, 0x0ff000f0, "smlalbt%c\t%12-15r, %16-19r, %0-3r, %8-11r"},
+    {0x014000e0, 0x0ff000f0, "smlaltt%c\t%12-15r, %16-19r, %0-3r, %8-11r"},
+
+    {0x01600080, 0x0ff0f0f0, "smulbb%c\t%16-19r, %0-3r, %8-11r"},
+    {0x016000a0, 0x0ff0f0f0, "smultb%c\t%16-19r, %0-3r, %8-11r"},
+    {0x016000c0, 0x0ff0f0f0, "smulbt%c\t%16-19r, %0-3r, %8-11r"},
+    {0x016000e0, 0x0ff0f0f0, "smultt%c\t%16-19r, %0-3r, %8-11r"},
+
+    {0x012000a0, 0x0ff0f0f0, "smulwb%c\t%16-19r, %0-3r, %8-11r"},
+    {0x012000e0, 0x0ff0f0f0, "smulwt%c\t%16-19r, %0-3r, %8-11r"},
+
+    {0x01000050, 0x0ff00ff0,  "qadd%c\t%12-15r, %0-3r, %16-19r"},
+    {0x01400050, 0x0ff00ff0, "qdadd%c\t%12-15r, %0-3r, %16-19r"},
+    {0x01200050, 0x0ff00ff0,  "qsub%c\t%12-15r, %0-3r, %16-19r"},
+    {0x01600050, 0x0ff00ff0, "qdsub%c\t%12-15r, %0-3r, %16-19r"},
+
+    {0x0c400000, 0x0ff00000, "mcrr%c\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"},
+    {0x0c500000, 0x0ff00000, "mrrc%c\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"},
+
+    /* ARM Instructions.  */
     {0x00000090, 0x0e100090, "str%c%6's%h\t%12-15r, %s"},
     {0x00100090, 0x0e100090, "ldr%c%6's%h\t%12-15r, %s"},
     {0x00000000, 0x0de00000, "and%c%20's\t%12-15r, %16-19r, %o"},
@@ -174,10 +228,21 @@
 
 static struct thumb_opcode thumb_opcodes[] =
 {
-  /* Thumb instructions */
-  {0x46C0, 0xFFFF, "nop\t\t\t(mov r8,r8)"}, /* format 5 instructions do not update the PSR */
+  /* Thumb instructions.  */
+
+  /* ARM V5 ISA extends Thumb.  */
+  {0xbe00, 0xff00, "bkpt\t%0-7x"},
+  {0x4780, 0xff87, "blx\t%3-6r"},	/* note: 4 bit register number.  */
+  /* Note: this is BLX(2).  BLX(1) is done in arm-dis.c/print_insn_thumb()
+     as an extension of the special processing there for Thumb BL.
+     BL and BLX(1) involve 2 successive 16-bit instructions, which must
+     always appear together in the correct order.  So, the empty
+     string is put in this table, and the string interpreter takes <empty>
+     to mean it has a pair of BL-ish instructions.  */
+  {0x46C0, 0xFFFF, "nop\t\t\t(mov r8, r8)"},
+  /* Format 5 instructions do not update the PSR.  */
   {0x1C00, 0xFFC0, "mov\t%0-2r, %3-5r\t\t(add %0-2r, %3-5r, #%6-8d)"},
-  /* format 4 */
+  /* Format 4.  */
   {0x4000, 0xFFC0, "and\t%0-2r, %3-5r"},
   {0x4040, 0xFFC0, "eor\t%0-2r, %3-5r"},
   {0x4080, 0xFFC0, "lsl\t%0-2r, %3-5r"},
diff --git a/opcodes/avr-dis.c b/opcodes/avr-dis.c
index 6fcd58c..db46cb4 100644
--- a/opcodes/avr-dis.c
+++ b/opcodes/avr-dis.c
@@ -17,223 +17,224 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-
+#include <assert.h>
 #include "sysdep.h"
 #include "dis-asm.h"
 #include "opintl.h"
 
-typedef unsigned char u8;
-typedef unsigned short u16;
-typedef unsigned long u32;
 
-#define IFMASK(a,b)     ((opcode & (a)) == (b))
-
-static char* SREG_flags = "CZNVSHTI";
-static char* sect94[] = {"COM","NEG","SWAP","INC",0,"ASR","LSR","ROR",
-			 0,0,"DEC",0,0,0,0,0};
-static char* sect98[] = {"CBI","SBIC","SBI","SBIS"};
-static char* branchs[] = {
-  "BRCS","BREQ","BRMI","BRVS",
-  "BRLT","BRHS","BRTS","BRIE",
-  "BRCC","BRNE","BRPL","BRVC",
-  "BRGE","BRHC","BRTC","BRID"
+struct avr_opcodes_s
+{
+  char *name;
+  char *constraints;
+  char *opcode;
+  int insn_size;		/* in words */
+  int isa;
+  unsigned int bin_opcode;
+  unsigned int bin_mask;
 };
 
-static char* last4[] = {"BLD","BST","SBRC","SBRS"};
+#define AVR_INSN(NAME, CONSTR, OPCODE, SIZE, ISA, BIN) \
+{#NAME, CONSTR, OPCODE, SIZE, ISA, BIN, 0},
 
-
-static void dispLDD PARAMS ((u16, char *));
-
-static void
-dispLDD (opcode, dest)
-     u16 opcode;
-     char *dest;
+struct avr_opcodes_s avr_opcodes[] =
 {
-  opcode = (((opcode & 0x2000) >> 8) | ((opcode & 0x0c00) >> 7)
-	    | (opcode & 7));
-  sprintf(dest, "%d", opcode);
+  #include "opcode/avr.h"
+  {NULL, NULL, NULL, 0, 0, 0, 0}
+};
+
+static int avr_operand PARAMS ((unsigned int, unsigned int,
+				unsigned int, int, char *, char *, int));
+
+static int
+avr_operand (insn, insn2, pc, constraint, buf, comment, regs)
+     unsigned int insn;
+     unsigned int insn2;
+     unsigned int pc;
+     int constraint;
+     char *buf;
+     char *comment;
+     int regs;
+{
+  int ok = 1;
+
+  switch (constraint)
+    {
+      /* Any register operand.  */
+    case 'r':
+      if (regs)
+	insn = (insn & 0xf) | ((insn & 0x0200) >> 5); /* source register */
+      else
+	insn = (insn & 0x01f0) >> 4; /* destination register */
+      
+      sprintf (buf, "r%d", insn);
+      break;
+
+    case 'd':
+      if (regs)
+	sprintf (buf, "r%d", 16 + (insn & 0xf));
+      else
+	sprintf (buf, "r%d", 16 + ((insn & 0xf0) >> 4));
+      break;
+      
+    case 'w':
+      sprintf (buf, "r%d", 24 + ((insn & 0x30) >> 3));
+      break;
+      
+    case 'a':
+      if (regs)
+	sprintf (buf, "r%d", 16 + (insn & 7));
+      else
+	sprintf (buf, "r%d", 16 + ((insn >> 4) & 7));
+      break;
+
+    case 'v':
+      if (regs)
+	sprintf (buf, "r%d", (insn & 0xf) * 2);
+      else
+	sprintf (buf, "r%d", ((insn & 0xf0) >> 3));
+      break;
+
+    case 'e':
+      {
+	char *xyz;
+
+	switch (insn & 0x100f)
+	  {
+	    case 0x0000: xyz = "Z";  break;
+	    case 0x1001: xyz = "Z+"; break;
+	    case 0x1002: xyz = "-Z"; break;
+	    case 0x0008: xyz = "Y";  break;
+	    case 0x1009: xyz = "Y+"; break;
+	    case 0x100a: xyz = "-Y"; break;
+	    case 0x100c: xyz = "X";  break;
+	    case 0x100d: xyz = "X+"; break;
+	    case 0x100e: xyz = "-X"; break;
+	    default: xyz = "??"; ok = 0;
+	  }
+	sprintf (buf, xyz);
+
+	if (AVR_UNDEF_P (insn))
+	  sprintf (comment, _("undefined"));
+      }
+      break;
+
+    case 'z':
+      *buf++ = 'Z';
+      if (insn & 0x1)
+	*buf++ = '+';
+      *buf = '\0';
+      if (AVR_UNDEF_P (insn))
+	sprintf (comment, _("undefined"));
+      break;
+
+    case 'b':
+      {
+	unsigned int x;
+	
+	x = (insn & 7);
+	x |= (insn >> 7) & (3 << 3);
+	x |= (insn >> 8) & (1 << 5);
+	
+	if (insn & 0x8)
+	  *buf++ = 'Y';
+	else
+	  *buf++ = 'Z';
+	sprintf (buf, "+%d", x);
+	sprintf (comment, "0x%02x", x);
+      }
+      break;
+      
+    case 'h':
+      sprintf (buf, "0x%x",
+	       ((((insn & 1) | ((insn & 0x1f0) >> 3)) << 16) | insn2) * 2);
+      break;
+      
+    case 'L':
+      {
+	int rel_addr = (((insn & 0xfff) ^ 0x800) - 0x800) * 2;
+	sprintf (buf, ".%+-8d", rel_addr);
+	sprintf (comment, "0x%x", pc + 2 + rel_addr);
+      }
+      break;
+
+    case 'l':
+      {
+	int rel_addr = ((((insn >> 3) & 0x7f) ^ 0x40) - 0x40) * 2;
+	sprintf (buf, ".%+-8d", rel_addr);
+	sprintf (comment, "0x%x", pc + 2 + rel_addr);
+      }
+      break;
+
+    case 'i':
+      sprintf (buf, "0x%04X", insn2);
+      break;
+      
+    case 'M':
+      sprintf (buf, "0x%02X", ((insn & 0xf00) >> 4) | (insn & 0xf));
+      sprintf (comment, "%d", ((insn & 0xf00) >> 4) | (insn & 0xf));
+      break;
+
+    case 'n':
+      sprintf (buf, "??");
+      fprintf (stderr, _("Internal disassembler error"));
+      ok = 0;
+      break;
+      
+    case 'K':
+      {
+	unsigned int x;
+
+	x = (insn & 0xf) | ((insn >> 2) & 0x30);
+	sprintf (buf, "0x%02x", x);
+	sprintf (comment, "%d", x);
+      }
+      break;
+      
+    case 's':
+      sprintf (buf, "%d", insn & 7);
+      break;
+      
+    case 'S':
+      sprintf (buf, "%d", (insn >> 4) & 7);
+      break;
+      
+    case 'P':
+      {
+	unsigned int x;
+	x = (insn & 0xf);
+	x |= (insn >> 5) & 0x30;
+	sprintf (buf, "0x%02x", x);
+	sprintf (comment, "%d", x);
+      }
+      break;
+
+    case 'p':
+      {
+	unsigned int x;
+	
+	x = (insn >> 3) & 0x1f;
+	sprintf (buf, "0x%02x", x);
+	sprintf (comment, "%d", x);
+      }
+      break;
+      
+    case '?':
+      *buf = '\0';
+      break;
+      
+    default:
+      sprintf (buf, "??");
+      fprintf (stderr, _("unknown constraint `%c'"), constraint);
+      ok = 0;
+    }
+
+    return ok;
 }
 
+static unsigned short avrdis_opcode PARAMS ((bfd_vma, disassemble_info *));
 
-static void regPP PARAMS ((u16, char *));
-
-static void
-regPP (opcode, dest)
-     u16 opcode;
-     char *dest;
-{
-  opcode = ((opcode & 0x0600) >> 5) | (opcode & 0xf);
-  sprintf(dest, "0x%02X", opcode);
-}
-
-
-static void reg50 PARAMS ((u16, char *));
-
-static void
-reg50 (opcode, dest)
-     u16 opcode;
-     char *dest;
-{
-  opcode = (opcode & 0x01f0) >> 4;
-  sprintf(dest, "R%d", opcode);
-}
-
-
-static void reg104 PARAMS ((u16, char *));
-
-static void
-reg104 (opcode, dest)
-     u16 opcode;
-     char *dest;
-{
-  opcode = (opcode & 0xf) | ((opcode & 0x0200) >> 5);
-  sprintf(dest, "R%d", opcode);
-}
-
-
-static void reg40 PARAMS ((u16, char *));
-
-static void
-reg40 (opcode, dest)
-     u16 opcode;
-     char *dest;
-{
-  opcode = (opcode & 0xf0) >> 4;
-  sprintf(dest, "R%d", opcode + 16);
-}
-
-
-static void reg20w PARAMS ((u16, char *));
-
-static void
-reg20w (opcode, dest)
-     u16 opcode;
-     char *dest;
-{
-  opcode = (opcode & 0x30) >> 4;
-  sprintf(dest, "R%d", 24 + opcode * 2);
-}
-
-
-static void reg_fmul_d PARAMS ((u16, char *));
-
-static void
-reg_fmul_d (opcode, dest)
-     u16 opcode;
-     char *dest;
-{
-  sprintf(dest, "R%d", 16 + ((opcode >> 4) & 7));
-}
-
-
-static void reg_fmul_r PARAMS ((u16, char *));
-
-static void
-reg_fmul_r (opcode, dest)
-     u16 opcode;
-     char *dest;
-{
-  sprintf(dest, "R%d", 16 + (opcode & 7));
-}
-
-
-static void reg_muls_d PARAMS ((u16, char *));
-
-static void
-reg_muls_d (opcode, dest)
-     u16 opcode;
-     char *dest;
-{
-  sprintf(dest, "R%d", 16 + ((opcode >> 4) & 0xf));
-}
-
-
-static void reg_muls_r PARAMS ((u16, char *));
-
-static void
-reg_muls_r (opcode, dest)
-     u16 opcode;
-     char *dest;
-{
-  sprintf(dest, "R%d", 16 + (opcode & 0xf));
-}
-
-
-static void reg_movw_d PARAMS ((u16, char *));
-
-static void
-reg_movw_d (opcode, dest)
-     u16 opcode;
-     char *dest;
-{
-  sprintf(dest, "R%d", 2 * ((opcode >> 4) & 0xf));
-}
-
-
-static void reg_movw_r PARAMS ((u16, char *));
-
-static void
-reg_movw_r (opcode, dest)
-     u16 opcode;
-     char *dest;
-{
-  sprintf(dest, "R%d", 2 * (opcode & 0xf));
-}
-
-
-static void lit404 PARAMS ((u16, char *));
-
-static void
-lit404 (opcode, dest)
-     u16 opcode;
-     char *dest;
-{
-  opcode = ((opcode & 0xf00) >> 4) | (opcode & 0xf);
-  sprintf(dest, "0x%02X", opcode);
-}
-
-
-static void lit204 PARAMS ((u16, char *));
-
-static void
-lit204 (opcode, dest)
-     u16 opcode;
-     char *dest;
-{
-  opcode = ((opcode & 0xc0) >> 2) | (opcode & 0xf);
-  sprintf(dest, "0x%02X", opcode);
-}
-
-
-static void add0fff PARAMS ((u16, char *, int));
-
-static void
-add0fff (op, dest, pc)
-     u16 op;
-     char *dest;
-     int pc;
-{
-  int rel_addr = (((op & 0xfff) ^ 0x800) - 0x800) * 2;
-  sprintf(dest, ".%+-8d ; 0x%06X", rel_addr, pc + 2 + rel_addr);
-}
-
-
-static void add03f8 PARAMS ((u16, char *, int));
-
-static void
-add03f8 (op, dest, pc)
-     u16 op;
-     char *dest;
-     int pc;
-{
-  int rel_addr = ((((op >> 3) & 0x7f) ^ 0x40) - 0x40) * 2;
-  sprintf(dest, ".%+-8d ; 0x%06X", rel_addr, pc + 2 + rel_addr);
-}
-
-
-static u16 avrdis_opcode PARAMS ((bfd_vma, disassemble_info *));
-
-static u16
+static unsigned short
 avrdis_opcode (addr, info)
      bfd_vma addr;
      disassemble_info *info;
@@ -255,402 +256,104 @@
      bfd_vma addr;
      disassemble_info *info;
 {
-  char rr[200];
-  char rd[200];
-  u16 opcode;
+  unsigned int insn, insn2;
+  struct avr_opcodes_s *opcode;
   void *stream = info->stream;
   fprintf_ftype prin = info->fprintf_func;
+  static int initialized;
   int cmd_len = 2;
+  int ok = 0;
+  char op1[20], op2[20], comment1[40], comment2[40];
 
-  opcode = avrdis_opcode (addr, info);
+  if (!initialized)
+    {
+      initialized = 1;
+      
+      for (opcode = avr_opcodes; opcode->name; opcode++)
+	{
+	  char * s;
+	  unsigned int bin = 0;
+	  unsigned int mask = 0;
+	
+	  for (s = opcode->opcode; *s; ++s)
+	    {
+	      bin <<= 1;
+	      mask <<= 1;
+	      bin |= (*s == '1');
+	      mask |= (*s == '1' || *s == '0');
+	    }
+	  assert (s - opcode->opcode == 16);
+	  assert (opcode->bin_opcode == bin);
+	  opcode->bin_mask = mask;
+	}
+    }
 
-  if (IFMASK(0xd000, 0x8000))
+  insn = avrdis_opcode (addr, info);
+  
+  for (opcode = avr_opcodes; opcode->name; opcode++)
     {
-      char letter;
-      reg50(opcode, rd);
-      dispLDD(opcode, rr);
-      if (opcode & 8)
-	letter = 'Y';
-      else
-	letter = 'Z';
-      if (opcode & 0x0200)
-	(*prin) (stream, "    STD     %c+%s,%s", letter, rr, rd);
-      else
-	(*prin) (stream, "    LDD     %s,%c+%s", rd, letter, rr);
+      if ((insn & opcode->bin_mask) == opcode->bin_opcode)
+	break;
     }
-  else
+  
+  /* Special case: disassemble `ldd r,b+0' as `ld r,b', and
+     `std b+0,r' as `st b,r' (next entry in the table).  */
+
+  if (AVR_DISP0_P (insn))
+    opcode++;
+
+  op1[0] = 0;
+  op2[0] = 0;
+  comment1[0] = 0;
+  comment2[0] = 0;
+
+  if (opcode->name)
     {
-      switch (opcode & 0xf000)
-        {
-        case 0x0000:
-	  {
-	    reg50(opcode, rd);
-	    reg104(opcode, rr);
-	    switch (opcode & 0x0c00)
-	      {
-	      case 0x0000:
-		switch (opcode & 0x0300)
-		  {
-		  case 0x0000:
-		    (*prin) (stream, "    NOP");
-		    break;
-		  case 0x0100:
-		    reg_movw_d(opcode, rd);
-		    reg_movw_r(opcode, rr);
-		    (*prin) (stream, "    MOVW    %s,%s", rd, rr);
-		    break;
-		  case 0x0200:
-		    reg_muls_d(opcode, rd);
-		    reg_muls_r(opcode, rr);
-		    (*prin) (stream, "    MULS    %s,%s", rd, rr);
-		    break;
-		  case 0x0300:
-		    reg_fmul_d(opcode, rd);
-		    reg_fmul_r(opcode, rr);
-		    if (IFMASK(0x88, 0))
-		      (*prin) (stream, "    MULSU   %s,%s", rd, rr);
-		    else if (IFMASK(0x88, 8))
-		      (*prin) (stream, "    FMUL    %s,%s", rd, rr);
-		    else if (IFMASK(0x88, 0x80))
-		      (*prin) (stream, "    FMULS   %s,%s", rd, rr);
-		    else
-		      (*prin) (stream, "    FMULSU  %s,%s", rd, rr);
-		  }
-		break;
-	      case 0x0400:
-		(*prin) (stream, "    CPC     %s,%s", rd, rr);
-		break;
-	      case 0x0800:
-		(*prin) (stream, "    SBC     %s,%s", rd, rr);
-		break;
-	      case 0x0c00:
-		(*prin) (stream, "    ADD     %s,%s", rd, rr);
-		break;
-	      }
-	  }
-	  break;
-        case 0x1000:
-	  {
-	    reg50(opcode, rd);
-	    reg104(opcode, rr);
-	    switch (opcode & 0x0c00)
-	      {
-	      case 0x0000:
-		(*prin) (stream, "    CPSE    %s,%s", rd, rr);
-		break;
-	      case 0x0400:
-		(*prin) (stream, "    CP      %s,%s", rd, rr);
-		break;
-	      case 0x0800:
-		(*prin) (stream, "    SUB     %s,%s", rd, rr);
-		break;
-	      case 0x0c00:
-		(*prin) (stream, "    ADC     %s,%s", rd, rr);
-		break;
-	      }
-	  }
-	  break;
-        case 0x2000:
-	  {
-	    reg50(opcode, rd);
-	    reg104(opcode, rr);
-	    switch (opcode & 0x0c00)
-	      {
-	      case 0x0000:
-		(*prin) (stream, "    AND     %s,%s", rd, rr);
-		break;
-	      case 0x0400:
-		(*prin) (stream, "    EOR     %s,%s", rd, rr);
-		break;
-	      case 0x0800:
-		(*prin) (stream, "    OR      %s,%s", rd, rr);
-		break;
-	      case 0x0c00:
-		(*prin) (stream, "    MOV     %s,%s", rd, rr);
-		break;
-	      }
-	  }
-	  break;
-        case 0x3000:
-	  {
-	    reg40(opcode, rd);
-	    lit404(opcode, rr);
-	    (*prin) (stream, "    CPI     %s,%s", rd, rr);
-	  }
-	  break;
-        case 0x4000:
-	  {
-	    reg40(opcode, rd);
-	    lit404(opcode, rr);
-	    (*prin) (stream, "    SBCI    %s,%s", rd, rr);
-	  }
-	  break;
-        case 0x5000:
-	  {
-	    reg40(opcode, rd);
-	    lit404(opcode, rr);
-	    (*prin) (stream, "    SUBI    %s,%s", rd, rr);
-	  }
-	  break;
-        case 0x6000:
-	  {
-	    reg40(opcode, rd);
-	    lit404(opcode, rr);
-	    (*prin) (stream, "    ORI     %s,%s", rd, rr);
-	  }
-	  break;
-        case 0x7000:
-	  {
-	    reg40(opcode, rd);
-	    lit404(opcode, rr);
-	    (*prin) (stream, "    ANDI    %s,%s", rd, rr);
-	  }
-	  break;
-        case 0x9000:
-	  {
-	    switch (opcode & 0x0e00)
-	      {
-	      case 0x0000:
-		{
-		  reg50(opcode, rd);
-		  switch (opcode & 0xf)
-		    {
-		    case 0x0:
-		      {
-			(*prin) (stream, "    LDS     %s,0x%04X", rd,
-				 avrdis_opcode(addr + 2, info));
-			cmd_len = 4;
-		      }
-		      break;
-		    case 0x1:
-		      (*prin) (stream, "    LD      %s,Z+", rd);
-		      break;
-		    case 0x2:
-		      (*prin) (stream, "    LD      %s,-Z", rd);
-		      break;
-		    case 0x4:
-		      (*prin) (stream, "    LPM     %s,Z", rd);
-		      break;
-		    case 0x5:
-		      (*prin) (stream, "    LPM     %s,Z+", rd);
-		      break;
-		    case 0x6:
-		      (*prin) (stream, "    ELPM    %s,Z", rd);
-		      break;
-		    case 0x7:
-		      (*prin) (stream, "    ELPM    %s,Z+", rd);
-		      break;
-		    case 0x9:
-		      (*prin) (stream, "    LD      %s,Y+", rd);
-		      break;
-		    case 0xa:
-		      (*prin) (stream, "    LD      %s,-Y", rd);
-		      break;
-		    case 0xc:
-		      (*prin) (stream, "    LD      %s,X", rd);
-		      break;
-		    case 0xd:
-		      (*prin) (stream, "    LD      %s,X+", rd);
-		      break;
-		    case 0xe:
-		      (*prin) (stream, "    LD      %s,-X", rd);
-		      break;
-		    case 0xf:
-		      (*prin) (stream, "    POP     %s", rd);
-		      break;
-		    default:
-		      (*prin) (stream, "    ????");
-		      break;
-		    }
-		}
-		break;
-	      case 0x0200:
-		{
-		  reg50(opcode, rd);
-		  switch (opcode & 0xf)
-		    {
-		    case 0x0:
-		      {
-			(*prin) (stream, "    STS     0x%04X,%s",
-				 avrdis_opcode(addr + 2, info), rd);
-			cmd_len = 4;
-		      }
-		      break;
-		    case 0x1:
-		      (*prin) (stream, "    ST      Z+,%s", rd);
-		      break;
-		    case 0x2:
-		      (*prin) (stream, "    ST      -Z,%s", rd);
-		      break;
-		    case 0x9:
-		      (*prin) (stream, "    ST      Y+,%s", rd);
-		      break;
-		    case 0xa:
-		      (*prin) (stream, "    ST      -Y,%s", rd);
-		      break;
-		    case 0xc:
-		      (*prin) (stream, "    ST      X,%s", rd);
-		      break;
-		    case 0xd:
-		      (*prin) (stream, "    ST      X+,%s", rd);
-		      break;
-		    case 0xe:
-		      (*prin) (stream, "    ST      -X,%s", rd);
-		      break;
-		    case 0xf:
-		      (*prin) (stream, "    PUSH    %s", rd);
-		      break;
-		    default:
-		      (*prin) (stream, "    ????");
-		      break;
-		    }
-		}
-		break;
-	      case 0x0400:
-		{
-		  if (IFMASK(0x020c, 0x000c))
-		    {
-		      u32 k = ((opcode & 0x01f0) >> 3) | (opcode & 1);
-		      k = (k << 16) | avrdis_opcode(addr + 2, info);
-		      if (opcode & 0x0002)
-			(*prin) (stream, "    CALL    0x%06X", k*2);
-		      else
-			(*prin) (stream, "    JMP     0x%06X", k*2);
-		      cmd_len = 4;
-		    }
-		  else if (IFMASK(0x010f, 0x0008))
-		    {
-		      int sf = (opcode & 0x70) >> 4;
-		      if (opcode & 0x0080)
-			(*prin) (stream, "    CL%c", SREG_flags[sf]);
-		      else
-			(*prin) (stream, "    SE%c", SREG_flags[sf]);
-		    }
-		  else if (IFMASK(0x001f, 0x0009))
-		    {
-		      if (opcode & 0x0100)
-			(*prin) (stream, "    ICALL");
-		      else
-			(*prin) (stream, "    IJMP");
-		    }
-		  else if (IFMASK(0x001f, 0x0019))
-		    {
-		      if (opcode & 0x0100)
-			(*prin) (stream, "    EICALL");
-		      else
-			(*prin) (stream, "    EIJMP");
-		    }
-		  else if (IFMASK(0x010f, 0x0108))
-		    {
-		      if (IFMASK(0x0090, 0x0000))
-			(*prin) (stream, "    RET");
-		      else if (IFMASK(0x0090, 0x0010))
-			(*prin) (stream, "    RETI");
-		      else if (IFMASK(0x00e0, 0x0080))
-			(*prin) (stream, "    SLEEP");
-		      else if (IFMASK(0x00e0, 0x00a0))
-			(*prin) (stream, "    WDR");
-		      else if (IFMASK(0x00f0, 0x00c0))
-			(*prin) (stream, "    LPM");
-		      else if (IFMASK(0x00f0, 0x00d0))
-			(*prin) (stream, "    ELPM");
-		      else if (IFMASK(0x00f0, 0x00e0))
-			(*prin) (stream, "    SPM");
-		      else if (IFMASK(0x00f0, 0x00f0))
-			(*prin) (stream, "    ESPM");
-		      else
-			(*prin) (stream, "    ????");
-		    }
-		  else
-		    {
-		      const char* p;
-		      reg50(opcode, rd);
-		      p = sect94[opcode & 0xf];
-		      if (!p)
-			p = "????";
-		      (*prin) (stream, "    %-8s%s", p, rd);
-		    }
-		}
-		break;
-	      case 0x0600:
-		{
-		  if (opcode & 0x0200)
-		    {
-		      lit204(opcode, rd);
-		      reg20w(opcode, rr);
-		      if (opcode & 0x0100)
-			(*prin) (stream, "    SBIW    %s,%s", rr, rd);
-		      else
-			(*prin) (stream, "    ADIW    %s,%s", rr, rd);
-		    }
-		}
-		break;
-	      case 0x0800:
-	      case 0x0a00:
-		{
-		  (*prin) (stream, "    %-8s0x%02X,%d",
-			   sect98[(opcode & 0x0300) >> 8],
-			   (opcode & 0xf8) >> 3,
-			   opcode & 7);
-		}
-		break;
-	      default:
-		{
-		  reg50(opcode, rd);
-		  reg104(opcode, rr);
-		  (*prin) (stream, "    MUL     %s,%s", rd, rr);
-		}
-	      }
-	  }
-	  break;
-        case 0xb000:
-	  {
-	    reg50(opcode, rd);
-	    regPP(opcode, rr);
-	    if (opcode & 0x0800)
-	      (*prin) (stream, "    OUT     %s,%s", rr, rd);
-	    else
-	      (*prin) (stream, "    IN      %s,%s", rd, rr);
-	  }
-	  break;
-        case 0xc000:
-	  {
-	    add0fff(opcode, rd, addr);
-	    (*prin) (stream, "    RJMP    %s", rd);
-	  }
-	  break;
-        case 0xd000:
-	  {
-	    add0fff(opcode, rd, addr);
-	    (*prin) (stream, "    RCALL   %s", rd);
-	  }
-	  break;
-        case 0xe000:
-	  {
-	    reg40(opcode, rd);
-	    lit404(opcode, rr);
-	    (*prin) (stream, "    LDI     %s,%s", rd, rr);
-	  }
-	  break;
-        case 0xf000:
-	  {
-	    if (opcode & 0x0800)
-	      {
-		reg50(opcode, rd);
-		(*prin) (stream, "    %-8s%s,%d",
-			 last4[(opcode & 0x0600) >> 9],
-			 rd, opcode & 7);
-	      }
-	    else
-	      {
-		char* p;
-		add03f8(opcode, rd, addr);
-		p = branchs[((opcode & 0x0400) >> 7) | (opcode & 7)];
-		(*prin) (stream, "    %-8s%s", p, rd);
-	      }
-	  }
-	  break;
-        }
+      char *op = opcode->constraints;
+
+      insn2 = 0;
+      ok = 1;
+
+      if (opcode->insn_size > 1)
+	{
+	  insn2 = avrdis_opcode (addr + 2, info);
+	  cmd_len = 4;
+	}
+
+      if (*op && *op != '?')
+	{
+	  int regs = REGISTER_P (*op);
+
+	  ok = avr_operand (insn, insn2, addr, *op, op1, comment1, 0);
+
+	  if (ok && *(++op) == ',')
+	    ok = avr_operand (insn, insn2, addr, *(++op), op2,
+			      *comment1 ? comment2 : comment1, regs);
+	}
     }
+
+  if (!ok)
+    {
+      /* Unknown opcode, or invalid combination of operands.  */
+      sprintf (op1, "0x%04x", insn);
+      op2[0] = 0;
+      sprintf (comment1, "????");
+      comment2[0] = 0;
+    }
+
+  (*prin) (stream, "%s", ok ? opcode->name : ".word");
+
+  if (*op1)
+    (*prin) (stream, "\t%s", op1);
+
+  if (*op2)
+    (*prin) (stream, ", %s", op2);
+
+  if (*comment1)
+    (*prin) (stream, "\t; %s", comment1);
+
+  if (*comment2)
+    (*prin) (stream, " %s", comment2);
+
   return cmd_len;
 }
diff --git a/opcodes/cgen-asm.c b/opcodes/cgen-asm.c
index 4ed6936..1e7ef2c 100644
--- a/opcodes/cgen-asm.c
+++ b/opcodes/cgen-asm.c
@@ -66,7 +66,7 @@
      CGEN_CPU_DESC cd;
      const CGEN_INSN *insns;
      int count;
-     int entsize;
+     int entsize ATTRIBUTE_UNUSED;
      CGEN_INSN_LIST **htable;
      CGEN_INSN_LIST *hentbuf;
 {
@@ -198,7 +198,7 @@
 
 const char *
 cgen_parse_keyword (cd, strp, keyword_table, valuep)
-     CGEN_CPU_DESC cd;
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
      const char **strp;
      CGEN_KEYWORD *keyword_table;
      long *valuep;
diff --git a/opcodes/cgen-asm.in b/opcodes/cgen-asm.in
new file mode 100644
index 0000000..ad6d172
--- /dev/null
+++ b/opcodes/cgen-asm.in
@@ -0,0 +1,312 @@
+/* Assembler interface for targets using CGEN. -*- C -*-
+   CGEN: Cpu tools GENerator
+
+THIS FILE IS MACHINE GENERATED WITH CGEN.
+- the resultant file is machine generated, cgen-asm.in isn't
+
+Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of the GNU Binutils and GDB, the GNU debugger.
+
+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.  */
+
+/* ??? Eventually more and more of this stuff can go to cpu-independent files.
+   Keep that in mind.  */
+
+#include "sysdep.h"
+#include <ctype.h>
+#include <stdio.h>
+#include "ansidecl.h"
+#include "bfd.h"
+#include "symcat.h"
+#include "@prefix@-desc.h"
+#include "@prefix@-opc.h"
+#include "opintl.h"
+
+#undef min
+#define min(a,b) ((a) < (b) ? (a) : (b))
+#undef max
+#define max(a,b) ((a) > (b) ? (a) : (b))
+
+static const char * parse_insn_normal
+     PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, const char **, CGEN_FIELDS *));
+
+/* -- assembler routines inserted here */
+
+/* Default insn parser.
+
+   The syntax string is scanned and operands are parsed and stored in FIELDS.
+   Relocs are queued as we go via other callbacks.
+
+   ??? Note that this is currently an all-or-nothing parser.  If we fail to
+   parse the instruction, we return 0 and the caller will start over from
+   the beginning.  Backtracking will be necessary in parsing subexpressions,
+   but that can be handled there.  Not handling backtracking here may get
+   expensive in the case of the m68k.  Deal with later.
+
+   Returns NULL for success, an error message for failure.
+*/
+
+static const char *
+parse_insn_normal (cd, insn, strp, fields)
+     CGEN_CPU_DESC cd;
+     const CGEN_INSN *insn;
+     const char **strp;
+     CGEN_FIELDS *fields;
+{
+  /* ??? Runtime added insns not handled yet.  */
+  const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
+  const char *str = *strp;
+  const char *errmsg;
+  const char *p;
+  const unsigned char * syn;
+#ifdef CGEN_MNEMONIC_OPERANDS
+  /* FIXME: wip */
+  int past_opcode_p;
+#endif
+
+  /* For now we assume the mnemonic is first (there are no leading operands).
+     We can parse it without needing to set up operand parsing.
+     GAS's input scrubber will ensure mnemonics are lowercase, but we may
+     not be called from GAS.  */
+  p = CGEN_INSN_MNEMONIC (insn);
+  while (*p && tolower (*p) == tolower (*str))
+    ++p, ++str;
+
+  if (* p)
+    return _("unrecognized instruction");
+
+#ifndef CGEN_MNEMONIC_OPERANDS
+  if (* str && !isspace (* str))
+    return _("unrecognized instruction");
+#endif
+
+  CGEN_INIT_PARSE (cd);
+  cgen_init_parse_operand (cd);
+#ifdef CGEN_MNEMONIC_OPERANDS
+  past_opcode_p = 0;
+#endif
+
+  /* We don't check for (*str != '\0') here because we want to parse
+     any trailing fake arguments in the syntax string.  */
+  syn = CGEN_SYNTAX_STRING (syntax);
+
+  /* Mnemonics come first for now, ensure valid string.  */
+  if (! CGEN_SYNTAX_MNEMONIC_P (* syn))
+    abort ();
+
+  ++syn;
+
+  while (* syn != 0)
+    {
+      /* Non operand chars must match exactly.  */
+      if (CGEN_SYNTAX_CHAR_P (* syn))
+	{
+	  /* FIXME: While we allow for non-GAS callers above, we assume the
+	     first char after the mnemonic part is a space.  */
+	  /* FIXME: We also take inappropriate advantage of the fact that
+	     GAS's input scrubber will remove extraneous blanks.  */
+	  if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn)))
+	    {
+#ifdef CGEN_MNEMONIC_OPERANDS
+	      if (* syn == ' ')
+		past_opcode_p = 1;
+#endif
+	      ++ syn;
+	      ++ str;
+	    }
+	  else
+	    {
+	      /* Syntax char didn't match.  Can't be this insn.  */
+	      static char msg [80];
+	      /* xgettext:c-format */
+	      sprintf (msg, _("syntax error (expected char `%c', found `%c')"),
+		       *syn, *str);
+	      return msg;
+	    }
+	  continue;
+	}
+
+      /* We have an operand of some sort.  */
+      errmsg = @arch@_cgen_parse_operand (cd, CGEN_SYNTAX_FIELD (*syn),
+					  &str, fields);
+      if (errmsg)
+	return errmsg;
+
+      /* Done with this operand, continue with next one.  */
+      ++ syn;
+    }
+
+  /* If we're at the end of the syntax string, we're done.  */
+  if (* syn == '\0')
+    {
+      /* FIXME: For the moment we assume a valid `str' can only contain
+	 blanks now.  IE: We needn't try again with a longer version of
+	 the insn and it is assumed that longer versions of insns appear
+	 before shorter ones (eg: lsr r2,r3,1 vs lsr r2,r3).  */
+      while (isspace (* str))
+	++ str;
+
+      if (* str != '\0')
+	return _("junk at end of line"); /* FIXME: would like to include `str' */
+
+      return NULL;
+    }
+
+  /* We couldn't parse it.  */
+  return _("unrecognized instruction");
+}
+
+/* Main entry point.
+   This routine is called for each instruction to be assembled.
+   STR points to the insn to be assembled.
+   We assume all necessary tables have been initialized.
+   The assembled instruction, less any fixups, is stored in BUF.
+   Remember that if CGEN_INT_INSN_P then BUF is an int and thus the value
+   still needs to be converted to target byte order, otherwise BUF is an array
+   of bytes in target byte order.
+   The result is a pointer to the insn's entry in the opcode table,
+   or NULL if an error occured (an error message will have already been
+   printed).
+
+   Note that when processing (non-alias) macro-insns,
+   this function recurses.
+
+   ??? It's possible to make this cpu-independent.
+   One would have to deal with a few minor things.
+   At this point in time doing so would be more of a curiosity than useful
+   [for example this file isn't _that_ big], but keeping the possibility in
+   mind helps keep the design clean.  */
+
+const CGEN_INSN *
+@arch@_cgen_assemble_insn (cd, str, fields, buf, errmsg)
+     CGEN_CPU_DESC cd;
+     const char *str;
+     CGEN_FIELDS *fields;
+     CGEN_INSN_BYTES_PTR buf;
+     char **errmsg;
+{
+  const char *start;
+  CGEN_INSN_LIST *ilist;
+  const char *parse_errmsg = NULL;
+  const char *insert_errmsg = NULL;
+
+  /* Skip leading white space.  */
+  while (isspace (* str))
+    ++ str;
+
+  /* The instructions are stored in hashed lists.
+     Get the first in the list.  */
+  ilist = CGEN_ASM_LOOKUP_INSN (cd, str);
+
+  /* Keep looking until we find a match.  */
+
+  start = str;
+  for ( ; ilist != NULL ; ilist = CGEN_ASM_NEXT_INSN (ilist))
+    {
+      const CGEN_INSN *insn = ilist->insn;
+
+#ifdef CGEN_VALIDATE_INSN_SUPPORTED 
+      /* not usually needed as unsupported opcodes shouldn't be in the hash lists */
+      /* Is this insn supported by the selected cpu?  */
+      if (! @arch@_cgen_insn_supported (cd, insn))
+	continue;
+#endif
+
+      /* If the RELAX attribute is set, this is an insn that shouldn't be
+	 chosen immediately.  Instead, it is used during assembler/linker
+	 relaxation if possible.  */
+      if (CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAX) != 0)
+	continue;
+
+      str = start;
+
+      /* Allow parse/insert handlers to obtain length of insn.  */
+      CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
+
+      parse_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields);
+      if (parse_errmsg != NULL)
+	continue;
+
+      /* ??? 0 is passed for `pc' */
+      insert_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf,
+						 (bfd_vma) 0);
+      if (insert_errmsg != NULL)
+        continue;
+
+      /* It is up to the caller to actually output the insn and any
+         queued relocs.  */
+      return insn;
+    }
+
+  {
+    static char errbuf[150];
+    const char *tmp_errmsg;
+
+#ifdef CGEN_VERBOSE_ASSEMBLER_ERRORS
+    /* If requesting verbose error messages, use insert_errmsg.
+       Failing that, use parse_errmsg */
+    tmp_errmsg = (insert_errmsg ? insert_errmsg :
+		  parse_errmsg ? parse_errmsg :
+		  _("unrecognized instruction"));
+
+    if (strlen (start) > 50)
+      /* xgettext:c-format */
+      sprintf (errbuf, "%s `%.50s...'", tmp_errmsg, start);
+    else 
+      /* xgettext:c-format */
+      sprintf (errbuf, "%s `%.50s'", tmp_errmsg, start);
+#else
+    if (strlen (start) > 50)
+      /* xgettext:c-format */
+      sprintf (errbuf, _("bad instruction `%.50s...'"), start);
+    else 
+      /* xgettext:c-format */
+      sprintf (errbuf, _("bad instruction `%.50s'"), start);
+#endif
+      
+    *errmsg = errbuf;
+    return NULL;
+  }
+}
+
+#if 0 /* This calls back to GAS which we can't do without care.  */
+
+/* Record each member of OPVALS in the assembler's symbol table.
+   This lets GAS parse registers for us.
+   ??? Interesting idea but not currently used.  */
+
+/* Record each member of OPVALS in the assembler's symbol table.
+   FIXME: Not currently used.  */
+
+void
+@arch@_cgen_asm_hash_keywords (cd, opvals)
+     CGEN_CPU_DESC cd;
+     CGEN_KEYWORD *opvals;
+{
+  CGEN_KEYWORD_SEARCH search = cgen_keyword_search_init (opvals, NULL);
+  const CGEN_KEYWORD_ENTRY * ke;
+
+  while ((ke = cgen_keyword_search_next (& search)) != NULL)
+    {
+#if 0 /* Unnecessary, should be done in the search routine.  */
+      if (! @arch@_cgen_opval_supported (ke))
+	continue;
+#endif
+      cgen_asm_record_register (cd, ke->name, ke->value);
+    }
+}
+
+#endif /* 0 */
diff --git a/opcodes/cgen-dis.c b/opcodes/cgen-dis.c
index 78b1cd9..f8598f1 100644
--- a/opcodes/cgen-dis.c
+++ b/opcodes/cgen-dis.c
@@ -43,7 +43,7 @@
      CGEN_CPU_DESC cd;
      const CGEN_INSN * insns;
      int count;
-     int entsize;
+     int entsize ATTRIBUTE_UNUSED;
      CGEN_INSN_LIST ** htable;
      CGEN_INSN_LIST * hentbuf;
 {
diff --git a/opcodes/cgen-dis.in b/opcodes/cgen-dis.in
new file mode 100644
index 0000000..22cef1f
--- /dev/null
+++ b/opcodes/cgen-dis.in
@@ -0,0 +1,431 @@
+/* Disassembler interface for targets using CGEN. -*- C -*-
+   CGEN: Cpu tools GENerator
+
+THIS FILE IS MACHINE GENERATED WITH CGEN.
+- the resultant file is machine generated, cgen-dis.in isn't
+
+Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of the GNU Binutils and GDB, the GNU debugger.
+
+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.  */
+
+/* ??? Eventually more and more of this stuff can go to cpu-independent files.
+   Keep that in mind.  */
+
+#include "sysdep.h"
+#include <stdio.h>
+#include "ansidecl.h"
+#include "dis-asm.h"
+#include "bfd.h"
+#include "symcat.h"
+#include "@prefix@-desc.h"
+#include "@prefix@-opc.h"
+#include "opintl.h"
+
+/* Default text to print if an instruction isn't recognized.  */
+#define UNKNOWN_INSN_MSG _("*unknown*")
+
+static void print_normal
+     PARAMS ((CGEN_CPU_DESC, PTR, long, unsigned int, bfd_vma, int));
+static void print_address
+     PARAMS ((CGEN_CPU_DESC, PTR, bfd_vma, unsigned int, bfd_vma, int));
+static void print_keyword
+     PARAMS ((CGEN_CPU_DESC, PTR, CGEN_KEYWORD *, long, unsigned int));
+static void print_insn_normal
+     PARAMS ((CGEN_CPU_DESC, PTR, const CGEN_INSN *, CGEN_FIELDS *,
+	      bfd_vma, int));
+static int print_insn PARAMS ((CGEN_CPU_DESC, bfd_vma,
+			       disassemble_info *, char *, int));
+static int default_print_insn
+     PARAMS ((CGEN_CPU_DESC, bfd_vma, disassemble_info *));
+
+/* -- disassembler routines inserted here */
+
+/* Default print handler.  */
+
+static void
+print_normal (cd, dis_info, value, attrs, pc, length)
+#ifdef CGEN_PRINT_NORMAL
+     CGEN_CPU_DESC cd;
+#else
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+#endif
+     PTR dis_info;
+     long value;
+     unsigned int attrs;
+#ifdef CGEN_PRINT_NORMAL
+     bfd_vma pc;
+     int length;
+#else
+     bfd_vma pc ATTRIBUTE_UNUSED;
+     int length ATTRIBUTE_UNUSED;
+#endif
+{
+  disassemble_info *info = (disassemble_info *) dis_info;
+
+#ifdef CGEN_PRINT_NORMAL
+  CGEN_PRINT_NORMAL (cd, info, value, attrs, pc, length);
+#endif
+
+  /* Print the operand as directed by the attributes.  */
+  if (CGEN_BOOL_ATTR (attrs, CGEN_OPERAND_SEM_ONLY))
+    ; /* nothing to do */
+  else if (CGEN_BOOL_ATTR (attrs, CGEN_OPERAND_SIGNED))
+    (*info->fprintf_func) (info->stream, "%ld", value);
+  else
+    (*info->fprintf_func) (info->stream, "0x%lx", value);
+}
+
+/* Default address handler.  */
+
+static void
+print_address (cd, dis_info, value, attrs, pc, length)
+#ifdef CGEN_PRINT_NORMAL
+     CGEN_CPU_DESC cd;
+#else
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+#endif
+     PTR dis_info;
+     bfd_vma value;
+     unsigned int attrs;
+#ifdef CGEN_PRINT_NORMAL
+     bfd_vma pc;
+     int length;
+#else
+     bfd_vma pc ATTRIBUTE_UNUSED;
+     int length ATTRIBUTE_UNUSED;
+#endif
+{
+  disassemble_info *info = (disassemble_info *) dis_info;
+
+#ifdef CGEN_PRINT_ADDRESS
+  CGEN_PRINT_ADDRESS (cd, info, value, attrs, pc, length);
+#endif
+
+  /* Print the operand as directed by the attributes.  */
+  if (CGEN_BOOL_ATTR (attrs, CGEN_OPERAND_SEM_ONLY))
+    ; /* nothing to do */
+  else if (CGEN_BOOL_ATTR (attrs, CGEN_OPERAND_PCREL_ADDR))
+    (*info->print_address_func) (value, info);
+  else if (CGEN_BOOL_ATTR (attrs, CGEN_OPERAND_ABS_ADDR))
+    (*info->print_address_func) (value, info);
+  else if (CGEN_BOOL_ATTR (attrs, CGEN_OPERAND_SIGNED))
+    (*info->fprintf_func) (info->stream, "%ld", (long) value);
+  else
+    (*info->fprintf_func) (info->stream, "0x%lx", (long) value);
+}
+
+/* Keyword print handler.  */
+
+static void
+print_keyword (cd, dis_info, keyword_table, value, attrs)
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+     PTR dis_info;
+     CGEN_KEYWORD *keyword_table;
+     long value;
+     unsigned int attrs ATTRIBUTE_UNUSED;
+{
+  disassemble_info *info = (disassemble_info *) dis_info;
+  const CGEN_KEYWORD_ENTRY *ke;
+
+  ke = cgen_keyword_lookup_value (keyword_table, value);
+  if (ke != NULL)
+    (*info->fprintf_func) (info->stream, "%s", ke->name);
+  else
+    (*info->fprintf_func) (info->stream, "???");
+}
+
+/* Default insn printer.
+
+   DIS_INFO is defined as `PTR' so the disassembler needn't know anything
+   about disassemble_info.  */
+
+static void
+print_insn_normal (cd, dis_info, insn, fields, pc, length)
+     CGEN_CPU_DESC cd;
+     PTR dis_info;
+     const CGEN_INSN *insn;
+     CGEN_FIELDS *fields;
+     bfd_vma pc;
+     int length;
+{
+  const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
+  disassemble_info *info = (disassemble_info *) dis_info;
+  const unsigned char *syn;
+
+  CGEN_INIT_PRINT (cd);
+
+  for (syn = CGEN_SYNTAX_STRING (syntax); *syn; ++syn)
+    {
+      if (CGEN_SYNTAX_MNEMONIC_P (*syn))
+	{
+	  (*info->fprintf_func) (info->stream, "%s", CGEN_INSN_MNEMONIC (insn));
+	  continue;
+	}
+      if (CGEN_SYNTAX_CHAR_P (*syn))
+	{
+	  (*info->fprintf_func) (info->stream, "%c", CGEN_SYNTAX_CHAR (*syn));
+	  continue;
+	}
+
+      /* We have an operand.  */
+      @arch@_cgen_print_operand (cd, CGEN_SYNTAX_FIELD (*syn), info,
+				 fields, CGEN_INSN_ATTRS (insn), pc, length);
+    }
+}
+
+/* Subroutine of print_insn. Reads an insn into the given buffers and updates
+   the extract info.
+   Returns 0 if all is well, non-zero otherwise.  */
+static int
+read_insn (cd, pc, info, buf, buflen, ex_info, insn_value)
+     CGEN_CPU_DESC cd;
+     bfd_vma pc;
+     disassemble_info *info;
+     char *buf;
+     int buflen;
+     CGEN_EXTRACT_INFO *ex_info;
+     unsigned long *insn_value;
+{
+  int status = (*info->read_memory_func) (pc, buf, buflen, info);
+  if (status != 0)
+    {
+      (*info->memory_error_func) (status, pc, info);
+      return -1;
+    }
+
+  ex_info->dis_info = info;
+  ex_info->valid = (1 << buflen) - 1;
+  ex_info->insn_bytes = buf;
+
+  switch (buflen)
+    {
+    case 1:
+      *insn_value = buf[0];
+      break;
+    case 2:
+      *insn_value = info->endian == BFD_ENDIAN_BIG ? bfd_getb16 (buf) : bfd_getl16 (buf);
+      break;
+    case 4:
+      *insn_value = info->endian == BFD_ENDIAN_BIG ? bfd_getb32 (buf) : bfd_getl32 (buf);
+      break;
+    default:
+      abort ();
+    }
+
+  return 0;
+}
+
+/* Utility to print an insn.
+   BUF is the base part of the insn, target byte order, BUFLEN bytes long.
+   The result is the size of the insn in bytes or zero for an unknown insn
+   or -1 if an error occurs fetching data (memory_error_func will have
+   been called).  */
+
+static int
+print_insn (cd, pc, info, buf, buflen)
+     CGEN_CPU_DESC cd;
+     bfd_vma pc;
+     disassemble_info *info;
+     char *buf;
+     int buflen;
+{
+  unsigned long insn_value;
+  const CGEN_INSN_LIST *insn_list;
+  CGEN_EXTRACT_INFO ex_info;
+
+  int rc = read_insn (cd, pc, info, buf, buflen, & ex_info, & insn_value);
+  if (rc != 0)
+    return rc;
+
+  /* The instructions are stored in hash lists.
+     Pick the first one and keep trying until we find the right one.  */
+
+  insn_list = CGEN_DIS_LOOKUP_INSN (cd, buf, insn_value);
+  while (insn_list != NULL)
+    {
+      const CGEN_INSN *insn = insn_list->insn;
+      CGEN_FIELDS fields;
+      int length;
+
+#ifdef CGEN_VALIDATE_INSN_SUPPORTED 
+      /* not needed as insn shouldn't be in hash lists if not supported */
+      /* Supported by this cpu?  */
+      if (! @arch@_cgen_insn_supported (cd, insn))
+        {
+          insn_list = CGEN_DIS_NEXT_INSN (insn_list);
+	  continue;
+        }
+#endif
+
+      /* Basic bit mask must be correct.  */
+      /* ??? May wish to allow target to defer this check until the extract
+	 handler.  */
+      if ((insn_value & CGEN_INSN_BASE_MASK (insn))
+	  == CGEN_INSN_BASE_VALUE (insn))
+	{
+	  /* Printing is handled in two passes.  The first pass parses the
+	     machine insn and extracts the fields.  The second pass prints
+	     them.  */
+
+	  /* Make sure the entire insn is loaded into insn_value, if it
+	     can fit.  */
+	  if (CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize &&
+	      (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long))
+	    {
+	      unsigned long full_insn_value;
+	      int rc = read_insn (cd, pc, info, buf,
+				  CGEN_INSN_BITSIZE (insn) / 8,
+				  & ex_info, & full_insn_value);
+	      if (rc != 0)
+		return rc;
+	      length = CGEN_EXTRACT_FN (cd, insn)
+		(cd, insn, &ex_info, full_insn_value, &fields, pc);
+	    }
+	  else
+	    length = CGEN_EXTRACT_FN (cd, insn)
+	      (cd, insn, &ex_info, insn_value, &fields, pc);
+
+	  /* length < 0 -> error */
+	  if (length < 0)
+	    return length;
+	  if (length > 0)
+	    {
+	      CGEN_PRINT_FN (cd, insn) (cd, info, insn, &fields, pc, length);
+	      /* length is in bits, result is in bytes */
+	      return length / 8;
+	    }
+	}
+
+      insn_list = CGEN_DIS_NEXT_INSN (insn_list);
+    }
+
+  return 0;
+}
+
+/* Default value for CGEN_PRINT_INSN.
+   The result is the size of the insn in bytes or zero for an unknown insn
+   or -1 if an error occured fetching bytes.  */
+
+#ifndef CGEN_PRINT_INSN
+#define CGEN_PRINT_INSN default_print_insn
+#endif
+
+static int
+default_print_insn (cd, pc, info)
+     CGEN_CPU_DESC cd;
+     bfd_vma pc;
+     disassemble_info *info;
+{
+  char buf[CGEN_MAX_INSN_SIZE];
+  int status;
+
+  /* Read the base part of the insn.  */
+
+  status = (*info->read_memory_func) (pc, buf, cd->base_insn_bitsize / 8, info);
+  if (status != 0)
+    {
+      (*info->memory_error_func) (status, pc, info);
+      return -1;
+    }
+
+  return print_insn (cd, pc, info, buf, cd->base_insn_bitsize / 8);
+}
+
+/* Main entry point.
+   Print one instruction from PC on INFO->STREAM.
+   Return the size of the instruction (in bytes).  */
+
+int
+print_insn_@arch@ (pc, info)
+     bfd_vma pc;
+     disassemble_info *info;
+{
+  static CGEN_CPU_DESC cd = 0;
+  static int prev_isa;
+  static int prev_mach;
+  static int prev_endian;
+  int length;
+  int isa,mach;
+  int endian = (info->endian == BFD_ENDIAN_BIG
+		? CGEN_ENDIAN_BIG
+		: CGEN_ENDIAN_LITTLE);
+  enum bfd_architecture arch;
+
+  /* ??? gdb will set mach but leave the architecture as "unknown" */
+#ifndef CGEN_BFD_ARCH
+#define CGEN_BFD_ARCH bfd_arch_@arch@
+#endif
+  arch = info->arch;
+  if (arch == bfd_arch_unknown)
+    arch = CGEN_BFD_ARCH;
+      
+  /* There's no standard way to compute the isa number (e.g. for arm thumb)
+     so we leave it to the target.  */
+#ifdef CGEN_COMPUTE_ISA
+  isa = CGEN_COMPUTE_ISA (info);
+#else
+  isa = 0;
+#endif
+
+  mach = info->mach;
+
+  /* If we've switched cpu's, close the current table and open a new one.  */
+  if (cd
+      && (isa != prev_isa
+	  || mach != prev_mach
+	  || endian != prev_endian))
+    {
+      @arch@_cgen_cpu_close (cd);
+      cd = 0;
+    }
+
+  /* If we haven't initialized yet, initialize the opcode table.  */
+  if (! cd)
+    {
+      const bfd_arch_info_type *arch_type = bfd_lookup_arch (arch, mach);
+      const char *mach_name;
+
+      if (!arch_type)
+	abort ();
+      mach_name = arch_type->printable_name;
+
+      prev_isa = isa;
+      prev_mach = mach;
+      prev_endian = endian;
+      cd = @arch@_cgen_cpu_open (CGEN_CPU_OPEN_ISAS, prev_isa,
+				 CGEN_CPU_OPEN_BFDMACH, mach_name,
+				 CGEN_CPU_OPEN_ENDIAN, prev_endian,
+				 CGEN_CPU_OPEN_END);
+      if (!cd)
+	abort ();
+      @arch@_cgen_init_dis (cd);
+    }
+
+  /* We try to have as much common code as possible.
+     But at this point some targets need to take over.  */
+  /* ??? Some targets may need a hook elsewhere.  Try to avoid this,
+     but if not possible try to move this hook elsewhere rather than
+     have two hooks.  */
+  length = CGEN_PRINT_INSN (cd, pc, info);
+  if (length > 0)
+    return length;
+  if (length < 0)
+    return -1;
+
+  (*info->fprintf_func) (info->stream, UNKNOWN_INSN_MSG);
+  return cd->default_insn_bitsize / 8;
+}
diff --git a/opcodes/cgen-ibld.in b/opcodes/cgen-ibld.in
new file mode 100644
index 0000000..5103293
--- /dev/null
+++ b/opcodes/cgen-ibld.in
@@ -0,0 +1,602 @@
+/* Instruction building/extraction support for @arch@. -*- C -*-
+
+THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator.
+- the resultant file is machine generated, cgen-ibld.in isn't
+
+Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of the GNU Binutils and GDB, the GNU debugger.
+
+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.  */
+
+/* ??? Eventually more and more of this stuff can go to cpu-independent files.
+   Keep that in mind.  */
+
+#include "sysdep.h"
+#include <ctype.h>
+#include <stdio.h>
+#include "ansidecl.h"
+#include "dis-asm.h"
+#include "bfd.h"
+#include "symcat.h"
+#include "@prefix@-desc.h"
+#include "@prefix@-opc.h"
+#include "opintl.h"
+
+#undef min
+#define min(a,b) ((a) < (b) ? (a) : (b))
+#undef max
+#define max(a,b) ((a) > (b) ? (a) : (b))
+
+/* Used by the ifield rtx function.  */
+#define FLD(f) (fields->f)
+
+static const char * insert_normal
+     PARAMS ((CGEN_CPU_DESC, long, unsigned int, unsigned int, unsigned int,
+	      unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR));
+static const char * insert_insn_normal
+     PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *,
+	      CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma));
+
+static int extract_normal
+     PARAMS ((CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, CGEN_INSN_INT,
+	      unsigned int, unsigned int, unsigned int, unsigned int,
+	      unsigned int, unsigned int, bfd_vma, long *));
+static int extract_insn_normal
+     PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, CGEN_EXTRACT_INFO *,
+	      CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma));
+static void put_insn_int_value
+     PARAMS ((CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT));
+
+
+/* Operand insertion.  */
+
+#if ! CGEN_INT_INSN_P
+
+/* Subroutine of insert_normal.  */
+
+static CGEN_INLINE void
+insert_1 (cd, value, start, length, word_length, bufp)
+     CGEN_CPU_DESC cd;
+     unsigned long value;
+     int start,length,word_length;
+     unsigned char *bufp;
+{
+  unsigned long x,mask;
+  int shift;
+  int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG;
+
+  switch (word_length)
+    {
+    case 8:
+      x = *bufp;
+      break;
+    case 16:
+      if (big_p)
+	x = bfd_getb16 (bufp);
+      else
+	x = bfd_getl16 (bufp);
+      break;
+    case 24:
+      /* ??? This may need reworking as these cases don't necessarily
+	 want the first byte and the last two bytes handled like this.  */
+      if (big_p)
+	x = (bufp[0] << 16) | bfd_getb16 (bufp + 1);
+      else
+	x = bfd_getl16 (bufp) | (bufp[2] << 16);
+      break;
+    case 32:
+      if (big_p)
+	x = bfd_getb32 (bufp);
+      else
+	x = bfd_getl32 (bufp);
+      break;
+    default :
+      abort ();
+    }
+
+  /* Written this way to avoid undefined behaviour.  */
+  mask = (((1L << (length - 1)) - 1) << 1) | 1;
+  if (CGEN_INSN_LSB0_P)
+    shift = (start + 1) - length;
+  else
+    shift = (word_length - (start + length));
+  x = (x & ~(mask << shift)) | ((value & mask) << shift);
+
+  switch (word_length)
+    {
+    case 8:
+      *bufp = x;
+      break;
+    case 16:
+      if (big_p)
+	bfd_putb16 (x, bufp);
+      else
+	bfd_putl16 (x, bufp);
+      break;
+    case 24:
+      /* ??? This may need reworking as these cases don't necessarily
+	 want the first byte and the last two bytes handled like this.  */
+      if (big_p)
+	{
+	  bufp[0] = x >> 16;
+	  bfd_putb16 (x, bufp + 1);
+	}
+      else
+	{
+	  bfd_putl16 (x, bufp);
+	  bufp[2] = x >> 16;
+	}
+      break;
+    case 32:
+      if (big_p)
+	bfd_putb32 (x, bufp);
+      else
+	bfd_putl32 (x, bufp);
+      break;
+    default :
+      abort ();
+    }
+}
+
+#endif /* ! CGEN_INT_INSN_P */
+
+/* Default insertion routine.
+
+   ATTRS is a mask of the boolean attributes.
+   WORD_OFFSET is the offset in bits from the start of the insn of the value.
+   WORD_LENGTH is the length of the word in bits in which the value resides.
+   START is the starting bit number in the word, architecture origin.
+   LENGTH is the length of VALUE in bits.
+   TOTAL_LENGTH is the total length of the insn in bits.
+
+   The result is an error message or NULL if success.  */
+
+/* ??? This duplicates functionality with bfd's howto table and
+   bfd_install_relocation.  */
+/* ??? This doesn't handle bfd_vma's.  Create another function when
+   necessary.  */
+
+static const char *
+insert_normal (cd, value, attrs, word_offset, start, length, word_length,
+	       total_length, buffer)
+     CGEN_CPU_DESC cd;
+     long value;
+     unsigned int attrs;
+     unsigned int word_offset, start, length, word_length, total_length;
+     CGEN_INSN_BYTES_PTR buffer;
+{
+  static char errbuf[100];
+  /* Written this way to avoid undefined behaviour.  */
+  unsigned long mask = (((1L << (length - 1)) - 1) << 1) | 1;
+
+  /* If LENGTH is zero, this operand doesn't contribute to the value.  */
+  if (length == 0)
+    return NULL;
+
+#if 0
+  if (CGEN_INT_INSN_P
+      && word_offset != 0)
+    abort ();
+#endif
+
+  if (word_length > 32)
+    abort ();
+
+  /* For architectures with insns smaller than the base-insn-bitsize,
+     word_length may be too big.  */
+  if (cd->min_insn_bitsize < cd->base_insn_bitsize)
+    {
+      if (word_offset == 0
+	  && word_length > total_length)
+	word_length = total_length;
+    }
+
+  /* Ensure VALUE will fit.  */
+  if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED))
+    {
+      unsigned long maxval = mask;
+      
+      if ((unsigned long) value > maxval)
+	{
+	  /* xgettext:c-format */
+	  sprintf (errbuf,
+		   _("operand out of range (%lu not between 0 and %lu)"),
+		   value, maxval);
+	  return errbuf;
+	}
+    }
+  else
+    {
+      if (! cgen_signed_overflow_ok_p (cd))
+	{
+	  long minval = - (1L << (length - 1));
+	  long maxval =   (1L << (length - 1)) - 1;
+	  
+	  if (value < minval || value > maxval)
+	    {
+	      sprintf
+		/* xgettext:c-format */
+		(errbuf, _("operand out of range (%ld not between %ld and %ld)"),
+		 value, minval, maxval);
+	      return errbuf;
+	    }
+	}
+    }
+
+#if CGEN_INT_INSN_P
+
+  {
+    int shift;
+
+    if (CGEN_INSN_LSB0_P)
+      shift = (word_offset + start + 1) - length;
+    else
+      shift = total_length - (word_offset + start + length);
+    *buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
+  }
+
+#else /* ! CGEN_INT_INSN_P */
+
+  {
+    unsigned char *bufp = (unsigned char *) buffer + word_offset / 8;
+
+    insert_1 (cd, value, start, length, word_length, bufp);
+  }
+
+#endif /* ! CGEN_INT_INSN_P */
+
+  return NULL;
+}
+
+/* Default insn builder (insert handler).
+   The instruction is recorded in CGEN_INT_INSN_P byte order
+   (meaning that if CGEN_INT_INSN_P BUFFER is an int * and thus the value is
+   recorded in host byte order, otherwise BUFFER is an array of bytes and the
+   value is recorded in target byte order).
+   The result is an error message or NULL if success.  */
+
+static const char *
+insert_insn_normal (cd, insn, fields, buffer, pc)
+     CGEN_CPU_DESC cd;
+     const CGEN_INSN * insn;
+     CGEN_FIELDS * fields;
+     CGEN_INSN_BYTES_PTR buffer;
+     bfd_vma pc;
+{
+  const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
+  unsigned long value;
+  const unsigned char * syn;
+
+  CGEN_INIT_INSERT (cd);
+  value = CGEN_INSN_BASE_VALUE (insn);
+
+  /* If we're recording insns as numbers (rather than a string of bytes),
+     target byte order handling is deferred until later.  */
+
+#if CGEN_INT_INSN_P
+
+  put_insn_int_value (cd, buffer, cd->base_insn_bitsize,
+		      CGEN_FIELDS_BITSIZE (fields), value);
+
+#else
+
+  cgen_put_insn_value (cd, buffer, min (cd->base_insn_bitsize,
+					CGEN_FIELDS_BITSIZE (fields)),
+		       value);
+
+#endif /* ! CGEN_INT_INSN_P */
+
+  /* ??? It would be better to scan the format's fields.
+     Still need to be able to insert a value based on the operand though;
+     e.g. storing a branch displacement that got resolved later.
+     Needs more thought first.  */
+
+  for (syn = CGEN_SYNTAX_STRING (syntax); * syn != '\0'; ++ syn)
+    {
+      const char *errmsg;
+
+      if (CGEN_SYNTAX_CHAR_P (* syn))
+	continue;
+
+      errmsg = (* cd->insert_operand) (cd, CGEN_SYNTAX_FIELD (*syn),
+				       fields, buffer, pc);
+      if (errmsg)
+	return errmsg;
+    }
+
+  return NULL;
+}
+
+/* Cover function to store an insn value into an integral insn.  Must go here
+ because it needs <prefix>-desc.h for CGEN_INT_INSN_P.  */
+
+static void
+put_insn_int_value (cd, buf, length, insn_length, value)
+     CGEN_CPU_DESC cd;
+     CGEN_INSN_BYTES_PTR buf;
+     int length;
+     int insn_length;
+     CGEN_INSN_INT value;
+{
+  /* For architectures with insns smaller than the base-insn-bitsize,
+     length may be too big.  */
+  if (length > insn_length)
+    *buf = value;
+  else
+    {
+      int shift = insn_length - length;
+      /* Written this way to avoid undefined behaviour.  */
+      CGEN_INSN_INT mask = (((1L << (length - 1)) - 1) << 1) | 1;
+      *buf = (*buf & ~(mask << shift)) | ((value & mask) << shift);
+    }
+}
+
+/* Operand extraction.  */
+
+#if ! CGEN_INT_INSN_P
+
+/* Subroutine of extract_normal.
+   Ensure sufficient bytes are cached in EX_INFO.
+   OFFSET is the offset in bytes from the start of the insn of the value.
+   BYTES is the length of the needed value.
+   Returns 1 for success, 0 for failure.  */
+
+static CGEN_INLINE int
+fill_cache (cd, ex_info, offset, bytes, pc)
+     CGEN_CPU_DESC cd;
+     CGEN_EXTRACT_INFO *ex_info;
+     int offset, bytes;
+     bfd_vma pc;
+{
+  /* It's doubtful that the middle part has already been fetched so
+     we don't optimize that case.  kiss.  */
+  int mask;
+  disassemble_info *info = (disassemble_info *) ex_info->dis_info;
+
+  /* First do a quick check.  */
+  mask = (1 << bytes) - 1;
+  if (((ex_info->valid >> offset) & mask) == mask)
+    return 1;
+
+  /* Search for the first byte we need to read.  */
+  for (mask = 1 << offset; bytes > 0; --bytes, ++offset, mask <<= 1)
+    if (! (mask & ex_info->valid))
+      break;
+
+  if (bytes)
+    {
+      int status;
+
+      pc += offset;
+      status = (*info->read_memory_func)
+	(pc, ex_info->insn_bytes + offset, bytes, info);
+
+      if (status != 0)
+	{
+	  (*info->memory_error_func) (status, pc, info);
+	  return 0;
+	}
+
+      ex_info->valid |= ((1 << bytes) - 1) << offset;
+    }
+
+  return 1;
+}
+
+/* Subroutine of extract_normal.  */
+
+static CGEN_INLINE long
+extract_1 (cd, ex_info, start, length, word_length, bufp, pc)
+     CGEN_CPU_DESC cd;
+     CGEN_EXTRACT_INFO *ex_info;
+     int start,length,word_length;
+     unsigned char *bufp;
+     bfd_vma pc;
+{
+  unsigned long x,mask;
+  int shift;
+  int big_p = CGEN_CPU_INSN_ENDIAN (cd) == CGEN_ENDIAN_BIG;
+
+  switch (word_length)
+    {
+    case 8:
+      x = *bufp;
+      break;
+    case 16:
+      if (big_p)
+	x = bfd_getb16 (bufp);
+      else
+	x = bfd_getl16 (bufp);
+      break;
+    case 24:
+      /* ??? This may need reworking as these cases don't necessarily
+	 want the first byte and the last two bytes handled like this.  */
+      if (big_p)
+	x = (bufp[0] << 16) | bfd_getb16 (bufp + 1);
+      else
+	x = bfd_getl16 (bufp) | (bufp[2] << 16);
+      break;
+    case 32:
+      if (big_p)
+	x = bfd_getb32 (bufp);
+      else
+	x = bfd_getl32 (bufp);
+      break;
+    default :
+      abort ();
+    }
+
+  /* Written this way to avoid undefined behaviour.  */
+  mask = (((1L << (length - 1)) - 1) << 1) | 1;
+  if (CGEN_INSN_LSB0_P)
+    shift = (start + 1) - length;
+  else
+    shift = (word_length - (start + length));
+  return (x >> shift) & mask;
+}
+
+#endif /* ! CGEN_INT_INSN_P */
+
+/* Default extraction routine.
+
+   INSN_VALUE is the first base_insn_bitsize bits of the insn in host order,
+   or sometimes less for cases like the m32r where the base insn size is 32
+   but some insns are 16 bits.
+   ATTRS is a mask of the boolean attributes.  We only need `SIGNED',
+   but for generality we take a bitmask of all of them.
+   WORD_OFFSET is the offset in bits from the start of the insn of the value.
+   WORD_LENGTH is the length of the word in bits in which the value resides.
+   START is the starting bit number in the word, architecture origin.
+   LENGTH is the length of VALUE in bits.
+   TOTAL_LENGTH is the total length of the insn in bits.
+
+   Returns 1 for success, 0 for failure.  */
+
+/* ??? The return code isn't properly used.  wip.  */
+
+/* ??? This doesn't handle bfd_vma's.  Create another function when
+   necessary.  */
+
+static int
+extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length,
+		word_length, total_length, pc, valuep)
+     CGEN_CPU_DESC cd;
+#if ! CGEN_INT_INSN_P
+     CGEN_EXTRACT_INFO *ex_info;
+#else
+     CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED;
+#endif
+     CGEN_INSN_INT insn_value;
+     unsigned int attrs;
+     unsigned int word_offset, start, length, word_length, total_length;
+#if ! CGEN_INT_INSN_P
+     bfd_vma pc;
+#else
+     bfd_vma pc ATTRIBUTE_UNUSED;
+#endif
+     long *valuep;
+{
+  CGEN_INSN_INT value;
+
+  /* If LENGTH is zero, this operand doesn't contribute to the value
+     so give it a standard value of zero.  */
+  if (length == 0)
+    {
+      *valuep = 0;
+      return 1;
+    }
+
+#if 0
+  if (CGEN_INT_INSN_P
+      && word_offset != 0)
+    abort ();
+#endif
+
+  if (word_length > 32)
+    abort ();
+
+  /* For architectures with insns smaller than the insn-base-bitsize,
+     word_length may be too big.  */
+  if (cd->min_insn_bitsize < cd->base_insn_bitsize)
+    {
+      if (word_offset == 0
+	  && word_length > total_length)
+	word_length = total_length;
+    }
+
+  /* Does the value reside in INSN_VALUE?  */
+
+  if (CGEN_INT_INSN_P || word_offset == 0)
+    {
+      /* Written this way to avoid undefined behaviour.  */
+      CGEN_INSN_INT mask = (((1L << (length - 1)) - 1) << 1) | 1;
+
+      if (CGEN_INSN_LSB0_P)
+	value = insn_value >> ((word_offset + start + 1) - length);
+      else
+	value = insn_value >> (total_length - ( word_offset + start + length));
+      value &= mask;
+      /* sign extend? */
+      if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)
+	  && (value & (1L << (length - 1))))
+	value |= ~mask;
+    }
+
+#if ! CGEN_INT_INSN_P
+
+  else
+    {
+      unsigned char *bufp = ex_info->insn_bytes + word_offset / 8;
+
+      if (word_length > 32)
+	abort ();
+
+      if (fill_cache (cd, ex_info, word_offset / 8, word_length / 8, pc) == 0)
+	return 0;
+
+      value = extract_1 (cd, ex_info, start, length, word_length, bufp, pc);
+    }
+
+#endif /* ! CGEN_INT_INSN_P */
+
+  *valuep = value;
+
+  return 1;
+}
+
+/* Default insn extractor.
+
+   INSN_VALUE is the first base_insn_bitsize bits, translated to host order.
+   The extracted fields are stored in FIELDS.
+   EX_INFO is used to handle reading variable length insns.
+   Return the length of the insn in bits, or 0 if no match,
+   or -1 if an error occurs fetching data (memory_error_func will have
+   been called).  */
+
+static int
+extract_insn_normal (cd, insn, ex_info, insn_value, fields, pc)
+     CGEN_CPU_DESC cd;
+     const CGEN_INSN *insn;
+     CGEN_EXTRACT_INFO *ex_info;
+     CGEN_INSN_INT insn_value;
+     CGEN_FIELDS *fields;
+     bfd_vma pc;
+{
+  const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
+  const unsigned char *syn;
+
+  CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
+
+  CGEN_INIT_EXTRACT (cd);
+
+  for (syn = CGEN_SYNTAX_STRING (syntax); *syn; ++syn)
+    {
+      int length;
+
+      if (CGEN_SYNTAX_CHAR_P (*syn))
+	continue;
+
+      length = (* cd->extract_operand) (cd, CGEN_SYNTAX_FIELD (*syn),
+					ex_info, insn_value, fields, pc);
+      if (length <= 0)
+	return length;
+    }
+
+  /* We recognized and successfully extracted this insn.  */
+  return CGEN_INSN_BITSIZE (insn);
+}
+
+/* machine generated code added here */
diff --git a/opcodes/cgen-opc.c b/opcodes/cgen-opc.c
index ede3add..14936b3 100644
--- a/opcodes/cgen-opc.c
+++ b/opcodes/cgen-opc.c
@@ -27,6 +27,10 @@
 #include "symcat.h"
 #include "opcode/cgen.h"
 
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
+
 static unsigned int hash_keyword_name
   PARAMS ((const CGEN_KEYWORD *, const char *, int));
 static unsigned int hash_keyword_value
@@ -263,7 +267,7 @@
      CGEN_CPU_DESC cd;
      const char *name;
 {
-  int i;
+  unsigned int i;
   const CGEN_HW_ENTRY **hw = cd->hw_table.entries;
 
   for (i = 0; i < cd->hw_table.num_entries; ++i)
@@ -281,9 +285,9 @@
 const CGEN_HW_ENTRY *
 cgen_hw_lookup_by_num (cd, hwnum)
      CGEN_CPU_DESC cd;
-     int hwnum;
+     unsigned int hwnum;
 {
-  int i;
+  unsigned int i;
   const CGEN_HW_ENTRY **hw = cd->hw_table.entries;
 
   /* ??? This can be speeded up.  */
@@ -305,7 +309,7 @@
      CGEN_CPU_DESC cd;
      const char *name;
 {
-  int i;
+  unsigned int i;
   const CGEN_OPERAND **op = cd->operand_table.entries;
 
   for (i = 0; i < cd->operand_table.num_entries; ++i)
diff --git a/opcodes/cgen.sh b/opcodes/cgen.sh
new file mode 100644
index 0000000..8a4eb6b
--- /dev/null
+++ b/opcodes/cgen.sh
@@ -0,0 +1,134 @@
+#! /bin/sh
+# Generate CGEN opcode files: arch-desc.[ch], arch-opc.[ch],
+# arch-asm.c, arch-dis.c, arch-opinst.c, arch-ibld.[ch].
+#
+# Usage:
+# cgen.sh action srcdir cgen cgendir cgenflags arch prefix options
+#
+# ACTION is currently always "opcodes". It exists to be consistent with the 
+# simulator.
+# OPTIONS is comma separated list of options:
+#	- opinst - arch-opinst.c is being made, causes semantic analysis
+#
+# We store the generated files in the source directory until we decide to
+# ship a Scheme interpreter (or other implementation) with gdb/binutils.
+# Maybe we never will.
+
+# We want to behave like make, any error forces us to stop.
+set -e
+
+action=$1
+srcdir=$2
+cgen=$3
+cgendir=$4
+cgenflags=$5
+arch=$6
+prefix=$7
+options=$8
+
+# List of extra files to build.
+# Values: opinst (only 1 extra file at present)
+extrafiles=$9
+
+rootdir=${srcdir}/..
+
+# $arch is $6, as passed on the command line.
+# $ARCH is the same argument but in all uppercase.
+# Both forms are used in this script.
+
+lowercase='abcdefghijklmnopqrstuvwxyz'
+uppercase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ARCH=`echo ${arch} | tr "${lowercase}" "${uppercase}"`
+
+extrafile_args=""
+for ef in .. $extrafiles
+do
+    case $ef in
+    ..) ;;
+    opinst) extrafile_args="-Q tmp-opinst.c1 $extrafile_args" ;;
+    esac
+done
+
+case $action in
+opcodes)
+	# Remove residual working files.
+	rm -f tmp-desc.h tmp-desc.h1
+	rm -f tmp-desc.c tmp-desc.c1
+	rm -f tmp-opc.h tmp-opc.h1
+	rm -f tmp-opc.c tmp-opc.c1
+	rm -f tmp-opinst.c tmp-opinst.c1
+	rm -f tmp-ibld.h tmp-ibld.h1
+	rm -f tmp-ibld.c tmp-ibld.in1
+	rm -f tmp-asm.c tmp-asm.in1
+	rm -f tmp-dis.c tmp-dis.in1
+
+	# Run CGEN.
+	${cgen} -s ${cgendir}/cgen-opc.scm \
+		-s ${cgendir} \
+		${cgenflags} \
+		-f "${options}" \
+		-m all \
+		-a ${arch} \
+		-H tmp-desc.h1 \
+		-C tmp-desc.c1 \
+		-O tmp-opc.h1 \
+		-P tmp-opc.c1 \
+		-L tmp-ibld.in1 \
+		-A tmp-asm.in1 \
+		-D tmp-dis.in1 \
+		${extrafile_args}
+
+	# Customise generated files for the particular architecture.
+	sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" < tmp-desc.h1 > tmp-desc.h
+	${rootdir}/move-if-change tmp-desc.h ${srcdir}/${prefix}-desc.h
+
+	sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \
+		-e "s/@prefix@/${prefix}/" < tmp-desc.c1 > tmp-desc.c
+	${rootdir}/move-if-change tmp-desc.c ${srcdir}/${prefix}-desc.c
+
+	sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" < tmp-opc.h1 > tmp-opc.h
+	${rootdir}/move-if-change tmp-opc.h ${srcdir}/${prefix}-opc.h
+
+	sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \
+		-e "s/@prefix@/${prefix}/" < tmp-opc.c1 > tmp-opc.c
+	${rootdir}/move-if-change tmp-opc.c ${srcdir}/${prefix}-opc.c
+
+	case $extrafiles in
+	*opinst*)
+	  sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \
+		-e "s/@prefix@/${prefix}/" < tmp-opinst.c1 >tmp-opinst.c
+	  ${rootdir}/move-if-change tmp-opinst.c ${srcdir}/${prefix}-opinst.c
+	  ;;
+	esac
+
+	cat ${srcdir}/cgen-ibld.in tmp-ibld.in1 | \
+	  sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \
+		-e "s/@prefix@/${prefix}/" > tmp-ibld.c
+	${rootdir}/move-if-change tmp-ibld.c ${srcdir}/${prefix}-ibld.c
+
+	sed -e "/ -- assembler routines/ r tmp-asm.in1" ${srcdir}/cgen-asm.in \
+	  | sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \
+		-e "s/@prefix@/${prefix}/" > tmp-asm.c
+	${rootdir}/move-if-change tmp-asm.c ${srcdir}/${prefix}-asm.c
+
+	sed -e "/ -- disassembler routines/ r tmp-dis.in1" ${srcdir}/cgen-dis.in \
+	  | sed -e "s/@ARCH@/${ARCH}/g" -e "s/@arch@/${arch}/g" \
+		-e "s/@prefix@/${prefix}/" > tmp-dis.c
+	${rootdir}/move-if-change tmp-dis.c ${srcdir}/${prefix}-dis.c
+
+	# Remove temporary files.
+	rm -f tmp-desc.h1 tmp-desc.c1
+	rm -f tmp-opc.h1 tmp-opc.c1
+	rm -f tmp-opinst.c1
+	rm -f tmp-ibld.h1 tmp-ibld.in1
+	rm -f tmp-asm.in1 tmp-dis.in1
+	;;
+
+*)
+	echo "$0: bad action: ${action}" >&2
+	exit 1
+	;;
+
+esac
+
+exit 0
diff --git a/opcodes/config.in b/opcodes/config.in
index c60a321..5caef55 100644
--- a/opcodes/config.in
+++ b/opcodes/config.in
@@ -25,9 +25,6 @@
 /* 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
 
diff --git a/opcodes/configure b/opcodes/configure
index 1655fe7..08ca1cd 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -22,6 +22,8 @@
 ac_help="$ac_help
   --disable-libtool-lock  avoid locking (might break parallel builds)"
 ac_help="$ac_help
+  --with-pic              try to use only PIC/non-PIC objects [default=use both]"
+ac_help="$ac_help
   --enable-targets        alternative target configurations"
 ac_help="$ac_help
   --enable-commonbfdlib   build shared BFD/opcodes/libiberty library"
@@ -34,6 +36,8 @@
   --disable-nls           do not use Native Language Support"
 ac_help="$ac_help
   --with-included-gettext use the GNU gettext library included here"
+ac_help="$ac_help
+  --enable-cgen-maint[=dir]    build cgen generated files"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -554,6 +558,68 @@
   ac_n= ac_c='\c' ac_t=
 fi
 
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:563: 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 568 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_cygwin=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:596: 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 601 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:608: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_mingw32=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
 
 
 ac_aux_dir=
@@ -603,7 +669,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:607: checking host system type" >&5
+echo "configure:673: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -624,7 +690,7 @@
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:628: checking target system type" >&5
+echo "configure:694: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
@@ -642,7 +708,7 @@
 echo "$ac_t""$target" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:646: checking build system type" >&5
+echo "configure:712: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -664,249 +730,49 @@
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
-# 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:671: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+
+        echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6
+echo "configure:736: checking for strerror in -lcposix" >&5
+ac_lib_var=`echo cposix'_'strerror | 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
-  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:701: 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:752: 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:784: 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 795 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lcposix  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 744 "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 strerror();
 
-main(){return(0);}
+int main() {
+strerror()
+; return 0; }
 EOF
-if { (eval echo configure:800: \"$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
+if { (eval echo configure:755: \"$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
   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:826: 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:831: 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:840: \"$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:859: 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
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
 
 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
-
-echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:891: 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
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; 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
+  LIBS="$LIBS -lcposix"
 else
   echo "$ac_t""no" 1>&6
-  ISC=
 fi
 
+  
+
 
 # We currently only use the version number for the name of any shared
 # library.  For user convenience, we always use the same version
@@ -925,7 +791,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:929: checking for a BSD compatible install" >&5
+echo "configure:795: 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
@@ -978,7 +844,7 @@
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:982: checking whether build environment is sane" >&5
+echo "configure:848: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -1035,7 +901,7 @@
 test "$program_transform_name" = "" && program_transform_name="s,x,x,"
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1039: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:905: 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
@@ -1081,7 +947,7 @@
 
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1085: checking for working aclocal" >&5
+echo "configure:951: checking for working aclocal" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1094,7 +960,7 @@
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1098: checking for working autoconf" >&5
+echo "configure:964: checking for working autoconf" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1107,7 +973,7 @@
 fi
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1111: checking for working automake" >&5
+echo "configure:977: checking for working automake" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1120,7 +986,7 @@
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1124: checking for working autoheader" >&5
+echo "configure:990: checking for working autoheader" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1133,7 +999,7 @@
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1137: checking for working makeinfo" >&5
+echo "configure:1003: checking for working makeinfo" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1156,7 +1022,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:1160: checking for $ac_word" >&5
+echo "configure:1026: 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
@@ -1188,7 +1054,7 @@
 # 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:1192: checking for $ac_word" >&5
+echo "configure:1058: 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
@@ -1220,7 +1086,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:1224: checking for $ac_word" >&5
+echo "configure:1090: 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
@@ -1323,36 +1189,228 @@
   enable_fast_install=yes
 fi
 
-# Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
+# 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:1330: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+echo "configure:1196: 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 "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+  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_RANLIB="ranlib"
+      ac_cv_prog_CC="gcc"
       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
+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:1226: 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:1277: 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:1309: 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 1320 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1325: \"$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:1351: 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:1356: 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:1365: \"$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:1384: 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
+
 # Check whether --with-gnu-ld or --without-gnu-ld was given.
 if test "${with_gnu_ld+set}" = set; then
   withval="$with_gnu_ld"
@@ -1365,8 +1423,14 @@
 if test "$ac_cv_prog_gcc" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
   echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1369: checking for ld used by GCC" >&5
-  ac_prog=`($CC -print-prog-name=ld) 2>&5`
+echo "configure:1427: checking for ld used by GCC" >&5
+  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]:[\\/]*)
@@ -1389,10 +1453,10 @@
   esac
 elif test "$with_gnu_ld" = yes; then
   echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1393: checking for GNU ld" >&5
+echo "configure:1457: checking for GNU ld" >&5
 else
   echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1396: checking for non-GNU ld" >&5
+echo "configure:1460: checking for non-GNU ld" >&5
 fi
 if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1427,7 +1491,7 @@
 fi
 test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
 echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1431: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1495: checking if the linker ($LD) is GNU ld" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1440,10 +1504,23 @@
 fi
 
 echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6
+with_gnu_ld=$ac_cv_prog_gnu_ld
 
 
+echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
+echo "configure:1512: checking for $LD option to reload object files" >&5
+if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+
+echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1447: checking for BSD-compatible nm" >&5
+echo "configure:1524: checking for BSD-compatible nm" >&5
 if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1454,18 +1531,20 @@
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
     test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
+    tmp_nm=$ac_dir/${ac_tool_prefix}nm
+    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
       # Check to see if the nm accepts a BSD-compat flag.
       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
       #   nm: unknown option "B" ignored
-      if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
-	ac_cv_path_NM="$ac_dir/nm -B"
+      # Tru64's nm complains that /dev/null is an invalid object file
+      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+	ac_cv_path_NM="$tmp_nm -B"
 	break
-      elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
-	ac_cv_path_NM="$ac_dir/nm -p"
+      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+	ac_cv_path_NM="$tmp_nm -p"
 	break
       else
-	ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+	ac_cv_path_NM=${ac_cv_path_NM="$tmp_nm"} # keep the first match, but
 	continue # so that we can try to find one that supports BSD flags
       fi
     fi
@@ -1479,7 +1558,7 @@
 echo "$ac_t""$NM" 1>&6
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1483: checking whether ln -s works" >&5
+echo "configure:1562: 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
@@ -1499,12 +1578,478 @@
   echo "$ac_t""no" 1>&6
 fi
 
+echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
+echo "configure:1583: checking how to recognise dependant libraries" >&5
+if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
 
-case "$target" in
-NONE) lt_target="$host" ;;
-*) lt_target="$target" ;;
+case "$host_os" in
+aix4*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi4*)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+    lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin* | mingw* |pw32*)
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+freebsd* )
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case "$host_cpu" in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+            lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+            lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20*)
+  # TODO:  Does this work for hpux-11 too?
+  lt_cv_deplibs_check_method='file_magic (s0-90-90-9|PA-RISC0-9.0-9) shared library'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libc.sl
+  ;;
+
+irix5* | irix6*)
+  case "$host_os" in
+  irix5*)
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+    ;;
+  *)
+    case "$LD" in
+    *-32|*"-32 ") libmagic=32-bit;;
+    *-n32|*"-n32 ") libmagic=N32;;
+    *-64|*"-64 ") libmagic=64-bit;;
+    *) libmagic=never-match;;
+    esac
+    # this will be overridden with pass_all, but let us keep it just in case
+        lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
+        ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  case "$host_cpu" in
+  alpha* | i*86 | powerpc* | sparc* | ia64* )
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+        lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
+      esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then :
+  else
+        lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+        lt_cv_file_magic_cmd='/usr/bin/file -L'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  # this will be overridden with pass_all, but let us keep it just in case
+  lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  lt_cv_file_magic_test_file=/lib/libc.so
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case "$host_vendor" in
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  motorola)
+        lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+        lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  esac
+  ;;
 esac
 
+fi
+
+echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+
+echo $ac_n "checking for object suffix""... $ac_c" 1>&6
+echo "configure:1726: checking for object suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  rm -f conftest*
+echo 'int i = 1;' > conftest.$ac_ext
+if { (eval echo configure:1732: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  for ac_file in conftest.*; do
+    case $ac_file in
+    *.c) ;;
+    *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
+    esac
+  done
+else
+  { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_objext" 1>&6
+OBJEXT=$ac_cv_objext
+ac_objext=$ac_cv_objext
+
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:1752: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  ac_cv_exeext=.exe
+else
+  rm -f conftest*
+  echo 'int main () { return 0; }' > conftest.$ac_ext
+  ac_cv_exeext=
+  if { (eval echo configure:1762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+    for file in conftest.*; do
+      case $file in
+      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+      esac
+    done
+  else
+    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+  fi
+  rm -f conftest*
+  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+
+# Only perform the check for file, if the check method requires it
+case "$deplibs_check_method" in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
+echo "configure:1789: checking for ${ac_tool_prefix}file" >&5
+if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$MAGIC_CMD" in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="/usr/bin:$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case "$deplibs_check_method" in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$ac_t""$MAGIC_CMD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    echo $ac_n "checking for file""... $ac_c" 1>&6
+echo "configure:1851: checking for file" >&5
+if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$MAGIC_CMD" in
+  /*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+  ?:/*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+  ;;
+  *)
+  ac_save_MAGIC_CMD="$MAGIC_CMD"
+  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="/usr/bin:$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case "$deplibs_check_method" in
+	"file_magic "*)
+	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    egrep "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  MAGIC_CMD="$ac_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  echo "$ac_t""$MAGIC_CMD" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+# 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:1922: 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:1954: 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
+
+# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1989: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # 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_STRIP="${ac_tool_prefix}strip"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+  echo "$ac_t""$STRIP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+if test -z "$ac_cv_prog_STRIP"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2021: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # 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_STRIP="strip"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":"
+fi
+fi
+STRIP="$ac_cv_prog_STRIP"
+if test -n "$STRIP"; then
+  echo "$ac_t""$STRIP" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+  STRIP=":"
+fi
+fi
+
+
 # Check for any special flags to pass to ltconfig.
 libtool_flags="--cache-file=$cache_file"
 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
@@ -1523,13 +2068,24 @@
 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
 
+# Check whether --with-pic or --without-pic was given.
+if test "${with_pic+set}" = set; then
+  withval="$with_pic"
+  pic_mode="$withval"
+else
+  pic_mode=default
+fi
+
+test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
+test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
+
 # Some flags need to be propagated to the compiler or linker for good
 # libtool support.
-case "$lt_target" in
+case "$host" in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 1532 "configure"' > conftest.$ac_ext
-  if { (eval echo configure:1533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  echo '#line 2088 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:2089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case "`/usr/bin/file conftest.o`" in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -1550,19 +2106,27 @@
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:1554: checking whether the C compiler needs -belf" >&5
+echo "configure:2110: checking whether the C compiler needs -belf" >&5
 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1559 "configure"
+  
+     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 2123 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1566: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   lt_cv_cc_needs_belf=yes
 else
@@ -1572,6 +2136,13 @@
   lt_cv_cc_needs_belf=no
 fi
 rm -f 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
+
 fi
 
 echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
@@ -1635,12 +2206,14 @@
 
 
 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
-CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
-LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
-DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
+AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
-$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
 || { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
 
 # Reload cache, that may have been modified by ltconfig
@@ -1654,7 +2227,7 @@
 
 
 # This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
+LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
 
 # Always use our own libtool.
 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
@@ -1664,6 +2237,12 @@
 exec 5>>./config.log
 
 
+  
+
+  
+	 
+	 
+
 # Check whether --enable-targets or --disable-targets was given.
 if test "${enable_targets+set}" = set; then
   enableval="$enable_targets"
@@ -1735,7 +2314,7 @@
 
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:1739: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:2318: 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"
@@ -1757,72 +2336,10 @@
   MAINT=$MAINTAINER_MODE_TRUE
   
 
-echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:1762: 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 1767 "configure"
-#include "confdefs.h"
-
-int main() {
-
-#ifndef __CYGWIN__
-#define __CYGWIN__ __CYGWIN32__
-#endif
-return __CYGWIN__;
-; return 0; }
-EOF
-if { (eval echo configure:1778: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ac_cv_cygwin=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_cygwin=no
-fi
-rm -f conftest*
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_cygwin" 1>&6
-CYGWIN=
-test "$ac_cv_cygwin" = yes && CYGWIN=yes
-echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:1795: 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 1800 "configure"
-#include "confdefs.h"
-
-int main() {
-return __MINGW32__;
-; return 0; }
-EOF
-if { (eval echo configure:1807: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ac_cv_mingw32=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_mingw32=no
-fi
-rm -f conftest*
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_mingw32" 1>&6
-MINGW32=
-test "$ac_cv_mingw32" = yes && MINGW32=yes
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1826: checking for executable suffix" >&5
+echo "configure:2343: checking for executable suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1832,7 +2349,7 @@
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:1836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:2353: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
@@ -1858,7 +2375,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:1862: checking for $ac_word" >&5
+echo "configure:2379: 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
@@ -1888,7 +2405,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:1892: checking for $ac_word" >&5
+echo "configure:2409: 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
@@ -1939,7 +2456,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:1943: checking for $ac_word" >&5
+echo "configure:2460: 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
@@ -1971,7 +2488,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1975: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2492: 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.
@@ -1982,12 +2499,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 1986 "configure"
+#line 2503 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2508: \"$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
@@ -2013,12 +2530,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:2017: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2534: 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:2022: checking whether we are using GNU C" >&5
+echo "configure:2539: 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
@@ -2027,7 +2544,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2031: \"$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:2548: \"$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
@@ -2046,7 +2563,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2050: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2567: 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
@@ -2080,7 +2597,7 @@
 
 ALL_LINGUAS=
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2084: checking how to run the C preprocessor" >&5
+echo "configure:2601: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -2095,13 +2612,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 2099 "configure"
+#line 2616 "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:2105: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2622: \"$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
   :
@@ -2112,13 +2629,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 2116 "configure"
+#line 2633 "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:2122: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2639: \"$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
   :
@@ -2129,13 +2646,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 2133 "configure"
+#line 2650 "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:2139: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2656: \"$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
   :
@@ -2159,13 +2676,43 @@
 fi
 echo "$ac_t""$CPP" 1>&6
 
+# 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:2683: 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
+
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2164: checking for ANSI C header files" >&5
+echo "configure:2711: 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 2169 "configure"
+#line 2716 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2173,7 +2720,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2177: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2724: \"$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*
@@ -2190,7 +2737,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 2194 "configure"
+#line 2741 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2208,7 +2755,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 2212 "configure"
+#line 2759 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -2229,7 +2776,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 2233 "configure"
+#line 2780 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2240,7 +2787,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:2244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2264,12 +2811,12 @@
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2268: checking for working const" >&5
+echo "configure:2815: 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 2273 "configure"
+#line 2820 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2318,7 +2865,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2322: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -2339,21 +2886,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2343: checking for inline" >&5
+echo "configure:2890: 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 2350 "configure"
+#line 2897 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:2357: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2904: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -2379,12 +2926,12 @@
 esac
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2383: checking for off_t" >&5
+echo "configure:2930: 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 2388 "configure"
+#line 2935 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2412,12 +2959,12 @@
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2416: checking for size_t" >&5
+echo "configure:2963: 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 2421 "configure"
+#line 2968 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2447,19 +2994,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:2451: checking for working alloca.h" >&5
+echo "configure:2998: 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 2456 "configure"
+#line 3003 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:2463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3010: \"$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
@@ -2480,12 +3027,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:2484: checking for alloca" >&5
+echo "configure:3031: 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 2489 "configure"
+#line 3036 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -2513,7 +3060,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:2517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3064: \"$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
@@ -2545,12 +3092,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2549: checking whether alloca needs Cray hooks" >&5
+echo "configure:3096: 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 2554 "configure"
+#line 3101 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -2575,12 +3122,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:2579: checking for $ac_func" >&5
+echo "configure:3126: 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 2584 "configure"
+#line 3131 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2603,7 +3150,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2607: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3154: \"$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
@@ -2630,7 +3177,7 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2634: checking stack direction for C alloca" >&5
+echo "configure:3181: 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
@@ -2638,7 +3185,7 @@
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 2642 "configure"
+#line 3189 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -2657,7 +3204,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:2661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3208: \"$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
@@ -2682,17 +3229,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2686: checking for $ac_hdr" >&5
+echo "configure:3233: 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 2691 "configure"
+#line 3238 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2696: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3243: \"$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*
@@ -2721,12 +3268,12 @@
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2725: checking for $ac_func" >&5
+echo "configure:3272: 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 2730 "configure"
+#line 3277 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2749,7 +3296,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3300: \"$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
@@ -2774,7 +3321,7 @@
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:2778: checking for working mmap" >&5
+echo "configure:3325: 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
@@ -2782,7 +3329,7 @@
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 2786 "configure"
+#line 3333 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -2922,7 +3469,7 @@
 }
 
 EOF
-if { (eval echo configure:2926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3473: \"$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
@@ -2950,17 +3497,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2954: checking for $ac_hdr" >&5
+echo "configure:3501: 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 2959 "configure"
+#line 3506 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2964: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3511: \"$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*
@@ -2990,12 +3537,12 @@
 __argz_count __argz_stringify __argz_next
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2994: checking for $ac_func" >&5
+echo "configure:3541: 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 2999 "configure"
+#line 3546 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3018,7 +3565,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3569: \"$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
@@ -3047,12 +3594,12 @@
      for ac_func in stpcpy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3051: checking for $ac_func" >&5
+echo "configure:3598: 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 3056 "configure"
+#line 3603 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3075,7 +3622,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3079: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3626: \"$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
@@ -3109,19 +3656,19 @@
 
    if test $ac_cv_header_locale_h = yes; then
     echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3113: checking for LC_MESSAGES" >&5
+echo "configure:3660: 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 3118 "configure"
+#line 3665 "configure"
 #include "confdefs.h"
 #include <locale.h>
 int main() {
 return LC_MESSAGES
 ; return 0; }
 EOF
-if { (eval echo configure:3125: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   am_cv_val_LC_MESSAGES=yes
 else
@@ -3142,7 +3689,7 @@
     fi
   fi
    echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3146: checking whether NLS is requested" >&5
+echo "configure:3693: 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"
@@ -3162,7 +3709,7 @@
 EOF
 
       echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3166: checking whether included gettext is requested" >&5
+echo "configure:3713: 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"
@@ -3181,17 +3728,17 @@
 
 	ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3185: checking for libintl.h" >&5
+echo "configure:3732: 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 3190 "configure"
+#line 3737 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3195: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3742: \"$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*
@@ -3208,19 +3755,19 @@
 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:3212: checking for gettext in libc" >&5
+echo "configure:3759: 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 3217 "configure"
+#line 3764 "configure"
 #include "confdefs.h"
 #include <libintl.h>
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   gt_cv_func_gettext_libc=yes
 else
@@ -3236,7 +3783,7 @@
 
 	   if test "$gt_cv_func_gettext_libc" != "yes"; then
 	     echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:3240: checking for bindtextdomain in -lintl" >&5
+echo "configure:3787: 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
@@ -3244,7 +3791,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lintl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3248 "configure"
+#line 3795 "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
@@ -3255,7 +3802,7 @@
 bindtextdomain()
 ; return 0; }
 EOF
-if { (eval echo configure:3259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3806: \"$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
@@ -3271,19 +3818,19 @@
 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:3275: checking for gettext in libintl" >&5
+echo "configure:3822: 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 3280 "configure"
+#line 3827 "configure"
 #include "confdefs.h"
 
 int main() {
 return (int) gettext ("")
 ; return 0; }
 EOF
-if { (eval echo configure:3287: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   gt_cv_func_gettext_libintl=yes
 else
@@ -3311,7 +3858,7 @@
 	      # 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:3315: checking for $ac_word" >&5
+echo "configure:3862: 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
@@ -3345,12 +3892,12 @@
 		for ac_func in dcgettext
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3349: checking for $ac_func" >&5
+echo "configure:3896: 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 3354 "configure"
+#line 3901 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3373,7 +3920,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3924: \"$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
@@ -3400,7 +3947,7 @@
 		# 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:3404: checking for $ac_word" >&5
+echo "configure:3951: 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
@@ -3436,7 +3983,7 @@
 		# 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:3440: checking for $ac_word" >&5
+echo "configure:3987: 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
@@ -3468,7 +4015,7 @@
 fi
 
 		cat > conftest.$ac_ext <<EOF
-#line 3472 "configure"
+#line 4019 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3476,7 +4023,7 @@
 			       return _nl_msg_cat_cntr
 ; return 0; }
 EOF
-if { (eval echo configure:3480: \"$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*
   CATOBJEXT=.gmo
 		   DATADIRNAME=share
@@ -3508,7 +4055,7 @@
         # 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:3512: checking for $ac_word" >&5
+echo "configure:4059: 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
@@ -3542,7 +4089,7 @@
         # 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:3546: checking for $ac_word" >&5
+echo "configure:4093: 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
@@ -3578,7 +4125,7 @@
         # 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:3582: checking for $ac_word" >&5
+echo "configure:4129: 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
@@ -3668,7 +4215,7 @@
        LINGUAS=
      else
        echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:3672: checking for catalogs to be installed" >&5
+echo "configure:4219: checking for catalogs to be installed" >&5
        NEW_LINGUAS=
        for lang in ${LINGUAS=$ALL_LINGUAS}; do
          case "$ALL_LINGUAS" in
@@ -3696,17 +4243,17 @@
       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:3700: checking for linux/version.h" >&5
+echo "configure:4247: 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 3705 "configure"
+#line 4252 "configure"
 #include "confdefs.h"
 #include <linux/version.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3710: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4257: \"$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*
@@ -3783,7 +4330,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:3787: checking for a BSD compatible install" >&5
+echo "configure:4334: 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
@@ -3840,17 +4387,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3844: checking for $ac_hdr" >&5
+echo "configure:4391: 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 3849 "configure"
+#line 4396 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3854: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4401: \"$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*
@@ -3877,6 +4424,34 @@
 done
 
 
+cgen_maint=no
+cgendir='$(srcdir)/../cgen'
+
+# Check whether --enable-cgen-maint or --disable-cgen-maint was given.
+if test "${enable_cgen_maint+set}" = set; then
+  enableval="$enable_cgen_maint"
+  case "${enableval}" in
+  yes)	cgen_maint=yes ;;
+  no)	cgen_maint=no ;;
+  *)
+	# argument is cgen install directory (not implemented yet).
+	# Having a `share' directory might be more appropriate for the .scm,
+	# .cpu, etc. files.
+	cgen_maint=yes
+	cgendir=${cgen_maint}/lib/cgen
+	;;
+esac
+fi
+
+
+if test x${cgen_maint} = xyes; then
+  CGEN_MAINT_TRUE=
+  CGEN_MAINT_FALSE='#'
+else
+  CGEN_MAINT_TRUE='#'
+  CGEN_MAINT_FALSE=
+fi
+
 
 using_cgen=no
 
@@ -3945,6 +4520,7 @@
 	bfd_arm_arch)		ta="$ta arm-dis.lo" ;;
 	bfd_avr_arch)		ta="$ta avr-dis.lo" ;;
 	bfd_convex_arch)	;;
+	bfd_cris_arch)		ta="$ta cris-dis.lo cris-opc.lo" ;;
 	bfd_d10v_arch)		ta="$ta d10v-dis.lo d10v-opc.lo" ;;
 	bfd_d30v_arch)		ta="$ta d30v-dis.lo d30v-opc.lo" ;;
 	bfd_fr30_arch)          ta="$ta fr30-asm.lo fr30-desc.lo fr30-dis.lo fr30-ibld.lo fr30-opc.lo" using_cgen=yes ;;
@@ -3953,10 +4529,12 @@
 	bfd_hppa_arch)		ta="$ta hppa-dis.lo" ;;
 	bfd_i370_arch)		ta="$ta i370-dis.lo i370-opc.lo" ;;
 	bfd_i386_arch)		ta="$ta i386-dis.lo" ;;
-	bfd_i860_arch)		;;
+	bfd_i860_arch)		ta="$ta i860-dis.lo" ;;
 	bfd_i960_arch)		ta="$ta i960-dis.lo" ;;
 	bfd_ia64_arch)		ta="$ta ia64-dis.lo ia64-opc.lo" ;;
 	bfd_m32r_arch)		ta="$ta m32r-asm.lo m32r-desc.lo m32r-dis.lo m32r-ibld.lo m32r-opc.lo m32r-opinst.lo" using_cgen=yes ;;
+	bfd_m68hc11_arch)	ta="$ta m68hc11-dis.lo m68hc11-opc.lo" ;;
+	bfd_m68hc12_arch)	ta="$ta m68hc11-dis.lo m68hc11-opc.lo" ;;
 	bfd_m68k_arch)		ta="$ta m68k-dis.lo m68k-opc.lo" ;;
 	bfd_m88k_arch)		ta="$ta m88k-dis.lo" ;;
 	bfd_mcore_arch)		ta="$ta mcore-dis.lo" ;;
@@ -3970,7 +4548,8 @@
 	bfd_romp_arch)		;;
 	bfd_rs6000_arch)	ta="$ta ppc-dis.lo ppc-opc.lo" ;;
 	bfd_powerpc_64_arch)	ta="$ta ppc-dis.lo ppc-opc.lo" ;;
-	bfd_sh_arch)		ta="$ta sh-dis.lo" ;;
+	bfd_sh_arch)
+				ta="$ta sh-dis.lo" ;;
 	bfd_sparc_arch)		ta="$ta sparc-dis.lo sparc-opc.lo" ;;
 	bfd_tahoe_arch)		;;
 	bfd_tic30_arch)		ta="$ta tic30-dis.lo" ;;
@@ -4171,7 +4750,6 @@
 s%@build_cpu@%$build_cpu%g
 s%@build_vendor@%$build_vendor%g
 s%@build_os@%$build_os%g
-s%@CC@%$CC%g
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
 s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
@@ -4185,13 +4763,16 @@
 s%@SET_MAKE@%$SET_MAKE%g
 s%@AR@%$AR%g
 s%@RANLIB@%$RANLIB%g
+s%@CC@%$CC%g
 s%@LN_S@%$LN_S%g
+s%@OBJEXT@%$OBJEXT%g
+s%@EXEEXT@%$EXEEXT%g
+s%@STRIP@%$STRIP%g
 s%@LIBTOOL@%$LIBTOOL%g
 s%@WARN_CFLAGS@%$WARN_CFLAGS%g
 s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
 s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
 s%@MAINT@%$MAINT%g
-s%@EXEEXT@%$EXEEXT%g
 s%@CPP@%$CPP%g
 s%@ALLOCA@%$ALLOCA%g
 s%@USE_NLS@%$USE_NLS%g
@@ -4215,6 +4796,9 @@
 s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g
 s%@l@%$l%g
 s%@HDEFINES@%$HDEFINES%g
+s%@CGEN_MAINT_TRUE@%$CGEN_MAINT_TRUE%g
+s%@CGEN_MAINT_FALSE@%$CGEN_MAINT_FALSE%g
+s%@cgendir@%$cgendir%g
 s%@WIN32LDFLAGS@%$WIN32LDFLAGS%g
 s%@WIN32LIBADD@%$WIN32LIBADD%g
 s%@archdefs@%$archdefs%g
diff --git a/opcodes/configure.in b/opcodes/configure.in
index 6f94bfc..7b18cfa 100644
--- a/opcodes/configure.in
+++ b/opcodes/configure.in
@@ -88,6 +88,24 @@
 
 AC_CHECK_HEADERS(string.h strings.h stdlib.h)
 
+cgen_maint=no
+cgendir='$(srcdir)/../cgen'
+
+AC_ARG_ENABLE(cgen-maint,
+[  --enable-cgen-maint[=dir]    build cgen generated files],
+[case "${enableval}" in
+  yes)	cgen_maint=yes ;;
+  no)	cgen_maint=no ;;
+  *)
+	# argument is cgen install directory (not implemented yet).
+	# Having a `share' directory might be more appropriate for the .scm,
+	# .cpu, etc. files.
+	cgen_maint=yes
+	cgendir=${cgen_maint}/lib/cgen
+	;;
+esac])dnl
+AM_CONDITIONAL(CGEN_MAINT, test x${cgen_maint} = xyes)
+AC_SUBST(cgendir)
 
 using_cgen=no
 
@@ -156,6 +174,7 @@
 	bfd_arm_arch)		ta="$ta arm-dis.lo" ;;
 	bfd_avr_arch)		ta="$ta avr-dis.lo" ;;
 	bfd_convex_arch)	;;
+	bfd_cris_arch)		ta="$ta cris-dis.lo cris-opc.lo" ;;
 	bfd_d10v_arch)		ta="$ta d10v-dis.lo d10v-opc.lo" ;;
 	bfd_d30v_arch)		ta="$ta d30v-dis.lo d30v-opc.lo" ;;
 	bfd_fr30_arch)          ta="$ta fr30-asm.lo fr30-desc.lo fr30-dis.lo fr30-ibld.lo fr30-opc.lo" using_cgen=yes ;;
@@ -164,10 +183,12 @@
 	bfd_hppa_arch)		ta="$ta hppa-dis.lo" ;;
 	bfd_i370_arch)		ta="$ta i370-dis.lo i370-opc.lo" ;;
 	bfd_i386_arch)		ta="$ta i386-dis.lo" ;;
-	bfd_i860_arch)		;;
+	bfd_i860_arch)		ta="$ta i860-dis.lo" ;;
 	bfd_i960_arch)		ta="$ta i960-dis.lo" ;;
 	bfd_ia64_arch)		ta="$ta ia64-dis.lo ia64-opc.lo" ;;
 	bfd_m32r_arch)		ta="$ta m32r-asm.lo m32r-desc.lo m32r-dis.lo m32r-ibld.lo m32r-opc.lo m32r-opinst.lo" using_cgen=yes ;;
+	bfd_m68hc11_arch)	ta="$ta m68hc11-dis.lo m68hc11-opc.lo" ;;
+	bfd_m68hc12_arch)	ta="$ta m68hc11-dis.lo m68hc11-opc.lo" ;;
 	bfd_m68k_arch)		ta="$ta m68k-dis.lo m68k-opc.lo" ;;
 	bfd_m88k_arch)		ta="$ta m88k-dis.lo" ;;
 	bfd_mcore_arch)		ta="$ta mcore-dis.lo" ;;
@@ -181,7 +202,8 @@
 	bfd_romp_arch)		;;
 	bfd_rs6000_arch)	ta="$ta ppc-dis.lo ppc-opc.lo" ;;
 	bfd_powerpc_64_arch)	ta="$ta ppc-dis.lo ppc-opc.lo" ;;
-	bfd_sh_arch)		ta="$ta sh-dis.lo" ;;
+	bfd_sh_arch)
+				ta="$ta sh-dis.lo" ;;
 	bfd_sparc_arch)		ta="$ta sparc-dis.lo sparc-opc.lo" ;;
 	bfd_tahoe_arch)		;;
 	bfd_tic30_arch)		ta="$ta tic30-dis.lo" ;;
diff --git a/opcodes/cris-dis.c b/opcodes/cris-dis.c
new file mode 100644
index 0000000..44a4b56
--- /dev/null
+++ b/opcodes/cris-dis.c
@@ -0,0 +1,1404 @@
+/* Disassembler code for CRIS.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Contributed by Axis Communications AB, Lund, Sweden.
+   Written by Hans-Peter Nilsson.
+
+This file is part of the GNU binutils and GDB, the GNU debugger.
+
+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 "dis-asm.h"
+#include "sysdep.h"
+#include "opcode/cris.h"
+#include "libiberty.h"
+
+/* No instruction will be disassembled longer than this.  In theory, and
+   in silicon, address prefixes can be cascaded.  In practice, cascading
+   is not used by GCC, and not supported by the assembler.  */
+#ifndef MAX_BYTES_PER_CRIS_INSN
+#define MAX_BYTES_PER_CRIS_INSN 8
+#endif
+
+/* Whether or not to decode prefixes, folding it into the following
+   instruction.  FIXME: Make this optional later.  */
+#ifndef PARSE_PREFIX
+#define PARSE_PREFIX 1
+#endif
+
+/* Sometimes we prefix all registers with this character.  */
+#define REGISTER_PREFIX_CHAR '$'
+
+/* Whether or not to trace the following sequence:
+   sub* X,r%d
+   bound* Y,r%d
+   adds.w [pc+r%d.w],pc
+
+   This is the assembly form of a switch-statement in C.
+   The "sub is optional.  If there is none, then X will be zero.
+   X is the value of the first case,
+   Y is the number of cases (including default).
+
+   This results in case offsets printed on the form:
+    case N: -> case_address
+   where N is an estimation on the corresponding 'case' operand in C,
+   and case_address is where execution of that case continues after the
+   sequence presented above.
+
+   The old style of output was to print the offsets as instructions,
+   which made it hard to follow "case"-constructs in the disassembly,
+   and caused a lot of annoying warnings about undefined instructions.
+
+   FIXME: Make this optional later.  */
+#ifndef TRACE_CASE
+#define TRACE_CASE 1
+#endif
+
+/* Value of first element in switch.  */
+static long case_offset = 0;
+
+/* How many more case-offsets to print.  */
+static long case_offset_counter = 0;
+
+/* Number of case offsets.  */
+static long no_of_case_offsets = 0;
+
+/* Candidate for next case_offset.  */
+static long last_immediate = 0;
+
+static int number_of_bits PARAMS ((unsigned int));
+static char *format_hex PARAMS ((unsigned long, char *));
+static char *format_dec PARAMS ((long, char *, int));
+static char *format_reg PARAMS ((int, char *, boolean));
+static int cris_constraint PARAMS ((const char *, unsigned int,
+				    unsigned int));
+static unsigned bytes_to_skip PARAMS ((unsigned int,
+				       const struct cris_opcode *));
+static char *print_flags PARAMS ((unsigned int, char *));
+static void print_with_operands
+  PARAMS ((const struct cris_opcode *, unsigned int, unsigned char *,
+	   bfd_vma, disassemble_info *, const struct cris_opcode *,
+	   unsigned int, unsigned char *, boolean));
+static const struct cris_spec_reg *spec_reg_info PARAMS ((unsigned int));
+static int print_insn_cris_generic
+  PARAMS ((bfd_vma, disassemble_info *, boolean));
+static int print_insn_cris_with_register_prefix
+  PARAMS ((bfd_vma, disassemble_info *));
+static int print_insn_cris_without_register_prefix
+  PARAMS ((bfd_vma, disassemble_info *));
+
+/* Return the descriptor of a special register.
+   FIXME: Depend on a CPU-version specific argument when all machinery
+   is in place.  */
+
+static const struct cris_spec_reg *
+spec_reg_info (sreg)
+     unsigned int sreg;
+{
+  int i;
+  for (i = 0; cris_spec_regs[i].name != NULL; i++)
+    {
+      if (cris_spec_regs[i].number == sreg)
+	return &cris_spec_regs[i];
+    }
+
+  return NULL;
+}
+
+/* Return the number of bits in the argument.  */
+
+static int
+number_of_bits (val)
+     unsigned int val;
+{
+  int bits;
+
+  for (bits = 0; val != 0; val &= val-1)
+    bits++;
+
+  return bits;
+}
+
+/* Get an entry in the opcode-table.  */
+
+static const struct cris_opcode *
+get_opcode_entry (insn, prefix_insn)
+     unsigned int insn;
+     unsigned int prefix_insn;
+{
+  /* For non-prefixed insns, we keep a table of pointers, indexed by the
+     insn code.  Each entry is initialized when found to be NULL.  */
+  static const struct cris_opcode **opc_table = NULL;
+
+  const struct cris_opcode *max_matchedp = NULL;
+  const struct cris_opcode **prefix_opc_table = NULL;
+
+  /* We hold a table for each prefix that need to be handled differently.  */
+  static const struct cris_opcode **dip_prefixes = NULL;
+  static const struct cris_opcode **bdapq_m1_prefixes = NULL;
+  static const struct cris_opcode **bdapq_m2_prefixes = NULL;
+  static const struct cris_opcode **bdapq_m4_prefixes = NULL;
+  static const struct cris_opcode **rest_prefixes = NULL;
+
+  /* Allocate and clear the opcode-table.  */
+  if (opc_table == NULL)
+    {
+      opc_table = xmalloc (65536 * sizeof (opc_table[0]));
+      memset (opc_table, 0, 65536 * sizeof (const struct cris_opcode *));
+
+      dip_prefixes
+	= xmalloc (65536 * sizeof (const struct cris_opcode **));
+      memset (dip_prefixes, 0, 65536 * sizeof (dip_prefixes[0]));
+
+      bdapq_m1_prefixes
+	= xmalloc (65536 * sizeof (const struct cris_opcode **));
+      memset (bdapq_m1_prefixes, 0, 65536 * sizeof (bdapq_m1_prefixes[0]));
+
+      bdapq_m2_prefixes
+	= xmalloc (65536 * sizeof (const struct cris_opcode **));
+      memset (bdapq_m2_prefixes, 0, 65536 * sizeof (bdapq_m2_prefixes[0]));
+
+      bdapq_m4_prefixes
+	= xmalloc (65536 * sizeof (const struct cris_opcode **));
+      memset (bdapq_m4_prefixes, 0, 65536 * sizeof (bdapq_m4_prefixes[0]));
+
+      rest_prefixes
+	= xmalloc (65536 * sizeof (const struct cris_opcode **));
+      memset (rest_prefixes, 0, 65536 * sizeof (rest_prefixes[0]));
+    }
+
+  /* Get the right table if this is a prefix.
+     This code is connected to cris_constraints in that it knows what
+     prefixes play a role in recognition of patterns; the necessary
+     state is reflected by which table is used.  If constraints
+     involving match or non-match of prefix insns are changed, then this
+     probably needs changing too.  */
+  if (prefix_insn != NO_CRIS_PREFIX)
+    {
+      const struct cris_opcode *popcodep
+	= (opc_table[prefix_insn] != NULL
+	   ? opc_table[prefix_insn]
+	   : get_opcode_entry (prefix_insn, NO_CRIS_PREFIX));
+
+      if (popcodep == NULL)
+	return NULL;
+
+      if (popcodep->match == BDAP_QUICK_OPCODE)
+	{
+	  /* Since some offsets are recognized with "push" macros, we
+	     have to have different tables for them.  */
+	  int offset = (prefix_insn & 255);
+
+	  if (offset > 127)
+	    offset -= 256;
+
+	  switch (offset)
+	    {
+	    case -4:
+	      prefix_opc_table = bdapq_m4_prefixes;
+	      break;
+
+	    case -2:
+	      prefix_opc_table = bdapq_m2_prefixes;
+	      break;
+
+	    case -1:
+	      prefix_opc_table = bdapq_m1_prefixes;
+	      break;
+
+	    default:
+	      prefix_opc_table = rest_prefixes;
+	      break;
+	    }
+	}
+      else if (popcodep->match == DIP_OPCODE)
+	/* We don't allow postincrement when the prefix is DIP, so use a
+	   different table for DIP.  */
+	prefix_opc_table = dip_prefixes;
+      else
+	prefix_opc_table = rest_prefixes;
+    }
+
+  if (prefix_insn != NO_CRIS_PREFIX
+      && prefix_opc_table[insn] != NULL)
+    max_matchedp = prefix_opc_table[insn];
+  else if (prefix_insn == NO_CRIS_PREFIX && opc_table[insn] != NULL)
+    max_matchedp = opc_table[insn];
+  else
+    {
+      const struct cris_opcode *opcodep;
+      int max_level_of_match = -1;
+
+      for (opcodep = cris_opcodes;
+	   opcodep->name != NULL;
+	   opcodep++)
+	{
+	  int level_of_match;
+
+	  /* We give a double lead for bits matching the template in
+	     cris_opcodes.  Not even, because then "move p8,r10" would
+	     be given 2 bits lead over "clear.d r10".  When there's a
+	     tie, the first entry in the table wins.  This is
+	     deliberate, to avoid a more complicated recognition
+	     formula.  */
+	  if ((opcodep->match & insn) == opcodep->match
+	      && (opcodep->lose & insn) == 0
+	      && ((level_of_match
+		   = cris_constraint (opcodep->args,
+				      insn,
+				      prefix_insn))
+		  >= 0)
+	      && ((level_of_match
+		   += 2 * number_of_bits (opcodep->match
+					  | opcodep->lose))
+			  > max_level_of_match))
+		    {
+		      max_matchedp = opcodep;
+		      max_level_of_match = level_of_match;
+
+		      /* If there was a full match, never mind looking
+			 further.  */
+		      if (level_of_match >= 2 * 16)
+			break;
+		    }
+		}
+      /* Fill in the new entry.
+
+	 If there are changes to the opcode-table involving prefixes, and
+	 disassembly then does not work correctly, try removing the
+	 else-clause below that fills in the prefix-table.  If that
+	 helps, you need to change the prefix_opc_table setting above, or
+	 something related.  */
+      if (prefix_insn == NO_CRIS_PREFIX)
+	opc_table[insn] = max_matchedp;
+      else
+	prefix_opc_table[insn] = max_matchedp;
+    }
+
+  return max_matchedp;
+}
+
+/* Format number as hex with a leading "0x" into outbuffer.  */
+
+static char *
+format_hex (number, outbuffer)
+     unsigned long number;
+     char *outbuffer;
+{
+  /* Obfuscate to avoid warning on 32-bit host, but properly truncate
+     negative numbers on >32-bit hosts.  */
+  if (sizeof (number) > 4)
+    number &= (1 << (sizeof (number) > 4 ? 32 : 1)) - 1;
+
+  sprintf (outbuffer, "0x%lx", number);
+
+  /* Save this value for the "case" support.  */
+  if (TRACE_CASE)
+    last_immediate = number;
+
+  return outbuffer + strlen (outbuffer);
+}
+
+/* Format number as decimal into outbuffer.  Parameter signedp says
+   whether the number should be formatted as signed (!= 0) or
+   unsigned (== 0).  */
+
+static char *
+format_dec (number, outbuffer, signedp)
+     long number;
+     char *outbuffer;
+     int signedp;
+{
+  last_immediate = number;
+  sprintf (outbuffer, signedp ? "%ld" : "%lu", number);
+
+  return outbuffer + strlen (outbuffer);
+}
+
+/* Format the name of the general register regno into outbuffer.  */
+
+static char *
+format_reg (regno, outbuffer_start, with_reg_prefix)
+     int regno;
+     char *outbuffer_start;
+     boolean with_reg_prefix;
+{
+  char *outbuffer = outbuffer_start;
+
+  if (with_reg_prefix)
+    *outbuffer++ = REGISTER_PREFIX_CHAR;
+
+  switch (regno)
+    {
+    case 15:
+      strcpy (outbuffer, "pc");
+      break;
+
+    case 14:
+      strcpy (outbuffer, "sp");
+      break;
+
+    default:
+      sprintf (outbuffer, "r%d", regno);
+      break;
+    }
+
+  return outbuffer_start + strlen (outbuffer_start);
+}
+
+/* Return -1 if the constraints of a bitwise-matched instruction say
+   that there is no match.  Otherwise return a nonnegative number
+   indicating the confidence in the match (higher is better).  */
+
+static int
+cris_constraint (cs, insn, prefix_insn)
+     const char *cs;
+     unsigned int insn;
+     unsigned int prefix_insn;
+{
+  int retval = 0;
+  int tmp;
+  int prefix_ok = 0;
+
+  const char *s;
+  for (s  = cs; *s; s++)
+    switch (*s)
+      {
+      case '!':
+	/* Do not recognize "pop" if there's a prefix.  */
+	if (prefix_insn != NO_CRIS_PREFIX)
+	  return -1;
+	break;
+
+      case 'M':
+	/* Size modifier for "clear", i.e. special register 0, 4 or 8.
+	   Check that it is one of them.  Only special register 12 could
+	   be mismatched, but checking for matches is more logical than
+	   checking for mismatches when there are only a few cases.  */
+	tmp = ((insn >> 12) & 0xf);
+	if (tmp != 0 && tmp != 4 && tmp != 8)
+	  return -1;
+	break;
+
+      case 'm':
+	if ((insn & 0x30) == 0x30)
+	  return -1;
+	break;
+
+      case 'S':
+	/* A prefix operand without side-effect.  */
+	if (prefix_insn != NO_CRIS_PREFIX && (insn & 0x400) == 0)
+	  {
+	    prefix_ok = 1;
+	    break;
+	  }
+	else
+	  return -1;
+
+      case 's':
+      case 'y':
+	/* If this is a prefixed insn with postincrement (side-effect),
+	   the prefix must not be DIP.  */
+	if (prefix_insn != NO_CRIS_PREFIX)
+	  {
+	    if (insn & 0x400)
+	      {
+		const struct cris_opcode *prefix_opcodep
+		  = get_opcode_entry (prefix_insn, NO_CRIS_PREFIX);
+
+		if (prefix_opcodep->match == DIP_OPCODE)
+		  return -1;
+	      }
+
+	    prefix_ok = 1;
+	  }
+	break;
+
+      case 'B':
+	/* If we don't fall through, then the prefix is ok.  */
+	prefix_ok = 1;
+
+	/* A "push" prefix.  Check for valid "push" size.
+	   In case of special register, it may be != 4.  */
+	if (prefix_insn != NO_CRIS_PREFIX)
+	  {
+	    /* Match the prefix insn to BDAPQ.  */
+	    const struct cris_opcode *prefix_opcodep
+	      = get_opcode_entry (prefix_insn, NO_CRIS_PREFIX);
+
+	    if (prefix_opcodep->match == BDAP_QUICK_OPCODE)
+	      {
+		int pushsize = (prefix_insn & 255);
+
+		if (pushsize > 127)
+		  pushsize -= 256;
+
+		if (s[1] == 'P')
+		  {
+		    unsigned int spec_reg = (insn >> 12) & 15;
+		    const struct cris_spec_reg *sregp
+		      = spec_reg_info (spec_reg);
+
+		    /* For a special-register, the "prefix size" must
+		       match the size of the register.  */
+		    if (sregp && sregp->reg_size == (unsigned int) -pushsize)
+		      break;
+		  }
+		else if (s[1] == 'R')
+		  {
+		    if ((insn & 0x30) == 0x20 && pushsize == -4)
+		      break;
+		  }
+		/* FIXME:  Should abort here; next constraint letter
+		   *must* be 'P' or 'R'.  */
+	      }
+	  }
+	return -1;
+
+      case 'D':
+	retval = (((insn >> 12) & 15) == (insn & 15));
+	if (!retval)
+	  return -1;
+	else
+	  retval += 4;
+	break;
+
+      case 'P':
+	{
+	  const struct cris_spec_reg *sregp
+	    = spec_reg_info ((insn >> 12) & 15);
+
+	  /* Since we match four bits, we will give a value of 4-1 = 3
+	     in a match.  If there is a corresponding exact match of a
+	     special register in another pattern, it will get a value of
+	     4, which will be higher.  This should be correct in that an
+	     exact pattern would match better than a general pattern.
+
+	     Note that there is a reason for not returning zero; the
+	     pattern for "clear" is partly  matched in the bit-pattern
+	     (the two lower bits must be zero), while the bit-pattern
+	     for a move from a special register is matched in the
+	     register constraint.  */
+
+	  if (sregp != NULL)
+	    {
+	      retval += 3;
+	      break;
+	    }
+	  else
+	    return -1;
+	}
+      }
+
+  if (prefix_insn != NO_CRIS_PREFIX && ! prefix_ok)
+    return -1;
+
+  return retval;
+}
+
+/* Return the length of an instruction.  */
+
+static unsigned
+bytes_to_skip (insn, matchedp)
+     unsigned int insn;
+     const struct cris_opcode *matchedp;
+{
+  /* Each insn is a word plus "immediate" operands.  */
+  unsigned to_skip = 2;
+  const char *template = matchedp->args;
+  const char *s;
+
+  for (s = template; *s; s++)
+    if (*s == 's' && (insn & 0x400) && (insn & 15) == 15)
+      {
+	/* Immediate via [pc+], so we have to check the size of the
+	   operand.  */
+	int mode_size = 1 << ((insn >> 4) & (*template == 'z' ? 1 : 3));
+
+	if (matchedp->imm_oprnd_size == SIZE_FIX_32)
+	  to_skip += 4;
+	else if (matchedp->imm_oprnd_size == SIZE_SPEC_REG)
+	  {
+	    const struct cris_spec_reg *sregp
+	      = spec_reg_info ((insn >> 12) & 15);
+
+	    /* FIXME: Improve error handling; should have been caught
+	       earlier.  */
+	    if (sregp == NULL)
+	      return 2;
+
+	    /* PC is incremented by two, not one, for a byte.  */
+	    to_skip += (sregp->reg_size + 1) & ~1;
+	  }
+	else
+	  to_skip += (mode_size + 1) & ~1;
+      }
+    else if (*s == 'b')
+      to_skip += 2;
+
+  return to_skip;
+}
+
+/* Print condition code flags.  */
+
+static char *
+print_flags (insn, cp)
+     unsigned int insn;
+     char *cp;
+{
+  /* Use the v8 (Etrax 100) flag definitions for disassembly.
+     The differences with v0 (Etrax 1..4) vs. Svinto are:
+     v0 'd' <=> v8 'm'
+     v0 'e' <=> v8 'b'.  */
+  static const char fnames[] = "cvznxibm";
+
+  unsigned char flagbits = (((insn >> 8) & 0xf0) | (insn & 15));
+  int i;
+
+  for (i = 0; i < 8; i++)
+    if (flagbits & (1 << i))
+      *cp++ = fnames[i];
+
+  return cp;
+}
+
+/* Print out an insn with its operands, and update the info->insn_type
+   fields.  The prefix_opcodep and the rest hold a prefix insn that is
+   supposed to be output as an address mode.  */
+
+static void
+print_with_operands (opcodep, insn, buffer, addr, info, prefix_opcodep,
+		     prefix_insn, prefix_buffer, with_reg_prefix)
+     const struct cris_opcode *opcodep;
+     unsigned int insn;
+     unsigned char *buffer;
+     bfd_vma addr;
+     disassemble_info *info;
+
+     /* If a prefix insn was before this insn (and is supposed to be
+	output as an address), here is a description of it.  */
+     const struct cris_opcode *prefix_opcodep;
+     unsigned int prefix_insn;
+     unsigned char *prefix_buffer;
+     boolean with_reg_prefix;
+{
+  /* Get a buffer of somewhat reasonable size where we store
+     intermediate parts of the insn.  */
+  char temp[sizeof (".d [$r13=$r12-2147483648],$r10") * 2];
+  char *tp = temp;
+  static const char mode_char[] = "bwd?";
+  const char *s;
+  const char *cs;
+
+  /* Print out the name first thing we do.  */
+  (*info->fprintf_func) (info->stream, "%s", opcodep->name);
+
+  cs = opcodep->args;
+  s = cs;
+
+  /* Ignore any prefix indicator.  */
+  if (*s == 'p')
+    s++;
+
+  if (*s == 'm' || *s == 'M' || *s == 'z')
+    {
+      *tp++ = '.';
+
+      /* Get the size-letter.  */
+      *tp++ = *s == 'M'
+	? (insn & 0x8000 ? 'd'
+	   : insn & 0x4000 ? 'w' : 'b')
+	: mode_char[(insn >> 4) & (*s == 'z' ? 1 : 3)];
+
+      /* Ignore the size and the space character that follows.  */
+      s += 2;
+    }
+
+  /* Add a space if this isn't a long-branch, because for those will add
+     the condition part of the name later.  */
+  if (opcodep->match != (BRANCH_PC_LOW + BRANCH_INCR_HIGH * 256))
+    *tp++ = ' ';
+
+  /* Fill in the insn-type if deducible from the name (and there's no
+     better way).  */
+  if (opcodep->name[0] == 'j')
+    {
+      if (strncmp (opcodep->name, "jsr", 3) == 0)
+	/* It's "jsr" or "jsrc".  */
+	info->insn_type = dis_jsr;
+      else
+	/* Any other jump-type insn is considered a branch.  */
+	info->insn_type = dis_branch;
+    }
+
+  /* We might know some more fields right now.  */
+  info->branch_delay_insns = opcodep->delayed;
+
+  /* Handle operands.  */
+  for (; *s; s++)
+    {
+    switch (*s)
+      {
+      case ',':
+	*tp++ = *s;
+	break;
+
+      case '!':
+	/* Ignore at this point; used at earlier stages to avoid recognition
+	   if there's a prefixes at something that in other ways looks like
+	   a "pop".  */
+	break;
+
+      case 'B':
+	/* This was the prefix that made this a "push".  We've already
+	   handled it by recognizing it, so signal that the prefix is
+	   handled by setting it to NULL.  */
+	prefix_opcodep = NULL;
+	break;
+
+      case 'D':
+      case 'r':
+	tp = format_reg (insn & 15, tp, with_reg_prefix);
+	break;
+
+      case 'R':
+	tp = format_reg ((insn >> 12) & 15, tp, with_reg_prefix);
+	break;
+
+      case 'y':
+      case 'S':
+      case 's':
+	/* Any "normal" memory operand.  */
+	if ((insn & 0x400) && (insn & 15) == 15)
+	  {
+	    /* We're looking at [pc+], i.e. we need to output an immediate
+	       number, where the size can depend on different things.  */
+	    long number;
+	    int signedp
+	      = ((*cs == 'z' && (insn & 0x20))
+		 || opcodep->match == BDAP_QUICK_OPCODE);
+	    int nbytes;
+
+	    if (opcodep->imm_oprnd_size == SIZE_FIX_32)
+	      nbytes = 4;
+	    else if (opcodep->imm_oprnd_size == SIZE_SPEC_REG)
+	      {
+		const struct cris_spec_reg *sregp
+		  = spec_reg_info ((insn >> 12) & 15);
+
+		/* A NULL return should have been as a non-match earlier,
+		   so catch it as an internal error in the error-case
+		   below.  */
+		if (sregp == NULL)
+		  /* Whatever non-valid size.  */
+		  nbytes = 42;
+		else
+		  /* PC is always incremented by a multiple of two.  */
+		  nbytes = (sregp->reg_size + 1) & ~1;
+	      }
+	    else
+	      {
+		int mode_size = 1 << ((insn >> 4) & (*cs == 'z' ? 1 : 3));
+
+		if (mode_size == 1)
+		  nbytes = 2;
+		else
+		  nbytes = mode_size;
+	      }
+
+	    switch (nbytes)
+	      {
+	      case 1:
+		number = buffer[2];
+		if (signedp && number > 127)
+		  number -= 256;
+		break;
+
+	      case 2:
+		number = buffer[2] + buffer[3] * 256;
+		if (signedp && number > 32767)
+		  number -= 65536;
+		break;
+
+	      case 4:
+		number
+		  = buffer[2] + buffer[3] * 256 + buffer[4] * 65536
+		  + buffer[5] * 0x1000000;
+		break;
+
+	      default:
+		strcpy (tp, "bug");
+		tp += 3;
+		number = 42;
+	      }
+
+	    if ((*cs == 'z' && (insn & 0x20))
+		|| (opcodep->match == BDAP_QUICK_OPCODE
+		    && (nbytes <= 2 || buffer[1 + nbytes] == 0)))
+	      tp = format_dec (number, tp, signedp);
+	    else
+	      {
+		unsigned int highbyte = (number >> 24) & 0xff;
+
+		/* Either output this as an address or as a number.  If it's
+		   a dword with the same high-byte as the address of the
+		   insn, assume it's an address, and also if it's a non-zero
+		   non-0xff high-byte.  If this is a jsr or a jump, then
+		   it's definitely an address.  */
+		if (nbytes == 4
+		    && (highbyte == ((addr >> 24) & 0xff)
+			|| (highbyte != 0 && highbyte != 0xff)
+			|| info->insn_type == dis_branch
+			|| info->insn_type == dis_jsr))
+		  {
+		    /* Finish off and output previous formatted bytes.  */
+		    *tp = 0;
+		    tp = temp;
+		    if (temp[0])
+		      (*info->fprintf_func) (info->stream, "%s", temp);
+
+		    (*info->print_address_func) ((bfd_vma) number, info);
+
+		    info->target = number;
+		  }
+		else
+		  tp = format_hex (number, tp);
+	      }
+	  }
+	else
+	  {
+	    /* Not an immediate number.  Then this is a (possibly
+	       prefixed) memory operand.  */
+	    if (info->insn_type != dis_nonbranch)
+	      {
+		int mode_size
+		  = 1 << ((insn >> 4)
+			  & (opcodep->args[0] == 'z' ? 1 : 3));
+		int size;
+		info->insn_type = dis_dref;
+		info->flags |= CRIS_DIS_FLAG_MEMREF;
+
+		if (opcodep->imm_oprnd_size == SIZE_FIX_32)
+		  size = 4;
+		else if (opcodep->imm_oprnd_size == SIZE_SPEC_REG)
+		  {
+		    const struct cris_spec_reg *sregp
+		      = spec_reg_info ((insn >> 12) & 15);
+
+		    /* FIXME: Improve error handling; should have been caught
+		       earlier.  */
+		    if (sregp == NULL)
+		      size = 4;
+		    else
+		      size = sregp->reg_size;
+		  }
+		else
+		  size = mode_size;
+
+		info->data_size = size;
+	      }
+
+	    *tp++ = '[';
+
+	    if (prefix_opcodep
+		/* We don't match dip with a postincremented field
+		   as a side-effect address mode.  */
+		&& ((insn & 0x400) == 0
+		    || prefix_opcodep->match != DIP_OPCODE))
+	      {
+		if (insn & 0x400)
+		  {
+		    tp = format_reg (insn & 15, tp, with_reg_prefix);
+		    *tp++ = '=';
+		  }
+
+
+		/* We mainly ignore the prefix format string when the
+		   address-mode syntax is output.  */
+		switch (prefix_opcodep->match)
+		  {
+		  case DIP_OPCODE:
+		    /* It's [r], [r+] or [pc+].  */
+		    if ((prefix_insn & 0x400) && (prefix_insn & 15) == 15)
+		      {
+			/* It's [pc+].  This cannot possibly be anything
+			   but an address.  */
+			unsigned long number
+			  = prefix_buffer[2] + prefix_buffer[3] * 256
+			  + prefix_buffer[4] * 65536
+			  + prefix_buffer[5] * 0x1000000;
+
+			info->target = (bfd_vma) number;
+
+			/* Finish off and output previous formatted
+			   data.  */
+			*tp = 0;
+			tp = temp;
+			if (temp[0])
+			  (*info->fprintf_func) (info->stream, "%s", temp);
+
+			(*info->print_address_func) ((bfd_vma) number, info);
+		      }
+		    else
+		      {
+			/* For a memref in an address, we use target2.
+			   In this case, target is zero.  */
+			info->flags
+			  |= (CRIS_DIS_FLAG_MEM_TARGET2_IS_REG
+			      | CRIS_DIS_FLAG_MEM_TARGET2_MEM);
+
+			info->target2 = prefix_insn & 15;
+
+			*tp++ = '[';
+			tp = format_reg (prefix_insn & 15, tp,
+					 with_reg_prefix);
+			if (prefix_insn & 0x400)
+			  *tp++ = '+';
+			*tp++ = ']';
+		      }
+		    break;
+
+		  case BDAP_QUICK_OPCODE:
+		    {
+		      int number;
+
+		      number = prefix_buffer[0];
+		      if (number > 127)
+			number -= 256;
+
+		      /* Output "reg+num" or, if num < 0, "reg-num".  */
+		      tp = format_reg ((prefix_insn >> 12) & 15, tp,
+				       with_reg_prefix);
+		      if (number >= 0)
+			*tp++ = '+';
+		      tp = format_dec (number, tp, 1);
+
+		      info->flags |= CRIS_DIS_FLAG_MEM_TARGET_IS_REG;
+		      info->target = (prefix_insn >> 12) & 15;
+		      info->target2 = (bfd_vma) number;
+		      break;
+		    }
+
+		  case BIAP_OPCODE:
+		    /* Output "r+R.m".  */
+		    tp = format_reg (prefix_insn & 15, tp, with_reg_prefix);
+		    *tp++ = '+';
+		    tp = format_reg ((prefix_insn >> 12) & 15, tp,
+				     with_reg_prefix);
+		    *tp++ = '.';
+		    *tp++ = mode_char[(prefix_insn >> 4) & 3];
+
+		    info->flags
+		      |= (CRIS_DIS_FLAG_MEM_TARGET2_IS_REG
+			  | CRIS_DIS_FLAG_MEM_TARGET_IS_REG
+
+			  | ((prefix_insn & 0x8000)
+			     ? CRIS_DIS_FLAG_MEM_TARGET2_MULT4
+			     : ((prefix_insn & 0x8000)
+				? CRIS_DIS_FLAG_MEM_TARGET2_MULT2 : 0)));
+
+		    /* Is it the casejump?  It's a "adds.w [pc+r%d.w],pc".  */
+		    if (insn == 0xf83f && (prefix_insn & ~0xf000) == 0x55f)
+		      /* Then start interpreting data as offsets.  */
+		      case_offset_counter = no_of_case_offsets;
+		    break;
+
+		  case BDAP_INDIR_OPCODE:
+		    /* Output "r+s.m", or, if "s" is [pc+], "r+s" or
+		       "r-s".  */
+		    tp = format_reg ((prefix_insn >> 12) & 15, tp,
+				     with_reg_prefix);
+
+		    if ((prefix_insn & 0x400) && (prefix_insn & 15) == 15)
+		      {
+			long number;
+			unsigned int nbytes;
+
+			/* It's a value.  Get its size.  */
+			int mode_size = 1 << ((prefix_insn >> 4) & 3);
+
+			if (mode_size == 1)
+			  nbytes = 2;
+			else
+			  nbytes = mode_size;
+
+			switch (nbytes)
+			  {
+			  case 1:
+			    number = prefix_buffer[2];
+			    if (number > 127)
+			      number -= 256;
+			    break;
+
+			  case 2:
+			    number = prefix_buffer[2] + prefix_buffer[3] * 256;
+			    if (number > 32767)
+			      number -= 65536;
+			    break;
+
+			  case 4:
+			    number
+			      = prefix_buffer[2] + prefix_buffer[3] * 256
+			      + prefix_buffer[4] * 65536
+			      + prefix_buffer[5] * 0x1000000;
+			    break;
+
+			  default:
+			    strcpy (tp, "bug");
+			    tp += 3;
+			    number = 42;
+			  }
+
+			info->flags |= CRIS_DIS_FLAG_MEM_TARGET_IS_REG;
+			info->target2 = (bfd_vma) number;
+
+			/* If the size is dword, then assume it's an
+			   address.  */
+			if (nbytes == 4)
+			  {
+			    /* Finish off and output previous formatted
+			       bytes.  */
+			    *tp++ = '+';
+			    *tp = 0;
+			    tp = temp;
+			    (*info->fprintf_func) (info->stream, "%s", temp);
+
+			    (*info->print_address_func) ((bfd_vma) number, info);
+			  }
+			else
+			  {
+			    if (number >= 0)
+			      *tp++ = '+';
+			    tp = format_dec (number, tp, 1);
+			  }
+		      }
+		    else
+		      {
+			/* Output "r+[R].m" or "r+[R+].m".  */
+			*tp++ = '+';
+			*tp++ = '[';
+			tp = format_reg (prefix_insn & 15, tp,
+					 with_reg_prefix);
+			if (prefix_insn & 0x400)
+			  *tp++ = '+';
+			*tp++ = ']';
+			*tp++ = '.';
+			*tp++ = mode_char[(prefix_insn >> 4) & 3];
+
+			info->flags
+			  |= (CRIS_DIS_FLAG_MEM_TARGET2_IS_REG
+			      | CRIS_DIS_FLAG_MEM_TARGET2_MEM
+			      | CRIS_DIS_FLAG_MEM_TARGET_IS_REG
+
+			      | (((prefix_insn >> 4) == 2)
+				 ? 0
+				 : (((prefix_insn >> 4) & 3) == 1
+				    ? CRIS_DIS_FLAG_MEM_TARGET2_MEM_WORD
+				    : CRIS_DIS_FLAG_MEM_TARGET2_MEM_BYTE)));
+		      }
+		    break;
+
+		  default:
+		    (*info->fprintf_func) (info->stream, "?prefix-bug");
+		  }
+
+		/* To mark that the prefix is used, reset it.  */
+		prefix_opcodep = NULL;
+	      }
+	    else
+	      {
+		tp = format_reg (insn & 15, tp, with_reg_prefix);
+
+		info->flags |= CRIS_DIS_FLAG_MEM_TARGET_IS_REG;
+		info->target = insn & 15;
+
+		if (insn & 0x400)
+		  *tp++ = '+';
+	      }
+	    *tp++ = ']';
+	  }
+	break;
+
+      case 'x':
+	tp = format_reg ((insn >> 12) & 15, tp, with_reg_prefix);
+	*tp++ = '.';
+	*tp++ = mode_char[(insn >> 4) & 3];
+	break;
+
+      case 'I':
+	tp = format_dec (insn & 63, tp, 0);
+	break;
+
+      case 'b':
+	{
+	  int where = buffer[2] + buffer[3] * 256;
+
+	  if (where > 32767)
+	    where -= 65536;
+
+	  where += addr + 4;
+
+	  if (insn == BA_PC_INCR_OPCODE)
+	    info->insn_type = dis_branch;
+	  else
+	    info->insn_type = dis_condbranch;
+
+	  info->target = (bfd_vma) where;
+
+	  *tp = 0;
+	  tp = temp;
+	  (*info->fprintf_func) (info->stream, "%s%s ",
+				 temp, cris_cc_strings[insn >> 12]);
+
+	  (*info->print_address_func) ((bfd_vma) where, info);
+	}
+      break;
+
+    case 'c':
+      tp = format_dec (insn & 31, tp, 0);
+      break;
+
+    case 'C':
+      tp = format_dec (insn & 15, tp, 0);
+      break;
+
+    case 'o':
+      {
+	long offset = insn & 0xfe;
+
+	if (insn & 1)
+	  offset |= ~0xff;
+
+	if (opcodep->match == BA_QUICK_OPCODE)
+	  info->insn_type = dis_branch;
+	else
+	  info->insn_type = dis_condbranch;
+
+	info->target = (bfd_vma) (addr + 2 + offset);
+	*tp = 0;
+	tp = temp;
+	(*info->fprintf_func) (info->stream, "%s", temp);
+
+	(*info->print_address_func) ((bfd_vma) (addr + 2 + offset), info);
+      }
+      break;
+
+    case 'O':
+      {
+	long number = buffer[0];
+
+	if (number > 127)
+	  number = number - 256;
+
+	tp = format_dec (number, tp, 1);
+	*tp++ = ',';
+	tp = format_reg ((insn >> 12) & 15, tp, with_reg_prefix);
+      }
+      break;
+
+    case 'f':
+      tp = print_flags (insn, tp);
+      break;
+
+    case 'i':
+      tp = format_dec ((insn & 32) ? (insn & 31) | ~31 : insn & 31, tp, 1);
+      break;
+
+    case 'P':
+      {
+	const struct cris_spec_reg *sregp
+	  = spec_reg_info ((insn >> 12) & 15);
+
+	if (sregp->name == NULL)
+	  /* Should have been caught as a non-match eariler.  */
+	  *tp++ = '?';
+	else
+	  {
+	    if (with_reg_prefix)
+	      *tp++ = REGISTER_PREFIX_CHAR;
+	    strcpy (tp, sregp->name);
+	    tp += strlen (tp);
+	  }
+      }
+      break;
+
+    default:
+      strcpy (tp, "???");
+      tp += 3;
+    }
+  }
+
+  *tp = 0;
+
+  if (prefix_opcodep)
+    (*info->fprintf_func) (info->stream, " (OOPS unused prefix \"%s: %s\")",
+			   prefix_opcodep->name, prefix_opcodep->args);
+
+  (*info->fprintf_func) (info->stream, "%s", temp);
+
+  /* Get info for matching case-tables, if we don't have any active.
+     We assume that the last constant seen is used; either in the insn
+     itself or in a "move.d const,rN, sub.d rN,rM"-like sequence.  */
+  if (TRACE_CASE && case_offset_counter == 0)
+    {
+      if (strncmp (opcodep->name, "sub", 3) == 0)
+	case_offset = last_immediate;
+
+      /* It could also be an "add", if there are negative case-values.  */
+      else if (strncmp (opcodep->name, "add", 3) == 0)
+	{
+	  /* The first case is the negated operand to the add.  */
+	  case_offset = -last_immediate;
+	}
+      /* A bound insn will tell us the number of cases.  */
+      else if (strncmp (opcodep->name, "bound", 5) == 0)
+	{
+	  no_of_case_offsets = last_immediate + 1;
+	}
+      /* A jump or jsr or branch breaks the chain of insns for a
+	 case-table, so assume default first-case again.  */
+      else if (info->insn_type == dis_jsr
+	       || info->insn_type == dis_branch
+	       || info->insn_type == dis_condbranch)
+	case_offset = 0;
+    }
+}
+
+
+/* Print the CRIS instruction at address memaddr on stream.  Returns
+   length of the instruction, in bytes.  Prefix register names with `$' if
+   WITH_REG_PREFIX.  */
+
+static int
+print_insn_cris_generic (memaddr, info, with_reg_prefix)
+     bfd_vma memaddr;
+     disassemble_info *info;
+     boolean with_reg_prefix;
+{
+  int nbytes;
+  unsigned int insn;
+  const struct cris_opcode *matchedp;
+  int advance = 0;
+
+  /* No instruction will be disassembled as longer than this number of
+     bytes; stacked prefixes will not be expanded.  */
+  unsigned char buffer[MAX_BYTES_PER_CRIS_INSN];
+  unsigned char *bufp;
+  int status;
+  bfd_vma addr;
+
+  /* There will be an "out of range" error after the last instruction.
+     Reading pairs of bytes in decreasing number, we hope that we will get
+     at least the amount that we will consume.
+
+     If we can't get any data, or we do not get enough data, we print
+     the error message.  */
+
+  for (nbytes = MAX_BYTES_PER_CRIS_INSN; nbytes > 0; nbytes -= 2)
+    {
+      status = (*info->read_memory_func) (memaddr, buffer, nbytes, info);
+      if (status == 0)
+	break;
+    }
+
+  /* If we did not get all we asked for, then clear the rest.
+     Hopefully this makes a reproducible result in case of errors.  */
+  if (nbytes != MAX_BYTES_PER_CRIS_INSN)
+    memset (buffer + nbytes, 0, MAX_BYTES_PER_CRIS_INSN - nbytes);
+
+  addr = memaddr;
+  bufp = buffer;
+
+  /* Set some defaults for the insn info.  */
+  info->insn_info_valid = 1;
+  info->branch_delay_insns = 0;
+  info->data_size = 0;
+  info->insn_type = dis_nonbranch;
+  info->flags = 0;
+  info->target = 0;
+  info->target2 = 0;
+
+  /* If we got any data, disassemble it.  */
+  if (nbytes != 0)
+    {
+      matchedp = NULL;
+
+      insn = bufp[0] + bufp[1] * 256;
+
+      /* If we're in a case-table, don't disassemble the offsets.  */
+      if (TRACE_CASE && case_offset_counter != 0)
+	{
+	  info->insn_type = dis_noninsn;
+	  advance += 2;
+
+	  /* If to print data as offsets, then shortcut here.  */
+	  (*info->fprintf_func) (info->stream, "case %d%s: -> ",
+				 case_offset + no_of_case_offsets
+				 - case_offset_counter,
+				 case_offset_counter == 1 ? "/default" :
+				 "");
+
+	  (*info->print_address_func) ((bfd_vma)
+				       ((short) (insn)
+					+ (long) (addr
+						  - (no_of_case_offsets
+						     - case_offset_counter)
+						  * 2)), info);
+	  case_offset_counter--;
+
+	  /* The default case start (without a "sub" or "add") must be
+	     zero.  */
+	  if (case_offset_counter == 0)
+	    case_offset = 0;
+	}
+      else if (insn == 0)
+	{
+	  /* We're often called to disassemble zeroes.  While this is a
+	     valid "bcc .+2" insn, it is also useless enough and enough
+	     of a nuiscance that we will just output "bcc .+2" for it
+	     and signal it as a noninsn.  */
+	  (*info->fprintf_func) (info->stream, "bcc .+2");
+	  info->insn_type = dis_noninsn;
+	  advance += 2;
+	}
+      else
+	{
+	  const struct cris_opcode *prefix_opcodep = NULL;
+	  unsigned char *prefix_buffer = bufp;
+	  unsigned int prefix_insn = insn;
+	  int prefix_size = 0;
+
+	  matchedp = get_opcode_entry (insn, NO_CRIS_PREFIX);
+
+	  /* Check if we're supposed to write out prefixes as address
+	     modes and if this was a prefix.  */
+	  if (matchedp != NULL && PARSE_PREFIX && matchedp->args[0] == 'p')
+	    {
+	      /* If it's a prefix, put it into the prefix vars and get the
+		 main insn.  */
+	      prefix_size = bytes_to_skip (prefix_insn, matchedp);
+	      prefix_opcodep = matchedp;
+
+	      insn = bufp[prefix_size] + bufp[prefix_size + 1] * 256;
+	      matchedp = get_opcode_entry (insn, prefix_insn);
+
+	      if (matchedp != NULL)
+		{
+		  addr += prefix_size;
+		  bufp += prefix_size;
+		  advance += prefix_size;
+		}
+	      else
+		{
+		  /* The "main" insn wasn't valid, at least not when
+		     prefixed.  Put back things enough to output the
+		     prefix insn only, as a normal insn.  */
+		  matchedp = prefix_opcodep;
+		  insn = prefix_insn;
+		  prefix_opcodep = NULL;
+		}
+	    }
+
+	  if (matchedp == NULL)
+	    {
+	      (*info->fprintf_func) (info->stream, "??0x%lx", insn);
+	      advance += 2;
+
+	      info->insn_type = dis_noninsn;
+	    }
+	  else
+	    {
+	      advance += bytes_to_skip (insn, matchedp);
+
+	      /* The info_type and assorted fields will be set according
+		 to the operands.   */
+	      print_with_operands (matchedp, insn, bufp, addr, info,
+				   prefix_opcodep, prefix_insn,
+				   prefix_buffer, with_reg_prefix);
+	    }
+	}
+    }
+  else
+    info->insn_type = dis_noninsn;
+
+  /* If we read less than MAX_BYTES_PER_CRIS_INSN, i.e. we got an error
+     status when reading that much, and the insn decoding indicated a
+     length exceeding what we read, there is an error.  */
+  if (status != 0 && (nbytes == 0 || advance > nbytes))
+    {
+      (*info->memory_error_func) (status, memaddr, info);
+      return -1;
+    }
+
+  /* Max supported insn size with one folded prefix insn.  */
+  info->bytes_per_line = MAX_BYTES_PER_CRIS_INSN;
+
+  /* I would like to set this to a fixed value larger than the actual
+     number of bytes to print in order to avoid spaces between bytes,
+     but objdump.c (2.9.1) does not like that, so we print 16-bit
+     chunks, which is the next choice.  */
+  info->bytes_per_chunk = 2;
+
+  /* Printing bytes in order of increasing addresses makes sense,
+     especially on a little-endian target.
+     This is completely the opposite of what you think; setting this to
+     BFD_ENDIAN_LITTLE will print bytes in order N..0 rather than the 0..N
+     we want.  */
+  info->display_endian = BFD_ENDIAN_BIG;
+
+  return advance;
+}
+
+/* Disassemble, prefixing register names with `$'.  */
+
+static int
+print_insn_cris_with_register_prefix (vma, info)
+     bfd_vma vma;
+     disassemble_info *info;
+{
+  return print_insn_cris_generic (vma, info, true);
+}
+
+/* Disassemble, no prefixes on register names.  */
+
+static int
+print_insn_cris_without_register_prefix (vma, info)
+     bfd_vma vma;
+     disassemble_info *info;
+{
+  return print_insn_cris_generic (vma, info, false);
+}
+
+/* Return a disassembler-function that prints registers with a `$' prefix,
+   or one that prints registers without a prefix.  */
+
+disassembler_ftype
+cris_get_disassembler (abfd)
+     bfd *abfd;
+{
+  /* If there's no bfd in sight, we return what is valid as input in all
+     contexts if fed back to the assembler: disassembly *with* register
+     prefix.  */
+  if (abfd == NULL || bfd_get_symbol_leading_char (abfd) == 0)
+    return print_insn_cris_with_register_prefix;
+
+  return print_insn_cris_without_register_prefix;
+}
+
+/*
+ * Local variables:
+ * eval: (c-set-style "gnu")
+ * indent-tabs-mode: t
+ * End:
+ */
diff --git a/opcodes/cris-opc.c b/opcodes/cris-opc.c
new file mode 100644
index 0000000..4690051
--- /dev/null
+++ b/opcodes/cris-opc.c
@@ -0,0 +1,885 @@
+/* cris-opc.c -- Table of opcodes for the CRIS processor.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Contributed by Axis Communications AB, Lund, Sweden.
+   Originally written for GAS 1.38.1 by Mikael Asker.
+   Reorganized by Hans-Peter Nilsson.
+
+This file is part of GAS, GDB and the GNU binutils.
+
+GAS, GDB, and GNU binutils 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.
+
+GAS, GDB, and GNU binutils are distributed in the hope that they 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 "opcode/cris.h"
+
+#ifndef NULL
+#define NULL (0)
+#endif
+
+const struct cris_spec_reg
+cris_spec_regs[] =
+{
+  {"p0",  0,  1, 0,		   NULL},
+  {"vr",  1,  1, 0,		   NULL},
+  {"p1",  1,  1, 0,		   NULL},
+  {"p2",  2,  1, cris_ver_warning, NULL},
+  {"p3",  3,  1, cris_ver_warning, NULL},
+  {"p4",  4,  2, 0,		   NULL},
+  {"ccr", 5,  2, 0,		   NULL},
+  {"p5",  5,  2, 0,		   NULL},
+  {"dcr0",6,  2, cris_ver_v0_3,	   NULL},
+  {"p6",  6,  2, cris_ver_v0_3,	   NULL},
+  {"dcr1/mof", 7, 4, cris_ver_v10p,
+   "Register `dcr1/mof' with ambiguous size specified.  Guessing 4 bytes"},
+  {"dcr1/mof", 7, 2, cris_ver_v0_3,
+   "Register `dcr1/mof' with ambiguous size specified.  Guessing 2 bytes"},
+  {"mof", 7,  4, cris_ver_v10p,	   NULL},
+  {"dcr1",7,  2, cris_ver_v0_3,	   NULL},
+  {"p7",  7,  4, cris_ver_v10p,	   NULL},
+  {"p7",  7,  2, cris_ver_v0_3,	   NULL},
+  {"p8",  8,  4, 0,		   NULL},
+  {"ibr", 9,  4, 0,		   NULL},
+  {"p9",  9,  4, 0,		   NULL},
+  {"irp", 10, 4, 0,		   NULL},
+  {"p10", 10, 4, 0,		   NULL},
+  {"srp", 11, 4, 0,		   NULL},
+  {"p11", 11, 4, 0,		   NULL},
+  /* For disassembly use only.  Accept at assembly with a warning.  */
+  {"bar/dtp0", 12, 4, cris_ver_warning,
+   "Ambiguous register `bar/dtp0' specified"},
+  {"bar", 12, 4, cris_ver_v8p,	   NULL},
+  {"dtp0",12, 4, cris_ver_v0_3,	   NULL},
+  {"p12", 12, 4, 0,		   NULL},
+  /* For disassembly use only.  Accept at assembly with a warning.  */
+  {"dccr/dtp1",13, 4, cris_ver_warning,
+   "Ambiguous register `dccr/dtp1' specified"},
+  {"dccr",13, 4, cris_ver_v8p,	   NULL},
+  {"dtp1",13, 4, cris_ver_v0_3,	   NULL},
+  {"p13", 13, 4, 0,		   NULL},
+  {"brp", 14, 4, cris_ver_v3p,	   NULL},
+  {"p14", 14, 4, cris_ver_v3p,	   NULL},
+  {"usp", 15, 4, cris_ver_v10p,	   NULL},
+  {"p15", 15, 4, cris_ver_v10p,	   NULL},
+  {NULL, 0, 0, NULL}
+};
+
+/* All CRIS opcodes are 16 bits.
+
+   - The match component is a mask saying which bits must match a
+     particular opcode in order for an instruction to be an instance
+     of that opcode.
+
+   - The args component is a string containing characters symbolically
+     matching the operands of an instruction.  Used for both assembly
+     and disassembly.
+
+     Operand-matching characters:
+     B	Not really an operand.  It causes a "BDAP -size,SP" prefix to be
+	output for the PUSH alias-instructions and recognizes a
+	push-prefix at disassembly.  Must be followed by a R or P letter.
+     !	Non-match pattern, will not match if there's a prefix insn.
+     b	Non-matching operand, used for branches with 16-bit
+	displacement. Only recognized by the disassembler.
+     c	5-bit unsigned immediate in bits <4:0>.
+     C	4-bit unsigned immediate in bits <3:0>.
+     D	General register in bits <15:12> and <3:0>.
+     f	List of flags in bits <15:12> and <3:0>.
+     i	6-bit signed immediate in bits <5:0>.
+     I	6-bit unsigned immediate in bits <5:0>.
+     M	Size modifier (B, W or D) for CLEAR instructions.
+     m	Size modifier (B, W or D) in bits <5:4>
+     o	[-128..127] word offset in bits <7:1> and <0>.  Used by 8-bit
+	branch instructions.
+     O	[-128..127] offset in bits <7:0>.  Also matches a comma and a
+	general register after the expression.  Used only for the BDAP
+	prefix insn.
+     P	Special register in bits <15:12>.
+     p	Indicates that the insn is a prefix insn.  Must be first
+	character.
+     R	General register in bits <15:12>.
+     r	General register in bits <3:0>.
+     S	Source operand in bit <10> and a prefix; a 3-operand prefix
+	without side-effect.
+     s	Source operand in bits <10> and <3:0>, optionally with a
+	side-effect prefix.
+     x	Register-dot-modifier, for example "r5.w" in bits <15:12> and <5:4>.
+     y	Like 's' but do not allow an integer at assembly.
+     z	Size modifier (B or W) in bit <4>.  */
+
+
+/* Please note the order of the opcodes in this table is significant.
+   The assembler requires that all instances of the same mnemonic must
+   be consecutive.  If they aren't, the assembler might not recognize
+   them, or may indicate and internal error.
+
+   The disassembler should not normally care about the order of the
+   opcodes, but will prefer an earlier alternative if the "match-score"
+   (see cris-dis.c) is computed as equal.
+
+   It should not be significant for proper execution that this table is
+   in alphabetical order, but please follow that convention for an easy
+   overview.  */
+
+const struct cris_opcode
+cris_opcodes[] =
+{
+  {"abs",     0x06B0, 0x0940,		  "r,R",     0, SIZE_NONE,     0,
+   cris_abs_op},
+
+  {"add",     0x0600, 0x09c0,		  "m r,R",   0, SIZE_NONE,     0,
+   cris_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"add",     0x0A00, 0x01c0,		  "m s,R",   0, SIZE_FIELD,    0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"add",     0x0A00, 0x01c0,		  "m S,D",   0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"add",     0x0a00, 0x05c0,		  "m S,R,r", 0, SIZE_NONE,     0,
+   cris_three_operand_add_sub_cmp_and_or_op},
+
+  {"addi",    0x0500, 0x0Ac0,		  "x,r",     0, SIZE_NONE,     0,
+   cris_addi_op},
+
+  {"addq",    0x0200, 0x0Dc0,		  "I,R",     0, SIZE_NONE,     0,
+   cris_quick_mode_add_sub_op},
+
+  {"adds",    0x0420, 0x0Bc0,		  "z r,R",   0, SIZE_NONE,     0,
+   cris_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"adds",    0x0820, 0x03c0,		  "z s,R",   0, SIZE_FIELD,    0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"adds",    0x0820, 0x03c0,		  "z S,D",   0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"adds",    0x0820, 0x07c0,		  "z S,R,r", 0, SIZE_NONE,     0,
+   cris_three_operand_add_sub_cmp_and_or_op},
+
+  {"addu",    0x0400, 0x0be0,		  "z r,R",   0, SIZE_NONE,     0,
+   cris_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"addu",    0x0800, 0x03e0,		  "z s,R",   0, SIZE_FIELD,    0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"addu",    0x0800, 0x03e0,		  "z S,D",   0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"addu",    0x0800, 0x07e0,		  "z S,R,r", 0, SIZE_NONE,     0,
+   cris_three_operand_add_sub_cmp_and_or_op},
+
+  {"and",     0x0700, 0x08C0,		  "m r,R",   0, SIZE_NONE,     0,
+   cris_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"and",     0x0B00, 0x00C0,		  "m s,R",   0, SIZE_FIELD,    0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"and",     0x0B00, 0x00C0,		  "m S,D",   0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"and",     0x0B00, 0x04C0,		  "m S,R,r", 0, SIZE_NONE,     0,
+   cris_three_operand_add_sub_cmp_and_or_op},
+
+  {"andq",    0x0300, 0x0CC0,		  "i,R",     0, SIZE_NONE,     0,
+   cris_quick_mode_and_cmp_move_or_op},
+
+  {"asr",     0x0780, 0x0840,		  "m r,R",   0, SIZE_NONE,     0,
+   cris_asr_op},
+
+  {"asrq",    0x03a0, 0x0c40,		  "c,R",     0, SIZE_NONE,     0,
+   cris_asrq_op},
+
+  {"ax",      0x15B0, 0xEA4F,		  "",	     0, SIZE_NONE,     0,
+   cris_ax_ei_setf_op},
+
+  /* FIXME: Should use branch #defines.  */
+  {"b",	      0x0dff, 0x0200,		  "b",	     1, SIZE_NONE,     0,
+   cris_sixteen_bit_offset_branch_op},
+
+  {"ba",
+   BA_QUICK_OPCODE,
+   0x0F00+(0xF-CC_A)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"bcc",
+   BRANCH_QUICK_OPCODE+CC_CC*0x1000,
+   0x0f00+(0xF-CC_CC)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"bcs",
+   BRANCH_QUICK_OPCODE+CC_CS*0x1000,
+   0x0f00+(0xF-CC_CS)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"bdap",
+   BDAP_INDIR_OPCODE, BDAP_INDIR_Z_BITS,  "pm s,R",  0, SIZE_FIELD,    0,
+   cris_bdap_prefix},
+
+  {"bdap",
+   BDAP_QUICK_OPCODE, BDAP_QUICK_Z_BITS,  "pO",	     0, SIZE_NONE,     0,
+   cris_quick_mode_bdap_prefix},
+
+  {"beq",
+   BRANCH_QUICK_OPCODE+CC_EQ*0x1000,
+   0x0f00+(0xF-CC_EQ)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  /* This is deliberately put before "bext" to trump it, even though not
+     in alphabetical order.  */
+  {"bwf",
+   BRANCH_QUICK_OPCODE+CC_EXT*0x1000,
+   0x0f00+(0xF-CC_EXT)*0x1000,		  "o",	     1, SIZE_NONE,
+   cris_ver_v10p,
+   cris_eight_bit_offset_branch_op},
+
+  {"bext",
+   BRANCH_QUICK_OPCODE+CC_EXT*0x1000,
+   0x0f00+(0xF-CC_EXT)*0x1000,		  "o",	     1, SIZE_NONE,
+   cris_ver_v0_3,
+   cris_eight_bit_offset_branch_op},
+
+  {"bge",
+   BRANCH_QUICK_OPCODE+CC_GE*0x1000,
+   0x0f00+(0xF-CC_GE)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"bgt",
+   BRANCH_QUICK_OPCODE+CC_GT*0x1000,
+   0x0f00+(0xF-CC_GT)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"bhi",
+   BRANCH_QUICK_OPCODE+CC_HI*0x1000,
+   0x0f00+(0xF-CC_HI)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"bhs",
+   BRANCH_QUICK_OPCODE+CC_HS*0x1000,
+   0x0f00+(0xF-CC_HS)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"biap", BIAP_OPCODE, BIAP_Z_BITS,	  "pm r,R",  0, SIZE_NONE,     0,
+   cris_biap_prefix},
+
+  {"ble",
+   BRANCH_QUICK_OPCODE+CC_LE*0x1000,
+   0x0f00+(0xF-CC_LE)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"blo",
+   BRANCH_QUICK_OPCODE+CC_LO*0x1000,
+   0x0f00+(0xF-CC_LO)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"bls",
+   BRANCH_QUICK_OPCODE+CC_LS*0x1000,
+   0x0f00+(0xF-CC_LS)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"blt",
+   BRANCH_QUICK_OPCODE+CC_LT*0x1000,
+   0x0f00+(0xF-CC_LT)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"bmi",
+   BRANCH_QUICK_OPCODE+CC_MI*0x1000,
+   0x0f00+(0xF-CC_MI)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"bmod",    0x0ab0, 0x0140,		  "s,R",     0, SIZE_FIX_32,
+   cris_ver_sim,
+   cris_not_implemented_op},
+
+  {"bmod",    0x0ab0, 0x0140,		  "S,D",     0, SIZE_NONE,
+   cris_ver_sim,
+   cris_not_implemented_op},
+
+  {"bmod",    0x0ab0, 0x0540,		  "S,R,r",   0, SIZE_NONE,
+   cris_ver_sim,
+   cris_not_implemented_op},
+
+  {"bne",
+   BRANCH_QUICK_OPCODE+CC_NE*0x1000,
+   0x0f00+(0xF-CC_NE)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"bound",   0x05c0, 0x0A00,		  "m r,R",   0, SIZE_NONE,     0,
+   cris_two_operand_bound_op},
+  {"bound",   0x09c0, 0x0200,		  "m s,R",   0, SIZE_FIELD,    0,
+   cris_two_operand_bound_op},
+  {"bound",   0x09c0, 0x0200,		  "m S,D",   0, SIZE_NONE,     0,
+   cris_two_operand_bound_op},
+  {"bound",   0x09c0, 0x0600,		  "m S,R,r", 0, SIZE_NONE,     0,
+   cris_three_operand_bound_op},
+  {"bpl",
+   BRANCH_QUICK_OPCODE+CC_PL*0x1000,
+   0x0f00+(0xF-CC_PL)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"break",   0xe930, 0x16c0,		  "C",	     0, SIZE_NONE,
+   cris_ver_v3p,
+   cris_break_op},
+
+  {"bstore",  0x0af0, 0x0100,		  "s,R",     0, SIZE_FIX_32,
+   cris_ver_warning,
+   cris_not_implemented_op},
+
+  {"bstore",  0x0af0, 0x0100,		  "S,D",     0, SIZE_NONE,
+   cris_ver_warning,
+   cris_not_implemented_op},
+
+  {"bstore",  0x0af0, 0x0500,		  "S,R,r",   0, SIZE_NONE,
+   cris_ver_warning,
+   cris_not_implemented_op},
+
+  {"btst",    0x04F0, 0x0B00,		  "r,R",     0, SIZE_NONE,     0,
+   cris_btst_nop_op},
+  {"btstq",   0x0380, 0x0C60,		  "c,R",     0, SIZE_NONE,     0,
+   cris_btst_nop_op},
+  {"bvc",
+   BRANCH_QUICK_OPCODE+CC_VC*0x1000,
+   0x0f00+(0xF-CC_VC)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"bvs",
+   BRANCH_QUICK_OPCODE+CC_VS*0x1000,
+   0x0f00+(0xF-CC_VS)*0x1000,		  "o",	     1, SIZE_NONE,     0,
+   cris_eight_bit_offset_branch_op},
+
+  {"clear",   0x0670, 0x3980,		  "M r",     0, SIZE_NONE,     0,
+   cris_reg_mode_clear_op},
+
+  {"clear",   0x0A70, 0x3180,		  "M y",     0, SIZE_NONE,     0,
+   cris_none_reg_mode_clear_test_op},
+
+  {"clear",   0x0A70, 0x3180,		  "M S",     0, SIZE_NONE,     0,
+   cris_none_reg_mode_clear_test_op},
+
+  {"clearf",  0x05F0, 0x0A00,		  "f",	     0, SIZE_NONE,     0,
+   cris_clearf_di_op},
+
+  {"cmp",     0x06C0, 0x0900,		  "m r,R",   0, SIZE_NONE,     0,
+   cris_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"cmp",     0x0Ac0, 0x0100,		  "m s,R",   0, SIZE_FIELD,    0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"cmp",     0x0Ac0, 0x0100,		  "m S,D",   0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"cmpq",    0x02C0, 0x0D00,		  "i,R",     0, SIZE_NONE,     0,
+   cris_quick_mode_and_cmp_move_or_op},
+
+  {"cmps",    0x08e0, 0x0300,		  "z s,R",   0, SIZE_FIELD,    0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"cmps",    0x08e0, 0x0300,		  "z S,D",   0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"cmpu",    0x08c0, 0x0320,		  "z s,R" ,  0, SIZE_FIELD,    0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"cmpu",    0x08c0, 0x0320,		  "z S,D",   0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"di",      0x25F0, 0xDA0F,		  "",	     0, SIZE_NONE,     0,
+   cris_clearf_di_op},
+
+  {"dip",     DIP_OPCODE, DIP_Z_BITS,	  "ps",	     0, SIZE_FIX_32,   0,
+   cris_dip_prefix},
+
+  {"div",     0x0980, 0x0640,		  "m R,r",   0, SIZE_FIELD,    0,
+   cris_not_implemented_op},
+
+  {"dstep",   0x06f0, 0x0900,		  "r,R",     0, SIZE_NONE,     0,
+   cris_dstep_logshift_mstep_neg_not_op},
+
+  {"ei",      0x25B0, 0xDA4F,		  "",	     0, SIZE_NONE,     0,
+   cris_ax_ei_setf_op},
+
+  {"jbrc",    0x69b0, 0x9640,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_reg_mode_jump_op},
+
+  {"jbrc",    0x6930, 0x92c0,		  "s",	     0, SIZE_FIX_32,
+   cris_ver_v8p,
+   cris_none_reg_mode_jump_op},
+
+  {"jbrc",    0x6930, 0x92c0,		  "S",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_none_reg_mode_jump_op},
+
+  {"jir",     0xA9b0, 0x5640,		  "r",	     0, SIZE_NONE,     0,
+   cris_reg_mode_jump_op},
+
+  {"jir",     0xA930, 0x52c0,		  "s",	     0, SIZE_FIX_32,   0,
+   cris_none_reg_mode_jump_op},
+
+  {"jir",     0xA930, 0x52c0,		  "S",	     0, SIZE_NONE,     0,
+   cris_none_reg_mode_jump_op},
+
+  {"jirc",    0x29b0, 0xd640,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_reg_mode_jump_op},
+
+  {"jirc",    0x2930, 0xd2c0,		  "s",	     0, SIZE_FIX_32,
+   cris_ver_v8p,
+   cris_none_reg_mode_jump_op},
+
+  {"jirc",    0x2930, 0xd2c0,		  "S",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_none_reg_mode_jump_op},
+
+  {"jsr",     0xB9b0, 0x4640,		  "r",	     0, SIZE_NONE,     0,
+   cris_reg_mode_jump_op},
+
+  {"jsr",     0xB930, 0x42c0,		  "s",	     0, SIZE_FIX_32,   0,
+   cris_none_reg_mode_jump_op},
+
+  {"jsr",     0xB930, 0x42c0,		  "S",	     0, SIZE_NONE,     0,
+   cris_none_reg_mode_jump_op},
+
+  {"jsrc",    0x39b0, 0xc640,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_reg_mode_jump_op},
+
+  {"jsrc",    0x3930, 0xc2c0,		  "s",	     0, SIZE_FIX_32,
+   cris_ver_v8p,
+   cris_none_reg_mode_jump_op},
+
+  {"jsrc",    0x3930, 0xc2c0,		  "S",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_none_reg_mode_jump_op},
+
+  {"jump",    0x09b0, 0xF640,		  "r",	     0, SIZE_NONE,     0,
+   cris_reg_mode_jump_op},
+
+  {"jump",
+   JUMP_INDIR_OPCODE, JUMP_INDIR_Z_BITS,  "s",	     0, SIZE_FIX_32,   0,
+   cris_none_reg_mode_jump_op},
+
+  {"jump",
+   JUMP_INDIR_OPCODE, JUMP_INDIR_Z_BITS,  "S",	     0, SIZE_NONE,     0,
+   cris_none_reg_mode_jump_op},
+
+  {"jmpu",    0x8930, 0x72c0,		  "s",	     0, SIZE_FIX_32,
+   cris_ver_v10p,
+   cris_none_reg_mode_jump_op},
+
+  {"jmpu",    0x8930, 0x72c0,		   "S",	     0, SIZE_NONE,
+   cris_ver_v10p,
+   cris_none_reg_mode_jump_op},
+
+  {"lsl",     0x04C0, 0x0B00,		  "m r,R",   0, SIZE_NONE,     0,
+   cris_dstep_logshift_mstep_neg_not_op},
+
+  {"lslq",    0x03c0, 0x0C20,		  "c,R",     0, SIZE_NONE,     0,
+   cris_dstep_logshift_mstep_neg_not_op},
+
+  {"lsr",     0x07C0, 0x0800,		  "m r,R",   0, SIZE_NONE,     0,
+   cris_dstep_logshift_mstep_neg_not_op},
+
+  {"lsrq",    0x03e0, 0x0C00,		  "c,R",     0, SIZE_NONE,     0,
+   cris_dstep_logshift_mstep_neg_not_op},
+
+  {"lz",      0x0730, 0x08C0,		  "r,R",     0, SIZE_NONE,
+   cris_ver_v3p,
+   cris_not_implemented_op},
+
+  {"move",    0x0640, 0x0980,		  "m r,R",   0, SIZE_NONE,     0,
+   cris_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"move",    0x0630, 0x09c0,		  "r,P",     0, SIZE_NONE,     0,
+   cris_move_to_preg_op},
+
+  {"move",    0x0670, 0x0980,		  "P,r",     0, SIZE_NONE,     0,
+   cris_reg_mode_move_from_preg_op},
+
+  {"move",    0x0BC0, 0x0000,		  "m R,y",   0, SIZE_FIELD,    0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"move",    0x0BC0, 0x0000,		  "m D,S",   0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"move",    0x0A40, 0x0180,		  "m s,R",   0, SIZE_FIELD,    0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"move",    0x0A40, 0x0180,		  "m S,D",   0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"move",    0x0A30, 0x01c0,		  "s,P",     0, SIZE_SPEC_REG, 0,
+   cris_move_to_preg_op},
+
+  {"move",    0x0A30, 0x01c0,		  "S,P",     0, SIZE_NONE,     0,
+   cris_move_to_preg_op},
+
+  {"move",    0x0A70, 0x0180,		  "P,y",     0, SIZE_SPEC_REG, 0,
+   cris_none_reg_mode_move_from_preg_op},
+
+  {"move",    0x0A70, 0x0180,		  "P,S",     0, SIZE_NONE,     0,
+   cris_none_reg_mode_move_from_preg_op},
+
+  {"movem",   0x0BF0, 0x0000,		  "R,y",     0, SIZE_FIX_32,   0,
+   cris_move_reg_to_mem_movem_op},
+
+  {"movem",   0x0BF0, 0x0000,		  "D,S",     0, SIZE_NONE,     0,
+   cris_move_reg_to_mem_movem_op},
+
+  {"movem",   0x0BB0, 0x0040,		  "s,R",     0, SIZE_FIX_32,   0,
+   cris_move_mem_to_reg_movem_op},
+
+  {"movem",   0x0BB0, 0x0040,		  "S,D",     0, SIZE_NONE,     0,
+   cris_move_mem_to_reg_movem_op},
+
+  {"moveq",   0x0240, 0x0D80,		  "i,R",     0, SIZE_NONE,     0,
+   cris_quick_mode_and_cmp_move_or_op},
+
+  {"movs",    0x0460, 0x0B80,		  "z r,R",   0, SIZE_NONE,     0,
+   cris_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"movs",    0x0860, 0x0380,		  "z s,R",   0, SIZE_FIELD,    0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"movs",    0x0860, 0x0380,		  "z S,D",   0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"movu",    0x0440, 0x0Ba0,		  "z r,R",   0, SIZE_NONE,     0,
+   cris_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"movu",    0x0840, 0x03a0,		  "z s,R",   0, SIZE_FIELD,    0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"movu",    0x0840, 0x03a0,		  "z S,D",   0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"mstep",   0x07f0, 0x0800,		  "r,R",     0, SIZE_NONE,     0,
+   cris_dstep_logshift_mstep_neg_not_op},
+
+  {"muls",    0x0d00, 0x02c0,		  "m r,R",   0, SIZE_NONE,
+   cris_ver_v10p,
+   cris_muls_op},
+
+  {"mulu",    0x0900, 0x06c0,		  "m r,R",   0, SIZE_NONE,
+   cris_ver_v10p,
+   cris_mulu_op},
+
+  {"neg",     0x0580, 0x0A40,		  "m r,R",   0, SIZE_NONE,     0,
+   cris_dstep_logshift_mstep_neg_not_op},
+
+  {"nop",     NOP_OPCODE, NOP_Z_BITS,	  "",	     0, SIZE_NONE,     0,
+   cris_btst_nop_op},
+
+  {"not",     0x8770, 0x7880,		  "r",	     0, SIZE_NONE,     0,
+   cris_dstep_logshift_mstep_neg_not_op},
+
+  {"or",      0x0740, 0x0880,		  "m r,R",   0, SIZE_NONE,     0,
+   cris_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"or",      0x0B40, 0x0080,		  "m s,R",   0, SIZE_FIELD,    0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"or",      0x0B40, 0x0080,		  "m S,D",   0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"or",      0x0B40, 0x0480,		  "m S,R,r", 0, SIZE_NONE,     0,
+   cris_three_operand_add_sub_cmp_and_or_op},
+
+  {"orq",     0x0340, 0x0C80,		  "i,R",     0, SIZE_NONE,     0,
+   cris_quick_mode_and_cmp_move_or_op},
+
+  {"pop",     0x0E6E, 0x0191,		  "!R",	     0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"pop",     0x0e3e, 0x01c1,		  "!P",	     0, SIZE_NONE,     0,
+   cris_none_reg_mode_move_from_preg_op},
+
+  {"push",    0x0FEE, 0x0011,		  "BR",	     0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"push",    0x0E7E, 0x0181,		  "BP",	     0, SIZE_NONE,     0,
+   cris_move_to_preg_op},
+
+  {"rbf",     0x3b30, 0xc0c0,		  "y",	     0, SIZE_NONE,
+   cris_ver_v10p,
+   cris_not_implemented_op},
+
+  {"rbf",     0x3b30, 0xc0c0,		  "S",	     0, SIZE_NONE,
+   cris_ver_v10p,
+   cris_not_implemented_op},
+
+  {"ret",     0xB67F, 0x4980,		  "",	     1, SIZE_NONE,     0,
+   cris_reg_mode_move_from_preg_op},
+
+  {"retb",    0xe67f, 0x1980,		  "",	     1, SIZE_NONE,     0,
+   cris_reg_mode_move_from_preg_op},
+
+  {"reti",    0xA67F, 0x5980,		  "",	     1, SIZE_NONE,     0,
+   cris_reg_mode_move_from_preg_op},
+
+  {"sbfs",    0x3b70, 0xc080,		  "y",	     0, SIZE_NONE,
+   cris_ver_v10p,
+   cris_not_implemented_op},
+
+  {"sbfs",    0x3b70, 0xc080,		  "S",	     0, SIZE_NONE,
+   cris_ver_v10p,
+   cris_not_implemented_op},
+
+  {"sa",
+   0x0530+CC_A*0x1000,
+   0x0AC0+(0xf-CC_A)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"scc",
+   0x0530+CC_CC*0x1000,
+   0x0AC0+(0xf-CC_CC)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"scs",
+   0x0530+CC_CS*0x1000,
+   0x0AC0+(0xf-CC_CS)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"seq",
+   0x0530+CC_EQ*0x1000,
+   0x0AC0+(0xf-CC_EQ)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"setf",    0x05b0, 0x0A40,		  "f",	     0, SIZE_NONE,     0,
+   cris_ax_ei_setf_op},
+
+  /* Need to have "swf" in front of "sext" so it is the one displayed in
+     disassembly.  */
+  {"swf",
+   0x0530+CC_EXT*0x1000,
+   0x0AC0+(0xf-CC_EXT)*0x1000,		  "r",	     0, SIZE_NONE,
+   cris_ver_v10p,
+   cris_scc_op},
+
+  {"sext",
+   0x0530+CC_EXT*0x1000,
+   0x0AC0+(0xf-CC_EXT)*0x1000,		  "r",	     0, SIZE_NONE,
+   cris_ver_v0_3,
+   cris_scc_op},
+
+  {"sge",
+   0x0530+CC_GE*0x1000,
+   0x0AC0+(0xf-CC_GE)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"sgt",
+   0x0530+CC_GT*0x1000,
+   0x0AC0+(0xf-CC_GT)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"shi",
+   0x0530+CC_HI*0x1000,
+   0x0AC0+(0xf-CC_HI)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"shs",
+   0x0530+CC_HS*0x1000,
+   0x0AC0+(0xf-CC_HS)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"sle",
+   0x0530+CC_LE*0x1000,
+   0x0AC0+(0xf-CC_LE)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"slo",
+   0x0530+CC_LO*0x1000,
+   0x0AC0+(0xf-CC_LO)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"sls",
+   0x0530+CC_LS*0x1000,
+   0x0AC0+(0xf-CC_LS)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"slt",
+   0x0530+CC_LT*0x1000,
+   0x0AC0+(0xf-CC_LT)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"smi",
+   0x0530+CC_MI*0x1000,
+   0x0AC0+(0xf-CC_MI)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"sne",
+   0x0530+CC_NE*0x1000,
+   0x0AC0+(0xf-CC_NE)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"spl",
+   0x0530+CC_PL*0x1000,
+   0x0AC0+(0xf-CC_PL)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"sub",     0x0680, 0x0940,		  "m r,R",   0, SIZE_NONE,     0,
+   cris_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"sub",     0x0a80, 0x0140,		  "m s,R",   0, SIZE_FIELD,    0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"sub",     0x0a80, 0x0140,		  "m S,D",   0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"sub",     0x0a80, 0x0540,		  "m S,R,r", 0, SIZE_NONE,     0,
+   cris_three_operand_add_sub_cmp_and_or_op},
+
+  {"subq",    0x0280, 0x0d40,		  "I,R",     0, SIZE_NONE,     0,
+   cris_quick_mode_add_sub_op},
+
+  {"subs",    0x04a0, 0x0b40,		  "z r,R",   0, SIZE_NONE,     0,
+   cris_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"subs",    0x08a0, 0x0340,		  "z s,R",   0, SIZE_FIELD,    0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"subs",    0x08a0, 0x0340,		  "z S,D",   0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"subs",    0x08a0, 0x0740,		  "z S,R,r", 0, SIZE_NONE,     0,
+   cris_three_operand_add_sub_cmp_and_or_op},
+
+  {"subu",    0x0480, 0x0b60,		  "z r,R",   0, SIZE_NONE,     0,
+   cris_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"subu",    0x0880, 0x0360,		  "z s,R",   0, SIZE_FIELD,    0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"subu",    0x0880, 0x0360,		  "z S,D",   0, SIZE_NONE,     0,
+   cris_none_reg_mode_add_sub_cmp_and_or_move_op},
+
+  {"subu",    0x0880, 0x0760,		  "z S,R,r", 0, SIZE_NONE,     0,
+   cris_three_operand_add_sub_cmp_and_or_op},
+
+  {"svc",
+   0x0530+CC_VC*0x1000,
+   0x0AC0+(0xf-CC_VC)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  {"svs",
+   0x0530+CC_VS*0x1000,
+   0x0AC0+(0xf-CC_VS)*0x1000,		  "r",	     0, SIZE_NONE,     0,
+   cris_scc_op},
+
+  /* The insn "swapn" is the same as "not" and will be disassembled as
+     such, but the swap* family of mnmonics are generally v8-and-higher
+     only, so count it in.  */
+  {"swapn",   0x8770, 0x7880,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_not_implemented_op},
+
+  {"swapw",   0x4770, 0xb880,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_not_implemented_op},
+
+  {"swapnw",  0xc770, 0x3880,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_not_implemented_op},
+
+  {"swapb",   0x2770, 0xd880,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_not_implemented_op},
+
+  {"swapnb",  0xA770, 0x5880,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_not_implemented_op},
+
+  {"swapwb",  0x6770, 0x9880,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_not_implemented_op},
+
+  {"swapnwb", 0xE770, 0x1880,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_not_implemented_op},
+
+  {"swapr",   0x1770, 0xe880,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_not_implemented_op},
+
+  {"swapnr",  0x9770, 0x6880,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_not_implemented_op},
+
+  {"swapwr",  0x5770, 0xa880,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_not_implemented_op},
+
+  {"swapnwr", 0xd770, 0x2880,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_not_implemented_op},
+
+  {"swapbr",  0x3770, 0xc880,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_not_implemented_op},
+
+  {"swapnbr", 0xb770, 0x4880,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_not_implemented_op},
+
+  {"swapwbr", 0x7770, 0x8880,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_not_implemented_op},
+
+  {"swapnwbr", 0xf770, 0x0880,		  "r",	     0, SIZE_NONE,
+   cris_ver_v8p,
+   cris_not_implemented_op},
+
+  {"test",    0x0640, 0x0980,		  "m D",     0, SIZE_NONE,     0,
+   cris_reg_mode_test_op},
+
+  {"test",    0x0b80, 0xf040,		  "m s",     0, SIZE_FIELD,    0,
+   cris_none_reg_mode_clear_test_op},
+
+  {"test",    0x0b80, 0xf040,		  "m S",     0, SIZE_NONE,     0,
+   cris_none_reg_mode_clear_test_op},
+
+  {"xor",     0x07B0, 0x0840,		  "r,R",     0, SIZE_NONE,     0,
+   cris_xor_op},
+
+  {NULL, 0, 0, NULL, 0, 0, 0, cris_not_implemented_op}
+};
+
+/* Condition-names, indexed by the CC_* numbers as found in cris.h. */
+const char * const
+cris_cc_strings[] =
+{
+  "hs",
+  "lo",
+  "ne",
+  "eq",
+  "vc",
+  "vs",
+  "pl",
+  "mi",
+  "ls",
+  "hi",
+  "ge",
+  "lt",
+  "gt",
+  "le",
+  "a",
+  /* In v0, this would be "ext".  */
+  "wf",
+};
+
+
+/*
+ * Local variables:
+ * eval: (c-set-style "gnu")
+ * indent-tabs-mode: t
+ * End:
+ */
diff --git a/opcodes/d30v-opc.c b/opcodes/d30v-opc.c
index 9dcc156..7b1bca0 100644
--- a/opcodes/d30v-opc.c
+++ b/opcodes/d30v-opc.c
@@ -349,7 +349,9 @@
   { 6, 6, 0, OPERAND_REG },
 #define Rb	(Ra3 + 1)
   { 6, 6, 6, OPERAND_REG },
-#define Rc	(Rb + 1)
+#define Rb2	(Rb + 1)
+  { 6, 6, 6, OPERAND_REG|OPERAND_DEST },
+#define Rc	(Rb2 + 1)
   { 6, 6, 12, OPERAND_REG },
 #define Aa	(Rc + 1)
   { 6, 1, 0, OPERAND_ACC|OPERAND_REG|OPERAND_DEST },
@@ -460,8 +462,8 @@
   { SHORT_AA, 2, { Aa, Rb, IMM6 } },		/* Aa,Rb,imm6 */
   { SHORT_RA, 0, { Ra, Ab, Rc } },		/* Ra,Ab,Rc */
   { SHORT_RA, 2, { Ra, Ab, IMM6U2 } },		/* Ra,Ab,imm6u */
-  { SHORT_MODINC, 1, { Rb, IMM5 } },		/* Rb,imm5 (modinc) */
-  { SHORT_MODDEC, 3, { Rb, IMM5 } },		/* Rb,imm5 (moddec) */
+  { SHORT_MODINC, 1, { Rb2, IMM5 } },		/* Rb2,imm5 (modinc) */
+  { SHORT_MODDEC, 3, { Rb2, IMM5 } },		/* Rb2,imm5 (moddec) */
   { SHORT_C1, 0, { Ra, Cb, Fake } },		/* Ra,Cb (mvfsys) */
   { SHORT_C2, 0, { Ca, Rb, Fake } },		/* Ca,Rb (mvtsys) */
   { SHORT_UF, 0, { Fa, Fb } },			/* Fa,Fb  (notfg) */
diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c
index 072aa42..58713bd 100644
--- a/opcodes/disassemble.c
+++ b/opcodes/disassemble.c
@@ -25,6 +25,7 @@
 #define ARCH_arc
 #define ARCH_arm
 #define ARCH_avr
+#define ARCH_cris
 #define ARCH_d10v
 #define ARCH_d30v
 #define ARCH_h8300
@@ -32,11 +33,14 @@
 #define ARCH_hppa
 #define ARCH_i370
 #define ARCH_i386
+#define ARCH_i860
 #define ARCH_i960
 #define ARCH_ia64
 #define ARCH_fr30
 #define ARCH_m32r
 #define ARCH_m68k
+#define ARCH_m68hc11
+#define ARCH_m68hc12
 #define ARCH_m88k
 #define ARCH_mcore
 #define ARCH_mips
@@ -101,6 +105,11 @@
       disassemble = print_insn_avr;
       break;
 #endif
+#ifdef ARCH_cris
+    case bfd_arch_cris:
+      disassemble = cris_get_disassembler (abfd);
+      break;
+#endif
 #ifdef ARCH_d10v
     case bfd_arch_d10v:
       disassemble = print_insn_d10v;
@@ -144,6 +153,11 @@
         disassemble = print_insn_i386_att;
       break;
 #endif
+#ifdef ARCH_i860
+    case bfd_arch_i860:
+      disassemble = print_insn_i860;
+      break;
+#endif
 #ifdef ARCH_i960
     case bfd_arch_i960:
       disassemble = print_insn_i960;
@@ -164,6 +178,14 @@
       disassemble = print_insn_m32r;
       break;
 #endif
+#if defined(ARCH_m68hc11) || defined(ARCH_m68hc12)
+    case bfd_arch_m68hc11:
+      disassemble = print_insn_m68hc11;
+      break;
+    case bfd_arch_m68hc12:
+      disassemble = print_insn_m68hc12;
+      break;
+#endif
 #ifdef ARCH_m68k
     case bfd_arch_m68k:
       disassemble = print_insn_m68k;
@@ -217,7 +239,7 @@
 #endif
 #ifdef ARCH_rs6000
     case bfd_arch_rs6000:
-      if (bfd_get_mach (abfd) == 620)
+      if (bfd_get_mach (abfd) == bfd_mach_ppc_620)
 	disassemble = print_insn_big_powerpc;
       else
 	disassemble = print_insn_rs6000;
diff --git a/opcodes/fr30-asm.c b/opcodes/fr30-asm.c
index 6038dbb..08092af 100644
--- a/opcodes/fr30-asm.c
+++ b/opcodes/fr30-asm.c
@@ -398,7 +398,7 @@
 	     first char after the mnemonic part is a space.  */
 	  /* FIXME: We also take inappropriate advantage of the fact that
 	     GAS's input scrubber will remove extraneous blanks.  */
-	  if (*str == CGEN_SYNTAX_CHAR (* syn))
+	  if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn)))
 	    {
 #ifdef CGEN_MNEMONIC_OPERANDS
 	      if (* syn == ' ')
@@ -410,9 +410,11 @@
 	  else
 	    {
 	      /* Syntax char didn't match.  Can't be this insn.  */
-	      /* FIXME: would like to return something like
-		 "expected char `c'" */
-	      return _("syntax error");
+	      static char msg [80];
+	      /* xgettext:c-format */
+	      sprintf (msg, _("syntax error (expected char `%c', found `%c')"),
+		       *syn, *str);
+	      return msg;
 	    }
 	  continue;
 	}
@@ -478,6 +480,7 @@
 {
   const char *start;
   CGEN_INSN_LIST *ilist;
+  const char *tmp_errmsg = NULL;
 
   /* Skip leading white space.  */
   while (isspace (* str))
@@ -494,7 +497,8 @@
     {
       const CGEN_INSN *insn = ilist->insn;
 
-#if 0 /* not needed as unsupported opcodes shouldn't be in the hash lists */
+#ifdef CGEN_VALIDATE_INSN_SUPPORTED 
+      /* not usually needed as unsupported opcodes shouldn't be in the hash lists */
       /* Is this insn supported by the selected cpu?  */
       if (! fr30_cgen_insn_supported (cd, insn))
 	continue;
@@ -511,30 +515,44 @@
       /* Allow parse/insert handlers to obtain length of insn.  */
       CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
 
-      if (! CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields))
-	{
-	  /* ??? 0 is passed for `pc' */
-	  if (CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf, (bfd_vma) 0)
-	      != NULL)
-	    continue;
-	  /* It is up to the caller to actually output the insn and any
-	     queued relocs.  */
-	  return insn;
-	}
+      tmp_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields);
+      if (tmp_errmsg != NULL)
+	continue;
 
-      /* Try the next entry.  */
+      /* ??? 0 is passed for `pc' */
+      tmp_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf,
+					      (bfd_vma) 0);
+      if (tmp_errmsg != NULL)
+        continue;
+
+      /* It is up to the caller to actually output the insn and any
+         queued relocs.  */
+      return insn;
     }
 
-  /* FIXME: We can return a better error message than this.
-     Need to track why it failed and pick the right one.  */
+  /* Make sure we leave this with something at this point. */
+  if (tmp_errmsg == NULL)
+    tmp_errmsg = "unknown mnemonic";
+
   {
-    static char errbuf[100];
+    static char errbuf[150];
+
+#ifdef CGEN_VERBOSE_ASSEMBLER_ERRORS
+    /* if verbose error messages, use errmsg from CGEN_PARSE_FN */
+    if (strlen (start) > 50)
+      /* xgettext:c-format */
+      sprintf (errbuf, "%s `%.50s...'", tmp_errmsg, start);
+    else 
+      /* xgettext:c-format */
+      sprintf (errbuf, "%s `%.50s'", tmp_errmsg, start);
+#else
     if (strlen (start) > 50)
       /* xgettext:c-format */
       sprintf (errbuf, _("bad instruction `%.50s...'"), start);
     else 
       /* xgettext:c-format */
       sprintf (errbuf, _("bad instruction `%.50s'"), start);
+#endif
       
     *errmsg = errbuf;
     return NULL;
diff --git a/opcodes/fr30-desc.c b/opcodes/fr30-desc.c
index 51e11e0..42561ed 100644
--- a/opcodes/fr30-desc.c
+++ b/opcodes/fr30-desc.c
@@ -32,6 +32,7 @@
 #include "fr30-desc.h"
 #include "fr30-opc.h"
 #include "opintl.h"
+#include "libiberty.h"
 
 /* Attributes.  */
 
@@ -59,7 +60,7 @@
 
 const CGEN_ATTR_TABLE fr30_cgen_ifield_attr_table[] =
 {
-  { "MACH", & MACH_attr[0] },
+  { "MACH", & MACH_attr[0], & MACH_attr[0] },
   { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
   { "PCREL-ADDR", &bool_attr[0], &bool_attr[0] },
   { "ABS-ADDR", &bool_attr[0], &bool_attr[0] },
@@ -71,7 +72,7 @@
 
 const CGEN_ATTR_TABLE fr30_cgen_hardware_attr_table[] =
 {
-  { "MACH", & MACH_attr[0] },
+  { "MACH", & MACH_attr[0], & MACH_attr[0] },
   { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
   { "CACHE-ADDR", &bool_attr[0], &bool_attr[0] },
   { "PC", &bool_attr[0], &bool_attr[0] },
@@ -81,7 +82,7 @@
 
 const CGEN_ATTR_TABLE fr30_cgen_operand_attr_table[] =
 {
-  { "MACH", & MACH_attr[0] },
+  { "MACH", & MACH_attr[0], & MACH_attr[0] },
   { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
   { "PCREL-ADDR", &bool_attr[0], &bool_attr[0] },
   { "ABS-ADDR", &bool_attr[0], &bool_attr[0] },
@@ -96,7 +97,7 @@
 
 const CGEN_ATTR_TABLE fr30_cgen_insn_attr_table[] =
 {
-  { "MACH", & MACH_attr[0] },
+  { "MACH", & MACH_attr[0], & MACH_attr[0] },
   { "ALIAS", &bool_attr[0], &bool_attr[0] },
   { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
   { "UNCOND-CTI", &bool_attr[0], &bool_attr[0] },
@@ -114,130 +115,137 @@
 /* Instruction set variants.  */
 
 static const CGEN_ISA fr30_cgen_isa_table[] = {
-  { "fr30", 16, 16, 16, 48,  },
-  { 0 }
+  { "fr30", 16, 16, 16, 48 },
+  { 0, 0, 0, 0, 0 }
 };
 
 /* Machine variants.  */
 
 static const CGEN_MACH fr30_cgen_mach_table[] = {
   { "fr30", "fr30", MACH_FR30 },
-  { 0 }
+  { 0, 0, 0 }
 };
 
 static CGEN_KEYWORD_ENTRY fr30_cgen_opval_gr_names_entries[] =
 {
-  { "r0", 0 },
-  { "r1", 1 },
-  { "r2", 2 },
-  { "r3", 3 },
-  { "r4", 4 },
-  { "r5", 5 },
-  { "r6", 6 },
-  { "r7", 7 },
-  { "r8", 8 },
-  { "r9", 9 },
-  { "r10", 10 },
-  { "r11", 11 },
-  { "r12", 12 },
-  { "r13", 13 },
-  { "r14", 14 },
-  { "r15", 15 },
-  { "ac", 13 },
-  { "fp", 14 },
-  { "sp", 15 }
+  { "r0", 0, {0, {0}}, 0, 0 },
+  { "r1", 1, {0, {0}}, 0, 0 },
+  { "r2", 2, {0, {0}}, 0, 0 },
+  { "r3", 3, {0, {0}}, 0, 0 },
+  { "r4", 4, {0, {0}}, 0, 0 },
+  { "r5", 5, {0, {0}}, 0, 0 },
+  { "r6", 6, {0, {0}}, 0, 0 },
+  { "r7", 7, {0, {0}}, 0, 0 },
+  { "r8", 8, {0, {0}}, 0, 0 },
+  { "r9", 9, {0, {0}}, 0, 0 },
+  { "r10", 10, {0, {0}}, 0, 0 },
+  { "r11", 11, {0, {0}}, 0, 0 },
+  { "r12", 12, {0, {0}}, 0, 0 },
+  { "r13", 13, {0, {0}}, 0, 0 },
+  { "r14", 14, {0, {0}}, 0, 0 },
+  { "r15", 15, {0, {0}}, 0, 0 },
+  { "ac", 13, {0, {0}}, 0, 0 },
+  { "fp", 14, {0, {0}}, 0, 0 },
+  { "sp", 15, {0, {0}}, 0, 0 }
 };
 
 CGEN_KEYWORD fr30_cgen_opval_gr_names =
 {
   & fr30_cgen_opval_gr_names_entries[0],
-  19
+  19,
+  0, 0, 0, 0
 };
 
 static CGEN_KEYWORD_ENTRY fr30_cgen_opval_cr_names_entries[] =
 {
-  { "cr0", 0 },
-  { "cr1", 1 },
-  { "cr2", 2 },
-  { "cr3", 3 },
-  { "cr4", 4 },
-  { "cr5", 5 },
-  { "cr6", 6 },
-  { "cr7", 7 },
-  { "cr8", 8 },
-  { "cr9", 9 },
-  { "cr10", 10 },
-  { "cr11", 11 },
-  { "cr12", 12 },
-  { "cr13", 13 },
-  { "cr14", 14 },
-  { "cr15", 15 }
+  { "cr0", 0, {0, {0}}, 0, 0 },
+  { "cr1", 1, {0, {0}}, 0, 0 },
+  { "cr2", 2, {0, {0}}, 0, 0 },
+  { "cr3", 3, {0, {0}}, 0, 0 },
+  { "cr4", 4, {0, {0}}, 0, 0 },
+  { "cr5", 5, {0, {0}}, 0, 0 },
+  { "cr6", 6, {0, {0}}, 0, 0 },
+  { "cr7", 7, {0, {0}}, 0, 0 },
+  { "cr8", 8, {0, {0}}, 0, 0 },
+  { "cr9", 9, {0, {0}}, 0, 0 },
+  { "cr10", 10, {0, {0}}, 0, 0 },
+  { "cr11", 11, {0, {0}}, 0, 0 },
+  { "cr12", 12, {0, {0}}, 0, 0 },
+  { "cr13", 13, {0, {0}}, 0, 0 },
+  { "cr14", 14, {0, {0}}, 0, 0 },
+  { "cr15", 15, {0, {0}}, 0, 0 }
 };
 
 CGEN_KEYWORD fr30_cgen_opval_cr_names =
 {
   & fr30_cgen_opval_cr_names_entries[0],
-  16
+  16,
+  0, 0, 0, 0
 };
 
 static CGEN_KEYWORD_ENTRY fr30_cgen_opval_dr_names_entries[] =
 {
-  { "tbr", 0 },
-  { "rp", 1 },
-  { "ssp", 2 },
-  { "usp", 3 },
-  { "mdh", 4 },
-  { "mdl", 5 }
+  { "tbr", 0, {0, {0}}, 0, 0 },
+  { "rp", 1, {0, {0}}, 0, 0 },
+  { "ssp", 2, {0, {0}}, 0, 0 },
+  { "usp", 3, {0, {0}}, 0, 0 },
+  { "mdh", 4, {0, {0}}, 0, 0 },
+  { "mdl", 5, {0, {0}}, 0, 0 }
 };
 
 CGEN_KEYWORD fr30_cgen_opval_dr_names =
 {
   & fr30_cgen_opval_dr_names_entries[0],
-  6
+  6,
+  0, 0, 0, 0
 };
 
 static CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_ps_entries[] =
 {
-  { "ps", 0 }
+  { "ps", 0, {0, {0}}, 0, 0 }
 };
 
 CGEN_KEYWORD fr30_cgen_opval_h_ps =
 {
   & fr30_cgen_opval_h_ps_entries[0],
-  1
+  1,
+  0, 0, 0, 0
 };
 
 static CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_r13_entries[] =
 {
-  { "r13", 0 }
+  { "r13", 0, {0, {0}}, 0, 0 }
 };
 
 CGEN_KEYWORD fr30_cgen_opval_h_r13 =
 {
   & fr30_cgen_opval_h_r13_entries[0],
-  1
+  1,
+  0, 0, 0, 0
 };
 
 static CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_r14_entries[] =
 {
-  { "r14", 0 }
+  { "r14", 0, {0, {0}}, 0, 0 }
 };
 
 CGEN_KEYWORD fr30_cgen_opval_h_r14 =
 {
   & fr30_cgen_opval_h_r14_entries[0],
-  1
+  1,
+  0, 0, 0, 0
 };
 
 static CGEN_KEYWORD_ENTRY fr30_cgen_opval_h_r15_entries[] =
 {
-  { "r15", 0 }
+  { "r15", 0, {0, {0}}, 0, 0 }
 };
 
 CGEN_KEYWORD fr30_cgen_opval_h_r15 =
 {
   & fr30_cgen_opval_h_r15_entries[0],
-  1
+  1,
+  0, 0, 0, 0
 };
 
 
@@ -273,7 +281,7 @@
   { "h-ccr", HW_H_CCR, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
   { "h-scr", HW_H_SCR, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
   { "h-ilm", HW_H_ILM, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
-  { 0 }
+  { 0, 0, CGEN_ASM_NONE, 0, {0, {0}} }
 };
 
 #undef A
@@ -285,6 +293,7 @@
 const CGEN_IFLD fr30_cgen_ifld_table[] =
 {
   { FR30_F_NIL, "f-nil", 0, 0, 0, 0, { 0, { (1<<MACH_BASE) } }  },
+  { FR30_F_ANYOF, "f-anyof", 0, 0, 0, 0, { 0, { (1<<MACH_BASE) } }  },
   { FR30_F_OP1, "f-op1", 0, 16, 0, 4, { 0, { (1<<MACH_BASE) } }  },
   { FR30_F_OP2, "f-op2", 0, 16, 4, 4, { 0, { (1<<MACH_BASE) } }  },
   { FR30_F_OP3, "f-op3", 0, 16, 8, 4, { 0, { (1<<MACH_BASE) } }  },
@@ -324,7 +333,7 @@
   { FR30_F_REGLIST_LOW_ST, "f-reglist_low_st", 0, 16, 8, 8, { 0, { (1<<MACH_BASE) } }  },
   { FR30_F_REGLIST_HI_LD, "f-reglist_hi_ld", 0, 16, 8, 8, { 0, { (1<<MACH_BASE) } }  },
   { FR30_F_REGLIST_LOW_LD, "f-reglist_low_ld", 0, 16, 8, 8, { 0, { (1<<MACH_BASE) } }  },
-  { 0 }
+  { 0, 0, 0, 0, 0, 0, {0, {0}} }
 };
 
 #undef A
@@ -483,7 +492,7 @@
 /* ilm: interrupt level mask */
   { "ilm", FR30_OPERAND_ILM, HW_H_ILM, 0, 0,
     { 0|A(SEM_ONLY), { (1<<MACH_BASE) } }  },
-  { 0 }
+  { 0, 0, 0, 0, 0, {0, {0}} }
 };
 
 #undef A
@@ -498,7 +507,7 @@
   /* Special null first entry.
      A `num' value of zero is thus invalid.
      Also, the special `invalid' insn resides here.  */
-  { 0, 0, 0 },
+  { 0, 0, 0, 0, {0, {0}} },
 /* add $Rj,$Ri */
   {
     FR30_INSN_ADD, "add", "add", 16,
@@ -1446,9 +1455,11 @@
 fr30_cgen_rebuild_tables (cd)
      CGEN_CPU_TABLE *cd;
 {
-  int i,n_isas,n_machs;
+  int i,n_isas;
   unsigned int isas = cd->isas;
+#if 0
   unsigned int machs = cd->machs;
+#endif
 
   cd->int_insn_p = CGEN_INT_INSN_P;
 
@@ -1490,6 +1501,7 @@
 	++n_isas;
       }
 
+#if 0 /* Does nothing?? */
   /* Data derived from the mach spec.  */
   for (i = 0; i < MAX_MACHS; ++i)
     if (((1 << i) & machs) != 0)
@@ -1498,6 +1510,7 @@
 
 	++n_machs;
       }
+#endif
 
   /* Determine which hw elements are used by MACH.  */
   build_hw_table (cd);
@@ -1609,7 +1622,7 @@
   cd->rebuild_tables = fr30_cgen_rebuild_tables;
   fr30_cgen_rebuild_tables (cd);
 
-  /* Initialise flags.  */
+  /* Default to not allowing signed overflow.  */
   cd->signed_overflow_ok_p = 0;
   
   return (CGEN_CPU_DESC) cd;
diff --git a/opcodes/fr30-desc.h b/opcodes/fr30-desc.h
index 9d59219..446fc7d 100644
--- a/opcodes/fr30-desc.h
+++ b/opcodes/fr30-desc.h
@@ -43,7 +43,7 @@
 
 #define CGEN_INT_INSN_P 0
 
-/* Maximum number of syntax bytes in an instruction.  */
+/* Maximum nymber of syntax bytes in an instruction.  */
 #define CGEN_ACTUAL_MAX_SYNTAX_BYTES 15
 
 /* CGEN_MNEMONIC_OPERANDS is defined if mnemonics have operands.
@@ -155,17 +155,17 @@
 
 /* Enum declaration for fr30 ifield types.  */
 typedef enum ifield_type {
-  FR30_F_NIL, FR30_F_OP1, FR30_F_OP2, FR30_F_OP3
- , FR30_F_OP4, FR30_F_OP5, FR30_F_CC, FR30_F_CCC
- , FR30_F_RJ, FR30_F_RI, FR30_F_RS1, FR30_F_RS2
- , FR30_F_RJC, FR30_F_RIC, FR30_F_CRJ, FR30_F_CRI
- , FR30_F_U4, FR30_F_U4C, FR30_F_I4, FR30_F_M4
- , FR30_F_U8, FR30_F_I8, FR30_F_I20_4, FR30_F_I20_16
- , FR30_F_I20, FR30_F_I32, FR30_F_UDISP6, FR30_F_DISP8
- , FR30_F_DISP9, FR30_F_DISP10, FR30_F_S10, FR30_F_U10
- , FR30_F_REL9, FR30_F_DIR8, FR30_F_DIR9, FR30_F_DIR10
- , FR30_F_REL12, FR30_F_REGLIST_HI_ST, FR30_F_REGLIST_LOW_ST, FR30_F_REGLIST_HI_LD
- , FR30_F_REGLIST_LOW_LD, FR30_F_MAX
+  FR30_F_NIL, FR30_F_ANYOF, FR30_F_OP1, FR30_F_OP2
+ , FR30_F_OP3, FR30_F_OP4, FR30_F_OP5, FR30_F_CC
+ , FR30_F_CCC, FR30_F_RJ, FR30_F_RI, FR30_F_RS1
+ , FR30_F_RS2, FR30_F_RJC, FR30_F_RIC, FR30_F_CRJ
+ , FR30_F_CRI, FR30_F_U4, FR30_F_U4C, FR30_F_I4
+ , FR30_F_M4, FR30_F_U8, FR30_F_I8, FR30_F_I20_4
+ , FR30_F_I20_16, FR30_F_I20, FR30_F_I32, FR30_F_UDISP6
+ , FR30_F_DISP8, FR30_F_DISP9, FR30_F_DISP10, FR30_F_S10
+ , FR30_F_U10, FR30_F_REL9, FR30_F_DIR8, FR30_F_DIR9
+ , FR30_F_DIR10, FR30_F_REL12, FR30_F_REGLIST_HI_ST, FR30_F_REGLIST_LOW_ST
+ , FR30_F_REGLIST_HI_LD, FR30_F_REGLIST_LOW_LD, FR30_F_MAX
 } IFIELD_TYPE;
 
 #define MAX_IFLD ((int) FR30_F_MAX)
@@ -225,7 +225,7 @@
 } CGEN_OPERAND_TYPE;
 
 /* Number of operands types.  */
-#define MAX_OPERANDS ((int) FR30_OPERAND_MAX)
+#define MAX_OPERANDS 49
 
 /* Maximum number of operands referenced by any insn.  */
 #define MAX_OPERAND_INSTANCES 8
diff --git a/opcodes/fr30-dis.c b/opcodes/fr30-dis.c
index c42915b..bd5946f 100644
--- a/opcodes/fr30-dis.c
+++ b/opcodes/fr30-dis.c
@@ -96,60 +96,60 @@
 
 static void
 print_hi_register_list_ld (cd, dis_info, value, attrs, pc, length)
-     CGEN_CPU_DESC cd;
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
      PTR dis_info;
      long value;
-     unsigned int attrs;
-     bfd_vma pc;
-     int length;
+     unsigned int attrs ATTRIBUTE_UNUSED;
+     bfd_vma pc ATTRIBUTE_UNUSED;
+     int length ATTRIBUTE_UNUSED;
 {
   print_register_list (dis_info, value, 8, 0/*load*/);
 }
 
 static void
 print_low_register_list_ld (cd, dis_info, value, attrs, pc, length)
-     CGEN_CPU_DESC cd;
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
      PTR dis_info;
      long value;
-     unsigned int attrs;
-     bfd_vma pc;
-     int length;
+     unsigned int attrs ATTRIBUTE_UNUSED;
+     bfd_vma pc ATTRIBUTE_UNUSED;
+     int length ATTRIBUTE_UNUSED;
 {
   print_register_list (dis_info, value, 0, 0/*load*/);
 }
 
 static void
 print_hi_register_list_st (cd, dis_info, value, attrs, pc, length)
-     CGEN_CPU_DESC cd;
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
      PTR dis_info;
      long value;
-     unsigned int attrs;
-     bfd_vma pc;
-     int length;
+     unsigned int attrs ATTRIBUTE_UNUSED;
+     bfd_vma pc ATTRIBUTE_UNUSED;
+     int length ATTRIBUTE_UNUSED;
 {
   print_register_list (dis_info, value, 8, 1/*store*/);
 }
 
 static void
 print_low_register_list_st (cd, dis_info, value, attrs, pc, length)
-     CGEN_CPU_DESC cd;
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
      PTR dis_info;
      long value;
-     unsigned int attrs;
-     bfd_vma pc;
-     int length;
+     unsigned int attrs ATTRIBUTE_UNUSED;
+     bfd_vma pc ATTRIBUTE_UNUSED;
+     int length ATTRIBUTE_UNUSED;
 {
   print_register_list (dis_info, value, 0, 1/*store*/);
 }
 
 static void
 print_m4 (cd, dis_info, value, attrs, pc, length)
-     CGEN_CPU_DESC cd;
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
      PTR dis_info;
      long value;
-     unsigned int attrs;
-     bfd_vma pc;
-     int length;
+     unsigned int attrs ATTRIBUTE_UNUSED;
+     bfd_vma pc ATTRIBUTE_UNUSED;
+     int length ATTRIBUTE_UNUSED;
 {
   disassemble_info *info = (disassemble_info *) dis_info;
   (*info->fprintf_func) (info->stream, "%ld", value);
@@ -178,7 +178,7 @@
      int opindex;
      PTR xinfo;
      CGEN_FIELDS *fields;
-     void const *attrs;
+     void const *attrs ATTRIBUTE_UNUSED;
      bfd_vma pc;
      int length;
 {
@@ -324,12 +324,21 @@
 
 static void
 print_normal (cd, dis_info, value, attrs, pc, length)
+#ifdef CGEN_PRINT_NORMAL
      CGEN_CPU_DESC cd;
+#else
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+#endif
      PTR dis_info;
      long value;
      unsigned int attrs;
+#ifdef CGEN_PRINT_NORMAL
      bfd_vma pc;
      int length;
+#else
+     bfd_vma pc ATTRIBUTE_UNUSED;
+     int length ATTRIBUTE_UNUSED;
+#endif
 {
   disassemble_info *info = (disassemble_info *) dis_info;
 
@@ -350,12 +359,21 @@
 
 static void
 print_address (cd, dis_info, value, attrs, pc, length)
+#ifdef CGEN_PRINT_NORMAL
      CGEN_CPU_DESC cd;
+#else
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+#endif
      PTR dis_info;
      bfd_vma value;
      unsigned int attrs;
+#ifdef CGEN_PRINT_NORMAL
      bfd_vma pc;
      int length;
+#else
+     bfd_vma pc ATTRIBUTE_UNUSED;
+     int length ATTRIBUTE_UNUSED;
+#endif
 {
   disassemble_info *info = (disassemble_info *) dis_info;
 
@@ -380,11 +398,11 @@
 
 static void
 print_keyword (cd, dis_info, keyword_table, value, attrs)
-     CGEN_CPU_DESC cd;
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
      PTR dis_info;
      CGEN_KEYWORD *keyword_table;
      long value;
-     unsigned int attrs;
+     unsigned int attrs ATTRIBUTE_UNUSED;
 {
   disassemble_info *info = (disassemble_info *) dis_info;
   const CGEN_KEYWORD_ENTRY *ke;
@@ -435,6 +453,48 @@
     }
 }
 
+/* Subroutine of print_insn. Reads an insn into the given buffers and updates
+   the extract info.
+   Returns 0 if all is well, non-zero otherwise.  */
+static int
+read_insn (cd, pc, info, buf, buflen, ex_info, insn_value)
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+     bfd_vma pc;
+     disassemble_info *info;
+     char *buf;
+     int buflen;
+     CGEN_EXTRACT_INFO *ex_info;
+     unsigned long *insn_value;
+{
+  int status = (*info->read_memory_func) (pc, buf, buflen, info);
+  if (status != 0)
+    {
+      (*info->memory_error_func) (status, pc, info);
+      return -1;
+    }
+
+  ex_info->dis_info = info;
+  ex_info->valid = (1 << buflen) - 1;
+  ex_info->insn_bytes = buf;
+
+  switch (buflen)
+    {
+    case 1:
+      *insn_value = buf[0];
+      break;
+    case 2:
+      *insn_value = info->endian == BFD_ENDIAN_BIG ? bfd_getb16 (buf) : bfd_getl16 (buf);
+      break;
+    case 4:
+      *insn_value = info->endian == BFD_ENDIAN_BIG ? bfd_getb32 (buf) : bfd_getl32 (buf);
+      break;
+    default:
+      abort ();
+    }
+
+  return 0;
+}
+
 /* Utility to print an insn.
    BUF is the base part of the insn, target byte order, BUFLEN bytes long.
    The result is the size of the insn in bytes or zero for an unknown insn
@@ -453,24 +513,9 @@
   const CGEN_INSN_LIST *insn_list;
   CGEN_EXTRACT_INFO ex_info;
 
-  ex_info.dis_info = info;
-  ex_info.valid = (1 << (cd->base_insn_bitsize / 8)) - 1;
-  ex_info.insn_bytes = buf;
-
-  switch (buflen)
-    {
-    case 1:
-      insn_value = buf[0];
-      break;
-    case 2:
-      insn_value = info->endian == BFD_ENDIAN_BIG ? bfd_getb16 (buf) : bfd_getl16 (buf);
-      break;
-    case 4:
-      insn_value = info->endian == BFD_ENDIAN_BIG ? bfd_getb32 (buf) : bfd_getl32 (buf);
-      break;
-    default:
-      abort ();
-    }
+  int rc = read_insn (cd, pc, info, buf, buflen, & ex_info, & insn_value);
+  if (rc != 0)
+    return rc;
 
   /* The instructions are stored in hash lists.
      Pick the first one and keep trying until we find the right one.  */
@@ -482,10 +527,14 @@
       CGEN_FIELDS fields;
       int length;
 
-#if 0 /* not needed as insn shouldn't be in hash lists if not supported */
+#ifdef CGEN_VALIDATE_INSN_SUPPORTED 
+      /* not needed as insn shouldn't be in hash lists if not supported */
       /* Supported by this cpu?  */
       if (! fr30_cgen_insn_supported (cd, insn))
-	continue;
+        {
+          insn_list = CGEN_DIS_NEXT_INSN (insn_list);
+	  continue;
+        }
 #endif
 
       /* Basic bit mask must be correct.  */
@@ -498,8 +547,24 @@
 	     machine insn and extracts the fields.  The second pass prints
 	     them.  */
 
-	  length = CGEN_EXTRACT_FN (cd, insn)
-	    (cd, insn, &ex_info, insn_value, &fields, pc);
+	  /* Make sure the entire insn is loaded into insn_value, if it
+	     can fit.  */
+	  if ((unsigned) CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize &&
+	      (unsigned) (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long))
+	    {
+	      unsigned long full_insn_value;
+	      int rc = read_insn (cd, pc, info, buf,
+				  CGEN_INSN_BITSIZE (insn) / 8,
+				  & ex_info, & full_insn_value);
+	      if (rc != 0)
+		return rc;
+	      length = CGEN_EXTRACT_FN (cd, insn)
+		(cd, insn, &ex_info, full_insn_value, &fields, pc);
+	    }
+	  else
+	    length = CGEN_EXTRACT_FN (cd, insn)
+	      (cd, insn, &ex_info, insn_value, &fields, pc);
+
 	  /* length < 0 -> error */
 	  if (length < 0)
 	    return length;
@@ -556,7 +621,9 @@
      disassemble_info *info;
 {
   static CGEN_CPU_DESC cd = 0;
-  static prev_isa,prev_mach,prev_endian;
+  static int prev_isa;
+  static int prev_mach;
+  static int prev_endian;
   int length;
   int isa,mach;
   int endian = (info->endian == BFD_ENDIAN_BIG
diff --git a/opcodes/fr30-ibld.c b/opcodes/fr30-ibld.c
index 2aa4458..a29ce3e 100644
--- a/opcodes/fr30-ibld.c
+++ b/opcodes/fr30-ibld.c
@@ -3,7 +3,7 @@
 THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator.
 - the resultant file is machine generated, cgen-ibld.in isn't
 
-Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 This file is part of the GNU Binutils and GDB, the GNU debugger.
 
@@ -57,6 +57,9 @@
 static int extract_insn_normal
      PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, CGEN_EXTRACT_INFO *,
 	      CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma));
+static void put_insn_int_value
+     PARAMS ((CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT));
+
 
 /* Operand insertion.  */
 
@@ -183,9 +186,11 @@
   if (length == 0)
     return NULL;
 
+#if 0
   if (CGEN_INT_INSN_P
       && word_offset != 0)
     abort ();
+#endif
 
   if (word_length > 32)
     abort ();
@@ -203,6 +208,7 @@
   if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED))
     {
       unsigned long maxval = mask;
+      
       if ((unsigned long) value > maxval)
 	{
 	  /* xgettext:c-format */
@@ -214,15 +220,19 @@
     }
   else
     {
-      long minval = - (1L << (length - 1));
-      long maxval = (1L << (length - 1)) - 1;
-      if (value < minval || value > maxval)
+      if (! cgen_signed_overflow_ok_p (cd))
 	{
-	  sprintf
-	    /* xgettext:c-format */
-	    (errbuf, _("operand out of range (%ld not between %ld and %ld)"),
-	     value, minval, maxval);
-	  return errbuf;
+	  long minval = - (1L << (length - 1));
+	  long maxval =   (1L << (length - 1)) - 1;
+	  
+	  if (value < minval || value > maxval)
+	    {
+	      sprintf
+		/* xgettext:c-format */
+		(errbuf, _("operand out of range (%ld not between %ld and %ld)"),
+		 value, minval, maxval);
+	      return errbuf;
+	    }
 	}
     }
 
@@ -232,9 +242,9 @@
     int shift;
 
     if (CGEN_INSN_LSB0_P)
-      shift = (start + 1) - length;
+      shift = (word_offset + start + 1) - length;
     else
-      shift = word_length - (start + length);
+      shift = total_length - (word_offset + start + length);
     *buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
   }
 
@@ -278,7 +288,8 @@
 
 #if CGEN_INT_INSN_P
 
-  *buffer = value;
+  put_insn_int_value (cd, buffer, cd->base_insn_bitsize,
+		      CGEN_FIELDS_BITSIZE (fields), value);
 
 #else
 
@@ -308,6 +319,30 @@
 
   return NULL;
 }
+
+/* Cover function to store an insn value into an integral insn.  Must go here
+ because it needs <prefix>-desc.h for CGEN_INT_INSN_P.  */
+
+static void
+put_insn_int_value (cd, buf, length, insn_length, value)
+     CGEN_CPU_DESC cd;
+     CGEN_INSN_BYTES_PTR buf;
+     int length;
+     int insn_length;
+     CGEN_INSN_INT value;
+{
+  /* For architectures with insns smaller than the base-insn-bitsize,
+     length may be too big.  */
+  if (length > insn_length)
+    *buf = value;
+  else
+    {
+      int shift = insn_length - length;
+      /* Written this way to avoid undefined behaviour.  */
+      CGEN_INSN_INT mask = (((1L << (length - 1)) - 1) << 1) | 1;
+      *buf = (*buf & ~(mask << shift)) | ((value & mask) << shift);
+    }
+}
 
 /* Operand extraction.  */
 
@@ -439,11 +474,19 @@
 extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length,
 		word_length, total_length, pc, valuep)
      CGEN_CPU_DESC cd;
+#if ! CGEN_INT_INSN_P
      CGEN_EXTRACT_INFO *ex_info;
+#else
+     CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED;
+#endif
      CGEN_INSN_INT insn_value;
      unsigned int attrs;
      unsigned int word_offset, start, length, word_length, total_length;
+#if ! CGEN_INT_INSN_P
      bfd_vma pc;
+#else
+     bfd_vma pc ATTRIBUTE_UNUSED;
+#endif
      long *valuep;
 {
   CGEN_INSN_INT value;
@@ -456,9 +499,11 @@
       return 1;
     }
 
+#if 0
   if (CGEN_INT_INSN_P
       && word_offset != 0)
     abort ();
+#endif
 
   if (word_length > 32)
     abort ();
@@ -474,15 +519,15 @@
 
   /* Does the value reside in INSN_VALUE?  */
 
-  if (word_offset == 0)
+  if (CGEN_INT_INSN_P || word_offset == 0)
     {
       /* Written this way to avoid undefined behaviour.  */
       CGEN_INSN_INT mask = (((1L << (length - 1)) - 1) << 1) | 1;
 
       if (CGEN_INSN_LSB0_P)
-	value = insn_value >> ((start + 1) - length);
+	value = insn_value >> ((word_offset + start + 1) - length);
       else
-	value = insn_value >> (word_length - (start + length));
+	value = insn_value >> (total_length - ( word_offset + start + length));
       value &= mask;
       /* sign extend? */
       if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)
@@ -858,7 +903,9 @@
     case FR30_OPERAND_I20 :
       {
         length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 16, total_length, pc, & fields->f_i20_4);
+        if (length <= 0) break;
         length = extract_normal (cd, ex_info, insn_value, 0, 16, 0, 16, 16, total_length, pc, & fields->f_i20_16);
+        if (length <= 0) break;
 {
   FLD (f_i20) = ((((FLD (f_i20_4)) << (16))) | (FLD (f_i20_16)));
 }
diff --git a/opcodes/fr30-opc.c b/opcodes/fr30-opc.c
index 5ea7e0a..3b37dcb 100644
--- a/opcodes/fr30-opc.c
+++ b/opcodes/fr30-opc.c
@@ -28,6 +28,7 @@
 #include "symcat.h"
 #include "fr30-desc.h"
 #include "fr30-opc.h"
+#include "libiberty.h"
 
 /* The hash functions are recorded here to help keep assembler code out of
    the disassembler and vice versa.  */
@@ -42,123 +43,123 @@
 #define F(f) & fr30_cgen_ifld_table[CONCAT2 (FR30_,f)]
 
 static const CGEN_IFMT ifmt_empty = {
-  0, 0, 0x0, { 0 }
+  0, 0, 0x0, { { 0 } }
 };
 
 static const CGEN_IFMT ifmt_add = {
-  16, 16, 0xff00, { F (F_OP1), F (F_OP2), F (F_RJ), F (F_RI), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_RJ) }, { F (F_RI) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_addi = {
-  16, 16, 0xff00, { F (F_OP1), F (F_OP2), F (F_U4), F (F_RI), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_U4) }, { F (F_RI) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_add2 = {
-  16, 16, 0xff00, { F (F_OP1), F (F_OP2), F (F_M4), F (F_RI), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_M4) }, { F (F_RI) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_div0s = {
-  16, 16, 0xfff0, { F (F_OP1), F (F_OP2), F (F_OP3), F (F_RI), 0 }
+  16, 16, 0xfff0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3) }, { F (F_RI) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_div3 = {
-  16, 16, 0xffff, { F (F_OP1), F (F_OP2), F (F_OP3), F (F_OP4), 0 }
+  16, 16, 0xffff, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3) }, { F (F_OP4) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldi8 = {
-  16, 16, 0xf000, { F (F_OP1), F (F_I8), F (F_RI), 0 }
+  16, 16, 0xf000, { { F (F_OP1) }, { F (F_I8) }, { F (F_RI) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldi20 = {
-  16, 32, 0xff00, { F (F_OP1), F (F_I20), F (F_OP2), F (F_RI), 0 }
+  16, 32, 0xff00, { { F (F_OP1) }, { F (F_I20) }, { F (F_OP2) }, { F (F_RI) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldi32 = {
-  16, 48, 0xfff0, { F (F_OP1), F (F_I32), F (F_OP2), F (F_OP3), F (F_RI), 0 }
+  16, 48, 0xfff0, { { F (F_OP1) }, { F (F_I32) }, { F (F_OP2) }, { F (F_OP3) }, { F (F_RI) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldr14 = {
-  16, 16, 0xf000, { F (F_OP1), F (F_DISP10), F (F_RI), 0 }
+  16, 16, 0xf000, { { F (F_OP1) }, { F (F_DISP10) }, { F (F_RI) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldr14uh = {
-  16, 16, 0xf000, { F (F_OP1), F (F_DISP9), F (F_RI), 0 }
+  16, 16, 0xf000, { { F (F_OP1) }, { F (F_DISP9) }, { F (F_RI) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldr14ub = {
-  16, 16, 0xf000, { F (F_OP1), F (F_DISP8), F (F_RI), 0 }
+  16, 16, 0xf000, { { F (F_OP1) }, { F (F_DISP8) }, { F (F_RI) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldr15 = {
-  16, 16, 0xff00, { F (F_OP1), F (F_OP2), F (F_UDISP6), F (F_RI), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_UDISP6) }, { F (F_RI) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldr15dr = {
-  16, 16, 0xfff0, { F (F_OP1), F (F_OP2), F (F_OP3), F (F_RS2), 0 }
+  16, 16, 0xfff0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3) }, { F (F_RS2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_movdr = {
-  16, 16, 0xff00, { F (F_OP1), F (F_OP2), F (F_RS1), F (F_RI), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_RS1) }, { F (F_RI) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_call = {
-  16, 16, 0xf800, { F (F_OP1), F (F_OP5), F (F_REL12), 0 }
+  16, 16, 0xf800, { { F (F_OP1) }, { F (F_OP5) }, { F (F_REL12) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_int = {
-  16, 16, 0xff00, { F (F_OP1), F (F_OP2), F (F_U8), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_U8) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_brad = {
-  16, 16, 0xff00, { F (F_OP1), F (F_CC), F (F_REL9), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_CC) }, { F (F_REL9) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_dmovr13 = {
-  16, 16, 0xff00, { F (F_OP1), F (F_OP2), F (F_DIR10), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_DIR10) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_dmovr13h = {
-  16, 16, 0xff00, { F (F_OP1), F (F_OP2), F (F_DIR9), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_DIR9) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_dmovr13b = {
-  16, 16, 0xff00, { F (F_OP1), F (F_OP2), F (F_DIR8), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_DIR8) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_copop = {
-  16, 32, 0xfff0, { F (F_OP1), F (F_CCC), F (F_OP2), F (F_OP3), F (F_CRJ), F (F_U4C), F (F_CRI), 0 }
+  16, 32, 0xfff0, { { F (F_OP1) }, { F (F_CCC) }, { F (F_OP2) }, { F (F_OP3) }, { F (F_CRJ) }, { F (F_U4C) }, { F (F_CRI) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_copld = {
-  16, 32, 0xfff0, { F (F_OP1), F (F_CCC), F (F_OP2), F (F_OP3), F (F_RJC), F (F_U4C), F (F_CRI), 0 }
+  16, 32, 0xfff0, { { F (F_OP1) }, { F (F_CCC) }, { F (F_OP2) }, { F (F_OP3) }, { F (F_RJC) }, { F (F_U4C) }, { F (F_CRI) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_copst = {
-  16, 32, 0xfff0, { F (F_OP1), F (F_CCC), F (F_OP2), F (F_OP3), F (F_CRJ), F (F_U4C), F (F_RIC), 0 }
+  16, 32, 0xfff0, { { F (F_OP1) }, { F (F_CCC) }, { F (F_OP2) }, { F (F_OP3) }, { F (F_CRJ) }, { F (F_U4C) }, { F (F_RIC) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_addsp = {
-  16, 16, 0xff00, { F (F_OP1), F (F_OP2), F (F_S10), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_S10) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldm0 = {
-  16, 16, 0xff00, { F (F_OP1), F (F_OP2), F (F_REGLIST_LOW_LD), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_REGLIST_LOW_LD) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldm1 = {
-  16, 16, 0xff00, { F (F_OP1), F (F_OP2), F (F_REGLIST_HI_LD), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_REGLIST_HI_LD) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_stm0 = {
-  16, 16, 0xff00, { F (F_OP1), F (F_OP2), F (F_REGLIST_LOW_ST), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_REGLIST_LOW_ST) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_stm1 = {
-  16, 16, 0xff00, { F (F_OP1), F (F_OP2), F (F_REGLIST_HI_ST), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_REGLIST_HI_ST) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_enter = {
-  16, 16, 0xff00, { F (F_OP1), F (F_OP2), F (F_U10), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_U10) }, { 0 } }
 };
 
 #undef F
@@ -175,7 +176,7 @@
   /* Special null first entry.
      A `num' value of zero is thus invalid.
      Also, the special `invalid' insn resides here.  */
-  { { 0 } },
+  { { 0, 0, 0, 0 }, {{0}}, 0, {0}},
 /* add $Rj,$Ri */
   {
     { 0, 0, 0, 0 },
@@ -1178,15 +1179,15 @@
 #define F(f) & fr30_cgen_ifld_table[CONCAT2 (FR30_,f)]
 
 static const CGEN_IFMT ifmt_ldi8m = {
-  16, 16, 0xf000, { F (F_OP1), F (F_I8), F (F_RI), 0 }
+  16, 16, 0xf000, { { F (F_OP1) }, { F (F_I8) }, { F (F_RI) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldi20m = {
-  16, 32, 0xff00, { F (F_OP1), F (F_OP2), F (F_RI), F (F_I20), 0 }
+  16, 32, 0xff00, { { F (F_OP1) }, { F (F_OP2) }, { F (F_RI) }, { F (F_I20) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldi32m = {
-  16, 48, 0xfff0, { F (F_OP1), F (F_OP2), F (F_OP3), F (F_RI), F (F_I32), 0 }
+  16, 48, 0xfff0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_OP3) }, { F (F_RI) }, { F (F_I32) }, { 0 } }
 };
 
 #undef F
diff --git a/opcodes/fr30-opc.h b/opcodes/fr30-opc.h
index d387ed5..4dda89c 100644
--- a/opcodes/fr30-opc.h
+++ b/opcodes/fr30-opc.h
@@ -91,6 +91,7 @@
 {
   int length;
   long f_nil;
+  long f_anyof;
   long f_op1;
   long f_op2;
   long f_op3;
diff --git a/opcodes/h8300-dis.c b/opcodes/h8300-dis.c
index 7afdbc9..61350b0 100644
--- a/opcodes/h8300-dis.c
+++ b/opcodes/h8300-dis.c
@@ -23,7 +23,6 @@
 #include "dis-asm.h"
 #include "opintl.h"
 
-
 /* Run through the opcodes and sort them into order to make them easy
    to disassemble.  */
 static void
@@ -41,7 +40,7 @@
 	n1 = (int) p->data.nib[0];
       else
 	n1 = 0;
-      
+
       if ((int) p->data.nib[1] < 16)
 	n2 = (int) p->data.nib[1];
       else
@@ -50,16 +49,15 @@
       /* Just make sure there are an even number of nibbles in it, and
 	 that the count is the same as the length.  */
       for (i = 0; p->data.nib[i] != E; i++)
-	/*EMPTY*/;
-      
+	;
+
       if (i & 1)
 	abort ();
-      
+
       p->length = i / 2;
     }
 }
 
-
 unsigned int
 bfd_h8_disassemble (addr, info, mode)
      bfd_vma addr;
@@ -89,7 +87,7 @@
   int bit = 0;
   int plen = 0;
   static boolean init = 0;
-  struct h8_opcode *q = h8_opcodes;
+  struct h8_opcode *q;
   char CONST **pregnames = mode != 0 ? lregnames : wregnames;
   int status;
   int l;
@@ -109,25 +107,23 @@
       info->memory_error_func (status, addr, info);
       return -1;
     }
-  
+
   for (l = 2; status == 0 && l < 10; l += 2)
-    status = info->read_memory_func (addr + l, data+l, 2, info);
+    status = info->read_memory_func (addr + l, data + l, 2, info);
 
   /* Find the exact opcode/arg combo.  */
-  while (q->name)
+  for (q = h8_opcodes; q->name; q++)
     {
-      op_type *nib;
+      op_type *nib = q->data.nib;
       unsigned int len = 0;
 
-      nib = q->data.nib;
-      
       while (1)
 	{
 	  op_type looking_for = *nib;
 	  int thisnib = data[len >> 1];
-	  
+
 	  thisnib = (len & 1) ? (thisnib & 0xf) : ((thisnib >> 4) & 0xf);
-	  
+
 	  if (looking_for < 16 && looking_for >= 0)
 	    {
 	      if (looking_for != thisnib)
@@ -137,25 +133,28 @@
 	    {
 	      if ((int) looking_for & (int) B31)
 		{
-		  if (! (((int) thisnib & 0x8) != 0))
+		  if (!(((int) thisnib & 0x8) != 0))
 		    goto fail;
-		  
+
 		  looking_for = (op_type) ((int) looking_for & ~(int) B31);
 		}
-	      
+
 	      if ((int) looking_for & (int) B30)
 		{
 		  if (!(((int) thisnib & 0x8) == 0))
 		    goto fail;
-		  
+
 		  looking_for = (op_type) ((int) looking_for & ~(int) B30);
 		}
 
 	      if (looking_for & DBIT)
 		{
-		  if ((looking_for & 2) != (thisnib & 2))
+		  /* Exclude adds/subs by looking at bit 0 and 2, and
+                     make sure the operand size, either w or l,
+                     matches by looking at bit 1.  */
+		  if ((looking_for & 7) != (thisnib & 7))
 		    goto fail;
-		  
+
 		  abs = (thisnib & 0x8) ? 2 : 1;
 		}
 	      else if (looking_for & (REG | IND | INC | DEC))
@@ -181,18 +180,18 @@
 	      else if (looking_for & L_32)
 		{
 		  int i = len >> 1;
-		  
+
 		  abs = (data[i] << 24)
 		    | (data[i + 1] << 16)
 		    | (data[i + 2] << 8)
-		    | (data[i+ 3]);
+		    | (data[i + 3]);
 
 		  plen = 32;
 		}
 	      else if (looking_for & L_24)
 		{
 		  int i = len >> 1;
-		  
+
 		  abs = (data[i] << 16) | (data[i + 1] << 8) | (data[i + 2]);
 		  plen = 24;
 		}
@@ -245,10 +244,10 @@
 
 		  for (i = 0; i < q->length; i++)
 		    fprintf (stream, "%02x ", data[i]);
-		  
+
 		  for (; i < 6; i++)
 		    fprintf (stream, "   ");
-		  
+
 		  fprintf (stream, "%s\t", q->name);
 
 		  /* Gross.  Disgusting.  */
@@ -282,7 +281,7 @@
 		    while (*args != E)
 		      {
 			int x = *args;
-			
+
 			if (hadone)
 			  fprintf (stream, ",");
 
@@ -301,7 +300,7 @@
 			else if (x & REG)
 			  {
 			    int rn = (x & DST) ? rd : rs;
-			    
+
 			    switch (x & SIZE)
 			      {
 			      case L_8:
@@ -351,20 +350,22 @@
 			      {
 				abs += 2;
 				fprintf (stream,
-					 ".%s%d (%x)", (short) abs > 0 ? "+" : "",
+					 ".%s%d (%x)",
+					 (short) abs > 0 ? "+" : "",
 					 (short) abs, addr + (short) abs + 2);
 			      }
 			    else
 			      {
 				fprintf (stream,
-					 ".%s%d (%x)", (char) abs > 0 ? "+" : "",
+					 ".%s%d (%x)",
+					 (char) abs > 0 ? "+" : "",
 					 (char) abs, addr + (char) abs + 2);
 			      }
 			  }
 			else if (x & DISP)
 			  {
 			    fprintf (stream, "@(0x%x:%d,%s)",
-				     abs,plen, pregnames[rdisp]);
+				     abs, plen, pregnames[rdisp]);
 			  }
 			else if (x & CCR)
 			  {
@@ -377,32 +378,31 @@
 			else
 			  /* xgettext:c-format */
 			  fprintf (stream, _("Hmmmm %x"), x);
-			
+
 			hadone = 1;
 			args++;
 		      }
 		  }
-		  
+
 		  return q->length;
 		}
 	      else
 		/* xgettext:c-format */
 		fprintf (stream, _("Don't understand %x \n"), looking_for);
 	    }
-	  
+
 	  len++;
 	  nib++;
 	}
-      
+
     fail:
-      q++;
+      ;
     }
 
   /* Fell off the end.  */
   fprintf (stream, "%02x %02x        .word\tH'%x,H'%x",
 	   data[0], data[1],
 	   data[0], data[1]);
-  
   return 2;
 }
 
diff --git a/opcodes/h8500-dis.c b/opcodes/h8500-dis.c
index d5e15d4..802827e 100644
--- a/opcodes/h8500-dis.c
+++ b/opcodes/h8500-dis.c
@@ -69,8 +69,7 @@
   return 1;
 }
 
-static char *crname[] =
-{"sr", "ccr", "*", "br", "ep", "dp", "*", "tp"};
+static char *crname[] = { "sr", "ccr", "*", "br", "ep", "dp", "*", "tp" };
 
 int
 print_insn_h8500 (addr, info)
@@ -91,21 +90,22 @@
     /* Error return.  */
     return -1;
 
-if (0)  {
-    static    int one;
-    if (!one ) 
-      {
-	one = 1;
-	for (opcode = h8500_table; opcode->name; opcode++)
-	  {
-	    if ((opcode->bytes[0].contents & 0x8) == 0)
-	      printf("%s\n", opcode->name);
-	  }
-      }
-  }
+  if (0)
+    {
+      static int one;
 
+      if (!one)
+	{
+	  one = 1;
+	  for (opcode = h8500_table; opcode->name; opcode++)
+	    {
+	      if ((opcode->bytes[0].contents & 0x8) == 0)
+		printf ("%s\n", opcode->name);
+	    }
+	}
+    }
 
-  /* Run down the table to find the one which matches */
+  /* Run down the table to find the one which matches.  */
   for (opcode = h8500_table; opcode->name; opcode++)
     {
       int byte;
@@ -119,6 +119,7 @@
       int qim = 0;
       int i;
       int cr = 0;
+
       for (byte = 0; byte < opcode->length; byte++)
 	{
 	  FETCH_DATA (info, buffer + byte + 1);
@@ -129,7 +130,7 @@
 	    }
 	  else
 	    {
-	      /* extract any info parts */
+	      /* Extract any info parts.  */
 	      switch (opcode->bytes[byte].insert)
 		{
 		case 0:
@@ -221,8 +222,8 @@
 		}
 	    }
 	}
-      /* We get here when all the masks have passed so we can output the
-	 operands*/
+      /* We get here when all the masks have passed so we can output
+	 the operands.  */
       FETCH_DATA (info, buffer + opcode->length);
       for (i = 0; i < opcode->length; i++)
 	{
@@ -322,7 +323,8 @@
 	      func (stream, "#0x%0x:8", imm & 0xff);
 	      break;
 	    case PCREL16:
-	      func (stream, "0x%0x:16", (pcrel + addr + opcode->length) & 0xffff);
+	      func (stream, "0x%0x:16",
+		    (pcrel + addr + opcode->length) & 0xffff);
 	      break;
 	    case PCREL8:
 	      func (stream, "#0x%0x:8",
@@ -337,12 +339,12 @@
 	    }
 	}
       return opcode->length;
-    next:;
+    next:
+      ;
     }
 
-  /* Couldn't understand anything */
+  /* Couldn't understand anything.  */
   /* xgettext:c-format */
   func (stream, _("%02x\t\t*unknown*"), buffer[0]);
   return 1;
-
 }
diff --git a/opcodes/hppa-dis.c b/opcodes/hppa-dis.c
index 23c926a..1312bc5 100644
--- a/opcodes/hppa-dis.c
+++ b/opcodes/hppa-dis.c
@@ -1,5 +1,6 @@
 /* Disassembler for the PA-RISC. Somewhat derived from sparc-pinsn.c.
-   Copyright 1989, 1990, 1992, 1993 Free Software Foundation, Inc.
+   Copyright 1989, 90, 92, 93, 94, 95, 98, 99, 2000
+   Free Software Foundation, Inc.
 
    Contributed by the Center for Software Science at the
    University of Utah (pa-gdb-bugs@cs.utah.edu).
@@ -51,11 +52,14 @@
 #define MASK_16 0xffff
 #define MASK_21 0x1fffff
 
-/* This macro gets bit fields using HP's numbering (MSB = 0) */
+/* These macros get bit fields using HP's numbering (MSB = 0) */
 
 #define GET_FIELD(X, FROM, TO) \
   ((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1))
 
+#define GET_BIT(X, WHICH) \
+  GET_FIELD (X, WHICH, WHICH)
+
 /* Some of these have been converted to 2-d arrays because they
    consume less storage this way.  If the maintenance becomes a
    problem, convert them back to const 1-d pointer arrays.  */
@@ -140,6 +144,26 @@
 #define GET_COND(insn) (GET_FIELD ((insn), 16, 18) + \
 			(GET_FIELD ((insn), 19, 19) ? 8 : 0))
 
+static void fput_reg PARAMS ((unsigned int, disassemble_info *));
+static void fput_fp_reg PARAMS ((unsigned int, disassemble_info *));
+static void fput_fp_reg_r PARAMS ((unsigned int, disassemble_info *));
+static void fput_creg PARAMS ((unsigned int, disassemble_info *));
+static void fput_const PARAMS ((unsigned int, disassemble_info *));
+static int extract_3 PARAMS ((unsigned int));
+static int extract_5_load PARAMS ((unsigned int));
+static int extract_5_store PARAMS ((unsigned int));
+static unsigned extract_5r_store PARAMS ((unsigned int));
+static unsigned extract_5R_store PARAMS ((unsigned int));
+static unsigned extract_10U_store PARAMS ((unsigned int));
+static unsigned extract_5Q_store PARAMS ((unsigned int));
+static int extract_11 PARAMS ((unsigned int));
+static int extract_14 PARAMS ((unsigned int));
+static int extract_16 PARAMS ((unsigned int));
+static int extract_21 PARAMS ((unsigned int));
+static int extract_12 PARAMS ((unsigned int));
+static int extract_17 PARAMS ((unsigned int));
+static int extract_22 PARAMS ((unsigned int));
+
 /* Utility function to print registers.  Put these first, so gcc's function
    inlining can do its stuff.  */
 
@@ -690,9 +714,9 @@
 
 		    case 'J':
 		      {
-			int opcode = GET_FIELD (insn, 0, 5);
+			int opc = GET_FIELD (insn, 0, 5);
 
-			if (opcode == 0x16 || opcode == 0x1e)
+			if (opc == 0x16 || opc == 0x1e)
 			  {
 			    if (GET_FIELD (insn, 29, 29) == 0)
 			      fputs_filtered (",ma ", info);
@@ -706,16 +730,16 @@
 
 		    case 'e':
 		      {
-			int opcode = GET_FIELD (insn, 0, 5);
+			int opc = GET_FIELD (insn, 0, 5);
 
-			if (opcode == 0x13 || opcode == 0x1b)
+			if (opc == 0x13 || opc == 0x1b)
 			  {
 			    if (GET_FIELD (insn, 18, 18) == 1)
 			      fputs_filtered (",mb ", info);
 			    else
 			      fputs_filtered (",ma ", info);
 			  }
-			else if (opcode == 0x17 || opcode == 0x1f)
+			else if (opc == 0x17 || opc == 0x1f)
 			  {
 			    if (GET_FIELD (insn, 31, 31) == 1)
 			      fputs_filtered (",ma ", info);
diff --git a/opcodes/i860-dis.c b/opcodes/i860-dis.c
new file mode 100644
index 0000000..ba183ab
--- /dev/null
+++ b/opcodes/i860-dis.c
@@ -0,0 +1,288 @@
+/* Disassembler for the i860.
+   Copyright 2000 Free Software Foundation, Inc.
+
+   Contributed by Jason Eckhardt <jle@cygnus.com>.
+
+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 "dis-asm.h"
+#include "opcode/i860.h"
+
+/* Later we should probably choose the prefix based on which OS flavor.  */
+#define I860_REG_PREFIX "%"
+
+/* Integer register names (encoded as 0..31 in the instruction).  */
+static const char *const grnames[] = 
+ {"r0",  "r1",  "sp",  "fp",  "r4",  "r5",  "r6",  "r7",
+  "r8",  "r9",  "r10", "r11", "r12", "r13", "r14", "r15",
+  "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+  "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"};
+
+/* FP register names (encoded as 0..31 in the instruction).  */
+static const char *const frnames[] = 
+ {"f0",  "f1",  "f2",  "f3",  "f4",  "f5",  "f6",  "f7",
+  "f8",  "f9",  "f10", "f11", "f12", "f13", "f14", "f15",
+  "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
+  "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"};
+
+/* Control/status register names (encoded as 0..5 in the instruction).  */
+static const char *const crnames[] = 
+ {"fir", "psr", "dirbase", "db", "fsr", "epsr", "", ""};
+
+
+/* Prototypes.  */
+static int sign_ext		PARAMS((unsigned int, int)); 
+static void print_br_address	PARAMS((disassemble_info *, bfd_vma, long));
+
+
+/* True if opcode is xor, xorh, and, andh, or, orh, andnot, andnoth.  */
+#define BITWISE_OP(op)  ((op) == 0x30 || (op) == 0x31		\
+			 || (op) == 0x34 || (op) == 0x35	\
+			 || (op) == 0x38 || (op) == 0x39	\
+			 || (op) == 0x3c || (op) == 0x3d	\
+			 || (op) == 0x33 || (op) == 0x37	\
+			 || (op) == 0x3b || (op) == 0x3f)
+
+
+/* Sign extend N-bit number.  */
+static int
+sign_ext (x, n)
+     unsigned int x;
+     int n;
+{
+  int t;
+  t = x >> (n - 1);
+  t = ((-t) << n) | x;
+  return t;
+}
+
+
+/* Print a PC-relative branch offset.  VAL is the sign extended value
+   from the branch instruction.  */
+static void
+print_br_address (info, memaddr, val)
+     disassemble_info *info;
+     bfd_vma memaddr;
+     long val;
+{
+
+  long adj = (long)memaddr + 4 + (val << 2);
+
+  (*info->fprintf_func) (info->stream, "0x%08x", adj);
+	    
+  /* Attempt to obtain a symbol for the target address.  */
+	
+  if (info->print_address_func && adj != 0)
+    {
+      (*info->fprintf_func) (info->stream, "\t// ");
+      (*info->print_address_func) (adj, info);
+    }
+}
+
+
+/* Print one instruction.  */
+int
+print_insn_i860 (memaddr, info)
+     bfd_vma memaddr;
+     disassemble_info *info;
+{
+  bfd_byte buff[4];
+  unsigned int insn, i;
+  int status;
+  const struct i860_opcode *opcode = 0;
+
+  status = (*info->read_memory_func) (memaddr, buff, sizeof (buff), info);
+  if (status != 0)
+    {
+      (*info->memory_error_func) (status, memaddr, info);
+      return -1;
+    }
+
+  /* Note that i860 instructions are always accessed as little endian
+     data, regardless of the endian mode of the i860.  */
+  insn = bfd_getl32 (buff);
+
+  status = 0;
+  i = 0;
+  while (i860_opcodes[i].name != NULL)
+    {
+      opcode = &i860_opcodes[i];
+      if ((insn & opcode->match) == opcode->match
+	  && (insn & opcode->lose) == 0)
+	{
+	  status = 1;
+	  break;
+	}
+      ++i;
+    }
+
+  if (status == 0)
+    {
+      /* Instruction not in opcode table.  */
+      (*info->fprintf_func) (info->stream, ".long %#08x", insn);
+    }
+  else
+    {
+      const char *s;
+      int val;
+
+      /* If this a flop and its dual bit is set, prefix with 'd.'.  */ 	
+      if ((insn & 0xfc000000) == 0x48000000 && (insn & 0x200))
+	(*info->fprintf_func) (info->stream, "d.%s\t", opcode->name);
+      else
+	(*info->fprintf_func) (info->stream, "%s\t", opcode->name);
+
+      for (s = opcode->args; *s; s++)
+	{
+	  switch (*s)
+	    {
+	    /* Integer register (src1).  */
+	    case '1':
+	      (*info->fprintf_func) (info->stream, "%s%s", I860_REG_PREFIX,
+				     grnames[(insn >> 11) & 0x1f]);
+	      break;
+
+	    /* Integer register (src2).  */
+	    case '2':
+	      (*info->fprintf_func) (info->stream, "%s%s", I860_REG_PREFIX,
+				     grnames[(insn >> 21) & 0x1f]);
+	      break;
+
+	    /* Integer destination register.  */
+	    case 'd':
+	      (*info->fprintf_func) (info->stream, "%s%s", I860_REG_PREFIX,
+				     grnames[(insn >> 16) & 0x1f]);
+	      break;
+
+	    /* Floating-point register (src1).  */
+	    case 'e':
+	      (*info->fprintf_func) (info->stream, "%s%s", I860_REG_PREFIX,
+				     frnames[(insn >> 11) & 0x1f]);
+	      break;
+
+	    /* Floating-point register (src2).  */
+	    case 'f':
+	      (*info->fprintf_func) (info->stream, "%s%s", I860_REG_PREFIX,
+				     frnames[(insn >> 21) & 0x1f]);
+	      break;
+
+	    /* Floating-point destination register.  */
+	    case 'g':
+	      (*info->fprintf_func) (info->stream, "%s%s", I860_REG_PREFIX,
+				     frnames[(insn >> 16) & 0x1f]);
+	      break;
+
+	    /* Control register.  */
+	    case 'c':
+	      (*info->fprintf_func) (info->stream, "%s%s", I860_REG_PREFIX,
+				     crnames[(insn >> 21) & 0x7]);
+	      break;
+
+	    /* 16-bit immediate (sign extend, except for bitwise ops).  */
+	    case 'i':
+	      if (BITWISE_OP ((insn & 0xfc000000) >> 26))
+		(*info->fprintf_func) (info->stream, "0x%04x",
+				       (unsigned int) (insn & 0xffff));
+	      else
+		(*info->fprintf_func) (info->stream, "%d",
+				       sign_ext ((insn & 0xffff), 16));
+	      break;
+
+	    /* 16-bit immediate, aligned (2^0, ld.b).  */
+	    case 'I':
+	      (*info->fprintf_func) (info->stream, "%d",
+				     sign_ext ((insn & 0xffff), 16));
+	      break;
+
+	    /* 16-bit immediate, aligned (2^1, ld.s).  */
+	    case 'J':
+	      (*info->fprintf_func) (info->stream, "%d",
+				     sign_ext ((insn & 0xfffe), 16));
+	      break;
+
+	    /* 16-bit immediate, aligned (2^2, ld.l, {p}fld.l, fst.l).  */
+	    case 'K':
+	      (*info->fprintf_func) (info->stream, "%d",
+				     sign_ext ((insn & 0xfffc), 16));
+	      break;
+
+	    /* 16-bit immediate, aligned (2^3, {p}fld.d, fst.d).  */
+	    case 'L':
+	      (*info->fprintf_func) (info->stream, "%d",
+				     sign_ext ((insn & 0xfff8), 16));
+	      break;
+
+	    /* 16-bit immediate, aligned (2^4, {p}fld.q, fst.q).  */
+	    case 'M':
+	      (*info->fprintf_func) (info->stream, "%d",
+				     sign_ext ((insn & 0xfff0), 16));
+	      break;
+
+	    /* 5-bit immediate (zero extend).  */
+	    case '5':
+	      (*info->fprintf_func) (info->stream, "%d",
+				     ((insn >> 11) & 0x1f));
+	      break;
+
+	    /* Split 16 bit immediate (20..16:10..0).  */
+	    case 's':
+	      val = ((insn >> 5) & 0xf800) | (insn & 0x07ff);
+	      (*info->fprintf_func) (info->stream, "%d",
+				     sign_ext (val, 16));
+	      break;
+
+	    /* Split 16 bit immediate, aligned. (2^0, st.b).  */
+	    case 'S':
+	      val = ((insn >> 5) & 0xf800) | (insn & 0x07ff);
+	      (*info->fprintf_func) (info->stream, "%d",
+				     sign_ext (val, 16));
+	      break;
+
+	    /* Split 16 bit immediate, aligned. (2^1, st.s).  */
+	    case 'T':
+	      val = ((insn >> 5) & 0xf800) | (insn & 0x07fe);
+	      (*info->fprintf_func) (info->stream, "%d",
+				     sign_ext (val, 16));
+	      break;
+
+	    /* Split 16 bit immediate, aligned. (2^2, st.l).  */
+	    case 'U':
+	      val = ((insn >> 5) & 0xf800) | (insn & 0x07fc);
+	      (*info->fprintf_func) (info->stream, "%d",
+				     sign_ext (val, 16));
+	      break;
+
+	    /* 26-bit PC relative immediate (lbroff).  */
+	    case 'l':
+	      val = sign_ext ((insn & 0x03ffffff), 26);
+	      print_br_address (info, memaddr, val);
+	      break;
+
+	    /* 16-bit PC relative immediate (sbroff).  */
+	    case 'r':
+	      val = sign_ext ((((insn >> 5) & 0xf800) | (insn & 0x07ff)), 16);
+	      print_br_address (info, memaddr, val);
+	      break;
+
+	    default:
+	      (*info->fprintf_func) (info->stream, "%c", *s);
+	      break;
+	    }
+	}
+    }
+
+  return sizeof (insn);
+}
+
diff --git a/opcodes/ia64-asmtab.c b/opcodes/ia64-asmtab.c
index 4bad1c4..52ebb1d 100644
--- a/opcodes/ia64-asmtab.c
+++ b/opcodes/ia64-asmtab.c
@@ -11,1446 +11,1661 @@
   "fmix", "fmpy", "fms", "fneg", "fnegabs", "fnma", "fnmpy", "fnorm", "for",
   "fpabs", "fpack", "fpamax", "fpamin", "fpcmp", "fpcvt", "fpma", "fpmax",
   "fpmerge", "fpmin", "fpmpy", "fpms", "fpneg", "fpnegabs", "fpnma",
-  "fpnmpy", "fprcpa", "fprsqrta", "fpsub", "frcpa", "frsqrta", "fselect",
-  "fsetc", "fsub", "fswap", "fsxt", "fwb", "fx", "fxor", "fxu", "g", "ga",
-  "ge", "getf", "geu", "gt", "gtu", "h", "hu", "i", "ia", "imp", "invala",
-  "itc", "itr", "l", "ld1", "ld2", "ld4", "ld8", "ldf", "ldf8", "ldfd",
-  "ldfe", "ldfp8", "ldfpd", "ldfps", "ldfs", "le", "leu", "lfetch",
-  "loadrs", "loop", "lr", "lt", "ltu", "lu", "m", "many", "mf", "mix1",
-  "mix2", "mix4", "mov", "movl", "mux1", "mux2", "nc", "ne", "neq", "nge",
-  "ngt", "nl", "nle", "nlt", "nm", "nop", "nr", "ns", "nt1", "nt2", "nta",
-  "nz", "or", "orcm", "ord", "pack2", "pack4", "padd1", "padd2", "padd4",
-  "pavg1", "pavg2", "pavgsub1", "pavgsub2", "pcmp1", "pcmp2", "pcmp4",
-  "pmax1", "pmax2", "pmin1", "pmin2", "pmpy2", "pmpyshr2", "popcnt", "pr",
-  "probe", "psad1", "pshl2", "pshl4", "pshladd2", "pshr2", "pshr4",
-  "pshradd2", "psub1", "psub2", "psub4", "ptc", "ptr", "r", "raz", "rel",
-  "ret", "rfi", "rsm", "rum", "rw", "s", "s0", "s1", "s2", "s3", "sa", "se",
-  "setf", "shl", "shladd", "shladdp4", "shr", "shrp", "sig", "spill",
-  "spnt", "sptk", "srlz", "ssm", "sss", "st1", "st2", "st4", "st8", "stf",
-  "stf8", "stfd", "stfe", "stfs", "sub", "sum", "sxt1", "sxt2", "sxt4",
-  "sync", "tak", "tbit", "thash", "tnat", "tpa", "trunc", "ttag", "u",
-  "unc", "unord", "unpack1", "unpack2", "unpack4", "uss", "uus", "uuu", "w",
+  "fpnmpy", "fprcpa", "fprsqrta", "frcpa", "frsqrta", "fselect", "fsetc",
+  "fsub", "fswap", "fsxt", "fwb", "fx", "fxor", "fxu", "g", "ga", "ge",
+  "getf", "geu", "gt", "gtu", "h", "hu", "i", "ia", "imp", "invala", "itc",
+  "itr", "l", "ld1", "ld2", "ld4", "ld8", "ldf", "ldf8", "ldfd", "ldfe",
+  "ldfp8", "ldfpd", "ldfps", "ldfs", "le", "leu", "lfetch", "loadrs",
+  "loop", "lr", "lt", "ltu", "lu", "m", "many", "mf", "mix1", "mix2",
+  "mix4", "mov", "movl", "mux1", "mux2", "nc", "ne", "neq", "nge", "ngt",
+  "nl", "nle", "nlt", "nm", "nop", "nr", "ns", "nt1", "nt2", "nta", "nz",
+  "or", "orcm", "ord", "pack2", "pack4", "padd1", "padd2", "padd4", "pavg1",
+  "pavg2", "pavgsub1", "pavgsub2", "pcmp1", "pcmp2", "pcmp4", "pmax1",
+  "pmax2", "pmin1", "pmin2", "pmpy2", "pmpyshr2", "popcnt", "pr", "probe",
+  "psad1", "pshl2", "pshl4", "pshladd2", "pshr2", "pshr4", "pshradd2",
+  "psub1", "psub2", "psub4", "ptc", "ptr", "r", "raz", "rel", "ret", "rfi",
+  "rsm", "rum", "rw", "s", "s0", "s1", "s2", "s3", "sa", "se", "setf",
+  "shl", "shladd", "shladdp4", "shr", "shrp", "sig", "spill", "spnt",
+  "sptk", "srlz", "ssm", "sss", "st1", "st2", "st4", "st8", "stf", "stf8",
+  "stfd", "stfe", "stfs", "sub", "sum", "sxt1", "sxt2", "sxt4", "sync",
+  "tak", "tbit", "thash", "tnat", "tpa", "trunc", "ttag", "u", "unc",
+  "unord", "unpack1", "unpack2", "unpack4", "uss", "uus", "uuu", "w",
   "wexit", "wtop", "x", "xchg1", "xchg2", "xchg4", "xchg8", "xf", "xma",
   "xmpy", "xor", "xuf", "z", "zxt1", "zxt2", "zxt4",
 };
 
 static const struct ia64_dependency
 dependencies[] = {
-  { "ALAT", 0, 0, 0, -1, },
-  { "AR[BSP]", 25, 0, 2, 17, },
-  { "AR[BSPSTORE]", 25, 0, 2, 18, },
-  { "AR[CCV]", 25, 0, 2, 32, },
-  { "AR[EC]", 25, 0, 2, 66, },
-  { "AR[FPSR].sf0.controls", 29, 0, 2, -1, },
-  { "AR[FPSR].sf1.controls", 29, 0, 2, -1, },
-  { "AR[FPSR].sf2.controls", 29, 0, 2, -1, },
-  { "AR[FPSR].sf3.controls", 29, 0, 2, -1, },
-  { "AR[FPSR].sf0.flags", 29, 0, 2, -1, },
-  { "AR[FPSR].sf1.flags", 29, 0, 2, -1, },
-  { "AR[FPSR].sf2.flags", 29, 0, 2, -1, },
-  { "AR[FPSR].sf3.flags", 29, 0, 2, -1, },
-  { "AR[FPSR].traps", 29, 0, 2, -1, },
-  { "AR[FPSR].rv", 29, 0, 2, -1, },
-  { "AR[ITC]", 25, 0, 2, 44, },
-  { "AR[K%], % in 0 - 7", 1, 0, 2, -1, },
-  { "AR[LC]", 25, 0, 2, 65, },
-  { "AR[PFS]", 25, 0, 2, 64, },
-  { "AR[PFS]", 25, 0, 2, 64, },
-  { "AR[PFS]", 25, 0, 0, 64, },
-  { "AR[RNAT]", 25, 0, 2, 19, },
-  { "AR[RSC]", 25, 0, 2, 16, },
-  { "AR[UNAT]{%}, % in 0 - 63", 2, 0, 2, -1, },
-  { "AR%, % in 8-15, 20, 22-23, 31, 33-35, 37-39, 41-43, 45-47, 67-111", 3, 0, 0, -1, },
-  { "AR%, % in 48-63, 112-127", 4, 0, 2, -1, },
-  { "BR%, % in 0 - 7", 5, 0, 2, -1, },
-  { "BR%, % in 0 - 7", 5, 0, 0, -1, },
-  { "BR%, % in 0 - 7", 5, 0, 2, -1, },
-  { "CFM", 6, 0, 2, -1, },
-  { "CFM", 6, 0, 2, -1, },
-  { "CFM", 6, 0, 2, -1, },
-  { "CFM", 6, 0, 2, -1, },
-  { "CFM", 6, 0, 0, -1, },
-  { "CPUID#", 7, 0, 5, -1, },
-  { "CR[CMCV]", 26, 0, 3, 74, },
-  { "CR[DCR]", 26, 0, 3, 0, },
-  { "CR[EOI]", 26, 0, 6, 67, "SC Section 10.8.3.4", },
-  { "CR[GPTA]", 26, 0, 3, 9, },
-  { "CR[IFA]", 26, 0, 1, 20, },
-  { "CR[IFA]", 26, 0, 3, 20, },
-  { "CR[IFS]", 26, 0, 3, 23, },
-  { "CR[IFS]", 26, 0, 1, 23, },
-  { "CR[IFS]", 26, 0, 1, 23, },
-  { "CR[IHA]", 26, 0, 3, 25, },
-  { "CR[IIM]", 26, 0, 3, 24, },
-  { "CR[IIP]", 26, 0, 3, 19, },
-  { "CR[IIP]", 26, 0, 1, 19, },
-  { "CR[IIPA]", 26, 0, 3, 22, },
-  { "CR[IPSR]", 26, 0, 3, 16, },
-  { "CR[IPSR]", 26, 0, 1, 16, },
-  { "CR[IRR%], % in 0 - 3", 8, 0, 3, -1, },
-  { "CR[ISR]", 26, 0, 3, 17, },
-  { "CR[ITIR]", 26, 0, 3, 21, },
-  { "CR[ITIR]", 26, 0, 1, 21, },
-  { "CR[ITM]", 26, 0, 3, 1, },
-  { "CR[ITV]", 26, 0, 3, 72, },
-  { "CR[IVA]", 26, 0, 4, 2, },
-  { "CR[IVR]", 26, 0, 6, 65, "SC Section 10.8.3.2", },
-  { "CR[LID]", 26, 0, 6, 64, "SC Section 10.8.3.1", },
-  { "CR[LRR%], % in 0 - 1", 9, 0, 3, -1, },
-  { "CR[PMV]", 26, 0, 3, 73, },
-  { "CR[PTA]", 26, 0, 3, 8, },
-  { "CR[TPR]", 26, 0, 3, 66, },
-  { "CR[TPR]", 26, 0, 6, 66, "SC Section 10.8.3.3", },
-  { "CR%, % in 3-7, 10-15, 18, 26-63, 75-79, 82-127", 10, 0, 0, -1, },
-  { "DBR#", 11, 0, 2, -1, },
-  { "DBR#", 11, 0, 3, -1, },
-  { "DTC", 0, 0, 3, -1, },
-  { "DTC", 0, 0, 2, -1, },
-  { "DTC", 0, 0, 0, -1, },
-  { "DTC", 0, 0, 2, -1, },
-  { "DTC_LIMIT*", 0, 0, 2, -1, },
-  { "DTR", 0, 0, 3, -1, },
-  { "DTR", 0, 0, 2, -1, },
-  { "DTR", 0, 0, 3, -1, },
-  { "DTR", 0, 0, 0, -1, },
-  { "DTR", 0, 0, 2, -1, },
-  { "FR%, % in 0 - 1", 12, 0, 0, -1, },
-  { "FR%, % in 2 - 127", 13, 0, 2, -1, },
-  { "FR%, % in 2 - 127", 13, 0, 0, -1, },
-  { "GR0", 14, 0, 0, -1, },
-  { "GR%, % in 1 - 127", 15, 0, 0, -1, },
-  { "GR%, % in 1 - 127", 15, 0, 2, -1, },
-  { "IBR#", 16, 0, 2, -1, },
-  { "InService*", 17, 0, 3, -1, },
-  { "InService*", 17, 0, 2, -1, },
-  { "InService*", 17, 0, 2, -1, },
-  { "IP", 0, 0, 0, -1, },
-  { "ITC", 0, 0, 4, -1, },
-  { "ITC", 0, 0, 2, -1, },
-  { "ITC", 0, 0, 0, -1, },
-  { "ITC", 0, 0, 4, -1, },
-  { "ITC", 0, 0, 2, -1, },
-  { "ITC_LIMIT*", 0, 0, 2, -1, },
-  { "ITR", 0, 0, 2, -1, },
-  { "ITR", 0, 0, 4, -1, },
-  { "ITR", 0, 0, 2, -1, },
-  { "ITR", 0, 0, 0, -1, },
-  { "ITR", 0, 0, 4, -1, },
-  { "memory", 0, 0, 0, -1, },
-  { "MSR#", 18, 0, 5, -1, },
-  { "PKR#", 19, 0, 3, -1, },
-  { "PKR#", 19, 0, 0, -1, },
-  { "PKR#", 19, 0, 2, -1, },
-  { "PKR#", 19, 0, 2, -1, },
-  { "PMC#", 20, 0, 2, -1, },
-  { "PMC#", 20, 0, 6, -1, "SC+3 Section 12.1.1", },
-  { "PMD#", 21, 0, 2, -1, },
-  { "PR0", 0, 0, 0, -1, },
-  { "PR%, % in 1 - 62", 22, 0, 2, -1, },
-  { "PR%, % in 1 - 62", 22, 0, 2, -1, },
-  { "PR%, % in 1 - 62", 22, 0, 0, -1, },
-  { "PR63", 23, 0, 2, -1, },
-  { "PR63", 23, 0, 2, -1, },
-  { "PR63", 23, 0, 0, -1, },
-  { "PSR.ac", 27, 0, 1, 3, },
-  { "PSR.ac", 27, 0, 3, 3, },
-  { "PSR.ac", 27, 0, 2, 3, },
-  { "PSR.be", 27, 0, 1, 1, },
-  { "PSR.be", 27, 0, 3, 1, },
-  { "PSR.be", 27, 0, 2, 1, },
-  { "PSR.bn", 27, 0, 2, 44, },
-  { "PSR.cpl", 27, 0, 1, 32, },
-  { "PSR.da", 27, 0, 3, 38, },
-  { "PSR.db", 27, 0, 3, 24, },
-  { "PSR.db", 27, 0, 2, 24, },
-  { "PSR.db", 27, 0, 3, 24, },
-  { "PSR.dd", 27, 0, 3, 39, },
-  { "PSR.dfh", 27, 0, 3, 19, },
-  { "PSR.dfh", 27, 0, 2, 19, },
-  { "PSR.dfl", 27, 0, 3, 18, },
-  { "PSR.dfl", 27, 0, 2, 18, },
-  { "PSR.di", 27, 0, 3, 22, },
-  { "PSR.di", 27, 0, 2, 22, },
-  { "PSR.dt", 27, 0, 3, 17, },
-  { "PSR.dt", 27, 0, 2, 17, },
-  { "PSR.ed", 27, 0, 3, 43, },
-  { "PSR.i", 27, 0, 2, 14, },
-  { "PSR.i", 27, 0, 3, 14, },
-  { "PSR.ia", 27, 0, 0, 14, },
-  { "PSR.ic", 27, 0, 2, 13, },
-  { "PSR.ic", 27, 0, 3, 13, },
-  { "PSR.id", 27, 0, 0, 14, },
-  { "PSR.is", 27, 0, 0, 14, },
-  { "PSR.it", 27, 0, 3, 14, },
-  { "PSR.lp", 27, 0, 2, 25, },
-  { "PSR.lp", 27, 0, 3, 25, },
-  { "PSR.lp", 27, 0, 3, 25, },
-  { "PSR.mc", 27, 0, 0, 35, },
-  { "PSR.mfh", 27, 0, 2, 5, },
-  { "PSR.mfl", 27, 0, 2, 4, },
-  { "PSR.pk", 27, 0, 3, 15, },
-  { "PSR.pk", 27, 0, 2, 15, },
-  { "PSR.pp", 27, 0, 2, 21, },
-  { "PSR.ri", 27, 0, 0, 41, },
-  { "PSR.rt", 27, 0, 2, 27, },
-  { "PSR.rt", 27, 0, 3, 27, },
-  { "PSR.rt", 27, 0, 3, 27, },
-  { "PSR.si", 27, 0, 2, 23, },
-  { "PSR.si", 27, 0, 3, 23, },
-  { "PSR.sp", 27, 0, 2, 20, },
-  { "PSR.sp", 27, 0, 3, 20, },
-  { "PSR.ss", 27, 0, 3, 40, },
-  { "PSR.tb", 27, 0, 3, 26, },
-  { "PSR.tb", 27, 0, 2, 26, },
-  { "PSR.up", 27, 0, 2, 2, },
-  { "RR#", 24, 0, 3, -1, },
-  { "RR#", 24, 0, 2, -1, },
-  { "RSE", 28, 0, 2, -1, },
-  { "ALAT", 0, 1, 0, -1, },
-  { "AR[BSP]", 25, 1, 2, 17, },
-  { "AR[BSPSTORE]", 25, 1, 2, 18, },
-  { "AR[CCV]", 25, 1, 2, 32, },
-  { "AR[EC]", 25, 1, 2, 66, },
-  { "AR[FPSR].sf0.controls", 29, 1, 2, -1, },
-  { "AR[FPSR].sf1.controls", 29, 1, 2, -1, },
-  { "AR[FPSR].sf2.controls", 29, 1, 2, -1, },
-  { "AR[FPSR].sf3.controls", 29, 1, 2, -1, },
-  { "AR[FPSR].sf0.flags", 29, 1, 0, -1, },
-  { "AR[FPSR].sf0.flags", 29, 1, 2, -1, },
-  { "AR[FPSR].sf0.flags", 29, 1, 2, -1, },
-  { "AR[FPSR].sf1.flags", 29, 1, 0, -1, },
-  { "AR[FPSR].sf1.flags", 29, 1, 2, -1, },
-  { "AR[FPSR].sf1.flags", 29, 1, 2, -1, },
-  { "AR[FPSR].sf2.flags", 29, 1, 0, -1, },
-  { "AR[FPSR].sf2.flags", 29, 1, 2, -1, },
-  { "AR[FPSR].sf2.flags", 29, 1, 2, -1, },
-  { "AR[FPSR].sf3.flags", 29, 1, 0, -1, },
-  { "AR[FPSR].sf3.flags", 29, 1, 2, -1, },
-  { "AR[FPSR].sf3.flags", 29, 1, 2, -1, },
-  { "AR[FPSR].rv", 29, 1, 2, -1, },
-  { "AR[FPSR].traps", 29, 1, 2, -1, },
-  { "AR[ITC]", 25, 1, 2, 44, },
-  { "AR[K%], % in 0 - 7", 1, 1, 2, -1, },
-  { "AR[LC]", 25, 1, 2, 65, },
-  { "AR[PFS]", 25, 1, 0, 64, },
-  { "AR[PFS]", 25, 1, 2, 64, },
-  { "AR[PFS]", 25, 1, 2, 64, },
-  { "AR[RNAT]", 25, 1, 2, 19, },
-  { "AR[RSC]", 25, 1, 2, 16, },
-  { "AR[UNAT]{%}, % in 0 - 63", 2, 1, 2, -1, },
-  { "AR%, % in 8-15, 20, 22-23, 31, 33-35, 37-39, 41-43, 45-47, 67-111", 3, 1, 0, -1, },
-  { "AR%, % in 48 - 63, 112-127", 4, 1, 2, -1, },
-  { "BR%, % in 0 - 7", 5, 1, 2, -1, },
-  { "BR%, % in 0 - 7", 5, 1, 2, -1, },
-  { "BR%, % in 0 - 7", 5, 1, 2, -1, },
-  { "BR%, % in 0 - 7", 5, 1, 0, -1, },
-  { "CFM", 6, 1, 2, -1, },
-  { "CPUID#", 7, 1, 0, -1, },
-  { "CR[CMCV]", 26, 1, 2, 74, },
-  { "CR[DCR]", 26, 1, 2, 0, },
-  { "CR[EOI]", 26, 1, 6, 67, "SC Section 10.8.3.4", },
-  { "CR[GPTA]", 26, 1, 2, 9, },
-  { "CR[IFA]", 26, 1, 2, 20, },
-  { "CR[IFS]", 26, 1, 2, 23, },
-  { "CR[IHA]", 26, 1, 2, 25, },
-  { "CR[IIM]", 26, 1, 2, 24, },
-  { "CR[IIP]", 26, 1, 2, 19, },
-  { "CR[IIPA]", 26, 1, 2, 22, },
-  { "CR[IPSR]", 26, 1, 2, 16, },
-  { "CR[IRR%], % in 0 - 3", 8, 1, 2, -1, },
-  { "CR[ISR]", 26, 1, 2, 17, },
-  { "CR[ITIR]", 26, 1, 2, 21, },
-  { "CR[ITM]", 26, 1, 2, 1, },
-  { "CR[ITV]", 26, 1, 2, 72, },
-  { "CR[IVA]", 26, 1, 2, 2, },
-  { "CR[IVR]", 26, 1, 6, 65, "SC", },
-  { "CR[LID]", 26, 1, 6, 64, "SC", },
-  { "CR[LRR%], % in 0 - 1", 9, 1, 2, -1, },
-  { "CR[PMV]", 26, 1, 2, 73, },
-  { "CR[PTA]", 26, 1, 2, 8, },
-  { "CR[TPR]", 26, 1, 2, 66, },
-  { "CR%, % in 3-7, 10-15, 18, 26-63, 75-79, 82-127", 10, 1, 0, -1, },
-  { "DBR#", 11, 1, 2, -1, },
-  { "DTC", 0, 1, 0, -1, },
-  { "DTC", 0, 1, 2, -1, },
-  { "DTC", 0, 1, 2, -1, },
-  { "DTC_LIMIT*", 0, 1, 2, -1, },
-  { "DTR", 0, 1, 2, -1, },
-  { "DTR", 0, 1, 2, -1, },
-  { "DTR", 0, 1, 2, -1, },
-  { "DTR", 0, 1, 0, -1, },
-  { "FR%, % in 0 - 1", 12, 1, 0, -1, },
-  { "FR%, % in 2 - 127", 13, 1, 2, -1, },
-  { "GR0", 14, 1, 0, -1, },
-  { "GR%, % in 1 - 127", 15, 1, 2, -1, },
-  { "IBR#", 16, 1, 2, -1, },
-  { "InService*", 17, 1, 6, -1, "SC", },
-  { "IP", 0, 1, 0, -1, },
-  { "ITC", 0, 1, 0, -1, },
-  { "ITC", 0, 1, 2, -1, },
-  { "ITC", 0, 1, 2, -1, },
-  { "ITR", 0, 1, 2, -1, },
-  { "ITR", 0, 1, 2, -1, },
-  { "ITR", 0, 1, 0, -1, },
-  { "memory", 0, 1, 0, -1, },
-  { "MSR#", 18, 1, 6, -1, "SC", },
-  { "PKR#", 19, 1, 0, -1, },
-  { "PKR#", 19, 1, 0, -1, },
-  { "PKR#", 19, 1, 2, -1, },
-  { "PMC#", 20, 1, 2, -1, },
-  { "PMD#", 21, 1, 2, -1, },
-  { "PR0", 0, 1, 0, -1, },
-  { "PR%, % in 1 - 62", 22, 1, 0, -1, },
-  { "PR%, % in 1 - 62", 22, 1, 0, -1, },
-  { "PR%, % in 1 - 62", 22, 1, 2, -1, },
-  { "PR%, % in 1 - 62", 22, 1, 2, -1, },
-  { "PR63", 23, 1, 0, -1, },
-  { "PR63", 23, 1, 0, -1, },
-  { "PR63", 23, 1, 2, -1, },
-  { "PR63", 23, 1, 2, -1, },
-  { "PSR.ac", 27, 1, 2, 3, },
-  { "PSR.be", 27, 1, 2, 1, },
-  { "PSR.bn", 27, 1, 2, 44, },
-  { "PSR.cpl", 27, 1, 2, 32, },
-  { "PSR.da", 27, 1, 2, 38, },
-  { "PSR.db", 27, 1, 2, 24, },
-  { "PSR.dd", 27, 1, 2, 39, },
-  { "PSR.dfh", 27, 1, 2, 19, },
-  { "PSR.dfl", 27, 1, 2, 18, },
-  { "PSR.di", 27, 1, 2, 22, },
-  { "PSR.dt", 27, 1, 2, 17, },
-  { "PSR.ed", 27, 1, 2, 43, },
-  { "PSR.i", 27, 1, 2, 14, },
-  { "PSR.ia", 27, 1, 2, 14, },
-  { "PSR.ic", 27, 1, 2, 13, },
-  { "PSR.id", 27, 1, 2, 14, },
-  { "PSR.is", 27, 1, 2, 14, },
-  { "PSR.it", 27, 1, 2, 14, },
-  { "PSR.lp", 27, 1, 2, 25, },
-  { "PSR.mc", 27, 1, 2, 35, },
-  { "PSR.mfh", 27, 1, 0, 5, },
-  { "PSR.mfh", 27, 1, 2, 5, },
-  { "PSR.mfh", 27, 1, 2, 5, },
-  { "PSR.mfl", 27, 1, 0, 4, },
-  { "PSR.mfl", 27, 1, 2, 4, },
-  { "PSR.mfl", 27, 1, 2, 4, },
-  { "PSR.pk", 27, 1, 2, 15, },
-  { "PSR.pp", 27, 1, 2, 21, },
-  { "PSR.ri", 27, 1, 2, 41, },
-  { "PSR.rt", 27, 1, 2, 27, },
-  { "PSR.si", 27, 1, 2, 23, },
-  { "PSR.sp", 27, 1, 2, 20, },
-  { "PSR.ss", 27, 1, 2, 40, },
-  { "PSR.tb", 27, 1, 2, 26, },
-  { "PSR.up", 27, 1, 2, 2, },
-  { "RR#", 24, 1, 2, -1, },
-  { "RSE", 28, 1, 2, -1, },
-  { "PR63", 23, 2, 2, -1, },
+  { "ALAT", 0, 0, 0, -1, NULL, },
+  { "AR[BSP]", 26, 0, 2, 17, NULL, },
+  { "AR[BSPSTORE]", 26, 0, 2, 18, NULL, },
+  { "AR[CCV]", 26, 0, 2, 32, NULL, },
+  { "AR[EC]", 26, 0, 2, 66, NULL, },
+  { "AR[FPSR].sf0.controls", 30, 0, 2, -1, NULL, },
+  { "AR[FPSR].sf1.controls", 30, 0, 2, -1, NULL, },
+  { "AR[FPSR].sf2.controls", 30, 0, 2, -1, NULL, },
+  { "AR[FPSR].sf3.controls", 30, 0, 2, -1, NULL, },
+  { "AR[FPSR].sf0.flags", 30, 0, 2, -1, NULL, },
+  { "AR[FPSR].sf1.flags", 30, 0, 2, -1, NULL, },
+  { "AR[FPSR].sf2.flags", 30, 0, 2, -1, NULL, },
+  { "AR[FPSR].sf3.flags", 30, 0, 2, -1, NULL, },
+  { "AR[FPSR].traps", 30, 0, 2, -1, NULL, },
+  { "AR[FPSR].rv", 30, 0, 2, -1, NULL, },
+  { "AR[ITC]", 26, 0, 2, 44, NULL, },
+  { "AR[K%], % in 0 - 7", 1, 0, 2, -1, NULL, },
+  { "AR[LC]", 26, 0, 2, 65, NULL, },
+  { "AR[PFS]", 26, 0, 2, 64, NULL, },
+  { "AR[PFS]", 26, 0, 2, 64, NULL, },
+  { "AR[PFS]", 26, 0, 0, 64, NULL, },
+  { "AR[RNAT]", 26, 0, 2, 19, NULL, },
+  { "AR[RSC]", 26, 0, 2, 16, NULL, },
+  { "AR[UNAT]{%}, % in 0 - 63", 2, 0, 2, -1, NULL, },
+  { "AR%, % in 8-15, 20, 22-23, 31, 33-35, 37-39, 41-43, 45-47, 67-111", 3, 0, 0, -1, NULL, },
+  { "AR%, % in 48-63, 112-127", 4, 0, 2, -1, NULL, },
+  { "BR%, % in 0 - 7", 5, 0, 2, -1, NULL, },
+  { "BR%, % in 0 - 7", 5, 0, 0, -1, NULL, },
+  { "BR%, % in 0 - 7", 5, 0, 2, -1, NULL, },
+  { "CFM", 6, 0, 2, -1, NULL, },
+  { "CFM", 6, 0, 2, -1, NULL, },
+  { "CFM", 6, 0, 2, -1, NULL, },
+  { "CFM", 6, 0, 2, -1, NULL, },
+  { "CFM", 6, 0, 0, -1, NULL, },
+  { "CPUID#", 7, 0, 5, -1, NULL, },
+  { "CR[CMCV]", 27, 0, 3, 74, NULL, },
+  { "CR[DCR]", 27, 0, 3, 0, NULL, },
+  { "CR[EOI]", 27, 0, 7, 67, "SC Section 10.8.3.4", },
+  { "CR[GPTA]", 27, 0, 3, 9, NULL, },
+  { "CR[IFA]", 27, 0, 1, 20, NULL, },
+  { "CR[IFA]", 27, 0, 3, 20, NULL, },
+  { "CR[IFS]", 27, 0, 3, 23, NULL, },
+  { "CR[IFS]", 27, 0, 1, 23, NULL, },
+  { "CR[IFS]", 27, 0, 1, 23, NULL, },
+  { "CR[IHA]", 27, 0, 3, 25, NULL, },
+  { "CR[IIM]", 27, 0, 3, 24, NULL, },
+  { "CR[IIP]", 27, 0, 3, 19, NULL, },
+  { "CR[IIP]", 27, 0, 1, 19, NULL, },
+  { "CR[IIPA]", 27, 0, 3, 22, NULL, },
+  { "CR[IPSR]", 27, 0, 3, 16, NULL, },
+  { "CR[IPSR]", 27, 0, 1, 16, NULL, },
+  { "CR[IRR%], % in 0 - 3", 8, 0, 3, -1, NULL, },
+  { "CR[ISR]", 27, 0, 3, 17, NULL, },
+  { "CR[ITIR]", 27, 0, 3, 21, NULL, },
+  { "CR[ITIR]", 27, 0, 1, 21, NULL, },
+  { "CR[ITM]", 27, 0, 3, 1, NULL, },
+  { "CR[ITV]", 27, 0, 3, 72, NULL, },
+  { "CR[IVA]", 27, 0, 4, 2, NULL, },
+  { "CR[IVR]", 27, 0, 7, 65, "SC Section 10.8.3.2", },
+  { "CR[LID]", 27, 0, 7, 64, "SC Section 10.8.3.1", },
+  { "CR[LRR%], % in 0 - 1", 9, 0, 3, -1, NULL, },
+  { "CR[PMV]", 27, 0, 3, 73, NULL, },
+  { "CR[PTA]", 27, 0, 3, 8, NULL, },
+  { "CR[TPR]", 27, 0, 3, 66, NULL, },
+  { "CR[TPR]", 27, 0, 7, 66, "SC Section 10.8.3.3", },
+  { "CR%, % in 3-7, 10-15, 18, 26-63, 75-79, 82-127", 10, 0, 0, -1, NULL, },
+  { "DBR#", 11, 0, 2, -1, NULL, },
+  { "DBR#", 11, 0, 3, -1, NULL, },
+  { "DTC", 0, 0, 3, -1, NULL, },
+  { "DTC", 0, 0, 2, -1, NULL, },
+  { "DTC", 0, 0, 0, -1, NULL, },
+  { "DTC", 0, 0, 2, -1, NULL, },
+  { "DTC_LIMIT*", 0, 0, 2, -1, NULL, },
+  { "DTR", 0, 0, 3, -1, NULL, },
+  { "DTR", 0, 0, 2, -1, NULL, },
+  { "DTR", 0, 0, 3, -1, NULL, },
+  { "DTR", 0, 0, 0, -1, NULL, },
+  { "DTR", 0, 0, 2, -1, NULL, },
+  { "FR%, % in 0 - 1", 12, 0, 0, -1, NULL, },
+  { "FR%, % in 2 - 127", 13, 0, 2, -1, NULL, },
+  { "FR%, % in 2 - 127", 13, 0, 0, -1, NULL, },
+  { "GR0", 14, 0, 0, -1, NULL, },
+  { "GR%, % in 1 - 127", 15, 0, 0, -1, NULL, },
+  { "GR%, % in 1 - 127", 15, 0, 2, -1, NULL, },
+  { "IBR#", 16, 0, 2, -1, NULL, },
+  { "InService*", 17, 0, 3, -1, NULL, },
+  { "InService*", 17, 0, 2, -1, NULL, },
+  { "InService*", 17, 0, 2, -1, NULL, },
+  { "IP", 0, 0, 0, -1, NULL, },
+  { "ITC", 0, 0, 4, -1, NULL, },
+  { "ITC", 0, 0, 2, -1, NULL, },
+  { "ITC", 0, 0, 0, -1, NULL, },
+  { "ITC", 0, 0, 4, -1, NULL, },
+  { "ITC", 0, 0, 2, -1, NULL, },
+  { "ITC_LIMIT*", 0, 0, 2, -1, NULL, },
+  { "ITR", 0, 0, 2, -1, NULL, },
+  { "ITR", 0, 0, 4, -1, NULL, },
+  { "ITR", 0, 0, 2, -1, NULL, },
+  { "ITR", 0, 0, 0, -1, NULL, },
+  { "ITR", 0, 0, 4, -1, NULL, },
+  { "memory", 0, 0, 0, -1, NULL, },
+  { "MSR#", 18, 0, 5, -1, NULL, },
+  { "PKR#", 19, 0, 3, -1, NULL, },
+  { "PKR#", 19, 0, 0, -1, NULL, },
+  { "PKR#", 19, 0, 2, -1, NULL, },
+  { "PKR#", 19, 0, 2, -1, NULL, },
+  { "PMC#", 20, 0, 2, -1, NULL, },
+  { "PMC#", 20, 0, 7, -1, "SC+3 Section 12.1.1", },
+  { "PMD#", 21, 0, 2, -1, NULL, },
+  { "PR0", 0, 0, 0, -1, NULL, },
+  { "PR%, % in 1 - 15", 22, 0, 2, -1, NULL, },
+  { "PR%, % in 1 - 15", 22, 0, 2, -1, NULL, },
+  { "PR%, % in 1 - 15", 22, 0, 0, -1, NULL, },
+  { "PR%, % in 16 - 62", 23, 0, 2, -1, NULL, },
+  { "PR%, % in 16 - 62", 23, 0, 2, -1, NULL, },
+  { "PR%, % in 16 - 62", 23, 0, 0, -1, NULL, },
+  { "PR63", 24, 0, 2, -1, NULL, },
+  { "PR63", 24, 0, 2, -1, NULL, },
+  { "PR63", 24, 0, 0, -1, NULL, },
+  { "PSR.ac", 28, 0, 1, 3, NULL, },
+  { "PSR.ac", 28, 0, 3, 3, NULL, },
+  { "PSR.ac", 28, 0, 2, 3, NULL, },
+  { "PSR.be", 28, 0, 1, 1, NULL, },
+  { "PSR.be", 28, 0, 3, 1, NULL, },
+  { "PSR.be", 28, 0, 2, 1, NULL, },
+  { "PSR.bn", 28, 0, 2, 44, NULL, },
+  { "PSR.cpl", 28, 0, 1, 32, NULL, },
+  { "PSR.da", 28, 0, 3, 38, NULL, },
+  { "PSR.db", 28, 0, 3, 24, NULL, },
+  { "PSR.db", 28, 0, 2, 24, NULL, },
+  { "PSR.db", 28, 0, 3, 24, NULL, },
+  { "PSR.dd", 28, 0, 3, 39, NULL, },
+  { "PSR.dfh", 28, 0, 3, 19, NULL, },
+  { "PSR.dfh", 28, 0, 2, 19, NULL, },
+  { "PSR.dfl", 28, 0, 3, 18, NULL, },
+  { "PSR.dfl", 28, 0, 2, 18, NULL, },
+  { "PSR.di", 28, 0, 3, 22, NULL, },
+  { "PSR.di", 28, 0, 2, 22, NULL, },
+  { "PSR.dt", 28, 0, 3, 17, NULL, },
+  { "PSR.dt", 28, 0, 2, 17, NULL, },
+  { "PSR.ed", 28, 0, 3, 43, NULL, },
+  { "PSR.i", 28, 0, 2, 14, NULL, },
+  { "PSR.i", 28, 0, 3, 14, NULL, },
+  { "PSR.ia", 28, 0, 0, 14, NULL, },
+  { "PSR.ic", 28, 0, 2, 13, NULL, },
+  { "PSR.ic", 28, 0, 3, 13, NULL, },
+  { "PSR.id", 28, 0, 0, 14, NULL, },
+  { "PSR.is", 28, 0, 0, 14, NULL, },
+  { "PSR.it", 28, 0, 3, 14, NULL, },
+  { "PSR.lp", 28, 0, 2, 25, NULL, },
+  { "PSR.lp", 28, 0, 3, 25, NULL, },
+  { "PSR.lp", 28, 0, 3, 25, NULL, },
+  { "PSR.mc", 28, 0, 0, 35, NULL, },
+  { "PSR.mfh", 28, 0, 2, 5, NULL, },
+  { "PSR.mfl", 28, 0, 2, 4, NULL, },
+  { "PSR.pk", 28, 0, 3, 15, NULL, },
+  { "PSR.pk", 28, 0, 2, 15, NULL, },
+  { "PSR.pp", 28, 0, 2, 21, NULL, },
+  { "PSR.ri", 28, 0, 0, 41, NULL, },
+  { "PSR.rt", 28, 0, 2, 27, NULL, },
+  { "PSR.rt", 28, 0, 3, 27, NULL, },
+  { "PSR.rt", 28, 0, 3, 27, NULL, },
+  { "PSR.si", 28, 0, 2, 23, NULL, },
+  { "PSR.si", 28, 0, 3, 23, NULL, },
+  { "PSR.sp", 28, 0, 2, 20, NULL, },
+  { "PSR.sp", 28, 0, 3, 20, NULL, },
+  { "PSR.ss", 28, 0, 3, 40, NULL, },
+  { "PSR.tb", 28, 0, 3, 26, NULL, },
+  { "PSR.tb", 28, 0, 2, 26, NULL, },
+  { "PSR.up", 28, 0, 2, 2, NULL, },
+  { "RR#", 25, 0, 3, -1, NULL, },
+  { "RR#", 25, 0, 2, -1, NULL, },
+  { "RSE", 29, 0, 2, -1, NULL, },
+  { "ALAT", 0, 1, 0, -1, NULL, },
+  { "AR[BSP]", 26, 1, 2, 17, NULL, },
+  { "AR[BSPSTORE]", 26, 1, 2, 18, NULL, },
+  { "AR[CCV]", 26, 1, 2, 32, NULL, },
+  { "AR[EC]", 26, 1, 2, 66, NULL, },
+  { "AR[FPSR].sf0.controls", 30, 1, 2, -1, NULL, },
+  { "AR[FPSR].sf1.controls", 30, 1, 2, -1, NULL, },
+  { "AR[FPSR].sf2.controls", 30, 1, 2, -1, NULL, },
+  { "AR[FPSR].sf3.controls", 30, 1, 2, -1, NULL, },
+  { "AR[FPSR].sf0.flags", 30, 1, 0, -1, NULL, },
+  { "AR[FPSR].sf0.flags", 30, 1, 2, -1, NULL, },
+  { "AR[FPSR].sf0.flags", 30, 1, 2, -1, NULL, },
+  { "AR[FPSR].sf1.flags", 30, 1, 0, -1, NULL, },
+  { "AR[FPSR].sf1.flags", 30, 1, 2, -1, NULL, },
+  { "AR[FPSR].sf1.flags", 30, 1, 2, -1, NULL, },
+  { "AR[FPSR].sf2.flags", 30, 1, 0, -1, NULL, },
+  { "AR[FPSR].sf2.flags", 30, 1, 2, -1, NULL, },
+  { "AR[FPSR].sf2.flags", 30, 1, 2, -1, NULL, },
+  { "AR[FPSR].sf3.flags", 30, 1, 0, -1, NULL, },
+  { "AR[FPSR].sf3.flags", 30, 1, 2, -1, NULL, },
+  { "AR[FPSR].sf3.flags", 30, 1, 2, -1, NULL, },
+  { "AR[FPSR].rv", 30, 1, 2, -1, NULL, },
+  { "AR[FPSR].traps", 30, 1, 2, -1, NULL, },
+  { "AR[ITC]", 26, 1, 2, 44, NULL, },
+  { "AR[K%], % in 0 - 7", 1, 1, 2, -1, NULL, },
+  { "AR[LC]", 26, 1, 2, 65, NULL, },
+  { "AR[PFS]", 26, 1, 0, 64, NULL, },
+  { "AR[PFS]", 26, 1, 2, 64, NULL, },
+  { "AR[PFS]", 26, 1, 2, 64, NULL, },
+  { "AR[RNAT]", 26, 1, 2, 19, NULL, },
+  { "AR[RSC]", 26, 1, 2, 16, NULL, },
+  { "AR[UNAT]{%}, % in 0 - 63", 2, 1, 2, -1, NULL, },
+  { "AR%, % in 8-15, 20, 22-23, 31, 33-35, 37-39, 41-43, 45-47, 67-111", 3, 1, 0, -1, NULL, },
+  { "AR%, % in 48 - 63, 112-127", 4, 1, 2, -1, NULL, },
+  { "BR%, % in 0 - 7", 5, 1, 2, -1, NULL, },
+  { "BR%, % in 0 - 7", 5, 1, 2, -1, NULL, },
+  { "BR%, % in 0 - 7", 5, 1, 2, -1, NULL, },
+  { "BR%, % in 0 - 7", 5, 1, 0, -1, NULL, },
+  { "CFM", 6, 1, 2, -1, NULL, },
+  { "CPUID#", 7, 1, 0, -1, NULL, },
+  { "CR[CMCV]", 27, 1, 2, 74, NULL, },
+  { "CR[DCR]", 27, 1, 2, 0, NULL, },
+  { "CR[EOI]", 27, 1, 7, 67, "SC Section 10.8.3.4", },
+  { "CR[GPTA]", 27, 1, 2, 9, NULL, },
+  { "CR[IFA]", 27, 1, 2, 20, NULL, },
+  { "CR[IFS]", 27, 1, 2, 23, NULL, },
+  { "CR[IHA]", 27, 1, 2, 25, NULL, },
+  { "CR[IIM]", 27, 1, 2, 24, NULL, },
+  { "CR[IIP]", 27, 1, 2, 19, NULL, },
+  { "CR[IIPA]", 27, 1, 2, 22, NULL, },
+  { "CR[IPSR]", 27, 1, 2, 16, NULL, },
+  { "CR[IRR%], % in 0 - 3", 8, 1, 2, -1, NULL, },
+  { "CR[ISR]", 27, 1, 2, 17, NULL, },
+  { "CR[ITIR]", 27, 1, 2, 21, NULL, },
+  { "CR[ITM]", 27, 1, 2, 1, NULL, },
+  { "CR[ITV]", 27, 1, 2, 72, NULL, },
+  { "CR[IVA]", 27, 1, 2, 2, NULL, },
+  { "CR[IVR]", 27, 1, 7, 65, "SC", },
+  { "CR[LID]", 27, 1, 7, 64, "SC", },
+  { "CR[LRR%], % in 0 - 1", 9, 1, 2, -1, NULL, },
+  { "CR[PMV]", 27, 1, 2, 73, NULL, },
+  { "CR[PTA]", 27, 1, 2, 8, NULL, },
+  { "CR[TPR]", 27, 1, 2, 66, NULL, },
+  { "CR%, % in 3-7, 10-15, 18, 26-63, 75-79, 82-127", 10, 1, 0, -1, NULL, },
+  { "DBR#", 11, 1, 2, -1, NULL, },
+  { "DTC", 0, 1, 0, -1, NULL, },
+  { "DTC", 0, 1, 2, -1, NULL, },
+  { "DTC", 0, 1, 2, -1, NULL, },
+  { "DTC_LIMIT*", 0, 1, 2, -1, NULL, },
+  { "DTR", 0, 1, 2, -1, NULL, },
+  { "DTR", 0, 1, 2, -1, NULL, },
+  { "DTR", 0, 1, 2, -1, NULL, },
+  { "DTR", 0, 1, 0, -1, NULL, },
+  { "FR%, % in 0 - 1", 12, 1, 0, -1, NULL, },
+  { "FR%, % in 2 - 127", 13, 1, 2, -1, NULL, },
+  { "GR0", 14, 1, 0, -1, NULL, },
+  { "GR%, % in 1 - 127", 15, 1, 2, -1, NULL, },
+  { "IBR#", 16, 1, 2, -1, NULL, },
+  { "InService*", 17, 1, 7, -1, "SC", },
+  { "IP", 0, 1, 0, -1, NULL, },
+  { "ITC", 0, 1, 0, -1, NULL, },
+  { "ITC", 0, 1, 2, -1, NULL, },
+  { "ITC", 0, 1, 2, -1, NULL, },
+  { "ITR", 0, 1, 2, -1, NULL, },
+  { "ITR", 0, 1, 2, -1, NULL, },
+  { "ITR", 0, 1, 0, -1, NULL, },
+  { "memory", 0, 1, 0, -1, NULL, },
+  { "MSR#", 18, 1, 7, -1, "SC", },
+  { "PKR#", 19, 1, 0, -1, NULL, },
+  { "PKR#", 19, 1, 0, -1, NULL, },
+  { "PKR#", 19, 1, 2, -1, NULL, },
+  { "PMC#", 20, 1, 2, -1, NULL, },
+  { "PMD#", 21, 1, 2, -1, NULL, },
+  { "PR0", 0, 1, 0, -1, NULL, },
+  { "PR%, % in 1 - 15", 22, 1, 0, -1, NULL, },
+  { "PR%, % in 1 - 15", 22, 1, 0, -1, NULL, },
+  { "PR%, % in 1 - 15", 22, 1, 2, -1, NULL, },
+  { "PR%, % in 1 - 15", 22, 1, 2, -1, NULL, },
+  { "PR%, % in 16 - 62", 23, 1, 0, -1, NULL, },
+  { "PR%, % in 16 - 62", 23, 1, 0, -1, NULL, },
+  { "PR%, % in 16 - 62", 23, 1, 2, -1, NULL, },
+  { "PR%, % in 16 - 62", 23, 1, 2, -1, NULL, },
+  { "PR63", 24, 1, 0, -1, NULL, },
+  { "PR63", 24, 1, 0, -1, NULL, },
+  { "PR63", 24, 1, 2, -1, NULL, },
+  { "PR63", 24, 1, 2, -1, NULL, },
+  { "PSR.ac", 28, 1, 2, 3, NULL, },
+  { "PSR.be", 28, 1, 2, 1, NULL, },
+  { "PSR.bn", 28, 1, 2, 44, NULL, },
+  { "PSR.cpl", 28, 1, 2, 32, NULL, },
+  { "PSR.da", 28, 1, 2, 38, NULL, },
+  { "PSR.db", 28, 1, 2, 24, NULL, },
+  { "PSR.dd", 28, 1, 2, 39, NULL, },
+  { "PSR.dfh", 28, 1, 2, 19, NULL, },
+  { "PSR.dfl", 28, 1, 2, 18, NULL, },
+  { "PSR.di", 28, 1, 2, 22, NULL, },
+  { "PSR.dt", 28, 1, 2, 17, NULL, },
+  { "PSR.ed", 28, 1, 2, 43, NULL, },
+  { "PSR.i", 28, 1, 2, 14, NULL, },
+  { "PSR.ia", 28, 1, 2, 14, NULL, },
+  { "PSR.ic", 28, 1, 2, 13, NULL, },
+  { "PSR.id", 28, 1, 2, 14, NULL, },
+  { "PSR.is", 28, 1, 2, 14, NULL, },
+  { "PSR.it", 28, 1, 2, 14, NULL, },
+  { "PSR.lp", 28, 1, 2, 25, NULL, },
+  { "PSR.mc", 28, 1, 2, 35, NULL, },
+  { "PSR.mfh", 28, 1, 0, 5, NULL, },
+  { "PSR.mfh", 28, 1, 2, 5, NULL, },
+  { "PSR.mfh", 28, 1, 2, 5, NULL, },
+  { "PSR.mfl", 28, 1, 0, 4, NULL, },
+  { "PSR.mfl", 28, 1, 2, 4, NULL, },
+  { "PSR.mfl", 28, 1, 2, 4, NULL, },
+  { "PSR.pk", 28, 1, 2, 15, NULL, },
+  { "PSR.pp", 28, 1, 2, 21, NULL, },
+  { "PSR.ri", 28, 1, 2, 41, NULL, },
+  { "PSR.rt", 28, 1, 2, 27, NULL, },
+  { "PSR.si", 28, 1, 2, 23, NULL, },
+  { "PSR.sp", 28, 1, 2, 20, NULL, },
+  { "PSR.ss", 28, 1, 2, 40, NULL, },
+  { "PSR.tb", 28, 1, 2, 26, NULL, },
+  { "PSR.up", 28, 1, 2, 2, NULL, },
+  { "RR#", 25, 1, 2, -1, NULL, },
+  { "RSE", 29, 1, 2, -1, NULL, },
+  { "PR63", 24, 2, 6, -1, NULL, },
 };
 
 static const short dep0[] = {
-  2131, 2294, 
+  88, 252, 2131, 2297, 
 };
 
 static const short dep1[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 20602, 
+  32, 33, 88, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2297, 4127, 
+  20605, 
 };
 
 static const short dep2[] = {
-  32, 33, 2129, 2130, 2131, 2294, 4127, 20602, 
+  88, 252, 2157, 2158, 2160, 2161, 2163, 2164, 2166, 2314, 2317, 2318, 2321, 
+  2322, 2325, 2326, 
 };
 
 static const short dep3[] = {
-  32, 33, 81, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 20602, 
+  32, 33, 88, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2314, 2317, 
+  2318, 2321, 2322, 2325, 2326, 4127, 20605, 
 };
 
 static const short dep4[] = {
-  2314, 2315, 2318, 2319, 
+  88, 252, 22637, 22638, 22640, 22641, 22643, 22644, 22646, 22794, 22797, 22798, 
+  22801, 22802, 22805, 22806, 
 };
 
 static const short dep5[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 2314, 2315, 2318, 2319, 4127, 
-  20602, 
+  32, 33, 88, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 20605, 
+  22794, 22797, 22798, 22801, 22802, 22805, 22806, 
 };
 
 static const short dep6[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 4127, 20602, 
+  88, 252, 2157, 2158, 2160, 2161, 2163, 2164, 2166, 2314, 2315, 2317, 2319, 
+  2321, 2323, 2325, 
 };
 
 static const short dep7[] = {
-  2312, 2314, 2316, 2318, 
+  32, 33, 88, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2314, 2315, 
+  2318, 2319, 2322, 2323, 2326, 4127, 20605, 
 };
 
 static const short dep8[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 2312, 2315, 2316, 2319, 4127, 
-  20602, 
+  88, 252, 2157, 2158, 2160, 2161, 2163, 2164, 2166, 2314, 2316, 2318, 2320, 
+  2322, 2324, 2326, 
 };
 
 static const short dep9[] = {
-  2313, 2315, 2317, 2319, 
+  32, 33, 88, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2314, 2316, 
+  2317, 2320, 2321, 2324, 2325, 4127, 20605, 
 };
 
 static const short dep10[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 2313, 2314, 2317, 2318, 4127, 
-  20602, 
+  88, 252, 2157, 2158, 2160, 2161, 2163, 2164, 2166, 2314, 2315, 2316, 2317, 
+  2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 
 };
 
 static const short dep11[] = {
-  2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 
+  32, 33, 88, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2314, 2315, 
+  2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 4127, 20605, 
+  
 };
 
 static const short dep12[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 2312, 2313, 2314, 2315, 2316, 
-  2317, 2318, 2319, 4127, 20602, 
+  88, 252, 2364, 
 };
 
 static const short dep13[] = {
-  2357, 
+  32, 33, 88, 148, 166, 167, 252, 2074, 2075, 2157, 2159, 2160, 2162, 2163, 
+  2165, 2166, 4127, 
 };
 
 static const short dep14[] = {
-  145, 164, 2074, 2075, 2157, 2159, 2160, 2162, 2163, 
+  88, 147, 252, 295, 2364, 28844, 28987, 
 };
 
 static const short dep15[] = {
-  144, 288, 2357, 
+  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 
+  23, 24, 25, 32, 33, 88, 136, 148, 166, 167, 252, 295, 2074, 2075, 2157, 2159, 
+  2160, 2162, 2163, 2165, 2166, 4127, 28844, 28987, 
 };
 
 static const short dep16[] = {
-  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 
-  23, 24, 25, 133, 145, 164, 288, 2074, 2075, 2157, 2159, 2160, 2162, 2163, 
-  
+  1, 4, 32, 88, 126, 174, 177, 211, 252, 282, 2364, 28844, 28987, 
 };
 
 static const short dep17[] = {
-  1, 4, 32, 123, 171, 174, 208, 275, 2357, 
+  1, 18, 20, 30, 32, 33, 88, 148, 150, 151, 166, 167, 174, 177, 211, 252, 282, 
+  2074, 2075, 2157, 2159, 2160, 2162, 2163, 2165, 2166, 4127, 28844, 28987, 
+  
 };
 
 static const short dep18[] = {
-  1, 18, 20, 30, 32, 33, 145, 147, 148, 164, 171, 174, 208, 275, 2074, 2075, 
-  2157, 2159, 2160, 2162, 2163, 4127, 
+  1, 32, 43, 88, 174, 211, 218, 252, 28844, 28987, 
 };
 
 static const short dep19[] = {
-  1, 32, 43, 171, 208, 215, 
+  1, 30, 32, 33, 88, 145, 166, 174, 211, 218, 252, 4127, 28844, 28987, 
 };
 
 static const short dep20[] = {
-  1, 30, 32, 33, 142, 171, 208, 215, 4127, 
+  32, 88, 211, 252, 
 };
 
 static const short dep21[] = {
-  32, 208, 
+  88, 166, 211, 252, 
 };
 
 static const short dep22[] = {
-  208, 
+  1, 32, 88, 120, 121, 123, 124, 125, 126, 127, 130, 131, 132, 133, 134, 135, 
+  136, 137, 138, 139, 140, 142, 143, 144, 145, 146, 147, 148, 151, 152, 153, 
+  154, 155, 156, 157, 158, 161, 162, 163, 164, 165, 166, 167, 168, 169, 174, 
+  211, 252, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 
+  292, 293, 294, 295, 296, 297, 298, 300, 301, 303, 304, 305, 306, 307, 308, 
+  309, 310, 311, 312, 313, 28844, 28987, 
 };
 
 static const short dep23[] = {
-  1, 32, 117, 118, 120, 121, 122, 123, 124, 127, 128, 129, 130, 131, 132, 133, 
-  134, 135, 136, 137, 139, 140, 141, 142, 143, 144, 145, 148, 149, 150, 151, 
-  152, 153, 154, 155, 158, 159, 160, 161, 162, 163, 164, 165, 166, 171, 208, 
-  272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 
-  287, 288, 289, 290, 291, 293, 294, 296, 297, 298, 299, 300, 301, 302, 303, 
-  304, 305, 306, 
+  1, 30, 32, 33, 42, 43, 47, 50, 64, 88, 126, 166, 174, 211, 252, 279, 280, 
+  281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 
+  296, 297, 298, 300, 301, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 
+  313, 4127, 28844, 28987, 
 };
 
 static const short dep24[] = {
-  1, 30, 32, 33, 42, 43, 47, 50, 64, 171, 208, 272, 273, 274, 275, 276, 277, 
-  278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 293, 
-  294, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 4127, 
+  88, 125, 252, 281, 
 };
 
 static const short dep25[] = {
-  122, 274, 
+  88, 126, 166, 252, 281, 
 };
 
 static const short dep26[] = {
-  274, 
+  88, 126, 252, 282, 
 };
 
 static const short dep27[] = {
-  123, 275, 
+  18, 19, 88, 89, 92, 96, 99, 126, 148, 166, 252, 282, 
 };
 
 static const short dep28[] = {
-  18, 19, 89, 92, 96, 99, 123, 145, 275, 
+  32, 33, 88, 166, 252, 2157, 2159, 2160, 2162, 2163, 2165, 2166, 4127, 
 };
 
 static const short dep29[] = {
-  2157, 2159, 2160, 2162, 2163, 
+  1, 18, 32, 88, 174, 199, 200, 211, 252, 2074, 2255, 2258, 2364, 28844, 28987, 
+  
 };
 
 static const short dep30[] = {
-  1, 18, 32, 171, 196, 197, 208, 2074, 2252, 2255, 2357, 
+  1, 4, 30, 32, 33, 88, 126, 148, 166, 167, 174, 199, 201, 211, 252, 2074, 2075, 
+  2157, 2159, 2160, 2162, 2163, 2165, 2166, 2256, 2258, 4127, 28844, 28987, 
+  
 };
 
 static const short dep31[] = {
-  1, 4, 30, 32, 33, 123, 145, 164, 171, 196, 198, 208, 2074, 2075, 2157, 2159, 
-  2160, 2162, 2163, 2253, 2255, 4127, 
+  88, 252, 
 };
 
 static const short dep32[] = {
-  2074, 2076, 
+  88, 166, 252, 2074, 2076, 
 };
 
 static const short dep33[] = {
-  145, 164, 2157, 2159, 2160, 2162, 2163, 
+  32, 33, 88, 148, 166, 167, 252, 2157, 2159, 2160, 2162, 2163, 2165, 2166, 
+  4127, 
 };
 
 static const short dep34[] = {
-  4, 29, 30, 31, 113, 114, 174, 208, 270, 271, 2357, 
+  4, 29, 30, 31, 88, 116, 117, 177, 211, 252, 277, 278, 2364, 
 };
 
 static const short dep35[] = {
-  4, 29, 32, 33, 145, 164, 174, 208, 270, 271, 309, 2157, 2159, 2160, 2162, 
-  2163, 4127, 
+  4, 29, 32, 33, 88, 148, 166, 167, 177, 211, 252, 277, 278, 316, 2157, 2159, 
+  2160, 2162, 2163, 2165, 2166, 4127, 
 };
 
 static const short dep36[] = {
-  17, 195, 2357, 
+  17, 88, 198, 252, 2364, 
 };
 
 static const short dep37[] = {
-  17, 145, 164, 195, 2157, 2159, 2160, 2162, 2163, 
+  17, 32, 33, 88, 148, 166, 167, 198, 252, 2157, 2159, 2160, 2162, 2163, 2165, 
+  2166, 4127, 
 };
 
 static const short dep38[] = {
-  4, 17, 29, 30, 31, 113, 114, 174, 195, 208, 270, 271, 2357, 
+  4, 17, 29, 30, 31, 88, 116, 117, 177, 198, 211, 252, 277, 278, 2364, 
 };
 
 static const short dep39[] = {
-  4, 17, 29, 32, 33, 145, 164, 174, 195, 208, 270, 271, 309, 2157, 2159, 2160, 
-  2162, 2163, 4127, 
+  4, 17, 29, 32, 33, 88, 148, 166, 167, 177, 198, 211, 252, 277, 278, 316, 2157, 
+  2159, 2160, 2162, 2163, 2165, 2166, 4127, 
 };
 
 static const short dep40[] = {
-  1, 4, 30, 32, 33, 123, 145, 164, 171, 196, 198, 208, 2157, 2159, 2160, 2162, 
-  2163, 2253, 2255, 4127, 
+  1, 4, 30, 32, 33, 88, 126, 148, 166, 167, 174, 199, 201, 211, 252, 2157, 2159, 
+  2160, 2162, 2163, 2165, 2166, 2256, 2258, 4127, 28844, 28987, 
 };
 
 static const short dep41[] = {
-  9, 179, 180, 2127, 2292, 18582, 18583, 18724, 18725, 18727, 18728, 
+  88, 166, 252, 
 };
 
 static const short dep42[] = {
-  5, 13, 14, 32, 33, 179, 181, 2126, 2127, 2128, 2157, 2158, 2161, 2292, 4127, 
-  16513, 16515, 18724, 18726, 18727, 18729, 
+  9, 88, 182, 183, 252, 2127, 2295, 18585, 18586, 18731, 18732, 18734, 18735, 
+  22637, 22638, 22639, 22641, 22642, 22644, 22645, 22794, 22797, 22798, 22801, 
+  22802, 22805, 22806, 
 };
 
 static const short dep43[] = {
-  9, 10, 11, 12, 179, 180, 182, 183, 185, 186, 188, 189, 2127, 2292, 18582, 
-  18583, 18724, 18725, 18727, 18728, 
+  5, 13, 14, 32, 33, 88, 166, 182, 184, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 2295, 4127, 16516, 16518, 18731, 18733, 18734, 18736, 22794, 22797, 
+  22798, 22801, 22802, 22805, 22806, 
 };
 
 static const short dep44[] = {
-  5, 6, 7, 8, 13, 14, 32, 33, 179, 181, 182, 184, 185, 187, 188, 190, 2126, 
-  2127, 2128, 2157, 2158, 2161, 2292, 4127, 16513, 16515, 18724, 18726, 18727, 
-  18729, 
+  9, 10, 11, 12, 88, 182, 183, 185, 186, 188, 189, 191, 192, 252, 2127, 2295, 
+  18585, 18586, 18731, 18732, 18734, 18735, 22637, 22638, 22639, 22641, 22642, 
+  22644, 22645, 22794, 22797, 22798, 22801, 22802, 22805, 22806, 
 };
 
 static const short dep45[] = {
-  10, 182, 183, 2127, 2292, 18582, 18583, 18724, 18725, 18727, 18728, 
+  5, 6, 7, 8, 13, 14, 32, 33, 88, 166, 182, 184, 185, 187, 188, 190, 191, 193, 
+  252, 2126, 2127, 2128, 2157, 2158, 2161, 2164, 2295, 4127, 16516, 16518, 18731, 
+  18733, 18734, 18736, 22794, 22797, 22798, 22801, 22802, 22805, 22806, 
 };
 
 static const short dep46[] = {
-  6, 13, 14, 32, 33, 182, 184, 2126, 2127, 2128, 2157, 2158, 2161, 2292, 4127, 
-  16513, 16515, 18724, 18726, 18727, 18729, 
+  10, 88, 185, 186, 252, 2127, 2295, 18585, 18586, 18731, 18732, 18734, 18735, 
+  22637, 22638, 22639, 22641, 22642, 22644, 22645, 22794, 22797, 22798, 22801, 
+  22802, 22805, 22806, 
 };
 
 static const short dep47[] = {
-  11, 185, 186, 2127, 2292, 18582, 18583, 18724, 18725, 18727, 18728, 
+  6, 13, 14, 32, 33, 88, 166, 185, 187, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 2295, 4127, 16516, 16518, 18731, 18733, 18734, 18736, 22794, 22797, 
+  22798, 22801, 22802, 22805, 22806, 
 };
 
 static const short dep48[] = {
-  7, 13, 14, 32, 33, 185, 187, 2126, 2127, 2128, 2157, 2158, 2161, 2292, 4127, 
-  16513, 16515, 18724, 18726, 18727, 18729, 
+  11, 88, 188, 189, 252, 2127, 2295, 18585, 18586, 18731, 18732, 18734, 18735, 
+  22637, 22638, 22639, 22641, 22642, 22644, 22645, 22794, 22797, 22798, 22801, 
+  22802, 22805, 22806, 
 };
 
 static const short dep49[] = {
-  12, 188, 189, 2127, 2292, 18582, 18583, 18724, 18725, 18727, 18728, 
+  7, 13, 14, 32, 33, 88, 166, 188, 190, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 2295, 4127, 16516, 16518, 18731, 18733, 18734, 18736, 22794, 22797, 
+  22798, 22801, 22802, 22805, 22806, 
 };
 
 static const short dep50[] = {
-  8, 13, 14, 32, 33, 188, 190, 2126, 2127, 2128, 2157, 2158, 2161, 2292, 4127, 
-  16513, 16515, 18724, 18726, 18727, 18729, 
+  12, 88, 191, 192, 252, 2127, 2295, 18585, 18586, 18731, 18732, 18734, 18735, 
+  22637, 22638, 22639, 22641, 22642, 22644, 22645, 22794, 22797, 22798, 22801, 
+  22802, 22805, 22806, 
 };
 
 static const short dep51[] = {
-  2127, 2292, 18582, 18583, 18724, 18725, 18727, 18728, 
+  8, 13, 14, 32, 33, 88, 166, 191, 193, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 2295, 4127, 16516, 16518, 18731, 18733, 18734, 18736, 22794, 22797, 
+  22798, 22801, 22802, 22805, 22806, 
 };
 
 static const short dep52[] = {
-  32, 33, 2126, 2127, 2128, 2157, 2158, 2161, 2292, 4127, 16513, 16515, 18724, 
-  18726, 18727, 18729, 
+  9, 88, 182, 183, 252, 2127, 2295, 18585, 18586, 18731, 18732, 18734, 18735, 
+  
 };
 
 static const short dep53[] = {
-  5, 175, 
+  5, 13, 14, 32, 33, 88, 166, 182, 184, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 2295, 4127, 16516, 16518, 18731, 18733, 18734, 18736, 
 };
 
 static const short dep54[] = {
-  5, 175, 2157, 2158, 2161, 
+  9, 10, 11, 12, 88, 182, 183, 185, 186, 188, 189, 191, 192, 252, 2127, 2295, 
+  18585, 18586, 18731, 18732, 18734, 18735, 
 };
 
 static const short dep55[] = {
-  5, 2157, 2158, 2161, 
+  5, 6, 7, 8, 13, 14, 32, 33, 88, 166, 182, 184, 185, 187, 188, 190, 191, 193, 
+  252, 2126, 2127, 2128, 2157, 2158, 2161, 2164, 2295, 4127, 16516, 16518, 18731, 
+  18733, 18734, 18736, 
 };
 
 static const short dep56[] = {
-  6, 176, 
+  10, 88, 185, 186, 252, 2127, 2295, 18585, 18586, 18731, 18732, 18734, 18735, 
+  
 };
 
 static const short dep57[] = {
-  5, 176, 2157, 2158, 2161, 
+  6, 13, 14, 32, 33, 88, 166, 185, 187, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 2295, 4127, 16516, 16518, 18731, 18733, 18734, 18736, 
 };
 
 static const short dep58[] = {
-  7, 177, 
+  11, 88, 188, 189, 252, 2127, 2295, 18585, 18586, 18731, 18732, 18734, 18735, 
+  
 };
 
 static const short dep59[] = {
-  5, 177, 2157, 2158, 2161, 
+  7, 13, 14, 32, 33, 88, 166, 188, 190, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 2295, 4127, 16516, 16518, 18731, 18733, 18734, 18736, 
 };
 
 static const short dep60[] = {
-  8, 178, 
+  12, 88, 191, 192, 252, 2127, 2295, 18585, 18586, 18731, 18732, 18734, 18735, 
+  
 };
 
 static const short dep61[] = {
-  5, 178, 2157, 2158, 2161, 
+  8, 13, 14, 32, 33, 88, 166, 191, 193, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 2295, 4127, 16516, 16518, 18731, 18733, 18734, 18736, 
 };
 
 static const short dep62[] = {
-  9, 180, 181, 
+  88, 252, 2127, 2295, 18585, 18586, 18731, 18732, 18734, 18735, 
 };
 
 static const short dep63[] = {
-  180, 181, 2157, 2158, 2161, 
+  32, 33, 88, 166, 252, 2126, 2127, 2128, 2157, 2158, 2161, 2164, 2295, 4127, 
+  16516, 16518, 18731, 18733, 18734, 18736, 
 };
 
 static const short dep64[] = {
-  2157, 2158, 2161, 
+  5, 88, 178, 252, 
 };
 
 static const short dep65[] = {
-  10, 183, 184, 
+  5, 32, 33, 88, 166, 178, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep66[] = {
-  183, 184, 2157, 2158, 2161, 
+  5, 32, 33, 88, 166, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep67[] = {
-  11, 186, 187, 
+  6, 88, 179, 252, 
 };
 
 static const short dep68[] = {
-  186, 187, 2157, 2158, 2161, 
+  5, 32, 33, 88, 166, 179, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep69[] = {
-  12, 189, 190, 
+  7, 88, 180, 252, 
 };
 
 static const short dep70[] = {
-  189, 190, 2157, 2158, 2161, 
+  5, 32, 33, 88, 166, 180, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep71[] = {
-  9, 13, 14, 145, 164, 2157, 2158, 2161, 
+  8, 88, 181, 252, 
 };
 
 static const short dep72[] = {
-  9, 10, 13, 14, 145, 164, 2157, 2158, 2161, 
+  5, 32, 33, 88, 166, 181, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep73[] = {
-  9, 11, 13, 14, 145, 164, 2157, 2158, 2161, 
+  9, 88, 183, 184, 252, 
 };
 
 static const short dep74[] = {
-  9, 12, 13, 14, 145, 164, 2157, 2158, 2161, 
+  32, 33, 88, 166, 183, 184, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep75[] = {
-  9, 179, 180, 
+  32, 33, 88, 166, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep76[] = {
-  5, 13, 14, 179, 181, 2157, 2158, 2161, 
+  10, 88, 186, 187, 252, 
 };
 
 static const short dep77[] = {
-  9, 10, 11, 12, 179, 180, 182, 183, 185, 186, 188, 189, 
+  32, 33, 88, 166, 186, 187, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep78[] = {
-  5, 6, 7, 8, 13, 14, 179, 181, 182, 184, 185, 187, 188, 190, 2157, 2158, 2161, 
-  
+  11, 88, 189, 190, 252, 
 };
 
 static const short dep79[] = {
-  10, 182, 183, 
+  32, 33, 88, 166, 189, 190, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep80[] = {
-  6, 13, 14, 182, 184, 2157, 2158, 2161, 
+  12, 88, 192, 193, 252, 
 };
 
 static const short dep81[] = {
-  11, 185, 186, 
+  32, 33, 88, 166, 192, 193, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep82[] = {
-  7, 13, 14, 185, 187, 2157, 2158, 2161, 
+  9, 13, 14, 32, 33, 88, 148, 166, 167, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep83[] = {
-  12, 188, 189, 
+  9, 10, 13, 14, 32, 33, 88, 148, 166, 167, 252, 2157, 2158, 2161, 2164, 4127, 
+  
 };
 
 static const short dep84[] = {
-  8, 13, 14, 188, 190, 2157, 2158, 2161, 
+  9, 11, 13, 14, 32, 33, 88, 148, 166, 167, 252, 2157, 2158, 2161, 2164, 4127, 
+  
 };
 
 static const short dep85[] = {
-  9, 179, 180, 2314, 2315, 2318, 2319, 
+  9, 12, 13, 14, 32, 33, 88, 148, 166, 167, 252, 2157, 2158, 2161, 2164, 4127, 
+  
 };
 
 static const short dep86[] = {
-  5, 13, 14, 179, 181, 2157, 2158, 2161, 2314, 2315, 2318, 2319, 
+  9, 88, 182, 183, 252, 
 };
 
 static const short dep87[] = {
-  9, 10, 11, 12, 179, 180, 182, 183, 185, 186, 188, 189, 2314, 2315, 2318, 2319, 
-  
+  5, 13, 14, 32, 33, 88, 166, 182, 184, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep88[] = {
-  5, 6, 7, 8, 13, 14, 179, 181, 182, 184, 185, 187, 188, 190, 2157, 2158, 2161, 
-  2314, 2315, 2318, 2319, 
+  9, 10, 11, 12, 88, 182, 183, 185, 186, 188, 189, 191, 192, 252, 
 };
 
 static const short dep89[] = {
-  10, 182, 183, 2314, 2315, 2318, 2319, 
+  5, 6, 7, 8, 13, 14, 32, 33, 88, 166, 182, 184, 185, 187, 188, 190, 191, 193, 
+  252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep90[] = {
-  6, 13, 14, 182, 184, 2157, 2158, 2161, 2314, 2315, 2318, 2319, 
+  10, 88, 185, 186, 252, 
 };
 
 static const short dep91[] = {
-  11, 185, 186, 2314, 2315, 2318, 2319, 
+  6, 13, 14, 32, 33, 88, 166, 185, 187, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep92[] = {
-  7, 13, 14, 185, 187, 2157, 2158, 2161, 2314, 2315, 2318, 2319, 
+  11, 88, 188, 189, 252, 
 };
 
 static const short dep93[] = {
-  12, 188, 189, 2314, 2315, 2318, 2319, 
+  7, 13, 14, 32, 33, 88, 166, 188, 190, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep94[] = {
-  8, 13, 14, 188, 190, 2157, 2158, 2161, 2314, 2315, 2318, 2319, 
+  12, 88, 191, 192, 252, 
 };
 
 static const short dep95[] = {
-  32, 33, 2126, 2127, 2128, 2157, 2158, 2161, 2314, 2315, 2318, 2319, 4127, 
-  16513, 16515, 
+  8, 13, 14, 32, 33, 88, 166, 191, 193, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep96[] = {
-  32, 33, 2126, 2127, 2128, 2157, 2158, 2161, 4127, 16513, 16515, 
+  9, 88, 182, 183, 252, 2157, 2158, 2159, 2161, 2162, 2164, 2165, 2314, 2317, 
+  2318, 2321, 2322, 2325, 2326, 
 };
 
 static const short dep97[] = {
-  13, 14, 32, 33, 2126, 2127, 2128, 2157, 2158, 2161, 2292, 4127, 16513, 16515, 
-  18724, 18726, 18727, 18729, 
+  5, 13, 14, 32, 33, 88, 166, 182, 184, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 2314, 2317, 2318, 2321, 2322, 2325, 2326, 4127, 16516, 16518, 
 };
 
 static const short dep98[] = {
-  32, 33, 145, 164, 2129, 2130, 2131, 2157, 2158, 2161, 4127, 20602, 
+  9, 10, 11, 12, 88, 182, 183, 185, 186, 188, 189, 191, 192, 252, 2157, 2158, 
+  2159, 2161, 2162, 2164, 2165, 2314, 2317, 2318, 2321, 2322, 2325, 2326, 
 };
 
 static const short dep99[] = {
-  2075, 2076, 2253, 2254, 
+  5, 6, 7, 8, 13, 14, 32, 33, 88, 166, 182, 184, 185, 187, 188, 190, 191, 193, 
+  252, 2126, 2127, 2128, 2157, 2158, 2161, 2164, 2314, 2317, 2318, 2321, 2322, 
+  2325, 2326, 4127, 16516, 16518, 
 };
 
 static const short dep100[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 2252, 2254, 4127, 20602, 
+  10, 88, 185, 186, 252, 2157, 2158, 2159, 2161, 2162, 2164, 2165, 2314, 2317, 
+  2318, 2321, 2322, 2325, 2326, 
 };
 
 static const short dep101[] = {
-  32, 33, 2074, 2076, 2157, 2158, 2161, 2294, 4127, 20602, 
+  6, 13, 14, 32, 33, 88, 166, 185, 187, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 2314, 2317, 2318, 2321, 2322, 2325, 2326, 4127, 16516, 16518, 
 };
 
 static const short dep102[] = {
-  14446, 14448, 14449, 14451, 14602, 14603, 14606, 14607, 
+  11, 88, 188, 189, 252, 2157, 2158, 2159, 2161, 2162, 2164, 2165, 2314, 2317, 
+  2318, 2321, 2322, 2325, 2326, 
 };
 
 static const short dep103[] = {
-  32, 33, 2129, 2130, 2131, 4127, 14602, 14603, 14606, 14607, 20602, 24685, 
-  24686, 24689, 
+  7, 13, 14, 32, 33, 88, 166, 188, 190, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 2314, 2317, 2318, 2321, 2322, 2325, 2326, 4127, 16516, 16518, 
 };
 
 static const short dep104[] = {
-  110, 112, 113, 115, 14602, 14603, 14606, 14607, 
+  12, 88, 191, 192, 252, 2157, 2158, 2159, 2161, 2162, 2164, 2165, 2314, 2317, 
+  2318, 2321, 2322, 2325, 2326, 
 };
 
 static const short dep105[] = {
-  14602, 14603, 14606, 14607, 24685, 24686, 24689, 
+  8, 13, 14, 32, 33, 88, 166, 191, 193, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 2314, 2317, 2318, 2321, 2322, 2325, 2326, 4127, 16516, 16518, 
 };
 
 static const short dep106[] = {
-  32, 33, 2157, 2158, 2161, 2294, 4127, 20602, 
+  9, 88, 182, 183, 252, 22637, 22638, 22639, 22641, 22642, 22644, 22645, 22794, 
+  22797, 22798, 22801, 22802, 22805, 22806, 
 };
 
 static const short dep107[] = {
-  32, 33, 110, 113, 2294, 4127, 20602, 24685, 
+  5, 13, 14, 32, 33, 88, 166, 182, 184, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 4127, 16516, 16518, 22794, 22797, 22798, 22801, 22802, 22805, 22806, 
+  
 };
 
 static const short dep108[] = {
-  4, 17, 19, 20, 174, 195, 198, 2073, 2251, 
+  9, 10, 11, 12, 88, 182, 183, 185, 186, 188, 189, 191, 192, 252, 22637, 22638, 
+  22639, 22641, 22642, 22644, 22645, 22794, 22797, 22798, 22801, 22802, 22805, 
+  22806, 
 };
 
 static const short dep109[] = {
-  32, 33, 174, 195, 197, 2129, 2130, 2131, 2157, 2158, 2161, 2251, 4127, 20602, 
-  
+  5, 6, 7, 8, 13, 14, 32, 33, 88, 166, 182, 184, 185, 187, 188, 190, 191, 193, 
+  252, 2126, 2127, 2128, 2157, 2158, 2161, 2164, 4127, 16516, 16518, 22794, 
+  22797, 22798, 22801, 22802, 22805, 22806, 
 };
 
 static const short dep110[] = {
-  4, 17, 18, 19, 32, 33, 2073, 2157, 2158, 2161, 2294, 4127, 20602, 
+  10, 88, 185, 186, 252, 22637, 22638, 22639, 22641, 22642, 22644, 22645, 22794, 
+  22797, 22798, 22801, 22802, 22805, 22806, 
 };
 
 static const short dep111[] = {
-  32, 33, 2129, 2130, 2131, 2314, 2315, 2318, 2319, 4127, 20602, 
+  6, 13, 14, 32, 33, 88, 166, 185, 187, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 4127, 16516, 16518, 22794, 22797, 22798, 22801, 22802, 22805, 22806, 
+  
 };
 
 static const short dep112[] = {
-  32, 33, 2129, 2130, 2131, 4127, 20602, 
+  11, 88, 188, 189, 252, 22637, 22638, 22639, 22641, 22642, 22644, 22645, 22794, 
+  22797, 22798, 22801, 22802, 22805, 22806, 
 };
 
 static const short dep113[] = {
-  32, 33, 2129, 2130, 2131, 2312, 2315, 2316, 2319, 4127, 20602, 
+  7, 13, 14, 32, 33, 88, 166, 188, 190, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 4127, 16516, 16518, 22794, 22797, 22798, 22801, 22802, 22805, 22806, 
+  
 };
 
 static const short dep114[] = {
-  32, 33, 2129, 2130, 2131, 2313, 2314, 2317, 2318, 4127, 20602, 
+  12, 88, 191, 192, 252, 22637, 22638, 22639, 22641, 22642, 22644, 22645, 22794, 
+  22797, 22798, 22801, 22802, 22805, 22806, 
 };
 
 static const short dep115[] = {
-  32, 33, 2129, 2130, 2131, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 
-  4127, 20602, 
+  8, 13, 14, 32, 33, 88, 166, 191, 193, 252, 2126, 2127, 2128, 2157, 2158, 2161, 
+  2164, 4127, 16516, 16518, 22794, 22797, 22798, 22801, 22802, 22805, 22806, 
+  
 };
 
 static const short dep116[] = {
-  0, 32, 33, 145, 164, 2157, 2158, 2161, 4127, 
+  88, 252, 2157, 2158, 2159, 2161, 2162, 2164, 2165, 2314, 2317, 2318, 2321, 
+  2322, 2325, 2326, 
 };
 
 static const short dep117[] = {
-  0, 170, 
+  32, 33, 88, 166, 252, 2126, 2127, 2128, 2157, 2158, 2161, 2164, 2314, 2317, 
+  2318, 2321, 2322, 2325, 2326, 4127, 16516, 16518, 
 };
 
 static const short dep118[] = {
-  0, 32, 33, 145, 164, 170, 2157, 2158, 2161, 4127, 
+  88, 252, 22637, 22638, 22639, 22641, 22642, 22644, 22645, 22794, 22797, 22798, 
+  22801, 22802, 22805, 22806, 
 };
 
 static const short dep119[] = {
-  170, 2157, 2158, 2161, 
+  32, 33, 88, 166, 252, 2126, 2127, 2128, 2157, 2158, 2161, 2164, 4127, 16516, 
+  16518, 22794, 22797, 22798, 22801, 22802, 22805, 22806, 
 };
 
 static const short dep120[] = {
-  2, 21, 172, 199, 
+  13, 14, 32, 33, 88, 166, 252, 2126, 2127, 2128, 2157, 2158, 2161, 2164, 2295, 
+  4127, 16516, 16518, 18731, 18733, 18734, 18736, 
 };
 
 static const short dep121[] = {
-  1, 2, 21, 22, 157, 158, 172, 199, 
+  32, 33, 88, 148, 166, 167, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 
+  4127, 20605, 
 };
 
 static const short dep122[] = {
-  1, 21, 22, 30, 32, 33, 157, 158, 172, 199, 4127, 
+  88, 252, 2075, 2076, 2256, 2257, 
 };
 
 static const short dep123[] = {
-  0, 32, 33, 170, 2157, 2158, 2161, 4127, 
+  32, 33, 88, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2255, 2257, 
+  4127, 20605, 
 };
 
 static const short dep124[] = {
-  1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 21, 22, 23, 171, 172, 173, 
-  175, 176, 177, 178, 180, 181, 183, 184, 186, 187, 189, 190, 191, 192, 193, 
-  199, 200, 201, 2064, 2073, 2242, 2251, 
+  32, 33, 88, 166, 252, 2074, 2076, 2157, 2158, 2161, 2164, 2297, 4127, 20605, 
+  
 };
 
 static const short dep125[] = {
-  22, 32, 33, 123, 171, 172, 173, 175, 176, 177, 178, 180, 181, 183, 184, 186, 
-  187, 189, 190, 191, 192, 193, 199, 200, 201, 2129, 2130, 2131, 2157, 2158, 
-  2161, 2242, 2251, 4127, 20602, 
+  88, 252, 14446, 14448, 14449, 14451, 14452, 14454, 14605, 14606, 14609, 14610, 
+  14613, 14614, 
 };
 
 static const short dep126[] = {
-  162, 2157, 2158, 2161, 
+  32, 33, 88, 166, 252, 2129, 2130, 2131, 4127, 14605, 14606, 14609, 14610, 
+  14613, 14614, 20605, 24685, 24686, 24689, 24692, 
 };
 
 static const short dep127[] = {
-  162, 
+  88, 113, 115, 116, 118, 252, 273, 274, 277, 278, 
 };
 
 static const short dep128[] = {
-  64, 2157, 2158, 2161, 
+  32, 33, 88, 166, 252, 273, 274, 277, 278, 4127, 24685, 24686, 24689, 24692, 
+  
 };
 
 static const short dep129[] = {
-  1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 21, 22, 23, 32, 33, 123, 160, 
-  2064, 2073, 2157, 2158, 2161, 2294, 4127, 20602, 
+  32, 33, 88, 166, 252, 2157, 2158, 2161, 2164, 2297, 4127, 20605, 
 };
 
 static const short dep130[] = {
-  35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 52, 53, 54, 55, 
-  56, 57, 59, 61, 62, 63, 64, 85, 87, 210, 211, 212, 213, 214, 215, 216, 217, 
-  218, 219, 220, 222, 223, 224, 225, 226, 228, 230, 231, 232, 248, 2108, 2277, 
-  
+  32, 33, 88, 110, 113, 116, 166, 252, 2297, 4127, 20605, 24685, 
 };
 
 static const short dep131[] = {
-  32, 33, 87, 142, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 222, 
-  223, 224, 225, 226, 228, 230, 231, 232, 248, 2129, 2130, 2131, 2157, 2158, 
-  2161, 2277, 4127, 20602, 
+  4, 17, 19, 20, 88, 177, 198, 201, 252, 2073, 2254, 
 };
 
 static const short dep132[] = {
-  51, 86, 221, 248, 2131, 2294, 
+  32, 33, 88, 166, 177, 198, 200, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 
+  2254, 4127, 20605, 
 };
 
 static const short dep133[] = {
-  32, 33, 35, 36, 38, 40, 41, 43, 44, 45, 46, 48, 49, 52, 53, 55, 56, 57, 58, 
-  59, 61, 62, 63, 85, 86, 142, 221, 248, 2099, 2108, 2157, 2158, 2161, 2294, 
-  4127, 20602, 
+  4, 17, 18, 19, 32, 33, 88, 166, 252, 2073, 2157, 2158, 2161, 2164, 2297, 4127, 
+  20605, 
 };
 
 static const short dep134[] = {
-  2, 21, 33, 172, 199, 208, 2131, 2294, 
+  0, 32, 33, 88, 148, 166, 167, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep135[] = {
-  2, 18, 19, 21, 22, 30, 32, 33, 157, 158, 172, 199, 208, 2294, 4127, 20602, 
-  
+  0, 88, 173, 252, 
 };
 
 static const short dep136[] = {
-  117, 118, 120, 121, 125, 126, 129, 130, 131, 132, 133, 134, 135, 136, 138, 
-  141, 142, 146, 147, 150, 151, 152, 153, 154, 156, 157, 159, 160, 161, 162, 
-  164, 165, 166, 272, 273, 277, 279, 280, 281, 282, 284, 286, 290, 293, 294, 
-  296, 297, 298, 299, 301, 302, 303, 305, 306, 
+  0, 32, 33, 88, 148, 166, 167, 173, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep137[] = {
-  32, 33, 64, 272, 273, 277, 279, 280, 281, 282, 284, 286, 290, 293, 294, 296, 
-  297, 298, 299, 301, 302, 303, 305, 306, 2129, 2130, 2131, 2157, 2158, 2161, 
-  4127, 20602, 
+  32, 33, 88, 166, 173, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep138[] = {
-  116, 118, 119, 121, 150, 151, 166, 272, 273, 293, 294, 296, 297, 306, 
+  2, 21, 88, 175, 202, 252, 28844, 28987, 
 };
 
 static const short dep139[] = {
-  32, 33, 162, 272, 273, 293, 294, 296, 297, 306, 2129, 2130, 2131, 2157, 2158, 
-  2161, 4127, 20602, 
+  1, 2, 21, 22, 88, 160, 161, 166, 175, 202, 252, 28844, 28987, 
 };
 
 static const short dep140[] = {
-  32, 33, 118, 121, 126, 127, 130, 132, 134, 136, 138, 139, 141, 145, 146, 148, 
-  149, 150, 151, 153, 154, 156, 158, 159, 161, 165, 166, 2157, 2158, 2161, 2294, 
-  4127, 20602, 
+  1, 21, 22, 30, 32, 33, 88, 160, 161, 166, 175, 202, 252, 4127, 28844, 28987, 
+  
 };
 
 static const short dep141[] = {
-  32, 33, 118, 121, 150, 151, 166, 2157, 2158, 2161, 2294, 4127, 20602, 
+  0, 32, 33, 88, 166, 173, 252, 2157, 2158, 2161, 2164, 4127, 
 };
 
 static const short dep142[] = {
-  68, 69, 92, 93, 236, 237, 251, 252, 
+  1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 21, 22, 23, 88, 174, 175, 
+  176, 178, 179, 180, 181, 183, 184, 186, 187, 189, 190, 192, 193, 194, 195, 
+  196, 202, 203, 204, 252, 2064, 2073, 2245, 2254, 28844, 28987, 
 };
 
 static const short dep143[] = {
-  32, 33, 39, 54, 69, 71, 77, 90, 93, 142, 167, 236, 237, 251, 252, 2129, 2130, 
-  2131, 2157, 2158, 2161, 4127, 20602, 
+  22, 32, 33, 88, 126, 166, 174, 175, 176, 178, 179, 180, 181, 183, 184, 186, 
+  187, 189, 190, 192, 193, 194, 195, 196, 202, 203, 204, 252, 2129, 2130, 2131, 
+  2157, 2158, 2161, 2164, 2245, 2254, 4127, 20605, 28844, 28987, 
 };
 
 static const short dep144[] = {
-  32, 33, 39, 54, 69, 71, 90, 93, 95, 97, 142, 167, 236, 237, 251, 252, 2129, 
-  2130, 2131, 2157, 2158, 2161, 4127, 20602, 
+  88, 252, 14455, 14457, 14458, 14460, 14489, 14490, 14505, 14615, 14616, 14636, 
+  14637, 14639, 14640, 14649, 
 };
 
 static const short dep145[] = {
-  12455, 12456, 12595, 
+  32, 33, 88, 165, 166, 252, 2157, 2158, 2161, 2164, 4127, 14615, 14616, 14636, 
+  14637, 14639, 14640, 14649, 
 };
 
 static const short dep146[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 4127, 12595, 20602, 
+  14455, 14457, 14458, 14460, 14489, 14490, 14505, 14615, 14616, 14636, 14637, 
+  14639, 14640, 14649, 
 };
 
 static const short dep147[] = {
-  6210, 6211, 6378, 
+  165, 14615, 14616, 14636, 14637, 14639, 14640, 14649, 
 };
 
 static const short dep148[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 4127, 6378, 20602, 
+  88, 252, 14456, 14457, 14459, 14460, 14468, 14469, 14470, 14471, 14472, 14473, 
+  14474, 14475, 14477, 14480, 14481, 14489, 14490, 14491, 14492, 14493, 14498, 
+  14499, 14500, 14501, 14505, 14615, 14616, 14622, 14623, 14624, 14625, 14627, 
+  14629, 14636, 14637, 14639, 14640, 14641, 14642, 14645, 14646, 14649, 
 };
 
 static const short dep149[] = {
-  6228, 6391, 
+  32, 33, 64, 88, 126, 166, 252, 2157, 2158, 2161, 2164, 4127, 14615, 14616, 
+  14622, 14623, 14624, 14625, 14627, 14629, 14636, 14637, 14639, 14640, 14641, 
+  14642, 14645, 14646, 14649, 
 };
 
 static const short dep150[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 4127, 6391, 20602, 
+  1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 21, 22, 23, 32, 33, 88, 126, 
+  163, 166, 252, 2064, 2073, 2157, 2158, 2161, 2164, 2297, 4127, 20605, 28844, 
+  
 };
 
 static const short dep151[] = {
-  6246, 6247, 6248, 6249, 6402, 6404, 8451, 
+  35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 52, 53, 54, 55, 
+  56, 57, 59, 61, 62, 63, 64, 85, 87, 88, 213, 214, 215, 216, 217, 218, 219, 
+  220, 221, 222, 223, 225, 226, 227, 228, 229, 231, 233, 234, 235, 251, 252, 
+  2108, 2280, 
 };
 
 static const short dep152[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 4127, 6249, 6403, 6404, 8295, 
-  8450, 20602, 
+  32, 33, 87, 88, 126, 145, 166, 213, 214, 215, 216, 217, 218, 219, 220, 221, 
+  222, 223, 225, 226, 227, 228, 229, 231, 233, 234, 235, 251, 252, 2129, 2130, 
+  2131, 2157, 2158, 2161, 2164, 2280, 4127, 20605, 
 };
 
 static const short dep153[] = {
-  6250, 6251, 6405, 
+  51, 86, 88, 224, 251, 252, 2131, 2297, 
 };
 
 static const short dep154[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 4127, 6405, 20602, 
+  32, 33, 35, 36, 38, 40, 41, 43, 44, 45, 46, 48, 49, 52, 53, 55, 56, 57, 58, 
+  59, 61, 62, 63, 85, 86, 88, 126, 145, 166, 224, 251, 252, 2099, 2108, 2157, 
+  2158, 2161, 2164, 2297, 4127, 20605, 
 };
 
 static const short dep155[] = {
-  6252, 6406, 
+  2, 21, 33, 88, 175, 202, 211, 252, 2131, 2297, 28844, 28987, 
 };
 
 static const short dep156[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 4127, 6406, 20602, 
+  2, 18, 19, 21, 22, 30, 32, 33, 88, 160, 161, 166, 175, 202, 211, 252, 2297, 
+  4127, 20605, 28844, 28987, 
 };
 
 static const short dep157[] = {
-  10341, 10497, 
+  88, 120, 121, 123, 124, 128, 129, 132, 133, 134, 135, 136, 137, 138, 139, 
+  141, 144, 145, 149, 150, 153, 154, 155, 156, 157, 159, 160, 162, 163, 164, 
+  165, 167, 168, 169, 252, 279, 280, 284, 286, 287, 288, 289, 291, 293, 297, 
+  300, 301, 303, 304, 305, 306, 308, 309, 310, 312, 313, 
 };
 
 static const short dep158[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 4127, 10497, 20602, 
+  32, 33, 64, 88, 126, 166, 252, 279, 280, 284, 286, 287, 288, 289, 291, 293, 
+  297, 300, 301, 303, 304, 305, 306, 308, 309, 310, 312, 313, 2129, 2130, 2131, 
+  2157, 2158, 2161, 2164, 4127, 20605, 
 };
 
 static const short dep159[] = {
-  68, 69, 73, 74, 92, 93, 236, 237, 239, 240, 251, 252, 
+  88, 119, 121, 122, 124, 153, 154, 169, 252, 279, 280, 300, 301, 303, 304, 
+  313, 
 };
 
 static const short dep160[] = {
-  32, 33, 39, 69, 71, 74, 77, 90, 93, 142, 167, 236, 237, 239, 241, 251, 252, 
-  2129, 2130, 2131, 2157, 2158, 2161, 4127, 20602, 
+  32, 33, 88, 165, 166, 252, 279, 280, 300, 301, 303, 304, 313, 2129, 2130, 
+  2131, 2157, 2158, 2161, 2164, 4127, 20605, 
 };
 
 static const short dep161[] = {
-  68, 69, 92, 93, 95, 96, 236, 237, 251, 252, 253, 254, 
+  32, 33, 88, 121, 124, 126, 129, 130, 133, 135, 137, 139, 141, 142, 144, 148, 
+  149, 151, 152, 153, 154, 156, 157, 159, 161, 162, 164, 166, 168, 169, 252, 
+  2157, 2158, 2161, 2164, 2297, 4127, 20605, 
 };
 
 static const short dep162[] = {
-  32, 33, 39, 54, 69, 71, 90, 93, 95, 97, 142, 167, 236, 237, 251, 252, 253, 
-  254, 2129, 2130, 2131, 2157, 2158, 2161, 4127, 20602, 
+  32, 33, 88, 121, 124, 153, 154, 166, 169, 252, 2157, 2158, 2161, 2164, 2297, 
+  4127, 20605, 
 };
 
 static const short dep163[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 12456, 20602, 
+  32, 33, 67, 68, 73, 75, 88, 102, 126, 155, 166, 170, 252, 2129, 2130, 2131, 
+  2157, 2158, 2161, 2164, 2297, 4127, 20605, 
 };
 
 static const short dep164[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 6210, 20602, 
+  32, 33, 67, 68, 73, 75, 88, 102, 126, 127, 128, 130, 131, 155, 166, 170, 252, 
+  2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 20605, 
 };
 
 static const short dep165[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 6228, 20602, 
+  68, 69, 88, 92, 93, 239, 240, 252, 254, 255, 
 };
 
 static const short dep166[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 6248, 8294, 20602, 
-  
+  32, 33, 39, 54, 69, 71, 77, 88, 90, 93, 126, 145, 166, 170, 239, 240, 252, 
+  254, 255, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 20605, 
 };
 
 static const short dep167[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 6250, 20602, 
+  32, 33, 39, 54, 69, 71, 88, 90, 93, 95, 97, 126, 145, 166, 170, 239, 240, 
+  252, 254, 255, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 20605, 
 };
 
 static const short dep168[] = {
-  32, 33, 123, 162, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 6251, 6252, 
-  20602, 
+  88, 252, 12458, 12459, 12602, 
 };
 
 static const short dep169[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 10341, 20602, 
+  32, 33, 88, 126, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 
+  12602, 20605, 
 };
 
 static const short dep170[] = {
-  32, 33, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 6178, 20602, 
+  88, 252, 6210, 6211, 6381, 
 };
 
 static const short dep171[] = {
-  68, 70, 71, 89, 90, 91, 235, 236, 250, 251, 
+  32, 33, 88, 126, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 
+  6381, 20605, 
 };
 
 static const short dep172[] = {
-  32, 33, 69, 70, 74, 76, 91, 93, 95, 98, 167, 235, 237, 250, 252, 2129, 2130, 
-  2131, 2157, 2158, 2161, 4127, 20602, 
+  88, 252, 6228, 6394, 
 };
 
 static const short dep173[] = {
-  68, 70, 71, 72, 89, 90, 91, 94, 235, 236, 238, 250, 251, 
+  32, 33, 88, 126, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 
+  6394, 20605, 
 };
 
 static const short dep174[] = {
-  32, 33, 69, 70, 72, 74, 76, 91, 93, 94, 95, 98, 167, 235, 237, 238, 250, 252, 
-  2129, 2130, 2131, 2157, 2158, 2161, 4127, 20602, 
+  88, 252, 6246, 6247, 6248, 6249, 6405, 6407, 8454, 
 };
 
 static const short dep175[] = {
-  68, 70, 71, 75, 76, 77, 89, 90, 91, 235, 236, 241, 242, 250, 251, 
+  32, 33, 88, 126, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 
+  6249, 6406, 6407, 8295, 8453, 20605, 
 };
 
 static const short dep176[] = {
-  32, 33, 69, 70, 74, 76, 91, 93, 167, 235, 237, 240, 242, 250, 252, 2129, 2130, 
-  2131, 2157, 2158, 2161, 4127, 20602, 
+  88, 252, 6250, 6251, 6408, 
 };
 
 static const short dep177[] = {
-  68, 70, 71, 89, 90, 91, 97, 98, 99, 235, 236, 250, 251, 254, 255, 
+  32, 33, 88, 126, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 
+  6408, 20605, 
 };
 
 static const short dep178[] = {
-  32, 33, 69, 70, 91, 93, 95, 98, 167, 235, 237, 250, 252, 253, 255, 2129, 2130, 
-  2131, 2157, 2158, 2161, 4127, 20602, 
+  88, 252, 6252, 6409, 
 };
 
 static const short dep179[] = {
-  32, 33, 38, 62, 167, 2129, 2130, 2131, 2294, 4127, 20602, 
+  32, 33, 88, 126, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 
+  6409, 20605, 
 };
 
 static const short dep180[] = {
-  32, 33, 167, 2129, 2130, 2131, 2294, 4127, 20602, 
+  88, 252, 10341, 10500, 
 };
 
 static const short dep181[] = {
-  32, 33, 68, 73, 75, 167, 2129, 2130, 2131, 2294, 4127, 20602, 
+  32, 33, 88, 126, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 
+  10500, 20605, 
 };
 
 static const short dep182[] = {
-  32, 33, 68, 73, 75, 167, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 20602, 
-  
+  68, 69, 73, 74, 88, 92, 93, 239, 240, 242, 243, 252, 254, 255, 
 };
 
 static const short dep183[] = {
-  32, 33, 145, 164, 2126, 2127, 2128, 2129, 2130, 2131, 2157, 2158, 2161, 4127, 
-  16513, 16515, 20602, 
+  32, 33, 39, 54, 69, 71, 74, 77, 88, 90, 93, 126, 145, 166, 170, 239, 240, 
+  242, 244, 252, 254, 255, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 20605, 
+  
 };
 
 static const short dep184[] = {
-  32, 33, 68, 73, 75, 2129, 2130, 2131, 2157, 2158, 2161, 4127, 20602, 
+  68, 69, 88, 92, 93, 95, 96, 239, 240, 252, 254, 255, 256, 257, 
 };
 
 static const short dep185[] = {
-  32, 33, 69, 70, 91, 235, 237, 250, 252, 2129, 2130, 2131, 2157, 2158, 2161, 
-  4127, 20602, 
+  32, 33, 39, 54, 69, 71, 88, 90, 93, 95, 97, 126, 145, 166, 170, 239, 240, 
+  252, 254, 255, 256, 257, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 20605, 
+  
 };
 
 static const short dep186[] = {
-  32, 33, 67, 68, 73, 75, 100, 102, 116, 117, 119, 120, 123, 124, 125, 127, 
-  128, 135, 152, 167, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 20602, 
-  
+  32, 33, 88, 126, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2297, 
+  4127, 12459, 20605, 
 };
 
 static const short dep187[] = {
-  32, 33, 36, 67, 68, 73, 75, 100, 102, 116, 117, 119, 120, 123, 124, 125, 127, 
-  128, 135, 137, 152, 167, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 20602, 
-  
+  32, 33, 88, 126, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2297, 
+  4127, 6210, 20605, 
 };
 
 static const short dep188[] = {
-  0, 170, 2131, 2294, 
+  32, 33, 88, 126, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2297, 
+  4127, 6228, 20605, 
 };
 
 static const short dep189[] = {
-  0, 32, 33, 67, 68, 73, 75, 100, 102, 116, 117, 119, 120, 123, 124, 125, 127, 
-  128, 135, 152, 167, 170, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 20602, 
-  
+  32, 33, 88, 126, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2297, 
+  4127, 6248, 8294, 20605, 
 };
 
 static const short dep190[] = {
-  0, 32, 33, 36, 67, 68, 73, 75, 100, 102, 116, 117, 119, 120, 123, 124, 125, 
-  127, 128, 135, 137, 152, 167, 170, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 
-  4127, 20602, 
+  32, 33, 88, 126, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2297, 
+  4127, 6250, 20605, 
 };
 
 static const short dep191[] = {
-  23, 32, 33, 67, 68, 73, 75, 100, 102, 116, 117, 119, 120, 123, 124, 125, 127, 
-  128, 135, 152, 167, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 20602, 
-  
+  32, 33, 88, 126, 165, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 
+  2297, 4127, 6251, 6252, 20605, 
 };
 
 static const short dep192[] = {
-  0, 170, 2294, 26706, 
+  32, 33, 88, 126, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2297, 
+  4127, 10341, 20605, 
 };
 
 static const short dep193[] = {
-  23, 201, 
+  32, 33, 88, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2297, 4127, 
+  6178, 20605, 
 };
 
 static const short dep194[] = {
-  201, 
+  68, 70, 71, 88, 89, 90, 91, 238, 239, 252, 253, 254, 
 };
 
 static const short dep195[] = {
-  0, 100, 170, 256, 2131, 2294, 
+  32, 33, 69, 70, 74, 76, 88, 91, 93, 95, 98, 126, 166, 170, 238, 240, 252, 
+  253, 255, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 20605, 
 };
 
 static const short dep196[] = {
-  0, 3, 32, 33, 67, 68, 73, 75, 100, 102, 116, 117, 119, 120, 123, 124, 125, 
-  127, 128, 135, 152, 167, 170, 256, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 
-  4127, 20602, 
+  68, 70, 71, 72, 88, 89, 90, 91, 94, 238, 239, 241, 252, 253, 254, 
 };
 
 static const short dep197[] = {
-  0, 32, 33, 67, 68, 73, 75, 100, 102, 116, 117, 119, 120, 123, 124, 125, 127, 
-  128, 135, 152, 167, 170, 256, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 
-  20602, 
+  32, 33, 69, 70, 72, 74, 76, 88, 91, 93, 94, 95, 98, 126, 166, 170, 238, 240, 
+  241, 252, 253, 255, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 20605, 
+  
 };
 
 static const short dep198[] = {
-  32, 33, 2126, 2127, 2128, 2157, 2158, 2161, 2294, 4127, 16513, 16515, 20602, 
+  68, 70, 71, 75, 76, 77, 88, 89, 90, 91, 238, 239, 244, 245, 252, 253, 254, 
   
 };
 
 static const short dep199[] = {
-  32, 33, 67, 68, 73, 75, 100, 102, 116, 117, 119, 120, 123, 124, 125, 127, 
-  128, 135, 152, 167, 2129, 2130, 2131, 2157, 2158, 2161, 2292, 4127, 16513, 
-  16515, 18724, 18726, 18727, 18729, 20602, 
+  32, 33, 69, 70, 74, 76, 88, 91, 93, 126, 166, 170, 238, 240, 243, 245, 252, 
+  253, 255, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 20605, 
 };
 
 static const short dep200[] = {
-  32, 33, 36, 67, 68, 73, 75, 100, 102, 116, 117, 119, 120, 123, 124, 125, 127, 
-  128, 135, 137, 152, 167, 2129, 2130, 2131, 2157, 2158, 2161, 2292, 4127, 16513, 
-  16515, 18724, 18726, 18727, 18729, 20602, 
+  68, 70, 71, 88, 89, 90, 91, 97, 98, 99, 238, 239, 252, 253, 254, 257, 258, 
+  
 };
 
 static const short dep201[] = {
-  0, 170, 2127, 2292, 18582, 18583, 18724, 18725, 18727, 18728, 
+  32, 33, 69, 70, 88, 91, 93, 95, 98, 126, 166, 170, 238, 240, 252, 253, 255, 
+  256, 258, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 20605, 
 };
 
 static const short dep202[] = {
-  0, 32, 33, 67, 68, 73, 75, 100, 102, 116, 117, 119, 120, 123, 124, 125, 127, 
-  128, 135, 152, 167, 170, 2129, 2130, 2131, 2157, 2158, 2161, 2292, 4127, 16513, 
-  16515, 18724, 18726, 18727, 18729, 20602, 
+  32, 33, 38, 62, 88, 166, 170, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 
+  2297, 4127, 20605, 
 };
 
 static const short dep203[] = {
-  0, 32, 33, 36, 67, 68, 73, 75, 100, 102, 116, 117, 119, 120, 123, 124, 125, 
-  127, 128, 135, 137, 152, 167, 170, 2129, 2130, 2131, 2157, 2158, 2161, 2292, 
-  4127, 16513, 16515, 18724, 18726, 18727, 18729, 20602, 
+  32, 33, 88, 166, 170, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2297, 
+  4127, 20605, 
 };
 
 static const short dep204[] = {
-  0, 170, 2128, 2292, 18582, 18583, 18724, 18725, 18727, 18728, 
+  32, 33, 68, 73, 75, 88, 126, 166, 170, 252, 2129, 2130, 2131, 2157, 2158, 
+  2161, 2164, 2297, 4127, 20605, 
 };
 
 static const short dep205[] = {
-  0, 100, 170, 256, 
+  32, 33, 88, 148, 166, 167, 252, 2126, 2127, 2128, 2129, 2130, 2131, 2157, 
+  2158, 2161, 2164, 4127, 16516, 16518, 20605, 
 };
 
 static const short dep206[] = {
-  0, 32, 33, 67, 68, 73, 75, 102, 116, 117, 119, 120, 123, 124, 125, 127, 128, 
-  135, 152, 167, 170, 256, 2129, 2130, 2131, 2157, 2158, 2161, 4127, 20602, 
-  
+  32, 33, 68, 73, 75, 88, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 
+  4127, 20605, 
 };
 
 static const short dep207[] = {
-  67, 123, 137, 2157, 2158, 2161, 
+  32, 33, 69, 70, 88, 91, 126, 166, 238, 240, 252, 253, 255, 2129, 2130, 2131, 
+  2157, 2158, 2161, 2164, 4127, 20605, 
 };
 
 static const short dep208[] = {
-  67, 123, 124, 128, 137, 2157, 2158, 2161, 
+  32, 33, 67, 68, 73, 75, 88, 100, 102, 119, 120, 122, 123, 126, 127, 128, 130, 
+  131, 138, 155, 166, 170, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2297, 
+  4127, 20605, 
 };
 
 static const short dep209[] = {
-  32, 33, 67, 123, 137, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 4127, 20602, 
-  
+  32, 33, 36, 67, 68, 73, 75, 88, 100, 102, 119, 120, 122, 123, 126, 127, 128, 
+  130, 131, 138, 140, 155, 166, 170, 252, 2129, 2130, 2131, 2157, 2158, 2161, 
+  2164, 2297, 4127, 20605, 
 };
 
 static const short dep210[] = {
-  32, 33, 67, 123, 124, 128, 137, 2129, 2130, 2131, 2157, 2158, 2161, 2294, 
-  4127, 20602, 
+  0, 88, 173, 252, 2131, 2297, 
 };
 
 static const short dep211[] = {
-  2157, 2158, 2159, 2160, 2161, 2162, 2163, 
+  0, 32, 33, 67, 68, 73, 75, 88, 100, 102, 119, 120, 122, 123, 126, 127, 128, 
+  130, 131, 138, 155, 166, 170, 173, 252, 2129, 2130, 2131, 2157, 2158, 2161, 
+  2164, 2297, 4127, 20605, 
 };
 
 static const short dep212[] = {
-  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 19, 20, 21, 22, 23, 
-  171, 172, 173, 174, 175, 176, 177, 178, 180, 181, 183, 184, 186, 187, 189, 
-  190, 191, 192, 193, 195, 198, 199, 200, 201, 2064, 2073, 2131, 2242, 2251, 
-  2294, 
+  0, 32, 33, 36, 67, 68, 73, 75, 88, 100, 102, 119, 120, 122, 123, 126, 127, 
+  128, 130, 131, 138, 140, 155, 166, 170, 173, 252, 2129, 2130, 2131, 2157, 
+  2158, 2161, 2164, 2297, 4127, 20605, 
 };
 
 static const short dep213[] = {
+  23, 32, 33, 67, 68, 73, 75, 88, 100, 102, 119, 120, 122, 123, 126, 127, 128, 
+  130, 131, 138, 155, 166, 170, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 
+  2297, 4127, 20605, 
+};
+
+static const short dep214[] = {
+  0, 88, 173, 252, 2297, 26706, 
+};
+
+static const short dep215[] = {
+  0, 88, 100, 173, 252, 259, 
+};
+
+static const short dep216[] = {
+  0, 32, 33, 67, 68, 73, 75, 88, 102, 119, 120, 122, 123, 126, 127, 128, 130, 
+  131, 138, 155, 166, 170, 173, 252, 259, 2129, 2130, 2131, 2157, 2158, 2161, 
+  2164, 4127, 20605, 
+};
+
+static const short dep217[] = {
+  0, 23, 88, 100, 173, 204, 252, 259, 
+};
+
+static const short dep218[] = {
+  0, 32, 33, 67, 68, 73, 75, 88, 102, 119, 120, 122, 123, 126, 127, 128, 130, 
+  131, 138, 155, 166, 170, 173, 204, 252, 259, 2129, 2130, 2131, 2157, 2158, 
+  2161, 2164, 4127, 20605, 
+};
+
+static const short dep219[] = {
+  0, 88, 100, 173, 252, 259, 2131, 2297, 
+};
+
+static const short dep220[] = {
+  0, 3, 32, 33, 67, 68, 73, 75, 88, 100, 102, 119, 120, 122, 123, 126, 127, 
+  128, 130, 131, 138, 155, 166, 170, 173, 252, 259, 2129, 2130, 2131, 2157, 
+  2158, 2161, 2164, 2297, 4127, 20605, 
+};
+
+static const short dep221[] = {
+  0, 32, 33, 67, 68, 73, 75, 88, 100, 102, 119, 120, 122, 123, 126, 127, 128, 
+  130, 131, 138, 155, 166, 170, 173, 252, 259, 2129, 2130, 2131, 2157, 2158, 
+  2161, 2164, 2297, 4127, 20605, 
+};
+
+static const short dep222[] = {
+  32, 33, 88, 166, 252, 2126, 2127, 2128, 2157, 2158, 2161, 2164, 2297, 4127, 
+  16516, 16518, 20605, 
+};
+
+static const short dep223[] = {
+  32, 33, 67, 68, 73, 75, 88, 100, 102, 119, 120, 122, 123, 126, 127, 128, 130, 
+  131, 138, 155, 166, 170, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2295, 
+  4127, 16516, 16518, 18731, 18733, 18734, 18736, 20605, 
+};
+
+static const short dep224[] = {
+  32, 33, 36, 67, 68, 73, 75, 88, 100, 102, 119, 120, 122, 123, 126, 127, 128, 
+  130, 131, 138, 140, 155, 166, 170, 252, 2129, 2130, 2131, 2157, 2158, 2161, 
+  2164, 2295, 4127, 16516, 16518, 18731, 18733, 18734, 18736, 20605, 
+};
+
+static const short dep225[] = {
+  0, 88, 173, 252, 2127, 2295, 18585, 18586, 18731, 18732, 18734, 18735, 
+};
+
+static const short dep226[] = {
+  0, 32, 33, 67, 68, 73, 75, 88, 100, 102, 119, 120, 122, 123, 126, 127, 128, 
+  130, 131, 138, 155, 166, 170, 173, 252, 2129, 2130, 2131, 2157, 2158, 2161, 
+  2164, 2295, 4127, 16516, 16518, 18731, 18733, 18734, 18736, 20605, 
+};
+
+static const short dep227[] = {
+  0, 32, 33, 36, 67, 68, 73, 75, 88, 100, 102, 119, 120, 122, 123, 126, 127, 
+  128, 130, 131, 138, 140, 155, 166, 170, 173, 252, 2129, 2130, 2131, 2157, 
+  2158, 2161, 2164, 2295, 4127, 16516, 16518, 18731, 18733, 18734, 18736, 20605, 
+  
+};
+
+static const short dep228[] = {
+  0, 88, 173, 252, 2128, 2295, 18585, 18586, 18731, 18732, 18734, 18735, 
+};
+
+static const short dep229[] = {
+  32, 33, 67, 88, 126, 140, 166, 252, 2157, 2158, 2161, 2164, 4127, 
+};
+
+static const short dep230[] = {
+  32, 33, 67, 88, 126, 127, 131, 140, 166, 252, 2157, 2158, 2161, 2164, 4127, 
+  
+};
+
+static const short dep231[] = {
+  32, 33, 67, 88, 126, 140, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 
+  2297, 4127, 20605, 
+};
+
+static const short dep232[] = {
+  32, 33, 67, 88, 126, 127, 131, 140, 166, 252, 2129, 2130, 2131, 2157, 2158, 
+  2161, 2164, 2297, 4127, 20605, 
+};
+
+static const short dep233[] = {
+  32, 33, 88, 166, 252, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 4127, 20605, 
+  
+};
+
+static const short dep234[] = {
+  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 19, 20, 21, 22, 23, 
+  88, 174, 175, 176, 177, 178, 179, 180, 181, 183, 184, 186, 187, 189, 190, 
+  192, 193, 194, 195, 196, 198, 201, 202, 203, 204, 252, 2064, 2073, 2131, 2245, 
+  2254, 2297, 28844, 28987, 
+};
+
+static const short dep235[] = {
   1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 21, 22, 23, 
-  32, 33, 123, 160, 171, 172, 173, 174, 175, 176, 177, 178, 180, 181, 183, 184, 
-  186, 187, 189, 190, 191, 192, 193, 195, 197, 199, 200, 201, 2064, 2073, 2129, 
-  2130, 2131, 2157, 2158, 2161, 2242, 2251, 2294, 4127, 20602, 
+  32, 33, 88, 126, 163, 166, 174, 175, 176, 177, 178, 179, 180, 181, 183, 184, 
+  186, 187, 189, 190, 192, 193, 194, 195, 196, 198, 200, 202, 203, 204, 252, 
+  2064, 2073, 2129, 2130, 2131, 2157, 2158, 2161, 2164, 2245, 2254, 2297, 4127, 
+  20605, 28844, 28987, 
 };
 
 #define NELS(X) (sizeof(X)/sizeof(X[0]))
 static const struct ia64_opcode_dependency
 op_dependencies[] = {
   { NELS(dep1), dep1, NELS(dep0), dep0, },
-  { NELS(dep2), dep2, NELS(dep0), dep0, },
-  { 0, NULL, 0, NULL, },
-  { NELS(dep3), dep3, NELS(dep0), dep0, },
+  { NELS(dep3), dep3, NELS(dep2), dep2, },
   { NELS(dep5), dep5, NELS(dep4), dep4, },
-  { NELS(dep6), dep6, 0, NULL, },
-  { NELS(dep8), dep8, NELS(dep7), dep7, },
-  { NELS(dep10), dep10, NELS(dep9), dep9, },
-  { NELS(dep12), dep12, NELS(dep11), dep11, },
-  { NELS(dep14), dep14, NELS(dep13), dep13, },
-  { NELS(dep16), dep16, NELS(dep15), dep15, },
-  { NELS(dep18), dep18, NELS(dep17), dep17, },
-  { NELS(dep20), dep20, NELS(dep19), dep19, },
-  { NELS(dep22), dep22, NELS(dep21), dep21, },
-  { NELS(dep24), dep24, NELS(dep23), dep23, },
-  { NELS(dep26), dep26, NELS(dep25), dep25, },
-  { NELS(dep28), dep28, NELS(dep27), dep27, },
-  { NELS(dep29), dep29, NELS(dep13), dep13, },
-  { NELS(dep31), dep31, NELS(dep30), dep30, },
-  { NELS(dep32), dep32, 0, NULL, },
-  { NELS(dep33), dep33, NELS(dep13), dep13, },
+  { NELS(dep7), dep7, NELS(dep6), dep6, },
+  { NELS(dep9), dep9, NELS(dep8), dep8, },
+  { NELS(dep11), dep11, NELS(dep10), dep10, },
+  { NELS(dep13), dep13, NELS(dep12), dep12, },
+  { NELS(dep15), dep15, NELS(dep14), dep14, },
+  { NELS(dep17), dep17, NELS(dep16), dep16, },
+  { NELS(dep19), dep19, NELS(dep18), dep18, },
+  { NELS(dep21), dep21, NELS(dep20), dep20, },
+  { NELS(dep23), dep23, NELS(dep22), dep22, },
+  { NELS(dep25), dep25, NELS(dep24), dep24, },
+  { NELS(dep27), dep27, NELS(dep26), dep26, },
+  { NELS(dep28), dep28, NELS(dep12), dep12, },
+  { NELS(dep30), dep30, NELS(dep29), dep29, },
+  { NELS(dep32), dep32, NELS(dep31), dep31, },
+  { NELS(dep33), dep33, NELS(dep12), dep12, },
   { NELS(dep35), dep35, NELS(dep34), dep34, },
   { NELS(dep37), dep37, NELS(dep36), dep36, },
   { NELS(dep39), dep39, NELS(dep38), dep38, },
-  { NELS(dep40), dep40, NELS(dep30), dep30, },
-  { NELS(dep42), dep42, NELS(dep41), dep41, },
-  { NELS(dep44), dep44, NELS(dep43), dep43, },
-  { NELS(dep46), dep46, NELS(dep45), dep45, },
-  { NELS(dep48), dep48, NELS(dep47), dep47, },
-  { NELS(dep50), dep50, NELS(dep49), dep49, },
-  { NELS(dep52), dep52, NELS(dep51), dep51, },
-  { NELS(dep54), dep54, NELS(dep53), dep53, },
-  { NELS(dep55), dep55, 0, NULL, },
+  { NELS(dep40), dep40, NELS(dep29), dep29, },
+  { NELS(dep41), dep41, NELS(dep31), dep31, },
+  { NELS(dep43), dep43, NELS(dep42), dep42, },
+  { NELS(dep45), dep45, NELS(dep44), dep44, },
+  { NELS(dep47), dep47, NELS(dep46), dep46, },
+  { NELS(dep49), dep49, NELS(dep48), dep48, },
+  { NELS(dep51), dep51, NELS(dep50), dep50, },
+  { NELS(dep53), dep53, NELS(dep52), dep52, },
+  { NELS(dep55), dep55, NELS(dep54), dep54, },
   { NELS(dep57), dep57, NELS(dep56), dep56, },
   { NELS(dep59), dep59, NELS(dep58), dep58, },
   { NELS(dep61), dep61, NELS(dep60), dep60, },
   { NELS(dep63), dep63, NELS(dep62), dep62, },
-  { NELS(dep64), dep64, 0, NULL, },
-  { NELS(dep66), dep66, NELS(dep65), dep65, },
+  { NELS(dep65), dep65, NELS(dep64), dep64, },
+  { NELS(dep66), dep66, NELS(dep31), dep31, },
   { NELS(dep68), dep68, NELS(dep67), dep67, },
   { NELS(dep70), dep70, NELS(dep69), dep69, },
-  { NELS(dep71), dep71, 0, NULL, },
-  { NELS(dep72), dep72, 0, NULL, },
-  { NELS(dep73), dep73, 0, NULL, },
-  { NELS(dep74), dep74, 0, NULL, },
-  { NELS(dep76), dep76, NELS(dep75), dep75, },
-  { NELS(dep78), dep78, NELS(dep77), dep77, },
-  { NELS(dep80), dep80, NELS(dep79), dep79, },
-  { NELS(dep82), dep82, NELS(dep81), dep81, },
-  { NELS(dep84), dep84, NELS(dep83), dep83, },
-  { NELS(dep86), dep86, NELS(dep85), dep85, },
-  { NELS(dep88), dep88, NELS(dep87), dep87, },
-  { NELS(dep90), dep90, NELS(dep89), dep89, },
-  { NELS(dep92), dep92, NELS(dep91), dep91, },
-  { NELS(dep94), dep94, NELS(dep93), dep93, },
-  { NELS(dep95), dep95, NELS(dep4), dep4, },
-  { NELS(dep96), dep96, 0, NULL, },
-  { NELS(dep97), dep97, NELS(dep51), dep51, },
-  { NELS(dep98), dep98, 0, NULL, },
-  { NELS(dep100), dep100, NELS(dep99), dep99, },
-  { NELS(dep101), dep101, NELS(dep0), dep0, },
+  { NELS(dep72), dep72, NELS(dep71), dep71, },
+  { NELS(dep74), dep74, NELS(dep73), dep73, },
+  { NELS(dep75), dep75, NELS(dep31), dep31, },
+  { NELS(dep77), dep77, NELS(dep76), dep76, },
+  { NELS(dep79), dep79, NELS(dep78), dep78, },
+  { NELS(dep81), dep81, NELS(dep80), dep80, },
+  { NELS(dep82), dep82, NELS(dep31), dep31, },
+  { NELS(dep83), dep83, NELS(dep31), dep31, },
+  { NELS(dep84), dep84, NELS(dep31), dep31, },
+  { NELS(dep85), dep85, NELS(dep31), dep31, },
+  { NELS(dep87), dep87, NELS(dep86), dep86, },
+  { NELS(dep89), dep89, NELS(dep88), dep88, },
+  { NELS(dep91), dep91, NELS(dep90), dep90, },
+  { NELS(dep93), dep93, NELS(dep92), dep92, },
+  { NELS(dep95), dep95, NELS(dep94), dep94, },
+  { NELS(dep97), dep97, NELS(dep96), dep96, },
+  { NELS(dep99), dep99, NELS(dep98), dep98, },
+  { NELS(dep101), dep101, NELS(dep100), dep100, },
   { NELS(dep103), dep103, NELS(dep102), dep102, },
   { NELS(dep105), dep105, NELS(dep104), dep104, },
-  { NELS(dep106), dep106, NELS(dep0), dep0, },
-  { NELS(dep107), dep107, NELS(dep0), dep0, },
+  { NELS(dep107), dep107, NELS(dep106), dep106, },
   { NELS(dep109), dep109, NELS(dep108), dep108, },
-  { NELS(dep110), dep110, NELS(dep0), dep0, },
-  { NELS(dep111), dep111, NELS(dep4), dep4, },
-  { NELS(dep112), dep112, 0, NULL, },
-  { NELS(dep113), dep113, NELS(dep7), dep7, },
-  { NELS(dep114), dep114, NELS(dep9), dep9, },
-  { NELS(dep115), dep115, NELS(dep11), dep11, },
-  { NELS(dep116), dep116, 0, NULL, },
-  { NELS(dep118), dep118, NELS(dep117), dep117, },
-  { NELS(dep119), dep119, NELS(dep117), dep117, },
-  { NELS(dep121), dep121, NELS(dep120), dep120, },
-  { NELS(dep122), dep122, NELS(dep120), dep120, },
-  { NELS(dep123), dep123, NELS(dep117), dep117, },
-  { NELS(dep125), dep125, NELS(dep124), dep124, },
-  { NELS(dep126), dep126, 0, NULL, },
-  { NELS(dep127), dep127, 0, NULL, },
-  { NELS(dep128), dep128, 0, NULL, },
+  { NELS(dep111), dep111, NELS(dep110), dep110, },
+  { NELS(dep113), dep113, NELS(dep112), dep112, },
+  { NELS(dep115), dep115, NELS(dep114), dep114, },
+  { NELS(dep117), dep117, NELS(dep116), dep116, },
+  { NELS(dep119), dep119, NELS(dep118), dep118, },
+  { NELS(dep120), dep120, NELS(dep62), dep62, },
+  { NELS(dep121), dep121, NELS(dep31), dep31, },
+  { NELS(dep123), dep123, NELS(dep122), dep122, },
+  { NELS(dep124), dep124, NELS(dep0), dep0, },
+  { NELS(dep126), dep126, NELS(dep125), dep125, },
+  { NELS(dep128), dep128, NELS(dep127), dep127, },
   { NELS(dep129), dep129, NELS(dep0), dep0, },
-  { NELS(dep131), dep131, NELS(dep130), dep130, },
-  { NELS(dep133), dep133, NELS(dep132), dep132, },
-  { NELS(dep135), dep135, NELS(dep134), dep134, },
-  { NELS(dep137), dep137, NELS(dep136), dep136, },
+  { NELS(dep130), dep130, NELS(dep0), dep0, },
+  { NELS(dep132), dep132, NELS(dep131), dep131, },
+  { NELS(dep133), dep133, NELS(dep0), dep0, },
+  { NELS(dep134), dep134, NELS(dep31), dep31, },
+  { NELS(dep136), dep136, NELS(dep135), dep135, },
+  { NELS(dep137), dep137, NELS(dep135), dep135, },
   { NELS(dep139), dep139, NELS(dep138), dep138, },
-  { NELS(dep140), dep140, NELS(dep0), dep0, },
-  { NELS(dep141), dep141, NELS(dep0), dep0, },
+  { NELS(dep140), dep140, NELS(dep138), dep138, },
+  { NELS(dep141), dep141, NELS(dep135), dep135, },
   { NELS(dep143), dep143, NELS(dep142), dep142, },
-  { NELS(dep144), dep144, NELS(dep142), dep142, },
-  { NELS(dep146), dep146, NELS(dep145), dep145, },
-  { NELS(dep148), dep148, NELS(dep147), dep147, },
-  { NELS(dep150), dep150, NELS(dep149), dep149, },
+  { NELS(dep145), dep145, NELS(dep144), dep144, },
+  { NELS(dep147), dep147, NELS(dep146), dep146, },
+  { NELS(dep149), dep149, NELS(dep148), dep148, },
+  { NELS(dep150), dep150, NELS(dep0), dep0, },
   { NELS(dep152), dep152, NELS(dep151), dep151, },
   { NELS(dep154), dep154, NELS(dep153), dep153, },
   { NELS(dep156), dep156, NELS(dep155), dep155, },
   { NELS(dep158), dep158, NELS(dep157), dep157, },
   { NELS(dep160), dep160, NELS(dep159), dep159, },
-  { NELS(dep162), dep162, NELS(dep161), dep161, },
+  { NELS(dep161), dep161, NELS(dep0), dep0, },
+  { NELS(dep162), dep162, NELS(dep0), dep0, },
   { NELS(dep163), dep163, NELS(dep0), dep0, },
-  { NELS(dep164), dep164, NELS(dep0), dep0, },
-  { NELS(dep165), dep165, NELS(dep0), dep0, },
-  { NELS(dep166), dep166, NELS(dep0), dep0, },
-  { NELS(dep167), dep167, NELS(dep0), dep0, },
-  { NELS(dep168), dep168, NELS(dep0), dep0, },
-  { NELS(dep169), dep169, NELS(dep0), dep0, },
-  { NELS(dep170), dep170, NELS(dep0), dep0, },
-  { NELS(dep172), dep172, NELS(dep171), dep171, },
-  { NELS(dep174), dep174, NELS(dep173), dep173, },
-  { NELS(dep176), dep176, NELS(dep175), dep175, },
-  { NELS(dep178), dep178, NELS(dep177), dep177, },
-  { NELS(dep179), dep179, NELS(dep0), dep0, },
-  { NELS(dep180), dep180, NELS(dep0), dep0, },
-  { NELS(dep181), dep181, NELS(dep0), dep0, },
-  { NELS(dep182), dep182, NELS(dep0), dep0, },
-  { NELS(dep183), dep183, 0, NULL, },
-  { NELS(dep184), dep184, 0, NULL, },
-  { NELS(dep185), dep185, NELS(dep171), dep171, },
+  { NELS(dep164), dep164, NELS(dep31), dep31, },
+  { NELS(dep166), dep166, NELS(dep165), dep165, },
+  { NELS(dep167), dep167, NELS(dep165), dep165, },
+  { NELS(dep169), dep169, NELS(dep168), dep168, },
+  { NELS(dep171), dep171, NELS(dep170), dep170, },
+  { NELS(dep173), dep173, NELS(dep172), dep172, },
+  { NELS(dep175), dep175, NELS(dep174), dep174, },
+  { NELS(dep177), dep177, NELS(dep176), dep176, },
+  { NELS(dep179), dep179, NELS(dep178), dep178, },
+  { NELS(dep181), dep181, NELS(dep180), dep180, },
+  { NELS(dep183), dep183, NELS(dep182), dep182, },
+  { NELS(dep185), dep185, NELS(dep184), dep184, },
   { NELS(dep186), dep186, NELS(dep0), dep0, },
   { NELS(dep187), dep187, NELS(dep0), dep0, },
-  { NELS(dep189), dep189, NELS(dep188), dep188, },
-  { NELS(dep190), dep190, NELS(dep188), dep188, },
+  { NELS(dep188), dep188, NELS(dep0), dep0, },
+  { NELS(dep189), dep189, NELS(dep0), dep0, },
+  { NELS(dep190), dep190, NELS(dep0), dep0, },
   { NELS(dep191), dep191, NELS(dep0), dep0, },
-  { NELS(dep189), dep189, NELS(dep192), dep192, },
-  { NELS(dep194), dep194, NELS(dep193), dep193, },
-  { NELS(dep196), dep196, NELS(dep195), dep195, },
-  { NELS(dep197), dep197, NELS(dep195), dep195, },
-  { NELS(dep198), dep198, NELS(dep0), dep0, },
-  { NELS(dep199), dep199, NELS(dep51), dep51, },
-  { NELS(dep200), dep200, NELS(dep51), dep51, },
-  { NELS(dep202), dep202, NELS(dep201), dep201, },
-  { NELS(dep203), dep203, NELS(dep201), dep201, },
-  { NELS(dep202), dep202, NELS(dep204), dep204, },
-  { NELS(dep206), dep206, NELS(dep205), dep205, },
-  { NELS(dep207), dep207, 0, NULL, },
-  { NELS(dep208), dep208, 0, NULL, },
+  { NELS(dep192), dep192, NELS(dep0), dep0, },
+  { NELS(dep193), dep193, NELS(dep0), dep0, },
+  { NELS(dep195), dep195, NELS(dep194), dep194, },
+  { NELS(dep197), dep197, NELS(dep196), dep196, },
+  { NELS(dep199), dep199, NELS(dep198), dep198, },
+  { NELS(dep201), dep201, NELS(dep200), dep200, },
+  { NELS(dep202), dep202, NELS(dep0), dep0, },
+  { NELS(dep203), dep203, NELS(dep0), dep0, },
+  { NELS(dep204), dep204, NELS(dep0), dep0, },
+  { NELS(dep205), dep205, NELS(dep31), dep31, },
+  { NELS(dep206), dep206, NELS(dep31), dep31, },
+  { NELS(dep207), dep207, NELS(dep194), dep194, },
+  { NELS(dep208), dep208, NELS(dep0), dep0, },
   { NELS(dep209), dep209, NELS(dep0), dep0, },
-  { NELS(dep210), dep210, NELS(dep0), dep0, },
-  { NELS(dep211), dep211, NELS(dep13), dep13, },
-  { NELS(dep213), dep213, NELS(dep212), dep212, },
+  { NELS(dep211), dep211, NELS(dep210), dep210, },
+  { NELS(dep212), dep212, NELS(dep210), dep210, },
+  { NELS(dep213), dep213, NELS(dep0), dep0, },
+  { NELS(dep211), dep211, NELS(dep214), dep214, },
+  { NELS(dep216), dep216, NELS(dep215), dep215, },
+  { NELS(dep218), dep218, NELS(dep217), dep217, },
+  { NELS(dep220), dep220, NELS(dep219), dep219, },
+  { NELS(dep221), dep221, NELS(dep219), dep219, },
+  { NELS(dep222), dep222, NELS(dep0), dep0, },
+  { NELS(dep223), dep223, NELS(dep62), dep62, },
+  { NELS(dep224), dep224, NELS(dep62), dep62, },
+  { NELS(dep226), dep226, NELS(dep225), dep225, },
+  { NELS(dep227), dep227, NELS(dep225), dep225, },
+  { NELS(dep226), dep226, NELS(dep228), dep228, },
+  { NELS(dep229), dep229, NELS(dep31), dep31, },
+  { NELS(dep230), dep230, NELS(dep31), dep31, },
+  { NELS(dep231), dep231, NELS(dep0), dep0, },
+  { NELS(dep232), dep232, NELS(dep0), dep0, },
+  { NELS(dep233), dep233, NELS(dep31), dep31, },
+  { 0, NULL, 0, NULL, },
+  { NELS(dep235), dep235, NELS(dep234), dep234, },
 };
 
 static const struct ia64_completer_table
@@ -1458,378 +1673,378 @@
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 1 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 1 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 85 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, 417, -1, 0, 1, 9 },
-  { 0x0, 0x0, 0, 480, -1, 0, 1, 20 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 140 },
-  { 0x0, 0x0, 0, 579, -1, 0, 1, 20 },
-  { 0x0, 0x0, 0, 1739, -1, 0, 1, 13 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 12 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 63 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 63 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 16 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 88 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, 416, -1, 0, 1, 6 },
+  { 0x0, 0x0, 0, 479, -1, 0, 1, 17 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 145 },
+  { 0x0, 0x0, 0, 578, -1, 0, 1, 17 },
+  { 0x0, 0x0, 0, 1742, -1, 0, 1, 10 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 9 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 71 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 71 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 13 },
   { 0x1, 0x1, 0, -1, -1, 13, 1, 0 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 30 },
-  { 0x0, 0x0, 0, 1912, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 30 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 30 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 118 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 41 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 37 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 75 },
-  { 0x0, 0x0, 0, 1779, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, 1955, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, 1783, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 30 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 30 },
-  { 0x0, 0x0, 0, 1785, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, 1964, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, 1967, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 30 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 30 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 30 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, 1985, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 30 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 30 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, 1988, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, 1991, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 30 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 32 },
-  { 0x0, 0x0, 0, 1997, -1, 0, 1, 26 },
-  { 0x0, 0x0, 0, 1118, -1, 0, 1, 30 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 37 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 30 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 74 },
-  { 0x0, 0x0, 0, 1151, -1, 0, 1, 120 },
-  { 0x0, 0x0, 0, 1160, -1, 0, 1, 120 },
-  { 0x0, 0x0, 0, 1169, -1, 0, 1, 120 },
-  { 0x0, 0x0, 0, 1178, -1, 0, 1, 120 },
-  { 0x0, 0x0, 0, 1187, -1, 0, 1, 120 },
-  { 0x0, 0x0, 0, 1196, -1, 0, 1, 120 },
-  { 0x0, 0x0, 0, 1205, -1, 0, 1, 120 },
-  { 0x0, 0x0, 0, 1214, -1, 0, 1, 120 },
-  { 0x0, 0x0, 0, 1223, -1, 0, 1, 120 },
-  { 0x0, 0x0, 0, 1233, -1, 0, 1, 120 },
-  { 0x0, 0x0, 0, 1243, -1, 0, 1, 120 },
-  { 0x0, 0x0, 0, 1253, -1, 0, 1, 120 },
-  { 0x0, 0x0, 0, 1262, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1268, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1274, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1280, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1286, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1292, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1298, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1304, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1310, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1316, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1322, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1328, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1334, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1340, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1346, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1352, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1358, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1364, -1, 0, 1, 130 },
-  { 0x0, 0x0, 0, 1368, -1, 0, 1, 136 },
-  { 0x0, 0x0, 0, 1372, -1, 0, 1, 138 },
-  { 0x0, 0x0, 0, 1376, -1, 0, 1, 138 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 76 },
-  { 0x0, 0x0, 0, 250, -1, 0, 1, 37 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 1 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 1 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 3 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 30 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 59 },
-  { 0x1, 0x1, 0, 933, -1, 20, 1, 59 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 60 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 61 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 62 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 63 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 64 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 83 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 84 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 33 },
+  { 0x0, 0x0, 0, 1918, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 33 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 33 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 122 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 44 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 40 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 78 },
+  { 0x0, 0x0, 0, 1782, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, 1961, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, 1786, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 33 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 33 },
+  { 0x0, 0x0, 0, 1788, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, 1970, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, 1973, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 33 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 33 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 33 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, 1995, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 33 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 33 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, 1998, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 24 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 24 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 24 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 24 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 33 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 35 },
+  { 0x0, 0x0, 0, 2006, -1, 0, 1, 29 },
+  { 0x0, 0x0, 0, 1121, -1, 0, 1, 33 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 40 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 33 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 77 },
+  { 0x0, 0x0, 0, 1154, -1, 0, 1, 124 },
+  { 0x0, 0x0, 0, 1163, -1, 0, 1, 124 },
+  { 0x0, 0x0, 0, 1172, -1, 0, 1, 124 },
+  { 0x0, 0x0, 0, 1181, -1, 0, 1, 124 },
+  { 0x0, 0x0, 0, 1190, -1, 0, 1, 124 },
+  { 0x0, 0x0, 0, 1199, -1, 0, 1, 124 },
+  { 0x0, 0x0, 0, 1208, -1, 0, 1, 124 },
+  { 0x0, 0x0, 0, 1217, -1, 0, 1, 124 },
+  { 0x0, 0x0, 0, 1226, -1, 0, 1, 124 },
+  { 0x0, 0x0, 0, 1236, -1, 0, 1, 124 },
+  { 0x0, 0x0, 0, 1246, -1, 0, 1, 124 },
+  { 0x0, 0x0, 0, 1256, -1, 0, 1, 124 },
+  { 0x0, 0x0, 0, 1265, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1271, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1277, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1283, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1289, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1295, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1301, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1307, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1313, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1319, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1325, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1331, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1337, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1343, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1349, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1355, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1361, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1367, -1, 0, 1, 135 },
+  { 0x0, 0x0, 0, 1371, -1, 0, 1, 140 },
+  { 0x0, 0x0, 0, 1375, -1, 0, 1, 142 },
+  { 0x0, 0x0, 0, 1379, -1, 0, 1, 142 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 79 },
+  { 0x0, 0x0, 0, 249, -1, 0, 1, 40 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 33 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 67 },
+  { 0x1, 0x1, 0, 934, -1, 20, 1, 67 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 68 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 69 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 70 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 71 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 72 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 86 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 87 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 88 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 89 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 90 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 91 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 92 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 93 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 94 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 95 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 96 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 97 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 98 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 99 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 100 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 101 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 102 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 103 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 104 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 105 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 106 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 107 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 108 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 141 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 141 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 141 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 63 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 109 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 110 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 111 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 112 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 113 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 146 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 146 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 146 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 71 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 140 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, 2283, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, 2284, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, 1751, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, 1752, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 145 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
   { 0x0, 0x0, 0, 2298, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, 2299, -1, 0, 1, 0 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 2299, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 2300, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 2301, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 2302, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 2285, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 2286, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 14 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 81 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 80 },
+  { 0x0, 0x0, 0, 1754, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, 1755, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, 2313, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, 2314, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, 2315, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, 2316, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, 2317, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, 2300, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, 2301, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 11 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 84 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 83 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
   { 0x1, 0x1, 0, -1, -1, 13, 1, 0 },
-  { 0x0, 0x0, 0, 2304, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, 2319, -1, 0, 1, 0 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 81 },
-  { 0x0, 0x0, 0, 1640, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1642, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1644, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1646, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1648, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1650, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1653, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1656, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1659, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1660, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1661, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1662, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1663, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1664, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1665, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1666, -1, 0, 1, 2 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 84 },
+  { 0x0, 0x0, 0, 1643, -1, 0, 1, 130 },
+  { 0x0, 0x0, 0, 1645, -1, 0, 1, 130 },
+  { 0x0, 0x0, 0, 1647, -1, 0, 1, 130 },
+  { 0x0, 0x0, 0, 1649, -1, 0, 1, 130 },
+  { 0x0, 0x0, 0, 1651, -1, 0, 1, 130 },
+  { 0x0, 0x0, 0, 1653, -1, 0, 1, 130 },
+  { 0x0, 0x0, 0, 1656, -1, 0, 1, 130 },
+  { 0x0, 0x0, 0, 1659, -1, 0, 1, 130 },
+  { 0x0, 0x0, 0, 1662, -1, 0, 1, 130 },
+  { 0x0, 0x0, 0, 1663, -1, 0, 1, 130 },
+  { 0x0, 0x0, 0, 1664, -1, 0, 1, 130 },
+  { 0x0, 0x0, 0, 1665, -1, 0, 1, 130 },
+  { 0x0, 0x0, 0, 1666, -1, 0, 1, 130 },
+  { 0x0, 0x0, 0, 1667, -1, 0, 1, 130 },
+  { 0x0, 0x0, 0, 1668, -1, 0, 1, 130 },
+  { 0x0, 0x0, 0, 1669, -1, 0, 1, 130 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
   { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 79 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 116 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 113 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 115 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 114 },
-  { 0x0, 0x0, 0, 1377, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1378, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1379, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, 1380, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 1 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 1 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 2 },
-  { 0x0, 0x0, 0, -1, -1, 0, 1, 2 },
-  { 0x0, 0x0, 1, 217, -1, 0, 1, 15 },
-  { 0x1, 0x1, 2, -1, -1, 27, 1, 15 },
-  { 0x0, 0x0, 3, -1, 1062, 0, 0, -1 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 82 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 120 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 118 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 120 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 119 },
+  { 0x0, 0x0, 0, 1380, -1, 0, 1, 133 },
+  { 0x0, 0x0, 0, 1381, -1, 0, 1, 133 },
+  { 0x0, 0x0, 0, 1382, -1, 0, 1, 133 },
+  { 0x0, 0x0, 0, 1383, -1, 0, 1, 133 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 0, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 1, 216, -1, 0, 1, 12 },
+  { 0x1, 0x1, 2, -1, -1, 27, 1, 12 },
   { 0x0, 0x0, 3, -1, 1063, 0, 0, -1 },
-  { 0x1, 0x1, 3, 2174, 1144, 33, 1, 122 },
-  { 0x1, 0x1, 3, 2175, 1153, 33, 1, 122 },
-  { 0x1, 0x1, 3, 2176, 1162, 33, 1, 122 },
-  { 0x1, 0x1, 3, 2177, 1171, 33, 1, 122 },
-  { 0x1, 0x1, 3, 2178, 1180, 33, 1, 122 },
-  { 0x1, 0x1, 3, 2179, 1189, 33, 1, 122 },
-  { 0x1, 0x1, 3, 2180, 1198, 33, 1, 122 },
-  { 0x1, 0x1, 3, 2181, 1207, 33, 1, 122 },
-  { 0x1, 0x1, 3, 2182, 1216, 33, 1, 122 },
-  { 0x1, 0x1, 3, 2183, 1225, 33, 1, 122 },
-  { 0x1, 0x1, 3, 2184, 1235, 33, 1, 122 },
-  { 0x1, 0x1, 3, 2185, 1245, 33, 1, 122 },
-  { 0x1, 0x1, 3, 2186, 1258, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2187, 1264, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2188, 1270, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2189, 1276, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2190, 1282, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2191, 1288, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2192, 1294, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2193, 1300, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2194, 1306, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2195, 1312, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2196, 1318, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2197, 1324, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2198, 1330, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2199, 1336, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2200, 1342, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2201, 1348, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2202, 1354, 33, 1, 132 },
-  { 0x1, 0x1, 3, 2203, 1360, 33, 1, 132 },
-  { 0x1, 0x1, 3, -1, -1, 27, 1, 37 },
-  { 0x0, 0x0, 4, 1753, 1131, 0, 1, 127 },
-  { 0x0, 0x0, 4, 1754, 1133, 0, 1, 127 },
-  { 0x0, 0x0, 4, 1755, 1135, 0, 1, 127 },
-  { 0x0, 0x0, 4, 1756, 1137, 0, 1, 127 },
-  { 0x0, 0x0, 4, 1757, 1139, 0, 1, 128 },
-  { 0x0, 0x0, 4, 1758, 1141, 0, 1, 128 },
-  { 0x1, 0x1, 4, -1, 1148, 33, 1, 125 },
-  { 0x5, 0x5, 4, 375, 1147, 32, 1, 120 },
-  { 0x1, 0x1, 4, -1, 1157, 33, 1, 125 },
-  { 0x5, 0x5, 4, 376, 1156, 32, 1, 120 },
-  { 0x1, 0x1, 4, -1, 1166, 33, 1, 125 },
-  { 0x5, 0x5, 4, 377, 1165, 32, 1, 120 },
-  { 0x1, 0x1, 4, -1, 1175, 33, 1, 125 },
-  { 0x5, 0x5, 4, 378, 1174, 32, 1, 120 },
-  { 0x1, 0x1, 4, -1, 1184, 33, 1, 125 },
-  { 0x5, 0x5, 4, 379, 1183, 32, 1, 120 },
-  { 0x1, 0x1, 4, -1, 1193, 33, 1, 125 },
-  { 0x5, 0x5, 4, 380, 1192, 32, 1, 120 },
-  { 0x1, 0x1, 4, -1, 1202, 33, 1, 125 },
-  { 0x5, 0x5, 4, 381, 1201, 32, 1, 120 },
-  { 0x1, 0x1, 4, -1, 1211, 33, 1, 125 },
-  { 0x5, 0x5, 4, 382, 1210, 32, 1, 120 },
-  { 0x1, 0x1, 4, -1, 1220, 33, 1, 125 },
-  { 0x5, 0x5, 4, 383, 1219, 32, 1, 120 },
-  { 0x1, 0x1, 4, -1, 1230, 33, 1, 125 },
-  { 0x5, 0x5, 4, 849, 1228, 32, 1, 120 },
-  { 0x1, 0x1, 4, -1, 1240, 33, 1, 125 },
-  { 0x5, 0x5, 4, 850, 1238, 32, 1, 120 },
-  { 0x1, 0x1, 4, -1, 1250, 33, 1, 125 },
-  { 0x5, 0x5, 4, 851, 1248, 32, 1, 120 },
-  { 0x1, 0x21, 10, 1675, -1, 33, 1, 6 },
-  { 0x200001, 0x200001, 10, 1676, -1, 12, 1, 6 },
-  { 0x0, 0x0, 10, 1677, -1, 0, 1, 6 },
-  { 0x1, 0x1, 10, 1678, -1, 12, 1, 6 },
-  { 0x1, 0x1, 10, 1679, -1, 33, 1, 6 },
-  { 0x200001, 0x200001, 10, 1680, -1, 12, 1, 6 },
-  { 0x1, 0x21, 10, 1681, -1, 33, 1, 6 },
-  { 0x200001, 0x200001, 10, 1682, -1, 12, 1, 6 },
-  { 0x0, 0x0, 10, -1, 1703, 0, 0, -1 },
-  { 0x0, 0x0, 10, -1, 1704, 0, 0, -1 },
-  { 0x0, 0x0, 10, -1, 1705, 0, 0, -1 },
+  { 0x0, 0x0, 3, -1, 1064, 0, 0, -1 },
+  { 0x1, 0x1, 3, 2189, 1147, 33, 1, 126 },
+  { 0x1, 0x1, 3, 2190, 1156, 33, 1, 126 },
+  { 0x1, 0x1, 3, 2191, 1165, 33, 1, 126 },
+  { 0x1, 0x1, 3, 2192, 1174, 33, 1, 126 },
+  { 0x1, 0x1, 3, 2193, 1183, 33, 1, 126 },
+  { 0x1, 0x1, 3, 2194, 1192, 33, 1, 126 },
+  { 0x1, 0x1, 3, 2195, 1201, 33, 1, 126 },
+  { 0x1, 0x1, 3, 2196, 1210, 33, 1, 126 },
+  { 0x1, 0x1, 3, 2197, 1219, 33, 1, 126 },
+  { 0x1, 0x1, 3, 2198, 1228, 33, 1, 126 },
+  { 0x1, 0x1, 3, 2199, 1238, 33, 1, 126 },
+  { 0x1, 0x1, 3, 2200, 1248, 33, 1, 126 },
+  { 0x1, 0x1, 3, 2201, 1261, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2202, 1267, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2203, 1273, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2204, 1279, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2205, 1285, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2206, 1291, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2207, 1297, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2208, 1303, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2209, 1309, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2210, 1315, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2211, 1321, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2212, 1327, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2213, 1333, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2214, 1339, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2215, 1345, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2216, 1351, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2217, 1357, 33, 1, 137 },
+  { 0x1, 0x1, 3, 2218, 1363, 33, 1, 137 },
+  { 0x1, 0x1, 3, -1, -1, 27, 1, 40 },
+  { 0x0, 0x0, 4, 1756, 1134, 0, 1, 132 },
+  { 0x0, 0x0, 4, 1757, 1136, 0, 1, 132 },
+  { 0x0, 0x0, 4, 1758, 1138, 0, 1, 132 },
+  { 0x0, 0x0, 4, 1759, 1140, 0, 1, 132 },
+  { 0x0, 0x0, 4, 1760, 1142, 0, 1, 133 },
+  { 0x0, 0x0, 4, 1761, 1144, 0, 1, 133 },
+  { 0x1, 0x1, 4, -1, 1151, 33, 1, 129 },
+  { 0x5, 0x5, 4, 374, 1150, 32, 1, 124 },
+  { 0x1, 0x1, 4, -1, 1160, 33, 1, 129 },
+  { 0x5, 0x5, 4, 375, 1159, 32, 1, 124 },
+  { 0x1, 0x1, 4, -1, 1169, 33, 1, 129 },
+  { 0x5, 0x5, 4, 376, 1168, 32, 1, 124 },
+  { 0x1, 0x1, 4, -1, 1178, 33, 1, 129 },
+  { 0x5, 0x5, 4, 377, 1177, 32, 1, 124 },
+  { 0x1, 0x1, 4, -1, 1187, 33, 1, 129 },
+  { 0x5, 0x5, 4, 378, 1186, 32, 1, 124 },
+  { 0x1, 0x1, 4, -1, 1196, 33, 1, 129 },
+  { 0x5, 0x5, 4, 379, 1195, 32, 1, 124 },
+  { 0x1, 0x1, 4, -1, 1205, 33, 1, 129 },
+  { 0x5, 0x5, 4, 380, 1204, 32, 1, 124 },
+  { 0x1, 0x1, 4, -1, 1214, 33, 1, 129 },
+  { 0x5, 0x5, 4, 381, 1213, 32, 1, 124 },
+  { 0x1, 0x1, 4, -1, 1223, 33, 1, 129 },
+  { 0x5, 0x5, 4, 382, 1222, 32, 1, 124 },
+  { 0x1, 0x1, 4, -1, 1233, 33, 1, 129 },
+  { 0x5, 0x5, 4, 848, 1231, 32, 1, 124 },
+  { 0x1, 0x1, 4, -1, 1243, 33, 1, 129 },
+  { 0x5, 0x5, 4, 849, 1241, 32, 1, 124 },
+  { 0x1, 0x1, 4, -1, 1253, 33, 1, 129 },
+  { 0x5, 0x5, 4, 850, 1251, 32, 1, 124 },
+  { 0x1, 0x21, 10, 1678, -1, 33, 1, 3 },
+  { 0x200001, 0x200001, 10, 1679, -1, 12, 1, 3 },
+  { 0x0, 0x0, 10, 1680, -1, 0, 1, 3 },
+  { 0x1, 0x1, 10, 1681, -1, 12, 1, 3 },
+  { 0x1, 0x1, 10, 1682, -1, 33, 1, 3 },
+  { 0x200001, 0x200001, 10, 1683, -1, 12, 1, 3 },
+  { 0x1, 0x21, 10, 1684, -1, 33, 1, 3 },
+  { 0x200001, 0x200001, 10, 1685, -1, 12, 1, 3 },
   { 0x0, 0x0, 10, -1, 1706, 0, 0, -1 },
   { 0x0, 0x0, 10, -1, 1707, 0, 0, -1 },
   { 0x0, 0x0, 10, -1, 1708, 0, 0, -1 },
   { 0x0, 0x0, 10, -1, 1709, 0, 0, -1 },
   { 0x0, 0x0, 10, -1, 1710, 0, 0, -1 },
-  { 0x1, 0x21, 10, 1683, -1, 33, 1, 6 },
-  { 0x200001, 0x200001, 10, 1684, -1, 12, 1, 6 },
-  { 0x0, 0x0, 10, 1685, -1, 0, 1, 6 },
-  { 0x1, 0x1, 10, 1686, -1, 12, 1, 6 },
-  { 0x1, 0x1, 10, 1687, -1, 33, 1, 6 },
-  { 0x200001, 0x200001, 10, 1688, -1, 12, 1, 6 },
-  { 0x1, 0x21, 10, 1689, -1, 33, 1, 6 },
-  { 0x200001, 0x200001, 10, 1690, -1, 12, 1, 6 },
-  { 0x0, 0x0, 10, -1, 1719, 0, 0, -1 },
-  { 0x0, 0x0, 10, -1, 1720, 0, 0, -1 },
-  { 0x0, 0x0, 10, -1, 1721, 0, 0, -1 },
+  { 0x0, 0x0, 10, -1, 1711, 0, 0, -1 },
+  { 0x0, 0x0, 10, -1, 1712, 0, 0, -1 },
+  { 0x0, 0x0, 10, -1, 1713, 0, 0, -1 },
+  { 0x1, 0x21, 10, 1686, -1, 33, 1, 3 },
+  { 0x200001, 0x200001, 10, 1687, -1, 12, 1, 3 },
+  { 0x0, 0x0, 10, 1688, -1, 0, 1, 3 },
+  { 0x1, 0x1, 10, 1689, -1, 12, 1, 3 },
+  { 0x1, 0x1, 10, 1690, -1, 33, 1, 3 },
+  { 0x200001, 0x200001, 10, 1691, -1, 12, 1, 3 },
+  { 0x1, 0x21, 10, 1692, -1, 33, 1, 3 },
+  { 0x200001, 0x200001, 10, 1693, -1, 12, 1, 3 },
   { 0x0, 0x0, 10, -1, 1722, 0, 0, -1 },
   { 0x0, 0x0, 10, -1, 1723, 0, 0, -1 },
   { 0x0, 0x0, 10, -1, 1724, 0, 0, -1 },
   { 0x0, 0x0, 10, -1, 1725, 0, 0, -1 },
   { 0x0, 0x0, 10, -1, 1726, 0, 0, -1 },
-  { 0x1, 0x1, 10, 1691, -1, 36, 1, 69 },
-  { 0x1000001, 0x1000001, 10, 1692, -1, 12, 1, 69 },
   { 0x0, 0x0, 10, -1, 1727, 0, 0, -1 },
+  { 0x0, 0x0, 10, -1, 1728, 0, 0, -1 },
   { 0x0, 0x0, 10, -1, 1729, 0, 0, -1 },
-  { 0x1, 0x1, 10, 1693, -1, 36, 1, 69 },
-  { 0x1000001, 0x1000001, 10, 1694, -1, 12, 1, 69 },
-  { 0x0, 0x0, 10, -1, 1731, 0, 0, -1 },
-  { 0x0, 0x0, 10, -1, 1733, 0, 0, -1 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x0, 0x0, 11, 1695, -1, 0, 1, 6 },
-  { 0x1, 0x1, 11, 1696, -1, 12, 1, 6 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x0, 0x0, 11, 1697, -1, 0, 1, 6 },
-  { 0x1, 0x1, 11, 1698, -1, 12, 1, 6 },
-  { 0x1, 0x1, 11, 1699, -1, 33, 1, 6 },
-  { 0x200001, 0x200001, 11, 1700, -1, 12, 1, 6 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x0, 0x0, 11, 1701, -1, 0, 1, 6 },
-  { 0x1, 0x1, 11, 1702, -1, 12, 1, 6 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x0, 0x0, 11, 1711, -1, 0, 1, 6 },
-  { 0x1, 0x1, 11, 1712, -1, 12, 1, 6 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x0, 0x0, 11, 1713, -1, 0, 1, 6 },
-  { 0x1, 0x1, 11, 1714, -1, 12, 1, 6 },
-  { 0x1, 0x1, 11, 1715, -1, 33, 1, 6 },
-  { 0x200001, 0x200001, 11, 1716, -1, 12, 1, 6 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x2, 0x3, 11, -1, -1, 37, 1, 8 },
-  { 0x0, 0x0, 11, 1717, -1, 0, 1, 6 },
-  { 0x1, 0x1, 11, 1718, -1, 12, 1, 6 },
-  { 0x1, 0x1, 11, -1, -1, 36, 1, 71 },
-  { 0x1, 0x1, 11, -1, -1, 36, 1, 71 },
-  { 0x1, 0x1, 11, 1728, -1, 36, 1, 69 },
-  { 0x1000001, 0x1000001, 11, 1730, -1, 12, 1, 69 },
-  { 0x1, 0x1, 11, -1, -1, 36, 1, 71 },
-  { 0x1, 0x1, 11, -1, -1, 36, 1, 71 },
-  { 0x1, 0x1, 11, 1732, -1, 36, 1, 69 },
-  { 0x1000001, 0x1000001, 11, 1734, -1, 12, 1, 69 },
-  { 0x0, 0x0, 12, -1, -1, 0, 1, 17 },
-  { 0x0, 0x0, 12, -1, -1, 0, 1, 17 },
-  { 0x1, 0x1, 13, 258, 1146, 34, 1, 120 },
-  { 0x1, 0x1, 13, 260, 1155, 34, 1, 120 },
-  { 0x1, 0x1, 13, 262, 1164, 34, 1, 120 },
-  { 0x1, 0x1, 13, 264, 1173, 34, 1, 120 },
-  { 0x1, 0x1, 13, 266, 1182, 34, 1, 120 },
-  { 0x1, 0x1, 13, 268, 1191, 34, 1, 120 },
-  { 0x1, 0x1, 13, 270, 1200, 34, 1, 120 },
-  { 0x1, 0x1, 13, 272, 1209, 34, 1, 120 },
-  { 0x1, 0x1, 13, 274, 1218, 34, 1, 120 },
-  { 0x1, 0x1, 13, 276, 1227, 34, 1, 120 },
-  { 0x1, 0x1, 13, 278, 1237, 34, 1, 120 },
-  { 0x1, 0x1, 13, 280, 1247, 34, 1, 120 },
+  { 0x1, 0x1, 10, 1694, -1, 36, 1, 3 },
+  { 0x1000001, 0x1000001, 10, 1695, -1, 12, 1, 3 },
+  { 0x0, 0x0, 10, -1, 1730, 0, 0, -1 },
+  { 0x0, 0x0, 10, -1, 1732, 0, 0, -1 },
+  { 0x1, 0x1, 10, 1696, -1, 36, 1, 3 },
+  { 0x1000001, 0x1000001, 10, 1697, -1, 12, 1, 3 },
+  { 0x0, 0x0, 10, -1, 1734, 0, 0, -1 },
+  { 0x0, 0x0, 10, -1, 1736, 0, 0, -1 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x0, 0x0, 11, 1698, -1, 0, 1, 3 },
+  { 0x1, 0x1, 11, 1699, -1, 12, 1, 3 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x0, 0x0, 11, 1700, -1, 0, 1, 3 },
+  { 0x1, 0x1, 11, 1701, -1, 12, 1, 3 },
+  { 0x1, 0x1, 11, 1702, -1, 33, 1, 3 },
+  { 0x200001, 0x200001, 11, 1703, -1, 12, 1, 3 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x0, 0x0, 11, 1704, -1, 0, 1, 3 },
+  { 0x1, 0x1, 11, 1705, -1, 12, 1, 3 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x0, 0x0, 11, 1714, -1, 0, 1, 3 },
+  { 0x1, 0x1, 11, 1715, -1, 12, 1, 3 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x0, 0x0, 11, 1716, -1, 0, 1, 3 },
+  { 0x1, 0x1, 11, 1717, -1, 12, 1, 3 },
+  { 0x1, 0x1, 11, 1718, -1, 33, 1, 3 },
+  { 0x200001, 0x200001, 11, 1719, -1, 12, 1, 3 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x2, 0x3, 11, -1, -1, 37, 1, 5 },
+  { 0x0, 0x0, 11, 1720, -1, 0, 1, 3 },
+  { 0x1, 0x1, 11, 1721, -1, 12, 1, 3 },
+  { 0x1, 0x1, 11, -1, -1, 36, 1, 5 },
+  { 0x1, 0x1, 11, -1, -1, 36, 1, 5 },
+  { 0x1, 0x1, 11, 1731, -1, 36, 1, 3 },
+  { 0x1000001, 0x1000001, 11, 1733, -1, 12, 1, 3 },
+  { 0x1, 0x1, 11, -1, -1, 36, 1, 5 },
+  { 0x1, 0x1, 11, -1, -1, 36, 1, 5 },
+  { 0x1, 0x1, 11, 1735, -1, 36, 1, 3 },
+  { 0x1000001, 0x1000001, 11, 1737, -1, 12, 1, 3 },
+  { 0x0, 0x0, 12, -1, -1, 0, 1, 14 },
+  { 0x0, 0x0, 12, -1, -1, 0, 1, 14 },
+  { 0x1, 0x1, 13, 257, 1149, 34, 1, 124 },
+  { 0x1, 0x1, 13, 259, 1158, 34, 1, 124 },
+  { 0x1, 0x1, 13, 261, 1167, 34, 1, 124 },
+  { 0x1, 0x1, 13, 263, 1176, 34, 1, 124 },
+  { 0x1, 0x1, 13, 265, 1185, 34, 1, 124 },
+  { 0x1, 0x1, 13, 267, 1194, 34, 1, 124 },
+  { 0x1, 0x1, 13, 269, 1203, 34, 1, 124 },
+  { 0x1, 0x1, 13, 271, 1212, 34, 1, 124 },
+  { 0x1, 0x1, 13, 273, 1221, 34, 1, 124 },
+  { 0x1, 0x1, 13, 275, 1230, 34, 1, 124 },
+  { 0x1, 0x1, 13, 277, 1240, 34, 1, 124 },
+  { 0x1, 0x1, 13, 279, 1250, 34, 1, 124 },
+  { 0x0, 0x0, 19, -1, 617, 0, 0, -1 },
   { 0x0, 0x0, 19, -1, 618, 0, 0, -1 },
   { 0x0, 0x0, 19, -1, 619, 0, 0, -1 },
   { 0x0, 0x0, 19, -1, 620, 0, 0, -1 },
@@ -1859,68 +2074,106 @@
   { 0x0, 0x0, 19, -1, 644, 0, 0, -1 },
   { 0x0, 0x0, 19, -1, 645, 0, 0, -1 },
   { 0x0, 0x0, 19, -1, 646, 0, 0, -1 },
-  { 0x0, 0x0, 19, -1, 647, 0, 0, -1 },
-  { 0x0, 0x0, 20, -1, 2252, 0, 0, -1 },
-  { 0x0, 0x0, 20, -1, 2253, 0, 0, -1 },
+  { 0x0, 0x0, 20, -1, 2267, 0, 0, -1 },
   { 0x0, 0x0, 20, -1, 2268, 0, 0, -1 },
-  { 0x0, 0x0, 20, -1, 2269, 0, 0, -1 },
-  { 0x0, 0x0, 20, -1, 2274, 0, 0, -1 },
-  { 0x0, 0x0, 20, -1, 2275, 0, 0, -1 },
-  { 0x0, 0x0, 21, 654, 2264, 0, 0, -1 },
-  { 0x0, 0x0, 21, 655, 2266, 0, 0, -1 },
-  { 0x0, 0x0, 23, -1, 2262, 0, 0, -1 },
-  { 0x0, 0x0, 23, -1, 2263, 0, 0, -1 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, 995, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 10 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 10 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 10 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 10 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 10 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 10 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 10 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 10 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 9 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 10 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 10 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 10 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 10 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 11 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 11 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 11 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 11 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 11 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 11 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 11 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 11 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 11 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 11 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 11 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 11 },
+  { 0x0, 0x0, 20, -1, 2283, 0, 0, -1 },
+  { 0x0, 0x0, 20, -1, 2284, 0, 0, -1 },
+  { 0x0, 0x0, 20, -1, 2289, 0, 0, -1 },
+  { 0x0, 0x0, 20, -1, 2290, 0, 0, -1 },
+  { 0x0, 0x0, 21, 653, 2279, 0, 0, -1 },
+  { 0x0, 0x0, 21, 654, 2281, 0, 0, -1 },
+  { 0x0, 0x0, 23, -1, 2277, 0, 0, -1 },
+  { 0x0, 0x0, 23, -1, 2278, 0, 0, -1 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, 996, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 7 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 7 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 7 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 7 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 7 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 7 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 7 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 7 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 6 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 7 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 7 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 7 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 7 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 8 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 8 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 8 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 8 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 8 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 8 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 8 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 8 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 8 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 8 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 8 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 8 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 15 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 15 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 15 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 15 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 15 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 15 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 15 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 15 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 15 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 15 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 15 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 15 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, 1017, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
   { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
   { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
   { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
@@ -1933,9 +2186,30 @@
   { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
   { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
   { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, 1016, -1, 35, 1, 20 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 18 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 19 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 19 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 19 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 19 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 19 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 19 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 19 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 19 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 19 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 19 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 19 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 19 },
   { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
   { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
   { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
@@ -1972,6 +2246,33 @@
   { 0x1, 0x1, 24, -1, -1, 35, 1, 21 },
   { 0x1, 0x1, 24, -1, -1, 35, 1, 21 },
   { 0x1, 0x1, 24, -1, -1, 35, 1, 21 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, 1050, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
+  { 0x1, 0x1, 24, -1, -1, 35, 1, 17 },
   { 0x1, 0x1, 24, -1, -1, 35, 1, 21 },
   { 0x1, 0x1, 24, -1, -1, 35, 1, 21 },
   { 0x1, 0x1, 24, -1, -1, 35, 1, 21 },
@@ -1984,2400 +2285,2329 @@
   { 0x1, 0x1, 24, -1, -1, 35, 1, 21 },
   { 0x1, 0x1, 24, -1, -1, 35, 1, 21 },
   { 0x1, 0x1, 24, -1, -1, 35, 1, 21 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 22 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 22 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 22 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 22 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 22 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 22 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 22 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 22 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 22 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 22 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 22 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 22 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 23 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, 1049, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 20 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 35, 1, 24 },
-  { 0x1, 0x1, 24, -1, -1, 33, 1, 73 },
-  { 0x1, 0x1, 24, -1, -1, 33, 1, 73 },
-  { 0x1, 0x1, 24, 1064, 1149, 35, 1, 125 },
-  { 0x1, 0x1, 24, 1065, 1158, 35, 1, 125 },
-  { 0x1, 0x1, 24, 1066, 1167, 35, 1, 125 },
-  { 0x1, 0x1, 24, 1067, 1176, 35, 1, 125 },
-  { 0x1, 0x1, 24, 1068, 1185, 35, 1, 125 },
-  { 0x1, 0x1, 24, 1069, 1194, 35, 1, 125 },
-  { 0x1, 0x1, 24, 1070, 1203, 35, 1, 125 },
-  { 0x1, 0x1, 24, 1071, 1212, 35, 1, 125 },
-  { 0x1, 0x1, 24, 1072, 1221, 35, 1, 125 },
-  { 0x1, 0x1, 24, 1073, 1231, 35, 1, 125 },
-  { 0x1, 0x1, 24, 1074, 1241, 35, 1, 125 },
-  { 0x1, 0x1, 24, 1075, 1251, 35, 1, 125 },
-  { 0x1, 0x1, 24, 1076, 1260, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1077, 1266, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1078, 1272, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1079, 1278, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1080, 1284, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1081, 1290, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1082, 1296, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1083, 1302, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1084, 1308, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1085, 1314, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1086, 1320, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1087, 1326, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1088, 1332, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1089, 1338, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1090, 1344, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1091, 1350, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1092, 1356, 35, 1, 134 },
-  { 0x1, 0x1, 24, 1093, 1362, 35, 1, 134 },
-  { 0x0, 0x0, 32, 2246, 2244, 0, 0, -1 },
-  { 0x0, 0x0, 32, 2249, 2247, 0, 0, -1 },
-  { 0x0, 0x0, 32, 2255, 2254, 0, 0, -1 },
-  { 0x0, 0x0, 32, 2257, 2256, 0, 0, -1 },
-  { 0x0, 0x0, 32, 2271, 2270, 0, 0, -1 },
-  { 0x0, 0x0, 32, 2273, 2272, 0, 0, -1 },
-  { 0x0, 0x0, 34, -1, 2265, 0, 0, -1 },
-  { 0x0, 0x0, 34, -1, 2267, 0, 0, -1 },
-  { 0x1, 0x1, 37, -1, 1823, 37, 1, 26 },
-  { 0x1, 0x1, 37, -1, 1858, 37, 1, 26 },
-  { 0x0, 0x0, 37, -1, 1861, 0, 0, -1 },
-  { 0x1, 0x1, 37, -1, -1, 37, 1, 26 },
-  { 0x1, 0x1, 37, -1, 1866, 37, 1, 26 },
-  { 0x0, 0x0, 37, -1, 1869, 0, 0, -1 },
-  { 0x1, 0x1, 37, -1, -1, 37, 1, 26 },
+  { 0x1, 0x1, 24, -1, -1, 33, 1, 76 },
+  { 0x1, 0x1, 24, -1, -1, 33, 1, 76 },
+  { 0x1, 0x1, 24, 1065, 1152, 35, 1, 129 },
+  { 0x1, 0x1, 24, 1066, 1161, 35, 1, 129 },
+  { 0x1, 0x1, 24, 1067, 1170, 35, 1, 129 },
+  { 0x1, 0x1, 24, 1068, 1179, 35, 1, 129 },
+  { 0x1, 0x1, 24, 1069, 1188, 35, 1, 129 },
+  { 0x1, 0x1, 24, 1070, 1197, 35, 1, 129 },
+  { 0x1, 0x1, 24, 1071, 1206, 35, 1, 129 },
+  { 0x1, 0x1, 24, 1072, 1215, 35, 1, 129 },
+  { 0x1, 0x1, 24, 1073, 1224, 35, 1, 129 },
+  { 0x1, 0x1, 24, 1074, 1234, 35, 1, 129 },
+  { 0x1, 0x1, 24, 1075, 1244, 35, 1, 129 },
+  { 0x1, 0x1, 24, 1076, 1254, 35, 1, 129 },
+  { 0x1, 0x1, 24, 1077, 1263, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1078, 1269, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1079, 1275, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1080, 1281, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1081, 1287, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1082, 1293, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1083, 1299, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1084, 1305, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1085, 1311, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1086, 1317, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1087, 1323, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1088, 1329, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1089, 1335, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1090, 1341, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1091, 1347, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1092, 1353, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1093, 1359, 35, 1, 139 },
+  { 0x1, 0x1, 24, 1094, 1365, 35, 1, 139 },
+  { 0x0, 0x0, 32, 2261, 2259, 0, 0, -1 },
+  { 0x0, 0x0, 32, 2264, 2262, 0, 0, -1 },
+  { 0x0, 0x0, 32, 2270, 2269, 0, 0, -1 },
+  { 0x0, 0x0, 32, 2272, 2271, 0, 0, -1 },
+  { 0x0, 0x0, 32, 2286, 2285, 0, 0, -1 },
+  { 0x0, 0x0, 32, 2288, 2287, 0, 0, -1 },
+  { 0x0, 0x0, 34, -1, 2280, 0, 0, -1 },
+  { 0x0, 0x0, 34, -1, 2282, 0, 0, -1 },
+  { 0x1, 0x1, 37, -1, 1826, 37, 1, 29 },
+  { 0x1, 0x1, 37, -1, 1861, 37, 1, 29 },
+  { 0x0, 0x0, 37, -1, 1864, 0, 0, -1 },
+  { 0x1, 0x1, 37, -1, -1, 37, 1, 29 },
+  { 0x1, 0x1, 37, -1, 1869, 37, 1, 29 },
   { 0x0, 0x0, 37, -1, 1872, 0, 0, -1 },
-  { 0x1, 0x1, 37, -1, -1, 37, 1, 26 },
-  { 0x1, 0x1, 37, -1, 1875, 37, 1, 26 },
-  { 0x1, 0x1, 37, -1, 1878, 37, 1, 26 },
-  { 0x1, 0x1, 37, -1, 1908, 37, 1, 26 },
-  { 0x3, 0x3, 37, -1, -1, 30, 1, 129 },
-  { 0x0, 0x0, 37, 909, -1, 0, 1, 90 },
-  { 0x0, 0x0, 37, -1, -1, 0, 1, 99 },
-  { 0x0, 0x0, 37, 915, -1, 0, 1, 111 },
-  { 0x3, 0x3, 37, -1, -1, 30, 1, 5 },
-  { 0x0, 0x0, 37, 916, -1, 0, 1, 37 },
-  { 0x0, 0x0, 39, -1, 786, 0, 0, -1 },
-  { 0x0, 0x0, 39, -1, 794, 0, 0, -1 },
-  { 0x0, 0x0, 39, 918, 790, 0, 0, -1 },
-  { 0x3, 0x3, 39, -1, 445, 33, 1, 9 },
-  { 0x18000001, 0x18000001, 39, -1, 453, 6, 1, 10 },
-  { 0x3, 0x3, 39, 919, 449, 33, 1, 9 },
-  { 0x0, 0x0, 39, -1, 798, 0, 0, -1 },
-  { 0x3, 0x3, 39, -1, 465, 33, 1, 11 },
-  { 0x0, 0x0, 39, -1, 802, 0, 0, -1 },
-  { 0x3, 0x3, 39, -1, 477, 33, 1, 18 },
-  { 0x0, 0x0, 39, -1, 807, 0, 0, -1 },
-  { 0x0, 0x0, 39, -1, 811, 0, 0, -1 },
-  { 0x3, 0x3, 39, -1, 500, 33, 1, 20 },
-  { 0x3, 0x3, 39, -1, 504, 33, 1, 20 },
-  { 0x0, 0x0, 39, -1, 815, 0, 0, -1 },
-  { 0x0, 0x0, 39, -1, 819, 0, 0, -1 },
-  { 0x3, 0x3, 39, -1, 524, 33, 1, 21 },
-  { 0x18000001, 0x18000001, 39, -1, 528, 6, 1, 21 },
-  { 0x0, 0x0, 39, -1, 823, 0, 0, -1 },
-  { 0x3, 0x3, 39, -1, 540, 33, 1, 22 },
-  { 0x0, 0x0, 39, -1, 827, 0, 0, -1 },
-  { 0x0, 0x0, 39, -1, 831, 0, 0, -1 },
-  { 0x3, 0x3, 39, -1, 560, 33, 1, 23 },
-  { 0x18000001, 0x18000001, 39, -1, 564, 6, 1, 23 },
-  { 0x0, 0x0, 39, -1, 835, 0, 0, -1 },
-  { 0x3, 0x3, 39, -1, 576, 33, 1, 24 },
-  { 0x0, 0x0, 39, -1, 840, 0, 0, -1 },
-  { 0x0, 0x0, 39, -1, 844, 0, 0, -1 },
-  { 0x3, 0x3, 39, -1, 599, 33, 1, 20 },
-  { 0x3, 0x3, 39, -1, 603, 33, 1, 20 },
-  { 0x0, 0x0, 39, -1, 848, 0, 0, -1 },
-  { 0x3, 0x3, 39, -1, 615, 33, 1, 24 },
-  { 0x0, 0x0, 40, 674, 785, 0, 0, -1 },
-  { 0x0, 0x0, 40, 675, 793, 0, 0, -1 },
-  { 0x0, 0x0, 40, 676, 789, 0, 0, -1 },
-  { 0x1, 0x1, 40, 677, 444, 34, 1, 9 },
-  { 0x10000001, 0x10000001, 40, 678, 452, 6, 1, 10 },
-  { 0x1, 0x1, 40, 679, 448, 34, 1, 9 },
-  { 0x0, 0x0, 40, 680, 797, 0, 0, -1 },
-  { 0x1, 0x1, 40, 681, 464, 34, 1, 11 },
-  { 0x0, 0x0, 40, 682, 801, 0, 0, -1 },
-  { 0x1, 0x1, 40, 683, 476, 34, 1, 18 },
-  { 0x0, 0x0, 40, 684, 806, 0, 0, -1 },
-  { 0x0, 0x0, 40, 685, 810, 0, 0, -1 },
-  { 0x1, 0x1, 40, 686, 499, 34, 1, 20 },
-  { 0x1, 0x1, 40, 687, 503, 34, 1, 20 },
-  { 0x0, 0x0, 40, 688, 814, 0, 0, -1 },
-  { 0x0, 0x0, 40, 689, 818, 0, 0, -1 },
-  { 0x1, 0x1, 40, 690, 523, 34, 1, 21 },
-  { 0x10000001, 0x10000001, 40, 691, 527, 6, 1, 21 },
-  { 0x0, 0x0, 40, 692, 822, 0, 0, -1 },
-  { 0x1, 0x1, 40, 693, 539, 34, 1, 22 },
-  { 0x0, 0x0, 40, 694, 826, 0, 0, -1 },
-  { 0x0, 0x0, 40, 695, 830, 0, 0, -1 },
-  { 0x1, 0x1, 40, 696, 559, 34, 1, 23 },
-  { 0x10000001, 0x10000001, 40, 697, 563, 6, 1, 23 },
-  { 0x0, 0x0, 40, 698, 834, 0, 0, -1 },
-  { 0x1, 0x1, 40, 699, 575, 34, 1, 24 },
-  { 0x0, 0x0, 40, 700, 839, 0, 0, -1 },
-  { 0x0, 0x0, 40, 701, 843, 0, 0, -1 },
-  { 0x1, 0x1, 40, 702, 598, 34, 1, 20 },
-  { 0x1, 0x1, 40, 703, 602, 34, 1, 20 },
-  { 0x0, 0x0, 40, 704, 847, 0, 0, -1 },
-  { 0x1, 0x1, 40, 705, 614, 34, 1, 24 },
-  { 0x800001, 0x800001, 40, -1, 923, 4, 1, 19 },
-  { 0x1, 0x1, 40, 1769, 921, 4, 1, 19 },
-  { 0x1, 0x1, 40, 771, 926, 4, 1, 2 },
-  { 0x2, 0x3, 40, -1, 931, 20, 1, 59 },
-  { 0x1, 0x1, 40, 1770, 929, 21, 1, 59 },
-  { 0x0, 0x0, 41, -1, -1, 0, 1, 77 },
-  { 0x0, 0x0, 41, -1, -1, 0, 1, 77 },
-  { 0x0, 0x0, 41, -1, -1, 0, 1, 119 },
-  { 0x1, 0x1, 43, 1094, 281, 38, 1, 4 },
-  { 0x0, 0x0, 43, -1, 324, 0, 0, -1 },
-  { 0x1, 0x1, 43, 1097, 287, 38, 1, 4 },
-  { 0x0, 0x0, 43, -1, 336, 0, 0, -1 },
-  { 0x0, 0x0, 43, -1, 290, 0, 0, -1 },
-  { 0x0, 0x0, 43, -1, 296, 0, 0, -1 },
-  { 0x1, 0x1, 43, 1102, 297, 38, 1, 4 },
-  { 0x0, 0x0, 43, -1, 340, 0, 0, -1 },
-  { 0x1, 0x1, 43, 1105, 303, 38, 1, 4 },
-  { 0x0, 0x0, 43, -1, 352, 0, 0, -1 },
-  { 0x0, 0x0, 43, -1, 306, 0, 0, -1 },
-  { 0x0, 0x0, 43, -1, 312, 0, 0, -1 },
-  { 0x0, 0x0, 43, 978, 1830, 0, 0, -1 },
-  { 0x0, 0x0, 43, 979, 2351, 0, 1, 51 },
-  { 0x0, 0x0, 43, 980, 1882, 0, 0, -1 },
-  { 0x0, 0x0, 43, 981, -1, 0, 1, 46 },
-  { 0x0, 0x0, 43, 893, -1, 0, 1, 0 },
+  { 0x1, 0x1, 37, -1, -1, 37, 1, 29 },
+  { 0x0, 0x0, 37, -1, 1875, 0, 0, -1 },
+  { 0x1, 0x1, 37, -1, -1, 37, 1, 29 },
+  { 0x1, 0x1, 37, -1, 1878, 37, 1, 29 },
+  { 0x1, 0x1, 37, -1, 1881, 37, 1, 29 },
+  { 0x1, 0x1, 37, -1, 1914, 37, 1, 29 },
+  { 0x3, 0x3, 37, -1, -1, 30, 1, 134 },
+  { 0x0, 0x0, 37, 910, -1, 0, 1, 95 },
+  { 0x0, 0x0, 37, -1, -1, 0, 1, 104 },
+  { 0x0, 0x0, 37, 916, -1, 0, 1, 116 },
+  { 0x3, 0x3, 37, -1, -1, 30, 1, 144 },
+  { 0x0, 0x0, 37, 917, -1, 0, 1, 40 },
+  { 0x0, 0x0, 39, -1, 785, 0, 0, -1 },
+  { 0x0, 0x0, 39, -1, 793, 0, 0, -1 },
+  { 0x0, 0x0, 39, 919, 789, 0, 0, -1 },
+  { 0x3, 0x3, 39, -1, 444, 33, 1, 6 },
+  { 0x18000001, 0x18000001, 39, -1, 452, 6, 1, 7 },
+  { 0x3, 0x3, 39, 920, 448, 33, 1, 6 },
+  { 0x0, 0x0, 39, -1, 797, 0, 0, -1 },
+  { 0x3, 0x3, 39, -1, 464, 33, 1, 8 },
+  { 0x0, 0x0, 39, -1, 801, 0, 0, -1 },
+  { 0x3, 0x3, 39, -1, 476, 33, 1, 15 },
+  { 0x0, 0x0, 39, -1, 806, 0, 0, -1 },
+  { 0x0, 0x0, 39, -1, 810, 0, 0, -1 },
+  { 0x3, 0x3, 39, -1, 499, 33, 1, 17 },
+  { 0x3, 0x3, 39, -1, 503, 33, 1, 17 },
+  { 0x0, 0x0, 39, -1, 814, 0, 0, -1 },
+  { 0x0, 0x0, 39, -1, 818, 0, 0, -1 },
+  { 0x3, 0x3, 39, -1, 523, 33, 1, 18 },
+  { 0x18000001, 0x18000001, 39, -1, 527, 6, 1, 18 },
+  { 0x0, 0x0, 39, -1, 822, 0, 0, -1 },
+  { 0x3, 0x3, 39, -1, 539, 33, 1, 19 },
+  { 0x0, 0x0, 39, -1, 826, 0, 0, -1 },
+  { 0x0, 0x0, 39, -1, 830, 0, 0, -1 },
+  { 0x3, 0x3, 39, -1, 559, 33, 1, 20 },
+  { 0x18000001, 0x18000001, 39, -1, 563, 6, 1, 20 },
+  { 0x0, 0x0, 39, -1, 834, 0, 0, -1 },
+  { 0x3, 0x3, 39, -1, 575, 33, 1, 21 },
+  { 0x0, 0x0, 39, -1, 839, 0, 0, -1 },
+  { 0x0, 0x0, 39, -1, 843, 0, 0, -1 },
+  { 0x3, 0x3, 39, -1, 598, 33, 1, 17 },
+  { 0x3, 0x3, 39, -1, 602, 33, 1, 17 },
+  { 0x0, 0x0, 39, -1, 847, 0, 0, -1 },
+  { 0x3, 0x3, 39, -1, 614, 33, 1, 21 },
+  { 0x0, 0x0, 40, 673, 784, 0, 0, -1 },
+  { 0x0, 0x0, 40, 674, 792, 0, 0, -1 },
+  { 0x0, 0x0, 40, 675, 788, 0, 0, -1 },
+  { 0x1, 0x1, 40, 676, 443, 34, 1, 6 },
+  { 0x10000001, 0x10000001, 40, 677, 451, 6, 1, 7 },
+  { 0x1, 0x1, 40, 678, 447, 34, 1, 6 },
+  { 0x0, 0x0, 40, 679, 796, 0, 0, -1 },
+  { 0x1, 0x1, 40, 680, 463, 34, 1, 8 },
+  { 0x0, 0x0, 40, 681, 800, 0, 0, -1 },
+  { 0x1, 0x1, 40, 682, 475, 34, 1, 15 },
+  { 0x0, 0x0, 40, 683, 805, 0, 0, -1 },
+  { 0x0, 0x0, 40, 684, 809, 0, 0, -1 },
+  { 0x1, 0x1, 40, 685, 498, 34, 1, 17 },
+  { 0x1, 0x1, 40, 686, 502, 34, 1, 17 },
+  { 0x0, 0x0, 40, 687, 813, 0, 0, -1 },
+  { 0x0, 0x0, 40, 688, 817, 0, 0, -1 },
+  { 0x1, 0x1, 40, 689, 522, 34, 1, 18 },
+  { 0x10000001, 0x10000001, 40, 690, 526, 6, 1, 18 },
+  { 0x0, 0x0, 40, 691, 821, 0, 0, -1 },
+  { 0x1, 0x1, 40, 692, 538, 34, 1, 19 },
+  { 0x0, 0x0, 40, 693, 825, 0, 0, -1 },
+  { 0x0, 0x0, 40, 694, 829, 0, 0, -1 },
+  { 0x1, 0x1, 40, 695, 558, 34, 1, 20 },
+  { 0x10000001, 0x10000001, 40, 696, 562, 6, 1, 20 },
+  { 0x0, 0x0, 40, 697, 833, 0, 0, -1 },
+  { 0x1, 0x1, 40, 698, 574, 34, 1, 21 },
+  { 0x0, 0x0, 40, 699, 838, 0, 0, -1 },
+  { 0x0, 0x0, 40, 700, 842, 0, 0, -1 },
+  { 0x1, 0x1, 40, 701, 597, 34, 1, 17 },
+  { 0x1, 0x1, 40, 702, 601, 34, 1, 17 },
+  { 0x0, 0x0, 40, 703, 846, 0, 0, -1 },
+  { 0x1, 0x1, 40, 704, 613, 34, 1, 21 },
+  { 0x800001, 0x800001, 40, -1, 924, 4, 1, 16 },
+  { 0x1, 0x1, 40, 1772, 922, 4, 1, 16 },
+  { 0x1, 0x1, 40, 770, 927, 4, 1, 22 },
+  { 0x2, 0x3, 40, -1, 932, 20, 1, 67 },
+  { 0x1, 0x1, 40, 1773, 930, 21, 1, 67 },
+  { 0x0, 0x0, 41, -1, -1, 0, 1, 80 },
+  { 0x0, 0x0, 41, -1, -1, 0, 1, 80 },
+  { 0x0, 0x0, 41, -1, -1, 0, 1, 123 },
+  { 0x1, 0x1, 43, 1095, 280, 38, 1, 1 },
+  { 0x0, 0x0, 43, -1, 323, 0, 0, -1 },
+  { 0x1, 0x1, 43, 1098, 286, 38, 1, 1 },
+  { 0x0, 0x0, 43, -1, 335, 0, 0, -1 },
+  { 0x0, 0x0, 43, -1, 289, 0, 0, -1 },
+  { 0x0, 0x0, 43, -1, 295, 0, 0, -1 },
+  { 0x1, 0x1, 43, 1103, 296, 38, 1, 1 },
+  { 0x0, 0x0, 43, -1, 339, 0, 0, -1 },
+  { 0x1, 0x1, 43, 1106, 302, 38, 1, 1 },
+  { 0x0, 0x0, 43, -1, 351, 0, 0, -1 },
+  { 0x0, 0x0, 43, -1, 305, 0, 0, -1 },
+  { 0x0, 0x0, 43, -1, 311, 0, 0, -1 },
+  { 0x0, 0x0, 43, 979, 1833, 0, 0, -1 },
+  { 0x0, 0x0, 43, 980, 2366, 0, 1, 54 },
+  { 0x0, 0x0, 43, 981, 1885, 0, 0, -1 },
+  { 0x0, 0x0, 43, 982, -1, 0, 1, 49 },
   { 0x0, 0x0, 43, 894, -1, 0, 1, 0 },
   { 0x0, 0x0, 43, 895, -1, 0, 1, 0 },
-  { 0x1, 0x1, 44, -1, 1366, 30, 1, 137 },
-  { 0x1, 0x1, 44, 776, 1365, 30, 1, 136 },
-  { 0x1, 0x1, 44, -1, 1370, 30, 1, 139 },
-  { 0x1, 0x1, 44, 777, 1369, 30, 1, 138 },
-  { 0x1, 0x1, 44, -1, 1374, 30, 1, 139 },
-  { 0x1, 0x1, 44, 778, 1373, 30, 1, 138 },
-  { 0x3, 0x3, 45, -1, 927, 3, 1, 2 },
-  { 0x1, 0x1, 46, 1790, -1, 30, 1, 129 },
-  { 0x1, 0x1, 46, 1821, -1, 30, 1, 5 },
-  { 0x0, 0x0, 48, -1, -1, 0, 1, 37 },
-  { 0x0, 0x0, 48, -1, -1, 0, 1, 37 },
-  { 0x1, 0x1, 55, -1, 1367, 31, 1, 137 },
-  { 0x1, 0x1, 55, -1, 1371, 31, 1, 139 },
-  { 0x1, 0x1, 55, -1, 1375, 31, 1, 139 },
-  { 0x0, 0x0, 55, -1, -1, 0, 1, 2 },
-  { 0x2, 0x3, 55, -1, -1, 27, 1, 2 },
-  { 0x1, 0x1, 55, -1, -1, 28, 1, 2 },
-  { 0x0, 0x0, 64, 12, 415, 0, 1, 9 },
-  { 0x0, 0x0, 64, 996, 418, 0, 1, 9 },
-  { 0x1, 0x1, 64, 997, 420, 33, 1, 9 },
-  { 0x1, 0x1, 64, 998, 422, 34, 1, 9 },
-  { 0x3, 0x3, 64, 999, 424, 33, 1, 9 },
-  { 0x0, 0x0, 64, 1000, 426, 0, 1, 9 },
-  { 0x1, 0x1, 64, 1001, 428, 33, 1, 9 },
-  { 0x1, 0x1, 64, 1002, 430, 34, 1, 9 },
-  { 0x3, 0x3, 64, 1003, 432, 33, 1, 9 },
-  { 0x1, 0x1, 64, 1004, 434, 6, 1, 10 },
-  { 0x8000001, 0x8000001, 64, 1005, 436, 6, 1, 10 },
-  { 0x10000001, 0x10000001, 64, 1006, 438, 6, 1, 10 },
-  { 0x18000001, 0x18000001, 64, 1007, 440, 6, 1, 10 },
-  { 0x0, 0x0, 64, 1008, 454, 0, 1, 11 },
-  { 0x1, 0x1, 64, 1009, 456, 33, 1, 11 },
-  { 0x1, 0x1, 64, 1010, 458, 34, 1, 11 },
-  { 0x3, 0x3, 64, 1011, 460, 33, 1, 11 },
-  { 0x0, 0x0, 64, 1012, 466, 0, 1, 18 },
-  { 0x1, 0x1, 64, 1013, 468, 33, 1, 18 },
-  { 0x1, 0x1, 64, 1014, 470, 34, 1, 18 },
-  { 0x3, 0x3, 64, 1015, 472, 33, 1, 18 },
-  { 0x0, 0x0, 64, 13, 478, 0, 1, 20 },
-  { 0x0, 0x0, 64, 1017, 481, 0, 1, 20 },
-  { 0x1, 0x1, 64, 1018, 483, 33, 1, 20 },
-  { 0x1, 0x1, 64, 1019, 485, 34, 1, 20 },
-  { 0x3, 0x3, 64, 1020, 487, 33, 1, 20 },
-  { 0x0, 0x0, 64, 1021, 489, 0, 1, 20 },
-  { 0x1, 0x1, 64, 1022, 491, 33, 1, 20 },
-  { 0x1, 0x1, 64, 1023, 493, 34, 1, 20 },
-  { 0x3, 0x3, 64, 1024, 495, 33, 1, 20 },
-  { 0x0, 0x0, 64, 1025, 505, 0, 1, 21 },
-  { 0x1, 0x1, 64, 1026, 507, 33, 1, 21 },
-  { 0x1, 0x1, 64, 1027, 509, 34, 1, 21 },
-  { 0x3, 0x3, 64, 1028, 511, 33, 1, 21 },
-  { 0x1, 0x1, 64, 1029, 513, 6, 1, 21 },
-  { 0x8000001, 0x8000001, 64, 1030, 515, 6, 1, 21 },
-  { 0x10000001, 0x10000001, 64, 1031, 517, 6, 1, 21 },
-  { 0x18000001, 0x18000001, 64, 1032, 519, 6, 1, 21 },
-  { 0x0, 0x0, 64, 1033, 529, 0, 1, 22 },
-  { 0x1, 0x1, 64, 1034, 531, 33, 1, 22 },
-  { 0x1, 0x1, 64, 1035, 533, 34, 1, 22 },
-  { 0x3, 0x3, 64, 1036, 535, 33, 1, 22 },
-  { 0x0, 0x0, 64, 1037, 541, 0, 1, 23 },
-  { 0x1, 0x1, 64, 1038, 543, 33, 1, 23 },
-  { 0x1, 0x1, 64, 1039, 545, 34, 1, 23 },
-  { 0x3, 0x3, 64, 1040, 547, 33, 1, 23 },
-  { 0x1, 0x1, 64, 1041, 549, 6, 1, 23 },
-  { 0x8000001, 0x8000001, 64, 1042, 551, 6, 1, 23 },
-  { 0x10000001, 0x10000001, 64, 1043, 553, 6, 1, 23 },
-  { 0x18000001, 0x18000001, 64, 1044, 555, 6, 1, 23 },
-  { 0x0, 0x0, 64, 1045, 565, 0, 1, 24 },
-  { 0x1, 0x1, 64, 1046, 567, 33, 1, 24 },
-  { 0x1, 0x1, 64, 1047, 569, 34, 1, 24 },
-  { 0x3, 0x3, 64, 1048, 571, 33, 1, 24 },
-  { 0x0, 0x0, 64, 15, 577, 0, 1, 20 },
-  { 0x0, 0x0, 64, 1050, 580, 0, 1, 20 },
-  { 0x1, 0x1, 64, 1051, 582, 33, 1, 20 },
-  { 0x1, 0x1, 64, 1052, 584, 34, 1, 20 },
-  { 0x3, 0x3, 64, 1053, 586, 33, 1, 20 },
-  { 0x0, 0x0, 64, 1054, 588, 0, 1, 20 },
-  { 0x1, 0x1, 64, 1055, 590, 33, 1, 20 },
-  { 0x1, 0x1, 64, 1056, 592, 34, 1, 20 },
-  { 0x3, 0x3, 64, 1057, 594, 33, 1, 20 },
-  { 0x0, 0x0, 64, 1058, 604, 0, 1, 24 },
-  { 0x1, 0x1, 64, 1059, 606, 33, 1, 24 },
-  { 0x1, 0x1, 64, 1060, 608, 34, 1, 24 },
-  { 0x3, 0x3, 64, 1061, 610, 33, 1, 24 },
-  { 0x3, 0x3, 65, 384, 1229, 33, 1, 124 },
-  { 0x3, 0x3, 65, 385, 1239, 33, 1, 124 },
-  { 0x3, 0x3, 65, 386, 1249, 33, 1, 124 },
-  { 0x0, 0x0, 65, -1, 1254, 0, 1, 130 },
-  { 0x0, 0x0, 65, -1, 1255, 0, 1, 130 },
-  { 0x0, 0x0, 65, -1, 1256, 0, 1, 130 },
-  { 0x0, 0x0, 107, 859, 1854, 0, 0, -1 },
-  { 0x0, 0x0, 107, 860, 2289, 0, 1, 26 },
-  { 0x0, 0x0, 107, 861, 1891, 0, 0, -1 },
-  { 0x0, 0x0, 107, 862, 2293, 0, 1, 26 },
-  { 0x0, 0x0, 109, -1, 1856, 0, 0, -1 },
-  { 0x1, 0x1, 109, -1, 2290, 27, 1, 26 },
-  { 0x0, 0x0, 109, -1, 1893, 0, 0, -1 },
-  { 0x1, 0x1, 109, -1, 2294, 27, 1, 26 },
-  { 0x0, 0x0, 110, 864, -1, 0, 1, 110 },
-  { 0x1, 0x1, 111, -1, -1, 27, 1, 110 },
-  { 0x0, 0x0, 112, 877, 2312, 0, 1, 4 },
-  { 0x0, 0x0, 112, 969, 285, 0, 0, -1 },
-  { 0x0, 0x0, 112, -1, 332, 0, 0, -1 },
-  { 0x0, 0x0, 112, 878, 2320, 0, 1, 4 },
-  { 0x0, 0x0, 112, -1, 294, 0, 0, -1 },
-  { 0x0, 0x0, 112, 879, 2332, 0, 1, 4 },
-  { 0x0, 0x0, 112, 974, 301, 0, 0, -1 },
-  { 0x0, 0x0, 112, -1, 348, 0, 0, -1 },
-  { 0x0, 0x0, 112, 1106, 2339, 0, 1, 4 },
-  { 0x0, 0x0, 112, -1, 310, 0, 0, -1 },
-  { 0x0, 0x0, 112, -1, 1840, 0, 0, -1 },
-  { 0x1, 0x9, 112, -1, 2358, 33, 1, 51 },
-  { 0x1, 0x1, 114, 1095, 2313, 37, 1, 4 },
-  { 0x1, 0x1, 114, 1098, 2321, 37, 1, 4 },
-  { 0x1, 0x1, 114, 1103, 2333, 37, 1, 4 },
-  { 0x0, 0x0, 114, -1, 2344, 0, 1, 4 },
-  { 0x0, 0x0, 115, 896, 2310, 0, 1, 4 },
-  { 0x0, 0x0, 115, 949, 283, 0, 0, -1 },
-  { 0x0, 0x0, 115, 970, 330, 0, 0, -1 },
-  { 0x0, 0x0, 115, -1, 2319, 0, 1, 4 },
-  { 0x0, 0x0, 115, 972, 292, 0, 0, -1 },
-  { 0x0, 0x0, 115, 898, 2330, 0, 1, 4 },
-  { 0x0, 0x0, 115, 954, 299, 0, 0, -1 },
-  { 0x0, 0x0, 115, 975, 346, 0, 0, -1 },
-  { 0x0, 0x0, 115, -1, 2338, 0, 1, 4 },
-  { 0x0, 0x0, 115, 977, 308, 0, 0, -1 },
-  { 0x0, 0x0, 115, 875, 1838, 0, 0, -1 },
-  { 0x0, 0x0, 115, 876, 2357, 0, 1, 51 },
-  { 0x1, 0x1, 115, -1, -1, 27, 1, 0 },
-  { 0x1, 0x1, 115, -1, -1, 27, 1, 0 },
-  { 0x1, 0x1, 115, -1, -1, 27, 1, 0 },
-  { 0x1, 0x1, 116, -1, 2311, 37, 1, 4 },
-  { 0x0, 0x0, 116, -1, 2324, 0, 1, 4 },
-  { 0x1, 0x1, 116, -1, 2331, 37, 1, 4 },
-  { 0x0, 0x0, 116, -1, 2343, 0, 1, 4 },
-  { 0x0, 0x0, 117, 943, -1, 0, 1, 2 },
-  { 0x0, 0x0, 117, 944, -1, 0, 1, 2 },
-  { 0x0, 0x0, 117, 945, -1, 0, 1, 2 },
-  { 0x3, 0x3, 117, 905, -1, 34, 1, 30 },
-  { 0x3, 0x3, 117, 906, -1, 34, 1, 2 },
-  { 0x1, 0x1, 118, -1, -1, 35, 1, 30 },
-  { 0x1, 0x1, 118, -1, -1, 35, 1, 2 },
-  { 0x0, 0x0, 119, -1, -1, 0, 1, 37 },
-  { 0x0, 0x0, 119, -1, -1, 0, 1, 58 },
-  { 0x1, 0x1, 119, -1, -1, 27, 1, 91 },
-  { 0x0, 0x0, 119, -1, -1, 0, 1, 100 },
-  { 0x0, 0x0, 119, -1, -1, 0, 1, 65 },
-  { 0x0, 0x0, 119, -1, -1, 0, 1, 65 },
-  { 0x0, 0x0, 119, -1, -1, 0, 1, 66 },
-  { 0x0, 0x0, 119, -1, -1, 0, 1, 37 },
-  { 0x1, 0x1, 119, -1, -1, 27, 1, 112 },
-  { 0x1, 0x1, 119, -1, -1, 27, 1, 37 },
-  { 0x0, 0x0, 119, -1, -1, 0, 1, 37 },
-  { 0x0, 0x0, 120, -1, 2245, 0, 0, -1 },
-  { 0x0, 0x0, 120, -1, 2248, 0, 0, -1 },
-  { 0x1, 0x1, 121, -1, -1, 35, 1, 19 },
-  { 0x1, 0x1, 121, -1, -1, 35, 1, 19 },
-  { 0x1, 0x1, 121, -1, -1, 35, 1, 19 },
-  { 0x1, 0x1, 121, -1, -1, 35, 1, 19 },
-  { 0x1, 0x1, 121, -1, -1, 35, 1, 2 },
-  { 0x1, 0x1, 121, -1, -1, 35, 1, 2 },
-  { 0x1, 0x1, 121, -1, -1, 35, 1, 2 },
-  { 0x1, 0x1, 121, -1, -1, 35, 1, 2 },
-  { 0x1, 0x1, 121, -1, -1, 23, 1, 59 },
-  { 0x1, 0x1, 121, -1, -1, 23, 1, 59 },
-  { 0x1, 0x1, 121, -1, -1, 23, 1, 59 },
-  { 0x1, 0x1, 121, -1, -1, 23, 1, 59 },
-  { 0x1, 0x1, 121, 741, -1, 23, 1, 59 },
-  { 0x9, 0x9, 121, 742, -1, 20, 1, 59 },
-  { 0x0, 0x0, 125, 1740, -1, 0, 1, 0 },
-  { 0x0, 0x0, 125, 1741, -1, 0, 1, 0 },
-  { 0x1, 0x1, 125, -1, -1, 28, 1, 30 },
-  { 0x1, 0x1, 125, -1, -1, 27, 1, 30 },
-  { 0x1, 0x1, 125, -1, -1, 29, 1, 0 },
-  { 0x1, 0x1, 125, -1, -1, 29, 1, 0 },
-  { 0x1, 0x1, 125, -1, -1, 29, 1, 0 },
-  { 0x1, 0x1, 125, -1, -1, 29, 1, 0 },
-  { 0x0, 0x0, 125, -1, -1, 0, 1, 109 },
-  { 0x1, 0x1, 125, -1, -1, 29, 1, 2 },
-  { 0x1, 0x1, 125, -1, -1, 29, 1, 2 },
-  { 0x1, 0x1, 125, -1, -1, 29, 1, 2 },
-  { 0x0, 0x0, 125, 903, -1, 0, 1, 30 },
-  { 0x0, 0x0, 125, 987, -1, 0, 1, 2 },
-  { 0x0, 0x0, 138, 962, 2308, 0, 1, 4 },
-  { 0x0, 0x0, 138, 866, 284, 0, 0, -1 },
-  { 0x0, 0x0, 138, 883, 329, 0, 0, -1 },
-  { 0x0, 0x0, 138, -1, 2318, 0, 1, 4 },
-  { 0x0, 0x0, 138, 885, 291, 0, 0, -1 },
-  { 0x0, 0x0, 138, 964, 2328, 0, 1, 4 },
-  { 0x0, 0x0, 138, 871, 300, 0, 0, -1 },
-  { 0x0, 0x0, 138, 888, 345, 0, 0, -1 },
-  { 0x0, 0x0, 138, -1, 2337, 0, 1, 4 },
-  { 0x0, 0x0, 138, 890, 307, 0, 0, -1 },
-  { 0x0, 0x0, 138, 2375, 1834, 0, 0, -1 },
-  { 0x1, 0x1, 138, 2376, 2353, 33, 1, 51 },
-  { 0x0, 0x0, 138, 2377, 1884, 0, 0, -1 },
-  { 0x1, 0x1, 138, 2378, -1, 28, 1, 46 },
-  { 0x1, 0x1, 139, -1, 2309, 37, 1, 4 },
-  { 0x0, 0x0, 139, -1, 2323, 0, 1, 4 },
-  { 0x1, 0x1, 139, -1, 2329, 37, 1, 4 },
-  { 0x0, 0x0, 139, -1, 2342, 0, 1, 4 },
-  { 0x1, 0x1, 142, 740, 925, 3, 1, 2 },
-  { 0x0, 0x0, 143, 1742, -1, 0, 1, 30 },
-  { 0x0, 0x0, 144, 746, 2305, 0, 1, 4 },
-  { 0x0, 0x0, 144, -1, 286, 0, 0, -1 },
-  { 0x0, 0x0, 144, 867, 331, 0, 0, -1 },
-  { 0x0, 0x0, 144, 748, 2315, 0, 1, 4 },
-  { 0x0, 0x0, 144, 869, 293, 0, 0, -1 },
-  { 0x0, 0x0, 144, 752, 2325, 0, 1, 4 },
-  { 0x0, 0x0, 144, -1, 302, 0, 0, -1 },
-  { 0x0, 0x0, 144, 872, 347, 0, 0, -1 },
-  { 0x0, 0x0, 144, 754, 2335, 0, 1, 4 },
-  { 0x0, 0x0, 144, 874, 309, 0, 0, -1 },
-  { 0x0, 0x0, 144, 958, 1832, 0, 0, -1 },
-  { 0x1, 0x1, 144, 959, 2352, 36, 1, 51 },
-  { 0x0, 0x0, 144, 960, 1883, 0, 0, -1 },
-  { 0x1, 0x1, 144, 961, -1, 27, 1, 46 },
-  { 0x1, 0x1, 145, -1, 2307, 37, 1, 4 },
-  { 0x1, 0x1, 145, -1, 2317, 37, 1, 4 },
-  { 0x1, 0x1, 145, -1, 2327, 37, 1, 4 },
-  { 0x0, 0x0, 145, -1, 2341, 0, 1, 4 },
-  { 0x0, 0x0, 146, -1, -1, 0, 1, 30 },
-  { 0x0, 0x0, 146, 904, -1, 0, 1, 2 },
-  { 0x0, 0x0, 147, -1, -1, 0, 1, 37 },
-  { 0x0, 0x0, 147, -1, -1, 0, 1, 58 },
-  { 0x0, 0x0, 147, -1, 2345, 0, 1, 55 },
-  { 0x0, 0x0, 147, -1, -1, 0, 1, 78 },
-  { 0x0, 0x0, 147, -1, -1, 0, 1, 78 },
-  { 0x0, 0x0, 147, -1, -1, 0, 1, 82 },
-  { 0x0, 0x0, 147, -1, -1, 0, 1, 37 },
-  { 0x1, 0x1, 148, -1, 416, 12, 1, 9 },
-  { 0x1, 0x1, 148, -1, 419, 12, 1, 9 },
-  { 0x200001, 0x200001, 148, -1, 421, 12, 1, 9 },
-  { 0x400001, 0x400001, 148, -1, 423, 12, 1, 9 },
-  { 0x600001, 0x600001, 148, -1, 425, 12, 1, 9 },
-  { 0x1, 0x1, 148, -1, 427, 12, 1, 9 },
-  { 0x200001, 0x200001, 148, -1, 429, 12, 1, 9 },
-  { 0x400001, 0x400001, 148, -1, 431, 12, 1, 9 },
-  { 0x600001, 0x600001, 148, -1, 433, 12, 1, 9 },
-  { 0x41, 0x41, 148, -1, 435, 6, 1, 10 },
-  { 0x8000041, 0x8000041, 148, -1, 437, 6, 1, 10 },
-  { 0x10000041, 0x10000041, 148, -1, 439, 6, 1, 10 },
-  { 0x18000041, 0x18000041, 148, -1, 441, 6, 1, 10 },
-  { 0x1, 0x1, 148, -1, 455, 12, 1, 11 },
-  { 0x200001, 0x200001, 148, -1, 457, 12, 1, 11 },
-  { 0x400001, 0x400001, 148, -1, 459, 12, 1, 11 },
-  { 0x600001, 0x600001, 148, -1, 461, 12, 1, 11 },
-  { 0x1, 0x1, 148, -1, 467, 12, 1, 18 },
-  { 0x200001, 0x200001, 148, -1, 469, 12, 1, 18 },
-  { 0x400001, 0x400001, 148, -1, 471, 12, 1, 18 },
-  { 0x600001, 0x600001, 148, -1, 473, 12, 1, 18 },
-  { 0x1, 0x1, 148, -1, 479, 12, 1, 20 },
-  { 0x1, 0x1, 148, -1, 482, 12, 1, 20 },
-  { 0x200001, 0x200001, 148, -1, 484, 12, 1, 20 },
-  { 0x400001, 0x400001, 148, -1, 486, 12, 1, 20 },
-  { 0x600001, 0x600001, 148, -1, 488, 12, 1, 20 },
-  { 0x1, 0x1, 148, -1, 490, 12, 1, 20 },
-  { 0x200001, 0x200001, 148, -1, 492, 12, 1, 20 },
-  { 0x400001, 0x400001, 148, -1, 494, 12, 1, 20 },
-  { 0x600001, 0x600001, 148, -1, 496, 12, 1, 20 },
-  { 0x1, 0x1, 148, -1, 506, 12, 1, 21 },
-  { 0x200001, 0x200001, 148, -1, 508, 12, 1, 21 },
-  { 0x400001, 0x400001, 148, -1, 510, 12, 1, 21 },
-  { 0x600001, 0x600001, 148, -1, 512, 12, 1, 21 },
-  { 0x41, 0x41, 148, -1, 514, 6, 1, 21 },
-  { 0x8000041, 0x8000041, 148, -1, 516, 6, 1, 21 },
-  { 0x10000041, 0x10000041, 148, -1, 518, 6, 1, 21 },
-  { 0x18000041, 0x18000041, 148, -1, 520, 6, 1, 21 },
-  { 0x1, 0x1, 148, -1, 530, 12, 1, 22 },
-  { 0x200001, 0x200001, 148, -1, 532, 12, 1, 22 },
-  { 0x400001, 0x400001, 148, -1, 534, 12, 1, 22 },
-  { 0x600001, 0x600001, 148, -1, 536, 12, 1, 22 },
-  { 0x1, 0x1, 148, -1, 542, 12, 1, 23 },
-  { 0x200001, 0x200001, 148, -1, 544, 12, 1, 23 },
-  { 0x400001, 0x400001, 148, -1, 546, 12, 1, 23 },
-  { 0x600001, 0x600001, 148, -1, 548, 12, 1, 23 },
-  { 0x41, 0x41, 148, -1, 550, 6, 1, 23 },
-  { 0x8000041, 0x8000041, 148, -1, 552, 6, 1, 23 },
-  { 0x10000041, 0x10000041, 148, -1, 554, 6, 1, 23 },
-  { 0x18000041, 0x18000041, 148, -1, 556, 6, 1, 23 },
-  { 0x1, 0x1, 148, -1, 566, 12, 1, 24 },
-  { 0x200001, 0x200001, 148, -1, 568, 12, 1, 24 },
-  { 0x400001, 0x400001, 148, -1, 570, 12, 1, 24 },
-  { 0x600001, 0x600001, 148, -1, 572, 12, 1, 24 },
-  { 0x1, 0x1, 148, -1, 578, 12, 1, 20 },
-  { 0x1, 0x1, 148, -1, 581, 12, 1, 20 },
-  { 0x200001, 0x200001, 148, -1, 583, 12, 1, 20 },
-  { 0x400001, 0x400001, 148, -1, 585, 12, 1, 20 },
-  { 0x600001, 0x600001, 148, -1, 587, 12, 1, 20 },
-  { 0x1, 0x1, 148, -1, 589, 12, 1, 20 },
-  { 0x200001, 0x200001, 148, -1, 591, 12, 1, 20 },
-  { 0x400001, 0x400001, 148, -1, 593, 12, 1, 20 },
-  { 0x600001, 0x600001, 148, -1, 595, 12, 1, 20 },
-  { 0x1, 0x1, 148, -1, 605, 12, 1, 24 },
-  { 0x200001, 0x200001, 148, -1, 607, 12, 1, 24 },
-  { 0x400001, 0x400001, 148, -1, 609, 12, 1, 24 },
-  { 0x600001, 0x600001, 148, -1, 611, 12, 1, 24 },
-  { 0x0, 0x0, 157, 616, -1, 0, 1, 72 },
-  { 0x0, 0x0, 157, 617, -1, 0, 1, 72 },
-  { 0x9, 0x9, 157, -1, 1150, 32, 1, 125 },
-  { 0x9, 0x9, 157, -1, 1159, 32, 1, 125 },
-  { 0x9, 0x9, 157, -1, 1168, 32, 1, 125 },
-  { 0x9, 0x9, 157, -1, 1177, 32, 1, 125 },
-  { 0x9, 0x9, 157, -1, 1186, 32, 1, 125 },
-  { 0x9, 0x9, 157, -1, 1195, 32, 1, 125 },
-  { 0x9, 0x9, 157, -1, 1204, 32, 1, 125 },
-  { 0x9, 0x9, 157, -1, 1213, 32, 1, 125 },
-  { 0x9, 0x9, 157, -1, 1222, 32, 1, 125 },
-  { 0x9, 0x9, 157, -1, 1232, 32, 1, 125 },
-  { 0x9, 0x9, 157, -1, 1242, 32, 1, 125 },
-  { 0x9, 0x9, 157, -1, 1252, 32, 1, 125 },
-  { 0x9, 0x9, 157, -1, 1261, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1267, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1273, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1279, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1285, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1291, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1297, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1303, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1309, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1315, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1321, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1327, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1333, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1339, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1345, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1351, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1357, 32, 1, 134 },
-  { 0x9, 0x9, 157, -1, 1363, 32, 1, 134 },
-  { 0x0, 0x0, 158, 982, 282, 0, 0, -1 },
-  { 0x1, 0x1, 158, -1, 2314, 38, 1, 4 },
-  { 0x0, 0x0, 158, 747, 323, 0, 0, -1 },
-  { 0x0, 0x0, 158, 983, 288, 0, 0, -1 },
-  { 0x1, 0x1, 158, -1, 2322, 38, 1, 4 },
-  { 0x0, 0x0, 158, 749, 335, 0, 0, -1 },
-  { 0x0, 0x0, 158, 750, 289, 0, 0, -1 },
-  { 0x0, 0x0, 158, 751, 295, 0, 0, -1 },
-  { 0x0, 0x0, 158, 984, 298, 0, 0, -1 },
-  { 0x1, 0x1, 158, -1, 2334, 38, 1, 4 },
-  { 0x0, 0x0, 158, 753, 339, 0, 0, -1 },
-  { 0x0, 0x0, 158, -1, 304, 0, 0, -1 },
-  { 0x1, 0x1, 158, -1, 2340, 38, 1, 4 },
-  { 0x0, 0x0, 158, 755, 351, 0, 0, -1 },
-  { 0x0, 0x0, 158, 756, 305, 0, 0, -1 },
-  { 0x0, 0x0, 158, 757, 311, 0, 0, -1 },
-  { 0x0, 0x0, 159, 1123, 1842, 0, 0, -1 },
-  { 0x0, 0x0, 159, 1124, 2363, 0, 1, 51 },
-  { 0x0, 0x0, 159, 1125, 1886, 0, 0, -1 },
-  { 0x1, 0x1, 159, 1126, -1, 29, 1, 46 },
-  { 0x0, 0x0, 160, -1, 1852, 0, 0, -1 },
-  { 0x1, 0x9, 160, -1, 2370, 33, 1, 51 },
-  { 0x0, 0x0, 161, 1114, 1850, 0, 0, -1 },
-  { 0x0, 0x0, 161, 1115, 2369, 0, 1, 51 },
-  { 0x1, 0x1, 162, 1128, -1, 27, 1, 30 },
-  { 0x0, 0x0, 163, 1735, 1846, 0, 0, -1 },
-  { 0x1, 0x1, 163, 1736, 2365, 33, 1, 51 },
-  { 0x0, 0x0, 163, 1737, 1888, 0, 0, -1 },
-  { 0x3, 0x3, 163, 1738, -1, 28, 1, 46 },
-  { 0x0, 0x0, 164, 1119, 1844, 0, 0, -1 },
-  { 0x1, 0x1, 164, 1120, 2364, 36, 1, 51 },
-  { 0x0, 0x0, 164, 1121, 1887, 0, 0, -1 },
-  { 0x5, 0x5, 164, 1122, -1, 27, 1, 46 },
-  { 0x0, 0x0, 165, -1, 2346, 0, 1, 55 },
-  { 0x1, 0x1, 167, -1, -1, 28, 1, 30 },
-  { 0x1, 0x1, 168, 2204, -1, 27, 1, 30 },
-  { 0x1, 0x1, 168, 2205, -1, 27, 1, 30 },
-  { 0x1, 0x1, 169, 1393, -1, 28, 1, 127 },
-  { 0x1, 0x1, 169, 1394, -1, 28, 1, 127 },
-  { 0x1, 0x1, 169, 1395, -1, 28, 1, 127 },
-  { 0x1, 0x1, 169, 1396, -1, 28, 1, 127 },
-  { 0x1, 0x1, 169, 1397, -1, 28, 1, 127 },
-  { 0x1, 0x1, 169, 1398, -1, 28, 1, 127 },
-  { 0x1, 0x1, 169, 1399, -1, 28, 1, 127 },
-  { 0x1, 0x1, 169, 1400, -1, 28, 1, 127 },
-  { 0x1, 0x1, 169, 1401, -1, 28, 1, 128 },
-  { 0x1, 0x1, 169, 1402, -1, 28, 1, 128 },
-  { 0x1, 0x1, 169, 1403, -1, 28, 1, 128 },
-  { 0x1, 0x1, 169, 1404, -1, 28, 1, 128 },
-  { 0x1, 0x1, 169, 1405, -1, 28, 1, 121 },
-  { 0x1, 0x1, 169, 1406, -1, 28, 1, 122 },
-  { 0x1, 0x1, 169, 1407, -1, 28, 1, 123 },
-  { 0x1, 0x1, 169, 1408, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1409, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1410, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1411, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1412, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1413, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1414, -1, 28, 1, 121 },
-  { 0x1, 0x1, 169, 1415, -1, 28, 1, 122 },
-  { 0x1, 0x1, 169, 1416, -1, 28, 1, 123 },
-  { 0x1, 0x1, 169, 1417, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1418, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1419, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1420, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1421, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1422, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1423, -1, 28, 1, 121 },
-  { 0x1, 0x1, 169, 1424, -1, 28, 1, 122 },
-  { 0x1, 0x1, 169, 1425, -1, 28, 1, 123 },
-  { 0x1, 0x1, 169, 1426, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1427, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1428, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1429, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1430, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1431, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1432, -1, 28, 1, 121 },
-  { 0x1, 0x1, 169, 1433, -1, 28, 1, 122 },
-  { 0x1, 0x1, 169, 1434, -1, 28, 1, 123 },
-  { 0x1, 0x1, 169, 1435, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1436, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1437, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1438, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1439, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1440, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1441, -1, 28, 1, 121 },
-  { 0x1, 0x1, 169, 1442, -1, 28, 1, 122 },
-  { 0x1, 0x1, 169, 1443, -1, 28, 1, 123 },
-  { 0x1, 0x1, 169, 1444, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1445, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1446, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1447, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1448, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1449, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1450, -1, 28, 1, 121 },
-  { 0x1, 0x1, 169, 1451, -1, 28, 1, 122 },
-  { 0x1, 0x1, 169, 1452, -1, 28, 1, 123 },
-  { 0x1, 0x1, 169, 1453, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1454, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1455, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1456, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1457, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1458, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1459, -1, 28, 1, 121 },
-  { 0x1, 0x1, 169, 1460, -1, 28, 1, 122 },
-  { 0x1, 0x1, 169, 1461, -1, 28, 1, 123 },
-  { 0x1, 0x1, 169, 1462, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1463, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1464, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1465, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1466, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1467, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1468, -1, 28, 1, 121 },
-  { 0x1, 0x1, 169, 1469, -1, 28, 1, 122 },
-  { 0x1, 0x1, 169, 1470, -1, 28, 1, 123 },
-  { 0x1, 0x1, 169, 1471, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1472, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1473, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1474, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1475, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1476, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1477, -1, 28, 1, 121 },
-  { 0x1, 0x1, 169, 1478, -1, 28, 1, 122 },
-  { 0x1, 0x1, 169, 1479, -1, 28, 1, 123 },
-  { 0x1, 0x1, 169, 1480, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1481, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1482, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1483, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1484, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1485, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1486, -1, 28, 1, 121 },
-  { 0x1, 0x1, 169, 1487, -1, 28, 1, 122 },
-  { 0x1, 0x1, 169, 1488, -1, 28, 1, 123 },
-  { 0x1, 0x1, 169, 1489, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1490, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1491, -1, 28, 1, 124 },
-  { 0x1, 0x1, 169, 1492, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1493, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1494, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1495, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1496, -1, 28, 1, 121 },
-  { 0x1, 0x1, 169, 1497, -1, 28, 1, 122 },
-  { 0x1, 0x1, 169, 1498, -1, 28, 1, 123 },
-  { 0x1, 0x1, 169, 1499, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1500, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1501, -1, 28, 1, 124 },
-  { 0x1, 0x1, 169, 1502, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1503, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1504, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1505, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1506, -1, 28, 1, 121 },
-  { 0x1, 0x1, 169, 1507, -1, 28, 1, 122 },
-  { 0x1, 0x1, 169, 1508, -1, 28, 1, 123 },
-  { 0x1, 0x1, 169, 1509, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1510, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1511, -1, 28, 1, 124 },
-  { 0x1, 0x1, 169, 1512, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1513, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1514, -1, 28, 1, 125 },
-  { 0x1, 0x1, 169, 1515, -1, 28, 1, 120 },
-  { 0x1, 0x1, 169, 1516, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1517, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1518, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1519, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1520, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1521, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1522, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1523, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1524, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1525, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1526, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1527, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1528, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1529, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1530, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1531, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1532, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1533, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1534, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1535, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1536, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1537, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1538, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1539, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1540, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1541, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1542, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1543, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1544, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1545, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1546, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1547, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1548, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1549, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1550, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1551, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1552, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1553, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1554, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1555, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1556, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1557, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1558, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1559, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1560, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1561, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1562, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1563, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1564, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1565, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1566, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1567, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1568, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1569, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1570, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1571, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1572, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1573, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1574, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1575, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1576, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1577, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1578, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1579, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1580, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1581, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1582, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1583, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1584, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1585, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1586, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1587, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1588, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1589, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1590, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1591, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1592, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1593, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1594, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1595, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1596, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1597, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1598, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1599, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1600, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1601, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1602, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1603, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1604, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1605, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1606, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1607, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1608, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1609, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1610, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1611, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1612, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1613, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1614, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1615, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1616, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1617, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1618, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1619, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1620, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1621, -1, 28, 1, 131 },
-  { 0x1, 0x1, 169, 1622, -1, 28, 1, 132 },
-  { 0x1, 0x1, 169, 1623, -1, 28, 1, 133 },
-  { 0x1, 0x1, 169, 1624, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1625, -1, 28, 1, 134 },
-  { 0x1, 0x1, 169, 1626, -1, 28, 1, 130 },
-  { 0x1, 0x1, 169, 1381, -1, 28, 1, 136 },
-  { 0x1, 0x1, 169, 1382, -1, 28, 1, 137 },
-  { 0x1, 0x1, 169, 1383, -1, 28, 1, 137 },
-  { 0x1, 0x1, 169, 1384, -1, 28, 1, 136 },
-  { 0x1, 0x1, 169, 1385, -1, 28, 1, 138 },
-  { 0x1, 0x1, 169, 1386, -1, 28, 1, 139 },
-  { 0x1, 0x1, 169, 1387, -1, 28, 1, 139 },
-  { 0x1, 0x1, 169, 1388, -1, 28, 1, 138 },
-  { 0x1, 0x1, 169, 1389, -1, 28, 1, 138 },
-  { 0x1, 0x1, 169, 1390, -1, 28, 1, 139 },
-  { 0x1, 0x1, 169, 1391, -1, 28, 1, 139 },
-  { 0x1, 0x1, 169, 1392, -1, 28, 1, 138 },
-  { 0x1, 0x1, 169, 1667, -1, 28, 1, 2 },
-  { 0x1, 0x1, 169, 1668, -1, 28, 1, 2 },
-  { 0x1, 0x1, 169, 1669, -1, 28, 1, 2 },
-  { 0x1, 0x1, 169, 1670, -1, 28, 1, 2 },
-  { 0x1, 0x1, 170, 1627, -1, 29, 1, 136 },
-  { 0x1, 0x1, 170, 1628, -1, 29, 1, 137 },
-  { 0x1, 0x1, 170, 1629, -1, 29, 1, 137 },
-  { 0x1, 0x1, 170, 1630, -1, 29, 1, 136 },
-  { 0x1, 0x1, 170, 1631, -1, 29, 1, 138 },
-  { 0x1, 0x1, 170, 1632, -1, 29, 1, 139 },
-  { 0x1, 0x1, 170, 1633, -1, 29, 1, 139 },
-  { 0x1, 0x1, 170, 1634, -1, 29, 1, 138 },
-  { 0x1, 0x1, 170, 1635, -1, 29, 1, 138 },
-  { 0x1, 0x1, 170, 1636, -1, 29, 1, 139 },
-  { 0x1, 0x1, 170, 1637, -1, 29, 1, 139 },
-  { 0x1, 0x1, 170, 1638, -1, 29, 1, 138 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 127 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 127 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 127 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 127 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 127 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 127 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 127 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 127 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 128 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 128 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 128 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 128 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 121 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 122 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 123 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 257, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 1791, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 121 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 122 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 123 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 259, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 1792, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 121 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 122 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 123 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 261, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 1793, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 121 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 122 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 123 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 263, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 1794, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 121 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 122 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 123 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 265, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 1795, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 121 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 122 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 123 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 267, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 1796, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 121 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 122 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 123 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 269, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 1797, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 121 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 122 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 123 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 271, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 1798, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 121 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 122 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 123 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 273, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 1799, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 121 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 122 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 123 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 124 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 275, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 1800, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 121 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 122 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 123 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 124 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 277, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 1801, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 121 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 122 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 123 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 124 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 279, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 125 },
-  { 0x3, 0x3, 171, 1802, -1, 28, 1, 120 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1803, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1804, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1805, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1806, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1807, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1808, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1809, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1810, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1811, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1812, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1813, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1814, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1815, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1816, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1817, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1818, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1819, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 131 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 132 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 133 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 134 },
-  { 0x3, 0x3, 171, 1820, -1, 28, 1, 130 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 136 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 137 },
-  { 0x3, 0x3, 171, 765, -1, 28, 1, 137 },
-  { 0x3, 0x3, 171, 766, -1, 28, 1, 136 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 138 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 139 },
-  { 0x3, 0x3, 171, 767, -1, 28, 1, 139 },
-  { 0x3, 0x3, 171, 768, -1, 28, 1, 138 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 138 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 139 },
-  { 0x3, 0x3, 171, 769, -1, 28, 1, 139 },
-  { 0x3, 0x3, 171, 770, -1, 28, 1, 138 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, 1759, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, 1760, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, 1761, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, 1762, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, 1763, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, 1764, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 126 },
-  { 0x3, 0x3, 171, 1765, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 126 },
-  { 0x3, 0x3, 171, 1766, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 135 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 135 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x3, 0x3, 171, -1, -1, 28, 1, 2 },
-  { 0x0, 0x0, 172, -1, 314, 0, 0, -1 },
-  { 0x0, 0x0, 172, 2402, 2372, 0, 1, 67 },
-  { 0x0, 0x0, 172, -1, 318, 0, 0, -1 },
-  { 0x0, 0x0, 172, 2404, 2374, 0, 1, 67 },
-  { 0x11, 0x31, 173, 2306, 321, 33, 1, 7 },
-  { 0x2200001, 0x2200001, 173, -1, 322, 12, 1, 7 },
-  { 0x1, 0x1, 173, -1, 325, 37, 1, 7 },
-  { 0x2000001, 0x2000001, 173, -1, 326, 12, 1, 7 },
-  { 0x11, 0x11, 173, -1, 327, 33, 1, 7 },
-  { 0x2200001, 0x2200001, 173, -1, 328, 12, 1, 7 },
-  { 0x11, 0x31, 173, 2316, 333, 33, 1, 7 },
-  { 0x2200001, 0x2200001, 173, -1, 334, 12, 1, 7 },
-  { 0x11, 0x31, 173, 2326, 337, 33, 1, 7 },
-  { 0x2200001, 0x2200001, 173, -1, 338, 12, 1, 7 },
-  { 0x1, 0x1, 173, -1, 341, 37, 1, 7 },
-  { 0x2000001, 0x2000001, 173, -1, 342, 12, 1, 7 },
-  { 0x11, 0x11, 173, -1, 343, 33, 1, 7 },
-  { 0x2200001, 0x2200001, 173, -1, 344, 12, 1, 7 },
-  { 0x11, 0x31, 173, 2336, 349, 33, 1, 7 },
-  { 0x2200001, 0x2200001, 173, -1, 350, 12, 1, 7 },
-  { 0x1, 0x1, 173, -1, 353, 33, 1, 70 },
-  { 0x200001, 0x200001, 173, -1, 354, 12, 1, 70 },
-  { 0x1, 0x1, 173, -1, 357, 33, 1, 70 },
-  { 0x200001, 0x200001, 173, -1, 358, 12, 1, 70 },
-  { 0x1, 0x1, 174, -1, -1, 37, 1, 7 },
-  { 0x2000001, 0x2000001, 174, -1, -1, 12, 1, 7 },
-  { 0x1, 0x1, 174, -1, -1, 37, 1, 7 },
-  { 0x2000001, 0x2000001, 174, -1, -1, 12, 1, 7 },
-  { 0x11, 0x11, 174, -1, -1, 33, 1, 7 },
-  { 0x2200001, 0x2200001, 174, -1, -1, 12, 1, 7 },
-  { 0x1, 0x1, 174, -1, -1, 37, 1, 7 },
-  { 0x2000001, 0x2000001, 174, -1, -1, 12, 1, 7 },
-  { 0x0, 0x0, 174, -1, -1, 0, 1, 8 },
-  { 0x1, 0x1, 174, -1, -1, 12, 1, 8 },
-  { 0x0, 0x0, 174, -1, -1, 0, 1, 8 },
-  { 0x1, 0x1, 174, -1, -1, 12, 1, 8 },
-  { 0x1, 0x1, 174, -1, -1, 33, 1, 8 },
-  { 0x200001, 0x200001, 174, -1, -1, 12, 1, 8 },
-  { 0x0, 0x0, 174, -1, -1, 0, 1, 8 },
-  { 0x1, 0x1, 174, -1, -1, 12, 1, 8 },
-  { 0x1, 0x1, 174, -1, -1, 37, 1, 7 },
-  { 0x2000001, 0x2000001, 174, -1, -1, 12, 1, 7 },
-  { 0x1, 0x1, 174, -1, -1, 37, 1, 7 },
-  { 0x2000001, 0x2000001, 174, -1, -1, 12, 1, 7 },
-  { 0x11, 0x11, 174, -1, -1, 33, 1, 7 },
-  { 0x2200001, 0x2200001, 174, -1, -1, 12, 1, 7 },
-  { 0x1, 0x1, 174, -1, -1, 37, 1, 7 },
-  { 0x2000001, 0x2000001, 174, -1, -1, 12, 1, 7 },
-  { 0x0, 0x0, 174, -1, -1, 0, 1, 8 },
-  { 0x1, 0x1, 174, -1, -1, 12, 1, 8 },
-  { 0x0, 0x0, 174, -1, -1, 0, 1, 8 },
-  { 0x1, 0x1, 174, -1, -1, 12, 1, 8 },
-  { 0x1, 0x1, 174, -1, -1, 33, 1, 8 },
-  { 0x200001, 0x200001, 174, -1, -1, 12, 1, 8 },
-  { 0x0, 0x0, 174, -1, -1, 0, 1, 8 },
-  { 0x1, 0x1, 174, -1, -1, 12, 1, 8 },
-  { 0x9, 0x9, 174, -1, -1, 33, 1, 71 },
-  { 0x1, 0x1, 174, 315, -1, 33, 1, 70 },
-  { 0x1200001, 0x1200001, 174, -1, -1, 12, 1, 71 },
-  { 0x200001, 0x200001, 174, 316, -1, 12, 1, 70 },
-  { 0x9, 0x9, 174, -1, -1, 33, 1, 71 },
-  { 0x1, 0x1, 174, 319, -1, 33, 1, 70 },
-  { 0x1200001, 0x1200001, 174, -1, -1, 12, 1, 71 },
-  { 0x200001, 0x200001, 174, 320, -1, 12, 1, 70 },
-  { 0x0, 0x0, 175, -1, 1848, 0, 0, -1 },
-  { 0x9, 0x9, 175, -1, 2366, 33, 1, 46 },
-  { 0x0, 0x0, 175, -1, 1889, 0, 0, -1 },
-  { 0x7, 0x7, 175, -1, -1, 27, 1, 46 },
-  { 0x1, 0x1, 195, -1, -1, 27, 1, 13 },
-  { 0x1, 0x1, 209, -1, -1, 29, 1, 0 },
-  { 0x1, 0x1, 209, -1, -1, 29, 1, 0 },
-  { 0x2, 0x3, 209, 936, -1, 27, 1, 30 },
-  { 0x0, 0x0, 209, 937, -1, 0, 1, 30 },
-  { 0x0, 0x0, 209, 938, -1, 0, 1, 0 },
-  { 0x0, 0x0, 209, 939, -1, 0, 1, 0 },
-  { 0x0, 0x0, 209, 940, -1, 0, 1, 0 },
-  { 0x0, 0x0, 209, 941, -1, 0, 1, 0 },
-  { 0x0, 0x0, 209, 2388, -1, 0, 1, 2 },
-  { 0x0, 0x0, 209, 2389, -1, 0, 1, 2 },
-  { 0x0, 0x0, 209, 2390, 780, 0, 0, -1 },
-  { 0x1, 0x1, 210, -1, -1, 27, 1, 0 },
-  { 0x1, 0x1, 210, -1, -1, 27, 1, 0 },
-  { 0x1, 0x1, 211, -1, 1132, 32, 1, 127 },
-  { 0x1, 0x1, 211, -1, 1134, 32, 1, 127 },
-  { 0x1, 0x1, 211, -1, 1136, 32, 1, 127 },
-  { 0x1, 0x1, 211, -1, 1138, 32, 1, 127 },
-  { 0x1, 0x1, 211, -1, 1140, 32, 1, 128 },
-  { 0x1, 0x1, 211, -1, 1142, 32, 1, 128 },
-  { 0x1, 0x1, 211, -1, 1639, 32, 1, 2 },
-  { 0x1, 0x1, 211, -1, 1641, 32, 1, 2 },
-  { 0x1, 0x1, 211, -1, 1643, 32, 1, 2 },
-  { 0x1, 0x1, 211, -1, 1645, 32, 1, 2 },
-  { 0x1, 0x1, 211, -1, 1647, 32, 1, 2 },
-  { 0x1, 0x1, 211, -1, 1649, 32, 1, 2 },
-  { 0x1, 0x1, 211, 2208, 1651, 32, 1, 2 },
-  { 0x1, 0x1, 211, 2209, 1654, 32, 1, 2 },
-  { 0x0, 0x0, 212, -1, 2250, 0, 0, -1 },
-  { 0x0, 0x0, 212, -1, 2251, 0, 0, -1 },
-  { 0x0, 0x0, 212, -1, 2276, 0, 0, -1 },
-  { 0x5, 0x5, 212, -1, 2279, 20, 1, 59 },
-  { 0x0, 0x0, 216, 1750, 779, 0, 0, -1 },
-  { 0x0, 0x0, 217, -1, 908, 0, 0, -1 },
-  { 0x0, 0x0, 217, -1, 989, 0, 0, -1 },
-  { 0x0, 0x0, 217, -1, -1, 0, 1, 117 },
-  { 0x0, 0x0, 217, -1, -1, 0, 1, 58 },
-  { 0x1, 0x1, 217, 656, 1822, 36, 1, 57 },
-  { 0x1, 0x1, 217, 657, 1857, 36, 1, 57 },
-  { 0x0, 0x0, 217, 658, 1860, 0, 0, -1 },
-  { 0x1, 0x1, 217, 659, -1, 36, 1, 57 },
-  { 0x0, 0x0, 217, 1129, -1, 0, 1, 30 },
-  { 0x1, 0x1, 217, 660, 1865, 36, 1, 57 },
-  { 0x0, 0x0, 217, 661, 1868, 0, 0, -1 },
-  { 0x1, 0x1, 217, 662, -1, 36, 1, 57 },
-  { 0x0, 0x0, 217, 663, 1871, 0, 0, -1 },
-  { 0x1, 0x1, 217, 664, -1, 36, 1, 57 },
-  { 0x1, 0x1, 217, 665, 1874, 36, 1, 57 },
-  { 0x1, 0x1, 217, 666, 1877, 36, 1, 57 },
-  { 0x0, 0x0, 217, 1130, -1, 0, 1, 30 },
-  { 0x1, 0x1, 217, 667, 1907, 36, 1, 57 },
-  { 0x1, 0x1, 217, 668, -1, 31, 1, 129 },
-  { 0x1, 0x1, 217, 220, 1143, 32, 1, 121 },
-  { 0x1, 0x1, 217, 221, 1152, 32, 1, 121 },
-  { 0x1, 0x1, 217, 222, 1161, 32, 1, 121 },
-  { 0x1, 0x1, 217, 223, 1170, 32, 1, 121 },
-  { 0x1, 0x1, 217, 224, 1179, 32, 1, 121 },
-  { 0x1, 0x1, 217, 225, 1188, 32, 1, 121 },
-  { 0x1, 0x1, 217, 226, 1197, 32, 1, 121 },
-  { 0x1, 0x1, 217, 227, 1206, 32, 1, 121 },
-  { 0x1, 0x1, 217, 228, 1215, 32, 1, 121 },
-  { 0x1, 0x1, 217, 229, 1224, 32, 1, 121 },
-  { 0x1, 0x1, 217, 230, 1234, 32, 1, 121 },
-  { 0x1, 0x1, 217, 231, 1244, 32, 1, 121 },
-  { 0x1, 0x1, 217, 232, 1257, 32, 1, 131 },
-  { 0x1, 0x1, 217, 233, 1263, 32, 1, 131 },
-  { 0x1, 0x1, 217, 234, 1269, 32, 1, 131 },
-  { 0x1, 0x1, 217, 235, 1275, 32, 1, 131 },
-  { 0x1, 0x1, 217, 236, 1281, 32, 1, 131 },
-  { 0x1, 0x1, 217, 237, 1287, 32, 1, 131 },
-  { 0x1, 0x1, 217, 238, 1293, 32, 1, 131 },
-  { 0x1, 0x1, 217, 239, 1299, 32, 1, 131 },
-  { 0x1, 0x1, 217, 240, 1305, 32, 1, 131 },
-  { 0x1, 0x1, 217, 241, 1311, 32, 1, 131 },
-  { 0x1, 0x1, 217, 242, 1317, 32, 1, 131 },
-  { 0x1, 0x1, 217, 243, 1323, 32, 1, 131 },
-  { 0x1, 0x1, 217, 244, 1329, 32, 1, 131 },
-  { 0x1, 0x1, 217, 245, 1335, 32, 1, 131 },
-  { 0x1, 0x1, 217, 246, 1341, 32, 1, 131 },
-  { 0x1, 0x1, 217, 247, 1347, 32, 1, 131 },
-  { 0x1, 0x1, 217, 248, 1353, 32, 1, 131 },
-  { 0x1, 0x1, 217, 249, 1359, 32, 1, 131 },
-  { 0x1, 0x1, 217, 672, -1, 31, 1, 5 },
-  { 0x0, 0x0, 218, 1910, -1, 0, 1, 57 },
-  { 0x0, 0x0, 218, 1911, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 23, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1913, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1914, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1915, -1, 0, 1, 41 },
-  { 0x0, 0x0, 218, 1916, -1, 0, 1, 36 },
-  { 0x1, 0x1, 218, 1917, -1, 12, 1, 45 },
-  { 0x0, 0x0, 218, 1918, -1, 0, 1, 50 },
-  { 0x1000001, 0x1000001, 218, 1919, -1, 12, 1, 45 },
-  { 0x1, 0x1, 218, 1920, -1, 36, 1, 50 },
-  { 0x200001, 0x200001, 218, 1921, -1, 12, 1, 45 },
-  { 0x1, 0x1, 218, 1922, -1, 33, 1, 50 },
-  { 0x1200001, 0x1200001, 218, 1923, -1, 12, 1, 45 },
-  { 0x9, 0x9, 218, 1924, -1, 33, 1, 45 },
-  { 0x1, 0x1, 218, 1925, -1, 12, 1, 45 },
-  { 0x0, 0x0, 218, 1926, -1, 0, 1, 50 },
-  { 0x200001, 0x1200001, 218, 1927, -1, 12, 1, 45 },
-  { 0x1, 0x9, 218, 1928, -1, 33, 1, 50 },
-  { 0x1, 0x1, 218, 1929, -1, 12, 1, 45 },
-  { 0x0, 0x0, 218, 1930, -1, 0, 1, 50 },
-  { 0x1000001, 0x1000001, 218, 1931, -1, 12, 1, 45 },
-  { 0x1, 0x1, 218, 1932, -1, 36, 1, 50 },
-  { 0x200001, 0x200001, 218, 1933, -1, 12, 1, 45 },
-  { 0x1, 0x1, 218, 1934, -1, 33, 1, 50 },
-  { 0x1200001, 0x1200001, 218, 1935, -1, 12, 1, 45 },
-  { 0x9, 0x9, 218, 1936, -1, 33, 1, 45 },
-  { 0x1, 0x1, 218, 1937, -1, 12, 1, 45 },
-  { 0x0, 0x0, 218, 1938, -1, 0, 1, 50 },
-  { 0x200001, 0x1200001, 218, 1939, -1, 12, 1, 45 },
-  { 0x1, 0x9, 218, 1940, -1, 33, 1, 50 },
-  { 0x1, 0x1, 218, 1941, -1, 28, 1, 25 },
-  { 0x0, 0x0, 218, 1942, -1, 0, 1, 25 },
-  { 0x3, 0x3, 218, 1943, -1, 27, 1, 25 },
-  { 0x1, 0x1, 218, 1944, -1, 27, 1, 25 },
-  { 0x0, 0x0, 218, 1945, -1, 0, 1, 57 },
-  { 0x0, 0x0, 218, 1946, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1947, -1, 0, 1, 25 },
-  { 0x1, 0x1, 218, 1948, -1, 36, 1, 57 },
-  { 0x1, 0x1, 218, 1949, -1, 37, 1, 25 },
-  { 0x0, 0x0, 218, 1950, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1951, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1952, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1953, -1, 0, 1, 57 },
-  { 0x0, 0x0, 218, 1954, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 35, -1, 0, 1, 25 },
-  { 0x1, 0x1, 218, 1956, -1, 36, 1, 57 },
-  { 0x1, 0x1, 218, 1957, -1, 37, 1, 25 },
-  { 0x0, 0x0, 218, 1958, -1, 0, 1, 25 },
-  { 0x1, 0x1, 218, 1959, -1, 36, 1, 57 },
-  { 0x1, 0x1, 218, 1960, -1, 37, 1, 25 },
-  { 0x0, 0x0, 218, 1961, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1962, -1, 0, 1, 57 },
-  { 0x0, 0x0, 218, 1963, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 40, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1965, -1, 0, 1, 57 },
-  { 0x0, 0x0, 218, 1966, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 41, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1968, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1969, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1970, -1, 0, 1, 45 },
-  { 0x1, 0x1, 218, 1971, -1, 27, 1, 45 },
-  { 0x1, 0x1, 218, 1972, -1, 28, 1, 45 },
-  { 0x3, 0x3, 218, 1973, -1, 27, 1, 45 },
-  { 0x1, 0x1, 218, 1974, -1, 29, 1, 45 },
-  { 0x5, 0x5, 218, 1975, -1, 27, 1, 45 },
-  { 0x3, 0x3, 218, 1976, -1, 28, 1, 45 },
-  { 0x7, 0x7, 218, 1977, -1, 27, 1, 45 },
-  { 0x1, 0x1, 218, 1978, -1, 28, 1, 25 },
-  { 0x0, 0x0, 218, 1979, -1, 0, 1, 25 },
-  { 0x3, 0x3, 218, 1980, -1, 27, 1, 25 },
-  { 0x1, 0x1, 218, 1981, -1, 27, 1, 25 },
-  { 0x0, 0x0, 218, 1982, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1983, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1984, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 50, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1986, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1987, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 55, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1989, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1990, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 58, -1, 0, 1, 2 },
-  { 0x0, 0x0, 218, 1992, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1993, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 1994, -1, 0, 1, 31 },
-  { 0x0, 0x0, 218, 1995, -1, 0, 1, 57 },
-  { 0x0, 0x0, 218, 1996, -1, 0, 1, 25 },
-  { 0x0, 0x0, 218, 63, -1, 0, 1, 25 },
-  { 0x1, 0x1, 219, 1998, -1, 34, 1, 57 },
-  { 0x1, 0x1, 219, 1999, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2000, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2001, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2002, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2003, -1, 34, 1, 42 },
-  { 0x1, 0x1, 219, 2004, -1, 34, 1, 38 },
-  { 0x400001, 0x400001, 219, 2005, -1, 12, 1, 47 },
-  { 0x1, 0x1, 219, 2006, -1, 34, 1, 52 },
-  { 0x1400001, 0x1400001, 219, 2007, -1, 12, 1, 47 },
-  { 0x5, 0x5, 219, 2008, -1, 34, 1, 52 },
-  { 0x600001, 0x600001, 219, 2009, -1, 12, 1, 47 },
-  { 0x3, 0x3, 219, 2010, -1, 33, 1, 52 },
-  { 0x1600001, 0x1600001, 219, 2011, -1, 12, 1, 47 },
-  { 0xb, 0xb, 219, 2012, -1, 33, 1, 47 },
-  { 0x400001, 0x400001, 219, 2013, -1, 12, 1, 47 },
-  { 0x1, 0x1, 219, 2014, -1, 34, 1, 52 },
-  { 0x600001, 0x1600001, 219, 2015, -1, 12, 1, 47 },
-  { 0x3, 0xb, 219, 2016, -1, 33, 1, 52 },
-  { 0x400001, 0x400001, 219, 2017, -1, 12, 1, 47 },
-  { 0x1, 0x1, 219, 2018, -1, 34, 1, 52 },
-  { 0x1400001, 0x1400001, 219, 2019, -1, 12, 1, 47 },
-  { 0x5, 0x5, 219, 2020, -1, 34, 1, 52 },
-  { 0x600001, 0x600001, 219, 2021, -1, 12, 1, 47 },
-  { 0x3, 0x3, 219, 2022, -1, 33, 1, 52 },
-  { 0x1600001, 0x1600001, 219, 2023, -1, 12, 1, 47 },
-  { 0xb, 0xb, 219, 2024, -1, 33, 1, 47 },
-  { 0x400001, 0x400001, 219, 2025, -1, 12, 1, 47 },
-  { 0x1, 0x1, 219, 2026, -1, 34, 1, 52 },
-  { 0x600001, 0x1600001, 219, 2027, -1, 12, 1, 47 },
-  { 0x3, 0xb, 219, 2028, -1, 33, 1, 52 },
-  { 0x41, 0x41, 219, 2029, -1, 28, 1, 27 },
-  { 0x1, 0x1, 219, 2030, -1, 34, 1, 27 },
-  { 0x83, 0x83, 219, 2031, -1, 27, 1, 27 },
-  { 0x81, 0x81, 219, 2032, -1, 27, 1, 27 },
-  { 0x1, 0x1, 219, 2033, -1, 34, 1, 57 },
-  { 0x1, 0x1, 219, 2034, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2035, -1, 34, 1, 27 },
-  { 0x5, 0x5, 219, 2036, -1, 34, 1, 57 },
-  { 0x9, 0x9, 219, 2037, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2038, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2039, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2040, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2041, -1, 34, 1, 57 },
-  { 0x1, 0x1, 219, 2042, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2043, -1, 34, 1, 27 },
-  { 0x5, 0x5, 219, 2044, -1, 34, 1, 57 },
-  { 0x9, 0x9, 219, 2045, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2046, -1, 34, 1, 27 },
-  { 0x5, 0x5, 219, 2047, -1, 34, 1, 57 },
-  { 0x9, 0x9, 219, 2048, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2049, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2050, -1, 34, 1, 57 },
-  { 0x1, 0x1, 219, 2051, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2052, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2053, -1, 34, 1, 57 },
-  { 0x1, 0x1, 219, 2054, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2055, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2056, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2057, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2058, -1, 34, 1, 47 },
-  { 0x81, 0x81, 219, 2059, -1, 27, 1, 47 },
-  { 0x41, 0x41, 219, 2060, -1, 28, 1, 47 },
-  { 0x83, 0x83, 219, 2061, -1, 27, 1, 47 },
-  { 0x21, 0x21, 219, 2062, -1, 29, 1, 47 },
-  { 0x85, 0x85, 219, 2063, -1, 27, 1, 47 },
-  { 0x43, 0x43, 219, 2064, -1, 28, 1, 47 },
-  { 0x87, 0x87, 219, 2065, -1, 27, 1, 47 },
-  { 0x41, 0x41, 219, 2066, -1, 28, 1, 27 },
-  { 0x1, 0x1, 219, 2067, -1, 34, 1, 27 },
-  { 0x83, 0x83, 219, 2068, -1, 27, 1, 27 },
-  { 0x81, 0x81, 219, 2069, -1, 27, 1, 27 },
-  { 0x1, 0x1, 219, 2070, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2071, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2072, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2073, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2074, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2075, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2076, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2077, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2078, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2079, -1, 34, 1, 2 },
-  { 0x1, 0x1, 219, 2080, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2081, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2082, -1, 34, 1, 33 },
-  { 0x1, 0x1, 219, 2083, -1, 34, 1, 57 },
-  { 0x1, 0x1, 219, 2084, -1, 34, 1, 27 },
-  { 0x1, 0x1, 219, 2085, -1, 34, 1, 27 },
-  { 0x1, 0x1, 220, 2086, -1, 35, 1, 57 },
-  { 0x1, 0x1, 220, 2087, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2088, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2089, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2090, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2091, -1, 35, 1, 43 },
-  { 0x1, 0x1, 220, 2092, -1, 35, 1, 39 },
-  { 0x800001, 0x800001, 220, 2093, -1, 12, 1, 48 },
-  { 0x1, 0x1, 220, 2094, -1, 35, 1, 53 },
-  { 0x1800001, 0x1800001, 220, 2095, -1, 12, 1, 48 },
-  { 0x3, 0x3, 220, 2096, -1, 35, 1, 53 },
-  { 0xa00001, 0xa00001, 220, 2097, -1, 12, 1, 48 },
-  { 0x5, 0x5, 220, 2098, -1, 33, 1, 53 },
-  { 0x1a00001, 0x1a00001, 220, 2099, -1, 12, 1, 48 },
-  { 0xd, 0xd, 220, 2100, -1, 33, 1, 48 },
-  { 0x800001, 0x800001, 220, 2101, -1, 12, 1, 48 },
-  { 0x1, 0x1, 220, 2102, -1, 35, 1, 53 },
-  { 0xa00001, 0x1a00001, 220, 2103, -1, 12, 1, 48 },
-  { 0x5, 0xd, 220, 2104, -1, 33, 1, 53 },
-  { 0x800001, 0x800001, 220, 2105, -1, 12, 1, 48 },
-  { 0x1, 0x1, 220, 2106, -1, 35, 1, 53 },
-  { 0x1800001, 0x1800001, 220, 2107, -1, 12, 1, 48 },
-  { 0x3, 0x3, 220, 2108, -1, 35, 1, 53 },
-  { 0xa00001, 0xa00001, 220, 2109, -1, 12, 1, 48 },
-  { 0x5, 0x5, 220, 2110, -1, 33, 1, 53 },
-  { 0x1a00001, 0x1a00001, 220, 2111, -1, 12, 1, 48 },
-  { 0xd, 0xd, 220, 2112, -1, 33, 1, 48 },
-  { 0x800001, 0x800001, 220, 2113, -1, 12, 1, 48 },
-  { 0x1, 0x1, 220, 2114, -1, 35, 1, 53 },
-  { 0xa00001, 0x1a00001, 220, 2115, -1, 12, 1, 48 },
-  { 0x5, 0xd, 220, 2116, -1, 33, 1, 53 },
-  { 0x81, 0x81, 220, 2117, -1, 28, 1, 28 },
-  { 0x1, 0x1, 220, 2118, -1, 35, 1, 28 },
-  { 0x103, 0x103, 220, 2119, -1, 27, 1, 28 },
-  { 0x101, 0x101, 220, 2120, -1, 27, 1, 28 },
-  { 0x1, 0x1, 220, 2121, -1, 35, 1, 57 },
-  { 0x1, 0x1, 220, 2122, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2123, -1, 35, 1, 28 },
-  { 0x3, 0x3, 220, 2124, -1, 35, 1, 57 },
-  { 0x5, 0x5, 220, 2125, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2126, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2127, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2128, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2129, -1, 35, 1, 57 },
-  { 0x1, 0x1, 220, 2130, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2131, -1, 35, 1, 28 },
-  { 0x3, 0x3, 220, 2132, -1, 35, 1, 57 },
-  { 0x5, 0x5, 220, 2133, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2134, -1, 35, 1, 28 },
-  { 0x3, 0x3, 220, 2135, -1, 35, 1, 57 },
-  { 0x5, 0x5, 220, 2136, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2137, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2138, -1, 35, 1, 57 },
-  { 0x1, 0x1, 220, 2139, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2140, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2141, -1, 35, 1, 57 },
-  { 0x1, 0x1, 220, 2142, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2143, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2144, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2145, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2146, -1, 35, 1, 48 },
-  { 0x101, 0x101, 220, 2147, -1, 27, 1, 48 },
-  { 0x81, 0x81, 220, 2148, -1, 28, 1, 48 },
-  { 0x103, 0x103, 220, 2149, -1, 27, 1, 48 },
-  { 0x41, 0x41, 220, 2150, -1, 29, 1, 48 },
-  { 0x105, 0x105, 220, 2151, -1, 27, 1, 48 },
-  { 0x83, 0x83, 220, 2152, -1, 28, 1, 48 },
-  { 0x107, 0x107, 220, 2153, -1, 27, 1, 48 },
-  { 0x81, 0x81, 220, 2154, -1, 28, 1, 28 },
-  { 0x1, 0x1, 220, 2155, -1, 35, 1, 28 },
-  { 0x103, 0x103, 220, 2156, -1, 27, 1, 28 },
-  { 0x101, 0x101, 220, 2157, -1, 27, 1, 28 },
-  { 0x1, 0x1, 220, 2158, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2159, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2160, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2161, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2162, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2163, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2164, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2165, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2166, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2167, -1, 35, 1, 2 },
-  { 0x1, 0x1, 220, 2168, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2169, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2170, -1, 35, 1, 34 },
-  { 0x1, 0x1, 220, 2171, -1, 35, 1, 57 },
-  { 0x1, 0x1, 220, 2172, -1, 35, 1, 28 },
-  { 0x1, 0x1, 220, 2173, -1, 35, 1, 28 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 57 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, 1776, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 44 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 40 },
-  { 0xc00001, 0xc00001, 221, -1, -1, 12, 1, 49 },
-  { 0x3, 0x3, 221, 2347, -1, 34, 1, 54 },
-  { 0x1c00001, 0x1c00001, 221, -1, -1, 12, 1, 49 },
-  { 0x7, 0x7, 221, 2348, -1, 34, 1, 54 },
-  { 0xe00001, 0xe00001, 221, -1, -1, 12, 1, 49 },
-  { 0x7, 0x7, 221, 2349, -1, 33, 1, 54 },
-  { 0x1e00001, 0x1e00001, 221, -1, -1, 12, 1, 49 },
-  { 0xf, 0xf, 221, 2350, -1, 33, 1, 49 },
-  { 0xc00001, 0xc00001, 221, -1, -1, 12, 1, 49 },
-  { 0x3, 0x3, 221, 2355, -1, 34, 1, 54 },
-  { 0xe00001, 0x1e00001, 221, -1, -1, 12, 1, 49 },
-  { 0x7, 0xf, 221, 2356, -1, 33, 1, 54 },
-  { 0xc00001, 0xc00001, 221, -1, -1, 12, 1, 49 },
-  { 0x3, 0x3, 221, 2359, -1, 34, 1, 54 },
-  { 0x1c00001, 0x1c00001, 221, -1, -1, 12, 1, 49 },
-  { 0x7, 0x7, 221, 2360, -1, 34, 1, 54 },
-  { 0xe00001, 0xe00001, 221, -1, -1, 12, 1, 49 },
-  { 0x7, 0x7, 221, 2361, -1, 33, 1, 54 },
-  { 0x1e00001, 0x1e00001, 221, -1, -1, 12, 1, 49 },
-  { 0xf, 0xf, 221, 2362, -1, 33, 1, 49 },
-  { 0xc00001, 0xc00001, 221, -1, -1, 12, 1, 49 },
-  { 0x3, 0x3, 221, 2367, -1, 34, 1, 54 },
-  { 0xe00001, 0x1e00001, 221, -1, -1, 12, 1, 49 },
-  { 0x7, 0xf, 221, 2368, -1, 33, 1, 54 },
-  { 0xc1, 0xc1, 221, -1, -1, 28, 1, 29 },
-  { 0x3, 0x3, 221, 2287, -1, 34, 1, 29 },
-  { 0x183, 0x183, 221, -1, -1, 27, 1, 29 },
-  { 0x181, 0x181, 221, 2288, -1, 27, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 57 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, 1777, -1, 34, 1, 29 },
-  { 0x7, 0x7, 221, -1, -1, 34, 1, 57 },
-  { 0xb, 0xb, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, 1778, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 57 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, 1781, -1, 34, 1, 29 },
-  { 0x7, 0x7, 221, -1, -1, 34, 1, 57 },
-  { 0xb, 0xb, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, 1782, -1, 34, 1, 29 },
-  { 0x7, 0x7, 221, -1, -1, 34, 1, 57 },
-  { 0xb, 0xb, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, 1784, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 57 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, 1786, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 57 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, 1787, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 49 },
-  { 0x181, 0x181, 221, -1, -1, 27, 1, 49 },
-  { 0xc1, 0xc1, 221, -1, -1, 28, 1, 49 },
-  { 0x183, 0x183, 221, -1, -1, 27, 1, 49 },
-  { 0x61, 0x61, 221, -1, -1, 29, 1, 49 },
-  { 0x185, 0x185, 221, -1, -1, 27, 1, 49 },
-  { 0xc3, 0xc3, 221, -1, -1, 28, 1, 49 },
-  { 0x187, 0x187, 221, -1, -1, 27, 1, 49 },
-  { 0xc1, 0xc1, 221, -1, -1, 28, 1, 29 },
-  { 0x3, 0x3, 221, 2291, -1, 34, 1, 29 },
-  { 0x183, 0x183, 221, -1, -1, 27, 1, 29 },
-  { 0x181, 0x181, 221, 2292, -1, 27, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 2 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 35 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 57 },
-  { 0x3, 0x3, 221, -1, -1, 34, 1, 29 },
-  { 0x3, 0x3, 221, 1789, -1, 34, 1, 29 },
-  { 0x3, 0x3, 222, 363, 1145, 32, 1, 123 },
-  { 0x3, 0x3, 222, 364, 1154, 32, 1, 123 },
-  { 0x3, 0x3, 222, 365, 1163, 32, 1, 123 },
-  { 0x3, 0x3, 222, 366, 1172, 32, 1, 123 },
-  { 0x3, 0x3, 222, 367, 1181, 32, 1, 123 },
-  { 0x3, 0x3, 222, 368, 1190, 32, 1, 123 },
-  { 0x3, 0x3, 222, 369, 1199, 32, 1, 123 },
-  { 0x3, 0x3, 222, 370, 1208, 32, 1, 123 },
-  { 0x3, 0x3, 222, 371, 1217, 32, 1, 123 },
-  { 0x3, 0x3, 222, 372, 1226, 32, 1, 123 },
-  { 0x3, 0x3, 222, 373, 1236, 32, 1, 123 },
-  { 0x3, 0x3, 222, 374, 1246, 32, 1, 123 },
-  { 0x3, 0x3, 222, 387, 1259, 32, 1, 133 },
-  { 0x3, 0x3, 222, 388, 1265, 32, 1, 133 },
-  { 0x3, 0x3, 222, 389, 1271, 32, 1, 133 },
-  { 0x3, 0x3, 222, 390, 1277, 32, 1, 133 },
-  { 0x3, 0x3, 222, 391, 1283, 32, 1, 133 },
-  { 0x3, 0x3, 222, 392, 1289, 32, 1, 133 },
-  { 0x3, 0x3, 222, 393, 1295, 32, 1, 133 },
-  { 0x3, 0x3, 222, 394, 1301, 32, 1, 133 },
-  { 0x3, 0x3, 222, 395, 1307, 32, 1, 133 },
-  { 0x3, 0x3, 222, 396, 1313, 32, 1, 133 },
-  { 0x3, 0x3, 222, 397, 1319, 32, 1, 133 },
-  { 0x3, 0x3, 222, 398, 1325, 32, 1, 133 },
-  { 0x3, 0x3, 222, 399, 1331, 32, 1, 133 },
-  { 0x3, 0x3, 222, 400, 1337, 32, 1, 133 },
-  { 0x3, 0x3, 222, 401, 1343, 32, 1, 133 },
-  { 0x3, 0x3, 222, 402, 1349, 32, 1, 133 },
-  { 0x3, 0x3, 222, 403, 1355, 32, 1, 133 },
-  { 0x3, 0x3, 222, 404, 1361, 32, 1, 133 },
-  { 0x1, 0x1, 223, -1, -1, 28, 1, 30 },
-  { 0x1, 0x1, 223, -1, -1, 28, 1, 30 },
-  { 0x0, 0x0, 230, 772, -1, 0, 1, 129 },
-  { 0x0, 0x0, 230, 773, -1, 0, 1, 5 },
-  { 0x1, 0x1, 231, -1, 1652, 33, 1, 126 },
-  { 0x1, 0x1, 231, -1, 1655, 33, 1, 126 },
-  { 0x0, 0x0, 231, -1, 1657, 0, 1, 135 },
-  { 0x0, 0x0, 231, -1, 1658, 0, 1, 135 },
-  { 0x0, 0x0, 232, 706, 784, 0, 0, -1 },
-  { 0x0, 0x0, 232, 707, 792, 0, 0, -1 },
-  { 0x0, 0x0, 232, 708, 788, 0, 0, -1 },
-  { 0x1, 0x1, 232, 709, 443, 33, 1, 9 },
-  { 0x8000001, 0x8000001, 232, 710, 451, 6, 1, 10 },
-  { 0x1, 0x1, 232, 711, 447, 33, 1, 9 },
-  { 0x0, 0x0, 232, 712, 796, 0, 0, -1 },
-  { 0x1, 0x1, 232, 713, 463, 33, 1, 11 },
-  { 0x0, 0x0, 232, 714, 800, 0, 0, -1 },
-  { 0x1, 0x1, 232, 715, 475, 33, 1, 18 },
-  { 0x0, 0x0, 232, 716, 805, 0, 0, -1 },
-  { 0x0, 0x0, 232, 717, 809, 0, 0, -1 },
-  { 0x1, 0x1, 232, 718, 498, 33, 1, 20 },
-  { 0x1, 0x1, 232, 719, 502, 33, 1, 20 },
-  { 0x0, 0x0, 232, 720, 813, 0, 0, -1 },
-  { 0x0, 0x0, 232, 721, 817, 0, 0, -1 },
-  { 0x1, 0x1, 232, 722, 522, 33, 1, 21 },
-  { 0x8000001, 0x8000001, 232, 723, 526, 6, 1, 21 },
-  { 0x0, 0x0, 232, 724, 821, 0, 0, -1 },
-  { 0x1, 0x1, 232, 725, 538, 33, 1, 22 },
-  { 0x0, 0x0, 232, 726, 825, 0, 0, -1 },
-  { 0x0, 0x0, 232, 727, 829, 0, 0, -1 },
-  { 0x1, 0x1, 232, 728, 558, 33, 1, 23 },
-  { 0x8000001, 0x8000001, 232, 729, 562, 6, 1, 23 },
-  { 0x0, 0x0, 232, 730, 833, 0, 0, -1 },
-  { 0x1, 0x1, 232, 731, 574, 33, 1, 24 },
-  { 0x0, 0x0, 232, 732, 838, 0, 0, -1 },
-  { 0x0, 0x0, 232, 733, 842, 0, 0, -1 },
-  { 0x1, 0x1, 232, 734, 597, 33, 1, 20 },
-  { 0x1, 0x1, 232, 735, 601, 33, 1, 20 },
-  { 0x0, 0x0, 232, 736, 846, 0, 0, -1 },
-  { 0x1, 0x1, 232, 737, 613, 33, 1, 24 },
-  { 0x0, 0x0, 233, 2212, 783, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2213, 791, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2214, 787, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2215, 442, 0, 1, 9 },
-  { 0x1, 0x1, 233, 2216, 450, 6, 1, 10 },
-  { 0x0, 0x0, 233, 2217, 446, 0, 1, 9 },
-  { 0x0, 0x0, 233, 2218, 795, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2219, 462, 0, 1, 11 },
-  { 0x0, 0x0, 233, 2220, 799, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2221, 474, 0, 1, 18 },
-  { 0x0, 0x0, 233, 2222, 804, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2223, 808, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2224, 497, 0, 1, 20 },
-  { 0x0, 0x0, 233, 2225, 501, 0, 1, 20 },
-  { 0x0, 0x0, 233, 2226, 812, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2227, 816, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2228, 521, 0, 1, 21 },
-  { 0x1, 0x1, 233, 2229, 525, 6, 1, 21 },
-  { 0x0, 0x0, 233, 2230, 820, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2231, 537, 0, 1, 22 },
-  { 0x0, 0x0, 233, 2232, 824, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2233, 828, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2234, 557, 0, 1, 23 },
-  { 0x1, 0x1, 233, 2235, 561, 6, 1, 23 },
-  { 0x0, 0x0, 233, 2236, 832, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2237, 573, 0, 1, 24 },
-  { 0x0, 0x0, 233, 2238, 837, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2239, 841, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2240, 596, 0, 1, 20 },
-  { 0x0, 0x0, 233, 2241, 600, 0, 1, 20 },
-  { 0x0, 0x0, 233, 2242, 845, 0, 0, -1 },
-  { 0x0, 0x0, 233, 2243, 612, 0, 1, 24 },
-  { 0x1, 0x1, 233, 738, 922, 27, 1, 19 },
-  { 0x0, 0x0, 233, 739, 920, 0, 1, 19 },
-  { 0x0, 0x0, 233, 966, 924, 0, 1, 2 },
-  { 0x0, 0x1, 233, 932, 930, 20, 1, 59 },
-  { 0x0, 0x0, 233, 108, 928, 0, 1, 59 },
-  { 0x1, 0x1, 236, -1, -1, 29, 1, 0 },
-  { 0x0, 0x0, 236, -1, -1, 0, 1, 0 },
-  { 0x1, 0x1, 236, 2384, -1, 27, 1, 0 },
-  { 0x1, 0x1, 236, 2385, -1, 27, 1, 0 },
-  { 0x1, 0x1, 236, 2386, -1, 27, 1, 2 },
-  { 0x1, 0x1, 236, 2387, -1, 27, 1, 2 },
-  { 0x0, 0x0, 257, -1, 1853, 0, 0, -1 },
-  { 0x0, 0x0, 257, -1, 1855, 0, 0, -1 },
-  { 0x1, 0x1, 257, -1, -1, 28, 1, 26 },
-  { 0x1, 0x1, 257, -1, -1, 28, 1, 26 },
-  { 0x0, 0x0, 257, -1, 1890, 0, 0, -1 },
-  { 0x0, 0x0, 257, -1, 1892, 0, 0, -1 },
-  { 0x1, 0x1, 257, -1, -1, 28, 1, 26 },
-  { 0x1, 0x1, 257, -1, -1, 28, 1, 26 },
-  { 0x0, 0x0, 259, 21, -1, 0, 1, 0 },
-  { 0x0, 0x0, 259, -1, -1, 0, 1, 0 },
-  { 0x0, 0x0, 259, -1, -1, 0, 1, 0 },
-  { 0x0, 0x1, 259, -1, -1, 29, 1, 0 },
-  { 0x0, 0x1, 259, -1, -1, 29, 1, 2 },
-  { 0x0, 0x1, 259, -1, -1, 29, 1, 2 },
-  { 0x0, 0x1, 259, -1, -1, 29, 1, 2 },
-  { 0x0, 0x1, 259, -1, -1, 29, 1, 2 },
-  { 0x0, 0x0, 259, 176, -1, 0, 1, 0 },
-  { 0x0, 0x1, 259, -1, -1, 29, 1, 0 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 5 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 56 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 56 },
-  { 0x0, 0x0, 260, -1, 1829, 0, 0, -1 },
-  { 0x0, 0x0, 260, -1, 1831, 0, 0, -1 },
-  { 0x0, 0x0, 260, -1, 1833, 0, 0, -1 },
-  { 0x0, 0x0, 260, -1, 1835, 0, 0, -1 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 46 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 46 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 46 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 46 },
-  { 0x0, 0x0, 260, -1, 1837, 0, 0, -1 },
+  { 0x0, 0x0, 43, 896, -1, 0, 1, 0 },
+  { 0x1, 0x1, 44, -1, 1369, 30, 1, 141 },
+  { 0x1, 0x1, 44, 775, 1368, 30, 1, 140 },
+  { 0x1, 0x1, 44, -1, 1373, 30, 1, 143 },
+  { 0x1, 0x1, 44, 776, 1372, 30, 1, 142 },
+  { 0x1, 0x1, 44, -1, 1377, 30, 1, 143 },
+  { 0x1, 0x1, 44, 777, 1376, 30, 1, 142 },
+  { 0x3, 0x3, 45, -1, 928, 3, 1, 22 },
+  { 0x1, 0x1, 46, 1793, -1, 30, 1, 134 },
+  { 0x1, 0x1, 46, 1824, -1, 30, 1, 144 },
+  { 0x0, 0x0, 48, -1, -1, 0, 1, 40 },
+  { 0x0, 0x0, 48, -1, -1, 0, 1, 40 },
+  { 0x1, 0x1, 55, -1, 1370, 31, 1, 141 },
+  { 0x1, 0x1, 55, -1, 1374, 31, 1, 143 },
+  { 0x1, 0x1, 55, -1, 1378, 31, 1, 143 },
+  { 0x0, 0x0, 55, -1, -1, 0, 1, 94 },
+  { 0x2, 0x3, 55, -1, -1, 27, 1, 94 },
+  { 0x1, 0x1, 55, -1, -1, 28, 1, 94 },
+  { 0x0, 0x0, 64, 12, 414, 0, 1, 6 },
+  { 0x0, 0x0, 64, 997, 417, 0, 1, 6 },
+  { 0x1, 0x1, 64, 998, 419, 33, 1, 6 },
+  { 0x1, 0x1, 64, 999, 421, 34, 1, 6 },
+  { 0x3, 0x3, 64, 1000, 423, 33, 1, 6 },
+  { 0x0, 0x0, 64, 1001, 425, 0, 1, 6 },
+  { 0x1, 0x1, 64, 1002, 427, 33, 1, 6 },
+  { 0x1, 0x1, 64, 1003, 429, 34, 1, 6 },
+  { 0x3, 0x3, 64, 1004, 431, 33, 1, 6 },
+  { 0x1, 0x1, 64, 1005, 433, 6, 1, 7 },
+  { 0x8000001, 0x8000001, 64, 1006, 435, 6, 1, 7 },
+  { 0x10000001, 0x10000001, 64, 1007, 437, 6, 1, 7 },
+  { 0x18000001, 0x18000001, 64, 1008, 439, 6, 1, 7 },
+  { 0x0, 0x0, 64, 1009, 453, 0, 1, 8 },
+  { 0x1, 0x1, 64, 1010, 455, 33, 1, 8 },
+  { 0x1, 0x1, 64, 1011, 457, 34, 1, 8 },
+  { 0x3, 0x3, 64, 1012, 459, 33, 1, 8 },
+  { 0x0, 0x0, 64, 1013, 465, 0, 1, 15 },
+  { 0x1, 0x1, 64, 1014, 467, 33, 1, 15 },
+  { 0x1, 0x1, 64, 1015, 469, 34, 1, 15 },
+  { 0x3, 0x3, 64, 1016, 471, 33, 1, 15 },
+  { 0x0, 0x0, 64, 13, 477, 0, 1, 17 },
+  { 0x0, 0x0, 64, 1018, 480, 0, 1, 17 },
+  { 0x1, 0x1, 64, 1019, 482, 33, 1, 17 },
+  { 0x1, 0x1, 64, 1020, 484, 34, 1, 17 },
+  { 0x3, 0x3, 64, 1021, 486, 33, 1, 17 },
+  { 0x0, 0x0, 64, 1022, 488, 0, 1, 17 },
+  { 0x1, 0x1, 64, 1023, 490, 33, 1, 17 },
+  { 0x1, 0x1, 64, 1024, 492, 34, 1, 17 },
+  { 0x3, 0x3, 64, 1025, 494, 33, 1, 17 },
+  { 0x0, 0x0, 64, 1026, 504, 0, 1, 18 },
+  { 0x1, 0x1, 64, 1027, 506, 33, 1, 18 },
+  { 0x1, 0x1, 64, 1028, 508, 34, 1, 18 },
+  { 0x3, 0x3, 64, 1029, 510, 33, 1, 18 },
+  { 0x1, 0x1, 64, 1030, 512, 6, 1, 18 },
+  { 0x8000001, 0x8000001, 64, 1031, 514, 6, 1, 18 },
+  { 0x10000001, 0x10000001, 64, 1032, 516, 6, 1, 18 },
+  { 0x18000001, 0x18000001, 64, 1033, 518, 6, 1, 18 },
+  { 0x0, 0x0, 64, 1034, 528, 0, 1, 19 },
+  { 0x1, 0x1, 64, 1035, 530, 33, 1, 19 },
+  { 0x1, 0x1, 64, 1036, 532, 34, 1, 19 },
+  { 0x3, 0x3, 64, 1037, 534, 33, 1, 19 },
+  { 0x0, 0x0, 64, 1038, 540, 0, 1, 20 },
+  { 0x1, 0x1, 64, 1039, 542, 33, 1, 20 },
+  { 0x1, 0x1, 64, 1040, 544, 34, 1, 20 },
+  { 0x3, 0x3, 64, 1041, 546, 33, 1, 20 },
+  { 0x1, 0x1, 64, 1042, 548, 6, 1, 20 },
+  { 0x8000001, 0x8000001, 64, 1043, 550, 6, 1, 20 },
+  { 0x10000001, 0x10000001, 64, 1044, 552, 6, 1, 20 },
+  { 0x18000001, 0x18000001, 64, 1045, 554, 6, 1, 20 },
+  { 0x0, 0x0, 64, 1046, 564, 0, 1, 21 },
+  { 0x1, 0x1, 64, 1047, 566, 33, 1, 21 },
+  { 0x1, 0x1, 64, 1048, 568, 34, 1, 21 },
+  { 0x3, 0x3, 64, 1049, 570, 33, 1, 21 },
+  { 0x0, 0x0, 64, 15, 576, 0, 1, 17 },
+  { 0x0, 0x0, 64, 1051, 579, 0, 1, 17 },
+  { 0x1, 0x1, 64, 1052, 581, 33, 1, 17 },
+  { 0x1, 0x1, 64, 1053, 583, 34, 1, 17 },
+  { 0x3, 0x3, 64, 1054, 585, 33, 1, 17 },
+  { 0x0, 0x0, 64, 1055, 587, 0, 1, 17 },
+  { 0x1, 0x1, 64, 1056, 589, 33, 1, 17 },
+  { 0x1, 0x1, 64, 1057, 591, 34, 1, 17 },
+  { 0x3, 0x3, 64, 1058, 593, 33, 1, 17 },
+  { 0x0, 0x0, 64, 1059, 603, 0, 1, 21 },
+  { 0x1, 0x1, 64, 1060, 605, 33, 1, 21 },
+  { 0x1, 0x1, 64, 1061, 607, 34, 1, 21 },
+  { 0x3, 0x3, 64, 1062, 609, 33, 1, 21 },
+  { 0x3, 0x3, 65, 383, 1232, 33, 1, 128 },
+  { 0x3, 0x3, 65, 384, 1242, 33, 1, 128 },
+  { 0x3, 0x3, 65, 385, 1252, 33, 1, 128 },
+  { 0x0, 0x0, 65, -1, 1257, 0, 1, 135 },
+  { 0x0, 0x0, 65, -1, 1258, 0, 1, 135 },
+  { 0x0, 0x0, 65, -1, 1259, 0, 1, 135 },
+  { 0x0, 0x0, 106, 858, 1857, 0, 0, -1 },
+  { 0x0, 0x0, 106, 859, 2304, 0, 1, 29 },
+  { 0x0, 0x0, 106, 860, 1898, 0, 0, -1 },
+  { 0x0, 0x0, 106, 861, 2308, 0, 1, 29 },
+  { 0x0, 0x0, 108, -1, 1859, 0, 0, -1 },
+  { 0x1, 0x1, 108, -1, 2305, 27, 1, 29 },
+  { 0x0, 0x0, 108, -1, 1900, 0, 0, -1 },
+  { 0x1, 0x1, 108, -1, 2309, 27, 1, 29 },
+  { 0x0, 0x0, 109, 863, -1, 0, 1, 115 },
+  { 0x1, 0x1, 110, -1, -1, 27, 1, 115 },
+  { 0x0, 0x0, 111, 877, 2327, 0, 1, 1 },
+  { 0x0, 0x0, 111, 970, 284, 0, 0, -1 },
+  { 0x0, 0x0, 111, -1, 331, 0, 0, -1 },
+  { 0x0, 0x0, 111, 878, 2335, 0, 1, 1 },
+  { 0x0, 0x0, 111, -1, 293, 0, 0, -1 },
+  { 0x0, 0x0, 111, 879, 2347, 0, 1, 1 },
+  { 0x0, 0x0, 111, 975, 300, 0, 0, -1 },
+  { 0x0, 0x0, 111, -1, 347, 0, 0, -1 },
+  { 0x0, 0x0, 111, 1107, 2354, 0, 1, 1 },
+  { 0x0, 0x0, 111, -1, 309, 0, 0, -1 },
+  { 0x0, 0x0, 111, -1, 1843, 0, 0, -1 },
+  { 0x1, 0x9, 111, -1, 2373, 33, 1, 54 },
+  { 0x2, 0x3, 111, 1120, 1894, 27, 1, 49 },
+  { 0x1, 0x1, 113, 1096, 2328, 37, 1, 1 },
+  { 0x1, 0x1, 113, 1099, 2336, 37, 1, 1 },
+  { 0x1, 0x1, 113, 1104, 2348, 37, 1, 1 },
+  { 0x0, 0x0, 113, -1, 2359, 0, 1, 1 },
+  { 0x0, 0x0, 114, 897, 2325, 0, 1, 1 },
+  { 0x0, 0x0, 114, 950, 282, 0, 0, -1 },
+  { 0x0, 0x0, 114, 971, 329, 0, 0, -1 },
+  { 0x0, 0x0, 114, -1, 2334, 0, 1, 1 },
+  { 0x0, 0x0, 114, 973, 291, 0, 0, -1 },
+  { 0x0, 0x0, 114, 899, 2345, 0, 1, 1 },
+  { 0x0, 0x0, 114, 955, 298, 0, 0, -1 },
+  { 0x0, 0x0, 114, 976, 345, 0, 0, -1 },
+  { 0x0, 0x0, 114, -1, 2353, 0, 1, 1 },
+  { 0x0, 0x0, 114, 978, 307, 0, 0, -1 },
+  { 0x0, 0x0, 114, 874, 1841, 0, 0, -1 },
+  { 0x0, 0x0, 114, 875, 2372, 0, 1, 54 },
+  { 0x0, 0x0, 114, 876, 1893, 0, 1, 49 },
+  { 0x1, 0x1, 114, -1, -1, 27, 1, 0 },
+  { 0x1, 0x1, 114, -1, -1, 27, 1, 0 },
+  { 0x1, 0x1, 114, -1, -1, 27, 1, 0 },
+  { 0x1, 0x1, 115, -1, 2326, 37, 1, 1 },
+  { 0x0, 0x0, 115, -1, 2339, 0, 1, 1 },
+  { 0x1, 0x1, 115, -1, 2346, 37, 1, 1 },
+  { 0x0, 0x0, 115, -1, 2358, 0, 1, 1 },
+  { 0x0, 0x0, 116, 944, -1, 0, 1, 0 },
+  { 0x0, 0x0, 116, 945, -1, 0, 1, 0 },
+  { 0x0, 0x0, 116, 946, -1, 0, 1, 0 },
+  { 0x3, 0x3, 116, 906, -1, 34, 1, 33 },
+  { 0x3, 0x3, 116, 907, -1, 34, 1, 40 },
+  { 0x1, 0x1, 117, -1, -1, 35, 1, 33 },
+  { 0x1, 0x1, 117, -1, -1, 35, 1, 40 },
+  { 0x0, 0x0, 118, -1, -1, 0, 1, 40 },
+  { 0x0, 0x0, 118, -1, -1, 0, 1, 66 },
+  { 0x1, 0x1, 118, -1, -1, 27, 1, 96 },
+  { 0x0, 0x0, 118, -1, -1, 0, 1, 105 },
+  { 0x0, 0x0, 118, -1, -1, 0, 1, 73 },
+  { 0x0, 0x0, 118, -1, -1, 0, 1, 73 },
+  { 0x0, 0x0, 118, -1, -1, 0, 1, 74 },
+  { 0x0, 0x0, 118, -1, -1, 0, 1, 40 },
+  { 0x1, 0x1, 118, -1, -1, 27, 1, 117 },
+  { 0x1, 0x1, 118, -1, -1, 27, 1, 40 },
+  { 0x0, 0x0, 118, -1, -1, 0, 1, 40 },
+  { 0x0, 0x0, 119, -1, 2260, 0, 0, -1 },
+  { 0x0, 0x0, 119, -1, 2263, 0, 0, -1 },
+  { 0x1, 0x1, 120, -1, -1, 35, 1, 16 },
+  { 0x1, 0x1, 120, -1, -1, 35, 1, 16 },
+  { 0x1, 0x1, 120, -1, -1, 35, 1, 16 },
+  { 0x1, 0x1, 120, -1, -1, 35, 1, 16 },
+  { 0x1, 0x1, 120, -1, -1, 35, 1, 22 },
+  { 0x1, 0x1, 120, -1, -1, 35, 1, 22 },
+  { 0x1, 0x1, 120, -1, -1, 35, 1, 22 },
+  { 0x1, 0x1, 120, -1, -1, 35, 1, 22 },
+  { 0x1, 0x1, 120, -1, -1, 23, 1, 67 },
+  { 0x1, 0x1, 120, -1, -1, 23, 1, 67 },
+  { 0x1, 0x1, 120, -1, -1, 23, 1, 67 },
+  { 0x1, 0x1, 120, -1, -1, 23, 1, 67 },
+  { 0x1, 0x1, 120, 740, -1, 23, 1, 67 },
+  { 0x9, 0x9, 120, 741, -1, 20, 1, 67 },
+  { 0x0, 0x0, 124, 1743, -1, 0, 1, 0 },
+  { 0x0, 0x0, 124, 1744, -1, 0, 1, 0 },
+  { 0x1, 0x1, 124, -1, -1, 28, 1, 33 },
+  { 0x1, 0x1, 124, -1, -1, 27, 1, 33 },
+  { 0x1, 0x1, 124, -1, -1, 29, 1, 0 },
+  { 0x1, 0x1, 124, -1, -1, 29, 1, 0 },
+  { 0x1, 0x1, 124, -1, -1, 29, 1, 0 },
+  { 0x1, 0x1, 124, -1, -1, 29, 1, 0 },
+  { 0x0, 0x0, 124, -1, -1, 0, 1, 114 },
+  { 0x1, 0x1, 124, -1, -1, 29, 1, 0 },
+  { 0x1, 0x1, 124, -1, -1, 29, 1, 0 },
+  { 0x1, 0x1, 124, -1, -1, 29, 1, 0 },
+  { 0x0, 0x0, 124, 904, -1, 0, 1, 33 },
+  { 0x0, 0x0, 124, 988, -1, 0, 1, 40 },
+  { 0x0, 0x0, 137, 963, 2323, 0, 1, 1 },
+  { 0x0, 0x0, 137, 865, 283, 0, 0, -1 },
+  { 0x0, 0x0, 137, 883, 328, 0, 0, -1 },
+  { 0x0, 0x0, 137, -1, 2333, 0, 1, 1 },
+  { 0x0, 0x0, 137, 885, 290, 0, 0, -1 },
+  { 0x0, 0x0, 137, 965, 2343, 0, 1, 1 },
+  { 0x0, 0x0, 137, 870, 299, 0, 0, -1 },
+  { 0x0, 0x0, 137, 888, 344, 0, 0, -1 },
+  { 0x0, 0x0, 137, -1, 2352, 0, 1, 1 },
+  { 0x0, 0x0, 137, 890, 306, 0, 0, -1 },
+  { 0x0, 0x0, 137, 2390, 1837, 0, 0, -1 },
+  { 0x1, 0x1, 137, 2391, 2368, 33, 1, 54 },
+  { 0x0, 0x0, 137, 2392, 1887, 0, 0, -1 },
+  { 0x1, 0x1, 137, 2393, -1, 28, 1, 49 },
+  { 0x1, 0x1, 138, -1, 2324, 37, 1, 1 },
+  { 0x0, 0x0, 138, -1, 2338, 0, 1, 1 },
+  { 0x1, 0x1, 138, -1, 2344, 37, 1, 1 },
+  { 0x0, 0x0, 138, -1, 2357, 0, 1, 1 },
+  { 0x1, 0x1, 141, 739, 926, 3, 1, 22 },
+  { 0x0, 0x0, 142, 1745, -1, 0, 1, 33 },
+  { 0x0, 0x0, 143, 745, 2320, 0, 1, 1 },
+  { 0x0, 0x0, 143, -1, 285, 0, 0, -1 },
+  { 0x0, 0x0, 143, 866, 330, 0, 0, -1 },
+  { 0x0, 0x0, 143, 747, 2330, 0, 1, 1 },
+  { 0x0, 0x0, 143, 868, 292, 0, 0, -1 },
+  { 0x0, 0x0, 143, 751, 2340, 0, 1, 1 },
+  { 0x0, 0x0, 143, -1, 301, 0, 0, -1 },
+  { 0x0, 0x0, 143, 871, 346, 0, 0, -1 },
+  { 0x0, 0x0, 143, 753, 2350, 0, 1, 1 },
+  { 0x0, 0x0, 143, 873, 308, 0, 0, -1 },
+  { 0x0, 0x0, 143, 959, 1835, 0, 0, -1 },
+  { 0x1, 0x1, 143, 960, 2367, 36, 1, 54 },
+  { 0x0, 0x0, 143, 961, 1886, 0, 0, -1 },
+  { 0x1, 0x1, 143, 962, -1, 27, 1, 49 },
+  { 0x1, 0x1, 144, -1, 2322, 37, 1, 1 },
+  { 0x1, 0x1, 144, -1, 2332, 37, 1, 1 },
+  { 0x1, 0x1, 144, -1, 2342, 37, 1, 1 },
+  { 0x0, 0x0, 144, -1, 2356, 0, 1, 1 },
+  { 0x0, 0x0, 145, -1, -1, 0, 1, 33 },
+  { 0x0, 0x0, 145, 905, -1, 0, 1, 40 },
+  { 0x0, 0x0, 146, -1, -1, 0, 1, 40 },
+  { 0x0, 0x0, 146, -1, -1, 0, 1, 66 },
+  { 0x0, 0x0, 146, -1, 2360, 0, 1, 63 },
+  { 0x0, 0x0, 146, -1, -1, 0, 1, 81 },
+  { 0x0, 0x0, 146, -1, -1, 0, 1, 81 },
+  { 0x0, 0x0, 146, -1, -1, 0, 1, 85 },
+  { 0x0, 0x0, 146, -1, -1, 0, 1, 40 },
+  { 0x1, 0x1, 147, -1, 415, 12, 1, 6 },
+  { 0x1, 0x1, 147, -1, 418, 12, 1, 6 },
+  { 0x200001, 0x200001, 147, -1, 420, 12, 1, 6 },
+  { 0x400001, 0x400001, 147, -1, 422, 12, 1, 6 },
+  { 0x600001, 0x600001, 147, -1, 424, 12, 1, 6 },
+  { 0x1, 0x1, 147, -1, 426, 12, 1, 6 },
+  { 0x200001, 0x200001, 147, -1, 428, 12, 1, 6 },
+  { 0x400001, 0x400001, 147, -1, 430, 12, 1, 6 },
+  { 0x600001, 0x600001, 147, -1, 432, 12, 1, 6 },
+  { 0x41, 0x41, 147, -1, 434, 6, 1, 7 },
+  { 0x8000041, 0x8000041, 147, -1, 436, 6, 1, 7 },
+  { 0x10000041, 0x10000041, 147, -1, 438, 6, 1, 7 },
+  { 0x18000041, 0x18000041, 147, -1, 440, 6, 1, 7 },
+  { 0x1, 0x1, 147, -1, 454, 12, 1, 8 },
+  { 0x200001, 0x200001, 147, -1, 456, 12, 1, 8 },
+  { 0x400001, 0x400001, 147, -1, 458, 12, 1, 8 },
+  { 0x600001, 0x600001, 147, -1, 460, 12, 1, 8 },
+  { 0x1, 0x1, 147, -1, 466, 12, 1, 15 },
+  { 0x200001, 0x200001, 147, -1, 468, 12, 1, 15 },
+  { 0x400001, 0x400001, 147, -1, 470, 12, 1, 15 },
+  { 0x600001, 0x600001, 147, -1, 472, 12, 1, 15 },
+  { 0x1, 0x1, 147, -1, 478, 12, 1, 17 },
+  { 0x1, 0x1, 147, -1, 481, 12, 1, 17 },
+  { 0x200001, 0x200001, 147, -1, 483, 12, 1, 17 },
+  { 0x400001, 0x400001, 147, -1, 485, 12, 1, 17 },
+  { 0x600001, 0x600001, 147, -1, 487, 12, 1, 17 },
+  { 0x1, 0x1, 147, -1, 489, 12, 1, 17 },
+  { 0x200001, 0x200001, 147, -1, 491, 12, 1, 17 },
+  { 0x400001, 0x400001, 147, -1, 493, 12, 1, 17 },
+  { 0x600001, 0x600001, 147, -1, 495, 12, 1, 17 },
+  { 0x1, 0x1, 147, -1, 505, 12, 1, 18 },
+  { 0x200001, 0x200001, 147, -1, 507, 12, 1, 18 },
+  { 0x400001, 0x400001, 147, -1, 509, 12, 1, 18 },
+  { 0x600001, 0x600001, 147, -1, 511, 12, 1, 18 },
+  { 0x41, 0x41, 147, -1, 513, 6, 1, 18 },
+  { 0x8000041, 0x8000041, 147, -1, 515, 6, 1, 18 },
+  { 0x10000041, 0x10000041, 147, -1, 517, 6, 1, 18 },
+  { 0x18000041, 0x18000041, 147, -1, 519, 6, 1, 18 },
+  { 0x1, 0x1, 147, -1, 529, 12, 1, 19 },
+  { 0x200001, 0x200001, 147, -1, 531, 12, 1, 19 },
+  { 0x400001, 0x400001, 147, -1, 533, 12, 1, 19 },
+  { 0x600001, 0x600001, 147, -1, 535, 12, 1, 19 },
+  { 0x1, 0x1, 147, -1, 541, 12, 1, 20 },
+  { 0x200001, 0x200001, 147, -1, 543, 12, 1, 20 },
+  { 0x400001, 0x400001, 147, -1, 545, 12, 1, 20 },
+  { 0x600001, 0x600001, 147, -1, 547, 12, 1, 20 },
+  { 0x41, 0x41, 147, -1, 549, 6, 1, 20 },
+  { 0x8000041, 0x8000041, 147, -1, 551, 6, 1, 20 },
+  { 0x10000041, 0x10000041, 147, -1, 553, 6, 1, 20 },
+  { 0x18000041, 0x18000041, 147, -1, 555, 6, 1, 20 },
+  { 0x1, 0x1, 147, -1, 565, 12, 1, 21 },
+  { 0x200001, 0x200001, 147, -1, 567, 12, 1, 21 },
+  { 0x400001, 0x400001, 147, -1, 569, 12, 1, 21 },
+  { 0x600001, 0x600001, 147, -1, 571, 12, 1, 21 },
+  { 0x1, 0x1, 147, -1, 577, 12, 1, 17 },
+  { 0x1, 0x1, 147, -1, 580, 12, 1, 17 },
+  { 0x200001, 0x200001, 147, -1, 582, 12, 1, 17 },
+  { 0x400001, 0x400001, 147, -1, 584, 12, 1, 17 },
+  { 0x600001, 0x600001, 147, -1, 586, 12, 1, 17 },
+  { 0x1, 0x1, 147, -1, 588, 12, 1, 17 },
+  { 0x200001, 0x200001, 147, -1, 590, 12, 1, 17 },
+  { 0x400001, 0x400001, 147, -1, 592, 12, 1, 17 },
+  { 0x600001, 0x600001, 147, -1, 594, 12, 1, 17 },
+  { 0x1, 0x1, 147, -1, 604, 12, 1, 21 },
+  { 0x200001, 0x200001, 147, -1, 606, 12, 1, 21 },
+  { 0x400001, 0x400001, 147, -1, 608, 12, 1, 21 },
+  { 0x600001, 0x600001, 147, -1, 610, 12, 1, 21 },
+  { 0x0, 0x0, 156, 615, -1, 0, 1, 75 },
+  { 0x0, 0x0, 156, 616, -1, 0, 1, 75 },
+  { 0x9, 0x9, 156, -1, 1153, 32, 1, 129 },
+  { 0x9, 0x9, 156, -1, 1162, 32, 1, 129 },
+  { 0x9, 0x9, 156, -1, 1171, 32, 1, 129 },
+  { 0x9, 0x9, 156, -1, 1180, 32, 1, 129 },
+  { 0x9, 0x9, 156, -1, 1189, 32, 1, 129 },
+  { 0x9, 0x9, 156, -1, 1198, 32, 1, 129 },
+  { 0x9, 0x9, 156, -1, 1207, 32, 1, 129 },
+  { 0x9, 0x9, 156, -1, 1216, 32, 1, 129 },
+  { 0x9, 0x9, 156, -1, 1225, 32, 1, 129 },
+  { 0x9, 0x9, 156, -1, 1235, 32, 1, 129 },
+  { 0x9, 0x9, 156, -1, 1245, 32, 1, 129 },
+  { 0x9, 0x9, 156, -1, 1255, 32, 1, 129 },
+  { 0x9, 0x9, 156, -1, 1264, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1270, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1276, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1282, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1288, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1294, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1300, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1306, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1312, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1318, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1324, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1330, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1336, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1342, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1348, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1354, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1360, 32, 1, 139 },
+  { 0x9, 0x9, 156, -1, 1366, 32, 1, 139 },
+  { 0x0, 0x0, 157, 983, 281, 0, 0, -1 },
+  { 0x1, 0x1, 157, -1, 2329, 38, 1, 1 },
+  { 0x0, 0x0, 157, 746, 322, 0, 0, -1 },
+  { 0x0, 0x0, 157, 984, 287, 0, 0, -1 },
+  { 0x1, 0x1, 157, -1, 2337, 38, 1, 1 },
+  { 0x0, 0x0, 157, 748, 334, 0, 0, -1 },
+  { 0x0, 0x0, 157, 749, 288, 0, 0, -1 },
+  { 0x0, 0x0, 157, 750, 294, 0, 0, -1 },
+  { 0x0, 0x0, 157, 985, 297, 0, 0, -1 },
+  { 0x1, 0x1, 157, -1, 2349, 38, 1, 1 },
+  { 0x0, 0x0, 157, 752, 338, 0, 0, -1 },
+  { 0x0, 0x0, 157, -1, 303, 0, 0, -1 },
+  { 0x1, 0x1, 157, -1, 2355, 38, 1, 1 },
+  { 0x0, 0x0, 157, 754, 350, 0, 0, -1 },
+  { 0x0, 0x0, 157, 755, 304, 0, 0, -1 },
+  { 0x0, 0x0, 157, 756, 310, 0, 0, -1 },
+  { 0x0, 0x0, 158, 1126, 1845, 0, 0, -1 },
+  { 0x0, 0x0, 158, 1127, 2378, 0, 1, 54 },
+  { 0x0, 0x0, 158, 1128, 1889, 0, 0, -1 },
+  { 0x1, 0x1, 158, 1129, -1, 29, 1, 49 },
+  { 0x0, 0x0, 159, -1, 1855, 0, 0, -1 },
+  { 0x1, 0x9, 159, -1, 2385, 33, 1, 54 },
+  { 0x6, 0x7, 159, -1, 1896, 27, 1, 49 },
+  { 0x0, 0x0, 160, 1115, 1853, 0, 0, -1 },
+  { 0x0, 0x0, 160, 1116, 2384, 0, 1, 54 },
+  { 0x1, 0x1, 160, 1117, 1895, 29, 1, 49 },
+  { 0x1, 0x1, 161, 1131, -1, 27, 1, 33 },
+  { 0x0, 0x0, 162, 1738, 1849, 0, 0, -1 },
+  { 0x1, 0x1, 162, 1739, 2380, 33, 1, 54 },
+  { 0x0, 0x0, 162, 1740, 1891, 0, 0, -1 },
+  { 0x3, 0x3, 162, 1741, -1, 28, 1, 49 },
+  { 0x0, 0x0, 163, 1122, 1847, 0, 0, -1 },
+  { 0x1, 0x1, 163, 1123, 2379, 36, 1, 54 },
+  { 0x0, 0x0, 163, 1124, 1890, 0, 0, -1 },
+  { 0x5, 0x5, 163, 1125, -1, 27, 1, 49 },
+  { 0x0, 0x0, 164, -1, 2361, 0, 1, 63 },
+  { 0x1, 0x1, 166, -1, -1, 28, 1, 33 },
+  { 0x1, 0x1, 167, 2219, -1, 27, 1, 33 },
+  { 0x1, 0x1, 167, 2220, -1, 27, 1, 33 },
+  { 0x1, 0x1, 168, 1396, -1, 28, 1, 132 },
+  { 0x1, 0x1, 168, 1397, -1, 28, 1, 132 },
+  { 0x1, 0x1, 168, 1398, -1, 28, 1, 132 },
+  { 0x1, 0x1, 168, 1399, -1, 28, 1, 132 },
+  { 0x1, 0x1, 168, 1400, -1, 28, 1, 132 },
+  { 0x1, 0x1, 168, 1401, -1, 28, 1, 132 },
+  { 0x1, 0x1, 168, 1402, -1, 28, 1, 132 },
+  { 0x1, 0x1, 168, 1403, -1, 28, 1, 132 },
+  { 0x1, 0x1, 168, 1404, -1, 28, 1, 133 },
+  { 0x1, 0x1, 168, 1405, -1, 28, 1, 133 },
+  { 0x1, 0x1, 168, 1406, -1, 28, 1, 133 },
+  { 0x1, 0x1, 168, 1407, -1, 28, 1, 133 },
+  { 0x1, 0x1, 168, 1408, -1, 28, 1, 125 },
+  { 0x1, 0x1, 168, 1409, -1, 28, 1, 126 },
+  { 0x1, 0x1, 168, 1410, -1, 28, 1, 127 },
+  { 0x1, 0x1, 168, 1411, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1412, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1413, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1414, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1415, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1416, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1417, -1, 28, 1, 125 },
+  { 0x1, 0x1, 168, 1418, -1, 28, 1, 126 },
+  { 0x1, 0x1, 168, 1419, -1, 28, 1, 127 },
+  { 0x1, 0x1, 168, 1420, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1421, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1422, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1423, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1424, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1425, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1426, -1, 28, 1, 125 },
+  { 0x1, 0x1, 168, 1427, -1, 28, 1, 126 },
+  { 0x1, 0x1, 168, 1428, -1, 28, 1, 127 },
+  { 0x1, 0x1, 168, 1429, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1430, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1431, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1432, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1433, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1434, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1435, -1, 28, 1, 125 },
+  { 0x1, 0x1, 168, 1436, -1, 28, 1, 126 },
+  { 0x1, 0x1, 168, 1437, -1, 28, 1, 127 },
+  { 0x1, 0x1, 168, 1438, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1439, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1440, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1441, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1442, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1443, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1444, -1, 28, 1, 125 },
+  { 0x1, 0x1, 168, 1445, -1, 28, 1, 126 },
+  { 0x1, 0x1, 168, 1446, -1, 28, 1, 127 },
+  { 0x1, 0x1, 168, 1447, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1448, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1449, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1450, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1451, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1452, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1453, -1, 28, 1, 125 },
+  { 0x1, 0x1, 168, 1454, -1, 28, 1, 126 },
+  { 0x1, 0x1, 168, 1455, -1, 28, 1, 127 },
+  { 0x1, 0x1, 168, 1456, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1457, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1458, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1459, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1460, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1461, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1462, -1, 28, 1, 125 },
+  { 0x1, 0x1, 168, 1463, -1, 28, 1, 126 },
+  { 0x1, 0x1, 168, 1464, -1, 28, 1, 127 },
+  { 0x1, 0x1, 168, 1465, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1466, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1467, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1468, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1469, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1470, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1471, -1, 28, 1, 125 },
+  { 0x1, 0x1, 168, 1472, -1, 28, 1, 126 },
+  { 0x1, 0x1, 168, 1473, -1, 28, 1, 127 },
+  { 0x1, 0x1, 168, 1474, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1475, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1476, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1477, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1478, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1479, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1480, -1, 28, 1, 125 },
+  { 0x1, 0x1, 168, 1481, -1, 28, 1, 126 },
+  { 0x1, 0x1, 168, 1482, -1, 28, 1, 127 },
+  { 0x1, 0x1, 168, 1483, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1484, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1485, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1486, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1487, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1488, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1489, -1, 28, 1, 125 },
+  { 0x1, 0x1, 168, 1490, -1, 28, 1, 126 },
+  { 0x1, 0x1, 168, 1491, -1, 28, 1, 127 },
+  { 0x1, 0x1, 168, 1492, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1493, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1494, -1, 28, 1, 128 },
+  { 0x1, 0x1, 168, 1495, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1496, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1497, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1498, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1499, -1, 28, 1, 125 },
+  { 0x1, 0x1, 168, 1500, -1, 28, 1, 126 },
+  { 0x1, 0x1, 168, 1501, -1, 28, 1, 127 },
+  { 0x1, 0x1, 168, 1502, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1503, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1504, -1, 28, 1, 128 },
+  { 0x1, 0x1, 168, 1505, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1506, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1507, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1508, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1509, -1, 28, 1, 125 },
+  { 0x1, 0x1, 168, 1510, -1, 28, 1, 126 },
+  { 0x1, 0x1, 168, 1511, -1, 28, 1, 127 },
+  { 0x1, 0x1, 168, 1512, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1513, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1514, -1, 28, 1, 128 },
+  { 0x1, 0x1, 168, 1515, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1516, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1517, -1, 28, 1, 129 },
+  { 0x1, 0x1, 168, 1518, -1, 28, 1, 124 },
+  { 0x1, 0x1, 168, 1519, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1520, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1521, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1522, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1523, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1524, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1525, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1526, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1527, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1528, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1529, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1530, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1531, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1532, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1533, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1534, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1535, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1536, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1537, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1538, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1539, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1540, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1541, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1542, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1543, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1544, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1545, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1546, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1547, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1548, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1549, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1550, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1551, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1552, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1553, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1554, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1555, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1556, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1557, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1558, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1559, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1560, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1561, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1562, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1563, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1564, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1565, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1566, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1567, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1568, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1569, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1570, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1571, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1572, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1573, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1574, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1575, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1576, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1577, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1578, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1579, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1580, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1581, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1582, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1583, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1584, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1585, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1586, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1587, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1588, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1589, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1590, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1591, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1592, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1593, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1594, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1595, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1596, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1597, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1598, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1599, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1600, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1601, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1602, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1603, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1604, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1605, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1606, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1607, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1608, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1609, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1610, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1611, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1612, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1613, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1614, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1615, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1616, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1617, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1618, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1619, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1620, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1621, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1622, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1623, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1624, -1, 28, 1, 136 },
+  { 0x1, 0x1, 168, 1625, -1, 28, 1, 137 },
+  { 0x1, 0x1, 168, 1626, -1, 28, 1, 138 },
+  { 0x1, 0x1, 168, 1627, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1628, -1, 28, 1, 139 },
+  { 0x1, 0x1, 168, 1629, -1, 28, 1, 135 },
+  { 0x1, 0x1, 168, 1384, -1, 28, 1, 140 },
+  { 0x1, 0x1, 168, 1385, -1, 28, 1, 141 },
+  { 0x1, 0x1, 168, 1386, -1, 28, 1, 141 },
+  { 0x1, 0x1, 168, 1387, -1, 28, 1, 140 },
+  { 0x1, 0x1, 168, 1388, -1, 28, 1, 142 },
+  { 0x1, 0x1, 168, 1389, -1, 28, 1, 143 },
+  { 0x1, 0x1, 168, 1390, -1, 28, 1, 143 },
+  { 0x1, 0x1, 168, 1391, -1, 28, 1, 142 },
+  { 0x1, 0x1, 168, 1392, -1, 28, 1, 142 },
+  { 0x1, 0x1, 168, 1393, -1, 28, 1, 143 },
+  { 0x1, 0x1, 168, 1394, -1, 28, 1, 143 },
+  { 0x1, 0x1, 168, 1395, -1, 28, 1, 142 },
+  { 0x1, 0x1, 168, 1670, -1, 28, 1, 133 },
+  { 0x1, 0x1, 168, 1671, -1, 28, 1, 133 },
+  { 0x1, 0x1, 168, 1672, -1, 28, 1, 133 },
+  { 0x1, 0x1, 168, 1673, -1, 28, 1, 133 },
+  { 0x1, 0x1, 169, 1630, -1, 29, 1, 140 },
+  { 0x1, 0x1, 169, 1631, -1, 29, 1, 141 },
+  { 0x1, 0x1, 169, 1632, -1, 29, 1, 141 },
+  { 0x1, 0x1, 169, 1633, -1, 29, 1, 140 },
+  { 0x1, 0x1, 169, 1634, -1, 29, 1, 142 },
+  { 0x1, 0x1, 169, 1635, -1, 29, 1, 143 },
+  { 0x1, 0x1, 169, 1636, -1, 29, 1, 143 },
+  { 0x1, 0x1, 169, 1637, -1, 29, 1, 142 },
+  { 0x1, 0x1, 169, 1638, -1, 29, 1, 142 },
+  { 0x1, 0x1, 169, 1639, -1, 29, 1, 143 },
+  { 0x1, 0x1, 169, 1640, -1, 29, 1, 143 },
+  { 0x1, 0x1, 169, 1641, -1, 29, 1, 142 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 132 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 132 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 132 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 132 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 132 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 132 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 132 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 132 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 133 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 133 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 133 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 133 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 125 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 126 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 127 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 256, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 1794, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 125 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 126 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 127 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 258, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 1795, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 125 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 126 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 127 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 260, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 1796, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 125 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 126 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 127 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 262, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 1797, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 125 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 126 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 127 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 264, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 1798, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 125 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 126 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 127 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 266, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 1799, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 125 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 126 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 127 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 268, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 1800, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 125 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 126 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 127 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 270, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 1801, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 125 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 126 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 127 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 272, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 1802, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 125 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 126 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 127 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 128 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 274, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 1803, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 125 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 126 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 127 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 128 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 276, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 1804, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 125 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 126 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 127 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 128 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 278, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 129 },
+  { 0x3, 0x3, 170, 1805, -1, 28, 1, 124 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1806, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1807, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1808, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1809, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1810, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1811, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1812, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1813, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1814, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1815, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1816, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1817, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1818, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1819, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1820, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1821, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1822, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 136 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 137 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 138 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 139 },
+  { 0x3, 0x3, 170, 1823, -1, 28, 1, 135 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 140 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 141 },
+  { 0x3, 0x3, 170, 764, -1, 28, 1, 141 },
+  { 0x3, 0x3, 170, 765, -1, 28, 1, 140 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 142 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 143 },
+  { 0x3, 0x3, 170, 766, -1, 28, 1, 143 },
+  { 0x3, 0x3, 170, 767, -1, 28, 1, 142 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 142 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 143 },
+  { 0x3, 0x3, 170, 768, -1, 28, 1, 143 },
+  { 0x3, 0x3, 170, 769, -1, 28, 1, 142 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, 1762, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, 1763, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, 1764, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, 1765, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, 1766, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, 1767, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 131 },
+  { 0x3, 0x3, 170, 1768, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 131 },
+  { 0x3, 0x3, 170, 1769, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 130 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 133 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 133 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 133 },
+  { 0x3, 0x3, 170, -1, -1, 28, 1, 133 },
+  { 0x0, 0x0, 171, -1, 313, 0, 0, -1 },
+  { 0x0, 0x0, 171, 2417, 2387, 0, 1, 1 },
+  { 0x0, 0x0, 171, -1, 317, 0, 0, -1 },
+  { 0x0, 0x0, 171, 2419, 2389, 0, 1, 1 },
+  { 0x11, 0x31, 172, 2321, 320, 33, 1, 4 },
+  { 0x2200001, 0x2200001, 172, -1, 321, 12, 1, 4 },
+  { 0x1, 0x1, 172, -1, 324, 37, 1, 4 },
+  { 0x2000001, 0x2000001, 172, -1, 325, 12, 1, 4 },
+  { 0x11, 0x11, 172, -1, 326, 33, 1, 4 },
+  { 0x2200001, 0x2200001, 172, -1, 327, 12, 1, 4 },
+  { 0x11, 0x31, 172, 2331, 332, 33, 1, 4 },
+  { 0x2200001, 0x2200001, 172, -1, 333, 12, 1, 4 },
+  { 0x11, 0x31, 172, 2341, 336, 33, 1, 4 },
+  { 0x2200001, 0x2200001, 172, -1, 337, 12, 1, 4 },
+  { 0x1, 0x1, 172, -1, 340, 37, 1, 4 },
+  { 0x2000001, 0x2000001, 172, -1, 341, 12, 1, 4 },
+  { 0x11, 0x11, 172, -1, 342, 33, 1, 4 },
+  { 0x2200001, 0x2200001, 172, -1, 343, 12, 1, 4 },
+  { 0x11, 0x31, 172, 2351, 348, 33, 1, 4 },
+  { 0x2200001, 0x2200001, 172, -1, 349, 12, 1, 4 },
+  { 0x1, 0x1, 172, -1, 352, 33, 1, 4 },
+  { 0x200001, 0x200001, 172, -1, 353, 12, 1, 4 },
+  { 0x1, 0x1, 172, -1, 356, 33, 1, 4 },
+  { 0x200001, 0x200001, 172, -1, 357, 12, 1, 4 },
+  { 0x1, 0x1, 173, -1, -1, 37, 1, 4 },
+  { 0x2000001, 0x2000001, 173, -1, -1, 12, 1, 4 },
+  { 0x1, 0x1, 173, -1, -1, 37, 1, 4 },
+  { 0x2000001, 0x2000001, 173, -1, -1, 12, 1, 4 },
+  { 0x11, 0x11, 173, -1, -1, 33, 1, 4 },
+  { 0x2200001, 0x2200001, 173, -1, -1, 12, 1, 4 },
+  { 0x1, 0x1, 173, -1, -1, 37, 1, 4 },
+  { 0x2000001, 0x2000001, 173, -1, -1, 12, 1, 4 },
+  { 0x0, 0x0, 173, -1, -1, 0, 1, 5 },
+  { 0x1, 0x1, 173, -1, -1, 12, 1, 5 },
+  { 0x0, 0x0, 173, -1, -1, 0, 1, 5 },
+  { 0x1, 0x1, 173, -1, -1, 12, 1, 5 },
+  { 0x1, 0x1, 173, -1, -1, 33, 1, 5 },
+  { 0x200001, 0x200001, 173, -1, -1, 12, 1, 5 },
+  { 0x0, 0x0, 173, -1, -1, 0, 1, 5 },
+  { 0x1, 0x1, 173, -1, -1, 12, 1, 5 },
+  { 0x1, 0x1, 173, -1, -1, 37, 1, 4 },
+  { 0x2000001, 0x2000001, 173, -1, -1, 12, 1, 4 },
+  { 0x1, 0x1, 173, -1, -1, 37, 1, 4 },
+  { 0x2000001, 0x2000001, 173, -1, -1, 12, 1, 4 },
+  { 0x11, 0x11, 173, -1, -1, 33, 1, 4 },
+  { 0x2200001, 0x2200001, 173, -1, -1, 12, 1, 4 },
+  { 0x1, 0x1, 173, -1, -1, 37, 1, 4 },
+  { 0x2000001, 0x2000001, 173, -1, -1, 12, 1, 4 },
+  { 0x0, 0x0, 173, -1, -1, 0, 1, 5 },
+  { 0x1, 0x1, 173, -1, -1, 12, 1, 5 },
+  { 0x0, 0x0, 173, -1, -1, 0, 1, 5 },
+  { 0x1, 0x1, 173, -1, -1, 12, 1, 5 },
+  { 0x1, 0x1, 173, -1, -1, 33, 1, 5 },
+  { 0x200001, 0x200001, 173, -1, -1, 12, 1, 5 },
+  { 0x0, 0x0, 173, -1, -1, 0, 1, 5 },
+  { 0x1, 0x1, 173, -1, -1, 12, 1, 5 },
+  { 0x9, 0x9, 173, -1, -1, 33, 1, 5 },
+  { 0x1, 0x1, 173, 314, -1, 33, 1, 4 },
+  { 0x1200001, 0x1200001, 173, -1, -1, 12, 1, 5 },
+  { 0x200001, 0x200001, 173, 315, -1, 12, 1, 4 },
+  { 0x9, 0x9, 173, -1, -1, 33, 1, 5 },
+  { 0x1, 0x1, 173, 318, -1, 33, 1, 4 },
+  { 0x1200001, 0x1200001, 173, -1, -1, 12, 1, 5 },
+  { 0x200001, 0x200001, 173, 319, -1, 12, 1, 4 },
+  { 0x0, 0x0, 174, -1, 1851, 0, 0, -1 },
+  { 0x9, 0x9, 174, -1, 2381, 33, 1, 49 },
+  { 0x0, 0x0, 174, -1, 1892, 0, 0, -1 },
+  { 0x7, 0x7, 174, -1, -1, 27, 1, 49 },
+  { 0x1, 0x1, 194, -1, -1, 27, 1, 10 },
+  { 0x1, 0x1, 208, -1, -1, 29, 1, 0 },
+  { 0x1, 0x1, 208, -1, -1, 29, 1, 0 },
+  { 0x2, 0x3, 208, 937, -1, 27, 1, 33 },
+  { 0x0, 0x0, 208, 938, -1, 0, 1, 33 },
+  { 0x0, 0x0, 208, 939, -1, 0, 1, 0 },
+  { 0x0, 0x0, 208, 940, -1, 0, 1, 0 },
+  { 0x0, 0x0, 208, 941, -1, 0, 1, 0 },
+  { 0x0, 0x0, 208, 942, -1, 0, 1, 0 },
+  { 0x0, 0x0, 208, 2403, -1, 0, 1, 93 },
+  { 0x0, 0x0, 208, 2404, -1, 0, 1, 93 },
+  { 0x0, 0x0, 208, 2405, 779, 0, 0, -1 },
+  { 0x1, 0x1, 209, -1, -1, 27, 1, 0 },
+  { 0x1, 0x1, 209, -1, -1, 27, 1, 0 },
+  { 0x1, 0x1, 210, -1, 1135, 32, 1, 132 },
+  { 0x1, 0x1, 210, -1, 1137, 32, 1, 132 },
+  { 0x1, 0x1, 210, -1, 1139, 32, 1, 132 },
+  { 0x1, 0x1, 210, -1, 1141, 32, 1, 132 },
+  { 0x1, 0x1, 210, -1, 1143, 32, 1, 133 },
+  { 0x1, 0x1, 210, -1, 1145, 32, 1, 133 },
+  { 0x1, 0x1, 210, -1, 1642, 32, 1, 130 },
+  { 0x1, 0x1, 210, -1, 1644, 32, 1, 130 },
+  { 0x1, 0x1, 210, -1, 1646, 32, 1, 130 },
+  { 0x1, 0x1, 210, -1, 1648, 32, 1, 130 },
+  { 0x1, 0x1, 210, -1, 1650, 32, 1, 130 },
+  { 0x1, 0x1, 210, -1, 1652, 32, 1, 130 },
+  { 0x1, 0x1, 210, 2223, 1654, 32, 1, 130 },
+  { 0x1, 0x1, 210, 2224, 1657, 32, 1, 130 },
+  { 0x0, 0x0, 211, -1, 2265, 0, 0, -1 },
+  { 0x0, 0x0, 211, -1, 2266, 0, 0, -1 },
+  { 0x0, 0x0, 211, -1, 2291, 0, 0, -1 },
+  { 0x5, 0x5, 211, -1, 2294, 20, 1, 67 },
+  { 0x0, 0x0, 215, 1753, 778, 0, 0, -1 },
+  { 0x0, 0x0, 216, -1, 909, 0, 0, -1 },
+  { 0x0, 0x0, 216, -1, 990, 0, 0, -1 },
+  { 0x0, 0x0, 216, -1, -1, 0, 1, 121 },
+  { 0x0, 0x0, 216, -1, -1, 0, 1, 66 },
+  { 0x1, 0x1, 216, 655, 1825, 36, 1, 65 },
+  { 0x1, 0x1, 216, 656, 1860, 36, 1, 65 },
+  { 0x0, 0x0, 216, 657, 1863, 0, 0, -1 },
+  { 0x1, 0x1, 216, 658, -1, 36, 1, 65 },
+  { 0x0, 0x0, 216, 1132, -1, 0, 1, 33 },
+  { 0x1, 0x1, 216, 659, 1868, 36, 1, 65 },
+  { 0x0, 0x0, 216, 660, 1871, 0, 0, -1 },
+  { 0x1, 0x1, 216, 661, -1, 36, 1, 65 },
+  { 0x0, 0x0, 216, 662, 1874, 0, 0, -1 },
+  { 0x1, 0x1, 216, 663, -1, 36, 1, 65 },
+  { 0x1, 0x1, 216, 664, 1877, 36, 1, 65 },
+  { 0x1, 0x1, 216, 665, 1880, 36, 1, 65 },
+  { 0x0, 0x0, 216, 1133, -1, 0, 1, 33 },
+  { 0x1, 0x1, 216, 666, 1913, 36, 1, 65 },
+  { 0x1, 0x1, 216, 667, -1, 31, 1, 134 },
+  { 0x1, 0x1, 216, 219, 1146, 32, 1, 125 },
+  { 0x1, 0x1, 216, 220, 1155, 32, 1, 125 },
+  { 0x1, 0x1, 216, 221, 1164, 32, 1, 125 },
+  { 0x1, 0x1, 216, 222, 1173, 32, 1, 125 },
+  { 0x1, 0x1, 216, 223, 1182, 32, 1, 125 },
+  { 0x1, 0x1, 216, 224, 1191, 32, 1, 125 },
+  { 0x1, 0x1, 216, 225, 1200, 32, 1, 125 },
+  { 0x1, 0x1, 216, 226, 1209, 32, 1, 125 },
+  { 0x1, 0x1, 216, 227, 1218, 32, 1, 125 },
+  { 0x1, 0x1, 216, 228, 1227, 32, 1, 125 },
+  { 0x1, 0x1, 216, 229, 1237, 32, 1, 125 },
+  { 0x1, 0x1, 216, 230, 1247, 32, 1, 125 },
+  { 0x1, 0x1, 216, 231, 1260, 32, 1, 136 },
+  { 0x1, 0x1, 216, 232, 1266, 32, 1, 136 },
+  { 0x1, 0x1, 216, 233, 1272, 32, 1, 136 },
+  { 0x1, 0x1, 216, 234, 1278, 32, 1, 136 },
+  { 0x1, 0x1, 216, 235, 1284, 32, 1, 136 },
+  { 0x1, 0x1, 216, 236, 1290, 32, 1, 136 },
+  { 0x1, 0x1, 216, 237, 1296, 32, 1, 136 },
+  { 0x1, 0x1, 216, 238, 1302, 32, 1, 136 },
+  { 0x1, 0x1, 216, 239, 1308, 32, 1, 136 },
+  { 0x1, 0x1, 216, 240, 1314, 32, 1, 136 },
+  { 0x1, 0x1, 216, 241, 1320, 32, 1, 136 },
+  { 0x1, 0x1, 216, 242, 1326, 32, 1, 136 },
+  { 0x1, 0x1, 216, 243, 1332, 32, 1, 136 },
+  { 0x1, 0x1, 216, 244, 1338, 32, 1, 136 },
+  { 0x1, 0x1, 216, 245, 1344, 32, 1, 136 },
+  { 0x1, 0x1, 216, 246, 1350, 32, 1, 136 },
+  { 0x1, 0x1, 216, 247, 1356, 32, 1, 136 },
+  { 0x1, 0x1, 216, 248, 1362, 32, 1, 136 },
+  { 0x1, 0x1, 216, 671, -1, 31, 1, 144 },
+  { 0x0, 0x0, 217, 1916, -1, 0, 1, 65 },
+  { 0x0, 0x0, 217, 1917, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 23, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1919, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1920, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1921, -1, 0, 1, 44 },
+  { 0x0, 0x0, 217, 1922, -1, 0, 1, 39 },
+  { 0x1, 0x1, 217, 1923, -1, 12, 1, 58 },
+  { 0x0, 0x0, 217, 1924, -1, 0, 1, 53 },
+  { 0x1000001, 0x1000001, 217, 1925, -1, 12, 1, 58 },
+  { 0x1, 0x1, 217, 1926, -1, 36, 1, 53 },
+  { 0x200001, 0x200001, 217, 1927, -1, 12, 1, 58 },
+  { 0x1, 0x1, 217, 1928, -1, 33, 1, 53 },
+  { 0x1200001, 0x1200001, 217, 1929, -1, 12, 1, 48 },
+  { 0x9, 0x9, 217, 1930, -1, 33, 1, 48 },
+  { 0x1, 0x1, 217, 1931, -1, 12, 1, 58 },
+  { 0x0, 0x0, 217, 1932, -1, 0, 1, 53 },
+  { 0x200001, 0x1200001, 217, 1933, -1, 12, 1, 58 },
+  { 0x1, 0x9, 217, 1934, -1, 33, 1, 53 },
+  { 0x1, 0x1, 217, 1935, -1, 12, 1, 58 },
+  { 0x0, 0x0, 217, 1936, -1, 0, 1, 53 },
+  { 0x1000001, 0x1000001, 217, 1937, -1, 12, 1, 58 },
+  { 0x1, 0x1, 217, 1938, -1, 36, 1, 53 },
+  { 0x200001, 0x200001, 217, 1939, -1, 12, 1, 58 },
+  { 0x1, 0x1, 217, 1940, -1, 33, 1, 53 },
+  { 0x1200001, 0x1200001, 217, 1941, -1, 12, 1, 48 },
+  { 0x9, 0x9, 217, 1942, -1, 33, 1, 48 },
+  { 0x1, 0x1, 217, 1943, -1, 12, 1, 58 },
+  { 0x0, 0x0, 217, 1944, -1, 0, 1, 53 },
+  { 0x200001, 0x1200001, 217, 1945, -1, 12, 1, 58 },
+  { 0x1, 0x9, 217, 1946, -1, 33, 1, 53 },
+  { 0x1, 0x1, 217, 1947, -1, 28, 1, 28 },
+  { 0x0, 0x0, 217, 1948, -1, 0, 1, 28 },
+  { 0x3, 0x3, 217, 1949, -1, 27, 1, 28 },
+  { 0x1, 0x1, 217, 1950, -1, 27, 1, 28 },
+  { 0x0, 0x0, 217, 1951, -1, 0, 1, 65 },
+  { 0x0, 0x0, 217, 1952, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1953, -1, 0, 1, 28 },
+  { 0x1, 0x1, 217, 1954, -1, 36, 1, 65 },
+  { 0x1, 0x1, 217, 1955, -1, 37, 1, 28 },
+  { 0x0, 0x0, 217, 1956, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1957, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1958, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1959, -1, 0, 1, 65 },
+  { 0x0, 0x0, 217, 1960, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 35, -1, 0, 1, 28 },
+  { 0x1, 0x1, 217, 1962, -1, 36, 1, 65 },
+  { 0x1, 0x1, 217, 1963, -1, 37, 1, 28 },
+  { 0x0, 0x0, 217, 1964, -1, 0, 1, 28 },
+  { 0x1, 0x1, 217, 1965, -1, 36, 1, 65 },
+  { 0x1, 0x1, 217, 1966, -1, 37, 1, 28 },
+  { 0x0, 0x0, 217, 1967, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1968, -1, 0, 1, 65 },
+  { 0x0, 0x0, 217, 1969, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 40, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1971, -1, 0, 1, 65 },
+  { 0x0, 0x0, 217, 1972, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 41, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1974, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1975, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1976, -1, 0, 1, 48 },
+  { 0x1, 0x1, 217, 1977, -1, 27, 1, 48 },
+  { 0x1, 0x1, 217, 1978, -1, 28, 1, 48 },
+  { 0x3, 0x3, 217, 1979, -1, 27, 1, 48 },
+  { 0x1, 0x1, 217, 1980, -1, 29, 1, 48 },
+  { 0x5, 0x5, 217, 1981, -1, 27, 1, 48 },
+  { 0x3, 0x3, 217, 1982, -1, 28, 1, 48 },
+  { 0x7, 0x7, 217, 1983, -1, 27, 1, 48 },
+  { 0x0, 0x0, 217, 1984, -1, 0, 1, 48 },
+  { 0x0, 0x0, 217, 1985, -1, 0, 1, 48 },
+  { 0x0, 0x0, 217, 1986, -1, 0, 1, 48 },
+  { 0x0, 0x0, 217, 1987, -1, 0, 1, 48 },
+  { 0x1, 0x1, 217, 1988, -1, 28, 1, 28 },
+  { 0x0, 0x0, 217, 1989, -1, 0, 1, 28 },
+  { 0x3, 0x3, 217, 1990, -1, 27, 1, 28 },
+  { 0x1, 0x1, 217, 1991, -1, 27, 1, 28 },
+  { 0x0, 0x0, 217, 1992, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1993, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1994, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 50, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1996, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1997, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 55, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 1999, -1, 0, 1, 23 },
+  { 0x0, 0x0, 217, 2000, -1, 0, 1, 23 },
+  { 0x0, 0x0, 217, 2001, -1, 0, 1, 23 },
+  { 0x0, 0x0, 217, 2002, -1, 0, 1, 23 },
+  { 0x0, 0x0, 217, 2003, -1, 0, 1, 34 },
+  { 0x0, 0x0, 217, 2004, -1, 0, 1, 65 },
+  { 0x0, 0x0, 217, 2005, -1, 0, 1, 28 },
+  { 0x0, 0x0, 217, 62, -1, 0, 1, 28 },
+  { 0x1, 0x1, 218, 2007, -1, 34, 1, 65 },
+  { 0x1, 0x1, 218, 2008, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2009, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2010, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2011, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2012, -1, 34, 1, 45 },
+  { 0x1, 0x1, 218, 2013, -1, 34, 1, 41 },
+  { 0x400001, 0x400001, 218, 2014, -1, 12, 1, 60 },
+  { 0x1, 0x1, 218, 2015, -1, 34, 1, 55 },
+  { 0x1400001, 0x1400001, 218, 2016, -1, 12, 1, 60 },
+  { 0x5, 0x5, 218, 2017, -1, 34, 1, 55 },
+  { 0x600001, 0x600001, 218, 2018, -1, 12, 1, 60 },
+  { 0x3, 0x3, 218, 2019, -1, 33, 1, 55 },
+  { 0x1600001, 0x1600001, 218, 2020, -1, 12, 1, 50 },
+  { 0xb, 0xb, 218, 2021, -1, 33, 1, 50 },
+  { 0x400001, 0x400001, 218, 2022, -1, 12, 1, 60 },
+  { 0x1, 0x1, 218, 2023, -1, 34, 1, 55 },
+  { 0x600001, 0x1600001, 218, 2024, -1, 12, 1, 60 },
+  { 0x3, 0xb, 218, 2025, -1, 33, 1, 55 },
+  { 0x400001, 0x400001, 218, 2026, -1, 12, 1, 60 },
+  { 0x1, 0x1, 218, 2027, -1, 34, 1, 55 },
+  { 0x1400001, 0x1400001, 218, 2028, -1, 12, 1, 60 },
+  { 0x5, 0x5, 218, 2029, -1, 34, 1, 55 },
+  { 0x600001, 0x600001, 218, 2030, -1, 12, 1, 60 },
+  { 0x3, 0x3, 218, 2031, -1, 33, 1, 55 },
+  { 0x1600001, 0x1600001, 218, 2032, -1, 12, 1, 50 },
+  { 0xb, 0xb, 218, 2033, -1, 33, 1, 50 },
+  { 0x400001, 0x400001, 218, 2034, -1, 12, 1, 60 },
+  { 0x1, 0x1, 218, 2035, -1, 34, 1, 55 },
+  { 0x600001, 0x1600001, 218, 2036, -1, 12, 1, 60 },
+  { 0x3, 0xb, 218, 2037, -1, 33, 1, 55 },
+  { 0x41, 0x41, 218, 2038, -1, 28, 1, 30 },
+  { 0x1, 0x1, 218, 2039, -1, 34, 1, 30 },
+  { 0x83, 0x83, 218, 2040, -1, 27, 1, 30 },
+  { 0x81, 0x81, 218, 2041, -1, 27, 1, 30 },
+  { 0x1, 0x1, 218, 2042, -1, 34, 1, 65 },
+  { 0x1, 0x1, 218, 2043, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2044, -1, 34, 1, 30 },
+  { 0x5, 0x5, 218, 2045, -1, 34, 1, 65 },
+  { 0x9, 0x9, 218, 2046, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2047, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2048, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2049, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2050, -1, 34, 1, 65 },
+  { 0x1, 0x1, 218, 2051, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2052, -1, 34, 1, 30 },
+  { 0x5, 0x5, 218, 2053, -1, 34, 1, 65 },
+  { 0x9, 0x9, 218, 2054, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2055, -1, 34, 1, 30 },
+  { 0x5, 0x5, 218, 2056, -1, 34, 1, 65 },
+  { 0x9, 0x9, 218, 2057, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2058, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2059, -1, 34, 1, 65 },
+  { 0x1, 0x1, 218, 2060, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2061, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2062, -1, 34, 1, 65 },
+  { 0x1, 0x1, 218, 2063, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2064, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2065, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2066, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2067, -1, 34, 1, 50 },
+  { 0x81, 0x81, 218, 2068, -1, 27, 1, 50 },
+  { 0x41, 0x41, 218, 2069, -1, 28, 1, 50 },
+  { 0x83, 0x83, 218, 2070, -1, 27, 1, 50 },
+  { 0x21, 0x21, 218, 2071, -1, 29, 1, 50 },
+  { 0x85, 0x85, 218, 2072, -1, 27, 1, 50 },
+  { 0x43, 0x43, 218, 2073, -1, 28, 1, 50 },
+  { 0x87, 0x87, 218, 2074, -1, 27, 1, 50 },
+  { 0x1, 0x1, 218, 2075, -1, 34, 1, 50 },
+  { 0x1, 0x1, 218, 2076, -1, 34, 1, 50 },
+  { 0x1, 0x1, 218, 2077, -1, 34, 1, 50 },
+  { 0x1, 0x1, 218, 2078, -1, 34, 1, 50 },
+  { 0x41, 0x41, 218, 2079, -1, 28, 1, 30 },
+  { 0x1, 0x1, 218, 2080, -1, 34, 1, 30 },
+  { 0x83, 0x83, 218, 2081, -1, 27, 1, 30 },
+  { 0x81, 0x81, 218, 2082, -1, 27, 1, 30 },
+  { 0x1, 0x1, 218, 2083, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2084, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2085, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2086, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2087, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2088, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2089, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2090, -1, 34, 1, 25 },
+  { 0x1, 0x1, 218, 2091, -1, 34, 1, 25 },
+  { 0x1, 0x1, 218, 2092, -1, 34, 1, 25 },
+  { 0x1, 0x1, 218, 2093, -1, 34, 1, 25 },
+  { 0x1, 0x1, 218, 2094, -1, 34, 1, 36 },
+  { 0x1, 0x1, 218, 2095, -1, 34, 1, 65 },
+  { 0x1, 0x1, 218, 2096, -1, 34, 1, 30 },
+  { 0x1, 0x1, 218, 2097, -1, 34, 1, 30 },
+  { 0x1, 0x1, 219, 2098, -1, 35, 1, 65 },
+  { 0x1, 0x1, 219, 2099, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2100, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2101, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2102, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2103, -1, 35, 1, 46 },
+  { 0x1, 0x1, 219, 2104, -1, 35, 1, 42 },
+  { 0x800001, 0x800001, 219, 2105, -1, 12, 1, 61 },
+  { 0x1, 0x1, 219, 2106, -1, 35, 1, 56 },
+  { 0x1800001, 0x1800001, 219, 2107, -1, 12, 1, 61 },
+  { 0x3, 0x3, 219, 2108, -1, 35, 1, 56 },
+  { 0xa00001, 0xa00001, 219, 2109, -1, 12, 1, 61 },
+  { 0x5, 0x5, 219, 2110, -1, 33, 1, 56 },
+  { 0x1a00001, 0x1a00001, 219, 2111, -1, 12, 1, 51 },
+  { 0xd, 0xd, 219, 2112, -1, 33, 1, 51 },
+  { 0x800001, 0x800001, 219, 2113, -1, 12, 1, 61 },
+  { 0x1, 0x1, 219, 2114, -1, 35, 1, 56 },
+  { 0xa00001, 0x1a00001, 219, 2115, -1, 12, 1, 61 },
+  { 0x5, 0xd, 219, 2116, -1, 33, 1, 56 },
+  { 0x800001, 0x800001, 219, 2117, -1, 12, 1, 61 },
+  { 0x1, 0x1, 219, 2118, -1, 35, 1, 56 },
+  { 0x1800001, 0x1800001, 219, 2119, -1, 12, 1, 61 },
+  { 0x3, 0x3, 219, 2120, -1, 35, 1, 56 },
+  { 0xa00001, 0xa00001, 219, 2121, -1, 12, 1, 61 },
+  { 0x5, 0x5, 219, 2122, -1, 33, 1, 56 },
+  { 0x1a00001, 0x1a00001, 219, 2123, -1, 12, 1, 51 },
+  { 0xd, 0xd, 219, 2124, -1, 33, 1, 51 },
+  { 0x800001, 0x800001, 219, 2125, -1, 12, 1, 61 },
+  { 0x1, 0x1, 219, 2126, -1, 35, 1, 56 },
+  { 0xa00001, 0x1a00001, 219, 2127, -1, 12, 1, 61 },
+  { 0x5, 0xd, 219, 2128, -1, 33, 1, 56 },
+  { 0x81, 0x81, 219, 2129, -1, 28, 1, 31 },
+  { 0x1, 0x1, 219, 2130, -1, 35, 1, 31 },
+  { 0x103, 0x103, 219, 2131, -1, 27, 1, 31 },
+  { 0x101, 0x101, 219, 2132, -1, 27, 1, 31 },
+  { 0x1, 0x1, 219, 2133, -1, 35, 1, 65 },
+  { 0x1, 0x1, 219, 2134, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2135, -1, 35, 1, 31 },
+  { 0x3, 0x3, 219, 2136, -1, 35, 1, 65 },
+  { 0x5, 0x5, 219, 2137, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2138, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2139, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2140, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2141, -1, 35, 1, 65 },
+  { 0x1, 0x1, 219, 2142, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2143, -1, 35, 1, 31 },
+  { 0x3, 0x3, 219, 2144, -1, 35, 1, 65 },
+  { 0x5, 0x5, 219, 2145, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2146, -1, 35, 1, 31 },
+  { 0x3, 0x3, 219, 2147, -1, 35, 1, 65 },
+  { 0x5, 0x5, 219, 2148, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2149, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2150, -1, 35, 1, 65 },
+  { 0x1, 0x1, 219, 2151, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2152, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2153, -1, 35, 1, 65 },
+  { 0x1, 0x1, 219, 2154, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2155, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2156, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2157, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2158, -1, 35, 1, 51 },
+  { 0x101, 0x101, 219, 2159, -1, 27, 1, 51 },
+  { 0x81, 0x81, 219, 2160, -1, 28, 1, 51 },
+  { 0x103, 0x103, 219, 2161, -1, 27, 1, 51 },
+  { 0x41, 0x41, 219, 2162, -1, 29, 1, 51 },
+  { 0x105, 0x105, 219, 2163, -1, 27, 1, 51 },
+  { 0x83, 0x83, 219, 2164, -1, 28, 1, 51 },
+  { 0x107, 0x107, 219, 2165, -1, 27, 1, 51 },
+  { 0x1, 0x1, 219, 2166, -1, 35, 1, 51 },
+  { 0x1, 0x1, 219, 2167, -1, 35, 1, 51 },
+  { 0x1, 0x1, 219, 2168, -1, 35, 1, 51 },
+  { 0x1, 0x1, 219, 2169, -1, 35, 1, 51 },
+  { 0x81, 0x81, 219, 2170, -1, 28, 1, 31 },
+  { 0x1, 0x1, 219, 2171, -1, 35, 1, 31 },
+  { 0x103, 0x103, 219, 2172, -1, 27, 1, 31 },
+  { 0x101, 0x101, 219, 2173, -1, 27, 1, 31 },
+  { 0x1, 0x1, 219, 2174, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2175, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2176, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2177, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2178, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2179, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2180, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2181, -1, 35, 1, 26 },
+  { 0x1, 0x1, 219, 2182, -1, 35, 1, 26 },
+  { 0x1, 0x1, 219, 2183, -1, 35, 1, 26 },
+  { 0x1, 0x1, 219, 2184, -1, 35, 1, 26 },
+  { 0x1, 0x1, 219, 2185, -1, 35, 1, 37 },
+  { 0x1, 0x1, 219, 2186, -1, 35, 1, 65 },
+  { 0x1, 0x1, 219, 2187, -1, 35, 1, 31 },
+  { 0x1, 0x1, 219, 2188, -1, 35, 1, 31 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 65 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, 1779, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 47 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 43 },
+  { 0xc00001, 0xc00001, 220, -1, -1, 12, 1, 62 },
+  { 0x3, 0x3, 220, 2362, -1, 34, 1, 57 },
+  { 0x1c00001, 0x1c00001, 220, -1, -1, 12, 1, 62 },
+  { 0x7, 0x7, 220, 2363, -1, 34, 1, 57 },
+  { 0xe00001, 0xe00001, 220, -1, -1, 12, 1, 62 },
+  { 0x7, 0x7, 220, 2364, -1, 33, 1, 57 },
+  { 0x1e00001, 0x1e00001, 220, -1, -1, 12, 1, 52 },
+  { 0xf, 0xf, 220, 2365, -1, 33, 1, 52 },
+  { 0xc00001, 0xc00001, 220, -1, -1, 12, 1, 62 },
+  { 0x3, 0x3, 220, 2370, -1, 34, 1, 57 },
+  { 0xe00001, 0x1e00001, 220, -1, -1, 12, 1, 62 },
+  { 0x7, 0xf, 220, 2371, -1, 33, 1, 57 },
+  { 0xc00001, 0xc00001, 220, -1, -1, 12, 1, 62 },
+  { 0x3, 0x3, 220, 2374, -1, 34, 1, 57 },
+  { 0x1c00001, 0x1c00001, 220, -1, -1, 12, 1, 62 },
+  { 0x7, 0x7, 220, 2375, -1, 34, 1, 57 },
+  { 0xe00001, 0xe00001, 220, -1, -1, 12, 1, 62 },
+  { 0x7, 0x7, 220, 2376, -1, 33, 1, 57 },
+  { 0x1e00001, 0x1e00001, 220, -1, -1, 12, 1, 52 },
+  { 0xf, 0xf, 220, 2377, -1, 33, 1, 52 },
+  { 0xc00001, 0xc00001, 220, -1, -1, 12, 1, 62 },
+  { 0x3, 0x3, 220, 2382, -1, 34, 1, 57 },
+  { 0xe00001, 0x1e00001, 220, -1, -1, 12, 1, 62 },
+  { 0x7, 0xf, 220, 2383, -1, 33, 1, 57 },
+  { 0xc1, 0xc1, 220, -1, -1, 28, 1, 32 },
+  { 0x3, 0x3, 220, 2302, -1, 34, 1, 32 },
+  { 0x183, 0x183, 220, -1, -1, 27, 1, 32 },
+  { 0x181, 0x181, 220, 2303, -1, 27, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 65 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, 1780, -1, 34, 1, 32 },
+  { 0x7, 0x7, 220, -1, -1, 34, 1, 65 },
+  { 0xb, 0xb, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, 1781, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 65 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, 1784, -1, 34, 1, 32 },
+  { 0x7, 0x7, 220, -1, -1, 34, 1, 65 },
+  { 0xb, 0xb, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, 1785, -1, 34, 1, 32 },
+  { 0x7, 0x7, 220, -1, -1, 34, 1, 65 },
+  { 0xb, 0xb, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, 1787, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 65 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, 1789, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 65 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, 1790, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 52 },
+  { 0x181, 0x181, 220, -1, -1, 27, 1, 52 },
+  { 0xc1, 0xc1, 220, -1, -1, 28, 1, 52 },
+  { 0x183, 0x183, 220, -1, -1, 27, 1, 52 },
+  { 0x61, 0x61, 220, -1, -1, 29, 1, 52 },
+  { 0x185, 0x185, 220, -1, -1, 27, 1, 52 },
+  { 0xc3, 0xc3, 220, -1, -1, 28, 1, 52 },
+  { 0x187, 0x187, 220, -1, -1, 27, 1, 52 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 52 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 52 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 52 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 52 },
+  { 0xc1, 0xc1, 220, -1, -1, 28, 1, 32 },
+  { 0x3, 0x3, 220, 2306, -1, 34, 1, 32 },
+  { 0x183, 0x183, 220, -1, -1, 27, 1, 32 },
+  { 0x181, 0x181, 220, 2307, -1, 27, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 27 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 27 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 27 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 27 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 38 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 65 },
+  { 0x3, 0x3, 220, -1, -1, 34, 1, 32 },
+  { 0x3, 0x3, 220, 1792, -1, 34, 1, 32 },
+  { 0x3, 0x3, 221, 362, 1148, 32, 1, 127 },
+  { 0x3, 0x3, 221, 363, 1157, 32, 1, 127 },
+  { 0x3, 0x3, 221, 364, 1166, 32, 1, 127 },
+  { 0x3, 0x3, 221, 365, 1175, 32, 1, 127 },
+  { 0x3, 0x3, 221, 366, 1184, 32, 1, 127 },
+  { 0x3, 0x3, 221, 367, 1193, 32, 1, 127 },
+  { 0x3, 0x3, 221, 368, 1202, 32, 1, 127 },
+  { 0x3, 0x3, 221, 369, 1211, 32, 1, 127 },
+  { 0x3, 0x3, 221, 370, 1220, 32, 1, 127 },
+  { 0x3, 0x3, 221, 371, 1229, 32, 1, 127 },
+  { 0x3, 0x3, 221, 372, 1239, 32, 1, 127 },
+  { 0x3, 0x3, 221, 373, 1249, 32, 1, 127 },
+  { 0x3, 0x3, 221, 386, 1262, 32, 1, 138 },
+  { 0x3, 0x3, 221, 387, 1268, 32, 1, 138 },
+  { 0x3, 0x3, 221, 388, 1274, 32, 1, 138 },
+  { 0x3, 0x3, 221, 389, 1280, 32, 1, 138 },
+  { 0x3, 0x3, 221, 390, 1286, 32, 1, 138 },
+  { 0x3, 0x3, 221, 391, 1292, 32, 1, 138 },
+  { 0x3, 0x3, 221, 392, 1298, 32, 1, 138 },
+  { 0x3, 0x3, 221, 393, 1304, 32, 1, 138 },
+  { 0x3, 0x3, 221, 394, 1310, 32, 1, 138 },
+  { 0x3, 0x3, 221, 395, 1316, 32, 1, 138 },
+  { 0x3, 0x3, 221, 396, 1322, 32, 1, 138 },
+  { 0x3, 0x3, 221, 397, 1328, 32, 1, 138 },
+  { 0x3, 0x3, 221, 398, 1334, 32, 1, 138 },
+  { 0x3, 0x3, 221, 399, 1340, 32, 1, 138 },
+  { 0x3, 0x3, 221, 400, 1346, 32, 1, 138 },
+  { 0x3, 0x3, 221, 401, 1352, 32, 1, 138 },
+  { 0x3, 0x3, 221, 402, 1358, 32, 1, 138 },
+  { 0x3, 0x3, 221, 403, 1364, 32, 1, 138 },
+  { 0x1, 0x1, 222, -1, -1, 28, 1, 33 },
+  { 0x1, 0x1, 222, -1, -1, 28, 1, 33 },
+  { 0x0, 0x0, 229, 771, -1, 0, 1, 134 },
+  { 0x0, 0x0, 229, 772, -1, 0, 1, 144 },
+  { 0x1, 0x1, 230, -1, 1655, 33, 1, 131 },
+  { 0x1, 0x1, 230, -1, 1658, 33, 1, 131 },
+  { 0x0, 0x0, 230, -1, 1660, 0, 1, 130 },
+  { 0x0, 0x0, 230, -1, 1661, 0, 1, 130 },
+  { 0x0, 0x0, 231, 705, 783, 0, 0, -1 },
+  { 0x0, 0x0, 231, 706, 791, 0, 0, -1 },
+  { 0x0, 0x0, 231, 707, 787, 0, 0, -1 },
+  { 0x1, 0x1, 231, 708, 442, 33, 1, 6 },
+  { 0x8000001, 0x8000001, 231, 709, 450, 6, 1, 7 },
+  { 0x1, 0x1, 231, 710, 446, 33, 1, 6 },
+  { 0x0, 0x0, 231, 711, 795, 0, 0, -1 },
+  { 0x1, 0x1, 231, 712, 462, 33, 1, 8 },
+  { 0x0, 0x0, 231, 713, 799, 0, 0, -1 },
+  { 0x1, 0x1, 231, 714, 474, 33, 1, 15 },
+  { 0x0, 0x0, 231, 715, 804, 0, 0, -1 },
+  { 0x0, 0x0, 231, 716, 808, 0, 0, -1 },
+  { 0x1, 0x1, 231, 717, 497, 33, 1, 17 },
+  { 0x1, 0x1, 231, 718, 501, 33, 1, 17 },
+  { 0x0, 0x0, 231, 719, 812, 0, 0, -1 },
+  { 0x0, 0x0, 231, 720, 816, 0, 0, -1 },
+  { 0x1, 0x1, 231, 721, 521, 33, 1, 18 },
+  { 0x8000001, 0x8000001, 231, 722, 525, 6, 1, 18 },
+  { 0x0, 0x0, 231, 723, 820, 0, 0, -1 },
+  { 0x1, 0x1, 231, 724, 537, 33, 1, 19 },
+  { 0x0, 0x0, 231, 725, 824, 0, 0, -1 },
+  { 0x0, 0x0, 231, 726, 828, 0, 0, -1 },
+  { 0x1, 0x1, 231, 727, 557, 33, 1, 20 },
+  { 0x8000001, 0x8000001, 231, 728, 561, 6, 1, 20 },
+  { 0x0, 0x0, 231, 729, 832, 0, 0, -1 },
+  { 0x1, 0x1, 231, 730, 573, 33, 1, 21 },
+  { 0x0, 0x0, 231, 731, 837, 0, 0, -1 },
+  { 0x0, 0x0, 231, 732, 841, 0, 0, -1 },
+  { 0x1, 0x1, 231, 733, 596, 33, 1, 17 },
+  { 0x1, 0x1, 231, 734, 600, 33, 1, 17 },
+  { 0x0, 0x0, 231, 735, 845, 0, 0, -1 },
+  { 0x1, 0x1, 231, 736, 612, 33, 1, 21 },
+  { 0x0, 0x0, 232, 2227, 782, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2228, 790, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2229, 786, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2230, 441, 0, 1, 6 },
+  { 0x1, 0x1, 232, 2231, 449, 6, 1, 7 },
+  { 0x0, 0x0, 232, 2232, 445, 0, 1, 6 },
+  { 0x0, 0x0, 232, 2233, 794, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2234, 461, 0, 1, 8 },
+  { 0x0, 0x0, 232, 2235, 798, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2236, 473, 0, 1, 15 },
+  { 0x0, 0x0, 232, 2237, 803, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2238, 807, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2239, 496, 0, 1, 17 },
+  { 0x0, 0x0, 232, 2240, 500, 0, 1, 17 },
+  { 0x0, 0x0, 232, 2241, 811, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2242, 815, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2243, 520, 0, 1, 18 },
+  { 0x1, 0x1, 232, 2244, 524, 6, 1, 18 },
+  { 0x0, 0x0, 232, 2245, 819, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2246, 536, 0, 1, 19 },
+  { 0x0, 0x0, 232, 2247, 823, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2248, 827, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2249, 556, 0, 1, 20 },
+  { 0x1, 0x1, 232, 2250, 560, 6, 1, 20 },
+  { 0x0, 0x0, 232, 2251, 831, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2252, 572, 0, 1, 21 },
+  { 0x0, 0x0, 232, 2253, 836, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2254, 840, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2255, 595, 0, 1, 17 },
+  { 0x0, 0x0, 232, 2256, 599, 0, 1, 17 },
+  { 0x0, 0x0, 232, 2257, 844, 0, 0, -1 },
+  { 0x0, 0x0, 232, 2258, 611, 0, 1, 21 },
+  { 0x1, 0x1, 232, 737, 923, 27, 1, 16 },
+  { 0x0, 0x0, 232, 738, 921, 0, 1, 16 },
+  { 0x0, 0x0, 232, 967, 925, 0, 1, 22 },
+  { 0x0, 0x1, 232, 933, 931, 20, 1, 67 },
+  { 0x0, 0x0, 232, 107, 929, 0, 1, 67 },
+  { 0x1, 0x1, 235, -1, -1, 29, 1, 0 },
+  { 0x0, 0x0, 235, -1, -1, 0, 1, 0 },
+  { 0x1, 0x1, 235, 2399, -1, 27, 1, 0 },
+  { 0x1, 0x1, 235, 2400, -1, 27, 1, 0 },
+  { 0x1, 0x1, 235, 2401, -1, 27, 1, 0 },
+  { 0x1, 0x1, 235, 2402, -1, 27, 1, 0 },
+  { 0x0, 0x0, 256, -1, 1856, 0, 0, -1 },
+  { 0x0, 0x0, 256, -1, 1858, 0, 0, -1 },
+  { 0x1, 0x1, 256, -1, -1, 28, 1, 29 },
+  { 0x1, 0x1, 256, -1, -1, 28, 1, 29 },
+  { 0x0, 0x0, 256, -1, 1897, 0, 0, -1 },
+  { 0x0, 0x0, 256, -1, 1899, 0, 0, -1 },
+  { 0x1, 0x1, 256, -1, -1, 28, 1, 29 },
+  { 0x1, 0x1, 256, -1, -1, 28, 1, 29 },
+  { 0x0, 0x0, 258, 21, -1, 0, 1, 0 },
+  { 0x0, 0x0, 258, -1, -1, 0, 1, 0 },
+  { 0x0, 0x0, 258, -1, -1, 0, 1, 0 },
+  { 0x0, 0x1, 258, -1, -1, 29, 1, 0 },
+  { 0x0, 0x1, 258, -1, -1, 29, 1, 0 },
+  { 0x0, 0x1, 258, -1, -1, 29, 1, 0 },
+  { 0x0, 0x1, 258, -1, -1, 29, 1, 0 },
+  { 0x0, 0x1, 258, -1, -1, 29, 1, 0 },
+  { 0x0, 0x0, 258, 175, -1, 0, 1, 0 },
+  { 0x0, 0x1, 258, -1, -1, 29, 1, 0 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 64 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 64 },
+  { 0x0, 0x0, 259, -1, 1832, 0, 0, -1 },
+  { 0x0, 0x0, 259, -1, 1834, 0, 0, -1 },
+  { 0x0, 0x0, 259, -1, 1836, 0, 0, -1 },
+  { 0x0, 0x0, 259, -1, 1838, 0, 0, -1 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 59 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 59 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 59 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 49 },
+  { 0x0, 0x0, 259, -1, 1840, 0, 0, -1 },
+  { 0x0, 0x0, 259, -1, 1842, 0, 0, -1 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 59 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 59 },
+  { 0x0, 0x0, 259, -1, 1844, 0, 0, -1 },
+  { 0x0, 0x0, 259, -1, 1846, 0, 0, -1 },
+  { 0x0, 0x0, 259, -1, 1848, 0, 0, -1 },
+  { 0x0, 0x0, 259, -1, 1850, 0, 0, -1 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 59 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 59 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 59 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 49 },
+  { 0x0, 0x0, 259, -1, 1852, 0, 0, -1 },
+  { 0x0, 0x0, 259, -1, 1854, 0, 0, -1 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 59 },
+  { 0x1, 0x1, 259, -1, -1, 12, 1, 59 },
+  { 0x1, 0x1, 259, 312, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, 354, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, 316, -1, 12, 1, 2 },
+  { 0x1, 0x1, 259, 358, -1, 12, 1, 2 },
   { 0x0, 0x0, 260, -1, 1839, 0, 0, -1 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 46 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 46 },
-  { 0x0, 0x0, 260, -1, 1841, 0, 0, -1 },
-  { 0x0, 0x0, 260, -1, 1843, 0, 0, -1 },
-  { 0x0, 0x0, 260, -1, 1845, 0, 0, -1 },
-  { 0x0, 0x0, 260, -1, 1847, 0, 0, -1 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 46 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 46 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 46 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 46 },
-  { 0x0, 0x0, 260, -1, 1849, 0, 0, -1 },
-  { 0x0, 0x0, 260, -1, 1851, 0, 0, -1 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 46 },
-  { 0x1, 0x1, 260, -1, -1, 12, 1, 46 },
-  { 0x1, 0x1, 260, 313, -1, 12, 1, 68 },
-  { 0x1, 0x1, 260, 355, -1, 12, 1, 68 },
-  { 0x1, 0x1, 260, 317, -1, 12, 1, 68 },
-  { 0x1, 0x1, 260, 359, -1, 12, 1, 68 },
-  { 0x0, 0x0, 261, -1, 1836, 0, 0, -1 },
-  { 0x9, 0x9, 261, -1, 2354, 33, 1, 46 },
-  { 0x0, 0x0, 261, 1112, 1885, 0, 0, -1 },
-  { 0x3, 0x3, 261, 1113, -1, 27, 1, 46 },
-  { 0x0, 0x0, 265, 2281, -1, 0, 1, 0 },
-  { 0x3, 0x3, 266, -1, -1, 27, 1, 0 },
-  { 0x3, 0x3, 266, -1, -1, 27, 1, 0 },
-  { 0x3, 0x3, 266, -1, -1, 27, 1, 2 },
-  { 0x3, 0x3, 266, -1, -1, 27, 1, 2 },
-  { 0x1, 0x1, 267, 2380, -1, 28, 1, 0 },
-  { 0x1, 0x1, 267, 2381, -1, 28, 1, 0 },
-  { 0x1, 0x1, 267, 2382, -1, 28, 1, 2 },
-  { 0x1, 0x1, 267, 2383, -1, 28, 1, 2 },
-  { 0x1, 0x1, 268, -1, -1, 27, 1, 2 },
-  { 0x1, 0x1, 268, -1, -1, 27, 1, 2 },
-  { 0x0, 0x0, 268, -1, 781, 0, 0, -1 },
-  { 0x0, 0x0, 269, 2393, 2258, 0, 0, -1 },
-  { 0x0, 0x0, 269, 2394, 2260, 0, 0, -1 },
-  { 0x0, 0x0, 270, -1, 2259, 0, 0, -1 },
-  { 0x0, 0x0, 270, -1, 2261, 0, 0, -1 },
-  { 0x0, 0x0, 271, -1, -1, 0, 1, 37 },
-  { 0x0, 0x0, 271, -1, -1, 0, 1, 37 },
-  { 0x0, 0x0, 276, -1, -1, 0, 1, 30 },
-  { 0x0, 0x0, 280, -1, 1859, 0, 1, 26 },
-  { 0x0, 0x0, 281, -1, -1, 0, 1, 63 },
-  { 0x0, 0x0, 281, -1, -1, 0, 1, 63 },
-  { 0x0, 0x0, 281, 1671, 2371, 0, 1, 67 },
-  { 0x0, 0x0, 281, -1, 356, 0, 0, -1 },
-  { 0x0, 0x0, 281, 1673, 2373, 0, 1, 67 },
-  { 0x0, 0x0, 281, -1, 360, 0, 0, -1 },
+  { 0x9, 0x9, 260, -1, 2369, 33, 1, 49 },
+  { 0x0, 0x0, 260, 1113, 1888, 0, 0, -1 },
+  { 0x3, 0x3, 260, 1114, -1, 27, 1, 49 },
+  { 0x0, 0x0, 264, 2296, -1, 0, 1, 0 },
+  { 0x3, 0x3, 265, -1, -1, 27, 1, 0 },
+  { 0x3, 0x3, 265, -1, -1, 27, 1, 0 },
+  { 0x3, 0x3, 265, -1, -1, 27, 1, 0 },
+  { 0x3, 0x3, 265, -1, -1, 27, 1, 0 },
+  { 0x1, 0x1, 266, 2395, -1, 28, 1, 0 },
+  { 0x1, 0x1, 266, 2396, -1, 28, 1, 0 },
+  { 0x1, 0x1, 266, 2397, -1, 28, 1, 0 },
+  { 0x1, 0x1, 266, 2398, -1, 28, 1, 0 },
+  { 0x1, 0x1, 267, -1, -1, 27, 1, 93 },
+  { 0x1, 0x1, 267, -1, -1, 27, 1, 93 },
+  { 0x0, 0x0, 267, -1, 780, 0, 0, -1 },
+  { 0x0, 0x0, 268, 2408, 2273, 0, 0, -1 },
+  { 0x0, 0x0, 268, 2409, 2275, 0, 0, -1 },
+  { 0x0, 0x0, 269, -1, 2274, 0, 0, -1 },
+  { 0x0, 0x0, 269, -1, 2276, 0, 0, -1 },
+  { 0x0, 0x0, 270, -1, -1, 0, 1, 40 },
+  { 0x0, 0x0, 270, -1, -1, 0, 1, 40 },
+  { 0x0, 0x0, 275, -1, -1, 0, 1, 33 },
+  { 0x0, 0x0, 279, -1, 1862, 0, 1, 29 },
+  { 0x0, 0x0, 280, -1, -1, 0, 1, 71 },
+  { 0x0, 0x0, 280, -1, -1, 0, 1, 71 },
+  { 0x0, 0x0, 280, 1674, 2386, 0, 1, 1 },
+  { 0x0, 0x0, 280, -1, 355, 0, 0, -1 },
+  { 0x0, 0x0, 280, 1676, 2388, 0, 1, 1 },
+  { 0x0, 0x0, 280, -1, 359, 0, 0, -1 },
 };
 
 static const struct ia64_main_table
 main_table[] = {
-  { 5, 1, 1, 0x10000000000ull, 0x1eff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 0, },
-  { 5, 1, 1, 0x10008000000ull, 0x1eff8000000ull, { 23, 24, 25, 3, 0 }, 0x0, 1, },
-  { 5, 7, 1, 0x0ull, 0x0ull, { 23, 65, 25, 0, 0 }, 0x0, 2, },
-  { 6, 1, 1, 0x12000000000ull, 0x1e000000000ull, { 23, 65, 26, 0, 0 }, 0x0, 3, },
-  { 7, 1, 1, 0x10040000000ull, 0x1eff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 4, },
-  { 7, 1, 1, 0x10c00000000ull, 0x1ee00000000ull, { 23, 62, 25, 0, 0 }, 0x0, 5, },
-  { 8, 1, 1, 0x10800000000ull, 0x1ee00000000ull, { 23, 62, 25, 0, 0 }, 0x0, 6, },
-  { 9, 3, 1, 0x2c00000000ull, 0x1ee00000000ull, { 23, 2, 51, 52, 53 }, 0x221, 7, },
-  { 10, 1, 1, 0x10060000000ull, 0x1eff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 8, },
-  { 10, 1, 1, 0x10160000000ull, 0x1eff8000000ull, { 23, 54, 25, 0, 0 }, 0x0, 9, },
-  { 11, 1, 1, 0x10068000000ull, 0x1eff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 10, },
-  { 11, 1, 1, 0x10168000000ull, 0x1eff8000000ull, { 23, 54, 25, 0, 0 }, 0x0, 11, },
-  { 14, 4, 0, 0x100000000ull, 0x1eff80011ffull, { 15, 0, 0, 0, 0 }, 0x40, 782, },
-  { 14, 4, 0, 0x100000000ull, 0x1eff80011c0ull, { 15, 0, 0, 0, 0 }, 0x0, 648, },
-  { 14, 4, 0, 0x100000000ull, 0x1eff80011c0ull, { 15, 0, 0, 0, 0 }, 0x40, 649, },
-  { 14, 4, 0, 0x108000100ull, 0x1eff80011c0ull, { 15, 0, 0, 0, 0 }, 0x200, 1767, },
-  { 14, 4, 0, 0x108000100ull, 0x1eff80011c0ull, { 15, 0, 0, 0, 0 }, 0x240, 1768, },
-  { 14, 4, 1, 0x2000000000ull, 0x1ee00001000ull, { 14, 15, 0, 0, 0 }, 0x0, 405, },
-  { 14, 4, 1, 0x2000000000ull, 0x1ee00001000ull, { 14, 15, 0, 0, 0 }, 0x40, 406, },
-  { 14, 4, 0, 0x8000000000ull, 0x1ee000011ffull, { 80, 0, 0, 0, 0 }, 0x40, 803, },
-  { 14, 4, 0, 0x8000000000ull, 0x1ee000011c0ull, { 80, 0, 0, 0, 0 }, 0x0, 650, },
-  { 14, 4, 0, 0x8000000000ull, 0x1ee000011c0ull, { 80, 0, 0, 0, 0 }, 0x40, 651, },
-  { 14, 4, 0, 0x8000000080ull, 0x1ee000011c0ull, { 80, 0, 0, 0, 0 }, 0x210, 2391, },
-  { 14, 4, 0, 0x8000000080ull, 0x1ee000011c0ull, { 80, 0, 0, 0, 0 }, 0x250, 2392, },
-  { 14, 4, 0, 0x8000000140ull, 0x1ee000011c0ull, { 80, 0, 0, 0, 0 }, 0x30, 413, },
-  { 14, 4, 0, 0x8000000140ull, 0x1ee000011c0ull, { 80, 0, 0, 0, 0 }, 0x70, 414, },
-  { 14, 4, 0, 0x8000000180ull, 0x1ee000011c0ull, { 80, 0, 0, 0, 0 }, 0x230, 411, },
-  { 14, 4, 0, 0x8000000180ull, 0x1ee000011c0ull, { 80, 0, 0, 0, 0 }, 0x270, 412, },
-  { 14, 4, 1, 0xa000000000ull, 0x1ee00001000ull, { 14, 80, 0, 0, 0 }, 0x0, 407, },
-  { 14, 4, 1, 0xa000000000ull, 0x1ee00001000ull, { 14, 80, 0, 0, 0 }, 0x40, 408, },
-  { 15, 4, 0, 0x0ull, 0x1e1f8000000ull, { 64, 0, 0, 0, 0 }, 0x0, 361, },
-  { 15, 5, 0, 0x0ull, 0x1e3f8000000ull, { 64, 0, 0, 0, 0 }, 0x0, 774, },
-  { 15, 2, 0, 0x0ull, 0x1eff8000000ull, { 64, 0, 0, 0, 0 }, 0x2, 907, },
-  { 15, 3, 0, 0x0ull, 0x1eff8000000ull, { 64, 0, 0, 0, 0 }, 0x0, 988, },
-  { 15, 6, 0, 0x0ull, 0x1eff8000000ull, { 68, 0, 0, 0, 0 }, 0x0, 2395, },
-  { 15, 7, 0, 0x0ull, 0x0ull, { 64, 0, 0, 0, 0 }, 0x0, 14, },
-  { 16, 6, 0, 0x18000000000ull, 0x1ee000011ffull, { 81, 0, 0, 0, 0 }, 0x40, 836, },
-  { 16, 6, 0, 0x18000000000ull, 0x1ee000011c0ull, { 81, 0, 0, 0, 0 }, 0x0, 652, },
-  { 16, 6, 0, 0x18000000000ull, 0x1ee000011c0ull, { 81, 0, 0, 0, 0 }, 0x40, 653, },
-  { 16, 6, 1, 0x1a000000000ull, 0x1ee00001000ull, { 14, 81, 0, 0, 0 }, 0x0, 409, },
-  { 16, 6, 1, 0x1a000000000ull, 0x1ee00001000ull, { 14, 81, 0, 0, 0 }, 0x40, 410, },
-  { 17, 4, 0, 0x4080000000ull, 0x1e9f8000018ull, { 15, 76, 0, 0, 0 }, 0x20, 2277, },
-  { 17, 4, 0, 0xe000000000ull, 0x1e800000018ull, { 80, 76, 0, 0, 0 }, 0x20, 2278, },
-  { 18, 4, 0, 0x60000000ull, 0x1e1f8000000ull, { 0, 0, 0, 0, 0 }, 0x2c, 216, },
-  { 22, 2, 0, 0x200000000ull, 0x1ee00000000ull, { 24, 79, 0, 0, 0 }, 0x0, 1772, },
-  { 22, 3, 0, 0x800000000ull, 0x1ee00000000ull, { 23, 80, 0, 0, 0 }, 0x0, 218, },
-  { 22, 3, 0, 0xc00000000ull, 0x1ee00000000ull, { 17, 80, 0, 0, 0 }, 0x0, 219, },
-  { 22, 3, 0, 0x2200000000ull, 0x1ee00000000ull, { 24, 79, 0, 0, 0 }, 0x0, 1773, },
-  { 22, 3, 0, 0x2600000000ull, 0x1ee00000000ull, { 18, 79, 0, 0, 0 }, 0x0, 1774, },
-  { 22, 7, 0, 0x0ull, 0x0ull, { 24, 79, 0, 0, 0 }, 0x0, 1775, },
-  { 25, 4, 0, 0x20000000ull, 0x1e1f8000000ull, { 0, 0, 0, 0, 0 }, 0x224, 16, },
-  { 26, 1, 2, 0x18000000000ull, 0x1fe00001000ull, { 21, 22, 24, 25, 0 }, 0x0, 968, },
-  { 26, 1, 2, 0x18000000000ull, 0x1fe00001000ull, { 22, 21, 25, 24, 0 }, 0x0, 948, },
-  { 26, 1, 2, 0x18000000000ull, 0x1fe00001000ull, { 21, 22, 25, 24, 0 }, 0x0, 881, },
-  { 26, 1, 2, 0x18000000000ull, 0x1fe00001000ull, { 22, 21, 24, 25, 0 }, 0x0, 865, },
-  { 26, 1, 2, 0x18200000000ull, 0x1fe00001000ull, { 21, 22, 24, 25, 0 }, 0x40, 1096, },
-  { 26, 1, 2, 0x19000000000ull, 0x1fe00001000ull, { 21, 22, 6, 25, 0 }, 0x0, 882, },
-  { 26, 1, 2, 0x19000000000ull, 0x1fe00001000ull, { 21, 22, 6, 25, 0 }, 0x40, 950, },
-  { 26, 1, 2, 0x18800000000ull, 0x1ee00001000ull, { 21, 22, 54, 25, 0 }, 0x0, 971, },
-  { 26, 1, 2, 0x18800000000ull, 0x1ee00001000ull, { 21, 22, 56, 25, 0 }, 0x0, 951, },
-  { 26, 1, 2, 0x18800000000ull, 0x1ee00001000ull, { 22, 21, 56, 25, 0 }, 0x0, 884, },
-  { 26, 1, 2, 0x18800000000ull, 0x1ee00001000ull, { 22, 21, 54, 25, 0 }, 0x0, 868, },
-  { 26, 1, 2, 0x18a00000000ull, 0x1ee00001000ull, { 21, 22, 54, 25, 0 }, 0x40, 1099, },
-  { 26, 1, 2, 0x1a800000000ull, 0x1ee00001000ull, { 21, 22, 58, 25, 0 }, 0x0, 963, },
-  { 26, 1, 2, 0x1a800000000ull, 0x1ee00001000ull, { 22, 21, 58, 25, 0 }, 0x0, 897, },
-  { 26, 1, 2, 0x1c200000000ull, 0x1fe00001000ull, { 22, 21, 24, 25, 0 }, 0x40, 1100, },
-  { 26, 1, 2, 0x1d000000000ull, 0x1fe00001000ull, { 22, 21, 6, 25, 0 }, 0x40, 952, },
-  { 26, 1, 2, 0x1ca00000000ull, 0x1ee00001000ull, { 22, 21, 54, 25, 0 }, 0x40, 1101, },
-  { 27, 1, 2, 0x18400000000ull, 0x1fe00001000ull, { 21, 22, 24, 25, 0 }, 0x0, 973, },
-  { 27, 1, 2, 0x18400000000ull, 0x1fe00001000ull, { 22, 21, 25, 24, 0 }, 0x0, 953, },
-  { 27, 1, 2, 0x18400000000ull, 0x1fe00001000ull, { 21, 22, 25, 24, 0 }, 0x0, 886, },
-  { 27, 1, 2, 0x18400000000ull, 0x1fe00001000ull, { 22, 21, 24, 25, 0 }, 0x0, 870, },
-  { 27, 1, 2, 0x18600000000ull, 0x1fe00001000ull, { 21, 22, 24, 25, 0 }, 0x40, 1104, },
-  { 27, 1, 2, 0x19400000000ull, 0x1fe00001000ull, { 21, 22, 6, 25, 0 }, 0x0, 887, },
-  { 27, 1, 2, 0x19400000000ull, 0x1fe00001000ull, { 21, 22, 6, 25, 0 }, 0x40, 955, },
-  { 27, 1, 2, 0x18c00000000ull, 0x1ee00001000ull, { 21, 22, 54, 25, 0 }, 0x0, 976, },
-  { 27, 1, 2, 0x18c00000000ull, 0x1ee00001000ull, { 21, 22, 56, 25, 0 }, 0x0, 956, },
-  { 27, 1, 2, 0x18c00000000ull, 0x1ee00001000ull, { 22, 21, 56, 25, 0 }, 0x0, 889, },
-  { 27, 1, 2, 0x18c00000000ull, 0x1ee00001000ull, { 22, 21, 54, 25, 0 }, 0x0, 873, },
-  { 27, 1, 2, 0x18e00000000ull, 0x1ee00001000ull, { 21, 22, 54, 25, 0 }, 0x40, 1107, },
-  { 27, 1, 2, 0x1ac00000000ull, 0x1ee00001000ull, { 21, 22, 55, 25, 0 }, 0x0, 985, },
-  { 27, 1, 2, 0x1ac00000000ull, 0x1ee00001000ull, { 21, 22, 57, 25, 0 }, 0x0, 965, },
-  { 27, 1, 2, 0x1ac00000000ull, 0x1ee00001000ull, { 22, 21, 57, 25, 0 }, 0x0, 899, },
-  { 27, 1, 2, 0x1ac00000000ull, 0x1ee00001000ull, { 22, 21, 55, 25, 0 }, 0x0, 880, },
-  { 27, 1, 2, 0x1c600000000ull, 0x1fe00001000ull, { 22, 21, 24, 25, 0 }, 0x40, 1108, },
-  { 27, 1, 2, 0x1d400000000ull, 0x1fe00001000ull, { 22, 21, 6, 25, 0 }, 0x40, 957, },
-  { 27, 1, 2, 0x1ce00000000ull, 0x1ee00001000ull, { 22, 21, 54, 25, 0 }, 0x40, 1109, },
-  { 28, 3, 1, 0x8008000000ull, 0x1fff8000000ull, { 23, 32, 24, 1, 0 }, 0x0, 251, },
-  { 29, 3, 1, 0x8048000000ull, 0x1fff8000000ull, { 23, 32, 24, 1, 0 }, 0x0, 252, },
-  { 30, 3, 1, 0x8088000000ull, 0x1fff8000000ull, { 23, 32, 24, 1, 0 }, 0x0, 253, },
-  { 31, 3, 1, 0x80c8000000ull, 0x1fff8000000ull, { 23, 32, 24, 1, 0 }, 0x0, 254, },
-  { 33, 4, 0, 0x10000000ull, 0x1e1f8000000ull, { 0, 0, 0, 0, 0 }, 0x224, 17, },
-  { 35, 2, 1, 0xc0000000ull, 0x1eff8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 934, },
-  { 36, 2, 1, 0xc8000000ull, 0x1eff8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 935, },
-  { 38, 2, 1, 0x8000000000ull, 0x1e000000000ull, { 23, 24, 25, 46, 71 }, 0x0, 18, },
-  { 38, 2, 1, 0xa600000000ull, 0x1ee04000000ull, { 23, 24, 44, 72, 0 }, 0x0, 2399, },
-  { 38, 2, 1, 0xa604000000ull, 0x1ee04000000ull, { 23, 54, 44, 72, 0 }, 0x0, 2400, },
-  { 38, 2, 1, 0xae00000000ull, 0x1ee00000000ull, { 23, 47, 25, 45, 72 }, 0x0, 19, },
-  { 42, 4, 0, 0x80000000ull, 0x1e1f8000000ull, { 0, 0, 0, 0, 0 }, 0x20, 20, },
-  { 47, 2, 1, 0xa400000000ull, 0x1ee00002000ull, { 23, 25, 75, 72, 0 }, 0x0, 2295, },
-  { 49, 5, 1, 0x80000000ull, 0x1e3f80fe000ull, { 17, 19, 0, 0, 0 }, 0x40, 22, },
-  { 50, 5, 1, 0x10008000000ull, 0x1fff8000000ull, { 17, 19, 18, 0, 0 }, 0x40, 1824, },
-  { 51, 5, 1, 0xb8000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1825, },
-  { 51, 5, 1, 0xb8000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 24, },
-  { 52, 5, 1, 0xb0000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1826, },
-  { 52, 5, 1, 0xb0000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 25, },
-  { 53, 5, 1, 0x160000000ull, 0x1e3f8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 26, },
-  { 54, 5, 1, 0x168000000ull, 0x1e3f8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 27, },
-  { 56, 3, 0, 0x2180000000ull, 0x1eff8000000ull, { 25, 0, 0, 0, 0 }, 0x0, 28, },
-  { 57, 5, 0, 0x40000000ull, 0x1eff8000000ull, { 78, 0, 0, 0, 0 }, 0x0, 1827, },
-  { 57, 5, 0, 0x40000000ull, 0x1eff8000000ull, { 78, 0, 0, 0, 0 }, 0x40, 29, },
-  { 58, 5, 2, 0xa000000000ull, 0x1e000001000ull, { 21, 22, 18, 59, 0 }, 0x0, 990, },
-  { 58, 5, 2, 0xa000000000ull, 0x1e000001000ull, { 22, 21, 18, 59, 0 }, 0x40, 1127, },
-  { 59, 5, 0, 0x28000000ull, 0x1eff8000000ull, { 0, 0, 0, 0, 0 }, 0x0, 1828, },
-  { 59, 5, 0, 0x28000000ull, 0x1eff8000000ull, { 0, 0, 0, 0, 0 }, 0x40, 30, },
-  { 60, 5, 2, 0x8000000000ull, 0x1fe00001000ull, { 21, 22, 18, 19, 0 }, 0x0, 758, },
-  { 60, 5, 2, 0x8000000000ull, 0x1fe00001000ull, { 21, 22, 18, 19, 0 }, 0x40, 759, },
-  { 60, 5, 2, 0x9000000000ull, 0x1fe00001000ull, { 21, 22, 19, 18, 0 }, 0x0, 891, },
-  { 60, 5, 2, 0x9000000000ull, 0x1fe00001000ull, { 21, 22, 19, 18, 0 }, 0x40, 892, },
-  { 60, 5, 2, 0x8000000000ull, 0x1fe00001000ull, { 22, 21, 18, 19, 0 }, 0x0, 1110, },
-  { 60, 5, 2, 0x8000000000ull, 0x1fe00001000ull, { 22, 21, 18, 19, 0 }, 0x40, 1111, },
-  { 60, 5, 2, 0x9000000000ull, 0x1fe00001000ull, { 22, 21, 19, 18, 0 }, 0x0, 1116, },
-  { 60, 5, 2, 0x9000000000ull, 0x1fe00001000ull, { 22, 21, 19, 18, 0 }, 0x40, 1117, },
-  { 61, 5, 1, 0xc0000000ull, 0x1eff8000000ull, { 17, 18, 0, 0, 0 }, 0x0, 855, },
-  { 61, 5, 1, 0xc0000000ull, 0x1eff8000000ull, { 17, 18, 0, 0, 0 }, 0x40, 856, },
-  { 61, 5, 1, 0xe0000000ull, 0x1e3f8000000ull, { 17, 18, 0, 0, 0 }, 0x0, 2397, },
-  { 61, 5, 1, 0x10008000000ull, 0x1fff80fe000ull, { 17, 19, 0, 0, 0 }, 0x40, 2398, },
-  { 62, 3, 1, 0x8488000000ull, 0x1fff8000000ull, { 23, 32, 70, 0, 0 }, 0x0, 255, },
-  { 63, 3, 1, 0x84c8000000ull, 0x1fff8000000ull, { 23, 32, 70, 0, 0 }, 0x0, 256, },
-  { 66, 3, 0, 0x60000000ull, 0x1eff8000000ull, { 0, 0, 0, 0, 0 }, 0x21, 31, },
-  { 67, 5, 1, 0x10000000000ull, 0x1fc00000000ull, { 17, 19, 20, 18, 0 }, 0x0, 1862, },
-  { 67, 5, 1, 0x10000000000ull, 0x1fc00000000ull, { 17, 19, 20, 18, 0 }, 0x40, 32, },
-  { 68, 5, 1, 0xa8000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1863, },
-  { 68, 5, 1, 0xa8000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 33, },
-  { 69, 5, 1, 0x80000000ull, 0x1e3f8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1780, },
-  { 70, 5, 1, 0xa0000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1864, },
-  { 70, 5, 1, 0xa0000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 34, },
-  { 71, 5, 1, 0x1c8000000ull, 0x1e3f8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 967, },
-  { 72, 5, 1, 0x10000000000ull, 0x1fc000fe000ull, { 17, 19, 20, 0, 0 }, 0x40, 1867, },
-  { 73, 5, 1, 0x14000000000ull, 0x1fc00000000ull, { 17, 19, 20, 18, 0 }, 0x0, 1870, },
-  { 73, 5, 1, 0x14000000000ull, 0x1fc00000000ull, { 17, 19, 20, 18, 0 }, 0x40, 36, },
-  { 74, 5, 1, 0x88000000ull, 0x1e3f8000000ull, { 17, 19, 0, 0, 0 }, 0xc0, 37, },
-  { 75, 5, 1, 0x88000000ull, 0x1e3f80fe000ull, { 17, 19, 0, 0, 0 }, 0x40, 38, },
-  { 76, 5, 1, 0x18000000000ull, 0x1fc00000000ull, { 17, 19, 20, 18, 0 }, 0x0, 1873, },
-  { 76, 5, 1, 0x18000000000ull, 0x1fc00000000ull, { 17, 19, 20, 18, 0 }, 0x40, 39, },
-  { 77, 5, 1, 0x18000000000ull, 0x1fc000fe000ull, { 17, 19, 20, 0, 0 }, 0x40, 1876, },
-  { 78, 5, 1, 0x10008000000ull, 0x1fff80fe000ull, { 17, 19, 0, 0, 0 }, 0x40, 1879, },
-  { 79, 5, 1, 0x170000000ull, 0x1e3f8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 42, },
-  { 80, 5, 1, 0x2080000000ull, 0x1e3f80fe000ull, { 17, 19, 0, 0, 0 }, 0x40, 43, },
-  { 81, 5, 1, 0x140000000ull, 0x1e3f8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 44, },
-  { 82, 5, 1, 0x20b8000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1880, },
-  { 82, 5, 1, 0x20b8000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 45, },
-  { 83, 5, 1, 0x20b0000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1881, },
-  { 83, 5, 1, 0x20b0000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 46, },
-  { 84, 5, 1, 0x2180000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 760, },
-  { 84, 5, 1, 0x2180000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 761, },
-  { 85, 5, 1, 0x20c0000000ull, 0x1eff8000000ull, { 17, 18, 0, 0, 0 }, 0x0, 857, },
-  { 85, 5, 1, 0x20c0000000ull, 0x1eff8000000ull, { 17, 18, 0, 0, 0 }, 0x40, 858, },
-  { 86, 5, 1, 0x13000000000ull, 0x1fc00000000ull, { 17, 19, 20, 18, 0 }, 0x0, 1894, },
-  { 86, 5, 1, 0x13000000000ull, 0x1fc00000000ull, { 17, 19, 20, 18, 0 }, 0x40, 47, },
-  { 87, 5, 1, 0x20a8000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1895, },
-  { 87, 5, 1, 0x20a8000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 48, },
-  { 88, 5, 1, 0x2080000000ull, 0x1e3f8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1788, },
-  { 89, 5, 1, 0x20a0000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1896, },
-  { 89, 5, 1, 0x20a0000000ull, 0x1eff8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 49, },
-  { 90, 5, 1, 0x13000000000ull, 0x1fc000fe000ull, { 17, 19, 20, 0, 0 }, 0x40, 1897, },
-  { 91, 5, 1, 0x17000000000ull, 0x1fc00000000ull, { 17, 19, 20, 18, 0 }, 0x0, 1898, },
-  { 91, 5, 1, 0x17000000000ull, 0x1fc00000000ull, { 17, 19, 20, 18, 0 }, 0x40, 51, },
-  { 92, 5, 1, 0x2088000000ull, 0x1e3f8000000ull, { 17, 19, 0, 0, 0 }, 0xc0, 52, },
-  { 93, 5, 1, 0x2088000000ull, 0x1e3f80fe000ull, { 17, 19, 0, 0, 0 }, 0x40, 53, },
-  { 94, 5, 1, 0x1b000000000ull, 0x1fc00000000ull, { 17, 19, 20, 18, 0 }, 0x0, 1899, },
-  { 94, 5, 1, 0x1b000000000ull, 0x1fc00000000ull, { 17, 19, 20, 18, 0 }, 0x40, 54, },
-  { 95, 5, 1, 0x1b000000000ull, 0x1fc000fe000ull, { 17, 19, 20, 0, 0 }, 0x40, 1900, },
-  { 96, 5, 2, 0x2200000000ull, 0x1fe00000000ull, { 17, 22, 18, 19, 0 }, 0x0, 1901, },
-  { 96, 5, 2, 0x2200000000ull, 0x1fe00000000ull, { 17, 22, 18, 19, 0 }, 0x40, 56, },
-  { 97, 5, 2, 0x3200000000ull, 0x1fe00000000ull, { 17, 22, 19, 0, 0 }, 0x0, 1902, },
-  { 97, 5, 2, 0x3200000000ull, 0x1fe00000000ull, { 17, 22, 19, 0, 0 }, 0x40, 57, },
-  { 98, 5, 1, 0x17008000000ull, 0x1fff8000000ull, { 17, 19, 18, 0, 0 }, 0x40, 1903, },
-  { 99, 5, 2, 0x200000000ull, 0x1fe00000000ull, { 17, 22, 18, 19, 0 }, 0x0, 1904, },
-  { 99, 5, 2, 0x200000000ull, 0x1fe00000000ull, { 17, 22, 18, 19, 0 }, 0x40, 59, },
-  { 100, 5, 2, 0x1200000000ull, 0x1fe00000000ull, { 17, 22, 19, 0, 0 }, 0x0, 1905, },
-  { 100, 5, 2, 0x1200000000ull, 0x1fe00000000ull, { 17, 22, 19, 0, 0 }, 0x40, 60, },
-  { 101, 5, 1, 0x1c000000000ull, 0x1f000000000ull, { 17, 19, 20, 18, 0 }, 0x0, 61, },
-  { 102, 5, 0, 0x20000000ull, 0x1eff8000000ull, { 49, 50, 0, 0, 0 }, 0x0, 1906, },
-  { 102, 5, 0, 0x20000000ull, 0x1eff8000000ull, { 49, 50, 0, 0, 0 }, 0x40, 62, },
-  { 103, 5, 1, 0x14008000000ull, 0x1fff8000000ull, { 17, 19, 18, 0, 0 }, 0x40, 1909, },
-  { 104, 5, 1, 0x1a0000000ull, 0x1e3f8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 64, },
-  { 105, 5, 1, 0x1e0000000ull, 0x1e3f8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1743, },
-  { 106, 3, 0, 0x100000000ull, 0x1eff8000000ull, { 0, 0, 0, 0, 0 }, 0x0, 65, },
-  { 108, 5, 1, 0x178000000ull, 0x1e3f8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 66, },
-  { 113, 3, 1, 0x8708000000ull, 0x1ffc8000000ull, { 23, 18, 0, 0, 0 }, 0x0, 2206, },
-  { 122, 3, 0, 0x80000000ull, 0x1eff8000000ull, { 0, 0, 0, 0, 0 }, 0x0, 67, },
-  { 122, 3, 0, 0x90000000ull, 0x1eff8000000ull, { 23, 0, 0, 0, 0 }, 0x0, 743, },
-  { 122, 3, 0, 0x98000000ull, 0x1eff8000000ull, { 17, 0, 0, 0, 0 }, 0x0, 744, },
-  { 123, 3, 0, 0x2170000000ull, 0x1eff8000000ull, { 24, 0, 0, 0, 0 }, 0xc, 669, },
-  { 124, 3, 1, 0x2070000000ull, 0x1eff8000000ull, { 29, 24, 0, 0, 0 }, 0x8, 670, },
-  { 124, 3, 1, 0x2078000000ull, 0x1eff8000000ull, { 30, 24, 0, 0, 0 }, 0x8, 910, },
-  { 126, 3, 1, 0x8000000000ull, 0x1fff8000000ull, { 23, 32, 0, 0, 0 }, 0x0, 68, },
-  { 126, 3, 1, 0x9000000000ull, 0x1fff8000000ull, { 23, 32, 24, 0, 0 }, 0x0, 69, },
-  { 126, 3, 1, 0xa000000000ull, 0x1eff0000000ull, { 23, 32, 61, 0, 0 }, 0x0, 70, },
-  { 127, 3, 1, 0x8040000000ull, 0x1fff8000000ull, { 23, 32, 0, 0, 0 }, 0x0, 71, },
-  { 127, 3, 1, 0x9040000000ull, 0x1fff8000000ull, { 23, 32, 24, 0, 0 }, 0x0, 72, },
-  { 127, 3, 1, 0xa040000000ull, 0x1eff0000000ull, { 23, 32, 61, 0, 0 }, 0x0, 73, },
-  { 128, 3, 1, 0x8080000000ull, 0x1fff8000000ull, { 23, 32, 0, 0, 0 }, 0x0, 74, },
-  { 128, 3, 1, 0x9080000000ull, 0x1fff8000000ull, { 23, 32, 24, 0, 0 }, 0x0, 75, },
-  { 128, 3, 1, 0xa080000000ull, 0x1eff0000000ull, { 23, 32, 61, 0, 0 }, 0x0, 76, },
-  { 129, 3, 1, 0x80c0000000ull, 0x1fff8000000ull, { 23, 32, 0, 0, 0 }, 0x0, 77, },
-  { 129, 3, 1, 0x90c0000000ull, 0x1fff8000000ull, { 23, 32, 24, 0, 0 }, 0x0, 78, },
-  { 129, 3, 1, 0xa0c0000000ull, 0x1eff0000000ull, { 23, 32, 61, 0, 0 }, 0x0, 79, },
-  { 130, 3, 1, 0xc6c0000000ull, 0x1fff8000000ull, { 17, 32, 0, 0, 0 }, 0x0, 852, },
-  { 130, 3, 1, 0xd6c0000000ull, 0x1fff8000000ull, { 17, 32, 24, 0, 0 }, 0x0, 853, },
-  { 130, 3, 1, 0xe6c0000000ull, 0x1eff0000000ull, { 17, 32, 61, 0, 0 }, 0x0, 854, },
-  { 131, 3, 1, 0xc040000000ull, 0x1fff8000000ull, { 17, 32, 0, 0, 0 }, 0x0, 80, },
-  { 131, 3, 1, 0xd040000000ull, 0x1fff8000000ull, { 17, 32, 24, 0, 0 }, 0x0, 81, },
-  { 131, 3, 1, 0xe040000000ull, 0x1eff0000000ull, { 17, 32, 61, 0, 0 }, 0x0, 82, },
-  { 132, 3, 1, 0xc0c0000000ull, 0x1fff8000000ull, { 17, 32, 0, 0, 0 }, 0x0, 83, },
-  { 132, 3, 1, 0xd0c0000000ull, 0x1fff8000000ull, { 17, 32, 24, 0, 0 }, 0x0, 84, },
-  { 132, 3, 1, 0xe0c0000000ull, 0x1eff0000000ull, { 17, 32, 61, 0, 0 }, 0x0, 85, },
-  { 133, 3, 1, 0xc000000000ull, 0x1fff8000000ull, { 17, 32, 0, 0, 0 }, 0x0, 86, },
-  { 133, 3, 1, 0xd000000000ull, 0x1fff8000000ull, { 17, 32, 24, 0, 0 }, 0x0, 87, },
-  { 133, 3, 1, 0xe000000000ull, 0x1eff0000000ull, { 17, 32, 61, 0, 0 }, 0x0, 88, },
-  { 134, 3, 2, 0xc048000000ull, 0x1fff8000000ull, { 17, 18, 32, 0, 0 }, 0x0, 89, },
-  { 134, 3, 2, 0xd048000000ull, 0x1fff8000000ull, { 17, 18, 32, 5, 0 }, 0x0, 90, },
-  { 135, 3, 2, 0xc0c8000000ull, 0x1fff8000000ull, { 17, 18, 32, 0, 0 }, 0x0, 91, },
-  { 135, 3, 2, 0xd0c8000000ull, 0x1fff8000000ull, { 17, 18, 32, 5, 0 }, 0x0, 92, },
-  { 136, 3, 2, 0xc088000000ull, 0x1fff8000000ull, { 17, 18, 32, 0, 0 }, 0x0, 93, },
-  { 136, 3, 2, 0xd088000000ull, 0x1fff8000000ull, { 17, 18, 32, 4, 0 }, 0x0, 94, },
-  { 137, 3, 1, 0xc080000000ull, 0x1fff8000000ull, { 17, 32, 0, 0, 0 }, 0x0, 95, },
-  { 137, 3, 1, 0xd080000000ull, 0x1fff8000000ull, { 17, 32, 24, 0, 0 }, 0x0, 96, },
-  { 137, 3, 1, 0xe080000000ull, 0x1eff0000000ull, { 17, 32, 61, 0, 0 }, 0x0, 97, },
-  { 140, 3, 0, 0xcb00000000ull, 0x1fff8000000ull, { 32, 0, 0, 0, 0 }, 0x0, 98, },
-  { 140, 3, 0, 0xdb00000000ull, 0x1fff8000000ull, { 32, 24, 0, 0, 0 }, 0x0, 99, },
-  { 140, 3, 0, 0xeb00000000ull, 0x1eff0000000ull, { 32, 61, 0, 0, 0 }, 0x0, 100, },
-  { 141, 3, 0, 0x50000000ull, 0x1eff8000000ull, { 0, 0, 0, 0, 0 }, 0x21, 101, },
-  { 149, 3, 0, 0x110000000ull, 0x1eff8000000ull, { 0, 0, 0, 0, 0 }, 0x0, 102, },
-  { 150, 2, 1, 0xe880000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 1744, },
-  { 151, 2, 1, 0xea80000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 1745, },
-  { 152, 2, 1, 0xf880000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 1746, },
-  { 153, 1, 1, 0x10800000000ull, 0x1fff80fe000ull, { 23, 25, 0, 0, 0 }, 0x0, 103, },
-  { 153, 1, 1, 0x10800000000ull, 0x1ee07f00000ull, { 23, 62, 0, 0, 0 }, 0x40, 104, },
-  { 153, 1, 1, 0x12000000000ull, 0x1e000300000ull, { 23, 65, 0, 0, 0 }, 0x40, 105, },
-  { 153, 5, 1, 0x80000000ull, 0x1e3f8000000ull, { 17, 19, 0, 0, 0 }, 0xc0, 106, },
-  { 153, 2, 1, 0xe00100000ull, 0x1ee00f00000ull, { 14, 24, 0, 0, 0 }, 0x40, 107, },
-  { 153, 2, 1, 0xe00000000ull, 0x1ee00f00000ull, { 14, 24, 77, 0, 0 }, 0x0, 2280, },
-  { 153, 2, 1, 0x188000000ull, 0x1eff8000000ull, { 23, 15, 0, 0, 0 }, 0x0, 109, },
-  { 153, 2, 1, 0x600000000ull, 0x1ee00000000ull, { 8, 24, 63, 0, 0 }, 0x0, 110, },
-  { 153, 2, 1, 0x400000000ull, 0x1ee00000000ull, { 9, 67, 0, 0, 0 }, 0x0, 111, },
-  { 153, 2, 1, 0x180000000ull, 0x1eff8000000ull, { 23, 7, 0, 0, 0 }, 0x0, 112, },
-  { 153, 2, 1, 0x198000000ull, 0x1eff8000000ull, { 23, 8, 0, 0, 0 }, 0x0, 113, },
-  { 153, 2, 1, 0x150000000ull, 0x1eff8000000ull, { 13, 24, 0, 0, 0 }, 0x0, 911, },
-  { 153, 2, 1, 0x50000000ull, 0x1eff8000000ull, { 13, 54, 0, 0, 0 }, 0x0, 912, },
-  { 153, 2, 1, 0x190000000ull, 0x1eff8000000ull, { 23, 13, 0, 0, 0 }, 0x0, 913, },
-  { 153, 3, 1, 0x140000000ull, 0x1eff8000000ull, { 13, 54, 0, 0, 0 }, 0x0, 991, },
-  { 153, 3, 1, 0x2150000000ull, 0x1eff8000000ull, { 13, 24, 0, 0, 0 }, 0x0, 992, },
-  { 153, 3, 1, 0x2110000000ull, 0x1eff8000000ull, { 23, 13, 0, 0, 0 }, 0x0, 993, },
-  { 153, 3, 1, 0x2160000000ull, 0x1eff8000000ull, { 16, 24, 0, 0, 0 }, 0x8, 114, },
-  { 153, 3, 1, 0x2120000000ull, 0x1eff8000000ull, { 23, 16, 0, 0, 0 }, 0x8, 115, },
-  { 153, 3, 1, 0x2168000000ull, 0x1eff8000000ull, { 11, 24, 0, 0, 0 }, 0x8, 116, },
-  { 153, 3, 1, 0x2148000000ull, 0x1eff8000000ull, { 12, 24, 0, 0, 0 }, 0x0, 117, },
-  { 153, 3, 1, 0x2128000000ull, 0x1eff8000000ull, { 23, 10, 0, 0, 0 }, 0x8, 118, },
-  { 153, 3, 1, 0x2108000000ull, 0x1eff8000000ull, { 23, 12, 0, 0, 0 }, 0x0, 119, },
-  { 153, 3, 1, 0x2000000000ull, 0x1eff8000000ull, { 37, 24, 0, 0, 0 }, 0x8, 120, },
-  { 153, 3, 1, 0x2008000000ull, 0x1eff8000000ull, { 28, 24, 0, 0, 0 }, 0x8, 121, },
-  { 153, 3, 1, 0x2010000000ull, 0x1eff8000000ull, { 31, 24, 0, 0, 0 }, 0x8, 122, },
-  { 153, 3, 1, 0x2018000000ull, 0x1eff8000000ull, { 34, 24, 0, 0, 0 }, 0x8, 123, },
-  { 153, 3, 1, 0x2020000000ull, 0x1eff8000000ull, { 35, 24, 0, 0, 0 }, 0x8, 124, },
-  { 153, 3, 1, 0x2028000000ull, 0x1eff8000000ull, { 36, 24, 0, 0, 0 }, 0x8, 125, },
-  { 153, 3, 1, 0x2030000000ull, 0x1eff8000000ull, { 33, 24, 0, 0, 0 }, 0x8, 126, },
-  { 153, 3, 1, 0x2080000000ull, 0x1eff8000000ull, { 23, 37, 0, 0, 0 }, 0x8, 127, },
-  { 153, 3, 1, 0x2088000000ull, 0x1eff8000000ull, { 23, 28, 0, 0, 0 }, 0x8, 128, },
-  { 153, 3, 1, 0x2090000000ull, 0x1eff8000000ull, { 23, 31, 0, 0, 0 }, 0x8, 129, },
-  { 153, 3, 1, 0x2098000000ull, 0x1eff8000000ull, { 23, 34, 0, 0, 0 }, 0x8, 130, },
-  { 153, 3, 1, 0x20a0000000ull, 0x1eff8000000ull, { 23, 35, 0, 0, 0 }, 0x8, 131, },
-  { 153, 3, 1, 0x20a8000000ull, 0x1eff8000000ull, { 23, 36, 0, 0, 0 }, 0x0, 132, },
-  { 153, 3, 1, 0x20b0000000ull, 0x1eff8000000ull, { 23, 33, 0, 0, 0 }, 0x8, 133, },
-  { 153, 3, 1, 0x20b8000000ull, 0x1eff8000000ull, { 23, 27, 0, 0, 0 }, 0x0, 134, },
-  { 153, 7, 1, 0x0ull, 0x0ull, { 23, 13, 0, 0, 0 }, 0x0, 135, },
-  { 153, 7, 1, 0x0ull, 0x0ull, { 13, 54, 0, 0, 0 }, 0x0, 136, },
-  { 153, 7, 1, 0x0ull, 0x0ull, { 13, 24, 0, 0, 0 }, 0x0, 137, },
-  { 154, 6, 1, 0xc000000000ull, 0x1e000100000ull, { 23, 69, 0, 0, 0 }, 0x0, 138, },
-  { 155, 2, 1, 0xeca0000000ull, 0x1fff0000000ull, { 23, 24, 73, 0, 0 }, 0x0, 139, },
-  { 156, 2, 1, 0xeea0000000ull, 0x1fff0000000ull, { 23, 24, 74, 0, 0 }, 0x0, 140, },
-  { 166, 4, 0, 0x4000000000ull, 0x1e1f8000000ull, { 64, 0, 0, 0, 0 }, 0x0, 362, },
-  { 166, 5, 0, 0x8000000ull, 0x1e3f8000000ull, { 64, 0, 0, 0, 0 }, 0x0, 775, },
-  { 166, 2, 0, 0x8000000ull, 0x1eff8000000ull, { 64, 0, 0, 0, 0 }, 0x2, 914, },
-  { 166, 3, 0, 0x8000000ull, 0x1eff8000000ull, { 64, 0, 0, 0, 0 }, 0x0, 994, },
-  { 166, 6, 0, 0x8000000ull, 0x1eff8000000ull, { 68, 0, 0, 0, 0 }, 0x0, 2396, },
-  { 166, 7, 0, 0x0ull, 0x0ull, { 64, 0, 0, 0, 0 }, 0x0, 141, },
-  { 173, 1, 1, 0x10070000000ull, 0x1eff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 142, },
-  { 173, 1, 1, 0x10170000000ull, 0x1eff8000000ull, { 23, 54, 25, 0, 0 }, 0x0, 143, },
-  { 176, 2, 1, 0xea00000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 2379, },
-  { 177, 2, 1, 0xf820000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 2282, },
-  { 178, 1, 1, 0x10400000000ull, 0x1fff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 144, },
-  { 179, 1, 1, 0x10600000000ull, 0x1fff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 145, },
-  { 180, 1, 1, 0x11400000000ull, 0x1fff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 146, },
-  { 181, 1, 1, 0x10450000000ull, 0x1fff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 147, },
-  { 182, 1, 1, 0x10650000000ull, 0x1fff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 148, },
-  { 183, 1, 1, 0x10470000000ull, 0x1fff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 149, },
-  { 184, 1, 1, 0x10670000000ull, 0x1fff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 150, },
-  { 185, 1, 1, 0x10520000000ull, 0x1fff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 762, },
-  { 186, 1, 1, 0x10720000000ull, 0x1fff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 763, },
-  { 187, 1, 1, 0x11520000000ull, 0x1fff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 764, },
-  { 188, 2, 1, 0xe850000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 2296, },
-  { 189, 2, 1, 0xea70000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 151, },
-  { 190, 2, 1, 0xe810000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 2297, },
-  { 191, 2, 1, 0xea30000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 152, },
-  { 192, 2, 1, 0xead0000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 1747, },
-  { 193, 2, 1, 0xe230000000ull, 0x1ff30000000ull, { 23, 24, 25, 41, 0 }, 0x0, 153, },
-  { 194, 2, 1, 0xe690000000ull, 0x1fff0000000ull, { 23, 25, 0, 0, 0 }, 0x0, 154, },
-  { 196, 3, 1, 0x21c0000000ull, 0x1eff8000000ull, { 23, 25, 24, 0, 0 }, 0x0, 1748, },
-  { 196, 3, 1, 0x20c0000000ull, 0x1eff8000000ull, { 23, 25, 48, 0, 0 }, 0x0, 1749, },
-  { 196, 3, 0, 0x2188000000ull, 0x1eff8000000ull, { 25, 48, 0, 0, 0 }, 0x0, 1771, },
-  { 197, 2, 1, 0xe8b0000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 155, },
-  { 198, 2, 1, 0xe240000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 156, },
-  { 198, 2, 1, 0xee50000000ull, 0x1fff0000000ull, { 23, 24, 38, 0, 0 }, 0x0, 157, },
-  { 199, 2, 1, 0xf040000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 158, },
-  { 199, 2, 1, 0xfc50000000ull, 0x1fff0000000ull, { 23, 24, 38, 0, 0 }, 0x0, 159, },
-  { 200, 1, 1, 0x10680000000ull, 0x1ffe0000000ull, { 23, 24, 40, 25, 0 }, 0x0, 160, },
-  { 201, 2, 1, 0xe220000000ull, 0x1fff0000000ull, { 23, 25, 24, 0, 0 }, 0x0, 161, },
-  { 201, 2, 1, 0xe630000000ull, 0x1fff0000000ull, { 23, 25, 42, 0, 0 }, 0x0, 162, },
-  { 202, 2, 1, 0xf020000000ull, 0x1fff0000000ull, { 23, 25, 24, 0, 0 }, 0x0, 163, },
-  { 202, 2, 1, 0xf430000000ull, 0x1fff0000000ull, { 23, 25, 42, 0, 0 }, 0x0, 164, },
-  { 203, 1, 1, 0x106c0000000ull, 0x1ffe0000000ull, { 23, 24, 40, 25, 0 }, 0x0, 165, },
-  { 204, 1, 1, 0x10420000000ull, 0x1fff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 166, },
-  { 205, 1, 1, 0x10620000000ull, 0x1fff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 167, },
-  { 206, 1, 1, 0x11420000000ull, 0x1fff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 168, },
-  { 207, 3, 0, 0x2048000000ull, 0x1eff8000000ull, { 25, 24, 0, 0, 0 }, 0x8, 942, },
-  { 207, 3, 0, 0x2050000000ull, 0x1eff8000000ull, { 25, 24, 0, 0, 0 }, 0xc, 863, },
-  { 207, 3, 0, 0x21a0000000ull, 0x1eff8000000ull, { 25, 0, 0, 0, 0 }, 0x8, 745, },
-  { 208, 3, 0, 0x2060000000ull, 0x1eff8000000ull, { 25, 24, 0, 0, 0 }, 0x8, 671, },
-  { 213, 4, 0, 0x40000000ull, 0x1e1f8000000ull, { 0, 0, 0, 0, 0 }, 0x22c, 169, },
-  { 214, 3, 0, 0x38000000ull, 0x1ee78000000ull, { 66, 0, 0, 0, 0 }, 0x8, 170, },
-  { 215, 3, 0, 0x28000000ull, 0x1ee78000000ull, { 66, 0, 0, 0, 0 }, 0x0, 171, },
-  { 224, 3, 1, 0xc708000000ull, 0x1ffc8000000ull, { 17, 24, 0, 0, 0 }, 0x0, 2207, },
-  { 225, 2, 1, 0xa600000000ull, 0x1ee04000000ull, { 23, 24, 44, 0, 0 }, 0x140, 172, },
-  { 225, 2, 1, 0xf240000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 173, },
-  { 226, 1, 1, 0x10080000000ull, 0x1efe0000000ull, { 23, 24, 39, 25, 0 }, 0x0, 174, },
-  { 227, 1, 1, 0x100c0000000ull, 0x1efe0000000ull, { 23, 24, 39, 25, 0 }, 0x0, 175, },
-  { 228, 2, 1, 0xa400000000ull, 0x1ee00002000ull, { 23, 25, 75, 0, 0 }, 0x140, 2303, },
-  { 228, 2, 1, 0xf220000000ull, 0x1fff0000000ull, { 23, 25, 24, 0, 0 }, 0x0, 177, },
-  { 229, 2, 1, 0xac00000000ull, 0x1ee00000000ull, { 23, 24, 25, 43, 0 }, 0x0, 178, },
-  { 234, 3, 0, 0x180000000ull, 0x1eff8000000ull, { 0, 0, 0, 0, 0 }, 0x0, 673, },
-  { 235, 3, 0, 0x30000000ull, 0x1ee78000000ull, { 66, 0, 0, 0, 0 }, 0x8, 179, },
-  { 237, 3, 1, 0x8c00000000ull, 0x1fff8000000ull, { 32, 24, 0, 0, 0 }, 0x0, 180, },
-  { 237, 3, 1, 0xac00000000ull, 0x1eff0000000ull, { 32, 24, 60, 0, 0 }, 0x0, 181, },
-  { 238, 3, 1, 0x8c40000000ull, 0x1fff8000000ull, { 32, 24, 0, 0, 0 }, 0x0, 182, },
-  { 238, 3, 1, 0xac40000000ull, 0x1eff0000000ull, { 32, 24, 60, 0, 0 }, 0x0, 183, },
-  { 239, 3, 1, 0x8c80000000ull, 0x1fff8000000ull, { 32, 24, 0, 0, 0 }, 0x0, 184, },
-  { 239, 3, 1, 0xac80000000ull, 0x1eff0000000ull, { 32, 24, 60, 0, 0 }, 0x0, 185, },
-  { 240, 3, 1, 0x8cc0000000ull, 0x1fff8000000ull, { 32, 24, 0, 0, 0 }, 0x0, 186, },
-  { 240, 3, 1, 0xacc0000000ull, 0x1eff0000000ull, { 32, 24, 60, 0, 0 }, 0x0, 187, },
-  { 241, 3, 1, 0xcec0000000ull, 0x1fff8000000ull, { 32, 18, 0, 0, 0 }, 0x0, 2210, },
-  { 241, 3, 1, 0xeec0000000ull, 0x1eff0000000ull, { 32, 18, 60, 0, 0 }, 0x0, 2211, },
-  { 242, 3, 1, 0xcc40000000ull, 0x1fff8000000ull, { 32, 18, 0, 0, 0 }, 0x0, 188, },
-  { 242, 3, 1, 0xec40000000ull, 0x1eff0000000ull, { 32, 18, 60, 0, 0 }, 0x0, 189, },
-  { 243, 3, 1, 0xccc0000000ull, 0x1fff8000000ull, { 32, 18, 0, 0, 0 }, 0x0, 190, },
-  { 243, 3, 1, 0xecc0000000ull, 0x1eff0000000ull, { 32, 18, 60, 0, 0 }, 0x0, 191, },
-  { 244, 3, 1, 0xcc00000000ull, 0x1fff8000000ull, { 32, 18, 0, 0, 0 }, 0x0, 192, },
-  { 244, 3, 1, 0xec00000000ull, 0x1eff0000000ull, { 32, 18, 60, 0, 0 }, 0x0, 193, },
-  { 245, 3, 1, 0xcc80000000ull, 0x1fff8000000ull, { 32, 18, 0, 0, 0 }, 0x0, 194, },
-  { 245, 3, 1, 0xec80000000ull, 0x1eff0000000ull, { 32, 18, 60, 0, 0 }, 0x0, 195, },
-  { 246, 1, 1, 0x10028000000ull, 0x1eff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 196, },
-  { 246, 1, 1, 0x10020000000ull, 0x1eff8000000ull, { 23, 24, 25, 3, 0 }, 0x0, 197, },
-  { 246, 1, 1, 0x10128000000ull, 0x1eff8000000ull, { 23, 54, 25, 0, 0 }, 0x0, 198, },
-  { 247, 3, 0, 0x20000000ull, 0x1ee78000000ull, { 66, 0, 0, 0, 0 }, 0x0, 199, },
-  { 248, 2, 1, 0xa0000000ull, 0x1eff8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 200, },
-  { 249, 2, 1, 0xa8000000ull, 0x1eff8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 201, },
-  { 250, 2, 1, 0xb0000000ull, 0x1eff8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 202, },
-  { 251, 3, 0, 0x198000000ull, 0x1eff8000000ull, { 0, 0, 0, 0, 0 }, 0x0, 917, },
-  { 252, 3, 1, 0x20f8000000ull, 0x1eff8000000ull, { 23, 25, 0, 0, 0 }, 0x8, 203, },
-  { 253, 2, 2, 0xa000000000ull, 0x1fe00003000ull, { 21, 22, 25, 75, 0 }, 0x0, 2401, },
-  { 253, 2, 2, 0xa000000000ull, 0x1fe00003000ull, { 22, 21, 25, 75, 0 }, 0x40, 1672, },
-  { 254, 3, 1, 0x20d0000000ull, 0x1eff8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 204, },
-  { 255, 2, 2, 0xa000002000ull, 0x1fe00003000ull, { 21, 22, 25, 0, 0 }, 0x0, 2403, },
-  { 255, 2, 2, 0xa000002000ull, 0x1fe00003000ull, { 22, 21, 25, 0, 0 }, 0x40, 1674, },
-  { 256, 3, 1, 0x20f0000000ull, 0x1eff8000000ull, { 23, 25, 0, 0, 0 }, 0x8, 205, },
-  { 258, 3, 1, 0x20d8000000ull, 0x1eff8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 206, },
-  { 262, 2, 1, 0xe840000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 900, },
-  { 263, 2, 1, 0xea40000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 901, },
-  { 264, 2, 1, 0xf840000000ull, 0x1fff0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 902, },
-  { 272, 3, 1, 0x8208000000ull, 0x1fff8000000ull, { 23, 32, 24, 0, 0 }, 0x0, 207, },
-  { 273, 3, 1, 0x8248000000ull, 0x1fff8000000ull, { 23, 32, 24, 0, 0 }, 0x0, 208, },
-  { 274, 3, 1, 0x8288000000ull, 0x1fff8000000ull, { 23, 32, 24, 0, 0 }, 0x0, 209, },
-  { 275, 3, 1, 0x82c8000000ull, 0x1fff8000000ull, { 23, 32, 24, 0, 0 }, 0x0, 210, },
-  { 277, 5, 1, 0x1d000000000ull, 0x1fc00000000ull, { 17, 19, 20, 18, 0 }, 0x0, 946, },
-  { 277, 5, 1, 0x1d000000000ull, 0x1fc00000000ull, { 17, 19, 20, 18, 0 }, 0x40, 986, },
-  { 278, 5, 1, 0x1d000000000ull, 0x1fc000fe000ull, { 17, 19, 20, 0, 0 }, 0x40, 947, },
-  { 279, 1, 1, 0x10078000000ull, 0x1eff8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 211, },
-  { 279, 1, 1, 0x10178000000ull, 0x1eff8000000ull, { 23, 54, 25, 0, 0 }, 0x0, 212, },
-  { 282, 2, 1, 0x80000000ull, 0x1eff8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 213, },
-  { 283, 2, 1, 0x88000000ull, 0x1eff8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 214, },
-  { 284, 2, 1, 0x90000000ull, 0x1eff8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 215, },
+  { 5, 1, 1, 0x00000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 0, },
+  { 5, 1, 1, 0x08000000ull, 0xf8000000ull, { 23, 24, 25, 3, 0 }, 0x0, 1, },
+  { 5, 7, 1, 0x00000000ull, 0x00000000ull, { 23, 65, 25, 0, 0 }, 0x0, 2, },
+  { 6, 1, 1, 0x00000000ull, 0x00000000ull, { 23, 65, 26, 0, 0 }, 0x0, 3, },
+  { 7, 1, 1, 0x40000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 4, },
+  { 7, 1, 1, 0x00000000ull, 0x00000000ull, { 23, 62, 25, 0, 0 }, 0x0, 5, },
+  { 8, 1, 1, 0x00000000ull, 0x00000000ull, { 23, 62, 25, 0, 0 }, 0x0, 6, },
+  { 9, 3, 1, 0x00000000ull, 0x00000000ull, { 23, 2, 51, 52, 53 }, 0x221, 7, },
+  { 10, 1, 1, 0x60000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 8, },
+  { 10, 1, 1, 0x60000000ull, 0xf8000000ull, { 23, 54, 25, 0, 0 }, 0x0, 9, },
+  { 11, 1, 1, 0x68000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 10, },
+  { 11, 1, 1, 0x68000000ull, 0xf8000000ull, { 23, 54, 25, 0, 0 }, 0x0, 11, },
+  { 14, 4, 0, 0x00000000ull, 0xf80011ffull, { 15, 0, 0, 0, 0 }, 0x40, 781, },
+  { 14, 4, 0, 0x00000000ull, 0xf80011c0ull, { 15, 0, 0, 0, 0 }, 0x0, 647, },
+  { 14, 4, 0, 0x00000000ull, 0xf80011c0ull, { 15, 0, 0, 0, 0 }, 0x40, 648, },
+  { 14, 4, 0, 0x08000100ull, 0xf80011c0ull, { 15, 0, 0, 0, 0 }, 0x200, 1770, },
+  { 14, 4, 0, 0x08000100ull, 0xf80011c0ull, { 15, 0, 0, 0, 0 }, 0x240, 1771, },
+  { 14, 4, 1, 0x00000000ull, 0x00001000ull, { 14, 15, 0, 0, 0 }, 0x0, 404, },
+  { 14, 4, 1, 0x00000000ull, 0x00001000ull, { 14, 15, 0, 0, 0 }, 0x40, 405, },
+  { 14, 4, 0, 0x00000000ull, 0x000011ffull, { 80, 0, 0, 0, 0 }, 0x40, 802, },
+  { 14, 4, 0, 0x00000000ull, 0x000011c0ull, { 80, 0, 0, 0, 0 }, 0x0, 649, },
+  { 14, 4, 0, 0x00000000ull, 0x000011c0ull, { 80, 0, 0, 0, 0 }, 0x40, 650, },
+  { 14, 4, 0, 0x00000080ull, 0x000011c0ull, { 80, 0, 0, 0, 0 }, 0x210, 2406, },
+  { 14, 4, 0, 0x00000080ull, 0x000011c0ull, { 80, 0, 0, 0, 0 }, 0x250, 2407, },
+  { 14, 4, 0, 0x00000140ull, 0x000011c0ull, { 80, 0, 0, 0, 0 }, 0x30, 412, },
+  { 14, 4, 0, 0x00000140ull, 0x000011c0ull, { 80, 0, 0, 0, 0 }, 0x70, 413, },
+  { 14, 4, 0, 0x00000180ull, 0x000011c0ull, { 80, 0, 0, 0, 0 }, 0x230, 410, },
+  { 14, 4, 0, 0x00000180ull, 0x000011c0ull, { 80, 0, 0, 0, 0 }, 0x270, 411, },
+  { 14, 4, 1, 0x00000000ull, 0x00001000ull, { 14, 80, 0, 0, 0 }, 0x0, 406, },
+  { 14, 4, 1, 0x00000000ull, 0x00001000ull, { 14, 80, 0, 0, 0 }, 0x40, 407, },
+  { 15, 4, 0, 0x00000000ull, 0xf8000000ull, { 64, 0, 0, 0, 0 }, 0x0, 360, },
+  { 15, 5, 0, 0x00000000ull, 0xf8000000ull, { 64, 0, 0, 0, 0 }, 0x0, 773, },
+  { 15, 2, 0, 0x00000000ull, 0xf8000000ull, { 64, 0, 0, 0, 0 }, 0x2, 908, },
+  { 15, 3, 0, 0x00000000ull, 0xf8000000ull, { 64, 0, 0, 0, 0 }, 0x0, 989, },
+  { 15, 6, 0, 0x00000000ull, 0xf8000000ull, { 68, 0, 0, 0, 0 }, 0x0, 2410, },
+  { 15, 7, 0, 0x00000000ull, 0x00000000ull, { 64, 0, 0, 0, 0 }, 0x0, 14, },
+  { 16, 6, 0, 0x00000000ull, 0x000011ffull, { 81, 0, 0, 0, 0 }, 0x40, 835, },
+  { 16, 6, 0, 0x00000000ull, 0x000011c0ull, { 81, 0, 0, 0, 0 }, 0x0, 651, },
+  { 16, 6, 0, 0x00000000ull, 0x000011c0ull, { 81, 0, 0, 0, 0 }, 0x40, 652, },
+  { 16, 6, 1, 0x00000000ull, 0x00001000ull, { 14, 81, 0, 0, 0 }, 0x0, 408, },
+  { 16, 6, 1, 0x00000000ull, 0x00001000ull, { 14, 81, 0, 0, 0 }, 0x40, 409, },
+  { 17, 4, 0, 0x80000000ull, 0xf8000018ull, { 15, 76, 0, 0, 0 }, 0x20, 2292, },
+  { 17, 4, 0, 0x00000000ull, 0x00000018ull, { 80, 76, 0, 0, 0 }, 0x20, 2293, },
+  { 18, 4, 0, 0x60000000ull, 0xf8000000ull, { 0, 0, 0, 0, 0 }, 0x2c, 215, },
+  { 22, 2, 0, 0x00000000ull, 0x00000000ull, { 24, 79, 0, 0, 0 }, 0x0, 1775, },
+  { 22, 3, 0, 0x00000000ull, 0x00000000ull, { 23, 80, 0, 0, 0 }, 0x0, 217, },
+  { 22, 3, 0, 0x00000000ull, 0x00000000ull, { 17, 80, 0, 0, 0 }, 0x0, 218, },
+  { 22, 3, 0, 0x00000000ull, 0x00000000ull, { 24, 79, 0, 0, 0 }, 0x0, 1776, },
+  { 22, 3, 0, 0x00000000ull, 0x00000000ull, { 18, 79, 0, 0, 0 }, 0x0, 1777, },
+  { 22, 7, 0, 0x00000000ull, 0x00000000ull, { 24, 79, 0, 0, 0 }, 0x0, 1778, },
+  { 25, 4, 0, 0x20000000ull, 0xf8000000ull, { 0, 0, 0, 0, 0 }, 0x224, 16, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 24, 25, 0 }, 0x0, 969, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 25, 24, 0 }, 0x0, 949, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 25, 24, 0 }, 0x0, 881, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 24, 25, 0 }, 0x0, 864, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 24, 25, 0 }, 0x40, 1097, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 6, 25, 0 }, 0x0, 882, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 6, 25, 0 }, 0x40, 951, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 54, 25, 0 }, 0x0, 972, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 56, 25, 0 }, 0x0, 952, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 56, 25, 0 }, 0x0, 884, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 54, 25, 0 }, 0x0, 867, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 54, 25, 0 }, 0x40, 1100, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 58, 25, 0 }, 0x0, 964, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 58, 25, 0 }, 0x0, 898, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 24, 25, 0 }, 0x40, 1101, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 6, 25, 0 }, 0x40, 953, },
+  { 26, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 54, 25, 0 }, 0x40, 1102, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 24, 25, 0 }, 0x0, 974, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 25, 24, 0 }, 0x0, 954, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 25, 24, 0 }, 0x0, 886, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 24, 25, 0 }, 0x0, 869, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 24, 25, 0 }, 0x40, 1105, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 6, 25, 0 }, 0x0, 887, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 6, 25, 0 }, 0x40, 956, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 54, 25, 0 }, 0x0, 977, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 56, 25, 0 }, 0x0, 957, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 56, 25, 0 }, 0x0, 889, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 54, 25, 0 }, 0x0, 872, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 54, 25, 0 }, 0x40, 1108, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 55, 25, 0 }, 0x0, 986, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 57, 25, 0 }, 0x0, 966, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 57, 25, 0 }, 0x0, 900, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 55, 25, 0 }, 0x0, 880, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 24, 25, 0 }, 0x40, 1109, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 6, 25, 0 }, 0x40, 958, },
+  { 27, 1, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 54, 25, 0 }, 0x40, 1110, },
+  { 28, 3, 1, 0x08000000ull, 0xf8000000ull, { 23, 32, 24, 1, 0 }, 0x0, 250, },
+  { 29, 3, 1, 0x48000000ull, 0xf8000000ull, { 23, 32, 24, 1, 0 }, 0x0, 251, },
+  { 30, 3, 1, 0x88000000ull, 0xf8000000ull, { 23, 32, 24, 1, 0 }, 0x0, 252, },
+  { 31, 3, 1, 0xc8000000ull, 0xf8000000ull, { 23, 32, 24, 1, 0 }, 0x0, 253, },
+  { 33, 4, 0, 0x10000000ull, 0xf8000000ull, { 0, 0, 0, 0, 0 }, 0x224, 17, },
+  { 35, 2, 1, 0xc0000000ull, 0xf8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 935, },
+  { 36, 2, 1, 0xc8000000ull, 0xf8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 936, },
+  { 38, 2, 1, 0x00000000ull, 0x00000000ull, { 23, 24, 25, 46, 71 }, 0x0, 18, },
+  { 38, 2, 1, 0x00000000ull, 0x04000000ull, { 23, 24, 44, 72, 0 }, 0x0, 2414, },
+  { 38, 2, 1, 0x04000000ull, 0x04000000ull, { 23, 54, 44, 72, 0 }, 0x0, 2415, },
+  { 38, 2, 1, 0x00000000ull, 0x00000000ull, { 23, 47, 25, 45, 72 }, 0x0, 19, },
+  { 42, 4, 0, 0x80000000ull, 0xf8000000ull, { 0, 0, 0, 0, 0 }, 0x20, 20, },
+  { 47, 2, 1, 0x00000000ull, 0x00002000ull, { 23, 25, 75, 72, 0 }, 0x0, 2310, },
+  { 49, 5, 1, 0x80000000ull, 0xf80fe000ull, { 17, 19, 0, 0, 0 }, 0x40, 22, },
+  { 50, 5, 1, 0x08000000ull, 0xf8000000ull, { 17, 19, 18, 0, 0 }, 0x40, 1827, },
+  { 51, 5, 1, 0xb8000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1828, },
+  { 51, 5, 1, 0xb8000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 24, },
+  { 52, 5, 1, 0xb0000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1829, },
+  { 52, 5, 1, 0xb0000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 25, },
+  { 53, 5, 1, 0x60000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 26, },
+  { 54, 5, 1, 0x68000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 27, },
+  { 56, 3, 0, 0x80000000ull, 0xf8000000ull, { 25, 0, 0, 0, 0 }, 0x0, 28, },
+  { 57, 5, 0, 0x40000000ull, 0xf8000000ull, { 78, 0, 0, 0, 0 }, 0x0, 1830, },
+  { 57, 5, 0, 0x40000000ull, 0xf8000000ull, { 78, 0, 0, 0, 0 }, 0x40, 29, },
+  { 58, 5, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 18, 59, 0 }, 0x0, 991, },
+  { 58, 5, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 18, 59, 0 }, 0x40, 1130, },
+  { 59, 5, 0, 0x28000000ull, 0xf8000000ull, { 0, 0, 0, 0, 0 }, 0x0, 1831, },
+  { 59, 5, 0, 0x28000000ull, 0xf8000000ull, { 0, 0, 0, 0, 0 }, 0x40, 30, },
+  { 60, 5, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 18, 19, 0 }, 0x0, 757, },
+  { 60, 5, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 18, 19, 0 }, 0x40, 758, },
+  { 60, 5, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 19, 18, 0 }, 0x0, 891, },
+  { 60, 5, 2, 0x00000000ull, 0x00001000ull, { 21, 22, 19, 18, 0 }, 0x40, 892, },
+  { 60, 5, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 18, 19, 0 }, 0x0, 1111, },
+  { 60, 5, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 18, 19, 0 }, 0x40, 1112, },
+  { 60, 5, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 19, 18, 0 }, 0x0, 1118, },
+  { 60, 5, 2, 0x00000000ull, 0x00001000ull, { 22, 21, 19, 18, 0 }, 0x40, 1119, },
+  { 61, 5, 1, 0xc0000000ull, 0xf8000000ull, { 17, 18, 0, 0, 0 }, 0x0, 854, },
+  { 61, 5, 1, 0xc0000000ull, 0xf8000000ull, { 17, 18, 0, 0, 0 }, 0x40, 855, },
+  { 61, 5, 1, 0xe0000000ull, 0xf8000000ull, { 17, 18, 0, 0, 0 }, 0x0, 2412, },
+  { 61, 5, 1, 0x08000000ull, 0xf80fe000ull, { 17, 19, 0, 0, 0 }, 0x40, 2413, },
+  { 62, 3, 1, 0x88000000ull, 0xf8000000ull, { 23, 32, 70, 0, 0 }, 0x0, 254, },
+  { 63, 3, 1, 0xc8000000ull, 0xf8000000ull, { 23, 32, 70, 0, 0 }, 0x0, 255, },
+  { 66, 3, 0, 0x60000000ull, 0xf8000000ull, { 0, 0, 0, 0, 0 }, 0x21, 31, },
+  { 67, 5, 1, 0x00000000ull, 0x00000000ull, { 17, 19, 20, 18, 0 }, 0x0, 1865, },
+  { 67, 5, 1, 0x00000000ull, 0x00000000ull, { 17, 19, 20, 18, 0 }, 0x40, 32, },
+  { 68, 5, 1, 0xa8000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1866, },
+  { 68, 5, 1, 0xa8000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 33, },
+  { 69, 5, 1, 0x80000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1783, },
+  { 70, 5, 1, 0xa0000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1867, },
+  { 70, 5, 1, 0xa0000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 34, },
+  { 71, 5, 1, 0xc8000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 968, },
+  { 72, 5, 1, 0x00000000ull, 0x000fe000ull, { 17, 19, 20, 0, 0 }, 0x40, 1870, },
+  { 73, 5, 1, 0x00000000ull, 0x00000000ull, { 17, 19, 20, 18, 0 }, 0x0, 1873, },
+  { 73, 5, 1, 0x00000000ull, 0x00000000ull, { 17, 19, 20, 18, 0 }, 0x40, 36, },
+  { 74, 5, 1, 0x88000000ull, 0xf8000000ull, { 17, 19, 0, 0, 0 }, 0xc0, 37, },
+  { 75, 5, 1, 0x88000000ull, 0xf80fe000ull, { 17, 19, 0, 0, 0 }, 0x40, 38, },
+  { 76, 5, 1, 0x00000000ull, 0x00000000ull, { 17, 19, 20, 18, 0 }, 0x0, 1876, },
+  { 76, 5, 1, 0x00000000ull, 0x00000000ull, { 17, 19, 20, 18, 0 }, 0x40, 39, },
+  { 77, 5, 1, 0x00000000ull, 0x000fe000ull, { 17, 19, 20, 0, 0 }, 0x40, 1879, },
+  { 78, 5, 1, 0x08000000ull, 0xf80fe000ull, { 17, 19, 0, 0, 0 }, 0x40, 1882, },
+  { 79, 5, 1, 0x70000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 42, },
+  { 80, 5, 1, 0x80000000ull, 0xf80fe000ull, { 17, 19, 0, 0, 0 }, 0x40, 43, },
+  { 81, 5, 1, 0x40000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 44, },
+  { 82, 5, 1, 0xb8000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1883, },
+  { 82, 5, 1, 0xb8000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 45, },
+  { 83, 5, 1, 0xb0000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1884, },
+  { 83, 5, 1, 0xb0000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 46, },
+  { 84, 5, 1, 0x80000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 759, },
+  { 84, 5, 1, 0x80000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 760, },
+  { 84, 5, 1, 0x88000000ull, 0xf8000000ull, { 17, 19, 18, 0, 0 }, 0x40, 893, },
+  { 85, 5, 1, 0xc0000000ull, 0xf8000000ull, { 17, 18, 0, 0, 0 }, 0x0, 856, },
+  { 85, 5, 1, 0xc0000000ull, 0xf8000000ull, { 17, 18, 0, 0, 0 }, 0x40, 857, },
+  { 86, 5, 1, 0x00000000ull, 0x00000000ull, { 17, 19, 20, 18, 0 }, 0x0, 1901, },
+  { 86, 5, 1, 0x00000000ull, 0x00000000ull, { 17, 19, 20, 18, 0 }, 0x40, 47, },
+  { 87, 5, 1, 0xa8000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1902, },
+  { 87, 5, 1, 0xa8000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 48, },
+  { 88, 5, 1, 0x80000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1791, },
+  { 89, 5, 1, 0xa0000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1903, },
+  { 89, 5, 1, 0xa0000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x40, 49, },
+  { 90, 5, 1, 0x00000000ull, 0x000fe000ull, { 17, 19, 20, 0, 0 }, 0x40, 1904, },
+  { 91, 5, 1, 0x00000000ull, 0x00000000ull, { 17, 19, 20, 18, 0 }, 0x0, 1905, },
+  { 91, 5, 1, 0x00000000ull, 0x00000000ull, { 17, 19, 20, 18, 0 }, 0x40, 51, },
+  { 92, 5, 1, 0x88000000ull, 0xf8000000ull, { 17, 19, 0, 0, 0 }, 0xc0, 52, },
+  { 93, 5, 1, 0x88000000ull, 0xf80fe000ull, { 17, 19, 0, 0, 0 }, 0x40, 53, },
+  { 94, 5, 1, 0x00000000ull, 0x00000000ull, { 17, 19, 20, 18, 0 }, 0x0, 1906, },
+  { 94, 5, 1, 0x00000000ull, 0x00000000ull, { 17, 19, 20, 18, 0 }, 0x40, 54, },
+  { 95, 5, 1, 0x00000000ull, 0x000fe000ull, { 17, 19, 20, 0, 0 }, 0x40, 1907, },
+  { 96, 5, 2, 0x00000000ull, 0x00000000ull, { 17, 22, 18, 19, 0 }, 0x0, 1908, },
+  { 96, 5, 2, 0x00000000ull, 0x00000000ull, { 17, 22, 18, 19, 0 }, 0x40, 56, },
+  { 97, 5, 2, 0x00000000ull, 0x00000000ull, { 17, 22, 19, 0, 0 }, 0x0, 1909, },
+  { 97, 5, 2, 0x00000000ull, 0x00000000ull, { 17, 22, 19, 0, 0 }, 0x40, 57, },
+  { 98, 5, 2, 0x00000000ull, 0x00000000ull, { 17, 22, 18, 19, 0 }, 0x0, 1910, },
+  { 98, 5, 2, 0x00000000ull, 0x00000000ull, { 17, 22, 18, 19, 0 }, 0x40, 58, },
+  { 99, 5, 2, 0x00000000ull, 0x00000000ull, { 17, 22, 19, 0, 0 }, 0x0, 1911, },
+  { 99, 5, 2, 0x00000000ull, 0x00000000ull, { 17, 22, 19, 0, 0 }, 0x40, 59, },
+  { 100, 5, 1, 0x00000000ull, 0x00000000ull, { 17, 19, 20, 18, 0 }, 0x0, 60, },
+  { 101, 5, 0, 0x20000000ull, 0xf8000000ull, { 49, 50, 0, 0, 0 }, 0x0, 1912, },
+  { 101, 5, 0, 0x20000000ull, 0xf8000000ull, { 49, 50, 0, 0, 0 }, 0x40, 61, },
+  { 102, 5, 1, 0x08000000ull, 0xf8000000ull, { 17, 19, 18, 0, 0 }, 0x40, 1915, },
+  { 103, 5, 1, 0xa0000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 63, },
+  { 104, 5, 1, 0xe0000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 1746, },
+  { 105, 3, 0, 0x00000000ull, 0xf8000000ull, { 0, 0, 0, 0, 0 }, 0x0, 64, },
+  { 107, 5, 1, 0x78000000ull, 0xf8000000ull, { 17, 18, 19, 0, 0 }, 0x0, 65, },
+  { 112, 3, 1, 0x08000000ull, 0xc8000000ull, { 23, 18, 0, 0, 0 }, 0x0, 2221, },
+  { 121, 3, 0, 0x80000000ull, 0xf8000000ull, { 0, 0, 0, 0, 0 }, 0x0, 66, },
+  { 121, 3, 0, 0x90000000ull, 0xf8000000ull, { 23, 0, 0, 0, 0 }, 0x0, 742, },
+  { 121, 3, 0, 0x98000000ull, 0xf8000000ull, { 17, 0, 0, 0, 0 }, 0x0, 743, },
+  { 122, 3, 0, 0x70000000ull, 0xf8000000ull, { 24, 0, 0, 0, 0 }, 0xc, 668, },
+  { 123, 3, 1, 0x70000000ull, 0xf8000000ull, { 29, 24, 0, 0, 0 }, 0x8, 669, },
+  { 123, 3, 1, 0x78000000ull, 0xf8000000ull, { 30, 24, 0, 0, 0 }, 0x8, 911, },
+  { 125, 3, 1, 0x00000000ull, 0xf8000000ull, { 23, 32, 0, 0, 0 }, 0x0, 67, },
+  { 125, 3, 1, 0x00000000ull, 0xf8000000ull, { 23, 32, 24, 0, 0 }, 0x400, 68, },
+  { 125, 3, 1, 0x00000000ull, 0xf0000000ull, { 23, 32, 61, 0, 0 }, 0x400, 69, },
+  { 126, 3, 1, 0x40000000ull, 0xf8000000ull, { 23, 32, 0, 0, 0 }, 0x0, 70, },
+  { 126, 3, 1, 0x40000000ull, 0xf8000000ull, { 23, 32, 24, 0, 0 }, 0x400, 71, },
+  { 126, 3, 1, 0x40000000ull, 0xf0000000ull, { 23, 32, 61, 0, 0 }, 0x400, 72, },
+  { 127, 3, 1, 0x80000000ull, 0xf8000000ull, { 23, 32, 0, 0, 0 }, 0x0, 73, },
+  { 127, 3, 1, 0x80000000ull, 0xf8000000ull, { 23, 32, 24, 0, 0 }, 0x400, 74, },
+  { 127, 3, 1, 0x80000000ull, 0xf0000000ull, { 23, 32, 61, 0, 0 }, 0x400, 75, },
+  { 128, 3, 1, 0xc0000000ull, 0xf8000000ull, { 23, 32, 0, 0, 0 }, 0x0, 76, },
+  { 128, 3, 1, 0xc0000000ull, 0xf8000000ull, { 23, 32, 24, 0, 0 }, 0x400, 77, },
+  { 128, 3, 1, 0xc0000000ull, 0xf0000000ull, { 23, 32, 61, 0, 0 }, 0x400, 78, },
+  { 129, 3, 1, 0xc0000000ull, 0xf8000000ull, { 17, 32, 0, 0, 0 }, 0x0, 851, },
+  { 129, 3, 1, 0xc0000000ull, 0xf8000000ull, { 17, 32, 24, 0, 0 }, 0x400, 852, },
+  { 129, 3, 1, 0xc0000000ull, 0xf0000000ull, { 17, 32, 61, 0, 0 }, 0x400, 853, },
+  { 130, 3, 1, 0x40000000ull, 0xf8000000ull, { 17, 32, 0, 0, 0 }, 0x0, 79, },
+  { 130, 3, 1, 0x40000000ull, 0xf8000000ull, { 17, 32, 24, 0, 0 }, 0x400, 80, },
+  { 130, 3, 1, 0x40000000ull, 0xf0000000ull, { 17, 32, 61, 0, 0 }, 0x400, 81, },
+  { 131, 3, 1, 0xc0000000ull, 0xf8000000ull, { 17, 32, 0, 0, 0 }, 0x0, 82, },
+  { 131, 3, 1, 0xc0000000ull, 0xf8000000ull, { 17, 32, 24, 0, 0 }, 0x400, 83, },
+  { 131, 3, 1, 0xc0000000ull, 0xf0000000ull, { 17, 32, 61, 0, 0 }, 0x400, 84, },
+  { 132, 3, 1, 0x00000000ull, 0xf8000000ull, { 17, 32, 0, 0, 0 }, 0x0, 85, },
+  { 132, 3, 1, 0x00000000ull, 0xf8000000ull, { 17, 32, 24, 0, 0 }, 0x400, 86, },
+  { 132, 3, 1, 0x00000000ull, 0xf0000000ull, { 17, 32, 61, 0, 0 }, 0x400, 87, },
+  { 133, 3, 2, 0x48000000ull, 0xf8000000ull, { 17, 18, 32, 0, 0 }, 0x0, 88, },
+  { 133, 3, 2, 0x48000000ull, 0xf8000000ull, { 17, 18, 32, 5, 0 }, 0x400, 89, },
+  { 134, 3, 2, 0xc8000000ull, 0xf8000000ull, { 17, 18, 32, 0, 0 }, 0x0, 90, },
+  { 134, 3, 2, 0xc8000000ull, 0xf8000000ull, { 17, 18, 32, 5, 0 }, 0x400, 91, },
+  { 135, 3, 2, 0x88000000ull, 0xf8000000ull, { 17, 18, 32, 0, 0 }, 0x0, 92, },
+  { 135, 3, 2, 0x88000000ull, 0xf8000000ull, { 17, 18, 32, 4, 0 }, 0x400, 93, },
+  { 136, 3, 1, 0x80000000ull, 0xf8000000ull, { 17, 32, 0, 0, 0 }, 0x0, 94, },
+  { 136, 3, 1, 0x80000000ull, 0xf8000000ull, { 17, 32, 24, 0, 0 }, 0x400, 95, },
+  { 136, 3, 1, 0x80000000ull, 0xf0000000ull, { 17, 32, 61, 0, 0 }, 0x400, 96, },
+  { 139, 3, 0, 0x00000000ull, 0xf8000000ull, { 32, 0, 0, 0, 0 }, 0x0, 97, },
+  { 139, 3, 0, 0x00000000ull, 0xf8000000ull, { 32, 24, 0, 0, 0 }, 0x400, 98, },
+  { 139, 3, 0, 0x00000000ull, 0xf0000000ull, { 32, 61, 0, 0, 0 }, 0x400, 99, },
+  { 140, 3, 0, 0x50000000ull, 0xf8000000ull, { 0, 0, 0, 0, 0 }, 0x21, 100, },
+  { 148, 3, 0, 0x10000000ull, 0xf8000000ull, { 0, 0, 0, 0, 0 }, 0x0, 101, },
+  { 149, 2, 1, 0x80000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 1747, },
+  { 150, 2, 1, 0x80000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 1748, },
+  { 151, 2, 1, 0x80000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 1749, },
+  { 152, 1, 1, 0x00000000ull, 0xf80fe000ull, { 23, 25, 0, 0, 0 }, 0x0, 102, },
+  { 152, 1, 1, 0x00000000ull, 0x07f00000ull, { 23, 62, 0, 0, 0 }, 0x40, 103, },
+  { 152, 1, 1, 0x00000000ull, 0x00300000ull, { 23, 65, 0, 0, 0 }, 0x40, 104, },
+  { 152, 5, 1, 0x80000000ull, 0xf8000000ull, { 17, 19, 0, 0, 0 }, 0xc0, 105, },
+  { 152, 2, 1, 0x00100000ull, 0x00f00000ull, { 14, 24, 0, 0, 0 }, 0x40, 106, },
+  { 152, 2, 1, 0x00000000ull, 0x00f00000ull, { 14, 24, 77, 0, 0 }, 0x0, 2295, },
+  { 152, 2, 1, 0x88000000ull, 0xf8000000ull, { 23, 15, 0, 0, 0 }, 0x0, 108, },
+  { 152, 2, 1, 0x00000000ull, 0x00000000ull, { 8, 24, 63, 0, 0 }, 0x0, 109, },
+  { 152, 2, 1, 0x00000000ull, 0x00000000ull, { 9, 67, 0, 0, 0 }, 0x0, 110, },
+  { 152, 2, 1, 0x80000000ull, 0xf8000000ull, { 23, 7, 0, 0, 0 }, 0x0, 111, },
+  { 152, 2, 1, 0x98000000ull, 0xf8000000ull, { 23, 8, 0, 0, 0 }, 0x0, 112, },
+  { 152, 2, 1, 0x50000000ull, 0xf8000000ull, { 13, 24, 0, 0, 0 }, 0x0, 912, },
+  { 152, 2, 1, 0x50000000ull, 0xf8000000ull, { 13, 54, 0, 0, 0 }, 0x0, 913, },
+  { 152, 2, 1, 0x90000000ull, 0xf8000000ull, { 23, 13, 0, 0, 0 }, 0x0, 914, },
+  { 152, 3, 1, 0x40000000ull, 0xf8000000ull, { 13, 54, 0, 0, 0 }, 0x0, 992, },
+  { 152, 3, 1, 0x50000000ull, 0xf8000000ull, { 13, 24, 0, 0, 0 }, 0x0, 993, },
+  { 152, 3, 1, 0x10000000ull, 0xf8000000ull, { 23, 13, 0, 0, 0 }, 0x0, 994, },
+  { 152, 3, 1, 0x60000000ull, 0xf8000000ull, { 16, 24, 0, 0, 0 }, 0x8, 113, },
+  { 152, 3, 1, 0x20000000ull, 0xf8000000ull, { 23, 16, 0, 0, 0 }, 0x8, 114, },
+  { 152, 3, 1, 0x68000000ull, 0xf8000000ull, { 11, 24, 0, 0, 0 }, 0x8, 115, },
+  { 152, 3, 1, 0x48000000ull, 0xf8000000ull, { 12, 24, 0, 0, 0 }, 0x0, 116, },
+  { 152, 3, 1, 0x28000000ull, 0xf8000000ull, { 23, 10, 0, 0, 0 }, 0x8, 117, },
+  { 152, 3, 1, 0x08000000ull, 0xf8000000ull, { 23, 12, 0, 0, 0 }, 0x0, 118, },
+  { 152, 3, 1, 0x00000000ull, 0xf8000000ull, { 37, 24, 0, 0, 0 }, 0x8, 119, },
+  { 152, 3, 1, 0x08000000ull, 0xf8000000ull, { 28, 24, 0, 0, 0 }, 0x8, 120, },
+  { 152, 3, 1, 0x10000000ull, 0xf8000000ull, { 31, 24, 0, 0, 0 }, 0x8, 121, },
+  { 152, 3, 1, 0x18000000ull, 0xf8000000ull, { 34, 24, 0, 0, 0 }, 0x8, 122, },
+  { 152, 3, 1, 0x20000000ull, 0xf8000000ull, { 35, 24, 0, 0, 0 }, 0x8, 123, },
+  { 152, 3, 1, 0x28000000ull, 0xf8000000ull, { 36, 24, 0, 0, 0 }, 0x8, 124, },
+  { 152, 3, 1, 0x30000000ull, 0xf8000000ull, { 33, 24, 0, 0, 0 }, 0x8, 125, },
+  { 152, 3, 1, 0x80000000ull, 0xf8000000ull, { 23, 37, 0, 0, 0 }, 0x8, 126, },
+  { 152, 3, 1, 0x88000000ull, 0xf8000000ull, { 23, 28, 0, 0, 0 }, 0x8, 127, },
+  { 152, 3, 1, 0x90000000ull, 0xf8000000ull, { 23, 31, 0, 0, 0 }, 0x8, 128, },
+  { 152, 3, 1, 0x98000000ull, 0xf8000000ull, { 23, 34, 0, 0, 0 }, 0x8, 129, },
+  { 152, 3, 1, 0xa0000000ull, 0xf8000000ull, { 23, 35, 0, 0, 0 }, 0x8, 130, },
+  { 152, 3, 1, 0xa8000000ull, 0xf8000000ull, { 23, 36, 0, 0, 0 }, 0x0, 131, },
+  { 152, 3, 1, 0xb0000000ull, 0xf8000000ull, { 23, 33, 0, 0, 0 }, 0x8, 132, },
+  { 152, 3, 1, 0xb8000000ull, 0xf8000000ull, { 23, 27, 0, 0, 0 }, 0x0, 133, },
+  { 152, 7, 1, 0x00000000ull, 0x00000000ull, { 23, 13, 0, 0, 0 }, 0x0, 134, },
+  { 152, 7, 1, 0x00000000ull, 0x00000000ull, { 13, 54, 0, 0, 0 }, 0x0, 135, },
+  { 152, 7, 1, 0x00000000ull, 0x00000000ull, { 13, 24, 0, 0, 0 }, 0x0, 136, },
+  { 153, 6, 1, 0x00000000ull, 0x00100000ull, { 23, 69, 0, 0, 0 }, 0x0, 137, },
+  { 154, 2, 1, 0xa0000000ull, 0xf0000000ull, { 23, 24, 73, 0, 0 }, 0x0, 138, },
+  { 155, 2, 1, 0xa0000000ull, 0xf0000000ull, { 23, 24, 74, 0, 0 }, 0x0, 139, },
+  { 165, 4, 0, 0x00000000ull, 0xf8000000ull, { 64, 0, 0, 0, 0 }, 0x0, 361, },
+  { 165, 5, 0, 0x08000000ull, 0xf8000000ull, { 64, 0, 0, 0, 0 }, 0x0, 774, },
+  { 165, 2, 0, 0x08000000ull, 0xf8000000ull, { 64, 0, 0, 0, 0 }, 0x2, 915, },
+  { 165, 3, 0, 0x08000000ull, 0xf8000000ull, { 64, 0, 0, 0, 0 }, 0x0, 995, },
+  { 165, 6, 0, 0x08000000ull, 0xf8000000ull, { 68, 0, 0, 0, 0 }, 0x0, 2411, },
+  { 165, 7, 0, 0x00000000ull, 0x00000000ull, { 64, 0, 0, 0, 0 }, 0x0, 140, },
+  { 172, 1, 1, 0x70000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 141, },
+  { 172, 1, 1, 0x70000000ull, 0xf8000000ull, { 23, 54, 25, 0, 0 }, 0x0, 142, },
+  { 175, 2, 1, 0x00000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 2394, },
+  { 176, 2, 1, 0x20000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 2297, },
+  { 177, 1, 1, 0x00000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 143, },
+  { 178, 1, 1, 0x00000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 144, },
+  { 179, 1, 1, 0x00000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 145, },
+  { 180, 1, 1, 0x50000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 146, },
+  { 181, 1, 1, 0x50000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 147, },
+  { 182, 1, 1, 0x70000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 148, },
+  { 183, 1, 1, 0x70000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 149, },
+  { 184, 1, 1, 0x20000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 761, },
+  { 185, 1, 1, 0x20000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 762, },
+  { 186, 1, 1, 0x20000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 763, },
+  { 187, 2, 1, 0x50000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 2311, },
+  { 188, 2, 1, 0x70000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 150, },
+  { 189, 2, 1, 0x10000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 2312, },
+  { 190, 2, 1, 0x30000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 151, },
+  { 191, 2, 1, 0xd0000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 1750, },
+  { 192, 2, 1, 0x30000000ull, 0x30000000ull, { 23, 24, 25, 41, 0 }, 0x0, 152, },
+  { 193, 2, 1, 0x90000000ull, 0xf0000000ull, { 23, 25, 0, 0, 0 }, 0x0, 153, },
+  { 195, 3, 1, 0xc0000000ull, 0xf8000000ull, { 23, 25, 24, 0, 0 }, 0x0, 1751, },
+  { 195, 3, 1, 0xc0000000ull, 0xf8000000ull, { 23, 25, 48, 0, 0 }, 0x0, 1752, },
+  { 195, 3, 0, 0x88000000ull, 0xf8000000ull, { 25, 48, 0, 0, 0 }, 0x0, 1774, },
+  { 196, 2, 1, 0xb0000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 154, },
+  { 197, 2, 1, 0x40000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 155, },
+  { 197, 2, 1, 0x50000000ull, 0xf0000000ull, { 23, 24, 38, 0, 0 }, 0x0, 156, },
+  { 198, 2, 1, 0x40000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 157, },
+  { 198, 2, 1, 0x50000000ull, 0xf0000000ull, { 23, 24, 38, 0, 0 }, 0x0, 158, },
+  { 199, 1, 1, 0x80000000ull, 0xe0000000ull, { 23, 24, 40, 25, 0 }, 0x0, 159, },
+  { 200, 2, 1, 0x20000000ull, 0xf0000000ull, { 23, 25, 24, 0, 0 }, 0x0, 160, },
+  { 200, 2, 1, 0x30000000ull, 0xf0000000ull, { 23, 25, 42, 0, 0 }, 0x0, 161, },
+  { 201, 2, 1, 0x20000000ull, 0xf0000000ull, { 23, 25, 24, 0, 0 }, 0x0, 162, },
+  { 201, 2, 1, 0x30000000ull, 0xf0000000ull, { 23, 25, 42, 0, 0 }, 0x0, 163, },
+  { 202, 1, 1, 0xc0000000ull, 0xe0000000ull, { 23, 24, 40, 25, 0 }, 0x0, 164, },
+  { 203, 1, 1, 0x20000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 165, },
+  { 204, 1, 1, 0x20000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 166, },
+  { 205, 1, 1, 0x20000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 167, },
+  { 206, 3, 0, 0x48000000ull, 0xf8000000ull, { 25, 24, 0, 0, 0 }, 0x8, 943, },
+  { 206, 3, 0, 0x50000000ull, 0xf8000000ull, { 25, 24, 0, 0, 0 }, 0xc, 862, },
+  { 206, 3, 0, 0xa0000000ull, 0xf8000000ull, { 25, 0, 0, 0, 0 }, 0x8, 744, },
+  { 207, 3, 0, 0x60000000ull, 0xf8000000ull, { 25, 24, 0, 0, 0 }, 0x8, 670, },
+  { 212, 4, 0, 0x40000000ull, 0xf8000000ull, { 0, 0, 0, 0, 0 }, 0x22c, 168, },
+  { 213, 3, 0, 0x38000000ull, 0x78000000ull, { 66, 0, 0, 0, 0 }, 0x8, 169, },
+  { 214, 3, 0, 0x28000000ull, 0x78000000ull, { 66, 0, 0, 0, 0 }, 0x0, 170, },
+  { 223, 3, 1, 0x08000000ull, 0xc8000000ull, { 17, 24, 0, 0, 0 }, 0x0, 2222, },
+  { 224, 2, 1, 0x00000000ull, 0x04000000ull, { 23, 24, 44, 0, 0 }, 0x140, 171, },
+  { 224, 2, 1, 0x40000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 172, },
+  { 225, 1, 1, 0x80000000ull, 0xe0000000ull, { 23, 24, 39, 25, 0 }, 0x0, 173, },
+  { 226, 1, 1, 0xc0000000ull, 0xe0000000ull, { 23, 24, 39, 25, 0 }, 0x0, 174, },
+  { 227, 2, 1, 0x00000000ull, 0x00002000ull, { 23, 25, 75, 0, 0 }, 0x140, 2318, },
+  { 227, 2, 1, 0x20000000ull, 0xf0000000ull, { 23, 25, 24, 0, 0 }, 0x0, 176, },
+  { 228, 2, 1, 0x00000000ull, 0x00000000ull, { 23, 24, 25, 43, 0 }, 0x0, 177, },
+  { 233, 3, 0, 0x80000000ull, 0xf8000000ull, { 0, 0, 0, 0, 0 }, 0x0, 672, },
+  { 234, 3, 0, 0x30000000ull, 0x78000000ull, { 66, 0, 0, 0, 0 }, 0x8, 178, },
+  { 236, 3, 1, 0x00000000ull, 0xf8000000ull, { 32, 24, 0, 0, 0 }, 0x0, 179, },
+  { 236, 3, 1, 0x00000000ull, 0xf0000000ull, { 32, 24, 60, 0, 0 }, 0x400, 180, },
+  { 237, 3, 1, 0x40000000ull, 0xf8000000ull, { 32, 24, 0, 0, 0 }, 0x0, 181, },
+  { 237, 3, 1, 0x40000000ull, 0xf0000000ull, { 32, 24, 60, 0, 0 }, 0x400, 182, },
+  { 238, 3, 1, 0x80000000ull, 0xf8000000ull, { 32, 24, 0, 0, 0 }, 0x0, 183, },
+  { 238, 3, 1, 0x80000000ull, 0xf0000000ull, { 32, 24, 60, 0, 0 }, 0x400, 184, },
+  { 239, 3, 1, 0xc0000000ull, 0xf8000000ull, { 32, 24, 0, 0, 0 }, 0x0, 185, },
+  { 239, 3, 1, 0xc0000000ull, 0xf0000000ull, { 32, 24, 60, 0, 0 }, 0x400, 186, },
+  { 240, 3, 1, 0xc0000000ull, 0xf8000000ull, { 32, 18, 0, 0, 0 }, 0x0, 2225, },
+  { 240, 3, 1, 0xc0000000ull, 0xf0000000ull, { 32, 18, 60, 0, 0 }, 0x400, 2226, },
+  { 241, 3, 1, 0x40000000ull, 0xf8000000ull, { 32, 18, 0, 0, 0 }, 0x0, 187, },
+  { 241, 3, 1, 0x40000000ull, 0xf0000000ull, { 32, 18, 60, 0, 0 }, 0x400, 188, },
+  { 242, 3, 1, 0xc0000000ull, 0xf8000000ull, { 32, 18, 0, 0, 0 }, 0x0, 189, },
+  { 242, 3, 1, 0xc0000000ull, 0xf0000000ull, { 32, 18, 60, 0, 0 }, 0x400, 190, },
+  { 243, 3, 1, 0x00000000ull, 0xf8000000ull, { 32, 18, 0, 0, 0 }, 0x0, 191, },
+  { 243, 3, 1, 0x00000000ull, 0xf0000000ull, { 32, 18, 60, 0, 0 }, 0x400, 192, },
+  { 244, 3, 1, 0x80000000ull, 0xf8000000ull, { 32, 18, 0, 0, 0 }, 0x0, 193, },
+  { 244, 3, 1, 0x80000000ull, 0xf0000000ull, { 32, 18, 60, 0, 0 }, 0x400, 194, },
+  { 245, 1, 1, 0x28000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 195, },
+  { 245, 1, 1, 0x20000000ull, 0xf8000000ull, { 23, 24, 25, 3, 0 }, 0x0, 196, },
+  { 245, 1, 1, 0x28000000ull, 0xf8000000ull, { 23, 54, 25, 0, 0 }, 0x0, 197, },
+  { 246, 3, 0, 0x20000000ull, 0x78000000ull, { 66, 0, 0, 0, 0 }, 0x0, 198, },
+  { 247, 2, 1, 0xa0000000ull, 0xf8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 199, },
+  { 248, 2, 1, 0xa8000000ull, 0xf8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 200, },
+  { 249, 2, 1, 0xb0000000ull, 0xf8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 201, },
+  { 250, 3, 0, 0x98000000ull, 0xf8000000ull, { 0, 0, 0, 0, 0 }, 0x0, 918, },
+  { 251, 3, 1, 0xf8000000ull, 0xf8000000ull, { 23, 25, 0, 0, 0 }, 0x8, 202, },
+  { 252, 2, 2, 0x00000000ull, 0x00003000ull, { 21, 22, 25, 75, 0 }, 0x0, 2416, },
+  { 252, 2, 2, 0x00000000ull, 0x00003000ull, { 22, 21, 25, 75, 0 }, 0x40, 1675, },
+  { 253, 3, 1, 0xd0000000ull, 0xf8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 203, },
+  { 254, 2, 2, 0x00002000ull, 0x00003000ull, { 21, 22, 25, 0, 0 }, 0x0, 2418, },
+  { 254, 2, 2, 0x00002000ull, 0x00003000ull, { 22, 21, 25, 0, 0 }, 0x40, 1677, },
+  { 255, 3, 1, 0xf0000000ull, 0xf8000000ull, { 23, 25, 0, 0, 0 }, 0x8, 204, },
+  { 257, 3, 1, 0xd8000000ull, 0xf8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 205, },
+  { 261, 2, 1, 0x40000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 901, },
+  { 262, 2, 1, 0x40000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 902, },
+  { 263, 2, 1, 0x40000000ull, 0xf0000000ull, { 23, 24, 25, 0, 0 }, 0x0, 903, },
+  { 271, 3, 1, 0x08000000ull, 0xf8000000ull, { 23, 32, 24, 0, 0 }, 0x0, 206, },
+  { 272, 3, 1, 0x48000000ull, 0xf8000000ull, { 23, 32, 24, 0, 0 }, 0x0, 207, },
+  { 273, 3, 1, 0x88000000ull, 0xf8000000ull, { 23, 32, 24, 0, 0 }, 0x0, 208, },
+  { 274, 3, 1, 0xc8000000ull, 0xf8000000ull, { 23, 32, 24, 0, 0 }, 0x0, 209, },
+  { 276, 5, 1, 0x00000000ull, 0x00000000ull, { 17, 19, 20, 18, 0 }, 0x0, 947, },
+  { 276, 5, 1, 0x00000000ull, 0x00000000ull, { 17, 19, 20, 18, 0 }, 0x40, 987, },
+  { 277, 5, 1, 0x00000000ull, 0x000fe000ull, { 17, 19, 20, 0, 0 }, 0x40, 948, },
+  { 278, 1, 1, 0x78000000ull, 0xf8000000ull, { 23, 24, 25, 0, 0 }, 0x0, 210, },
+  { 278, 1, 1, 0x78000000ull, 0xf8000000ull, { 23, 54, 25, 0, 0 }, 0x0, 211, },
+  { 281, 2, 1, 0x80000000ull, 0xf8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 212, },
+  { 282, 2, 1, 0x88000000ull, 0xf8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 213, },
+  { 283, 2, 1, 0x90000000ull, 0xf8000000ull, { 23, 25, 0, 0, 0 }, 0x0, 214, },
 };
 
 static const char dis_table[] = {
 0xa0, 0xc2, 0x60, 0xa0, 0x2c, 0x80, 0xa0, 0x2a, 0x80, 0xa0, 0x1a, 0x70, 
-0x98, 0xb0, 0x01, 0x40, 0x90, 0x50, 0x90, 0x28, 0x24, 0x30, 0xd0, 0x24, 
-0x30, 0xc8, 0x90, 0x28, 0x24, 0x30, 0xc0, 0x24, 0x30, 0xb8, 0x90, 0x50, 
-0x90, 0x28, 0x24, 0x30, 0xa8, 0x24, 0x30, 0xa0, 0x90, 0x28, 0x24, 0x30, 
-0x98, 0x24, 0x30, 0x90, 0xa8, 0x0b, 0x28, 0x15, 0x00, 0x97, 0x00, 0x95, 
+0x98, 0xb0, 0x01, 0x40, 0x90, 0x50, 0x90, 0x28, 0x24, 0x31, 0x48, 0x24, 
+0x31, 0x40, 0x90, 0x28, 0x24, 0x31, 0x38, 0x24, 0x31, 0x30, 0x90, 0x50, 
+0x90, 0x28, 0x24, 0x31, 0x20, 0x24, 0x31, 0x18, 0x90, 0x28, 0x24, 0x31, 
+0x10, 0x24, 0x31, 0x08, 0xa8, 0x0b, 0x28, 0x15, 0x00, 0x97, 0x00, 0x95, 
 0xa8, 0x9a, 0x98, 0x05, 0x18, 0x90, 0xf8, 0x90, 0x80, 0x90, 0x40, 0x80, 
-0xa4, 0x21, 0x18, 0x34, 0x26, 0x80, 0xa4, 0x2e, 0x48, 0x35, 0xce, 0x90, 
-0x50, 0x90, 0x28, 0x80, 0x35, 0xc4, 0x80, 0x34, 0x0a, 0x81, 0x33, 0xa6, 
+0xa4, 0x21, 0x18, 0x34, 0x26, 0x80, 0xa4, 0x2e, 0xc0, 0x35, 0xdd, 0x90, 
+0x50, 0x90, 0x28, 0x80, 0x35, 0xd3, 0x80, 0x34, 0x0a, 0x81, 0x33, 0xa6, 
 0x90, 0xe0, 0x90, 0x70, 0x90, 0x38, 0xa4, 0x20, 0x30, 0x34, 0x07, 0xa4, 
-0x1d, 0x28, 0x34, 0x04, 0x90, 0x38, 0xa4, 0x30, 0x48, 0x36, 0x0f, 0xa4, 
-0x2f, 0xf0, 0x36, 0x03, 0x90, 0x70, 0x90, 0x38, 0xa4, 0x2e, 0xc8, 0x35, 
-0xe4, 0xa4, 0x2e, 0xa0, 0x35, 0xdf, 0x80, 0xa4, 0x20, 0x10, 0x34, 0x03, 
+0x1d, 0x28, 0x34, 0x04, 0x90, 0x38, 0xa4, 0x30, 0xc0, 0x36, 0x1e, 0xa4, 
+0x30, 0x68, 0x36, 0x12, 0x90, 0x70, 0x90, 0x38, 0xa4, 0x2f, 0x40, 0x35, 
+0xf3, 0xa4, 0x2f, 0x18, 0x35, 0xee, 0x80, 0xa4, 0x20, 0x10, 0x34, 0x03, 
 0x92, 0x18, 0x91, 0xc0, 0x80, 0x91, 0x80, 0x90, 0xf8, 0xdb, 0x84, 0x60, 
-0xea, 0x40, 0xc0, 0xc0, 0x80, 0xa4, 0x39, 0xf8, 0x8c, 0x3b, 0x58, 0x84, 
-0x37, 0x75, 0xc0, 0xc0, 0x80, 0xa4, 0x39, 0xe8, 0x8c, 0x3b, 0x38, 0x84, 
-0x37, 0x73, 0xd3, 0x82, 0x40, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x27, 0x50, 
-0xc0, 0xc0, 0x81, 0x37, 0x25, 0xa4, 0x1d, 0x38, 0x33, 0xa8, 0x80, 0x90, 
+0xea, 0x40, 0xc0, 0xc0, 0x80, 0xa4, 0x3a, 0x70, 0x8c, 0x3b, 0xd0, 0x84, 
+0x37, 0x84, 0xc0, 0xc0, 0x80, 0xa4, 0x3a, 0x60, 0x8c, 0x3b, 0xb0, 0x84, 
+0x37, 0x82, 0xd3, 0x82, 0x40, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x36, 0x50, 
+0xc0, 0xc0, 0x81, 0x37, 0x34, 0xa4, 0x1d, 0x38, 0x33, 0xa8, 0x80, 0x90, 
 0x28, 0x80, 0x33, 0xa4, 0x80, 0x34, 0x0c, 0x81, 0x90, 0x38, 0xa4, 0x20, 
 0x98, 0x34, 0x0f, 0xa4, 0x20, 0x68, 0x34, 0x09, 0xc0, 0x40, 0x10, 0x10, 
 0x90, 0x38, 0xa4, 0x1d, 0x10, 0x33, 0xa3, 0xa4, 0x1d, 0x00, 0x33, 0xa1, 
 0x18, 0x24, 0x21, 0x10, 0x83, 0x90, 0xa8, 0xd3, 0x82, 0xc0, 0xc0, 0xc0, 
-0x80, 0xa4, 0x39, 0xc8, 0x37, 0x5f, 0xc0, 0xc0, 0x80, 0xa4, 0x39, 0xb8, 
-0x37, 0x5b, 0xd3, 0x82, 0x40, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x21, 0x50, 
-0xc0, 0xc0, 0x81, 0x37, 0x1f, 0x92, 0xb8, 0x99, 0x84, 0x20, 0x88, 0x90, 
-0x78, 0x90, 0x50, 0x10, 0x10, 0x80, 0xa4, 0x2e, 0x40, 0x35, 0xcd, 0x82, 
-0x35, 0xc3, 0x90, 0x80, 0x10, 0x10, 0x90, 0x38, 0xa4, 0x30, 0x40, 0x36, 
-0x0e, 0xa4, 0x2f, 0xe8, 0x36, 0x02, 0x80, 0x90, 0x38, 0xa4, 0x2e, 0xc0, 
-0x35, 0xe3, 0xa4, 0x2e, 0x98, 0x35, 0xde, 0x83, 0x90, 0xa8, 0xd3, 0x82, 
-0xc0, 0xc0, 0xc0, 0x80, 0xa4, 0x39, 0x98, 0x37, 0x53, 0xc0, 0xc0, 0x80, 
-0xa4, 0x39, 0x88, 0x37, 0x4f, 0xd3, 0x82, 0x40, 0x50, 0xc0, 0xc0, 0x81, 
-0x37, 0x1b, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x19, 0x18, 0x24, 0x20, 0x90, 
-0x83, 0x90, 0xa8, 0xd3, 0x82, 0xc0, 0xc0, 0xc0, 0x80, 0xa4, 0x39, 0x68, 
-0x37, 0x47, 0xc0, 0xc0, 0x80, 0xa4, 0x39, 0x58, 0x37, 0x43, 0xd3, 0x82, 
-0x40, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x15, 0x50, 0xc0, 0xc0, 0x81, 0x37, 
-0x13, 0x94, 0x50, 0x92, 0xf8, 0x99, 0x84, 0x1d, 0x68, 0x90, 0x78, 0x90, 
-0x50, 0x10, 0x10, 0x80, 0xa4, 0x2e, 0x38, 0x35, 0xcc, 0x82, 0x35, 0xc2, 
-0x90, 0x80, 0x10, 0x10, 0x90, 0x38, 0xa4, 0x30, 0x38, 0x36, 0x0d, 0xa4, 
-0x2f, 0xe0, 0x36, 0x01, 0x80, 0x90, 0x38, 0xa4, 0x2e, 0xb8, 0x35, 0xe2, 
-0xa4, 0x2e, 0x90, 0x35, 0xdd, 0x83, 0x90, 0xe8, 0xd3, 0x83, 0xc0, 0xc0, 
-0xc0, 0x80, 0xa4, 0x3a, 0x08, 0x8c, 0x3b, 0x78, 0x84, 0x37, 0x77, 0xc0, 
-0xc0, 0x80, 0xa4, 0x39, 0xf0, 0x8c, 0x3b, 0x48, 0x84, 0x37, 0x74, 0xd3, 
-0x82, 0x40, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x29, 0x50, 0xc0, 0xc0, 0x81, 
-0x37, 0x26, 0x18, 0x24, 0x1d, 0x60, 0x83, 0x90, 0xa8, 0xd3, 0x82, 0xc0, 
-0xc0, 0xc0, 0x80, 0xa4, 0x39, 0xd8, 0x37, 0x63, 0xc0, 0xc0, 0x80, 0xa4, 
-0x39, 0xc0, 0x37, 0x5d, 0xd3, 0x82, 0x40, 0x50, 0xc0, 0xc0, 0x81, 0x37, 
-0x23, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x20, 0x92, 0xb8, 0x99, 0x84, 0x1d, 
-0x58, 0x90, 0x78, 0x90, 0x50, 0x10, 0x10, 0x80, 0xa4, 0x2e, 0x30, 0x35, 
-0xcb, 0x82, 0x35, 0xc1, 0x90, 0x80, 0x10, 0x10, 0x90, 0x38, 0xa4, 0x30, 
-0x30, 0x36, 0x0c, 0xa4, 0x2f, 0xd8, 0x36, 0x00, 0x80, 0x90, 0x38, 0xa4, 
-0x2e, 0xb0, 0x35, 0xe1, 0xa4, 0x2e, 0x88, 0x35, 0xdc, 0x83, 0x90, 0xa8, 
-0xd3, 0x82, 0xc0, 0xc0, 0xc0, 0x80, 0xa4, 0x39, 0xa8, 0x37, 0x57, 0xc0, 
-0xc0, 0x80, 0xa4, 0x39, 0x90, 0x37, 0x51, 0xd3, 0x82, 0x40, 0x50, 0xc0, 
-0xc0, 0x81, 0x37, 0x1d, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x1a, 0x18, 0x20, 
+0x80, 0xa4, 0x3a, 0x40, 0x37, 0x6e, 0xc0, 0xc0, 0x80, 0xa4, 0x3a, 0x30, 
+0x37, 0x6a, 0xd3, 0x82, 0x40, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x30, 0x50, 
+0xc0, 0xc0, 0x81, 0x37, 0x2e, 0x92, 0xb8, 0x99, 0x84, 0x20, 0x88, 0x90, 
+0x78, 0x90, 0x50, 0x10, 0x10, 0x80, 0xa4, 0x2e, 0xb8, 0x35, 0xdc, 0x82, 
+0x35, 0xd2, 0x90, 0x80, 0x10, 0x10, 0x90, 0x38, 0xa4, 0x30, 0xb8, 0x36, 
+0x1d, 0xa4, 0x30, 0x60, 0x36, 0x11, 0x80, 0x90, 0x38, 0xa4, 0x2f, 0x38, 
+0x35, 0xf2, 0xa4, 0x2f, 0x10, 0x35, 0xed, 0x83, 0x90, 0xa8, 0xd3, 0x82, 
+0xc0, 0xc0, 0xc0, 0x80, 0xa4, 0x3a, 0x10, 0x37, 0x62, 0xc0, 0xc0, 0x80, 
+0xa4, 0x3a, 0x00, 0x37, 0x5e, 0xd3, 0x82, 0x40, 0x50, 0xc0, 0xc0, 0x81, 
+0x37, 0x2a, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x28, 0x18, 0x24, 0x20, 0x90, 
+0x83, 0x90, 0xa8, 0xd3, 0x82, 0xc0, 0xc0, 0xc0, 0x80, 0xa4, 0x39, 0xe0, 
+0x37, 0x56, 0xc0, 0xc0, 0x80, 0xa4, 0x39, 0xd0, 0x37, 0x52, 0xd3, 0x82, 
+0x40, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x24, 0x50, 0xc0, 0xc0, 0x81, 0x37, 
+0x22, 0x94, 0x50, 0x92, 0xf8, 0x99, 0x84, 0x1d, 0x68, 0x90, 0x78, 0x90, 
+0x50, 0x10, 0x10, 0x80, 0xa4, 0x2e, 0xb0, 0x35, 0xdb, 0x82, 0x35, 0xd1, 
+0x90, 0x80, 0x10, 0x10, 0x90, 0x38, 0xa4, 0x30, 0xb0, 0x36, 0x1c, 0xa4, 
+0x30, 0x58, 0x36, 0x10, 0x80, 0x90, 0x38, 0xa4, 0x2f, 0x30, 0x35, 0xf1, 
+0xa4, 0x2f, 0x08, 0x35, 0xec, 0x83, 0x90, 0xe8, 0xd3, 0x83, 0xc0, 0xc0, 
+0xc0, 0x80, 0xa4, 0x3a, 0x80, 0x8c, 0x3b, 0xf0, 0x84, 0x37, 0x86, 0xc0, 
+0xc0, 0x80, 0xa4, 0x3a, 0x68, 0x8c, 0x3b, 0xc0, 0x84, 0x37, 0x83, 0xd3, 
+0x82, 0x40, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x38, 0x50, 0xc0, 0xc0, 0x81, 
+0x37, 0x35, 0x18, 0x24, 0x1d, 0x60, 0x83, 0x90, 0xa8, 0xd3, 0x82, 0xc0, 
+0xc0, 0xc0, 0x80, 0xa4, 0x3a, 0x50, 0x37, 0x72, 0xc0, 0xc0, 0x80, 0xa4, 
+0x3a, 0x38, 0x37, 0x6c, 0xd3, 0x82, 0x40, 0x50, 0xc0, 0xc0, 0x81, 0x37, 
+0x32, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x2f, 0x92, 0xb8, 0x99, 0x84, 0x1d, 
+0x58, 0x90, 0x78, 0x90, 0x50, 0x10, 0x10, 0x80, 0xa4, 0x2e, 0xa8, 0x35, 
+0xda, 0x82, 0x35, 0xd0, 0x90, 0x80, 0x10, 0x10, 0x90, 0x38, 0xa4, 0x30, 
+0xa8, 0x36, 0x1b, 0xa4, 0x30, 0x50, 0x36, 0x0f, 0x80, 0x90, 0x38, 0xa4, 
+0x2f, 0x28, 0x35, 0xf0, 0xa4, 0x2f, 0x00, 0x35, 0xeb, 0x83, 0x90, 0xa8, 
+0xd3, 0x82, 0xc0, 0xc0, 0xc0, 0x80, 0xa4, 0x3a, 0x20, 0x37, 0x66, 0xc0, 
+0xc0, 0x80, 0xa4, 0x3a, 0x08, 0x37, 0x60, 0xd3, 0x82, 0x40, 0x50, 0xc0, 
+0xc0, 0x81, 0x37, 0x2c, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x29, 0x18, 0x20, 
 0x01, 0x48, 0x83, 0x90, 0xa8, 0xd3, 0x82, 0xc0, 0xc0, 0xc0, 0x80, 0xa4, 
-0x39, 0x78, 0x37, 0x4b, 0xc0, 0xc0, 0x80, 0xa4, 0x39, 0x60, 0x37, 0x45, 
-0xd3, 0x82, 0x40, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x17, 0x50, 0xc0, 0xc0, 
-0x81, 0x37, 0x14, 0xda, 0x06, 0xe0, 0xea, 0x80, 0x90, 0x60, 0x90, 0x38, 
+0x39, 0xf0, 0x37, 0x5a, 0xc0, 0xc0, 0x80, 0xa4, 0x39, 0xd8, 0x37, 0x54, 
+0xd3, 0x82, 0x40, 0x50, 0xc0, 0xc0, 0x81, 0x37, 0x26, 0x50, 0xc0, 0xc0, 
+0x81, 0x37, 0x23, 0xda, 0x06, 0xe0, 0xea, 0x80, 0x90, 0x60, 0x90, 0x38, 
 0xa4, 0x21, 0x00, 0x34, 0x1e, 0x80, 0x34, 0x1b, 0x90, 0x38, 0xa4, 0x20, 
 0xa8, 0x34, 0x19, 0x80, 0x34, 0x16, 0x90, 0x60, 0x90, 0x38, 0xa4, 0x20, 
 0xe8, 0x34, 0x1f, 0x80, 0x34, 0x1c, 0x90, 0x38, 0xa4, 0x20, 0xc0, 0x34, 
 0x1a, 0x80, 0x34, 0x17, 0xc8, 0x40, 0x18, 0x00, 0x91, 0x38, 0x90, 0x40, 
-0x82, 0xa4, 0x2d, 0xf8, 0x35, 0xc0, 0x90, 0xc0, 0x80, 0x90, 0x90, 0x90, 
-0x48, 0xc9, 0xe1, 0x7e, 0x40, 0x85, 0x35, 0xf8, 0xc9, 0xe1, 0x7d, 0x80, 
-0x85, 0x35, 0xf5, 0x80, 0x35, 0xf4, 0x10, 0x10, 0x81, 0x35, 0xd0, 0x90, 
-0xa8, 0x10, 0x10, 0x90, 0x28, 0x81, 0x35, 0xee, 0x90, 0x38, 0xa4, 0x2f, 
-0x48, 0x35, 0xea, 0xa4, 0x2f, 0x38, 0x35, 0xe8, 0x90, 0x70, 0x10, 0x10, 
-0x90, 0x38, 0xa4, 0x2f, 0x60, 0x35, 0xed, 0x80, 0x35, 0xeb, 0x90, 0x60, 
-0x90, 0x28, 0x24, 0x2f, 0x98, 0xa4, 0x2f, 0x88, 0x35, 0xf2, 0x80, 0xa4, 
-0x2f, 0x78, 0x35, 0xf0, 0x80, 0x90, 0xf8, 0x90, 0x90, 0x90, 0x50, 0x90, 
-0x28, 0x80, 0x37, 0x0b, 0x80, 0x37, 0x12, 0x80, 0xa4, 0x38, 0x80, 0x37, 
-0x11, 0x90, 0x28, 0x81, 0x37, 0x0f, 0x80, 0xa4, 0x38, 0x68, 0x37, 0x0e, 
-0x83, 0x37, 0x0c, 0x98, 0xb0, 0x01, 0x40, 0x90, 0x50, 0x90, 0x28, 0x24, 
-0x2d, 0xe8, 0x24, 0x2d, 0xe0, 0x90, 0x28, 0x24, 0x2d, 0xd8, 0x24, 0x2d, 
-0xd0, 0x90, 0x50, 0x90, 0x28, 0x24, 0x2d, 0xc0, 0x24, 0x2d, 0xb8, 0x90, 
-0x28, 0x24, 0x2d, 0xb0, 0x24, 0x2d, 0xa8, 0xa8, 0x08, 0xe0, 0x0d, 0xe0, 
+0x82, 0xa4, 0x2e, 0x70, 0x35, 0xcf, 0x90, 0xc0, 0x80, 0x90, 0x90, 0x90, 
+0x48, 0xc9, 0xe1, 0x82, 0x00, 0x85, 0x36, 0x07, 0xc9, 0xe1, 0x81, 0x40, 
+0x85, 0x36, 0x04, 0x80, 0x36, 0x03, 0x10, 0x10, 0x81, 0x35, 0xdf, 0x90, 
+0xa8, 0x10, 0x10, 0x90, 0x28, 0x81, 0x35, 0xfd, 0x90, 0x38, 0xa4, 0x2f, 
+0xc0, 0x35, 0xf9, 0xa4, 0x2f, 0xb0, 0x35, 0xf7, 0x90, 0x70, 0x10, 0x10, 
+0x90, 0x38, 0xa4, 0x2f, 0xd8, 0x35, 0xfc, 0x80, 0x35, 0xfa, 0x90, 0x60, 
+0x90, 0x28, 0x24, 0x30, 0x10, 0xa4, 0x30, 0x00, 0x36, 0x01, 0x80, 0xa4, 
+0x2f, 0xf0, 0x35, 0xff, 0x80, 0x90, 0xf8, 0x90, 0x90, 0x90, 0x50, 0x90, 
+0x28, 0x80, 0x37, 0x1a, 0x80, 0x37, 0x21, 0x80, 0xa4, 0x38, 0xf8, 0x37, 
+0x20, 0x90, 0x28, 0x81, 0x37, 0x1e, 0x80, 0xa4, 0x38, 0xe0, 0x37, 0x1d, 
+0x83, 0x37, 0x1b, 0x98, 0xb0, 0x01, 0x40, 0x90, 0x50, 0x90, 0x28, 0x24, 
+0x2e, 0x60, 0x24, 0x2e, 0x58, 0x90, 0x28, 0x24, 0x2e, 0x50, 0x24, 0x2e, 
+0x48, 0x90, 0x50, 0x90, 0x28, 0x24, 0x2e, 0x38, 0x24, 0x2e, 0x30, 0x90, 
+0x28, 0x24, 0x2e, 0x28, 0x24, 0x2e, 0x20, 0xa8, 0x08, 0xe0, 0x0d, 0xe0, 
 0x96, 0x38, 0x95, 0xe8, 0x9b, 0x48, 0x05, 0xa8, 0x91, 0xa0, 0x90, 0xd0, 
 0x90, 0x70, 0x90, 0x38, 0xa4, 0x1c, 0x88, 0x33, 0x92, 0xa4, 0x1c, 0x78, 
 0x33, 0x90, 0x90, 0x38, 0xa4, 0x1c, 0x68, 0x33, 0x8e, 0x80, 0x33, 0x8c, 
 0x90, 0x60, 0x90, 0x28, 0x24, 0x1c, 0x28, 0xa4, 0x1c, 0x18, 0x33, 0x84, 
 0x90, 0x38, 0xa4, 0x1c, 0x08, 0x33, 0x82, 0xa4, 0x1c, 0x50, 0x33, 0x8b, 
 0x90, 0xe0, 0x90, 0x70, 0x90, 0x38, 0xa4, 0x1c, 0x40, 0x33, 0x89, 0xa4, 
-0x1c, 0x30, 0x33, 0x87, 0x90, 0x38, 0xa4, 0x2d, 0x60, 0x35, 0xb2, 0xa4, 
-0x2d, 0x00, 0x35, 0xa6, 0x90, 0x70, 0x90, 0x38, 0xa4, 0x2a, 0xd8, 0x35, 
-0x67, 0xa4, 0x2a, 0xa8, 0x35, 0x61, 0x10, 0x10, 0xa4, 0x1b, 0xf8, 0x33, 
+0x1c, 0x30, 0x33, 0x87, 0x90, 0x38, 0xa4, 0x2d, 0xd8, 0x35, 0xc1, 0xa4, 
+0x2d, 0x78, 0x35, 0xb5, 0x90, 0x70, 0x90, 0x38, 0xa4, 0x2a, 0xb0, 0x35, 
+0x62, 0xa4, 0x2a, 0x80, 0x35, 0x5c, 0x10, 0x10, 0xa4, 0x1b, 0xf8, 0x33, 
 0x80, 0x91, 0x50, 0x90, 0x90, 0x90, 0x50, 0x90, 0x28, 0x24, 0x1c, 0xb8, 
 0x80, 0x33, 0x9e, 0x80, 0xa4, 0x1c, 0xc0, 0x33, 0x9c, 0x90, 0x50, 0x90, 
 0x28, 0x24, 0x1c, 0xc8, 0x80, 0x33, 0x9f, 0x90, 0x38, 0xa4, 0x1c, 0xd0, 
 0x33, 0x9d, 0xa4, 0x1c, 0x98, 0x33, 0x94, 0x90, 0xe0, 0x90, 0x70, 0x90, 
-0x38, 0xa4, 0x2c, 0xa0, 0x35, 0x9a, 0xa4, 0x2c, 0x40, 0x35, 0x8e, 0x90, 
-0x38, 0xa4, 0x2b, 0xe8, 0x35, 0x82, 0xa4, 0x2b, 0x98, 0x35, 0x78, 0x81, 
-0xa4, 0x1c, 0xa8, 0x33, 0x96, 0xe4, 0xe1, 0xc1, 0x40, 0x37, 0x07, 0xed, 
-0x21, 0xbf, 0xe0, 0xdf, 0x80, 0x37, 0x01, 0x92, 0x40, 0x99, 0x18, 0x02, 
-0x00, 0x10, 0x10, 0x90, 0x80, 0x10, 0x10, 0x90, 0x38, 0xa4, 0x2d, 0x58, 
-0x35, 0xb1, 0xa4, 0x2c, 0xf8, 0x35, 0xa5, 0x80, 0x90, 0x38, 0xa4, 0x2a, 
-0xd0, 0x35, 0x66, 0xa4, 0x2a, 0xa0, 0x35, 0x60, 0x10, 0x10, 0x80, 0x90, 
-0x70, 0x90, 0x38, 0xa4, 0x2c, 0x98, 0x35, 0x99, 0xa4, 0x2c, 0x38, 0x35, 
-0x8d, 0x90, 0x38, 0xa4, 0x2b, 0xe0, 0x35, 0x81, 0xa4, 0x2b, 0x90, 0x35, 
-0x77, 0xe4, 0xe1, 0xbe, 0x40, 0x36, 0xfb, 0xed, 0x21, 0xbc, 0xe0, 0xdf, 
-0x40, 0x36, 0xf5, 0x92, 0x80, 0x92, 0x40, 0x99, 0x18, 0x02, 0x00, 0x10, 
-0x10, 0x90, 0x80, 0x10, 0x10, 0x90, 0x38, 0xa4, 0x2d, 0x50, 0x35, 0xb0, 
-0xa4, 0x2c, 0xf0, 0x35, 0xa4, 0x80, 0x90, 0x38, 0xa4, 0x2a, 0xc8, 0x35, 
-0x65, 0xa4, 0x2a, 0x98, 0x35, 0x5f, 0x10, 0x10, 0x80, 0x90, 0x70, 0x90, 
-0x38, 0xa4, 0x2c, 0x90, 0x35, 0x98, 0xa4, 0x2c, 0x30, 0x35, 0x8c, 0x90, 
-0x38, 0xa4, 0x2b, 0xd8, 0x35, 0x80, 0xa4, 0x2b, 0x88, 0x35, 0x76, 0xe4, 
-0xe1, 0xc1, 0x80, 0x37, 0x09, 0xe5, 0x21, 0xc0, 0x00, 0x37, 0x03, 0x92, 
+0x38, 0xa4, 0x2d, 0x08, 0x35, 0xa9, 0xa4, 0x2c, 0x68, 0x35, 0x96, 0x90, 
+0x38, 0xa4, 0x2c, 0x00, 0x35, 0x87, 0xa4, 0x2b, 0x70, 0x35, 0x76, 0x81, 
+0xa4, 0x1c, 0xa8, 0x33, 0x96, 0xe4, 0xe1, 0xc5, 0x00, 0x37, 0x16, 0xed, 
+0x21, 0xc3, 0xa0, 0xdf, 0x80, 0x37, 0x10, 0x92, 0x40, 0x99, 0x18, 0x02, 
+0x00, 0x10, 0x10, 0x90, 0x80, 0x10, 0x10, 0x90, 0x38, 0xa4, 0x2d, 0xd0, 
+0x35, 0xc0, 0xa4, 0x2d, 0x70, 0x35, 0xb4, 0x80, 0x90, 0x38, 0xa4, 0x2a, 
+0xa8, 0x35, 0x61, 0xa4, 0x2a, 0x78, 0x35, 0x5b, 0x10, 0x10, 0x80, 0x90, 
+0x70, 0x90, 0x38, 0xa4, 0x2c, 0xf8, 0x35, 0xa8, 0xa4, 0x2c, 0x60, 0x35, 
+0x94, 0x90, 0x38, 0xa4, 0x2b, 0xf0, 0x35, 0x86, 0xa4, 0x2b, 0x68, 0x35, 
+0x74, 0xe4, 0xe1, 0xc2, 0x00, 0x37, 0x0a, 0xed, 0x21, 0xc0, 0xa0, 0xdf, 
+0x40, 0x37, 0x04, 0x92, 0x80, 0x92, 0x40, 0x99, 0x18, 0x02, 0x00, 0x10, 
+0x10, 0x90, 0x80, 0x10, 0x10, 0x90, 0x38, 0xa4, 0x2d, 0xc8, 0x35, 0xbf, 
+0xa4, 0x2d, 0x68, 0x35, 0xb3, 0x80, 0x90, 0x38, 0xa4, 0x2a, 0xa0, 0x35, 
+0x60, 0xa4, 0x2a, 0x70, 0x35, 0x5a, 0x10, 0x10, 0x80, 0x90, 0x70, 0x90, 
+0x38, 0xa4, 0x2c, 0xe8, 0x35, 0xa7, 0xa4, 0x2c, 0x58, 0x35, 0x92, 0x90, 
+0x38, 0xa4, 0x2b, 0xe0, 0x35, 0x85, 0xa4, 0x2b, 0x60, 0x35, 0x72, 0xe4, 
+0xe1, 0xc5, 0x40, 0x37, 0x18, 0xe5, 0x21, 0xc3, 0xc0, 0x37, 0x12, 0x92, 
 0x50, 0x99, 0x18, 0x02, 0x00, 0x10, 0x10, 0x90, 0x80, 0x10, 0x10, 0x90, 
-0x38, 0xa4, 0x2d, 0x48, 0x35, 0xaf, 0xa4, 0x2c, 0xe8, 0x35, 0xa3, 0x80, 
-0x90, 0x38, 0xa4, 0x2a, 0xc0, 0x35, 0x64, 0xa4, 0x2a, 0x90, 0x35, 0x5e, 
-0x10, 0x10, 0x80, 0x90, 0x70, 0x90, 0x38, 0xa4, 0x2c, 0x88, 0x35, 0x97, 
-0xa4, 0x2c, 0x28, 0x35, 0x8b, 0x90, 0x38, 0xa4, 0x2b, 0xd0, 0x35, 0x7f, 
-0xa4, 0x2b, 0x80, 0x35, 0x75, 0xec, 0xe1, 0xbe, 0xa0, 0xe6, 0xc0, 0x36, 
-0xfd, 0xe5, 0x21, 0xbd, 0x00, 0x36, 0xf7, 0xc0, 0x40, 0x80, 0x10, 0x10, 
-0x81, 0x90, 0x90, 0x90, 0x48, 0xc9, 0xe1, 0x5a, 0xc0, 0x85, 0x35, 0x6f, 
-0xc9, 0xe1, 0x5b, 0x40, 0x85, 0x35, 0x6c, 0x80, 0x35, 0x6a, 0x80, 0xd8, 
+0x38, 0xa4, 0x2d, 0xc0, 0x35, 0xbe, 0xa4, 0x2d, 0x60, 0x35, 0xb2, 0x80, 
+0x90, 0x38, 0xa4, 0x2a, 0x98, 0x35, 0x5f, 0xa4, 0x2a, 0x68, 0x35, 0x59, 
+0x10, 0x10, 0x80, 0x90, 0x70, 0x90, 0x38, 0xa4, 0x2c, 0xd8, 0x35, 0xa6, 
+0xa4, 0x2c, 0x50, 0x35, 0x90, 0x90, 0x38, 0xa4, 0x2b, 0xd0, 0x35, 0x84, 
+0xa4, 0x2b, 0x58, 0x35, 0x70, 0xec, 0xe1, 0xc2, 0x60, 0xe6, 0xc0, 0x37, 
+0x0c, 0xe5, 0x21, 0xc0, 0xc0, 0x37, 0x06, 0xc0, 0x40, 0x80, 0x10, 0x10, 
+0x81, 0x90, 0x90, 0x90, 0x48, 0xc9, 0xe1, 0x59, 0x80, 0x85, 0x35, 0x6a, 
+0xc9, 0xe1, 0x5a, 0x00, 0x85, 0x35, 0x67, 0x80, 0x35, 0x65, 0x80, 0xd8, 
 0x47, 0x80, 0x0d, 0xc0, 0xc0, 0x80, 0x10, 0x10, 0x82, 0x90, 0x58, 0xd5, 
-0x81, 0x80, 0x80, 0x36, 0xf1, 0x80, 0x36, 0xef, 0xd5, 0x81, 0x80, 0x80, 
-0x36, 0xed, 0x80, 0x36, 0xeb, 0xc0, 0x80, 0x10, 0x10, 0x82, 0x90, 0x58, 
-0xd5, 0x81, 0x80, 0x80, 0x36, 0xf2, 0x80, 0x36, 0xf0, 0xd5, 0x81, 0x80, 
-0x80, 0x36, 0xee, 0x80, 0x36, 0xec, 0xc0, 0x80, 0x84, 0x36, 0xea, 0xa0, 
+0x81, 0x80, 0x80, 0x37, 0x00, 0x80, 0x36, 0xfe, 0xd5, 0x81, 0x80, 0x80, 
+0x36, 0xfc, 0x80, 0x36, 0xfa, 0xc0, 0x80, 0x10, 0x10, 0x82, 0x90, 0x58, 
+0xd5, 0x81, 0x80, 0x80, 0x37, 0x01, 0x80, 0x36, 0xff, 0xd5, 0x81, 0x80, 
+0x80, 0x36, 0xfd, 0x80, 0x36, 0xfb, 0xc0, 0x80, 0x84, 0x36, 0xf9, 0xa0, 
 0x56, 0x50, 0xa0, 0x40, 0x70, 0xa8, 0x1d, 0x40, 0x33, 0x18, 0xa0, 0x12, 
 0x38, 0xa0, 0x0b, 0x48, 0x96, 0x00, 0x9a, 0xf0, 0x05, 0xc0, 0x91, 0x70, 
 0x90, 0xb8, 0x90, 0x70, 0x90, 0x38, 0xa4, 0x14, 0x50, 0x33, 0x7c, 0xa4, 
@@ -4395,7 +4625,7 @@
 0x41, 0xa4, 0x13, 0xe8, 0x33, 0x43, 0x10, 0x10, 0xa4, 0x13, 0xe0, 0x33, 
 0x42, 0x90, 0x70, 0x90, 0x38, 0xa4, 0x13, 0xa8, 0x33, 0x26, 0xa4, 0x13, 
 0xb8, 0x33, 0x28, 0x10, 0x10, 0xa4, 0x13, 0xb0, 0x33, 0x27, 0xe4, 0xe1, 
-0x51, 0x00, 0x35, 0x4e, 0x9a, 0xf0, 0x05, 0x00, 0x91, 0x70, 0x90, 0xb8, 
+0x4f, 0xc0, 0x35, 0x49, 0x9a, 0xf0, 0x05, 0x00, 0x91, 0x70, 0x90, 0xb8, 
 0x90, 0x70, 0x90, 0x38, 0xa4, 0x13, 0xa0, 0x33, 0x74, 0xa4, 0x13, 0x98, 
 0x33, 0x76, 0x10, 0x10, 0xa4, 0x13, 0x90, 0x33, 0x75, 0x90, 0x70, 0x90, 
 0x38, 0xa4, 0x13, 0x88, 0x33, 0x59, 0xa4, 0x13, 0x80, 0x33, 0x5b, 0x10, 
@@ -4408,8 +4638,8 @@
 0x28, 0x80, 0x33, 0x56, 0x80, 0x33, 0x58, 0x10, 0x10, 0x80, 0x33, 0x57, 
 0x90, 0x88, 0x90, 0x50, 0x90, 0x28, 0x80, 0x33, 0x3b, 0x80, 0x33, 0x3d, 
 0x10, 0x10, 0x80, 0x33, 0x3c, 0x90, 0x50, 0x90, 0x28, 0x80, 0x33, 0x20, 
-0x80, 0x33, 0x22, 0x10, 0x10, 0x80, 0x33, 0x21, 0xe4, 0xe1, 0x3e, 0x80, 
-0x35, 0x0e, 0x95, 0x40, 0x9a, 0x90, 0x05, 0x00, 0x91, 0x10, 0x90, 0x88, 
+0x80, 0x33, 0x22, 0x10, 0x10, 0x80, 0x33, 0x21, 0xe4, 0xe1, 0x3d, 0x40, 
+0x35, 0x09, 0x95, 0x40, 0x9a, 0x90, 0x05, 0x00, 0x91, 0x10, 0x90, 0x88, 
 0x90, 0x50, 0x90, 0x28, 0x80, 0x33, 0x6e, 0x80, 0x33, 0x70, 0x10, 0x10, 
 0x80, 0x33, 0x6f, 0x90, 0x50, 0x90, 0x28, 0x80, 0x33, 0x53, 0x80, 0x33, 
 0x55, 0x10, 0x10, 0x80, 0x33, 0x54, 0x90, 0xb8, 0x90, 0x70, 0x90, 0x38, 
@@ -4422,12 +4652,12 @@
 0x90, 0xb8, 0x90, 0x70, 0x90, 0x38, 0xa4, 0x13, 0x18, 0x33, 0x35, 0xa4, 
 0x13, 0x28, 0x33, 0x37, 0x10, 0x10, 0xa4, 0x13, 0x20, 0x33, 0x36, 0x90, 
 0x70, 0x90, 0x38, 0xa4, 0x12, 0xe8, 0x33, 0x1a, 0xa4, 0x12, 0xf8, 0x33, 
-0x1c, 0x10, 0x10, 0xa4, 0x12, 0xf0, 0x33, 0x1b, 0xe4, 0xe1, 0x50, 0x80, 
-0x35, 0x4c, 0x98, 0xb8, 0x01, 0x68, 0x10, 0x10, 0x10, 0x10, 0x90, 0x50, 
+0x1c, 0x10, 0x10, 0xa4, 0x12, 0xf0, 0x33, 0x1b, 0xe4, 0xe1, 0x4f, 0x40, 
+0x35, 0x47, 0x98, 0xb8, 0x01, 0x68, 0x10, 0x10, 0x10, 0x10, 0x90, 0x50, 
 0x90, 0x28, 0x80, 0x33, 0x17, 0x80, 0x33, 0x19, 0x10, 0x10, 0x80, 0x33, 
 0x18, 0x90, 0x60, 0x90, 0x30, 0x60, 0xa0, 0x97, 0x00, 0x60, 0xa0, 0x96, 
 0xc0, 0x90, 0x30, 0x60, 0xa0, 0x96, 0x80, 0x60, 0xa0, 0x96, 0x40, 0xe4, 
-0xe1, 0x3d, 0x80, 0x35, 0x0a, 0x96, 0xe8, 0x94, 0x80, 0x9a, 0x30, 0x04, 
+0xe1, 0x3c, 0x40, 0x35, 0x05, 0x96, 0xe8, 0x94, 0x80, 0x9a, 0x30, 0x04, 
 0x40, 0x91, 0x10, 0x90, 0x88, 0x90, 0x50, 0x90, 0x28, 0x80, 0x33, 0x65, 
 0x80, 0x33, 0x6a, 0x10, 0x10, 0x80, 0x33, 0x69, 0x90, 0x50, 0x90, 0x28, 
 0x80, 0x33, 0x4a, 0x80, 0x33, 0x4f, 0x10, 0x10, 0x80, 0x33, 0x4e, 0x90, 
@@ -4439,13 +4669,13 @@
 0x10, 0x10, 0x80, 0x33, 0x48, 0x90, 0x88, 0x90, 0x50, 0x90, 0x28, 0x80, 
 0x33, 0x2c, 0x80, 0x33, 0x2e, 0x10, 0x10, 0x80, 0x33, 0x2d, 0x90, 0x50, 
 0x90, 0x28, 0x80, 0x33, 0x0e, 0x80, 0x33, 0x10, 0x10, 0x10, 0x80, 0x33, 
-0x0f, 0xe4, 0xe1, 0x50, 0x00, 0x35, 0x4a, 0x88, 0x02, 0x28, 0x91, 0x10, 
+0x0f, 0xe4, 0xe1, 0x4e, 0xc0, 0x35, 0x45, 0x88, 0x02, 0x28, 0x91, 0x10, 
 0x90, 0x88, 0x90, 0x50, 0x90, 0x28, 0x80, 0x33, 0x66, 0x80, 0x33, 0x68, 
 0x10, 0x10, 0x80, 0x33, 0x67, 0x90, 0x50, 0x90, 0x28, 0x80, 0x33, 0x4b, 
 0x80, 0x33, 0x4d, 0x10, 0x10, 0x80, 0x33, 0x4c, 0x90, 0x88, 0x90, 0x50, 
 0x90, 0x28, 0x80, 0x33, 0x30, 0x80, 0x33, 0x32, 0x10, 0x10, 0x80, 0x33, 
 0x31, 0x90, 0x50, 0x90, 0x28, 0x80, 0x33, 0x12, 0x80, 0x33, 0x14, 0x10, 
-0x10, 0x80, 0x33, 0x13, 0xe4, 0xe1, 0x3c, 0x80, 0x35, 0x06, 0x93, 0x40, 
+0x10, 0x80, 0x33, 0x13, 0xe4, 0xe1, 0x3b, 0x40, 0x35, 0x01, 0x93, 0x40, 
 0x99, 0x90, 0x03, 0x00, 0x90, 0xc0, 0x90, 0x60, 0x90, 0x28, 0x81, 0x32, 
 0x9e, 0x10, 0x10, 0x80, 0x32, 0x9d, 0x90, 0x28, 0x81, 0x32, 0x9a, 0x10, 
 0x10, 0x80, 0x32, 0x99, 0x90, 0x60, 0x90, 0x28, 0x81, 0x32, 0x96, 0x10, 
@@ -4454,9 +4684,9 @@
 0x10, 0x80, 0x32, 0x9c, 0x90, 0x28, 0x81, 0x32, 0x97, 0x10, 0x10, 0x80, 
 0x32, 0x98, 0x90, 0x60, 0x90, 0x28, 0x81, 0x32, 0x93, 0x10, 0x10, 0x80, 
 0x32, 0x94, 0x90, 0x28, 0x81, 0x32, 0x8f, 0x10, 0x10, 0x80, 0x32, 0x90, 
-0xe4, 0xe1, 0x4f, 0x80, 0x35, 0x48, 0x88, 0x00, 0x88, 0x10, 0x10, 0x10, 
+0xe4, 0xe1, 0x4e, 0x40, 0x35, 0x43, 0x88, 0x00, 0x88, 0x10, 0x10, 0x10, 
 0x10, 0x90, 0x28, 0x81, 0x32, 0x8d, 0x10, 0x10, 0x80, 0x32, 0x8e, 0xe4, 
-0xe1, 0x3b, 0x80, 0x35, 0x02, 0xa0, 0x0e, 0x80, 0xa0, 0x09, 0x08, 0x94, 
+0xe1, 0x3a, 0x40, 0x34, 0xfd, 0xa0, 0x0e, 0x80, 0xa0, 0x09, 0x08, 0x94, 
 0x80, 0x9a, 0x30, 0x04, 0x40, 0x91, 0x10, 0x90, 0x88, 0x90, 0x50, 0x90, 
 0x28, 0x80, 0x33, 0x0d, 0x80, 0x33, 0x0c, 0x10, 0x10, 0x80, 0x33, 0x0b, 
 0x90, 0x50, 0x90, 0x28, 0x80, 0x32, 0xf2, 0x80, 0x32, 0xf1, 0x10, 0x10, 
@@ -4468,7 +4698,7 @@
 0xed, 0x80, 0x32, 0xef, 0x10, 0x10, 0x80, 0x32, 0xee, 0x90, 0x88, 0x90, 
 0x50, 0x90, 0x28, 0x80, 0x32, 0xd2, 0x80, 0x32, 0xd4, 0x10, 0x10, 0x80, 
 0x32, 0xd3, 0x90, 0x50, 0x90, 0x28, 0x80, 0x32, 0xb7, 0x80, 0x32, 0xb9, 
-0x10, 0x10, 0x80, 0x32, 0xb8, 0xe4, 0xe1, 0x48, 0x80, 0x35, 0x36, 0x9a, 
+0x10, 0x10, 0x80, 0x32, 0xb8, 0xe4, 0xe1, 0x47, 0x40, 0x35, 0x31, 0x9a, 
 0x30, 0x04, 0x40, 0x91, 0x10, 0x90, 0x88, 0x90, 0x50, 0x90, 0x28, 0x80, 
 0x33, 0x05, 0x80, 0x33, 0x07, 0x10, 0x10, 0x80, 0x33, 0x06, 0x90, 0x50, 
 0x90, 0x28, 0x80, 0x32, 0xea, 0x80, 0x32, 0xec, 0x10, 0x10, 0x80, 0x32, 
@@ -4480,7 +4710,7 @@
 0x32, 0xe9, 0x10, 0x10, 0x80, 0x32, 0xe8, 0x90, 0x88, 0x90, 0x50, 0x90, 
 0x28, 0x80, 0x32, 0xcc, 0x80, 0x32, 0xce, 0x10, 0x10, 0x80, 0x32, 0xcd, 
 0x90, 0x50, 0x90, 0x28, 0x80, 0x32, 0xb1, 0x80, 0x32, 0xb3, 0x10, 0x10, 
-0x80, 0x32, 0xb2, 0xe4, 0xe1, 0x38, 0x00, 0x34, 0xea, 0x94, 0x80, 0x9a, 
+0x80, 0x32, 0xb2, 0xe4, 0xe1, 0x36, 0xc0, 0x34, 0xe5, 0x94, 0x80, 0x9a, 
 0x30, 0x04, 0x40, 0x91, 0x10, 0x90, 0x88, 0x90, 0x50, 0x90, 0x28, 0x80, 
 0x32, 0xff, 0x80, 0x33, 0x01, 0x10, 0x10, 0x80, 0x33, 0x00, 0x90, 0x50, 
 0x90, 0x28, 0x80, 0x32, 0xe4, 0x80, 0x32, 0xe6, 0x10, 0x10, 0x80, 0x32, 
@@ -4492,10 +4722,10 @@
 0x32, 0xe3, 0x10, 0x10, 0x80, 0x32, 0xe2, 0x90, 0x88, 0x90, 0x50, 0x90, 
 0x28, 0x80, 0x32, 0xc6, 0x80, 0x32, 0xc8, 0x10, 0x10, 0x80, 0x32, 0xc7, 
 0x90, 0x50, 0x90, 0x28, 0x80, 0x32, 0xab, 0x80, 0x32, 0xad, 0x10, 0x10, 
-0x80, 0x32, 0xac, 0xe4, 0xe1, 0x47, 0x80, 0x35, 0x32, 0x88, 0x00, 0xb0, 
+0x80, 0x32, 0xac, 0xe4, 0xe1, 0x46, 0x40, 0x35, 0x2d, 0x88, 0x00, 0xb0, 
 0x10, 0x10, 0x10, 0x10, 0x90, 0x50, 0x90, 0x28, 0x80, 0x32, 0xa8, 0x80, 
-0x32, 0xaa, 0x10, 0x10, 0x80, 0x32, 0xa9, 0xe4, 0xe1, 0x37, 0x80, 0x34, 
-0xe8, 0x96, 0xe8, 0x94, 0x80, 0x9a, 0x30, 0x04, 0x40, 0x91, 0x10, 0x90, 
+0x32, 0xaa, 0x10, 0x10, 0x80, 0x32, 0xa9, 0xe4, 0xe1, 0x36, 0x40, 0x34, 
+0xe3, 0x96, 0xe8, 0x94, 0x80, 0x9a, 0x30, 0x04, 0x40, 0x91, 0x10, 0x90, 
 0x88, 0x90, 0x50, 0x90, 0x28, 0x80, 0x32, 0xf6, 0x80, 0x32, 0xfb, 0x10, 
 0x10, 0x80, 0x32, 0xfa, 0x90, 0x50, 0x90, 0x28, 0x80, 0x32, 0xdb, 0x80, 
 0x32, 0xe0, 0x10, 0x10, 0x80, 0x32, 0xdf, 0x90, 0x88, 0x90, 0x50, 0x90, 
@@ -4506,50 +4736,50 @@
 0x90, 0x28, 0x80, 0x32, 0xd8, 0x80, 0x32, 0xda, 0x10, 0x10, 0x80, 0x32, 
 0xd9, 0x90, 0x88, 0x90, 0x50, 0x90, 0x28, 0x80, 0x32, 0xbd, 0x80, 0x32, 
 0xbf, 0x10, 0x10, 0x80, 0x32, 0xbe, 0x90, 0x50, 0x90, 0x28, 0x80, 0x32, 
-0x9f, 0x80, 0x32, 0xa1, 0x10, 0x10, 0x80, 0x32, 0xa0, 0xe4, 0xe1, 0x46, 
-0x80, 0x35, 0x2e, 0x88, 0x02, 0x28, 0x91, 0x10, 0x90, 0x88, 0x90, 0x50, 
+0x9f, 0x80, 0x32, 0xa1, 0x10, 0x10, 0x80, 0x32, 0xa0, 0xe4, 0xe1, 0x45, 
+0x40, 0x35, 0x29, 0x88, 0x02, 0x28, 0x91, 0x10, 0x90, 0x88, 0x90, 0x50, 
 0x90, 0x28, 0x80, 0x32, 0xf7, 0x80, 0x32, 0xf9, 0x10, 0x10, 0x80, 0x32, 
 0xf8, 0x90, 0x50, 0x90, 0x28, 0x80, 0x32, 0xdc, 0x80, 0x32, 0xde, 0x10, 
 0x10, 0x80, 0x32, 0xdd, 0x90, 0x88, 0x90, 0x50, 0x90, 0x28, 0x80, 0x32, 
 0xc1, 0x80, 0x32, 0xc3, 0x10, 0x10, 0x80, 0x32, 0xc2, 0x90, 0x50, 0x90, 
 0x28, 0x80, 0x32, 0xa3, 0x80, 0x32, 0xa5, 0x10, 0x10, 0x80, 0x32, 0xa4, 
-0xe4, 0xe1, 0x37, 0x00, 0x34, 0xe6, 0x90, 0x40, 0xe5, 0x21, 0x45, 0x80, 
-0x35, 0x2a, 0xe5, 0x21, 0x36, 0x80, 0x34, 0xe4, 0x9e, 0xb4, 0x20, 0x08, 
+0xe4, 0xe1, 0x35, 0xc0, 0x34, 0xe1, 0x90, 0x40, 0xe5, 0x21, 0x44, 0x40, 
+0x35, 0x25, 0xe5, 0x21, 0x35, 0x40, 0x34, 0xdf, 0x9e, 0xb4, 0x20, 0x08, 
 0x93, 0x70, 0x91, 0xd8, 0xd5, 0x07, 0x80, 0xd0, 0xc4, 0x40, 0x90, 0x48, 
-0x80, 0x8c, 0x36, 0xe0, 0x84, 0x36, 0xe6, 0xa4, 0x34, 0xc0, 0x36, 0xb0, 
-0x90, 0x28, 0x24, 0x34, 0x00, 0xa4, 0x32, 0x80, 0x36, 0x68, 0xd0, 0xc4, 
-0x40, 0x90, 0x48, 0x80, 0x8c, 0x36, 0xc0, 0x84, 0x36, 0xe4, 0xa4, 0x34, 
-0xb0, 0x36, 0xae, 0x90, 0x28, 0x24, 0x33, 0xf0, 0xa4, 0x32, 0x70, 0x36, 
-0x66, 0xd5, 0x06, 0x80, 0xd0, 0xc3, 0x40, 0x90, 0x28, 0x80, 0x36, 0xd0, 
-0xa4, 0x34, 0x90, 0x36, 0xaa, 0x90, 0x28, 0x24, 0x33, 0xd0, 0xa4, 0x32, 
-0x50, 0x36, 0x62, 0xd0, 0xc3, 0x40, 0x90, 0x28, 0x80, 0x36, 0xcc, 0xa4, 
-0x34, 0x80, 0x36, 0xa8, 0x90, 0x28, 0x24, 0x33, 0xc0, 0xa4, 0x32, 0x40, 
-0x36, 0x60, 0x91, 0x98, 0xd5, 0x06, 0x80, 0xd0, 0xc3, 0x40, 0x90, 0x28, 
-0x80, 0x36, 0xc4, 0xa4, 0x34, 0x60, 0x36, 0xa4, 0x90, 0x28, 0x24, 0x33, 
-0xa0, 0xa4, 0x32, 0x20, 0x36, 0x5c, 0xd0, 0xc3, 0x40, 0x90, 0x28, 0x80, 
-0x36, 0xc0, 0xa4, 0x34, 0x50, 0x36, 0xa2, 0x90, 0x28, 0x24, 0x33, 0x90, 
-0xa4, 0x32, 0x10, 0x36, 0x5a, 0xd5, 0x06, 0x80, 0xd0, 0xc3, 0x40, 0x90, 
-0x28, 0x80, 0x36, 0xb8, 0xa4, 0x34, 0x30, 0x36, 0x9e, 0x90, 0x28, 0x24, 
-0x33, 0x70, 0xa4, 0x31, 0xf0, 0x36, 0x56, 0xd0, 0xc3, 0x40, 0x90, 0x28, 
-0x80, 0x36, 0xb4, 0xa4, 0x34, 0x20, 0x36, 0x9c, 0x90, 0x28, 0x24, 0x33, 
-0x60, 0xa4, 0x31, 0xe0, 0x36, 0x54, 0x93, 0x70, 0x91, 0xd8, 0xd5, 0x07, 
-0x80, 0xd0, 0xc4, 0x40, 0x90, 0x48, 0x80, 0x8c, 0x37, 0x00, 0x84, 0x36, 
-0xe8, 0xa4, 0x34, 0xd0, 0x36, 0xb2, 0x90, 0x28, 0x24, 0x34, 0x10, 0xa4, 
-0x32, 0x90, 0x36, 0x6a, 0xd0, 0xc4, 0x40, 0x90, 0x48, 0x80, 0x8c, 0x36, 
-0xd0, 0x84, 0x36, 0xe5, 0xa4, 0x34, 0xb8, 0x36, 0xaf, 0x90, 0x28, 0x24, 
-0x33, 0xf8, 0xa4, 0x32, 0x78, 0x36, 0x67, 0xd5, 0x06, 0x80, 0xd0, 0xc3, 
-0x40, 0x90, 0x28, 0x80, 0x36, 0xd4, 0xa4, 0x34, 0xa0, 0x36, 0xac, 0x90, 
-0x28, 0x24, 0x33, 0xe0, 0xa4, 0x32, 0x60, 0x36, 0x64, 0xd0, 0xc3, 0x40, 
-0x90, 0x28, 0x80, 0x36, 0xce, 0xa4, 0x34, 0x88, 0x36, 0xa9, 0x90, 0x28, 
-0x24, 0x33, 0xc8, 0xa4, 0x32, 0x48, 0x36, 0x61, 0x91, 0x98, 0xd5, 0x06, 
-0x80, 0xd0, 0xc3, 0x40, 0x90, 0x28, 0x80, 0x36, 0xc8, 0xa4, 0x34, 0x70, 
-0x36, 0xa6, 0x90, 0x28, 0x24, 0x33, 0xb0, 0xa4, 0x32, 0x30, 0x36, 0x5e, 
-0xd0, 0xc3, 0x40, 0x90, 0x28, 0x80, 0x36, 0xc2, 0xa4, 0x34, 0x58, 0x36, 
-0xa3, 0x90, 0x28, 0x24, 0x33, 0x98, 0xa4, 0x32, 0x18, 0x36, 0x5b, 0xd5, 
-0x06, 0x80, 0xd0, 0xc3, 0x40, 0x90, 0x28, 0x80, 0x36, 0xbc, 0xa4, 0x34, 
-0x40, 0x36, 0xa0, 0x90, 0x28, 0x24, 0x33, 0x80, 0xa4, 0x32, 0x00, 0x36, 
-0x58, 0xd0, 0xc3, 0x40, 0x90, 0x28, 0x80, 0x36, 0xb6, 0xa4, 0x34, 0x28, 
-0x36, 0x9d, 0x90, 0x28, 0x24, 0x33, 0x68, 0xa4, 0x31, 0xe8, 0x36, 0x55, 
+0x80, 0x8c, 0x37, 0x58, 0x84, 0x36, 0xf5, 0xa4, 0x35, 0x38, 0x36, 0xbf, 
+0x90, 0x28, 0x24, 0x34, 0x78, 0xa4, 0x32, 0xf8, 0x36, 0x77, 0xd0, 0xc4, 
+0x40, 0x90, 0x48, 0x80, 0x8c, 0x37, 0x38, 0x84, 0x36, 0xf3, 0xa4, 0x35, 
+0x28, 0x36, 0xbd, 0x90, 0x28, 0x24, 0x34, 0x68, 0xa4, 0x32, 0xe8, 0x36, 
+0x75, 0xd5, 0x06, 0x80, 0xd0, 0xc3, 0x40, 0x90, 0x28, 0x80, 0x36, 0xdf, 
+0xa4, 0x35, 0x08, 0x36, 0xb9, 0x90, 0x28, 0x24, 0x34, 0x48, 0xa4, 0x32, 
+0xc8, 0x36, 0x71, 0xd0, 0xc3, 0x40, 0x90, 0x28, 0x80, 0x36, 0xdb, 0xa4, 
+0x34, 0xf8, 0x36, 0xb7, 0x90, 0x28, 0x24, 0x34, 0x38, 0xa4, 0x32, 0xb8, 
+0x36, 0x6f, 0x91, 0x98, 0xd5, 0x06, 0x80, 0xd0, 0xc3, 0x40, 0x90, 0x28, 
+0x80, 0x36, 0xd3, 0xa4, 0x34, 0xd8, 0x36, 0xb3, 0x90, 0x28, 0x24, 0x34, 
+0x18, 0xa4, 0x32, 0x98, 0x36, 0x6b, 0xd0, 0xc3, 0x40, 0x90, 0x28, 0x80, 
+0x36, 0xcf, 0xa4, 0x34, 0xc8, 0x36, 0xb1, 0x90, 0x28, 0x24, 0x34, 0x08, 
+0xa4, 0x32, 0x88, 0x36, 0x69, 0xd5, 0x06, 0x80, 0xd0, 0xc3, 0x40, 0x90, 
+0x28, 0x80, 0x36, 0xc7, 0xa4, 0x34, 0xa8, 0x36, 0xad, 0x90, 0x28, 0x24, 
+0x33, 0xe8, 0xa4, 0x32, 0x68, 0x36, 0x65, 0xd0, 0xc3, 0x40, 0x90, 0x28, 
+0x80, 0x36, 0xc3, 0xa4, 0x34, 0x98, 0x36, 0xab, 0x90, 0x28, 0x24, 0x33, 
+0xd8, 0xa4, 0x32, 0x58, 0x36, 0x63, 0x93, 0x70, 0x91, 0xd8, 0xd5, 0x07, 
+0x80, 0xd0, 0xc4, 0x40, 0x90, 0x48, 0x80, 0x8c, 0x37, 0x78, 0x84, 0x36, 
+0xf7, 0xa4, 0x35, 0x48, 0x36, 0xc1, 0x90, 0x28, 0x24, 0x34, 0x88, 0xa4, 
+0x33, 0x08, 0x36, 0x79, 0xd0, 0xc4, 0x40, 0x90, 0x48, 0x80, 0x8c, 0x37, 
+0x48, 0x84, 0x36, 0xf4, 0xa4, 0x35, 0x30, 0x36, 0xbe, 0x90, 0x28, 0x24, 
+0x34, 0x70, 0xa4, 0x32, 0xf0, 0x36, 0x76, 0xd5, 0x06, 0x80, 0xd0, 0xc3, 
+0x40, 0x90, 0x28, 0x80, 0x36, 0xe3, 0xa4, 0x35, 0x18, 0x36, 0xbb, 0x90, 
+0x28, 0x24, 0x34, 0x58, 0xa4, 0x32, 0xd8, 0x36, 0x73, 0xd0, 0xc3, 0x40, 
+0x90, 0x28, 0x80, 0x36, 0xdd, 0xa4, 0x35, 0x00, 0x36, 0xb8, 0x90, 0x28, 
+0x24, 0x34, 0x40, 0xa4, 0x32, 0xc0, 0x36, 0x70, 0x91, 0x98, 0xd5, 0x06, 
+0x80, 0xd0, 0xc3, 0x40, 0x90, 0x28, 0x80, 0x36, 0xd7, 0xa4, 0x34, 0xe8, 
+0x36, 0xb5, 0x90, 0x28, 0x24, 0x34, 0x28, 0xa4, 0x32, 0xa8, 0x36, 0x6d, 
+0xd0, 0xc3, 0x40, 0x90, 0x28, 0x80, 0x36, 0xd1, 0xa4, 0x34, 0xd0, 0x36, 
+0xb2, 0x90, 0x28, 0x24, 0x34, 0x10, 0xa4, 0x32, 0x90, 0x36, 0x6a, 0xd5, 
+0x06, 0x80, 0xd0, 0xc3, 0x40, 0x90, 0x28, 0x80, 0x36, 0xcb, 0xa4, 0x34, 
+0xb8, 0x36, 0xaf, 0x90, 0x28, 0x24, 0x33, 0xf8, 0xa4, 0x32, 0x78, 0x36, 
+0x67, 0xd0, 0xc3, 0x40, 0x90, 0x28, 0x80, 0x36, 0xc5, 0xa4, 0x34, 0xa0, 
+0x36, 0xac, 0x90, 0x28, 0x24, 0x33, 0xe0, 0xa4, 0x32, 0x60, 0x36, 0x64, 
 0x99, 0x08, 0x01, 0xf0, 0x81, 0x90, 0x78, 0xd4, 0xc2, 0x00, 0xa4, 0x1f, 
 0xb0, 0x33, 0xee, 0xa4, 0x1f, 0x30, 0x33, 0xde, 0xd4, 0xc2, 0x00, 0xa4, 
 0x1f, 0x40, 0x33, 0xf0, 0xa4, 0x1e, 0xc0, 0x33, 0xe0, 0x81, 0x90, 0x78, 
@@ -4564,7 +4794,7 @@
 0x24, 0x12, 0xa0, 0x90, 0x38, 0xa4, 0x11, 0xd0, 0x32, 0x38, 0x24, 0x11, 
 0xc8, 0x90, 0x60, 0x90, 0x38, 0xa4, 0x10, 0xf8, 0x32, 0x1d, 0x24, 0x10, 
 0xf0, 0x90, 0x38, 0xa4, 0x10, 0x20, 0x32, 0x02, 0x24, 0x10, 0x18, 0xe4, 
-0xe1, 0x8d, 0x80, 0x36, 0x38, 0x99, 0x90, 0x03, 0x00, 0x90, 0xc0, 0x90, 
+0xe1, 0x91, 0x40, 0x36, 0x47, 0x99, 0x90, 0x03, 0x00, 0x90, 0xc0, 0x90, 
 0x60, 0x90, 0x38, 0xa4, 0x12, 0x90, 0x32, 0x50, 0x24, 0x12, 0x88, 0x90, 
 0x38, 0xa4, 0x11, 0xb8, 0x32, 0x35, 0x24, 0x11, 0xb0, 0x90, 0x60, 0x90, 
 0x38, 0xa4, 0x10, 0xe0, 0x32, 0x1a, 0x24, 0x10, 0xd8, 0x90, 0x38, 0xa4, 
@@ -4572,7 +4802,7 @@
 0x38, 0xa4, 0x12, 0x78, 0x32, 0x4d, 0x24, 0x12, 0x70, 0x90, 0x38, 0xa4, 
 0x11, 0xa0, 0x32, 0x32, 0x24, 0x11, 0x98, 0x90, 0x60, 0x90, 0x38, 0xa4, 
 0x10, 0xc8, 0x32, 0x17, 0x24, 0x10, 0xc0, 0x90, 0x38, 0xa4, 0x0f, 0xf0, 
-0x31, 0xfc, 0x24, 0x0f, 0xe8, 0xe4, 0xe1, 0x8c, 0x00, 0x36, 0x32, 0x93, 
+0x31, 0xfc, 0x24, 0x0f, 0xe8, 0xe4, 0xe1, 0x8f, 0xc0, 0x36, 0x41, 0x93, 
 0x78, 0x99, 0x90, 0x03, 0x00, 0x90, 0xc0, 0x90, 0x60, 0x90, 0x38, 0xa4, 
 0x12, 0x60, 0x32, 0x4a, 0x24, 0x12, 0x58, 0x90, 0x38, 0xa4, 0x11, 0x88, 
 0x32, 0x2f, 0x24, 0x11, 0x80, 0x90, 0x60, 0x90, 0x38, 0xa4, 0x10, 0xb0, 
@@ -4581,10 +4811,10 @@
 0x32, 0x47, 0x24, 0x12, 0x40, 0x90, 0x38, 0xa4, 0x11, 0x70, 0x32, 0x2c, 
 0x24, 0x11, 0x68, 0x90, 0x60, 0x90, 0x38, 0xa4, 0x10, 0x98, 0x32, 0x11, 
 0x24, 0x10, 0x90, 0x90, 0x38, 0xa4, 0x0f, 0xc0, 0x31, 0xf6, 0x24, 0x0f, 
-0xb8, 0xec, 0xa0, 0xff, 0x00, 0x02, 0x00, 0x33, 0xfe, 0xa4, 0x31, 0x50, 
-0x36, 0x2c, 0x88, 0x00, 0x88, 0x10, 0x10, 0x10, 0x10, 0x90, 0x38, 0xa4, 
+0xb8, 0xec, 0xa0, 0xff, 0x00, 0x02, 0x00, 0x33, 0xfe, 0xa4, 0x31, 0xc8, 
+0x36, 0x3b, 0x88, 0x00, 0x88, 0x10, 0x10, 0x10, 0x10, 0x90, 0x38, 0xa4, 
 0x0f, 0xa8, 0x31, 0xf3, 0x24, 0x0f, 0xa0, 0xe9, 0x60, 0xfe, 0x40, 0x02, 
-0x00, 0x33, 0xfa, 0xe3, 0x61, 0x89, 0x00, 0x36, 0x26, 0x95, 0x08, 0x93, 
+0x00, 0x33, 0xfa, 0xe3, 0x61, 0x8c, 0xc0, 0x36, 0x35, 0x95, 0x08, 0x93, 
 0x40, 0x99, 0x90, 0x03, 0x00, 0x90, 0xc0, 0x90, 0x60, 0x90, 0x38, 0xa4, 
 0x12, 0x30, 0x32, 0x41, 0x24, 0x12, 0x28, 0x90, 0x38, 0xa4, 0x11, 0x58, 
 0x32, 0x26, 0x24, 0x11, 0x50, 0x90, 0x60, 0x90, 0x38, 0xa4, 0x10, 0x80, 
@@ -4593,22 +4823,22 @@
 0x32, 0x3e, 0x24, 0x11, 0xf8, 0x90, 0x38, 0xa4, 0x11, 0x28, 0x32, 0x23, 
 0x24, 0x11, 0x20, 0x90, 0x60, 0x90, 0x38, 0xa4, 0x10, 0x50, 0x32, 0x08, 
 0x24, 0x10, 0x48, 0x90, 0x38, 0xa4, 0x0f, 0x60, 0x31, 0xea, 0x24, 0x0f, 
-0x58, 0xe4, 0xe1, 0x8d, 0xc0, 0x36, 0x3a, 0x88, 0x01, 0x88, 0x90, 0xc0, 
+0x58, 0xe4, 0xe1, 0x91, 0x80, 0x36, 0x49, 0x88, 0x01, 0x88, 0x90, 0xc0, 
 0x90, 0x60, 0x90, 0x38, 0xa4, 0x12, 0x20, 0x32, 0x42, 0x24, 0x12, 0x18, 
 0x90, 0x38, 0xa4, 0x11, 0x48, 0x32, 0x27, 0x24, 0x11, 0x40, 0x90, 0x60, 
 0x90, 0x38, 0xa4, 0x10, 0x70, 0x32, 0x0c, 0x24, 0x10, 0x68, 0x90, 0x38, 
-0xa4, 0x0f, 0x80, 0x31, 0xee, 0x24, 0x0f, 0x78, 0xe4, 0xe1, 0x8c, 0x40, 
-0x36, 0x34, 0x92, 0xd0, 0x99, 0x50, 0x02, 0x80, 0x90, 0xa0, 0x90, 0x50, 
+0xa4, 0x0f, 0x80, 0x31, 0xee, 0x24, 0x0f, 0x78, 0xe4, 0xe1, 0x90, 0x00, 
+0x36, 0x43, 0x92, 0xd0, 0x99, 0x50, 0x02, 0x80, 0x90, 0xa0, 0x90, 0x50, 
 0x90, 0x28, 0x80, 0x31, 0xe9, 0x24, 0x0f, 0x40, 0x90, 0x28, 0x80, 0x31, 
 0xe5, 0x24, 0x0f, 0x20, 0x90, 0x50, 0x90, 0x28, 0x80, 0x31, 0xe1, 0x24, 
 0x0f, 0x00, 0x90, 0x28, 0x80, 0x31, 0xdd, 0x24, 0x0e, 0xe0, 0x90, 0xa0, 
 0x90, 0x50, 0x90, 0x28, 0x80, 0x31, 0xe6, 0x24, 0x0f, 0x38, 0x90, 0x28, 
 0x80, 0x31, 0xe2, 0x24, 0x0f, 0x18, 0x90, 0x50, 0x90, 0x28, 0x80, 0x31, 
 0xde, 0x24, 0x0e, 0xf8, 0x90, 0x28, 0x80, 0x31, 0xda, 0x24, 0x0e, 0xd8, 
-0xec, 0xe1, 0x8a, 0xe1, 0x00, 0x00, 0x36, 0x2e, 0x88, 0x00, 0x78, 0x10, 
+0xec, 0xe1, 0x8e, 0xa1, 0x00, 0x00, 0x36, 0x3d, 0x88, 0x00, 0x78, 0x10, 
 0x10, 0x10, 0x10, 0x90, 0x28, 0x80, 0x31, 0xd8, 0x24, 0x0e, 0xc8, 0xec, 
-0xe1, 0x89, 0x60, 0xfe, 0x00, 0x36, 0x28, 0xe5, 0xa1, 0x36, 0x00, 0x34, 
-0xd6, 0xa0, 0x2a, 0x10, 0xa8, 0x16, 0x60, 0x29, 0xd8, 0xa0, 0x0c, 0x48, 
+0xe1, 0x8d, 0x20, 0xfe, 0x00, 0x36, 0x37, 0xe5, 0xa1, 0x34, 0xc0, 0x34, 
+0xd1, 0xa0, 0x2a, 0x10, 0xa8, 0x16, 0x60, 0x29, 0xd8, 0xa0, 0x0c, 0x48, 
 0xa0, 0x0a, 0xc8, 0x95, 0x60, 0x92, 0xb0, 0x91, 0x40, 0x90, 0x88, 0x90, 
 0x50, 0x90, 0x28, 0x80, 0x31, 0xa1, 0x80, 0x31, 0xa0, 0x10, 0x10, 0x80, 
 0x31, 0x9f, 0x90, 0x70, 0x90, 0x38, 0xa4, 0x08, 0x98, 0x31, 0xb3, 0xa4, 
@@ -4758,7 +4988,7 @@
 0x30, 0x9c, 0x24, 0x04, 0xe8, 0x90, 0x38, 0xa4, 0x04, 0x60, 0x30, 0x8a, 
 0x24, 0x04, 0x58, 0x10, 0x10, 0x80, 0x10, 0x10, 0x10, 0x10, 0x90, 0x38, 
 0xa4, 0x02, 0xf8, 0x30, 0x5d, 0x24, 0x02, 0xf0, 0xd7, 0x42, 0x00, 0xa4, 
-0x31, 0x00, 0x36, 0x22, 0xa4, 0x30, 0xe0, 0x36, 0x1e, 0x9c, 0xe0, 0x06, 
+0x31, 0x78, 0x36, 0x31, 0xa4, 0x31, 0x58, 0x36, 0x2d, 0x9c, 0xe0, 0x06, 
 0x90, 0x93, 0x00, 0x91, 0x80, 0x90, 0xc0, 0x90, 0x60, 0x90, 0x38, 0xa4, 
 0x03, 0x28, 0x30, 0x63, 0x24, 0x03, 0x20, 0x90, 0x38, 0xa4, 0x03, 0xb8, 
 0x30, 0x75, 0x24, 0x03, 0xb0, 0x90, 0x60, 0x90, 0x38, 0xa4, 0x04, 0xd8, 
@@ -4776,116 +5006,114 @@
 0x90, 0x28, 0x80, 0x30, 0x58, 0x24, 0x02, 0xb8, 0x90, 0x50, 0x90, 0x28, 
 0x80, 0x30, 0x5c, 0x24, 0x02, 0xd8, 0x90, 0x28, 0x80, 0x30, 0x5a, 0x24, 
 0x02, 0xc8, 0x80, 0x10, 0x10, 0x10, 0x10, 0x90, 0x28, 0x80, 0x30, 0x53, 
-0x24, 0x02, 0xa0, 0xd7, 0x42, 0x00, 0xa4, 0x31, 0x08, 0x36, 0x23, 0xa4, 
-0x30, 0xe8, 0x36, 0x1f, 0xa0, 0x15, 0x40, 0xa0, 0x10, 0xb8, 0xa0, 0x0c, 
+0x24, 0x02, 0xa0, 0xd7, 0x42, 0x00, 0xa4, 0x31, 0x80, 0x36, 0x32, 0xa4, 
+0x31, 0x60, 0x36, 0x2e, 0xa0, 0x14, 0x90, 0xa0, 0x10, 0xb8, 0xa0, 0x0c, 
 0x88, 0x9e, 0x88, 0x09, 0xd0, 0x94, 0xf0, 0x90, 0xb0, 0x88, 0x00, 0x68, 
-0x84, 0x10, 0x10, 0xc9, 0xe1, 0x2d, 0x80, 0x85, 0x34, 0xd2, 0xcb, 0x61, 
-0x26, 0x40, 0x85, 0x34, 0xa8, 0x9a, 0x00, 0x03, 0xf8, 0x91, 0x98, 0x80, 
-0x91, 0x10, 0x90, 0xa0, 0x90, 0x68, 0x90, 0x20, 0x38, 0x57, 0xc9, 0xe2, 
-0x15, 0x40, 0x85, 0x34, 0xd0, 0xa4, 0x42, 0x98, 0x38, 0x54, 0x90, 0x38, 
-0xa4, 0x42, 0x60, 0x38, 0x4d, 0xa4, 0x42, 0x50, 0x38, 0x4b, 0x90, 0x48, 
-0x10, 0x10, 0xa4, 0x42, 0x18, 0x38, 0x44, 0x10, 0x10, 0x80, 0x38, 0x40, 
-0x81, 0x10, 0x10, 0x80, 0xa4, 0x41, 0xe8, 0x38, 0x3e, 0x91, 0xb0, 0x91, 
-0x60, 0x90, 0xe0, 0x90, 0x70, 0x90, 0x38, 0xa4, 0x42, 0x88, 0x38, 0x52, 
-0xa4, 0x42, 0x78, 0x38, 0x50, 0x90, 0x38, 0xa4, 0x42, 0x40, 0x38, 0x49, 
-0xa4, 0x42, 0x30, 0x38, 0x47, 0x90, 0x48, 0x10, 0x10, 0xa4, 0x42, 0x08, 
-0x38, 0x42, 0x10, 0x10, 0x80, 0x38, 0x3f, 0x90, 0x28, 0x80, 0x38, 0x38, 
-0x80, 0x38, 0x37, 0x81, 0x10, 0x10, 0x80, 0xa4, 0x41, 0xd8, 0x38, 0x3c, 
-0xcb, 0x61, 0x26, 0x00, 0x85, 0x34, 0xa7, 0x90, 0xd8, 0x88, 0x00, 0x90, 
-0x84, 0x90, 0x38, 0xc1, 0xc0, 0x85, 0x38, 0x5b, 0xc9, 0xe1, 0x2d, 0x40, 
-0x85, 0x34, 0xce, 0xcb, 0x61, 0x25, 0xc0, 0x85, 0x34, 0xa6, 0x88, 0x00, 
-0x68, 0x84, 0x10, 0x10, 0xc9, 0xe1, 0x2d, 0x00, 0x85, 0x34, 0xcc, 0xcb, 
-0x61, 0x25, 0x80, 0x85, 0x34, 0xa5, 0x91, 0xf8, 0x90, 0xb0, 0x88, 0x00, 
-0x68, 0x84, 0x10, 0x10, 0xc9, 0xe1, 0x2c, 0x80, 0x85, 0x34, 0xc8, 0xcb, 
-0x61, 0x25, 0x00, 0x85, 0x34, 0xa3, 0x88, 0x01, 0x00, 0x90, 0xa0, 0x81, 
-0x90, 0x70, 0x80, 0x90, 0x20, 0x38, 0x4e, 0xc9, 0xe1, 0x2c, 0x40, 0x85, 
-0x34, 0xc6, 0x81, 0x38, 0x45, 0x81, 0x10, 0x10, 0x80, 0xa4, 0x41, 0xc8, 
-0x38, 0x3a, 0xcb, 0x61, 0x24, 0xc0, 0x85, 0x34, 0xa2, 0x90, 0xb0, 0x88, 
-0x00, 0x68, 0x84, 0x10, 0x10, 0xc9, 0xe1, 0x2c, 0x00, 0x85, 0x34, 0xc4, 
-0xcb, 0x61, 0x24, 0x80, 0x85, 0x34, 0xa1, 0x88, 0x00, 0x68, 0x84, 0x10, 
-0x10, 0xc9, 0xe1, 0x2b, 0xc0, 0x85, 0x34, 0xc2, 0xcb, 0x61, 0x24, 0x40, 
-0x85, 0x34, 0xa0, 0x92, 0x38, 0x81, 0x91, 0x68, 0x91, 0x18, 0x90, 0x80, 
-0x90, 0x40, 0x80, 0xa4, 0x43, 0x50, 0x38, 0x6b, 0x80, 0xa4, 0x43, 0x48, 
-0x38, 0x68, 0x90, 0x28, 0x81, 0x38, 0x67, 0x90, 0x38, 0xa4, 0x43, 0x28, 
-0x38, 0x66, 0xa4, 0x43, 0x18, 0x38, 0x64, 0x90, 0x28, 0x80, 0x38, 0x62, 
-0x80, 0x38, 0x61, 0x80, 0x90, 0x40, 0x10, 0x10, 0x80, 0x24, 0x43, 0x00, 
-0x10, 0x10, 0x90, 0x38, 0xa4, 0x42, 0xf0, 0x38, 0x5f, 0xa4, 0x42, 0xe0, 
-0x38, 0x5d, 0x90, 0x50, 0x80, 0xc9, 0xa2, 0x16, 0x40, 0x85, 0x38, 0x5a, 
-0x80, 0x38, 0x58, 0x9a, 0xd0, 0x03, 0xe0, 0x91, 0x60, 0x90, 0xb0, 0x88, 
-0x00, 0x68, 0x84, 0x10, 0x10, 0xc9, 0xe1, 0x2b, 0x40, 0x85, 0x34, 0xbe, 
-0xcb, 0x61, 0x23, 0xc0, 0x85, 0x34, 0x9e, 0x88, 0x00, 0x68, 0x84, 0x10, 
-0x10, 0xc9, 0xe1, 0x2b, 0x00, 0x85, 0x34, 0xbc, 0xcb, 0x61, 0x23, 0x80, 
-0x85, 0x34, 0x9d, 0x90, 0xb0, 0x88, 0x00, 0x68, 0x84, 0x10, 0x10, 0xc9, 
-0xe1, 0x2a, 0xc0, 0x85, 0x34, 0xba, 0xcb, 0x61, 0x23, 0x40, 0x85, 0x34, 
-0x9c, 0x88, 0x00, 0x68, 0x84, 0x10, 0x10, 0xc9, 0xe1, 0x2a, 0x80, 0x85, 
-0x34, 0xb8, 0xcb, 0x61, 0x23, 0x00, 0x85, 0x34, 0x9b, 0x90, 0x90, 0x90, 
-0x48, 0xcb, 0xa1, 0x21, 0x40, 0x85, 0x34, 0x8a, 0xcb, 0xa1, 0x21, 0x00, 
-0x85, 0x34, 0x89, 0x90, 0x48, 0xcb, 0xa1, 0x20, 0xc0, 0x85, 0x34, 0x88, 
-0xcb, 0xa1, 0x20, 0x80, 0x85, 0x34, 0x87, 0xcb, 0xa2, 0x0d, 0x40, 0x80, 
-0x38, 0x36, 0x92, 0x40, 0x91, 0x20, 0x90, 0x90, 0x90, 0x48, 0x8c, 0x23, 
-0x88, 0x84, 0x24, 0x24, 0x00, 0x8c, 0x23, 0x80, 0x84, 0x24, 0x23, 0xf8, 
-0x90, 0x48, 0x8c, 0x23, 0x78, 0x84, 0x24, 0x23, 0xf0, 0x8c, 0x23, 0x70, 
-0x84, 0x24, 0x23, 0xe8, 0x90, 0x90, 0x90, 0x48, 0x8c, 0x23, 0x60, 0x84, 
-0x24, 0x23, 0xd8, 0x8c, 0x23, 0x58, 0x84, 0x24, 0x23, 0xd0, 0x90, 0x48, 
-0x8c, 0x23, 0x50, 0x84, 0x24, 0x23, 0xc8, 0x8c, 0x23, 0x48, 0x84, 0x24, 
-0x23, 0xc0, 0x91, 0x20, 0x90, 0x90, 0x90, 0x48, 0x8c, 0x23, 0x38, 0x84, 
+0x84, 0x10, 0x10, 0xc9, 0xe1, 0x2c, 0x40, 0x85, 0x34, 0xcd, 0xcb, 0x61, 
+0x25, 0x00, 0x85, 0x34, 0xa3, 0x9a, 0x00, 0x03, 0xf8, 0x91, 0x98, 0x80, 
+0x91, 0x10, 0x90, 0xa0, 0x90, 0x68, 0x90, 0x20, 0x38, 0x66, 0xc9, 0xe2, 
+0x19, 0x00, 0x85, 0x34, 0xcb, 0xa4, 0x43, 0x10, 0x38, 0x63, 0x90, 0x38, 
+0xa4, 0x42, 0xd8, 0x38, 0x5c, 0xa4, 0x42, 0xc8, 0x38, 0x5a, 0x90, 0x48, 
+0x10, 0x10, 0xa4, 0x42, 0x90, 0x38, 0x53, 0x10, 0x10, 0x80, 0x38, 0x4f, 
+0x81, 0x10, 0x10, 0x80, 0xa4, 0x42, 0x60, 0x38, 0x4d, 0x91, 0xb0, 0x91, 
+0x60, 0x90, 0xe0, 0x90, 0x70, 0x90, 0x38, 0xa4, 0x43, 0x00, 0x38, 0x61, 
+0xa4, 0x42, 0xf0, 0x38, 0x5f, 0x90, 0x38, 0xa4, 0x42, 0xb8, 0x38, 0x58, 
+0xa4, 0x42, 0xa8, 0x38, 0x56, 0x90, 0x48, 0x10, 0x10, 0xa4, 0x42, 0x80, 
+0x38, 0x51, 0x10, 0x10, 0x80, 0x38, 0x4e, 0x90, 0x28, 0x80, 0x38, 0x47, 
+0x80, 0x38, 0x46, 0x81, 0x10, 0x10, 0x80, 0xa4, 0x42, 0x50, 0x38, 0x4b, 
+0xcb, 0x61, 0x24, 0xc0, 0x85, 0x34, 0xa2, 0x90, 0xd8, 0x88, 0x00, 0x90, 
+0x84, 0x90, 0x38, 0xc1, 0xc0, 0x85, 0x38, 0x6a, 0xc9, 0xe1, 0x2c, 0x00, 
+0x85, 0x34, 0xc9, 0xcb, 0x61, 0x24, 0x80, 0x85, 0x34, 0xa1, 0x88, 0x00, 
+0x68, 0x84, 0x10, 0x10, 0xc9, 0xe1, 0x2b, 0xc0, 0x85, 0x34, 0xc7, 0xcb, 
+0x61, 0x24, 0x40, 0x85, 0x34, 0xa0, 0x91, 0xf8, 0x90, 0xb0, 0x88, 0x00, 
+0x68, 0x84, 0x10, 0x10, 0xc9, 0xe1, 0x2b, 0x40, 0x85, 0x34, 0xc3, 0xcb, 
+0x61, 0x23, 0xc0, 0x85, 0x34, 0x9e, 0x88, 0x01, 0x00, 0x90, 0xa0, 0x81, 
+0x90, 0x70, 0x80, 0x90, 0x20, 0x38, 0x5d, 0xc9, 0xe1, 0x2b, 0x00, 0x85, 
+0x34, 0xc1, 0x81, 0x38, 0x54, 0x81, 0x10, 0x10, 0x80, 0xa4, 0x42, 0x40, 
+0x38, 0x49, 0xcb, 0x61, 0x23, 0x80, 0x85, 0x34, 0x9d, 0x90, 0xb0, 0x88, 
+0x00, 0x68, 0x84, 0x10, 0x10, 0xc9, 0xe1, 0x2a, 0xc0, 0x85, 0x34, 0xbf, 
+0xcb, 0x61, 0x23, 0x40, 0x85, 0x34, 0x9c, 0x88, 0x00, 0x68, 0x84, 0x10, 
+0x10, 0xc9, 0xe1, 0x2a, 0x80, 0x85, 0x34, 0xbd, 0xcb, 0x61, 0x23, 0x00, 
+0x85, 0x34, 0x9b, 0x92, 0x38, 0x81, 0x91, 0x68, 0x91, 0x18, 0x90, 0x80, 
+0x90, 0x40, 0x80, 0xa4, 0x43, 0xc8, 0x38, 0x7a, 0x80, 0xa4, 0x43, 0xc0, 
+0x38, 0x77, 0x90, 0x28, 0x81, 0x38, 0x76, 0x90, 0x38, 0xa4, 0x43, 0xa0, 
+0x38, 0x75, 0xa4, 0x43, 0x90, 0x38, 0x73, 0x90, 0x28, 0x80, 0x38, 0x71, 
+0x80, 0x38, 0x70, 0x80, 0x90, 0x40, 0x10, 0x10, 0x80, 0x24, 0x43, 0x78, 
+0x10, 0x10, 0x90, 0x38, 0xa4, 0x43, 0x68, 0x38, 0x6e, 0xa4, 0x43, 0x58, 
+0x38, 0x6c, 0x90, 0x50, 0x80, 0xc9, 0xa2, 0x1a, 0x00, 0x85, 0x38, 0x69, 
+0x80, 0x38, 0x67, 0x9a, 0xd0, 0x03, 0xe0, 0x91, 0x60, 0x90, 0xb0, 0x88, 
+0x00, 0x68, 0x84, 0x10, 0x10, 0xc9, 0xe1, 0x2a, 0x00, 0x85, 0x34, 0xb9, 
+0xcb, 0x61, 0x22, 0x80, 0x85, 0x34, 0x99, 0x88, 0x00, 0x68, 0x84, 0x10, 
+0x10, 0xc9, 0xe1, 0x29, 0xc0, 0x85, 0x34, 0xb7, 0xcb, 0x61, 0x22, 0x40, 
+0x85, 0x34, 0x98, 0x90, 0xb0, 0x88, 0x00, 0x68, 0x84, 0x10, 0x10, 0xc9, 
+0xe1, 0x29, 0x80, 0x85, 0x34, 0xb5, 0xcb, 0x61, 0x22, 0x00, 0x85, 0x34, 
+0x97, 0x88, 0x00, 0x68, 0x84, 0x10, 0x10, 0xc9, 0xe1, 0x29, 0x40, 0x85, 
+0x34, 0xb3, 0xcb, 0x61, 0x21, 0xc0, 0x85, 0x34, 0x96, 0x90, 0x90, 0x90, 
+0x48, 0xcb, 0xa1, 0x20, 0x00, 0x85, 0x34, 0x85, 0xcb, 0xa1, 0x1f, 0xc0, 
+0x85, 0x34, 0x84, 0x90, 0x48, 0xcb, 0xa1, 0x1f, 0x80, 0x85, 0x34, 0x83, 
+0xcb, 0xa1, 0x1f, 0x40, 0x85, 0x34, 0x82, 0xcb, 0xa2, 0x11, 0x00, 0x80, 
+0x38, 0x45, 0x92, 0x40, 0x91, 0x20, 0x90, 0x90, 0x90, 0x48, 0x8c, 0x23, 
+0x60, 0x84, 0x24, 0x23, 0xd8, 0x8c, 0x23, 0x58, 0x84, 0x24, 0x23, 0xd0, 
+0x90, 0x48, 0x8c, 0x23, 0x50, 0x84, 0x24, 0x23, 0xc8, 0x8c, 0x23, 0x48, 
+0x84, 0x24, 0x23, 0xc0, 0x90, 0x90, 0x90, 0x48, 0x8c, 0x23, 0x38, 0x84, 
 0x24, 0x23, 0xb0, 0x8c, 0x23, 0x30, 0x84, 0x24, 0x23, 0xa8, 0x90, 0x48, 
 0x8c, 0x23, 0x28, 0x84, 0x24, 0x23, 0xa0, 0x8c, 0x23, 0x20, 0x84, 0x24, 
-0x23, 0x98, 0x90, 0x90, 0x90, 0x48, 0x8c, 0x23, 0x10, 0x84, 0x24, 0x22, 
-0xe8, 0x8c, 0x23, 0x08, 0x84, 0x24, 0x22, 0xe0, 0x90, 0x48, 0x8c, 0x23, 
-0x00, 0x84, 0x24, 0x22, 0xd8, 0x8c, 0x22, 0xf8, 0x84, 0x24, 0x22, 0xd0, 
-0xa0, 0x0f, 0x50, 0xa0, 0x09, 0x08, 0x9a, 0x30, 0x04, 0x40, 0x91, 0x90, 
-0x90, 0xc8, 0x98, 0x50, 0x00, 0x80, 0xe5, 0x22, 0x0c, 0x40, 0x38, 0x2d, 
-0xe5, 0x22, 0x08, 0x40, 0x38, 0x2b, 0xcb, 0x61, 0x12, 0x40, 0x85, 0x34, 
-0x58, 0x98, 0x50, 0x00, 0x80, 0xe5, 0x22, 0x04, 0x40, 0x38, 0x0d, 0xe5, 
-0x22, 0x00, 0x40, 0x38, 0x0b, 0xcb, 0x61, 0x12, 0x00, 0x85, 0x34, 0x57, 
-0x90, 0x48, 0xcb, 0xa1, 0x11, 0xc0, 0x85, 0x34, 0x56, 0xcb, 0xa1, 0x11, 
-0x80, 0x85, 0x34, 0x55, 0x91, 0x90, 0x90, 0xc8, 0x98, 0x50, 0x00, 0x80, 
-0xe5, 0x21, 0xfb, 0x40, 0x37, 0xf3, 0xe5, 0x21, 0xf8, 0x40, 0x37, 0xe7, 
-0xcb, 0x61, 0x11, 0x00, 0x85, 0x34, 0x53, 0x98, 0x50, 0x00, 0x80, 0xe5, 
-0x21, 0xf5, 0x40, 0x37, 0xdb, 0xe5, 0x21, 0xf2, 0x40, 0x37, 0xcf, 0xcb, 
-0x61, 0x10, 0xc0, 0x85, 0x34, 0x52, 0x90, 0x48, 0xcb, 0xa1, 0x10, 0x80, 
-0x85, 0x34, 0x51, 0xcb, 0xa1, 0x10, 0x40, 0x85, 0x34, 0x50, 0x92, 0x20, 
-0x91, 0x30, 0x90, 0xb8, 0xd5, 0x03, 0x00, 0xc0, 0xc0, 0x81, 0x8c, 0x01, 
-0xa0, 0x84, 0x30, 0x3e, 0xc0, 0xc0, 0x81, 0x8c, 0x01, 0x80, 0x84, 0x30, 
-0x3c, 0xd5, 0x02, 0x00, 0xc0, 0xc0, 0x81, 0x30, 0x28, 0xc0, 0xc0, 0x81, 
-0x30, 0x24, 0x90, 0x78, 0xd5, 0x02, 0x00, 0xc0, 0xc0, 0x81, 0x30, 0x1c, 
-0xc0, 0xc0, 0x81, 0x30, 0x18, 0xd5, 0x02, 0x00, 0xc0, 0xc0, 0x81, 0x30, 
-0x10, 0xc0, 0xc0, 0x81, 0x30, 0x0c, 0x91, 0x70, 0x90, 0xd8, 0xd5, 0x03, 
-0x80, 0xc8, 0xe1, 0xef, 0x40, 0x81, 0x8c, 0x01, 0xc0, 0x84, 0x30, 0x40, 
-0xc8, 0xe1, 0xf0, 0x40, 0x81, 0x8c, 0x01, 0x90, 0x84, 0x30, 0x3d, 0xd5, 
-0x02, 0x80, 0xc8, 0xe1, 0xee, 0xc0, 0x81, 0x30, 0x2c, 0xc8, 0xe1, 0xeb, 
-0xc0, 0x81, 0x30, 0x26, 0x90, 0x98, 0xd5, 0x02, 0x80, 0xc8, 0xe1, 0xe5, 
-0xc0, 0x81, 0x30, 0x20, 0xc8, 0xe1, 0xe6, 0xc0, 0x81, 0x30, 0x1a, 0xd5, 
-0x02, 0x80, 0xc8, 0xe1, 0xe5, 0x40, 0x81, 0x30, 0x14, 0xc8, 0xe1, 0xe2, 
-0x40, 0x81, 0x30, 0x0e, 0x9a, 0x30, 0x04, 0x40, 0x91, 0x90, 0x90, 0xc8, 
-0x98, 0x50, 0x00, 0x80, 0xe5, 0x22, 0x06, 0x40, 0x38, 0x15, 0xe5, 0x22, 
-0x07, 0x40, 0x38, 0x27, 0xcb, 0x61, 0x0f, 0xc0, 0x85, 0x34, 0x4e, 0x98, 
-0x50, 0x00, 0x80, 0xe5, 0x21, 0xfe, 0x40, 0x37, 0xf5, 0xe5, 0x21, 0xff, 
-0x40, 0x38, 0x07, 0xcb, 0x61, 0x0f, 0x80, 0x85, 0x34, 0x4d, 0x90, 0x48, 
-0xcb, 0xa1, 0x0f, 0x40, 0x85, 0x34, 0x4c, 0xcb, 0xa1, 0x0f, 0x00, 0x85, 
-0x34, 0x4b, 0x91, 0x90, 0x90, 0xc8, 0x98, 0x50, 0x00, 0x80, 0xe5, 0x21, 
-0xfa, 0x40, 0x37, 0xef, 0xe5, 0x21, 0xf7, 0x40, 0x37, 0xe3, 0xcb, 0x61, 
-0x0d, 0x40, 0x85, 0x34, 0x3a, 0x98, 0x50, 0x00, 0x80, 0xe5, 0x21, 0xf4, 
-0x40, 0x37, 0xd7, 0xe5, 0x21, 0xf1, 0x40, 0x37, 0xcb, 0xcb, 0x61, 0x0d, 
-0x00, 0x85, 0x34, 0x39, 0x90, 0x48, 0xcb, 0xa1, 0x0c, 0xc0, 0x85, 0x34, 
-0x38, 0xcb, 0xa1, 0x0c, 0x80, 0x85, 0x34, 0x37, 0x91, 0x00, 0x90, 0x80, 
-0x90, 0x40, 0xe5, 0x20, 0x02, 0x40, 0x30, 0x0a, 0xe5, 0x20, 0x01, 0x80, 
-0x30, 0x07, 0x90, 0x40, 0xe5, 0x20, 0x00, 0xc0, 0x30, 0x04, 0xe5, 0x20, 
-0x00, 0x00, 0x30, 0x01, 0x90, 0x80, 0x90, 0x40, 0xe5, 0x21, 0xe9, 0x40, 
-0x37, 0x9f, 0xe5, 0x21, 0xea, 0x80, 0x37, 0xb5, 0x90, 0x40, 0xe5, 0x21, 
-0xdf, 0xc0, 0x37, 0x79, 0xe5, 0x21, 0xe1, 0x00, 0x37, 0x8f, 0x80, 0x99, 
-0x28, 0x02, 0xf0, 0x8c, 0x21, 0x48, 0x90, 0x80, 0x90, 0x40, 0xe5, 0x22, 
-0x09, 0x40, 0x38, 0x23, 0xe5, 0x22, 0x07, 0xc0, 0x38, 0x29, 0x90, 0x40, 
-0xe5, 0x22, 0x01, 0x40, 0x38, 0x03, 0xe5, 0x21, 0xff, 0xc0, 0x38, 0x09, 
-0x91, 0x48, 0x90, 0xc8, 0x98, 0x50, 0x00, 0x80, 0xe5, 0x21, 0xfa, 0xc0, 
-0x37, 0xf1, 0xe5, 0x21, 0xf7, 0xc0, 0x37, 0xe5, 0xcb, 0x61, 0x0b, 0x00, 
-0x85, 0x34, 0x30, 0x90, 0x40, 0xe5, 0x21, 0xf4, 0xc0, 0x37, 0xd9, 0xe5, 
-0x21, 0xf1, 0xc0, 0x37, 0xcd, 0x90, 0x48, 0xcb, 0xa1, 0x0a, 0x80, 0x85, 
-0x34, 0x2e, 0xcb, 0xa1, 0x0a, 0xc0, 0x85, 0x34, 0x2f, 0x10, 0x10, 0x90, 
-0x80, 0x90, 0x40, 0xe5, 0x21, 0xec, 0xc0, 0x37, 0xb1, 0xe5, 0x21, 0xeb, 
-0x40, 0x37, 0xb9, 0x90, 0x40, 0xe5, 0x21, 0xe3, 0x40, 0x37, 0x8b, 0xe5, 
-0x21, 0xe1, 0xc0, 0x37, 0x93, 
+0x23, 0x98, 0x91, 0x20, 0x90, 0x90, 0x90, 0x48, 0x8c, 0x23, 0x10, 0x84, 
+0x24, 0x23, 0x88, 0x8c, 0x23, 0x08, 0x84, 0x24, 0x23, 0x80, 0x90, 0x48, 
+0x8c, 0x23, 0x00, 0x84, 0x24, 0x23, 0x78, 0x8c, 0x22, 0xf8, 0x84, 0x24, 
+0x23, 0x70, 0x90, 0x38, 0xa4, 0x22, 0xe0, 0x34, 0x5d, 0xa4, 0x22, 0xd0, 
+0x34, 0x5b, 0xa0, 0x0f, 0x50, 0xa0, 0x09, 0x08, 0x9a, 0x30, 0x04, 0x40, 
+0x91, 0x90, 0x90, 0xc8, 0x98, 0x50, 0x00, 0x80, 0xe5, 0x22, 0x10, 0x00, 
+0x38, 0x3c, 0xe5, 0x22, 0x0c, 0x00, 0x38, 0x3a, 0xcb, 0x61, 0x12, 0x40, 
+0x85, 0x34, 0x58, 0x98, 0x50, 0x00, 0x80, 0xe5, 0x22, 0x08, 0x00, 0x38, 
+0x1c, 0xe5, 0x22, 0x04, 0x00, 0x38, 0x1a, 0xcb, 0x61, 0x12, 0x00, 0x85, 
+0x34, 0x57, 0x90, 0x48, 0xcb, 0xa1, 0x11, 0xc0, 0x85, 0x34, 0x56, 0xcb, 
+0xa1, 0x11, 0x80, 0x85, 0x34, 0x55, 0x91, 0x90, 0x90, 0xc8, 0x98, 0x50, 
+0x00, 0x80, 0xe5, 0x21, 0xff, 0x00, 0x38, 0x02, 0xe5, 0x21, 0xfc, 0x00, 
+0x37, 0xf6, 0xcb, 0x61, 0x11, 0x00, 0x85, 0x34, 0x53, 0x98, 0x50, 0x00, 
+0x80, 0xe5, 0x21, 0xf9, 0x00, 0x37, 0xea, 0xe5, 0x21, 0xf6, 0x00, 0x37, 
+0xde, 0xcb, 0x61, 0x10, 0xc0, 0x85, 0x34, 0x52, 0x90, 0x48, 0xcb, 0xa1, 
+0x10, 0x80, 0x85, 0x34, 0x51, 0xcb, 0xa1, 0x10, 0x40, 0x85, 0x34, 0x50, 
+0x92, 0x20, 0x91, 0x30, 0x90, 0xb8, 0xd5, 0x03, 0x00, 0xc0, 0xc0, 0x81, 
+0x8c, 0x01, 0xa0, 0x84, 0x30, 0x3e, 0xc0, 0xc0, 0x81, 0x8c, 0x01, 0x80, 
+0x84, 0x30, 0x3c, 0xd5, 0x02, 0x00, 0xc0, 0xc0, 0x81, 0x30, 0x28, 0xc0, 
+0xc0, 0x81, 0x30, 0x24, 0x90, 0x78, 0xd5, 0x02, 0x00, 0xc0, 0xc0, 0x81, 
+0x30, 0x1c, 0xc0, 0xc0, 0x81, 0x30, 0x18, 0xd5, 0x02, 0x00, 0xc0, 0xc0, 
+0x81, 0x30, 0x10, 0xc0, 0xc0, 0x81, 0x30, 0x0c, 0x91, 0x70, 0x90, 0xd8, 
+0xd5, 0x03, 0x80, 0xc8, 0xe1, 0xf3, 0x00, 0x81, 0x8c, 0x01, 0xc0, 0x84, 
+0x30, 0x40, 0xc8, 0xe1, 0xf4, 0x00, 0x81, 0x8c, 0x01, 0x90, 0x84, 0x30, 
+0x3d, 0xd5, 0x02, 0x80, 0xc8, 0xe1, 0xf2, 0x80, 0x81, 0x30, 0x2c, 0xc8, 
+0xe1, 0xef, 0x80, 0x81, 0x30, 0x26, 0x90, 0x98, 0xd5, 0x02, 0x80, 0xc8, 
+0xe1, 0xe9, 0x80, 0x81, 0x30, 0x20, 0xc8, 0xe1, 0xea, 0x80, 0x81, 0x30, 
+0x1a, 0xd5, 0x02, 0x80, 0xc8, 0xe1, 0xe9, 0x00, 0x81, 0x30, 0x14, 0xc8, 
+0xe1, 0xe6, 0x00, 0x81, 0x30, 0x0e, 0x9a, 0x30, 0x04, 0x40, 0x91, 0x90, 
+0x90, 0xc8, 0x98, 0x50, 0x00, 0x80, 0xe5, 0x22, 0x0a, 0x00, 0x38, 0x24, 
+0xe5, 0x22, 0x0b, 0x00, 0x38, 0x36, 0xcb, 0x61, 0x0f, 0xc0, 0x85, 0x34, 
+0x4e, 0x98, 0x50, 0x00, 0x80, 0xe5, 0x22, 0x02, 0x00, 0x38, 0x04, 0xe5, 
+0x22, 0x03, 0x00, 0x38, 0x16, 0xcb, 0x61, 0x0f, 0x80, 0x85, 0x34, 0x4d, 
+0x90, 0x48, 0xcb, 0xa1, 0x0f, 0x40, 0x85, 0x34, 0x4c, 0xcb, 0xa1, 0x0f, 
+0x00, 0x85, 0x34, 0x4b, 0x91, 0x90, 0x90, 0xc8, 0x98, 0x50, 0x00, 0x80, 
+0xe5, 0x21, 0xfe, 0x00, 0x37, 0xfe, 0xe5, 0x21, 0xfb, 0x00, 0x37, 0xf2, 
+0xcb, 0x61, 0x0d, 0x40, 0x85, 0x34, 0x3a, 0x98, 0x50, 0x00, 0x80, 0xe5, 
+0x21, 0xf8, 0x00, 0x37, 0xe6, 0xe5, 0x21, 0xf5, 0x00, 0x37, 0xda, 0xcb, 
+0x61, 0x0d, 0x00, 0x85, 0x34, 0x39, 0x90, 0x48, 0xcb, 0xa1, 0x0c, 0xc0, 
+0x85, 0x34, 0x38, 0xcb, 0xa1, 0x0c, 0x80, 0x85, 0x34, 0x37, 0x91, 0x00, 
+0x90, 0x80, 0x90, 0x40, 0xe5, 0x20, 0x02, 0x40, 0x30, 0x0a, 0xe5, 0x20, 
+0x01, 0x80, 0x30, 0x07, 0x90, 0x40, 0xe5, 0x20, 0x00, 0xc0, 0x30, 0x04, 
+0xe5, 0x20, 0x00, 0x00, 0x30, 0x01, 0x90, 0x80, 0x90, 0x40, 0xe5, 0x21, 
+0xed, 0x00, 0x37, 0xae, 0xe5, 0x21, 0xee, 0x40, 0x37, 0xc4, 0x90, 0x40, 
+0xe5, 0x21, 0xe3, 0x80, 0x37, 0x88, 0xe5, 0x21, 0xe4, 0xc0, 0x37, 0x9e, 
+0x80, 0x99, 0x28, 0x02, 0xf0, 0x8c, 0x21, 0x48, 0x90, 0x80, 0x90, 0x40, 
+0xe5, 0x22, 0x0d, 0x00, 0x38, 0x32, 0xe5, 0x22, 0x0b, 0x80, 0x38, 0x38, 
+0x90, 0x40, 0xe5, 0x22, 0x05, 0x00, 0x38, 0x12, 0xe5, 0x22, 0x03, 0x80, 
+0x38, 0x18, 0x91, 0x48, 0x90, 0xc8, 0x98, 0x50, 0x00, 0x80, 0xe5, 0x21, 
+0xfe, 0x80, 0x38, 0x00, 0xe5, 0x21, 0xfb, 0x80, 0x37, 0xf4, 0xcb, 0x61, 
+0x0b, 0x00, 0x85, 0x34, 0x30, 0x90, 0x40, 0xe5, 0x21, 0xf8, 0x80, 0x37, 
+0xe8, 0xe5, 0x21, 0xf5, 0x80, 0x37, 0xdc, 0x90, 0x48, 0xcb, 0xa1, 0x0a, 
+0x80, 0x85, 0x34, 0x2e, 0xcb, 0xa1, 0x0a, 0xc0, 0x85, 0x34, 0x2f, 0x10, 
+0x10, 0x90, 0x80, 0x90, 0x40, 0xe5, 0x21, 0xf0, 0x80, 0x37, 0xc0, 0xe5, 
+0x21, 0xef, 0x00, 0x37, 0xc8, 0x90, 0x40, 0xe5, 0x21, 0xe7, 0x00, 0x37, 
+0x9a, 0xe5, 0x21, 0xe5, 0x80, 0x37, 0xa2, 
 };
 
 static const struct ia64_dis_names ia64_dis_names[] = {
@@ -5963,16 +6191,16 @@
 { 0x4, 386, 0, 1108 },
 { 0x1, 386, 1, 1110 },
 { 0x2, 386, 0, 1109 },
-{ 0x8, 170, 0, 1111 },
-{ 0x4, 170, 0, 1112 },
-{ 0x2, 170, 0, 1113 },
-{ 0x1, 170, 1, 1115 },
-{ 0x1, 171, 0, 1114 },
-{ 0x10, 172, 0, 1116 },
-{ 0x8, 172, 0, 1117 },
-{ 0x4, 172, 0, 1118 },
-{ 0x1, 172, 1, 1120 },
-{ 0x2, 172, 0, 1119 },
+{ 0x8, 171, 0, 1111 },
+{ 0x4, 171, 0, 1112 },
+{ 0x2, 171, 0, 1113 },
+{ 0x1, 171, 1, 1115 },
+{ 0x1, 172, 0, 1114 },
+{ 0x10, 173, 0, 1116 },
+{ 0x8, 173, 0, 1117 },
+{ 0x4, 173, 0, 1118 },
+{ 0x1, 173, 1, 1120 },
+{ 0x2, 173, 0, 1119 },
 { 0x220, 143, 0, 1121 },
 { 0x120, 143, 0, 1122 },
 { 0xa0, 143, 0, 1123 },
@@ -6003,1047 +6231,1062 @@
 { 0x4, 145, 0, 1148 },
 { 0x1, 145, 1, 1150 },
 { 0x2, 145, 0, 1149 },
-{ 0x10, 177, 0, 1151 },
-{ 0x8, 177, 0, 1152 },
-{ 0x4, 177, 0, 1153 },
-{ 0x1, 177, 1, 1155 },
-{ 0x2, 177, 0, 1154 },
-{ 0x8, 166, 0, 1156 },
-{ 0x4, 166, 0, 1157 },
-{ 0x2, 166, 0, 1158 },
-{ 0x1, 166, 1, 1160 },
-{ 0x1, 167, 0, 1159 },
-{ 0x220, 139, 0, 1161 },
-{ 0x120, 139, 0, 1162 },
-{ 0xa0, 139, 0, 1163 },
-{ 0x60, 139, 1, 1165 },
-{ 0x4, 140, 0, 1164 },
-{ 0x110, 139, 0, 1171 },
-{ 0x90, 139, 0, 1172 },
-{ 0x50, 139, 0, 1173 },
-{ 0x30, 139, 1, 1175 },
-{ 0x2, 140, 0, 1174 },
-{ 0x8, 139, 0, 1176 },
-{ 0x4, 139, 0, 1177 },
-{ 0x2, 139, 0, 1178 },
-{ 0x1, 139, 1, 1180 },
-{ 0x1, 140, 0, 1179 },
-{ 0x440, 185, 0, 1166 },
-{ 0x240, 185, 0, 1167 },
-{ 0x140, 185, 0, 1168 },
-{ 0xc0, 185, 1, 1170 },
-{ 0x40, 185, 0, 1169 },
-{ 0x220, 185, 0, 1181 },
-{ 0x120, 185, 0, 1182 },
-{ 0xa0, 185, 0, 1183 },
-{ 0x60, 185, 1, 1185 },
-{ 0x20, 185, 0, 1184 },
-{ 0x10, 185, 0, 1186 },
-{ 0x8, 185, 0, 1187 },
-{ 0x4, 185, 0, 1188 },
-{ 0x1, 185, 1, 1190 },
-{ 0x2, 185, 0, 1189 },
-{ 0x8, 158, 0, 1191 },
-{ 0x4, 158, 0, 1192 },
-{ 0x2, 158, 0, 1193 },
-{ 0x1, 158, 1, 1195 },
-{ 0x1, 159, 0, 1194 },
-{ 0x10, 165, 0, 1196 },
-{ 0x8, 165, 0, 1197 },
-{ 0x4, 165, 0, 1198 },
-{ 0x1, 165, 1, 1200 },
-{ 0x2, 165, 0, 1199 },
-{ 0x220, 130, 0, 1201 },
-{ 0x120, 130, 0, 1202 },
-{ 0xa0, 130, 0, 1203 },
-{ 0x60, 130, 1, 1205 },
-{ 0x4, 131, 0, 1204 },
-{ 0x110, 130, 0, 1226 },
-{ 0x90, 130, 0, 1227 },
-{ 0x50, 130, 0, 1228 },
-{ 0x30, 130, 1, 1230 },
-{ 0x2, 131, 0, 1229 },
-{ 0x8, 130, 0, 1231 },
-{ 0x4, 130, 0, 1232 },
-{ 0x2, 130, 0, 1233 },
-{ 0x1, 130, 1, 1235 },
-{ 0x1, 131, 0, 1234 },
-{ 0x440, 138, 0, 1206 },
-{ 0x240, 138, 0, 1207 },
-{ 0x140, 138, 0, 1208 },
-{ 0xc0, 138, 1, 1210 },
-{ 0x40, 138, 0, 1209 },
-{ 0x220, 138, 0, 1236 },
-{ 0x120, 138, 0, 1237 },
-{ 0xa0, 138, 0, 1238 },
-{ 0x60, 138, 1, 1240 },
-{ 0x20, 138, 0, 1239 },
-{ 0x10, 138, 0, 1241 },
-{ 0x8, 138, 0, 1242 },
-{ 0x4, 138, 0, 1243 },
-{ 0x1, 138, 1, 1245 },
-{ 0x2, 138, 0, 1244 },
-{ 0x440, 101, 0, 1211 },
-{ 0x240, 101, 0, 1212 },
-{ 0x140, 101, 0, 1213 },
-{ 0xc0, 101, 1, 1215 },
-{ 0x40, 101, 0, 1214 },
-{ 0x220, 101, 0, 1246 },
-{ 0x120, 101, 0, 1247 },
-{ 0xa0, 101, 0, 1248 },
-{ 0x60, 101, 1, 1250 },
-{ 0x20, 101, 0, 1249 },
-{ 0x10, 101, 0, 1251 },
-{ 0x8, 101, 0, 1252 },
-{ 0x1, 101, 1, 1255 },
-{ 0x2, 101, 0, 1254 },
-{ 0x440, 146, 1, 1221 },
-{ 0x441, 126, 0, 1216 },
-{ 0x240, 146, 1, 1222 },
-{ 0x241, 126, 0, 1217 },
-{ 0x140, 146, 1, 1223 },
-{ 0x141, 126, 0, 1218 },
-{ 0xc0, 146, 1, 1225 },
-{ 0x40, 146, 1, 1224 },
-{ 0xc1, 126, 1, 1220 },
-{ 0x41, 126, 0, 1219 },
-{ 0x220, 146, 1, 1266 },
-{ 0x221, 126, 0, 1256 },
-{ 0x120, 146, 1, 1267 },
-{ 0x121, 126, 0, 1257 },
-{ 0xa0, 146, 1, 1268 },
-{ 0xa1, 126, 0, 1258 },
-{ 0x60, 146, 1, 1270 },
-{ 0x20, 146, 1, 1269 },
-{ 0x61, 126, 1, 1260 },
-{ 0x21, 126, 0, 1259 },
-{ 0x10, 146, 1, 1271 },
-{ 0x11, 126, 0, 1261 },
-{ 0x8, 146, 1, 1272 },
-{ 0x9, 126, 0, 1262 },
-{ 0x4, 146, 1, 1273 },
-{ 0x5, 126, 0, 1263 },
-{ 0x1, 146, 1, 1275 },
-{ 0x2, 146, 1, 1274 },
-{ 0x3, 126, 1, 1265 },
-{ 0x1, 126, 0, 1264 },
-{ 0x1, 111, 1, 1279 },
-{ 0x1, 112, 0, 1278 },
-{ 0x3, 111, 1, 1277 },
-{ 0x3, 112, 0, 1276 },
-{ 0x1108, 115, 1, 1360 },
-{ 0x1108, 119, 0, 1280 },
-{ 0x908, 115, 1, 1361 },
-{ 0x908, 119, 0, 1281 },
-{ 0x508, 115, 1, 1362 },
-{ 0x508, 119, 0, 1282 },
-{ 0x308, 115, 1, 1364 },
-{ 0x18, 116, 1, 1363 },
-{ 0x308, 119, 1, 1284 },
-{ 0x18, 120, 0, 1283 },
-{ 0x88, 115, 1, 1380 },
-{ 0x88, 119, 0, 1320 },
-{ 0x48, 115, 1, 1381 },
-{ 0x48, 119, 0, 1321 },
-{ 0x28, 115, 1, 1382 },
-{ 0x28, 119, 0, 1322 },
-{ 0x18, 115, 1, 1384 },
-{ 0x8, 116, 1, 1383 },
-{ 0x18, 119, 1, 1324 },
-{ 0x8, 120, 0, 1323 },
-{ 0x884, 115, 1, 1365 },
-{ 0x442, 117, 1, 1310 },
-{ 0x884, 119, 1, 1295 },
-{ 0x442, 121, 0, 1285 },
-{ 0x484, 115, 1, 1366 },
-{ 0x242, 117, 1, 1311 },
-{ 0x484, 119, 1, 1296 },
-{ 0x242, 121, 0, 1286 },
-{ 0x284, 115, 1, 1367 },
-{ 0x142, 117, 1, 1312 },
-{ 0x284, 119, 1, 1297 },
-{ 0x142, 121, 0, 1287 },
-{ 0x184, 115, 1, 1369 },
-{ 0xc, 116, 1, 1368 },
-{ 0xc2, 117, 1, 1314 },
-{ 0x6, 118, 1, 1313 },
-{ 0x184, 119, 1, 1299 },
-{ 0xc, 120, 1, 1298 },
-{ 0xc2, 121, 1, 1289 },
-{ 0x6, 122, 0, 1288 },
-{ 0x44, 115, 1, 1385 },
-{ 0x22, 117, 1, 1350 },
-{ 0x44, 119, 1, 1335 },
-{ 0x22, 121, 0, 1325 },
-{ 0x24, 115, 1, 1386 },
-{ 0x12, 117, 1, 1351 },
-{ 0x24, 119, 1, 1336 },
-{ 0x12, 121, 0, 1326 },
-{ 0x14, 115, 1, 1387 },
-{ 0xa, 117, 1, 1352 },
-{ 0x14, 119, 1, 1337 },
-{ 0xa, 121, 0, 1327 },
-{ 0xc, 115, 1, 1389 },
-{ 0x4, 116, 1, 1388 },
-{ 0x6, 117, 1, 1354 },
-{ 0x2, 118, 1, 1353 },
-{ 0xc, 119, 1, 1339 },
-{ 0x4, 120, 1, 1338 },
-{ 0x6, 121, 1, 1329 },
-{ 0x2, 122, 0, 1328 },
-{ 0x442, 115, 1, 1370 },
-{ 0x221, 117, 1, 1315 },
-{ 0x442, 119, 1, 1300 },
-{ 0x221, 121, 0, 1290 },
-{ 0x242, 115, 1, 1371 },
-{ 0x121, 117, 1, 1316 },
-{ 0x242, 119, 1, 1301 },
-{ 0x121, 121, 0, 1291 },
-{ 0x142, 115, 1, 1372 },
-{ 0xa1, 117, 1, 1317 },
-{ 0x142, 119, 1, 1302 },
-{ 0xa1, 121, 0, 1292 },
-{ 0xc2, 115, 1, 1374 },
-{ 0x6, 116, 1, 1373 },
-{ 0x61, 117, 1, 1319 },
-{ 0x3, 118, 1, 1318 },
-{ 0xc2, 119, 1, 1304 },
-{ 0x6, 120, 1, 1303 },
-{ 0x61, 121, 1, 1294 },
-{ 0x3, 122, 0, 1293 },
-{ 0x22, 115, 1, 1390 },
-{ 0x11, 117, 1, 1355 },
-{ 0x22, 119, 1, 1340 },
-{ 0x11, 121, 0, 1330 },
-{ 0x12, 115, 1, 1391 },
-{ 0x9, 117, 1, 1356 },
-{ 0x12, 119, 1, 1341 },
-{ 0x9, 121, 0, 1331 },
-{ 0xa, 115, 1, 1392 },
-{ 0x5, 117, 1, 1357 },
-{ 0xa, 119, 1, 1342 },
-{ 0x5, 121, 0, 1332 },
-{ 0x6, 115, 1, 1394 },
-{ 0x2, 116, 1, 1393 },
-{ 0x3, 117, 1, 1359 },
-{ 0x1, 118, 1, 1358 },
-{ 0x6, 119, 1, 1344 },
-{ 0x2, 120, 1, 1343 },
-{ 0x3, 121, 1, 1334 },
-{ 0x1, 122, 0, 1333 },
-{ 0x221, 115, 1, 1375 },
-{ 0x221, 119, 0, 1305 },
-{ 0x121, 115, 1, 1376 },
-{ 0x121, 119, 0, 1306 },
-{ 0xa1, 115, 1, 1377 },
-{ 0xa1, 119, 0, 1307 },
-{ 0x61, 115, 1, 1379 },
-{ 0x3, 116, 1, 1378 },
-{ 0x61, 119, 1, 1309 },
-{ 0x3, 120, 0, 1308 },
-{ 0x11, 115, 1, 1395 },
-{ 0x11, 119, 0, 1345 },
-{ 0x9, 115, 1, 1396 },
-{ 0x9, 119, 0, 1346 },
-{ 0x5, 115, 1, 1397 },
-{ 0x5, 119, 0, 1347 },
-{ 0x3, 115, 1, 1399 },
-{ 0x1, 116, 1, 1398 },
-{ 0x3, 119, 1, 1349 },
-{ 0x1, 120, 0, 1348 },
-{ 0x442, 156, 0, 1400 },
-{ 0x242, 156, 0, 1401 },
-{ 0x142, 156, 0, 1402 },
-{ 0xc2, 156, 1, 1404 },
-{ 0x6, 157, 1, 1403 },
+{ 0x8, 167, 0, 1151 },
+{ 0x4, 167, 0, 1152 },
+{ 0x2, 167, 0, 1153 },
+{ 0x1, 167, 1, 1155 },
+{ 0x1, 168, 0, 1154 },
+{ 0x220, 139, 0, 1156 },
+{ 0x120, 139, 0, 1157 },
+{ 0xa0, 139, 0, 1158 },
+{ 0x60, 139, 1, 1160 },
+{ 0x4, 140, 0, 1159 },
+{ 0x110, 139, 0, 1166 },
+{ 0x90, 139, 0, 1167 },
+{ 0x50, 139, 0, 1168 },
+{ 0x30, 139, 1, 1170 },
+{ 0x2, 140, 0, 1169 },
+{ 0x8, 139, 0, 1171 },
+{ 0x4, 139, 0, 1172 },
+{ 0x2, 139, 0, 1173 },
+{ 0x1, 139, 1, 1175 },
+{ 0x1, 140, 0, 1174 },
+{ 0x440, 185, 0, 1161 },
+{ 0x240, 185, 0, 1162 },
+{ 0x140, 185, 0, 1163 },
+{ 0xc0, 185, 1, 1165 },
+{ 0x40, 185, 0, 1164 },
+{ 0x220, 185, 0, 1176 },
+{ 0x120, 185, 0, 1177 },
+{ 0xa0, 185, 0, 1178 },
+{ 0x60, 185, 1, 1180 },
+{ 0x20, 185, 0, 1179 },
+{ 0x10, 185, 0, 1181 },
+{ 0x8, 185, 0, 1182 },
+{ 0x4, 185, 0, 1183 },
+{ 0x1, 185, 1, 1185 },
+{ 0x2, 185, 0, 1184 },
+{ 0x8, 159, 0, 1186 },
+{ 0x4, 159, 0, 1187 },
+{ 0x2, 159, 0, 1188 },
+{ 0x1, 159, 1, 1190 },
+{ 0x1, 160, 0, 1189 },
+{ 0x10, 166, 0, 1191 },
+{ 0x8, 166, 0, 1192 },
+{ 0x4, 166, 0, 1193 },
+{ 0x1, 166, 1, 1195 },
+{ 0x2, 166, 0, 1194 },
+{ 0x220, 130, 0, 1196 },
+{ 0x120, 130, 0, 1197 },
+{ 0xa0, 130, 0, 1198 },
+{ 0x60, 130, 1, 1200 },
+{ 0x4, 131, 0, 1199 },
+{ 0x110, 130, 0, 1221 },
+{ 0x90, 130, 0, 1222 },
+{ 0x50, 130, 0, 1223 },
+{ 0x30, 130, 1, 1225 },
+{ 0x2, 131, 0, 1224 },
+{ 0x8, 130, 0, 1226 },
+{ 0x4, 130, 0, 1227 },
+{ 0x2, 130, 0, 1228 },
+{ 0x1, 130, 1, 1230 },
+{ 0x1, 131, 0, 1229 },
+{ 0x440, 138, 0, 1201 },
+{ 0x240, 138, 0, 1202 },
+{ 0x140, 138, 0, 1203 },
+{ 0xc0, 138, 1, 1205 },
+{ 0x40, 138, 0, 1204 },
+{ 0x220, 138, 0, 1231 },
+{ 0x120, 138, 0, 1232 },
+{ 0xa0, 138, 0, 1233 },
+{ 0x60, 138, 1, 1235 },
+{ 0x20, 138, 0, 1234 },
+{ 0x10, 138, 0, 1236 },
+{ 0x8, 138, 0, 1237 },
+{ 0x4, 138, 0, 1238 },
+{ 0x1, 138, 1, 1240 },
+{ 0x2, 138, 0, 1239 },
+{ 0x440, 101, 0, 1206 },
+{ 0x240, 101, 0, 1207 },
+{ 0x140, 101, 0, 1208 },
+{ 0xc0, 101, 1, 1210 },
+{ 0x40, 101, 0, 1209 },
+{ 0x220, 101, 0, 1241 },
+{ 0x120, 101, 0, 1242 },
+{ 0xa0, 101, 0, 1243 },
+{ 0x60, 101, 1, 1245 },
+{ 0x20, 101, 0, 1244 },
+{ 0x10, 101, 0, 1246 },
+{ 0x8, 101, 0, 1247 },
+{ 0x1, 101, 1, 1250 },
+{ 0x2, 101, 0, 1249 },
+{ 0x440, 146, 1, 1216 },
+{ 0x441, 126, 0, 1211 },
+{ 0x240, 146, 1, 1217 },
+{ 0x241, 126, 0, 1212 },
+{ 0x140, 146, 1, 1218 },
+{ 0x141, 126, 0, 1213 },
+{ 0xc0, 146, 1, 1220 },
+{ 0x40, 146, 1, 1219 },
+{ 0xc1, 126, 1, 1215 },
+{ 0x41, 126, 0, 1214 },
+{ 0x220, 146, 1, 1261 },
+{ 0x221, 126, 0, 1251 },
+{ 0x120, 146, 1, 1262 },
+{ 0x121, 126, 0, 1252 },
+{ 0xa0, 146, 1, 1263 },
+{ 0xa1, 126, 0, 1253 },
+{ 0x60, 146, 1, 1265 },
+{ 0x20, 146, 1, 1264 },
+{ 0x61, 126, 1, 1255 },
+{ 0x21, 126, 0, 1254 },
+{ 0x10, 146, 1, 1266 },
+{ 0x11, 126, 0, 1256 },
+{ 0x8, 146, 1, 1267 },
+{ 0x9, 126, 0, 1257 },
+{ 0x4, 146, 1, 1268 },
+{ 0x5, 126, 0, 1258 },
+{ 0x1, 146, 1, 1270 },
+{ 0x2, 146, 1, 1269 },
+{ 0x3, 126, 1, 1260 },
+{ 0x1, 126, 0, 1259 },
+{ 0x1, 111, 1, 1274 },
+{ 0x1, 112, 0, 1273 },
+{ 0x3, 111, 1, 1272 },
+{ 0x3, 112, 0, 1271 },
+{ 0x1108, 115, 1, 1355 },
+{ 0x1108, 119, 0, 1275 },
+{ 0x908, 115, 1, 1356 },
+{ 0x908, 119, 0, 1276 },
+{ 0x508, 115, 1, 1357 },
+{ 0x508, 119, 0, 1277 },
+{ 0x308, 115, 1, 1359 },
+{ 0x18, 116, 1, 1358 },
+{ 0x308, 119, 1, 1279 },
+{ 0x18, 120, 0, 1278 },
+{ 0x88, 115, 1, 1375 },
+{ 0x88, 119, 0, 1315 },
+{ 0x48, 115, 1, 1376 },
+{ 0x48, 119, 0, 1316 },
+{ 0x28, 115, 1, 1377 },
+{ 0x28, 119, 0, 1317 },
+{ 0x18, 115, 1, 1379 },
+{ 0x8, 116, 1, 1378 },
+{ 0x18, 119, 1, 1319 },
+{ 0x8, 120, 0, 1318 },
+{ 0x884, 115, 1, 1360 },
+{ 0x442, 117, 1, 1305 },
+{ 0x884, 119, 1, 1290 },
+{ 0x442, 121, 0, 1280 },
+{ 0x484, 115, 1, 1361 },
+{ 0x242, 117, 1, 1306 },
+{ 0x484, 119, 1, 1291 },
+{ 0x242, 121, 0, 1281 },
+{ 0x284, 115, 1, 1362 },
+{ 0x142, 117, 1, 1307 },
+{ 0x284, 119, 1, 1292 },
+{ 0x142, 121, 0, 1282 },
+{ 0x184, 115, 1, 1364 },
+{ 0xc, 116, 1, 1363 },
+{ 0xc2, 117, 1, 1309 },
+{ 0x6, 118, 1, 1308 },
+{ 0x184, 119, 1, 1294 },
+{ 0xc, 120, 1, 1293 },
+{ 0xc2, 121, 1, 1284 },
+{ 0x6, 122, 0, 1283 },
+{ 0x44, 115, 1, 1380 },
+{ 0x22, 117, 1, 1345 },
+{ 0x44, 119, 1, 1330 },
+{ 0x22, 121, 0, 1320 },
+{ 0x24, 115, 1, 1381 },
+{ 0x12, 117, 1, 1346 },
+{ 0x24, 119, 1, 1331 },
+{ 0x12, 121, 0, 1321 },
+{ 0x14, 115, 1, 1382 },
+{ 0xa, 117, 1, 1347 },
+{ 0x14, 119, 1, 1332 },
+{ 0xa, 121, 0, 1322 },
+{ 0xc, 115, 1, 1384 },
+{ 0x4, 116, 1, 1383 },
+{ 0x6, 117, 1, 1349 },
+{ 0x2, 118, 1, 1348 },
+{ 0xc, 119, 1, 1334 },
+{ 0x4, 120, 1, 1333 },
+{ 0x6, 121, 1, 1324 },
+{ 0x2, 122, 0, 1323 },
+{ 0x442, 115, 1, 1365 },
+{ 0x221, 117, 1, 1310 },
+{ 0x442, 119, 1, 1295 },
+{ 0x221, 121, 0, 1285 },
+{ 0x242, 115, 1, 1366 },
+{ 0x121, 117, 1, 1311 },
+{ 0x242, 119, 1, 1296 },
+{ 0x121, 121, 0, 1286 },
+{ 0x142, 115, 1, 1367 },
+{ 0xa1, 117, 1, 1312 },
+{ 0x142, 119, 1, 1297 },
+{ 0xa1, 121, 0, 1287 },
+{ 0xc2, 115, 1, 1369 },
+{ 0x6, 116, 1, 1368 },
+{ 0x61, 117, 1, 1314 },
+{ 0x3, 118, 1, 1313 },
+{ 0xc2, 119, 1, 1299 },
+{ 0x6, 120, 1, 1298 },
+{ 0x61, 121, 1, 1289 },
+{ 0x3, 122, 0, 1288 },
+{ 0x22, 115, 1, 1385 },
+{ 0x11, 117, 1, 1350 },
+{ 0x22, 119, 1, 1335 },
+{ 0x11, 121, 0, 1325 },
+{ 0x12, 115, 1, 1386 },
+{ 0x9, 117, 1, 1351 },
+{ 0x12, 119, 1, 1336 },
+{ 0x9, 121, 0, 1326 },
+{ 0xa, 115, 1, 1387 },
+{ 0x5, 117, 1, 1352 },
+{ 0xa, 119, 1, 1337 },
+{ 0x5, 121, 0, 1327 },
+{ 0x6, 115, 1, 1389 },
+{ 0x2, 116, 1, 1388 },
+{ 0x3, 117, 1, 1354 },
+{ 0x1, 118, 1, 1353 },
+{ 0x6, 119, 1, 1339 },
+{ 0x2, 120, 1, 1338 },
+{ 0x3, 121, 1, 1329 },
+{ 0x1, 122, 0, 1328 },
+{ 0x221, 115, 1, 1370 },
+{ 0x221, 119, 0, 1300 },
+{ 0x121, 115, 1, 1371 },
+{ 0x121, 119, 0, 1301 },
+{ 0xa1, 115, 1, 1372 },
+{ 0xa1, 119, 0, 1302 },
+{ 0x61, 115, 1, 1374 },
+{ 0x3, 116, 1, 1373 },
+{ 0x61, 119, 1, 1304 },
+{ 0x3, 120, 0, 1303 },
+{ 0x11, 115, 1, 1390 },
+{ 0x11, 119, 0, 1340 },
+{ 0x9, 115, 1, 1391 },
+{ 0x9, 119, 0, 1341 },
+{ 0x5, 115, 1, 1392 },
+{ 0x5, 119, 0, 1342 },
+{ 0x3, 115, 1, 1394 },
+{ 0x1, 116, 1, 1393 },
+{ 0x3, 119, 1, 1344 },
+{ 0x1, 120, 0, 1343 },
+{ 0x442, 157, 0, 1395 },
+{ 0x242, 157, 0, 1396 },
+{ 0x142, 157, 0, 1397 },
+{ 0xc2, 157, 1, 1399 },
+{ 0x6, 158, 1, 1398 },
 { 0x1, 376, 0, 920 },
-{ 0x22, 156, 0, 1410 },
-{ 0x12, 156, 0, 1411 },
-{ 0xa, 156, 0, 1412 },
-{ 0x6, 156, 1, 1414 },
-{ 0x2, 157, 1, 1413 },
+{ 0x22, 157, 0, 1405 },
+{ 0x12, 157, 0, 1406 },
+{ 0xa, 157, 0, 1407 },
+{ 0x6, 157, 1, 1409 },
+{ 0x2, 158, 1, 1408 },
 { 0x2, 310, 0, 949 },
-{ 0x221, 156, 0, 1405 },
-{ 0x121, 156, 0, 1406 },
-{ 0xa1, 156, 0, 1407 },
-{ 0x61, 156, 1, 1409 },
-{ 0x3, 157, 1, 1408 },
+{ 0x221, 157, 0, 1400 },
+{ 0x121, 157, 0, 1401 },
+{ 0xa1, 157, 0, 1402 },
+{ 0x61, 157, 1, 1404 },
+{ 0x3, 158, 1, 1403 },
 { 0x1, 372, 0, 921 },
-{ 0x11, 156, 0, 1415 },
-{ 0x9, 156, 0, 1416 },
-{ 0x5, 156, 0, 1417 },
-{ 0x3, 156, 1, 1419 },
-{ 0x1, 157, 1, 1418 },
+{ 0x11, 157, 0, 1410 },
+{ 0x9, 157, 0, 1411 },
+{ 0x5, 157, 0, 1412 },
+{ 0x3, 157, 1, 1414 },
+{ 0x1, 158, 1, 1413 },
 { 0x1, 310, 0, 950 },
-{ 0x4, 162, 0, 1420 },
-{ 0x1, 162, 0, 1422 },
-{ 0x1, 169, 0, 1423 },
-{ 0x1, 168, 1, 1424 },
-{ 0x2, 162, 0, 1421 },
-{ 0x1, 148, 0, 1425 },
-{ 0x880, 154, 0, 1426 },
-{ 0x480, 154, 0, 1427 },
-{ 0x280, 154, 0, 1428 },
-{ 0x180, 154, 1, 1430 },
-{ 0x80, 155, 0, 1429 },
-{ 0x440, 154, 0, 1431 },
-{ 0x240, 154, 0, 1432 },
-{ 0x140, 154, 0, 1433 },
-{ 0xc0, 154, 1, 1435 },
-{ 0x40, 155, 0, 1434 },
-{ 0x220, 154, 0, 1436 },
-{ 0x120, 154, 0, 1437 },
-{ 0xa0, 154, 0, 1438 },
-{ 0x60, 154, 1, 1440 },
-{ 0x20, 155, 0, 1439 },
-{ 0x110, 154, 0, 1441 },
-{ 0x90, 154, 0, 1442 },
-{ 0x50, 154, 0, 1443 },
-{ 0x30, 154, 1, 1445 },
-{ 0x10, 155, 1, 1444 },
+{ 0x4, 163, 0, 1415 },
+{ 0x1, 163, 0, 1417 },
+{ 0x1, 170, 0, 1418 },
+{ 0x1, 169, 1, 1419 },
+{ 0x2, 163, 0, 1416 },
+{ 0x1, 148, 0, 1420 },
+{ 0x880, 154, 0, 1421 },
+{ 0x480, 154, 0, 1422 },
+{ 0x280, 154, 0, 1423 },
+{ 0x180, 154, 1, 1425 },
+{ 0x80, 155, 0, 1424 },
+{ 0x440, 154, 1, 1436 },
+{ 0x88, 156, 0, 1426 },
+{ 0x240, 154, 1, 1437 },
+{ 0x48, 156, 0, 1427 },
+{ 0x140, 154, 1, 1438 },
+{ 0x28, 156, 0, 1428 },
+{ 0xc0, 154, 1, 1440 },
+{ 0x40, 155, 1, 1439 },
+{ 0x18, 156, 1, 1430 },
+{ 0x8, 156, 0, 1429 },
+{ 0x220, 154, 1, 1441 },
+{ 0x44, 156, 0, 1431 },
+{ 0x120, 154, 1, 1442 },
+{ 0x24, 156, 0, 1432 },
+{ 0xa0, 154, 1, 1443 },
+{ 0x14, 156, 0, 1433 },
+{ 0x60, 154, 1, 1445 },
+{ 0x20, 155, 1, 1444 },
+{ 0xc, 156, 1, 1435 },
+{ 0x4, 156, 0, 1434 },
+{ 0x110, 154, 0, 1446 },
+{ 0x90, 154, 0, 1447 },
+{ 0x50, 154, 0, 1448 },
+{ 0x30, 154, 1, 1450 },
+{ 0x10, 155, 1, 1449 },
 { 0x1, 328, 0, 914 },
-{ 0x88, 154, 0, 1446 },
-{ 0x48, 154, 0, 1447 },
-{ 0x28, 154, 0, 1448 },
-{ 0x18, 154, 1, 1450 },
-{ 0x8, 155, 1, 1449 },
+{ 0x88, 154, 0, 1451 },
+{ 0x48, 154, 0, 1452 },
+{ 0x28, 154, 0, 1453 },
+{ 0x18, 154, 1, 1455 },
+{ 0x8, 155, 1, 1454 },
 { 0xc, 311, 0, 946 },
-{ 0x44, 154, 0, 1451 },
-{ 0x24, 154, 0, 1452 },
-{ 0x14, 154, 0, 1453 },
-{ 0xc, 154, 1, 1455 },
-{ 0x4, 155, 1, 1454 },
+{ 0x44, 154, 1, 1466 },
+{ 0x22, 156, 0, 1456 },
+{ 0x24, 154, 1, 1467 },
+{ 0x12, 156, 0, 1457 },
+{ 0x14, 154, 1, 1468 },
+{ 0xa, 156, 0, 1458 },
+{ 0xc, 154, 1, 1470 },
+{ 0x4, 155, 1, 1469 },
+{ 0x6, 156, 1, 1460 },
+{ 0x2, 156, 1, 1459 },
 { 0x6, 311, 0, 947 },
-{ 0x22, 154, 0, 1456 },
-{ 0x12, 154, 0, 1457 },
-{ 0xa, 154, 0, 1458 },
-{ 0x6, 154, 1, 1460 },
-{ 0x2, 155, 1, 1459 },
+{ 0x22, 154, 1, 1471 },
+{ 0x11, 156, 0, 1461 },
+{ 0x12, 154, 1, 1472 },
+{ 0x9, 156, 0, 1462 },
+{ 0xa, 154, 1, 1473 },
+{ 0x5, 156, 0, 1463 },
+{ 0x6, 154, 1, 1475 },
+{ 0x2, 155, 1, 1474 },
+{ 0x3, 156, 1, 1465 },
+{ 0x1, 156, 1, 1464 },
 { 0x3, 311, 0, 948 },
-{ 0x11, 154, 0, 1461 },
-{ 0x9, 154, 0, 1462 },
-{ 0x5, 154, 0, 1463 },
-{ 0x3, 154, 1, 1465 },
-{ 0x1, 155, 1, 1464 },
+{ 0x11, 154, 0, 1476 },
+{ 0x9, 154, 0, 1477 },
+{ 0x5, 154, 0, 1478 },
+{ 0x3, 154, 1, 1480 },
+{ 0x1, 155, 1, 1479 },
 { 0x1, 108, 0, 915 },
-{ 0x8, 150, 0, 1466 },
-{ 0x4, 150, 0, 1467 },
-{ 0x2, 150, 0, 1468 },
-{ 0x1, 150, 1, 1470 },
-{ 0x1, 151, 1, 1469 },
+{ 0x8, 150, 0, 1481 },
+{ 0x4, 150, 0, 1482 },
+{ 0x2, 150, 0, 1483 },
+{ 0x1, 150, 1, 1485 },
+{ 0x1, 151, 1, 1484 },
 { 0x1, 275, 0, 927 },
-{ 0x8, 152, 0, 1471 },
-{ 0x4, 152, 0, 1472 },
-{ 0x2, 152, 0, 1473 },
-{ 0x1, 152, 1, 1475 },
-{ 0x1, 153, 1, 1474 },
+{ 0x8, 152, 0, 1486 },
+{ 0x4, 152, 0, 1487 },
+{ 0x2, 152, 0, 1488 },
+{ 0x1, 152, 1, 1490 },
+{ 0x1, 153, 1, 1489 },
 { 0x1, 274, 0, 928 },
-{ 0x8, 160, 0, 1476 },
-{ 0x4, 160, 0, 1477 },
-{ 0x2, 160, 0, 1478 },
-{ 0x1, 160, 1, 1480 },
-{ 0x1, 161, 1, 1479 },
+{ 0x8, 161, 0, 1491 },
+{ 0x4, 161, 0, 1492 },
+{ 0x2, 161, 0, 1493 },
+{ 0x1, 161, 1, 1495 },
+{ 0x1, 162, 1, 1494 },
 { 0x1, 273, 0, 929 },
-{ 0x8, 163, 0, 1481 },
-{ 0x4, 163, 0, 1482 },
-{ 0x2, 163, 0, 1483 },
-{ 0x1, 163, 1, 1485 },
-{ 0x1, 164, 1, 1484 },
+{ 0x8, 164, 0, 1496 },
+{ 0x4, 164, 0, 1497 },
+{ 0x2, 164, 0, 1498 },
+{ 0x1, 164, 1, 1500 },
+{ 0x1, 165, 1, 1499 },
 { 0x1, 272, 0, 930 },
-{ 0x8, 175, 0, 1486 },
-{ 0x4, 175, 0, 1487 },
-{ 0x2, 175, 0, 1488 },
-{ 0x1, 175, 1, 1490 },
-{ 0x1, 176, 0, 1489 },
-{ 0x8, 173, 0, 1491 },
-{ 0x4, 173, 0, 1492 },
-{ 0x2, 173, 0, 1493 },
-{ 0x1, 173, 1, 1495 },
-{ 0x1, 174, 0, 1494 },
-{ 0x1, 283, 0, 1496 },
-{ 0x1, 31, 0, 1497 },
-{ 0x8, 109, 0, 1498 },
-{ 0x4, 109, 0, 1499 },
-{ 0x2, 109, 0, 1500 },
-{ 0x1, 109, 1, 1502 },
-{ 0x1, 110, 0, 1501 },
-{ 0x8, 113, 0, 1503 },
-{ 0x4, 113, 0, 1504 },
-{ 0x2, 113, 0, 1505 },
-{ 0x1, 113, 1, 1507 },
-{ 0x1, 114, 0, 1506 },
-{ 0x8, 183, 0, 1508 },
-{ 0x4, 183, 0, 1509 },
-{ 0x2, 183, 0, 1510 },
-{ 0x1, 183, 1, 1512 },
-{ 0x1, 184, 0, 1511 },
-{ 0x1, 125, 0, 1513 },
-{ 0x442, 123, 0, 1514 },
-{ 0x242, 123, 0, 1515 },
-{ 0x142, 123, 0, 1516 },
-{ 0xc2, 123, 1, 1518 },
-{ 0x6, 124, 0, 1517 },
-{ 0x22, 123, 0, 1524 },
-{ 0x12, 123, 0, 1525 },
-{ 0xa, 123, 0, 1526 },
-{ 0x6, 123, 1, 1528 },
-{ 0x2, 124, 1, 1527 },
+{ 0x8, 176, 0, 1501 },
+{ 0x4, 176, 0, 1502 },
+{ 0x2, 176, 0, 1503 },
+{ 0x1, 176, 1, 1505 },
+{ 0x1, 177, 0, 1504 },
+{ 0x8, 174, 0, 1506 },
+{ 0x4, 174, 0, 1507 },
+{ 0x2, 174, 0, 1508 },
+{ 0x1, 174, 1, 1510 },
+{ 0x1, 175, 0, 1509 },
+{ 0x1, 283, 0, 1511 },
+{ 0x1, 31, 0, 1512 },
+{ 0x8, 109, 0, 1513 },
+{ 0x4, 109, 0, 1514 },
+{ 0x2, 109, 0, 1515 },
+{ 0x1, 109, 1, 1517 },
+{ 0x1, 110, 0, 1516 },
+{ 0x8, 113, 0, 1518 },
+{ 0x4, 113, 0, 1519 },
+{ 0x2, 113, 0, 1520 },
+{ 0x1, 113, 1, 1522 },
+{ 0x1, 114, 0, 1521 },
+{ 0x8, 183, 0, 1523 },
+{ 0x4, 183, 0, 1524 },
+{ 0x2, 183, 0, 1525 },
+{ 0x1, 183, 1, 1527 },
+{ 0x1, 184, 0, 1526 },
+{ 0x1, 125, 0, 1528 },
+{ 0x442, 123, 0, 1529 },
+{ 0x242, 123, 0, 1530 },
+{ 0x142, 123, 0, 1531 },
+{ 0xc2, 123, 1, 1533 },
+{ 0x6, 124, 0, 1532 },
+{ 0x22, 123, 0, 1539 },
+{ 0x12, 123, 0, 1540 },
+{ 0xa, 123, 0, 1541 },
+{ 0x6, 123, 1, 1543 },
+{ 0x2, 124, 1, 1542 },
 { 0x1, 93, 0, 1070 },
-{ 0x221, 123, 0, 1519 },
-{ 0x121, 123, 0, 1520 },
-{ 0xa1, 123, 0, 1521 },
-{ 0x61, 123, 1, 1523 },
-{ 0x3, 124, 0, 1522 },
-{ 0x11, 123, 0, 1529 },
-{ 0x9, 123, 0, 1530 },
-{ 0x5, 123, 0, 1531 },
-{ 0x3, 123, 1, 1533 },
-{ 0x1, 124, 1, 1532 },
+{ 0x221, 123, 0, 1534 },
+{ 0x121, 123, 0, 1535 },
+{ 0xa1, 123, 0, 1536 },
+{ 0x61, 123, 1, 1538 },
+{ 0x3, 124, 0, 1537 },
+{ 0x11, 123, 0, 1544 },
+{ 0x9, 123, 0, 1545 },
+{ 0x5, 123, 0, 1546 },
+{ 0x3, 123, 1, 1548 },
+{ 0x1, 124, 1, 1547 },
 { 0x1, 92, 0, 1071 },
-{ 0x1, 189, 0, 1534 },
-{ 0x1, 147, 0, 1535 },
-{ 0x1, 107, 0, 1536 },
-{ 0x1, 106, 0, 1537 },
-{ 0x4, 186, 0, 1538 },
-{ 0x2, 186, 0, 1539 },
-{ 0x1, 186, 0, 1540 },
-{ 0x1, 149, 0, 1541 },
-{ 0x2, 187, 0, 1542 },
-{ 0x1, 187, 0, 1543 },
-{ 0x4, 137, 0, 1544 },
-{ 0x2, 137, 0, 1545 },
-{ 0x1, 137, 0, 1546 },
-{ 0x4, 134, 0, 1547 },
-{ 0x1, 142, 0, 1550 },
-{ 0x1, 141, 1, 1551 },
-{ 0x2, 134, 0, 1548 },
-{ 0x1, 100, 0, 1552 },
-{ 0x1, 241, 1, 1553 },
-{ 0x1, 134, 0, 1549 },
-{ 0x8, 102, 0, 1554 },
-{ 0x4, 102, 0, 1555 },
-{ 0x2, 102, 0, 1556 },
-{ 0x1, 102, 1, 1558 },
-{ 0x1, 103, 0, 1557 },
-{ 0x8, 104, 0, 1559 },
-{ 0x4, 104, 0, 1560 },
-{ 0x2, 104, 0, 1561 },
-{ 0x1, 104, 1, 1563 },
-{ 0x1, 105, 1, 1562 },
+{ 0x1, 189, 0, 1549 },
+{ 0x1, 147, 0, 1550 },
+{ 0x1, 107, 0, 1551 },
+{ 0x1, 106, 0, 1552 },
+{ 0x4, 186, 0, 1553 },
+{ 0x2, 186, 0, 1554 },
+{ 0x1, 186, 0, 1555 },
+{ 0x1, 149, 0, 1556 },
+{ 0x2, 187, 0, 1557 },
+{ 0x1, 187, 0, 1558 },
+{ 0x4, 137, 0, 1559 },
+{ 0x2, 137, 0, 1560 },
+{ 0x1, 137, 0, 1561 },
+{ 0x4, 134, 0, 1562 },
+{ 0x1, 142, 0, 1565 },
+{ 0x1, 141, 1, 1566 },
+{ 0x2, 134, 0, 1563 },
+{ 0x1, 100, 0, 1567 },
+{ 0x1, 241, 1, 1568 },
+{ 0x1, 134, 0, 1564 },
+{ 0x8, 102, 0, 1569 },
+{ 0x4, 102, 0, 1570 },
+{ 0x2, 102, 0, 1571 },
+{ 0x1, 102, 1, 1573 },
+{ 0x1, 103, 0, 1572 },
+{ 0x8, 104, 0, 1574 },
+{ 0x4, 104, 0, 1575 },
+{ 0x2, 104, 0, 1576 },
+{ 0x1, 104, 1, 1578 },
+{ 0x1, 105, 1, 1577 },
 { 0x1, 367, 0, 1072 },
-{ 0x8, 132, 0, 1564 },
-{ 0x4, 132, 0, 1565 },
-{ 0x2, 132, 0, 1566 },
-{ 0x1, 132, 1, 1568 },
-{ 0x1, 133, 1, 1567 },
+{ 0x8, 132, 0, 1579 },
+{ 0x4, 132, 0, 1580 },
+{ 0x2, 132, 0, 1581 },
+{ 0x1, 132, 1, 1583 },
+{ 0x1, 133, 1, 1582 },
 { 0x1, 366, 0, 1073 },
-{ 0x8, 135, 0, 1569 },
-{ 0x4, 135, 0, 1570 },
-{ 0x2, 135, 0, 1571 },
-{ 0x1, 135, 1, 1573 },
-{ 0x1, 136, 1, 1572 },
+{ 0x8, 135, 0, 1584 },
+{ 0x4, 135, 0, 1585 },
+{ 0x2, 135, 0, 1586 },
+{ 0x1, 135, 1, 1588 },
+{ 0x1, 136, 1, 1587 },
 { 0x1, 365, 0, 1074 },
-{ 0x8, 180, 0, 1574 },
-{ 0x4, 180, 0, 1575 },
-{ 0x2, 180, 0, 1576 },
-{ 0x1, 180, 1, 1578 },
-{ 0x1, 181, 0, 1577 },
-{ 0x8, 178, 0, 1579 },
-{ 0x4, 178, 0, 1580 },
-{ 0x2, 178, 0, 1581 },
-{ 0x1, 178, 1, 1583 },
-{ 0x1, 179, 0, 1582 },
-{ 0x8, 42, 0, 1588 },
-{ 0x18, 42, 0, 1584 },
-{ 0x4, 42, 0, 1589 },
-{ 0xc, 42, 0, 1585 },
-{ 0x2, 42, 0, 1590 },
-{ 0x6, 42, 0, 1586 },
-{ 0x1, 42, 0, 1591 },
-{ 0x3, 42, 0, 1587 },
-{ 0x51, 28, 0, 1593 },
-{ 0xd1, 28, 0, 1592 },
-{ 0x31, 28, 1, 1603 },
-{ 0x11, 29, 0, 1602 },
-{ 0x71, 28, 1, 1601 },
-{ 0x31, 29, 0, 1600 },
-{ 0x29, 28, 0, 1595 },
-{ 0x69, 28, 0, 1594 },
-{ 0x19, 28, 1, 1607 },
-{ 0x9, 29, 0, 1606 },
-{ 0x39, 28, 1, 1605 },
-{ 0x19, 29, 0, 1604 },
-{ 0x15, 28, 0, 1597 },
-{ 0x35, 28, 0, 1596 },
-{ 0xd, 28, 1, 1611 },
-{ 0x5, 29, 0, 1610 },
-{ 0x1d, 28, 1, 1609 },
-{ 0xd, 29, 0, 1608 },
-{ 0xb, 28, 0, 1599 },
-{ 0x1b, 28, 0, 1598 },
-{ 0x7, 28, 1, 1615 },
-{ 0x3, 29, 0, 1614 },
-{ 0xf, 28, 1, 1613 },
-{ 0x7, 29, 0, 1612 },
-{ 0xa2, 26, 0, 1617 },
-{ 0x1a2, 26, 0, 1616 },
-{ 0x62, 26, 1, 1627 },
-{ 0x22, 27, 0, 1626 },
-{ 0xe2, 26, 1, 1625 },
-{ 0x62, 27, 0, 1624 },
-{ 0x52, 26, 0, 1619 },
-{ 0xd2, 26, 0, 1618 },
-{ 0x32, 26, 1, 1631 },
-{ 0x12, 27, 0, 1630 },
-{ 0x72, 26, 1, 1629 },
-{ 0x32, 27, 0, 1628 },
-{ 0x2a, 26, 0, 1621 },
-{ 0x6a, 26, 0, 1620 },
-{ 0x1a, 26, 1, 1635 },
-{ 0xa, 27, 0, 1634 },
-{ 0x3a, 26, 1, 1633 },
-{ 0x1a, 27, 0, 1632 },
-{ 0x16, 26, 0, 1623 },
-{ 0x36, 26, 0, 1622 },
-{ 0xe, 26, 1, 1639 },
-{ 0x6, 27, 0, 1638 },
-{ 0x1e, 26, 1, 1637 },
-{ 0xe, 27, 0, 1636 },
-{ 0x51, 26, 0, 1641 },
-{ 0xd1, 26, 0, 1640 },
-{ 0x31, 26, 1, 1651 },
-{ 0x11, 27, 0, 1650 },
-{ 0x71, 26, 1, 1649 },
-{ 0x31, 27, 0, 1648 },
-{ 0x29, 26, 0, 1643 },
-{ 0x69, 26, 0, 1642 },
-{ 0x19, 26, 1, 1655 },
-{ 0x9, 27, 0, 1654 },
-{ 0x39, 26, 1, 1653 },
-{ 0x19, 27, 0, 1652 },
-{ 0x15, 26, 0, 1645 },
-{ 0x35, 26, 0, 1644 },
-{ 0xd, 26, 1, 1659 },
-{ 0x5, 27, 0, 1658 },
-{ 0x1d, 26, 1, 1657 },
-{ 0xd, 27, 0, 1656 },
-{ 0xb, 26, 0, 1647 },
-{ 0x1b, 26, 0, 1646 },
-{ 0x7, 26, 1, 1663 },
-{ 0x3, 27, 0, 1662 },
-{ 0xf, 26, 1, 1661 },
-{ 0x7, 27, 0, 1660 },
-{ 0x51, 24, 0, 1665 },
-{ 0xd1, 24, 0, 1664 },
-{ 0x31, 24, 1, 1675 },
-{ 0x11, 25, 0, 1674 },
-{ 0x71, 24, 1, 1673 },
-{ 0x31, 25, 0, 1672 },
-{ 0x29, 24, 0, 1667 },
-{ 0x69, 24, 0, 1666 },
-{ 0x19, 24, 1, 1679 },
-{ 0x9, 25, 0, 1678 },
-{ 0x39, 24, 1, 1677 },
-{ 0x19, 25, 0, 1676 },
-{ 0x15, 24, 0, 1669 },
-{ 0x35, 24, 0, 1668 },
-{ 0xd, 24, 1, 1683 },
-{ 0x5, 25, 0, 1682 },
-{ 0x1d, 24, 1, 1681 },
-{ 0xd, 25, 0, 1680 },
-{ 0xb, 24, 0, 1671 },
-{ 0x1b, 24, 0, 1670 },
-{ 0x7, 24, 1, 1687 },
-{ 0x3, 25, 0, 1686 },
-{ 0xf, 24, 1, 1685 },
-{ 0x7, 25, 0, 1684 },
-{ 0xa2, 22, 0, 1689 },
-{ 0x1a2, 22, 0, 1688 },
-{ 0x62, 22, 1, 1699 },
-{ 0x22, 23, 0, 1698 },
-{ 0xe2, 22, 1, 1697 },
-{ 0x62, 23, 0, 1696 },
-{ 0x52, 22, 0, 1691 },
-{ 0xd2, 22, 0, 1690 },
-{ 0x32, 22, 1, 1703 },
-{ 0x12, 23, 0, 1702 },
-{ 0x72, 22, 1, 1701 },
-{ 0x32, 23, 0, 1700 },
-{ 0x2a, 22, 0, 1693 },
-{ 0x6a, 22, 0, 1692 },
-{ 0x1a, 22, 1, 1707 },
-{ 0xa, 23, 0, 1706 },
-{ 0x3a, 22, 1, 1705 },
-{ 0x1a, 23, 0, 1704 },
-{ 0x16, 22, 0, 1695 },
-{ 0x36, 22, 0, 1694 },
-{ 0xe, 22, 1, 1711 },
-{ 0x6, 23, 0, 1710 },
-{ 0x1e, 22, 1, 1709 },
-{ 0xe, 23, 0, 1708 },
-{ 0x51, 22, 0, 1713 },
-{ 0xd1, 22, 0, 1712 },
-{ 0x31, 22, 1, 1723 },
-{ 0x11, 23, 0, 1722 },
-{ 0x71, 22, 1, 1721 },
-{ 0x31, 23, 0, 1720 },
-{ 0x29, 22, 0, 1715 },
-{ 0x69, 22, 0, 1714 },
-{ 0x19, 22, 1, 1727 },
-{ 0x9, 23, 0, 1726 },
-{ 0x39, 22, 1, 1725 },
-{ 0x19, 23, 0, 1724 },
-{ 0x15, 22, 0, 1717 },
-{ 0x35, 22, 0, 1716 },
-{ 0xd, 22, 1, 1731 },
-{ 0x5, 23, 0, 1730 },
-{ 0x1d, 22, 1, 1729 },
-{ 0xd, 23, 0, 1728 },
-{ 0xb, 22, 0, 1719 },
-{ 0x1b, 22, 0, 1718 },
-{ 0x7, 22, 1, 1735 },
-{ 0x3, 23, 0, 1734 },
-{ 0xf, 22, 1, 1733 },
-{ 0x7, 23, 0, 1732 },
-{ 0x51, 20, 1, 1761 },
-{ 0x50, 20, 0, 1737 },
-{ 0xd1, 20, 1, 1760 },
-{ 0xd0, 20, 0, 1736 },
-{ 0x31, 20, 1, 1771 },
-{ 0x30, 20, 1, 1747 },
-{ 0x11, 21, 1, 1770 },
-{ 0x10, 21, 0, 1746 },
-{ 0x71, 20, 1, 1769 },
-{ 0x70, 20, 1, 1745 },
-{ 0x31, 21, 1, 1768 },
-{ 0x30, 21, 0, 1744 },
-{ 0x29, 20, 1, 1763 },
-{ 0x28, 20, 0, 1739 },
-{ 0x69, 20, 1, 1762 },
-{ 0x68, 20, 0, 1738 },
-{ 0x19, 20, 1, 1775 },
-{ 0x18, 20, 1, 1751 },
-{ 0x9, 21, 1, 1774 },
-{ 0x8, 21, 0, 1750 },
-{ 0x39, 20, 1, 1773 },
-{ 0x38, 20, 1, 1749 },
-{ 0x19, 21, 1, 1772 },
-{ 0x18, 21, 0, 1748 },
-{ 0x15, 20, 1, 1765 },
-{ 0x14, 20, 0, 1741 },
-{ 0x35, 20, 1, 1764 },
-{ 0x34, 20, 0, 1740 },
-{ 0xd, 20, 1, 1779 },
-{ 0xc, 20, 1, 1755 },
-{ 0x5, 21, 1, 1778 },
-{ 0x4, 21, 0, 1754 },
-{ 0x1d, 20, 1, 1777 },
-{ 0x1c, 20, 1, 1753 },
-{ 0xd, 21, 1, 1776 },
-{ 0xc, 21, 0, 1752 },
-{ 0xb, 20, 1, 1767 },
-{ 0xa, 20, 0, 1743 },
-{ 0x1b, 20, 1, 1766 },
-{ 0x1a, 20, 0, 1742 },
-{ 0x7, 20, 1, 1783 },
-{ 0x6, 20, 1, 1759 },
-{ 0x3, 21, 1, 1782 },
-{ 0x2, 21, 0, 1758 },
-{ 0xf, 20, 1, 1781 },
-{ 0xe, 20, 1, 1757 },
-{ 0x7, 21, 1, 1780 },
-{ 0x6, 21, 0, 1756 },
-{ 0x8, 19, 0, 1785 },
-{ 0x18, 19, 0, 1784 },
-{ 0x1, 19, 1, 1789 },
-{ 0x2, 19, 0, 1788 },
-{ 0x3, 19, 1, 1787 },
-{ 0x4, 19, 0, 1786 },
-{ 0x1, 282, 0, 1790 },
-{ 0x14, 41, 0, 1793 },
-{ 0x34, 41, 0, 1791 },
-{ 0xc, 41, 0, 1794 },
-{ 0x1c, 41, 0, 1792 },
-{ 0x2, 41, 0, 1797 },
-{ 0x6, 41, 0, 1795 },
-{ 0x1, 41, 0, 1798 },
-{ 0x3, 41, 0, 1796 },
-{ 0x51, 17, 0, 1800 },
-{ 0xd1, 17, 0, 1799 },
-{ 0x31, 17, 1, 1810 },
-{ 0x11, 18, 0, 1809 },
-{ 0x71, 17, 1, 1808 },
-{ 0x31, 18, 0, 1807 },
-{ 0x29, 17, 0, 1802 },
-{ 0x69, 17, 0, 1801 },
-{ 0x19, 17, 1, 1814 },
-{ 0x9, 18, 0, 1813 },
-{ 0x39, 17, 1, 1812 },
-{ 0x19, 18, 0, 1811 },
-{ 0x15, 17, 0, 1804 },
-{ 0x35, 17, 0, 1803 },
-{ 0xd, 17, 1, 1818 },
-{ 0x5, 18, 0, 1817 },
-{ 0x1d, 17, 1, 1816 },
-{ 0xd, 18, 0, 1815 },
-{ 0xb, 17, 0, 1806 },
-{ 0x1b, 17, 0, 1805 },
-{ 0x7, 17, 1, 1822 },
-{ 0x3, 18, 0, 1821 },
-{ 0xf, 17, 1, 1820 },
-{ 0x7, 18, 0, 1819 },
-{ 0x1, 30, 0, 1823 },
-{ 0x1, 98, 0, 1824 },
-{ 0x2, 43, 0, 1825 },
-{ 0x1, 43, 0, 1826 },
-{ 0x1, 330, 0, 1827 },
-{ 0x2, 50, 0, 1828 },
-{ 0x1, 50, 0, 1829 },
-{ 0x1, 91, 0, 1830 },
-{ 0x51, 15, 0, 1832 },
-{ 0xd1, 15, 0, 1831 },
-{ 0x31, 15, 1, 1842 },
-{ 0x11, 16, 0, 1841 },
-{ 0x71, 15, 1, 1840 },
-{ 0x31, 16, 0, 1839 },
-{ 0x29, 15, 0, 1834 },
-{ 0x69, 15, 0, 1833 },
-{ 0x19, 15, 1, 1846 },
-{ 0x9, 16, 0, 1845 },
-{ 0x39, 15, 1, 1844 },
-{ 0x19, 16, 0, 1843 },
-{ 0x15, 15, 0, 1836 },
-{ 0x35, 15, 0, 1835 },
-{ 0xd, 15, 1, 1850 },
-{ 0x5, 16, 0, 1849 },
-{ 0x1d, 15, 1, 1848 },
-{ 0xd, 16, 0, 1847 },
-{ 0xb, 15, 0, 1838 },
-{ 0x1b, 15, 0, 1837 },
-{ 0x7, 15, 1, 1854 },
-{ 0x3, 16, 0, 1853 },
-{ 0xf, 15, 1, 1852 },
-{ 0x7, 16, 0, 1851 },
-{ 0xa20, 13, 0, 1856 },
-{ 0x1a20, 13, 0, 1855 },
-{ 0x620, 13, 1, 1866 },
-{ 0x220, 14, 0, 1865 },
-{ 0xe20, 13, 1, 1864 },
-{ 0x620, 14, 0, 1863 },
-{ 0x520, 13, 0, 1858 },
-{ 0xd20, 13, 0, 1857 },
-{ 0x320, 13, 1, 1870 },
-{ 0x120, 14, 0, 1869 },
-{ 0x720, 13, 1, 1868 },
-{ 0x320, 14, 0, 1867 },
-{ 0x2a0, 13, 0, 1860 },
-{ 0x6a0, 13, 0, 1859 },
-{ 0x1a0, 13, 1, 1874 },
-{ 0xa0, 14, 0, 1873 },
-{ 0x3a0, 13, 1, 1872 },
-{ 0x1a0, 14, 0, 1871 },
-{ 0x160, 13, 0, 1862 },
-{ 0x360, 13, 0, 1861 },
-{ 0xe0, 13, 1, 1878 },
-{ 0x60, 14, 0, 1877 },
-{ 0x1e0, 13, 1, 1876 },
-{ 0xe0, 14, 0, 1875 },
-{ 0x51, 13, 1, 1904 },
-{ 0x50, 13, 0, 1880 },
-{ 0xd1, 13, 1, 1903 },
-{ 0xd0, 13, 0, 1879 },
-{ 0x31, 13, 1, 1914 },
-{ 0x30, 13, 1, 1890 },
-{ 0x11, 14, 1, 1913 },
-{ 0x10, 14, 0, 1889 },
-{ 0x71, 13, 1, 1912 },
-{ 0x70, 13, 1, 1888 },
-{ 0x31, 14, 1, 1911 },
-{ 0x30, 14, 0, 1887 },
-{ 0x29, 13, 1, 1906 },
-{ 0x28, 13, 0, 1882 },
-{ 0x69, 13, 1, 1905 },
-{ 0x68, 13, 0, 1881 },
-{ 0x19, 13, 1, 1918 },
-{ 0x18, 13, 1, 1894 },
-{ 0x9, 14, 1, 1917 },
-{ 0x8, 14, 0, 1893 },
-{ 0x39, 13, 1, 1916 },
-{ 0x38, 13, 1, 1892 },
-{ 0x19, 14, 1, 1915 },
-{ 0x18, 14, 0, 1891 },
-{ 0x15, 13, 1, 1908 },
-{ 0x14, 13, 0, 1884 },
-{ 0x35, 13, 1, 1907 },
-{ 0x34, 13, 0, 1883 },
-{ 0xd, 13, 1, 1922 },
-{ 0xc, 13, 1, 1898 },
-{ 0x5, 14, 1, 1921 },
-{ 0x4, 14, 0, 1897 },
-{ 0x1d, 13, 1, 1920 },
-{ 0x1c, 13, 1, 1896 },
-{ 0xd, 14, 1, 1919 },
-{ 0xc, 14, 0, 1895 },
-{ 0xb, 13, 1, 1910 },
-{ 0xa, 13, 0, 1886 },
-{ 0x1b, 13, 1, 1909 },
-{ 0x1a, 13, 0, 1885 },
-{ 0x7, 13, 1, 1926 },
-{ 0x6, 13, 1, 1902 },
-{ 0x3, 14, 1, 1925 },
-{ 0x2, 14, 0, 1901 },
-{ 0xf, 13, 1, 1924 },
-{ 0xe, 13, 1, 1900 },
-{ 0x7, 14, 1, 1923 },
-{ 0x6, 14, 0, 1899 },
-{ 0x8, 12, 0, 1928 },
-{ 0x18, 12, 0, 1927 },
-{ 0x1, 12, 1, 1932 },
-{ 0x2, 12, 0, 1931 },
-{ 0x3, 12, 1, 1930 },
-{ 0x4, 12, 0, 1929 },
-{ 0x1, 80, 1, 1992 },
-{ 0x1, 81, 1, 1991 },
-{ 0x1, 82, 1, 1990 },
-{ 0x1, 83, 1, 1989 },
+{ 0x8, 180, 0, 1589 },
+{ 0x4, 180, 0, 1590 },
+{ 0x2, 180, 0, 1591 },
+{ 0x1, 180, 1, 1593 },
+{ 0x1, 181, 0, 1592 },
+{ 0x8, 178, 0, 1594 },
+{ 0x4, 178, 0, 1595 },
+{ 0x2, 178, 0, 1596 },
+{ 0x1, 178, 1, 1598 },
+{ 0x1, 179, 0, 1597 },
+{ 0x8, 42, 0, 1603 },
+{ 0x18, 42, 0, 1599 },
+{ 0x4, 42, 0, 1604 },
+{ 0xc, 42, 0, 1600 },
+{ 0x2, 42, 0, 1605 },
+{ 0x6, 42, 0, 1601 },
+{ 0x1, 42, 0, 1606 },
+{ 0x3, 42, 0, 1602 },
+{ 0x51, 28, 0, 1608 },
+{ 0xd1, 28, 0, 1607 },
+{ 0x31, 28, 1, 1618 },
+{ 0x11, 29, 0, 1617 },
+{ 0x71, 28, 1, 1616 },
+{ 0x31, 29, 0, 1615 },
+{ 0x29, 28, 0, 1610 },
+{ 0x69, 28, 0, 1609 },
+{ 0x19, 28, 1, 1622 },
+{ 0x9, 29, 0, 1621 },
+{ 0x39, 28, 1, 1620 },
+{ 0x19, 29, 0, 1619 },
+{ 0x15, 28, 0, 1612 },
+{ 0x35, 28, 0, 1611 },
+{ 0xd, 28, 1, 1626 },
+{ 0x5, 29, 0, 1625 },
+{ 0x1d, 28, 1, 1624 },
+{ 0xd, 29, 0, 1623 },
+{ 0xb, 28, 0, 1614 },
+{ 0x1b, 28, 0, 1613 },
+{ 0x7, 28, 1, 1630 },
+{ 0x3, 29, 0, 1629 },
+{ 0xf, 28, 1, 1628 },
+{ 0x7, 29, 0, 1627 },
+{ 0xa2, 26, 0, 1632 },
+{ 0x1a2, 26, 0, 1631 },
+{ 0x62, 26, 1, 1642 },
+{ 0x22, 27, 0, 1641 },
+{ 0xe2, 26, 1, 1640 },
+{ 0x62, 27, 0, 1639 },
+{ 0x52, 26, 0, 1634 },
+{ 0xd2, 26, 0, 1633 },
+{ 0x32, 26, 1, 1646 },
+{ 0x12, 27, 0, 1645 },
+{ 0x72, 26, 1, 1644 },
+{ 0x32, 27, 0, 1643 },
+{ 0x2a, 26, 0, 1636 },
+{ 0x6a, 26, 0, 1635 },
+{ 0x1a, 26, 1, 1650 },
+{ 0xa, 27, 0, 1649 },
+{ 0x3a, 26, 1, 1648 },
+{ 0x1a, 27, 0, 1647 },
+{ 0x16, 26, 0, 1638 },
+{ 0x36, 26, 0, 1637 },
+{ 0xe, 26, 1, 1654 },
+{ 0x6, 27, 0, 1653 },
+{ 0x1e, 26, 1, 1652 },
+{ 0xe, 27, 0, 1651 },
+{ 0x51, 26, 0, 1656 },
+{ 0xd1, 26, 0, 1655 },
+{ 0x31, 26, 1, 1666 },
+{ 0x11, 27, 0, 1665 },
+{ 0x71, 26, 1, 1664 },
+{ 0x31, 27, 0, 1663 },
+{ 0x29, 26, 0, 1658 },
+{ 0x69, 26, 0, 1657 },
+{ 0x19, 26, 1, 1670 },
+{ 0x9, 27, 0, 1669 },
+{ 0x39, 26, 1, 1668 },
+{ 0x19, 27, 0, 1667 },
+{ 0x15, 26, 0, 1660 },
+{ 0x35, 26, 0, 1659 },
+{ 0xd, 26, 1, 1674 },
+{ 0x5, 27, 0, 1673 },
+{ 0x1d, 26, 1, 1672 },
+{ 0xd, 27, 0, 1671 },
+{ 0xb, 26, 0, 1662 },
+{ 0x1b, 26, 0, 1661 },
+{ 0x7, 26, 1, 1678 },
+{ 0x3, 27, 0, 1677 },
+{ 0xf, 26, 1, 1676 },
+{ 0x7, 27, 0, 1675 },
+{ 0x51, 24, 0, 1680 },
+{ 0xd1, 24, 0, 1679 },
+{ 0x31, 24, 1, 1690 },
+{ 0x11, 25, 0, 1689 },
+{ 0x71, 24, 1, 1688 },
+{ 0x31, 25, 0, 1687 },
+{ 0x29, 24, 0, 1682 },
+{ 0x69, 24, 0, 1681 },
+{ 0x19, 24, 1, 1694 },
+{ 0x9, 25, 0, 1693 },
+{ 0x39, 24, 1, 1692 },
+{ 0x19, 25, 0, 1691 },
+{ 0x15, 24, 0, 1684 },
+{ 0x35, 24, 0, 1683 },
+{ 0xd, 24, 1, 1698 },
+{ 0x5, 25, 0, 1697 },
+{ 0x1d, 24, 1, 1696 },
+{ 0xd, 25, 0, 1695 },
+{ 0xb, 24, 0, 1686 },
+{ 0x1b, 24, 0, 1685 },
+{ 0x7, 24, 1, 1702 },
+{ 0x3, 25, 0, 1701 },
+{ 0xf, 24, 1, 1700 },
+{ 0x7, 25, 0, 1699 },
+{ 0xa2, 22, 0, 1704 },
+{ 0x1a2, 22, 0, 1703 },
+{ 0x62, 22, 1, 1714 },
+{ 0x22, 23, 0, 1713 },
+{ 0xe2, 22, 1, 1712 },
+{ 0x62, 23, 0, 1711 },
+{ 0x52, 22, 0, 1706 },
+{ 0xd2, 22, 0, 1705 },
+{ 0x32, 22, 1, 1718 },
+{ 0x12, 23, 0, 1717 },
+{ 0x72, 22, 1, 1716 },
+{ 0x32, 23, 0, 1715 },
+{ 0x2a, 22, 0, 1708 },
+{ 0x6a, 22, 0, 1707 },
+{ 0x1a, 22, 1, 1722 },
+{ 0xa, 23, 0, 1721 },
+{ 0x3a, 22, 1, 1720 },
+{ 0x1a, 23, 0, 1719 },
+{ 0x16, 22, 0, 1710 },
+{ 0x36, 22, 0, 1709 },
+{ 0xe, 22, 1, 1726 },
+{ 0x6, 23, 0, 1725 },
+{ 0x1e, 22, 1, 1724 },
+{ 0xe, 23, 0, 1723 },
+{ 0x51, 22, 0, 1728 },
+{ 0xd1, 22, 0, 1727 },
+{ 0x31, 22, 1, 1738 },
+{ 0x11, 23, 0, 1737 },
+{ 0x71, 22, 1, 1736 },
+{ 0x31, 23, 0, 1735 },
+{ 0x29, 22, 0, 1730 },
+{ 0x69, 22, 0, 1729 },
+{ 0x19, 22, 1, 1742 },
+{ 0x9, 23, 0, 1741 },
+{ 0x39, 22, 1, 1740 },
+{ 0x19, 23, 0, 1739 },
+{ 0x15, 22, 0, 1732 },
+{ 0x35, 22, 0, 1731 },
+{ 0xd, 22, 1, 1746 },
+{ 0x5, 23, 0, 1745 },
+{ 0x1d, 22, 1, 1744 },
+{ 0xd, 23, 0, 1743 },
+{ 0xb, 22, 0, 1734 },
+{ 0x1b, 22, 0, 1733 },
+{ 0x7, 22, 1, 1750 },
+{ 0x3, 23, 0, 1749 },
+{ 0xf, 22, 1, 1748 },
+{ 0x7, 23, 0, 1747 },
+{ 0x51, 20, 1, 1776 },
+{ 0x50, 20, 0, 1752 },
+{ 0xd1, 20, 1, 1775 },
+{ 0xd0, 20, 0, 1751 },
+{ 0x31, 20, 1, 1786 },
+{ 0x30, 20, 1, 1762 },
+{ 0x11, 21, 1, 1785 },
+{ 0x10, 21, 0, 1761 },
+{ 0x71, 20, 1, 1784 },
+{ 0x70, 20, 1, 1760 },
+{ 0x31, 21, 1, 1783 },
+{ 0x30, 21, 0, 1759 },
+{ 0x29, 20, 1, 1778 },
+{ 0x28, 20, 0, 1754 },
+{ 0x69, 20, 1, 1777 },
+{ 0x68, 20, 0, 1753 },
+{ 0x19, 20, 1, 1790 },
+{ 0x18, 20, 1, 1766 },
+{ 0x9, 21, 1, 1789 },
+{ 0x8, 21, 0, 1765 },
+{ 0x39, 20, 1, 1788 },
+{ 0x38, 20, 1, 1764 },
+{ 0x19, 21, 1, 1787 },
+{ 0x18, 21, 0, 1763 },
+{ 0x15, 20, 1, 1780 },
+{ 0x14, 20, 0, 1756 },
+{ 0x35, 20, 1, 1779 },
+{ 0x34, 20, 0, 1755 },
+{ 0xd, 20, 1, 1794 },
+{ 0xc, 20, 1, 1770 },
+{ 0x5, 21, 1, 1793 },
+{ 0x4, 21, 0, 1769 },
+{ 0x1d, 20, 1, 1792 },
+{ 0x1c, 20, 1, 1768 },
+{ 0xd, 21, 1, 1791 },
+{ 0xc, 21, 0, 1767 },
+{ 0xb, 20, 1, 1782 },
+{ 0xa, 20, 0, 1758 },
+{ 0x1b, 20, 1, 1781 },
+{ 0x1a, 20, 0, 1757 },
+{ 0x7, 20, 1, 1798 },
+{ 0x6, 20, 1, 1774 },
+{ 0x3, 21, 1, 1797 },
+{ 0x2, 21, 0, 1773 },
+{ 0xf, 20, 1, 1796 },
+{ 0xe, 20, 1, 1772 },
+{ 0x7, 21, 1, 1795 },
+{ 0x6, 21, 0, 1771 },
+{ 0x8, 19, 0, 1800 },
+{ 0x18, 19, 0, 1799 },
+{ 0x1, 19, 1, 1804 },
+{ 0x2, 19, 0, 1803 },
+{ 0x3, 19, 1, 1802 },
+{ 0x4, 19, 0, 1801 },
+{ 0x1, 282, 0, 1805 },
+{ 0x14, 41, 0, 1808 },
+{ 0x34, 41, 0, 1806 },
+{ 0xc, 41, 0, 1809 },
+{ 0x1c, 41, 0, 1807 },
+{ 0x2, 41, 0, 1812 },
+{ 0x6, 41, 0, 1810 },
+{ 0x1, 41, 0, 1813 },
+{ 0x3, 41, 0, 1811 },
+{ 0x51, 17, 0, 1815 },
+{ 0xd1, 17, 0, 1814 },
+{ 0x31, 17, 1, 1825 },
+{ 0x11, 18, 0, 1824 },
+{ 0x71, 17, 1, 1823 },
+{ 0x31, 18, 0, 1822 },
+{ 0x29, 17, 0, 1817 },
+{ 0x69, 17, 0, 1816 },
+{ 0x19, 17, 1, 1829 },
+{ 0x9, 18, 0, 1828 },
+{ 0x39, 17, 1, 1827 },
+{ 0x19, 18, 0, 1826 },
+{ 0x15, 17, 0, 1819 },
+{ 0x35, 17, 0, 1818 },
+{ 0xd, 17, 1, 1833 },
+{ 0x5, 18, 0, 1832 },
+{ 0x1d, 17, 1, 1831 },
+{ 0xd, 18, 0, 1830 },
+{ 0xb, 17, 0, 1821 },
+{ 0x1b, 17, 0, 1820 },
+{ 0x7, 17, 1, 1837 },
+{ 0x3, 18, 0, 1836 },
+{ 0xf, 17, 1, 1835 },
+{ 0x7, 18, 0, 1834 },
+{ 0x1, 30, 0, 1838 },
+{ 0x1, 98, 0, 1839 },
+{ 0x2, 43, 0, 1840 },
+{ 0x1, 43, 0, 1841 },
+{ 0x1, 330, 0, 1842 },
+{ 0x2, 50, 0, 1843 },
+{ 0x1, 50, 0, 1844 },
+{ 0x1, 91, 0, 1845 },
+{ 0x51, 15, 0, 1847 },
+{ 0xd1, 15, 0, 1846 },
+{ 0x31, 15, 1, 1857 },
+{ 0x11, 16, 0, 1856 },
+{ 0x71, 15, 1, 1855 },
+{ 0x31, 16, 0, 1854 },
+{ 0x29, 15, 0, 1849 },
+{ 0x69, 15, 0, 1848 },
+{ 0x19, 15, 1, 1861 },
+{ 0x9, 16, 0, 1860 },
+{ 0x39, 15, 1, 1859 },
+{ 0x19, 16, 0, 1858 },
+{ 0x15, 15, 0, 1851 },
+{ 0x35, 15, 0, 1850 },
+{ 0xd, 15, 1, 1865 },
+{ 0x5, 16, 0, 1864 },
+{ 0x1d, 15, 1, 1863 },
+{ 0xd, 16, 0, 1862 },
+{ 0xb, 15, 0, 1853 },
+{ 0x1b, 15, 0, 1852 },
+{ 0x7, 15, 1, 1869 },
+{ 0x3, 16, 0, 1868 },
+{ 0xf, 15, 1, 1867 },
+{ 0x7, 16, 0, 1866 },
+{ 0xa20, 13, 0, 1871 },
+{ 0x1a20, 13, 0, 1870 },
+{ 0x620, 13, 1, 1881 },
+{ 0x220, 14, 0, 1880 },
+{ 0xe20, 13, 1, 1879 },
+{ 0x620, 14, 0, 1878 },
+{ 0x520, 13, 0, 1873 },
+{ 0xd20, 13, 0, 1872 },
+{ 0x320, 13, 1, 1885 },
+{ 0x120, 14, 0, 1884 },
+{ 0x720, 13, 1, 1883 },
+{ 0x320, 14, 0, 1882 },
+{ 0x2a0, 13, 0, 1875 },
+{ 0x6a0, 13, 0, 1874 },
+{ 0x1a0, 13, 1, 1889 },
+{ 0xa0, 14, 0, 1888 },
+{ 0x3a0, 13, 1, 1887 },
+{ 0x1a0, 14, 0, 1886 },
+{ 0x160, 13, 0, 1877 },
+{ 0x360, 13, 0, 1876 },
+{ 0xe0, 13, 1, 1893 },
+{ 0x60, 14, 0, 1892 },
+{ 0x1e0, 13, 1, 1891 },
+{ 0xe0, 14, 0, 1890 },
+{ 0x51, 13, 1, 1919 },
+{ 0x50, 13, 0, 1895 },
+{ 0xd1, 13, 1, 1918 },
+{ 0xd0, 13, 0, 1894 },
+{ 0x31, 13, 1, 1929 },
+{ 0x30, 13, 1, 1905 },
+{ 0x11, 14, 1, 1928 },
+{ 0x10, 14, 0, 1904 },
+{ 0x71, 13, 1, 1927 },
+{ 0x70, 13, 1, 1903 },
+{ 0x31, 14, 1, 1926 },
+{ 0x30, 14, 0, 1902 },
+{ 0x29, 13, 1, 1921 },
+{ 0x28, 13, 0, 1897 },
+{ 0x69, 13, 1, 1920 },
+{ 0x68, 13, 0, 1896 },
+{ 0x19, 13, 1, 1933 },
+{ 0x18, 13, 1, 1909 },
+{ 0x9, 14, 1, 1932 },
+{ 0x8, 14, 0, 1908 },
+{ 0x39, 13, 1, 1931 },
+{ 0x38, 13, 1, 1907 },
+{ 0x19, 14, 1, 1930 },
+{ 0x18, 14, 0, 1906 },
+{ 0x15, 13, 1, 1923 },
+{ 0x14, 13, 0, 1899 },
+{ 0x35, 13, 1, 1922 },
+{ 0x34, 13, 0, 1898 },
+{ 0xd, 13, 1, 1937 },
+{ 0xc, 13, 1, 1913 },
+{ 0x5, 14, 1, 1936 },
+{ 0x4, 14, 0, 1912 },
+{ 0x1d, 13, 1, 1935 },
+{ 0x1c, 13, 1, 1911 },
+{ 0xd, 14, 1, 1934 },
+{ 0xc, 14, 0, 1910 },
+{ 0xb, 13, 1, 1925 },
+{ 0xa, 13, 0, 1901 },
+{ 0x1b, 13, 1, 1924 },
+{ 0x1a, 13, 0, 1900 },
+{ 0x7, 13, 1, 1941 },
+{ 0x6, 13, 1, 1917 },
+{ 0x3, 14, 1, 1940 },
+{ 0x2, 14, 0, 1916 },
+{ 0xf, 13, 1, 1939 },
+{ 0xe, 13, 1, 1915 },
+{ 0x7, 14, 1, 1938 },
+{ 0x6, 14, 0, 1914 },
+{ 0x8, 12, 0, 1943 },
+{ 0x18, 12, 0, 1942 },
+{ 0x1, 12, 1, 1947 },
+{ 0x2, 12, 0, 1946 },
+{ 0x3, 12, 1, 1945 },
+{ 0x4, 12, 0, 1944 },
+{ 0x1, 80, 1, 2007 },
+{ 0x1, 81, 1, 2006 },
+{ 0x1, 82, 1, 2005 },
+{ 0x1, 83, 1, 2004 },
 { 0x39, 39, 1, 20 },
 { 0x19, 40, 0, 19 },
-{ 0x3, 80, 1, 1988 },
-{ 0x3, 81, 1, 1987 },
-{ 0x3, 82, 1, 1986 },
-{ 0x3, 83, 1, 1985 },
+{ 0x3, 80, 1, 2003 },
+{ 0x3, 81, 1, 2002 },
+{ 0x3, 82, 1, 2001 },
+{ 0x3, 83, 1, 2000 },
 { 0x69, 39, 0, 9 },
-{ 0x14, 75, 1, 1982 },
-{ 0xa, 79, 1, 1981 },
+{ 0x14, 75, 1, 1997 },
+{ 0xa, 79, 1, 1996 },
 { 0xd1, 39, 0, 7 },
-{ 0x34, 75, 1, 1934 },
-{ 0xe, 86, 0, 1933 },
-{ 0xc, 75, 1, 2046 },
-{ 0x6, 79, 0, 2045 },
-{ 0x2, 75, 1, 1940 },
-{ 0x2, 78, 0, 1939 },
-{ 0x12, 75, 1, 1938 },
-{ 0x6, 78, 0, 1937 },
-{ 0xa, 75, 1, 1984 },
-{ 0x5, 79, 1, 1983 },
+{ 0x34, 75, 1, 1949 },
+{ 0xe, 86, 0, 1948 },
+{ 0xc, 75, 1, 2061 },
+{ 0x6, 79, 0, 2060 },
+{ 0x2, 75, 1, 1955 },
+{ 0x2, 78, 0, 1954 },
+{ 0x12, 75, 1, 1953 },
+{ 0x6, 78, 0, 1952 },
+{ 0xa, 75, 1, 1999 },
+{ 0x5, 79, 1, 1998 },
 { 0x71, 39, 1, 16 },
 { 0x31, 40, 0, 15 },
-{ 0x1a, 75, 1, 1936 },
-{ 0x7, 86, 0, 1935 },
-{ 0x6, 75, 1, 2048 },
-{ 0x3, 79, 0, 2047 },
-{ 0x1, 75, 1, 2056 },
-{ 0x1, 76, 1, 2055 },
-{ 0x1, 77, 1, 2054 },
-{ 0x1, 78, 0, 2053 },
-{ 0x3, 75, 1, 2052 },
-{ 0x3, 76, 1, 2051 },
-{ 0x3, 77, 1, 2050 },
-{ 0x3, 78, 0, 2049 },
-{ 0x8, 58, 1, 2004 },
-{ 0x2, 61, 1, 2001 },
-{ 0x1, 63, 1, 2003 },
-{ 0x1, 64, 1, 2002 },
+{ 0x1a, 75, 1, 1951 },
+{ 0x7, 86, 0, 1950 },
+{ 0x6, 75, 1, 2063 },
+{ 0x3, 79, 0, 2062 },
+{ 0x1, 75, 1, 2071 },
+{ 0x1, 76, 1, 2070 },
+{ 0x1, 77, 1, 2069 },
+{ 0x1, 78, 0, 2068 },
+{ 0x3, 75, 1, 2067 },
+{ 0x3, 76, 1, 2066 },
+{ 0x3, 77, 1, 2065 },
+{ 0x3, 78, 0, 2064 },
+{ 0x8, 58, 1, 2019 },
+{ 0x2, 61, 1, 2016 },
+{ 0x1, 63, 1, 2018 },
+{ 0x1, 64, 1, 2017 },
 { 0xf, 39, 1, 28 },
 { 0x7, 40, 0, 27 },
-{ 0x18, 58, 1, 2000 },
-{ 0x6, 61, 1, 1997 },
-{ 0x3, 63, 1, 1999 },
-{ 0x3, 64, 1, 1998 },
+{ 0x18, 58, 1, 2015 },
+{ 0x6, 61, 1, 2012 },
+{ 0x3, 63, 1, 2014 },
+{ 0x3, 64, 1, 2013 },
 { 0x1b, 39, 0, 13 },
-{ 0x14, 58, 1, 1994 },
-{ 0xa, 62, 1, 1993 },
+{ 0x14, 58, 1, 2009 },
+{ 0xa, 62, 1, 2008 },
 { 0x35, 39, 0, 11 },
-{ 0x34, 58, 1, 1942 },
-{ 0xe, 67, 0, 1941 },
-{ 0xc, 58, 1, 2058 },
-{ 0x6, 62, 0, 2057 },
-{ 0x2, 58, 1, 1948 },
-{ 0x4, 61, 0, 1947 },
-{ 0x12, 58, 1, 1946 },
-{ 0xc, 61, 0, 1945 },
-{ 0xa, 58, 1, 1996 },
-{ 0x5, 62, 1, 1995 },
+{ 0x34, 58, 1, 1957 },
+{ 0xe, 67, 0, 1956 },
+{ 0xc, 58, 1, 2073 },
+{ 0x6, 62, 0, 2072 },
+{ 0x2, 58, 1, 1963 },
+{ 0x4, 61, 0, 1962 },
+{ 0x12, 58, 1, 1961 },
+{ 0xc, 61, 0, 1960 },
+{ 0xa, 58, 1, 2011 },
+{ 0x5, 62, 1, 2010 },
 { 0x1d, 39, 1, 24 },
 { 0xd, 40, 0, 23 },
-{ 0x1a, 58, 1, 1944 },
-{ 0x7, 67, 0, 1943 },
-{ 0x6, 58, 1, 2060 },
-{ 0x3, 62, 0, 2059 },
-{ 0x1, 58, 1, 2068 },
-{ 0x1, 59, 1, 2067 },
-{ 0x1, 60, 1, 2066 },
-{ 0x1, 61, 0, 2065 },
-{ 0x3, 58, 1, 2064 },
-{ 0x3, 59, 1, 2063 },
-{ 0x3, 60, 1, 2062 },
-{ 0x3, 61, 0, 2061 },
-{ 0x28, 73, 1, 2006 },
-{ 0x28, 74, 0, 2005 },
-{ 0x68, 73, 1, 1950 },
-{ 0x38, 85, 0, 1949 },
-{ 0x18, 73, 1, 2070 },
-{ 0x18, 74, 0, 2069 },
-{ 0x14, 73, 1, 2008 },
-{ 0x14, 74, 0, 2007 },
-{ 0x34, 73, 1, 1952 },
-{ 0x1c, 85, 0, 1951 },
-{ 0xc, 73, 1, 2072 },
-{ 0xc, 74, 0, 2071 },
-{ 0xa, 73, 1, 2010 },
-{ 0xa, 74, 0, 2009 },
-{ 0x1a, 73, 1, 1954 },
-{ 0xe, 85, 0, 1953 },
-{ 0x6, 73, 1, 2074 },
-{ 0x6, 74, 0, 2073 },
-{ 0x5, 73, 1, 2012 },
-{ 0x5, 74, 0, 2011 },
-{ 0xd, 73, 1, 1956 },
-{ 0x7, 85, 0, 1955 },
-{ 0x3, 73, 1, 2076 },
-{ 0x3, 74, 0, 2075 },
-{ 0x28, 56, 1, 2014 },
-{ 0x28, 57, 0, 2013 },
-{ 0x68, 56, 1, 1958 },
-{ 0x38, 66, 0, 1957 },
-{ 0x18, 56, 1, 2078 },
-{ 0x18, 57, 0, 2077 },
-{ 0x14, 56, 1, 2016 },
-{ 0x14, 57, 0, 2015 },
-{ 0x34, 56, 1, 1960 },
-{ 0x1c, 66, 0, 1959 },
-{ 0xc, 56, 1, 2080 },
-{ 0xc, 57, 0, 2079 },
-{ 0xa, 56, 1, 2018 },
-{ 0xa, 57, 0, 2017 },
-{ 0x1a, 56, 1, 1962 },
-{ 0xe, 66, 0, 1961 },
-{ 0x6, 56, 1, 2082 },
-{ 0x6, 57, 0, 2081 },
-{ 0x5, 56, 1, 2020 },
-{ 0x5, 57, 0, 2019 },
-{ 0xd, 56, 1, 1964 },
-{ 0x7, 66, 0, 1963 },
-{ 0x3, 56, 1, 2084 },
-{ 0x3, 57, 0, 2083 },
-{ 0x8, 68, 1, 2032 },
-{ 0x2, 69, 1, 2031 },
-{ 0x2, 70, 1, 2030 },
-{ 0x2, 71, 0, 2029 },
-{ 0x18, 68, 1, 2028 },
-{ 0x6, 69, 1, 2027 },
-{ 0x6, 70, 1, 2026 },
-{ 0x6, 71, 0, 2025 },
-{ 0x14, 68, 1, 2022 },
-{ 0xa, 72, 0, 2021 },
-{ 0x34, 68, 1, 1966 },
-{ 0xe, 84, 0, 1965 },
-{ 0xc, 68, 1, 2086 },
-{ 0x6, 72, 0, 2085 },
-{ 0x2, 68, 1, 1972 },
-{ 0x4, 71, 0, 1971 },
-{ 0x12, 68, 1, 1970 },
-{ 0xc, 71, 0, 1969 },
-{ 0xa, 68, 1, 2024 },
-{ 0x5, 72, 0, 2023 },
-{ 0x1a, 68, 1, 1968 },
-{ 0x7, 84, 0, 1967 },
-{ 0x6, 68, 1, 2088 },
-{ 0x3, 72, 0, 2087 },
-{ 0x1, 68, 1, 2096 },
-{ 0x1, 69, 1, 2095 },
-{ 0x1, 70, 1, 2094 },
-{ 0x1, 71, 0, 2093 },
-{ 0x3, 68, 1, 2092 },
-{ 0x3, 69, 1, 2091 },
-{ 0x3, 70, 1, 2090 },
-{ 0x3, 71, 0, 2089 },
-{ 0x8, 51, 1, 2044 },
-{ 0x2, 52, 1, 2043 },
-{ 0x2, 53, 1, 2042 },
-{ 0x2, 54, 0, 2041 },
-{ 0x18, 51, 1, 2040 },
-{ 0x6, 52, 1, 2039 },
-{ 0x6, 53, 1, 2038 },
-{ 0x6, 54, 0, 2037 },
-{ 0x14, 51, 1, 2034 },
-{ 0xa, 55, 0, 2033 },
-{ 0x34, 51, 1, 1974 },
-{ 0xe, 65, 0, 1973 },
-{ 0xc, 51, 1, 2098 },
-{ 0x6, 55, 0, 2097 },
-{ 0x2, 51, 1, 1980 },
-{ 0x4, 54, 0, 1979 },
-{ 0x12, 51, 1, 1978 },
-{ 0xc, 54, 0, 1977 },
-{ 0xa, 51, 1, 2036 },
-{ 0x5, 55, 0, 2035 },
-{ 0x1a, 51, 1, 1976 },
-{ 0x7, 65, 0, 1975 },
-{ 0x6, 51, 1, 2100 },
-{ 0x3, 55, 0, 2099 },
-{ 0x1, 51, 1, 2108 },
-{ 0x1, 52, 1, 2107 },
-{ 0x1, 53, 1, 2106 },
-{ 0x1, 54, 0, 2105 },
-{ 0x3, 51, 1, 2104 },
-{ 0x3, 52, 1, 2103 },
-{ 0x3, 53, 1, 2102 },
-{ 0x3, 54, 0, 2101 },
-{ 0x1, 3, 0, 2109 },
-{ 0x1, 240, 0, 2110 },
-{ 0x1, 322, 0, 2111 },
-{ 0x1, 317, 0, 2112 },
-{ 0x2, 301, 0, 2113 },
-{ 0x1, 301, 0, 2116 },
-{ 0x2, 300, 0, 2114 },
-{ 0x1, 300, 0, 2117 },
-{ 0x2, 299, 0, 2115 },
-{ 0x1, 299, 0, 2118 },
-{ 0x1, 298, 0, 2119 },
-{ 0x1, 297, 0, 2120 },
-{ 0x2, 296, 0, 2121 },
-{ 0x1, 296, 0, 2123 },
-{ 0x2, 295, 0, 2122 },
-{ 0x1, 295, 0, 2124 },
-{ 0x1, 325, 0, 2131 },
-{ 0x8, 324, 0, 2125 },
-{ 0x4, 324, 0, 2127 },
-{ 0x2, 324, 0, 2129 },
-{ 0x1, 324, 0, 2132 },
-{ 0x8, 323, 0, 2126 },
-{ 0x4, 323, 0, 2128 },
-{ 0x2, 323, 0, 2130 },
-{ 0x1, 323, 0, 2133 },
-{ 0x1, 294, 0, 2140 },
-{ 0x8, 293, 0, 2134 },
-{ 0x4, 293, 0, 2136 },
-{ 0x2, 293, 0, 2138 },
-{ 0x1, 293, 0, 2141 },
-{ 0x8, 292, 0, 2135 },
-{ 0x4, 292, 0, 2137 },
-{ 0x2, 292, 1, 2139 },
-{ 0x4, 101, 0, 1253 },
-{ 0x1, 292, 0, 2142 },
-{ 0x1, 5, 0, 2143 },
-{ 0x1, 6, 0, 2144 },
-{ 0x1, 239, 0, 2145 },
-{ 0x1, 238, 0, 2146 },
-{ 0x1, 388, 0, 2147 },
-{ 0x1, 289, 0, 2148 },
-{ 0x1, 11, 0, 2149 },
-{ 0x1, 9, 0, 2150 },
-{ 0x1, 363, 0, 2151 },
-{ 0x1, 337, 0, 2152 },
-{ 0x1, 336, 0, 2153 },
-{ 0x1, 387, 0, 2154 },
-{ 0x1, 288, 0, 2155 },
-{ 0x1, 10, 0, 2156 },
-{ 0x1, 8, 0, 2157 },
-{ 0x1, 4, 0, 2158 },
-{ 0x1, 362, 0, 2159 },
-{ 0x1, 361, 0, 2160 },
-{ 0x1, 1, 0, 2161 },
-{ 0x1, 0, 0, 2162 },
+{ 0x1a, 58, 1, 1959 },
+{ 0x7, 67, 0, 1958 },
+{ 0x6, 58, 1, 2075 },
+{ 0x3, 62, 0, 2074 },
+{ 0x1, 58, 1, 2083 },
+{ 0x1, 59, 1, 2082 },
+{ 0x1, 60, 1, 2081 },
+{ 0x1, 61, 0, 2080 },
+{ 0x3, 58, 1, 2079 },
+{ 0x3, 59, 1, 2078 },
+{ 0x3, 60, 1, 2077 },
+{ 0x3, 61, 0, 2076 },
+{ 0x28, 73, 1, 2021 },
+{ 0x28, 74, 0, 2020 },
+{ 0x68, 73, 1, 1965 },
+{ 0x38, 85, 0, 1964 },
+{ 0x18, 73, 1, 2085 },
+{ 0x18, 74, 0, 2084 },
+{ 0x14, 73, 1, 2023 },
+{ 0x14, 74, 0, 2022 },
+{ 0x34, 73, 1, 1967 },
+{ 0x1c, 85, 0, 1966 },
+{ 0xc, 73, 1, 2087 },
+{ 0xc, 74, 0, 2086 },
+{ 0xa, 73, 1, 2025 },
+{ 0xa, 74, 0, 2024 },
+{ 0x1a, 73, 1, 1969 },
+{ 0xe, 85, 0, 1968 },
+{ 0x6, 73, 1, 2089 },
+{ 0x6, 74, 0, 2088 },
+{ 0x5, 73, 1, 2027 },
+{ 0x5, 74, 0, 2026 },
+{ 0xd, 73, 1, 1971 },
+{ 0x7, 85, 0, 1970 },
+{ 0x3, 73, 1, 2091 },
+{ 0x3, 74, 0, 2090 },
+{ 0x28, 56, 1, 2029 },
+{ 0x28, 57, 0, 2028 },
+{ 0x68, 56, 1, 1973 },
+{ 0x38, 66, 0, 1972 },
+{ 0x18, 56, 1, 2093 },
+{ 0x18, 57, 0, 2092 },
+{ 0x14, 56, 1, 2031 },
+{ 0x14, 57, 0, 2030 },
+{ 0x34, 56, 1, 1975 },
+{ 0x1c, 66, 0, 1974 },
+{ 0xc, 56, 1, 2095 },
+{ 0xc, 57, 0, 2094 },
+{ 0xa, 56, 1, 2033 },
+{ 0xa, 57, 0, 2032 },
+{ 0x1a, 56, 1, 1977 },
+{ 0xe, 66, 0, 1976 },
+{ 0x6, 56, 1, 2097 },
+{ 0x6, 57, 0, 2096 },
+{ 0x5, 56, 1, 2035 },
+{ 0x5, 57, 0, 2034 },
+{ 0xd, 56, 1, 1979 },
+{ 0x7, 66, 0, 1978 },
+{ 0x3, 56, 1, 2099 },
+{ 0x3, 57, 0, 2098 },
+{ 0x8, 68, 1, 2047 },
+{ 0x2, 69, 1, 2046 },
+{ 0x2, 70, 1, 2045 },
+{ 0x2, 71, 0, 2044 },
+{ 0x18, 68, 1, 2043 },
+{ 0x6, 69, 1, 2042 },
+{ 0x6, 70, 1, 2041 },
+{ 0x6, 71, 0, 2040 },
+{ 0x14, 68, 1, 2037 },
+{ 0xa, 72, 0, 2036 },
+{ 0x34, 68, 1, 1981 },
+{ 0xe, 84, 0, 1980 },
+{ 0xc, 68, 1, 2101 },
+{ 0x6, 72, 0, 2100 },
+{ 0x2, 68, 1, 1987 },
+{ 0x4, 71, 0, 1986 },
+{ 0x12, 68, 1, 1985 },
+{ 0xc, 71, 0, 1984 },
+{ 0xa, 68, 1, 2039 },
+{ 0x5, 72, 0, 2038 },
+{ 0x1a, 68, 1, 1983 },
+{ 0x7, 84, 0, 1982 },
+{ 0x6, 68, 1, 2103 },
+{ 0x3, 72, 0, 2102 },
+{ 0x1, 68, 1, 2111 },
+{ 0x1, 69, 1, 2110 },
+{ 0x1, 70, 1, 2109 },
+{ 0x1, 71, 0, 2108 },
+{ 0x3, 68, 1, 2107 },
+{ 0x3, 69, 1, 2106 },
+{ 0x3, 70, 1, 2105 },
+{ 0x3, 71, 0, 2104 },
+{ 0x8, 51, 1, 2059 },
+{ 0x2, 52, 1, 2058 },
+{ 0x2, 53, 1, 2057 },
+{ 0x2, 54, 0, 2056 },
+{ 0x18, 51, 1, 2055 },
+{ 0x6, 52, 1, 2054 },
+{ 0x6, 53, 1, 2053 },
+{ 0x6, 54, 0, 2052 },
+{ 0x14, 51, 1, 2049 },
+{ 0xa, 55, 0, 2048 },
+{ 0x34, 51, 1, 1989 },
+{ 0xe, 65, 0, 1988 },
+{ 0xc, 51, 1, 2113 },
+{ 0x6, 55, 0, 2112 },
+{ 0x2, 51, 1, 1995 },
+{ 0x4, 54, 0, 1994 },
+{ 0x12, 51, 1, 1993 },
+{ 0xc, 54, 0, 1992 },
+{ 0xa, 51, 1, 2051 },
+{ 0x5, 55, 0, 2050 },
+{ 0x1a, 51, 1, 1991 },
+{ 0x7, 65, 0, 1990 },
+{ 0x6, 51, 1, 2115 },
+{ 0x3, 55, 0, 2114 },
+{ 0x1, 51, 1, 2123 },
+{ 0x1, 52, 1, 2122 },
+{ 0x1, 53, 1, 2121 },
+{ 0x1, 54, 0, 2120 },
+{ 0x3, 51, 1, 2119 },
+{ 0x3, 52, 1, 2118 },
+{ 0x3, 53, 1, 2117 },
+{ 0x3, 54, 0, 2116 },
+{ 0x1, 3, 0, 2124 },
+{ 0x1, 240, 0, 2125 },
+{ 0x1, 322, 0, 2126 },
+{ 0x1, 317, 0, 2127 },
+{ 0x2, 301, 0, 2128 },
+{ 0x1, 301, 0, 2131 },
+{ 0x2, 300, 0, 2129 },
+{ 0x1, 300, 0, 2132 },
+{ 0x2, 299, 0, 2130 },
+{ 0x1, 299, 0, 2133 },
+{ 0x1, 298, 0, 2134 },
+{ 0x1, 297, 0, 2135 },
+{ 0x2, 296, 0, 2136 },
+{ 0x1, 296, 0, 2138 },
+{ 0x2, 295, 0, 2137 },
+{ 0x1, 295, 0, 2139 },
+{ 0x1, 325, 0, 2146 },
+{ 0x8, 324, 0, 2140 },
+{ 0x4, 324, 0, 2142 },
+{ 0x2, 324, 0, 2144 },
+{ 0x1, 324, 0, 2147 },
+{ 0x8, 323, 0, 2141 },
+{ 0x4, 323, 0, 2143 },
+{ 0x2, 323, 0, 2145 },
+{ 0x1, 323, 0, 2148 },
+{ 0x1, 294, 0, 2155 },
+{ 0x8, 293, 0, 2149 },
+{ 0x4, 293, 0, 2151 },
+{ 0x2, 293, 0, 2153 },
+{ 0x1, 293, 0, 2156 },
+{ 0x8, 292, 0, 2150 },
+{ 0x4, 292, 0, 2152 },
+{ 0x2, 292, 1, 2154 },
+{ 0x4, 101, 0, 1248 },
+{ 0x1, 292, 0, 2157 },
+{ 0x1, 5, 0, 2158 },
+{ 0x1, 6, 0, 2159 },
+{ 0x1, 239, 0, 2160 },
+{ 0x1, 238, 0, 2161 },
+{ 0x1, 388, 0, 2162 },
+{ 0x1, 289, 0, 2163 },
+{ 0x1, 11, 0, 2164 },
+{ 0x1, 9, 0, 2165 },
+{ 0x1, 363, 0, 2166 },
+{ 0x1, 337, 0, 2167 },
+{ 0x1, 336, 0, 2168 },
+{ 0x1, 387, 0, 2169 },
+{ 0x1, 288, 0, 2170 },
+{ 0x1, 10, 0, 2171 },
+{ 0x1, 8, 0, 2172 },
+{ 0x1, 4, 0, 2173 },
+{ 0x1, 362, 0, 2174 },
+{ 0x1, 361, 0, 2175 },
+{ 0x1, 1, 0, 2176 },
+{ 0x1, 0, 0, 2177 },
 };
 
diff --git a/opcodes/ia64-dis.c b/opcodes/ia64-dis.c
index 7a68597..5e46796 100644
--- a/opcodes/ia64-dis.c
+++ b/opcodes/ia64-dis.c
@@ -165,6 +165,13 @@
             | (((insn >> 36) & 0x1) << 20)
             | ((insn >> 6) & 0xfffff);
         }
+      else if (odesc - elf64_ia64_operands == IA64_OPND_TGT64)
+	{
+	  /* 60-bit immedate for long branches.  */
+	  value = (((insn >> 13) & 0xfffff)
+		   | (((insn >> 36) & 1) << 59)
+		   | (slot[1] << 20)) << 4;
+	}
       else
 	{
 	  err = (*odesc->extract) (odesc, insn, &value);
@@ -254,11 +261,13 @@
     (*info->fprintf_func) (info->stream, ";;");
 
  done:
+  ia64_free_opcode ((struct ia64_opcode *)idesc);
+ failed:
   if (slotnum == 2)
     retval += 16 - 3*slot_multiplier;
   return retval;
 
  decoding_failed:
   (*info->fprintf_func) (info->stream, "      data8 %#011llx", insn);
-  goto done;
+  goto failed;
 }
diff --git a/opcodes/ia64-gen.c b/opcodes/ia64-gen.c
index a1e062e..e5e4e93 100644
--- a/opcodes/ia64-gen.c
+++ b/opcodes/ia64-gen.c
@@ -177,7 +177,7 @@
   int nchks;                   
   int total_chks;                   /* total #of terminal insns */
   int *chks;                        /* insn classes which read (RAW), write
-                                       (WAW), or write (WAR) this rsrc */ // 
+                                       (WAW), or write (WAR) this rsrc */
   int *chknotes;                    /* dependency notes for each class */
   int nregs;
   int total_regs;                   /* total #of terminal insns */
@@ -281,14 +281,14 @@
   for (i=0;i < count;i++)
     set[deps[i]] = 1;
   count = 0;
-  for (i=0;i < sizeof(set);i++)
+  for (i=0;i < (int)sizeof(set);i++)
     if (set[i])
       ++count;
 
   list = tmalloc(struct deplist);
   list->len = count;
   list->deps = (unsigned short *)malloc (sizeof(unsigned short) * count);
-  for (i=0, count=0;i < sizeof(set);i++)
+  for (i=0, count=0;i < (int)sizeof(set);i++)
     {
       if (set[i])
         {
@@ -461,7 +461,7 @@
      existing class or terminal with the same name. */ 
   if ((xsect || comment || notestr) && is_class)
     {
-      // first, populate with the class we're based on
+      /* First, populate with the class we're based on.  */
       char *subname = name;
       if (xsect)
         *xsect = 0;
@@ -697,6 +697,8 @@
     return IA64_DVS_INSTR;
   else if (strcmp (sem, "specific") == 0)
     return IA64_DVS_SPECIFIC;
+  else if (strcmp (sem, "stop") == 0)
+    return IA64_DVS_STOP;
   else 
     return IA64_DVS_OTHER;
 }
@@ -1332,8 +1334,10 @@
         return IA64_RS_FRb;
       if (strstr (name, "GR%") != NULL)
         return IA64_RS_GR;
-      if (strstr (name, "PR%") != NULL)
+      if (strstr (name, "PR%, % in 1 ") != NULL)
         return IA64_RS_PR;
+      if (strstr (name, "PR%, % in 16 ") != NULL)
+	return IA64_RS_PRr;
 
       fprintf (stderr, "Warning! Don't know how to specify %% dependency %s\n",
                name);
@@ -1455,6 +1459,8 @@
               (int)rdeps[i]->mode, (int)rdeps[i]->semantics, regindex);
       if (rdeps[i]->semantics == IA64_DVS_OTHER)
         printf ("\"%s\", ", rdeps[i]->extra);
+      else
+	printf ("NULL, ");
       printf("},\n");
     }
   printf ("};\n\n");
@@ -2391,7 +2397,7 @@
 int
 insert_opcode_dependencies (opc, cmp)
      struct ia64_opcode *opc;
-     struct completer_entry *cmp;
+     struct completer_entry *cmp ATTRIBUTE_UNUSED;
 {
   /* note all resources which point to this opcode.  rfi has the most chks
      (79) and cmpxchng has the most regs (54) so 100 here should be enough */
@@ -2697,12 +2703,14 @@
   printf ("static const struct ia64_main_table\nmain_table[] = {\n");
   while (ptr != NULL)
     {
-      printf ("  { %d, %d, %d, 0x%llxull, 0x%llxull, { %d, %d, %d, %d, %d }, 0x%x, %d, },\n",
+      printf ("  { %d, %d, %d, 0x",
 	      ptr->name->num,
 	      ptr->opcode->type,
-	      ptr->opcode->num_outputs,
-	      ptr->opcode->opcode,
-	      ptr->opcode->mask,
+	      ptr->opcode->num_outputs);
+      fprintf_vma (stdout, ptr->opcode->opcode);
+      printf ("ull, 0x");
+      fprintf_vma (stdout, ptr->opcode->mask);
+      printf ("ull, { %d, %d, %d, %d, %d }, 0x%x, %d, },\n",
 	      ptr->opcode->operands[0],
 	      ptr->opcode->operands[1],
 	      ptr->opcode->operands[2],
@@ -2731,7 +2739,9 @@
 }
 
 int
-main (int argc, char **argv)
+main (argc, argv)
+     int argc;
+     char **argv ATTRIBUTE_UNUSED;
 {
   if (argc > 1)
     {
diff --git a/opcodes/ia64-ic.tbl b/opcodes/ia64-ic.tbl
index 021194a..bae3433 100644
--- a/opcodes/ia64-ic.tbl
+++ b/opcodes/ia64-ic.tbl
@@ -24,7 +24,7 @@
 fr-writers;	IC:fp-arith, IC:fp-non-arith\fclass, IC:mem-readers-fp
 gr-readers;	IC:gr-readers-writers, IC:mem-readers, IC:mem-writers, chk.s, cmp, cmp4, fc, itc.i, itc.d, itr.i, itr.d, IC:mov-to-AR-gr, IC:mov-to-BR, IC:mov-to-CR, IC:mov-to-IND, IC:mov-from-IND, IC:mov-to-PR-allreg, IC:mov-to-PSR-l, IC:mov-to-PSR-um, IC:probe-all, ptc.e, ptc.g, ptc.ga, ptc.l, ptr.i, ptr.d, setf, tbit, tnat
 gr-readers-writers;	IC:mov-from-IND, add, addl, addp4, adds, and, andcm, IC:czx, dep\dep[Format in {I13}], extr, IC:mem-readers-int, IC:ld-all-postinc, IC:lfetch-postinc, IC:mix, IC:mux, or, IC:pack, IC:padd, IC:pavg, IC:pavgsub, IC:pcmp, IC:pmax, IC:pmin, IC:pmpy, IC:pmpyshr, popcnt, IC:probe-nofault, IC:psad, IC:pshl, IC:pshladd, IC:pshr, IC:pshradd, IC:psub, shl, shladd, shladdp4, shr, shrp, IC:st-postinc, sub, IC:sxt, tak, thash, tpa, ttag, IC:unpack, xor, IC:zxt
-gr-writers;	alloc, dep, getf, IC:gr-readers-writers, IC:mem-readers-int, IC:mov-from-AR, IC:mov-from-BR, IC:mov-from-CR, IC:mov-from-PR, IC:mov-immediate, IC:mov-from-PSR, IC:mov-from-PSR-um, IC:mov-ip, movl
+gr-writers;	alloc, dep, getf, IC:gr-readers-writers, IC:mem-readers-int, IC:mov-from-AR, IC:mov-from-BR, IC:mov-from-CR, IC:mov-from-PR, IC:mov-from-PSR, IC:mov-from-PSR-um, IC:mov-ip, movl
 indirect-brp;	brp[Format in {B7}]
 indirect-brs;	br.call[Format in {B5}], br.cond[Format in {B4}], br.ia, br.ret
 invala-all;	invala[Format in {M24}], invala.e
@@ -124,7 +124,6 @@
 mov-from-PR;	mov_pr[Format in {I25}]
 mov-from-PSR;	mov_psr[Format in {M36}]
 mov-from-PSR-um;	mov_um[Format in {M36}]
-mov-immediate;	addl[Format in {A5}]
 mov-ip;	mov_ip[Format in {I25}]
 mov-to-AR;	IC:mov-to-AR-M, IC:mov-to-AR-I
 mov-to-AR-BSP;	IC:mov-to-AR-M[Field(ar3) == BSP]
@@ -201,5 +200,35 @@
 pr-norm-writers-fp;	IC:pr-gen-writers-fp[Field(ctype)==]
 pr-norm-writers-int;	IC:pr-gen-writers-int[Field(ctype)==]
 pr-or-writers;	IC:pr-gen-writers-int[Field(ctype) in {or orcm}], IC:pr-gen-writers-int[Field(ctype) in {or.andcm and.orcm}]
-pr-readers-br;	br.call, br.cond, brl.call, brl.cond, br.ret, br.wexit, br.wtop, break.b, break, nop.b, nop, IC:ReservedBQP
-pr-readers-nobr-nomovpr;	add, addp4, and, andcm, break.f, break.i, break.m, break.x, break, chk.s, IC:chk-a, cmp, cmp4, IC:cmpxchg, IC:czx, dep, extr, IC:fp-arith, IC:fp-non-arith, fc, fchkf, fclrf, fcmp, IC:fetchadd, fpcmp, fsetc, fwb, getf, IC:invala-all, itc.i, itc.d, itr.i, itr.d, IC:ld, IC:ldf, IC:ldfp, IC:lfetch-all, mf, IC:mix, IC:mov-from-AR-M, IC:mov-from-AR-IM, IC:mov-from-AR-I, IC:mov-to-AR-M, IC:mov-to-AR-I, IC:mov-to-AR-IM, IC:mov-to-BR, IC:mov-from-BR, IC:mov-to-CR, IC:mov-from-CR, IC:mov-to-IND, IC:mov-from-IND, IC:mov-ip, IC:mov-immediate, IC:mov-to-PSR-l, IC:mov-to-PSR-um, IC:mov-from-PSR, IC:mov-from-PSR-um, movl, IC:mux, nop.f, nop.i, nop.m, nop.x, nop, or, IC:pack, IC:padd, IC:pavg, IC:pavgsub, IC:pcmp, IC:pmax, IC:pmin, IC:pmpy, IC:pmpyshr, popcnt, IC:probe-all, IC:psad, IC:pshl, IC:pshladd, IC:pshr, IC:pshradd, IC:psub, ptc.e, ptc.g, ptc.ga, ptc.l, ptr.d, ptr.i, IC:ReservedQP, rsm, setf, shl, shladd, shladdp4, shr, shrp, srlz.i, srlz.d, ssm, IC:st, IC:stf, sub, sum, IC:sxt, sync, tak,
\ No newline at end of file
+pr-readers-br;	br.call, br.cond, brl.call, brl.cond, br.ret, br.wexit, br.wtop, break.b, nop.b, IC:ReservedBQP
+pr-readers-nobr-nomovpr;	add, addl, addp4, adds, and, andcm, break.f, break.i, break.m, break.x, chk.s, IC:chk-a, cmp, cmp4, IC:cmpxchg, IC:czx, dep, extr, IC:fp-arith, IC:fp-non-arith, fc, fchkf, fclrf, fcmp, IC:fetchadd, fpcmp, fsetc, fwb, getf, IC:invala-all, itc.i, itc.d, itr.i, itr.d, IC:ld, IC:ldf, IC:ldfp, IC:lfetch-all, mf, IC:mix, IC:mov-from-AR-M, IC:mov-from-AR-IM, IC:mov-from-AR-I, IC:mov-to-AR-M, IC:mov-to-AR-I, IC:mov-to-AR-IM, IC:mov-to-BR, IC:mov-from-BR, IC:mov-to-CR, IC:mov-from-CR, IC:mov-to-IND, IC:mov-from-IND, IC:mov-ip, IC:mov-to-PSR-l, IC:mov-to-PSR-um, IC:mov-from-PSR, IC:mov-from-PSR-um, movl, IC:mux, nop.f, nop.i, nop.m, nop.x, or, IC:pack, IC:padd, IC:pavg, IC:pavgsub, IC:pcmp, IC:pmax, IC:pmin, IC:pmpy, IC:pmpyshr, popcnt, IC:probe-all, IC:psad, IC:pshl, IC:pshladd, IC:pshr, IC:pshradd, IC:psub, ptc.e, ptc.g, ptc.ga, ptc.l, ptr.d, ptr.i, IC:ReservedQP, rsm, setf, shl, shladd, shladdp4, shr, shrp, srlz.i, srlz.d, ssm, IC:st, IC:stf, sub, sum, IC:sxt, sync, tak, tbit, thash, tnat, tpa, ttag, IC:unpack, IC:xchg, xma, xmpy, xor, IC:zxt
+pr-unc-writers-fp;	IC:pr-gen-writers-fp[Field(ctype)==unc]+11, fprcpa+11, fprsqrta+11, frcpa+11, frsqrta+11
+pr-unc-writers-int;	IC:pr-gen-writers-int[Field(ctype)==unc]+11
+pr-writers;	IC:pr-writers-int, IC:pr-writers-fp
+pr-writers-fp;	IC:pr-norm-writers-fp, IC:pr-unc-writers-fp
+pr-writers-int;	IC:pr-norm-writers-int, IC:pr-unc-writers-int, IC:pr-and-writers, IC:pr-or-writers
+predicatable-instructions;	IC:mov-from-PR, IC:mov-to-PR, IC:pr-readers-br, IC:pr-readers-nobr-nomovpr
+priv-ops;	IC:mov-to-IND-priv, bsw, itc.i, itc.d, itr.i, itr.d, IC:mov-to-CR, IC:mov-from-CR, IC:mov-to-PSR-l, IC:mov-from-PSR, IC:mov-from-IND-priv, ptc.e, ptc.g, ptc.ga, ptc.l, ptr.i, ptr.d, rfi, rsm, ssm, tak, tpa
+probe-all;	IC:probe-fault, IC:probe-nofault
+probe-fault;	probe[Format in {M40}]
+probe-nofault;	probe[Format in {M38 M39}]
+psad;	psad1
+pshl;	pshl2, pshl4
+pshladd;	pshladd2
+pshr;	pshr2, pshr4
+pshradd;	pshradd2
+psub;	psub1, psub2, psub4
+ReservedBQP;	-+15
+ReservedQP;	-+16
+rse-readers;	alloc, br.call, br.ia, br.ret, brl.call, cover, flushrs, loadrs, IC:mov-from-AR-BSP, IC:mov-from-AR-BSPSTORE, IC:mov-to-AR-BSPSTORE, IC:mov-from-AR-RNAT, IC:mov-to-AR-RNAT, rfi
+rse-writers;	alloc, br.call, br.ia, br.ret, brl.call, cover, flushrs, loadrs, IC:mov-to-AR-BSPSTORE, rfi
+st;	st1, st2, st4, st8, st8.spill
+st-postinc;	IC:stf[Format in {M10}], IC:st[Format in {M5}]
+stf;	stfs, stfd, stfe, stf8, stf.spill
+sxt;	sxt1, sxt2, sxt4
+sys-mask-writers-partial;	rsm, ssm
+unpack;	unpack1, unpack2, unpack4
+unpredicatable-instructions;	alloc, br.cloop, br.ctop, br.cexit, br.ia, brp, bsw, clrrrb, cover, epc, flushrs, loadrs, rfi
+user-mask-writers-partial;	rum, sum
+xchg;	xchg1, xchg2, xchg4, xchg8
+zxt;	zxt1, zxt2, zxt4
diff --git a/opcodes/ia64-opc-f.c b/opcodes/ia64-opc-f.c
index 9b5bc6a..c19d649 100644
--- a/opcodes/ia64-opc-f.c
+++ b/opcodes/ia64-opc-f.c
@@ -207,6 +207,7 @@
     {"fpamax.s1",	f, OpXbX6Sf (1, 0, 0x17, 1), {F1, F2, F3}},
     {"fpamax.s2",	f, OpXbX6Sf (1, 0, 0x17, 2), {F1, F2, F3}},
     {"fpamax.s3",	f, OpXbX6Sf (1, 0, 0x17, 3), {F1, F2, F3}},
+
     {"fpcmp.eq.s0",	f, OpXbX6Sf (1, 0, 0x30, 0), {F1, F2, F3}},
     {"fpcmp.eq",	f, OpXbX6Sf (1, 0, 0x30, 0), {F1, F2, F3}, PSEUDO},
     {"fpcmp.eq.s1",	f, OpXbX6Sf (1, 0, 0x30, 1), {F1, F2, F3}},
@@ -222,6 +223,16 @@
     {"fpcmp.le.s1",	f, OpXbX6Sf (1, 0, 0x32, 1), {F1, F2, F3}},
     {"fpcmp.le.s2",	f, OpXbX6Sf (1, 0, 0x32, 2), {F1, F2, F3}},
     {"fpcmp.le.s3",	f, OpXbX6Sf (1, 0, 0x32, 3), {F1, F2, F3}},
+    {"fpcmp.gt.s0",	f, OpXbX6Sf (1, 0, 0x31, 0), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.gt",	f, OpXbX6Sf (1, 0, 0x31, 0), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.gt.s1",	f, OpXbX6Sf (1, 0, 0x31, 1), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.gt.s2",	f, OpXbX6Sf (1, 0, 0x31, 2), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.gt.s3",	f, OpXbX6Sf (1, 0, 0x31, 3), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.ge.s0",	f, OpXbX6Sf (1, 0, 0x32, 0), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.ge",	f, OpXbX6Sf (1, 0, 0x32, 0), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.ge.s1",	f, OpXbX6Sf (1, 0, 0x32, 1), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.ge.s2",	f, OpXbX6Sf (1, 0, 0x32, 2), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.ge.s3",	f, OpXbX6Sf (1, 0, 0x32, 3), {F1, F3, F2}, PSEUDO},
     {"fpcmp.unord.s0",	f, OpXbX6Sf (1, 0, 0x33, 0), {F1, F2, F3}},
     {"fpcmp.unord",	f, OpXbX6Sf (1, 0, 0x33, 0), {F1, F2, F3}, PSEUDO},
     {"fpcmp.unord.s1",	f, OpXbX6Sf (1, 0, 0x33, 1), {F1, F2, F3}},
@@ -242,6 +253,16 @@
     {"fpcmp.nle.s1",	f, OpXbX6Sf (1, 0, 0x36, 1), {F1, F2, F3}},
     {"fpcmp.nle.s2",	f, OpXbX6Sf (1, 0, 0x36, 2), {F1, F2, F3}},
     {"fpcmp.nle.s3",	f, OpXbX6Sf (1, 0, 0x36, 3), {F1, F2, F3}},
+    {"fpcmp.ngt.s0",	f, OpXbX6Sf (1, 0, 0x35, 0), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.ngt",	f, OpXbX6Sf (1, 0, 0x35, 0), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.ngt.s1",	f, OpXbX6Sf (1, 0, 0x35, 1), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.ngt.s2",	f, OpXbX6Sf (1, 0, 0x35, 2), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.ngt.s3",	f, OpXbX6Sf (1, 0, 0x35, 3), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.nge.s0",	f, OpXbX6Sf (1, 0, 0x36, 0), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.nge",	f, OpXbX6Sf (1, 0, 0x36, 0), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.nge.s1",	f, OpXbX6Sf (1, 0, 0x36, 1), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.nge.s2",	f, OpXbX6Sf (1, 0, 0x36, 2), {F1, F3, F2}, PSEUDO},
+    {"fpcmp.nge.s3",	f, OpXbX6Sf (1, 0, 0x36, 3), {F1, F3, F2}, PSEUDO},
     {"fpcmp.ord.s0",	f, OpXbX6Sf (1, 0, 0x37, 0), {F1, F2, F3}},
     {"fpcmp.ord",	f, OpXbX6Sf (1, 0, 0x37, 0), {F1, F2, F3}, PSEUDO},
     {"fpcmp.ord.s1",	f, OpXbX6Sf (1, 0, 0x37, 1), {F1, F2, F3}},
@@ -530,12 +551,6 @@
     {"fpms.s2",		f, OpXaSf (0xb, 1, 2), {F1, F3, F4, F2}},
     {"fpms.s3",		f, OpXaSf (0xb, 1, 3), {F1, F3, F4, F2}},
 
-    {"fpsub.s0",        f, OpXaSfF4 (0xb, 1, 0, 1), {F1, F3, F2}, PSEUDO},
-    {"fpsub",		f, OpXaSfF4 (0xb, 1, 0, 1), {F1, F3, F2}, PSEUDO},
-    {"fpsub.s1",	f, OpXaSfF4 (0xb, 1, 1, 1), {F1, F3, F2}, PSEUDO},
-    {"fpsub.s2",	f, OpXaSfF4 (0xb, 1, 2, 1), {F1, F3, F2}, PSEUDO},
-    {"fpsub.s3",	f, OpXaSfF4 (0xb, 1, 3, 1), {F1, F3, F2}, PSEUDO},
-
     {"fnmpy.s0",	f, OpXaSfF2 (0xc, 0, 0, 0), {F1, F3, F4}, PSEUDO},
     {"fnmpy",		f, OpXaSfF2 (0xc, 0, 0, 0), {F1, F3, F4}, PSEUDO},
     {"fnmpy.s1",	f, OpXaSfF2 (0xc, 0, 1, 0), {F1, F3, F4}, PSEUDO},
diff --git a/opcodes/ia64-opc-m.c b/opcodes/ia64-opc-m.c
index 13a971e..12eb95b 100644
--- a/opcodes/ia64-opc-m.c
+++ b/opcodes/ia64-opc-m.c
@@ -262,117 +262,119 @@
     {"ld8.c.clr.acq.nta", M, OpMXX6aHint (4, 0, 0, 0x2b, 3), {R1, MR3}},
 
     /* integer load w/increment by register */
-    {"ld1",		M, OpMXX6aHint (4, 1, 0, 0x00, 0), {R1, MR3, R2}},
-    {"ld1.nt1",		M, OpMXX6aHint (4, 1, 0, 0x00, 1), {R1, MR3, R2}},
-    {"ld1.nta",		M, OpMXX6aHint (4, 1, 0, 0x00, 3), {R1, MR3, R2}},
-    {"ld2",		M, OpMXX6aHint (4, 1, 0, 0x01, 0), {R1, MR3, R2}},
-    {"ld2.nt1",		M, OpMXX6aHint (4, 1, 0, 0x01, 1), {R1, MR3, R2}},
-    {"ld2.nta",		M, OpMXX6aHint (4, 1, 0, 0x01, 3), {R1, MR3, R2}},
-    {"ld4",		M, OpMXX6aHint (4, 1, 0, 0x02, 0), {R1, MR3, R2}},
-    {"ld4.nt1",		M, OpMXX6aHint (4, 1, 0, 0x02, 1), {R1, MR3, R2}},
-    {"ld4.nta",		M, OpMXX6aHint (4, 1, 0, 0x02, 3), {R1, MR3, R2}},
-    {"ld8",		M, OpMXX6aHint (4, 1, 0, 0x03, 0), {R1, MR3, R2}},
-    {"ld8.nt1",		M, OpMXX6aHint (4, 1, 0, 0x03, 1), {R1, MR3, R2}},
-    {"ld8.nta",		M, OpMXX6aHint (4, 1, 0, 0x03, 3), {R1, MR3, R2}},
-    {"ld1.s",		M, OpMXX6aHint (4, 1, 0, 0x04, 0), {R1, MR3, R2}},
-    {"ld1.s.nt1",	M, OpMXX6aHint (4, 1, 0, 0x04, 1), {R1, MR3, R2}},
-    {"ld1.s.nta",	M, OpMXX6aHint (4, 1, 0, 0x04, 3), {R1, MR3, R2}},
-    {"ld2.s",		M, OpMXX6aHint (4, 1, 0, 0x05, 0), {R1, MR3, R2}},
-    {"ld2.s.nt1",	M, OpMXX6aHint (4, 1, 0, 0x05, 1), {R1, MR3, R2}},
-    {"ld2.s.nta",	M, OpMXX6aHint (4, 1, 0, 0x05, 3), {R1, MR3, R2}},
-    {"ld4.s",		M, OpMXX6aHint (4, 1, 0, 0x06, 0), {R1, MR3, R2}},
-    {"ld4.s.nt1",	M, OpMXX6aHint (4, 1, 0, 0x06, 1), {R1, MR3, R2}},
-    {"ld4.s.nta",	M, OpMXX6aHint (4, 1, 0, 0x06, 3), {R1, MR3, R2}},
-    {"ld8.s",		M, OpMXX6aHint (4, 1, 0, 0x07, 0), {R1, MR3, R2}},
-    {"ld8.s.nt1",	M, OpMXX6aHint (4, 1, 0, 0x07, 1), {R1, MR3, R2}},
-    {"ld8.s.nta",	M, OpMXX6aHint (4, 1, 0, 0x07, 3), {R1, MR3, R2}},
-    {"ld1.a",		M, OpMXX6aHint (4, 1, 0, 0x08, 0), {R1, MR3, R2}},
-    {"ld1.a.nt1",	M, OpMXX6aHint (4, 1, 0, 0x08, 1), {R1, MR3, R2}},
-    {"ld1.a.nta",	M, OpMXX6aHint (4, 1, 0, 0x08, 3), {R1, MR3, R2}},
-    {"ld2.a",		M, OpMXX6aHint (4, 1, 0, 0x09, 0), {R1, MR3, R2}},
-    {"ld2.a.nt1",	M, OpMXX6aHint (4, 1, 0, 0x09, 1), {R1, MR3, R2}},
-    {"ld2.a.nta",	M, OpMXX6aHint (4, 1, 0, 0x09, 3), {R1, MR3, R2}},
-    {"ld4.a",		M, OpMXX6aHint (4, 1, 0, 0x0a, 0), {R1, MR3, R2}},
-    {"ld4.a.nt1",	M, OpMXX6aHint (4, 1, 0, 0x0a, 1), {R1, MR3, R2}},
-    {"ld4.a.nta",	M, OpMXX6aHint (4, 1, 0, 0x0a, 3), {R1, MR3, R2}},
-    {"ld8.a",		M, OpMXX6aHint (4, 1, 0, 0x0b, 0), {R1, MR3, R2}},
-    {"ld8.a.nt1",	M, OpMXX6aHint (4, 1, 0, 0x0b, 1), {R1, MR3, R2}},
-    {"ld8.a.nta",	M, OpMXX6aHint (4, 1, 0, 0x0b, 3), {R1, MR3, R2}},
-    {"ld1.sa",		M, OpMXX6aHint (4, 1, 0, 0x0c, 0), {R1, MR3, R2}},
-    {"ld1.sa.nt1",	M, OpMXX6aHint (4, 1, 0, 0x0c, 1), {R1, MR3, R2}},
-    {"ld1.sa.nta",	M, OpMXX6aHint (4, 1, 0, 0x0c, 3), {R1, MR3, R2}},
-    {"ld2.sa",		M, OpMXX6aHint (4, 1, 0, 0x0d, 0), {R1, MR3, R2}},
-    {"ld2.sa.nt1",	M, OpMXX6aHint (4, 1, 0, 0x0d, 1), {R1, MR3, R2}},
-    {"ld2.sa.nta",	M, OpMXX6aHint (4, 1, 0, 0x0d, 3), {R1, MR3, R2}},
-    {"ld4.sa",		M, OpMXX6aHint (4, 1, 0, 0x0e, 0), {R1, MR3, R2}},
-    {"ld4.sa.nt1",	M, OpMXX6aHint (4, 1, 0, 0x0e, 1), {R1, MR3, R2}},
-    {"ld4.sa.nta",	M, OpMXX6aHint (4, 1, 0, 0x0e, 3), {R1, MR3, R2}},
-    {"ld8.sa",		M, OpMXX6aHint (4, 1, 0, 0x0f, 0), {R1, MR3, R2}},
-    {"ld8.sa.nt1",	M, OpMXX6aHint (4, 1, 0, 0x0f, 1), {R1, MR3, R2}},
-    {"ld8.sa.nta",	M, OpMXX6aHint (4, 1, 0, 0x0f, 3), {R1, MR3, R2}},
-    {"ld1.bias",	M, OpMXX6aHint (4, 1, 0, 0x10, 0), {R1, MR3, R2}},
-    {"ld1.bias.nt1",	M, OpMXX6aHint (4, 1, 0, 0x10, 1), {R1, MR3, R2}},
-    {"ld1.bias.nta",	M, OpMXX6aHint (4, 1, 0, 0x10, 3), {R1, MR3, R2}},
-    {"ld2.bias",	M, OpMXX6aHint (4, 1, 0, 0x11, 0), {R1, MR3, R2}},
-    {"ld2.bias.nt1",	M, OpMXX6aHint (4, 1, 0, 0x11, 1), {R1, MR3, R2}},
-    {"ld2.bias.nta",	M, OpMXX6aHint (4, 1, 0, 0x11, 3), {R1, MR3, R2}},
-    {"ld4.bias",	M, OpMXX6aHint (4, 1, 0, 0x12, 0), {R1, MR3, R2}},
-    {"ld4.bias.nt1",	M, OpMXX6aHint (4, 1, 0, 0x12, 1), {R1, MR3, R2}},
-    {"ld4.bias.nta",	M, OpMXX6aHint (4, 1, 0, 0x12, 3), {R1, MR3, R2}},
-    {"ld8.bias",	M, OpMXX6aHint (4, 1, 0, 0x13, 0), {R1, MR3, R2}},
-    {"ld8.bias.nt1",	M, OpMXX6aHint (4, 1, 0, 0x13, 1), {R1, MR3, R2}},
-    {"ld8.bias.nta",	M, OpMXX6aHint (4, 1, 0, 0x13, 3), {R1, MR3, R2}},
-    {"ld1.acq",		M, OpMXX6aHint (4, 1, 0, 0x14, 0), {R1, MR3, R2}},
-    {"ld1.acq.nt1",	M, OpMXX6aHint (4, 1, 0, 0x14, 1), {R1, MR3, R2}},
-    {"ld1.acq.nta",	M, OpMXX6aHint (4, 1, 0, 0x14, 3), {R1, MR3, R2}},
-    {"ld2.acq",		M, OpMXX6aHint (4, 1, 0, 0x15, 0), {R1, MR3, R2}},
-    {"ld2.acq.nt1",	M, OpMXX6aHint (4, 1, 0, 0x15, 1), {R1, MR3, R2}},
-    {"ld2.acq.nta",	M, OpMXX6aHint (4, 1, 0, 0x15, 3), {R1, MR3, R2}},
-    {"ld4.acq",		M, OpMXX6aHint (4, 1, 0, 0x16, 0), {R1, MR3, R2}},
-    {"ld4.acq.nt1",	M, OpMXX6aHint (4, 1, 0, 0x16, 1), {R1, MR3, R2}},
-    {"ld4.acq.nta",	M, OpMXX6aHint (4, 1, 0, 0x16, 3), {R1, MR3, R2}},
-    {"ld8.acq",		M, OpMXX6aHint (4, 1, 0, 0x17, 0), {R1, MR3, R2}},
-    {"ld8.acq.nt1",	M, OpMXX6aHint (4, 1, 0, 0x17, 1), {R1, MR3, R2}},
-    {"ld8.acq.nta",	M, OpMXX6aHint (4, 1, 0, 0x17, 3), {R1, MR3, R2}},
-    {"ld8.fill",	M, OpMXX6aHint (4, 1, 0, 0x1b, 0), {R1, MR3, R2}},
-    {"ld8.fill.nt1",	M, OpMXX6aHint (4, 1, 0, 0x1b, 1), {R1, MR3, R2}},
-    {"ld8.fill.nta",	M, OpMXX6aHint (4, 1, 0, 0x1b, 3), {R1, MR3, R2}},
-    {"ld1.c.clr",	M, OpMXX6aHint (4, 1, 0, 0x20, 0), {R1, MR3, R2}},
-    {"ld1.c.clr.nt1",	M, OpMXX6aHint (4, 1, 0, 0x20, 1), {R1, MR3, R2}},
-    {"ld1.c.clr.nta",	M, OpMXX6aHint (4, 1, 0, 0x20, 3), {R1, MR3, R2}},
-    {"ld2.c.clr",	M, OpMXX6aHint (4, 1, 0, 0x21, 0), {R1, MR3, R2}},
-    {"ld2.c.clr.nt1",	M, OpMXX6aHint (4, 1, 0, 0x21, 1), {R1, MR3, R2}},
-    {"ld2.c.clr.nta",	M, OpMXX6aHint (4, 1, 0, 0x21, 3), {R1, MR3, R2}},
-    {"ld4.c.clr",	M, OpMXX6aHint (4, 1, 0, 0x22, 0), {R1, MR3, R2}},
-    {"ld4.c.clr.nt1",	M, OpMXX6aHint (4, 1, 0, 0x22, 1), {R1, MR3, R2}},
-    {"ld4.c.clr.nta",	M, OpMXX6aHint (4, 1, 0, 0x22, 3), {R1, MR3, R2}},
-    {"ld8.c.clr",	M, OpMXX6aHint (4, 1, 0, 0x23, 0), {R1, MR3, R2}},
-    {"ld8.c.clr.nt1",	M, OpMXX6aHint (4, 1, 0, 0x23, 1), {R1, MR3, R2}},
-    {"ld8.c.clr.nta",	M, OpMXX6aHint (4, 1, 0, 0x23, 3), {R1, MR3, R2}},
-    {"ld1.c.nc",	M, OpMXX6aHint (4, 1, 0, 0x24, 0), {R1, MR3, R2}},
-    {"ld1.c.nc.nt1",	M, OpMXX6aHint (4, 1, 0, 0x24, 1), {R1, MR3, R2}},
-    {"ld1.c.nc.nta",	M, OpMXX6aHint (4, 1, 0, 0x24, 3), {R1, MR3, R2}},
-    {"ld2.c.nc",	M, OpMXX6aHint (4, 1, 0, 0x25, 0), {R1, MR3, R2}},
-    {"ld2.c.nc.nt1",	M, OpMXX6aHint (4, 1, 0, 0x25, 1), {R1, MR3, R2}},
-    {"ld2.c.nc.nta",	M, OpMXX6aHint (4, 1, 0, 0x25, 3), {R1, MR3, R2}},
-    {"ld4.c.nc",	M, OpMXX6aHint (4, 1, 0, 0x26, 0), {R1, MR3, R2}},
-    {"ld4.c.nc.nt1",	M, OpMXX6aHint (4, 1, 0, 0x26, 1), {R1, MR3, R2}},
-    {"ld4.c.nc.nta",	M, OpMXX6aHint (4, 1, 0, 0x26, 3), {R1, MR3, R2}},
-    {"ld8.c.nc",	M, OpMXX6aHint (4, 1, 0, 0x27, 0), {R1, MR3, R2}},
-    {"ld8.c.nc.nt1",	M, OpMXX6aHint (4, 1, 0, 0x27, 1), {R1, MR3, R2}},
-    {"ld8.c.nc.nta",	M, OpMXX6aHint (4, 1, 0, 0x27, 3), {R1, MR3, R2}},
-    {"ld1.c.clr.acq",	  M, OpMXX6aHint (4, 1, 0, 0x28, 0), {R1, MR3, R2}},
-    {"ld1.c.clr.acq.nt1", M, OpMXX6aHint (4, 1, 0, 0x28, 1), {R1, MR3, R2}},
-    {"ld1.c.clr.acq.nta", M, OpMXX6aHint (4, 1, 0, 0x28, 3), {R1, MR3, R2}},
-    {"ld2.c.clr.acq",	  M, OpMXX6aHint (4, 1, 0, 0x29, 0), {R1, MR3, R2}},
-    {"ld2.c.clr.acq.nt1", M, OpMXX6aHint (4, 1, 0, 0x29, 1), {R1, MR3, R2}},
-    {"ld2.c.clr.acq.nta", M, OpMXX6aHint (4, 1, 0, 0x29, 3), {R1, MR3, R2}},
-    {"ld4.c.clr.acq",	  M, OpMXX6aHint (4, 1, 0, 0x2a, 0), {R1, MR3, R2}},
-    {"ld4.c.clr.acq.nt1", M, OpMXX6aHint (4, 1, 0, 0x2a, 1), {R1, MR3, R2}},
-    {"ld4.c.clr.acq.nta", M, OpMXX6aHint (4, 1, 0, 0x2a, 3), {R1, MR3, R2}},
-    {"ld8.c.clr.acq",	  M, OpMXX6aHint (4, 1, 0, 0x2b, 0), {R1, MR3, R2}},
-    {"ld8.c.clr.acq.nt1", M, OpMXX6aHint (4, 1, 0, 0x2b, 1), {R1, MR3, R2}},
-    {"ld8.c.clr.acq.nta", M, OpMXX6aHint (4, 1, 0, 0x2b, 3), {R1, MR3, R2}},
+#define LDINCREG(c,h) M, OpMXX6aHint (4, 1, 0, c, h), {R1, MR3, R2}, POSTINC,
+    {"ld1",		LDINCREG (0x00, 0)},
+    {"ld1.nt1",		LDINCREG (0x00, 1)},
+    {"ld1.nta",		LDINCREG (0x00, 3)},
+    {"ld2",		LDINCREG (0x01, 0)},
+    {"ld2.nt1",		LDINCREG (0x01, 1)},
+    {"ld2.nta",		LDINCREG (0x01, 3)},
+    {"ld4",		LDINCREG (0x02, 0)},
+    {"ld4.nt1",		LDINCREG (0x02, 1)},
+    {"ld4.nta",		LDINCREG (0x02, 3)},
+    {"ld8",		LDINCREG (0x03, 0)},
+    {"ld8.nt1",		LDINCREG (0x03, 1)},
+    {"ld8.nta",		LDINCREG (0x03, 3)},
+    {"ld1.s",		LDINCREG (0x04, 0)},
+    {"ld1.s.nt1",	LDINCREG (0x04, 1)},
+    {"ld1.s.nta",	LDINCREG (0x04, 3)},
+    {"ld2.s",		LDINCREG (0x05, 0)},
+    {"ld2.s.nt1",	LDINCREG (0x05, 1)},
+    {"ld2.s.nta",	LDINCREG (0x05, 3)},
+    {"ld4.s",		LDINCREG (0x06, 0)},
+    {"ld4.s.nt1",	LDINCREG (0x06, 1)},
+    {"ld4.s.nta",	LDINCREG (0x06, 3)},
+    {"ld8.s",		LDINCREG (0x07, 0)},
+    {"ld8.s.nt1",	LDINCREG (0x07, 1)},
+    {"ld8.s.nta",	LDINCREG (0x07, 3)},
+    {"ld1.a",		LDINCREG (0x08, 0)},
+    {"ld1.a.nt1",	LDINCREG (0x08, 1)},
+    {"ld1.a.nta",	LDINCREG (0x08, 3)},
+    {"ld2.a",		LDINCREG (0x09, 0)},
+    {"ld2.a.nt1",	LDINCREG (0x09, 1)},
+    {"ld2.a.nta",	LDINCREG (0x09, 3)},
+    {"ld4.a",		LDINCREG (0x0a, 0)},
+    {"ld4.a.nt1",	LDINCREG (0x0a, 1)},
+    {"ld4.a.nta",	LDINCREG (0x0a, 3)},
+    {"ld8.a",		LDINCREG (0x0b, 0)},
+    {"ld8.a.nt1",	LDINCREG (0x0b, 1)},
+    {"ld8.a.nta",	LDINCREG (0x0b, 3)},
+    {"ld1.sa",		LDINCREG (0x0c, 0)},
+    {"ld1.sa.nt1",	LDINCREG (0x0c, 1)},
+    {"ld1.sa.nta",	LDINCREG (0x0c, 3)},
+    {"ld2.sa",		LDINCREG (0x0d, 0)},
+    {"ld2.sa.nt1",	LDINCREG (0x0d, 1)},
+    {"ld2.sa.nta",	LDINCREG (0x0d, 3)},
+    {"ld4.sa",		LDINCREG (0x0e, 0)},
+    {"ld4.sa.nt1",	LDINCREG (0x0e, 1)},
+    {"ld4.sa.nta",	LDINCREG (0x0e, 3)},
+    {"ld8.sa",		LDINCREG (0x0f, 0)},
+    {"ld8.sa.nt1",	LDINCREG (0x0f, 1)},
+    {"ld8.sa.nta",	LDINCREG (0x0f, 3)},
+    {"ld1.bias",	LDINCREG (0x10, 0)},
+    {"ld1.bias.nt1",	LDINCREG (0x10, 1)},
+    {"ld1.bias.nta",	LDINCREG (0x10, 3)},
+    {"ld2.bias",	LDINCREG (0x11, 0)},
+    {"ld2.bias.nt1",	LDINCREG (0x11, 1)},
+    {"ld2.bias.nta",	LDINCREG (0x11, 3)},
+    {"ld4.bias",	LDINCREG (0x12, 0)},
+    {"ld4.bias.nt1",	LDINCREG (0x12, 1)},
+    {"ld4.bias.nta",	LDINCREG (0x12, 3)},
+    {"ld8.bias",	LDINCREG (0x13, 0)},
+    {"ld8.bias.nt1",	LDINCREG (0x13, 1)},
+    {"ld8.bias.nta",	LDINCREG (0x13, 3)},
+    {"ld1.acq",		LDINCREG (0x14, 0)},
+    {"ld1.acq.nt1",	LDINCREG (0x14, 1)},
+    {"ld1.acq.nta",	LDINCREG (0x14, 3)},
+    {"ld2.acq",		LDINCREG (0x15, 0)},
+    {"ld2.acq.nt1",	LDINCREG (0x15, 1)},
+    {"ld2.acq.nta",	LDINCREG (0x15, 3)},
+    {"ld4.acq",		LDINCREG (0x16, 0)},
+    {"ld4.acq.nt1",	LDINCREG (0x16, 1)},
+    {"ld4.acq.nta",	LDINCREG (0x16, 3)},
+    {"ld8.acq",		LDINCREG (0x17, 0)},
+    {"ld8.acq.nt1",	LDINCREG (0x17, 1)},
+    {"ld8.acq.nta",	LDINCREG (0x17, 3)},
+    {"ld8.fill",	LDINCREG (0x1b, 0)},
+    {"ld8.fill.nt1",	LDINCREG (0x1b, 1)},
+    {"ld8.fill.nta",	LDINCREG (0x1b, 3)},
+    {"ld1.c.clr",	LDINCREG (0x20, 0)},
+    {"ld1.c.clr.nt1",	LDINCREG (0x20, 1)},
+    {"ld1.c.clr.nta",	LDINCREG (0x20, 3)},
+    {"ld2.c.clr",	LDINCREG (0x21, 0)},
+    {"ld2.c.clr.nt1",	LDINCREG (0x21, 1)},
+    {"ld2.c.clr.nta",	LDINCREG (0x21, 3)},
+    {"ld4.c.clr",	LDINCREG (0x22, 0)},
+    {"ld4.c.clr.nt1",	LDINCREG (0x22, 1)},
+    {"ld4.c.clr.nta",	LDINCREG (0x22, 3)},
+    {"ld8.c.clr",	LDINCREG (0x23, 0)},
+    {"ld8.c.clr.nt1",	LDINCREG (0x23, 1)},
+    {"ld8.c.clr.nta",	LDINCREG (0x23, 3)},
+    {"ld1.c.nc",	LDINCREG (0x24, 0)},
+    {"ld1.c.nc.nt1",	LDINCREG (0x24, 1)},
+    {"ld1.c.nc.nta",	LDINCREG (0x24, 3)},
+    {"ld2.c.nc",	LDINCREG (0x25, 0)},
+    {"ld2.c.nc.nt1",	LDINCREG (0x25, 1)},
+    {"ld2.c.nc.nta",	LDINCREG (0x25, 3)},
+    {"ld4.c.nc",	LDINCREG (0x26, 0)},
+    {"ld4.c.nc.nt1",	LDINCREG (0x26, 1)},
+    {"ld4.c.nc.nta",	LDINCREG (0x26, 3)},
+    {"ld8.c.nc",	LDINCREG (0x27, 0)},
+    {"ld8.c.nc.nt1",	LDINCREG (0x27, 1)},
+    {"ld8.c.nc.nta",	LDINCREG (0x27, 3)},
+    {"ld1.c.clr.acq",	  LDINCREG (0x28, 0)},
+    {"ld1.c.clr.acq.nt1", LDINCREG (0x28, 1)},
+    {"ld1.c.clr.acq.nta", LDINCREG (0x28, 3)},
+    {"ld2.c.clr.acq",	  LDINCREG (0x29, 0)},
+    {"ld2.c.clr.acq.nt1", LDINCREG (0x29, 1)},
+    {"ld2.c.clr.acq.nta", LDINCREG (0x29, 3)},
+    {"ld4.c.clr.acq",	  LDINCREG (0x2a, 0)},
+    {"ld4.c.clr.acq.nt1", LDINCREG (0x2a, 1)},
+    {"ld4.c.clr.acq.nta", LDINCREG (0x2a, 3)},
+    {"ld8.c.clr.acq",	  LDINCREG (0x2b, 0)},
+    {"ld8.c.clr.acq.nt1", LDINCREG (0x2b, 1)},
+    {"ld8.c.clr.acq.nta", LDINCREG (0x2b, 3)},
+#undef LDINCREG
 
     {"st1",		M, OpMXX6aHint (4, 0, 0, 0x30, 0), {MR3, R2}},
     {"st1.nta",		M, OpMXX6aHint (4, 0, 0, 0x30, 3), {MR3, R2}},
@@ -451,137 +453,141 @@
     {"getf.d",		  M, OpMXX6a (4, 0, 1, 0x1f), {R1, F2}},
 
     /* integer load w/increment by immediate */
-    {"ld1",		M, OpX6aHint (5, 0x00, 0), {R1, MR3, IMM9b}},
-    {"ld1.nt1",		M, OpX6aHint (5, 0x00, 1), {R1, MR3, IMM9b}},
-    {"ld1.nta",		M, OpX6aHint (5, 0x00, 3), {R1, MR3, IMM9b}},
-    {"ld2",		M, OpX6aHint (5, 0x01, 0), {R1, MR3, IMM9b}},
-    {"ld2.nt1",		M, OpX6aHint (5, 0x01, 1), {R1, MR3, IMM9b}},
-    {"ld2.nta",		M, OpX6aHint (5, 0x01, 3), {R1, MR3, IMM9b}},
-    {"ld4",		M, OpX6aHint (5, 0x02, 0), {R1, MR3, IMM9b}},
-    {"ld4.nt1",		M, OpX6aHint (5, 0x02, 1), {R1, MR3, IMM9b}},
-    {"ld4.nta",		M, OpX6aHint (5, 0x02, 3), {R1, MR3, IMM9b}},
-    {"ld8",		M, OpX6aHint (5, 0x03, 0), {R1, MR3, IMM9b}},
-    {"ld8.nt1",		M, OpX6aHint (5, 0x03, 1), {R1, MR3, IMM9b}},
-    {"ld8.nta",		M, OpX6aHint (5, 0x03, 3), {R1, MR3, IMM9b}},
-    {"ld1.s",		M, OpX6aHint (5, 0x04, 0), {R1, MR3, IMM9b}},
-    {"ld1.s.nt1",	M, OpX6aHint (5, 0x04, 1), {R1, MR3, IMM9b}},
-    {"ld1.s.nta",	M, OpX6aHint (5, 0x04, 3), {R1, MR3, IMM9b}},
-    {"ld2.s",		M, OpX6aHint (5, 0x05, 0), {R1, MR3, IMM9b}},
-    {"ld2.s.nt1",	M, OpX6aHint (5, 0x05, 1), {R1, MR3, IMM9b}},
-    {"ld2.s.nta",	M, OpX6aHint (5, 0x05, 3), {R1, MR3, IMM9b}},
-    {"ld4.s",		M, OpX6aHint (5, 0x06, 0), {R1, MR3, IMM9b}},
-    {"ld4.s.nt1",	M, OpX6aHint (5, 0x06, 1), {R1, MR3, IMM9b}},
-    {"ld4.s.nta",	M, OpX6aHint (5, 0x06, 3), {R1, MR3, IMM9b}},
-    {"ld8.s",		M, OpX6aHint (5, 0x07, 0), {R1, MR3, IMM9b}},
-    {"ld8.s.nt1",	M, OpX6aHint (5, 0x07, 1), {R1, MR3, IMM9b}},
-    {"ld8.s.nta",	M, OpX6aHint (5, 0x07, 3), {R1, MR3, IMM9b}},
-    {"ld1.a",		M, OpX6aHint (5, 0x08, 0), {R1, MR3, IMM9b}},
-    {"ld1.a.nt1",	M, OpX6aHint (5, 0x08, 1), {R1, MR3, IMM9b}},
-    {"ld1.a.nta",	M, OpX6aHint (5, 0x08, 3), {R1, MR3, IMM9b}},
-    {"ld2.a",		M, OpX6aHint (5, 0x09, 0), {R1, MR3, IMM9b}},
-    {"ld2.a.nt1",	M, OpX6aHint (5, 0x09, 1), {R1, MR3, IMM9b}},
-    {"ld2.a.nta",	M, OpX6aHint (5, 0x09, 3), {R1, MR3, IMM9b}},
-    {"ld4.a",		M, OpX6aHint (5, 0x0a, 0), {R1, MR3, IMM9b}},
-    {"ld4.a.nt1",	M, OpX6aHint (5, 0x0a, 1), {R1, MR3, IMM9b}},
-    {"ld4.a.nta",	M, OpX6aHint (5, 0x0a, 3), {R1, MR3, IMM9b}},
-    {"ld8.a",		M, OpX6aHint (5, 0x0b, 0), {R1, MR3, IMM9b}},
-    {"ld8.a.nt1",	M, OpX6aHint (5, 0x0b, 1), {R1, MR3, IMM9b}},
-    {"ld8.a.nta",	M, OpX6aHint (5, 0x0b, 3), {R1, MR3, IMM9b}},
-    {"ld1.sa",		M, OpX6aHint (5, 0x0c, 0), {R1, MR3, IMM9b}},
-    {"ld1.sa.nt1",	M, OpX6aHint (5, 0x0c, 1), {R1, MR3, IMM9b}},
-    {"ld1.sa.nta",	M, OpX6aHint (5, 0x0c, 3), {R1, MR3, IMM9b}},
-    {"ld2.sa",		M, OpX6aHint (5, 0x0d, 0), {R1, MR3, IMM9b}},
-    {"ld2.sa.nt1",	M, OpX6aHint (5, 0x0d, 1), {R1, MR3, IMM9b}},
-    {"ld2.sa.nta",	M, OpX6aHint (5, 0x0d, 3), {R1, MR3, IMM9b}},
-    {"ld4.sa",		M, OpX6aHint (5, 0x0e, 0), {R1, MR3, IMM9b}},
-    {"ld4.sa.nt1",	M, OpX6aHint (5, 0x0e, 1), {R1, MR3, IMM9b}},
-    {"ld4.sa.nta",	M, OpX6aHint (5, 0x0e, 3), {R1, MR3, IMM9b}},
-    {"ld8.sa",		M, OpX6aHint (5, 0x0f, 0), {R1, MR3, IMM9b}},
-    {"ld8.sa.nt1",	M, OpX6aHint (5, 0x0f, 1), {R1, MR3, IMM9b}},
-    {"ld8.sa.nta",	M, OpX6aHint (5, 0x0f, 3), {R1, MR3, IMM9b}},
-    {"ld1.bias",	M, OpX6aHint (5, 0x10, 0), {R1, MR3, IMM9b}},
-    {"ld1.bias.nt1",	M, OpX6aHint (5, 0x10, 1), {R1, MR3, IMM9b}},
-    {"ld1.bias.nta",	M, OpX6aHint (5, 0x10, 3), {R1, MR3, IMM9b}},
-    {"ld2.bias",	M, OpX6aHint (5, 0x11, 0), {R1, MR3, IMM9b}},
-    {"ld2.bias.nt1",	M, OpX6aHint (5, 0x11, 1), {R1, MR3, IMM9b}},
-    {"ld2.bias.nta",	M, OpX6aHint (5, 0x11, 3), {R1, MR3, IMM9b}},
-    {"ld4.bias",	M, OpX6aHint (5, 0x12, 0), {R1, MR3, IMM9b}},
-    {"ld4.bias.nt1",	M, OpX6aHint (5, 0x12, 1), {R1, MR3, IMM9b}},
-    {"ld4.bias.nta",	M, OpX6aHint (5, 0x12, 3), {R1, MR3, IMM9b}},
-    {"ld8.bias",	M, OpX6aHint (5, 0x13, 0), {R1, MR3, IMM9b}},
-    {"ld8.bias.nt1",	M, OpX6aHint (5, 0x13, 1), {R1, MR3, IMM9b}},
-    {"ld8.bias.nta",	M, OpX6aHint (5, 0x13, 3), {R1, MR3, IMM9b}},
-    {"ld1.acq",		M, OpX6aHint (5, 0x14, 0), {R1, MR3, IMM9b}},
-    {"ld1.acq.nt1",	M, OpX6aHint (5, 0x14, 1), {R1, MR3, IMM9b}},
-    {"ld1.acq.nta",	M, OpX6aHint (5, 0x14, 3), {R1, MR3, IMM9b}},
-    {"ld2.acq",		M, OpX6aHint (5, 0x15, 0), {R1, MR3, IMM9b}},
-    {"ld2.acq.nt1",	M, OpX6aHint (5, 0x15, 1), {R1, MR3, IMM9b}},
-    {"ld2.acq.nta",	M, OpX6aHint (5, 0x15, 3), {R1, MR3, IMM9b}},
-    {"ld4.acq",		M, OpX6aHint (5, 0x16, 0), {R1, MR3, IMM9b}},
-    {"ld4.acq.nt1",	M, OpX6aHint (5, 0x16, 1), {R1, MR3, IMM9b}},
-    {"ld4.acq.nta",	M, OpX6aHint (5, 0x16, 3), {R1, MR3, IMM9b}},
-    {"ld8.acq",		M, OpX6aHint (5, 0x17, 0), {R1, MR3, IMM9b}},
-    {"ld8.acq.nt1",	M, OpX6aHint (5, 0x17, 1), {R1, MR3, IMM9b}},
-    {"ld8.acq.nta",	M, OpX6aHint (5, 0x17, 3), {R1, MR3, IMM9b}},
-    {"ld8.fill",	M, OpX6aHint (5, 0x1b, 0), {R1, MR3, IMM9b}},
-    {"ld8.fill.nt1",	M, OpX6aHint (5, 0x1b, 1), {R1, MR3, IMM9b}},
-    {"ld8.fill.nta",	M, OpX6aHint (5, 0x1b, 3), {R1, MR3, IMM9b}},
-    {"ld1.c.clr",	M, OpX6aHint (5, 0x20, 0), {R1, MR3, IMM9b}},
-    {"ld1.c.clr.nt1",	M, OpX6aHint (5, 0x20, 1), {R1, MR3, IMM9b}},
-    {"ld1.c.clr.nta",	M, OpX6aHint (5, 0x20, 3), {R1, MR3, IMM9b}},
-    {"ld2.c.clr",	M, OpX6aHint (5, 0x21, 0), {R1, MR3, IMM9b}},
-    {"ld2.c.clr.nt1",	M, OpX6aHint (5, 0x21, 1), {R1, MR3, IMM9b}},
-    {"ld2.c.clr.nta",	M, OpX6aHint (5, 0x21, 3), {R1, MR3, IMM9b}},
-    {"ld4.c.clr",	M, OpX6aHint (5, 0x22, 0), {R1, MR3, IMM9b}},
-    {"ld4.c.clr.nt1",	M, OpX6aHint (5, 0x22, 1), {R1, MR3, IMM9b}},
-    {"ld4.c.clr.nta",	M, OpX6aHint (5, 0x22, 3), {R1, MR3, IMM9b}},
-    {"ld8.c.clr",	M, OpX6aHint (5, 0x23, 0), {R1, MR3, IMM9b}},
-    {"ld8.c.clr.nt1",	M, OpX6aHint (5, 0x23, 1), {R1, MR3, IMM9b}},
-    {"ld8.c.clr.nta",	M, OpX6aHint (5, 0x23, 3), {R1, MR3, IMM9b}},
-    {"ld1.c.nc",	M, OpX6aHint (5, 0x24, 0), {R1, MR3, IMM9b}},
-    {"ld1.c.nc.nt1",	M, OpX6aHint (5, 0x24, 1), {R1, MR3, IMM9b}},
-    {"ld1.c.nc.nta",	M, OpX6aHint (5, 0x24, 3), {R1, MR3, IMM9b}},
-    {"ld2.c.nc",	M, OpX6aHint (5, 0x25, 0), {R1, MR3, IMM9b}},
-    {"ld2.c.nc.nt1",	M, OpX6aHint (5, 0x25, 1), {R1, MR3, IMM9b}},
-    {"ld2.c.nc.nta",	M, OpX6aHint (5, 0x25, 3), {R1, MR3, IMM9b}},
-    {"ld4.c.nc",	M, OpX6aHint (5, 0x26, 0), {R1, MR3, IMM9b}},
-    {"ld4.c.nc.nt1",	M, OpX6aHint (5, 0x26, 1), {R1, MR3, IMM9b}},
-    {"ld4.c.nc.nta",	M, OpX6aHint (5, 0x26, 3), {R1, MR3, IMM9b}},
-    {"ld8.c.nc",	M, OpX6aHint (5, 0x27, 0), {R1, MR3, IMM9b}},
-    {"ld8.c.nc.nt1",	M, OpX6aHint (5, 0x27, 1), {R1, MR3, IMM9b}},
-    {"ld8.c.nc.nta",	M, OpX6aHint (5, 0x27, 3), {R1, MR3, IMM9b}},
-    {"ld1.c.clr.acq",	  M, OpX6aHint (5, 0x28, 0), {R1, MR3, IMM9b}},
-    {"ld1.c.clr.acq.nt1", M, OpX6aHint (5, 0x28, 1), {R1, MR3, IMM9b}},
-    {"ld1.c.clr.acq.nta", M, OpX6aHint (5, 0x28, 3), {R1, MR3, IMM9b}},
-    {"ld2.c.clr.acq",	  M, OpX6aHint (5, 0x29, 0), {R1, MR3, IMM9b}},
-    {"ld2.c.clr.acq.nt1", M, OpX6aHint (5, 0x29, 1), {R1, MR3, IMM9b}},
-    {"ld2.c.clr.acq.nta", M, OpX6aHint (5, 0x29, 3), {R1, MR3, IMM9b}},
-    {"ld4.c.clr.acq",	  M, OpX6aHint (5, 0x2a, 0), {R1, MR3, IMM9b}},
-    {"ld4.c.clr.acq.nt1", M, OpX6aHint (5, 0x2a, 1), {R1, MR3, IMM9b}},
-    {"ld4.c.clr.acq.nta", M, OpX6aHint (5, 0x2a, 3), {R1, MR3, IMM9b}},
-    {"ld8.c.clr.acq",	  M, OpX6aHint (5, 0x2b, 0), {R1, MR3, IMM9b}},
-    {"ld8.c.clr.acq.nt1", M, OpX6aHint (5, 0x2b, 1), {R1, MR3, IMM9b}},
-    {"ld8.c.clr.acq.nta", M, OpX6aHint (5, 0x2b, 3), {R1, MR3, IMM9b}},
+#define LDINCIMMED(c,h) M, OpX6aHint (5, c, h), {R1, MR3, IMM9b}, POSTINC
+    {"ld1",		LDINCIMMED (0x00, 0)},
+    {"ld1.nt1",		LDINCIMMED (0x00, 1)},
+    {"ld1.nta",		LDINCIMMED (0x00, 3)},
+    {"ld2",		LDINCIMMED (0x01, 0)},
+    {"ld2.nt1",		LDINCIMMED (0x01, 1)},
+    {"ld2.nta",		LDINCIMMED (0x01, 3)},
+    {"ld4",		LDINCIMMED (0x02, 0)},
+    {"ld4.nt1",		LDINCIMMED (0x02, 1)},
+    {"ld4.nta",		LDINCIMMED (0x02, 3)},
+    {"ld8",		LDINCIMMED (0x03, 0)},
+    {"ld8.nt1",		LDINCIMMED (0x03, 1)},
+    {"ld8.nta",		LDINCIMMED (0x03, 3)},
+    {"ld1.s",		LDINCIMMED (0x04, 0)},
+    {"ld1.s.nt1",	LDINCIMMED (0x04, 1)},
+    {"ld1.s.nta",	LDINCIMMED (0x04, 3)},
+    {"ld2.s",		LDINCIMMED (0x05, 0)},
+    {"ld2.s.nt1",	LDINCIMMED (0x05, 1)},
+    {"ld2.s.nta",	LDINCIMMED (0x05, 3)},
+    {"ld4.s",		LDINCIMMED (0x06, 0)},
+    {"ld4.s.nt1",	LDINCIMMED (0x06, 1)},
+    {"ld4.s.nta",	LDINCIMMED (0x06, 3)},
+    {"ld8.s",		LDINCIMMED (0x07, 0)},
+    {"ld8.s.nt1",	LDINCIMMED (0x07, 1)},
+    {"ld8.s.nta",	LDINCIMMED (0x07, 3)},
+    {"ld1.a",		LDINCIMMED (0x08, 0)},
+    {"ld1.a.nt1",	LDINCIMMED (0x08, 1)},
+    {"ld1.a.nta",	LDINCIMMED (0x08, 3)},
+    {"ld2.a",		LDINCIMMED (0x09, 0)},
+    {"ld2.a.nt1",	LDINCIMMED (0x09, 1)},
+    {"ld2.a.nta",	LDINCIMMED (0x09, 3)},
+    {"ld4.a",		LDINCIMMED (0x0a, 0)},
+    {"ld4.a.nt1",	LDINCIMMED (0x0a, 1)},
+    {"ld4.a.nta",	LDINCIMMED (0x0a, 3)},
+    {"ld8.a",		LDINCIMMED (0x0b, 0)},
+    {"ld8.a.nt1",	LDINCIMMED (0x0b, 1)},
+    {"ld8.a.nta",	LDINCIMMED (0x0b, 3)},
+    {"ld1.sa",		LDINCIMMED (0x0c, 0)},
+    {"ld1.sa.nt1",	LDINCIMMED (0x0c, 1)},
+    {"ld1.sa.nta",	LDINCIMMED (0x0c, 3)},
+    {"ld2.sa",		LDINCIMMED (0x0d, 0)},
+    {"ld2.sa.nt1",	LDINCIMMED (0x0d, 1)},
+    {"ld2.sa.nta",	LDINCIMMED (0x0d, 3)},
+    {"ld4.sa",		LDINCIMMED (0x0e, 0)},
+    {"ld4.sa.nt1",	LDINCIMMED (0x0e, 1)},
+    {"ld4.sa.nta",	LDINCIMMED (0x0e, 3)},
+    {"ld8.sa",		LDINCIMMED (0x0f, 0)},
+    {"ld8.sa.nt1",	LDINCIMMED (0x0f, 1)},
+    {"ld8.sa.nta",	LDINCIMMED (0x0f, 3)},
+    {"ld1.bias",	LDINCIMMED (0x10, 0)},
+    {"ld1.bias.nt1",	LDINCIMMED (0x10, 1)},
+    {"ld1.bias.nta",	LDINCIMMED (0x10, 3)},
+    {"ld2.bias",	LDINCIMMED (0x11, 0)},
+    {"ld2.bias.nt1",	LDINCIMMED (0x11, 1)},
+    {"ld2.bias.nta",	LDINCIMMED (0x11, 3)},
+    {"ld4.bias",	LDINCIMMED (0x12, 0)},
+    {"ld4.bias.nt1",	LDINCIMMED (0x12, 1)},
+    {"ld4.bias.nta",	LDINCIMMED (0x12, 3)},
+    {"ld8.bias",	LDINCIMMED (0x13, 0)},
+    {"ld8.bias.nt1",	LDINCIMMED (0x13, 1)},
+    {"ld8.bias.nta",	LDINCIMMED (0x13, 3)},
+    {"ld1.acq",		LDINCIMMED (0x14, 0)},
+    {"ld1.acq.nt1",	LDINCIMMED (0x14, 1)},
+    {"ld1.acq.nta",	LDINCIMMED (0x14, 3)},
+    {"ld2.acq",		LDINCIMMED (0x15, 0)},
+    {"ld2.acq.nt1",	LDINCIMMED (0x15, 1)},
+    {"ld2.acq.nta",	LDINCIMMED (0x15, 3)},
+    {"ld4.acq",		LDINCIMMED (0x16, 0)},
+    {"ld4.acq.nt1",	LDINCIMMED (0x16, 1)},
+    {"ld4.acq.nta",	LDINCIMMED (0x16, 3)},
+    {"ld8.acq",		LDINCIMMED (0x17, 0)},
+    {"ld8.acq.nt1",	LDINCIMMED (0x17, 1)},
+    {"ld8.acq.nta",	LDINCIMMED (0x17, 3)},
+    {"ld8.fill",	LDINCIMMED (0x1b, 0)},
+    {"ld8.fill.nt1",	LDINCIMMED (0x1b, 1)},
+    {"ld8.fill.nta",	LDINCIMMED (0x1b, 3)},
+    {"ld1.c.clr",	LDINCIMMED (0x20, 0)},
+    {"ld1.c.clr.nt1",	LDINCIMMED (0x20, 1)},
+    {"ld1.c.clr.nta",	LDINCIMMED (0x20, 3)},
+    {"ld2.c.clr",	LDINCIMMED (0x21, 0)},
+    {"ld2.c.clr.nt1",	LDINCIMMED (0x21, 1)},
+    {"ld2.c.clr.nta",	LDINCIMMED (0x21, 3)},
+    {"ld4.c.clr",	LDINCIMMED (0x22, 0)},
+    {"ld4.c.clr.nt1",	LDINCIMMED (0x22, 1)},
+    {"ld4.c.clr.nta",	LDINCIMMED (0x22, 3)},
+    {"ld8.c.clr",	LDINCIMMED (0x23, 0)},
+    {"ld8.c.clr.nt1",	LDINCIMMED (0x23, 1)},
+    {"ld8.c.clr.nta",	LDINCIMMED (0x23, 3)},
+    {"ld1.c.nc",	LDINCIMMED (0x24, 0)},
+    {"ld1.c.nc.nt1",	LDINCIMMED (0x24, 1)},
+    {"ld1.c.nc.nta",	LDINCIMMED (0x24, 3)},
+    {"ld2.c.nc",	LDINCIMMED (0x25, 0)},
+    {"ld2.c.nc.nt1",	LDINCIMMED (0x25, 1)},
+    {"ld2.c.nc.nta",	LDINCIMMED (0x25, 3)},
+    {"ld4.c.nc",	LDINCIMMED (0x26, 0)},
+    {"ld4.c.nc.nt1",	LDINCIMMED (0x26, 1)},
+    {"ld4.c.nc.nta",	LDINCIMMED (0x26, 3)},
+    {"ld8.c.nc",	LDINCIMMED (0x27, 0)},
+    {"ld8.c.nc.nt1",	LDINCIMMED (0x27, 1)},
+    {"ld8.c.nc.nta",	LDINCIMMED (0x27, 3)},
+    {"ld1.c.clr.acq",	  LDINCIMMED (0x28, 0)},
+    {"ld1.c.clr.acq.nt1", LDINCIMMED (0x28, 1)},
+    {"ld1.c.clr.acq.nta", LDINCIMMED (0x28, 3)},
+    {"ld2.c.clr.acq",	  LDINCIMMED (0x29, 0)},
+    {"ld2.c.clr.acq.nt1", LDINCIMMED (0x29, 1)},
+    {"ld2.c.clr.acq.nta", LDINCIMMED (0x29, 3)},
+    {"ld4.c.clr.acq",	  LDINCIMMED (0x2a, 0)},
+    {"ld4.c.clr.acq.nt1", LDINCIMMED (0x2a, 1)},
+    {"ld4.c.clr.acq.nta", LDINCIMMED (0x2a, 3)},
+    {"ld8.c.clr.acq",	  LDINCIMMED (0x2b, 0)},
+    {"ld8.c.clr.acq.nt1", LDINCIMMED (0x2b, 1)},
+    {"ld8.c.clr.acq.nta", LDINCIMMED (0x2b, 3)},
+#undef LDINCIMMED
 
     /* store w/increment by immediate */
-    {"st1",		M, OpX6aHint (5, 0x30, 0), {MR3, R2, IMM9a}},
-    {"st1.nta",		M, OpX6aHint (5, 0x30, 3), {MR3, R2, IMM9a}},
-    {"st2",		M, OpX6aHint (5, 0x31, 0), {MR3, R2, IMM9a}},
-    {"st2.nta",		M, OpX6aHint (5, 0x31, 3), {MR3, R2, IMM9a}},
-    {"st4",		M, OpX6aHint (5, 0x32, 0), {MR3, R2, IMM9a}},
-    {"st4.nta",		M, OpX6aHint (5, 0x32, 3), {MR3, R2, IMM9a}},
-    {"st8",		M, OpX6aHint (5, 0x33, 0), {MR3, R2, IMM9a}},
-    {"st8.nta",		M, OpX6aHint (5, 0x33, 3), {MR3, R2, IMM9a}},
-    {"st1.rel",		M, OpX6aHint (5, 0x34, 0), {MR3, R2, IMM9a}},
-    {"st1.rel.nta",	M, OpX6aHint (5, 0x34, 3), {MR3, R2, IMM9a}},
-    {"st2.rel",		M, OpX6aHint (5, 0x35, 0), {MR3, R2, IMM9a}},
-    {"st2.rel.nta",	M, OpX6aHint (5, 0x35, 3), {MR3, R2, IMM9a}},
-    {"st4.rel",		M, OpX6aHint (5, 0x36, 0), {MR3, R2, IMM9a}},
-    {"st4.rel.nta",	M, OpX6aHint (5, 0x36, 3), {MR3, R2, IMM9a}},
-    {"st8.rel",		M, OpX6aHint (5, 0x37, 0), {MR3, R2, IMM9a}},
-    {"st8.rel.nta",	M, OpX6aHint (5, 0x37, 3), {MR3, R2, IMM9a}},
-    {"st8.spill",	M, OpX6aHint (5, 0x3b, 0), {MR3, R2, IMM9a}},
-    {"st8.spill.nta",	M, OpX6aHint (5, 0x3b, 3), {MR3, R2, IMM9a}},
+#define STINCIMMED(c,h) M, OpX6aHint (5, c, h), {MR3, R2, IMM9a}, POSTINC
+    {"st1",		STINCIMMED (0x30, 0)},
+    {"st1.nta",		STINCIMMED (0x30, 3)},
+    {"st2",		STINCIMMED (0x31, 0)},
+    {"st2.nta",		STINCIMMED (0x31, 3)},
+    {"st4",		STINCIMMED (0x32, 0)},
+    {"st4.nta",		STINCIMMED (0x32, 3)},
+    {"st8",		STINCIMMED (0x33, 0)},
+    {"st8.nta",		STINCIMMED (0x33, 3)},
+    {"st1.rel",		STINCIMMED (0x34, 0)},
+    {"st1.rel.nta",	STINCIMMED (0x34, 3)},
+    {"st2.rel",		STINCIMMED (0x35, 0)},
+    {"st2.rel.nta",	STINCIMMED (0x35, 3)},
+    {"st4.rel",		STINCIMMED (0x36, 0)},
+    {"st4.rel.nta",	STINCIMMED (0x36, 3)},
+    {"st8.rel",		STINCIMMED (0x37, 0)},
+    {"st8.rel.nta",	STINCIMMED (0x37, 3)},
+    {"st8.spill",	STINCIMMED (0x3b, 0)},
+    {"st8.spill.nta",	STINCIMMED (0x3b, 3)},
+#undef STINCIMMED
 
     /* floating-point load */
     {"ldfs",		M, OpMXX6aHint (6, 0, 0, 0x02, 0), {F1, MR3}},
@@ -660,81 +666,84 @@
     {"ldfe.c.nc.nt1",	M, OpMXX6aHint (6, 0, 0, 0x24, 1), {F1, MR3}},
     {"ldfe.c.nc.nta",	M, OpMXX6aHint (6, 0, 0, 0x24, 3), {F1, MR3}},
 
-    {"ldfs",		M, OpMXX6aHint (6, 1, 0, 0x02, 0), {F1, MR3, R2}},
-    {"ldfs.nt1",	M, OpMXX6aHint (6, 1, 0, 0x02, 1), {F1, MR3, R2}},
-    {"ldfs.nta",	M, OpMXX6aHint (6, 1, 0, 0x02, 3), {F1, MR3, R2}},
-    {"ldfd",		M, OpMXX6aHint (6, 1, 0, 0x03, 0), {F1, MR3, R2}},
-    {"ldfd.nt1",	M, OpMXX6aHint (6, 1, 0, 0x03, 1), {F1, MR3, R2}},
-    {"ldfd.nta",	M, OpMXX6aHint (6, 1, 0, 0x03, 3), {F1, MR3, R2}},
-    {"ldf8",		M, OpMXX6aHint (6, 1, 0, 0x01, 0), {F1, MR3, R2}},
-    {"ldf8.nt1",	M, OpMXX6aHint (6, 1, 0, 0x01, 1), {F1, MR3, R2}},
-    {"ldf8.nta",	M, OpMXX6aHint (6, 1, 0, 0x01, 3), {F1, MR3, R2}},
-    {"ldfe",		M, OpMXX6aHint (6, 1, 0, 0x00, 0), {F1, MR3, R2}},
-    {"ldfe.nt1",	M, OpMXX6aHint (6, 1, 0, 0x00, 1), {F1, MR3, R2}},
-    {"ldfe.nta",	M, OpMXX6aHint (6, 1, 0, 0x00, 3), {F1, MR3, R2}},
-    {"ldfs.s",		M, OpMXX6aHint (6, 1, 0, 0x06, 0), {F1, MR3, R2}},
-    {"ldfs.s.nt1",	M, OpMXX6aHint (6, 1, 0, 0x06, 1), {F1, MR3, R2}},
-    {"ldfs.s.nta",	M, OpMXX6aHint (6, 1, 0, 0x06, 3), {F1, MR3, R2}},
-    {"ldfd.s",		M, OpMXX6aHint (6, 1, 0, 0x07, 0), {F1, MR3, R2}},
-    {"ldfd.s.nt1",	M, OpMXX6aHint (6, 1, 0, 0x07, 1), {F1, MR3, R2}},
-    {"ldfd.s.nta",	M, OpMXX6aHint (6, 1, 0, 0x07, 3), {F1, MR3, R2}},
-    {"ldf8.s",		M, OpMXX6aHint (6, 1, 0, 0x05, 0), {F1, MR3, R2}},
-    {"ldf8.s.nt1",	M, OpMXX6aHint (6, 1, 0, 0x05, 1), {F1, MR3, R2}},
-    {"ldf8.s.nta",	M, OpMXX6aHint (6, 1, 0, 0x05, 3), {F1, MR3, R2}},
-    {"ldfe.s",		M, OpMXX6aHint (6, 1, 0, 0x04, 0), {F1, MR3, R2}},
-    {"ldfe.s.nt1",	M, OpMXX6aHint (6, 1, 0, 0x04, 1), {F1, MR3, R2}},
-    {"ldfe.s.nta",	M, OpMXX6aHint (6, 1, 0, 0x04, 3), {F1, MR3, R2}},
-    {"ldfs.a",		M, OpMXX6aHint (6, 1, 0, 0x0a, 0), {F1, MR3, R2}},
-    {"ldfs.a.nt1",	M, OpMXX6aHint (6, 1, 0, 0x0a, 1), {F1, MR3, R2}},
-    {"ldfs.a.nta",	M, OpMXX6aHint (6, 1, 0, 0x0a, 3), {F1, MR3, R2}},
-    {"ldfd.a",		M, OpMXX6aHint (6, 1, 0, 0x0b, 0), {F1, MR3, R2}},
-    {"ldfd.a.nt1",	M, OpMXX6aHint (6, 1, 0, 0x0b, 1), {F1, MR3, R2}},
-    {"ldfd.a.nta",	M, OpMXX6aHint (6, 1, 0, 0x0b, 3), {F1, MR3, R2}},
-    {"ldf8.a",		M, OpMXX6aHint (6, 1, 0, 0x09, 0), {F1, MR3, R2}},
-    {"ldf8.a.nt1",	M, OpMXX6aHint (6, 1, 0, 0x09, 1), {F1, MR3, R2}},
-    {"ldf8.a.nta",	M, OpMXX6aHint (6, 1, 0, 0x09, 3), {F1, MR3, R2}},
-    {"ldfe.a",		M, OpMXX6aHint (6, 1, 0, 0x08, 0), {F1, MR3, R2}},
-    {"ldfe.a.nt1",	M, OpMXX6aHint (6, 1, 0, 0x08, 1), {F1, MR3, R2}},
-    {"ldfe.a.nta",	M, OpMXX6aHint (6, 1, 0, 0x08, 3), {F1, MR3, R2}},
-    {"ldfs.sa",		M, OpMXX6aHint (6, 1, 0, 0x0e, 0), {F1, MR3, R2}},
-    {"ldfs.sa.nt1",	M, OpMXX6aHint (6, 1, 0, 0x0e, 1), {F1, MR3, R2}},
-    {"ldfs.sa.nta",	M, OpMXX6aHint (6, 1, 0, 0x0e, 3), {F1, MR3, R2}},
-    {"ldfd.sa",		M, OpMXX6aHint (6, 1, 0, 0x0f, 0), {F1, MR3, R2}},
-    {"ldfd.sa.nt1",	M, OpMXX6aHint (6, 1, 0, 0x0f, 1), {F1, MR3, R2}},
-    {"ldfd.sa.nta",	M, OpMXX6aHint (6, 1, 0, 0x0f, 3), {F1, MR3, R2}},
-    {"ldf8.sa",		M, OpMXX6aHint (6, 1, 0, 0x0d, 0), {F1, MR3, R2}},
-    {"ldf8.sa.nt1",	M, OpMXX6aHint (6, 1, 0, 0x0d, 1), {F1, MR3, R2}},
-    {"ldf8.sa.nta",	M, OpMXX6aHint (6, 1, 0, 0x0d, 3), {F1, MR3, R2}},
-    {"ldfe.sa",		M, OpMXX6aHint (6, 1, 0, 0x0c, 0), {F1, MR3, R2}},
-    {"ldfe.sa.nt1",	M, OpMXX6aHint (6, 1, 0, 0x0c, 1), {F1, MR3, R2}},
-    {"ldfe.sa.nta",	M, OpMXX6aHint (6, 1, 0, 0x0c, 3), {F1, MR3, R2}},
-    {"ldf.fill",	M, OpMXX6aHint (6, 1, 0, 0x1b, 0), {F1, MR3, R2}},
-    {"ldf.fill.nt1",	M, OpMXX6aHint (6, 1, 0, 0x1b, 1), {F1, MR3, R2}},
-    {"ldf.fill.nta",	M, OpMXX6aHint (6, 1, 0, 0x1b, 3), {F1, MR3, R2}},
-    {"ldfs.c.clr",	M, OpMXX6aHint (6, 1, 0, 0x22, 0), {F1, MR3, R2}},
-    {"ldfs.c.clr.nt1",	M, OpMXX6aHint (6, 1, 0, 0x22, 1), {F1, MR3, R2}},
-    {"ldfs.c.clr.nta",	M, OpMXX6aHint (6, 1, 0, 0x22, 3), {F1, MR3, R2}},
-    {"ldfd.c.clr",	M, OpMXX6aHint (6, 1, 0, 0x23, 0), {F1, MR3, R2}},
-    {"ldfd.c.clr.nt1",	M, OpMXX6aHint (6, 1, 0, 0x23, 1), {F1, MR3, R2}},
-    {"ldfd.c.clr.nta",	M, OpMXX6aHint (6, 1, 0, 0x23, 3), {F1, MR3, R2}},
-    {"ldf8.c.clr",	M, OpMXX6aHint (6, 1, 0, 0x21, 0), {F1, MR3, R2}},
-    {"ldf8.c.clr.nt1",	M, OpMXX6aHint (6, 1, 0, 0x21, 1), {F1, MR3, R2}},
-    {"ldf8.c.clr.nta",	M, OpMXX6aHint (6, 1, 0, 0x21, 3), {F1, MR3, R2}},
-    {"ldfe.c.clr",	M, OpMXX6aHint (6, 1, 0, 0x20, 0), {F1, MR3, R2}},
-    {"ldfe.c.clr.nt1",	M, OpMXX6aHint (6, 1, 0, 0x20, 1), {F1, MR3, R2}},
-    {"ldfe.c.clr.nta",	M, OpMXX6aHint (6, 1, 0, 0x20, 3), {F1, MR3, R2}},
-    {"ldfs.c.nc",	M, OpMXX6aHint (6, 1, 0, 0x26, 0), {F1, MR3, R2}},
-    {"ldfs.c.nc.nt1",	M, OpMXX6aHint (6, 1, 0, 0x26, 1), {F1, MR3, R2}},
-    {"ldfs.c.nc.nta",	M, OpMXX6aHint (6, 1, 0, 0x26, 3), {F1, MR3, R2}},
-    {"ldfd.c.nc",	M, OpMXX6aHint (6, 1, 0, 0x27, 0), {F1, MR3, R2}},
-    {"ldfd.c.nc.nt1",	M, OpMXX6aHint (6, 1, 0, 0x27, 1), {F1, MR3, R2}},
-    {"ldfd.c.nc.nta",	M, OpMXX6aHint (6, 1, 0, 0x27, 3), {F1, MR3, R2}},
-    {"ldf8.c.nc",	M, OpMXX6aHint (6, 1, 0, 0x25, 0), {F1, MR3, R2}},
-    {"ldf8.c.nc.nt1",	M, OpMXX6aHint (6, 1, 0, 0x25, 1), {F1, MR3, R2}},
-    {"ldf8.c.nc.nta",	M, OpMXX6aHint (6, 1, 0, 0x25, 3), {F1, MR3, R2}},
-    {"ldfe.c.nc",	M, OpMXX6aHint (6, 1, 0, 0x24, 0), {F1, MR3, R2}},
-    {"ldfe.c.nc.nt1",	M, OpMXX6aHint (6, 1, 0, 0x24, 1), {F1, MR3, R2}},
-    {"ldfe.c.nc.nta",	M, OpMXX6aHint (6, 1, 0, 0x24, 3), {F1, MR3, R2}},
+    /* floating-point load w/increment by register */
+#define FLDINCREG(c,h) M, OpMXX6aHint (6, 1, 0, c, h), {F1, MR3, R2}, POSTINC
+    {"ldfs",		FLDINCREG (0x02, 0)},
+    {"ldfs.nt1",	FLDINCREG (0x02, 1)},
+    {"ldfs.nta",	FLDINCREG (0x02, 3)},
+    {"ldfd",		FLDINCREG (0x03, 0)},
+    {"ldfd.nt1",	FLDINCREG (0x03, 1)},
+    {"ldfd.nta",	FLDINCREG (0x03, 3)},
+    {"ldf8",		FLDINCREG (0x01, 0)},
+    {"ldf8.nt1",	FLDINCREG (0x01, 1)},
+    {"ldf8.nta",	FLDINCREG (0x01, 3)},
+    {"ldfe",		FLDINCREG (0x00, 0)},
+    {"ldfe.nt1",	FLDINCREG (0x00, 1)},
+    {"ldfe.nta",	FLDINCREG (0x00, 3)},
+    {"ldfs.s",		FLDINCREG (0x06, 0)},
+    {"ldfs.s.nt1",	FLDINCREG (0x06, 1)},
+    {"ldfs.s.nta",	FLDINCREG (0x06, 3)},
+    {"ldfd.s",		FLDINCREG (0x07, 0)},
+    {"ldfd.s.nt1",	FLDINCREG (0x07, 1)},
+    {"ldfd.s.nta",	FLDINCREG (0x07, 3)},
+    {"ldf8.s",		FLDINCREG (0x05, 0)},
+    {"ldf8.s.nt1",	FLDINCREG (0x05, 1)},
+    {"ldf8.s.nta",	FLDINCREG (0x05, 3)},
+    {"ldfe.s",		FLDINCREG (0x04, 0)},
+    {"ldfe.s.nt1",	FLDINCREG (0x04, 1)},
+    {"ldfe.s.nta",	FLDINCREG (0x04, 3)},
+    {"ldfs.a",		FLDINCREG (0x0a, 0)},
+    {"ldfs.a.nt1",	FLDINCREG (0x0a, 1)},
+    {"ldfs.a.nta",	FLDINCREG (0x0a, 3)},
+    {"ldfd.a",		FLDINCREG (0x0b, 0)},
+    {"ldfd.a.nt1",	FLDINCREG (0x0b, 1)},
+    {"ldfd.a.nta",	FLDINCREG (0x0b, 3)},
+    {"ldf8.a",		FLDINCREG (0x09, 0)},
+    {"ldf8.a.nt1",	FLDINCREG (0x09, 1)},
+    {"ldf8.a.nta",	FLDINCREG (0x09, 3)},
+    {"ldfe.a",		FLDINCREG (0x08, 0)},
+    {"ldfe.a.nt1",	FLDINCREG (0x08, 1)},
+    {"ldfe.a.nta",	FLDINCREG (0x08, 3)},
+    {"ldfs.sa",		FLDINCREG (0x0e, 0)},
+    {"ldfs.sa.nt1",	FLDINCREG (0x0e, 1)},
+    {"ldfs.sa.nta",	FLDINCREG (0x0e, 3)},
+    {"ldfd.sa",		FLDINCREG (0x0f, 0)},
+    {"ldfd.sa.nt1",	FLDINCREG (0x0f, 1)},
+    {"ldfd.sa.nta",	FLDINCREG (0x0f, 3)},
+    {"ldf8.sa",		FLDINCREG (0x0d, 0)},
+    {"ldf8.sa.nt1",	FLDINCREG (0x0d, 1)},
+    {"ldf8.sa.nta",	FLDINCREG (0x0d, 3)},
+    {"ldfe.sa",		FLDINCREG (0x0c, 0)},
+    {"ldfe.sa.nt1",	FLDINCREG (0x0c, 1)},
+    {"ldfe.sa.nta",	FLDINCREG (0x0c, 3)},
+    {"ldf.fill",	FLDINCREG (0x1b, 0)},
+    {"ldf.fill.nt1",	FLDINCREG (0x1b, 1)},
+    {"ldf.fill.nta",	FLDINCREG (0x1b, 3)},
+    {"ldfs.c.clr",	FLDINCREG (0x22, 0)},
+    {"ldfs.c.clr.nt1",	FLDINCREG (0x22, 1)},
+    {"ldfs.c.clr.nta",	FLDINCREG (0x22, 3)},
+    {"ldfd.c.clr",	FLDINCREG (0x23, 0)},
+    {"ldfd.c.clr.nt1",	FLDINCREG (0x23, 1)},
+    {"ldfd.c.clr.nta",	FLDINCREG (0x23, 3)},
+    {"ldf8.c.clr",	FLDINCREG (0x21, 0)},
+    {"ldf8.c.clr.nt1",	FLDINCREG (0x21, 1)},
+    {"ldf8.c.clr.nta",	FLDINCREG (0x21, 3)},
+    {"ldfe.c.clr",	FLDINCREG (0x20, 0)},
+    {"ldfe.c.clr.nt1",	FLDINCREG (0x20, 1)},
+    {"ldfe.c.clr.nta",	FLDINCREG (0x20, 3)},
+    {"ldfs.c.nc",	FLDINCREG (0x26, 0)},
+    {"ldfs.c.nc.nt1",	FLDINCREG (0x26, 1)},
+    {"ldfs.c.nc.nta",	FLDINCREG (0x26, 3)},
+    {"ldfd.c.nc",	FLDINCREG (0x27, 0)},
+    {"ldfd.c.nc.nt1",	FLDINCREG (0x27, 1)},
+    {"ldfd.c.nc.nta",	FLDINCREG (0x27, 3)},
+    {"ldf8.c.nc",	FLDINCREG (0x25, 0)},
+    {"ldf8.c.nc.nt1",	FLDINCREG (0x25, 1)},
+    {"ldf8.c.nc.nta",	FLDINCREG (0x25, 3)},
+    {"ldfe.c.nc",	FLDINCREG (0x24, 0)},
+    {"ldfe.c.nc.nt1",	FLDINCREG (0x24, 1)},
+    {"ldfe.c.nc.nta",	FLDINCREG (0x24, 3)},
+#undef FLDINCREG
 
     /* floating-point store */
     {"stfs",		M, OpMXX6aHint (6, 0, 0, 0x32, 0), {MR3, F2}},
@@ -805,7 +814,7 @@
     {"ldfp8.c.nc.nta",	M2, OpMXX6aHint (6, 0, 1, 0x25, 3), {F1, F2, MR3}},
 
     /* floating-point load pair w/increment by immediate */
-#define LD(a,b,c)	M2, OpMXX6aHint (6, 1, 1, a, b), {F1, F2, MR3, c}
+#define LD(a,b,c) M2, OpMXX6aHint (6, 1, 1, a, b), {F1, F2, MR3, c}, POSTINC
     {"ldfps",		LD (0x02, 0, C8)},
     {"ldfps.nt1",	LD (0x02, 1, C8)},
     {"ldfps.nta",	LD (0x02, 3, C8)},
@@ -881,22 +890,24 @@
     {"lfetch.fault.excl.nta",	M0, OpMXX6aHint (6, 0, 0, 0x2f, 3), {MR3}},
 
     /* line prefetch w/increment by register */
-    {"lfetch",			M0, OpMXX6aHint (6, 1, 0, 0x2c, 0), {MR3, R2}},
-    {"lfetch.nt1",		M0, OpMXX6aHint (6, 1, 0, 0x2c, 1), {MR3, R2}},
-    {"lfetch.nt2",		M0, OpMXX6aHint (6, 1, 0, 0x2c, 2), {MR3, R2}},
-    {"lfetch.nta",		M0, OpMXX6aHint (6, 1, 0, 0x2c, 3), {MR3, R2}},
-    {"lfetch.excl",		M0, OpMXX6aHint (6, 1, 0, 0x2d, 0), {MR3, R2}},
-    {"lfetch.excl.nt1",		M0, OpMXX6aHint (6, 1, 0, 0x2d, 1), {MR3, R2}},
-    {"lfetch.excl.nt2",		M0, OpMXX6aHint (6, 1, 0, 0x2d, 2), {MR3, R2}},
-    {"lfetch.excl.nta",		M0, OpMXX6aHint (6, 1, 0, 0x2d, 3), {MR3, R2}},
-    {"lfetch.fault",		M0, OpMXX6aHint (6, 1, 0, 0x2e, 0), {MR3, R2}},
-    {"lfetch.fault.nt1",	M0, OpMXX6aHint (6, 1, 0, 0x2e, 1), {MR3, R2}},
-    {"lfetch.fault.nt2",	M0, OpMXX6aHint (6, 1, 0, 0x2e, 2), {MR3, R2}},
-    {"lfetch.fault.nta",	M0, OpMXX6aHint (6, 1, 0, 0x2e, 3), {MR3, R2}},
-    {"lfetch.fault.excl",	M0, OpMXX6aHint (6, 1, 0, 0x2f, 0), {MR3, R2}},
-    {"lfetch.fault.excl.nt1",	M0, OpMXX6aHint (6, 1, 0, 0x2f, 1), {MR3, R2}},
-    {"lfetch.fault.excl.nt2",	M0, OpMXX6aHint (6, 1, 0, 0x2f, 2), {MR3, R2}},
-    {"lfetch.fault.excl.nta",	M0, OpMXX6aHint (6, 1, 0, 0x2f, 3), {MR3, R2}},
+#define LFETCHINCREG(c,h) M0, OpMXX6aHint (6, 1, 0, c, h), {MR3, R2}, POSTINC
+    {"lfetch",			LFETCHINCREG (0x2c, 0)},
+    {"lfetch.nt1",		LFETCHINCREG (0x2c, 1)},
+    {"lfetch.nt2",		LFETCHINCREG (0x2c, 2)},
+    {"lfetch.nta",		LFETCHINCREG (0x2c, 3)},
+    {"lfetch.excl",		LFETCHINCREG (0x2d, 0)},
+    {"lfetch.excl.nt1",		LFETCHINCREG (0x2d, 1)},
+    {"lfetch.excl.nt2",		LFETCHINCREG (0x2d, 2)},
+    {"lfetch.excl.nta",		LFETCHINCREG (0x2d, 3)},
+    {"lfetch.fault",		LFETCHINCREG (0x2e, 0)},
+    {"lfetch.fault.nt1",	LFETCHINCREG (0x2e, 1)},
+    {"lfetch.fault.nt2",	LFETCHINCREG (0x2e, 2)},
+    {"lfetch.fault.nta",	LFETCHINCREG (0x2e, 3)},
+    {"lfetch.fault.excl",	LFETCHINCREG (0x2f, 0)},
+    {"lfetch.fault.excl.nt1",	LFETCHINCREG (0x2f, 1)},
+    {"lfetch.fault.excl.nt2",	LFETCHINCREG (0x2f, 2)},
+    {"lfetch.fault.excl.nta",	LFETCHINCREG (0x2f, 3)},
+#undef LFETCHINCREG
 
     /* semaphore operations */
     {"setf.sig",	M, OpMXX6a (6, 0, 1, 0x1c), {F1, R2}},
@@ -904,111 +915,118 @@
     {"setf.s",		M, OpMXX6a (6, 0, 1, 0x1e), {F1, R2}},
     {"setf.d",		M, OpMXX6a (6, 0, 1, 0x1f), {F1, R2}},
 
-    {"ldfs",		M, OpX6aHint (7, 0x02, 0), {F1, MR3, IMM9b}},
-    {"ldfs.nt1",	M, OpX6aHint (7, 0x02, 1), {F1, MR3, IMM9b}},
-    {"ldfs.nta",	M, OpX6aHint (7, 0x02, 3), {F1, MR3, IMM9b}},
-    {"ldfd",		M, OpX6aHint (7, 0x03, 0), {F1, MR3, IMM9b}},
-    {"ldfd.nt1",	M, OpX6aHint (7, 0x03, 1), {F1, MR3, IMM9b}},
-    {"ldfd.nta",	M, OpX6aHint (7, 0x03, 3), {F1, MR3, IMM9b}},
-    {"ldf8",		M, OpX6aHint (7, 0x01, 0), {F1, MR3, IMM9b}},
-    {"ldf8.nt1",	M, OpX6aHint (7, 0x01, 1), {F1, MR3, IMM9b}},
-    {"ldf8.nta",	M, OpX6aHint (7, 0x01, 3), {F1, MR3, IMM9b}},
-    {"ldfe",		M, OpX6aHint (7, 0x00, 0), {F1, MR3, IMM9b}},
-    {"ldfe.nt1",	M, OpX6aHint (7, 0x00, 1), {F1, MR3, IMM9b}},
-    {"ldfe.nta",	M, OpX6aHint (7, 0x00, 3), {F1, MR3, IMM9b}},
-    {"ldfs.s",		M, OpX6aHint (7, 0x06, 0), {F1, MR3, IMM9b}},
-    {"ldfs.s.nt1",	M, OpX6aHint (7, 0x06, 1), {F1, MR3, IMM9b}},
-    {"ldfs.s.nta",	M, OpX6aHint (7, 0x06, 3), {F1, MR3, IMM9b}},
-    {"ldfd.s",		M, OpX6aHint (7, 0x07, 0), {F1, MR3, IMM9b}},
-    {"ldfd.s.nt1",	M, OpX6aHint (7, 0x07, 1), {F1, MR3, IMM9b}},
-    {"ldfd.s.nta",	M, OpX6aHint (7, 0x07, 3), {F1, MR3, IMM9b}},
-    {"ldf8.s",		M, OpX6aHint (7, 0x05, 0), {F1, MR3, IMM9b}},
-    {"ldf8.s.nt1",	M, OpX6aHint (7, 0x05, 1), {F1, MR3, IMM9b}},
-    {"ldf8.s.nta",	M, OpX6aHint (7, 0x05, 3), {F1, MR3, IMM9b}},
-    {"ldfe.s",		M, OpX6aHint (7, 0x04, 0), {F1, MR3, IMM9b}},
-    {"ldfe.s.nt1",	M, OpX6aHint (7, 0x04, 1), {F1, MR3, IMM9b}},
-    {"ldfe.s.nta",	M, OpX6aHint (7, 0x04, 3), {F1, MR3, IMM9b}},
-    {"ldfs.a",		M, OpX6aHint (7, 0x0a, 0), {F1, MR3, IMM9b}},
-    {"ldfs.a.nt1",	M, OpX6aHint (7, 0x0a, 1), {F1, MR3, IMM9b}},
-    {"ldfs.a.nta",	M, OpX6aHint (7, 0x0a, 3), {F1, MR3, IMM9b}},
-    {"ldfd.a",		M, OpX6aHint (7, 0x0b, 0), {F1, MR3, IMM9b}},
-    {"ldfd.a.nt1",	M, OpX6aHint (7, 0x0b, 1), {F1, MR3, IMM9b}},
-    {"ldfd.a.nta",	M, OpX6aHint (7, 0x0b, 3), {F1, MR3, IMM9b}},
-    {"ldf8.a",		M, OpX6aHint (7, 0x09, 0), {F1, MR3, IMM9b}},
-    {"ldf8.a.nt1",	M, OpX6aHint (7, 0x09, 1), {F1, MR3, IMM9b}},
-    {"ldf8.a.nta",	M, OpX6aHint (7, 0x09, 3), {F1, MR3, IMM9b}},
-    {"ldfe.a",		M, OpX6aHint (7, 0x08, 0), {F1, MR3, IMM9b}},
-    {"ldfe.a.nt1",	M, OpX6aHint (7, 0x08, 1), {F1, MR3, IMM9b}},
-    {"ldfe.a.nta",	M, OpX6aHint (7, 0x08, 3), {F1, MR3, IMM9b}},
-    {"ldfs.sa",		M, OpX6aHint (7, 0x0e, 0), {F1, MR3, IMM9b}},
-    {"ldfs.sa.nt1",	M, OpX6aHint (7, 0x0e, 1), {F1, MR3, IMM9b}},
-    {"ldfs.sa.nta",	M, OpX6aHint (7, 0x0e, 3), {F1, MR3, IMM9b}},
-    {"ldfd.sa",		M, OpX6aHint (7, 0x0f, 0), {F1, MR3, IMM9b}},
-    {"ldfd.sa.nt1",	M, OpX6aHint (7, 0x0f, 1), {F1, MR3, IMM9b}},
-    {"ldfd.sa.nta",	M, OpX6aHint (7, 0x0f, 3), {F1, MR3, IMM9b}},
-    {"ldf8.sa",		M, OpX6aHint (7, 0x0d, 0), {F1, MR3, IMM9b}},
-    {"ldf8.sa.nt1",	M, OpX6aHint (7, 0x0d, 1), {F1, MR3, IMM9b}},
-    {"ldf8.sa.nta",	M, OpX6aHint (7, 0x0d, 3), {F1, MR3, IMM9b}},
-    {"ldfe.sa",		M, OpX6aHint (7, 0x0c, 0), {F1, MR3, IMM9b}},
-    {"ldfe.sa.nt1",	M, OpX6aHint (7, 0x0c, 1), {F1, MR3, IMM9b}},
-    {"ldfe.sa.nta",	M, OpX6aHint (7, 0x0c, 3), {F1, MR3, IMM9b}},
-    {"ldf.fill",	M, OpX6aHint (7, 0x1b, 0), {F1, MR3, IMM9b}},
-    {"ldf.fill.nt1",	M, OpX6aHint (7, 0x1b, 1), {F1, MR3, IMM9b}},
-    {"ldf.fill.nta",	M, OpX6aHint (7, 0x1b, 3), {F1, MR3, IMM9b}},
-    {"ldfs.c.clr",	M, OpX6aHint (7, 0x22, 0), {F1, MR3, IMM9b}},
-    {"ldfs.c.clr.nt1",	M, OpX6aHint (7, 0x22, 1), {F1, MR3, IMM9b}},
-    {"ldfs.c.clr.nta",	M, OpX6aHint (7, 0x22, 3), {F1, MR3, IMM9b}},
-    {"ldfd.c.clr",	M, OpX6aHint (7, 0x23, 0), {F1, MR3, IMM9b}},
-    {"ldfd.c.clr.nt1",	M, OpX6aHint (7, 0x23, 1), {F1, MR3, IMM9b}},
-    {"ldfd.c.clr.nta",	M, OpX6aHint (7, 0x23, 3), {F1, MR3, IMM9b}},
-    {"ldf8.c.clr",	M, OpX6aHint (7, 0x21, 0), {F1, MR3, IMM9b}},
-    {"ldf8.c.clr.nt1",	M, OpX6aHint (7, 0x21, 1), {F1, MR3, IMM9b}},
-    {"ldf8.c.clr.nta",	M, OpX6aHint (7, 0x21, 3), {F1, MR3, IMM9b}},
-    {"ldfe.c.clr",	M, OpX6aHint (7, 0x20, 0), {F1, MR3, IMM9b}},
-    {"ldfe.c.clr.nt1",	M, OpX6aHint (7, 0x20, 1), {F1, MR3, IMM9b}},
-    {"ldfe.c.clr.nta",	M, OpX6aHint (7, 0x20, 3), {F1, MR3, IMM9b}},
-    {"ldfs.c.nc",	M, OpX6aHint (7, 0x26, 0), {F1, MR3, IMM9b}},
-    {"ldfs.c.nc.nt1",	M, OpX6aHint (7, 0x26, 1), {F1, MR3, IMM9b}},
-    {"ldfs.c.nc.nta",	M, OpX6aHint (7, 0x26, 3), {F1, MR3, IMM9b}},
-    {"ldfd.c.nc",	M, OpX6aHint (7, 0x27, 0), {F1, MR3, IMM9b}},
-    {"ldfd.c.nc.nt1",	M, OpX6aHint (7, 0x27, 1), {F1, MR3, IMM9b}},
-    {"ldfd.c.nc.nta",	M, OpX6aHint (7, 0x27, 3), {F1, MR3, IMM9b}},
-    {"ldf8.c.nc",	M, OpX6aHint (7, 0x25, 0), {F1, MR3, IMM9b}},
-    {"ldf8.c.nc.nt1",	M, OpX6aHint (7, 0x25, 1), {F1, MR3, IMM9b}},
-    {"ldf8.c.nc.nta",	M, OpX6aHint (7, 0x25, 3), {F1, MR3, IMM9b}},
-    {"ldfe.c.nc",	M, OpX6aHint (7, 0x24, 0), {F1, MR3, IMM9b}},
-    {"ldfe.c.nc.nt1",	M, OpX6aHint (7, 0x24, 1), {F1, MR3, IMM9b}},
-    {"ldfe.c.nc.nta",	M, OpX6aHint (7, 0x24, 3), {F1, MR3, IMM9b}},
+    /* floating-point load w/increment by immediate */
+#define FLDINCIMMED(c,h) M, OpX6aHint (7, c, h), {F1, MR3, IMM9b}, POSTINC
+    {"ldfs",		FLDINCIMMED (0x02, 0)},
+    {"ldfs.nt1",	FLDINCIMMED (0x02, 1)},
+    {"ldfs.nta",	FLDINCIMMED (0x02, 3)},
+    {"ldfd",		FLDINCIMMED (0x03, 0)},
+    {"ldfd.nt1",	FLDINCIMMED (0x03, 1)},
+    {"ldfd.nta",	FLDINCIMMED (0x03, 3)},
+    {"ldf8",		FLDINCIMMED (0x01, 0)},
+    {"ldf8.nt1",	FLDINCIMMED (0x01, 1)},
+    {"ldf8.nta",	FLDINCIMMED (0x01, 3)},
+    {"ldfe",		FLDINCIMMED (0x00, 0)},
+    {"ldfe.nt1",	FLDINCIMMED (0x00, 1)},
+    {"ldfe.nta",	FLDINCIMMED (0x00, 3)},
+    {"ldfs.s",		FLDINCIMMED (0x06, 0)},
+    {"ldfs.s.nt1",	FLDINCIMMED (0x06, 1)},
+    {"ldfs.s.nta",	FLDINCIMMED (0x06, 3)},
+    {"ldfd.s",		FLDINCIMMED (0x07, 0)},
+    {"ldfd.s.nt1",	FLDINCIMMED (0x07, 1)},
+    {"ldfd.s.nta",	FLDINCIMMED (0x07, 3)},
+    {"ldf8.s",		FLDINCIMMED (0x05, 0)},
+    {"ldf8.s.nt1",	FLDINCIMMED (0x05, 1)},
+    {"ldf8.s.nta",	FLDINCIMMED (0x05, 3)},
+    {"ldfe.s",		FLDINCIMMED (0x04, 0)},
+    {"ldfe.s.nt1",	FLDINCIMMED (0x04, 1)},
+    {"ldfe.s.nta",	FLDINCIMMED (0x04, 3)},
+    {"ldfs.a",		FLDINCIMMED (0x0a, 0)},
+    {"ldfs.a.nt1",	FLDINCIMMED (0x0a, 1)},
+    {"ldfs.a.nta",	FLDINCIMMED (0x0a, 3)},
+    {"ldfd.a",		FLDINCIMMED (0x0b, 0)},
+    {"ldfd.a.nt1",	FLDINCIMMED (0x0b, 1)},
+    {"ldfd.a.nta",	FLDINCIMMED (0x0b, 3)},
+    {"ldf8.a",		FLDINCIMMED (0x09, 0)},
+    {"ldf8.a.nt1",	FLDINCIMMED (0x09, 1)},
+    {"ldf8.a.nta",	FLDINCIMMED (0x09, 3)},
+    {"ldfe.a",		FLDINCIMMED (0x08, 0)},
+    {"ldfe.a.nt1",	FLDINCIMMED (0x08, 1)},
+    {"ldfe.a.nta",	FLDINCIMMED (0x08, 3)},
+    {"ldfs.sa",		FLDINCIMMED (0x0e, 0)},
+    {"ldfs.sa.nt1",	FLDINCIMMED (0x0e, 1)},
+    {"ldfs.sa.nta",	FLDINCIMMED (0x0e, 3)},
+    {"ldfd.sa",		FLDINCIMMED (0x0f, 0)},
+    {"ldfd.sa.nt1",	FLDINCIMMED (0x0f, 1)},
+    {"ldfd.sa.nta",	FLDINCIMMED (0x0f, 3)},
+    {"ldf8.sa",		FLDINCIMMED (0x0d, 0)},
+    {"ldf8.sa.nt1",	FLDINCIMMED (0x0d, 1)},
+    {"ldf8.sa.nta",	FLDINCIMMED (0x0d, 3)},
+    {"ldfe.sa",		FLDINCIMMED (0x0c, 0)},
+    {"ldfe.sa.nt1",	FLDINCIMMED (0x0c, 1)},
+    {"ldfe.sa.nta",	FLDINCIMMED (0x0c, 3)},
+    {"ldf.fill",	FLDINCIMMED (0x1b, 0)},
+    {"ldf.fill.nt1",	FLDINCIMMED (0x1b, 1)},
+    {"ldf.fill.nta",	FLDINCIMMED (0x1b, 3)},
+    {"ldfs.c.clr",	FLDINCIMMED (0x22, 0)},
+    {"ldfs.c.clr.nt1",	FLDINCIMMED (0x22, 1)},
+    {"ldfs.c.clr.nta",	FLDINCIMMED (0x22, 3)},
+    {"ldfd.c.clr",	FLDINCIMMED (0x23, 0)},
+    {"ldfd.c.clr.nt1",	FLDINCIMMED (0x23, 1)},
+    {"ldfd.c.clr.nta",	FLDINCIMMED (0x23, 3)},
+    {"ldf8.c.clr",	FLDINCIMMED (0x21, 0)},
+    {"ldf8.c.clr.nt1",	FLDINCIMMED (0x21, 1)},
+    {"ldf8.c.clr.nta",	FLDINCIMMED (0x21, 3)},
+    {"ldfe.c.clr",	FLDINCIMMED (0x20, 0)},
+    {"ldfe.c.clr.nt1",	FLDINCIMMED (0x20, 1)},
+    {"ldfe.c.clr.nta",	FLDINCIMMED (0x20, 3)},
+    {"ldfs.c.nc",	FLDINCIMMED (0x26, 0)},
+    {"ldfs.c.nc.nt1",	FLDINCIMMED (0x26, 1)},
+    {"ldfs.c.nc.nta",	FLDINCIMMED (0x26, 3)},
+    {"ldfd.c.nc",	FLDINCIMMED (0x27, 0)},
+    {"ldfd.c.nc.nt1",	FLDINCIMMED (0x27, 1)},
+    {"ldfd.c.nc.nta",	FLDINCIMMED (0x27, 3)},
+    {"ldf8.c.nc",	FLDINCIMMED (0x25, 0)},
+    {"ldf8.c.nc.nt1",	FLDINCIMMED (0x25, 1)},
+    {"ldf8.c.nc.nta",	FLDINCIMMED (0x25, 3)},
+    {"ldfe.c.nc",	FLDINCIMMED (0x24, 0)},
+    {"ldfe.c.nc.nt1",	FLDINCIMMED (0x24, 1)},
+    {"ldfe.c.nc.nta",	FLDINCIMMED (0x24, 3)},
+#undef FLDINCIMMED
 
     /* floating-point store w/increment by immediate */
-    {"stfs",		M, OpX6aHint (7, 0x32, 0), {MR3, F2, IMM9a}},
-    {"stfs.nta",	M, OpX6aHint (7, 0x32, 3), {MR3, F2, IMM9a}},
-    {"stfd",		M, OpX6aHint (7, 0x33, 0), {MR3, F2, IMM9a}},
-    {"stfd.nta",	M, OpX6aHint (7, 0x33, 3), {MR3, F2, IMM9a}},
-    {"stf8",		M, OpX6aHint (7, 0x31, 0), {MR3, F2, IMM9a}},
-    {"stf8.nta",	M, OpX6aHint (7, 0x31, 3), {MR3, F2, IMM9a}},
-    {"stfe",		M, OpX6aHint (7, 0x30, 0), {MR3, F2, IMM9a}},
-    {"stfe.nta",	M, OpX6aHint (7, 0x30, 3), {MR3, F2, IMM9a}},
-    {"stf.spill",	M, OpX6aHint (7, 0x3b, 0), {MR3, F2, IMM9a}},
-    {"stf.spill.nta",	M, OpX6aHint (7, 0x3b, 3), {MR3, F2, IMM9a}},
+#define FSTINCIMMED(c,h) M, OpX6aHint (7, c, h), {MR3, F2, IMM9a}, POSTINC
+    {"stfs",		FSTINCIMMED (0x32, 0)},
+    {"stfs.nta",	FSTINCIMMED (0x32, 3)},
+    {"stfd",		FSTINCIMMED (0x33, 0)},
+    {"stfd.nta",	FSTINCIMMED (0x33, 3)},
+    {"stf8",		FSTINCIMMED (0x31, 0)},
+    {"stf8.nta",	FSTINCIMMED (0x31, 3)},
+    {"stfe",		FSTINCIMMED (0x30, 0)},
+    {"stfe.nta",	FSTINCIMMED (0x30, 3)},
+    {"stf.spill",	FSTINCIMMED (0x3b, 0)},
+    {"stf.spill.nta",	FSTINCIMMED (0x3b, 3)},
+#undef FSTINCIMMED
 
     /* line prefetch w/increment by immediate */
-    {"lfetch",			M0, OpX6aHint (7, 0x2c, 0), {MR3, IMM9b}},
-    {"lfetch.nt1",		M0, OpX6aHint (7, 0x2c, 1), {MR3, IMM9b}},
-    {"lfetch.nt2",		M0, OpX6aHint (7, 0x2c, 2), {MR3, IMM9b}},
-    {"lfetch.nta",		M0, OpX6aHint (7, 0x2c, 3), {MR3, IMM9b}},
-    {"lfetch.excl",		M0, OpX6aHint (7, 0x2d, 0), {MR3, IMM9b}},
-    {"lfetch.excl.nt1",		M0, OpX6aHint (7, 0x2d, 1), {MR3, IMM9b}},
-    {"lfetch.excl.nt2",		M0, OpX6aHint (7, 0x2d, 2), {MR3, IMM9b}},
-    {"lfetch.excl.nta",		M0, OpX6aHint (7, 0x2d, 3), {MR3, IMM9b}},
-    {"lfetch.fault",		M0, OpX6aHint (7, 0x2e, 0), {MR3, IMM9b}},
-    {"lfetch.fault.nt1",	M0, OpX6aHint (7, 0x2e, 1), {MR3, IMM9b}},
-    {"lfetch.fault.nt2",	M0, OpX6aHint (7, 0x2e, 2), {MR3, IMM9b}},
-    {"lfetch.fault.nta",	M0, OpX6aHint (7, 0x2e, 3), {MR3, IMM9b}},
-    {"lfetch.fault.excl",	M0, OpX6aHint (7, 0x2f, 0), {MR3, IMM9b}},
-    {"lfetch.fault.excl.nt1",	M0, OpX6aHint (7, 0x2f, 1), {MR3, IMM9b}},
-    {"lfetch.fault.excl.nt2",	M0, OpX6aHint (7, 0x2f, 2), {MR3, IMM9b}},
-    {"lfetch.fault.excl.nta",	M0, OpX6aHint (7, 0x2f, 3), {MR3, IMM9b}},
+#define LFETCHINCIMMED(c,h) M0, OpX6aHint (7, c, h), {MR3, IMM9b}, POSTINC
+    {"lfetch",			LFETCHINCIMMED (0x2c, 0)},
+    {"lfetch.nt1",		LFETCHINCIMMED (0x2c, 1)},
+    {"lfetch.nt2",		LFETCHINCIMMED (0x2c, 2)},
+    {"lfetch.nta",		LFETCHINCIMMED (0x2c, 3)},
+    {"lfetch.excl",		LFETCHINCIMMED (0x2d, 0)},
+    {"lfetch.excl.nt1",		LFETCHINCIMMED (0x2d, 1)},
+    {"lfetch.excl.nt2",		LFETCHINCIMMED (0x2d, 2)},
+    {"lfetch.excl.nta",		LFETCHINCIMMED (0x2d, 3)},
+    {"lfetch.fault",		LFETCHINCIMMED (0x2e, 0)},
+    {"lfetch.fault.nt1",	LFETCHINCIMMED (0x2e, 1)},
+    {"lfetch.fault.nt2",	LFETCHINCIMMED (0x2e, 2)},
+    {"lfetch.fault.nta",	LFETCHINCIMMED (0x2e, 3)},
+    {"lfetch.fault.excl",	LFETCHINCIMMED (0x2f, 0)},
+    {"lfetch.fault.excl.nt1",	LFETCHINCIMMED (0x2f, 1)},
+    {"lfetch.fault.excl.nt2",	LFETCHINCIMMED (0x2f, 2)},
+    {"lfetch.fault.excl.nta",	LFETCHINCIMMED (0x2f, 3)},
+#undef LFETCHINCIMMED
 
     {0}
   };
diff --git a/opcodes/ia64-opc.c b/opcodes/ia64-opc.c
index c054b3d..c2ddc87 100644
--- a/opcodes/ia64-opc.c
+++ b/opcodes/ia64-opc.c
@@ -740,7 +740,8 @@
 {
   index = DEP(index);
 
-  if (index < 0 || index >= sizeof(dependencies) / sizeof(dependencies[0]))
+  if (index < 0
+      || index >= (int)(sizeof(dependencies) / sizeof(dependencies[0])))
     return NULL;
 
   return &dependencies[index];
diff --git a/opcodes/ia64-opc.h b/opcodes/ia64-opc.h
index 8a208fd..d030681 100644
--- a/opcodes/ia64-opc.h
+++ b/opcodes/ia64-opc.h
@@ -40,6 +40,7 @@
 #define F2_EQ_F3	IA64_OPCODE_F2_EQ_F3
 #define LEN_EQ_64MCNT	IA64_OPCODE_LEN_EQ_64MCNT
 #define MOD_RRBS        IA64_OPCODE_MOD_RRBS
+#define POSTINC		IA64_OPCODE_POSTINC
 
 #define AR_CCV	IA64_OPND_AR_CCV
 #define AR_PFS	IA64_OPND_AR_PFS
diff --git a/opcodes/ia64-raw.tbl b/opcodes/ia64-raw.tbl
index 3b39e73..ec35888 100644
--- a/opcodes/ia64-raw.tbl
+++ b/opcodes/ia64-raw.tbl
@@ -53,7 +53,7 @@
 CR[IRR%], % in 0 - 3;	IC:mov-from-CR-IVR;	IC:mov-from-CR-IRR+1;	data
 CR[ISR];	IC:mov-to-CR-ISR;	IC:mov-from-CR-ISR;	data
 CR[ITIR];	IC:mov-to-CR-ITIR;	IC:mov-from-CR-ITIR;	data
-CR[ITIR];	IC:mov-to-CR-ITIR;	itc.i, itc.d, itr.i, itc.d;	implied
+CR[ITIR];	IC:mov-to-CR-ITIR;	itc.i, itc.d, itr.i, itr.d;	implied
 CR[ITM];	IC:mov-to-CR-ITM;	IC:mov-from-CR-ITM;	data
 CR[ITV];	IC:mov-to-CR-ITV;	IC:mov-from-CR-ITV;	data
 CR[IVA];	IC:mov-to-CR-IVA;	IC:mov-from-CR-IVA;	instr
@@ -80,7 +80,7 @@
 FR%, % in 0 - 1;	IC:none;	IC:fr-readers+1;	none
 FR%, % in 2 - 127;	IC:fr-writers+1\IC:ldf-c+1\IC:ldfp-c+1;	IC:fr-readers+1;	impliedF
 FR%, % in 2 - 127;	IC:ldf-c+1, IC:ldfp-c+1;	IC:fr-readers+1;	none
-GR0;	IC:none;	IC:gr-readers+1, IC:mov-immediate;	none
+GR0;	IC:none;	IC:gr-readers+1;	none
 GR%, % in 1 - 127;	IC:ld-c+1+13;	IC:gr-readers+1;	none
 GR%, % in 1 - 127;	IC:gr-writers+1\IC:ld-c+1+13;	IC:gr-readers+1;	impliedF
 IBR#;	IC:mov-to-IND-IBR+3;	IC:mov-from-IND-IBR+3;	impliedF
@@ -108,11 +108,14 @@
 PMC#;	IC:mov-to-IND-PMC+3;	IC:mov-from-IND-PMC+3;	impliedF
 PMC#;	IC:mov-to-IND-PMC+3;	IC:mov-from-IND-PMD+3;	SC+3 Section 12.1.1
 PMD#;	IC:mov-to-IND-PMD+3;	IC:mov-from-IND-PMD+3;	impliedF
-PR0;	IC:pr-writers+1;	IC:pr-readers-br+1, IC:pr-readers-nobr-nomovpr+1 , IC:mov-from-PR+12, IC:mov-to-PR+12;	none
-PR%, % in 1 - 62;	IC:pr-writers+1, IC:mov-to-PR-allreg+7, IC:mov-to-PR-rotreg;	IC:pr-readers-nobr-nomovpr+1 , IC:mov-from-PR, IC:mov-to-PR+12;	impliedF
-PR%, % in 1 - 62;	IC:pr-writers-fp+1;	IC:pr-readers-br+1;	impliedF
-PR%, % in 1 - 62;	IC:pr-writers-int+1, IC:mov-to-PR-allreg+7, IC:mov-to-PR-rotreg;	IC:pr-readers-br+1;	none
-PR63;	IC:mod-sched-brs, IC:pr-writers+1, IC:mov-to-PR-allreg+7, IC:mov-to-PR-rotreg;	IC:pr-readers-nobr-nomovpr+1 , IC:mov-from-PR, IC:mov-to-PR+12;	impliedF
+PR0;	IC:pr-writers+1;	IC:pr-readers-br+1, IC:pr-readers-nobr-nomovpr+1, IC:mov-from-PR+12, IC:mov-to-PR+12;	none
+PR%, % in 1 - 15;	IC:pr-writers+1, IC:mov-to-PR-allreg+7;	IC:pr-readers-nobr-nomovpr+1, IC:mov-from-PR, IC:mov-to-PR+12;	impliedF
+PR%, % in 1 - 15;	IC:pr-writers-fp+1;	IC:pr-readers-br+1;	impliedF
+PR%, % in 1 - 15;	IC:pr-writers-int+1, IC:mov-to-PR-allreg+7;	IC:pr-readers-br+1;	none
+PR%, % in 16 - 62;	IC:pr-writers+1, IC:mov-to-PR-allreg+7, IC:mov-to-PR-rotreg;	IC:pr-readers-nobr-nomovpr+1, IC:mov-from-PR, IC:mov-to-PR+12;	impliedF
+PR%, % in 16 - 62;	IC:pr-writers-fp+1;	IC:pr-readers-br+1;	impliedF
+PR%, % in 16 - 62;	IC:pr-writers-int+1, IC:mov-to-PR-allreg+7, IC:mov-to-PR-rotreg;	IC:pr-readers-br+1;	none
+PR63;	IC:mod-sched-brs, IC:pr-writers+1, IC:mov-to-PR-allreg+7, IC:mov-to-PR-rotreg;	IC:pr-readers-nobr-nomovpr+1, IC:mov-from-PR, IC:mov-to-PR+12;	impliedF
 PR63;	IC:pr-writers-fp+1, IC:mod-sched-brs;	IC:pr-readers-br+1;	impliedF
 PR63;	IC:pr-writers-int+1, IC:mov-to-PR-allreg+7, IC:mov-to-PR-rotreg;	IC:pr-readers-br+1;	none
 PSR.ac;	IC:user-mask-writers-partial+7, IC:mov-to-PSR-um;	IC:mem-readers, IC:mem-writers;	implied
diff --git a/opcodes/ia64-war.tbl b/opcodes/ia64-war.tbl
index aa49e08..8cdfac5 100644
--- a/opcodes/ia64-war.tbl
+++ b/opcodes/ia64-war.tbl
@@ -1,2 +1,2 @@
-Resource Name;	Readers;	Writers;	Results of Dependency
-PR63;	IC:pr-readers-br+1;	IC:mod-sched-brs;	impliedF
+Resource Name;	Readers;	Writers;	Semantics of Dependency
+PR63;	IC:pr-readers-br+1;	IC:mod-sched-brs;	stop
diff --git a/opcodes/ia64-waw.tbl b/opcodes/ia64-waw.tbl
index 0fa743e..c8a3365 100644
--- a/opcodes/ia64-waw.tbl
+++ b/opcodes/ia64-waw.tbl
@@ -82,12 +82,15 @@
 PMC#;	IC:mov-to-IND-PMC+3;	IC:mov-to-IND-PMC+3;	impliedF
 PMD#;	IC:mov-to-IND-PMD+3;	IC:mov-to-IND-PMD+3;	impliedF
 PR0;	IC:pr-writers+1;	IC:pr-writers+1;	none
-PR%, % in 1 - 62;	IC:pr-and-writers+1;	IC:pr-and-writers+1;	none
-PR%, % in 1 - 62;	IC:pr-or-writers+1;	IC:pr-or-writers+1;	none
-PR%, % in 1 - 62;	IC:pr-unc-writers-fp+1, IC:pr-unc-writers-int+1, IC:pr-norm-writers-fp+1, IC:pr-norm-writers-int+1, IC:pr-and-writers+1, IC:mov-to-PR+7;	IC:pr-unc-writers-fp+1, IC:pr-unc-writers-int+1, IC:pr-norm-writers-fp+1, IC:pr-norm-writers-int+1, IC:pr-or-writers+1, IC:mov-to-PR+7;	impliedF
+PR%, % in 1 - 15;	IC:pr-and-writers+1;	IC:pr-and-writers+1;	none
+PR%, % in 1 - 15;	IC:pr-or-writers+1;	IC:pr-or-writers+1;	none
+PR%, % in 1 - 15;	IC:pr-unc-writers-fp+1, IC:pr-unc-writers-int+1, IC:pr-norm-writers-fp+1, IC:pr-norm-writers-int+1, IC:pr-and-writers+1, IC:mov-to-PR-allreg+7;	IC:pr-unc-writers-fp+1, IC:pr-unc-writers-int+1, IC:pr-norm-writers-fp+1, IC:pr-norm-writers-int+1, IC:pr-or-writers+1, IC:mov-to-PR-allreg+7;	impliedF
+PR%, % in 16 - 62;	IC:pr-and-writers+1;	IC:pr-and-writers+1;	none
+PR%, % in 16 - 62;	IC:pr-or-writers+1;	IC:pr-or-writers+1;	none
+PR%, % in 16 - 62;	IC:pr-unc-writers-fp+1, IC:pr-unc-writers-int+1, IC:pr-norm-writers-fp+1, IC:pr-norm-writers-int+1, IC:pr-and-writers+1, IC:mov-to-PR-allreg+7, IC:mov-to-PR-rotreg;	IC:pr-unc-writers-fp+1, IC:pr-unc-writers-int+1, IC:pr-norm-writers-fp+1, IC:pr-norm-writers-int+1, IC:pr-or-writers+1, IC:mov-to-PR-allreg+7, IC:mov-to-PR-rotreg;	impliedF
 PR63;	IC:pr-and-writers+1;	IC:pr-and-writers+1;	none
 PR63;	IC:pr-or-writers+1;	IC:pr-or-writers+1;	none
-PR63;	IC:mod-sched-brs, IC:pr-unc-writers-fp+1, IC:pr-unc-writers-int+1, IC:pr-norm-writers-fp+1, IC:pr-norm-writers-int+1, IC:pr-and-writers+1, IC:mov-to-PR+7;	IC:mod-sched-brs, IC:pr-unc-writers-fp+1, IC:pr-unc-writers-int+1, IC:pr-norm-writers-fp+1, IC:pr-norm-writers-int+1, IC:pr-or-writers+1, IC:mov-to-PR+7;	impliedF
+PR63;	IC:mod-sched-brs, IC:pr-unc-writers-fp+1, IC:pr-unc-writers-int+1, IC:pr-norm-writers-fp+1, IC:pr-norm-writers-int+1, IC:pr-and-writers+1, IC:mov-to-PR-allreg+7, IC:mov-to-PR-rotreg;	IC:mod-sched-brs, IC:pr-unc-writers-fp+1, IC:pr-unc-writers-int+1, IC:pr-norm-writers-fp+1, IC:pr-norm-writers-int+1, IC:pr-or-writers+1, IC:mov-to-PR-allreg+7, IC:mov-to-PR-rotreg;	impliedF
 PSR.ac;	IC:user-mask-writers-partial+7, IC:mov-to-PSR-um, IC:sys-mask-writers-partial+7, IC:mov-to-PSR-l, rfi;	IC:user-mask-writers-partial+7, IC:mov-to-PSR-um, IC:sys-mask-writers-partial+7, IC:mov-to-PSR-l, rfi;	impliedF
 PSR.be;	IC:user-mask-writers-partial+7, IC:mov-to-PSR-um, IC:sys-mask-writers-partial+7, IC:mov-to-PSR-l, rfi;	IC:user-mask-writers-partial+7, IC:mov-to-PSR-um, IC:sys-mask-writers-partial+7, IC:mov-to-PSR-l, rfi;	impliedF
 PSR.bn;	bsw, rfi;	bsw, rfi;	impliedF
diff --git a/opcodes/m32r-asm.c b/opcodes/m32r-asm.c
index 0aa62ce..5dba005 100644
--- a/opcodes/m32r-asm.c
+++ b/opcodes/m32r-asm.c
@@ -406,7 +406,7 @@
 	     first char after the mnemonic part is a space.  */
 	  /* FIXME: We also take inappropriate advantage of the fact that
 	     GAS's input scrubber will remove extraneous blanks.  */
-	  if (*str == CGEN_SYNTAX_CHAR (* syn))
+	  if (tolower (*str) == tolower (CGEN_SYNTAX_CHAR (* syn)))
 	    {
 #ifdef CGEN_MNEMONIC_OPERANDS
 	      if (* syn == ' ')
@@ -418,9 +418,11 @@
 	  else
 	    {
 	      /* Syntax char didn't match.  Can't be this insn.  */
-	      /* FIXME: would like to return something like
-		 "expected char `c'" */
-	      return _("syntax error");
+	      static char msg [80];
+	      /* xgettext:c-format */
+	      sprintf (msg, _("syntax error (expected char `%c', found `%c')"),
+		       *syn, *str);
+	      return msg;
 	    }
 	  continue;
 	}
@@ -486,7 +488,7 @@
 {
   const char *start;
   CGEN_INSN_LIST *ilist;
-  const char *tmp_errmsg;
+  const char *tmp_errmsg = NULL;
 
   /* Skip leading white space.  */
   while (isspace (* str))
@@ -521,20 +523,25 @@
       /* Allow parse/insert handlers to obtain length of insn.  */
       CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
 
-      if (!(tmp_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields)))
-	{
-	  /* ??? 0 is passed for `pc' */
-	  if (CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf, (bfd_vma) 0)
-	      != NULL)
-	    continue;
-	  /* It is up to the caller to actually output the insn and any
-	     queued relocs.  */
-	  return insn;
-	}
+      tmp_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields);
+      if (tmp_errmsg != NULL)
+	continue;
 
-      /* Try the next entry.  */
+      /* ??? 0 is passed for `pc' */
+      tmp_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf,
+					      (bfd_vma) 0);
+      if (tmp_errmsg != NULL)
+        continue;
+
+      /* It is up to the caller to actually output the insn and any
+         queued relocs.  */
+      return insn;
     }
 
+  /* Make sure we leave this with something at this point. */
+  if (tmp_errmsg == NULL)
+    tmp_errmsg = "unknown mnemonic";
+
   {
     static char errbuf[150];
 
diff --git a/opcodes/m32r-desc.c b/opcodes/m32r-desc.c
index 360c38f..a13d083 100644
--- a/opcodes/m32r-desc.c
+++ b/opcodes/m32r-desc.c
@@ -32,6 +32,7 @@
 #include "m32r-desc.h"
 #include "m32r-opc.h"
 #include "opintl.h"
+#include "libiberty.h"
 
 /* Attributes.  */
 
@@ -69,7 +70,7 @@
 
 const CGEN_ATTR_TABLE m32r_cgen_ifield_attr_table[] =
 {
-  { "MACH", & MACH_attr[0] },
+  { "MACH", & MACH_attr[0], & MACH_attr[0] },
   { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
   { "PCREL-ADDR", &bool_attr[0], &bool_attr[0] },
   { "ABS-ADDR", &bool_attr[0], &bool_attr[0] },
@@ -82,7 +83,7 @@
 
 const CGEN_ATTR_TABLE m32r_cgen_hardware_attr_table[] =
 {
-  { "MACH", & MACH_attr[0] },
+  { "MACH", & MACH_attr[0], & MACH_attr[0] },
   { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
   { "CACHE-ADDR", &bool_attr[0], &bool_attr[0] },
   { "PC", &bool_attr[0], &bool_attr[0] },
@@ -92,7 +93,7 @@
 
 const CGEN_ATTR_TABLE m32r_cgen_operand_attr_table[] =
 {
-  { "MACH", & MACH_attr[0] },
+  { "MACH", & MACH_attr[0], & MACH_attr[0] },
   { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
   { "PCREL-ADDR", &bool_attr[0], &bool_attr[0] },
   { "ABS-ADDR", &bool_attr[0], &bool_attr[0] },
@@ -108,8 +109,8 @@
 
 const CGEN_ATTR_TABLE m32r_cgen_insn_attr_table[] =
 {
-  { "MACH", & MACH_attr[0] },
-  { "PIPE", & PIPE_attr[0] },
+  { "MACH", & MACH_attr[0], & MACH_attr[0] },
+  { "PIPE", & PIPE_attr[0], & PIPE_attr[0] },
   { "ALIAS", &bool_attr[0], &bool_attr[0] },
   { "VIRTUAL", &bool_attr[0], &bool_attr[0] },
   { "UNCOND-CTI", &bool_attr[0], &bool_attr[0] },
@@ -128,8 +129,8 @@
 /* Instruction set variants.  */
 
 static const CGEN_ISA m32r_cgen_isa_table[] = {
-  { "m32r", 32, 32, 16, 32,  },
-  { 0 }
+  { "m32r", 32, 32, 16, 32 },
+  { 0, 0, 0, 0, 0 }
 };
 
 /* Machine variants.  */
@@ -137,81 +138,84 @@
 static const CGEN_MACH m32r_cgen_mach_table[] = {
   { "m32r", "m32r", MACH_M32R },
   { "m32rx", "m32rx", MACH_M32RX },
-  { 0 }
+  { 0, 0, 0 }
 };
 
 static CGEN_KEYWORD_ENTRY m32r_cgen_opval_gr_names_entries[] =
 {
-  { "fp", 13 },
-  { "lr", 14 },
-  { "sp", 15 },
-  { "r0", 0 },
-  { "r1", 1 },
-  { "r2", 2 },
-  { "r3", 3 },
-  { "r4", 4 },
-  { "r5", 5 },
-  { "r6", 6 },
-  { "r7", 7 },
-  { "r8", 8 },
-  { "r9", 9 },
-  { "r10", 10 },
-  { "r11", 11 },
-  { "r12", 12 },
-  { "r13", 13 },
-  { "r14", 14 },
-  { "r15", 15 }
+  { "fp", 13, {0, {0}}, 0, 0 },
+  { "lr", 14, {0, {0}}, 0, 0 },
+  { "sp", 15, {0, {0}}, 0, 0 },
+  { "r0", 0, {0, {0}}, 0, 0 },
+  { "r1", 1, {0, {0}}, 0, 0 },
+  { "r2", 2, {0, {0}}, 0, 0 },
+  { "r3", 3, {0, {0}}, 0, 0 },
+  { "r4", 4, {0, {0}}, 0, 0 },
+  { "r5", 5, {0, {0}}, 0, 0 },
+  { "r6", 6, {0, {0}}, 0, 0 },
+  { "r7", 7, {0, {0}}, 0, 0 },
+  { "r8", 8, {0, {0}}, 0, 0 },
+  { "r9", 9, {0, {0}}, 0, 0 },
+  { "r10", 10, {0, {0}}, 0, 0 },
+  { "r11", 11, {0, {0}}, 0, 0 },
+  { "r12", 12, {0, {0}}, 0, 0 },
+  { "r13", 13, {0, {0}}, 0, 0 },
+  { "r14", 14, {0, {0}}, 0, 0 },
+  { "r15", 15, {0, {0}}, 0, 0 }
 };
 
 CGEN_KEYWORD m32r_cgen_opval_gr_names =
 {
   & m32r_cgen_opval_gr_names_entries[0],
-  19
+  19,
+  0, 0, 0, 0
 };
 
 static CGEN_KEYWORD_ENTRY m32r_cgen_opval_cr_names_entries[] =
 {
-  { "psw", 0 },
-  { "cbr", 1 },
-  { "spi", 2 },
-  { "spu", 3 },
-  { "bpc", 6 },
-  { "bbpsw", 8 },
-  { "bbpc", 14 },
-  { "cr0", 0 },
-  { "cr1", 1 },
-  { "cr2", 2 },
-  { "cr3", 3 },
-  { "cr4", 4 },
-  { "cr5", 5 },
-  { "cr6", 6 },
-  { "cr7", 7 },
-  { "cr8", 8 },
-  { "cr9", 9 },
-  { "cr10", 10 },
-  { "cr11", 11 },
-  { "cr12", 12 },
-  { "cr13", 13 },
-  { "cr14", 14 },
-  { "cr15", 15 }
+  { "psw", 0, {0, {0}}, 0, 0 },
+  { "cbr", 1, {0, {0}}, 0, 0 },
+  { "spi", 2, {0, {0}}, 0, 0 },
+  { "spu", 3, {0, {0}}, 0, 0 },
+  { "bpc", 6, {0, {0}}, 0, 0 },
+  { "bbpsw", 8, {0, {0}}, 0, 0 },
+  { "bbpc", 14, {0, {0}}, 0, 0 },
+  { "cr0", 0, {0, {0}}, 0, 0 },
+  { "cr1", 1, {0, {0}}, 0, 0 },
+  { "cr2", 2, {0, {0}}, 0, 0 },
+  { "cr3", 3, {0, {0}}, 0, 0 },
+  { "cr4", 4, {0, {0}}, 0, 0 },
+  { "cr5", 5, {0, {0}}, 0, 0 },
+  { "cr6", 6, {0, {0}}, 0, 0 },
+  { "cr7", 7, {0, {0}}, 0, 0 },
+  { "cr8", 8, {0, {0}}, 0, 0 },
+  { "cr9", 9, {0, {0}}, 0, 0 },
+  { "cr10", 10, {0, {0}}, 0, 0 },
+  { "cr11", 11, {0, {0}}, 0, 0 },
+  { "cr12", 12, {0, {0}}, 0, 0 },
+  { "cr13", 13, {0, {0}}, 0, 0 },
+  { "cr14", 14, {0, {0}}, 0, 0 },
+  { "cr15", 15, {0, {0}}, 0, 0 }
 };
 
 CGEN_KEYWORD m32r_cgen_opval_cr_names =
 {
   & m32r_cgen_opval_cr_names_entries[0],
-  23
+  23,
+  0, 0, 0, 0
 };
 
 static CGEN_KEYWORD_ENTRY m32r_cgen_opval_h_accums_entries[] =
 {
-  { "a0", 0 },
-  { "a1", 1 }
+  { "a0", 0, {0, {0}}, 0, 0 },
+  { "a1", 1, {0, {0}}, 0, 0 }
 };
 
 CGEN_KEYWORD m32r_cgen_opval_h_accums =
 {
   & m32r_cgen_opval_h_accums_entries[0],
-  2
+  2,
+  0, 0, 0, 0
 };
 
 
@@ -240,7 +244,7 @@
   { "h-bpsw", HW_H_BPSW, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
   { "h-bbpsw", HW_H_BBPSW, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
   { "h-lock", HW_H_LOCK, CGEN_ASM_NONE, 0, { 0, { (1<<MACH_BASE) } } },
-  { 0 }
+  { 0, 0, CGEN_ASM_NONE, 0, {0, {0}} }
 };
 
 #undef A
@@ -277,7 +281,7 @@
   { M32R_F_BITS67, "f-bits67", 0, 32, 6, 2, { 0, { (1<<MACH_BASE) } }  },
   { M32R_F_BIT14, "f-bit14", 0, 32, 14, 1, { 0, { (1<<MACH_BASE) } }  },
   { M32R_F_IMM1, "f-imm1", 0, 32, 15, 1, { 0, { (1<<MACH_BASE) } }  },
-  { 0 }
+  { 0, 0, 0, 0, 0, 0, {0, {0}} }
 };
 
 #undef A
@@ -367,7 +371,7 @@
 /* accum: accumulator */
   { "accum", M32R_OPERAND_ACCUM, HW_H_ACCUM, 0, 0,
     { 0|A(SEM_ONLY), { (1<<MACH_BASE) } }  },
-  { 0 }
+  { 0, 0, 0, 0, 0, {0, {0}} }
 };
 
 #undef A
@@ -382,7 +386,7 @@
   /* Special null first entry.
      A `num' value of zero is thus invalid.
      Also, the special `invalid' insn resides here.  */
-  { 0, 0, 0 },
+  { 0, 0, 0, 0, {0, {0}} },
 /* add $dr,$sr */
   {
     M32R_INSN_ADD, "add", "add", 16,
@@ -1175,9 +1179,11 @@
 m32r_cgen_rebuild_tables (cd)
      CGEN_CPU_TABLE *cd;
 {
-  int i,n_isas,n_machs;
+  int i,n_isas;
   unsigned int isas = cd->isas;
+#if 0
   unsigned int machs = cd->machs;
+#endif
 
   cd->int_insn_p = CGEN_INT_INSN_P;
 
@@ -1219,6 +1225,7 @@
 	++n_isas;
       }
 
+#if 0 /* Does nothing?? */
   /* Data derived from the mach spec.  */
   for (i = 0; i < MAX_MACHS; ++i)
     if (((1 << i) & machs) != 0)
@@ -1227,6 +1234,7 @@
 
 	++n_machs;
       }
+#endif
 
   /* Determine which hw elements are used by MACH.  */
   build_hw_table (cd);
@@ -1338,7 +1346,7 @@
   cd->rebuild_tables = m32r_cgen_rebuild_tables;
   m32r_cgen_rebuild_tables (cd);
 
-  /* Initialise flags.  */
+  /* Default to not allowing signed overflow.  */
   cd->signed_overflow_ok_p = 0;
   
   return (CGEN_CPU_DESC) cd;
diff --git a/opcodes/m32r-desc.h b/opcodes/m32r-desc.h
index 32ea2f7..774891d 100644
--- a/opcodes/m32r-desc.h
+++ b/opcodes/m32r-desc.h
@@ -44,7 +44,7 @@
 
 #define CGEN_INT_INSN_P 1
 
-/* Maximum number of syntax bytes in an instruction.  */
+/* Maximum nymber of syntax bytes in an instruction.  */
 #define CGEN_ACTUAL_MAX_SYNTAX_BYTES 15
 
 /* CGEN_MNEMONIC_OPERANDS is defined if mnemonics have operands.
@@ -189,7 +189,7 @@
 } CGEN_OPERAND_TYPE;
 
 /* Number of operands types.  */
-#define MAX_OPERANDS ((int) M32R_OPERAND_MAX)
+#define MAX_OPERANDS 26
 
 /* Maximum number of operands referenced by any insn.  */
 #define MAX_OPERAND_INSTANCES 11
diff --git a/opcodes/m32r-dis.c b/opcodes/m32r-dis.c
index d6d5377..ed99320 100644
--- a/opcodes/m32r-dis.c
+++ b/opcodes/m32r-dis.c
@@ -68,12 +68,12 @@
 
 static void
 print_hash (cd, dis_info, value, attrs, pc, length)
-     CGEN_CPU_DESC cd;
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
      PTR dis_info;
-     long value;
-     unsigned int attrs;
-     bfd_vma pc;
-     int length;
+     long value ATTRIBUTE_UNUSED;
+     unsigned int attrs ATTRIBUTE_UNUSED;
+     bfd_vma pc ATTRIBUTE_UNUSED;
+     int length ATTRIBUTE_UNUSED;
 {
   disassemble_info *info = (disassemble_info *) dis_info;
   (*info->fprintf_func) (info->stream, "#");
@@ -156,7 +156,7 @@
      int opindex;
      PTR xinfo;
      CGEN_FIELDS *fields;
-     void const *attrs;
+     void const *attrs ATTRIBUTE_UNUSED;
      bfd_vma pc;
      int length;
 {
@@ -263,12 +263,12 @@
 
 static void
 print_normal (cd, dis_info, value, attrs, pc, length)
-     CGEN_CPU_DESC cd;
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
      PTR dis_info;
      long value;
      unsigned int attrs;
-     bfd_vma pc;
-     int length;
+     bfd_vma pc ATTRIBUTE_UNUSED;
+     int length ATTRIBUTE_UNUSED;
 {
   disassemble_info *info = (disassemble_info *) dis_info;
 
@@ -289,12 +289,12 @@
 
 static void
 print_address (cd, dis_info, value, attrs, pc, length)
-     CGEN_CPU_DESC cd;
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
      PTR dis_info;
      bfd_vma value;
      unsigned int attrs;
-     bfd_vma pc;
-     int length;
+     bfd_vma pc ATTRIBUTE_UNUSED;
+     int length ATTRIBUTE_UNUSED;
 {
   disassemble_info *info = (disassemble_info *) dis_info;
 
@@ -319,11 +319,11 @@
 
 static void
 print_keyword (cd, dis_info, keyword_table, value, attrs)
-     CGEN_CPU_DESC cd;
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
      PTR dis_info;
      CGEN_KEYWORD *keyword_table;
      long value;
-     unsigned int attrs;
+     unsigned int attrs ATTRIBUTE_UNUSED;
 {
   disassemble_info *info = (disassemble_info *) dis_info;
   const CGEN_KEYWORD_ENTRY *ke;
@@ -374,6 +374,48 @@
     }
 }
 
+/* Subroutine of print_insn. Reads an insn into the given buffers and updates
+   the extract info.
+   Returns 0 if all is well, non-zero otherwise.  */
+static int
+read_insn (cd, pc, info, buf, buflen, ex_info, insn_value)
+     CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
+     bfd_vma pc;
+     disassemble_info *info;
+     char *buf;
+     int buflen;
+     CGEN_EXTRACT_INFO *ex_info;
+     unsigned long *insn_value;
+{
+  int status = (*info->read_memory_func) (pc, buf, buflen, info);
+  if (status != 0)
+    {
+      (*info->memory_error_func) (status, pc, info);
+      return -1;
+    }
+
+  ex_info->dis_info = info;
+  ex_info->valid = (1 << buflen) - 1;
+  ex_info->insn_bytes = buf;
+
+  switch (buflen)
+    {
+    case 1:
+      *insn_value = buf[0];
+      break;
+    case 2:
+      *insn_value = info->endian == BFD_ENDIAN_BIG ? bfd_getb16 (buf) : bfd_getl16 (buf);
+      break;
+    case 4:
+      *insn_value = info->endian == BFD_ENDIAN_BIG ? bfd_getb32 (buf) : bfd_getl32 (buf);
+      break;
+    default:
+      abort ();
+    }
+
+  return 0;
+}
+
 /* Utility to print an insn.
    BUF is the base part of the insn, target byte order, BUFLEN bytes long.
    The result is the size of the insn in bytes or zero for an unknown insn
@@ -391,9 +433,13 @@
   unsigned long insn_value;
   const CGEN_INSN_LIST *insn_list;
   CGEN_EXTRACT_INFO ex_info;
-
+#if 0
+  int rc = read_insn (cd, pc, info, buf, buflen, & ex_info, & insn_value);
+  if (rc != 0)
+    return rc;
+#else
   ex_info.dis_info = info;
-  ex_info.valid = (1 << (cd->base_insn_bitsize / 8)) - 1;
+  ex_info.valid = (1 << buflen) - 1;
   ex_info.insn_bytes = buf;
 
   switch (buflen)
@@ -410,7 +456,7 @@
     default:
       abort ();
     }
-
+#endif
   /* The instructions are stored in hash lists.
      Pick the first one and keep trying until we find the right one.  */
 
@@ -441,8 +487,23 @@
 	     machine insn and extracts the fields.  The second pass prints
 	     them.  */
 
-	  length = CGEN_EXTRACT_FN (cd, insn)
-	    (cd, insn, &ex_info, insn_value, &fields, pc);
+	  /* Make sure the entire insn is loaded into insn_value, if it
+	     can fit.  */
+	  if ((unsigned) CGEN_INSN_BITSIZE (insn) > cd->base_insn_bitsize &&
+	      (unsigned) (CGEN_INSN_BITSIZE (insn) / 8) <= sizeof (unsigned long))
+	    {
+	      unsigned long full_insn_value;
+	      int rc = read_insn (cd, pc, info, buf,
+				  CGEN_INSN_BITSIZE (insn) / 8,
+				  & ex_info, & full_insn_value);
+	      if (rc != 0)
+		return rc;
+	      length = CGEN_EXTRACT_FN (cd, insn)
+		(cd, insn, &ex_info, full_insn_value, &fields, pc);
+	    }
+	  else
+	    length = CGEN_EXTRACT_FN (cd, insn)
+	      (cd, insn, &ex_info, insn_value, &fields, pc);
 	  /* length < 0 -> error */
 	  if (length < 0)
 	    return length;
@@ -466,7 +527,6 @@
 
 #ifndef CGEN_PRINT_INSN
 #define CGEN_PRINT_INSN default_print_insn
-#endif
 
 static int
 default_print_insn (cd, pc, info)
@@ -488,6 +548,7 @@
 
   return print_insn (cd, pc, info, buf, cd->base_insn_bitsize / 8);
 }
+#endif
 
 /* Main entry point.
    Print one instruction from PC on INFO->STREAM.
@@ -499,7 +560,9 @@
      disassemble_info *info;
 {
   static CGEN_CPU_DESC cd = 0;
-  static prev_isa,prev_mach,prev_endian;
+  static int prev_isa;
+  static int prev_mach;
+  static int prev_endian;
   int length;
   int isa,mach;
   int endian = (info->endian == BFD_ENDIAN_BIG
diff --git a/opcodes/m32r-ibld.c b/opcodes/m32r-ibld.c
index 30c3c6a..9920380 100644
--- a/opcodes/m32r-ibld.c
+++ b/opcodes/m32r-ibld.c
@@ -57,6 +57,9 @@
 static int extract_insn_normal
      PARAMS ((CGEN_CPU_DESC, const CGEN_INSN *, CGEN_EXTRACT_INFO *,
 	      CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma));
+static void put_insn_int_value
+     PARAMS ((CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT));
+
 
 /* Operand insertion.  */
 
@@ -183,9 +186,11 @@
   if (length == 0)
     return NULL;
 
+#if 0
   if (CGEN_INT_INSN_P
       && word_offset != 0)
     abort ();
+#endif
 
   if (word_length > 32)
     abort ();
@@ -237,9 +242,9 @@
     int shift;
 
     if (CGEN_INSN_LSB0_P)
-      shift = (start + 1) - length;
+      shift = (word_offset + start + 1) - length;
     else
-      shift = word_length - (start + length);
+      shift = total_length - (word_offset + start + length);
     *buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
   }
 
@@ -283,7 +288,8 @@
 
 #if CGEN_INT_INSN_P
 
-  *buffer = value;
+  put_insn_int_value (cd, buffer, cd->base_insn_bitsize,
+		      CGEN_FIELDS_BITSIZE (fields), value);
 
 #else
 
@@ -313,6 +319,30 @@
 
   return NULL;
 }
+
+/* Cover function to store an insn value into an integral insn.  Must go here
+ because it needs <prefix>-desc.h for CGEN_INT_INSN_P.  */
+
+static void
+put_insn_int_value (cd, buf, length, insn_length, value)
+     CGEN_CPU_DESC cd;
+     CGEN_INSN_BYTES_PTR buf;
+     int length;
+     int insn_length;
+     CGEN_INSN_INT value;
+{
+  /* For architectures with insns smaller than the base-insn-bitsize,
+     length may be too big.  */
+  if (length > insn_length)
+    *buf = value;
+  else
+    {
+      int shift = insn_length - length;
+      /* Written this way to avoid undefined behaviour.  */
+      CGEN_INSN_INT mask = (((1L << (length - 1)) - 1) << 1) | 1;
+      *buf = (*buf & ~(mask << shift)) | ((value & mask) << shift);
+    }
+}
 
 /* Operand extraction.  */
 
@@ -444,11 +474,19 @@
 extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length,
 		word_length, total_length, pc, valuep)
      CGEN_CPU_DESC cd;
+#if ! CGEN_INT_INSN_P
      CGEN_EXTRACT_INFO *ex_info;
+#else
+     CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED;
+#endif
      CGEN_INSN_INT insn_value;
      unsigned int attrs;
      unsigned int word_offset, start, length, word_length, total_length;
+#if ! CGEN_INT_INSN_P
      bfd_vma pc;
+#else
+     bfd_vma pc ATTRIBUTE_UNUSED;
+#endif
      long *valuep;
 {
   CGEN_INSN_INT value;
@@ -461,9 +499,11 @@
       return 1;
     }
 
+#if 0
   if (CGEN_INT_INSN_P
       && word_offset != 0)
     abort ();
+#endif
 
   if (word_length > 32)
     abort ();
@@ -479,15 +519,15 @@
 
   /* Does the value reside in INSN_VALUE?  */
 
-  if (word_offset == 0)
+  if (CGEN_INT_INSN_P || word_offset == 0)
     {
       /* Written this way to avoid undefined behaviour.  */
       CGEN_INSN_INT mask = (((1L << (length - 1)) - 1) << 1) | 1;
 
       if (CGEN_INSN_LSB0_P)
-	value = insn_value >> ((start + 1) - length);
+	value = insn_value >> ((word_offset + start + 1) - length);
       else
-	value = insn_value >> (word_length - (start + length));
+	value = insn_value >> (total_length - ( word_offset + start + length));
       value &= mask;
       /* sign extend? */
       if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)
diff --git a/opcodes/m32r-opc.c b/opcodes/m32r-opc.c
index a1efecc..a0753f3 100644
--- a/opcodes/m32r-opc.c
+++ b/opcodes/m32r-opc.c
@@ -28,6 +28,7 @@
 #include "symcat.h"
 #include "m32r-desc.h"
 #include "m32r-opc.h"
+#include "libiberty.h"
 
 /* The hash functions are recorded here to help keep assembler code out of
    the disassembler and vice versa.  */
@@ -42,131 +43,131 @@
 #define F(f) & m32r_cgen_ifld_table[CONCAT2 (M32R_,f)]
 
 static const CGEN_IFMT ifmt_empty = {
-  0, 0, 0x0, { 0 }
+  0, 0, 0x0, { { 0 } }
 };
 
 static const CGEN_IFMT ifmt_add = {
-  16, 16, 0xf0f0, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
+  16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_add3 = {
-  32, 32, 0xf0f00000, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_SIMM16), 0 }
+  32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_and3 = {
-  32, 32, 0xf0f00000, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_UIMM16), 0 }
+  32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_or3 = {
-  32, 32, 0xf0f00000, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_UIMM16), 0 }
+  32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_addi = {
-  16, 16, 0xf000, { F (F_OP1), F (F_R1), F (F_SIMM8), 0 }
+  16, 16, 0xf000, { { F (F_OP1) }, { F (F_R1) }, { F (F_SIMM8) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_addv3 = {
-  32, 32, 0xf0f00000, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_SIMM16), 0 }
+  32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_bc8 = {
-  16, 16, 0xff00, { F (F_OP1), F (F_R1), F (F_DISP8), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_bc24 = {
-  32, 32, 0xff000000, { F (F_OP1), F (F_R1), F (F_DISP24), 0 }
+  32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_beq = {
-  32, 32, 0xf0f00000, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_DISP16), 0 }
+  32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_DISP16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_beqz = {
-  32, 32, 0xfff00000, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_DISP16), 0 }
+  32, 32, 0xfff00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_DISP16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_cmp = {
-  16, 16, 0xf0f0, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
+  16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_cmpi = {
-  32, 32, 0xfff00000, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_SIMM16), 0 }
+  32, 32, 0xfff00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_cmpz = {
-  16, 16, 0xfff0, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
+  16, 16, 0xfff0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_div = {
-  32, 32, 0xf0f0ffff, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_SIMM16), 0 }
+  32, 32, 0xf0f0ffff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_jc = {
-  16, 16, 0xfff0, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
+  16, 16, 0xfff0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ld24 = {
-  32, 32, 0xf0000000, { F (F_OP1), F (F_R1), F (F_UIMM24), 0 }
+  32, 32, 0xf0000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_UIMM24) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldi16 = {
-  32, 32, 0xf0ff0000, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_SIMM16), 0 }
+  32, 32, 0xf0ff0000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_machi_a = {
-  16, 16, 0xf070, { F (F_OP1), F (F_R1), F (F_ACC), F (F_OP23), F (F_R2), 0 }
+  16, 16, 0xf070, { { F (F_OP1) }, { F (F_R1) }, { F (F_ACC) }, { F (F_OP23) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_mvfachi = {
-  16, 16, 0xf0ff, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
+  16, 16, 0xf0ff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_mvfachi_a = {
-  16, 16, 0xf0f3, { F (F_OP1), F (F_R1), F (F_OP2), F (F_ACCS), F (F_OP3), 0 }
+  16, 16, 0xf0f3, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_OP3) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_mvfc = {
-  16, 16, 0xf0f0, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
+  16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_mvtachi = {
-  16, 16, 0xf0ff, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
+  16, 16, 0xf0ff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_mvtachi_a = {
-  16, 16, 0xf0f3, { F (F_OP1), F (F_R1), F (F_OP2), F (F_ACCS), F (F_OP3), 0 }
+  16, 16, 0xf0f3, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_OP3) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_mvtc = {
-  16, 16, 0xf0f0, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
+  16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_nop = {
-  16, 16, 0xffff, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
+  16, 16, 0xffff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_rac_dsi = {
-  16, 16, 0xf3f2, { F (F_OP1), F (F_ACCD), F (F_BITS67), F (F_OP2), F (F_ACCS), F (F_BIT14), F (F_IMM1), 0 }
+  16, 16, 0xf3f2, { { F (F_OP1) }, { F (F_ACCD) }, { F (F_BITS67) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_BIT14) }, { F (F_IMM1) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_seth = {
-  32, 32, 0xf0ff0000, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_HI16), 0 }
+  32, 32, 0xf0ff0000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_HI16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_slli = {
-  16, 16, 0xf0e0, { F (F_OP1), F (F_R1), F (F_SHIFT_OP2), F (F_UIMM5), 0 }
+  16, 16, 0xf0e0, { { F (F_OP1) }, { F (F_R1) }, { F (F_SHIFT_OP2) }, { F (F_UIMM5) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_st_d = {
-  32, 32, 0xf0f00000, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_SIMM16), 0 }
+  32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_trap = {
-  16, 16, 0xfff0, { F (F_OP1), F (F_R1), F (F_OP2), F (F_UIMM4), 0 }
+  16, 16, 0xfff0, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_UIMM4) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_satb = {
-  32, 32, 0xf0f0ffff, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), F (F_UIMM16), 0 }
+  32, 32, 0xf0f0ffff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_UIMM16) }, { 0 } }
 };
 
 #undef F
@@ -183,7 +184,7 @@
   /* Special null first entry.
      A `num' value of zero is thus invalid.
      Also, the special `invalid' insn resides here.  */
-  { { 0 } },
+  { { 0, 0, 0, 0 }, {{0}}, 0, {0}},
 /* add $dr,$sr */
   {
     { 0, 0, 0, 0 },
@@ -1000,147 +1001,147 @@
 #define F(f) & m32r_cgen_ifld_table[CONCAT2 (M32R_,f)]
 
 static const CGEN_IFMT ifmt_bc8r = {
-  16, 16, 0xff00, { F (F_OP1), F (F_R1), F (F_DISP8), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_bc24r = {
-  32, 32, 0xff000000, { F (F_OP1), F (F_R1), F (F_DISP24), 0 }
+  32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_bl8r = {
-  16, 16, 0xff00, { F (F_OP1), F (F_R1), F (F_DISP8), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_bl24r = {
-  32, 32, 0xff000000, { F (F_OP1), F (F_R1), F (F_DISP24), 0 }
+  32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_bcl8r = {
-  16, 16, 0xff00, { F (F_OP1), F (F_R1), F (F_DISP8), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_bcl24r = {
-  32, 32, 0xff000000, { F (F_OP1), F (F_R1), F (F_DISP24), 0 }
+  32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_bnc8r = {
-  16, 16, 0xff00, { F (F_OP1), F (F_R1), F (F_DISP8), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_bnc24r = {
-  32, 32, 0xff000000, { F (F_OP1), F (F_R1), F (F_DISP24), 0 }
+  32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_bra8r = {
-  16, 16, 0xff00, { F (F_OP1), F (F_R1), F (F_DISP8), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_bra24r = {
-  32, 32, 0xff000000, { F (F_OP1), F (F_R1), F (F_DISP24), 0 }
+  32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_bncl8r = {
-  16, 16, 0xff00, { F (F_OP1), F (F_R1), F (F_DISP8), 0 }
+  16, 16, 0xff00, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP8) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_bncl24r = {
-  32, 32, 0xff000000, { F (F_OP1), F (F_R1), F (F_DISP24), 0 }
+  32, 32, 0xff000000, { { F (F_OP1) }, { F (F_R1) }, { F (F_DISP24) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ld_2 = {
-  16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
+  16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ld_d2 = {
-  32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
+  32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldb_2 = {
-  16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
+  16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldb_d2 = {
-  32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
+  32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldh_2 = {
-  16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
+  16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldh_d2 = {
-  32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
+  32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldub_2 = {
-  16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
+  16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldub_d2 = {
-  32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
+  32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_lduh_2 = {
-  16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
+  16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_lduh_d2 = {
-  32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
+  32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_pop = {
-  16, 16, 0xf0ff, { F (F_OP1), F (F_R1), F (F_OP2), F (F_R2), 0 }
+  16, 16, 0xf0ff, { { F (F_OP1) }, { F (F_R1) }, { F (F_OP2) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldi8a = {
-  16, 16, 0xf000, { F (F_OP1), F (F_R1), F (F_SIMM8), 0 }
+  16, 16, 0xf000, { { F (F_OP1) }, { F (F_R1) }, { F (F_SIMM8) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_ldi16a = {
-  32, 32, 0xf0ff0000, { F (F_OP1), F (F_OP2), F (F_R2), F (F_R1), F (F_SIMM16), 0 }
+  32, 32, 0xf0ff0000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R2) }, { F (F_R1) }, { F (F_SIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_rac_d = {
-  16, 16, 0xf3ff, { F (F_OP1), F (F_ACCD), F (F_BITS67), F (F_OP2), F (F_ACCS), F (F_BIT14), F (F_IMM1), 0 }
+  16, 16, 0xf3ff, { { F (F_OP1) }, { F (F_ACCD) }, { F (F_BITS67) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_BIT14) }, { F (F_IMM1) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_rac_ds = {
-  16, 16, 0xf3f3, { F (F_OP1), F (F_ACCD), F (F_BITS67), F (F_OP2), F (F_ACCS), F (F_BIT14), F (F_IMM1), 0 }
+  16, 16, 0xf3f3, { { F (F_OP1) }, { F (F_ACCD) }, { F (F_BITS67) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_BIT14) }, { F (F_IMM1) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_rach_d = {
-  16, 16, 0xf3ff, { F (F_OP1), F (F_ACCD), F (F_BITS67), F (F_OP2), F (F_ACCS), F (F_BIT14), F (F_IMM1), 0 }
+  16, 16, 0xf3ff, { { F (F_OP1) }, { F (F_ACCD) }, { F (F_BITS67) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_BIT14) }, { F (F_IMM1) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_rach_ds = {
-  16, 16, 0xf3f3, { F (F_OP1), F (F_ACCD), F (F_BITS67), F (F_OP2), F (F_ACCS), F (F_BIT14), F (F_IMM1), 0 }
+  16, 16, 0xf3f3, { { F (F_OP1) }, { F (F_ACCD) }, { F (F_BITS67) }, { F (F_OP2) }, { F (F_ACCS) }, { F (F_BIT14) }, { F (F_IMM1) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_st_2 = {
-  16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
+  16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_st_d2 = {
-  32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
+  32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_stb_2 = {
-  16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
+  16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_stb_d2 = {
-  32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
+  32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_sth_2 = {
-  16, 16, 0xf0f0, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
+  16, 16, 0xf0f0, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_sth_d2 = {
-  32, 32, 0xf0f00000, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), F (F_SIMM16), 0 }
+  32, 32, 0xf0f00000, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { F (F_SIMM16) }, { 0 } }
 };
 
 static const CGEN_IFMT ifmt_push = {
-  16, 16, 0xf0ff, { F (F_OP1), F (F_OP2), F (F_R1), F (F_R2), 0 }
+  16, 16, 0xf0ff, { { F (F_OP1) }, { F (F_OP2) }, { F (F_R1) }, { F (F_R2) }, { 0 } }
 };
 
 #undef F
diff --git a/opcodes/m68hc11-dis.c b/opcodes/m68hc11-dis.c
new file mode 100644
index 0000000..2ef241c
--- /dev/null
+++ b/opcodes/m68hc11-dis.c
@@ -0,0 +1,608 @@
+/* m68hc11-dis.c -- Motorola 68HC11 & 68HC12 disassembly
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Written by Stephane Carrez (stcarrez@worldnet.fr)
+
+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 <stdio.h>
+
+#include "ansidecl.h"
+#include "opcode/m68hc11.h"
+#include "dis-asm.h"
+
+static const char *const reg_name[] = {
+  "X", "Y", "SP", "PC"
+};
+
+static const char *const reg_src_table[] = {
+  "A", "B", "CCR", "TMP3", "D", "X", "Y", "SP"
+};
+
+static const char *const reg_dst_table[] = {
+  "A", "B", "CCR", "TMP2", "D", "X", "Y", "SP"
+};
+
+#define OP_PAGE_MASK (M6811_OP_PAGE2|M6811_OP_PAGE3|M6811_OP_PAGE4)
+
+static int
+read_memory (memaddr, buffer, size, info)
+     bfd_vma memaddr;
+     bfd_byte *buffer;
+     int size;
+     struct disassemble_info *info;
+{
+  int status;
+
+  /* Get first byte.  Only one at a time because we don't know the
+     size of the insn.  */
+  status = (*info->read_memory_func) (memaddr, buffer, size, info);
+  if (status != 0)
+    {
+      (*info->memory_error_func) (status, memaddr, info);
+      return -1;
+    }
+  return 0;
+}
+
+
+/* Read the 68HC12 indexed operand byte and print the corresponding mode.
+   Returns the number of bytes read or -1 if failure.  */
+static int
+print_indexed_operand (memaddr, info, mov_insn)
+     bfd_vma memaddr;
+     struct disassemble_info *info;
+     int mov_insn;
+{
+  bfd_byte buffer[4];
+  int reg;
+  int status;
+  short sval;
+  int pos = 1;
+
+  status = read_memory (memaddr, &buffer[0], 1, info);
+  if (status != 0)
+    {
+      return status;
+    }
+
+  /* n,r with 5-bits signed constant.  */
+  if ((buffer[0] & 0x20) == 0)
+    {
+      reg = (buffer[0] >> 6) & 3;
+      sval = (buffer[0] & 0x1f);
+      if (sval & 0x10)
+	sval |= 0xfff0;
+      (*info->fprintf_func) (info->stream, "%d,%s",
+			     (int) sval, reg_name[reg]);
+    }
+
+  /* Auto pre/post increment/decrement.  */
+  else if ((buffer[0] & 0xc0) != 0xc0)
+    {
+      const char *mode;
+
+      reg = (buffer[0] >> 6) & 3;
+      sval = (buffer[0] & 0x0f);
+      if (sval & 0x8)
+	{
+	  sval |= 0xfff0;
+	  sval = -sval;
+	  mode = "-";
+	}
+      else
+	{
+	  sval = sval + 1;
+	  mode = "+";
+	}
+      (*info->fprintf_func) (info->stream, "%d,%s%s%s",
+			     (int) sval,
+			     (buffer[0] & 0x10 ? "" : mode),
+			     reg_name[reg], (buffer[0] & 0x10 ? mode : ""));
+    }
+
+  /* [n,r] 16-bits offset indexed indirect.  */
+  else if ((buffer[0] & 0x07) == 3)
+    {
+      if (mov_insn)
+	{
+	  (*info->fprintf_func) (info->stream, "<invalid op: 0x%x>",
+				 buffer[0] & 0x0ff);
+	  return 0;
+	}
+      reg = (buffer[0] >> 3) & 0x03;
+      status = read_memory (memaddr + pos, &buffer[0], 2, info);
+      if (status != 0)
+	{
+	  return status;
+	}
+
+      pos += 2;
+      sval = ((buffer[0] << 8) | (buffer[1] & 0x0FF));
+      (*info->fprintf_func) (info->stream, "[%u,%s]",
+			     sval & 0x0ffff, reg_name[reg]);
+    }
+  else if ((buffer[0] & 0x4) == 0)
+    {
+      if (mov_insn)
+	{
+	  (*info->fprintf_func) (info->stream, "<invalid op: 0x%x>",
+				 buffer[0] & 0x0ff);
+	  return 0;
+	}
+      reg = (buffer[0] >> 3) & 0x03;
+      status = read_memory (memaddr + pos,
+			    &buffer[1], (buffer[0] & 0x2 ? 2 : 1), info);
+      if (status != 0)
+	{
+	  return status;
+	}
+      if (buffer[0] & 2)
+	{
+	  sval = ((buffer[1] << 8) | (buffer[2] & 0x0FF));
+	  sval &= 0x0FFFF;
+	  pos += 2;
+	}
+      else
+	{
+	  sval = buffer[1] & 0x00ff;
+	  if (buffer[0] & 0x01)
+	    sval |= 0xff00;
+	  pos++;
+	}
+      (*info->fprintf_func) (info->stream, "%d,%s",
+			     (int) sval, reg_name[reg]);
+    }
+  else
+    {
+      reg = (buffer[0] >> 3) & 0x03;
+      switch (buffer[0] & 3)
+	{
+	case 0:
+	  (*info->fprintf_func) (info->stream, "A,%s", reg_name[reg]);
+	  break;
+	case 1:
+	  (*info->fprintf_func) (info->stream, "B,%s", reg_name[reg]);
+	  break;
+	case 2:
+	  (*info->fprintf_func) (info->stream, "D,%s", reg_name[reg]);
+	  break;
+	case 3:
+	default:
+	  (*info->fprintf_func) (info->stream, "[D,%s]", reg_name[reg]);
+	  break;
+	}
+    }
+
+  return pos;
+}
+
+/* Disassemble one instruction at address 'memaddr'.  Returns the number
+   of bytes used by that instruction.  */
+static int
+print_insn (memaddr, info, arch)
+     bfd_vma memaddr;
+     struct disassemble_info *info;
+     int arch;
+{
+  int status;
+  bfd_byte buffer[4];
+  unsigned char code;
+  long format, pos, i;
+  short sval;
+  const struct m68hc11_opcode *opcode;
+
+  /* Get first byte.  Only one at a time because we don't know the
+     size of the insn.  */
+  status = read_memory (memaddr, buffer, 1, info);
+  if (status != 0)
+    {
+      return status;
+    }
+
+  format = 0;
+  code = buffer[0];
+  pos = 0;
+
+  /* Look for page2,3,4 opcodes.  */
+  if (code == M6811_OPCODE_PAGE2)
+    {
+      pos++;
+      format = M6811_OP_PAGE2;
+    }
+  else if (code == M6811_OPCODE_PAGE3 && arch == cpu6811)
+    {
+      pos++;
+      format = M6811_OP_PAGE3;
+    }
+  else if (code == M6811_OPCODE_PAGE4 && arch == cpu6811)
+    {
+      pos++;
+      format = M6811_OP_PAGE4;
+    }
+
+  /* We are in page2,3,4; get the real opcode.  */
+  if (pos == 1)
+    {
+      status = read_memory (memaddr + pos, &buffer[1], 1, info);
+      if (status != 0)
+	{
+	  return status;
+	}
+      code = buffer[1];
+    }
+
+
+  /* Look first for a 68HC12 alias.  All of them are 2-bytes long and
+     in page 1.  There is no operand to print.  We read the second byte
+     only when we have a possible match.  */
+  if ((arch & cpu6812) && format == 0)
+    {
+      int must_read = 1;
+
+      /* Walk the alias table to find a code1+code2 match.  */
+      for (i = 0; i < m68hc12_num_alias; i++)
+	{
+	  if (m68hc12_alias[i].code1 == code)
+	    {
+	      if (must_read)
+		{
+		  status = read_memory (memaddr + pos + 1,
+					&buffer[1], 1, info);
+		  if (status != 0)
+		    break;
+
+		  must_read = 1;
+		}
+	      if (m68hc12_alias[i].code2 == (unsigned char) buffer[1])
+		{
+		  (*info->fprintf_func) (info->stream, "%s",
+					 m68hc12_alias[i].name);
+		  return 2;
+		}
+	    }
+	}
+    }
+
+  pos++;
+
+  /* Scan the opcode table until we find the opcode
+     with the corresponding page.  */
+  opcode = m68hc11_opcodes;
+  for (i = 0; i < m68hc11_num_opcodes; i++, opcode++)
+    {
+      int offset;
+
+      if ((opcode->arch & arch) == 0)
+	continue;
+      if (opcode->opcode != code)
+	continue;
+      if ((opcode->format & OP_PAGE_MASK) != format)
+	continue;
+
+      if (opcode->format & M6812_OP_REG)
+	{
+	  int j;
+	  int is_jump;
+
+	  if (opcode->format & M6811_OP_JUMP_REL)
+	    is_jump = 1;
+	  else
+	    is_jump = 0;
+
+	  status = read_memory (memaddr + pos, &buffer[0], 1, info);
+	  if (status != 0)
+	    {
+	      return status;
+	    }
+	  for (j = 0; i + j < m68hc11_num_opcodes; j++)
+	    {
+	      if ((opcode[j].arch & arch) == 0)
+		continue;
+	      if (opcode[j].opcode != code)
+		continue;
+	      if (is_jump)
+		{
+		  if (!(opcode[j].format & M6811_OP_JUMP_REL))
+		    continue;
+
+		  if ((opcode[j].format & M6812_OP_IBCC_MARKER)
+		      && (buffer[0] & 0xc0) != 0x80)
+		    continue;
+		  if ((opcode[j].format & M6812_OP_TBCC_MARKER)
+		      && (buffer[0] & 0xc0) != 0x40)
+		    continue;
+		  if ((opcode[j].format & M6812_OP_DBCC_MARKER)
+		      && (buffer[0] & 0xc0) != 0)
+		    continue;
+		  if ((opcode[j].format & M6812_OP_EQ_MARKER)
+		      && (buffer[0] & 0x20) == 0)
+		    break;
+		  if (!(opcode[j].format & M6812_OP_EQ_MARKER)
+		      && (buffer[0] & 0x20) != 0)
+		    break;
+		  continue;
+		}
+	      if (opcode[j].format & M6812_OP_EXG_MARKER && buffer[0] & 0x80)
+		break;
+	      if ((opcode[j].format & M6812_OP_SEX_MARKER)
+		  && (((buffer[0] & 0x07) >= 3 && (buffer[0] & 7) <= 7))
+		  && ((buffer[0] & 0x0f0) <= 0x20))
+		break;
+	      if (opcode[j].format & M6812_OP_TFR_MARKER
+		  && !(buffer[0] & 0x80))
+		break;
+	    }
+	  if (i + j < m68hc11_num_opcodes)
+	    opcode = &opcode[j];
+	}
+
+      /* We have found the opcode.  Extract the operand and print it.  */
+      (*info->fprintf_func) (info->stream, "%s", opcode->name);
+
+      format = opcode->format;
+      if (format & (M6811_OP_MASK | M6811_OP_BITMASK
+		    | M6811_OP_JUMP_REL | M6812_OP_JUMP_REL16))
+	{
+	  (*info->fprintf_func) (info->stream, "\t");
+	}
+
+      /* The movb and movw must be handled in a special way...  */
+      offset = 0;
+      if (format & (M6812_OP_IDX_P2 | M6812_OP_IND16_P2))
+	{
+	  if ((format & M6812_OP_IDX_P2)
+	      && (format & (M6811_OP_IMM8 | M6811_OP_IMM16 | M6811_OP_IND16)))
+	    offset = 1;
+	}
+
+      /* Operand with one more byte: - immediate, offset,
+         direct-low address.  */
+      if (format &
+	  (M6811_OP_IMM8 | M6811_OP_IX | M6811_OP_IY | M6811_OP_DIRECT))
+	{
+	  status = read_memory (memaddr + pos + offset, &buffer[0], 1, info);
+	  if (status != 0)
+	    {
+	      return status;
+	    }
+
+	  pos++;
+	  offset = -1;
+	  if (format & M6811_OP_IMM8)
+	    {
+	      (*info->fprintf_func) (info->stream, "#%d", (int) buffer[0]);
+	      format &= ~M6811_OP_IMM8;
+	    }
+	  else if (format & M6811_OP_IX)
+	    {
+	      /* Offsets are in range 0..255, print them unsigned.  */
+	      (*info->fprintf_func) (info->stream, "%u,x", buffer[0] & 0x0FF);
+	      format &= ~M6811_OP_IX;
+	    }
+	  else if (format & M6811_OP_IY)
+	    {
+	      (*info->fprintf_func) (info->stream, "%u,y", buffer[0] & 0x0FF);
+	      format &= ~M6811_OP_IY;
+	    }
+	  else if (format & M6811_OP_DIRECT)
+	    {
+	      (*info->fprintf_func) (info->stream, "*");
+	      (*info->print_address_func) (buffer[0] & 0x0FF, info);
+	      format &= ~M6811_OP_DIRECT;
+	    }
+	}
+
+#define M6812_INDEXED_FLAGS (M6812_OP_IDX|M6812_OP_IDX_1|M6812_OP_IDX_2)
+      /* Analyze the 68HC12 indexed byte.  */
+      if (format & M6812_INDEXED_FLAGS)
+	{
+	  status = print_indexed_operand (memaddr + pos, info, 0);
+	  if (status < 0)
+	    {
+	      return status;
+	    }
+	  pos += status;
+	}
+
+      /* 68HC12 dbcc/ibcc/tbcc operands.  */
+      if ((format & M6812_OP_REG) && (format & M6811_OP_JUMP_REL))
+	{
+	  status = read_memory (memaddr + pos, &buffer[0], 2, info);
+	  if (status != 0)
+	    {
+	      return status;
+	    }
+	  (*info->fprintf_func) (info->stream, "%s,",
+				 reg_src_table[buffer[0] & 0x07]);
+	  sval = buffer[1] & 0x0ff;
+	  if (buffer[0] & 0x10)
+	    sval |= 0xff00;
+
+	  pos += 2;
+	  (*info->print_address_func) (memaddr + pos + sval, info);
+	  format &= ~(M6812_OP_REG | M6811_OP_JUMP_REL);
+	}
+      else if (format & (M6812_OP_REG | M6812_OP_REG_2))
+	{
+	  status = read_memory (memaddr + pos, &buffer[0], 1, info);
+	  if (status != 0)
+	    {
+	      return status;
+	    }
+
+	  pos++;
+	  (*info->fprintf_func) (info->stream, "%s,%s",
+				 reg_src_table[(buffer[0] >> 4) & 7],
+				 reg_dst_table[(buffer[0] & 7)]);
+	}
+
+      /* M6811_OP_BITMASK and M6811_OP_JUMP_REL must be treated separately
+         and in that order.  The brset/brclr insn have a bitmask and then
+         a relative branch offset.  */
+      if (format & M6811_OP_BITMASK)
+	{
+	  status = read_memory (memaddr + pos, &buffer[0], 1, info);
+	  if (status != 0)
+	    {
+	      return status;
+	    }
+	  pos++;
+	  (*info->fprintf_func) (info->stream, " #$%02x%s",
+				 buffer[0] & 0x0FF,
+				 (format & M6811_OP_JUMP_REL ? " " : ""));
+	  format &= ~M6811_OP_BITMASK;
+	}
+      if (format & M6811_OP_JUMP_REL)
+	{
+	  int val;
+
+	  status = read_memory (memaddr + pos, &buffer[0], 1, info);
+	  if (status != 0)
+	    {
+	      return status;
+	    }
+
+	  pos++;
+	  val = (buffer[0] & 0x80) ? buffer[0] | 0xFFFFFF00 : buffer[0];
+	  (*info->print_address_func) (memaddr + pos + val, info);
+	  format &= ~M6811_OP_JUMP_REL;
+	}
+      else if (format & M6812_OP_JUMP_REL16)
+	{
+	  int val;
+
+	  status = read_memory (memaddr + pos, &buffer[0], 2, info);
+	  if (status != 0)
+	    {
+	      return status;
+	    }
+
+	  pos += 2;
+	  val = ((buffer[0] << 8) | (buffer[1] & 0x0FF));
+	  if (val & 0x8000)
+	    val |= 0xffff0000;
+
+	  (*info->print_address_func) (memaddr + pos + val, info);
+	  format &= ~M6812_OP_JUMP_REL16;
+	}
+      if (format & (M6811_OP_IMM16 | M6811_OP_IND16))
+	{
+	  int val;
+
+	  status = read_memory (memaddr + pos + offset, &buffer[0], 2, info);
+	  if (status != 0)
+	    {
+	      return status;
+	    }
+	  if (format & M6812_OP_IDX_P2)
+	    offset = -2;
+	  else
+	    offset = 0;
+	  pos += 2;
+
+	  val = ((buffer[0] << 8) | (buffer[1] & 0x0FF));
+	  val &= 0x0FFFF;
+	  if (format & M6811_OP_IMM16)
+	    {
+	      format &= ~M6811_OP_IMM16;
+	      (*info->fprintf_func) (info->stream, "#");
+	    }
+	  else
+	    format &= ~M6811_OP_IND16;
+
+	  (*info->print_address_func) (val, info);
+	}
+
+      if (format & M6812_OP_IDX_P2)
+	{
+	  (*info->fprintf_func) (info->stream, ", ");
+	  status = print_indexed_operand (memaddr + pos + offset, info, 1);
+	  if (status < 0)
+	    return status;
+	  pos += status;
+	}
+
+      if (format & M6812_OP_IND16_P2)
+	{
+	  int val;
+
+	  (*info->fprintf_func) (info->stream, ", ");
+
+	  status = read_memory (memaddr + pos + offset, &buffer[0], 2, info);
+	  if (status != 0)
+	    {
+	      return status;
+	    }
+	  pos += 2;
+
+	  val = ((buffer[0] << 8) | (buffer[1] & 0x0FF));
+	  val &= 0x0FFFF;
+	  (*info->print_address_func) (val, info);
+	}
+
+#ifdef DEBUG
+      /* Consistency check.  'format' must be 0, so that we have handled
+         all formats; and the computed size of the insn must match the
+         opcode table content.  */
+      if (format & ~(M6811_OP_PAGE4 | M6811_OP_PAGE3 | M6811_OP_PAGE2))
+	{
+	  (*info->fprintf_func) (info->stream, "; Error, format: %x", format);
+	}
+      if (pos != opcode->size)
+	{
+	  (*info->fprintf_func) (info->stream, "; Error, size: %d expect %d",
+				 pos, opcode->size);
+	}
+#endif
+      return pos;
+    }
+
+  /* Opcode not recognized.  */
+  if (format == M6811_OP_PAGE2 && arch & cpu6812
+      && ((code >= 0x30 && code <= 0x39) || (code >= 0x40 && code <= 0xff)))
+    (*info->fprintf_func) (info->stream, "trap\t#%d", code & 0x0ff);
+
+  else if (format == M6811_OP_PAGE2)
+    (*info->fprintf_func) (info->stream, ".byte\t0x%02x, 0x%02x",
+			   M6811_OPCODE_PAGE2, code);
+  else if (format == M6811_OP_PAGE3)
+    (*info->fprintf_func) (info->stream, ".byte\t0x%02x, 0x%02x",
+			   M6811_OPCODE_PAGE3, code);
+  else if (format == M6811_OP_PAGE4)
+    (*info->fprintf_func) (info->stream, ".byte\t0x%02x, 0x%02x",
+			   M6811_OPCODE_PAGE4, code);
+  else
+    (*info->fprintf_func) (info->stream, ".byte\t0x%02x", code);
+
+  return pos;
+}
+
+/* Disassemble one instruction at address 'memaddr'.  Returns the number
+   of bytes used by that instruction.  */
+int
+print_insn_m68hc11 (memaddr, info)
+     bfd_vma memaddr;
+     struct disassemble_info *info;
+{
+  return print_insn (memaddr, info, cpu6811);
+}
+
+int
+print_insn_m68hc12 (memaddr, info)
+     bfd_vma memaddr;
+     struct disassemble_info *info;
+{
+  return print_insn (memaddr, info, cpu6812);
+}
diff --git a/opcodes/m68hc11-opc.c b/opcodes/m68hc11-opc.c
new file mode 100644
index 0000000..1e37971
--- /dev/null
+++ b/opcodes/m68hc11-opc.c
@@ -0,0 +1,1074 @@
+/* m68hc11-opc.c -- Motorola 68HC11 & 68HC12 opcode list
+   Copyright 1999, 2000 Free Software Foundation, Inc.
+   Written by Stephane Carrez (stcarrez@worldnet.fr)
+
+This file is part of GDB, GAS, and the GNU binutils.
+
+GDB, GAS, and the GNU binutils are free software; you can redistribute
+them and/or modify them 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, GAS, and the GNU binutils are distributed in the hope that they
+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 file; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include <stdio.h>
+#include "ansidecl.h"
+#include "opcode/m68hc11.h"
+
+#define TABLE_SIZE(X)       (sizeof(X) / sizeof(X[0]))
+
+/* Combination of CCR flags.  */
+#define M6811_ZC_BIT    M6811_Z_BIT|M6811_C_BIT
+#define M6811_NZ_BIT    M6811_N_BIT|M6811_Z_BIT
+#define M6811_NZV_BIT   M6811_N_BIT|M6811_Z_BIT|M6811_V_BIT
+#define M6811_NZC_BIT   M6811_N_BIT|M6811_Z_BIT|M6811_C_BIT
+#define M6811_NVC_BIT   M6811_N_BIT|M6811_V_BIT|M6811_C_BIT
+#define M6811_ZVC_BIT   M6811_Z_BIT|M6811_V_BIT|M6811_C_BIT
+#define M6811_NZVC_BIT  M6811_ZVC_BIT|M6811_N_BIT
+#define M6811_HNZVC_BIT M6811_NZVC_BIT|M6811_H_BIT
+#define M6811_HNVC_BIT  M6811_NVC_BIT|M6811_H_BIT
+#define M6811_VC_BIT    M6811_V_BIT|M6811_C_BIT
+
+/* Flags when the insn only changes some CCR flags.  */
+#define CHG_NONE        0,0,0
+#define CHG_Z           0,0,M6811_Z_BIT
+#define CHG_C           0,0,M6811_C_BIT
+#define CHG_ZVC         0,0,M6811_ZVC_BIT
+#define CHG_NZC         0,0,M6811_NZC_BIT
+#define CHG_NZV         0,0,M6811_NZV_BIT
+#define CHG_NZVC        0,0,M6811_NZVC_BIT
+#define CHG_HNZVC       0,0,M6811_HNZVC_BIT
+#define CHG_ALL         0,0,0xff
+
+/* The insn clears and changes some flags.  */
+#define CLR_I           0,M6811_I_BIT,0
+#define CLR_C           0,M6811_C_BIT,0
+#define CLR_V           0,M6811_V_BIT,0
+#define CLR_V_CHG_ZC    0,M6811_V_BIT,M6811_ZC_BIT
+#define CLR_V_CHG_NZ    0,M6811_V_BIT,M6811_NZ_BIT
+#define CLR_V_CHG_ZVC   0,M6811_V_BIT,M6811_ZVC_BIT
+#define CLR_N_CHG_ZVC   0,M6811_N_BIT,M6811_ZVC_BIT /* Used by lsr */
+#define CLR_VC_CHG_NZ   0,M6811_VC_BIT,M6811_NZ_BIT
+
+/* The insn sets some flags.  */
+#define SET_I           M6811_I_BIT,0,0
+#define SET_C           M6811_C_BIT,0,0
+#define SET_V           M6811_V_BIT,0,0
+#define SET_Z_CLR_NVC   M6811_Z_BIT,M6811_NVC_BIT,0
+#define SET_C_CLR_V_CHG_NZ M6811_C_BIT,M6811_V_BIT,M6811_NZ_BIT
+#define SET_Z_CHG_HNVC  M6811_Z_BIT,0,M6811_HNVC_BIT
+
+#define _M 0xff
+#define OP_NONE         M6811_OP_NONE
+#define OP_PAGE2        M6811_OP_PAGE2
+#define OP_PAGE3        M6811_OP_PAGE3
+#define OP_PAGE4        M6811_OP_PAGE4
+#define OP_IMM8         M6811_OP_IMM8
+#define OP_IMM16        M6811_OP_IMM16
+#define OP_IX           M6811_OP_IX
+#define OP_IY           M6811_OP_IY
+#define OP_IND16        M6811_OP_IND16
+#define OP_IDX          M6812_OP_IDX
+#define OP_IDX_1        M6812_OP_IDX_1
+#define OP_IDX_2        M6812_OP_IDX_2
+#define OP_D_IDX        M6812_OP_D_IDX
+#define OP_D_IDX_2      M6812_OP_D_IDX_2
+#define OP_DIRECT       M6811_OP_DIRECT
+#define OP_BITMASK      M6811_OP_BITMASK
+#define OP_JUMP_REL     M6811_OP_JUMP_REL
+#define OP_JUMP_REL16   M6812_OP_JUMP_REL16
+#define OP_REG          M6812_OP_REG
+#define OP_REG_1        M6812_OP_REG
+#define OP_REG_2        M6812_OP_REG_2
+#define OP_IDX_p2       M6812_OP_IDX_P2
+#define OP_IND16_p2     M6812_OP_IND16_P2
+#define OP_TRAP_ID      M6812_OP_TRAP_ID
+#define OP_EXG_MARKER   M6812_OP_EXG_MARKER
+#define OP_TFR_MARKER   M6812_OP_TFR_MARKER
+#define OP_DBEQ_MARKER  (M6812_OP_DBCC_MARKER|M6812_OP_EQ_MARKER)
+#define OP_DBNE_MARKER  (M6812_OP_DBCC_MARKER)
+#define OP_TBEQ_MARKER  (M6812_OP_TBCC_MARKER|M6812_OP_EQ_MARKER)
+#define OP_TBNE_MARKER  (M6812_OP_TBCC_MARKER)
+#define OP_IBEQ_MARKER  (M6812_OP_IBCC_MARKER|M6812_OP_EQ_MARKER)
+#define OP_IBNE_MARKER  (M6812_OP_IBCC_MARKER)
+
+/*
+   { "test", OP_NONE,          1, 0x00,  5, _M,  CHG_NONE,  cpu6811 },
+                                                            +-- cpu
+  Name -+                                        +------- Insn CCR changes
+  Format  ------+                            +----------- Max # cycles
+  Size     --------------------+         +--------------- Min # cycles
+                                   +--------------------- Opcode
+*/
+const struct m68hc11_opcode m68hc11_opcodes[] = {
+  { "aba",  OP_NONE,           1, 0x1b,  2,  2,  CHG_HNZVC, cpu6811 },
+  { "aba",  OP_NONE | OP_PAGE2,2, 0x06,  2,  2,  CHG_HNZVC, cpu6812 },
+  { "abx",  OP_NONE,           1, 0x3a,  3,  3,  CHG_NONE,  cpu6811 },
+  { "aby",  OP_NONE | OP_PAGE2,2, 0x3a,  4,  4,  CHG_NONE,  cpu6811 },
+
+  { "adca", OP_IMM8,           2, 0x89,  1,  1,  CHG_HNZVC, cpu6811|cpu6812 },
+  { "adca", OP_DIRECT,         2, 0x99,  3,  3,  CHG_HNZVC, cpu6811|cpu6812 },
+  { "adca", OP_IND16,          3, 0xb9,  3,  3,  CHG_HNZVC, cpu6811|cpu6812 },
+  { "adca", OP_IX,             2, 0xa9,  4,  4,  CHG_HNZVC, cpu6811 },
+  { "adca", OP_IY | OP_PAGE2,  3, 0xa9,  5,  5,  CHG_HNZVC, cpu6811 },
+  { "adca", OP_IDX,            2, 0xa9,  3,  3,  CHG_HNZVC, cpu6812 },
+  { "adca", OP_IDX_1,          3, 0xa9,  3,  3,  CHG_HNZVC, cpu6812 },
+  { "adca", OP_IDX_2,          4, 0xa9,  4,  4,  CHG_HNZVC, cpu6812 },
+  { "adca", OP_D_IDX,          2, 0xa9,  6,  6,  CHG_HNZVC, cpu6812 },
+  { "adca", OP_D_IDX_2,        4, 0xa9,  6,  6,  CHG_HNZVC, cpu6812 },
+
+  { "adcb", OP_IMM8,           2, 0xc9,  1,  1,  CHG_HNZVC, cpu6811|cpu6812 },
+  { "adcb", OP_DIRECT,         2, 0xd9,  3,  3,  CHG_HNZVC, cpu6811|cpu6812 },
+  { "adcb", OP_IND16,          3, 0xf9,  3,  3,  CHG_HNZVC, cpu6811|cpu6812 },
+  { "adcb", OP_IX,             2, 0xe9,  4,  4,  CHG_HNZVC, cpu6811 },
+  { "adcb", OP_IY | OP_PAGE2,  3, 0xe9,  5,  5,  CHG_HNZVC, cpu6811 },
+  { "adcb", OP_IDX,            2, 0xe9,  3,  3,  CHG_HNZVC, cpu6812 },
+  { "adcb", OP_IDX_1,          3, 0xe9,  3,  3,  CHG_HNZVC, cpu6812 },
+  { "adcb", OP_IDX_2,          4, 0xe9,  4,  4,  CHG_HNZVC, cpu6812 },
+  { "adcb", OP_D_IDX,          2, 0xe9,  6,  6,  CHG_HNZVC, cpu6812 },
+  { "adcb", OP_D_IDX_2,        4, 0xe9,  6,  6,  CHG_HNZVC, cpu6812 },
+
+  { "adda", OP_IMM8,           2, 0x8b,  1,  1,  CHG_HNZVC, cpu6811|cpu6812 },
+  { "adda", OP_DIRECT,         2, 0x9b,  3,  3,  CHG_HNZVC, cpu6811|cpu6812 },
+  { "adda", OP_IND16,          3, 0xbb,  3,  3,  CHG_HNZVC, cpu6811|cpu6812 },
+  { "adda", OP_IX,             2, 0xab,  4,  4,  CHG_HNZVC, cpu6811 },
+  { "adda", OP_IY | OP_PAGE2,  3, 0xab,  5,  5,  CHG_HNZVC, cpu6811 },
+  { "adda", OP_IDX,            2, 0xab,  3,  3,  CHG_HNZVC, cpu6812 },
+  { "adda", OP_IDX_1,          3, 0xab,  3,  3,  CHG_HNZVC, cpu6812 },
+  { "adda", OP_IDX_2,          4, 0xab,  4,  4,  CHG_HNZVC, cpu6812 },
+  { "adda", OP_D_IDX,          2, 0xab,  6,  6,  CHG_HNZVC, cpu6812 },
+  { "adda", OP_D_IDX_2,        4, 0xab,  6,  6,  CHG_HNZVC, cpu6812 },
+
+  { "addb", OP_IMM8,           2, 0xcb,  1,  1,  CHG_HNZVC, cpu6811|cpu6812 },
+  { "addb", OP_DIRECT,         2, 0xdb,  3,  3,  CHG_HNZVC, cpu6811|cpu6812 },
+  { "addb", OP_IND16,          3, 0xfb,  3,  3,  CHG_HNZVC, cpu6811|cpu6812 },
+  { "addb", OP_IX,             2, 0xeb,  4,  4,  CHG_HNZVC, cpu6811 },
+  { "addb", OP_IY | OP_PAGE2,  3, 0xeb,  5,  5,  CHG_HNZVC, cpu6811 },
+  { "addb", OP_IDX,            2, 0xeb,  3,  3,  CHG_HNZVC, cpu6812 },
+  { "addb", OP_IDX_1,          3, 0xeb,  3,  3,  CHG_HNZVC, cpu6812 },
+  { "addb", OP_IDX_2,          4, 0xeb,  4,  4,  CHG_HNZVC, cpu6812 },
+  { "addb", OP_D_IDX,          2, 0xeb,  6,  6,  CHG_HNZVC, cpu6812 },
+  { "addb", OP_D_IDX_2,        4, 0xeb,  6,  6,  CHG_HNZVC, cpu6812 },
+
+  { "addd", OP_IMM16,          3, 0xc3,  2,  2,  CHG_NZVC, cpu6811|cpu6812 },
+  { "addd", OP_DIRECT,         2, 0xd3,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "addd", OP_IND16,          3, 0xf3,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "addd", OP_IX,             2, 0xe3,  6,  6,  CHG_NZVC, cpu6811 },
+  { "addd", OP_IY | OP_PAGE2,  3, 0xe3,  7,  7,  CHG_NZVC, cpu6811 },
+  { "addd", OP_IDX,            2, 0xe3,  3,  3,  CHG_NZVC, cpu6812 },
+  { "addd", OP_IDX_1,          3, 0xe3,  3,  3,  CHG_NZVC, cpu6812 },
+  { "addd", OP_IDX_2,          4, 0xe3,  4,  4,  CHG_NZVC, cpu6812 },
+  { "addd", OP_D_IDX,          2, 0xe3,  6,  6,  CHG_NZVC, cpu6812 },
+  { "addd", OP_D_IDX_2,        4, 0xe3,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "anda", OP_IMM8,         2, 0x84,  1,  1,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "anda", OP_DIRECT,       2, 0x94,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "anda", OP_IND16,        3, 0xb4,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "anda", OP_IX,             2, 0xa4,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "anda", OP_IY | OP_PAGE2,  3, 0xa4,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "anda", OP_IDX,            2, 0xa4,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "anda", OP_IDX_1,          3, 0xa4,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "anda", OP_IDX_2,          4, 0xa4,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "anda", OP_D_IDX,          2, 0xa4,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+  { "anda", OP_D_IDX_2,        4, 0xa4,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "andb", OP_IMM8,         2, 0xc4,  1,  1,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "andb", OP_DIRECT,       2, 0xd4,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "andb", OP_IND16,        3, 0xf4,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "andb", OP_IX,             2, 0xe4,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "andb", OP_IY | OP_PAGE2,  3, 0xe4,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "andb", OP_IDX,            2, 0xe4,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "andb", OP_IDX_1,          3, 0xe4,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "andb", OP_IDX_2,          4, 0xe4,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "andb", OP_D_IDX,          2, 0xe4,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+  { "andb", OP_D_IDX_2,        4, 0xe4,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "andcc", OP_IMM8,          2, 0x10,  1,  1,  CHG_ALL,  cpu6812 },
+
+  { "asl",  OP_IND16,          3, 0x78,  4,  4,  CHG_NZVC, cpu6811|cpu6812 },
+  { "asl",  OP_IX,             2, 0x68,  6,  6,  CHG_NZVC, cpu6811 },
+  { "asl",  OP_IY | OP_PAGE2,  3, 0x68,  7,  7,  CHG_NZVC, cpu6811 },
+  { "asl",  OP_IDX,            2, 0x68,  3,  3,  CHG_NZVC, cpu6812 },
+  { "asl",  OP_IDX_1,          3, 0x68,  4,  4,  CHG_NZVC, cpu6812 },
+  { "asl",  OP_IDX_2,          4, 0x68,  5,  5,  CHG_NZVC, cpu6812 },
+  { "asl",  OP_D_IDX,          2, 0x68,  6,  6,  CHG_NZVC, cpu6812 },
+  { "asl",  OP_D_IDX_2,        4, 0x68,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "asla", OP_NONE,           1, 0x48,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+  { "aslb", OP_NONE,           1, 0x58,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+  { "asld", OP_NONE,           1, 0x05,  3,  3,  CHG_NZVC, cpu6811 },
+  { "asld", OP_NONE,           1, 0x59,  1,  1,  CHG_NZVC, cpu6812 },
+
+  { "asr",  OP_IND16,          3, 0x77,  4,  4,  CHG_NZVC, cpu6811|cpu6812 },
+  { "asr",  OP_IX,             2, 0x67,  6,  6,  CHG_NZVC, cpu6811 },
+  { "asr",  OP_IY | OP_PAGE2,  3, 0x67,  7,  7,  CHG_NZVC, cpu6811 },
+  { "asr",  OP_IDX,            2, 0x67,  3,  3,  CHG_NZVC, cpu6812 },
+  { "asr",  OP_IDX_1,          3, 0x67,  4,  4,  CHG_NZVC, cpu6812 },
+  { "asr",  OP_IDX_2,          4, 0x67,  5,  5,  CHG_NZVC, cpu6812 },
+  { "asr",  OP_D_IDX,          2, 0x67,  6,  6,  CHG_NZVC, cpu6812 },
+  { "asr",  OP_D_IDX_2,        4, 0x67,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "asra", OP_NONE,           1, 0x47,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+  { "asrb", OP_NONE,           1, 0x57,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+
+  { "bcc", OP_JUMP_REL,        2, 0x24,  1,  3,  CHG_NONE, cpu6811|cpu6812 },
+
+  { "bclr", OP_BITMASK|OP_DIRECT,  3, 0x15,  6,  6,  CLR_V_CHG_NZ, cpu6811 },
+  { "bclr", OP_BITMASK|OP_IX,       3, 0x1d,  7,  7,  CLR_V_CHG_NZ, cpu6811 },
+  { "bclr", OP_BITMASK|OP_IY|OP_PAGE2, 4, 0x1d, 8, 8, CLR_V_CHG_NZ, cpu6811},
+  { "bclr", OP_BITMASK|OP_DIRECT,   3, 0x4d,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "bclr", OP_BITMASK|OP_IND16,    4, 0x1d,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "bclr", OP_BITMASK|OP_IDX,      3, 0x0d,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "bclr", OP_BITMASK|OP_IDX_1,    4, 0x0d,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "bclr", OP_BITMASK|OP_IDX_2,    5, 0x0d,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "bcs", OP_JUMP_REL,        2, 0x25,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+  { "beq", OP_JUMP_REL,        2, 0x27,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+  { "bge", OP_JUMP_REL,        2, 0x2c,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+
+  { "bgnd", OP_NONE,           1, 0x00,  5,  5, CHG_NONE, cpu6811 | cpu6812 },
+
+  { "bgt", OP_JUMP_REL,        2, 0x2e,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+  { "bhi", OP_JUMP_REL,        2, 0x22,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+  { "bhs", OP_JUMP_REL,        2, 0x24,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+  
+  { "bita", OP_IMM8,          2, 0x85,  1,  1, CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "bita", OP_DIRECT,        2, 0x95,  3,  3, CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "bita", OP_IND16,         3, 0xb5,  3,  3, CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "bita", OP_IX,             2, 0xa5,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "bita", OP_IY | OP_PAGE2,  3, 0xa5,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "bita", OP_IDX,            2, 0xa5,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "bita", OP_IDX_1,          3, 0xa5,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "bita", OP_IDX_2,          4, 0xa5,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "bita", OP_D_IDX,          2, 0xa5,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+  { "bita", OP_D_IDX_2,        4, 0xa5,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "bitb", OP_IMM8,          2, 0xc5,  1,  1, CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "bitb", OP_DIRECT,        2, 0xd5,  3,  3, CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "bitb", OP_IND16,         3, 0xf5,  3,  3, CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "bitb", OP_IX,             2, 0xe5,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "bitb", OP_IY | OP_PAGE2,  3, 0xe5,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "bitb", OP_IDX,            2, 0xe5,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "bitb", OP_IDX_1,          3, 0xe5,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "bitb", OP_IDX_2,          4, 0xe5,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "bitb", OP_D_IDX,          2, 0xe5,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+  { "bitb", OP_D_IDX_2,        4, 0xe5,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "ble", OP_JUMP_REL,        2, 0x2f,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+  { "blo", OP_JUMP_REL,        2, 0x25,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+  { "bls", OP_JUMP_REL,        2, 0x23,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+  { "blt", OP_JUMP_REL,        2, 0x2d,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+  { "bmi", OP_JUMP_REL,        2, 0x2b,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+  { "bne", OP_JUMP_REL,        2, 0x26,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+  { "bpl", OP_JUMP_REL,        2, 0x2a,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+  { "bra", OP_JUMP_REL,        2, 0x20,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+
+  { "brclr", OP_BITMASK | OP_JUMP_REL
+           | OP_DIRECT,         4, 0x13,  6,  6, CHG_NONE, cpu6811 },
+  { "brclr", OP_BITMASK | OP_JUMP_REL
+           | OP_IX,             4, 0x1f,  7,  7, CHG_NONE, cpu6811 },
+  { "brclr", OP_BITMASK | OP_JUMP_REL
+           | OP_IY | OP_PAGE2,  5, 0x1f,  8,  8, CHG_NONE, cpu6811 },
+  { "brclr", OP_BITMASK | OP_JUMP_REL
+           | OP_DIRECT,         4, 0x4f,  4,  4,  CHG_NONE, cpu6812 },
+  { "brclr", OP_BITMASK | OP_JUMP_REL
+           | OP_IND16,          5, 0x1f,  5,  5,  CHG_NONE, cpu6812 },
+  { "brclr", OP_BITMASK | OP_JUMP_REL
+           | OP_IDX,            4, 0x0f,  4,  4,  CHG_NONE, cpu6812 },
+  { "brclr", OP_BITMASK | OP_JUMP_REL
+           | OP_IDX_1,          5, 0x0f,  6,  6,  CHG_NONE, cpu6812 },
+  { "brclr", OP_BITMASK
+           | OP_JUMP_REL
+           | OP_IDX_2,          6, 0x0f,  8,  8,  CHG_NONE, cpu6812 },
+
+  { "brn", OP_JUMP_REL,         2, 0x21,  1,  3,  CHG_NONE, cpu6811|cpu6812 },
+
+  { "brset", OP_BITMASK | OP_JUMP_REL
+           | OP_DIRECT,         4, 0x12,  6,  6,  CHG_NONE, cpu6811 },
+  { "brset", OP_BITMASK
+           | OP_JUMP_REL
+           | OP_IX,             4, 0x1e,  7,  7,  CHG_NONE, cpu6811 },
+  { "brset", OP_BITMASK | OP_JUMP_REL
+           | OP_IY | OP_PAGE2,  5, 0x1e,  8,  8,  CHG_NONE, cpu6811 },
+  { "brset", OP_BITMASK | OP_JUMP_REL
+           | OP_DIRECT,   4, 0x4e,  4,  4,  CHG_NONE, cpu6812 },
+  { "brset", OP_BITMASK | OP_JUMP_REL
+           | OP_IND16,    5, 0x1e,  5,  5,  CHG_NONE, cpu6812 },
+  { "brset", OP_BITMASK | OP_JUMP_REL
+           | OP_IDX,            4, 0x0e,  4,  4,  CHG_NONE, cpu6812 },
+  { "brset", OP_BITMASK | OP_JUMP_REL
+           | OP_IDX_1,          5, 0x0e,  6,  6,  CHG_NONE, cpu6812 },
+  { "brset", OP_BITMASK | OP_JUMP_REL
+           | OP_IDX_2,          6, 0x0e,  8,  8,  CHG_NONE, cpu6812 },
+
+
+  { "bset", OP_BITMASK | OP_DIRECT,   3, 0x14,  6,  6, CLR_V_CHG_NZ, cpu6811 },
+  { "bset", OP_BITMASK | OP_IX,       3, 0x1c,  7,  7, CLR_V_CHG_NZ, cpu6811 },
+  { "bset", OP_BITMASK|OP_IY|OP_PAGE2, 4, 0x1c, 8, 8, CLR_V_CHG_NZ, cpu6811 },
+  { "bset", OP_BITMASK|OP_DIRECT,   3, 0x4c,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "bset", OP_BITMASK|OP_IND16,    4, 0x1c,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "bset", OP_BITMASK|OP_IDX,      3, 0x0c,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "bset", OP_BITMASK|OP_IDX_1,    4, 0x0c,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "bset", OP_BITMASK|OP_IDX_2,    5, 0x0c,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "bsr",  OP_JUMP_REL,       2, 0x8d,  6,  6, CHG_NONE, cpu6811 },
+  { "bsr",  OP_JUMP_REL,       2, 0x07,  4,  4, CHG_NONE, cpu6812 },
+
+  { "bvc",  OP_JUMP_REL,       2, 0x28,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+  { "bvs",  OP_JUMP_REL,       2, 0x29,  1,  3, CHG_NONE, cpu6811 | cpu6812 },
+
+  { "call", OP_IND16,          4, 0x4a,  8,  8,  CHG_NONE, cpu6812 },
+  { "call", OP_IDX,            3, 0x4b,  8,  8,  CHG_NONE, cpu6812 },
+  { "call", OP_IDX_1,          4, 0x4b,  8,  8,  CHG_NONE, cpu6812 },
+  { "call", OP_IDX_2,          5, 0x4b,  9,  9,  CHG_NONE, cpu6812 },
+  { "call", OP_D_IDX,          2, 0x4b, 10, 10,  CHG_NONE, cpu6812 },
+  { "call", OP_D_IDX_2,        4, 0x4b, 10, 10,  CHG_NONE, cpu6812 },
+
+  { "cba",  OP_NONE,           1, 0x11,  2,  2,  CHG_NZVC, cpu6811 },
+  { "cba",  OP_NONE | OP_PAGE2,2, 0x17,  2,  2,  CHG_NZVC, cpu6812 },
+
+  { "clc",  OP_NONE,           1, 0x0c,  2,  2,  CLR_C, cpu6811 },
+  { "cli",  OP_NONE,           1, 0x0e,  2,  2,  CLR_I, cpu6811 },
+
+  { "clr", OP_IND16,           3, 0x7f,  6,  6,  SET_Z_CLR_NVC, cpu6811 },
+  { "clr", OP_IX,              2, 0x6f,  6,  6,  SET_Z_CLR_NVC, cpu6811 },
+  { "clr", OP_IY | OP_PAGE2,   3, 0x6f,  7,  7,  SET_Z_CLR_NVC, cpu6811 },
+  { "clr", OP_IND16,           3, 0x79,  3,  3,  SET_Z_CLR_NVC, cpu6812 },
+  { "clr", OP_IDX,             2, 0x69,  2,  2,  SET_Z_CLR_NVC, cpu6812 },
+  { "clr", OP_IDX_1,           3, 0x69,  3,  3,  SET_Z_CLR_NVC, cpu6812 },
+  { "clr", OP_IDX_2,           4, 0x69,  4,  4,  SET_Z_CLR_NVC, cpu6812 },
+  { "clr", OP_D_IDX,           2, 0x69,  5,  5,  SET_Z_CLR_NVC, cpu6812 },
+  { "clr", OP_D_IDX_2,         4, 0x69,  5,  5,  SET_Z_CLR_NVC, cpu6812 },
+
+  { "clra", OP_NONE,           1, 0x4f,  2,  2,  SET_Z_CLR_NVC, cpu6811 },
+  { "clrb", OP_NONE,           1, 0x5f,  2,  2,  SET_Z_CLR_NVC, cpu6811 },
+  { "clra", OP_NONE,           1, 0x87,  1,  1,  SET_Z_CLR_NVC, cpu6812 },
+  { "clrb", OP_NONE,           1, 0xc7,  1,  1,  SET_Z_CLR_NVC, cpu6812 },
+
+  { "clv",  OP_NONE,           1, 0x0a,  2,  2,  CLR_V, cpu6811 },
+
+  { "cmpa", OP_IMM8,           2, 0x81,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+  { "cmpa", OP_DIRECT,         2, 0x91,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "cmpa", OP_IND16,          3, 0xb1,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "cmpa", OP_IX,             2, 0xa1,  4,  4,  CHG_NZVC, cpu6811 },
+  { "cmpa", OP_IY | OP_PAGE2,  3, 0xa1,  5,  5,  CHG_NZVC, cpu6811 },
+  { "cmpa", OP_IDX,            2, 0xa1,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cmpa", OP_IDX_1,          3, 0xa1,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cmpa", OP_IDX_2,          4, 0xa1,  4,  4,  CHG_NZVC, cpu6812 },
+  { "cmpa", OP_D_IDX,          2, 0xa1,  6,  6,  CHG_NZVC, cpu6812 },
+  { "cmpa", OP_D_IDX_2,        4, 0xa1,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "cmpb", OP_IMM8,           2, 0xc1,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+  { "cmpb", OP_DIRECT,         2, 0xd1,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "cmpb", OP_IND16,          3, 0xf1,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "cmpb", OP_IX,             2, 0xe1,  4,  4,  CHG_NZVC, cpu6811 },
+  { "cmpb", OP_IY | OP_PAGE2,  3, 0xe1,  5,  5,  CHG_NZVC, cpu6811 },
+  { "cmpb", OP_IDX,            2, 0xe1,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cmpb", OP_IDX_1,          3, 0xe1,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cmpb", OP_IDX_2,          4, 0xe1,  4,  4,  CHG_NZVC, cpu6812 },
+  { "cmpb", OP_D_IDX,          2, 0xe1,  6,  6,  CHG_NZVC, cpu6812 },
+  { "cmpb", OP_D_IDX_2,        4, 0xe1,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "com", OP_IND16,           3, 0x73,  6,  6,  SET_C_CLR_V_CHG_NZ, cpu6811 },
+  { "com", OP_IX,              2, 0x63,  6,  6,  SET_C_CLR_V_CHG_NZ, cpu6811 },
+  { "com", OP_IY | OP_PAGE2,   3, 0x63,  7,  7,  SET_C_CLR_V_CHG_NZ, cpu6811 },
+  { "com", OP_IND16,           3, 0x71,  4,  4,  SET_C_CLR_V_CHG_NZ, cpu6812 },
+  { "com", OP_IDX,             2, 0x61,  3,  3,  SET_C_CLR_V_CHG_NZ, cpu6812 },
+  { "com", OP_IDX_1,           3, 0x61,  4,  4,  SET_C_CLR_V_CHG_NZ, cpu6812 },
+  { "com", OP_IDX_2,           4, 0x61,  5,  5,  SET_C_CLR_V_CHG_NZ, cpu6812 },
+  { "com", OP_D_IDX,           2, 0x61,  6,  6,  SET_C_CLR_V_CHG_NZ, cpu6812 },
+  { "com", OP_D_IDX_2,         4, 0x61,  6,  6,  SET_C_CLR_V_CHG_NZ, cpu6812 },
+
+  { "coma", OP_NONE,           1, 0x43,  2,  2,  SET_C_CLR_V_CHG_NZ, cpu6811 },
+  { "coma", OP_NONE,           1, 0x41,  1,  1,  SET_C_CLR_V_CHG_NZ, cpu6812 },
+  { "comb", OP_NONE,           1, 0x53,  2,  2,  SET_C_CLR_V_CHG_NZ, cpu6811 },
+  { "comb", OP_NONE,           1, 0x51,  1,  1,  SET_C_CLR_V_CHG_NZ, cpu6812 },
+
+  { "cpd", OP_IMM16 | OP_PAGE3,  4, 0x83,  5,  5,  CHG_NZVC, cpu6811 },
+  { "cpd", OP_DIRECT | OP_PAGE3, 3, 0x93,  6,  6,  CHG_NZVC, cpu6811 },
+  { "cpd", OP_IND16 | OP_PAGE3,  4, 0xb3,  7,  7,  CHG_NZVC, cpu6811 },
+  { "cpd", OP_IX | OP_PAGE3,     3, 0xa3,  7,  7,  CHG_NZVC, cpu6811 },
+  { "cpd", OP_IY | OP_PAGE4,     3, 0xa3,  7,  7,  CHG_NZVC, cpu6811 },
+  { "cpd", OP_IMM16,             3, 0x8c,  2,  2,  CHG_NZVC, cpu6812 },
+  { "cpd", OP_DIRECT,            2, 0x9c,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cpd", OP_IND16,             3, 0xbc,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cpd", OP_IDX,               2, 0xac,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cpd", OP_IDX_1,             3, 0xac,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cpd", OP_IDX_2,             4, 0xac,  4,  4,  CHG_NZVC, cpu6812 },
+  { "cpd", OP_D_IDX,             2, 0xac,  6,  6,  CHG_NZVC, cpu6812 },
+  { "cpd", OP_D_IDX_2,           4, 0xac,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "cps", OP_IMM16,             3, 0x8f,  2,  2,  CHG_NZVC, cpu6812 },
+  { "cps", OP_DIRECT,            2, 0x9f,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cps", OP_IND16,             3, 0xbf,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cps", OP_IDX,               2, 0xaf,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cps", OP_IDX_1,             3, 0xaf,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cps", OP_IDX_2,             4, 0xaf,  4,  4,  CHG_NZVC, cpu6812 },
+  { "cps", OP_D_IDX,             2, 0xaf,  6,  6,  CHG_NZVC, cpu6812 },
+  { "cps", OP_D_IDX_2,           4, 0xaf,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "cpx", OP_IMM16,             3, 0x8c,  4,  4,  CHG_NZVC, cpu6811 },
+  { "cpx", OP_DIRECT,            2, 0x9c,  5,  5,  CHG_NZVC, cpu6811 },
+  { "cpx", OP_IND16,             3, 0xbc,  5,  5,  CHG_NZVC, cpu6811 },
+  { "cpx", OP_IX,                2, 0xac,  6,  6,  CHG_NZVC, cpu6811 },
+  { "cpx", OP_IY | OP_PAGE4,     3, 0xac,  7,  7,  CHG_NZVC, cpu6811 },
+  { "cpx", OP_IMM16,             3, 0x8e,  2,  2,  CHG_NZVC, cpu6812 },
+  { "cpx", OP_DIRECT,            2, 0x9e,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cpx", OP_IND16,             3, 0xbe,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cpx", OP_IDX,               2, 0xae,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cpx", OP_IDX_1,             3, 0xae,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cpx", OP_IDX_2,             4, 0xae,  4,  4,  CHG_NZVC, cpu6812 },
+  { "cpx", OP_D_IDX,             2, 0xae,  6,  6,  CHG_NZVC, cpu6812 },
+  { "cpx", OP_D_IDX_2,           4, 0xae,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "cpy", OP_PAGE2 | OP_IMM16,  4, 0x8c,  5,  5,  CHG_NZVC, cpu6811 },
+  { "cpy", OP_PAGE2 | OP_DIRECT, 3, 0x9c,  6,  6,  CHG_NZVC, cpu6811 },
+  { "cpy", OP_PAGE2 | OP_IY,     3, 0xac,  7,  7,  CHG_NZVC, cpu6811 },
+  { "cpy", OP_PAGE2 | OP_IND16,  4, 0xbc,  7,  7,  CHG_NZVC, cpu6811 },
+  { "cpy", OP_PAGE3 | OP_IX,     3, 0xac,  7,  7,  CHG_NZVC, cpu6811 },
+  { "cpy", OP_IMM16,             3, 0x8d,  2,  2,  CHG_NZVC, cpu6812 },
+  { "cpy", OP_DIRECT,            2, 0x9d,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cpy", OP_IND16,             3, 0xbd,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cpy", OP_IDX,               2, 0xad,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cpy", OP_IDX_1,             3, 0xad,  3,  3,  CHG_NZVC, cpu6812 },
+  { "cpy", OP_IDX_2,             4, 0xad,  4,  4,  CHG_NZVC, cpu6812 },
+  { "cpy", OP_D_IDX,             2, 0xad,  6,  6,  CHG_NZVC, cpu6812 },
+  { "cpy", OP_D_IDX_2,           4, 0xad,  6,  6,  CHG_NZVC, cpu6812 },
+
+  /* After 'daa', the Z flag is undefined. Mark it as changed.  */
+  { "daa", OP_NONE,              1, 0x19,  2,  2,  CHG_NZVC, cpu6811 },
+  { "daa", OP_NONE | OP_PAGE2,  2, 0x07,  3,  3,  CHG_NZVC, cpu6812 },
+
+  { "dbeq", OP_DBEQ_MARKER
+          | OP_REG | OP_JUMP_REL,3, 0x04,  3,  3, CHG_NONE, cpu6812 },
+  { "dbne", OP_DBNE_MARKER
+          | OP_REG | OP_JUMP_REL,3, 0x04,  3,  3, CHG_NONE, cpu6812 },
+
+  { "dec", OP_IX,                2, 0x6a,  6,  6,  CHG_NZV, cpu6811 },
+  { "dec", OP_IND16,             3, 0x7a,  6,  6,  CHG_NZV, cpu6811 },
+  { "dec", OP_IY | OP_PAGE2,     3, 0x6a,  7,  7,  CHG_NZV, cpu6811 },
+  { "dec", OP_IND16,             3, 0x73,  4,  4,  CHG_NZV, cpu6812 },
+  { "dec", OP_IDX,               2, 0x63,  3,  3,  CHG_NZV, cpu6812 },
+  { "dec", OP_IDX_1,             3, 0x63,  4,  4,  CHG_NZV, cpu6812 },
+  { "dec", OP_IDX_2,             4, 0x63,  5,  5,  CHG_NZV, cpu6812 },
+  { "dec", OP_D_IDX,             2, 0x63,  6,  6,  CHG_NZV, cpu6812 },
+  { "dec", OP_D_IDX_2,           4, 0x63,  6,  6,  CHG_NZV, cpu6812 },
+
+  { "des",  OP_NONE,             1, 0x34,  3,  3,  CHG_NONE, cpu6811 },
+
+  { "deca", OP_NONE,             1, 0x4a,  2,  2,  CHG_NZV, cpu6811 },
+  { "deca", OP_NONE,             1, 0x43,  1,  1,  CHG_NZV, cpu6812 },
+  { "decb", OP_NONE,             1, 0x5a,  2,  2,  CHG_NZV, cpu6811 },
+  { "decb", OP_NONE,             1, 0x53,  1,  1,  CHG_NZV, cpu6812 },
+
+  { "dex",  OP_NONE,             1, 0x09,  1,  1,  CHG_Z, cpu6812|cpu6811 },
+  { "dey",  OP_NONE | OP_PAGE2,  2, 0x09,  4,  4,  CHG_Z, cpu6811 },
+  { "dey",  OP_NONE,             1, 0x03,  1,  1,  CHG_Z, cpu6812 },
+
+  { "ediv", OP_NONE,             1, 0x11,  11,  11,  CHG_NZVC, cpu6812 },
+  { "edivs", OP_NONE | OP_PAGE2, 2, 0x14,  12,  12,  CHG_NZVC, cpu6812 },
+  { "emacs", OP_IND16 | OP_PAGE2, 4, 0x12,  13,  13,  CHG_NZVC, cpu6812 },
+
+  { "emaxd", OP_IDX | OP_PAGE2,     3, 0x1a,  4,  4,  CHG_NZVC, cpu6812 },
+  { "emaxd", OP_IDX_1 | OP_PAGE2,   4, 0x1a,  4,  4,  CHG_NZVC, cpu6812 },
+  { "emaxd", OP_IDX_2 | OP_PAGE2,   5, 0x1a,  5,  5,  CHG_NZVC, cpu6812 },
+  { "emaxd", OP_D_IDX | OP_PAGE2,   3, 0x1a,  7,  7,  CHG_NZVC, cpu6812 },
+  { "emaxd", OP_D_IDX_2 | OP_PAGE2, 5, 0x1a,  7,  7,  CHG_NZVC, cpu6812 },
+
+  { "emaxm", OP_IDX | OP_PAGE2,     3, 0x1e,  4,  4,  CHG_NZVC, cpu6812 },
+  { "emaxm", OP_IDX_1 | OP_PAGE2,   4, 0x1e,  5,  5,  CHG_NZVC, cpu6812 },
+  { "emaxm", OP_IDX_2 | OP_PAGE2,   5, 0x1e,  6,  6,  CHG_NZVC, cpu6812 },
+  { "emaxm", OP_D_IDX | OP_PAGE2,   3, 0x1e,  7,  7,  CHG_NZVC, cpu6812 },
+  { "emaxm", OP_D_IDX_2 | OP_PAGE2, 5, 0x1e,  7,  7,  CHG_NZVC, cpu6812 },
+
+  { "emind", OP_IDX | OP_PAGE2,     3, 0x1b,  4,  4,  CHG_NZVC, cpu6812 },
+  { "emind", OP_IDX_1 | OP_PAGE2,   4, 0x1b,  4,  4,  CHG_NZVC, cpu6812 },
+  { "emind", OP_IDX_2 | OP_PAGE2,   5, 0x1b,  5,  5,  CHG_NZVC, cpu6812 },
+  { "emind", OP_D_IDX | OP_PAGE2,   3, 0x1b,  7,  7,  CHG_NZVC, cpu6812 },
+  { "emind", OP_D_IDX_2 | OP_PAGE2, 5, 0x1b,  7,  7,  CHG_NZVC, cpu6812 },
+
+  { "eminm", OP_IDX | OP_PAGE2,     3, 0x1f,  4,  4,  CHG_NZVC, cpu6812 },
+  { "eminm", OP_IDX_1 | OP_PAGE2,   4, 0x1f,  5,  5,  CHG_NZVC, cpu6812 },
+  { "eminm", OP_IDX_2 | OP_PAGE2,   5, 0x1f,  6,  6,  CHG_NZVC, cpu6812 },
+  { "eminm", OP_D_IDX | OP_PAGE2,   3, 0x1f,  7,  7,  CHG_NZVC, cpu6812 },
+  { "eminm", OP_D_IDX_2 | OP_PAGE2, 5, 0x1f,  7,  7,  CHG_NZVC, cpu6812 },
+
+  { "emul",  OP_NONE,               1, 0x13,  3,  3,  CHG_NZC, cpu6812 },
+  { "emuls", OP_NONE | OP_PAGE2,    2, 0x13,  3,  3,  CHG_NZC, cpu6812 },
+
+  { "eora", OP_IMM8,         2, 0x88,  1,  1,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "eora", OP_DIRECT,       2, 0x98,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "eora", OP_IND16,        3, 0xb8,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "eora", OP_IX,             2, 0xa8,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "eora", OP_IY | OP_PAGE2,  3, 0xa8,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "eora", OP_IDX,            2, 0xa8,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "eora", OP_IDX_1,          3, 0xa8,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "eora", OP_IDX_2,          4, 0xa8,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "eora", OP_D_IDX,          2, 0xa8,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+  { "eora", OP_D_IDX_2,        4, 0xa8,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "eorb", OP_IMM8,         2, 0xc8,  1,  1,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "eorb", OP_DIRECT,       2, 0xd8,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "eorb", OP_IND16,        3, 0xf8,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "eorb", OP_IX,             2, 0xe8,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "eorb", OP_IY | OP_PAGE2,  3, 0xe8,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "eorb", OP_IDX,            2, 0xe8,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "eorb", OP_IDX_1,          3, 0xe8,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "eorb", OP_IDX_2,          4, 0xe8,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "eorb", OP_D_IDX,          2, 0xe8,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+  { "eorb", OP_D_IDX_2,        4, 0xe8,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "etbl", OP_IDX | OP_PAGE2,3, 0x3f, 10, 10,  CHG_NZC, cpu6812 },
+
+  { "exg",  OP_EXG_MARKER
+          | OP_REG | OP_REG_2, 2, 0xb7, 1, 1,  CHG_NONE, cpu6812 },
+
+  { "fdiv", OP_NONE,             1, 0x03,  3, 41, CHG_ZVC, cpu6811},
+  { "fdiv", OP_NONE | OP_PAGE2, 2, 0x11, 12, 12, CHG_ZVC, cpu6812 },
+
+  { "ibeq", OP_IBEQ_MARKER
+          | OP_REG | OP_JUMP_REL,  3, 0x04,  3,  3, CHG_NONE, cpu6812 },
+  { "ibne", OP_IBNE_MARKER
+          | OP_REG | OP_JUMP_REL,  3, 0x04,  3,  3, CHG_NONE, cpu6812 },
+
+  { "idiv",  OP_NONE,              1, 0x02,  3, 41, CLR_V_CHG_ZC, cpu6811},
+  { "idiv",  OP_NONE | OP_PAGE2,  2, 0x10, 12, 12, CLR_V_CHG_ZC, cpu6812 },
+  { "idivs", OP_NONE | OP_PAGE2,  2, 0x15, 12, 12, CHG_NZVC, cpu6812 },
+
+  { "inc", OP_IX,                  2, 0x6c,  6,  6,  CHG_NZV, cpu6811 },
+  { "inc", OP_IND16,               3, 0x7c,  6,  6,  CHG_NZV, cpu6811 },
+  { "inc", OP_IY | OP_PAGE2,       3, 0x6c,  7,  7,  CHG_NZV, cpu6811 },
+  { "inc", OP_IND16,               3, 0x72,  4,  4,  CHG_NZV, cpu6812 },
+  { "inc", OP_IDX,                 2, 0x62,  3,  3,  CHG_NZV, cpu6812 },
+  { "inc", OP_IDX_1,               3, 0x62,  4,  4,  CHG_NZV, cpu6812 },
+  { "inc", OP_IDX_2,               4, 0x62,  5,  5,  CHG_NZV, cpu6812 },
+  { "inc", OP_D_IDX,               2, 0x62,  6,  6,  CHG_NZV, cpu6812 },
+  { "inc", OP_D_IDX_2,             4, 0x62,  6,  6,  CHG_NZV, cpu6812 },
+
+  { "inca", OP_NONE,               1, 0x4c,  2,  2,  CHG_NZV, cpu6811 },
+  { "inca", OP_NONE,               1, 0x42,  1,  1,  CHG_NZV, cpu6812 },
+  { "incb", OP_NONE,               1, 0x5c,  2,  2,  CHG_NZV, cpu6811 },
+  { "incb", OP_NONE,               1, 0x52,  1,  1,  CHG_NZV, cpu6812 },
+
+  { "ins",  OP_NONE,               1, 0x31,  3,  3,  CHG_NONE, cpu6811 },
+
+  { "inx",  OP_NONE,               1, 0x08,  1,  1,  CHG_Z, cpu6811|cpu6812 },
+  { "iny",  OP_NONE |OP_PAGE2,     2, 0x08,  4,  4,  CHG_Z, cpu6811 },
+  { "iny",  OP_NONE,               1, 0x02,  1,  1,  CHG_Z, cpu6812 },
+
+  { "jmp",  OP_IND16,              3, 0x7e,  3,  3,  CHG_NONE, cpu6811 },
+  { "jmp",  OP_IX,                 2, 0x6e,  3,  3,  CHG_NONE, cpu6811 },
+  { "jmp",  OP_IY | OP_PAGE2,      3, 0x6e,  4,  4,  CHG_NONE, cpu6811 },
+  { "jmp",  OP_IND16,              3, 0x06,  3,  3,  CHG_NONE, cpu6812 },
+  { "jmp",  OP_IDX,                2, 0x05,  3,  3,  CHG_NONE, cpu6812 },
+  { "jmp",  OP_IDX_1,              3, 0x05,  3,  3,  CHG_NONE, cpu6812 },
+  { "jmp",  OP_IDX_2,              4, 0x05,  4,  4,  CHG_NONE, cpu6812 },
+  { "jmp",  OP_D_IDX,              2, 0x05,  6,  6,  CHG_NONE, cpu6812 },
+  { "jmp",  OP_D_IDX_2,            4, 0x05,  6,  6,  CHG_NONE, cpu6812 },
+
+  { "jsr",  OP_DIRECT,             2, 0x9d,  5,  5,  CHG_NONE, cpu6811 },
+  { "jsr",  OP_IND16,              3, 0xbd,  6,  6,  CHG_NONE, cpu6811 },
+  { "jsr",  OP_IX,                 2, 0xad,  6,  6,  CHG_NONE, cpu6811 },
+  { "jsr",  OP_IY | OP_PAGE2,      3, 0xad,  6,  6,  CHG_NONE, cpu6811 },
+  { "jsr",  OP_DIRECT,             2, 0x17,  4,  4,  CHG_NONE, cpu6812 },
+  { "jsr",  OP_IND16,              3, 0x16,  4,  3,  CHG_NONE, cpu6812 },
+  { "jsr",  OP_IDX,                2, 0x15,  4,  4,  CHG_NONE, cpu6812 },
+  { "jsr",  OP_IDX_1,              3, 0x15,  4,  4,  CHG_NONE, cpu6812 },
+  { "jsr",  OP_IDX_2,              4, 0x15,  5,  5,  CHG_NONE, cpu6812 },
+  { "jsr",  OP_D_IDX,              2, 0x15,  7,  7,  CHG_NONE, cpu6812 },
+  { "jsr",  OP_D_IDX_2,            4, 0x15,  7,  7,  CHG_NONE, cpu6812 },
+
+  { "lbcc", OP_JUMP_REL16 | OP_PAGE2,  4, 0x24,  3,  4, CHG_NONE, cpu6812 },
+  { "lbcs", OP_JUMP_REL16 | OP_PAGE2,  4, 0x25,  3,  4, CHG_NONE, cpu6812 },
+  { "lbeq", OP_JUMP_REL16 | OP_PAGE2,  4, 0x27,  3,  4, CHG_NONE, cpu6812 },
+  { "lbge", OP_JUMP_REL16 | OP_PAGE2,  4, 0x2c,  3,  4, CHG_NONE, cpu6812 },
+  { "lbgt", OP_JUMP_REL16 | OP_PAGE2,  4, 0x2e,  3,  4, CHG_NONE, cpu6812 },
+  { "lbhi", OP_JUMP_REL16 | OP_PAGE2,  4, 0x22,  3,  4, CHG_NONE, cpu6812 },
+  { "lbhs", OP_JUMP_REL16 | OP_PAGE2,  4, 0x24,  3,  4, CHG_NONE, cpu6812 },
+  { "lble", OP_JUMP_REL16 | OP_PAGE2,  4, 0x2f,  3,  4, CHG_NONE, cpu6812 },
+  { "lblo", OP_JUMP_REL16 | OP_PAGE2,  4, 0x25,  3,  4, CHG_NONE, cpu6812 },
+  { "lbls", OP_JUMP_REL16 | OP_PAGE2,  4, 0x23,  3,  4, CHG_NONE, cpu6812 },
+  { "lblt", OP_JUMP_REL16 | OP_PAGE2,  4, 0x2d,  3,  4, CHG_NONE, cpu6812 },
+  { "lbmi", OP_JUMP_REL16 | OP_PAGE2,  4, 0x2b,  3,  4, CHG_NONE, cpu6812 },
+  { "lbne", OP_JUMP_REL16 | OP_PAGE2,  4, 0x26,  3,  4, CHG_NONE, cpu6812 },
+  { "lbpl", OP_JUMP_REL16 | OP_PAGE2,  4, 0x2a,  3,  4, CHG_NONE, cpu6812 },
+  { "lbra", OP_JUMP_REL16 | OP_PAGE2,  4, 0x20,  4,  4, CHG_NONE, cpu6812 },
+  { "lbrn", OP_JUMP_REL16 | OP_PAGE2,  4, 0x21,  3,  3, CHG_NONE, cpu6812 },
+  { "lbvc", OP_JUMP_REL16 | OP_PAGE2,  4, 0x28,  3,  4, CHG_NONE, cpu6812 },
+  { "lbvs", OP_JUMP_REL16 | OP_PAGE2,  4, 0x29,  3,  4, CHG_NONE, cpu6812 },
+
+  { "ldaa", OP_IMM8,         2, 0x86,  1,  1,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "ldaa", OP_DIRECT,       2, 0x96,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "ldaa", OP_IND16,        3, 0xb6,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "ldaa", OP_IX,             2, 0xa6,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "ldaa", OP_IY | OP_PAGE2,  3, 0xa6,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "ldaa", OP_IDX,            2, 0xa6,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldaa", OP_IDX_1,          3, 0xa6,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldaa", OP_IDX_2,          4, 0xa6,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldaa", OP_D_IDX,          2, 0xa6,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldaa", OP_D_IDX_2,        4, 0xa6,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "ldab", OP_IMM8,         2, 0xc6,  1,  1,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "ldab", OP_DIRECT,       2, 0xd6,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "ldab", OP_IND16,        3, 0xf6,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "ldab", OP_IX,             2, 0xe6,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "ldab", OP_IY | OP_PAGE2,  3, 0xe6,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "ldab", OP_IDX,            2, 0xe6,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldab", OP_IDX_1,          3, 0xe6,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldab", OP_IDX_2,          4, 0xe6,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldab", OP_D_IDX,          2, 0xe6,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldab", OP_D_IDX_2,        4, 0xe6,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "ldd", OP_IMM16,         3, 0xcc,  2,  2,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "ldd", OP_DIRECT,        2, 0xdc,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "ldd", OP_IND16,         3, 0xfc,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "ldd", OP_IX,              2, 0xec,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "ldd", OP_IY | OP_PAGE2,   3, 0xec,  6,  6,  CLR_V_CHG_NZ, cpu6811 },
+  { "ldd", OP_IDX,             2, 0xec,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldd", OP_IDX_1,           3, 0xec,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldd", OP_IDX_2,           4, 0xec,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldd", OP_D_IDX,           2, 0xec,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldd", OP_D_IDX_2,         4, 0xec,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "lds",  OP_IMM16,          3, 0x8e,  3,  3,  CLR_V_CHG_NZ, cpu6811 },
+  { "lds",  OP_DIRECT,         2, 0x9e,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "lds",  OP_IND16,          3, 0xbe,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "lds",  OP_IX,             2, 0xae,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "lds",  OP_IY | OP_PAGE2,  3, 0xae,  6,  6,  CLR_V_CHG_NZ, cpu6811 },
+  { "lds",  OP_IMM16,          3, 0xcf,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+  { "lds",  OP_DIRECT,         2, 0xdf,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "lds",  OP_IND16,          3, 0xff,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "lds",  OP_IDX,            2, 0xef,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "lds",  OP_IDX_1,          3, 0xef,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "lds",  OP_IDX_2,          4, 0xef,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "lds",  OP_D_IDX,          2, 0xef,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+  { "lds",  OP_D_IDX_2,        4, 0xef,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "ldx",  OP_IMM16,        3, 0xce,  2,  2,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "ldx",  OP_DIRECT,       2, 0xde,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "ldx",  OP_IND16,        3, 0xfe,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "ldx",  OP_IX,             2, 0xee,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "ldx",  OP_IY | OP_PAGE4,  3, 0xee,  6,  6,  CLR_V_CHG_NZ, cpu6811 },
+  { "ldx",  OP_IDX,            2, 0xee,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldx",  OP_IDX_1,          3, 0xee,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldx",  OP_IDX_2,          4, 0xee,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldx",  OP_D_IDX,          2, 0xee,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldx",  OP_D_IDX_2,        4, 0xee,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "ldy",  OP_IMM16 | OP_PAGE2,  4, 0xce, 4, 4, CLR_V_CHG_NZ, cpu6811 },
+  { "ldy",  OP_DIRECT | OP_PAGE2, 3, 0xde, 5, 5, CLR_V_CHG_NZ, cpu6811 },
+  { "ldy",  OP_IND16 | OP_PAGE2,  4, 0xfe, 6, 6, CLR_V_CHG_NZ, cpu6811 },
+  { "ldy",  OP_IX | OP_PAGE3,     3, 0xee, 6, 6, CLR_V_CHG_NZ, cpu6811 },
+  { "ldy",  OP_IY | OP_PAGE2,     3, 0xee, 6, 6, CLR_V_CHG_NZ, cpu6811 },
+  { "ldy",  OP_IMM16,          3, 0xcd,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldy",  OP_DIRECT,         2, 0xdd,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldy",  OP_IND16,          3, 0xfd,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldy",  OP_IDX,            2, 0xed,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldy",  OP_IDX_1,          3, 0xed,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldy",  OP_IDX_2,          4, 0xed,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldy",  OP_D_IDX,          2, 0xed,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+  { "ldy",  OP_D_IDX_2,        4, 0xed,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "leas", OP_IDX,            2, 0x1b,  2,  2,  CHG_NONE, cpu6812 },
+  { "leas", OP_IDX_1,          3, 0x1b,  2,  2,  CHG_NONE, cpu6812 },
+  { "leas", OP_IDX_2,          4, 0x1b,  2,  2,  CHG_NONE, cpu6812 },
+
+  { "leax", OP_IDX,            2, 0x1a,  2,  2,  CHG_NONE, cpu6812 },
+  { "leax", OP_IDX_1,          3, 0x1a,  2,  2,  CHG_NONE, cpu6812 },
+  { "leax", OP_IDX_2,          4, 0x1a,  2,  2,  CHG_NONE, cpu6812 },
+
+  { "leay", OP_IDX,            2, 0x19,  2,  2,  CHG_NONE, cpu6812 },
+  { "leay", OP_IDX_1,          3, 0x19,  2,  2,  CHG_NONE, cpu6812 },
+  { "leay", OP_IDX_2,          4, 0x19,  2,  2,  CHG_NONE, cpu6812 },
+
+  { "lsl",  OP_IND16,          3, 0x78,  4,  4,  CHG_NZVC, cpu6811|cpu6812 },
+  { "lsl",  OP_IX,             2, 0x68,  6,  6,  CHG_NZVC, cpu6811 },
+  { "lsl",  OP_IY | OP_PAGE2,  3, 0x68,  7,  7,  CHG_NZVC, cpu6811 },
+  { "lsl",  OP_IDX,            2, 0x68,  3,  3,  CHG_NZVC, cpu6812 },
+  { "lsl",  OP_IDX_1,          3, 0x68,  4,  4,  CHG_NZVC, cpu6812 },
+  { "lsl",  OP_IDX_2,          4, 0x68,  5,  5,  CHG_NZVC, cpu6812 },
+  { "lsl",  OP_D_IDX,          2, 0x68,  6,  6,  CHG_NZVC, cpu6812 },
+  { "lsl",  OP_D_IDX_2,        4, 0x68,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "lsla", OP_NONE,           1, 0x48,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+  { "lslb", OP_NONE,           1, 0x58,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+  { "lsld", OP_NONE,           1, 0x05,  3,  3,  CHG_NZVC, cpu6811 },
+  { "lsld", OP_NONE,           1, 0x59,  1,  1,  CHG_NZVC, cpu6812 },
+
+  { "lsr",  OP_IND16,        3, 0x74,  4,  4,  CLR_N_CHG_ZVC, cpu6811|cpu6812},
+  { "lsr",  OP_IX,             2, 0x64,  6,  6,  CLR_N_CHG_ZVC, cpu6811 },
+  { "lsr",  OP_IY | OP_PAGE2,  3, 0x64,  7,  7,  CLR_V_CHG_ZVC, cpu6811 },
+  { "lsr",  OP_IDX,            2, 0x64,  3,  3,  CLR_N_CHG_ZVC, cpu6812 },
+  { "lsr",  OP_IDX_1,          3, 0x64,  4,  4,  CLR_N_CHG_ZVC, cpu6812 },
+  { "lsr",  OP_IDX_2,          4, 0x64,  5,  5,  CLR_N_CHG_ZVC, cpu6812 },
+  { "lsr",  OP_D_IDX,          2, 0x64,  6,  6,  CLR_N_CHG_ZVC, cpu6812 },
+  { "lsr",  OP_D_IDX_2,        4, 0x64,  6,  6,  CLR_N_CHG_ZVC, cpu6812 },
+
+  { "lsra", OP_NONE,         1, 0x44,  1,  1,  CLR_N_CHG_ZVC, cpu6811|cpu6812},
+  { "lsrb", OP_NONE,         1, 0x54,  1,  1,  CLR_N_CHG_ZVC, cpu6811|cpu6812},
+  { "lsrd", OP_NONE,           1, 0x04,  3,  3,  CLR_N_CHG_ZVC, cpu6811 },
+  { "lsrd", OP_NONE,           1, 0x49,  1,  1,  CLR_N_CHG_ZVC, cpu6812 },
+
+  { "maxa", OP_IDX | OP_PAGE2,     3, 0x18,  4,  4,  CHG_NZVC, cpu6812 },
+  { "maxa", OP_IDX_1 | OP_PAGE2,   4, 0x18,  4,  4,  CHG_NZVC, cpu6812 },
+  { "maxa", OP_IDX_2 | OP_PAGE2,   5, 0x18,  5,  5,  CHG_NZVC, cpu6812 },
+  { "maxa", OP_D_IDX | OP_PAGE2,   3, 0x18,  7,  7,  CHG_NZVC, cpu6812 },
+  { "maxa", OP_D_IDX_2 | OP_PAGE2, 5, 0x18,  7,  7,  CHG_NZVC, cpu6812 },
+
+  { "maxm", OP_IDX | OP_PAGE2,     3, 0x1c,  4,  4,  CHG_NZVC, cpu6812 },
+  { "maxm", OP_IDX_1 | OP_PAGE2,   4, 0x1c,  5,  5,  CHG_NZVC, cpu6812 },
+  { "maxm", OP_IDX_2 | OP_PAGE2,   5, 0x1c,  6,  6,  CHG_NZVC, cpu6812 },
+  { "maxm", OP_D_IDX | OP_PAGE2,   3, 0x1c,  7,  7,  CHG_NZVC, cpu6812 },
+  { "maxm", OP_D_IDX_2 | OP_PAGE2, 5, 0x1c,  7,  7,  CHG_NZVC, cpu6812 },
+
+  { "mem",  OP_NONE,                1, 0x01,  5,  5,  CHG_HNZVC, cpu6812 },
+
+  { "mina", OP_IDX | OP_PAGE2,     3, 0x19,  4,  4,  CHG_NZVC, cpu6812 },
+  { "mina", OP_IDX_1 | OP_PAGE2,   4, 0x19,  4,  4,  CHG_NZVC, cpu6812 },
+  { "mina", OP_IDX_2 | OP_PAGE2,   5, 0x19,  5,  5,  CHG_NZVC, cpu6812 },
+  { "mina", OP_D_IDX | OP_PAGE2,   3, 0x19,  7,  7,  CHG_NZVC, cpu6812 },
+  { "mina", OP_D_IDX_2 | OP_PAGE2, 5, 0x19,  7,  7,  CHG_NZVC, cpu6812 },
+
+  { "minm", OP_IDX | OP_PAGE2,     3, 0x1d,  4,  4,  CHG_NZVC, cpu6812 },
+  { "minm", OP_IDX_1 | OP_PAGE2,   4, 0x1d,  5,  5,  CHG_NZVC, cpu6812 },
+  { "minm", OP_IDX_2 | OP_PAGE2,   5, 0x1d,  6,  6,  CHG_NZVC, cpu6812 },
+  { "minm", OP_D_IDX | OP_PAGE2,   3, 0x1d,  7,  7,  CHG_NZVC, cpu6812 },
+  { "minm", OP_D_IDX_2 | OP_PAGE2, 5, 0x1d,  7,  7,  CHG_NZVC, cpu6812 },
+
+  { "movb", OP_IMM8|OP_IND16_p2|OP_PAGE2, 5, 0x0b, 4, 4,  CHG_NONE, cpu6812 },
+  { "movb", OP_IMM8|OP_IDX_p2|OP_PAGE2,     4, 0x08,  4,  4,  CHG_NONE, cpu6812 },
+  { "movb", OP_IND16|OP_IND16_p2|OP_PAGE2,  6, 0x0c,  6,  6,  CHG_NONE, cpu6812 },
+  { "movb", OP_IND16 | OP_IDX_p2 | OP_PAGE2,    5, 0x09,  5,  5,  CHG_NONE, cpu6812 },
+  { "movb", OP_IDX | OP_IND16_p2 | OP_PAGE2,    5, 0x0d,  5,  5,  CHG_NONE, cpu6812 },
+  { "movb", OP_IDX | OP_IDX_p2 | OP_PAGE2,      4, 0x0a,  5,  5,  CHG_NONE, cpu6812 },
+
+  { "movw", OP_IMM16 | OP_IND16_p2 | OP_PAGE2,  6, 0x03,  5,  5,  CHG_NONE, cpu6812 },
+  { "movw", OP_IMM16 | OP_IDX_p2 | OP_PAGE2,    5, 0x00,  4,  4,  CHG_NONE, cpu6812 },
+  { "movw", OP_IND16 | OP_IND16_p2 | OP_PAGE2,  6, 0x04,  6,  6,  CHG_NONE, cpu6812 },
+  { "movw", OP_IND16 | OP_IDX_p2 | OP_PAGE2,    5, 0x01,  5,  5,  CHG_NONE, cpu6812 },
+  { "movw", OP_IDX | OP_IND16_p2 | OP_PAGE2,    5, 0x05,  5,  5,  CHG_NONE, cpu6812 },
+  { "movw", OP_IDX | OP_IDX_p2 | OP_PAGE2,      4, 0x02,  5,  5,  CHG_NONE, cpu6812 },
+
+  { "mul",  OP_NONE,           1, 0x3d,  3, 10,  CHG_C, cpu6811 },
+  { "mul",  OP_NONE,           1, 0x12,  3,  3,  CHG_C, cpu6812 },
+
+  { "neg",  OP_IND16,          3, 0x70,  4,  4,  CHG_NZVC, cpu6811|cpu6812 },
+  { "neg",  OP_IX,             2, 0x60,  6,  6,  CHG_NZVC, cpu6811 },
+  { "neg",  OP_IY | OP_PAGE2,  3, 0x60,  7,  7,  CHG_NZVC, cpu6811 },
+  { "neg",  OP_IDX,            2, 0x60,  3,  3,  CHG_NZVC, cpu6812 },
+  { "neg",  OP_IDX_1,          3, 0x60,  4,  4,  CHG_NZVC, cpu6812 },
+  { "neg",  OP_IDX_2,          4, 0x60,  5,  5,  CHG_NZVC, cpu6812 },
+  { "neg",  OP_D_IDX,          2, 0x60,  6,  6,  CHG_NZVC, cpu6812 },
+  { "neg",  OP_D_IDX_2,        4, 0x60,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "nega", OP_NONE,           1, 0x40,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+  { "negb", OP_NONE,           1, 0x50,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+  { "nop",  OP_NONE,           1, 0x01,  2,  2,  CHG_NONE, cpu6811 },
+  { "nop",  OP_NONE,           1, 0xa7,  1,  1,  CHG_NONE, cpu6812 },
+
+  { "oraa", OP_IMM8,         2, 0x8a,  1,  1,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "oraa", OP_DIRECT,       2, 0x9a,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "oraa", OP_IND16,        3, 0xba,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "oraa", OP_IX,             2, 0xaa,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "oraa", OP_IY | OP_PAGE2,  3, 0xaa,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "oraa", OP_IDX,            2, 0xaa,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "oraa", OP_IDX_1,          3, 0xaa,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "oraa", OP_IDX_2,          4, 0xaa,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "oraa", OP_D_IDX,          2, 0xaa,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+  { "oraa", OP_D_IDX_2,        4, 0xaa,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "orab", OP_IMM8,         2, 0xca,  1,  1,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "orab", OP_DIRECT,       2, 0xda,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "orab", OP_IND16,        3, 0xfa,  3,  3,  CLR_V_CHG_NZ, cpu6811|cpu6812 },
+  { "orab", OP_IX,             2, 0xea,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "orab", OP_IY | OP_PAGE2,  3, 0xea,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "orab", OP_IDX,            2, 0xea,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "orab", OP_IDX_1,          3, 0xea,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "orab", OP_IDX_2,          4, 0xea,  4,  4,  CLR_V_CHG_NZ, cpu6812 },
+  { "orab", OP_D_IDX,          2, 0xea,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+  { "orab", OP_D_IDX_2,        4, 0xea,  6,  6,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "orcc", OP_IMM8,           2, 0x14,  1,  1,  CHG_ALL, cpu6812 },
+
+  { "psha", OP_NONE,           1, 0x36,  2,  2,  CHG_NONE, cpu6811|cpu6812 },
+  { "pshb", OP_NONE,           1, 0x37,  2,  2,  CHG_NONE, cpu6811|cpu6812 },
+  { "pshc", OP_NONE,           1, 0x39,  2,  2,  CHG_NONE, cpu6812 },
+  { "pshd", OP_NONE,           1, 0x3b,  2,  2,  CHG_NONE, cpu6812 },
+  { "pshx", OP_NONE,           1, 0x3c,  4,  4,  CHG_NONE, cpu6811 },
+  { "pshx", OP_NONE,           1, 0x34,  2,  2,  CHG_NONE, cpu6812 },
+  { "pshy", OP_NONE | OP_PAGE2,2, 0x3c,  5,  5,  CHG_NONE, cpu6811 },
+  { "pshy", OP_NONE,           1, 0x35,  2,  2,  CHG_NONE, cpu6812 },
+
+  { "pula", OP_NONE,           1, 0x32,  3,  3,  CHG_NONE, cpu6811|cpu6812 },
+  { "pulb", OP_NONE,           1, 0x33,  3,  3,  CHG_NONE, cpu6811|cpu6812 },
+  { "pulc", OP_NONE,           1, 0x38,  3,  3,  CHG_NONE, cpu6812 },
+  { "puld", OP_NONE,           1, 0x3a,  3,  3,  CHG_NONE, cpu6812 },
+  { "pulx", OP_NONE,           1, 0x38,  5,  5,  CHG_NONE, cpu6811 },
+  { "pulx", OP_NONE,           1, 0x30,  3,  3,  CHG_NONE, cpu6812 },
+  { "puly", OP_NONE | OP_PAGE2,2, 0x38,  6,  6,  CHG_NONE, cpu6811 },
+  { "puly", OP_NONE,           1, 0x31,  3,  3,  CHG_NONE, cpu6812 },
+
+  { "rev",  OP_NONE | OP_PAGE2, 2, 0x3a,  _M,  _M,  CHG_HNZVC, cpu6812 },
+  { "revw", OP_NONE | OP_PAGE2, 2, 0x3b,  _M,  _M,  CHG_HNZVC, cpu6812 },
+
+  { "rol",  OP_IND16,          3, 0x79,  6,  6,  CHG_NZVC, cpu6811 },
+  { "rol",  OP_IX,             2, 0x69,  6,  6,  CHG_NZVC, cpu6811 },
+  { "rol",  OP_IY | OP_PAGE2,  3, 0x69,  7,  7,  CHG_NZVC, cpu6811 },
+  { "rol",  OP_IND16,          3, 0x75,  4,  4,  CHG_NZVC, cpu6812 },
+  { "rol",  OP_IDX,            2, 0x65,  3,  3,  CHG_NZVC, cpu6812 },
+  { "rol",  OP_IDX_1,          3, 0x65,  4,  4,  CHG_NZVC, cpu6812 },
+  { "rol",  OP_IDX_2,          4, 0x65,  5,  5,  CHG_NZVC, cpu6812 },
+  { "rol",  OP_D_IDX,          2, 0x65,  6,  6,  CHG_NZVC, cpu6812 },
+  { "rol",  OP_D_IDX_2,        4, 0x65,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "rola", OP_NONE,           1, 0x49,  2,  2,  CHG_NZVC, cpu6811 },
+  { "rola", OP_NONE,           1, 0x45,  1,  1,  CHG_NZVC, cpu6812 },
+  { "rolb", OP_NONE,           1, 0x59,  2,  2,  CHG_NZVC, cpu6811 },
+  { "rolb", OP_NONE,           1, 0x55,  1,  1,  CHG_NZVC, cpu6812 },
+
+  { "ror",  OP_IND16,          3, 0x76,  4,  4,  CHG_NZVC, cpu6811|cpu6812 },
+  { "ror",  OP_IX,             2, 0x66,  6,  6,  CHG_NZVC, cpu6811 },
+  { "ror",  OP_IY | OP_PAGE2,  3, 0x66,  7,  7,  CHG_NZVC, cpu6811 },
+  { "ror",  OP_IDX,            2, 0x66,  3,  3,  CHG_NZVC, cpu6812 },
+  { "ror",  OP_IDX_1,          3, 0x66,  4,  4,  CHG_NZVC, cpu6812 },
+  { "ror",  OP_IDX_2,          4, 0x66,  5,  5,  CHG_NZVC, cpu6812 },
+  { "ror",  OP_D_IDX,          2, 0x66,  6,  6,  CHG_NZVC, cpu6812 },
+  { "ror",  OP_D_IDX_2,        4, 0x66,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "rora", OP_NONE,           1, 0x46,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+  { "rorb", OP_NONE,           1, 0x56,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+
+  { "rtc",  OP_NONE,           1, 0x0a,  6,  6,  CHG_NONE, cpu6812 },
+  { "rti",  OP_NONE,           1, 0x3b, 12, 12,  CHG_ALL, cpu6811},
+  { "rti",  OP_NONE,           1, 0x0b,  8, 10,  CHG_ALL, cpu6812},
+  { "rts",  OP_NONE,           1, 0x39,  5,  5,  CHG_NONE, cpu6811 },
+  { "rts",  OP_NONE,           1, 0x3d,  5,  5,  CHG_NONE, cpu6812 },
+
+  { "sba",  OP_NONE,             1, 0x10,  2,  2,  CHG_NZVC, cpu6811 },
+  { "sba",  OP_NONE | OP_PAGE2, 2, 0x16,  2,  2,  CHG_NZVC, cpu6812 },
+
+  { "sbca", OP_IMM8,           2, 0x82,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+  { "sbca", OP_DIRECT,         2, 0x92,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "sbca", OP_IND16,          3, 0xb2,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "sbca", OP_IX,             2, 0xa2,  4,  4,  CHG_NZVC, cpu6811 },
+  { "sbca", OP_IY | OP_PAGE2,  3, 0xa2,  5,  5,  CHG_NZVC, cpu6811 },
+  { "sbca", OP_IDX,            2, 0xa2,  3,  3,  CHG_NZVC, cpu6812 },
+  { "sbca", OP_IDX_1,          3, 0xa2,  3,  3,  CHG_NZVC, cpu6812 },
+  { "sbca", OP_IDX_2,          4, 0xa2,  4,  4,  CHG_NZVC, cpu6812 },
+  { "sbca", OP_D_IDX,          2, 0xa2,  6,  6,  CHG_NZVC, cpu6812 },
+  { "sbca", OP_D_IDX_2,        4, 0xa2,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "sbcb", OP_IMM8,           2, 0xc2,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+  { "sbcb", OP_DIRECT,         2, 0xd2,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "sbcb", OP_IND16,          3, 0xf2,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "sbcb", OP_IX,             2, 0xe2,  4,  4,  CHG_NZVC, cpu6811 },
+  { "sbcb", OP_IY | OP_PAGE2,  3, 0xe2,  5,  5,  CHG_NZVC, cpu6811 },
+  { "sbcb", OP_IDX,            2, 0xe2,  3,  3,  CHG_NZVC, cpu6812 },
+  { "sbcb", OP_IDX_1,          3, 0xe2,  3,  3,  CHG_NZVC, cpu6812 },
+  { "sbcb", OP_IDX_2,          4, 0xe2,  4,  4,  CHG_NZVC, cpu6812 },
+  { "sbcb", OP_D_IDX,          2, 0xe2,  6,  6,  CHG_NZVC, cpu6812 },
+  { "sbcb", OP_D_IDX_2,        4, 0xe2,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "sec",  OP_NONE,           1, 0x0d,  2,  2,  SET_C, cpu6811 },
+  { "sei",  OP_NONE,           1, 0x0f,  2,  2,  SET_I, cpu6811 },
+  { "sev",  OP_NONE,           1, 0x0b,  2,  2,  SET_V, cpu6811 },
+
+  { "sex",  M6812_OP_SEX_MARKER
+          | OP_REG | OP_REG_2, 2, 0xb7,  1,  1,  CHG_NONE, cpu6812 },
+
+  { "staa", OP_IND16,          3, 0xb7,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "staa", OP_DIRECT,         2, 0x97,  3,  3,  CLR_V_CHG_NZ, cpu6811 },
+  { "staa", OP_IX,             2, 0xa7,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "staa", OP_IY | OP_PAGE2,  3, 0xa7,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "staa", OP_DIRECT,         2, 0x5a,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+  { "staa", OP_IND16,          3, 0x7a,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "staa", OP_IDX,            2, 0x6a,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+  { "staa", OP_IDX_1,          3, 0x6a,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "staa", OP_IDX_2,          4, 0x6a,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "staa", OP_D_IDX,          2, 0x6a,  5,  5,  CLR_V_CHG_NZ, cpu6812 },
+  { "staa", OP_D_IDX_2,        4, 0x6a,  5,  5,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "stab", OP_IND16,          3, 0xf7,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "stab", OP_DIRECT,         2, 0xd7,  3,  3,  CLR_V_CHG_NZ, cpu6811 },
+  { "stab", OP_IX,             2, 0xe7,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "stab", OP_IY | OP_PAGE2,  3, 0xe7,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "stab", OP_DIRECT,         2, 0x5b,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+  { "stab", OP_IND16,          3, 0x7b,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "stab", OP_IDX,            2, 0x6b,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+  { "stab", OP_IDX_1,          3, 0x6b,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "stab", OP_IDX_2,          4, 0x6b,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "stab", OP_D_IDX,          2, 0x6b,  5,  5,  CLR_V_CHG_NZ, cpu6812 },
+  { "stab", OP_D_IDX_2,        4, 0x6b,  5,  5,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "std",  OP_IND16,          3, 0xfd,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "std",  OP_DIRECT,         2, 0xdd,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "std",  OP_IX,             2, 0xed,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "std",  OP_IY | OP_PAGE2,  3, 0xed,  6,  6,  CLR_V_CHG_NZ, cpu6811 },
+  { "std",  OP_DIRECT,         2, 0x5c,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+  { "std",  OP_IND16,          3, 0x7c,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "std",  OP_IDX,            2, 0x6c,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+  { "std",  OP_IDX_1,          3, 0x6c,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "std",  OP_IDX_2,          4, 0x6c,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "std",  OP_D_IDX,          2, 0x6c,  5,  5,  CLR_V_CHG_NZ, cpu6812 },
+  { "std",  OP_D_IDX_2,        4, 0x6c,  5,  5,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "stop", OP_NONE,           1, 0xcf,  2,  2,  CHG_NONE, cpu6811 },
+  { "stop", OP_NONE | OP_PAGE2,2, 0x3e,  2,  9,  CHG_NONE, cpu6812 },
+
+  { "sts",  OP_IND16,          3, 0xbf,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "sts",  OP_DIRECT,         2, 0x9f,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "sts",  OP_IX,             2, 0xaf,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "sts",  OP_IY | OP_PAGE2,  3, 0xaf,  6,  6,  CLR_V_CHG_NZ, cpu6811 },
+  { "sts",  OP_DIRECT,         2, 0x5f,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+  { "sts",  OP_IND16,          3, 0x7f,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "sts",  OP_IDX,            2, 0x6f,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+  { "sts",  OP_IDX_1,          3, 0x6f,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "sts",  OP_IDX_2,          4, 0x6f,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "sts",  OP_D_IDX,          2, 0x6f,  5,  5,  CLR_V_CHG_NZ, cpu6812 },
+  { "sts",  OP_D_IDX_2,        4, 0x6f,  5,  5,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "stx",  OP_IND16,          3, 0xff,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "stx",  OP_DIRECT,         2, 0xdf,  4,  4,  CLR_V_CHG_NZ, cpu6811 },
+  { "stx",  OP_IX,             2, 0xef,  5,  5,  CLR_V_CHG_NZ, cpu6811 },
+  { "stx",  OP_IY | OP_PAGE4,  3, 0xef,  6,  6,  CLR_V_CHG_NZ, cpu6811 },
+  { "stx",  OP_DIRECT,         2, 0x5e,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+  { "stx",  OP_IND16,          3, 0x7e,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "stx",  OP_IDX,            2, 0x6e,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+  { "stx",  OP_IDX_1,          3, 0x6e,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "stx",  OP_IDX_2,          4, 0x6e,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "stx",  OP_D_IDX,          2, 0x6e,  5,  5,  CLR_V_CHG_NZ, cpu6812 },
+  { "stx",  OP_D_IDX_2,        4, 0x6e,  5,  5,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "sty",  OP_IND16 | OP_PAGE2,  4, 0xff, 6, 6, CLR_V_CHG_NZ, cpu6811 },
+  { "sty",  OP_DIRECT | OP_PAGE2, 3, 0xdf, 5, 5, CLR_V_CHG_NZ, cpu6811 },
+  { "sty",  OP_IY | OP_PAGE2,     3, 0xef, 6, 6, CLR_V_CHG_NZ, cpu6811 },
+  { "sty",  OP_IX | OP_PAGE3,     3, 0xef, 6, 6, CLR_V_CHG_NZ, cpu6811 },
+  { "sty",  OP_DIRECT,         2, 0x5d,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+  { "sty",  OP_IND16,          3, 0x7d,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "sty",  OP_IDX,            2, 0x6d,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+  { "sty",  OP_IDX_1,          3, 0x6d,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "sty",  OP_IDX_2,          4, 0x6d,  3,  3,  CLR_V_CHG_NZ, cpu6812 },
+  { "sty",  OP_D_IDX,          2, 0x6d,  5,  5,  CLR_V_CHG_NZ, cpu6812 },
+  { "sty",  OP_D_IDX_2,        4, 0x6d,  5,  5,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "suba", OP_IMM8,           2, 0x80,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+  { "suba", OP_DIRECT,         2, 0x90,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "suba", OP_IND16,          3, 0xb0,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "suba", OP_IX,             2, 0xa0,  4,  4,  CHG_NZVC, cpu6811 },
+  { "suba", OP_IY | OP_PAGE2,  3, 0xa0,  5,  5,  CHG_NZVC, cpu6811 },
+  { "suba", OP_IDX,            2, 0xa0,  3,  3,  CHG_NZVC, cpu6812 },
+  { "suba", OP_IDX_1,          3, 0xa0,  3,  3,  CHG_NZVC, cpu6812 },
+  { "suba", OP_IDX_2,          4, 0xa0,  4,  4,  CHG_NZVC, cpu6812 },
+  { "suba", OP_D_IDX,          2, 0xa0,  6,  6,  CHG_NZVC, cpu6812 },
+  { "suba", OP_D_IDX_2,        4, 0xa0,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "subb", OP_IMM8,           2, 0xc0,  1,  1,  CHG_NZVC, cpu6811|cpu6812 },
+  { "subb", OP_DIRECT,         2, 0xd0,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "subb", OP_IND16,          3, 0xf0,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "subb", OP_IX,             2, 0xe0,  4,  4,  CHG_NZVC, cpu6811 },
+  { "subb", OP_IY | OP_PAGE2,  3, 0xe0,  5,  5,  CHG_NZVC, cpu6811 },
+  { "subb", OP_IDX,            2, 0xe0,  3,  3,  CHG_NZVC, cpu6812 },
+  { "subb", OP_IDX_1,          3, 0xe0,  3,  3,  CHG_NZVC, cpu6812 },
+  { "subb", OP_IDX_2,          4, 0xe0,  4,  4,  CHG_NZVC, cpu6812 },
+  { "subb", OP_D_IDX,          2, 0xe0,  6,  6,  CHG_NZVC, cpu6812 },
+  { "subb", OP_D_IDX_2,        4, 0xe0,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "subd", OP_IMM16,          3, 0x83,  2,  2,  CHG_NZVC, cpu6811|cpu6812 },
+  { "subd", OP_DIRECT,         2, 0x93,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "subd", OP_IND16,          3, 0xb3,  3,  3,  CHG_NZVC, cpu6811|cpu6812 },
+  { "subd", OP_IX,             2, 0xa3,  6,  6,  CHG_NZVC, cpu6811 },
+  { "subd", OP_IY | OP_PAGE2,  3, 0xa3,  7,  7,  CHG_NZVC, cpu6811 },
+  { "subd", OP_IDX,            2, 0xa3,  3,  3,  CHG_NZVC, cpu6812 },
+  { "subd", OP_IDX_1,          3, 0xa3,  3,  3,  CHG_NZVC, cpu6812 },
+  { "subd", OP_IDX_2,          4, 0xa3,  4,  4,  CHG_NZVC, cpu6812 },
+  { "subd", OP_D_IDX,          2, 0xa3,  6,  6,  CHG_NZVC, cpu6812 },
+  { "subd", OP_D_IDX_2,        4, 0xa3,  6,  6,  CHG_NZVC, cpu6812 },
+
+  { "swi",  OP_NONE,           1, 0x3f,  9,  9,  CHG_NONE, cpu6811|cpu6812 },
+
+  { "tab",  OP_NONE,           1, 0x16,  2,  2,  CLR_V_CHG_NZ, cpu6811 },
+  { "tab",  OP_NONE | OP_PAGE2,2, 0x0e,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "tap",  OP_NONE,           1, 0x06,  2,  2,  CHG_ALL, cpu6811 },
+
+  { "tba",  OP_NONE,           1, 0x17,  2,  2,  CLR_V_CHG_NZ, cpu6811 },
+  { "tba",  OP_NONE | OP_PAGE2,2, 0x0f,  2,  2,  CLR_V_CHG_NZ, cpu6812 },
+
+  { "test", OP_NONE,           1, 0x00,  5, _M,  CHG_NONE, cpu6811 },
+
+  { "tpa",  OP_NONE,           1, 0x07,  2,  2,  CHG_NONE, cpu6811 },
+
+  { "tbeq", OP_TBEQ_MARKER
+          | OP_REG | OP_JUMP_REL,  3, 0x04,  3,  3, CHG_NONE, cpu6812 },
+
+  { "tbl",  OP_IDX | OP_PAGE2,  3, 0x3d,  8,  8, CHG_NZC, cpu6812 },
+
+  { "tbne", OP_TBNE_MARKER
+          | OP_REG | OP_JUMP_REL,  3, 0x04,  3,  3, CHG_NONE, cpu6812 },
+
+  { "tfr",  OP_TFR_MARKER
+          | OP_REG_1 | OP_REG_2, 2, 0xb7, 1, 1,  CHG_NONE, cpu6812 },
+
+  { "trap", OP_IMM8 | OP_TRAP_ID, 2, 0x18,  11,  11,  SET_I, cpu6812 },
+
+  { "tst",  OP_IND16,          3, 0x7d,  6,  6,  CLR_VC_CHG_NZ, cpu6811 },
+  { "tst",  OP_IX,             2, 0x6d,  6,  6,  CLR_VC_CHG_NZ, cpu6811 },
+  { "tst",  OP_IY | OP_PAGE2,  3, 0x6d,  7,  7,  CLR_VC_CHG_NZ, cpu6811 },
+  { "tst",  OP_IND16,          3, 0xf7,  3,  3,  CLR_VC_CHG_NZ, cpu6812 },
+  { "tst",  OP_IDX,            2, 0xe7,  3,  3,  CLR_VC_CHG_NZ, cpu6812 },
+  { "tst",  OP_IDX_1,          3, 0xe7,  3,  3,  CLR_VC_CHG_NZ, cpu6812 },
+  { "tst",  OP_IDX_2,          4, 0xe7,  4,  4,  CLR_VC_CHG_NZ, cpu6812 },
+  { "tst",  OP_D_IDX,          2, 0xe7,  6,  6,  CLR_VC_CHG_NZ, cpu6812 },
+  { "tst",  OP_D_IDX_2,        4, 0xe7,  6,  6,  CLR_VC_CHG_NZ, cpu6812 },
+
+  { "tsta", OP_NONE,           1, 0x4d,  2,  2,  CLR_VC_CHG_NZ, cpu6811 },
+  { "tsta", OP_NONE,           1, 0x97,  1,  1,  CLR_VC_CHG_NZ, cpu6812 },
+  { "tstb", OP_NONE,           1, 0x5d,  2,  2,  CLR_VC_CHG_NZ, cpu6811 },
+  { "tstb", OP_NONE,           1, 0xd7,  1,  1,  CLR_VC_CHG_NZ, cpu6812 },
+
+  { "tsx",  OP_NONE,           1, 0x30,  3,  3,  CHG_NONE, cpu6811 },
+  { "tsy",  OP_NONE | OP_PAGE2,2, 0x30,  4,  4,  CHG_NONE, cpu6811 },
+  { "txs",  OP_NONE,           1, 0x35,  3,  3,  CHG_NONE, cpu6811 },
+  { "tys",  OP_NONE | OP_PAGE2,2, 0x35,  4,  4,  CHG_NONE, cpu6811 },
+
+  { "wai",  OP_NONE,           1, 0x3e,  5,  _M, CHG_NONE, cpu6811|cpu6812 },
+
+  { "wav",  OP_NONE | OP_PAGE2, 2, 0x3c,  8,  _M, SET_Z_CHG_HNVC, cpu6812 },
+
+  { "xgdx", OP_NONE,           1, 0x8f,  3,  3,  CHG_NONE, cpu6811 },
+  { "xgdy", OP_NONE | OP_PAGE2,2, 0x8f,  4,  4,  CHG_NONE, cpu6811 }
+};
+
+const int m68hc11_num_opcodes = TABLE_SIZE (m68hc11_opcodes);
+
+/* The following alias table provides source compatibility to
+   move from 68HC11 assembly to 68HC12.  */
+const struct m68hc12_opcode_alias m68hc12_alias[] = {
+  { "abx", "leax b,x",   2, 0x1a, 0xe5 },
+  { "aby", "leay b,y",   2, 0x19, 0xed },
+  { "clc", "andcc #$fe", 2, 0x10, 0xfe },
+  { "cli", "andcc #$ef", 2, 0x10, 0xef },
+  { "clv", "andcc #$fd", 2, 0x10, 0xfd },
+  { "des", "leas -1,sp", 2, 0x1b, 0x9f },
+  { "ins", "leas 1,sp",  2, 0x1b, 0x81 },
+  { "sec", "orcc #$01",  2, 0x14, 0x01 },
+  { "sei", "orcc #$10",  2, 0x14, 0x10 },
+  { "sev", "orcc #$02",  2, 0x14, 0x02 },
+  { "tap", "tfr a,ccr",  2, 0xb7, 0x02 },
+  { "tpa", "tfr ccr,a",  2, 0xb7, 0x20 },
+  { "tsx", "tfr sp,x",   2, 0xb7, 0x75 },
+  { "tsy", "tfr sp,y",   2, 0xb7, 0x76 },
+  { "txs", "tfr x,sp",   2, 0xb7, 0x57 },
+  { "tys", "tfr y,sp",   2, 0xb7, 0x67 },
+  { "xgdx","exg d,x",    2, 0xb7, 0xc5 },
+  { "xgdy","exg d,y",    2, 0xb7, 0xc6 }
+};
+const int m68hc12_num_alias = TABLE_SIZE (m68hc12_alias);
diff --git a/opcodes/mcore-dis.c b/opcodes/mcore-dis.c
index 6df124f..83b1da5 100644
--- a/opcodes/mcore-dis.c
+++ b/opcodes/mcore-dis.c
@@ -29,7 +29,7 @@
     /* O0  */ 0xFFFF,
     /* OT  */ 0xFFFC,
     /* O1  */ 0xFFF0,
-    /* OC  */ 0xFFE0,
+    /* OC  */ 0xFE00,
     /* O2  */ 0xFF00,
     /* X1  */ 0xFFF0,
     /* OI  */ 0xFE00,
diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c
index fa33821..a75dc89 100644
--- a/opcodes/mips-dis.c
+++ b/opcodes/mips-dis.c
@@ -157,6 +157,30 @@
 			     reg_names[(l >> OP_SH_RD) & OP_MASK_RD]);
       break;
 
+    case 'U':
+      {
+      /* First check for both rd and rt being equal. */
+      int reg = (l >> OP_SH_RD) & OP_MASK_RD;
+      if (reg == ((l >> OP_SH_RT) & OP_MASK_RT))
+        (*info->fprintf_func) (info->stream, "$%s",
+                               reg_names[reg]);
+      else                        
+        {
+          /* If one is zero use the other. */
+          if (reg == 0)
+            (*info->fprintf_func) (info->stream, "$%s",
+                                   reg_names[(l >> OP_SH_RT) & OP_MASK_RT]);
+          else if (((l >> OP_SH_RT) & OP_MASK_RT) == 0)
+            (*info->fprintf_func) (info->stream, "$%s",
+                                   reg_names[reg]);
+          else /* Bogus, result depends on processor. */
+            (*info->fprintf_func) (info->stream, "$%s or $%s",
+                                   reg_names[reg],
+                                   reg_names[(l >> OP_SH_RT) & OP_MASK_RT]);
+          }
+      }
+      break;
+
     case 'z':
       (*info->fprintf_func) (info->stream, "$%s", reg_names[0]);
       break;
@@ -171,7 +195,6 @@
 			     (l >> OP_SH_CODE) & OP_MASK_CODE);
       break;
 
-
     case 'q':
       (*info->fprintf_func) (info->stream, "0x%x",
 			     (l >> OP_SH_CODE2) & OP_MASK_CODE2);
@@ -184,7 +207,12 @@
 
     case 'B':
       (*info->fprintf_func) (info->stream, "0x%x",
-			     (l >> OP_SH_SYSCALL) & OP_MASK_SYSCALL);
+			     (l >> OP_SH_CODE20) & OP_MASK_CODE20);
+      break;
+
+    case 'J':
+      (*info->fprintf_func) (info->stream, "0x%x",
+			     (l >> OP_SH_CODE19) & OP_MASK_CODE19);
       break;
 
     case 'S':
@@ -193,7 +221,6 @@
 			     (l >> OP_SH_FS) & OP_MASK_FS);
       break;
 
-
     case 'T':
     case 'W':
       (*info->fprintf_func) (info->stream, "$f%d",
@@ -235,6 +262,10 @@
 			     (l >> OP_SH_PERFREG) & OP_MASK_PERFREG);
       break;
 
+    case 'H':
+      (*info->fprintf_func) (info->stream, "%d", 
+			     (l >> OP_SH_SEL) & OP_MASK_SEL);
+      break;
 
     default:
       /* xgettext:c-format */
@@ -256,79 +287,98 @@
      int *isa;
      int *cputype;
 {
-  int target_processor = 0;
-  int mips_isa = 0;
+  int target_processor = CPU_UNKNOWN;
+  int mips_isa = ISA_UNKNOWN;
 
   /* Use standard MIPS register names by default.  */
   reg_names = std_reg_names;
 
   switch (mach)
     {
-      case bfd_mach_mips3000:
-	target_processor = 3000;
-	mips_isa = 1;
-	break;
-      case bfd_mach_mips3900:
-	target_processor = 3900;
-	mips_isa = 1;
-	break;
-      case bfd_mach_mips4000:
-	target_processor = 4000;
-	mips_isa = 3;
-	break;
-      case bfd_mach_mips4010:
-	target_processor = 4010;
-	mips_isa = 2;
-	break;
-      case bfd_mach_mips4100:
-	target_processor = 4100;
-	mips_isa = 3;
-	break;
-      case bfd_mach_mips4111:
-	target_processor = 4100;
-	mips_isa = 3;
-	break;
-      case bfd_mach_mips4300:
-	target_processor = 4300;
-	mips_isa = 3;
-	break;
-      case bfd_mach_mips4400:
-	target_processor = 4400;
-	mips_isa = 3;
-	break;
-      case bfd_mach_mips4600:
-	target_processor = 4600;
-	mips_isa = 3;
-	break;
-      case bfd_mach_mips4650:
-	target_processor = 4650;
-	mips_isa = 3;
-	break;
-      case bfd_mach_mips5000:
-	target_processor = 5000;
-	mips_isa = 4;
-	break;
-      case bfd_mach_mips6000:
-	target_processor = 6000;
-	mips_isa = 2;
-	break;
-      case bfd_mach_mips8000:
-	target_processor = 8000;
-	mips_isa = 4;
-	break;
-      case bfd_mach_mips10000:
-	target_processor = 10000;
-	mips_isa = 4;
-	break;
-      case bfd_mach_mips16:
-	target_processor = 16;
-	mips_isa = 3;
-	break;
-      default:
-	target_processor = 3000;
-	mips_isa = 3;
-	break;
-
+    case bfd_mach_mips3000:
+      target_processor = CPU_R3000;
+      mips_isa = ISA_MIPS1;
+      break;
+    case bfd_mach_mips3900:
+      target_processor = CPU_R3900;
+      mips_isa = ISA_MIPS1;
+      break;
+    case bfd_mach_mips4000:
+      target_processor = CPU_R4000;
+      mips_isa = ISA_MIPS3;
+      break;
+    case bfd_mach_mips4010:
+      target_processor = CPU_R4010;
+      mips_isa = ISA_MIPS2;
+      break;
+    case bfd_mach_mips4100:
+      target_processor = CPU_VR4100;
+      mips_isa = ISA_MIPS3;
+      break;
+    case bfd_mach_mips4111:
+      target_processor = CPU_VR4100; /* FIXME: Shouldn't this be CPU_R4111 ??? */
+      mips_isa = ISA_MIPS3;
+      break;
+    case bfd_mach_mips4300:
+      target_processor = CPU_R4300;
+      mips_isa = ISA_MIPS3;
+      break;
+    case bfd_mach_mips4400:
+      target_processor = CPU_R4400;
+      mips_isa = ISA_MIPS3;
+      break;
+    case bfd_mach_mips4600:
+      target_processor = CPU_R4600;
+      mips_isa = ISA_MIPS3;
+      break;
+    case bfd_mach_mips4650:
+      target_processor = CPU_R4650;
+      mips_isa = ISA_MIPS3;
+      break;
+    case bfd_mach_mips5000:
+      target_processor = CPU_R5000;
+      mips_isa = ISA_MIPS4;
+      break;
+    case bfd_mach_mips6000:
+      target_processor = CPU_R6000;
+      mips_isa = ISA_MIPS2;
+      break;
+    case bfd_mach_mips8000:
+      target_processor = CPU_R8000;
+      mips_isa = ISA_MIPS4;
+      break;
+    case bfd_mach_mips10000:
+      target_processor = CPU_R10000;
+      mips_isa = ISA_MIPS4;
+      break;
+    case bfd_mach_mips16:
+      target_processor = CPU_MIPS16;
+      mips_isa = ISA_MIPS3;
+      break;
+    case bfd_mach_mips32:
+      target_processor = CPU_MIPS32;
+      mips_isa = ISA_MIPS32;
+      break;
+    case bfd_mach_mips32_4k:
+      target_processor = CPU_MIPS32_4K;
+      mips_isa = ISA_MIPS32;
+      break;
+    case bfd_mach_mips5:
+      target_processor = CPU_MIPS5;
+      mips_isa = ISA_MIPS5;
+      break;
+    case bfd_mach_mips64:
+      target_processor = CPU_MIPS64;
+      mips_isa = ISA_MIPS64;
+      break;
+    case bfd_mach_mips_sb1:
+      target_processor = CPU_SB1;
+      mips_isa = ISA_MIPS64;
+      break;
+    default:
+      target_processor = CPU_R3000;
+      mips_isa = ISA_MIPS3;
+      break;
     }
 
   *isa = mips_isa;
diff --git a/opcodes/mips-opc.c b/opcodes/mips-opc.c
index 75926f6..7b0ee2c 100644
--- a/opcodes/mips-opc.c
+++ b/opcodes/mips-opc.c
@@ -1,7 +1,8 @@
-/* mips.h.  Mips opcode list for GDB, the GNU debugger.
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* mips-opc.c -- MIPS opcode list.
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
    Contributed by Ralph Campbell and OSF
    Commented and modified by Ian Lance Taylor, Cygnus Support
+   Extended for MIPS32 support by Anders Norlander, and by SiByte, Inc.
 
 This file is part of GDB, GAS, and the GNU binutils.
 
@@ -77,6 +78,9 @@
 #define I3	INSN_ISA3
 #define I4	INSN_ISA4
 #define I5	INSN_ISA5
+#define I32	INSN_ISA32
+#define I64     INSN_ISA64
+
 #define P3	INSN_4650
 #define L1	INSN_4010
 #define V1      INSN_4100
@@ -93,9 +97,6 @@
 
 #define G6      INSN_GP32
 
-#define M1      0
-#define M2      0
-
 /* The order of overloaded instructions matters.  Label arguments and
    register arguments look the same. Instructions that can have either
    for arguments must apear in the correct order in this table for the
@@ -106,721 +107,750 @@
    Many instructions are short hand for other instructions (i.e., The
    jal <register> instruction is short for jalr <register>).  */
 
-const struct mips_opcode mips_builtin_opcodes[] = {
+const struct mips_opcode mips_builtin_opcodes[] =
+{
 /* These instructions appear first so that the disassembler will find
    them first.  The assemblers uses a hash table based on the
    instruction name anyhow.  */
-/* name,	args,	mask,		match,	pinfo */
-{"nop",     "",		0x00000000, 0xffffffff,	0,		I1	},
-{"li",      "t,j",      0x24000000, 0xffe00000, WR_t,		I1	}, /* addiu */
-{"li",	    "t,i",	0x34000000, 0xffe00000, WR_t,		I1	}, /* ori */
-{"li",      "t,I",	0,    (int) M_LI,	INSN_MACRO,	I1	},
-{"move",    "d,s",	0x00000025, 0xfc1f07ff,	WR_d|RD_s,	I1|G6	},/* or */
-{"move",    "d,s",	0x0000002d, 0xfc1f07ff, WR_d|RD_s,	I3	},/* daddu */
-{"move",    "d,s",	0x00000021, 0xfc1f07ff, WR_d|RD_s,	I1	},/* addu */
-{"move",    "d,s",	0x00000025, 0xfc1f07ff,	WR_d|RD_s,	I1	},/* or */
-{"b",       "p",	0x10000000, 0xffff0000,	UBD,		I1	},/* beq 0,0 */
-{"b",       "p",	0x04010000, 0xffff0000,	UBD,		I1	},/* bgez 0 */
-{"bal",     "p",	0x04110000, 0xffff0000,	UBD|WR_31,	I1	},/* bgezal 0*/
+/* name,    args,	match,	    mask,	pinfo,          	membership */
+{"pref",    "k,o(b)",   0xcc000000, 0xfc000000, RD_b,           	I32|G3	},
+{"nop",     "",         0x00000000, 0xffffffff, 0,              	I1      },
+{"ssnop",   "",         0x00000040, 0xffffffff, 0,              	I32	},
+{"li",      "t,j",      0x24000000, 0xffe00000, WR_t,			I1	}, /* addiu */
+{"li",	    "t,i",	0x34000000, 0xffe00000, WR_t,			I1	}, /* ori */
+{"li",      "t,I",	0,    (int) M_LI,	INSN_MACRO,		I1	},
+{"move",    "d,s",	0x00000025, 0xfc1f07ff,	WR_d|RD_s,		I1|G6	},/* or */
+{"move",    "d,s",	0x0000002d, 0xfc1f07ff, WR_d|RD_s,		I3	},/* daddu */
+{"move",    "d,s",	0x00000021, 0xfc1f07ff, WR_d|RD_s,		I1	},/* addu */
+{"move",    "d,s",	0x00000025, 0xfc1f07ff,	WR_d|RD_s,		I1	},/* or */
+{"b",       "p",	0x10000000, 0xffff0000,	UBD,			I1	},/* beq 0,0 */
+{"b",       "p",	0x04010000, 0xffff0000,	UBD,			I1	},/* bgez 0 */
+{"bal",     "p",	0x04110000, 0xffff0000,	UBD|WR_31,		I1	},/* bgezal 0*/
 
-{"abs",     "d,v",	0,    (int) M_ABS,	INSN_MACRO,	I1	},
-{"abs.s",   "D,V",	0x46000005, 0xffff003f,	WR_D|RD_S|FP_S,	I1	},
-{"abs.d",   "D,V",	0x46200005, 0xffff003f,	WR_D|RD_S|FP_D,	I1	},
-{"abs.ps",  "D,V",	0x46c00005, 0xffff003f,	WR_D|RD_S|FP_D,	I5	},
-{"add",     "d,v,t",	0x00000020, 0xfc0007ff,	WR_d|RD_s|RD_t,	I1	},
-{"add",     "t,r,I",	0,    (int) M_ADD_I,	INSN_MACRO,	I1	},
-{"add.s",   "D,V,T",	0x46000000, 0xffe0003f,	WR_D|RD_S|RD_T|FP_S,	I1},
-{"add.d",   "D,V,T",	0x46200000, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I1},
-{"add.ps",  "D,V,T",	0x46c00000, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I5},
-{"addi",    "t,r,j",	0x20000000, 0xfc000000,	WR_t|RD_s,	I1	},
-{"addiu",   "t,r,j",	0x24000000, 0xfc000000,	WR_t|RD_s,	I1	},
-{"addu",    "d,v,t",	0x00000021, 0xfc0007ff,	WR_d|RD_s|RD_t,	I1	},
-{"addu",    "t,r,I",	0,    (int) M_ADDU_I,	INSN_MACRO,	I1	},
-{"alnv.ps", "D,V,T,s",	0x4c00001e, 0xfc00003f,	WR_D|RD_S|RD_T|FP_D,	I5},
-{"and",     "d,v,t",	0x00000024, 0xfc0007ff,	WR_d|RD_s|RD_t,	I1	},
-{"and",     "t,r,I",	0,    (int) M_AND_I,	INSN_MACRO,	I1	},
-{"andi",    "t,r,i",	0x30000000, 0xfc000000,	WR_t|RD_s,	I1	},
+{"abs",     "d,v",	0,    (int) M_ABS,	INSN_MACRO,		I1	},
+{"abs.s",   "D,V",	0x46000005, 0xffff003f,	WR_D|RD_S|FP_S,		I1	},
+{"abs.d",   "D,V",	0x46200005, 0xffff003f,	WR_D|RD_S|FP_D,		I1	},
+{"abs.ps",  "D,V",	0x46c00005, 0xffff003f,	WR_D|RD_S|FP_D,		I5	},
+{"add",     "d,v,t",	0x00000020, 0xfc0007ff,	WR_d|RD_s|RD_t,		I1	},
+{"add",     "t,r,I",	0,    (int) M_ADD_I,	INSN_MACRO,		I1	},
+{"add.s",   "D,V,T",	0x46000000, 0xffe0003f,	WR_D|RD_S|RD_T|FP_S,	I1	},
+{"add.d",   "D,V,T",	0x46200000, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I1	},
+{"add.ps",  "D,V,T",	0x46c00000, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I5	},
+{"addi",    "t,r,j",	0x20000000, 0xfc000000,	WR_t|RD_s,		I1	},
+{"addiu",   "t,r,j",	0x24000000, 0xfc000000,	WR_t|RD_s,		I1	},
+{"addu",    "d,v,t",	0x00000021, 0xfc0007ff,	WR_d|RD_s|RD_t,		I1	},
+{"addu",    "t,r,I",	0,    (int) M_ADDU_I,	INSN_MACRO,		I1	},
+{"alnv.ps", "D,V,T,s",	0x4c00001e, 0xfc00003f,	WR_D|RD_S|RD_T|FP_D,	I5	},
+{"and",     "d,v,t",	0x00000024, 0xfc0007ff,	WR_d|RD_s|RD_t,		I1	},
+{"and",     "t,r,I",	0,    (int) M_AND_I,	INSN_MACRO,		I1	},
+{"andi",    "t,r,i",	0x30000000, 0xfc000000,	WR_t|RD_s,		I1	},
 /* b is at the top of the table.  */
 /* bal is at the top of the table.  */
-{"bc0f",    "p",	0x41000000, 0xffff0000,	CBD|RD_CC,	I1	},
-{"bc0fl",   "p",	0x41020000, 0xffff0000,	CBL|RD_CC,	I2|T3	},
-{"bc1f",    "p",	0x45000000, 0xffff0000,	CBD|RD_CC|FP_S,	I1|M1	},
-{"bc1f",    "N,p",	0x45000000, 0xffe30000,	CBD|RD_CC|FP_S,	I4|M1	},
-{"bc1fl",   "p",	0x45020000, 0xffff0000,	CBL|RD_CC|FP_S,	I2|T3|M1},
-{"bc1fl",   "N,p",	0x45020000, 0xffe30000,	CBL|RD_CC|FP_S,	I4|M1	},
-{"bc2f",    "p",	0x49000000, 0xffff0000,	CBD|RD_CC,	I1	},
-{"bc2fl",   "p",	0x49020000, 0xffff0000,	CBL|RD_CC,	I2|T3	},
-{"bc3f",    "p",	0x4d000000, 0xffff0000,	CBD|RD_CC,	I1	},
-{"bc3fl",   "p",	0x4d020000, 0xffff0000,	CBL|RD_CC,	I2|T3	},
-{"bc0t",    "p",	0x41010000, 0xffff0000,	CBD|RD_CC,	I1	},
-{"bc0tl",   "p",	0x41030000, 0xffff0000,	CBL|RD_CC,	I2|T3	},
-{"bc1t",    "p",	0x45010000, 0xffff0000,	CBD|RD_CC|FP_S,	I1	},
-{"bc1t",    "N,p",	0x45010000, 0xffe30000,	CBD|RD_CC|FP_S,	I4|M1	},
-{"bc1tl",   "p",	0x45030000, 0xffff0000,	CBL|RD_CC|FP_S,	I2|T3	},
-{"bc1tl",   "N,p",	0x45030000, 0xffe30000,	CBL|RD_CC|FP_S,	I4|M1	},
-{"bc2t",    "p",	0x49010000, 0xffff0000,	CBD|RD_CC,	I1	},
-{"bc2tl",   "p",	0x49030000, 0xffff0000,	CBL|RD_CC,	I2|T3	},
-{"bc3t",    "p",	0x4d010000, 0xffff0000,	CBD|RD_CC,	I1	},
-{"bc3tl",   "p",	0x4d030000, 0xffff0000,	CBL|RD_CC,	I2|T3	},
-{"beqz",    "s,p",	0x10000000, 0xfc1f0000,	CBD|RD_s,	I1	},
-{"beqzl",   "s,p",	0x50000000, 0xfc1f0000,	CBL|RD_s,	I2|T3	},
-{"beq",     "s,t,p",	0x10000000, 0xfc000000,	CBD|RD_s|RD_t,	I1	},
-{"beq",     "s,I,p",	0,    (int) M_BEQ_I,	INSN_MACRO,	I1	},
-{"beql",    "s,t,p",	0x50000000, 0xfc000000,	CBL|RD_s|RD_t,	I2|T3	},
-{"beql",    "s,I,p",	0,    (int) M_BEQL_I,	INSN_MACRO,	I2	},
-{"bge",     "s,t,p",	0,    (int) M_BGE,	INSN_MACRO,	I1	},
-{"bge",     "s,I,p",	0,    (int) M_BGE_I,	INSN_MACRO,	I1	},
-{"bgel",    "s,t,p",	0,    (int) M_BGEL,	INSN_MACRO,	I2	},
-{"bgel",    "s,I,p",	0,    (int) M_BGEL_I,	INSN_MACRO,	I2	},
-{"bgeu",    "s,t,p",	0,    (int) M_BGEU,	INSN_MACRO,	I1	},
-{"bgeu",    "s,I,p",	0,    (int) M_BGEU_I,	INSN_MACRO,	I1	},
-{"bgeul",   "s,t,p",	0,    (int) M_BGEUL,	INSN_MACRO,	I2	},
-{"bgeul",   "s,I,p",	0,    (int) M_BGEUL_I,	INSN_MACRO,	I2	},
-{"bgez",    "s,p",	0x04010000, 0xfc1f0000,	CBD|RD_s,	I1	},
-{"bgezl",   "s,p",	0x04030000, 0xfc1f0000,	CBL|RD_s,	I2|T3	},
-{"bgezal",  "s,p",	0x04110000, 0xfc1f0000,	CBD|RD_s|WR_31,	I1	},
-{"bgezall", "s,p",	0x04130000, 0xfc1f0000,	CBL|RD_s,	I2|T3	},
-{"bgt",     "s,t,p",	0,    (int) M_BGT,	INSN_MACRO,	I1	},
-{"bgt",     "s,I,p",	0,    (int) M_BGT_I,	INSN_MACRO,	I1	},
-{"bgtl",    "s,t,p",	0,    (int) M_BGTL,	INSN_MACRO,	I2	},
-{"bgtl",    "s,I,p",	0,    (int) M_BGTL_I,	INSN_MACRO,	I2	},
-{"bgtu",    "s,t,p",	0,    (int) M_BGTU,	INSN_MACRO,	I1	},
-{"bgtu",    "s,I,p",	0,    (int) M_BGTU_I,	INSN_MACRO,	I1	},
-{"bgtul",   "s,t,p",	0,    (int) M_BGTUL,	INSN_MACRO,	I2	},
-{"bgtul",   "s,I,p",	0,    (int) M_BGTUL_I,	INSN_MACRO,	I2	},
-{"bgtz",    "s,p",	0x1c000000, 0xfc1f0000,	CBD|RD_s,	I1	},
-{"bgtzl",   "s,p",	0x5c000000, 0xfc1f0000,	CBL|RD_s,	I2|T3	},
-{"ble",     "s,t,p",	0,    (int) M_BLE,	INSN_MACRO,	I1	},
-{"ble",     "s,I,p",	0,    (int) M_BLE_I,	INSN_MACRO,	I1	},
-{"blel",    "s,t,p",	0,    (int) M_BLEL,	INSN_MACRO,	I2	},
-{"blel",    "s,I,p",	0,    (int) M_BLEL_I,	INSN_MACRO,	I2	},
-{"bleu",    "s,t,p",	0,    (int) M_BLEU,	INSN_MACRO,	I1	},
-{"bleu",    "s,I,p",	0,    (int) M_BLEU_I,	INSN_MACRO,	I1	},
-{"bleul",   "s,t,p",	0,    (int) M_BLEUL,	INSN_MACRO,	I2	},
-{"bleul",   "s,I,p",	0,    (int) M_BLEUL_I,	INSN_MACRO,	I2	},
-{"blez",    "s,p",	0x18000000, 0xfc1f0000,	CBD|RD_s,	I1	},
-{"blezl",   "s,p",	0x58000000, 0xfc1f0000,	CBL|RD_s,	I2|T3	},
-{"blt",     "s,t,p",	0,    (int) M_BLT,	INSN_MACRO,	I1	},
-{"blt",     "s,I,p",	0,    (int) M_BLT_I,	INSN_MACRO,	I1	},
-{"bltl",    "s,t,p",	0,    (int) M_BLTL,	INSN_MACRO,	I2	},
-{"bltl",    "s,I,p",	0,    (int) M_BLTL_I,	INSN_MACRO,	I2	},
-{"bltu",    "s,t,p",	0,    (int) M_BLTU,	INSN_MACRO,	I1	},
-{"bltu",    "s,I,p",	0,    (int) M_BLTU_I,	INSN_MACRO,	I1	},
-{"bltul",   "s,t,p",	0,    (int) M_BLTUL,	INSN_MACRO,	I2	},
-{"bltul",   "s,I,p",	0,    (int) M_BLTUL_I,	INSN_MACRO,	I2	},
-{"bltz",    "s,p",	0x04000000, 0xfc1f0000,	CBD|RD_s,	I1	},
-{"bltzl",   "s,p",	0x04020000, 0xfc1f0000,	CBL|RD_s,	I2|T3	},
-{"bltzal",  "s,p",	0x04100000, 0xfc1f0000,	CBD|RD_s|WR_31,	I1	},
-{"bltzall", "s,p",	0x04120000, 0xfc1f0000,	CBL|RD_s,	I2|T3	},
-{"bnez",    "s,p",	0x14000000, 0xfc1f0000,	CBD|RD_s,	I1	},
-{"bnezl",   "s,p",	0x54000000, 0xfc1f0000,	CBL|RD_s,	I2|T3	},
-{"bne",     "s,t,p",	0x14000000, 0xfc000000,	CBD|RD_s|RD_t,	I1	},
-{"bne",     "s,I,p",	0,    (int) M_BNE_I,	INSN_MACRO,	I1	},
-{"bnel",    "s,t,p",	0x54000000, 0xfc000000,	CBL|RD_s|RD_t, 	I2|T3	},
-{"bnel",    "s,I,p",	0,    (int) M_BNEL_I,	INSN_MACRO,	I2	},
-{"break",   "",		0x0000000d, 0xffffffff,	TRAP,		I1	},
-{"break",   "c",	0x0000000d, 0xfc00ffff,	TRAP,		I1	},
-{"break",   "c,q",	0x0000000d, 0xfc00003f,	TRAP,		I1	},
+{"bc0f",    "p",	0x41000000, 0xffff0000,	CBD|RD_CC,		I1	},
+{"bc0fl",   "p",	0x41020000, 0xffff0000,	CBL|RD_CC,		I2|T3	},
+{"bc1f",    "p",	0x45000000, 0xffff0000,	CBD|RD_CC|FP_S,		I1	},
+{"bc1f",    "N,p",      0x45000000, 0xffe30000, CBD|RD_CC|FP_S, 	I4|I32	},
+{"bc1fl",   "p",	0x45020000, 0xffff0000,	CBL|RD_CC|FP_S,		I2|T3	},
+{"bc1fl",   "N,p",      0x45020000, 0xffe30000, CBL|RD_CC|FP_S, 	I4|I32	},
+{"bc2f",    "p",	0x49000000, 0xffff0000,	CBD|RD_CC,		I1	},
+{"bc2fl",   "p",	0x49020000, 0xffff0000,	CBL|RD_CC,		I2|T3	},
+{"bc3f",    "p",	0x4d000000, 0xffff0000,	CBD|RD_CC,		I1	},
+{"bc3fl",   "p",	0x4d020000, 0xffff0000,	CBL|RD_CC,		I2|T3	},
+{"bc0t",    "p",	0x41010000, 0xffff0000,	CBD|RD_CC,		I1	},
+{"bc0tl",   "p",	0x41030000, 0xffff0000,	CBL|RD_CC,		I2|T3	},
+{"bc1t",    "p",	0x45010000, 0xffff0000,	CBD|RD_CC|FP_S,		I1	},
+{"bc1t",    "N,p",      0x45010000, 0xffe30000, CBD|RD_CC|FP_S, 	I4|I32	},
+{"bc1tl",   "p",	0x45030000, 0xffff0000,	CBL|RD_CC|FP_S,		I2|T3	},
+{"bc1tl",   "N,p",      0x45030000, 0xffe30000, CBL|RD_CC|FP_S, 	I4|I32	},
+{"bc2t",    "p",	0x49010000, 0xffff0000,	CBD|RD_CC,		I1	},
+{"bc2tl",   "p",	0x49030000, 0xffff0000,	CBL|RD_CC,		I2|T3	},
+{"bc3t",    "p",	0x4d010000, 0xffff0000,	CBD|RD_CC,		I1	},
+{"bc3tl",   "p",	0x4d030000, 0xffff0000,	CBL|RD_CC,		I2|T3	},
+{"beqz",    "s,p",	0x10000000, 0xfc1f0000,	CBD|RD_s,		I1	},
+{"beqzl",   "s,p",	0x50000000, 0xfc1f0000,	CBL|RD_s,		I2|T3	},
+{"beq",     "s,t,p",	0x10000000, 0xfc000000,	CBD|RD_s|RD_t,		I1	},
+{"beq",     "s,I,p",	0,    (int) M_BEQ_I,	INSN_MACRO,		I1	},
+{"beql",    "s,t,p",	0x50000000, 0xfc000000,	CBL|RD_s|RD_t,		I2|T3	},
+{"beql",    "s,I,p",	0,    (int) M_BEQL_I,	INSN_MACRO,		I2	},
+{"bge",     "s,t,p",	0,    (int) M_BGE,	INSN_MACRO,		I1	},
+{"bge",     "s,I,p",	0,    (int) M_BGE_I,	INSN_MACRO,		I1	},
+{"bgel",    "s,t,p",	0,    (int) M_BGEL,	INSN_MACRO,		I2	},
+{"bgel",    "s,I,p",	0,    (int) M_BGEL_I,	INSN_MACRO,		I2	},
+{"bgeu",    "s,t,p",	0,    (int) M_BGEU,	INSN_MACRO,		I1	},
+{"bgeu",    "s,I,p",	0,    (int) M_BGEU_I,	INSN_MACRO,		I1	},
+{"bgeul",   "s,t,p",	0,    (int) M_BGEUL,	INSN_MACRO,		I2	},
+{"bgeul",   "s,I,p",	0,    (int) M_BGEUL_I,	INSN_MACRO,		I2	},
+{"bgez",    "s,p",	0x04010000, 0xfc1f0000,	CBD|RD_s,		I1	},
+{"bgezl",   "s,p",	0x04030000, 0xfc1f0000,	CBL|RD_s,		I2|T3	},
+{"bgezal",  "s,p",	0x04110000, 0xfc1f0000,	CBD|RD_s|WR_31,		I1	},
+{"bgezall", "s,p",	0x04130000, 0xfc1f0000,	CBL|RD_s,		I2|T3	},
+{"bgt",     "s,t,p",	0,    (int) M_BGT,	INSN_MACRO,		I1	},
+{"bgt",     "s,I,p",	0,    (int) M_BGT_I,	INSN_MACRO,		I1	},
+{"bgtl",    "s,t,p",	0,    (int) M_BGTL,	INSN_MACRO,		I2	},
+{"bgtl",    "s,I,p",	0,    (int) M_BGTL_I,	INSN_MACRO,		I2	},
+{"bgtu",    "s,t,p",	0,    (int) M_BGTU,	INSN_MACRO,		I1	},
+{"bgtu",    "s,I,p",	0,    (int) M_BGTU_I,	INSN_MACRO,		I1	},
+{"bgtul",   "s,t,p",	0,    (int) M_BGTUL,	INSN_MACRO,		I2	},
+{"bgtul",   "s,I,p",	0,    (int) M_BGTUL_I,	INSN_MACRO,		I2	},
+{"bgtz",    "s,p",	0x1c000000, 0xfc1f0000,	CBD|RD_s,		I1	},
+{"bgtzl",   "s,p",	0x5c000000, 0xfc1f0000,	CBL|RD_s,		I2|T3	},
+{"ble",     "s,t,p",	0,    (int) M_BLE,	INSN_MACRO,		I1	},
+{"ble",     "s,I,p",	0,    (int) M_BLE_I,	INSN_MACRO,		I1	},
+{"blel",    "s,t,p",	0,    (int) M_BLEL,	INSN_MACRO,		I2	},
+{"blel",    "s,I,p",	0,    (int) M_BLEL_I,	INSN_MACRO,		I2	},
+{"bleu",    "s,t,p",	0,    (int) M_BLEU,	INSN_MACRO,		I1	},
+{"bleu",    "s,I,p",	0,    (int) M_BLEU_I,	INSN_MACRO,		I1	},
+{"bleul",   "s,t,p",	0,    (int) M_BLEUL,	INSN_MACRO,		I2	},
+{"bleul",   "s,I,p",	0,    (int) M_BLEUL_I,	INSN_MACRO,		I2	},
+{"blez",    "s,p",	0x18000000, 0xfc1f0000,	CBD|RD_s,		I1	},
+{"blezl",   "s,p",	0x58000000, 0xfc1f0000,	CBL|RD_s,		I2|T3	},
+{"blt",     "s,t,p",	0,    (int) M_BLT,	INSN_MACRO,		I1	},
+{"blt",     "s,I,p",	0,    (int) M_BLT_I,	INSN_MACRO,		I1	},
+{"bltl",    "s,t,p",	0,    (int) M_BLTL,	INSN_MACRO,		I2	},
+{"bltl",    "s,I,p",	0,    (int) M_BLTL_I,	INSN_MACRO,		I2	},
+{"bltu",    "s,t,p",	0,    (int) M_BLTU,	INSN_MACRO,		I1	},
+{"bltu",    "s,I,p",	0,    (int) M_BLTU_I,	INSN_MACRO,		I1	},
+{"bltul",   "s,t,p",	0,    (int) M_BLTUL,	INSN_MACRO,		I2	},
+{"bltul",   "s,I,p",	0,    (int) M_BLTUL_I,	INSN_MACRO,		I2	},
+{"bltz",    "s,p",	0x04000000, 0xfc1f0000,	CBD|RD_s,		I1	},
+{"bltzl",   "s,p",	0x04020000, 0xfc1f0000,	CBL|RD_s,		I2|T3	},
+{"bltzal",  "s,p",	0x04100000, 0xfc1f0000,	CBD|RD_s|WR_31,		I1	},
+{"bltzall", "s,p",	0x04120000, 0xfc1f0000,	CBL|RD_s,		I2|T3	},
+{"bnez",    "s,p",	0x14000000, 0xfc1f0000,	CBD|RD_s,		I1	},
+{"bnezl",   "s,p",	0x54000000, 0xfc1f0000,	CBL|RD_s,		I2|T3	},
+{"bne",     "s,t,p",	0x14000000, 0xfc000000,	CBD|RD_s|RD_t,		I1	},
+{"bne",     "s,I,p",	0,    (int) M_BNE_I,	INSN_MACRO,		I1	},
+{"bnel",    "s,t,p",	0x54000000, 0xfc000000,	CBL|RD_s|RD_t, 		I2|T3	},
+{"bnel",    "s,I,p",	0,    (int) M_BNEL_I,	INSN_MACRO,		I2	},
+{"break",   "",		0x0000000d, 0xffffffff,	TRAP,			I1	},
+{"break",   "B",        0x0000000d, 0xfc00003f, TRAP,           	I32     },
+{"break",   "c",	0x0000000d, 0xfc00ffff,	TRAP,			I1	},
+{"break",   "c,q",	0x0000000d, 0xfc00003f,	TRAP,			I1	},
 {"c.f.d",   "S,T",	0x46200030, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.f.d",   "M,S,T",	0x46200030, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
-{"c.f.s",   "S,T",	0x46000030, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.f.s",   "M,S,T",	0x46000030, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
+{"c.f.d",   "M,S,T",    0x46200030, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
+{"c.f.s",   "S,T",      0x46000030, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S,   I1      },
+{"c.f.s",   "M,S,T",    0x46000030, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
 {"c.f.ps",  "S,T",	0x46c00030, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.f.ps",  "M,S,T",	0x46c00030, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.un.d",  "S,T",	0x46200031, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.un.d",  "M,S,T",	0x46200031, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
-{"c.un.s",  "S,T",	0x46000031, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.un.s",  "M,S,T",	0x46000031, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
+{"c.un.d",  "M,S,T",    0x46200031, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
+{"c.un.s",  "S,T",      0x46000031, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S,   I1      },
+{"c.un.s",  "M,S,T",    0x46000031, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
 {"c.un.ps", "S,T",	0x46c00031, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.un.ps", "M,S,T",	0x46c00031, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.eq.d",  "S,T",	0x46200032, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.eq.d",  "M,S,T",	0x46200032, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
-{"c.eq.s",  "S,T",	0x46000032, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.eq.s",  "M,S,T",	0x46000032, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
+{"c.eq.d",  "M,S,T",    0x46200032, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
+{"c.eq.s",  "S,T",      0x46000032, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S,   I1      },
+{"c.eq.s",  "M,S,T",    0x46000032, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
 {"c.eq.ps", "S,T",	0x46c00032, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.eq.ps", "M,S,T",	0x46c00032, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.ueq.d", "S,T",	0x46200033, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.ueq.d", "M,S,T",	0x46200033, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
-{"c.ueq.s", "S,T",	0x46000033, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.ueq.s", "M,S,T",	0x46000033, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
+{"c.ueq.d", "M,S,T",    0x46200033, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
+{"c.ueq.s", "S,T",      0x46000033, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S,   I1      },
+{"c.ueq.s", "M,S,T",    0x46000033, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
 {"c.ueq.ps","S,T",	0x46c00033, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.ueq.ps","M,S,T",	0x46c00033, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.lt.s",  "S,T",	0x4600003c, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.lt.s",  "M,S,T",	0x4600003c, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
-{"c.olt.d", "S,T",	0x46200034, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.olt.d", "M,S,T",	0x46200034, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
+{"c.lt.s",  "M,S,T",    0x4600003c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
+{"c.olt.d", "S,T",      0x46200034, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D,   I1      },
+{"c.olt.d", "M,S,T",    0x46200034, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
 {"c.olt.s", "S,T",	0x46000034, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.olt.s", "M,S,T",	0x46000034, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
+{"c.olt.s", "M,S,T",    0x46000034, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
 {"c.olt.ps","S,T",	0x46c00034, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.olt.ps","M,S,T",	0x46c00034, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.ult.d", "S,T",	0x46200035, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.ult.d", "M,S,T",	0x46200035, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
-{"c.ult.s", "S,T",	0x46000035, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.ult.s", "M,S,T",	0x46000035, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
+{"c.ult.d", "M,S,T",    0x46200035, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
+{"c.ult.s", "S,T",      0x46000035, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S,   I1      },
+{"c.ult.s", "M,S,T",    0x46000035, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
 {"c.ult.ps","S,T",	0x46c00035, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.ult.ps","M,S,T",	0x46c00035, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.le.s",  "S,T",	0x4600003e, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.le.s",  "M,S,T",	0x4600003e, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
-{"c.ole.d", "S,T",	0x46200036, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.ole.d", "M,S,T",	0x46200036, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
-{"c.ole.s", "S,T",	0x46000036, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.ole.s", "M,S,T",	0x46000036, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
+{"c.le.s",  "M,S,T",    0x4600003e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
+{"c.ole.d", "S,T",      0x46200036, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D,   I1      },
+{"c.ole.d", "M,S,T",    0x46200036, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
+{"c.ole.s", "S,T",      0x46000036, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S,   I1      },
+{"c.ole.s", "M,S,T",    0x46000036, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
 {"c.ole.ps","S,T",	0x46c00036, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.ole.ps","M,S,T",	0x46c00036, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.ule.d", "S,T",	0x46200037, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.ule.d", "M,S,T",	0x46200037, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
-{"c.ule.s", "S,T",	0x46000037, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.ule.s", "M,S,T",	0x46000037, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
+{"c.ule.d", "M,S,T",    0x46200037, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
+{"c.ule.s", "S,T",      0x46000037, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S,   I1      },
+{"c.ule.s", "M,S,T",    0x46000037, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
 {"c.ule.ps","S,T",	0x46c00037, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.ule.ps","M,S,T",	0x46c00037, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.sf.d",  "S,T",	0x46200038, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.sf.d",  "M,S,T",	0x46200038, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
-{"c.sf.s",  "S,T",	0x46000038, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.sf.s",  "M,S,T",	0x46000038, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
+{"c.sf.d",  "M,S,T",    0x46200038, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
+{"c.sf.s",  "S,T",      0x46000038, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S,   I1      },
+{"c.sf.s",  "M,S,T",    0x46000038, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
 {"c.sf.ps", "S,T",	0x46c00038, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.sf.ps", "M,S,T",	0x46c00038, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.ngle.d","S,T",	0x46200039, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.ngle.d","M,S,T",	0x46200039, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
-{"c.ngle.s","S,T",	0x46000039, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.ngle.s","M,S,T",	0x46000039, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
+{"c.ngle.d","M,S,T",    0x46200039, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
+{"c.ngle.s","S,T",      0x46000039, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S,   I1      },
+{"c.ngle.s","M,S,T",    0x46000039, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
 {"c.ngle.ps","S,T",	0x46c00039, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.ngle.ps","M,S,T",	0x46c00039, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.seq.d", "S,T",	0x4620003a, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.seq.d", "M,S,T",	0x4620003a, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
-{"c.seq.s", "S,T",	0x4600003a, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.seq.s", "M,S,T",	0x4600003a, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
+{"c.seq.d", "M,S,T",    0x4620003a, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
+{"c.seq.s", "S,T",      0x4600003a, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S,   I1      },
+{"c.seq.s", "M,S,T",    0x4600003a, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
 {"c.seq.ps","S,T",	0x46c0003a, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.seq.ps","M,S,T",	0x46c0003a, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.ngl.d", "S,T",	0x4620003b, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.ngl.d", "M,S,T",	0x4620003b, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
-{"c.ngl.s", "S,T",	0x4600003b, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.ngl.s", "M,S,T",	0x4600003b, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
+{"c.ngl.d", "M,S,T",    0x4620003b, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
+{"c.ngl.s", "S,T",      0x4600003b, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S,   I1      },
+{"c.ngl.s", "M,S,T",    0x4600003b, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
 {"c.ngl.ps","S,T",	0x46c0003b, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.ngl.ps","M,S,T",	0x46c0003b, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.lt.d",  "S,T",	0x4620003c, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.lt.d",  "M,S,T",	0x4620003c, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
+{"c.lt.d",  "M,S,T",    0x4620003c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
 {"c.lt.ps", "S,T",	0x46c0003c, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.lt.ps", "M,S,T",	0x46c0003c, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.nge.d", "S,T",	0x4620003d, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.nge.d", "M,S,T",	0x4620003d, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
-{"c.nge.s", "S,T",	0x4600003d, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.nge.s", "M,S,T",	0x4600003d, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
+{"c.nge.d", "M,S,T",    0x4620003d, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
+{"c.nge.s", "S,T",      0x4600003d, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S,   I1      },
+{"c.nge.s", "M,S,T",    0x4600003d, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
 {"c.nge.ps","S,T",	0x46c0003d, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.nge.ps","M,S,T",	0x46c0003d, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.le.d",  "S,T",	0x4620003e, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.le.d",  "M,S,T",	0x4620003e, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
+{"c.le.d",  "M,S,T",    0x4620003e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
 {"c.le.ps", "S,T",	0x46c0003e, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.le.ps", "M,S,T",	0x46c0003e, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.ngt.d", "S,T",	0x4620003f, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I1	},
-{"c.ngt.d", "M,S,T",	0x4620003f, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I4|M1	},
-{"c.ngt.s", "S,T",	0x4600003f, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_S,	I1	},
-{"c.ngt.s", "M,S,T",	0x4600003f, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_S,	I4|M1	},
+{"c.ngt.d", "M,S,T",    0x4620003f, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D,   I4|I32	},
+{"c.ngt.s", "S,T",      0x4600003f, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S,   I1      },
+{"c.ngt.s", "M,S,T",    0x4600003f, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S,   I4|I32	},
 {"c.ngt.ps","S,T",	0x46c0003f, 0xffe007ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
 {"c.ngt.ps","M,S,T",	0x46c0003f, 0xffe000ff,	RD_S|RD_T|WR_CC|FP_D,	I5	},
-{"cache",   "k,o(b)",	0xbc000000, 0xfc000000, RD_b,		I3|T3|M1	},
-{"ceil.l.d", "D,S",	0x4620000a, 0xffff003f, WR_D|RD_S|FP_D,	I3	},
-{"ceil.l.s", "D,S",	0x4600000a, 0xffff003f, WR_D|RD_S|FP_S,	I3	},
-{"ceil.w.d", "D,S",	0x4620000e, 0xffff003f, WR_D|RD_S|FP_D,	I2	},
-{"ceil.w.s", "D,S",	0x4600000e, 0xffff003f, WR_D|RD_S|FP_S,	I2	},
-{"cfc0",    "t,G",	0x40400000, 0xffe007ff,	LCD|WR_t|RD_C0,	I1	},
+{"cache",   "k,o(b)",   0xbc000000, 0xfc000000, RD_b,           	I3|I32|T3},
+{"ceil.l.d", "D,S",	0x4620000a, 0xffff003f, WR_D|RD_S|FP_D,		I3	},
+{"ceil.l.s", "D,S",	0x4600000a, 0xffff003f, WR_D|RD_S|FP_S,		I3	},
+{"ceil.w.d", "D,S",	0x4620000e, 0xffff003f, WR_D|RD_S|FP_D,		I2	},
+{"ceil.w.s", "D,S",	0x4600000e, 0xffff003f, WR_D|RD_S|FP_S,		I2	},
+{"cfc0",    "t,G",	0x40400000, 0xffe007ff,	LCD|WR_t|RD_C0,		I1	},
 {"cfc1",    "t,G",	0x44400000, 0xffe007ff,	LCD|WR_t|RD_C1|FP_S,	I1	},
 {"cfc1",    "t,S",	0x44400000, 0xffe007ff,	LCD|WR_t|RD_C1|FP_S,	I1	},
-{"cfc2",    "t,G",	0x48400000, 0xffe007ff,	LCD|WR_t|RD_C2,	I1	},
-{"cfc3",    "t,G",	0x4c400000, 0xffe007ff,	LCD|WR_t|RD_C3,	I1	},
-{"ctc0",    "t,G",	0x40c00000, 0xffe007ff,	COD|RD_t|WR_CC,	I1	},
+{"cfc2",    "t,G",	0x48400000, 0xffe007ff,	LCD|WR_t|RD_C2,		I1	},
+{"cfc3",    "t,G",	0x4c400000, 0xffe007ff,	LCD|WR_t|RD_C3,		I1	},
+{"clo",     "U,s",      0x70000021, 0xfc0007ff, WR_d|WR_t|RD_s, 	I32     },
+{"clz",     "U,s",      0x70000020, 0xfc0007ff, WR_d|WR_t|RD_s, 	I32     },
+{"ctc0",    "t,G",	0x40c00000, 0xffe007ff,	COD|RD_t|WR_CC,		I1	},
 {"ctc1",    "t,G",	0x44c00000, 0xffe007ff,	COD|RD_t|WR_CC|FP_S,	I1	},
 {"ctc1",    "t,S",	0x44c00000, 0xffe007ff,	COD|RD_t|WR_CC|FP_S,	I1	},
-{"ctc2",    "t,G",	0x48c00000, 0xffe007ff,	COD|RD_t|WR_CC,	I1	},
-{"ctc3",    "t,G",	0x4cc00000, 0xffe007ff,	COD|RD_t|WR_CC,	I1	},
-{"cvt.d.l", "D,S",	0x46a00021, 0xffff003f,	WR_D|RD_S|FP_D,	I3	},
+{"ctc2",    "t,G",	0x48c00000, 0xffe007ff,	COD|RD_t|WR_CC,		I1	},
+{"ctc3",    "t,G",	0x4cc00000, 0xffe007ff,	COD|RD_t|WR_CC,		I1	},
+{"cvt.d.l", "D,S",	0x46a00021, 0xffff003f,	WR_D|RD_S|FP_D,		I3	},
 {"cvt.d.s", "D,S",	0x46000021, 0xffff003f,	WR_D|RD_S|FP_D|FP_S,	I1	},
-{"cvt.d.w", "D,S",	0x46800021, 0xffff003f,	WR_D|RD_S|FP_D,	I1	},
-{"cvt.l.d", "D,S",	0x46200025, 0xffff003f,	WR_D|RD_S|FP_D,	I3	},
-{"cvt.l.s", "D,S",	0x46000025, 0xffff003f,	WR_D|RD_S|FP_S,	I3	},
-{"cvt.s.l", "D,S",	0x46a00020, 0xffff003f,	WR_D|RD_S|FP_S,	I3	},
+{"cvt.d.w", "D,S",	0x46800021, 0xffff003f,	WR_D|RD_S|FP_D,		I1	},
+{"cvt.l.d", "D,S",	0x46200025, 0xffff003f,	WR_D|RD_S|FP_D,		I3	},
+{"cvt.l.s", "D,S",	0x46000025, 0xffff003f,	WR_D|RD_S|FP_S,		I3	},
+{"cvt.s.l", "D,S",	0x46a00020, 0xffff003f,	WR_D|RD_S|FP_S,		I3	},
 {"cvt.s.d", "D,S",	0x46200020, 0xffff003f,	WR_D|RD_S|FP_S|FP_D,	I1	},
-{"cvt.s.w", "D,S",	0x46800020, 0xffff003f,	WR_D|RD_S|FP_S,	I1	},
+{"cvt.s.w", "D,S",	0x46800020, 0xffff003f,	WR_D|RD_S|FP_S,		I1	},
 {"cvt.s.pl","D,S",	0x46c00028, 0xffff003f,	WR_D|RD_S|FP_S|FP_D,	I5	},
 {"cvt.s.pu","D,S",	0x46c00020, 0xffff003f,	WR_D|RD_S|FP_S|FP_D,	I5	},
-{"cvt.w.d", "D,S",	0x46200024, 0xffff003f,	WR_D|RD_S|FP_D,	I1	},
-{"cvt.w.s", "D,S",	0x46000024, 0xffff003f,	WR_D|RD_S|FP_S,	I1	},
-{"cvt.ps.s","D,V,T",	0x46000026, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I5},
-{"dabs",    "d,v",	0,    (int) M_DABS,	INSN_MACRO,	I3	},
-{"dadd",    "d,v,t",	0x0000002c, 0xfc0007ff, WR_d|RD_s|RD_t,	I3	},
-{"dadd",    "t,r,I",	0,    (int) M_DADD_I,	INSN_MACRO,	I3	},
-{"daddi",   "t,r,j",	0x60000000, 0xfc000000, WR_t|RD_s,	I3	},
-{"daddiu",  "t,r,j",	0x64000000, 0xfc000000, WR_t|RD_s,	I3	},
-{"daddu",   "d,v,t",	0x0000002d, 0xfc0007ff, WR_d|RD_s|RD_t,	I3	},
-{"daddu",   "t,r,I",	0,    (int) M_DADDU_I,	INSN_MACRO,	I3	},
+{"cvt.w.d", "D,S",	0x46200024, 0xffff003f,	WR_D|RD_S|FP_D,		I1	},
+{"cvt.w.s", "D,S",	0x46000024, 0xffff003f,	WR_D|RD_S|FP_S,		I1	},
+{"cvt.ps.s","D,V,T",	0x46000026, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I5	},
+{"dabs",    "d,v",	0,    (int) M_DABS,	INSN_MACRO,		I3	},
+{"dadd",    "d,v,t",	0x0000002c, 0xfc0007ff, WR_d|RD_s|RD_t,		I3	},
+{"dadd",    "t,r,I",	0,    (int) M_DADD_I,	INSN_MACRO,		I3	},
+{"daddi",   "t,r,j",	0x60000000, 0xfc000000, WR_t|RD_s,		I3	},
+{"daddiu",  "t,r,j",	0x64000000, 0xfc000000, WR_t|RD_s,		I3	},
+{"daddu",   "d,v,t",	0x0000002d, 0xfc0007ff, WR_d|RD_s|RD_t,		I3	},
+{"daddu",   "t,r,I",	0,    (int) M_DADDU_I,	INSN_MACRO,		I3	},
+{"dclo",    "U,s",      0x70000025, 0xfc0007ff, RD_s|WR_d|WR_t, 	I64     },
+{"dclz",    "U,s",      0x70000024, 0xfc0007ff, RD_s|WR_d|WR_t, 	I64     },
 /* dctr and dctw are used on the r5000.  */
-{"dctr",    "o(b)",	0xbc050000, 0xfc1f0000, RD_b,	I3	},
-{"dctw",    "o(b)",	0xbc090000, 0xfc1f0000, RD_b,	I3	},
-{"deret",   "",         0x4200001f, 0xffffffff,    0,	G2|M1	},
+{"dctr",    "o(b)",	0xbc050000, 0xfc1f0000, RD_b,			I3	},
+{"dctw",    "o(b)",	0xbc090000, 0xfc1f0000, RD_b,			I3	},
+{"deret",   "",         0x4200001f, 0xffffffff, 0, 			I32|G2	},
 /* For ddiv, see the comments about div.  */
-{"ddiv",    "z,s,t",	0x0000001e, 0xfc00ffff, RD_s|RD_t|WR_HI|WR_LO,	I3	},
-{"ddiv",    "d,v,t",	0,    (int) M_DDIV_3,	INSN_MACRO,	I3	},
-{"ddiv",    "d,v,I",	0,    (int) M_DDIV_3I,	INSN_MACRO,	I3	},
+{"ddiv",    "z,s,t",    0x0000001e, 0xfc00ffff, RD_s|RD_t|WR_HILO,      I3      },
+{"ddiv",    "d,v,t",	0,    (int) M_DDIV_3,	INSN_MACRO,		I3	},
+{"ddiv",    "d,v,I",	0,    (int) M_DDIV_3I,	INSN_MACRO,		I3	},
 /* For ddivu, see the comments about div.  */
-{"ddivu",   "z,s,t",	0x0000001f, 0xfc00ffff, RD_s|RD_t|WR_HI|WR_LO,	I3	},
-{"ddivu",   "d,v,t",	0,    (int) M_DDIVU_3,	INSN_MACRO,	I3	},
-{"ddivu",   "d,v,I",	0,    (int) M_DDIVU_3I,	INSN_MACRO,	I3	},
+{"ddivu",   "z,s,t",    0x0000001f, 0xfc00ffff, RD_s|RD_t|WR_HILO,      I3      },
+{"ddivu",   "d,v,t",	0,    (int) M_DDIVU_3,	INSN_MACRO,		I3	},
+{"ddivu",   "d,v,I",	0,    (int) M_DDIVU_3I,	INSN_MACRO,		I3	},
 /* The MIPS assembler treats the div opcode with two operands as
    though the first operand appeared twice (the first operand is both
    a source and a destination).  To get the div machine instruction,
    you must use an explicit destination of $0.  */
-{"div",     "z,s,t",	0x0000001a, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO,	I1	},
-{"div",     "z,t",	0x0000001a, 0xffe0ffff,	RD_s|RD_t|WR_HI|WR_LO,	I1	},
-{"div",     "d,v,t",	0,    (int) M_DIV_3,	INSN_MACRO,	I1	},
-{"div",     "d,v,I",	0,    (int) M_DIV_3I,	INSN_MACRO,	I1	},
+{"div",     "z,s,t",    0x0000001a, 0xfc00ffff, RD_s|RD_t|WR_HILO,      I1      },
+{"div",     "z,t",      0x0000001a, 0xffe0ffff, RD_s|RD_t|WR_HILO,      I1      },
+{"div",     "d,v,t",	0,    (int) M_DIV_3,	INSN_MACRO,		I1	},
+{"div",     "d,v,I",	0,    (int) M_DIV_3I,	INSN_MACRO,		I1	},
 {"div.d",   "D,V,T",	0x46200003, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I1	},
 {"div.s",   "D,V,T",	0x46000003, 0xffe0003f,	WR_D|RD_S|RD_T|FP_S,	I1	},
 /* For divu, see the comments about div.  */
-{"divu",    "z,s,t",	0x0000001b, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO,	I1	},
-{"divu",    "z,t",	0x0000001b, 0xffe0ffff,	RD_s|RD_t|WR_HI|WR_LO,	I1	},
-{"divu",    "d,v,t",	0,    (int) M_DIVU_3,	INSN_MACRO,	I1	},
-{"divu",    "d,v,I",	0,    (int) M_DIVU_3I,	INSN_MACRO,	I1	},
-{"dla",     "t,o(b)",	0x64000000, 0xfc000000, WR_t|RD_s,	I3	}, /* daddiu */
-{"dla",     "t,A(b)",	0,    (int) M_DLA_AB,	INSN_MACRO,	I3	},
-{"dli",     "t,j",      0x24000000, 0xffe00000, WR_t,	I3	}, /* addiu */
-{"dli",	    "t,i",	0x34000000, 0xffe00000, WR_t,	I3	}, /* ori */
-{"dli",     "t,I",	0,    (int) M_DLI,	INSN_MACRO,	I3	},
+{"divu",    "z,s,t",    0x0000001b, 0xfc00ffff, RD_s|RD_t|WR_HILO,      I1      },
+{"divu",    "z,t",      0x0000001b, 0xffe0ffff, RD_s|RD_t|WR_HILO,      I1      },
+{"divu",    "d,v,t",	0,    (int) M_DIVU_3,	INSN_MACRO,		I1	},
+{"divu",    "d,v,I",	0,    (int) M_DIVU_3I,	INSN_MACRO,		I1	},
+{"dla",     "t,o(b)",	0x64000000, 0xfc000000, WR_t|RD_s,		I3	}, /* daddiu */
+{"dla",     "t,A(b)",	0,    (int) M_DLA_AB,	INSN_MACRO,		I3	},
+{"dli",     "t,j",      0x24000000, 0xffe00000, WR_t,			I3	}, /* addiu */
+{"dli",	    "t,i",	0x34000000, 0xffe00000, WR_t,			I3	}, /* ori */
+{"dli",     "t,I",	0,    (int) M_DLI,	INSN_MACRO,		I3	},
 
-{"dmadd16", "s,t",      0x00000029, 0xfc00ffff, RD_s|RD_t|WR_LO|RD_LO,	V1	},
-{"dmfc0",   "t,G",	0x40200000, 0xffe007ff, LCD|WR_t|RD_C0,	I3	},
+{"dmadd16", "s,t",      0x00000029, 0xfc00ffff, RD_s|RD_t|MOD_LO,       V1      },
+{"dmfc0",   "t,G",	0x40200000, 0xffe007ff, LCD|WR_t|RD_C0,		I3	},
+{"dmfc0",   "t,G,H",    0x40200000, 0xffe007f8, LCD|WR_t|RD_C0, 	I64     },
 {"dmtc0",   "t,G",	0x40a00000, 0xffe007ff, COD|RD_t|WR_C0|WR_CC,	I3	},
+{"dmtc0",   "t,G,H",    0x40a00000, 0xffe007f8, COD|RD_t|WR_C0|WR_CC,   I64     },
 {"dmfc1",   "t,S",	0x44200000, 0xffe007ff, LCD|WR_t|RD_S|FP_S,	I3	},
+{"dmfc1",   "t,G",      0x44200000, 0xffe007ff, LCD|WR_t|RD_S|FP_S,     I3      },
 {"dmtc1",   "t,S",	0x44a00000, 0xffe007ff, COD|RD_t|WR_S|FP_S,	I3	},
-{"dmfc2",   "t,S",	0x48200000, 0xffe007ff, LCD|WR_t|RD_S|FP_S,	I3	},
-{"dmtc2",   "t,S",	0x48a00000, 0xffe007ff, COD|RD_t|WR_S|FP_S,	I3	},
-{"dmul",    "d,v,t",	0,    (int) M_DMUL,	INSN_MACRO,	I3	},
-{"dmul",    "d,v,I",	0,    (int) M_DMUL_I,	INSN_MACRO,	I3	},
-{"dmulo",   "d,v,t",	0,    (int) M_DMULO,	INSN_MACRO,	I3	},
-{"dmulo",   "d,v,I",	0,    (int) M_DMULO_I,	INSN_MACRO,	I3	},
-{"dmulou",  "d,v,t",	0,    (int) M_DMULOU,	INSN_MACRO,	I3	},
-{"dmulou",  "d,v,I",	0,    (int) M_DMULOU_I,	INSN_MACRO,	I3	},
-{"dmult",   "s,t",	0x0000001c, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO,	    I3},
-{"dmultu",  "s,t",	0x0000001d, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO,      I3},
-{"dneg",    "d,w",	0x0000002e, 0xffe007ff,	WR_d|RD_t,	I3	}, /* dsub 0 */
-{"dnegu",   "d,w",	0x0000002f, 0xffe007ff,	WR_d|RD_t,	I3	}, /* dsubu 0*/
-{"drem",    "z,s,t",	0x0000001e, 0xfc00ffff, RD_s|RD_t|WR_HI|WR_LO,	I3	},
-{"drem",    "d,v,t",	3,    (int) M_DREM_3,	INSN_MACRO,	I3	},
-{"drem",    "d,v,I",	3,    (int) M_DREM_3I,	INSN_MACRO,	I3	},
-{"dremu",   "z,s,t",	0x0000001f, 0xfc00ffff, RD_s|RD_t|WR_HI|WR_LO,	I3	},
-{"dremu",   "d,v,t",	3,    (int) M_DREMU_3,	INSN_MACRO,	I3	},
-{"dremu",   "d,v,I",	3,    (int) M_DREMU_3I,	INSN_MACRO,	I3	},
-{"dsllv",   "d,t,s",	0x00000014, 0xfc0007ff,	WR_d|RD_t|RD_s,	I3	},
-{"dsll32",  "d,w,<",	0x0000003c, 0xffe0003f, WR_d|RD_t,	I3	},
-{"dsll",    "d,w,s",	0x00000014, 0xfc0007ff,	WR_d|RD_t|RD_s,	I3	}, /* dsllv */
-{"dsll",    "d,w,>",	0x0000003c, 0xffe0003f, WR_d|RD_t,	I3	}, /* dsll32 */
-{"dsll",    "d,w,<",	0x00000038, 0xffe0003f,	WR_d|RD_t,	I3	},
-{"dsrav",   "d,t,s",	0x00000017, 0xfc0007ff,	WR_d|RD_t|RD_s,	I3	},
-{"dsra32",  "d,w,<",	0x0000003f, 0xffe0003f, WR_d|RD_t,	I3	},
-{"dsra",    "d,w,s",	0x00000017, 0xfc0007ff,	WR_d|RD_t|RD_s,	I3	}, /* dsrav */
-{"dsra",    "d,w,>",	0x0000003f, 0xffe0003f, WR_d|RD_t,	I3	}, /* dsra32 */
-{"dsra",    "d,w,<",	0x0000003b, 0xffe0003f,	WR_d|RD_t,	I3	},
-{"dsrlv",   "d,t,s",	0x00000016, 0xfc0007ff,	WR_d|RD_t|RD_s,	I3	},
-{"dsrl32",  "d,w,<",	0x0000003e, 0xffe0003f, WR_d|RD_t,	I3	},
-{"dsrl",    "d,w,s",	0x00000016, 0xfc0007ff,	WR_d|RD_t|RD_s,	I3	}, /* dsrlv */
-{"dsrl",    "d,w,>",	0x0000003e, 0xffe0003f, WR_d|RD_t,	I3	}, /* dsrl32 */
-{"dsrl",    "d,w,<",	0x0000003a, 0xffe0003f,	WR_d|RD_t,	I3	},
-{"dsub",    "d,v,t",	0x0000002e, 0xfc0007ff,	WR_d|RD_s|RD_t,	I3	},
-{"dsub",    "d,v,I",	0,    (int) M_DSUB_I,	INSN_MACRO,	I3	},
-{"dsubu",   "d,v,t",	0x0000002f, 0xfc0007ff,	WR_d|RD_s|RD_t,	I3	},
-{"dsubu",   "d,v,I",	0,    (int) M_DSUBU_I,	INSN_MACRO,	I3	},
-{"eret",    "",		0x42000018, 0xffffffff,	0,	I3|M1	},
-{"floor.l.d", "D,S",	0x4620000b, 0xffff003f, WR_D|RD_S|FP_D,	I3	},
-{"floor.l.s", "D,S",	0x4600000b, 0xffff003f, WR_D|RD_S|FP_S,	I3	},
-{"floor.w.d", "D,S",	0x4620000f, 0xffff003f, WR_D|RD_S|FP_D,	I2	},
-{"floor.w.s", "D,S",	0x4600000f, 0xffff003f, WR_D|RD_S|FP_S,	I2	},
-{"flushi",  "",		0xbc010000, 0xffffffff, 0,		L1	},
-{"flushd",  "",		0xbc020000, 0xffffffff, 0, L1		},
-{"flushid", "",		0xbc030000, 0xffffffff, 0, L1		},
-{"hibernate","",        0x42000023, 0xffffffff,	0, V1	},
-{"jr",      "s",	0x00000008, 0xfc1fffff,	UBD|RD_s,	I1	},
-{"j",       "s",	0x00000008, 0xfc1fffff,	UBD|RD_s,	I1	}, /* jr */
+{"dmtc1",   "t,G",      0x44a00000, 0xffe007ff, COD|RD_t|WR_S|FP_S,     I3      },
+{"dmfc2",   "t,G",      0x48200000, 0xffe007ff, LCD|WR_t|RD_C2, 	I3      },
+{"dmfc2",   "t,G,H",    0x48200000, 0xffe007f8, LCD|WR_t|RD_C2, 	I64     },
+{"dmtc2",   "t,G",      0x48a00000, 0xffe007ff, COD|RD_t|WR_C2|WR_CC,   I3      },
+{"dmtc2",   "t,G,H",    0x48a00000, 0xffe007f8, COD|RD_t|WR_C2|WR_CC,   I64     },
+{"dmfc3",   "t,G",      0x4c200000, 0xffe007ff, LCD|WR_t|RD_C3, 	I3      },
+{"dmfc3",   "t,G,H",    0x4c200000, 0xffe007f8, LCD|WR_t|RD_C3, 	I64     },
+{"dmtc3",   "t,G",      0x4ca00000, 0xffe007ff, COD|RD_t|WR_C3|WR_CC,   I3      },
+{"dmtc3",   "t,G,H",    0x4ca00000, 0xffe007f8, COD|RD_t|WR_C3|WR_CC,   I64     },
+{"dmul",    "d,v,t",	0,    (int) M_DMUL,	INSN_MACRO,		I3	},
+{"dmul",    "d,v,I",	0,    (int) M_DMUL_I,	INSN_MACRO,		I3	},
+{"dmulo",   "d,v,t",	0,    (int) M_DMULO,	INSN_MACRO,		I3	},
+{"dmulo",   "d,v,I",	0,    (int) M_DMULO_I,	INSN_MACRO,		I3	},
+{"dmulou",  "d,v,t",	0,    (int) M_DMULOU,	INSN_MACRO,		I3	},
+{"dmulou",  "d,v,I",	0,    (int) M_DMULOU_I,	INSN_MACRO,		I3	},
+{"dmult",   "s,t",      0x0000001c, 0xfc00ffff, RD_s|RD_t|WR_HILO,      I3	},
+{"dmultu",  "s,t",      0x0000001d, 0xfc00ffff, RD_s|RD_t|WR_HILO,      I3	},
+{"dneg",    "d,w",	0x0000002e, 0xffe007ff,	WR_d|RD_t,		I3	}, /* dsub 0 */
+{"dnegu",   "d,w",	0x0000002f, 0xffe007ff,	WR_d|RD_t,		I3	}, /* dsubu 0*/
+{"drem",    "z,s,t",    0x0000001e, 0xfc00ffff, RD_s|RD_t|WR_HILO,      I3      },
+{"drem",    "d,v,t",	3,    (int) M_DREM_3,	INSN_MACRO,		I3	},
+{"drem",    "d,v,I",	3,    (int) M_DREM_3I,	INSN_MACRO,		I3	},
+{"dremu",   "z,s,t",    0x0000001f, 0xfc00ffff, RD_s|RD_t|WR_HILO,      I3      },
+{"dremu",   "d,v,t",	3,    (int) M_DREMU_3,	INSN_MACRO,		I3	},
+{"dremu",   "d,v,I",	3,    (int) M_DREMU_3I,	INSN_MACRO,		I3	},
+{"dsllv",   "d,t,s",	0x00000014, 0xfc0007ff,	WR_d|RD_t|RD_s,		I3	},
+{"dsll32",  "d,w,<",	0x0000003c, 0xffe0003f, WR_d|RD_t,		I3	},
+{"dsll",    "d,w,s",	0x00000014, 0xfc0007ff,	WR_d|RD_t|RD_s,		I3	}, /* dsllv */
+{"dsll",    "d,w,>",	0x0000003c, 0xffe0003f, WR_d|RD_t,		I3	}, /* dsll32 */
+{"dsll",    "d,w,<",	0x00000038, 0xffe0003f,	WR_d|RD_t,		I3	},
+{"dsrav",   "d,t,s",	0x00000017, 0xfc0007ff,	WR_d|RD_t|RD_s,		I3	},
+{"dsra32",  "d,w,<",	0x0000003f, 0xffe0003f, WR_d|RD_t,		I3	},
+{"dsra",    "d,w,s",	0x00000017, 0xfc0007ff,	WR_d|RD_t|RD_s,		I3	}, /* dsrav */
+{"dsra",    "d,w,>",	0x0000003f, 0xffe0003f, WR_d|RD_t,		I3	}, /* dsra32 */
+{"dsra",    "d,w,<",	0x0000003b, 0xffe0003f,	WR_d|RD_t,		I3	},
+{"dsrlv",   "d,t,s",	0x00000016, 0xfc0007ff,	WR_d|RD_t|RD_s,		I3	},
+{"dsrl32",  "d,w,<",	0x0000003e, 0xffe0003f, WR_d|RD_t,		I3	},
+{"dsrl",    "d,w,s",	0x00000016, 0xfc0007ff,	WR_d|RD_t|RD_s,		I3	}, /* dsrlv */
+{"dsrl",    "d,w,>",	0x0000003e, 0xffe0003f, WR_d|RD_t,		I3	}, /* dsrl32 */
+{"dsrl",    "d,w,<",	0x0000003a, 0xffe0003f,	WR_d|RD_t,		I3	},
+{"dsub",    "d,v,t",	0x0000002e, 0xfc0007ff,	WR_d|RD_s|RD_t,		I3	},
+{"dsub",    "d,v,I",	0,    (int) M_DSUB_I,	INSN_MACRO,		I3	},
+{"dsubu",   "d,v,t",	0x0000002f, 0xfc0007ff,	WR_d|RD_s|RD_t,		I3	},
+{"dsubu",   "d,v,I",	0,    (int) M_DSUBU_I,	INSN_MACRO,		I3	},
+{"eret",    "",         0x42000018, 0xffffffff, 0,      		I3|I32	},
+{"floor.l.d", "D,S",	0x4620000b, 0xffff003f, WR_D|RD_S|FP_D,		I3	},
+{"floor.l.s", "D,S",	0x4600000b, 0xffff003f, WR_D|RD_S|FP_S,		I3	},
+{"floor.w.d", "D,S",	0x4620000f, 0xffff003f, WR_D|RD_S|FP_D,		I2	},
+{"floor.w.s", "D,S",	0x4600000f, 0xffff003f, WR_D|RD_S|FP_S,		I2	},
+{"flushi",  "",		0xbc010000, 0xffffffff, 0,			L1	},
+{"flushd",  "",		0xbc020000, 0xffffffff, 0, 			L1	},
+{"flushid", "",		0xbc030000, 0xffffffff, 0, 			L1	},
+{"hibernate","",        0x42000023, 0xffffffff,	0, 			V1	},
+{"jr",      "s",	0x00000008, 0xfc1fffff,	UBD|RD_s,		I1	},
+{"j",       "s",	0x00000008, 0xfc1fffff,	UBD|RD_s,		I1	}, /* jr */
 /* SVR4 PIC code requires special handling for j, so it must be a
    macro.  */
-{"j",	    "a",	0,     (int) M_J_A,	INSN_MACRO,	I1	},
+{"j",	    "a",	0,     (int) M_J_A,	INSN_MACRO,		I1	},
 /* This form of j is used by the disassembler and internally by the
    assembler, but will never match user input (because the line above
    will match first).  */
-{"j",       "a",	0x08000000, 0xfc000000,	UBD,		I1	},
-{"jalr",    "s",	0x0000f809, 0xfc1fffff,	UBD|RD_s|WR_d,	I1	},
-{"jalr",    "d,s",	0x00000009, 0xfc1f07ff,	UBD|RD_s|WR_d,	I1	},
+{"j",       "a",	0x08000000, 0xfc000000,	UBD,			I1	},
+{"jalr",    "s",	0x0000f809, 0xfc1fffff,	UBD|RD_s|WR_d,		I1	},
+{"jalr",    "d,s",	0x00000009, 0xfc1f07ff,	UBD|RD_s|WR_d,		I1	},
 /* SVR4 PIC code requires special handling for jal, so it must be a
    macro.  */
-{"jal",     "d,s",	0,     (int) M_JAL_2,	INSN_MACRO,	I1	},
-{"jal",     "s",	0,     (int) M_JAL_1,	INSN_MACRO,	I1	},
-{"jal",     "a",	0,     (int) M_JAL_A,	INSN_MACRO,	I1	},
+{"jal",     "d,s",	0,     (int) M_JAL_2,	INSN_MACRO,		I1	},
+{"jal",     "s",	0,     (int) M_JAL_1,	INSN_MACRO,		I1	},
+{"jal",     "a",	0,     (int) M_JAL_A,	INSN_MACRO,		I1	},
 /* This form of jal is used by the disassembler and internally by the
    assembler, but will never match user input (because the line above
    will match first).  */
-{"jal",     "a",	0x0c000000, 0xfc000000,	UBD|WR_31,	I1	},
+{"jal",     "a",	0x0c000000, 0xfc000000,	UBD|WR_31,		I1	},
   /* jalx really should only be avaliable if mips16 is available,
      but for now make it I1. */
-{"jalx",    "a",	0x74000000, 0xfc000000, UBD|WR_31,	I1      },
-{"la",      "t,o(b)",	0x24000000, 0xfc000000,	WR_t|RD_s,	I1	}, /* addiu */
-{"la",      "t,A(b)",	0,    (int) M_LA_AB,	INSN_MACRO,	I1	},
-{"lb",      "t,o(b)",	0x80000000, 0xfc000000,	LDD|RD_b|WR_t,	I1	},
-{"lb",      "t,A(b)",	0,    (int) M_LB_AB,	INSN_MACRO,	I1	},
-{"lbu",     "t,o(b)",	0x90000000, 0xfc000000,	LDD|RD_b|WR_t,	I1	},
-{"lbu",     "t,A(b)",	0,    (int) M_LBU_AB,	INSN_MACRO,	I1	},
-{"ld",	    "t,o(b)",   0xdc000000, 0xfc000000, WR_t|RD_b,	I3	},
-{"ld",      "t,o(b)",	0,    (int) M_LD_OB,	INSN_MACRO,	I1	},
-{"ld",      "t,A(b)",	0,    (int) M_LD_AB,	INSN_MACRO,	I1	},
+{"jalx",    "a",	0x74000000, 0xfc000000, UBD|WR_31,		I1      },
+{"la",      "t,o(b)",	0x24000000, 0xfc000000,	WR_t|RD_s,		I1	}, /* addiu */
+{"la",      "t,A(b)",	0,    (int) M_LA_AB,	INSN_MACRO,		I1	},
+{"lb",      "t,o(b)",	0x80000000, 0xfc000000,	LDD|RD_b|WR_t,		I1	},
+{"lb",      "t,A(b)",	0,    (int) M_LB_AB,	INSN_MACRO,		I1	},
+{"lbu",     "t,o(b)",	0x90000000, 0xfc000000,	LDD|RD_b|WR_t,		I1	},
+{"lbu",     "t,A(b)",	0,    (int) M_LBU_AB,	INSN_MACRO,		I1	},
+{"ld",	    "t,o(b)",   0xdc000000, 0xfc000000, WR_t|RD_b,		I3	},
+{"ld",      "t,o(b)",	0,    (int) M_LD_OB,	INSN_MACRO,		I1	},
+{"ld",      "t,A(b)",	0,    (int) M_LD_AB,	INSN_MACRO,		I1	},
 {"ldc1",    "T,o(b)",	0xd4000000, 0xfc000000, CLD|RD_b|WR_T|FP_D,	I2	},
 {"ldc1",    "E,o(b)",	0xd4000000, 0xfc000000, CLD|RD_b|WR_T|FP_D,	I2	},
-{"ldc1",    "T,A(b)",	0,    (int) M_LDC1_AB,	INSN_MACRO,	I2	},
-{"ldc1",    "E,A(b)",	0,    (int) M_LDC1_AB,	INSN_MACRO,	I2	},
+{"ldc1",    "T,A(b)",	0,    (int) M_LDC1_AB,	INSN_MACRO,		I2	},
+{"ldc1",    "E,A(b)",	0,    (int) M_LDC1_AB,	INSN_MACRO,		I2	},
 {"l.d",     "T,o(b)",	0xd4000000, 0xfc000000, CLD|RD_b|WR_T|FP_D,	I2	}, /* ldc1 */
-{"l.d",     "T,o(b)",	0,    (int) M_L_DOB,	INSN_MACRO,	I1	},
-{"l.d",     "T,A(b)",	0,    (int) M_L_DAB,	INSN_MACRO,	I1	},
-{"ldc2",    "E,o(b)",	0xd8000000, 0xfc000000, CLD|RD_b|WR_CC,	I2	},
-{"ldc2",    "E,A(b)",	0,    (int) M_LDC2_AB,	INSN_MACRO,	I2	},
-{"ldc3",    "E,o(b)",	0xdc000000, 0xfc000000, CLD|RD_b|WR_CC,	I2	},
-{"ldc3",    "E,A(b)",	0,    (int) M_LDC3_AB,	INSN_MACRO,	I2	},
-{"ldl",	    "t,o(b)",	0x68000000, 0xfc000000, LDD|WR_t|RD_b,	I3	},
-{"ldl",	    "t,A(b)",	0,    (int) M_LDL_AB,	INSN_MACRO,	I3	},
-{"ldr",	    "t,o(b)",	0x6c000000, 0xfc000000, LDD|WR_t|RD_b,	I3	},
-{"ldr",     "t,A(b)",	0,    (int) M_LDR_AB,	INSN_MACRO,	I3	},
+{"l.d",     "T,o(b)",	0,    (int) M_L_DOB,	INSN_MACRO,		I1	},
+{"l.d",     "T,A(b)",	0,    (int) M_L_DAB,	INSN_MACRO,		I1	},
+{"ldc2",    "E,o(b)",	0xd8000000, 0xfc000000, CLD|RD_b|WR_CC,		I2	},
+{"ldc2",    "E,A(b)",	0,    (int) M_LDC2_AB,	INSN_MACRO,		I2	},
+{"ldc3",    "E,o(b)",	0xdc000000, 0xfc000000, CLD|RD_b|WR_CC,		I2	},
+{"ldc3",    "E,A(b)",	0,    (int) M_LDC3_AB,	INSN_MACRO,		I2	},
+{"ldl",	    "t,o(b)",	0x68000000, 0xfc000000, LDD|WR_t|RD_b,		I3	},
+{"ldl",	    "t,A(b)",	0,    (int) M_LDL_AB,	INSN_MACRO,		I3	},
+{"ldr",	    "t,o(b)",	0x6c000000, 0xfc000000, LDD|WR_t|RD_b,		I3	},
+{"ldr",     "t,A(b)",	0,    (int) M_LDR_AB,	INSN_MACRO,		I3	},
 {"ldxc1",   "D,t(b)",	0x4c000001, 0xfc00f83f, LDD|WR_D|RD_t|RD_b,	I4	},
-{"lh",      "t,o(b)",	0x84000000, 0xfc000000,	LDD|RD_b|WR_t,	I1	},
-{"lh",      "t,A(b)",	0,    (int) M_LH_AB,	INSN_MACRO,	I1	},
-{"lhu",     "t,o(b)",	0x94000000, 0xfc000000,	LDD|RD_b|WR_t,	I1	},
-{"lhu",     "t,A(b)",	0,    (int) M_LHU_AB,	INSN_MACRO,	I1	},
+{"lh",      "t,o(b)",	0x84000000, 0xfc000000,	LDD|RD_b|WR_t,		I1	},
+{"lh",      "t,A(b)",	0,    (int) M_LH_AB,	INSN_MACRO,		I1	},
+{"lhu",     "t,o(b)",	0x94000000, 0xfc000000,	LDD|RD_b|WR_t,		I1	},
+{"lhu",     "t,A(b)",	0,    (int) M_LHU_AB,	INSN_MACRO,		I1	},
 /* li is at the start of the table.  */
-{"li.d",    "t,F",	0,    (int) M_LI_D,	INSN_MACRO,	I1	},
-{"li.d",    "T,L",	0,    (int) M_LI_DD,	INSN_MACRO,	I1	},
-{"li.s",    "t,f",	0,    (int) M_LI_S,	INSN_MACRO,	I1	},
-{"li.s",    "T,l",	0,    (int) M_LI_SS,	INSN_MACRO,	I1	},
-{"ll",	    "t,o(b)",	0xc0000000, 0xfc000000, LDD|RD_b|WR_t,	I2	},
-{"ll",	    "t,A(b)",	0,    (int) M_LL_AB,	INSN_MACRO,	I2	},
-{"lld",	    "t,o(b)",	0xd0000000, 0xfc000000, LDD|RD_b|WR_t,	I3	},
-{"lld",     "t,A(b)",	0,    (int) M_LLD_AB,	INSN_MACRO,	I3	},
-{"lui",     "t,u",	0x3c000000, 0xffe00000,	WR_t,		I1	},
+{"li.d",    "t,F",	0,    (int) M_LI_D,	INSN_MACRO,		I1	},
+{"li.d",    "T,L",	0,    (int) M_LI_DD,	INSN_MACRO,		I1	},
+{"li.s",    "t,f",	0,    (int) M_LI_S,	INSN_MACRO,		I1	},
+{"li.s",    "T,l",	0,    (int) M_LI_SS,	INSN_MACRO,		I1	},
+{"ll",	    "t,o(b)",	0xc0000000, 0xfc000000, LDD|RD_b|WR_t,		I2	},
+{"ll",	    "t,A(b)",	0,    (int) M_LL_AB,	INSN_MACRO,		I2	},
+{"lld",	    "t,o(b)",	0xd0000000, 0xfc000000, LDD|RD_b|WR_t,		I3	},
+{"lld",     "t,A(b)",	0,    (int) M_LLD_AB,	INSN_MACRO,		I3	},
+{"lui",     "t,u",	0x3c000000, 0xffe00000,	WR_t,			I1	},
 {"luxc1",   "D,t(b)",	0x4c000005, 0xfc00f83f, LDD|WR_D|RD_t|RD_b,	I5	},
-{"lw",      "t,o(b)",	0x8c000000, 0xfc000000,	LDD|RD_b|WR_t,	I1	},
-{"lw",      "t,A(b)",	0,    (int) M_LW_AB,	INSN_MACRO,	I1	},
-{"lwc0",    "E,o(b)",	0xc0000000, 0xfc000000,	CLD|RD_b|WR_CC,	I1	},
-{"lwc0",    "E,A(b)",	0,    (int) M_LWC0_AB,	INSN_MACRO,	I1	},
+{"lw",      "t,o(b)",	0x8c000000, 0xfc000000,	LDD|RD_b|WR_t,		I1	},
+{"lw",      "t,A(b)",	0,    (int) M_LW_AB,	INSN_MACRO,		I1	},
+{"lwc0",    "E,o(b)",	0xc0000000, 0xfc000000,	CLD|RD_b|WR_CC,		I1	},
+{"lwc0",    "E,A(b)",	0,    (int) M_LWC0_AB,	INSN_MACRO,		I1	},
 {"lwc1",    "T,o(b)",	0xc4000000, 0xfc000000,	CLD|RD_b|WR_T|FP_S,	I1	},
 {"lwc1",    "E,o(b)",	0xc4000000, 0xfc000000,	CLD|RD_b|WR_T|FP_S,	I1	},
-{"lwc1",    "T,A(b)",	0,    (int) M_LWC1_AB,	INSN_MACRO,	I1	},
-{"lwc1",    "E,A(b)",	0,    (int) M_LWC1_AB,	INSN_MACRO,	I1	},
+{"lwc1",    "T,A(b)",	0,    (int) M_LWC1_AB,	INSN_MACRO,		I1	},
+{"lwc1",    "E,A(b)",	0,    (int) M_LWC1_AB,	INSN_MACRO,		I1	},
 {"l.s",     "T,o(b)",	0xc4000000, 0xfc000000,	CLD|RD_b|WR_T|FP_S,	I1	}, /* lwc1 */
-{"l.s",     "T,A(b)",	0,    (int) M_LWC1_AB,	INSN_MACRO,	I1	},
-{"lwc2",    "E,o(b)",	0xc8000000, 0xfc000000,	CLD|RD_b|WR_CC,	I1	},
-{"lwc2",    "E,A(b)",	0,    (int) M_LWC2_AB,	INSN_MACRO,	I1	},
-{"lwc3",    "E,o(b)",	0xcc000000, 0xfc000000,	CLD|RD_b|WR_CC,	I1	},
-{"lwc3",    "E,A(b)",	0,    (int) M_LWC3_AB,	INSN_MACRO,	I1	},
-{"lwl",     "t,o(b)",	0x88000000, 0xfc000000,	LDD|RD_b|WR_t,	I1	},
-{"lwl",     "t,A(b)",	0,    (int) M_LWL_AB,	INSN_MACRO,	I1	},
-{"lcache",  "t,o(b)",	0x88000000, 0xfc000000,	LDD|RD_b|WR_t,	I2	}, /* same */
-{"lcache",  "t,A(b)",	0,    (int) M_LWL_AB,	INSN_MACRO,	I2	}, /* as lwl */
-{"lwr",     "t,o(b)",	0x98000000, 0xfc000000,	LDD|RD_b|WR_t,	I1	},
-{"lwr",     "t,A(b)",	0,    (int) M_LWR_AB,	INSN_MACRO,	I1	},
-{"flush",   "t,o(b)",	0x98000000, 0xfc000000,	LDD|RD_b|WR_t,	I2	}, /* same */
-{"flush",   "t,A(b)",	0,    (int) M_LWR_AB,	INSN_MACRO,	I2	}, /* as lwr */
-{"lwu",     "t,o(b)",	0x9c000000, 0xfc000000,	LDD|RD_b|WR_t,	I3	},
-{"lwu",     "t,A(b)",	0,    (int) M_LWU_AB,	INSN_MACRO,	I3	},
+{"l.s",     "T,A(b)",	0,    (int) M_LWC1_AB,	INSN_MACRO,		I1	},
+{"lwc2",    "E,o(b)",	0xc8000000, 0xfc000000,	CLD|RD_b|WR_CC,		I1	},
+{"lwc2",    "E,A(b)",	0,    (int) M_LWC2_AB,	INSN_MACRO,		I1	},
+{"lwc3",    "E,o(b)",	0xcc000000, 0xfc000000,	CLD|RD_b|WR_CC,		I1	},
+{"lwc3",    "E,A(b)",	0,    (int) M_LWC3_AB,	INSN_MACRO,		I1	},
+{"lwl",     "t,o(b)",	0x88000000, 0xfc000000,	LDD|RD_b|WR_t,		I1	},
+{"lwl",     "t,A(b)",	0,    (int) M_LWL_AB,	INSN_MACRO,		I1	},
+{"lcache",  "t,o(b)",	0x88000000, 0xfc000000,	LDD|RD_b|WR_t,		I2	}, /* same */
+{"lcache",  "t,A(b)",	0,    (int) M_LWL_AB,	INSN_MACRO,		I2	}, /* as lwl */
+{"lwr",     "t,o(b)",	0x98000000, 0xfc000000,	LDD|RD_b|WR_t,		I1	},
+{"lwr",     "t,A(b)",	0,    (int) M_LWR_AB,	INSN_MACRO,		I1	},
+{"flush",   "t,o(b)",	0x98000000, 0xfc000000,	LDD|RD_b|WR_t,		I2	}, /* same */
+{"flush",   "t,A(b)",	0,    (int) M_LWR_AB,	INSN_MACRO,		I2	}, /* as lwr */
+{"lwu",     "t,o(b)",	0x9c000000, 0xfc000000,	LDD|RD_b|WR_t,		I3	},
+{"lwu",     "t,A(b)",	0,    (int) M_LWU_AB,	INSN_MACRO,		I3	},
 {"lwxc1",   "D,t(b)",	0x4c000000, 0xfc00f83f, LDD|WR_D|RD_t|RD_b,	I4	},
-
-
-{"mad",	    "s,t",	0x70000000, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO|RD_HI|RD_LO,	P3	},
-{"madu",    "s,t",	0x70000001, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO|RD_HI|RD_LO,	P3	},
-{"madd.d",  "D,R,S,T",	0x4c000021, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D,	I4	},
-{"madd.s",  "D,R,S,T",	0x4c000020, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S,	I4	},
-{"madd.ps", "D,R,S,T",	0x4c000026, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D,	I5	},
-{"madd",    "s,t",	0x0000001c, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO,		L1	},
-{"madd",    "s,t",	0x70000000, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO|IS_M,	        G1|M1	},
-{"madd",    "d,s,t",	0x70000000, 0xfc0007ff,	RD_s|RD_t|WR_HI|WR_LO|WR_d|IS_M,	G1	},
-{"maddu",   "s,t",	0x0000001d, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO,		L1	},
-{"maddu",   "s,t",	0x70000001, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO|IS_M,	G1|M1},
-{"maddu",   "d,s,t",	0x70000001, 0xfc0007ff,	RD_s|RD_t|WR_HI|WR_LO|WR_d|IS_M,	G1},
-{"madd16",  "s,t",      0x00000028, 0xfc00ffff, RD_s|RD_t|WR_HI|WR_LO|RD_HI|RD_LO,	V1	},
-{"mfc0",    "t,G",	0x40000000, 0xffe007ff,	LCD|WR_t|RD_C0,	I1	},
-{"mfc1",    "t,S",	0x44000000, 0xffe007ff,	LCD|WR_t|RD_S|FP_S,	I1},
-{"mfc1",    "t,G",	0x44000000, 0xffe007ff,	LCD|WR_t|RD_S|FP_S,	I1},
-{"mfc2",    "t,G",	0x48000000, 0xffe007ff,	LCD|WR_t|RD_C2,	I1	},
-{"mfc3",    "t,G",	0x4c000000, 0xffe007ff,	LCD|WR_t|RD_C3,	I1	},
-{"mfhi",    "d",	0x00000010, 0xffff07ff,	WR_d|RD_HI,	I1	},
-{"mflo",    "d",	0x00000012, 0xffff07ff,	WR_d|RD_LO,	I1	},
-{"mov.d",   "D,S",	0x46200006, 0xffff003f,	WR_D|RD_S|FP_D,	I1	},
-{"mov.s",   "D,S",	0x46000006, 0xffff003f,	WR_D|RD_S|FP_S,	I1	},
-{"mov.ps",  "D,S",	0x46c00006, 0xffff003f,	WR_D|RD_S|FP_D,	I5	},
-{"movf",    "d,s,N",	0x00000001, 0xfc0307ff, WR_d|RD_s|RD_CC|FP_D|FP_S, I4|M1},
-{"movf.d",  "D,S,N",	0x46200011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D,	I4|M1	},
-{"movf.s",  "D,S,N",	0x46000011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_S,	I4|M1	},
+{"mad",     "s,t",      0x70000000, 0xfc00ffff, RD_s|RD_t|MOD_HILO,     P3      },
+{"madu",    "s,t",      0x70000001, 0xfc00ffff, RD_s|RD_t|MOD_HILO,     P3      },
+{"madd.d",  "D,R,S,T",	0x4c000021, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D,    I4	},
+{"madd.s",  "D,R,S,T",	0x4c000020, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S,    I4	},
+{"madd.ps", "D,R,S,T",	0x4c000026, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D,    I5	},
+{"madd",    "s,t",      0x0000001c, 0xfc00ffff, RD_s|RD_t|WR_HILO,           L1 },
+{"madd",    "s,t",      0x70000000, 0xfc00ffff, RD_s|RD_t|MOD_HILO,          I32},
+{"madd",    "s,t",      0x70000000, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M,      G1 },
+{"madd",    "d,s,t",    0x70000000, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, G1 },
+{"maddu",   "s,t",      0x0000001d, 0xfc00ffff, RD_s|RD_t|WR_HILO,           L1 },
+{"maddu",   "s,t",      0x70000001, 0xfc00ffff, RD_s|RD_t|MOD_HILO,          I32},
+{"maddu",   "s,t",      0x70000001, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M,      G1	},
+{"maddu",   "d,s,t",    0x70000001, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, G1	},
+{"madd16",  "s,t",      0x00000028, 0xfc00ffff, RD_s|RD_t|MOD_HILO,          V1 },
+{"mfc0",    "t,G",	0x40000000, 0xffe007ff,	LCD|WR_t|RD_C0,		I1	},
+{"mfc0",    "t,G,H",    0x40000000, 0xffe007f8, LCD|WR_t|RD_C0, 	I32     },
+{"mfc1",    "t,S",	0x44000000, 0xffe007ff,	LCD|WR_t|RD_S|FP_S,	I1	},
+{"mfc1",    "t,G",	0x44000000, 0xffe007ff,	LCD|WR_t|RD_S|FP_S,	I1	},
+{"mfc2",    "t,G",	0x48000000, 0xffe007ff,	LCD|WR_t|RD_C2,		I1	},
+{"mfc2",    "t,G,H",    0x48000000, 0xffe007f8, LCD|WR_t|RD_C2, 	I32     },
+{"mfc3",    "t,G",	0x4c000000, 0xffe007ff,	LCD|WR_t|RD_C3,		I1	},
+{"mfc3",    "t,G,H",    0x4c000000, 0xffe007f8, LCD|WR_t|RD_C3, 	I32     },
+{"mfhi",    "d",	0x00000010, 0xffff07ff,	WR_d|RD_HI,		I1	},
+{"mflo",    "d",	0x00000012, 0xffff07ff,	WR_d|RD_LO,		I1	},
+{"mov.d",   "D,S",	0x46200006, 0xffff003f,	WR_D|RD_S|FP_D,		I1	},
+{"mov.s",   "D,S",	0x46000006, 0xffff003f,	WR_D|RD_S|FP_S,		I1	},
+{"mov.ps",  "D,S",	0x46c00006, 0xffff003f,	WR_D|RD_S|FP_D,		I5	},
+{"movf",    "d,s,N",    0x00000001, 0xfc0307ff, WR_d|RD_s|RD_CC|FP_D|FP_S, I4|I32},
+{"movf.d",  "D,S,N",    0x46200011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D,   I4|I32	},
+{"movf.s",  "D,S,N",    0x46000011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_S,   I4|I32	},
 {"movf.ps", "D,S,N",	0x46c00011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D,	I5	},
-{"movn",    "d,v,t",	0x0000000b, 0xfc0007ff,	WR_d|RD_s|RD_t,	I4|M1	},
-{"ffc",     "d,v",	0x0000000b, 0xfc1f07ff,	WR_d|RD_s,L1	},
-{"movn.d",  "D,S,t",	0x46200013, 0xffe0003f, WR_D|RD_S|RD_t|FP_D,	I4|M1	},
-{"movn.s",  "D,S,t",	0x46000013, 0xffe0003f, WR_D|RD_S|RD_t|FP_S,	I4|M1	},
-{"movt",    "d,s,N",	0x00010001, 0xfc0307ff, WR_d|RD_s|RD_CC,	I4|M1	},
-{"movt.d",  "D,S,N",	0x46210011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D,	I4|M1	},
-{"movt.s",  "D,S,N",	0x46010011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_S,	I4|M1	},
-{"movt.ps", "D,S,N",	0x46c10011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D,	I5},
-{"movz",    "d,v,t",	0x0000000a, 0xfc0007ff,	WR_d|RD_s|RD_t,	I4|M1	},
-{"ffs",     "d,v",	0x0000000a, 0xfc1f07ff,	WR_d|RD_s,L1	},
-{"movz.d",  "D,S,t",	0x46200012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D,	I4|M1	},
-{"movz.s",  "D,S,t",	0x46000012, 0xffe0003f, WR_D|RD_S|RD_t|FP_S,	I4|M1	},
+{"movn",    "d,v,t",    0x0000000b, 0xfc0007ff, WR_d|RD_s|RD_t, 	I4|I32	},
+{"ffc",     "d,v",	0x0000000b, 0xfc1f07ff,	WR_d|RD_s,		L1	},
+{"movn.d",  "D,S,t",    0x46200013, 0xffe0003f, WR_D|RD_S|RD_t|FP_D,    I4|I32	},
+{"movn.s",  "D,S,t",    0x46000013, 0xffe0003f, WR_D|RD_S|RD_t|FP_S,    I4|I32	},
+{"movt",    "d,s,N",    0x00010001, 0xfc0307ff, WR_d|RD_s|RD_CC,        I4|I32	},
+{"movt.d",  "D,S,N",    0x46210011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D,   I4|I32	},
+{"movt.s",  "D,S,N",    0x46010011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_S,   I4|I32	},
+{"movt.ps", "D,S,N",	0x46c10011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D,	I5	},
+{"movz",    "d,v,t",    0x0000000a, 0xfc0007ff, WR_d|RD_s|RD_t, 	I4|I32	},
+{"ffs",     "d,v",	0x0000000a, 0xfc1f07ff,	WR_d|RD_s,		L1	},
+{"movz.d",  "D,S,t",    0x46200012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D,    I4|I32	},
+{"movz.s",  "D,S,t",    0x46000012, 0xffe0003f, WR_D|RD_S|RD_t|FP_S,    I4|I32	},
 /* move is at the top of the table.  */
-{"msub.d",  "D,R,S,T",	0x4c000029, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D,	I4	},
-{"msub.s",  "D,R,S,T",	0x4c000028, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S,	I4	},
-{"msub.ps", "D,R,S,T",	0x4c00002e, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D,	I5	},
-{"msub",    "s,t",	0x0000001e, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO,L1	},
-{"msubu",   "s,t",	0x0000001f, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO,L1	},
+{"msub.d",  "D,R,S,T",	0x4c000029, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, I4	},
+{"msub.s",  "D,R,S,T",	0x4c000028, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S, I4	},
+{"msub.ps", "D,R,S,T",	0x4c00002e, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, I5	},
+{"msub",    "s,t",      0x0000001e, 0xfc00ffff, RD_s|RD_t|WR_HILO,	L1    	},
+{"msub",    "s,t",      0x70000004, 0xfc00ffff, RD_s|RD_t|MOD_HILO,     I32     },
+{"msubu",   "s,t",      0x0000001f, 0xfc00ffff, RD_s|RD_t|WR_HILO,	L1	},
+{"msubu",   "s,t",      0x70000005, 0xfc00ffff, RD_s|RD_t|MOD_HILO,     I32     },
 {"mtc0",    "t,G",	0x40800000, 0xffe007ff,	COD|RD_t|WR_C0|WR_CC,	I1	},
+{"mtc0",    "t,G,H",    0x40800000, 0xffe007f8, COD|RD_t|WR_C0|WR_CC,   I32     },
 {"mtc1",    "t,S",	0x44800000, 0xffe007ff,	COD|RD_t|WR_S|FP_S,	I1	},
 {"mtc1",    "t,G",	0x44800000, 0xffe007ff,	COD|RD_t|WR_S|FP_S,	I1	},
 {"mtc2",    "t,G",	0x48800000, 0xffe007ff,	COD|RD_t|WR_C2|WR_CC,	I1	},
+{"mtc2",    "t,G,H",    0x48800000, 0xffe007f8, COD|RD_t|WR_C2|WR_CC,   I32     },
 {"mtc3",    "t,G",	0x4c800000, 0xffe007ff,	COD|RD_t|WR_C3|WR_CC,	I1	},
-{"mthi",    "s",	0x00000011, 0xfc1fffff,	RD_s|WR_HI,	I1	},
-{"mtlo",    "s",	0x00000013, 0xfc1fffff,	RD_s|WR_LO,	I1	},
+{"mtc3",    "t,G,H",    0x4c800000, 0xffe007f8, COD|RD_t|WR_C3|WR_CC,   I32     },
+{"mthi",    "s",	0x00000011, 0xfc1fffff,	RD_s|WR_HI,		I1	},
+{"mtlo",    "s",	0x00000013, 0xfc1fffff,	RD_s|WR_LO,		I1	},
 {"mul.d",   "D,V,T",	0x46200002, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I1	},
 {"mul.s",   "D,V,T",	0x46000002, 0xffe0003f,	WR_D|RD_S|RD_T|FP_S,	I1	},
 {"mul.ps",  "D,V,T",	0x46c00002, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I5	},
-{"mul",     "d,v,t",	0x70000002, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HI|WR_LO,P3},
-{"mul",     "d,v,t",	0,    (int) M_MUL,	INSN_MACRO,	I1	},
-{"mul",     "d,v,I",	0,    (int) M_MUL_I,	INSN_MACRO,	I1	},
-{"mulo",    "d,v,t",	0,    (int) M_MULO,	INSN_MACRO,	I1	},
-{"mulo",    "d,v,I",	0,    (int) M_MULO_I,	INSN_MACRO,	I1	},
-{"mulou",   "d,v,t",	0,    (int) M_MULOU,	INSN_MACRO,	I1	},
-{"mulou",   "d,v,I",	0,    (int) M_MULOU_I,	INSN_MACRO,	I1	},
-{"mult",    "s,t",	0x00000018, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO|IS_M,	I1},
-{"mult",    "d,s,t",	0x00000018, 0xfc0007ff,	RD_s|RD_t|WR_HI|WR_LO|WR_d|IS_M, G1},
-{"multu",   "s,t",	0x00000019, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO|IS_M,	I1},
-{"multu",   "d,s,t",	0x00000019, 0xfc0007ff,	RD_s|RD_t|WR_HI|WR_LO|WR_d|IS_M, G1},
-{"neg",     "d,w",	0x00000022, 0xffe007ff,	WR_d|RD_t,	I1	}, /* sub 0 */
-{"negu",    "d,w",	0x00000023, 0xffe007ff,	WR_d|RD_t,	I1	}, /* subu 0 */
-{"neg.d",   "D,V",	0x46200007, 0xffff003f,	WR_D|RD_S|FP_D,	I1	},
-{"neg.s",   "D,V",	0x46000007, 0xffff003f,	WR_D|RD_S|FP_S,	I1	},
-{"neg.ps",  "D,V",	0x46c00007, 0xffff003f,	WR_D|RD_S|FP_D,I5	},
-{"nmadd.d", "D,R,S,T",	0x4c000031, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D,	I4	},
-{"nmadd.s", "D,R,S,T",	0x4c000030, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S,	I4	},
-{"nmadd.ps","D,R,S,T",	0x4c000036, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D,	I5	},
-{"nmsub.d", "D,R,S,T",	0x4c000039, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D,	I4	},
-{"nmsub.s", "D,R,S,T",	0x4c000038, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S,	I4	},
-{"nmsub.ps","D,R,S,T",	0x4c00003e, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D,	I5	},
+{"mul",     "d,v,t",    0x70000002, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, I32|P3  },
+{"mul",     "d,v,t",	0,    (int) M_MUL,	INSN_MACRO,		I1	},
+{"mul",     "d,v,I",	0,    (int) M_MUL_I,	INSN_MACRO,		I1	},
+{"mulo",    "d,v,t",	0,    (int) M_MULO,	INSN_MACRO,		I1	},
+{"mulo",    "d,v,I",	0,    (int) M_MULO_I,	INSN_MACRO,		I1	},
+{"mulou",   "d,v,t",	0,    (int) M_MULOU,	INSN_MACRO,		I1	},
+{"mulou",   "d,v,I",	0,    (int) M_MULOU_I,	INSN_MACRO,		I1	},
+{"mult",    "s,t",      0x00000018, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, I1	},
+{"mult",    "d,s,t",    0x00000018, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, G1	},
+{"multu",   "s,t",      0x00000019, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, I1	},
+{"multu",   "d,s,t",    0x00000019, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, G1	},
+{"neg",     "d,w",	0x00000022, 0xffe007ff,	WR_d|RD_t,		I1	}, /* sub 0 */
+{"negu",    "d,w",	0x00000023, 0xffe007ff,	WR_d|RD_t,		I1	}, /* subu 0 */
+{"neg.d",   "D,V",	0x46200007, 0xffff003f,	WR_D|RD_S|FP_D,		I1	},
+{"neg.s",   "D,V",	0x46000007, 0xffff003f,	WR_D|RD_S|FP_S,		I1	},
+{"neg.ps",  "D,V",	0x46c00007, 0xffff003f,	WR_D|RD_S|FP_D,		I5	},
+{"nmadd.d", "D,R,S,T",	0x4c000031, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, I4	},
+{"nmadd.s", "D,R,S,T",	0x4c000030, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S, I4	},
+{"nmadd.ps","D,R,S,T",	0x4c000036, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, I5	},
+{"nmsub.d", "D,R,S,T",	0x4c000039, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, I4	},
+{"nmsub.s", "D,R,S,T",	0x4c000038, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S, I4	},
+{"nmsub.ps","D,R,S,T",	0x4c00003e, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, I5	},
 /* nop is at the start of the table.  */
-{"nor",     "d,v,t",	0x00000027, 0xfc0007ff,	WR_d|RD_s|RD_t,	I1	},
-{"nor",     "t,r,I",	0,    (int) M_NOR_I,	INSN_MACRO,	I1	},
-{"not",     "d,v",	0x00000027, 0xfc1f07ff,	WR_d|RD_s|RD_t,	I1	},/*nor d,s,0*/
-{"or",      "d,v,t",	0x00000025, 0xfc0007ff,	WR_d|RD_s|RD_t,	I1	},
-{"or",      "t,r,I",	0,    (int) M_OR_I,	INSN_MACRO,	I1	},
-{"ori",     "t,r,i",	0x34000000, 0xfc000000,	WR_t|RD_s,	I1	},
+{"nor",     "d,v,t",	0x00000027, 0xfc0007ff,	WR_d|RD_s|RD_t,		I1	},
+{"nor",     "t,r,I",	0,    (int) M_NOR_I,	INSN_MACRO,		I1	},
+{"not",     "d,v",	0x00000027, 0xfc1f07ff,	WR_d|RD_s|RD_t,		I1	},/*nor d,s,0*/
+{"or",      "d,v,t",	0x00000025, 0xfc0007ff,	WR_d|RD_s|RD_t,		I1	},
+{"or",      "t,r,I",	0,    (int) M_OR_I,	INSN_MACRO,		I1	},
+{"ori",     "t,r,i",	0x34000000, 0xfc000000,	WR_t|RD_s,		I1	},
 
-{"pll.ps",  "D,V,T",	0x46c0002c, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I5},
-{"plu.ps",  "D,V,T",	0x46c0002d, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I5},
+{"pll.ps",  "D,V,T",	0x46c0002c, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I5	},
+{"plu.ps",  "D,V,T",	0x46c0002d, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I5	},
 
-{"pref",    "k,o(b)",	0xcc000000, 0xfc000000, RD_b,		G3|M1	},
-{"prefx",   "h,t(b)",	0x4c00000f, 0xfc0007ff, RD_b|RD_t,	I4	},
+/* pref is at the start of the table.  */
+{"prefx",   "h,t(b)",	0x4c00000f, 0xfc0007ff, RD_b|RD_t,		I4	},
 
-{"pul.ps",  "D,V,T",	0x46c0002e, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I5},
-{"puu.ps",  "D,V,T",	0x46c0002f, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I5},
+{"pul.ps",  "D,V,T",	0x46c0002e, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I5	},
+{"puu.ps",  "D,V,T",	0x46c0002f, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I5	},
 
-{"recip.d", "D,S",	0x46200015, 0xffff003f, WR_D|RD_S|FP_D,	I4	},
-{"recip.s", "D,S",	0x46000015, 0xffff003f, WR_D|RD_S|FP_S,	I4	},
-{"rem",     "z,s,t",	0x0000001a, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO,	I1 },
-{"rem",     "d,v,t",	0,    (int) M_REM_3,	INSN_MACRO,	I1	},
-{"rem",     "d,v,I",	0,    (int) M_REM_3I,	INSN_MACRO,	I1	},
-{"remu",    "z,s,t",	0x0000001b, 0xfc00ffff,	RD_s|RD_t|WR_HI|WR_LO,	I1 },
-{"remu",    "d,v,t",	0,    (int) M_REMU_3,	INSN_MACRO,	I1	},
-{"remu",    "d,v,I",	0,    (int) M_REMU_3I,	INSN_MACRO,	I1	},
-{"rfe",     "",		0x42000010, 0xffffffff,	0,	I1|T3		},
-{"rol",     "d,v,t",	0,    (int) M_ROL,	INSN_MACRO,	I1	},
-{"rol",     "d,v,I",	0,    (int) M_ROL_I,	INSN_MACRO,	I1	},
-{"ror",     "d,v,t",	0,    (int) M_ROR,	INSN_MACRO,	I1	},
-{"ror",     "d,v,I",	0,    (int) M_ROR_I,	INSN_MACRO,	I1	},
-{"round.l.d", "D,S",	0x46200008, 0xffff003f, WR_D|RD_S|FP_D,	I3	},
-{"round.l.s", "D,S",	0x46000008, 0xffff003f, WR_D|RD_S|FP_S,	I3	},
-{"round.w.d", "D,S",	0x4620000c, 0xffff003f, WR_D|RD_S|FP_D,	I2	},
-{"round.w.s", "D,S",	0x4600000c, 0xffff003f, WR_D|RD_S|FP_S,	I2	},
-{"rsqrt.d", "D,S",	0x46200016, 0xffff003f, WR_D|RD_S|FP_D,	I4	},
-{"rsqrt.s", "D,S",	0x46000016, 0xffff003f, WR_D|RD_S|FP_S,	I4	},
-{"sb",      "t,o(b)",	0xa0000000, 0xfc000000,	SM|RD_t|RD_b,	I1	},
-{"sb",      "t,A(b)",	0,    (int) M_SB_AB,	INSN_MACRO,	I1	},
+{"recip.d", "D,S",	0x46200015, 0xffff003f, WR_D|RD_S|FP_D,		I4	},
+{"recip.s", "D,S",	0x46000015, 0xffff003f, WR_D|RD_S|FP_S,		I4	},
+{"rem",     "z,s,t",    0x0000001a, 0xfc00ffff, RD_s|RD_t|WR_HILO,      I1	},
+{"rem",     "d,v,t",	0,    (int) M_REM_3,	INSN_MACRO,		I1	},
+{"rem",     "d,v,I",	0,    (int) M_REM_3I,	INSN_MACRO,		I1	},
+{"remu",    "z,s,t",    0x0000001b, 0xfc00ffff, RD_s|RD_t|WR_HILO,      I1	},
+{"remu",    "d,v,t",	0,    (int) M_REMU_3,	INSN_MACRO,		I1	},
+{"remu",    "d,v,I",	0,    (int) M_REMU_3I,	INSN_MACRO,		I1	},
+{"rfe",     "",		0x42000010, 0xffffffff,	0,			I1|T3	},
+{"rol",     "d,v,t",	0,    (int) M_ROL,	INSN_MACRO,		I1	},
+{"rol",     "d,v,I",	0,    (int) M_ROL_I,	INSN_MACRO,		I1	},
+{"ror",     "d,v,t",	0,    (int) M_ROR,	INSN_MACRO,		I1	},
+{"ror",     "d,v,I",	0,    (int) M_ROR_I,	INSN_MACRO,		I1	},
+{"round.l.d", "D,S",	0x46200008, 0xffff003f, WR_D|RD_S|FP_D,		I3	},
+{"round.l.s", "D,S",	0x46000008, 0xffff003f, WR_D|RD_S|FP_S,		I3	},
+{"round.w.d", "D,S",	0x4620000c, 0xffff003f, WR_D|RD_S|FP_D,		I2	},
+{"round.w.s", "D,S",	0x4600000c, 0xffff003f, WR_D|RD_S|FP_S,		I2	},
+{"rsqrt.d", "D,S",	0x46200016, 0xffff003f, WR_D|RD_S|FP_D,		I4	},
+{"rsqrt.s", "D,S",	0x46000016, 0xffff003f, WR_D|RD_S|FP_S,		I4	},
+{"sb",      "t,o(b)",	0xa0000000, 0xfc000000,	SM|RD_t|RD_b,		I1	},
+{"sb",      "t,A(b)",	0,    (int) M_SB_AB,	INSN_MACRO,		I1	},
 {"sc",	    "t,o(b)",	0xe0000000, 0xfc000000, SM|RD_t|WR_t|RD_b,	I2	},
-{"sc",	    "t,A(b)",	0,    (int) M_SC_AB,	INSN_MACRO,	I2	},
+{"sc",	    "t,A(b)",	0,    (int) M_SC_AB,	INSN_MACRO,		I2	},
 {"scd",	    "t,o(b)",	0xf0000000, 0xfc000000, SM|RD_t|WR_t|RD_b,	I3	},
-{"scd",	    "t,A(b)",	0,    (int) M_SCD_AB,	INSN_MACRO,	I3	},
-{"sd",	    "t,o(b)",	0xfc000000, 0xfc000000,	SM|RD_t|RD_b,	I3	},
-{"sd",      "t,o(b)",	0,    (int) M_SD_OB,	INSN_MACRO,	I1	},
-{"sd",      "t,A(b)",	0,    (int) M_SD_AB,	INSN_MACRO,	I1	},
-{"sdbbp",   "",		0x0000000e, 0xffffffff,	TRAP,           G2|M1	},
-{"sdbbp",   "c",	0x0000000e, 0xfc00ffff,	TRAP,		G2|M1	},
-{"sdbbp",   "c,q",	0x0000000e, 0xfc00003f,	TRAP,		G2|M1	},
+{"scd",	    "t,A(b)",	0,    (int) M_SCD_AB,	INSN_MACRO,		I3	},
+{"sd",	    "t,o(b)",	0xfc000000, 0xfc000000,	SM|RD_t|RD_b,		I3	},
+{"sd",      "t,o(b)",	0,    (int) M_SD_OB,	INSN_MACRO,		I1	},
+{"sd",      "t,A(b)",	0,    (int) M_SD_AB,	INSN_MACRO,		I1	},
+{"sdbbp",   "",		0x0000000e, 0xffffffff,	TRAP,           	G2	},
+{"sdbbp",   "c",	0x0000000e, 0xfc00ffff,	TRAP,			G2	},
+{"sdbbp",   "c,q",	0x0000000e, 0xfc00003f,	TRAP,			G2	},
+{"sdbbp",   "",         0x7000003f, 0xffffffff, TRAP,           	I32     },
+{"sdbbp",   "B",        0x7000003f, 0xfc00003f, TRAP,           	I32     },
 {"sdc1",    "T,o(b)",	0xf4000000, 0xfc000000, SM|RD_T|RD_b|FP_D,	I2	},
 {"sdc1",    "E,o(b)",	0xf4000000, 0xfc000000, SM|RD_T|RD_b|FP_D,	I2	},
-{"sdc1",    "T,A(b)",	0,    (int) M_SDC1_AB,	INSN_MACRO,	I2	},
-{"sdc1",    "E,A(b)",	0,    (int) M_SDC1_AB,	INSN_MACRO,	I2	},
-{"sdc2",    "E,o(b)",	0xf8000000, 0xfc000000, SM|RD_C2|RD_b,	I2	},
-{"sdc2",    "E,A(b)",	0,    (int) M_SDC2_AB,	INSN_MACRO,	I2	},
-{"sdc3",    "E,o(b)",	0xfc000000, 0xfc000000, SM|RD_C3|RD_b,	I2	},
-{"sdc3",    "E,A(b)",	0,    (int) M_SDC3_AB,	INSN_MACRO,	I2	},
+{"sdc1",    "T,A(b)",	0,    (int) M_SDC1_AB,	INSN_MACRO,		I2	},
+{"sdc1",    "E,A(b)",	0,    (int) M_SDC1_AB,	INSN_MACRO,		I2	},
+{"sdc2",    "E,o(b)",	0xf8000000, 0xfc000000, SM|RD_C2|RD_b,		I2	},
+{"sdc2",    "E,A(b)",	0,    (int) M_SDC2_AB,	INSN_MACRO,		I2	},
+{"sdc3",    "E,o(b)",	0xfc000000, 0xfc000000, SM|RD_C3|RD_b,		I2	},
+{"sdc3",    "E,A(b)",	0,    (int) M_SDC3_AB,	INSN_MACRO,		I2	},
 {"s.d",     "T,o(b)",	0xf4000000, 0xfc000000, SM|RD_T|RD_b|FP_D,	I2	},
-{"s.d",     "T,o(b)",	0,    (int) M_S_DOB,	INSN_MACRO,	I1	},
-{"s.d",     "T,A(b)",	0,    (int) M_S_DAB,	INSN_MACRO,	I1	},
-{"sdl",     "t,o(b)",	0xb0000000, 0xfc000000,	SM|RD_t|RD_b,	I3	},
-{"sdl",     "t,A(b)",	0,    (int) M_SDL_AB,	INSN_MACRO,	I3	},
-{"sdr",     "t,o(b)",	0xb4000000, 0xfc000000,	SM|RD_t|RD_b,	I3	},
-{"sdr",     "t,A(b)",	0,    (int) M_SDR_AB,	INSN_MACRO,	I3	},
+{"s.d",     "T,o(b)",	0,    (int) M_S_DOB,	INSN_MACRO,		I1	},
+{"s.d",     "T,A(b)",	0,    (int) M_S_DAB,	INSN_MACRO,		I1	},
+{"sdl",     "t,o(b)",	0xb0000000, 0xfc000000,	SM|RD_t|RD_b,		I3	},
+{"sdl",     "t,A(b)",	0,    (int) M_SDL_AB,	INSN_MACRO,		I3	},
+{"sdr",     "t,o(b)",	0xb4000000, 0xfc000000,	SM|RD_t|RD_b,		I3	},
+{"sdr",     "t,A(b)",	0,    (int) M_SDR_AB,	INSN_MACRO,		I3	},
 {"sdxc1",   "S,t(b)",   0x4c000009, 0xfc0007ff, SM|RD_S|RD_t|RD_b,	I4	},
-{"selsl",   "d,v,t",	0x00000005, 0xfc0007ff,	WR_d|RD_s|RD_t,L1	},
-{"selsr",   "d,v,t",	0x00000001, 0xfc0007ff,	WR_d|RD_s|RD_t,L1	},
-{"seq",     "d,v,t",	0,    (int) M_SEQ,	INSN_MACRO,	I1	},
-{"seq",     "d,v,I",	0,    (int) M_SEQ_I,	INSN_MACRO,	I1	},
-{"sge",     "d,v,t",	0,    (int) M_SGE,	INSN_MACRO,	I1	},
-{"sge",     "d,v,I",	0,    (int) M_SGE_I,	INSN_MACRO,	I1	},
-{"sgeu",    "d,v,t",	0,    (int) M_SGEU,	INSN_MACRO,	I1	},
-{"sgeu",    "d,v,I",	0,    (int) M_SGEU_I,	INSN_MACRO,	I1	},
-{"sgt",     "d,v,t",	0,    (int) M_SGT,	INSN_MACRO,	I1	},
-{"sgt",     "d,v,I",	0,    (int) M_SGT_I,	INSN_MACRO,	I1	},
-{"sgtu",    "d,v,t",	0,    (int) M_SGTU,	INSN_MACRO,	I1	},
-{"sgtu",    "d,v,I",	0,    (int) M_SGTU_I,	INSN_MACRO,	I1	},
-{"sh",      "t,o(b)",	0xa4000000, 0xfc000000,	SM|RD_t|RD_b,	I1	},
-{"sh",      "t,A(b)",	0,    (int) M_SH_AB,	INSN_MACRO,	I1	},
-{"sle",     "d,v,t",	0,    (int) M_SLE,	INSN_MACRO,	I1	},
-{"sle",     "d,v,I",	0,    (int) M_SLE_I,	INSN_MACRO,	I1	},
-{"sleu",    "d,v,t",	0,    (int) M_SLEU,	INSN_MACRO,	I1	},
-{"sleu",    "d,v,I",	0,    (int) M_SLEU_I,	INSN_MACRO,	I1	},
-{"sllv",    "d,t,s",	0x00000004, 0xfc0007ff,	WR_d|RD_t|RD_s,	I1	},
-{"sll",     "d,w,s",	0x00000004, 0xfc0007ff,	WR_d|RD_t|RD_s,	I1	}, /* sllv */
-{"sll",     "d,w,<",	0x00000000, 0xffe0003f,	WR_d|RD_t,	I1	},
-{"slt",     "d,v,t",	0x0000002a, 0xfc0007ff,	WR_d|RD_s|RD_t,	I1	},
-{"slt",     "d,v,I",	0,    (int) M_SLT_I,	INSN_MACRO,	I1	},
-{"slti",    "t,r,j",	0x28000000, 0xfc000000,	WR_t|RD_s,	I1	},
-{"sltiu",   "t,r,j",	0x2c000000, 0xfc000000,	WR_t|RD_s,	I1	},
-{"sltu",    "d,v,t",	0x0000002b, 0xfc0007ff,	WR_d|RD_s|RD_t,	I1	},
-{"sltu",    "d,v,I",	0,    (int) M_SLTU_I,	INSN_MACRO,	I1	},
-{"sne",     "d,v,t",	0,    (int) M_SNE,	INSN_MACRO,	I1	},
-{"sne",     "d,v,I",	0,    (int) M_SNE_I,	INSN_MACRO,	I1	},
-{"sqrt.d",  "D,S",	0x46200004, 0xffff003f, WR_D|RD_S|FP_D,	I2	},
-{"sqrt.s",  "D,S",	0x46000004, 0xffff003f, WR_D|RD_S|FP_S,	I2	},
-{"srav",    "d,t,s",	0x00000007, 0xfc0007ff,	WR_d|RD_t|RD_s,	I1	},
-{"sra",     "d,w,s",	0x00000007, 0xfc0007ff,	WR_d|RD_t|RD_s,	I1	}, /* srav */
-{"sra",     "d,w,<",	0x00000003, 0xffe0003f,	WR_d|RD_t,	I1	},
-{"srlv",    "d,t,s",	0x00000006, 0xfc0007ff,	WR_d|RD_t|RD_s,	I1	},
-{"srl",     "d,w,s",	0x00000006, 0xfc0007ff,	WR_d|RD_t|RD_s,	I1	}, /* srlv */
-{"srl",     "d,w,<",	0x00000002, 0xffe0003f,	WR_d|RD_t,	I1	},
-{"ssnop",     "",	0x00000040, 0xffffffff,	0,		M1	},
-{"standby", "",         0x42000021, 0xffffffff,	0,		V1	},
-{"sub",     "d,v,t",	0x00000022, 0xfc0007ff,	WR_d|RD_s|RD_t,	I1	},
-{"sub",     "d,v,I",	0,    (int) M_SUB_I,	INSN_MACRO,	I1	},
+{"selsl",   "d,v,t",	0x00000005, 0xfc0007ff,	WR_d|RD_s|RD_t,		L1	},
+{"selsr",   "d,v,t",	0x00000001, 0xfc0007ff,	WR_d|RD_s|RD_t,		L1	},
+{"seq",     "d,v,t",	0,    (int) M_SEQ,	INSN_MACRO,		I1	},
+{"seq",     "d,v,I",	0,    (int) M_SEQ_I,	INSN_MACRO,		I1	},
+{"sge",     "d,v,t",	0,    (int) M_SGE,	INSN_MACRO,		I1	},
+{"sge",     "d,v,I",	0,    (int) M_SGE_I,	INSN_MACRO,		I1	},
+{"sgeu",    "d,v,t",	0,    (int) M_SGEU,	INSN_MACRO,		I1	},
+{"sgeu",    "d,v,I",	0,    (int) M_SGEU_I,	INSN_MACRO,		I1	},
+{"sgt",     "d,v,t",	0,    (int) M_SGT,	INSN_MACRO,		I1	},
+{"sgt",     "d,v,I",	0,    (int) M_SGT_I,	INSN_MACRO,		I1	},
+{"sgtu",    "d,v,t",	0,    (int) M_SGTU,	INSN_MACRO,		I1	},
+{"sgtu",    "d,v,I",	0,    (int) M_SGTU_I,	INSN_MACRO,		I1	},
+{"sh",      "t,o(b)",	0xa4000000, 0xfc000000,	SM|RD_t|RD_b,		I1	},
+{"sh",      "t,A(b)",	0,    (int) M_SH_AB,	INSN_MACRO,		I1	},
+{"sle",     "d,v,t",	0,    (int) M_SLE,	INSN_MACRO,		I1	},
+{"sle",     "d,v,I",	0,    (int) M_SLE_I,	INSN_MACRO,		I1	},
+{"sleu",    "d,v,t",	0,    (int) M_SLEU,	INSN_MACRO,		I1	},
+{"sleu",    "d,v,I",	0,    (int) M_SLEU_I,	INSN_MACRO,		I1	},
+{"sllv",    "d,t,s",	0x00000004, 0xfc0007ff,	WR_d|RD_t|RD_s,		I1	},
+{"sll",     "d,w,s",	0x00000004, 0xfc0007ff,	WR_d|RD_t|RD_s,		I1	}, /* sllv */
+{"sll",     "d,w,<",	0x00000000, 0xffe0003f,	WR_d|RD_t,		I1	},
+{"slt",     "d,v,t",	0x0000002a, 0xfc0007ff,	WR_d|RD_s|RD_t,		I1	},
+{"slt",     "d,v,I",	0,    (int) M_SLT_I,	INSN_MACRO,		I1	},
+{"slti",    "t,r,j",	0x28000000, 0xfc000000,	WR_t|RD_s,		I1	},
+{"sltiu",   "t,r,j",	0x2c000000, 0xfc000000,	WR_t|RD_s,		I1	},
+{"sltu",    "d,v,t",	0x0000002b, 0xfc0007ff,	WR_d|RD_s|RD_t,		I1	},
+{"sltu",    "d,v,I",	0,    (int) M_SLTU_I,	INSN_MACRO,		I1	},
+{"sne",     "d,v,t",	0,    (int) M_SNE,	INSN_MACRO,		I1	},
+{"sne",     "d,v,I",	0,    (int) M_SNE_I,	INSN_MACRO,		I1	},
+{"sqrt.d",  "D,S",	0x46200004, 0xffff003f, WR_D|RD_S|FP_D,		I2	},
+{"sqrt.s",  "D,S",	0x46000004, 0xffff003f, WR_D|RD_S|FP_S,		I2	},
+{"srav",    "d,t,s",	0x00000007, 0xfc0007ff,	WR_d|RD_t|RD_s,		I1	},
+{"sra",     "d,w,s",	0x00000007, 0xfc0007ff,	WR_d|RD_t|RD_s,		I1	}, /* srav */
+{"sra",     "d,w,<",	0x00000003, 0xffe0003f,	WR_d|RD_t,		I1	},
+{"srlv",    "d,t,s",	0x00000006, 0xfc0007ff,	WR_d|RD_t|RD_s,		I1	},
+{"srl",     "d,w,s",	0x00000006, 0xfc0007ff,	WR_d|RD_t|RD_s,		I1	}, /* srlv */
+{"srl",     "d,w,<",	0x00000002, 0xffe0003f,	WR_d|RD_t,		I1	},
+/* ssnop is at the start of the table.  */
+{"standby", "",         0x42000021, 0xffffffff,	0,			V1	},
+{"sub",     "d,v,t",	0x00000022, 0xfc0007ff,	WR_d|RD_s|RD_t,		I1	},
+{"sub",     "d,v,I",	0,    (int) M_SUB_I,	INSN_MACRO,		I1	},
 {"sub.d",   "D,V,T",	0x46200001, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I1	},     
 {"sub.s",   "D,V,T",	0x46000001, 0xffe0003f,	WR_D|RD_S|RD_T|FP_S,	I1	},
 {"sub.ps",  "D,V,T",	0x46c00001, 0xffe0003f,	WR_D|RD_S|RD_T|FP_D,	I5	},
-{"subu",    "d,v,t",	0x00000023, 0xfc0007ff,	WR_d|RD_s|RD_t,	I1	},
-{"subu",    "d,v,I",	0,    (int) M_SUBU_I,	INSN_MACRO,	I1	},
-{"suspend", "",         0x42000022, 0xffffffff,	0,		V1	},
+{"subu",    "d,v,t",	0x00000023, 0xfc0007ff,	WR_d|RD_s|RD_t,		I1	},
+{"subu",    "d,v,I",	0,    (int) M_SUBU_I,	INSN_MACRO,		I1	},
+{"suspend", "",         0x42000022, 0xffffffff,	0,			V1	},
 {"suxc1",   "S,t(b)",   0x4c00000d, 0xfc0007ff, SM|RD_S|RD_t|RD_b,	I5	},
-{"sw",      "t,o(b)",	0xac000000, 0xfc000000,	SM|RD_t|RD_b,	I1	},
-{"sw",      "t,A(b)",	0,    (int) M_SW_AB,	INSN_MACRO,	I1	},
-{"swc0",    "E,o(b)",	0xe0000000, 0xfc000000,	SM|RD_C0|RD_b,	I1	},
-{"swc0",    "E,A(b)",	0,    (int) M_SWC0_AB,	INSN_MACRO,	I1	},
+{"sw",      "t,o(b)",	0xac000000, 0xfc000000,	SM|RD_t|RD_b,		I1	},
+{"sw",      "t,A(b)",	0,    (int) M_SW_AB,	INSN_MACRO,		I1	},
+{"swc0",    "E,o(b)",	0xe0000000, 0xfc000000,	SM|RD_C0|RD_b,		I1	},
+{"swc0",    "E,A(b)",	0,    (int) M_SWC0_AB,	INSN_MACRO,		I1	},
 {"swc1",    "T,o(b)",	0xe4000000, 0xfc000000,	SM|RD_T|RD_b|FP_S,	I1	},
 {"swc1",    "E,o(b)",	0xe4000000, 0xfc000000,	SM|RD_T|RD_b|FP_S,	I1	},
-{"swc1",    "T,A(b)",	0,    (int) M_SWC1_AB,	INSN_MACRO,	I1	},
-{"swc1",    "E,A(b)",	0,    (int) M_SWC1_AB,	INSN_MACRO,	I1	},
+{"swc1",    "T,A(b)",	0,    (int) M_SWC1_AB,	INSN_MACRO,		I1	},
+{"swc1",    "E,A(b)",	0,    (int) M_SWC1_AB,	INSN_MACRO,		I1	},
 {"s.s",     "T,o(b)",	0xe4000000, 0xfc000000,	SM|RD_T|RD_b|FP_S,	I1	}, /* swc1 */
-{"s.s",     "T,A(b)",	0,    (int) M_SWC1_AB,	INSN_MACRO,	I1	},
-{"swc2",    "E,o(b)",	0xe8000000, 0xfc000000,	SM|RD_C2|RD_b,	I1	},
-{"swc2",    "E,A(b)",	0,    (int) M_SWC2_AB,	INSN_MACRO,	I1	},
-{"swc3",    "E,o(b)",	0xec000000, 0xfc000000,	SM|RD_C3|RD_b,	I1	},
-{"swc3",    "E,A(b)",	0,    (int) M_SWC3_AB,	INSN_MACRO,	I1	},
-{"swl",     "t,o(b)",	0xa8000000, 0xfc000000,	SM|RD_t|RD_b,	I1	},
-{"swl",     "t,A(b)",	0,    (int) M_SWL_AB,	INSN_MACRO,	I1	},
-{"scache",  "t,o(b)",	0xa8000000, 0xfc000000,	RD_t|RD_b,	I2	}, /* same */
-{"scache",  "t,A(b)",	0,    (int) M_SWL_AB,	INSN_MACRO,	I2	}, /* as swl */
-{"swr",     "t,o(b)",	0xb8000000, 0xfc000000,	SM|RD_t|RD_b,	I1	},
-{"swr",     "t,A(b)",	0,    (int) M_SWR_AB,	INSN_MACRO,	I1	},
-{"invalidate", "t,o(b)",0xb8000000, 0xfc000000,	RD_t|RD_b,	I2	}, /* same */
-{"invalidate", "t,A(b)",0,    (int) M_SWR_AB,	INSN_MACRO,	I2	}, /* as swr */
+{"s.s",     "T,A(b)",	0,    (int) M_SWC1_AB,	INSN_MACRO,		I1	},
+{"swc2",    "E,o(b)",	0xe8000000, 0xfc000000,	SM|RD_C2|RD_b,		I1	},
+{"swc2",    "E,A(b)",	0,    (int) M_SWC2_AB,	INSN_MACRO,		I1	},
+{"swc3",    "E,o(b)",	0xec000000, 0xfc000000,	SM|RD_C3|RD_b,		I1	},
+{"swc3",    "E,A(b)",	0,    (int) M_SWC3_AB,	INSN_MACRO,		I1	},
+{"swl",     "t,o(b)",	0xa8000000, 0xfc000000,	SM|RD_t|RD_b,		I1	},
+{"swl",     "t,A(b)",	0,    (int) M_SWL_AB,	INSN_MACRO,		I1	},
+{"scache",  "t,o(b)",	0xa8000000, 0xfc000000,	RD_t|RD_b,		I2	}, /* same */
+{"scache",  "t,A(b)",	0,    (int) M_SWL_AB,	INSN_MACRO,		I2	}, /* as swl */
+{"swr",     "t,o(b)",	0xb8000000, 0xfc000000,	SM|RD_t|RD_b,		I1	},
+{"swr",     "t,A(b)",	0,    (int) M_SWR_AB,	INSN_MACRO,		I1	},
+{"invalidate", "t,o(b)",0xb8000000, 0xfc000000,	RD_t|RD_b,		I2	}, /* same */
+{"invalidate", "t,A(b)",0,    (int) M_SWR_AB,	INSN_MACRO,		I2	}, /* as swr */
 {"swxc1",   "S,t(b)",   0x4c000008, 0xfc0007ff, SM|RD_S|RD_t|RD_b,	I4	},
-{"sync",    "",		0x0000000f, 0xffffffff,	INSN_SYNC,	I2|G1	},
-{"sync.p",  "",		0x0000040f, 0xffffffff,	INSN_SYNC,	I2	},
-{"sync.l",  "",		0x0000000f, 0xffffffff,	INSN_SYNC,	I2	},
-{"syscall", "",		0x0000000c, 0xffffffff,	TRAP,	I1		},
-{"syscall", "B",	0x0000000c, 0xfc00003f,	TRAP,	I1		},
-{"teqi",    "s,j",	0x040c0000, 0xfc1f0000, RD_s|TRAP,	I2	},
-{"teq",	    "s,t",	0x00000034, 0xfc00ffff, RD_s|RD_t|TRAP,	I2	},
-{"teq",	    "s,t,q",	0x00000034, 0xfc00003f, RD_s|RD_t|TRAP,	I2	},
-{"teq",     "s,j",	0x040c0000, 0xfc1f0000, RD_s|TRAP,	I2	}, /* teqi */
-{"teq",     "s,I",	0,    (int) M_TEQ_I,	INSN_MACRO,	I2	},
-{"tgei",    "s,j",	0x04080000, 0xfc1f0000, RD_s|TRAP,	I2	},
-{"tge",	    "s,t",	0x00000030, 0xfc00ffff,	RD_s|RD_t|TRAP,	I2	},
-{"tge",	    "s,t,q",	0x00000030, 0xfc00003f,	RD_s|RD_t|TRAP,	I2	},
-{"tge",     "s,j",	0x04080000, 0xfc1f0000, RD_s|TRAP,	I2	}, /* tgei */
-{"tge",	    "s,I",	0,    (int) M_TGE_I,    INSN_MACRO,	I2	},
-{"tgeiu",   "s,j",	0x04090000, 0xfc1f0000, RD_s|TRAP,	I2		},
-{"tgeu",    "s,t",	0x00000031, 0xfc00ffff, RD_s|RD_t|TRAP,	I2	 },
-{"tgeu",    "s,t,q",	0x00000031, 0xfc00003f, RD_s|RD_t|TRAP,	I2	 },
-{"tgeu",    "s,j",	0x04090000, 0xfc1f0000, RD_s|TRAP,	I2		}, /* tgeiu */
-{"tgeu",    "s,I",	0,    (int) M_TGEU_I,	INSN_MACRO,	I2	},
-{"tlbp",    "",		0x42000008, 0xffffffff,	INSN_TLB,	I1|M1	},
-{"tlbr",    "",		0x42000001, 0xffffffff,	INSN_TLB,	I1|M1	},
-{"tlbwi",   "",		0x42000002, 0xffffffff,	INSN_TLB,	I1|M1	},
-{"tlbwr",   "",		0x42000006, 0xffffffff,	INSN_TLB,	I1|M1	},
-{"tlti",    "s,j",	0x040a0000, 0xfc1f0000,	RD_s|TRAP,	I2		},
-{"tlt",     "s,t",	0x00000032, 0xfc00ffff, RD_s|RD_t|TRAP,	I2	 },
-{"tlt",     "s,t,q",	0x00000032, 0xfc00003f, RD_s|RD_t|TRAP,	I2	 },
-{"tlt",     "s,j",	0x040a0000, 0xfc1f0000,	RD_s|TRAP,	I2		}, /* tlti */
-{"tlt",     "s,I",	0,    (int) M_TLT_I,	INSN_MACRO,	I2	},
-{"tltiu",   "s,j",	0x040b0000, 0xfc1f0000, RD_s|TRAP,	I2		},
-{"tltu",    "s,t",	0x00000033, 0xfc00ffff, RD_s|RD_t|TRAP,	I2	 },
-{"tltu",    "s,t,q",	0x00000033, 0xfc00003f, RD_s|RD_t|TRAP,	I2	 },
-{"tltu",    "s,j",	0x040b0000, 0xfc1f0000, RD_s|TRAP,	I2		}, /* tltiu */
-{"tltu",    "s,I",	0,    (int) M_TLTU_I,	INSN_MACRO,	I2	},
-{"tnei",    "s,j",	0x040e0000, 0xfc1f0000, RD_s|TRAP,	I2		},
-{"tne",     "s,t",	0x00000036, 0xfc00ffff, RD_s|RD_t|TRAP,	I2	 },
-{"tne",     "s,t,q",	0x00000036, 0xfc00003f, RD_s|RD_t|TRAP,	I2	 },
-{"tne",     "s,j",	0x040e0000, 0xfc1f0000, RD_s|TRAP,	I2		}, /* tnei */
-{"tne",     "s,I",	0,    (int) M_TNE_I,	INSN_MACRO,	I2	},
-{"trunc.l.d", "D,S",	0x46200009, 0xffff003f, WR_D|RD_S|FP_D,	I3	},
-{"trunc.l.s", "D,S",	0x46000009, 0xffff003f,	WR_D|RD_S|FP_S,	I3	},
-{"trunc.w.d", "D,S",	0x4620000d, 0xffff003f, WR_D|RD_S|FP_D,	I2	},
-{"trunc.w.d", "D,S,x",	0x4620000d, 0xffff003f, WR_D|RD_S|FP_D,	I2	},
-{"trunc.w.d", "D,S,t",	0,    (int) M_TRUNCWD,	INSN_MACRO,	I1	},
-{"trunc.w.s", "D,S",	0x4600000d, 0xffff003f,	WR_D|RD_S|FP_S,	I2	},
-{"trunc.w.s", "D,S,x",	0x4600000d, 0xffff003f,	WR_D|RD_S|FP_S,	I2	},
-{"trunc.w.s", "D,S,t",	0,    (int) M_TRUNCWS,	INSN_MACRO,	I1	},
-{"uld",     "t,o(b)",	0,    (int) M_ULD,	INSN_MACRO,	I3	},
-{"uld",     "t,A(b)",	0,    (int) M_ULD_A,	INSN_MACRO,	I3	},
-{"ulh",     "t,o(b)",	0,    (int) M_ULH,	INSN_MACRO,	I1	},
-{"ulh",     "t,A(b)",	0,    (int) M_ULH_A,	INSN_MACRO,	I1	},
-{"ulhu",    "t,o(b)",	0,    (int) M_ULHU,	INSN_MACRO,	I1	},
-{"ulhu",    "t,A(b)",	0,    (int) M_ULHU_A,	INSN_MACRO,	I1	},
-{"ulw",     "t,o(b)",	0,    (int) M_ULW,	INSN_MACRO,	I1	},
-{"ulw",     "t,A(b)",	0,    (int) M_ULW_A,	INSN_MACRO,	I1	},
-{"usd",     "t,o(b)",	0,    (int) M_USD,	INSN_MACRO,	I3	},
-{"usd",     "t,A(b)",	0,    (int) M_USD_A,	INSN_MACRO,	I3	},
-{"ush",     "t,o(b)",	0,    (int) M_USH,	INSN_MACRO,	I1	},
-{"ush",     "t,A(b)",	0,    (int) M_USH_A,	INSN_MACRO,	I1	},
-{"usw",     "t,o(b)",	0,    (int) M_USW,	INSN_MACRO,	I1	},
-{"usw",     "t,A(b)",	0,    (int) M_USW_A,	INSN_MACRO,	I1	},
-{"xor",     "d,v,t",	0x00000026, 0xfc0007ff,	WR_d|RD_s|RD_t,	I1	},
-{"xor",     "t,r,I",	0,    (int) M_XOR_I,	INSN_MACRO,	I1	},
-{"xori",    "t,r,i",	0x38000000, 0xfc000000,	WR_t|RD_s,	I1	},
-{"wait",    "",		0x42000020, 0xffffffff,	TRAP,	I3|M1	},
-{"waiti",   "",		0x42000020, 0xffffffff,	TRAP,	L1	},
-{"wb", 	    "o(b)",	0xbc040000, 0xfc1f0000, SM|RD_b,	L1	},
+{"sync",    "",		0x0000000f, 0xffffffff,	INSN_SYNC,		I2|G1	},
+{"sync.p",  "",		0x0000040f, 0xffffffff,	INSN_SYNC,		I2	},
+{"sync.l",  "",		0x0000000f, 0xffffffff,	INSN_SYNC,		I2	},
+{"syscall", "",		0x0000000c, 0xffffffff,	TRAP,			I1	},
+{"syscall", "B",	0x0000000c, 0xfc00003f,	TRAP,			I1	},
+{"teqi",    "s,j",	0x040c0000, 0xfc1f0000, RD_s|TRAP,		I2	},
+{"teq",	    "s,t",	0x00000034, 0xfc00ffff, RD_s|RD_t|TRAP,		I2	},
+{"teq",	    "s,t,q",	0x00000034, 0xfc00003f, RD_s|RD_t|TRAP,		I2	},
+{"teq",     "s,j",	0x040c0000, 0xfc1f0000, RD_s|TRAP,		I2	}, /* teqi */
+{"teq",     "s,I",	0,    (int) M_TEQ_I,	INSN_MACRO,		I2	},
+{"tgei",    "s,j",	0x04080000, 0xfc1f0000, RD_s|TRAP,		I2	},
+{"tge",	    "s,t",	0x00000030, 0xfc00ffff,	RD_s|RD_t|TRAP,		I2	},
+{"tge",	    "s,t,q",	0x00000030, 0xfc00003f,	RD_s|RD_t|TRAP,		I2	},
+{"tge",     "s,j",	0x04080000, 0xfc1f0000, RD_s|TRAP,		I2	}, /* tgei */
+{"tge",	    "s,I",	0,    (int) M_TGE_I,    INSN_MACRO,		I2	},
+{"tgeiu",   "s,j",	0x04090000, 0xfc1f0000, RD_s|TRAP,		I2	},
+{"tgeu",    "s,t",	0x00000031, 0xfc00ffff, RD_s|RD_t|TRAP,		I2	},
+{"tgeu",    "s,t,q",	0x00000031, 0xfc00003f, RD_s|RD_t|TRAP,		I2	},
+{"tgeu",    "s,j",	0x04090000, 0xfc1f0000, RD_s|TRAP,		I2	}, /* tgeiu */
+{"tgeu",    "s,I",	0,    (int) M_TGEU_I,	INSN_MACRO,		I2	},
+{"tlbp",    "",         0x42000008, 0xffffffff, INSN_TLB,       	I1   	},
+{"tlbr",    "",         0x42000001, 0xffffffff, INSN_TLB,       	I1   	},
+{"tlbwi",   "",         0x42000002, 0xffffffff, INSN_TLB,       	I1   	},
+{"tlbwr",   "",         0x42000006, 0xffffffff, INSN_TLB,       	I1   	},
+{"tlti",    "s,j",	0x040a0000, 0xfc1f0000,	RD_s|TRAP,		I2	},
+{"tlt",     "s,t",	0x00000032, 0xfc00ffff, RD_s|RD_t|TRAP,		I2	},
+{"tlt",     "s,t,q",	0x00000032, 0xfc00003f, RD_s|RD_t|TRAP,		I2	},
+{"tlt",     "s,j",	0x040a0000, 0xfc1f0000,	RD_s|TRAP,		I2	}, /* tlti */
+{"tlt",     "s,I",	0,    (int) M_TLT_I,	INSN_MACRO,		I2	},
+{"tltiu",   "s,j",	0x040b0000, 0xfc1f0000, RD_s|TRAP,		I2	},
+{"tltu",    "s,t",	0x00000033, 0xfc00ffff, RD_s|RD_t|TRAP,		I2	},
+{"tltu",    "s,t,q",	0x00000033, 0xfc00003f, RD_s|RD_t|TRAP,		I2	},
+{"tltu",    "s,j",	0x040b0000, 0xfc1f0000, RD_s|TRAP,		I2	}, /* tltiu */
+{"tltu",    "s,I",	0,    (int) M_TLTU_I,	INSN_MACRO,		I2	},
+{"tnei",    "s,j",	0x040e0000, 0xfc1f0000, RD_s|TRAP,		I2	},
+{"tne",     "s,t",	0x00000036, 0xfc00ffff, RD_s|RD_t|TRAP,		I2	},
+{"tne",     "s,t,q",	0x00000036, 0xfc00003f, RD_s|RD_t|TRAP,		I2	},
+{"tne",     "s,j",	0x040e0000, 0xfc1f0000, RD_s|TRAP,		I2	}, /* tnei */
+{"tne",     "s,I",	0,    (int) M_TNE_I,	INSN_MACRO,		I2	},
+{"trunc.l.d", "D,S",	0x46200009, 0xffff003f, WR_D|RD_S|FP_D,		I3	},
+{"trunc.l.s", "D,S",	0x46000009, 0xffff003f,	WR_D|RD_S|FP_S,		I3	},
+{"trunc.w.d", "D,S",	0x4620000d, 0xffff003f, WR_D|RD_S|FP_D,		I2	},
+{"trunc.w.d", "D,S,x",	0x4620000d, 0xffff003f, WR_D|RD_S|FP_D,		I2	},
+{"trunc.w.d", "D,S,t",	0,    (int) M_TRUNCWD,	INSN_MACRO,		I1	},
+{"trunc.w.s", "D,S",	0x4600000d, 0xffff003f,	WR_D|RD_S|FP_S,		I2	},
+{"trunc.w.s", "D,S,x",	0x4600000d, 0xffff003f,	WR_D|RD_S|FP_S,		I2	},
+{"trunc.w.s", "D,S,t",	0,    (int) M_TRUNCWS,	INSN_MACRO,		I1	},
+{"uld",     "t,o(b)",	0,    (int) M_ULD,	INSN_MACRO,		I3	},
+{"uld",     "t,A(b)",	0,    (int) M_ULD_A,	INSN_MACRO,		I3	},
+{"ulh",     "t,o(b)",	0,    (int) M_ULH,	INSN_MACRO,		I1	},
+{"ulh",     "t,A(b)",	0,    (int) M_ULH_A,	INSN_MACRO,		I1	},
+{"ulhu",    "t,o(b)",	0,    (int) M_ULHU,	INSN_MACRO,		I1	},
+{"ulhu",    "t,A(b)",	0,    (int) M_ULHU_A,	INSN_MACRO,		I1	},
+{"ulw",     "t,o(b)",	0,    (int) M_ULW,	INSN_MACRO,		I1	},
+{"ulw",     "t,A(b)",	0,    (int) M_ULW_A,	INSN_MACRO,		I1	},
+{"usd",     "t,o(b)",	0,    (int) M_USD,	INSN_MACRO,		I3	},
+{"usd",     "t,A(b)",	0,    (int) M_USD_A,	INSN_MACRO,		I3	},
+{"ush",     "t,o(b)",	0,    (int) M_USH,	INSN_MACRO,		I1	},
+{"ush",     "t,A(b)",	0,    (int) M_USH_A,	INSN_MACRO,		I1	},
+{"usw",     "t,o(b)",	0,    (int) M_USW,	INSN_MACRO,		I1	},
+{"usw",     "t,A(b)",	0,    (int) M_USW_A,	INSN_MACRO,		I1	},
+{"xor",     "d,v,t",	0x00000026, 0xfc0007ff,	WR_d|RD_s|RD_t,		I1	},
+{"xor",     "t,r,I",	0,    (int) M_XOR_I,	INSN_MACRO,		I1	},
+{"xori",    "t,r,i",	0x38000000, 0xfc000000,	WR_t|RD_s,		I1	},
+{"wait",    "",         0x42000020, 0xffffffff, TRAP,   		I3|I32	},
+{"wait",    "J",        0x42000020, 0xfe00003f, TRAP,   		I32     },
+{"waiti",   "",		0x42000020, 0xffffffff,	TRAP,			L1	},
+{"wb", 	    "o(b)",	0xbc040000, 0xfc1f0000, SM|RD_b,		L1	},
 /* No hazard protection on coprocessor instructions--they shouldn't
    change the state of the processor and if they do it's up to the
    user to put in nops as necessary.  These are at the end so that the
    disasembler recognizes more specific versions first.  */
-{"c0",      "C",	0x42000000, 0xfe000000,	0,	I1		},
-{"c1",      "C",	0x46000000, 0xfe000000,	0,	I1		},
-{"c2",      "C",	0x4a000000, 0xfe000000,	0,	I1		},
-{"c3",      "C",	0x4e000000, 0xfe000000,	0,	I1		},
-{"cop0",     "C",	0,    (int) M_COP0,	INSN_MACRO,	I1	},
-{"cop1",     "C",	0,    (int) M_COP1,	INSN_MACRO,	I1	},
-{"cop2",     "C",	0,    (int) M_COP2,	INSN_MACRO,	I1	},
-{"cop3",     "C",	0,    (int) M_COP3,	INSN_MACRO,	I1	},
+{"c0",      "C",	0x42000000, 0xfe000000,	0,			I1	},
+{"c1",      "C",	0x46000000, 0xfe000000,	0,			I1	},
+{"c2",      "C",	0x4a000000, 0xfe000000,	0,			I1	},
+{"c3",      "C",	0x4e000000, 0xfe000000,	0,			I1	},
+{"cop0",     "C",	0,    (int) M_COP0,	INSN_MACRO,		I1	},
+{"cop1",     "C",	0,    (int) M_COP1,	INSN_MACRO,		I1	},
+{"cop2",     "C",	0,    (int) M_COP2,	INSN_MACRO,		I1	},
+{"cop3",     "C",	0,    (int) M_COP3,	INSN_MACRO,		I1	},
 
   /* Conflicts with the 4650's "mul" instruction.  Nobody's using the
      4010 any more, so move this insn out of the way.  If the object
      format gave us more info, we could do this right.  */
-{"addciu",  "t,r,j",	0x70000000, 0xfc000000,	WR_t|RD_s,L1	},
+{"addciu",  "t,r,j",	0x70000000, 0xfc000000,	WR_t|RD_s,		L1	},
 };
 
 #define MIPS_NUM_OPCODES \
diff --git a/opcodes/mips16-opc.c b/opcodes/mips16-opc.c
index ab2d7c0..2cc09cb 100644
--- a/opcodes/mips16-opc.c
+++ b/opcodes/mips16-opc.c
@@ -62,164 +62,165 @@
 
 #define T3      INSN_3900
 
-const struct mips_opcode mips16_opcodes[] = {
-{"nop",	    "",		0x6500, 0xffff, RD_Z }, /* move $0,$Z */
-{"la",	    "x,A",	0x0800, 0xf800, WR_x|RD_PC },
-{"abs",	    "x,w",	0, (int) M_ABS, INSN_MACRO },
-{"addiu",   "y,x,4",	0x4000, 0xf810, WR_y|RD_x },
-{"addiu",   "x,k",	0x4800, 0xf800, WR_x|RD_x },
-{"addiu",   "S,K",	0x6300, 0xff00, WR_SP|RD_SP },
-{"addiu",   "S,S,K",	0x6300, 0xff00, WR_SP|RD_SP },
-{"addiu",   "x,P,V",	0x0800, 0xf800, WR_x|RD_PC },
-{"addiu",   "x,S,V",	0x0000, 0xf800, WR_x|RD_SP },
-{"addu",    "z,v,y",	0xe001, 0xf803, WR_z|RD_x|RD_y },
-{"addu",    "y,x,4",	0x4000, 0xf810, WR_y|RD_x },
-{"addu",    "x,k",	0x4800, 0xf800, WR_x|RD_x },
-{"addu",    "S,K",	0x6300, 0xff00, WR_SP|RD_SP },
-{"addu",    "S,S,K",	0x6300, 0xff00, WR_SP|RD_SP },
-{"addu",    "x,P,V",	0x0800, 0xf800, WR_x|RD_PC },
-{"addu",    "x,S,V",	0x0000, 0xf800, WR_x|RD_SP },
-{"and",	    "x,y",	0xe80c, 0xf81f, WR_x|RD_x|RD_y },
-{"b",	    "q",	0x1000, 0xf800, BR},
-{"beq",	    "x,y,p",	0, (int) M_BEQ, INSN_MACRO },
-{"beq",     "x,U,p",	0, (int) M_BEQ_I, INSN_MACRO },
-{"beqz",    "x,p",	0x2000, 0xf800, BR|RD_x },
-{"bge",	    "x,y,p",	0, (int) M_BGE, INSN_MACRO },
-{"bge",     "x,8,p",	0, (int) M_BGE_I, INSN_MACRO },
-{"bgeu",    "x,y,p",	0, (int) M_BGEU, INSN_MACRO },
-{"bgeu",    "x,8,p",	0, (int) M_BGEU_I, INSN_MACRO },
-{"bgt",	    "x,y,p",	0, (int) M_BGT, INSN_MACRO },
-{"bgt",     "x,8,p",	0, (int) M_BGT_I, INSN_MACRO },
-{"bgtu",    "x,y,p",	0, (int) M_BGTU, INSN_MACRO },
-{"bgtu",    "x,8,p",	0, (int) M_BGTU_I, INSN_MACRO },
-{"ble",	    "x,y,p",	0, (int) M_BLE, INSN_MACRO },
-{"ble",     "x,8,p",	0, (int) M_BLE_I, INSN_MACRO },
-{"bleu",    "x,y,p",	0, (int) M_BLEU, INSN_MACRO },
-{"bleu",    "x,8,p",	0, (int) M_BLEU_I, INSN_MACRO },
-{"blt",	    "x,y,p",	0, (int) M_BLT, INSN_MACRO },
-{"blt",     "x,8,p",	0, (int) M_BLT_I, INSN_MACRO },
-{"bltu",    "x,y,p",	0, (int) M_BLTU, INSN_MACRO },
-{"bltu",    "x,8,p",	0, (int) M_BLTU_I, INSN_MACRO },
-{"bne",	    "x,y,p",	0, (int) M_BNE, INSN_MACRO },
-{"bne",     "x,U,p",	0, (int) M_BNE_I, INSN_MACRO },
-{"bnez",    "x,p",	0x2800, 0xf800, BR|RD_x },
-{"break",   "6",	0xe805, 0xf81f, TRAP },
-{"bteqz",   "p",	0x6000, 0xff00, BR|RD_T },
-{"btnez",   "p",	0x6100, 0xff00, BR|RD_T },
-{"cmpi",    "x,U",	0x7000, 0xf800, WR_T|RD_x },
-{"cmp",	    "x,y",	0xe80a, 0xf81f, WR_T|RD_x|RD_y },
-{"cmp",     "x,U",	0x7000, 0xf800, WR_T|RD_x },
-{"dla",	    "y,E",	0xfe00, 0xff00, WR_y|RD_PC, I3 },
-{"daddiu",  "y,x,4",	0x4010, 0xf810, WR_y|RD_x, I3 },
-{"daddiu",  "y,j",	0xfd00, 0xff00, WR_y|RD_y, I3 },
-{"daddiu",  "S,K",	0xfb00, 0xff00, WR_SP|RD_SP, I3 },
-{"daddiu",  "S,S,K",	0xfb00, 0xff00, WR_SP|RD_SP, I3 },
-{"daddiu",  "y,P,W",	0xfe00, 0xff00, WR_y|RD_PC, I3 },
-{"daddiu",  "y,S,W",	0xff00, 0xff00, WR_y|RD_SP, I3 },
+const struct mips_opcode mips16_opcodes[] =
+{
+{"nop",	    "",		0x6500, 0xffff, RD_Z,		0 }, /* move $0,$Z */
+{"la",	    "x,A",	0x0800, 0xf800, WR_x|RD_PC,	0 },
+{"abs",	    "x,w",	0, (int) M_ABS, INSN_MACRO,	0 },
+{"addiu",   "y,x,4",	0x4000, 0xf810, WR_y|RD_x,	0 },
+{"addiu",   "x,k",	0x4800, 0xf800, WR_x|RD_x,	0 },
+{"addiu",   "S,K",	0x6300, 0xff00, WR_SP|RD_SP,	0 },
+{"addiu",   "S,S,K",	0x6300, 0xff00, WR_SP|RD_SP,	0 },
+{"addiu",   "x,P,V",	0x0800, 0xf800, WR_x|RD_PC,	0 },
+{"addiu",   "x,S,V",	0x0000, 0xf800, WR_x|RD_SP,	0 },
+{"addu",    "z,v,y",	0xe001, 0xf803, WR_z|RD_x|RD_y,	0 },
+{"addu",    "y,x,4",	0x4000, 0xf810, WR_y|RD_x,	0 },
+{"addu",    "x,k",	0x4800, 0xf800, WR_x|RD_x,	0 },
+{"addu",    "S,K",	0x6300, 0xff00, WR_SP|RD_SP,	0 },
+{"addu",    "S,S,K",	0x6300, 0xff00, WR_SP|RD_SP,	0 },
+{"addu",    "x,P,V",	0x0800, 0xf800, WR_x|RD_PC,	0 },
+{"addu",    "x,S,V",	0x0000, 0xf800, WR_x|RD_SP,	0 },
+{"and",	    "x,y",	0xe80c, 0xf81f, WR_x|RD_x|RD_y,	0 },
+{"b",	    "q",	0x1000, 0xf800, BR,		0 },
+{"beq",	    "x,y,p",	0, (int) M_BEQ, INSN_MACRO,	0 },
+{"beq",     "x,U,p",	0, (int) M_BEQ_I, INSN_MACRO,	0 },
+{"beqz",    "x,p",	0x2000, 0xf800, BR|RD_x,	0 },
+{"bge",	    "x,y,p",	0, (int) M_BGE, INSN_MACRO,	0 },
+{"bge",     "x,8,p",	0, (int) M_BGE_I, INSN_MACRO,	0 },
+{"bgeu",    "x,y,p",	0, (int) M_BGEU, INSN_MACRO,	0 },
+{"bgeu",    "x,8,p",	0, (int) M_BGEU_I, INSN_MACRO,	0 },
+{"bgt",	    "x,y,p",	0, (int) M_BGT, INSN_MACRO,	0 },
+{"bgt",     "x,8,p",	0, (int) M_BGT_I, INSN_MACRO,	0 },
+{"bgtu",    "x,y,p",	0, (int) M_BGTU, INSN_MACRO,	0 },
+{"bgtu",    "x,8,p",	0, (int) M_BGTU_I, INSN_MACRO,	0 },
+{"ble",	    "x,y,p",	0, (int) M_BLE, INSN_MACRO,	0 },
+{"ble",     "x,8,p",	0, (int) M_BLE_I, INSN_MACRO,	0 },
+{"bleu",    "x,y,p",	0, (int) M_BLEU, INSN_MACRO,	0 },
+{"bleu",    "x,8,p",	0, (int) M_BLEU_I, INSN_MACRO,	0 },
+{"blt",	    "x,y,p",	0, (int) M_BLT, INSN_MACRO,	0 },
+{"blt",     "x,8,p",	0, (int) M_BLT_I, INSN_MACRO,	0 },
+{"bltu",    "x,y,p",	0, (int) M_BLTU, INSN_MACRO,	0 },
+{"bltu",    "x,8,p",	0, (int) M_BLTU_I, INSN_MACRO,	0 },
+{"bne",	    "x,y,p",	0, (int) M_BNE, INSN_MACRO,	0 },
+{"bne",     "x,U,p",	0, (int) M_BNE_I, INSN_MACRO,	0 },
+{"bnez",    "x,p",	0x2800, 0xf800, BR|RD_x,	0 },
+{"break",   "6",	0xe805, 0xf81f, TRAP,		0 },
+{"bteqz",   "p",	0x6000, 0xff00, BR|RD_T,	0 },
+{"btnez",   "p",	0x6100, 0xff00, BR|RD_T,	0 },
+{"cmpi",    "x,U",	0x7000, 0xf800, WR_T|RD_x,	0 },
+{"cmp",	    "x,y",	0xe80a, 0xf81f, WR_T|RD_x|RD_y,	0 },
+{"cmp",     "x,U",	0x7000, 0xf800, WR_T|RD_x,	0 },
+{"dla",	    "y,E",	0xfe00, 0xff00, WR_y|RD_PC, 	I3 },
+{"daddiu",  "y,x,4",	0x4010, 0xf810, WR_y|RD_x, 	I3 },
+{"daddiu",  "y,j",	0xfd00, 0xff00, WR_y|RD_y, 	I3 },
+{"daddiu",  "S,K",	0xfb00, 0xff00, WR_SP|RD_SP, 	I3 },
+{"daddiu",  "S,S,K",	0xfb00, 0xff00, WR_SP|RD_SP, 	I3 },
+{"daddiu",  "y,P,W",	0xfe00, 0xff00, WR_y|RD_PC, 	I3 },
+{"daddiu",  "y,S,W",	0xff00, 0xff00, WR_y|RD_SP, 	I3 },
 {"daddu",   "z,v,y",	0xe000, 0xf803, WR_z|RD_x|RD_y, I3 },
-{"daddu",   "y,x,4",	0x4010, 0xf810, WR_y|RD_x, I3 },
-{"daddu",   "y,j",	0xfd00, 0xff00, WR_y|RD_y, I3 },
-{"daddu",   "S,K",	0xfb00, 0xff00, WR_SP|RD_SP, I3 },
-{"daddu",   "S,S,K",	0xfb00, 0xff00, WR_SP|RD_SP, I3 },
-{"daddu",   "y,P,W",	0xfe00, 0xff00, WR_y|RD_PC, I3 },
-{"daddu",   "y,S,W",	0xff00, 0xff00, WR_y|RD_SP, I3 },
+{"daddu",   "y,x,4",	0x4010, 0xf810, WR_y|RD_x, 	I3 },
+{"daddu",   "y,j",	0xfd00, 0xff00, WR_y|RD_y, 	I3 },
+{"daddu",   "S,K",	0xfb00, 0xff00, WR_SP|RD_SP, 	I3 },
+{"daddu",   "S,S,K",	0xfb00, 0xff00, WR_SP|RD_SP, 	I3 },
+{"daddu",   "y,P,W",	0xfe00, 0xff00, WR_y|RD_PC, 	I3 },
+{"daddu",   "y,S,W",	0xff00, 0xff00, WR_y|RD_SP, 	I3 },
 {"ddiv",    "0,x,y",	0xe81e, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, I3 },
-{"ddiv",    "z,v,y",	0, (int) M_DDIV_3, INSN_MACRO },
+{"ddiv",    "z,v,y",	0, (int) M_DDIV_3, INSN_MACRO,	0 },
 {"ddivu",   "0,x,y",	0xe81f, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, I3 },
-{"ddivu",   "z,v,y",	0, (int) M_DDIVU_3, INSN_MACRO },
-{"div",     "0,x,y",	0xe81a, 0xf81f, RD_x|RD_y|WR_HI|WR_LO },
-{"div",     "z,v,y",	0, (int) M_DIV_3, INSN_MACRO },
-{"divu",    "0,x,y",	0xe81b, 0xf81f, RD_x|RD_y|WR_HI|WR_LO },
-{"divu",    "z,v,y",	0, (int) M_DIVU_3, INSN_MACRO },
-{"dmul",    "z,v,y",	0, (int) M_DMUL, INSN_MACRO, I3 },
+{"ddivu",   "z,v,y",	0, (int) M_DDIVU_3, INSN_MACRO,	0 },
+{"div",     "0,x,y",	0xe81a, 0xf81f, RD_x|RD_y|WR_HI|WR_LO,	0 },
+{"div",     "z,v,y",	0, (int) M_DIV_3, INSN_MACRO,	0 },
+{"divu",    "0,x,y",	0xe81b, 0xf81f, RD_x|RD_y|WR_HI|WR_LO,	0 },
+{"divu",    "z,v,y",	0, (int) M_DIVU_3, INSN_MACRO,	0 },
+{"dmul",    "z,v,y",	0, (int) M_DMUL, INSN_MACRO, 	I3 },
 {"dmult",   "x,y",	0xe81c, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, I3 },
 {"dmultu",  "x,y",	0xe81d, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, I3 },
 {"drem",    "0,x,y",	0xe81e, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, I3 },
-{"drem",    "z,v,y",	0, (int) M_DREM_3, INSN_MACRO },
+{"drem",    "z,v,y",	0, (int) M_DREM_3, INSN_MACRO,	0 },
 {"dremu",   "0,x,y",	0xe81f, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, I3 },
-{"dremu",   "z,v,y",	0, (int) M_DREMU_3, INSN_MACRO },
+{"dremu",   "z,v,y",	0, (int) M_DREMU_3, INSN_MACRO,	0 },
 {"dsllv",   "y,x",	0xe814, 0xf81f, WR_y|RD_y|RD_x, I3 },
-{"dsll",    "x,w,[",	0x3001, 0xf803, WR_x|RD_y, I3 },
+{"dsll",    "x,w,[",	0x3001, 0xf803, WR_x|RD_y, 	I3 },
 {"dsll",    "y,x",	0xe814, 0xf81f, WR_y|RD_y|RD_x, I3 },
 {"dsrav",   "y,x",	0xe817, 0xf81f, WR_y|RD_y|RD_x, I3 },
-{"dsra",    "y,]",	0xe813, 0xf81f, WR_y|RD_y, I3 },
+{"dsra",    "y,]",	0xe813, 0xf81f, WR_y|RD_y, 	I3 },
 {"dsra",    "y,x",	0xe817, 0xf81f, WR_y|RD_y|RD_x, I3 },
 {"dsrlv",   "y,x",	0xe816, 0xf81f, WR_y|RD_y|RD_x, I3 },
-{"dsrl",    "y,]",	0xe808, 0xf81f, WR_y|RD_y, I3 },
+{"dsrl",    "y,]",	0xe808, 0xf81f, WR_y|RD_y, 	I3 },
 {"dsrl",    "y,x",	0xe816, 0xf81f, WR_y|RD_y|RD_x, I3 },
 {"dsubu",   "z,v,y",	0xe002, 0xf803, WR_z|RD_x|RD_y, I3 },
-{"dsubu",   "y,x,4",	0, (int) M_DSUBU_I, INSN_MACRO },
-{"dsubu",   "y,j",	0, (int) M_DSUBU_I_2, INSN_MACRO },
-{"exit",    "L",	0xed09, 0xff1f, TRAP },
-{"exit",    "L",	0xee09, 0xff1f, TRAP },
-{"exit",    "L",	0xef09, 0xff1f, TRAP },
-{"entry",   "l",	0xe809, 0xf81f, TRAP },
-{"extend",  "e",	0xf000, 0xf800, 0 },
-{"jalr",    "x",	0xe840, 0xf8ff, UBD|WR_31|RD_x },
-{"jalr",    "R,x",	0xe840, 0xf8ff, UBD|WR_31|RD_x },
-{"jal",     "x",	0xe840, 0xf8ff, UBD|WR_31|RD_x },
-{"jal",     "R,x",	0xe840, 0xf8ff, UBD|WR_31|RD_x },
-{"jal",	    "a",	0x1800, 0xfc00, UBD|WR_31 },
-{"jalx",    "a",	0x1c00, 0xfc00, UBD|WR_31 },
-{"jr",	    "x",	0xe800, 0xf8ff, UBD|RD_x },
-{"jr",	    "R",	0xe820, 0xffff, UBD|RD_31 },
-{"j",	    "x",	0xe800, 0xf8ff, UBD|RD_x },
-{"j",	    "R",	0xe820, 0xffff, UBD|RD_31 },
-{"lb",	    "y,5(x)",	0x8000, 0xf800, WR_y|RD_x },
-{"lbu",	    "y,5(x)",	0xa000, 0xf800, WR_y|RD_x },
-{"ld",	    "y,D(x)",	0x3800, 0xf800, WR_y|RD_x, I3 },
-{"ld",	    "y,B",	0xfc00, 0xff00, WR_y|RD_PC, I3 },
-{"ld",	    "y,D(P)",	0xfc00, 0xff00, WR_y|RD_PC, I3 },
-{"ld",	    "y,D(S)",	0xf800, 0xff00, WR_y|RD_SP, I3 },
-{"lh",	    "y,H(x)",	0x8800, 0xf800, WR_y|RD_x },
-{"lhu",	    "y,H(x)",	0xa800, 0xf800, WR_y|RD_x },
-{"li",	    "x,U",	0x6800, 0xf800, WR_x },
-{"lw",	    "y,W(x)",	0x9800, 0xf800, WR_y|RD_x },
-{"lw",	    "x,A",	0xb000, 0xf800, WR_x|RD_PC },
-{"lw",	    "x,V(P)",	0xb000, 0xf800, WR_x|RD_PC },
-{"lw",	    "x,V(S)",	0x9000, 0xf800, WR_x|RD_SP },
-{"lwu",     "y,W(x)",	0xb800, 0xf800, WR_y|RD_x, I3 },
-{"mfhi",    "x",	0xe810, 0xf8ff, WR_x|RD_HI },
-{"mflo",    "x",	0xe812, 0xf8ff, WR_x|RD_LO },
-{"move",    "y,X",	0x6700, 0xff00, WR_y|RD_X },
-{"move",    "Y,Z",	0x6500, 0xff00, WR_Y|RD_Z },
-{"mul",     "z,v,y",	0, (int) M_MUL, INSN_MACRO },
-{"mult",    "x,y",	0xe818, 0xf81f, RD_x|RD_y|WR_HI|WR_LO },
-{"multu",   "x,y",	0xe819, 0xf81f, RD_x|RD_y|WR_HI|WR_LO },
-{"neg",	    "x,w",	0xe80b, 0xf81f, WR_x|RD_y },
-{"not",	    "x,w",	0xe80f, 0xf81f, WR_x|RD_y },
-{"or",	    "x,y",	0xe80d, 0xf81f, WR_x|RD_x|RD_y },
-{"rem",     "0,x,y",	0xe81a, 0xf81f, RD_x|RD_y|WR_HI|WR_LO },
-{"rem",     "z,v,y",	0, (int) M_REM_3, INSN_MACRO },
-{"remu",    "0,x,y",	0xe81b, 0xf81f, RD_x|RD_y|WR_HI|WR_LO },
-{"remu",    "z,v,y",	0, (int) M_REMU_3, INSN_MACRO },
-{"sb",	    "y,5(x)",	0xc000, 0xf800, RD_y|RD_x },
-{"sd",	    "y,D(x)",	0x7800, 0xf800, RD_y|RD_x, I3 },
-{"sd",	    "y,D(S)",	0xf900, 0xff00, RD_y|RD_PC, I3 },
-{"sd",	    "R,C(S)",	0xfa00, 0xff00, RD_31|RD_PC },
-{"sh",	    "y,H(x)",	0xc800, 0xf800, RD_y|RD_x },
-{"sllv",    "y,x",	0xe804, 0xf81f, WR_y|RD_y|RD_x },
-{"sll",	    "x,w,<",	0x3000, 0xf803, WR_x|RD_y },
-{"sll",     "y,x",	0xe804, 0xf81f, WR_y|RD_y|RD_x },
-{"slti",    "x,8",	0x5000, 0xf800, WR_T|RD_x },
-{"slt",	    "x,y",	0xe802, 0xf81f, WR_T|RD_x|RD_y },
-{"slt",     "x,8",	0x5000, 0xf800, WR_T|RD_x },
-{"sltiu",   "x,8",	0x5800, 0xf800, WR_T|RD_x },
-{"sltu",    "x,y",	0xe803, 0xf81f, WR_T|RD_x|RD_y },
-{"sltu",    "x,8",	0x5800, 0xf800, WR_T|RD_x },
-{"srav",    "y,x",	0xe807, 0xf81f, WR_y|RD_y|RD_x },
-{"sra",	    "x,w,<",	0x3003, 0xf803, WR_x|RD_y },
-{"sra",     "y,x",	0xe807, 0xf81f, WR_y|RD_y|RD_x },
-{"srlv",    "y,x",	0xe806, 0xf81f, WR_y|RD_y|RD_x },
-{"srl",	    "x,w,<",	0x3002, 0xf803, WR_x|RD_y },
-{"srl",     "y,x",	0xe806, 0xf81f, WR_y|RD_y|RD_x },
-{"subu",    "z,v,y",	0xe003, 0xf803, WR_z|RD_x|RD_y },
-{"subu",    "y,x,4",	0, (int) M_SUBU_I, INSN_MACRO },
-{"subu",    "x,k",	0, (int) M_SUBU_I_2, INSN_MACRO },
-{"sw",	    "y,W(x)",	0xd800, 0xf800, RD_y|RD_x },
-{"sw",	    "x,V(S)",	0xd000, 0xf800, RD_x|RD_SP },
-{"sw",	    "R,V(S)",	0x6200, 0xff00, RD_31|RD_SP },
-{"xor",	    "x,y",	0xe80e, 0xf81f, WR_x|RD_x|RD_y },
+{"dsubu",   "y,x,4",	0, (int) M_DSUBU_I, INSN_MACRO,	0 },
+{"dsubu",   "y,j",	0, (int) M_DSUBU_I_2, INSN_MACRO, 0 },
+{"exit",    "L",	0xed09, 0xff1f, TRAP,		0 },
+{"exit",    "L",	0xee09, 0xff1f, TRAP,		0 },
+{"exit",    "L",	0xef09, 0xff1f, TRAP,		0 },
+{"entry",   "l",	0xe809, 0xf81f, TRAP,		0 },
+{"extend",  "e",	0xf000, 0xf800, 0,		0 },
+{"jalr",    "x",	0xe840, 0xf8ff, UBD|WR_31|RD_x,	0 },
+{"jalr",    "R,x",	0xe840, 0xf8ff, UBD|WR_31|RD_x,	0 },
+{"jal",     "x",	0xe840, 0xf8ff, UBD|WR_31|RD_x,	0 },
+{"jal",     "R,x",	0xe840, 0xf8ff, UBD|WR_31|RD_x,	0 },
+{"jal",	    "a",	0x1800, 0xfc00, UBD|WR_31,	0 },
+{"jalx",    "a",	0x1c00, 0xfc00, UBD|WR_31,	0 },
+{"jr",	    "x",	0xe800, 0xf8ff, UBD|RD_x,	0 },
+{"jr",	    "R",	0xe820, 0xffff, UBD|RD_31,	0 },
+{"j",	    "x",	0xe800, 0xf8ff, UBD|RD_x,	0 },
+{"j",	    "R",	0xe820, 0xffff, UBD|RD_31,	0 },
+{"lb",	    "y,5(x)",	0x8000, 0xf800, WR_y|RD_x,	0 },
+{"lbu",	    "y,5(x)",	0xa000, 0xf800, WR_y|RD_x,	0 },
+{"ld",	    "y,D(x)",	0x3800, 0xf800, WR_y|RD_x, 	I3 },
+{"ld",	    "y,B",	0xfc00, 0xff00, WR_y|RD_PC, 	I3 },
+{"ld",	    "y,D(P)",	0xfc00, 0xff00, WR_y|RD_PC, 	I3 },
+{"ld",	    "y,D(S)",	0xf800, 0xff00, WR_y|RD_SP, 	I3 },
+{"lh",	    "y,H(x)",	0x8800, 0xf800, WR_y|RD_x,	0 },
+{"lhu",	    "y,H(x)",	0xa800, 0xf800, WR_y|RD_x,	0 },
+{"li",	    "x,U",	0x6800, 0xf800, WR_x,		0 },
+{"lw",	    "y,W(x)",	0x9800, 0xf800, WR_y|RD_x,	0 },
+{"lw",	    "x,A",	0xb000, 0xf800, WR_x|RD_PC,	0 },
+{"lw",	    "x,V(P)",	0xb000, 0xf800, WR_x|RD_PC,	0 },
+{"lw",	    "x,V(S)",	0x9000, 0xf800, WR_x|RD_SP,	0 },
+{"lwu",     "y,W(x)",	0xb800, 0xf800, WR_y|RD_x, 	I3 },
+{"mfhi",    "x",	0xe810, 0xf8ff, WR_x|RD_HI,	0 },
+{"mflo",    "x",	0xe812, 0xf8ff, WR_x|RD_LO,	0 },
+{"move",    "y,X",	0x6700, 0xff00, WR_y|RD_X, 	0 },
+{"move",    "Y,Z",	0x6500, 0xff00, WR_Y|RD_Z,	0 },
+{"mul",     "z,v,y",	0, (int) M_MUL, INSN_MACRO,	0 },
+{"mult",    "x,y",	0xe818, 0xf81f, RD_x|RD_y|WR_HI|WR_LO,	0 },
+{"multu",   "x,y",	0xe819, 0xf81f, RD_x|RD_y|WR_HI|WR_LO,	0 },
+{"neg",	    "x,w",	0xe80b, 0xf81f, WR_x|RD_y,	0 },
+{"not",	    "x,w",	0xe80f, 0xf81f, WR_x|RD_y,	0 },
+{"or",	    "x,y",	0xe80d, 0xf81f, WR_x|RD_x|RD_y,	0 },
+{"rem",     "0,x,y",	0xe81a, 0xf81f, RD_x|RD_y|WR_HI|WR_LO,	0 },
+{"rem",     "z,v,y",	0, (int) M_REM_3, INSN_MACRO,	0 },
+{"remu",    "0,x,y",	0xe81b, 0xf81f, RD_x|RD_y|WR_HI|WR_LO,	0 },
+{"remu",    "z,v,y",	0, (int) M_REMU_3, INSN_MACRO,	0 },
+{"sb",	    "y,5(x)",	0xc000, 0xf800, RD_y|RD_x,	0 },
+{"sd",	    "y,D(x)",	0x7800, 0xf800, RD_y|RD_x, 	I3 },
+{"sd",	    "y,D(S)",	0xf900, 0xff00, RD_y|RD_PC, 	I3 },
+{"sd",	    "R,C(S)",	0xfa00, 0xff00, RD_31|RD_PC,	0 },
+{"sh",	    "y,H(x)",	0xc800, 0xf800, RD_y|RD_x,	0 },
+{"sllv",    "y,x",	0xe804, 0xf81f, WR_y|RD_y|RD_x, 0 },
+{"sll",	    "x,w,<",	0x3000, 0xf803, WR_x|RD_y,	0 },
+{"sll",     "y,x",	0xe804, 0xf81f, WR_y|RD_y|RD_x,	0 },
+{"slti",    "x,8",	0x5000, 0xf800, WR_T|RD_x,	0 },
+{"slt",	    "x,y",	0xe802, 0xf81f, WR_T|RD_x|RD_y,	0 },
+{"slt",     "x,8",	0x5000, 0xf800, WR_T|RD_x,	0 },
+{"sltiu",   "x,8",	0x5800, 0xf800, WR_T|RD_x,	0 },
+{"sltu",    "x,y",	0xe803, 0xf81f, WR_T|RD_x|RD_y,	0 },
+{"sltu",    "x,8",	0x5800, 0xf800, WR_T|RD_x,	0 },
+{"srav",    "y,x",	0xe807, 0xf81f, WR_y|RD_y|RD_x,	0 },
+{"sra",	    "x,w,<",	0x3003, 0xf803, WR_x|RD_y,	0 },
+{"sra",     "y,x",	0xe807, 0xf81f, WR_y|RD_y|RD_x,	0 },
+{"srlv",    "y,x",	0xe806, 0xf81f, WR_y|RD_y|RD_x,	0 },
+{"srl",	    "x,w,<",	0x3002, 0xf803, WR_x|RD_y,	0 },
+{"srl",     "y,x",	0xe806, 0xf81f, WR_y|RD_y|RD_x,	0 },
+{"subu",    "z,v,y",	0xe003, 0xf803, WR_z|RD_x|RD_y,	0 },
+{"subu",    "y,x,4",	0, (int) M_SUBU_I, INSN_MACRO,	0 },
+{"subu",    "x,k",	0, (int) M_SUBU_I_2, INSN_MACRO,0 },
+{"sw",	    "y,W(x)",	0xd800, 0xf800, RD_y|RD_x,	0 },
+{"sw",	    "x,V(S)",	0xd000, 0xf800, RD_x|RD_SP,	0 },
+{"sw",	    "R,V(S)",	0x6200, 0xff00, RD_31|RD_SP,	0 },
+{"xor",	    "x,y",	0xe80e, 0xf81f, WR_x|RD_x|RD_y, 0 },
 };
 
 const int bfd_mips16_num_opcodes =
diff --git a/opcodes/po/POTFILES.in b/opcodes/po/POTFILES.in
index 361d98b..1b24f67 100644
--- a/opcodes/po/POTFILES.in
+++ b/opcodes/po/POTFILES.in
@@ -9,6 +9,8 @@
 cgen-asm.c
 cgen-dis.c
 cgen-opc.c
+cris-dis.c
+cris-opc.c
 d10v-dis.c
 d10v-opc.c
 d30v-dis.c
@@ -29,6 +31,7 @@
 i370-dis.c
 i370-opc.c
 i386-dis.c
+i860-dis.c
 i960-dis.c
 ia64-asmtab.c
 ia64-asmtab.h
@@ -54,6 +57,8 @@
 m32r-opc.c
 m32r-opc.h
 m32r-opinst.c
+m68hc11-dis.c
+m68hc11-opc.c
 m68k-dis.c
 m68k-opc.c
 m88k-dis.c
diff --git a/opcodes/po/opcodes.pot b/opcodes/po/opcodes.pot
index 8bc5cee..6bc8d82 100644
--- a/opcodes/po/opcodes.pot
+++ b/opcodes/po/opcodes.pot
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-05-30 11:33-0700\n"
+"POT-Creation-Date: 2000-12-16 13:55-0800\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -22,7 +22,8 @@
 msgid "jump hint unaligned"
 msgstr ""
 
-#: arc-dis.c:232
+#. Default text to print if an instruction isn't recognized.
+#: arc-dis.c:232 fr30-dis.c:39 m32r-dis.c:39
 msgid "*unknown*"
 msgstr ""
 
@@ -48,32 +49,45 @@
 msgid "branch address not on 4 byte boundary"
 msgstr ""
 
-#: arm-dis.c:476
+#: arm-dis.c:489
 msgid "<illegal precision>"
 msgstr ""
 
-#: arm-dis.c:888
+#: arm-dis.c:904
 #, c-format
 msgid "Unrecognised register name set: %s\n"
 msgstr ""
 
-#: arm-dis.c:895
+#: arm-dis.c:911
 #, c-format
 msgid "Unrecognised disassembler option: %s\n"
 msgstr ""
 
-#: arm-dis.c:1059
+#: arm-dis.c:1075
 msgid ""
 "\n"
 "The following ARM specific disassembler options are supported for use with\n"
 "the -M switch:\n"
 msgstr ""
 
+#: avr-dis.c:118 avr-dis.c:128
+msgid "undefined"
+msgstr ""
+
+#: avr-dis.c:180
+msgid "Internal disassembler error"
+msgstr ""
+
+#: avr-dis.c:228
+#, c-format
+msgid "unknown constraint `%c'"
+msgstr ""
+
 #: cgen-asm.c:224
 msgid "unrecognized keyword/register name"
 msgstr ""
 
-#: cgen-asm.c:332 fr30-ibld.c:223 m32r-ibld.c:227
+#: cgen-asm.c:332 fr30-ibld.c:232 m32r-ibld.c:232
 #, c-format
 msgid "operand out of range (%ld not between %ld and %ld)"
 msgstr ""
@@ -105,28 +119,26 @@
 msgstr ""
 
 #. We couldn't parse it.
-#: fr30-asm.c:369 fr30-asm.c:373 fr30-asm.c:447 m32r-asm.c:377 m32r-asm.c:381
-#: m32r-asm.c:455
+#: fr30-asm.c:369 fr30-asm.c:373 fr30-asm.c:449 m32r-asm.c:377 m32r-asm.c:381
+#: m32r-asm.c:457
 msgid "unrecognized instruction"
 msgstr ""
 
-#. Syntax char didn't match.  Can't be this insn.
-#. FIXME: would like to return something like
-#. "expected char `c'"
 #: fr30-asm.c:415 m32r-asm.c:423
-msgid "syntax error"
+#, c-format
+msgid "syntax error (expected char `%c', found `%c')"
 msgstr ""
 
-#: fr30-asm.c:441 m32r-asm.c:449
+#: fr30-asm.c:443 m32r-asm.c:451
 msgid "junk at end of line"
 msgstr ""
 
-#: fr30-asm.c:534 m32r-asm.c:552
+#: fr30-asm.c:551 m32r-asm.c:559
 #, c-format
 msgid "bad instruction `%.50s...'"
 msgstr ""
 
-#: fr30-asm.c:537 m32r-asm.c:555
+#: fr30-asm.c:554 m32r-asm.c:562
 #, c-format
 msgid "bad instruction `%.50s'"
 msgstr ""
@@ -136,62 +148,66 @@
 msgid "Unrecognized field %d while printing insn.\n"
 msgstr ""
 
-#: fr30-ibld.c:210 m32r-ibld.c:211
+#: fr30-ibld.c:216 m32r-ibld.c:216
 #, c-format
 msgid "operand out of range (%lu not between 0 and %lu)"
 msgstr ""
 
-#: fr30-ibld.c:745 m32r-ibld.c:679
+#: fr30-ibld.c:790 m32r-ibld.c:719
 #, c-format
 msgid "Unrecognized field %d while building insn.\n"
 msgstr ""
 
-#: fr30-ibld.c:947 m32r-ibld.c:809
+#: fr30-ibld.c:994 m32r-ibld.c:849
 #, c-format
 msgid "Unrecognized field %d while decoding insn.\n"
 msgstr ""
 
-#: fr30-ibld.c:1091 m32r-ibld.c:914
+#: fr30-ibld.c:1138 m32r-ibld.c:954
 #, c-format
 msgid "Unrecognized field %d while getting int operand.\n"
 msgstr ""
 
-#: fr30-ibld.c:1220 m32r-ibld.c:1004
+#: fr30-ibld.c:1267 m32r-ibld.c:1044
 #, c-format
 msgid "Unrecognized field %d while getting vma operand.\n"
 msgstr ""
 
-#: fr30-ibld.c:1349 m32r-ibld.c:1097
+#: fr30-ibld.c:1396 m32r-ibld.c:1137
 #, c-format
 msgid "Unrecognized field %d while setting int operand.\n"
 msgstr ""
 
-#: fr30-ibld.c:1471 m32r-ibld.c:1183
+#: fr30-ibld.c:1518 m32r-ibld.c:1223
 #, c-format
 msgid "Unrecognized field %d while setting vma operand.\n"
 msgstr ""
 
-#: h8300-dis.c:405
+#: h8300-dis.c:380
 #, c-format
 msgid "Hmmmm %x"
 msgstr ""
 
-#: h8300-dis.c:417
+#: h8300-dis.c:391
 #, c-format
 msgid "Don't understand %x \n"
 msgstr ""
 
-#: h8500-dis.c:140
+#: h8500-dis.c:141
 #, c-format
 msgid "can't cope with insert %d\n"
 msgstr ""
 
-#. Couldn't understand anything
-#: h8500-dis.c:345
+#. Couldn't understand anything.
+#: h8500-dis.c:348
 #, c-format
 msgid "%02x\t\t*unknown*"
 msgstr ""
 
+#: i386-dis.c:1949
+msgid "<internal disassembler error>"
+msgstr ""
+
 #: m10200-dis.c:199
 #, c-format
 msgid "unknown\t0x%02x"
@@ -222,7 +238,7 @@
 msgid "# <dis error: %08x>"
 msgstr ""
 
-#: mips-dis.c:242
+#: mips-dis.c:273
 #, c-format
 msgid "# internal error, undefined modifier(%c)"
 msgstr ""
@@ -266,21 +282,21 @@
 msgstr ""
 
 #. Mark as non-valid instruction
-#: sparc-dis.c:743
+#: sparc-dis.c:748
 msgid "unknown"
 msgstr ""
 
-#: sparc-dis.c:815
+#: sparc-dis.c:823
 #, c-format
 msgid "Internal error:  bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n"
 msgstr ""
 
-#: sparc-dis.c:826
+#: sparc-dis.c:834
 #, c-format
 msgid "Internal error: bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n"
 msgstr ""
 
-#: sparc-dis.c:875
+#: sparc-dis.c:883
 #, c-format
 msgid "Internal error: bad sparc-opcode.h: \"%s\" == \"%s\"\n"
 msgstr ""
diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c
index 62f7bd0..ccfc89d 100644
--- a/opcodes/ppc-opc.c
+++ b/opcodes/ppc-opc.c
@@ -1194,6 +1194,10 @@
 #define XTO(op, xop, to) (X ((op), (xop)) | ((((unsigned long)(to)) & 0x1f) << 21))
 #define XTO_MASK (X_MASK | TO_MASK)
 
+/* An X form tlb instruction with the SH field specified.  */
+#define XTLB(op, xop, sh) (X ((op), (xop)) | ((((unsigned long)(sh)) & 0x1f) << 11))
+#define XTLB_MASK (X_MASK | SH_MASK)
+
 /* An XFL form instruction.  */
 #define XFL(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x3ff) << 1) | (((unsigned long)(rc)) & 1))
 #define XFL_MASK (XFL (0x3f, 0x3ff, 1) | (((unsigned long)1) << 25) | (((unsigned long)1) << 16))
@@ -1321,6 +1325,7 @@
 #define PPC64   PPC_OPCODE_PPC | PPC_OPCODE_64 | PPC_OPCODE_ANY
 #define PPCONLY	PPC_OPCODE_PPC
 #define PPC403	PPC
+#define PPC405	PPC403
 #define PPC750	PPC
 #define PPC860	PPC
 #define PPCVEC	PPC_OPCODE_ALTIVEC | PPC_OPCODE_ANY
@@ -1400,7 +1405,91 @@
 { "tnei",    OPTO(3,TONE), OPTO_MASK,	PWRCOM,		{ RA, SI } },
 { "twi",     OP(3),	OP_MASK,	PPCCOM,		{ TO, RA, SI } },
 { "ti",      OP(3),	OP_MASK,	PWRCOM,		{ TO, RA, SI } },
-  
+
+{ "macchw",	XO(4,172,0,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "macchw.",	XO(4,172,0,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "macchwo",	XO(4,172,1,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "macchwo.",	XO(4,172,1,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "macchws",	XO(4,236,0,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "macchws.",	XO(4,236,0,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "macchwso",	XO(4,236,1,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "macchwso.",	XO(4,236,1,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "macchwsu",	XO(4,204,0,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "macchwsu.",	XO(4,204,0,1), XO_MASK, PPC405,		{ RT, RA, RB } },
+{ "macchwsuo",	XO(4,204,1,0), XO_MASK, PPC405,		{ RT, RA, RB } },
+{ "macchwsuo.",	XO(4,204,1,1), XO_MASK, PPC405,		{ RT, RA, RB } },
+{ "macchwu",	XO(4,140,0,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "macchwu.",	XO(4,140,0,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "macchwuo",	XO(4,140,1,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "macchwuo.",	XO(4,140,1,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhw",	XO(4,44,0,0),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhw.",	XO(4,44,0,1),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhwo",	XO(4,44,1,0),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhwo.",	XO(4,44,1,1),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhws",	XO(4,108,0,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhws.",	XO(4,108,0,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhwso",	XO(4,108,1,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhwso.",	XO(4,108,1,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhwsu",	XO(4,76,0,0),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhwsu.",	XO(4,76,0,1),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhwsuo",	XO(4,76,1,0),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhwsuo.",	XO(4,76,1,1),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhwu",	XO(4,12,0,0),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhwu.",	XO(4,12,0,1),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhwuo",	XO(4,12,1,0),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "machhwuo.",	XO(4,12,1,1),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhw",	XO(4,428,0,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhw.",	XO(4,428,0,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhwo",	XO(4,428,1,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhwo.",	XO(4,428,1,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhws",	XO(4,492,0,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhws.",	XO(4,492,0,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhwso",	XO(4,492,1,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhwso.",	XO(4,492,1,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhwsu",	XO(4,460,0,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhwsu.",	XO(4,460,0,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhwsuo",	XO(4,460,1,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhwsuo.",	XO(4,460,1,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhwu",	XO(4,396,0,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhwu.",	XO(4,396,0,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhwuo",	XO(4,396,1,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "maclhwuo.",	XO(4,396,1,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "mulchw",	XRC(4,168,0),  X_MASK,	PPC405,		{ RT, RA, RB } },
+{ "mulchw.",	XRC(4,168,1),  X_MASK,	PPC405,		{ RT, RA, RB } },
+{ "mulchwu",	XRC(4,136,0),  X_MASK,	PPC405,		{ RT, RA, RB } },
+{ "mulchwu.",	XRC(4,136,1),  X_MASK,	PPC405,		{ RT, RA, RB } },
+{ "mulhhw",	XRC(4,40,0),   X_MASK,	PPC405,		{ RT, RA, RB } },
+{ "mulhhw.",	XRC(4,40,1),   X_MASK,	PPC405,		{ RT, RA, RB } },
+{ "mulhhwu",	XRC(4,8,0),    X_MASK,	PPC405,		{ RT, RA, RB } },
+{ "mulhhwu.",	XRC(4,8,1),    X_MASK,	PPC405,		{ RT, RA, RB } },
+{ "mullhw",	XRC(4,424,0),  X_MASK,	PPC405,		{ RT, RA, RB } },
+{ "mullhw.",	XRC(4,424,1),  X_MASK,	PPC405,		{ RT, RA, RB } },
+{ "mullhwu",	XRC(4,392,0),  X_MASK,	PPC405,		{ RT, RA, RB } },
+{ "mullhwu.",	XRC(4,392,1),  X_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmacchw",	XO(4,174,0,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmacchw.",	XO(4,174,0,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmacchwo",	XO(4,174,1,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmacchwo.",	XO(4,174,1,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmacchws",	XO(4,238,0,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmacchws.",	XO(4,238,0,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmacchwso",	XO(4,238,1,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmacchwso.",	XO(4,238,1,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmachhw",	XO(4,46,0,0),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmachhw.",	XO(4,46,0,1),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmachhwo",	XO(4,46,1,0),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmachhwo.",	XO(4,46,1,1),  XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmachhws",	XO(4,110,0,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmachhws.",	XO(4,110,0,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmachhwso",	XO(4,110,1,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmachhwso.",	XO(4,110,1,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmaclhw",	XO(4,430,0,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmaclhw.",	XO(4,430,0,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmaclhwo",	XO(4,430,1,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmaclhwo.",	XO(4,430,1,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmaclhws",	XO(4,494,0,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmaclhws.",	XO(4,494,0,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmaclhwso",	XO(4,494,1,0), XO_MASK,	PPC405,		{ RT, RA, RB } },
+{ "nmaclhwso.",	XO(4,494,1,1), XO_MASK,	PPC405,		{ RT, RA, RB } },
 { "mfvscr",  VX(4, 1540), VX_MASK,	PPCVEC,		{ VD } },
 { "mtvscr",  VX(4, 1604), VX_MASK,	PPCVEC,		{ VD } },
 { "vaddcuw", VX(4,  384), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
@@ -1520,7 +1609,7 @@
 { "vsldoi",    VXA(4,  44), VXA_MASK,	PPCVEC,		{ VD, VA, VB, SHB } },
 { "vslh",      VX(4,  324), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
 { "vslo",      VX(4, 1036), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
-{ "vslw",      VX(4,  338), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vslw",      VX(4,  388), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
 { "vspltb",    VX(4,  524), VX_MASK,	PPCVEC,		{ VD, VB, UIMM } },
 { "vsplth",    VX(4,  588), VX_MASK,	PPCVEC,		{ VD, VB, UIMM } },
 { "vspltisb",  VX(4,  780), VX_MASK,	PPCVEC,		{ VD, SIMM } },
@@ -2033,11 +2122,13 @@
 { "bcr",     XLLK(19,16,0), XLBB_MASK,	PWRCOM,		{ BO, BI } },
 { "bcrl",    XLLK(19,16,1), XLBB_MASK,	PWRCOM,		{ BO, BI } },
 
+{ "rfid",    XL(19,18),	0xffffffff,	PPC64,		{ 0 } },
+
 { "crnot",   XL(19,33), XL_MASK,	PPCCOM,		{ BT, BA, BBA } },
 { "crnor",   XL(19,33),	XL_MASK,	COM,		{ BT, BA, BB } },
 
 { "rfi",     XL(19,50),	0xffffffff,	COM,		{ 0 } },
-{ "rfci",    XL(19,51),	0xffffffff,	PPC,		{ 0 } },
+{ "rfci",    XL(19,51),	0xffffffff,	PPC403,		{ 0 } },
 
 { "rfsvc",   XL(19,82),	0xffffffff,	POWER,		{ 0 } },
 
@@ -2366,6 +2457,8 @@
 { "mulhw",   XO(31,75,0,0), XO_MASK,	PPC,		{ RT, RA, RB } },
 { "mulhw.",  XO(31,75,0,1), XO_MASK,	PPC,		{ RT, RA, RB } },
 
+{ "mtsrd",   X(31,82),	XRB_MASK|(1<<20), PPC64,	{ SR, RS } },
+
 { "mfmsr",   X(31,83),	XRARB_MASK,	COM,		{ RT } },
 
 { "ldarx",   X(31,84),	X_MASK,		PPC64,		{ RT, RA, RB } },
@@ -2384,6 +2477,8 @@
 { "mulo",    XO(31,107,1,0), XO_MASK,	M601,		{ RT, RA, RB } },
 { "mulo.",   XO(31,107,1,1), XO_MASK,	M601,		{ RT, RA, RB } },
 
+{ "mtsrdin", X(31,114),	XRA_MASK,	PPC64,		{ RS, RB } },
+
 { "clf",     X(31,118), XRB_MASK,	POWER,		{ RT, RA } },
 
 { "lbzux",   X(31,119),	X_MASK,		COM,		{ RT, RAL, RB } },
@@ -2433,6 +2528,8 @@
 
 { "wrteei",  X(31,163),	XE_MASK,	PPC403,		{ E } },
 
+{ "mtmsrd",  X(31,178),	XRARB_MASK,	PPC64,		{ RS } },
+
 { "stdux",   X(31,181),	X_MASK,		PPC64,		{ RS, RAS, RB } },
 
 { "stwux",   X(31,183),	X_MASK,		PPCCOM,		{ RS, RAS, RB } },
@@ -2534,7 +2631,7 @@
 
 { "lhzx",    X(31,279),	X_MASK,		COM,		{ RT, RA, RB } },
 
-{ "icbt",    X(31,262),	XRT_MASK,	PPC,		{ RA, RB } },
+{ "icbt",    X(31,262),	XRT_MASK,	PPC403,		{ RA, RB } },
 
 { "eqv",     XRC(31,284,0), X_MASK,	COM,		{ RA, RS, RB } },
 { "eqv.",    XRC(31,284,1), X_MASK,	COM,		{ RA, RS, RB } },
@@ -2583,7 +2680,7 @@
 { "mfdmasa3", XSPR(31,323,219), XSPR_MASK, PPC403,	{ RT } },
 { "mfdmacc3", XSPR(31,323,220), XSPR_MASK, PPC403,	{ RT } },
 { "mfdmasr", XSPR(31,323,224), XSPR_MASK, PPC403,	{ RT } },
-{ "mfdcr",   X(31,323),	X_MASK,		PPC,		{ RT, SPR } },
+{ "mfdcr",   X(31,323),	X_MASK,		PPC403,		{ RT, SPR } },
 
 { "div",     XO(31,331,0,0), XO_MASK,	M601,		{ RT, RA, RB } },
 { "div.",    XO(31,331,0,1), XO_MASK,	M601,		{ RT, RA, RB } },
@@ -2621,6 +2718,10 @@
 { "mflctrl2", XSPR(31,339,157), XSPR_MASK, PPC860,	{ RT } },
 { "mfictrl",  XSPR(31,339,158), XSPR_MASK, PPC860,	{ RT } },
 { "mfbar",    XSPR(31,339,159), XSPR_MASK, PPC860,	{ RT } },
+{ "mfsprg4",  XSPR(31,339,260), XSPR_MASK, PPC405,	{ RT } },
+{ "mfsprg5",  XSPR(31,339,261), XSPR_MASK, PPC405,	{ RT } },
+{ "mfsprg6",  XSPR(31,339,262), XSPR_MASK, PPC405,	{ RT } },
+{ "mfsprg7",  XSPR(31,339,263), XSPR_MASK, PPC405,	{ RT } },
 { "mfsprg",   XSPR(31,339,272), XSPRG_MASK, PPC,	{ RT, SPRG } },
 { "mfsprg0",  XSPR(31,339,272), XSPR_MASK, PPC,		{ RT } },
 { "mfsprg1",  XSPR(31,339,273), XSPR_MASK, PPC,		{ RT } },
@@ -2661,9 +2762,10 @@
 { "mfmd_dbcam", XSPR(31,339,824), XSPR_MASK, PPC860,	{ RT } },
 { "mfmd_dbram0",XSPR(31,339,825), XSPR_MASK, PPC860,	{ RT } },
 { "mfmd_dbram1",XSPR(31,339,826), XSPR_MASK, PPC860,	{ RT } },
-{ "mfzpr",   XSPR(31,339,944), XSPR_MASK, PPC403,	{ RT } },
-{ "mfpid",   XSPR(31,339,945), XSPR_MASK, PPC403,	{ RT } },
-{ "mficdbdr",XSPR(31,339,979), XSPR_MASK, PPC403,	{ RT } },
+{ "mfzpr",   	XSPR(31,339,944), XSPR_MASK, PPC403,	{ RT } },
+{ "mfpid",   	XSPR(31,339,945), XSPR_MASK, PPC403,	{ RT } },
+{ "mfccr0",  	XSPR(31,339,947), XSPR_MASK, PPC405,	{ RT } },
+{ "mficdbdr",	XSPR(31,339,979), XSPR_MASK, PPC403,	{ RT } },
 { "mfummcr0",	XSPR(31,339,936),  XSPR_MASK, PPC750,	{ RT } },
 { "mfupmc1",	XSPR(31,339,937),  XSPR_MASK, PPC750,	{ RT } },
 { "mfupmc2",	XSPR(31,339,938),  XSPR_MASK, PPC750,	{ RT } },
@@ -2671,12 +2773,21 @@
 { "mfummcr1",	XSPR(31,339,940),  XSPR_MASK, PPC750,	{ RT } },
 { "mfupmc3",	XSPR(31,339,941),  XSPR_MASK, PPC750,	{ RT } },
 { "mfupmc4",	XSPR(31,339,942),  XSPR_MASK, PPC750,	{ RT } },
+{ "mfiac3",     XSPR(31,339,948),  XSPR_MASK, PPC405,	{ RT } },
+{ "mfiac4",     XSPR(31,339,949),  XSPR_MASK, PPC405,	{ RT } },
+{ "mfdvc1",     XSPR(31,339,950),  XSPR_MASK, PPC405,	{ RT } },
+{ "mfdvc2",     XSPR(31,339,951),  XSPR_MASK, PPC405,	{ RT } },
 { "mfmmcr0",	XSPR(31,339,952),  XSPR_MASK, PPC750,	{ RT } },
 { "mfpmc1",	XSPR(31,339,953),  XSPR_MASK, PPC750,	{ RT } },
+{ "mfsgr",	XSPR(31,339,953),  XSPR_MASK, PPC403,	{ RT } },
 { "mfpmc2",	XSPR(31,339,954),  XSPR_MASK, PPC750,	{ RT } },
+{ "mfdcwr", 	XSPR(31,339,954),  XSPR_MASK, PPC403,	{ RT } },
 { "mfsia",	XSPR(31,339,955),  XSPR_MASK, PPC750,	{ RT } },
+{ "mfsler",	XSPR(31,339,955),  XSPR_MASK, PPC405,	{ RT } },
 { "mfmmcr1",	XSPR(31,339,956),  XSPR_MASK, PPC750,	{ RT } },
+{ "mfsu0r",	XSPR(31,339,956),  XSPR_MASK, PPC405,	{ RT } },
 { "mfpmc3",	XSPR(31,339,957),  XSPR_MASK, PPC750,	{ RT } },
+{ "mfdbcr1", 	XSPR(31,339,957),  XSPR_MASK, PPC405,	{ RT } },
 { "mfpmc4",	XSPR(31,339,958),  XSPR_MASK, PPC750,	{ RT } },
 { "mfesr",   XSPR(31,339,980), XSPR_MASK, PPC403,	{ RT } },
 { "mfdear",  XSPR(31,339,981), XSPR_MASK, PPC403,	{ RT } },
@@ -2690,6 +2801,7 @@
 { "mfsrr2",  XSPR(31,339,990), XSPR_MASK, PPC403,	{ RT } },
 { "mfsrr3",  XSPR(31,339,991), XSPR_MASK, PPC403,	{ RT } },
 { "mfdbsr",  XSPR(31,339,1008), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdbcr0", XSPR(31,339,1010), XSPR_MASK, PPC405,	{ RT } },
 { "mfiac1",  XSPR(31,339,1012), XSPR_MASK, PPC403,	{ RT } },
 { "mfiac2",  XSPR(31,339,1013), XSPR_MASK, PPC403,	{ RT } },
 { "mfdac1",  XSPR(31,339,1014), XSPR_MASK, PPC403,	{ RT } },
@@ -2711,7 +2823,7 @@
 
 { "lhax",    X(31,343),	X_MASK,		COM,		{ RT, RA, RB } },
 
-{ "dccci",   X(31,454),	XRT_MASK,	PPC,		{ RA, RB } },
+{ "dccci",   X(31,454),	XRT_MASK,	PPC403,		{ RA, RB } },
 
 { "abs",     XO(31,360,0,0), XORB_MASK, M601,		{ RT, RA } },
 { "abs.",    XO(31,360,0,1), XORB_MASK, M601,		{ RT, RA } },
@@ -2725,6 +2837,7 @@
 
 { "tlbia",   X(31,370),	0xffffffff,	PPC,		{ 0 } },
 
+{ "mftbl",   XSPR(31,371,268), XSPR_MASK, PPC,		{ RT } },
 { "mftbu",   XSPR(31,371,269), XSPR_MASK, PPC,		{ RT } },
 { "mftb",    X(31,371),	X_MASK,		PPC,		{ RT, TBR } },
 
@@ -2812,7 +2925,7 @@
 { "mtthrm1",	XSPR(31,451,1020), XSPR_MASK, PPC750,	{ RT } },
 { "mtthrm2",	XSPR(31,451,1021), XSPR_MASK, PPC750,	{ RT } },
 { "mtthrm3",	XSPR(31,451,1022), XSPR_MASK, PPC750,	{ RT } },
-{ "mtdcr",   X(31,451),	X_MASK,		PPC,		{ SPR, RS } },
+{ "mtdcr",   X(31,451),	X_MASK,		PPC403,		{ SPR, RS } },
 
 { "divdu",   XO(31,457,0,0), XO_MASK,	PPC64,		{ RT, RA, RB } },
 { "divdu.",  XO(31,457,0,1), XO_MASK,	PPC64,		{ RT, RA, RB } },
@@ -2859,6 +2972,10 @@
 { "mtsprg1", XSPR(31,467,273), XSPR_MASK,    PPC,	{ RT } },
 { "mtsprg2", XSPR(31,467,274), XSPR_MASK,    PPC,	{ RT } },
 { "mtsprg3", XSPR(31,467,275), XSPR_MASK,    PPC,	{ RT } },
+{ "mtsprg4", XSPR(31,467,276), XSPR_MASK,    PPC405,	{ RT } },
+{ "mtsprg5", XSPR(31,467,277), XSPR_MASK,    PPC405,	{ RT } },
+{ "mtsprg6", XSPR(31,467,278), XSPR_MASK,    PPC405,	{ RT } },
+{ "mtsprg7", XSPR(31,467,279), XSPR_MASK,    PPC405,	{ RT } },
 { "mtasr",   XSPR(31,467,280), XSPR_MASK,    PPC64,	{ RS } },
 { "mtear",   XSPR(31,467,282), XSPR_MASK,    PPC,	{ RS } },
 { "mttbl",   XSPR(31,467,284), XSPR_MASK,    PPC,	{ RS } },
@@ -2869,8 +2986,19 @@
 { "mtdbatl", XSPR(31,467,537), XSPRBAT_MASK, PPC,	{ SPRBAT, RS } },
 { "mtzpr",   XSPR(31,467,944), XSPR_MASK, PPC403,	{ RT } },
 { "mtpid",   XSPR(31,467,945), XSPR_MASK, PPC403,	{ RT } },
+{ "mtccr0",  XSPR(31,467,947), XSPR_MASK, PPC405,	{ RT } },
+{ "mtiac3",  XSPR(31,467,948), XSPR_MASK, PPC405,	{ RT } },
+{ "mtiac4",  XSPR(31,467,949), XSPR_MASK, PPC405,	{ RT } },
+{ "mtdvc1",  XSPR(31,467,950), XSPR_MASK, PPC405,	{ RT } },
+{ "mtdvc2",  XSPR(31,467,951), XSPR_MASK, PPC405,	{ RT } },
+{ "mtsgr",   XSPR(31,467,953), XSPR_MASK, PPC403,	{ RT } },
+{ "mtdcwr",  XSPR(31,467,954), XSPR_MASK, PPC403,	{ RT } },
+{ "mtsler",  XSPR(31,467,955), XSPR_MASK, PPC405,	{ RT } },
+{ "mtsu0r",  XSPR(31,467,956), XSPR_MASK, PPC405,	{ RT } },
+{ "mtdbcr1", XSPR(31,467,957), XSPR_MASK, PPC405,	{ RT } },
 { "mticdbdr",XSPR(31,467,979), XSPR_MASK, PPC403,	{ RT } },
 { "mtesr",   XSPR(31,467,980), XSPR_MASK, PPC403,	{ RT } },
+{ "mtdear",  XSPR(31,467,981), XSPR_MASK, PPC403,	{ RT } },
 { "mtevpr",  XSPR(31,467,982), XSPR_MASK, PPC403,	{ RT } },
 { "mtcdbcr", XSPR(31,467,983), XSPR_MASK, PPC403,	{ RT } },
 { "mttsr",   XSPR(31,467,984), XSPR_MASK, PPC403,	{ RT } },
@@ -2881,6 +3009,7 @@
 { "mtsrr2",  XSPR(31,467,990), XSPR_MASK, PPC403,	{ RT } },
 { "mtsrr3",  XSPR(31,467,991), XSPR_MASK, PPC403,	{ RT } },
 { "mtdbsr",  XSPR(31,467,1008), XSPR_MASK, PPC403,	{ RT } },
+{ "mtdbcr0", XSPR(31,467,1010), XSPR_MASK, PPC405,	{ RT } },
 { "mtiac1",  XSPR(31,467,1012), XSPR_MASK, PPC403,	{ RT } },
 { "mtiac2",  XSPR(31,467,1013), XSPR_MASK, PPC403,	{ RT } },
 { "mtdac1",  XSPR(31,467,1014), XSPR_MASK, PPC403,	{ RT } },
@@ -2997,6 +3126,8 @@
 { "sreq",    XRC(31,729,0), X_MASK,	M601,		{ RA, RS, RB } },
 { "sreq.",   XRC(31,729,1), X_MASK,	M601,		{ RA, RS, RB } },
 
+{ "dcba",    X(31,758),	XRT_MASK,	PPC405,		{ RA, RB } },
+
 { "stfdux",  X(31,759),	X_MASK,		COM,		{ FRS, RAS, RB } },
 
 { "srliq",   XRC(31,760,0), X_MASK,	M601,		{ RA, RS, SH } },
@@ -3037,6 +3168,8 @@
 { "extsh.",  XRC(31,922,1), XRB_MASK,	PPCCOM,		{ RA, RS } },
 { "exts.",   XRC(31,922,1), XRB_MASK,	PWRCOM,		{ RA, RS } },
 
+{ "tlbrehi", XTLB(31,946,0), XTLB_MASK,	PPC403,		{ RT, RA } },
+{ "tlbrelo", XTLB(31,946,1), XTLB_MASK,	PPC403,		{ RT, RA } },
 { "tlbre",   X(31,946),	X_MASK,		PPC403,		{ RT, RA, SH } },
 
 { "sraiq",   XRC(31,952,0), X_MASK,	M601,		{ RA, RS, SH } },
@@ -3045,9 +3178,12 @@
 { "extsb",   XRC(31,954,0), XRB_MASK,	PPC,		{ RA, RS} },
 { "extsb.",  XRC(31,954,1), XRB_MASK,	PPC,		{ RA, RS} },
 
-{ "iccci",   X(31,966),	XRT_MASK,	PPC,		{ RA, RB } },
+{ "iccci",   X(31,966),	XRT_MASK,	PPC403,		{ RA, RB } },
 
 { "tlbld",   X(31,978),	XRTRA_MASK,	PPC,		{ RB } },
+
+{ "tlbwehi", XTLB(31,978,0), XTLB_MASK,	PPC403,		{ RT, RA } },
+{ "tlbwelo", XTLB(31,978,1), XTLB_MASK,	PPC403,		{ RT, RA } },
 { "tlbwe",   X(31,978),	X_MASK,		PPC403,		{ RS, RA, SH } },
 
 { "icbi",    X(31,982),	XRT_MASK,	PPC,		{ RA, RB } },
diff --git a/opcodes/sh-dis.c b/opcodes/sh-dis.c
index 548e2a8..719f37a 100644
--- a/opcodes/sh-dis.c
+++ b/opcodes/sh-dis.c
@@ -1,5 +1,6 @@
 /* Disassemble SH instructions.
-   Copyright (C) 1993, 94, 95, 96, 97, 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 96, 97, 1998, 2000
+   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
@@ -34,22 +35,22 @@
 {
   int n;
 
-  fprintf_fn (stream,"%s\t", op->name);
+  fprintf_fn (stream, "%s\t", op->name);
   for (n = 0; n < 2; n++)
     {
       switch (op->arg[n])
 	{
 	case A_IND_N:
-	  fprintf_fn (stream, "@r%d", rn);	
+	  fprintf_fn (stream, "@r%d", rn);
 	  break;
 	case A_INC_N:
-	  fprintf_fn (stream, "@r%d+", rn);	
+	  fprintf_fn (stream, "@r%d+", rn);
 	  break;
 	case A_PMOD_N:
-	  fprintf_fn (stream, "@r%d+r8", rn);	
+	  fprintf_fn (stream, "@r%d+r8", rn);
 	  break;
 	case A_PMODY_N:
-	  fprintf_fn (stream, "@r%d+r9", rn);	
+	  fprintf_fn (stream, "@r%d+r9", rn);
 	  break;
 	case DSP_REG_M:
 	  fprintf_fn (stream, "a%c", '0' + rm);
@@ -64,7 +65,7 @@
 	  abort ();
 	}
       if (n == 0)
-	fprintf_fn (stream, ",");	
+	fprintf_fn (stream, ",");
     }
 }
 
@@ -72,6 +73,7 @@
    nibbles of the insn, i.e. field a and the bit that indicates if
    a parallel processing insn follows.
    Return nonzero if a field b of a parallel processing insns follows.  */
+
 static void
 print_insn_ddt (insn, info)
      int insn;
@@ -97,19 +99,20 @@
     {
       static sh_opcode_info *first_movx, *first_movy;
       sh_opcode_info *opx, *opy;
-      int insn_x, insn_y;
+      unsigned int insn_x, insn_y;
 
       if (! first_movx)
 	{
-	  for (first_movx = sh_table; first_movx->nibbles[1] != MOVX; )
+	  for (first_movx = sh_table; first_movx->nibbles[1] != MOVX;)
 	    first_movx++;
-	  for (first_movy = first_movx; first_movy->nibbles[1] != MOVY; )
+	  for (first_movy = first_movx; first_movy->nibbles[1] != MOVY;)
 	    first_movy++;
 	}
       insn_x = (insn >> 2) & 0xb;
       if (insn_x)
 	{
-	  for (opx = first_movx; opx->nibbles[2] != insn_x; ) opx++;
+	  for (opx = first_movx; opx->nibbles[2] != insn_x;)
+	    opx++;
 	  print_movxy (opx, ((insn >> 9) & 1) + 4, (insn >> 7) & 1,
 		       fprintf_fn, stream);
 	}
@@ -118,7 +121,8 @@
 	{
 	  if (insn_x)
 	    fprintf_fn (stream, "\t");
-	  for (opy = first_movy; opy->nibbles[2] != insn_y; ) opy++;
+	  for (opy = first_movy; opy->nibbles[2] != insn_y;)
+	    opy++;
 	  print_movxy (opy, ((insn >> 8) & 1) + 6, (insn >> 6) & 1,
 		       fprintf_fn, stream);
 	}
@@ -174,12 +178,12 @@
      int field_b;
      struct disassemble_info *info;
 {
-  static char *sx_tab[] = {"x0","x1","a0","a1"};
-  static char *sy_tab[] = {"y0","y1","m0","m1"};
+  static char *sx_tab[] = { "x0", "x1", "a0", "a1" };
+  static char *sy_tab[] = { "y0", "y1", "m0", "m1" };
   fprintf_ftype fprintf_fn = info->fprintf_func;
   void *stream = info->stream;
-  int nib1, nib2, nib3;
-  char *dc;
+  unsigned int nib1, nib2, nib3;
+  char *dc = NULL;
   sh_opcode_info *op;
 
   if ((field_b & 0xe800) == 0)
@@ -192,10 +196,10 @@
     }
   if ((field_b & 0xc000) == 0x4000 && (field_b & 0x3000) != 0x1000)
     {
-      static char *du_tab[] = {"x0","y0","a0","a1"};
-      static char *se_tab[] = {"x0","x1","y0","a1"};
-      static char *sf_tab[] = {"y0","y1","x0","a1"};
-      static char *sg_tab[] = {"m0","m1","a0","a1"};
+      static char *du_tab[] = { "x0", "y0", "a0", "a1" };
+      static char *se_tab[] = { "x0", "x1", "y0", "a1" };
+      static char *sf_tab[] = { "y0", "y1", "x0", "a1" };
+      static char *sg_tab[] = { "m0", "m1", "a0", "a1" };
 
       if (field_b & 0x2000)
 	{
@@ -243,11 +247,11 @@
 	  int n;
 
 	  fprintf_fn (stream, "%s%s\t", dc, op->name);
-	  for (n = 0; n < 3 && op->arg[n] != A_END; n++) 
+	  for (n = 0; n < 3 && op->arg[n] != A_END; n++)
 	    {
 	      if (n && op->arg[1] != A_END)
 		fprintf_fn (stream, ",");
-	      switch (op->arg[n]) 
+	      switch (op->arg[n])
 		{
 		case DSP_REG_N:
 		  print_dsp_reg (field_b & 0xf, fprintf_fn, stream);
@@ -262,7 +266,7 @@
 		  fprintf_fn (stream, "mach");
 		  break;
 		case A_MACL:
-		  fprintf_fn (stream ,"macl");
+		  fprintf_fn (stream, "macl");
 		  break;
 		default:
 		  abort ();
@@ -275,7 +279,7 @@
   fprintf_fn (stream, ".word 0x%x", field_b);
 }
 
-static int 
+static int
 print_insn_shx (memaddr, info)
      bfd_vma memaddr;
      struct disassemble_info *info;
@@ -285,7 +289,7 @@
   unsigned char insn[2];
   unsigned char nibs[4];
   int status;
-  bfd_vma relmask = ~ (bfd_vma) 0;
+  bfd_vma relmask = ~(bfd_vma) 0;
   sh_opcode_info *op;
   int target_arch;
 
@@ -318,13 +322,13 @@
 
   status = info->read_memory_func (memaddr, insn, 2, info);
 
-  if (status != 0) 
+  if (status != 0)
     {
       info->memory_error_func (status, memaddr, info);
       return -1;
     }
 
-  if (info->flags & LITTLE_BIT) 
+  if (info->flags & LITTLE_BIT)
     {
       nibs[0] = (insn[1] >> 4) & 0xf;
       nibs[1] = insn[1] & 0xf;
@@ -332,7 +336,7 @@
       nibs[2] = (insn[0] >> 4) & 0xf;
       nibs[3] = insn[0] & 0xf;
     }
-  else 
+  else
     {
       nibs[0] = (insn[0] >> 4) & 0xf;
       nibs[1] = insn[0] & 0xf;
@@ -349,13 +353,13 @@
 
 	  status = info->read_memory_func (memaddr + 2, insn, 2, info);
 
-	  if (status != 0) 
+	  if (status != 0)
 	    {
 	      info->memory_error_func (status, memaddr + 2, info);
 	      return -1;
 	    }
 
-	  if (info->flags & LITTLE_BIT) 
+	  if (info->flags & LITTLE_BIT)
 	    field_b = insn[1] << 8 | insn[0];
 	  else
 	    field_b = insn[0] << 8 | insn[1];
@@ -367,7 +371,7 @@
       print_insn_ddt ((nibs[1] << 8) | (nibs[2] << 4) | nibs[3], info);
       return 2;
     }
-  for (op = sh_table; op->name; op++) 
+  for (op = sh_table; op->name; op++)
     {
       int n;
       int imm = 0;
@@ -383,7 +387,7 @@
 	{
 	  int i = op->nibbles[n];
 
-	  if (i < 16) 
+	  if (i < 16)
 	    {
 	      if (nibs[n] == i)
 		continue;
@@ -392,10 +396,10 @@
 	  switch (i)
 	    {
 	    case BRANCH_8:
-	      imm = (nibs[2] << 4) | (nibs[3]);	  
+	      imm = (nibs[2] << 4) | (nibs[3]);
 	      if (imm & 0x80)
 		imm |= ~0xff;
-	      imm = ((char)imm) * 2 + 4 ;
+	      imm = ((char) imm) * 2 + 4;
 	      goto ok;
 	    case BRANCH_12:
 	      imm = ((nibs[1]) << 8) | (nibs[2] << 4) | (nibs[3]);
@@ -409,31 +413,31 @@
 	      goto ok;
 	    case IMM0_4BY2:
 	    case IMM1_4BY2:
-	      imm = nibs[3] <<1;
+	      imm = nibs[3] << 1;
 	      goto ok;
 	    case IMM0_4BY4:
 	    case IMM1_4BY4:
-	      imm = nibs[3] <<2;
+	      imm = nibs[3] << 2;
 	      goto ok;
 	    case IMM0_8:
 	    case IMM1_8:
 	      imm = (nibs[2] << 4) | nibs[3];
 	      goto ok;
 	    case PCRELIMM_8BY2:
-	      imm = ((nibs[2] << 4) | nibs[3]) <<1;
-	      relmask = ~ (bfd_vma) 1;
+	      imm = ((nibs[2] << 4) | nibs[3]) << 1;
+	      relmask = ~(bfd_vma) 1;
 	      goto ok;
 	    case PCRELIMM_8BY4:
-	      imm = ((nibs[2] << 4) | nibs[3]) <<2;
-	      relmask = ~ (bfd_vma) 3;
+	      imm = ((nibs[2] << 4) | nibs[3]) << 2;
+	      relmask = ~(bfd_vma) 3;
 	      goto ok;
 	    case IMM0_8BY2:
 	    case IMM1_8BY2:
-	      imm = ((nibs[2] << 4) | nibs[3]) <<1;
+	      imm = ((nibs[2] << 4) | nibs[3]) << 1;
 	      goto ok;
 	    case IMM0_8BY4:
 	    case IMM1_8BY4:
-	      imm = ((nibs[2] << 4) | nibs[3]) <<2;
+	      imm = ((nibs[2] << 4) | nibs[3]) << 2;
 	      goto ok;
 	    case REG_N:
 	      rn = nibs[n];
@@ -447,7 +451,7 @@
 	      break;
 	    case REG_B:
 	      rb = nibs[n] & 0x07;
-	      break;	
+	      break;
 	    case SDT_REG_N:
 	      /* sh-dsp: single data transfer.  */
 	      rn = nibs[n];
@@ -460,21 +464,21 @@
 	    case REPEAT:
 	      goto fail;
 	    default:
-	      abort();
+	      abort ();
 	    }
 	}
 
     ok:
-      fprintf_fn (stream,"%s\t", op->name);
+      fprintf_fn (stream, "%s\t", op->name);
       disp_pc = 0;
-      for (n = 0; n < 3 && op->arg[n] != A_END; n++) 
+      for (n = 0; n < 3 && op->arg[n] != A_END; n++)
 	{
 	  if (n && op->arg[1] != A_END)
 	    fprintf_fn (stream, ",");
-	  switch (op->arg[n]) 
+	  switch (op->arg[n])
 	    {
 	    case A_IMM:
-	      fprintf_fn (stream, "#%d", (char)(imm));
+	      fprintf_fn (stream, "#%d", (char) (imm));
 	      break;
 	    case A_R0:
 	      fprintf_fn (stream, "r0");
@@ -483,34 +487,34 @@
 	      fprintf_fn (stream, "r%d", rn);
 	      break;
 	    case A_INC_N:
-	      fprintf_fn (stream, "@r%d+", rn);	
+	      fprintf_fn (stream, "@r%d+", rn);
 	      break;
 	    case A_DEC_N:
-	      fprintf_fn (stream, "@-r%d", rn);	
+	      fprintf_fn (stream, "@-r%d", rn);
 	      break;
 	    case A_IND_N:
-	      fprintf_fn (stream, "@r%d", rn);	
+	      fprintf_fn (stream, "@r%d", rn);
 	      break;
 	    case A_DISP_REG_N:
-	      fprintf_fn (stream, "@(%d,r%d)", imm, rn);	
+	      fprintf_fn (stream, "@(%d,r%d)", imm, rn);
 	      break;
 	    case A_PMOD_N:
-	      fprintf_fn (stream, "@r%d+r8", rn);	
+	      fprintf_fn (stream, "@r%d+r8", rn);
 	      break;
 	    case A_REG_M:
 	      fprintf_fn (stream, "r%d", rm);
 	      break;
 	    case A_INC_M:
-	      fprintf_fn (stream, "@r%d+", rm);	
+	      fprintf_fn (stream, "@r%d+", rm);
 	      break;
 	    case A_DEC_M:
-	      fprintf_fn (stream, "@-r%d", rm);	
+	      fprintf_fn (stream, "@-r%d", rm);
 	      break;
 	    case A_IND_M:
-	      fprintf_fn (stream, "@r%d", rm);	
+	      fprintf_fn (stream, "@r%d", rm);
 	      break;
 	    case A_DISP_REG_M:
-	      fprintf_fn (stream, "@(%d,r%d)", imm, rm);	
+	      fprintf_fn (stream, "@(%d,r%d)", imm, rm);
 	      break;
 	    case A_REG_B:
 	      fprintf_fn (stream, "r%d_bank", rb);
@@ -522,12 +526,12 @@
 	      break;
 	    case A_IND_R0_REG_N:
 	      fprintf_fn (stream, "@(r0,r%d)", rn);
-	      break; 
+	      break;
 	    case A_IND_R0_REG_M:
 	      fprintf_fn (stream, "@(r0,r%d)", rm);
-	      break; 
+	      break;
 	    case A_DISP_GBR:
-	      fprintf_fn (stream, "@(%d,gbr)",imm);
+	      fprintf_fn (stream, "@(%d,gbr)", imm);
 	      break;
 	    case A_R0_GBR:
 	      fprintf_fn (stream, "@(r0,gbr)");
@@ -585,7 +589,7 @@
 	      fprintf_fn (stream, "mach");
 	      break;
 	    case A_MACL:
-	      fprintf_fn (stream ,"macl");
+	      fprintf_fn (stream, "macl");
 	      break;
 	    case A_PR:
 	      fprintf_fn (stream, "pr");
@@ -608,7 +612,6 @@
 		  fprintf_fn (stream, "xd%d", rn & ~1);
 		  break;
 		}
-	    d_reg_n:
 	    case D_REG_N:
 	      fprintf_fn (stream, "dr%d", rn);
 	      break;
@@ -633,16 +636,16 @@
 	      fprintf_fn (stream, "fr0");
 	      break;
 	    case V_REG_N:
-	      fprintf_fn (stream, "fv%d", rn*4);
+	      fprintf_fn (stream, "fv%d", rn * 4);
 	      break;
 	    case V_REG_M:
-	      fprintf_fn (stream, "fv%d", rm*4);
+	      fprintf_fn (stream, "fv%d", rm * 4);
 	      break;
 	    case XMTRX_M4:
 	      fprintf_fn (stream, "xmtrx");
 	      break;
 	    default:
-	      abort();
+	      abort ();
 	    }
 	}
 
@@ -655,7 +658,7 @@
       if (!(info->flags & 1)
 	  && (op->name[0] == 'j'
 	      || (op->name[0] == 'b'
-		  && (op->name[1] == 'r' 
+		  && (op->name[1] == 'r'
 		      || op->name[1] == 's'))
 	      || (op->name[0] == 'r' && op->name[1] == 't')
 	      || (op->name[0] == 'b' && op->name[2] == '.')))
@@ -674,7 +677,7 @@
 	  int size;
 	  bfd_byte bytes[4];
 
-	  if (relmask == ~ (bfd_vma) 1)
+	  if (relmask == ~(bfd_vma) 1)
 	    size = 2;
 	  else
 	    size = 4;
@@ -710,7 +713,7 @@
   return 2;
 }
 
-int 
+int
 print_insn_shl (memaddr, info)
      bfd_vma memaddr;
      struct disassemble_info *info;
@@ -722,7 +725,7 @@
   return r;
 }
 
-int 
+int
 print_insn_sh (memaddr, info)
      bfd_vma memaddr;
      struct disassemble_info *info;
diff --git a/opcodes/sh-opc.h b/opcodes/sh-opc.h
index 1bfacbe..334c942 100644
--- a/opcodes/sh-opc.h
+++ b/opcodes/sh-opc.h
@@ -400,7 +400,7 @@
 
 /* 10000001mmmmi4*2 mov.w R0,@(<disp>,<REG_M>)*/{"mov.w",{A_R0,A_DISP_REG_M},{HEX_8,HEX_1,REG_M,IMM1_4BY2}, arch_sh1_up},
 
-/* 11000001i8*2.... mov.w R0,@(<disp>,GBR)*/{"mov.w",{A_R0,A_DISP_GBR},{HEX_C,HEX_1,IMM0_8BY2}, arch_sh1_up},
+/* 11000001i8*2.... mov.w R0,@(<disp>,GBR)*/{"mov.w",{A_R0,A_DISP_GBR},{HEX_C,HEX_1,IMM1_8BY2}, arch_sh1_up},
 
 /* 11000111i8p4.... mova @(<disp>,PC),R0*/{"mova",{A_DISP_PC,A_R0},{HEX_C,HEX_7,PCRELIMM_8BY4}, arch_sh1_up},
 /* 0000nnnn11000011 movca.l R0,@<REG_N> */{"movca.l",{A_R0,A_IND_N},{HEX_0,REG_N,HEX_C,HEX_3}, arch_sh4_up},
diff --git a/opcodes/sparc-dis.c b/opcodes/sparc-dis.c
index a595d0f..cebff52 100644
--- a/opcodes/sparc-dis.c
+++ b/opcodes/sparc-dis.c
@@ -1,5 +1,5 @@
 /* Print SPARC instructions.
-   Copyright (C) 1989, 91-97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1989, 91-97, 1998, 2000 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
@@ -25,7 +25,8 @@
 
 /* Bitmask of v9 architectures.  */
 #define MASK_V9 ((1 << SPARC_OPCODE_ARCH_V9) \
-		 | (1 << SPARC_OPCODE_ARCH_V9A))
+		 | (1 << SPARC_OPCODE_ARCH_V9A) \
+		 | (1 << SPARC_OPCODE_ARCH_V9B))
 /* 1 if INSN is for v9 only.  */
 #define V9_ONLY_P(insn) (! ((insn)->architecture & ~MASK_V9))
 /* 1 if INSN is for v9.  */
@@ -95,7 +96,7 @@
 static char *v9a_asr_reg_names[] =
 {
   "pcr", "pic", "dcr", "gsr", "set_softint", "clear_softint",
-  "softint", "tick_cmpr"
+  "softint", "tick_cmpr", "sys_tick", "sys_tick_cmpr"
 };
 
 /* Macros used to extract instruction fields.  Not all fields have
@@ -463,6 +464,10 @@
 		    }
 		    break;
 
+		  case '3':
+		    (info->fprintf_func) (stream, "%d", X_IMM (insn, 3));
+		    break;
+
 		  case 'K':
 		    {
 		      int mask = X_MEMBAR (insn);
@@ -551,7 +556,7 @@
 		    break;
 
 		  case '/':
-		    if (X_RS1 (insn) < 16 || X_RS1 (insn) > 23)
+		    if (X_RS1 (insn) < 16 || X_RS1 (insn) > 25)
 		      (*info->fprintf_func) (stream, "%%reserved");
 		    else
 		      (*info->fprintf_func) (stream, "%%%s",
@@ -559,7 +564,7 @@
 		    break;
 
 		  case '_':
-		    if (X_RD (insn) < 16 || X_RD (insn) > 23)
+		    if (X_RD (insn) < 16 || X_RD (insn) > 25)
 		      (*info->fprintf_func) (stream, "%%reserved");
 		    else
 		      (*info->fprintf_func) (stream, "%%%s",
@@ -770,6 +775,9 @@
     case bfd_mach_sparc_v8plusa :
     case bfd_mach_sparc_v9a :
       return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9A);
+    case bfd_mach_sparc_v8plusb :
+    case bfd_mach_sparc_v9b :
+      return SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9B);
     }
   abort ();
 }
diff --git a/opcodes/sparc-opc.c b/opcodes/sparc-opc.c
index a7132bb..2e20d2e 100644
--- a/opcodes/sparc-opc.c
+++ b/opcodes/sparc-opc.c
@@ -1,5 +1,5 @@
 /* Table of opcodes for the sparc.
-   Copyright (C) 1989, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright (C) 1989, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
 This file is part of the BFD library.
@@ -35,27 +35,30 @@
 #define MASK_SPARCLITE	SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_SPARCLITE)
 #define MASK_V9		SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9)
 #define MASK_V9A	SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9A)
+#define MASK_V9B	SPARC_OPCODE_ARCH_MASK (SPARC_OPCODE_ARCH_V9B)
 
 /* Bit masks of architectures supporting the insn.  */
 
 #define v6		(MASK_V6 | MASK_V7 | MASK_V8 | MASK_SPARCLET \
-			 | MASK_SPARCLITE | MASK_V9 | MASK_V9A)
+			 | MASK_SPARCLITE | MASK_V9 | MASK_V9A | MASK_V9B)
 /* v6 insns not supported on the sparclet */
 #define v6notlet	(MASK_V6 | MASK_V7 | MASK_V8 \
-			 | MASK_SPARCLITE | MASK_V9 | MASK_V9A)
+			 | MASK_SPARCLITE | MASK_V9 | MASK_V9A | MASK_V9B)
 #define v7		(MASK_V7 | MASK_V8 | MASK_SPARCLET \
-			 | MASK_SPARCLITE | MASK_V9 | MASK_V9A)
+			 | MASK_SPARCLITE | MASK_V9 | MASK_V9A | MASK_V9B)
 /* Although not all insns are implemented in hardware, sparclite is defined
    to be a superset of v8.  Unimplemented insns trap and are then theoretically
    implemented in software.
    It's not clear that the same is true for sparclet, although the docs
    suggest it is.  Rather than complicating things, the sparclet assembler
    recognizes all v8 insns.  */
-#define v8		(MASK_V8 | MASK_SPARCLET | MASK_SPARCLITE | MASK_V9 | MASK_V9A)
+#define v8		(MASK_V8 | MASK_SPARCLET | MASK_SPARCLITE \
+			 | MASK_V9 | MASK_V9A | MASK_V9B)
 #define sparclet	(MASK_SPARCLET)
 #define sparclite	(MASK_SPARCLITE)
-#define v9		(MASK_V9 | MASK_V9A)
-#define v9a		(MASK_V9A)
+#define v9		(MASK_V9 | MASK_V9A | MASK_V9B)
+#define v9a		(MASK_V9A | MASK_V9B)
+#define v9b		(MASK_V9B)
 /* v6 insns not supported by v9 */
 #define v6notv9		(MASK_V6 | MASK_V7 | MASK_V8 \
 			 | MASK_SPARCLET | MASK_SPARCLITE)
@@ -76,6 +79,8 @@
   { "v9", MASK_V6 | MASK_V7 | MASK_V8 | MASK_V9 },
   /* v9 with ultrasparc additions */
   { "v9a", MASK_V6 | MASK_V7 | MASK_V8 | MASK_V9 | MASK_V9A },
+  /* v9 with cheetah additions */
+  { "v9b", MASK_V6 | MASK_V7 | MASK_V8 | MASK_V9 | MASK_V9A | MASK_V9B },
   { NULL, 0 }
 };
 
@@ -755,8 +760,8 @@
 { "scan",	F3(2, 0x2c, 0), F3(~2, ~0x2c, ~0)|ASI(~0),	"1,2,d", 0, sparclet|sparclite },
 { "scan",	F3(2, 0x2c, 1), F3(~2, ~0x2c, ~1),		"1,i,d", 0, sparclet|sparclite },
 
-{ "popc",	F3(2, 0x2e, 0), F3(~2, ~0x2e, ~0)|RS2_G0|ASI(~0),"2,d", 0, v9 },
-{ "popc",	F3(2, 0x2e, 1), F3(~2, ~0x2e, ~1)|RS2_G0,	"i,d", 0, v9 },
+{ "popc",	F3(2, 0x2e, 0), F3(~2, ~0x2e, ~0)|RS1_G0|ASI(~0),"2,d", 0, v9 },
+{ "popc",	F3(2, 0x2e, 1), F3(~2, ~0x2e, ~1)|RS1_G0,	"i,d", 0, v9 },
 
 { "clr",	F3(2, 0x02, 0), F3(~2, ~0x02, ~0)|RD_G0|RS1_G0|ASI_RS2(~0),	"d", F_ALIAS, v6 }, /* or %g0,%g0,d */
 { "clr",	F3(2, 0x02, 1), F3(~2, ~0x02, ~1)|RS1_G0|SIMM13(~0),		"d", F_ALIAS, v6 }, /* or %g0,0,d	*/
@@ -843,6 +848,10 @@
 { "wr", F3(2, 0x30, 1)|RD(22),	F3(~2, ~0x30, ~1)|RD(~22),		"1,i,_", 0, v9a }, /* wr r,i,%softint */
 { "wr", F3(2, 0x30, 0)|RD(23),	F3(~2, ~0x30, ~0)|RD(~23)|ASI(~0),	"1,2,_", 0, v9a }, /* wr r,r,%tick_cmpr */
 { "wr", F3(2, 0x30, 1)|RD(23),	F3(~2, ~0x30, ~1)|RD(~23),		"1,i,_", 0, v9a }, /* wr r,i,%tick_cmpr */
+{ "wr", F3(2, 0x30, 0)|RD(24),	F3(~2, ~0x30, ~0)|RD(~24)|ASI(~0),	"1,2,_", 0, v9b }, /* wr r,r,%sys_tick */
+{ "wr", F3(2, 0x30, 1)|RD(24),	F3(~2, ~0x30, ~1)|RD(~24),		"1,i,_", 0, v9b }, /* wr r,i,%sys_tick */
+{ "wr", F3(2, 0x30, 0)|RD(25),	F3(~2, ~0x30, ~0)|RD(~25)|ASI(~0),	"1,2,_", 0, v9b }, /* wr r,r,%sys_tick_cmpr */
+{ "wr", F3(2, 0x30, 1)|RD(25),	F3(~2, ~0x30, ~1)|RD(~25),		"1,i,_", 0, v9b }, /* wr r,i,%sys_tick_cmpr */
 
 { "rd",	F3(2, 0x28, 0),			F3(~2, ~0x28, ~0)|SIMM13(~0),		"M,d", 0, v8 }, /* rd %asrX,r */
 { "rd",	F3(2, 0x28, 0),			F3(~2, ~0x28, ~0)|RS1_G0|SIMM13(~0),	"y,d", 0, v6 }, /* rd %y,r */
@@ -862,6 +871,8 @@
 { "rd",	F3(2, 0x28, 0)|RS1(19),		F3(~2, ~0x28, ~0)|RS1(~19)|SIMM13(~0),	"/,d", 0, v9a }, /* rd %gsr,r */
 { "rd",	F3(2, 0x28, 0)|RS1(22),		F3(~2, ~0x28, ~0)|RS1(~22)|SIMM13(~0),	"/,d", 0, v9a }, /* rd %softint,r */
 { "rd",	F3(2, 0x28, 0)|RS1(23),		F3(~2, ~0x28, ~0)|RS1(~23)|SIMM13(~0),	"/,d", 0, v9a }, /* rd %tick_cmpr,r */
+{ "rd",	F3(2, 0x28, 0)|RS1(24),		F3(~2, ~0x28, ~0)|RS1(~24)|SIMM13(~0),	"/,d", 0, v9b }, /* rd %sys_tick,r */
+{ "rd",	F3(2, 0x28, 0)|RS1(25),		F3(~2, ~0x28, ~0)|RS1(~25)|SIMM13(~0),	"/,d", 0, v9b }, /* rd %sys_tick_cmpr,r */
 
 { "rdpr",	F3(2, 0x2a, 0),		F3(~2, ~0x2a, ~0)|SIMM13(~0),	"?,d", 0, v9 },   /* rdpr %priv,r */
 { "wrpr",	F3(2, 0x32, 0),		F3(~2, ~0x32, ~0),		"1,2,!", 0, v9 }, /* wrpr r1,r2,%priv */
@@ -1814,6 +1825,19 @@
 { "array16",	F3F(2, 0x36, 0x012), F3F(~2, ~0x36, ~0x012), "1,2,d", 0, v9a },
 { "array32",	F3F(2, 0x36, 0x014), F3F(~2, ~0x36, ~0x014), "1,2,d", 0, v9a },
 
+/* Cheetah instructions */
+{ "edge8n",    F3F(2, 0x36, 0x001), F3F(~2, ~0x36, ~0x001), "1,2,d", 0, v9b },
+{ "edge8ln",   F3F(2, 0x36, 0x003), F3F(~2, ~0x36, ~0x003), "1,2,d", 0, v9b },
+{ "edge16n",   F3F(2, 0x36, 0x005), F3F(~2, ~0x36, ~0x005), "1,2,d", 0, v9b },
+{ "edge16ln",  F3F(2, 0x36, 0x007), F3F(~2, ~0x36, ~0x007), "1,2,d", 0, v9b },
+{ "edge32n",   F3F(2, 0x36, 0x009), F3F(~2, ~0x36, ~0x009), "1,2,d", 0, v9b },
+{ "edge32ln",  F3F(2, 0x36, 0x00b), F3F(~2, ~0x36, ~0x00b), "1,2,d", 0, v9b },
+
+{ "bmask",     F3F(2, 0x36, 0x019), F3F(~2, ~0x36, ~0x019), "1,2,d", 0, v9b },
+{ "bshuffle",  F3F(2, 0x36, 0x04c), F3F(~2, ~0x36, ~0x04c), "v,B,H", 0, v9b },
+
+{ "siam",      F3F(2, 0x36, 0x081), F3F(~2, ~0x36, ~0x081)|RD_G0|RS1_G0|RS2(~7), "3", 0, v9b },
+
 /* More v9 specific insns, these need to come last so they do not clash
    with v9a instructions such as "edge8" which looks like impdep1. */
 
@@ -1976,6 +2000,7 @@
   { 2, "#n_writes" },
   { 3, "#one_write" },
   { 4, "#page" },
+  { 16, "#invalidate" },
   { 0, 0 }
 };
 
diff --git a/opcodes/tic30-dis.c b/opcodes/tic30-dis.c
index 5ccf893..77be735 100644
--- a/opcodes/tic30-dis.c
+++ b/opcodes/tic30-dis.c
@@ -1,5 +1,5 @@
 /* Disassembly routines for TMS320C30 architecture
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
 
    This program is free software; you can redistribute it and/or modify
@@ -27,10 +27,10 @@
 #define PARALLEL_INSN 2
 
 /* Gets the type of instruction based on the top 2 or 3 bits of the
-   instruction word. */
+   instruction word.  */
 #define GET_TYPE(insn) (insn & 0x80000000 ? insn & 0xC0000000 : insn & 0xE0000000)
 
-/* Instruction types. */
+/* Instruction types.  */
 #define TWO_OPERAND_1 0x00000000
 #define TWO_OPERAND_2 0x40000000
 #define THREE_OPERAND 0x20000000
@@ -38,14 +38,14 @@
 #define MUL_ADDS      0x80000000
 #define BRANCHES      0x60000000
 
-/* Specific instruction id bits. */
+/* Specific instruction id bits.  */
 #define NORMAL_IDEN    0x1F800000
 #define PAR_STORE_IDEN 0x3E000000
 #define MUL_ADD_IDEN   0x2C000000
 #define BR_IMM_IDEN    0x1F000000
 #define BR_COND_IDEN   0x1C3F0000
 
-/* Addressing modes. */
+/* Addressing modes.  */
 #define AM_REGISTER 0x00000000
 #define AM_DIRECT   0x00200000
 #define AM_INDIRECT 0x00400000
@@ -56,15 +56,15 @@
 #define REG_AR0 0x08
 #define LDP_INSN 0x08700000
 
-/* TMS320C30 program counter for current instruction. */
+/* TMS320C30 program counter for current instruction.  */
 static unsigned int _pc;
 
 struct instruction
-  {
-    int type;
-    template *tm;
-    partemplate *ptm;
-  };
+{
+  int type;
+  template *tm;
+  partemplate *ptm;
+};
 
 int get_tic30_instruction PARAMS ((unsigned long, struct instruction *));
 int print_two_operand
@@ -85,15 +85,14 @@
      disassemble_info *info;
 {
   unsigned long insn_word;
-  struct instruction insn =
-  {0, NULL, NULL};
+  struct instruction insn = { 0, NULL, NULL };
   bfd_vma bufaddr = pc - info->buffer_vma;
-  /* Obtain the current instruction word from the buffer. */
+  /* Obtain the current instruction word from the buffer.  */
   insn_word = (*(info->buffer + bufaddr) << 24) | (*(info->buffer + bufaddr + 1) << 16) |
     (*(info->buffer + bufaddr + 2) << 8) | *(info->buffer + bufaddr + 3);
   _pc = pc / 4;
   /* Get the instruction refered to by the current instruction word
-     and print it out based on its type. */
+     and print it out based on its type.  */
   if (!get_tic30_instruction (insn_word, &insn))
     return -1;
   switch (GET_TYPE (insn_word))
@@ -249,7 +248,7 @@
   if (insn->tm->opcode_modifier == AddressMode)
     {
       int src_op, dest_op;
-      /* Determine whether instruction is a store or a normal instruction. */
+      /* Determine whether instruction is a store or a normal instruction.  */
       if ((insn->tm->operand_types[1] & (Direct | Indirect)) == (Direct | Indirect))
 	{
 	  src_op = 1;
@@ -260,14 +259,14 @@
 	  src_op = 0;
 	  dest_op = 1;
 	}
-      /* Get the destination register. */
+      /* Get the destination register.  */
       if (insn->tm->operands == 2)
 	get_register_operand ((insn_word & 0x001F0000) >> 16, operand[dest_op]);
-      /* Get the source operand based on addressing mode. */
+      /* Get the source operand based on addressing mode.  */
       switch (insn_word & AddressMode)
 	{
 	case AM_REGISTER:
-	  /* Check for the NOP instruction before getting the operand. */
+	  /* Check for the NOP instruction before getting the operand.  */
 	  if ((insn->tm->operand_types[0] & NotReq) == 0)
 	    get_register_operand ((insn_word & 0x0000001F), operand[src_op]);
 	  break;
@@ -278,7 +277,7 @@
 	  get_indirect_operand ((insn_word & 0x0000FFFF), 2, operand[src_op]);
 	  break;
 	case AM_IMM:
-	  /* Get the value of the immediate operand based on variable type. */
+	  /* Get the value of the immediate operand based on variable type.  */
 	  switch (insn->tm->imm_arg_type)
 	    {
 	    case Imm_Float:
@@ -294,7 +293,7 @@
 	    default:
 	      return 0;
 	    }
-	  /* Handle special case for LDP instruction. */
+	  /* Handle special case for LDP instruction.  */
 	  if ((insn_word & 0xFFFFFF00) == LDP_INSN)
 	    {
 	      strcpy (name, "ldp");
@@ -303,7 +302,7 @@
 	    }
 	}
     }
-  /* Handle case for stack and rotate instructions. */
+  /* Handle case for stack and rotate instructions.  */
   else if (insn->tm->operands == 1)
     {
       if (insn->tm->opcode_modifier == StackOp)
@@ -311,7 +310,7 @@
 	  get_register_operand ((insn_word & 0x001F0000) >> 16, operand[0]);
 	}
     }
-  /* Output instruction to stream. */
+  /* Output instruction to stream.  */
   info->fprintf_func (info->stream, "   %s %s%c%s", name,
 		      operand[0][0] ? operand[0] : "",
 		      operand[1][0] ? ',' : ' ',
@@ -385,7 +384,7 @@
   if (insn->ptm == NULL)
     return 0;
   /* Parse out the names of each of the parallel instructions from the
-     q_insn1_insn2 format. */
+     q_insn1_insn2 format.  */
   name1 = (char *) strdup (insn->ptm->name + 2);
   name2 = "";
   len = strlen (name1);
@@ -398,7 +397,7 @@
 	  break;
 	}
     }
-  /* Get the operands of the instruction based on the operand order. */
+  /* Get the operands of the instruction based on the operand order.  */
   switch (insn->ptm->oporder)
     {
     case OO_4op1:
@@ -500,14 +499,14 @@
 
   if (insn->tm == NULL)
     return 0;
-  /* Get the operands for 24-bit immediate jumps. */
+  /* Get the operands for 24-bit immediate jumps.  */
   if (insn->tm->operand_types[0] & Imm24)
     {
       address = insn_word & 0x00FFFFFF;
       sprintf (operand[0], "0x%lX", address);
       print_label = 1;
     }
-  /* Get the operand for the trap instruction. */
+  /* Get the operand for the trap instruction.  */
   else if (insn->tm->operand_types[0] & IVector)
     {
       address = insn_word & 0x0000001F;
@@ -516,7 +515,7 @@
   else
     {
       address = insn_word & 0x0000FFFF;
-      /* Get the operands for the DB instructions. */
+      /* Get the operands for the DB instructions.  */
       if (insn->tm->operands == 2)
 	{
 	  get_register_operand (((insn_word & 0x01C00000) >> 22) + REG_AR0, operand[0]);
@@ -528,7 +527,7 @@
 	  else
 	    get_register_operand (insn_word & 0x0000001F, operand[1]);
 	}
-      /* Get the operands for the standard branches. */
+      /* Get the operands for the standard branches.  */
       else if (insn->tm->operands == 1)
 	{
 	  if (insn_word & PCRel)
@@ -545,7 +544,7 @@
 		      operand[0][0] ? operand[0] : "",
 		      operand[1][0] ? ',' : ' ',
 		      operand[1][0] ? operand[1] : "");
-  /* Print destination of branch in relation to current symbol. */
+  /* Print destination of branch in relation to current symbol.  */
   if (print_label && info->symbols)
     {
       asymbol *sym = *info->symbols;
@@ -553,7 +552,7 @@
       if ((insn->tm->opcode_modifier == PCRel) && (insn_word & PCRel))
 	{
 	  address = (_pc + 1 + (short) address) - ((sym->section->vma + sym->value) / 4);
-	  /* Check for delayed instruction, if so adjust destination. */
+	  /* Check for delayed instruction, if so adjust destination.  */
 	  if (insn_word & 0x00200000)
 	    address += 2;
 	}
@@ -583,8 +582,8 @@
 
   if (buffer == NULL)
     return 0;
-  /* Determine which bits identify the sections of the indirect operand based on the
-     size in bytes. */
+  /* Determine which bits identify the sections of the indirect
+     operand based on the size in bytes.  */
   switch (size)
     {
     case 1:
@@ -614,14 +613,15 @@
 	      {
 		size_t i, len;
 		int bufcnt;
-		
+
 		len = strlen (current_ind->syntax);
 		for (i = 0, bufcnt = 0; i < len; i++, bufcnt++)
 		  {
 		    buffer[bufcnt] = current_ind->syntax[i];
 		    if (buffer[bufcnt - 1] == 'a' && buffer[bufcnt] == 'r')
 		      buffer[++bufcnt] = arnum + '0';
-		    if (buffer[bufcnt] == '(' && current_ind->displacement == DISP_REQUIRED)
+		    if (buffer[bufcnt] == '('
+			&& current_ind->displacement == DISP_REQUIRED)
 		      {
 			sprintf (&buffer[bufcnt + 1], "%u", disp);
 			bufcnt += strlen (&buffer[bufcnt + 1]);
diff --git a/opcodes/tic54x-dis.c b/opcodes/tic54x-dis.c
index e2c0b20..bf40d68 100644
--- a/opcodes/tic54x-dis.c
+++ b/opcodes/tic54x-dis.c
@@ -558,7 +558,7 @@
         }
       ++reg;
     }
-  sprintf (buf, "MMR(%d)", mmr); // FIXME -- different targets
+  sprintf (buf, "MMR(%d)", mmr); /* FIXME -- different targets.  */
   return 0;
 }
 
diff --git a/opcodes/tic80-dis.c b/opcodes/tic80-dis.c
index 449ce8f..6c72976 100644
--- a/opcodes/tic80-dis.c
+++ b/opcodes/tic80-dis.c
@@ -1,5 +1,5 @@
 /* Print TI TMS320C80 (MVP) instructions
-   Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
 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
@@ -36,13 +36,12 @@
 				      const struct tic80_opcode *));
 static int fill_instruction PARAMS ((struct disassemble_info *, bfd_vma,
 				     unsigned long *));
-
 
 /* Print an integer operand.  Try to be somewhat smart about the
    format by assuming that small positive or negative integers are
    probably loop increment values, structure offsets, or similar
    values that are more meaningful printed as signed decimal values.
-   Larger numbers are probably better printed as hex values. */
+   Larger numbers are probably better printed as hex values.  */
 
 static void
 print_operand_integer (info, value)
@@ -51,18 +50,17 @@
 {
   if ((value > 9999 || value < -9999))
     {
-      (*info -> fprintf_func) (info -> stream, "%#lx", value);
+      (*info->fprintf_func) (info->stream, "%#lx", value);
     }
   else
     {
-      (*info -> fprintf_func) (info -> stream, "%ld", value);
+      (*info->fprintf_func) (info->stream, "%ld", value);
     }
 }
-
 
 /* FIXME: depends upon sizeof (long) == sizeof (float) and
    also upon host floating point format matching target
-   floating point format. */
+   floating point format.  */
 
 static void
 print_operand_float (info, value)
@@ -72,9 +70,8 @@
   union { float f; long l; } fval;
 
   fval.l = value;
-  (*info -> fprintf_func) (info -> stream, "%g", fval.f);
+  (*info->fprintf_func) (info->stream, "%g", fval.f);
 }
-
 
 static void
 print_operand_control_register (info, value)
@@ -86,14 +83,13 @@
   tmp = tic80_value_to_symbol (value, TIC80_OPERAND_CR);
   if (tmp != NULL)
     {
-      (*info -> fprintf_func) (info -> stream, "%s", tmp);
+      (*info->fprintf_func) (info->stream, "%s", tmp);
     }
   else
     {
-      (*info -> fprintf_func) (info -> stream, "%#lx", value);
+      (*info->fprintf_func) (info->stream, "%#lx", value);
     }
 }
-
 
 static void
 print_operand_condition_code (info, value)
@@ -105,14 +101,13 @@
   tmp = tic80_value_to_symbol (value, TIC80_OPERAND_CC);
   if (tmp != NULL)
     {
-      (*info -> fprintf_func) (info -> stream, "%s", tmp);
+      (*info->fprintf_func) (info->stream, "%s", tmp);
     }
   else
     {
-      (*info -> fprintf_func) (info -> stream, "%ld", value);
+      (*info->fprintf_func) (info->stream, "%ld", value);
     }
 }
-
 
 static void
 print_operand_bitnum (info, value)
@@ -126,20 +121,19 @@
   tmp = tic80_value_to_symbol (bitnum, TIC80_OPERAND_BITNUM);
   if (tmp != NULL)
     {
-      (*info -> fprintf_func) (info -> stream, "%s", tmp);
+      (*info->fprintf_func) (info->stream, "%s", tmp);
     }
   else
     {
-      (*info -> fprintf_func) (info -> stream, "%ld", bitnum);
+      (*info->fprintf_func) (info->stream, "%ld", bitnum);
     }
 }
-
 
 /* Print the operand as directed by the flags.  */
 
-#define M_SI(insn,op) ((((op) -> flags & TIC80_OPERAND_M_SI) != 0) && ((insn) & (1 << 17)))
-#define M_LI(insn,op) ((((op) -> flags & TIC80_OPERAND_M_LI) != 0) && ((insn) & (1 << 15)))
-#define R_SCALED(insn,op) ((((op) -> flags & TIC80_OPERAND_SCALED) != 0) && ((insn) & (1 << 11)))
+#define M_SI(insn,op) ((((op)->flags & TIC80_OPERAND_M_SI) != 0) && ((insn) & (1 << 17)))
+#define M_LI(insn,op) ((((op)->flags & TIC80_OPERAND_M_LI) != 0) && ((insn) & (1 << 15)))
+#define R_SCALED(insn,op) ((((op)->flags & TIC80_OPERAND_SCALED) != 0) && ((insn) & (1 << 11)))
 
 static void
 print_operand (info, value, insn, operand, memaddr)
@@ -149,61 +143,60 @@
      const struct tic80_operand *operand;
      bfd_vma memaddr;
 {
-  if ((operand -> flags & TIC80_OPERAND_GPR) != 0)
+  if ((operand->flags & TIC80_OPERAND_GPR) != 0)
     {
-      (*info -> fprintf_func) (info -> stream, "r%ld", value);
+      (*info->fprintf_func) (info->stream, "r%ld", value);
       if (M_SI (insn, operand) || M_LI (insn, operand))
 	{
-	  (*info -> fprintf_func) (info -> stream, ":m");
+	  (*info->fprintf_func) (info->stream, ":m");
 	}
     }
-  else if ((operand -> flags & TIC80_OPERAND_FPA) != 0)
+  else if ((operand->flags & TIC80_OPERAND_FPA) != 0)
     {
-      (*info -> fprintf_func) (info -> stream, "a%ld", value);
+      (*info->fprintf_func) (info->stream, "a%ld", value);
     }
-  else if ((operand -> flags & TIC80_OPERAND_PCREL) != 0)
+  else if ((operand->flags & TIC80_OPERAND_PCREL) != 0)
     {
-      (*info -> print_address_func) (memaddr + 4 * value, info);
+      (*info->print_address_func) (memaddr + 4 * value, info);
     }
-  else if ((operand -> flags & TIC80_OPERAND_BASEREL) != 0)
+  else if ((operand->flags & TIC80_OPERAND_BASEREL) != 0)
     {
-      (*info -> print_address_func) (value, info);
+      (*info->print_address_func) (value, info);
     }
-  else if ((operand -> flags & TIC80_OPERAND_BITNUM) != 0)
+  else if ((operand->flags & TIC80_OPERAND_BITNUM) != 0)
     {
       print_operand_bitnum (info, value);
     }
-  else if ((operand -> flags & TIC80_OPERAND_CC) != 0)
+  else if ((operand->flags & TIC80_OPERAND_CC) != 0)
     {
       print_operand_condition_code (info, value);
     }
-  else if ((operand -> flags & TIC80_OPERAND_CR) != 0)
+  else if ((operand->flags & TIC80_OPERAND_CR) != 0)
     {
       print_operand_control_register (info, value);
     }
-  else if ((operand -> flags & TIC80_OPERAND_FLOAT) != 0)
+  else if ((operand->flags & TIC80_OPERAND_FLOAT) != 0)
     {
       print_operand_float (info, value);
     }
-  else if ((operand -> flags & TIC80_OPERAND_BITFIELD))
+  else if ((operand->flags & TIC80_OPERAND_BITFIELD))
     {
-      (*info -> fprintf_func) (info -> stream, "%#lx", value);
+      (*info->fprintf_func) (info->stream, "%#lx", value);
     }
   else
     {
       print_operand_integer (info, value);
     }
 
-  /* If this is a scaled operand, then print the modifier */
+  /* If this is a scaled operand, then print the modifier.  */
 
   if (R_SCALED (insn, operand))
     {
-      (*info -> fprintf_func) (info -> stream, ":s");
+      (*info->fprintf_func) (info->stream, ":s");
     }
 }
-
 
-/* We have chosen an opcode table entry */
+/* We have chosen an opcode table entry.  */
 
 static int
 print_one_instruction (info, memaddr, insn, opcode)
@@ -218,18 +211,18 @@
   const unsigned char *opindex;
   int close_paren;
 
-  (*info -> fprintf_func) (info -> stream, "%-10s", opcode -> name);
+  (*info->fprintf_func) (info->stream, "%-10s", opcode->name);
 
-  for (opindex = opcode -> operands; *opindex != 0; opindex++)
+  for (opindex = opcode->operands; *opindex != 0; opindex++)
     {
       operand = tic80_operands + *opindex;
 
       /* Extract the value from the instruction.  */
-      if (operand -> extract)
+      if (operand->extract)
 	{
-	  value = (*operand -> extract) (insn, (int *) NULL);
+	  value = (*operand->extract) (insn, (int *) NULL);
 	}
-      else if (operand -> bits == 32)
+      else if (operand->bits == 32)
 	{
 	  status = fill_instruction (info, memaddr, (unsigned long *) &value);
 	  if (status == -1)
@@ -239,52 +232,50 @@
 	}
       else
 	{
-	  value = (insn >> operand -> shift) & ((1 << operand -> bits) - 1);
-	  if ((operand -> flags & TIC80_OPERAND_SIGNED) != 0
-	      && (value & (1 << (operand -> bits - 1))) != 0)
+	  value = (insn >> operand->shift) & ((1 << operand->bits) - 1);
+	  if ((operand->flags & TIC80_OPERAND_SIGNED) != 0
+	      && (value & (1 << (operand->bits - 1))) != 0)
 	    {
-	      value -= 1 << operand -> bits;
+	      value -= 1 << operand->bits;
 	    }
 	}
 
       /* If this operand is enclosed in parenthesis, then print
 	 the open paren, otherwise just print the regular comma
-	 separator, except for the first operand. */
+	 separator, except for the first operand.  */
 
-      if ((operand -> flags & TIC80_OPERAND_PARENS) == 0)
+      if ((operand->flags & TIC80_OPERAND_PARENS) == 0)
 	{
 	  close_paren = 0;
-	  if (opindex != opcode -> operands)
+	  if (opindex != opcode->operands)
 	    {
-	      (*info -> fprintf_func) (info -> stream, ",");
+	      (*info->fprintf_func) (info->stream, ",");
 	    }
 	}
       else
 	{
 	  close_paren = 1;
-	  (*info -> fprintf_func) (info -> stream, "(");
+	  (*info->fprintf_func) (info->stream, "(");
 	}
 
       print_operand (info, value, insn, operand, memaddr);
 
       /* If we printed an open paren before printing this operand, close
-	 it now. The flag gets reset on each loop. */
+	 it now. The flag gets reset on each loop.  */
 
       if (close_paren)
 	{
-	  (*info -> fprintf_func) (info -> stream, ")");
+	  (*info->fprintf_func) (info->stream, ")");
 	}
     }
   return (length);
 }
-
 
-
 /* There are no specific bits that tell us for certain whether a vector
    instruction opcode contains one or two instructions.  However since
    a destination register of r0 is illegal, we can check for nonzero
    values in both destination register fields.  Only opcodes that have
-   two valid instructions will have non-zero in both */
+   two valid instructions will have non-zero in both.  */
 
 #define TWO_INSN(insn) ((((insn) & (0x1F << 27)) != 0) && (((insn) & (0x1F << 22)) != 0))
 
@@ -302,12 +293,12 @@
      opcodes (vec_opcode != NULL) find the first match that is not the
      previously found match.  FIXME: there should be faster ways to
      search (hash table or binary search), but don't worry too much
-     about it until other TIc80 support is finished. */
+     about it until other TIc80 support is finished.  */
 
   opcode_end = tic80_opcodes + tic80_num_opcodes;
   for (opcode = tic80_opcodes; opcode < opcode_end; opcode++)
     {
-      if ((insn & opcode -> mask) == opcode -> opcode &&
+      if ((insn & opcode->mask) == opcode->opcode &&
 	  opcode != vec_opcode)
 	{
 	  break;
@@ -316,19 +307,19 @@
 
   if (opcode == opcode_end)
     {
-      /* No match found, just print the bits as a .word directive */
-      (*info -> fprintf_func) (info -> stream, ".word %#08lx", insn);
+      /* No match found, just print the bits as a .word directive.  */
+      (*info->fprintf_func) (info->stream, ".word %#08lx", insn);
     }
   else
     {
       /* Match found, decode the instruction.  */
       length = print_one_instruction (info, memaddr, insn, opcode);
-      if (opcode -> flags & TIC80_VECTOR && vec_opcode == NULL && TWO_INSN (insn))
+      if (opcode->flags & TIC80_VECTOR && vec_opcode == NULL && TWO_INSN (insn))
 	{
 	  /* There is another instruction to print from the same opcode.
 	     Print the separator and then find and print the other
-	     instruction. */
-	  (*info -> fprintf_func) (info -> stream, "   ||   ");
+	     instruction.  */
+	  (*info->fprintf_func) (info->stream, "   ||   ");
 	  length = print_instruction (info, memaddr, insn, opcode);
 	}
     }
@@ -337,7 +328,7 @@
 
 /* Get the next 32 bit word from the instruction stream and convert it
    into internal format in the unsigned long INSN, for which we are
-   passed the address.  Return 0 on success, -1 on error. */
+   passed the address.  Return 0 on success, -1 on error.  */
 
 static int
 fill_instruction (info, memaddr, insnp)
@@ -348,37 +339,36 @@
   bfd_byte buffer[4];
   int status;
 
-  /* Get the bits for the next 32 bit word and put in buffer */
+  /* Get the bits for the next 32 bit word and put in buffer.  */
 
-  status = (*info -> read_memory_func) (memaddr + length, buffer, 4, info);
+  status = (*info->read_memory_func) (memaddr + length, buffer, 4, info);
   if (status != 0)
     {
-      (*info -> memory_error_func) (status, memaddr, info);
+      (*info->memory_error_func) (status, memaddr, info);
       return (-1);
     }
 
   /* Read was successful, so increment count of bytes read and convert
-     the bits into internal format. */
-     
+     the bits into internal format.  */
+
   length += 4;
-  if (info -> endian == BFD_ENDIAN_LITTLE)
+  if (info->endian == BFD_ENDIAN_LITTLE)
     {
       *insnp = bfd_getl32 (buffer);
     }
-  else if (info -> endian == BFD_ENDIAN_BIG)
+  else if (info->endian == BFD_ENDIAN_BIG)
     {
       *insnp = bfd_getb32 (buffer);
     }
   else
     {
-      /* FIXME: Should probably just default to one or the other */
+      /* FIXME: Should probably just default to one or the other.  */
       abort ();
     }
   return (0);
 }
-
 
-int 
+int
 print_insn_tic80 (memaddr, info)
      bfd_vma memaddr;
      struct disassemble_info *info;
diff --git a/opcodes/w65-dis.c b/opcodes/w65-dis.c
index 309bd5a..c9771d5 100644
--- a/opcodes/w65-dis.c
+++ b/opcodes/w65-dis.c
@@ -1,5 +1,5 @@
 /* Disassemble WDC 65816 instructions.
-   Copyright (C) 1995, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1998, 2000 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
@@ -23,13 +23,14 @@
 #include "w65-opc.h"
 #include "dis-asm.h"
 
-static   fprintf_ftype fpr;
-static   void *stream;
-static   struct disassemble_info *local_info;
+static fprintf_ftype fpr;
+static void *stream;
+static struct disassemble_info *local_info;
 #if 0
-static char *lname[] =  {"r0","r1","r2","r3","r4","r5","r6","r7","s0"};
+static char *lname[] = { "r0","r1","r2","r3","r4","r5","r6","r7","s0" };
 
-static char *findname (val)
+static char *
+findname (val)
      unsigned int val;
 {
   if (val >= 0x10 && val <= 0x20)
@@ -41,79 +42,77 @@
 print_operand (lookup, format, args)
      int lookup;
      char *format;
-     unsigned     int *args;
+     unsigned int *args;
 {
   int val;
   int c;
 
   while (*format)
     {
-      switch ( c = *format++) 
+      switch (c = *format++)
 	{
 	case '$':
 	  val = args[(*format++) - '0'];
-	  if (lookup) 
+	  if (lookup)
 	    {
 #if 0
-	      name = findname(val);
+	      name = findname (val);
 	      if (name)
-		fpr(stream, "%s", name);
+		fpr (stream, "%s", name);
 	      else
 #endif
-		local_info->print_address_func (val, local_info);  
+		local_info->print_address_func (val, local_info);
 	    }
 	  else
 	    fpr (stream, "0x%x", val);
 
 	  break;
 	default:
-	  fpr(stream,"%c", c);
+	  fpr (stream, "%c", c);
 	  break;
 	}
     }
 }
-int 
-print_insn_w65(memaddr, info)
+
+int
+print_insn_w65 (memaddr, info)
      bfd_vma memaddr;
      struct disassemble_info *info;
 {
-
-
   int status = 0;
   unsigned char insn[4];
   register struct opinfo *op;
   int i;
-  int X =0;
+  int X = 0;
   int M = 0;
   int args[2];
-stream = info->stream;
+  stream = info->stream;
   fpr = info->fprintf_func;
-local_info =    info;
-  for (i = 0; i <4 && status == 0; i++) 
+  local_info = info;
+  for (i = 0; i < 4 && status == 0; i++)
     {
-    status = info->read_memory_func(memaddr+i, insn + i, 1, info);
-  }
+      status = info->read_memory_func (memaddr + i, insn + i, 1, info);
+    }
 
-
-  for (op = optable; op->val != insn[0]; op++) 
+  for (op = optable; op->val != insn[0]; op++)
     ;
 
-  fpr(stream,"%s", op->name);
-  
-  /* Prepare all the posible operand values */
+  fpr (stream, "%s", op->name);
+
+  /* Prepare all the posible operand values.  */
   {
     int size = 1;
     int asR_W65_ABS8 = insn[1];
     int asR_W65_ABS16 = (insn[2] << 8) + asR_W65_ABS8;
     int asR_W65_ABS24 = (insn[3] << 16) + asR_W65_ABS16;
-    int asR_W65_PCR8 = ((char)(asR_W65_ABS8)) + memaddr + 2;
-    int asR_W65_PCR16 = ((short)(asR_W65_ABS16)) + memaddr + 3;
+    int asR_W65_PCR8 = ((char) (asR_W65_ABS8)) + memaddr + 2;
+    int asR_W65_PCR16 = ((short) (asR_W65_ABS16)) + memaddr + 3;
 
-    switch (op->amode) {
-      DISASM();
-    }
+    switch (op->amode)
+      {
+	DISASM ();
+      }
 
-  return size;
+    return size;
   }
-
 }
diff --git a/opcodes/z8k-dis.c b/opcodes/z8k-dis.c
index 590f9d3..9621b3e 100644
--- a/opcodes/z8k-dis.c
+++ b/opcodes/z8k-dis.c
@@ -1,5 +1,6 @@
 /* Disassemble z8000 code.
-   Copyright 1992, 1993, 1995, 1998 Free Software Foundation, Inc.
+   Copyright 1992, 1993, 1995, 1998, 2000
+   Free Software Foundation, Inc.
 
 This file is part of GNU Binutils.
 
@@ -22,10 +23,8 @@
 
 #define DEFINE_TABLE
 #include "z8k-opc.h"
-
 
 #include <setjmp.h>
-
 
 typedef struct
 {
@@ -67,7 +66,7 @@
 {
   unsigned char mybuf[20];
   int status;
-  instr_data_s *priv = (instr_data_s *)info->private_data;
+  instr_data_s *priv = (instr_data_s *) info->private_data;
 
   if ((nibble % 4) != 0)
     abort ();
@@ -84,15 +83,15 @@
 
   {
     int i;
-    unsigned char *p = mybuf ;
-    
+    unsigned char *p = mybuf;
+
     for (i = 0; i < nibble;)
       {
 	priv->words[i] = (p[0] << 8) | p[1];
-	
+
 	priv->bytes[i] = *p;
 	priv->nibbles[i++] = *p >> 4;
-	priv->nibbles[i++] = *p &0xf;
+	priv->nibbles[i++] = *p & 0xf;
 
 	++p;
 	priv->bytes[i] = *p;
@@ -126,7 +125,7 @@
   "nc/uge"
 };
 
-int z8k_lookup_instr PARAMS ((unsigned char*, disassemble_info *));
+int z8k_lookup_instr PARAMS ((unsigned char *, disassemble_info *));
 static void output_instr
   PARAMS ((instr_data_s *, unsigned long, disassemble_info *));
 static void unpack_instr PARAMS ((instr_data_s *, int, disassemble_info *));
@@ -196,7 +195,9 @@
   while (!nibl_matched && z8k_table[tabl_index].name)
     {
       nibl_matched = 1;
-      for (nibl_index = 0; nibl_index < z8k_table[tabl_index].length * 2 && nibl_matched; nibl_index++)
+      for (nibl_index = 0;
+	   nibl_index < z8k_table[tabl_index].length * 2 && nibl_matched;
+	   nibl_index++)
 	{
 	  if ((nibl_index % 4) == 0)
 	    /* Fetch one word at a time.  */
@@ -439,7 +440,7 @@
 	  instr_data->interrupts = instr_nibl & 0x3;
 	  break;
 	case CLASS_BIT:
-	  /* do nothing */
+	  /* Do nothing.  */
 	  break;
 	case CLASS_IR:
 	  instr_data->arg_reg[datum_value] = instr_nibl;
diff --git a/readline/CHANGELOG b/readline/CHANGELOG
index 479e6c0..9024bdf 100644
--- a/readline/CHANGELOG
+++ b/readline/CHANGELOG
@@ -214,3 +214,126 @@
 	- set SHELL from @MAKE_SHELL@
 
 [readline-4.0 released]
+
+				   3/11
+				   ----
+doc/Makefile.in
+	- removed references to HTMLTOC, since separate HTML table-of-contents
+	  files are no longer created
+
+examples/Makefile.in
+	- remove `*.exe' in clean target for MS-DOS
+
+Makefile.in
+	- make `readline' target depend on ./libreadline.a
+	- configure now substitutes TERMCAP_LIB into Makefile.in
+	- use ${TERMCAP_LIB} instead of -ltermcap in recipe for `readline'
+	- clean target now removes readline and readline.exe in case they
+	  get built
+
+configure.in
+	- use `pwd.exe' to set BUILD_DIR on MS-DOS DJGPP
+
+				   3/15
+				   ----
+support/shlib-install
+	- Irix 5.x and Irix 6.x should install shared libraries like Solaris 2
+	- changes for installing on hp-ux 1[01].x
+
+				   3/23
+				   ----
+configure.in
+	- make sure that the $CC argument to shobj-conf is quoted
+
+				    4/8
+				    ---
+
+xmalloc.h, rlprivate.h, rlshell.h
+	- new files
+
+Makefile.in,shlib/Makefile.in
+	- add dependencies on xmalloc.h, rlshell.h
+	- add xmalloc.h, rlprivate.h, rlshell.h to list of header files
+
+MANIFEST
+	- add xmalloc.h, rlprivate.h, rlshell.h
+
+				    4/9
+				    ---
+Makefile.in,shlib/Makefile.in
+	- add dependencies on rlprivate.h
+
+				   4/13
+				   ----
+doc/Makefile.in
+	- add variable, PSDVI, which is the desired resolution of the
+	  generated postscript files.  Set to 300 because I don't have
+	  any 600-dpi printers
+	- set LANGUAGE= before calling makeinfo, so messages are in English
+	- add rluserman.{info,dvi,ps,html} to appropriate variables
+	- add rules to create rluserman.{info,dvi,ps,html}
+	- install and uninstall rluserman.info, but don't update the directory
+	  file in $(infodir) yet
+
+MANIFEST
+	- add doc/rluserman.{texinfo,info,dvi,ps,html}
+
+				   4/30
+				   ----
+configure.in
+	- updated library version to 4.1
+
+				    5/3
+				    ---
+configure.in
+	- SHLIB_MAJOR and SHLIB_MINOR shared library version numbers are
+	  constructed from $LIBRARY_VERSION and substituted into Makefiles
+
+				    5/5
+				    ---
+support/shlib-install
+	- OSF/1 installs shared libraries like Solaris
+
+Makefile.in
+	- broke the header file install and uninstall into two new targets:
+	  install-headers and uninstall-headers
+	- install and uninstall depend on install-headers and uninstall-headers
+	  respectively
+	- changed install-shared and uninstall-shared targets to depend on
+	  install-headers and uninstall-headers, respectively, so users may
+	  choose to install only the shared libraries.  I'm not sure about
+	  the uninstall one yet -- maybe it should check whether or not
+	  the static libraries are installed and not remove the header files
+	  if they are
+
+				    9/3
+				    ---
+configure.in, config.h.in
+	- added test for memmove (for later use)
+	- changed version to 4.1-beta1
+
+				   9/13
+				   ----
+examples/rlfe.c
+	- Per Bothner's `rlfe' readline front-end program
+
+examples/Makefile.in
+	- added rules to build rlfe
+
+				   9/21
+				   ----
+support/shlib-install
+	- changes to handle FreeBSD-3.x elf or a.out shared libraries, which
+	  have different semantics and need different naming conventions
+
+				 1/24/2000
+				 ---------
+doc/Makefile.in
+	- remove *.bt and *.bts on `make clean'
+
+				    2/4
+				    ---
+
+
+configure.in
+	- changed LIBVERSION to 4.1-beta5
diff --git a/readline/CHANGES b/readline/CHANGES
index 65339c2..d2929ab 100644
--- a/readline/CHANGES
+++ b/readline/CHANGES
@@ -1,3 +1,111 @@
+This document details the changes between this version, readline-4.1,
+and the previous version, readline-4.0.
+
+1.  Changes to Readline
+
+a.  Changed the HTML documents so that the table-of-contents is no longer
+    a separate file.
+
+b.  Changes to the shared object configuration for: Irix 5.x, Irix 6.x,
+    OSF/1.
+
+c.  The shared library major and minor versions are now constructed
+    automatically by configure and substituted into the makefiles.
+
+d.  It's now possible to install the shared libraries separately from the
+    static libraries.
+
+e.  The history library tries to truncate the history file only if it is a
+    regular file.
+
+f.  A bug that caused _rl_dispatch to address negative array indices on
+    systems with signed chars was fixed.
+
+g.  rl-yank-nth-arg now leaves the history position the same as when it was
+    called.
+
+h.  Changes to the completion code to handle MS-DOS drive-letter:pathname
+    filenames.
+
+i.  Completion is now case-insensitive by default on MS-DOS.
+
+j.  Fixes to the history file manipulation code for MS-DOS.
+
+k.  Readline attempts to bind the arrow keys to appropriate defaults on MS-DOS.
+
+l.  Some fixes were made to the redisplay code for better operation on MS-DOS.
+
+m.  The quoted-insert code will now insert tty special chars like ^C.
+
+n.  A bug was fixed that caused the display code to reference memory before
+    the start of the prompt string.
+
+o.  More support for __EMX__ (OS/2).
+
+p.  A bug was fixed in readline's signal handling that could cause infinite
+    recursion in signal handlers.
+
+q.  A bug was fixed that caused the point to be less than zero when rl_forward
+    was given a very large numeric argument.
+
+r.  The vi-mode code now gets characters via the application-settable value
+    of rl_getc_function rather than calling rl_getc directly.
+
+s.  The history file code now uses O_BINARY mode when reading and writing
+    the history file on cygwin32.
+
+t.  Fixed a bug in the redisplay code for lines with more than 256 line
+    breaks.
+
+u.  A bug was fixed which caused invisible character markers to not be
+    stripped from the prompt string if the terminal was in no-echo mode.
+    
+v.  Readline no longer tries to get the variables it needs for redisplay 
+    from the termcap entry if the calling application has specified its
+    own redisplay function.  Readline treats the terminal as `dumb' in
+    this case.
+
+w.  Fixes to the SIGWINCH code so that a multiple-line prompt with escape
+    sequences is redrawn correctly.
+
+x.  Changes to the install and install-shared targets so that the libraries
+    and header files are installed separately.
+
+2.  New Features in Readline
+
+a.  A new Readline `user manual' is in doc/rluserman.texinfo.
+
+b.  Parentheses matching is now always compiled into readline, and enabled
+    or disabled when the value of the `blink-matching-paren' variable is
+    changed.
+
+c.  MS-DOS systems now use ~/_inputrc as the last-ditch inputrc filename.
+
+d.  MS-DOS systems now use ~/_history as the default history file.
+
+e.  history-search-{forward,backward} now leave the point at the end of the
+    line when the string to search for is empty, like
+    {reverse,forward}-search-history.
+
+f.  history-search-{forward,backward} now leave the last history line found
+    in the readline buffer if the second or subsequent search fails.
+
+g.  New function for use by applications:  rl_on_new_line_with_prompt, used
+    when an application displays the prompt itself before calling readline().
+
+h.  New variable for use by applications:  rl_already_prompted.  An application
+    that displays the prompt itself before calling readline() must set this to
+    a non-zero value.
+
+i.  A new variable, rl_gnu_readline_p, always 1.  The intent is that an
+    application can verify whether or not it is linked with the `real'
+    readline library or some substitute.
+
+j.  Per Bothner's `rlfe' (pronounced `Ralphie') readline front-end program
+    is included in the examples subdirectory, though it is not built
+    by default.
+
+-------------------------------------------------------------------------------
 This document details the changes between this version, readline-4.0,
 and the previous version, readline-2.2.
 
diff --git a/readline/COPYING b/readline/COPYING
index a43ea21..1bf1526 100644
--- a/readline/COPYING
+++ b/readline/COPYING
@@ -2,7 +2,7 @@
 		       Version 2, June 1991
 
  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-                          675 Mass Ave, Cambridge, MA 02139, USA
+                          59 Temple Place, Suite 330, Boston, MA 02111 USA
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
@@ -305,7 +305,7 @@
 
     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., 675 Mass Ave, Cambridge, MA 02139, USA.
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
 Also add information on how to contact you by electronic and paper mail.
 
diff --git a/readline/ChangeLog.Cygnus b/readline/ChangeLog.Cygnus
index bc53a32..4556c2a 100644
--- a/readline/ChangeLog.Cygnus
+++ b/readline/ChangeLog.Cygnus
@@ -1,3 +1,34 @@
+2000-07-10  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* terminal.c (_rl_get_screen_size) [__DJGPP__]: Determine screen
+	size via DJGPP-specific calls.
+	(_rl_init_terminal_io) [__MSDOS__]: DJGPP-specific terminal
+	initialization.
+	(_rl_backspace) [__MSDOS__]: Don't call tputs.
+	(ding) [__MSDOS__]: Use DJGPP-specific calls to support visible
+	bell.
+
+	* display.c (_rl_move_vert) [__MSDOS__]: Support cursor movement
+	upwards with DJGPP-specific calls.
+	(_rl_clear_to_eol) [__MSDOS__]: Don't call tputs.
+	(_rl_clear_screen) [__MSDOS__]: Support clear-screen with
+	DJGPP-specific calls.
+	(insert_some_chars) [__MSDOS__]: Don't call tputs.
+	(delete_chars) [__MSDOS__]: Don't call tputs.
+
+2000-07-09  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+        * Import of readline 4.1.
+
+        Locally modified files: Makefile.in, configure.in, configure
+        (regenerated), config.h.in (regenerated), readline.h, rltty.c,
+ 	shell.c signals.c.
+
+        Locally added files: acconfig.h, config/*, config.h.bot,
+        cross-build/*, doc/inc-hit.texinfo.
+
+        New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
+
 2000-03-16  Eli Zaretskii  <eliz@is.elta.co.il>
 
 	* support/shobj-conf: Shared libs are unsupported on MSDOS.
diff --git a/readline/MANIFEST b/readline/MANIFEST
index f23ff41..a51ca05 100644
--- a/readline/MANIFEST
+++ b/readline/MANIFEST
@@ -11,8 +11,8 @@
 INSTALL		f
 CHANGELOG	f
 CHANGES		f
+USAGE		f
 aclocal.m4	f
-acconfig.h	f
 config.h.in	f
 configure	f
 configure.in	f
@@ -28,11 +28,14 @@
 readline.h	f
 rlconf.h	f
 rldefs.h	f
+rlprivate.h	f
+rlshell.h	f
 rlstdc.h	f
 rltty.h		f
 rlwinsize.h	f
 tcap.h		f
 tilde.h		f
+xmalloc.h	f
 bind.c		f
 complete.c	f
 display.c	f
@@ -77,6 +80,7 @@
 doc/rlman.texinfo	f
 doc/rltech.texinfo	f
 doc/rluser.texinfo	f
+doc/rluserman.texinfo	f
 doc/hist.texinfo	f
 doc/hstech.texinfo	f
 doc/hsuser.texinfo	f
@@ -84,8 +88,10 @@
 doc/texi2dvi		f
 doc/texi2html		f
 examples/Makefile.in	f
+examples/excallback.c	f
 examples/fileman.c	f
 examples/manexamp.c	f
+examples/rlfe.c		f
 examples/rltest.c	f
 examples/rl.c		f
 examples/rlversion.c	f
@@ -94,10 +100,14 @@
 # formatted documentation, from MANIFEST.doc
 doc/readline.ps		f
 doc/history.ps		f
+doc/rluserman.ps	f
 doc/readline.dvi	f
 doc/history.dvi		f
+doc/rluserman.dvi	f
 doc/readline.info	f
 doc/history.info	f
+doc/rluserman.info	f
 doc/readline.html	f
 doc/history.html	f
+doc/rluserman.html	f
 doc/readline.0		f
diff --git a/readline/Makefile.in b/readline/Makefile.in
index 5c667ed..3069ff7 100644
--- a/readline/Makefile.in
+++ b/readline/Makefile.in
@@ -14,7 +14,7 @@
 
 # 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
 RL_LIBRARY_VERSION = @LIBVERSION@
 RL_LIBRARY_NAME = readline
 
@@ -60,6 +60,8 @@
 DEFS = @DEFS@
 LOCAL_DEFS = @LOCAL_DEFS@
 
+TERMCAP_LIB = @TERMCAP_LIB@
+
 # For libraries which include headers from other libraries.
 INCLUDES = -I. -I$(srcdir) -I$(includedir)
 
@@ -88,7 +90,7 @@
 # The header files for this library.
 HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
 	   posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \
-	   ansi_stdlib.h tcap.h rlstdc.h
+	   ansi_stdlib.h tcap.h rlstdc.h xmalloc.h rlprivate.h rlshell.h
 
 HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o 
 TILDEOBJ = tilde.o
@@ -115,6 +117,8 @@
 
 all: static
 
+everything: static shared examples
+
 static: $(STATIC_LIBS)
 
 libreadline.a: $(OBJECTS)
@@ -127,8 +131,8 @@
 	$(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o
 	-test -n "$(RANLIB)" && $(RANLIB) $@
 
-readline: $(OBJECTS) readline.h rldefs.h chardefs.h
-	$(CC) $(CCFLAGS) -o $@ ./examples/rl.c ./libreadline.a -ltermcap
+readline: $(OBJECTS) readline.h rldefs.h chardefs.h ./libreadline.a
+	$(CC) $(CCFLAGS) -o $@ ./examples/rl.c ./libreadline.a ${TERMCAP_LIB}
 
 Makefile makefile: config.status $(srcdir)/Makefile.in
 	CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
@@ -147,9 +151,8 @@
 	CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status
 	echo > $@
 
-# CYGNUS LOCAL: Never run autoconf.
-#$(srcdir)/configure: $(srcdir)/configure.in	 Comment-me-out in distribution
-#	cd $(srcdir) && autoconf	 Comment-me-out in distribution
+#$(srcdir)/configure: $(srcdir)/configure.in	## Comment-me-out in distribution
+#	cd $(srcdir) && autoconf	## Comment-me-out in distribution
 
 shared:	force
 	-test -d shlib || mkdir shlib
@@ -165,6 +168,17 @@
 
 force:
 
+install-headers: installdirs ${INSTALLED_HEADERS}
+	for f in ${INSTALLED_HEADERS}; do \
+		$(INSTALL_DATA) $(srcdir)/$$f $(includedir)/readline ; \
+	done
+
+uninstall-headers:
+	-test -n "$(includedir)" && cd $(includedir)/readline && \
+		${RM} ${INSTALLED_HEADERS}
+
+maybe-uninstall-headers: uninstall-headers
+
 ## CYGNUS LOCAL
 ## Don't mess with people's installed readline's.
 ## This tries to install this version of readline over whatever
@@ -175,14 +189,11 @@
 
 install:
 
-#install: installdirs $(STATIC_LIBS)
-#	for f in ${INSTALLED_HEADERS}; do \
-#		$(INSTALL_DATA) $(srcdir)/$$f $(includedir)/readline ; \
-#	done
-#	-( if test -f $(libdir)/libreadline.a ; then $(MV) $(libdir)/libreadline.a $(libdir)/libreadline.old; fi )
+#install: installdirs $(STATIC_LIBS) install-headers
+#	-$(MV) $(libdir)/libreadline.a $(libdir)/libreadline.old
 #	$(INSTALL_DATA) libreadline.a $(libdir)/libreadline.a
 #	-test -n "$(RANLIB)" && $(RANLIB) -t $(libdir)/libreadline.a
-#	-( if test -f $(libdir)/libhistory.a; then $(MV) $(libdir)/libhistory.a $(libdir)/libhistory.old; fi )
+#	-$(MV) $(libdir)/libhistory.a $(libdir)/libhistory.old
 #	$(INSTALL_DATA) libhistory.a $(libdir)/libhistory.a
 #	-test -n "$(RANLIB)" && $(RANLIB) -t $(libdir)/libhistory.a
 #	-( if test -d doc ; then \
@@ -194,16 +205,14 @@
 	-$(SHELL) $(srcdir)/support/mkdirs $(includedir) \
 		$(includedir)/readline $(libdir) $(infodir) $(man3dir)
 
-uninstall:
-	-test -n "$(includedir)" && cd $(includedir)/readline && \
-		${RM} ${INSTALLED_HEADERS}
+uninstall: uninstall-headers
 	-test -n "$(libdir)" && cd $(libdir) && \
 		${RM} libreadline.a libreadline.old libhistory.a libhistory.old $(SHARED_LIBS)
 
-install-shared: installdirs shared
+install-shared: installdirs install-headers shared
 	-( cd shlib ; ${MAKE} ${MFLAGS} install )
 
-uninstall-shared:
+uninstall-shared: maybe-uninstall-headers
 	-( cd shlib; ${MAKE} ${MFLAGS} uninstall )
 
 TAGS:	force
@@ -214,6 +223,7 @@
 
 clean:	force
 	$(RM) $(OBJECTS) $(STATIC_LIBS)
+	$(RM) readline readline.exe
 	-( cd shlib && $(MAKE) $(MFLAGS) $@ )
 	-( cd doc && $(MAKE) $(MFLAGS) $@ )
 	-( cd examples && $(MAKE) $(MFLAGS) $@ )
@@ -241,7 +251,7 @@
 dist:   force
 	@echo Readline distributions are created using $(srcdir)/support/mkdist.
 	@echo Here is a sample of the necessary commands:
-	@echo bash $(srcdir)/support/mkdist -m $(srcdir)/MANIFEST -s $(srcdir) -r $(RL_LIBRARY_NAME)-$(RL_LIBRARY_VERSION)
+	@echo bash $(srcdir)/support/mkdist -m $(srcdir)/MANIFEST -s $(srcdir) -r $(RL_LIBRARY_NAME) $(RL_LIBRARY_VERSION)
 	@echo tar cf $(RL_LIBRARY_NAME)-${RL_LIBRARY_VERSION}.tar ${RL_LIBRARY_NAME}-$(RL_LIBRARY_VERSION)
 	@echo gzip $(RL_LIBRARY_NAME)-$(RL_LIBRARY_VERSION).tar
 
@@ -300,6 +310,8 @@
 macro.o: history.h rlstdc.h
 nls.o: ansi_stdlib.h
 nls.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+nls.o: readline.h keymaps.h chardefs.h tilde.h  
+nls.o: history.h rlstdc.h  
 parens.o: rlconf.h
 parens.o: ${BUILD_DIR}/config.h
 parens.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h
@@ -338,6 +350,54 @@
 xmalloc.o: ${BUILD_DIR}/config.h
 xmalloc.o: ansi_stdlib.h
 
+bind.o: rlshell.h
+histfile.o: rlshell.h
+nls.o: rlshell.h
+readline.o: rlshell.h
+shell.o: rlshell.h
+terminal.o: rlshell.h
+histexpand.o: rlshell.h
+
+bind.o: rlprivate.h
+callback.o: rlprivate.h
+complete.o: rlprivate.h
+display.o: rlprivate.h
+input.o: rlprivate.h
+isearch.o: rlprivate.h
+kill.o: rlprivate.h
+macro.o: rlprivate.h
+nls.o: rlprivate.h   
+parens.o: rlprivate.h
+readline.o: rlprivate.h
+rltty.o: rlprivate.h 
+search.o: rlprivate.h
+signals.o: rlprivate.h
+terminal.o: rlprivate.h
+undo.o: rlprivate.h
+util.o: rlprivate.h
+vi_mode.o: rlprivate.h
+
+bind.o: xmalloc.h
+complete.o: xmalloc.h
+display.o: xmalloc.h
+funmap.o: xmalloc.h
+histexpand.o: xmalloc.h
+histfile.o: xmalloc.h
+history.o: xmalloc.h
+input.o: xmalloc.h
+isearch.o: xmalloc.h
+keymaps.o: xmalloc.h
+kill.o: xmalloc.h
+macro.o: xmalloc.h
+readline.o: xmalloc.h
+savestring.o: xmalloc.h
+search.o: xmalloc.h
+shell.o: xmalloc.h
+tilde.o: xmalloc.h
+tilde.o: xmalloc.h
+util.o: xmalloc.h
+vi_mode.o: xmalloc.h
+
 readline.o: $(srcdir)/readline.c
 vi_mode.o: $(srcdir)/vi_mode.c
 funmap.o: $(srcdir)/funmap.c
diff --git a/readline/README b/readline/README
index 56565b2..41a5d0c 100644
--- a/readline/README
+++ b/readline/README
@@ -1,7 +1,7 @@
 Introduction
 ============
 
-This is the Gnu Readline library, version 4.0.
+This is the Gnu Readline library, version 4.1.
 
 The Readline library provides a set of functions for use by applications
 that allow users to edit command lines as they are typed in.  Both
diff --git a/readline/USAGE b/readline/USAGE
new file mode 100644
index 0000000..edc9f54
--- /dev/null
+++ b/readline/USAGE
@@ -0,0 +1,37 @@
+From rms@gnu.org Thu Jul 22 20:37:55 1999
+Flags: 10
+Return-Path: rms@gnu.org
+Received: from arthur.INS.CWRU.Edu (root@arthur.INS.CWRU.Edu [129.22.8.215]) by odin.INS.CWRU.Edu with ESMTP (8.8.6+cwru/CWRU-2.4-ins)
+	id UAA25349; Thu, 22 Jul 1999 20:37:54 -0400 (EDT) (from rms@gnu.org for <chet@odin.INS.CWRU.Edu>)
+Received: from nike.ins.cwru.edu (root@nike.INS.CWRU.Edu [129.22.8.219]) by arthur.INS.CWRU.Edu with ESMTP (8.8.8+cwru/CWRU-3.6)
+	id UAA05311; Thu, 22 Jul 1999 20:37:51 -0400 (EDT) (from rms@gnu.org for <chet@po.cwru.edu>)
+Received: from pele.santafe.edu (pele.santafe.edu [192.12.12.119]) by nike.ins.cwru.edu with ESMTP (8.8.7/CWRU-2.5-bsdi)
+	id UAA13350; Thu, 22 Jul 1999 20:37:50 -0400 (EDT) (from rms@gnu.org for <chet@nike.ins.cwru.edu>)
+Received: from wijiji.santafe.edu (wijiji [192.12.12.5])
+	by pele.santafe.edu (8.9.1/8.9.1) with ESMTP id SAA10831
+	for <chet@nike.ins.cwru.edu>; Thu, 22 Jul 1999 18:37:47 -0600 (MDT)
+Received: (from rms@localhost)
+	by wijiji.santafe.edu (8.9.1b+Sun/8.9.1) id SAA01089;
+	Thu, 22 Jul 1999 18:37:46 -0600 (MDT)
+Date: Thu, 22 Jul 1999 18:37:46 -0600 (MDT)
+Message-Id: <199907230037.SAA01089@wijiji.santafe.edu>
+X-Authentication-Warning: wijiji.santafe.edu: rms set sender to rms@gnu.org using -f
+From: Richard Stallman <rms@gnu.org>
+To: chet@nike.ins.cwru.edu
+Subject: Use of Readline
+Reply-to: rms@gnu.org
+
+I think Allbery's suggestion is a good one.  So please add this text
+in a suitable place.  Please don't put it in the GPL itself; that
+should be the same as the GPL everywhere else.  Putting it in the
+README and/or the documentation would be a good idea.
+
+
+======================================================================
+Our position on the use of Readline through a shared-library linking
+mechanism is that there is no legal difference between shared-library
+linking and static linking--either kind of linking combines various
+modules into a single larger work.  The conditions for using Readline
+in a larger work are stated in section 3 of the GNU GPL.
+
+
diff --git a/readline/aclocal.m4 b/readline/aclocal.m4
index c277a0c..f8f5b74 100644
--- a/readline/aclocal.m4
+++ b/readline/aclocal.m4
@@ -316,13 +316,19 @@
 main()
 {
 DIR *dir;
-int fd;
-unlink("/tmp/not_a_directory");
-fd = open("/tmp/not_a_directory", O_WRONLY|O_CREAT, 0666);
+int fd, err;
+err = mkdir("/tmp/bash-aclocal", 0700);
+if (err < 0) {
+  perror("mkdir");
+  exit(1);
+}
+unlink("/tmp/bash-aclocal/not_a_directory");
+fd = open("/tmp/bash-aclocal/not_a_directory", O_WRONLY|O_CREAT|O_EXCL, 0666);
 write(fd, "\n", 1);
 close(fd);
-dir = opendir("/tmp/not_a_directory");
-unlink("/tmp/not_a_directory");
+dir = opendir("/tmp/bash-aclocal/not_a_directory");
+unlink("/tmp/bash-aclocal/not_a_directory");
+rmdir("/tmp/bash-aclocal");
 exit (dir == 0);
 }], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no,
     [AC_MSG_WARN(cannot check opendir if cross compiling -- defaulting to no)
@@ -354,25 +360,59 @@
 fi
 ])
 
-AC_DEFUN(BASH_TYPE_INT32_T,
+dnl
+dnl A signed 16-bit integer quantity
+dnl
+AC_DEFUN(BASH_TYPE_BITS16_T,
 [
-if test "$ac_cv_sizeof_int" = 4; then
-  AC_CHECK_TYPE(int32_t, int)
-elif test "$ac_cv_sizeof_long" = 4; then
-  AC_CHECK_TYPE(int32_t, long)
+if test "$ac_cv_sizeof_short" = 2; then
+  AC_CHECK_TYPE(bits16_t, short)
+elif test "$ac_cv_sizeof_char" = 2; then
+  AC_CHECK_TYPE(bits16_t, char)
 else
-  AC_CHECK_TYPE(int32_t, int)
+  AC_CHECK_TYPE(bits16_t, short)
 fi
 ])
 
-AC_DEFUN(BASH_TYPE_U_INT32_T,
+dnl
+dnl An unsigned 16-bit integer quantity
+dnl
+AC_DEFUN(BASH_TYPE_U_BITS16_T,
+[
+if test "$ac_cv_sizeof_short" = 2; then
+  AC_CHECK_TYPE(u_bits16_t, unsigned short)
+elif test "$ac_cv_sizeof_char" = 2; then
+  AC_CHECK_TYPE(u_bits16_t, unsigned char)
+else
+  AC_CHECK_TYPE(u_bits16_t, unsigned short)
+fi
+])
+
+dnl
+dnl A signed 32-bit integer quantity
+dnl
+AC_DEFUN(BASH_TYPE_BITS32_T,
 [
 if test "$ac_cv_sizeof_int" = 4; then
-  AC_CHECK_TYPE(u_int32_t, unsigned int)
+  AC_CHECK_TYPE(bits32_t, int)
 elif test "$ac_cv_sizeof_long" = 4; then
-  AC_CHECK_TYPE(u_int32_t, unsigned long)
+  AC_CHECK_TYPE(bits32_t, long)
 else
-  AC_CHECK_TYPE(u_int32_t, unsigned int)
+  AC_CHECK_TYPE(bits32_t, int)
+fi
+])
+
+dnl
+dnl An unsigned 32-bit integer quantity
+dnl
+AC_DEFUN(BASH_TYPE_U_BITS32_T,
+[
+if test "$ac_cv_sizeof_int" = 4; then
+  AC_CHECK_TYPE(u_bits32_t, unsigned int)
+elif test "$ac_cv_sizeof_long" = 4; then
+  AC_CHECK_TYPE(u_bits32_t, unsigned long)
+else
+  AC_CHECK_TYPE(u_bits32_t, unsigned int)
 fi
 ])
 
@@ -387,6 +427,9 @@
 fi
 ])
 
+dnl
+dnl A signed 64-bit quantity
+dnl
 AC_DEFUN(BASH_TYPE_BITS64_T,
 [
 if test "$ac_sv_sizeof_char_p" = 8; then
@@ -427,6 +470,20 @@
 fi
 ])
 
+AC_DEFUN(BASH_FUNC_INET_ATON,
+[
+AC_CACHE_CHECK([for inet_aton], bash_cv_func_inet_aton,
+[AC_TRY_LINK([
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+struct in_addr ap;], [ inet_aton("127.0.0.1", &ap); ],
+bash_cv_func_inet_aton=yes, bash_cv_func_inet_aton=no)])
+if test $bash_cv_func_inet_aton = yes; then
+  AC_DEFINE(HAVE_INET_ATON)
+fi
+])
+
 AC_DEFUN(BASH_STRUCT_TERMIOS_LDISC,
 [AC_MSG_CHECKING([for a c_line member of struct termios])
 AC_CACHE_VAL(bash_cv_termios_ldisc,
@@ -845,7 +902,7 @@
 /* Add more tests in here as appropriate. */
 main()
 {
-int fd;
+int fd, err;
 
 #if defined (HAVE_MKFIFO)
 exit (0);
@@ -858,12 +915,19 @@
 #if defined (NeXT)
 exit (1);
 #endif
-
-fd = mknod ("/tmp/sh-np-autoconf", 0666 | S_IFIFO, 0);
-if (fd == -1)
+err = mkdir("/tmp/bash-aclocal", 0700);
+if (err < 0) {
+  perror ("mkdir");
+  exit(1);
+}
+fd = mknod ("/tmp/bash-aclocal/sh-np-autoconf", 0666 | S_IFIFO, 0);
+if (fd == -1) {
+  rmdir ("/tmp/bash-aclocal");
   exit (1);
+}
 close(fd);
-unlink ("/tmp/sh-np-autoconf");
+unlink ("/tmp/bash-aclocal/sh-np-autoconf");
+rmdir ("/tmp/bash-aclocal");
 exit(0);
 }], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
     [AC_MSG_WARN(cannot check for named pipes if cross-compiling -- defaulting to missing)
@@ -1037,12 +1101,32 @@
 fi
 ])
 
+AC_DEFUN(BASH_CHECK_DEV_STDIN,
+[AC_MSG_CHECKING(whether /dev/stdin stdout stderr are available)
+AC_CACHE_VAL(bash_cv_dev_stdin,
+[if test -d /dev/fd && test -r /dev/stdin; then
+   bash_cv_dev_stdin=present
+ elif test -d /proc/self/fd && test -r /dev/stdin; then
+   bash_cv_dev_stdin=present
+ else
+   bash_cv_dev_stdin=absent
+ fi
+])
+AC_MSG_RESULT($bash_cv_dev_stdin)
+if test $bash_cv_dev_stdin = "present"; then
+  AC_DEFINE(HAVE_DEV_STDIN)
+fi
+])
+
 dnl
-dnl Check for the presence of getpeername (the only networking function
-dnl bash currently requires) in libsocket.  If libsocket is present,
-dnl check for libnsl and add it to LIBS if it's there, since most
-dnl systems with libsocket require linking with libnsl as well.
-dnl This should only be called if getpeername was not found in libc.
+dnl Check for the presence of getpeername in libsocket.
+dnl If libsocket is present, check for libnsl and add it to LIBS if
+dnl it's there, since most systems with libsocket require linking
+dnl with libnsl as well.  This should only be called if getpeername
+dnl was not found in libc.
+dnl
+dnl NOTE: IF WE FIND GETPEERNAME, WE ASSUME THAT WE HAVE BIND/CONNECT
+dnl	  AS WELL
 dnl
 AC_DEFUN(BASH_CHECK_SOCKLIB,
 [
@@ -1084,6 +1168,32 @@
 fi
 ])
 
+dnl
+dnl This needs BASH_CHECK_SOCKLIB, but since that's not called on every
+dnl system, we can't use AC_PREREQ
+dnl
+AC_DEFUN(BASH_FUNC_GETHOSTBYNAME,
+[if test "X$bash_cv_have_gethostbyname" = "X"; then
+_bash_needmsg=yes
+else
+AC_MSG_CHECKING(for gethostbyname in socket library)
+_bash_needmsg=
+fi
+AC_CACHE_VAL(bash_cv_have_gethostbyname,
+[AC_TRY_LINK([#include <netdb.h>],
+[ struct hostent *hp;
+  hp = gethostbyname("localhost");
+], bash_cv_have_gethostbyname=yes, bash_cv_have_gethostbyname=no)]
+)
+if test "X$_bash_needmsg" = Xyes; then
+    AC_MSG_CHECKING(for gethostbyname in socket library)
+fi
+AC_MSG_RESULT($bash_cv_have_gethostbyname)
+if test "$bash_cv_have_gethostbyname" = yes; then
+AC_DEFINE(HAVE_GETHOSTBYNAME)
+fi
+])
+
 AC_DEFUN(BASH_DEFAULT_MAIL_DIR,
 [AC_MSG_CHECKING(for default mail directory)
 AC_CACHE_VAL(bash_cv_mail_dir,
@@ -1299,3 +1409,19 @@
 if test $bash_cv_off_t_64 = yes; then
         AC_DEFINE(HAVE_OFF_T_64)
 fi])
+
+AC_DEFUN(BASH_STRUCT_TIMEVAL,
+[AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h)
+AC_CACHE_VAL(bash_cv_struct_timeval,
+[
+AC_EGREP_HEADER(struct timeval, sys/time.h,
+		bash_cv_struct_timeval=yes,
+		AC_EGREP_HEADER(struct timeval, time.h,
+			bash_cv_struct_timeval=yes,
+			bash_cv_struct_timeval=no))
+])
+AC_MSG_RESULT($bash_cv_struct_timeval)
+if test $bash_cv_struct_timeval = yes; then
+  AC_DEFINE(HAVE_TIMEVAL)
+fi
+])
diff --git a/readline/ansi_stdlib.h b/readline/ansi_stdlib.h
index 52339da..a720cb9 100644
--- a/readline/ansi_stdlib.h
+++ b/readline/ansi_stdlib.h
@@ -18,7 +18,7 @@
 
    You should have received a copy of the GNU General Public License along
    with Bash; see the file COPYING.  If not, write to the Free Software
-   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+   Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #if !defined (_STDLIB_H_)
 #define	_STDLIB_H_ 1
diff --git a/readline/bind.c b/readline/bind.c
index 73cd827..6a6424e 100644
--- a/readline/bind.c
+++ b/readline/bind.c
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -42,7 +42,6 @@
 #  include "ansi_stdlib.h"
 #endif /* HAVE_STDLIB_H */
 
-#include <signal.h>
 #include <errno.h>
 
 #if !defined (errno)
@@ -58,65 +57,25 @@
 #include "readline.h"
 #include "history.h"
 
+#include "rlprivate.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
 #if !defined (strchr) && !defined (__STDC__)
 extern char *strchr (), *strrchr ();
 #endif /* !strchr && !__STDC__ */
 
-#ifndef O_BINARY
-# define O_BINARY 0
-#endif
-
-extern int _rl_horizontal_scroll_mode;
-extern int _rl_mark_modified_lines;
-extern int _rl_bell_preference;
-extern int _rl_meta_flag;
-extern int _rl_convert_meta_chars_to_ascii;
-extern int _rl_output_meta_chars;
-extern int _rl_complete_show_all;
-extern int _rl_complete_mark_directories;
-extern int _rl_print_completions_horizontally;
-extern int _rl_completion_case_fold;
-extern int _rl_enable_keypad;
-#if defined (PAREN_MATCHING)
-extern int rl_blink_matching_paren;
-#endif /* PAREN_MATCHING */
-#if defined (VISIBLE_STATS)
-extern int rl_visible_stats;
-#endif /* VISIBLE_STATS */
-extern int rl_complete_with_tilde_expansion;
-extern int rl_completion_query_items;
-extern int rl_inhibit_completion;
-extern char *_rl_comment_begin;
-extern unsigned char *_rl_isearch_terminators;
-
-extern int rl_explicit_arg;
-extern int rl_editing_mode;
-extern unsigned char _rl_parsing_conditionalized_out;
-extern Keymap _rl_keymap;
-
-extern char *possible_control_prefixes[], *possible_meta_prefixes[];
-
-/* Functions imported from funmap.c */
-extern char **rl_funmap_names ();
-extern int rl_add_funmap_entry ();
-
-/* Functions imported from util.c */
-extern char *_rl_strindex ();
-
-/* Functions imported from shell.c */
-extern char *get_env_value ();
-
 /* Variables exported by this file. */
 Keymap rl_binding_keymap;
 
-/* Forward declarations */
-void rl_set_keymap_from_edit_mode ();
+static int _rl_read_init_file __P((char *, int));
+static int glean_key_from_name __P((char *));
+static int substring_member_of_array __P((char *, char **));
 
-static int _rl_read_init_file ();
-static int glean_key_from_name ();
-static int substring_member_of_array ();
+static int currently_reading_init_file;
 
-extern char *xmalloc (), *xrealloc ();
+/* used only in this file */
+static int _rl_prefer_visible_bell = 1;
 
 /* **************************************************************** */
 /*								    */
@@ -650,7 +609,7 @@
   char *buffer;
   int i, file;
 
-  if ((stat (filename, &finfo) < 0) || (file = open (filename, O_RDONLY | O_BINARY, 0666)) < 0)
+  if ((stat (filename, &finfo) < 0) || (file = open (filename, O_RDONLY, 0666)) < 0)
     return ((char *)NULL);
 
   file_size = (size_t)finfo.st_size;
@@ -671,7 +630,7 @@
   i = read (file, buffer, file_size);
   close (file);
 
-#if 1
+#if 0
   if (i < file_size)
 #else
   if (i < 0)
@@ -681,33 +640,16 @@
       return ((char *)NULL);
     }
 
+#if 0
   buffer[file_size] = '\0';
-
-#if O_BINARY
-  {
-    /* Systems which distinguish between text and binary files need
-       to strip the CR characters before each Newline, otherwise the
-       parsing functions won't work.  */
-    char *s, *d;
-    size_t removed = 0;
-
-    for (s = buffer, d = buffer; s < buffer + file_size; s++)
-      {
-	if (removed)
-	  *d = *s;
-	if (*s != '\r' || s[1] != '\n')
-	  d++;
-	else
-	  removed++;
-      }
-
-    file_size -= removed;
-    buffer[file_size] = '\0';
-  }
-#endif
-
   if (sizep)
     *sizep = file_size;
+#else
+  buffer[i] = '\0';
+  if (sizep)
+    *sizep = i;
+#endif
+
   return (buffer);
 }
 
@@ -727,7 +669,6 @@
      1. the filename used for the previous call
      2. the value of the shell variable `INPUTRC'
      3. ~/.inputrc
-     4. (for __MSDOS__ only) ~/_inputrc
    If the file existed and could be opened and read, 0 is returned,
    otherwise errno is returned. */
 int
@@ -747,20 +688,11 @@
   if (*filename == 0)
     filename = DEFAULT_INPUTRC;
 
-#ifdef __MSDOS__
-  {
-    /* DOS doesn't allow leading dots in file names.  If the original
-       name fails (it could work if we are on Windows), fall back to
-       ~/_inputrc.  */
-    int retval = _rl_read_init_file (filename, 0);
-
-    if (retval == 0)
-      return retval;
-    else if (strcmp (filename, "~/.inputrc") == 0)
-      filename = "~/_inputrc";
-  }
+#if defined (__MSDOS__)
+  if (_rl_read_init_file (filename, 0) == 0)
+    return 0;
+  filename = "~/_inputrc";
 #endif
-
   return (_rl_read_init_file (filename, 0));
 }
 
@@ -789,6 +721,8 @@
       last_readline_init_file = savestring (filename);
     }
 
+  currently_reading_init_file = 1;
+
   /* Loop over the lines in the file.  Lines that start with `#' are
      comments; all other lines are commands for readline initialization. */
   current_readline_init_lineno = 1;
@@ -799,6 +733,12 @@
       /* Find the end of this line. */
       for (i = 0; line + i != end && line[i] != '\n'; i++);
 
+#if defined (__CYGWIN32__)
+      /* ``Be liberal in what you accept.'' */
+      if (line[i] == '\n' && line[i-1] == '\r')
+	line[i - 1] = '\0';
+#endif
+
       /* Mark end of line. */
       line[i] = '\0';
 
@@ -819,6 +759,7 @@
     }
 
   free (buffer);
+  currently_reading_init_file = 0;
   return (0);
 }
 
@@ -826,9 +767,11 @@
 _rl_init_file_error (msg)
      char *msg;
 {
-  fprintf (stderr, "readline: %s: line %d: %s\n", current_readline_init_file,
- 		   current_readline_init_lineno,
- 		   msg);
+  if (currently_reading_init_file)
+    fprintf (stderr, "readline: %s: line %d: %s\n", current_readline_init_file,
+		     current_readline_init_lineno, msg);
+  else
+    fprintf (stderr, "readline: %s\n", msg);
 }
 
 /* **************************************************************** */
@@ -1275,154 +1218,273 @@
    have one of two values; either "On" or 1 for truth, or "Off" or 0 for
    false. */
 
+#define V_SPECIAL	0x1
+
 static struct {
   char *name;
   int *value;
+  int flags;
 } boolean_varlist [] = {
-#if defined (PAREN_MATCHING)
-  { "blink-matching-paren",	&rl_blink_matching_paren },
-#endif
-  { "completion-ignore-case",	&_rl_completion_case_fold },
-  { "convert-meta",		&_rl_convert_meta_chars_to_ascii },
-  { "disable-completion",	&rl_inhibit_completion },
-  { "enable-keypad",		&_rl_enable_keypad },
-  { "expand-tilde",		&rl_complete_with_tilde_expansion },
-  { "horizontal-scroll-mode",	&_rl_horizontal_scroll_mode },
-  { "input-meta",		&_rl_meta_flag },
-  { "mark-directories",		&_rl_complete_mark_directories },
-  { "mark-modified-lines",	&_rl_mark_modified_lines },
-  { "meta-flag",		&_rl_meta_flag },
-  { "output-meta",		&_rl_output_meta_chars },
-  { "print-completions-horizontally", &_rl_print_completions_horizontally },
-  { "show-all-if-ambiguous",	&_rl_complete_show_all },
+  { "blink-matching-paren",	&rl_blink_matching_paren,	V_SPECIAL },
+  { "completion-ignore-case",	&_rl_completion_case_fold,	0 },
+  { "convert-meta",		&_rl_convert_meta_chars_to_ascii, 0 },
+  { "disable-completion",	&rl_inhibit_completion,		0 },
+  { "enable-keypad",		&_rl_enable_keypad,		0 },
+  { "expand-tilde",		&rl_complete_with_tilde_expansion, 0 },
+  { "horizontal-scroll-mode",	&_rl_horizontal_scroll_mode,	0 },
+  { "input-meta",		&_rl_meta_flag,			0 },
+  { "mark-directories",		&_rl_complete_mark_directories,	0 },
+  { "mark-modified-lines",	&_rl_mark_modified_lines,	0 },
+  { "meta-flag",		&_rl_meta_flag,			0 },
+  { "output-meta",		&_rl_output_meta_chars,		0 },
+  { "prefer-visible-bell",	&_rl_prefer_visible_bell,	V_SPECIAL },
+  { "print-completions-horizontally", &_rl_print_completions_horizontally, 0 },
+  { "show-all-if-ambiguous",	&_rl_complete_show_all,		0 },
 #if defined (VISIBLE_STATS)
-  { "visible-stats",		&rl_visible_stats },
+  { "visible-stats",		&rl_visible_stats,		0 },
 #endif /* VISIBLE_STATS */
   { (char *)NULL, (int *)NULL }
 };
 
+static int
+find_boolean_var (name)
+     char *name;
+{
+  register int i;
+
+  for (i = 0; boolean_varlist[i].name; i++)
+    if (_rl_stricmp (name, boolean_varlist[i].name) == 0)
+      return i;
+  return -1;
+}
+
+/* Hooks for handling special boolean variables, where a
+   function needs to be called or another variable needs
+   to be changed when they're changed. */
+static void
+hack_special_boolean_var (i)
+     int i;
+{
+  char *name;
+
+  name = boolean_varlist[i].name;
+
+  if (_rl_stricmp (name, "blink-matching-paren") == 0)
+    _rl_enable_paren_matching (rl_blink_matching_paren);
+  else if (_rl_stricmp (name, "prefer-visible-bell") == 0)
+    {
+      if (_rl_prefer_visible_bell)
+	_rl_bell_preference = VISIBLE_BELL;
+      else
+	_rl_bell_preference = AUDIBLE_BELL;
+    }
+}
+
+/* These *must* correspond to the array indices for the appropriate
+   string variable.  (Though they're not used right now.) */
+#define V_BELLSTYLE	0
+#define V_COMBEGIN	1
+#define V_EDITMODE	2
+#define V_ISRCHTERM	3
+#define V_KEYMAP	4
+
+#define	V_STRING	1
+#define V_INT		2
+
+/* Forward declarations */
+static int sv_bell_style __P((char *));
+static int sv_combegin __P((char *));
+static int sv_compquery __P((char *));
+static int sv_editmode __P((char *));
+static int sv_isrchterm __P((char *));
+static int sv_keymap __P((char *));
+
+static struct {
+  char *name;
+  int flags;
+  Function *set_func;
+} string_varlist[] = {
+  { "bell-style",	V_STRING,	sv_bell_style },
+  { "comment-begin",	V_STRING,	sv_combegin },
+  { "completion-query-items", V_INT,	sv_compquery },
+  { "editing-mode",	V_STRING,	sv_editmode },
+  { "isearch-terminators", V_STRING,	sv_isrchterm },
+  { "keymap",		V_STRING,	sv_keymap },
+  { (char *)NULL,	0 }
+};
+
+static int
+find_string_var (name)
+     char *name;
+{
+  register int i;
+
+  for (i = 0; string_varlist[i].name; i++)
+    if (_rl_stricmp (name, string_varlist[i].name) == 0)
+      return i;
+  return -1;
+}
+
+/* A boolean value that can appear in a `set variable' command is true if
+   the value is null or empty, `on' (case-insenstive), or "1".  Any other
+   values result in 0 (false). */
+static int
+bool_to_int (value)
+     char *value;
+{
+  return (value == 0 || *value == '\0' ||
+		(_rl_stricmp (value, "on") == 0) ||
+		(value[0] == '1' && value[1] == '\0'));
+}
+
 int
 rl_variable_bind (name, value)
      char *name, *value;
 {
   register int i;
+  int	v;
 
   /* Check for simple variables first. */
-  for (i = 0; boolean_varlist[i].name; i++)
+  i = find_boolean_var (name);
+  if (i >= 0)
     {
-      if (_rl_stricmp (name, boolean_varlist[i].name) == 0)
-	{
-	  /* A variable is TRUE if the "value" is "on", "1" or "". */
-	  *boolean_varlist[i].value = *value == 0 ||
-	  			      _rl_stricmp (value, "on") == 0 ||
-				      (value[0] == '1' && value[1] == '\0');
-	  return 0;
-	}
+      *boolean_varlist[i].value = bool_to_int (value);
+      if (boolean_varlist[i].flags & V_SPECIAL)
+	hack_special_boolean_var (i);
+      return 0;
     }
 
-  /* Not a boolean variable, so check for specials. */
+  i = find_string_var (name);
 
-  /* Editing mode change? */
-  if (_rl_stricmp (name, "editing-mode") == 0)
+  /* For the time being, unknown variable names or string names without a
+     handler function are simply ignored. */
+  if (i < 0 || string_varlist[i].set_func == 0)
+    return 0;
+
+  v = (*string_varlist[i].set_func) (value);
+  return v;
+}
+
+static int
+sv_editmode (value)
+     char *value;
+{
+  if (_rl_strnicmp (value, "vi", 2) == 0)
     {
-      if (_rl_strnicmp (value, "vi", 2) == 0)
-	{
 #if defined (VI_MODE)
-	  _rl_keymap = vi_insertion_keymap;
-	  rl_editing_mode = vi_mode;
+      _rl_keymap = vi_insertion_keymap;
+      rl_editing_mode = vi_mode;
 #endif /* VI_MODE */
-	}
-      else if (_rl_strnicmp (value, "emacs", 5) == 0)
-	{
-	  _rl_keymap = emacs_standard_keymap;
-	  rl_editing_mode = emacs_mode;
-	}
+      return 0;
     }
+  else if (_rl_strnicmp (value, "emacs", 5) == 0)
+    {
+      _rl_keymap = emacs_standard_keymap;
+      rl_editing_mode = emacs_mode;
+      return 0;
+    }
+  return 1;
+}
 
-  /* Comment string change? */
-  else if (_rl_stricmp (name, "comment-begin") == 0)
+static int
+sv_combegin (value)
+     char *value;
+{
+  if (value && *value)
     {
-      if (*value)
-	{
-	  if (_rl_comment_begin)
-	    free (_rl_comment_begin);
+      FREE (_rl_comment_begin);
+      _rl_comment_begin = savestring (value);
+      return 0;
+    }
+  return 1;
+}
 
-	  _rl_comment_begin = savestring (value);
-	}
-    }
-  else if (_rl_stricmp (name, "completion-query-items") == 0)
-    {
-      int nval = 100;
-      if (*value)
-	{
-	  nval = atoi (value);
-	  if (nval < 0)
-	    nval = 0;
-	}
-      rl_completion_query_items = nval;
-    }
-  else if (_rl_stricmp (name, "keymap") == 0)
-    {
-      Keymap kmap;
-      kmap = rl_get_keymap_by_name (value);
-      if (kmap)
-        rl_set_keymap (kmap);
-    }
-  else if (_rl_stricmp (name, "bell-style") == 0)
-    {
-      if (!*value)
-        _rl_bell_preference = AUDIBLE_BELL;
-      else
-        {
-          if (_rl_stricmp (value, "none") == 0 || _rl_stricmp (value, "off") == 0)
-            _rl_bell_preference = NO_BELL;
-          else if (_rl_stricmp (value, "audible") == 0 || _rl_stricmp (value, "on") == 0)
-            _rl_bell_preference = AUDIBLE_BELL;
-          else if (_rl_stricmp (value, "visible") == 0)
-            _rl_bell_preference = VISIBLE_BELL;
-        }
-    }
-  else if (_rl_stricmp (name, "prefer-visible-bell") == 0)
-    {
-      /* Backwards compatibility. */
-      if (*value && (_rl_stricmp (value, "on") == 0 ||
-		     (*value == '1' && !value[1])))
-        _rl_bell_preference = VISIBLE_BELL;
-      else
-        _rl_bell_preference = AUDIBLE_BELL;
-    }
-  else if (_rl_stricmp (name, "isearch-terminators") == 0)
-    {
-      /* Isolate the value and translate it into a character string. */
-      int beg, end;
-      char *v;
+static int
+sv_compquery (value)
+     char *value;
+{
+  int nval = 100;
 
-      v = savestring (value);
-      FREE (_rl_isearch_terminators);
-      if (v[0] == '"' || v[0] == '\'')
-	{
-	  int delim = v[0];
-	  for (beg = end = 1; v[end] && v[end] != delim; end++)
-	    ;
-	}
-      else
-	{
-	  for (beg = end = 0; whitespace (v[end]) == 0; end++)
-	    ;
-	}
-
-      v[end] = '\0';
-      /* The value starts at v + beg.  Translate it into a character string. */
-      _rl_isearch_terminators = (unsigned char *)xmalloc (2 * strlen (v) + 1);
-      rl_translate_keyseq (v + beg, _rl_isearch_terminators, &end);
-      _rl_isearch_terminators[end] = '\0';
-      free (v);
+  if (value && *value)
+    {
+      nval = atoi (value);
+      if (nval < 0)
+	nval = 0;
     }
-      
-  /* For the time being, unknown variable names are simply ignored. */
+  rl_completion_query_items = nval;
   return 0;
 }
 
+static int
+sv_keymap (value)
+     char *value;
+{
+  Keymap kmap;
+
+  kmap = rl_get_keymap_by_name (value);
+  if (kmap)
+    {
+      rl_set_keymap (kmap);
+      return 0;
+    }
+  return 1;
+}
+
+#define _SET_BELL(v)	do { _rl_bell_preference = v; return 0; } while (0)
+
+static int
+sv_bell_style (value)
+     char *value;
+{
+  if (value == 0 || *value == '\0')
+    _SET_BELL (AUDIBLE_BELL);
+  else if (_rl_stricmp (value, "none") == 0 || _rl_stricmp (value, "off") == 0)
+    _SET_BELL (NO_BELL);
+  else if (_rl_stricmp (value, "audible") == 0 || _rl_stricmp (value, "on") == 0)
+    _SET_BELL (AUDIBLE_BELL);
+  else if (_rl_stricmp (value, "visible") == 0)
+    _SET_BELL (VISIBLE_BELL);
+  else
+    return 1;
+}
+#undef _SET_BELL
+
+static int
+sv_isrchterm (value)
+     char *value;
+{
+  int beg, end, delim;
+  char *v;
+
+  if (value == 0)
+    return 1;
+
+  /* Isolate the value and translate it into a character string. */
+  v = savestring (value);
+  FREE (_rl_isearch_terminators);
+  if (v[0] == '"' || v[0] == '\'')
+    {
+      delim = v[0];
+      for (beg = end = 1; v[end] && v[end] != delim; end++)
+	;
+    }
+  else
+    {
+      for (beg = end = 0; whitespace (v[end]) == 0; end++)
+	;
+    }
+
+  v[end] = '\0';
+
+  /* The value starts at v + beg.  Translate it into a character string. */
+  _rl_isearch_terminators = (unsigned char *)xmalloc (2 * strlen (v) + 1);
+  rl_translate_keyseq (v + beg, _rl_isearch_terminators, &end);
+  _rl_isearch_terminators[end] = '\0';
+
+  free (v);
+  return 0;
+}
+      
 /* Return the character which matches NAME.
    For example, `Space' returns ' '. */
 
diff --git a/readline/callback.c b/readline/callback.c
index 6915be4..1172356 100644
--- a/readline/callback.c
+++ b/readline/callback.c
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -35,15 +35,7 @@
 /* System-specific feature definitions and include files. */
 #include "rldefs.h"
 #include "readline.h"
-
-extern void readline_internal_setup ();
-extern char *readline_internal_teardown ();
-extern int readline_internal_char ();
-extern void _rl_init_line_state ();
-
-extern int _rl_meta_flag;
-extern char *rl_prompt;
-extern int rl_visible_prompt_length;
+#include "rlprivate.h"
 
 /* **************************************************************** */
 /*								    */
diff --git a/readline/chardefs.h b/readline/chardefs.h
index 3e9e273..664c1e4 100644
--- a/readline/chardefs.h
+++ b/readline/chardefs.h
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #ifndef _CHARDEFS_H_
 #define _CHARDEFS_H_
diff --git a/readline/complete.c b/readline/complete.c
index 1188120..fb48712 100644
--- a/readline/complete.c
+++ b/readline/complete.c
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -70,20 +70,14 @@
 
 /* Some standard library routines. */
 #include "readline.h"
+#include "xmalloc.h"
+#include "rlprivate.h"
 
-extern char *tilde_expand ();
-extern char *rl_copy_text ();
-extern void _rl_abort_internal ();
-extern int _rl_qsort_string_compare ();
-extern void _rl_replace_text ();
-
-extern Function *rl_last_func;
-extern int rl_editing_mode;
-extern int screenwidth;
-
-extern void _rl_move_vert ();
-extern int _rl_vis_botlin;
-extern int rl_display_fixed;
+#ifdef __STDC__
+typedef int QSFUNC (const void *, const void *);
+#else
+typedef int QSFUNC ();
+#endif
 
 /* If non-zero, then this is the address of a function to call when
    completing a word would normally display the list of possible matches.
@@ -95,27 +89,25 @@
 VFunction *rl_completion_display_matches_hook = (VFunction *)NULL;
 
 /* Forward declarations for functions defined and used in this file. */
-char *filename_completion_function ();
-char **completion_matches ();
+char *filename_completion_function __P((char *, int));
+char **completion_matches __P((char *, CPFunction *));
 
 #if defined (VISIBLE_STATS)
 #  if !defined (X_OK)
 #    define X_OK 1
 #  endif
-static int stat_char ();
+static int stat_char __P((char *));
 #endif
 
-static char *rl_quote_filename ();
-static char *rl_strpbrk ();
+static char *rl_quote_filename __P((char *, int, char *));
+static char *rl_strpbrk __P((char *, char *));
 
-static char **remove_duplicate_matches ();
-static void insert_match ();
-static int append_to_match ();
-static void insert_all_matches ();
-static void display_matches ();
-static int compute_lcd_of_matches ();
-
-extern char *xmalloc (), *xrealloc ();
+static char **remove_duplicate_matches __P((char **));
+static void insert_match __P((char *, int, int, char *));
+static int append_to_match __P((char *, int, int));
+static void insert_all_matches __P((char **, int, char *));
+static void display_matches __P((char **));
+static int compute_lcd_of_matches __P((char **, int, char *));
 
 /* **************************************************************** */
 /*								    */
@@ -136,7 +128,11 @@
 int _rl_print_completions_horizontally;
 
 /* Non-zero means that case is not significant in filename completion. */
+#if defined (__MSDOS__) && !defined (__DJGPP__)
+int _rl_completion_case_fold = 1;
+#else
 int _rl_completion_case_fold;
+#endif
 
 /* Global variables available to applications using readline. */
 
@@ -417,6 +413,10 @@
   char *temp;
 
   temp = rl_filename_completion_desired ? strrchr (pathname, '/') : (char *)NULL;
+#if defined (__MSDOS__)
+  if (rl_filename_completion_desired && temp == 0 && isalpha (pathname[0]) && pathname[1] == ':')
+    temp = pathname + 1;
+#endif
   return (temp ? ++temp : pathname);
 }
 
@@ -477,7 +477,12 @@
 	  c = to_print[-1];
 	  to_print[-1] = '\0';
 
-	  s = tilde_expand (full_pathname);
+	  /* If setting the last slash in full_pathname to a NUL results in
+	     full_pathname being the empty string, we are trying to complete
+	     files in the root directory.  If we pass a null string to the
+	     bash directory completion hook, for example, it will expand it
+	     to the current directory.  We just want the `/'. */
+	  s = tilde_expand (full_pathname && *full_pathname ? full_pathname : "/");
 	  if (rl_directory_completion_hook)
 	    (*rl_directory_completion_hook) (&s);
 
@@ -627,25 +632,31 @@
   /* If there is an application-specific function to say whether or not
      a character is quoted and we found a quote character, let that
      function decide whether or not a character is a word break, even
-     if it is found in rl_completer_word_break_characters. */
-  if (rl_char_is_quoted_p)
-    isbrk = (found_quote == 0 ||
- 		(*rl_char_is_quoted_p) (rl_line_buffer, rl_point) == 0) &&
-	      strchr (rl_completer_word_break_characters, scan) != 0;
-  else
-    isbrk = strchr (rl_completer_word_break_characters, scan) != 0;
-
-  if (isbrk)
+     if it is found in rl_completer_word_break_characters.  Don't bother
+     if we're at the end of the line, though. */
+  if (scan)
     {
-      /* If the character that caused the word break was a quoting
-	 character, then remember it as the delimiter. */
-      if (rl_basic_quote_characters && strchr (rl_basic_quote_characters, scan) && (end - rl_point) > 1)
-	delimiter = scan;
+      if (rl_char_is_quoted_p)
+	isbrk = (found_quote == 0 ||
+		(*rl_char_is_quoted_p) (rl_line_buffer, rl_point) == 0) &&
+		strchr (rl_completer_word_break_characters, scan) != 0;
+      else
+	isbrk = strchr (rl_completer_word_break_characters, scan) != 0;
 
-      /* If the character isn't needed to determine something special
-	 about what kind of completion to perform, then advance past it. */
-      if (rl_special_prefixes == 0 || strchr (rl_special_prefixes, scan) == 0)
-	rl_point++;
+      if (isbrk)
+	{
+	  /* If the character that caused the word break was a quoting
+	     character, then remember it as the delimiter. */
+	  if (rl_basic_quote_characters &&
+	      strchr (rl_basic_quote_characters, scan) &&
+	      (end - rl_point) > 1)
+	    delimiter = scan;
+
+	  /* If the character isn't needed to determine something special
+	     about what kind of completion to perform, then advance past it. */
+	  if (rl_special_prefixes == 0 || strchr (rl_special_prefixes, scan) == 0)
+	    rl_point++;
+	}
     }
 
   if (fp)
@@ -715,7 +726,7 @@
   /* Sort the array without matches[0], since we need it to
      stay in place no matter what. */
   if (i)
-    qsort (matches+1, i-1, sizeof (char *), _rl_qsort_string_compare);
+    qsort (matches+1, i-1, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
 
   /* Remember the lowest common denominator for it may be unique. */
   lowest_common = savestring (matches[0]);
@@ -908,7 +919,7 @@
 
   /* Sort the items if they are not already sorted. */
   if (rl_ignore_completion_duplicates == 0)
-    qsort (matches + 1, len, sizeof (char *), _rl_qsort_string_compare);
+    qsort (matches + 1, len, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
 
   crlf ();
 
@@ -1409,7 +1420,7 @@
 {
 #if defined (__WIN32__) || defined (__OPENNT)
   return (char *)NULL;
-#else /* !__WIN32__ && !__OPENNT */
+#else /* !__WIN32__ && !__OPENNT) */
   static char *username = (char *)NULL;
   static struct passwd *entry;
   static int namelen, first_char, first_char_loc;
@@ -1452,7 +1463,7 @@
 
       return (value);
     }
-#endif /* !__GO32__ */
+#endif /* !__WIN32__ && !__OPENNT */
 }
 
 /* Okay, now we write the entry_function for filename completion.  In the
@@ -1494,18 +1505,24 @@
 
       temp = strrchr (dirname, '/');
 
+#if defined (__MSDOS__)
+      /* special hack for //X/... */
+      if (dirname[0] == '/' && dirname[1] == '/' && isalpha (dirname[2]) && dirname[3] == '/')
+        temp = strrchr (dirname + 3, '/');
+#endif
+
       if (temp)
 	{
 	  strcpy (filename, ++temp);
 	  *temp = '\0';
 	}
-#if defined (__WIN32__) || defined (__OPENNT) || defined (__MSDOS__)
-      /* Handle the drive-relative names "d:foo/bar".  */
-      else if (dirname[1] == ':')
-	{
-	  strcpy (filename, dirname + 2);
-	  dirname[2] = '\0';
-	}
+#if defined (__MSDOS__)
+      /* searches from current directory on the drive */
+      else if (isalpha (dirname[0]) && dirname[1] == ':')
+        {
+          strcpy (filename, dirname + 2);
+          dirname[2] = '\0';
+        }
 #endif
       else
 	{
@@ -1668,11 +1685,7 @@
       /* Clean up from previous call, if any. */
       FREE (orig_text);
       if (matches)
-	{
-	  for (match_list_index = 0; matches[match_list_index]; match_list_index++)
-	    free (matches[match_list_index]);
-	  free (matches);
-	}
+	free_match_list (matches);
 
       match_list_index = match_list_size = 0;
       matches = (char **)NULL;
diff --git a/readline/config.h.in b/readline/config.h.in
index 87f807f..569e53d 100644
--- a/readline/config.h.in
+++ b/readline/config.h.in
@@ -57,6 +57,9 @@
 /* Define if you have the lstat function.  */
 #undef HAVE_LSTAT
 
+/* Define if you have the memmove function.  */
+#undef HAVE_MEMMOVE
+
 /* Define if you have the putenv function.  */
 #undef HAVE_PUTENV
 
diff --git a/readline/configure b/readline/configure
index cdcdf88..ae9bf94 100755
--- a/readline/configure
+++ b/readline/configure
@@ -1,7 +1,19 @@
 #! /bin/sh
 
-# From configure.in for Readline 4.0, version 2.14, from autoconf version 2.13
-LIBVERSION=4.0
+# From configure.in for Readline 4.1, version 2.22, from autoconf version 2.13
+LIBVERSION=4.1
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -121,7 +133,6 @@
 program_transform_name=s,x,x,
 silent=
 site=
-sitefile=
 srcdir=
 target=NONE
 verbose=
@@ -236,7 +247,6 @@
   --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
@@ -407,11 +417,6 @@
   -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=*)
@@ -577,16 +582,12 @@
 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
+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
-else
-  CONFIG_SITE="$sitefile"
 fi
 for ac_site_file in $CONFIG_SITE; do
   if test -r "$ac_site_file"; then
@@ -656,7 +657,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:660: checking host system type" >&5
+echo "configure:661: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -697,7 +698,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:701: checking for $ac_word" >&5
+echo "configure:702: 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
@@ -727,7 +728,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:731: checking for $ac_word" >&5
+echo "configure:732: 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
@@ -778,7 +779,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:782: checking for $ac_word" >&5
+echo "configure:783: 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
@@ -810,7 +811,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:814: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:815: 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.
@@ -821,12 +822,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 825 "configure"
+#line 826 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:830: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:831: \"$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
@@ -852,12 +853,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:856: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:857: 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:861: checking whether we are using GNU C" >&5
+echo "configure:862: 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
@@ -866,7 +867,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:870: \"$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:871: \"$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
@@ -885,7 +886,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:889: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:890: 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
@@ -917,7 +918,7 @@
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:921: checking how to run the C preprocessor" >&5
+echo "configure:922: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -932,13 +933,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 936 "configure"
+#line 937 "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:942: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:943: \"$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
   :
@@ -949,13 +950,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 953 "configure"
+#line 954 "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:959: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:960: \"$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
   :
@@ -966,13 +967,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 970 "configure"
+#line 971 "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:976: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:977: \"$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
   :
@@ -998,17 +999,17 @@
 
 ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6
-echo "configure:1002: checking for minix/config.h" >&5
+echo "configure:1003: checking for minix/config.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 1007 "configure"
+#line 1008 "configure"
 #include "confdefs.h"
 #include <minix/config.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1012: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1013: \"$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*
@@ -1085,13 +1086,13 @@
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:1089: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:1090: checking whether ${CC-cc} needs -traditional" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     ac_pattern="Autoconf.*'x'"
   cat > conftest.$ac_ext <<EOF
-#line 1095 "configure"
+#line 1096 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
@@ -1109,7 +1110,7 @@
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 1113 "configure"
+#line 1114 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
@@ -1142,7 +1143,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:1146: checking for a BSD compatible install" >&5
+echo "configure:1147: 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
@@ -1197,7 +1198,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:1201: checking for $ac_word" >&5
+echo "configure:1202: 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
@@ -1227,7 +1228,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:1231: checking for $ac_word" >&5
+echo "configure:1232: 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
@@ -1259,12 +1260,12 @@
 
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1263: checking return type of signal handlers" >&5
+echo "configure:1264: 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 1268 "configure"
+#line 1269 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -1281,7 +1282,7 @@
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:1285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1286: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -1301,12 +1302,12 @@
 
 
 echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:1305: checking whether stat file-mode macros are broken" >&5
+echo "configure:1306: 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 1310 "configure"
+#line 1311 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -1361,12 +1362,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:1365: checking for $ac_hdr that defines DIR" >&5
+echo "configure:1366: 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 1370 "configure"
+#line 1371 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -1374,7 +1375,7 @@
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:1378: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1379: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -1399,7 +1400,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:1403: checking for opendir in -ldir" >&5
+echo "configure:1404: 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
@@ -1407,7 +1408,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1411 "configure"
+#line 1412 "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
@@ -1418,7 +1419,7 @@
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:1422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1423: \"$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
@@ -1440,7 +1441,7 @@
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:1444: checking for opendir in -lx" >&5
+echo "configure:1445: 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
@@ -1448,7 +1449,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1452 "configure"
+#line 1453 "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
@@ -1459,7 +1460,7 @@
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:1463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1464: \"$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
@@ -1482,15 +1483,16 @@
 fi
 
 
-for ac_func in strcasecmp select setenv putenv tcgetattr setlocale lstat
+for ac_func in lstat memmove putenv select setenv setlocale \
+		strcasecmp tcgetattr
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1489: checking for $ac_func" >&5
+echo "configure:1491: 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 1494 "configure"
+#line 1496 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1513,7 +1515,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1519: \"$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
@@ -1539,7 +1541,7 @@
 
 
 echo $ac_n "checking for working strcoll""... $ac_c" 1>&6
-echo "configure:1543: checking for working strcoll" >&5
+echo "configure:1545: checking for working strcoll" >&5
 if eval "test \"`echo '$''{'ac_cv_func_strcoll_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1547,7 +1549,7 @@
   ac_cv_func_strcoll_works=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 1551 "configure"
+#line 1553 "configure"
 #include "confdefs.h"
 #include <string.h>
 main ()
@@ -1557,7 +1559,7 @@
 	strcoll ("123", "456") >= 0);
 }
 EOF
-if { (eval echo configure:1561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_strcoll_works=yes
 else
@@ -1586,17 +1588,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1590: checking for $ac_hdr" >&5
+echo "configure:1592: 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 1595 "configure"
+#line 1597 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1600: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1602: \"$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*
@@ -1625,13 +1627,13 @@
 
 
 echo $ac_n "checking for type of signal functions""... $ac_c" 1>&6
-echo "configure:1629: checking for type of signal functions" >&5
+echo "configure:1631: checking for type of signal functions" >&5
 if eval "test \"`echo '$''{'bash_cv_signal_vintage'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
   cat > conftest.$ac_ext <<EOF
-#line 1635 "configure"
+#line 1637 "configure"
 #include "confdefs.h"
 #include <signal.h>
 int main() {
@@ -1644,7 +1646,7 @@
   
 ; return 0; }
 EOF
-if { (eval echo configure:1648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   bash_cv_signal_vintage=posix
 else
@@ -1653,7 +1655,7 @@
   rm -rf conftest*
   
     cat > conftest.$ac_ext <<EOF
-#line 1657 "configure"
+#line 1659 "configure"
 #include "confdefs.h"
 #include <signal.h>
 int main() {
@@ -1663,7 +1665,7 @@
     
 ; return 0; }
 EOF
-if { (eval echo configure:1667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   bash_cv_signal_vintage=4.2bsd
 else
@@ -1672,7 +1674,7 @@
   rm -rf conftest*
   
       cat > conftest.$ac_ext <<EOF
-#line 1676 "configure"
+#line 1678 "configure"
 #include "confdefs.h"
 
 	#include <signal.h>
@@ -1685,7 +1687,7 @@
         
 ; return 0; }
 EOF
-if { (eval echo configure:1689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   bash_cv_signal_vintage=svr3
 else
@@ -1726,7 +1728,7 @@
 
 
 echo $ac_n "checking if signal handlers must be reinstalled when invoked""... $ac_c" 1>&6
-echo "configure:1730: checking if signal handlers must be reinstalled when invoked" >&5
+echo "configure:1732: checking if signal handlers must be reinstalled when invoked" >&5
 if eval "test \"`echo '$''{'bash_cv_must_reinstall_sighandlers'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1736,7 +1738,7 @@
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 1740 "configure"
+#line 1742 "configure"
 #include "confdefs.h"
 
 #include <signal.h>
@@ -1783,7 +1785,7 @@
 }
 
 EOF
-if { (eval echo configure:1787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   bash_cv_must_reinstall_sighandlers=no
 else
@@ -1808,7 +1810,7 @@
 
 
 echo $ac_n "checking for presence of POSIX-style sigsetjmp/siglongjmp""... $ac_c" 1>&6
-echo "configure:1812: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5
+echo "configure:1814: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5
 if eval "test \"`echo '$''{'bash_cv_func_sigsetjmp'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1818,7 +1820,7 @@
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 1822 "configure"
+#line 1824 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_UNISTD_H
@@ -1859,7 +1861,7 @@
 #endif
 }
 EOF
-if { (eval echo configure:1863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   bash_cv_func_sigsetjmp=present
 else
@@ -1882,12 +1884,12 @@
 fi
 
 echo $ac_n "checking for lstat""... $ac_c" 1>&6
-echo "configure:1886: checking for lstat" >&5
+echo "configure:1888: checking for lstat" >&5
 if eval "test \"`echo '$''{'bash_cv_func_lstat'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1891 "configure"
+#line 1893 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -1897,7 +1899,7 @@
  lstat(".",(struct stat *)0); 
 ; return 0; }
 EOF
-if { (eval echo configure:1901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   bash_cv_func_lstat=yes
 else
@@ -1918,12 +1920,12 @@
 fi
 
 echo $ac_n "checking whether programs are able to redeclare getpw functions""... $ac_c" 1>&6
-echo "configure:1922: checking whether programs are able to redeclare getpw functions" >&5
+echo "configure:1924: checking whether programs are able to redeclare getpw functions" >&5
 if eval "test \"`echo '$''{'bash_cv_can_redecl_getpw'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1927 "configure"
+#line 1929 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <pwd.h>
@@ -1934,7 +1936,7 @@
 struct passwd *z; z = getpwent(); z = getpwuid(0); z = getpwnam("root");
 ; return 0; }
 EOF
-if { (eval echo configure:1938: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1940: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_can_redecl_getpw=yes
 else
@@ -1956,7 +1958,7 @@
 
 
 echo $ac_n "checking whether or not strcoll and strcmp differ""... $ac_c" 1>&6
-echo "configure:1960: checking whether or not strcoll and strcmp differ" >&5
+echo "configure:1962: checking whether or not strcoll and strcmp differ" >&5
 if eval "test \"`echo '$''{'bash_cv_func_strcoll_broken'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1966,7 +1968,7 @@
 
 else
   cat > conftest.$ac_ext <<EOF
-#line 1970 "configure"
+#line 1972 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -2005,7 +2007,7 @@
 }
 
 EOF
-if { (eval echo configure:2009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   bash_cv_func_strcoll_broken=yes
 else
@@ -2029,12 +2031,12 @@
 
 
 echo $ac_n "checking whether signal handlers are of type void""... $ac_c" 1>&6
-echo "configure:2033: checking whether signal handlers are of type void" >&5
+echo "configure:2035: checking whether signal handlers are of type void" >&5
 if eval "test \"`echo '$''{'bash_cv_void_sighandler'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2038 "configure"
+#line 2040 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -2049,7 +2051,7 @@
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:2053: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2055: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_void_sighandler=yes
 else
@@ -2069,12 +2071,12 @@
 fi
 
 echo $ac_n "checking for TIOCGWINSZ in sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:2073: checking for TIOCGWINSZ in sys/ioctl.h" >&5
+echo "configure:2075: checking for TIOCGWINSZ in sys/ioctl.h" >&5
 if eval "test \"`echo '$''{'bash_cv_tiocgwinsz_in_ioctl'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2078 "configure"
+#line 2080 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ioctl.h>
@@ -2082,7 +2084,7 @@
 int x = TIOCGWINSZ;
 ; return 0; }
 EOF
-if { (eval echo configure:2086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_tiocgwinsz_in_ioctl=yes
 else
@@ -2103,12 +2105,12 @@
 fi
 
 echo $ac_n "checking for TIOCSTAT in sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:2107: checking for TIOCSTAT in sys/ioctl.h" >&5
+echo "configure:2109: checking for TIOCSTAT in sys/ioctl.h" >&5
 if eval "test \"`echo '$''{'bash_cv_tiocstat_in_ioctl'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2112 "configure"
+#line 2114 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ioctl.h>
@@ -2116,7 +2118,7 @@
 int x = TIOCSTAT;
 ; return 0; }
 EOF
-if { (eval echo configure:2120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_tiocstat_in_ioctl=yes
 else
@@ -2137,12 +2139,12 @@
 fi
 
 echo $ac_n "checking for FIONREAD in sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:2141: checking for FIONREAD in sys/ioctl.h" >&5
+echo "configure:2143: checking for FIONREAD in sys/ioctl.h" >&5
 if eval "test \"`echo '$''{'bash_cv_fionread_in_ioctl'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2146 "configure"
+#line 2148 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ioctl.h>
@@ -2150,7 +2152,7 @@
 int x = FIONREAD;
 ; return 0; }
 EOF
-if { (eval echo configure:2154: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2156: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_fionread_in_ioctl=yes
 else
@@ -2171,19 +2173,19 @@
 fi
 
 echo $ac_n "checking for speed_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:2175: checking for speed_t in sys/types.h" >&5
+echo "configure:2177: checking for speed_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'bash_cv_speed_t_in_sys_types'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2180 "configure"
+#line 2182 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int main() {
 speed_t x;
 ; return 0; }
 EOF
-if { (eval echo configure:2187: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_speed_t_in_sys_types=yes
 else
@@ -2204,12 +2206,12 @@
 fi
 
 echo $ac_n "checking for struct winsize in sys/ioctl.h and termios.h""... $ac_c" 1>&6
-echo "configure:2208: checking for struct winsize in sys/ioctl.h and termios.h" >&5
+echo "configure:2210: checking for struct winsize in sys/ioctl.h and termios.h" >&5
 if eval "test \"`echo '$''{'bash_cv_struct_winsize_header'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2213 "configure"
+#line 2215 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ioctl.h>
@@ -2217,7 +2219,7 @@
 struct winsize x;
 ; return 0; }
 EOF
-if { (eval echo configure:2221: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2223: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_struct_winsize_header=ioctl_h
 else
@@ -2225,7 +2227,7 @@
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 2229 "configure"
+#line 2231 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <termios.h>
@@ -2233,7 +2235,7 @@
 struct winsize x;
 ; return 0; }
 EOF
-if { (eval echo configure:2237: \"$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*
   bash_cv_struct_winsize_header=termios_h
 else
@@ -2266,12 +2268,12 @@
 
 
 echo $ac_n "checking if struct dirent has a d_ino member""... $ac_c" 1>&6
-echo "configure:2270: checking if struct dirent has a d_ino member" >&5
+echo "configure:2272: checking if struct dirent has a d_ino member" >&5
 if eval "test \"`echo '$''{'bash_cv_dirent_has_dino'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2275 "configure"
+#line 2277 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -2300,7 +2302,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2304: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2306: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_dirent_has_dino=yes
 else
@@ -2322,12 +2324,12 @@
 
 
 echo $ac_n "checking if struct dirent has a d_fileno member""... $ac_c" 1>&6
-echo "configure:2326: checking if struct dirent has a d_fileno member" >&5
+echo "configure:2328: checking if struct dirent has a d_fileno member" >&5
 if eval "test \"`echo '$''{'bash_cv_dirent_has_d_fileno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2331 "configure"
+#line 2333 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -2356,7 +2358,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2360: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2362: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bash_cv_dirent_has_d_fileno=yes
 else
@@ -2385,14 +2387,14 @@
 _bash_needmsg=yes
 else
 echo $ac_n "checking which library has the termcap functions""... $ac_c" 1>&6
-echo "configure:2389: checking which library has the termcap functions" >&5
+echo "configure:2391: checking which library has the termcap functions" >&5
 _bash_needmsg=
 fi
 if eval "test \"`echo '$''{'bash_cv_termcap_lib'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
-echo "configure:2396: checking for tgetent in -ltermcap" >&5
+echo "configure:2398: checking for tgetent in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2400,7 +2402,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2404 "configure"
+#line 2406 "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
@@ -2411,7 +2413,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:2415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2417: \"$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
@@ -2430,7 +2432,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6
-echo "configure:2434: checking for tgetent in -lcurses" >&5
+echo "configure:2436: checking for tgetent in -lcurses" >&5
 ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2438,7 +2440,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2442 "configure"
+#line 2444 "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
@@ -2449,7 +2451,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:2453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2455: \"$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
@@ -2468,7 +2470,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6
-echo "configure:2472: checking for tgetent in -lncurses" >&5
+echo "configure:2474: checking for tgetent in -lncurses" >&5
 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2476,7 +2478,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2480 "configure"
+#line 2482 "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
@@ -2487,7 +2489,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:2491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2493: \"$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
@@ -2516,7 +2518,7 @@
 
 if test "X$_bash_needmsg" = "Xyes"; then
 echo $ac_n "checking which library has the termcap functions""... $ac_c" 1>&6
-echo "configure:2520: checking which library has the termcap functions" >&5
+echo "configure:2522: checking which library has the termcap functions" >&5
 fi
 echo "$ac_t""using $bash_cv_termcap_lib" 1>&6
 if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
@@ -2553,8 +2555,8 @@
 #
 if test -f ${srcdir}/support/shobj-conf; then
         echo $ac_n "checking configuration for building shared libraries""... $ac_c" 1>&6
-echo "configure:2557: checking configuration for building shared libraries" >&5
-        eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C ${CC} -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
+echo "configure:2559: checking configuration for building shared libraries" >&5
+        eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
         
         
         
@@ -2568,9 +2570,20 @@
 	
 	
         echo "$ac_t""$SHLIB_STATUS" 1>&6
+
+	# shared library versioning
+	# quoted for m4 so I can use character classes
+	SHLIB_MAJOR=`expr "$LIBVERSION" : '\([0-9]\)\..*'`
+	SHLIB_MINOR=`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`
+	
+	
 fi
 
-BUILD_DIR=`pwd`
+case "$host_os" in
+msdosdjgpp*)	BUILD_DIR=`pwd.exe` ;;	# to prevent //d/path/file
+*)		BUILD_DIR=`pwd` ;;
+esac
+
 
 
 
@@ -2748,6 +2761,8 @@
 s%@SHLIB_LIBSUFF@%$SHLIB_LIBSUFF%g
 s%@SHLIB_LIBVERSION@%$SHLIB_LIBVERSION%g
 s%@SHLIB_LIBS@%$SHLIB_LIBS%g
+s%@SHLIB_MAJOR@%$SHLIB_MAJOR%g
+s%@SHLIB_MINOR@%$SHLIB_MINOR%g
 s%@BUILD_DIR@%$BUILD_DIR%g
 s%@LOCAL_CFLAGS@%$LOCAL_CFLAGS%g
 s%@LOCAL_LDFLAGS@%$LOCAL_LDFLAGS%g
diff --git a/readline/configure.in b/readline/configure.in
index 9afdaa7..780b4df 100644
--- a/readline/configure.in
+++ b/readline/configure.in
@@ -4,8 +4,8 @@
 dnl report bugs to chet@po.cwru.edu
 dnl
 dnl Process this file with autoconf to produce a configure script.
-AC_REVISION([for Readline 4.0, version 2.14, from autoconf version] AC_ACVERSION)
-LIBVERSION=4.0
+AC_REVISION([for Readline 4.1, version 2.22, from autoconf version] AC_ACVERSION)
+LIBVERSION=4.1
 
 AC_INIT(readline.h)
 AC_CONFIG_HEADER(config.h)
@@ -32,6 +32,7 @@
 test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
 
 AC_PROG_CC
+dnl AC_AIX
 AC_MINIX
 
 dnl BEGIN changes for CYGNUS cross-building for Cygwin
@@ -91,7 +92,8 @@
 AC_HEADER_STAT
 AC_HEADER_DIRENT
 
-AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr setlocale lstat)
+AC_CHECK_FUNCS(lstat memmove putenv select setenv setlocale \
+		strcasecmp tcgetattr)
 
 AC_FUNC_STRCOLL
 
@@ -140,7 +142,7 @@
 #
 if test -f ${srcdir}/support/shobj-conf; then
         AC_MSG_CHECKING(configuration for building shared libraries)
-        eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C ${CC} -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
+        eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
         AC_SUBST(SHOBJ_CC)
         AC_SUBST(SHOBJ_CFLAGS)
         AC_SUBST(SHOBJ_LD)
@@ -154,9 +156,20 @@
 	AC_SUBST(SHLIB_LIBVERSION)
 	AC_SUBST(SHLIB_LIBS)
         AC_MSG_RESULT($SHLIB_STATUS)
+
+	# shared library versioning
+	# quoted for m4 so I can use character classes
+	SHLIB_MAJOR=[`expr "$LIBVERSION" : '\([0-9]\)\..*'`]
+	SHLIB_MINOR=[`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`]
+	AC_SUBST(SHLIB_MAJOR)
+	AC_SUBST(SHLIB_MINOR)
 fi
 
-BUILD_DIR=`pwd`
+case "$host_os" in
+msdosdjgpp*)	BUILD_DIR=`pwd.exe` ;;	# to prevent //d/path/file
+*)		BUILD_DIR=`pwd` ;;
+esac
+
 AC_SUBST(BUILD_DIR)
 
 AC_SUBST(CFLAGS)
diff --git a/readline/display.c b/readline/display.c
index 3215a94..9fff8cc 100644
--- a/readline/display.c
+++ b/readline/display.c
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -41,10 +41,9 @@
 
 #include <stdio.h>
 
-#if defined (__GO32__)
-#  include <go32.h>
-#  include <pc.h>
-#endif /* __GO32__ */
+#ifdef __MSDOS__
+# include <pc.h>
+#endif
 
 /* System-specific feature definitions and include files. */
 #include "rldefs.h"
@@ -56,48 +55,25 @@
 #include "readline.h"
 #include "history.h"
 
+#include "rlprivate.h"
+#include "xmalloc.h"
+
 #if !defined (strchr) && !defined (__STDC__)
 extern char *strchr (), *strrchr ();
 #endif /* !strchr && !__STDC__ */
 
-/* Global and pseudo-global variables and functions
-   imported from readline.c. */
-extern char *rl_prompt;
-extern int readline_echoing_p;
-
-extern int _rl_output_meta_chars;
-extern int _rl_horizontal_scroll_mode;
-extern int _rl_mark_modified_lines;
-extern int _rl_prefer_visible_bell;
-
-/* Variables and functions imported from terminal.c */
-extern void _rl_output_some_chars ();
-#ifdef _MINIX
-extern void _rl_output_character_function ();
-#else
-extern int _rl_output_character_function ();
+#if defined (HACK_TERMCAP_MOTION)
+extern char *term_forward_char;
 #endif
-extern int _rl_backspace ();
 
-extern char *term_clreol, *term_clrpag;
-extern char *term_im, *term_ic,  *term_ei, *term_DC;
-extern char *term_up, *term_dc, *term_cr, *term_IC;
-extern int screenheight, screenwidth, screenchars;
-extern int terminal_can_insert, _rl_term_autowrap;
-
-/* Pseudo-global functions (local to the readline library) exported
-   by this file. */
-void _rl_move_cursor_relative (), _rl_output_some_chars ();
-void _rl_move_vert ();
-void _rl_clear_to_eol (), _rl_clear_screen ();
-
-static void update_line (), space_to_eol ();
-static void delete_chars (), insert_some_chars ();
-static void cr ();
+static void update_line __P((char *, char *, int, int, int, int));
+static void space_to_eol __P((int));
+static void delete_chars __P((int));
+static void insert_some_chars __P((char *, int));
+static void cr __P((void));
 
 static int *inv_lbreaks, *vis_lbreaks;
-
-extern char *xmalloc (), *xrealloc ();
+static int inv_lbsize, vis_lbsize;
 
 /* Heuristic used to decide whether it is faster to move from CUR to NEW
    by backing up or outputting a carriage return and moving forward. */
@@ -190,7 +166,7 @@
 /* Expand the prompt string S and return the number of visible
    characters in *LP, if LP is not null.  This is currently more-or-less
    a placeholder for expansion.  LIP, if non-null is a place to store the
-   index of the last invisible character in ther eturned string. */
+   index of the last invisible character in the returned string. */
 
 /* Current implementation:
 	\001 (^A) start non-visible characters
@@ -250,6 +226,18 @@
   return ret;
 }
 
+/* Just strip out RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE from
+   PMT and return the rest of PMT. */
+char *
+_rl_strip_prompt (pmt)
+     char *pmt;
+{
+  char *ret;
+
+  ret = expand_prompt (pmt, (int *)NULL, (int *)NULL);
+  return ret;
+}
+
 /*
  * Expand the prompt string into the various display components, if
  * necessary.
@@ -307,6 +295,49 @@
     }
 }
 
+/* Initialize the VISIBLE_LINE and INVISIBLE_LINE arrays, and their associated
+   arrays of line break markers.  MINSIZE is the minimum size of VISIBLE_LINE
+   and INVISIBLE_LINE; if it is greater than LINE_SIZE, LINE_SIZE is
+   increased.  If the lines have already been allocated, this ensures that
+   they can hold at least MINSIZE characters. */
+static void
+init_line_structures (minsize)
+      int minsize;
+{
+  register int n;
+
+  if (invisible_line == 0)	/* initialize it */
+    {
+      if (line_size < minsize)
+	line_size = minsize;
+      visible_line = xmalloc (line_size);
+      invisible_line = xmalloc (line_size);
+    }
+  else if (line_size < minsize)	/* ensure it can hold MINSIZE chars */
+    {
+      line_size *= 2;
+      if (line_size < minsize)
+	line_size = minsize;
+      visible_line = xrealloc (visible_line, line_size);
+      invisible_line = xrealloc (invisible_line, line_size);
+    }
+
+  for (n = minsize; n < line_size; n++)
+    {
+      visible_line[n] = 0;
+      invisible_line[n] = 1;
+    }
+
+  if (vis_lbreaks == 0)
+    {
+      /* should be enough. */
+      inv_lbsize = vis_lbsize = 256;
+      inv_lbreaks = (int *)xmalloc (inv_lbsize * sizeof (int));
+      vis_lbreaks = (int *)xmalloc (vis_lbsize * sizeof (int));
+      inv_lbreaks[0] = vis_lbreaks[0] = 0;
+    }
+}
+  
 /* Basic redisplay algorithm. */
 void
 rl_redisplay ()
@@ -325,19 +356,7 @@
 
   if (invisible_line == 0)
     {
-      visible_line = xmalloc (line_size);
-      invisible_line = xmalloc (line_size);
-      for (in = 0; in < line_size; in++)
-	{
-	  visible_line[in] = 0;
-	  invisible_line[in] = 1;
-	}
-
-      /* should be enough, but then again, this is just for testing. */
-      inv_lbreaks = (int *)malloc (256 * sizeof (int));
-      vis_lbreaks = (int *)malloc (256 * sizeof (int));
-      inv_lbreaks[0] = vis_lbreaks[0] = 0;
-
+      init_line_structures (0);
       rl_on_new_line ();
     }
 
@@ -395,12 +414,13 @@
       else
 	{
 	  prompt_this_line++;
+	  pmtlen = prompt_this_line - rl_display_prompt;	/* temp var */
 	  if (forced_display)
 	    {
-	      _rl_output_some_chars (rl_display_prompt, prompt_this_line - rl_display_prompt);
+	      _rl_output_some_chars (rl_display_prompt, pmtlen);
 	      /* Make sure we are at column zero even after a newline,
 		 regardless of the state of terminal output processing. */
-	      if (prompt_this_line[-2] != '\r')
+	      if (pmtlen < 2 || prompt_this_line[-2] != '\r')
 		cr ();
 	    }
 	}
@@ -419,11 +439,25 @@
       wrap_offset = 0;
     }
 
+#define CHECK_INV_LBREAKS() \
+      do { \
+	if (newlines >= (inv_lbsize - 2)) \
+	  { \
+	    inv_lbsize *= 2; \
+	    inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
+	  } \
+      } while (0)
+	  
 #define CHECK_LPOS() \
       do { \
 	lpos++; \
 	if (lpos >= screenwidth) \
 	  { \
+	    if (newlines >= (inv_lbsize - 2)) \
+	      { \
+		inv_lbsize *= 2; \
+		inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
+	      } \
 	    inv_lbreaks[++newlines] = out; \
 	    lpos = 0; \
 	  } \
@@ -437,14 +471,13 @@
      contents of the command line? */
   while (lpos >= screenwidth)
     {
-#if 0
-      temp = ((newlines + 1) * screenwidth) - ((newlines == 0) ? wrap_offset : 0);
-#else
       /* XXX - possible fix from Darin Johnson <darin@acuson.com> for prompt
 	 string with invisible characters that is longer than the screen
-	 width. */
+	 width.  XXX - this doesn't work right if invisible characters have
+	 to be put on the second screen line -- it adds too much (the number
+	 of invisible chars after the screenwidth). */
       temp = ((newlines + 1) * screenwidth) + ((newlines == 0) ? wrap_offset : 0);
-#endif
+
       inv_lbreaks[++newlines] = temp;
       lpos -= screenwidth;
     }
@@ -477,6 +510,7 @@
 	      if (lpos + 4 >= screenwidth)
 		{
 		  temp = screenwidth - lpos;
+		  CHECK_INV_LBREAKS ();
 		  inv_lbreaks[++newlines] = out + temp;
 		  lpos = 4 - temp;
 		}
@@ -506,6 +540,7 @@
 	    {
 	      register int temp2;
 	      temp2 = screenwidth - lpos;
+	      CHECK_INV_LBREAKS ();
 	      inv_lbreaks[++newlines] = out + temp2;
 	      lpos = temp - temp2;
 	      while (out < newout)
@@ -522,6 +557,7 @@
       else if (c == '\n' && _rl_horizontal_scroll_mode == 0 && term_up && *term_up)
 	{
 	  line[out++] = '\0';	/* XXX - sentinel */
+	  CHECK_INV_LBREAKS ();
 	  inv_lbreaks[++newlines] = out;
 	  lpos = 0;
 	}
@@ -546,6 +582,7 @@
     }
 
   inv_botlin = lb_botlin = newlines;
+  CHECK_INV_LBREAKS ();
   inv_lbreaks[newlines+1] = out;
   cursor_linenum = lb_linenum;
 
@@ -776,11 +813,17 @@
   /* Swap visible and non-visible lines. */
   {
     char *temp = visible_line;
-    int *itemp = vis_lbreaks;
+    int *itemp = vis_lbreaks, ntemp = vis_lbsize;
+
     visible_line = invisible_line;
     invisible_line = temp;
+
     vis_lbreaks = inv_lbreaks;
     inv_lbreaks = itemp;
+
+    vis_lbsize = inv_lbsize;
+    inv_lbsize = ntemp;
+
     rl_display_fixed = 0;
     /* If we are displaying on a single line, and last_lmargin is > 0, we
        are not displaying any invisible characters, so set visible_wrap_offset
@@ -907,7 +950,7 @@
       putc ('\r', rl_outstream);
 #else
       tputs (term_cr, 1, _rl_output_character_function);
-#endif /* !__MSDOS__ */
+#endif
       _rl_output_some_chars (local_prompt, lendiff);
       _rl_last_c_pos = lendiff;
     }
@@ -1037,6 +1080,58 @@
   return 0;
 }
 
+/* Tell the update routines that we have moved onto a new line with the
+   prompt already displayed.  Code originally from the version of readline
+   distributed with CLISP. */
+int
+rl_on_new_line_with_prompt ()
+{
+  int prompt_size, i, l, real_screenwidth, newlines;
+  char *prompt_last_line;
+
+  /* Initialize visible_line and invisible_line to ensure that they can hold
+     the already-displayed prompt. */
+  prompt_size = strlen (rl_prompt) + 1;
+  init_line_structures (prompt_size);
+
+  /* Make sure the line structures hold the already-displayed prompt for
+     redisplay. */
+  strcpy (visible_line, rl_prompt);
+  strcpy (invisible_line, rl_prompt);
+
+  /* If the prompt contains newlines, take the last tail. */
+  prompt_last_line = strrchr (rl_prompt, '\n');
+  if (!prompt_last_line)
+    prompt_last_line = rl_prompt;
+
+  l = strlen (prompt_last_line);
+  _rl_last_c_pos = l;
+
+  /* Dissect prompt_last_line into screen lines. Note that here we have
+     to use the real screenwidth. Readline's notion of screenwidth might be
+     one less, see terminal.c. */
+  real_screenwidth = screenwidth + (_rl_term_autowrap ? 0 : 1);
+  _rl_last_v_pos = l / real_screenwidth;
+  /* If the prompt length is a multiple of real_screenwidth, we don't know
+     whether the cursor is at the end of the last line, or already at the
+     beginning of the next line. Output a newline just to be safe. */
+  if (l > 0 && (l % real_screenwidth) == 0)
+    _rl_output_some_chars ("\n", 1);
+  last_lmargin = 0;
+
+  newlines = 0; i = 0;
+  while (i <= l)
+    {
+      _rl_vis_botlin = newlines;
+      vis_lbreaks[newlines++] = i;
+      i += real_screenwidth;
+    }
+  vis_lbreaks[newlines] = l;
+  visible_wrap_offset = 0;
+
+  return 0;
+}
+
 /* Actually update the display, period. */
 int
 rl_forced_update_display ()
@@ -1094,8 +1189,6 @@
 	 That kind of control is for people who don't know what the
 	 data is underneath the cursor. */
 #if defined (HACK_TERMCAP_MOTION)
-      extern char *term_forward_char;
-
       if (term_forward_char)
 	for (i = _rl_last_c_pos; i < new; i++)
 	  tputs (term_forward_char, 1, _rl_output_character_function);
@@ -1122,31 +1215,33 @@
   if (_rl_last_v_pos == to || to > screenheight)
     return;
 
-#if defined (__GO32__)
-  {
-    int row, col;
-
-    i = fflush (rl_outstream);	/* make sure the cursor pos is current! */
-    ScreenGetCursor (&row, &col);
-    ScreenSetCursor ((row + to - _rl_last_v_pos), col);
-    delta = i;
-  }
-#else /* !__GO32__ */
-
   if ((delta = to - _rl_last_v_pos) > 0)
     {
       for (i = 0; i < delta; i++)
 	putc ('\n', rl_outstream);
+#if defined (__MSDOS__)
+      putc ('\r', rl_outstream);
+#else
       tputs (term_cr, 1, _rl_output_character_function);
+#endif
       _rl_last_c_pos = 0;
     }
   else
     {			/* delta < 0 */
+#ifdef __MSDOS__
+      int row, col;
+
+      i = fflush (rl_outstream); /* make sure the cursor pos is current! */
+      ScreenGetCursor (&row, &col);
+      ScreenSetCursor ((row + to - _rl_last_v_pos), col);
+      delta = i;
+#else /* !__MSDOS__ */
       if (term_up && *term_up)
 	for (i = 0; i < -delta; i++)
 	  tputs (term_up, 1, _rl_output_character_function);
+#endif /* !__MSDOS__ */
     }
-#endif /* !__GO32__ */
+
   _rl_last_v_pos = to;		/* Now TO is here */
 }
 
@@ -1354,11 +1449,12 @@
 _rl_clear_to_eol (count)
      int count;
 {
-#if !defined (__GO32__)
+#ifndef __MSDOS__
   if (term_clreol)
     tputs (term_clreol, 1, _rl_output_character_function);
-  else if (count)
-#endif /* !__GO32__ */
+  else
+#endif
+  if (count)
     space_to_eol (count);
 }
 
@@ -1386,8 +1482,8 @@
   if (term_clrpag)
     tputs (term_clrpag, 1, _rl_output_character_function);
   else
-#endif /* !__GO32__ */
     crlf ();
+#endif
 }
 
 /* Insert COUNT characters from STRING to the output stream. */
@@ -1396,21 +1492,9 @@
      char *string;
      int count;
 {
-#if defined (__GO32__)
-#ifndef __DJGPP__
-  int row, col, width;
-  char *row_start;
-
-  ScreenGetCursor (&row, &col);
-  width = ScreenCols ();
-  row_start = ScreenPrimary + (row * width);
-
-  memcpy (row_start + col + count, row_start + col, width - col - count);
-#endif /* !__DJGPP__ */
-  /* Place the text on the screen. */
+#ifdef __MSDOS__
   _rl_output_some_chars (string, count);
-#else /* !_GO32 */
-
+#else  /* !__MSDOS__ */
   /* If IC is defined, then we do not have to "enter" insert mode. */
   if (term_IC)
     {
@@ -1443,7 +1527,7 @@
       if (term_ei && *term_ei)
 	tputs (term_ei, 1, _rl_output_character_function);
     }
-#endif /* !__GO32__ */
+#endif /* !__MSDOS__ */
 }
 
 /* Delete COUNT characters from the display line. */
@@ -1451,22 +1535,10 @@
 delete_chars (count)
      int count;
 {
-#if !defined (__DJGPP__)
-#if defined (__GO32__)
-  int row, col, width;
-  char *row_start;
-
-  ScreenGetCursor (&row, &col);
-  width = ScreenCols ();
-  row_start = ScreenPrimary + (row * width);
-
-  memcpy (row_start + col, row_start + col + count, width - col - count);
-  memset (row_start + width - count, 0, count * 2);
-#else /* !_GO32 */
-
   if (count > screenwidth)	/* XXX */
     return;
 
+#ifndef __MSDOS__
   if (term_DC && *term_DC)
     {
       char *buffer;
@@ -1479,8 +1551,7 @@
 	while (count--)
 	  tputs (term_dc, 1, _rl_output_character_function);
     }
-#endif /* !__GO32__ */
-#endif /* !__DJGPP__ */
+#endif /* !__MSDOS__ */
 }
 
 void
@@ -1502,7 +1573,11 @@
   if (full_lines && _rl_term_autowrap && (VIS_LLEN(_rl_vis_botlin) == screenwidth))
     {
       char *last_line;
+#if 0
       last_line = &visible_line[inv_lbreaks[_rl_vis_botlin]];
+#else
+      last_line = &visible_line[vis_lbreaks[_rl_vis_botlin]];
+#endif
       _rl_move_cursor_relative (screenwidth - 1, last_line);
       _rl_clear_to_eol (0);
       putc (last_line[screenwidth - 1], rl_outstream);
@@ -1523,16 +1598,47 @@
       putc ('\r', rl_outstream);
 #else
       tputs (term_cr, 1, _rl_output_character_function);
-#endif /* !__MSDOS__ */
+#endif
       _rl_last_c_pos = 0;
     }
 }
 
+/* Redraw the last line of a multi-line prompt that may possibly contain
+   terminal escape sequences.  Called with the cursor at column 0 of the
+   line to draw the prompt on. */
+static void
+redraw_prompt (t)
+     char *t;
+{
+  char *oldp, *oldl, *oldlprefix;
+  int oldlen, oldlast, oldplen;
+
+  /* Geez, I should make this a struct. */
+  oldp = rl_display_prompt;
+  oldl = local_prompt;
+  oldlprefix = local_prompt_prefix;
+  oldlen = visible_length;
+  oldplen = prefix_length;
+  oldlast = last_invisible;
+
+  rl_display_prompt = t;
+  local_prompt = expand_prompt (t, &visible_length, &last_invisible);
+  local_prompt_prefix = (char *)NULL;
+  rl_forced_update_display ();
+
+  rl_display_prompt = oldp;
+  local_prompt = oldl;
+  local_prompt_prefix = oldlprefix;
+  visible_length = oldlen;
+  prefix_length = oldplen;
+  last_invisible = oldlast;
+}
+      
 /* Redisplay the current line after a SIGWINCH is received. */
 void
 _rl_redisplay_after_sigwinch ()
 {
-  char *t, *oldp, *oldl, *oldlprefix;
+  char *t;
 
   /* Clear the current line and put the cursor at column 0.  Make sure
      the right thing happens if we have wrapped to a new screen line. */
@@ -1542,7 +1648,7 @@
       putc ('\r', rl_outstream);
 #else
       tputs (term_cr, 1, _rl_output_character_function);
-#endif /* !__MSDOS__ */
+#endif
       _rl_last_c_pos = 0;
 #if defined (__MSDOS__)
       space_to_eol (screenwidth);
@@ -1565,17 +1671,7 @@
   /* Redraw only the last line of a multi-line prompt. */
   t = strrchr (rl_display_prompt, '\n');
   if (t)
-    {
-      oldp = rl_display_prompt;
-      oldl = local_prompt;
-      oldlprefix = local_prompt_prefix;
-      rl_display_prompt = ++t;
-      local_prompt = local_prompt_prefix = (char *)NULL;
-      rl_forced_update_display ();
-      rl_display_prompt = oldp;
-      local_prompt = oldl;
-      local_prompt_prefix = oldlprefix;
-    }
+    redraw_prompt (++t);
   else
     rl_forced_update_display ();
 }
@@ -1600,3 +1696,25 @@
   cr ();
   fflush (rl_outstream);
 }
+
+/* return the `current display line' of the cursor -- the number of lines to
+   move up to get to the first screen line of the current readline line. */
+int
+_rl_current_display_line ()
+{
+  int ret, nleft;
+
+  /* Find out whether or not there might be invisible characters in the
+     editing buffer. */
+  if (rl_display_prompt == rl_prompt)
+    nleft = _rl_last_c_pos - screenwidth - rl_visible_prompt_length;
+  else
+    nleft = _rl_last_c_pos - screenwidth;
+
+  if (nleft > 0)
+    ret = 1 + nleft / screenwidth;
+  else
+    ret = 0;
+
+  return ret;
+}
diff --git a/readline/doc/ChangeLog b/readline/doc/ChangeLog
index 3c26ae5..995c43a 100644
--- a/readline/doc/ChangeLog
+++ b/readline/doc/ChangeLog
@@ -1,3 +1,12 @@
+2000-07-09  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+        * Import of readline 4.1.
+
+        Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
+        inclusion in the gdb manual.
+
+        New file: rluserman.texinfo
+
 Tue Apr 18 15:43:52 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* readline.0: Delete.  Generated by Makefile, deleted by distclean
diff --git a/readline/doc/Makefile.in b/readline/doc/Makefile.in
index 1031472..4a38563 100644
--- a/readline/doc/Makefile.in
+++ b/readline/doc/Makefile.in
@@ -1,6 +1,23 @@
 # This makefile for Readline library documentation is in -*- text -*- mode.
 # Emacs likes it that way.
-top_srcdir = @top_srcdir@
+
+# Copyright (C) 1996 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 USA.
+
+topdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = .:@srcdir@
 
@@ -8,25 +25,33 @@
 infodir = @infodir@
 
 mandir = @mandir@
-man3dir = $(mandir)/man3
+manpfx = man
+
+man1ext = 1
+man1dir = $(mandir)/$(manpfx)$(man1ext)
+man3ext = 3
+man3dir = $(mandir)/$(manpfx)$(man3ext)
 
 SHELL = @MAKE_SHELL@
 RM = rm -f
 
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+
+BUILD_DIR = @BUILD_DIR@
 TEXINPUTDIR = $(srcdir)
 
-MAKEINFO    = makeinfo
+MAKEINFO    = LANGUAGE= makeinfo
 TEXI2DVI    = $(srcdir)/texi2dvi
 TEXI2HTML   = $(srcdir)/texi2html
 QUIETPS     = #set this to -q to shut up dvips
-DVIPS       = dvips -D 300 $(QUIETPS) -o $@     # tricky
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
+PAPERSIZE   = letter
+PSDPI       = 300	# I don't have any 600-dpi printers
+DVIPS       = dvips -D ${PSDPI} $(QUIETPS) -t ${PAPERSIZE} -o $@     # tricky
 
 RLSRC = $(srcdir)/rlman.texinfo $(srcdir)/rluser.texinfo \
-	$(srcdir)/rltech.texinfo $(srcdir)/manvers.texinfo
+	$(srcdir)/rltech.texinfo $(srcdir)/manvers.texinfo \
+	$(srcdir)/rluserman.texinfo
 HISTSRC = $(srcdir)/hist.texinfo $(srcdir)/hsuser.texinfo \
 	  $(srcdir)/hstech.texinfo $(srcdir)/manvers.texinfo
 
@@ -36,16 +61,15 @@
 # This should be a program that converts troff to postscript
 GROFF       = groff
 
-DVIOBJ = readline.dvi history.dvi
-INFOOBJ = readline.info history.info
-PSOBJ = readline.ps history.ps
-HTMLOBJ = readline.html history.html
-HTMLTOC = readline_toc.html history_toc.html
+DVIOBJ = readline.dvi history.dvi rluserman.dvi
+INFOOBJ = readline.info history.info rluserman.info
+PSOBJ = readline.ps history.ps rluserman.ps
+HTMLOBJ = readline.html history.html rluserman.html
 TEXTOBJ = readline.0
 
-INTERMEDIATE_OBJ = rlman.dvi hist.dvi
+INTERMEDIATE_OBJ = rlman.dvi hist.dvi rluserman.dvi
 
-CREATED_DOCS = $(DVIOBJ) $(INFOOBJ) $(PSOBJ) $(HTMLOBJ) $(HTMLTOC) $(TEXTOBJ)
+CREATED_DOCS = $(DVIOBJ) $(INFOOBJ) $(PSOBJ) $(HTMLOBJ) $(TEXTOBJ)
 
 .SUFFIXES:      .0 .3 .ps .txt .dvi
 
@@ -63,6 +87,12 @@
 readline.info: $(RLSRC)
 	$(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rlman.texinfo
 
+rluserman.dvi: $(RLSRC)
+	TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/rluserman.texinfo
+
+rluserman.info: $(RLSRC)
+	$(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rluserman.texinfo
+
 history.dvi: ${HISTSRC}
 	TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/hist.texinfo
 	mv hist.dvi history.dvi
@@ -74,18 +104,25 @@
 	$(RM) $@
 	$(DVIPS) readline.dvi
 
+rluserman.ps:	rluserman.dvi
+	$(RM) $@
+	$(DVIPS) rluserman.dvi
+
 history.ps:	history.dvi
 	$(RM) $@
 	$(DVIPS) history.dvi
 
 readline.html:	${RLSRC}
 	$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/rlman.texinfo
-	sed -e 's:rlman.html:readline.html:' rlman.html > readline.html
+	sed -e 's:rlman.html:readline.html:g' rlman.html > readline.html
 	$(RM) rlman.html
 
+rluserman.html:	${RLSRC}
+	$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/rluserman.texinfo
+
 history.html:	${HISTSRC}
 	$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/hist.texinfo
-	sed -e 's:hist.html:history.html:' hist.html > history.html
+	sed -e 's:hist.html:history.html:g' hist.html > history.html
 	$(RM) hist.html
 
 info:	$(INFOOBJ)
@@ -98,7 +135,7 @@
 
 clean:
 	$(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
-	      *.fns *.kys *.tps *.vrs *.o core
+	      *.fns *.kys *.tps *.vrs *.bt *.bts *.o core
 
 distclean: clean
 	$(RM) $(CREATED_DOCS)
@@ -112,8 +149,8 @@
 	$(RM) $(INTERMEDIATE_OBJ)
 	$(RM) Makefile
 
-installdirs:	$(top_srcdir)/support/mkdirs
-	-$(SHELL) $(top_srcdir)/support/mkdirs $(infodir) $(man3dir)
+installdirs:	$(topdir)/support/mkdirs
+	-$(SHELL) $(topdir)/support/mkdirs $(infodir) $(man3dir)
 
 install:	installdirs
 	if test -f readline.info; then \
@@ -121,12 +158,17 @@
 	else \
 		${INSTALL_DATA} $(srcdir)/readline.info $(infodir)/readline.info; \
 	fi
+	if test -f rluserman.info; then \
+		${INSTALL_DATA} rluserman.info $(infodir)/rluserman.info; \
+	else \
+		${INSTALL_DATA} $(srcdir)/rluserman.info $(infodir)/rluserman.info; \
+	fi
 	if test -f history.info; then \
 		${INSTALL_DATA} history.info $(infodir)/history.info; \
 	else \
 		${INSTALL_DATA} $(srcdir)/history.info $(infodir)/history.info; \
 	fi
-	if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
+	-if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
 		install-info --dir-file=$(infodir)/dir $(infodir)/readline.info ; \
 		install-info --dir-file=$(infodir)/dir $(infodir)/history.info ; \
 	else true; fi
@@ -134,5 +176,6 @@
 
 uninstall:
 	$(RM) $(infodir)/readline.info
+	$(RM) $(infodir)/rluserman.info
 	$(RM) $(infodir)/history.info
 	$(RM) $(man3dir)/readline.3
diff --git a/readline/doc/hist.texinfo b/readline/doc/hist.texinfo
index 31a0ba0..8a9c941 100644
--- a/readline/doc/hist.texinfo
+++ b/readline/doc/hist.texinfo
@@ -55,8 +55,8 @@
 typed input.
 
 Published by the Free Software Foundation @*
-675 Massachusetts Avenue, @*
-Cambridge, MA 02139 USA
+59 Temple Place, Suite 330, @*
+Boston, MA 02111 USA
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
diff --git a/readline/doc/hstech.texinfo b/readline/doc/hstech.texinfo
index 5410090..12fff2c 100644
--- a/readline/doc/hstech.texinfo
+++ b/readline/doc/hstech.texinfo
@@ -66,6 +66,13 @@
 includes some history manipulation by default, and has the added
 advantage of command line editing.
 
+Before declaring any functions using any functionality the History
+library provides in other code, an application writer should include
+the file @code{<readline/history.h>} in any file that uses the
+History library's features.  It supplies extern declarations for all
+of the library's public functions and variables, and declares all of
+the public data structures.
+
 @node History Storage
 @section History Storage
 
@@ -334,7 +341,7 @@
 @item -1
 if there was an error in expansion;
 @item 2
-if the returned line should only be displayed, but not executed,
+if the returned line should be displayed, but not executed,
 as with the @code{:p} modifier (@pxref{Modifiers}).
 @end table
 
diff --git a/readline/doc/hsuser.texinfo b/readline/doc/hsuser.texinfo
index 7c4582d..5f75f5d 100644
--- a/readline/doc/hsuser.texinfo
+++ b/readline/doc/hsuser.texinfo
@@ -1,7 +1,7 @@
 @ignore
 This file documents the user interface to the GNU History library.
 
-Copyright (C) 1988, 1991, 1996 Free Software Foundation, Inc.
+Copyright (C) 1988-1999 Free Software Foundation, Inc.
 Authored by Brian Fox and Chet Ramey.
 
 Permission is granted to make and distribute verbatim copies of this manual
@@ -26,11 +26,16 @@
 @node Using History Interactively
 @chapter Using History Interactively
 
+@ifclear BashFeatures
+@defcodeindex bt
+@end ifclear
+
 @ifset BashFeatures
-This chapter describes how to use the GNU History Library interactively,
-from a user's standpoint.  It should be considered a user's guide.  For
-information on using the GNU History Library in other programs,
-see the GNU Readline Library Manual.
+This chapter describes how to use the @sc{gnu} History Library
+interactively, from a user's standpoint.
+It should be considered a user's guide.
+For information on using the @sc{gnu} History Library in other programs,
+see the @sc{gnu} Readline Library Manual.
 @end ifset
 @ifclear BashFeatures
 This chapter describes how to use the GNU History Library interactively,
@@ -63,20 +68,25 @@
 When the @samp{-o history} option to the @code{set} builtin
 is enabled (@pxref{The Set Builtin}),
 the shell provides access to the @var{command history},
-the list of commands previously typed.  The text of the last
-@code{HISTSIZE}
-commands (default 500) is saved in a history list.  The shell
-stores each command in the history list prior to parameter and
-variable expansion
+the list of commands previously typed.
+The value of the @code{HISTSIZE} shell variable is used as the
+number of commands to save in a history list.
+The text of the last @code{$HISTSIZE}
+commands (default 500) is saved.
+The shell stores each command in the history list prior to
+parameter and variable expansion
 but after history expansion is performed, subject to the
 values of the shell variables
 @code{HISTIGNORE} and @code{HISTCONTROL}.
+
 When the shell starts up, the history is initialized from the
 file named by the @code{HISTFILE} variable (default @file{~/.bash_history}).
-@code{HISTFILE} is truncated, if necessary, to contain no more than
-the number of lines specified by the value of the @code{HISTFILESIZE}
-variable.  When an interactive shell exits, the last
-@code{HISTSIZE} lines are copied from the history list to @code{HISTFILE}.
+The file named by the value of @code{HISTFILE} is truncated, if
+necessary, to contain no more than the number of lines specified by
+the value of the @code{HISTFILESIZE} variable.
+When an interactive shell exits, the last
+@code{$HISTSIZE} lines are copied from the history list to the file
+named by @code{$HISTFILE}.
 If the @code{histappend} shell option is set (@pxref{Bash Builtins}),
 the lines are appended to the history file,
 otherwise the history file is overwritten.
@@ -88,11 +98,11 @@
 
 The builtin command @code{fc} may be used to list or edit and re-execute
 a portion of the history list.
-The @code{history} builtin can be used to display or modify the history
+The @code{history} builtin may be used to display or modify the history
 list and manipulate the history file.
-When using the command-line editing, search commands
+When using command-line editing, search commands
 are available in each editing mode that provide access to the
-history list.
+history list (@pxref{Commands For History}).
 
 The shell allows control over which commands are saved on the history
 list.  The @code{HISTCONTROL} and @code{HISTIGNORE}
@@ -105,19 +115,20 @@
 The @code{lithist}
 shell option causes the shell to save the command with embedded newlines
 instead of semicolons.
+The @code{shopt} builtin is used to set these options.
 @xref{Bash Builtins}, for a description of @code{shopt}.
 
 @node Bash History Builtins
 @section Bash History Builtins
 @cindex history builtins
 
-Bash provides two builtin commands that allow you to manipulate the
+Bash provides two builtin commands which manipulate the
 history list and history file.
 
 @table @code
 
 @item fc
-@comment btindex fc
+@btindex fc
 @example
 @code{fc [-e @var{ename}] [-nlr] [@var{first}] [@var{last}]}
 @code{fc -s [@var{pat}=@var{rep}] [@var{command}]}
@@ -149,25 +160,29 @@
 and typing @samp{r} re-executes the last command (@pxref{Aliases}).
 
 @item history
-@comment btindex history
+@btindex history
 @example
-history [-c] [@var{n}]
+history [@var{n}]
+history -c
+history -d @var{offset}
 history [-anrw] [@var{filename}]
 history -ps @var{arg}
 @end example
 
-Display the history list with line numbers.  Lines prefixed with
-with a @samp{*} have been modified.  An argument of @var{n} says
-to list only the last @var{n} lines.  Options, if supplied, have
-the following meanings:
+With no options, display the history list with line numbers.
+Lines prefixed with with a @samp{*} have been modified.
+An argument of @var{n} lists only the last @var{n} lines.
+Options, if supplied, have the following meanings:
 
 @table @code
-@item -w
-Write out the current history to the history file.
+@item -c
+Clear the history list.  This may be combined
+with the other options to replace the history list completely.
 
-@item -r
-Read the current history file and append its contents to
-the history list.
+@item -d @var{offset}
+Delete the history entry at position @var{offset}.
+@var{offset} should be specified as it appears when the history is
+displayed.
 
 @item -a
 Append the new
@@ -179,20 +194,24 @@
 to the current history list.  These are lines appended to the history
 file since the beginning of the current Bash session.
 
-@item -c
-Clear the history list.  This may be combined
-with the other options to replace the history list completely.
+@item -r
+Read the current history file and append its contents to
+the history list.
+
+@item -w
+Write out the current history to the history file.
+
+@item -p
+Perform history substitution on the @var{arg}s and display the result
+on the standard output, without storing the results in the history list.
 
 @item -s
 The @var{arg}s are added to the end of
 the history list as a single entry.
 
-@item -p
-Perform history substitution on the @var{arg}s and display the result
-on the standard output, without storing the results in the history list.
 @end table
 
-When the @samp{-w}, @samp{-r}, @samp{-a}, or @samp{-n} option is
+When any of the @samp{-w}, @samp{-r}, @samp{-a}, or @samp{-n} options is
 used, if @var{filename}
 is given, then it is used as the history file.  If not, then
 the value of the @code{HISTFILE} variable is used.
@@ -309,6 +328,26 @@
 of the line, with the first word being denoted by 0 (zero).  Words are
 inserted into the current line separated by single spaces.
 
+@need 0.75
+For example,
+
+@table @code
+@item !!
+designates the preceding command.  When you type this, the preceding
+command is repeated in toto.
+
+@item !!:$
+designates the last argument of the preceding command.  This may be
+shortened to @code{!$}.
+
+@item !fi:2
+designates the second argument of the most recent command starting with
+the letters @code{fi}.
+@end table
+
+@need 0.75
+Here are the word designators:
+ 
 @table @code
 
 @item 0 (zero)
diff --git a/readline/doc/inc-hist.texinfo b/readline/doc/inc-hist.texinfo
index 06774b7..37ed15f 100644
--- a/readline/doc/inc-hist.texinfo
+++ b/readline/doc/inc-hist.texinfo
@@ -1,7 +1,7 @@
 @ignore
 This file documents the user interface to the GNU History library.
 
-Copyright (C) 1988, 1991, 1996 Free Software Foundation, Inc.
+Copyright (C) 1988-1999 Free Software Foundation, Inc.
 Authored by Brian Fox and Chet Ramey.
 
 Permission is granted to make and distribute verbatim copies of this manual
@@ -26,16 +26,21 @@
 @node Using History Interactively
 @chapter Using History Interactively
 
+@c @ifclear BashFeatures
+@c @defcodeindex bt
+@c @end ifclear
+
 @ifset BashFeatures
-This chapter describes how to use the GNU History Library interactively,
-from a user's standpoint.  It should be considered a user's guide.  For
-information on using the GNU History Library in other programs,
-see the GNU Readline Library Manual.
+This chapter describes how to use the @sc{gnu} History Library
+interactively, from a user's standpoint.
+It should be considered a user's guide.
+For information on using the @sc{gnu} History Library in other programs,
+see the @sc{gnu} Readline Library Manual.
 @end ifset
 @ifclear BashFeatures
 This chapter describes how to use the GNU History Library interactively,
-from a user's standpoint.  It should be considered a user's guide.  
-@c For
+from a user's standpoint.  It should be considered a user's guide.
+@c  For
 @c information on using the GNU History Library in your own programs,
 @c @pxref{Programming with GNU History}.
 @end ifclear
@@ -64,20 +69,25 @@
 When the @samp{-o history} option to the @code{set} builtin
 is enabled (@pxref{The Set Builtin}),
 the shell provides access to the @var{command history},
-the list of commands previously typed.  The text of the last
-@code{HISTSIZE}
-commands (default 500) is saved in a history list.  The shell
-stores each command in the history list prior to parameter and
-variable expansion
+the list of commands previously typed.
+The value of the @code{HISTSIZE} shell variable is used as the
+number of commands to save in a history list.
+The text of the last @code{$HISTSIZE}
+commands (default 500) is saved.
+The shell stores each command in the history list prior to
+parameter and variable expansion
 but after history expansion is performed, subject to the
 values of the shell variables
 @code{HISTIGNORE} and @code{HISTCONTROL}.
+
 When the shell starts up, the history is initialized from the
 file named by the @code{HISTFILE} variable (default @file{~/.bash_history}).
-@code{HISTFILE} is truncated, if necessary, to contain no more than
-the number of lines specified by the value of the @code{HISTFILESIZE}
-variable.  When an interactive shell exits, the last
-@code{HISTSIZE} lines are copied from the history list to @code{HISTFILE}.
+The file named by the value of @code{HISTFILE} is truncated, if
+necessary, to contain no more than the number of lines specified by
+the value of the @code{HISTFILESIZE} variable.
+When an interactive shell exits, the last
+@code{$HISTSIZE} lines are copied from the history list to the file
+named by @code{$HISTFILE}.
 If the @code{histappend} shell option is set (@pxref{Bash Builtins}),
 the lines are appended to the history file,
 otherwise the history file is overwritten.
@@ -89,11 +99,11 @@
 
 The builtin command @code{fc} may be used to list or edit and re-execute
 a portion of the history list.
-The @code{history} builtin can be used to display or modify the history
+The @code{history} builtin may be used to display or modify the history
 list and manipulate the history file.
-When using the command-line editing, search commands
+When using command-line editing, search commands
 are available in each editing mode that provide access to the
-history list.
+history list (@pxref{Commands For History}).
 
 The shell allows control over which commands are saved on the history
 list.  The @code{HISTCONTROL} and @code{HISTIGNORE}
@@ -106,19 +116,20 @@
 The @code{lithist}
 shell option causes the shell to save the command with embedded newlines
 instead of semicolons.
+The @code{shopt} builtin is used to set these options.
 @xref{Bash Builtins}, for a description of @code{shopt}.
 
 @node Bash History Builtins
 @section Bash History Builtins
 @cindex history builtins
 
-Bash provides two builtin commands that allow you to manipulate the
+Bash provides two builtin commands which manipulate the
 history list and history file.
 
 @table @code
 
 @item fc
-@c btindex fc
+@btindex fc
 @example
 @code{fc [-e @var{ename}] [-nlr] [@var{first}] [@var{last}]}
 @code{fc -s [@var{pat}=@var{rep}] [@var{command}]}
@@ -150,25 +161,29 @@
 and typing @samp{r} re-executes the last command (@pxref{Aliases}).
 
 @item history
-@c btindex history
+@btindex history
 @example
-history [-c] [@var{n}]
+history [@var{n}]
+history -c
+history -d @var{offset}
 history [-anrw] [@var{filename}]
 history -ps @var{arg}
 @end example
 
-Display the history list with line numbers.  Lines prefixed with
-with a @samp{*} have been modified.  An argument of @var{n} says
-to list only the last @var{n} lines.  Options, if supplied, have
-the following meanings:
+With no options, display the history list with line numbers.
+Lines prefixed with with a @samp{*} have been modified.
+An argument of @var{n} lists only the last @var{n} lines.
+Options, if supplied, have the following meanings:
 
 @table @code
-@item -w
-Write out the current history to the history file.
+@item -c
+Clear the history list.  This may be combined
+with the other options to replace the history list completely.
 
-@item -r
-Read the current history file and append its contents to
-the history list.
+@item -d @var{offset}
+Delete the history entry at position @var{offset}.
+@var{offset} should be specified as it appears when the history is
+displayed.
 
 @item -a
 Append the new
@@ -180,20 +195,24 @@
 to the current history list.  These are lines appended to the history
 file since the beginning of the current Bash session.
 
-@item -c
-Clear the history list.  This may be combined
-with the other options to replace the history list completely.
+@item -r
+Read the current history file and append its contents to
+the history list.
+
+@item -w
+Write out the current history to the history file.
+
+@item -p
+Perform history substitution on the @var{arg}s and display the result
+on the standard output, without storing the results in the history list.
 
 @item -s
 The @var{arg}s are added to the end of
 the history list as a single entry.
 
-@item -p
-Perform history substitution on the @var{arg}s and display the result
-on the standard output, without storing the results in the history list.
 @end table
 
-When the @samp{-w}, @samp{-r}, @samp{-a}, or @samp{-n} option is
+When any of the @samp{-w}, @samp{-r}, @samp{-a}, or @samp{-n} options is
 used, if @var{filename}
 is given, then it is used as the history file.  If not, then
 the value of the @code{HISTFILE} variable is used.
@@ -310,6 +329,26 @@
 of the line, with the first word being denoted by 0 (zero).  Words are
 inserted into the current line separated by single spaces.
 
+@need 0.75
+For example,
+
+@table @code
+@item !!
+designates the preceding command.  When you type this, the preceding
+command is repeated in toto.
+
+@item !!:$
+designates the last argument of the preceding command.  This may be
+shortened to @code{!$}.
+
+@item !fi:2
+designates the second argument of the most recent command starting with
+the letters @code{fi}.
+@end table
+
+@need 0.75
+Here are the word designators:
+ 
 @table @code
 
 @item 0 (zero)
diff --git a/readline/doc/manvers.texinfo b/readline/doc/manvers.texinfo
index 63924e3..3122b6c 100644
--- a/readline/doc/manvers.texinfo
+++ b/readline/doc/manvers.texinfo
@@ -1,6 +1,6 @@
-@set EDITION 4.0
-@set VERSION 4.0
-@set UPDATED 31 December 1998
-@set UPDATE-MONTH December 1998
+@set EDITION 4.1
+@set VERSION 4.1
+@set UPDATED 2000 January 19
+@set UPDATE-MONTH January 2000
 
-@set LASTCHANGE Thu Dec 31 10:17:05 EST 1998
+@set LASTCHANGE Wed Jan 19 12:16:30 EST 2000
diff --git a/readline/doc/readline.3 b/readline/doc/readline.3
index 6b36f2f..c1ed9cf 100644
--- a/readline/doc/readline.3
+++ b/readline/doc/readline.3
@@ -6,9 +6,9 @@
 .\"	Case Western Reserve University
 .\"	chet@ins.CWRU.Edu
 .\"
-.\"	Last Change: Thu Dec 31 10:16:30 EST 1998
+.\"	Last Change: Tue Jun  1 13:28:03 EDT 1999
 .\"
-.TH READLINE 3 "1998 Dec 31" GNU
+.TH READLINE 3 "1999 Jun 1" GNU
 .\"
 .\" File Name macro.  This used to be `.PN', for Path Name,
 .\" but Sun doesn't seem to like that very much.
@@ -148,6 +148,7 @@
 .IR SPACE ,
 and
 .IR TAB .
+.PP
 In addition to command names, readline allows keys to be bound
 to a string that is inserted when the key is pressed (a \fImacro\fP).
 .PP
@@ -564,7 +565,7 @@
 alphanumeric characters (letters and digits).
 .TP
 .B backward\-word (M\-b)
-Move back to the start of this, or the previous, word.  Words are
+Move back to the start of the current or previous word.  Words are
 composed of alphanumeric characters (letters and digits).
 .TP
 .B clear\-screen (C\-l)
@@ -1172,9 +1173,9 @@
 Individual \fBreadline\fP initialization file
 .PD
 .SH AUTHORS
-Brian Fox, Free Software Foundation (primary author)
+Brian Fox, Free Software Foundation
 .br
-bfox@ai.MIT.Edu
+bfox@gnu.org
 .PP
 Chet Ramey, Case Western Reserve University
 .br
diff --git a/readline/doc/rlman.texinfo b/readline/doc/rlman.texinfo
index 41bafbf..759f0eb 100644
--- a/readline/doc/rlman.texinfo
+++ b/readline/doc/rlman.texinfo
@@ -55,8 +55,8 @@
 to provide a command line interface.
 
 Published by the Free Software Foundation @*
-675 Massachusetts Avenue, @*
-Cambridge, MA 02139 USA
+59 Temple Place, Suite 330, @*
+Boston, MA 02111 USA
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
diff --git a/readline/doc/rltech.texinfo b/readline/doc/rltech.texinfo
index ea8d7f8..51c340a 100644
--- a/readline/doc/rltech.texinfo
+++ b/readline/doc/rltech.texinfo
@@ -167,6 +167,13 @@
 defined within the Readline library which allow a user program to add
 customized functionality to Readline.
 
+Before declaring any functions that customize Readline's behavior, or
+using any functionality Readline provides in other code, an
+application writer should include the file @code{<readline/readline.h>}
+in any file that uses Readline's features.  Since some of the definitions
+in @code{readline.h} use the @code{stdio} library, the file
+@code{<stdio.h>} should be included before @code{readline.h}.
+
 @menu
 * The Function Type::	C declarations to make code readable.
 * Function Writing::	Variables and calling conventions.
@@ -241,7 +248,9 @@
 
 @deftypevar {char *} rl_line_buffer
 This is the line gathered so far.  You are welcome to modify the
-contents of the line, but see @ref{Allowing Undoing}.
+contents of the line, but see @ref{Allowing Undoing}.  The
+function @code{rl_extend_line_buffer} is available to increase
+the memory allocated to @code{rl_line_buffer}.
 @end deftypevar
 
 @deftypevar int rl_point
@@ -282,6 +291,16 @@
 @code{readline ()}, and should not be assigned to directly.
 @end deftypevar
 
+@deftypevar int rl_already_prompted
+If an application wishes to display the prompt itself, rather than have
+Readline do it the first time @code{readline()} is called, it should set
+this variable to a non-zero value after displaying the prompt.
+The prompt must also be passed as the argument to @code{readline()} so
+the redisplay functions can update the display properly.
+The calling application is responsible for managing the value; Readline
+never sets it.
+@end deftypevar
+
 @deftypevar {char *} rl_library_version
 The version number of this revision of the library.
 @end deftypevar
@@ -447,6 +466,13 @@
 @code{emacs_standard_keymap} is the default, and the examples in
 this manual assume that.
 
+Since @code{readline} installs a set of default key bindings the first
+time it is called, there is always the danger that a custom binding
+installed before the first call to @code{readline} will be overridden.
+An alternate mechanism is to install custom key bindings in an
+initialization function assigned to the @code{rl_startup_hook} variable
+(@pxref{Readline Variables}).
+
 These functions manage key bindings.
 
 @deftypefun int rl_bind_key (int key, Function *function)
@@ -534,6 +560,12 @@
 Print the names of all bindable Readline functions to @code{rl_outstream}.
 @end deftypefun
 
+@deftypefun {char **} rl_funmap_names ()
+Return a NULL terminated array of known function names.  The array is
+sorted.  The array itself is allocated, but not the strings inside.  You
+should free () the array when you done, but not the pointrs.
+@end deftypefun
+
 @node Allowing Undoing
 @subsection Allowing Undoing
 
@@ -615,10 +647,19 @@
 @end deftypefun
 
 @deftypefun int rl_on_new_line ()
-Tell the update routines that we have moved onto a new (empty) line,
+Tell the update functions that we have moved onto a new (empty) line,
 usually after ouputting a newline.
 @end deftypefun
 
+@deftypefun int rl_on_new_line_with_prompt ()
+Tell the update functions that we have moved onto a new line, with
+@var{rl_prompt} already displayed.
+This could be used by applications that want to output the prompt string
+themselves, but still need Readline to know the prompt string length for
+redisplay.
+It should be used after setting @var{rl_already_prompted}.
+@end deftypefun
+
 @deftypefun int rl_reset_line_state ()
 Reset the display state to a clean state and redisplay the current line
 starting on a new line.
@@ -688,7 +729,7 @@
 @code{rl_read_key ()}.
 @end deftypefun
 
-@deftypefun rl_extend_line_buffer (int len)
+@deftypefun int rl_extend_line_buffer (int len)
 Ensure that @code{rl_line_buffer} has enough space to hold @var{len}
 characters, possibly reallocating it if necessary.
 @end deftypefun
@@ -700,6 +741,8 @@
 @deftypefun int rl_reset_terminal (char *terminal_name)
 Reinitialize Readline's idea of the terminal settings using
 @var{terminal_name} as the terminal type (e.g., @code{vt100}).
+If @var{terminal_name} is NULL, the value of the @code{TERM}
+environment variable is used.
 @end deftypefun
 
 @deftypefun int alphabetic (int c)
@@ -1106,7 +1149,7 @@
 
 @deftypevar {Function *} rl_completion_entry_function
 A pointer to the generator function for @code{completion_matches ()}.
-@code{NULL} means to use @code{filename_entry_function ()}, the default
+@code{NULL} means to use @code{filename_completion_function ()}, the default
 filename completer.
 @end deftypevar
 
diff --git a/readline/doc/rluser.texinfo b/readline/doc/rluser.texinfo
index 755f7ca..9f088ff 100644
--- a/readline/doc/rluser.texinfo
+++ b/readline/doc/rluser.texinfo
@@ -7,10 +7,10 @@
 This file documents the end user interface to the GNU command line
 editing features.  It is to be an appendix to manuals for programs which
 use these features.  There is a document entitled "readline.texinfo"
-which contains both end-user and programmer documentation for the GNU
-Readline Library.
+which contains both end-user and programmer documentation for the
+GNU Readline Library.
 
-Copyright (C) 1988, 1991, 1993, 1996 Free Software Foundation, Inc.
+Copyright (C) 1988-1999 Free Software Foundation, Inc.
 
 Authored by Brian Fox and Chet Ramey.
 
@@ -36,11 +36,19 @@
 @comment If you are including this manual as an appendix, then set the
 @comment variable readline-appendix.
 
+@ifclear BashFeatures
+@defcodeindex bt
+@end ifclear
+
 @node Command Line Editing
 @chapter Command Line Editing
 
-This chapter describes the basic features of the @sc{GNU}
+This chapter describes the basic features of the @sc{gnu}
 command line editing interface.
+@ifset BashFeatures
+Command line editing is provided by the Readline library, which is
+used by several different programs, including Bash.
+@end ifset
 
 @menu
 * Introduction and Notation::	Notation used in this text.
@@ -50,6 +58,12 @@
 				available for binding
 * Readline vi Mode::		A short description of how to make Readline
 				behave like the vi editor.
+@ifset BashFeatures
+* Programmable Completion::	How to specify the possible completions for
+				a specific command.
+* Programmable Completion Builtins::	Builtin commands to specify how to
+				complete arguments for a particular command.
+@end ifset
 @end menu
 
 @node Introduction and Notation
@@ -63,9 +77,19 @@
 is depressed.
 
 The text @key{M-k} is read as `Meta-K' and describes the character
-produced when the meta key (if you have one) is depressed, and the @key{k}
-key is pressed.  If you do not have a meta key, the identical keystroke
-can be generated by typing @key{ESC} @i{first}, and then typing @key{k}.
+produced when the Meta key (if you have one) is depressed, and the @key{k}
+key is pressed.
+The Meta key is labeled @key{ALT} on many keyboards.
+On keyboards with two keys labeled @key{ALT} (usually to either side of
+the space bar), the @key{ALT} on the left side is generally set to
+work as a Meta key.
+The @key{ALT} key on the right may also be configured to work as a
+Meta key or may be configured as some other modifier, such as a
+Compose key for typing accented characters.
+
+If you do not have a Meta or @key{ALT} key, or another key working as
+a Meta key, the identical keystroke can be generated by typing @key{ESC}
+@i{first}, and then typing @key{k}.
 Either process is known as @dfn{metafying} the @key{k} key.
 
 The text @key{M-C-k} is read as `Meta-Control-k' and describes the
@@ -75,6 +99,10 @@
 @key{DEL}, @key{ESC}, @key{LFD}, @key{SPC}, @key{RET}, and @key{TAB} all
 stand for themselves when seen in this text, or in an init file
 (@pxref{Readline Init File}).
+If your keyboard lacks a @key{LFD} key, typing @key{C-j} will
+produce the desired character.
+The @key{RET} key may be labeled @key{Return} or @key{Enter} on
+some keyboards.
 
 @node Readline Interaction
 @section Readline Interaction
@@ -110,8 +138,8 @@
 space to the right.  If you mistype a character, you can use your
 erase character to back up and delete the mistyped character.
 
-Sometimes you may miss typing a character that you wanted to type, and
-not notice your error until you have typed several other characters.  In
+Sometimes you may mistype a character, and
+not notice the error until you have typed several other characters.  In
 that case, you can type @key{C-b} to move the cursor to the left, and then
 correct your mistake.  Afterwards, you can move the cursor to the right
 with @key{C-f}.
@@ -120,7 +148,7 @@
 to the right of the cursor are `pushed over' to make room for the text
 that you have inserted.  Likewise, when you delete text behind the cursor,
 characters to the right of the cursor are `pulled back' to fill in the
-blank space created by the removal of the text.  A list of the basic bare
+blank space created by the removal of the text.  A list of the bare
 essentials for editing the text of an input line follows.
 
 @table @asis
@@ -128,22 +156,28 @@
 Move back one character.
 @item @key{C-f}
 Move forward one character.
-@item @key{DEL}
+@item @key{DEL} or @key{Backspace}
 Delete the character to the left of the cursor.
 @item @key{C-d}
 Delete the character underneath the cursor.
 @item @w{Printing characters}
 Insert the character into the line at the cursor.
-@item @key{C-_}
+@item @key{C-_} or @key{C-x C-u}
 Undo the last editing command.  You can undo all the way back to an
 empty line.
 @end table
 
+@noindent
+(Depending on your configuration, the @key{Backspace} key be set to
+delete the character to the left of the cursor and the @key{DEL} key set
+to delete the character underneath the cursor, like @key{C-d}, rather
+than the character to the left of the cursor.)
+
 @node Readline Movement Commands
 @subsection Readline Movement Commands
 
 
-The above table describes the most basic possible keystrokes that you need
+The above table describes the most basic keystrokes that you need
 in order to do editing of the input line.  For your convenience, many
 other commands have been added in addition to @key{C-b}, @key{C-f},
 @key{C-d}, and @key{DEL}.  Here are some commands for moving more rapidly
@@ -175,6 +209,8 @@
 @dfn{Killing} text means to delete the text from the line, but to save
 it away for later use, usually by @dfn{yanking} (re-inserting)
 it back into the line.
+(`Cut' and `paste' are more recent jargon for `kill' and `yank'.)
+
 If the description for a command says that it `kills' text, then you can
 be sure that you can get the text back in a different (or the same)
 place later.
@@ -194,12 +230,14 @@
 Kill the text from the current cursor position to the end of the line.
 
 @item M-d
-Kill from the cursor to the end of the current word, or if between
+Kill from the cursor to the end of the current word, or, if between
 words, to the end of the next word.
+Word boundaries are the same as those used by @key{M-f}.
 
 @item M-DEL
-Kill from the cursor the start of the previous word, or if between
+Kill from the cursor the start of the previous word, or, if between
 words, to the start of the previous word.
+Word boundaries are the same as those used by @key{M-b}.
 
 @item C-w
 Kill from the cursor to the previous whitespace.  This is different than
@@ -231,7 +269,7 @@
 
 The general way to pass numeric arguments to a command is to type meta
 digits before the command.  If the first `digit' typed is a minus
-sign (@key{-}), then the sign of the argument will be negative.  Once
+sign (@samp{-}), then the sign of the argument will be negative.  Once
 you have typed one meta digit to get the argument started, you can type
 the remainder of the digits, and then the command.  For example, to give
 the @key{C-d} command an argument of 10, you could type @samp{M-1 0 C-d}.
@@ -252,15 +290,18 @@
 the next entry from the history matching the string typed so far.
 An incremental search requires only as many characters as needed to
 find the desired history entry.
-The characters present in the value of the @var{isearch-terminators} variable
+To search backward in the history for a particular string, type
+@key{C-r}.  Typing @key{C-s} searches forward through the history.
+The characters present in the value of the @code{isearch-terminators} variable
 are used to terminate an incremental search.
 If that variable has not been assigned a value, the @key{ESC} and
 @key{C-J} characters will terminate an incremental search.
 @key{C-g} will abort an incremental search and restore the original line.
 When the search is terminated, the history entry containing the
 search string becomes the current line.
-To find other matching entries in the history list, type @key{C-s} or
-@key{C-r} as appropriate.
+
+To find other matching entries in the history list, type @key{C-r} or
+@key{C-s} as appropriate.
 This will search backward or forward in the history for the next
 entry matching the search string typed so far.
 Any other key sequence bound to a Readline command will terminate
@@ -276,11 +317,11 @@
 @section Readline Init File
 @cindex initialization file, readline
 
-Although the Readline library comes with a set of @code{emacs}-like
+Although the Readline library comes with a set of Emacs-like
 keybindings installed by default, it is possible to use a different set
 of keybindings.
 Any user can customize programs that use Readline by putting
-commands in an @dfn{inputrc} file in his home directory.
+commands in an @dfn{inputrc} file, conventionally in his home directory.
 The name of this
 @ifset BashFeatures
 file is taken from the value of the shell variable @code{INPUTRC}.  If
@@ -326,6 +367,11 @@
 set editing-mode vi
 @end example
 
+@ifset BashFeatures
+The @w{@code{bind -V}} command lists the current Readline variable names
+and values.  @xref{Bash Builtins}.
+@end ifset
+
 A great deal of run-time behavior is changeable with the following
 variables.
 
@@ -363,7 +409,7 @@
 @vindex convert-meta
 If set to @samp{on}, Readline will convert characters with the
 eighth bit set to an ASCII key sequence by stripping the eighth
-bit and prepending an @key{ESC} character, converting them to a
+bit and prefixing an @key{ESC} character, converting them to a
 meta-prefixed key sequence.  The default value is @samp{on}.
 
 @item disable-completion
@@ -469,7 +515,7 @@
 
 @item Key Bindings
 The syntax for controlling key bindings in the init file is
-simple.  First you have to know the name of the command that you
+simple.  First you need to find the name of the command that you
 want to change.  The following sections contain tables of the command
 name, the default keybinding, if any, and a short description of what
 the command does.
@@ -480,6 +526,12 @@
 can be expressed in different ways, depending on which is most
 comfortable for you.
 
+@ifset BashFeatures
+The @w{@code{bind -p}} command displays Readline function names and
+bindings in a format that can put directly into an initialization file.
+@xref{Bash Builtins}.
+@end ifset
+
 @table @asis
 @item @w{@var{keyname}: @var{function-name} or @var{macro}}
 @var{keyname} is the name of a key spelled out in English.  For example:
@@ -497,7 +549,7 @@
 @item @w{"@var{keyseq}": @var{function-name} or @var{macro}}
 @var{keyseq} differs from @var{keyname} above in that strings
 denoting an entire key sequence can be specified, by placing
-the key sequence in double quotes.  Some GNU Emacs style key
+the key sequence in double quotes.  Some @sc{gnu} Emacs style key
 escapes can be used, as in the following example, but the
 special character names are not recognized.
 
@@ -515,7 +567,7 @@
 
 @end table
 
-The following GNU Emacs style escape sequences are available when
+The following @sc{gnu} Emacs style escape sequences are available when
 specifying key sequences:
 
 @table @code
@@ -528,12 +580,12 @@
 @item @kbd{\\}
 backslash
 @item @kbd{\"}
-@key{"}
+@key{"}, a double quotation mark
 @item @kbd{\'}
-@key{'}
+@key{'}, a single quote or apostrophe
 @end table
 
-In addition to the GNU Emacs style escape sequences, a second
+In addition to the @sc{gnu} Emacs style escape sequences, a second
 set of backslash escapes is available:
 
 @table @code
@@ -554,10 +606,10 @@
 @item \v
 vertical tab
 @item \@var{nnn}
-the character whose ASCII code is the octal value @var{nnn}
+the character whose @code{ASCII} code is the octal value @var{nnn}
 (one to three digits)
 @item \x@var{nnn}
-the character whose ASCII code is the hexadecimal value @var{nnn}
+the character whose @code{ASCII} code is the hexadecimal value @var{nnn}
 (one to three digits)
 @end table
 
@@ -762,6 +814,17 @@
 
 This section describes Readline commands that may be bound to key
 sequences.
+@ifset BashFeatures
+You can list your key bindings by executing
+@w{@code{bind -P}} or, for a more terse format, suitable for an
+@var{inputrc} file, @w{@code{bind -p}}.  (@xref{Bash Builtins}.)
+@end ifset
+
+Command names without an accompanying key sequence are unbound by default.
+In the following descriptions, @var{point} refers to the current cursor
+position, and @var{mark} refers to a cursor position saved by the
+@code{set-mark} command.
+The text between the point and mark is referred to as the @var{region}.
 
 @node Commands For Moving
 @subsection Commands For Moving
@@ -783,7 +846,7 @@
 letters and digits.
 
 @item backward-word (M-b)
-Move back to the start of this, or the previous, word.  Words are
+Move back to the start of the current or previous word.  Words are
 composed of letters and digits.
 
 @item clear-screen (C-l)
@@ -846,9 +909,9 @@
 
 @item history-search-forward ()
 Search forward through the history for the string of characters
-between the start of the current line and the current cursor
-position (the @var{point}).  This is a non-incremental search.  By
-default, this command is unbound.
+between the start of the current line and the point.
+This is a non-incremental search.
+By default, this command is unbound.
 
 @item history-search-backward ()
 Search backward through the history for the string of characters
@@ -908,11 +971,11 @@
 cursor forward as well.  If the insertion point
 is at the end of the line, then this
 transposes the last two characters of the line.
-Negative arguments don't work.
+Negative arguments have no effect.
 
 @item transpose-words (M-t)
-Drag the word behind the cursor past the word in front of the cursor
-moving the cursor over that word as well.
+Drag the word before point past the word after point,
+moving point past that word as well.
 
 @item upcase-word (M-u)
 Uppercase the current (or following) word.  With a negative argument,
@@ -934,38 +997,36 @@
 @ftable @code
 
 @item kill-line (C-k)
-Kill the text from the current cursor position to the end of the line.
+Kill the text from point to the end of the line.
 
 @item backward-kill-line (C-x Rubout)
 Kill backward to the beginning of the line.
 
 @item unix-line-discard (C-u)
 Kill backward from the cursor to the beginning of the current line.
-The killed text is saved on the kill-ring.
 
 @item kill-whole-line ()
-Kill all characters on the current line, no matter where the
-cursor is.  By default, this is unbound.
+Kill all characters on the current line, no matter point is.
+By default, this is unbound.
 
 @item kill-word (M-d)
-Kill from the cursor to the end of the current word, or if between
-words, to the end of the next word.  Word boundaries are the same
-as @code{forward-word}.
+Kill from point to the end of the current word, or if between
+words, to the end of the next word.
+Word boundaries are the same as @code{forward-word}.
 
 @item backward-kill-word (M-DEL)
-Kill the word behind the cursor.  Word boundaries are the same
-as @code{backward-word}.
+Kill the word behind point.
+Word boundaries are the same as @code{backward-word}.
 
 @item unix-word-rubout (C-w)
-Kill the word behind the cursor, using white space as a word
-boundary.  The killed text is saved on the kill-ring.
+Kill the word behind point, using white space as a word boundary.
+The killed text is saved on the kill-ring.
 
 @item delete-horizontal-space ()
 Delete all spaces and tabs around point.  By default, this is unbound.
 
 @item kill-region ()
-Kill the text between the point and the @emph{mark} (saved
-cursor position).  This text is referred to as the @var{region}.
+Kill the text in the current region.
 By default, this command is unbound.
 
 @item copy-region-as-kill ()
@@ -1109,7 +1170,7 @@
 completion matches.
 
 @item complete-into-braces (M-@{)
-Perform filename completion and return the list of possible completions
+Perform filename completion and insert the list of possible completions
 enclosed within braces so the list is available to the shell
 (@pxref{Brace Expansion}).
 
@@ -1138,7 +1199,7 @@
 @ftable @code
 
 @item re-read-init-file (C-x C-r)
-Read in the contents of the inputrc file, and incorporate
+Read in the contents of the @var{inputrc} file, and incorporate
 any bindings or variable assignments found there.
 
 @item abort (C-g)
@@ -1192,7 +1253,8 @@
 variable is inserted at the beginning of the current line,
 and the line is accepted as if a newline had been typed.
 @ifset BashFeatures
-This makes the current line a shell comment.
+The default value of @code{comment-begin} causes this command
+to make the current line a shell comment.
 @end ifset
 
 @item dump-functions ()
@@ -1285,3 +1347,283 @@
 line with the standard @code{vi} movement keys, move to previous
 history lines with @samp{k} and subsequent lines with @samp{j}, and
 so forth.
+
+@ifset BashFeatures
+@node Programmable Completion
+@section Programmable Completion
+@cindex programmable completion
+
+When word completion is attempted for an argument to a command for
+which a completion specification (a @var{compspec}) has been defined
+using the @code{complete} builtin (@pxref{Programmable Completion Builtins}),
+the programmable completion facilities are invoked. 
+
+First, the command name is identified.
+If a compspec has been defined for that command, the
+compspec is used to generate the list of possible completions for the word.
+If the command word is a full pathname, a compspec for the full
+pathname is searched for first.
+If no compspec is found for the full pathname, an attempt is made to
+find a compspec for the portion following the final slash.
+
+Once a compspec has been found, it is used to generate the list of
+matching words.
+If a compspec is not found, the default Bash completion
+described above (@pxref{Commands For Completion}) is performed.
+
+First, the actions specified by the compspec are used.
+Only matches which are prefixed by the word being completed are
+returned.
+When the @samp{-f} or @samp{-d} option is used for filename or
+directory name completion, the shell variable @code{FIGNORE} is
+used to filter the matches.
+@xref{Bash Variables}, for a description of @code{FIGNORE}.
+
+Any completions specified by a filename expansion pattern to the
+@samp{-G} option are generated next.
+The words generated by the pattern need not match the word being completed.
+The @code{GLOBIGNORE} shell variable is not used to filter the matches,
+but the @code{FIGNORE} shell variable is used.
+
+Next, the string specified as the argument to the @samp{-W} option
+is considered.
+The string is first split using the characters in the @code{IFS}
+special variable as delimiters.
+Shell quoting is honored.
+Each word is then expanded using
+brace expansion, tilde expansion, parameter and variable expansion,
+command substitution, arithmetic expansion, and pathname expansion,
+as described above (@pxref{Shell Expansions}).
+The results are split using the rules described above
+(@pxref{Word Splitting}).
+The results of the expansion are prefix-matched against the word being
+completed, and the matching words become the possible completions.
+
+After these matches have been generated, any shell function or command
+specified with the @samp{-F} and @samp{-C} options is invoked.
+When the command or function is invoked, the @code{COMP_LINE} and
+@code{COMP_POINT} variables are assigned values as described above
+(@pxref{Bash Variables}).
+If a shell function is being invoked, the @code{COMP_WORDS} and
+@code{COMP_CWORD} variables are also set.
+When the function or command is invoked, the first argument is the
+name of the command whose arguments are being completed, the
+second argument is the word being completed, and the third argument
+is the word preceding the word being completed on the current command line.
+No filtering of the generated completions against the word being completed
+is performed; the function or command has complete freedom in generating
+the matches.
+
+Any function specified with @samp{-F} is invoked first.
+The function may use any of the shell facilities, including the
+@code{compgen} builtin described below
+(@pxref{Programmable Completion Builtins}), to generate the matches.
+It must put the possible completions in the @code{COMPREPLY} array
+variable.
+
+Next, any command specified with the @samp{-C} option is invoked
+in an environment equivalent to command substitution.
+It should print a list of completions, one per line, to
+the standard output.
+Backslash may be used to escape a newline, if necessary.
+
+After all of the possible completions are generated, any filter
+specified with the @samp{-X} option is applied to the list.
+The filter is a pattern as used for pathname expansion; a @samp{&}
+in the pattern is replaced with the text of the word being completed.
+A literal @samp{&} may be escaped with a backslash; the backslash
+is removed before attempting a match.
+Any completion that matches the pattern will be removed from the list.
+A leading @samp{!} negates the pattern; in this case any completion
+not matching the pattern will be removed.
+
+Finally, any prefix and suffix specified with the @samp{-P} and @samp{-S}
+options are added to each member of the completion list, and the result is
+returned to the Readline completion code as the list of possible
+completions.
+
+If a compspec is found, whatever it generates is returned to the completion
+code as the full set of possible completions.
+The default Bash completions are not attempted, and the Readline
+default of filename completion is disabled.
+
+@node Programmable Completion Builtins
+@section Programmable Completion Builtins
+@cindex completion builtins
+
+Two builtin commands are available to manipulate the programmable completion
+facilities.
+
+@table @code
+@item compgen
+@btindex compgen
+@example
+@code{compgen [@var{option}] [@var{word}]}
+@end example
+
+Generate possible completion matches for @var{word} according to
+the @var{option}s, which may be any option accepted by the
+@code{complete}
+builtin with the exception of @samp{-p} and @samp{-r}, and write
+the matches to the standard output.
+When using the @samp{-F} or @samp{-C} options, the various shell variables
+set by the programmable completion facilities, while available, will not
+have useful values.
+
+The matches will be generated in the same way as if the programmable
+completion code had generated them directly from a completion specification
+with the same flags.
+If @var{word} is specified, only those completions matching @var{word}
+will be displayed.
+
+The return value is true unless an invalid option is supplied, or no
+matches were generated.
+
+@item complete
+@btindex complete
+@example
+@code{complete [-abcdefjkvu] [-A @var{action}] [-G @var{globpat}] [-W @var{wordlist}]
+[-P @var{prefix}] [-S @var{suffix}] [-X @var{filterpat}] [-F @var{function}]
+[-C @var{command}] @var{name} [@var{name} @dots{}]}
+@code{complete -pr [@var{name} @dots{}]}
+@end example
+
+Specify how arguments to each @var{name} should be completed.
+If the @samp{-p} option is supplied, or if no options are supplied, existing
+completion specifications are printed in a way that allows them to be
+reused as input.
+The @samp{-r} option removes a completion specification for
+each @var{name}, or, if no @var{name}s are supplied, all
+completion specifications.
+
+The process of applying these completion specifications when word completion
+is attempted is described above (@pxref{Programmable Completion}).
+
+Other options, if specified, have the following meanings.
+The arguments to the @samp{-G}, @samp{-W}, and @samp{-X} options
+(and, if necessary, the @samp{-P} and @samp{-S} options)
+should be quoted to protect them from expansion before the
+@code{complete} builtin is invoked.
+
+@table @code
+@item -A @var{action}
+The @var{action} may be one of the following to generate a list of possible
+completions:
+
+@table @code
+@item alias
+Alias names.  May also be specified as @samp{-a}.
+
+@item arrayvar
+Array variable names.
+
+@item binding
+Readline key binding names (@pxref{Bindable Readline Commands}).
+
+@item builtin
+Names of shell builtin commands.  May also be specified as @samp{-b}.
+
+@item command
+Command names.  May also be specified as @samp{-c}.
+
+@item directory
+Directory names.  May also be specified as @samp{-d}.
+
+@item disabled
+Names of disabled shell builtins.
+
+@item enabled
+Names of enabled shell builtins.
+
+@item export
+Names of exported shell variables.  May also be specified as @samp{-e}.
+
+@item file
+File names.  May also be specified as @samp{-f}.
+
+@item function
+Names of shell functions.
+
+@item helptopic
+Help topics as accepted by the @code{help} builtin (@pxref{Bash Builtins}).
+
+@item hostname
+Hostnames, as taken from the file specified by the
+@code{HOSTFILE} shell variable (@pxref{Bash Variables}).
+
+@item job
+Job names, if job control is active.  May also be specified as @samp{-j}.
+
+@item keyword
+Shell reserved words.  May also be specified as @samp{-k}.
+
+@item running
+Names of running jobs, if job control is active.
+
+@item setopt
+Valid arguments for the @samp{-o} option to the @code{set} builtin
+(@pxref{The Set Builtin}).
+
+@item shopt
+Shell option names as accepted by the @code{shopt} builtin
+(@pxref{Bash Builtins}).
+
+@item signal
+Signal names.
+
+@item stopped
+Names of stopped jobs, if job control is active.
+
+@item user
+User names.  May also be specified as @samp{-u}.
+
+@item variable
+Names of all shell variables.  May also be specified as @samp{-v}.
+@end table
+
+@item -G @var{globpat}
+The filename expansion pattern @var{globpat} is expanded to generate
+the possible completions.
+
+@item -W @var{wordlist}
+The @var{wordlist} is split using the characters in the
+@code{IFS} special variable as delimiters, and each resultant word
+is expanded.
+The possible completions are the members of the resultant list which
+match the word being completed.
+
+@item -C @var{command}
+@var{command} is executed in a subshell environment, and its output is
+used as the possible completions.
+
+@item -F @var{function}
+The shell function @var{function} is executed in the current shell
+environment.
+When it finishes, the possible completions are retrieved from the value
+of the @code{COMPREPLY} array variable.
+
+@item -X @var{filterpat}
+@var{filterpat} is a pattern as used for filename expansion.
+It is applied to the list of possible completions generated by the
+preceding options and arguments, and each completion matching
+@var{filterpat} is removed from the list.
+A leading @samp{!} in @var{filterpat} negates the pattern; in this
+case, any completion not matching @var{filterpat} is removed.
+
+@item -P @var{prefix}
+@var{prefix} is added at the beginning of each possible completion
+after all other options have been applied.
+
+@item -S @var{suffix}
+@var{suffix} is appended to each possible completion
+after all other options have been applied.
+@end table
+
+The return value is true unless an invalid option is supplied, an option
+other than @samp{-p} or @samp{-r} is supplied without a @var{name}
+argument, an attempt is made to remove a completion specification for
+a @var{name} for which no specification exists, or
+an error occurs adding a completion specification.
+
+@end table
+@end ifset
diff --git a/readline/doc/rluserman.texinfo b/readline/doc/rluserman.texinfo
new file mode 100644
index 0000000..e6a3dcd
--- /dev/null
+++ b/readline/doc/rluserman.texinfo
@@ -0,0 +1,94 @@
+\input texinfo    @c -*-texinfo-*-
+@comment %**start of header (This is for running Texinfo on a region.)
+@setfilename rluserman.info
+@settitle GNU Readline Library
+@comment %**end of header (This is for running Texinfo on a region.)
+@setchapternewpage odd
+
+@include manvers.texinfo
+
+@ifinfo
+@dircategory Libraries
+@direntry
+* Readline: (readline).       The GNU readline library API
+@end direntry
+
+This document describes the end user interface of the GNU Readline Library,
+a utility which aids in the consistency of user interface across discrete
+programs that need to provide a command line interface.
+
+Copyright (C) 1988-1999 Free Software Foundation, Inc.
+
+Permission is granted to make and distribute verbatim copies of
+this manual provided the copyright notice and this permission notice
+pare 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 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,
+except that this permission notice may be stated in a translation approved
+by the Free Software Foundation.
+@end ifinfo
+
+@titlepage  
+@title GNU Readline Library User Interface
+@subtitle Edition @value{EDITION}, for @code{Readline Library} Version @value{VERSION}.
+@subtitle @value{UPDATE-MONTH}
+@author Brian Fox, Free Software Foundation
+@author Chet Ramey, Case Western Reserve University
+
+@page
+This document describes the end user interface of the GNU Readline Library,
+a utility which aids in the consistency of user interface across discrete
+programs that need to provide a command line interface.
+
+Published by the Free Software Foundation @*
+59 Temple Place, Suite 330, @*
+Boston, MA 02111 USA
+
+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 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,
+except that this permission notice may be stated in a translation approved
+by the Free Software Foundation.
+
+@vskip 0pt plus 1filll
+Copyright @copyright{} 1988-1999 Free Software Foundation, Inc.
+@end titlepage
+
+@ifinfo
+@node Top
+@top GNU Readline Library
+
+This document describes the end user interface of the GNU Readline Library,
+a utility which aids in the consistency of user interface across discrete
+programs that need to provide a command line interface.
+
+@menu
+* Command Line Editing::	   GNU Readline User's Manual.
+@end menu
+@end ifinfo
+
+@include rluser.texinfo
+
+@contents
+@bye
diff --git a/readline/emacs_keymap.c b/readline/emacs_keymap.c
index 4ba3858..daba213 100644
--- a/readline/emacs_keymap.c
+++ b/readline/emacs_keymap.c
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #if !defined (BUFSIZ)
 #include <stdio.h>
@@ -76,11 +76,7 @@
   { ISFUNC, rl_insert },	/* & */
   { ISFUNC, rl_insert },	/* ' */
   { ISFUNC, rl_insert },	/* ( */
-#if defined (PAREN_MATCHING)
-  { ISFUNC, rl_insert_close },	/* ) */
-#else
   { ISFUNC, rl_insert },	/* ) */
-#endif /* !PAREN_MATCHING */
   { ISFUNC, rl_insert },	/* * */
   { ISFUNC, rl_insert },	/* + */
   { ISFUNC, rl_insert },	/* , */
@@ -140,11 +136,7 @@
   /* Some more punctuation. */
   { ISFUNC, rl_insert },	/* [ */
   { ISFUNC, rl_insert },	/* \ */
-#if defined (PAREN_MATCHING)
-  { ISFUNC, rl_insert_close },	/* ] */
-#else
   { ISFUNC, rl_insert },	/* ] */
-#endif /* !PAREN_MATCHING */
   { ISFUNC, rl_insert },	/* ^ */
   { ISFUNC, rl_insert },	/* _ */
   { ISFUNC, rl_insert },	/* ` */
@@ -180,11 +172,7 @@
   /* Final punctuation. */
   { ISFUNC, rl_insert },	/* { */
   { ISFUNC, rl_insert },	/* | */
-#if defined (PAREN_MATCHING)
-  { ISFUNC, rl_insert_close },	/* } */
-#else
   { ISFUNC, rl_insert },	/* } */
-#endif /* !PAREN_MATCHING */
   { ISFUNC, rl_insert },	/* ~ */
   { ISFUNC, rl_rubout },	/* RUBOUT */
 
diff --git a/readline/examples/ChangeLog.Cygnus b/readline/examples/ChangeLog.Cygnus
new file mode 100644
index 0000000..43adfc1
--- /dev/null
+++ b/readline/examples/ChangeLog.Cygnus
@@ -0,0 +1,6 @@
+2000-07-09  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+        * Import of readline 4.1.
+
+        New files: excallback.c, rlfe.c.
+
diff --git a/readline/examples/Makefile.in b/readline/examples/Makefile.in
index 879aa49..7246e75 100644
--- a/readline/examples/Makefile.in
+++ b/readline/examples/Makefile.in
@@ -1,5 +1,22 @@
-# This is the Makefile for the examples subdirectory of readline. -*- text -*-
 #
+# This is the Makefile for the readline examples subdirectory.
+#
+# Copyright (C) 1994 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 USA.
+
 SHELL = @MAKE_SHELL@
 RM = rm -f
 
@@ -11,7 +28,7 @@
 DEFS = @DEFS@
 CC = @CC@
 CFLAGS = @CFLAGS@
-LOCAL_CFLAGS = @LOCAL_CFLAGS@
+LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DREADLINE_LIBRARY
 CPPFLAGS = @CPPFLAGS@
 
 INCLUDES = -I$(srcdir) -I$(top_srcdir) -I..
@@ -19,6 +36,9 @@
 CCFLAGS  = $(DEFS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(CFLAGS)
 LDFLAGS = -g -L..
 
+READLINE_LIB = ../libreadline.a
+HISTORY_LIB = ../libhistory.a
+
 TERMCAP_LIB = @TERMCAP_LIB@
 
 .c.o:
@@ -39,12 +59,12 @@
 rltest: rltest.o
 	$(CC) $(LDFLAGS) -o $@ rltest.o -lreadline $(TERMCAP_LIB)
 
-rlversion: rlversion.o
+rlversion: rlversion.o $(READLINE_LIB)
 	$(CC) $(LDFLAGS) -o $@ rlversion.o -lreadline $(TERMCAP_LIB)
 
 clean mostlyclean:
 	$(RM) $(OBJECTS)
-	$(RM) $(EXECUTABLES)
+	$(RM) $(EXECUTABLES) *.exe
 
 distclean maintainer-clean: clean
 	$(RM) Makefile
@@ -53,3 +73,13 @@
 rltest.o: rltest.c
 rl.o: rl.c
 rlversion.o: rlversion.c
+
+# Stuff for Per Bothner's `rlfe' program
+ 
+rlfe: rlfe.o $(READLINE_LIB) $(HISTORY_LIB)
+	$(CC) $(LDFLAGS) -o $@ rlfe.o -lreadline -lhistory ${TERMCAP_LIB}
+
+rlfe.o: rlfe.c
+
+rlfe.o: $(top_srcdir)/readline.h
+rlfe.o: $(top_srcdir)/history.h
diff --git a/readline/examples/excallback.c b/readline/examples/excallback.c
new file mode 100644
index 0000000..ca03fc3
--- /dev/null
+++ b/readline/examples/excallback.c
@@ -0,0 +1,186 @@
+/*
+From: Jeff Solomon <jsolomon@stanford.edu>
+Date: Fri,  9 Apr 1999 10:13:27 -0700 (PDT)
+To: chet@po.cwru.edu
+Subject: new readline example
+Message-ID: <14094.12094.527305.199695@mrclean.Stanford.EDU>
+
+Chet,
+
+I've been using readline 4.0. Specifically, I've been using the perl
+version Term::ReadLine::Gnu. It works great.
+
+Anyway, I've been playing around the alternate interface and I wanted
+to contribute a little C program, callback.c, to you that you could
+use as an example of the alternate interface in the /examples
+directory of the readline distribution.
+
+My example shows how, using the alternate interface, you can
+interactively change the prompt (which is very nice imo). Also, I
+point out that you must roll your own terminal setting when using the
+alternate interface because readline depreps (using your parlance) the
+terminal while in the user callback. I try to demostrate what I mean
+with an example. I've included the program below.
+
+To compile, I just put the program in the examples directory and made
+the appropriate changes to the EXECUTABLES and OBJECTS line and added
+an additional target 'callback'.
+
+I compiled on my Sun Solaris2.6 box using Sun's cc.
+
+Let me know what you think.
+
+Jeff
+*/
+
+#if defined (HAVE_CONFIG_H)
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <sys/types.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <termios.h>	/* xxx - should make this more general */
+
+#ifdef READLINE_LIBRARY
+#  include "readline.h"
+#else
+#  include <readline/readline.h>
+#endif
+
+/* This little examples demonstrates the alternate interface to using readline.
+ * In the alternate interface, the user maintains control over program flow and
+ * only calls readline when STDIN is readable. Using the alternate interface,
+ * you can do anything else while still using readline (like talking to a
+ * network or another program) without blocking.
+ *
+ * Specifically, this program highlights two importants features of the
+ * alternate interface. The first is the ability to interactively change the
+ * prompt, which can't be done using the regular interface since rl_prompt is
+ * read-only.
+ * 
+ * The second feature really highlights a subtle point when using the alternate
+ * interface. That is, readline will not alter the terminal when inside your
+ * callback handler. So let's so, your callback executes a user command that
+ * takes a non-trivial amount of time to complete (seconds). While your
+ * executing the command, the user continues to type keystrokes and expects them
+ * to be re-echoed on the new prompt when it returns. Unfortunately, the default
+ * terminal configuration doesn't do this. After the prompt returns, the user
+ * must hit one additional keystroke and then will see all of his previous
+ * keystrokes. To illustrate this, compile and run this program. Type "sleep" at
+ * the prompt and then type "bar" before the prompt returns (you have 3
+ * seconds). Notice how "bar" is re-echoed on the prompt after the prompt
+ * returns? This is what you expect to happen. Now comment out the 4 lines below
+ * the line that says COMMENT LINE BELOW. Recompile and rerun the program and do
+ * the same thing. When the prompt returns, you should not see "bar". Now type
+ * "f", see how "barf" magically appears? This behavior is un-expected and not
+ * desired.
+ */
+
+void process_line(char *line);
+int  change_prompt(void);
+char *get_prompt(void);
+
+int prompt = 1;
+char prompt_buf[40], line_buf[256];
+tcflag_t old_lflag;
+cc_t     old_vtime;
+struct termios term;
+
+int 
+main()
+{
+    fd_set fds;
+
+    /* Adjust the terminal slightly before the handler is installed. Disable
+     * canonical mode processing and set the input character time flag to be
+     * non-blocking.
+     */
+    if( tcgetattr(STDIN_FILENO, &term) < 0 ) {
+        perror("tcgetattr");
+        exit(1);
+    }
+    old_lflag = term.c_lflag;
+    old_vtime = term.c_cc[VTIME];
+    term.c_lflag &= ~ICANON;
+    term.c_cc[VTIME] = 1;
+    /* COMMENT LINE BELOW - see above */
+    if( tcsetattr(STDIN_FILENO, TCSANOW, &term) < 0 ) {
+        perror("tcsetattr");
+        exit(1);
+    }
+
+    rl_add_defun("change-prompt", change_prompt, CTRL('t'));
+    rl_callback_handler_install(get_prompt(), process_line);
+
+    while(1) {
+      FD_ZERO(&fds);
+      FD_SET(fileno(stdin), &fds);
+
+      if( select(FD_SETSIZE, &fds, NULL, NULL, NULL) < 0) {
+        perror("select");
+        exit(1);
+      }
+
+      if( FD_ISSET(fileno(stdin), &fds) ) {
+        rl_callback_read_char();
+      }
+    }
+}
+
+void
+process_line(char *line)
+{
+  if( line == NULL ) {
+    fprintf(stderr, "\n", line);
+
+    /* reset the old terminal setting before exiting */
+    term.c_lflag     = old_lflag;
+    term.c_cc[VTIME] = old_vtime;
+    if( tcsetattr(STDIN_FILENO, TCSANOW, &term) < 0 ) {
+        perror("tcsetattr");
+        exit(1);
+    }
+    exit(0);
+  }
+
+  if( strcmp(line, "sleep") == 0 ) {
+    sleep(3);
+  } else {
+    fprintf(stderr, "|%s|\n", line);
+  }
+}
+
+int
+change_prompt(void)
+{
+  /* toggle the prompt variable */
+  prompt = !prompt;
+
+  /* save away the current contents of the line */
+  strcpy(line_buf, rl_line_buffer);
+
+  /* install a new handler which will change the prompt and erase the current line */
+  rl_callback_handler_install(get_prompt(), process_line);
+
+  /* insert the old text on the new line */
+  rl_insert_text(line_buf);
+
+  /* redraw the current line - this is an undocumented function. It invokes the
+   * redraw-current-line command.
+   */
+  rl_refresh_line(0, 0);
+}
+
+char *
+get_prompt(void)
+{
+  /* The prompts can even be different lengths! */
+  sprintf(prompt_buf, "%s", 
+    prompt ? "Hit ctrl-t to toggle prompt> " : "Pretty cool huh?> ");
+  return prompt_buf;
+}
diff --git a/readline/examples/fileman.c b/readline/examples/fileman.c
index 0702a5b..dc29a40 100644
--- a/readline/examples/fileman.c
+++ b/readline/examples/fileman.c
@@ -1,22 +1,22 @@
 /* fileman.c -- A tiny application which demonstrates how to use the
    GNU Readline library.  This application interactively allows users
    to manipulate files and their modes. */
-/*
- * Remove the next line if you're compiling this against an installed
- * libreadline.a
- */
-#define READLINE_LIBRARY
 
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+#  include <config.h>
 #endif
 
 #include <sys/types.h>
 #ifdef HAVE_SYS_FILE_H
-#include <sys/file.h>
+#  include <sys/file.h>
 #endif
 #include <sys/stat.h>
 
+#ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+
+#include <fcntl.h>
 #include <stdio.h>
 #include <errno.h>
 
@@ -26,6 +26,10 @@
 #  include <strings.h>
 #endif /* !HAVE_STRING_H */
 
+#ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+#endif
+
 #ifdef READLINE_LIBRARY
 #  include "readline.h"
 #  include "history.h"
@@ -34,7 +38,6 @@
 #  include <readline/history.h>
 #endif
 
-extern char *getwd ();
 extern char *xmalloc ();
 
 /* The names of functions that actually do the manipulation. */
@@ -300,7 +303,12 @@
   if (!valid_argument ("view", arg))
     return 1;
 
+#if defined (__MSDOS__)
+  /* more.com doesn't grok slashes in pathnames */
+  sprintf (syscom, "less %s", arg);
+#else
   sprintf (syscom, "more %s", arg);
+#endif
   return (system (syscom));
 }
 
@@ -406,7 +414,7 @@
 {
   char dir[1024], *s;
 
-  s = getwd (dir);
+  s = getcwd (dir, sizeof(dir) - 1);
   if (s == 0)
     {
       printf ("Error getting pwd: %s\n", dir);
diff --git a/readline/examples/rl.c b/readline/examples/rl.c
index 17a6343..2d1d17e 100644
--- a/readline/examples/rl.c
+++ b/readline/examples/rl.c
@@ -2,15 +2,9 @@
  * rl - command-line interface to read a line from the standard input
  *      (or another fd) using readline.
  *
- * usage: rl [-p prompt] [-u unit] [-d default]
+ * usage: rl [-p prompt] [-u unit] [-d default] [-n nchars]
  */
 
-/*
- * Remove the next line if you're compiling this against an installed
- * libreadline.a
- */
-#define READLINE_LIBRARY
-
 #if defined (HAVE_CONFIG_H)
 #  include <config.h>
 #endif
@@ -18,8 +12,14 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include "posixstat.h"
-#include "readline.h"
-#include "history.h"
+
+#if defined (READLINE_LIBRARY)
+#  include "readline.h"
+#  include "history.h"
+#else
+#  include <readline/readline.h>
+#  include <readline/history.h>
+#endif
 
 extern int optind;
 extern char *optarg;
@@ -40,22 +40,24 @@
       deftext = (char *)NULL;
       rl_startup_hook = (Function *)NULL;
     }
+  return 0;
 }
 
 static void
 usage()
 {
-  fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default]\n",
+  fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default] [-n nchars]\n",
 		progname, progname);
 }
 
+int
 main (argc, argv)
      int argc;
      char **argv;
 {
   char *temp, *prompt;
   struct stat sb;
-  int opt, fd;
+  int opt, fd, nch;
   FILE *ifp;
 
   progname = strrchr(argv[0], '/');
@@ -66,10 +68,10 @@
 
   /* defaults */
   prompt = "readline$ ";
-  fd = 0;
+  fd = nch = 0;
   deftext = (char *)0;
 
-  while ((opt = getopt(argc, argv, "p:u:d:")) != EOF)
+  while ((opt = getopt(argc, argv, "p:u:d:n:")) != EOF)
     {
       switch (opt)
 	{
@@ -87,6 +89,14 @@
 	case 'd':
 	  deftext = optarg;
 	  break;
+	case 'n':
+	  nch = atoi(optarg);
+	  if (nch < 0)
+	    {
+	      fprintf (stderr, "%s: bad value for -n: `%s'\n", progname, optarg);
+	      exit (2);
+	    }
+	  break;
 	default:
 	  usage ();
 	  exit (2);
@@ -107,6 +117,9 @@
   if (deftext && *deftext)
     rl_startup_hook = set_deftext;
 
+  if (nch > 0)
+    rl_num_chars_to_read = nch;
+
   temp = readline (prompt);
 
   /* Test for EOF. */
diff --git a/readline/examples/rlfe.c b/readline/examples/rlfe.c
new file mode 100644
index 0000000..5c3c8fd
--- /dev/null
+++ b/readline/examples/rlfe.c
@@ -0,0 +1,685 @@
+/* A front-end using readline to "cook" input lines for Kawa.
+ *
+ * Copyright (C) 1999  Per Bothner
+ * 
+ * This front-end 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.
+ *
+ * Some code from Johnson & Troan: "Linux Application Development"
+ * (Addison-Wesley, 1998) was used directly or for inspiration.
+ */
+
+/* PROBLEMS/TODO:
+ *
+ * Only tested under Linux;  needs to be ported.
+ *
+ * When running mc -c under the Linux console, mc does not recognize
+ * mouse clicks, which mc does when not running under fep.
+ *
+ * Pasting selected text containing tabs is like hitting the tab character,
+ * which invokes readline completion.  We don't want this.  I don't know
+ * if this is fixable without integrating fep into a terminal emulator.
+ *
+ * Echo suppression is a kludge, but can only be avoided with better kernel
+ * support: We need a tty mode to disable "real" echoing, while still
+ * letting the inferior think its tty driver to doing echoing.
+ * Stevens's book claims SCR$ and BSD4.3+ have TIOCREMOTE.
+ *
+ * The latest readline may have some hooks we can use to avoid having
+ * to back up the prompt.
+ *
+ * Desirable readline feature:  When in cooked no-echo mode (e.g. password),
+ * echo characters are they are types with '*', but remove them when done.
+ *
+ * A synchronous output while we're editing an input line should be
+ * inserted in the output view *before* the input line, so that the
+ * lines being edited (with the prompt) float at the end of the input.
+ *
+ * A "page mode" option to emulate more/less behavior:  At each page of
+ * output, pause for a user command.  This required parsing the output
+ * to keep track of line lengths.  It also requires remembering the
+ * output, if we want an option to scroll back, which suggests that
+ * this should be integrated with a terminal emulator like xterm.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <signal.h>
+#include <netdb.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <grp.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <termios.h>
+
+#ifdef READLINE_LIBRARY
+#  include "readline.h"
+#  include "history.h"
+#else
+#  include <readline/readline.h>
+#  include <readline/history.h>
+#endif
+
+#ifndef COMMAND
+#define COMMAND "/bin/sh"
+#endif
+#ifndef COMMAND_ARGS
+#define COMMAND_ARGS COMMAND
+#endif
+
+#ifndef HAVE_MEMMOVE
+#  if __GNUC__ > 1
+#    define memmove(d, s, n)	__builtin_memcpy(d, s, n)
+#  else
+#    define memmove(d, s, n)	memcpy(d, s, n)
+#  endif
+#else
+#  define memmove(d, s, n)	memcpy(d, s, n)
+#endif
+
+#define APPLICATION_NAME "Fep"
+
+static int in_from_inferior_fd;
+static int out_to_inferior_fd;
+
+/* Unfortunately, we cannot safely display echo from the inferior process.
+   The reason is that the echo bit in the pty is "owned" by the inferior,
+   and if we try to turn it off, we could confuse the inferior.
+   Thus, when echoing, we get echo twice:  First readline echoes while
+   we're actually editing. Then we send the line to the inferior, and the
+   terminal driver send back an extra echo.
+   The work-around is to remember the input lines, and when we see that
+   line come back, we supress the output.
+   A better solution (supposedly available on SVR4) would be a smarter
+   terminal driver, with more flags ... */
+#define ECHO_SUPPRESS_MAX 1024
+char echo_suppress_buffer[ECHO_SUPPRESS_MAX];
+int echo_suppress_start = 0;
+int echo_suppress_limit = 0;
+
+#define DEBUG
+
+#ifdef DEBUG
+FILE *logfile = NULL;
+#define DPRINT0(FMT) (fprintf(logfile, FMT), fflush(logfile))
+#define DPRINT1(FMT, V1) (fprintf(logfile, FMT, V1), fflush(logfile))
+#define DPRINT2(FMT, V1, V2) (fprintf(logfile, FMT, V1, V2), fflush(logfile))
+#else
+#define DPRINT0(FMT) /* Do nothing */
+#define DPRINT1(FMT, V1) /* Do nothing */
+#define DPRINT2(FMT, V1, V2) /* Do nothing */
+#endif
+
+struct termios orig_term;
+
+/* Pid of child process. */
+static pid_t child = -1;
+
+static void
+sig_child (int signo)
+{
+  int status;
+  wait (&status);
+  DPRINT0 ("(Child process died.)\n");
+  tcsetattr(STDIN_FILENO, TCSANOW, &orig_term);
+  exit (0);
+}
+
+volatile int propagate_sigwinch = 0;
+
+/* sigwinch_handler
+ * propagate window size changes from input file descriptor to
+ * master side of pty.
+ */
+void sigwinch_handler(int signal) { 
+   propagate_sigwinch = 1;
+}
+
+/* get_master_pty() takes a double-indirect character pointer in which
+ * to put a slave name, and returns an integer file descriptor.
+ * If it returns < 0, an error has occurred.
+ * Otherwise, it has returned the master pty file descriptor, and fills
+ * in *name with the name of the corresponding slave pty.
+ * Once the slave pty has been opened, you are responsible to free *name.
+ */
+
+int get_master_pty(char **name) { 
+   int i, j;
+   /* default to returning error */
+   int master = -1;
+
+   /* create a dummy name to fill in */
+   *name = strdup("/dev/ptyXX");
+
+   /* search for an unused pty */
+   for (i=0; i<16 && master <= 0; i++) {
+      for (j=0; j<16 && master <= 0; j++) {
+         (*name)[5] = 'p';
+         (*name)[8] = "pqrstuvwxyzPQRST"[i];
+         (*name)[9] = "0123456789abcdef"[j];
+         /* open the master pty */
+         if ((master = open(*name, O_RDWR)) < 0) {
+            if (errno == ENOENT) {
+               /* we are out of pty devices */
+               free (*name);
+               return (master);
+            }
+         }
+         else {
+           /* By substituting a letter, we change the master pty
+            * name into the slave pty name.
+            */
+           (*name)[5] = 't';
+           if (access(*name, R_OK|W_OK) != 0)
+             {
+               close(master);
+               master = -1;
+             }
+         }
+      }
+   }
+   if ((master < 0) && (i == 16) && (j == 16)) {
+      /* must have tried every pty unsuccessfully */
+      free (*name);
+      return (master);
+   }
+
+   (*name)[5] = 't';
+
+   return (master);
+}
+
+/* get_slave_pty() returns an integer file descriptor.
+ * If it returns < 0, an error has occurred.
+ * Otherwise, it has returned the slave file descriptor.
+ */
+
+int get_slave_pty(char *name) { 
+   struct group *gptr;
+   gid_t gid;
+   int slave = -1;
+
+   /* chown/chmod the corresponding pty, if possible.
+    * This will only work if the process has root permissions.
+    * Alternatively, write and exec a small setuid program that
+    * does just this.
+    */
+   if ((gptr = getgrnam("tty")) != 0) {
+      gid = gptr->gr_gid;
+   } else {
+      /* if the tty group does not exist, don't change the
+       * group on the slave pty, only the owner
+       */
+      gid = -1;
+   }
+
+   /* Note that we do not check for errors here.  If this is code
+    * where these actions are critical, check for errors!
+    */
+   chown(name, getuid(), gid);
+   /* This code only makes the slave read/writeable for the user.
+    * If this is for an interactive shell that will want to
+    * receive "write" and "wall" messages, OR S_IWGRP into the
+    * second argument below.
+    */
+   chmod(name, S_IRUSR|S_IWUSR);
+
+   /* open the corresponding slave pty */
+   slave = open(name, O_RDWR);
+   return (slave);
+}
+
+/* Certain special characters, such as ctrl/C, we want to pass directly
+   to the inferior, rather than letting readline handle them. */
+
+static char special_chars[20];
+static int special_chars_count;
+
+static void
+add_special_char(int ch)
+{
+  if (ch != 0)
+    special_chars[special_chars_count++] = ch;
+}
+
+static int eof_char;
+
+static int
+is_special_char(int ch)
+{
+  int i;
+#if 0
+  if (ch == eof_char && rl_point == rl_end)
+    return 1;
+#endif
+  for (i = special_chars_count;  --i >= 0; )
+    if (special_chars[i] == ch)
+      return 1;
+  return 0;
+}
+
+static char buf[1024];
+/* buf[0 .. buf_count-1] is the what has been emitted on the current line.
+   It is used as the readline prompt. */
+static int buf_count = 0;
+
+int num_keys = 0;
+
+static void
+null_prep_terminal (int meta)
+{
+}
+
+static void
+null_deprep_terminal ()
+{
+}
+
+char pending_special_char;
+
+static void
+line_handler (char *line)
+{
+  if (line == NULL)
+    {
+      char buf[1];
+      DPRINT0("saw eof!\n");
+      buf[0] = '\004'; /* ctrl/d */
+      write (out_to_inferior_fd, buf, 1);
+    }
+  else
+    {
+      static char enter[] = "\r";
+      /*  Send line to inferior: */
+      int length = strlen (line);
+      if (length > ECHO_SUPPRESS_MAX-2)
+	{
+	  echo_suppress_start = 0;
+	  echo_suppress_limit = 0;
+	}
+      else
+	{
+	  if (echo_suppress_limit + length > ECHO_SUPPRESS_MAX - 2)
+	    {
+	      if (echo_suppress_limit - echo_suppress_start + length
+		  <= ECHO_SUPPRESS_MAX - 2)
+		{
+		  memmove (echo_suppress_buffer,
+			   echo_suppress_buffer + echo_suppress_start,
+			   echo_suppress_limit - echo_suppress_start);
+		  echo_suppress_limit -= echo_suppress_start;
+		  echo_suppress_start = 0;
+		}
+	      else
+		{
+		  echo_suppress_limit = 0;
+		}
+	      echo_suppress_start = 0;
+	    }
+	  memcpy (echo_suppress_buffer + echo_suppress_limit,
+		  line, length);
+	  echo_suppress_limit += length;
+	  echo_suppress_buffer[echo_suppress_limit++] = '\r';
+	  echo_suppress_buffer[echo_suppress_limit++] = '\n';
+	}
+      write (out_to_inferior_fd, line, length);
+      if (pending_special_char == 0)
+        {
+          write (out_to_inferior_fd, enter, sizeof(enter)-1);
+          if (*line)
+            add_history (line);
+        }
+      free (line);
+    }
+  rl_callback_handler_remove ();
+  buf_count = 0;
+  num_keys = 0;
+  if (pending_special_char != 0)
+    {
+      write (out_to_inferior_fd, &pending_special_char, 1);
+      pending_special_char = 0;
+    }
+}
+
+/* Value of rl_getc_function.
+   Use this because readline should read from stdin, not rl_instream,
+   points to the pty (so readline has monitor its terminal modes). */
+
+int
+my_rl_getc (FILE *dummy)
+{
+  int ch = rl_getc (stdin);
+  if (is_special_char (ch))
+    {
+      pending_special_char = ch;
+      return '\r';
+    }
+  return ch;
+}
+
+int
+main(int argc, char** argv)
+{
+  char *path;
+  int i;
+  int master;
+  char *name;
+  int in_from_tty_fd;
+  struct sigaction act;
+  struct winsize ws;
+  struct termios t;
+  int maxfd;
+  fd_set in_set;
+  static char empty_string[1] = "";
+  char *prompt = empty_string;
+  int ioctl_err = 0;
+
+#ifdef DEBUG
+  logfile = fopen("LOG", "w");
+#endif
+
+  rl_readline_name = APPLICATION_NAME;
+  
+  if ((master = get_master_pty(&name)) < 0)
+    {
+      perror("ptypair: could not open master pty");
+      exit(1);
+    }
+
+  DPRINT1("pty name: '%s'\n", name);
+
+  /* set up SIGWINCH handler */
+  act.sa_handler = sigwinch_handler;
+  sigemptyset(&(act.sa_mask));
+  act.sa_flags = 0;
+  if (sigaction(SIGWINCH, &act, NULL) < 0)
+    {
+      perror("ptypair: could not handle SIGWINCH ");
+      exit(1);
+    }
+
+  if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) < 0)
+    {
+      perror("ptypair: could not get window size");
+      exit(1);
+    }
+
+  if ((child = fork()) < 0)
+    {
+      perror("cannot fork");
+      exit(1);
+    }
+
+  if (child == 0)
+    { 
+      int slave;  /* file descriptor for slave pty */
+
+      /* We are in the child process */
+      close(master);
+
+#ifdef TIOCSCTTY
+      if ((slave = get_slave_pty(name)) < 0)
+	{
+	  perror("ptypair: could not open slave pty");
+	  exit(1);
+	}
+      free(name);
+#endif
+
+      /* We need to make this process a session group leader, because
+       * it is on a new PTY, and things like job control simply will
+       * not work correctly unless there is a session group leader
+       * and process group leader (which a session group leader
+       * automatically is). This also disassociates us from our old
+       * controlling tty. 
+       */
+      if (setsid() < 0)
+	{
+	  perror("could not set session leader");
+	}
+
+      /* Tie us to our new controlling tty. */
+#ifdef TIOCSCTTY
+      if (ioctl(slave, TIOCSCTTY, NULL))
+	{
+	  perror("could not set new controlling tty");
+	}
+#else
+      if ((slave = get_slave_pty(name)) < 0)
+	{
+	  perror("ptypair: could not open slave pty");
+	  exit(1);
+	}
+      free(name);
+#endif
+
+      /* make slave pty be standard in, out, and error */
+      dup2(slave, STDIN_FILENO);
+      dup2(slave, STDOUT_FILENO);
+      dup2(slave, STDERR_FILENO);
+
+      /* at this point the slave pty should be standard input */
+      if (slave > 2)
+	{
+	  close(slave);
+	}
+
+      /* Try to restore window size; failure isn't critical */
+      if (ioctl(STDOUT_FILENO, TIOCSWINSZ, &ws) < 0)
+	{
+	  perror("could not restore window size");
+	}
+
+      /* now start the shell */
+      {
+	static char* command_args[] = { COMMAND_ARGS, NULL };
+	if (argc <= 1)
+	  execvp(COMMAND, command_args);
+	else
+	  execvp(argv[1], &argv[1]);
+      }
+
+      /* should never be reached */
+      exit(1);
+    }
+
+  /* parent */
+  signal (SIGCHLD, sig_child);
+  free(name);
+
+  /* Note that we only set termios settings for standard input;
+   * the master side of a pty is NOT a tty.
+   */
+  tcgetattr(STDIN_FILENO, &orig_term);
+
+  t = orig_term;
+  eof_char = t.c_cc[VEOF];
+  /*  add_special_char(t.c_cc[VEOF]);*/
+  add_special_char(t.c_cc[VINTR]);
+  add_special_char(t.c_cc[VQUIT]);
+  add_special_char(t.c_cc[VSUSP]);
+#if defined (VDISCARD)
+  add_special_char(t.c_cc[VDISCARD]);
+#endif
+
+#if 0
+  t.c_lflag |= (ICANON | ISIG | ECHO | ECHOCTL | ECHOE | \
+		ECHOK | ECHOKE | ECHONL | ECHOPRT );
+#else
+  t.c_lflag &= ~(ICANON | ISIG | ECHO | ECHOCTL | ECHOE | \
+		 ECHOK | ECHOKE | ECHONL | ECHOPRT );
+#endif
+  t.c_iflag |= IGNBRK;
+  t.c_cc[VMIN] = 1;
+  t.c_cc[VTIME] = 0;
+  tcsetattr(STDIN_FILENO, TCSANOW, &t);
+  in_from_inferior_fd = master;
+  out_to_inferior_fd = master;
+  rl_instream = fdopen (master, "r");
+  rl_getc_function = my_rl_getc;
+
+  rl_prep_term_function = null_prep_terminal; 
+  rl_deprep_term_function = null_deprep_terminal; 
+  rl_callback_handler_install (prompt, line_handler);
+
+  in_from_tty_fd = STDIN_FILENO;
+  FD_ZERO (&in_set);
+  maxfd = in_from_inferior_fd > in_from_tty_fd ? in_from_inferior_fd
+    : in_from_tty_fd;
+  for (;;)
+    {
+      int num;
+      FD_SET (in_from_inferior_fd, &in_set);
+      FD_SET (in_from_tty_fd, &in_set);
+
+      num = select(maxfd+1, &in_set, NULL, NULL, NULL);
+
+      if (propagate_sigwinch)
+	{
+	  struct winsize ws;
+	  if (ioctl (STDIN_FILENO, TIOCGWINSZ, &ws) >= 0)
+	    {
+	      ioctl (master, TIOCSWINSZ, &ws);
+	    }
+	  propagate_sigwinch = 0;
+	  continue;
+	}
+
+      if (num <= 0)
+	{
+	  perror ("select");
+	  exit (-1);
+	}
+      if (FD_ISSET (in_from_tty_fd, &in_set))
+	{
+	  extern int readline_echoing_p;
+	  struct termios term_master;
+	  int do_canon = 1;
+	  int ioctl_ret;
+
+	  DPRINT1("[tty avail num_keys:%d]\n", num_keys);
+
+	  /* If we can't get tty modes for the master side of the pty, we
+	     can't handle non-canonical-mode programs.  Always assume the
+	     master is in canonical echo mode if we can't tell. */
+	  ioctl_ret = tcgetattr(master, &term_master);
+
+	  if (ioctl_ret >= 0)
+	    {
+	      DPRINT2 ("echo:%d, canon:%d\n",
+			(term_master.c_lflag & ECHO) != 0,
+			(term_master.c_lflag & ICANON) != 0);
+	      do_canon = (term_master.c_lflag & ICANON) != 0;
+	      readline_echoing_p = (term_master.c_lflag & ECHO) != 0;
+	    }
+	  else
+	    {
+	      if (ioctl_err == 0)
+		DPRINT1("tcgetattr on master fd failed: errno = %d\n", errno);
+	      ioctl_err = 1;
+	    }
+
+	  if (do_canon == 0 && num_keys == 0)
+	    {
+	      char ch[10];
+	      int count = read (STDIN_FILENO, ch, sizeof(ch));
+	      write (out_to_inferior_fd, ch, count);
+	    }
+	  else
+	    {
+	      if (num_keys == 0)
+		{
+		  int i;
+		  /* Re-install callback handler for new prompt. */
+		  if (prompt != empty_string)
+		    free (prompt);
+		  prompt = malloc (buf_count + 1);
+		  if (prompt == NULL)
+		    prompt = empty_string;
+		  else
+		    {
+		      memcpy (prompt, buf, buf_count);
+		      prompt[buf_count] = '\0';
+		      DPRINT1("New prompt '%s'\n", prompt);
+#if 0 /* ifdef HAVE_RL_ALREADY_PROMPTED -- doesn't work */
+		      rl_already_prompted = buf_count > 0;
+#else
+		      if (buf_count > 0)
+			write (1, "\r", 1);
+#endif
+		    }
+		  rl_callback_handler_install (prompt, line_handler);
+		}
+	      num_keys++;
+	      rl_callback_read_char ();
+	    }
+	}
+      else /* input from inferior. */
+	{
+	  int i;
+	  int count;
+	  int old_count;
+	  if (buf_count > (sizeof(buf) >> 2))
+	    buf_count = 0;
+	  count = read (in_from_inferior_fd, buf+buf_count,
+			sizeof(buf) - buf_count);
+	  if (count <= 0)
+	    {
+	      DPRINT0 ("(Connection closed by foreign host.)\n");
+	      tcsetattr(STDIN_FILENO, TCSANOW, &orig_term);
+	      exit (0);
+	    }
+	  old_count = buf_count;
+
+          /* Look for any pending echo that we need to suppress. */
+	  while (echo_suppress_start < echo_suppress_limit
+		 && count > 0
+		 && buf[buf_count] == echo_suppress_buffer[echo_suppress_start])
+	    {
+	      count--;
+	      buf_count++;
+	      echo_suppress_start++;
+	    }
+
+          /* Write to the terminal anything that was not suppressed. */
+          if (count > 0)
+            write (1, buf + buf_count, count);
+
+          /* Finally, look for a prompt candidate.
+           * When we get around to going input (from the keyboard),
+           * we will consider the prompt to be anything since the last
+           * line terminator.  So we need to save that text in the
+           * initial part of buf.  However, anything before the
+           * most recent end-of-line is not interesting. */
+	  buf_count += count;
+#if 1
+	  for (i = buf_count;  --i >= old_count; )
+#else
+	  for (i = buf_count - 1;  i-- >= buf_count - count; )
+#endif
+	    {
+	      if (buf[i] == '\n' || buf[i] == '\r')
+		{
+		  i++;
+		  memmove (buf, buf+i, buf_count - i);
+		  buf_count -= i;
+		  break;
+		}
+	    }
+	  DPRINT2("-> i: %d, buf_count: %d\n", i, buf_count);
+	}
+    }
+}
diff --git a/readline/examples/rltest.c b/readline/examples/rltest.c
index 453f8ec..6250f90 100644
--- a/readline/examples/rltest.c
+++ b/readline/examples/rltest.c
@@ -4,20 +4,20 @@
 /*								    */
 /* **************************************************************** */
 
-/*
- * Remove the next line if you're compiling this against an installed
- * libreadline.a
- */
-#define READLINE_LIBRARY
-
 #if defined (HAVE_CONFIG_H)
 #include <config.h>
 #endif
 
 #include <stdio.h>
 #include <sys/types.h>
-#include "readline.h"
-#include "history.h"
+
+#ifdef READLINE_LIBRARY
+#  include "readline.h"
+#  include "history.h"
+#else
+#  include <readline/readline.h>
+#  include <readline/history.h>
+#endif
 
 extern HIST_ENTRY **history_list ();
 
diff --git a/readline/examples/rlversion.c b/readline/examples/rlversion.c
index 2d73a96..652d37c 100644
--- a/readline/examples/rlversion.c
+++ b/readline/examples/rlversion.c
@@ -2,8 +2,6 @@
  * rlversion -- print out readline's version number
  */
 
-#define READLINE_LIBRARY
-
 #if defined (HAVE_CONFIG_H)
 #  include <config.h>
 #endif
@@ -12,7 +10,11 @@
 #include <sys/types.h>
 #include "posixstat.h"
 
-#include "readline.h"
+#ifdef READLINE_LIBRARY
+#  include "readline.h"
+#else
+#  include <readline/readline.h>
+#endif
 
 main()
 {
diff --git a/readline/funmap.c b/readline/funmap.c
index f6b8628..1f7ba87 100644
--- a/readline/funmap.c
+++ b/readline/funmap.c
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,15 +18,13 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
 #  include <config.h>
 #endif
 
-extern char *xmalloc (), *xrealloc ();
-
 #if !defined (BUFSIZ)
 #include <stdio.h>
 #endif /* BUFSIZ */
@@ -40,6 +38,14 @@
 #include "rlconf.h"
 #include "readline.h"
 
+#include "xmalloc.h"
+
+#ifdef __STDC__
+typedef int QSFUNC (const void *, const void *);
+#else
+typedef int QSFUNC ();
+#endif
+
 extern int _rl_qsort_string_compare ();
 
 FUNMAP **funmap;
@@ -240,7 +246,7 @@
       result[result_index + 1] = (char *)NULL;
     }
 
-  qsort (result, result_index, sizeof (char *), _rl_qsort_string_compare);
+  qsort (result, result_index, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
   return (result);
 }
 
diff --git a/readline/histexpand.c b/readline/histexpand.c
index 392e6d3..78da3e5 100644
--- a/readline/histexpand.c
+++ b/readline/histexpand.c
@@ -7,7 +7,7 @@
 
    The Library 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    The Library is distributed in the hope that it will be useful, but
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #define READLINE_LIBRARY
 
@@ -50,6 +50,9 @@
 #include "history.h"
 #include "histlib.h"
 
+#include "rlshell.h"
+#include "xmalloc.h"
+
 #define HISTORY_WORD_DELIMITERS		" \t\n;&()|<>"
 #define HISTORY_QUOTE_CHARACTERS	"\"'`"
 
@@ -60,15 +63,10 @@
 static int subst_lhs_len;
 static int subst_rhs_len;
 
-static char *get_history_word_specifier ();
-static char *history_find_word ();
+static char *get_history_word_specifier __P((char *, char *, int *));
+static char *history_find_word __P((char *, int));
 
-extern int history_offset;
-
-extern char *single_quote ();
-static char *quote_breaks ();
-
-extern char *xmalloc (), *xrealloc ();
+static char *quote_breaks __P((char *));
 
 /* Variables exported by this file. */
 /* The character that represents the start of a history expansion
diff --git a/readline/histfile.c b/readline/histfile.c
index 9437e99..b908e22 100644
--- a/readline/histfile.c
+++ b/readline/histfile.c
@@ -7,7 +7,7 @@
 
    The Library 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    The Library is distributed in the hope that it will be useful, but
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 /* The goal is to make the implementation transparent, so that you
    don't have to know what data types are used, just what functions
@@ -35,7 +35,7 @@
 #ifndef _MINIX
 #  include <sys/file.h>
 #endif
-#include <sys/stat.h>
+#include "posixstat.h"
 #include <fcntl.h>
 
 #if defined (HAVE_STDLIB_H)
@@ -54,15 +54,19 @@
 #  include <strings.h>
 #endif /* !HAVE_STRING_H */
 
-#if defined (__EMX__)
+
+/* If we're compiling for __EMX__ (OS/2) or __CYGWIN__ (cygwin32 environment
+   on win 95/98/nt), we want to open files with O_BINARY mode so that there
+   is no \n -> \r\n conversion performed.  On other systems, we don't want to
+   mess around with O_BINARY at all, so we ensure that it's defined to 0. */
+#if defined (__EMX__) || defined (__CYGWIN__)
 #  ifndef O_BINARY
 #    define O_BINARY 0
 #  endif
-#else /* !__EMX__ */
-   /* If we're not compiling for __EMX__, we don't want this at all.  Ever. */
+#else /* !__EMX__ && !__CYGWIN__ */
 #  undef O_BINARY
 #  define O_BINARY 0
-#endif /* !__EMX__ */
+#endif /* !__EMX__ && !__CYGWIN__ */
 
 #include <errno.h>
 #if !defined (errno)
@@ -72,10 +76,8 @@
 #include "history.h"
 #include "histlib.h"
 
-/* Functions imported from shell.c */
-extern char *get_env_value ();
-
-extern char *xmalloc (), *xrealloc ();
+#include "rlshell.h"
+#include "xmalloc.h"
 
 /* Return the string that should be used in the place of this
    filename.  This only matters when you don't specify the
@@ -105,7 +107,11 @@
   return_val = xmalloc (2 + home_len + 8); /* strlen(".history") == 8 */
   strcpy (return_val, home);
   return_val[home_len] = '/';
+#if defined (__MSDOS__)
+  strcpy (return_val + home_len + 1, "_history");
+#else
   strcpy (return_val + home_len + 1, ".history");
+#endif
 
   return (return_val);
 }
@@ -132,7 +138,7 @@
 {
   register int line_start, line_end;
   char *input, *buffer;
-  int file, current_line;
+  int file, current_line, chars_read;
   struct stat finfo;
   size_t file_size;
 
@@ -140,16 +146,6 @@
   input = history_filename (filename);
   file = open (input, O_RDONLY|O_BINARY, 0666);
 
-
-#ifdef __MSDOS__
-  /* MSDOS doesn't allow leading dots in file names.  Try again
-     with the dot replaced by an underscore.  */
-  if (file < 0 && !filename)
-    {
-      input[strlen (input) - 8] = '_';
-      file = open (input, O_RDONLY|O_BINARY, 0666);
-    }
-#endif
   if ((file < 0) || (fstat (file, &finfo) == -1))
     goto error_and_exit;
 
@@ -165,11 +161,9 @@
     }
 
   buffer = xmalloc (file_size + 1);
-#if 0
-  if (read (file, buffer, file_size) != file_size)
-#else
-  if (read (file, buffer, file_size) < 0)
-#endif
+
+  chars_read = read (file, buffer, file_size);
+  if (chars_read < 0)
     {
   error_and_exit:
       if (file >= 0)
@@ -185,15 +179,15 @@
 
   /* Set TO to larger than end of file if negative. */
   if (to < 0)
-    to = file_size;
+    to = chars_read;
 
   /* Start at beginning of file, work to end. */
   line_start = line_end = current_line = 0;
 
   /* Skip lines until we are at FROM. */
-  while (line_start < file_size && current_line < from)
+  while (line_start < chars_read && current_line < from)
     {
-      for (line_end = line_start; line_end < file_size; line_end++)
+      for (line_end = line_start; line_end < chars_read; line_end++)
 	if (buffer[line_end] == '\n')
 	  {
 	    current_line++;
@@ -204,7 +198,7 @@
     }
 
   /* If there are lines left to gobble, then gobble them now. */
-  for (line_end = line_start; line_end < file_size; line_end++)
+  for (line_end = line_start; line_end < chars_read; line_end++)
     if (buffer[line_end] == '\n')
       {
 	buffer[line_end] = '\0';
@@ -243,19 +237,13 @@
   filename = history_filename (fname);
   file = open (filename, O_RDONLY|O_BINARY, 0666);
 
-#ifdef __MSDOS__
-  /* MSDOS doesn't allow leading dots in file names.  Try again
-     with the dot replaced by an underscore.  */
-  if (file < 0 && !fname)
-    {
-      filename[strlen (filename) - 8] = '_';
-      file = open (filename, O_RDONLY|O_BINARY, 0666);
-    }
-#endif
-
   if (file == -1 || fstat (file, &finfo) == -1)
     goto truncate_exit;
 
+  /* Don't try to truncate non-regular files. */
+  if (S_ISREG(finfo.st_mode) == 0)
+    goto truncate_exit;
+
   file_size = (size_t)finfo.st_size;
 
   /* check for overflow on very large files */
@@ -299,11 +287,11 @@
      truncate to. */
   if (i && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
     {
-      write (file, buffer + i, file_size - i);
+      write (file, buffer + i, chars_read - i);
 
 #if defined (__BEOS__)
       /* BeOS ignores O_TRUNC. */
-      ftruncate (file, file_size - i);
+      ftruncate (file, chars_read - i);
 #endif
 
       close (file);
@@ -334,23 +322,8 @@
 
   if ((file = open (output, mode, 0600)) == -1)
     {
-#ifdef __MSDOS__
-      /* MSDOS doesn't allow leading dots in file names.  If this is
-	 the default file name, try again with the dot replaced by an
-	 underscore.  */
-      if (!filename)
-	{
-	  output[strlen (output) - 8] = '_';
-	  if ((file = open (output, mode, 0600)) == -1)
-	    {
-	      FREE (output);
-	      return (errno);
-	    }
-	}
-#else
       FREE (output);
       return (errno);
-#endif
     }
 
   if (nelements > history_length)
diff --git a/readline/histlib.h b/readline/histlib.h
index 422cf59..88a34d1 100644
--- a/readline/histlib.h
+++ b/readline/histlib.h
@@ -6,7 +6,7 @@
 
    The Library 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    The Library is distributed in the hope that it will be useful, but
@@ -17,7 +17,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #if !defined (_HISTLIB_H_)
 #define _HISTLIB_H_
@@ -31,8 +31,11 @@
 typedef char **CPPFunction ();
 #endif /* _FUNCTION_DEF */
 
+#if !defined (STREQ)
 #define STREQ(a, b)	(((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
-#define STREQN(a, b, n)	(((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
+#define STREQN(a, b, n) (((n) == 0) ? (1) \
+				    : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
+#endif
 
 #ifndef savestring
 #  ifndef strcpy
@@ -79,4 +82,7 @@
 #define HISTORY_APPEND 0
 #define HISTORY_OVERWRITE 1
 
+/* Some variable definitions shared across history source files. */
+extern int history_offset;
+
 #endif /* !_HISTLIB_H_ */
diff --git a/readline/history.c b/readline/history.c
index d56ffac..400f18b 100644
--- a/readline/history.c
+++ b/readline/history.c
@@ -7,7 +7,7 @@
 
    The Library 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    The Library is distributed in the hope that it will be useful, but
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 /* The goal is to make the implementation transparent, so that you
    don't have to know what data types are used, just what functions
@@ -53,7 +53,7 @@
 #include "history.h"
 #include "histlib.h"
 
-extern char *xmalloc (), *xrealloc ();
+#include "xmalloc.h"
 
 /* The number of slots to increase the_history by. */
 #define DEFAULT_HISTORY_GROW_SIZE 50
diff --git a/readline/history.h b/readline/history.h
index 8ecce72..5210deb 100644
--- a/readline/history.h
+++ b/readline/history.h
@@ -6,7 +6,7 @@
 
    The Library 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    The Library is distributed in the hope that it will be useful, but
@@ -17,7 +17,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #ifndef _HISTORY_H_
 #define _HISTORY_H_
@@ -119,7 +119,7 @@
   
 /* Return the history entry at the current position, as determined by
    history_offset.  If there is no entry there, return a NULL pointer. */
-HIST_ENTRY *current_history __P((void));
+extern HIST_ENTRY *current_history __P((void));
 
 /* Return the history entry which is logically at OFFSET in the history
    array.  OFFSET is relative to history_base. */
@@ -132,7 +132,7 @@
 /* Moving around the history list. */
 
 /* Set the position in the history list to POS. */
-int history_set_pos __P((int));
+extern int history_set_pos __P((int));
 
 /* Back up history_offset to the previous history entry, and return
    a pointer to that entry.  If there is no previous entry, return
@@ -187,7 +187,7 @@
 
 /* Append NELEMENT entries to FILENAME.  The entries appended are from
    the end of the list minus NELEMENTs up to the end of the list. */
-int append_history __P((int, char *));
+extern int append_history __P((int, char *));
 
 /* Truncate the history file, leaving only the last NLINES lines. */
 extern int history_truncate_file __P((char *, int));
diff --git a/readline/histsearch.c b/readline/histsearch.c
index 7e98e95..8d153b6 100644
--- a/readline/histsearch.c
+++ b/readline/histsearch.c
@@ -7,7 +7,7 @@
 
    The Library 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    The Library is distributed in the hope that it will be useful, but
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #define READLINE_LIBRARY
 
@@ -47,9 +47,6 @@
 #include "history.h"
 #include "histlib.h"
 
-/* Variables imported from other history library files. */
-extern int history_offset;
-
 /* The list of alternate characters that can delimit a history search
    string. */
 char *history_search_delimiter_chars = (char *)NULL;
diff --git a/readline/input.c b/readline/input.c
index a8ba23c..64a55c6 100644
--- a/readline/input.c
+++ b/readline/input.c
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -67,39 +67,15 @@
 /* Some standard library routines. */
 #include "readline.h"
 
+#include "rlprivate.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
 /* What kind of non-blocking I/O do we have? */
 #if !defined (O_NDELAY) && defined (O_NONBLOCK)
 #  define O_NDELAY O_NONBLOCK	/* Posix style */
 #endif
 
-/* Functions imported from other files in the library. */
-extern char *xmalloc (), *xrealloc ();
-
-/* Variables and functions from macro.c. */
-extern void _rl_add_macro_char ();
-extern void _rl_with_macro_input ();
-extern int _rl_next_macro_key ();
-extern int _rl_defining_kbd_macro;
-
-#if defined (VI_MODE)
-extern void _rl_vi_set_last ();
-extern int _rl_vi_textmod_command ();
-#endif /* VI_MODE */
-
-extern FILE *rl_instream, *rl_outstream;
-extern Function *rl_last_func;
-extern int rl_key_sequence_length;
-extern int rl_pending_input;
-extern int rl_editing_mode;
-
-extern Keymap _rl_keymap;
-
-extern int _rl_convert_meta_chars_to_ascii;
-
-#if defined (__GO32__) && !defined (HAVE_SELECT)
-#  include <pc.h>
-#endif /* __GO32__ */
-
 /* Non-null means it is a pointer to a function to run while waiting for
    character input. */
 Function *rl_event_hook = (Function *)NULL;
@@ -176,17 +152,6 @@
 static void
 rl_gather_tyi ()
 {
-#if defined (__GO32__) && !defined (HAVE_SELECT)
-  char input;
-
-  if (isatty (0) && kbhit () && ibuffer_space ())
-    {
-      int i;
-      i = (*rl_getc_function) (rl_instream);
-      rl_stuff_char (i);
-    }
-#else /* !__GO32__ */
-
   int tty;
   register int tem, result;
   int chars_avail;
@@ -255,7 +220,6 @@
       if (chars_avail)
 	rl_stuff_char (input);
     }
-#endif /* !__GO32__ */
 }
 
 /* Is there input available to be read on the readline input file
@@ -394,14 +358,9 @@
 rl_getc (stream)
      FILE *stream;
 {
-  int result, flags;
+  int result;
   unsigned char c;
 
-#if defined (__GO32__) && !defined (HAVE_TERMIOS_H)
-  if (isatty (0))
-    return (getkey () & 0x7F);
-#endif /* __GO32__ */
-
   while (1)
     {
       result = read (fileno (stream), &c, sizeof (unsigned char));
@@ -420,40 +379,31 @@
 #endif
 
 #if defined (EWOULDBLOCK)
-      if (errno == EWOULDBLOCK)
+#  define X_EWOULDBLOCK EWOULDBLOCK
+#else
+#  define X_EWOULDBLOCK -99
+#endif
+
+#if defined (EAGAIN)
+#  define X_EAGAIN EAGAIN
+#else
+#  define X_EAGAIN -99
+#endif
+
+      if (errno == X_EWOULDBLOCK || errno == X_EAGAIN)
 	{
-	  if ((flags = fcntl (fileno (stream), F_GETFL, 0)) < 0)
+	  if (unset_nodelay_mode (fileno (stream)) < 0)
 	    return (EOF);
-	  if (flags & O_NDELAY)
-	    {
-	      flags &= ~O_NDELAY;
-	      fcntl (fileno (stream), F_SETFL, flags);
-	      continue;
-	    }
 	  continue;
 	}
-#endif /* EWOULDBLOCK */
 
-#if defined (_POSIX_VERSION) && defined (EAGAIN) && defined (O_NONBLOCK)
-      if (errno == EAGAIN)
-	{
-	  if ((flags = fcntl (fileno (stream), F_GETFL, 0)) < 0)
-	    return (EOF);
-	  if (flags & O_NONBLOCK)
-	    {
-	      flags &= ~O_NONBLOCK;
-	      fcntl (fileno (stream), F_SETFL, flags);
-	      continue;
-	    }
-	}
-#endif /* _POSIX_VERSION && EAGAIN && O_NONBLOCK */
+#undef X_EWOULDBLOCK
+#undef X_EAGAIN
 
-#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
       /* If the error that we received was SIGINT, then try again,
 	 this is simply an interrupted system call to read ().
 	 Otherwise, some error ocurred, also signifying EOF. */
       if (errno != EINTR)
 	return (EOF);
-#endif /* !__GO32__ */
     }
 }
diff --git a/readline/isearch.c b/readline/isearch.c
index 67279e1..952c10d 100644
--- a/readline/isearch.c
+++ b/readline/isearch.c
@@ -12,7 +12,7 @@
 
    The Library 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    The Library is distributed in the hope that it will be useful, but
@@ -23,7 +23,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -48,24 +48,17 @@
 #include "readline.h"
 #include "history.h"
 
+#include "rlprivate.h"
+#include "xmalloc.h"
+
 /* Variables exported to other files in the readline library. */
 unsigned char *_rl_isearch_terminators = (unsigned char *)NULL;
 
 /* Variables imported from other files in the readline library. */
-extern Keymap _rl_keymap;
 extern HIST_ENTRY *saved_line_for_history;
-extern int rl_line_buffer_len;
-extern int rl_point, rl_end;
-extern char *rl_line_buffer;
 
-extern int rl_execute_next ();
-extern void rl_extend_line_buffer ();
-
-extern int _rl_input_available ();
-
-extern char *xmalloc (), *xrealloc ();
-
-static int rl_search_history ();
+/* Forward declarations */
+static int rl_search_history __P((int, int));
 
 /* Last line found by the current incremental search, so we don't `find'
    identical lines many times in a row. */
diff --git a/readline/keymaps.c b/readline/keymaps.c
index c73666b..8fb7de3 100644
--- a/readline/keymaps.c
+++ b/readline/keymaps.c
@@ -7,7 +7,7 @@
 
    Readline 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 1, or (at your option) any
+   Free Software Foundation; either version 2, or (at your option) any
    later version.
 
    Readline is distributed in the hope that it will be useful, but
@@ -17,7 +17,7 @@
 
    You should have received a copy of the GNU General Public License
    along with Readline; see the file COPYING.  If not, write to the Free
-   Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+   Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -30,18 +30,18 @@
 #  include "ansi_stdlib.h"
 #endif /* HAVE_STDLIB_H */
 
+#include <stdio.h>	/* for FILE * definition for readline.h */
+
+#include "readline.h"
 #include "rlconf.h"
-#include "keymaps.h"
+
 #include "emacs_keymap.c"
 
 #if defined (VI_MODE)
 #include "vi_keymap.c"
 #endif
 
-extern int rl_do_lowercase_version ();
-extern int rl_rubout (), rl_insert ();
-
-extern char *xmalloc (), *xrealloc ();
+#include "xmalloc.h"
 
 /* **************************************************************** */
 /*								    */
diff --git a/readline/keymaps.h b/readline/keymaps.h
index 5dff46f..3a504fb 100644
--- a/readline/keymaps.h
+++ b/readline/keymaps.h
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,11 +18,15 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #ifndef _KEYMAPS_H_
 #define _KEYMAPS_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #if defined (READLINE_LIBRARY)
 #  include "rlstdc.h"
 #  include "chardefs.h"
@@ -97,4 +101,8 @@
 /* Set the current keymap to MAP. */
 extern void rl_set_keymap __P((Keymap));
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _KEYMAPS_H_ */
diff --git a/readline/kill.c b/readline/kill.c
index 0b4714f..c3241bd 100644
--- a/readline/kill.c
+++ b/readline/kill.c
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -46,17 +46,8 @@
 #include "readline.h"
 #include "history.h"
 
-extern int _rl_last_command_was_kill;
-extern int rl_editing_mode;
-extern int rl_explicit_arg;
-extern Function *rl_last_func;
-
-extern void _rl_init_argument ();
-extern int _rl_set_mark_at_pos ();
-extern void _rl_fix_point ();
-extern void _rl_abort_internal ();
-
-extern char *xmalloc (), *xrealloc ();
+#include "rlprivate.h"
+#include "xmalloc.h"
 
 /* **************************************************************** */
 /*								    */
@@ -385,10 +376,12 @@
 rl_kill_region (count, ignore)
      int count, ignore;
 {
-  int r;
+  int r, npoint;
 
+  npoint = (rl_point < rl_mark) ? rl_point : rl_mark;
   r = region_kill_internal (1);
   _rl_fix_point (1);
+  rl_point = npoint;
   return r;
 }
 
@@ -503,7 +496,9 @@
 {
   register HIST_ENTRY *entry;
   char *arg;
-  int i;
+  int i, pos;
+
+  pos = where_history ();
 
   if (history_skip)
     {
@@ -512,16 +507,10 @@
     }
 
   entry = previous_history ();
-  if (entry)
-    {
-      if (history_skip)
-	{
-	  for (i = 0; i < history_skip; i++)
-	    next_history ();
-	}
-      next_history ();
-    }
-  else
+
+  history_set_pos (pos);
+
+  if (entry == 0)
     {
       ding ();
       return -1;
diff --git a/readline/macro.c b/readline/macro.c
index f3c442b..5a44852 100644
--- a/readline/macro.c
+++ b/readline/macro.c
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -46,20 +46,11 @@
 #include "readline.h"
 #include "history.h"
 
+#include "rlprivate.h"
+#include "xmalloc.h"
+
 #define SWAP(s, e)  do { int t; t = s; s = e; e = t; } while (0)
 
-/* Forward definitions. */
-void _rl_push_executing_macro (), _rl_pop_executing_macro ();
-void _rl_add_macro_char ();
-
-/* Extern declarations. */
-extern int rl_explicit_arg;
-extern int rl_key_sequence_length;
-
-extern void _rl_abort_internal ();
-
-extern char *xmalloc (), *xrealloc ();
-
 /* **************************************************************** */
 /*								    */
 /*			Hacking Keyboard Macros 		    */
diff --git a/readline/nls.c b/readline/nls.c
index f2d413d..67bed8a 100644
--- a/readline/nls.c
+++ b/readline/nls.c
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -27,6 +27,8 @@
 
 #include <sys/types.h>
 
+#include <stdio.h>
+
 #if defined (HAVE_UNISTD_H)
 #  include <unistd.h>
 #endif /* HAVE_UNISTD_H */
@@ -44,13 +46,9 @@
 #include <ctype.h>
 
 #include "rldefs.h"
-
-extern int _rl_convert_meta_chars_to_ascii;
-extern int _rl_output_meta_chars;
-extern int _rl_meta_flag;
-
-/* Functions imported from shell.c */
-extern char *get_env_value ();
+#include "readline.h"
+#include "rlshell.h"
+#include "rlprivate.h"
 
 #if !defined (HAVE_SETLOCALE)    
 /* A list of legal values for the LANG or LC_CTYPE environment variables.
@@ -70,12 +68,11 @@
  "iso88599",
  "iso885910",
  "koi8r",
- "koi8-r", 
   0
 };
 
-static char *normalize_codeset ();
-static char *find_codeset ();
+static char *normalize_codeset __P((char *));
+static char *find_codeset __P((char *, size_t *));
 #endif /* !HAVE_SETLOCALE */
 
 /* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value
diff --git a/readline/parens.c b/readline/parens.c
index a500c0a..b6de529 100644
--- a/readline/parens.c
+++ b/readline/parens.c
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,23 +18,11 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #include "rlconf.h"
 
-#if !defined (PAREN_MATCHING)
-extern int rl_insert ();
-
-int
-rl_insert_close (count, invoking_key)
-     int count, invoking_key;
-{
-  return (rl_insert (count, invoking_key));
-}
-
-#else /* PAREN_MATCHING */
-
 #if defined (HAVE_CONFIG_H)
 #  include <config.h>
 #endif
@@ -64,8 +52,9 @@
 #endif /* !strchr && !__STDC__ */
 
 #include "readline.h"
+#include "rlprivate.h"
 
-extern int rl_explicit_arg;
+static int find_matching_open __P((char *, int, int));
 
 /* Non-zero means try to blink the matching open parenthesis when the
    close parenthesis is inserted. */
@@ -75,7 +64,25 @@
 int rl_blink_matching_paren = 0;
 #endif /* !HAVE_SELECT */
 
-static int find_matching_open ();
+/* Change emacs_standard_keymap to have bindings for paren matching when
+   ON_OR_OFF is 1, change them back to self_insert when ON_OR_OFF == 0. */
+void
+_rl_enable_paren_matching (on_or_off)
+     int on_or_off;
+{
+  if (on_or_off)
+    {	/* ([{ */
+      rl_bind_key_in_map (')', rl_insert_close, emacs_standard_keymap);
+      rl_bind_key_in_map (']', rl_insert_close, emacs_standard_keymap);
+      rl_bind_key_in_map ('}', rl_insert_close, emacs_standard_keymap);
+    }
+  else
+    {	/* ([{ */
+      rl_bind_key_in_map (')', rl_insert, emacs_standard_keymap);
+      rl_bind_key_in_map (']', rl_insert, emacs_standard_keymap);
+      rl_bind_key_in_map ('}', rl_insert, emacs_standard_keymap);
+    }
+}
 
 int
 rl_insert_close (count, invoking_key)
@@ -152,5 +159,3 @@
     }
   return (i);
 }
-
-#endif /* PAREN_MATCHING */
diff --git a/readline/posixdir.h b/readline/posixdir.h
index 7480a93..98ced75 100644
--- a/readline/posixdir.h
+++ b/readline/posixdir.h
@@ -6,7 +6,7 @@
 
    Bash 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    Bash is distributed in the hope that it will be useful, but WITHOUT
@@ -16,7 +16,7 @@
 
    You should have received a copy of the GNU General Public License
    along with Bash; see the file COPYING.  If not, write to the Free
-   Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+   Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 /* This file should be included instead of <dirent.h> or <sys/dir.h>. */
 
diff --git a/readline/posixjmp.h b/readline/posixjmp.h
index 1347cc0..b52aa00 100644
--- a/readline/posixjmp.h
+++ b/readline/posixjmp.h
@@ -1,5 +1,23 @@
 /* posixjmp.h -- wrapper for setjmp.h with changes for POSIX systems. */
 
+/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
+
+   This file is part of GNU Bash, the Bourne Again SHell.
+
+   Bash 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.
+
+   Bash 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 Bash; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
 #ifndef _POSIXJMP_H_
 #define _POSIXJMP_H_
 
diff --git a/readline/posixstat.h b/readline/posixstat.h
index bfce8c0..c93b528 100644
--- a/readline/posixstat.h
+++ b/readline/posixstat.h
@@ -7,7 +7,7 @@
 
    Bash 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    Bash is distributed in the hope that it will be useful, but WITHOUT
@@ -17,7 +17,7 @@
 
    You should have received a copy of the GNU General Public License
    along with Bash; see the file COPYING.  If not, write to the Free
-   Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+   Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 /* This file should be included instead of <sys/stat.h>.
    It relies on the local sys/stat.h to work though. */
diff --git a/readline/readline.c b/readline/readline.c
index 6bd25f7..2c6aef6 100644
--- a/readline/readline.c
+++ b/readline/readline.c
@@ -8,7 +8,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -19,7 +19,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -47,7 +47,6 @@
 #  include <locale.h>
 #endif
 
-#include <signal.h>
 #include <stdio.h>
 #include "posixjmp.h"
 
@@ -63,119 +62,27 @@
 #include "readline.h"
 #include "history.h"
 
+#include "rlprivate.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
 #ifndef RL_LIBRARY_VERSION
-#  define RL_LIBRARY_VERSION "4.0"
+#  define RL_LIBRARY_VERSION "4.1"
 #endif
 
 /* Evaluates its arguments multiple times. */
 #define SWAP(s, e)  do { int t; t = s; s = e; e = t; } while (0)
 
-/* NOTE: Functions and variables prefixed with `_rl_' are
-   pseudo-global: they are global so they can be shared
-   between files in the readline library, but are not intended
-   to be visible to readline callers. */
-
-/* Variables and functions imported from terminal.c */
-extern int _rl_init_terminal_io ();
-extern void _rl_enable_meta_key ();
-#ifdef _MINIX
-extern void _rl_output_character_function ();
-#else
-extern int _rl_output_character_function ();
-#endif
-
-extern int _rl_enable_meta;
-extern int _rl_term_autowrap;
-extern int screenwidth, screenheight, screenchars;
-
-/* Variables and functions imported from rltty.c. */
-extern void rl_prep_terminal (), rl_deprep_terminal ();
-extern void rltty_set_default_bindings ();
-
-/* Functions imported from util.c. */
-extern void _rl_abort_internal ();
-extern void rl_extend_line_buffer ();
-extern int alphabetic ();
-
-/* Functions imported from bind.c. */
-extern void _rl_bind_if_unbound ();
-
-/* Functions imported from input.c. */
-extern int _rl_any_typein ();
-extern void _rl_insert_typein ();
-extern int rl_read_key ();
-
-/* Functions imported from nls.c */
-extern int _rl_init_eightbit ();
-
-/* Functions imported from shell.c */
-extern char *get_env_value ();
-
-/* External redisplay functions and variables from display.c */
-extern void _rl_move_vert ();
-extern void _rl_update_final ();
-extern void _rl_clear_to_eol ();
-extern void _rl_clear_screen ();
-extern void _rl_erase_entire_line ();
-
-extern void _rl_erase_at_end_of_line ();
-extern void _rl_move_cursor_relative ();
-
-extern int _rl_vis_botlin;
-extern int _rl_last_c_pos;
-extern int _rl_horizontal_scroll_mode;
-extern int rl_display_fixed;
-extern int _rl_suppress_redisplay;
-extern char *rl_display_prompt;
-
-/* Variables imported from complete.c. */
-extern char *rl_completer_word_break_characters;
-extern char *rl_basic_word_break_characters;
-extern int rl_completion_query_items;
-extern int rl_complete_with_tilde_expansion;
-
-/* Variables and functions from macro.c. */
-extern void _rl_add_macro_char ();
-extern void _rl_with_macro_input ();
-extern int _rl_next_macro_key ();
-extern int _rl_defining_kbd_macro;
-
-#if defined (VI_MODE)
-/* Functions imported from vi_mode.c. */
-extern void _rl_vi_set_last ();
-extern void _rl_vi_reset_last ();
-extern void _rl_vi_done_inserting ();
-extern int _rl_vi_textmod_command ();
-extern void _rl_vi_initialize_line ();
-#endif /* VI_MODE */
-
-extern UNDO_LIST *rl_undo_list;
-extern int _rl_doing_an_undo;
-
 /* Forward declarations used in this file. */
-void _rl_free_history_entry ();
+void _rl_free_history_entry __P((HIST_ENTRY *));
 
-int _rl_dispatch ();
-int _rl_init_argument ();
+static char *readline_internal __P((void));
+static void readline_initialize_everything __P((void));
+static void start_using_history __P((void));
+static void bind_arrow_keys __P((void));
+static int rl_change_case __P((int, int));
 
-static char *readline_internal ();
-static void readline_initialize_everything ();
-static void start_using_history ();
-static void bind_arrow_keys ();
-
-#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
-static void readline_default_bindings ();
-#endif /* !__GO32__ */
-
-#if defined (__GO32__)
-#  include <go32.h>
-#  include <pc.h>
-#  if !defined (__DJGPP__)
-#    undef HANDLE_SIGNALS
-#  endif /* !__DJGPP__ */
-#endif /* __GO32__ */
-
-extern char *xmalloc (), *xrealloc ();
+static void readline_default_bindings __P((void));
 
 /* **************************************************************** */
 /*								    */
@@ -185,6 +92,8 @@
 
 char *rl_library_version = RL_LIBRARY_VERSION;
 
+int rl_gnu_readline_p = 1;
+
 /* A pointer to the keymap that is currently in use.
    By default, it is the standard emacs keymap. */
 Keymap _rl_keymap = emacs_standard_keymap;
@@ -247,6 +156,10 @@
 char *rl_prompt;
 int rl_visible_prompt_length = 0;
 
+/* Set to non-zero by calling application if it has already printed rl_prompt
+   and does not want readline to do it the first time. */
+int rl_already_prompted = 0;
+
 /* The number of characters read in order to type this complete command. */
 int rl_key_sequence_length = 0;
 
@@ -292,6 +205,10 @@
 /* Non-zero means to erase entire line, including prompt, on empty input lines. */
 int rl_erase_empty_line = 0;
 
+/* Non-zero means to read only this many characters rather than up to a
+   character bound to accept-line. */
+int rl_num_chars_to_read;
+
 /* Line buffer and maintenence. */
 char *rl_line_buffer = (char *)NULL;
 int rl_line_buffer_len = 0;
@@ -371,6 +288,8 @@
 STATIC_CALLBACK void
 readline_internal_setup ()
 {
+  char *nprompt;
+
   _rl_in_stream = rl_instream;
   _rl_out_stream = rl_outstream;
 
@@ -379,15 +298,20 @@
 
   if (readline_echoing_p == 0)
     {
-      if (rl_prompt)
+      if (rl_prompt && rl_already_prompted == 0)
 	{
-	  fprintf (_rl_out_stream, "%s", rl_prompt);
+	  nprompt = _rl_strip_prompt (rl_prompt);
+	  fprintf (_rl_out_stream, "%s", nprompt);
 	  fflush (_rl_out_stream);
+	  free (nprompt);
 	}
     }
   else
     {
-      rl_on_new_line ();
+      if (rl_prompt && rl_already_prompted)
+	rl_on_new_line_with_prompt ();
+      else
+	rl_on_new_line ();
       (*rl_redisplay_function) ();
 #if defined (VI_MODE)
       if (rl_editing_mode == vi_mode)
@@ -479,7 +403,7 @@
 	}
 
       lastc = c;
-      _rl_dispatch (c, _rl_keymap);
+      _rl_dispatch ((unsigned char)c, _rl_keymap);
 
       /* If there was no change in _rl_last_command_was_kill, then no kill
 	 has taken place.  Note that if input is pending we are reading
@@ -494,6 +418,12 @@
 	rl_vi_check ();
 #endif /* VI_MODE */
 
+      if (rl_num_chars_to_read && rl_end >= rl_num_chars_to_read)
+        {
+          (*rl_redisplay_function) ();
+          rl_newline (1, '\n');
+        }
+
       if (rl_done == 0)
 	(*rl_redisplay_function) ();
 
@@ -691,6 +621,7 @@
   return 0;
 }
 
+#if 0
 #if defined (__EMX__)
 static void
 _emx_build_environ ()
@@ -714,15 +645,18 @@
   *tp = 0;
 }
 #endif /* __EMX__ */
+#endif
 
 /* Initialize the entire state of the world. */
 static void
 readline_initialize_everything ()
 {
+#if 0
 #if defined (__EMX__)
   if (environ == 0)
     _emx_build_environ ();
 #endif
+#endif
 
   /* Find out if we are running in Emacs. */
   running_in_emacs = get_env_value ("EMACS") != (char *)0;
@@ -747,10 +681,8 @@
   /* Initialize the terminal interface. */
   _rl_init_terminal_io ((char *)NULL);
 
-#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
   /* Bind tty characters to readline functions. */
   readline_default_bindings ();
-#endif /* !__GO32__ || HAVE_TERMIOS_H */
 
   /* Initialize the function names. */
   rl_initialize_funmap ();
@@ -799,6 +731,17 @@
 {
   Function *f;
 
+#if defined (__MSDOS__)
+  f = rl_function_of_keyseq ("\033[0A", _rl_keymap, (int *)NULL);
+  if (!f || f == rl_do_lowercase_version)
+    {
+       _rl_bind_if_unbound ("\033[0A", rl_get_previous_history);
+       _rl_bind_if_unbound ("\033[0B", rl_backward);
+       _rl_bind_if_unbound ("\033[0C", rl_forward);
+       _rl_bind_if_unbound ("\033[0D", rl_get_next_history);
+    }
+#endif
+	
   f = rl_function_of_keyseq ("\033[A", _rl_keymap, (int *)NULL);
   if (!f || f == rl_do_lowercase_version)
     {
@@ -1123,6 +1066,10 @@
       else
 	rl_point = end;
     }
+
+  if (rl_end < 0)
+    rl_end = 0;
+
   return 0;
 }
 
@@ -1257,35 +1204,14 @@
 rl_refresh_line (ignore1, ignore2)
      int ignore1, ignore2;
 {
-  int curr_line, nleft;
+  int curr_line;
 
-  /* Find out whether or not there might be invisible characters in the
-     editing buffer. */
-  if (rl_display_prompt == rl_prompt)
-    nleft = _rl_last_c_pos - screenwidth - rl_visible_prompt_length;
-  else
-    nleft = _rl_last_c_pos - screenwidth;
-
-  if (nleft > 0)
-    curr_line = 1 + nleft / screenwidth;
-  else
-    curr_line = 0;
+  curr_line = _rl_current_display_line ();
 
   _rl_move_vert (curr_line);
   _rl_move_cursor_relative (0, the_line);   /* XXX is this right */
 
-#if defined (__GO32__) && !defined (__DJGPP__)
-  {
-    int row, col, width, row_start;
-
-    ScreenGetCursor (&row, &col);
-    width = ScreenCols ();
-    row_start = ScreenPrimary + (row * width);
-    memset (row_start + col, 0, (width - col) * 2);
-  }
-#else /* !__GO32__ || __DJGPP__ */
   _rl_clear_to_eol (0);		/* arg of 0 means to not use spaces */
-#endif /* !__GO32__ || __DJGPP__ */
 
   rl_forced_update_display ();
   rl_display_fixed = 1;
@@ -1423,7 +1349,14 @@
 {
   int c;
 
+#if defined (HANDLE_SIGNALS)
+  _rl_disable_tty_signals ();
+#endif
   c = rl_read_key ();
+#if defined (HANDLE_SIGNALS)
+  _rl_restore_tty_signals ();
+#endif
+
   return (rl_insert (count, c));  
 }
 
@@ -1617,8 +1550,6 @@
 #define DownCase 2
 #define CapCase 3
 
-static int rl_change_case ();
-
 /* Uppercase the word at point. */
 int
 rl_upcase_word (count, key)
diff --git a/readline/readline.h b/readline/readline.h
index dba1a0f..fc28d6e 100644
--- a/readline/readline.h
+++ b/readline/readline.h
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #if !defined (_READLINE_H_)
 #define _READLINE_H_
@@ -192,7 +192,7 @@
 extern int rl_noninc_forward_search_again __P((int, int));
 extern int rl_noninc_reverse_search_again __P((int, int));
 
-/* Not available unless readline is compiled -DPAREN_MATCHING. */
+/* Bindable command used when inserting a matching close character. */
 extern int rl_insert_close __P((int, int));
 
 /* Not available unless READLINE_CALLBACKS is defined. */
@@ -331,11 +331,12 @@
 /* Functions for redisplay. */
 extern void rl_redisplay __P((void));
 extern int rl_on_new_line __P((void));
+extern int rl_on_new_line_with_prompt __P((void));
 extern int rl_forced_update_display __P((void));
 extern int rl_clear_message __P((void));
 extern int rl_reset_line_state __P((void));
 
-#if defined (__STDC__) && defined (USE_VARARGS) && defined (PREFER_STDARG)
+#if (defined (__STDC__) || defined (__cplusplus)) && defined (USE_VARARGS) && defined (PREFER_STDARG)
 extern int rl_message (const char *, ...);
 #else
 extern int rl_message ();
@@ -405,6 +406,9 @@
 /* The version of this incarnation of the readline library. */
 extern char *rl_library_version;
 
+/* True if this is real GNU readline. */
+extern int rl_gnu_readline_p;
+
 /* The name of the calling program.  You should initialize this to
    whatever was in argv[0].  It is used when parsing conditionals. */
 extern char *rl_readline_name;
@@ -468,6 +472,15 @@
    rl_newline. */
 extern int rl_erase_empty_line;
 
+/* If non-zero, the application has already printed the prompt (rl_prompt)
+   before calling readline, so readline should not output it the first time
+   redisplay is done. */
+extern int rl_already_prompted;
+
+/* A non-zero value means to read only this many characters rather than
+   up to a character bound to accept-line. */
+extern int rl_num_chars_to_read;
+
 /* Variables to control readline signal handling. */
 /* If non-zero, readline will install its own signal handlers for
    SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
@@ -610,8 +623,10 @@
 #define SINGLE_MATCH    1
 #define MULT_MATCH      2
 
+#if 0
 #if !defined (savestring)
-extern char *savestring ();	/* XXX backwards compatibility */
+extern char *savestring __P((char *));	/* XXX backwards compatibility */
+#endif
 #endif
 
 #ifdef __cplusplus
diff --git a/readline/rlconf.h b/readline/rlconf.h
index 1356fd8..d2ab704 100644
--- a/readline/rlconf.h
+++ b/readline/rlconf.h
@@ -8,7 +8,7 @@
 
    The Library 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    The Library is distributed in the hope that it will be useful, but
@@ -19,7 +19,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #if !defined (_RLCONF_H_)
 #define _RLCONF_H_
@@ -30,10 +30,6 @@
 /* Define this to get an indication of file type when listing completions. */
 #define VISIBLE_STATS
 
-/* If defined, readline shows opening parens and braces when closing
-   paren or brace entered. */
-/* #define PAREN_MATCHING */
-
 /* This definition is needed by readline.c, rltty.c, and signals.c. */
 /* If on, then readline handles signals in a way that doesn't screw. */
 #define HANDLE_SIGNALS
diff --git a/readline/rldefs.h b/readline/rldefs.h
index d4aced4..e504d9b 100644
--- a/readline/rldefs.h
+++ b/readline/rldefs.h
@@ -10,7 +10,7 @@
 
    The Library 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    The Library is distributed in the hope that it will be useful, but
@@ -21,7 +21,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #if !defined (_RLDEFS_H_)
 #define _RLDEFS_H_
@@ -122,7 +122,8 @@
 
 #if !defined (STREQ)
 #define STREQ(a, b)	(((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
-#define STREQN(a, b, n)	(((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
+#define STREQN(a, b, n)	(((n) == 0) ? (1) \
+				    : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
 #endif
 
 #if !defined (FREE)
diff --git a/readline/rlprivate.h b/readline/rlprivate.h
new file mode 100644
index 0000000..c05230e
--- /dev/null
+++ b/readline/rlprivate.h
@@ -0,0 +1,271 @@
+/* rlprivate.h -- functions and variables global to the readline library,
+		  but not intended for use by applications. */
+
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU Readline Library, a library for
+   reading lines of text with interactive input and history editing.
+
+   The GNU Readline Library 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.
+
+   The GNU Readline 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 General Public License for more details.
+
+   The GNU General Public License is often shipped with GNU software, and
+   is generally kept in a file called COPYING or LICENSE.  If you do not
+   have a copy of the license, write to the Free Software Foundation,
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#if !defined (_RL_PRIVATE_H_)
+#define _RL_PRIVATE_H_
+
+#include "rlconf.h"	/* for VISIBLE_STATS */
+#include "rlstdc.h"
+#include "posixjmp.h" /* defines procenv_t */
+
+/*************************************************************************
+ *									 *
+ * Global functions undocumented in texinfo manual and not in readline.h *
+ *									 *
+ *************************************************************************/
+
+/* terminal.c */
+extern char *rl_get_termcap __P((char *));
+
+/*************************************************************************
+ *									 *
+ * Global variables undocumented in texinfo manual and not in readline.h *
+ *									 *
+ *************************************************************************/
+
+/* complete.c */
+extern int rl_complete_with_tilde_expansion;
+#if defined (VISIBLE_STATS)
+extern int rl_visible_stats;
+#endif /* VISIBLE_STATS */
+
+/* readline.c */
+extern int rl_line_buffer_len;
+extern int rl_numeric_arg;
+extern int rl_arg_sign;
+extern int rl_explicit_arg;
+extern int rl_editing_mode;
+extern int rl_visible_prompt_length;
+extern Function *rl_last_func;
+extern int readline_echoing_p;
+extern int rl_key_sequence_length;
+
+/* display.c */
+extern int rl_display_fixed;
+
+/* parens.c */
+extern int rl_blink_matching_paren;
+
+/*************************************************************************
+ *									 *
+ * Global functions and variables unsed and undocumented		 *
+ *									 *
+ *************************************************************************/
+
+/* bind.c */
+extern char *rl_untranslate_keyseq __P((int));
+
+/* kill.c */
+extern int rl_set_retained_kills __P((int));
+
+/* readline.c */
+extern int rl_discard_argument __P((void));
+
+/* rltty.c */
+extern int rl_stop_output __P((int, int));
+
+/* terminal.c */
+extern void _rl_set_screen_size __P((int, int));
+
+/* undo.c */
+extern int _rl_fix_last_undo_of_type __P((int, int, int));
+
+/* util.c */
+extern char *_rl_savestring __P((char *));
+
+/*************************************************************************
+ *									 *
+ * Functions and variables private to the readline library		 *
+ *									 *
+ *************************************************************************/
+
+/* NOTE: Functions and variables prefixed with `_rl_' are
+   pseudo-global: they are global so they can be shared
+   between files in the readline library, but are not intended
+   to be visible to readline callers. */
+
+/*************************************************************************
+ * Undocumented private functions					 *
+ *************************************************************************/
+
+#if defined(READLINE_CALLBACKS)
+
+/* readline.c */
+extern void readline_internal_setup __P((void));
+extern char *readline_internal_teardown __P((int));
+extern int readline_internal_char __P((void));
+
+#endif /* READLINE_CALLBACKS */
+
+/* bind.c */
+extern void _rl_bind_if_unbound __P((char *, Function *));
+
+/* display.c */
+extern char *_rl_strip_prompt __P((char *));
+extern void _rl_move_cursor_relative __P((int, char *));
+extern void _rl_move_vert __P((int));
+extern void _rl_save_prompt __P((void));
+extern void _rl_restore_prompt __P((void));
+extern char *_rl_make_prompt_for_search __P((int));
+extern void _rl_erase_at_end_of_line __P((int));
+extern void _rl_clear_to_eol __P((int));
+extern void _rl_clear_screen __P((void));
+extern void _rl_update_final __P((void));
+extern void _rl_redisplay_after_sigwinch __P((void));
+extern void _rl_clean_up_for_exit __P((void));
+extern void _rl_erase_entire_line __P((void));
+extern int _rl_currentb_display_line __P((void));
+
+/* input.c */
+extern int _rl_any_typein __P((void));
+extern int _rl_input_available __P((void));
+extern void _rl_insert_typein __P((int));
+
+/* macro.c */
+extern void _rl_with_macro_input __P((char *));
+extern int _rl_next_macro_key __P((void));
+extern void _rl_push_executing_macro __P((void));
+extern void _rl_pop_executing_macro __P((void));
+extern void _rl_add_macro_char __P((int));
+extern void _rl_kill_kbd_macro __P((void));
+
+/* nls.c */
+extern int _rl_init_eightbit __P((void));
+
+/* parens.c */
+extern void _rl_enable_paren_matching __P((int));
+
+/* readline.c */
+extern void _rl_init_line_state __P((void));
+extern void _rl_set_the_line __P((void));
+extern int _rl_dispatch __P((int, Keymap));
+extern int _rl_init_argument __P((void));
+extern void _rl_fix_point __P((int));
+extern void _rl_replace_text __P((char *, int, int));
+extern int _rl_char_search_internal __P((int, int, int));
+extern int _rl_set_mark_at_pos __P((int));
+
+/* rltty.c */
+extern int _rl_disable_tty_signals __P((void));
+extern int _rl_restore_tty_signals __P((void));
+
+/* terminal.c */
+extern void _rl_get_screen_size __P((int, int));
+extern int _rl_init_terminal_io __P((char *));
+#ifdef _MINIX
+extern void _rl_output_character_function __P((int));
+#else
+extern int _rl_output_character_function __P((int));
+#endif
+extern void _rl_output_some_chars __P((char *, int));
+extern int _rl_backspace __P((int));
+extern void _rl_enable_meta_key __P((void));
+extern void _rl_control_keypad __P((int));
+
+/* util.c */
+extern int alphabetic __P((int));
+extern int _rl_abort_internal __P((void));
+extern char *_rl_strindex __P((char *, char *));
+extern int _rl_qsort_string_compare __P((char **, char **));
+extern int (_rl_uppercase_p) __P((int));
+extern int (_rl_lowercase_p) __P((int));
+extern int (_rl_pure_alphabetic) __P((int));
+extern int (_rl_digit_p) __P((int));
+extern int (_rl_to_lower) __P((int));
+extern int (_rl_to_upper) __P((int));
+extern int (_rl_digit_value) __P((int));
+
+/* vi_mode.c */
+extern void _rl_vi_initialize_line __P((void));
+extern void _rl_vi_reset_last __P((void));
+extern void _rl_vi_set_last __P((int, int, int));
+extern int _rl_vi_textmod_command __P((int));
+extern void _rl_vi_done_inserting __P((void));
+
+/*************************************************************************
+ * Undocumented private variables					 *
+ *************************************************************************/
+
+/* complete.c */
+extern int _rl_complete_show_all;
+extern int _rl_complete_mark_directories;
+extern int _rl_print_completions_horizontally;
+extern int _rl_completion_case_fold;
+
+/* display.c */
+extern int _rl_vis_botlin;
+extern int _rl_last_c_pos;
+extern int _rl_suppress_redisplay;
+extern char *rl_display_prompt;
+
+/* funmap.c */
+extern char *possible_control_prefixes[];
+extern char *possible_meta_prefixes[];
+
+/* isearch.c */
+extern unsigned char *_rl_isearch_terminators;
+
+/* macro.c */
+extern int _rl_defining_kbd_macro;
+extern char *_rl_executing_macro;
+
+/* readline.c */
+extern int _rl_horizontal_scroll_mode;
+extern int _rl_mark_modified_lines;
+extern int _rl_bell_preference;
+extern int _rl_meta_flag;
+extern int _rl_convert_meta_chars_to_ascii;
+extern int _rl_output_meta_chars;
+extern char *_rl_comment_begin;
+extern unsigned char _rl_parsing_conditionalized_out;
+extern Keymap _rl_keymap;
+extern FILE *_rl_in_stream;
+extern FILE *_rl_out_stream;
+extern int _rl_last_command_was_kill;
+extern int _rl_eof_char;
+extern procenv_t readline_top_level;
+
+/* terminal.c */
+extern int _rl_enable_keypad;
+extern int _rl_enable_meta;
+extern char *term_clreol;
+extern char *term_clrpag;
+extern char *term_im;
+extern char *term_ic;
+extern char *term_ei;
+extern char *term_DC;
+extern char *term_up;
+extern char *term_dc;
+extern char *term_cr;
+extern char *term_IC;
+extern int screenheight;
+extern int screenwidth;
+extern int screenchars;
+extern int terminal_can_insert;
+extern int _rl_term_autowrap;
+
+/* undo.c */
+extern int _rl_doing_an_undo;
+extern int _rl_undo_group_level;
+
+#endif /* _RL_PRIVATE_H_ */
diff --git a/readline/rlshell.h b/readline/rlshell.h
new file mode 100644
index 0000000..7a4e699
--- /dev/null
+++ b/readline/rlshell.h
@@ -0,0 +1,34 @@
+/* rlshell.h -- utility functions normally provided by bash. */
+
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU Readline Library, a library for
+   reading lines of text with interactive input and history editing.
+
+   The GNU Readline Library 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.
+
+   The GNU Readline 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 General Public License for more details.
+
+   The GNU General Public License is often shipped with GNU software, and
+   is generally kept in a file called COPYING or LICENSE.  If you do not
+   have a copy of the license, write to the Free Software Foundation,
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#if !defined (_RL_SHELL_H_)
+#define _RL_SHELL_H_
+
+#include "rlstdc.h"
+
+extern char *single_quote __P((char *));
+extern void set_lines_and_columns __P((int, int));
+extern char *get_env_value __P((char *));
+extern char *get_home_dir __P((void));
+extern int unset_nodelay_mode __P((int));
+
+#endif /* _RL_SHELL_H_ */
diff --git a/readline/rlstdc.h b/readline/rlstdc.h
index 08b0f89..dac8e98 100644
--- a/readline/rlstdc.h
+++ b/readline/rlstdc.h
@@ -7,7 +7,7 @@
 
    Bash 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    Bash is distributed in the hope that it will be useful, but WITHOUT
@@ -17,7 +17,7 @@
 
    You should have received a copy of the GNU General Public License
    along with Bash; see the file COPYING.  If not, write to the Free
-   Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+   Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #if !defined (_RL_STDC_H_)
 #define _RL_STDC_H_
@@ -28,52 +28,12 @@
    and traditional C compilers with something like this:
 	extern char *func __P((char *, char *, int)); */
 
-#if defined (__STDC__)
-
-#  if !defined (__P)
+#if !defined (__P)
+#  if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
 #    define __P(protos) protos
-#  endif
-#  define __STRING(x) #x
-
-#  if !defined (__GNUC__)
-#    define inline
-#  endif
-
-#else /* !__STDC__ */
-
-#  if !defined (__P)
+#  else
 #    define __P(protos) ()
 #  endif
-#  define __STRING(x) "x"
-
-#if defined (__GNUC__)		/* gcc with -traditional */
-#  if !defined (const)
-#    define const  __const
-#  endif
-#  if !defined (inline)
-#    define inline __inline
-#  endif
-#  if !defined (signed)
-#    define signed __signed
-#  endif
-#  if !defined (volatile)
-#    define volatile __volatile
-#  endif
-#else /* !__GNUC__ */
-#  if !defined (const)
-#    define const
-#  endif
-#  if !defined (inline)
-#    define inline
-#  endif
-#  if !defined (signed)
-#    define signed
-#  endif
-#  if !defined (volatile)
-#    define volatile
-#  endif
-#endif /* !__GNUC__ */
-
-#endif /* !__STDC__ */
+#endif
 
 #endif /* !_RL_STDC_H_ */
diff --git a/readline/rltty.c b/readline/rltty.c
index 08cd85b..203056e 100644
--- a/readline/rltty.c
+++ b/readline/rltty.c
@@ -8,7 +8,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -19,7 +19,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -43,28 +43,12 @@
 
 #include "rltty.h"
 #include "readline.h"
+#include "rlprivate.h"
 
 #if !defined (errno)
 extern int errno;
 #endif /* !errno */
 
-extern int readline_echoing_p;
-extern int _rl_eof_char;
-
-extern int _rl_enable_keypad, _rl_enable_meta;
-
-extern void _rl_control_keypad ();
-
-#if defined (__GO32__)
-#  include <pc.h>
-#  if !defined (__DJGPP__)
-#    undef HANDLE_SIGNALS
-#  endif /* !__DJGPP__ */
-#endif /* __GO32__ */
-
-/* Indirect functions to allow apps control over terminal management. */
-extern void rl_prep_terminal (), rl_deprep_terminal ();
-
 VFunction *rl_prep_term_function = rl_prep_terminal;
 VFunction *rl_deprep_term_function = rl_deprep_terminal;
 
@@ -106,6 +90,7 @@
 #    endif /* HAVE_USG_SIGHOLD */
 #  endif /* !HAVE_BSD_SIGNALS */
 #endif /* !HAVE_POSIX_SIGNALS */
+
   sigint_blocked = 1;
 }
 
@@ -113,7 +98,7 @@
 static void
 release_sigint ()
 {
-  if (!sigint_blocked)
+  if (sigint_blocked == 0)
     return;
 
 #if defined (HAVE_POSIX_SIGNALS)
@@ -140,25 +125,27 @@
 /* Non-zero means that the terminal is in a prepped state. */
 static int terminal_prepped;
 
+static _RL_TTY_CHARS _rl_tty_chars, _rl_last_tty_chars;
+
 /* If non-zero, means that this process has called tcflow(fd, TCOOFF)
    and output is suspended. */
 #if defined (__ksr1__)
 static int ksrflow;
 #endif
 
-#if defined (TIOCGWINSZ)
 /* Dummy call to force a backgrounded readline to stop before it tries
    to get the tty settings. */
 static void
 set_winsize (tty)
      int tty;
 {
+#if defined (TIOCGWINSZ)
   struct winsize w;
 
   if (ioctl (tty, TIOCGWINSZ, &w) == 0)
       (void) ioctl (tty, TIOCSWINSZ, &w);
-}
 #endif /* TIOCGWINSZ */
+}
 
 #if defined (NEW_TTY_DRIVER)
 
@@ -186,6 +173,42 @@
 
 static TIOTYPE otio;
 
+static void
+save_tty_chars (tiop)
+     TIOTYPE *tiop;
+{
+  _rl_last_tty_chars = _rl_tty_chars;
+
+  if (tiop->flags & SGTTY_SET)
+    {
+      _rl_tty_chars.t_erase = tiop->sgttyb.sg_erase;
+      _rl_tty_chars.t_kill = tiop->sgttyb.sg_kill;
+    }
+
+  if (tiop->flags & TCHARS_SET)
+    {
+      _rl_tty_chars.t_intr = tiop->tchars.t_intrc;
+      _rl_tty_chars.t_quit = tiop->tchars.t_quitc;
+      _rl_tty_chars.t_start = tiop->tchars.t_startc;
+      _rl_tty_chars.t_stop = tiop->tchars.t_stopc
+      _rl_tty_chars.t_eof = tiop->tchars.t_eofc;
+      _rl_tty_chars.t_eol = '\n';
+      _rl_tty_chars.t_eol2 = tiop->tchars.t_brkc;
+    }
+
+  if (tiop->flags & LTCHARS_SET)
+    {
+      _rl_tty_chars.t_susp = tiop->ltchars.t_suspc;
+      _rl_tty_chars.t_dsusp = tiop->ltchars.t_dsuspc;
+      _rl_tty_chars.t_reprint = tiop->ltchars.t_rprntc;
+      _rl_tty_chars.t_flush = tiop->ltchars.t_flushc;
+      _rl_tty_chars.t_werase = tiop->ltchars.t_werasc;
+      _rl_tty_chars.t_lnext = tiop->ltchars.t_lnextc;
+    }
+
+  _rl_tty_chars.t_status = -1;
+}
+
 static int
 get_tty_settings (tty, tiop)
      int tty;
@@ -262,7 +285,6 @@
      int meta_flag;
      TIOTYPE otio, *tiop;
 {
-#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
   readline_echoing_p = (otio.sgttyb.sg_flags & ECHO);
 
   /* Copy the original settings to the structure we're going to use for
@@ -328,7 +350,6 @@
   tiop->ltchars.t_dsuspc = -1;	/* C-y */
   tiop->ltchars.t_lnextc = -1;	/* C-v */
 #endif /* TIOCGLTC */
-#endif /* !__GO32__ || HAVE_TERMIOS_H */
 }
 
 #else  /* !defined (NEW_TTY_DRIVER) */
@@ -366,11 +387,58 @@
 #endif
 
 static void
+save_tty_chars (tiop)
+     TIOTYPE *tiop;
+{
+  _rl_last_tty_chars = _rl_tty_chars;
+
+  _rl_tty_chars.t_eof = tiop->c_cc[VEOF];
+  _rl_tty_chars.t_eol = tiop->c_cc[VEOL];
+#ifdef VEOL2
+  _rl_tty_chars.t_eol2 = tiop->c_cc[VEOL2];
+#endif
+  _rl_tty_chars.t_erase = tiop->c_cc[VERASE];
+#ifdef VWERASE
+  _rl_tty_chars.t_werase = tiop->c_cc[VWERASE];
+#endif
+  _rl_tty_chars.t_kill = tiop->c_cc[VKILL];
+#ifdef VREPRINT
+  _rl_tty_chars.t_reprint = tiop->c_cc[VREPRINT];
+#endif
+  _rl_tty_chars.t_intr = tiop->c_cc[VINTR];
+  _rl_tty_chars.t_quit = tiop->c_cc[VQUIT];
+#ifdef VSUSP
+  _rl_tty_chars.t_susp = tiop->c_cc[VSUSP];
+#endif
+#ifdef VDSUSP
+  _rl_tty_chars.t_dsusp = tiop->c_cc[VDSUSP];
+#endif
+#ifdef VSTART
+  _rl_tty_chars.t_start = tiop->c_cc[VSTART];
+#endif
+#ifdef VSTOP
+  _rl_tty_chars.t_stop = tiop->c_cc[VSTOP];
+#endif
+#ifdef VLNEXT
+  _rl_tty_chars.t_lnext = tiop->c_cc[VLNEXT];
+#endif
+#ifdef VDISCARD
+  _rl_tty_chars.t_flush = tiop->c_cc[VDISCARD];
+#endif
+#ifdef VSTATUS
+  _rl_tty_chars.t_status = tiop->c_cc[VSTATUS];
+#endif
+}
+
+#if defined (_AIX) || defined (_AIX41)
+/* Currently this is only used on AIX */
+static void
 rltty_warning (msg)
      char *msg;
 {
   fprintf (stderr, "readline: warning: %s\n", msg);
 }
+#endif
 
 #if defined (_AIX)
 void
@@ -386,16 +454,12 @@
 #endif
 
 static int
-get_tty_settings (tty, tiop)
+_get_tty_settings (tty, tiop)
      int tty;
      TIOTYPE *tiop;
 {
   int ioctl_ret;
 
-#if defined (TIOCGWINSZ)
-  set_winsize (tty);
-#endif
-
   while (1)
     {
       ioctl_ret = GETATTR (tty, tiop);
@@ -419,6 +483,21 @@
       break;
     }
 
+  return 0;
+}
+
+static int
+get_tty_settings (tty, tiop)
+     int tty;
+     TIOTYPE *tiop;
+{
+#if defined (TIOCGWINSZ)
+  set_winsize (tty);
+#endif
+
+  if (_get_tty_settings (tty, tiop) < 0)
+    return -1;
+
 #if defined (_AIX)
   setopost(tiop);
 #endif
@@ -427,7 +506,7 @@
 }
 
 static int
-set_tty_settings (tty, tiop)
+_set_tty_settings (tty, tiop)
      int tty;
      TIOTYPE *tiop;
 {
@@ -437,7 +516,17 @@
 	return -1;
       errno = 0;
     }
+  return 0;
+}
 
+static int
+set_tty_settings (tty, tiop)
+     int tty;
+     TIOTYPE *tiop;
+{
+  if (_set_tty_settings (tty, tiop) < 0)
+    return -1;
+    
 #if 0
 
 #if defined (TERMIOS_TTY_DRIVER)
@@ -454,7 +543,7 @@
   ioctl (tty, TCXONC, 1);	/* Simulate a ^Q. */
 #endif /* !TERMIOS_TTY_DRIVER */
 
-#endif
+#endif /* 0 */
 
   return 0;
 }
@@ -526,7 +615,6 @@
 rl_prep_terminal (meta_flag)
      int meta_flag;
 {
-#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
   int tty;
   TIOTYPE tio;
 
@@ -546,6 +634,8 @@
 
   otio = tio;
 
+  save_tty_chars (&otio);
+
   prepare_terminal_settings (meta_flag, otio, &tio);
 
   if (set_tty_settings (tty, &tio) < 0)
@@ -561,14 +651,12 @@
   terminal_prepped = 1;
 
   release_sigint ();
-#endif /* !__GO32__ || HAVE_TERMIOS_H */
 }
 
 /* Restore the terminal's normal settings and modes. */
 void
 rl_deprep_terminal ()
 {
-#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
   int tty;
 
   if (!terminal_prepped)
@@ -593,7 +681,6 @@
   terminal_prepped = 0;
 
   release_sigint ();
-#endif /* !__GO32__ || HAVE_TERMIOS_H */
 }
 
 /* **************************************************************** */
@@ -731,3 +818,54 @@
     }
 #endif /* !NEW_TTY_DRIVER */
 }
+
+#if defined (HANDLE_SIGNALS)
+
+#if defined (NEW_TTY_DRIVER)
+int
+_rl_disable_tty_signals ()
+{
+  return 0;
+}
+
+int
+_rl_restore_tty_signals ()
+{
+  return 0;
+}
+#else
+
+static TIOTYPE sigstty, nosigstty;
+static int tty_sigs_disabled = 0;
+
+int
+_rl_disable_tty_signals ()
+{
+  if (tty_sigs_disabled)
+    return 0;
+
+  if (_get_tty_settings (fileno (rl_instream), &sigstty) < 0)
+    return -1;
+
+  nosigstty = sigstty;
+
+  nosigstty.c_lflag &= ~ISIG;
+
+  if (_set_tty_settings (fileno (rl_instream), &nosigstty) < 0)
+    return (_set_tty_settings (fileno (rl_instream), &sigstty));
+
+  tty_sigs_disabled = 1;
+  return 0;
+}
+
+int
+_rl_restore_tty_signals ()
+{
+  if (tty_sigs_disabled == 0)
+    return 0;
+
+  return (_set_tty_settings (fileno (rl_instream), &sigstty));
+}
+#endif /* !NEW_TTY_DRIVER */
+
+#endif /* HANDLE_SIGNALS */
diff --git a/readline/rltty.h b/readline/rltty.h
index fe78346..029a3fb 100644
--- a/readline/rltty.h
+++ b/readline/rltty.h
@@ -8,7 +8,7 @@
 
    The Library 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    The Library is distributed in the hope that it will be useful, but
@@ -19,10 +19,10 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #if !defined (_RLTTY_H_)
-#define _RLTTY_H
+#define _RLTTY_H_
 
 /* Posix systems use termios and the Posix signal functions. */
 #if defined (TERMIOS_TTY_DRIVER)
@@ -60,4 +60,23 @@
 #  endif /* !_SVR4_DISABLE */
 #endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
 
+typedef struct _rl_tty_chars {
+  char t_eof;
+  char t_eol;
+  char t_eol2;
+  char t_erase;
+  char t_werase;
+  char t_kill;
+  char t_reprint;
+  char t_intr;
+  char t_quit;
+  char t_susp;
+  char t_dsusp;
+  char t_start;
+  char t_stop;
+  char t_lnext;
+  char t_flush;
+  char t_status;
+} _RL_TTY_CHARS;
+
 #endif /* _RLTTY_H_ */
diff --git a/readline/rlwinsize.h b/readline/rlwinsize.h
index 92b3de1..7838154 100644
--- a/readline/rlwinsize.h
+++ b/readline/rlwinsize.h
@@ -9,7 +9,7 @@
 
    The Library 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    The Library is distributed in the hope that it will be useful, but
@@ -20,7 +20,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #if !defined (_RLWINSIZE_H_)
 #define _RLWINSIZE_H_
@@ -55,4 +55,3 @@
 
 #endif /* _RL_WINSIZE_H */
 
-
diff --git a/readline/savestring.c b/readline/savestring.c
index 3f53a87..485890e 100644
--- a/readline/savestring.c
+++ b/readline/savestring.c
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 extern char *strcpy ();
 extern char *xmalloc ();
diff --git a/readline/search.c b/readline/search.c
index 6c76e1a..112f807 100644
--- a/readline/search.c
+++ b/readline/search.c
@@ -8,7 +8,7 @@
 
    The Library 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    The Library is distributed in the hope that it will be useful, but
@@ -19,7 +19,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -43,30 +43,51 @@
 #include "readline.h"
 #include "history.h"
 
+#include "rlprivate.h"
+#include "xmalloc.h"
+
 #ifdef abs
 #  undef abs
 #endif
 #define abs(x)		(((x) >= 0) ? (x) : -(x))
 
-extern char *xmalloc (), *xrealloc ();
-
-/* Variables imported from readline.c */
-extern int rl_point, rl_end, rl_line_buffer_len;
-extern int rl_editing_mode;
-extern char *rl_prompt;
-extern char *rl_line_buffer;
 extern HIST_ENTRY *saved_line_for_history;
-extern Function *rl_last_func;
 
 /* Functions imported from the rest of the library. */
-extern int _rl_free_history_entry ();
-extern char *_rl_make_prompt_for_search ();
-extern void rl_extend_line_buffer ();
+extern int _rl_free_history_entry __P((HIST_ENTRY *));
 
 static char *noninc_search_string = (char *) NULL;
 static int noninc_history_pos;
+
 static char *prev_line_found = (char *) NULL;
 
+static int rl_history_search_len;
+static int rl_history_search_pos;
+static char *history_search_string;
+static int history_string_size;
+
+/* Make the data from the history entry ENTRY be the contents of the
+   current line.  This doesn't do anything with rl_point; the caller
+   must set it. */
+static void
+make_history_line_current (entry)
+     HIST_ENTRY *entry;
+{
+  int line_len;
+
+  line_len = strlen (entry->line);
+  if (line_len >= rl_line_buffer_len)
+    rl_extend_line_buffer (line_len);
+  strcpy (rl_line_buffer, entry->line);
+
+  rl_undo_list = (UNDO_LIST *)entry->data;
+  rl_end = line_len;
+
+  if (saved_line_for_history)
+    _rl_free_history_entry (saved_line_for_history);
+  saved_line_for_history = (HIST_ENTRY *)NULL;
+}
+
 /* Search the history list for STRING starting at absolute history position
    POS.  If STRING begins with `^', the search must match STRING at the
    beginning of a history line, otherwise a full substring match is performed
@@ -102,7 +123,7 @@
      char *string;
      int dir;
 {
-  int oldpos, pos, line_len;
+  int oldpos, pos;
   HIST_ENTRY *entry;
 
   if (string == 0 || *string == '\0' || noninc_history_pos < 0)
@@ -132,19 +153,10 @@
 #endif
   history_set_pos (oldpos);
 
-  line_len = strlen (entry->line);
-  if (line_len >= rl_line_buffer_len)
-    rl_extend_line_buffer (line_len);
-  strcpy (rl_line_buffer, entry->line);
+  make_history_line_current (entry);
 
-  rl_undo_list = (UNDO_LIST *)entry->data;
-  rl_end = strlen (rl_line_buffer);
   rl_point = 0;
   rl_clear_message ();
-
-  if (saved_line_for_history)
-    _rl_free_history_entry (saved_line_for_history);
-  saved_line_for_history = (HIST_ENTRY *)NULL;
 }
 
 /* Search non-interactively through the history list.  DIR < 0 means to
@@ -235,8 +247,7 @@
     {
       /* We want to start the search from the current history position. */
       noninc_history_pos = where_history ();
-      if (noninc_search_string)
-	free (noninc_search_string);
+      FREE (noninc_search_string);
       noninc_search_string = savestring (rl_line_buffer);
     }
 
@@ -295,59 +306,84 @@
 }
 
 static int
-rl_history_search_internal (count, direction)
-     int count, direction;
+rl_history_search_internal (count, dir)
+     int count, dir;
 {
-  HIST_ENTRY *temp, *old_temp;
-  int line_len;
+  HIST_ENTRY *temp;
+  int ret, oldpos;
 
   maybe_save_line ();
+  temp = (HIST_ENTRY *)NULL;
 
-  temp = old_temp = (HIST_ENTRY *)NULL;
+  /* Search COUNT times through the history for a line whose prefix
+     matches history_search_string.  When this loop finishes, TEMP,
+     if non-null, is the history line to copy into the line buffer. */
   while (count)
     {
-      temp = (direction < 0) ? previous_history () : next_history ();
-      if (temp == 0)
-        break;
-      /* On an empty prefix, make this the same as previous-history. */
-      if (rl_point == 0)
-	{
-	  count--;
-	  continue;
-	}
-      if (STREQN (rl_line_buffer, temp->line, rl_point))
-	{
-	  /* Don't find multiple instances of the same line. */
-	  if (prev_line_found && STREQ (prev_line_found, temp->line))
-	    continue;
-          if (direction < 0)
-            old_temp = temp;
-          prev_line_found = temp->line;
-          count--;
-	}
+      ret = noninc_search_from_pos (history_search_string, rl_history_search_pos + dir, dir);
+      if (ret == -1)
+	break;
+
+      /* Get the history entry we found. */
+      rl_history_search_pos = ret;
+      oldpos = where_history ();
+      history_set_pos (rl_history_search_pos);
+      temp = current_history ();
+      history_set_pos (oldpos);
+
+      /* Don't find multiple instances of the same line. */
+      if (prev_line_found && STREQ (prev_line_found, temp->line))
+        continue;
+      prev_line_found = temp->line;
+      count--;
     }
 
+  /* If we didn't find anything at all, return. */
   if (temp == 0)
     {
-      if (direction < 0 && old_temp)
-	temp = old_temp;
-      else
-	{
-	  maybe_unsave_line ();
-	  ding ();
-	  return 1;
-	}
+      maybe_unsave_line ();
+      ding ();
+      /* If you don't want the saved history line (last match) to show up
+         in the line buffer after the search fails, change the #if 0 to
+         #if 1 */
+#if 0
+      if (rl_point > rl_history_search_len)
+        {
+          rl_point = rl_end = rl_history_search_len;
+          rl_line_buffer[rl_end] = '\0';
+        }
+#else
+      rl_point = rl_history_search_len;	/* maybe_unsave_line changes it */
+#endif
+      return 1;
     }
 
-  line_len = strlen (temp->line);
-  if (line_len >= rl_line_buffer_len)
-    rl_extend_line_buffer (line_len);
-  strcpy (rl_line_buffer, temp->line);
-  rl_undo_list = (UNDO_LIST *)temp->data;
-  rl_end = line_len;
+  /* Copy the line we found into the current line buffer. */
+  make_history_line_current (temp);
+
+  rl_point = rl_history_search_len;
   return 0;
 }
 
+static void
+rl_history_search_reinit ()
+{
+  rl_history_search_pos = where_history ();
+  rl_history_search_len = rl_point;
+  prev_line_found = (char *)NULL;
+  if (rl_point)
+    {
+      if (rl_history_search_len >= history_string_size - 2)
+	{
+	  history_string_size = rl_history_search_len + 2;
+	  history_search_string = xrealloc (history_search_string, history_string_size);
+	}
+      history_search_string[0] = '^';
+      strncpy (history_search_string + 1, rl_line_buffer, rl_point);
+      history_search_string[rl_point + 1] = '\0';
+    }
+}
+
 /* Search forward in the history for the string of characters
    from the start of the line to rl_point.  This is a non-incremental
    search. */
@@ -357,8 +393,13 @@
 {
   if (count == 0)
     return (0);
-  if (rl_last_func != rl_history_search_forward)
-    prev_line_found = (char *)NULL;
+
+  if (rl_last_func != rl_history_search_forward &&
+      rl_last_func != rl_history_search_backward)
+    rl_history_search_reinit ();
+
+  if (rl_history_search_len == 0)
+    return (rl_get_next_history (count, ignore));
   return (rl_history_search_internal (abs (count), (count > 0) ? 1 : -1));
 }
 
@@ -371,7 +412,12 @@
 {
   if (count == 0)
     return (0);
-  if (rl_last_func != rl_history_search_backward)
-    prev_line_found = (char *)NULL;
+
+  if (rl_last_func != rl_history_search_forward &&
+      rl_last_func != rl_history_search_backward)
+    rl_history_search_reinit ();
+
+  if (rl_history_search_len == 0)
+    return (rl_get_previous_history (count, ignore));
   return (rl_history_search_internal (abs (count), (count > 0) ? -1 : 1));
 }
diff --git a/readline/shell.c b/readline/shell.c
index f0ddc89..b32726c 100644
--- a/readline/shell.c
+++ b/readline/shell.c
@@ -8,7 +8,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -19,7 +19,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -45,13 +45,21 @@
 #  include <strings.h>
 #endif /* !HAVE_STRING_H */
 
+#include <fcntl.h>
 #include <pwd.h>
 
+#include <stdio.h>
+
+#include "rlshell.h"
+#include "xmalloc.h"
+
 #if !defined (HAVE_GETPW_DECLS)
 extern struct passwd *getpwuid ();
 #endif /* !HAVE_GETPW_DECLS */
 
-extern char *xmalloc ();
+#ifndef NULL
+#  define NULL 0
+#endif
 
 /* All of these functions are resolved from bash if we are linking readline
    as part of bash. */
@@ -64,7 +72,7 @@
   register int c;
   char *result, *r, *s;
 
-  result = (char *)xmalloc (3 + (3 * strlen (string)));
+  result = (char *)xmalloc (3 + (4 * strlen (string)));
   r = result;
   *r++ = '\'';
 
@@ -132,3 +140,37 @@
     home_dir = entry->pw_dir;
   return (home_dir);
 }
+
+#if !defined (O_NDELAY)
+#  if defined (FNDELAY)
+#    define O_NDELAY FNDELAY
+#  endif
+#endif
+
+int
+unset_nodelay_mode (fd)
+     int fd;
+{
+  int flags, bflags;
+
+  if ((flags = fcntl (fd, F_GETFL, 0)) < 0)
+    return -1;
+
+  bflags = 0;
+
+#ifdef O_NONBLOCK
+  bflags |= O_NONBLOCK;
+#endif
+
+#ifdef O_NDELAY
+  bflags |= O_NDELAY;
+#endif
+
+  if (flags & bflags)
+    {
+      flags &= ~bflags;
+      return (fcntl (fd, F_SETFL, flags));
+    }
+
+  return 0;
+}
diff --git a/readline/shlib/Makefile.in b/readline/shlib/Makefile.in
index bff52f7..b1f70de 100644
--- a/readline/shlib/Makefile.in
+++ b/readline/shlib/Makefile.in
@@ -15,7 +15,8 @@
 
 # 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
 RL_LIBRARY_VERSION = @LIBVERSION@
 RL_LIBRARY_NAME = readline
 
@@ -75,9 +76,9 @@
 SHLIB_STATUS = @SHLIB_STATUS@
 
 # shared library versioning
-SHLIB_MAJOR=		4
+SHLIB_MAJOR=		@SHLIB_MAJOR@
 # shared library systems like SVR4's do not use minor versions
-SHLIB_MINOR=		.0
+SHLIB_MINOR=		.@SHLIB_MINOR@
 
 # For libraries which include headers from other libraries.
 INCLUDES = -I. -I.. -I$(topdir) -I$(includedir)
@@ -112,7 +113,7 @@
 # The header files for this library.
 HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
 	   posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \
-	   ansi_stdlib.h tcap.h
+	   ansi_stdlib.h tcap.h xmalloc.h rlprivate.h rlshell.h
 
 SHARED_HISTOBJ = history.so histexpand.so histfile.so histsearch.so shell.so
 SHARED_TILDEOBJ = tilde.so
@@ -131,7 +132,7 @@
 	@echo "Your system and compiler (${host_os}-${CC}) are not supported by the"
 	@echo "${topdir}/support/shobj-conf script."
 	@echo "If your operating system provides facilities for creating"
-	@echo "shared libraries, please update the script and re-run configure.
+	@echo "shared libraries, please update the script and re-run configure."
 	@echo "Please send the changes you made to bash-maintainers@gnu.org"
 	@echo "for inclusion in future bash and readline releases."
 
@@ -222,6 +223,8 @@
 macro.so: $(topdir)/tilde.h $(topdir)/history.h
 nls.so: $(topdir)/ansi_stdlib.h
 nls.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h
+nls.o: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
+nls.o: $(topdir)/tilde.h $(topdir)/history.h $(topdir)/rlstdc.h  
 parens.so: $(topdir)/rlconf.h ${BUILD_DIR}/config.h
 parens.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
 parens.so: $(topdir)/tilde.h
@@ -257,6 +260,54 @@
 xmalloc.so: ${BUILD_DIR}/config.h
 xmalloc.so: $(topdir)/ansi_stdlib.h
 
+bind.so: $(topdir)/rlshell.h
+histfile.so: $(topdir)/rlshell.h
+nls.so: $(topdir)/rlshell.h
+readline.so: $(topdir)/rlshell.h
+shell.so: $(topdir)/rlshell.h
+terminal.so: $(topdir)/rlshell.h
+histexpand.so: $(topdir)/rlshell.h
+
+bind.so: $(topdir)/rlprivate.h
+callback.so: $(topdir)/rlprivate.h
+complete.so: $(topdir)/rlprivate.h
+display.so: $(topdir)/rlprivate.h
+input.so: $(topdir)/rlprivate.h
+isearch.so: $(topdir)/rlprivate.h
+kill.so: $(topdir)/rlprivate.h
+macro.so: $(topdir)/rlprivate.h
+nls.so: $(topdir)/rlprivate.h   
+parens.so: $(topdir)/rlprivate.h
+readline.so: $(topdir)/rlprivate.h
+rltty.so: $(topdir)/rlprivate.h 
+search.so: $(topdir)/rlprivate.h
+signals.so: $(topdir)/rlprivate.h
+terminal.so: $(topdir)/rlprivate.h
+undo.so: $(topdir)/rlprivate.h
+util.so: $(topdir)/rlprivate.h
+vi_mode.so: $(topdir)/rlprivate.h
+
+bind.so: $(topdir)/xmalloc.h
+complete.so: $(topdir)/xmalloc.h
+display.so: $(topdir)/xmalloc.h
+funmap.so: $(topdir)/xmalloc.h
+histexpand.so: $(topdir)/xmalloc.h
+histfile.so: $(topdir)/xmalloc.h
+history.so: $(topdir)/xmalloc.h
+input.so: $(topdir)/xmalloc.h
+isearch.so: $(topdir)/xmalloc.h
+keymaps.so: $(topdir)/xmalloc.h
+kill.so: $(topdir)/xmalloc.h
+macro.so: $(topdir)/xmalloc.h
+readline.so: $(topdir)/xmalloc.h
+savestring.so: $(topdir)/xmalloc.h
+search.so: $(topdir)/xmalloc.h
+shell.so: $(topdir)/xmalloc.h
+tilde.so: $(topdir)/xmalloc.h
+tilde.so: $(topdir)/xmalloc.h
+util.so: $(topdir)/xmalloc.h
+vi_mode.so: $(topdir)/xmalloc.h
+
 readline.so: $(topdir)/readline.c
 vi_mode.so: $(topdir)/vi_mode.c
 funmap.so: $(topdir)/funmap.c
diff --git a/readline/signals.c b/readline/signals.c
index 40e0912..283a115 100644
--- a/readline/signals.c
+++ b/readline/signals.c
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -40,15 +40,13 @@
 #  include <sys/ioctl.h>
 #endif /* GWINSZ_IN_SYS_IOCTL */
 
-#if defined (__GO32__) && !defined(__DJGPP__)
-#  undef HANDLE_SIGNALS
-#endif /* __GO32__  && !__DJGPP__ */
-
 #if defined (HANDLE_SIGNALS)
 /* Some standard library routines. */
 #include "readline.h"
 #include "history.h"
 
+#include "rlprivate.h"
+
 #if !defined (RETSIGTYPE)
 #  if defined (VOID_SIGHANDLER)
 #    define RETSIGTYPE void
@@ -67,19 +65,15 @@
    to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */
 typedef RETSIGTYPE SigHandler ();
 
-extern int readline_echoing_p;
-extern int rl_pending_input;
-extern int _rl_meta_flag;
+#if defined (HAVE_POSIX_SIGNALS)
+typedef struct sigaction sighandler_cxt;
+#  define rl_sigaction(s, nh, oh)	sigaction(s, nh, oh)
+#else
+typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt;
+#  define sigemptyset(m)
+#endif /* !HAVE_POSIX_SIGNALS */
 
-extern void free_undo_list ();
-extern void _rl_get_screen_size ();
-extern void _rl_redisplay_after_sigwinch ();
-extern void _rl_clean_up_for_exit ();
-extern void _rl_kill_kbd_macro ();
-extern void _rl_init_argument ();
-extern void rl_deprep_terminal (), rl_prep_terminal ();
-
-static SigHandler *rl_set_sighandler ();
+static SigHandler *rl_set_sighandler __P((int, SigHandler *, sighandler_cxt *));
 
 /* Exported variables for use by applications. */
 
@@ -103,14 +97,6 @@
 /*								    */
 /* **************************************************************** */
 
-#if defined (HAVE_POSIX_SIGNALS)
-typedef struct sigaction sighandler_cxt;
-#  define rl_sigaction(s, nh, oh)	sigaction(s, nh, oh)
-#else
-typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt;
-#  define sigemptyset(m)
-#endif /* !HAVE_POSIX_SIGNALS */
-
 static sighandler_cxt old_int, old_term, old_alrm, old_quit;
 #if defined (SIGTSTP)
 static sighandler_cxt old_tstp, old_ttou, old_ttin;
@@ -167,6 +153,10 @@
 #  endif /* HAVE_BSD_SIGNALS */
 #endif /* !HAVE_POSIX_SIGNALS */
 
+#if defined (__EMX__)
+      signal (sig, SIG_ACK);
+#endif
+
       kill (getpid (), sig);
 
       /* Let the signal that we just sent through.  */
@@ -234,6 +224,7 @@
      SigHandler *handler;
      sighandler_cxt *ohandler;
 {
+  sighandler_cxt old_handler;
 #if defined (HAVE_POSIX_SIGNALS)
   struct sigaction act;
 
@@ -241,10 +232,17 @@
   act.sa_flags = 0;
   sigemptyset (&act.sa_mask);
   sigemptyset (&ohandler->sa_mask);
-  sigaction (sig, &act, ohandler);
+  sigaction (sig, &act, &old_handler);
 #else
-  ohandler->sa_handler = (SigHandler *)signal (sig, handler);
+  old_handler.sa_handler = (SigHandler *)signal (sig, handler);
 #endif /* !HAVE_POSIX_SIGNALS */
+
+  /* XXX -- assume we have memcpy */
+  /* If rl_set_signals is called twice in a row, don't set the old handler to
+     rl_signal_handler, because that would cause infinite recursion. */
+  if (handler != rl_signal_handler || old_handler.sa_handler != rl_signal_handler)
+    memcpy (ohandler, &old_handler, sizeof (sighandler_cxt));
+
   return (ohandler->sa_handler);
 }
 
diff --git a/readline/support/config.guess b/readline/support/config.guess
index 66a2428..ad5983e 100755
--- a/readline/support/config.guess
+++ b/readline/support/config.guess
@@ -35,6 +35,19 @@
 # (but try to keep the structure clean).
 #
 
+# Use $HOST_CC if defined. $CC may point to a cross-compiler
+if test x"$CC_FOR_BUILD" = x; then
+  if test x"$HOST_CC" != x; then
+    CC_FOR_BUILD="$HOST_CC"
+  else
+    if test x"$CC" != x; then
+      CC_FOR_BUILD="$CC"
+    else
+      CC_FOR_BUILD=cc
+    fi
+  fi
+fi
+
 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
 # (ghazi@noc.rutgers.edu 8/24/94.)
 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
@@ -57,7 +70,8 @@
 REL_LEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.\([0-9]*\)'`    # 1
 REL_SUBLEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.[0-9]*.\([0-9]*\)'` # 2
 
-trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
 
 # Some versions of i386 SVR4.2 make `uname' equivalent to `uname -n', which
 # is contrary to all other versions of uname
@@ -81,9 +95,6 @@
     i?86:OpenBSD:*:*)
 	echo ${UNAME_MACHINE}-pc-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
 	exit 0 ;;
-    i?86:FreeBSD:*:*)
-	echo ${UNAME_MACHINE}-pc-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-	exit 0 ;;
     sparc:NetBSD:*:*)
 	echo sparc-unknown-netbsd${UNAME_RELEASE}
 	exit 0 ;;
@@ -151,17 +162,11 @@
     *:QNX:*:42*)
 	echo i386-qssl-qnx`echo ${UNAME_VERSION}`
 	exit 0 ;;
-    BeBox:BeOS:*:*)
-	echo powerpc-be-beos
+    Alpha*:Windows:NT:*:SP*)
+	echo alpha-pc-opennt
 	exit 0 ;;
-    BeMac:BeOS:*:*)
-	echo powerpc-apple-beos
-	exit 0 ;;
-    BePC:BeOS:*:*)
-	echo i586-pc-beos
-	exit 0 ;;
-    SX-4:SUPER-UX:*:*)
-	echo sx4-nec-superux${UNAME_RELEASE}
+    *:Windows:NT:*:SP*)
+	echo intel-pc-opennt
 	exit 0 ;;
     # end cases added for Bash
     alpha:OSF1:*:*)
@@ -172,7 +177,7 @@
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	cat <<EOF >dummy.s
+	cat <<EOF >$dummy.s
 	.globl main
 	.ent main
 main:
@@ -189,9 +194,9 @@
 	ret \$31,(\$26),1
 	.end main
 EOF
-	${CC-cc} dummy.s -o dummy 2>/dev/null
+	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
 	if test "$?" = 0 ; then
-		./dummy
+		./$dummy
 		case "$?" in
 			7)
 				UNAME_MACHINE="alpha"
@@ -210,9 +215,15 @@
 				;;
 		esac
 	fi
-	rm -f dummy.s dummy
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
+	rm -f $dummy.s $dummy
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
 	exit 0 ;;
+    Alpha\ *:Windows_NT*:*)
+        # How do we know it's Interix rather than the generic POSIX subsystem?
+        # Should we change UNAME_MACHINE based on the output of uname instead
+        # of the specific Alpha model?
+        echo alpha-pc-interix
+        exit 0 ;;
     21064:Windows_NT:50:3)
 	echo alpha-dec-winnt3.5
 	exit 0 ;;
@@ -255,7 +266,7 @@
     SR2?01:HI-UX/MPP:*:*)
 	echo hppa1.1-hitachi-hiuxmpp
 	exit 0;;
-    Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
 	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
 	if test "`(/bin/universe) 2>/dev/null`" = att ; then
 		echo pyramid-pyramid-sysv3
@@ -263,9 +274,12 @@
 		echo pyramid-pyramid-bsd
 	fi
 	exit 0 ;;
-    NILE:*:*:dcosx)
+    NILE:*:*:*:dcosx)
 	echo pyramid-pyramid-svr4
 	exit 0 ;;
+    sun4H:SunOS:5.*:*)
+        echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+        exit 0 ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit 0 ;;
@@ -287,7 +301,7 @@
 	# Japanese Language versions have a version number like `4.1.3-JL'.
 	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
 	exit 0 ;;
-    sun3*:SunOS:*:*|sun:SunOS:*:*)
+    sun3*:SunOS:*:*)
 	echo m68k-sun-sunos${UNAME_RELEASE}
 	exit 0 ;;
     sun*:*:4.2BSD:*)
@@ -309,19 +323,45 @@
 	echo m68k-atari-netbsd${UNAME_RELEASE}
 	exit 0 ;;
     atari*:OpenBSD:*:*)
-	echo m68k-atari-openbsd${UNAME_RELEASE}
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor 
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit 0 ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit 0 ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit 0 ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit 0 ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit 0 ;;
     sun3*:NetBSD:*:*)
 	echo m68k-sun-netbsd${UNAME_RELEASE}
 	exit 0 ;;
     sun3*:OpenBSD:*:*)
-	echo m68k-sun-openbsd${UNAME_RELEASE}
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
     mac68k:NetBSD:*:*)
 	echo m68k-apple-netbsd${UNAME_RELEASE}
 	exit 0 ;;
     mac68k:OpenBSD:*:*)
-	echo m68k-apple-openbsd${UNAME_RELEASE}
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
     mvme68k:OpenBSD:*:*)
 	echo m68k-unknown-openbsd${UNAME_RELEASE}
@@ -329,15 +369,15 @@
     mvme88k:OpenBSD:*:*)
 	echo m88k-unknown-openbsd${UNAME_RELEASE}
 	exit 0 ;;
-    Power?Macintosh:Rhapsody:*:*)
-      echo powerpc-apple-rhapsody${UNAME_RELEASE}
-      exit 0 ;;
-    *:Rhapsody:*:*)
-      echo ${UNAME_MACHINE}-unknown-rhapsody${UNAME_RELEASE}
-      exit 0 ;;
+    *:"Mac OS":*:*)
+	echo `uname -p`-apple-macos${UNAME_RELEASE}
+	exit 0 ;;
     powerpc:machten:*:*)
 	echo powerpc-apple-machten${UNAME_RELEASE}
 	exit 0 ;;
+    macppc:NetBSD:*:*)
+        echo powerpc-apple-netbsd${UNAME_RELEASE}
+        exit 0 ;;
     RISC*:Mach:*:*)
 	echo mips-dec-mach_bsd4.3
 	exit 0 ;;
@@ -347,12 +387,16 @@
     VAX*:ULTRIX*:*:*)
 	echo vax-dec-ultrix${UNAME_RELEASE}
 	exit 0 ;;
-    2020:CLIX:*:*)
+    2020:CLIX:*:* | 2430:CLIX:*:*)
 	echo clipper-intergraph-clix${UNAME_RELEASE}
 	exit 0 ;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
-	sed 's/^	//' << EOF >dummy.c
-	int main (argc, argv) int argc; char **argv; {
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
 	#if defined (host_mips) && defined (MIPSEB)
 	#if defined (SYSTYPE_SYSV)
 	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
@@ -367,10 +411,10 @@
 	  exit (-1);
 	}
 EOF
-	${CC-cc} dummy.c -o dummy \
-	  && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
-	  && rm dummy.c dummy && exit 0
-	rm -f dummy.c dummy
+	$CC_FOR_BUILD $dummy.c -o $dummy \
+	  && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+	  && rm $dummy.c $dummy && exit 0
+	rm -f $dummy.c $dummy
 	echo mips-mips-riscos${UNAME_RELEASE}
 	exit 0 ;;
     Night_Hawk:Power_UNIX:*:*)
@@ -389,13 +433,14 @@
 	# DG/UX returns AViiON for all architectures
 	UNAME_PROCESSOR=`/usr/bin/uname -p`
 	if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
-	if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+	  if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
 	     -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
 		echo m88k-dg-dgux${UNAME_RELEASE}
-	else
+	  else
 		echo m88k-dg-dguxbcs${UNAME_RELEASE}
-	fi
-	else echo i586-dg-dgux${UNAME_RELEASE}
+	  fi
+	else
+	  echo i586-dg-dgux${UNAME_RELEASE}
 	fi
  	exit 0 ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
@@ -422,7 +467,7 @@
 	exit 0 ;;
     *:AIX:2:3)
 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-		sed 's/^		//' << EOF >dummy.c
+		sed 's/^		//' << EOF >$dummy.c
 		#include <sys/systemcfg.h>
 
 		main()
@@ -433,8 +478,8 @@
 			exit(0);
 			}
 EOF
-		${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
-		rm -f dummy.c dummy
+		$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+		rm -f $dummy.c $dummy
 		echo rs6000-ibm-aix3.2.5
 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
 		echo rs6000-ibm-aix3.2.4
@@ -443,7 +488,8 @@
 	fi
 	exit 0 ;;
     *:AIX:*:4)
-	if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
 	else
 		IBM_ARCH=powerpc
@@ -484,17 +530,46 @@
 	case "${UNAME_MACHINE}" in
 	    9000/31? )		HP_ARCH=m68000 ;;
 	    9000/[34]?? )	HP_ARCH=m68k ;;
-	    9000/78? | 9000/80[24] | 9000/8[67]1 | 9000/8[78]9 | 9000/893 )
-				HP_ARCH=hppa2.0 ;;
-	    9000/7?? | 9000/8?[13679] | 9000/892 )
-				HP_ARCH=hppa1.1 ;;
-	    9000/[68]?? )	HP_ARCH=hppa1.0 ;;
+	    9000/[678][0-9][0-9])
+              sed 's/^              //' << EOF >$dummy.c
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+	($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+	rm -f $dummy.c $dummy
 	esac
 	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
 	exit 0 ;;
     3050*:HI-UX:*:*)
-	sed 's/^	//' << EOF >dummy.c
+	sed 's/^	//' << EOF >$dummy.c
 	#include <unistd.h>
 	int
 	main ()
@@ -519,8 +594,8 @@
 	  exit (0);
 	}
 EOF
-	${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
-	rm -f dummy.c dummy
+	$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+	rm -f $dummy.c $dummy
 	echo unknown-hitachi-hiuxwe2
 	exit 0 ;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
@@ -529,6 +604,9 @@
     9000/8??:4.3bsd:*:*)
 	echo hppa1.0-hp-bsd
 	exit 0 ;;
+    *9??*:MPE/iX:*:*)
+        echo hppa1.0-hp-mpeix
+        exit 0 ;;
     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
 	echo hppa1.1-hp-osf
 	exit 0 ;;
@@ -537,14 +615,17 @@
 	exit 0 ;;
     i?86:OSF1:*:*)
 	if [ -x /usr/sbin/sysversion ] ; then
-	    echo ${UNAME_MACHINE}-pc-osf1mk
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
 	else
-	    echo ${UNAME_MACHINE}-pc-osf1
+	    echo ${UNAME_MACHINE}-unknown-osf1
 	fi
 	exit 0 ;;
     parisc*:Lites*:*:*)
 	echo hppa1.1-hp-lites
 	exit 0 ;;
+    hppa*:OpenBSD:*:*)
+        echo hppa-unknown-openbsd
+        exit 0 ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
 	echo c1-convex-bsd
         exit 0 ;;
@@ -577,11 +658,14 @@
     CRAY*TS:*:*:*)
 	echo t90-cray-unicos${UNAME_RELEASE}
 	exit 0 ;;
+    CRAY*T3E:*:*:*)
+        echo alpha-cray-unicosmk${UNAME_RELEASE}
+        exit 0 ;;
     CRAY-2:*:*:*)
 	echo cray2-cray-unicos
         exit 0 ;;
     F300:UNIX_System_V:*:*)
-	FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
 	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
 	echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit 0 ;;
@@ -591,14 +675,26 @@
     hp3[0-9][05]:NetBSD:*:*)
 	echo m68k-hp-netbsd${UNAME_RELEASE}
 	exit 0 ;;
-    hp3[0-9][05]:OpenBSD:*:*)
-	echo m68k-hp-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    i?86:BSD/386:*:* | *:BSD/OS:*:*)
+    hp300:OpenBSD:*:*)
+        echo m68k-unknown-openbsd${UNAME_RELEASE}
+        exit 0 ;;
+    i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
 	exit 0 ;;
+    sparc*:BSD/OS:*:*)
+        echo sparc-unknown-bsdi${UNAME_RELEASE}
+        exit 0 ;;
+    *:BSD/OS:*:*)
+        echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+        exit 0 ;;
     *:FreeBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	if test -x /usr/bin/objformat; then
+	    if test "elf" = "`/usr/bin/objformat`"; then
+		echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
+		exit 0
+	    fi
+	fi
+	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-=(].*//'`
 	exit 0 ;;
     *:NetBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
@@ -607,14 +703,23 @@
 	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
 	exit 0 ;;
     i*:CYGWIN*:*)
-	echo i386-pc-cygwin32
+	echo ${UNAME_MACHINE}-pc-cygwin32
 	exit 0 ;;
     i*:MINGW*:*)
-	echo i386-pc-mingw32
+	echo ${UNAME_MACHINE}-pc-mingw32
 	exit 0 ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+        # How do we know it's Interix rather than the generic POSIX subsystem?
+        # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+        # UNAME_MACHINE based on the output of uname instead of i386?
+        echo i386-pc-interix
+        exit 0 ;;
+    i*:UWIN*:*)
+        echo ${UNAME_MACHINE}-pc-uwin
+        exit 0 ;;
     p*:CYGWIN*:*)
-	echo powerpcle-unknown-cygwin32
-	exit 0 ;;
+	echo powerpcle-unknown-cygwin
+	exit 0 ;;    
     prep*:SunOS:5.*:*)
 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit 0 ;;
@@ -622,9 +727,17 @@
 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit 0 ;;
     *:Linux:*:*)
+        # uname on the ARM produces all sorts of strangeness, and we need to
+        # filter it out.
+        case "$UNAME_MACHINE" in
+          armv*)                      UNAME_MACHINE=$UNAME_MACHINE ;;
+          arm* | sa110*)              UNAME_MACHINE="arm" ;;
+        esac
+
 	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us.
-	ld_help_string=`ld --help 2>&1`
+	# first see if it will tell us.  cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	ld_help_string=`cd /; ld --help 2>&1`
 	ld_supported_emulations=`echo $ld_help_string \
 			 | sed -ne '/supported emulations:/!d
 				    s/[ 	][ 	]*/ /g
@@ -632,15 +745,46 @@
 				    s/ .*//
 				    p'`
 	case "$ld_supported_emulations" in
+	  *ia64)      echo "${UNAME_MACHINE}-unknown-linux"         ; exit 0 ;;
 	  i?86linux)  echo "${UNAME_MACHINE}-pc-linux-gnuaout"      ; exit 0 ;;
 	  i?86coff)   echo "${UNAME_MACHINE}-pc-linux-gnucoff"      ; exit 0 ;;
 	  sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+	  armlinux)   echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
 	  m68klinux)  echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
-	  elf32ppc)   echo "powerpc-unknown-linux-gnu"              ; exit 0 ;;
-	esac
+	  elf32ppc | elf32ppclinux)
+		# Determine Lib Version
+		cat >$dummy.c <<EOF
+#include <features.h>
+#if defined(__GLIBC__)
+extern char __libc_version[];
+extern char __libc_release[];
+#endif
+main(argc, argv)
+     int argc;
+     char *argv[];
+{
+#if defined(__GLIBC__)
+  printf("%s %s\n", __libc_version, __libc_release);
+#else
+  printf("unkown\n");
+#endif
+  return 0;
+}
+EOF
+		LIBC=""
+		$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
+		if test "$?" = 0 ; then
+			./$dummy | grep 1\.99 > /dev/null
+			if test "$?" = 0 ; then
+				LIBC="libc1"
+			fi
+		fi	
+		rm -f $dummy.c $dummy
+		echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;;
+ 	esac
 
 	if test "${UNAME_MACHINE}" = "alpha" ; then
-		sed 's/^	//'  <<EOF >dummy.s
+		sed 's/^	//'  <<EOF >$dummy.s
 		.globl main
 		.ent main
 	main:
@@ -658,9 +802,9 @@
 		.end main
 EOF
 		LIBC=""
-		${CC-cc} dummy.s -o dummy 2>/dev/null
+		$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
 		if test "$?" = 0 ; then
-			./dummy
+			./$dummy
 			case "$?" in
 			7)
 				UNAME_MACHINE="alpha"
@@ -679,20 +823,21 @@
 				;;
 			esac
 
-			objdump --private-headers dummy | \
+			objdump --private-headers $dummy | \
 			  grep ld.so.1 > /dev/null
 			if test "$?" = 0 ; then
 				LIBC="libc1"
 			fi
 		fi
-		rm -f dummy.s dummy
+		rm -f $dummy.s $dummy
 		echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
 	elif test "${UNAME_MACHINE}" = "mips" ; then
-	  cat >dummy.c <<EOF
-main(argc, argv)
-     int argc;
-     char *argv[];
-{
+	  cat >$dummy.c <<EOF
+#ifdef __cplusplus
+int main (int argc, char *argv[]) {
+#else
+int main (argc, argv) int argc; char *argv[]; {
+#endif
 #ifdef __MIPSEB__
   printf ("%s-unknown-linux-gnu\n", argv[1]);
 #endif
@@ -702,8 +847,8 @@
   return 0;
 }
 EOF
-	  ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
-	  rm -f dummy.c dummy
+	  $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+	  rm -f $dummy.c $dummy
 	else
 	  # Either a pre-BFD a.out linker (linux-gnuoldld)
 	  # or one that does not give us useful --help.
@@ -722,12 +867,13 @@
 	    ;;
 	  esac
 	  # Determine whether the default compiler is a.out or elf
-	  cat >dummy.c <<EOF
+	  cat >$dummy.c <<EOF
 #include <features.h>
-main(argc, argv)
-     int argc;
-     char *argv[];
-{
+#ifdef __cplusplus
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
 #ifdef __ELF__
 # ifdef __GLIBC__
 #  if __GLIBC__ >= 2
@@ -744,8 +890,8 @@
   return 0;
 }
 EOF
-	  ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
-	  rm -f dummy.c dummy
+	  ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+	  rm -f $dummy.c $dummy
 	fi ;;
 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
 # are messed up and put the nodename in both sysname and nodename.
@@ -754,9 +900,9 @@
 	exit 0 ;;
 # added by chet for bash based on usenet posting from <hops@sco.com> and
 # documentation on SCO's web site -- UnixWare 7 (SVR5)
-    i?86:UnixWare:5*:*)
-	echo ${UNAME_MACHINE}-pc-sysv5uw${UNAME_VERSION}
-	exit 0 ;;
+#    i?86:UnixWare:5*:*)
+#	echo ${UNAME_MACHINE}-pc-sysv5uw${UNAME_VERSION}
+#	exit 0 ;;
     i?86:UNIX_SV:4.2MP:2.*)
 	# Unixware is an offshoot of SVR4, but it has its own version
 	# number series starting with 2...
@@ -772,6 +918,14 @@
 		echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
 	fi
 	exit 0 ;;
+    i?86:*:5:7*)
+        UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+        (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+        (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) && UNAME_MACHINE=i586
+        (/bin/uname -X|egrep '^Machine.*Pent.*II' >/dev/null) && UNAME_MACHINE=i686
+        (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) && UNAME_MACHINE=i585
+        echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE}
+        exit 0 ;;
     i?86:*:3.2:*)
 	if test -f /usr/options/cb.name; then
 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
@@ -781,6 +935,10 @@
 		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
 		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
 			&& UNAME_MACHINE=i586
+		(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
 		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
 	else
 		echo ${UNAME_MACHINE}-pc-sysv32
@@ -827,7 +985,7 @@
     m68*:LynxOS:2.*:*)
 	echo m68k-unknown-lynxos${UNAME_RELEASE}
 	exit 0 ;;
-    i?86:LynxOS:2.*:*)
+    i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
 	echo i386-pc-lynxos${UNAME_RELEASE}
 	exit 0 ;;
     TSUNAMI:LynxOS:2.*:*)
@@ -872,23 +1030,40 @@
     news*:NEWS-OS:*:6*)
 	echo mips-sony-newsos6
 	exit 0 ;;
-    R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
+    R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
 		echo mips-nec-sysv${UNAME_RELEASE}
 	else
 		echo mips-unknown-sysv${UNAME_RELEASE}
 	fi
 	exit 0 ;;
-    PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                           # says <Richard.M.Bartel@ccMail.Census.GOV>
-	echo i586-unisys-sysv4 
+    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
+	echo powerpc-apple-beos
+	exit 0 ;;
+    BeMac:BeOS:*:*)
+	echo powerpc-apple-beos
+	exit 0 ;;
+    BePC:BeOS:*:*)
+	echo i586-pc-beos
+	exit 0 ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit 0 ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
 	exit 0 ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
 
-cat >dummy.c <<EOF
+cat >$dummy.c <<EOF
 #ifdef _SEQUENT_
 # include <sys/types.h>
 # include <sys/utsname.h>
@@ -930,7 +1105,10 @@
 #endif
   int version;
   version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
   exit (0);
 #endif
 
@@ -1097,8 +1275,8 @@
 }
 EOF
 
-${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
-rm -f dummy.c dummy
+${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
+rm -f $dummy.c $dummy
 
 # Apollos put the system type in the environment.
 
diff --git a/readline/support/config.sub b/readline/support/config.sub
index c1ec2df..7d0c026 100755
--- a/readline/support/config.sub
+++ b/readline/support/config.sub
@@ -98,6 +98,16 @@
 		os=
 		basic_machine=$1
 		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=vxworks
+		basic_machine=$1
+		;;
 	-hiux*)
 		os=-hiuxwe2
 		;;
@@ -121,6 +131,9 @@
 		os=-sco3.2v2
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
 	-isc)
 		os=-isc2.2
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -149,19 +162,27 @@
 case $basic_machine in
 	# Recognize the basic CPU types without company name.
 	# Some are omitted here because they have special meanings below.
-	tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
-		| arme[lb] | pyramid \
-		| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
-		| hppa2.0 | alpha | we32k | ns16k | clipper | i370 | sh \
-		| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
-		| pdp11 | mips64el | mips64orion | mips64orionel \
-		| sparc | sparclet | sparclite | sparc64)
+	tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
+		| arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
+		| 580 | i960 | h8300 \
+		| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
+		| alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \
+		| we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
+		| 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
+		| mips64orion | mips64orionel | mipstx39 | mipstx39el \
+		| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
+		| mips64vr5000 | miprs64vr5000el | mcore \
+		| sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
+	        | thumb | d10v)
 		basic_machine=$basic_machine-unknown
 		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65)
+		;;
+
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
-	i[3456]86)
+	i[34567]86)
 	  basic_machine=$basic_machine-pc
 	  ;;
 	# Object if more than one company name word.
@@ -170,30 +191,53 @@
 		exit 1
 		;;
 	# Recognize the basic CPU types with company name.
-	vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
-	      | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
-	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
-	      | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
-	      | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \
-	      | alpha-* | alphaev5-* | alphaev56-* | alphapca56-* | alphaev6-* \
-	      | we32k-* | cydra-* | ns16k-* \
-	      | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
-	      | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
-	      | mips64el-* | mips64orion-* | mips64orionel-* | f301-* \
-	      | butterfly-bbn* \
-	      | cadmus-* | ews*-nec | ibmrt-ibm* | masscomp-masscomp \
+	# FIXME: clean up the formatting here.
+	vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
+	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
+	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
+	      | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
+	      | xmp-* | ymp-* \
+	      | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \
+	      | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \
+	      | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
+	      | clipper-* | orion-* \
+	      | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+	      | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
+	      | mips64el-* | mips64orion-* | mips64orionel-* \
+	      | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
+	      | mipstx39-* | mipstx39el-* | mcore-* \
+	      | f301-* | armv*-* | t3e-* \
+	      | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
+	      | thumb-* | v850-* | d30v-* | tic30-* | c30-* )
+		;;
+	# BEGIN cases added for Bash
+	butterfly-bbn* | cadmus-* | ews*-nec | ibmrt-ibm* | masscomp-masscomp \
 	      | tandem-* | symmetric-* | drs6000-icl | *-*ardent | gould-gould \
 	      | concurrent-* | ksr1-* | esa-ibm | fxc-alliant | *370-amdahl \
-	      | *-convex | sx4*-nec)
+	      | *-convex | sx[45]*-nec )
 		;;
+	# END cases added for Bash
+
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
 	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
 		basic_machine=m68000-att
 		;;
 	3b*)
 		basic_machine=we32k-att
 		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
 	alliant | fx80)
 		basic_machine=fx80-alliant
 		;;
@@ -212,13 +256,9 @@
 #		basic_machine=m68k-cbm
 		basic_machine=m68k-unknown
 		;;
-	amigaos)
-		basic_machine=m68k-unknown
-		os=-amigaos
-		;;
-	amigados)
+	amigaos | amigados)
 		basic_machine=m68k-cbm
-		os=-amigados
+		os=-amigaos
 		;;
 	amigaunix | amix)
 		basic_machine=m68k-cbm
@@ -228,6 +268,10 @@
 		basic_machine=m68k-apollo
 		os=-sysv
 		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
 	aux)
 		basic_machine=m68k-apple
 		os=-aux
@@ -307,6 +351,10 @@
 	encore | umax | mmax | multimax)
 		basic_machine=ns32k-encore
 		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
 	fx2800)
 		basic_machine=i860-alliant
 		;;
@@ -325,6 +373,14 @@
 		basic_machine=h8300-hitachi
 		os=-hms
 		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
 	harris)
 		basic_machine=m88k-harris
 		os=-sysv3
@@ -340,13 +396,30 @@
 		basic_machine=m68k-hp
 		os=-hpux
 		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
 	hp9k2[0-9][0-9] | hp9k31[0-9])
 		basic_machine=m68000-hp
 		;;
 	hp9k3[2-9][0-9])
 		basic_machine=m68k-hp
 		;;
-	hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
 		basic_machine=hppa1.1-hp
 		;;
 	hp9k8[0-9][0-9] | hp8[0-9][0-9])
@@ -355,6 +428,14 @@
 	hppa-next)
 		os=-nextstep3
 		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
 	ibm032-*)
 		basic_machine=ibmrt-ibm
 		;;
@@ -363,22 +444,38 @@
 		os=-mvs
 		;;
 # I'm not sure what "Sysv32" means.  Should this be sysv3.2?
-	i[3456]86v32)
+	i[34567]86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
 		;;
-	i[3456]86v4*)
+	i[34567]86v4*)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv4
 		;;
-	i[3456]86v)
+	i[34567]86v)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv
 		;;
-	i[3456]86sol2)
+	i[34567]86sol2)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-solaris2
 		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	i386-go32 | go32)
+		basic_machine=i386-unknown
+		os=-go32
+		;;
+	i386-mingw32 | mingw32)
+		basic_machine=i386-unknown
+		os=-mingw32
+		;;
 	iris | iris4d)
 		basic_machine=mips-sgi
 		case $os in
@@ -410,13 +507,17 @@
 	miniframe)
 		basic_machine=m68000-convergent
 		;;
+	*mint | *MiNT)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
 	mipsel*-linux*)
 		basic_machine=mipsel-unknown
-		os=-linux
+		os=-linux-gnu
 		;;
 	mips*-linux*)
 		basic_machine=mips-unknown
-		os=-linux
+		os=-linux-gnu
 		;;
 	mips3*-*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
@@ -424,10 +525,26 @@
 	mips3*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
 		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	msdos)
+		basic_machine=i386-unknown
+		os=-msdos
+		;;
 	ncr3000)
 		basic_machine=i486-ncr
 		os=-sysv4
 		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-corel
+		os=-linux
+		;;
 	news | news700 | news800 | news900)
 		basic_machine=m68k-sony
 		os=-newsos
@@ -440,6 +557,10 @@
 		basic_machine=mips-sony
 		os=-newsos
 		;;
+        necv70)
+                basic_machine=v70-nec
+                os=-sysv
+                ;;
 	next | m*-next )
 		basic_machine=m68k-next
 		case $os in
@@ -465,6 +586,10 @@
 		basic_machine=i960-intel
 		os=-nindy
 		;;
+        mon960)
+                basic_machine=i960-intel
+                os=-mon960
+                ;;
 	np1)
 		basic_machine=np1-gould
 		;;
@@ -476,6 +601,18 @@
 		basic_machine=i386-pc
 		os=-sco3.2v4
 		;;
+        op50n-* | op60c-*)
+                basic_machine=hppa1.1-oki
+                os=-proelf
+                ;;
+        OSE68000 | ose68000)
+                basic_machine=m68000-ericsson
+                os=-ose
+                ;;
+        os68k)
+                basic_machine=m68k-none
+                os=-os68k
+                ;;
 	pa-hitachi)
 		basic_machine=hppa1.1-hitachi
 		os=-hiuxwe2
@@ -490,28 +627,26 @@
 	pbb)
 		basic_machine=m68k-tti
 		;;
-        pc532 | pc532-*)
+	pc532 | pc532-*)
 		basic_machine=ns32k-pc532
 		;;
-	pentium | p5)
+	pentium | p5 | k5 | k6 | nexen)
 		basic_machine=i586-intel
 		;;
-	pentiumpro | p6)
-		basic_machine=i686-intel
+        pentiumpro | p6 | 6x86)
+                basic_machine=i686-pc
+                ;;
+	pentiumii | pentium2)
+		basic_machine=i786-pc
 		;;
-	pentium-* | p5-*)
+	pentium-* | p5-* | k5-* | k6-* | nexen-*)
 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	pentiumpro-* | p6-*)
+	pentiumpro-* | p6-* | 6x86*)
 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	k5)
-		# We don't have specific support for AMD's K5 yet, so just call it a Pentium
-		basic_machine=i586-amd
-		;;
-	nexen)
-		# We don't have specific support for Nexgen yet, so just call it a Pentium
-		basic_machine=i586-nexgen
+	pentiumii-* | pentium2-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	pn)
 		basic_machine=pn-gould
@@ -519,24 +654,32 @@
 	power)	basic_machine=rs6000-ibm
 		;;
 	ppc)	basic_machine=powerpc-unknown
-	        ;;
+		;;
 	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ppcle | powerpclittle | ppc-le | powerpc-little)
 		basic_machine=powerpcle-unknown
-	        ;;
+		;;
 	ppcle-* | powerpclittle-*)
 		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ps2)
 		basic_machine=i386-ibm
 		;;
+        rom68k)
+                basic_machine=m68k-rom68k
+                os=-coff
+                ;;
 	rm[46]00)
 		basic_machine=mips-siemens
 		;;
 	rtpc | rtpc-*)
 		basic_machine=romp-ibm
 		;;
+        sa29200)
+                basic_machine=a29k-amd
+                os=-udi
+                ;;
 	sequent)
 		basic_machine=i386-sequent
 		;;
@@ -544,6 +687,10 @@
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
+        sparclite-wrs)
+                basic_machine=sparclite-wrs
+                os=-vxworks
+                ;;
 	sps7)
 		basic_machine=m68k-bull
 		os=-sysv2
@@ -551,6 +698,13 @@
 	spur)
 		basic_machine=spur-unknown
 		;;
+        st2000)
+                basic_machine=m68k-tandem
+                ;;
+        stratus)
+                basic_machine=i860-stratus
+                os=-sysv4
+                ;;
 	sun2)
 		basic_machine=m68000-sun
 		;;
@@ -595,6 +749,16 @@
 		basic_machine=i386-sequent
 		os=-dynix
 		;;
+        t3e)
+                basic_machine=t3e-cray
+                os=-unicos
+                ;;
+        tx39)
+                basic_machine=mipstx39-unknown
+                ;;
+        tx39el)
+                basic_machine=mipstx39el-unknown
+                ;;
 	tower | tower-32)
 		basic_machine=m68k-ncr
 		;;
@@ -614,6 +778,10 @@
 		basic_machine=i386-pc
 		os=-sysv5uw7
 		;;
+        v810 | necv810)
+                basic_machine=v810-nec
+                os=-none
+                ;;
 	vaxv)
 		basic_machine=vax-dec
 		os=-sysv
@@ -637,13 +805,25 @@
 		basic_machine=a29k-wrs
 		os=-vxworks
 		;;
+        w65*)
+                basic_machine=w65-wdc
+                os=-none
+                ;;
+        w89k-*)
+                basic_machine=hppa1.1-winbond
+                os=-proelf
+                ;;
 	xmp)
 		basic_machine=xmp-cray
 		os=-unicos
 		;;
-        xps | xps100)
+	xps | xps100)
 		basic_machine=xps100-honeywell
 		;;
+        z8k-*-coff)
+                basic_machine=z8k-unknown
+                os=-sim
+                ;;
 	none)
 		basic_machine=none-none
 		os=-none
@@ -651,8 +831,17 @@
 
 # Here we handle the default manufacturer of certain CPU types.  It is in
 # some cases the only manufacturer, in others, it is the most popular.
+        w89k)
+                basic_machine=hppa1.1-winbond
+                ;;
+        op50n)
+                basic_machine=hppa1.1-oki
+                ;;
+        op60c)
+                basic_machine=hppa1.1-oki
+                ;;
 	mips)
-		if test "x$os" = "x-linux" ; then
+		if test "x$os" = "x-linux-gnu" ; then
 			basic_machine=mips-unknown
 		else
 			basic_machine=mips-mips
@@ -673,10 +862,10 @@
 	we32k)
 		basic_machine=we32k-att
 		;;
-	sparc)
+	sparc | sparcv9)
 		basic_machine=sparc-sun
 		;;
-        cydra)
+	cydra)
 		basic_machine=cydra-cydrome
 		;;
 	orion)
@@ -685,6 +874,16 @@
 	orion105)
 		basic_machine=clipper-highlevel
 		;;
+        mac | mpw | mac-mpw)
+                basic_machine=m68k-apple
+                ;;
+        pmac | pmac-mpw)
+                basic_machine=powerpc-apple
+                ;;
+        c4x*)
+                basic_machine=c4x-none
+                os=-coff
+                ;;
 	*)
 		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
 		exit 1
@@ -717,7 +916,7 @@
 	-solaris)
 		os=-solaris2
 		;;
-	svr4*)
+	-svr4*)
 		os=-sysv4
 		;;
 	-unixware | -uw | -unixware2* | -uw2*)
@@ -726,6 +925,9 @@
 	-unixware7* | -uw7*)
 		os=-sysv5uw7
 		;;
+        -unixware*)
+                os=-sysv4.2uw
+		;;
 	-gnu/linux*)
 		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
 		;;
@@ -736,18 +938,31 @@
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
 	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
-	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
-	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -linux-gnu* | -uxpv* | -qnx* | -powerux* | -beos* | -rhapsody* \
-	      | -superux* )
+	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
+	# BEGIN CASES ADDED FOR Bash
+	-qnx* | -powerux* | -superux* )
+		;;
+	# END CASES ADDED FOR Bash
+        -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+              | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+              | -macos* | -mpw* | -magic* | -mon960* | -lnews*)
+                ;;
+        -mac*)
+                os=`echo $os | sed -e 's|mac|macos|'`
+                ;;
+
 	-linux*)
 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
 		;;
@@ -772,11 +987,14 @@
 	-acis*)
 		os=-aos
 		;;
+        -386bsd)
+                os=-bsd
+                ;;
 	-ctix* | -uts*)
 		os=-sysv
 		;;
 	-ns2 )
-	        os=-nextstep2
+		os=-nextstep2
 		;;
 	# Preserve the version number of sinix5.
 	-sinix5.*)
@@ -806,9 +1024,18 @@
 	# This must come after -sysvr[45].
 	-sysv*)
 		;;
+        -ose*)
+                os=-ose
+                ;;
+        -es1800*)
+                os=-ose
+                ;;
 	-xenix)
 		os=-xenix
 		;;
+        -*mint | -*MiNT)
+                os=-mint
+                ;;
 	-none)
 		;;
 	*)
@@ -837,7 +1064,7 @@
 	arm*-semi)
 		os=-aout
 		;;
-        pdp11-*)
+	pdp11-*)
 		os=-none
 		;;
 	*-dec | vax-*)
@@ -855,6 +1082,15 @@
 		# default.
 		# os=-sunos4
 		;;
+        m68*-cisco)
+                os=-aout
+                ;;
+        mips*-cisco)
+                os=-elf
+                ;;
+        mips*-*)
+                os=-elf
+                ;;
 	*-tti)	# must be before sparc entry or we get the wrong os.
 		os=-sysv3
 		;;
@@ -867,6 +1103,15 @@
 	*-ibm)
 		os=-aix
 		;;
+        *-wec)
+                os=-proelf
+                ;;
+        *-winbond)
+                os=-proelf
+                ;;
+        *-oki)
+                os=-proelf
+                ;;
 	*-hp)
 		os=-hpux
 		;;
@@ -909,19 +1154,19 @@
 	*-next)
 		os=-nextstep3
 		;;
-        *-gould)
+	*-gould)
 		os=-sysv
 		;;
-        *-highlevel)
+	*-highlevel)
 		os=-bsd
 		;;
 	*-encore)
 		os=-bsd
 		;;
-        *-sgi)
+	*-sgi)
 		os=-irix
 		;;
-        *-siemens)
+	*-siemens)
 		os=-sysv4
 		;;
 	*-masscomp)
@@ -930,6 +1175,18 @@
 	f301-fujitsu)
 		os=-uxpv
 		;;
+        *-rom68k)
+                os=-coff
+                ;;
+        *-*bug)
+                os=-coff
+                ;;
+        *-apple)
+                os=-macos
+                ;;
+        *-atari*)
+                os=-mint
+                ;;
 	*)
 		os=-none
 		;;
@@ -954,6 +1211,9 @@
 			-aix*)
 				vendor=ibm
 				;;
+                        -beos*)
+                                vendor=be
+                                ;;
 			-hpux*)
 				vendor=hp
 				;;
@@ -984,6 +1244,15 @@
 			-aux*)
 				vendor=apple
 				;;
+                        -hms*)
+                                vendor=hitachi
+                                ;;
+                        -mpw* | -macos*)
+                                vendor=apple
+                                ;;
+                        -*mint | -*MiNT)
+                                vendor=atari
+                                ;;
 		esac
 		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
 		;;
diff --git a/readline/support/shlib-install b/readline/support/shlib-install
index e43a7c0..471fec7 100755
--- a/readline/support/shlib-install
+++ b/readline/support/shlib-install
@@ -49,7 +49,7 @@
 if [ -z "$uninstall" ]; then
 	${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
 	if [ -f "$INSTALLDIR/$LIBNAME" ]; then
-		${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}${OLDSUFF}
+		${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
 	fi
 fi
 
@@ -63,6 +63,14 @@
 
 # post-install/uninstall
 
+# HP-UX requires that a shared library have execute permission
+case "$host_os" in
+hpux*)	if [ -z "$uninstall" ]; then
+		chmod 755 ${INSTALLDIR}/${LIBNAME}
+	fi ;;
+*)	;;
+esac
+
 case "$LIBNAME" in
 *.*.[0-9].[0-9])	# libname.so.M.N
 	LINK2=`echo $LIBNAME | sed 's:\(.*\..*\.[0-9]\)\.[0-9]:\1:'`	# libname.so.M
@@ -71,6 +79,9 @@
 *.*.[0-9])		# libname.so.M
 	LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]:\1:'`		# libname.so
 	;;
+*.[0-9])		# libname.M
+	LINK1=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]:\1:'`		# libname
+	;;
 esac
 
 #
@@ -91,7 +102,7 @@
 	fi
 	;;
 
-solaris2*|aix4.[2-9]*|hpux1*)
+solaris2*|aix4.[2-9]*|osf*|irix[56]*)
 	# libname.so -> libname.so.M
 	${echo} ${RM} ${INSTALLDIR}/$LINK1
 	if [ -z "$uninstall" ]; then
@@ -99,6 +110,38 @@
 	fi
 	;;
 
+
+# FreeBSD 3.x can have either a.out or ELF shared libraries
+freebsd3*)
+	if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
+		# libname.so -> libname.so.M
+		${echo} ${RM} ${INSTALLDIR}/$LINK1
+		if [ -z "$uninstall" ]; then
+			${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
+		fi
+	else
+		# libname.so.M -> libname.so.M.N
+		${echo} ${RM} ${INSTALLDIR}/$LINK2
+		if [ -z "$uninstall" ]; then
+			${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2
+		fi
+
+		# libname.so -> libname.so.M.N
+		${echo} ${RM} ${INSTALLDIR}/$LINK1
+		if [ -z "$uninstall" ]; then
+			${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
+		fi
+	fi
+	;;
+
+hpux1*)
+	# libname.sl -> libname.M
+	${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
+	if [ -z "$uninstall" ]; then
+		${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LINK1}.sl
+	fi
+	;;
+
 *)	;;
 esac
 
diff --git a/readline/support/shobj-conf b/readline/support/shobj-conf
index 86f8c32..6649c70 100755
--- a/readline/support/shobj-conf
+++ b/readline/support/shobj-conf
@@ -62,9 +62,9 @@
 sunos5*-gcc*|solaris2*-gcc*)
 	SHOBJ_CFLAGS=-fpic
 	SHOBJ_LD='${CC}'
-	SHOBJ_LDFLAGS='-shared -Wl,-i'
+	SHOBJ_LDFLAGS='-shared -Wl,-i -Wl,-h,$@'
 
-	SHLIB_XLDFLAGS='-R $(libdir)'
+#	SHLIB_XLDFLAGS='-R $(libdir)'
 	SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
 	;;
 
@@ -73,7 +73,7 @@
 	SHOBJ_LD=/usr/ccs/bin/ld
 	SHOBJ_LDFLAGS='-G -dy -z text -i -h $@'
 
-	SHLIB_XLDFLAGS='-R $(libdir)'
+#	SHLIB_XLDFLAGS='-R $(libdir)'
 	SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
 	;;
 
@@ -86,13 +86,32 @@
 	SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
 	;;
 
+# FreeBSD-3.x can have either a.out or ELF object files
+#freebsd3*)
+#	SHOBJ_CFLAGS=-fpic
+#	SHOBJ_LD='${CC}'
+#	SHOBJ_LDFLAGS='-shared'
+#
+#	SHLIB_XLDFLAGS='-R$(libdir)'
+#	SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+#	;;
+
+# FreeBSD-3.x ELF
 freebsd3*)
 	SHOBJ_CFLAGS=-fpic
 	SHOBJ_LD='${CC}'
-	SHOBJ_LDFLAGS='-shared'
 
-	SHLIB_XLDFLAGS='-R$(libdir)'
-	SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+	if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
+		SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+
+		SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
+		SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+	else
+		SHOBJ_LDFLAGS='-shared'
+
+		SHLIB_XLDFLAGS='-R$(libdir)'
+		SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+	fi
 	;;
 
 linux*)
@@ -142,6 +161,15 @@
 	SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
 	;;
 
+osf*-gcc*)
+	# Fix to use gcc linker driver from bfischer@TechFak.Uni-Bielefeld.DE
+	SHOBJ_LD='${CC}'
+	SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+
+	SHLIB_XLDFLAGS='-rpath $(libdir)'
+	SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+	;;
+
 osf*)
 	SHOBJ_LD=ld
 	SHOBJ_LDFLAGS='-shared -soname $@ -expect_unresolved "*"'
@@ -187,7 +215,9 @@
 irix[56]*)
 	SHOBJ_CFLAGS='-K PIC'
 	SHOBJ_LD=ld
-	SHOBJ_LDFLAGS='-call_shared -hidden_symbol -no_unresolved -soname $@'
+#	SHOBJ_LDFLAGS='-call_shared -hidden_symbol -no_unresolved -soname $@'
+#	Change from David Kaelbling <drk@sgi.com>
+	SHOBJ_LDFLAGS='-shared -no_unresolved -soname $@'
 
 	SHLIB_XLDFLAGS='-rpath $(libdir)'
 	SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
@@ -306,7 +336,7 @@
 	SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
 	;;
 
-msdosdjgpp*)
+msdos*)
 	SHOBJ_STATUS=unsupported
 	SHLIB_STATUS=unsupported
 	;;
diff --git a/readline/tcap.h b/readline/tcap.h
index acb2d76..58ab894 100644
--- a/readline/tcap.h
+++ b/readline/tcap.h
@@ -8,7 +8,7 @@
 
    The Library 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    The Library is distributed in the hope that it will be useful, but
@@ -19,7 +19,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #if !defined (_RLTCAP_H_)
 #define _RLTCAP_H_
diff --git a/readline/terminal.c b/readline/terminal.c
index 627a385..02757fe 100644
--- a/readline/terminal.c
+++ b/readline/terminal.c
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -46,9 +46,7 @@
 #  include <locale.h>
 #endif
 
-#include <signal.h>
 #include <stdio.h>
-#include <setjmp.h>
 
 /* System-specific feature definitions and include files. */
 #include "rldefs.h"
@@ -57,8 +55,8 @@
 #  include <sys/ioctl.h>
 #endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */
 
-#if defined (__GO32__)
-#  include <pc.h>
+#ifdef __MSDOS__
+# include <pc.h>
 #endif
 
 #include "rltty.h"
@@ -68,21 +66,8 @@
 #include "readline.h"
 #include "history.h"
 
-/* Variables and functions imported from readline.c */
-extern FILE *_rl_in_stream, *_rl_out_stream;
-extern int readline_echoing_p;
-extern int _rl_bell_preference;
-extern Keymap _rl_keymap;
-
-/* Functions imported from bind.c */
-extern void _rl_bind_if_unbound ();
-
-/* Functions imported from shell.c */
-extern void set_lines_and_columns ();
-extern char *get_env_value ();
-
-/* Functions imported from display.c */
-extern void _rl_redisplay_after_sigwinch ();
+#include "rlprivate.h"
+#include "rlshell.h"
 
 /* **************************************************************** */
 /*								    */
@@ -90,13 +75,13 @@
 /*								    */
 /* **************************************************************** */
 
-#ifndef __DJGPP__
+#ifndef __MSDOS__
 static char *term_buffer = (char *)NULL;
 static char *term_string_buffer = (char *)NULL;
 
 /* Non-zero means this terminal can't really do anything. */
 static int dumb_term;
-#endif
+#endif /* !__MSDOS__ */
 
 static int tcap_initialized;
 
@@ -158,6 +143,22 @@
 /* Non-zero means the user wants to enable a meta key. */
 int _rl_enable_meta = 1;
 
+#if defined (__EMX__)
+static void
+_emx_get_screensize (swp, shp)
+     int *swp, *shp;
+{
+  int sz[2];
+
+  _scrsize (sz);
+
+  if (swp)
+    *swp = sz[0];
+  if (shp)
+    *shp = sz[1];
+}
+#endif
+
 /* Get readline's idea of the screen size.  TTY is a file descriptor open
    to the terminal.  If IGNORE_ENV is true, we do not pay attention to the
    values of $LINES and $COLUMNS.  The tests for TERM_STRING_BUFFER being
@@ -170,9 +171,6 @@
 #if defined (TIOCGWINSZ)
   struct winsize window_size;
 #endif /* TIOCGWINSZ */
-#if defined (__EMX__)
-  int sz[2];
-#endif
 
 #if defined (TIOCGWINSZ)
   if (ioctl (tty, TIOCGWINSZ, &window_size) == 0)
@@ -183,9 +181,7 @@
 #endif /* TIOCGWINSZ */
 
 #if defined (__EMX__)
-  _scrsize (sz);
-  screenwidth = sz[0];
-  screenheight = sz[1];
+  _emx_get_screensize (&screenwidth, &screenheight);
 #endif
 
   /* Environment variable COLUMNS overrides setting of "co" if IGNORE_ENV
@@ -195,8 +191,7 @@
       if (ignore_env == 0 && (ss = get_env_value ("COLUMNS")))
 	screenwidth = atoi (ss);
 
-#if defined(__DJGPP__)
-      tty = tty;
+#if defined (__DJGPP__)
       if (screenwidth <= 0)
 	screenwidth = ScreenCols ();
 #else
@@ -212,7 +207,7 @@
       if (ignore_env == 0 && (ss = get_env_value ("LINES")))
 	screenheight = atoi (ss);
 
-#if defined(__DJGPP__)
+#if defined (__DJGPP__)
       if (screenheight <= 0)
 	screenheight = ScreenRows ();
 #else
@@ -233,7 +228,7 @@
      do a pair of putenv () or setenv () calls. */
   set_lines_and_columns (screenheight, screenwidth);
 
-  if (!_rl_term_autowrap)
+  if (_rl_term_autowrap == 0)
     screenwidth--;
 
   screenchars = screenwidth * screenheight;
@@ -271,32 +266,32 @@
    search algorithm to something smarter. */
 static struct _tc_string tc_strings[] =
 {
-  "DC", &term_DC,
-  "IC", &term_IC,
-  "ce", &term_clreol,
-  "cl", &term_clrpag,
-  "cr", &term_cr,
-  "dc", &term_dc,
-  "ei", &term_ei,
-  "ic", &term_ic,
-  "im", &term_im,
-  "kd", &term_kd,
-  "kh", &term_kh,	/* home */
-  "kH", &term_kH,	/* end */
-  "kl", &term_kl,
-  "kr", &term_kr,
-  "ku", &term_ku,
-  "ks", &term_ks,
-  "ke", &term_ke,
-  "le", &term_backspace,
-  "mm", &term_mm,
-  "mo", &term_mo,
+  { "DC", &term_DC },
+  { "IC", &term_IC },
+  { "ce", &term_clreol },
+  { "cl", &term_clrpag },
+  { "cr", &term_cr },
+  { "dc", &term_dc },
+  { "ei", &term_ei },
+  { "ic", &term_ic },
+  { "im", &term_im },
+  { "kd", &term_kd },
+  { "kh", &term_kh },	/* home */
+  { "kH", &term_kH },	/* end */
+  { "kl", &term_kl },
+  { "kr", &term_kr },
+  { "ku", &term_ku },
+  { "ks", &term_ks },
+  { "ke", &term_ke },
+  { "le", &term_backspace },
+  { "mm", &term_mm },
+  { "mo", &term_mo },
 #if defined (HACK_TERMCAP_MOTION)
-  "nd", &term_forward_char,
+  { "nd", &term_forward_char },
 #endif
-  "pc", &term_pc,
-  "up", &term_up,
-  "vb", &visible_bell,
+  { "pc", &term_pc },
+  { "up", &term_up },
+  { "vb", &visible_bell },
 };
 
 #define NUM_TC_STRINGS (sizeof (tc_strings) / sizeof (struct _tc_string))
@@ -307,9 +302,7 @@
 get_term_capabilities (bp)
      char **bp;
 {
-#if defined(__DJGPP__)
-  bp = bp;
-#else
+#if !defined (__DJGPP__)	/* XXX - doesn't DJGPP have a termcap library? */
   register int i;
 
   for (i = 0; i < NUM_TC_STRINGS; i++)
@@ -318,66 +311,97 @@
   tcap_initialized = 1;
 }
 
+#define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay)
+#define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc)
+
 int
 _rl_init_terminal_io (terminal_name)
      char *terminal_name;
 {
-#if defined (__GO32__)
-  terminal_name = terminal_name;
-  screenwidth = screenheight = 0;
-  _rl_get_screen_size (rl_instream ? fileno (rl_instream) : 0, 0);
-
-  term_cr = "\r";
-  term_im = term_ei = term_ic = term_IC = (char *)NULL;
-  term_up = term_dc = term_DC = visible_bell = (char *)NULL;
-
-  /* Does the __GO32__ have a meta key?  I don't know. */
-  term_has_meta = 0;
-  term_mm = term_mo = (char *)NULL;
-
-  /* It probably has arrow keys, but I don't know what they are. */
-  term_ku = term_kd = term_kr = term_kl = (char *)NULL;
-
-#if defined (HACK_TERMCAP_MOTION)
-  term_forward_char = (char *)NULL;
-#endif /* HACK_TERMCAP_MOTION */
-  terminal_can_insert = _rl_term_autowrap = 0;
-  return 0;
-#else /* !__GO32__ */
-
   char *term, *buffer;
-  int tty;
+  int tty, tgetent_ret;
   Keymap xkeymap;
 
   term = terminal_name ? terminal_name : get_env_value ("TERM");
-
-  if (term_string_buffer == 0)
-    term_string_buffer = xmalloc (2032);
-
-  if (term_buffer == 0)
-    term_buffer = xmalloc (4080);
-
-  buffer = term_string_buffer;
-
   term_clrpag = term_cr = term_clreol = (char *)NULL;
+  tty = rl_instream ? fileno (rl_instream) : 0;
+  screenwidth = screenheight = 0;
 
   if (term == 0)
     term = "dumb";
 
-  if (tgetent (term_buffer, term) <= 0)
+#ifdef __MSDOS__
+  term_im = term_ei = term_ic = term_IC = (char *)NULL;
+  term_up = term_dc = term_DC = visible_bell = (char *)NULL;
+  term_ku = term_kd = term_kl = term_kr = (char *)NULL;
+  term_mm = term_mo = (char *)NULL;
+  terminal_can_insert = term_has_meta = _rl_term_autowrap = 0;
+  term_cr = "\r";
+
+  _rl_get_screen_size (tty, 0);
+#else  /* !__MSDOS__ */
+  /* I've separated this out for later work on not calling tgetent at all
+     if the calling application has supplied a custom redisplay function,
+     (and possibly if the application has supplied a custom input function). */
+  if (CUSTOM_REDISPLAY_FUNC())
     {
+      tgetent_ret = -1;
+    }
+  else
+    {
+      if (term_string_buffer == 0)
+	term_string_buffer = xmalloc(2032);
+
+      if (term_buffer == 0)
+	term_buffer = xmalloc(4080);
+
+      buffer = term_string_buffer;
+
+      tgetent_ret = tgetent (term_buffer, term);
+    }
+
+  if (tgetent_ret <= 0)
+    {
+      FREE (term_string_buffer);
+      FREE (term_buffer);
+      buffer = term_buffer = term_string_buffer = (char *)NULL;
+
       dumb_term = 1;
-      screenwidth = 79;
-      screenheight = 24;
-      screenchars = 79 * 24;
+      _rl_term_autowrap = 0;	/* used by _rl_get_screen_size */
+
+#if defined (__EMX__)
+      _emx_get_screensize (&screenwidth, &screenheight);
+      screenwidth--;
+#else /* !__EMX__ */
+      _rl_get_screen_size (tty, 0);
+#endif /* !__EMX__ */
+
+      /* Defaults. */
+      if (screenwidth <= 0 || screenheight <= 0)
+        {
+	  screenwidth = 79;
+	  screenheight = 24;
+        }
+
+      /* Everything below here is used by the redisplay code (tputs). */
+      screenchars = screenwidth * screenheight;
       term_cr = "\r";
       term_im = term_ei = term_ic = term_IC = (char *)NULL;
       term_up = term_dc = term_DC = visible_bell = (char *)NULL;
       term_ku = term_kd = term_kl = term_kr = (char *)NULL;
+      term_mm = term_mo = (char *)NULL;
 #if defined (HACK_TERMCAP_MOTION)
       term_forward_char = (char *)NULL;
 #endif
-      terminal_can_insert = 0;
+      terminal_can_insert = term_has_meta = 0;
+
+      /* Reasonable defaults for tgoto().  Readline currently only uses
+         tgoto if term_IC or term_DC is defined, but just in case we
+         change that later... */
+      PC = '\0';
+      BC = term_backspace = "\b";
+      UP = term_up;
+
       return 0;
     }
 
@@ -392,10 +416,6 @@
   if (!term_cr)
     term_cr = "\r";
 
-  tty = rl_instream ? fileno (rl_instream) : 0;
-
-  screenwidth = screenheight = 0;
-
   _rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
 
   _rl_get_screen_size (tty, 0);
@@ -412,6 +432,8 @@
   if (!term_has_meta)
     term_mm = term_mo = (char *)NULL;
 
+#endif /* !__MSDOS__ */
+
   /* Attempt to find and bind the arrow keys.  Do not override already
      bound keys in an overzealous attempt, however. */
   xkeymap = _rl_keymap;
@@ -438,7 +460,6 @@
 
   _rl_keymap = xkeymap;
 
-#endif /* !__GO32__ */
   return 0;
 }
 
@@ -484,6 +505,7 @@
   return putc (c, _rl_out_stream);
 }
 #endif /* !_MINIX */
+
 /* Write COUNT characters from STRING to the output stream. */
 void
 _rl_output_some_chars (string, count)
@@ -500,12 +522,12 @@
 {
   register int i;
 
-#if !defined (__GO32__)
+#ifndef __MSDOS__
   if (term_backspace)
     for (i = 0; i < count; i++)
       tputs (term_backspace, 1, _rl_output_character_function);
   else
-#endif /* !__GO32__ */
+#endif
     for (i = 0; i < count; i++)
       putc ('\b', _rl_out_stream);
   return 0;
@@ -535,7 +557,7 @@
 	default:
 	  break;
 	case VISIBLE_BELL:
-#if defined (__GO32__)
+#ifdef __MSDOS__
 	  ScreenVisualBell ();
 	  break;
 #else
@@ -565,7 +587,7 @@
 void
 _rl_enable_meta_key ()
 {
-#if !defined(__DJGPP__)
+#if !defined (__DJGPP__)
   if (term_has_meta && term_mm)
     tputs (term_mm, 1, _rl_output_character_function);
 #endif
@@ -575,9 +597,7 @@
 _rl_control_keypad (on)
      int on;
 {
-#if defined(__DJGPP__)
-  on = on;
-#else
+#if !defined (__DJGPP__)
   if (on && term_ks)
     tputs (term_ks, 1, _rl_output_character_function);
   else if (!on && term_ke)
diff --git a/readline/tilde.c b/readline/tilde.c
index d1853bd..777b655 100644
--- a/readline/tilde.c
+++ b/readline/tilde.c
@@ -7,7 +7,7 @@
 
    Readline 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 1, or (at your option) any
+   Free Software Foundation; either version 2, or (at your option) any
    later version.
 
    Readline is distributed in the hope that it will be useful, but
@@ -17,7 +17,7 @@
 
    You should have received a copy of the GNU General Public License
    along with Readline; see the file COPYING.  If not, write to the Free
-   Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+   Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #if defined (HAVE_CONFIG_H)
 #  include <config.h>
@@ -47,12 +47,22 @@
 
 #include "tilde.h"
 
+#if defined (TEST) || defined (STATIC_MALLOC)
+static char *xmalloc (), *xrealloc ();
+#else
+#  if defined __STDC__
+extern char *xmalloc (int);
+extern char *xrealloc (void *, int);
+#  else
+extern char *xmalloc (), *xrealloc ();
+#  endif /* !__STDC__ */
+#endif /* TEST || STATIC_MALLOC */
+
 #if !defined (HAVE_GETPW_DECLS)
 extern struct passwd *getpwuid (), *getpwnam ();
 #endif /* !HAVE_GETPW_DECLS */
 
 #if !defined (savestring)
-extern char *xmalloc ();
 #  ifndef strcpy
 extern char *strcpy ();
 #  endif
@@ -67,17 +77,11 @@
 #  endif /* !__STDC__ */
 #endif /* !NULL */
 
-#if defined (TEST) || defined (STATIC_MALLOC)
-static char *xmalloc (), *xrealloc ();
-#else
-extern char *xmalloc (), *xrealloc ();
-#endif /* TEST || STATIC_MALLOC */
-
 /* If being compiled as part of bash, these will be satisfied from
    variables.o.  If being compiled as part of readline, they will
    be satisfied from shell.o. */
-extern char *get_home_dir ();
-extern char *get_env_value ();
+extern char *get_home_dir __P((void));
+extern char *get_env_value __P((char *));
 
 /* The default value of tilde_additional_prefixes.  This is set to
    whitespace preceding a tilde so that simple programs which do not
@@ -122,7 +126,9 @@
      int *len;
 {
   register int i, j, string_len;
-  register char **prefixes = tilde_additional_prefixes;
+  register char **prefixes;
+
+  prefixes = tilde_additional_prefixes;
 
   string_len = strlen (string);
   *len = 0;
@@ -161,7 +167,11 @@
 
   for (i = 0; i < string_len; i++)
     {
+#if defined (__MSDOS__)
+      if (string[i] == '/' || string[i] == '\\' /* || !string[i] */)
+#else
       if (string[i] == '/' /* || !string[i] */)
+#endif
 	break;
 
       for (j = 0; suffixes && suffixes[j]; j++)
@@ -225,11 +235,18 @@
       free (tilde_word);
 
       len = strlen (expansion);
-      if ((result_index + len + 1) > result_size)
-	result = xrealloc (result, 1 + (result_size += (len + 20)));
+#ifdef __CYGWIN32__
+      /* Fix for Cygwin to prevent ~user/xxx from expanding to //xxx when
+         $HOME for `user' is /.  On cygwin, // denotes a network drive. */
+      if (len > 1 || *expansion != '/' || *string != '/')
+#endif
+	{
+	  if ((result_index + len + 1) > result_size)
+	    result = xrealloc (result, 1 + (result_size += (len + 20)));
 
-      strcpy (result + result_index, expansion);
-      result_index += len;
+	  strcpy (result + result_index, expansion);
+	  result_index += len;
+	}
       free (expansion);
     }
 
@@ -250,7 +267,11 @@
   int i;
 
   ret = xmalloc (strlen (fname));
+#if defined (__MSDOS__)
+  for (i = 1; fname[i] && fname[i] != '/' && fname[i] != '\\'; i++)
+#else
   for (i = 1; fname[i] && fname[i] != '/'; i++)
+#endif
     ret[i - 1] = fname[i];
   ret[i - 1] = '\0';
   if (lenp)
@@ -271,7 +292,7 @@
   plen = (prefix && *prefix) ? strlen (prefix) : 0;
   slen = strlen (suffix + suffind);
   ret = xmalloc (plen + slen + 1);
-  if (prefix && *prefix)
+  if (plen)
     strcpy (ret, prefix);
   strcpy (ret + plen, suffix + suffind);
   return ret;
diff --git a/readline/tilde.h b/readline/tilde.h
index 634b954..7783fd6 100644
--- a/readline/tilde.h
+++ b/readline/tilde.h
@@ -8,7 +8,7 @@
 
    The Library 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 1, or (at your option)
+   the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
    The Library is distributed in the hope that it will be useful, but
@@ -19,11 +19,27 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #if !defined (_TILDE_H_)
 #  define _TILDE_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* A function can be defined using prototypes and compile on both ANSI C
+   and traditional C compilers with something like this:
+	extern char *func __P((char *, char *, int)); */
+
+#if !defined (__P)
+#  if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
+#    define __P(protos) protos
+#  else
+#    define __P(protos) ()
+#  endif
+#endif
+
 /* Function pointers can be declared as (Function *)foo. */
 #if !defined (_FUNCTION_DEF)
 #  define _FUNCTION_DEF
@@ -56,10 +72,14 @@
 extern char **tilde_additional_suffixes;
 
 /* Return a new string which is the result of tilde expanding STRING. */
-extern char *tilde_expand ();
+extern char *tilde_expand __P((char *));
 
 /* Do the work of tilde expansion on FILENAME.  FILENAME starts with a
    tilde.  If there is no expansion, call tilde_expansion_failure_hook. */
-extern char *tilde_expand_word ();
+extern char *tilde_expand_word __P((char *));
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _TILDE_H_ */
diff --git a/readline/undo.c b/readline/undo.c
index 28ebcc8..f7f30d1 100644
--- a/readline/undo.c
+++ b/readline/undo.c
@@ -8,7 +8,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -19,7 +19,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -47,6 +47,8 @@
 #include "readline.h"
 #include "history.h"
 
+#include "rlprivate.h"
+
 #define SWAP(s, e)  do { int t; t = s; s = e; e = t; } while (0)
 
 /* Non-zero tells rl_delete_text and rl_insert_text to not add to
diff --git a/readline/util.c b/readline/util.c
index 1dc3b66..be9e0a9 100644
--- a/readline/util.c
+++ b/readline/util.c
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
@@ -52,25 +52,11 @@
 /* Some standard library routines. */
 #include "readline.h"
 
+#include "rlprivate.h"
+#include "xmalloc.h"
+
 #define SWAP(s, e)  do { int t; t = s; s = e; e = t; } while (0)
 
-/* Pseudo-globals imported from readline.c */
-extern int readline_echoing_p;
-extern procenv_t readline_top_level;
-extern int rl_line_buffer_len;
-extern Function *rl_last_func;
-
-extern int _rl_defining_kbd_macro;
-extern char *_rl_executing_macro;
-
-/* Pseudo-global functions imported from other library files. */
-extern void _rl_replace_text ();
-extern void _rl_pop_executing_macro ();
-extern void _rl_set_the_line ();
-extern void _rl_init_argument ();
-
-extern char *xmalloc (), *xrealloc ();
-
 /* **************************************************************** */
 /*								    */
 /*			Utility Functions			    */
diff --git a/readline/vi_keymap.c b/readline/vi_keymap.c
index 14929a3..cf6724c 100644
--- a/readline/vi_keymap.c
+++ b/readline/vi_keymap.c
@@ -7,7 +7,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 
 #if !defined (BUFSIZ)
 #include <stdio.h>
diff --git a/readline/vi_mode.c b/readline/vi_mode.c
index d4868bf..be7f949 100644
--- a/readline/vi_mode.c
+++ b/readline/vi_mode.c
@@ -8,7 +8,7 @@
 
    The GNU Readline Library 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 1, or
+   as published by the Free Software Foundation; either version 2, or
    (at your option) any later version.
 
    The GNU Readline Library is distributed in the hope that it will be
@@ -19,7 +19,7 @@
    The GNU General Public License is often shipped with GNU software, and
    is generally kept in a file called COPYING or LICENSE.  If you do not
    have a copy of the license, write to the Free Software Foundation,
-   675 Mass Ave, Cambridge, MA 02139, USA. */
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
 #define READLINE_LIBRARY
 
 /* **************************************************************** */
@@ -54,6 +54,9 @@
 #include "readline.h"
 #include "history.h"
 
+#include "rlprivate.h"
+#include "xmalloc.h"
+
 #ifndef _rl_digit_p
 #define _rl_digit_p(c)  ((c) >= '0' && (c) <= '9')
 #endif
@@ -74,26 +77,6 @@
 #define exchange(x, y) do {int temp = x; x = y; y = temp;} while (0)
 #endif
 
-extern char *xmalloc (), *xrealloc ();
-
-/* Variables imported from readline.c */
-extern int rl_point, rl_end, rl_mark;
-extern FILE *rl_instream;
-extern int rl_line_buffer_len, rl_explicit_arg, rl_numeric_arg;
-extern Keymap _rl_keymap;
-extern char *rl_prompt;
-extern char *rl_line_buffer;
-extern int rl_arg_sign;
-
-extern int _rl_doing_an_undo;
-extern int _rl_undo_group_level;
-
-extern void _rl_dispatch ();
-extern int _rl_char_search_internal ();
-
-extern void rl_extend_line_buffer ();
-extern int rl_vi_check ();
-
 /* Non-zero means enter insertion mode. */
 static int _rl_vi_doing_insert;
 
@@ -131,7 +114,7 @@
 /* Arrays for the saved marks. */
 static int vi_mark_chars[27];
 
-static int rl_digit_loop1 ();
+static int rl_digit_loop1 __P((void));
 
 void
 _rl_vi_initialize_line ()
@@ -1043,7 +1026,7 @@
       if (vi_redoing)
 	target = _rl_vi_last_search_char;
       else
-	_rl_vi_last_search_char = target = rl_getc (rl_instream);
+	_rl_vi_last_search_char = target = (*rl_getc_function) (rl_instream);
 
       switch (key)
         {
@@ -1159,7 +1142,7 @@
   if (vi_redoing)
     c = _rl_vi_last_replacement;
   else
-    _rl_vi_last_replacement = c = rl_getc (rl_instream);
+    _rl_vi_last_replacement = c = (*rl_getc_function) (rl_instream);
 
   if (c == '\033' || c == CTRL ('C'))
     return -1;
diff --git a/readline/xmalloc.c b/readline/xmalloc.c
index 4160651..c0d0640 100644
--- a/readline/xmalloc.c
+++ b/readline/xmalloc.c
@@ -7,7 +7,7 @@
 
    Readline 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 1, or (at your option) any
+   Free Software Foundation; either version 2, or (at your option) any
    later version.
 
    Readline is distributed in the hope that it will be useful, but
@@ -17,7 +17,8 @@
 
    You should have received a copy of the GNU General Public License
    along with Readline; see the file COPYING.  If not, write to the Free
-   Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+   Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+#define READLINE_LIBRARY
 
 #if defined (HAVE_CONFIG_H)
 #include <config.h>
@@ -31,7 +32,7 @@
 #  include "ansi_stdlib.h"
 #endif /* HAVE_STDLIB_H */
 
-static void memory_error_and_abort ();
+#include "xmalloc.h"
 
 /* **************************************************************** */
 /*								    */
@@ -39,6 +40,14 @@
 /*								    */
 /* **************************************************************** */
 
+static void
+memory_error_and_abort (fname)
+     char *fname;
+{
+  fprintf (stderr, "%s: out of virtual memory\n", fname);
+  exit (2);
+}
+
 /* Return a pointer to free()able block of memory large enough
    to hold BYTES number of bytes.  If the memory cannot be allocated,
    print an error message and abort. */
@@ -56,7 +65,7 @@
 
 char *
 xrealloc (pointer, bytes)
-     char *pointer;
+     PTR_T pointer;
      int bytes;
 {
   char *temp;
@@ -68,19 +77,11 @@
   return (temp);
 }
 
-static void
-memory_error_and_abort (fname)
-     char *fname;
-{
-  fprintf (stderr, "%s: out of virtual memory\n", fname);
-  exit (2);
-}
-
 /* Use this as the function to call when adding unwind protects so we
    don't need to know what free() returns. */
 void
 xfree (string)
-     char *string;
+     PTR_T string;
 {
   if (string)
     free (string);
diff --git a/readline/xmalloc.h b/readline/xmalloc.h
new file mode 100644
index 0000000..bdf251b
--- /dev/null
+++ b/readline/xmalloc.h
@@ -0,0 +1,46 @@
+/* xmalloc.h -- memory allocation that aborts on errors. */
+
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+
+   This file is part of the GNU Readline Library, a library for
+   reading lines of text with interactive input and history editing.
+
+   The GNU Readline Library 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.
+
+   The GNU Readline 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 General Public License for more details.
+
+   The GNU General Public License is often shipped with GNU software, and
+   is generally kept in a file called COPYING or LICENSE.  If you do not
+   have a copy of the license, write to the Free Software Foundation,
+   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#if !defined (_XMALLOC_H_)
+#define _XMALLOC_H_
+
+#if defined (READLINE_LIBRARY)
+#  include "rlstdc.h"
+#else
+#  include <readline/rlstdc.h>
+#endif
+
+#ifndef PTR_T
+
+#ifdef __STDC__
+#  define PTR_T	void *
+#else
+#  define PTR_T	char *
+#endif
+
+#endif /* !PTR_T */
+
+extern char *xmalloc __P((int));
+extern char *xrealloc __P((void *, int));
+extern void xfree __P((void *));
+
+#endif /* _XMALLOC_H_ */
diff --git a/sim/ChangeLog b/sim/ChangeLog
index 92193f5..d4ac848 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,26 @@
+2000-10-25  Geoff Keating  <geoffk@cygnus.com>
+
+	* MAINTAINERS: Added self and Andrew for the ppc sim.
+
+Thu Jul 27 21:26:26 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	From Stephane Carrez <Stephane.Carrez@worldnet.fr>:
+	* m68hc11: New directory.
+	* configure.in: Add.
+	* configure: Regenerate.
+
+Tue Jul  4 13:43:54 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* tic80: New directory.
+	* configure.in: Add configury.
+	* configure: Regenerate.
+
+2000-04-20  Nick Clifton  <nickc@cygnus.com>
+
+	* configure.in (extra_subdirs): Add testsuite to strongarm
+	directories. 
+	* configure: Regenerate.
+
 Sat Mar  4 16:48:54 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* MAINTAINERS: New file.  Blank.
diff --git a/sim/MAINTAINERS b/sim/MAINTAINERS
index 0f069ec..71f62ef 100644
--- a/sim/MAINTAINERS
+++ b/sim/MAINTAINERS
@@ -1 +1,5 @@
-This file is intentionally left blank.
+Maintiners for particular sims:
+ppc		Andrew Cagney <ac131313@cygnus.com>
+ppc		Geoff Keating <geoffk@cygnus.com>
+
+The remainder of this file is intentionally left blank.
diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index f7b7895..9180bd5 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -1,3 +1,157 @@
+2000-12-18  Nick Clifton  <nickc@redhat.com>
+
+	* armemu.c (ARMul_Emulate26): Fix test for StoreDouble
+	instruction.
+
+2000-12-10  Nick Clifton  <nickc@redhat.com>
+
+	* armos.c (ARMul_OSHandleSWI): Add 0x91 as an FPE SWI.
+
+2000-12-07  Nick Clifton  <nickc@redhat.com>
+
+	* armemu.c (ARMul_Emulate26): Detect double word load and
+	store instructions and call emulation routines.
+	(Handle_Load_Double): Emulate a double word load instruction.
+	(Handle_Store_Double): Emulate a double word store
+	instruction.
+
+2000-12-03  Nick Clifton  <nickc@redhat.com>
+
+	* armos.c: Fix formatting.
+	(ARMul_OSHandleSWI): Suppress support of DEMON SWIs when in xscale
+	mode.
+
+2000-11-29  Nick Clifton  <nickc@redhat.com>
+
+	* armdefs.h (State): Add 'v5e' and 'xscale' fields.
+	(ARM_v5e_Prop): Define.
+	(ARM_XScale_Prop): Define.
+	
+	* wrapper.c (sim_create_inferior): Select processor based on
+	machine number.
+	(SWI_vector_installed): New boolean.  Set to true if the SWI
+	vector address is written to by the executable.
+	
+	* arminit.c (ARMul_NewState): Switch default to 32 bit mode.
+	(ARMul_SelectProcessor): Initialise v5e and xscale signals.
+	(ARMul_Abort): Fix calculation of LR address.
+
+	* armos.c (ARMul_OSHandleSWI): If a SWI vector has been installed
+	and a SWI is not handled by the simulator, pass the SWI off to the
+	vector, otherwise issue a warning message and continue.
+
+	* armsupp.c (ARMul_CPSRAltered): Set S bit aswell.
+	
+	* thumbemu.c: Add v5 instruction simulation.
+	* armemu.c: Add v5, XScale and El Segundo instruction simulation.
+
+	* armcopro.c: Add XScale co-processor emulation.
+	* armemu.h: Add exported XScale co-processor functions.
+	
+2000-09-15  Nick Clifton  <nickc@redhat.com>
+
+	* armdefs.h: Rename StrongARM property to v4_ARM and add v5 ARM
+	property.  Delete unnecessary processor names.
+	(ARM_Strong_Prop): Delete.
+	(STRONGARM): Delete.
+	(ARM_v4_Prop): Add.
+	(ARM_v5_Prop): Add
+	(State): Delete is_StrongARM boolean.  Add is_v4 and is_v5
+	booleans.
+
+	* armemu.h (BUSUSEDINCPCS): Use is_v4 boolean.
+	(BUSUSEDINCPCN): Use is_v4 boolean.
+
+	* arminit.c (ARMul_NewState): Initialise is_v4 and is_v5 fields.
+	(ARMul_SelectProcessor): Change second parameter from 'processor'
+	to 'properties'.  Set is_v4 and is_v5 booleans in State.
+
+	* armrdi.c: Remove use of ARM processor names.  Replace with ARM
+	processor properties.
+
+	* wrapper.c (sim_create_inferior): Choose properties passed to
+	ARMul_SelectProcessor based on machine number.
+
+2000-08-14  Nick Clifton  <nickc@redhat.com>
+
+	* armemu.c (LHPOSTDOWN): Compute write back value before
+	performing load in case the offset register is overwritten.
+	(LHPOSTUP): Ditto.
+
+2000-07-14  Fernando Nasser <fnasser@cygnus.com>
+
+	* wrapper.c (sim_create_inferior): Fix typo in the previous patch.
+
+2000-07-14  Fernando Nasser <fnasser@cygnus.com>
+
+	* wrapper.c (sim_create_inferior): Reset mode to ARM when creating a
+	new inferior.
+
+2000-07-04  Alexandre Oliva  <aoliva@redhat.com>
+
+	* armvirt.c (ABORTS): Do not define.
+
+	* armdefs.h (struct ARMul_State): Add is_StrongARM.
+	(ARM_Strong_Prop, STRONGARM): Define.
+	* arminit.c (ARMul_NewState): Reset is_StrongARM.
+	(ARMul_SelectProcessor): Set is_StrongARM.
+	* wrapper.c (sim_create_inferior): Use bfd machine type to
+	determine processor type to emulate.
+	* armemu.h (BUSUSEDINCPCS, BUSUSEDINCPCN): Don't increment PC
+	when emulating StrongARM.
+
+	* armemu.c (ARMul_Emulate, t_undefined): Proceed to next insn.
+
+	* armemu.h (INSN_SIZE): New macro.
+	(SET_ABORT): Save CPSR in SPSR and set LR.
+	* armemu.c (ARMul_Emulate, isize): Set to INSN_SIZE.
+	(WriteR15, WriteSR15): Do not discard bit 1 in Thumb mode.
+	* arminit.c (ARMul_Abort): Use new SETABORT and INSN_SIZE.
+
+	* armemu.c (LoadSMult): Use WriteR15() to discard the least
+	significant bits of PC.
+
+	* armemu.h (WRITEDESTB): New macro.
+	* armemu.c (ARMul_Emulate26, bl): Use WriteR15Branch() to
+	modify PC.  Moved the existing logic...
+	(WriteR15Branch): ... here.  New function.
+	(WriteR15, WriteSR15): Drop the two least significant bits.
+	(LoadSMult): Use WriteR15Branch() to modify PC.
+	(LoadMult): Use WRITEDESTB() instead of WRITEDEST().
+
+	* armemu.h (GETSPSR): Call ARMul_GetSPSR().
+	* armsupp.c (ARMul_CPSRAltered): Zero out bits as they're
+	extracted from state->Cpsr, but preserve the unused bits.
+	(ARMul_GetCPSR): Get bits preserved in state->Cpsr.
+	(ARMul_GetSPSR, ARMul_FixCPSR): Use ARMul_GetCPSR() to
+	get the full CPSR word.
+
+	* armemu.h (PSR_FBITS, PSR_SBITS, PSR_XBITS, PSR_CBITS): New.
+	(SETPSR_F, SETPSR_S, SETPSR_X, SETPSR_C): New macros.
+	(SETPSR, SET_INTMODE, SETCC): Removed.
+	* armsupp.c (ARMul_FixCPSR, ARMul_FixSPSR): Do not test bit
+	mask.  Use SETPSR_* to modify PSR.
+	(ARMul_SetCPSR): Load all bits from value.
+	* armemu.c (ARMul_Emulate, msr): Do not test bit mask.
+
+	* armemu.c (ARMul_Emulate): Compute writeback value before
+	loading, since the offset register may be the destination
+	register.
+
+	* armdefs.h (SYSTEMBANK): Define as USERBANK.
+	* armsupp.c (ARMul_SwitchMode): Remove SYSTEMBANK cases.
+
+2000-06-22  Alexandre Oliva  <aoliva@cygnus.com>
+
+	* armemu.c (Multiply64): Fix computation of flag N.
+
+	* armemu.c (MultiplyAdd64): Fix computation of flag N.
+
+2000-06-20  Alexandre Oliva  <aoliva@cygnus.com>
+
+	* armemu.h (NEGBRANCH): Do not overwrite the two most significant
+	bits of the offset.
+
 2000-05-25  Nick Clifton  <nickc@cygnus.com>
 
 	* armcopro.c (MMUMCR): Only indicate mode change if a singal has
@@ -85,7 +239,6 @@
 
 	* configure: Regenerated to track ../common/aclocal.m4 changes.
 
-
 1999-05-08  Felix Lee  <flee@cygnus.com>
 
 	* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/arm/armcopro.c b/sim/arm/armcopro.c
index 48be680..db7ee60 100644
--- a/sim/arm/armcopro.c
+++ b/sim/arm/armcopro.c
@@ -19,37 +19,880 @@
 #include "armemu.h"
 #include "ansidecl.h"
 
-extern unsigned ARMul_CoProInit (ARMul_State * state);
-extern void ARMul_CoProExit (ARMul_State * state);
-extern void ARMul_CoProAttach (ARMul_State * state, unsigned number,
-			       ARMul_CPInits * init, ARMul_CPExits * exit,
-			       ARMul_LDCs * ldc, ARMul_STCs * stc,
-			       ARMul_MRCs * mrc, ARMul_MCRs * mcr,
-			       ARMul_CDPs * cdp,
-			       ARMul_CPReads * read, ARMul_CPWrites * write);
-extern void ARMul_CoProDetach (ARMul_State * state, unsigned number);
+/* Dummy Co-processors.  */
 
+static unsigned
+NoCoPro3R (ARMul_State * state ATTRIBUTE_UNUSED,
+	   unsigned      a     ATTRIBUTE_UNUSED,
+	   ARMword       b     ATTRIBUTE_UNUSED)
+{
+  return ARMul_CANT;
+}
 
-/***************************************************************************\
-*                            Dummy Co-processors                            *
-\***************************************************************************/
+static unsigned
+NoCoPro4R (ARMul_State * state ATTRIBUTE_UNUSED,
+	   unsigned      a     ATTRIBUTE_UNUSED,
+	   ARMword       b     ATTRIBUTE_UNUSED,
+	   ARMword       c     ATTRIBUTE_UNUSED)
+{
+  return ARMul_CANT;
+}
 
-static unsigned NoCoPro3R (ARMul_State * state, unsigned, ARMword);
-static unsigned NoCoPro4R (ARMul_State * state, unsigned, ARMword, ARMword);
-static unsigned NoCoPro4W (ARMul_State * state, unsigned, ARMword, ARMword *);
+static unsigned
+NoCoPro4W (ARMul_State * state ATTRIBUTE_UNUSED,
+	   unsigned      a     ATTRIBUTE_UNUSED,
+	   ARMword       b     ATTRIBUTE_UNUSED,
+	   ARMword *     c     ATTRIBUTE_UNUSED)
+{
+  return ARMul_CANT;
+}
 
-/***************************************************************************\
-*                Define Co-Processor instruction handlers here              *
-\***************************************************************************/
+/* The XScale Co-processors.  */
+
+/* Coprocessor 15:  System Control.  */
+
+/* There are two sets of registers for copro 15.
+   One set is available when opcode_2 is 0 and
+   the other set when opcode_2 >= 1.  */
+static ARMword XScale_cp15_opcode_2_is_0_Regs[16];
+static ARMword XScale_cp15_opcode_2_is_not_0_Regs[16];
+/* There are also a set of breakpoint registers
+   which are accessed via CRm instead of opcode_2.  */
+static ARMword XScale_cp15_DBR1;
+static ARMword XScale_cp15_DBCON;
+static ARMword XScale_cp15_IBCR0;
+static ARMword XScale_cp15_IBCR1;
+
+static unsigned
+XScale_cp15_init (ARMul_State * state ATTRIBUTE_UNUSED)
+{
+  int i;
+
+  for (i = 16; i--;)
+    {
+      XScale_cp15_opcode_2_is_0_Regs[i] = 0;
+      XScale_cp15_opcode_2_is_not_0_Regs[i] = 0;
+    }
+
+  /* Initialise the processor ID.  */
+  XScale_cp15_opcode_2_is_0_Regs[0] = 0x69052000;
+
+  /* Initialise the cache type.  */
+  XScale_cp15_opcode_2_is_not_0_Regs[0] = 0x0B1AA1AA;
+
+  /* Initialise the ARM Control Register.  */
+  XScale_cp15_opcode_2_is_0_Regs[1] = 0x00000078;
+  
+}
+
+/* Check an access to a register.  */
+
+static unsigned
+check_cp15_access (ARMul_State * state,
+		   unsigned      reg,
+		   unsigned      CRm,
+		   unsigned      opcode_1,
+		   unsigned      opcode_2)
+{
+  /* Do not allow access to these register in USER mode.  */
+  if (state->Mode == USER26MODE || state->Mode == USER32MODE)
+    return ARMul_CANT;
+
+  /* Opcode_1should be zero.  */
+  if (opcode_1 != 0)
+    return ARMul_CANT;
+  
+  /* Different register have different access requirements.  */
+  switch (reg)
+    {
+    case 0:
+    case 1:
+      /* CRm must be 0.  Opcode_2 can be anything.  */
+      if (CRm != 0)
+	return ARMul_CANT;
+      break;      
+    case 2:
+    case 3:
+      /* CRm must be 0.  Opcode_2 must be zero.  */
+      if ((CRm != 0) || (opcode_2 != 0))
+	return ARMul_CANT;
+      break;
+    case 4:
+      /* Access not allowed.  */
+      return ARMul_CANT;
+    case 5:
+    case 6:
+      /* Opcode_2 must be zero.  CRm must be 0.  */
+      if ((CRm != 0) || (opcode_2 != 0))
+	return ARMul_CANT;
+      break;
+    case 7:
+      /* Permissable combinations:
+	   Opcode_2  CRm
+	      0       5
+	      0       6
+	      0       7
+	      1       5
+	      1       6
+	      1      10
+	      4      10
+	      5       2
+	      6       5  */
+      switch (opcode_2)
+	{
+	default:               return ARMul_CANT;
+	case 6: if (CRm !=  5) return ARMul_CANT; break;
+	case 5: if (CRm !=  2) return ARMul_CANT; break;
+	case 4: if (CRm != 10) return ARMul_CANT; break;
+	case 1: if ((CRm != 5) && (CRm != 6) && (CRm != 10)) return ARMul_CANT; break;
+	case 0: if ((CRm < 5) || (CRm > 7)) return ARMul_CANT; break;
+	}
+      break;
+      
+    case 8:
+      /* Permissable combinations:
+	   Opcode_2  CRm
+	      0       5
+	      0       6
+	      0       7
+	      1       5
+	      1       6  */
+      if (opcode_2 > 1)
+	return ARMul_CANT;
+      if ((CRm < 5) || (CRm > 7))
+	return ARMul_CANT;
+      if (opcode_2 == 1 && CRm == 7)
+	return ARMul_CANT;
+      break;
+    case 9:
+      /* Opcode_2 must be zero or one.  CRm must be 1 or 2.  */
+      if (   ((CRm != 0) && (CRm != 1))
+	  || ((opcode_2 != 1) && (opcode_2 != 2)))
+	return ARMul_CANT;
+      break;
+    case 10:
+      /* Opcode_2 must be zero or one.  CRm must be 4 or 8.  */
+      if (   ((CRm != 0) && (CRm != 1))
+	  || ((opcode_2 != 4) && (opcode_2 != 8)))
+	return ARMul_CANT;
+      break;
+    case 11:
+      /* Access not allowed.  */
+      return ARMul_CANT;
+    case 12:
+      /* Access not allowed.  */
+      return ARMul_CANT;
+    case 13:
+      /* Opcode_2 must be zero.  CRm must be 0.  */
+      if ((CRm != 0) || (opcode_2 != 0))
+	return ARMul_CANT;
+      break;
+    case 14:
+      /* Opcode_2 must be 0.  CRm must be 0, 3, 4, 8 or 9.  */
+      if (opcode_2 != 0)
+	return ARMul_CANT;
+
+      if ((CRm != 0) && (CRm != 3) && (CRm != 4) && (CRm != 8) && (CRm != 9))
+	return ARMul_CANT;
+      break;
+    case 15:
+      /* Opcode_2 must be zero.  CRm must be 1.  */
+      if ((CRm != 1) || (opcode_2 != 0))
+	return ARMul_CANT;
+      break;
+    default:
+      /* Should never happen.  */
+      return ARMul_CANT;
+    }
+  
+  return ARMul_DONE;
+}
+
+/* Store a value into one of coprocessor 15's registers.  */
+
+void
+write_cp15_reg (unsigned reg, unsigned opcode_2, unsigned CRm, ARMword value)
+{
+  if (opcode_2)
+    {
+      switch (reg)
+	{
+	case 0: /* Cache Type.  */
+	  /* Writes are not allowed.  */
+	  return;
+
+	case 1: /* Auxillary Control.  */
+	  /* Only BITS (5, 4) and BITS (1, 0) can be written.  */
+	  value &= 0x33;
+	  break;
+	  
+	default:
+	  return;
+	}
+      
+      XScale_cp15_opcode_2_is_not_0_Regs [reg] = value;
+    }
+  else
+    {
+      switch (reg)
+	{
+	case 0: /* ID.  */
+	  /* Writes are not allowed.  */
+	  return;
+
+	case 1: /* ARM Control.  */
+	  /* Only BITS (13, 11), BITS (9, 7) and BITS (2, 0) can be written.
+	     BITS (31, 14) and BIT (10) write as zero, BITS (6, 3) write as one.  */
+	  value &= 0x00003b87;
+	  value |= 0x00000078;
+	  break;
+
+	case 2: /* Translation Table Base.  */
+	  /* Only BITS (31, 14) can be written.  */
+	  value &= 0xffffc000;
+	  break;
+	  
+	case 3: /* Domain Access Control.  */
+	  /* All bits writable.  */
+	  break;
+	  
+	case 5: /* Fault Status Register.  */
+	  /* BITS (10, 9) and BITS (7, 0) can be written.  */
+	  value &= 0x000006ff;
+	  break;
+
+	case 6: /* Fault Address Register.  */
+	  /* All bits writable.  */
+	  break;
+
+	case 7: /* Cache Functions.  */
+	case 8: /* TLB Operations.  */
+	case 10: /* TLB Lock Down.  */
+	  /* Ignore writes.  */
+	  return;
+
+	case 9: /* Data Cache Lock.  */
+	  /* Only BIT (0) can be written.  */
+	  value &= 0x1;
+	  break;
+
+	case 13: /* Process ID.  */
+	  /* Only BITS (31, 25) are writable.  */
+	  value &= 0xfe000000;
+	  break;
+
+	case 14: /* DBR0, DBR1, DBCON, IBCR0, IBCR1 */
+	  /* All bits can be written.  Which register is accessed is
+	     dependent upon CRm.  */
+	  switch (CRm)
+	    {
+	    case 0: /* DBR0 */
+	      break;
+	    case 3: /* DBR1 */
+	      XScale_cp15_DBR1 = value;
+	      break;
+	    case 4: /* DBCON */
+	      XScale_cp15_DBCON = value;
+	      break;
+	    case 8: /* IBCR0 */
+	      XScale_cp15_IBCR0 = value;
+	      break;
+	    case 9: /* IBCR1 */
+	      XScale_cp15_IBCR1 = value;
+	      break;
+	    default:
+	      return;
+	    }
+	  break;
+
+	case 15: /* Coprpcessor Access Register.  */
+	  /* Access is only valid if CRm == 1.  */
+	  if (CRm != 1)
+	    return;
+	  
+	  /* Only BITS (13, 0) may be written.  */
+	  value &= 0x00003fff;
+	  break;
+	  
+	default:
+	  return;
+	}
+
+      XScale_cp15_opcode_2_is_0_Regs [reg] = value;
+    }
+  
+  return;
+}
+
+/* Return the value in a cp13 register.  */
+
+static ARMword
+read_cp15_reg (unsigned reg, unsigned opcode_2, unsigned CRm)
+{
+  if (opcode_2 == 0)
+    {
+      if (reg == 15 && CRm != 1)
+	return 0;
+
+      if (reg == 14)
+	{
+	  switch (CRm)
+	    {
+	    case 3: return XScale_cp15_DBR1;
+	    case 4: return XScale_cp15_DBCON;
+	    case 8: return XScale_cp15_IBCR0;
+	    case 9: return XScale_cp15_IBCR1;
+	    default:
+	      break;
+	    }
+	}
+      
+      return XScale_cp15_opcode_2_is_0_Regs [reg];
+    }
+  else
+    return XScale_cp15_opcode_2_is_not_0_Regs [reg];
+
+  return 0;
+}
+
+static unsigned
+XScale_cp15_LDC (ARMul_State * state, unsigned type, ARMword instr, ARMword data)
+{
+  unsigned reg = BITS (12, 15);
+  unsigned result;
+  
+  result = check_cp15_access (state, reg, 0, 0, 0);
+  
+  if (result == ARMul_DONE && type == ARMul_DATA)
+    write_cp15_reg (reg, 0, 0, data);
+
+  return result;
+}
+
+static unsigned
+XScale_cp15_STC (ARMul_State * state, unsigned type, ARMword instr, ARMword * data)
+{
+  unsigned reg = BITS (12, 15);
+  unsigned result;
+  
+  result = check_cp15_access (state, reg, 0, 0, 0);
+  
+  if (result == ARMul_DONE && type == ARMul_DATA)
+    * data = read_cp15_reg (reg, 0, 0);
+  
+  return result;
+}
+
+static unsigned
+XScale_cp15_MRC (ARMul_State * state,
+	      unsigned      type ATTRIBUTE_UNUSED,
+	      ARMword       instr,
+	      ARMword *     value)
+{
+  unsigned opcode_2 = BITS (5, 7);
+  unsigned CRm = BITS (0, 3);
+  unsigned reg = BITS (16, 19);
+  unsigned result;
+  
+  result = check_cp15_access (state, reg, CRm, BITS (21, 23), opcode_2);
+  
+  if (result == ARMul_DONE)
+    * value = read_cp15_reg (reg, opcode_2, CRm);
+  
+  return result;
+}
+
+static unsigned
+XScale_cp15_MCR (ARMul_State * state,
+	      unsigned      type ATTRIBUTE_UNUSED,
+	      ARMword       instr,
+	      ARMword       value)
+{
+  unsigned opcode_2 = BITS (5, 7);
+  unsigned CRm = BITS (0, 3);
+  unsigned reg = BITS (16, 19);
+  unsigned result;
+  
+  result = check_cp15_access (state, reg, CRm, BITS (21, 23), opcode_2);
+  
+  if (result == ARMul_DONE)
+    write_cp15_reg (reg, opcode_2, CRm, value);
+  
+  return result;
+}
+
+static unsigned
+XScale_cp15_read_reg (ARMul_State * state ATTRIBUTE_UNUSED,
+		   unsigned      reg,
+		   ARMword *     value)
+{
+  /* FIXME: Not sure what to do about the alternative register set
+     here.  For now default to just accessing CRm == 0 registers.  */
+  * value = read_cp15_reg (reg, 0, 0);
+  
+  return TRUE;
+}
+
+static unsigned
+XScale_cp15_write_reg (ARMul_State * state ATTRIBUTE_UNUSED,
+		    unsigned      reg,
+		    ARMword       value)
+{
+  /* FIXME: Not sure what to do about the alternative register set
+     here.  For now default to just accessing CRm == 0 registers.  */
+  write_cp15_reg (reg, 0, 0, value);
+  
+  return TRUE;
+}
+
+/* Coprocessor 13:  Interrupt Controller and Bus Controller.  */
+
+/* There are two sets of registers for copro 13.
+   One set (of three registers) is available when CRm is 0
+   and the other set (of six registers) when CRm is 1.  */
+
+static ARMword XScale_cp13_CR0_Regs[16];
+static ARMword XScale_cp13_CR1_Regs[16];
+
+static unsigned
+XScale_cp13_init (ARMul_State * state ATTRIBUTE_UNUSED)
+{
+  int i;
+
+  for (i = 16; i--;)
+    {
+      XScale_cp13_CR0_Regs[i] = 0;
+      XScale_cp13_CR1_Regs[i] = 0;
+    }
+}
+
+/* Check an access to a register.  */
+
+static unsigned
+check_cp13_access (ARMul_State * state,
+		   unsigned      reg,
+		   unsigned      CRm,
+		   unsigned      opcode_1,
+		   unsigned      opcode_2)
+{
+  /* Do not allow access to these register in USER mode.  */
+  if (state->Mode == USER26MODE || state->Mode == USER32MODE)
+    return ARMul_CANT;
+
+  /* The opcodes should be zero.  */
+  if ((opcode_1 != 0) || (opcode_2 != 0))
+    return ARMul_CANT;
+  
+  /* Do not allow access to these register if bit 13 of coprocessor
+     15's register 15 is zero.  */
+  if ((XScale_cp15_opcode_2_is_0_Regs[15] & (1 << 13)) == 0)
+    return ARMul_CANT;
+  
+  /* Registers 0, 4 and 8 are defined when CRm == 0.
+     Registers 0, 4, 5, 6, 7, 8 are defined when CRm == 1.
+     For all other CRm values undefined behaviour results.  */
+  if (CRm == 0)
+    {
+      if (reg == 0 || reg == 4 || reg == 8)
+	return ARMul_DONE;
+    }
+  else if (CRm == 1)
+    {
+      if (reg == 0 || (reg >= 4 && reg <= 8))
+	return ARMul_DONE;
+    }
+
+  return ARMul_CANT;
+}
+
+/* Store a value into one of coprocessor 13's registers.  */
+
+static void
+write_cp13_reg (unsigned reg, unsigned CRm, ARMword value)
+{
+  switch (CRm)
+    {
+    case 0:
+      switch (reg)
+	{
+	case 0: /* INTCTL */
+	  /* Only BITS (3:0) can be written.  */
+	  value &= 0xf;
+	  break;
+	  
+	case 4: /* INTSRC */
+	  /* No bits may be written.  */
+	  return;
+	  
+	case 8: /* INTSTR */
+	  /* Only BITS (1:0) can be written.  */
+	  value &= 0x3;
+	  break;
+	  
+	default:
+	  /* Should not happen.  Ignore any writes to unimplemented registers.  */
+	  return;
+	}
+      
+      XScale_cp13_CR0_Regs [reg] = value;
+      break;
+
+    case 1:
+      switch (reg)
+	{
+	case 0: /* BCUCTL */
+	  /* Only BITS (30:28) and BITS (3:0) can be written.
+	     BIT(31) is write ignored.  */
+	  value &= 0x7000000f;
+	  value |= XScale_cp13_CR1_Regs[0] & (1UL << 31);
+	  break;
+	  
+	case 4: /* ELOG0 */
+	case 5: /* ELOG1 */
+	case 6: /* ECAR0 */
+	case 7: /* ECAR1 */
+	  /* No bits can be written.  */
+	  return;
+
+	case 8: /* ECTST */
+	  /* Only BITS (7:0) can be written.  */
+	  value &= 0xff;
+	  break;
+	  
+	default:
+	  /* Should not happen.  Ignore any writes to unimplemented registers.  */
+	  return;
+	}
+      
+      XScale_cp13_CR1_Regs [reg] = value;
+      break;
+
+    default:
+      /* Should not happen.  */
+      break;
+    }
+  
+  return;
+}
+
+/* Return the value in a cp13 register.  */
+
+static ARMword
+read_cp13_reg (unsigned reg, unsigned CRm)
+{
+  if (CRm == 0)
+    return XScale_cp13_CR0_Regs [reg];
+  else if (CRm == 1)
+    return XScale_cp13_CR1_Regs [reg];
+
+  return 0;
+}
+
+static unsigned
+XScale_cp13_LDC (ARMul_State * state, unsigned type, ARMword instr, ARMword data)
+{
+  unsigned reg = BITS (12, 15);
+  unsigned result;
+  
+  result = check_cp13_access (state, reg, 0, 0, 0);
+  
+  if (result == ARMul_DONE && type == ARMul_DATA)
+    write_cp13_reg (reg, 0, data);
+
+  return result;
+}
+
+static unsigned
+XScale_cp13_STC (ARMul_State * state, unsigned type, ARMword instr, ARMword * data)
+{
+  unsigned reg = BITS (12, 15);
+  unsigned result;
+  
+  result = check_cp13_access (state, reg, 0, 0, 0);
+  
+  if (result == ARMul_DONE && type == ARMul_DATA)
+    * data = read_cp13_reg (reg, 0);
+  
+  return result;
+}
+
+static unsigned
+XScale_cp13_MRC (ARMul_State * state,
+	      unsigned      type ATTRIBUTE_UNUSED,
+	      ARMword       instr,
+	      ARMword *     value)
+{
+  unsigned CRm = BITS (0, 3);
+  unsigned reg = BITS (16, 19);
+  unsigned result;
+  
+  result = check_cp13_access (state, reg, CRm, BITS (21, 23), BITS (5, 7));
+  
+  if (result == ARMul_DONE)
+    * value = read_cp13_reg (reg, CRm);
+  
+  return result;
+}
+
+static unsigned
+XScale_cp13_MCR (ARMul_State * state,
+	      unsigned      type ATTRIBUTE_UNUSED,
+	      ARMword       instr,
+	      ARMword       value)
+{
+  unsigned CRm = BITS (0, 3);
+  unsigned reg = BITS (16, 19);
+  unsigned result;
+  
+  result = check_cp13_access (state, reg, CRm, BITS (21, 23), BITS (5, 7));
+  
+  if (result == ARMul_DONE)
+    write_cp13_reg (reg, CRm, value);
+  
+  return result;
+}
+
+static unsigned
+XScale_cp13_read_reg
+(
+ ARMul_State * state ATTRIBUTE_UNUSED,
+ unsigned      reg,
+ ARMword *     value
+)
+{
+  /* FIXME: Not sure what to do about the alternative register set
+     here.  For now default to just accessing CRm == 0 registers.  */
+  * value = read_cp13_reg (reg, 0);
+  
+  return TRUE;
+}
+
+static unsigned
+XScale_cp13_write_reg
+(
+ ARMul_State * state ATTRIBUTE_UNUSED,
+ unsigned      reg,
+ ARMword       value
+)
+{
+  /* FIXME: Not sure what to do about the alternative register set
+     here.  For now default to just accessing CRm == 0 registers.  */
+  write_cp13_reg (reg, 0, value);
+  
+  return TRUE;
+}
+
+/* Coprocessor 14:  Performance Monitoring,  Clock and Power management,
+   Software Debug.  */
+
+static ARMword XScale_cp14_Regs[16];
+
+static unsigned
+XScale_cp14_init (ARMul_State * state ATTRIBUTE_UNUSED)
+{
+  int i;
+
+  for (i = 16; i--;)
+    XScale_cp14_Regs[i] = 0;
+}
+
+/* Check an access to a register.  */
+
+static unsigned
+check_cp14_access (ARMul_State * state,
+		   unsigned      reg,
+		   unsigned      CRm,
+		   unsigned      opcode1,
+		   unsigned      opcode2)
+{
+  /* Not allowed to access these register in USER mode.  */
+  if (state->Mode == USER26MODE || state->Mode == USER32MODE)
+    return ARMul_CANT;
+
+  /* CRm should be zero.  */
+  if (CRm != 0)
+    return ARMul_CANT;
+
+  /* OPcodes should be zero.  */
+  if (opcode1 != 0 || opcode2 != 0)
+    return ARMul_CANT;
+  
+  /* Accessing registers 4 or 5 has unpredicatable results.  */
+  if (reg >= 4 && reg <= 5)
+    return ARMul_CANT;
+
+  return ARMul_DONE;
+}
+
+/* Store a value into one of coprocessor 14's registers.  */
+
+void
+write_cp14_reg (unsigned reg, ARMword value)
+{
+  switch (reg)
+    {
+    case 0: /* PMNC */
+      /* Only BITS (27:12), BITS (10:8) and BITS (6:0) can be written.  */
+      value &= 0x0ffff77f;
+      break;
+
+    case 4:
+    case 5:
+      /* We should not normally reach this code.  The debugger interface
+	 can bypass the normal checks though, so it could happen.  */
+      value = 0;
+      break;
+      
+    case 6: /* CCLKCFG */
+      /* Only BITS (3:0) can be written.  */
+      value &= 0xf;
+      break;
+
+    case 7: /* PWRMODE */
+      /* Although BITS (1:0) can be written with non-zero values, this would
+	 have the side effect of putting the processor to sleep.  Thus in
+	 order for the register to be read again, it would have to go into
+	 ACTIVE mode, which means that any read will see these bits as zero.
+	 
+	 Rather than trying to implement complex reset-to-zero-upon-read logic
+	 we just override the write value with zero.  */
+      value = 0;
+      break;
+
+    case 10: /* DCSR */
+      /* Only BITS (31:30), BITS (23:22), BITS (20:16) and BITS (5:0) can
+	 be written.  */
+      value &= 0xc0df003f;
+      break;
+
+    case 11: /* TBREG */
+      /* No writes are permitted.  */
+      value = 0;
+      break;
+      
+    case 14: /* TXRXCTRL */
+      /* Only BITS (31:30) can be written.  */
+      value &= 0xc0000000;
+      break;
+      
+    default:
+      /* All bits can be written.  */
+      break;
+    }
+
+  XScale_cp14_Regs [reg] = value;
+}
+
+/* Return the value in a cp14 register.  Not a static function since
+   it is used by the code to emulate the BKPT instruction in armemu.c.  */
+
+ARMword
+read_cp14_reg (unsigned reg)
+{
+  return XScale_cp14_Regs [reg];
+}
+
+static unsigned
+XScale_cp14_LDC (ARMul_State * state, unsigned type, ARMword instr, ARMword data)
+{
+  unsigned reg = BITS (12, 15);
+  unsigned result;
+  
+  result = check_cp14_access (state, reg, 0, 0, 0);
+  
+  if (result == ARMul_DONE && type == ARMul_DATA)
+    write_cp14_reg (reg, data);
+
+  return result;
+}
+
+static unsigned
+XScale_cp14_STC (ARMul_State * state, unsigned type, ARMword instr, ARMword * data)
+{
+  unsigned reg = BITS (12, 15);
+  unsigned result;
+  
+  result = check_cp14_access (state, reg, 0, 0, 0);
+  
+  if (result == ARMul_DONE && type == ARMul_DATA)
+    * data = read_cp14_reg (reg);
+  
+  return result;
+}
+
+static unsigned
+XScale_cp14_MRC
+(
+ ARMul_State * state,
+ unsigned      type ATTRIBUTE_UNUSED,
+ ARMword       instr,
+ ARMword *     value
+)
+{
+  unsigned reg = BITS (16, 19);
+  unsigned result;
+  
+  result = check_cp14_access (state, reg, BITS (0, 3), BITS (21, 23), BITS (5, 7));
+  
+  if (result == ARMul_DONE)
+    * value = read_cp14_reg (reg);
+  
+  return result;
+}
+
+static unsigned
+XScale_cp14_MCR
+(
+ ARMul_State * state,
+ unsigned      type ATTRIBUTE_UNUSED,
+ ARMword       instr,
+ ARMword       value
+)
+{
+  unsigned reg = BITS (16, 19);
+  unsigned result;
+  
+  result = check_cp14_access (state, reg, BITS (0, 3), BITS (21, 23), BITS (5, 7));
+  
+  if (result == ARMul_DONE)
+    write_cp14_reg (reg, value);
+  
+  return result;
+}
+
+static unsigned
+XScale_cp14_read_reg
+(
+ ARMul_State * state ATTRIBUTE_UNUSED,
+ unsigned      reg,
+ ARMword *     value
+)
+{
+  * value = read_cp14_reg (reg);
+  
+  return TRUE;
+}
+
+static unsigned
+XScale_cp14_write_reg
+(
+ ARMul_State * state ATTRIBUTE_UNUSED,
+ unsigned      reg,
+ ARMword       value
+)
+{
+  write_cp14_reg (reg, value);
+  
+  return TRUE;
+}
 
 /* Here's ARMulator's MMU definition.  A few things to note:
-1) it has eight registers, but only two are defined.
-2) you can only access its registers with MCR and MRC.
-3) MMU Register 0 (ID) returns 0x41440110
-4) Register 1 only has 4 bits defined.  Bits 0 to 3 are unused, bit 4
-controls 32/26 bit program space, bit 5 controls 32/26 bit data space,
-bit 6 controls late abort timimg and bit 7 controls big/little endian.
-*/
+   1) It has eight registers, but only two are defined.
+   2) You can only access its registers with MCR and MRC.
+   3) MMU Register 0 (ID) returns 0x41440110
+   4) Register 1 only has 4 bits defined.  Bits 0 to 3 are unused, bit 4
+      controls 32/26 bit program space, bit 5 controls 32/26 bit data space,
+      bit 6 controls late abort timimg and bit 7 controls big/little endian.  */
 
 static ARMword MMUReg[8];
 
@@ -58,12 +901,17 @@
 {
   MMUReg[1] = state->prog32Sig << 4 |
     state->data32Sig << 5 | state->lateabtSig << 6 | state->bigendSig << 7;
+
   ARMul_ConsolePrint (state, ", MMU present");
-  return (TRUE);
+
+  return TRUE;
 }
 
 static unsigned
-MMUMRC (ARMul_State * state ATTRIBUTE_UNUSED, unsigned type ATTRIBUTE_UNUSED, ARMword instr, ARMword * value)
+MMUMRC (ARMul_State * state ATTRIBUTE_UNUSED,
+	unsigned      type ATTRIBUTE_UNUSED,
+	ARMword       instr,
+	ARMword *     value)
 {
   int reg = BITS (16, 19) & 7;
 
@@ -71,16 +919,20 @@
     *value = 0x41440110;
   else
     *value = MMUReg[reg];
-  return (ARMul_DONE);
+
+  return ARMul_DONE;
 }
 
 static unsigned
-MMUMCR (ARMul_State * state, unsigned type ATTRIBUTE_UNUSED, ARMword instr, ARMword value)
+MMUMCR (ARMul_State * state,
+	unsigned      type ATTRIBUTE_UNUSED,
+	ARMword       instr,
+	ARMword       value)
 {
   int reg = BITS (16, 19) & 7;
 
   MMUReg[reg] = value;
-  
+
   if (reg == 1)
     {
       ARMword p,d,l,b;
@@ -90,22 +942,22 @@
       l = state->lateabtSig;
       b = state->bigendSig;
       
-      state->prog32Sig = value >> 4 & 1;
-      state->data32Sig = value >> 5 & 1;
+      state->prog32Sig  = value >> 4 & 1;
+      state->data32Sig  = value >> 5 & 1;
       state->lateabtSig = value >> 6 & 1;
-      state->bigendSig = value >> 7 & 1;
+      state->bigendSig  = value >> 7 & 1;
 
-      if (p != state->prog32Sig
+      if (   p != state->prog32Sig
 	  || d != state->data32Sig
 	  || l != state->lateabtSig
 	  || b != state->bigendSig)
-	state->Emulate = CHANGEMODE;	/* Force ARMulator to notice these now.  */
+	/* Force ARMulator to notice these now.  */
+	state->Emulate = CHANGEMODE;
     }
-  
+
   return ARMul_DONE;
 }
 
-
 static unsigned
 MMURead (ARMul_State * state ATTRIBUTE_UNUSED, unsigned reg, ARMword * value)
 {
@@ -113,7 +965,8 @@
     *value = 0x41440110;
   else if (reg < 8)
     *value = MMUReg[reg];
-  return (TRUE);
+
+  return TRUE;
 }
 
 static unsigned
@@ -121,7 +974,7 @@
 {
   if (reg < 8)
     MMUReg[reg] = value;
-  
+
   if (reg == 1)
     {
       ARMword p,d,l,b;
@@ -131,126 +984,132 @@
       l = state->lateabtSig;
       b = state->bigendSig;
       
-      state->prog32Sig = value >> 4 & 1;
-      state->data32Sig = value >> 5 & 1;
+      state->prog32Sig  = value >> 4 & 1;
+      state->data32Sig  = value >> 5 & 1;
       state->lateabtSig = value >> 6 & 1;
-      state->bigendSig = value >> 7 & 1;
-
+      state->bigendSig  = value >> 7 & 1;
       
-      if (p != state->prog32Sig
+      if (   p != state->prog32Sig
 	  || d != state->data32Sig
 	  || l != state->lateabtSig
 	  || b != state->bigendSig)
-	state->Emulate = CHANGEMODE;	/* Force ARMulator to notice these now.  */
+	/* Force ARMulator to notice these now.  */	
+	state->Emulate = CHANGEMODE;
     }
-  
+
   return TRUE;
 }
 
 
 /* What follows is the Validation Suite Coprocessor.  It uses two
-co-processor numbers (4 and 5) and has the follwing functionality.
-Sixteen registers.  Both co-processor nuimbers can be used in an MCR and
-MRC to access these registers.  CP 4 can LDC and STC to and from the
-registers.  CP 4 and CP 5 CDP 0 will busy wait for the number of cycles
-specified by a CP register.  CP 5 CDP 1 issues a FIQ after a number of
-cycles (specified in a CP register), CDP 2 issues an IRQW in the same
-way, CDP 3 and 4 turn of the FIQ and IRQ source, and CDP 5 stores a 32
-bit time value in a CP register (actually it's the total number of N, S,
-I, C and F cyles) */
+   co-processor numbers (4 and 5) and has the follwing functionality.
+   Sixteen registers.  Both co-processor nuimbers can be used in an MCR
+   and MRC to access these registers.  CP 4 can LDC and STC to and from
+   the registers.  CP 4 and CP 5 CDP 0 will busy wait for the number of
+   cycles specified by a CP register.  CP 5 CDP 1 issues a FIQ after a
+   number of cycles (specified in a CP register), CDP 2 issues an IRQW
+   in the same way, CDP 3 and 4 turn of the FIQ and IRQ source, and CDP 5
+   stores a 32 bit time value in a CP register (actually it's the total
+   number of N, S, I, C and F cyles).  */
 
 static ARMword ValReg[16];
 
 static unsigned
-ValLDC (ARMul_State * state ATTRIBUTE_UNUSED, unsigned type, ARMword instr, ARMword data)
+ValLDC (ARMul_State * state ATTRIBUTE_UNUSED,
+	unsigned      type,
+	ARMword       instr,
+	ARMword        data)
 {
   static unsigned words;
 
   if (type != ARMul_DATA)
-    {
-      words = 0;
-      return (ARMul_DONE);
-    }
-  if (BIT (22))
-    {				/* it's a long access, get two words */
-      ValReg[BITS (12, 15)] = data;
-      if (words++ == 4)
-	return (ARMul_DONE);
-      else
-	return (ARMul_INC);
-    }
+    words = 0;
   else
-    {				/* get just one word */
+    {
       ValReg[BITS (12, 15)] = data;
-      return (ARMul_DONE);
+
+      if (BIT (22))
+	/* It's a long access, get two words.  */
+	if (words++ != 4)
+	  return ARMul_INC;
     }
+  
+  return ARMul_DONE;
 }
 
 static unsigned
-ValSTC (ARMul_State * state ATTRIBUTE_UNUSED, unsigned type, ARMword instr, ARMword * data)
+ValSTC (ARMul_State * state ATTRIBUTE_UNUSED,
+	unsigned      type,
+	ARMword       instr,
+	ARMword *     data)
 {
   static unsigned words;
 
   if (type != ARMul_DATA)
-    {
-      words = 0;
-      return (ARMul_DONE);
-    }
-  if (BIT (22))
-    {				/* it's a long access, get two words */
-      *data = ValReg[BITS (12, 15)];
-      if (words++ == 4)
-	return (ARMul_DONE);
-      else
-	return (ARMul_INC);
-    }
+    words = 0;
   else
-    {				/* get just one word */
-      *data = ValReg[BITS (12, 15)];
-      return (ARMul_DONE);
+    {
+      * data = ValReg[BITS (12, 15)];
+
+      if (BIT (22))
+	/* It's a long access, get two words.  */
+	if (words++ != 4)
+	  return ARMul_INC;
     }
+
+  return ARMul_DONE;
 }
 
 static unsigned
-ValMRC (ARMul_State * state ATTRIBUTE_UNUSED, unsigned type ATTRIBUTE_UNUSED, ARMword instr, ARMword * value)
+ValMRC (ARMul_State * state ATTRIBUTE_UNUSED,
+	unsigned      type  ATTRIBUTE_UNUSED,
+	ARMword       instr,
+	ARMword *     value)
 {
   *value = ValReg[BITS (16, 19)];
-  return (ARMul_DONE);
+
+  return ARMul_DONE;
 }
 
 static unsigned
-ValMCR (ARMul_State * state ATTRIBUTE_UNUSED, unsigned type ATTRIBUTE_UNUSED, ARMword instr, ARMword value)
+ValMCR (ARMul_State * state ATTRIBUTE_UNUSED,
+	unsigned      type  ATTRIBUTE_UNUSED,
+	ARMword       instr,
+	ARMword       value)
 {
   ValReg[BITS (16, 19)] = value;
-  return (ARMul_DONE);
+
+  return ARMul_DONE;
 }
 
 static unsigned
 ValCDP (ARMul_State * state, unsigned type, ARMword instr)
 {
   static unsigned long finish = 0;
-  ARMword howlong;
 
-  howlong = ValReg[BITS (0, 3)];
-  if (BITS (20, 23) == 0)
+  if (BITS (20, 23) != 0)
+    return ARMul_CANT;
+
+  if (type == ARMul_FIRST)
     {
-      if (type == ARMul_FIRST)
-	{			/* First cycle of a busy wait */
-	  finish = ARMul_Time (state) + howlong;
-	  if (howlong == 0)
-	    return (ARMul_DONE);
-	  else
-	    return (ARMul_BUSY);
-	}
-      else if (type == ARMul_BUSY)
-	{
-	  if (ARMul_Time (state) >= finish)
-	    return (ARMul_DONE);
-	  else
-	    return (ARMul_BUSY);
-	}
+      ARMword howlong;
+      
+      howlong = ValReg[BITS (0, 3)];
+      
+      /* First cycle of a busy wait.  */
+      finish = ARMul_Time (state) + howlong;
+      
+      return howlong == 0 ? ARMul_DONE : ARMul_BUSY;
     }
-  return (ARMul_CANT);
+  else if (type == ARMul_BUSY)
+    {
+      if (ARMul_Time (state) >= finish)
+	return ARMul_DONE;
+      else
+	return ARMul_BUSY;
+    }
+  
+  return ARMul_CANT;
 }
 
 static unsigned
@@ -258,7 +1117,7 @@
 {
   state->NfiqSig = LOW;
   state->Exception++;
-  return (0);
+  return 0;
 }
 
 static unsigned
@@ -266,7 +1125,7 @@
 {
   state->NirqSig = LOW;
   state->Exception++;
-  return (0);
+  return 0;
 }
 
 static unsigned
@@ -276,50 +1135,56 @@
   ARMword howlong;
 
   howlong = ValReg[BITS (0, 3)];
+
   switch ((int) BITS (20, 23))
     {
     case 0:
       if (type == ARMul_FIRST)
-	{			/* First cycle of a busy wait */
+	{
+	  /* First cycle of a busy wait.  */
 	  finish = ARMul_Time (state) + howlong;
-	  if (howlong == 0)
-	    return (ARMul_DONE);
-	  else
-	    return (ARMul_BUSY);
+
+	  return howlong == 0 ? ARMul_DONE : ARMul_BUSY;
 	}
       else if (type == ARMul_BUSY)
 	{
 	  if (ARMul_Time (state) >= finish)
-	    return (ARMul_DONE);
+	    return ARMul_DONE;
 	  else
-	    return (ARMul_BUSY);
+	    return ARMul_BUSY;
 	}
-      return (ARMul_DONE);
+      return ARMul_DONE;
+      
     case 1:
       if (howlong == 0)
 	ARMul_Abort (state, ARMul_FIQV);
       else
 	ARMul_ScheduleEvent (state, howlong, DoAFIQ);
-      return (ARMul_DONE);
+      return ARMul_DONE;
+      
     case 2:
       if (howlong == 0)
 	ARMul_Abort (state, ARMul_IRQV);
       else
 	ARMul_ScheduleEvent (state, howlong, DoAIRQ);
-      return (ARMul_DONE);
+      return ARMul_DONE;
+      
     case 3:
       state->NfiqSig = HIGH;
       state->Exception--;
-      return (ARMul_DONE);
+      return ARMul_DONE;
+      
     case 4:
       state->NirqSig = HIGH;
       state->Exception--;
-      return (ARMul_DONE);
+      return ARMul_DONE;
+      
     case 5:
       ValReg[BITS (0, 3)] = ARMul_Time (state);
-      return (ARMul_DONE);
+      return ARMul_DONE;
     }
-  return (ARMul_CANT);
+  
+  return ARMul_CANT;
 }
 
 /***************************************************************************\
@@ -329,18 +1194,20 @@
 unsigned
 ARMul_CoProInit (ARMul_State * state)
 {
-  register unsigned i;
+  unsigned int i;
 
-  for (i = 0; i < 16; i++)	/* initialise tham all first */
+  /* Initialise tham all first.  */
+  for (i = 0; i < 16; i++)
     ARMul_CoProDetach (state, i);
 
-  /* Install CoPro Instruction handlers here
-     The format is
-     ARMul_CoProAttach(state, CP Number, Init routine, Exit routine
-     LDC routine, STC routine, MRC routine, MCR routine,
-     CDP routine, Read Reg routine, Write Reg routine) ;
-   */
-
+  /* Install CoPro Instruction handlers here.
+     The format is:
+     ARMul_CoProAttach (state, CP Number,
+                        Init routine, Exit routine
+                        LDC routine, STC routine,
+			MRC routine, MCR routine,
+                        CDP routine,
+			Read Reg routine, Write Reg routine).  */
   ARMul_CoProAttach (state, 4, NULL, NULL,
 		     ValLDC, ValSTC, ValMRC, ValMCR, ValCDP, NULL, NULL);
 
@@ -350,13 +1217,28 @@
   ARMul_CoProAttach (state, 15, MMUInit, NULL,
 		     NULL, NULL, MMUMRC, MMUMCR, NULL, MMURead, MMUWrite);
 
+  ARMul_CoProAttach (state, 13, XScale_cp13_init, NULL,
+		     XScale_cp13_LDC, XScale_cp13_STC, XScale_cp13_MRC,
+		     XScale_cp13_MCR, NULL, XScale_cp13_read_reg,
+		     XScale_cp13_write_reg);
+  
+  ARMul_CoProAttach (state, 14, XScale_cp14_init, NULL,
+		     XScale_cp14_LDC, XScale_cp14_STC, XScale_cp14_MRC,
+		     XScale_cp14_MCR, NULL, XScale_cp14_read_reg,
+		     XScale_cp14_write_reg);
+  
+  ARMul_CoProAttach (state, 15, XScale_cp15_init, NULL,
+		     NULL, NULL, XScale_cp15_MRC, XScale_cp15_MCR,
+		     NULL, XScale_cp15_read_reg, XScale_cp15_write_reg);
 
-  /* No handlers below here */
+  /* No handlers below here.  */
 
-  for (i = 0; i < 16; i++)	/* Call all the initialisation routines */
+  /* Call all the initialisation routines.  */
+  for (i = 0; i < 16; i++)
     if (state->CPInit[i])
       (state->CPInit[i]) (state);
-  return (TRUE);
+
+  return TRUE;
 }
 
 /***************************************************************************\
@@ -371,7 +1253,8 @@
   for (i = 0; i < 16; i++)
     if (state->CPExit[i])
       (state->CPExit[i]) (state);
-  for (i = 0; i < 16; i++)	/* Detach all handlers */
+
+  for (i = 0; i < 16; i++)	/* Detach all handlers.  */
     ARMul_CoProDetach (state, i);
 }
 
@@ -380,11 +1263,17 @@
 \***************************************************************************/
 
 void
-ARMul_CoProAttach (ARMul_State * state, unsigned number,
-		   ARMul_CPInits * init, ARMul_CPExits * exit,
-		   ARMul_LDCs * ldc, ARMul_STCs * stc,
-		   ARMul_MRCs * mrc, ARMul_MCRs * mcr, ARMul_CDPs * cdp,
-		   ARMul_CPReads * read, ARMul_CPWrites * write)
+ARMul_CoProAttach (ARMul_State *    state,
+		   unsigned         number,
+		   ARMul_CPInits *  init,
+		   ARMul_CPExits *  exit,
+		   ARMul_LDCs *     ldc,
+		   ARMul_STCs *     stc,
+		   ARMul_MRCs *     mrc,
+		   ARMul_MCRs *     mcr,
+		   ARMul_CDPs *     cdp,
+		   ARMul_CPReads *  read,
+		   ARMul_CPWrites * write)
 {
   if (init != NULL)
     state->CPInit[number] = init;
@@ -412,40 +1301,9 @@
   ARMul_CoProAttach (state, number, NULL, NULL,
 		     NoCoPro4R, NoCoPro4W, NoCoPro4W, NoCoPro4R,
 		     NoCoPro3R, NULL, NULL);
+
   state->CPInit[number] = NULL;
   state->CPExit[number] = NULL;
   state->CPRead[number] = NULL;
   state->CPWrite[number] = NULL;
 }
-
-/***************************************************************************\
-*         There is no CoPro around, so Undefined Instruction trap           *
-\***************************************************************************/
-
-static unsigned
-NoCoPro3R (ARMul_State * state ATTRIBUTE_UNUSED,
-	   unsigned a ATTRIBUTE_UNUSED,
-	   ARMword b ATTRIBUTE_UNUSED)
-{
-  return (ARMul_CANT);
-}
-
-static unsigned
-NoCoPro4R (
-	   ARMul_State * state ATTRIBUTE_UNUSED,
-	   unsigned a ATTRIBUTE_UNUSED,
-	   ARMword b ATTRIBUTE_UNUSED,
-	   ARMword c ATTRIBUTE_UNUSED)
-{
-  return (ARMul_CANT);
-}
-
-static unsigned
-NoCoPro4W (
-	   ARMul_State * state ATTRIBUTE_UNUSED,
-	   unsigned a ATTRIBUTE_UNUSED,
-	   ARMword b ATTRIBUTE_UNUSED,
-	   ARMword * c ATTRIBUTE_UNUSED)
-{
-  return (ARMul_CANT);
-}
diff --git a/sim/arm/armdefs.h b/sim/arm/armdefs.h
index b23f26f..204dc6b 100644
--- a/sim/arm/armdefs.h
+++ b/sim/arm/armdefs.h
@@ -30,6 +30,7 @@
 #endif
 
 typedef unsigned long ARMword;	/* must be 32 bits wide */
+typedef unsigned long long ARMdword;	/* Must be at least 64 bits wide.  */
 typedef struct ARMul_State ARMul_State;
 
 typedef unsigned ARMul_CPInits (ARMul_State * state);
@@ -56,9 +57,13 @@
   unsigned ErrorCode;		/* type of illegal instruction */
   ARMword Reg[16];		/* the current register file */
   ARMword RegBank[7][16];	/* all the registers */
+  /* 40 bit accumulator.  We always keep this 64 bits wide,
+     and move only 40 bits out of it in an MRA insn.  */
+  ARMdword Accumulator;
   ARMword Cpsr;			/* the current psr */
   ARMword Spsr[7];		/* the exception psr's */
   ARMword NFlag, ZFlag, CFlag, VFlag, IFFlags;	/* dummy flags for speed */
+  ARMword SFlag;
 #ifdef MODET
   ARMword TFlag;		/* Thumb state */
 #endif
@@ -123,7 +128,11 @@
 
   const struct Dbg_HostosInterface *hostif;
 
-  int verbose;			/* non-zero means print various messages like the banner */
+  unsigned is_v4;		/* Are we emulating a v4 architecture (or higher) ?  */
+  unsigned is_v5;		/* Are we emulating a v5 architecture ?  */
+  unsigned is_v5e;		/* Are we emulating a v5e architecture ?  */
+  unsigned is_XScale;		/* Are we emulating an XScale architecture ?  */
+  unsigned verbose;		/* Print various messages like the banner */
 };
 
 #define ResetPin NresetSig
@@ -137,7 +146,7 @@
 #define LateAbortPin lateabtSig
 
 /***************************************************************************\
-*                        Types of ARM we know about                         *
+*                        Properties of ARM we know about                    *
 \***************************************************************************/
 
 /* The bitflags */
@@ -146,24 +155,10 @@
 #define ARM_Debug_Prop   0x10
 #define ARM_Isync_Prop   ARM_Debug_Prop
 #define ARM_Lock_Prop    0x20
-
-/* ARM2 family */
-#define ARM2    (ARM_Fix26_Prop)
-#define ARM2as  ARM2
-#define ARM61   ARM2
-#define ARM3    ARM2
-
-#ifdef ARM60			/* previous definition in armopts.h */
-#undef ARM60
-#endif
-
-/* ARM6 family */
-#define ARM6    (ARM_Lock_Prop)
-#define ARM60   ARM6
-#define ARM600  ARM6
-#define ARM610  ARM6
-#define ARM620  ARM6
-
+#define ARM_v4_Prop      0x40
+#define ARM_v5_Prop      0x80
+#define ARM_v5e_Prop     0x100
+#define ARM_XScale_Prop  0x200
 
 /***************************************************************************\
 *                   Macros to extract instruction fields                    *
@@ -226,7 +221,7 @@
 #define ABORTBANK 4
 #define UNDEFBANK 5
 #define DUMMYBANK 6
-#define SYSTEMBANK 7
+#define SYSTEMBANK USERBANK
 
 #define BANK_CAN_ACCESS_SPSR(bank)  \
   ((bank) != USERBANK && (bank) != SYSTEMBANK && (bank) != DUMMYBANK)
diff --git a/sim/arm/armemu.c b/sim/arm/armemu.c
index acbcb75..47dc1b8 100644
--- a/sim/arm/armemu.c
+++ b/sim/arm/armemu.c
@@ -24,6 +24,7 @@
 static ARMword GetDPSRegRHS (ARMul_State * state, ARMword instr);
 static void WriteR15 (ARMul_State * state, ARMword src);
 static void WriteSR15 (ARMul_State * state, ARMword src);
+static void WriteR15Branch (ARMul_State * state, ARMword src);
 static ARMword GetLSRegRHS (ARMul_State * state, ARMword instr);
 static ARMword GetLS7RHS (ARMul_State * state, ARMword instr);
 static unsigned LoadWord (ARMul_State * state, ARMword instr,
@@ -50,6 +51,8 @@
 			    int signextend, int scc);
 static unsigned MultiplyAdd64 (ARMul_State * state, ARMword instr,
 			       int signextend, int scc);
+static void Handle_Load_Double (ARMul_State * state, ARMword instr);
+static void Handle_Store_Double (ARMul_State * state, ARMword instr);
 
 #define LUNSIGNED (0)		/* unsigned operation */
 #define LSIGNED   (1)		/* signed operation */
@@ -105,60 +108,67 @@
   if (StoreHalfWord(state, instr, temp))                \
      LSBase = temp ;
 
-/* load post decrement writeback */
+/* Load post decrement writeback.  */
 #define LHPOSTDOWN()                                    \
 {                                                       \
-  int done = 1 ;                                        \
-  lhs = LHS ;                                           \
-  switch (BITS(5,6)) {                                  \
+  int done = 1;                                        	\
+  lhs = LHS;						\
+  temp = lhs - GetLS7RHS (state, instr);		\
+  							\
+  switch (BITS (5, 6))					\
+    {                                  			\
     case 1: /* H */                                     \
-      if (LoadHalfWord(state,instr,lhs,LUNSIGNED))      \
-         LSBase = lhs - GetLS7RHS(state,instr) ;        \
-      break ;                                           \
+      if (LoadHalfWord (state, instr, lhs, LUNSIGNED))  \
+         LSBase = temp;        				\
+      break;                                           	\
     case 2: /* SB */                                    \
-      if (LoadByte(state,instr,lhs,LSIGNED))            \
-         LSBase = lhs - GetLS7RHS(state,instr) ;        \
-      break ;                                           \
+      if (LoadByte (state, instr, lhs, LSIGNED))        \
+         LSBase = temp;        				\
+      break;                                           	\
     case 3: /* SH */                                    \
-      if (LoadHalfWord(state,instr,lhs,LSIGNED))        \
-         LSBase = lhs - GetLS7RHS(state,instr) ;        \
-      break ;                                           \
-    case 0: /* SWP handled elsewhere */                 \
+      if (LoadHalfWord (state, instr, lhs, LSIGNED))    \
+         LSBase = temp;        				\
+      break;                                           	\
+    case 0: /* SWP handled elsewhere.  */               \
     default:                                            \
-      done = 0 ;                                        \
-      break ;                                           \
+      done = 0;                                        	\
+      break;                                           	\
     }                                                   \
   if (done)                                             \
-     break ;                                            \
+     break;                                            	\
 }
 
-/* load post increment writeback */
+/* Load post increment writeback.  */
 #define LHPOSTUP()                                      \
 {                                                       \
-  int done = 1 ;                                        \
-  lhs = LHS ;                                           \
-  switch (BITS(5,6)) {                                  \
+  int done = 1;                                        	\
+  lhs = LHS;                                           	\
+  temp = lhs + GetLS7RHS (state, instr);		\
+  							\
+  switch (BITS (5, 6))					\
+    {                                  			\
     case 1: /* H */                                     \
-      if (LoadHalfWord(state,instr,lhs,LUNSIGNED))      \
-         LSBase = lhs + GetLS7RHS(state,instr) ;        \
-      break ;                                           \
+      if (LoadHalfWord (state, instr, lhs, LUNSIGNED))  \
+         LSBase = temp;        				\
+      break;                                           	\
     case 2: /* SB */                                    \
-      if (LoadByte(state,instr,lhs,LSIGNED))            \
-         LSBase = lhs + GetLS7RHS(state,instr) ;        \
-      break ;                                           \
+      if (LoadByte (state, instr, lhs, LSIGNED))        \
+         LSBase = temp;        				\
+      break;                                           	\
     case 3: /* SH */                                    \
-      if (LoadHalfWord(state,instr,lhs,LSIGNED))        \
-         LSBase = lhs + GetLS7RHS(state,instr) ;        \
-      break ;                                           \
-    case 0: /* SWP handled elsewhere */                 \
+      if (LoadHalfWord (state, instr, lhs, LSIGNED))    \
+         LSBase = temp;        				\
+      break;                                           	\
+    case 0: /* SWP handled elsewhere.  */               \
     default:                                            \
-      done = 0 ;                                        \
-      break ;                                           \
+      done = 0;                                        	\
+      break;                                           	\
     }                                                   \
   if (done)                                             \
-     break ;                                            \
+     break;                                            	\
 }
 
+
 /* load pre decrement */
 #define LHPREDOWN()                                     \
 {                                                       \
@@ -298,14 +308,7 @@
 
   do
     {				/* just keep going */
-#ifdef MODET
-      if (TFLAG)
-	{
-	  isize = 2;
-	}
-      else
-#endif
-	isize = 4;
+      isize = INSN_SIZE;
       switch (state->NextInstr)
 	{
 	case SEQ:
@@ -406,7 +409,7 @@
 	    }
 	  if (state->Debug)
 	    {
-	      fprintf (stderr, "At %08lx Instr %08lx Mode %02lx\n", pc, instr,
+	      fprintf (stderr, "sim: At %08lx Instr %08lx Mode %02lx\n", pc, instr,
 		       state->Mode);
 	      (void) fgetc (stdin);
 	    }
@@ -434,7 +437,7 @@
 	    {
 	    case t_undefined:
 	      ARMul_UndefInstr (state, instr);	/* This is a Thumb instruction */
-	      break;
+	      goto donext;
 
 	    case t_branch:	/* already processed */
 	      goto donext;
@@ -458,6 +461,30 @@
 	  temp = TRUE;
 	  break;
 	case NV:
+	  if (state->is_v5)
+	    {
+	      if (BITS (25, 27) == 5) /* BLX(1) */
+		{
+		  ARMword dest;
+		  
+		  state->Reg[14] = pc + 4;
+		  
+		  dest = pc + 8 + 1; /* Force entry into Thumb mode.  */
+		  if (BIT (23))
+		    dest += (NEGBRANCH + (BIT (24) << 1));
+		  else
+		    dest += POSBRANCH + (BIT (24) << 1);
+		  
+		  WriteR15Branch (state, dest);
+		  goto donext;
+		}
+	      else if ((instr & 0xFC70F000) == 0xF450F000)
+		/* The PLD instruction.  Ignored.  */
+		goto donext;
+	      else
+		/* UNDEFINED in v5, UNPREDICTABLE in v3, v4, non executed in v1, v2.  */
+		ARMul_UndefInstr (state, instr);
+	    }
 	  temp = FALSE;
 	  break;
 	case EQ:
@@ -512,6 +539,63 @@
 	{			/* if the condition codes don't match, stop here */
 	mainswitch:
 
+	  if (state->is_XScale)
+	    {
+	      if (BIT (20) == 0 && BITS (25, 27) == 0)
+		{
+		  if (BITS (4, 7) == 0xD)
+		    {
+		      /* XScale Load Consecutive insn.  */
+		      ARMword temp = GetLS7RHS (state, instr);
+		      ARMword temp2 = BIT (23) ? LHS + temp : LHS - temp;
+		      ARMword addr = BIT (24) ? temp2 : temp;
+		      
+		      if (BIT (12))
+			ARMul_UndefInstr (state, instr);
+		      else if (addr & 7)
+			/* Alignment violation.  */
+			ARMul_Abort (state, ARMul_DataAbortV);
+		      else
+			{
+			  int wb = BIT (24) && BIT (21);
+			  
+			  state->Reg[BITS (12, 15)] =
+			    ARMul_LoadWordN (state, addr);
+			  state->Reg[BITS (12, 15) + 1] =
+			    ARMul_LoadWordN (state, addr + 4);
+			  if (wb)
+			    LSBase = addr;
+			}
+
+		      goto donext;
+		    }
+		  else if (BITS (4, 7) == 0xF)
+		    {
+		      /* XScale Store Consecutive insn.  */
+		      ARMword temp = GetLS7RHS (state, instr);
+		      ARMword temp2 = BIT (23) ? LHS + temp : LHS - temp;
+		      ARMword addr = BIT (24) ? temp2 : temp;
+
+		      if (BIT (12))
+			ARMul_UndefInstr (state, instr);
+		      else if (addr & 7)
+			/* Alignment violation.  */
+			ARMul_Abort (state, ARMul_DataAbortV);
+		      else
+			{
+			  ARMul_StoreWordN (state, addr,
+					    state->Reg[BITS (12, 15)]);
+			  ARMul_StoreWordN (state, addr + 4,
+					    state->Reg[BITS (12, 15) + 1]);
+
+			  if (BIT (21))
+			    LSBase = addr;
+			}
+
+		      goto donext;
+		    }
+		}
+	    }
 
 	  switch ((int) BITS (20, 27))
 	    {
@@ -528,7 +612,16 @@
 		  SHDOWNWB ();
 		  break;
 		}
-	      /* TODO: CHECK: should 0xD and 0xF generate undefined intruction aborts? */
+	      if (BITS (4, 7) == 0xD)
+		{
+		  Handle_Load_Double (state, instr);
+		  break;
+		}
+	      if (BITS (4, 7) == 0xF)
+		{
+		  Handle_Store_Double (state, instr);
+		  break;
+		}
 #endif
 	      if (BITS (4, 7) == 9)
 		{		/* MUL */
@@ -687,6 +780,16 @@
 		  SHDOWNWB ();
 		  break;
 		}
+	      if (BITS (4, 7) == 0xD)
+		{
+		  Handle_Load_Double (state, instr);
+		  break;
+		}
+	      if (BITS (4, 7) == 0xF)
+		{
+		  Handle_Store_Double (state, instr);
+		  break;
+		}
 #endif
 	      rhs = DPRegRHS;
 	      dest = LHS - rhs;
@@ -765,6 +868,16 @@
 		  SHUPWB ();
 		  break;
 		}
+	      if (BITS (4, 7) == 0xD)
+		{
+		  Handle_Load_Double (state, instr);
+		  break;
+		}
+	      if (BITS (4, 7) == 0xF)
+		{
+		  Handle_Store_Double (state, instr);
+		  break;
+		}
 #endif
 #ifdef MODET
 	      if (BITS (4, 7) == 0x9)
@@ -889,6 +1002,16 @@
 		  SHUPWB ();
 		  break;
 		}
+	      if (BITS (4, 7) == 0xD)
+		{
+		  Handle_Load_Double (state, instr);
+		  break;
+		}
+	      if (BITS (4, 7) == 0xF)
+		{
+		  Handle_Store_Double (state, instr);
+		  break;
+		}
 #endif
 #ifdef MODET
 	      if (BITS (4, 7) == 0x9)
@@ -999,6 +1122,48 @@
 	      break;
 
 	    case 0x10:		/* TST reg and MRS CPSR and SWP word */
+	      if (state->is_v5e)
+		{
+		  if (BIT (4) == 0 && BIT (7) == 1)
+		    {
+		      /* ElSegundo SMLAxy insn.  */
+		      ARMword op1 = state->Reg[BITS (0, 3)];
+		      ARMword op2 = state->Reg[BITS (8, 11)];
+		      ARMword Rn = state->Reg[BITS (12, 15)];
+		      
+		      if (BIT (5))
+			op1 >>= 16;
+		      if (BIT (6))
+			op2 >>= 16;
+		      op1 &= 0xFFFF;
+		      op2 &= 0xFFFF;
+		      if (op1 & 0x8000)
+			op1 -= 65536;
+		      if (op2 & 0x8000)
+			op2 -= 65536;
+		      op1 *= op2;
+		      
+		      if (AddOverflow (op1, Rn, op1 + Rn))
+			SETS;
+		      state->Reg[BITS (16, 19)] = op1 + Rn;
+		      break;
+		    }
+
+		  if (BITS (4, 11) == 5)
+		    {
+		      /* ElSegundo QADD insn.  */
+		      ARMword op1 = state->Reg[BITS (0, 3)];
+		      ARMword op2 = state->Reg[BITS (16, 19)];
+		      ARMword result = op1 + op2;
+		      if (AddOverflow (op1, op2, result))
+			{
+			  result = POS (result) ? 0x80000000 : 0x7fffffff;
+			  SETS;
+			}
+		      state->Reg[BITS (12, 15)] = result;
+		      break;
+		    }
+		}
 #ifdef MODET
 	      if (BITS (4, 11) == 0xB)
 		{
@@ -1006,6 +1171,16 @@
 		  SHPREDOWN ();
 		  break;
 		}
+	      if (BITS (4, 7) == 0xD)
+		{
+		  Handle_Load_Double (state, instr);
+		  break;
+		}
+	      if (BITS (4, 7) == 0xF)
+		{
+		  Handle_Store_Double (state, instr);
+		  break;
+		}
 #endif
 	      if (BITS (4, 11) == 9)
 		{		/* SWP */
@@ -1071,6 +1246,72 @@
 	      break;
 
 	    case 0x12:		/* TEQ reg and MSR reg to CPSR (ARM6) */
+	      if (state->is_v5)
+		{
+		  if (BITS (4, 7) == 3)
+		    {
+		      /* BLX(2) */
+		      ARMword temp;
+
+		      if (TFLAG)
+			temp = (pc + 2) | 1;
+		      else
+			temp = pc + 4;
+
+		      WriteR15Branch (state, state->Reg[RHSReg]);
+		      state->Reg[14] = temp;
+		      break;
+		    }
+		}
+
+	      if (state->is_v5e)
+		{
+		  if (BIT (4) == 0 && BIT (7) == 1
+		      && (BIT (5) == 0 || BITS (12, 15) == 0))
+		    {
+		      /* ElSegundo SMLAWy/SMULWy insn.  */
+		      unsigned long long op1 = state->Reg[BITS (0, 3)];
+		      unsigned long long op2 = state->Reg[BITS (8, 11)];
+		      unsigned long long result;
+
+		      if (BIT (6))
+			op2 >>= 16;
+		      if (op1 & 0x80000000)
+			op1 -= 1ULL << 32;
+		      op2 &= 0xFFFF;
+		      if (op2 & 0x8000)
+			op2 -= 65536;
+		      result = (op1 * op2) >> 16;
+
+		      if (BIT (5) == 0)
+			{
+			  ARMword Rn = state->Reg[BITS (12, 15)];
+			  
+			  if (AddOverflow (result, Rn, result + Rn))
+			    SETS;
+			  result += Rn;
+			}
+		      state->Reg[BITS (16, 19)] = result;
+		      break;
+		    }
+
+		  if (BITS (4, 11) == 5)
+		    {
+		      /* ElSegundo QSUB insn.  */
+		      ARMword op1 = state->Reg[BITS (0, 3)];
+		      ARMword op2 = state->Reg[BITS (16, 19)];
+		      ARMword result = op1 - op2;
+
+		      if (SubOverflow (op1, op2, result))
+			{
+			  result = POS (result) ? 0x80000000 : 0x7fffffff;
+			  SETS;
+			}
+
+		      state->Reg[BITS (12, 15)] = result;
+		      break;
+		    }
+		}
 #ifdef MODET
 	      if (BITS (4, 11) == 0xB)
 		{
@@ -1078,45 +1319,78 @@
 		  SHPREDOWNWB ();
 		  break;
 		}
-#endif
-#ifdef MODET
 	      if (BITS (4, 27) == 0x12FFF1)
-		{		/* BX */
-		  /* Branch to the address in RHSReg. If bit0 of
-		     destination address is 1 then switch to Thumb mode: */
-		  ARMword addr = state->Reg[RHSReg];
-
-		  /* If we read the PC then the bottom bit is clear */
-		  if (RHSReg == 15)
-		    addr &= ~1;
-
-		  /* Enable this for a helpful bit of debugging when
-		     GDB is not yet fully working... 
-		     fprintf (stderr, "BX at %x to %x (go %s)\n",
-		     state->Reg[15], addr, (addr & 1) ? "thumb": "arm" ); */
-
-		  if (addr & (1 << 0))
-		    {		/* Thumb bit */
-		      SETT;
-		      state->Reg[15] = addr & 0xfffffffe;
-		      /* NOTE: The other CPSR flag setting blocks do not
-		         seem to update the state->Cpsr state, but just do
-		         the explicit flag. The copy from the seperate
-		         flags to the register must happen later. */
-		      FLUSHPIPE;
-		    }
-		  else
-		    {
-		      CLEART;
-		      state->Reg[15] = addr & 0xfffffffc;
-		      FLUSHPIPE;
-		    }
+		{
+		  /* BX */
+		  WriteR15Branch (state, state->Reg[RHSReg]);
+		  break;
+		}
+	      if (BITS (4, 7) == 0xD)
+		{
+		  Handle_Load_Double (state, instr);
+		  break;
+		}
+	      if (BITS (4, 7) == 0xF)
+		{
+		  Handle_Store_Double (state, instr);
+		  break;
 		}
 #endif
-	      if (DESTReg == 15 && BITS (17, 18) == 0)
-		{		/* MSR reg to CPSR */
+	      if (state->is_v5)
+		{
+		  if (BITS (4, 7) == 0x7)
+		    {
+		      ARMword value;
+		      extern int SWI_vector_installed;
+
+		      /* Hardware is allowed to optionally override this
+			 instruction and treat it as a breakpoint.  Since
+			 this is a simulator not hardware, we take the position
+			 that if a SWI vector was not installed, then an Abort
+			 vector was probably not installed either, and so
+			 normally this instruction would be ignored, even if an
+			 Abort is generated.  This is a bad thing, since GDB
+			 uses this instruction for its breakpoints (at least in
+			 Thumb mode it does).  So intercept the instruction here
+			 and generate a breakpoint SWI instead.  */
+		      if (! SWI_vector_installed)
+			ARMul_OSHandleSWI (state, SWI_Breakpoint);
+		      else
+		    
+			/* BKPT - normally this will cause an abort, but for the
+			   XScale if bit 31 in register 10 of coprocessor 14 is
+			   clear, then this is treated as a no-op.  */
+			if (state->is_XScale)
+			  {
+			    if (read_cp14_reg (10) & (1UL << 31))
+			      {
+				ARMword value;
+				
+				value = read_cp14_reg (10);
+				value &= ~0x1c;
+				value |= 0xc;
+				
+				write_cp14_reg (10, value);
+				write_cp15_reg (5, 0, 0, 0x200);  /* Set FSR.  */
+				write_cp15_reg (6, 0, 0, pc);     /* Set FAR.  */
+			      }
+			    else
+			      break;
+			  }
+
+		      ARMul_Abort (state, ARMul_PrefetchAbortV);
+		      break;
+		    }
+		}
+	      if (DESTReg == 15)
+		{
+		  /* MSR reg to CPSR */
 		  UNDEF_MSRPC;
 		  temp = DPRegRHS;
+#ifdef MODET
+		  /* Don't allow TBIT to be set by MSR.  */
+		  temp &= ~ TBIT;
+#endif
 		  ARMul_FixCPSR (state, instr, temp);
 		}
 	      else
@@ -1154,6 +1428,60 @@
 	      break;
 
 	    case 0x14:		/* CMP reg and MRS SPSR and SWP byte */
+	      if (state->is_v5e)
+		{
+		  if (BIT (4) == 0 && BIT (7) == 1)
+		    {
+		      /* ElSegundo SMLALxy insn.  */
+		      unsigned long long op1 = state->Reg[BITS (0, 3)];
+		      unsigned long long op2 = state->Reg[BITS (8, 11)];
+		      unsigned long long dest;
+		      unsigned long long result;
+
+		      if (BIT (5))
+			op1 >>= 16;
+		      if (BIT (6))
+			op2 >>= 16;
+		      op1 &= 0xFFFF;
+		      if (op1 & 0x8000)
+			op1 -= 65536;
+		      op2 &= 0xFFFF;
+		      if (op2 & 0x8000)
+			op2 -= 65536;
+
+		      dest = (unsigned long long) state->Reg[BITS (16, 19)] << 32;
+		      dest |= state->Reg[BITS (12, 15)];
+		      dest += op1 * op2;
+		      state->Reg[BITS (12, 15)] = dest;
+		      state->Reg[BITS (16, 19)] = dest >> 32;
+		      break;
+		    }
+
+		  if (BITS (4, 11) == 5)
+		    {
+		      /* ElSegundo QDADD insn.  */
+		      ARMword op1 = state->Reg[BITS (0, 3)];
+		      ARMword op2 = state->Reg[BITS (16, 19)];
+		      ARMword op2d = op2 + op2;
+		      ARMword result;
+
+		      if (AddOverflow (op2, op2, op2d))
+			{
+			  SETS;
+			  op2d = POS (op2d) ? 0x80000000 : 0x7fffffff;
+			}
+
+		      result = op1 + op2d;
+		      if (AddOverflow (op1, op2d, result))
+			{
+			  SETS;
+			  result = POS (result) ? 0x80000000 : 0x7fffffff;
+			}
+
+		      state->Reg[BITS (12, 15)] = result;
+		      break;
+		    }
+		}
 #ifdef MODET
 	      if (BITS (4, 7) == 0xB)
 		{
@@ -1161,6 +1489,16 @@
 		  SHPREDOWN ();
 		  break;
 		}
+	      if (BITS (4, 7) == 0xD)
+		{
+		  Handle_Load_Double (state, instr);
+		  break;
+		}
+	      if (BITS (4, 7) == 0xF)
+		{
+		  Handle_Store_Double (state, instr);
+		  break;
+		}
 #endif
 	      if (BITS (4, 11) == 9)
 		{		/* SWP */
@@ -1233,6 +1571,72 @@
 	      break;
 
 	    case 0x16:		/* CMN reg and MSR reg to SPSR */
+	      if (state->is_v5e)
+		{
+		  if (BIT (4) == 0 && BIT (7) == 1 && BITS (12, 15) == 0)
+		    {
+		      /* ElSegundo SMULxy insn.  */
+		      ARMword op1 = state->Reg[BITS (0, 3)];
+		      ARMword op2 = state->Reg[BITS (8, 11)];
+		      ARMword Rn = state->Reg[BITS (12, 15)];
+
+		      if (BIT (5))
+			op1 >>= 16;
+		      if (BIT (6))
+			op2 >>= 16;
+		      op1 &= 0xFFFF;
+		      op2 &= 0xFFFF;
+		      if (op1 & 0x8000)
+			op1 -= 65536;
+		      if (op2 & 0x8000)
+			op2 -= 65536;
+
+		      state->Reg[BITS (16, 19)] = op1 * op2;
+		      break;
+		    }
+
+		  if (BITS (4, 11) == 5)
+		    {
+		      /* ElSegundo QDSUB insn.  */
+		      ARMword op1 = state->Reg[BITS (0, 3)];
+		      ARMword op2 = state->Reg[BITS (16, 19)];
+		      ARMword op2d = op2 + op2;
+		      ARMword result;
+
+		      if (AddOverflow (op2, op2, op2d))
+			{
+			  SETS;
+			  op2d = POS (op2d) ? 0x80000000 : 0x7fffffff;
+			}
+
+		      result = op1 - op2d;
+		      if (SubOverflow (op1, op2d, result))
+			{
+			  SETS;
+			  result = POS (result) ? 0x80000000 : 0x7fffffff;
+			}
+
+		      state->Reg[BITS (12, 15)] = result;
+		      break;
+		    }
+		}
+
+	      if (state->is_v5)
+		{
+		  if (BITS (4, 11) == 0xF1 && BITS (16, 19) == 0xF)
+		    {
+		      /* ARM5 CLZ insn.  */
+		      ARMword op1 = state->Reg[BITS (0, 3)];
+		      int result = 32;
+
+		      if (op1)
+			for (result = 0; (op1 & 0x80000000) == 0; op1 <<= 1)
+			  result++;
+
+		      state->Reg[BITS (12, 15)] = result;
+		      break;
+		    }
+		}
 #ifdef MODET
 	      if (BITS (4, 7) == 0xB)
 		{
@@ -1240,8 +1644,18 @@
 		  SHPREDOWNWB ();
 		  break;
 		}
+	      if (BITS (4, 7) == 0xD)
+		{
+		  Handle_Load_Double (state, instr);
+		  break;
+		}
+	      if (BITS (4, 7) == 0xF)
+		{
+		  Handle_Store_Double (state, instr);
+		  break;
+		}
 #endif
-	      if (DESTReg == 15 && BITS (17, 18) == 0)
+	      if (DESTReg == 15)
 		{		/* MSR */
 		  UNDEF_MSRPC;
 		  ARMul_FixSPSR (state, instr, DPRegRHS);
@@ -1302,6 +1716,16 @@
 		  SHPREUP ();
 		  break;
 		}
+	      if (BITS (4, 7) == 0xD)
+		{
+		  Handle_Load_Double (state, instr);
+		  break;
+		}
+	      if (BITS (4, 7) == 0xF)
+		{
+		  Handle_Store_Double (state, instr);
+		  break;
+		}
 #endif
 	      rhs = DPRegRHS;
 	      dest = LHS | rhs;
@@ -1330,6 +1754,16 @@
 		  SHPREUPWB ();
 		  break;
 		}
+	      if (BITS (4, 7) == 0xD)
+		{
+		  Handle_Load_Double (state, instr);
+		  break;
+		}
+	      if (BITS (4, 7) == 0xF)
+		{
+		  Handle_Store_Double (state, instr);
+		  break;
+		}
 #endif
 	      dest = DPRegRHS;
 	      WRITEDEST (dest);
@@ -1356,6 +1790,16 @@
 		  SHPREUP ();
 		  break;
 		}
+	      if (BITS (4, 7) == 0xD)
+		{
+		  Handle_Load_Double (state, instr);
+		  break;
+		}
+	      else if (BITS (4, 7) == 0xF)
+		{
+		  Handle_Store_Double (state, instr);
+		  break;
+		}
 #endif
 	      rhs = DPRegRHS;
 	      dest = LHS & ~rhs;
@@ -1384,6 +1828,16 @@
 		  SHPREUPWB ();
 		  break;
 		}
+	      if (BITS (4, 7) == 0xD)
+		{
+		  Handle_Load_Double (state, instr);
+		  break;
+		}
+	      if (BITS (4, 7) == 0xF)
+		{
+		  Handle_Store_Double (state, instr);
+		  break;
+		}
 #endif
 	      dest = ~DPRegRHS;
 	      WRITEDEST (dest);
@@ -1590,7 +2044,7 @@
 	      break;
 
 	    case 0x32:		/* TEQ immed and MSR immed to CPSR */
-	      if (DESTReg == 15 && BITS (17, 18) == 0)
+	      if (DESTReg == 15)
 		{		/* MSR immed to CPSR */
 		  ARMul_FixCPSR (state, instr, DPImmRHS);
 		}
@@ -1655,7 +2109,7 @@
 	      break;
 
 	    case 0x36:		/* CMN immed and MSR immed to SPSR */
-	      if (DESTReg == 15 && BITS (17, 18) == 0)	/* MSR */
+	      if (DESTReg == 15)	/* MSR */
 		ARMul_FixSPSR (state, instr, DPImmRHS);
 	      else
 		{
@@ -1998,8 +2452,9 @@
 	      UNDEF_LSRPCBaseWb;
 	      UNDEF_LSRPCOffWb;
 	      lhs = LHS;
+	      temp = lhs - LSRegRHS;
 	      if (LoadWord (state, instr, lhs))
-		LSBase = lhs - LSRegRHS;
+		LSBase = temp;
 	      break;
 
 	    case 0x62:		/* Store Word, WriteBack, Post Dec, Reg */
@@ -2030,9 +2485,10 @@
 	      UNDEF_LSRPCBaseWb;
 	      UNDEF_LSRPCOffWb;
 	      lhs = LHS;
+	      temp = lhs - LSRegRHS;
 	      state->NtransSig = LOW;
 	      if (LoadWord (state, instr, lhs))
-		LSBase = lhs - LSRegRHS;
+		LSBase = temp;
 	      state->NtransSig = (state->Mode & 3) ? HIGH : LOW;
 	      break;
 
@@ -2062,8 +2518,9 @@
 	      UNDEF_LSRPCBaseWb;
 	      UNDEF_LSRPCOffWb;
 	      lhs = LHS;
+	      temp = lhs - LSRegRHS;
 	      if (LoadByte (state, instr, lhs, LUNSIGNED))
-		LSBase = lhs - LSRegRHS;
+		LSBase = temp;
 	      break;
 
 	    case 0x66:		/* Store Byte, WriteBack, Post Dec, Reg */
@@ -2094,9 +2551,10 @@
 	      UNDEF_LSRPCBaseWb;
 	      UNDEF_LSRPCOffWb;
 	      lhs = LHS;
+	      temp = lhs - LSRegRHS;
 	      state->NtransSig = LOW;
 	      if (LoadByte (state, instr, lhs, LUNSIGNED))
-		LSBase = lhs - LSRegRHS;
+		LSBase = temp;
 	      state->NtransSig = (state->Mode & 3) ? HIGH : LOW;
 	      break;
 
@@ -2126,8 +2584,9 @@
 	      UNDEF_LSRPCBaseWb;
 	      UNDEF_LSRPCOffWb;
 	      lhs = LHS;
+	      temp = lhs + LSRegRHS;
 	      if (LoadWord (state, instr, lhs))
-		LSBase = lhs + LSRegRHS;
+		LSBase = temp;
 	      break;
 
 	    case 0x6a:		/* Store Word, WriteBack, Post Inc, Reg */
@@ -2158,9 +2617,10 @@
 	      UNDEF_LSRPCBaseWb;
 	      UNDEF_LSRPCOffWb;
 	      lhs = LHS;
+	      temp = lhs + LSRegRHS;
 	      state->NtransSig = LOW;
 	      if (LoadWord (state, instr, lhs))
-		LSBase = lhs + LSRegRHS;
+		LSBase = temp;
 	      state->NtransSig = (state->Mode & 3) ? HIGH : LOW;
 	      break;
 
@@ -2190,8 +2650,9 @@
 	      UNDEF_LSRPCBaseWb;
 	      UNDEF_LSRPCOffWb;
 	      lhs = LHS;
+	      temp = lhs + LSRegRHS;
 	      if (LoadByte (state, instr, lhs, LUNSIGNED))
-		LSBase = lhs + LSRegRHS;
+		LSBase = temp;
 	      break;
 
 	    case 0x6e:		/* Store Byte, WriteBack, Post Inc, Reg */
@@ -2222,9 +2683,10 @@
 	      UNDEF_LSRPCBaseWb;
 	      UNDEF_LSRPCOffWb;
 	      lhs = LHS;
+	      temp = lhs + LSRegRHS;
 	      state->NtransSig = LOW;
 	      if (LoadByte (state, instr, lhs, LUNSIGNED))
-		LSBase = lhs + LSRegRHS;
+		LSBase = temp;
 	      state->NtransSig = (state->Mode & 3) ? HIGH : LOW;
 	      break;
 
@@ -2411,7 +2873,7 @@
 		{
 		  /* Check for the special breakpoint opcode.
 		     This value should correspond to the value defined
-		     as ARM_BE_BREAKPOINT in gdb/arm-tdep.c.  */
+		     as ARM_BE_BREAKPOINT in gdb/arm/tm-arm.h.  */
 		  if (BITS (0, 19) == 0xfdefe)
 		    {
 		      if (!ARMul_OSHandleSWI (state, SWI_Breakpoint))
@@ -2660,11 +3122,56 @@
 \***************************************************************************/
 
 	    case 0xc4:
+	      if (state->is_XScale)
+		{
+		  if (BITS (4, 7) != 0x00)
+		    ARMul_UndefInstr (state, instr);
+
+		  if (BITS (8, 11) != 0x00)
+		    ARMul_UndefInstr (state, instr); /* Not CP0.  */
+
+		  /* XScale MAR insn.  Move two registers into accumulator.  */
+		  if (BITS (0, 3) == 0x00)
+		    {
+		      state->Accumulator = state->Reg[BITS (12, 15)];
+		      state->Accumulator += (ARMdword) state->Reg[BITS (16, 19)] << 32;
+		      break;
+		    }
+		  /* Access to any other acc is unpredicatable.  */
+		  break;
+		}
+	      /* Drop through.  */
+	      
 	    case 0xc0:		/* Store , No WriteBack , Post Dec */
 	      ARMul_STC (state, instr, LHS);
 	      break;
 
 	    case 0xc5:
+	      if (state->is_XScale)
+		{
+		  if (BITS (4, 7) != 0x00)
+		    ARMul_UndefInstr (state, instr);
+
+		  if (BITS (8, 11) != 0x00)
+		    ARMul_UndefInstr (state, instr); /* Not CP0.  */
+
+		  /* XScale MRA insn.  Move accumulator into two registers.  */
+		  if (BITS (0, 3) == 0x00)
+		    {
+		      ARMword t1 = (state->Accumulator >> 32) & 255;
+
+		      if (t1 & 128)
+			t1 -= 256;
+
+		      state->Reg[BITS (12, 15)] = state->Accumulator;
+		      state->Reg[BITS (16, 19)] = t1;
+		      break;
+		    }
+		  /* Access to any other acc is unpredicatable.  */
+		  break;
+		}
+	      /* Drop through.  */
+
 	    case 0xc1:		/* Load , No WriteBack , Post Dec */
 	      ARMul_LDC (state, instr, LHS);
 	      break;
@@ -2761,6 +3268,88 @@
 \***************************************************************************/
 
 	    case 0xe2:
+	      if (state->is_XScale)
+		switch (BITS (18, 19))
+		  {
+		  case 0x0:
+		    {
+		      /* XScale MIA instruction.  Signed multiplication of two 32 bit
+			 values and addition to 40 bit accumulator.  */
+		      long long Rm = state->Reg[MULLHSReg];
+		      long long Rs = state->Reg[MULACCReg];
+
+		      if (Rm & (1 << 31))
+			Rm -= 1ULL << 32;
+		      if (Rs & (1 << 31))
+			Rs -= 1ULL << 32;
+		      state->Accumulator += Rm * Rs;
+		    }
+		    goto donext;
+
+		  case 0x2:
+		    {
+		      /* XScale MIAPH instruction.  */
+		      ARMword t1 = state->Reg[MULLHSReg] >> 16;
+		      ARMword t2 = state->Reg[MULACCReg] >> 16;
+		      ARMword t3 = state->Reg[MULLHSReg] & 0xffff;
+		      ARMword t4 = state->Reg[MULACCReg] & 0xffff;
+		      long long t5;
+
+		      if (t1 & (1 << 15))
+			t1 -= 1 << 16;
+		      if (t2 & (1 << 15))
+			t2 -= 1 << 16;
+		      if (t3 & (1 << 15))
+			t3 -= 1 << 16;
+		      if (t4 & (1 << 15))
+			t4 -= 1 << 16;
+		      t1 *= t2;
+		      t5 = t1;
+		      if (t5 & (1 << 31))
+			t5 -= 1ULL << 32;
+		      state->Accumulator += t5;
+		      t3 *= t4;
+		      t5 = t3;
+		      if (t5 & (1 << 31))
+			t5 -= 1ULL << 32;
+		      state->Accumulator += t5;
+		    }
+		    goto donext;
+
+		  case 0x3:
+		    {
+		      /* XScale MIAxy instruction.  */
+		      ARMword t1;
+		      ARMword t2;
+		      long long t5;
+
+		      if (BIT (17))
+			t1 = state->Reg[MULLHSReg] >> 16;
+		      else
+			t1 = state->Reg[MULLHSReg] & 0xffff;
+
+		      if (BIT (16))
+			t2 = state->Reg[MULACCReg] >> 16;
+		      else
+			t2 = state->Reg[MULACCReg] & 0xffff;
+
+		      if (t1 & (1 << 15))
+			t1 -= 1 << 16;
+		      if (t2 & (1 << 15))
+			t2 -= 1 << 16;
+		      t1 *= t2;
+		      t5 = t1;
+		      if (t5 & (1 << 31))
+			t5 -= 1ULL << 32;
+		      state->Accumulator += t5;
+		    }
+		    goto donext;
+
+		  default:
+		    break;
+		  }
+	      /* Drop through.  */
+
 	    case 0xe0:
 	    case 0xe4:
 	    case 0xe6:
@@ -3120,11 +3709,21 @@
 static void
 WriteR15 (ARMul_State * state, ARMword src)
 {
-  /* The ARM documentation implies (but doe snot state) that the bottom bit of the PC is never set */
+  /* The ARM documentation states that the two least significant bits
+     are discarded when setting PC, except in the cases handled by
+     WriteR15Branch() below.  It's probably an oversight: in THUMB
+     mode, the second least significant bit should probably not be
+     discarded.  */
+#ifdef MODET
+  if (TFLAG)
+    src &= 0xfffffffe;
+  else
+#endif
+    src &= 0xfffffffc;
 #ifdef MODE32
-  state->Reg[15] = src & PCBITS & ~0x1;
+  state->Reg[15] = src & PCBITS;
 #else
-  state->Reg[15] = (src & R15PCBITS & ~0x1) | ECC | ER15INT | EMODE;
+  state->Reg[15] = (src & R15PCBITS) | ECC | ER15INT | EMODE;
   ARMul_R15Altered (state);
 #endif
   FLUSHPIPE;
@@ -3138,13 +3737,25 @@
 WriteSR15 (ARMul_State * state, ARMword src)
 {
 #ifdef MODE32
-  state->Reg[15] = src & PCBITS;
   if (state->Bank > 0)
     {
       state->Cpsr = state->Spsr[state->Bank];
       ARMul_CPSRAltered (state);
     }
+#ifdef MODET
+  if (TFLAG)
+    src &= 0xfffffffe;
+  else
+#endif
+    src &= 0xfffffffc;
+  state->Reg[15] = src & PCBITS;
 #else
+#ifdef MODET
+  if (TFLAG)
+    abort (); /* ARMul_R15Altered would have to support it.  */
+  else
+#endif
+    src &= 0xfffffffc;
   if (state->Bank == USERBANK)
     state->Reg[15] = (src & (CCBITS | R15PCBITS)) | ER15INT | EMODE;
   else
@@ -3154,6 +3765,29 @@
   FLUSHPIPE;
 }
 
+/* In machines capable of running in Thumb mode, BX, BLX, LDR and LDM
+   will switch to Thumb mode if the least significant bit is set. */
+
+static void
+WriteR15Branch (ARMul_State * state, ARMword src)
+{
+#ifdef MODET
+  if (src & 1)
+    {		/* Thumb bit */
+      SETT;
+      state->Reg[15] = src & 0xfffffffe;
+    }
+  else
+    {
+      CLEART;
+      state->Reg[15] = src & 0xfffffffc;
+    }
+  FLUSHPIPE;
+#else
+  WriteR15 (state, src);
+#endif
+}
+
 /***************************************************************************\
 * This routine evaluates most Load and Store register RHS's.  It is         *
 * intended to be called from the macro LSRegRHS, which filters the          *
@@ -3241,7 +3875,7 @@
     }
   if (address & 3)
     dest = ARMul_Align (state, address, dest);
-  WRITEDEST (dest);
+  WRITEDESTB (dest);
   ARMul_Icycles (state, 1, 0L);
 
   return (DESTReg != LHSReg);
@@ -3318,6 +3952,220 @@
 }
 
 /***************************************************************************\
+* This function does the work of loading two words for a LDRD instruction. *
+\***************************************************************************/
+
+static void
+Handle_Load_Double (ARMul_State * state, ARMword instr)
+{
+  ARMword dest_reg;
+  ARMword addr_reg;
+  ARMword write_back  = BIT (21);
+  ARMword immediate   = BIT (22);
+  ARMword add_to_base = BIT (23);        
+  ARMword pre_indexed = BIT (24);
+  ARMword offset;
+  ARMword addr;
+  ARMword sum;
+  ARMword base;
+  ARMword value1;
+  ARMword value2;
+  
+  BUSUSEDINCPCS;
+
+  /* If the writeback bit is set, the pre-index bit must be clear.  */
+  if (write_back && ! pre_indexed)
+    {
+      ARMul_UndefInstr (state, instr);
+      return;
+    }
+  
+  /* Extract the base address register.  */
+  addr_reg = LHSReg;
+  
+  /* Extract the destination register and check it.  */
+  dest_reg = DESTReg;
+  
+  /* Destination register must be even.  */
+  if ((dest_reg & 1)
+    /* Destination register cannot be LR.  */
+      || (dest_reg == 14))
+    {
+      ARMul_UndefInstr (state, instr);
+      return;
+    }
+
+  /* Compute the base address.  */
+  base = state->Reg[addr_reg];
+
+  /* Compute the offset.  */
+  offset = immediate ? ((BITS (8, 11) << 4) | BITS (0, 3)) : state->Reg[RHSReg];
+
+  /* Compute the sum of the two.  */
+  if (add_to_base)
+    sum = base + offset;
+  else
+    sum = base - offset;
+  
+  /* If this is a pre-indexed mode use the sum.  */
+  if (pre_indexed)
+    addr = sum;
+  else
+    addr = base;
+
+  /* The address must be aligned on a 8 byte boundary.  */
+  if (addr & 0x7)
+    {
+#ifdef ABORTS
+      ARMul_DATAABORT (addr);
+#else
+      ARMul_UndefInstr (state, instr);
+#endif
+      return;
+    }
+
+  /* For pre indexed or post indexed addressing modes,
+     check that the destination registers do not overlap
+     the address registers.  */
+  if ((! pre_indexed || write_back)
+      && (   addr_reg == dest_reg
+	  || addr_reg == dest_reg + 1))
+    {
+      ARMul_UndefInstr (state, instr);
+      return;
+    }
+
+  /* Load the words.  */
+  value1 = ARMul_LoadWordN (state, addr);
+  value2 = ARMul_LoadWordN (state, addr + 4);
+
+  /* Check for data aborts.  */
+  if (state->Aborted)
+    {
+      TAKEABORT;
+      return;
+    }
+  
+  ARMul_Icycles (state, 2, 0L);
+
+  /* Store the values.  */
+  state->Reg[dest_reg] = value1;
+  state->Reg[dest_reg + 1] = value2;
+  
+  /* Do the post addressing and writeback.  */
+  if (! pre_indexed)
+    addr = sum;
+  
+  if (! pre_indexed || write_back)
+    state->Reg[addr_reg] = addr;
+}
+
+/***************************************************************************\
+* This function does the work of storing two words for a STRD instruction. *
+\***************************************************************************/
+
+static void
+Handle_Store_Double (ARMul_State * state, ARMword instr)
+{
+  ARMword src_reg;
+  ARMword addr_reg;
+  ARMword write_back  = BIT (21);
+  ARMword immediate   = BIT (22);
+  ARMword add_to_base = BIT (23);        
+  ARMword pre_indexed = BIT (24);
+  ARMword offset;
+  ARMword addr;
+  ARMword sum;
+  ARMword base;
+
+  BUSUSEDINCPCS;
+
+  /* If the writeback bit is set, the pre-index bit must be clear.  */
+  if (write_back && ! pre_indexed)
+    {
+      ARMul_UndefInstr (state, instr);
+      return;
+    }
+  
+  /* Extract the base address register.  */
+  addr_reg = LHSReg;
+  
+  /* Base register cannot be PC.  */
+  if (addr_reg == 15)
+    {
+      ARMul_UndefInstr (state, instr);
+      return;
+    }
+  
+  /* Extract the source register.  */
+  src_reg = DESTReg;
+  
+  /* Source register must be even.  */
+  if (src_reg & 1)
+    {
+      ARMul_UndefInstr (state, instr);
+      return;
+    }
+
+  /* Compute the base address.  */
+  base = state->Reg[addr_reg];
+
+  /* Compute the offset.  */
+  offset = immediate ? ((BITS (8, 11) << 4) | BITS (0, 3)) : state->Reg[RHSReg];
+
+  /* Compute the sum of the two.  */
+  if (add_to_base)
+    sum = base + offset;
+  else
+    sum = base - offset;
+  
+  /* If this is a pre-indexed mode use the sum.  */
+  if (pre_indexed)
+    addr = sum;
+  else
+    addr = base;
+
+  /* The address must be aligned on a 8 byte boundary.  */
+  if (addr & 0x7)
+    {
+#ifdef ABORTS
+      ARMul_DATAABORT (addr);
+#else
+      ARMul_UndefInstr (state, instr);
+#endif
+      return;
+    }
+
+  /* For pre indexed or post indexed addressing modes,
+     check that the destination registers do not overlap
+     the address registers.  */
+  if ((! pre_indexed || write_back)
+      && (   addr_reg == src_reg
+	  || addr_reg == src_reg + 1))
+    {
+      ARMul_UndefInstr (state, instr);
+      return;
+    }
+
+  /* Load the words.  */
+  ARMul_StoreWordN (state, addr, state->Reg[src_reg]);
+  ARMul_StoreWordN (state, addr + 4, state->Reg[src_reg + 1]);
+  
+  if (state->Aborted)
+    {
+      TAKEABORT;
+      return;
+    }
+  
+  /* Do the post addressing and writeback.  */
+  if (! pre_indexed)
+    addr = sum;
+  
+  if (! pre_indexed || write_back)
+    state->Reg[addr_reg] = addr;
+}
+
+/***************************************************************************\
 * This function does the work of storing a word from a STR instruction.     *
 \***************************************************************************/
 
@@ -3463,10 +4311,7 @@
 
   if (BIT (15) && !state->Aborted)
     {				/* PC is in the reg list */
-#ifdef MODE32
-      state->Reg[15] = PC;
-#endif
-      FLUSHPIPE;
+      WriteR15Branch(state, PC);
     }
 
   ARMul_Icycles (state, 1, 0L);	/* to write back the final register */
@@ -3538,7 +4383,7 @@
 	  state->Cpsr = GETSPSR (state->Bank);
 	  ARMul_CPSRAltered (state);
 	}
-      state->Reg[15] = PC;
+      WriteR15 (state, PC);
 #else
       if (state->Mode == USER26MODE || state->Mode == USER32MODE)
 	{			/* protect bits in user mode */
@@ -3549,8 +4394,8 @@
 	}
       else
 	ARMul_R15Altered (state);
-#endif
       FLUSHPIPE;
+#endif
     }
 
   if (!BIT (15) && state->Mode != USER26MODE && state->Mode != USER32MODE)
@@ -3815,14 +4660,13 @@
       state->Reg[nRdHi] = RdHi;
     }				/* else undefined result */
   else
-    fprintf (stderr, "MULTIPLY64 - INVALID ARGUMENTS\n");
+    fprintf (stderr, "sim: MULTIPLY64 - INVALID ARGUMENTS\n");
 
   if (scc)
     {
-      if ((RdHi == 0) && (RdLo == 0))
-	ARMul_NegZero (state, RdHi);	/* zero value */
-      else
-	ARMul_NegZero (state, scc);	/* non-zero value */
+      /* Ensure that both RdHi and RdLo are used to compute Z, but
+	 don't let RdLo's sign bit make it to N.  */
+      ARMul_NegZero (state, RdHi | (RdLo >> 16) | (RdLo & 0xFFFF));
     }
 
   /* The cycle count depends on whether the instruction is a signed or
@@ -3871,10 +4715,9 @@
 
   if (scc)
     {
-      if ((RdHi == 0) && (RdLo == 0))
-	ARMul_NegZero (state, RdHi);	/* zero value */
-      else
-	ARMul_NegZero (state, scc);	/* non-zero value */
+      /* Ensure that both RdHi and RdLo are used to compute Z, but
+	 don't let RdLo's sign bit make it to N.  */
+      ARMul_NegZero (state, RdHi | (RdLo >> 16) | (RdLo & 0xFFFF));
     }
 
   return scount + 1;		/* extra cycle for addition */
diff --git a/sim/arm/armemu.h b/sim/arm/armemu.h
index b80c4ef..8fd5f35 100644
--- a/sim/arm/armemu.h
+++ b/sim/arm/armemu.h
@@ -55,6 +55,7 @@
 #define ZBIT (1L << 30)
 #define CBIT (1L << 29)
 #define VBIT (1L << 28)
+#define SBIT (1L << 27)
 #define IBIT (1L << 7)
 #define FBIT (1L << 6)
 #define IFBITS (3L << 6)
@@ -73,6 +74,9 @@
 #define SETT state->TFlag = 1
 #define CLEART state->TFlag = 0
 #define ASSIGNT(res) state->TFlag = res
+#define INSN_SIZE (TFLAG ? 2 : 4)
+#else
+#define INSN_SIZE 4
 #endif
 
 #define NFLAG state->NFlag
@@ -95,6 +99,10 @@
 #define CLEARV state->VFlag = 0
 #define ASSIGNV(res) state->VFlag = res
 
+#define SFLAG state->SFlag
+#define SETS state->SFlag = 1
+#define CLEARS state->SFlag = 0
+#define ASSIGNS(res) state->SFlag = res
 
 #define IFLAG (state->IFFlags >> 1)
 #define FFLAG (state->IFFlags & 1)
@@ -102,7 +110,17 @@
 #define ASSIGNINT(res) state->IFFlags = (((res) >> 6) & 3)
 #define ASSIGNR15INT(res) state->IFFlags = (((res) >> 26) & 3) ;
 
+#define PSR_FBITS (0xff000000L)
+#define PSR_SBITS (0x00ff0000L)
+#define PSR_XBITS (0x0000ff00L)
+#define PSR_CBITS (0x000000ffL)
+
+#if defined MODE32 || defined MODET
+#define CCBITS (0xf8000000L)
+#else
 #define CCBITS (0xf0000000L)
+#endif
+
 #define INTBITS (0xc0L)
 
 #if defined MODET && defined MODE32
@@ -141,7 +159,7 @@
 #define R15PCMODE (state->Reg[15] & (R15PCBITS | R15MODEBITS))
 #define R15MODE (state->Reg[15] & R15MODEBITS)
 
-#define ECC ((NFLAG << 31) | (ZFLAG << 30) | (CFLAG << 29) | (VFLAG << 28))
+#define ECC ((NFLAG << 31) | (ZFLAG << 30) | (CFLAG << 29) | (VFLAG << 28) | (SFLAG << 27))
 #define EINT (IFFLAGS << 6)
 #define ER15INT (IFFLAGS << 26)
 #define EMODE (state->Mode)
@@ -158,10 +176,11 @@
 #define PATCHR15 state->Reg[15] = ECC | ER15INT | EMODE | R15PC
 #endif
 
-#define GETSPSR(bank) bank>0?state->Spsr[bank]:ECC | EINT | EMODE ;
-#define SETPSR(d,s) d = (s) & (ARMword)(CCBITS | INTBITS | MODEBITS)
-#define SETINTMODE(d,s) d = ((d) & CCBITS) | ((s) & (INTBITS | MODEBITS))
-#define SETCC(d,s) d = ((d) & (INTBITS | MODEBITS)) | ((s) & CCBITS)
+#define GETSPSR(bank) (ARMul_GetSPSR (state, EMODE))
+#define SETPSR_F(d,s) d = ((d) & ~PSR_FBITS) | ((s) & PSR_FBITS)
+#define SETPSR_S(d,s) d = ((d) & ~PSR_SBITS) | ((s) & PSR_SBITS)
+#define SETPSR_X(d,s) d = ((d) & ~PSR_XBITS) | ((s) & PSR_XBITS)
+#define SETPSR_C(d,s) d = ((d) & ~PSR_CBITS) | ((s) & PSR_CBITS)
 #define SETR15PSR(s) if (state->Mode == USER26MODE) { \
                         state->Reg[15] = ((s) & CCBITS) | R15PC | ER15INT | EMODE ; \
                         ASSIGNN((state->Reg[15] & NBIT) != 0) ; \
@@ -173,7 +192,13 @@
                         state->Reg[15] = R15PC | ((s) & (CCBITS | R15INTBITS | R15MODEBITS)) ; \
                         ARMul_R15Altered (state) ; \
                         }
-#define SETABORT(i,m) state->Cpsr = ECC | EINT | (i) | (m)
+#define SETABORT(i,m,d) do { \
+  int SETABORT_mode = (m); \
+  ARMul_SetSPSR (state, SETABORT_mode, ARMul_GetCPSR (state)); \
+  ARMul_SetCPSR (state, ((ARMul_GetCPSR (state) & ~(EMODE | TBIT)) \
+			 | (i) | SETABORT_mode)); \
+  state->Reg[14] = temp - (d); \
+} while (0)
 
 #ifndef MODE32
 #define VECTORS 0x20
@@ -215,11 +240,29 @@
 #define RESUME 8
 
 #define NORMALCYCLE state->NextInstr = 0
-#define BUSUSEDN state->NextInstr |= 1	/* the next fetch will be an N cycle */
-#define BUSUSEDINCPCS state->Reg[15] += isize ; /* a standard PC inc and an S cycle */ \
-                      state->NextInstr = (state->NextInstr & 0xff) | 2
-#define BUSUSEDINCPCN state->Reg[15] += isize ; /* a standard PC inc and an N cycle */ \
-                      state->NextInstr |= 3
+#define BUSUSEDN    state->NextInstr |= 1  /* The next fetch will be an N cycle.  */
+#define BUSUSEDINCPCS								\
+  do										\
+    {										\
+      if (! state->is_v4)							\
+        { 									\
+	  state->Reg[15] += isize ; /* A standard PC inc and an S cycle.  */ 	\
+	  state->NextInstr = (state->NextInstr & 0xff) | 2; 			\
+	}									\
+    }										\
+  while (0)
+#define BUSUSEDINCPCN								\
+  do										\
+    {										\
+      if (state->is_v4)								\
+	BUSUSEDN;								\
+      else									\
+	{ 									\
+	  state->Reg[15] += isize ; /* A standard PC inc and an N cycle.  */	\
+	  state->NextInstr |= 3;						\
+	}									\
+    }										\
+  while (0)
 #define INCPC state->Reg[15] += isize ; /* a standard PC inc */ \
               state->NextInstr |= 2
 #define FLUSHPIPE state->NextInstr |= PRIMEPIPE
@@ -326,6 +369,11 @@
                          ARMul_NegZero(state, d) ; \
                          }
 
+#define WRITEDESTB(d) if (DESTReg == 15) \
+                        WriteR15Branch(state, d) ; \
+                     else \
+                          DEST = d
+
 #define BYTETOBUS(data) ((data & 0xff) | \
                         ((data & 0xff) << 8) | \
                         ((data & 0xff) << 16) | \
@@ -342,7 +390,7 @@
 #define STORESMULT(instr,address,wb) StoreSMult(state,instr,address,wb)
 
 #define POSBRANCH ((instr & 0x7fffff) << 2)
-#define NEGBRANCH (0xff000000 | ((instr & 0xffffff) << 2))
+#define NEGBRANCH (0xfc000000 | ((instr & 0xffffff) << 2))
 
 /***************************************************************************\
 *                          Values for Emulate                               *
@@ -434,3 +482,14 @@
 #define UNDEF_IllegalMode
 #define UNDEF_Prog32SigChange
 #define UNDEF_Data32SigChange
+
+/* Coprocessor support functions.  */
+extern unsigned ARMul_CoProInit (ARMul_State *);
+extern void     ARMul_CoProExit (ARMul_State *);
+extern void     ARMul_CoProAttach (ARMul_State *, unsigned, ARMul_CPInits *, ARMul_CPExits *,
+				   ARMul_LDCs *, ARMul_STCs *, ARMul_MRCs *, ARMul_MCRs *,
+				   ARMul_CDPs *, ARMul_CPReads *, ARMul_CPWrites *);
+extern void     ARMul_CoProDetach (ARMul_State *, unsigned);
+extern void     write_cp15_reg (unsigned, unsigned, unsigned, ARMword);
+extern void     write_cp14_reg (unsigned, ARMword);
+extern ARMword  read_cp14_reg  (unsigned);
diff --git a/sim/arm/arminit.c b/sim/arm/arminit.c
index 0105c17..2f6e73d 100644
--- a/sim/arm/arminit.c
+++ b/sim/arm/arminit.c
@@ -85,8 +85,9 @@
     }
   for (i = 0; i < 7; i++)
     state->Spsr[i] = 0;
-  
-  state->Mode = USER26MODE;
+
+  /* state->Mode = USER26MODE;  */
+  state->Mode = USER32MODE;
 
   state->CallDebug = FALSE;
   state->Debug = FALSE;
@@ -113,29 +114,30 @@
   for (i = 0; i < EVENTLISTSIZE; i++)
     *(state->EventPtr + i) = NULL;
 
-#ifdef ARM61
-  state->prog32Sig = LOW;
-  state->data32Sig = LOW;
-#else
   state->prog32Sig = HIGH;
   state->data32Sig = HIGH;
-#endif
 
   state->lateabtSig = LOW;
   state->bigendSig = LOW;
 
+  state->is_v4 = LOW;
+  state->is_v5 = LOW;
+  state->is_v5e = LOW;
+  state->is_XScale = LOW;
+
   ARMul_Reset (state);
-  return (state);
+
+  return state;
 }
 
 /***************************************************************************\
-*       Call this routine to set ARMulator to model a certain processor     *
+  Call this routine to set ARMulator to model certain processor properities
 \***************************************************************************/
 
 void
-ARMul_SelectProcessor (ARMul_State * state, unsigned processor)
+ARMul_SelectProcessor (ARMul_State * state, unsigned properties)
 {
-  if (processor & ARM_Fix26_Prop)
+  if (properties & ARM_Fix26_Prop)
     {
       state->prog32Sig = LOW;
       state->data32Sig = LOW;
@@ -147,6 +149,11 @@
     }
 
   state->lateabtSig = LOW;
+
+  state->is_v4 = (properties & (ARM_v4_Prop | ARM_v5_Prop)) ? HIGH : LOW;
+  state->is_v5 = (properties & ARM_v5_Prop) ? HIGH : LOW;
+  state->is_v5e = (properties & ARM_v5e_Prop) ? HIGH : LOW;
+  state->is_XScale = (properties & ARM_XScale_Prop) ? HIGH : LOW;
 }
 
 /***************************************************************************\
@@ -253,6 +260,9 @@
 ARMul_Abort (ARMul_State * state, ARMword vector)
 {
   ARMword temp;
+  int isize = INSN_SIZE;
+  int esize = (TFLAG ? 0 : 4);
+  int e2size = (TFLAG ? -4 : 0);
 
   state->Aborted = FALSE;
 
@@ -270,53 +280,29 @@
   switch (vector)
     {
     case ARMul_ResetV:		/* RESET */
-      state->Spsr[SVCBANK] = CPSR;
-      SETABORT (INTBITS, state->prog32Sig ? SVC32MODE : SVC26MODE);
-      ARMul_CPSRAltered (state);
-      state->Reg[14] = temp;
+      SETABORT (INTBITS, state->prog32Sig ? SVC32MODE : SVC26MODE, 0);
       break;
     case ARMul_UndefinedInstrV:	/* Undefined Instruction */
-      state->Spsr[state->prog32Sig ? UNDEFBANK : SVCBANK] = CPSR;
-      SETABORT (IBIT, state->prog32Sig ? UNDEF32MODE : SVC26MODE);
-      ARMul_CPSRAltered (state);
-      state->Reg[14] = temp - 4;
+      SETABORT (IBIT, state->prog32Sig ? UNDEF32MODE : SVC26MODE, isize);
       break;
     case ARMul_SWIV:		/* Software Interrupt */
-      state->Spsr[SVCBANK] = CPSR;
-      SETABORT (IBIT, state->prog32Sig ? SVC32MODE : SVC26MODE);
-      ARMul_CPSRAltered (state);
-      state->Reg[14] = temp - 4;
+      SETABORT (IBIT, state->prog32Sig ? SVC32MODE : SVC26MODE, isize);
       break;
     case ARMul_PrefetchAbortV:	/* Prefetch Abort */
       state->AbortAddr = 1;
-      state->Spsr[state->prog32Sig ? ABORTBANK : SVCBANK] = CPSR;
-      SETABORT (IBIT, state->prog32Sig ? ABORT32MODE : SVC26MODE);
-      ARMul_CPSRAltered (state);
-      state->Reg[14] = temp - 4;
+      SETABORT (IBIT, state->prog32Sig ? ABORT32MODE : SVC26MODE, esize);
       break;
     case ARMul_DataAbortV:	/* Data Abort */
-      state->Spsr[state->prog32Sig ? ABORTBANK : SVCBANK] = CPSR;
-      SETABORT (IBIT, state->prog32Sig ? ABORT32MODE : SVC26MODE);
-      ARMul_CPSRAltered (state);
-      state->Reg[14] = temp - 4;	/* the PC must have been incremented */
+      SETABORT (IBIT, state->prog32Sig ? ABORT32MODE : SVC26MODE, e2size);
       break;
     case ARMul_AddrExceptnV:	/* Address Exception */
-      state->Spsr[SVCBANK] = CPSR;
-      SETABORT (IBIT, SVC26MODE);
-      ARMul_CPSRAltered (state);
-      state->Reg[14] = temp - 4;
+      SETABORT (IBIT, SVC26MODE, isize);
       break;
     case ARMul_IRQV:		/* IRQ */
-      state->Spsr[IRQBANK] = CPSR;
-      SETABORT (IBIT, state->prog32Sig ? IRQ32MODE : IRQ26MODE);
-      ARMul_CPSRAltered (state);
-      state->Reg[14] = temp - 4;
+      SETABORT (IBIT, state->prog32Sig ? IRQ32MODE : IRQ26MODE, esize);
       break;
     case ARMul_FIQV:		/* FIQ */
-      state->Spsr[FIQBANK] = CPSR;
-      SETABORT (INTBITS, state->prog32Sig ? FIQ32MODE : FIQ26MODE);
-      ARMul_CPSRAltered (state);
-      state->Reg[14] = temp - 4;
+      SETABORT (INTBITS, state->prog32Sig ? FIQ32MODE : FIQ26MODE, esize);
       break;
     }
   if (ARMul_MODE32BIT)
diff --git a/sim/arm/armos.c b/sim/arm/armos.c
index 958d4cd..dd0ce23 100644
--- a/sim/arm/armos.c
+++ b/sim/arm/armos.c
@@ -16,11 +16,11 @@
     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
 
 /* This file contains a model of Demon, ARM Ltd's Debug Monitor,
-including all the SWI's required to support the C library. The code in
-it is not really for the faint-hearted (especially the abort handling
-code), but it is a complete example. Defining NOOS will disable all the
-fun, and definign VAILDATE will define SWI 1 to enter SVC mode, and SWI
-0x11 to halt the emulator. */
+   including all the SWI's required to support the C library. The code in
+   it is not really for the faint-hearted (especially the abort handling
+   code), but it is a complete example. Defining NOOS will disable all the
+   fun, and definign VAILDATE will define SWI 1 to enter SVC mode, and SWI
+   0x11 to halt the emulator.  */
 
 #include "config.h"
 #include "ansidecl.h"
@@ -70,6 +70,8 @@
 
 #include "armdefs.h"
 #include "armos.h"
+#include "armemu.h"
+
 #ifndef NOOS
 #ifndef VALIDATE
 /* #ifndef ASIM */
@@ -95,9 +97,7 @@
 #endif
 #define UNIQUETEMPS 256
 
-/***************************************************************************\
-*                          OS private Information                           *
-\***************************************************************************/
+/* OS private Information.  */
 
 struct OSblock
 {
@@ -124,23 +124,22 @@
 #endif
 
 static ARMword softvectorcode[] =
-{	/* basic: swi tidyexception + event; mov pc, lr;
-	   ldmia r11,{r11,pc}; swi generateexception  + event.  */
-  0xef000090, 0xe1a0e00f, 0xe89b8800, 0xef000080,	/*Reset */
-  0xef000091, 0xe1a0e00f, 0xe89b8800, 0xef000081,	/*Undef */
-  0xef000092, 0xe1a0e00f, 0xe89b8800, 0xef000082,	/*SWI  */
-  0xef000093, 0xe1a0e00f, 0xe89b8800, 0xef000083,	/*Prefetch abort */
-  0xef000094, 0xe1a0e00f, 0xe89b8800, 0xef000084,	/*Data abort */
-  0xef000095, 0xe1a0e00f, 0xe89b8800, 0xef000085,	/*Address exception */
-  0xef000096, 0xe1a0e00f, 0xe89b8800, 0xef000086, /*IRQ*/
-  0xef000097, 0xe1a0e00f, 0xe89b8800, 0xef000087, /*FIQ*/
-  0xef000098, 0xe1a0e00f, 0xe89b8800, 0xef000088,	/*Error */
-  0xe1a0f00e			/* default handler */
+{
+  /* Basic: swi tidyexception + event; mov pc, lr;
+     ldmia r11,{r11,pc}; swi generateexception  + event.  */
+  0xef000090, 0xe1a0e00f, 0xe89b8800, 0xef000080, /* Reset */
+  0xef000091, 0xe1a0e00f, 0xe89b8800, 0xef000081, /* Undef */
+  0xef000092, 0xe1a0e00f, 0xe89b8800, 0xef000082, /* SWI */
+  0xef000093, 0xe1a0e00f, 0xe89b8800, 0xef000083, /* Prefetch abort */
+  0xef000094, 0xe1a0e00f, 0xe89b8800, 0xef000084, /* Data abort */
+  0xef000095, 0xe1a0e00f, 0xe89b8800, 0xef000085, /* Address exception */
+  0xef000096, 0xe1a0e00f, 0xe89b8800, 0xef000086, /* IRQ */
+  0xef000097, 0xe1a0e00f, 0xe89b8800, 0xef000087, /* FIQ */
+  0xef000098, 0xe1a0e00f, 0xe89b8800, 0xef000088, /* Error */
+  0xe1a0f00e			/* Default handler */
 };
 
-/***************************************************************************\
-*            Time for the Operating System to initialise itself.            *
-\***************************************************************************/
+/* Time for the Operating System to initialise itself.  */
 
 unsigned
 ARMul_OSInit (ARMul_State * state)
@@ -159,6 +158,7 @@
 	  exit (15);
 	}
     }
+  
   OSptr = (struct OSblock *) state->OSptr;
   OSptr->ErrorP = 0;
   state->Reg[13] = ADDRSUPERSTACK;	/* set up a stack for the current mode */
@@ -167,20 +167,26 @@
   ARMul_SetReg (state, UNDEF32MODE, 13, ADDRSUPERSTACK);	/* and for undef 32 mode */
   ARMul_SetReg (state, SYSTEMMODE, 13, ADDRSUPERSTACK);	/* and for system mode */
   instr = 0xe59ff000 | (ADDRSOFTVECTORS - 8);	/* load pc from soft vector */
+  
   for (i = ARMul_ResetV; i <= ARMFIQV; i += 4)
     ARMul_WriteWord (state, i, instr);	/* write hardware vectors */
+  
   for (i = ARMul_ResetV; i <= ARMFIQV + 4; i += 4)
     {
       ARMul_WriteWord (state, ADDRSOFTVECTORS + i, SOFTVECTORCODE + i * 4);
       ARMul_WriteWord (state, ADDRSOFHANDLERS + 2 * i + 4L,
 		       SOFTVECTORCODE + sizeof (softvectorcode) - 4L);
     }
+
   for (i = 0; i < sizeof (softvectorcode); i += 4)
     ARMul_WriteWord (state, SOFTVECTORCODE + i, softvectorcode[i / 4]);
+
   for (i = 0; i < FOPEN_MAX; i++)
     OSptr->FileTable[i] = NULL;
+
   for (i = 0; i < UNIQUETEMPS; i++)
     OSptr->tempnames[i] = NULL;
+
   ARMul_ConsolePrint (state, ", Demon 1.01");
 
 /* #ifndef ASIM */
@@ -188,6 +194,7 @@
   /* install fpe */
   for (i = 0; i < fpesize; i += 4)	/* copy the code */
     ARMul_WriteWord (state, FPESTART + i, fpecode[i >> 2]);
+
   for (i = FPESTART + fpesize;; i -= 4)
     {				/* reverse the error strings */
       if ((j = ARMul_ReadWord (state, i)) == 0xffffffff)
@@ -200,6 +207,7 @@
 	  ARMul_WriteWord (state, i, j);
 	}
     }
+
   ARMul_WriteWord (state, FPEOLDVECT, ARMul_ReadWord (state, 4));	/* copy old illegal instr vector */
   ARMul_WriteWord (state, 4, FPENEWVECT (ARMul_ReadWord (state, i - 4)));	/* install new vector */
   ARMul_ConsolePrint (state, ", FPE");
@@ -208,7 +216,7 @@
 #endif /* VALIDATE */
 #endif /* NOOS */
 
-  return (TRUE);
+  return TRUE;
 }
 
 void
@@ -218,16 +226,15 @@
 }
 
 
-/***************************************************************************\
-*                  Return the last Operating System Error.                  *
-\***************************************************************************/
+/* Return the last Operating System Error.  */
 
 ARMword ARMul_OSLastErrorP (ARMul_State * state)
 {
   return ((struct OSblock *) state->OSptr)->ErrorP;
 }
 
-static int translate_open_mode[] = {
+static int translate_open_mode[] =
+{
   O_RDONLY,			/* "r"   */
   O_RDONLY + O_BINARY,		/* "rb"  */
   O_RDWR,			/* "r+"  */
@@ -259,6 +266,7 @@
 {
   ARMword temp;
   char *cptr = state->CommandLine;
+
   if (cptr == NULL)
     cptr = "\0";
   do
@@ -280,10 +288,10 @@
   for (i = 0; (dummy[i] = ARMul_ReadByte (state, name + i)); i++)
     ;
 
-  /* Now we need to decode the Demon open mode */
+  /* Now we need to decode the Demon open mode.  */
   flags = translate_open_mode[SWIflags];
 
-  /* Filename ":tt" is special: it denotes stdin/out */
+  /* Filename ":tt" is special: it denotes stdin/out.  */
   if (strcmp (dummy, ":tt") == 0)
     {
       if (flags == O_RDONLY)	/* opening tty "r" */
@@ -317,6 +325,7 @@
   if (res > 0)
     for (i = 0; i < res; i++)
       ARMul_WriteByte (state, ptr + i, local[i]);
+
   free (local);
   state->Reg[0] = res == -1 ? -1 : len - res;
   OSptr->ErrorNo = errno;
@@ -343,6 +352,7 @@
   res = write (f, local, len);
   state->Reg[0] = res == -1 ? -1 : len - res;
   free (local);
+
   OSptr->ErrorNo = errno;
 }
 
@@ -367,17 +377,39 @@
   OSptr->ErrorNo = errno;
 }
 
-/***************************************************************************\
-* The emulator calls this routine when a SWI instruction is encuntered. The *
-* parameter passed is the SWI number (lower 24 bits of the instruction).    *
-\***************************************************************************/
+/* The emulator calls this routine when a SWI instruction is encuntered.
+   The parameter passed is the SWI number (lower 24 bits of the instruction).  */
 
 unsigned
 ARMul_OSHandleSWI (ARMul_State * state, ARMword number)
 {
   ARMword addr, temp;
   struct OSblock *OSptr = (struct OSblock *) state->OSptr;
-
+  ARMword saved_number = 0;
+  
+  /* Intel do not want DEMON SWI support.  */
+  if (state->is_XScale)
+    switch (number)
+    {
+    case SWI_Read:
+    case SWI_Write:
+    case SWI_Open:
+    case SWI_Clock:
+    case SWI_Time:
+    case SWI_Close:
+    case SWI_Flen:
+    case SWI_Exit:
+    case SWI_Seek:
+    case SWI_WriteC:
+    case SWI_Write0:
+    case SWI_GetErrno:
+    case SWI_GetEnv:
+      saved_number = number;
+      number = -1;
+    default:
+      break;
+    }
+  
   switch (number)
     {
     case SWI_Read:
@@ -393,23 +425,23 @@
       return TRUE;
 
     case SWI_Clock:
-      /* return number of centi-seconds... */
+      /* Return number of centi-seconds.  */
       state->Reg[0] =
 #ifdef CLOCKS_PER_SEC
 	(CLOCKS_PER_SEC >= 100)
 	? (ARMword) (clock () / (CLOCKS_PER_SEC / 100))
 	: (ARMword) ((clock () * 100) / CLOCKS_PER_SEC);
 #else
-	/* presume unix... clock() returns microseconds */
+	/* Presume unix... clock() returns microseconds.  */
 	(ARMword) (clock () / 10000);
 #endif
       OSptr->ErrorNo = errno;
-      return (TRUE);
+      return TRUE;
 
     case SWI_Time:
       state->Reg[0] = (ARMword) time (NULL);
       OSptr->ErrorNo = errno;
-      return (TRUE);
+      return TRUE;
 
     case SWI_Close:
       state->Reg[0] = close (state->Reg[0]);
@@ -418,7 +450,7 @@
 
     case SWI_Flen:
       SWIflen (state, state->Reg[0]);
-      return (TRUE);
+      return TRUE;
 
     case SWI_Exit:
       state->Emulate = FALSE;
@@ -426,7 +458,7 @@
 
     case SWI_Seek:
       {
-	/* We must return non-zero for failure */
+	/* We must return non-zero for failure.  */
 	state->Reg[0] = -1 >= lseek (state->Reg[0], state->Reg[1], SEEK_SET);
 	OSptr->ErrorNo = errno;
 	return TRUE;
@@ -435,20 +467,15 @@
     case SWI_WriteC:
       (void) fputc ((int) state->Reg[0], stdout);
       OSptr->ErrorNo = errno;
-      return (TRUE);
+      return TRUE;
 
     case SWI_Write0:
       SWIWrite0 (state, state->Reg[0]);
-      return (TRUE);
+      return TRUE;
 
     case SWI_GetErrno:
       state->Reg[0] = OSptr->ErrorNo;
-      return (TRUE);
-
-    case SWI_Breakpoint:
-      state->EndCondition = RDIError_BreakpointReached;
-      state->Emulate = FALSE;
-      return (TRUE);
+      return TRUE;
 
     case SWI_GetEnv:
       state->Reg[0] = ADDRCMDLINE;
@@ -458,17 +485,22 @@
 	state->Reg[1] = ADDRUSERSTACK;
 
       WriteCommandLineTo (state, state->Reg[0]);
-      return (TRUE);
+      return TRUE;
 
-      /* Handle Angel SWIs as well as Demon ones */
+    case SWI_Breakpoint:
+      state->EndCondition = RDIError_BreakpointReached;
+      state->Emulate = FALSE;
+      return TRUE;
+
+      /* Handle Angel SWIs as well as Demon ones.  */
     case AngelSWI_ARM:
     case AngelSWI_Thumb:
-      /* R1 is almost always a parameter block */
+      /* R1 is almost always a parameter block.  */
       addr = state->Reg[1];
-      /* R0 is a reason code */
+      /* R0 is a reason code.  */
       switch (state->Reg[0])
 	{
-	  /* Unimplemented reason codes */
+	  /* Unimplemented reason codes.  */
 	case AngelSWI_Reason_ReadC:
 	case AngelSWI_Reason_IsTTY:
 	case AngelSWI_Reason_TmpNam:
@@ -478,61 +510,61 @@
 	case AngelSWI_Reason_EnterSVC:
 	default:
 	  state->Emulate = FALSE;
-	  return (FALSE);
+	  return FALSE;
 
 	case AngelSWI_Reason_Clock:
-	  /* return number of centi-seconds... */
+	  /* Return number of centi-seconds.  */
 	  state->Reg[0] =
 #ifdef CLOCKS_PER_SEC
 	    (CLOCKS_PER_SEC >= 100)
 	    ? (ARMword) (clock () / (CLOCKS_PER_SEC / 100))
 	    : (ARMword) ((clock () * 100) / CLOCKS_PER_SEC);
 #else
-	    /* presume unix... clock() returns microseconds */
+	    /* Presume unix... clock() returns microseconds.  */
 	    (ARMword) (clock () / 10000);
 #endif
 	  OSptr->ErrorNo = errno;
-	  return (TRUE);
+	  return TRUE;
 
 	case AngelSWI_Reason_Time:
 	  state->Reg[0] = (ARMword) time (NULL);
 	  OSptr->ErrorNo = errno;
-	  return (TRUE);
+	  return TRUE;
 
 	case AngelSWI_Reason_WriteC:
 	  (void) fputc ((int) ARMul_ReadByte (state, addr), stdout);
 	  OSptr->ErrorNo = errno;
-	  return (TRUE);
+	  return TRUE;
 
 	case AngelSWI_Reason_Write0:
 	  SWIWrite0 (state, addr);
-	  return (TRUE);
+	  return TRUE;
 
 	case AngelSWI_Reason_Close:
 	  state->Reg[0] = close (ARMul_ReadWord (state, addr));
 	  OSptr->ErrorNo = errno;
-	  return (TRUE);
+	  return TRUE;
 
 	case AngelSWI_Reason_Seek:
 	  state->Reg[0] = -1 >= lseek (ARMul_ReadWord (state, addr),
 				       ARMul_ReadWord (state, addr + 4),
 				       SEEK_SET);
 	  OSptr->ErrorNo = errno;
-	  return (TRUE);
+	  return TRUE;
 
 	case AngelSWI_Reason_FLen:
 	  SWIflen (state, ARMul_ReadWord (state, addr));
-	  return (TRUE);
+	  return TRUE;
 
 	case AngelSWI_Reason_GetCmdLine:
 	  WriteCommandLineTo (state, ARMul_ReadWord (state, addr));
-	  return (TRUE);
+	  return TRUE;
 
 	case AngelSWI_Reason_HeapInfo:
-	  /* R1 is a pointer to a pointer */
+	  /* R1 is a pointer to a pointer.  */
 	  addr = ARMul_ReadWord (state, addr);
 
-	  /* Pick up the right memory limit */
+	  /* Pick up the right memory limit.  */
 	  if (state->MemSize)
 	    temp = state->MemSize;
 	  else
@@ -542,7 +574,7 @@
 	  ARMul_WriteWord (state, addr + 4, temp);	/* Heap limit */
 	  ARMul_WriteWord (state, addr + 8, temp);	/* Stack base */
 	  ARMul_WriteWord (state, addr + 12, temp);	/* Stack limit */
-	  return (TRUE);
+	  return TRUE;
 
 	case AngelSWI_Reason_ReportException:
 	  if (state->Reg[1] == ADP_Stopped_ApplicationExit)
@@ -555,16 +587,16 @@
 	case ADP_Stopped_ApplicationExit:
 	  state->Reg[0] = 0;
 	  state->Emulate = FALSE;
-	  return (TRUE);
+	  return TRUE;
 
 	case ADP_Stopped_RunTimeError:
 	  state->Reg[0] = -1;
 	  state->Emulate = FALSE;
-	  return (TRUE);
+	  return TRUE;
 
 	case AngelSWI_Reason_Errno:
 	  state->Reg[0] = OSptr->ErrorNo;
-	  return (TRUE);
+	  return TRUE;
 
 	case AngelSWI_Reason_Open:
 	  SWIopen (state,
@@ -587,29 +619,61 @@
 	  return TRUE;
 	}
 
+    case 0x90:
+    case 0x91:
+    case 0x92:
+      /* These are used by the FPE code.  */
+      return TRUE;
+      
     default:
-      state->Emulate = FALSE;
-      return (FALSE);
+      {
+	/* If there is a SWI vector installed use it.  */
+	extern int SWI_vector_installed;
+
+	if (state->is_XScale && saved_number != -1)
+	  number = saved_number;
+	    
+	if (SWI_vector_installed && number != SWI_Breakpoint)
+	  {
+	    ARMword cpsr;
+	    ARMword i_size;
+	    
+	    cpsr = ARMul_GetCPSR (state);
+	    i_size = INSN_SIZE;
+	    
+	    ARMul_SetSPSR (state, SVC32MODE, cpsr);
+	    
+	    cpsr &= ~0xbf;
+	    cpsr |= SVC32MODE | 0x80;
+	    ARMul_SetCPSR (state, cpsr);
+	    
+	    state->RegBank[SVCBANK][14] = state->Reg[14] = state->Reg[15] - i_size;
+	    state->NextInstr            = RESUME;
+	    state->Reg[15]              = state->pc = ARMSWIV;
+	    FLUSHPIPE;
+	  }
+	else
+	  fprintf (stderr, "unknown SWI encountered - %x - ignoring\n", number);
+	return TRUE;
+      }
     }
 }
 
 #ifndef NOOS
 #ifndef ASIM
 
-/***************************************************************************\
-* The emulator calls this routine when an Exception occurs.  The second     *
-* parameter is the address of the relevant exception vector.  Returning     *
-* FALSE from this routine causes the trap to be taken, TRUE causes it to    *
-* be ignored (so set state->Emulate to FALSE!).                             *
-\***************************************************************************/
+/* The emulator calls this routine when an Exception occurs.  The second
+   parameter is the address of the relevant exception vector.  Returning
+   FALSE from this routine causes the trap to be taken, TRUE causes it to
+   be ignored (so set state->Emulate to FALSE!).  */
 
 unsigned
-ARMul_OSException (ARMul_State * state ATTRIBUTE_UNUSED, ARMword vector ATTRIBUTE_UNUSED, ARMword pc ATTRIBUTE_UNUSED)
-{				/* don't use this here */
-  return (FALSE);
+ARMul_OSException (ARMul_State * state  ATTRIBUTE_UNUSED,
+		   ARMword       vector ATTRIBUTE_UNUSED,
+		   ARMword       pc     ATTRIBUTE_UNUSED)
+{
+  return FALSE;
 }
 
 #endif
-
-
 #endif /* NOOS */
diff --git a/sim/arm/armrdi.c b/sim/arm/armrdi.c
index a42b310..14904e3 100644
--- a/sim/arm/armrdi.c
+++ b/sim/arm/armrdi.c
@@ -180,22 +180,23 @@
 typedef struct
 {
   char name[16];
-  unsigned val;
+  unsigned properties;
 }
 Processor;
 
-Processor const p_arm2 = { "ARM2", ARM2 };
-Processor const p_arm2as = { "ARM2AS", ARM2as };
-Processor const p_arm61 = { "ARM61", ARM61 };
-Processor const p_arm3 = { "ARM3", ARM3 };
-Processor const p_arm6 = { "ARM6", ARM6 };
-Processor const p_arm60 = { "ARM60", ARM60 };
-Processor const p_arm600 = { "ARM600", ARM600 };
-Processor const p_arm610 = { "ARM610", ARM610 };
-Processor const p_arm620 = { "ARM620", ARM620 };
-Processor const p_unknown = { "", UNKNOWNPROC };
+Processor const p_arm2 =    { "ARM2",   ARM_Fix26_Prop };
+Processor const p_arm2as =  { "ARM2AS", ARM_Fix26_Prop };
+Processor const p_arm61 =   { "ARM61",  ARM_Fix26_Prop };
+Processor const p_arm3 =    { "ARM3",   ARM_Fix26_Prop };
+Processor const p_arm6 =    { "ARM6",   ARM_Lock_Prop };
+Processor const p_arm60 =   {  "ARM60", ARM_Lock_Prop };
+Processor const p_arm600 =  { "ARM600", ARM_Lock_Prop };
+Processor const p_arm610 =  { "ARM610", ARM_Lock_Prop };
+Processor const p_arm620 =  { "ARM620", ARM_Lock_Prop };
+Processor const p_unknown = { "",       0 };
 
-Processor const *const processors[] = {
+Processor const *const processors[] =
+{
   &p_arm6,			/* default: must come first */
   &p_arm2,
   &p_arm2as,
diff --git a/sim/arm/armsupp.c b/sim/arm/armsupp.c
index 5c18ddd..2d0390d 100644
--- a/sim/arm/armsupp.c
+++ b/sim/arm/armsupp.c
@@ -183,7 +183,7 @@
 ARMword
 ARMul_GetCPSR (ARMul_State * state)
 {
-  return (CPSR);
+  return (CPSR | state->Cpsr);
 }
 
 /***************************************************************************\
@@ -193,8 +193,7 @@
 void
 ARMul_SetCPSR (ARMul_State * state, ARMword value)
 {
-  state->Cpsr = CPSR;
-  SETPSR (state->Cpsr, value);
+  state->Cpsr = value;
   ARMul_CPSRAltered (state);
 }
 
@@ -206,23 +205,18 @@
 void
 ARMul_FixCPSR (ARMul_State * state, ARMword instr, ARMword rhs)
 {
-  state->Cpsr = CPSR;
-  if (state->Bank == USERBANK)
-    {				/* Only write flags in user mode */
-      if (BIT (19))
-	{
-	  SETCC (state->Cpsr, rhs);
-	}
+  state->Cpsr = ARMul_GetCPSR (state);
+  if (state->Bank != USERBANK)
+    {				/* In user mode, only write flags */
+      if (BIT (16))
+	SETPSR_C (state->Cpsr, rhs);
+      if (BIT (17))
+	SETPSR_X (state->Cpsr, rhs);
+      if (BIT (18))
+	SETPSR_S (state->Cpsr, rhs);
     }
-  else
-    {				/* Not a user mode */
-      if (BITS (16, 19) == 9)
-	SETPSR (state->Cpsr, rhs);
-      else if (BIT (16))
-	SETINTMODE (state->Cpsr, rhs);
-      else if (BIT (19))
-	SETCC (state->Cpsr, rhs);
-    }
+  if (BIT (19))
+    SETPSR_F (state->Cpsr, rhs);
   ARMul_CPSRAltered (state);
 }
 
@@ -236,7 +230,7 @@
   ARMword bank = ModeToBank (mode & MODEBITS);
 
   if (! BANK_CAN_ACCESS_SPSR (bank))
-    return CPSR;
+    return ARMul_GetCPSR (state);
 
   return state->Spsr[bank];
 }
@@ -263,12 +257,14 @@
 {
   if (BANK_CAN_ACCESS_SPSR (state->Bank))
     {
-      if (BITS (16, 19) == 9)
-	SETPSR (state->Spsr[state->Bank], rhs);
-      else if (BIT (16))
-	SETINTMODE (state->Spsr[state->Bank], rhs);
-      else if (BIT (19))
-	SETCC (state->Spsr[state->Bank], rhs);
+      if (BIT (16))
+	SETPSR_C (state->Spsr[state->Bank], rhs);
+      if (BIT (17))
+	SETPSR_X (state->Spsr[state->Bank], rhs);
+      if (BIT (18))
+	SETPSR_S (state->Spsr[state->Bank], rhs);
+      if (BIT (19))
+	SETPSR_F (state->Spsr[state->Bank], rhs);
     }
 }
 
@@ -294,14 +290,23 @@
       
       state->NtransSig = (state->Mode & 3) ? HIGH : LOW;
     }
+  state->Cpsr &= ~MODEBITS;
 
   ASSIGNINT (state->Cpsr & INTBITS);
+  state->Cpsr &= ~INTBITS;
   ASSIGNN ((state->Cpsr & NBIT) != 0);
+  state->Cpsr &= ~NBIT;
   ASSIGNZ ((state->Cpsr & ZBIT) != 0);
+  state->Cpsr &= ~ZBIT;
   ASSIGNC ((state->Cpsr & CBIT) != 0);
+  state->Cpsr &= ~CBIT;
   ASSIGNV ((state->Cpsr & VBIT) != 0);
+  state->Cpsr &= ~VBIT;
+  ASSIGNS ((state->Cpsr & SBIT) != 0);
+  state->Cpsr &= ~SBIT;
 #ifdef MODET
   ASSIGNT ((state->Cpsr & TBIT) != 0);
+  state->Cpsr &= ~TBIT;
 #endif
 
   if (oldmode > SVC26MODE)
@@ -369,10 +374,6 @@
     {				/* really need to do it */
       switch (oldbank)
 	{			/* save away the old registers */
-	case SYSTEMBANK:
-	  /* The System mode uses the USER bank.  */
-	  oldbank = USERBANK;
-	  /* Fall through.  */
 	case USERBANK:
 	case IRQBANK:
 	case SVCBANK:
@@ -398,9 +399,6 @@
       
       switch (newbank)
 	{			/* restore the new registers */
-	case SYSTEMBANK:
-	  newbank = USERBANK;
-	  /* Fall through.  */
 	case USERBANK:
 	case IRQBANK:
 	case SVCBANK:
diff --git a/sim/arm/armvirt.c b/sim/arm/armvirt.c
index 38f0083..f9ac453 100644
--- a/sim/arm/armvirt.c
+++ b/sim/arm/armvirt.c
@@ -32,7 +32,7 @@
 #define ABORTS 1
 #endif
 
-#define ABORTS
+/* #define ABORTS */
 
 #ifdef ABORTS			/* the memory system will abort */
 /* For the old test suite Abort between 32 Kbytes and 32 Mbytes
diff --git a/sim/arm/thumbemu.c b/sim/arm/thumbemu.c
index dc90dd7..3351c2f 100644
--- a/sim/arm/thumbemu.c
+++ b/sim/arm/thumbemu.c
@@ -209,11 +209,19 @@
 	      *ainstr = 0xE12FFF10	/* base */
 		| ((tinstr & 0x0078) >> 3);	/* Rd */
 	      break;
+	    case 0xE:		/* UNDEFINED */
+	    case 0xF:		/* UNDEFINED */
+	      if (state->is_v5)
+		{
+		  /* BLX Rs; BLX Hs */
+		  *ainstr = 0xE12FFF30	/* base */
+		    | ((tinstr & 0x0078) >> 3);	/* Rd */
+		  break;
+		}
+	      /* Drop through.  */
 	    case 0x0:		/* UNDEFINED */
 	    case 0x4:		/* UNDEFINED */
 	    case 0x8:		/* UNDEFINED */
-	    case 0xE:		/* UNDEFINED */
-	    case 0xF:		/* UNDEFINED */
 	      valid = t_undefined;
 	      break;
 	    }
@@ -322,30 +330,48 @@
       break;
     case 22:
     case 23:
-      if ((tinstr & 0x0F00) == 0x0000)
+      switch (tinstr & 0x0F00)
 	{
+	case 0x0000:
 	  /* Format 13 */
 	  /* NOTE: The instruction contains a shift left of 2
-	     equivalent (implemented as ROR #30): */
+	     equivalent (implemented as ROR #30):  */
 	  *ainstr = ((tinstr & (1 << 7))	/* base */
 		     ? 0xE24DDF00	/* SUB */
 		     : 0xE28DDF00)	/* ADD */
 	    | (tinstr & 0x007F);	/* off7 */
-	}
-      else if ((tinstr & 0x0F00) == 0x0e00)
-	*ainstr = 0xEF000000 | SWI_Breakpoint;
-      else
-	{
-	  /* Format 14 */
-	  ARMword subset[4] = {
-	    0xE92D0000,		/* STMDB sp!,{rlist}    */
-	    0xE92D4000,		/* STMDB sp!,{rlist,lr} */
-	    0xE8BD0000,		/* LDMIA sp!,{rlist}    */
-	    0xE8BD8000		/* LDMIA sp!,{rlist,pc} */
-	  };
-	  *ainstr = subset[((tinstr & (1 << 11)) >> 10)
-			   | ((tinstr & (1 << 8)) >> 8)]	/* base */
-	    | (tinstr & 0x00FF);	/* mask8 */
+	  break;
+	case 0x0400:
+	  /* Format 14 - Push */
+	  * ainstr = 0xE92D0000 | (tinstr & 0x00FF);
+	  break;
+	case 0x0500:
+	  /* Format 14 - Push + LR */
+	  * ainstr = 0xE92D4000 | (tinstr & 0x00FF);
+	  break;
+	case 0x0c00:
+	  /* Format 14 - Pop */
+	  * ainstr = 0xE8BD0000 | (tinstr & 0x00FF);
+	  break;
+	case 0x0d00:
+	  /* Format 14 - Pop + PC */
+	  * ainstr = 0xE8BD8000 | (tinstr & 0x00FF);
+	  break;
+	case 0x0e00:
+	  if (state->is_v5)
+	    {
+	      /* This is normally an undefined instruction.  The v5t architecture 
+		 defines this particular pattern as a BKPT instruction, for
+		 hardware assisted debugging.  We map onto the arm BKPT
+		 instruction.  */
+	      * ainstr = 0xE1200070 | ((tinstr & 0xf0) << 4) | (tinstr & 0xf);
+	      break;
+	    }
+	  /* Drop through.  */
+	default:
+	  /* Everything else is an undefined instruction.  */
+	  valid = t_undefined;
+	  break;
 	}
       break;
     case 24:			/* STMIA */
@@ -446,6 +472,34 @@
       valid = t_branch;
       break;
     case 29:			/* UNDEFINED */
+      if (state->is_v5)
+	{
+	  if (tinstr & 1)
+	    {
+	      valid = t_undefined;
+	      break;
+	    }
+	  /* Drop through.  */
+	  
+	do_blx2:			/* BLX instruction 2 */
+	  /* Format 19 */
+	  /* There is no single ARM instruction equivalent for this
+	     instruction. Also, it should only ever be matched with the
+	     fmt19 "BL/BLX instruction 1" instruction.  However, we do
+	     allow the simulation of it on its own, with undefined results
+	     if r14 is not suitably initialised.  */
+	  {
+	    ARMword tmp = (pc + 2);
+	    
+	    state->Reg[15] = ((state->Reg[14] + ((tinstr & 0x07FF) << 1))
+			      & 0xFFFFFFFC);
+	    CLEART;
+	    state->Reg[14] = (tmp | 1);
+	    valid = t_branch;
+	    FLUSHPIPE;
+	    break;
+	  }
+	}
       valid = t_undefined;
       break;
     case 30:			/* BL instruction 1 */
@@ -461,7 +515,14 @@
       valid = t_branch;		/* in-case we don't have the 2nd half */
       tinstr = next_instr;	/* move the instruction down */
       if (((tinstr & 0xF800) >> 11) != 31)
-	break;			/* exit, since not correct instruction */
+	{
+	  if (((tinstr & 0xF800) >> 11) == 29)
+	    {
+	      pc += 2;
+	      goto do_blx2;
+	    }
+	  break;		/* exit, since not correct instruction */
+	}
       /* else we fall through to process the second half of the BL */
       pc += 2;			/* point the pc at the 2nd half */
     case 31:			/* BL instruction 2 */
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index 8fca85d..f6c4b05 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -1,5 +1,5 @@
 /* run front end support for arm
-   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
 
 This file is part of ARM SIM.
 
@@ -114,6 +114,8 @@
   return 0;
 }
 
+int SWI_vector_installed = FALSE;
+
 int
 sim_write (sd, addr, buffer, size)
      SIM_DESC sd ATTRIBUTE_UNUSED;
@@ -122,11 +124,15 @@
      int size;
 {
   int i;
+
   init ();
+
+  if ((addr <= 0x8) && ((addr + size) >= 0x8))
+    SWI_vector_installed = TRUE;
+
   for (i = 0; i < size; i++)
-    {
-      ARMul_WriteByte (state, addr + i, buffer[i]);
-    }
+    ARMul_WriteByte (state, addr + i, buffer[i]);
+
   return size;
 }
 
@@ -198,6 +204,7 @@
      char **env;
 {
   int argvlen = 0;
+  int mach;
   char **arg;
 
   if (abfd != NULL)
@@ -205,12 +212,56 @@
   else
     ARMul_SetPC (state, 0);	/* ??? */
 
-  /* We explicitly select a processor capable of supporting the ARM
-     32bit mode.  JGS  */
-  ARMul_SelectProcessor (state, ARM600);
-  /* And then we force the simulated CPU into the 32bit User mode.  */
-  ARMul_SetCPSR (state, USER32MODE);
+  mach = bfd_get_mach (abfd);
 
+  switch (mach)
+    {
+    default:
+      (*sim_callback->printf_filtered) (sim_callback,
+					"Unknown machine type; please update sim_create_inferior.\n");
+      /* fall through */
+
+    case 0:
+      /* We wouldn't set the machine type with earlier toolchains, so we
+	 explicitly select a processor capable of supporting all ARMs in
+	 32bit mode.  */
+    case bfd_mach_arm_5:
+    case bfd_mach_arm_5T:
+      ARMul_SelectProcessor (state, ARM_v5_Prop);
+      break;
+
+    case bfd_mach_arm_5TE:
+      ARMul_SelectProcessor (state, ARM_v5_Prop | ARM_v5e_Prop);
+      break;
+
+    case bfd_mach_arm_XScale:
+      ARMul_SelectProcessor (state, ARM_v5_Prop | ARM_v5e_Prop | ARM_XScale_Prop);
+      break;
+
+    case bfd_mach_arm_4:
+    case bfd_mach_arm_4T:
+      ARMul_SelectProcessor (state, ARM_v4_Prop);
+      break;
+
+    case bfd_mach_arm_3:
+    case bfd_mach_arm_3M:
+      ARMul_SelectProcessor (state, ARM_Lock_Prop);
+      break;
+
+    case bfd_mach_arm_2:
+    case bfd_mach_arm_2a:
+      ARMul_SelectProcessor (state, ARM_Fix26_Prop);
+      break;
+    }
+
+  if (mach > 3)
+    {
+      /* Reset mode to ARM.  A gdb user may rerun a program that had entered
+	 THUMB mode from the start and cause the ARM-mode startup code to be
+	 executed in THUMB mode. */
+      ARMul_SetCPSR (state, USER32MODE);
+    }
+  
   if (argv != NULL)
     {
       /*
@@ -318,6 +369,7 @@
      int length ATTRIBUTE_UNUSED;
 {
   init ();
+
   if (rn == 25)
     {
       state->Cpsr = frommem (state, memory);
@@ -338,6 +390,7 @@
   ARMword regval;
 
   init ();
+
   if (rn < 16)
     regval = ARMul_GetReg (state, state->Mode, rn);
   else if (rn == 25)		/* FIXME: use PS_REGNUM from gdb/config/arm/tm-arm.h */
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 41655f7..dd88930 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,195 @@
+2000-12-27  Alexandre Oliva  <aoliva@redhat.com>
+
+	* Make-common.in (sim-io.o): Depend on targ-vals.h.
+
+2000-12-23  Ben Elliston  <bje@redhat.com>
+
+	* cgen-trace.c (trace_result): Handle 'f' type operands; output
+	them to the trace stream using sim_fpu_printn_fpu. Include
+	"sim-fpu.h".
+
+2000-12-15  Ben Elliston  <bje@redhat.com>
+
+	* sim-fpu.h (sim_fpu_printn_fpu): Declare.
+	* sim-fpu.c (print_bits): Add digits parameter. Print only as many
+	trailing digits as specified (-1 to print all digits).
+	(sim_fpu_print_fpu): New wrapper around sim_fpu_printn_fpu.
+	(sim_fpu_printn_fpu): Rename from sim_fpu_print_fpu; update calls
+	to print_bits ().
+
+2000-12-13  Ben Elliston  <bje@redhat.com>
+
+	* cgen.sh: Set prefix/PREFIX (append ISA if applicable). Factor
+	sed expressions into $sedscript, substituting @prefix@/@PREFIX@.
+	(defs): New action.
+
+2000-12-12  Geoffrey Keating  <geoffk@redhat.com>
+
+	* sim-endian.h: Don't have parameters on macro definitions which
+	are simply renaming functions, to permit use of XCONCAT2 in both
+	the macro name and the arguments in a use of such a definition.
+
+2000-12-11  Ben Elliston  <bje@redhat.com>
+
+	* cgen-ops.h (SUBWORDDFDI): New function.
+
+2000-12-05  Ben Elliston  <bje@redhat.com>
+
+	* Make-common.in (cgen-defs): New target.
+	(cgen-decode): Pass $(EXTRAFILES).
+
+	* genmloop.sh: Use @prefix@, not @cpu@ throughout. Add -prefix and
+	-outfile-suffix options.
+
+2000-12-04  Ben Elliston  <bje@redhat.com>
+
+	* cgen-ops.h (SUBWORDSIQI): Mask off top bits.
+	(SUBWORDSIUQI): Likewise.
+	(SUBWORDDIHI): Likewise.
+	(SUBWORDDIQI): New function.
+
+	* cgen-trace.c (disassemble_insn): Remove unused declaration.
+	* cgen-scache.c (scache_option_handler): Remove unused local var.
+
+2000-12-03  Ben Elliston  <bje@redhat.com>
+
+	* sim-profile.c (profile_option_handler): Remove unused prof_nr.
+
+2000-11-26  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* hw-events.c (delete_hw_event_data): Remove the scheduled events.
+
+2000-11-26  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* dv-core.c (dv_core_attach_address_callback): Don't abort if
+	space is not zero.
+
+2000-11-24  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* hw-base.c (hw_delete): Don't free base_of_hw since it's freed.
+	(set_hw_delete): Moved the macro as a function.
+	* hw-base.h (set_hw_delete): Declare as external function.
+	* hw-alloc.c (delete_hw_alloc_data): Allow to free the memory
+	allocated using hw_malloc.
+	
+2000-11-24  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* sim-options.c (sim_parse_args): Free the memory used for
+	long_options, short_options, handlers, opt_cpu, orig_val.
+
+2000-11-20  Ben Elliston  <bje@redhat.com>
+
+	* cgen-ops.h (SUBBI): New macro.
+	(SUBWORDSIQI, SUBWORDSIHI, SUBWORDSIUQI): New functions.
+	(SUBWORDDIHI, SUBWORDDIUQI, SUBWORDDIDF): Likewise.
+
+2000-11-16  Ben Elliston  <bje@redhat.com>
+
+	* cgen-types.h (VOID): New type.
+
+2000-11-09  Ben Elliston  <bje@redhat.com>
+
+	* sim-fpu.c (sim_fpu_one): Set exponent to 0.
+	(sim_fpu_two): Set exponent to 1.
+
+2000-10-26  Ben Elliston  <bje@redhat.com>
+
+        * cgen.sh: Handle an isa argument between cpu and mach. Default to
+        `all'. Pass `-i' options to cgen applications.
+        * Make-common.in (cgen-arch, cgen-cpu, cgen-decode, cgen-cpu-decode,
+        cgen-desc): Pass $(isa) to cgen.sh.
+
+2000-10-08  Ben Elliston  <bje@redhat.com>
+
+	* cgen-utils.c (cgen_rtx_error): New function.
+
+2000-10-07  Ben Elliston  <bje@redhat.com>
+
+	* cgen-trace.c (sim_cgen_disassemble_insn): Handle failure
+	conditions for sim_core_read_buffer().
+
+2000-09-26  Dave Brolley  <brolley@redhat.com>
+
+	* cgen-utils.c (RORQI): New function.
+	(ROLQI): New function.
+	(RORHI): New function.
+	(ROLHI): New function.
+
+2000-08-28  Dave Brolley  <brolley@redhat.com>
+
+	* cgen-trace.c (sim_cgen_disassemble_insn): Make sure entire insn is
+	in insn_value if it will fit.
+
+2000-08-21  Frank Ch. Eigler  <fche@redhat.com>
+
+	* Make-common.in, cgen.sh: Contribute CGEN-related build targets/rules.
+
+2000-08-15  Dave Brolley  <brolley@redhat.com>
+
+	* sim-profile.c (profile_print_speed): Print cpu frequency if not zero.
+
+2000-08-15  Dave Brolley  <brolley@redhat.com>
+
+	* sim-profile.h (PROFILE_DATA): Add cpu_freq.
+	(PROFILE_CPU_FREQ): New macro.
+	* sim-profile.c (OPTION_PROFILE_CPU_FREQUENCY): New enumerator.
+	(profile-options): Add profile-cpu-frequency.
+	(parse_frequency): New function.
+	(profile_option_handler): Handle OPTION_PROFILE_CPU_FREQUENCY.
+	(profile_print_speed): Print cpu frequency and simulated execution time.
+	Re-indent other items to match.
+
+2000-08-09  Andrew Cagney  <cagney@lulu.cygnus.com>
+
+	* dv-sockser.c (dv_sockser_init): Eliminate MIN macro.
+
+2000-07-27  Frank Ch. Eigler  <fche@redhat.com>
+
+	From Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+	* Makefile.in (install): Install run.1 man page.
+
+Thu Jul 27 21:56:08 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	From 2000-06-23 Doug Evans <dje@casey.transmeta.com>:
+	* Makefile.in (headers,nltvals.def): Merge.
+
+Thu Jul 27 20:37:47 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	From 2000-06-25 Stephane Carrez <Stephane.Carrez@worldnet.fr>:
+	* nrun.c (main): Print the simulator statistics only in
+	verbose mode.
+	* hw-properties.h (hw_find_integer_array_property): Fix
+	prototype (use signed_cell).
+
+	From 2000-06-25 Stephane Carrez <Stephane.Carrez@worldnet.fr>:
+	* sim-events.c (sim_events_remain_time): New function returning
+	the time that remains before the event is raised.
+	* hw-events.c (hw_event_remain_time): Likewise.
+	* sim-events.h (sim_events_remain_time): Declare.
+	* hw-events.h (hw_event_remain_time): Declare.
+
+	From 2000-06-25 Stephane Carrez <Stephane.Carrez@worldnet.fr>:
+	* sim-hw.c: Use <errno.h> instead of <sys/errno.h>
+	(OPTION_HW_LIST): New option --hw-list to list the devices.
+	(hw_option_handler): List the device tree with 'sim_hw_print'.
+
+	From 2000-06-25 Stephane Carrez <Stephane.Carrez@worldnet.fr>:
+	* sim-bits.h (_MSB_16, _LSB_16): Define for 16-bit targets.
+	(MASK, LSBIT, MSBIT): Likewise and use _MSB_16 and _LSB_16.
+	(EXTENDED): Define for 16-bit word size.
+	* sim-bits.c (LSEXTRACTED, MSEXTRACTED, LSINSERTED,
+	MSINSERTED, LSSEXT, MSSEXT): Implement for 16-bit word size.
+	* sim-types.h: Added support for 16-bit targets.
+
+2000-06-23  Frank Ch. Eigler  <fche@redhat.com>
+
+	* cgen-trace.h (TRACE_USEFUL_MASK): Remove TRACE_EVENTS_IDX.
+
+2000-06-24  Frank Ch. Eigler  <fche@redhat.com>
+
+	From Maciej W. Rozycki <macro@ds2.pg.gda.pl>:
+	* Makefile.in (distclean): Clean cconfig.h also.
+
 Tue May 23 21:39:23 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 7c25d6c..f37d03f 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -1,5 +1,5 @@
 # Makefile fragment for common parts of all simulators.
-# Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 # Contributed by Cygnus Support.
 
 # This program is free software; you can redistribute it and/or modify
@@ -424,7 +424,7 @@
 	$(SHELL) $(srcdir)/../../move-if-change tmp-$@ $@
 
 sim-io.o: $(srccom)/sim-io.c $(sim_main_headers) $(sim-io_h) \
-	  $(srcroot)/include/remote-sim.h
+	  $(srcroot)/include/remote-sim.h targ-vals.h
 	$(CC) -c $(srccom)/sim-io.c $(ALL_CFLAGS)
 
 sim-memopt.o: $(srccom)/sim-memopt.c $(sim_main_headers) \
@@ -654,4 +654,61 @@
 	CONFIG_FILES=$@:../common/gdbinit.in CONFIG_HEADERS= $(SHELL) ./config.status
 
 
+# CGEN support
+
+CGENDIR = @cgendir@
+CGEN = `if [ -f ../../guile/libguile/guile ]; then echo ../../guile/libguile/guile; else echo guile ; fi`
+CGENFLAGS = -v
+srccgen = $(CGENDIR)
+
+CGEN_READ_SCM = ../../cgen/stamp-cgen $(srccgen)/sim.scm
+CGEN_ARCH_SCM = $(srccgen)/sim-arch.scm
+CGEN_CPU_SCM = $(srccgen)/sim-cpu.scm $(srccgen)/sim-model.scm
+CGEN_DECODE_SCM = $(srccgen)/sim-decode.scm
+CGEN_DESC_SCM = $(srccgen)/desc.scm $(srccgen)/desc-cpu.scm
+
+# Various choices for which cpu specific files to generate.
+CGEN_CPU_EXTR = -E tmp-ext.c1
+CGEN_CPU_READ = -R tmp-read.c1
+CGEN_CPU_WRITE = -W tmp-write.c1
+CGEN_CPU_SEM = -S tmp-sem.c1
+CGEN_CPU_SEMSW = -X tmp-semsw.c1
+
+CGEN_FLAGS_TO_PASS = \
+	CGEN=$(CGEN) \
+	CGENFLAGS="$(CGENFLAGS)"
+
+# We store the generated files in the source directory until we decide to
+# ship a Scheme interpreter with gdb/binutils.  Maybe we never will.
+
+cgen-arch: force
+	$(SHELL) $(srccom)/cgen.sh arch $(srcdir) \
+		$(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
+		$(arch) "$(FLAGS)" ignored "$(isa)" $(mach) ignored ignored
+	
+cgen-cpu: force
+	$(SHELL) $(srccom)/cgen.sh cpu $(srcdir) \
+		$(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
+		$(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" "$(EXTRAFILES)"
+
+cgen-defs: force
+	$(SHELL) $(srccom)/cgen.sh defs $(srcdir) \
+		$(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
+		$(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" ignored
+
+cgen-decode: force
+	$(SHELL) $(srccom)/cgen.sh decode $(srcdir) \
+		$(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
+		$(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" "$(EXTRAFILES)"
+
+cgen-cpu-decode: force
+	$(SHELL) $(srccom)/cgen.sh cpu-decode $(srcdir) \
+		$(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
+		$(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" "$(EXTRAFILES)"
+
+cgen-desc: force
+	$(SHELL) $(srccom)/cgen.sh desc $(srcdir) \
+		$(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
+		$(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" ignored
+
 ## End COMMON_POST_CONFIG_FRAG
diff --git a/sim/common/Makefile.in b/sim/common/Makefile.in
index 6428082..d021566 100644
--- a/sim/common/Makefile.in
+++ b/sim/common/Makefile.in
@@ -71,17 +71,14 @@
 
 all:
 
-# Generate TARG_VALS_H for newlib/libgloss using devo and build tree.
+# Generate nltvals.def for newlib/libgloss using devo and build tree.
 # This file is shipped with distributions so we build in the source dir.
-# This is built in srcdir so putting dependencies here is risky.
 # Use `make headers' to rebuild.
-headers: nltvals.def
+# Note: If gdb releases begin to contain target header files (not a good idea,
+# but if they did ...), targ-vals.def coud be generated at build time.
+# An alternative is to slurp in the tables at runtime.
 .PHONY: headers
-
-# Note: If gdb releases begin to contain target header files, generate
-# targ-vals.def at build time.
-
-nltvals.def: Makefile gennltvals.sh gentvals.sh
+headers:
 	rootme=`pwd` ; \
 	cd $(srcdir) ; \
 	rm -f nltvals.new ; \
@@ -113,13 +110,13 @@
 distclean mostlyclean maintainer-clean realclean: clean
 	rm -f TAGS
 	rm -f Makefile config.cache config.log config.status
-	rm -f config.h stamp-h
+	rm -f cconfig.h config.h stamp-h
 
 # Dummy target to force execution of dependent targets.
 force:
 
 # Copy the files into directories where they will be run.
-install:
+install: install-man
 
 install-man: installdirs
 	n=`echo run | sed '$(program_transform_name)'`; \
diff --git a/sim/common/cgen-ops.h b/sim/common/cgen-ops.h
index c632177..2ce1b12 100644
--- a/sim/common/cgen-ops.h
+++ b/sim/common/cgen-ops.h
@@ -23,6 +23,8 @@
 #ifndef CGEN_SEM_OPS_H
 #define CGEN_SEM_OPS_H
 
+#include <assert.h>
+
 #if defined (__GNUC__) && ! defined (SEMOPS_DEFINE_INLINE)
 #define SEMOPS_DEFINE_INLINE
 #define SEMOPS_INLINE extern inline
@@ -39,6 +41,7 @@
 #define ANDIF(x, y) ((x) && (y))
 #define ORIF(x, y) ((x) || (y))
 
+#define SUBBI(x, y) ((x) - (y))
 #define ANDBI(x, y) ((x) & (y))
 #define ORBI(x, y) ((x) | (y))
 #define XORBI(x, y) ((x) ^ (y))
@@ -308,6 +311,51 @@
   return x.out;
 }
 
+SEMOPS_INLINE DF
+SUBWORDDIDF (DI in)
+{
+  union { DI in; DF out; } x;
+  x.in = in;
+  return x.out;
+}
+
+SEMOPS_INLINE QI
+SUBWORDSIQI (SI in, int byte)
+{
+  assert (byte >= 0 && byte <= 3);
+  return (UQI) (in >> (8 * (3 - byte))) & 0xFF;
+}
+
+SEMOPS_INLINE UQI
+SUBWORDSIUQI (SI in, int byte)
+{
+  assert (byte >= 0 && byte <= 3);
+  return (UQI) (in >> (8 * (3 - byte))) & 0xFF;
+}
+
+SEMOPS_INLINE QI
+SUBWORDDIQI (DI in, int byte)
+{
+  assert (byte >= 0 && byte <= 7);
+  return (UQI) (in >> (8 * (7 - byte))) & 0xFF;
+}
+
+SEMOPS_INLINE HI
+SUBWORDDIHI (DI in, int word)
+{
+  assert (word >= 0 && word <= 3);
+  return (UHI) (in >> (16 * (3 - word))) & 0xFFFF;
+}
+
+SEMOPS_INLINE HI
+SUBWORDSIHI (SI in, int word)
+{
+  if (word == 0)
+    return (USI) in >> 16;
+  else
+    return in;
+}
+
 SEMOPS_INLINE SI
 SUBWORDSFSI (SF in)
 {
@@ -316,6 +364,21 @@
   return x.out;
 }
 
+SEMOPS_INLINE DI
+SUBWORDDFDI (DF in)
+{
+  union { DF in; DI out; } x;
+  x.in = in;
+  return x.out;
+}
+
+SEMOPS_INLINE UQI
+SUBWORDDIUQI (DI in, int byte)
+{
+  assert (byte >= 0 && byte <= 7);
+  return (UQI) (in >> (8 * (7 - byte)));
+}
+
 SEMOPS_INLINE SI
 SUBWORDDISI (DI in, int word)
 {
@@ -397,13 +460,22 @@
 
 #else
 
-SF SUBWORDSISF (SI);
+QI SUBWORDSIQI (SI);
+HI SUBWORDSIHI (HI);
 SI SUBWORDSFSI (SF);
+SF SUBWORDSISF (SI);
+DI SUBWORDDFDI (DF);
+DF SUBWORDDIDF (DI);
+QI SUBWORDDIQI (DI, int);
+HI SUBWORDDIHI (DI, int);
 SI SUBWORDDISI (DI, int);
 SI SUBWORDDFSI (DF, int);
 SI SUBWORDXFSI (XF, int);
 SI SUBWORDTFSI (TF, int);
 
+UQI SUBWORDSIUQI (SI);
+UQI SUBWORDDIUQI (DI);
+
 DI JOINSIDI (SI, SI);
 DF JOINSIDF (SI, SI);
 XF JOINSIXF (SI, SI, SI);
diff --git a/sim/common/cgen-scache.c b/sim/common/cgen-scache.c
index 890afc8..282497c 100644
--- a/sim/common/cgen-scache.c
+++ b/sim/common/cgen-scache.c
@@ -117,8 +117,6 @@
 scache_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt,
 		       char *arg, int is_command)
 {
-  int n;
-
   switch (opt)
     {
     case 'c' :
diff --git a/sim/common/cgen-trace.c b/sim/common/cgen-trace.c
index 4e382d4..765ab57 100644
--- a/sim/common/cgen-trace.c
+++ b/sim/common/cgen-trace.c
@@ -22,6 +22,7 @@
 #include "dis-asm.h"
 #include "bfd.h"
 #include "sim-main.h"
+#include "sim-fpu.h"
 
 #undef min
 #define min(a,b) ((a) < (b) ? (a) : (b))
@@ -54,10 +55,6 @@
 #define SIZE_TRACE_BUF 1024
 #endif
 
-static void
-disassemble_insn (SIM_CPU *, const CGEN_INSN *,
-		  const struct argbuf *, IADDR, char *);
-
 /* Text is queued in TRACE_BUF because we want to output the insn's cycle
    count first but that isn't known until after the insn has executed.
    This also handles the queueing of trace results, TRACE_RESULT may be
@@ -239,6 +236,19 @@
     default :
       cgen_trace_printf (cpu, "%s <- 0x%x", name, va_arg (args, int));
       break;
+    case 'f':
+      {
+	DI di;
+	sim_fpu f;
+
+	/* this is separated from previous line for sunos cc */
+	di = va_arg (args, DI);
+	sim_fpu_64to (&f, di);
+
+	cgen_trace_printf (cpu, "%s <- ", name);
+	sim_fpu_printn_fpu (&f, (sim_fpu_print_func *) cgen_trace_printf, 4, cpu);
+	break;
+      }
     case 'D' :
       {
 	DI di;
@@ -354,6 +364,7 @@
 			   const ARGBUF *abuf, IADDR pc, char *buf)
 {
   unsigned int length;
+  unsigned int base_length;
   unsigned long insn_value;
   struct disassemble_info disasm_info;
   SFILE sfile;
@@ -380,7 +391,18 @@
   length = sim_core_read_buffer (sd, cpu, read_map, &insn_buf, pc,
 				 insn_length);
 
-  switch (min (cd->base_insn_bitsize, insn_bit_length))
+  if (length != insn_length)
+  {
+    sim_io_error (sd, "unable to read address %x", pc);
+  }
+
+  /* If the entire insn will fit into an integer, then do it. Otherwise, just
+     use the bits of the base_insn.  */
+  if (insn_bit_length <= 32)
+    base_length = insn_bit_length;
+  else
+    base_length = min (cd->base_insn_bitsize, insn_bit_length);
+  switch (base_length)
     {
     case 0 : return; /* fake insn, typically "compile" (aka "invalid") */
     case 8 : insn_value = insn_buf.bytes[0]; break;
diff --git a/sim/common/cgen-types.h b/sim/common/cgen-types.h
index 9848edf..dd85d4c 100644
--- a/sim/common/cgen-types.h
+++ b/sim/common/cgen-types.h
@@ -64,6 +64,7 @@
 extern const char *mode_names[];
 #define MODE_NAME(m) (mode_names[m])
 
+typedef void VOID;
 typedef unsigned char BI;
 typedef signed8 QI;
 typedef signed16 HI;
diff --git a/sim/common/cgen-utils.c b/sim/common/cgen-utils.c
index e7407ed..8383196 100644
--- a/sim/common/cgen-utils.c
+++ b/sim/common/cgen-utils.c
@@ -321,6 +321,74 @@
 
 #endif /* DI_FN_SUPPORT */
 
+QI
+RORQI (val, shift)
+     QI  val;
+     int shift;
+{
+  if (shift != 0)
+    {
+      int remain = 8 - shift;
+      int mask = (1 << shift) - 1;
+      QI result = (val & mask) << remain;
+      mask = (1 << remain) - 1;
+      result |= (val >> shift) & mask;
+      return result;
+    }
+  return val;
+}
+
+QI
+ROLQI (val, shift)
+     QI  val;
+     int shift;
+{
+  if (shift != 0)
+    {
+      int remain = 8 - shift;
+      int mask = (1 << remain) - 1;
+      QI result = (val & mask) << shift;
+      mask = (1 << shift) - 1;
+      result |= (val >> remain) & mask;
+      return result;
+    }
+  return val;
+}
+
+HI
+RORHI (val, shift)
+     HI  val;
+     int shift;
+{
+  if (shift != 0)
+    {
+      int remain = 16 - shift;
+      int mask = (1 << shift) - 1;
+      HI result = (val & mask) << remain;
+      mask = (1 << remain) - 1;
+      result |= (val >> shift) & mask;
+      return result;
+    }
+  return val;
+}
+
+HI
+ROLHI (val, shift)
+     HI  val;
+     int shift;
+{
+  if (shift != 0)
+    {
+      int remain = 16 - shift;
+      int mask = (1 << remain) - 1;
+      HI result = (val & mask) << shift;
+      mask = (1 << shift) - 1;
+      result |= (val >> remain) & mask;
+      return result;
+    }
+  return val;
+}
+
 SI
 RORSI (val, shift)
      SI  val;
@@ -355,3 +423,16 @@
 
   return val;
 }
+
+/* Emit an error message from CGEN RTL.  */
+
+void
+cgen_rtx_error (SIM_CPU *cpu, const char * msg)
+{
+  SIM_DESC sd = CPU_STATE (cpu);
+
+  sim_io_printf (sd, msg);
+  sim_io_printf (sd, "\n");
+
+  sim_engine_halt (sd, cpu, NULL, CIA_GET (cpu), sim_stopped, SIM_SIGTRAP);
+}
diff --git a/sim/common/cgen.sh b/sim/common/cgen.sh
new file mode 100644
index 0000000..14fa247
--- /dev/null
+++ b/sim/common/cgen.sh
@@ -0,0 +1,207 @@
+#! /bin/sh
+# Generate CGEN simulator files.
+#
+# Usage: /bin/sh cgen.sh {"arch"|"cpu"|"decode"|"defs"|"cpu-decode"} \
+#	srcdir cgen cgendir cgenflags \
+#	arch archflags cpu mach suffix extrafiles
+#
+# We store the generated files in the source directory until we decide to
+# ship a Scheme interpreter (or other implementation) with gdb/binutils.
+# Maybe we never will.
+
+# We want to behave like make, any error forces us to stop.
+set -e
+
+action=$1
+srcdir=$2
+cgen=$3
+cgendir=$4
+cgenflags=$5
+arch=$6
+archflags=$7
+cpu=$8
+isa=$9
+# portably bring parameters beyond $9 into view
+shift ; mach=$9
+shift ; suffix=$9
+shift ; extrafiles=$9
+
+rootdir=${srcdir}/../..
+
+if test -z "$isa" ; then
+  isa=all
+  prefix=$cpu
+else
+  prefix=${cpu}_$isa
+fi
+
+lowercase='abcdefghijklmnopqrstuvwxyz'
+uppercase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ARCH=`echo ${arch} | tr "${lowercase}" "${uppercase}"`
+CPU=`echo ${cpu} | tr "${lowercase}" "${uppercase}"`
+PREFIX=`echo ${prefix} | tr "${lowercase}" "${uppercase}"`
+
+sedscript="\
+-e s/@ARCH@/${ARCH}/g -e s/@arch@/${arch}/g \
+-e s/@CPU@/${CPU}/g -e s/@cpu@/${cpu}/g \
+-e s/@PREFIX@/${PREFIX}/g -e s/@prefix@/${prefix}/g"
+
+case $action in
+arch)
+	rm -f tmp-arch.h1 tmp-arch.h
+	rm -f tmp-arch.c1 tmp-arch.c
+	rm -f tmp-all.h1 tmp-all.h
+
+	${cgen} -s ${cgendir}/cgen-sim.scm \
+		-s ${cgendir} \
+		${cgenflags} \
+		-f "${archflags}" \
+		-m ${mach} \
+		-a ${arch} \
+		-i ${isa} \
+		-A tmp-arch.h1 \
+		-B tmp-arch.c1 \
+		-N tmp-all.h1
+	sed $sedscript < tmp-arch.h1 > tmp-arch.h
+	${rootdir}/move-if-change tmp-arch.h ${srcdir}/arch.h
+	sed $sedscript < tmp-arch.c1 > tmp-arch.c
+	${rootdir}/move-if-change tmp-arch.c ${srcdir}/arch.c
+	sed $sedscript < tmp-all.h1 > tmp-all.h
+	${rootdir}/move-if-change tmp-all.h ${srcdir}/cpuall.h
+
+	rm -f tmp-arch.h1 tmp-arch.c1 tmp-all.h1
+	;;
+
+cpu | decode | cpu-decode)
+
+	fileopts=""
+	case $action in
+	*cpu*)
+		rm -f tmp-cpu.h1 tmp-cpu.c1
+		rm -f tmp-ext.c1 tmp-read.c1 tmp-write.c1
+		rm -f tmp-sem.c1 tmp-semsw.c1
+		rm -f tmp-mod.c1
+		rm -f tmp-cpu.h tmp-cpu.c
+		rm -f tmp-ext.c tmp-read.c tmp-write.c
+		rm -f tmp-sem.c tmp-semsw.c tmp-mod.c
+		fileopts="$fileopts \
+			-C tmp-cpu.h1 \
+			-U tmp-cpu.c1 \
+			-M tmp-mod.c1 \
+			${extrafiles}"
+		;;
+	esac
+	case $action in
+	*decode*)
+		rm -f tmp-dec.h1 tmp-dec.h tmp-dec.c1 tmp-dec.c
+		fileopts="$fileopts \
+			-T tmp-dec.h1 \
+			-D tmp-dec.c1"
+		;;
+	esac
+
+	${cgen} -s ${cgendir}/cgen-sim.scm \
+		-s ${cgendir} \
+		${cgenflags} \
+		-f "${archflags}" \
+		-m ${mach} \
+		-a ${arch} \
+		-i ${isa} \
+		${fileopts}
+
+	case $action in
+	*cpu*)
+		sed $sedscript < tmp-cpu.h1 > tmp-cpu.h
+		${rootdir}/move-if-change tmp-cpu.h ${srcdir}/cpu${suffix}.h
+		sed $sedscript < tmp-cpu.c1 > tmp-cpu.c
+		${rootdir}/move-if-change tmp-cpu.c ${srcdir}/cpu${suffix}.c
+		sed $sedscript < tmp-mod.c1 > tmp-mod.c
+		${rootdir}/move-if-change tmp-mod.c ${srcdir}/model${suffix}.c
+		if test -f tmp-ext.c1 ; then \
+			sed $sedscript < tmp-ext.c1 > tmp-ext.c ; \
+			${rootdir}/move-if-change tmp-ext.c ${srcdir}/extract${suffix}.c ; \
+		fi
+		if test -f tmp-read.c1 ; then \
+			sed $sedscript < tmp-read.c1 > tmp-read.c ; \
+			${rootdir}/move-if-change tmp-read.c ${srcdir}/read${suffix}.c ; \
+		fi
+		if test -f tmp-write.c1 ; then \
+			sed $sedscript < tmp-write.c1 > tmp-write.c ; \
+			${rootdir}/move-if-change tmp-write.c ${srcdir}/write${suffix}.c ; \
+		fi
+		if test -f tmp-sem.c1 ; then \
+			sed $sedscript < tmp-sem.c1 > tmp-sem.c ; \
+			${rootdir}/move-if-change tmp-sem.c ${srcdir}/sem${suffix}.c ; \
+		fi
+		if test -f tmp-semsw.c1 ; then \
+			sed $sedscript < tmp-semsw.c1 > tmp-semsw.c ; \
+			${rootdir}/move-if-change tmp-semsw.c ${srcdir}/sem${suffix}-switch.c ; \
+		fi
+
+		rm -f tmp-cpu.h1 tmp-cpu.c1
+		rm -f tmp-ext.c1 tmp-read.c1 tmp-write.c1
+		rm -f tmp-sem.c1 tmp-semsw.c1 tmp-mod.c1
+		;;
+	esac
+
+	case $action in
+	*decode*)
+		sed $sedscript < tmp-dec.h1 > tmp-dec.h
+		${rootdir}/move-if-change tmp-dec.h ${srcdir}/decode${suffix}.h
+		sed $sedscript < tmp-dec.c1 > tmp-dec.c
+		${rootdir}/move-if-change tmp-dec.c ${srcdir}/decode${suffix}.c
+
+		rm -f tmp-dec.h1 tmp-dec.c1
+		;;
+	esac
+
+	;;
+
+defs)
+	rm -f tmp-defs.h1 tmp-defs.h
+	
+	${cgen} -s ${cgendir}/cgen-sim.scm \
+		-s ${cgendir} \
+		${cgenflags} \
+		-f "${archflags}" \
+		-m ${mach} \
+		-a ${arch} \
+		-i ${isa} \
+		-G tmp-defs.h1
+	sed $sedscript < tmp-defs.h1 > tmp-defs.h
+	${rootdir}/move-if-change tmp-defs.h ${srcdir}/defs${suffix}.h
+	;;
+
+desc)
+	rm -f tmp-desc.h1 tmp-desc.h
+	rm -f tmp-desc.c1 tmp-desc.c
+	rm -f tmp-opc.h1 tmp-opc.h
+
+	${cgen} -s ${cgendir}/cgen-opc.scm \
+		-s ${cgendir} \
+		${cgenflags} \
+		-f "${archflags}" \
+		-m ${mach} \
+		-a ${arch} \
+		-i ${isa} \
+		-H tmp-desc.h1 \
+		-C tmp-desc.c1 \
+		-O tmp-opc.h1
+	sed $sedscript < tmp-desc.h1 > tmp-desc.h
+	${rootdir}/move-if-change tmp-desc.h ${srcdir}/${arch}-desc.h
+	sed $sedscript < tmp-desc.c1 > tmp-desc.c
+	${rootdir}/move-if-change tmp-desc.c ${srcdir}/${arch}-desc.c
+	sed $sedscript < tmp-opc.h1 > tmp-opc.h
+	${rootdir}/move-if-change tmp-opc.h ${srcdir}/${arch}-opc.h
+
+	rm -f tmp-desc.h1 tmp-desc.c1 tmp-opc.h1
+	;;
+
+*)
+	echo "`basename $0`: unknown action: ${action}" >&2
+	exit 1
+	;;
+
+esac
+
+exit 0
diff --git a/sim/common/dv-core.c b/sim/common/dv-core.c
index 1bf4f68..0a0c4a9 100644
--- a/sim/common/dv-core.c
+++ b/sim/common/dv-core.c
@@ -57,8 +57,6 @@
   /* NOTE: At preset the space is assumed to be zero.  Perhaphs the
      space should be mapped onto something for instance: space0 -
      unified memory; space1 - IO memory; ... */
-  if (space != 0)
-    hw_abort (me, "Hey! Unknown space %d", space);
   sim_core_attach (hw_system (me),
 		   NULL, /*cpu*/
 		   level,
diff --git a/sim/common/dv-sockser.c b/sim/common/dv-sockser.c
index fb457d4..d5e6577 100644
--- a/sim/common/dv-sockser.c
+++ b/sim/common/dv-sockser.c
@@ -74,7 +74,6 @@
 #endif /* ! defined (FNBLOCK) */
 #endif /* ! defined (O_NONBLOCK) */
 
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
 
 /* Compromise between eating cpu and properly busy-waiting.
    One could have an option to set this but for now that seems
@@ -148,7 +147,9 @@
 		      sockser_addr);
       return SIM_RC_FAIL;
     }
-  tmp = MIN (port_str - sockser_addr, (int) sizeof hostname - 1);
+  tmp = port_str - sockser_addr;
+  if (tmp >= sizeof hostname)
+    tmp = sizeof (hostname) - 1;
   strncpy (hostname, sockser_addr, tmp);
   hostname[tmp] = '\000';
   port = atoi (port_str + 1);
diff --git a/sim/common/genmloop.sh b/sim/common/genmloop.sh
index d3e17b0..dddd1a1 100644
--- a/sim/common/genmloop.sh
+++ b/sim/common/genmloop.sh
@@ -1,5 +1,5 @@
 # Generate the main loop of the simulator.
-# Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 # Contributed by Cygnus Support.
 #
 # This file is part of the GNU simulators.
@@ -100,6 +100,10 @@
 #	Things can be sped up by generating both serial and parallel versions
 #	and is better suited to mixed parallel architectures like the m32r.
 #
+# -prefix: string to prepend to function names in mloop.c/eng.h.
+#
+#       If no prefix is specified, the cpu type is used.
+#
 # -switch file: specify file containing semantics implemented as a switch()
 #
 # -cpu <cpu-family>
@@ -110,6 +114,10 @@
 #
 #	Specify the mainloop.in input file.
 #
+# -outfile-suffix <output-file-suffix>
+#
+#	Specify the suffix to append to output files.
+#
 # Only one of -scache/-pbb may be selected.
 # -simple is the default.
 #
@@ -128,6 +136,8 @@
 switch=
 cpu="unknown"
 infile=""
+prefix="unknown"
+outsuffix=""
 
 while test $# -gt 0
 do
@@ -141,10 +151,12 @@
 	-scache) scache=yes ;;
 	-pbb) pbb=yes ;;
 	-no-parallel) ;;
+	-outfile-suffix) shift ; outsuffix=$1 ;;
 	-parallel-read) parallel=read ;;
 	-parallel-write) parallel=write ;;
 	-parallel-generic-write) parallel=genwrite ;;
 	-parallel-only) parallel_only=yes ;;
+	-prefix) shift ; prefix=$1 ;;
 	-switch) shift ; switch=$1 ;;
 	-cpu) shift ; cpu=$1 ;;
 	-infile) shift ; infile=$1 ;;
@@ -170,14 +182,19 @@
     exit 1
 fi
 
+if [ "x$prefix" = xunknown ] ; then
+    prefix=$cpu
+fi
+
 lowercase='abcdefghijklmnopqrstuvwxyz'
 uppercase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 CPU=`echo ${cpu} | tr "${lowercase}" "${uppercase}"`
+PREFIX=`echo ${prefix} | tr "${lowercase}" "${uppercase}"`
 
 ##########################################################################
 
-rm -f eng.hin
-exec 1>eng.hin
+rm -f eng${outsuffix}.hin
+exec 1>eng${outsuffix}.hin
 
 echo "/* engine configuration for ${cpu} */"
 echo ""
@@ -191,11 +208,11 @@
 fi
 
 echo ""
-echo "/* WITH_SCACHE_PBB_${CPU}: non-zero if the pbb engine was selected.  */"
+echo "/* WITH_SCACHE_PBB_${PREFIX}: non-zero if the pbb engine was selected.  */"
 if [ x$pbb = xyes ] ; then
-	echo "#define WITH_SCACHE_PBB_${CPU} 1"
+	echo "#define WITH_SCACHE_PBB_${PREFIX} 1"
 else
-	echo "#define WITH_SCACHE_PBB_${CPU} 0"
+	echo "#define WITH_SCACHE_PBB_${PREFIX} 0"
 fi
 
 echo ""
@@ -256,22 +273,22 @@
 echo "/* Functions defined in the generated mainloop.c file"
 echo "   (which doesn't necessarily have that file name).  */"
 echo ""
-echo "extern ENGINE_FN ${cpu}_engine_run_full;"
-echo "extern ENGINE_FN ${cpu}_engine_run_fast;"
+echo "extern ENGINE_FN ${prefix}_engine_run_full;"
+echo "extern ENGINE_FN ${prefix}_engine_run_fast;"
 
 if [ x$pbb = xyes ] ; then
 	echo ""
-	echo "extern SEM_PC ${cpu}_pbb_begin (SIM_CPU *, int);"
-	echo "extern SEM_PC ${cpu}_pbb_chain (SIM_CPU *, SEM_ARG);"
-	echo "extern SEM_PC ${cpu}_pbb_cti_chain (SIM_CPU *, SEM_ARG, SEM_BRANCH_TYPE, PCADDR);"
-	echo "extern void ${cpu}_pbb_before (SIM_CPU *, SCACHE *);"
-	echo "extern void ${cpu}_pbb_after (SIM_CPU *, SCACHE *);"
+	echo "extern SEM_PC ${prefix}_pbb_begin (SIM_CPU *, int);"
+	echo "extern SEM_PC ${prefix}_pbb_chain (SIM_CPU *, SEM_ARG);"
+	echo "extern SEM_PC ${prefix}_pbb_cti_chain (SIM_CPU *, SEM_ARG, SEM_BRANCH_TYPE, PCADDR);"
+	echo "extern void ${prefix}_pbb_before (SIM_CPU *, SCACHE *);"
+	echo "extern void ${prefix}_pbb_after (SIM_CPU *, SCACHE *);"
 fi
 
 ##########################################################################
 
-rm -f tmp-mloop.cin mloop.cin
-exec 1>tmp-mloop.cin
+rm -f tmp-mloop-$$.cin mloop${outsuffix}.cin
+exec 1>tmp-mloop-$$.cin
 
 # We use @cpu@ instead of ${cpu} because we still need to run sed to handle
 # transformation of @cpu@ for mainloop.in, so there's no need to use ${cpu}
@@ -296,7 +313,7 @@
    virtual and real.  */
 
 static INLINE void
-@cpu@_fill_argbuf (const SIM_CPU *cpu, ARGBUF *abuf, const IDESC *idesc,
+@prefix@_fill_argbuf (const SIM_CPU *cpu, ARGBUF *abuf, const IDESC *idesc,
 		    PCADDR pc, int fast_p)
 {
 #if WITH_SCACHE
@@ -309,7 +326,7 @@
 /* Fill in tracing/profiling fields of an ARGBUF.  */
 
 static INLINE void
-@cpu@_fill_argbuf_tp (const SIM_CPU *cpu, ARGBUF *abuf,
+@prefix@_fill_argbuf_tp (const SIM_CPU *cpu, ARGBUF *abuf,
 		       int trace_p, int profile_p)
 {
   ARGBUF_TRACE_P (abuf) = trace_p;
@@ -324,13 +341,13 @@
    of parallel insns.  */
 
 static INLINE void
-@cpu@_emit_before (SIM_CPU *current_cpu, SCACHE *sc, PCADDR pc, int first_p)
+@prefix@_emit_before (SIM_CPU *current_cpu, SCACHE *sc, PCADDR pc, int first_p)
 {
   ARGBUF *abuf = &sc[0].argbuf;
-  const IDESC *id = & CPU_IDESC (current_cpu) [@CPU@_INSN_X_BEFORE];
+  const IDESC *id = & CPU_IDESC (current_cpu) [@PREFIX@_INSN_X_BEFORE];
 
   abuf->fields.before.first_p = first_p;
-  @cpu@_fill_argbuf (current_cpu, abuf, id, pc, 0);
+  @prefix@_fill_argbuf (current_cpu, abuf, id, pc, 0);
   /* no need to set trace_p,profile_p */
 }
 
@@ -339,12 +356,12 @@
    parallel insns.  */
 
 static INLINE void
-@cpu@_emit_after (SIM_CPU *current_cpu, SCACHE *sc, PCADDR pc)
+@prefix@_emit_after (SIM_CPU *current_cpu, SCACHE *sc, PCADDR pc)
 {
   ARGBUF *abuf = &sc[0].argbuf;
-  const IDESC *id = & CPU_IDESC (current_cpu) [@CPU@_INSN_X_AFTER];
+  const IDESC *id = & CPU_IDESC (current_cpu) [@PREFIX@_INSN_X_AFTER];
 
-  @cpu@_fill_argbuf (current_cpu, abuf, id, pc, 0);
+  @prefix@_fill_argbuf (current_cpu, abuf, id, pc, 0);
   /* no need to set trace_p,profile_p */
 }
 
@@ -373,7 +390,7 @@
 #define FAST_P 0
 
 void
-@cpu@_engine_run_full (SIM_CPU *current_cpu)
+@prefix@_engine_run_full (SIM_CPU *current_cpu)
 {
 #define FAST_P 0
   SIM_DESC current_state = CPU_STATE (current_cpu);
@@ -428,7 +445,7 @@
 #include "$switch"
 #endif
 #else
-      @cpu@_sem_init_idesc_table (current_cpu);
+      @prefix@_sem_init_idesc_table (current_cpu);
 #endif
       CPU_IDESC_SEM_INIT_P (current_cpu) = 1;
     }
@@ -483,7 +500,7 @@
     cat << EOF
 
 static INLINE SCACHE *
-@cpu@_scache_lookup (SIM_CPU *current_cpu, PCADDR vpc, SCACHE *scache,
+@prefix@_scache_lookup (SIM_CPU *current_cpu, PCADDR vpc, SCACHE *scache,
                      unsigned int hash_mask, int FAST_P)
 {
   /* First step: look up current insn in hash table.  */
@@ -518,7 +535,7 @@
 #define FAST_P 0
 
 void
-@cpu@_engine_run_full (SIM_CPU *current_cpu)
+@prefix@_engine_run_full (SIM_CPU *current_cpu)
 {
   SIM_DESC current_state = CPU_STATE (current_cpu);
   SCACHE *scache = CPU_SCACHE_CACHE (current_cpu);
@@ -536,7 +553,7 @@
   if (! CPU_IDESC_SEM_INIT_P (current_cpu))
     {
 #if ! WITH_SEM_SWITCH_FULL
-      @cpu@_sem_init_idesc_table (current_cpu);
+      @prefix@_sem_init_idesc_table (current_cpu);
 #endif
       CPU_IDESC_SEM_INIT_P (current_cpu) = 1;
     }
@@ -547,7 +564,7 @@
     {
       SCACHE *sc;
 
-      sc = @cpu@_scache_lookup (current_cpu, vpc, scache, hash_mask, FAST_P);
+      sc = @prefix@_scache_lookup (current_cpu, vpc, scache, hash_mask, FAST_P);
 
 /* begin full-exec-scache */
 EOF
@@ -579,7 +596,7 @@
 #define FAST_P 1
 
 void
-@cpu@_engine_run_fast (SIM_CPU *current_cpu)
+@prefix@_engine_run_fast (SIM_CPU *current_cpu)
 {
   SIM_DESC current_state = CPU_STATE (current_cpu);
   SCACHE *scache = CPU_SCACHE_CACHE (current_cpu);
@@ -603,7 +620,7 @@
 #include "$switch"
 #endif
 #else
-      @cpu@_semf_init_idesc_table (current_cpu);
+      @prefix@_semf_init_idesc_table (current_cpu);
 #endif
       CPU_IDESC_SEM_INIT_P (current_cpu) = 1;
     }
@@ -614,7 +631,7 @@
     {
       SCACHE *sc;
 
-      sc = @cpu@_scache_lookup (current_cpu, vpc, scache, hash_mask, FAST_P);
+      sc = @prefix@_scache_lookup (current_cpu, vpc, scache, hash_mask, FAST_P);
 
 /* begin fast-exec-scache */
 EOF
@@ -650,7 +667,7 @@
     cat << EOF
 
 static INLINE SCACHE *
-@cpu@_scache_lookup (SIM_CPU *current_cpu, PCADDR vpc, SCACHE *scache,
+@prefix@_scache_lookup (SIM_CPU *current_cpu, PCADDR vpc, SCACHE *scache,
                      unsigned int hash_mask, int FAST_P)
 {
   /* First step: look up current insn in hash table.  */
@@ -687,7 +704,7 @@
 #define FAST_P 0
 
 void
-@cpu@_engine_run_full (SIM_CPU *current_cpu)
+@prefix@_engine_run_full (SIM_CPU *current_cpu)
 {
   SIM_DESC current_state = CPU_STATE (current_cpu);
   SCACHE *scache = CPU_SCACHE_CACHE (current_cpu);
@@ -722,7 +739,7 @@
   if (! CPU_IDESC_SEM_INIT_P (current_cpu))
     {
 #if ! WITH_SEM_SWITCH_FULL
-      @cpu@_sem_init_idesc_table (current_cpu);
+      @prefix@_sem_init_idesc_table (current_cpu);
 #endif
       CPU_IDESC_SEM_INIT_P (current_cpu) = 1;
     }
@@ -757,7 +774,7 @@
 #define FAST_P 1
 
 void
-@cpu@_engine_run_fast (SIM_CPU *current_cpu)
+@prefix@_engine_run_fast (SIM_CPU *current_cpu)
 {
   SIM_DESC current_state = CPU_STATE (current_cpu);
   SCACHE *scache = CPU_SCACHE_CACHE (current_cpu);
@@ -801,7 +818,7 @@
 #include "$switch"
 #endif
 #else
-      @cpu@_semf_init_idesc_table (current_cpu);
+      @prefix@_semf_init_idesc_table (current_cpu);
 #endif
       CPU_IDESC_SEM_INIT_P (current_cpu) = 1;
     }
@@ -850,7 +867,7 @@
    FAST_P is non-zero if no tracing/profiling/etc. is wanted.  */
 
 INLINE SEM_PC
-@cpu@_pbb_begin (SIM_CPU *current_cpu, int FAST_P)
+@prefix@_pbb_begin (SIM_CPU *current_cpu, int FAST_P)
 {
   SEM_PC new_vpc;
   PCADDR pc;
@@ -933,11 +950,11 @@
 	/* Was pbb terminated by a cti?  */
 	if (_cti_sc)
 	  {
-	    id = & CPU_IDESC (current_cpu) [@CPU@_INSN_X_CTI_CHAIN];
+	    id = & CPU_IDESC (current_cpu) [@PREFIX@_INSN_X_CTI_CHAIN];
 	  }
 	else
 	  {
-	    id = & CPU_IDESC (current_cpu) [@CPU@_INSN_X_CHAIN];
+	    id = & CPU_IDESC (current_cpu) [@PREFIX@_INSN_X_CHAIN];
 	  }
 	SEM_SET_CODE (&sc->argbuf, id, FAST_P);
 	sc->argbuf.idesc = id;
@@ -964,7 +981,7 @@
 /* Chain to the next block from a non-cti terminated previous block.  */
 
 INLINE SEM_PC
-@cpu@_pbb_chain (SIM_CPU *current_cpu, SEM_ARG sem_arg)
+@prefix@_pbb_chain (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
 
@@ -1002,7 +1019,7 @@
    BR_TYPE != SEM_BRANCH_UNTAKEN.  */
 
 INLINE SEM_PC
-@cpu@_pbb_cti_chain (SIM_CPU *current_cpu, SEM_ARG sem_arg,
+@prefix@_pbb_cti_chain (SIM_CPU *current_cpu, SEM_ARG sem_arg,
 		     SEM_BRANCH_TYPE br_type, PCADDR new_pc)
 {
   SEM_PC *new_vpc_ptr;
@@ -1060,7 +1077,7 @@
    This is called before each insn.  */
 
 void
-@cpu@_pbb_before (SIM_CPU *current_cpu, SCACHE *sc)
+@prefix@_pbb_before (SIM_CPU *current_cpu, SCACHE *sc)
 {
   SEM_ARG sem_arg = sc;
   const ARGBUF *abuf = SEM_ARGBUF (sem_arg);
@@ -1087,7 +1104,7 @@
 	  if (ARGBUF_PROFILE_P (prev_abuf))
 	    {
 	      cycles = (*prev_idesc->timing->model_fn) (current_cpu, prev_sem_arg);
-	      @cpu@_model_insn_after (current_cpu, 0 /*last_p*/, cycles);
+	      @prefix@_model_insn_after (current_cpu, 0 /*last_p*/, cycles);
 	    }
 	}
 
@@ -1097,7 +1114,7 @@
   /* FIXME: Later make cover macros: PROFILE_INSN_{INIT,FINI}.  */
   if (PROFILE_MODEL_P (current_cpu)
       && ARGBUF_PROFILE_P (cur_abuf))
-    @cpu@_model_insn_before (current_cpu, first_p);
+    @prefix@_model_insn_before (current_cpu, first_p);
 
   TRACE_INSN_INIT (current_cpu, cur_abuf, first_p);
   TRACE_INSN (current_cpu, cur_idesc->idata, cur_abuf, pc);
@@ -1108,7 +1125,7 @@
    insns.  */
 
 void
-@cpu@_pbb_after (SIM_CPU *current_cpu, SCACHE *sc)
+@prefix@_pbb_after (SIM_CPU *current_cpu, SCACHE *sc)
 {
   SEM_ARG sem_arg = sc;
   const ARGBUF *abuf = SEM_ARGBUF (sem_arg);
@@ -1123,7 +1140,7 @@
       int cycles;
 
       cycles = (*prev_idesc->timing->model_fn) (current_cpu, prev_sem_arg);
-      @cpu@_model_insn_after (current_cpu, 1 /*last_p*/, cycles);
+      @prefix@_model_insn_after (current_cpu, 1 /*last_p*/, cycles);
     }
   TRACE_INSN_FINI (current_cpu, prev_abuf, 1 /*last_p*/);
 }
@@ -1131,7 +1148,7 @@
 #define FAST_P 0
 
 void
-@cpu@_engine_run_full (SIM_CPU *current_cpu)
+@prefix@_engine_run_full (SIM_CPU *current_cpu)
 {
   SIM_DESC current_state = CPU_STATE (current_cpu);
   SCACHE *scache = CPU_SCACHE_CACHE (current_cpu);
@@ -1176,14 +1193,14 @@
 #include "$switch"
 #endif
 #else
-      @cpu@_sem_init_idesc_table (current_cpu);
+      @prefix@_sem_init_idesc_table (current_cpu);
 #endif
 
       /* Initialize the "begin (compile) a pbb" virtual insn.  */
       vpc = CPU_SCACHE_PBB_BEGIN (current_cpu);
       SEM_SET_FULL_CODE (SEM_ARGBUF (vpc),
-			 & CPU_IDESC (current_cpu) [@CPU@_INSN_X_BEGIN]);
-      vpc->argbuf.idesc = & CPU_IDESC (current_cpu) [@CPU@_INSN_X_BEGIN];
+			 & CPU_IDESC (current_cpu) [@PREFIX@_INSN_X_BEGIN]);
+      vpc->argbuf.idesc = & CPU_IDESC (current_cpu) [@PREFIX@_INSN_X_BEGIN];
 
       CPU_IDESC_SEM_INIT_P (current_cpu) = 1;
     }
@@ -1193,7 +1210,7 @@
      pbb we don't want to call pbb_begin each time (which hashes on the pc
      and does a table lookup).  A way to speed this up is to save vpc
      between calls.  */
-  vpc = @cpu@_pbb_begin (current_cpu, FAST_P);
+  vpc = @prefix@_pbb_begin (current_cpu, FAST_P);
 
   do
     {
@@ -1223,7 +1240,7 @@
 #define FAST_P 1
 
 void
-@cpu@_engine_run_fast (SIM_CPU *current_cpu)
+@prefix@_engine_run_fast (SIM_CPU *current_cpu)
 {
   SIM_DESC current_state = CPU_STATE (current_cpu);
   SCACHE *scache = CPU_SCACHE_CACHE (current_cpu);
@@ -1268,14 +1285,14 @@
 #include "$switch"
 #endif
 #else
-      @cpu@_semf_init_idesc_table (current_cpu);
+      @prefix@_semf_init_idesc_table (current_cpu);
 #endif
 
       /* Initialize the "begin (compile) a pbb" virtual insn.  */
       vpc = CPU_SCACHE_PBB_BEGIN (current_cpu);
       SEM_SET_FAST_CODE (SEM_ARGBUF (vpc),
-			 & CPU_IDESC (current_cpu) [@CPU@_INSN_X_BEGIN]);
-      vpc->argbuf.idesc = & CPU_IDESC (current_cpu) [@CPU@_INSN_X_BEGIN];
+			 & CPU_IDESC (current_cpu) [@PREFIX@_INSN_X_BEGIN]);
+      vpc->argbuf.idesc = & CPU_IDESC (current_cpu) [@PREFIX@_INSN_X_BEGIN];
 
       CPU_IDESC_SEM_INIT_P (current_cpu) = 1;
     }
@@ -1285,7 +1302,7 @@
      pbb we don't want to call pbb_begin each time (which hashes on the pc
      and does a table lookup).  A way to speed this up is to save vpc
      between calls.  */
-  vpc = @cpu@_pbb_begin (current_cpu, FAST_P);
+  vpc = @prefix@_pbb_begin (current_cpu, FAST_P);
 
   do
     {
@@ -1307,9 +1324,11 @@
 
 fi # -pbb
 
-# Process @cpu@,@CPU@ appearing in mainloop.in.
-sed -e "s/@cpu@/$cpu/g" -e "s/@CPU@/$CPU/g" < tmp-mloop.cin > mloop.cin
+# Expand @..@ macros appearing in tmp-mloop-{pid}.cin.
+sed \
+  -e "s/@cpu@/$cpu/g" -e "s/@CPU@/$CPU/g" \
+  -e "s/@prefix@/$prefix/g" -e "s/@PREFIX@/$PREFIX/g" < tmp-mloop-$$.cin > mloop${outsuffix}.cin
 rc=$?
-rm -f tmp-mloop.cin
+rm -f tmp-mloop-$$.cin
 
 exit $rc
diff --git a/sim/common/hw-alloc.c b/sim/common/hw-alloc.c
index e64ae82..5664e9b 100644
--- a/sim/common/hw-alloc.c
+++ b/sim/common/hw-alloc.c
@@ -42,8 +42,6 @@
 void
 delete_hw_alloc_data (struct hw *me)
 {
-  if (me->alloc_of_hw != NULL)
-    hw_abort (me, "hw-alloc botch");
   while (me->alloc_of_hw != NULL)
     {
       hw_free (me, me->alloc_of_hw->alloc);
diff --git a/sim/common/hw-base.c b/sim/common/hw-base.c
index a13ac64..9c05da8 100644
--- a/sim/common/hw-base.c
+++ b/sim/common/hw-base.c
@@ -510,10 +510,15 @@
   delete_hw_alloc_data (me);
 
   /* finally */
-  zfree (me->base_of_hw);
   zfree (me);
 }
 
+void
+set_hw_delete (struct hw *hw, hw_delete_callback method)
+{
+  hw->base_of_hw->to_delete = method;
+}
+
 
 /* Go through the devices various reg properties for those that
    specify attach addresses */
diff --git a/sim/common/hw-base.h b/sim/common/hw-base.h
index d6452d1..5760103 100644
--- a/sim/common/hw-base.h
+++ b/sim/common/hw-base.h
@@ -54,8 +54,7 @@
 typedef void (hw_delete_callback)
      (struct hw *me);
 
-#define set_hw_delete(hw, method) \
-((hw)->base_of_hw->to_delete = (method))
+extern void set_hw_delete(struct hw* hw, hw_delete_callback method);
 
 
 /* ALLOC */
diff --git a/sim/common/hw-events.c b/sim/common/hw-events.c
index 31c5a40..243a7aa 100644
--- a/sim/common/hw-events.c
+++ b/sim/common/hw-events.c
@@ -51,8 +51,9 @@
 void
 delete_hw_event_data (struct hw *me)
 {
-  if (me->events_of_hw != NULL)
-    hw_abort (me, "stray events");
+  /* Remove the scheduled event.  */
+  while (me->events_of_hw)
+    hw_event_queue_deschedule (me, &me->events_of_hw->event);
 }
 
 
@@ -164,6 +165,15 @@
   return sim_events_time (hw_system (me));
 }
 
+/* Returns the time that remains before the event is raised. */
+signed64
+hw_event_remain_time (struct hw *me, struct hw_event *event)
+{
+  signed64 t;
+
+  t = sim_events_remain_time (hw_system (me), event->real);
+  return t;
+}
 
 /* Only worry about this compling on ANSI systems.
    Build with `make test-hw-events' in sim/<cpu> directory*/
diff --git a/sim/common/hw-events.h b/sim/common/hw-events.h
index a9b6f8b..29e10fa 100644
--- a/sim/common/hw-events.h
+++ b/sim/common/hw-events.h
@@ -58,4 +58,8 @@
 signed64 hw_event_queue_time
 (struct hw *me);
 
+/* Returns the time that remains before the event is raised. */
+signed64 hw_event_remain_time
+(struct hw *me, struct hw_event *event);
+
 #endif
diff --git a/sim/common/hw-properties.h b/sim/common/hw-properties.h
index 511fba3..198878f 100644
--- a/sim/common/hw-properties.h
+++ b/sim/common/hw-properties.h
@@ -166,7 +166,7 @@
 (struct hw *me,
  const char *property,
  unsigned index,
- signed_word *integer);
+ signed_cell *integer);
 
 
 
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index c5b43a2..ef25d68 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -165,7 +165,8 @@
       
     }
   /* Print any stats the simulator collected.  */
-  sim_info (sd, 0);
+  if (STATE_VERBOSE_P (sd))
+    sim_info (sd, 0);
   
   /* Shutdown the simulator.  */
   sim_close (sd, 0);
diff --git a/sim/common/run.1 b/sim/common/run.1
index 886e20b..ad11210 100644
--- a/sim/common/run.1
+++ b/sim/common/run.1
@@ -87,21 +87,377 @@
 , Richard M. Stallman and Roland H. Pesch.
 
 .SH COPYING
-Copyright (c) 1993 Free Software Foundation, Inc.
+Copyright (c) 1993, 2000 Free Software Foundation, Inc.
 .PP
-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.
-.PP
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the
-entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-.PP
-Permission is granted to copy and distribute translations of this
-manual into another language, under the above conditions for modified
-versions, except that this permission notice may be included in
-translations approved by the Free Software Foundation instead of in
-the original English.
+This document is distributed under the terms of the GNU Free
+Documentation License, version 1.1.  That license is described in the
+sources for this manual page, but it is not displayed here in order to
+make this manual more consise.  Copies of this license can also be
+obtained from: http://www.gnu.org/copyleft/.
 
+\"  GNU Free Documentation License
+\"    Version 1.1, March 2000
 
+\"    Copyright (C) 2000  Free Software Foundation, Inc.
+\"    59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+     
+\"    Everyone is permitted to copy and distribute verbatim
+\"    copies of this license document, but changing it is
+\"    not allowed.
+\"  .PP
+\"  0. PREAMBLE
+\"  .PP
+\"  The purpose of this License is to make a manual, textbook, or other
+\"  written document "free" in the sense of freedom: to assure everyone
+\"  the effective freedom to copy and redistribute it, with or without
+\"  modifying it, either commercially or noncommercially.  Secondarily,
+\"  this License preserves for the author and publisher a way to get
+\"  credit for their work, while not being considered responsible for
+\"  modifications made by others.
+\"  .PP
+\"  This License is a kind of "copyleft", which means that derivative
+\"  works of the document must themselves be free in the same sense.  It
+\"  complements the GNU General Public License, which is a copyleft
+\"  license designed for free software.
+\"  .PP
+\"  We have designed this License in order to use it for manuals for free
+\"  software, because free software needs free documentation: a free
+\"  program should come with manuals providing the same freedoms that the
+\"  software does.  But this License is not limited to software manuals;
+\"  it can be used for any textual work, regardless of subject matter or
+\"  whether it is published as a printed book.  We recommend this License
+\"  principally for works whose purpose is instruction or reference.
+\"  .PP
+\"  1. APPLICABILITY AND DEFINITIONS
+\"  .PP
+\"  This License applies to any manual or other work that contains a
+\"  notice placed by the copyright holder saying it can be distributed
+\"  under the terms of this License.  The "Document", below, refers to any
+\"  such manual or work.  Any member of the public is a licensee, and is
+\"  addressed as "you".
+\"  .PP
+\"  A "Modified Version" of the Document means any work containing the
+\"  Document or a portion of it, either copied verbatim, or with
+\"  modifications and/or translated into another language.
+\"  .PP
+\"  A "Secondary Section" is a named appendix or a front-matter section of
+\"  the Document that deals exclusively with the relationship of the
+\"  publishers or authors of the Document to the Document's overall subject
+\"  (or to related matters) and contains nothing that could fall directly
+\"  within that overall subject.  (For example, if the Document is in part a
+\"  textbook of mathematics, a Secondary Section may not explain any
+\"  mathematics.)  The relationship could be a matter of historical
+\"  connection with the subject or with related matters, or of legal,
+\"  commercial, philosophical, ethical or political position regarding
+\"  them.
+\"  .PP
+\"  The "Invariant Sections" are certain Secondary Sections whose titles
+\"  are designated, as being those of Invariant Sections, in the notice
+\"  that says that the Document is released under this License.
+\"  .PP
+\"  The "Cover Texts" are certain short passages of text that are listed,
+\"  as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+\"  the Document is released under this License.
+\"  .PP
+\"  A "Transparent" copy of the Document means a machine-readable copy,
+\"  represented in a format whose specification is available to the
+\"  general public, whose contents can be viewed and edited directly and
+\"  straightforwardly with generic text editors or (for images composed of
+\"  pixels) generic paint programs or (for drawings) some widely available
+\"  drawing editor, and that is suitable for input to text formatters or
+\"  for automatic translation to a variety of formats suitable for input
+\"  to text formatters.  A copy made in an otherwise Transparent file
+\"  format whose markup has been designed to thwart or discourage
+\"  subsequent modification by readers is not Transparent.  A copy that is
+\"  not "Transparent" is called "Opaque".
+\"  .PP
+\"  Examples of suitable formats for Transparent copies include plain
+\"  ASCII without markup, Texinfo input format, LaTeX input format, SGML
+\"  or XML using a publicly available DTD, and standard-conforming simple
+\"  HTML designed for human modification.  Opaque formats include
+\"  PostScript, PDF, proprietary formats that can be read and edited only
+\"  by proprietary word processors, SGML or XML for which the DTD and/or
+\"  processing tools are not generally available, and the
+\"  machine-generated HTML produced by some word processors for output
+\"  purposes only.
+\"  .PP
+\"  The "Title Page" means, for a printed book, the title page itself,
+\"  plus such following pages as are needed to hold, legibly, the material
+\"  this License requires to appear in the title page.  For works in
+\"  formats which do not have any title page as such, "Title Page" means
+\"  the text near the most prominent appearance of the work's title,
+\"  preceding the beginning of the body of the text.
+\"  .PP
+\"  2. VERBATIM COPYING
+\"  .PP
+\"  You may copy and distribute the Document in any medium, either
+\"  commercially or noncommercially, provided that this License, the
+\"  copyright notices, and the license notice saying this License applies
+\"  to the Document are reproduced in all copies, and that you add no other
+\"  conditions whatsoever to those of this License.  You may not use
+\"  technical measures to obstruct or control the reading or further
+\"  copying of the copies you make or distribute.  However, you may accept
+\"  compensation in exchange for copies.  If you distribute a large enough
+\"  number of copies you must also follow the conditions in section 3.
+\"  .PP
+\"  You may also lend copies, under the same conditions stated above, and
+\"  you may publicly display copies.
+\"  .PP
+\"  3. COPYING IN QUANTITY
+\"  .PP
+\"  If you publish printed copies of the Document numbering more than 100,
+\"  and the Document's license notice requires Cover Texts, you must enclose
+\"  the copies in covers that carry, clearly and legibly, all these Cover
+\"  Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+\"  the back cover.  Both covers must also clearly and legibly identify
+\"  you as the publisher of these copies.  The front cover must present
+\"  the full title with all words of the title equally prominent and
+\"  visible.  You may add other material on the covers in addition.
+\"  Copying with changes limited to the covers, as long as they preserve
+\"  the title of the Document and satisfy these conditions, can be treated
+\"  as verbatim copying in other respects.
+\"  .PP
+\"  If the required texts for either cover are too voluminous to fit
+\"  legibly, you should put the first ones listed (as many as fit
+\"  reasonably) on the actual cover, and continue the rest onto adjacent
+\"  pages.
+\"  .PP
+\"  If you publish or distribute Opaque copies of the Document numbering
+\"  more than 100, you must either include a machine-readable Transparent
+\"  copy along with each Opaque copy, or state in or with each Opaque copy
+\"  a publicly-accessible computer-network location containing a complete
+\"  Transparent copy of the Document, free of added material, which the
+\"  general network-using public has access to download anonymously at no
+\"  charge using public-standard network protocols.  If you use the latter
+\"  option, you must take reasonably prudent steps, when you begin
+\"  distribution of Opaque copies in quantity, to ensure that this
+\"  Transparent copy will remain thus accessible at the stated location
+\"  until at least one year after the last time you distribute an Opaque
+\"  copy (directly or through your agents or retailers) of that edition to
+\"  the public.
+\"  .PP
+\"  It is requested, but not required, that you contact the authors of the
+\"  Document well before redistributing any large number of copies, to give
+\"  them a chance to provide you with an updated version of the Document.
+\"  .PP
+\"  4. MODIFICATIONS
+\"  .PP
+\"  You may copy and distribute a Modified Version of the Document under
+\"  the conditions of sections 2 and 3 above, provided that you release
+\"  the Modified Version under precisely this License, with the Modified
+\"  Version filling the role of the Document, thus licensing distribution
+\"  and modification of the Modified Version to whoever possesses a copy
+\"  of it.  In addition, you must do these things in the Modified Version:
+\"  .PP
+\"  A. Use in the Title Page (and on the covers, if any) a title distinct
+\"  from that of the Document, and from those of previous versions
+\"  (which should, if there were any, be listed in the History section
+\"  of the Document).  You may use the same title as a previous version
+\"  if the original publisher of that version gives permission.
+\"  .PP
+\"  B. List on the Title Page, as authors, one or more persons or entities
+\"  responsible for authorship of the modifications in the Modified
+\"  Version, together with at least five of the principal authors of the
+\"  Document (all of its principal authors, if it has less than five).
+\"  .PP
+\"  C. State on the Title page the name of the publisher of the
+\"  Modified Version, as the publisher.
+\"  .PP
+\"  D. Preserve all the copyright notices of the Document.
+\"  .PP
+\"  E. Add an appropriate copyright notice for your modifications
+\"  adjacent to the other copyright notices.
+\"  .PP
+\"  F. Include, immediately after the copyright notices, a license notice
+\"  giving the public permission to use the Modified Version under the
+\"  terms of this License, in the form shown in the Addendum below.
+\"  Preserve in that license notice the full lists of Invariant Sections
+\"  and required Cover Texts given in the Document's license notice.
+\"  .PP
+\"  H. Include an unaltered copy of this License.
+\"  .PP
+\"  I. Preserve the section entitled "History", and its title, and add to
+\"  it an item stating at least the title, year, new authors, and
+\"  publisher of the Modified Version as given on the Title Page.  If
+\"  there is no section entitled "History" in the Document, create one
+\"  stating the title, year, authors, and publisher of the Document as
+\"  given on its Title Page, then add an item describing the Modified
+\"  Version as stated in the previous sentence.
+\"  .PP
+\"  J. Preserve the network location, if any, given in the Document for
+\"  public access to a Transparent copy of the Document, and likewise
+\"  the network locations given in the Document for previous versions
+\"  it was based on.  These may be placed in the "History" section.
+\"  You may omit a network location for a work that was published at
+\"  least four years before the Document itself, or if the original
+\"  publisher of the version it refers to gives permission.
+\"  .PP
+\"  K. In any section entitled "Acknowledgements" or "Dedications",
+\"  preserve the section's title, and preserve in the section all the
+\"  substance and tone of each of the contributor acknowledgements
+\"  and/or dedications given therein.
+\"  .PP
+\"  L. Preserve all the Invariant Sections of the Document,
+\"  unaltered in their text and in their titles.  Section numbers
+\"  or the equivalent are not considered part of the section titles.
+\"  .PP
+\"  M. Delete any section entitled "Endorsements".  Such a section
+\"  may not be included in the Modified Version.
+\"  .PP
+\"  N. Do not retitle any existing section as "Endorsements"
+\"  or to conflict in title with any Invariant Section.
+\"  .PP
+\"  If the Modified Version includes new front-matter sections or
+\"  appendices that qualify as Secondary Sections and contain no material
+\"  copied from the Document, you may at your option designate some or all
+\"  of these sections as invariant.  To do this, add their titles to the
+\"  list of Invariant Sections in the Modified Version's license notice.
+\"  These titles must be distinct from any other section titles.
+\"  .PP
+\"  You may add a section entitled "Endorsements", provided it contains
+\"  nothing but endorsements of your Modified Version by various
+\"  parties--for example, statements of peer review or that the text has
+\"  been approved by an organization as the authoritative definition of a
+\"  standard.
+\"  .PP
+\"  You may add a passage of up to five words as a Front-Cover Text, and a
+\"  passage of up to 25 words as a Back-Cover Text, to the end of the list
+\"  of Cover Texts in the Modified Version.  Only one passage of
+\"  Front-Cover Text and one of Back-Cover Text may be added by (or
+\"  through arrangements made by) any one entity.  If the Document already
+\"  includes a cover text for the same cover, previously added by you or
+\"  by arrangement made by the same entity you are acting on behalf of,
+\"  you may not add another; but you may replace the old one, on explicit
+\"  permission from the previous publisher that added the old one.
+\"  .PP
+\"  The author(s) and publisher(s) of the Document do not by this License
+\"  give permission to use their names for publicity for or to assert or
+\"  imply endorsement of any Modified Version.
+\"  .PP
+
+\"  5. COMBINING DOCUMENTS
+\"  .PP
+\"  You may combine the Document with other documents released under this
+\"  License, under the terms defined in section 4 above for modified
+\"  versions, provided that you include in the combination all of the
+\"  Invariant Sections of all of the original documents, unmodified, and
+\"  list them all as Invariant Sections of your combined work in its
+\"  license notice.
+\"  .PP
+\"  The combined work need only contain one copy of this License, and
+\"  multiple identical Invariant Sections may be replaced with a single
+\"  copy.  If there are multiple Invariant Sections with the same name but
+\"  different contents, make the title of each such section unique by
+\"  adding at the end of it, in parentheses, the name of the original
+\"  author or publisher of that section if known, or else a unique number.
+\"  Make the same adjustment to the section titles in the list of
+\"  Invariant Sections in the license notice of the combined work.
+\"  .PP
+\"  In the combination, you must combine any sections entitled "History"
+\"  in the various original documents, forming one section entitled
+\"  "History"; likewise combine any sections entitled "Acknowledgements",
+\"  and any sections entitled "Dedications".  You must delete all sections
+\"  entitled "Endorsements."
+\"  .PP
+
+\"  6. COLLECTIONS OF DOCUMENTS
+\"  .PP
+\"  You may make a collection consisting of the Document and other documents
+\"  released under this License, and replace the individual copies of this
+\"  License in the various documents with a single copy that is included in
+\"  the collection, provided that you follow the rules of this License for
+\"  verbatim copying of each of the documents in all other respects.
+\"  .PP
+\"  You may extract a single document from such a collection, and distribute
+\"  it individually under this License, provided you insert a copy of this
+\"  License into the extracted document, and follow this License in all
+\"  other respects regarding verbatim copying of that document.
+\"  .PP
+
+\"  7. AGGREGATION WITH INDEPENDENT WORKS
+\"  .PP
+\"  A compilation of the Document or its derivatives with other separate
+\"  and independent documents or works, in or on a volume of a storage or
+\"  distribution medium, does not as a whole count as a Modified Version
+\"  of the Document, provided no compilation copyright is claimed for the
+\"  compilation.  Such a compilation is called an "aggregate", and this
+\"  License does not apply to the other self-contained works thus compiled
+\"  with the Document, on account of their being thus compiled, if they
+\"  are not themselves derivative works of the Document.
+\"  .PP
+\"  If the Cover Text requirement of section 3 is applicable to these
+\"  copies of the Document, then if the Document is less than one quarter
+\"  of the entire aggregate, the Document's Cover Texts may be placed on
+\"  covers that surround only the Document within the aggregate.
+\"  Otherwise they must appear on covers around the whole aggregate.
+\"  .PP
+
+\"  8. TRANSLATION
+\"  .PP
+\"  Translation is considered a kind of modification, so you may
+\"  distribute translations of the Document under the terms of section 4.
+\"  Replacing Invariant Sections with translations requires special
+\"  permission from their copyright holders, but you may include
+\"  translations of some or all Invariant Sections in addition to the
+\"  original versions of these Invariant Sections.  You may include a
+\"  translation of this License provided that you also include the
+\"  original English version of this License.  In case of a disagreement
+\"  between the translation and the original English version of this
+\"  License, the original English version will prevail.
+\"  .PP
+
+\"  9. TERMINATION
+\"  .PP
+\"  You may not copy, modify, sublicense, or distribute the Document except
+\"  as expressly provided for under this License.  Any other attempt to
+\"  copy, modify, sublicense or distribute the Document 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.
+\"  .PP
+
+\"  10. FUTURE REVISIONS OF THIS LICENSE
+\"  .PP
+\"  The Free Software Foundation may publish new, revised versions
+\"  of the GNU Free Documentation 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.  See
+\"  http://www.gnu.org/copyleft/.
+\"  .PP
+\"  Each version of the License is given a distinguishing version number.
+\"  If the Document specifies that a particular numbered version of this
+\"  License "or any later version" applies to it, you have the option of
+\"  following the terms and conditions either of that specified version or
+\"  of any later version that has been published (not as a draft) by the
+\"  Free Software Foundation.  If the Document does not specify a version
+\"  number of this License, you may choose any version ever published (not
+\"  as a draft) by the Free Software Foundation.
+\"  .PP
+
+\"  ADDENDUM: How to use this License for your documents
+\"  .PP
+\"  To use this License in a document you have written, include a copy of
+\"  the License in the document and put the following copyright and
+\"  license notices just after the title page:
+\"  .PP
+\"      Copyright (c)  YEAR  YOUR NAME.
+\"      Permission is granted to copy, distribute and/or
+\"      modify this document under the terms of the GNU
+\"      Free Documentation License, Version 1.1 or any later
+\"      version published by the Free Software Foundation;
+\"      with the Invariant Sections being LIST THEIR TITLES,
+\"      with the Front-Cover Texts being LIST, and with the
+\"      Back-Cover Texts being LIST.  A copy of the license
+\"      is included in the section entitled "GNU Free
+\"      Documentation License".
+\"  .PP
+\"  If you have no Invariant Sections, write "with no Invariant Sections"
+\"  instead of saying which ones are invariant.  If you have no
+\"  Front-Cover Texts, write "no Front-Cover Texts" instead of
+\"  "Front-Cover Texts being LIST"; likewise for Back-Cover Texts.
+\"  .PP
+\"  If your document contains nontrivial examples of program code, we
+\"  recommend releasing these examples in parallel under your choice of
+\"  free software license, such as the GNU General Public License,
+\"  to permit their use in free software.
diff --git a/sim/common/sim-bits.c b/sim/common/sim-bits.c
index ecfb73b..4ba0f79 100644
--- a/sim/common/sim-bits.c
+++ b/sim/common/sim-bits.c
@@ -72,6 +72,17 @@
       return val;
     }
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+  if (stop >= 16)
+    return 0;
+  else
+    {
+      if (start < 16)
+	val &= LSMASK (start, 0);
+      val >>= stop;
+      return val;
+    }
+#endif
 }
 
 
@@ -96,6 +107,17 @@
       return val;
     }
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+  if (stop < 16)
+    return 0;
+  else
+    {
+      if (start >= 16)
+	val &= MSMASK (start, 64 - 1);
+      val >>= (64 - stop - 1);
+      return val;
+    }
+#endif
 }
 
 
@@ -121,6 +143,18 @@
       return val;
     }
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+  /* Bit numbers are 63..0, even for 16 bit targets.
+     On 16 bit targets we ignore 63..16  */
+  if (stop >= 16)
+    return 0;
+  else
+    {
+      val <<= stop;
+      val &= LSMASK (start, stop);
+      return val;
+    }
+#endif
 }
 
 INLINE_SIM_BITS\
@@ -145,6 +179,18 @@
       return val;
     }
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+  /* Bit numbers are 0..63, even for 16 bit targets.
+     On 16 bit targets we ignore 0..47.  */
+  if (stop < 32 + 16)
+    return 0;
+  else
+    {
+      val <<= ((64 - 1) - stop);
+      val &= MSMASK (start, stop);
+      return val;
+    }
+#endif
 }
 
 
@@ -166,6 +212,14 @@
     return val;
   }
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+  if (sign_bit >= 16)
+    return val;
+  else {
+    val = LSSEXT16 (val, sign_bit);
+    return val;
+  }
+#endif
 }
 
 INLINE_SIM_BITS\
@@ -185,6 +239,14 @@
     return val;
   }
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+  if (sign_bit < 32 + 16)
+    return val;
+  else {
+    val = MSSEXT16 (val, sign_bit - 32 - 16);
+    return val;
+  }
+#endif
 }
 
 
diff --git a/sim/common/sim-bits.h b/sim/common/sim-bits.h
index d111bcd..caebf0a 100644
--- a/sim/common/sim-bits.h
+++ b/sim/common/sim-bits.h
@@ -166,20 +166,32 @@
 #define _MSB_32(START, STOP) (START <= STOP \
 			      ? (START < 32 ? 0 : START - 32) \
 			      : (STOP < 32 ? 0 : STOP - 32))
+#define _MSB_16(START, STOP) (START <= STOP \
+			      ? (START < 48 ? 0 : START - 48) \
+			      : (STOP < 48 ? 0 : STOP - 48))
 #else
 #define _MSB_32(START, STOP) (START >= STOP \
 			      ? (START >= 32 ? 31 : START) \
 			      : (STOP >= 32 ? 31 : STOP))
+#define _MSB_16(START, STOP) (START >= STOP \
+			      ? (START >= 16 ? 15 : START) \
+			      : (STOP >= 16 ? 15 : STOP))
 #endif
 
 #if (WITH_TARGET_WORD_MSB == 0)
 #define _LSB_32(START, STOP) (START <= STOP \
 			      ? (STOP < 32 ? 0 : STOP - 32) \
 			      : (START < 32 ? 0 : START - 32))
+#define _LSB_16(START, STOP) (START <= STOP \
+			      ? (STOP < 48 ? 0 : STOP - 48) \
+			      : (START < 48 ? 0 : START - 48))
 #else
 #define _LSB_32(START, STOP) (START >= STOP \
 			      ? (STOP >= 32 ? 31 : STOP) \
 			      : (START >= 32 ? 31 : START))
+#define _LSB_16(START, STOP) (START >= STOP \
+			      ? (STOP >= 16 ? 15 : STOP) \
+			      : (START >= 16 ? 15 : START))
 #endif
 
 #if (WITH_TARGET_WORD_MSB == 0)
@@ -204,11 +216,17 @@
 
 #if (WITH_TARGET_WORD_BITSIZE == 64)
 #define LSBIT(POS) LSBIT64 (POS)
-#else
+#endif
+#if (WITH_TARGET_WORD_BITSIZE == 32)
 #define LSBIT(POS) ((unsigned32)((POS) >= 32 \
 		                 ? 0 \
 			         : (1 << ((POS) >= 32 ? 0 : (POS)))))
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+#define LSBIT(POS) ((unsigned16)((POS) >= 16 \
+		                 ? 0 \
+			         : (1 << ((POS) >= 16 ? 0 : (POS)))))
+#endif
 
 
 #define MSBIT8(POS)  ((unsigned8) 1 << ( 8 - 1 - (POS)))
@@ -218,11 +236,17 @@
 
 #if (WITH_TARGET_WORD_BITSIZE == 64)
 #define MSBIT(POS) MSBIT64 (POS)
-#else
+#endif
+#if (WITH_TARGET_WORD_BITSIZE == 32)
 #define MSBIT(POS) ((unsigned32)((POS) < 32 \
 		                 ? 0 \
 		                 : (1 << ((POS) < 32 ? 0 : (64 - 1) - (POS)))))
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+#define MSBIT(POS) ((unsigned16)((POS) < 48 \
+		                 ? 0 \
+		                 : (1 << ((POS) < 48 ? 0 : (64 - 1) - (POS)))))
+#endif
 
 
 /* Bit operations */
@@ -287,6 +311,23 @@
 		      _MSB_POS (32, 0), \
 		      _MSB_32 ((START), (STOP))))))
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+#define MASK(START, STOP) \
+     (_POS_LE ((START), (STOP)) \
+      ? (_POS_LE ((STOP), _MSB_POS (64, 15)) \
+	 ? 0 \
+	 : _MASKn (16, \
+		   _MSB_16 ((START), (STOP)), \
+		   _LSB_16 ((START), (STOP)))) \
+      : (_MASKn (16, \
+		 _LSB_16 ((START), (STOP)), \
+		 _LSB_POS (16, 0)) \
+	 | (_POS_LE ((STOP), _MSB_POS (64, 15)) \
+	    ? 0 \
+	    : _MASKn (16, \
+		      _MSB_POS (16, 0), \
+		      _MSB_16 ((START), (STOP))))))
+#endif
 #if !defined (MASK)
 #error "MASK never undefined"
 #endif
@@ -475,6 +516,9 @@
 #if (WITH_TARGET_WORD_BITSIZE == 32)
 #define EXTENDED(X)     (X)
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+#define EXTENDED(X)     (X)
+#endif
 
 
 /* memory alignment macro's */
diff --git a/sim/common/sim-endian.h b/sim/common/sim-endian.h
index d733c82..8239aa0 100644
--- a/sim/common/sim-endian.h
+++ b/sim/common/sim-endian.h
@@ -80,53 +80,53 @@
 
 /* SWAP */
 
-#define SWAP_1(X) swap_1(X)
-#define SWAP_2(X) swap_2(X)
-#define SWAP_4(X) swap_4(X)
-#define SWAP_8(X) swap_8(X)
-#define SWAP_16(X) swap_16(X)
+#define SWAP_1 swap_1
+#define SWAP_2 swap_2
+#define SWAP_4 swap_4
+#define SWAP_8 swap_8
+#define SWAP_16 swap_16
 
 
 /* HOST to BE */
 
-#define H2BE_1(X) endian_h2be_1(X)
-#define H2BE_2(X) endian_h2be_2(X)
-#define H2BE_4(X) endian_h2be_4(X)
-#define H2BE_8(X) endian_h2be_8(X)
-#define H2BE_16(X) endian_h2be_16(X)
-#define BE2H_1(X) endian_be2h_1(X)
-#define BE2H_2(X) endian_be2h_2(X)
-#define BE2H_4(X) endian_be2h_4(X)
-#define BE2H_8(X) endian_be2h_8(X)
-#define BE2H_16(X) endian_be2h_16(X)
+#define H2BE_1 endian_h2be_1
+#define H2BE_2 endian_h2be_2
+#define H2BE_4 endian_h2be_4
+#define H2BE_8 endian_h2be_8
+#define H2BE_16 endian_h2be_16
+#define BE2H_1 endian_be2h_1
+#define BE2H_2 endian_be2h_2
+#define BE2H_4 endian_be2h_4
+#define BE2H_8 endian_be2h_8
+#define BE2H_16 endian_be2h_16
 
 
 /* HOST to LE */
 
-#define H2LE_1(X) endian_h2le_1(X)
-#define H2LE_2(X) endian_h2le_2(X)
-#define H2LE_4(X) endian_h2le_4(X)
-#define H2LE_8(X) endian_h2le_8(X)
-#define H2LE_16(X) endian_h2le_16(X)
-#define LE2H_1(X) endian_le2h_1(X)
-#define LE2H_2(X) endian_le2h_2(X)
-#define LE2H_4(X) endian_le2h_4(X)
-#define LE2H_8(X) endian_le2h_8(X)
-#define LE2H_16(X) endian_le2h_16(X)
+#define H2LE_1 endian_h2le_1
+#define H2LE_2 endian_h2le_2
+#define H2LE_4 endian_h2le_4
+#define H2LE_8 endian_h2le_8
+#define H2LE_16 endian_h2le_16
+#define LE2H_1 endian_le2h_1
+#define LE2H_2 endian_le2h_2
+#define LE2H_4 endian_le2h_4
+#define LE2H_8 endian_le2h_8
+#define LE2H_16 endian_le2h_16
 
 
 /* HOST to TARGET */
 
-#define H2T_1(X) endian_h2t_1(X)
-#define H2T_2(X) endian_h2t_2(X)
-#define H2T_4(X) endian_h2t_4(X)
-#define H2T_8(X) endian_h2t_8(X)
-#define H2T_16(X) endian_h2t_16(X)
-#define T2H_1(X) endian_t2h_1(X)
-#define T2H_2(X) endian_t2h_2(X)
-#define T2H_4(X) endian_t2h_4(X)
-#define T2H_8(X) endian_t2h_8(X)
-#define T2H_16(X) endian_t2h_16(X)
+#define H2T_1 endian_h2t_1
+#define H2T_2 endian_h2t_2
+#define H2T_4 endian_h2t_4
+#define H2T_8 endian_h2t_8
+#define H2T_16 endian_h2t_16
+#define T2H_1 endian_t2h_1
+#define T2H_2 endian_t2h_2
+#define T2H_4 endian_t2h_4
+#define T2H_8 endian_t2h_8
+#define T2H_16 endian_t2h_16
 
 
 /* CONVERT IN PLACE
@@ -219,22 +219,22 @@
    Byte swap a quantity the size of the targets word */
 
 #if (WITH_TARGET_WORD_BITSIZE == 64)
-#define H2T_word(X) H2T_8(X)
-#define T2H_word(X) T2H_8(X)
-#define H2BE_word(X) H2BE_8(X)
-#define BE2H_word(X) BE2H_8(X)
-#define H2LE_word(X) H2LE_8(X)
-#define LE2H_word(X) LE2H_8(X)
-#define SWAP_word(X) SWAP_8(X)
+#define H2T_word H2T_8
+#define T2H_word T2H_8
+#define H2BE_word H2BE_8
+#define BE2H_word BE2H_8
+#define H2LE_word H2LE_8
+#define LE2H_word LE2H_8
+#define SWAP_word SWAP_8
 #endif
 #if (WITH_TARGET_WORD_BITSIZE == 32)
-#define H2T_word(X) H2T_4(X)
-#define T2H_word(X) T2H_4(X)
-#define H2BE_word(X) H2BE_4(X)
-#define BE2H_word(X) BE2H_4(X)
-#define H2LE_word(X) H2LE_4(X)
-#define LE2H_word(X) LE2H_4(X)
-#define SWAP_word(X) SWAP_4(X)
+#define H2T_word H2T_4
+#define T2H_word T2H_4
+#define H2BE_word H2BE_4
+#define BE2H_word BE2H_4
+#define H2LE_word H2LE_4
+#define LE2H_word LE2H_4
+#define SWAP_word SWAP_4
 #endif
 
 
@@ -243,13 +243,13 @@
 
    Byte swap a quantity the size of the targets IEEE 1275 memory cell */
 
-#define H2T_cell(X) H2T_4(X)
-#define T2H_cell(X) T2H_4(X)
-#define H2BE_cell(X) H2BE_4(X)
-#define BE2H_cell(X) BE2H_4(X)
-#define H2LE_cell(X) H2LE_4(X)
-#define LE2H_cell(X) LE2H_4(X)
-#define SWAP_cell(X) SWAP_4(X)
+#define H2T_cell H2T_4
+#define T2H_cell T2H_4
+#define H2BE_cell H2BE_4
+#define BE2H_cell BE2H_4
+#define H2LE_cell H2LE_4
+#define LE2H_cell LE2H_4
+#define SWAP_cell SWAP_4
 
 
 
diff --git a/sim/common/sim-events.c b/sim/common/sim-events.c
index fa294a7..1866b2d 100644
--- a/sim/common/sim-events.c
+++ b/sim/common/sim-events.c
@@ -379,6 +379,19 @@
 }
 
 
+/* Returns the time that remains before the event is raised. */
+INLINE_SIM_EVENTS\
+(signed64)
+sim_events_remain_time (SIM_DESC sd, sim_event *event)
+{
+  if (event == 0)
+    return 0;
+  
+  return (event->time_of_event - sim_events_time (sd));
+}
+
+
+
 STATIC_INLINE_SIM_EVENTS\
 (void)
 update_time_from_event (SIM_DESC sd)
diff --git a/sim/common/sim-events.h b/sim/common/sim-events.h
index 3bae3df..55b2b74 100644
--- a/sim/common/sim-events.h
+++ b/sim/common/sim-events.h
@@ -268,4 +268,10 @@
 (unsigned long) sim_events_elapsed_time
 (SIM_DESC sd);
 
+/* Returns the time that remains before the event is raised. */
+INLINE_SIM_EVENTS\
+(signed64) sim_events_remain_time
+(SIM_DESC sd, sim_event *event);
+
+
 #endif
diff --git a/sim/common/sim-fpu.c b/sim/common/sim-fpu.c
index 99381e0..76391751 100644
--- a/sim/common/sim-fpu.c
+++ b/sim/common/sim-fpu.c
@@ -51,25 +51,30 @@
 #include "sim-assert.h"
 
 
-/* Debugging support. */
+/* Debugging support. 
+   If digits is -1, then print all digits.  */
 
 static void
 print_bits (unsigned64 x,
 	    int msbit,
+	    int digits,
 	    sim_fpu_print_func print,
 	    void *arg)
 {
   unsigned64 bit = LSBIT64 (msbit);
   int i = 4;
-  while (bit)
+  while (bit && digits)
     {
       if (i == 0)
 	print (arg, ",");
+
       if ((x & bit))
 	print (arg, "1");
       else
 	print (arg, "0");
       bit >>= 1;
+
+      if (digits > 0) digits--;
       i = (i + 1) % 4;
     }
 }
@@ -1375,14 +1380,6 @@
     ASSERT (high >= LSBIT64 ((NR_FRAC_GUARD * 2) - 64));
     ASSERT (LSBIT64 (((NR_FRAC_GUARD + 1) * 2) - 64) < IMPLICIT_1);
 
-#if 0
-    printf ("\n");
-    print_bits (high, 63, (sim_fpu_print_func*)fprintf, stdout);
-    printf (";");
-    print_bits (low, 63, (sim_fpu_print_func*)fprintf, stdout);
-    printf ("\n");
-#endif
-
     /* normalize */
     do
       {
@@ -1394,13 +1391,6 @@
       }
     while (high < IMPLICIT_1);
 
-#if 0
-    print_bits (high, 63, (sim_fpu_print_func*)fprintf, stdout);
-    printf (";");
-    print_bits (low, 63, (sim_fpu_print_func*)fprintf, stdout);
-    printf ("\n");
-#endif
-
     ASSERT (high >= IMPLICIT_1 && high < IMPLICIT_2);
     if (low != 0)
       {
@@ -1530,16 +1520,6 @@
 	numerator <<= 1;
       }
 
-#if 0
-    printf ("\n");
-    print_bits (quotient, 63, (sim_fpu_print_func*)fprintf, stdout);
-    printf ("\n");
-    print_bits (numerator, 63, (sim_fpu_print_func*)fprintf, stdout);
-    printf ("\n");
-    print_bits (denominator, 63, (sim_fpu_print_func*)fprintf, stdout);
-    printf ("\n");
-#endif
-
     /* discard (but save) the extra bits */
     if ((quotient & LSMASK64 (NR_SPARE -1, 0)))
       quotient = (quotient >> NR_SPARE) | 1;
@@ -2456,10 +2436,10 @@
   sim_fpu_class_qnan,
 };
 const sim_fpu sim_fpu_one = {
-  sim_fpu_class_number, 0, IMPLICIT_1, 1
+  sim_fpu_class_number, 0, IMPLICIT_1, 0
 };
 const sim_fpu sim_fpu_two = {
-  sim_fpu_class_number, 0, IMPLICIT_1, 2
+  sim_fpu_class_number, 0, IMPLICIT_1, 1
 };
 const sim_fpu sim_fpu_max32 = {
   sim_fpu_class_number, 0, LSMASK64 (NR_FRAC_GUARD, NR_GUARDS32), NORMAL_EXPMAX32
@@ -2477,17 +2457,26 @@
 		   sim_fpu_print_func *print,
 		   void *arg)
 {
+  sim_fpu_printn_fpu (f, print, -1, arg);
+}
+
+INLINE_SIM_FPU (void)
+sim_fpu_printn_fpu (const sim_fpu *f,
+		   sim_fpu_print_func *print,
+		   int digits,
+		   void *arg)
+{
   print (arg, "%s", f->sign ? "-" : "+");
   switch (f->class)
     {
     case sim_fpu_class_qnan:
       print (arg, "0.");
-      print_bits (f->fraction, NR_FRAC_GUARD - 1, print, arg);
+      print_bits (f->fraction, NR_FRAC_GUARD - 1, digits, print, arg);
       print (arg, "*QuietNaN");
       break;
     case sim_fpu_class_snan:
       print (arg, "0.");
-      print_bits (f->fraction, NR_FRAC_GUARD - 1, print, arg);
+      print_bits (f->fraction, NR_FRAC_GUARD - 1, digits, print, arg);
       print (arg, "*SignalNaN");
       break;
     case sim_fpu_class_zero:
@@ -2499,8 +2488,8 @@
     case sim_fpu_class_number:
     case sim_fpu_class_denorm:
       print (arg, "1.");
-      print_bits (f->fraction, NR_FRAC_GUARD - 1, print, arg);
-      print (arg, "*2^%+-5d", f->normal_exp);
+      print_bits (f->fraction, NR_FRAC_GUARD - 1, digits, print, arg);
+      print (arg, "*2^%+d", f->normal_exp);
       ASSERT (f->fraction >= IMPLICIT_1);
       ASSERT (f->fraction < IMPLICIT_2);
     }
diff --git a/sim/common/sim-fpu.h b/sim/common/sim-fpu.h
index 05d53c2..91adad8 100644
--- a/sim/common/sim-fpu.h
+++ b/sim/common/sim-fpu.h
@@ -164,9 +164,9 @@
    When converting from the sim_fpu internal type to 32/64 bit packed
    format, the operation may result in a loss of precision. The
    configuration macro WITH_FPU_CONVERSION controls this.  By default,
-   silent round to nearest is performed.  Alternativly, round up,
+   silent round to nearest is performed.  Alternatively, round up,
    round down and round to zero can be performed.  In a simulator
-   emulating exact FPU behavour, sim_fpu_round_{32,64} should be
+   emulating exact FPU behavior, sim_fpu_round_{32,64} should be
    called before packing the sim_fpu value.  */
 
 INLINE_SIM_FPU (void) sim_fpu_32to (sim_fpu *f, unsigned32 s);
@@ -189,7 +189,7 @@
 
 INLINE_SIM_FPU (void) sim_fpu_fractionto (sim_fpu *f, int sign, int normal_exp, unsigned64 fraction, int precision);
 
-/* Reverse operaton.  If S is a non-zero number, discards the implied
+/* Reverse operation.  If S is a non-zero number, discards the implied
    leading one and returns PRECISION fraction bits.  No rounding is
    performed. */
 INLINE_SIM_FPU (unsigned64) sim_fpu_tofraction (const sim_fpu *s, int precision);
@@ -210,7 +210,7 @@
 
 
 
-/* Arrithmetic operators.
+/* Arithmetic operators.
 
    FIXME: In the future, additional arguments ROUNDING and BITSIZE may
    be added. */
@@ -283,7 +283,7 @@
 
 /* Conversion of internal sim_fpu type to host double format.
 
-   For debuging/tracing only.  A SNaN is never returned. */
+   For debugging/tracing only.  A SNaN is never returned. */
 
 /* INLINE_SIM_FPU (float) sim_fpu_2f (const sim_fpu *f); */
 INLINE_SIM_FPU (double) sim_fpu_2d (const sim_fpu *d);
@@ -402,10 +402,17 @@
 
 typedef void sim_fpu_print_func (void *, char *, ...);
 
+/* Print a sim_fpu with full precision.  */
 INLINE_SIM_FPU (void) sim_fpu_print_fpu (const sim_fpu *f,
 					 sim_fpu_print_func *print,
 					 void *arg);
 
+/* Print a sim_fpu with `n' trailing digits.  */
+INLINE_SIM_FPU (void) sim_fpu_printn_fpu (const sim_fpu *f,
+					  sim_fpu_print_func *print,
+					  int digits,
+					  void *arg);
+
 INLINE_SIM_FPU (void) sim_fpu_print_status (int status,
 					    sim_fpu_print_func *print,
 					    void *arg);
diff --git a/sim/common/sim-hw.c b/sim/common/sim-hw.c
index f438462..922b8ec 100644
--- a/sim/common/sim-hw.c
+++ b/sim/common/sim-hw.c
@@ -41,7 +41,7 @@
 #include <stdlib.h>
 #endif
 #include <ctype.h>
-#include <sys/errno.h>
+#include <errno.h>
 
 
 struct sim_hw {
@@ -101,6 +101,7 @@
   OPTION_HW_INFO = OPTION_START,
   OPTION_HW_TRACE,
   OPTION_HW_DEVICE,
+  OPTION_HW_LIST,
   OPTION_HW_FILE,
 };
 
@@ -126,6 +127,10 @@
       '\0', "DEVICE", "Add the specified device",
       hw_option_handler },
 
+  { {"hw-list", no_argument, NULL, OPTION_HW_LIST },
+      '\0', NULL, "List the device tree",
+      hw_option_handler },
+
   { {"hw-file", required_argument, NULL, OPTION_HW_FILE },
       '\0', "FILE", "Add the devices listed in the file",
       hw_option_handler },
@@ -257,6 +262,12 @@
 	return SIM_RC_OK;
       }
 
+    case OPTION_HW_LIST:
+      {
+	sim_hw_print (sd, sim_io_vprintf);
+	return SIM_RC_OK;
+      }
+  
     case OPTION_HW_FILE:
       {
 	return merge_device_file (sd, arg);
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index 077019c..9ccc51d 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -499,6 +499,7 @@
   const OPTION *opt;
   OPTION_HANDLER **handlers;
   sim_cpu **opt_cpu;
+  SIM_RC result = SIM_RC_OK;
 
   /* Count the number of arguments.  */
   for (argc = 0; argv[argc] != NULL; ++argc)
@@ -579,7 +580,8 @@
 	    if (opt->shortopt != 0)
 	      {
 		sim_io_eprintf (sd, "internal error, short cpu specific option");
-		return SIM_RC_FAIL;
+		result = SIM_RC_FAIL;
+		break;
 	      }
 	    if (opt->opt.name != NULL)
 	      {
@@ -617,13 +619,24 @@
 	  break;
 	}
       if (optc == '?')
-	return SIM_RC_FAIL;
+	{
+	  result = SIM_RC_FAIL;
+	  break;
+	}
 
       if ((*handlers[optc]) (sd, opt_cpu[optc], orig_val[optc], optarg, 0/*!is_command*/) == SIM_RC_FAIL)
-	return SIM_RC_FAIL;
+	{
+	  result = SIM_RC_FAIL;
+	  break;
+	}
     }
 
-  return SIM_RC_OK;
+  zfree (long_options);
+  zfree (short_options);
+  zfree (handlers);
+  zfree (opt_cpu);
+  zfree (orig_val);
+  return result;
 }
 
 /* Utility of sim_print_help to print a list of option tables.  */
diff --git a/sim/common/sim-profile.c b/sim/common/sim-profile.c
index 9129a38..1ac148d 100644
--- a/sim/common/sim-profile.c
+++ b/sim/common/sim-profile.c
@@ -1,5 +1,5 @@
 /* Default profiling support.
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
 
 This file is part of GDB, the GNU debugger.
@@ -34,6 +34,7 @@
 #include <strings.h>
 #endif
 #endif
+#include <ctype.h>
 
 #define COMMAS(n) sim_add_commas (comma_buf, sizeof (comma_buf), (n))
 
@@ -48,6 +49,7 @@
   OPTION_PROFILE_MODEL,
   OPTION_PROFILE_FILE,
   OPTION_PROFILE_CORE,
+  OPTION_PROFILE_CPU_FREQUENCY,
   OPTION_PROFILE_PC,
   OPTION_PROFILE_PC_RANGE,
   OPTION_PROFILE_PC_GRANULARITY,
@@ -71,6 +73,10 @@
   { {"profile-model", optional_argument, NULL, OPTION_PROFILE_MODEL},
       '\0', "on|off", "Perform model profiling",
       profile_option_handler },
+  { {"profile-cpu-frequency", required_argument, NULL,
+     OPTION_PROFILE_CPU_FREQUENCY},
+      '\0', "CPU FREQUENCY", "Specify the speed of the simulated cpu clock",
+      profile_option_handler },
 
   { {"profile-file", required_argument, NULL, OPTION_PROFILE_FILE},
       '\0', "FILE NAME", "Specify profile output file",
@@ -189,13 +195,60 @@
 }
 
 static SIM_RC
+parse_frequency (SIM_DESC sd, const char *arg, unsigned long *freq)
+{
+  const char *ch;
+  /* First, parse a decimal number.  */
+  *freq = 0;
+  ch = arg;
+  if (isdigit (*arg))
+    {
+      for (/**/; *ch != '\0'; ++ch)
+	{
+	  if (! isdigit (*ch))
+	    break;
+	  *freq = *freq * 10 + (*ch - '0');
+	}
+
+      /* Accept KHz, MHz or Hz as a suffix.  */
+      if (tolower (*ch) == 'm')
+	{
+	  *freq *= 1000000;
+	  ++ch;
+	}
+      else if (tolower (*ch) == 'k')
+	{
+	  *freq *= 1000;
+	  ++ch;
+	}
+
+      if (tolower (*ch) == 'h')
+	{
+	  ++ch;
+	  if (tolower (*ch) == 'z')
+	    ++ch;
+	}
+    }
+
+  if (*ch != '\0')
+    {
+      sim_io_eprintf (sd, "Invalid argument for --profile-cpu-frequency: %s\n",
+		      arg);
+      *freq = 0;
+      return SIM_RC_FAIL;
+    }
+
+  return SIM_RC_OK;
+}
+
+static SIM_RC
 profile_option_handler (SIM_DESC sd,
 			sim_cpu *cpu,
 			int opt,
 			char *arg,
 			int is_command)
 {
-  int cpu_nr,prof_nr;
+  int cpu_nr;
 
   /* FIXME: Need to handle `cpu' arg.  */
 
@@ -237,6 +290,18 @@
 	sim_io_eprintf (sd, "Model profiling not compiled in, `--profile-model' ignored\n");
       break;
 
+    case OPTION_PROFILE_CPU_FREQUENCY :
+      {
+	unsigned long val;
+	SIM_RC rc = parse_frequency (sd, arg, &val);
+	if (rc == SIM_RC_OK)
+	  {
+	    for (cpu_nr = 0; cpu_nr < MAX_NR_PROCESSORS; ++cpu_nr)
+	      PROFILE_CPU_FREQ (CPU_PROFILE_DATA (STATE_CPU (sd,cpu_nr))) = val;
+	  }
+	return rc;
+      }
+
     case OPTION_PROFILE_FILE :
       /* FIXME: Might want this to apply to pc profiling only,
 	 or have two profile file options.  */
@@ -924,31 +989,59 @@
   PROFILE_DATA *data = CPU_PROFILE_DATA (cpu);
   unsigned long milliseconds = sim_events_elapsed_time (sd);
   unsigned long total = PROFILE_TOTAL_INSN_COUNT (data);
+  double clock;
+  double secs;
   char comma_buf[20];
 
   sim_io_printf (sd, "Simulator Execution Speed\n\n");
 
   if (total != 0)
-    sim_io_printf (sd, "  Total instructions:   %s\n", COMMAS (total));
+    sim_io_printf (sd, "  Total instructions:      %s\n", COMMAS (total));
 
   if (milliseconds < 1000)
-    sim_io_printf (sd, "  Total execution time: < 1 second\n\n");
+    sim_io_printf (sd, "  Total execution time:    < 1 second\n\n");
   else
     {
       /* The printing of the time rounded to 2 decimal places makes the speed
 	 calculation seem incorrect [even though it is correct].  So round
 	 MILLISECONDS first. This can marginally affect the result, but it's
 	 better that the user not perceive there's a math error.  */
-      double secs = (double) milliseconds / 1000;
+      secs = (double) milliseconds / 1000;
       secs = ((double) (unsigned long) (secs * 100 + .5)) / 100;
-      sim_io_printf (sd, "  Total execution time: %.2f seconds\n", secs);
+      sim_io_printf (sd, "  Total execution time   : %.2f seconds\n", secs);
       /* Don't confuse things with data that isn't useful.
 	 If we ran for less than 2 seconds, only use the data if we
 	 executed more than 100,000 insns.  */
       if (secs >= 2 || total >= 100000)
-	sim_io_printf (sd, "  Simulator speed:      %s insns/second\n\n",
+	sim_io_printf (sd, "  Simulator speed:         %s insns/second\n",
 		       COMMAS ((unsigned long) ((double) total / secs)));
     }
+
+  /* Print simulated execution time if the cpu frequency has been specified.  */
+  clock = PROFILE_CPU_FREQ (data);
+  if (clock != 0)
+    {
+      if (clock >= 1000000)
+	sim_io_printf (sd, "  Simulated cpu frequency: %.2f MHz\n",
+		       clock / 1000000);
+      else
+	sim_io_printf (sd, "  Simulated cpu frequency: %.2f Hz\n", clock);
+
+#if WITH_PROFILE_MODEL_P
+      if (PROFILE_FLAGS (data) [PROFILE_MODEL_IDX])
+	{
+	  /* The printing of the time rounded to 2 decimal places makes the
+	     speed calculation seem incorrect [even though it is correct].
+	     So round 	 SECS first. This can marginally affect the result,
+	     but it's 	 better that the user not perceive there's a math
+	     error.  */
+	  secs = PROFILE_MODEL_TOTAL_CYCLES (data) / clock;
+	  secs = ((double) (unsigned long) (secs * 100 + .5)) / 100;
+	  sim_io_printf (sd, "  Simulated execution time: %.2f seconds\n",
+			 secs);
+	}
+#endif /* WITH_PROFILE_MODEL_P */
+    }
 }
 
 /* Print selected address ranges.  */
diff --git a/sim/common/sim-profile.h b/sim/common/sim-profile.h
index 4ffe850..81fad7d 100644
--- a/sim/common/sim-profile.h
+++ b/sim/common/sim-profile.h
@@ -150,6 +150,10 @@
   unsigned long total_insn_count;
 #define PROFILE_TOTAL_INSN_COUNT(p) ((p)->total_insn_count)
 
+  /* CPU frequency.  Always accepted, regardless of profiling options.  */
+  unsigned long cpu_freq;
+#define PROFILE_CPU_FREQ(p) ((p)->cpu_freq)
+
 #if WITH_PROFILE_INSN_P
   unsigned int *insn_count;
 #define PROFILE_INSN_COUNT(p) ((p)->insn_count)
diff --git a/sim/common/sim-trace.h b/sim/common/sim-trace.h
index 14d277e..d34f5c4 100644
--- a/sim/common/sim-trace.h
+++ b/sim/common/sim-trace.h
@@ -85,8 +85,7 @@
 ((1 << TRACE_INSN_IDX) \
  | (1 << TRACE_LINENUM_IDX) \
  | (1 << TRACE_MEMORY_IDX) \
- | (1 << TRACE_MODEL_IDX) \
- | (1 << TRACE_EVENTS_IDX))
+ | (1 << TRACE_MODEL_IDX))
 
 /* Masks so WITH_TRACE can have symbolic values.
    The case choice here is on purpose.  The lowercase parts are args to
diff --git a/sim/common/sim-types.h b/sim/common/sim-types.h
index babc598..afd008f 100644
--- a/sim/common/sim-types.h
+++ b/sim/common/sim-types.h
@@ -164,6 +164,10 @@
 typedef unsigned32 unsigned_word;
 typedef signed32 signed_word;
 #endif
+#if (WITH_TARGET_WORD_BITSIZE == 16)
+typedef unsigned16 unsigned_word;
+typedef signed16 signed_word;
+#endif
 
 
 /* Other instructions */
@@ -175,6 +179,10 @@
 typedef unsigned32 unsigned_address;
 typedef signed32 signed_address;
 #endif
+#if (WITH_TARGET_ADDRESS_BITSIZE == 16)
+typedef unsigned16 unsigned_address;
+typedef signed16 signed_address;
+#endif
 typedef unsigned_address address_word;
 
 
diff --git a/sim/configure b/sim/configure
index 57d3bd8..8d324ad 100755
--- a/sim/configure
+++ b/sim/configure
@@ -1411,7 +1411,14 @@
 	sim_target=arm
 	extra_subdirs="${extra_subdirs} testsuite"
 	;;
-  strongarm*-*-*)	sim_target=arm ;;
+  strongarm*-*-*)
+  	sim_target=arm
+	extra_subdirs="${extra_subdirs} testsuite"
+	;;
+  xscale-*-*)
+  	sim_target=arm
+	extra_subdirs="${extra_subdirs} testsuite"
+	;;
   d10v-*-*)		sim_target=d10v ;;
   d30v-*-*)
 	sim_target=d30v
@@ -1423,6 +1430,7 @@
   h8500-*-*)		sim_target=h8500 ;;
   i960-*-*)		sim_target=i960 ;;
   m32r-*-*)		sim_target=m32r ;;
+  m68hc11-*-*|m6811-*-*) sim_target=m68hc11 ;;
   mcore-*-*)		sim_target=mcore ;;
   mips*-*-*)
 	# The MIPS simulator can only be compiled by gcc.
@@ -1448,6 +1456,11 @@
 	only_if_gcc=yes
 	#extra_subdirs="${extra_subdirs}"
 	;;
+  tic80-*-*)
+	sim_target=tic80
+	only_if_gcc=yes
+	extra_subdirs="${extra_subdirs} igen"
+	;;
   v850-*-*)
 	# The V850 simulator can only be compiled by gcc.
 	sim_target=v850
diff --git a/sim/configure.in b/sim/configure.in
index 8bee260..e472f88 100644
--- a/sim/configure.in
+++ b/sim/configure.in
@@ -50,7 +50,14 @@
 	sim_target=arm
 	extra_subdirs="${extra_subdirs} testsuite"
 	;;
-  strongarm*-*-*)	sim_target=arm ;;
+  strongarm*-*-*)
+  	sim_target=arm
+	extra_subdirs="${extra_subdirs} testsuite"
+	;;
+  xscale-*-*)
+  	sim_target=arm
+	extra_subdirs="${extra_subdirs} testsuite"
+	;;
   d10v-*-*)		sim_target=d10v ;;
   d30v-*-*)
 	sim_target=d30v
@@ -62,6 +69,7 @@
   h8500-*-*)		sim_target=h8500 ;;
   i960-*-*)		sim_target=i960 ;;
   m32r-*-*)		sim_target=m32r ;;
+  m68hc11-*-*|m6811-*-*) sim_target=m68hc11 ;;
   mcore-*-*)		sim_target=mcore ;;
   mips*-*-*)
 	# The MIPS simulator can only be compiled by gcc.
@@ -87,6 +95,11 @@
 	only_if_gcc=yes
 	#extra_subdirs="${extra_subdirs}"
 	;;
+  tic80-*-*)
+	sim_target=tic80
+	only_if_gcc=yes
+	extra_subdirs="${extra_subdirs} igen"
+	;;
   v850-*-*)
 	# The V850 simulator can only be compiled by gcc.
 	sim_target=v850
diff --git a/sim/d30v/ChangeLog b/sim/d30v/ChangeLog
index 1845a45..6f65b24 100644
--- a/sim/d30v/ChangeLog
+++ b/sim/d30v/ChangeLog
@@ -1,3 +1,7 @@
+2000-07-05  Nick Clifton  <nickc@cygnus.com>
+
+	* d30v-insns: Change minimum loop size limit to 0x10.
+
 Tue May 23 21:39:23 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/d30v/d30v-insns b/sim/d30v/d30v-insns
index 47f837c..7b7c3c8 100644
--- a/sim/d30v/d30v-insns
+++ b/sim/d30v/d30v-insns
@@ -1621,7 +1621,7 @@
 	  sim_engine_abort (SD, CPU, cia, "REPEAT with ra=0 and REPEATI with imm = 0 is forbidden.");
 	if (count > 1)
 	  PSW_SET_QUEUE (PSW_RP, 1);
-	if (rpt_e  < rpt_s + 0x18)
+	if (rpt_e  < rpt_s + 0x10)
 	  sim_io_eprintf (sd, "warning: 0x%lx: REPEAT or REPEATI loop is too small\n", (long) cia);
 	WRITE32_QUEUE (&RPT_C, count - 1);
 	WRITE32_QUEUE (&RPT_S, rpt_s);
diff --git a/sim/fr30/ChangeLog b/sim/fr30/ChangeLog
index 14f255d..27c8b88 100644
--- a/sim/fr30/ChangeLog
+++ b/sim/fr30/ChangeLog
@@ -1,3 +1,23 @@
+2000-11-18  Greg McGary  <greg@mcgary.org>
+
+	* Makefile.in: remove `@true' commands for rules that have
+	$(CGEN_MAINT) as a prerequisite.
+
+2000-10-06  Dave Brolley  <brolley@redhat.com>
+
+	* sem.c: Regenerated.
+	* sem-switch.c: Regenerated.
+
+2000-08-28  Dave Brolley  <brolley@redhat.com>
+
+	* cpu.h: Regenerated.
+	* decode.c: Regenerated.
+
+2000-08-21  Frank Ch. Eigler  <fche@redhat.com>
+
+	* Makefile.in (fr30-clean): Add stamp-arch, stamp-cpu.
+	(stamp-arch, stamp-cpu): New targets.
+
 Tue May 23 21:39:23 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/fr30/Makefile.in b/sim/fr30/Makefile.in
index 427312e..102cb0c 100644
--- a/sim/fr30/Makefile.in
+++ b/sim/fr30/Makefile.in
@@ -1,5 +1,5 @@
 # Makefile template for Configure for the fr30 simulator
-# Copyright (C) 1998 Free Software Foundation, Inc.
+# Copyright (C) 1998, 2000 Free Software Foundation, Inc.
 # Contributed by Cygnus Support.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -18,7 +18,7 @@
 
 ## COMMON_PRE_CONFIG_FRAG
 
-FR30_OBJS = fr30.o cpu.o decode.o sem.o model.o mloop.o
+FR30_OBJS = fr30.o cpu.o decode.o sem.o model.o arch.o mloop.o
 
 CONFIG_DEVICES = dv-sockser.o
 CONFIG_DEVICES =
@@ -32,7 +32,7 @@
 	sim-reg.o \
 	cgen-utils.o cgen-trace.o cgen-scache.o \
 	cgen-run.o sim-reason.o sim-engine.o sim-stop.o \
-	sim-if.o arch.o \
+	sim-if.o \
 	$(FR30_OBJS) \
 	traps.o devices.o \
 	$(CONFIG_DEVICES)
@@ -87,4 +87,21 @@
 fr30-clean:
 	rm -f mloop.c eng.h stamp-mloop
 	rm -f tmp-*
+	rm -f stamp-arch stamp-cpu
 
+# cgen support, enable with --enable-cgen-maint
+CGEN_MAINT = ; @true
+# The following line is commented in or out depending upon --enable-cgen-maint.
+@CGEN_MAINT@CGEN_MAINT =
+
+stamp-arch: $(CGEN_READ_SCM) $(CGEN_ARCH_SCM) $(srccgen)/fr30.cpu
+	$(MAKE) cgen-arch $(CGEN_FLAGS_TO_PASS) mach=all \
+	  FLAGS="with-scache with-profile=fn"
+	touch stamp-arch
+arch.h arch.c cpuall.h: $(CGEN_MAINT) stamp-arch
+
+stamp-cpu: $(CGEN_READ_SCM) $(CGEN_CPU_SCM) $(CGEN_DECODE_SCM) $(srccgen)/fr30.cpu
+	$(MAKE) cgen-cpu-decode $(CGEN_FLAGS_TO_PASS) \
+	  cpu=fr30bf mach=fr30 SUFFIX= FLAGS="with-scache with-profile=fn" EXTRAFILES="$(CGEN_CPU_SEM) $(CGEN_CPU_SEMSW)"
+	touch stamp-cpu
+cpu.h sem.c sem-switch.c model.c decode.c decode.h: $(CGEN_MAINT) stamp-cpu
diff --git a/sim/fr30/cpu.h b/sim/fr30/cpu.h
index 27745da1..ac1af48 100644
--- a/sim/fr30/cpu.h
+++ b/sim/fr30/cpu.h
@@ -54,14 +54,14 @@
 #define SET_H_DR(index, x) \
 do { \
 fr30bf_h_dr_set_handler (current_cpu, (index), (x));\
-} while (0)
+;} while (0)
   /* processor status */
   USI h_ps;
 #define GET_H_PS() fr30bf_h_ps_get_handler (current_cpu)
 #define SET_H_PS(x) \
 do { \
 fr30bf_h_ps_set_handler (current_cpu, (x));\
-} while (0)
+;} while (0)
   /* General Register 13 explicitly required */
   SI h_r13;
 #define GET_H_R13() CPU (h_r13)
@@ -100,7 +100,7 @@
 #define SET_H_SBIT(x) \
 do { \
 fr30bf_h_sbit_set_handler (current_cpu, (x));\
-} while (0)
+;} while (0)
   /* trace trap       bit */
   BI h_tbit;
 #define GET_H_TBIT() CPU (h_tbit)
@@ -119,21 +119,21 @@
 #define SET_H_CCR(x) \
 do { \
 fr30bf_h_ccr_set_handler (current_cpu, (x));\
-} while (0)
+;} while (0)
   /* system condition bits */
   UQI h_scr;
 #define GET_H_SCR() fr30bf_h_scr_get_handler (current_cpu)
 #define SET_H_SCR(x) \
 do { \
 fr30bf_h_scr_set_handler (current_cpu, (x));\
-} while (0)
+;} while (0)
   /* interrupt level mask */
   UQI h_ilm;
 #define GET_H_ILM() fr30bf_h_ilm_get_handler (current_cpu)
 #define SET_H_ILM(x) \
 do { \
 fr30bf_h_ilm_set_handler (current_cpu, (x));\
-} while (0)
+;} while (0)
   } hardware;
 #define CPU_CGEN_HW(cpu) (& (cpu)->cpu_data.hardware)
 } FR30BF_CPU_DATA;
@@ -230,102 +230,41 @@
     unsigned char out_h_gr_13;
   } sfmt_dmovr13pi;
   struct { /*  */
-    SI* i_Ri;
-    UINT f_Rs1;
-    unsigned char in_Ri;
-  } sfmt_mov2dr;
-  struct { /*  */
-    SI* i_Ri;
-    UINT f_Rs1;
-    unsigned char out_Ri;
-  } sfmt_movdr;
-  struct { /*  */
     UINT f_Rs2;
     unsigned char in_h_gr_15;
     unsigned char out_h_gr_15;
   } sfmt_ldr15dr;
   struct { /*  */
     SI* i_Ri;
+    UINT f_Ri;
+    UINT f_Rs1;
+    unsigned char in_Ri;
+  } sfmt_mov2dr;
+  struct { /*  */
+    SI* i_Ri;
+    UINT f_Ri;
+    UINT f_Rs1;
+    unsigned char out_Ri;
+  } sfmt_movdr;
+  struct { /*  */
+    SI* i_Ri;
+    UINT f_Ri;
     UINT f_i32;
     unsigned char out_Ri;
   } sfmt_ldi32;
   struct { /*  */
     SI* i_Ri;
+    UINT f_Ri;
     UINT f_i20;
     unsigned char out_Ri;
   } sfmt_ldi20;
   struct { /*  */
     SI* i_Ri;
+    UINT f_Ri;
     UINT f_i8;
     unsigned char out_Ri;
   } sfmt_ldi8;
   struct { /*  */
-    SI* i_Ri;
-    unsigned char in_Ri;
-    unsigned char in_h_gr_15;
-    unsigned char out_h_gr_15;
-  } sfmt_str15gr;
-  struct { /*  */
-    SI* i_Ri;
-    USI f_udisp6;
-    unsigned char in_Ri;
-    unsigned char in_h_gr_15;
-  } sfmt_str15;
-  struct { /*  */
-    SI* i_Ri;
-    INT f_disp8;
-    unsigned char in_Ri;
-    unsigned char in_h_gr_14;
-  } sfmt_str14b;
-  struct { /*  */
-    SI* i_Ri;
-    SI f_disp9;
-    unsigned char in_Ri;
-    unsigned char in_h_gr_14;
-  } sfmt_str14h;
-  struct { /*  */
-    SI* i_Ri;
-    SI f_disp10;
-    unsigned char in_Ri;
-    unsigned char in_h_gr_14;
-  } sfmt_str14;
-  struct { /*  */
-    SI* i_Ri;
-    USI f_udisp6;
-    unsigned char in_h_gr_15;
-    unsigned char out_Ri;
-  } sfmt_ldr15;
-  struct { /*  */
-    SI* i_Ri;
-    INT f_disp8;
-    unsigned char in_h_gr_14;
-    unsigned char out_Ri;
-  } sfmt_ldr14ub;
-  struct { /*  */
-    SI* i_Ri;
-    SI f_disp9;
-    unsigned char in_h_gr_14;
-    unsigned char out_Ri;
-  } sfmt_ldr14uh;
-  struct { /*  */
-    SI* i_Ri;
-    SI f_disp10;
-    unsigned char in_h_gr_14;
-    unsigned char out_Ri;
-  } sfmt_ldr14;
-  struct { /*  */
-    SI* i_Ri;
-    SI f_m4;
-    unsigned char in_Ri;
-    unsigned char out_Ri;
-  } sfmt_add2;
-  struct { /*  */
-    SI* i_Ri;
-    UINT f_u4;
-    unsigned char in_Ri;
-    unsigned char out_Ri;
-  } sfmt_addi;
-  struct { /*  */
     USI f_u10;
     unsigned char in_h_gr_14;
     unsigned char in_h_gr_15;
@@ -334,11 +273,39 @@
   } sfmt_enter;
   struct { /*  */
     SI* i_Ri;
-    SI* i_Rj;
+    UINT f_Ri;
     unsigned char in_Ri;
-    unsigned char in_Rj;
-    unsigned char in_h_gr_13;
-  } sfmt_str13;
+    unsigned char in_h_gr_15;
+    unsigned char out_h_gr_15;
+  } sfmt_str15gr;
+  struct { /*  */
+    SI* i_Ri;
+    UINT f_Ri;
+    USI f_udisp6;
+    unsigned char in_Ri;
+    unsigned char in_h_gr_15;
+  } sfmt_str15;
+  struct { /*  */
+    SI* i_Ri;
+    INT f_disp8;
+    UINT f_Ri;
+    unsigned char in_Ri;
+    unsigned char in_h_gr_14;
+  } sfmt_str14b;
+  struct { /*  */
+    SI* i_Ri;
+    SI f_disp9;
+    UINT f_Ri;
+    unsigned char in_Ri;
+    unsigned char in_h_gr_14;
+  } sfmt_str14h;
+  struct { /*  */
+    SI* i_Ri;
+    SI f_disp10;
+    UINT f_Ri;
+    unsigned char in_Ri;
+    unsigned char in_h_gr_14;
+  } sfmt_str14;
   struct { /*  */
     SI* i_Ri;
     UINT f_Ri;
@@ -348,7 +315,60 @@
   } sfmt_ldr15gr;
   struct { /*  */
     SI* i_Ri;
+    UINT f_Ri;
+    USI f_udisp6;
+    unsigned char in_h_gr_15;
+    unsigned char out_Ri;
+  } sfmt_ldr15;
+  struct { /*  */
+    SI* i_Ri;
+    INT f_disp8;
+    UINT f_Ri;
+    unsigned char in_h_gr_14;
+    unsigned char out_Ri;
+  } sfmt_ldr14ub;
+  struct { /*  */
+    SI* i_Ri;
+    SI f_disp9;
+    UINT f_Ri;
+    unsigned char in_h_gr_14;
+    unsigned char out_Ri;
+  } sfmt_ldr14uh;
+  struct { /*  */
+    SI* i_Ri;
+    SI f_disp10;
+    UINT f_Ri;
+    unsigned char in_h_gr_14;
+    unsigned char out_Ri;
+  } sfmt_ldr14;
+  struct { /*  */
+    SI* i_Ri;
+    SI f_m4;
+    UINT f_Ri;
+    unsigned char in_Ri;
+    unsigned char out_Ri;
+  } sfmt_add2;
+  struct { /*  */
+    SI* i_Ri;
+    UINT f_Ri;
+    UINT f_u4;
+    unsigned char in_Ri;
+    unsigned char out_Ri;
+  } sfmt_addi;
+  struct { /*  */
+    SI* i_Ri;
     SI* i_Rj;
+    UINT f_Ri;
+    UINT f_Rj;
+    unsigned char in_Ri;
+    unsigned char in_Rj;
+    unsigned char in_h_gr_13;
+  } sfmt_str13;
+  struct { /*  */
+    SI* i_Ri;
+    SI* i_Rj;
+    UINT f_Ri;
+    UINT f_Rj;
     unsigned char in_Rj;
     unsigned char in_h_gr_13;
     unsigned char out_Ri;
@@ -356,6 +376,8 @@
   struct { /*  */
     SI* i_Ri;
     SI* i_Rj;
+    UINT f_Ri;
+    UINT f_Rj;
     unsigned char in_Ri;
     unsigned char in_Rj;
     unsigned char out_Ri;
diff --git a/sim/fr30/decode.c b/sim/fr30/decode.c
index 3ed6a11..407bd93 100644
--- a/sim/fr30/decode.c
+++ b/sim/fr30/decode.c
@@ -639,9 +639,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
+  FLD (f_Rj) = f_Rj;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_add", "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_add", "f_Ri 0x%x", 'x', f_Ri, "f_Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -668,9 +670,10 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (f_u4) = f_u4;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addi", "f_u4 0x%x", 'x', f_u4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addi", "f_Ri 0x%x", 'x', f_Ri, "f_u4 0x%x", 'x', f_u4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -696,9 +699,10 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (f_m4) = f_m4;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_add2", "f_m4 0x%x", 'x', f_m4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_add2", "f_Ri 0x%x", 'x', f_Ri, "f_m4 0x%x", 'x', f_m4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -724,9 +728,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
+  FLD (f_Rj) = f_Rj;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addc", "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addc", "f_Ri 0x%x", 'x', f_Ri, "f_Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -753,9 +759,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
+  FLD (f_Rj) = f_Rj;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addn", "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addn", "f_Ri 0x%x", 'x', f_Ri, "f_Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -782,9 +790,10 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (f_u4) = f_u4;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addni", "f_u4 0x%x", 'x', f_u4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addni", "f_Ri 0x%x", 'x', f_Ri, "f_u4 0x%x", 'x', f_u4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -810,9 +819,10 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (f_m4) = f_m4;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addn2", "f_m4 0x%x", 'x', f_m4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addn2", "f_Ri 0x%x", 'x', f_Ri, "f_m4 0x%x", 'x', f_m4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -838,9 +848,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
+  FLD (f_Rj) = f_Rj;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmp", "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmp", "f_Ri 0x%x", 'x', f_Ri, "f_Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -866,9 +878,10 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (f_u4) = f_u4;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmpi", "f_u4 0x%x", 'x', f_u4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmpi", "f_Ri 0x%x", 'x', f_Ri, "f_u4 0x%x", 'x', f_u4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -893,9 +906,10 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (f_m4) = f_m4;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmp2", "f_m4 0x%x", 'x', f_m4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmp2", "f_Ri 0x%x", 'x', f_Ri, "f_m4 0x%x", 'x', f_m4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -920,9 +934,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
+  FLD (f_Rj) = f_Rj;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_and", "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_and", "f_Ri 0x%x", 'x', f_Ri, "f_Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -949,9 +965,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
+  FLD (f_Rj) = f_Rj;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_andm", "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_andm", "f_Ri 0x%x", 'x', f_Ri, "f_Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -977,9 +995,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
+  FLD (f_Rj) = f_Rj;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_andh", "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_andh", "f_Ri 0x%x", 'x', f_Ri, "f_Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1005,9 +1025,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
+  FLD (f_Rj) = f_Rj;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_andb", "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_andb", "f_Ri 0x%x", 'x', f_Ri, "f_Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1033,9 +1055,10 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (f_u4) = f_u4;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_bandl", "f_u4 0x%x", 'x', f_u4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_bandl", "f_Ri 0x%x", 'x', f_Ri, "f_u4 0x%x", 'x', f_u4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1060,9 +1083,10 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (f_u4) = f_u4;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_btstl", "f_u4 0x%x", 'x', f_u4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_btstl", "f_Ri 0x%x", 'x', f_Ri, "f_u4 0x%x", 'x', f_u4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1087,9 +1111,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
+  FLD (f_Rj) = f_Rj;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mul", "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mul", "f_Ri 0x%x", 'x', f_Ri, "f_Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1115,9 +1141,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
+  FLD (f_Rj) = f_Rj;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mulu", "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mulu", "f_Ri 0x%x", 'x', f_Ri, "f_Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1143,9 +1171,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
+  FLD (f_Rj) = f_Rj;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mulh", "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mulh", "f_Ri 0x%x", 'x', f_Ri, "f_Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1169,8 +1199,9 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_div0s", "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_div0s", "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1207,8 +1238,9 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_div1", "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_div1", "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1231,8 +1263,9 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_div2", "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_div2", "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1285,9 +1318,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
+  FLD (f_Rj) = f_Rj;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_lsl", "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_lsl", "f_Ri 0x%x", 'x', f_Ri, "f_Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1314,9 +1349,10 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (f_u4) = f_u4;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_lsli", "f_u4 0x%x", 'x', f_u4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_lsli", "f_Ri 0x%x", 'x', f_Ri, "f_u4 0x%x", 'x', f_u4, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1343,8 +1379,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_i8) = f_i8;
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi8", "f_i8 0x%x", 'x', f_i8, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi8", "f_i8 0x%x", 'x', f_i8, "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1379,8 +1416,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_i20) = f_i20;
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi20", "f_i20 0x%x", 'x', f_i20, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi20", "f_i20 0x%x", 'x', f_i20, "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1411,8 +1449,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_i32) = f_i32;
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi32", "f_i32 0x%x", 'x', f_i32, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi32", "f_i32 0x%x", 'x', f_i32, "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1437,9 +1476,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Rj) = f_Rj;
+  FLD (f_Ri) = f_Ri;
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld", "Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld", "f_Rj 0x%x", 'x', f_Rj, "f_Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1465,9 +1506,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Rj) = f_Rj;
+  FLD (f_Ri) = f_Ri;
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldr13", "Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldr13", "f_Rj 0x%x", 'x', f_Rj, "f_Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1495,8 +1538,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_disp10) = f_disp10;
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldr14", "f_disp10 0x%x", 'x', f_disp10, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldr14", "f_disp10 0x%x", 'x', f_disp10, "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1523,8 +1567,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_disp9) = f_disp9;
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldr14uh", "f_disp9 0x%x", 'x', f_disp9, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldr14uh", "f_disp9 0x%x", 'x', f_disp9, "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1551,8 +1596,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_disp8) = f_disp8;
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldr14ub", "f_disp8 0x%x", 'x', f_disp8, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldr14ub", "f_disp8 0x%x", 'x', f_disp8, "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1579,8 +1625,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_udisp6) = f_udisp6;
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldr15", "f_udisp6 0x%x", 'x', f_udisp6, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldr15", "f_udisp6 0x%x", 'x', f_udisp6, "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1680,9 +1727,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
+  FLD (f_Rj) = f_Rj;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st", "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st", "f_Ri 0x%x", 'x', f_Ri, "f_Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1708,9 +1757,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
+  FLD (f_Rj) = f_Rj;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_str13", "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_str13", "f_Ri 0x%x", 'x', f_Ri, "f_Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1737,9 +1788,10 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (f_disp10) = f_disp10;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_str14", "f_disp10 0x%x", 'x', f_disp10, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_str14", "f_Ri 0x%x", 'x', f_Ri, "f_disp10 0x%x", 'x', f_disp10, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1765,9 +1817,10 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (f_disp9) = f_disp9;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_str14h", "f_disp9 0x%x", 'x', f_disp9, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_str14h", "f_Ri 0x%x", 'x', f_Ri, "f_disp9 0x%x", 'x', f_disp9, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1793,9 +1846,10 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (f_disp8) = f_disp8;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_str14b", "f_disp8 0x%x", 'x', f_disp8, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_str14b", "f_Ri 0x%x", 'x', f_Ri, "f_disp8 0x%x", 'x', f_disp8, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1821,9 +1875,10 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (f_udisp6) = f_udisp6;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_str15", "f_udisp6 0x%x", 'x', f_udisp6, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_str15", "f_Ri 0x%x", 'x', f_Ri, "f_udisp6 0x%x", 'x', f_udisp6, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1847,8 +1902,9 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_str15gr", "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_str15gr", "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1922,9 +1978,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Rj) = f_Rj;
+  FLD (f_Ri) = f_Ri;
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mov", "Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mov", "f_Rj 0x%x", 'x', f_Rj, "f_Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1951,8 +2009,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_Rs1) = f_Rs1;
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_movdr", "f_Rs1 0x%x", 'x', f_Rs1, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_movdr", "f_Rs1 0x%x", 'x', f_Rs1, "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1975,8 +2034,9 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_movps", "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_movps", "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -2001,9 +2061,10 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (f_Rs1) = f_Rs1;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mov2dr", "f_Rs1 0x%x", 'x', f_Rs1, "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mov2dr", "f_Ri 0x%x", 'x', f_Ri, "f_Rs1 0x%x", 'x', f_Rs1, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -2026,8 +2087,9 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mov2ps", "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mov2ps", "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -2050,8 +2112,9 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_jmp", "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_jmp", "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -2074,8 +2137,9 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_callr", "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_callr", "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -2746,8 +2810,9 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldres", "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldres", "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -2847,8 +2912,9 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_extsb", "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_extsb", "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -2872,8 +2938,9 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_extub", "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_extub", "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -2897,8 +2964,9 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_extsh", "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_extsh", "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -2922,8 +2990,9 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_extuh", "Ri 0x%x", 'x', f_Ri, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_extuh", "f_Ri 0x%x", 'x', f_Ri, "Ri 0x%x", 'x', f_Ri, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -3130,9 +3199,11 @@
     f_Ri = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_Ri) = f_Ri;
+  FLD (f_Rj) = f_Rj;
   FLD (i_Ri) = & CPU (h_gr)[f_Ri];
   FLD (i_Rj) = & CPU (h_gr)[f_Rj];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_xchb", "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_xchb", "f_Ri 0x%x", 'x', f_Ri, "f_Rj 0x%x", 'x', f_Rj, "Ri 0x%x", 'x', f_Ri, "Rj 0x%x", 'x', f_Rj, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
diff --git a/sim/fr30/sem-switch.c b/sim/fr30/sem-switch.c
index f3477e5..d6340c0 100644
--- a/sim/fr30/sem-switch.c
+++ b/sim/fr30/sem-switch.c
@@ -384,12 +384,16 @@
 
   {
 #if WITH_SCACHE_PBB_FR30BF
-#ifdef DEFINE_SWITCH
+#if defined DEFINE_SWITCH || defined FAST_P
     /* In the switch case FAST_P is a constant, allowing several optimizations
        in any called inline functions.  */
     vpc = fr30bf_pbb_begin (current_cpu, FAST_P);
 #else
+#if 0 /* cgen engine can't handle dynamic fast/full switching yet.  */
     vpc = fr30bf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
+#else
+    vpc = fr30bf_pbb_begin (current_cpu, 0);
+#endif
 #endif
 #endif
   }
diff --git a/sim/fr30/sem.c b/sim/fr30/sem.c
index 0d83f36..f3a749b 100644
--- a/sim/fr30/sem.c
+++ b/sim/fr30/sem.c
@@ -179,12 +179,16 @@
 
   {
 #if WITH_SCACHE_PBB_FR30BF
-#ifdef DEFINE_SWITCH
+#if defined DEFINE_SWITCH || defined FAST_P
     /* In the switch case FAST_P is a constant, allowing several optimizations
        in any called inline functions.  */
     vpc = fr30bf_pbb_begin (current_cpu, FAST_P);
 #else
+#if 0 /* cgen engine can't handle dynamic fast/full switching yet.  */
     vpc = fr30bf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
+#else
+    vpc = fr30bf_pbb_begin (current_cpu, 0);
+#endif
 #endif
 #endif
   }
diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog
index d497410..0eb353c 100644
--- a/sim/h8300/ChangeLog
+++ b/sim/h8300/ChangeLog
@@ -1,3 +1,26 @@
+2000-08-10  Kazu Hirata  <kazu@hxi.com>
+
+	* compile.c (decode): Clean up the code.
+
+2000-06-15  Kazu Hirata  <kazu@hxi.com>
+
+	* compile.c (decode): Distinguish inc/dec.[wl] and adds/subs
+	correctly.
+
+2000-06-20  Frank Ch. Eigler  <fche@redhat.com>
+
+	* compile.c: Don't include "wait.h".
+	(sim_resume): Use local SIM_WIFEXITED and SIM_WIFSIGNALED macros
+	instead of WIF* from host.
+
+2000-06-13  Frank Ch. Eigler  <fche@redhat.com>
+
+	* compile.c, writecode.c: Correct typo.
+
+2000-06-13  Kazu Hirata  <kazu@hxi.com>
+
+	* compile.c: Fix formatting.
+
 Tue May 23 21:39:23 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 2ec759d..d567cb1 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -30,7 +30,6 @@
 #ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
 #endif
-#include "wait.h"
 #include "ansidecl.h"
 #include "bfd.h"
 #include "callback.h"
@@ -74,7 +73,7 @@
 
 #include "inst.h"
 
-/* The rate at which to call the host's poll_quit callback. */
+/* The rate at which to call the host's poll_quit callback.  */
 
 #define POLL_QUIT_INTERVAL 0x80000
 
@@ -109,7 +108,6 @@
 
 static int memory_size;
 
-
 static int
 get_now ()
 {
@@ -125,7 +123,6 @@
   return 1;
 }
 
-
 static int
 bitfrom (x)
 {
@@ -142,8 +139,7 @@
     }
 }
 
-static
-unsigned int
+static unsigned int
 lvalue (x, rn)
 {
   switch (x / 4)
@@ -156,8 +152,8 @@
       return X (OP_REG, SP);
 
     case OP_MEM:
-
       return X (OP_MEM, SP);
+
     default:
       abort ();
     }
@@ -174,20 +170,19 @@
   int rd = 0;
   int rdisp = 0;
   int abs = 0;
-  int plen = 0;
   int bit = 0;
-
-  struct h8_opcode *q = h8_opcodes;
+  int plen = 0;
+  struct h8_opcode *q;
   int size = 0;
+
   dst->dst.type = -1;
   dst->src.type = -1;
-  /* Find the exact opcode/arg combo */
-  while (q->name)
-    {
-      op_type *nib;
-      unsigned int len = 0;
 
-      nib = q->data.nib;
+  /* Find the exact opcode/arg combo.  */
+  for (q = h8_opcodes; q->name; q++)
+    {
+      op_type *nib = q->data.nib;
+      unsigned int len = 0;
 
       while (1)
 	{
@@ -207,40 +202,40 @@
 		{
 		  if (!(((int) thisnib & 0x8) != 0))
 		    goto fail;
-		  looking_for = (op_type) ((int) looking_for & ~(int)
-					   B31);
+
+		  looking_for = (op_type) ((int) looking_for & ~(int) B31);
 		  thisnib &= 0x7;
 		}
+
 	      if ((int) looking_for & (int) B30)
 		{
 		  if (!(((int) thisnib & 0x8) == 0))
 		    goto fail;
+
 		  looking_for = (op_type) ((int) looking_for & ~(int) B30);
 		}
+
 	      if (looking_for & DBIT)
 		{
-		  if ((looking_for & 5) != (thisnib & 5))
+		  /* Exclude adds/subs by looking at bit 0 and 2, and
+                     make sure the operand size, either w or l,
+                     matches by looking at bit 1.  */
+		  if ((looking_for & 7) != (thisnib & 7))
 		    goto fail;
+
 		  abs = (thisnib & 0x8) ? 2 : 1;
 		}
 	      else if (looking_for & (REG | IND | INC | DEC))
 		{
 		  if (looking_for & REG)
 		    {
-		      /*
-		       * Can work out size from the
-		       * register
-		       */
+		      /* Can work out size from the register.  */
 		      size = bitfrom (looking_for);
 		    }
 		  if (looking_for & SRC)
-		    {
-		      rs = thisnib;
-		    }
+		    rs = thisnib;
 		  else
-		    {
-		      rd = thisnib;
-		    }
+		    rd = thisnib;
 		}
 	      else if (looking_for & L_16)
 		{
@@ -253,10 +248,7 @@
 		}
 	      else if (looking_for & ABSJMP)
 		{
-		  abs =
-		    (data[1] << 16)
-		    | (data[2] << 8)
-		    | (data[3]);
+		  abs = (data[1] << 16) | (data[2] << 8) | (data[3]);
 		}
 	      else if (looking_for & MEMIND)
 		{
@@ -265,6 +257,7 @@
 	      else if (looking_for & L_32)
 		{
 		  int i = len >> 1;
+
 		  abs = (data[i] << 24)
 		    | (data[i + 1] << 16)
 		    | (data[i + 2] << 8)
@@ -275,12 +268,13 @@
 	      else if (looking_for & L_24)
 		{
 		  int i = len >> 1;
+
 		  abs = (data[i] << 16) | (data[i + 1] << 8) | (data[i + 2]);
 		  plen = 24;
 		}
 	      else if (looking_for & IGNORE)
 		{
-		  /* nothing to do */
+		  ;
 		}
 	      else if (looking_for & DISPREG)
 		{
@@ -299,6 +293,8 @@
 		    case 0:
 		      abs = 1;
 		      break;
+		    default:
+		      goto fail;
 		    }
 		}
 	      else if (looking_for & L_8)
@@ -313,9 +309,9 @@
 		    {
 		      plen = 8;
 		      abs = h8300hmode ? ~0xff0000ff : ~0xffff00ff;
-		      abs |= data[len >> 1] & 0xff ;
+		      abs |= data[len >> 1] & 0xff;
 		    }
-		   else
+		  else
 		    {
 		      abs = data[len >> 1] & 0xff;
 		    }
@@ -330,7 +326,7 @@
 		{
 		  dst->op = q;
 
-		  /* Fill in the args */
+		  /* Fill in the args.  */
 		  {
 		    op_type *args = q->args.nib;
 		    int hadone = 0;
@@ -342,15 +338,11 @@
 			ea_type *p;
 
 			if (x & DST)
-			  {
-			    p = &(dst->dst);
-			  }
+			  p = &(dst->dst);
 			else
-			  {
-			    p = &(dst->src);
-			  }
+			  p = &(dst->src);
 
-			if (x & (L_3))
+			if (x & L_3)
 			  {
 			    p->type = X (OP_IMM, size);
 			    p->literal = bit;
@@ -362,8 +354,8 @@
 			  }
 			else if (x & REG)
 			  {
-			    /* Reset the size, some
-			       ops (like mul) have two sizes */
+			    /* Reset the size.
+			       Some ops (like mul) have two sizes.  */
 
 			    size = bitfrom (x);
 			    p->type = X (OP_REG, size);
@@ -425,12 +417,9 @@
 		      }
 		  }
 
-		  /*
-		     * But a jmp or a jsr gets
-		     * automagically lvalued, since we
-		     * branch to their address not their
-		     * contents
-		   */
+		  /* But a jmp or a jsr gets automagically lvalued,
+		     since we branch to their address not their
+		     contents.  */
 		  if (q->how == O (O_JSR, SB)
 		      || q->how == O (O_JMP, SB))
 		    {
@@ -443,7 +432,7 @@
 		  dst->opcode = q->how;
 		  dst->cycles = q->time;
 
-		  /* And a jsr to 0xc4 is turned into a magic trap */
+		  /* And a jsr to 0xc4 is turned into a magic trap.  */
 
 		  if (dst->opcode == O (O_JSR, SB))
 		    {
@@ -457,9 +446,7 @@
 		  return;
 		}
 	      else
-		{
-		  printf ("Dont understand %x \n", looking_for);
-		}
+		printf ("Don't understand %x \n", looking_for);
 	    }
 
 	  len++;
@@ -467,13 +454,13 @@
 	}
 
     fail:
-      q++;
+      ;
     }
 
+  /* Fell off the end.  */
   dst->opcode = O (O_ILL, SB);
 }
 
-
 static void
 compile (pc)
 {
@@ -1370,32 +1357,17 @@
 	  cpu.exception = SIGILL;
 	  goto end;
 	case O (O_SLEEP, SN):
-	  /* The format of r0 is defined by devo/include/wait.h.  */
-#if 0 /* FIXME: Ugh.  A breakpoint is the sleep insn.  */
-	  if (WIFEXITED (cpu.regs[0]))
-	    {
-	      cpu.state = SIM_STATE_EXITED;
-	      cpu.exception = WEXITSTATUS (cpu.regs[0]);
-	    }
-	  else if (WIFSTOPPED (cpu.regs[0]))
-	    {
-	      cpu.state = SIM_STATE_STOPPED;
-	      cpu.exception = WSTOPSIG (cpu.regs[0]);
-	    }
-	  else
-	    {
-	      cpu.state = SIM_STATE_SIGNALLED;
-	      cpu.exception = WTERMSIG (cpu.regs[0]);
-	    }
-#else
 	  /* FIXME: Doesn't this break for breakpoints when r0
 	     contains just the right (er, wrong) value?  */
 	  cpu.state = SIM_STATE_STOPPED;
-	  if (! WIFEXITED (cpu.regs[0]) && WIFSIGNALED (cpu.regs[0]))
+	  /* The format of r0 is defined by target newlib.  Expand
+             the macros here instead of looking for .../sys/wait.h.  */
+#define SIM_WIFEXITED(v) (((v) & 0xff) == 0)
+#define SIM_WIFSIGNALED(v) (((v) & 0x7f) > 0 && (((v) & 0x7f) < 0x7f))
+  	  if (! SIM_WIFEXITED (cpu.regs[0]) && SIM_WIFSIGNALED (cpu.regs[0])) 
 	    cpu.exception = SIGILL;
 	  else
 	    cpu.exception = SIGTRAP;
-#endif
 	  goto end;
 	case O (O_BPT, SN):
 	  cpu.state = SIM_STATE_STOPPED;
diff --git a/sim/h8300/writecode.c b/sim/h8300/writecode.c
index 50bbf9f..ea5c8ac 100644
--- a/sim/h8300/writecode.c
+++ b/sim/h8300/writecode.c
@@ -882,7 +882,7 @@
 	  printf ("case 0x%03x:\n", i);
 	}
 
-      /* Dont need any if's this is the only one */
+      /* Don't need any if's this is the only one */
       edo (*p);
     }
   else
diff --git a/sim/i960/ChangeLog b/sim/i960/ChangeLog
index bb87c5e..d5050ae 100644
--- a/sim/i960/ChangeLog
+++ b/sim/i960/ChangeLog
@@ -1,3 +1,13 @@
+2000-11-18  Greg McGary  <greg@mcgary.org>
+
+	* Makefile.in: remove `@true' commands for rules that have
+	$(CGEN_MAINT) as a prerequisite.
+
+2000-08-21  Frank Ch. Eigler  <fche@redhat.com>
+
+	* Makefile.in (i960-clean): Add stamp-arch, stamp-cpu.
+	(stamp-arch, stamp-cpu): New targets.
+
 Tue May 23 21:39:23 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/i960/Makefile.in b/sim/i960/Makefile.in
index deb2672..0059e23 100644
--- a/sim/i960/Makefile.in
+++ b/sim/i960/Makefile.in
@@ -98,4 +98,28 @@
 i960-clean:
 	rm -f mloop.c eng.h stamp-mloop
 	rm -f tmp-*
+	rm -f stamp-arch stamp-cpu stamp-desc
 
+# cgen support, enable with --enable-cgen-maint
+CGEN_MAINT = ; @true
+# The following line is commented in or out depending upon --enable-cgen-maint.
+@CGEN_MAINT@CGEN_MAINT =
+
+stamp-arch: $(CGEN_READ_SCM) $(CGEN_ARCH_SCM) $(srccgen)/i960.cpu
+	$(MAKE) cgen-arch $(CGEN_FLAGS_TO_PASS) mach=all \
+	  FLAGS="with-scache with-profile=fn"
+	touch stamp-arch
+arch.h arch.c cpuall.h: $(CGEN_MAINT) stamp-arch
+
+stamp-cpu: $(CGEN_READ_SCM) $(CGEN_CPU_SCM) $(CGEN_DECODE_SCM) $(srccgen)/i960.cpu
+	$(MAKE) cgen-cpu-decode $(CGEN_FLAGS_TO_PASS) \
+	  cpu=i960base mach=i960:ka_sa,i960:ca SUFFIX= FLAGS="with-scache with-profile=fn" EXTRAFILES="$(CGEN_CPU_SEM) $(CGEN_CPU_SEMSW)"
+	touch stamp-cpu
+cpu.h sem.c sem-switch.c model.c decode.c decode.h: $(CGEN_MAINT) stamp-cpu
+
+stamp-desc: $(CGEN_READ_SCM) $(CGEN_DESC_SCM) \
+		$(srccgen)/sparc.cpu $(srccgen)/sparccom.cpu $(srccgen)/i960.cpu $(srccgen)/i960.cpu
+	$(MAKE) cgen-desc $(CGEN_FLAGS_TO_PASS) \
+		cpu=i960 mach=all
+	touch stamp-desc
+i960-desc.c i960-desc.h i960-opc.h: $(CGEN_MAINT) stamp-desc
diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog
index 9f11db8..cec7d3c 100644
--- a/sim/m32r/ChangeLog
+++ b/sim/m32r/ChangeLog
@@ -1,3 +1,32 @@
+2000-11-18  Greg McGary  <greg@mcgary.org>
+
+	* Makefile.in: remove `@true' commands for rules that have
+	$(CGEN_MAINT) as a prerequisite.
+
+2000-10-06  Dave Brolley  <brolley@redhat.com>
+
+	* sem.c: Regenerated.
+	* sem-switch.c: Regenerated.
+	* semx-switch.c: Regenerated.
+
+2000-08-28  Dave Brolley  <brolley@redhat.com>
+
+	* Makefile.in: Use of @true confuses VPATH. Remove it.
+	* cpu.h: Regenerated.
+	* cpux.h: Regenerated.
+	* decode.c: Regenerated.
+	* decodex.c: Regenerated.
+	* model.c: Regenerated.
+	* modelx.c: Regenerated.
+	* sem-switch.c: Regenerated.
+	* sem.c: Regenerated.
+	* semx-switch.c: Regenerated.
+
+2000-08-21  Frank Ch. Eigler  <fche@redhat.com>
+
+	* Makefile.in (m32r-clean): Add stamp-arch, stamp-cpu.
+	(stamp-arch, stamp-cpu): New targets.
+
 Tue May 23 21:39:23 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/m32r/Makefile.in b/sim/m32r/Makefile.in
index 71296e5..0c2bf6f 100644
--- a/sim/m32r/Makefile.in
+++ b/sim/m32r/Makefile.in
@@ -1,5 +1,5 @@
 # Makefile template for Configure for the m32r simulator
-# Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 # Contributed by Cygnus Support.
 #
 # This file is part of GDB, the GNU debugger.
@@ -116,5 +116,30 @@
 m32r-clean:
 	rm -f mloop.c eng.h stamp-mloop
 	rm -f mloopx.c engx.h stamp-xmloop
+	rm -f stamp-arch stamp-cpu stamp-xcpu
 	rm -f tmp-*
 
+# cgen support, enable with --enable-cgen-maint
+CGEN_MAINT = ; @true
+# The following line is commented in or out depending upon --enable-cgen-maint.
+@CGEN_MAINT@CGEN_MAINT =
+
+stamp-arch: $(CGEN_READ_SCM) $(CGEN_ARCH_SCM) $(srccgen)/m32r.cpu
+	$(MAKE) cgen-arch $(CGEN_FLAGS_TO_PASS) mach=all \
+	  FLAGS="with-scache with-profile=fn"
+	touch stamp-arch
+arch.h arch.c cpuall.h: $(CGEN_MAINT) stamp-arch
+
+stamp-cpu: $(CGEN_READ_SCM) $(CGEN_CPU_SCM) $(CGEN_DECODE_SCM) $(srccgen)/m32r.cpu
+	$(MAKE) cgen-cpu-decode $(CGEN_FLAGS_TO_PASS) \
+	  cpu=m32rbf mach=m32r SUFFIX= \
+	  FLAGS="with-scache with-profile=fn" \
+	  EXTRAFILES="$(CGEN_CPU_SEM) $(CGEN_CPU_SEMSW)"
+	touch stamp-cpu
+cpu.h sem.c sem-switch.c model.c decode.c decode.h: $(CGEN_MAINT) stamp-cpu
+
+stamp-xcpu: $(CGEN_READ_SCM) $(CGEN_CPU_SCM) $(CGEN_DECODE_SCM) $(srccgen)/m32r.cpu
+	$(MAKE) cgen-cpu-decode $(CGEN_FLAGS_TO_PASS) \
+	  cpu=m32rxf mach=m32rx SUFFIX=x FLAGS="with-scache with-profile=fn" EXTRAFILES="$(CGEN_CPU_SEMSW)"
+	touch stamp-xcpu
+cpux.h semx-switch.c modelx.c decodex.c decodex.h: $(CGEN_MAINT) stamp-xcpu
diff --git a/sim/m32r/cpu.h b/sim/m32r/cpu.h
index fa475d5..f3df6be 100644
--- a/sim/m32r/cpu.h
+++ b/sim/m32r/cpu.h
@@ -50,14 +50,14 @@
 #define SET_H_CR(index, x) \
 do { \
 m32rbf_h_cr_set_handler (current_cpu, (index), (x));\
-} while (0)
+;} while (0)
   /* accumulator */
   DI h_accum;
 #define GET_H_ACCUM() m32rbf_h_accum_get_handler (current_cpu)
 #define SET_H_ACCUM(x) \
 do { \
 m32rbf_h_accum_set_handler (current_cpu, (x));\
-} while (0)
+;} while (0)
   /* condition bit */
   BI h_cond;
 #define GET_H_COND() CPU (h_cond)
@@ -68,7 +68,7 @@
 #define SET_H_PSW(x) \
 do { \
 m32rbf_h_psw_set_handler (current_cpu, (x));\
-} while (0)
+;} while (0)
   /* backup psw */
   UQI h_bpsw;
 #define GET_H_BPSW() CPU (h_bpsw)
@@ -137,30 +137,24 @@
   struct { /*  */
     SI* i_dr;
     UINT f_hi16;
+    UINT f_r1;
     unsigned char out_dr;
   } sfmt_seth;
   struct { /*  */
-    SI* i_sr;
-    UINT f_r1;
-    unsigned char in_sr;
-  } sfmt_mvtc;
-  struct { /*  */
-    SI* i_dr;
-    UINT f_r2;
-    unsigned char out_dr;
-  } sfmt_mvfc;
-  struct { /*  */
     ADDR i_uimm24;
     SI* i_dr;
+    UINT f_r1;
     unsigned char out_dr;
   } sfmt_ld24;
   struct { /*  */
     SI* i_sr;
+    UINT f_r2;
     unsigned char in_sr;
     unsigned char out_h_gr_14;
   } sfmt_jl;
   struct { /*  */
     SI* i_dr;
+    UINT f_r1;
     UINT f_uimm5;
     unsigned char in_dr;
     unsigned char out_dr;
@@ -168,12 +162,15 @@
   struct { /*  */
     SI* i_dr;
     INT f_simm8;
+    UINT f_r1;
     unsigned char in_dr;
     unsigned char out_dr;
   } sfmt_addi;
   struct { /*  */
     SI* i_src1;
     SI* i_src2;
+    UINT f_r1;
+    UINT f_r2;
     unsigned char in_src1;
     unsigned char in_src2;
     unsigned char out_src2;
@@ -182,12 +179,16 @@
     SI* i_src1;
     SI* i_src2;
     INT f_simm16;
+    UINT f_r1;
+    UINT f_r2;
     unsigned char in_src1;
     unsigned char in_src2;
   } sfmt_st_d;
   struct { /*  */
     SI* i_dr;
     SI* i_sr;
+    UINT f_r1;
+    UINT f_r2;
     unsigned char in_sr;
     unsigned char out_dr;
     unsigned char out_sr;
@@ -196,12 +197,16 @@
     IADDR i_disp16;
     SI* i_src1;
     SI* i_src2;
+    UINT f_r1;
+    UINT f_r2;
     unsigned char in_src1;
     unsigned char in_src2;
   } sfmt_beq;
   struct { /*  */
     SI* i_dr;
     SI* i_sr;
+    UINT f_r1;
+    UINT f_r2;
     UINT f_uimm16;
     unsigned char in_sr;
     unsigned char out_dr;
@@ -210,12 +215,16 @@
     SI* i_dr;
     SI* i_sr;
     INT f_simm16;
+    UINT f_r1;
+    UINT f_r2;
     unsigned char in_sr;
     unsigned char out_dr;
   } sfmt_add3;
   struct { /*  */
     SI* i_dr;
     SI* i_sr;
+    UINT f_r1;
+    UINT f_r2;
     unsigned char in_dr;
     unsigned char in_sr;
     unsigned char out_dr;
diff --git a/sim/m32r/cpux.h b/sim/m32r/cpux.h
index 71b14fa..83545af 100644
--- a/sim/m32r/cpux.h
+++ b/sim/m32r/cpux.h
@@ -50,21 +50,21 @@
 #define SET_H_CR(index, x) \
 do { \
 m32rxf_h_cr_set_handler (current_cpu, (index), (x));\
-} while (0)
+;} while (0)
   /* accumulator */
   DI h_accum;
 #define GET_H_ACCUM() m32rxf_h_accum_get_handler (current_cpu)
 #define SET_H_ACCUM(x) \
 do { \
 m32rxf_h_accum_set_handler (current_cpu, (x));\
-} while (0)
+;} while (0)
   /* accumulators */
   DI h_accums[2];
 #define GET_H_ACCUMS(index) m32rxf_h_accums_get_handler (current_cpu, index)
 #define SET_H_ACCUMS(index, x) \
 do { \
 m32rxf_h_accums_set_handler (current_cpu, (index), (x));\
-} while (0)
+;} while (0)
   /* condition bit */
   BI h_cond;
 #define GET_H_COND() CPU (h_cond)
@@ -75,7 +75,7 @@
 #define SET_H_PSW(x) \
 do { \
 m32rxf_h_psw_set_handler (current_cpu, (x));\
-} while (0)
+;} while (0)
   /* backup psw */
   UQI h_bpsw;
 #define GET_H_BPSW() CPU (h_bpsw)
@@ -140,47 +140,43 @@
     unsigned char out_h_gr_14;
   } sfmt_bl8;
   struct { /*  */
-    SI* i_dr;
-    UINT f_hi16;
-    unsigned char out_dr;
-  } sfmt_seth;
-  struct { /*  */
     SI f_imm1;
     UINT f_accd;
     UINT f_accs;
   } sfmt_rac_dsi;
   struct { /*  */
-    SI* i_sr;
+    SI* i_dr;
+    UINT f_hi16;
     UINT f_r1;
-    unsigned char in_sr;
-  } sfmt_mvtc;
+    unsigned char out_dr;
+  } sfmt_seth;
   struct { /*  */
     SI* i_src1;
     UINT f_accs;
+    UINT f_r1;
     unsigned char in_src1;
   } sfmt_mvtachi_a;
   struct { /*  */
     SI* i_dr;
-    UINT f_r2;
-    unsigned char out_dr;
-  } sfmt_mvfc;
-  struct { /*  */
-    SI* i_dr;
     UINT f_accs;
+    UINT f_r1;
     unsigned char out_dr;
   } sfmt_mvfachi_a;
   struct { /*  */
     ADDR i_uimm24;
     SI* i_dr;
+    UINT f_r1;
     unsigned char out_dr;
   } sfmt_ld24;
   struct { /*  */
     SI* i_sr;
+    UINT f_r2;
     unsigned char in_sr;
     unsigned char out_h_gr_14;
   } sfmt_jl;
   struct { /*  */
     SI* i_dr;
+    UINT f_r1;
     UINT f_uimm5;
     unsigned char in_dr;
     unsigned char out_dr;
@@ -188,12 +184,15 @@
   struct { /*  */
     SI* i_dr;
     INT f_simm8;
+    UINT f_r1;
     unsigned char in_dr;
     unsigned char out_dr;
   } sfmt_addi;
   struct { /*  */
     SI* i_src1;
     SI* i_src2;
+    UINT f_r1;
+    UINT f_r2;
     unsigned char in_src1;
     unsigned char in_src2;
     unsigned char out_src2;
@@ -202,6 +201,8 @@
     SI* i_src1;
     SI* i_src2;
     INT f_simm16;
+    UINT f_r1;
+    UINT f_r2;
     unsigned char in_src1;
     unsigned char in_src2;
   } sfmt_st_d;
@@ -209,12 +210,16 @@
     SI* i_src1;
     SI* i_src2;
     UINT f_acc;
+    UINT f_r1;
+    UINT f_r2;
     unsigned char in_src1;
     unsigned char in_src2;
   } sfmt_machi_a;
   struct { /*  */
     SI* i_dr;
     SI* i_sr;
+    UINT f_r1;
+    UINT f_r2;
     unsigned char in_sr;
     unsigned char out_dr;
     unsigned char out_sr;
@@ -223,12 +228,16 @@
     IADDR i_disp16;
     SI* i_src1;
     SI* i_src2;
+    UINT f_r1;
+    UINT f_r2;
     unsigned char in_src1;
     unsigned char in_src2;
   } sfmt_beq;
   struct { /*  */
     SI* i_dr;
     SI* i_sr;
+    UINT f_r1;
+    UINT f_r2;
     UINT f_uimm16;
     unsigned char in_sr;
     unsigned char out_dr;
@@ -237,12 +246,16 @@
     SI* i_dr;
     SI* i_sr;
     INT f_simm16;
+    UINT f_r1;
+    UINT f_r2;
     unsigned char in_sr;
     unsigned char out_dr;
   } sfmt_add3;
   struct { /*  */
     SI* i_dr;
     SI* i_sr;
+    UINT f_r1;
+    UINT f_r2;
     unsigned char in_dr;
     unsigned char in_sr;
     unsigned char out_dr;
diff --git a/sim/m32r/decode.c b/sim/m32r/decode.c
index 2b6b774..1ebfca1 100644
--- a/sim/m32r/decode.c
+++ b/sim/m32r/decode.c
@@ -485,9 +485,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
   FLD (i_sr) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_add", "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_add", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -517,9 +519,11 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_add3", "f_simm16 0x%x", 'x', f_simm16, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_add3", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -547,10 +551,12 @@
     f_uimm16 = EXTRACT_MSB0_UINT (insn, 32, 16, 16);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
   FLD (f_uimm16) = f_uimm16;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_and3", "f_uimm16 0x%x", 'x', f_uimm16, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_and3", "f_r2 0x%x", 'x', f_r2, "f_uimm16 0x%x", 'x', f_uimm16, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -578,10 +584,12 @@
     f_uimm16 = EXTRACT_MSB0_UINT (insn, 32, 16, 16);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
   FLD (f_uimm16) = f_uimm16;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_or3", "f_uimm16 0x%x", 'x', f_uimm16, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_or3", "f_r2 0x%x", 'x', f_r2, "f_uimm16 0x%x", 'x', f_uimm16, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -607,9 +615,10 @@
     f_simm8 = EXTRACT_MSB0_INT (insn, 16, 8, 8);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
   FLD (f_simm8) = f_simm8;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addi", "f_simm8 0x%x", 'x', f_simm8, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addi", "f_r1 0x%x", 'x', f_r1, "f_simm8 0x%x", 'x', f_simm8, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -635,9 +644,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
   FLD (i_sr) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addv", "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addv", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -667,9 +678,11 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addv3", "f_simm16 0x%x", 'x', f_simm16, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addv3", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -695,9 +708,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
   FLD (i_sr) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addx", "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addx", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -772,10 +787,12 @@
     f_disp16 = ((((EXTRACT_MSB0_INT (insn, 32, 16, 16)) << (2))) + (pc));
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_disp16) = f_disp16;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_beq", "disp16 0x%x", 'x', f_disp16, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_beq", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "disp16 0x%x", 'x', f_disp16, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -801,9 +818,10 @@
     f_disp16 = ((((EXTRACT_MSB0_INT (insn, 32, 16, 16)) << (2))) + (pc));
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
   FLD (i_disp16) = f_disp16;
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_beqz", "disp16 0x%x", 'x', f_disp16, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_beqz", "f_r2 0x%x", 'x', f_r2, "disp16 0x%x", 'x', f_disp16, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -922,9 +940,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmp", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmp", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -951,8 +971,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r2) = f_r2;
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmpi", "f_simm16 0x%x", 'x', f_simm16, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmpi", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -977,9 +998,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
   FLD (i_sr) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_div", "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_div", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1004,8 +1027,9 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_jl", "sr 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_jl", "f_r2 0x%x", 'x', f_r2, "sr 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1023,14 +1047,15 @@
   {
     const IDESC *idesc = &m32rbf_insn_data[itype];
     CGEN_INSN_INT insn = entire_insn;
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
     UINT f_r2;
 
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_jmp", "sr 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_jmp", "f_r2 0x%x", 'x', f_r2, "sr 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1055,9 +1080,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld", "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1086,9 +1113,11 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld_d", "f_simm16 0x%x", 'x', f_simm16, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld_d", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1114,9 +1143,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld_plus", "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld_plus", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1143,9 +1174,10 @@
     f_uimm24 = EXTRACT_MSB0_UINT (insn, 32, 8, 24);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
   FLD (i_uimm24) = f_uimm24;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld24", "uimm24 0x%x", 'x', f_uimm24, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld24", "f_r1 0x%x", 'x', f_r1, "uimm24 0x%x", 'x', f_uimm24, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1171,8 +1203,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm8) = f_simm8;
+  FLD (f_r1) = f_r1;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi8", "f_simm8 0x%x", 'x', f_simm8, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi8", "f_simm8 0x%x", 'x', f_simm8, "f_r1 0x%x", 'x', f_r1, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1198,8 +1231,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r1) = f_r1;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi16", "f_simm16 0x%x", 'x', f_simm16, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi16", "f_simm16 0x%x", 'x', f_simm16, "f_r1 0x%x", 'x', f_r1, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1224,9 +1258,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_lock", "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_lock", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1252,9 +1288,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_machi", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_machi", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1280,9 +1318,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mulhi", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mulhi", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1308,9 +1348,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mv", "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mv", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1334,8 +1376,9 @@
     f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvfachi", "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvfachi", "f_r1 0x%x", 'x', f_r1, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1352,7 +1395,7 @@
   {
     const IDESC *idesc = &m32rbf_insn_data[itype];
     CGEN_INSN_INT insn = entire_insn;
-#define FLD(f) abuf->fields.sfmt_mvfc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
     UINT f_r1;
     UINT f_r2;
 
@@ -1361,8 +1404,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvfc", "f_r2 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvfc", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1385,8 +1429,9 @@
     f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvtachi", "src1 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvtachi", "f_r1 0x%x", 'x', f_r1, "src1 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1403,7 +1448,7 @@
   {
     const IDESC *idesc = &m32rbf_insn_data[itype];
     CGEN_INSN_INT insn = entire_insn;
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
     UINT f_r1;
     UINT f_r2;
 
@@ -1411,9 +1456,10 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
   FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvtc", "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvtc", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1487,8 +1533,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_hi16) = f_hi16;
+  FLD (f_r1) = f_r1;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_seth", "f_hi16 0x%x", 'x', f_hi16, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_seth", "f_hi16 0x%x", 'x', f_hi16, "f_r1 0x%x", 'x', f_r1, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1516,9 +1563,11 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sll3", "f_simm16 0x%x", 'x', f_simm16, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sll3", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1544,9 +1593,10 @@
     f_uimm5 = EXTRACT_MSB0_UINT (insn, 16, 11, 5);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
   FLD (f_uimm5) = f_uimm5;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_slli", "f_uimm5 0x%x", 'x', f_uimm5, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_slli", "f_r1 0x%x", 'x', f_r1, "f_uimm5 0x%x", 'x', f_uimm5, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1572,9 +1622,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1603,9 +1655,11 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st_d", "f_simm16 0x%x", 'x', f_simm16, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st_d", "f_simm16 0x%x", 'x', f_simm16, "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1631,9 +1685,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_stb", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_stb", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1662,9 +1718,11 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_stb_d", "f_simm16 0x%x", 'x', f_simm16, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_stb_d", "f_simm16 0x%x", 'x', f_simm16, "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1690,9 +1748,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sth", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sth", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1721,9 +1781,11 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sth_d", "f_simm16 0x%x", 'x', f_simm16, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sth_d", "f_simm16 0x%x", 'x', f_simm16, "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1749,9 +1811,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st_plus", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st_plus", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1801,9 +1865,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_unlock", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_unlock", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
diff --git a/sim/m32r/decodex.c b/sim/m32r/decodex.c
index 3a8884a..a254fe8 100644
--- a/sim/m32r/decodex.c
+++ b/sim/m32r/decodex.c
@@ -447,20 +447,17 @@
       case 133 : itype = M32RXF_INSN_CMPUI; goto extract_sfmt_cmpi;
       case 134 :
         {
-          unsigned int val;
-          /* Must fetch more bits.  */
-          insn = GETIMEMUHI (current_cpu, pc + 2);
-          val = (((insn >> 12) & (15 << 0)));
+          unsigned int val = (((insn >> -6) & (63 << 0)));
           switch (val)
           {
           case 0 :
             {
-              unsigned int val = (((insn >> 8) & (15 << 0)));
+              unsigned int val = (((insn >> -12) & (63 << 0)));
               switch (val)
               {
               case 0 : itype = M32RXF_INSN_SAT; goto extract_sfmt_sat;
-              case 2 : itype = M32RXF_INSN_SATH; goto extract_sfmt_satb;
-              case 3 : itype = M32RXF_INSN_SATB; goto extract_sfmt_satb;
+              case 32 : itype = M32RXF_INSN_SATH; goto extract_sfmt_satb;
+              case 48 : itype = M32RXF_INSN_SATB; goto extract_sfmt_satb;
               default : itype = M32RXF_INSN_X_INVALID; goto extract_sfmt_empty;
               }
             }
@@ -474,27 +471,16 @@
       case 142 : itype = M32RXF_INSN_OR3; goto extract_sfmt_or3;
       case 144 :
         {
-          unsigned int val;
-          /* Must fetch more bits.  */
-          insn = GETIMEMUHI (current_cpu, pc + 2);
-          val = (((insn >> 12) & (15 << 0)));
+          unsigned int val = (((insn >> -6) & (63 << 0)));
           switch (val)
           {
           case 0 :
             {
-              unsigned int val = (((insn >> 8) & (15 << 0)));
+              unsigned int val = (((insn >> -12) & (63 << 0)));
               switch (val)
               {
-              case 0 :
-                {
-                  unsigned int val = (((insn >> 4) & (15 << 0)));
-                  switch (val)
-                  {
-                  case 0 : itype = M32RXF_INSN_DIV; goto extract_sfmt_div;
-                  case 1 : itype = M32RXF_INSN_DIVH; goto extract_sfmt_div;
-                  default : itype = M32RXF_INSN_X_INVALID; goto extract_sfmt_empty;
-                  }
-                }
+              case 0 : itype = M32RXF_INSN_DIV; goto extract_sfmt_div;
+              case 1 : itype = M32RXF_INSN_DIVH; goto extract_sfmt_div;
               default : itype = M32RXF_INSN_X_INVALID; goto extract_sfmt_empty;
               }
             }
@@ -603,9 +589,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
   FLD (i_sr) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_add", "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_add", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -635,9 +623,11 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_add3", "f_simm16 0x%x", 'x', f_simm16, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_add3", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -665,10 +655,12 @@
     f_uimm16 = EXTRACT_MSB0_UINT (insn, 32, 16, 16);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
   FLD (f_uimm16) = f_uimm16;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_and3", "f_uimm16 0x%x", 'x', f_uimm16, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_and3", "f_r2 0x%x", 'x', f_r2, "f_uimm16 0x%x", 'x', f_uimm16, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -696,10 +688,12 @@
     f_uimm16 = EXTRACT_MSB0_UINT (insn, 32, 16, 16);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
   FLD (f_uimm16) = f_uimm16;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_or3", "f_uimm16 0x%x", 'x', f_uimm16, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_or3", "f_r2 0x%x", 'x', f_r2, "f_uimm16 0x%x", 'x', f_uimm16, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -725,9 +719,10 @@
     f_simm8 = EXTRACT_MSB0_INT (insn, 16, 8, 8);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
   FLD (f_simm8) = f_simm8;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addi", "f_simm8 0x%x", 'x', f_simm8, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addi", "f_r1 0x%x", 'x', f_r1, "f_simm8 0x%x", 'x', f_simm8, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -753,9 +748,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
   FLD (i_sr) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addv", "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addv", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -785,9 +782,11 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addv3", "f_simm16 0x%x", 'x', f_simm16, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addv3", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -813,9 +812,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
   FLD (i_sr) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addx", "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_addx", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -890,10 +891,12 @@
     f_disp16 = ((((EXTRACT_MSB0_INT (insn, 32, 16, 16)) << (2))) + (pc));
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_disp16) = f_disp16;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_beq", "disp16 0x%x", 'x', f_disp16, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_beq", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "disp16 0x%x", 'x', f_disp16, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -919,9 +922,10 @@
     f_disp16 = ((((EXTRACT_MSB0_INT (insn, 32, 16, 16)) << (2))) + (pc));
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
   FLD (i_disp16) = f_disp16;
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_beqz", "disp16 0x%x", 'x', f_disp16, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_beqz", "f_r2 0x%x", 'x', f_r2, "disp16 0x%x", 'x', f_disp16, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1088,9 +1092,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmp", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmp", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1117,8 +1123,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r2) = f_r2;
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmpi", "f_simm16 0x%x", 'x', f_simm16, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmpi", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1141,8 +1148,9 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmpz", "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_cmpz", "f_r2 0x%x", 'x', f_r2, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1167,9 +1175,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
   FLD (i_sr) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_div", "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_div", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1188,14 +1198,15 @@
   {
     const IDESC *idesc = &m32rxf_insn_data[itype];
     CGEN_INSN_INT insn = entire_insn;
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
     UINT f_r2;
 
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_jc", "sr 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_jc", "f_r2 0x%x", 'x', f_r2, "sr 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1218,8 +1229,9 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_jl", "sr 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_jl", "f_r2 0x%x", 'x', f_r2, "sr 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1237,14 +1249,15 @@
   {
     const IDESC *idesc = &m32rxf_insn_data[itype];
     CGEN_INSN_INT insn = entire_insn;
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
     UINT f_r2;
 
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_jmp", "sr 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_jmp", "f_r2 0x%x", 'x', f_r2, "sr 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1269,9 +1282,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld", "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1300,9 +1315,11 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld_d", "f_simm16 0x%x", 'x', f_simm16, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld_d", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1328,9 +1345,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld_plus", "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld_plus", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1357,9 +1376,10 @@
     f_uimm24 = EXTRACT_MSB0_UINT (insn, 32, 8, 24);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
   FLD (i_uimm24) = f_uimm24;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld24", "uimm24 0x%x", 'x', f_uimm24, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ld24", "f_r1 0x%x", 'x', f_r1, "uimm24 0x%x", 'x', f_uimm24, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1385,8 +1405,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm8) = f_simm8;
+  FLD (f_r1) = f_r1;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi8", "f_simm8 0x%x", 'x', f_simm8, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi8", "f_simm8 0x%x", 'x', f_simm8, "f_r1 0x%x", 'x', f_r1, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1412,8 +1433,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r1) = f_r1;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi16", "f_simm16 0x%x", 'x', f_simm16, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_ldi16", "f_simm16 0x%x", 'x', f_simm16, "f_r1 0x%x", 'x', f_r1, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1438,9 +1460,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_lock", "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_lock", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1469,9 +1493,11 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_acc) = f_acc;
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_machi_a", "f_acc 0x%x", 'x', f_acc, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_machi_a", "f_acc 0x%x", 'x', f_acc, "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1499,10 +1525,12 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (f_acc) = f_acc;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mulhi_a", "f_acc 0x%x", 'x', f_acc, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mulhi_a", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "f_acc 0x%x", 'x', f_acc, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1528,9 +1556,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mv", "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mv", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1557,8 +1587,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_accs) = f_accs;
+  FLD (f_r1) = f_r1;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvfachi_a", "f_accs 0x%x", 'x', f_accs, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvfachi_a", "f_accs 0x%x", 'x', f_accs, "f_r1 0x%x", 'x', f_r1, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1575,7 +1606,7 @@
   {
     const IDESC *idesc = &m32rxf_insn_data[itype];
     CGEN_INSN_INT insn = entire_insn;
-#define FLD(f) abuf->fields.sfmt_mvfc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
     UINT f_r1;
     UINT f_r2;
 
@@ -1584,8 +1615,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvfc", "f_r2 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvfc", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1611,8 +1643,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_accs) = f_accs;
+  FLD (f_r1) = f_r1;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvtachi_a", "f_accs 0x%x", 'x', f_accs, "src1 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvtachi_a", "f_accs 0x%x", 'x', f_accs, "f_r1 0x%x", 'x', f_r1, "src1 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1629,7 +1662,7 @@
   {
     const IDESC *idesc = &m32rxf_insn_data[itype];
     CGEN_INSN_INT insn = entire_insn;
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
     UINT f_r1;
     UINT f_r2;
 
@@ -1637,9 +1670,10 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
   FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvtc", "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mvtc", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1722,8 +1756,9 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_hi16) = f_hi16;
+  FLD (f_r1) = f_r1;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_seth", "f_hi16 0x%x", 'x', f_hi16, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_seth", "f_hi16 0x%x", 'x', f_hi16, "f_r1 0x%x", 'x', f_r1, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1751,9 +1786,11 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sll3", "f_simm16 0x%x", 'x', f_simm16, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sll3", "f_simm16 0x%x", 'x', f_simm16, "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1779,9 +1816,10 @@
     f_uimm5 = EXTRACT_MSB0_UINT (insn, 16, 11, 5);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
   FLD (f_uimm5) = f_uimm5;
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_slli", "f_uimm5 0x%x", 'x', f_uimm5, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_slli", "f_r1 0x%x", 'x', f_r1, "f_uimm5 0x%x", 'x', f_uimm5, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1807,9 +1845,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1838,9 +1878,11 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st_d", "f_simm16 0x%x", 'x', f_simm16, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st_d", "f_simm16 0x%x", 'x', f_simm16, "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1866,9 +1908,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_stb", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_stb", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1897,9 +1941,11 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_stb_d", "f_simm16 0x%x", 'x', f_simm16, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_stb_d", "f_simm16 0x%x", 'x', f_simm16, "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1925,9 +1971,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sth", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sth", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1956,9 +2004,11 @@
 
   /* Record the fields for the semantic handler.  */
   FLD (f_simm16) = f_simm16;
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sth_d", "f_simm16 0x%x", 'x', f_simm16, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sth_d", "f_simm16 0x%x", 'x', f_simm16, "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -1984,9 +2034,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st_plus", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_st_plus", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -2036,9 +2088,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_unlock", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_unlock", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -2064,9 +2118,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_satb", "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_satb", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -2092,9 +2148,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r2) = f_r2;
+  FLD (f_r1) = f_r1;
   FLD (i_sr) = & CPU (h_gr)[f_r2];
   FLD (i_dr) = & CPU (h_gr)[f_r1];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sat", "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_sat", "f_r2 0x%x", 'x', f_r2, "f_r1 0x%x", 'x', f_r1, "sr 0x%x", 'x', f_r2, "dr 0x%x", 'x', f_r1, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -2134,9 +2192,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_macwu1", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_macwu1", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -2162,9 +2222,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_msblo", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_msblo", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
@@ -2190,9 +2252,11 @@
     f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4);
 
   /* Record the fields for the semantic handler.  */
+  FLD (f_r1) = f_r1;
+  FLD (f_r2) = f_r2;
   FLD (i_src1) = & CPU (h_gr)[f_r1];
   FLD (i_src2) = & CPU (h_gr)[f_r2];
-  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mulwu1", "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
+  TRACE_EXTRACT (current_cpu, abuf, (current_cpu, pc, "sfmt_mulwu1", "f_r1 0x%x", 'x', f_r1, "f_r2 0x%x", 'x', f_r2, "src1 0x%x", 'x', f_r1, "src2 0x%x", 'x', f_r2, (char *) 0));
 
 #if WITH_PROFILE_MODEL_P
   /* Record the fields for profiling.  */
diff --git a/sim/m32r/model.c b/sim/m32r/model.c
index 99ca3cd..b5998a2 100644
--- a/sim/m32r/model.c
+++ b/sim/m32r/model.c
@@ -893,7 +893,7 @@
 static int
 model_m32r_d_jmp (SIM_CPU *current_cpu, void *sem_arg)
 {
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
   const IDESC * UNUSED idesc = abuf->idesc;
   int cycles = 0;
@@ -1539,7 +1539,7 @@
 static int
 model_m32r_d_mvfc (SIM_CPU *current_cpu, void *sem_arg)
 {
-#define FLD(f) abuf->fields.sfmt_mvfc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
   const IDESC * UNUSED idesc = abuf->idesc;
   int cycles = 0;
@@ -1600,7 +1600,7 @@
 static int
 model_m32r_d_mvtc (SIM_CPU *current_cpu, void *sem_arg)
 {
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
   const IDESC * UNUSED idesc = abuf->idesc;
   int cycles = 0;
@@ -2875,7 +2875,7 @@
 static int
 model_test_jmp (SIM_CPU *current_cpu, void *sem_arg)
 {
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
   const IDESC * UNUSED idesc = abuf->idesc;
   int cycles = 0;
@@ -3339,7 +3339,7 @@
 static int
 model_test_mvfc (SIM_CPU *current_cpu, void *sem_arg)
 {
-#define FLD(f) abuf->fields.sfmt_mvfc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
   const IDESC * UNUSED idesc = abuf->idesc;
   int cycles = 0;
@@ -3387,7 +3387,7 @@
 static int
 model_test_mvtc (SIM_CPU *current_cpu, void *sem_arg)
 {
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
   const IDESC * UNUSED idesc = abuf->idesc;
   int cycles = 0;
diff --git a/sim/m32r/modelx.c b/sim/m32r/modelx.c
index 93e1522..3ee95b3 100644
--- a/sim/m32r/modelx.c
+++ b/sim/m32r/modelx.c
@@ -1012,7 +1012,7 @@
 static int
 model_m32rx_jc (SIM_CPU *current_cpu, void *sem_arg)
 {
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
   const IDESC * UNUSED idesc = abuf->idesc;
   int cycles = 0;
@@ -1032,7 +1032,7 @@
 static int
 model_m32rx_jnc (SIM_CPU *current_cpu, void *sem_arg)
 {
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
   const IDESC * UNUSED idesc = abuf->idesc;
   int cycles = 0;
@@ -1072,7 +1072,7 @@
 static int
 model_m32rx_jmp (SIM_CPU *current_cpu, void *sem_arg)
 {
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
   const IDESC * UNUSED idesc = abuf->idesc;
   int cycles = 0;
@@ -1718,7 +1718,7 @@
 static int
 model_m32rx_mvfc (SIM_CPU *current_cpu, void *sem_arg)
 {
-#define FLD(f) abuf->fields.sfmt_mvfc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
   const IDESC * UNUSED idesc = abuf->idesc;
   int cycles = 0;
@@ -1779,7 +1779,7 @@
 static int
 model_m32rx_mvtc (SIM_CPU *current_cpu, void *sem_arg)
 {
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   const ARGBUF * UNUSED abuf = SEM_ARGBUF ((SEM_ARG) sem_arg);
   const IDESC * UNUSED idesc = abuf->idesc;
   int cycles = 0;
diff --git a/sim/m32r/sem-switch.c b/sim/m32r/sem-switch.c
index 1b0b447..94bb9a2 100644
--- a/sim/m32r/sem-switch.c
+++ b/sim/m32r/sem-switch.c
@@ -318,12 +318,16 @@
 
   {
 #if WITH_SCACHE_PBB_M32RBF
-#ifdef DEFINE_SWITCH
+#if defined DEFINE_SWITCH || defined FAST_P
     /* In the switch case FAST_P is a constant, allowing several optimizations
        in any called inline functions.  */
     vpc = m32rbf_pbb_begin (current_cpu, FAST_P);
 #else
+#if 0 /* cgen engine can't handle dynamic fast/full switching yet.  */
     vpc = m32rbf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
+#else
+    vpc = m32rbf_pbb_begin (current_cpu, 0);
+#endif
 #endif
 #endif
   }
@@ -1191,7 +1195,7 @@
 {
   SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
   SEM_BRANCH_INIT
@@ -1761,7 +1765,7 @@
 {
   SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-#define FLD(f) abuf->fields.sfmt_mvfc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
   vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
@@ -1818,7 +1822,7 @@
 {
   SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
   vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
diff --git a/sim/m32r/sem.c b/sim/m32r/sem.c
index 63a0abf..cea7b58 100644
--- a/sim/m32r/sem.c
+++ b/sim/m32r/sem.c
@@ -179,12 +179,16 @@
 
   {
 #if WITH_SCACHE_PBB_M32RBF
-#ifdef DEFINE_SWITCH
+#if defined DEFINE_SWITCH || defined FAST_P
     /* In the switch case FAST_P is a constant, allowing several optimizations
        in any called inline functions.  */
     vpc = m32rbf_pbb_begin (current_cpu, FAST_P);
 #else
+#if 0 /* cgen engine can't handle dynamic fast/full switching yet.  */
     vpc = m32rbf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
+#else
+    vpc = m32rbf_pbb_begin (current_cpu, 0);
+#endif
 #endif
 #endif
   }
@@ -1127,7 +1131,7 @@
 static SEM_PC
 SEM_FN_NAME (m32rbf,jmp) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
@@ -1755,7 +1759,7 @@
 static SEM_PC
 SEM_FN_NAME (m32rbf,mvfc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.sfmt_mvfc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
@@ -1818,7 +1822,7 @@
 static SEM_PC
 SEM_FN_NAME (m32rbf,mvtc) (SIM_CPU *current_cpu, SEM_ARG sem_arg)
 {
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
diff --git a/sim/m32r/semx-switch.c b/sim/m32r/semx-switch.c
index a68d18b..5f184c8 100644
--- a/sim/m32r/semx-switch.c
+++ b/sim/m32r/semx-switch.c
@@ -490,12 +490,16 @@
 
   {
 #if WITH_SCACHE_PBB_M32RXF
-#ifdef DEFINE_SWITCH
+#if defined DEFINE_SWITCH || defined FAST_P
     /* In the switch case FAST_P is a constant, allowing several optimizations
        in any called inline functions.  */
     vpc = m32rxf_pbb_begin (current_cpu, FAST_P);
 #else
+#if 0 /* cgen engine can't handle dynamic fast/full switching yet.  */
     vpc = m32rxf_pbb_begin (current_cpu, STATE_RUN_FAST_P (CPU_STATE (current_cpu)));
+#else
+    vpc = m32rxf_pbb_begin (current_cpu, 0);
+#endif
 #endif
 #endif
   }
@@ -1525,7 +1529,7 @@
 {
   SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
   SEM_BRANCH_INIT
@@ -1550,7 +1554,7 @@
 {
   SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
   SEM_BRANCH_INIT
@@ -1606,7 +1610,7 @@
 {
   SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
   SEM_BRANCH_INIT
@@ -2176,7 +2180,7 @@
 {
   SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-#define FLD(f) abuf->fields.sfmt_mvfc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
   vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
@@ -2233,7 +2237,7 @@
 {
   SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
   vpc = SEM_NEXT_VPC (sem_arg, pc, 2);
@@ -3849,7 +3853,7 @@
 {
   SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
 #define OPRND(f) par_exec->operands.sfmt_jc.f
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
@@ -3874,7 +3878,7 @@
   {
     SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
     const ARGBUF *abuf = SEM_ARGBUF (sem_arg)->fields.write.abuf;
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
 #define OPRND(f) par_exec->operands.sfmt_jc.f
     int UNUSED written = abuf->written;
     IADDR UNUSED pc = abuf->addr;
@@ -3896,7 +3900,7 @@
 {
   SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
 #define OPRND(f) par_exec->operands.sfmt_jc.f
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
@@ -3921,7 +3925,7 @@
   {
     SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
     const ARGBUF *abuf = SEM_ARGBUF (sem_arg)->fields.write.abuf;
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
 #define OPRND(f) par_exec->operands.sfmt_jc.f
     int UNUSED written = abuf->written;
     IADDR UNUSED pc = abuf->addr;
@@ -3994,7 +3998,7 @@
 {
   SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
 #define OPRND(f) par_exec->operands.sfmt_jmp.f
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
@@ -4015,7 +4019,7 @@
   {
     SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
     const ARGBUF *abuf = SEM_ARGBUF (sem_arg)->fields.write.abuf;
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_jl.f
 #define OPRND(f) par_exec->operands.sfmt_jmp.f
     int UNUSED written = abuf->written;
     IADDR UNUSED pc = abuf->addr;
@@ -4851,7 +4855,7 @@
 {
   SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-#define FLD(f) abuf->fields.sfmt_mvfc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
 #define OPRND(f) par_exec->operands.sfmt_mvfc.f
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
@@ -4872,7 +4876,7 @@
   {
     SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
     const ARGBUF *abuf = SEM_ARGBUF (sem_arg)->fields.write.abuf;
-#define FLD(f) abuf->fields.sfmt_mvfc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
 #define OPRND(f) par_exec->operands.sfmt_mvfc.f
     int UNUSED written = abuf->written;
     IADDR UNUSED pc = abuf->addr;
@@ -4965,7 +4969,7 @@
 {
   SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
   ARGBUF *abuf = SEM_ARGBUF (sem_arg);
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
 #define OPRND(f) par_exec->operands.sfmt_mvtc.f
   int UNUSED written = 0;
   IADDR UNUSED pc = abuf->addr;
@@ -4986,7 +4990,7 @@
   {
     SEM_ARG sem_arg = SEM_SEM_ARG (vpc, sc);
     const ARGBUF *abuf = SEM_ARGBUF (sem_arg)->fields.write.abuf;
-#define FLD(f) abuf->fields.sfmt_mvtc.f
+#define FLD(f) abuf->fields.sfmt_ld_plus.f
 #define OPRND(f) par_exec->operands.sfmt_mvtc.f
     int UNUSED written = abuf->written;
     IADDR UNUSED pc = abuf->addr;
diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
new file mode 100644
index 0000000..bf0ce64
--- /dev/null
+++ b/sim/m68hc11/ChangeLog
@@ -0,0 +1,273 @@
+2000-11-26  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* dv-m68hc11.c (m68hc11cpu_io_read_buffer): Use attach_size
+	instead of a hard-coded value.
+	(m68hc11cpu_io_write_buffer): Likewise.
+	(dv_m68hc11_descriptor): Define a 68hc12 device.
+	* dv-m68hc11eepr.c (dv_m68hc11eepr_descriptor): Likewise.
+	* dv-m68hc11tim.c (dv_m68hc11tim_descriptor): Likewise.
+	* dv-m68hc11spi.c (dv_m68hc11spi_descriptor): Likewise.
+	* dv-m68hc11sio.c (dv_m68hc11sio_descriptor): Likewise.
+
+2000-11-22  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* dv-m68hc11.c (attach_m68hc11_regs): Register a delete handler.
+	(m68hc11cpu_delete): Delete handler to detach the address space.
+
+2000-11-24  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* dv-m68hc11eepr.c (attach_m68hc11eepr_regs): Use hw_malloc.
+	* dv-nvram.c (attach_nvram_regs): Use hw_free and hw_malloc
+	instead of free and malloc.
+
+2000-09-11  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* Makefile.in: Was missing from initial patch.
+
+2000-09-10  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* interp.c (sim_store_register): Remove soft register hack.
+	(sim_fetch_register): Likewise.
+	(sim_create_inferior): Likewise.
+	* sim-main.h: Likewise.
+
+2000-09-10  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* interrupts.c (interrupts_update_pending): Clear the mask of
+	pending interrupts here.
+	(interrupts_get_current): Don't clear the mask of pending interrupts.
+
+2000-09-10  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* sim-main.h: Define cycle_to_string.
+	* dv-m68hc11tim.c (cycle_to_string): New function to translate 
+	the cpu cycle into some formatted time string.
+	(m68hc11tim_print_timer): Use it.
+	* dv-m68hc11sio.c (m68hc11sio_info): Use cycle_to_string.
+	* dv-m68hc11spi.c (m68hc11spi_info): Likewise.
+	* interrupts.c (interrupts_info): Likewise.
+	* m68hc11_sim.c (cpu_info): Likewise.
+
+2000-09-06  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* dv-m68hc11tim.c (m68hc11tim_timer_event): Compute the overflow
+	interrupt and compare events accurately.  Take into account the
+	pending ticks not processed by the simulator yet (introduced a shift).
+	(m68hc11_port_event): Reset the timer interrupt delays.
+	(m68hc11tim_io_read_buffer): Be able to read several bytes.
+	(m68hc11tim_io_write_buffer): Likewise for write.
+	(m68hc11tim_io_write_buffer): Recompute the timer overflow interrupt.
+
+2000-09-06  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* dv-m68hc11spi.c (m68hc11spi_io_read_buffer): Clear the interrupts.
+	(m68hc11spi_io_write_buffer): Likewise and fix the spi frame.
+	(m68hc11spi_info): Clarify the status report
+	of the SPI when a byte is being sent.
+	(m68hc11spi_clock): Fix the spi send frame.
+	
+2000-08-11  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* sim-main.h (m68hc11_map_level): Define level of address mappings.
+	* dv-m68hc11eepr.c (struct m68hc11eepr ): New flag to indicate
+	whether the eeprom is currently mapped or not.
+	(m68hc11eepr_port_event): Use the flag to see if we must unmap
+	or map the eeprom.  Update the flag to reflect the current state.
+	Use M6811_EEPROM_LEVEL when mapping the eeprom.
+	(m68hc11eepr_finish): Remove overlap hack.
+	(attach_m68hc11eepr_regs): Use M6811_IO_LEVEL when mapping the
+	config and control registers.
+	* dv-m68hc11.c (m68hc11cpu_finish): Remove overlap hack.
+	(attach_m68hc11_regs): Use M6811_IO_LEVEL.
+	(m68hc11cpu_io_write): Likewise when unmapping and re-mapping.
+	* dv-m68hc11spi.c (m68hc11spi_finish): Likewise.
+	(attach_m68hc11spi_regs): Likewise.
+	* dv-m68hc11tim.c (m68hc11tim_finish): Likewise.
+	(attach_m68hc11tim_regs): Likewise.
+	* dv-m68hc11sio.c (m68hc11sio_finish): Likewise.
+	(attach_m68hc11sio_regs): Likewise.
+	* interp.c (sim_open): Likewise.
+	* dv-nvram.c (attach_nvram_regs): Likewise.
+
+Thu Jul 27 21:27:25 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure, config.in: Regenerate.
+
+2000-06-25  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* Makefile.in (SIM_RUN_OBJS): Define to use nrun.c
+	* dv-m68hc11.c (m68hc11cpu_finish): Register detach address callback.
+	(dv_m6811_detach_address_callback): New function to detach a
+	device from an address space.
+	* dv-m68hc11eepr.c (m68hc11eepr_port_event): Initialize
+	config register according to --cpu-config option.
+	* sim-main.h (_sim_cpu): Add cpu_config member.
+	* interp.c (sim_open): Delete specific simulator options.
+	* m68hc11_sim.c (cpu_option_handler): New options
+	--emulos and -cpu-config <val> to configure the simulator.
+	(cpu_initialize): Initialize cpu_config member.
+
+2000-06-24  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* emulos.c: Fix indentation and comments.
+	* gencode.c: Likewise.
+	* dv-m68hc11tim.c (m68hc11tim_timer_event): Handle COMPARE_EVENT.
+	(m68hc11tim_io_write_buffer): Write compare registers and
+	setup compare event.
+	* interp.c: Remove unused global variables.
+	* interrupts.c (idefs): New compare interrupts.
+	Fix indentation and comments.
+	* interrupts.h: Likewise.
+
+2000-06-18  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* dv-m68hc11sio.c: Fix indentation and comments.
+	Remove INT_PORT.
+	* dv-m68hc11.c: Fix indentation and comments.
+	(m68hc11cpu_port_event): Move initialization of M6811_HPRIO from here.
+	* m68hc11_sim.c (cpu_reset): To here.
+	* dv-m68hc11eepr.c: Fix indentation and comments.
+	
+2000-06-17  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* dv-nvram.c: New file, rename from dv-pram.c.
+	* dv-pram.c: Delete file.
+	* sim-main.h: Incorporate m68hc11_sim.h.
+	* m68hc11_sim.h: Delete file.
+	* configure.in: Rename pram into nvram.
+	* interp.c (sim_open): Likewise in creation of device tree.
+	
+2000-05-31  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* interp.c (sim_open): Create the SPI device.
+	* dv-m68hc11spi.c: New file for SPI device simulation.
+	* configure.in (hw_extra_devices): Add SPI device.
+
+2000-05-28  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* interrupts.c (interrupts_initialize): Clear XIRQ accounting.
+	(interrupts_process): Separate IRQ and XIRQ accounting.
+	(interrupts_info): Report XIRQ accounting.
+	* interrupts.h (struct interrupts): Added accounting for XIRQ.
+
+2000-04-16  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* dv-pram.c (attach_pram_regs): Fix the 'save-modified' mode.
+	* m68hc11_sim.h (_sim_cpu): Allow configuration of cpu mode.
+	* dv-m68hc11.c (attach_m68hc11_regs): Get the cpu MODA,MODB 
+	configuration from the 'mode' device tree property.
+	(m68hc11cpu_port_event): Reset M6811_HPRIO to the cpu MODA, MODB
+	configuration.
+
+2000-02-24  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* sim-main.h: Remove WITH_TARGET_* defines.
+	* Makefile.in (SIM_EXTRA_CFLAGS): Specify the WITH_TARGET_* flags.
+
+2000-02-08  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* dv-m68hc11sio.c (m68hc11sio_port_event): Setup the SCI to
+	1200 baud when cpu is in bootstrap mode.
+
+	* dv-m68hc11tim.c (m68hc11tim_io_write_buffer): Be able to
+	write in the TCTN timer register.
+
+	* dv-m68hc11sio.c (m68hc11sio_io_write_buffer): Divide cpu clock
+	by 4 to obtain the E clock frequency.
+	(sccr2_desc): Use M6811_TIE for TIE bit.
+	(m68hc11sio_info): Fix baud rate report.
+
+	* dv-m68hc11tim.c (to_realtime): Likewise.
+
+	* interp.c (sim_open): When building device tree, only provide
+	devices that do not exist yet.
+
+	* emulos.c: Fix compilation pb under Windows.
+
+	* dv-m68hc11.c (attach_m68hc11_regs): Get the clock frequency
+	from the 'clock' property.
+
+2000-01-02  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* m68hc11_sim.h (*_REGNUM): Define.
+	(_sim_cpu): New member cpu_page0_reg table.
+	* interp.c (sim_create_inferior): Fill the cpu_page0_reg table with
+	addresses of soft registers in .page0.
+	(sim_fetch_register, sim_store_register): Use cpu_page0_reg table 
+	to get/set soft registers.
+
+1999-12-31  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* dv-m68hc11.c (m68hc11cpu_io_write_buffer): Clear byte to avoid
+	returning random values.
+
+1999-12-17  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* gencode.c: Fix "subb N,x" that used a instead of b.
+
+1999-09-09  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* gencode.c: Fixed sbc8 and adc8 when there was a initial carry.
+
+1999-09-01  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* sim-main.h (SIM_HANDLES_LMA): Define to enable loading using lma.
+
+1999-08-14  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* dv-m68hc11.c (attach_m68hc11_regs): Save the size of the
+	register region in the m68hc11cpu struct.
+	(m68hc11cpu_io_write): When the IO mapping addres changes,
+	detach the register region and re-attach it at the new address.
+	(m68hc11cpu_io_read_buffer): Renamed base_address into
+	attach_address.
+	(m68hc11cpu_io_write_buffer): Likewise. Pass the hw pointer
+	to m68hc11cpu_io_write.
+
+1999-08-13  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* gencode.c: For sbc8, check the carry and increment the source
+	before trying to set the carry for the result.
+
+1999-05-24  John S. Kallal <kallal@voicenet.com>
+	
+	* interp.c (sim_get_info): Don't crash if the command line is 0.
+	Define prototype for sim_get_info() and init_system().
+	(sim_info): Correct call to sim_get_info().
+	
+1999-05-16  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* configure.in: Recognize m6811-*-*.
+	* configure: Regenerate.
+	* m68hc11_sim.h (cpu_ccr_update_add8, cpu_ccr_update_add16,
+	cpu_ccr_update_sub8, cpu_ccr_update_sub16):
+	Correct the computation of carry of 8 and 16-bits add and subtract.
+	* gencode.c: Use cpu_ccr_update_sub8 for subtraction (carry and
+	overflow set in a different manner than add).
+
+1999-05-14  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* dv-m68hc11.c (dv_m6811_attach_address_callback): Removed a
+	trace message.
+	* interp.c (sim_open, sim_create_inferior): Initialize the
+	cpu_elf_start from the ELF header.
+	* m68hc11_sim.c (cpu_initialize): Clear the new data members.
+	(cpu_restart): Use cpu_elf_start as the starting address when
+	the flag is set.
+	(cpu_special): When cpu_use_elf_start is set, the WAI instruction
+	exits the simulator (exit status is in D).
+	* m68hc11_sim.h (_sim_cpu): Added members cpu_use_elf_start and
+	cpu_elf_star to start execution at address specified in ELF file.
+
+1999-05-02  Stephane Carrez  <stcarrez@worldnet.fr>
+
+	* Makefile.in, config.in, configure, configure.in: New files.
+	* gencode.c: New file, generation of 68HC11 interpreter.
+	* m68hc11_sim.h, m68hc11_sim.c: New files, specific operations
+	for interpreter.
+	* interrupts.c, interrupts.h: New files, management of interrupts.
+	* interp.c, sim-main.h, 
+	* dv-m68hc11.c, dv-m68hc11eepr.c, dv-m68hc11sio.c,
+	dv-m68hc11tim.c, dv-pram.c: New files representing devices for
+	68HC11 (dv-pram.c is generic and could probably migrate to common).
+	* emulos.c: New file, basic emulation of some os.
diff --git a/sim/m68hc11/Makefile.in b/sim/m68hc11/Makefile.in
new file mode 100644
index 0000000..6cbf400
--- /dev/null
+++ b/sim/m68hc11/Makefile.in
@@ -0,0 +1,60 @@
+#    Makefile template for Configure for the 68HC11 sim library.
+#    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+#    Written by Cygnus Support.
+# 
+# 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.
+
+## COMMON_PRE_CONFIG_FRAG
+
+M68HC11_OBJS = interp.o m68hc11int.o emulos.o interrupts.o m68hc11_sim.o
+
+# List of main object files for `run'.
+SIM_RUN_OBJS = nrun.o
+
+SIM_OBJS = $(M68HC11_OBJS) \
+	$(SIM_NEW_COMMON_OBJS) \
+	sim-load.o \
+	sim-hload.o \
+	sim-engine.o \
+	sim-stop.o \
+	sim-resume.o \
+	sim-hrw.o \
+	sim-reason.o \
+        $(SIM_EXTRA_OBJS)
+
+SIM_PROFILE= -DPROFILE=1 -DWITH_PROFILE=-1
+SIM_EXTRA_CFLAGS = -DWITH_TARGET_WORD_BITSIZE=16 \
+		   -DWITH_TARGET_CELL_BITSIZE=32 \
+		   -DWITH_TARGET_WORD_MSB=15
+SIM_EXTRA_CLEAN = clean-extra
+
+SIM_EXTRA_OBJS = @m68hc11_extra_objs@
+
+INCLUDE = $(srcdir)/../../include/callback.h \
+	  interrupts.h sim-main.h
+
+
+## COMMON_POST_CONFIG_FRAG
+
+m68hc11int.c: gencode
+	./gencode > $@
+
+gencode:	gencode.c
+	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -o gencode $<
+
+interp.o: interp.c $(INCLUDE)
+
+clean-extra:
+	rm -f gencode m68hc11int.c
diff --git a/sim/m68hc11/config.in b/sim/m68hc11/config.in
new file mode 100644
index 0000000..dbd6508
--- /dev/null
+++ b/sim/m68hc11/config.in
@@ -0,0 +1,174 @@
+/* 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 as the return type of signal handlers (int or void).  */
+#undef RETSIGTYPE
+
+/* 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 if your processor stores words with the most significant
+   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
+#undef WORDS_BIGENDIAN
+
+/* Define to 1 if NLS is requested.  */
+#undef ENABLE_NLS
+
+/* 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 __setfpucw function.  */
+#undef HAVE___SETFPUCW
+
+/* Define if you have the aint function.  */
+#undef HAVE_AINT
+
+/* Define if you have the anint function.  */
+#undef HAVE_ANINT
+
+/* 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 getrusage function.  */
+#undef HAVE_GETRUSAGE
+
+/* 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 sigaction function.  */
+#undef HAVE_SIGACTION
+
+/* Define if you have the sqrt function.  */
+#undef HAVE_SQRT
+
+/* 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 time function.  */
+#undef HAVE_TIME
+
+/* Define if you have the <argz.h> header file.  */
+#undef HAVE_ARGZ_H
+
+/* Define if you have the <fcntl.h> header file.  */
+#undef HAVE_FCNTL_H
+
+/* Define if you have the <fpu_control.h> header file.  */
+#undef HAVE_FPU_CONTROL_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 <stdlib.h> header file.  */
+#undef HAVE_STDLIB_H
+
+/* Define if you have the <string.h> header file.  */
+#undef HAVE_STRING_H
+
+/* Define if you have the <strings.h> header file.  */
+#undef HAVE_STRINGS_H
+
+/* Define if you have the <sys/param.h> header file.  */
+#undef HAVE_SYS_PARAM_H
+
+/* Define if you have the <sys/resource.h> header file.  */
+#undef HAVE_SYS_RESOURCE_H
+
+/* Define if you have the <sys/time.h> header file.  */
+#undef HAVE_SYS_TIME_H
+
+/* Define if you have the <time.h> header file.  */
+#undef HAVE_TIME_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 m library (-lm).  */
+#undef HAVE_LIBM
diff --git a/sim/m68hc11/configure b/sim/m68hc11/configure
new file mode 100755
index 0000000..e636611
--- /dev/null
+++ b/sim/m68hc11/configure
@@ -0,0 +1,4353 @@
+#! /bin/sh
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+sim_inline="-DDEFAULT_INLINE=0"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 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
+
+
+
+
+
+# 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
+
+
+
+# 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
+
+
+
+
+
+
+# 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:
+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"
+ac_help="$ac_help
+  --enable-maintainer-mode		Enable developer functionality."
+ac_help="$ac_help
+  --enable-sim-bswap			Use Host specific BSWAP instruction."
+ac_help="$ac_help
+  --enable-sim-cflags=opts		Extra CFLAGS for use in building simulator"
+ac_help="$ac_help
+  --enable-sim-debug=opts		Enable debugging flags"
+ac_help="$ac_help
+  --enable-sim-stdio			Specify whether to use stdio for console input/output."
+ac_help="$ac_help
+  --enable-sim-trace=opts		Enable tracing flags"
+ac_help="$ac_help
+  --enable-sim-profile=opts		Enable profiling flags"
+ac_help="$ac_help
+  --enable-sim-inline=inlines		Specify which functions should be inlined."
+ac_help="$ac_help
+  --enable-sim-alignment=align		Specify strict,  nonstrict or forced alignment of memory accesses."
+ac_help="$ac_help
+  --enable-sim-hostendian=end		Specify host byte endian orientation."
+ac_help="$ac_help
+  --enable-build-warnings[=LIST]		Enable build-time compiler warnings"
+ac_help="$ac_help
+  --enable-sim-hardware=LIST		Specify the hardware to be included in the build."
+
+# 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=Makefile.in
+
+# 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
+
+
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:689: 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 704 "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:710: \"$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 721 "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:727: \"$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 738 "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:744: \"$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
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:769: 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
+
+echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
+echo "configure:796: 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:817: 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 822 "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:830: \"$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*
+  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 847 "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 865 "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 886 "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:897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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:921: 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 926 "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:975: \"$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:996: 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 1003 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:1010: \"$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:1036: 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 1041 "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 "(^|[^a-zA-Z_0-9])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:1069: 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 1074 "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 "(^|[^a-zA-Z_0-9])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:1104: 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 1109 "configure"
+#include "confdefs.h"
+#include <alloca.h>
+int main() {
+char *p = alloca(2 * sizeof(int));
+; return 0; }
+EOF
+if { (eval echo configure:1116: \"$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
+  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:1137: 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 1142 "configure"
+#include "confdefs.h"
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _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
+#endif
+
+int main() {
+char *p = (char *) alloca(1);
+; return 0; }
+EOF
+if { (eval echo configure:1170: \"$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
+  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.${ac_objext}
+  cat >> confdefs.h <<\EOF
+#define C_ALLOCA 1
+EOF
+
+
+echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+echo "configure:1202: 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 1207 "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:1232: 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 1237 "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:1260: \"$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
+  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:1287: 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 1295 "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:1314: \"$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
+  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:1339: 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 1344 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1349: \"$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:1378: 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 1383 "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:1406: \"$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:1431: 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 1439 "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:1579: \"$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
+
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:1602: 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 1607 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:1618: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_cygwin=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:1635: 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 1640 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:1647: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_mingw32=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+
+# autoconf.info says this should be called right after AC_INIT.
+
+
+ac_aux_dir=
+for ac_dir in `cd $srcdir;pwd`/../.. $srcdir/`cd $srcdir;pwd`/../..; 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 `cd $srcdir;pwd`/../.. $srcdir/`cd $srcdir;pwd`/../.." 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.
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+#    configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+#    same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+#    as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# 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:1714: 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 target system type""... $ac_c" 1>&6
+echo "configure:1735: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+  case $nonopt in
+  NONE) target_alias=$host_alias ;;
+  *) target_alias=$nonopt ;;
+  esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:1753: 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
+
+test "$host_alias" != "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+if test "$program_transform_name" = s,x,x,; then
+  program_transform_name=
+else
+  # Double any \ or $.  echo might interpret backslashes.
+  cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+  program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+  rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,${program_prefix},; $program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+# 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:1797: 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:1827: 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:1878: 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:1910: 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 1921 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1926: \"$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:1952: 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:1957: 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:1966: \"$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:1985: 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
+
+# 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:2028: 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'
+
+
+# Put a plausible default for CC_FOR_BUILD in Makefile.
+if test "x$cross_compiling" = "xno"; then
+  CC_FOR_BUILD='$(CC)'
+else
+  CC_FOR_BUILD=gcc
+fi
+
+
+
+
+AR=${AR-ar}
+
+# 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:2096: 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
+
+
+ALL_LINGUAS=
+                              
+   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:2131: 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 2136 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2141: \"$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 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:2171: 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 2176 "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:2199: \"$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
+
+
+   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:2228: 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 2233 "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:2256: \"$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
+
+   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:2290: 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 2295 "configure"
+#include "confdefs.h"
+#include <locale.h>
+int main() {
+return LC_MESSAGES
+; return 0; }
+EOF
+if { (eval echo configure:2302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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:2323: 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:2343: 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:2362: 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 2367 "configure"
+#include "confdefs.h"
+#include <libintl.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2372: \"$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
+  echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
+echo "configure:2389: 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 2394 "configure"
+#include "confdefs.h"
+#include <libintl.h>
+int main() {
+return (int) gettext ("")
+; return 0; }
+EOF
+if { (eval echo configure:2401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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:2417: 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 2425 "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:2436: \"$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
+  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:2452: 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 2457 "configure"
+#include "confdefs.h"
+
+int main() {
+return (int) gettext ("")
+; return 0; }
+EOF
+if { (eval echo configure:2464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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:2492: 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:2526: 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 2531 "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:2554: \"$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
+
+		# 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:2581: 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=":"
+  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_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:2617: 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 2649 "configure"
+#include "confdefs.h"
+
+int main() {
+extern int _nl_msg_cat_cntr;
+			       return _nl_msg_cat_cntr
+; return 0; }
+EOF
+if { (eval echo configure:2657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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:2689: 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:2723: 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=":"
+  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_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:2759: 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:2849: 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:2877: 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 2882 "configure"
+#include "confdefs.h"
+#include <linux/version.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2887: \"$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
+  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
+  
+
+# Check for common headers.
+# FIXME: Seems to me this can cause problems for i386-windows hosts.
+# At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*.
+for ac_hdr in stdlib.h string.h strings.h unistd.h time.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2956: 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 2961 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2966: \"$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_hdr in sys/time.h sys/resource.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2996: 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 3001 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3006: \"$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_hdr in fcntl.h fpu_control.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:3036: 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 3041 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3046: \"$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_hdr in dlfcn.h errno.h sys/stat.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:3076: 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 3081 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3086: \"$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 getrusage time sigaction __setfpucw
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3115: 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 3120 "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:3143: \"$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
+
+
+# Check for socket libraries
+echo $ac_n "checking for bind in -lsocket""... $ac_c" 1>&6
+echo "configure:3170: checking for bind in -lsocket" >&5
+ac_lib_var=`echo socket'_'bind | 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="-lsocket  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3178 "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 bind();
+
+int main() {
+bind()
+; return 0; }
+EOF
+if { (eval echo configure:3189: \"$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
+  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
+    ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lsocket $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
+echo "configure:3217: checking for gethostbyname in -lnsl" >&5
+ac_lib_var=`echo nsl'_'gethostbyname | 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="-lnsl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3225 "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 gethostbyname();
+
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:3236: \"$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
+  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
+    ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lnsl $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+. ${srcdir}/../../bfd/configure.host
+
+
+
+USE_MAINTAINER_MODE=no
+# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+  enableval="$enable_maintainer_mode"
+  case "${enableval}" in
+  yes)	MAINT="" USE_MAINTAINER_MODE=yes ;;
+  no)	MAINT="#" ;;
+  *)	{ echo "configure: error: "--enable-maintainer-mode does not take a value"" 1>&2; exit 1; }; MAINT="#" ;;
+esac
+if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
+  echo "Setting maintainer mode" 6>&1
+fi
+else
+  MAINT="#"
+fi
+
+
+
+# Check whether --enable-sim-bswap or --disable-sim-bswap was given.
+if test "${enable_sim_bswap+set}" = set; then
+  enableval="$enable_sim_bswap"
+  case "${enableval}" in
+  yes)	sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
+  no)	sim_bswap="-DWITH_BSWAP=0";;
+  *)	{ echo "configure: error: "--enable-sim-bswap does not take a value"" 1>&2; exit 1; }; sim_bswap="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
+  echo "Setting bswap flags = $sim_bswap" 6>&1
+fi
+else
+  sim_bswap=""
+fi
+
+
+
+# Check whether --enable-sim-cflags or --disable-sim-cflags was given.
+if test "${enable_sim_cflags+set}" = set; then
+  enableval="$enable_sim_cflags"
+  case "${enableval}" in
+  yes)	 sim_cflags="-O2 -fomit-frame-pointer";;
+  trace) { echo "configure: error: "Please use --enable-sim-debug instead."" 1>&2; exit 1; }; sim_cflags="";;
+  no)	 sim_cflags="";;
+  *)	 sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+esac
+if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
+  echo "Setting sim cflags = $sim_cflags" 6>&1
+fi
+else
+  sim_cflags=""
+fi
+
+
+
+# Check whether --enable-sim-debug or --disable-sim-debug was given.
+if test "${enable_sim_debug+set}" = set; then
+  enableval="$enable_sim_debug"
+  case "${enableval}" in
+  yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";;
+  no)  sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";;
+  *)   sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
+  echo "Setting sim debug = $sim_debug" 6>&1
+fi
+else
+  sim_debug=""
+fi
+
+
+
+# Check whether --enable-sim-stdio or --disable-sim-stdio was given.
+if test "${enable_sim_stdio+set}" = set; then
+  enableval="$enable_sim_stdio"
+  case "${enableval}" in
+  yes)	sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
+  no)	sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
+  *)	{ echo "configure: error: "Unknown value $enableval passed to --enable-sim-stdio"" 1>&2; exit 1; }; sim_stdio="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
+  echo "Setting stdio flags = $sim_stdio" 6>&1
+fi
+else
+  sim_stdio=""
+fi
+
+
+
+# Check whether --enable-sim-trace or --disable-sim-trace was given.
+if test "${enable_sim_trace+set}" = set; then
+  enableval="$enable_sim_trace"
+  case "${enableval}" in
+  yes)	sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
+  no)	sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
+  [-0-9]*)
+	sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
+  [a-z]*)
+	sim_trace=""
+	for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
+	  if test x"$sim_trace" = x; then
+	    sim_trace="-DWITH_TRACE='(TRACE_$x"
+	  else
+	    sim_trace="${sim_trace}|TRACE_$x"
+	  fi
+	done
+	sim_trace="$sim_trace)'" ;;
+esac
+if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
+  echo "Setting sim trace = $sim_trace" 6>&1
+fi
+else
+  sim_trace=""
+fi
+
+
+
+# Check whether --enable-sim-profile or --disable-sim-profile was given.
+if test "${enable_sim_profile+set}" = set; then
+  enableval="$enable_sim_profile"
+  case "${enableval}" in
+  yes)	sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";;
+  no)	sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";;
+  [-0-9]*)
+	sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
+  [a-z]*)
+	sim_profile=""
+	for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
+	  if test x"$sim_profile" = x; then
+	    sim_profile="-DWITH_PROFILE='(PROFILE_$x"
+	  else
+	    sim_profile="${sim_profile}|PROFILE_$x"
+	  fi
+	done
+	sim_profile="$sim_profile)'" ;;
+esac
+if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
+  echo "Setting sim profile = $sim_profile" 6>&1
+fi
+else
+  sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1"
+fi
+
+
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:3412: 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 3417 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:3434: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_type_signal=void
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_type_signal=int
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
+
+
+
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:3456: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  ac_cv_exeext=.exe
+else
+  rm -f conftest*
+  echo 'int main () { return 0; }' > conftest.$ac_ext
+  ac_cv_exeext=
+  if { (eval echo configure:3466: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+    for file in conftest.*; do
+      case $file in
+      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+      esac
+    done
+  else
+    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+  fi
+  rm -f conftest*
+  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+
+sim_link_files=
+sim_link_links=
+
+sim_link_links=tconfig.h
+if test -f ${srcdir}/tconfig.in
+then
+  sim_link_files=tconfig.in
+else
+  sim_link_files=../common/tconfig.in
+fi
+
+# targ-vals.def points to the libc macro description file.
+case "${target}" in
+*-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
+esac
+sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
+sim_link_links="${sim_link_links} targ-vals.def"
+
+
+
+
+default_sim_inline=""
+# Check whether --enable-sim-inline or --disable-sim-inline was given.
+if test "${enable_sim_inline+set}" = set; then
+  enableval="$enable_sim_inline"
+  sim_inline=""
+case "$enableval" in
+  no)		sim_inline="-DDEFAULT_INLINE=0";;
+  0)		sim_inline="-DDEFAULT_INLINE=0";;
+  yes | 2)	sim_inline="-DDEFAULT_INLINE=ALL_C_INLINE";;
+  1)		sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
+  *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
+       new_flag=""
+       case "$x" in
+	 *_INLINE=*)	new_flag="-D$x";;
+	 *=*)		new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
+	 *_INLINE)	new_flag="-D$x=ALL_C_INLINE";;
+	 *)		new_flag="-D$x""_INLINE=ALL_C_INLINE";;
+       esac
+       if test x"$sim_inline" = x""; then
+	 sim_inline="$new_flag"
+       else
+	 sim_inline="$sim_inline $new_flag"
+       fi
+     done;;
+esac
+if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
+  echo "Setting inline flags = $sim_inline" 6>&1
+fi
+else
+  
+if test "x$cross_compiling" = "xno"; then
+  if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
+    sim_inline="${default_sim_inline}"
+    if test x"$silent" != x"yes"; then
+      echo "Setting inline flags = $sim_inline" 6>&1
+    fi
+  else
+    sim_inline=""
+  fi
+else
+  sim_inline="-DDEFAULT_INLINE=0"
+fi
+fi
+
+wire_alignment="NONSTRICT_ALIGNMENT"
+default_alignment=""
+
+# Check whether --enable-sim-alignment or --disable-sim-alignment was given.
+if test "${enable_sim_alignment+set}" = set; then
+  enableval="$enable_sim_alignment"
+  case "${enableval}" in
+  strict | STRICT)       sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
+  nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
+  forced | FORCED)       sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";;
+  yes) if test x"$wire_alignment" != x; then
+	 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
+       else
+         if test x"$default_alignment" != x; then
+           sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
+         else
+	   echo "No hard-wired alignment for target $target" 1>&6
+	   sim_alignment="-DWITH_ALIGNMENT=0"
+         fi
+       fi;;
+  no)  if test x"$default_alignment" != x; then
+	 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
+       else
+         if test x"$wire_alignment" != x; then
+	   sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
+         else
+           echo "No default alignment for target $target" 1>&6
+           sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
+         fi
+       fi;;
+  *)   { echo "configure: error: "Unknown value $enableval passed to --enable-sim-alignment"" 1>&2; exit 1; }; sim_alignment="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
+  echo "Setting alignment flags = $sim_alignment" 6>&1
+fi
+else
+  if test x"$default_alignment" != x; then
+  sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
+else
+  if test x"$wire_alignment" != x; then
+    sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
+  else
+    sim_alignment=
+  fi
+fi
+fi
+
+
+# Check whether --enable-sim-hostendian or --disable-sim-hostendian was given.
+if test "${enable_sim_hostendian+set}" = set; then
+  enableval="$enable_sim_hostendian"
+  case "${enableval}" in
+  no)	 sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
+  b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
+  l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
+  *)	 { echo "configure: error: "Unknown value $enableval for --enable-sim-hostendian"" 1>&2; exit 1; }; sim_hostendian="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
+  echo "Setting hostendian flags = $sim_hostendian" 6>&1
+fi
+else
+  
+if test "x$cross_compiling" = "xno"; then
+  echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
+echo "configure:3616: checking whether byte ordering is bigendian" >&5
+if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_c_bigendian=unknown
+# See if sys/param.h defines the BYTE_ORDER macro.
+cat > conftest.$ac_ext <<EOF
+#line 3623 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:3634: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+cat > conftest.$ac_ext <<EOF
+#line 3638 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:3649: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_bigendian=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_bigendian=no
+fi
+rm -f conftest*
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+if test $ac_cv_c_bigendian = unknown; then
+if test "$cross_compiling" = yes; then
+    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+  cat > conftest.$ac_ext <<EOF
+#line 3669 "configure"
+#include "confdefs.h"
+main () {
+  /* Are we little or big endian?  From Harbison&Steele.  */
+  union
+  {
+    long l;
+    char c[sizeof (long)];
+  } u;
+  u.l = 1;
+  exit (u.c[sizeof (long) - 1] == 1);
+}
+EOF
+if { (eval echo configure:3682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_c_bigendian=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_c_bigendian=yes
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_c_bigendian" 1>&6
+if test $ac_cv_c_bigendian = yes; then
+  cat >> confdefs.h <<\EOF
+#define WORDS_BIGENDIAN 1
+EOF
+
+fi
+
+  if test $ac_cv_c_bigendian = yes; then
+    sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
+  else
+    sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
+  fi
+else
+  sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
+fi
+fi
+
+
+# Check whether --enable-build-warnings or --disable-build-warnings was given.
+if test "${enable_build_warnings+set}" = set; then
+  enableval="$enable_build_warnings"
+  build_warnings="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations"
+case "${enableval}" in
+  yes)	;;
+  no)	build_warnings="-w";;
+  ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+	build_warnings="${build_warnings} ${t}";;
+  *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+	build_warnings="${t} ${build_warnings}";;
+  *)	build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+esac
+if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
+  echo "Setting warning flags = $build_warnings" 6>&1
+fi
+WARN_CFLAGS=""
+WERROR_CFLAGS=""
+if test "x${build_warnings}" != x -a "x$GCC" = xyes
+then
+  # Separate out the -Werror flag as some files just cannot be
+  # compiled with it enabled.
+  for w in ${build_warnings}; do
+    case $w in
+    -Werr*) WERROR_CFLAGS=-Werror ;;
+    *) WARN_CFLAGS="${WARN_CFLAGS} $w"
+    esac
+  done
+fi
+else
+  build_warnings=""
+fi
+
+
+#
+# Add simulated hardware devices
+#
+hw_enabled=no
+case "${target}" in
+  m68hc11-*-*|m6811-*-*)
+	hw_enabled=yes
+	hw_extra_devices="m68hc11 m68hc11sio m68hc11eepr m68hc11tim m68hc11spi nvram"
+	m68hc11_extra_objs="dv-sockser.o"
+	SIM_SUBTARGET="$SIM_SUBTARGET -DTARGET_M68HC11=1"
+	;;
+  *)
+	m68hc11_extra_objs="" 
+	;;
+esac
+
+if test x"$hw_enabled" = x"yes"; then
+  sim_hw_p=yes
+else
+  sim_hw_p=no
+fi
+if test "$hw_devices"; then
+  hardware="core pal glue"
+else
+  hardware="core pal glue $hw_extra_devices"
+fi
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+# Check whether --enable-sim-hardware or --disable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then
+  enableval="$enable_sim_hardware"
+  
+case "${enableval}" in
+  yes)	sim_hw_p=yes;;
+  no)	sim_hw_p=no;;
+  ,*)   sim_hw_p=yes; hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,)   sim_hw_p=yes; hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)	sim_hw_p=yes; hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+if test "$sim_hw_p" != yes; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in x $hardware ; do
+    case " $f " in
+      x) ;;
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+fi
+if test x"$silent" != x"yes" && test "$sim_hw_p" = "yes"; then
+  echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+fi
+else
+  
+if test "$sim_hw_p" != yes; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+fi
+if test x"$silent" != x"yes"; then
+  echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+fi
+fi
+
+
+for ac_hdr in string.h strings.h stdlib.h stdlib.h fcntl.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:3827: 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 3832 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3837: \"$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
+
+
+
+
+
+
+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
+
+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.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.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in 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%@sim_environment@%$sim_environment%g
+s%@sim_alignment@%$sim_alignment%g
+s%@sim_assert@%$sim_assert%g
+s%@sim_bitsize@%$sim_bitsize%g
+s%@sim_endian@%$sim_endian%g
+s%@sim_hostendian@%$sim_hostendian%g
+s%@sim_float@%$sim_float%g
+s%@sim_scache@%$sim_scache%g
+s%@sim_default_model@%$sim_default_model%g
+s%@sim_hw_cflags@%$sim_hw_cflags%g
+s%@sim_hw_objs@%$sim_hw_objs%g
+s%@sim_hw@%$sim_hw%g
+s%@sim_inline@%$sim_inline%g
+s%@sim_packages@%$sim_packages%g
+s%@sim_regparm@%$sim_regparm%g
+s%@sim_reserved_bits@%$sim_reserved_bits%g
+s%@sim_smp@%$sim_smp%g
+s%@sim_stdcall@%$sim_stdcall%g
+s%@sim_xor_endian@%$sim_xor_endian%g
+s%@WARN_CFLAGS@%$WARN_CFLAGS%g
+s%@WERROR_CFLAGS@%$WERROR_CFLAGS%g
+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%@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%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_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%@CC@%$CC%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
+s%@HDEFINES@%$HDEFINES%g
+s%@AR@%$AR%g
+s%@RANLIB@%$RANLIB%g
+s%@SET_MAKE@%$SET_MAKE%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
+s%@MAINT@%$MAINT%g
+s%@sim_bswap@%$sim_bswap%g
+s%@sim_cflags@%$sim_cflags%g
+s%@sim_debug@%$sim_debug%g
+s%@sim_stdio@%$sim_stdio%g
+s%@sim_trace@%$sim_trace%g
+s%@sim_profile@%$sim_profile%g
+s%@EXEEXT@%$EXEEXT%g
+s%@m68hc11_extra_objs@%$m68hc11_extra_objs%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.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in"}
+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="$sim_link_files"
+ac_dests="$sim_link_links"
+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
+case "x$CONFIG_FILES" in
+ xMakefile*)
+   echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
+   rm -f Makesim1.tmp Makesim2.tmp Makefile
+   sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
+   sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
+   sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
+	-e '/^## COMMON_POST_/ r Makesim2.tmp' \
+	<Makefile.sim >Makefile
+   rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
+   ;;
+ esac
+ case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac
+
+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/sim/m68hc11/configure.in b/sim/m68hc11/configure.in
new file mode 100644
index 0000000..78dee58
--- /dev/null
+++ b/sim/m68hc11/configure.in
@@ -0,0 +1,35 @@
+dnl Process this file with autoconf to produce a configure script.
+sinclude(../common/aclocal.m4)
+AC_PREREQ(2.12.1)dnl
+AC_INIT(Makefile.in)
+
+SIM_AC_COMMON
+
+dnl Options available in this module
+SIM_AC_OPTION_INLINE()
+SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
+SIM_AC_OPTION_HOSTENDIAN
+SIM_AC_OPTION_WARNINGS
+
+#
+# Add simulated hardware devices
+#
+hw_enabled=no
+case "${target}" in
+  m68hc11-*-*|m6811-*-*)
+	hw_enabled=yes
+	hw_extra_devices="m68hc11 m68hc11sio m68hc11eepr m68hc11tim m68hc11spi nvram"
+	m68hc11_extra_objs="dv-sockser.o"
+	SIM_SUBTARGET="$SIM_SUBTARGET -DTARGET_M68HC11=1"
+	;;
+  *)
+	m68hc11_extra_objs="" 
+	;;
+esac
+SIM_AC_OPTION_HARDWARE($hw_enabled,$hw_devices,$hw_extra_devices)
+
+AC_CHECK_HEADERS(string.h strings.h stdlib.h stdlib.h fcntl.h)
+
+AC_SUBST(m68hc11_extra_objs)
+
+SIM_AC_OUTPUT
diff --git a/sim/m68hc11/dv-m68hc11.c b/sim/m68hc11/dv-m68hc11.c
new file mode 100644
index 0000000..f300297
--- /dev/null
+++ b/sim/m68hc11/dv-m68hc11.c
@@ -0,0 +1,593 @@
+/*  dv-m68hc11.c -- CPU 68HC11&68HC12 as a device.
+    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+    Written by Stephane Carrez (stcarrez@worldnet.fr)
+    (From a driver model Contributed by Cygnus Solutions.)
+    
+    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 "sim-main.h"
+#include "hw-main.h"
+
+/* DEVICE
+
+        m68hc11cpu - m68hc11 cpu virtual device
+        m68hc12cpu - m68hc12 cpu virtual device
+   
+   DESCRIPTION
+
+        Implements the external m68hc11/68hc12 functionality.  This includes
+        the delivery of of interrupts generated from other devices and the
+        handling of device specific registers.
+
+
+   PROPERTIES
+
+   reg <base> <size>
+
+        Register base (should be 0x1000 0x03f for C11, 0x0000 0x3ff for HC12).
+
+   clock <hz>
+
+        Frequency of the quartz used by the processor.
+
+   mode [single | expanded | bootstrap | test]
+
+        Cpu operating mode (the MODA and MODB external pins).
+
+
+   PORTS
+
+   reset (input)
+
+        Reset the cpu and generates a cpu-reset event (used to reset
+        other devices).
+
+   nmi (input)
+
+        Deliver a non-maskable interrupt to the processor.
+
+
+   cpu-reset (output)
+
+        Event generated after the CPU performs a reset.
+
+
+   BUGS
+
+        When delivering an interrupt, this code assumes that there is only
+        one processor (number 0).
+
+   */
+
+
+
+struct m68hc11cpu {
+  /* Pending interrupts for delivery by event handler.  */
+  int              pending_reset;
+  int              pending_nmi;
+  int              pending_level;
+  struct hw_event  *event;
+  unsigned_word    attach_address;
+  int              attach_size;
+  int              attach_space;
+};
+
+
+
+/* input port ID's */ 
+
+enum {
+  RESET_PORT,
+  NMI_PORT,
+  IRQ_PORT,
+  CPU_RESET_PORT
+};
+
+
+static const struct hw_port_descriptor m68hc11cpu_ports[] = {
+
+  /* Interrupt inputs.  */
+  { "reset",     RESET_PORT,     0, input_port, },
+  { "nmi",       NMI_PORT,       0, input_port, },
+  { "irq",       IRQ_PORT,       0, input_port, },
+
+  /* Events generated for connection to other devices.  */
+  { "cpu-reset", CPU_RESET_PORT, 0, output_port, },
+
+  { NULL, },
+};
+
+static hw_io_read_buffer_method m68hc11cpu_io_read_buffer;
+static hw_io_write_buffer_method m68hc11cpu_io_write_buffer;
+static hw_ioctl_method m68hc11_ioctl;
+
+/* Finish off the partially created hw device.  Attach our local
+   callbacks.  Wire up our port names etc.  */
+
+static hw_port_event_method m68hc11cpu_port_event;
+
+
+static void
+dv_m6811_attach_address_callback (struct hw *me,
+                                  int level,
+                                  int space,
+                                  address_word addr,
+                                  address_word nr_bytes,
+                                  struct hw *client)
+{
+  HW_TRACE ((me, "attach - level=%d, space=%d, addr=0x%lx, sz=%ld, client=%s",
+	     level, space, (unsigned long) addr, (unsigned long) nr_bytes,
+             hw_path (client)));
+
+  if (space != io_map)
+    {
+      sim_core_attach (hw_system (me),
+		       NULL, /*cpu*/
+		       level,
+		       access_read_write_exec,
+		       space, addr,
+		       nr_bytes,
+		       0, /* modulo */
+		       client,
+		       NULL);
+    }
+  else
+    {
+      /*printf("Attach from sub device: %d\n", (long) addr);*/
+      sim_core_attach (hw_system (me),
+		       NULL, /*cpu*/
+		       level,
+		       access_io,
+		       space, addr,
+		       nr_bytes,
+		       0, /* modulo */
+		       client,
+		       NULL);
+    }
+}
+
+static void
+dv_m6811_detach_address_callback (struct hw *me,
+                                  int level,
+                                  int space,
+                                  address_word addr,
+                                  address_word nr_bytes,
+                                  struct hw *client)
+{
+  sim_core_detach (hw_system (me), NULL, /*cpu*/
+                   level, space, addr);
+}
+
+static void
+m68hc11_delete (struct hw* me)
+{
+  struct m68hc11cpu *controller;
+  
+  controller = hw_data (me);
+
+  hw_detach_address (me, M6811_IO_LEVEL,
+		     controller->attach_space,
+		     controller->attach_address,
+		     controller->attach_size, me);
+}
+
+
+static void
+attach_m68hc11_regs (struct hw *me,
+		     struct m68hc11cpu *controller)
+{
+  SIM_DESC sd;
+  sim_cpu *cpu;
+  reg_property_spec reg;
+  const char *cpu_mode;
+  
+  if (hw_find_property (me, "reg") == NULL)
+    hw_abort (me, "Missing \"reg\" property");
+
+  if (!hw_find_reg_array_property (me, "reg", 0, &reg))
+    hw_abort (me, "\"reg\" property must contain one addr/size entry");
+
+  hw_unit_address_to_attach_address (hw_parent (me),
+				     &reg.address,
+				     &controller->attach_space,
+				     &controller->attach_address,
+				     me);
+  hw_unit_size_to_attach_size (hw_parent (me),
+			       &reg.size,
+			       &controller->attach_size, me);
+
+  hw_attach_address (hw_parent (me), M6811_IO_LEVEL,
+		     controller->attach_space,
+                     controller->attach_address,
+                     controller->attach_size,
+		     me);
+  set_hw_delete (me, m68hc11_delete);
+
+  /* Get cpu frequency.  */
+  sd = hw_system (me);
+  cpu = STATE_CPU (sd, 0);
+  if (hw_find_property (me, "clock") != NULL)
+    {
+      cpu->cpu_frequency = hw_find_integer_property (me, "clock");
+    }
+  else
+    {
+      cpu->cpu_frequency = 8*1000*1000;
+    }
+
+  cpu_mode = "expanded";
+  if (hw_find_property (me, "mode") != NULL)
+    cpu_mode = hw_find_string_property (me, "mode");
+
+  if (strcmp (cpu_mode, "test") == 0)
+    cpu->cpu_mode = M6811_MDA | M6811_SMOD;
+  else if (strcmp (cpu_mode, "bootstrap") == 0)
+    cpu->cpu_mode = M6811_SMOD;
+  else if (strcmp (cpu_mode, "single") == 0)
+    cpu->cpu_mode = 0;
+  else
+    cpu->cpu_mode = M6811_MDA;
+}
+
+static void
+m68hc11cpu_finish (struct hw *me)
+{
+  struct m68hc11cpu *controller;
+
+  controller = HW_ZALLOC (me, struct m68hc11cpu);
+  set_hw_data (me, controller);
+  set_hw_io_read_buffer (me, m68hc11cpu_io_read_buffer);
+  set_hw_io_write_buffer (me, m68hc11cpu_io_write_buffer);
+  set_hw_ports (me, m68hc11cpu_ports);
+  set_hw_port_event (me, m68hc11cpu_port_event);
+  set_hw_attach_address (me, dv_m6811_attach_address_callback);
+  set_hw_detach_address (me, dv_m6811_detach_address_callback);
+#ifdef set_hw_ioctl
+  set_hw_ioctl (me, m68hc11_ioctl);
+#else
+  me->to_ioctl = m68hc11_ioctl;
+#endif
+
+  /* Initialize the pending interrupt flags.  */
+  controller->pending_level = 0;
+  controller->pending_reset = 0;
+  controller->pending_nmi = 0;
+  controller->event = NULL;
+
+  attach_m68hc11_regs (me, controller);
+}
+
+/* An event arrives on an interrupt port.  */
+
+static void
+deliver_m68hc11cpu_interrupt (struct hw *me, void *data)
+{
+}
+
+
+static void
+m68hc11cpu_port_event (struct hw *me,
+                       int my_port,
+                       struct hw *source,
+                       int source_port,
+                       int level)
+{
+  struct m68hc11cpu *controller = hw_data (me);
+  SIM_DESC sd;
+  sim_cpu* cpu;
+  
+  sd  = hw_system (me);
+  cpu = STATE_CPU (sd, 0);
+  switch (my_port)
+    {
+    case RESET_PORT:
+      HW_TRACE ((me, "port-in reset"));
+
+      /* The reset is made in 3 steps:
+         - First, cleanup the current sim_cpu struct.
+         - Reset the devices.
+         - Restart the cpu for the reset (get the CPU mode from the
+           CONFIG register that gets initialized by EEPROM device).  */
+      cpu_reset (cpu);
+      hw_port_event (me, CPU_RESET_PORT, 1);
+      cpu_restart (cpu);
+      break;
+      
+    case NMI_PORT:
+      controller->pending_nmi = 1;
+      HW_TRACE ((me, "port-in nmi"));
+      break;
+      
+    case IRQ_PORT:
+      /* level == 0 means that the interrupt was cleared.  */
+      if(level == 0)
+	controller->pending_level = -1; /* signal end of interrupt */
+      else
+	controller->pending_level = level;
+      HW_TRACE ((me, "port-in level=%d", level));
+      break;
+      
+    default:
+      hw_abort (me, "bad switch");
+      break;
+    }
+
+  /* Schedule an event to be delivered immediately after current
+     instruction.  */
+  if(controller->event != NULL)
+    hw_event_queue_deschedule(me, controller->event);
+  controller->event =
+    hw_event_queue_schedule (me, 0, deliver_m68hc11cpu_interrupt, NULL);
+}
+
+
+io_reg_desc config_desc[] = {
+  { M6811_NOSEC, "NOSEC ", "Security Mode Disable" },
+  { M6811_NOCOP, "NOCOP ", "COP System Disable" },
+  { M6811_ROMON, "ROMON ", "Enable On-chip Rom" },
+  { M6811_EEON,  "EEON  ", "Enable On-chip EEprom" },
+  { 0,  0, 0 }
+};
+
+io_reg_desc hprio_desc[] = {
+  { M6811_RBOOT, "RBOOT ", "Read Bootstrap ROM" },
+  { M6811_SMOD,  "SMOD  ", "Special Mode" },
+  { M6811_MDA,   "MDA   ", "Mode Select A" },
+  { M6811_IRV,   "IRV   ", "Internal Read Visibility" },
+  { 0,  0, 0 }
+};
+
+io_reg_desc option_desc[] = {
+  { M6811_ADPU,  "ADPU  ", "A/D Powerup" },
+  { M6811_CSEL,  "CSEL  ", "A/D/EE Charge pump clock source select" },
+  { M6811_IRQE,  "IRQE  ", "IRQ Edge/Level sensitive" },
+  { M6811_DLY,   "DLY   ", "Stop exit turn on delay" },
+  { M6811_CME,   "CME   ", "Clock Monitor Enable" },
+  { M6811_CR1,   "CR1   ", "COP timer rate select (CR1)" },
+  { M6811_CR0,   "CR0   ", "COP timer rate select (CR0)" },
+  { 0,  0, 0 }
+};
+
+static void
+m68hc11_info (struct hw *me)
+{
+  SIM_DESC sd;
+  uint16 base = 0;
+  sim_cpu *cpu;
+  struct m68hc11sio *controller;
+  uint8 val;
+  
+  sd = hw_system (me);
+  cpu = STATE_CPU (sd, 0);
+  controller = hw_data (me);
+
+  base = cpu_get_io_base (cpu);
+  sim_io_printf (sd, "M68HC11:\n");
+
+  val = cpu->ios[M6811_HPRIO];
+  print_io_byte (sd, "HPRIO ", hprio_desc, val, base + M6811_HPRIO);
+  sim_io_printf (sd, "\n");
+
+  val = cpu->ios[M6811_CONFIG];
+  print_io_byte (sd, "CONFIG", config_desc, val, base + M6811_CONFIG);
+  sim_io_printf (sd, "\n");
+
+  val = cpu->ios[M6811_OPTION];
+  print_io_byte (sd, "OPTION", option_desc, val, base + M6811_OPTION);
+  sim_io_printf (sd, "\n");
+
+  val = cpu->ios[M6811_INIT];
+  print_io_byte (sd, "INIT  ", 0, val, base + M6811_INIT);
+  sim_io_printf (sd, "Ram = 0x%04x IO = 0x%04x\n",
+		 (((uint16) (val & 0xF0)) << 8),
+		 (((uint16) (val & 0x0F)) << 12));
+
+
+  cpu_info (sd, cpu);
+  interrupts_info (sd, &cpu->cpu_interrupts);
+}
+
+static int
+m68hc11_ioctl (struct hw *me,
+	       hw_ioctl_request request,
+	       va_list ap)
+{
+  m68hc11_info (me);
+  return 0;
+}
+
+/* generic read/write */
+
+static unsigned
+m68hc11cpu_io_read_buffer (struct hw *me,
+			   void *dest,
+			   int space,
+			   unsigned_word base,
+			   unsigned nr_bytes)
+{
+  SIM_DESC sd;
+  struct m68hc11cpu *controller = hw_data (me);
+  sim_cpu *cpu;
+  unsigned byte = 0;
+  int result;
+  
+  HW_TRACE ((me, "read 0x%08lx %d", (long) base, (int) nr_bytes));
+
+  sd  = hw_system (me); 
+  cpu = STATE_CPU (sd, 0);
+
+  /* Handle reads for the sub-devices.  */
+  base -= controller->attach_address;
+  result = sim_core_read_buffer (sd, cpu,
+				 io_map, dest, base, nr_bytes);
+  if (result > 0)
+    return result;
+  
+  while (nr_bytes)
+    {
+      if (base >= controller->attach_size)
+	break;
+
+      memcpy (dest, &cpu->ios[base], 1);
+      dest++;
+      base++;
+      byte++;
+      nr_bytes--;
+    }
+  return byte;
+}     
+
+
+static void
+m68hc11cpu_io_write (struct hw *me, sim_cpu *cpu,
+                     unsigned_word addr, uint8 val)
+{
+  switch (addr)
+    {
+    case M6811_PORTA:
+      break;
+
+    case M6811_PIOC:
+      break;
+
+    case M6811_PORTC:
+      break;
+
+    case M6811_PORTB:
+      break;
+
+    case M6811_PORTCL:
+      break;
+
+    case M6811_DDRC:
+      break;
+
+    case M6811_PORTD:
+      break;
+
+    case M6811_DDRD:
+      break;
+
+    case M6811_TMSK2:
+      
+      break;
+      
+      /* Change the RAM and I/O mapping.  */
+    case M6811_INIT:
+      {
+	uint8 old_bank = cpu->ios[M6811_INIT];
+	
+	cpu->ios[M6811_INIT] = val;
+
+	/* Update IO mapping.  Detach from the old address
+	   and attach to the new one.  */
+	if ((old_bank & 0xF0) != (val & 0xF0))
+	  {
+            struct m68hc11cpu *controller = hw_data (me);
+
+            hw_detach_address (hw_parent (me), M6811_IO_LEVEL,
+                               controller->attach_space,
+                               controller->attach_address,
+                               controller->attach_size,
+                               me);
+            controller->attach_address = (val & 0x0F0) << 12;
+            hw_attach_address (hw_parent (me), M6811_IO_LEVEL,
+                               controller->attach_space,
+                               controller->attach_address,
+                               controller->attach_size,
+                               me);
+	  }
+	if ((old_bank & 0x0F) != (val & 0x0F))
+	  {
+	    ;
+	  }
+	return;
+      }
+
+    /* Writing the config is similar to programing the eeprom.
+       The config register value is the last byte of the EEPROM.
+       This last byte is not mapped in memory (that's why we have
+       to add '1' to 'end_addr').  */
+    case M6811_CONFIG:
+      {
+        return;
+      }
+      
+
+      /* COP reset.  */
+    case M6811_COPRST:
+      if (val == 0xAA && cpu->ios[addr] == 0x55)
+	{
+          val = 0;
+          /* COP reset here.  */
+	}
+      break;
+      
+    default:
+      break;
+
+    }
+  cpu->ios[addr] = val;
+}
+
+static unsigned
+m68hc11cpu_io_write_buffer (struct hw *me,
+			    const void *source,
+			    int space,
+			    unsigned_word base,
+			    unsigned nr_bytes)
+{
+  SIM_DESC sd;
+  struct m68hc11cpu *controller = hw_data (me);
+  unsigned byte;
+  sim_cpu *cpu;
+  int result;
+
+  HW_TRACE ((me, "write 0x%08lx %d", (long) base, (int) nr_bytes));
+
+  sd = hw_system (me); 
+  cpu = STATE_CPU (sd, 0);  
+  base -= controller->attach_address;
+  result = sim_core_write_buffer (sd, cpu,
+				  io_map, source, base, nr_bytes);
+  if (result > 0)
+    return result;
+
+  byte = 0;
+  while (nr_bytes)
+    {
+      uint8 val;
+      if (base >= controller->attach_size)
+	break;
+
+      val = *((uint8*) source);
+      m68hc11cpu_io_write (me, cpu, base, val);
+      source++;
+      base++;
+      byte++;
+      nr_bytes--;
+    }
+  return byte;
+}
+
+const struct hw_descriptor dv_m68hc11_descriptor[] = {
+  { "m68hc11", m68hc11cpu_finish },
+  { "m68hc12", m68hc11cpu_finish },
+  { NULL },
+};
+
diff --git a/sim/m68hc11/dv-m68hc11eepr.c b/sim/m68hc11/dv-m68hc11eepr.c
new file mode 100644
index 0000000..a48456f
--- /dev/null
+++ b/sim/m68hc11/dv-m68hc11eepr.c
@@ -0,0 +1,628 @@
+/*  dv-m68hc11eepr.c -- Simulation of the 68HC11 Internal EEPROM.
+    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+    Written by Stephane Carrez (stcarrez@worldnet.fr)
+    (From a driver model Contributed by Cygnus Solutions.)
+    
+    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 "sim-main.h"
+#include "hw-main.h"
+#include "sim-assert.h"
+#include "sim-events.h"
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+
+
+/* DEVICE
+
+        m68hc11eepr - m68hc11 EEPROM
+
+   
+   DESCRIPTION
+
+        Implements the 68HC11 eeprom device described in the m68hc11
+        user guide (Chapter 4 in the pink book).
+
+
+   PROPERTIES
+
+   reg <base> <length>
+
+        Base of eeprom and its length.
+
+   file <path>
+
+        Path of the EEPROM file.  The default is 'm6811.eeprom'.
+
+
+   PORTS
+
+        None
+
+   */
+
+
+
+/* static functions */
+
+
+/* port ID's */
+
+enum
+{
+  RESET_PORT
+};
+
+
+static const struct hw_port_descriptor m68hc11eepr_ports[] = 
+{
+  { "reset", RESET_PORT, 0, input_port, },
+  { NULL, },
+};
+
+
+
+/* The timer/counter register internal state.  Note that we store
+   state using the control register images, in host endian order.  */
+
+struct m68hc11eepr 
+{
+  address_word  base_address; /* control register base */
+  int           attach_space;
+  unsigned      size;
+  int           mapped;
+  
+  /* Current state of the eeprom programing:
+     - eeprom_wmode indicates whether the EEPROM address and byte have
+       been latched.
+     - eeprom_waddr indicates the EEPROM address that was latched
+       and eeprom_wbyte is the byte that was latched.
+     - eeprom_wcycle indicates the CPU absolute cycle type when
+       the high voltage was applied (successfully) on the EEPROM.
+   
+     These data members are setup only when we detect good EEPROM programing
+     conditions (see Motorola EEPROM Programming and PPROG register usage).
+     When the high voltage is switched off, we look at the CPU absolute
+     cycle time to see if the EEPROM command must succeeds or not.
+     The EEPROM content is updated and saved only at that time.
+     (EEPROM command is: byte zero bits program, byte erase, row erase
+     and bulk erase).
+    
+     The CONFIG register is programmed in the same way.  It is physically
+     located at the end of the EEPROM (eeprom size + 1).  It is not mapped
+     in memory but it's saved in the EEPROM file.  */
+  unsigned long		eeprom_wcycle;
+  uint16		eeprom_waddr;
+  uint8			eeprom_wbyte;
+  uint8			eeprom_wmode;
+
+  uint8*		eeprom;
+  
+  /* Minimum time in CPU cycles for programming the EEPROM.  */
+  unsigned long         eeprom_min_cycles;
+
+  char* file_name;
+};
+
+
+
+/* Finish off the partially created hw device.  Attach our local
+   callbacks.  Wire up our port names etc.  */
+
+static hw_io_read_buffer_method m68hc11eepr_io_read_buffer;
+static hw_io_write_buffer_method m68hc11eepr_io_write_buffer;
+static hw_ioctl_method m68hc11eepr_ioctl;
+
+/* Read or write the memory bank content from/to a file.
+   Returns 0 if the operation succeeded and -1 if it failed.  */
+static int
+m6811eepr_memory_rw (struct m68hc11eepr *controller, int mode)
+{
+  const char *name = controller->file_name;
+  int fd;
+  size_t size;
+  
+  size = controller->size;
+  fd = open (name, mode, 0644);
+  if (fd < 0)
+    {
+      if (mode == O_RDONLY)
+        {
+          memset (controller->eeprom, 0xFF, size);
+          /* Default value for CONFIG register (0xFF should be ok):
+             controller->eeprom[size - 1] = M6811_NOSEC | M6811_NOCOP
+                                            | M6811_ROMON | M6811_EEON;  */
+          return 0;
+        }
+      return -1;
+    }
+
+  if (mode == O_RDONLY)
+    {
+      if (read (fd, controller->eeprom, size) != size)
+	{
+	  close (fd);
+	  return -1;
+	}
+    }
+  else
+    {
+      if (write (fd, controller->eeprom, size) != size)
+	{
+	  close (fd);
+	  return -1;
+	}
+    }
+  close (fd);
+
+  return 0;
+}
+
+
+
+
+static void
+attach_m68hc11eepr_regs (struct hw *me,
+                         struct m68hc11eepr *controller)
+{
+  unsigned_word attach_address;
+  int attach_space;
+  unsigned attach_size;
+  reg_property_spec reg;
+
+  if (hw_find_property (me, "reg") == NULL)
+    hw_abort (me, "Missing \"reg\" property");
+
+  if (!hw_find_reg_array_property (me, "reg", 0, &reg))
+    hw_abort (me, "\"reg\" property must contain one addr/size entry");
+
+  hw_unit_address_to_attach_address (hw_parent (me),
+				     &reg.address,
+				     &attach_space,
+				     &attach_address,
+				     me);
+  hw_unit_size_to_attach_size (hw_parent (me),
+			       &reg.size,
+			       &attach_size, me);
+
+  /* Attach the two IO registers that control the EEPROM.
+     The EEPROM is only attached at reset time because it may
+     be enabled/disabled by the EEON bit in the CONFIG register.  */
+  hw_attach_address (hw_parent (me), M6811_IO_LEVEL,
+                     io_map, M6811_PPROG, 1, me);
+  hw_attach_address (hw_parent (me), M6811_IO_LEVEL,
+                     io_map, M6811_CONFIG, 1, me);
+
+  if (hw_find_property (me, "file") == NULL)
+    controller->file_name = "m6811.eeprom";
+  else
+    controller->file_name = hw_find_string_property (me, "file");
+  
+  controller->attach_space = attach_space;
+  controller->base_address = attach_address;
+  controller->eeprom = (char*) hw_malloc (me, attach_size + 1);
+  controller->eeprom_min_cycles = 10000;
+  controller->size = attach_size + 1;
+  controller->mapped = 0;
+  
+  m6811eepr_memory_rw (controller, O_RDONLY);
+}
+
+
+/* An event arrives on an interrupt port.  */
+
+static void
+m68hc11eepr_port_event (struct hw *me,
+                        int my_port,
+                        struct hw *source,
+                        int source_port,
+                        int level)
+{
+  SIM_DESC sd;
+  struct m68hc11eepr *controller;
+  sim_cpu *cpu;
+  
+  controller = hw_data (me);
+  sd         = hw_system (me);
+  cpu        = STATE_CPU (sd, 0);
+  switch (my_port)
+    {
+    case RESET_PORT:
+      {
+	HW_TRACE ((me, "EEPROM reset"));
+
+        /* Re-read the EEPROM from the file.  This gives the chance
+           to users to erase this file before doing a reset and have
+           a fresh EEPROM taken into account.  */
+        m6811eepr_memory_rw (controller, O_RDONLY);
+
+        /* Reset the state of EEPROM programmer.  The CONFIG register
+           is also initialized from the EEPROM/file content.  */
+        cpu->ios[M6811_PPROG]    = 0;
+        if (cpu->cpu_use_local_config)
+          cpu->ios[M6811_CONFIG] = cpu->cpu_config;
+        else
+          cpu->ios[M6811_CONFIG]   = controller->eeprom[controller->size-1];
+        controller->eeprom_wmode = 0;
+        controller->eeprom_waddr = 0;
+        controller->eeprom_wbyte = 0;
+
+        /* Attach or detach to the bus depending on the EEPROM enable bit.
+           The EEPROM CONFIG register is still enabled and can be programmed
+           for a next configuration (taken into account only after a reset,
+           see Motorola spec).  */
+        if (cpu->ios[M6811_CONFIG] & M6811_EEON)
+          {
+            if (controller->mapped)
+              hw_attach_address (hw_parent (me), M6811_EEPROM_LEVEL,
+                                 controller->attach_space,
+                                 controller->base_address,
+                                 controller->size - 1,
+                                 me);
+            controller->mapped = 0;
+          }
+        else
+          {
+            if (!controller->mapped)
+              hw_detach_address (hw_parent (me), M6811_EEPROM_LEVEL,
+                                 controller->attach_space,
+                                 controller->base_address,
+                                 controller->size - 1,
+                                 me);
+            controller->mapped = 1;
+          }
+        break;
+      }
+
+    default:
+      hw_abort (me, "Event on unknown port %d", my_port);
+      break;
+    }
+}
+
+
+static void
+m68hc11eepr_finish (struct hw *me)
+{
+  struct m68hc11eepr *controller;
+
+  controller = HW_ZALLOC (me, struct m68hc11eepr);
+  set_hw_data (me, controller);
+  set_hw_io_read_buffer (me, m68hc11eepr_io_read_buffer);
+  set_hw_io_write_buffer (me, m68hc11eepr_io_write_buffer);
+  set_hw_ports (me, m68hc11eepr_ports);
+  set_hw_port_event (me, m68hc11eepr_port_event);
+#ifdef set_hw_ioctl
+  set_hw_ioctl (me, m68hc11eepr_ioctl);
+#else
+  me->to_ioctl = m68hc11eepr_ioctl;
+#endif
+
+  attach_m68hc11eepr_regs (me, controller);
+}
+ 
+
+
+static io_reg_desc pprog_desc[] = {
+  { M6811_BYTE,  "BYTE  ", "Byte Program Mode" },
+  { M6811_ROW,   "ROW   ", "Row Program Mode" },
+  { M6811_ERASE, "ERASE ", "Erase Mode" },
+  { M6811_EELAT, "EELAT ", "EEProm Latch Control" },
+  { M6811_EEPGM, "EEPGM ", "EEProm Programming Voltable Enable" },
+  { 0,  0, 0 }
+};
+extern io_reg_desc config_desc[];
+
+
+/* Describe the state of the EEPROM device.  */
+static void
+m68hc11eepr_info (struct hw *me)
+{
+  SIM_DESC sd;
+  uint16 base = 0;
+  sim_cpu *cpu;
+  struct m68hc11eepr *controller;
+  uint8 val;
+  
+  sd         = hw_system (me);
+  cpu        = STATE_CPU (sd, 0);
+  controller = hw_data (me);
+  base       = cpu_get_io_base (cpu);
+  
+  sim_io_printf (sd, "M68HC11 EEprom:\n");
+
+  val = cpu->ios[M6811_PPROG];
+  print_io_byte (sd, "PPROG  ", pprog_desc, val, base + M6811_PPROG);
+  sim_io_printf (sd, "\n");
+
+  val = cpu->ios[M6811_CONFIG];
+  print_io_byte (sd, "CONFIG ", config_desc, val, base + M6811_CONFIG);
+  sim_io_printf (sd, "\n");
+
+  val = controller->eeprom[controller->size - 1];
+  print_io_byte (sd, "(*NEXT*) ", config_desc, val, base + M6811_CONFIG);
+  sim_io_printf (sd, "\n");
+  
+  /* Describe internal state of EEPROM.  */
+  if (controller->eeprom_wmode)
+    {
+      if (controller->eeprom_waddr == controller->size - 1)
+        sim_io_printf (sd, "  Programming CONFIG register ");
+      else
+        sim_io_printf (sd, "  Programming: 0x%04x ",
+                       controller->eeprom_waddr);
+
+      sim_io_printf (sd, "with 0x%02x\n",
+		     controller->eeprom_wbyte);
+    }
+
+  sim_io_printf (sd, "  EEProm file: %s\n",
+                 controller->file_name);
+}
+
+static int
+m68hc11eepr_ioctl (struct hw *me,
+		   hw_ioctl_request request,
+		   va_list ap)
+{
+  m68hc11eepr_info (me);
+  return 0;
+}
+
+/* generic read/write */
+
+static unsigned
+m68hc11eepr_io_read_buffer (struct hw *me,
+			    void *dest,
+			    int space,
+			    unsigned_word base,
+			    unsigned nr_bytes)
+{
+  SIM_DESC sd;
+  struct m68hc11eepr *controller;
+  sim_cpu *cpu;
+  
+  HW_TRACE ((me, "read 0x%08lx %d", (long) base, (int) nr_bytes));
+
+  sd         = hw_system (me);
+  controller = hw_data (me);
+  cpu        = STATE_CPU (sd, 0);
+
+  if (space == io_map)
+    {
+      unsigned cnt = 0;
+      
+      while (nr_bytes != 0)
+        {
+          switch (base)
+            {
+            case M6811_PPROG:
+            case M6811_CONFIG:
+              *((uint8*) dest) = cpu->ios[base];
+              break;
+
+            default:
+              hw_abort (me, "reading wrong register 0x%04x", base);
+            }
+          dest = (uint8*) (dest) + 1;
+          base++;
+          nr_bytes--;
+          cnt++;
+        }
+      return cnt;
+    }
+
+  /* In theory, we can't read the EEPROM when it's being programmed.  */
+  if ((cpu->ios[M6811_PPROG] & M6811_EELAT) != 0
+      && cpu_is_running (cpu))
+    {
+      sim_memory_error (cpu, SIM_SIGBUS, base,
+			"EEprom not configured for reading");
+    }
+
+  base = base - controller->base_address;
+  memcpy (dest, &controller->eeprom[base], nr_bytes);
+  return nr_bytes;
+}
+
+
+static unsigned
+m68hc11eepr_io_write_buffer (struct hw *me,
+			     const void *source,
+			     int space,
+			     unsigned_word base,
+			     unsigned nr_bytes)
+{
+  SIM_DESC sd;
+  struct m68hc11eepr *controller;
+  sim_cpu *cpu;
+  uint8 val;
+
+  HW_TRACE ((me, "write 0x%08lx %d", (long) base, (int) nr_bytes));
+
+  sd         = hw_system (me);
+  controller = hw_data (me);
+  cpu        = STATE_CPU (sd, 0);
+
+  /* Programming several bytes at a time is not possible.  */
+  if (space != io_map && nr_bytes != 1)
+    {
+      sim_memory_error (cpu, SIM_SIGBUS, base,
+			"EEprom write error (only 1 byte can be programmed)");
+      return 0;
+    }
+  
+  if (nr_bytes != 1)
+    hw_abort (me, "Cannot write more than 1 byte to EEPROM device at a time");
+
+  val = *((const uint8*) source);
+
+  /* Write to the EEPROM control register.  */
+  if (space == io_map && base == M6811_PPROG)
+    {
+      uint8 wrong_bits;
+      uint16 addr;
+      
+      addr = base + cpu_get_io_base (cpu);
+
+      /* Setting EELAT and EEPGM at the same time is an error.
+         Clearing them both is ok.  */
+      wrong_bits = (cpu->ios[M6811_PPROG] ^ val) & val;
+      wrong_bits &= (M6811_EELAT | M6811_EEPGM);
+
+      if (wrong_bits == (M6811_EEPGM|M6811_EELAT))
+	{
+	  sim_memory_error (cpu, SIM_SIGBUS, addr,
+			    "Wrong eeprom programing value");
+	  return 0;
+	}
+
+      if ((val & M6811_EELAT) == 0)
+	{
+	  val = 0;
+	}
+      if ((val & M6811_EEPGM) && !(cpu->ios[M6811_PPROG] & M6811_EELAT))
+	{
+	  sim_memory_error (cpu, SIM_SIGBUS, addr,
+			    "EEProm high voltage applied after EELAT");
+	}
+      if ((val & M6811_EEPGM) && controller->eeprom_wmode == 0)
+	{
+	  sim_memory_error (cpu, SIM_SIGSEGV, addr,
+			    "EEProm high voltage applied without address");
+	}
+      if (val & M6811_EEPGM)
+	{
+	  controller->eeprom_wcycle = cpu_current_cycle (cpu);
+	}
+      else if (cpu->ios[M6811_PPROG] & M6811_PPROG)
+	{
+	  int i;
+	  unsigned long t = cpu_current_cycle (cpu);
+
+	  t -= controller->eeprom_wcycle;
+	  if (t < controller->eeprom_min_cycles)
+	    {
+	      sim_memory_error (cpu, SIM_SIGILL, addr,
+				"EEprom programmed only for %lu cycles",
+				t);
+	    }
+
+	  /* Program the byte by clearing some bits.  */
+	  if (!(cpu->ios[M6811_PPROG] & M6811_ERASE))
+	    {
+	      controller->eeprom[controller->eeprom_waddr]
+		&= controller->eeprom_wbyte;
+	    }
+
+	  /* Erase a byte, row or the complete eeprom.  Erased value is 0xFF.
+             Ignore row or complete eeprom erase when we are programming the
+             CONFIG register (last EEPROM byte).  */
+	  else if ((cpu->ios[M6811_PPROG] & M6811_BYTE)
+                   || controller->eeprom_waddr == controller->size - 1)
+	    {
+	      controller->eeprom[controller->eeprom_waddr] = 0xff;
+	    }
+	  else if (cpu->ios[M6811_BYTE] & M6811_ROW)
+	    {
+              size_t max_size;
+
+              /* Size of EEPROM (-1 because the last byte is the
+                 CONFIG register.  */
+              max_size = controller->size;
+	      controller->eeprom_waddr &= 0xFFF0;
+	      for (i = 0; i < 16
+                     && controller->eeprom_waddr < max_size; i++)
+		{
+		  controller->eeprom[controller->eeprom_waddr] = 0xff;
+		  controller->eeprom_waddr ++;
+		}
+	    }
+	  else
+	    {
+              size_t max_size;
+
+              max_size = controller->size;
+	      for (i = 0; i < max_size; i++)
+		{
+		  controller->eeprom[i] = 0xff;
+		}
+	    }
+
+	  /* Save the eeprom in a file.  We have to save after each
+	     change because the simulator can be stopped or crash...  */
+	  if (m6811eepr_memory_rw (controller, O_WRONLY | O_CREAT) != 0)
+	    {
+	      sim_memory_error (cpu, SIM_SIGABRT, addr,
+				"EEPROM programing failed: errno=%d", errno);
+	    }
+	  controller->eeprom_wmode = 0;
+	}
+      cpu->ios[M6811_PPROG] = val;
+      return 1;
+    }
+
+  /* The CONFIG IO register is mapped at end of EEPROM.
+     It's not visible.  */
+  if (space == io_map && base == M6811_CONFIG)
+    {
+      base = controller->size - 1;
+    }
+  else
+    {
+      base = base - controller->base_address;
+    }
+
+  /* Writing the memory is allowed for the Debugger or simulator
+     (cpu not running).  */
+  if (cpu_is_running (cpu))
+    {
+      if ((cpu->ios[M6811_PPROG] & M6811_EELAT) == 0)
+	{
+	  sim_memory_error (cpu, SIM_SIGSEGV, base,
+			    "EEprom not configured for writing");
+	  return 0;
+	}
+      if (controller->eeprom_wmode != 0)
+	{
+	  sim_memory_error (cpu, SIM_SIGSEGV, base,
+			    "EEprom write error");
+	  return 0;
+	}
+      controller->eeprom_wmode = 1;
+      controller->eeprom_waddr = base;
+      controller->eeprom_wbyte = val;
+    }
+  else
+    {
+      controller->eeprom[base] = val;
+      m6811eepr_memory_rw (controller, O_WRONLY);
+    }
+  
+  return 1;
+}
+
+const struct hw_descriptor dv_m68hc11eepr_descriptor[] = {
+  { "m68hc11eepr", m68hc11eepr_finish },
+  { "m68hc12eepr", m68hc11eepr_finish },
+  { NULL },
+};
+
diff --git a/sim/m68hc11/dv-m68hc11sio.c b/sim/m68hc11/dv-m68hc11sio.c
new file mode 100644
index 0000000..1f022c4
--- /dev/null
+++ b/sim/m68hc11/dv-m68hc11sio.c
@@ -0,0 +1,664 @@
+/*  dv-m68hc11sio.c -- Simulation of the 68HC11 serial device.
+    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+    Written by Stephane Carrez (stcarrez@worldnet.fr)
+    (From a driver model Contributed by Cygnus Solutions.)
+
+    This file is part of the program GDB, the GNU debugger.
+    
+    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 "sim-main.h"
+#include "hw-main.h"
+#include "dv-sockser.h"
+#include "sim-assert.h"
+
+
+/* DEVICE
+
+        m68hc11sio - m68hc11 serial I/O
+
+   
+   DESCRIPTION
+
+        Implements the m68hc11 serial I/O controller described in the m68hc11
+        user guide. The serial I/O controller is directly connected to the CPU
+        interrupt. The simulator implements:
+
+            - baud rate emulation
+            - 8-bits transfers
+    
+   PROPERTIES
+
+   backend {tcp | stdio}
+
+        Use dv-sockser TCP-port backend or stdio for backend.  Default: stdio.
+
+   
+   PORTS
+
+   reset (input)
+
+        Reset port. This port is only used to simulate a reset of the serial
+        I/O controller. It should be connected to the RESET output of the cpu.
+
+   */
+
+
+
+/* port ID's */
+
+enum
+{
+  RESET_PORT
+};
+
+
+static const struct hw_port_descriptor m68hc11sio_ports[] = 
+{
+  { "reset", RESET_PORT, 0, input_port, },
+  { NULL, },
+};
+
+
+/* Serial Controller information.  */
+struct m68hc11sio 
+{
+  enum {sio_tcp, sio_stdio} backend; /* backend */
+
+  /* Number of cpu cycles to send a bit on the wire.  */
+  unsigned long baud_cycle;
+
+  /* Length in bits of characters sent, this includes the
+     start/stop and parity bits.  Together with baud_cycle, this
+     is used to find the number of cpu cycles to send/receive a data.  */
+  unsigned int  data_length;
+
+  /* Information about next character to be transmited.  */
+  unsigned char tx_has_char;
+  unsigned char tx_char;
+
+  unsigned char rx_char;
+  unsigned char rx_clear_scsr;
+  
+  /* Periodic I/O polling.  */
+  struct hw_event* tx_poll_event;
+  struct hw_event* rx_poll_event;
+};
+
+
+
+/* Finish off the partially created hw device.  Attach our local
+   callbacks.  Wire up our port names etc.  */
+
+static hw_io_read_buffer_method m68hc11sio_io_read_buffer;
+static hw_io_write_buffer_method m68hc11sio_io_write_buffer;
+static hw_port_event_method m68hc11sio_port_event;
+static hw_ioctl_method m68hc11sio_ioctl;
+
+#define M6811_SCI_FIRST_REG (M6811_BAUD)
+#define M6811_SCI_LAST_REG  (M6811_SCDR)
+
+
+static void
+attach_m68hc11sio_regs (struct hw *me,
+                        struct m68hc11sio *controller)
+{
+  hw_attach_address (hw_parent (me), M6811_IO_LEVEL, io_map,
+                     M6811_SCI_FIRST_REG,
+                     M6811_SCI_LAST_REG - M6811_SCI_FIRST_REG + 1,
+		     me);
+
+  if (hw_find_property(me, "backend") != NULL)
+    {
+      const char *value = hw_find_string_property(me, "backend");
+      if(! strcmp(value, "tcp"))
+	controller->backend = sio_tcp;
+      else if(! strcmp(value, "stdio"))
+	controller->backend = sio_stdio;
+      else
+	hw_abort (me, "illegal value for backend parameter `%s':"
+                  "use tcp or stdio", value);
+    }
+}
+
+
+static void
+m68hc11sio_finish (struct hw *me)
+{
+  struct m68hc11sio *controller;
+
+  controller = HW_ZALLOC (me, struct m68hc11sio);
+  set_hw_data (me, controller);
+  set_hw_io_read_buffer (me, m68hc11sio_io_read_buffer);
+  set_hw_io_write_buffer (me, m68hc11sio_io_write_buffer);
+  set_hw_ports (me, m68hc11sio_ports);
+  set_hw_port_event (me, m68hc11sio_port_event);
+#ifdef set_hw_ioctl
+  set_hw_ioctl (me, m68hc11sio_ioctl);
+#else
+  me->to_ioctl = m68hc11sio_ioctl;
+#endif
+
+  /* Preset defaults.  */
+  controller->backend = sio_stdio;
+
+  /* Attach ourself to our parent bus.  */
+  attach_m68hc11sio_regs (me, controller);
+
+  /* Initialize to reset state.  */
+  controller->tx_poll_event = NULL;
+  controller->rx_poll_event = NULL;
+  controller->tx_char       = 0;
+  controller->tx_has_char   = 0;
+  controller->rx_clear_scsr = 0;
+  controller->rx_char       = 0;
+}
+
+
+
+/* An event arrives on an interrupt port.  */
+
+static void
+m68hc11sio_port_event (struct hw *me,
+                       int my_port,
+                       struct hw *source,
+                       int source_port,
+                       int level)
+{
+  SIM_DESC sd;
+  struct m68hc11sio *controller;
+  sim_cpu *cpu;
+  unsigned8 val;
+  
+  controller = hw_data (me);
+  sd         = hw_system (me);
+  cpu        = STATE_CPU (sd, 0);  
+  switch (my_port)
+    {
+    case RESET_PORT:
+      {
+	HW_TRACE ((me, "SCI reset"));
+
+        /* Reset the state of SCI registers.  */
+        val = 0;
+        m68hc11sio_io_write_buffer (me, &val, io_map,
+                                    (unsigned_word) M6811_BAUD, 1);
+        m68hc11sio_io_write_buffer (me, &val, io_map,
+                                    (unsigned_word) M6811_SCCR1, 1);
+        m68hc11sio_io_write_buffer (me, &val, io_map,
+                                    (unsigned_word) M6811_SCCR2, 1);
+        
+        cpu->ios[M6811_SCSR]    = M6811_TC | M6811_TDRE;
+        controller->rx_char     = 0;
+        controller->tx_char     = 0;
+        controller->tx_has_char = 0;
+        controller->rx_clear_scsr = 0;
+        if (controller->rx_poll_event)
+          {
+            hw_event_queue_deschedule (me, controller->rx_poll_event);
+            controller->rx_poll_event = 0;
+          }
+        if (controller->tx_poll_event)
+          {
+            hw_event_queue_deschedule (me, controller->tx_poll_event);
+            controller->tx_poll_event = 0;
+          }
+
+        /* In bootstrap mode, initialize the SCI to 1200 bauds to
+           simulate some initial setup by the internal rom.  */
+        if (((cpu->ios[M6811_HPRIO]) & (M6811_SMOD | M6811_MDA)) == M6811_SMOD)
+          {
+            unsigned char val = 0x33;
+            
+            m68hc11sio_io_write_buffer (me, &val, io_map,
+                                        (unsigned_word) M6811_BAUD, 1);
+            val = 0x12;
+            m68hc11sio_io_write_buffer (me, &val, io_map,
+                                        (unsigned_word) M6811_SCCR2, 1);
+          }
+        break;
+      }
+
+    default:
+      hw_abort (me, "Event on unknown port %d", my_port);
+      break;
+    }
+}
+
+
+void
+m68hc11sio_rx_poll (struct hw *me, void *data)
+{
+  SIM_DESC sd;
+  struct m68hc11sio *controller;
+  sim_cpu *cpu;
+  char cc;
+  int cnt;
+  int check_interrupt = 0;
+  
+  controller = hw_data (me);
+  sd         = hw_system (me);
+  cpu        = STATE_CPU (sd, 0);
+  switch (controller->backend)
+    {
+    case sio_tcp:
+      cnt = dv_sockser_read (sd);
+      if (cnt != -1)
+        {
+          cc = (char) cnt;
+          cnt = 1;
+        }
+      break;
+
+    case sio_stdio:
+      cnt = sim_io_poll_read (sd, 0 /* stdin */, &cc, 1);
+      break;
+
+    default:
+      cnt = 0;
+      break;
+    }
+
+  if (cnt == 1)
+    {
+      /* Raise the overrun flag if the previous character was not read.  */
+      if (cpu->ios[M6811_SCSR] & M6811_RDRF)
+        cpu->ios[M6811_SCSR] |= M6811_OR;
+
+      cpu->ios[M6811_SCSR]     |= M6811_RDRF;
+      controller->rx_char       = cc;
+      controller->rx_clear_scsr = 0;
+      check_interrupt = 1;
+    }
+  else
+    {
+      /* handle idle line detect here.  */
+      ;
+    }
+
+  if (controller->rx_poll_event)
+    {
+      hw_event_queue_deschedule (me, controller->rx_poll_event);
+      controller->rx_poll_event = 0;
+    }
+
+  if (cpu->ios[M6811_SCCR2] & M6811_RE)
+    {
+      unsigned long clock_cycle;
+
+      /* Compute CPU clock cycles to wait for the next character.  */
+      clock_cycle = controller->data_length * controller->baud_cycle;
+
+      controller->rx_poll_event = hw_event_queue_schedule (me, clock_cycle,
+                                                           m68hc11sio_rx_poll,
+                                                           NULL);
+    }
+
+  if (check_interrupt)
+      interrupts_update_pending (&cpu->cpu_interrupts);
+}
+
+
+void
+m68hc11sio_tx_poll (struct hw *me, void *data)
+{
+  SIM_DESC sd;
+  struct m68hc11sio *controller;
+  sim_cpu *cpu;
+  int check_interrupt = 0;
+  
+  controller = hw_data (me);
+  sd         = hw_system (me);
+  cpu        = STATE_CPU (sd, 0);
+
+  cpu->ios[M6811_SCSR] |= M6811_TDRE;
+  cpu->ios[M6811_SCSR] |= M6811_TC;
+  
+  /* Transmitter is enabled and we have something to sent.  */
+  if ((cpu->ios[M6811_SCCR2] & M6811_TE) && controller->tx_has_char)
+    {
+      cpu->ios[M6811_SCSR] &= ~M6811_TDRE;
+      cpu->ios[M6811_SCSR] &= ~M6811_TC;
+      controller->tx_has_char = 0;
+      check_interrupt = 1;
+      switch (controller->backend)
+        {
+        case sio_tcp:
+          dv_sockser_write (sd, controller->tx_char);
+          break;
+
+        case sio_stdio:
+          sim_io_write_stdout (sd, &controller->tx_char, 1);
+          sim_io_flush_stdout (sd);
+          break;
+
+        default:
+          break;
+        }
+    }
+
+  if (controller->tx_poll_event)
+    {
+      hw_event_queue_deschedule (me, controller->tx_poll_event);
+      controller->tx_poll_event = 0;
+    }
+  
+  if ((cpu->ios[M6811_SCCR2] & M6811_TE)
+      && ((cpu->ios[M6811_SCSR] & M6811_TC) == 0))
+    {
+      unsigned long clock_cycle;
+      
+      /* Compute CPU clock cycles to wait for the next character.  */
+      clock_cycle = controller->data_length * controller->baud_cycle;
+
+      controller->tx_poll_event = hw_event_queue_schedule (me, clock_cycle,
+                                                           m68hc11sio_tx_poll,
+                                                           NULL);
+    }
+
+  if (check_interrupt)
+      interrupts_update_pending (&cpu->cpu_interrupts);
+}
+
+/* Descriptions of the SIO I/O ports.  These descriptions are only used to
+   give information of the SIO device under GDB.  */
+io_reg_desc sccr2_desc[] = {
+  { M6811_TIE,   "TIE  ", "Transmit Interrupt Enable" },
+  { M6811_TCIE,  "TCIE ", "Transmit Complete Interrupt Enable" },
+  { M6811_RIE,   "RIE  ", "Receive Interrupt Enable" },
+  { M6811_ILIE,  "ILIE ", "Idle Line Interrupt Enable" },
+  { M6811_TE,    "TE   ", "Transmit Enable" },
+  { M6811_RE,    "RE   ", "Receive Enable" },
+  { M6811_RWU,   "RWU  ", "Receiver Wake Up" },
+  { M6811_SBK,   "SBRK ", "Send Break" },
+  { 0,  0, 0 }
+};
+
+io_reg_desc sccr1_desc[] = {
+  { M6811_R8,    "R8   ", "Receive Data bit 8" },
+  { M6811_T8,    "T8   ", "Transmit Data bit 8" },
+  { M6811_M,     "M    ", "SCI Character length (0=8-bits, 1=9-bits)" },
+  { M6811_WAKE,  "WAKE ", "Wake up method select (0=idle, 1=addr mark" },
+  { 0,  0, 0 }
+};
+
+io_reg_desc scsr_desc[] = {
+  { M6811_TDRE,  "TDRE ", "Transmit Data Register Empty" },
+  { M6811_TC,    "TC   ", "Transmit Complete" },
+  { M6811_RDRF,  "RDRF ", "Receive Data Register Full" },
+  { M6811_IDLE,  "IDLE ", "Idle Line Detect" },
+  { M6811_OR,    "OR   ", "Overrun Error" },
+  { M6811_NF,    "NF   ", "Noise Flag" },
+  { M6811_FE,    "FE   ", "Framing Error" },
+  { 0,  0, 0 }
+};
+
+io_reg_desc baud_desc[] = {
+  { M6811_TCLR,  "TCLR ", "Clear baud rate (test mode)" },
+  { M6811_SCP1,  "SCP1 ", "SCI baud rate prescaler select (SCP1)" },
+  { M6811_SCP0,  "SCP0 ", "SCI baud rate prescaler select (SCP0)" },
+  { M6811_RCKB,  "RCKB ", "Baur Rate Clock Check (test mode)" },
+  { M6811_SCR2,  "SCR2 ", "SCI Baud rate select (SCR2)" },
+  { M6811_SCR1,  "SCR1 ", "SCI Baud rate select (SCR1)" },
+  { M6811_SCR0,  "SCR0 ", "SCI Baud rate select (SCR0)" },
+  { 0,  0, 0 }
+};
+
+static void
+m68hc11sio_info (struct hw *me)
+{
+  SIM_DESC sd;
+  uint16 base = 0;
+  sim_cpu *cpu;
+  struct m68hc11sio *controller;
+  uint8 val;
+  long clock_cycle;
+  
+  sd = hw_system (me);
+  cpu = STATE_CPU (sd, 0);
+  controller = hw_data (me);
+  
+  sim_io_printf (sd, "M68HC11 SIO:\n");
+
+  base = cpu_get_io_base (cpu);
+
+  val  = cpu->ios[M6811_BAUD];
+  print_io_byte (sd, "BAUD ", baud_desc, val, base + M6811_BAUD);
+  sim_io_printf (sd, " (%ld baud)\n",
+                 (cpu->cpu_frequency / 4) / controller->baud_cycle);
+
+  val = cpu->ios[M6811_SCCR1];
+  print_io_byte (sd, "SCCR1", sccr1_desc, val, base + M6811_SCCR1);
+  sim_io_printf (sd, "  (%d bits) (%dN1)\n",
+                 controller->data_length, controller->data_length - 2);
+
+  val = cpu->ios[M6811_SCCR2];
+  print_io_byte (sd, "SCCR2", sccr2_desc, val, base + M6811_SCCR2);
+  sim_io_printf (sd, "\n");
+
+  val = cpu->ios[M6811_SCSR];
+  print_io_byte (sd, "SCSR ", scsr_desc, val, base + M6811_SCSR);
+  sim_io_printf (sd, "\n");
+
+  clock_cycle = controller->data_length * controller->baud_cycle;
+  
+  if (controller->tx_poll_event)
+    {
+      signed64 t;
+      int n;
+
+      t = hw_event_remain_time (me, controller->tx_poll_event);
+      n = (clock_cycle - t) / controller->baud_cycle;
+      n = controller->data_length - n;
+      sim_io_printf (sd, "  Transmit finished in %s (%d bit%s)\n",
+		     cycle_to_string (cpu, t), n, (n > 1 ? "s" : ""));
+    }
+  if (controller->rx_poll_event)
+    {
+      signed64 t;
+
+      t = hw_event_remain_time (me, controller->rx_poll_event);
+      sim_io_printf (sd, "  Receive finished in %s\n",
+		     cycle_to_string (cpu, t));
+    }
+  
+}
+
+static int
+m68hc11sio_ioctl (struct hw *me,
+                  hw_ioctl_request request,
+                  va_list ap)
+{
+  m68hc11sio_info (me);
+  return 0;
+}
+
+/* generic read/write */
+
+static unsigned
+m68hc11sio_io_read_buffer (struct hw *me,
+                           void *dest,
+                           int space,
+                           unsigned_word base,
+                           unsigned nr_bytes)
+{
+  SIM_DESC sd;
+  struct m68hc11sio *controller;
+  sim_cpu *cpu;
+  unsigned8 val;
+  
+  HW_TRACE ((me, "read 0x%08lx %d", (long) base, (int) nr_bytes));
+
+  sd  = hw_system (me);
+  cpu = STATE_CPU (sd, 0);
+  controller = hw_data (me);
+
+  switch (base)
+    {
+    case M6811_SCSR:
+      controller->rx_clear_scsr = cpu->ios[M6811_SCSR]
+        & (M6811_RDRF | M6811_IDLE | M6811_OR | M6811_NF | M6811_FE);
+      
+    case M6811_BAUD:
+    case M6811_SCCR1:
+    case M6811_SCCR2:
+      val = cpu->ios[base];
+      break;
+      
+    case M6811_SCDR:
+      if (controller->rx_clear_scsr)
+        {
+          cpu->ios[M6811_SCSR] &= ~controller->rx_clear_scsr;
+        }
+      val = controller->rx_char;
+      break;
+      
+    default:
+      return 0;
+    }
+  *((unsigned8*) dest) = val;
+  return 1;
+}
+
+static unsigned
+m68hc11sio_io_write_buffer (struct hw *me,
+                            const void *source,
+                            int space,
+                            unsigned_word base,
+                            unsigned nr_bytes)
+{
+  SIM_DESC sd;
+  struct m68hc11sio *controller;
+  sim_cpu *cpu;
+  unsigned8 val;
+
+  HW_TRACE ((me, "write 0x%08lx %d", (long) base, (int) nr_bytes));
+
+  sd  = hw_system (me);
+  cpu = STATE_CPU (sd, 0);
+  controller = hw_data (me);
+  
+  val = *((const unsigned8*) source);
+  switch (base)
+    {
+    case M6811_BAUD:
+      {
+        long divisor;
+        long baud;
+
+        cpu->ios[M6811_BAUD] = val;        
+        switch (val & (M6811_SCP1|M6811_SCP0))
+          {
+          case M6811_BAUD_DIV_1:
+            divisor = 1 * 16;
+            break;
+
+          case M6811_BAUD_DIV_3:
+            divisor = 3 * 16;
+            break;
+
+          case M6811_BAUD_DIV_4:
+            divisor = 4 * 16;
+            break;
+
+          default:
+          case M6811_BAUD_DIV_13:
+            divisor = 13 * 16;
+            break;
+          }
+        val &= (M6811_SCR2|M6811_SCR1|M6811_SCR0);
+        divisor *= (1 << val);
+
+        baud = (cpu->cpu_frequency / 4) / divisor;
+
+        HW_TRACE ((me, "divide rate %ld, baud rate %ld",
+                   divisor, baud));
+
+        controller->baud_cycle = divisor;
+      }
+      break;
+      
+    case M6811_SCCR1:
+      {
+        if (val & M6811_M)
+          controller->data_length = 11;
+        else
+          controller->data_length = 10;
+
+        cpu->ios[M6811_SCCR1] = val;
+      }
+      break;
+      
+    case M6811_SCCR2:
+      if ((val & M6811_RE) == 0)
+        {
+          val &= ~(M6811_RDRF|M6811_IDLE|M6811_OR|M6811_NF|M6811_NF);
+          val |= (cpu->ios[M6811_SCCR2]
+                  & (M6811_RDRF|M6811_IDLE|M6811_OR|M6811_NF|M6811_NF));
+          cpu->ios[M6811_SCCR2] = val;
+          break;
+        }
+
+      /* Activate reception.  */
+      if (controller->rx_poll_event == 0)
+        {
+          long clock_cycle;
+          
+          /* Compute CPU clock cycles to wait for the next character.  */
+          clock_cycle = controller->data_length * controller->baud_cycle;
+
+          controller->rx_poll_event = hw_event_queue_schedule (me, clock_cycle,
+                                                               m68hc11sio_rx_poll,
+                                                               NULL);
+        }      
+      cpu->ios[M6811_SCCR2] = val;
+      interrupts_update_pending (&cpu->cpu_interrupts);
+      break;
+
+      /* No effect.  */
+    case M6811_SCSR:
+      return 1;
+      
+    case M6811_SCDR:
+      if (!(cpu->ios[M6811_SCSR] & M6811_TDRE))
+        {
+          return 0;
+        }
+
+      controller->tx_char     = val;
+      controller->tx_has_char = 1;
+      if ((cpu->ios[M6811_SCCR2] & M6811_TE)
+          && controller->tx_poll_event == 0)
+        {
+          m68hc11sio_tx_poll (me, NULL);
+        }
+      return 1;
+      
+    default:
+      return 0;
+    }
+  return nr_bytes;
+}     
+
+
+const struct hw_descriptor dv_m68hc11sio_descriptor[] = {
+  { "m68hc11sio", m68hc11sio_finish },
+  { "m68hc12sio", m68hc11sio_finish },
+  { NULL },
+};
+
diff --git a/sim/m68hc11/dv-m68hc11spi.c b/sim/m68hc11/dv-m68hc11spi.c
new file mode 100644
index 0000000..d0bdfda
--- /dev/null
+++ b/sim/m68hc11/dv-m68hc11spi.c
@@ -0,0 +1,534 @@
+/*  dv-m68hc11spi.c -- Simulation of the 68HC11 SPI
+    Copyright (C) 2000 Free Software Foundation, Inc.
+    Written by Stephane Carrez (stcarrez@worldnet.fr)
+    (From a driver model Contributed by Cygnus Solutions.)
+
+    This file is part of the program GDB, the GNU debugger.
+    
+    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 "sim-main.h"
+#include "hw-main.h"
+#include "dv-sockser.h"
+#include "sim-assert.h"
+
+
+/* DEVICE
+
+        m68hc11spi - m68hc11 SPI interface
+
+   
+   DESCRIPTION
+
+        Implements the m68hc11 Synchronous Serial Peripheral Interface
+        described in the m68hc11 user guide (Chapter 8 in pink book).
+        The SPI I/O controller is directly connected to the CPU
+        interrupt.  The simulator implements:
+
+            - SPI clock emulation
+            - Data transfer
+            - Write collision detection
+    
+
+   PROPERTIES
+
+        None
+
+   
+   PORTS
+
+   reset (input)
+
+        Reset port. This port is only used to simulate a reset of the SPI
+        I/O controller. It should be connected to the RESET output of the cpu.
+
+   */
+
+
+
+/* port ID's */
+
+enum
+{
+  RESET_PORT
+};
+
+
+static const struct hw_port_descriptor m68hc11spi_ports[] = 
+{
+  { "reset", RESET_PORT, 0, input_port, },
+  { NULL, },
+};
+
+
+/* SPI */
+struct m68hc11spi 
+{
+  /* Information about next character to be transmited.  */
+  unsigned char tx_char;
+  int           tx_bit;
+  unsigned char mode;
+  
+  unsigned char rx_char;
+  unsigned char rx_clear_scsr;
+  unsigned char clk_pin;
+  
+  /* SPI clock rate (twice the real clock).  */
+  unsigned int clock;
+  
+  /* Periodic SPI event.  */
+  struct hw_event* spi_event;
+};
+
+
+
+/* Finish off the partially created hw device.  Attach our local
+   callbacks.  Wire up our port names etc */
+
+static hw_io_read_buffer_method m68hc11spi_io_read_buffer;
+static hw_io_write_buffer_method m68hc11spi_io_write_buffer;
+static hw_port_event_method m68hc11spi_port_event;
+static hw_ioctl_method m68hc11spi_ioctl;
+
+#define M6811_SPI_FIRST_REG (M6811_SPCR)
+#define M6811_SPI_LAST_REG  (M6811_SPDR)
+
+
+static void
+attach_m68hc11spi_regs (struct hw *me,
+                        struct m68hc11spi *controller)
+{
+  hw_attach_address (hw_parent (me), M6811_IO_LEVEL, io_map,
+                     M6811_SPI_FIRST_REG,
+                     M6811_SPI_LAST_REG - M6811_SPI_FIRST_REG + 1,
+		     me);
+}
+
+static void
+m68hc11spi_finish (struct hw *me)
+{
+  struct m68hc11spi *controller;
+
+  controller = HW_ZALLOC (me, struct m68hc11spi);
+  set_hw_data (me, controller);
+  set_hw_io_read_buffer (me, m68hc11spi_io_read_buffer);
+  set_hw_io_write_buffer (me, m68hc11spi_io_write_buffer);
+  set_hw_ports (me, m68hc11spi_ports);
+  set_hw_port_event (me, m68hc11spi_port_event);
+#ifdef set_hw_ioctl
+  set_hw_ioctl (me, m68hc11spi_ioctl);
+#else
+  me->to_ioctl = m68hc11spi_ioctl;
+#endif
+
+  /* Attach ourself to our parent bus.  */
+  attach_m68hc11spi_regs (me, controller);
+
+  /* Initialize to reset state.  */
+  controller->spi_event = NULL;
+  controller->rx_clear_scsr = 0;
+}
+
+
+
+/* An event arrives on an interrupt port */
+
+static void
+m68hc11spi_port_event (struct hw *me,
+                       int my_port,
+                       struct hw *source,
+                       int source_port,
+                       int level)
+{
+  SIM_DESC sd;
+  struct m68hc11spi *controller;
+  sim_cpu* cpu;
+  unsigned8 val;
+  
+  controller = hw_data (me);
+  sd         = hw_system (me);
+  cpu        = STATE_CPU (sd, 0);  
+  switch (my_port)
+    {
+    case RESET_PORT:
+      {
+	HW_TRACE ((me, "SPI reset"));
+
+        /* Reset the state of SPI registers.  */
+        controller->rx_clear_scsr = 0;
+        if (controller->spi_event)
+          {
+            hw_event_queue_deschedule (me, controller->spi_event);
+            controller->spi_event = 0;
+          }
+
+        val = 0;
+        m68hc11spi_io_write_buffer (me, &val, io_map,
+                                    (unsigned_word) M6811_SPCR, 1);
+        break;
+      }
+
+    default:
+      hw_abort (me, "Event on unknown port %d", my_port);
+      break;
+    }
+}
+
+static void
+set_bit_port (struct hw *me, sim_cpu *cpu, int port, int mask, int value)
+{
+  /* TODO: Post an event to inform other devices that pin 'port' changes.
+     This has only a sense if we provide some device that is logically
+     connected to these pin ports (SCLK and MOSI) and that handles
+     the SPI protocol.  */
+  if (value)
+    cpu->ios[port] |= mask;
+  else
+    cpu->ios[port] &= ~mask;
+}
+
+
+/* When a character is sent/received by the SPI, the PD2..PD5 line
+   are driven by the following signals:
+
+	      B7	B6
+      -----+---------+--------+---/-+-------
+ MOSI      |    |    |   |    |     |
+ MISO	   +---------+--------+---/-+
+		____      ___
+ CLK	_______/    \____/   \__		CPOL=0, CPHA=0
+	_______	     ____     __
+	       \____/    \___/			CPOL=1, CPHA=0
+	   ____	     ____     __
+	__/    \____/    \___/			CPOL=0, CPHA=1
+	__	____      ___
+	  \____/    \____/   \__		CPOL=1, CPHA=1
+
+ SS ___                                 ____
+       \__________________________//___/
+
+ MISO = PD2
+ MOSI = PD3
+ SCK  = PD4
+ SS   = PD5
+
+*/
+
+#define SPI_START_BYTE 0
+#define SPI_START_BIT  1
+#define SPI_MIDDLE_BIT 2
+
+void
+m68hc11spi_clock (struct hw *me, void *data)
+{
+  SIM_DESC sd;
+  struct m68hc11spi* controller;
+  sim_cpu *cpu;
+  int check_interrupt = 0;
+  
+  controller = hw_data (me);
+  sd         = hw_system (me);
+  cpu        = STATE_CPU (sd, 0);
+
+  /* Cleanup current event.  */
+  if (controller->spi_event)
+    {
+      hw_event_queue_deschedule (me, controller->spi_event);
+      controller->spi_event = 0;
+    }
+
+  /* Change a bit of data at each two SPI event.  */
+  if (controller->mode == SPI_START_BIT)
+    {
+      /* Reflect the bit value on bit 2 of port D.  */
+      set_bit_port (me, cpu, M6811_PORTD, (1 << 2),
+                    (controller->tx_char & (1 << controller->tx_bit)));
+      controller->tx_bit--;
+      controller->mode = SPI_MIDDLE_BIT;
+    }
+  else if (controller->mode == SPI_MIDDLE_BIT)
+    {
+      controller->mode = SPI_START_BIT;
+    }
+
+  if (controller->mode == SPI_START_BYTE)
+    {
+      /* Start a new SPI transfer.  */
+      
+      /* TBD: clear SS output.  */
+      controller->mode = SPI_START_BIT;
+      controller->tx_bit = 7;
+      set_bit_port (me, cpu, M6811_PORTD, (1 << 4), ~controller->clk_pin);
+    }
+  else
+    {
+      /* Change the SPI clock at each event on bit 4 of port D.  */
+      controller->clk_pin = ~controller->clk_pin;
+      set_bit_port (me, cpu, M6811_PORTD, (1 << 4), controller->clk_pin);
+    }
+  
+  /* Transmit is now complete for this byte.  */
+  if (controller->mode == SPI_START_BIT && controller->tx_bit < 0)
+    {
+      controller->rx_clear_scsr = 0;
+      cpu->ios[M6811_SPSR] |= M6811_SPIF;
+      if (cpu->ios[M6811_SPCR] & M6811_SPIE)
+        check_interrupt = 1;
+    }
+  else
+    {
+      controller->spi_event = hw_event_queue_schedule (me, controller->clock,
+                                                       m68hc11spi_clock,
+                                                       NULL);
+    }
+
+  if (check_interrupt)
+    interrupts_update_pending (&cpu->cpu_interrupts);
+}
+
+/* Flags of the SPCR register.  */
+io_reg_desc spcr_desc[] = {
+  { M6811_SPIE, "SPIE ", "Serial Peripheral Interrupt Enable" },
+  { M6811_SPE,  "SPE  ",  "Serial Peripheral System Enable" },
+  { M6811_DWOM, "DWOM ", "Port D Wire-OR mode option" },
+  { M6811_MSTR, "MSTR ", "Master Mode Select" },
+  { M6811_CPOL, "CPOL ", "Clock Polarity" },
+  { M6811_CPHA, "CPHA ", "Clock Phase" },
+  { M6811_SPR1, "SPR1 ", "SPI Clock Rate Select" },
+  { M6811_SPR0, "SPR0 ", "SPI Clock Rate Select" },
+  { 0,  0, 0 }
+};
+
+
+/* Flags of the SPSR register.  */
+io_reg_desc spsr_desc[] = {
+  { M6811_SPIF,	"SPIF ", "SPI Transfer Complete flag" },
+  { M6811_WCOL, "WCOL ", "Write Collision" },
+  { M6811_MODF, "MODF ", "Mode Fault" },
+  { 0,  0, 0 }
+};
+
+static void
+m68hc11spi_info (struct hw *me)
+{
+  SIM_DESC sd;
+  uint16 base = 0;
+  sim_cpu *cpu;
+  struct m68hc11spi *controller;
+  uint8 val;
+  
+  sd = hw_system (me);
+  cpu = STATE_CPU (sd, 0);
+  controller = hw_data (me);
+  
+  sim_io_printf (sd, "M68HC11 SPI:\n");
+
+  base = cpu_get_io_base (cpu);
+
+  val = cpu->ios[M6811_SPCR];
+  print_io_byte (sd, "SPCR", spcr_desc, val, base + M6811_SPCR);
+  sim_io_printf (sd, "\n");
+
+  val = cpu->ios[M6811_SPSR];
+  print_io_byte (sd, "SPSR", spsr_desc, val, base + M6811_SPSR);
+  sim_io_printf (sd, "\n");
+
+  if (controller->spi_event)
+    {
+      signed64 t;
+
+      sim_io_printf (sd, "  SPI has %d bits to send\n",
+                     controller->tx_bit + 1);
+      t = hw_event_remain_time (me, controller->spi_event);
+      sim_io_printf (sd, "  SPI current bit-cycle finished in %s\n",
+		     cycle_to_string (cpu, t));
+
+      t += (controller->tx_bit + 1) * 2 * controller->clock;
+      sim_io_printf (sd, "  SPI operation finished in %s\n",
+		     cycle_to_string (cpu, t));
+    }
+}
+
+static int
+m68hc11spi_ioctl (struct hw *me,
+                  hw_ioctl_request request,
+                  va_list ap)
+{
+  m68hc11spi_info (me);
+  return 0;
+}
+
+/* generic read/write */
+
+static unsigned
+m68hc11spi_io_read_buffer (struct hw *me,
+                           void *dest,
+                           int space,
+                           unsigned_word base,
+                           unsigned nr_bytes)
+{
+  SIM_DESC sd;
+  struct m68hc11spi *controller;
+  sim_cpu *cpu;
+  unsigned8 val;
+  
+  HW_TRACE ((me, "read 0x%08lx %d", (long) base, (int) nr_bytes));
+
+  sd  = hw_system (me);
+  cpu = STATE_CPU (sd, 0);
+  controller = hw_data (me);
+
+  switch (base)
+    {
+    case M6811_SPSR:
+      controller->rx_clear_scsr = cpu->ios[M6811_SCSR]
+        & (M6811_SPIF | M6811_WCOL | M6811_MODF);
+      
+    case M6811_SPCR:
+      val = cpu->ios[base];
+      break;
+      
+    case M6811_SPDR:
+      if (controller->rx_clear_scsr)
+        {
+          cpu->ios[M6811_SPSR] &= ~controller->rx_clear_scsr;
+          controller->rx_clear_scsr = 0;
+          interrupts_update_pending (&cpu->cpu_interrupts);
+        }
+      val = controller->rx_char;
+      break;
+      
+    default:
+      return 0;
+    }
+  *((unsigned8*) dest) = val;
+  return 1;
+}
+
+static unsigned
+m68hc11spi_io_write_buffer (struct hw *me,
+                            const void *source,
+                            int space,
+                            unsigned_word base,
+                            unsigned nr_bytes)
+{
+  SIM_DESC sd;
+  struct m68hc11spi *controller;
+  sim_cpu *cpu;
+  unsigned8 val;
+
+  HW_TRACE ((me, "write 0x%08lx %d", (long) base, (int) nr_bytes));
+
+  sd  = hw_system (me);
+  cpu = STATE_CPU (sd, 0);
+  controller = hw_data (me);
+  
+  val = *((const unsigned8*) source);
+  switch (base)
+    {
+    case M6811_SPCR:
+      cpu->ios[M6811_SPCR] = val;
+
+      /* The SPI clock rate is 2, 4, 16, 32 of the internal CPU clock.
+         We have to drive the clock pin and need a 2x faster clock.  */
+      switch (val & (M6811_SPR1 | M6811_SPR0))
+        {
+        case 0:
+          controller->clock = 1;
+          break;
+
+        case 1:
+          controller->clock = 2;
+          break;
+
+        case 2:
+          controller->clock = 8;
+          break;
+
+        default:
+          controller->clock = 16;
+          break;
+        }
+
+      /* Set the clock pin.  */
+      if ((val & M6811_CPOL)
+          && (controller->spi_event == 0
+              || ((val & M6811_CPHA) && controller->mode == 1)))
+        controller->clk_pin = 1;
+      else
+        controller->clk_pin = 0;
+
+      set_bit_port (me, cpu, M6811_PORTD, (1 << 4), controller->clk_pin);
+      break;
+      
+      /* Can't write to SPSR.  */
+    case M6811_SPSR:
+      break;
+      
+    case M6811_SPDR:
+      if (!(cpu->ios[M6811_SPCR] & M6811_SPE))
+        {
+          return 0;
+        }
+
+      if (controller->rx_clear_scsr)
+        {
+          cpu->ios[M6811_SPSR] &= ~controller->rx_clear_scsr;
+          controller->rx_clear_scsr = 0;
+          interrupts_update_pending (&cpu->cpu_interrupts);
+        }
+
+      /* If transfer is taking place, a write to SPDR
+         generates a collision.  */
+      if (controller->spi_event)
+        {
+          cpu->ios[M6811_SPSR] |= M6811_WCOL;
+          break;
+        }
+
+      /* Refuse the write if there was no read of SPSR.  */
+      /* ???? TBD. */
+
+      /* Prepare to send a byte.  */
+      controller->tx_char = val;
+      controller->mode   = SPI_START_BYTE;
+
+      /* Toggle clock pin internal value when CPHA is 0 so that
+         it will really change in the middle of a bit.  */
+      if (!(cpu->ios[M6811_SPCR] & M6811_CPHA))
+        controller->clk_pin = ~controller->clk_pin;
+
+      cpu->ios[M6811_SPDR] = val;
+
+      /* Activate transmission.  */
+      m68hc11spi_clock (me, NULL);
+      break;
+
+    default:
+      return 0;
+    }
+  return nr_bytes;
+}     
+
+
+const struct hw_descriptor dv_m68hc11spi_descriptor[] = {
+  { "m68hc11spi", m68hc11spi_finish },
+  { "m68hc12spi", m68hc11spi_finish },
+  { NULL },
+};
+
diff --git a/sim/m68hc11/dv-m68hc11tim.c b/sim/m68hc11/dv-m68hc11tim.c
new file mode 100644
index 0000000..144ae4b
--- /dev/null
+++ b/sim/m68hc11/dv-m68hc11tim.c
@@ -0,0 +1,694 @@
+/*  dv-m68hc11tim.c -- Simulation of the 68HC11 timer devices.
+    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+    Written by Stephane Carrez (stcarrez@worldnet.fr)
+    (From a driver model Contributed by Cygnus Solutions.)
+
+    This file is part of the program GDB, the GNU debugger.
+    
+    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 vertimn 2 of the License, or
+    (at your option) any later vertimn.
+    
+    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 "sim-main.h"
+#include "hw-main.h"
+#include "sim-assert.h"
+
+
+/* DEVICE
+
+        m68hc11tim - m68hc11 timer devices
+
+   
+   DESCRIPTION
+   
+        Implements the m68hc11 timer as described in Chapter 10
+        of the pink book.
+
+   
+   PROPERTIES
+
+        none
+
+   
+   PORTS
+
+   reset (input)
+
+        Reset the timer device.  This port must be connected to
+        the cpu-reset output port.
+
+   */
+
+
+
+/* port ID's */
+
+enum
+{
+  RESET_PORT
+};
+
+
+static const struct hw_port_descriptor m68hc11tim_ports[] = 
+{
+  { "reset", RESET_PORT, 0, input_port, },
+  { NULL, },
+};
+
+
+/* Timer Controller information.  */
+struct m68hc11tim 
+{
+  unsigned long cop_delay;
+  unsigned long rti_delay;
+  unsigned long ovf_delay;
+  signed64      clock_prescaler;
+  signed64      tcnt_adjust;
+  signed64      cop_prev_interrupt;
+  signed64      rti_prev_interrupt;
+
+  /* Periodic timers.  */
+  struct hw_event *rti_timer_event;
+  struct hw_event *cop_timer_event;
+  struct hw_event *tof_timer_event;
+  struct hw_event *cmp_timer_event;
+};
+
+
+
+/* Finish off the partially created hw device.  Attach our local
+   callbacks.  Wire up our port names etc.  */
+
+static hw_io_read_buffer_method m68hc11tim_io_read_buffer;
+static hw_io_write_buffer_method m68hc11tim_io_write_buffer;
+static hw_port_event_method m68hc11tim_port_event;
+static hw_ioctl_method m68hc11tim_ioctl;
+
+#define M6811_TIMER_FIRST_REG (M6811_TCTN)
+#define M6811_TIMER_LAST_REG  (M6811_PACNT)
+
+
+static void
+attach_m68hc11tim_regs (struct hw *me,
+                        struct m68hc11tim *controller)
+{
+  hw_attach_address (hw_parent (me), M6811_IO_LEVEL, io_map,
+                     M6811_TIMER_FIRST_REG,
+                     M6811_TIMER_LAST_REG - M6811_TIMER_FIRST_REG + 1,
+		     me);
+}
+
+static void
+m68hc11tim_finish (struct hw *me)
+{
+  struct m68hc11tim *controller;
+
+  controller = HW_ZALLOC (me, struct m68hc11tim);
+  set_hw_data (me, controller);
+  set_hw_io_read_buffer (me, m68hc11tim_io_read_buffer);
+  set_hw_io_write_buffer (me, m68hc11tim_io_write_buffer);
+  set_hw_ports (me, m68hc11tim_ports);
+  set_hw_port_event (me, m68hc11tim_port_event);
+#ifdef set_hw_ioctl
+  set_hw_ioctl (me, m68hc11tim_ioctl);
+#else
+  me->to_ioctl = m68hc11tim_ioctl;
+#endif
+  
+  /* Preset defaults.  */
+  controller->clock_prescaler = 1;
+  controller->tcnt_adjust = 0;
+  
+  /* Attach ourself to our parent bus.  */
+  attach_m68hc11tim_regs (me, controller);
+}
+
+
+
+/* An event arrives on an interrupt port.  */
+
+static void
+m68hc11tim_port_event (struct hw *me,
+                       int my_port,
+                       struct hw *source,
+                       int source_port,
+                       int level)
+{
+  SIM_DESC sd;
+  struct m68hc11tim *controller;
+  sim_cpu *cpu;
+  unsigned8 val;
+  
+  controller = hw_data (me);
+  sd         = hw_system (me);
+  cpu        = STATE_CPU (sd, 0);
+  switch (my_port)
+    {
+    case RESET_PORT:
+      {
+	HW_TRACE ((me, "Timer reset"));
+
+        /* Cancel all timer events.  */
+        if (controller->rti_timer_event)
+          {
+            hw_event_queue_deschedule (me, controller->rti_timer_event);
+            controller->rti_timer_event = 0;
+            controller->rti_prev_interrupt = 0;
+          }
+        if (controller->cop_timer_event)
+          {
+            hw_event_queue_deschedule (me, controller->cop_timer_event);
+            controller->cop_timer_event = 0;
+            controller->cop_prev_interrupt = 0;
+          }
+        if (controller->tof_timer_event)
+          {
+            hw_event_queue_deschedule (me, controller->tof_timer_event);
+            controller->tof_timer_event = 0;
+          }
+        if (controller->cmp_timer_event)
+          {
+            hw_event_queue_deschedule (me, controller->cmp_timer_event);
+            controller->cmp_timer_event = 0;
+          }
+
+        /* Reset the state of Timer registers.  This also restarts
+           the timer events (overflow and RTI clock).  */
+        val = 0;
+        m68hc11tim_io_write_buffer (me, &val, io_map,
+                                    (unsigned_word) M6811_TMSK2, 1);
+        m68hc11tim_io_write_buffer (me, &val, io_map,
+                                    (unsigned_word) M6811_TFLG2, 1);
+        m68hc11tim_io_write_buffer (me, &val, io_map,
+                                    (unsigned_word) M6811_PACTL, 1);
+        break;
+      }
+
+    default:
+      hw_abort (me, "Event on unknown port %d", my_port);
+      break;
+    }
+}
+
+enum event_type
+{
+  COP_EVENT,
+  RTI_EVENT,
+  OVERFLOW_EVENT,
+  COMPARE_EVENT
+};
+
+void
+m68hc11tim_timer_event (struct hw *me, void *data)
+{
+  SIM_DESC sd;
+  struct m68hc11tim *controller;
+  sim_cpu *cpu;
+  enum event_type type;
+  unsigned long delay;
+  struct hw_event **eventp;
+  int check_interrupt = 0;
+  unsigned mask;
+  unsigned flags;
+  unsigned long tcnt_internal;
+  unsigned long tcnt;
+  int i;
+  sim_events *events;
+  
+  controller = hw_data (me);
+  sd         = hw_system (me);
+  cpu        = STATE_CPU (sd, 0);
+  type       = (enum event_type) ((long) data) & 0x0FF;
+  events     = STATE_EVENTS (sd);
+
+  delay = 0;
+  switch (type)
+    {
+    case COP_EVENT:
+      eventp = &controller->cop_timer_event;
+      delay  = controller->cop_delay;
+      delay  = controller->cop_prev_interrupt + controller->cop_delay;
+      controller->cop_prev_interrupt = delay;
+      delay  = delay - cpu->cpu_absolute_cycle;
+      check_interrupt = 1;
+      delay += events->nr_ticks_to_process;
+      break;
+
+    case RTI_EVENT:
+      eventp = &controller->rti_timer_event;
+      delay  = controller->rti_prev_interrupt + controller->rti_delay;
+      
+      if (((long) (data) & 0x0100) == 0)
+        {
+          cpu->ios[M6811_TFLG2] |= M6811_RTIF;
+          check_interrupt = 1;
+          controller->rti_prev_interrupt = delay;
+          delay += controller->rti_delay;
+        }
+      delay = delay - cpu->cpu_absolute_cycle;
+      delay += events->nr_ticks_to_process;
+      break;
+
+    case OVERFLOW_EVENT:
+      /* Compute the 68HC11 internal free running counter.
+         There may be 'nr_ticks_to_process' pending cycles that are
+         not (yet) taken into account by 'sim_events_time'.  */
+      tcnt_internal = sim_events_time (sd) - controller->tcnt_adjust;
+      tcnt_internal += events->nr_ticks_to_process;
+
+      /* We must take into account the prescaler that comes
+         before the counter (it's a power of 2).  */
+      tcnt_internal &= 0x0ffff * controller->clock_prescaler;
+
+      /* Compute the time when the overflow will occur.  It occurs when
+         the counter increments from 0x0ffff to 0x10000 (and thus resets).  */
+      delay = (0x10000 * controller->clock_prescaler) - tcnt_internal;
+
+      /* The 'nr_ticks_to_process' will be subtracted when the event
+         is scheduled.  */
+      delay += events->nr_ticks_to_process;
+
+      eventp = &controller->tof_timer_event;
+      if (((long) (data) & 0x100) == 0)
+        {
+          cpu->ios[M6811_TFLG2] |= M6811_TOF;
+          check_interrupt = 1;
+        }
+      break;
+
+    case COMPARE_EVENT:
+      eventp = &controller->cmp_timer_event;
+
+      /* Compute the 68HC11 internal free running counter.
+         There may be 'nr_ticks_to_process' pending cycles that are
+         not (yet) taken into account by 'sim_events_time'.  */
+      events = STATE_EVENTS (sd);
+      tcnt_internal = sim_events_time (sd) - controller->tcnt_adjust;
+      tcnt_internal += events->nr_ticks_to_process;
+
+      /* We must take into account the prescaler that comes
+         before the counter (it's a power of 2).  */
+      tcnt_internal &= 0x0ffff * controller->clock_prescaler;
+
+      /* Get current visible TCNT register value.  */
+      tcnt = tcnt_internal / controller->clock_prescaler;
+      
+      flags = cpu->ios[M6811_TMSK1];
+      mask  = 0x80;
+      delay = 65536 * controller->clock_prescaler;
+
+      /* Scan each output compare register to see if one matches
+         the free running counter.  Set the corresponding OCi flag
+         if the output compare is enabled.  */
+      for (i = M6811_TOC1; i <= M6811_TOC5; i += 2, mask >>= 1)
+        {
+          unsigned long compare;
+          
+          compare = (cpu->ios[i] << 8) + cpu->ios[i+1];
+          if (compare == tcnt && (flags & mask))
+            {
+              cpu->ios[M6811_TFLG1] |= mask;
+              check_interrupt++;
+            }
+
+          /* Compute how many times for the next match.
+             Use the internal counter value to take into account the
+             prescaler accurately.  */
+          compare = compare * controller->clock_prescaler;
+          if (compare > tcnt_internal)
+            compare = compare - tcnt_internal;
+          else
+            compare = compare - tcnt_internal
+              + 65536 * controller->clock_prescaler;
+          
+          if (compare < delay)
+            delay = compare;
+        }
+
+      /* Deactivate the compare timer if no output compare is enabled.  */
+      if ((flags & 0xF0) == 0)
+        delay = 0;
+      break;
+
+    default:
+      eventp = 0;
+      break;
+    }
+
+  if (*eventp)
+    {
+      hw_event_queue_deschedule (me, *eventp);
+      *eventp = 0;
+    }
+
+  if (delay != 0)
+    {
+      *eventp = hw_event_queue_schedule (me, delay,
+                                         m68hc11tim_timer_event,
+                                         (void*) type);
+    }
+
+  if (check_interrupt)
+    interrupts_update_pending (&cpu->cpu_interrupts);
+}
+
+
+/* Descriptions of the Timer I/O ports.  These descriptions are only used to
+   give information of the Timer device under GDB.  */
+io_reg_desc tmsk2_desc[] = {
+  { M6811_TOI,    "TOI   ", "Timer Overflow Interrupt Enable" },
+  { M6811_RTII,   "RTII  ", "RTI Interrupt Enable" },
+  { M6811_PAOVI,  "PAOVI ", "Pulse Accumulator Overflow Interrupt Enable" },
+  { M6811_PAII,   "PAII  ", "Pulse Accumulator Interrupt Enable" },
+  { M6811_PR1,    "PR1   ", "Timer prescaler (PR1)" },
+  { M6811_PR0,    "PR0   ", "Timer prescaler (PR0)" },
+  { M6811_TPR_1,  "TPR_1 ", "Timer prescaler div 1" },
+  { M6811_TPR_4,  "TPR_4 ", "Timer prescaler div 4" },
+  { M6811_TPR_8,  "TPR_8 ", "Timer prescaler div 8" },
+  { M6811_TPR_16, "TPR_16", "Timer prescaler div 16" },
+  { 0,  0, 0 }
+};
+
+io_reg_desc tflg2_desc[] = {
+  { M6811_TOF,   "TOF   ", "Timer Overflow Bit" },
+  { M6811_RTIF,  "RTIF  ", "Read Time Interrupt Flag" },
+  { M6811_PAOVF, "PAOVF ", "Pulse Accumulator Overflow Interrupt Flag" },
+  { M6811_PAIF,  "PAIF  ", "Pulse Accumulator Input Edge" },
+  { 0,  0, 0 }
+};
+
+io_reg_desc pactl_desc[] = {
+  { M6811_DDRA7,  "DDRA7 ", "Data Direction for Port A bit-7" },
+  { M6811_PAEN,   "PAEN  ", "Pulse Accumulator System Enable" },
+  { M6811_PAMOD,  "PAMOD ", "Pulse Accumulator Mode" },
+  { M6811_PEDGE,  "PEDGE ", "Pulse Accumulator Edge Control" },
+  { M6811_RTR1,   "RTR1  ", "RTI Interrupt rate select (RTR1)" },
+  { M6811_RTR0,   "RTR0  ", "RTI Interrupt rate select (RTR0)" },
+  { 0,  0, 0 }
+};
+
+static double
+to_realtime (sim_cpu *cpu, signed64 t)
+{
+  return (double) (t) / (double) (cpu->cpu_frequency / 4);
+}
+
+const char*
+cycle_to_string (sim_cpu *cpu, signed64 t)
+{
+  double dt;
+  static char buf[64];
+  
+  dt = to_realtime (cpu, t);
+  if (dt < 0.001)
+    sprintf (buf, "%llu cycle%s (%3.1f us)", t,
+             (t > 1 ? "s" : ""), dt * 1000000.0);
+  else if (dt < 1.0)
+    sprintf (buf, "%llu cycles (%3.1f ms)", t, dt * 1000.0);
+  else
+    sprintf (buf, "%llu cycles (%3.1f s)", t, dt);
+
+  return buf;
+}
+
+static void
+m68hc11tim_print_timer (struct hw *me, const char *name,
+                        struct hw_event *event)
+{
+  SIM_DESC sd;
+  
+  sd = hw_system (me);
+  if (event == 0)
+    {
+      sim_io_printf (sd, "  No %s interrupt will be raised.\n", name);
+    }
+  else
+    {
+      signed64 t;
+      sim_cpu* cpu;
+
+      cpu = STATE_CPU (sd, 0);
+
+      t  = hw_event_remain_time (me, event);
+      sim_io_printf (sd, "  Next %s interrupt in %s\n",
+                     name, cycle_to_string (cpu, t));
+    }
+}
+
+static void
+m68hc11tim_info (struct hw *me)
+{
+  SIM_DESC sd;
+  uint16 base = 0;
+  sim_cpu *cpu;
+  struct m68hc11tim *controller;
+  uint8 val;
+  
+  sd = hw_system (me);
+  cpu = STATE_CPU (sd, 0);
+  controller = hw_data (me);
+  
+  sim_io_printf (sd, "M68HC11 Timer:\n");
+
+  base = cpu_get_io_base (cpu);
+
+  val  = cpu->ios[M6811_TMSK2];
+  print_io_byte (sd, "TMSK2 ", tmsk2_desc, val, base + M6811_TMSK2);
+  sim_io_printf (sd, "\n");
+
+  val = cpu->ios[M6811_TFLG2];
+  print_io_byte (sd, "TFLG2", tflg2_desc, val, base + M6811_TFLG2);
+  sim_io_printf (sd, "\n");
+
+  val = cpu->ios[M6811_PACTL];
+  print_io_byte (sd, "PACTL", pactl_desc, val, base + M6811_PACTL);
+  sim_io_printf (sd, "\n");
+
+  /* Give info about the next timer interrupts.  */
+  m68hc11tim_print_timer (me, "RTI", controller->rti_timer_event);
+  m68hc11tim_print_timer (me, "COP", controller->cop_timer_event);
+  m68hc11tim_print_timer (me, "OVERFLOW", controller->tof_timer_event);
+  m68hc11tim_print_timer (me, "COMPARE", controller->cmp_timer_event);
+}
+
+static int
+m68hc11tim_ioctl (struct hw *me,
+                  hw_ioctl_request request,
+                  va_list ap)
+{
+  m68hc11tim_info (me);
+  return 0;
+}
+
+/* generic read/write */
+
+static unsigned
+m68hc11tim_io_read_buffer (struct hw *me,
+                           void *dest,
+                           int space,
+                           unsigned_word base,
+                           unsigned nr_bytes)
+{
+  SIM_DESC sd;
+  struct m68hc11tim *controller;
+  sim_cpu *cpu;
+  unsigned8 val;
+  unsigned cnt = 0;
+  
+  HW_TRACE ((me, "read 0x%08lx %d", (long) base, (int) nr_bytes));
+
+  sd  = hw_system (me);
+  cpu = STATE_CPU (sd, 0);
+  controller = hw_data (me);
+
+  while (nr_bytes)
+    {
+      switch (base)
+        {
+          /* The cpu_absolute_cycle is updated after each instruction.
+             Reading in a 16-bit register will be split in two accesses
+             but this will be atomic within the simulator.  */
+        case M6811_TCTN_H:
+          val = (uint8) ((cpu->cpu_absolute_cycle - controller->tcnt_adjust)
+                         / (controller->clock_prescaler * 256));
+          break;
+
+        case M6811_TCTN_L:
+          val = (uint8) ((cpu->cpu_absolute_cycle - controller->tcnt_adjust)
+                         / controller->clock_prescaler);
+          break;
+
+        default:
+          val = cpu->ios[base];
+          break;
+        }
+      *((unsigned8*) dest) = val;
+      dest++;
+      base++;
+      nr_bytes--;
+      cnt++;
+    }
+  return cnt;
+}
+
+static unsigned
+m68hc11tim_io_write_buffer (struct hw *me,
+                            const void *source,
+                            int space,
+                            unsigned_word base,
+                            unsigned nr_bytes)
+{
+  SIM_DESC sd;
+  struct m68hc11tim *controller;
+  sim_cpu *cpu;
+  unsigned8 val, n;
+  signed64 adj;
+  int reset_compare = 0;
+  int reset_overflow = 0;
+  int cnt = 0;
+  
+  HW_TRACE ((me, "write 0x%08lx %d", (long) base, (int) nr_bytes));
+
+  sd  = hw_system (me);
+  cpu = STATE_CPU (sd, 0);
+  controller = hw_data (me);
+
+  while (nr_bytes)
+    {
+      val = *((const unsigned8*) source);
+      switch (base)
+        {
+          /* Set the timer counter low part, trying to preserve the low part.
+             We compute the absolute cycle adjustment that we have to apply
+             to obtain the timer current value.  Computation must be made
+             in 64-bit to avoid overflow problems.  */
+        case M6811_TCTN_L:
+          adj = ((cpu->cpu_absolute_cycle - controller->tcnt_adjust)
+                 / (controller->clock_prescaler * (signed64) 256)) & 0x0FF;
+          adj = cpu->cpu_absolute_cycle
+            - (adj * controller->clock_prescaler * (signed64) 256)
+            - ((signed64) adj * controller->clock_prescaler);
+          controller->tcnt_adjust = adj;
+          reset_compare = 1;
+          reset_overflow = 1;
+          break;
+
+        case M6811_TCTN_H:
+          adj = ((cpu->cpu_absolute_cycle - controller->tcnt_adjust)
+                 / controller->clock_prescaler) & 0x0ff;
+          adj = cpu->cpu_absolute_cycle
+            - ((signed64) val * controller->clock_prescaler * (signed64) 256)
+            - (adj * controller->clock_prescaler);
+          controller->tcnt_adjust = adj;
+          reset_compare = 1;
+          reset_overflow = 1;
+          break;
+
+        case M6811_TMSK2:
+
+      /* Timer prescaler cannot be changed after 64 bus cycles.  */
+          if (cpu->cpu_absolute_cycle >= 64)
+            {
+              val &= ~(M6811_PR1 | M6811_PR0);
+              val |= cpu->ios[M6811_TMSK2] & (M6811_PR1 | M6811_PR0);
+            }
+          switch (val & (M6811_PR1 | M6811_PR0))
+            {
+            case 0:
+              n = 1;
+              break;
+            case M6811_PR0:
+              n = 4;
+              break;
+            case M6811_PR1:
+              n = 8;
+              break;
+            default:
+            case M6811_PR1 | M6811_PR0:
+              n = 16;
+              break;
+            }
+          if (cpu->cpu_absolute_cycle < 64)
+            {
+              reset_overflow = 1;
+              controller->clock_prescaler = n;
+            }
+          cpu->ios[base] = val;
+          interrupts_update_pending (&cpu->cpu_interrupts);
+          break;
+
+        case M6811_PACTL:
+          n = (1 << ((val & (M6811_RTR1 | M6811_RTR0))));
+          cpu->ios[base] = val;
+
+          controller->rti_delay = (long) (n) * 8192;
+          m68hc11tim_timer_event (me, (void*) (RTI_EVENT| 0x100));
+          break;
+      
+        case M6811_TFLG2:
+          if (val & M6811_TOF)
+            val &= ~M6811_TOF;
+          else
+            val |= cpu->ios[M6811_TFLG2] & M6811_TOF;
+
+      /* Clear the Real Time interrupt flag. */
+          if (val & M6811_RTIF)
+            val &= ~M6811_RTIF;
+          else
+            val |= cpu->ios[M6811_TFLG2] & M6811_RTIF;
+      
+          cpu->ios[base] = val;
+          interrupts_update_pending (&cpu->cpu_interrupts);
+          break;
+
+        case M6811_TOC1:
+        case M6811_TOC2:
+        case M6811_TOC3:
+        case M6811_TOC4:
+        case M6811_TOC5:
+          cpu->ios[base] = val;
+          reset_compare = 1;
+          break;
+      
+        default:
+          break;
+        }
+
+      base++;
+      nr_bytes--;
+      cnt++;
+      source++;
+    }
+
+  /* Re-compute the next timer compare event.  */
+  if (reset_compare)
+    {
+      m68hc11tim_timer_event (me, (void*) (COMPARE_EVENT));
+    }
+  if (reset_overflow)
+    {
+      m68hc11tim_timer_event (me, (void*) (OVERFLOW_EVENT| 0x100));
+    }
+  return cnt;
+}     
+
+
+const struct hw_descriptor dv_m68hc11tim_descriptor[] = {
+  { "m68hc11tim", m68hc11tim_finish },
+  { "m68hc12tim", m68hc11tim_finish },
+  { NULL },
+};
+
diff --git a/sim/m68hc11/dv-nvram.c b/sim/m68hc11/dv-nvram.c
new file mode 100644
index 0000000..1a8a91a
--- /dev/null
+++ b/sim/m68hc11/dv-nvram.c
@@ -0,0 +1,351 @@
+/*  dv-nvram.c -- Generic driver for a non volatile ram (battery saved)
+    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+    Written by Stephane Carrez (stcarrez@worldnet.fr)
+    (From a driver model Contributed by Cygnus Solutions.)
+    
+    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 "sim-main.h"
+#include "hw-main.h"
+#include "sim-assert.h"
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+
+/* DEVICE
+
+        nvram - Non Volatile Ram
+
+   
+   DESCRIPTION
+
+        Implements a generic battery saved CMOS ram. This ram device does
+        not contain any realtime clock and does not generate any interrupt.
+        The ram content is loaded from a file and saved when it is changed.
+        It is intended to be generic.
+
+   
+   PROPERTIES
+
+   reg <base> <length>
+
+        Base and size of the non-volatile ram bank.
+
+   file <path>
+
+        Path where the memory must be saved or loaded when we start.
+
+   mode {map | save-modified | save-all}
+
+        Controls how to load and save the memory content.
+
+           map            The file is mapped in memory
+           save-modified  The simulator keeps an open file descriptor to
+                          the file and saves portion of memory which are
+                          modified. 
+           save-all       The simulator saves the complete memory each time
+                          it's modified (it does not keep an open file
+                          descriptor).
+
+
+   PORTS
+
+        None.
+
+
+   NOTES
+
+        This device is independent of the Motorola 68hc11.
+
+   */
+
+
+
+/* static functions */
+
+/* Control of how to access the ram and save its content.  */
+
+enum nvram_mode
+{
+  /* Save the complete ram block each time it's changed.
+     We don't keep an open file descriptor.  This should be
+     ok for small memory banks.  */
+  NVRAM_SAVE_ALL,
+
+  /* Save only the memory bytes which are modified.
+     This mode means that we have to keep an open file
+     descriptor (O_RDWR).  It's good for middle sized memory banks.  */
+  NVRAM_SAVE_MODIFIED,
+
+  /* Map file in memory (not yet implemented).
+     This mode is suitable for large memory banks.  We don't allocate
+     a buffer to represent the ram, instead it's mapped in memory
+     with mmap.  */
+  NVRAM_MAP_FILE
+};
+
+struct nvram 
+{
+  address_word    base_address; /* Base address of ram.  */
+  unsigned        size;         /* Size of ram.  */
+  unsigned8       *data;        /* Pointer to ram memory.  */
+  const char      *file_name;   /* Path of ram file.  */
+  int             fd;           /* File description of opened ram file.  */
+  enum nvram_mode mode;         /* How load/save ram file.  */
+};
+
+
+
+/* Finish off the partially created hw device.  Attach our local
+   callbacks.  Wire up our port names etc.  */
+
+static hw_io_read_buffer_method  nvram_io_read_buffer;
+static hw_io_write_buffer_method nvram_io_write_buffer;
+
+
+
+static void
+attach_nvram_regs (struct hw *me, struct nvram *controller)
+{
+  unsigned_word attach_address;
+  int attach_space;
+  unsigned attach_size;
+  reg_property_spec reg;
+  int result, oerrno;
+
+  /* Get ram bank description (base and size).  */
+  if (hw_find_property (me, "reg") == NULL)
+    hw_abort (me, "Missing \"reg\" property");
+
+  if (!hw_find_reg_array_property (me, "reg", 0, &reg))
+    hw_abort (me, "\"reg\" property must contain one addr/size entry");
+
+  hw_unit_address_to_attach_address (hw_parent (me),
+				     &reg.address,
+				     &attach_space,
+				     &attach_address,
+				     me);
+  hw_unit_size_to_attach_size (hw_parent (me),
+			       &reg.size,
+			       &attach_size, me);
+
+  hw_attach_address (hw_parent (me), 0,
+		     attach_space, attach_address, attach_size,
+		     me);
+
+  controller->mode         = NVRAM_SAVE_ALL;
+  controller->base_address = attach_address;
+  controller->size         = attach_size;
+  controller->fd           = -1;
+  
+  /* Get the file where the ram content must be loaded/saved.  */
+  if(hw_find_property (me, "file") == NULL)
+    hw_abort (me, "Missing \"file\" property");
+  
+  controller->file_name = hw_find_string_property (me, "file");
+
+  /* Get the mode which defines how to save the memory.  */
+  if(hw_find_property (me, "mode") != NULL)
+    {
+      const char *value = hw_find_string_property (me, "mode");
+
+      if (strcmp (value, "map") == 0)
+        controller->mode = NVRAM_MAP_FILE;
+      else if (strcmp (value, "save-modified") == 0)
+        controller->mode = NVRAM_SAVE_MODIFIED;
+      else if (strcmp (value, "save-all") == 0)
+        controller->mode = NVRAM_SAVE_ALL;
+      else
+	hw_abort (me, "illegal value for mode parameter `%s': "
+                  "use map, save-modified or save-all", value);
+    }
+
+  /* Initialize the ram by loading/mapping the file in memory.
+     If the file does not exist, create and give it some content.  */
+  switch (controller->mode)
+    {
+    case NVRAM_MAP_FILE:
+      hw_abort (me, "'map' mode is not yet implemented, use 'save-modified'");
+      break;
+
+    case NVRAM_SAVE_MODIFIED:
+    case NVRAM_SAVE_ALL:
+      controller->data = (char*) hw_malloc (me, attach_size);
+      if (controller->data == 0)
+        hw_abort (me, "Not enough memory, try to use the mode 'map'");
+
+      memset (controller->data, 0, attach_size);
+      controller->fd = open (controller->file_name, O_RDWR);
+      if (controller->fd < 0)
+        {
+          controller->fd = open (controller->file_name,
+                                 O_RDWR | O_CREAT, 0644);
+          if (controller->fd < 0)
+            hw_abort (me, "Cannot open or create file '%s'",
+                      controller->file_name);
+          result = write (controller->fd, controller->data, attach_size);
+          if (result != attach_size)
+            {
+              oerrno = errno;
+              hw_free (me, controller->data);
+              close (controller->fd);
+              errno = oerrno;
+              hw_abort (me, "Failed to save the ram content");
+            }
+        }
+      else
+        {
+          result = read (controller->fd, controller->data, attach_size);
+          if (result != attach_size)
+            {
+              oerrno = errno;
+              hw_free (me, controller->data);
+              close (controller->fd);
+              errno = oerrno;
+              hw_abort (me, "Failed to load the ram content");
+            }
+        }
+      if (controller->mode == NVRAM_SAVE_ALL)
+        {
+          close (controller->fd);
+          controller->fd = -1;
+        }
+      break;
+
+    default:
+      break;
+    }
+}
+
+
+static void
+nvram_finish (struct hw *me)
+{
+  struct nvram *controller;
+
+  controller = HW_ZALLOC (me, struct nvram);
+
+  set_hw_data (me, controller);
+  set_hw_io_read_buffer (me, nvram_io_read_buffer);
+  set_hw_io_write_buffer (me, nvram_io_write_buffer);
+
+  /* Attach ourself to our parent bus.  */
+  attach_nvram_regs (me, controller);
+}
+
+
+
+/* generic read/write */
+
+static unsigned
+nvram_io_read_buffer (struct hw *me,
+                      void *dest,
+                      int space,
+                      unsigned_word base,
+                      unsigned nr_bytes)
+{
+  struct nvram *controller = hw_data (me);
+  
+  HW_TRACE ((me, "read 0x%08lx %d [%ld]",
+             (long) base, (int) nr_bytes,
+             (long) (base - controller->base_address)));
+
+  base -= controller->base_address;
+  if (base + nr_bytes > controller->size)
+    nr_bytes = controller->size - base;
+  
+  memcpy (dest, &controller->data[base], nr_bytes);
+  return nr_bytes;
+}
+
+
+
+static unsigned
+nvram_io_write_buffer (struct hw *me,
+                       const void *source,
+                       int space,
+                       unsigned_word base,
+                       unsigned nr_bytes)
+{
+  struct nvram *controller = hw_data (me);
+
+  HW_TRACE ((me, "write 0x%08lx %d [%ld]",
+             (long) base, (int) nr_bytes,
+             (long) (base - controller->base_address)));
+
+  base -= controller->base_address;
+  if (base + nr_bytes > controller->size)
+    nr_bytes = controller->size - base;
+  
+  switch (controller->mode)
+    {
+    case NVRAM_SAVE_ALL:
+      {
+        int fd, result, oerrno;
+        
+        fd = open (controller->file_name, O_WRONLY, 0644);
+        if (fd < 0)
+          {
+            return 0;
+          }
+
+        memcpy (&controller->data[base], source, nr_bytes);
+        result = write (fd, controller->data, controller->size);
+        oerrno = errno;
+        close (fd);
+        errno = oerrno;
+  
+        if (result != controller->size)
+          {
+            return 0;
+          }
+        return nr_bytes;
+      }
+      
+    case NVRAM_SAVE_MODIFIED:
+      {
+        off_t pos;
+        int result;
+
+        pos = lseek (controller->fd, (off_t) base, SEEK_SET);
+        if (pos != (off_t) base)
+          return 0;
+
+        result = write (controller->fd, source, nr_bytes);
+        if (result < 0)
+          return 0;
+
+        nr_bytes = result;
+        break;
+      }
+
+    default:
+      break;
+    }
+  memcpy (&controller->data[base], source, nr_bytes);
+  return nr_bytes;
+}
+
+
+const struct hw_descriptor dv_nvram_descriptor[] = {
+  { "nvram", nvram_finish, },
+  { NULL },
+};
+
diff --git a/sim/m68hc11/emulos.c b/sim/m68hc11/emulos.c
new file mode 100644
index 0000000..bb9f27b
--- /dev/null
+++ b/sim/m68hc11/emulos.c
@@ -0,0 +1,161 @@
+/* emulos.c -- Small OS emulation
+   Copyright 1999, 2000 Free Software Foundation, Inc.
+   Written by Stephane Carrez (stcarrez@worldnet.fr)
+
+This file is part of GDB, GAS, and the GNU binutils.
+
+GDB, GAS, and the GNU binutils are free software; you can redistribute
+them and/or modify them under the terms of the GNU General Public
+License as published by the Free Software Foundation; either version
+1, or (at your option) any later version.
+
+GDB, GAS, and the GNU binutils are distributed in the hope that they
+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 file; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include "sim-main.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifndef WIN32
+#include <sys/types.h>
+#include <sys/time.h>
+
+/* This file emulates some OS system calls.
+   It's basically used to give access to the host OS facilities
+   like: stdin, stdout, files, time of day.  */
+static int bench_mode = -1;
+static struct timeval bench_start;
+static struct timeval bench_stop;
+
+void
+emul_bench (struct _sim_cpu* cpu)
+{
+  int op;
+
+  op = cpu_get_d (cpu);
+  switch (op)
+    {
+    case 0:
+      bench_mode = 0;
+      gettimeofday (&bench_start, 0);
+      break;
+
+    case 1:
+      gettimeofday (&bench_stop, 0);
+      if (bench_mode != 0)
+        printf ("bench start not called...\n");
+      bench_mode = 1;
+      break;
+
+    case 2:
+      {
+        int sz = 0;
+        int addr = cpu_get_x (cpu);
+        double t_start, t_stop, t;
+        char buf[1024];
+
+        op = cpu_get_y (cpu);
+        t_start = (double) (bench_start.tv_sec) * 1.0e6;
+        t_start += (double) (bench_start.tv_usec);
+        t_stop  = (double) (bench_stop.tv_sec) * 1.0e6;
+        t_stop  += (double) (bench_stop.tv_usec);
+        
+        while (sz < 1024)
+          {
+            buf[sz] = memory_read8 (cpu, addr);
+            if (buf[sz] == 0)
+              break;
+
+            sz ++;
+            addr++;
+          }
+        buf[1023] = 0;
+
+        if (bench_mode != 1)
+          printf ("bench_stop not called");
+
+        bench_mode = -1;
+        t = t_stop - t_start;
+        printf ("%-40.40s [%6d] %3.3f us\n", buf,
+                op, t / (double) (op));
+        break;
+      }
+    }
+}
+#endif
+
+void
+emul_write(struct _sim_cpu* state)
+{
+  int addr = cpu_get_x (state) & 0x0FFFF;
+  int size = cpu_get_d (state) & 0x0FFFF;
+
+  if (addr + size > 0x0FFFF) {
+    size = 0x0FFFF - addr;
+  }
+  state->cpu_running = 0;
+  while (size)
+    {
+      uint8 val = memory_read8 (state, addr);
+        
+      write(0, &val, 1);
+      addr ++;
+      size--;
+    }
+}
+
+/* emul_exit () is used by the default startup code of GCC to implement
+   the exit ().  For a real target, this will create an ILLEGAL fault.
+   But doing an exit () on a real target is really a non-sense.
+   exit () is important for the validation of GCC.  The exit status
+   is passed in 'D' register.  */
+void
+emul_exit (sim_cpu *cpu)
+{
+  sim_engine_halt (CPU_STATE (cpu), cpu,
+		   NULL, NULL_CIA, sim_exited,
+		   cpu_get_d (cpu));
+}
+
+void
+emul_os (int code, sim_cpu *proc)
+{
+  proc->cpu_current_cycle = 8;
+  switch (code)
+    {
+    case 0x0:
+      break;
+
+      /* 0xCD 0x01 */
+    case 0x01:
+      emul_write (proc);
+      break;
+
+      /* 0xCD 0x02 */
+    case 0x02:
+      break;
+
+      /* 0xCD 0x03 */
+    case 0x03:
+      emul_exit (proc);
+      break;
+
+      /* 0xCD 0x04 */
+    case 0x04:
+#ifndef WIN32
+      emul_bench (proc);
+#endif
+      break;
+        
+    default:
+      break;
+    }
+}
+
diff --git a/sim/m68hc11/gencode.c b/sim/m68hc11/gencode.c
new file mode 100644
index 0000000..a5bff86
--- /dev/null
+++ b/sim/m68hc11/gencode.c
@@ -0,0 +1,1484 @@
+/* gencode.c -- Motorola 68hc11 Emulator Generator
+   Copyright 1999, 2000 Free Software Foundation, Inc.
+   Written by Stephane Carrez (stcarrez@worldnet.fr)
+
+This file is part of GDB, GAS, and the GNU binutils.
+
+GDB, GAS, and the GNU binutils are free software; you can redistribute
+them and/or modify them 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, GAS, and the GNU binutils are distributed in the hope that they
+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 <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <errno.h>
+
+#include "ansidecl.h"
+#include "opcode/m68hc11.h"
+
+#define TABLE_SIZE(X)	    (sizeof(X) / sizeof(X[0]))
+
+/* Combination of CCR flags.  */
+#define M6811_ZC_BIT	M6811_Z_BIT|M6811_C_BIT
+#define M6811_NZ_BIT	M6811_N_BIT|M6811_Z_BIT
+#define M6811_NZV_BIT	M6811_N_BIT|M6811_Z_BIT|M6811_V_BIT
+#define M6811_NVC_BIT	M6811_N_BIT|M6811_V_BIT|M6811_C_BIT
+#define M6811_ZVC_BIT	M6811_Z_BIT|M6811_V_BIT|M6811_C_BIT
+#define M6811_NZVC_BIT	M6811_ZVC_BIT|M6811_N_BIT
+#define M6811_HNZVC_BIT M6811_NZVC_BIT|M6811_H_BIT
+
+/* Flags when the insn only changes some CCR flags.  */
+#define CHG_NONE	0,0,0
+#define CHG_Z		0,0,M6811_Z_BIT
+#define CHG_C		0,0,M6811_C_BIT
+#define CHG_ZVC		0,0,M6811_ZVC_BIT
+#define CHG_NZV		0,0,M6811_NZV_BIT
+#define CHG_NZVC	0,0,M6811_NZVC_BIT
+#define CHG_HNZVC	0,0,M6811_HNZVC_BIT
+#define CHG_ALL		0,0,0xff
+
+/* The insn clears and changes some flags.  */
+#define CLR_I		0,M6811_I_BIT,0
+#define CLR_C		0,M6811_C_BIT,0
+#define CLR_V		0,M6811_V_BIT,0
+#define CLR_V_CHG_ZC	0,M6811_V_BIT,M6811_ZC_BIT
+#define CLR_V_CHG_NZ	0,M6811_V_BIT,M6811_NZ_BIT
+#define CLR_V_CHG_ZVC	0,M6811_V_BIT,M6811_ZVC_BIT
+#define CLR_N_CHG_ZVC	0,M6811_N_BIT,M6811_ZVC_BIT /* Used by lsr */
+
+/* The insn sets some flags.  */
+#define SET_I		M6811_I_BIT,0,0
+#define SET_C		M6811_C_BIT,0,0
+#define SET_V		M6811_V_BIT,0,0
+#define SET_Z_CLR_NVC	M6811_Z_BIT,M6811_NVC_BIT,0
+#define SET_C_CLR_V_CHG_NZ M6811_C_BIT,M6811_V_BIT,M6811_NZ_BIT
+
+#define _M 0xff
+
+
+struct m6811_opcode_pattern 
+{
+  const char *name;
+  const char *pattern;
+  const char *ccr_update;
+};
+
+/*
+ *  { "test", M6811_OP_NONE, 1, 0x00, 5, _M,  CHG_NONE },
+ * Name -+					 +---- Insn CCR changes
+ * Format  ------+			   +---------- Max # cycles
+ * Size	    -----------------+	      +--------------- Min # cycles
+ *				 +-------------------- Opcode
+ */
+struct m6811_opcode_pattern m6811_opcode_patterns[] = {
+  /* Move 8 and 16 bits.  We need two implementations: one that sets the
+     flags and one that preserve them.	*/
+  { "movtst8",	"dst8 = src8",	 "cpu_ccr_update_tst8 (proc, dst8)" },
+  { "movtst16", "dst16 = src16", "cpu_ccr_update_tst16 (proc, dst16)" },
+  { "mov8",	"dst8 = src8" },
+  { "mov16",	"dst16 = src16" },
+
+  /* Conditional branches.  'addr' is the address of the branch.  */
+  { "bra", "cpu_set_pc (proc, addr)" },
+  { "bhi",
+   "if ((cpu_get_ccr (proc) & (M6811_C_BIT|M6811_Z_BIT)) == 0)\n@ \
+     cpu_set_pc (proc, addr)" },
+  { "bls",
+    "if ((cpu_get_ccr (proc) & (M6811_C_BIT|M6811_Z_BIT)))\n@ \
+     cpu_set_pc (proc, addr)" },
+  { "bcc", "if (!cpu_get_ccr_C (proc))\n@ cpu_set_pc (proc, addr)" },
+  { "bcs", "if (cpu_get_ccr_C (proc))\n@ cpu_set_pc (proc, addr)" },
+  { "bne", "if (!cpu_get_ccr_Z (proc))\n@ cpu_set_pc (proc, addr)" },
+  { "beq", "if (cpu_get_ccr_Z (proc))\n@ cpu_set_pc (proc, addr)" },
+  { "bvc", "if (!cpu_get_ccr_V (proc))\n@ cpu_set_pc (proc, addr)" },
+  { "bvs", "if (cpu_get_ccr_V (proc))\n@ cpu_set_pc (proc, addr)" },
+  { "bpl", "if (!cpu_get_ccr_N (proc))\n@ cpu_set_pc (proc, addr)" },
+  { "bmi", "if (cpu_get_ccr_N (proc))\n@ cpu_set_pc (proc, addr)" },
+  { "bge", "if ((cpu_get_ccr_N (proc) ^ cpu_get_ccr_V (proc)) == 0)\n@ cpu_set_pc (proc, addr)" },
+  { "blt", "if ((cpu_get_ccr_N (proc) ^ cpu_get_ccr_V (proc)))\n@ cpu_set_pc (proc, addr)" },
+  { "bgt",
+    "if ((cpu_get_ccr_Z (proc) | (cpu_get_ccr_N (proc) ^ cpu_get_ccr_V (proc))) == 0)\n@ \
+     cpu_set_pc (proc, addr)" },
+  { "ble",
+    "if ((cpu_get_ccr_Z (proc) | (cpu_get_ccr_N (proc) ^ cpu_get_ccr_V (proc))))\n@ \
+     cpu_set_pc (proc, addr)" },
+
+  /* brclr and brset perform a test and a conditional jump at the same
+     time.  Flags are not changed.  */
+  { "brclr8",
+    "if ((src8 & dst8) == 0)\n@	 cpu_set_pc (proc, addr)" },
+  { "brset8",
+    "if (((~src8) & dst8) == 0)\n@  cpu_set_pc (proc, addr)" },
+  
+
+  { "rts",  "addr = cpu_pop_uint16 (proc); cpu_set_pc (proc, addr); cpu_return(proc)" },
+
+  { "mul16", "dst16 = ((uint16) src8 & 0x0FF) * ((uint16) dst8 & 0x0FF)",
+    "cpu_set_ccr_C (proc, src8 & 0x80)" },
+  { "neg8", "dst8 = - src8",
+    "cpu_set_ccr_C (proc, src8 == 0); cpu_ccr_update_tst8 (proc, dst8)" },
+  { "com8", "dst8 = ~src8",
+    "cpu_set_ccr_C (proc, 1); cpu_ccr_update_tst8 (proc, dst8);" },
+  { "clr8", "dst8 = 0",
+    "cpu_set_ccr (proc, (cpu_get_ccr (proc) & (M6811_S_BIT|M6811_X_BIT|M6811_H_BIT| \
+M6811_I_BIT)) | M6811_Z_BIT)"},
+  { "clr16","dst16 = 0",
+    "cpu_set_ccr (proc, (cpu_get_ccr (proc) & (M6811_S_BIT|M6811_X_BIT|M6811_H_BIT| \
+M6811_I_BIR)) | M6811_Z_BIT)"},
+
+  /* 8-bits shift and rotation.	 */
+  { "lsr8",  "dst8 = src8 >> 1",
+    "cpu_set_ccr_C (proc, src8 & 1); cpu_ccr_update_shift8 (proc, dst8)" },
+  { "lsl8",  "dst8 = src8 << 1",
+    "cpu_set_ccr_C (proc, (src8 & 0x80) >> 7); cpu_ccr_update_shift8 (proc, dst8)" },
+  { "asr8",  "dst8 = (src8 >> 1) | (src8 & 0x80)",
+    "cpu_set_ccr_C (proc, src8 & 1); cpu_ccr_update_shift8 (proc, dst8)" },
+  { "ror8",  "dst8 = (src8 >> 1) | (cpu_get_ccr_C (proc) << 7)",
+    "cpu_set_ccr_C (proc, src8 & 1); cpu_ccr_update_shift8 (proc, dst8)" },
+  { "rol8",  "dst8 = (src8 << 1) | (cpu_get_ccr_C (proc))",
+    "cpu_set_ccr_C (proc, (src8 & 0x80) >> 7); cpu_ccr_update_shift8 (proc, dst8)" },
+
+  /* 16-bits shift instructions.  */
+  { "lsl16",  "dst16 = src16 << 1",
+    "cpu_set_ccr_C (proc, (src16&0x8000) >> 15); cpu_ccr_update_shift16 (proc, dst16)"},
+  { "lsr16",  "dst16 = src16 >> 1",
+    "cpu_set_ccr_C (proc, src16 & 1); cpu_ccr_update_shift16 (proc, dst16)"},
+
+  { "dec8", "dst8 = src8 - 1", "cpu_ccr_update_tst8 (proc, dst8)" },
+  { "inc8", "dst8 = src8 + 1", "cpu_ccr_update_tst8 (proc, dst8)" },
+  { "tst8", 0, "cpu_set_ccr_C (proc, 0); cpu_ccr_update_tst8 (proc, src8)" },
+
+  { "sub8", "cpu_ccr_update_sub8 (proc, dst8 - src8, dst8, src8);\
+dst8 = dst8 - src8", 0 },
+  { "add8", "cpu_ccr_update_add8 (proc, dst8 + src8, dst8, src8);\
+dst8 = dst8 + src8", 0 },
+  { "sbc8", "if (cpu_get_ccr_C (proc))\n@ \
+{\n\
+  cpu_ccr_update_sub8 (proc, dst8 - src8 - 1, dst8, src8);\n\
+  dst8 = dst8 - src8 - 1;\n\
+}\n\
+else\n\
+{\n\
+  cpu_ccr_update_sub8 (proc, dst8 - src8, dst8, src8);\n\
+  dst8 = dst8 - src8;\n\
+}", 0 },
+  { "adc8", "if (cpu_get_ccr_C (proc))\n@ \
+{\n\
+  cpu_ccr_update_add8 (proc, dst8 + src8 + 1, dst8, src8);\n\
+  dst8 = dst8 + src8 + 1;\n\
+}\n\
+else\n\
+{\n\
+  cpu_ccr_update_add8 (proc, dst8 + src8, dst8, src8);\n\
+  dst8 = dst8 + src8;\n\
+}",
+    0 },
+
+  /* 8-bits logical operations.	 */
+  { "and8", "dst8 = dst8 & src8", "cpu_ccr_update_tst8 (proc, dst8)" },
+  { "eor8", "dst8 = dst8 ^ src8", "cpu_ccr_update_tst8 (proc, dst8)" },
+  { "or8",  "dst8 = dst8 | src8", "cpu_ccr_update_tst8 (proc, dst8)" },
+  { "bclr8","dst8 = (~dst8) & src8", "cpu_ccr_update_tst8 (proc, dst8)" },
+
+  /* 16-bits add and subtract instructions.  */
+  { "sub16", "cpu_ccr_update_sub16 (proc, dst16 - src16, dst16, src16);\
+dst16 = dst16 - src16", 0 },
+  { "add16", "cpu_ccr_update_add16 (proc, dst16 + src16, dst16, src16);\
+dst16 = dst16 + src16", 0 },
+  { "inc16", "dst16 = src16 + 1", "cpu_set_ccr_Z (proc, dst16 == 0)" },
+  { "dec16", "dst16 = src16 - 1", "cpu_set_ccr_Z (proc, dst16 == 0)" },
+
+  /* Special increment/decrement for the stack pointer:
+     flags are not changed.  */
+  { "ins16", "dst16 = src16 + 1" },
+  { "des16", "dst16 = src16 - 1" },
+  
+  { "jsr16", "cpu_push_uint16 (proc, cpu_get_pc (proc)); cpu_call (proc, addr)"},
+
+  /* xgdx and xgdx patterns. Flags are not changed.  */
+  { "xgdxy16", "dst16 = cpu_get_d (proc); cpu_set_d (proc, src16)"},
+  { "stop", ""},
+
+  /* tsx, tsy, txs, tys don't affect the flags.	 Sp value is corrected
+     by +/- 1.	*/
+  { "tsxy16", "dst16 = src16 + 1;"},
+  { "txys16", "dst16 = src16 - 1;"},
+
+  /* Add b to X or Y with an unsigned extension 8->16.	Flags not changed.  */
+  { "abxy16","dst16 = dst16 + (uint16) src8"},
+
+  /* After 'daa', the Z flag is undefined. Mark it as changed.	*/
+  { "daa8",  "" },
+  { "nop",  0 },
+
+
+  /* Integer divide:
+     (parallel (set IX (div D IX))
+	       (set D  (mod D IX)))  */
+  { "idiv16", "if (src16 == 0)\n{\n\
+dst16 = 0xffff;\
+}\nelse\n{\n\
+cpu_set_d (proc, dst16 % src16);\
+dst16 = dst16 / src16;\
+}",
+  "cpu_set_ccr_Z (proc, dst16 == 0); cpu_set_ccr_V (proc, 0);\
+cpu_set_ccr_C (proc, src16 == 0)" },
+
+  /* Fractional divide:
+     (parallel (set IX (div (mul D 65536) IX)
+	       (set D  (mod (mul D 65536) IX))))  */
+  { "fdiv16", "if (src16 <= dst16 )\n{\n\
+dst16 = 0xffff;\n\
+cpu_set_ccr_Z (proc, 0);\n\
+cpu_set_ccr_V (proc, 1);\n\
+cpu_set_ccr_C (proc, dst16 == 0);\n\
+}\nelse\n{\n\
+unsigned long l = (unsigned long) (dst16) << 16;\n\
+cpu_set_d (proc, (uint16) (l % (unsigned long) (src16)));\n\
+dst16 = (uint16) (l / (unsigned long) (src16));\n\
+cpu_set_ccr_V (proc, 0);\n\
+cpu_set_ccr_C (proc, 0);\n\
+cpu_set_ccr_Z (proc, dst16 == 0);\n\
+}", 0 },
+
+  /* Operations to get/set the CCR.  */
+  { "clv",  0, "cpu_set_ccr_V (proc, 0)" },
+  { "sev",  0, "cpu_set_ccr_V (proc, 1)" },
+  { "clc",  0, "cpu_set_ccr_C (proc, 0)" },
+  { "sec",  0, "cpu_set_ccr_C (proc, 1)" },
+  { "cli",  0, "cpu_set_ccr_I (proc, 0)" },
+  { "sei",  0, "cpu_set_ccr_I (proc, 1)" },
+
+  /* Some special instructions are implemented by 'cpu_special'.  */
+  { "rti",  "cpu_special (proc, M6811_RTI)" },
+  { "wai",  "cpu_special (proc, M6811_WAI)" },
+  { "test", "cpu_special (proc, M6811_TEST)" },
+  { "swi",  "cpu_special (proc, M6811_SWI)" },
+  { "syscall","cpu_special (proc, M6811_EMUL_SYSCALL)" },
+
+  { "page2", "cpu_page2_interp (proc)", 0 },
+  { "page3", "cpu_page3_interp (proc)", 0 },
+  { "page4", "cpu_page4_interp (proc)", 0 }
+};
+
+/* Definition of an opcode of the 68HC11.  */
+struct m6811_opcode_def
+{
+  const char	 *name;
+  const char	 *operands;
+  const char	 *insn_pattern;
+  unsigned char	 insn_size;
+  unsigned char	 insn_code;
+  unsigned char	 insn_min_cycles;
+  unsigned char	 insn_max_cycles;
+  unsigned char	 set_flags_mask;
+  unsigned char	 clr_flags_mask;
+  unsigned char	 chg_flags_mask;
+};
+
+
+/*
+ *  { "dex", "x->x", "dec16", 1, 0x00, 5, _M,  CHG_NONE },
+ * Name -+					 +----- Insn CCR changes
+ * Operands  ---+			  +------------ Max # cycles
+ * Pattern   -----------+	       +--------------- Min # cycles
+ * Size	     -----------------+	  +-------------------- Opcode
+ *
+ * Operands   Fetch operand		Save result
+ * -------    --------------		------------
+ * x->x	      src16 = x			x = dst16
+ * d->d	      src16 = d			d = dst16
+ * b,a->a     src8 = b dst8 = a		a = dst8
+ * sp->x      src16 = sp		x = dst16
+ * (sp)->a    src8 = pop8		a = dst8
+ * a->(sp)    src8 = a			push8 dst8
+ * (x)->(x)   src8 = (IND, X)		(IND, X) = dst8
+ * (y)->a     src8 = (IND, Y)		a = dst8
+ * ()->b      src8 = (EXT)		b = dst8
+ */
+const struct m6811_opcode_def m6811_page1_opcodes[] = {
+  { "test", 0,		0,	     1, 0x00,  5, _M,  CHG_NONE },
+  { "nop",  0,		0,	     1, 0x01,  2,  2,  CHG_NONE },
+  { "idiv", "x,d->x",	"idiv16",    1, 0x02,  3, 41,  CLR_V_CHG_ZC},
+  { "fdiv", "x,d->x",	"fdiv16",    1, 0x03,  3, 41,  CHG_ZVC},
+  { "lsrd", "d->d",	"lsr16",     1, 0x04,  3,  3,  CLR_N_CHG_ZVC },
+  { "asld", "d->d",	"lsl16",     1, 0x05,  3,  3,  CHG_NZVC },
+  { "lsld", "d->d",	"lsl16",     1, 0x05,  3,  3,  CHG_NZVC },
+  { "tap",  "a->ccr",	"mov8",	     1, 0x06,  2,  2,  CHG_ALL},
+  { "tpa",  "ccr->a",	"mov8",	     1, 0x07,  2,  2,  CHG_NONE },
+  { "inx",  "x->x",	"inc16",     1, 0x08,  3,  3,  CHG_Z },
+  { "dex",  "x->x",	"dec16",     1, 0x09,  3,  3,  CHG_Z },
+  { "clv",  0,		0,	     1, 0x0a,  2,  2,  CLR_V },
+  { "sev",  0,		0,	     1, 0x0b,  2,  2,  SET_V },
+  { "clc",  0,		0,	     1, 0x0c,  2,  2,  CLR_C },
+  { "sec",  0,		0,	     1, 0x0d,  2,  2,  SET_C },
+  { "cli",  0,		0,	     1, 0x0e,  2,  2,  CLR_I },
+  { "sei",  0,		0,	     1, 0x0f,  2,  2,  SET_I },
+  { "sba",  "b,a->a",	"sub8",	     1, 0x10,  2,  2,  CHG_NZVC },
+  { "cba",  "b,a",	"sub8",	     1, 0x11,  2,  2,  CHG_NZVC },
+  { "brset","*,#,r",	"brset8",    4, 0x12,  6,  6, CHG_NONE },
+  { "brclr","*,#,r",	"brclr8",    4, 0x13,  6,  6, CHG_NONE },
+  { "bset", "*,#->*",	"or8",	     3, 0x14,  6,  6, CLR_V_CHG_NZ },
+  { "bclr", "*,#->*",	"bclr8",     3, 0x15,  6,  6, CLR_V_CHG_NZ },
+  { "tab",  "a->b",	"movtst8",   1, 0x16,  2,  2, CLR_V_CHG_NZ },
+  { "tba",  "b->a",	"movtst8",   1, 0x17,  2,  2, CLR_V_CHG_NZ },
+  { "page2", 0,		"page2",     1, 0x18,  0,  0, CHG_NONE },
+  { "page3", 0,		"page3",     1, 0x1a,  0,  0, CHG_NONE },
+
+  /* After 'daa', the Z flag is undefined.  Mark it as changed.	 */
+  { "daa",  "a->a",	"daa8",	     1, 0x19,  2,  2, CHG_NZVC },
+  { "aba",  "b,a->a",	"add8",	     1, 0x1b,  2,  2, CHG_HNZVC},
+  { "bset", "(x),#->(x)","or8",	     3, 0x1c,  7,  7, CLR_V_CHG_NZ },
+  { "bclr", "(x),#->(x)","bclr8",    3, 0x1d,  7,  7, CLR_V_CHG_NZ },
+  { "brset","(x),#,r",	"brset8",    4, 0x1e,  7,  7, CHG_NONE },
+  { "brclr","(x),#,r",	"brclr8",    4, 0x1f,  7,  7, CHG_NONE },
+
+  /* Relative branch.  All of them take 3 bytes.  Flags not changed.  */
+  { "bra",  "r",	0,	     2, 0x20,  3,  3, CHG_NONE },
+  { "brn",  "r",	"nop",	     2, 0x21,  3,  3, CHG_NONE },
+  { "bhi",  "r",	0,	     2, 0x22,  3,  3, CHG_NONE },
+  { "bls",  "r",	0,	     2, 0x23,  3,  3, CHG_NONE },
+  { "bcc",  "r",	0,	     2, 0x24,  3,  3, CHG_NONE },
+  { "bhs",  "r",	0,	     2, 0x24,  3,  3, CHG_NONE },
+  { "bcs",  "r",	0,	     2, 0x25,  3,  3, CHG_NONE },
+  { "blo",  "r",	0,	     2, 0x25,  3,  3, CHG_NONE },
+  { "bne",  "r",	0,	     2, 0x26,  3,  3, CHG_NONE },
+  { "beq",  "r",	0,	     2, 0x27,  3,  3, CHG_NONE },
+  { "bvc",  "r",	0,	     2, 0x28,  3,  3, CHG_NONE },
+  { "bvs",  "r",	0,	     2, 0x29,  3,  3, CHG_NONE },
+  { "bpl",  "r",	0,	     2, 0x2a,  3,  3, CHG_NONE },
+  { "bmi",  "r",	0,	     2, 0x2b,  3,  3, CHG_NONE },
+  { "bge",  "r",	0,	     2, 0x2c,  3,  3, CHG_NONE },
+  { "blt",  "r",	0,	     2, 0x2d,  3,  3, CHG_NONE },
+  { "bgt",  "r",	0,	     2, 0x2e,  3,  3, CHG_NONE },
+  { "ble",  "r",	0,	     2, 0x2f,  3,  3, CHG_NONE },
+
+  { "tsx",  "sp->x",	"tsxy16",    1, 0x30,  3,  3, CHG_NONE },
+  { "ins",  "sp->sp",	"ins16",     1, 0x31,  3,  3, CHG_NONE },
+  { "pula", "(sp)->a",	"mov8",	     1, 0x32,  4,  4, CHG_NONE },
+  { "pulb", "(sp)->b",	"mov8",	     1, 0x33,  4,  4, CHG_NONE },
+  { "des",  "sp->sp",	"des16",     1, 0x34,  3,  3, CHG_NONE },
+  { "txs",  "x->sp",	"txys16",    1, 0x35,  3,  3, CHG_NONE },
+  { "psha", "a->(sp)",	"mov8",	     1, 0x36,  3,  3, CHG_NONE },
+  { "pshb", "b->(sp)",	"mov8",	     1, 0x37,  3,  3, CHG_NONE },
+  { "pulx", "(sp)->x",	"mov16",     1, 0x38,  5,  5, CHG_NONE },
+  { "rts",  0,		0,	     1, 0x39,  5,  5, CHG_NONE },
+  { "abx",  "b,x->x",	"abxy16",    1, 0x3a,  3,  3, CHG_NONE },
+  { "rti",  0,		0,	     1, 0x3b, 12, 12, CHG_ALL},
+  { "pshx", "x->(sp)",	"mov16",     1, 0x3c,  4,  4, CHG_NONE },
+  { "mul",  "b,a->d",	"mul16",     1, 0x3d,  3, 10, CHG_C },
+  { "wai",  0,		0,	     1, 0x3e, 14, _M, CHG_NONE },
+  { "swi",  0,		0,	     1, 0x3f, 14, _M, CHG_NONE },
+  { "nega", "a->a",	"neg8",	     1, 0x40,  2,  2, CHG_NZVC },
+  { "syscall", "",	"syscall",   1, 0x41,  2,  2, CHG_NONE },
+  { "coma", "a->a",	"com8",	     1, 0x43,  2,  2, SET_C_CLR_V_CHG_NZ },
+  { "lsra", "a->a",	"lsr8",	     1, 0x44,  2,  2, CLR_N_CHG_ZVC},
+  { "rora", "a->a",	"ror8",	     1, 0x46,  2,  2, CHG_NZVC },
+  { "asra", "a->a",	"asr8",	     1, 0x47,  2,  2, CHG_NZVC },
+  { "asla", "a->a",	"lsl8",	     1, 0x48,  2,  2, CHG_NZVC },
+  { "lsla", "a->a",	"lsl8",	     1, 0x48,  2,  2, CHG_NZVC },
+  { "rola", "a->a",	"rol8",	     1, 0x49,  2,  2, CHG_NZVC },
+  { "deca", "a->a",	"dec8",	     1, 0x4a,  2,  2, CHG_NZV },
+  { "inca", "a->a",	"inc8",	     1, 0x4c,  2,  2, CHG_NZV },
+  { "tsta", "a",	"tst8",	     1, 0x4d,  2,  2, CLR_V_CHG_NZ },
+  { "clra", "->a",	"clr8",	     1, 0x4f,  2,  2, SET_Z_CLR_NVC },
+  { "negb", "b->b",	"neg8",	     1, 0x50,  2,  2, CHG_NZVC },
+  { "comb", "b->b",	"com8",	     1, 0x53,  2,  2, SET_C_CLR_V_CHG_NZ },
+  { "lsrb", "b->b",	"lsr8",	     1, 0x54,  2,  2, CLR_N_CHG_ZVC },
+  { "rorb", "b->b",	"ror8",	     1, 0x56,  2,  2, CHG_NZVC },
+  { "asrb", "b->b",	"asr8",	     1, 0x57,  2,  2, CHG_NZVC },
+  { "aslb", "b->b",	"lsl8",	     1, 0x58,  2,  2, CHG_NZVC },
+  { "lslb", "b->b",	"lsl8",	     1, 0x58,  2,  2, CHG_NZVC },
+  { "rolb", "b->b",	"rol8",	     1, 0x59,  2,  2, CHG_NZVC },
+  { "decb", "b->b",	"dec8",	     1, 0x5a,  2,  2, CHG_NZV },
+  { "incb", "b->b",	"inc8",	     1, 0x5c,  2,  2, CHG_NZV },
+  { "tstb", "b",	"tst8",	     1, 0x5d,  2,  2, CLR_V_CHG_NZ },
+  { "clrb", "->b",	"clr8",	     1, 0x5f,  2,  2, SET_Z_CLR_NVC },
+  { "neg",  "(x)->(x)", "neg8",	     2, 0x60,  6,  6, CHG_NZVC },
+  { "com",  "(x)->(x)", "com8",	     2, 0x63,  6,  6, SET_C_CLR_V_CHG_NZ },
+  { "lsr",  "(x)->(x)", "lsr8",	     2, 0x64,  6,  6, CLR_N_CHG_ZVC },
+  { "ror",  "(x)->(x)", "ror8",	     2, 0x66,  6,  6, CHG_NZVC },
+  { "asr",  "(x)->(x)", "asr8",	     2, 0x67,  6,  6, CHG_NZVC },
+  { "asl",  "(x)->(x)", "lsl8",	     2, 0x68,  6,  6, CHG_NZVC },
+  { "lsl",  "(x)->(x)", "lsl8",	     2, 0x68,  6,  6, CHG_NZVC },
+  { "rol",  "(x)->(x)", "rol8",	     2, 0x69,  6,  6, CHG_NZVC },
+  { "dec",  "(x)->(x)", "dec8",	     2, 0x6a,  6,  6, CHG_NZV },
+  { "inc",  "(x)->(x)", "inc8",	     2, 0x6c,  6,  6, CHG_NZV },
+  { "tst",  "(x)",	"tst8",	     2, 0x6d,  6,  6, CLR_V_CHG_NZ },
+  { "jmp",  "&(x)",	"bra",	     2, 0x6e,  3,  3, CHG_NONE },
+  { "clr",  "->(x)",	"clr8",	     2, 0x6f,  6,  6, SET_Z_CLR_NVC },
+  { "neg",  "()->()",	"neg8",	     3, 0x70,  6,  6, CHG_NZVC },
+  { "com",  "()->()",	"com8",	     3, 0x73,  6,  6, SET_C_CLR_V_CHG_NZ },
+  { "lsr",  "()->()",	"lsr8",	     3, 0x74,  6,  6, CLR_V_CHG_ZVC },
+  { "ror",  "()->()",	"ror8",	     3, 0x76,  6,  6, CHG_NZVC },
+  { "asr",  "()->()",	"asr8",	     3, 0x77,  6,  6, CHG_NZVC },
+  { "asl",  "()->()",	"lsl8",	     3, 0x78,  6,  6, CHG_NZVC },
+  { "lsl",  "()->()",	"lsl8",	     3, 0x78,  6,  6, CHG_NZVC },
+  { "rol",  "()->()",	"rol8",	     3, 0x79,  6,  6, CHG_NZVC },
+  { "dec",  "()->()",	"dec8",	     3, 0x7a,  6,  6, CHG_NZV },
+  { "inc",  "()->()",	"inc8",	     3, 0x7c,  6,  6, CHG_NZV },
+  { "tst",  "()",	"tst8",	     3, 0x7d,  6,  6, CLR_V_CHG_NZ },
+  { "jmp",  "&()",	"bra",	     3, 0x7e,  3,  3, CHG_NONE },
+  { "clr",  "->()",	"clr8",	     3, 0x7f,  6,  6, SET_Z_CLR_NVC },
+  { "suba", "#,a->a",	"sub8",	     2, 0x80,  2,  2, CHG_NZVC },
+  { "cmpa", "#,a",	"sub8",	     2, 0x81,  2,  2, CHG_NZVC },
+  { "sbca", "#,a->a",	"sbc8",	     2, 0x82,  2,  2, CHG_NZVC },
+  { "subd", "#,d->d",	"sub16",     3, 0x83,  4,  4, CHG_NZVC },
+  { "anda", "#,a->a",	"and8",	     2, 0x84,  2,  2, CLR_V_CHG_NZ },
+  { "bita", "#,a",	"and8",	     2, 0x85,  2,  2, CLR_V_CHG_NZ },
+  { "ldaa", "#->a",	"movtst8",   2, 0x86,  2,  2, CLR_V_CHG_NZ },
+  { "eora", "#,a->a",	"eor8",	     2, 0x88,  2,  2, CLR_V_CHG_NZ },
+  { "adca", "#,a->a",	"adc8",	     2, 0x89,  2,  2, CHG_HNZVC },
+  { "oraa", "#,a->a",	"or8",	     2, 0x8a,  2,  2, CLR_V_CHG_NZ },
+  { "adda", "#,a->a",	"add8",	     2, 0x8b,  2,  2, CHG_HNZVC },
+  { "cmpx", "#,x",	"sub16",     3, 0x8c,  4,  4, CHG_NZVC },
+  { "cpx",  "#,x",	"sub16",     3, 0x8c,  4,  4, CHG_NZVC },
+  { "bsr",  "r",	"jsr16",     2, 0x8d,  6,  6, CHG_NONE },
+  { "lds",  "#->sp",	"movtst16",  3, 0x8e,  3,  3, CLR_V_CHG_NZ },
+  { "xgdx", "x->x",	"xgdxy16",   1, 0x8f,  3,  3, CHG_NONE },
+  { "suba", "*,a->a",	"sub8",	     2, 0x90,  3,  3, CHG_NZVC },
+  { "cmpa", "*,a",	"sub8",	     2, 0x91,  3,  3, CHG_NZVC },
+  { "sbca", "*,a->a",	"sbc8",	     2, 0x92,  3,  3, CHG_NZVC },
+  { "subd", "*,d->d",	"sub16",     2, 0x93,  5,  5, CHG_NZVC },
+  { "anda", "*,a->a",	"and8",	     2, 0x94,  3,  3, CLR_V_CHG_NZ },
+  { "bita", "*,a",	"and8",	     2, 0x95,  3,  3, CLR_V_CHG_NZ },
+  { "ldaa", "*->a",	"movtst8",   2, 0x96,  3,  3, CLR_V_CHG_NZ },
+  { "staa", "a->*",	"movtst8",   2, 0x97,  3,  3, CLR_V_CHG_NZ },
+  { "eora", "*,a->a",	"eor8",	     2, 0x98,  3,  3, CLR_V_CHG_NZ },
+  { "adca", "*,a->a",	"adc8",	     2, 0x99,  3,  3, CHG_HNZVC },
+  { "oraa", "*,a->a",	"or8",	     2, 0x9a,  3,  3, CLR_V_CHG_NZ },
+  { "adda", "*,a->a",	"add8",	     2, 0x9b,  3,  3, CHG_HNZVC },
+  { "cmpx", "*,x",	"sub16",     2, 0x9c,  5,  5, CHG_NZVC },
+  { "cpx",  "*,x",	"sub16",     2, 0x9c,  5,  5, CHG_NZVC },
+  { "jsr",  "*",	"jsr16",     2, 0x9d,  5,  5, CHG_NONE },
+  { "lds",  "*->sp",	"movtst16",  2, 0x9e,  4,  4, CLR_V_CHG_NZ },
+  { "sts",  "sp->*",	"movtst16",  2, 0x9f,  4,  4, CLR_V_CHG_NZ },
+  { "suba", "(x),a->a", "sub8",	     2, 0xa0,  4,  4, CHG_NZVC },
+  { "cmpa", "(x),a",	"sub8",	     2, 0xa1,  4,  4, CHG_NZVC },
+  { "sbca", "(x),a->a", "sbc8",	     2, 0xa2,  4,  4, CHG_NZVC },
+  { "subd", "(x),d->d", "sub16",     2, 0xa3,  6,  6, CHG_NZVC },
+  { "anda", "(x),a->a", "and8",	     2, 0xa4,  4,  4, CLR_V_CHG_NZ },
+  { "bita", "(x),a",	"and8",	     2, 0xa5,  4,  4, CLR_V_CHG_NZ },
+  { "ldaa", "(x)->a",	"movtst8",   2, 0xa6,  4,  4, CLR_V_CHG_NZ },
+  { "staa", "a->(x)",	"movtst8",   2, 0xa7,  4,  4, CLR_V_CHG_NZ },
+  { "eora", "(x),a->a", "eor8",	     2, 0xa8,  4,  4, CLR_V_CHG_NZ },
+  { "adca", "(x),a->a", "adc8",	     2, 0xa9,  4,  4, CHG_HNZVC },
+  { "oraa", "(x),a->a", "or8",	     2, 0xaa,  4,  4, CLR_V_CHG_NZ },
+  { "adda", "(x),a->a", "add8",	     2, 0xab,  4,  4, CHG_HNZVC },
+  { "cmpx", "(x),x",	"sub16",     2, 0xac,  6,  6, CHG_NZVC },
+  { "cpx",  "(x),x",	"sub16",     2, 0xac,  6,  6, CHG_NZVC },
+  { "jsr",  "&(x)",	"jsr16",     2, 0xad,  6,  6, CHG_NONE },
+  { "lds",  "(x)->sp",	"movtst16",  2, 0xae,  5,  5, CLR_V_CHG_NZ },
+  { "sts",  "sp->(x)",	"movtst16",  2, 0xaf,  5,  5, CLR_V_CHG_NZ },
+  { "suba", "(),a->a",	"sub8",	     3, 0xb0,  4,  4, CHG_NZVC },
+  { "cmpa", "(),a",	"sub8",	     3, 0xb1,  4,  4, CHG_NZVC },
+  { "sbca", "(),a->a",	"sbc8",	     3, 0xb2,  4,  4, CHG_NZVC },
+  { "subd", "(),d->d",	"sub16",     3, 0xb3,  6,  6, CHG_NZVC },
+  { "anda", "(),a->a",	"and8",	     3, 0xb4,  4,  4, CLR_V_CHG_NZ },
+  { "bita", "(),a",	"and8",	     3, 0xb5,  4,  4, CLR_V_CHG_NZ },
+  { "ldaa", "()->a",	"movtst8",   3, 0xb6,  4,  4, CLR_V_CHG_NZ },
+  { "staa", "a->()",	"movtst8",   3, 0xb7,  4,  4, CLR_V_CHG_NZ },
+  { "eora", "(),a->a",	"eor8",	     3, 0xb8,  4,  4, CLR_V_CHG_NZ },
+  { "adca", "(),a->a",	"adc8",	     3, 0xb9,  4,  4, CHG_HNZVC },
+  { "oraa", "(),a->a",	"or8",	     3, 0xba,  4,  4, CLR_V_CHG_NZ },
+  { "adda", "(),a->a",	"add8",	     3, 0xbb,  4,  4, CHG_HNZVC },
+  { "cmpx", "(),x",	"sub16",     3, 0xbc,  5,  5, CHG_NZVC },
+  { "cpx",  "(),x",	"sub16",     3, 0xbc,  5,  5, CHG_NZVC },
+  { "jsr",  "&()",	"jsr16",     3, 0xbd,  6,  6, CHG_NONE },
+  { "lds",  "()->sp",	"movtst16",  3, 0xbe,  5,  5, CLR_V_CHG_NZ },
+  { "sts",  "sp->()",	"movtst16",  3, 0xbf,  5,  5, CLR_V_CHG_NZ },
+  { "subb", "#,b->b",	"sub8",	     2, 0xc0,  2,  2, CHG_NZVC },
+  { "cmpb", "#,b",	"sub8",	     2, 0xc1,  2,  2, CHG_NZVC },
+  { "sbcb", "#,b->b",	"sbc8",	     2, 0xc2,  2,  2, CHG_NZVC },
+  { "addd", "#,d->d",	"add16",     3, 0xc3,  4,  4, CHG_NZVC },
+  { "andb", "#,b->b",	"and8",	     2, 0xc4,  2,  2, CLR_V_CHG_NZ },
+  { "bitb", "#,b",	"and8",	     2, 0xc5,  2,  2, CLR_V_CHG_NZ },
+  { "ldab", "#->b",	"movtst8",   2, 0xc6,  2,  2, CLR_V_CHG_NZ },
+  { "eorb", "#,b->b",	"eor8",	     2, 0xc8,  2,  2, CLR_V_CHG_NZ },
+  { "adcb", "#,b->b",	"adc8",	     2, 0xc9,  2,  2, CHG_HNZVC },
+  { "orab", "#,b->b",	"or8",	     2, 0xca,  2,  2, CLR_V_CHG_NZ },
+  { "addb", "#,b->b",	"add8",	     2, 0xcb,  2,  2, CHG_HNZVC },
+  { "ldd",  "#->d",	"movtst16",  3, 0xcc,  3,  3, CLR_V_CHG_NZ },
+  { "page4",0,		"page4",     1, 0xcd,  0,  0, CHG_NONE },
+  { "ldx",  "#->x",	"movtst16",  3, 0xce,  3,  3, CLR_V_CHG_NZ },
+  { "stop", 0,		0,	     1, 0xcf,  2,  2, CHG_NONE },
+  { "subb", "*,b->b",	"sub8",	     2, 0xd0,  3,  3, CHG_NZVC },
+  { "cmpb", "*,b",	"sub8",	     2, 0xd1,  3,  3, CHG_NZVC },
+  { "sbcb", "*,b->b",	"sbc8",	     2, 0xd2,  3,  3, CHG_NZVC },
+  { "addd", "*,d->d",	"add16",     2, 0xd3,  5,  5, CHG_NZVC },
+  { "andb", "*,b->b",	"and8",	     2, 0xd4,  3,  3, CLR_V_CHG_NZ },
+  { "bitb", "*,b",	"and8",	     2, 0xd5,  3,  3, CLR_V_CHG_NZ },
+  { "ldab", "*->b",	"movtst8",   2, 0xd6,  3,  3, CLR_V_CHG_NZ },
+  { "stab", "b->*",	"movtst8",   2, 0xd7,  3,  3, CLR_V_CHG_NZ },
+  { "eorb", "*,b->b",	"eor8",	     2, 0xd8,  3,  3, CLR_V_CHG_NZ },
+  { "adcb", "*,b->b",	"adc8",	     2, 0xd9,  3,  3, CHG_HNZVC },
+  { "orab", "*,b->b",	"or8",	     2, 0xda,  3,  3, CLR_V_CHG_NZ },
+  { "addb", "*,b->b",	"add8",	     2, 0xdb,  3,  3, CHG_HNZVC },
+  { "ldd",  "*->d",	"movtst16",  2, 0xdc,  4,  4, CLR_V_CHG_NZ },
+  { "std",  "d->*",	"movtst16",  2, 0xdd,  4,  4, CLR_V_CHG_NZ },
+  { "ldx",  "*->x",	"movtst16",  2, 0xde,  4,  4, CLR_V_CHG_NZ },
+  { "stx",  "x->*",	"movtst16",  2, 0xdf,  4,  4, CLR_V_CHG_NZ },
+  { "subb", "(x),b->b", "sub8",	     2, 0xe0,  4,  4, CHG_NZVC },
+  { "cmpb", "(x),b",	"sub8",	     2, 0xe1,  4,  4, CHG_NZVC },
+  { "sbcb", "(x),b->b", "sbc8",	     2, 0xe2,  4,  4, CHG_NZVC },
+  { "addd", "(x),d->d", "add16",     2, 0xe3,  6,  6, CHG_NZVC },
+  { "andb", "(x),b->b", "and8",	     2, 0xe4,  4,  4, CLR_V_CHG_NZ },
+  { "bitb", "(x),b",	"and8",	     2, 0xe5,  4,  4, CLR_V_CHG_NZ },
+  { "ldab", "(x)->b",	"movtst8",   2, 0xe6,  4,  4, CLR_V_CHG_NZ },
+  { "stab", "b->(x)",	"movtst8",   2, 0xe7,  4,  4, CLR_V_CHG_NZ },
+  { "eorb", "(x),b->b", "eor8",	     2, 0xe8,  4,  4, CLR_V_CHG_NZ },
+  { "adcb", "(x),b->b", "adc8",	     2, 0xe9,  4,  4, CHG_HNZVC },
+  { "orab", "(x),b->b", "or8",	     2, 0xea,  4,  4, CLR_V_CHG_NZ },
+  { "addb", "(x),b->b", "add8",	     2, 0xeb,  4,  4, CHG_HNZVC },
+  { "ldd",  "(x)->d",	"movtst16",  2, 0xec,  5,  5, CLR_V_CHG_NZ },
+  { "std",  "d->(x)",	"movtst16",  2, 0xed,  5,  5, CLR_V_CHG_NZ },
+  { "ldx",  "(x)->x",	"movtst16",  2, 0xee,  5,  5, CLR_V_CHG_NZ },
+  { "stx",  "x->(x)",	"movtst16",  2, 0xef,  5,  5, CLR_V_CHG_NZ },
+  { "subb", "(),b->b",	"sub8",	     3, 0xf0,  4,  4, CHG_NZVC },
+  { "cmpb", "(),b",	"sub8",	     3, 0xf1,  4,  4, CHG_NZVC },
+  { "sbcb", "(),b->b",	"sbc8",	     3, 0xf2,  4,  4, CHG_NZVC },
+  { "addd", "(),d->d",	"add16",     3, 0xf3,  6,  6, CHG_NZVC },
+  { "andb", "(),b->b",	"and8",	     3, 0xf4,  4,  4, CLR_V_CHG_NZ },
+  { "bitb", "(),b",	"and8",	     3, 0xf5,  4,  4, CLR_V_CHG_NZ },
+  { "ldab", "()->b",	"movtst8",   3, 0xf6,  4,  4, CLR_V_CHG_NZ },
+  { "stab", "b->()",	"movtst8",   3, 0xf7,  4,  4, CLR_V_CHG_NZ },
+  { "eorb", "(),b->b",	"eor8",	     3, 0xf8,  4,  4, CLR_V_CHG_NZ },
+  { "adcb", "(),b->b",	"eor8",	     3, 0xf9,  4,  4, CHG_HNZVC },
+  { "orab", "(),b->b",	"or8",	     3, 0xfa,  4,  4, CLR_V_CHG_NZ },
+  { "addb", "(),b->b",	"add8",	     3, 0xfb,  4,  4, CHG_HNZVC },
+  { "ldd",  "()->d",	"movtst16",  3, 0xfc,  5,  5, CLR_V_CHG_NZ },
+  { "std",  "d->()",	"movtst16",  3, 0xfd,  5,  5, CLR_V_CHG_NZ },
+  { "ldx",  "()->x",	"movtst16",  3, 0xfe,  5,  5, CLR_V_CHG_NZ },
+  { "stx",  "x->()",	"movtst16",  3, 0xff,  5,  5, CLR_V_CHG_NZ }
+};
+
+
+/* Page 2 opcodes */
+/*
+ *  { "dex", "x->x", "dec16", 1, 0x00, 5, _M,  CHG_NONE },
+ * Name -+					 +----- Insn CCR changes
+ * Operands  ---+			  +------------ Max # cycles
+ * Pattern   -----------+	       +--------------- Min # cycles
+ * Size	     -----------------+	  +-------------------- Opcode
+ */
+const struct m6811_opcode_def m6811_page2_opcodes[] = {
+  { "iny",  "y->y",	"inc16",     2, 0x08, 4, 4, CHG_Z },
+  { "dey",  "y->y",	"dec16",     2, 0x09, 4, 4, CHG_Z },
+  { "bset", "(y),#->(y)","or8",	     4, 0x1c, 8, 8, CLR_V_CHG_NZ },
+  { "bclr", "(y),#->(y)","bclr8",    4, 0x1d, 8, 8, CLR_V_CHG_NZ },
+  { "brset","(y),#,r",	 "brset8",   5, 0x1e, 8, 8, CHG_NONE },
+  { "brclr","(y),#,r",	"brclr8",    5, 0x1f, 8, 8, CHG_NONE },
+  { "tsy",  "sp->y",	"tsxy16",    2, 0x30, 4, 4, CHG_NONE },
+  { "tys",  "y->sp",	"txys16",    2, 0x35, 4, 4, CHG_NONE },
+  { "puly", "(sp)->y",	"mov16",     2, 0x38, 6, 6, CHG_NONE },
+  { "aby",  "b,y->y",	"abxy16",    2, 0x3a, 4, 4, CHG_NONE },
+  { "pshy", "y->(sp)",	"mov16",     2, 0x3c, 5, 5, CHG_NONE },
+  { "neg",  "(y)->(y)", "neg8",	     3, 0x60, 7, 7, CHG_NZVC },
+  { "com",  "(y)->(y)", "com8",	     3, 0x63, 7, 7, SET_C_CLR_V_CHG_NZ},
+  { "lsr",  "(y)->(y)", "lsr8",	     3, 0x64, 7, 7, CLR_V_CHG_ZVC },
+  { "ror",  "(y)->(y)", "ror8",	     3, 0x66, 7, 7, CHG_NZVC },
+  { "asr",  "(y)->(y)", "asr8",	     3, 0x67, 7, 7, CHG_NZVC },
+  { "asl",  "(y)->(y)", "lsl8",	     3, 0x68, 7, 7, CHG_NZVC },
+  { "lsl",  "(y)->(y)", "lsl8",	     3, 0x68, 7, 7, CHG_NZVC },
+  { "rol",  "(y)->(y)", "rol8",	     3, 0x69, 7, 7, CHG_NZVC },
+  { "dec",  "(y)->(y)", "dec8",	     3, 0x6a, 7, 7, CHG_NZV },
+  { "inc",  "(y)->(y)", "inc8",	     3, 0x6c, 7, 7, CHG_NZV },
+  { "tst",  "(y)",	"tst8",	     3, 0x6d, 7, 7, CLR_V_CHG_NZ },
+  { "jmp",  "&(y)",	"bra",	     3, 0x6e, 4, 4, CHG_NONE },
+  { "clr",  "->(y)",	"clr8",	     3, 0x6f, 7, 7, SET_Z_CLR_NVC },
+  { "cmpy", "#,y",	"sub16",     4, 0x8c, 5, 5, CHG_NZVC },
+  { "cpy",  "#,y",	"sub16",     4, 0x8c, 5, 5, CHG_NZVC },
+  { "xgdy", "y->y",	"xgdxy16",   2, 0x8f, 4, 4, CHG_NONE },
+  { "cmpy", "*,y",	"sub16",     3, 0x9c, 6, 6, CHG_NZVC },
+  { "cpy",  "*,y",	"sub16",     3, 0x9c, 6, 6, CHG_NZVC },
+  { "suba", "(y),a->a", "sub8",	     3, 0xa0, 5, 5, CHG_NZVC },
+  { "cmpa", "(y),a",	"sub8",	     3, 0xa1, 5, 5, CHG_NZVC },
+  { "sbca", "(y),a->a", "sbc8",	     3, 0xa2, 5, 5, CHG_NZVC },
+  { "subd", "(y),d->d", "sub16",     3, 0xa3, 7, 7, CHG_NZVC },
+  { "anda", "(y),a->a", "and8",	     3, 0xa4, 5, 5, CLR_V_CHG_NZ },
+  { "bita", "(y),a",	"and8",	     3, 0xa5, 5, 5, CLR_V_CHG_NZ },
+  { "ldaa", "(y)->a",	"movtst8",   3, 0xa6, 5, 5, CLR_V_CHG_NZ },
+  { "staa", "a->(y)",	"movtst8",   3, 0xa7, 5, 5, CLR_V_CHG_NZ },
+  { "eora", "(y),a->a", "eor8",	     3, 0xa8, 5, 5, CLR_V_CHG_NZ },
+  { "adca", "(y),a->a", "adc8",	     3, 0xa9, 5, 5, CHG_HNZVC },
+  { "oraa", "(y),a->a", "or8",	     3, 0xaa, 5, 5, CLR_V_CHG_NZ },
+  { "adda", "(y),a->a", "add8",	     3, 0xab, 5, 5, CHG_HNZVC },
+  { "cmpy", "(y),y",	"sub16",     3, 0xac, 7, 7, CHG_NZVC },
+  { "cpy",  "(y),y",	"sub16",     3, 0xac, 7, 7, CHG_NZVC },
+  { "jsr",  "&(y)",	"jsr16",     3, 0xad, 6, 6, CHG_NONE },
+  { "lds",  "(y)->sp",	"movtst16",  3, 0xae, 6, 6, CLR_V_CHG_NZ },
+  { "sts",  "sp->(y)",	"movtst16",  3, 0xaf, 6, 6, CLR_V_CHG_NZ },
+  { "cmpy", "(),y",	"sub16",     4, 0xbc, 7, 7, CHG_NZVC },
+  { "cpy",  "(),y",	"sub16",     4, 0xbc, 7, 7, CHG_NZVC },
+  { "ldy",  "#->y",	"movtst16",  4, 0xce, 4, 4, CLR_V_CHG_NZ },
+  { "ldy",  "*->y",	"movtst16",  3, 0xde, 5, 5, CLR_V_CHG_NZ },
+  { "sty",  "y->*",	"movtst16",  3, 0xdf, 5, 5, CLR_V_CHG_NZ },
+  { "subb", "(y),b->b", "sub8",	     3, 0xe0, 5, 5, CHG_NZVC },
+  { "cmpb", "(y),b",	"sub8",	     3, 0xe1, 5, 5, CHG_NZVC },
+  { "sbcb", "(y),b->b", "sbc8",	     3, 0xe2, 5, 5, CHG_NZVC },
+  { "addd", "(y),d->d", "add16",     3, 0xe3, 7, 7, CHG_NZVC },
+  { "andb", "(y),b->b", "and8",	     3, 0xe4, 5, 5, CLR_V_CHG_NZ },
+  { "bitb", "(y),b",	"and8",	     3, 0xe5, 5, 5, CLR_V_CHG_NZ },
+  { "ldab", "(y)->b",	"movtst8",   3, 0xe6, 5, 5, CLR_V_CHG_NZ },
+  { "stab", "b->(y)",	"movtst8",   3, 0xe7, 5, 5, CLR_V_CHG_NZ },
+  { "eorb", "(y),b->b", "eor8",	     3, 0xe8, 5, 5, CLR_V_CHG_NZ },
+  { "adcb", "(y),b->b", "adc8",	     3, 0xe9, 5, 5, CHG_HNZVC },
+  { "orab", "(y),b->b", "or8",	     3, 0xea, 5, 5, CLR_V_CHG_NZ },
+  { "addb", "(y),b->b", "add8",	     3, 0xeb, 5, 5, CHG_HNZVC },
+  { "ldd",  "(y)->d",	"movtst16",  3, 0xec, 6, 6, CLR_V_CHG_NZ },
+  { "std",  "d->(y)",	"movtst16",  3, 0xed, 6, 6, CLR_V_CHG_NZ },
+  { "ldy",  "(y)->y",	"movtst16",  3, 0xee, 6, 6, CLR_V_CHG_NZ },
+  { "sty",  "y->(y)",	"movtst16",  3, 0xef, 6, 6, CLR_V_CHG_NZ },
+  { "ldy",  "()->y",	"movtst16",  4, 0xfe, 6, 6, CLR_V_CHG_NZ },
+  { "sty",  "y->()",	"movtst16",  4, 0xff, 6, 6, CLR_V_CHG_NZ }
+};
+
+/* Page 3 opcodes */
+/*
+ *  { "dex", "x->x", "dec16", 1, 0x00, 5, _M,  CHG_NONE },
+ * Name -+					 +----- Insn CCR changes
+ * Operands  ---+			  +------------ Max # cycles
+ * Pattern   -----------+	       +--------------- Min # cycles
+ * Size	     -----------------+	  +-------------------- Opcode
+ */
+const struct m6811_opcode_def m6811_page3_opcodes[] = {
+  { "cmpd", "#,d",	"sub16",     4, 0x83, 5, 5, CHG_NZVC },
+  { "cpd",  "#,d",	"sub16",     4, 0x83, 5, 5, CHG_NZVC },
+  { "cmpd", "*,d",	"sub16",     3, 0x93, 6, 6, CHG_NZVC },
+  { "cpd",  "*,d",	"sub16",     3, 0x93, 6, 6, CHG_NZVC },
+  { "cmpd", "(x),d",	"sub16",     3, 0xa3, 7, 7, CHG_NZVC },
+  { "cpd",  "(x),d",	"sub16",     3, 0xa3, 7, 7, CHG_NZVC },
+  { "cmpy", "(x),y",	"sub16",     3, 0xac, 7, 7, CHG_NZVC },
+  { "cpy",  "(x),y",	"sub16",     3, 0xac, 7, 7, CHG_NZVC },
+  { "cmpd", "(),d",	"sub16",     4, 0xb3, 7, 7, CHG_NZVC },
+  { "cpd",  "(),d",	"sub16",     4, 0xb3, 7, 7, CHG_NZVC },
+  { "ldy",  "(x)->y",	"movtst16",  3, 0xee, 6, 6, CLR_V_CHG_NZ },
+  { "sty",  "y->(x)",	"movtst16",  3, 0xef, 6, 6, CLR_V_CHG_NZ }
+};
+
+/* Page 4 opcodes */
+/*
+ *  { "dex", "x->x", "dec16", 1, 0x00, 5, _M,  CHG_NONE },
+ * Name -+					 +----- Insn CCR changes
+ * Operands  ---+			  +------------ Max # cycles
+ * Pattern   -----------+	       +--------------- Min # cycles
+ * Size	     -----------------+	  +-------------------- Opcode
+ */
+const struct m6811_opcode_def m6811_page4_opcodes[] = {
+  { "syscall", "",	"syscall",   2, 0x03, 6, 6, CHG_NONE },
+  { "cmpd", "(y),d",	"sub16",     3, 0xa3, 7, 7, CHG_NZVC },
+  { "cpd",  "(y),d",	"sub16",     3, 0xa3, 7, 7, CHG_NZVC },
+  { "cmpx", "(y),x",	"sub16",     3, 0xac, 7, 7, CHG_NZVC },
+  { "cpx",  "(y),x",	"sub16",     3, 0xac, 7, 7, CHG_NZVC },
+  { "ldx",  "(y)->x",	"movtst16",  3, 0xee, 6, 6, CLR_V_CHG_NZ },
+  { "stx",  "x->(y)",	"movtst16",  3, 0xef, 6, 6, CLR_V_CHG_NZ }
+};
+
+void fatal_error (const struct m6811_opcode_def*, const char*);
+void print (FILE*, int, const char*,...);
+int gen_fetch_operands (FILE*, int, const struct m6811_opcode_def*,
+			const char*);
+void gen_save_result (FILE*, int, const struct m6811_opcode_def*,
+		      int, const char*);
+const struct m6811_opcode_pattern*
+find_opcode_pattern (const struct m6811_opcode_def*);
+void gen_interp (FILE*, int, const struct m6811_opcode_def*);
+void gen_interpreter_for_table (FILE*, int,
+				const struct m6811_opcode_def*,
+				int, const char*);
+void gen_interpreter (FILE*);
+
+
+static int indent_level = 2;
+static int current_insn_size = 0;
+
+/* Fatal error message and exit.  This method is called when an inconsistency
+   is detected in the generation table.	 */
+void
+fatal_error (const struct m6811_opcode_def *opcode, const char *msg)
+{
+  fprintf (stderr, "Fatal error: %s\n", msg);
+  if (opcode)
+    {
+      fprintf (stderr, "Opcode: 0x%02x %s %s\n",
+	       opcode->insn_code, opcode->name, opcode->operands);
+    }
+  exit (1);
+}
+
+
+/* Format and pretty print for the code generation.  (printf like format).  */
+void
+print (FILE *fp, int col, const char *msg, ...)
+{
+  va_list argp;
+  char buf[1024];
+  int cur_col = -1;
+  int i;
+
+  /* Format in a buffer.  */
+  va_start (argp, msg);
+  vsprintf (buf, msg, argp);
+  va_end (argp);
+
+  /* Basic pretty print:
+     - Every line is indented at column 'col',
+     - Indentation is updated when '{' and '}' are found,
+     - Indentation is incremented by the special character '@' (not displayed).
+     - New lines inserted automatically after ';'  */
+  for (i = 0; buf[i]; i++)
+    {
+      if (buf[i] == '{')
+	col += indent_level;
+      else if (buf[i] == '}')
+	col -= indent_level;
+      else if (buf[i] == '@')
+	{
+	  col += indent_level;
+	  continue;
+	}
+      if (cur_col == -1 && buf[i] != ' ' && buf[i] != '\t' && buf[i] != '\n')
+	{
+	  cur_col = 0;
+	  while (cur_col < col)
+	    {
+	      fputc (' ', fp);
+	      cur_col++;
+	    }
+	}
+      if (buf[i] == '}')
+	col -= indent_level;
+      else if (buf[i] == '{')
+	col += indent_level;
+      else if (buf[i] == '\n')
+	cur_col = -1;
+
+      if (cur_col != -1 || buf[i] == '\n')
+	fputc (buf[i], fp);
+
+      if (buf[i] == ';')
+	{
+	  fputc ('\n', fp);
+	  cur_col = -1;
+	}
+    }
+}
+
+
+/* Generate the code to obtain the operands before execution of the
+   instruction.	 Operands are copied in local variables.  This allows to
+   have the same instruction pattern and different operand formats.
+   There is a maximum of 3 variables:
+ 
+		       8-bits	       16-bits
+   1st operand:		src8		src16
+   2nd operand:		dst8		dst16
+   alt operand:		addr		addr
+  
+   The operand string is interpreted as follows:
+ 
+   a	Copy A register in the local 8-bits variable.
+   b	"    B "
+   ccr	"    ccr "
+   d	"    D "	"      "    16-bits variable.
+   x	"    X "
+   y	"    Y "
+   sp	"    SP "
+   *	68HC11 page0 memory pointer.
+	Get 8-bits page0 offset from program, set up 'addr' local
+	variable to refer to the location in page0.
+	Copy the 8/16-bits value pointed to by 'addr' in a 8/16-bits variable.
+   (x)	68HC11 indirect access with X register.
+	Get 8-bits unsigned offset from program, set up 'addr' = X + offset.
+	Copy the 8/16-bits value pointed to by 'addr' in a 8/16-bits variable.
+   (y)	Same as (x) with Y register.
+   ()	68HC11 extended address mode (global variable).
+	Get 16-bits address from program and set 'addr'.
+	Copy the 8/16-bits value pointed to by 'addr' in a 8/16-bits variable.
+   (sp) Pop
+	Pop a 8/16-bits value from stack and set in a 8/16-bits variable.
+   r	Relative branch
+	Get 8-bits relative branch, compute absolute address and set 'addr'
+   #	68HC11 immediate value
+	Get a 8/16-bits value from program and set a 8/16-bits variable.
+   &(x)
+   &(y)
+   &()	Similar to (x), (y) and () except that we don't read the
+	value pointed to by 'addr' (ie, only 'addr' is setup). Used by jmp/jsr.
+   ,	Operand separator.
+   -	End of input operands.
+  
+   Example:
+       (x),a->a	      addr = x + (uint16) (fetch8 (proc));
+		      src8 = a
+       *,#,r	      addr = (uint16) (fetch8 (proc))  <- Temporary 'addr'
+		      src8 = read_mem8 (proc, addr)
+		      dst8 = fetch8 (proc)
+		      addr = fetch_relbranch (proc)    <- Final 'addr'
+  
+   Returns 1 if the 'addr' operand is set, 0 otherwise.	 */
+int
+gen_fetch_operands (FILE *fp, int col,
+		    const struct m6811_opcode_def *opcode,
+		    const char *operand_size)
+{
+  static char *vars[2] = {
+    "src",
+    "dst"
+  };
+  char c;
+  int addr_set = 0;
+  int cur_var = 0;
+  const char *operands = opcode->operands;
+  
+  if (operands == 0)
+    operands = "";
+
+  while ((c = *operands++) != 0)
+    {
+      switch (c)
+	{
+	case 'a':
+	  if (cur_var >= 2)
+	    fatal_error (opcode, "Too many locals");
+	  
+	  print (fp, col, "%s8 = cpu_get_a (proc);", vars[cur_var]);
+	  break;
+
+	case 'b':
+	  if (cur_var >= 2)
+	    fatal_error (opcode, "Too many locals");
+
+	  print (fp, col, "%s8 = cpu_get_b (proc);", vars[cur_var]);
+	  break;
+
+	case 'd':
+	  if (cur_var >= 2)
+	    fatal_error (opcode, "Too many locals");
+
+	  print (fp, col, "%s16 = cpu_get_d (proc);", vars[cur_var]);
+	  break;
+
+	case 'x':
+	  if (cur_var >= 2)
+	    fatal_error (opcode, "Too many locals");
+
+	  print (fp, col, "%s16 = cpu_get_x (proc);", vars[cur_var]);
+	  break;
+
+	case 'y':
+	  if (cur_var >= 2)
+	    fatal_error (opcode, "Too many locals");
+
+	  print (fp, col, "%s16 = cpu_get_y (proc);", vars[cur_var]);
+	  break;
+
+	case '*':
+	  if (cur_var >= 2)
+	    fatal_error (opcode, "Too many locals");
+
+	  if (addr_set)
+	    fatal_error (opcode, "Wrong use of '*', 'addr' already used");
+	  
+	  addr_set = 1;
+	  current_insn_size += 1;
+	  print (fp, col, "addr = (uint16) cpu_fetch8 (proc);");
+	  print (fp, col, "%s%s = memory_read%s (proc, addr);",
+		 vars[cur_var], operand_size, operand_size);
+	  break;
+
+	case '&':
+	  if (addr_set)
+	    fatal_error (opcode, "Wrong use of '&', 'addr' already used");
+	  
+	  addr_set = 1;
+	  if (strncmp (operands, "(x)", 3) == 0)
+	    {
+	      current_insn_size += 1;
+	      print (fp, col, "addr = cpu_get_x (proc) + (uint16) cpu_fetch8 (proc);");
+	      operands += 3;
+	    }
+	  else if (strncmp (operands, "(y)", 3) == 0)
+	    {
+	      current_insn_size += 1;
+	      print (fp, col, "addr = cpu_get_y (proc) + (uint16) cpu_fetch8 (proc);");
+	      operands += 3;
+	    }
+	  else if (strncmp (operands, "()", 2) == 0)
+	    {
+	      current_insn_size += 2;
+	      print (fp, col, "addr = cpu_fetch16 (proc);");
+	      operands += 2;
+	    }
+	  else
+	    {
+	      fatal_error (opcode, "Unknown operand");
+	    }
+	  break;
+	  
+	case '(':
+	  if (cur_var >= 2)
+	    fatal_error (opcode, "Too many locals");
+	  
+	  if (addr_set)
+	    fatal_error (opcode, "Wrong use of '(', 'addr' already used");
+	  
+	  if (strncmp (operands, "x)", 2) == 0)
+	    {
+	      addr_set = 1;
+	      current_insn_size += 1;
+	      print (fp, col, "addr = cpu_get_x (proc) + (uint16) cpu_fetch8 (proc);");
+	      print (fp, col, "%s%s = memory_read%s (proc, addr);",
+		     vars[cur_var], operand_size, operand_size);
+	      operands += 2;
+	    }
+	  else if (strncmp (operands, "y)", 2) == 0)
+	    {
+	      addr_set = 1;
+	      current_insn_size += 1;
+	      print (fp, col, "addr = cpu_get_y (proc) + (uint16) cpu_fetch8 (proc);");
+	      print (fp, col, "%s%s = memory_read%s (proc, addr);",
+		     vars[cur_var], operand_size, operand_size);
+	      operands += 2;
+	    }
+	  else if (strncmp (operands, ")", 1) == 0)
+	    {
+	      addr_set = 1;
+	      current_insn_size += 2;
+	      print (fp, col, "addr = cpu_fetch16 (proc);");
+	      print (fp, col, "%s%s = memory_read%s (proc, addr);",
+		     vars[cur_var], operand_size, operand_size);
+	      operands++;
+	    }
+	  else if (strncmp (operands, "sp)", 3) == 0)
+	    {
+	      print (fp, col, "%s%s = cpu_pop_uint%s (proc);",
+		     vars[cur_var], operand_size, operand_size);
+	      operands += 3;
+	    }
+	  else
+	    {
+	      fatal_error (opcode, "Unknown operand");
+	    }
+	  break;
+
+	case 's':
+	  if (cur_var >= 2)
+	    fatal_error (opcode, "Too many locals");
+	  
+	  if (strncmp (operands, "p", 1) == 0)
+	    {
+	      print (fp, col, "%s16 = cpu_get_sp (proc);", vars[cur_var]);
+	      operands++;
+	    }
+	  else
+	    {
+	      fatal_error (opcode, "Unknown operands");
+	    }
+	  break;
+
+	case 'c':
+	  if (strncmp (operands, "cr", 2) == 0)
+	    {
+	      print (fp, col, "%s8 = cpu_get_ccr (proc);", vars[cur_var]);
+	      operands += 2;
+	    }
+	  else
+	    {
+	      fatal_error (opcode, "Unknown operands");
+	    }
+	  break;
+	  
+	case 'r':
+	  if (addr_set && cur_var != 2)
+	    fatal_error (opcode, "Wrong use of 'r'");
+
+	  addr_set = 1;
+	  current_insn_size += 1;
+	  print (fp, col, "addr = cpu_fetch_relbranch (proc);");
+	  break;
+
+	case '#':
+	  if (strcmp (operand_size, "8") == 0)
+	    {
+	      current_insn_size += 1;
+	    }
+	  else
+	    {
+	      current_insn_size += 2;
+	    }
+	  print (fp, col, "%s%s = cpu_fetch%s (proc);", vars[cur_var],
+		 operand_size, operand_size);
+	  break;
+	  
+	case ',':
+	  cur_var ++;
+	  break;
+
+	case '-':
+	  return addr_set;
+
+	default:
+	  fatal_error (opcode, "Invalid operands");
+	  break;
+	}
+    }
+  return addr_set;
+}
+
+
+/* Generate the code to save the instruction result.  The result is in
+   a local variable: either 'dst8' or 'dst16'.
+   There may be only one result.  Instructions with 2 results (ie idiv
+   and fdiv), take care of saving the first value.
+  
+   The operand string is the same as for 'gen_fetch_operands'.
+   Everything before '->' is ignored.  If the '->' is not found, it
+   is assumed that there is nothing to save.  After '->', the operand
+   string is interpreted as follows:
+  
+   a	Save 'dst8' in A register
+   b	"	       B "
+   ccr	"	       CCR "
+   d	"    'dst16'   D "
+   x	"	       X "
+   y	"	       Y "
+   sp	"	       SP "
+   *	68HC11 page0 memory pointer.
+   (x)	68HC11 indirect access with X register.
+   (y)	Same as (x) with Y register.
+   ()	68HC11 extended address mode (global variable).
+	For these modes, if they were used as an input operand,
+	the 'addr' variable contains the address of memory where
+	the result must be saved.
+	If they were not used an input operand, 'addr' is computed
+	(as in gen_fetch_operands()), and the result is saved.
+   (sp) Push
+	Push the 8/16-bits result on the stack.	 */
+void
+gen_save_result (FILE *fp, int col,
+		 const struct m6811_opcode_def *opcode,
+		 int addr_set,
+		 const char *operand_size)
+{
+  char c;
+  const char *operands = opcode->operands;
+
+  /* When the result is saved, 'result_size' is a string which
+     indicates the size of the saved result ("8" or "16").  This
+     is a sanity check with 'operand_size' to detect inconsistencies
+     in the different tables.  */
+  const char *result_size = 0;
+  
+  if (operands == 0)
+    operands = "";
+
+  operands = strchr (operands, '-');
+  if (operands == 0)
+    return;
+
+  operands++;
+  if (*operands++ != '>')
+    {
+      fatal_error (opcode, "Invalid operand");
+    }
+
+  c = *operands++;
+  switch (c)
+    {
+    case 'a':
+      result_size = "8";
+      print (fp, col, "cpu_set_a (proc, dst8);");
+      break;
+
+    case 'b':
+      result_size = "8";
+      print (fp, col, "cpu_set_b (proc, dst8);");
+      break;
+
+    case 'd':
+      result_size = "16";
+      print (fp, col, "cpu_set_d (proc, dst16);");
+      break;
+
+    case 'x':
+      result_size = "16";
+      print (fp, col, "cpu_set_x (proc, dst16);");
+      break;
+
+    case 'y':
+      result_size = "16";
+      print (fp, col, "cpu_set_y (proc, dst16);");
+      break;
+
+    case '*':
+      if (addr_set == 0)
+	{
+	  current_insn_size += 1;
+	  print (fp, col, "addr = (uint16) cpu_fetch8 (proc);");
+	}
+      result_size = operand_size;
+      print (fp, col, "memory_write%s (proc, addr, dst%s);",
+	     operand_size, operand_size);
+      break;
+
+    case '(':
+      if (strncmp (operands, "x)", 2) == 0)
+	{
+	  if (addr_set == 0)
+	    {
+	      current_insn_size += 1;
+	      print (fp, col, "addr = cpu_get_x (proc) + cpu_fetch8 (proc);");
+	    }
+	  print (fp, col, "memory_write%s (proc, addr, dst%s);",
+		 operand_size, operand_size);
+	  operands += 2;
+	  result_size = operand_size;
+	}
+      else if (strncmp (operands, "y)", 2) == 0)
+	{
+	  if (addr_set == 0)
+	    {
+	      current_insn_size += 1;
+	      print (fp, col, "addr = cpu_get_y (proc) + cpu_fetch8 (proc);");
+	    }
+	  print (fp, col, "memory_write%s (proc, addr, dst%s);",
+		 operand_size, operand_size);
+	  operands += 2;
+	  result_size = operand_size;
+	}
+      else if (strncmp (operands, ")", 1) == 0)
+	{
+	  if (addr_set == 0)
+	    {
+	      current_insn_size += 2;
+	      print (fp, col, "addr = cpu_fetch16 (proc);");
+	    }
+	  print (fp, col, "memory_write%s (proc, addr, dst%s);",
+		 operand_size, operand_size);
+	  operands++;
+	  result_size = operand_size;
+	}
+      else if (strncmp (operands, "sp)", 3) == 0)
+	{
+	  print (fp, col, "cpu_push_uint%s (proc, dst%s);",
+		 operand_size, operand_size);
+	  operands += 3;
+	  result_size = operand_size;
+	}
+      else
+	{
+	  fatal_error (opcode, "Invalid operand");
+	}
+      break;
+
+    case 's':
+      if (strncmp (operands, "p", 1) == 0)
+	{
+	  print (fp, col, "cpu_set_sp (proc, dst16);");
+	  operands++;
+	  result_size = "16";
+	}
+      else
+	{
+	  fatal_error (opcode, "Invalid operand");
+	}
+      break;
+
+    case 'c':
+      if (strncmp (operands, "cr", 2) == 0)
+	{
+	  print (fp, col, "cpu_set_ccr (proc, dst8);");
+	  operands += 2;
+	  result_size = "8";
+	}
+      else
+	{
+	  fatal_error (opcode, "Invalid operand");
+	}
+      break;
+	  
+    default:
+      fatal_error (opcode, "Invalid operand");
+      break;
+    }
+
+  if (*operands != 0)
+    fatal_error (opcode, "Garbage at end of operand");
+  
+  if (result_size == 0)
+    fatal_error (opcode, "? No result seems to be saved");
+
+  if (strcmp (result_size, operand_size) != 0)
+    fatal_error (opcode, "Result saved different than pattern size");
+}
+
+
+/* Find the instruction pattern for a given instruction.  */
+const struct m6811_opcode_pattern*
+find_opcode_pattern (const struct m6811_opcode_def *opcode)
+{
+  int i;
+  const char *pattern = opcode->insn_pattern;
+  
+  if (pattern == 0)
+    {
+      pattern = opcode->name;
+    }
+  for (i = 0; i < TABLE_SIZE(m6811_opcode_patterns); i++)
+    {
+      if (strcmp (m6811_opcode_patterns[i].name, pattern) == 0)
+	{
+	  return &m6811_opcode_patterns[i];
+	}
+    }
+  fatal_error (opcode, "Unknown instruction pattern");
+  return 0;
+}
+
+
+/* Generate the code for interpretation of instruction 'opcode'.  */
+void
+gen_interp (FILE *fp, int col, const struct m6811_opcode_def *opcode)
+{
+  const char *operands = opcode->operands;
+  int addr_set;
+  const char *pattern = opcode->insn_pattern;
+  const struct m6811_opcode_pattern *op;
+  const char *operand_size;
+  
+  if (pattern == 0)
+    {
+      pattern = opcode->name;
+    }
+
+  /* Find out the size of the operands: 8 or 16-bits.  */
+  if (strcmp(&pattern[strlen(pattern) - 1], "8") == 0)
+    {
+      operand_size = "8";
+    }
+  else if (strcmp (&pattern[strlen(pattern) - 2], "16") == 0)
+    {
+      operand_size = "16";
+    }
+  else
+    {
+      operand_size = "";
+    }
+  
+  if (operands == 0)
+    operands = "";
+
+  /* Generate entry point for the instruction.	*/
+  print (fp, col, "case 0x%02x: /* %s %s */\n", opcode->insn_code,
+	 opcode->name, operands);
+  col += indent_level;
+
+  /* Generate the code to get the instruction operands.	 */
+  addr_set = gen_fetch_operands (fp, col, opcode, operand_size);
+
+  /* Generate instruction interpretation.  */
+  op = find_opcode_pattern (opcode);
+  if (op->pattern)
+    {
+      print (fp, col, "%s;", op->pattern);
+    }
+
+  /* Generate the code to save the result.  */
+  gen_save_result (fp, col, opcode, addr_set, operand_size);
+
+  /* For some instructions, generate the code to update the flags.  */
+  if (op && op->ccr_update)
+    {
+      print (fp, col, "%s;", op->ccr_update);
+    }
+  print (fp, col, "break;");
+}
+
+
+/* Generate the interpretor for a given 68HC11 page set.  */
+void
+gen_interpreter_for_table (FILE *fp, int col,
+			   const struct m6811_opcode_def *table,
+			   int size,
+			   const char *cycles_table_name)
+{
+  int i;
+  int init_size;
+
+  init_size = table == m6811_page1_opcodes ? 1 : 2;
+  
+  /* Get the opcode and dispatch directly.  */
+  print (fp, col, "op = cpu_fetch8 (proc);");
+  print (fp, col, "cpu_add_cycles (proc, %s[op]);", cycles_table_name);
+  
+  print (fp, col, "switch (op)\n");
+  col += indent_level;
+  print (fp, col, "{\n");
+  
+  for (i = 0; i < size; i++)
+    {
+      /* The table contains duplicate entries (ie, instruction aliases).  */
+      if (i > 0 && table[i].insn_code == table[i - 1].insn_code)
+	continue;
+
+      current_insn_size = init_size;
+      gen_interp (fp, col, &table[i]);
+      if (current_insn_size != table[i].insn_size)
+	{
+	  fatal_error (&table[i], "Insn size inconsistency");
+	}
+    }
+
+  print (fp, col, "default:\n");
+  print (fp, col + indent_level, "cpu_special (proc, M6811_ILLEGAL);");
+  print (fp, col + indent_level, "break;");
+  print (fp, col, "}\n");
+}
+
+/* Generate the table of instruction cycle.  These tables are indexed
+   by the opcode number to allow a fast cycle time computation.	 */
+void
+gen_cycle_table (FILE *fp, const char *name,
+		 const struct m6811_opcode_def *table,
+		 int size)
+{
+  int i;
+  char cycles[256];
+  int page1;
+
+  page1 = table == m6811_page1_opcodes;
+
+  /* Build the cycles table.  The table is indexed by the opcode.  */
+  memset (cycles, 0, sizeof (cycles));
+  while (--size >= 0)
+    {
+      if (table->insn_min_cycles > table->insn_max_cycles)
+	fatal_error (table, "Wrong insn cycles");
+
+      if (table->insn_max_cycles == _M)
+	cycles[table->insn_code] = table->insn_min_cycles;
+      else
+	cycles[table->insn_code] = table->insn_max_cycles;
+
+      table++;
+    }
+
+  /* Some check: for the page1 opcode, the cycle type of the page2/3/4
+     opcode must be 0.	*/
+  if (page1 && (cycles[M6811_OPCODE_PAGE2] != 0
+		|| cycles[M6811_OPCODE_PAGE3] != 0
+		|| cycles[M6811_OPCODE_PAGE4] != 0))
+      fatal_error (0, "Invalid cycle table");
+
+  /* Generates the cycles table.  */
+  print (fp, 0, "static const unsigned char %s[256] = {\n", name);
+  for (i = 0; i < 256; i++)
+    {
+      if ((i % 16) == 0)
+	{
+	  print (fp, indent_level, "/* %3d */ ", i);
+	}
+      fprintf (fp, "%2d", cycles[i]);
+      if (i != 255)
+	fprintf (fp, ",");
+
+      if ((i % 16) != 15)
+	fprintf (fp, " ");
+      else
+	fprintf (fp, "\n");
+    }
+  print (fp, 0, "};\n\n");
+}
+
+void
+gen_function_entry (FILE *fp, const char *name)
+{
+  /* Generate interpretor entry point.	*/
+  print (fp, 0, "%s (proc)\n", name);
+  print (fp, indent_level, "struct _sim_cpu* proc;");
+  print (fp, indent_level, "{\n");
+
+  /* Interpretor local variables.  */
+  print (fp, indent_level, "unsigned char op;");
+  print (fp, indent_level, "uint16 addr, src16, dst16;");
+  print (fp, indent_level, "uint8 src8, dst8;\n");
+}
+
+void
+gen_function_close (FILE *fp)
+{
+  print (fp, 0, "}\n");
+}
+
+void
+gen_interpreter (FILE *fp)
+{
+  int col = 0;
+
+  /* Generate header of interpretor.  */
+  print (fp, col, "/* File generated automatically by gencode. */\n");
+  print (fp, col, "#include \"sim-main.h\"\n\n");
+
+  gen_cycle_table (fp, "cycles_page1", m6811_page1_opcodes,
+		   TABLE_SIZE (m6811_page1_opcodes));
+  gen_cycle_table (fp, "cycles_page2", m6811_page2_opcodes,
+		   TABLE_SIZE (m6811_page2_opcodes));
+  gen_cycle_table (fp, "cycles_page3", m6811_page3_opcodes,
+		   TABLE_SIZE (m6811_page3_opcodes));
+  gen_cycle_table (fp, "cycles_page4", m6811_page4_opcodes,
+		   TABLE_SIZE (m6811_page4_opcodes));
+
+  /* Generate the page 2, 3 and 4 handlers.  */
+  gen_function_entry (fp, "static void\ncpu_page2_interp");
+  gen_interpreter_for_table (fp, indent_level,
+			     m6811_page2_opcodes,
+			     TABLE_SIZE(m6811_page2_opcodes),
+			     "cycles_page2");
+  gen_function_close (fp);
+  
+  gen_function_entry (fp, "static void\ncpu_page3_interp");
+  gen_interpreter_for_table (fp, indent_level,
+			     m6811_page3_opcodes,
+			     TABLE_SIZE(m6811_page3_opcodes),
+			     "cycles_page3");
+  gen_function_close (fp);
+  
+  gen_function_entry (fp, "static void\ncpu_page4_interp");
+  gen_interpreter_for_table (fp, indent_level,
+			     m6811_page4_opcodes,
+			     TABLE_SIZE(m6811_page4_opcodes),
+			     "cycles_page4");
+  gen_function_close (fp);
+
+  /* Generate the interpretor entry point.  */
+  gen_function_entry (fp, "void\ncpu_interp");
+
+  gen_interpreter_for_table (fp, indent_level, m6811_page1_opcodes,
+			     TABLE_SIZE(m6811_page1_opcodes),
+			     "cycles_page1");
+  gen_function_close (fp);
+}
+
+int
+main (int argc, char *argv[])
+{
+  gen_interpreter (stdout);
+  if (fclose (stdout) != 0)
+    {
+      fprintf (stderr, "Error while generating the interpreter: %d\n",
+	       errno);
+      return 1;
+    }
+  return 0;
+}
diff --git a/sim/m68hc11/interp.c b/sim/m68hc11/interp.c
new file mode 100644
index 0000000..f9de865
--- /dev/null
+++ b/sim/m68hc11/interp.c
@@ -0,0 +1,469 @@
+/* interp.c -- Simulator for Motorola 68HC11
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Written by Stephane Carrez (stcarrez@worldnet.fr)
+
+This file is part of GDB, the GNU debugger.
+
+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.  */
+
+#include "sim-main.h"
+#include "sim-assert.h"
+#include "sim-hw.h"
+#include "sim-options.h"
+#include "hw-tree.h"
+#include "hw-device.h"
+#include "hw-ports.h"
+
+#ifndef MONITOR_BASE
+# define MONITOR_BASE (0x0C000)
+# define MONITOR_SIZE (0x04000)
+#endif
+
+static void sim_get_info (SIM_DESC sd, char *cmd);
+
+
+char *interrupt_names[] = {
+  "reset",
+  "nmi",
+  "int",
+  NULL
+};
+
+#ifndef INLINE
+#if defined(__GNUC__) && defined(__OPTIMIZE__)
+#define INLINE __inline__
+#else
+#define INLINE
+#endif
+#endif
+
+struct sim_info_list
+{
+  const char *name;
+  const char *device;
+};
+
+struct sim_info_list dev_list[] = {
+  {"cpu", "/m68hc11"},
+  {"timer", "/m68hc11/m68hc11tim"},
+  {"sio", "/m68hc11/m68hc11sio"},
+  {"spi", "/m68hc11/m68hc11spi"},
+  {"eeprom", "/m68hc11/m68hc11eepr"},
+  {0, 0}
+};
+
+/* Give some information about the simulator.  */
+static void
+sim_get_info (SIM_DESC sd, char *cmd)
+{
+  sim_cpu *cpu;
+
+  if (cmd != 0 && (cmd[0] == ' ' || cmd[0] == '-'))
+    {
+      int i;
+      struct hw *hw_dev;
+      cmd++;
+
+      for (i = 0; dev_list[i].name; i++)
+	if (strcmp (cmd, dev_list[i].name) == 0)
+	  break;
+
+      if (dev_list[i].name == 0)
+	{
+	  sim_io_eprintf (sd, "Device '%s' not found.\n", cmd);
+	  sim_io_eprintf (sd, "Valid devices: cpu timer sio eeprom\n");
+	  return;
+	}
+      hw_dev = sim_hw_parse (sd, dev_list[i].device);
+      if (hw_dev == 0)
+	{
+	  sim_io_eprintf (sd, "Device '%s' not found\n", dev_list[i].device);
+	  return;
+	}
+      hw_ioctl (hw_dev, 23, 0);
+      return;
+    }
+
+  cpu = STATE_CPU (sd, 0);
+  cpu_info (sd, cpu);
+  interrupts_info (sd, &cpu->cpu_interrupts);
+}
+
+
+void
+sim_board_reset (SIM_DESC sd)
+{
+  struct hw *hw_cpu;
+  sim_cpu *cpu;
+
+  cpu = STATE_CPU (sd, 0);
+  /*  hw_cpu = sim_hw_parse (sd, "/"); */
+  hw_cpu = sim_hw_parse (sd, "/m68hc11");
+  if (hw_cpu == 0)
+    {
+      sim_io_eprintf (sd, "m68hc11 cpu not found in device tree.");
+      return;
+    }
+
+  cpu_reset (cpu);
+  hw_port_event (hw_cpu, 3, 0);
+  cpu_restart (cpu);
+}
+
+SIM_DESC
+sim_open (SIM_OPEN_KIND kind, host_callback *callback,
+          struct _bfd *abfd, char **argv)
+{
+  char **p;
+  SIM_DESC sd;
+  sim_cpu *cpu;
+  struct hw *device_tree;
+
+  sd = sim_state_alloc (kind, callback);
+  cpu = STATE_CPU (sd, 0);
+
+  SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+
+  /* for compatibility */
+  current_alignment = NONSTRICT_ALIGNMENT;
+  current_target_byte_order = BIG_ENDIAN;
+
+  cpu_initialize (sd, cpu);
+
+  cpu->cpu_use_elf_start = 1;
+  if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK)
+    return 0;
+
+  /* getopt will print the error message so we just have to exit if this fails.
+     FIXME: Hmmm...  in the case of gdb we need getopt to call
+     print_filtered.  */
+  if (sim_parse_args (sd, argv) != SIM_RC_OK)
+    {
+      /* Uninstall the modules to avoid memory leaks,
+         file descriptor leaks, etc.  */
+      sim_module_uninstall (sd);
+      return 0;
+    }
+
+  device_tree = sim_hw_parse (sd, "/");
+  if (hw_tree_find_property (device_tree, "/m68hc11/reg") == 0)
+    {
+      /* Allocate core managed memory */
+
+      /* the monitor  */
+      sim_do_commandf (sd, "memory region 0x%lx@%d,0x%lx",
+		       /* MONITOR_BASE, MONITOR_SIZE */
+		       0x8000, M6811_RAM_LEVEL, 0x8000);
+      sim_do_commandf (sd, "memory region 0x000@%d,0x8000",
+                       M6811_RAM_LEVEL);
+      sim_hw_parse (sd, "/m68hc11/reg 0x1000 0x03F");
+    }
+
+  if (hw_tree_find_property (device_tree, "/m68hc11/m68hc11sio/reg") == 0)
+    {
+      sim_hw_parse (sd, "/m68hc11/m68hc11sio/reg 0x2b 0x5");
+      sim_hw_parse (sd, "/m68hc11/m68hc11sio/backend stdio");
+      sim_hw_parse (sd, "/m68hc11 > cpu-reset reset /m68hc11/m68hc11sio");
+    }
+  if (hw_tree_find_property (device_tree, "/m68hc11/m68hc11tim/reg") == 0)
+    {
+      /* M68hc11 Timer configuration. */
+      sim_hw_parse (sd, "/m68hc11/m68hc11tim/reg 0x1b 0x5");
+      sim_hw_parse (sd, "/m68hc11 > cpu-reset reset /m68hc11/m68hc11tim");
+    }
+
+  /* Create the SPI device.  */
+  if (hw_tree_find_property (device_tree, "/m68hc11/m68hc11spi/reg") == 0)
+    {
+      sim_hw_parse (sd, "/m68hc11/m68hc11spi/reg 0x28 0x3");
+      sim_hw_parse (sd, "/m68hc11 > cpu-reset reset /m68hc11/m68hc11spi");
+    }
+  if (hw_tree_find_property (device_tree, "/m68hc11/pram/reg") == 0)
+    {
+      /* M68hc11 persistent ram configuration. */
+      sim_hw_parse (sd, "/m68hc11/nvram/reg 0x0 256");
+      sim_hw_parse (sd, "/m68hc11/nvram/file m68hc11.ram");
+      sim_hw_parse (sd, "/m68hc11/nvram/mode save-modified");
+      /*sim_hw_parse (sd, "/m68hc11 > cpu-reset reset /m68hc11/pram"); */
+    }
+  if (hw_tree_find_property (device_tree, "/m68hc11/m68hc11eepr/reg") == 0)
+    {
+      sim_hw_parse (sd, "/m68hc11/m68hc11eepr/reg 0xb000 512");
+      /* Connect the CPU reset to all devices. */
+      sim_hw_parse (sd, "/m68hc11 > cpu-reset reset /m68hc11/m68hc11eepr");
+    }
+
+  /* Check for/establish the a reference program image.  */
+  if (sim_analyze_program (sd,
+			   (STATE_PROG_ARGV (sd) != NULL
+			    ? *STATE_PROG_ARGV (sd)
+			    : NULL), abfd) != SIM_RC_OK)
+    {
+      sim_module_uninstall (sd);
+      return 0;
+    }
+
+  /* Establish any remaining configuration options.  */
+  if (sim_config (sd) != SIM_RC_OK)
+    {
+      sim_module_uninstall (sd);
+      return 0;
+    }
+
+  if (sim_post_argv_init (sd) != SIM_RC_OK)
+    {
+      /* Uninstall the modules to avoid memory leaks,
+         file descriptor leaks, etc.  */
+      sim_module_uninstall (sd);
+      return 0;
+    }
+
+  if (abfd != NULL)
+    {
+      cpu->cpu_elf_start = bfd_get_start_address (abfd);
+    }
+
+  sim_board_reset (sd);
+
+  /* Fudge our descriptor.  */
+  return sd;
+}
+
+
+void
+sim_close (SIM_DESC sd, int quitting)
+{
+  /* shut down modules */
+  sim_module_uninstall (sd);
+
+  /* Ensure that any resources allocated through the callback
+     mechanism are released: */
+  sim_io_shutdown (sd);
+
+  /* FIXME - free SD */
+
+  return;
+}
+
+void
+sim_set_profile (int n)
+{
+}
+
+void
+sim_set_profile_size (int n)
+{
+}
+
+/* Generic implementation of sim_engine_run that works within the
+   sim_engine setjmp/longjmp framework. */
+
+void
+sim_engine_run (SIM_DESC sd,
+                int next_cpu_nr,	/* ignore */
+		int nr_cpus,	/* ignore */
+		int siggnal)	/* ignore */
+{
+  sim_cpu *cpu;
+
+  SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
+  cpu = STATE_CPU (sd, 0);
+  while (1)
+    {
+      cpu_single_step (cpu);
+
+      /* process any events */
+      if (sim_events_tickn (sd, cpu->cpu_current_cycle))
+	{
+	  sim_events_process (sd);
+	}
+    }
+}
+
+int
+sim_trace (SIM_DESC sd)
+{
+  sim_resume (sd, 0, 0);
+  return 1;
+}
+
+void
+sim_info (SIM_DESC sd, int verbose)
+{
+  sim_io_eprintf (sd, "Simulator info:\n");
+  sim_io_eprintf (sd, "  CPU Motorola 68HC11\n");
+  sim_get_info (sd, 0);
+  sim_module_info (sd, verbose || STATE_VERBOSE_P (sd));
+}
+
+SIM_RC
+sim_create_inferior (SIM_DESC sd, struct _bfd *abfd,
+                     char **argv, char **env)
+{
+  sim_cpu *cpu;
+  int i;
+
+  cpu = STATE_CPU (sd, 0);
+
+  if (abfd != NULL)
+    {
+      cpu->cpu_elf_start = bfd_get_start_address (abfd);
+    }
+
+  /* reset all state information */
+  sim_board_reset (sd);
+
+  return SIM_RC_OK;
+}
+
+
+void
+sim_set_callbacks (host_callback *p)
+{
+  /*  m6811_callback = p; */
+}
+
+
+int
+sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+{
+  sim_cpu *cpu;
+  uint16 val;
+
+  cpu = STATE_CPU (sd, 0);
+  switch (rn)
+    {
+    case A_REGNUM:
+      val = cpu_get_a (cpu);
+      break;
+
+    case B_REGNUM:
+      val = cpu_get_b (cpu);
+      break;
+
+    case D_REGNUM:
+      val = cpu_get_d (cpu);
+      break;
+
+    case X_REGNUM:
+      val = cpu_get_x (cpu);
+      break;
+
+    case Y_REGNUM:
+      val = cpu_get_y (cpu);
+      break;
+
+    case SP_REGNUM:
+      val = cpu_get_sp (cpu);
+      break;
+
+    case PC_REGNUM:
+      val = cpu_get_pc (cpu);
+      break;
+
+    case PSW_REGNUM:
+      val = cpu_get_ccr (cpu);
+      break;
+
+    default:
+      val = 0;
+      break;
+    }
+  memory[0] = val >> 8;
+  memory[1] = val & 0x0FF;
+  return 2;
+}
+
+int
+sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
+{
+  uint16 val;
+  sim_cpu *cpu;
+
+  cpu = STATE_CPU (sd, 0);
+
+  val = *memory++;
+  if (length == 2)
+    val = (val << 8) | *memory;
+
+  switch (rn)
+    {
+    case D_REGNUM:
+      cpu_set_d (cpu, val);
+      break;
+
+    case A_REGNUM:
+      cpu_set_a (cpu, val);
+      break;
+
+    case B_REGNUM:
+      cpu_set_b (cpu, val);
+      break;
+
+    case X_REGNUM:
+      cpu_set_x (cpu, val);
+      break;
+
+    case Y_REGNUM:
+      cpu_set_y (cpu, val);
+      break;
+
+    case SP_REGNUM:
+      cpu_set_sp (cpu, val);
+      break;
+
+    case PC_REGNUM:
+      cpu_set_pc (cpu, val);
+      break;
+
+    case PSW_REGNUM:
+      cpu_set_ccr (cpu, val);
+      break;
+
+    default:
+      break;
+    }
+
+  return 2;
+}
+
+void
+sim_size (int s)
+{
+  ;
+}
+
+void
+sim_do_command (SIM_DESC sd, char *cmd)
+{
+  char *mm_cmd = "memory-map";
+  char *int_cmd = "interrupt";
+
+  /* Commands available from GDB:   */
+  if (sim_args_command (sd, cmd) != SIM_RC_OK)
+    {
+      if (strncmp (cmd, "info", sizeof ("info") - 1) == 0)
+	sim_get_info (sd, &cmd[4]);
+      else if (strncmp (cmd, "frame", sizeof ("frame") - 1) == 0)
+	cpu_print_frame (sd, STATE_CPU (sd, 0));
+      else if (strncmp (cmd, mm_cmd, strlen (mm_cmd) == 0))
+	sim_io_eprintf (sd,
+			"`memory-map' command replaced by `sim memory'\n");
+      else if (strncmp (cmd, int_cmd, strlen (int_cmd)) == 0)
+	sim_io_eprintf (sd, "`interrupt' command replaced by `sim watch'\n");
+      else
+	sim_io_eprintf (sd, "Unknown command `%s'\n", cmd);
+    }
+}
diff --git a/sim/m68hc11/interrupts.c b/sim/m68hc11/interrupts.c
new file mode 100644
index 0000000..44771bb
--- /dev/null
+++ b/sim/m68hc11/interrupts.c
@@ -0,0 +1,318 @@
+/* interrupts.c -- 68HC11 Interrupts Emulation
+   Copyright 1999, 2000 Free Software Foundation, Inc.
+   Written by Stephane Carrez (stcarrez@worldnet.fr)
+
+This file is part of GDB, GAS, and the GNU binutils.
+
+GDB, GAS, and the GNU binutils are free software; you can redistribute
+them and/or modify them under the terms of the GNU General Public
+License as published by the Free Software Foundation; either version
+1, or (at your option) any later version.
+
+GDB, GAS, and the GNU binutils are distributed in the hope that they
+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 file; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include "sim-main.h"
+
+struct interrupt_def idefs[] = {
+  /* Serial interrupts.  */
+  { M6811_INT_SCI,      M6811_SCSR,   M6811_TDRE,  M6811_SCCR2,  M6811_TIE },
+  { M6811_INT_SCI,      M6811_SCSR,   M6811_TC,    M6811_SCCR2,  M6811_TCIE },
+  { M6811_INT_SCI,      M6811_SCSR,   M6811_RDRF,  M6811_SCCR2,  M6811_RIE },
+  { M6811_INT_SCI,      M6811_SCSR,   M6811_IDLE,  M6811_SCCR2,  M6811_ILIE },
+
+  /* SPI interrupts.  */
+  { M6811_INT_SPI,      M6811_SPSR,   M6811_SPIF,  M6811_SPCR,   M6811_SPIE },
+
+  /* Realtime interrupts.  */
+  { M6811_INT_TCTN,     M6811_TFLG2,  M6811_TOF,   M6811_TMSK2,  M6811_TOI },
+  { M6811_INT_RT,       M6811_TFLG2,  M6811_RTIF,  M6811_TMSK2,  M6811_RTII },
+
+  /* Output compare interrupts.  */
+  { M6811_INT_OUTCMP1,  M6811_TFLG1,  M6811_OC1F,  M6811_TMSK1,  M6811_OC1I },
+  { M6811_INT_OUTCMP2,  M6811_TFLG1,  M6811_OC2F,  M6811_TMSK1,  M6811_OC2I },
+  { M6811_INT_OUTCMP3,  M6811_TFLG1,  M6811_OC3F,  M6811_TMSK1,  M6811_OC3I },
+  { M6811_INT_OUTCMP4,  M6811_TFLG1,  M6811_OC4F,  M6811_TMSK1,  M6811_OC4I },
+  { M6811_INT_OUTCMP5,  M6811_TFLG1,  M6811_OC5F,  M6811_TMSK1,  M6811_OC5I },
+
+  /* Input compare interrupts.  */
+  { M6811_INT_INCMP1,   M6811_TFLG1,  M6811_IC1F,  M6811_TMSK1,  M6811_IC1I },
+  { M6811_INT_INCMP2,   M6811_TFLG1,  M6811_IC2F,  M6811_TMSK1,  M6811_IC2I },
+  { M6811_INT_INCMP3,   M6811_TFLG1,  M6811_IC3F,  M6811_TMSK1,  M6811_IC3I },
+#if 0
+  { M6811_INT_COPRESET, M6811_CONFIG, M6811_NOCOP, 0,            0 },
+  { M6811_INT_COPFAIL,  M6811_CONFIG, M6811_NOCOP, 0,            0 }
+#endif
+};
+
+#define TableSize(X) (sizeof X / sizeof(X[0]))
+#define CYCLES_MAX ((((signed64) 1) << 62) - 1)
+
+/* Initialize the interrupts of the processor.  */
+int
+interrupts_initialize (struct _sim_cpu *proc)
+{
+  struct interrupts *interrupts = &proc->cpu_interrupts;
+  int i;
+  
+  interrupts->cpu          = proc;
+  interrupts->pending_mask = 0;
+  interrupts->vectors_addr = 0xffc0;
+  interrupts->nb_interrupts_raised = 0;
+  interrupts->min_mask_cycles = CYCLES_MAX;
+  interrupts->max_mask_cycles = 0;
+  interrupts->start_mask_cycle = -1;
+  interrupts->xirq_start_mask_cycle = -1;
+  interrupts->xirq_max_mask_cycles = 0;
+  interrupts->xirq_min_mask_cycles = CYCLES_MAX;
+  
+  for (i = 0; i < M6811_INT_NUMBER; i++)
+    {
+      interrupts->interrupt_order[i] = i;
+    }
+  return 0;
+}
+
+
+/* Update the mask of pending interrupts.  This operation must be called
+   when the state of some 68HC11 IO registers changes.  It looks the
+   different registers that indicate a pending interrupt (timer, SCI, SPI,
+   ...) and records the interrupt if it's there and enabled.  */
+void
+interrupts_update_pending (struct interrupts *interrupts)
+{
+  int i;
+  uint8 *ioregs;
+
+  ioregs = &interrupts->cpu->ios[0];
+  
+  for (i = 0; i < TableSize(idefs); i++)
+    {
+      struct interrupt_def *idef = &idefs[i];
+      uint8 data;
+      
+      /* Look if the interrupt is enabled.  */
+      if (idef->enable_paddr)
+	{
+	  data = ioregs[idef->enable_paddr];
+	  if (!(data & idef->enabled_mask))
+            {
+              /* Disable it.  */
+              interrupts->pending_mask &= ~(1 << idef->int_number);
+              continue;
+            }
+	}
+
+      /* Interrupt is enabled, see if it's there.  */
+      data = ioregs[idef->int_paddr];
+      if (!(data & idef->int_mask))
+        {
+          /* Disable it.  */
+          interrupts->pending_mask &= ~(1 << idef->int_number);
+          continue;
+        }
+
+      /* Ok, raise it.  */
+      interrupts->pending_mask |= (1 << idef->int_number);
+    }
+}
+
+
+/* Finds the current active and non-masked interrupt.
+   Returns the interrupt number (index in the vector table) or -1
+   if no interrupt can be serviced.  */
+int
+interrupts_get_current (struct interrupts *interrupts)
+{
+  int i;
+  
+  if (interrupts->pending_mask == 0)
+    return -1;
+
+  /* SWI and illegal instructions are simulated by an interrupt.
+     They are not maskable.  */
+  if (interrupts->pending_mask & (1 << M6811_INT_SWI))
+    {
+      interrupts->pending_mask &= ~(1 << M6811_INT_SWI);
+      return M6811_INT_SWI;
+    }
+  if (interrupts->pending_mask & (1 << M6811_INT_ILLEGAL))
+    {
+      interrupts->pending_mask &= ~(1 << M6811_INT_ILLEGAL);
+      return M6811_INT_ILLEGAL;
+    }
+  
+  /* If there is a non maskable interrupt, go for it (unless we are masked
+     by the X-bit.  */
+  if (interrupts->pending_mask & (1 << M6811_INT_XIRQ))
+    {
+      if (cpu_get_ccr_X (interrupts->cpu) == 0)
+	{
+	  interrupts->pending_mask &= ~(1 << M6811_INT_XIRQ);
+	  return M6811_INT_XIRQ;
+	}
+      return -1;
+    }
+
+  /* Interrupts are masked, do nothing.  */
+  if (cpu_get_ccr_I (interrupts->cpu) == 1)
+    {
+      return -1;
+    }
+
+  /* Returns the first interrupt number which is pending.
+     The interrupt priority is specified by the table `interrupt_order'.
+     For these interrupts, the pending mask is cleared when the program
+     performs some actions on the corresponding device.  If the device
+     is not reset, the interrupt remains and will be re-raised when
+     we return from the interrupt (see 68HC11 pink book).  */
+  for (i = 0; i < M6811_INT_NUMBER; i++)
+    {
+      enum M6811_INT int_number = interrupts->interrupt_order[i];
+
+      if (interrupts->pending_mask & (1 << int_number))
+	{
+	  return int_number;
+	}
+    }
+  return -1;
+}
+
+
+/* Process the current interrupt if there is one.  This operation must
+   be called after each instruction to handle the interrupts.  If interrupts
+   are masked, it does nothing.  */
+int
+interrupts_process (struct interrupts *interrupts)
+{
+  int id;
+  uint8 ccr;
+
+  /* See if interrupts are enabled/disabled and keep track of the
+     number of cycles the interrupts are masked.  Such information is
+     then reported by the info command.  */
+  ccr = cpu_get_ccr (interrupts->cpu);
+  if (ccr & M6811_I_BIT)
+    {
+      if (interrupts->start_mask_cycle < 0)
+        interrupts->start_mask_cycle = cpu_current_cycle (interrupts->cpu);
+    }
+  else if (interrupts->start_mask_cycle >= 0
+           && (ccr & M6811_I_BIT) == 0)
+    {
+      signed64 t = cpu_current_cycle (interrupts->cpu);
+
+      t -= interrupts->start_mask_cycle;
+      if (t < interrupts->min_mask_cycles)
+        interrupts->min_mask_cycles = t;
+      if (t > interrupts->max_mask_cycles)
+        interrupts->max_mask_cycles = t;
+      interrupts->start_mask_cycle = -1;
+    }
+  if (ccr & M6811_X_BIT)
+    {
+      if (interrupts->xirq_start_mask_cycle < 0)
+        interrupts->xirq_start_mask_cycle
+	  = cpu_current_cycle (interrupts->cpu);
+    }
+  else if (interrupts->xirq_start_mask_cycle >= 0
+           && (ccr & M6811_X_BIT) == 0)
+    {
+      signed64 t = cpu_current_cycle (interrupts->cpu);
+
+      t -= interrupts->xirq_start_mask_cycle;
+      if (t < interrupts->xirq_min_mask_cycles)
+        interrupts->xirq_min_mask_cycles = t;
+      if (t > interrupts->xirq_max_mask_cycles)
+        interrupts->xirq_max_mask_cycles = t;
+      interrupts->xirq_start_mask_cycle = -1;
+    }
+
+  id = interrupts_get_current (interrupts);
+  if (id >= 0)
+    {
+      uint16 addr;
+      
+      cpu_push_all (interrupts->cpu);
+      addr = memory_read16 (interrupts->cpu,
+                            interrupts->vectors_addr + id * 2);
+      cpu_call (interrupts->cpu, addr);
+
+      /* Now, protect from nested interrupts.  */
+      if (id == M6811_INT_XIRQ)
+	{
+	  cpu_set_ccr_X (interrupts->cpu, 1);
+	}
+      else
+	{
+	  cpu_set_ccr_I (interrupts->cpu, 1);
+	}
+
+      interrupts->nb_interrupts_raised++;
+      cpu_add_cycles (interrupts->cpu, 14);
+      return 1;
+    }
+  return 0;
+}
+
+void
+interrupts_raise (struct interrupts *interrupts, enum M6811_INT number)
+{
+  interrupts->pending_mask |= (1 << number);
+  interrupts->nb_interrupts_raised ++;
+}
+
+
+
+void
+interrupts_info (SIM_DESC sd, struct interrupts *interrupts)
+{
+  signed64 t;
+  
+  if (interrupts->start_mask_cycle >= 0)
+    {
+      t = cpu_current_cycle (interrupts->cpu);
+
+      t -= interrupts->start_mask_cycle;
+      if (t > interrupts->max_mask_cycles)
+        interrupts->max_mask_cycles = t;
+    }
+  if (interrupts->xirq_start_mask_cycle >= 0)
+    {
+      t = cpu_current_cycle (interrupts->cpu);
+
+      t -= interrupts->xirq_start_mask_cycle;
+      if (t > interrupts->xirq_max_mask_cycles)
+        interrupts->xirq_max_mask_cycles = t;
+    }
+
+  sim_io_printf (sd, "Interrupts Info:\n");
+  sim_io_printf (sd, "  Interrupts raised: %lu\n",
+                 interrupts->nb_interrupts_raised);
+
+  t = interrupts->min_mask_cycles == CYCLES_MAX ?
+    interrupts->max_mask_cycles :
+    interrupts->min_mask_cycles;
+  sim_io_printf (sd, "  Shortest interrupts masked sequence: %s\n",
+                 cycle_to_string (interrupts->cpu, t));
+
+  t = interrupts->max_mask_cycles;
+  sim_io_printf (sd, "  Longest interrupts masked sequence: %s\n",
+                 cycle_to_string (interrupts->cpu, t));
+
+  t = interrupts->xirq_min_mask_cycles == CYCLES_MAX ?
+    interrupts->xirq_max_mask_cycles :
+    interrupts->xirq_min_mask_cycles;
+  sim_io_printf (sd, "  XIRQ Min interrupts masked sequence: %s\n",
+                 cycle_to_string (interrupts->cpu, t));
+
+  t = interrupts->xirq_max_mask_cycles;
+  sim_io_printf (sd, "  XIRQ Max interrupts masked sequence: %s\n",
+                 cycle_to_string (interrupts->cpu, t));
+}
diff --git a/sim/m68hc11/interrupts.h b/sim/m68hc11/interrupts.h
new file mode 100644
index 0000000..39069cd
--- /dev/null
+++ b/sim/m68hc11/interrupts.h
@@ -0,0 +1,132 @@
+/* interrupts.h -- 68HC11 Interrupts Emulation
+   Copyright 1999, 2000 Free Software Foundation, Inc.
+   Written by Stephane Carrez (stcarrez@worldnet.fr)
+
+This file is part of GDB, GAS, and the GNU binutils.
+
+GDB, GAS, and the GNU binutils are free software; you can redistribute
+them and/or modify them under the terms of the GNU General Public
+License as published by the Free Software Foundation; either version
+1, or (at your option) any later version.
+
+GDB, GAS, and the GNU binutils are distributed in the hope that they
+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 file; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef _M6811_SIM_INTERRUPTS_H
+#define _M6811_SIM_INTERRUPTS_H
+
+/* Definition of 68HC11 interrupts.  These enum are used as an index
+   in the interrupt table.  */
+enum M6811_INT
+{
+  M6811_INT_RESERVED1 = 0,
+  M6811_INT_RESERVED2,
+  M6811_INT_RESERVED3,
+  M6811_INT_RESERVED4,
+  M6811_INT_RESERVED5,
+  M6811_INT_RESERVED6,
+  M6811_INT_RESERVED7,
+  M6811_INT_RESERVED8,
+
+  M6811_INT_RESERVED9,
+  M6811_INT_RESERVED10,
+  M6811_INT_RESERVED11,
+
+  M6811_INT_SCI,
+  M6811_INT_SPI,
+  M6811_INT_AINPUT,
+  M6811_INT_AOVERFLOW,
+  M6811_INT_TCTN,
+
+  M6811_INT_OUTCMP5,
+  M6811_INT_OUTCMP4,
+  M6811_INT_OUTCMP3,
+  M6811_INT_OUTCMP2,
+  M6811_INT_OUTCMP1,
+
+  M6811_INT_INCMP3,
+  M6811_INT_INCMP2,
+  M6811_INT_INCMP1,
+
+  M6811_INT_RT,
+  M6811_INT_IRQ,
+  M6811_INT_XIRQ,
+  M6811_INT_SWI,
+  M6811_INT_ILLEGAL,
+
+  M6811_INT_COPRESET,
+  M6811_INT_COPFAIL,
+
+  M6811_INT_RESET,
+  M6811_INT_NUMBER
+};
+
+
+/* Structure to describe how to recognize an interrupt in the
+   68hc11 IO regs.  */
+struct interrupt_def
+{
+  enum M6811_INT   int_number;
+  unsigned char    int_paddr;
+  unsigned char    int_mask;
+  unsigned char    enable_paddr;
+  unsigned char    enabled_mask;
+};
+
+/* Management of 68HC11 interrupts:
+    - We use a table of 'interrupt_def' to describe the interrupts that must be
+      raised depending on IO register flags (enable and present flags).
+    - We keep a mask of pending interrupts.  This mask is refreshed by
+      calling 'interrupts_update_pending'.  It must be refreshed each time
+      an IO register is changed.
+    - 'interrupts_process' must be called after each insn. It has two purposes:
+      first it maintains a min/max count of CPU cycles between which interrupts
+      are masked; second it checks for pending interrupts and raise one if
+      interrupts are enabled.  */
+struct interrupts {
+  struct _sim_cpu   *cpu;
+
+  /* Mask of current pending interrupts.  */
+  unsigned long     pending_mask;
+
+  /* Address of vector table.  This is set depending on the
+     68hc11 init mode.  */
+  uint16            vectors_addr;
+
+  /* Priority order of interrupts.  This is controlled by setting the HPRIO
+     IO register.  */
+  enum M6811_INT    interrupt_order[M6811_INT_NUMBER];
+
+  /* Simulator statistics to report useful debug information to users.  */
+
+  /* - Max/Min number of CPU cycles executed with interrupts masked.  */
+  signed64          start_mask_cycle;
+  signed64          min_mask_cycles;
+  signed64          max_mask_cycles;
+
+  /* - Same for XIRQ.  */
+  signed64          xirq_start_mask_cycle;
+  signed64          xirq_min_mask_cycles;
+  signed64          xirq_max_mask_cycles;
+
+  /* - Total number of interrupts raised.  */
+  unsigned long     nb_interrupts_raised;
+};
+
+extern int  interrupts_initialize     (struct _sim_cpu* cpu);
+extern void interrupts_update_pending (struct interrupts* interrupts);
+extern int  interrupts_get_current    (struct interrupts* interrupts);
+extern int  interrupts_process        (struct interrupts* interrupts);
+extern void interrupts_raise          (struct interrupts* interrupts,
+                                       enum M6811_INT number);
+
+extern void interrupts_info           (SIM_DESC sd,
+                                       struct interrupts* interrupts);
+
+#endif
diff --git a/sim/m68hc11/m68hc11_sim.c b/sim/m68hc11/m68hc11_sim.c
new file mode 100644
index 0000000..169edfa
--- /dev/null
+++ b/sim/m68hc11/m68hc11_sim.c
@@ -0,0 +1,640 @@
+/* m6811_cpu.c -- 68HC11 CPU Emulation
+   Copyright 1999, 2000 Free Software Foundation, Inc.
+   Written by Stephane Carrez (stcarrez@worldnet.fr)
+
+This file is part of GDB, GAS, and the GNU binutils.
+
+GDB, GAS, and the GNU binutils are free software; you can redistribute
+them and/or modify them under the terms of the GNU General Public
+License as published by the Free Software Foundation; either version
+1, or (at your option) any later version.
+
+GDB, GAS, and the GNU binutils are distributed in the hope that they
+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 file; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include "sim-main.h"
+#include "sim-assert.h"
+#include "sim-module.h"
+#include "sim-options.h"
+
+void cpu_free_frame (sim_cpu* cpu, struct cpu_frame *frame);
+
+enum {
+  OPTION_CPU_RESET = OPTION_START,
+  OPTION_EMUL_OS,
+  OPTION_CPU_CONFIG,
+  OPTION_CPU_MODE
+};
+
+static DECLARE_OPTION_HANDLER (cpu_option_handler);
+
+static const OPTION cpu_options[] =
+{
+  { {"cpu-reset", no_argument, NULL, OPTION_CPU_RESET },
+      '\0', NULL, "Reset the CPU",
+      cpu_option_handler },
+
+  { {"emulos",    no_argument, NULL, OPTION_EMUL_OS },
+      '\0', NULL, "Emulate some OS system calls (read, write, ...)",
+      cpu_option_handler },
+
+  { {"cpu-config", required_argument, NULL, OPTION_CPU_CONFIG },
+      '\0', NULL, "Specify the initial CPU configuration register",
+      cpu_option_handler },
+
+  { {NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL }
+};
+
+
+static SIM_RC
+cpu_option_handler (SIM_DESC sd, sim_cpu *cpu,
+                    int opt, char *arg, int is_command)
+{
+  sim_cpu *cpu;
+  int val;
+  
+  cpu = STATE_CPU (sd, 0);
+  switch (opt)
+    {
+    case OPTION_CPU_RESET:
+      sim_board_reset (sd);
+      break;
+
+    case OPTION_EMUL_OS:
+      cpu->cpu_emul_syscall = 1;
+      break;
+
+    case OPTION_CPU_CONFIG:
+      if (sscanf(arg, "0x%x", &val) == 1
+          || sscanf(arg, "%d", &val) == 1)
+        {
+          cpu->cpu_config = val;
+          cpu->cpu_use_local_config = 1;
+        }
+      else
+        cpu->cpu_use_local_config = 0;
+      break;
+      
+    case OPTION_CPU_MODE:
+      break;
+    }
+
+  return SIM_RC_OK;
+}
+
+/* Tentative to keep track of the cpu frame.  */
+struct cpu_frame*
+cpu_find_frame (sim_cpu *cpu, uint16 sp)
+{
+  struct cpu_frame_list *flist;
+
+  flist = cpu->cpu_frames;
+  while (flist)
+    {
+      struct cpu_frame *frame;
+
+      frame = flist->frame;
+      while (frame)
+	{
+	  if (frame->sp_low <= sp && frame->sp_high >= sp)
+	    {
+	      cpu->cpu_current_frame = flist;
+	      return frame;
+	    }
+
+	  frame = frame->up;
+	}
+      flist = flist->next;
+    }
+  return 0;
+}
+
+struct cpu_frame_list*
+cpu_create_frame_list (sim_cpu *cpu)
+{
+  struct cpu_frame_list *flist;
+
+  flist = (struct cpu_frame_list*) malloc (sizeof (struct cpu_frame_list));
+  flist->frame = 0;
+  flist->next  = cpu->cpu_frames;
+  flist->prev  = 0;
+  if (flist->next)
+    flist->next->prev = flist;
+  cpu->cpu_frames = flist;
+  cpu->cpu_current_frame = flist;
+  return flist;
+}
+
+void
+cpu_remove_frame_list (sim_cpu *cpu, struct cpu_frame_list *flist)
+{
+  struct cpu_frame *frame;
+  
+  if (flist->prev == 0)
+    cpu->cpu_frames = flist->next;
+  else
+    flist->prev->next = flist->next;
+  if (flist->next)
+    flist->next->prev = flist->prev;
+
+  frame = flist->frame;
+  while (frame)
+    {
+      struct cpu_frame* up = frame->up;
+      cpu_free_frame (cpu, frame);
+      frame = up;
+    }
+  free (flist);
+}
+  
+    
+struct cpu_frame*
+cpu_create_frame (sim_cpu *cpu, uint16 pc, uint16 sp)
+{
+  struct cpu_frame *frame;
+
+  frame = (struct cpu_frame*) malloc (sizeof(struct cpu_frame));
+  frame->up = 0;
+  frame->pc = pc;
+  frame->sp_low  = sp;
+  frame->sp_high = sp;
+  return frame;
+}
+
+void
+cpu_free_frame (sim_cpu *cpu, struct cpu_frame *frame)
+{
+  free (frame);
+}
+
+uint16
+cpu_frame_reg (sim_cpu *cpu, uint16 rn)
+{
+  struct cpu_frame *frame;
+
+  if (cpu->cpu_current_frame == 0)
+    return 0;
+  
+  frame = cpu->cpu_current_frame->frame;
+  while (frame)
+    {
+      if (rn == 0)
+	return frame->sp_high;
+      frame = frame->up;
+      rn--;
+    }
+  return 0;
+}
+  
+void
+cpu_call (sim_cpu *cpu, uint16 addr)
+{
+#if HAVE_FRAME
+  uint16 pc = cpu->cpu_insn_pc;
+  uint16 sp;
+  struct cpu_frame_list *flist;
+  struct cpu_frame* frame;
+  struct cpu_frame* new_frame;
+#endif
+
+  cpu_set_pc (cpu, addr);
+#if HAVE_FRAME
+  sp = cpu_get_sp (cpu);
+
+  cpu->cpu_need_update_frame = 0;
+  flist = cpu->cpu_current_frame;
+  if (flist == 0)
+    flist = cpu_create_frame_list (cpu);
+
+  frame = flist->frame;
+  if (frame && frame->sp_low > sp)
+    frame->sp_low = sp;
+
+  new_frame = cpu_create_frame (cpu, pc, sp);
+  new_frame->up = frame;
+  flist->frame = new_frame;
+#endif
+}
+
+void
+cpu_update_frame (sim_cpu *cpu, int do_create)
+{
+#if HAVE_FRAME
+  struct cpu_frame *frame;
+
+  frame = cpu_find_frame (cpu, cpu_get_sp (cpu));
+  if (frame)
+    {
+      while (frame != cpu->cpu_current_frame->frame)
+	{
+	  struct cpu_frame* up;
+	  
+	  up = cpu->cpu_current_frame->frame->up;
+	  cpu_free_frame (cpu, cpu->cpu_current_frame->frame);
+	  cpu->cpu_current_frame->frame = up;
+	}
+      return;
+    }
+
+  if (do_create)
+    {
+      cpu_create_frame_list (cpu);
+      frame = cpu_create_frame (cpu, cpu_get_pc (cpu), cpu_get_sp (cpu));
+      cpu->cpu_current_frame->frame = frame;
+    }
+#endif
+}
+
+void
+cpu_return (sim_cpu *cpu)
+{
+#if HAVE_FRAME
+  uint16 sp = cpu_get_sp (cpu);
+  struct cpu_frame *frame;
+  struct cpu_frame_list *flist;
+
+  cpu->cpu_need_update_frame = 0;
+  flist = cpu->cpu_current_frame;
+  if (flist && flist->frame && flist->frame->up)
+    {
+      frame = flist->frame->up;
+      if (frame->sp_low <= sp && frame->sp_high >= sp)
+	{
+	  cpu_free_frame (cpu, flist->frame);
+	  flist->frame = frame;
+	  return;
+	}
+    }
+  cpu_update_frame (cpu, 1);
+#endif
+}
+
+void
+cpu_print_frame (SIM_DESC sd, sim_cpu *cpu)
+{
+  struct cpu_frame* frame;
+  int level = 0;
+  
+  if (cpu->cpu_current_frame == 0 || cpu->cpu_current_frame->frame == 0)
+    {
+      sim_io_printf (sd, "No frame.\n");
+      return;
+    }
+  sim_io_printf (sd, " #   PC   SP-L  SP-H\n");
+  frame = cpu->cpu_current_frame->frame;
+  while (frame)
+    {
+      sim_io_printf (sd, "%3d 0x%04x 0x%04x 0x%04x\n",
+		     level, frame->pc, frame->sp_low, frame->sp_high);
+      frame = frame->up;
+      level++;
+    }
+}
+
+/* Set the stack pointer and re-compute the current frame.  */
+void
+cpu_set_sp (sim_cpu *cpu, uint16 val)
+{
+  cpu->cpu_regs.sp = val;
+  cpu_update_frame (cpu, 0);
+}
+
+int
+cpu_initialize (SIM_DESC sd, sim_cpu *cpu)
+{
+  int result;
+  
+  sim_add_option_table (sd, 0, cpu_options);
+
+  memset (&cpu->cpu_regs, 0, sizeof(cpu->cpu_regs));
+
+  cpu->cpu_absolute_cycle = 0;
+  cpu->cpu_current_cycle  = 0;
+  cpu->cpu_emul_syscall   = 1;
+  cpu->cpu_running        = 1;
+  cpu->cpu_stop_on_interrupt = 0;
+  cpu->cpu_frequency = 8 * 1000 * 1000;
+  cpu->cpu_frames = 0;
+  cpu->cpu_current_frame = 0;
+  cpu->cpu_use_elf_start = 0;
+  cpu->cpu_elf_start     = 0;
+  cpu->cpu_use_local_config = 0;
+  cpu->cpu_config        = M6811_NOSEC | M6811_NOCOP | M6811_ROMON |
+    M6811_EEON;
+  result = interrupts_initialize (cpu);
+
+  cpu->cpu_is_initialized = 1;
+  return result;
+}
+
+
+/* Reinitialize the processor after a reset.  */
+int
+cpu_reset (sim_cpu *cpu)
+{
+  cpu->cpu_need_update_frame = 0;
+  cpu->cpu_current_frame = 0;
+  while (cpu->cpu_frames)
+    cpu_remove_frame_list (cpu, cpu->cpu_frames);
+
+  /* Initialize the config register.
+     It is only initialized at reset time.  */
+  memset (cpu->ios, 0, sizeof (cpu->ios));
+  cpu->ios[M6811_INIT] = 0x1;
+
+  /* Output compare registers set to 0xFFFF.  */
+  cpu->ios[M6811_TOC1_H] = 0xFF;
+  cpu->ios[M6811_TOC1_L] = 0xFF;
+  cpu->ios[M6811_TOC2_H] = 0xFF;
+  cpu->ios[M6811_TOC2_L] = 0xFF;
+  cpu->ios[M6811_TOC3_H] = 0xFF;
+  cpu->ios[M6811_TOC4_L] = 0xFF;
+  cpu->ios[M6811_TOC5_H] = 0xFF;
+  cpu->ios[M6811_TOC5_L] = 0xFF;
+
+  /* Setup the processor registers.  */
+  memset (&cpu->cpu_regs, 0, sizeof(cpu->cpu_regs));
+  cpu->cpu_absolute_cycle = 0;
+  cpu->cpu_current_cycle  = 0;
+  cpu->cpu_is_initialized = 0;
+
+  /* Reinitialize the CPU operating mode.  */
+  cpu->ios[M6811_HPRIO] = cpu->cpu_mode;
+  return 0;
+}
+
+/* Reinitialize the processor after a reset.  */
+int
+cpu_restart (sim_cpu *cpu)
+{
+  uint16 addr;
+
+  /* Get CPU starting address depending on the CPU mode.  */
+  if (cpu->cpu_use_elf_start == 0)
+    {
+      switch ((cpu->ios[M6811_HPRIO]) & (M6811_SMOD | M6811_MDA))
+        {
+          /* Single Chip  */
+        default:
+        case 0 :
+          addr = memory_read16 (cpu, 0xFFFE);
+          break;
+
+          /* Expanded Multiplexed  */
+        case M6811_MDA:
+          addr = memory_read16 (cpu, 0xFFFE);
+          break;
+
+          /* Special Bootstrap  */
+        case M6811_SMOD:
+          addr = 0;
+          break;
+
+          /* Factory Test  */
+        case M6811_MDA | M6811_SMOD:
+          addr = memory_read16 (cpu, 0xFFFE);
+          break;
+        }
+    }
+  else
+    {
+      addr = cpu->cpu_elf_start;
+    }
+  
+  /* Setup the processor registers.  */
+  cpu->cpu_insn_pc  = addr;
+  cpu->cpu_regs.pc  = addr;
+  cpu->cpu_regs.ccr = M6811_X_BIT | M6811_I_BIT | M6811_S_BIT;
+  cpu->cpu_absolute_cycle = 0;
+  cpu->cpu_is_initialized = 1;
+  cpu->cpu_current_cycle  = 0;
+
+  cpu_call (cpu, addr);
+  
+  return 0;
+}
+
+void
+print_io_reg_desc (SIM_DESC sd, io_reg_desc *desc, int val, int mode)
+{
+  while (desc->mask)
+    {
+      if (val & desc->mask)
+	sim_io_printf (sd, "%s",
+		       mode == 0 ? desc->short_name : desc->long_name);
+      desc++;
+    }
+}
+
+void
+print_io_byte (SIM_DESC sd, const char *name, io_reg_desc *desc,
+	       uint8 val, uint16 addr)
+{
+  sim_io_printf (sd, "  %-9.9s @ 0x%04x 0x%02x ", name, addr, val);
+  if (desc)
+    print_io_reg_desc (sd, desc, val, 0);
+}
+
+void
+cpu_ccr_update_tst8 (sim_cpu *proc, uint8 val)
+{
+  cpu_set_ccr_V (proc, 0);
+  cpu_set_ccr_N (proc, val & 0x80 ? 1 : 0);
+  cpu_set_ccr_Z (proc, val == 0 ? 1 : 0);
+}
+
+
+uint16
+cpu_fetch_relbranch (sim_cpu *cpu)
+{
+  uint16 addr = (uint16) cpu_fetch8 (cpu);
+
+  if (addr & 0x0080)
+    {
+      addr |= 0xFF00;
+    }
+  addr += cpu->cpu_regs.pc;
+  return addr;
+}
+
+
+/* Push all the CPU registers (when an interruption occurs).  */
+void
+cpu_push_all (sim_cpu *cpu)
+{
+  cpu_push_uint16 (cpu, cpu->cpu_regs.pc);
+  cpu_push_uint16 (cpu, cpu->cpu_regs.iy);
+  cpu_push_uint16 (cpu, cpu->cpu_regs.ix);
+  cpu_push_uint16 (cpu, cpu->cpu_regs.d);
+  cpu_push_uint8 (cpu, cpu->cpu_regs.ccr);
+}
+
+
+/* Handle special instructions.  */
+void
+cpu_special (sim_cpu *cpu, enum M6811_Special special)
+{
+  switch (special)
+    {
+    case M6811_RTI:
+      {
+        uint8 ccr;
+
+        ccr = cpu_pop_uint8 (cpu);
+        cpu_set_ccr (cpu, ccr);
+        cpu_set_d (cpu, cpu_pop_uint16 (cpu));
+        cpu_set_x (cpu, cpu_pop_uint16 (cpu));
+        cpu_set_y (cpu, cpu_pop_uint16 (cpu));
+        cpu_set_pc (cpu, cpu_pop_uint16 (cpu));
+	cpu_return (cpu);
+        break;
+      }
+      
+    case M6811_WAI:
+      /* In the ELF-start mode, we are in a special mode where
+	 the WAI corresponds to an exit.  */
+      if (cpu->cpu_use_elf_start)
+        {
+          cpu_set_pc (cpu, cpu->cpu_insn_pc);
+          sim_engine_halt (CPU_STATE (cpu), cpu,
+                           NULL, NULL_CIA, sim_exited,
+                           cpu_get_d (cpu));
+          return;
+        }
+      /* SCz: not correct... */
+      cpu_push_all (cpu);
+      break;
+      
+    case M6811_SWI:
+      interrupts_raise (&cpu->cpu_interrupts, M6811_INT_SWI);
+      interrupts_process (&cpu->cpu_interrupts);
+      break;
+      
+    case M6811_EMUL_SYSCALL:
+    case M6811_ILLEGAL:
+      if (cpu->cpu_emul_syscall)
+        {
+          uint8 op = memory_read8 (cpu,
+                                   cpu_get_pc (cpu) - 1);
+          if (op == 0x41)
+            {
+	      cpu_set_pc (cpu, cpu->cpu_insn_pc);
+	      sim_engine_halt (CPU_STATE (cpu), cpu,
+			       NULL, NULL_CIA, sim_exited,
+			       cpu_get_d (cpu));
+	      return;
+            }
+          else
+            {
+              emul_os (op, cpu);
+            }
+          return;
+        }
+      
+      interrupts_raise (&cpu->cpu_interrupts, M6811_INT_ILLEGAL);
+      interrupts_process (&cpu->cpu_interrupts);
+      break;
+
+    case M6811_TEST:
+      {
+        SIM_DESC sd;
+
+        sd = CPU_STATE (cpu);
+
+        /* Breakpoint instruction if we are under gdb.  */
+        if (STATE_OPEN_KIND (sd) == SIM_OPEN_DEBUG)
+          {
+            cpu->cpu_regs.pc --;
+            sim_engine_halt (CPU_STATE (cpu), cpu,
+                             0, cpu_get_pc (cpu), sim_stopped,
+                             SIM_SIGTRAP);
+          }
+        /* else this is a nop but not in test factory mode.  */
+        break;
+      }
+    }
+}
+
+
+void
+cpu_single_step (sim_cpu *cpu)
+{
+  cpu->cpu_current_cycle = 0;
+  cpu->cpu_insn_pc = cpu_get_pc (cpu);
+
+  /* Handle the pending interrupts.  If an interrupt is handled,
+     treat this as an single step.  */
+  if (interrupts_process (&cpu->cpu_interrupts))
+    {
+      cpu->cpu_absolute_cycle += cpu->cpu_current_cycle;
+      return;
+    }
+  
+  /*  printf("PC = 0x%04x\n", cpu_get_pc (cpu));*/
+  cpu_interp (cpu);
+  cpu->cpu_absolute_cycle += cpu->cpu_current_cycle;
+}
+
+/* VARARGS */
+void
+sim_memory_error (sim_cpu *cpu, SIM_SIGNAL excep,
+		  uint16 addr, const char *message, ...)
+{
+  char buf[1024];
+  va_list args;
+
+  va_start (args, message);
+  vsprintf (buf, message, args);
+  va_end (args);
+
+  printf("%s\n", buf);
+  cpu_memory_exception (cpu, excep, addr, buf);
+}
+
+
+void
+cpu_memory_exception (sim_cpu *cpu, SIM_SIGNAL excep,
+                      uint16 addr, const char *message)
+{
+  if (cpu->cpu_running == 0)
+    return;
+
+  cpu_set_pc (cpu, cpu->cpu_insn_pc);
+  sim_engine_halt (CPU_STATE (cpu), cpu, NULL,
+                   cpu_get_pc (cpu), sim_stopped, excep);
+  
+#if 0
+  cpu->mem_exception = excep;
+  cpu->fault_addr    = addr;
+  cpu->fault_msg     = strdup (message);
+
+  if (cpu->cpu_use_handler)
+    {
+      longjmp (&cpu->cpu_exception_handler, 1);
+    }
+  (* cpu->callback->printf_filtered)
+    (cpu->callback, "Fault at 0x%04x: %s\n", addr, message);
+#endif
+}
+
+void
+cpu_info (SIM_DESC sd, sim_cpu *cpu)
+{
+  sim_io_printf (sd, "CPU info:\n");
+  sim_io_printf (sd, "  Absolute cycle: %s\n",
+                 cycle_to_string (cpu, cpu->cpu_absolute_cycle));
+  
+  sim_io_printf (sd, "  Syscall emulation: %s\n",
+                 cpu->cpu_emul_syscall ? "yes, via 0xcd <n>" : "no");
+  sim_io_printf (sd, "  Memory errors detection: %s\n",
+                 cpu->cpu_check_memory ? "yes" : "no");
+  sim_io_printf (sd, "  Stop on interrupt: %s\n",
+                 cpu->cpu_stop_on_interrupt ? "yes" : "no");
+}
+
diff --git a/sim/m68hc11/sim-main.h b/sim/m68hc11/sim-main.h
new file mode 100644
index 0000000..6b2575c
--- /dev/null
+++ b/sim/m68hc11/sim-main.h
@@ -0,0 +1,493 @@
+/* sim-main.h -- Simulator for Motorola 68HC11
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Written by Stephane Carrez (stcarrez@worldnet.fr)
+
+This file is part of GDB, the GNU debugger.
+
+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 _SIM_MAIN_H
+#define _SIM_MAIN_H
+
+#define WITH_MODULO_MEMORY 1
+#define WITH_WATCHPOINTS 1
+#define SIM_HANDLES_LMA 1
+
+#include "sim-basics.h"
+
+typedef address_word sim_cia;
+
+#include "sim-signal.h"
+#include "sim-base.h"
+
+#include "bfd.h"
+
+#include "opcode/m68hc11.h"
+
+#include "callback.h"
+#include "remote-sim.h"
+#include "opcode/m68hc11.h"
+#include "sim-types.h"
+
+typedef unsigned8 uint8;
+typedef unsigned16 uint16;
+typedef signed16 int16;
+typedef unsigned32 uint32;
+typedef signed32 int32;
+typedef unsigned64 uint64;
+typedef signed64 int64;
+
+struct _sim_cpu;
+
+#include "interrupts.h"
+#include <setjmp.h>
+
+/* Specifies the level of mapping for the IO, EEprom, nvram and external
+   RAM.  IO registers are mapped over everything and the external RAM
+   is last (ie, it can be hidden by everything above it in the list).  */
+enum m68hc11_map_level
+{
+  M6811_IO_LEVEL,
+  M6811_EEPROM_LEVEL,
+  M6811_NVRAM_LEVEL,
+  M6811_RAM_LEVEL
+};
+
+
+#define X_REGNUM 	0
+#define D_REGNUM	1
+#define Y_REGNUM        2
+#define SP_REGNUM 	3
+#define PC_REGNUM 	4
+#define A_REGNUM        5
+#define B_REGNUM        6
+#define PSW_REGNUM 	7
+#define Z_REGNUM        8
+
+typedef struct m6811_regs {
+    unsigned short      d;
+    unsigned short      ix;
+    unsigned short      iy;
+    unsigned short      sp;
+    unsigned short      pc;
+    unsigned char       ccr;
+} m6811_regs;
+
+
+/* Description of 68HC11 IO registers.  Such description is only provided
+   for the info command to display the current setting of IO registers
+   from GDB.  */
+struct io_reg_desc
+{
+  int        mask;
+  const char *short_name;
+  const char *long_name;
+};
+typedef struct io_reg_desc io_reg_desc;
+
+extern void print_io_reg_desc (SIM_DESC sd, io_reg_desc *desc, int val,
+			       int mode);
+extern void print_io_byte (SIM_DESC sd, const char *name,
+			   io_reg_desc *desc, uint8 val, uint16 addr);
+
+
+/* List of special 68HC11 instructions that are not handled by the
+   'gencode.c' generator.  These complex instructions are implemented
+   by 'cpu_special'.  */
+enum M6811_Special
+{
+  M6811_RTI,
+  M6811_WAI,
+  M6811_SWI,
+  M6811_TEST,
+  M6811_ILLEGAL,
+  M6811_EMUL_SYSCALL
+};
+
+#define CPU_POP 1
+#define CPU_PUSH 2
+
+#define MAX_PORTS 0x40
+
+/* Tentative to keep track of the stack frame.
+   The frame is updated each time a call or a return are made.
+   We also have to take into account changes of stack pointer
+   (either thread switch or longjmp).  */
+struct cpu_frame 
+{
+  struct cpu_frame *up;
+  uint16 pc;
+  uint16 sp_low;
+  uint16 sp_high;
+};
+
+/* Represents a list of frames (or a thread).  */
+struct cpu_frame_list
+{
+  struct cpu_frame_list *next;
+  struct cpu_frame_list *prev;
+  struct cpu_frame      *frame;
+};
+
+struct _sim_cpu {
+  /* CPU registers.  */
+  struct m6811_regs     cpu_regs;
+
+  /* CPU interrupts.  */
+  struct interrupts     cpu_interrupts;
+
+  struct cpu_frame_list *cpu_frames;
+  struct cpu_frame_list *cpu_current_frame;
+  int                   cpu_need_update_frame;
+
+  /* CPU absolute cycle time.  The cycle time is updated after
+     each instruction, by the number of cycles taken by the instruction.
+     It is cleared only when reset occurs.  */
+  signed64              cpu_absolute_cycle;
+
+  /* Number of cycles to increment after the current instruction.
+     This is also the number of ticks for the generic event scheduler.  */
+  uint8                 cpu_current_cycle;
+  int                   cpu_emul_syscall;
+  int                   cpu_is_initialized;
+  int                   cpu_running;
+  int                   cpu_check_memory;
+  int                   cpu_stop_on_interrupt;
+
+  /* When this is set, start execution of program at address specified
+     in the ELF header.  This is used for testing some programs that do not
+     have an interrupt table linked with them.  Programs created during the
+     GCC validation are like this. A normal 68HC11 does not behave like
+     this (unless there is some OS or downloadable feature).  */
+  int                   cpu_use_elf_start;
+
+  /* The starting address specified in ELF header.  */
+  int                   cpu_elf_start;
+  
+  uint16                cpu_insn_pc;
+
+  /* CPU frequency.  This is the quartz frequency.  It is divided by 4 to
+     get the cycle time.  This is used for the timer rate and for the baud
+     rate generation.  */
+  unsigned long         cpu_frequency;
+
+  /* The mode in which the CPU is configured (MODA and MODB pins).  */
+  unsigned int          cpu_mode;
+
+  /* Initial value of the CONFIG register.  */
+  uint8                 cpu_config;
+  uint8                 cpu_use_local_config;
+  
+  uint8 ios[0x3F];
+  
+  /* ... base type ... */
+  sim_cpu_base base;
+};
+
+/* Returns the cpu absolute cycle time (A virtual counter incremented
+   at each 68HC11 E clock).  */
+#define cpu_current_cycle(PROC) ((PROC)->cpu_absolute_cycle)
+#define cpu_add_cycles(PROC,T)  ((PROC)->cpu_current_cycle += (signed64) (T))
+#define cpu_is_running(PROC)    ((PROC)->cpu_running)
+
+/* Get the IO/RAM base addresses depending on the M6811_INIT register.  */
+#define cpu_get_io_base(PROC) \
+        (((uint16)(((PROC)->ios[M6811_INIT]) & 0x0F))<<12)
+#define cpu_get_reg_base(PROC) \
+        (((uint16)(((PROC)->ios[M6811_INIT]) & 0xF0))<<8)
+
+/* Returns the different CPU registers.  */
+#define cpu_get_ccr(PROC)          ((PROC)->cpu_regs.ccr)
+#define cpu_get_pc(PROC)           ((PROC)->cpu_regs.pc)
+#define cpu_get_d(PROC)            ((PROC)->cpu_regs.d)
+#define cpu_get_x(PROC)            ((PROC)->cpu_regs.ix)
+#define cpu_get_y(PROC)            ((PROC)->cpu_regs.iy)
+#define cpu_get_sp(PROC)           ((PROC)->cpu_regs.sp)
+#define cpu_get_a(PROC)            ((PROC->cpu_regs.d >> 8) & 0x0FF)
+#define cpu_get_b(PROC)            ((PROC->cpu_regs.d) & 0x0FF)
+
+#define cpu_set_d(PROC,VAL)        (((PROC)->cpu_regs.d) = (VAL))
+#define cpu_set_x(PROC,VAL)        (((PROC)->cpu_regs.ix) = (VAL))
+#define cpu_set_y(PROC,VAL)        (((PROC)->cpu_regs.iy) = (VAL))
+
+#if 0
+/* This is a function in m68hc11_sim.c to keep track of the frame.  */
+#define cpu_set_sp(PROC,VAL)       (((PROC)->cpu_regs.sp) = (VAL))
+#endif
+
+#define cpu_set_pc(PROC,VAL)       (((PROC)->cpu_regs.pc) = (VAL))
+
+#define cpu_set_a(PROC,VAL)  \
+      cpu_set_d(PROC,((VAL) << 8) | cpu_get_b(PROC))
+#define cpu_set_b(PROC,VAL)  \
+      cpu_set_d(PROC,((cpu_get_a(PROC)) << 8)|(VAL & 0x0FF))
+
+#define cpu_set_ccr(PROC,VAL)      ((PROC)->cpu_regs.ccr = (VAL))
+#define cpu_get_ccr_H(PROC)        ((cpu_get_ccr(PROC) & M6811_H_BIT) ? 1: 0)
+#define cpu_get_ccr_X(PROC)        ((cpu_get_ccr(PROC) & M6811_X_BIT) ? 1: 0)
+#define cpu_get_ccr_S(PROC)        ((cpu_get_ccr(PROC) & M6811_S_BIT) ? 1: 0)
+#define cpu_get_ccr_N(PROC)        ((cpu_get_ccr(PROC) & M6811_N_BIT) ? 1: 0)
+#define cpu_get_ccr_V(PROC)        ((cpu_get_ccr(PROC) & M6811_V_BIT) ? 1: 0)
+#define cpu_get_ccr_C(PROC)        ((cpu_get_ccr(PROC) & M6811_C_BIT) ? 1: 0)
+#define cpu_get_ccr_Z(PROC)        ((cpu_get_ccr(PROC) & M6811_Z_BIT) ? 1: 0)
+#define cpu_get_ccr_I(PROC)        ((cpu_get_ccr(PROC) & M6811_I_BIT) ? 1: 0)
+
+#define cpu_set_ccr_flag(S,B,V) \
+cpu_set_ccr(S,(cpu_get_ccr(S) & ~(B)) | ((V) ? B : 0))
+
+#define cpu_set_ccr_H(PROC,VAL)    cpu_set_ccr_flag(PROC, M6811_H_BIT, VAL)
+#define cpu_set_ccr_X(PROC,VAL)    cpu_set_ccr_flag(PROC, M6811_X_BIT, VAL)
+#define cpu_set_ccr_S(PROC,VAL)    cpu_set_ccr_flag(PROC, M6811_S_BIT, VAL)
+#define cpu_set_ccr_N(PROC,VAL)    cpu_set_ccr_flag(PROC, M6811_N_BIT, VAL)
+#define cpu_set_ccr_V(PROC,VAL)    cpu_set_ccr_flag(PROC, M6811_V_BIT, VAL)
+#define cpu_set_ccr_C(PROC,VAL)    cpu_set_ccr_flag(PROC, M6811_C_BIT, VAL)
+#define cpu_set_ccr_Z(PROC,VAL)    cpu_set_ccr_flag(PROC, M6811_Z_BIT, VAL)
+#define cpu_set_ccr_I(PROC,VAL)    cpu_set_ccr_flag(PROC, M6811_I_BIT, VAL)
+
+#undef inline
+#define inline static __inline__
+
+extern void cpu_memory_exception (struct _sim_cpu *proc,
+                                  SIM_SIGNAL excep,
+                                  uint16 addr,
+                                  const char *message);
+
+inline uint8
+memory_read8 (sim_cpu *cpu, uint16 addr)
+{
+  uint8 val;
+  
+  if (sim_core_read_buffer (CPU_STATE (cpu), cpu, 0, &val, addr, 1) != 1)
+    {
+      cpu_memory_exception (cpu, SIM_SIGSEGV, addr,
+                            "Read error");
+    }
+  return val;
+}
+
+inline void
+memory_write8 (sim_cpu *cpu, uint16 addr, uint8 val)
+{
+  if (sim_core_write_buffer (CPU_STATE (cpu), cpu, 0, &val, addr, 1) != 1)
+    {
+      cpu_memory_exception (cpu, SIM_SIGSEGV, addr,
+                            "Write error");
+    }
+}
+
+inline uint16
+memory_read16 (sim_cpu *cpu, uint16 addr)
+{
+  uint8 b[2];
+  
+  if (sim_core_read_buffer (CPU_STATE (cpu), cpu, 0, b, addr, 2) != 2)
+    {
+      cpu_memory_exception (cpu, SIM_SIGSEGV, addr,
+                            "Read error");
+    }
+  return (((uint16) (b[0])) << 8) | ((uint16) b[1]);
+}
+
+inline void
+memory_write16 (sim_cpu *cpu, uint16 addr, uint16 val)
+{
+  uint8 b[2];
+
+  b[0] = val >> 8;
+  b[1] = val;
+  if (sim_core_write_buffer (CPU_STATE (cpu), cpu, 0, b, addr, 2) != 2)
+    {
+      cpu_memory_exception (cpu, SIM_SIGSEGV, addr,
+                            "Write error");
+    }
+}
+extern void
+cpu_ccr_update_tst8 (sim_cpu *proc, uint8 val);
+
+     inline void
+cpu_ccr_update_tst16 (sim_cpu *proc, uint16 val)
+{
+  cpu_set_ccr_V (proc, 0);
+  cpu_set_ccr_N (proc, val & 0x8000 ? 1 : 0);
+  cpu_set_ccr_Z (proc, val == 0 ? 1 : 0);
+}
+
+     inline void
+cpu_ccr_update_shift8 (sim_cpu *proc, uint8 val)
+{
+  cpu_set_ccr_N (proc, val & 0x80 ? 1 : 0);
+  cpu_set_ccr_Z (proc, val == 0 ? 1 : 0);
+  cpu_set_ccr_V (proc, cpu_get_ccr_N (proc) ^ cpu_get_ccr_C (proc));
+}
+
+     inline void
+cpu_ccr_update_shift16 (sim_cpu *proc, uint16 val)
+{
+  cpu_set_ccr_N (proc, val & 0x8000 ? 1 : 0);
+  cpu_set_ccr_Z (proc, val == 0 ? 1 : 0);
+  cpu_set_ccr_V (proc, cpu_get_ccr_N (proc) ^ cpu_get_ccr_C (proc));
+}
+
+inline void
+cpu_ccr_update_add8 (sim_cpu *proc, uint8 r, uint8 a, uint8 b)
+{
+  cpu_set_ccr_C (proc, ((a & b) | (b & ~r) | (a & ~r)) & 0x80 ? 1 : 0);
+  cpu_set_ccr_V (proc, ((a & b & ~r) | (~a & ~b & r)) & 0x80 ? 1 : 0);
+  cpu_set_ccr_Z (proc, r == 0);
+  cpu_set_ccr_N (proc, r & 0x80 ? 1 : 0);
+}
+
+
+inline void
+cpu_ccr_update_sub8 (sim_cpu *proc, uint8 r, uint8 a, uint8 b)
+{
+  cpu_set_ccr_C (proc, ((~a & b) | (b & r) | (~a & r)) & 0x80 ? 1 : 0);
+  cpu_set_ccr_V (proc, ((a & ~b & ~r) | (~a & b & r)) & 0x80 ? 1 : 0);
+  cpu_set_ccr_Z (proc, r == 0);
+  cpu_set_ccr_N (proc, r & 0x80 ? 1 : 0);
+}
+
+inline void
+cpu_ccr_update_add16 (sim_cpu *proc, uint16 r, uint16 a, uint16 b)
+{
+  cpu_set_ccr_C (proc, ((a & b) | (b & ~r) | (a & ~r)) & 0x8000 ? 1 : 0);
+  cpu_set_ccr_V (proc, ((a & b & ~r) | (~a & ~b & r)) & 0x8000 ? 1 : 0);
+  cpu_set_ccr_Z (proc, r == 0);
+  cpu_set_ccr_N (proc, r & 0x8000 ? 1 : 0);
+}
+
+inline void
+cpu_ccr_update_sub16 (sim_cpu *proc, uint16 r, uint16 a, uint16 b)
+{
+  cpu_set_ccr_C (proc, ((~a & b) | (b & r) | (~a & r)) & 0x8000 ? 1 : 0);
+  cpu_set_ccr_V (proc, ((a & ~b & ~r) | (~a & b & r)) & 0x8000 ? 1 : 0);
+  cpu_set_ccr_Z (proc, r == 0);
+  cpu_set_ccr_N (proc, r & 0x8000 ? 1 : 0);
+}
+
+
+inline void
+cpu_push_uint8 (sim_cpu *proc, uint8 val)
+{
+  uint16 addr = proc->cpu_regs.sp;
+
+  memory_write8 (proc, addr, val);
+  proc->cpu_regs.sp = addr - 1;
+  proc->cpu_need_update_frame |= CPU_PUSH;
+}
+
+inline void
+cpu_push_uint16 (sim_cpu *proc, uint16 val)
+{
+  uint16 addr = proc->cpu_regs.sp - 1;
+
+  memory_write16 (proc, addr, val);
+  proc->cpu_regs.sp = addr - 1;
+  proc->cpu_need_update_frame |= CPU_PUSH;
+}
+
+inline uint8
+cpu_pop_uint8 (sim_cpu *proc)
+{
+  uint16 addr = proc->cpu_regs.sp;
+  uint8 val;
+  
+  val = memory_read8 (proc, addr + 1);
+  proc->cpu_regs.sp = addr + 1;
+  proc->cpu_need_update_frame |= CPU_POP;
+  return val;
+}
+
+inline uint16
+cpu_pop_uint16 (sim_cpu *proc)
+{
+  uint16 addr = proc->cpu_regs.sp;
+  uint16 val;
+  
+  val = memory_read16 (proc, addr + 1);
+  proc->cpu_regs.sp = addr + 2;
+  proc->cpu_need_update_frame |= CPU_POP;
+  return val;
+}
+
+inline uint8
+cpu_fetch8 (sim_cpu *proc)
+{
+  uint16 addr = proc->cpu_regs.pc;
+  uint8 val;
+  
+  val = memory_read8 (proc, addr);
+  proc->cpu_regs.pc = addr + 1;
+  return val;
+}
+
+inline uint16
+cpu_fetch16 (sim_cpu *proc)
+{
+  uint16 addr = proc->cpu_regs.pc;
+  uint16 val;
+  
+  val = memory_read16 (proc, addr);
+  proc->cpu_regs.pc = addr + 2;
+  return val;
+}
+
+extern void cpu_call (sim_cpu* proc, uint16 addr);
+extern void cpu_special (sim_cpu *proc, enum M6811_Special special);
+
+extern uint16 cpu_fetch_relbranch (sim_cpu *proc);
+extern void cpu_push_all (sim_cpu *proc);
+extern void cpu_single_step (sim_cpu *proc);
+
+extern void cpu_info (SIM_DESC sd, sim_cpu *proc);
+
+extern int cpu_initialize (SIM_DESC sd, sim_cpu *cpu);
+
+extern void cpu_print_frame (SIM_DESC sd, sim_cpu *cpu);
+extern void cpu_set_sp (sim_cpu *cpu, uint16 val);
+extern uint16 cpu_frame_reg (sim_cpu *cpu, uint16 rn);
+extern int cpu_reset (sim_cpu *cpu);
+extern int cpu_restart (sim_cpu *cpu);
+extern void sim_memory_error (sim_cpu *cpu, SIM_SIGNAL excep,
+                              uint16 addr, const char *message, ...);
+extern void emul_os (int op, sim_cpu *cpu);
+extern void cpu_interp (sim_cpu *cpu);
+
+/* The current state of the processor; registers, memory, etc.  */
+
+#define CIA_GET(CPU)      (cpu_get_pc (CPU))
+#define CIA_SET(CPU,VAL)  (cpu_set_pc ((CPU), (VAL)))
+
+#if (WITH_SMP)
+#define STATE_CPU(sd,n) (&(sd)->cpu[n])
+#else
+#define STATE_CPU(sd,n) (&(sd)->cpu[0])
+#endif
+
+struct sim_state {
+  sim_cpu        cpu[MAX_NR_PROCESSORS];
+  device         *devices;
+  sim_state_base base;
+};
+
+extern void sim_set_profile (int n);
+extern void sim_set_profile_size (int n);
+extern void sim_board_reset (SIM_DESC sd);
+
+extern const char *cycle_to_string (sim_cpu *cpu, signed64 t);
+
+#endif
+
+
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index a6e059c..5273dbf 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,26 @@
+2000-10-19  Frank Ch. Eigler  <fche@redhat.com>
+
+	On advice from Chris G. Demetriou <cgd@sibyte.com>:
+	* sim-main.h (GPR_CLEAR): Remove unused alternative macro.
+
+Thu Jul 27 22:02:05 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	From Maciej W. Rozycki <macro@ds2.pg.gda.pl>:
+	* Makefile.in: Don't delete *.igen when cleaning directory.
+
+Wed Jul 19 18:50:51 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* m16.igen (break): Call SignalException not sim_engine_halt.
+
+Mon Jul  3 11:13:20 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	From Jason Eckhardt:
+	* mips.igen (MOVZ.fmt, MOVN.fmt): Move conditional on GPR[RT].
+
+Tue Jun 13 20:52:07 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* mips.igen (MxC1, DMxC1): Fix printf formatting.
+
 2000-05-24  Michael Hayes  <mhayes@cygnus.com>
 
 	* mips.igen (do_dmultx): Fix typo.
diff --git a/sim/mips/Makefile.in b/sim/mips/Makefile.in
index 3e4bd5f..9883175 100644
--- a/sim/mips/Makefile.in
+++ b/sim/mips/Makefile.in
@@ -289,5 +289,5 @@
 	rm -f $(BUILT_SRC_FROM_IGEN)
 	rm -f $(BUILT_SRC_FROM_M16)
 	rm -f tmp-*
-	rm -f m16* m32* itable*
+	rm -f m16*.o m32*.o itable*.o
 
diff --git a/sim/mips/m16.igen b/sim/mips/m16.igen
index 9b36ff9..833d7ca 100644
--- a/sim/mips/m16.igen
+++ b/sim/mips/m16.igen
@@ -1232,5 +1232,5 @@
     PC = cia - 2; /* reference the branch instruction */
   else
     PC = cia;
-  sim_engine_halt (SD, CPU, NULL, cia, sim_stopped, SIM_SIGTRAP);
+  SignalException (BreakPoint, instruction_0);
 }
diff --git a/sim/mips/mips.igen b/sim/mips/mips.igen
index 585e83a..f8263f4 100644
--- a/sim/mips/mips.igen
+++ b/sim/mips/mips.igen
@@ -3034,8 +3034,8 @@
 	{
 	  if (STATE_VERBOSE_P(SD))
 	    sim_io_eprintf (SD, 
-	      "Warning: PC 0x%x: semantic_DMxC1_COP1Sa 32-bit use of odd FPR number\n",
-	      CIA);
+	      "Warning: PC 0x%lx: semantic_DMxC1_COP1Sa 32-bit use of odd FPR number\n",
+	      (long) CIA);
 	  PENDING_FILL(RT,SET64HI(0xDEADC0DE) | 0xBAD0BAD0);
 	}
     }
@@ -3209,7 +3209,8 @@
 	{
 	  if (STATE_VERBOSE_P(SD))
 	    sim_io_eprintf (SD, 
-	      "Warning:  PC 0x%x: MTC1 not DMTC1 with 64 bit regs\n", CIA);
+			    "Warning:  PC 0x%lx: MTC1 not DMTC1 with 64 bit regs\n",
+			    (long) CIA);
 	  PENDING_FILL ((FS + FGRIDX), (SET64HI(0xDEADC0DE) | VL4_8(GPR[RT])));
 	}
       else
@@ -3282,16 +3283,14 @@
 
 
 010001,10,3.FMT,5.RT,5.FS,5.FD,010011:COP1:32::MOVN.fmt
+"movn.%s<FMT> f<FD>, f<FS>, r<RT>"
 *mipsIV:
 *vr5000:
 {
-  unsigned32 instruction = instruction_0;
-  int destreg = ((instruction >> 6) & 0x0000001F);
-  int fs = ((instruction >> 11) & 0x0000001F);
-  int format = ((instruction >> 21) & 0x00000007);
-  {
-    StoreFPR(destreg,format,ValueFPR(fs,format));
-  }
+  if (GPR[RT] != 0)
+    StoreFPR (FD, FMT, ValueFPR (FS, FMT));
+  else
+    StoreFPR (FD, FMT, ValueFPR (FD, FMT));
 }
 
 
@@ -3307,13 +3306,10 @@
 *mipsIV:
 *vr5000:
 {
-  unsigned32 instruction = instruction_0;
-  int destreg = ((instruction >> 6) & 0x0000001F);
-  int fs = ((instruction >> 11) & 0x0000001F);
-  int format = ((instruction >> 21) & 0x00000007);
-  {
-   StoreFPR(destreg,format,ValueFPR(fs,format));
-  }
+  if (GPR[RT] == 0)
+    StoreFPR (FD, FMT, ValueFPR (FS, FMT));
+  else
+    StoreFPR (FD, FMT, ValueFPR (FD, FMT));
 }
 
 
diff --git a/sim/mips/sim-main.h b/sim/mips/sim-main.h
index 4ec46e9..7db51a1 100644
--- a/sim/mips/sim-main.h
+++ b/sim/mips/sim-main.h
@@ -773,12 +773,7 @@
 char* pr_uword64 PARAMS ((uword64 addr));
 
 
-/* Some mips flavours split their GPR banks into two halves. */
-#ifdef SPLIT_GPR
-#define GPR_CLEAR(N) do { GPR_SET((N),0); GPR1_SET((N),0); } while (0)
-#else
 #define GPR_CLEAR(N) do { GPR_SET((N),0); } while (0)
-#endif
 
 void mips_cpu_exception_trigger(SIM_DESC sd, sim_cpu* cpu, address_word pc);
 void mips_cpu_exception_suspend(SIM_DESC sd, sim_cpu* cpu, int exception);
diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index 13da6be..3d76d2c 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -1,3 +1,12 @@
+Wed Aug  9 02:24:53 2000  Graham Stott  <grahams@cygnus.co.uk>
+
+	* am33.igen: Warning clean-up.
+	(movm): Initialize PC and mask.
+	(mov, movbu, movhu): Set srcreg2 from RI0.
+	(bsch): Initialize c.
+	(sat16_cmp): Actually do the comparison.
+	(mov_llt): Do not overwrite dstreg with uninitialized variable.
+
 Tue May 23 21:39:23 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/mn10300/am33.igen b/sim/mn10300/am33.igen
index b5d0a85..a5745e2 100644
--- a/sim/mn10300/am33.igen
+++ b/sim/mn10300/am33.igen
@@ -287,6 +287,9 @@
   unsigned32 usp = State.regs[REG_USP];
   unsigned32 mask;
 
+  PC = cia;
+  mask = REGS;
+
   if (STATE_ARCHITECTURE (sd)->mach == bfd_mach_am33
       )
     {
@@ -1578,6 +1581,7 @@
   if (start == -1)
     start = 31;
     
+  c = 0;
   for (i = start; i >= 0; i--)
     {
       if (temp & (1 << i))
@@ -1641,7 +1645,7 @@
 {
   int dstreg, imm;
   int z, c, n, v;
-  unsigned32 reg1, reg2, sum;
+  unsigned32 reg2, sum;
 
   PC = cia;
   dstreg = translate_rreg (SD_, RN0);
@@ -1682,7 +1686,7 @@
 {
   int imm, dstreg;
   int z, c, n, v;
-  unsigned32 reg1, reg2, difference;
+  unsigned32 reg2, difference;
 
   PC = cia;
   dstreg = translate_rreg (SD_, RN0);
@@ -1828,7 +1832,7 @@
 "asl"
 *am33
 {
-  int srcreg, dstreg;
+  int dstreg;
   int z, n;
 
   PC = cia;
@@ -2755,7 +2759,7 @@
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM0);
-  srcreg1 = translate_rreg (SD_, RI0);
+  srcreg2 = translate_rreg (SD_, RI0);
   dstreg = translate_rreg (SD_, RN0);
   State.regs[dstreg] = load_word (State.regs[srcreg1] + State.regs[srcreg2]);
 }
@@ -2783,7 +2787,7 @@
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM0);
-  srcreg1 = translate_rreg (SD_, RI0);
+  srcreg2 = translate_rreg (SD_, RI0);
   dstreg = translate_rreg (SD_, RN0);
   State.regs[dstreg] = load_byte (State.regs[srcreg1] + State.regs[srcreg2]);
 }
@@ -2811,7 +2815,7 @@
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM0);
-  srcreg1 = translate_rreg (SD_, RI0);
+  srcreg2 = translate_rreg (SD_, RI0);
   dstreg = translate_rreg (SD_, RN0);
   State.regs[dstreg] = load_half (State.regs[srcreg1] + State.regs[srcreg2]);
 }
@@ -3167,7 +3171,8 @@
   start = (State.regs[srcreg2] & 0x1f) - 1;
   if (start == -1)
     start = 31;
-    
+
+  c = 0;    
   for (i = start; i >= 0; i--)
     {
       if (temp & (1 << i))
@@ -3415,7 +3420,7 @@
 "asl"
 *am33
 {
-  int srcreg, dstreg;
+  int dstreg;
   int z, n;
 
   PC = cia;
@@ -4172,7 +4177,7 @@
 "asl"
 *am33
 {
-  int srcreg, dstreg;
+  int dstreg;
   int z, n;
 
   PC = cia;
@@ -4985,7 +4990,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -5024,7 +5028,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -5197,7 +5200,6 @@
 *am33
 {
   int srcreg1, dstreg1, dstreg2;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -5232,7 +5234,6 @@
 *am33
 {
   int srcreg1, dstreg1, dstreg2;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -5340,7 +5341,6 @@
 *am33
 {
   int srcreg1, dstreg1, dstreg2;
-  int result1;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -5457,7 +5457,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -5496,7 +5495,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -5721,7 +5719,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -5760,7 +5757,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -5974,7 +5970,6 @@
 {
   int dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   dstreg1 = translate_rreg (SD_, RN1);
@@ -6011,7 +6006,6 @@
 {
   int dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   dstreg1 = translate_rreg (SD_, RN1);
@@ -6174,7 +6168,6 @@
 *am33
 {
   int dstreg1, dstreg2;
-  signed int temp;
 
   PC = cia;
   dstreg1 = translate_rreg (SD_, RN1);
@@ -6207,7 +6200,6 @@
 *am33
 {
   int dstreg1, dstreg2;
-  signed int temp;
 
   PC = cia;
   dstreg1 = translate_rreg (SD_, RN1);
@@ -6293,7 +6285,6 @@
 *am33
 {
   int srcreg2, dstreg1, dstreg2;
-  int result1;
 
   PC = cia;
   srcreg2 = translate_rreg (SD_, RM2);
@@ -6310,7 +6301,6 @@
 *am33
 {
   int dstreg1, dstreg2;
-  int result1;
 
   PC = cia;
   dstreg1 = translate_rreg (SD_, RN1);
@@ -6421,7 +6411,6 @@
 {
   int dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   dstreg1 = translate_rreg (SD_, RN1);
@@ -6458,7 +6447,6 @@
 {
   int dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   dstreg1 = translate_rreg (SD_, RN1);
@@ -6671,7 +6659,6 @@
 {
   int dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   dstreg1 = translate_rreg (SD_, RN1);
@@ -6708,7 +6695,6 @@
 {
   int dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   dstreg1 = translate_rreg (SD_, RN1);
@@ -6932,7 +6918,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -6971,7 +6956,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -7530,7 +7514,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -7569,7 +7552,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -7804,7 +7786,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -7845,7 +7826,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -8071,7 +8051,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -8110,7 +8089,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -8226,7 +8204,6 @@
 *am33
 {
   int srcreg1, srcreg2, dstreg1, dstreg2;
-  int result1;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -8234,7 +8211,7 @@
   dstreg1 = translate_rreg (SD_, RN1);
   dstreg2 = translate_rreg (SD_, RN2);
 
-  State.regs[dstreg1] = result1;
+  genericCmp (State.regs[dstreg2], State.regs[dstreg1]);
   if (State.regs[srcreg1] >= 0x7fff)
     State.regs[dstreg1] = 0x7fff;
   else if (State.regs[srcreg1] <= 0xffff8000)
@@ -8400,7 +8377,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -8451,7 +8427,6 @@
 {
   int srcreg1, dstreg1, dstreg2;
   int result1;
-  signed int temp;
 
   PC = cia;
   srcreg1 = translate_rreg (SD_, RM1);
@@ -8475,7 +8450,6 @@
 *am33
 {
   int srcreg, dstreg;
-  int result1;
 
   PC = cia;
   srcreg = translate_rreg (SD_, RM);
@@ -8489,7 +8463,6 @@
       State.regs[REG_PC] = State.regs[REG_LAR] - 4;
       nia = PC;
     }
-  State.regs[dstreg] = result1;
 }
 
 // 1111 0111 1110 0000 Rm1 Rn1 imm4 0001; mov_lgt (Rm+,imm4),Rn
diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog
index fc0af62..52e6685 100644
--- a/sim/ppc/ChangeLog
+++ b/sim/ppc/ChangeLog
@@ -1,3 +1,20 @@
+2000-12-12  Geoffrey Keating  <geoffk@redhat.com>
+
+	* sim-endian.h: Don't have parameters on macro definitions which
+	are simply renaming functions, to permit use of XCONCAT2 in both
+	the macro name and the arguments in a use of such a definition.
+
+2000-11-15  Jim Blandy  <jimb@redhat.com>
+
+	* sim_calls.c: Doc fix.
+	(sim_fetch_register, sim_store_register): Call
+	gdbarch_register_name directly, instead of going through
+	REGISTER_NAME macro.
+
+2000-10-24  Geoff Keating  <geoffk@cygnus.com>
+
+	* ppc-instructions (lfsux): Correct XO field of lfsux instruction.
+
 Tue May 23 21:39:23 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/ppc/ppc-instructions b/sim/ppc/ppc-instructions
index b9a3287..25a9d78 100644
--- a/sim/ppc/ppc-instructions
+++ b/sim/ppc/ppc-instructions
@@ -3426,7 +3426,7 @@
 	*rA = EA;
 	PPC_INSN_INT_FLOAT(RA_BITMASK, FRT_BITMASK, (RA_BITMASK & ~1), 0);
 
-0.31,6.FRT,11.RA,16.RB,21.576,31./:X:f::Load Floating-Point Single with Update Indexed
+0.31,6.FRT,11.RA,16.RB,21.567,31./:X:f::Load Floating-Point Single with Update Indexed
 *601: PPC_UNIT_IU,    PPC_UNIT_IU,    3,  3,  0
 *603: PPC_UNIT_LSU,   PPC_UNIT_LSU,   1,  2,  0
 *603e:PPC_UNIT_LSU,   PPC_UNIT_LSU,   1,  2,  0
diff --git a/sim/ppc/sim-endian.h b/sim/ppc/sim-endian.h
index ceca970..74e8f1b 100644
--- a/sim/ppc/sim-endian.h
+++ b/sim/ppc/sim-endian.h
@@ -246,46 +246,46 @@
 
 /* SWAP */
 
-#define SWAP_1(X) swap_1(X)
-#define SWAP_2(X) swap_2(X)
-#define SWAP_4(X) swap_4(X)
-#define SWAP_8(X) swap_8(X)
+#define SWAP_1 swap_1
+#define SWAP_2 swap_2
+#define SWAP_4 swap_4
+#define SWAP_8 swap_8
 
 
 /* HOST to BE */
 
-#define H2BE_1(X) endian_h2be_1(X)
-#define H2BE_2(X) endian_h2be_2(X)
-#define H2BE_4(X) endian_h2be_4(X)
-#define H2BE_8(X) endian_h2be_8(X)
-#define BE2H_1(X) endian_be2h_1(X)
-#define BE2H_2(X) endian_be2h_2(X)
-#define BE2H_4(X) endian_be2h_4(X)
-#define BE2H_8(X) endian_be2h_8(X)
+#define H2BE_1 endian_h2be_1
+#define H2BE_2 endian_h2be_2
+#define H2BE_4 endian_h2be_4
+#define H2BE_8 endian_h2be_8
+#define BE2H_1 endian_be2h_1
+#define BE2H_2 endian_be2h_2
+#define BE2H_4 endian_be2h_4
+#define BE2H_8 endian_be2h_8
 
 
 /* HOST to LE */
 
-#define H2LE_1(X) endian_h2le_1(X)
-#define H2LE_2(X) endian_h2le_2(X)
-#define H2LE_4(X) endian_h2le_4(X)
-#define H2LE_8(X) endian_h2le_8(X)
-#define LE2H_1(X) endian_le2h_1(X)
-#define LE2H_2(X) endian_le2h_2(X)
-#define LE2H_4(X) endian_le2h_4(X)
-#define LE2H_8(X) endian_le2h_8(X)
+#define H2LE_1 endian_h2le_1
+#define H2LE_2 endian_h2le_2
+#define H2LE_4 endian_h2le_4
+#define H2LE_8 endian_h2le_8
+#define LE2H_1 endian_le2h_1
+#define LE2H_2 endian_le2h_2
+#define LE2H_4 endian_le2h_4
+#define LE2H_8 endian_le2h_8
 
 
 /* HOST to TARGET */
 
-#define H2T_1(X) endian_h2t_1(X)
-#define H2T_2(X) endian_h2t_2(X)
-#define H2T_4(X) endian_h2t_4(X)
-#define H2T_8(X) endian_h2t_8(X)
-#define T2H_1(X) endian_t2h_1(X)
-#define T2H_2(X) endian_t2h_2(X)
-#define T2H_4(X) endian_t2h_4(X)
-#define T2H_8(X) endian_t2h_8(X)
+#define H2T_1 endian_h2t_1
+#define H2T_2 endian_h2t_2
+#define H2T_4 endian_h2t_4
+#define H2T_8 endian_h2t_8
+#define T2H_1 endian_t2h_1
+#define T2H_2 endian_t2h_2
+#define T2H_4 endian_t2h_4
+#define T2H_8 endian_t2h_8
 
 
 /* CONVERT IN PLACE
@@ -370,22 +370,22 @@
    Byte swap a quantity the size of the targets word */
 
 #if (WITH_TARGET_WORD_BITSIZE == 64)
-#define H2T_word(X) H2T_8(X)
-#define T2H_word(X) T2H_8(X)
-#define H2BE_word(X) H2BE_8(X)
-#define BE2H_word(X) BE2H_8(X)
-#define H2LE_word(X) H2LE_8(X)
-#define LE2H_word(X) LE2H_8(X)
-#define SWAP_word(X) SWAP_8(X)
+#define H2T_word H2T_8
+#define T2H_word T2H_8
+#define H2BE_word H2BE_8
+#define BE2H_word BE2H_8
+#define H2LE_word H2LE_8
+#define LE2H_word LE2H_8
+#define SWAP_word SWAP_8
 #endif
 #if (WITH_TARGET_WORD_BITSIZE == 32)
-#define H2T_word(X) H2T_4(X)
-#define T2H_word(X) T2H_4(X)
-#define H2BE_word(X) H2BE_4(X)
-#define BE2H_word(X) BE2H_4(X)
-#define H2LE_word(X) H2LE_4(X)
-#define LE2H_word(X) LE2H_4(X)
-#define SWAP_word(X) SWAP_4(X)
+#define H2T_word H2T_4
+#define T2H_word T2H_4
+#define H2BE_word H2BE_4
+#define BE2H_word BE2H_4
+#define H2LE_word H2LE_4
+#define LE2H_word LE2H_4
+#define SWAP_word SWAP_4
 #endif
 
 
@@ -393,13 +393,13 @@
 
    Byte swap a quantity the size of the targets IEEE 1275 memory cell */
 
-#define H2T_cell(X) H2T_4(X)
-#define T2H_cell(X) T2H_4(X)
-#define H2BE_cell(X) H2BE_4(X)
-#define BE2H_cell(X) BE2H_4(X)
-#define H2LE_cell(X) H2LE_4(X)
-#define LE2H_cell(X) LE2H_4(X)
-#define SWAP_cell(X) SWAP_4(X)
+#define H2T_cell H2T_4
+#define T2H_cell T2H_4
+#define H2BE_cell H2BE_4
+#define BE2H_cell BE2H_4
+#define H2LE_cell H2LE_4
+#define LE2H_cell LE2H_4
+#define SWAP_cell SWAP_4
 
 
 #if (SIM_ENDIAN_INLINE & INCLUDE_MODULE)
diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c
index 15df3c5..b6defa0 100644
--- a/sim/ppc/sim_calls.c
+++ b/sim/ppc/sim_calls.c
@@ -59,22 +59,28 @@
 static device *root_device;
 static host_callback *callbacks;
 
-/* We use GDB's reg_names array to map GDB register numbers onto
-   names, which we can then look up in the register table.
+/* We use GDB's gdbarch_register_name function to map GDB register
+   numbers onto names, which we can then look up in the register
+   table.  Since the `set architecture' command can select a new
+   processor variant at run-time, the meanings of the register numbers
+   can change, so we need to make sure the sim uses the same
+   name/number mapping that GDB uses.
 
-   We used to just use the REGISTER_NAMES macro, from GDB's
-   target-dependent header files.  That was kind of nice, because it
-   meant that libsim.a had only a compile-time dependency on GDB;
-   using reg_names directly means that there are now link-time and
-   run-time dependencies too.
+   (We don't use the REGISTER_NAME macro, which is a wrapper for
+   gdbarch_register_name.  We #include GDB's "defs.h", which tries to
+   #include GDB's "config.h", but gets ours instead, and REGISTER_NAME
+   ends up not getting defined.  Simpler to just use
+   gdbarch_register_name directly.)
 
-   However, the GDB PPC back-end now modifies the reg_names array when
-   the user runs the `set processor' command, which affects the
-   meanings of the register numbers.  So the sim needs to see the
-   register names GDB is actually using.
+   We used to just use the REGISTER_NAMES macro from GDB's
+   target-dependent header files, which expanded into an initializer
+   for an array of strings.  That was kind of nice, because it meant
+   that libsim.a had only a compile-time dependency on GDB; using
+   gdbarch_register_name directly means that there are now link-time
+   and run-time dependencies too.
 
-   Perhaps the host_callback structure could contain a pointer to the
-   register name table; that would be cleaner.  */
+   Perhaps the host_callback structure could provide a function for
+   retrieving register names; that would be cleaner.  */
 
 SIM_DESC
 sim_open (SIM_OPEN_KIND kind,
@@ -181,13 +187,13 @@
   }
 
   /* GDB will sometimes ask for the contents of a register named "";
-     we ignore such requests, and leave garbage in *BUF.  In
-     REG_NAMES, the empty string means "the register with this
-     number is not present in the currently selected architecture
-     variant."  That's following the kludge we're using for the MIPS
-     processors.  But there are loops that just walk through the
-     entire list of names and try to get everything.  */
-  regname = REGISTER_NAME (regno);
+     we ignore such requests, and leave garbage in *BUF.  In GDB
+     terms, the empty string means "the register with this number is
+     not present in the currently selected architecture variant."
+     That's following the kludge we're using for the MIPS processors.
+     But there are loops that just walk through the entire list of
+     names and try to get everything.  */
+  regname = gdbarch_register_name (current_gdbarch, regno);
   if (! regname || regname[0] == '\0')
     return -1;
 
@@ -208,7 +214,7 @@
     return 0;
 
   /* See comments in sim_fetch_register, above.  */
-  regname = REGISTER_NAME (regno);
+  regname = gdbarch_register_name (current_gdbarch, regno);
   if (! regname || regname[0] == '\0')
     return -1;
 
diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog
index f82652a..ae8773a 100644
--- a/sim/sh/ChangeLog
+++ b/sim/sh/ChangeLog
@@ -1,3 +1,7 @@
+2000-10-24  Ben Elliston  <bje@redhat.com>
+
+	* gencode.c (tab): Delimit strings with commas where applicable.
+
 Tue May 23 21:39:23 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/sh/Makefile.in b/sim/sh/Makefile.in
index 7de4b53..62aaeaf 100644
--- a/sim/sh/Makefile.in
+++ b/sim/sh/Makefile.in
@@ -24,7 +24,7 @@
 
 ## COMMON_POST_CONFIG_FRAG
 
-interp.o: interp.c code.c table.c
+interp.o: interp.c code.c table.c ppi.c
 
 code.c: gencode
 	./gencode -x >code.c
@@ -34,6 +34,9 @@
 	./gencode -s >table.c
 #	indent table.c
 
+ppi.c: gencode
+	./gencode -p >ppi.c
+
 gencode: gencode.c
 	$(CC_FOR_BUILD) -o gencode $(srcdir)/gencode.c
 
diff --git a/sim/sh/gencode.c b/sim/sh/gencode.c
index 02605fc..ba6ee4c 100644
--- a/sim/sh/gencode.c
+++ b/sim/sh/gencode.c
@@ -41,9 +41,7 @@
   char *code;
   char *stuff[MAX_NR_STUFF];
   int index;
-}
-
-op;
+} op;
 
 
 op tab[] =
@@ -1321,7 +1319,7 @@
     "  res = Sz << i;",
     "else if (i >= 128 - 16)",
     "  res = Sz >> 128 - i;",
-    "else"
+    "else",
     "  {",
     "    RAISE_EXCEPTION (SIGILL);",
     "    return;",
@@ -1336,7 +1334,7 @@
     "",
     "if (i < 32)",
     "  {",
-    "    if (i == 32)"
+    "    if (i == 32)",
     "      {",
     "        res = 0;",
     "        res_grd = Sz;",
@@ -1352,7 +1350,7 @@
     "else if (i >= 96)",
     "  {",
     "    i = 128 - i;",
-    "    if (i == 32)"
+    "    if (i == 32)",
     "      {",
     "        res_grd = SIGN32 (Sz_grd);",
     "        res = Sz_grd;",
@@ -1364,7 +1362,7 @@
     "      }",
     "    carry = Sz >> (i - 1) & 1;",
     "  }",
-    "else"
+    "else",
     "  {",
     "    RAISE_EXCEPTION (SIGILL);",
     "    return;",
@@ -1540,7 +1538,7 @@
     "  res = Sx << Sy;",
     "else if (Sy >= 128 - 16)",
     "  res = Sx >> 128 - Sy;",
-    "else"
+    "else",
     "  {",
     "    RAISE_EXCEPTION (SIGILL);",
     "    return;",
@@ -1554,7 +1552,7 @@
     "",
     "if (Sy < 32)",
     "  {",
-    "    if (Sy == 32)"
+    "    if (Sy == 32)",
     "      {",
     "        res = 0;",
     "        res_grd = Sx;",
@@ -1570,7 +1568,7 @@
     "else if (Sy >= 96)",
     "  {",
     "    Sy = 128 - Sy;",
-    "    if (Sy == 32)"
+    "    if (Sy == 32)",
     "      {",
     "        res_grd = SIGN32 (Sx_grd);",
     "        res = Sx_grd;",
@@ -1582,7 +1580,7 @@
     "      }",
     "    carry = Sx >> (Sy - 1) & 1;",
     "  }",
-    "else"
+    "else",
     "  {",
     "    RAISE_EXCEPTION (SIGILL);",
     "    return;",
@@ -1694,7 +1692,7 @@
   { "","", "(if cc) pdmsb Sx,Dz",	"100111ccxx..zzzz",
     "unsigned Sx = DSP_R (x);",
     "int Sx_grd = GET_DSP_GRD (x);",
-    "int i = 16;"
+    "int i = 16;",
     "",
     "if (Sx_grd < 0)",
     "  {",
@@ -1710,7 +1708,7 @@
     "  res = 30;",
     "else",
     "  res = 31;",
-    "do"
+    "do",
     "  {",
     "    if (Sx & ~0 << i)",
     "      {",
@@ -1727,13 +1725,13 @@
   },
   { "","", "(if cc) pdmsb Sy,Dz",	"101111cc..yyzzzz",
     "unsigned Sy = DSP_R (y);",
-    "int i;"
+    "int i;",
     "",
     "if (Sy < 0)",
     "  Sy = ~Sy;",
     "Sy <<= 1;",
     "res = 31;",
-    "do"
+    "do",
     "  {",
     "    if (Sy & ~0 << i)",
     "      {",
diff --git a/sim/testsuite/ChangeLog b/sim/testsuite/ChangeLog
index bdb9078..b5a72d0 100644
--- a/sim/testsuite/ChangeLog
+++ b/sim/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2000-11-01  Dave Brolley  <brolley@cygnus.com>
+
+	* lib/sim-defs.exp (run_sm_test): Correct comment. "output" and
+	"xerror" options do not use a list of machines. Clear options from
+	previous test case. Use "$cpu_option"  to identify the machine to the
+	assembler, if specified.
+
 Tue May 23 21:39:23 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
 	* configure: Regenerated to track ../common/aclocal.m4 changes.
diff --git a/sim/testsuite/lib/sim-defs.exp b/sim/testsuite/lib/sim-defs.exp
index 3224528..e00b99c9 100644
--- a/sim/testsuite/lib/sim-defs.exp
+++ b/sim/testsuite/lib/sim-defs.exp
@@ -154,8 +154,8 @@
 # as[(mach-list)]: <assembler options>
 # ld[(mach-list)]: <linker options>
 # sim[(mach-list)]: <simulator options>
-# output[(mach-list)]: program output pattern to match with string-match
-# xerror[(mach-list)]: program is expected to return with a "failure" exit code
+# output: program output pattern to match with string-match
+# xerror: program is expected to return with a "failure" exit code
 # If `output' is not specified, the program must output "pass" if !xerror or
 # "fail" if xerror.
 # The parens in "optname()" are optional if the specification is for all machs.
@@ -164,6 +164,7 @@
     global subdir srcdir
     global SIMFLAGS
     global opts
+    global cpu_option
 
     if [string match "*/*" $name] {
 	set file $name
@@ -177,14 +178,28 @@
 	unresolved $subdir/$name
 	return
     }
-    set opts(as) {}
-    set opts(ld) {}
-    set opts(sim) {}
-    set opts(output) {}
-    set opts(mach) {}
-    set opts(timeout) {}
+    # Clear default options
+    set opts(as) ""
+    set opts(ld) ""
+    set opts(sim) ""
+    set opts(output) ""
+    set opts(mach) ""
+    set opts(timeout) ""
     set opts(xerror) "no"
 
+    # Clear any machine specific options specified in a previous test case
+    foreach m $requested_machs {
+	if [info exists opts(as,$m)] {
+	    unset opts(as,$m)
+	}
+	if [info exists opts(ld,$m)] {
+	    unset opts(ld,$m)
+	}
+	if [info exists opts(sim,$m)] {
+	    unset opts(sim,$m)
+	}
+    }
+
     foreach i $opt_array {
 	set opt_name [lindex $i 0]
 	set opt_machs [lindex $i 1]
@@ -231,7 +246,11 @@
 	    set opts(as,$mach) $opts(as)
 	}
 
-	set comp_output [target_assemble $sourcefile ${name}.o "$opts(as,$mach) -I$srcdir/$subdir"]
+	set as_options "$opts(as,$mach) -I$srcdir/$subdir"
+	if [info exists cpu_option] {
+	    set as_options "$as_options $cpu_option=$mach"
+	}
+	set comp_output [target_assemble $sourcefile ${name}.o "$as_options"]
 
 	if ![string match "" $comp_output] {
 	    verbose -log "$comp_output" 3
diff --git a/sim/tic80/ChangeLog b/sim/tic80/ChangeLog
new file mode 100644
index 0000000..a98b57d
--- /dev/null
+++ b/sim/tic80/ChangeLog
@@ -0,0 +1,662 @@
+Tue Jul  4 13:58:43 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* tic80.igen: Rename insns.  Re-format.
+	* tic80.dc: rename dc.
+	* tic80.ic: rename ic. Replace ``compute'' with ``cache''.
+
+Wed May 24 14:40:34 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+2000-04-12  Frank Ch. Eigler  <fche@redhat.com>
+
+	* cpu.h (GPR_CLEAR): New macro.
+	(GPR_SET): Removed macro.
+
+Thu Sep  2 18:15:53 1999  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+1999-05-08  Felix Lee  <flee@cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+	
+Fri May  1 14:41:11 1998  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* insns: Pass correct arguments to sim_engine_abort.
+
+Tue Apr 28 18:33:31 1998  Geoffrey Noer  <noer@cygnus.com>
+
+        * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Sun Apr 26 15:31:55 1998  Tom Tromey  <tromey@creche>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+	* config.in: Ditto.
+
+Sun Apr 26 15:19:45 1998  Tom Tromey  <tromey@cygnus.com>
+
+	* acconfig.h: New file.
+	* configure.in: Reverted change of Apr 24; use sinclude again.
+
+Fri Apr 24 14:16:40 1998  Tom Tromey  <tromey@creche>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+	* config.in: Ditto.
+
+Fri Apr 24 11:18:28 1998  Tom Tromey  <tromey@cygnus.com>
+
+	* configure.in: Don't call sinclude.
+
+Fri Apr 24 19:43:30 1998  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* ic (rBase, rLink): Make the type a pointer.
+
+Sat Apr  4 20:36:25 1998  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Fri Mar 27 16:15:52 1998  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Wed Mar 25 12:35:29 1998  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Wed Mar 18 12:38:12 1998  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Wed Mar 11 14:12:56 1998  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* alu.h (IMEM32_IMMED, IMEM32, STORE, MEM): Replace sim_core_*_map
+ 	with read_map, write_map, exec_map resp.
+
+Thu Feb 26 19:08:37 1998  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-calls.c (sim_info): Delete.
+
+Tue Feb 17 14:35:05 1998  Michael Meissner  <meissner@cygnus.com>
+
+	* misc.c (tic80_trace_cond_br): Take size/code arguments, and
+	decode bcond conditions and bbo/bbz comparison bits.
+
+	* cpu.h (tic80_trace_cond_br): Update prototype.
+	(TRACE_COND_PR): Take size/code additional arguments.
+
+	* insns: (bbo/bbz/bcnd): Update call to TRACE_COND_PR.
+
+Tue Feb 17 12:50:27 1998  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-calls.c (sim_store_register, sim_fetch_register): Pass in
+ 	length parameter.  Return -1.
+
+Fri Feb 13 17:11:22 1998  Michael Meissner  <meissner@cygnus.com>
+
+	* insns ({get,set}_fp_reg): Tic80 floating point is little endian,
+	not big endian.
+
+	* misc.c (tic80_trace_fpu*): Pass address of sim_fpu structure,
+	not the structure itself.  Use %g consistantly to print floating
+	point.
+
+	* cpu.h: (tic80_trace_fpu*): Update prototypes.
+
+Tue Feb  3 16:25:47 1998  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* alu.h (IMEM32, IMEM32_IMMED): Rename IMEM and IMEM_IMMED so that
+ 	in sync with recent igen change.
+
+Sun Feb  1 16:47:51 1998  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Sat Jan 31 18:15:41 1998  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Fri Jan 30 11:47:50 1998  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* cpu.h (CPU_CIA): Delete macro, replace with...
+ 	(CIA_SET, CIA_GET): Define.
+
+Wed Jan 28 18:44:33 1998  Michael Meissner  <meissner@cygnus.com>
+
+	* misc.c (tic80_trace_cmp_internal): New function to return
+	compare bits as a string.
+	(tic80_trace_{,fpu2}cmp): New functions for tracing cmp and fcmp.
+
+	* cpu.h (tic80_trace_{,fpu2}cmp): Add declaration.
+	(TRACE_{,FPU2}CMP): New macros for tracing compares.
+
+	* insns (do_{,f}cmp): Use compare specific tracing functions to
+	print out the flag bits.
+
+Mon Jan 19 22:26:29 1998  Doug Evans  <devans@seba>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Mon Dec 15 23:17:11 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+	* config.in: Ditto.
+
+Thu Dec  4 09:21:05 1997  Doug Evans  <devans@canuck.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Mon Nov 24 14:57:58 1997  Doug Evans  <devans@seba.cygnus.com>
+
+	* cpu.h (TRACE_COND_BR): Use TRACE_BRANCH_P, not TRACE_ALU_P.
+
+Sat Nov 22 21:42:09 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* interp.c (engine_step): Replace SIGTRAP with SIM_SIGTRAP.
+	(engine_run_until_stop): Replace SIGINT with SIM_SIGINT.
+
+	* sim-main.h: Include sim-signal.h.
+	(SIGTRAP): Delete definition.
+
+	* interp.c, sim-calls.c: Do not include signal.h.
+
+	* insns (illegal): SIGILL -> SIM_SIGILL.
+ 	(fp_unavailable): SIGFPE -> SIM_SIGFPE.
+	(do_trap): SIGTRAP -> SIM_SIGTRAP.
+	
+Tue Nov 18 15:33:48 1997  Doug Evans  <devans@canuck.cygnus.com>
+
+	* sim-main.h (CIA_ADDR): Define.
+
+	* Makefile.in (SIM_OBJS): Use $(SIM_NEW_COMMON_OBJS).
+
+Fri Oct 17 17:26:36 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* alu.h (ALU32_END): Use ALU32_RESULT.
+
+Mon Sep 29 12:49:06 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* insns (get_fp_reg, set_fp_reg): Update to use changed sim_fpu
+ 	interface.
+	(do_fadd, do_fcmp, do_fdiv, do_fmpy, do_frnd, do_fsub): Ditto.
+
+	* misc.c (tic80_trace_fpu3, tic80_trace_fpu2, tic80_trace_fpu1,
+ 	tic80_trace_fpu2i) Update to use changed sim_fpu interface.
+	
+Fri Oct  3 09:28:00 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure.in (SIM_AC_OPTIONS_BITSIZE): Define.
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Wed Sep 24 17:38:57 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Tue Sep 23 11:04:38 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Tue Sep 23 10:19:51 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* Makefile.in (SIM_WARNINGS, SIM_ALIGNMENT, SIM_ENDIAN,
+ 	SIM_HOSTENDIAN, SIM_INLINE, SIM_RESERVED_BITS): Delete, moved to
+ 	common.
+	(SIM_EXTRA_CFLAGS): Update.
+	
+Mon Sep 22 11:46:20 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Fri Sep 19 17:45:25 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Tue Sep 16 23:10:03 1997  Felix Lee  <flee@cygnus.com>
+
+	* sim-main.h (kill): macro was missing args.
+	(SIGTRAP): define for MSVC.
+
+Mon Sep 15 17:36:15 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Mon Sep  8 20:10:43 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* cpu.h (CPU_CIA): Define.
+
+	* sim-main.h (struct sim_state): Delete halt_ok, path_to_halt,
+ 	restart_ok, path_to_restart members.
+	(struct sim_state): Delete reason, siggnal members.
+	
+Thu Sep  4 17:21:23 1997  Doug Evans  <dje@seba>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Thu Sep  4 17:45:14 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-calls.c (sim_open): Add memory before parsing arguments.
+	(sim_read): Delete, replace with sim-hrw.
+	(sim_write): Delete, replace with sim-hrw.
+
+Thu Sep  4 10:48:57 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-calls.c (sim_open): Use sim_do_command to add memory, only
+ 	add memory if none already present.
+	(sim_open): Move init of registers from here.
+	(sim_create_inferior): To here. Init modules.
+
+	* Makefile.in (SIM_OBJS): Add sim-memopt.o module.
+
+	* sim-calls.c (sim_open): Add zero modulo arg to sim_core_attach.
+
+Mon Sep  1 11:06:30 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-calls.c (sim_open): Use sim_state_alloc
+	(simulation): Delete.
+
+Sat Aug 30 09:40:47 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* insns (do_trap): Unsigned `i' for unsigned iterator.
+	(do_trap): Ditto for comparison with getpid.
+
+Wed Aug 27 18:13:22 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+	* config.in: Ditto.
+
+Wed Aug 27 13:41:24 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* insns (do_st): Use U8_4 instead of V4_L8.
+
+	* sim-calls.c (sim_open): Add call to sim_analyze_program, update
+ 	call to sim_config.
+
+	* sim-calls.c (sim_kill): Delete.
+	(sim_create_inferior): Add ABFD argument.  Initialize PC from ABFD
+ 	and not SD.
+	(sim_load): Delete, use sim-hload.c.
+
+	* Makefile.in (SIM_OBJS): Add sim-hload.o module.
+
+Mon Aug 25 17:50:22 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+	* config.in: Ditto.
+
+Mon Aug 25 16:33:29 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-calls.c (sim_open): Add ABFD argument.
+	(sim_open): Move sim_config call to just after argument
+ 	parsing. Check return status.
+
+Fri Aug  8 21:52:27 1997  Mark Alexander  <marka@cygnus.com>
+
+	* sim-calls.c (sim_store_register): Allow accumulators
+	other than A0 to be modified.  Correct error message.
+
+Thu May 29 14:02:40 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* misc.c (tic80_trace_fpu3, tic80_trace_fpu2, tic80_trace_fpu1,
+ 	tic80_trace_fpu2i): Pass in function prefix.
+	(tic80_trace_ldst): Rewrite so it calls print_one_insn directly.
+	
+	* Makefile.in (SIM_OBJS): Include sim-watch.o module.
+
+	* sim-main.h (WITH_WATCHPOINTS): Enable watchpoints.
+
+	* ic (bitnum): Compute bitnum from BITNUM.
+	* insn (bbo, bbz): Use.
+	
+	* insn: Convert long immediate instructions to igen long immediate
+ 	form.
+	* insn: Add disasembler information.
+	
+Thu May 29 12:09:13 1997  Andrew Cagney  <cagney@b2.cygnus.com>
+
+	* alu.h (IMEM_IMMED): New macro, fetch 32bit immediate operand N.
+
+	* insns (subu i): Immediate is signed not unsigned.
+
+Tue May 27 13:22:13 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-calls.c (sim_read): Pass NULL cpu to sim_core_read_buffer.
+	(sim_write): Ditto for write.
+
+Tue May 20 09:33:31 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-calls.c (sim_load): Set STATE_LOADED_P.
+
+	* sim-main.h: Include <unistd.h>.
+
+	* sim-calls.c (sim_set_callback): Delete.
+	(sim_open): Add/install callback argument.
+	(sim_size): Delete.
+	
+Mon May 19 18:59:33 1997  Mike Meissner  <meissner@cygnus.com>
+
+	* configure.in: Check for getpid, kill functions.
+	* config{.in,ure}: Regenerate.
+
+	* insns (do_trap): Add support for kill, getpid system calls.
+
+	* sim-main.h (errno.h): Include.
+	(getpid,kill): Define as NOPs if the host doesn't have them.
+
+Mon May 19 14:58:47 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-calls.c (sim_open): Set the simulator base magic number.
+	(sim_load): Delete prototype of sim_load_file.
+	(sim_open): Define sd to be &simulation.
+
+Fri May 16 14:35:30 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* insns (illegal, fp_unavailable): Halt instead of abort the
+ 	simulator.
+
+	* insns: Replace calls to engine_error with sim_engine_abort.
+  	Ditto for engine_halt V sim_engine_halt.
+	
+Tue May 13 15:24:12 1997  Andrew Cagney  <cagney@b2.cygnus.com>
+
+	* interp.c (engine_run_until_stop): Delete. Moved to common.
+	(engine_step): Ditto.
+	(engine_step): Ditto.
+	(engine_halt): Ditto.
+	(engine_restart): Ditto.
+	(engine_halt): Ditto.
+	(engine_error): Ditto.
+
+	* sim-calls.c (sim_stop): Delete. Moved to common.
+	(sim_stop_reason): Ditto.
+	(sim_resume): Ditto.
+
+	* Makefile.in (SIM_OBJS): Link in generic sim-engine, sim-run,
+ 	sim-resume, sim-reason, sim-stop modules.
+
+Fri May 16 11:57:49 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* ic (compute): Drop check for REG == 0, now always forced to
+ 	zero.
+
+	* cpu.h (GPR_SET): New macro update the gpr.
+	* insns (do_add): Use GPR_SET to update the GPR register.
+
+	* sim-calls.c (sim_fetch_register): Pretend that r0 is zero.
+
+	* Makefile.in (tmp-igen): Specify zero-r0 so that every
+ 	instruction clears r0.
+
+	* interp.c (engine_run_until_stop): Igen now generates code to
+ 	clear r0.
+	(engine_step): Ditto.
+
+Thu May 15 11:45:37 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* insns (do_shift): When rot==0 and zero/sign merge treat it as
+ 	32.
+	(set_fp_reg): For interger conversion, use sim-fpu fpu2i
+ 	functions.
+	(do_fmpy): Perform iii and uuu using integer arithmetic.
+	
+	* Makefile.in (ENGINE_H): Assume everything depends on the fpu.
+
+	* insns (get_fp_reg): Use sim_fpu_u32to to perform unsigned
+ 	conversion.
+	(do_fcmp): Update to use new fp compare functions. Make reg nr arg
+ 	instead of reg.  Stops fp overflow.
+	(get_fp_reg): Assume val is valid when reg == 0.
+	(set_fp_reg): Fix double conversion.
+
+	* misc.c (tic80_trace_fpu1): New function, trace simple fp op.
+	
+	* insns (do_frnd): Add tracing.
+
+	* cpu.h (TRACE_FPU1): Ditto.
+
+	* insns (do_trap): Printf formatting.
+
+Wed May 14 18:05:50 1997  Mike Meissner  <meissner@cygnus.com>
+
+	* misc.c (tic80_trace_fpu{3,2,2i}): Align columns with other
+	insns.  Use %g to print floating point instead of %f in case the
+	numbers are real large.
+
+Tue May 13 18:00:10 1997  Mike Meissner  <meissner@cygnus.com>
+
+	* insns (do_trap): For system calls that are defined, but not
+	provided return EINVAL. Temporarily add traps 74-79 to just print
+	the register state.
+
+	* interp.c (engine_{run_until_stop,step}): Before executing
+	instructions, make sure r0 == 0.
+
+Tue May 13 16:39:37 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* alu.h (IMEM): Take full cia not just IP as argument.
+
+	* interp.c (engine_run_until_stop): Delete handling of annuled
+ 	instructions.
+	(engine_step): Ditto.
+
+	* insn (do_branch): New function.
+	(do_bbo, do_bbz, do_bcnd, do_bsr, do_jsr): Use do_branch to handle
+ 	annuled branches.
+
+Mon May 12 17:15:52 1997  Mike Meissner  <meissner@cygnus.com>
+
+	* insns (do_{ld,st}): Fix tracing for ld/st.
+
+Mon May 12 11:12:24 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-calls.c (sim_stop_reason): Restore keep_running after a
+ 	CNTRL-C, don't re-clear it.
+
+	* interp.c (engine_error): stop rather than signal with SIGABRT
+ 	when an error.
+
+	* insns (do_ld): For 64bit loads, always store LSW in rDest, MSW in
+ 	rDest + 1. Also done by Michael Meissner  <meissner@cygnus.com>
+	(do_st): Converse for store.
+
+	* misc.c (tic80_trace_fpu2i): Correct printf format for int type.
+
+Sun May 11 11:02:57 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-calls.c (sim_stop_reason): Return a SIGINT if keep_running
+ 	was cleared.
+
+	* interp.c (engine_step): New function.  Single step the simulator
+ 	taking care of cntrl-c during a step.
+
+	* sim-calls.c (sim_resume): Differentiate between stepping and
+ 	running so that a cntrl-c during a step is reported.
+
+Sun May 11 10:54:31 1997  Mark Alexander    <marka@cygnus.com>
+
+	* sim-calls.c (sim_fetch_register): Use correct reg base.
+	(sim_store_register): Ditto.
+
+Sun May 11 10:25:14 1997  Michael Meissner  <meissner@cygnus.com>
+
+	* cpu.h (tic80_trace_shift): Add declaration.
+	(TRACE_SHIFT): New macro to trace shift instructions.
+
+	* misc.c (tic80_trace_alu2): Align spacing.
+	(tic80_trace_shift): New function to trace shifts.
+
+	* insns (lmo): Add missing 0b prefix to bits.
+	(do_shift): Use ~ (unsigned32)0, instead of -1.  Use TRACE_SHIFT
+	instead of TRACE_ALU2.
+	(sl r): Use EndMask as is, instead of using Source+1 register.
+	(subu): Operands are unsigned, not signed.
+	(do_{ld,st}): Fix endian problems with ld.d/st.d.
+
+Sat May 10 12:35:47 1997  Michael Meissner  <meissner@cygnus.com>
+
+	* insns (and{.tt,.tf,.ft,.ff}): Immediate values are unsigned, not
+	signed.
+
+Fri May  9 15:47:36 1997  Mike Meissner  <meissner@cygnus.com>
+
+	* insns (cmp_vals,do_cmp): Produce the correct bits as specified
+	by the architecture.
+	(xor): Fix xor immediate patterns to use the correct bits.
+
+Fri May  9 09:55:33 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* alu.h (long_immediate): Adjust the CIA delay-pointer as well as
+ 	the NIA when a 64bit insn.
+
+Thu May  8 11:57:47 1997  Michael Meissner  <meissner@cygnus.com>
+
+	* insns (jsr,bsr): For non-allulled calls, set r31 so that the
+	return address does not reexecute the instruction in the delay
+	slot.
+	(bbo,bbz): Complement bit number to reverse the one's complement
+	that the assembler is required to do.
+
+	* misc.c (tic80_trace_*): Change format slightly to accomidate
+	real large decimal values.
+
+Thu May  8 14:07:16 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-calls.c (sim_do_command): Implement.
+	(sim_store_register): Fix typo T2H v H2T.
+
+Wed May  7 11:48:55 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* cpu.h (TRACE_FPU2, TRACE_FPU3, TRACE_FPU2I): Add.
+	* insn: Clean up fpu tracing.
+
+	* sim-calls.c (sim_create_inferior): Start out with interrupts
+ 	enabled.
+
+	* cpu.h (TRACE_SINK3), misc.c (tic80_trace_sink3): Three argument
+ 	sink
+
+	* insns (rdcr, swcr, wrcr, brcr, rmo, lmo): Implement.
+
+	* insns (do_*): Remove MY_INDEX/indx argument from support functions,
+ 	igen now handles this.
+	
+	* cpu.h (CR): New macro - access TIc80 control registers.
+	
+	* misc.c: New file.
+	(tic80_cr2index): New function, map control register opcode index
+ 	into the internal CR enum.
+
+	* interp.c
+ 	(tic80_trace_{alu{2,3},nop,sink{1,2},{,u}cond_br,ldst}): Move from
+ 	here
+	* misc.c: to here.
+	
+	* Makefile.in (SIM_OBJS): Add misc.o.
+
+Tue May  6 15:22:58 1997  Mike Meissner  <meissner@cygnus.com>
+
+	* cpu.h ({,v}{S,D}P_FPR): Delete unused macros that won't work on
+	big endian hosts.
+	(tic80_trace_{alu{2,3},nop,sink{1,2},{,u}cond_br,ldst}): Declare
+	new functions.
+	(TRACE_{ALU{2,3},NOP,SINK{1,2},{,U}COND_BR,LD,ST}): New macros to
+	trace various instruction types.
+
+	* insns: Modify all instructions to support semantic tracing.
+
+	* interp.c (toplevel): Include itable.h.
+	(tic80_trace_{alu{2,3},nop,sink{1,2},{,u}cond_br,ldst}): New
+	functions to provide semantic level tracing information.
+
+Mon May  5 11:50:43 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* alu.h: Update usage of core object to reflect recent changes in
+ 	../common/sim-*core.
+	* sim-calls.c (sim_open): Ditto.
+
+Mon May  5 14:10:17 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* insn (cmnd): No-op cache flushes.
+	
+	* insns (do_trap): Allow writes to STDERR.
+
+	* Makefile.in (SIM_OBJS): Link in sim-fpu.o.
+	(SIM_EXTRA_LIBS): Link in the math library.
+
+	* alu.h: Add support for floating point unit using sim-alu.
+	
+	* insns (fadd, fsub, fmpy, fdiv, fcmp, frnd*): Implement.
+
+Fri May  2 14:57:14 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-calls.c: Include sim-utils.h and sim-options.h.
+
+	* sim-main.h (sim_state): Drop sim_events and sim_core members,
+ 	moved to simulator base type.
+
+	* alu.h (IMEM, MEM, STORE): Update track changes in common
+ 	directory.
+
+	* insns: Drop cia argument from functions, igen now handles this.
+
+	* interp.c (engine_init): Include string.h/strings.h to define
+ 	memset et.al.
+
+	* sim-main.h (sim_cia): Delcare, tracking common dir changes.
+
+	* cpu.h (sim_cpu): Update instruction_address with sim_cia.
+
+Wed Apr 30 11:26:56 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* sim-main.h (signal.h): Include so that SIG* available to all
+ 	callers of sig_halt.
+
+	* insns (do_shift): New function, implement shift operations.
+	(do_trap): Add handler for trap 73 - SIGTRAP.
+	
+Tue Apr 29 10:58:48 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* alu.h (MEM, STORE): Force addresses to be correctly aligned.
+
+	* insns (do_jsr): Fix.
+	(do_st, do_ld): Handle 64bit transfers.
+	(do_trap): Match libgloss.
+	(rdcr): Implement nop - Dest == r0 - variant.
+
+	* sim-calls.c (sim_create_inferior): Initialize SP.
+
+	* Makefile.in (ENGINE_H): Everything now depends on sim-options.h.
+	(support.o): Depends on ENGINE_H.
+
+	* cpu.h: Four accumulators.
+
+	* Makefile.in (tmp-igen): Include line number information in
+ 	generated files.
+
+	* insns (dld, dst): Fill in.
+
+Mon Apr 28 13:02:26 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* insns (vld): Fix instruction format wrong.
+
+Thu Apr 24 16:43:09 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* dc: Add additional rules so that minor opcode files are
+ 	detected.
+	* insns: Enable more instructions.
+	
+	* sim-calls.c (sim_fetch_register,sim_store_register, sim_write):
+ 	Implement.
+
+Thu Apr 24 00:39:51 1997  Doug Evans  <dje@canuck.cygnus.com>
+
+	* configure: Regenerated to track ../common/aclocal.m4 changes.
+	* Makefile.in (SIM_OBJS): Add sim-module.o, sim-profile.o.
+	* sim-calls.c (sim_open): Call sim_module_uninstall if argument
+	parsing fails.  Call sim_post_argv_init.
+	(sim_close): Call sim_module_uninstall.
+
+Wed Apr 23 20:05:33 1997  Andrew Cagney  <cagney@b1.cygnus.com>
+
+	* insns (and, bbo, bcnd, bsr, dcache, jsr, or, xor, nor): Enable.
+  	* ic: Add fields for enabled instructions.
+
diff --git a/sim/tic80/Makefile.in b/sim/tic80/Makefile.in
new file mode 100644
index 0000000..7111a61
--- /dev/null
+++ b/sim/tic80/Makefile.in
@@ -0,0 +1,140 @@
+# Makefile for blah ...
+# Copyright blah ...
+
+
+
+## COMMON_PRE_CONFIG_FRAG
+
+# These variables are given default values in COMMON_PRE_CONFIG_FRAG.
+# We override the ones we need to here.
+# Not all of these need to be mentioned, only the necessary ones.
+
+# List of object files, less common parts.
+SIM_OBJS = \
+	$(SIM_NEW_COMMON_OBJS) \
+	support.o idecode.o semantics.o itable.o misc.o \
+	sim-engine.o \
+	sim-calls.o \
+	sim-hload.o \
+	sim-hrw.o \
+	sim-reason.o \
+	sim-resume.o \
+	sim-run.o \
+	sim-stop.o \
+
+# List of extra dependencies.
+# Generally this consists of simulator specific files included by sim-main.h.
+SIM_EXTRA_DEPS = itable.h idecode.h cpu.h alu.h
+
+# List of extra libraries to link with
+SIM_EXTRA_LIBS = -lm
+
+# List of generators
+SIM_GEN=tmp-igen
+
+# List of flags to always pass to $(CC).
+
+SIM_EXTRA_CFLAGS = \
+	-DWITH_TARGET_WORD_MSB=31
+
+# List of main object files for `run'.
+SIM_RUN_OBJS = nrun.o
+
+# Dependency of `clean' to clean any extra files.
+SIM_EXTRA_CLEAN = clean-igen
+
+
+## COMMON_POST_CONFIG_FRAG
+
+# Rules need to build $(SIM_OBJS), plus whatever else the target wants.
+
+# ... target specific rules ...
+
+BUILT_SRC_FROM_IGEN = \
+	icache.h \
+	icache.c \
+	idecode.h \
+	idecode.c \
+	semantics.h \
+	semantics.c \
+	model.h \
+	model.c \
+	support.h \
+	support.c \
+	itable.h itable.c
+$(BUILT_SRC_FROM_IGEN): tmp-igen
+#
+
+.PHONY: clean-igen
+clean-igen:
+	rm -f $(BUILT_SRC_FROM_IGEN)
+	rm -f tmp-igen tmp-insns
+
+../igen/igen:
+	cd ../igen && $(MAKE)
+
+tmp-igen: $(srcdir)/tic80.dc $(srcdir)/tic80.igen $(srcdir)/tic80.ic ../igen/igen
+	cd ../igen && $(MAKE)
+	../igen/igen \
+		-F f \
+		-G direct-access \
+		-G delayed-branch \
+		-G zero-r0 \
+		-F short,emul \
+		-B 32 -H 31 \
+		-o $(srcdir)/tic80.dc \
+		-k $(srcdir)/tic80.ic \
+		-i $(srcdir)/tic80.igen \
+		-n icache.h    -hc tmp-icache.h \
+		-n icache.c    -c  tmp-icache.c \
+		-n semantics.h -hs tmp-semantics.h \
+		-n semantics.c -s  tmp-semantics.c \
+		-n idecode.h   -hd tmp-idecode.h \
+		-n idecode.c   -d  tmp-idecode.c \
+		-n model.h     -hm tmp-model.h \
+		-n model.c     -m  tmp-model.c \
+		-n support.h   -hf tmp-support.h \
+		-n support.c   -f  tmp-support.c \
+		-n itable.h    -ht tmp-itable.h \
+		-n itable.c    -t  tmp-itable.c
+	$(srcdir)/../../move-if-change tmp-icache.h icache.h
+	$(srcdir)/../../move-if-change tmp-icache.c icache.c
+	$(srcdir)/../../move-if-change tmp-idecode.h idecode.h
+	$(srcdir)/../../move-if-change tmp-idecode.c idecode.c
+	$(srcdir)/../../move-if-change tmp-semantics.h semantics.h
+	$(srcdir)/../../move-if-change tmp-semantics.c semantics.c
+	$(srcdir)/../../move-if-change tmp-model.h model.h
+	$(srcdir)/../../move-if-change tmp-model.c model.c
+	$(srcdir)/../../move-if-change tmp-support.h support.h
+	$(srcdir)/../../move-if-change tmp-support.c support.c
+	$(srcdir)/../../move-if-change tmp-itable.h itable.h
+	$(srcdir)/../../move-if-change tmp-itable.c itable.c
+	touch tmp-igen
+
+ENGINE_H = \
+	sim-main.h \
+	$(srcdir)/../common/sim-basics.h \
+	config.h \
+	$(srcdir)/../common/sim-config.h \
+	$(srcdir)/../common/sim-inline.h \
+	$(srcdir)/../common/sim-types.h \
+	$(srcdir)/../common/sim-bits.h \
+	$(srcdir)/../common/sim-endian.h \
+	$(srcdir)/../common/sim-options.h \
+	itable.h \
+	idecode.h \
+	cpu.h \
+	alu.h \
+	$(srcdir)/../common/sim-alu.h \
+	$(srcdir)/../common/sim-core.h \
+	$(srcdir)/../common/sim-events.h \
+	$(srcdir)/../common/sim-fpu.h \
+	$(srcdir)/../common/sim-engine.h \
+
+idecode.o: $(ENGINE_H)
+semantics.o: $(ENGINE_H)
+support.o: $(ENGINE_H)
+interp.o: interp.c $(ENGINE_H)
+sim-calls.o: sim-calls.c $(ENGINE_H)
+cpu.o: cpu.c $(ENGINE_H)
+misc.o: $(ENGINE_H)
\ No newline at end of file
diff --git a/sim/tic80/acconfig.h b/sim/tic80/acconfig.h
new file mode 100644
index 0000000..f9b87a1
--- /dev/null
+++ b/sim/tic80/acconfig.h
@@ -0,0 +1,15 @@
+
+/* 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/sim/tic80/alu.h b/sim/tic80/alu.h
new file mode 100644
index 0000000..b5bc7c1
--- /dev/null
+++ b/sim/tic80/alu.h
@@ -0,0 +1,75 @@
+/* Texas Instruments TMS320C80 (MVP) Simulator.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   Contributed by Cygnus Support.
+
+This file is part of GDB, the GNU debugger.
+
+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 _TIC80_ALU_H_
+#define _TIC80_ALU_H_
+
+#define ALU_CARRY 0 /* FIXME */
+
+#define ALU32_END(TARG) \
+{ \
+  (TARG) = ALU32_RESULT; /* FIXME */ \
+}
+
+#define ALU_END(TARG) ALU32_END(TARG)
+
+#include "sim-alu.h"
+
+
+
+/* Bring data in from the cold */
+
+#define IMEM32(CIA) \
+(sim_core_read_aligned_4(STATE_CPU (sd, 0), CIA, exec_map, (CIA).ip))
+
+#define IMEM32_IMMED(CIA, N) \
+(sim_core_read_aligned_4 (STATE_CPU (sd, 0), CIA, exec_map, (CIA).ip + 4 * (N)))
+
+#define MEM(SIGN, EA, NR_BYTES) \
+((SIGN##_##NR_BYTES) sim_core_read_unaligned_##NR_BYTES (STATE_CPU (sd, 0), cia, \
+                                                         read_map, \
+                                                         (EA)))
+
+#define STORE(EA, NR_BYTES, VAL) \
+do { \
+  sim_core_write_unaligned_##NR_BYTES (STATE_CPU (sd, 0), cia, \
+                                       write_map, \
+                                       (EA), (VAL)); \
+} while (0)
+
+
+#define long_immediate(VARIABLE) \
+     unsigned_word VARIABLE = MEM (unsigned, nia.ip, 4); \
+     cia.dp += sizeof (instruction_word); \
+     nia.ip += sizeof (instruction_word); \
+     nia.dp += sizeof (instruction_word);
+
+
+
+/* Floating point support */
+
+#define IS_FP_AVAILABLE ((CPU)->cr[IE_CR] & IE_CR_IE)
+
+#include "sim-fpu.h"
+
+
+#endif
diff --git a/sim/tic80/config.in b/sim/tic80/config.in
new file mode 100644
index 0000000..fffbc59
--- /dev/null
+++ b/sim/tic80/config.in
@@ -0,0 +1,168 @@
+/* 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 as the return type of signal handlers (int or void).  */
+#undef RETSIGTYPE
+
+/* 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 if your processor stores words with the most significant
+   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
+#undef WORDS_BIGENDIAN
+
+/* Define to 1 if NLS is requested.  */
+#undef ENABLE_NLS
+
+/* 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 __setfpucw function.  */
+#undef HAVE___SETFPUCW
+
+/* 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 getpid function.  */
+#undef HAVE_GETPID
+
+/* Define if you have the getrusage function.  */
+#undef HAVE_GETRUSAGE
+
+/* Define if you have the kill function.  */
+#undef HAVE_KILL
+
+/* 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 sigaction function.  */
+#undef HAVE_SIGACTION
+
+/* 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 time function.  */
+#undef HAVE_TIME
+
+/* Define if you have the <argz.h> header file.  */
+#undef HAVE_ARGZ_H
+
+/* Define if you have the <fcntl.h> header file.  */
+#undef HAVE_FCNTL_H
+
+/* Define if you have the <fpu_control.h> header file.  */
+#undef HAVE_FPU_CONTROL_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 <stdlib.h> header file.  */
+#undef HAVE_STDLIB_H
+
+/* Define if you have the <string.h> header file.  */
+#undef HAVE_STRING_H
+
+/* Define if you have the <strings.h> header file.  */
+#undef HAVE_STRINGS_H
+
+/* Define if you have the <sys/param.h> header file.  */
+#undef HAVE_SYS_PARAM_H
+
+/* Define if you have the <sys/resource.h> header file.  */
+#undef HAVE_SYS_RESOURCE_H
+
+/* Define if you have the <sys/time.h> header file.  */
+#undef HAVE_SYS_TIME_H
+
+/* Define if you have the <time.h> header file.  */
+#undef HAVE_TIME_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
diff --git a/sim/tic80/configure b/sim/tic80/configure
new file mode 100755
index 0000000..b681188
--- /dev/null
+++ b/sim/tic80/configure
@@ -0,0 +1,4459 @@
+#! /bin/sh
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+sim_inline="-DDEFAULT_INLINE=0"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 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
+
+
+
+
+
+# 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
+
+
+
+# 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
+
+
+
+
+
+
+# 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:
+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"
+ac_help="$ac_help
+  --enable-maintainer-mode		Enable developer functionality."
+ac_help="$ac_help
+  --enable-sim-bswap			Use Host specific BSWAP instruction."
+ac_help="$ac_help
+  --enable-sim-cflags=opts		Extra CFLAGS for use in building simulator"
+ac_help="$ac_help
+  --enable-sim-debug=opts		Enable debugging flags"
+ac_help="$ac_help
+  --enable-sim-stdio			Specify whether to use stdio for console input/output."
+ac_help="$ac_help
+  --enable-sim-trace=opts		Enable tracing flags"
+ac_help="$ac_help
+  --enable-sim-profile=opts		Enable profiling flags"
+ac_help="$ac_help
+  --enable-sim-inline=inlines		Specify which functions should be inlined."
+ac_help="$ac_help
+  --enable-sim-endian=endian		Specify target byte endian orientation."
+ac_help="$ac_help
+  --enable-sim-alignment=align		Specify strict,  nonstrict or forced alignment of memory accesses."
+ac_help="$ac_help
+  --enable-sim-hostendian=end		Specify host byte endian orientation."
+ac_help="$ac_help
+  --enable-build-warnings[=LIST]		Enable build-time compiler warnings"
+ac_help="$ac_help
+  --enable-sim-reserved-bits		Specify whether to check reserved bits in instruction."
+ac_help="$ac_help
+  --enable-sim-bitsize=N		Specify target bitsize (32 or 64)."
+
+# 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=Makefile.in
+
+# 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
+
+
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:693: 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 708 "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:714: \"$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 725 "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:731: \"$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 742 "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:748: \"$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
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:773: 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
+
+echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
+echo "configure:800: 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:821: 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 826 "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:834: \"$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*
+  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 851 "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 869 "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 890 "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:901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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:925: 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 930 "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:979: \"$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:1000: 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 1007 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:1014: \"$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:1040: 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 1045 "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 "(^|[^a-zA-Z_0-9])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:1073: 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 1078 "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 "(^|[^a-zA-Z_0-9])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:1108: 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 1113 "configure"
+#include "confdefs.h"
+#include <alloca.h>
+int main() {
+char *p = alloca(2 * sizeof(int));
+; return 0; }
+EOF
+if { (eval echo configure:1120: \"$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
+  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:1141: 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 1146 "configure"
+#include "confdefs.h"
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _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
+#endif
+
+int main() {
+char *p = (char *) alloca(1);
+; return 0; }
+EOF
+if { (eval echo configure:1174: \"$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
+  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.${ac_objext}
+  cat >> confdefs.h <<\EOF
+#define C_ALLOCA 1
+EOF
+
+
+echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+echo "configure:1206: 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 1211 "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:1236: 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 1241 "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:1264: \"$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
+  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:1291: 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 1299 "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:1318: \"$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
+  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: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
+
+for ac_func in getpagesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1382: 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 1387 "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:1410: \"$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:1435: 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 1443 "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:1583: \"$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
+
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:1606: 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 1611 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:1622: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_cygwin=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:1639: 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 1644 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:1651: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_mingw32=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+
+# autoconf.info says this should be called right after AC_INIT.
+
+
+ac_aux_dir=
+for ac_dir in `cd $srcdir;pwd`/../.. $srcdir/`cd $srcdir;pwd`/../..; 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 `cd $srcdir;pwd`/../.. $srcdir/`cd $srcdir;pwd`/../.." 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.
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+#    configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+#    same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+#    as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# 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:1718: 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 target system type""... $ac_c" 1>&6
+echo "configure:1739: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+  case $nonopt in
+  NONE) target_alias=$host_alias ;;
+  *) target_alias=$nonopt ;;
+  esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:1757: 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
+
+test "$host_alias" != "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+if test "$program_transform_name" = s,x,x,; then
+  program_transform_name=
+else
+  # Double any \ or $.  echo might interpret backslashes.
+  cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+  program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+  rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,${program_prefix},; $program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+# 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:1801: 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:1831: 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:1882: 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:1914: 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 1925 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1930: \"$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:1956: 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:1961: 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:1970: \"$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:1989: 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
+
+# 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:2032: 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'
+
+
+# Put a plausible default for CC_FOR_BUILD in Makefile.
+if test "x$cross_compiling" = "xno"; then
+  CC_FOR_BUILD='$(CC)'
+else
+  CC_FOR_BUILD=gcc
+fi
+
+
+
+
+AR=${AR-ar}
+
+# 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:2100: 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
+
+
+ALL_LINGUAS=
+                              
+   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:2135: 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 2140 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2145: \"$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 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:2175: 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 2180 "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:2203: \"$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
+
+
+   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:2232: 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 2237 "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:2260: \"$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
+
+   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:2294: 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 2299 "configure"
+#include "confdefs.h"
+#include <locale.h>
+int main() {
+return LC_MESSAGES
+; return 0; }
+EOF
+if { (eval echo configure:2306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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:2327: 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:2347: 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:2366: 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 2371 "configure"
+#include "confdefs.h"
+#include <libintl.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2376: \"$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
+  echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
+echo "configure:2393: 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 2398 "configure"
+#include "confdefs.h"
+#include <libintl.h>
+int main() {
+return (int) gettext ("")
+; return 0; }
+EOF
+if { (eval echo configure:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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:2421: 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 2429 "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:2440: \"$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
+  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:2456: 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 2461 "configure"
+#include "confdefs.h"
+
+int main() {
+return (int) gettext ("")
+; return 0; }
+EOF
+if { (eval echo configure:2468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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:2496: 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:2530: 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 2535 "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:2558: \"$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
+
+		# 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:2585: 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=":"
+  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_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:2621: 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 2653 "configure"
+#include "confdefs.h"
+
+int main() {
+extern int _nl_msg_cat_cntr;
+			       return _nl_msg_cat_cntr
+; return 0; }
+EOF
+if { (eval echo configure:2661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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:2693: 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:2727: 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=":"
+  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_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:2763: 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:2853: 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:2881: 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 2886 "configure"
+#include "confdefs.h"
+#include <linux/version.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2891: \"$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
+  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
+  
+
+# Check for common headers.
+# FIXME: Seems to me this can cause problems for i386-windows hosts.
+# At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*.
+for ac_hdr in stdlib.h string.h strings.h unistd.h time.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2960: 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 2965 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2970: \"$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_hdr in sys/time.h sys/resource.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:3000: 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 3005 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3010: \"$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_hdr in fcntl.h fpu_control.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:3040: 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 3045 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3050: \"$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_hdr in dlfcn.h errno.h sys/stat.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:3080: 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 3085 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3090: \"$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 getrusage time sigaction __setfpucw
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3119: 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 3124 "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:3147: \"$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
+
+
+# Check for socket libraries
+echo $ac_n "checking for bind in -lsocket""... $ac_c" 1>&6
+echo "configure:3174: checking for bind in -lsocket" >&5
+ac_lib_var=`echo socket'_'bind | 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="-lsocket  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3182 "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 bind();
+
+int main() {
+bind()
+; return 0; }
+EOF
+if { (eval echo configure:3193: \"$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
+  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
+    ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lsocket $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
+echo "configure:3221: checking for gethostbyname in -lnsl" >&5
+ac_lib_var=`echo nsl'_'gethostbyname | 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="-lnsl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3229 "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 gethostbyname();
+
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:3240: \"$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
+  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
+    ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lnsl $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+. ${srcdir}/../../bfd/configure.host
+
+
+
+USE_MAINTAINER_MODE=no
+# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+  enableval="$enable_maintainer_mode"
+  case "${enableval}" in
+  yes)	MAINT="" USE_MAINTAINER_MODE=yes ;;
+  no)	MAINT="#" ;;
+  *)	{ echo "configure: error: "--enable-maintainer-mode does not take a value"" 1>&2; exit 1; }; MAINT="#" ;;
+esac
+if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
+  echo "Setting maintainer mode" 6>&1
+fi
+else
+  MAINT="#"
+fi
+
+
+
+# Check whether --enable-sim-bswap or --disable-sim-bswap was given.
+if test "${enable_sim_bswap+set}" = set; then
+  enableval="$enable_sim_bswap"
+  case "${enableval}" in
+  yes)	sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
+  no)	sim_bswap="-DWITH_BSWAP=0";;
+  *)	{ echo "configure: error: "--enable-sim-bswap does not take a value"" 1>&2; exit 1; }; sim_bswap="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
+  echo "Setting bswap flags = $sim_bswap" 6>&1
+fi
+else
+  sim_bswap=""
+fi
+
+
+
+# Check whether --enable-sim-cflags or --disable-sim-cflags was given.
+if test "${enable_sim_cflags+set}" = set; then
+  enableval="$enable_sim_cflags"
+  case "${enableval}" in
+  yes)	 sim_cflags="-O2 -fomit-frame-pointer";;
+  trace) { echo "configure: error: "Please use --enable-sim-debug instead."" 1>&2; exit 1; }; sim_cflags="";;
+  no)	 sim_cflags="";;
+  *)	 sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+esac
+if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
+  echo "Setting sim cflags = $sim_cflags" 6>&1
+fi
+else
+  sim_cflags=""
+fi
+
+
+
+# Check whether --enable-sim-debug or --disable-sim-debug was given.
+if test "${enable_sim_debug+set}" = set; then
+  enableval="$enable_sim_debug"
+  case "${enableval}" in
+  yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";;
+  no)  sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";;
+  *)   sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
+  echo "Setting sim debug = $sim_debug" 6>&1
+fi
+else
+  sim_debug=""
+fi
+
+
+
+# Check whether --enable-sim-stdio or --disable-sim-stdio was given.
+if test "${enable_sim_stdio+set}" = set; then
+  enableval="$enable_sim_stdio"
+  case "${enableval}" in
+  yes)	sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
+  no)	sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
+  *)	{ echo "configure: error: "Unknown value $enableval passed to --enable-sim-stdio"" 1>&2; exit 1; }; sim_stdio="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
+  echo "Setting stdio flags = $sim_stdio" 6>&1
+fi
+else
+  sim_stdio=""
+fi
+
+
+
+# Check whether --enable-sim-trace or --disable-sim-trace was given.
+if test "${enable_sim_trace+set}" = set; then
+  enableval="$enable_sim_trace"
+  case "${enableval}" in
+  yes)	sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
+  no)	sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
+  [-0-9]*)
+	sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
+  [a-z]*)
+	sim_trace=""
+	for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
+	  if test x"$sim_trace" = x; then
+	    sim_trace="-DWITH_TRACE='(TRACE_$x"
+	  else
+	    sim_trace="${sim_trace}|TRACE_$x"
+	  fi
+	done
+	sim_trace="$sim_trace)'" ;;
+esac
+if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
+  echo "Setting sim trace = $sim_trace" 6>&1
+fi
+else
+  sim_trace=""
+fi
+
+
+
+# Check whether --enable-sim-profile or --disable-sim-profile was given.
+if test "${enable_sim_profile+set}" = set; then
+  enableval="$enable_sim_profile"
+  case "${enableval}" in
+  yes)	sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";;
+  no)	sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";;
+  [-0-9]*)
+	sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
+  [a-z]*)
+	sim_profile=""
+	for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
+	  if test x"$sim_profile" = x; then
+	    sim_profile="-DWITH_PROFILE='(PROFILE_$x"
+	  else
+	    sim_profile="${sim_profile}|PROFILE_$x"
+	  fi
+	done
+	sim_profile="$sim_profile)'" ;;
+esac
+if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
+  echo "Setting sim profile = $sim_profile" 6>&1
+fi
+else
+  sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1"
+fi
+
+
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:3416: 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 3421 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:3438: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_type_signal=void
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_type_signal=int
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
+
+
+
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:3460: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+  ac_cv_exeext=.exe
+else
+  rm -f conftest*
+  echo 'int main () { return 0; }' > conftest.$ac_ext
+  ac_cv_exeext=
+  if { (eval echo configure:3470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+    for file in conftest.*; do
+      case $file in
+      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+      *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+      esac
+    done
+  else
+    { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+  fi
+  rm -f conftest*
+  test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
+
+sim_link_files=
+sim_link_links=
+
+sim_link_links=tconfig.h
+if test -f ${srcdir}/tconfig.in
+then
+  sim_link_files=tconfig.in
+else
+  sim_link_files=../common/tconfig.in
+fi
+
+# targ-vals.def points to the libc macro description file.
+case "${target}" in
+*-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
+esac
+sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
+sim_link_links="${sim_link_links} targ-vals.def"
+
+
+
+
+default_sim_inline="-DDEFAULT_INLINE=0"
+# Check whether --enable-sim-inline or --disable-sim-inline was given.
+if test "${enable_sim_inline+set}" = set; then
+  enableval="$enable_sim_inline"
+  sim_inline=""
+case "$enableval" in
+  no)		sim_inline="-DDEFAULT_INLINE=0";;
+  0)		sim_inline="-DDEFAULT_INLINE=0";;
+  yes | 2)	sim_inline="-DDEFAULT_INLINE=ALL_C_INLINE";;
+  1)		sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
+  *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
+       new_flag=""
+       case "$x" in
+	 *_INLINE=*)	new_flag="-D$x";;
+	 *=*)		new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
+	 *_INLINE)	new_flag="-D$x=ALL_C_INLINE";;
+	 *)		new_flag="-D$x""_INLINE=ALL_C_INLINE";;
+       esac
+       if test x"$sim_inline" = x""; then
+	 sim_inline="$new_flag"
+       else
+	 sim_inline="$sim_inline $new_flag"
+       fi
+     done;;
+esac
+if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
+  echo "Setting inline flags = $sim_inline" 6>&1
+fi
+else
+  
+if test "x$cross_compiling" = "xno"; then
+  if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
+    sim_inline="${default_sim_inline}"
+    if test x"$silent" != x"yes"; then
+      echo "Setting inline flags = $sim_inline" 6>&1
+    fi
+  else
+    sim_inline=""
+  fi
+else
+  sim_inline="-DDEFAULT_INLINE=0"
+fi
+fi
+
+
+wire_endian="LITTLE_ENDIAN"
+default_endian=""
+# Check whether --enable-sim-endian or --disable-sim-endian was given.
+if test "${enable_sim_endian+set}" = set; then
+  enableval="$enable_sim_endian"
+  case "${enableval}" in
+  b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
+  l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
+  yes)	 if test x"$wire_endian" != x; then
+	   sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
+	 else
+           if test x"$default_endian" != x; then
+	     sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}"
+	   else
+	     echo "No hard-wired endian for target $target" 1>&6
+	     sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
+	   fi
+	 fi;;
+  no)	 if test x"$default_endian" != x; then
+	   sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
+	 else
+	   if test x"$wire_endian" != x; then
+	     sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}"
+	   else
+	     echo "No default endian for target $target" 1>&6
+	     sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
+	   fi
+	 fi;;
+  *)	 { echo "configure: error: "Unknown value $enableval for --enable-sim-endian"" 1>&2; exit 1; }; sim_endian="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
+  echo "Setting endian flags = $sim_endian" 6>&1
+fi
+else
+  if test x"$default_endian" != x; then
+  sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
+else
+  if test x"$wire_endian" != x; then
+    sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
+  else
+    sim_endian=
+  fi
+fi
+fi
+
+wire_alignment="FORCED_ALIGNMENT"
+default_alignment=""
+
+# Check whether --enable-sim-alignment or --disable-sim-alignment was given.
+if test "${enable_sim_alignment+set}" = set; then
+  enableval="$enable_sim_alignment"
+  case "${enableval}" in
+  strict | STRICT)       sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
+  nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
+  forced | FORCED)       sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";;
+  yes) if test x"$wire_alignment" != x; then
+	 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
+       else
+         if test x"$default_alignment" != x; then
+           sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
+         else
+	   echo "No hard-wired alignment for target $target" 1>&6
+	   sim_alignment="-DWITH_ALIGNMENT=0"
+         fi
+       fi;;
+  no)  if test x"$default_alignment" != x; then
+	 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
+       else
+         if test x"$wire_alignment" != x; then
+	   sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
+         else
+           echo "No default alignment for target $target" 1>&6
+           sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
+         fi
+       fi;;
+  *)   { echo "configure: error: "Unknown value $enableval passed to --enable-sim-alignment"" 1>&2; exit 1; }; sim_alignment="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
+  echo "Setting alignment flags = $sim_alignment" 6>&1
+fi
+else
+  if test x"$default_alignment" != x; then
+  sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
+else
+  if test x"$wire_alignment" != x; then
+    sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
+  else
+    sim_alignment=
+  fi
+fi
+fi
+
+
+# Check whether --enable-sim-hostendian or --disable-sim-hostendian was given.
+if test "${enable_sim_hostendian+set}" = set; then
+  enableval="$enable_sim_hostendian"
+  case "${enableval}" in
+  no)	 sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
+  b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
+  l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
+  *)	 { echo "configure: error: "Unknown value $enableval for --enable-sim-hostendian"" 1>&2; exit 1; }; sim_hostendian="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
+  echo "Setting hostendian flags = $sim_hostendian" 6>&1
+fi
+else
+  
+if test "x$cross_compiling" = "xno"; then
+  echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
+echo "configure:3666: checking whether byte ordering is bigendian" >&5
+if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_c_bigendian=unknown
+# See if sys/param.h defines the BYTE_ORDER macro.
+cat > conftest.$ac_ext <<EOF
+#line 3673 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:3684: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+cat > conftest.$ac_ext <<EOF
+#line 3688 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:3699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_bigendian=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_bigendian=no
+fi
+rm -f conftest*
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+if test $ac_cv_c_bigendian = unknown; then
+if test "$cross_compiling" = yes; then
+    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+  cat > conftest.$ac_ext <<EOF
+#line 3719 "configure"
+#include "confdefs.h"
+main () {
+  /* Are we little or big endian?  From Harbison&Steele.  */
+  union
+  {
+    long l;
+    char c[sizeof (long)];
+  } u;
+  u.l = 1;
+  exit (u.c[sizeof (long) - 1] == 1);
+}
+EOF
+if { (eval echo configure:3732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_c_bigendian=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_c_bigendian=yes
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_c_bigendian" 1>&6
+if test $ac_cv_c_bigendian = yes; then
+  cat >> confdefs.h <<\EOF
+#define WORDS_BIGENDIAN 1
+EOF
+
+fi
+
+  if test $ac_cv_c_bigendian = yes; then
+    sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
+  else
+    sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
+  fi
+else
+  sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
+fi
+fi
+
+
+# Check whether --enable-build-warnings or --disable-build-warnings was given.
+if test "${enable_build_warnings+set}" = set; then
+  enableval="$enable_build_warnings"
+  build_warnings="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations"
+case "${enableval}" in
+  yes)	;;
+  no)	build_warnings="-w";;
+  ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+	build_warnings="${build_warnings} ${t}";;
+  *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+	build_warnings="${t} ${build_warnings}";;
+  *)	build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+esac
+if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
+  echo "Setting warning flags = $build_warnings" 6>&1
+fi
+WARN_CFLAGS=""
+WERROR_CFLAGS=""
+if test "x${build_warnings}" != x -a "x$GCC" = xyes
+then
+  # Separate out the -Werror flag as some files just cannot be
+  # compiled with it enabled.
+  for w in ${build_warnings}; do
+    case $w in
+    -Werr*) WERROR_CFLAGS=-Werror ;;
+    *) WARN_CFLAGS="${WARN_CFLAGS} $w"
+    esac
+  done
+fi
+else
+  build_warnings=""
+fi
+
+
+default_sim_reserved_bits="1"
+# Check whether --enable-sim-reserved-bits or --disable-sim-reserved-bits was given.
+if test "${enable_sim_reserved_bits+set}" = set; then
+  enableval="$enable_sim_reserved_bits"
+  case "${enableval}" in
+  yes)	sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
+  no)	sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
+  *)	{ echo "configure: error: "--enable-sim-reserved-bits does not take a value"" 1>&2; exit 1; }; sim_reserved_bits="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
+  echo "Setting reserved flags = $sim_reserved_bits" 6>&1
+fi
+else
+  sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"
+fi
+
+wire_word_bitsize="32"
+wire_word_msb="31"
+wire_address_bitsize=""
+wire_cell_bitsize=""
+# Check whether --enable-sim-bitsize or --disable-sim-bitsize was given.
+if test "${enable_sim_bitsize+set}" = set; then
+  enableval="$enable_sim_bitsize"
+  sim_bitsize=
+case "${enableval}" in
+  64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";;
+  32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";;
+  64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
+  32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
+  32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
+        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31"
+      else
+        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0"
+      fi ;;
+  64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
+        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63"
+      else
+        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0"
+      fi ;;
+  *)  { echo "configure: error: "--enable-sim-bitsize was given $enableval.  Expected 32 or 64"" 1>&2; exit 1; } ;;
+esac
+# address bitsize
+tmp=`echo "${enableval}" | sed -e "s/^[0-9]*,*[0-9]*,*//"`
+case x"${tmp}" in
+  x ) ;;
+  x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;;
+  x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;;
+  * ) { echo "configure: error: "--enable-sim-bitsize was given address size $enableval.  Expected 32 or 64"" 1>&2; exit 1; } ;;
+esac
+# cell bitsize
+tmp=`echo "${enableval}" | sed -e "s/^[0-9]*,*[0-9*]*,*[0-9]*,*//"`
+case x"${tmp}" in
+  x ) ;;
+  x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;;
+  x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;;
+  * ) { echo "configure: error: "--enable-sim-bitsize was given cell size $enableval.  Expected 32 or 64"" 1>&2; exit 1; } ;;
+esac
+if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
+  echo "Setting bitsize flags = $sim_bitsize" 6>&1
+fi
+else
+  sim_bitsize=""
+if test x"$wire_word_bitsize" != x; then
+  sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize"
+fi
+if test x"$wire_word_msb" != x; then
+  sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb"
+fi
+if test x"$wire_address_bitsize" != x; then
+  sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize"
+fi
+if test x"$wire_cell_bitsize" != x; then
+  sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize"
+fi
+fi
+
+
+for ac_hdr in stdlib.h unistd.h string.h strings.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:3881: 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 3886 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3891: \"$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 getpid kill
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3920: 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 3925 "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:3948: \"$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
+
+
+
+
+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
+
+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.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.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in 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%@sim_environment@%$sim_environment%g
+s%@sim_alignment@%$sim_alignment%g
+s%@sim_assert@%$sim_assert%g
+s%@sim_bitsize@%$sim_bitsize%g
+s%@sim_endian@%$sim_endian%g
+s%@sim_hostendian@%$sim_hostendian%g
+s%@sim_float@%$sim_float%g
+s%@sim_scache@%$sim_scache%g
+s%@sim_default_model@%$sim_default_model%g
+s%@sim_hw_cflags@%$sim_hw_cflags%g
+s%@sim_hw_objs@%$sim_hw_objs%g
+s%@sim_hw@%$sim_hw%g
+s%@sim_inline@%$sim_inline%g
+s%@sim_packages@%$sim_packages%g
+s%@sim_regparm@%$sim_regparm%g
+s%@sim_reserved_bits@%$sim_reserved_bits%g
+s%@sim_smp@%$sim_smp%g
+s%@sim_stdcall@%$sim_stdcall%g
+s%@sim_xor_endian@%$sim_xor_endian%g
+s%@WARN_CFLAGS@%$WARN_CFLAGS%g
+s%@WERROR_CFLAGS@%$WERROR_CFLAGS%g
+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%@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%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_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%@CC@%$CC%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
+s%@HDEFINES@%$HDEFINES%g
+s%@AR@%$AR%g
+s%@RANLIB@%$RANLIB%g
+s%@SET_MAKE@%$SET_MAKE%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
+s%@MAINT@%$MAINT%g
+s%@sim_bswap@%$sim_bswap%g
+s%@sim_cflags@%$sim_cflags%g
+s%@sim_debug@%$sim_debug%g
+s%@sim_stdio@%$sim_stdio%g
+s%@sim_trace@%$sim_trace%g
+s%@sim_profile@%$sim_profile%g
+s%@EXEEXT@%$EXEEXT%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.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in"}
+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="$sim_link_files"
+ac_dests="$sim_link_links"
+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
+case "x$CONFIG_FILES" in
+ xMakefile*)
+   echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
+   rm -f Makesim1.tmp Makesim2.tmp Makefile
+   sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
+   sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
+   sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
+	-e '/^## COMMON_POST_/ r Makesim2.tmp' \
+	<Makefile.sim >Makefile
+   rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
+   ;;
+ esac
+ case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac
+
+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/sim/tic80/configure.in b/sim/tic80/configure.in
new file mode 100644
index 0000000..730b62e
--- /dev/null
+++ b/sim/tic80/configure.in
@@ -0,0 +1,21 @@
+dnl Process this file with autoconf to produce a configure script.
+sinclude(../common/aclocal.m4)
+AC_PREREQ(2.5)dnl
+AC_INIT(Makefile.in)
+
+SIM_AC_COMMON
+
+dnl Options available in this module
+SIM_AC_OPTION_INLINE(0)
+SIM_AC_OPTION_ENDIAN(LITTLE_ENDIAN)
+SIM_AC_OPTION_ALIGNMENT(FORCED_ALIGNMENT)
+SIM_AC_OPTION_HOSTENDIAN
+SIM_AC_OPTION_WARNINGS
+SIM_AC_OPTION_RESERVED_BITS(1)
+SIM_AC_OPTION_BITSIZE(32,31)
+
+dnl For UNIX emulation
+AC_CHECK_HEADERS(stdlib.h unistd.h string.h strings.h)
+AC_CHECK_FUNCS(getpid kill)
+
+SIM_AC_OUTPUT
diff --git a/sim/tic80/cpu.h b/sim/tic80/cpu.h
new file mode 100644
index 0000000..642c181
--- /dev/null
+++ b/sim/tic80/cpu.h
@@ -0,0 +1,345 @@
+/* TIc80 Simulator.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Contributed by Cygnus Support.
+
+This file is part of GDB, the GNU debugger.
+
+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.  */
+
+
+
+/* TI C80 control registers */
+
+typedef enum {
+  EPC_CR,
+  EIP_CR,
+  CONFIG_CR,
+  INTPEN_CR,
+  IE_CR,
+  FPST_CR,
+  PPERROR_CR,
+  PKTREQ_CR,
+  TCOUNT_CR,
+  TSCALE_CR,
+  FLTOP_CR,
+  FLTADR_CR,
+  FLTTAG_CR,
+  FLTDLT_CR,
+  FLTDTH_CR,
+  FLT005_CR,
+  FLT006_CR,
+  FLT007_CR,
+  FLT008_CR,
+  FLT009_CR,
+  FLT010_CR,
+  FLT011_CR,
+  FLT012_CR,
+  FLT013_CR,
+  FLT014_CR,
+  FLT015_CR,
+  SYSSTK_CR,
+  SYSTMP_CR,
+  MPC_CR,
+  MIP_CR,
+  ECOMCNTL_CR,
+  ANASTAT_CR,
+  BRK1_CR,
+  BRK2_CR,
+  ITAG0_CR,
+  ITAG1_CR,
+  ITAG2_CR,
+  ITAG3_CR,
+  ITAG4_CR,
+  ITAG5_CR,
+  ITAG6_CR,
+  ITAG7_CR,
+  ITAG8_CR,
+  ITAG9_CR,
+  ITAG10_CR,
+  ITAG11_CR,
+  ITAG12_CR,
+  ITAG13_CR,
+  ITAG14_CR,
+  ITAG15_CR,
+  ILRU_CR,
+  DTAG0_CR,
+  DTAG1_CR,
+  DTAG2_CR,
+  DTAG3_CR,
+  DTAG4_CR,
+  DTAG5_CR,
+  DTAG6_CR,
+  DTAG7_CR,
+  DTAG8_CR,
+  DTAG9_CR,
+  DTAG10_CR,
+  DTAG11_CR,
+  DTAG12_CR,
+  DTAG13_CR,
+  DTAG14_CR,
+  DTAG15_CR,
+  DLRU_CR,
+  IN0P_CR,
+  IN1P_CR,
+  OUTP_CR,
+  SCRATCH_CR,
+  nr_tic80_control_regs,
+} tic80_control_regs;
+
+/* extern int tic80_cr2index (tic80_control_regs reg); */
+
+/* Map an instruction CR index onto the corresponding internal cr enum
+   or SCRATCH_CR if the index is invalid */
+
+extern tic80_control_regs tic80_index2cr (int index);
+
+
+/* TIc80 interrupt register bits */
+
+enum {
+  IE_CR_PE = BIT32(31),
+  IE_CR_X4 = BIT32(30),
+  IE_CR_X3 = BIT32(29),
+  IE_CR_BP = BIT32(28),
+  IE_CR_PB = BIT32(27),
+  IE_CR_PC = BIT32(26),
+  IE_CR_MI = BIT32(25),
+  /**/
+  IE_CR_P3 = BIT32(19),
+  IE_CR_P2 = BIT32(18),
+  IE_CR_P1 = BIT32(17),
+  IE_CR_P0 = BIT32(16),
+  IE_CR_IO = BIT32(15),
+  IE_CR_MF = BIT32(14),
+  /**/
+  IE_CR_X2 = BIT32(12),
+  IE_CR_X1 = BIT32(11),
+  IE_CR_TI = BIT32(10),
+  IE_CR_F1 = BIT32(9),
+  IE_CR_F0 = BIT32(8),
+  IE_CR_FX = BIT32(7),
+  IE_CR_FU = BIT32(6),
+  IE_CR_FO = BIT32(5),
+  /**/
+  IE_CR_FZ = BIT32(3),
+  IE_CR_FI = BIT32(2),
+  /**/
+  IE_CR_IE = BIT32(0),
+};
+
+
+
+
+struct _sim_cpu {
+  unsigned32 reg[32];
+  unsigned64 acc[4];
+  unsigned32 cr[nr_tic80_control_regs];
+  int is_user_mode; /* hidden mode latch */
+  sim_cia cia;
+  sim_cpu_base base;
+};
+
+#define CIA_GET(CPU) ((CPU)->cia)
+#define CIA_SET(CPU,VAL) ((CPU)->cia = (VAL))
+
+#define GPR(N) ((CPU)->reg[N])
+#define GPR_CLEAR(N) (GPR((N)) = 0)
+#define ACC(N) ((CPU)->acc[N])
+#define CR(N) ((CPU)->cr[tic80_index2cr ((N))])
+
+
+
+#if defined(WITH_TRACE)
+extern char *tic80_trace_alu3	  PARAMS ((int, unsigned32, unsigned32, unsigned32));
+extern char *tic80_trace_cmp	  PARAMS ((int, unsigned32, unsigned32, unsigned32));
+extern char *tic80_trace_alu2	  PARAMS ((int, unsigned32, unsigned32));
+extern char *tic80_trace_shift	  PARAMS ((int, unsigned32, unsigned32, int, int, int, int, int));
+extern void tic80_trace_fpu3	  PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, sim_fpu *, sim_fpu *, sim_fpu *));
+extern void tic80_trace_fpu2	  PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, sim_fpu *, sim_fpu *));
+extern void tic80_trace_fpu1	  PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, sim_fpu *));
+extern void tic80_trace_fpu2i	  PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, unsigned32, sim_fpu *, sim_fpu *));
+extern void tic80_trace_fpu2cmp	  PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, unsigned32, sim_fpu *, sim_fpu *));
+extern char *tic80_trace_nop	  PARAMS ((int));
+extern char *tic80_trace_sink1	  PARAMS ((int, unsigned32));
+extern char *tic80_trace_sink2	  PARAMS ((int, unsigned32, unsigned32));
+extern char *tic80_trace_sink3	  PARAMS ((int, unsigned32, unsigned32, unsigned32));
+extern char *tic80_trace_cond_br  PARAMS ((int, int, unsigned32, unsigned32, int, int));
+extern char *tic80_trace_ucond_br PARAMS ((int, unsigned32));
+extern void tic80_trace_ldst	  PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, int, int, int, unsigned32, unsigned32, unsigned32));
+
+#define TRACE_ALU3(indx, result, input1, input2)			\
+do {									\
+  if (TRACE_ALU_P (CPU)) {						\
+    trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file,		\
+		    itable[indx].line_nr, "alu",			\
+		    tic80_trace_alu3 (indx, result, input1, input2));	\
+  }									\
+} while (0)
+
+#define TRACE_CMP(indx, result, input1, input2)				\
+do {									\
+  if (TRACE_ALU_P (CPU)) {						\
+    trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file,		\
+		    itable[indx].line_nr, "alu",			\
+		    tic80_trace_cmp (indx, result, input1, input2));	\
+  }									\
+} while (0)
+
+#define TRACE_ALU2(indx, result, input)					\
+do {									\
+  if (TRACE_ALU_P (CPU)) {						\
+    trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file,		\
+		    itable[indx].line_nr, "alu",			\
+		    tic80_trace_alu2 (indx, result, input));		\
+  }									\
+} while (0)
+
+#define TRACE_SHIFT(indx, result, input, i, n, merge, endmask, rotate)	\
+do {									\
+  if (TRACE_ALU_P (CPU)) {						\
+    trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file,		\
+		    itable[indx].line_nr, "shift",			\
+		    tic80_trace_shift (indx, result, input, i, n,	\
+				       merge, endmask, rotate));	\
+  }									\
+} while (0)
+
+#define TRACE_FPU3(result, input1, input2)				\
+do {									\
+  if (TRACE_FPU_P (CPU)) {						\
+    tic80_trace_fpu3 (SD, CPU, cia, MY_INDEX, 				\
+		      &result, &input1, &input2);			\
+  }									\
+} while (0)
+
+#define TRACE_FPU2(result, input)					\
+do {									\
+  if (TRACE_FPU_P (CPU)) {						\
+    tic80_trace_fpu2 (SD, CPU, cia, MY_INDEX, 				\
+		      &result, &input);					\
+  }									\
+} while (0)
+
+#define TRACE_FPU1(result)						\
+do {									\
+  if (TRACE_FPU_P (CPU)) {						\
+    tic80_trace_fpu1 (SD, CPU, cia, MY_INDEX, 				\
+		      &result);						\
+  }									\
+} while (0)
+
+#define TRACE_FPU2I(result, input1, input2)				\
+do {									\
+  if (TRACE_FPU_P (CPU)) {						\
+    tic80_trace_fpu2i (SD, CPU, cia, MY_INDEX, 				\
+		       result, &input1, &input2);			\
+  }									\
+} while (0)
+
+#define TRACE_FPU2CMP(result, input1, input2)				\
+do {									\
+  if (TRACE_FPU_P (CPU)) {						\
+    tic80_trace_fpu2cmp (SD, CPU, cia, MY_INDEX,			\
+			 result, &input1, &input2);			\
+  }									\
+} while (0)
+
+#define TRACE_NOP(indx)							\
+do {									\
+  if (TRACE_ALU_P (CPU)) {						\
+    trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file,		\
+		    itable[indx].line_nr, "nop",			\
+		    tic80_trace_nop (indx));				\
+  }									\
+} while (0)
+
+#define TRACE_SINK1(indx, input)					\
+do {									\
+  if (TRACE_ALU_P (CPU)) {						\
+    trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file,		\
+		    itable[indx].line_nr, "nop",			\
+		    tic80_trace_sink1 (indx, input));			\
+  }									\
+} while (0)
+
+#define TRACE_SINK2(indx, input1, input2)				\
+do {									\
+  if (TRACE_ALU_P (CPU)) {						\
+    trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file,		\
+		    itable[indx].line_nr, "nop",			\
+		    tic80_trace_sink2 (indx, input1, input2));		\
+  }									\
+} while (0)
+
+#define TRACE_SINK3(indx, input1, input2, input3)			\
+do {									\
+  if (TRACE_ALU_P (CPU)) {						\
+    trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file,		\
+		    itable[indx].line_nr, "nop",			\
+		    tic80_trace_sink3 (indx, input1, input2, input3));	\
+  }									\
+} while (0)
+
+#define TRACE_COND_BR(indx, jump_p, cond, target, size, code)		\
+do {									\
+  if (TRACE_BRANCH_P (CPU)) {						\
+    trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file,		\
+		    itable[indx].line_nr, "branch",			\
+		    tic80_trace_cond_br (indx, jump_p, cond, target,	\
+					 size, code));			\
+  }									\
+} while (0)
+
+#define TRACE_UCOND_BR(indx, target)					\
+do {									\
+  if (TRACE_BRANCH_P (CPU)) {						\
+    trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file,		\
+		    itable[indx].line_nr, "branch",			\
+		    tic80_trace_ucond_br (indx, target));		\
+  }									\
+} while (0)
+
+#define TRACE_LD(result, m, s, addr1, addr2)				\
+do {									\
+  if (TRACE_MEMORY_P (CPU)) {						\
+    tic80_trace_ldst (SD, CPU, cia, MY_INDEX, 				\
+ 		      0, m, s, result, addr1, addr2);			\
+  }									\
+} while (0)
+
+#define TRACE_ST(value, m, s, addr1, addr2)				\
+do {									\
+  if (TRACE_MEMORY_P (CPU)) {						\
+    tic80_trace_ldst (SD, CPU, cia, MY_INDEX, 				\
+		      1, m, s, value, addr1, addr2);			\
+  }									\
+} while (0)
+
+#else
+#define TRACE_ALU3(indx, result, input1, input2)
+#define TRACE_ALU2(indx, result, input)
+#define TRACE_FPU3(result, input1, input2)
+#define TRACE_FPU2(result, input)
+#define TRACE_FPU1(result)
+#define TRACE_FPU2I(result, input1, input2)
+#define TRACE_NOP(indx)
+#define TRACE_SINK1(indx, input)
+#define TRACE_SINK2(indx, input1, input2)
+#define TRACE_SINK3(indx, input1, input2, input3)
+#define TRACE_COND_BR(indx, jump_p, cond, target, size, code)
+#define TRACE_UCOND_BR(indx, target)
+#define TRACE_LD(m, s, result, addr1, addr2)
+#define TRACE_ST(m, s, value, addr1, addr2)
+#endif
diff --git a/sim/tic80/interp.c b/sim/tic80/interp.c
new file mode 100644
index 0000000..17f06d4
--- /dev/null
+++ b/sim/tic80/interp.c
@@ -0,0 +1,127 @@
+/*  This file is part of the GDB simulators.
+
+    Copyright (C) 1997, Free Software Foundation
+    Condtributed by Cyngnus Solutions.
+
+    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 "sim-main.h"
+
+#include "idecode.h"
+#include "itable.h"
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+
+
+#if 0
+
+void
+engine_error (SIM_DESC sd,
+	      sim_cpu *cpu,
+	      instruction_address cia,
+	      const char *fmt,
+	      ...)
+{
+  va_list ap;
+  va_start (ap, fmt);
+  sim_io_evprintf (sd, fmt, ap);
+  va_end (ap);
+
+  sim_halt (sd, cpu, NULL, cia, sim_stopped, SIGABRT);
+}
+
+void
+engine_halt (SIM_DESC sd,
+	     sim_cpu *cpu,
+	     instruction_address cia,
+	     enum sim_stop reason,
+	     int siggnal)
+{
+  if (!sd->halt_ok)
+    sim_io_error (sd, "engine_halt - bad longjmp");
+  sd->reason = reason;
+  sd->siggnal = siggnal;
+  sd->halt_ok = 0;
+  sd->restart_ok = 0;
+  if (cpu != NULL)
+    cpu->cia = cia;
+  longjmp (sd->path_to_halt, 1);
+}
+
+void
+engine_restart (SIM_DESC sd,
+		sim_cpu *cpu,
+		instruction_address cia)
+{
+  if (!sd->restart_ok)
+    sim_io_error (sd, "engine_restart - bad longjmp");
+  sd->restart_ok = 0;
+  cpu->cia = cia;
+  longjmp(sd->path_to_restart, 1);
+}
+
+
+void
+engine_run_until_stop (SIM_DESC sd,
+		       volatile int *keep_running)
+{
+  if (!setjmp (sd->path_to_halt))
+    {
+      instruction_address cia;
+      sim_cpu *cpu = STATE_CPU (sd, 0);
+      sd->halt_ok = 1;
+      setjmp (sd->path_to_restart);
+      sd->restart_ok = 1;
+      cia = cpu->cia;
+      do
+	{
+	  instruction_word insn = IMEM (cia);
+	  cia = idecode_issue (sd, insn, cia);
+	}
+      while (*keep_running);
+      engine_halt (sd, cpu, cia, sim_stopped, SIM_SIGINT);
+    }
+}
+
+
+void
+engine_step (SIM_DESC sd)
+{
+  if (!setjmp (sd->path_to_halt))
+    {
+      instruction_address cia;
+      instruction_word insn;
+      sim_cpu *cpu = STATE_CPU (sd, 0);
+      sd->halt_ok = 1;
+      setjmp (sd->path_to_restart);
+      sd->restart_ok = 1;
+      cia = cpu->cia;
+      insn = IMEM (cia);
+      cia = idecode_issue (sd, insn, cia);
+      engine_halt (sd, cpu, cia, sim_stopped, SIM_SIGTRAP);
+    }
+}
+
+#endif
diff --git a/sim/tic80/misc.c b/sim/tic80/misc.c
new file mode 100644
index 0000000..fc7fbec
--- /dev/null
+++ b/sim/tic80/misc.c
@@ -0,0 +1,624 @@
+/* TIc80 Simulator.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Contributed by Cygnus Support.
+
+This file is part of GDB, the GNU debugger.
+
+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.  */
+
+
+#include "sim-main.h"
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+
+
+tic80_control_regs
+tic80_index2cr (int index)
+{
+  switch (index)
+    {
+    case 0x0000: return EPC_CR;
+    case 0x0001: return EIP_CR;
+    case 0x0002: return CONFIG_CR;
+    case 0x0004: return INTPEN_CR;
+    case 0x0006: return IE_CR;
+    case 0x0008: return FPST_CR;
+    case 0x000A: return PPERROR_CR;
+    case 0x000D: return PKTREQ_CR;
+    case 0x000E: return TCOUNT_CR;
+    case 0x000F: return TSCALE_CR;
+    case 0x0010: return FLTOP_CR;
+    case 0x0011: return FLTADR_CR;
+    case 0x0012: return FLTTAG_CR;
+    case 0x0013: return FLTDLT_CR;
+    case 0x0014: return FLTDTH_CR;
+    case 0x0015: return FLT005_CR;
+    case 0x0016: return FLT006_CR;
+    case 0x0017: return FLT007_CR;
+    case 0x0018: return FLT008_CR;
+    case 0x0019: return FLT009_CR;
+    case 0x001a: return FLT010_CR;
+    case 0x001b: return FLT011_CR;
+    case 0x001c: return FLT012_CR;
+    case 0x001d: return FLT013_CR;
+    case 0x001e: return FLT014_CR;
+    case 0x001f: return FLT015_CR;
+    case 0x0020: return SYSSTK_CR;
+    case 0x0021: return SYSTMP_CR;
+    case 0x0030: return MPC_CR;
+    case 0x0031: return MIP_CR;
+    case 0x0033: return ECOMCNTL_CR;
+    case 0x0034: return ANASTAT_CR;
+    case 0x0039: return BRK1_CR;
+    case 0x003A: return BRK2_CR;
+    case 0x0200: return ITAG0_CR;
+    case 0x0201: return ITAG1_CR;
+    case 0x0202: return ITAG2_CR;
+    case 0x0203: return ITAG3_CR;
+    case 0x0204: return ITAG4_CR;
+    case 0x0205: return ITAG5_CR;
+    case 0x0206: return ITAG6_CR;
+    case 0x0207: return ITAG7_CR;
+    case 0x0208: return ITAG8_CR;
+    case 0x0209: return ITAG9_CR;
+    case 0x020a: return ITAG10_CR;
+    case 0x020b: return ITAG11_CR;
+    case 0x020c: return ITAG12_CR;
+    case 0x020d: return ITAG13_CR;
+    case 0x020e: return ITAG14_CR;
+    case 0x020f: return ITAG15_CR;
+    case 0x0300: return ILRU_CR;
+    case 0x0400: return DTAG0_CR;
+    case 0x0401: return DTAG1_CR;
+    case 0x0402: return DTAG2_CR;
+    case 0x0403: return DTAG3_CR;
+    case 0x0404: return DTAG4_CR;
+    case 0x0405: return DTAG5_CR;
+    case 0x0406: return DTAG6_CR;
+    case 0x0407: return DTAG7_CR;
+    case 0x0408: return DTAG8_CR;
+    case 0x0409: return DTAG9_CR;
+    case 0x040a: return DTAG10_CR;
+    case 0x040b: return DTAG11_CR;
+    case 0x040c: return DTAG12_CR;
+    case 0x040d: return DTAG13_CR;
+    case 0x040e: return DTAG14_CR;
+    case 0x040f: return DTAG15_CR;
+    case 0x0500: return DLRU_CR;
+    case 0x4000: return IN0P_CR;
+    case 0x4001: return IN1P_CR;
+    case 0x4002: return OUTP_CR;
+    default: return SCRATCH_CR;
+    }
+}
+
+
+
+#if defined(WITH_TRACE)
+/* Tracing support routines */
+
+static char tic80_trace_buffer[1024];
+static int  tic80_size_name;
+
+#define SIZE_HEX	8
+#define SIZE_DECIMAL	11
+
+/* Initialize tracing by calculating the maximum name size */
+static void
+tic80_init_trace (void)
+{
+  int i;
+  int len, max_len = 0;
+
+  for (i = 0; i < (int)nr_itable_entries; i++) {
+    len = strlen (itable[i].name);
+    if (len > max_len)
+      max_len = len;
+  }
+
+  tic80_size_name = max_len + sizeof(":m") - 1 + sizeof (":s") - 1;
+}
+
+/* Given an integer which is the result of a comparison, return a string
+   giving which bits are set.  */
+
+static char *
+tic80_trace_cmp_internal (unsigned32 flag)
+{
+  struct cmp_bits { unsigned32 bit; char *string; };
+  static char buffer[32*8];
+  static struct cmp_bits bits[] =
+  {
+    { BIT32(29), "hs" },
+    { BIT32(28), "lo" },
+    { BIT32(27), "ls" },
+    { BIT32(26), "hi" },
+    { BIT32(25), "ge" },
+    { BIT32(24), "lt" },
+    { BIT32(23), "le" },
+    { BIT32(22), "gt" },
+    { BIT32(21), "ne" },
+    { BIT32(20), "eq" },
+
+    { BIT32(19), "hs.h" },
+    { BIT32(18), "lo.h" },
+    { BIT32(17), "ls.h" },
+    { BIT32(16), "hi.h" },
+    { BIT32(15), "ge.h" },
+    { BIT32(14), "lt.h" },
+    { BIT32(13), "le.h" },
+    { BIT32(12), "gt.h" },
+    { BIT32(11), "ne.h" },
+    { BIT32(10), "eq.h" },
+
+    { BIT32( 9), "hs.b" },
+    { BIT32( 8), "lo.b" },
+    { BIT32( 7), "ls.b" },
+    { BIT32( 6), "hi.b" },
+    { BIT32( 5), "ge.b" },
+    { BIT32( 4), "lt.b" },
+    { BIT32( 3), "le.b" },
+    { BIT32( 2), "gt.b" },
+    { BIT32( 1), "ne.b" },
+    { BIT32( 0), "eq.b" },
+    { 0,	 (char *)0 },
+  };
+
+  int i;
+  char *p = buffer;
+
+  for (i = 0; bits[i].bit != 0; i++)
+    {
+      if ((flag & bits[i].bit) != 0)
+	{
+	  if (p != buffer)
+	    *p++ = ' ';
+
+	  strcpy (p, bits[i].string);
+	  p += strlen (p);
+	}
+    }
+
+  *p = '\0';
+  return buffer;
+}
+
+/* Trace the result of an ALU operation with 2 integer inputs and an integer output */
+char *
+tic80_trace_alu3 (int indx,
+		  unsigned32 result,
+		  unsigned32 input1,
+		  unsigned32 input2)
+{
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld => 0x%.*lx/%*ld",
+	   tic80_size_name, itable[indx].name,
+	   SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1,
+	   SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2,
+	   SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result);
+
+  return tic80_trace_buffer;
+}
+
+/* Trace the result of an ALU operation with 2 integer inputs and an integer output
+   that sets the bits from a compare instruction.  */
+char *
+tic80_trace_cmp (int indx,
+		 unsigned32 result,
+		 unsigned32 input1,
+		 unsigned32 input2)
+{
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld => 0x%.*lx %s",
+	   tic80_size_name, itable[indx].name,
+	   SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1,
+	   SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2,
+	   SIZE_HEX, result, tic80_trace_cmp_internal (result));
+
+  return tic80_trace_buffer;
+}
+
+/* Trace the result of an ALU operation with 1 integer input and an integer output */
+char *
+tic80_trace_alu2 (int indx,
+		  unsigned32 result,
+		  unsigned32 input)
+{
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld %*s => 0x%.*lx/%*ld",
+	   tic80_size_name, itable[indx].name,
+	   SIZE_HEX, input, SIZE_DECIMAL, (long)(signed32)input,
+	   SIZE_HEX + SIZE_DECIMAL + 3, "",
+	   SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result);
+
+  return tic80_trace_buffer;
+}
+
+/* Trace the result of a shift instruction */
+char *
+tic80_trace_shift (int indx,
+		   unsigned32 result,
+		   unsigned32 input,
+		   int i,
+		   int n,
+		   int merge,
+		   int endmask,
+		   int rotate)
+{
+  const char *merge_name;
+  char name[40];
+  char *p;
+
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  switch (merge)
+    {
+    default:	merge_name = ".??"; break;
+    case 0:	merge_name = ".dz"; break;
+    case 1:	merge_name = ".dm"; break;
+    case 2:	merge_name = ".ds"; break;
+    case 3:	merge_name = ".ez"; break;
+    case 4:	merge_name = ".em"; break;
+    case 5:	merge_name = ".es"; break;
+    case 6:	merge_name = ".iz"; break;
+    case 7:	merge_name = ".im"; break;
+    }
+
+  /* Don't use itable[indx].name, which is just sl {r,i}.  Instead reconstruct
+     the name, using the i and n fields.  */
+  p = strchr (itable[indx].name, ' ');
+  sprintf (name, "s%s%s%s%s",
+	   (n) ? "r" : "l",
+	   (i) ? "i" : "",
+	   merge_name,
+	   (p) ? p : "");
+
+  sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld %*s%2d,%2d => 0x%.*lx/%*ld",
+	   tic80_size_name, name,
+	   SIZE_HEX, input, SIZE_DECIMAL, (long)(signed32)input,
+	   SIZE_HEX + SIZE_DECIMAL - 2, "",
+	   rotate, endmask,
+	   SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result);
+
+  return tic80_trace_buffer;
+}
+
+/* Trace the result of an FPU operation with 2 floating point inputs and a floating point output */
+void
+tic80_trace_fpu3 (SIM_DESC sd,
+		  sim_cpu *cpu,
+		  sim_cia cia,
+		  int indx,
+		  sim_fpu *result,
+		  sim_fpu *input1,
+		  sim_fpu *input2)
+{
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  trace_one_insn (sd, cpu, cia.ip, 1,
+		  itable[indx].file, itable[indx].line_nr, "fpu",
+		  "%-*s %*g %*g => %*g",
+		  tic80_size_name, itable[indx].name,
+		  SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input1),
+		  SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input2),
+		  SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (result));
+}
+
+/* Trace the result of an FPU operation with 1 floating point input and a floating point output */
+void
+tic80_trace_fpu2 (SIM_DESC sd,
+		  sim_cpu *cpu,
+		  sim_cia cia,
+		  int indx,
+		  sim_fpu *result,
+		  sim_fpu *input)
+{
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  trace_one_insn (sd, cpu, cia.ip, 1,
+		  itable[indx].file, itable[indx].line_nr, "fpu",
+		  "%-*s %*g %-*s => %*g",
+		  tic80_size_name, itable[indx].name,
+		  SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input),
+		  SIZE_HEX + SIZE_DECIMAL + 3, "",
+		  SIZE_HEX + SIZE_DECIMAL, sim_fpu_2d (result));
+}
+
+/* Trace the result of an FPU operation with 1 floating point input and a floating point output */
+void
+tic80_trace_fpu1 (SIM_DESC sd,
+		  sim_cpu *cpu,
+		  sim_cia cia,
+		  int indx,
+		  sim_fpu *result)
+{
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  trace_one_insn (sd, cpu, cia.ip, 1,
+		  itable[indx].file, itable[indx].line_nr, "fpu",
+		  "%-*s %-*s %-*s => %*g",
+		  tic80_size_name, itable[indx].name,
+		  SIZE_HEX + SIZE_DECIMAL + 3, "",
+		  SIZE_HEX + SIZE_DECIMAL + 3, "",
+		  SIZE_HEX + SIZE_DECIMAL, sim_fpu_2d (result));
+}
+
+/* Trace the result of an FPU operation with 2 floating point inputs and an integer output */
+void
+tic80_trace_fpu2i (SIM_DESC sd,
+		   sim_cpu *cpu,
+		   sim_cia cia,
+		   int indx,
+		   unsigned32 result,
+		   sim_fpu *input1,
+		   sim_fpu *input2)
+{
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  trace_one_insn (sd, cpu, cia.ip, 1,
+		  itable[indx].file, itable[indx].line_nr, "fpu",
+		  "%-*s %*g %*g => 0x%.*lx %-*ld",
+		  tic80_size_name, itable[indx].name,
+		  SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input1),
+		  SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input2),
+		  SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result);
+}
+
+/* Trace the result of an FPU operation with 2 floating point inputs and an integer output
+   that is the result of a comparison.  */
+void
+tic80_trace_fpu2cmp (SIM_DESC sd,
+		     sim_cpu *cpu,
+		     sim_cia cia,
+		     int indx,
+		     unsigned32 result,
+		     sim_fpu *input1,
+		     sim_fpu *input2)
+{
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  trace_one_insn (sd, cpu, cia.ip, 1,
+		  itable[indx].file, itable[indx].line_nr, "fpu",
+		  "%-*s %*g %*g => 0x%.*lx %s",
+		  tic80_size_name, itable[indx].name,
+		  SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input1),
+		  SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input2),
+		  SIZE_HEX, result, tic80_trace_cmp_internal (result));
+}
+
+/* Trace the result of a NOP operation */
+char *
+tic80_trace_nop (int indx)
+{
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  sprintf (tic80_trace_buffer, "%s", itable[indx].name);
+  return tic80_trace_buffer;
+}
+
+/* Trace the result of a data sink with one input */
+char *
+tic80_trace_sink1 (int indx, unsigned32 input)
+{
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld",
+	   tic80_size_name, itable[indx].name,
+	   SIZE_HEX, input, SIZE_DECIMAL, (long)(signed32)input);
+
+  return tic80_trace_buffer;
+}
+
+/* Trace the result of a data sink with two inputs */
+char *
+tic80_trace_sink2 (int indx, unsigned32 input1, unsigned32 input2)
+{
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld",
+	   tic80_size_name, itable[indx].name,
+	   SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1,
+	   SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2);
+
+  return tic80_trace_buffer;
+}
+
+/* Trace the result of a data sink with three inputs */
+char *
+tic80_trace_sink3 (int indx, unsigned32 input1, unsigned32 input2, unsigned32 input3)
+{
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld    0x%.*lx/%*ld",
+	   tic80_size_name, itable[indx].name,
+	   SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1,
+	   SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2,
+	   SIZE_HEX, input3, SIZE_DECIMAL, (long)(signed32)input3);
+
+  return tic80_trace_buffer;
+}
+
+/* Trace the result of a conditional branch operation */
+char *
+tic80_trace_cond_br (int indx,
+		     int jump_p,
+		     unsigned32 cond,
+		     unsigned32 target,
+		     int size,
+		     int code)
+{
+  char *suffix1, *suffix2;
+
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  if (size >= 0 && code >= 0)
+    {				/* BCND */
+      switch (code)
+	{
+	default: suffix1 = "???"; break;
+	case 0:  suffix1 = "nev"; break;
+	case 1:  suffix1 = "gt0"; break;
+	case 2:  suffix1 = "eq0"; break;
+	case 3:  suffix1 = "ge0"; break;
+	case 4:  suffix1 = "lt0"; break;
+	case 5:  suffix1 = "ne0"; break;
+	case 6:  suffix1 = "le0"; break;
+	case 7:  suffix1 = "alw"; break;
+	}
+
+      switch (size)
+	{
+	default: suffix2 = ".?"; break;
+	case 0:  suffix2 = ".b"; break;
+	case 1:  suffix2 = ".h"; break;
+	case 2:  suffix2 = ".w"; break;
+	}
+
+    } else {			/* BBO/BBZ */
+
+      suffix2 = "";
+      switch (cond)
+	{
+	default: suffix1 = "??.?"; break;
+	case 29: suffix1 = "hs.w"; break;
+	case 28: suffix1 = "lo.w"; break;
+	case 27: suffix1 = "ls.w"; break;
+	case 26: suffix1 = "hi.w"; break;
+	case 25: suffix1 = "ge.w"; break;
+	case 24: suffix1 = "lt.w"; break;
+	case 23: suffix1 = "le.w"; break;
+	case 22: suffix1 = "gt.w"; break;
+	case 21: suffix1 = "ne.w"; break;
+	case 20: suffix1 = "eq.w"; break;
+	case 19: suffix1 = "hs.h"; break;
+	case 18: suffix1 = "lo.h"; break;
+	case 17: suffix1 = "ls.h"; break;
+	case 16: suffix1 = "hi.h"; break;
+	case 15: suffix1 = "ge.h"; break;
+	case 14: suffix1 = "lt.h"; break;
+	case 13: suffix1 = "le.h"; break;
+	case 12: suffix1 = "gt.h"; break;
+	case 11: suffix1 = "ne.h"; break;
+	case 10: suffix1 = "eq.h"; break;
+	case  9: suffix1 = "hs.b"; break;
+	case  8: suffix1 = "lo.b"; break;
+	case  7: suffix1 = "ls.b"; break;
+	case  6: suffix1 = "hi.b"; break;
+	case  5: suffix1 = "ge.b"; break;
+	case  4: suffix1 = "lt.b"; break;
+	case  3: suffix1 = "le.b"; break;
+	case  2: suffix1 = "gt.b"; break;
+	case  1: suffix1 = "ne.b"; break;
+	case  0: suffix1 = "eq.b"; break;
+	}
+    }
+
+  if (jump_p)
+    sprintf (tic80_trace_buffer,
+	     "%-*s 0x%.*lx %*s 0x%.*lx/%*ld => 0x%.*lx %s%s",
+	     tic80_size_name, itable[indx].name,
+	     SIZE_HEX, target, SIZE_DECIMAL, "",
+	     SIZE_HEX, cond, SIZE_DECIMAL, (long)(signed32)cond,
+	     SIZE_HEX, target,
+	     suffix1, suffix2);
+  else
+    sprintf (tic80_trace_buffer,
+	     "%-*s 0x%.*lx %*s 0x%.*lx/%*ld => %-*s %s%s",
+	     tic80_size_name, itable[indx].name,
+	     SIZE_HEX, target, SIZE_DECIMAL, "",
+	     SIZE_HEX, cond, SIZE_DECIMAL, (long)(signed32)cond,
+	     SIZE_HEX + 2, "[no jump]",
+	     suffix1, suffix2);
+
+  return tic80_trace_buffer;
+}
+
+/* Trace the result of a unconditional branch operation */
+char *
+tic80_trace_ucond_br (int indx,
+		      unsigned32 target)
+{
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  sprintf (tic80_trace_buffer,
+	     "%-*s 0x%.*lx %*s => 0x%.*lx",
+	     tic80_size_name, itable[indx].name,
+	     SIZE_HEX, target, (SIZE_DECIMAL*2) + SIZE_HEX + 4, "",
+	     SIZE_HEX, target);
+
+  return tic80_trace_buffer;
+}
+
+/* Trace the result of a load or store operation with 2 integer addresses
+   and an integer output or input */
+void
+tic80_trace_ldst (SIM_DESC sd,
+		  sim_cpu *cpu,
+		  sim_cia cia,
+		  int indx,
+		  int st_p,
+		  int m_p,
+		  int s_p,
+		  unsigned32 value,
+		  unsigned32 input1,
+		  unsigned32 input2)
+{
+  char name[40];
+
+  if (!tic80_size_name)
+    tic80_init_trace ();
+
+  strcpy (name, itable[indx].name);
+  if (m_p)
+    strcat (name, ":m");
+
+  if (s_p)
+    strcat (name, ":s");
+
+  trace_one_insn (sd, cpu, cia.ip, 1,
+		  itable[indx].file, itable[indx].line_nr, "memory",
+		  "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld %s 0x%.*lx/%*ld",
+		  tic80_size_name, name,
+		  SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1,
+		  SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2,
+		  (!st_p) ? "=>" : "<=",
+		  SIZE_HEX, value, SIZE_DECIMAL, (long)(signed32)value);
+}
+
+#endif /* WITH_TRACE */
diff --git a/sim/tic80/sim-calls.c b/sim/tic80/sim-calls.c
new file mode 100644
index 0000000..c60bd9b
--- /dev/null
+++ b/sim/tic80/sim-calls.c
@@ -0,0 +1,203 @@
+/*  This file is part of the program psim.
+
+    Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>
+    Copyright (C) 1997, Free Software Foundation
+
+    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 <stdarg.h>
+#include <ctype.h>
+
+#include "bfd.h"
+#include "sim-main.h"
+#include "sim-utils.h"
+#include "sim-options.h"
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+
+
+#define SIM_ADDR unsigned
+
+SIM_DESC
+sim_open (SIM_OPEN_KIND kind,
+	  host_callback *callback,
+	  struct _bfd *abfd,
+	  char **argv)
+{
+  char *buf;
+  SIM_DESC sd = sim_state_alloc (kind, callback);
+
+  if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK)
+    return 0;
+
+#define TIC80_MEM_START 0x2000000
+#define TIC80_MEM_SIZE 0x100000
+
+  /* main memory */
+  asprintf (&buf, "memory region 0x%lx,0x%lx",
+	    TIC80_MEM_START, TIC80_MEM_SIZE);
+  sim_do_command (sd, buf);
+  free (buf);
+  /* interrupt memory */
+  sim_do_command (sd, "memory region 0x1010000,0x1000");
+  /* some memory at zero */
+  sim_do_command (sd, "memory region 0,0x100000");
+  
+  /* getopt will print the error message so we just have to exit if this fails.
+     FIXME: Hmmm...  in the case of gdb we need getopt to call
+     print_filtered.  */
+  if (sim_parse_args (sd, argv) != SIM_RC_OK)
+    {
+      /* Uninstall the modules to avoid memory leaks,
+	 file descriptor leaks, etc.  */
+      sim_module_uninstall (sd);
+      return 0;
+    }
+
+  /* check for/establish the a reference program image */
+  if (sim_analyze_program (sd,
+			   (STATE_PROG_ARGV (sd) != NULL
+			    ? *STATE_PROG_ARGV (sd)
+			    : NULL),
+			   abfd) != SIM_RC_OK)
+    {
+      sim_module_uninstall (sd);
+      return 0;
+    }
+
+  /* establish any remaining configuration options */
+  if (sim_config (sd) != SIM_RC_OK)
+    {
+      sim_module_uninstall (sd);
+      return 0;
+    }
+
+  if (sim_post_argv_init (sd) != SIM_RC_OK)
+    {
+      /* Uninstall the modules to avoid memory leaks,
+	 file descriptor leaks, etc.  */
+      sim_module_uninstall (sd);
+      return 0;
+    }
+
+ /* FIXME: for now */
+  return sd;
+}
+
+
+void
+sim_close (SIM_DESC sd, int quitting)
+{
+  /* Uninstall the modules to avoid memory leaks,
+     file descriptor leaks, etc.  */
+  sim_module_uninstall (sd);
+}
+
+
+/* FIXME - these magic numbers need to be moved elsewhere */
+
+#define SP_REGNUM 1		/* Contains address of top of stack */
+#define FP_REGNUM 31		/* Contains address of executing stack frame */
+#define PC_REGNUM 32		/* Contains program counter (FIXME?) */
+#define NPC_REGNUM 33		/* Contains the next program counter (FIXME?) */
+#define A0_REGNUM 34		/* Accumulator register 0 */
+#define A3_REGNUM 37		/* Accumulator register 1 */
+
+#define R0_REGNUM 0             /* General Purpose Register 0 - for sim */
+#define Rn_REGNUM 31            /* Last General Purpose Register - for sim */
+#define An_REGNUM A3_REGNUM     /* Last Accumulator register - for sim */
+
+int
+sim_fetch_register (SIM_DESC sd, int regnr, unsigned char *buf, int length)
+{
+  if (regnr == R0_REGNUM)
+    memset (buf, 0, sizeof (unsigned32));
+  else if (regnr > R0_REGNUM && regnr <= Rn_REGNUM)
+    *(unsigned32*)buf = H2T_4 (STATE_CPU (sd, 0)->reg[regnr - R0_REGNUM]);
+  else if (regnr == PC_REGNUM)
+    *(unsigned32*)buf = H2T_4 (STATE_CPU (sd, 0)->cia.ip);
+  else if (regnr == NPC_REGNUM)
+    *(unsigned32*)buf = H2T_4 (STATE_CPU (sd, 0)->cia.dp);
+  else if (regnr >= A0_REGNUM && regnr <= An_REGNUM)
+    *(unsigned64*)buf = H2T_8 (STATE_CPU (sd, 0)->acc[regnr - A0_REGNUM]);
+  else
+    sim_io_error (sd, "sim_fetch_register - unknown register nr %d", regnr);
+  return -1;
+}
+
+
+int
+sim_store_register (SIM_DESC sd, int regnr, unsigned char *buf, int length)
+{
+  if (regnr >= R0_REGNUM && regnr <= Rn_REGNUM)
+    STATE_CPU (sd, 0)->reg[regnr - R0_REGNUM] = T2H_4 (*(unsigned32*)buf);
+  else if (regnr == PC_REGNUM)
+    STATE_CPU (sd, 0)->cia.ip = T2H_4 (*(unsigned32*)buf);
+  else if (regnr == NPC_REGNUM)
+    STATE_CPU (sd, 0)->cia.dp = T2H_4 (*(unsigned32*)buf);
+  else if (regnr >= A0_REGNUM && regnr <= An_REGNUM)
+    STATE_CPU (sd, 0)->acc[regnr - A0_REGNUM] = T2H_8 (*(unsigned64*)buf);
+  else
+    sim_io_error (sd, "sim_store_register - unknown register nr %d", regnr);
+  return -1;
+}
+
+
+SIM_RC
+sim_create_inferior (SIM_DESC sd,
+		     struct _bfd *abfd,
+		     char **argv,
+		     char **envp)
+{
+  /* clear all registers */
+  memset (&STATE_CPU (sd, 0)->reg, 0, sizeof (STATE_CPU (sd, 0)->reg));
+  memset (&STATE_CPU (sd, 0)->acc, 0, sizeof (STATE_CPU (sd, 0)->acc));
+  memset (&STATE_CPU (sd, 0)->cr, 0, sizeof (STATE_CPU (sd, 0)->cr));
+  STATE_CPU (sd, 0)->is_user_mode = 0;
+  memset (&STATE_CPU (sd, 0)->cia, 0, sizeof (STATE_CPU (sd, 0)->cia));
+  /* initialize any modules */
+  sim_module_init (sd);
+  /* set the stack-pointer/program counter */
+  if (abfd != NULL)
+    STATE_CPU (sd, 0)->cia.ip = bfd_get_start_address (abfd);
+  else
+    STATE_CPU (sd, 0)->cia.ip = 0;
+  STATE_CPU (sd, 0)->cia.dp = (STATE_CPU (sd, 0)->cia.ip
+			       + sizeof (instruction_word));
+  STATE_CPU (sd, 0)->cr[IE_CR] |= IE_CR_IE;
+  STATE_CPU (sd, 0)->reg[1] = TIC80_MEM_START + TIC80_MEM_SIZE - 16;
+  return SIM_RC_OK;
+}
+
+
+void
+sim_do_command (SIM_DESC sd, char *cmd)
+{
+  if (sim_args_command (sd, cmd) != SIM_RC_OK)
+    sim_io_eprintf (sd, "Unknown command `%s'\n", cmd);
+}
diff --git a/sim/tic80/sim-main.h b/sim/tic80/sim-main.h
new file mode 100644
index 0000000..67db353
--- /dev/null
+++ b/sim/tic80/sim-main.h
@@ -0,0 +1,81 @@
+/*  This file is part of the program psim.
+
+    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+    Copyright (C) 1997, Free Software Foundation
+
+    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 _SIM_MAIN_H_
+#define _SIM_MAIN_H_
+
+
+#include "sim-basics.h"
+#include "sim-signal.h"
+
+#include <signal.h> /* For kill() in insns:do_trap */
+
+#include <errno.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+/* These are generated files.  */
+#include "itable.h"
+#include "idecode.h"
+#include "idecode.h"
+
+typedef instruction_address sim_cia;
+static const sim_cia null_cia = {0}; /* Dummy */
+#define NULL_CIA null_cia
+/* FIXME: Perhaps igen should generate access macros for
+   `instruction_address' that we could use.  */
+#define CIA_ADDR(cia) ((cia).ip)
+
+#define WITH_WATCHPOINTS 1
+
+#include "sim-base.h"
+
+#include "alu.h"
+#include "cpu.h"
+
+
+struct sim_state {
+
+  /* the processors proper */
+  sim_cpu cpu;
+#define STATE_CPU(sd, n) (&(sd)->cpu)
+
+  /* The base class.  */
+  sim_state_base base;
+
+};
+
+/* (re) initialize the simulator */
+
+extern void engine_init
+(SIM_DESC sd);
+
+
+#ifndef HAVE_GETPID
+#define getpid() 42
+#endif
+
+#ifndef HAVE_KILL
+#define kill(sig, pid) (errno = EINVAL, -1)
+#endif
+#endif
diff --git a/sim/tic80/tic80.dc b/sim/tic80/tic80.dc
new file mode 100644
index 0000000..4199826
--- /dev/null
+++ b/sim/tic80/tic80.dc
@@ -0,0 +1,6 @@
+# most instructions
+switch: 21: 12: 21: 12
+switch: 11:  7:  6: 12
+#switch: 21: 13: 21: 13
+#switch: 12:  7:  6: 13
+switch: 27: 27: 27: 27
diff --git a/sim/tic80/tic80.ic b/sim/tic80/tic80.ic
new file mode 100644
index 0000000..de81d14
--- /dev/null
+++ b/sim/tic80/tic80.ic
@@ -0,0 +1,52 @@
+cache:Dest:Dest:
+cache:Dest:rDest:signed_word *:(&(CPU)->reg[Dest])
+#
+cache:Source1:Source1:
+cache:Source1:vSource1:signed_word:(GPR (Source1) + 0)
+#cache:Source1:vSource1:signed_word:(Source1 == 0 ? 0 : (CPU)->reg[Source1])
+#
+cache:Source2:Source2:
+cache:Source2:vSource2:signed_word:(GPR (Source2) + 0)
+#cache:Source2:vSource2:signed_word:(Source2 == 0 ? 0 : (CPU)->reg[Source2])
+#
+cache:Source:Source:
+cache:Source:vSource:signed_word:(GPR (Source) + 0)
+#cache:Source:vSource:signed_word:(Source == 0 ? 0 : (CPU)->reg[Source])
+#
+cache:IndOff:IndOff:
+cache:IndOff:rIndOff:signed_word:(GPR (IndOff) + 0)
+#cache:IndOff:rIndOff:signed_word:(IndOff == 0 ? 0 : (CPU)->reg[IndOff])
+#
+cache:Base:Base:
+cache:Base:vBase:signed_word:(GPR (Base) + 0)
+cache:Base:rBase:signed_word*:(&GPR (Base))
+#cache:Base:vBase:signed_word:(Base == 0 ? 0 : (CPU)->reg[Base])
+#
+cache:Link:Link:
+cache:Link:rLink:signed_word*:(&(CPU)->reg[Link])
+#
+# Trap Number
+cache:UTN:UTN:
+cache:INDTR:INDTR:
+cache:INDTR:UTN:unsigned_word:(INDTR == 0 ? 0 : (CPU)->reg[INDTR])
+#
+cache:A:A:
+#
+cache:SignedImmediate:SignedImmediate:
+cache:SignedImmediate:vSource1:signed_word:SEXT (SignedImmediate, 14)
+#
+cache:UnsignedImmediate:UnsignedImmediate:
+cache:UnsignedImmediate:vSource1:signed_word:UnsignedImmediate
+#
+cache:BITNUM:BITNUM:
+cache:Code:Code:
+cache:BITNUM:bitnum:int:(~BITNUM) & 0x1f
+
+#
+cache:SignedOffset:SignedOffset:
+cache:SignedOffset:vSignedOffset:signed_word:SEXT (SignedOffset, 14)
+#
+cache:UCRN:UCRN:
+cache:INDCR:INDCR:
+cache:INDCR:UCRN:unsigned32:(GPR (INDCR) + 0)
+#cache:INDCR:UCRN:unsigned32:(INDCR == 0 ? 0 : (CPU)->reg[INDCR])
diff --git a/sim/tic80/tic80.igen b/sim/tic80/tic80.igen
new file mode 100644
index 0000000..1595693f
--- /dev/null
+++ b/sim/tic80/tic80.igen
@@ -0,0 +1,1615 @@
+// Texas Instruments TMS320C80 (MVP) Simulator.
+
+
+// The following is called when ever an illegal instruction is encountered.
+:internal::::illegal:
+{
+  sim_io_eprintf (SD, "0x%lx: illegal instruction\n", (unsigned long) cia.ip);
+  sim_engine_halt (SD, CPU, NULL, cia, sim_signalled, SIM_SIGILL);
+}
+
+// The following is called when ever an FP op is attempted with FPU disabled.
+:internal::::fp_unavailable:
+{
+  sim_io_eprintf (SD, "0x%lx: floating-point unavailable\n", (unsigned long) cia.ip);
+  sim_engine_halt (SD, CPU, NULL, cia, sim_signalled, SIM_SIGFPE);
+}
+
+// Handle a branch instruction
+:function:::instruction_address:do_branch:int annul, address_word target, int rLink_p, unsigned32 *rLink
+{
+  instruction_address nia;
+  if (annul)
+    {
+      if (rLink_p)
+        *rLink = cia.dp;
+      nia.ip = target;
+      nia.dp = target + 4;
+    }
+  else
+    {
+      if (rLink_p)
+        *rLink = cia.dp + sizeof (instruction_word);
+      nia.ip = cia.dp;
+      nia.dp = target;
+    }
+  return nia;
+}
+
+// Signed Integer Add - add source1, source2, dest
+:function:::void:do_add:unsigned32 *rDest, signed32 source1, signed32 source2
+{
+  unsigned32 result;
+  ALU_BEGIN (source1);
+  ALU_ADD (source2);
+  ALU_END (result);
+  *rDest = result;
+  TRACE_ALU3 (MY_INDEX, result, source1, source2);
+  /* FIXME - a signed add may cause an exception */
+}
+31.Dest,26.Source2,21.0b101100,15.0,14.SignedImmediate::::add i
+"add <SignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_add (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b11101100,13.0,12.0,11./,4.Source1::::add r
+"add r<Source1>, r<Source2>, r<Dest>"
+{
+  do_add (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b11101100,13.0,12.1,11./+LongSignedImmediate::::add l
+"add 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_add (_SD, rDest, LongSignedImmediate, vSource2);
+}
+
+
+// Unsigned Integer Add - addu source1, source2, dest
+:function:::void:do_addu:unsigned32 *rDest, unsigned32 source1, unsigned32 source2
+{
+  unsigned32 result = source1 + source2;
+  TRACE_ALU3 (MY_INDEX, result, source1, source2);
+  *rDest = result;
+}
+
+31.Dest,26.Source2,21.0b101100,15.1,14.SignedImmediate::::addu i
+"addu <SignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_addu (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b11101100,13.1,12.0,11./,4.Source1::::addu r
+"addu r<Source1>, r<Source2>, r<Dest>"
+{
+  do_addu (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b11101100,13.1,12.1,11./+LongSignedImmediate::::addu l
+"addu 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_addu (_SD, rDest, LongSignedImmediate, vSource2);
+}
+
+
+:function:::void:do_and:signed32 *rDest, signed32 source1, signed32 source2
+{
+  unsigned32 result = source1 & source2;
+  TRACE_ALU3 (MY_INDEX, result, source1, source2);
+  *rDest = result;
+}
+
+
+// and, and.tt
+31.Dest,26.Source2,21.0b0010001,14.UnsignedImmediate::::and.tt i
+"and.tt <UnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_and (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b110010001,12.0,11./,4.Source1::::and.tt r
+"and.tt r<Source1>, r<Source2>, r<Dest>"
+{
+  do_and (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b110010001,12.1,11./+LongSignedImmediate::::and.tt l
+"and.tt 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_and (_SD, rDest, LongSignedImmediate, vSource2);
+
+}
+
+// and.ff
+31.Dest,26.Source2,21.0b0011000,14.UnsignedImmediate::::and.ff i
+"and.ff <UnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_and (_SD, rDest, ~vSource1, ~vSource2);
+}
+31.Dest,26.Source2,21.0b110011000,12.0,11./,4.Source1::::and.ff r
+"and.ff r<Source1>, r<Source2>, r<Dest>"
+{
+  do_and (_SD, rDest, ~vSource1, ~vSource2);
+}
+31.Dest,26.Source2,21.0b110011000,12.1,11./+LongSignedImmediate::::and.ff l
+"and.ff 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_and (_SD, rDest, ~LongSignedImmediate, ~vSource2);
+}
+
+// and.ft
+31.Dest,26.Source2,21.0b0010100,14.UnsignedImmediate::::and.ft i
+"and.ft <UnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_and (_SD, rDest, ~vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b110010100,12.0,11./,4.Source1::::and.ft r
+"and.ft r<Source1>, r<Source2>, r<Dest>"
+{
+  do_and (_SD, rDest, ~vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b110010100,12.1,11./+LongSignedImmediate::::and.ft l
+"and.ft 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_and (_SD, rDest, ~LongSignedImmediate, vSource2);
+}
+
+// and.tf
+31.Dest,26.Source2,21.0b0010010,14.UnsignedImmediate::::and.tf i
+"and.tf <UnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_and (_SD, rDest, vSource1, ~vSource2);
+}
+31.Dest,26.Source2,21.0b110010010,12.0,11./,4.Source1::::and.tf r
+"and.tf r<Source1>, r<Source2>, r<Dest>"
+{
+  do_and (_SD, rDest, vSource1, ~vSource2);
+}
+31.Dest,26.Source2,21.0b110010010,12.1,11./+LongSignedImmediate::::and.tf l
+"and.tf 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_and (_SD, rDest, LongSignedImmediate, ~vSource2);
+}
+
+// bbo[.a]
+:function:::instruction_address:do_bbo:instruction_address nia, int bitnum, unsigned32 source, int annul, unsigned32 offset
+{
+  int jump_p;
+  address_word target = cia.ip + 4 * offset;
+  if (MASKED32 (source, bitnum, bitnum))
+    {
+      nia = do_branch (_SD, annul, target, 0, NULL);
+      jump_p = 1;
+    }
+  else
+    jump_p = 0;
+  TRACE_COND_BR(MY_INDEX, jump_p, bitnum, target, -1, -1);
+  return nia;
+}
+:%s::::A:int A
+{
+  if (A)
+    return ".a";
+  else
+    return "";
+}
+31.BITNUM,26.Source,21.0b100101,15.A,14.SignedOffset::::bbo i
+"bbo%s<A> <SignedOffset>, r<Source>, <bitnum>"
+{
+  nia = do_bbo (_SD, nia, bitnum, vSource, A, vSignedOffset);
+}
+31.BITNUM,26.Source,21.0b11100101,13.A,12.0,11./,4.IndOff::::bbo r
+"bbo%s<A> r<IndOff>, r<Source>, <bitnum>"
+{
+  nia = do_bbo (_SD, nia, bitnum, vSource, A, rIndOff);
+}
+31.BITNUM,26.Source,21.0b11100101,13.A,12.1,11./+LongSignedImmediate::::bbo l
+"bbo%s<A> <LongSignedImmediate>, r<Source>, <bitnum>"
+{
+  nia = do_bbo (_SD, nia, bitnum, vSource, A, LongSignedImmediate);
+}
+
+// bbz[.a]
+:function:::instruction_address:do_bbz:instruction_address nia, int bitnum, unsigned32 source, int annul, unsigned32 offset
+{
+  int jump_p;
+  address_word target = cia.ip + 4 * offset;
+  if (!MASKED32 (source, bitnum, bitnum))
+    {
+      nia = do_branch (_SD, annul, target, 0, NULL);
+      jump_p = 1;
+    }
+  else
+    jump_p = 0;
+  TRACE_COND_BR(MY_INDEX, jump_p, bitnum, target, -1, -1);
+  return nia;
+}
+31.BITNUM,26.Source,21.0b100100,15.A,14.SignedOffset::::bbz i
+"bbz%s<A> <SignedOffset>, r<Source>, <bitnum>"
+{
+  nia = do_bbz (_SD, nia, bitnum, vSource, A, vSignedOffset);
+}
+31.BITNUM,26.Source,21.0b11100100,13.A,12.0,11./,4.IndOff::::bbz r
+"bbz%s<A> r<IndOff>, r<Source>, <bitnum>"
+{
+  nia = do_bbz (_SD, nia, bitnum, vSource, A, rIndOff);
+}
+31.BITNUM,26.Source,21.0b11100100,13.A,12.1,11./+LongSignedImmediate::::bbz l
+"bbz%s<A> <LongSignedImmediate>, r<Source>, <bitnum>"
+{
+  nia = do_bbz (_SD, nia, bitnum, vSource, A, LongSignedImmediate);
+}
+
+// bcnd[.a]
+:function:::instruction_address:do_bcnd:instruction_address nia, int Cond, unsigned32 source, int annul, unsigned32 offset
+{
+  int condition;
+  int size = EXTRACTED32 (Cond, 31 - 27, 30 - 27);
+  int code = EXTRACTED32 (Cond, 29 - 27, 27 - 27);
+  signed32 val = 0;
+  address_word target = cia.ip + 4 * offset;
+  switch (size)
+    {
+    case 0: val = SEXT32 (source, 7); break;
+    case 1: val = SEXT32 (source, 15); break;
+    case 2: val = source; break;
+    default: sim_engine_abort (SD, CPU, cia, "bcnd - reserved size");
+    }
+  switch (code)
+    {
+    case 0: condition = 0; break;
+    case 1: condition = val > 0; break;
+    case 2: condition = val == 0; break;
+    case 3: condition = val >= 0; break;
+    case 4: condition = val < 0; break;
+    case 5: condition = val != 0; break;
+    case 6: condition = val <= 0; break;
+    default: condition = 1; break;
+    }
+  if (condition)
+    {
+      nia = do_branch (_SD, annul, target, 0, NULL);
+    }
+  TRACE_COND_BR(MY_INDEX, condition, val, target, size, code);
+  return nia;
+}
+31.Code,26.Source,21.0b100110,15.A,14.SignedOffset::::bcnd i
+"bcnd%s<A> <SignedOffset>, r<Source>, <Code>"
+{
+  nia = do_bcnd (_SD, nia, Code, vSource, A, vSignedOffset);
+}
+31.Code,26.Source,21.0b11100110,13.A,12.0,11./,4.IndOff::::bcnd r
+"bcnd%s<A> r<IndOff>, r<Source>, <Code>"
+{
+  nia = do_bcnd (_SD, nia, Code, vSource, A, rIndOff);
+}
+31.Code,26.Source,21.0b11100110,13.A,12.1,11./+LongSignedImmediate::::bcnd l
+"bcnd%s<A> <LongSignedImmediate>, r<Source>, <Code>"
+{
+  nia = do_bcnd (_SD, nia, Code, vSource, A, LongSignedImmediate);
+}
+
+// br[.a] - see bbz[.a]
+
+
+// brcr
+:function:::sim_cia:do_brcr:instruction_address nia, int cr
+{
+  if (cr >= 0x4000 || !(CPU)->is_user_mode)
+    {
+      unsigned32 control = CR (cr);
+      unsigned32 ie = control & 0x00000001;
+      unsigned32 pc = control & 0xfffffffc;
+      unsigned32 is_user_mode = control & 0x00000002;
+      (CPU)->is_user_mode = is_user_mode;
+      nia.dp = pc;
+      if (ie)
+        (CPU)->cr[IE_CR] |= IE_CR_IE;
+      else
+        (CPU)->cr[IE_CR] &= ~IE_CR_IE;
+    }
+  TRACE_UCOND_BR (MY_INDEX, nia.dp);
+  return nia;
+}
+31.//,27.0,26.//,21.0b0000110,14.UCRN::::brcr i
+"brcr CR[<UCRN>]"
+{
+  nia = do_brcr (_SD, nia, UCRN);
+}
+31.//,27.0,26.//,21.0b110000110,12.0,11./,4.INDCR::::brcr r
+"brcr CR[r<INDCR>]"
+{
+  nia = do_brcr (_SD, nia, UCRN);
+}
+31.//,27.0,26.//,21.0b110000110,12.1,11./+UnsignedControlRegisterNumber::::brcr l
+"brcr CR[<UnsignedControlRegisterNumber>]"
+{
+  nia = do_brcr (_SD, nia, UnsignedControlRegisterNumber);
+}
+
+// bsr[.a]
+:function:::instruction_address:do_bsr:instruction_address nia, signed32 *rLink, int annul, unsigned32 offset
+{
+  address_word target = cia.ip + 4 * offset;
+  nia = do_branch (_SD, annul, target, 1, rLink);
+  TRACE_UCOND_BR (MY_INDEX, target);
+  return nia;
+}
+31.Link,26./,21.0b100000,15.A,14.SignedOffset::::bsr i
+"bsr%s<A> <SignedOffset>, r<Link>"
+{
+  nia = do_bsr (_SD, nia, rLink, A, vSignedOffset);
+}
+31.Link,26./,21.0b11100000,13.A,12.0,11./,4.IndOff::::bsr r
+"bsr%s<A> r<IndOff>, r<Link>"
+{
+  nia = do_bsr (_SD, nia, rLink, A, rIndOff);
+}
+31.Link,26./,21.0b11100000,13.A,12.1,11./+LongSignedImmediate::::bsr l
+"bsr%s<A> <LongSignedImmediate>, r<Link>"
+{
+  nia = do_bsr (_SD, nia, rLink, A, LongSignedImmediate);
+}
+
+// cmnd
+:function:::void:do_cmnd:signed32 source
+{
+  int Reset = EXTRACTED32 (source, 31, 31);
+  int Halt = EXTRACTED32 (source, 30, 30);
+  int Unhalt = EXTRACTED32 (source, 29, 29);
+  /* int ICR = EXTRACTED32 (source, 28, 28); */
+  /* int DCR = EXTRACTED32 (source, 27, 27); */
+  int Task = EXTRACTED32 (source, 14, 14);
+  int Msg = EXTRACTED32 (source, 13, 13);
+  int VC = EXTRACTED32 (source, 10, 10);
+  int TC = EXTRACTED32 (source, 9, 9);
+  int MP = EXTRACTED32 (source, 8, 8);
+  int PP = EXTRACTED32 (source, 3, 0);
+  /* what is implemented? */
+  if (PP != 0)
+    sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - PPs not supported",
+                      (unsigned long) cia.ip);
+  if (VC != 0)
+    sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - VC not supported",
+                      (unsigned long) cia.ip);
+  if (TC != 0)
+    sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - TC not supported",
+                      (unsigned long) cia.ip);
+  if (MP)
+    {
+      if (Reset || Halt)
+        sim_engine_halt (SD, CPU, NULL, cia, sim_exited, 0);
+      if (Unhalt)
+        sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - Can not unhalt the MP",
+                          (unsigned long) cia.ip);
+      /* if (ICR || DCR); */
+      if (Task)
+        sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - Can not Task the MP",
+                          (unsigned long) cia.ip);
+      if (Msg)
+        sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - Msg to MP not suported",
+                          (unsigned long) cia.ip);
+    }
+  TRACE_SINK1 (MY_INDEX, source);
+}
+31./,21.0b0000010,14.UI::::cmnd i
+"cmnd <UI>"
+{
+  do_cmnd (_SD, UI);
+}
+31./,21.0b110000010,12.0,11./,4.Source::::cmnd r
+"cmnd r<Source>"
+{
+  do_cmnd (_SD, vSource);
+}
+31./,21.0b110000010,12.1,11./+LongUnsignedImmediate::::cmnd l
+"cmnd <LongUnsignedImmediate>"
+{
+  do_cmnd (_SD, LongUnsignedImmediate);
+}
+
+// cmp
+:function:::unsigned32:cmp_vals:signed32 s1, unsigned32 u1, signed32 s2, unsigned32 u2
+{
+  unsigned32 field = 0;
+  if (s1 == s2) field |= 0x001;
+  if (s1 != s2) field |= 0x002;
+  if (s1 >  s2) field |= 0x004;
+  if (s1 <= s2) field |= 0x008;
+  if (s1 <  s2) field |= 0x010;
+  if (s1 >= s2) field |= 0x020;
+  if (u1 >  u2) field |= 0x040;
+  if (u1 <= u2) field |= 0x080;
+  if (u1 <  u2) field |= 0x100;
+  if (u1 >= u2) field |= 0x200;
+  return field;
+}
+:function:::void:do_cmp:unsigned32 *rDest, unsigned32 source1, unsigned32 source2
+{
+  unsigned32 field = 0;
+  field |= cmp_vals (_SD, source1, source1, source2, source2) << 20;
+  field |= cmp_vals (_SD, (signed16)source1, (unsigned16)source1,
+         (signed16)source2, (unsigned16)source2) << 10;
+  field |= cmp_vals (_SD, (signed8)source1, (unsigned8)source1,
+          (signed8)source2, (unsigned8)source2);
+  TRACE_CMP (MY_INDEX, field, source1, source2);
+  *rDest = field;
+}
+31.Dest,26.Source2,21.0b1010000,14.SignedImmediate::::cmp i
+"cmp <SignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_cmp (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b111010000,12.0,11./,4.Source1::::cmp r
+"cmp r<Source1>, r<Source2>, r<Dest>"
+{
+  do_cmp (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b111010000,12.1,11./+LongSignedImmediate::::cmp l
+"cmp 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_cmp (_SD, rDest, LongSignedImmediate, vSource2);
+}
+
+// dcache
+:%s::::F:int F
+{
+  if (F)
+    return "f";
+  else
+    return "c";
+}
+31./,27.F,26.Source2,21.0b0111,17.m,16.0b00,14.SignedOffset::::dcache i
+"dcache%s<F> <SignedOffset> (r<Source2>%s<m>)"
+{
+  TRACE_NOP (MY_INDEX);
+  /* NOP */
+}
+31./,27.F,26.Source2,21.0b110111,15.m,14.0b00,12.0,11./,4.Source1::::dcache r
+"dcache%s<F> r<Source1> (r<Source2>%s<m>)"
+{
+  TRACE_NOP (MY_INDEX);
+  /* NOP */
+}
+31./,27.F,26.Source2,21.0b110111,15.m,14.0b00,12.1,11./+LongSignedImmediate::::dcache l
+"dcache%s<F> <LongSignedImmediate> (r<Source2>%s<m>)"
+{
+  TRACE_NOP (MY_INDEX);
+  /* NOP */
+}
+
+// dld[{.b|.h|.d}]
+void::function::do_dld:int Dest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset
+{
+  do_ld (_SD, Dest, base, rBase, m, sz, S, offset);
+}
+31.Dest,26.Base,21.0b110100,15.m,14.sz,12.0,11.S,10.1,9./,4.IndOff::::dld r
+"dld%s<sz> r<IndOff>%s<S> (r<Base>%s<m>), r<Dest>"
+{
+  do_dld (_SD, Dest, vBase, rBase, m, sz, S, rIndOff);
+}
+31.Dest,26.Base,21.0b110100,15.m,14.sz,12.1,11.S,10.1,9./+LongSignedImmediateOffset::::dld l
+"dld%s<sz> 0x%08lx<LongSignedImmediateOffset>%s<S> (r<Base>%s<m>), r<Dest>"
+{
+  do_dld (_SD, Dest, vBase, rBase, m, sz, S, LongSignedImmediateOffset);
+}
+
+// dld.u[{.b|.h|.d}]
+void::function::do_dld_u:unsigned32 *rDest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset
+{
+  do_ld_u (_SD, rDest, base, rBase, m, sz, S, offset);
+}
+31.Dest,26.Base,21.0b110101,15.m,14.sz,12.0,11.S,10.1,9./,4.IndOff::::dld.u r
+"dld.u%s<sz> r<IndOff>%s<S> (r<Base>%s<m>), r<Dest>"
+{
+  do_dld_u (_SD, rDest, vBase, rBase, m, sz, S, rIndOff);
+}
+31.Dest,26.Base,21.0b110101,15.m,14.sz,12.1,11.S,10.1,9./+LongSignedImmediateOffset::::dld.u l
+"dld.u%s<sz> 0x%08lx<LongSignedImmediateOffset>%s<S> (r<Base>%s<m>), r<Dest>"
+{
+  do_dld_u (_SD, rDest, vBase, rBase, m, sz, S, LongSignedImmediateOffset);
+}
+
+// dst[{.b|.h|.d}]
+void::function::do_dst:int Source, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset
+{
+  do_st (_SD, Source, base, rBase, m, sz, S, offset);
+}
+31.Source,26.Base,21.0b110110,15.m,14.sz,12.0,11.S,10.1,9./,4.IndOff::::dst r
+"dst%s<sz> r<IndOff>%s<S> (r<Base>%s<m>), r<Source>"
+{
+  do_dst (_SD, Source, vBase, rBase, m, sz, S, rIndOff);
+}
+31.Source,26.Base,21.0b110110,15.m,14.sz,12.1,11.S,10.1,9./+LongSignedImmediateOffset::::dst l
+"dst%s<sz> 0x%08lx<LongSignedImmediateOffset>%s<S> (r<Base>%s<m>), r<Source>"
+{
+  do_dst (_SD, Source, vBase, rBase, m, sz, S, LongSignedImmediateOffset);
+}
+
+// estop
+31./,21.0b1111111,14.1,13.0,12.0,11./::::estop
+
+// etrap
+31./,27.1,26./,21.0b0000001,14.UTN::::etrap i
+31./,27.1,26./,21.0b110000001,12.0,11./,4.iUTN::::etrap r
+31./,27.1,26./,21.0b110000001,12.1,11./::::etrap l
+
+
+// exts - see shift.ds
+
+
+// extu - see shift.dz
+
+
+sim_fpu::function::get_fp_reg:int reg, unsigned32 val, int precision
+{
+  sim_fpu ans;
+  switch (precision)
+    {
+    case 0: /* single */
+      sim_fpu_32to (&ans, val);
+      break;
+    case 1: /* double */
+      if (reg < 0)
+        sim_engine_abort (SD, CPU, cia, "DP immediate invalid");
+      if (reg & 1)
+        sim_engine_abort (SD, CPU, cia, "DP FP register must be even");
+      if (reg <= 1)
+        sim_engine_abort (SD, CPU, cia, "DP FP register must be >= 2");
+      sim_fpu_232to (&ans, GPR (reg + 1), GPR (reg));
+      break;
+    case 2: /* 32 bit signed integer */
+      sim_fpu_i32to (&ans, val, 0);
+      break;
+    case 3: /* 32 bit unsigned integer */
+      sim_fpu_u32to (&ans, val, 0);
+      break;
+    default:
+      sim_engine_abort (SD, CPU, cia, "Unsupported FP precision");
+    }
+  return ans;
+}
+void::function::set_fp_reg:int Dest, sim_fpu val, int PD
+{
+  switch (PD)
+    {
+    case 0: /* single */
+      {
+        sim_fpu_to32 (&GPR (Dest), &val);
+        break;
+      }
+    case 1: /* double */
+      {
+        if (Dest & 1)
+          sim_engine_abort (SD, CPU, cia, "DP FP Dest register must be even");
+        if (Dest <= 1)
+          sim_engine_abort (SD, CPU, cia, "DP FP Dest register must be >= 2");
+        sim_fpu_to232 (&GPR (Dest + 1), &GPR (Dest + 0), &val);
+        break;
+      }
+    case 2: /* signed */
+      {
+        sim_fpu_to32i (&GPR (Dest), &val, 0);
+        break;
+      }
+    case 3: /* unsigned */
+      {
+        sim_fpu_to32u (&GPR (Dest), &val, 0);
+        break;
+      }
+    default:
+      sim_engine_abort (SD, CPU, cia, "Unsupported FP precision");
+    }
+
+}
+// fadd.{s|d}{s|d}{s|d}
+void::function::do_fadd:int Dest, int PD, sim_fpu s1, sim_fpu s2
+{
+  sim_fpu ans;
+  sim_fpu_add (&ans, &s1, &s2);
+  TRACE_FPU3 (ans, s1, s2);
+  set_fp_reg (_SD, Dest, ans, PD);
+}
+const char *::function::str_PX:int PX
+{
+  switch (PX)
+    {
+    case 0: return "s";
+    case 1: return "d";
+    case 2: return "i";
+    case 3: return "u";
+    default: return "?";
+    }
+}
+31.Dest,26.Source2,21.0b111110000,12.0,11.r,10.PD,8.P2,6.P1,4.Source1::f::fadd r
+"fadd.%s<PX#P1>%s<PX#P2>%s<PX#PD> r<Source1>, r<Source2>, r<Dest>"
+{
+  do_fadd (_SD, Dest, PD,
+           get_fp_reg (_SD, Source1, vSource1, P1),
+           get_fp_reg (_SD, Source2, vSource2, P2));
+}
+31.Dest,26.Source2,21.0b111110000,12.1,11.r,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fadd l
+"fadd.%s<PX#P1>%s<PX#P2>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Source2>, r<Dest>"
+{
+  do_fadd (_SD, Dest, PD,
+           get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1),
+           get_fp_reg (_SD, Source2, vSource2, P2));
+
+}
+
+// fcmp.{s|d}{s|d}{s|d}
+void::function::do_fcmp:unsigned32 *rDest, sim_fpu s1, sim_fpu s2
+{
+  unsigned32 result = 0;
+  if (sim_fpu_is_nan (&s1) || sim_fpu_is_nan (&s2))
+    result |= BIT32 (30);
+  else
+    {
+      result |= BIT32 (31);
+      if (sim_fpu_is_eq (&s1, &s2)) result |= BIT32(20);
+      if (sim_fpu_is_ne (&s1, &s2)) result |= BIT32(21);
+      if (sim_fpu_is_gt (&s1, &s2)) result |= BIT32(22);
+      if (sim_fpu_is_le (&s1, &s2)) result |= BIT32(23);
+      if (sim_fpu_is_lt (&s1, &s2)) result |= BIT32(24);
+      if (sim_fpu_is_ge (&s1, &s2)) result |= BIT32(25);
+      if (sim_fpu_is_lt (&s1, &sim_fpu_zero)
+          || sim_fpu_is_gt (&s1, &s2)) result |= BIT32(26);
+      if (sim_fpu_is_lt (&sim_fpu_zero, &s1)
+          && sim_fpu_is_lt (&s1, &s2)) result |= BIT32(27);
+      if (sim_fpu_is_le (&sim_fpu_zero, &s1)
+          && sim_fpu_is_le (&s1, &s2)) result |= BIT32(28);
+      if (sim_fpu_is_le (&s1, &sim_fpu_zero)
+          || sim_fpu_is_ge (&s1, &s2)) result |= BIT32(29);
+    }
+  *rDest = result;
+  TRACE_FPU2CMP (result, s1, s2);
+}
+31.Dest,26.Source2,21.0b111110101,12.0,11./,10.0,8.P2,6.P1,4.Source1::f::fcmp r
+"fcmp.%s<PX#P1>%s<PX#P2> r<Source1>, r<Source2>, r<Dest>"
+{
+  do_fcmp (_SD, rDest,
+           get_fp_reg (_SD, Source1, vSource1, P1),
+           get_fp_reg (_SD, Source2, vSource2, P2));
+}
+31.Dest,26.Source2,21.0b111110101,12.1,11./,10.0,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fcmp l
+"fcmp.%s<PX#P1>%s<PX#P2> 0x%08lx<SinglePrecisionFloatingPoint>, r<Source2>, r<Dest>"
+{
+  do_fcmp (_SD, rDest,
+           get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1),
+           get_fp_reg (_SD, Source2, vSource2, P2));
+}
+
+
+// fdiv.{s|d}{s|d}{s|d}
+void::function::do_fdiv:int Dest, int PD, sim_fpu s1, sim_fpu s2
+{
+  sim_fpu ans;
+  sim_fpu_div (&ans, &s1, &s2);
+  TRACE_FPU3 (ans, s1, s2);
+  set_fp_reg (_SD, Dest, ans, PD);
+}
+31.Dest,26.Source2,21.0b111110011,12.0,11./,10.PD,8.P2,6.P1,4.Source1::f::fdiv r
+"fdiv.%s<PX#P1>%s<PX#P2>%s<PX#PD> r<Source1>, r<Source2>, r<Dest>"
+{
+  do_fdiv (_SD, Dest, PD,
+           get_fp_reg (_SD, Source1, vSource1, P1),
+           get_fp_reg (_SD, Source2, vSource2, P2));
+}
+31.Dest,26.Source2,21.0b111110011,12.1,11./,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fdiv l
+"fdiv.%s<PX#P1>%s<PX#P2>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Source2>, r<Dest>"
+{
+  do_fdiv (_SD, Dest, PD,
+           get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1),
+           get_fp_reg (_SD, Source2, vSource2, P2));
+}
+
+// fmpy.{s|d|i|u}{s|d|i|u}{s|d|i|u}
+void::function::do_fmpy:int Dest, int PD, sim_fpu s1, sim_fpu s2
+{
+  switch (PD)
+    {
+    case 2: /* signed */
+      {
+        signed64 i1;
+        signed64 i2;
+        sim_fpu_to64i (&i1, &s1, 0);
+        sim_fpu_to64i (&i2, &s2, 0);
+        GPR (Dest) = i1 * i2;
+        TRACE_FPU2I (GPR (Dest), s1, s2);
+        break;
+      }
+    case 3: /* unsigned */
+      {
+        unsigned64 u1;
+        unsigned64 u2;
+        sim_fpu_to64u (&u1, &s1, 0);
+        sim_fpu_to64u (&u2, &s2, 0);
+        GPR (Dest) = u1 * u2;
+        TRACE_FPU2I (GPR (Dest), s1, s2);
+        break;
+      }
+    default:
+      {
+        sim_fpu ans;
+        sim_fpu_mul (&ans, &s1, &s2);
+        set_fp_reg (_SD, Dest, ans, PD);
+        TRACE_FPU3 (ans, s1, s2);
+      }
+    }
+}
+31.Dest,26.Source2,21.0b111110010,12.0,11./,10.PD,8.P2,6.P1,4.Source1::f::fmpy r
+"fmpy.%s<PX#P1>%s<PX#P2>%s<PX#PD> r<Source1>, r<Source2>, r<Dest>"
+{
+  do_fmpy (_SD, Dest, PD,
+           get_fp_reg (_SD, Source1, vSource1, P1),
+           get_fp_reg (_SD, Source2, vSource2, P2));
+}
+31.Dest,26.Source2,21.0b111110010,12.1,11./,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fmpy l
+"fmpy.%s<PX#P1>%s<PX#P2>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Source2>, r<Dest>"
+{
+  do_fmpy (_SD, Dest, PD,
+           get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1),
+           get_fp_reg (_SD, Source2, vSource2, P2));
+}
+
+// frndm.{s|d|i|u}{s|d|i|u}
+void::function::do_frnd:int Dest, int PD, sim_fpu s1
+{
+  set_fp_reg (_SD, Dest, s1, PD);
+  TRACE_FPU1 (s1);
+}
+31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b11,6.P1,4.Source::f::frndm r
+"frndm.%s<PX#P1>%s<PX#PD> r<Source>, r<Dest>"
+{
+  do_frnd (_SD, Dest, PD,
+           get_fp_reg (_SD, Source, vSource, P1));
+}
+31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b11,6.P1,4./+SinglePrecisionFloatingPoint::f::frndm l
+"frndm.%s<PX#P1>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Dest>"
+{
+  do_frnd (_SD, Dest, PD,
+           get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1));
+}
+
+// frndn.{s|d|i|u}{s|d|i|u}
+31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b00,6.P1,4.Source::f::frndn r
+"frndn.%s<PX#P1>%s<PX#PD> r<Source>, r<Dest>"
+{
+  do_frnd (_SD, Dest, PD,
+           get_fp_reg (_SD, Source, vSource, P1));
+}
+31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b00,6.P1,4./+SinglePrecisionFloatingPoint::f::frndn l
+"frndn.%s<PX#P1>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Dest>"
+{
+  do_frnd (_SD, Dest, PD,
+           get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1));
+}
+
+// frndp.{s|d|i|u}{s|d|i|u}
+31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b10,6.P1,4.Source::f::frndp r
+"frndp.%s<PX#P1>%s<PX#PD> r<Source>, r<Dest>"
+{
+  do_frnd (_SD, Dest, PD,
+           get_fp_reg (_SD, Source, vSource, P1));
+}
+31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b10,6.P1,4./+SinglePrecisionFloatingPoint::f::frndp l
+"frndp.%s<PX#P1>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Dest>"
+{
+  do_frnd (_SD, Dest, PD,
+           get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1));
+}
+
+// frndz.{s|d|i|u}{s|d|i|u}
+31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b01,6.P1,4.Source::f::frndz r
+"frndz.%s<PX#P1>%s<PX#PD> r<Source>, r<Dest>"
+{
+  do_frnd (_SD, Dest, PD,
+           get_fp_reg (_SD, Source, vSource, P1));
+}
+31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b01,6.P1,4./+SinglePrecisionFloatingPoint::f::frndz l
+"frndz.%s<PX#P1>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Dest>"
+{
+  do_frnd (_SD, Dest, PD,
+           get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1));
+}
+
+// fsqrt.{s|d}{s|d}{s|d}
+#void::function::do_fsqrt:unsigned32 *rDest, unsigned32 Source, unsigned32 Source2
+#  sim_io_error ("fsqrt");
+31.Dest,26./,21.0b111110111,12.0,11./,10.PD,8.//,6.P1,4.Source::f::fsqrt r
+"fsqrt.%s<PX#P1>%s<PX#PD> r<Source>, r<Dest>"
+#  do_fsqrt (_SD, rDest, vSource);
+31.Dest,26./,21.0b111110111,12.1,11./,10.PD,8.//,6.P1,4./+SinglePrecisionFloatingPoint::f::fsqrt l
+"fsqrt.%s<PX#P1>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Dest>"
+#  do_fsqrt (_SD, rDest, SinglePrecisionFloatingPoint);
+
+
+// fsub.{s|d}{s|d}{s|d}
+void::function::do_fsub:int Dest, int PD, sim_fpu s1, sim_fpu s2
+{
+  sim_fpu ans;
+  sim_fpu_sub (&ans, &s1, &s2);
+  TRACE_FPU3 (ans, s1, s2);
+  set_fp_reg (_SD, Dest, ans, PD);
+}
+31.Dest,26.Source2,21.0b111110001,12.0,11.r,10.PD,8.P2,6.P1,4.Source1::f::fsub r
+"fsub.%s<PX#P1>%s<PX#P2>%s<PX#PD> r<Source1>, r<Source2>, r<Dest>"
+{
+  do_fsub (_SD, Dest, PD,
+           get_fp_reg (_SD, Source1, vSource1, P1),
+           get_fp_reg (_SD, Source2, vSource2, P2));
+}
+31.Dest,26.Source2,21.0b111110001,12.1,11.r,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fsub l
+"fsub.%s<PX#P1>%s<PX#P2>%s<PX#PD> 0x%08lx<SinglePrecisionFloatingPoint>, r<Source2>, r<Dest>"
+{
+  do_fsub (_SD, Dest, PD,
+           get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1),
+           get_fp_reg (_SD, Source2, vSource2, P2));
+}
+
+// illop
+31./,21.0b0000000,14./::::illop
+"illop"
+31./,21.0b111111111,12./::::illop l
+"illop"
+
+
+// ins - see sl.im
+
+
+// jsr[.a]
+instruction_address::function::do_jsr:instruction_address nia, signed32 *rLink, int annul, unsigned32 offset, unsigned32 base
+{
+  address_word target = offset + base;
+  TRACE_UCOND_BR (MY_INDEX, target);
+  nia = do_branch (_SD, annul, target, 1, rLink);
+  if (nia.dp & 0x3)
+    sim_engine_abort (SD, CPU, cia,
+                      "0x%lx: destination address 0x%lx misaligned",
+                      (unsigned long) cia.ip,
+                      (unsigned long) nia.dp);
+  return nia;
+}
+31.Link,26.Base,21.0b100010,15.A,14.SignedOffset::::jsr i
+"jsr%s<A> <SignedOffset>, r<Link>"
+{
+  nia = do_jsr (_SD, nia, rLink, A, vSignedOffset, vBase);
+}
+31.Link,26.Base,21.0b11100010,13.A,12.0,11./,4.IndOff::::jsr r
+"jsr%s<A> r<IndOff>, r<Link>"
+{
+  nia = do_jsr (_SD, nia, rLink, A, rIndOff, vBase);
+}
+31.Link,26.Base,21.0b11100010,13.A,12.1,11./+LongSignedImmediate::::jsr l
+"jsr%s<A> <LongSignedImmediate>, r<Link>"
+{
+  nia = do_jsr (_SD, nia, rLink, A, LongSignedImmediate, vBase);
+}
+
+// ld[{.b.h.d}]
+void::function::do_ld:int Dest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset
+{
+  unsigned32 addr;
+  switch (sz)
+    {
+    case 0:
+      addr = base + (S ? (offset << 0) : offset);
+      if (m)
+        *rBase = addr;
+      GPR(Dest) = MEM (signed, addr, 1);
+      break;
+    case 1:
+      addr = base + (S ? (offset << 1) : offset);
+      if (m)
+        *rBase = addr;
+      GPR(Dest) = MEM (signed, addr, 2);
+      break;
+    case 2:
+      addr = base + (S ? (offset << 2) : offset);
+      if (m)
+        *rBase = addr;
+      GPR(Dest) = MEM (signed, addr, 4);
+      break;
+    case 3:
+      {
+        signed64 val;
+        if (Dest & 0x1)
+          sim_engine_abort (SD, CPU, cia, "0x%lx: ld.d to odd register %d",
+                            cia.ip, Dest);
+        addr = base + (S ? (offset << 3) : offset);
+        if (m)
+          *rBase = addr;
+        val = MEM (signed, addr, 8);
+        GPR(Dest + 1) = VH4_8 (val);
+        GPR(Dest + 0) = VL4_8 (val);
+      }
+      break;
+    default:
+      addr = -1;
+      sim_engine_abort (SD, CPU, cia, "ld - invalid sz %d", sz);
+    }
+  TRACE_LD (GPR(Dest), m, S, base, offset);
+}
+const char *::function::str_sz:int sz
+{
+  switch (sz)
+    {
+    case 0: return ".b";
+    case 1: return ".h";
+    case 2: return "";
+    case 3: return ".d";
+    default: return "?";
+    }
+}
+const char *::function::str_m:int m
+{
+  if (m)
+    return ":m";
+  else
+    return "";
+}
+const char *::function::str_S:int S
+{
+  if (S)
+    return ":s";
+  else
+    return "";
+}
+31.Dest,26.Base,21.0b0100,17.m,16.sz,14.SignedOffset::::ld i
+"ld%s<sz> <SignedOffset> (r<Base>%s<m>), r<Dest>"
+{
+  do_ld (_SD, Dest, vBase, rBase, m, sz, 0, vSignedOffset);
+}
+31.Dest,26.Base,21.0b110100,15.m,14.sz,12.0,11.S,10.0,9./,4.IndOff::::ld r
+"ld%s<sz> r<IndOff>%s<S> (r<Base>%s<m>), r<Dest>"
+{
+  do_ld (_SD, Dest, vBase, rBase, m, sz, S, rIndOff);
+}
+31.Dest,26.Base,21.0b110100,15.m,14.sz,12.1,11.S,10.0,9./+LongSignedImmediateOffset::::ld l
+"ld%s<sz> 0x%08lx<LongSignedImmediateOffset>%s<S> (r<Base>%s<m>), r<Dest>"
+{
+  do_ld (_SD, Dest, vBase, rBase, m, sz, S, LongSignedImmediateOffset);
+}
+
+// ld.u[{.b.h.d}]
+void::function::do_ld_u:unsigned32 *rDest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset
+{
+  unsigned32 addr;
+  switch (sz)
+    {
+    case 0:
+      addr = base + (S ? (offset << 0) : offset);
+      *rDest = MEM (unsigned, addr, 1);
+      break;
+    case 1:
+      addr = base + (S ? (offset << 1) : offset);
+      *rDest = MEM (unsigned, addr, 2);
+      break;
+    default:
+      addr = -1;
+      sim_engine_abort (SD, CPU, cia, "ld.u - invalid sz %d", sz);
+    }
+  if (m)
+    *rBase = addr;
+  TRACE_LD (m, S, *rDest, base, offset);
+}
+31.Dest,26.Base,21.0b0101,17.m,16.sz,14.SignedOffset::::ld.u i
+"ld.u%s<sz> <SignedOffset> (r<Base>%s<m>), r<Dest>"
+{
+  do_ld_u (_SD, rDest, vBase, rBase, m, sz, 0, vSignedOffset);
+}
+31.Dest,26.Base,21.0b110101,15.m,14.sz,12.0,11.S,10.0,9./,4.IndOff::::ld.u r
+"ld.u%s<sz> r<IndOff>%s<S> (r<Base>%s<m>), r<Dest>"
+{
+  do_ld_u (_SD, rDest, vBase, rBase, m, sz, S, rIndOff);
+}
+31.Dest,26.Base,21.0b110101,15.m,14.sz,12.1,11.S,10.0,9./+LongSignedImmediateOffset::::ld.u l
+"ld.u%s<sz> 0x%08lx<LongSignedImmediateOffset>%s<S> (r<Base>%s<m>), r<Dest>"
+{
+  do_ld_u (_SD, rDest, vBase, rBase, m, sz, S, LongSignedImmediateOffset);
+}
+
+// lmo
+31.Dest,26.Source,21.0b111111000,12.0,11./::::lmo
+"lmo r<Source>, r<Dest>"
+{
+  int b;
+  for (b = 0; b < 32; b++)
+    if (vSource & BIT32 (31 - b))
+      break;
+  TRACE_ALU2 (MY_INDEX, b, vSource);
+  *rDest = b;
+}
+
+
+// nop - see rdcr 0, r0
+
+
+void::function::do_or:unsigned32 *rDest, unsigned32 Source1, unsigned32 Source2
+{
+  unsigned32 result = Source1 | Source2;
+  TRACE_ALU3 (MY_INDEX, result, Source1, Source2);
+  *rDest = result;
+}
+
+// or, or.tt
+31.Dest,26.Source2,21.0b0010111,14.UnsignedImmediate::::or.tt i
+"or.tt <UnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_or (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b110010111,12.0,11./,4.Source1::::or.tt r
+"or.tt r<Source1>, r<Source2>, r<Dest>"
+{
+  do_or (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b110010111,12.1,11./+LongUnsignedImmediate::::or.tt l
+"or.tt 0x%08lx<LongUnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_or (_SD, rDest, LongUnsignedImmediate, vSource2);
+}
+
+// or.ff
+31.Dest,26.Source2,21.0b0011110,14.UnsignedImmediate::::or.ff i
+"or.ff <UnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_or (_SD, rDest, ~vSource1, ~vSource2);
+}
+31.Dest,26.Source2,21.0b110011110,12.0,11./,4.Source1::::or.ff r
+"or.ff r<Source1>, r<Source2>, r<Dest>"
+{
+  do_or (_SD, rDest, ~vSource1, ~vSource2);
+}
+31.Dest,26.Source2,21.0b110011110,12.1,11./+LongUnsignedImmediate::::or.ff l
+"or.ff 0x%08lx<LongUnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_or (_SD, rDest, ~LongUnsignedImmediate, ~vSource2);
+}
+
+// or.ft
+31.Dest,26.Source2,21.0b0011101,14.UnsignedImmediate::::or.ft i
+"or.ft <UnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_or (_SD, rDest, ~vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b110011101,12.0,11./,4.Source1::::or.ft r
+"or.ft r<Source1>, r<Source2>, r<Dest>"
+{
+  do_or (_SD, rDest, ~vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b110011101,12.1,11./+LongUnsignedImmediate::::or.ft l
+"or.ft 0x%08lx<LongUnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_or (_SD, rDest, ~LongUnsignedImmediate, vSource2);
+}
+
+// or.tf
+31.Dest,26.Source2,21.0b0011011,14.UnsignedImmediate::::or.tf i
+"or.tf <UnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_or (_SD, rDest, vSource1, ~vSource2);
+}
+31.Dest,26.Source2,21.0b110011011,12.0,11./,4.Source1::::or.tf r
+"or.tf r<Source1>, r<Source2>, r<Dest>"
+{
+  do_or (_SD, rDest, vSource1, ~vSource2);
+}
+31.Dest,26.Source2,21.0b110011011,12.1,11./+LongUnsignedImmediate::::or.tf l
+"or.tf 0x%08lx<LongUnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_or (_SD, rDest, LongUnsignedImmediate, ~vSource2);
+}
+
+// rdcr
+void::function::do_rdcr:unsigned32 Dest, int cr
+{
+  TRACE_SINK2 (MY_INDEX, Dest, cr);
+  GPR (Dest) = CR (cr);
+}
+31.Dest,26.0,21.0b0000100,14.UCRN::::rdcr i
+"rdcr CR[<UCRN>], r<Dest>"
+{
+  do_rdcr (_SD, Dest, UCRN);
+}
+31.Dest,26.0,21.0b110000100,12.0,11./,4.INDCR::::rdcr r
+"rdcr CR[r<INDCR>], r<Dest>"
+{
+  do_rdcr (_SD, Dest, UCRN);
+}
+31.Dest,26.0,21.0b110000100,12.1,11./+UnsignedControlRegisterNumber::::rdcr l
+"rdcr CR[<UnsignedControlRegisterNumber>], r<Dest>"
+{
+  do_rdcr (_SD, Dest, UnsignedControlRegisterNumber);
+}
+
+// rmo
+31.Dest,26.Source,21.0b111111001,12.0,11./::::rmo
+"rmo r<Source>, r<Dest>"
+{
+  int b;
+  for (b = 0; b < 32; b++)
+    if (vSource & BIT32 (b))
+      break;
+  if (b < 32)
+    b = 31 - b;
+  TRACE_ALU2 (MY_INDEX, b, vSource);
+  *rDest = b;
+}
+
+// rotl - see sl.dz
+
+
+// rotr - see sl.dz
+
+
+// shl - see sl.iz
+
+
+// sl.{d|e|i}{m|s|z}
+void::function::do_shift:int Dest, unsigned32 source, int Merge, int i, int n, int EndMask, int Rotate
+{
+  /* see 10-30 for a reasonable description */
+  unsigned32 input = source;
+  unsigned32 rotated;
+  unsigned32 endmask;
+  unsigned32 shiftmask;
+  unsigned32 cm;
+  int nRotate;
+  /* rotate the source */
+  if (n)
+    {
+      rotated = ROTR32 (source, Rotate);
+      nRotate = (- Rotate) & 31;
+    }
+  else
+    {
+      rotated = ROTL32 (source, Rotate);
+      nRotate = Rotate;
+    }
+  /* form the end mask */
+  if (EndMask == 0)
+    endmask = ~ (unsigned32)0;
+  else
+    endmask = (1 << EndMask) - 1;
+  if (i)
+    endmask = ~endmask;
+  /* form the shiftmask */
+  switch (Merge)
+    {
+    case 0: case 1: case 2:
+      shiftmask = ~ (unsigned32)0;  /* disabled */
+      break;
+    case 3: case 5:      /* enabled - 0 -> 32 */
+      if (nRotate == 0)
+        shiftmask = ~ (unsigned32)0;
+      else
+        shiftmask = ((1 << nRotate) - 1);  /* enabled - 0 -> 0 */
+      break;
+    case 4:
+      shiftmask = ((1 << nRotate) - 1);  /* enabled - 0 -> 0 */
+      break;
+    case 6: case 7:
+      shiftmask = ~((1 << nRotate) - 1);  /* inverted */
+      break;
+    default:
+      sim_engine_abort (SD, CPU, cia,
+                        "0x%lx: Invalid merge (%d) for shift",
+                        (long) cia.ip, (int) source);
+      shiftmask = 0;
+    }
+  /* and the composite mask */
+  cm = shiftmask & endmask;
+  /* and merge */
+  switch (Merge)
+    {
+    case 0: case 3: case 6:    /* zero */
+      GPR (Dest) = rotated & cm;
+      break;
+    case 1: case 4: case 7:    /* merge */
+      GPR (Dest) = (rotated & cm) | (GPR (Dest) & ~cm);
+      break;
+    case 2: case 5:      /* sign */
+      {
+        int b;
+        GPR (Dest) = rotated & cm;
+        for (b = 1; b <= 31; b++)
+          if (!MASKED32 (cm, b, b))
+            GPR (Dest) |= INSERTED32 (EXTRACTED32 (GPR (Dest), b - 1, b - 1),
+                                      b, b);
+      }
+      break;
+    default:
+      sim_engine_abort (SD, CPU, cia,
+                        "0x%lx: Invalid merge (%d)",
+                        (long) cia.ip, (int) source);
+    }
+  TRACE_SHIFT (MY_INDEX, GPR (Dest), input, i, n, Merge, EndMask, Rotate);
+}
+const char *::function::str_Merge:int Merge
+{
+  switch (Merge)
+    {
+    case 0: return "dz";
+    case 1: return "dm";
+    case 2: return "ds";
+    case 3: return "ez";
+    case 4: return "em";
+    case 5: return "es";
+    case 6: return "iz";
+    case 7: return "im";
+    default: return "?";
+    }
+}
+31.Dest,26.Source,21.0b0001,17.Merge,14./,11.i,10.n,9.EndMask,4.Rotate::::sl i
+"sl.%s<Merge> <Rotate>, <EndMask>, r<Source>, r<Dest>"
+{
+  do_shift (_SD, Dest, vSource, Merge, i, n, EndMask, Rotate);
+}
+31.Dest,26.Source,21.0b110001,15.Merge,12.0,11.i,10.n,9.EndMask,4.RotReg::::sl r
+"sl.%s<Merge> r<RotReg>, <EndMask>, r<Source>, r<Dest>"
+{
+  do_shift (_SD, Dest, vSource, Merge, i, n, EndMask, GPR (RotReg) & 31);
+}
+
+// sli.{d|e|i}{m|s|z} - see shift
+
+
+// sr.{d|e|i}{m|s|z} - see shift
+
+
+// sra - see sr.es - see shift
+
+
+// sri.{d|e|i}{m|s|z} - see shift
+
+
+// srl - see sr.ez
+
+
+// st[{.b|.h|.d}]
+void::function::do_st:int Source, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset
+{
+  unsigned32 addr;
+  switch (sz)
+    {
+    case 0:
+      addr = base + (S ? (offset << 0) : offset);
+      STORE (addr, 1, GPR(Source));
+      break;
+    case 1:
+      addr = base + (S ? (offset << 1) : offset);
+      STORE (addr, 2, GPR(Source));
+      break;
+    case 2:
+      addr = base + (S ? (offset << 2) : offset);
+      STORE (addr, 4, GPR(Source));
+      break;
+    case 3:
+      {
+        signed64 val;
+        if (Source & 0x1)
+          sim_engine_abort (SD, CPU, cia,
+                            "0x%lx: st.d with odd source register %d",
+                            cia.ip, Source);
+        addr = base + (S ? (offset << 3) : offset);
+        val = U8_4 (GPR(Source + 1), GPR(Source));
+        STORE (addr, 8, val);
+      }
+      break;
+    default:
+      addr = -1;
+      sim_engine_abort (SD, CPU, cia, "st - invalid sz %d", sz);
+    }
+  if (m)
+    *rBase = addr;
+  TRACE_ST (Source, m, S, base, offset);
+}
+31.Source,26.Base,21.0b0110,17.m,16.sz,14.SignedOffset::::st i
+"st%s<sz> <SignedOffset> (r<Base>%s<m>), r<Source>"
+{
+  do_st (_SD, Source, vBase, rBase, m, sz, 0, vSignedOffset);
+}
+31.Source,26.Base,21.0b110110,15.m,14.sz,12.0,11.S,10.0,9./,4.IndOff::::st r
+"st%s<sz> r<IndOff>%s<S> (r<Base>%s<m>), r<Source>"
+{
+  do_st (_SD, Source, vBase, rBase, m, sz, S, rIndOff);
+}
+31.Source,26.Base,21.0b110110,15.m,14.sz,12.1,11.S,10.0,9./+LongSignedImmediateOffset::::st l
+"st%s<sz> 0x%08lx<LongSignedImmediateOffset>%s<S> (r<Base>%s<m>), r<Source>"
+{
+  do_st (_SD, Source, vBase, rBase, m, sz, S, LongSignedImmediateOffset);
+}
+
+// sub
+void::function::do_sub:signed32 *rDest, signed32 Source1, signed32 Source2
+{
+  ALU_BEGIN (Source1);
+  ALU_SUB (Source2);
+  ALU_END (*rDest);
+  TRACE_ALU3 (MY_INDEX, *rDest, Source1, Source2);
+}
+31.Dest,26.Source2,21.0b101101,15.0,14.SignedImmediate::::sub i
+"sub <SignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_sub (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b11101101,13.0,12.0,11./,4.Source1::::sub r
+"sub r<Source1>, r<Source2>, r<Dest>"
+{
+  do_sub (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b11101101,13.0,12.1,11./+LongSignedImmediate::::sub l
+"sub 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_sub (_SD, rDest, LongSignedImmediate, vSource2);
+}
+
+// subu
+void::function::do_subu:unsigned32 *rDest, unsigned32 Source1, signed32 Source2
+{
+  unsigned32 result = Source1 - Source2;
+  TRACE_ALU3 (MY_INDEX, result, Source1, Source2);
+  *rDest = result;
+}
+// NOTE - the book has 15.1 which conflicts with subu.
+31.Dest,26.Source2,21.0b101101,15.1,14.SignedImmediate::::subu i
+"subu <SignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_subu (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b11101101,13.1,12.0,11./,4.Source1::::subu r
+"subu r<Source1>, r<Source2>, r<Dest>"
+{
+  do_subu (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b11101101,13.1,12.1,11./+LongSignedImmediate::::subu l
+"subu 0x%08lx<LongSignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_subu (_SD, rDest, LongSignedImmediate, vSource2);
+}
+
+// swcr
+void::function::do_swcr:int Dest, signed32 source, signed32 cr
+{
+  tic80_control_regs reg = tic80_index2cr (cr);
+  /* cache the old CR value */
+  unsigned32 old_cr = CR (cr);
+  /* Handle the write if allowed */
+  if (cr >= 0x4000 || !(CPU)->is_user_mode)
+    switch (reg)
+      {
+      case INTPEN_CR:
+        CR (cr) &= ~source;
+        break;
+      default:
+        CR (cr) = source;
+        break;
+      }
+  /* Finish off the read */
+  GPR (Dest) = old_cr;
+  TRACE_SINK3 (MY_INDEX, source, cr, Dest);
+}
+31.Dest,26.Source,21.0b000010,15.1,14.UCRN::::swcr i
+"swcr CR[<UCRN>], r<Dest>"
+{
+  do_swcr (_SD, Dest, vSource, UCRN);
+}
+31.Dest,26.Source,21.0b11000010,13.1,12.0,11./,4.INDCR::::swcr r
+"swcr CR[r<INDCR>], r<Dest>"
+{
+  do_swcr (_SD, Dest, vSource, UCRN);
+}
+31.Dest,26.Source,21.0b11000010,13.1,12.1,11./+LongUnsignedControlRegisterNumber::::swcr l
+"swcr CR[<LongUnsignedControlRegisterNumber>], r<Dest>"
+{
+  do_swcr (_SD, Dest, vSource, LongUnsignedControlRegisterNumber);
+}
+
+// trap
+void::function::do_trap:unsigned32 trap_number
+{
+  int i;
+  TRACE_SINK1 (MY_INDEX, trap_number);
+  switch (trap_number)
+    {
+    case 72:
+      switch (GPR(15))
+        {
+        case 1: /* EXIT */
+          {
+            sim_engine_halt (SD, CPU, NULL, cia, sim_exited, GPR(2));
+            break;
+          }
+        case 4: /* WRITE */
+          {
+            unsigned i;
+            if (GPR(2) == 1)
+        for (i = 0; i < GPR(6); i++)
+                {
+            char c;
+            c = MEM (unsigned, GPR(4) + i, 1);
+                  sim_io_write_stdout (SD, &c, 1);
+                }
+            else if (GPR(2) == 2)
+        for (i = 0; i < GPR(6); i++)
+                {
+            char c;
+            c = MEM (unsigned, GPR(4) + i, 1);
+                  sim_io_write_stderr (SD, &c, 1);
+                }
+            else
+              sim_engine_abort (SD, CPU, cia,
+                                "0x%lx: write to invalid fid %d",
+                                (long) cia.ip, (int) GPR(2));
+            GPR(2) = GPR(6);
+            break;
+          }
+        case 20: /* GETPID */
+    {
+      GPR(2) = getpid ();
+      break;
+    }
+        case 37: /* KILL */
+    if ( GPR (2) != (unsigned) getpid ())
+      {
+        int ret = kill (GPR(2), GPR(4));
+        if (ret < 0)
+          ret = -errno;
+        GPR (2) = ret;
+        break;
+      }
+    else
+      {
+        sim_engine_halt (SD, CPU, NULL, cia, sim_signalled, GPR(4));
+        break;
+      }
+        default:
+    /* For system calls which are defined, just return EINVAL instead of trapping */
+    if (GPR(15) <= 204)
+      {
+        GPR(2) = -22;    /* -EINVAL */
+        break;
+      }
+          sim_engine_abort (SD, CPU, cia,
+                            "0x%lx: unknown syscall %d",
+                            (long) cia.ip, (int) GPR(15));
+        }
+      break;
+    case 73:
+      sim_engine_halt (SD, CPU, NULL, cia, sim_stopped, SIM_SIGTRAP);
+
+    /* Add a few traps for now to print the register state */
+    case 74:
+    case 75:
+    case 76:
+    case 77:
+    case 78:
+    case 79:
+      if (!TRACE_ALU_P (CPU))
+        trace_one_insn (SD, CPU, cia.ip, 1, itable[MY_INDEX].file,
+            itable[MY_INDEX].line_nr, "trap",
+            "Trap %ld", (long) trap_number);
+
+      for (i = 0; i < 32; i++)
+        sim_io_eprintf (SD, "%s0x%.8lx%s", ((i % 8) == 0) ? "\t" : " ", (long)GPR(i),
+            (((i+1) % 8) == 0) ? "\n" : "");
+      sim_io_write_stderr (SD, "\n", 1);
+      break;
+
+    default:
+      sim_engine_abort (SD, CPU, cia,
+                        "0x%lx: unsupported trap %d",
+                        (long) cia.ip, (int) trap_number);
+    }
+}
+31./,27.0,26./,21.0b0000001,14.UTN::::trap i
+"trap <UTN>"
+{
+  do_trap (_SD, UTN);
+}
+31./,27.0,26./,21.0b110000001,12.0,11./,4.INDTR::::trap r
+"trap r<INDTR>"
+{
+  do_trap (_SD, UTN);
+}
+31./,27.0,26./,21.0b110000001,12.1,11./+UTN::::trap l
+"trap 0x%08lx<UTN>"
+{
+  do_trap (_SD, UTN);
+}
+
+// vadd.{s|d}{s|d}
+31.*,26.Dest,21.0b11110,16./,15.0b000,12.0,11./,10.*,9.*,7.PD,6.*,5.P1,4.Source::f::vadd r
+31.*,26.Dest,21.0b11110,16./,15.0b000,12.1,11./,10.*,9.*,7.PD,6.*,5.P1,4.Source::f::vadd l
+
+
+// vld{0|1}.{s|d} - see above - same instruction
+#31.Dest,26.*,21.0b11110,16.*,10.1,9.S,8.*,6.p,7.******::f::vld
+
+
+// vmac.ss{s|d}
+#31.*,   26.Source2,21.0b11110,16.a0,15.0b110,12.0,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4.Source1::f::vmac.ss ra
+31.Dest,26.Source2,21.0b11110,16.a0,15.0b110,12.0,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4.Source1::f::vmac.ss rr
+#31.*,   26.Source2,21.0b11110,16.a0,15.0b110,12.1,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4./::f::vmac.ss ia
+31.Dest,26.Source2,21.0b11110,16.a0,15.0b110,12.1,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4./::f::vmac.ss ir
+
+
+// vmpy.{s|d}{s|d}
+31.*,26.Dest,21.0b11110,16./,15.0b010,12.0,11./,10.*,8.*,7.PD,6.*,5.P1,4.Source::f::vmpy r
+31.*,26.Dest,21.0b11110,16./,15.0b010,12.1,11./,10.*,8.*,7.PD,6.*,5.P1,4./::f::vmpy l
+
+
+// vmsc.ss{s|d}
+#31.*,   26.Source2,21.0b11110,16.a0,15.0b111,12.0,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4.Source1::f::vmsc.ss ra
+31.Dest,26.Source2,21.0b11110,16.a0,15.0b111,12.0,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4.Source1::f::vmsc.ss rr
+#31.*,   26.Source2,21.0b11110,16.a0,15.0b111,12.1,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4./::f::vmsc.ss ia
+31.Dest,26.Source2,21.0b11110,16.a0,15.0b111,12.1,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4./::f::vmsc.ss ir
+
+
+// vmsub.{s|d}{s|d}
+31.*,26.Dest,21.0b11110,16.a0,15.0b011,12.0,11.a1,10.*,8.Z,7.PD,6.*,5./,4.Source::f::vmsub r
+31.*,26.Dest,21.0b11110,16.a0,15.0b011,12.1,11.a1,10.*,8.Z,7.PD,6.*,5./,4./::f::vmsub l
+
+
+// vrnd.{s|d}{s|d}
+31.*,26.Dest,21.0b11110,16.a0,15.0b100,12.0,11.a1,10.*,8.PD,6.*,5.P1,4.Source::f::vrnd f r
+31.*,26.Dest,21.0b11110,16.a0,15.0b100,12.1,11.a1,10.*,8.PD,6.*,5.P1,4./::f::vrnd f l
+
+
+// vrnd.{i|u}{s|d}
+31.*,26.Dest,21.0b11110,16./,15.0b101,12.0,11./,10.*,8./,7.PD,6.*,5.P1,4.Source::f::vrnd i r
+31.*,26.Dest,21.0b11110,16./,15.0b101,12.1,11./,10.*,8./,7.PD,6.*,5.P1,4./::f::vrnd i l
+
+
+// vst.{s|d} - see above - same instruction
+#31.Source,26.*,21.0b11110,16.*,10.0,9.S,8.*,6.1,5.*::f::vst
+
+
+// vsub.{i|u}{s|d}
+31.*,26.Dest,21.0b11110,16./,15.0b001,12.0,11./,10.*,8./,7.PD,6.*,5.P1,4.Source::f::vsub r
+31.*,26.Dest,21.0b11110,16./,15.0b001,12.1,11./,10.*,8./,7.PD,6.*,5.P1,4./::f::vsub l
+
+
+// wrcr - see swcr, creg, source, r0
+
+
+// xnor
+void::function::do_xnor:signed32 *rDest, signed32 source1, signed32 source2
+{
+  unsigned32 result = ~ (source1 ^ source2);
+  TRACE_ALU3 (MY_INDEX, result, source1, source2);
+  *rDest = result;
+}
+31.Dest,26.Source2,21.0b0011001,14.UnsignedImmediate::::xnor i
+"xnor <UnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_xnor (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b110011001,12.0,11./,4.Source1::::xnor r
+"xnor r<Source1>, r<Source2>, r<Dest>"
+{
+  do_xnor (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b110011001,12.1,11./+LongUnsignedImmediate::::xnor l
+"xnor 0x%08lx<LongUnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_xnor (_SD, rDest, LongUnsignedImmediate, vSource2);
+}
+
+// xor
+void::function::do_xor:signed32 *rDest, signed32 source1, signed32 source2
+{
+  unsigned32 result = source1 ^ source2;
+  TRACE_ALU3 (MY_INDEX, result, source1, source2);
+  *rDest = result;
+}
+31.Dest,26.Source2,21.0b0010110,14.UnsignedImmediate::::xor i
+"xor <UnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_xor (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b110010110,12.0,11./,4.Source1::::xor r
+"xor r<Source1>, r<Source2>, r<Dest>"
+{
+  do_xor (_SD, rDest, vSource1, vSource2);
+}
+31.Dest,26.Source2,21.0b110010110,12.1,11./+LongUnsignedImmediate::::xor l
+"xor 0x%08lx<LongUnsignedImmediate>, r<Source2>, r<Dest>"
+{
+  do_xor (_SD, rDest, LongUnsignedImmediate, vSource2);
+}
diff --git a/symlink-tree b/symlink-tree
index 096582d..8f11c08 100755
--- a/symlink-tree
+++ b/symlink-tree
@@ -10,6 +10,11 @@
 srcdir=$1
 ignore="$2"
 
+if test $# -lt 1; then
+  echo "symlink-tree error:  Usage: symlink-tree srcdir \"ignore1 ignore2 ...\""
+  exit 1
+fi
+
 ignore_additional=". .. CVS"
 
 # If we were invoked with a relative path name, adjust ${prog} to work
diff --git a/texinfo/texinfo.tex b/texinfo/texinfo.tex
index c49af9f..faad86b 100644
--- a/texinfo/texinfo.tex
+++ b/texinfo/texinfo.tex
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{1999-09-25.10}
+\def\texinfoversion{2000-05-28.15}
 %
 % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
 % Free Software Foundation, Inc.
@@ -214,6 +214,9 @@
     \normalturnoffactive  % \ in index entries must not stay \, e.g., if
                    % the page break happens to be in the middle of an example.
     \shipout\vbox{%
+      % Do this early so pdf references go to the beginning of the page.
+      \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
+      %
       \ifcropmarks \vbox to \outervsize\bgroup
         \hsize = \outerhsize
         \vskip-\topandbottommargin
@@ -243,8 +246,6 @@
         \unvbox\footlinebox
       \fi
       %
-      \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
-      %
       \ifcropmarks
           \egroup % end of \vbox\bgroup
         \hfil\egroup % end of (centering) \line\bgroup
@@ -891,7 +892,7 @@
     \fi}
   \def\pdfmkdest#1{\pdfdest name{#1@} xyz}
   \def\pdfmkpgn#1{#1@}
-  \let\linkcolor = \Cyan
+  \let\linkcolor = \Blue  % was Cyan, but that seems light?
   \def\endlink{\Black\pdfendlink}
   % Adding outlines to PDF; macros for calculating structure of outlines
   % come from Petr Olsak
@@ -906,7 +907,8 @@
       \closein 1 
       \indexnofonts
       \def\tt{}
-      % thanh's hack / proper braces in bookmarks  
+      \let\_ = \normalunderscore
+      % Thanh's hack / proper braces in bookmarks  
       \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
       \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
       %
@@ -1670,7 +1672,10 @@
 }
 
 % Subroutines used in generating headings
-% Produces Day Month Year style of output.
+% This produces Day Month Year style of output.
+% Only define if not already defined, in case a txi-??.tex file has set
+% up a different format (e.g., txi-cs.tex does this).
+\ifx\today\undefined
 \def\today{%
   \number\day\space
   \ifcase\month
@@ -1679,6 +1684,7 @@
   \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
   \fi
   \space\number\year}
+\fi
 
 % @settitle line...  specifies the title of the document, for headings.
 % It generates no output of its own.
@@ -4710,7 +4716,8 @@
 \def\deftypeivarheader#1#2#3{%
   \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
   \begingroup
-    \defname{#3}{\putwordInstanceVariableof\ \code{#1}}%
+    \defname{\defheaderxcond#2\relax$$$#3}
+            {\putwordInstanceVariableof\ \code{#1}}%
     \defvarargs{#3}%
   \endgroup
 }
@@ -5794,7 +5801,7 @@
 % Use @afourwide to print on European A4 paper in wide format.
 \def\afourwide{%
   \afourpaper
-  \internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}%
+  \internalpagesizes{6.5in}{9.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}%
   %
   \globaldefs = 0
 }